From: support Date: Fri, 21 Oct 2022 11:15:01 +0000 (+0000) Subject: Built motion from commit 21186556.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.openchannel?a=commitdiff_plain;h=526671bfd61106e43d5f8eb80d8e7e4e0c8ffb9a;p=motion2.git Built motion from commit 21186556.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 28c33aa..95247ef 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-21T10:22:18.173Z", + "time": "2022-10-21T11:07:24.689Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 80a5b7f..2984e78 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-21T10:22:18.173Z", + "time": "2022-10-21T11:07:24.689Z", "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 c716112..4a67956 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 _0xd928=['integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','action','contactManager'];(function(_0x370f61,_0x26dfc4){var _0x44b611=function(_0x52404d){while(--_0x52404d){_0x370f61['push'](_0x370f61['shift']());}};_0x44b611(++_0x26dfc4);}(_0xd928,0x85));var _0x8d92=function(_0x2c0f5c,_0x58bdbc){_0x2c0f5c=_0x2c0f5c-0x0;var _0x2ca3a2=_0xd928[_0x2c0f5c];return _0x2ca3a2;};'use strict';var Sequelize=require('sequelize');module[_0x8d92('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x9dc1a9){return this['getDataValue'](_0x8d92('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8d92('0x2'),_0x8d92('0x3'),_0x8d92('0x4'),'jscripty',_0x8d92('0x5'),_0x8d92('0x6'),_0x8d92('0x7'),_0x8d92('0x8')]],'msg':_0x8d92('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x8d92('0xa')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x8d92('0xa')](0x1000),'comment':_0x8d92('0xb')},'data4':{'type':Sequelize[_0x8d92('0xa')](0x1000),'comments':_0x8d92('0xc')},'data5':{'type':Sequelize[_0x8d92('0xa')](0x1000),'comments':_0x8d92('0xd')},'data6':{'type':Sequelize[_0x8d92('0xa')],'comments':_0x8d92('0xe')},'data7':{'type':Sequelize[_0x8d92('0xf')],'comments':_0x8d92('0x10')}}; \ No newline at end of file +var _0xfa74=['VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty','urlForward','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]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]'];(function(_0x3fb1c0,_0x57a877){var _0x533f47=function(_0x2b7420){while(--_0x2b7420){_0x3fb1c0['push'](_0x3fb1c0['shift']());}};_0x533f47(++_0x57a877);}(_0xfa74,0x1b0));var _0x4fa7=function(_0x31db2b,_0xb218b7){_0x31db2b=_0x31db2b-0x0;var _0x1459a0=_0xfa74[_0x31db2b];return _0x1459a0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4fa7('0x0')],'get':function(_0x4a83b7){return this[_0x4fa7('0x1')](_0x4fa7('0x2'));}},'action':{'type':Sequelize[_0x4fa7('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x4fa7('0x4'),_0x4fa7('0x5'),_0x4fa7('0x6'),_0x4fa7('0x7'),'browser','bot',_0x4fa7('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4fa7('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4fa7('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x4fa7('0xb')},'data3':{'type':Sequelize[_0x4fa7('0x3')](0x1000),'comment':_0x4fa7('0xc')},'data4':{'type':Sequelize[_0x4fa7('0x3')](0x1000),'comments':_0x4fa7('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x4fa7('0xe')},'data6':{'type':Sequelize[_0x4fa7('0x3')],'comments':_0x4fa7('0xf')},'data7':{'type':Sequelize[_0x4fa7('0x10')],'comments':_0x4fa7('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index b9df812..62c2c8f 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 _0xf5bb=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','then','error','stack','name','body','Action','catch','destroy','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x4f6dc2,_0x7c72f4){var _0x1288f0=function(_0x3509ae){while(--_0x3509ae){_0x4f6dc2['push'](_0x4f6dc2['shift']());}};_0x1288f0(++_0x7c72f4);}(_0xf5bb,0x9c));var _0xbf5b=function(_0x5b8d18,_0x1bbfa0){_0x5b8d18=_0x5b8d18-0x0;var _0x43ac37=_0xf5bb[_0x5b8d18];return _0x43ac37;};'use strict';var emlformat=require(_0xbf5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf5b('0x1'));var jsonpatch=require(_0xbf5b('0x2'));var rp=require(_0xbf5b('0x3'));var moment=require(_0xbf5b('0x4'));var BPromise=require(_0xbf5b('0x5'));var Mustache=require('mustache');var util=require(_0xbf5b('0x6'));var path=require('path');var sox=require(_0xbf5b('0x7'));var csv=require(_0xbf5b('0x8'));var ejs=require(_0xbf5b('0x9'));var fs=require('fs');var fs_extra=require(_0xbf5b('0xa'));var _=require(_0xbf5b('0xb'));var squel=require(_0xbf5b('0xc'));var crypto=require(_0xbf5b('0xd'));var jsforce=require(_0xbf5b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbf5b('0x8'));var querystring=require(_0xbf5b('0xf'));var Papa=require(_0xbf5b('0x10'));var Redis=require('ioredis');var authService=require(_0xbf5b('0x11'));var qs=require(_0xbf5b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf5b('0x13'))(_0xbf5b('0x14'));var utils=require(_0xbf5b('0x15'));var config=require(_0xbf5b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf5b('0x17'))['db'];function respondWithStatusCode(_0x3ee392,_0x4c72f6){_0x4c72f6=_0x4c72f6||0xcc;return function(_0x25386d){if(_0x25386d){return _0x3ee392[_0xbf5b('0x18')](_0x4c72f6);}return _0x3ee392[_0xbf5b('0x19')](_0x4c72f6)[_0xbf5b('0x1a')]();};}function respondWithResult(_0x4a1b1d,_0x556e3d){_0x556e3d=_0x556e3d||0xc8;return function(_0x1b6a99){if(_0x1b6a99){return _0x4a1b1d[_0xbf5b('0x19')](_0x556e3d)[_0xbf5b('0x1b')](_0x1b6a99);}};}function respondWithFilteredResult(_0x2799c4,_0x5a4d66){return function(_0x498c30){if(_0x498c30){var _0x3e3ea3=typeof _0x5a4d66['offset']===_0xbf5b('0x1c')&&typeof _0x5a4d66[_0xbf5b('0x1d')]===_0xbf5b('0x1c');var _0x1ee1d8=_0x498c30['count'];var _0x9012f3=_0x3e3ea3?0x0:_0x5a4d66['offset'];var _0x54a6ee=_0x3e3ea3?_0x498c30[_0xbf5b('0x1e')]:_0x5a4d66[_0xbf5b('0x1f')]+_0x5a4d66[_0xbf5b('0x1d')];var _0x2d79e5;if(_0x54a6ee>=_0x1ee1d8){_0x54a6ee=_0x1ee1d8;_0x2d79e5=0xc8;}else{_0x2d79e5=0xce;}_0x2799c4['status'](_0x2d79e5);return _0x2799c4[_0xbf5b('0x20')](_0xbf5b('0x21'),_0x9012f3+'-'+_0x54a6ee+'/'+_0x1ee1d8)['json'](_0x498c30);}return null;};}function patchUpdates(_0xe769cf){return function(_0x2459a0){try{jsonpatch['apply'](_0x2459a0,_0xe769cf,!![]);}catch(_0x52956e){return BPromise['reject'](_0x52956e);}return _0x2459a0[_0xbf5b('0x22')]();};}function saveUpdates(_0x2addf5,_0x38b693){return function(_0x1b7680){if(_0x1b7680){return _0x1b7680['update'](_0x2addf5)[_0xbf5b('0x23')](function(_0xc8264d){return _0xc8264d;});}return null;};}function removeEntity(_0x2a046f,_0x19121a){return function(_0x29ae9c){if(_0x29ae9c){return _0x29ae9c['destroy']()[_0xbf5b('0x23')](function(){_0x2a046f[_0xbf5b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbaec7,_0x4eddd2){return function(_0x34870a){if(!_0x34870a){_0xdbaec7[_0xbf5b('0x18')](0x194);}return _0x34870a;};}function handleError(_0x1c3df4,_0xd9be4){_0xd9be4=_0xd9be4||0x1f4;return function(_0x2fa22b){logger[_0xbf5b('0x24')](_0x2fa22b[_0xbf5b('0x25')]);if(_0x2fa22b['name']){delete _0x2fa22b[_0xbf5b('0x26')];}_0x1c3df4[_0xbf5b('0x19')](_0xd9be4)['send'](_0x2fa22b);};}exports['update']=function(_0x11656c,_0x5c1af8){if(_0x11656c[_0xbf5b('0x27')]['id']){delete _0x11656c[_0xbf5b('0x27')]['id'];}return db[_0xbf5b('0x28')]['find']({'where':{'id':_0x11656c['params']['id']}})[_0xbf5b('0x23')](handleEntityNotFound(_0x5c1af8,null))[_0xbf5b('0x23')](saveUpdates(_0x11656c[_0xbf5b('0x27')],null))[_0xbf5b('0x23')](respondWithResult(_0x5c1af8,null))[_0xbf5b('0x29')](handleError(_0x5c1af8,null));};exports[_0xbf5b('0x2a')]=function(_0x398faa,_0x33de3b){return db[_0xbf5b('0x28')]['find']({'where':{'id':_0x398faa[_0xbf5b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x33de3b,null))['then'](removeEntity(_0x33de3b,null))[_0xbf5b('0x29')](handleError(_0x33de3b,null));}; \ No newline at end of file +var _0xddb9=['limit','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','body','params','catch','Action','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined'];(function(_0x541499,_0x216973){var _0x1dba9a=function(_0x48bb68){while(--_0x48bb68){_0x541499['push'](_0x541499['shift']());}};_0x1dba9a(++_0x216973);}(_0xddb9,0x70));var _0x9ddb=function(_0x5d8b04,_0x360b56){_0x5d8b04=_0x5d8b04-0x0;var _0x507df7=_0xddb9[_0x5d8b04];return _0x507df7;};'use strict';var emlformat=require(_0x9ddb('0x0'));var rimraf=require(_0x9ddb('0x1'));var zipdir=require(_0x9ddb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ddb('0x3'));var moment=require('moment');var BPromise=require(_0x9ddb('0x4'));var Mustache=require(_0x9ddb('0x5'));var util=require(_0x9ddb('0x6'));var path=require(_0x9ddb('0x7'));var sox=require(_0x9ddb('0x8'));var csv=require(_0x9ddb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ddb('0xa'));var _=require(_0x9ddb('0xb'));var squel=require(_0x9ddb('0xc'));var crypto=require('crypto');var jsforce=require(_0x9ddb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ddb('0x9'));var querystring=require(_0x9ddb('0xe'));var Papa=require(_0x9ddb('0xf'));var Redis=require(_0x9ddb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9ddb('0x11'));var as=require(_0x9ddb('0x12'));var hardwareService=require(_0x9ddb('0x13'));var logger=require(_0x9ddb('0x14'))('api');var utils=require(_0x9ddb('0x15'));var config=require(_0x9ddb('0x16'));var licenseUtil=require(_0x9ddb('0x17'));var db=require(_0x9ddb('0x18'))['db'];function respondWithStatusCode(_0x3853e7,_0x25fcbe){_0x25fcbe=_0x25fcbe||0xcc;return function(_0x4177e2){if(_0x4177e2){return _0x3853e7['sendStatus'](_0x25fcbe);}return _0x3853e7[_0x9ddb('0x19')](_0x25fcbe)[_0x9ddb('0x1a')]();};}function respondWithResult(_0x372a43,_0x50114e){_0x50114e=_0x50114e||0xc8;return function(_0x17a95b){if(_0x17a95b){return _0x372a43[_0x9ddb('0x19')](_0x50114e)[_0x9ddb('0x1b')](_0x17a95b);}};}function respondWithFilteredResult(_0x3b3c28,_0x580655){return function(_0x16bff2){if(_0x16bff2){var _0x519ed7=typeof _0x580655['offset']===_0x9ddb('0x1c')&&typeof _0x580655[_0x9ddb('0x1d')]===_0x9ddb('0x1c');var _0x336a90=_0x16bff2['count'];var _0x4245c6=_0x519ed7?0x0:_0x580655['offset'];var _0x4f726b=_0x519ed7?_0x16bff2['count']:_0x580655[_0x9ddb('0x1e')]+_0x580655[_0x9ddb('0x1d')];var _0x5534c8;if(_0x4f726b>=_0x336a90){_0x4f726b=_0x336a90;_0x5534c8=0xc8;}else{_0x5534c8=0xce;}_0x3b3c28['status'](_0x5534c8);return _0x3b3c28[_0x9ddb('0x1f')](_0x9ddb('0x20'),_0x4245c6+'-'+_0x4f726b+'/'+_0x336a90)[_0x9ddb('0x1b')](_0x16bff2);}return null;};}function patchUpdates(_0x67fd8f){return function(_0x52c207){try{jsonpatch[_0x9ddb('0x21')](_0x52c207,_0x67fd8f,!![]);}catch(_0x3851af){return BPromise['reject'](_0x3851af);}return _0x52c207[_0x9ddb('0x22')]();};}function saveUpdates(_0x1540ef,_0x28ad34){return function(_0x444cd3){if(_0x444cd3){return _0x444cd3[_0x9ddb('0x23')](_0x1540ef)[_0x9ddb('0x24')](function(_0x5c5053){return _0x5c5053;});}return null;};}function removeEntity(_0x45de66,_0xcc5c30){return function(_0x34b231){if(_0x34b231){return _0x34b231[_0x9ddb('0x25')]()[_0x9ddb('0x24')](function(){_0x45de66[_0x9ddb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e8311,_0x4cc715){return function(_0x5e9126){if(!_0x5e9126){_0x9e8311[_0x9ddb('0x26')](0x194);}return _0x5e9126;};}function handleError(_0x2aec9b,_0x56290a){_0x56290a=_0x56290a||0x1f4;return function(_0x25a1c5){logger['error'](_0x25a1c5[_0x9ddb('0x27')]);if(_0x25a1c5[_0x9ddb('0x28')]){delete _0x25a1c5[_0x9ddb('0x28')];}_0x2aec9b[_0x9ddb('0x19')](_0x56290a)[_0x9ddb('0x29')](_0x25a1c5);};}exports[_0x9ddb('0x23')]=function(_0x31aba3,_0x5a3fd4){if(_0x31aba3[_0x9ddb('0x2a')]['id']){delete _0x31aba3[_0x9ddb('0x2a')]['id'];}return db['Action']['find']({'where':{'id':_0x31aba3[_0x9ddb('0x2b')]['id']}})[_0x9ddb('0x24')](handleEntityNotFound(_0x5a3fd4,null))[_0x9ddb('0x24')](saveUpdates(_0x31aba3['body'],null))[_0x9ddb('0x24')](respondWithResult(_0x5a3fd4,null))[_0x9ddb('0x2c')](handleError(_0x5a3fd4,null));};exports[_0x9ddb('0x25')]=function(_0xd7bb7b,_0x5e56c8){return db[_0x9ddb('0x2d')][_0x9ddb('0x2e')]({'where':{'id':_0xd7bb7b[_0x9ddb('0x2b')]['id']}})[_0x9ddb('0x24')](handleEntityNotFound(_0x5e56c8,null))[_0x9ddb('0x24')](removeEntity(_0x5e56c8,null))[_0x9ddb('0x2c')](handleError(_0x5e56c8,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 04f67a4..2f4c293 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 _0x14e0=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./action.attributes','define','tools_actions'];(function(_0x4765c3,_0x3f2f9f){var _0x3e86d9=function(_0x59b6d6){while(--_0x59b6d6){_0x4765c3['push'](_0x4765c3['shift']());}};_0x3e86d9(++_0x3f2f9f);}(_0x14e0,0x6e));var _0x014e=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0x14e0[_0x1344d6];return _0xf45b24;};'use strict';var _=require(_0x014e('0x0'));var util=require(_0x014e('0x1'));var logger=require(_0x014e('0x2'))(_0x014e('0x3'));var moment=require('moment');var BPromise=require(_0x014e('0x4'));var rp=require(_0x014e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x014e('0x6'));var attributes=require(_0x014e('0x7'));module['exports']=function(_0x58cdc6,_0x5f12e5){return _0x58cdc6[_0x014e('0x8')]('Action',attributes,{'tableName':_0x014e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15ec=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions'];(function(_0x17a395,_0x55e197){var _0x12c683=function(_0x8dd304){while(--_0x8dd304){_0x17a395['push'](_0x17a395['shift']());}};_0x12c683(++_0x55e197);}(_0x15ec,0x16c));var _0xc15e=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x15ec[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require(_0xc15e('0x0'));var logger=require(_0xc15e('0x1'))(_0xc15e('0x2'));var moment=require(_0xc15e('0x3'));var BPromise=require(_0xc15e('0x4'));var rp=require(_0xc15e('0x5'));var fs=require('fs');var path=require(_0xc15e('0x6'));var rimraf=require(_0xc15e('0x7'));var config=require(_0xc15e('0x8'));var attributes=require(_0xc15e('0x9'));module[_0xc15e('0xa')]=function(_0x4e7b48,_0x46f5d3){return _0x4e7b48['define'](_0xc15e('0xb'),attributes,{'tableName':_0xc15e('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 9683cc9..220bc24 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f2a5a,_0x10dbea){_0x2f2a5a=_0x2f2a5a-0x0;var _0x1ebf12=_0x1cb9[_0x2f2a5a];return _0x1ebf12;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xf494,0x1c6));var _0x4f49=function(_0xabf149,_0x7c2cc6){_0xabf149=_0xabf149-0x0;var _0x26bdfb=_0xf494[_0xabf149];return _0x26bdfb;};'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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 88a4046..b86fb56 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 _0x9bc6=['../../components/auth/service','../../components/interaction/service','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x46dc9e,_0x33b927){var _0x446121=function(_0x1bb285){while(--_0x1bb285){_0x46dc9e['push'](_0x46dc9e['shift']());}};_0x446121(++_0x33b927);}(_0x9bc6,0x126));var _0x69bc=function(_0x87e0dc,_0x577dce){_0x87e0dc=_0x87e0dc-0x0;var _0x2cd2d1=_0x9bc6[_0x87e0dc];return _0x2cd2d1;};'use strict';var multer=require(_0x69bc('0x0'));var util=require(_0x69bc('0x1'));var path=require(_0x69bc('0x2'));var timeout=require(_0x69bc('0x3'));var express=require('express');var router=express[_0x69bc('0x4')]();var fs_extra=require(_0x69bc('0x5'));var auth=require(_0x69bc('0x6'));var interaction=require(_0x69bc('0x7'));var config=require('../../config/environment');var controller=require(_0x69bc('0x8'));router['put']('/:id',auth[_0x69bc('0x9')](),controller[_0x69bc('0xa')]);router[_0x69bc('0xb')](_0x69bc('0xc'),auth[_0x69bc('0x9')](),controller[_0x69bc('0xd')]);module[_0x69bc('0xe')]=router; \ No newline at end of file +var _0xd0ba=['./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c797d,_0x4960ac){var _0x286e7a=function(_0x34b6b8){while(--_0x34b6b8){_0x4c797d['push'](_0x4c797d['shift']());}};_0x286e7a(++_0x4960ac);}(_0xd0ba,0xd8));var _0xad0b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xd0ba[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0xad0b('0x0'));var util=require('util');var path=require(_0xad0b('0x1'));var timeout=require(_0xad0b('0x2'));var express=require('express');var router=express[_0xad0b('0x3')]();var fs_extra=require(_0xad0b('0x4'));var auth=require(_0xad0b('0x5'));var interaction=require(_0xad0b('0x6'));var config=require(_0xad0b('0x7'));var controller=require(_0xad0b('0x8'));router[_0xad0b('0x9')](_0xad0b('0xa'),auth[_0xad0b('0xb')](),controller[_0xad0b('0xc')]);router[_0xad0b('0xd')](_0xad0b('0xa'),auth['isAuthenticated'](),controller[_0xad0b('0xe')]);module[_0xad0b('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6be6311..7740aaa 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 _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x57447f,_0x158ad1){var _0x22e71a=function(_0xcfe41d){while(--_0xcfe41d){_0x57447f['push'](_0x57447f['shift']());}};_0x22e71a(++_0x158ad1);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x16ecb8,_0x52d849){_0x16ecb8=_0x16ecb8-0x0;var _0x4b869c=_0x3f8a[_0x16ecb8];return _0x4b869c;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file +var _0x5496=['TEXT','sequelize','exports','STRING'];(function(_0x2e839a,_0xad03e6){var _0x535ede=function(_0x1cffe5){while(--_0x1cffe5){_0x2e839a['push'](_0x2e839a['shift']());}};_0x535ede(++_0xad03e6);}(_0x5496,0x175));var _0x6549=function(_0x4f7dbb,_0x150269){_0x4f7dbb=_0x4f7dbb-0x0;var _0x64f386=_0x5496[_0x4f7dbb];return _0x64f386;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6549('0x2')]},'parent':{'type':Sequelize[_0x6549('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6549('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5c931af..579a9f5 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 _0xc210=['AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','name','options','includeAll','rows','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','CustomReports','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','AnalyticMetric','findAll','keyBy','from','MetricId','function','replace','format','groupBy','group','orderBy','order','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','includes','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','metric','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','../../files/reports','savename','select','COUNT(*)','run','runReport','SEC_TO_TIME(%s)','operator','ValidationErrorItem','alias','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','index'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xc210,0x7c));var _0x0c21=function(_0x431970,_0x3d390b){_0x431970=_0x431970-0x0;var _0x3a347a=_0xc210[_0x431970];return _0x3a347a;};'use strict';var emlformat=require(_0x0c21('0x0'));var rimraf=require(_0x0c21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c21('0x2'));var rp=require(_0x0c21('0x3'));var moment=require(_0x0c21('0x4'));var BPromise=require(_0x0c21('0x5'));var Mustache=require(_0x0c21('0x6'));var util=require(_0x0c21('0x7'));var path=require(_0x0c21('0x8'));var sox=require(_0x0c21('0x9'));var csv=require(_0x0c21('0xa'));var ejs=require(_0x0c21('0xb'));var fs=require('fs');var fs_extra=require(_0x0c21('0xc'));var _=require(_0x0c21('0xd'));var squel=require(_0x0c21('0xe'));var crypto=require('crypto');var jsforce=require(_0x0c21('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0c21('0x10'));var Papa=require(_0x0c21('0x11'));var Redis=require(_0x0c21('0x12'));var authService=require(_0x0c21('0x13'));var qs=require(_0x0c21('0x14'));var as=require(_0x0c21('0x15'));var hardwareService=require(_0x0c21('0x16'));var logger=require('../../config/logger')(_0x0c21('0x17'));var utils=require(_0x0c21('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c21('0x19'))['db'];var dbH=require(_0x0c21('0x19'))[_0x0c21('0x1a')];function respondWithStatusCode(_0x3f13ab,_0x4e9cd1){_0x4e9cd1=_0x4e9cd1||0xcc;return function(_0x219915){if(_0x219915){return _0x3f13ab[_0x0c21('0x1b')](_0x4e9cd1);}return _0x3f13ab[_0x0c21('0x1c')](_0x4e9cd1)[_0x0c21('0x1d')]();};}function respondWithResult(_0x1e6991,_0x522612){_0x522612=_0x522612||0xc8;return function(_0x59af8f){if(_0x59af8f){return _0x1e6991[_0x0c21('0x1c')](_0x522612)[_0x0c21('0x1e')](_0x59af8f);}};}function respondWithFilteredResult(_0x3c5187,_0x50f86f){return function(_0xd3fa93){if(_0xd3fa93){var _0x2ea818=typeof _0x50f86f['offset']===_0x0c21('0x1f')&&typeof _0x50f86f[_0x0c21('0x20')]===_0x0c21('0x1f');var _0x52afdb=_0xd3fa93['count'];var _0x208ed6=_0x2ea818?0x0:_0x50f86f[_0x0c21('0x21')];var _0x4e1ba6=_0x2ea818?_0xd3fa93[_0x0c21('0x22')]:_0x50f86f['offset']+_0x50f86f[_0x0c21('0x20')];var _0x184f99;if(_0x4e1ba6>=_0x52afdb){_0x4e1ba6=_0x52afdb;_0x184f99=0xc8;}else{_0x184f99=0xce;}_0x3c5187['status'](_0x184f99);return _0x3c5187[_0x0c21('0x23')](_0x0c21('0x24'),_0x208ed6+'-'+_0x4e1ba6+'/'+_0x52afdb)['json'](_0xd3fa93);}return null;};}function patchUpdates(_0x199622){return function(_0x5753f0){try{jsonpatch[_0x0c21('0x25')](_0x5753f0,_0x199622,!![]);}catch(_0x36e1d0){return BPromise[_0x0c21('0x26')](_0x36e1d0);}return _0x5753f0[_0x0c21('0x27')]();};}function saveUpdates(_0x3b71e3,_0x4f1a66){return function(_0x570313){if(_0x570313){return _0x570313[_0x0c21('0x28')](_0x3b71e3)[_0x0c21('0x29')](function(_0x606d3){return _0x606d3;});}return null;};}function removeEntity(_0x2ef9f0,_0x136cd5){return function(_0x3f9e91){if(_0x3f9e91){return _0x3f9e91[_0x0c21('0x2a')]()[_0x0c21('0x29')](function(){var _0x47eaf1=_0x3f9e91[_0x0c21('0x2b')]({'plain':!![]});var _0x1950a2='CustomReports';return db[_0x0c21('0x2c')][_0x0c21('0x2a')]({'where':{'type':_0x1950a2,'resourceId':_0x47eaf1['id']}})[_0x0c21('0x29')](function(){return _0x3f9e91;});})[_0x0c21('0x29')](function(){_0x2ef9f0[_0x0c21('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2355b6,_0x56d863){return function(_0x2b8b14){if(!_0x2b8b14){_0x2355b6[_0x0c21('0x1b')](0x194);}return _0x2b8b14;};}function handleError(_0x48b6f1,_0x1586bb){_0x1586bb=_0x1586bb||0x1f4;return function(_0x2ab69a){logger[_0x0c21('0x2d')](_0x2ab69a[_0x0c21('0x2e')]);if(_0x2ab69a['name']){delete _0x2ab69a['name'];}_0x48b6f1[_0x0c21('0x1c')](_0x1586bb)[_0x0c21('0x2f')](_0x2ab69a);};}exports[_0x0c21('0x30')]=function(_0x567484,_0x101351){var _0x2b5ad8={},_0x8211b1={},_0x209ee4={'count':0x0,'rows':[]};var _0x15b491=_['map'](db[_0x0c21('0x31')][_0x0c21('0x32')],function(_0x5dad89){return{'name':_0x5dad89[_0x0c21('0x33')],'type':_0x5dad89['type'][_0x0c21('0x34')]};});_0x8211b1[_0x0c21('0x35')]=_['map'](_0x15b491,'name');_0x8211b1[_0x0c21('0x36')]=_['keys'](_0x567484[_0x0c21('0x36')]);_0x8211b1[_0x0c21('0x37')]=_['intersection'](_0x8211b1[_0x0c21('0x35')],_0x8211b1[_0x0c21('0x36')]);_0x2b5ad8[_0x0c21('0x38')]=_[_0x0c21('0x39')](_0x8211b1[_0x0c21('0x35')],qs['fields'](_0x567484[_0x0c21('0x36')][_0x0c21('0x3a')]));_0x2b5ad8['attributes']=_0x2b5ad8[_0x0c21('0x38')][_0x0c21('0x3b')]?_0x2b5ad8[_0x0c21('0x38')]:_0x8211b1[_0x0c21('0x35')];if(!_0x567484[_0x0c21('0x36')][_0x0c21('0x3c')](_0x0c21('0x3d'))){_0x2b5ad8[_0x0c21('0x20')]=qs['limit'](_0x567484[_0x0c21('0x36')][_0x0c21('0x20')]);_0x2b5ad8[_0x0c21('0x21')]=qs[_0x0c21('0x21')](_0x567484[_0x0c21('0x36')][_0x0c21('0x21')]);}_0x2b5ad8['order']=qs[_0x0c21('0x3e')](_0x567484[_0x0c21('0x36')][_0x0c21('0x3e')]);_0x2b5ad8[_0x0c21('0x3f')]=qs['filters'](_[_0x0c21('0x40')](_0x567484[_0x0c21('0x36')],_0x8211b1[_0x0c21('0x37')]),_0x15b491);if(_0x567484[_0x0c21('0x36')][_0x0c21('0x41')]){_0x2b5ad8['where']=_[_0x0c21('0x42')](_0x2b5ad8['where'],{'$or':_[_0x0c21('0x43')](_0x15b491,function(_0x2665b8){if(_0x2665b8[_0x0c21('0x44')]!==_0x0c21('0x45')){var _0x2bba41={};_0x2bba41[_0x2665b8[_0x0c21('0x46')]]={'$like':'%'+_0x567484[_0x0c21('0x36')][_0x0c21('0x41')]+'%'};return _0x2bba41;}})});}_0x2b5ad8=_['merge']({},_0x2b5ad8,_0x567484[_0x0c21('0x47')]);var _0x39d6df={'where':_0x2b5ad8['where']};return db[_0x0c21('0x31')][_0x0c21('0x22')](_0x39d6df)[_0x0c21('0x29')](function(_0x4a6d74){_0x209ee4[_0x0c21('0x22')]=_0x4a6d74;if(_0x567484[_0x0c21('0x36')][_0x0c21('0x48')]){_0x2b5ad8['include']=[{'all':!![]}];}return db[_0x0c21('0x31')]['findAll'](_0x2b5ad8);})[_0x0c21('0x29')](function(_0x4838e9){_0x209ee4[_0x0c21('0x49')]=_0x4838e9;return _0x209ee4;})['then'](respondWithFilteredResult(_0x101351,_0x2b5ad8))['catch'](handleError(_0x101351,null));};exports[_0x0c21('0x4a')]=function(_0x350e10,_0x21a949){var _0x19c795={'raw':![],'where':{'id':_0x350e10[_0x0c21('0x4b')]['id']}},_0x104b6f={};_0x104b6f['model']=_[_0x0c21('0x4c')](db['AnalyticCustomReport'][_0x0c21('0x32')]);_0x104b6f[_0x0c21('0x36')]=_[_0x0c21('0x4c')](_0x350e10[_0x0c21('0x36')]);_0x104b6f[_0x0c21('0x37')]=_[_0x0c21('0x39')](_0x104b6f['model'],_0x104b6f['query']);_0x19c795[_0x0c21('0x38')]=_[_0x0c21('0x39')](_0x104b6f[_0x0c21('0x35')],qs[_0x0c21('0x3a')](_0x350e10['query'][_0x0c21('0x3a')]));_0x19c795[_0x0c21('0x38')]=_0x19c795['attributes'][_0x0c21('0x3b')]?_0x19c795[_0x0c21('0x38')]:_0x104b6f['model'];if(_0x350e10[_0x0c21('0x36')]['includeAll']){_0x19c795[_0x0c21('0x4d')]=[{'all':!![]}];}_0x19c795=_[_0x0c21('0x42')]({},_0x19c795,_0x350e10[_0x0c21('0x47')]);return db[_0x0c21('0x31')][_0x0c21('0x4e')](_0x19c795)[_0x0c21('0x29')](handleEntityNotFound(_0x21a949,null))[_0x0c21('0x29')](respondWithResult(_0x21a949,null))[_0x0c21('0x4f')](handleError(_0x21a949,null));};exports[_0x0c21('0x50')]=function(_0x5bb9c0,_0x50f29c){return db[_0x0c21('0x31')]['create'](_0x5bb9c0[_0x0c21('0x51')],{})[_0x0c21('0x29')](function(_0x6495e5){var _0x3c4716=_0x5bb9c0[_0x0c21('0x52')][_0x0c21('0x2b')]({'plain':!![]});if(!_0x3c4716)throw new Error(_0x0c21('0x53'));if(_0x3c4716['role']===_0x0c21('0x52')){var _0x2b5e19=_0x6495e5[_0x0c21('0x2b')]({'plain':!![]});var _0x43736d=_0x0c21('0x54');return db[_0x0c21('0x55')][_0x0c21('0x4e')]({'where':{'name':_0x43736d,'userProfileId':_0x3c4716['userProfileId']},'raw':!![]})[_0x0c21('0x29')](function(_0x4078ea){if(_0x4078ea&&_0x4078ea[_0x0c21('0x56')]===0x0){return db[_0x0c21('0x2c')]['create']({'name':_0x2b5e19['name'],'resourceId':_0x2b5e19['id'],'type':_0x0c21('0x57'),'sectionId':_0x4078ea['id']},{})[_0x0c21('0x29')](function(){return _0x6495e5;});}else{return _0x6495e5;}})['catch'](function(_0x1f3bd3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f3bd3);throw _0x1f3bd3;});}return _0x6495e5;})['then'](respondWithResult(_0x50f29c,0xc9))[_0x0c21('0x4f')](handleError(_0x50f29c,null));};exports[_0x0c21('0x28')]=function(_0x17a16e,_0x3e0119){if(_0x17a16e['body']['id']){delete _0x17a16e[_0x0c21('0x51')]['id'];}return db[_0x0c21('0x31')][_0x0c21('0x4e')]({'where':{'id':_0x17a16e[_0x0c21('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e0119,null))[_0x0c21('0x29')](saveUpdates(_0x17a16e[_0x0c21('0x51')],null))[_0x0c21('0x29')](respondWithResult(_0x3e0119,null))['catch'](handleError(_0x3e0119,null));};exports['destroy']=function(_0xa40f94,_0x3c227f){return db[_0x0c21('0x31')][_0x0c21('0x4e')]({'where':{'id':_0xa40f94[_0x0c21('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c227f,null))[_0x0c21('0x29')](removeEntity(_0x3c227f,null))[_0x0c21('0x4f')](handleError(_0x3c227f,null));};exports[_0x0c21('0x58')]=function(_0x578767,_0x3458a2){var _0x5d5f94=0xa;var _0x10d966=[_0x0c21('0x59'),'left_join',_0x0c21('0x5a'),_0x0c21('0x5b')];var _0xd84e04={'SUM':_0x0c21('0x5c'),'COUNT':_0x0c21('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x0c21('0x5e'),'GROUP_CONCAT ASC':_0x0c21('0x5f'),'GROUP_CONCAT DESC':_0x0c21('0x60')};var _0x5f2f41={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0c21('0x61'),'HOUR':_0x0c21('0x62'),'ROUND':_0x0c21('0x63'),'UNIX_TIMESTAMP':_0x0c21('0x64')};var _0x5e1836=function(_0x478761){return!_['includes']([_0x0c21('0x65'),_0x0c21('0x66'),_0x0c21('0x67'),_0x0c21('0x68')],_0x478761);};var _0x498cf2=function(_0xc6761c){if(!_0xc6761c||!_0xc6761c[_0x0c21('0x69')]['length']){return'';}for(var _0x96b66e='(',_0x2c1b02=0x0;_0x2c1b02<_0xc6761c[_0x0c21('0x69')]['length'];_0x2c1b02+=0x1){_0x2c1b02>0x0&&(_0x96b66e+='\x20'+_0xc6761c['operator']+'\x20');_0x96b66e+=_0xc6761c[_0x0c21('0x69')][_0x2c1b02]['group']?_0x498cf2(_0xc6761c['rules'][_0x2c1b02]['group']):_0xc6761c[_0x0c21('0x69')][_0x2c1b02][_0x0c21('0x6a')]+'\x20'+_0xc6761c[_0x0c21('0x69')][_0x2c1b02][_0x0c21('0x6b')]+(_0x5e1836(_0xc6761c[_0x0c21('0x69')][_0x2c1b02][_0x0c21('0x6b')])?'\x20'+_0xc6761c[_0x0c21('0x69')][_0x2c1b02][_0x0c21('0x6c')]:'');}return _0x96b66e+')';};var _0x48aefe={'where':{'id':_0x578767[_0x0c21('0x4b')]['id']}},_0x360445,_0x2a18d0,_0x596d61,_0x569240,_0xba2ce8;_0x48aefe=_[_0x0c21('0x42')]({},_0x48aefe,_0x578767[_0x0c21('0x47')]);return db['AnalyticCustomReport'][_0x0c21('0x4e')](_0x48aefe)['then'](function(_0x29cbbe){if(_0x29cbbe){_0x360445=_0x29cbbe;return _0x29cbbe['getFields']();}return null;})[_0x0c21('0x29')](function(_0x6459ae){if(_0x6459ae){if(!_0x6459ae[_0x0c21('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a18d0=_0x6459ae;return db[_0x0c21('0x6d')][_0x0c21('0x6e')]({'raw':!![]});}return null;})[_0x0c21('0x29')](function(_0x544eff){if(_0x544eff){_0x596d61=_[_0x0c21('0x6f')](_0x544eff,'id');var _0x4fddc7;var _0x398427=squel['select']();_0x398427[_0x0c21('0x70')](_0x360445['table']);for(var _0x2c0fc8=0x0;_0x2c0fc8<_0x2a18d0['length'];_0x2c0fc8+=0x1){_0x4fddc7=_0x2a18d0[_0x2c0fc8]['MetricId']?_0x596d61[_0x2a18d0[_0x2c0fc8][_0x0c21('0x71')]]['metric']:_0x2a18d0[_0x2c0fc8][_0x0c21('0x6a')];_0x4fddc7=_0x2a18d0[_0x2c0fc8][_0x0c21('0x72')]?_[_0x0c21('0x73')](_0xd84e04[_0x2a18d0[_0x2c0fc8][_0x0c21('0x72')]],'%s',_0x4fddc7):_0x4fddc7;_0x4fddc7=_0x2a18d0[_0x2c0fc8][_0x0c21('0x74')]?_[_0x0c21('0x73')](_0x5f2f41[_0x2a18d0[_0x2c0fc8][_0x0c21('0x74')]],'%s',_0x4fddc7):_0x4fddc7;if(_0x2a18d0[_0x2c0fc8][_0x0c21('0x75')]){_0x398427[_0x0c21('0x76')](_0x4fddc7);}_0x2a18d0[_0x2c0fc8][_0x0c21('0x77')]&&_0x398427[_0x0c21('0x78')](_0x4fddc7,_0x2a18d0[_0x2c0fc8][_0x0c21('0x77')]===_0x0c21('0x79')?![]:!![]);_0x398427[_0x0c21('0x6a')](_0x4fddc7,_0x2a18d0[_0x2c0fc8]['alias']||_0x4fddc7);}if(_0x360445[_0x0c21('0x7a')]){_0x360445[_0x0c21('0x7a')]=JSON[_0x0c21('0x7b')](_0x360445[_0x0c21('0x7a')]);for(var _0x544733=0x0;_0x544733<_0x360445['joins'][_0x0c21('0x3b')];_0x544733+=0x1){if(_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x44')]&&_['includes'](_0x10d966,_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x44')])&&_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x7c')]&&_0x360445['joins'][_0x544733][_0x0c21('0x7d')]&&_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x7e')]){_0x398427[_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x44')]](_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x7d')],null,util[_0x0c21('0x74')](_0x0c21('0x7f'),_0x360445[_0x0c21('0x80')],_0x360445['joins'][_0x544733][_0x0c21('0x7c')],_0x360445['joins'][_0x544733][_0x0c21('0x7d')],_0x360445[_0x0c21('0x7a')][_0x544733][_0x0c21('0x7e')]));}}}if(_0x360445[_0x0c21('0x81')]){_0x360445[_0x0c21('0x81')]=JSON[_0x0c21('0x7b')](_0x360445['conditions']);_0x398427[_0x0c21('0x3f')](_0x498cf2(_0x360445[_0x0c21('0x81')]['group']));}_0xba2ce8=_0x398427[_0x0c21('0x82')]();_0x398427[_0x0c21('0x20')](_0x5d5f94);_0x398427['offset'](0x0);logger[_0x0c21('0x83')](_0x0c21('0x84'),_0x398427['toString']());return dbH[_0x0c21('0x85')][_0x0c21('0x36')](_0x398427['toString'](),{'type':dbH[_0x0c21('0x85')][_0x0c21('0x86')][_0x0c21('0x87')]});}})[_0x0c21('0x29')](respondWithResult(_0x3458a2,null))['catch'](handleError(_0x3458a2,null));};function runReport(_0x460001,_0x3e208c,_0x47bb49){var _0x20ee1d=_0x3e208c[_0x0c21('0x46')];var _0x28b763=0xa;var _0x139445=['join',_0x0c21('0x88'),_0x0c21('0x5a'),_0x0c21('0x5b')];var _0x205ff5={'SUM':_0x0c21('0x5c'),'COUNT':_0x0c21('0x5d'),'COUNT DISTINCT':_0x0c21('0x89'),'MAX':_0x0c21('0x8a'),'MIN':_0x0c21('0x8b'),'AVG':_0x0c21('0x8c'),'GROUP_CONCAT':_0x0c21('0x5e'),'GROUP_CONCAT ASC':_0x0c21('0x5f'),'GROUP_CONCAT DESC':_0x0c21('0x60')};var _0x1c399f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x0c21('0x64')};var _0x54702c=function(_0x196a77){return!_[_0x0c21('0x8d')]([_0x0c21('0x65'),'IS\x20NOT\x20NULL',_0x0c21('0x67'),_0x0c21('0x68')],_0x196a77);};var _0x1601b3=function(_0x28e29f){if(!_0x28e29f||!_0x28e29f[_0x0c21('0x69')][_0x0c21('0x3b')]){return'';}for(var _0x12df7e='(',_0x10aaf3=0x0;_0x10aaf3<_0x28e29f['rules'][_0x0c21('0x3b')];_0x10aaf3+=0x1){_0x10aaf3>0x0&&(_0x12df7e+='\x20'+_0x28e29f['operator']+'\x20');_0x12df7e+=_0x28e29f[_0x0c21('0x69')][_0x10aaf3][_0x0c21('0x76')]?_0x1601b3(_0x28e29f[_0x0c21('0x69')][_0x10aaf3][_0x0c21('0x76')]):_0x28e29f[_0x0c21('0x69')][_0x10aaf3][_0x0c21('0x6a')]+'\x20'+_0x28e29f[_0x0c21('0x69')][_0x10aaf3]['condition']+(_0x54702c(_0x28e29f[_0x0c21('0x69')][_0x10aaf3][_0x0c21('0x6b')])?'\x20'+_0x28e29f['rules'][_0x10aaf3]['value']:'');}return _0x12df7e+')';};var _0x414e8b={'where':{'id':_0x460001['id']}},_0x155245,_0x342731,_0x329350,_0x273f6f,_0x4c4ec3;_0x414e8b=_[_0x0c21('0x42')]({},_0x414e8b,_0x47bb49);return db[_0x0c21('0x31')]['find'](_0x414e8b)[_0x0c21('0x29')](function(_0x5e26ab){if(_0x5e26ab){_0x155245=_0x5e26ab;return _0x5e26ab[_0x0c21('0x8e')]();}return null;})[_0x0c21('0x29')](function(_0x51188f){if(_0x51188f){if(!_0x51188f[_0x0c21('0x3b')]){throw new db[(_0x0c21('0x8f'))]['ValidationErrorItem'](_0x0c21('0x90'),0x193);}_0x342731=_0x51188f;return db['AnalyticMetric'][_0x0c21('0x6e')]({'raw':!![]});}return null;})[_0x0c21('0x29')](function(_0x2d54f1){if(_0x2d54f1){_0x329350=_[_0x0c21('0x6f')](_0x2d54f1,'id');var _0x1d1dd9;var _0x469196=squel['select']();_0x469196[_0x0c21('0x70')](_0x155245[_0x0c21('0x80')]);for(var _0x294488=0x0;_0x294488<_0x342731[_0x0c21('0x3b')];_0x294488+=0x1){_0x1d1dd9=_0x342731[_0x294488][_0x0c21('0x71')]?_0x329350[_0x342731[_0x294488][_0x0c21('0x71')]][_0x0c21('0x91')]:_0x342731[_0x294488][_0x0c21('0x6a')];_0x1d1dd9=_0x342731[_0x294488][_0x0c21('0x72')]?_[_0x0c21('0x73')](_0x205ff5[_0x342731[_0x294488][_0x0c21('0x72')]],'%s',_0x1d1dd9):_0x1d1dd9;_0x1d1dd9=_0x342731[_0x294488]['format']?_[_0x0c21('0x73')](_0x1c399f[_0x342731[_0x294488]['format']],'%s',_0x1d1dd9):_0x1d1dd9;if(_0x342731[_0x294488]['groupBy']){_0x469196[_0x0c21('0x76')](_0x1d1dd9);}_0x342731[_0x294488][_0x0c21('0x77')]&&_0x469196['order'](_0x1d1dd9,_0x342731[_0x294488][_0x0c21('0x77')]===_0x0c21('0x79')?![]:!![]);_0x469196[_0x0c21('0x6a')](_0x1d1dd9,_0x342731[_0x294488]['alias']||_0x1d1dd9);}if(_0x155245[_0x0c21('0x7a')]){_0x155245[_0x0c21('0x7a')]=JSON[_0x0c21('0x7b')](_0x155245['joins']);for(var _0x55ccc1=0x0;_0x55ccc1<_0x155245[_0x0c21('0x7a')]['length'];_0x55ccc1+=0x1){if(_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x44')]&&_[_0x0c21('0x8d')](_0x139445,_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x44')])&&_0x155245[_0x0c21('0x7a')][_0x55ccc1]['parentKey']&&_0x155245[_0x0c21('0x7a')][_0x55ccc1]['foreignTable']&&_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x7e')]){_0x469196[_0x155245['joins'][_0x55ccc1][_0x0c21('0x44')]](_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x155245[_0x0c21('0x80')],_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x7c')],_0x155245['joins'][_0x55ccc1][_0x0c21('0x7d')],_0x155245[_0x0c21('0x7a')][_0x55ccc1][_0x0c21('0x7e')]));}}}if(_0x155245['conditions']){_0x155245[_0x0c21('0x81')]=JSON['parse'](_0x155245[_0x0c21('0x81')]);_0x469196['where'](_0x1601b3(_0x155245[_0x0c21('0x81')][_0x0c21('0x76')]));}_0x4c4ec3=_0x469196[_0x0c21('0x82')]();_0x469196[_0x0c21('0x20')](_0x28b763);_0x469196['offset'](0x0);return;}})[_0x0c21('0x29')](function(){if(_0x3e208c[_0x0c21('0x92')]===_0x0c21('0x93')){return null;}var _0x6ab66e=_[_0x0c21('0x42')](_0x3e208c,{'name':_0x3e208c[_0x0c21('0x94')]||_0x3e208c['name']||_0x155245[_0x0c21('0x46')],'basename':_0x20ee1d,'savename':util[_0x0c21('0x74')]('%s-%s.%s',_0x3e208c['name']||_0x155245[_0x0c21('0x46')],require(_0x0c21('0x95'))[_0x0c21('0x96')](0x4),_0x3e208c[_0x0c21('0x92')]||_0x0c21('0x97')),'reportId':_0x155245['id'],'reportType':_0x0c21('0x98')});return db[_0x0c21('0x99')][_0x0c21('0x50')](_0x6ab66e,{'raw':!![]});})[_0x0c21('0x29')](function(_0x33fd56){if(_0x155245[_0x0c21('0x80')]===_0x0c21('0x9a')){_0x4c4ec3['where'](_0x155245[_0x0c21('0x80')]+_0x0c21('0x9b'),_0x3e208c[_0x0c21('0x9c')],_0x3e208c[_0x0c21('0x9d')]);}else{_0x4c4ec3[_0x0c21('0x3f')](_0x155245['table']+_0x0c21('0x9e'),_0x3e208c['startDate'],_0x3e208c['endDate']);}if(_0x33fd56){logger[_0x0c21('0x9f')](_0x0c21('0xa0'),_0x4c4ec3[_0x0c21('0xa1')]());require(_0x0c21('0xa2'))['fork'](path[_0x0c21('0x59')](__dirname,'../../components/export/',_0x33fd56[_0x0c21('0x92')]),[_0x33fd56['id'],_0x4c4ec3['toString'](),path[_0x0c21('0x59')](__dirname,_0x0c21('0xa3'),_0x33fd56[_0x0c21('0xa4')]),_0x20ee1d]);return _0x33fd56;}else{var _0x25d49a=squel[_0x0c21('0xa5')]();_0x25d49a[_0x0c21('0x70')]('('+_0x4c4ec3[_0x0c21('0xa1')]()+')','countTable');_0x25d49a[_0x0c21('0x6a')](_0x0c21('0xa6'),'count');_0x4c4ec3['limit'](_0x3e208c[_0x0c21('0x20')]||_0x28b763);_0x4c4ec3[_0x0c21('0x21')](_0x3e208c[_0x0c21('0x21')]||0x0);return dbH[_0x0c21('0x85')][_0x0c21('0x36')](_0x25d49a[_0x0c21('0xa1')](),{'type':dbH['sequelize']['QueryTypes'][_0x0c21('0x87')]})[_0x0c21('0x29')](function(_0x51fc26){if(!_0x51fc26[_0x0c21('0x3b')]){_0x273f6f=0x0;}else{_0x273f6f=_0x51fc26[0x0][_0x0c21('0x22')]||0x0;}return dbH[_0x0c21('0x85')][_0x0c21('0x36')](_0x4c4ec3[_0x0c21('0xa1')](),{'type':dbH['sequelize'][_0x0c21('0x86')][_0x0c21('0x87')]});})[_0x0c21('0x29')](function(_0x19c6e9){return{'rows':_0x19c6e9||[],'count':_0x273f6f};});}});}exports[_0x0c21('0xa7')]=function(_0x186290,_0x579d2c){return runReport(_0x186290[_0x0c21('0x4b')],_0x186290[_0x0c21('0x36')],_0x186290['options'])[_0x0c21('0x29')](respondWithResult(_0x579d2c,null))[_0x0c21('0x4f')](handleError(_0x579d2c,null));};exports[_0x0c21('0xa8')]=runReport;exports[_0x0c21('0x36')]=function(_0x528bad,_0x241b9f){var _0x365f58=0xa;var _0xcbaedd=[_0x0c21('0x59'),_0x0c21('0x88'),_0x0c21('0x5a'),'cross_join'];var _0x4d11c5={'SUM':'SUM(%s)','COUNT':_0x0c21('0x5d'),'COUNT DISTINCT':_0x0c21('0x89'),'MAX':_0x0c21('0x8a'),'MIN':_0x0c21('0x8b'),'AVG':_0x0c21('0x8c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x0c21('0x5f'),'GROUP_CONCAT DESC':_0x0c21('0x60')};var _0x374746={'SEC_TO_TIME':_0x0c21('0xa9'),'DATE':_0x0c21('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x0c21('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x36ca1e=function(_0xb513df){return!_[_0x0c21('0x8d')](['IS\x20NULL',_0x0c21('0x66'),_0x0c21('0x67'),'IS\x20NOT\x20EMPTY'],_0xb513df);};var _0x5af4f7=function(_0x44fadd){if(!_0x44fadd||!_0x44fadd[_0x0c21('0x69')]['length']){return'';}for(var _0x2418e8='(',_0x21afec=0x0;_0x21afec<_0x44fadd[_0x0c21('0x69')][_0x0c21('0x3b')];_0x21afec+=0x1){_0x21afec>0x0&&(_0x2418e8+='\x20'+_0x44fadd[_0x0c21('0xaa')]+'\x20');_0x2418e8+=_0x44fadd[_0x0c21('0x69')][_0x21afec]['group']?_0x5af4f7(_0x44fadd[_0x0c21('0x69')][_0x21afec][_0x0c21('0x76')]):_0x44fadd['rules'][_0x21afec][_0x0c21('0x6a')]+'\x20'+_0x44fadd['rules'][_0x21afec]['condition']+(_0x36ca1e(_0x44fadd[_0x0c21('0x69')][_0x21afec][_0x0c21('0x6b')])?'\x20'+_0x44fadd[_0x0c21('0x69')][_0x21afec][_0x0c21('0x6c')]:'');}return _0x2418e8+')';};var _0x5bd68a={'where':{'id':_0x528bad[_0x0c21('0x4b')]['id']}},_0x2a8c11,_0x582d91,_0x465ae4,_0x28bc2a,_0x555977;_0x5bd68a=_[_0x0c21('0x42')]({},_0x5bd68a,_0x528bad[_0x0c21('0x47')]);return db['AnalyticCustomReport'][_0x0c21('0x4e')](_0x5bd68a)['then'](function(_0x1b2b98){if(_0x1b2b98){_0x2a8c11=_0x1b2b98;return _0x1b2b98[_0x0c21('0x8e')]();}return null;})[_0x0c21('0x29')](function(_0x2d060e){if(_0x2d060e){if(!_0x2d060e[_0x0c21('0x3b')]){throw new db[(_0x0c21('0x8f'))][(_0x0c21('0xab'))](_0x0c21('0x90'),0x193);}_0x582d91=_0x2d060e;return db[_0x0c21('0x6d')][_0x0c21('0x6e')]({'raw':!![]});}return null;})[_0x0c21('0x29')](function(_0x5582d1){if(_0x5582d1){_0x465ae4=_[_0x0c21('0x6f')](_0x5582d1,'id');var _0x5fd204;var _0x37cb38=squel[_0x0c21('0xa5')]();_0x37cb38[_0x0c21('0x70')](_0x2a8c11[_0x0c21('0x80')]);for(var _0x269173=0x0;_0x269173<_0x582d91[_0x0c21('0x3b')];_0x269173+=0x1){_0x5fd204=_0x582d91[_0x269173][_0x0c21('0x71')]?_0x465ae4[_0x582d91[_0x269173][_0x0c21('0x71')]][_0x0c21('0x91')]:_0x582d91[_0x269173][_0x0c21('0x6a')];_0x5fd204=_0x582d91[_0x269173][_0x0c21('0x72')]?_['replace'](_0x4d11c5[_0x582d91[_0x269173][_0x0c21('0x72')]],'%s',_0x5fd204):_0x5fd204;_0x5fd204=_0x582d91[_0x269173]['format']?_[_0x0c21('0x73')](_0x374746[_0x582d91[_0x269173][_0x0c21('0x74')]],'%s',_0x5fd204):_0x5fd204;if(_0x582d91[_0x269173]['groupBy']){_0x37cb38[_0x0c21('0x76')](_0x5fd204);}_0x582d91[_0x269173]['orderBy']&&_0x37cb38[_0x0c21('0x78')](_0x5fd204,_0x582d91[_0x269173][_0x0c21('0x77')]===_0x0c21('0x79')?![]:!![]);_0x37cb38['field'](_0x5fd204,_0x582d91[_0x269173][_0x0c21('0xac')]||_0x5fd204);}if(_0x2a8c11[_0x0c21('0x7a')]){_0x2a8c11[_0x0c21('0x7a')]=JSON['parse'](_0x2a8c11['joins']);for(var _0x1f3dfd=0x0;_0x1f3dfd<_0x2a8c11[_0x0c21('0x7a')][_0x0c21('0x3b')];_0x1f3dfd+=0x1){if(_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd][_0x0c21('0x44')]&&_[_0x0c21('0x8d')](_0xcbaedd,_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd]['type'])&&_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd]['parentKey']&&_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd][_0x0c21('0x7d')]&&_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd]['foreignKey']){_0x37cb38[_0x2a8c11['joins'][_0x1f3dfd][_0x0c21('0x44')]](_0x2a8c11['joins'][_0x1f3dfd]['foreignTable'],null,util[_0x0c21('0x74')](_0x0c21('0x7f'),_0x2a8c11[_0x0c21('0x80')],_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd][_0x0c21('0x7c')],_0x2a8c11[_0x0c21('0x7a')][_0x1f3dfd][_0x0c21('0x7d')],_0x2a8c11['joins'][_0x1f3dfd][_0x0c21('0x7e')]));}}}if(_0x2a8c11[_0x0c21('0x81')]){_0x2a8c11[_0x0c21('0x81')]=JSON[_0x0c21('0x7b')](_0x2a8c11['conditions']);_0x37cb38['where'](_0x5af4f7(_0x2a8c11[_0x0c21('0x81')][_0x0c21('0x76')]));}_0x555977=_0x37cb38[_0x0c21('0x82')]();_0x37cb38[_0x0c21('0x20')](_0x365f58);_0x37cb38[_0x0c21('0x21')](0x0);logger['debug'](_0x0c21('0x84'),_0x37cb38[_0x0c21('0xa1')]());return dbH[_0x0c21('0x85')]['query'](_0x37cb38[_0x0c21('0xa1')](),{'type':dbH[_0x0c21('0x85')]['QueryTypes'][_0x0c21('0x87')]});}})['then'](function(){return{'sql':_0x555977[_0x0c21('0xa1')]()};})[_0x0c21('0x29')](respondWithResult(_0x241b9f,null))['catch'](handleError(_0x241b9f,null));}; \ No newline at end of file +var _0x068d=['COUNT(%s)','DATE(%s)','operator','getFields','findAll','keyBy','select','groupBy','DESC','output','web','%s-%s.%s','generate','csv','custom','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','QueryTypes','runReport','UNIX_TIMESTAMP(%s)','order','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','then','UserProfileResource','destroy','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','rows','catch','params','fields','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','find','userProfileId','autoAssociation','error','join','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','field','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','sequelize','SELECT','cross_join'];(function(_0x447af3,_0x381c44){var _0x202e95=function(_0x29daef){while(--_0x29daef){_0x447af3['push'](_0x447af3['shift']());}};_0x202e95(++_0x381c44);}(_0x068d,0x166));var _0xd068=function(_0x49cbba,_0x10eb69){_0x49cbba=_0x49cbba-0x0;var _0x27bdf3=_0x068d[_0x49cbba];return _0x27bdf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd068('0x0'));var zipdir=require(_0xd068('0x1'));var jsonpatch=require(_0xd068('0x2'));var rp=require('request-promise');var moment=require(_0xd068('0x3'));var BPromise=require(_0xd068('0x4'));var Mustache=require(_0xd068('0x5'));var util=require(_0xd068('0x6'));var path=require(_0xd068('0x7'));var sox=require(_0xd068('0x8'));var csv=require(_0xd068('0x9'));var ejs=require(_0xd068('0xa'));var fs=require('fs');var fs_extra=require(_0xd068('0xb'));var _=require(_0xd068('0xc'));var squel=require(_0xd068('0xd'));var crypto=require('crypto');var jsforce=require(_0xd068('0xe'));var deskjs=require(_0xd068('0xf'));var toCsv=require(_0xd068('0x9'));var querystring=require(_0xd068('0x10'));var Papa=require(_0xd068('0x11'));var Redis=require(_0xd068('0x12'));var authService=require(_0xd068('0x13'));var qs=require(_0xd068('0x14'));var as=require(_0xd068('0x15'));var hardwareService=require(_0xd068('0x16'));var logger=require('../../config/logger')(_0xd068('0x17'));var utils=require(_0xd068('0x18'));var config=require(_0xd068('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xd068('0x1a'))[_0xd068('0x1b')];function respondWithStatusCode(_0x321f58,_0x54d3c2){_0x54d3c2=_0x54d3c2||0xcc;return function(_0x2bfd59){if(_0x2bfd59){return _0x321f58[_0xd068('0x1c')](_0x54d3c2);}return _0x321f58[_0xd068('0x1d')](_0x54d3c2)[_0xd068('0x1e')]();};}function respondWithResult(_0x4830ab,_0x48244e){_0x48244e=_0x48244e||0xc8;return function(_0x36f8a8){if(_0x36f8a8){return _0x4830ab['status'](_0x48244e)['json'](_0x36f8a8);}};}function respondWithFilteredResult(_0x2afda6,_0xcbbeaa){return function(_0x268394){if(_0x268394){var _0x58f4b8=typeof _0xcbbeaa[_0xd068('0x1f')]===_0xd068('0x20')&&typeof _0xcbbeaa[_0xd068('0x21')]===_0xd068('0x20');var _0x27c017=_0x268394[_0xd068('0x22')];var _0x1529c9=_0x58f4b8?0x0:_0xcbbeaa[_0xd068('0x1f')];var _0x1caffd=_0x58f4b8?_0x268394['count']:_0xcbbeaa['offset']+_0xcbbeaa[_0xd068('0x21')];var _0x1a4a2a;if(_0x1caffd>=_0x27c017){_0x1caffd=_0x27c017;_0x1a4a2a=0xc8;}else{_0x1a4a2a=0xce;}_0x2afda6[_0xd068('0x1d')](_0x1a4a2a);return _0x2afda6['set']('Content-Range',_0x1529c9+'-'+_0x1caffd+'/'+_0x27c017)[_0xd068('0x23')](_0x268394);}return null;};}function patchUpdates(_0x5f1ded){return function(_0x2dfc70){try{jsonpatch[_0xd068('0x24')](_0x2dfc70,_0x5f1ded,!![]);}catch(_0x1af325){return BPromise['reject'](_0x1af325);}return _0x2dfc70[_0xd068('0x25')]();};}function saveUpdates(_0x41646a,_0x3e8ea2){return function(_0x5b3451){if(_0x5b3451){return _0x5b3451[_0xd068('0x26')](_0x41646a)[_0xd068('0x27')](function(_0x3f394c){return _0x3f394c;});}return null;};}function removeEntity(_0x799626,_0x370bc3){return function(_0x1ec4de){if(_0x1ec4de){return _0x1ec4de['destroy']()[_0xd068('0x27')](function(){var _0x5aa86b=_0x1ec4de['get']({'plain':!![]});var _0x10b129='CustomReports';return db[_0xd068('0x28')][_0xd068('0x29')]({'where':{'type':_0x10b129,'resourceId':_0x5aa86b['id']}})[_0xd068('0x27')](function(){return _0x1ec4de;});})[_0xd068('0x27')](function(){_0x799626['status'](0xcc)[_0xd068('0x1e')]();});}};}function handleEntityNotFound(_0x102cca,_0x2c472c){return function(_0x3958f6){if(!_0x3958f6){_0x102cca['sendStatus'](0x194);}return _0x3958f6;};}function handleError(_0x16c213,_0x545479){_0x545479=_0x545479||0x1f4;return function(_0x5b2b73){logger['error'](_0x5b2b73[_0xd068('0x2a')]);if(_0x5b2b73['name']){delete _0x5b2b73[_0xd068('0x2b')];}_0x16c213[_0xd068('0x1d')](_0x545479)[_0xd068('0x2c')](_0x5b2b73);};}exports[_0xd068('0x2d')]=function(_0x118707,_0x5cf407){var _0x9a93c7={},_0x19898f={},_0x571dfa={'count':0x0,'rows':[]};var _0x877a67=_[_0xd068('0x2e')](db[_0xd068('0x2f')][_0xd068('0x30')],function(_0x345ed8){return{'name':_0x345ed8[_0xd068('0x31')],'type':_0x345ed8[_0xd068('0x32')]['key']};});_0x19898f[_0xd068('0x33')]=_[_0xd068('0x2e')](_0x877a67,_0xd068('0x2b'));_0x19898f['query']=_[_0xd068('0x34')](_0x118707['query']);_0x19898f['filters']=_[_0xd068('0x35')](_0x19898f[_0xd068('0x33')],_0x19898f[_0xd068('0x36')]);_0x9a93c7['attributes']=_[_0xd068('0x35')](_0x19898f['model'],qs['fields'](_0x118707[_0xd068('0x36')]['fields']));_0x9a93c7['attributes']=_0x9a93c7[_0xd068('0x37')][_0xd068('0x38')]?_0x9a93c7['attributes']:_0x19898f[_0xd068('0x33')];if(!_0x118707[_0xd068('0x36')][_0xd068('0x39')](_0xd068('0x3a'))){_0x9a93c7[_0xd068('0x21')]=qs['limit'](_0x118707[_0xd068('0x36')]['limit']);_0x9a93c7['offset']=qs[_0xd068('0x1f')](_0x118707[_0xd068('0x36')]['offset']);}_0x9a93c7['order']=qs[_0xd068('0x3b')](_0x118707['query']['sort']);_0x9a93c7[_0xd068('0x3c')]=qs[_0xd068('0x3d')](_[_0xd068('0x3e')](_0x118707['query'],_0x19898f[_0xd068('0x3d')]),_0x877a67);if(_0x118707[_0xd068('0x36')]['filter']){_0x9a93c7[_0xd068('0x3c')]=_[_0xd068('0x3f')](_0x9a93c7['where'],{'$or':_[_0xd068('0x2e')](_0x877a67,function(_0x4ab98b){if(_0x4ab98b['type']!==_0xd068('0x40')){var _0x10ce05={};_0x10ce05[_0x4ab98b[_0xd068('0x2b')]]={'$like':'%'+_0x118707[_0xd068('0x36')][_0xd068('0x41')]+'%'};return _0x10ce05;}})});}_0x9a93c7=_[_0xd068('0x3f')]({},_0x9a93c7,_0x118707[_0xd068('0x42')]);var _0x5d23f6={'where':_0x9a93c7['where']};return db[_0xd068('0x2f')]['count'](_0x5d23f6)[_0xd068('0x27')](function(_0x30078a){_0x571dfa[_0xd068('0x22')]=_0x30078a;if(_0x118707[_0xd068('0x36')]['includeAll']){_0x9a93c7['include']=[{'all':!![]}];}return db[_0xd068('0x2f')]['findAll'](_0x9a93c7);})[_0xd068('0x27')](function(_0x4b20fa){_0x571dfa[_0xd068('0x43')]=_0x4b20fa;return _0x571dfa;})[_0xd068('0x27')](respondWithFilteredResult(_0x5cf407,_0x9a93c7))[_0xd068('0x44')](handleError(_0x5cf407,null));};exports['show']=function(_0xe847b4,_0x213d55){var _0x48d88c={'raw':![],'where':{'id':_0xe847b4[_0xd068('0x45')]['id']}},_0x532843={};_0x532843[_0xd068('0x33')]=_[_0xd068('0x34')](db[_0xd068('0x2f')][_0xd068('0x30')]);_0x532843[_0xd068('0x36')]=_[_0xd068('0x34')](_0xe847b4['query']);_0x532843[_0xd068('0x3d')]=_[_0xd068('0x35')](_0x532843['model'],_0x532843[_0xd068('0x36')]);_0x48d88c[_0xd068('0x37')]=_[_0xd068('0x35')](_0x532843[_0xd068('0x33')],qs[_0xd068('0x46')](_0xe847b4[_0xd068('0x36')]['fields']));_0x48d88c['attributes']=_0x48d88c['attributes'][_0xd068('0x38')]?_0x48d88c[_0xd068('0x37')]:_0x532843[_0xd068('0x33')];if(_0xe847b4[_0xd068('0x36')]['includeAll']){_0x48d88c[_0xd068('0x47')]=[{'all':!![]}];}_0x48d88c=_[_0xd068('0x3f')]({},_0x48d88c,_0xe847b4['options']);return db[_0xd068('0x2f')]['find'](_0x48d88c)[_0xd068('0x27')](handleEntityNotFound(_0x213d55,null))[_0xd068('0x27')](respondWithResult(_0x213d55,null))[_0xd068('0x44')](handleError(_0x213d55,null));};exports[_0xd068('0x48')]=function(_0xb76c96,_0x317069){return db[_0xd068('0x2f')][_0xd068('0x48')](_0xb76c96[_0xd068('0x49')],{})['then'](function(_0x45c215){var _0x2741d5=_0xb76c96[_0xd068('0x4a')][_0xd068('0x4b')]({'plain':!![]});if(!_0x2741d5)throw new Error(_0xd068('0x4c'));if(_0x2741d5['role']===_0xd068('0x4a')){var _0xf302ac=_0x45c215[_0xd068('0x4b')]({'plain':!![]});var _0x1150e9=_0xd068('0x4d');return db['UserProfileSection'][_0xd068('0x4e')]({'where':{'name':_0x1150e9,'userProfileId':_0x2741d5[_0xd068('0x4f')]},'raw':!![]})[_0xd068('0x27')](function(_0x3358af){if(_0x3358af&&_0x3358af[_0xd068('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xf302ac[_0xd068('0x2b')],'resourceId':_0xf302ac['id'],'type':'CustomReports','sectionId':_0x3358af['id']},{})[_0xd068('0x27')](function(){return _0x45c215;});}else{return _0x45c215;}})[_0xd068('0x44')](function(_0x9bdf7e){logger[_0xd068('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9bdf7e);throw _0x9bdf7e;});}return _0x45c215;})['then'](respondWithResult(_0x317069,0xc9))[_0xd068('0x44')](handleError(_0x317069,null));};exports['update']=function(_0x32896a,_0x1581ee){if(_0x32896a[_0xd068('0x49')]['id']){delete _0x32896a['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x32896a['params']['id']}})[_0xd068('0x27')](handleEntityNotFound(_0x1581ee,null))[_0xd068('0x27')](saveUpdates(_0x32896a['body'],null))[_0xd068('0x27')](respondWithResult(_0x1581ee,null))[_0xd068('0x44')](handleError(_0x1581ee,null));};exports['destroy']=function(_0x6dd33b,_0x4fe337){return db[_0xd068('0x2f')][_0xd068('0x4e')]({'where':{'id':_0x6dd33b[_0xd068('0x45')]['id']}})[_0xd068('0x27')](handleEntityNotFound(_0x4fe337,null))[_0xd068('0x27')](removeEntity(_0x4fe337,null))['catch'](handleError(_0x4fe337,null));};exports['preview']=function(_0xb9ceb1,_0x17be36){var _0x1b51c9=0xa;var _0x401a23=[_0xd068('0x52'),_0xd068('0x53'),_0xd068('0x54'),'cross_join'];var _0x3e147f={'SUM':_0xd068('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd068('0x56'),'MAX':_0xd068('0x57'),'MIN':_0xd068('0x58'),'AVG':_0xd068('0x59'),'GROUP_CONCAT':_0xd068('0x5a'),'GROUP_CONCAT ASC':_0xd068('0x5b'),'GROUP_CONCAT DESC':_0xd068('0x5c')};var _0x5617a9={'SEC_TO_TIME':_0xd068('0x5d'),'DATE':'DATE(%s)','HOUR':_0xd068('0x5e'),'ROUND':_0xd068('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x492b6c=function(_0x3747fd){return!_[_0xd068('0x60')]([_0xd068('0x61'),_0xd068('0x62'),_0xd068('0x63'),_0xd068('0x64')],_0x3747fd);};var _0x564803=function(_0x215f6c){if(!_0x215f6c||!_0x215f6c['rules'][_0xd068('0x38')]){return'';}for(var _0x17b4ce='(',_0x287d9d=0x0;_0x287d9d<_0x215f6c[_0xd068('0x65')][_0xd068('0x38')];_0x287d9d+=0x1){_0x287d9d>0x0&&(_0x17b4ce+='\x20'+_0x215f6c['operator']+'\x20');_0x17b4ce+=_0x215f6c[_0xd068('0x65')][_0x287d9d][_0xd068('0x66')]?_0x564803(_0x215f6c[_0xd068('0x65')][_0x287d9d][_0xd068('0x66')]):_0x215f6c[_0xd068('0x65')][_0x287d9d]['field']+'\x20'+_0x215f6c[_0xd068('0x65')][_0x287d9d][_0xd068('0x67')]+(_0x492b6c(_0x215f6c['rules'][_0x287d9d]['condition'])?'\x20'+_0x215f6c[_0xd068('0x65')][_0x287d9d][_0xd068('0x68')]:'');}return _0x17b4ce+')';};var _0x454abd={'where':{'id':_0xb9ceb1[_0xd068('0x45')]['id']}},_0x1cdae7,_0x24c1c8,_0x4cecb2,_0x1df435,_0x5b92c0;_0x454abd=_['merge']({},_0x454abd,_0xb9ceb1[_0xd068('0x42')]);return db[_0xd068('0x2f')]['find'](_0x454abd)[_0xd068('0x27')](function(_0x320d1b){if(_0x320d1b){_0x1cdae7=_0x320d1b;return _0x320d1b['getFields']();}return null;})['then'](function(_0x1c63b7){if(_0x1c63b7){if(!_0x1c63b7[_0xd068('0x38')]){throw new db[(_0xd068('0x69'))][(_0xd068('0x6a'))](_0xd068('0x6b'),0x193);}_0x24c1c8=_0x1c63b7;return db[_0xd068('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xd068('0x27')](function(_0x3cd55b){if(_0x3cd55b){_0x4cecb2=_['keyBy'](_0x3cd55b,'id');var _0x1a1e86;var _0x40c418=squel['select']();_0x40c418[_0xd068('0x6d')](_0x1cdae7[_0xd068('0x6e')]);for(var _0x8fb13=0x0;_0x8fb13<_0x24c1c8[_0xd068('0x38')];_0x8fb13+=0x1){_0x1a1e86=_0x24c1c8[_0x8fb13][_0xd068('0x6f')]?_0x4cecb2[_0x24c1c8[_0x8fb13][_0xd068('0x6f')]][_0xd068('0x70')]:_0x24c1c8[_0x8fb13][_0xd068('0x71')];_0x1a1e86=_0x24c1c8[_0x8fb13][_0xd068('0x72')]?_[_0xd068('0x73')](_0x3e147f[_0x24c1c8[_0x8fb13]['function']],'%s',_0x1a1e86):_0x1a1e86;_0x1a1e86=_0x24c1c8[_0x8fb13][_0xd068('0x74')]?_['replace'](_0x5617a9[_0x24c1c8[_0x8fb13]['format']],'%s',_0x1a1e86):_0x1a1e86;if(_0x24c1c8[_0x8fb13]['groupBy']){_0x40c418[_0xd068('0x66')](_0x1a1e86);}_0x24c1c8[_0x8fb13][_0xd068('0x75')]&&_0x40c418['order'](_0x1a1e86,_0x24c1c8[_0x8fb13][_0xd068('0x75')]==='DESC'?![]:!![]);_0x40c418[_0xd068('0x71')](_0x1a1e86,_0x24c1c8[_0x8fb13][_0xd068('0x76')]||_0x1a1e86);}if(_0x1cdae7[_0xd068('0x77')]){_0x1cdae7['joins']=JSON[_0xd068('0x78')](_0x1cdae7[_0xd068('0x77')]);for(var _0x2c52b9=0x0;_0x2c52b9<_0x1cdae7[_0xd068('0x77')][_0xd068('0x38')];_0x2c52b9+=0x1){if(_0x1cdae7['joins'][_0x2c52b9][_0xd068('0x32')]&&_[_0xd068('0x60')](_0x401a23,_0x1cdae7['joins'][_0x2c52b9]['type'])&&_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x79')]&&_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x7a')]&&_0x1cdae7[_0xd068('0x77')][_0x2c52b9]['foreignKey']){_0x40c418[_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x32')]](_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x7a')],null,util['format'](_0xd068('0x7b'),_0x1cdae7['table'],_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x79')],_0x1cdae7['joins'][_0x2c52b9][_0xd068('0x7a')],_0x1cdae7[_0xd068('0x77')][_0x2c52b9][_0xd068('0x7c')]));}}}if(_0x1cdae7[_0xd068('0x7d')]){_0x1cdae7['conditions']=JSON['parse'](_0x1cdae7['conditions']);_0x40c418[_0xd068('0x3c')](_0x564803(_0x1cdae7[_0xd068('0x7d')][_0xd068('0x66')]));}_0x5b92c0=_0x40c418[_0xd068('0x7e')]();_0x40c418['limit'](_0x1b51c9);_0x40c418[_0xd068('0x1f')](0x0);logger[_0xd068('0x7f')]('Limited\x20Query:',_0x40c418['toString']());return dbH[_0xd068('0x80')][_0xd068('0x36')](_0x40c418['toString'](),{'type':dbH[_0xd068('0x80')]['QueryTypes'][_0xd068('0x81')]});}})[_0xd068('0x27')](respondWithResult(_0x17be36,null))[_0xd068('0x44')](handleError(_0x17be36,null));};function runReport(_0x23aac6,_0x582268,_0x189531){var _0x117180=_0x582268[_0xd068('0x2b')];var _0x1496be=0xa;var _0x7fe9dc=['join','left_join',_0xd068('0x54'),_0xd068('0x82')];var _0x11d2e1={'SUM':_0xd068('0x55'),'COUNT':_0xd068('0x83'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd068('0x57'),'MIN':_0xd068('0x58'),'AVG':_0xd068('0x59'),'GROUP_CONCAT':_0xd068('0x5a'),'GROUP_CONCAT ASC':_0xd068('0x5b'),'GROUP_CONCAT DESC':_0xd068('0x5c')};var _0x5cb52={'SEC_TO_TIME':_0xd068('0x5d'),'DATE':_0xd068('0x84'),'HOUR':_0xd068('0x5e'),'ROUND':_0xd068('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2e9001=function(_0x4fa70c){return!_[_0xd068('0x60')]([_0xd068('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xd068('0x64')],_0x4fa70c);};var _0x143ae8=function(_0x562f96){if(!_0x562f96||!_0x562f96[_0xd068('0x65')][_0xd068('0x38')]){return'';}for(var _0xb5f069='(',_0x2a84c6=0x0;_0x2a84c6<_0x562f96[_0xd068('0x65')][_0xd068('0x38')];_0x2a84c6+=0x1){_0x2a84c6>0x0&&(_0xb5f069+='\x20'+_0x562f96[_0xd068('0x85')]+'\x20');_0xb5f069+=_0x562f96[_0xd068('0x65')][_0x2a84c6][_0xd068('0x66')]?_0x143ae8(_0x562f96[_0xd068('0x65')][_0x2a84c6][_0xd068('0x66')]):_0x562f96['rules'][_0x2a84c6][_0xd068('0x71')]+'\x20'+_0x562f96[_0xd068('0x65')][_0x2a84c6][_0xd068('0x67')]+(_0x2e9001(_0x562f96[_0xd068('0x65')][_0x2a84c6][_0xd068('0x67')])?'\x20'+_0x562f96[_0xd068('0x65')][_0x2a84c6][_0xd068('0x68')]:'');}return _0xb5f069+')';};var _0x75c762={'where':{'id':_0x23aac6['id']}},_0x1d1cf1,_0x198a42,_0x594b7b,_0x5069aa,_0x552301;_0x75c762=_[_0xd068('0x3f')]({},_0x75c762,_0x189531);return db['AnalyticCustomReport'][_0xd068('0x4e')](_0x75c762)[_0xd068('0x27')](function(_0x3c8164){if(_0x3c8164){_0x1d1cf1=_0x3c8164;return _0x3c8164[_0xd068('0x86')]();}return null;})[_0xd068('0x27')](function(_0x15a198){if(_0x15a198){if(!_0x15a198[_0xd068('0x38')]){throw new db['Sequelize'][(_0xd068('0x6a'))](_0xd068('0x6b'),0x193);}_0x198a42=_0x15a198;return db['AnalyticMetric'][_0xd068('0x87')]({'raw':!![]});}return null;})['then'](function(_0xf6d62a){if(_0xf6d62a){_0x594b7b=_[_0xd068('0x88')](_0xf6d62a,'id');var _0x15c518;var _0x3cbe0e=squel[_0xd068('0x89')]();_0x3cbe0e['from'](_0x1d1cf1[_0xd068('0x6e')]);for(var _0x581fa0=0x0;_0x581fa0<_0x198a42[_0xd068('0x38')];_0x581fa0+=0x1){_0x15c518=_0x198a42[_0x581fa0]['MetricId']?_0x594b7b[_0x198a42[_0x581fa0][_0xd068('0x6f')]]['metric']:_0x198a42[_0x581fa0]['field'];_0x15c518=_0x198a42[_0x581fa0][_0xd068('0x72')]?_[_0xd068('0x73')](_0x11d2e1[_0x198a42[_0x581fa0]['function']],'%s',_0x15c518):_0x15c518;_0x15c518=_0x198a42[_0x581fa0][_0xd068('0x74')]?_[_0xd068('0x73')](_0x5cb52[_0x198a42[_0x581fa0][_0xd068('0x74')]],'%s',_0x15c518):_0x15c518;if(_0x198a42[_0x581fa0][_0xd068('0x8a')]){_0x3cbe0e[_0xd068('0x66')](_0x15c518);}_0x198a42[_0x581fa0][_0xd068('0x75')]&&_0x3cbe0e['order'](_0x15c518,_0x198a42[_0x581fa0]['orderBy']===_0xd068('0x8b')?![]:!![]);_0x3cbe0e[_0xd068('0x71')](_0x15c518,_0x198a42[_0x581fa0][_0xd068('0x76')]||_0x15c518);}if(_0x1d1cf1[_0xd068('0x77')]){_0x1d1cf1[_0xd068('0x77')]=JSON['parse'](_0x1d1cf1['joins']);for(var _0x4893fd=0x0;_0x4893fd<_0x1d1cf1[_0xd068('0x77')][_0xd068('0x38')];_0x4893fd+=0x1){if(_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x32')]&&_[_0xd068('0x60')](_0x7fe9dc,_0x1d1cf1['joins'][_0x4893fd]['type'])&&_0x1d1cf1['joins'][_0x4893fd][_0xd068('0x79')]&&_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x7a')]&&_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x7c')]){_0x3cbe0e[_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x32')]](_0x1d1cf1[_0xd068('0x77')][_0x4893fd]['foreignTable'],null,util[_0xd068('0x74')]('%s.%s\x20=\x20%s.%s',_0x1d1cf1[_0xd068('0x6e')],_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x79')],_0x1d1cf1['joins'][_0x4893fd][_0xd068('0x7a')],_0x1d1cf1[_0xd068('0x77')][_0x4893fd][_0xd068('0x7c')]));}}}if(_0x1d1cf1['conditions']){_0x1d1cf1['conditions']=JSON[_0xd068('0x78')](_0x1d1cf1[_0xd068('0x7d')]);_0x3cbe0e[_0xd068('0x3c')](_0x143ae8(_0x1d1cf1['conditions'][_0xd068('0x66')]));}_0x552301=_0x3cbe0e['clone']();_0x3cbe0e[_0xd068('0x21')](_0x1496be);_0x3cbe0e[_0xd068('0x1f')](0x0);return;}})[_0xd068('0x27')](function(){if(_0x582268[_0xd068('0x8c')]===_0xd068('0x8d')){return null;}var _0x467dcf=_[_0xd068('0x3f')](_0x582268,{'name':_0x582268['fullPath']||_0x582268[_0xd068('0x2b')]||_0x1d1cf1[_0xd068('0x2b')],'basename':_0x117180,'savename':util[_0xd068('0x74')](_0xd068('0x8e'),_0x582268['name']||_0x1d1cf1[_0xd068('0x2b')],require('randomstring')[_0xd068('0x8f')](0x4),_0x582268[_0xd068('0x8c')]||_0xd068('0x90')),'reportId':_0x1d1cf1['id'],'reportType':_0xd068('0x91')});return db['AnalyticExtractedReport'][_0xd068('0x48')](_0x467dcf,{'raw':!![]});})[_0xd068('0x27')](function(_0x5c5a86){if(_0x1d1cf1[_0xd068('0x6e')]===_0xd068('0x92')){_0x552301[_0xd068('0x3c')](_0x1d1cf1['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x582268['startDate'],_0x582268[_0xd068('0x93')]);}else{_0x552301[_0xd068('0x3c')](_0x1d1cf1['table']+_0xd068('0x94'),_0x582268[_0xd068('0x95')],_0x582268['endDate']);}if(_0x5c5a86){logger[_0xd068('0x96')](_0xd068('0x97'),_0x552301[_0xd068('0x98')]());require(_0xd068('0x99'))[_0xd068('0x9a')](path[_0xd068('0x52')](__dirname,_0xd068('0x9b'),_0x5c5a86[_0xd068('0x8c')]),[_0x5c5a86['id'],_0x552301[_0xd068('0x98')](),path[_0xd068('0x52')](__dirname,_0xd068('0x9c'),_0x5c5a86[_0xd068('0x9d')]),_0x117180]);return _0x5c5a86;}else{var _0x13db3b=squel['select']();_0x13db3b[_0xd068('0x6d')]('('+_0x552301[_0xd068('0x98')]()+')','countTable');_0x13db3b[_0xd068('0x71')]('COUNT(*)',_0xd068('0x22'));_0x552301[_0xd068('0x21')](_0x582268[_0xd068('0x21')]||_0x1496be);_0x552301[_0xd068('0x1f')](_0x582268['offset']||0x0);return dbH['sequelize'][_0xd068('0x36')](_0x13db3b[_0xd068('0x98')](),{'type':dbH[_0xd068('0x80')][_0xd068('0x9e')][_0xd068('0x81')]})[_0xd068('0x27')](function(_0x2ab604){if(!_0x2ab604['length']){_0x5069aa=0x0;}else{_0x5069aa=_0x2ab604[0x0][_0xd068('0x22')]||0x0;}return dbH[_0xd068('0x80')][_0xd068('0x36')](_0x552301[_0xd068('0x98')](),{'type':dbH[_0xd068('0x80')][_0xd068('0x9e')][_0xd068('0x81')]});})['then'](function(_0x588e94){return{'rows':_0x588e94||[],'count':_0x5069aa};});}});}exports['run']=function(_0x495ef8,_0x390848){return runReport(_0x495ef8[_0xd068('0x45')],_0x495ef8[_0xd068('0x36')],_0x495ef8['options'])[_0xd068('0x27')](respondWithResult(_0x390848,null))[_0xd068('0x44')](handleError(_0x390848,null));};exports[_0xd068('0x9f')]=runReport;exports[_0xd068('0x36')]=function(_0x18b56e,_0x3153b8){var _0xc97751=0xa;var _0x2c1379=[_0xd068('0x52'),_0xd068('0x53'),_0xd068('0x54'),'cross_join'];var _0x4fc28a={'SUM':_0xd068('0x55'),'COUNT':_0xd068('0x83'),'COUNT DISTINCT':_0xd068('0x56'),'MAX':_0xd068('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd068('0x5a'),'GROUP_CONCAT ASC':_0xd068('0x5b'),'GROUP_CONCAT DESC':_0xd068('0x5c')};var _0x1d8155={'SEC_TO_TIME':_0xd068('0x5d'),'DATE':_0xd068('0x84'),'HOUR':_0xd068('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xd068('0xa0')};var _0x3c58ed=function(_0x11e701){return!_[_0xd068('0x60')]([_0xd068('0x61'),_0xd068('0x62'),_0xd068('0x63'),_0xd068('0x64')],_0x11e701);};var _0x425715=function(_0xb3ab46){if(!_0xb3ab46||!_0xb3ab46[_0xd068('0x65')][_0xd068('0x38')]){return'';}for(var _0x4d70ec='(',_0x57a9c7=0x0;_0x57a9c7<_0xb3ab46[_0xd068('0x65')][_0xd068('0x38')];_0x57a9c7+=0x1){_0x57a9c7>0x0&&(_0x4d70ec+='\x20'+_0xb3ab46[_0xd068('0x85')]+'\x20');_0x4d70ec+=_0xb3ab46[_0xd068('0x65')][_0x57a9c7][_0xd068('0x66')]?_0x425715(_0xb3ab46[_0xd068('0x65')][_0x57a9c7][_0xd068('0x66')]):_0xb3ab46[_0xd068('0x65')][_0x57a9c7]['field']+'\x20'+_0xb3ab46[_0xd068('0x65')][_0x57a9c7][_0xd068('0x67')]+(_0x3c58ed(_0xb3ab46['rules'][_0x57a9c7][_0xd068('0x67')])?'\x20'+_0xb3ab46[_0xd068('0x65')][_0x57a9c7][_0xd068('0x68')]:'');}return _0x4d70ec+')';};var _0x32c5d5={'where':{'id':_0x18b56e[_0xd068('0x45')]['id']}},_0x5da094,_0x9c978e,_0x243753,_0x371645,_0xd9aea0;_0x32c5d5=_['merge']({},_0x32c5d5,_0x18b56e[_0xd068('0x42')]);return db[_0xd068('0x2f')]['find'](_0x32c5d5)[_0xd068('0x27')](function(_0x4f7e81){if(_0x4f7e81){_0x5da094=_0x4f7e81;return _0x4f7e81[_0xd068('0x86')]();}return null;})[_0xd068('0x27')](function(_0x2858a7){if(_0x2858a7){if(!_0x2858a7[_0xd068('0x38')]){throw new db[(_0xd068('0x69'))][(_0xd068('0x6a'))](_0xd068('0x6b'),0x193);}_0x9c978e=_0x2858a7;return db[_0xd068('0x6c')][_0xd068('0x87')]({'raw':!![]});}return null;})['then'](function(_0x15fde3){if(_0x15fde3){_0x243753=_[_0xd068('0x88')](_0x15fde3,'id');var _0x1d54ee;var _0x6e120c=squel[_0xd068('0x89')]();_0x6e120c[_0xd068('0x6d')](_0x5da094['table']);for(var _0x4ba000=0x0;_0x4ba000<_0x9c978e[_0xd068('0x38')];_0x4ba000+=0x1){_0x1d54ee=_0x9c978e[_0x4ba000]['MetricId']?_0x243753[_0x9c978e[_0x4ba000]['MetricId']][_0xd068('0x70')]:_0x9c978e[_0x4ba000]['field'];_0x1d54ee=_0x9c978e[_0x4ba000][_0xd068('0x72')]?_['replace'](_0x4fc28a[_0x9c978e[_0x4ba000][_0xd068('0x72')]],'%s',_0x1d54ee):_0x1d54ee;_0x1d54ee=_0x9c978e[_0x4ba000][_0xd068('0x74')]?_[_0xd068('0x73')](_0x1d8155[_0x9c978e[_0x4ba000][_0xd068('0x74')]],'%s',_0x1d54ee):_0x1d54ee;if(_0x9c978e[_0x4ba000][_0xd068('0x8a')]){_0x6e120c[_0xd068('0x66')](_0x1d54ee);}_0x9c978e[_0x4ba000][_0xd068('0x75')]&&_0x6e120c[_0xd068('0xa1')](_0x1d54ee,_0x9c978e[_0x4ba000][_0xd068('0x75')]===_0xd068('0x8b')?![]:!![]);_0x6e120c[_0xd068('0x71')](_0x1d54ee,_0x9c978e[_0x4ba000]['alias']||_0x1d54ee);}if(_0x5da094['joins']){_0x5da094[_0xd068('0x77')]=JSON[_0xd068('0x78')](_0x5da094[_0xd068('0x77')]);for(var _0x520d33=0x0;_0x520d33<_0x5da094[_0xd068('0x77')][_0xd068('0x38')];_0x520d33+=0x1){if(_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x32')]&&_[_0xd068('0x60')](_0x2c1379,_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x32')])&&_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x79')]&&_0x5da094['joins'][_0x520d33]['foreignTable']&&_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x7c')]){_0x6e120c[_0x5da094['joins'][_0x520d33][_0xd068('0x32')]](_0x5da094[_0xd068('0x77')][_0x520d33]['foreignTable'],null,util[_0xd068('0x74')](_0xd068('0x7b'),_0x5da094['table'],_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x79')],_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x7a')],_0x5da094[_0xd068('0x77')][_0x520d33][_0xd068('0x7c')]));}}}if(_0x5da094[_0xd068('0x7d')]){_0x5da094[_0xd068('0x7d')]=JSON['parse'](_0x5da094[_0xd068('0x7d')]);_0x6e120c['where'](_0x425715(_0x5da094[_0xd068('0x7d')][_0xd068('0x66')]));}_0xd9aea0=_0x6e120c[_0xd068('0x7e')]();_0x6e120c[_0xd068('0x21')](_0xc97751);_0x6e120c[_0xd068('0x1f')](0x0);logger[_0xd068('0x7f')](_0xd068('0xa2'),_0x6e120c[_0xd068('0x98')]());return dbH[_0xd068('0x80')][_0xd068('0x36')](_0x6e120c[_0xd068('0x98')](),{'type':dbH[_0xd068('0x80')][_0xd068('0x9e')][_0xd068('0x81')]});}})['then'](function(){return{'sql':_0xd9aea0[_0xd068('0x98')]()};})[_0xd068('0x27')](respondWithResult(_0x3153b8,null))[_0xd068('0x44')](handleError(_0x3153b8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1398d01..bbbbc70 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 _0x0994=['exports','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4de6ec,_0x2fc209){var _0x1bfbdc=function(_0x514762){while(--_0x514762){_0x4de6ec['push'](_0x4de6ec['shift']());}};_0x1bfbdc(++_0x2fc209);}(_0x0994,0x179));var _0x4099=function(_0x484976,_0x450694){_0x484976=_0x484976-0x0;var _0x407cd8=_0x0994[_0x484976];return _0x407cd8;};'use strict';var _=require('lodash');var util=require(_0x4099('0x0'));var logger=require(_0x4099('0x1'))(_0x4099('0x2'));var moment=require('moment');var BPromise=require(_0x4099('0x3'));var rp=require(_0x4099('0x4'));var fs=require('fs');var path=require(_0x4099('0x5'));var rimraf=require(_0x4099('0x6'));var config=require(_0x4099('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x4099('0x8')]=function(_0x751527,_0x4dbb25){return _0x751527['define'](_0x4099('0x9'),attributes,{'tableName':_0x4099('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9164=['exports','define','lodash','util','api','moment','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x237dcb,_0x5caca4){var _0x54e4de=function(_0x4beced){while(--_0x4beced){_0x237dcb['push'](_0x237dcb['shift']());}};_0x54e4de(++_0x5caca4);}(_0x9164,0x158));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4916('0x0'));var util=require(_0x4916('0x1'));var logger=require('../../config/logger')(_0x4916('0x2'));var moment=require(_0x4916('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4916('0x4'));var config=require(_0x4916('0x5'));var attributes=require(_0x4916('0x6'));module[_0x4916('0x7')]=function(_0x4e8285,_0x38e122){return _0x4e8285[_0x4916('0x8')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','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 0cd0438..02b3f22 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 _0x77c8=['info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2e2b37,_0xdac58a){var _0x20b4a5=function(_0x48a833){while(--_0x48a833){_0x2e2b37['push'](_0x2e2b37['shift']());}};_0x20b4a5(++_0xdac58a);}(_0x77c8,0x122));var _0x877c=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x77c8[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x877c('0x0'));var util=require(_0x877c('0x1'));var moment=require(_0x877c('0x2'));var BPromise=require('bluebird');var rs=require(_0x877c('0x3'));var fs=require('fs');var Redis=require(_0x877c('0x4'));var db=require(_0x877c('0x5'))['db'];var utils=require(_0x877c('0x6'));var logger=require(_0x877c('0x7'))(_0x877c('0x8'));var config=require(_0x877c('0x9'));var jayson=require(_0x877c('0xa'));var client=jayson[_0x877c('0xb')][_0x877c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d27f5,_0x2ccbda,_0x4f5ba6){return new BPromise(function(_0x514876,_0x248bb6){return client[_0x877c('0xd')](_0x1d27f5,_0x4f5ba6)[_0x877c('0xe')](function(_0x3dea49){logger['info'](_0x877c('0xf'),_0x2ccbda,_0x877c('0x10'));logger[_0x877c('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2ccbda,'request\x20sent',JSON[_0x877c('0x12')](_0x3dea49));if(_0x3dea49[_0x877c('0x13')]){if(_0x3dea49[_0x877c('0x13')][_0x877c('0x14')]===0x1f4){logger[_0x877c('0x13')](_0x877c('0xf'),_0x2ccbda,_0x3dea49['error'][_0x877c('0x15')]);return _0x248bb6(_0x3dea49['error'][_0x877c('0x15')]);}logger[_0x877c('0x13')](_0x877c('0xf'),_0x2ccbda,_0x3dea49[_0x877c('0x13')][_0x877c('0x15')]);return _0x514876(_0x3dea49[_0x877c('0x13')][_0x877c('0x15')]);}else{logger[_0x877c('0x16')](_0x877c('0xf'),_0x2ccbda,'request\x20sent');_0x514876(_0x3dea49['result']['message']);}})[_0x877c('0x17')](function(_0x148dff){logger[_0x877c('0x13')](_0x877c('0xf'),_0x2ccbda,_0x148dff);_0x248bb6(_0x148dff);});});} \ No newline at end of file +var _0xd49b=['lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x187649,_0x2e0589){var _0x24a605=function(_0x106ae0){while(--_0x106ae0){_0x187649['push'](_0x187649['shift']());}};_0x24a605(++_0x2e0589);}(_0xd49b,0x187));var _0xbd49=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xd49b[_0x34bd34];return _0x4e36d6;};'use strict';var _=require(_0xbd49('0x0'));var util=require(_0xbd49('0x1'));var moment=require('moment');var BPromise=require(_0xbd49('0x2'));var rs=require(_0xbd49('0x3'));var fs=require('fs');var Redis=require(_0xbd49('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd49('0x5'));var config=require(_0xbd49('0x6'));var jayson=require(_0xbd49('0x7'));var client=jayson[_0xbd49('0x8')][_0xbd49('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2161f2,_0x5edbf0,_0x12f5e1){return new BPromise(function(_0x32d506,_0x259b53){return client[_0xbd49('0xa')](_0x2161f2,_0x12f5e1)['then'](function(_0x7062fe){logger['info'](_0xbd49('0xb'),_0x5edbf0,_0xbd49('0xc'));logger[_0xbd49('0xd')](_0xbd49('0xe'),_0x5edbf0,'request\x20sent',JSON['stringify'](_0x7062fe));if(_0x7062fe['error']){if(_0x7062fe[_0xbd49('0xf')]['code']===0x1f4){logger[_0xbd49('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edbf0,_0x7062fe[_0xbd49('0xf')][_0xbd49('0x10')]);return _0x259b53(_0x7062fe[_0xbd49('0xf')][_0xbd49('0x10')]);}logger[_0xbd49('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edbf0,_0x7062fe[_0xbd49('0xf')][_0xbd49('0x10')]);return _0x32d506(_0x7062fe['error'][_0xbd49('0x10')]);}else{logger['info'](_0xbd49('0xb'),_0x5edbf0,'request\x20sent');_0x32d506(_0x7062fe['result'][_0xbd49('0x10')]);}})['catch'](function(_0x3e9047){logger[_0xbd49('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edbf0,_0x3e9047);_0x259b53(_0x3e9047);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index ca96115..3a8576c 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 _0x8035=['show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x8035,0x1d3));var _0x5803=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x8035[_0x2c3a8f];return _0x189412;};'use strict';var multer=require(_0x5803('0x0'));var util=require(_0x5803('0x1'));var path=require(_0x5803('0x2'));var timeout=require('connect-timeout');var express=require(_0x5803('0x3'));var router=express['Router']();var fs_extra=require(_0x5803('0x4'));var auth=require(_0x5803('0x5'));var interaction=require(_0x5803('0x6'));var config=require(_0x5803('0x7'));var controller=require(_0x5803('0x8'));router[_0x5803('0x9')]('/',auth[_0x5803('0xa')](),controller[_0x5803('0xb')]);router[_0x5803('0x9')](_0x5803('0xc'),auth[_0x5803('0xa')](),controller[_0x5803('0xd')]);router['get'](_0x5803('0xe'),auth[_0x5803('0xa')](),controller[_0x5803('0xf')]);router[_0x5803('0x9')](_0x5803('0x10'),auth[_0x5803('0xa')](),controller[_0x5803('0x11')]);router[_0x5803('0x9')](_0x5803('0x12'),auth[_0x5803('0xa')](),controller['query']);router[_0x5803('0x13')]('/',auth[_0x5803('0xa')](),controller[_0x5803('0x14')]);router[_0x5803('0x15')](_0x5803('0xc'),auth[_0x5803('0xa')](),controller[_0x5803('0x16')]);router['delete']('/:id',auth[_0x5803('0xa')](),controller[_0x5803('0x17')]);module['exports']=router; \ No newline at end of file +var _0xbc88=['isAuthenticated','index','get','/:id','show','preview','/:id/run','run','/:id/query','query','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xbc88,0x153));var _0x8bc8=function(_0x541d2a,_0x54b175){_0x541d2a=_0x541d2a-0x0;var _0x390245=_0xbc88[_0x541d2a];return _0x390245;};'use strict';var multer=require(_0x8bc8('0x0'));var util=require(_0x8bc8('0x1'));var path=require(_0x8bc8('0x2'));var timeout=require(_0x8bc8('0x3'));var express=require(_0x8bc8('0x4'));var router=express[_0x8bc8('0x5')]();var fs_extra=require(_0x8bc8('0x6'));var auth=require(_0x8bc8('0x7'));var interaction=require(_0x8bc8('0x8'));var config=require(_0x8bc8('0x9'));var controller=require(_0x8bc8('0xa'));router['get']('/',auth[_0x8bc8('0xb')](),controller[_0x8bc8('0xc')]);router[_0x8bc8('0xd')](_0x8bc8('0xe'),auth[_0x8bc8('0xb')](),controller[_0x8bc8('0xf')]);router[_0x8bc8('0xd')]('/:id/preview',auth['isAuthenticated'](),controller[_0x8bc8('0x10')]);router[_0x8bc8('0xd')](_0x8bc8('0x11'),auth[_0x8bc8('0xb')](),controller[_0x8bc8('0x12')]);router[_0x8bc8('0xd')](_0x8bc8('0x13'),auth[_0x8bc8('0xb')](),controller[_0x8bc8('0x14')]);router['post']('/',auth[_0x8bc8('0xb')](),controller['create']);router[_0x8bc8('0x15')](_0x8bc8('0xe'),auth[_0x8bc8('0xb')](),controller['update']);router[_0x8bc8('0x16')](_0x8bc8('0xe'),auth[_0x8bc8('0xb')](),controller[_0x8bc8('0x17')]);module[_0x8bc8('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0c35e14..d8b9c75 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 _0xbd51=['sequelize','STRING'];(function(_0x37d4ac,_0x4e47d6){var _0x5e727a=function(_0x5adbff){while(--_0x5adbff){_0x37d4ac['push'](_0x37d4ac['shift']());}};_0x5e727a(++_0x4e47d6);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4ce21b,_0x5c6759){_0x4ce21b=_0x4ce21b-0x0;var _0x824d87=_0xbd51[_0x4ce21b];return _0x824d87;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x3990de,_0xaa7852){var _0x4e6d1e=function(_0x1a8dd7){while(--_0x1a8dd7){_0x3990de['push'](_0x3990de['shift']());}};_0x4e6d1e(++_0xaa7852);}(_0x33c5,0xe6));var _0x533c=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x33c5[_0x1196b0];return _0x111c52;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 741a6b8..4919e33 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0x4819,0xcd));var _0x9481=function(_0x5d289a,_0x352880){_0x5d289a=_0x5d289a-0x0;var _0x14bd5f=_0x4819[_0x5d289a];return _0x14bd5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x19f332,_0x42a8ad){var _0x1696e2=function(_0x320b4a){while(--_0x320b4a){_0x19f332['push'](_0x19f332['shift']());}};_0x1696e2(++_0x42a8ad);}(_0x5fab,0x177));var _0xb5fa=function(_0x3aac69,_0x81d09f){_0x3aac69=_0x3aac69-0x0;var _0x38d35b=_0x5fab[_0x3aac69];return _0x38d35b;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ea1914a..ac2aa58 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 _0x626a=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x492275,_0x44cb8b){var _0xe2777d=function(_0x30f0a2){while(--_0x30f0a2){_0x492275['push'](_0x492275['shift']());}};_0xe2777d(++_0x44cb8b);}(_0x626a,0x196));var _0xa626=function(_0x58a5cb,_0x366da2){_0x58a5cb=_0x58a5cb-0x0;var _0x55e749=_0x626a[_0x58a5cb];return _0x55e749;};'use strict';var _=require(_0xa626('0x0'));var util=require(_0xa626('0x1'));var logger=require('../../config/logger')(_0xa626('0x2'));var moment=require(_0xa626('0x3'));var BPromise=require('bluebird');var rp=require(_0xa626('0x4'));var fs=require('fs');var path=require(_0xa626('0x5'));var rimraf=require(_0xa626('0x6'));var config=require(_0xa626('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xa626('0x8')]=function(_0x40bcf6,_0xba9314){return _0x40bcf6[_0xa626('0x9')](_0xa626('0xa'),attributes,{'tableName':_0xa626('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f0=['analytics_default_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x4a543a,_0xb24670){var _0x3fdc45=function(_0x409a2d){while(--_0x409a2d){_0x4a543a['push'](_0x4a543a['shift']());}};_0x3fdc45(++_0xb24670);}(_0x00f0,0xe5));var _0x000f=function(_0x3785e4,_0xfa6027){_0x3785e4=_0x3785e4-0x0;var _0x3c66d2=_0x00f0[_0x3785e4];return _0x3c66d2;};'use strict';var _=require(_0x000f('0x0'));var util=require('util');var logger=require(_0x000f('0x1'))(_0x000f('0x2'));var moment=require('moment');var BPromise=require(_0x000f('0x3'));var rp=require(_0x000f('0x4'));var fs=require('fs');var path=require(_0x000f('0x5'));var rimraf=require(_0x000f('0x6'));var config=require(_0x000f('0x7'));var attributes=require(_0x000f('0x8'));module['exports']=function(_0x3608a8,_0x4e986a){return _0x3608a8[_0x000f('0x9')](_0x000f('0xa'),attributes,{'tableName':_0x000f('0xb'),'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 866abd8..47bec05 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 _0xb6ed=['error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fc61e,_0x5b8599){var _0x58e101=function(_0x12066c){while(--_0x12066c){_0x3fc61e['push'](_0x3fc61e['shift']());}};_0x58e101(++_0x5b8599);}(_0xb6ed,0x17d));var _0xdb6e=function(_0x5ef8a4,_0x39e26a){_0x5ef8a4=_0x5ef8a4-0x0;var _0x1772ff=_0xb6ed[_0x5ef8a4];return _0x1772ff;};'use strict';var _=require(_0xdb6e('0x0'));var util=require(_0xdb6e('0x1'));var moment=require(_0xdb6e('0x2'));var BPromise=require(_0xdb6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb6e('0x4'));var db=require(_0xdb6e('0x5'))['db'];var utils=require(_0xdb6e('0x6'));var logger=require(_0xdb6e('0x7'))(_0xdb6e('0x8'));var config=require(_0xdb6e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb6e('0xa')][_0xdb6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5577d9,_0x36e203,_0x4732b2){return new BPromise(function(_0x30f168,_0x4d07d6){return client[_0xdb6e('0xc')](_0x5577d9,_0x4732b2)[_0xdb6e('0xd')](function(_0x1e8456){logger[_0xdb6e('0xe')](_0xdb6e('0xf'),_0x36e203,_0xdb6e('0x10'));logger[_0xdb6e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x36e203,'request\x20sent',JSON['stringify'](_0x1e8456));if(_0x1e8456[_0xdb6e('0x12')]){if(_0x1e8456[_0xdb6e('0x12')][_0xdb6e('0x13')]===0x1f4){logger['error'](_0xdb6e('0xf'),_0x36e203,_0x1e8456[_0xdb6e('0x12')][_0xdb6e('0x14')]);return _0x4d07d6(_0x1e8456[_0xdb6e('0x12')][_0xdb6e('0x14')]);}logger[_0xdb6e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x36e203,_0x1e8456[_0xdb6e('0x12')]['message']);return _0x30f168(_0x1e8456['error'][_0xdb6e('0x14')]);}else{logger[_0xdb6e('0xe')](_0xdb6e('0xf'),_0x36e203,_0xdb6e('0x10'));_0x30f168(_0x1e8456['result'][_0xdb6e('0x14')]);}})['catch'](function(_0x34b3be){logger[_0xdb6e('0x12')](_0xdb6e('0xf'),_0x36e203,_0x34b3be);_0x4d07d6(_0x34b3be);});});} \ No newline at end of file +var _0x3377=['../../config/utils','rpc','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3377,0x164));var _0x7337=function(_0x47590a,_0x3369bc){_0x47590a=_0x47590a-0x0;var _0x576ab3=_0x3377[_0x47590a];return _0x576ab3;};'use strict';var _=require(_0x7337('0x0'));var util=require(_0x7337('0x1'));var moment=require(_0x7337('0x2'));var BPromise=require('bluebird');var rs=require(_0x7337('0x3'));var fs=require('fs');var Redis=require(_0x7337('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7337('0x5'));var logger=require('../../config/logger')(_0x7337('0x6'));var config=require(_0x7337('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7337('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x192895,_0x1f1156,_0xbf990e){return new BPromise(function(_0x2d07ea,_0x406bf4){return client[_0x7337('0x9')](_0x192895,_0xbf990e)[_0x7337('0xa')](function(_0x7663a8){logger[_0x7337('0xb')](_0x7337('0xc'),_0x1f1156,_0x7337('0xd'));logger[_0x7337('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1f1156,_0x7337('0xd'),JSON['stringify'](_0x7663a8));if(_0x7663a8[_0x7337('0xf')]){if(_0x7663a8['error'][_0x7337('0x10')]===0x1f4){logger[_0x7337('0xf')](_0x7337('0xc'),_0x1f1156,_0x7663a8[_0x7337('0xf')]['message']);return _0x406bf4(_0x7663a8['error'][_0x7337('0x11')]);}logger[_0x7337('0xf')](_0x7337('0xc'),_0x1f1156,_0x7663a8[_0x7337('0xf')][_0x7337('0x11')]);return _0x2d07ea(_0x7663a8[_0x7337('0xf')][_0x7337('0x11')]);}else{logger[_0x7337('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1f1156,_0x7337('0xd'));_0x2d07ea(_0x7663a8['result']['message']);}})[_0x7337('0x12')](function(_0x200de9){logger[_0x7337('0xf')](_0x7337('0xc'),_0x1f1156,_0x200de9);_0x406bf4(_0x200de9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4e25035..9770a73 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 _0xcf71=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','/:id/query','query','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x13ca07,_0x22b8ef){var _0x48782e=function(_0x1c7850){while(--_0x1c7850){_0x13ca07['push'](_0x13ca07['shift']());}};_0x48782e(++_0x22b8ef);}(_0xcf71,0xba));var _0x1cf7=function(_0x533843,_0x3d5ec0){_0x533843=_0x533843-0x0;var _0x55a5f4=_0xcf71[_0x533843];return _0x55a5f4;};'use strict';var multer=require(_0x1cf7('0x0'));var util=require(_0x1cf7('0x1'));var path=require(_0x1cf7('0x2'));var timeout=require(_0x1cf7('0x3'));var express=require('express');var router=express[_0x1cf7('0x4')]();var fs_extra=require(_0x1cf7('0x5'));var auth=require(_0x1cf7('0x6'));var interaction=require(_0x1cf7('0x7'));var config=require(_0x1cf7('0x8'));var controller=require(_0x1cf7('0x9'));router[_0x1cf7('0xa')]('/',auth[_0x1cf7('0xb')](),controller[_0x1cf7('0xc')]);router[_0x1cf7('0xa')](_0x1cf7('0xd'),auth[_0x1cf7('0xb')](),controller['show']);router['get'](_0x1cf7('0xe'),auth[_0x1cf7('0xb')](),controller[_0x1cf7('0xf')]);router['get'](_0x1cf7('0x10'),auth['isAuthenticated'](),controller['run']);router[_0x1cf7('0xa')](_0x1cf7('0x11'),auth[_0x1cf7('0xb')](),controller[_0x1cf7('0x12')]);router[_0x1cf7('0x13')]('/',auth[_0x1cf7('0xb')](),controller['create']);router[_0x1cf7('0x14')]('/:id',auth[_0x1cf7('0xb')](),controller['update']);router[_0x1cf7('0x15')](_0x1cf7('0xd'),auth['isAuthenticated'](),controller[_0x1cf7('0x16')]);module[_0x1cf7('0x17')]=router; \ No newline at end of file +var _0x44fa=['/:id/query','query','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','preview','/:id/run','run'];(function(_0x1ef9e4,_0x4be134){var _0x1dcb4c=function(_0x21a6db){while(--_0x21a6db){_0x1ef9e4['push'](_0x1ef9e4['shift']());}};_0x1dcb4c(++_0x4be134);}(_0x44fa,0x68));var _0xa44f=function(_0x345660,_0x2d90a6){_0x345660=_0x345660-0x0;var _0x3b4601=_0x44fa[_0x345660];return _0x3b4601;};'use strict';var multer=require(_0xa44f('0x0'));var util=require(_0xa44f('0x1'));var path=require(_0xa44f('0x2'));var timeout=require(_0xa44f('0x3'));var express=require(_0xa44f('0x4'));var router=express[_0xa44f('0x5')]();var fs_extra=require(_0xa44f('0x6'));var auth=require(_0xa44f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa44f('0x8'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0xa44f('0x9')](),controller[_0xa44f('0xa')]);router[_0xa44f('0xb')]('/:id',auth[_0xa44f('0x9')](),controller[_0xa44f('0xc')]);router[_0xa44f('0xb')]('/:id/preview',auth[_0xa44f('0x9')](),controller[_0xa44f('0xd')]);router[_0xa44f('0xb')](_0xa44f('0xe'),auth[_0xa44f('0x9')](),controller[_0xa44f('0xf')]);router[_0xa44f('0xb')](_0xa44f('0x10'),auth[_0xa44f('0x9')](),controller[_0xa44f('0x11')]);router[_0xa44f('0x12')]('/',auth[_0xa44f('0x9')](),controller[_0xa44f('0x13')]);router[_0xa44f('0x14')](_0xa44f('0x15'),auth[_0xa44f('0x9')](),controller['update']);router[_0xa44f('0x16')](_0xa44f('0x15'),auth[_0xa44f('0x9')](),controller['destroy']);module[_0xa44f('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 31bed74..561ad9a 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 _0x70dd=['INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','scheduled','manual'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0x70dd,0xe5));var _0xd70d=function(_0x3789f0,_0x30af4a){_0x3789f0=_0x3789f0-0x0;var _0x3486cc=_0x70dd[_0x3789f0];return _0x3486cc;};'use strict';var Sequelize=require(_0xd70d('0x0'));var moment=require(_0xd70d('0x1'));module[_0xd70d('0x2')]={'name':{'type':Sequelize[_0xd70d('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xd70d('0x4')](_0xd70d('0x5'),_0xd70d('0x6'),_0xd70d('0x7')),'allowNull':![],'defaultValue':_0xd70d('0x5')},'savename':{'type':Sequelize[_0xd70d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd70d('0x8')]},'endDate':{'type':Sequelize[_0xd70d('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xd70d('0x4')]('manual',_0xd70d('0x9')),'allowNull':![],'defaultValue':_0xd70d('0xa')},'reportId':{'type':Sequelize[_0xd70d('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd846=['moment','STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x23e6d6,_0x1be04f){var _0xa8469b=function(_0x573263){while(--_0x573263){_0x23e6d6['push'](_0x23e6d6['shift']());}};_0xa8469b(++_0x1be04f);}(_0xd846,0x1c3));var _0x6d84=function(_0x65b116,_0x417a2d){_0x65b116=_0x65b116-0x0;var _0x3c7274=_0xd846[_0x65b116];return _0x3c7274;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6d84('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x6d84('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x6d84('0x2')]('csv',_0x6d84('0x3'),_0x6d84('0x4')),'allowNull':![],'defaultValue':_0x6d84('0x5')},'savename':{'type':Sequelize[_0x6d84('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6d84('0x6')]},'endDate':{'type':Sequelize[_0x6d84('0x6')]},'status':{'type':Sequelize[_0x6d84('0x1')],'defaultValue':_0x6d84('0x7')},'type':{'type':Sequelize[_0x6d84('0x2')](_0x6d84('0x8'),_0x6d84('0x9')),'allowNull':![],'defaultValue':_0x6d84('0x8')},'reportId':{'type':Sequelize[_0x6d84('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x6d84('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index eb32715..a406b43 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 _0x6ef5=['json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','include','rows','catch','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','root','Sequelize','ValidationError','sendStatus','join','server/files/reports','format','%s.%s','output','toLowerCase','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x6ef5,0xfe));var _0x56ef=function(_0x453c4e,_0x4cc709){_0x453c4e=_0x453c4e-0x0;var _0x4aaa99=_0x6ef5[_0x453c4e];return _0x4aaa99;};'use strict';var emlformat=require(_0x56ef('0x0'));var rimraf=require(_0x56ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56ef('0x2'));var rp=require('request-promise');var moment=require(_0x56ef('0x3'));var BPromise=require(_0x56ef('0x4'));var Mustache=require(_0x56ef('0x5'));var util=require('util');var path=require(_0x56ef('0x6'));var sox=require(_0x56ef('0x7'));var csv=require(_0x56ef('0x8'));var ejs=require(_0x56ef('0x9'));var fs=require('fs');var fs_extra=require(_0x56ef('0xa'));var _=require(_0x56ef('0xb'));var squel=require(_0x56ef('0xc'));var crypto=require(_0x56ef('0xd'));var jsforce=require(_0x56ef('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x56ef('0xf'));var Papa=require(_0x56ef('0x10'));var Redis=require(_0x56ef('0x11'));var authService=require(_0x56ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x56ef('0x13'));var hardwareService=require(_0x56ef('0x14'));var logger=require('../../config/logger')(_0x56ef('0x15'));var utils=require('../../config/utils');var config=require(_0x56ef('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x56ef('0x17'))['db'];function respondWithStatusCode(_0x28d751,_0xaa0b97){_0xaa0b97=_0xaa0b97||0xcc;return function(_0x2070f9){if(_0x2070f9){return _0x28d751['sendStatus'](_0xaa0b97);}return _0x28d751['status'](_0xaa0b97)[_0x56ef('0x18')]();};}function respondWithResult(_0x5a5915,_0x155718){_0x155718=_0x155718||0xc8;return function(_0x52a9e8){if(_0x52a9e8){return _0x5a5915[_0x56ef('0x19')](_0x155718)['json'](_0x52a9e8);}};}function respondWithFilteredResult(_0x34c068,_0x259c98){return function(_0x4c5f71){if(_0x4c5f71){var _0x3307e7=typeof _0x259c98[_0x56ef('0x1a')]===_0x56ef('0x1b')&&typeof _0x259c98[_0x56ef('0x1c')]===_0x56ef('0x1b');var _0x32d4ba=_0x4c5f71[_0x56ef('0x1d')];var _0xccfdd6=_0x3307e7?0x0:_0x259c98[_0x56ef('0x1a')];var _0x22e97e=_0x3307e7?_0x4c5f71[_0x56ef('0x1d')]:_0x259c98[_0x56ef('0x1a')]+_0x259c98['limit'];var _0xabb79b;if(_0x22e97e>=_0x32d4ba){_0x22e97e=_0x32d4ba;_0xabb79b=0xc8;}else{_0xabb79b=0xce;}_0x34c068['status'](_0xabb79b);return _0x34c068[_0x56ef('0x1e')]('Content-Range',_0xccfdd6+'-'+_0x22e97e+'/'+_0x32d4ba)[_0x56ef('0x1f')](_0x4c5f71);}return null;};}function patchUpdates(_0x3d7905){return function(_0x4054ac){try{jsonpatch[_0x56ef('0x20')](_0x4054ac,_0x3d7905,!![]);}catch(_0x16275a){return BPromise[_0x56ef('0x21')](_0x16275a);}return _0x4054ac['save']();};}function saveUpdates(_0x4808ad,_0x3af7eb){return function(_0x4fed25){if(_0x4fed25){return _0x4fed25[_0x56ef('0x22')](_0x4808ad)[_0x56ef('0x23')](function(_0x151bfd){return _0x151bfd;});}return null;};}function removeEntity(_0xbba6f,_0x3e1946){return function(_0x38378a){if(_0x38378a){return _0x38378a[_0x56ef('0x24')]()['then'](function(){var _0x54dafb=_0x38378a[_0x56ef('0x25')]({'plain':!![]});var _0x55026e='ExtractedReports';return db[_0x56ef('0x26')][_0x56ef('0x24')]({'where':{'type':_0x55026e,'resourceId':_0x54dafb['id']}})[_0x56ef('0x23')](function(){return _0x38378a;});})[_0x56ef('0x23')](function(){_0xbba6f[_0x56ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4589fe,_0xda6fc3){return function(_0x33446d){if(!_0x33446d){_0x4589fe['sendStatus'](0x194);}return _0x33446d;};}function handleError(_0x2689f6,_0x32d4b6){_0x32d4b6=_0x32d4b6||0x1f4;return function(_0x4fe908){logger[_0x56ef('0x27')](_0x4fe908[_0x56ef('0x28')]);if(_0x4fe908[_0x56ef('0x29')]){delete _0x4fe908['name'];}_0x2689f6[_0x56ef('0x19')](_0x32d4b6)[_0x56ef('0x2a')](_0x4fe908);};}exports[_0x56ef('0x2b')]=function(_0x581719,_0x118b24){var _0x24aa29={},_0x219d4c={},_0x354f8e={'count':0x0,'rows':[]};var _0x683ab2=_['map'](db[_0x56ef('0x2c')][_0x56ef('0x2d')],function(_0x40e57c){return{'name':_0x40e57c[_0x56ef('0x2e')],'type':_0x40e57c[_0x56ef('0x2f')][_0x56ef('0x30')]};});_0x219d4c[_0x56ef('0x31')]=_[_0x56ef('0x32')](_0x683ab2,'name');_0x219d4c[_0x56ef('0x33')]=_[_0x56ef('0x34')](_0x581719[_0x56ef('0x33')]);_0x219d4c['filters']=_['intersection'](_0x219d4c[_0x56ef('0x31')],_0x219d4c['query']);_0x24aa29['attributes']=_[_0x56ef('0x35')](_0x219d4c['model'],qs[_0x56ef('0x36')](_0x581719[_0x56ef('0x33')][_0x56ef('0x36')]));_0x24aa29[_0x56ef('0x37')]=_0x24aa29[_0x56ef('0x37')][_0x56ef('0x38')]?_0x24aa29[_0x56ef('0x37')]:_0x219d4c['model'];if(!_0x581719[_0x56ef('0x33')][_0x56ef('0x39')](_0x56ef('0x3a'))){_0x24aa29[_0x56ef('0x1c')]=qs['limit'](_0x581719['query'][_0x56ef('0x1c')]);_0x24aa29['offset']=qs[_0x56ef('0x1a')](_0x581719[_0x56ef('0x33')][_0x56ef('0x1a')]);}_0x24aa29[_0x56ef('0x3b')]=qs['sort'](_0x581719[_0x56ef('0x33')][_0x56ef('0x3c')]);_0x24aa29[_0x56ef('0x3d')]=qs[_0x56ef('0x3e')](_[_0x56ef('0x3f')](_0x581719['query'],_0x219d4c[_0x56ef('0x3e')]),_0x683ab2);if(_0x581719[_0x56ef('0x33')]['filter']){_0x24aa29[_0x56ef('0x3d')]=_['merge'](_0x24aa29['where'],{'$or':_[_0x56ef('0x32')](_0x683ab2,function(_0x256e59){if(_0x256e59[_0x56ef('0x2f')]!=='VIRTUAL'){var _0x17f9ce={};_0x17f9ce[_0x256e59[_0x56ef('0x29')]]={'$like':'%'+_0x581719['query'][_0x56ef('0x40')]+'%'};return _0x17f9ce;}})});}_0x24aa29=_[_0x56ef('0x41')]({},_0x24aa29,_0x581719['options']);var _0x417778={'where':_0x24aa29['where']};return db[_0x56ef('0x2c')][_0x56ef('0x1d')](_0x417778)[_0x56ef('0x23')](function(_0x5a5a69){_0x354f8e['count']=_0x5a5a69;if(_0x581719[_0x56ef('0x33')]['includeAll']){_0x24aa29[_0x56ef('0x42')]=[{'all':!![]}];}return db[_0x56ef('0x2c')]['findAll'](_0x24aa29);})[_0x56ef('0x23')](function(_0xff76e7){_0x354f8e[_0x56ef('0x43')]=_0xff76e7;return _0x354f8e;})[_0x56ef('0x23')](respondWithFilteredResult(_0x118b24,_0x24aa29))[_0x56ef('0x44')](handleError(_0x118b24,null));};exports['show']=function(_0x7228cc,_0x2c9cb5){var _0x35e900={'raw':!![],'where':{'id':_0x7228cc[_0x56ef('0x45')]['id']}},_0x4c226c={};_0x4c226c[_0x56ef('0x31')]=_[_0x56ef('0x34')](db[_0x56ef('0x2c')][_0x56ef('0x2d')]);_0x4c226c[_0x56ef('0x33')]=_[_0x56ef('0x34')](_0x7228cc[_0x56ef('0x33')]);_0x4c226c[_0x56ef('0x3e')]=_[_0x56ef('0x35')](_0x4c226c[_0x56ef('0x31')],_0x4c226c['query']);_0x35e900[_0x56ef('0x37')]=_[_0x56ef('0x35')](_0x4c226c['model'],qs['fields'](_0x7228cc[_0x56ef('0x33')][_0x56ef('0x36')]));_0x35e900[_0x56ef('0x37')]=_0x35e900['attributes'][_0x56ef('0x38')]?_0x35e900['attributes']:_0x4c226c['model'];if(_0x7228cc['query'][_0x56ef('0x46')]){_0x35e900[_0x56ef('0x42')]=[{'all':!![]}];}_0x35e900=_['merge']({},_0x35e900,_0x7228cc[_0x56ef('0x47')]);return db[_0x56ef('0x2c')][_0x56ef('0x48')](_0x35e900)['then'](handleEntityNotFound(_0x2c9cb5,null))[_0x56ef('0x23')](respondWithResult(_0x2c9cb5,null))[_0x56ef('0x44')](handleError(_0x2c9cb5,null));};exports[_0x56ef('0x49')]=function(_0x3ac98e,_0x593ff9){return db['AnalyticExtractedReport']['create'](_0x3ac98e[_0x56ef('0x4a')],{})[_0x56ef('0x23')](function(_0x3b6970){var _0x145b86=_0x3ac98e[_0x56ef('0x4b')][_0x56ef('0x25')]({'plain':!![]});if(!_0x145b86)throw new Error(_0x56ef('0x4c'));if(_0x145b86[_0x56ef('0x4d')]===_0x56ef('0x4b')){var _0x4c0d2e=_0x3b6970[_0x56ef('0x25')]({'plain':!![]});var _0x461b45=_0x56ef('0x4e');return db['UserProfileSection'][_0x56ef('0x48')]({'where':{'name':_0x461b45,'userProfileId':_0x145b86[_0x56ef('0x4f')]},'raw':!![]})[_0x56ef('0x23')](function(_0x33c4df){if(_0x33c4df&&_0x33c4df['autoAssociation']===0x0){return db['UserProfileResource'][_0x56ef('0x49')]({'name':_0x4c0d2e[_0x56ef('0x29')],'resourceId':_0x4c0d2e['id'],'type':_0x33c4df[_0x56ef('0x29')],'sectionId':_0x33c4df['id']},{})['then'](function(){return _0x3b6970;});}else{return _0x3b6970;}})[_0x56ef('0x44')](function(_0x26c5eb){logger[_0x56ef('0x27')](_0x56ef('0x50'),_0x26c5eb);throw _0x26c5eb;});}return _0x3b6970;})[_0x56ef('0x23')](respondWithResult(_0x593ff9,0xc9))[_0x56ef('0x44')](handleError(_0x593ff9,null));};exports[_0x56ef('0x22')]=function(_0x2229fe,_0x4c60a3){if(_0x2229fe['body']['id']){delete _0x2229fe[_0x56ef('0x4a')]['id'];}return db['AnalyticExtractedReport'][_0x56ef('0x48')]({'where':{'id':_0x2229fe[_0x56ef('0x45')]['id']}})[_0x56ef('0x23')](handleEntityNotFound(_0x4c60a3,null))[_0x56ef('0x23')](saveUpdates(_0x2229fe[_0x56ef('0x4a')],null))[_0x56ef('0x23')](respondWithResult(_0x4c60a3,null))['catch'](handleError(_0x4c60a3,null));};exports['destroy']=function(_0x46fbb1,_0x14c193){return db[_0x56ef('0x2c')][_0x56ef('0x48')]({'where':{'id':_0x46fbb1[_0x56ef('0x45')]['id']}})[_0x56ef('0x23')](handleEntityNotFound(_0x14c193,null))[_0x56ef('0x23')](removeEntity(_0x14c193,null))[_0x56ef('0x44')](handleError(_0x14c193,null));};exports[_0x56ef('0x51')]=function(_0x2684a7,_0x1aeb93,_0xf4b9ca){return db[_0x56ef('0x2c')][_0x56ef('0x48')]({'where':{'id':_0x2684a7[_0x56ef('0x45')]['id']},'attributes':[_0x56ef('0x29'),_0x56ef('0x52'),_0x56ef('0x53'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x1aeb93,null))['then'](function(_0x31f042){if(_0x31f042){if(!fs[_0x56ef('0x54')](path['join'](config[_0x56ef('0x55')],'server/files/reports',_0x31f042['savename']))){throw new db[(_0x56ef('0x56'))][(_0x56ef('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x2684a7['query']['exists']){return _0x1aeb93[_0x56ef('0x58')](0xc8);}return _0x1aeb93[_0x56ef('0x51')](path[_0x56ef('0x59')](config[_0x56ef('0x55')],_0x56ef('0x5a'),_0x31f042[_0x56ef('0x53')]),util[_0x56ef('0x5b')](_0x56ef('0x5c'),_0x31f042[_0x56ef('0x52')]||_0x31f042[_0x56ef('0x29')],_0x31f042[_0x56ef('0x5d')][_0x56ef('0x5e')]()));}})['catch'](handleError(_0x1aeb93,null));}; \ No newline at end of file +var _0xcbbf=['fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','AnalyticExtractedReport','includeAll','findAll','rows','catch','show','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','download','basename','output','existsSync','join','savename','ValidationError','exists','root','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','ExtractedReports','UserProfileResource','stack','name','map','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbbf,0x156));var _0xfcbb=function(_0x51208e,_0x30cc15){_0x51208e=_0x51208e-0x0;var _0x11dc15=_0xcbbf[_0x51208e];return _0x11dc15;};'use strict';var emlformat=require(_0xfcbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcbb('0x1'));var jsonpatch=require(_0xfcbb('0x2'));var rp=require('request-promise');var moment=require(_0xfcbb('0x3'));var BPromise=require(_0xfcbb('0x4'));var Mustache=require(_0xfcbb('0x5'));var util=require('util');var path=require(_0xfcbb('0x6'));var sox=require(_0xfcbb('0x7'));var csv=require(_0xfcbb('0x8'));var ejs=require(_0xfcbb('0x9'));var fs=require('fs');var fs_extra=require(_0xfcbb('0xa'));var _=require(_0xfcbb('0xb'));var squel=require(_0xfcbb('0xc'));var crypto=require('crypto');var jsforce=require(_0xfcbb('0xd'));var deskjs=require(_0xfcbb('0xe'));var toCsv=require(_0xfcbb('0x8'));var querystring=require(_0xfcbb('0xf'));var Papa=require(_0xfcbb('0x10'));var Redis=require(_0xfcbb('0x11'));var authService=require(_0xfcbb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfcbb('0x13'));var hardwareService=require(_0xfcbb('0x14'));var logger=require(_0xfcbb('0x15'))(_0xfcbb('0x16'));var utils=require(_0xfcbb('0x17'));var config=require(_0xfcbb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcbb('0x19'))['db'];function respondWithStatusCode(_0x139bb1,_0x301f64){_0x301f64=_0x301f64||0xcc;return function(_0x57594f){if(_0x57594f){return _0x139bb1[_0xfcbb('0x1a')](_0x301f64);}return _0x139bb1[_0xfcbb('0x1b')](_0x301f64)[_0xfcbb('0x1c')]();};}function respondWithResult(_0xb76a3,_0x43269b){_0x43269b=_0x43269b||0xc8;return function(_0x404c23){if(_0x404c23){return _0xb76a3[_0xfcbb('0x1b')](_0x43269b)[_0xfcbb('0x1d')](_0x404c23);}};}function respondWithFilteredResult(_0x53cd42,_0x40849c){return function(_0x3a96bf){if(_0x3a96bf){var _0xb54303=typeof _0x40849c[_0xfcbb('0x1e')]===_0xfcbb('0x1f')&&typeof _0x40849c[_0xfcbb('0x20')]===_0xfcbb('0x1f');var _0x4605f9=_0x3a96bf['count'];var _0x5d8c0e=_0xb54303?0x0:_0x40849c[_0xfcbb('0x1e')];var _0x494550=_0xb54303?_0x3a96bf[_0xfcbb('0x21')]:_0x40849c['offset']+_0x40849c[_0xfcbb('0x20')];var _0x1485ab;if(_0x494550>=_0x4605f9){_0x494550=_0x4605f9;_0x1485ab=0xc8;}else{_0x1485ab=0xce;}_0x53cd42[_0xfcbb('0x1b')](_0x1485ab);return _0x53cd42[_0xfcbb('0x22')](_0xfcbb('0x23'),_0x5d8c0e+'-'+_0x494550+'/'+_0x4605f9)['json'](_0x3a96bf);}return null;};}function patchUpdates(_0x45544e){return function(_0x1c9827){try{jsonpatch['apply'](_0x1c9827,_0x45544e,!![]);}catch(_0x42b6b8){return BPromise[_0xfcbb('0x24')](_0x42b6b8);}return _0x1c9827[_0xfcbb('0x25')]();};}function saveUpdates(_0x3203ab,_0x18b70a){return function(_0x49b353){if(_0x49b353){return _0x49b353['update'](_0x3203ab)['then'](function(_0x145c9b){return _0x145c9b;});}return null;};}function removeEntity(_0x401459,_0x3601f9){return function(_0xb7e4b7){if(_0xb7e4b7){return _0xb7e4b7['destroy']()[_0xfcbb('0x26')](function(){var _0xd35ac5=_0xb7e4b7[_0xfcbb('0x27')]({'plain':!![]});var _0xc3e951=_0xfcbb('0x28');return db[_0xfcbb('0x29')]['destroy']({'where':{'type':_0xc3e951,'resourceId':_0xd35ac5['id']}})['then'](function(){return _0xb7e4b7;});})[_0xfcbb('0x26')](function(){_0x401459[_0xfcbb('0x1b')](0xcc)[_0xfcbb('0x1c')]();});}};}function handleEntityNotFound(_0x117544,_0x1d7d91){return function(_0x2af2a3){if(!_0x2af2a3){_0x117544[_0xfcbb('0x1a')](0x194);}return _0x2af2a3;};}function handleError(_0x1f9e2e,_0x2e802c){_0x2e802c=_0x2e802c||0x1f4;return function(_0x1d2910){logger['error'](_0x1d2910[_0xfcbb('0x2a')]);if(_0x1d2910['name']){delete _0x1d2910[_0xfcbb('0x2b')];}_0x1f9e2e[_0xfcbb('0x1b')](_0x2e802c)['send'](_0x1d2910);};}exports['index']=function(_0x131d6a,_0x3ddafa){var _0x3ae130={},_0x341f33={},_0x21aed5={'count':0x0,'rows':[]};var _0x5488de=_[_0xfcbb('0x2c')](db['AnalyticExtractedReport'][_0xfcbb('0x2d')],function(_0x59d01a){return{'name':_0x59d01a[_0xfcbb('0x2e')],'type':_0x59d01a[_0xfcbb('0x2f')][_0xfcbb('0x30')]};});_0x341f33[_0xfcbb('0x31')]=_[_0xfcbb('0x2c')](_0x5488de,_0xfcbb('0x2b'));_0x341f33[_0xfcbb('0x32')]=_[_0xfcbb('0x33')](_0x131d6a[_0xfcbb('0x32')]);_0x341f33[_0xfcbb('0x34')]=_[_0xfcbb('0x35')](_0x341f33[_0xfcbb('0x31')],_0x341f33['query']);_0x3ae130[_0xfcbb('0x36')]=_['intersection'](_0x341f33[_0xfcbb('0x31')],qs['fields'](_0x131d6a[_0xfcbb('0x32')]['fields']));_0x3ae130[_0xfcbb('0x36')]=_0x3ae130[_0xfcbb('0x36')][_0xfcbb('0x37')]?_0x3ae130['attributes']:_0x341f33[_0xfcbb('0x31')];if(!_0x131d6a[_0xfcbb('0x32')][_0xfcbb('0x38')]('nolimit')){_0x3ae130[_0xfcbb('0x20')]=qs[_0xfcbb('0x20')](_0x131d6a[_0xfcbb('0x32')]['limit']);_0x3ae130['offset']=qs['offset'](_0x131d6a[_0xfcbb('0x32')][_0xfcbb('0x1e')]);}_0x3ae130['order']=qs[_0xfcbb('0x39')](_0x131d6a['query'][_0xfcbb('0x39')]);_0x3ae130['where']=qs[_0xfcbb('0x34')](_[_0xfcbb('0x3a')](_0x131d6a[_0xfcbb('0x32')],_0x341f33[_0xfcbb('0x34')]),_0x5488de);if(_0x131d6a[_0xfcbb('0x32')][_0xfcbb('0x3b')]){_0x3ae130[_0xfcbb('0x3c')]=_['merge'](_0x3ae130[_0xfcbb('0x3c')],{'$or':_[_0xfcbb('0x2c')](_0x5488de,function(_0x4e93e1){if(_0x4e93e1[_0xfcbb('0x2f')]!==_0xfcbb('0x3d')){var _0x57f796={};_0x57f796[_0x4e93e1[_0xfcbb('0x2b')]]={'$like':'%'+_0x131d6a[_0xfcbb('0x32')][_0xfcbb('0x3b')]+'%'};return _0x57f796;}})});}_0x3ae130=_['merge']({},_0x3ae130,_0x131d6a[_0xfcbb('0x3e')]);var _0x4cb4f1={'where':_0x3ae130['where']};return db[_0xfcbb('0x3f')]['count'](_0x4cb4f1)[_0xfcbb('0x26')](function(_0x41514f){_0x21aed5[_0xfcbb('0x21')]=_0x41514f;if(_0x131d6a[_0xfcbb('0x32')][_0xfcbb('0x40')]){_0x3ae130['include']=[{'all':!![]}];}return db[_0xfcbb('0x3f')][_0xfcbb('0x41')](_0x3ae130);})[_0xfcbb('0x26')](function(_0x4c6041){_0x21aed5[_0xfcbb('0x42')]=_0x4c6041;return _0x21aed5;})[_0xfcbb('0x26')](respondWithFilteredResult(_0x3ddafa,_0x3ae130))[_0xfcbb('0x43')](handleError(_0x3ddafa,null));};exports[_0xfcbb('0x44')]=function(_0x31896a,_0x166de5){var _0x1ef719={'raw':!![],'where':{'id':_0x31896a['params']['id']}},_0x5c3e11={};_0x5c3e11[_0xfcbb('0x31')]=_[_0xfcbb('0x33')](db[_0xfcbb('0x3f')][_0xfcbb('0x2d')]);_0x5c3e11[_0xfcbb('0x32')]=_[_0xfcbb('0x33')](_0x31896a['query']);_0x5c3e11[_0xfcbb('0x34')]=_[_0xfcbb('0x35')](_0x5c3e11['model'],_0x5c3e11[_0xfcbb('0x32')]);_0x1ef719[_0xfcbb('0x36')]=_[_0xfcbb('0x35')](_0x5c3e11[_0xfcbb('0x31')],qs[_0xfcbb('0x45')](_0x31896a[_0xfcbb('0x32')][_0xfcbb('0x45')]));_0x1ef719[_0xfcbb('0x36')]=_0x1ef719[_0xfcbb('0x36')][_0xfcbb('0x37')]?_0x1ef719['attributes']:_0x5c3e11[_0xfcbb('0x31')];if(_0x31896a[_0xfcbb('0x32')][_0xfcbb('0x40')]){_0x1ef719[_0xfcbb('0x46')]=[{'all':!![]}];}_0x1ef719=_['merge']({},_0x1ef719,_0x31896a[_0xfcbb('0x3e')]);return db['AnalyticExtractedReport'][_0xfcbb('0x47')](_0x1ef719)[_0xfcbb('0x26')](handleEntityNotFound(_0x166de5,null))[_0xfcbb('0x26')](respondWithResult(_0x166de5,null))[_0xfcbb('0x43')](handleError(_0x166de5,null));};exports['create']=function(_0x4abc5f,_0x5e335c){return db[_0xfcbb('0x3f')][_0xfcbb('0x48')](_0x4abc5f['body'],{})[_0xfcbb('0x26')](function(_0x3133aa){var _0x4aead5=_0x4abc5f[_0xfcbb('0x49')][_0xfcbb('0x27')]({'plain':!![]});if(!_0x4aead5)throw new Error(_0xfcbb('0x4a'));if(_0x4aead5[_0xfcbb('0x4b')]==='user'){var _0xa3f7d2=_0x3133aa[_0xfcbb('0x27')]({'plain':!![]});var _0x3c24ce=_0xfcbb('0x28');return db[_0xfcbb('0x4c')][_0xfcbb('0x47')]({'where':{'name':_0x3c24ce,'userProfileId':_0x4aead5[_0xfcbb('0x4d')]},'raw':!![]})[_0xfcbb('0x26')](function(_0x420e06){if(_0x420e06&&_0x420e06[_0xfcbb('0x4e')]===0x0){return db[_0xfcbb('0x29')][_0xfcbb('0x48')]({'name':_0xa3f7d2[_0xfcbb('0x2b')],'resourceId':_0xa3f7d2['id'],'type':_0x420e06[_0xfcbb('0x2b')],'sectionId':_0x420e06['id']},{})[_0xfcbb('0x26')](function(){return _0x3133aa;});}else{return _0x3133aa;}})[_0xfcbb('0x43')](function(_0x5bcf92){logger[_0xfcbb('0x4f')](_0xfcbb('0x50'),_0x5bcf92);throw _0x5bcf92;});}return _0x3133aa;})[_0xfcbb('0x26')](respondWithResult(_0x5e335c,0xc9))[_0xfcbb('0x43')](handleError(_0x5e335c,null));};exports[_0xfcbb('0x51')]=function(_0x21bdb1,_0x334dd8){if(_0x21bdb1[_0xfcbb('0x52')]['id']){delete _0x21bdb1[_0xfcbb('0x52')]['id'];}return db['AnalyticExtractedReport'][_0xfcbb('0x47')]({'where':{'id':_0x21bdb1[_0xfcbb('0x53')]['id']}})['then'](handleEntityNotFound(_0x334dd8,null))[_0xfcbb('0x26')](saveUpdates(_0x21bdb1[_0xfcbb('0x52')],null))['then'](respondWithResult(_0x334dd8,null))[_0xfcbb('0x43')](handleError(_0x334dd8,null));};exports['destroy']=function(_0x1bb980,_0x2ff169){return db[_0xfcbb('0x3f')]['find']({'where':{'id':_0x1bb980[_0xfcbb('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ff169,null))[_0xfcbb('0x26')](removeEntity(_0x2ff169,null))['catch'](handleError(_0x2ff169,null));};exports[_0xfcbb('0x54')]=function(_0x445a8d,_0x2b2ba9,_0x2e6cb6){return db[_0xfcbb('0x3f')][_0xfcbb('0x47')]({'where':{'id':_0x445a8d['params']['id']},'attributes':[_0xfcbb('0x2b'),_0xfcbb('0x55'),'savename',_0xfcbb('0x56')],'raw':!![]})[_0xfcbb('0x26')](handleEntityNotFound(_0x2b2ba9,null))[_0xfcbb('0x26')](function(_0x26038b){if(_0x26038b){if(!fs[_0xfcbb('0x57')](path[_0xfcbb('0x58')](config['root'],'server/files/reports',_0x26038b[_0xfcbb('0x59')]))){throw new db['Sequelize'][(_0xfcbb('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x445a8d[_0xfcbb('0x32')][_0xfcbb('0x5b')]){return _0x2b2ba9[_0xfcbb('0x1a')](0xc8);}return _0x2b2ba9[_0xfcbb('0x54')](path['join'](config[_0xfcbb('0x5c')],_0xfcbb('0x5d'),_0x26038b[_0xfcbb('0x59')]),util[_0xfcbb('0x5e')](_0xfcbb('0x5f'),_0x26038b[_0xfcbb('0x55')]||_0x26038b[_0xfcbb('0x2b')],_0x26038b['output'][_0xfcbb('0x60')]()));}})[_0xfcbb('0x43')](handleError(_0x2b2ba9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index ea0ead5..cc5f0d8 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 _0xb3fa=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','api','moment'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xb3fa,0xda));var _0xab3f=function(_0x33f9bb,_0x57740e){_0x33f9bb=_0x33f9bb-0x0;var _0x1ead6d=_0xb3fa[_0x33f9bb];return _0x1ead6d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xab3f('0x0'));var moment=require(_0xab3f('0x1'));var BPromise=require(_0xab3f('0x2'));var rp=require(_0xab3f('0x3'));var fs=require('fs');var path=require(_0xab3f('0x4'));var rimraf=require(_0xab3f('0x5'));var config=require(_0xab3f('0x6'));var attributes=require(_0xab3f('0x7'));module[_0xab3f('0x8')]=function(_0x3c0781,_0x1a6048){return _0x3c0781['define']('AnalyticExtractedReport',attributes,{'tableName':_0xab3f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd597=['path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','api','moment','bluebird'];(function(_0x5d491a,_0x46fe1b){var _0x31b402=function(_0x14854e){while(--_0x14854e){_0x5d491a['push'](_0x5d491a['shift']());}};_0x31b402(++_0x46fe1b);}(_0xd597,0x119));var _0x7d59=function(_0x407885,_0x43907d){_0x407885=_0x407885-0x0;var _0x2c9a72=_0xd597[_0x407885];return _0x2c9a72;};'use strict';var _=require(_0x7d59('0x0'));var util=require(_0x7d59('0x1'));var logger=require('../../config/logger')(_0x7d59('0x2'));var moment=require(_0x7d59('0x3'));var BPromise=require(_0x7d59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d59('0x5'));var rimraf=require(_0x7d59('0x6'));var config=require('../../config/environment');var attributes=require(_0x7d59('0x7'));module[_0x7d59('0x8')]=function(_0x2d6eae,_0x56732f){return _0x2d6eae[_0x7d59('0x9')](_0x7d59('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d19a91d..214c0b4 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 _0xe764=['client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe764,0x85));var _0x4e76=function(_0x4c5a90,_0x39edaf){_0x4c5a90=_0x4c5a90-0x0;var _0x8e83e8=_0xe764[_0x4c5a90];return _0x8e83e8;};'use strict';var _=require(_0x4e76('0x0'));var util=require(_0x4e76('0x1'));var moment=require(_0x4e76('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e76('0x3'));var fs=require('fs');var Redis=require(_0x4e76('0x4'));var db=require(_0x4e76('0x5'))['db'];var utils=require(_0x4e76('0x6'));var logger=require(_0x4e76('0x7'))(_0x4e76('0x8'));var config=require(_0x4e76('0x9'));var jayson=require(_0x4e76('0xa'));var client=jayson[_0x4e76('0xb')][_0x4e76('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cf943,_0x1d3ebe,_0x4f9f3f){return new BPromise(function(_0x4e2d37,_0x46e59f){return client[_0x4e76('0xd')](_0x4cf943,_0x4f9f3f)[_0x4e76('0xe')](function(_0xf47aae){logger['info'](_0x4e76('0xf'),_0x1d3ebe,_0x4e76('0x10'));logger[_0x4e76('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1d3ebe,_0x4e76('0x10'),JSON[_0x4e76('0x12')](_0xf47aae));if(_0xf47aae[_0x4e76('0x13')]){if(_0xf47aae[_0x4e76('0x13')]['code']===0x1f4){logger[_0x4e76('0x13')](_0x4e76('0xf'),_0x1d3ebe,_0xf47aae[_0x4e76('0x13')]['message']);return _0x46e59f(_0xf47aae['error'][_0x4e76('0x14')]);}logger[_0x4e76('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1d3ebe,_0xf47aae[_0x4e76('0x13')][_0x4e76('0x14')]);return _0x4e2d37(_0xf47aae[_0x4e76('0x13')]['message']);}else{logger[_0x4e76('0x15')](_0x4e76('0xf'),_0x1d3ebe,'request\x20sent');_0x4e2d37(_0xf47aae[_0x4e76('0x16')][_0x4e76('0x14')]);}})[_0x4e76('0x17')](function(_0x5b9c99){logger[_0x4e76('0x13')](_0x4e76('0xf'),_0x1d3ebe,_0x5b9c99);_0x46e59f(_0x5b9c99);});});} \ No newline at end of file +var _0xa72e=['then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4dca07,_0x21eac1){var _0x11dcac=function(_0x5420e6){while(--_0x5420e6){_0x4dca07['push'](_0x4dca07['shift']());}};_0x11dcac(++_0x21eac1);}(_0xa72e,0x150));var _0xea72=function(_0x3e68f2,_0x5e7bf7){_0x3e68f2=_0x3e68f2-0x0;var _0x18718b=_0xa72e[_0x3e68f2];return _0x18718b;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var moment=require(_0xea72('0x2'));var BPromise=require(_0xea72('0x3'));var rs=require(_0xea72('0x4'));var fs=require('fs');var Redis=require(_0xea72('0x5'));var db=require(_0xea72('0x6'))['db'];var utils=require(_0xea72('0x7'));var logger=require(_0xea72('0x8'))(_0xea72('0x9'));var config=require(_0xea72('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xea72('0xb')][_0xea72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4de5ff,_0x4659d3,_0x131b75){return new BPromise(function(_0x3c6d64,_0x1c1dd6){return client[_0xea72('0xd')](_0x4de5ff,_0x131b75)[_0xea72('0xe')](function(_0x2c84a2){logger[_0xea72('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4659d3,_0xea72('0x10'));logger[_0xea72('0x11')](_0xea72('0x12'),_0x4659d3,_0xea72('0x10'),JSON[_0xea72('0x13')](_0x2c84a2));if(_0x2c84a2[_0xea72('0x14')]){if(_0x2c84a2['error']['code']===0x1f4){logger['error'](_0xea72('0x15'),_0x4659d3,_0x2c84a2['error'][_0xea72('0x16')]);return _0x1c1dd6(_0x2c84a2['error']['message']);}logger[_0xea72('0x14')](_0xea72('0x15'),_0x4659d3,_0x2c84a2['error'][_0xea72('0x16')]);return _0x3c6d64(_0x2c84a2[_0xea72('0x14')][_0xea72('0x16')]);}else{logger[_0xea72('0xf')](_0xea72('0x15'),_0x4659d3,_0xea72('0x10'));_0x3c6d64(_0x2c84a2[_0xea72('0x17')][_0xea72('0x16')]);}})[_0xea72('0x18')](function(_0x3d4af8){logger[_0xea72('0x14')](_0xea72('0x15'),_0x4659d3,_0x3d4af8);_0x1c1dd6(_0x3d4af8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5ae31be..dc20746 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 _0x3f27=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','/:id','show','get','/:id/download','post','create','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x17586f,_0xc29f47){var _0x583035=function(_0x56ce8e){while(--_0x56ce8e){_0x17586f['push'](_0x17586f['shift']());}};_0x583035(++_0xc29f47);}(_0x3f27,0xc4));var _0x73f2=function(_0x400b93,_0xf89da3){_0x400b93=_0x400b93-0x0;var _0x365d4b=_0x3f27[_0x400b93];return _0x365d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73f2('0x0'));var timeout=require(_0x73f2('0x1'));var express=require(_0x73f2('0x2'));var router=express[_0x73f2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x73f2('0x4'));var interaction=require(_0x73f2('0x5'));var config=require(_0x73f2('0x6'));var controller=require(_0x73f2('0x7'));router['get']('/',auth[_0x73f2('0x8')](),controller[_0x73f2('0x9')]);router['get'](_0x73f2('0xa'),auth[_0x73f2('0x8')](),controller[_0x73f2('0xb')]);router[_0x73f2('0xc')](_0x73f2('0xd'),auth[_0x73f2('0x8')](),controller['download']);router[_0x73f2('0xe')]('/',auth[_0x73f2('0x8')](),controller[_0x73f2('0xf')]);router[_0x73f2('0x10')](_0x73f2('0xa'),auth[_0x73f2('0x8')](),controller[_0x73f2('0x11')]);router[_0x73f2('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x73f2('0x13')]=router; \ No newline at end of file +var _0xcc93=['../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4fafac,_0x3a1c4d){var _0x3d2b43=function(_0x7fa4fe){while(--_0x7fa4fe){_0x4fafac['push'](_0x4fafac['shift']());}};_0x3d2b43(++_0x3a1c4d);}(_0xcc93,0x1c1));var _0x3cc9=function(_0x2da4c6,_0x3cbf23){_0x2da4c6=_0x2da4c6-0x0;var _0x4741c6=_0xcc93[_0x2da4c6];return _0x4741c6;};'use strict';var multer=require(_0x3cc9('0x0'));var util=require(_0x3cc9('0x1'));var path=require('path');var timeout=require(_0x3cc9('0x2'));var express=require(_0x3cc9('0x3'));var router=express[_0x3cc9('0x4')]();var fs_extra=require(_0x3cc9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3cc9('0x6'));var config=require(_0x3cc9('0x7'));var controller=require(_0x3cc9('0x8'));router[_0x3cc9('0x9')]('/',auth[_0x3cc9('0xa')](),controller['index']);router[_0x3cc9('0x9')](_0x3cc9('0xb'),auth[_0x3cc9('0xa')](),controller[_0x3cc9('0xc')]);router[_0x3cc9('0x9')]('/:id/download',auth[_0x3cc9('0xa')](),controller['download']);router[_0x3cc9('0xd')]('/',auth[_0x3cc9('0xa')](),controller[_0x3cc9('0xe')]);router[_0x3cc9('0xf')](_0x3cc9('0xb'),auth[_0x3cc9('0xa')](),controller[_0x3cc9('0x10')]);router[_0x3cc9('0x11')](_0x3cc9('0xb'),auth['isAuthenticated'](),controller[_0x3cc9('0x12')]);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 1e97237..5c11f80 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 _0xdfd6=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xdfd6,0xb5));var _0x6dfd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xdfd6[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x6dfd('0x0'));module[_0x6dfd('0x1')]={'field':{'type':Sequelize[_0x6dfd('0x2')]},'alias':{'type':Sequelize[_0x6dfd('0x3')]},'function':{'type':Sequelize[_0x6dfd('0x3')]},'format':{'type':Sequelize[_0x6dfd('0x3')]},'groupBy':{'type':Sequelize[_0x6dfd('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6dfd('0x3')]},'custom':{'type':Sequelize[_0x6dfd('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x49a7=['BOOLEAN','exports','STRING'];(function(_0x3a3d63,_0x225317){var _0x10da5a=function(_0x12c907){while(--_0x12c907){_0x3a3d63['push'](_0x3a3d63['shift']());}};_0x10da5a(++_0x225317);}(_0x49a7,0x70));var _0x749a=function(_0x247ee7,_0x5ba033){_0x247ee7=_0x247ee7-0x0;var _0x1b6421=_0x49a7[_0x247ee7];return _0x1b6421;};'use strict';var Sequelize=require('sequelize');module[_0x749a('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x749a('0x1')]},'format':{'type':Sequelize[_0x749a('0x1')]},'groupBy':{'type':Sequelize[_0x749a('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x749a('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 964edd8..3f77877 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 _0x07c2=['lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','findAll','catch','show','params','length','includeAll','include','find','create','body','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5da52e,_0x12e17c){var _0x3265cd=function(_0x3a2500){while(--_0x3a2500){_0x5da52e['push'](_0x5da52e['shift']());}};_0x3265cd(++_0x12e17c);}(_0x07c2,0xf1));var _0x207c=function(_0x268b06,_0x446ed1){_0x268b06=_0x268b06-0x0;var _0x31d48b=_0x07c2[_0x268b06];return _0x31d48b;};'use strict';var emlformat=require(_0x207c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x207c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x207c('0x2'));var moment=require(_0x207c('0x3'));var BPromise=require(_0x207c('0x4'));var Mustache=require(_0x207c('0x5'));var util=require(_0x207c('0x6'));var path=require(_0x207c('0x7'));var sox=require('sox');var csv=require(_0x207c('0x8'));var ejs=require(_0x207c('0x9'));var fs=require('fs');var fs_extra=require(_0x207c('0xa'));var _=require(_0x207c('0xb'));var squel=require('squel');var crypto=require(_0x207c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x207c('0x8'));var querystring=require(_0x207c('0xd'));var Papa=require(_0x207c('0xe'));var Redis=require(_0x207c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x207c('0x10'));var as=require(_0x207c('0x11'));var hardwareService=require(_0x207c('0x12'));var logger=require(_0x207c('0x13'))(_0x207c('0x14'));var utils=require(_0x207c('0x15'));var config=require(_0x207c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x207c('0x17'))['db'];function respondWithStatusCode(_0x542ba8,_0x9f5604){_0x9f5604=_0x9f5604||0xcc;return function(_0x5cb038){if(_0x5cb038){return _0x542ba8['sendStatus'](_0x9f5604);}return _0x542ba8[_0x207c('0x18')](_0x9f5604)[_0x207c('0x19')]();};}function respondWithResult(_0x5ac7bc,_0x209f2c){_0x209f2c=_0x209f2c||0xc8;return function(_0x2d296c){if(_0x2d296c){return _0x5ac7bc[_0x207c('0x18')](_0x209f2c)[_0x207c('0x1a')](_0x2d296c);}};}function respondWithFilteredResult(_0x417000,_0x4d4f2b){return function(_0x8da5f8){if(_0x8da5f8){var _0x4ade90=typeof _0x4d4f2b[_0x207c('0x1b')]===_0x207c('0x1c')&&typeof _0x4d4f2b['limit']==='undefined';var _0x1ddcb3=_0x8da5f8[_0x207c('0x1d')];var _0x4d245e=_0x4ade90?0x0:_0x4d4f2b[_0x207c('0x1b')];var _0x2f03bc=_0x4ade90?_0x8da5f8[_0x207c('0x1d')]:_0x4d4f2b[_0x207c('0x1b')]+_0x4d4f2b[_0x207c('0x1e')];var _0x327bd0;if(_0x2f03bc>=_0x1ddcb3){_0x2f03bc=_0x1ddcb3;_0x327bd0=0xc8;}else{_0x327bd0=0xce;}_0x417000[_0x207c('0x18')](_0x327bd0);return _0x417000['set'](_0x207c('0x1f'),_0x4d245e+'-'+_0x2f03bc+'/'+_0x1ddcb3)[_0x207c('0x1a')](_0x8da5f8);}return null;};}function patchUpdates(_0x19ce80){return function(_0xe80172){try{jsonpatch[_0x207c('0x20')](_0xe80172,_0x19ce80,!![]);}catch(_0xc94ef3){return BPromise[_0x207c('0x21')](_0xc94ef3);}return _0xe80172[_0x207c('0x22')]();};}function saveUpdates(_0x30c1de,_0x1fd868){return function(_0x1e5eff){if(_0x1e5eff){return _0x1e5eff[_0x207c('0x23')](_0x30c1de)['then'](function(_0x5f3401){return _0x5f3401;});}return null;};}function removeEntity(_0x421e87,_0x4fe300){return function(_0x447821){if(_0x447821){return _0x447821[_0x207c('0x24')]()[_0x207c('0x25')](function(){_0x421e87[_0x207c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277b73,_0x1a1a6a){return function(_0x18a3d5){if(!_0x18a3d5){_0x277b73[_0x207c('0x26')](0x194);}return _0x18a3d5;};}function handleError(_0x2ceb79,_0x273794){_0x273794=_0x273794||0x1f4;return function(_0x5708d0){logger[_0x207c('0x27')](_0x5708d0[_0x207c('0x28')]);if(_0x5708d0['name']){delete _0x5708d0['name'];}_0x2ceb79[_0x207c('0x18')](_0x273794)[_0x207c('0x29')](_0x5708d0);};}exports[_0x207c('0x2a')]=function(_0x53d82b,_0x11217c){var _0x5dee74={},_0x466de8={},_0xeafa01={'count':0x0,'rows':[]};var _0x3aa0fe=_['map'](db[_0x207c('0x2b')][_0x207c('0x2c')],function(_0x2d43ce){return{'name':_0x2d43ce[_0x207c('0x2d')],'type':_0x2d43ce['type'][_0x207c('0x2e')]};});_0x466de8[_0x207c('0x2f')]=_[_0x207c('0x30')](_0x3aa0fe,_0x207c('0x31'));_0x466de8[_0x207c('0x32')]=_[_0x207c('0x33')](_0x53d82b['query']);_0x466de8[_0x207c('0x34')]=_[_0x207c('0x35')](_0x466de8[_0x207c('0x2f')],_0x466de8[_0x207c('0x32')]);_0x5dee74[_0x207c('0x36')]=_[_0x207c('0x35')](_0x466de8[_0x207c('0x2f')],qs[_0x207c('0x37')](_0x53d82b[_0x207c('0x32')][_0x207c('0x37')]));_0x5dee74[_0x207c('0x36')]=_0x5dee74[_0x207c('0x36')]['length']?_0x5dee74[_0x207c('0x36')]:_0x466de8[_0x207c('0x2f')];if(!_0x53d82b[_0x207c('0x32')][_0x207c('0x38')](_0x207c('0x39'))){_0x5dee74[_0x207c('0x1e')]=qs['limit'](_0x53d82b[_0x207c('0x32')][_0x207c('0x1e')]);_0x5dee74[_0x207c('0x1b')]=qs[_0x207c('0x1b')](_0x53d82b[_0x207c('0x32')][_0x207c('0x1b')]);}_0x5dee74[_0x207c('0x3a')]=qs[_0x207c('0x3b')](_0x53d82b['query'][_0x207c('0x3b')]);_0x5dee74[_0x207c('0x3c')]=qs[_0x207c('0x34')](_[_0x207c('0x3d')](_0x53d82b['query'],_0x466de8[_0x207c('0x34')]),_0x3aa0fe);if(_0x53d82b['query']['filter']){_0x5dee74[_0x207c('0x3c')]=_['merge'](_0x5dee74['where'],{'$or':_[_0x207c('0x30')](_0x3aa0fe,function(_0x35b55c){if(_0x35b55c[_0x207c('0x3e')]!==_0x207c('0x3f')){var _0x1fc615={};_0x1fc615[_0x35b55c['name']]={'$like':'%'+_0x53d82b[_0x207c('0x32')][_0x207c('0x40')]+'%'};return _0x1fc615;}})});}_0x5dee74=_[_0x207c('0x41')]({},_0x5dee74,_0x53d82b[_0x207c('0x42')]);var _0x4391b4={'where':_0x5dee74[_0x207c('0x3c')]};return db[_0x207c('0x2b')][_0x207c('0x1d')](_0x4391b4)[_0x207c('0x25')](function(_0x3a9001){_0xeafa01['count']=_0x3a9001;if(_0x53d82b['query']['includeAll']){_0x5dee74['include']=[{'all':!![]}];}return db[_0x207c('0x2b')][_0x207c('0x43')](_0x5dee74);})[_0x207c('0x25')](function(_0x3dc7fe){_0xeafa01['rows']=_0x3dc7fe;return _0xeafa01;})[_0x207c('0x25')](respondWithFilteredResult(_0x11217c,_0x5dee74))[_0x207c('0x44')](handleError(_0x11217c,null));};exports[_0x207c('0x45')]=function(_0x5dea31,_0xf18826){var _0x3058b8={'raw':![],'where':{'id':_0x5dea31[_0x207c('0x46')]['id']}},_0x4821a8={};_0x4821a8[_0x207c('0x2f')]=_['keys'](db[_0x207c('0x2b')][_0x207c('0x2c')]);_0x4821a8[_0x207c('0x32')]=_['keys'](_0x5dea31[_0x207c('0x32')]);_0x4821a8['filters']=_[_0x207c('0x35')](_0x4821a8['model'],_0x4821a8[_0x207c('0x32')]);_0x3058b8[_0x207c('0x36')]=_[_0x207c('0x35')](_0x4821a8['model'],qs[_0x207c('0x37')](_0x5dea31[_0x207c('0x32')][_0x207c('0x37')]));_0x3058b8['attributes']=_0x3058b8['attributes'][_0x207c('0x47')]?_0x3058b8['attributes']:_0x4821a8[_0x207c('0x2f')];if(_0x5dea31[_0x207c('0x32')][_0x207c('0x48')]){_0x3058b8[_0x207c('0x49')]=[{'all':!![]}];}_0x3058b8=_[_0x207c('0x41')]({},_0x3058b8,_0x5dea31['options']);return db[_0x207c('0x2b')][_0x207c('0x4a')](_0x3058b8)['then'](handleEntityNotFound(_0xf18826,null))[_0x207c('0x25')](respondWithResult(_0xf18826,null))['catch'](handleError(_0xf18826,null));};exports['create']=function(_0x377a6e,_0x297415){return db[_0x207c('0x2b')][_0x207c('0x4b')](_0x377a6e[_0x207c('0x4c')],{})['then'](respondWithResult(_0x297415,0xc9))[_0x207c('0x44')](handleError(_0x297415,null));};exports['bulkCreate']=function(_0x2f847e,_0x4930cb){return db[_0x207c('0x2b')][_0x207c('0x4d')](_0x2f847e[_0x207c('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4930cb,0xc9))['catch'](handleError(_0x4930cb,null));};exports[_0x207c('0x23')]=function(_0x1a6154,_0x31e3e5){if(_0x1a6154[_0x207c('0x4c')]['id']){delete _0x1a6154[_0x207c('0x4c')]['id'];}return db[_0x207c('0x2b')][_0x207c('0x4a')]({'where':{'id':_0x1a6154[_0x207c('0x46')]['id']}})[_0x207c('0x25')](handleEntityNotFound(_0x31e3e5,null))[_0x207c('0x25')](saveUpdates(_0x1a6154[_0x207c('0x4c')],null))[_0x207c('0x25')](respondWithResult(_0x31e3e5,null))[_0x207c('0x44')](handleError(_0x31e3e5,null));};exports[_0x207c('0x24')]=function(_0x462b43,_0x10e335){return db[_0x207c('0x2b')]['find']({'where':{'id':_0x462b43[_0x207c('0x46')]['id']}})['then'](handleEntityNotFound(_0x10e335,null))[_0x207c('0x25')](removeEntity(_0x10e335,null))[_0x207c('0x44')](handleError(_0x10e335,null));};exports[_0x207c('0x4e')]=function(_0x1d332b,_0x2274e2){return db[_0x207c('0x2b')][_0x207c('0x24')]({'where':{'id':_0x1d332b[_0x207c('0x32')][_0x207c('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x207c('0x25')](respondWithResult(_0x2274e2,0xcc))[_0x207c('0x44')](handleError(_0x2274e2,null));};exports['addFields']=function(_0x5897d5,_0x1cd405,_0x5cc019){return db[_0x207c('0x50')][_0x207c('0x51')]({'where':{'id':_0x5897d5[_0x207c('0x46')]['id']}})[_0x207c('0x25')](handleEntityNotFound(_0x1cd405,null))[_0x207c('0x25')](function(_0x2e8ab6){if(_0x2e8ab6){return db[_0x207c('0x52')][_0x207c('0x53')](function(_0x22861f){return db[_0x207c('0x2b')][_0x207c('0x24')]({'where':{'CustomReportId':_0x5897d5[_0x207c('0x46')]['id']},'transaction':_0x22861f})[_0x207c('0x25')](function(_0x4c8b66){var _0x142e6f=_[_0x207c('0x30')](_0x5897d5[_0x207c('0x4c')],function(_0xe302cd){delete _0xe302cd['id'];_0xe302cd['CustomReportId']=_0x5897d5[_0x207c('0x46')]['id'];return _0xe302cd;});return db[_0x207c('0x2b')][_0x207c('0x4d')](_0x142e6f,{'transaction':_0x22861f});});})[_0x207c('0x25')](function(){return db[_0x207c('0x2b')]['findAll']({'where':{'CustomReportId':_0x5897d5[_0x207c('0x46')]['id']}});});}})[_0x207c('0x25')](respondWithResult(_0x1cd405,null))[_0x207c('0x44')](handleError(_0x1cd405,null));}; \ No newline at end of file +var _0x25a1=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','length','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x39ac40,_0x1b0147){var _0xca35ad=function(_0x2b16aa){while(--_0x2b16aa){_0x39ac40['push'](_0x39ac40['shift']());}};_0xca35ad(++_0x1b0147);}(_0x25a1,0x1d0));var _0x125a=function(_0x1869e5,_0x1d98fd){_0x1869e5=_0x1869e5-0x0;var _0xd18c76=_0x25a1[_0x1869e5];return _0xd18c76;};'use strict';var emlformat=require(_0x125a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x125a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x125a('0x2'));var Mustache=require('mustache');var util=require(_0x125a('0x3'));var path=require(_0x125a('0x4'));var sox=require('sox');var csv=require(_0x125a('0x5'));var ejs=require(_0x125a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x125a('0x7'));var squel=require(_0x125a('0x8'));var crypto=require(_0x125a('0x9'));var jsforce=require(_0x125a('0xa'));var deskjs=require(_0x125a('0xb'));var toCsv=require(_0x125a('0x5'));var querystring=require(_0x125a('0xc'));var Papa=require('papaparse');var Redis=require(_0x125a('0xd'));var authService=require(_0x125a('0xe'));var qs=require(_0x125a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x125a('0x10'));var logger=require(_0x125a('0x11'))(_0x125a('0x12'));var utils=require(_0x125a('0x13'));var config=require(_0x125a('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xacea5c,_0x52580d){_0x52580d=_0x52580d||0xcc;return function(_0x136e4c){if(_0x136e4c){return _0xacea5c[_0x125a('0x15')](_0x52580d);}return _0xacea5c[_0x125a('0x16')](_0x52580d)[_0x125a('0x17')]();};}function respondWithResult(_0x71ffa5,_0x16be02){_0x16be02=_0x16be02||0xc8;return function(_0x7675ca){if(_0x7675ca){return _0x71ffa5['status'](_0x16be02)[_0x125a('0x18')](_0x7675ca);}};}function respondWithFilteredResult(_0x368b75,_0x4dc03e){return function(_0x1519bc){if(_0x1519bc){var _0x410e4d=typeof _0x4dc03e[_0x125a('0x19')]===_0x125a('0x1a')&&typeof _0x4dc03e[_0x125a('0x1b')]===_0x125a('0x1a');var _0x369de2=_0x1519bc[_0x125a('0x1c')];var _0x47afaa=_0x410e4d?0x0:_0x4dc03e[_0x125a('0x19')];var _0x2e430e=_0x410e4d?_0x1519bc[_0x125a('0x1c')]:_0x4dc03e[_0x125a('0x19')]+_0x4dc03e[_0x125a('0x1b')];var _0x178e49;if(_0x2e430e>=_0x369de2){_0x2e430e=_0x369de2;_0x178e49=0xc8;}else{_0x178e49=0xce;}_0x368b75[_0x125a('0x16')](_0x178e49);return _0x368b75[_0x125a('0x1d')](_0x125a('0x1e'),_0x47afaa+'-'+_0x2e430e+'/'+_0x369de2)[_0x125a('0x18')](_0x1519bc);}return null;};}function patchUpdates(_0x468c35){return function(_0x5ebc2c){try{jsonpatch[_0x125a('0x1f')](_0x5ebc2c,_0x468c35,!![]);}catch(_0x3c068b){return BPromise[_0x125a('0x20')](_0x3c068b);}return _0x5ebc2c[_0x125a('0x21')]();};}function saveUpdates(_0x1a32e9,_0x3506f6){return function(_0xa29331){if(_0xa29331){return _0xa29331[_0x125a('0x22')](_0x1a32e9)[_0x125a('0x23')](function(_0x484431){return _0x484431;});}return null;};}function removeEntity(_0x3a9e87,_0x3d12fc){return function(_0x57bc75){if(_0x57bc75){return _0x57bc75[_0x125a('0x24')]()[_0x125a('0x23')](function(){_0x3a9e87[_0x125a('0x16')](0xcc)[_0x125a('0x17')]();});}};}function handleEntityNotFound(_0x4379f1,_0x4c1802){return function(_0x5eeabf){if(!_0x5eeabf){_0x4379f1['sendStatus'](0x194);}return _0x5eeabf;};}function handleError(_0x4277ce,_0x271967){_0x271967=_0x271967||0x1f4;return function(_0x160ab8){logger[_0x125a('0x25')](_0x160ab8['stack']);if(_0x160ab8[_0x125a('0x26')]){delete _0x160ab8[_0x125a('0x26')];}_0x4277ce[_0x125a('0x16')](_0x271967)[_0x125a('0x27')](_0x160ab8);};}exports[_0x125a('0x28')]=function(_0x30e91a,_0x4ba31f){var _0x3c0b29={},_0x11411d={},_0x5e86cc={'count':0x0,'rows':[]};var _0x14bcaa=_[_0x125a('0x29')](db[_0x125a('0x2a')]['rawAttributes'],function(_0x1fb852){return{'name':_0x1fb852['fieldName'],'type':_0x1fb852[_0x125a('0x2b')][_0x125a('0x2c')]};});_0x11411d[_0x125a('0x2d')]=_[_0x125a('0x29')](_0x14bcaa,'name');_0x11411d[_0x125a('0x2e')]=_['keys'](_0x30e91a['query']);_0x11411d[_0x125a('0x2f')]=_[_0x125a('0x30')](_0x11411d['model'],_0x11411d[_0x125a('0x2e')]);_0x3c0b29[_0x125a('0x31')]=_[_0x125a('0x30')](_0x11411d['model'],qs['fields'](_0x30e91a['query'][_0x125a('0x32')]));_0x3c0b29[_0x125a('0x31')]=_0x3c0b29[_0x125a('0x31')]['length']?_0x3c0b29[_0x125a('0x31')]:_0x11411d['model'];if(!_0x30e91a['query'][_0x125a('0x33')]('nolimit')){_0x3c0b29[_0x125a('0x1b')]=qs[_0x125a('0x1b')](_0x30e91a[_0x125a('0x2e')][_0x125a('0x1b')]);_0x3c0b29[_0x125a('0x19')]=qs[_0x125a('0x19')](_0x30e91a[_0x125a('0x2e')]['offset']);}_0x3c0b29[_0x125a('0x34')]=qs[_0x125a('0x35')](_0x30e91a[_0x125a('0x2e')][_0x125a('0x35')]);_0x3c0b29[_0x125a('0x36')]=qs[_0x125a('0x2f')](_[_0x125a('0x37')](_0x30e91a[_0x125a('0x2e')],_0x11411d['filters']),_0x14bcaa);if(_0x30e91a['query'][_0x125a('0x38')]){_0x3c0b29[_0x125a('0x36')]=_['merge'](_0x3c0b29[_0x125a('0x36')],{'$or':_[_0x125a('0x29')](_0x14bcaa,function(_0x260c8d){if(_0x260c8d['type']!=='VIRTUAL'){var _0x3a101c={};_0x3a101c[_0x260c8d[_0x125a('0x26')]]={'$like':'%'+_0x30e91a['query'][_0x125a('0x38')]+'%'};return _0x3a101c;}})});}_0x3c0b29=_[_0x125a('0x39')]({},_0x3c0b29,_0x30e91a[_0x125a('0x3a')]);var _0x43ad32={'where':_0x3c0b29['where']};return db[_0x125a('0x2a')][_0x125a('0x1c')](_0x43ad32)[_0x125a('0x23')](function(_0x3e9683){_0x5e86cc['count']=_0x3e9683;if(_0x30e91a['query'][_0x125a('0x3b')]){_0x3c0b29['include']=[{'all':!![]}];}return db[_0x125a('0x2a')][_0x125a('0x3c')](_0x3c0b29);})[_0x125a('0x23')](function(_0x290783){_0x5e86cc[_0x125a('0x3d')]=_0x290783;return _0x5e86cc;})[_0x125a('0x23')](respondWithFilteredResult(_0x4ba31f,_0x3c0b29))[_0x125a('0x3e')](handleError(_0x4ba31f,null));};exports['show']=function(_0x560dca,_0x852826){var _0x25e287={'raw':![],'where':{'id':_0x560dca[_0x125a('0x3f')]['id']}},_0x4d7c9d={};_0x4d7c9d['model']=_[_0x125a('0x40')](db['AnalyticFieldReport']['rawAttributes']);_0x4d7c9d[_0x125a('0x2e')]=_[_0x125a('0x40')](_0x560dca[_0x125a('0x2e')]);_0x4d7c9d[_0x125a('0x2f')]=_[_0x125a('0x30')](_0x4d7c9d[_0x125a('0x2d')],_0x4d7c9d[_0x125a('0x2e')]);_0x25e287[_0x125a('0x31')]=_['intersection'](_0x4d7c9d[_0x125a('0x2d')],qs['fields'](_0x560dca[_0x125a('0x2e')][_0x125a('0x32')]));_0x25e287[_0x125a('0x31')]=_0x25e287['attributes'][_0x125a('0x41')]?_0x25e287['attributes']:_0x4d7c9d[_0x125a('0x2d')];if(_0x560dca[_0x125a('0x2e')][_0x125a('0x3b')]){_0x25e287[_0x125a('0x42')]=[{'all':!![]}];}_0x25e287=_[_0x125a('0x39')]({},_0x25e287,_0x560dca[_0x125a('0x3a')]);return db[_0x125a('0x2a')][_0x125a('0x43')](_0x25e287)[_0x125a('0x23')](handleEntityNotFound(_0x852826,null))[_0x125a('0x23')](respondWithResult(_0x852826,null))[_0x125a('0x3e')](handleError(_0x852826,null));};exports[_0x125a('0x44')]=function(_0xd5562b,_0x1804b7){return db['AnalyticFieldReport'][_0x125a('0x44')](_0xd5562b[_0x125a('0x45')],{})[_0x125a('0x23')](respondWithResult(_0x1804b7,0xc9))[_0x125a('0x3e')](handleError(_0x1804b7,null));};exports['bulkCreate']=function(_0x22deb9,_0xe3b9a9){return db['AnalyticFieldReport'][_0x125a('0x46')](_0x22deb9[_0x125a('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xe3b9a9,0xc9))['catch'](handleError(_0xe3b9a9,null));};exports[_0x125a('0x22')]=function(_0x16202d,_0x446383){if(_0x16202d['body']['id']){delete _0x16202d[_0x125a('0x45')]['id'];}return db[_0x125a('0x2a')][_0x125a('0x43')]({'where':{'id':_0x16202d[_0x125a('0x3f')]['id']}})[_0x125a('0x23')](handleEntityNotFound(_0x446383,null))[_0x125a('0x23')](saveUpdates(_0x16202d[_0x125a('0x45')],null))[_0x125a('0x23')](respondWithResult(_0x446383,null))['catch'](handleError(_0x446383,null));};exports[_0x125a('0x24')]=function(_0x58d3b7,_0x519c6d){return db['AnalyticFieldReport'][_0x125a('0x43')]({'where':{'id':_0x58d3b7[_0x125a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x519c6d,null))[_0x125a('0x23')](removeEntity(_0x519c6d,null))[_0x125a('0x3e')](handleError(_0x519c6d,null));};exports[_0x125a('0x47')]=function(_0xbaecb3,_0x570356){return db[_0x125a('0x2a')][_0x125a('0x24')]({'where':{'id':_0xbaecb3['query'][_0x125a('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x125a('0x23')](respondWithResult(_0x570356,0xcc))[_0x125a('0x3e')](handleError(_0x570356,null));};exports[_0x125a('0x49')]=function(_0x3f1f88,_0x47b627,_0x3747ab){return db[_0x125a('0x4a')][_0x125a('0x4b')]({'where':{'id':_0x3f1f88[_0x125a('0x3f')]['id']}})[_0x125a('0x23')](handleEntityNotFound(_0x47b627,null))[_0x125a('0x23')](function(_0x12e0aa){if(_0x12e0aa){return db[_0x125a('0x4c')][_0x125a('0x4d')](function(_0x377df4){return db['AnalyticFieldReport'][_0x125a('0x24')]({'where':{'CustomReportId':_0x3f1f88[_0x125a('0x3f')]['id']},'transaction':_0x377df4})['then'](function(_0x114212){var _0x545c5d=_['map'](_0x3f1f88[_0x125a('0x45')],function(_0x1cb4e1){delete _0x1cb4e1['id'];_0x1cb4e1[_0x125a('0x4e')]=_0x3f1f88['params']['id'];return _0x1cb4e1;});return db[_0x125a('0x2a')][_0x125a('0x46')](_0x545c5d,{'transaction':_0x377df4});});})[_0x125a('0x23')](function(){return db[_0x125a('0x2a')][_0x125a('0x3c')]({'where':{'CustomReportId':_0x3f1f88['params']['id']}});});}})[_0x125a('0x23')](respondWithResult(_0x47b627,null))[_0x125a('0x3e')](handleError(_0x47b627,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b3ec731..4550573 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 _0x4821=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','util','bluebird','request-promise'];(function(_0x197835,_0x467333){var _0x228110=function(_0x105be9){while(--_0x105be9){_0x197835['push'](_0x197835['shift']());}};_0x228110(++_0x467333);}(_0x4821,0x115));var _0x1482=function(_0x112e99,_0x345a74){_0x112e99=_0x112e99-0x0;var _0x5ed545=_0x4821[_0x112e99];return _0x5ed545;};'use strict';var _=require('lodash');var util=require(_0x1482('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1482('0x1'));var rp=require(_0x1482('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1482('0x3'));var config=require(_0x1482('0x4'));var attributes=require(_0x1482('0x5'));module[_0x1482('0x6')]=function(_0x1a7409,_0x20d40b){return _0x1a7409[_0x1482('0x7')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeb2=['analytics_report_fields','lodash','util','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xbeb2,0x175));var _0x2beb=function(_0x473c90,_0x14d680){_0x473c90=_0x473c90-0x0;var _0x5eef4a=_0xbeb2[_0x473c90];return _0x5eef4a;};'use strict';var _=require(_0x2beb('0x0'));var util=require(_0x2beb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2beb('0x2'));var BPromise=require(_0x2beb('0x3'));var rp=require(_0x2beb('0x4'));var fs=require('fs');var path=require(_0x2beb('0x5'));var rimraf=require(_0x2beb('0x6'));var config=require('../../config/environment');var attributes=require(_0x2beb('0x7'));module[_0x2beb('0x8')]=function(_0x2dc2f4,_0x28fd50){return _0x2dc2f4[_0x2beb('0x9')](_0x2beb('0xa'),attributes,{'tableName':_0x2beb('0xb'),'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 a678900..40626ba 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 _0x830c=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util'];(function(_0x3951b5,_0xe8505e){var _0x29cca5=function(_0x54662b){while(--_0x54662b){_0x3951b5['push'](_0x3951b5['shift']());}};_0x29cca5(++_0xe8505e);}(_0x830c,0x178));var _0xc830=function(_0x2c6a60,_0x5f4462){_0x2c6a60=_0x2c6a60-0x0;var _0x4ee6b1=_0x830c[_0x2c6a60];return _0x4ee6b1;};'use strict';var _=require(_0xc830('0x0'));var util=require(_0xc830('0x1'));var moment=require(_0xc830('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc830('0x3'));var db=require(_0xc830('0x4'))['db'];var utils=require(_0xc830('0x5'));var logger=require(_0xc830('0x6'))(_0xc830('0x7'));var config=require(_0xc830('0x8'));var jayson=require(_0xc830('0x9'));var client=jayson[_0xc830('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x155b30,_0x52c205,_0x37b0c5){return new BPromise(function(_0x459219,_0x17e8b4){return client[_0xc830('0xb')](_0x155b30,_0x37b0c5)[_0xc830('0xc')](function(_0x3d556c){logger[_0xc830('0xd')](_0xc830('0xe'),_0x52c205,'request\x20sent');logger['debug'](_0xc830('0xf'),_0x52c205,'request\x20sent',JSON[_0xc830('0x10')](_0x3d556c));if(_0x3d556c[_0xc830('0x11')]){if(_0x3d556c[_0xc830('0x11')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x52c205,_0x3d556c[_0xc830('0x11')]['message']);return _0x17e8b4(_0x3d556c[_0xc830('0x11')][_0xc830('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x52c205,_0x3d556c[_0xc830('0x11')][_0xc830('0x12')]);return _0x459219(_0x3d556c['error'][_0xc830('0x12')]);}else{logger[_0xc830('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x52c205,_0xc830('0x13'));_0x459219(_0x3d556c[_0xc830('0x14')]['message']);}})['catch'](function(_0xead54b){logger[_0xc830('0x11')](_0xc830('0xe'),_0x52c205,_0xead54b);_0x17e8b4(_0xead54b);});});} \ No newline at end of file +var _0x5c18=['client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xae4ef3,_0x33fb30){var _0x3b4945=function(_0x15b32f){while(--_0x15b32f){_0xae4ef3['push'](_0xae4ef3['shift']());}};_0x3b4945(++_0x33fb30);}(_0x5c18,0x148));var _0x85c1=function(_0x2a2477,_0x43d8fa){_0x2a2477=_0x2a2477-0x0;var _0x23009c=_0x5c18[_0x2a2477];return _0x23009c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85c1('0x0'));var BPromise=require('bluebird');var rs=require(_0x85c1('0x1'));var fs=require('fs');var Redis=require(_0x85c1('0x2'));var db=require(_0x85c1('0x3'))['db'];var utils=require(_0x85c1('0x4'));var logger=require(_0x85c1('0x5'))(_0x85c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x85c1('0x7'));var client=jayson[_0x85c1('0x8')][_0x85c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed02d,_0x2070fc,_0x1e1a1b){return new BPromise(function(_0x46de72,_0xe3ac0e){return client[_0x85c1('0xa')](_0xed02d,_0x1e1a1b)[_0x85c1('0xb')](function(_0x4add1d){logger['info'](_0x85c1('0xc'),_0x2070fc,_0x85c1('0xd'));logger[_0x85c1('0xe')](_0x85c1('0xf'),_0x2070fc,_0x85c1('0xd'),JSON[_0x85c1('0x10')](_0x4add1d));if(_0x4add1d[_0x85c1('0x11')]){if(_0x4add1d[_0x85c1('0x11')]['code']===0x1f4){logger[_0x85c1('0x11')](_0x85c1('0xc'),_0x2070fc,_0x4add1d['error'][_0x85c1('0x12')]);return _0xe3ac0e(_0x4add1d[_0x85c1('0x11')][_0x85c1('0x12')]);}logger[_0x85c1('0x11')](_0x85c1('0xc'),_0x2070fc,_0x4add1d['error']['message']);return _0x46de72(_0x4add1d[_0x85c1('0x11')][_0x85c1('0x12')]);}else{logger[_0x85c1('0x13')](_0x85c1('0xc'),_0x2070fc,'request\x20sent');_0x46de72(_0x4add1d['result'][_0x85c1('0x12')]);}})[_0x85c1('0x14')](function(_0x26177e){logger['error'](_0x85c1('0xc'),_0x2070fc,_0x26177e);_0xe3ac0e(_0x26177e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 97e7c41..047e535 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(_0x4288f5,_0xe71961){var _0xc04f3=function(_0x488f7b){while(--_0x488f7b){_0x4288f5['push'](_0x4288f5['shift']());}};_0xc04f3(++_0xe71961);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x344f35,_0xb9b8ce){var _0x241f0e=function(_0xcc379c){while(--_0xcc379c){_0x344f35['push'](_0x344f35['shift']());}};_0x241f0e(++_0xb9b8ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 2e12422..c91bd65 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 _0x74b1=['STRING','sequelize','exports','name'];(function(_0x1749a1,_0x490f8d){var _0x34b7a3=function(_0x58aa80){while(--_0x58aa80){_0x1749a1['push'](_0x1749a1['shift']());}};_0x34b7a3(++_0x490f8d);}(_0x74b1,0xb5));var _0x174b=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x74b1[_0x571a17];return _0x3ef337;};'use strict';var Sequelize=require(_0x174b('0x0'));module[_0x174b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x174b('0x2')},'table':{'type':Sequelize[_0x174b('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x174b('0x3')]}}; \ No newline at end of file +var _0xb67f=['TEXT','exports','STRING','name'];(function(_0x542f0c,_0x224bf1){var _0x2d88e1=function(_0x78dc51){while(--_0x78dc51){_0x542f0c['push'](_0x542f0c['shift']());}};_0x2d88e1(++_0x224bf1);}(_0xb67f,0x12d));var _0xfb67=function(_0x2c59f4,_0x59e7c0){_0x2c59f4=_0x2c59f4-0x0;var _0x1f2b41=_0xb67f[_0x2c59f4];return _0x1f2b41;};'use strict';var Sequelize=require('sequelize');module[_0xfb67('0x0')]={'name':{'type':Sequelize[_0xfb67('0x1')],'allowNull':![],'unique':_0xfb67('0x2')},'table':{'type':Sequelize[_0xfb67('0x1')]},'metric':{'type':Sequelize[_0xfb67('0x3')]},'description':{'type':Sequelize[_0xfb67('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4d72915..1fd776d 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 _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5c7f23,_0x207fc7){var _0x509249=function(_0x40fed5){while(--_0x40fed5){_0x5c7f23['push'](_0x5c7f23['shift']());}};_0x509249(++_0x207fc7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5ac188,_0x163bcf){_0x5ac188=_0x5ac188-0x0;var _0x32fa2f=_0x7fbe[_0x5ac188];return _0x32fa2f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x2d4eb7,_0x35a03d){var _0x571698=function(_0x4a01f3){while(--_0x4a01f3){_0x2d4eb7['push'](_0x2d4eb7['shift']());}};_0x571698(++_0x35a03d);}(_0xe14b,0x93));var _0xbe14=function(_0x4641d9,_0x3362db){_0x4641d9=_0x4641d9-0x0;var _0x58b071=_0xe14b[_0x4641d9];return _0x58b071;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0dafe66..5d3ce64 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 _0xf722=['exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0x127277,_0x4cacaf){var _0x23c8ee=function(_0x942e67){while(--_0x942e67){_0x127277['push'](_0x127277['shift']());}};_0x23c8ee(++_0x4cacaf);}(_0xf722,0x18f));var _0x2f72=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf722[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var logger=require(_0x2f72('0x2'))(_0x2f72('0x3'));var moment=require('moment');var BPromise=require(_0x2f72('0x4'));var rp=require(_0x2f72('0x5'));var fs=require('fs');var path=require(_0x2f72('0x6'));var rimraf=require(_0x2f72('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f72('0x8'));module[_0x2f72('0x9')]=function(_0x334168,_0x537e3d){return _0x334168['define'](_0x2f72('0xa'),attributes,{'tableName':_0x2f72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b5a=['exports','define','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x20ab51,_0x246894){_0x20ab51=_0x20ab51-0x0;var _0x51a966=_0x5b5a[_0x20ab51];return _0x51a966;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var logger=require(_0xa5b5('0x1'))('api');var moment=require(_0xa5b5('0x2'));var BPromise=require(_0xa5b5('0x3'));var rp=require(_0xa5b5('0x4'));var fs=require('fs');var path=require(_0xa5b5('0x5'));var rimraf=require(_0xa5b5('0x6'));var config=require(_0xa5b5('0x7'));var attributes=require(_0xa5b5('0x8'));module[_0xa5b5('0x9')]=function(_0x509b78,_0x33678e){return _0x509b78[_0xa5b5('0xa')]('AnalyticMetric',attributes,{'tableName':_0xa5b5('0xb'),'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 7ffa17d..43e438b 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 _0x0c61=['jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x6a474,_0x3b8732){var _0x4c65a6=function(_0x4a5867){while(--_0x4a5867){_0x6a474['push'](_0x6a474['shift']());}};_0x4c65a6(++_0x3b8732);}(_0x0c61,0xdd));var _0x10c6=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x0c61[_0xa79977];return _0x109f10;};'use strict';var _=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var moment=require(_0x10c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x10c6('0x3'));var fs=require('fs');var Redis=require(_0x10c6('0x4'));var db=require(_0x10c6('0x5'))['db'];var utils=require(_0x10c6('0x6'));var logger=require(_0x10c6('0x7'))(_0x10c6('0x8'));var config=require(_0x10c6('0x9'));var jayson=require(_0x10c6('0xa'));var client=jayson[_0x10c6('0xb')][_0x10c6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41388c,_0x234031,_0x549930){return new BPromise(function(_0x2125e1,_0x1ce6b6){return client['request'](_0x41388c,_0x549930)[_0x10c6('0xd')](function(_0x35955f){logger[_0x10c6('0xe')](_0x10c6('0xf'),_0x234031,'request\x20sent');logger[_0x10c6('0x10')](_0x10c6('0x11'),_0x234031,'request\x20sent',JSON[_0x10c6('0x12')](_0x35955f));if(_0x35955f[_0x10c6('0x13')]){if(_0x35955f['error']['code']===0x1f4){logger[_0x10c6('0x13')](_0x10c6('0xf'),_0x234031,_0x35955f[_0x10c6('0x13')]['message']);return _0x1ce6b6(_0x35955f[_0x10c6('0x13')]['message']);}logger['error'](_0x10c6('0xf'),_0x234031,_0x35955f[_0x10c6('0x13')][_0x10c6('0x14')]);return _0x2125e1(_0x35955f[_0x10c6('0x13')][_0x10c6('0x14')]);}else{logger['info'](_0x10c6('0xf'),_0x234031,'request\x20sent');_0x2125e1(_0x35955f['result'][_0x10c6('0x14')]);}})['catch'](function(_0x5dd0c0){logger[_0x10c6('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x234031,_0x5dd0c0);_0x1ce6b6(_0x5dd0c0);});});} \ No newline at end of file +var _0x2588=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch'];(function(_0x27f154,_0x2c11d4){var _0x2b3005=function(_0x4c9fda){while(--_0x4c9fda){_0x27f154['push'](_0x27f154['shift']());}};_0x2b3005(++_0x2c11d4);}(_0x2588,0xc8));var _0x8258=function(_0x33ce7f,_0x3cb0a2){_0x33ce7f=_0x33ce7f-0x0;var _0x46b86d=_0x2588[_0x33ce7f];return _0x46b86d;};'use strict';var _=require(_0x8258('0x0'));var util=require(_0x8258('0x1'));var moment=require(_0x8258('0x2'));var BPromise=require(_0x8258('0x3'));var rs=require(_0x8258('0x4'));var fs=require('fs');var Redis=require(_0x8258('0x5'));var db=require(_0x8258('0x6'))['db'];var utils=require(_0x8258('0x7'));var logger=require(_0x8258('0x8'))('rpc');var config=require(_0x8258('0x9'));var jayson=require(_0x8258('0xa'));var client=jayson[_0x8258('0xb')][_0x8258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x304132,_0x2afdcc,_0x40256e){return new BPromise(function(_0x2e9b1c,_0x5315c1){return client['request'](_0x304132,_0x40256e)[_0x8258('0xd')](function(_0x8ee628){logger[_0x8258('0xe')](_0x8258('0xf'),_0x2afdcc,_0x8258('0x10'));logger[_0x8258('0x11')](_0x8258('0x12'),_0x2afdcc,'request\x20sent',JSON[_0x8258('0x13')](_0x8ee628));if(_0x8ee628['error']){if(_0x8ee628['error'][_0x8258('0x14')]===0x1f4){logger['error'](_0x8258('0xf'),_0x2afdcc,_0x8ee628['error'][_0x8258('0x15')]);return _0x5315c1(_0x8ee628[_0x8258('0x16')][_0x8258('0x15')]);}logger['error'](_0x8258('0xf'),_0x2afdcc,_0x8ee628['error'][_0x8258('0x15')]);return _0x2e9b1c(_0x8ee628[_0x8258('0x16')]['message']);}else{logger[_0x8258('0xe')](_0x8258('0xf'),_0x2afdcc,'request\x20sent');_0x2e9b1c(_0x8ee628[_0x8258('0x17')][_0x8258('0x15')]);}})[_0x8258('0x18')](function(_0x19dd6c){logger[_0x8258('0x16')](_0x8258('0xf'),_0x2afdcc,_0x19dd6c);_0x5315c1(_0x19dd6c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 6d1abdc..7e16d7f 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 _0x18d6=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x30dfb2,_0x5dfad8){var _0x41dac6=function(_0x3333d0){while(--_0x3333d0){_0x30dfb2['push'](_0x30dfb2['shift']());}};_0x41dac6(++_0x5dfad8);}(_0x18d6,0x166));var _0x618d=function(_0x4e6fb2,_0x3cf23e){_0x4e6fb2=_0x4e6fb2-0x0;var _0x2f1636=_0x18d6[_0x4e6fb2];return _0x2f1636;};'use strict';var multer=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var path=require('path');var timeout=require(_0x618d('0x2'));var express=require(_0x618d('0x3'));var router=express[_0x618d('0x4')]();var fs_extra=require(_0x618d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x618d('0x6'));var config=require(_0x618d('0x7'));var controller=require('./analyticMetric.controller');router[_0x618d('0x8')]('/',auth['isAuthenticated'](),controller[_0x618d('0x9')]);router[_0x618d('0x8')]('/:id',auth[_0x618d('0xa')](),controller[_0x618d('0xb')]);router[_0x618d('0xc')]('/',auth[_0x618d('0xa')](),controller[_0x618d('0xd')]);router[_0x618d('0xe')](_0x618d('0xf'),auth['isAuthenticated'](),controller[_0x618d('0x10')]);router[_0x618d('0x11')]('/:id',auth[_0x618d('0xa')](),controller[_0x618d('0x12')]);module[_0x618d('0x13')]=router; \ No newline at end of file +var _0x3981=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x1c0946,_0x1397d0){var _0x486457=function(_0x21b7a3){while(--_0x21b7a3){_0x1c0946['push'](_0x1c0946['shift']());}};_0x486457(++_0x1397d0);}(_0x3981,0x144));var _0x1398=function(_0x590776,_0x843c7e){_0x590776=_0x590776-0x0;var _0x55ad22=_0x3981[_0x590776];return _0x55ad22;};'use strict';var multer=require(_0x1398('0x0'));var util=require('util');var path=require(_0x1398('0x1'));var timeout=require(_0x1398('0x2'));var express=require(_0x1398('0x3'));var router=express[_0x1398('0x4')]();var fs_extra=require(_0x1398('0x5'));var auth=require(_0x1398('0x6'));var interaction=require(_0x1398('0x7'));var config=require(_0x1398('0x8'));var controller=require(_0x1398('0x9'));router[_0x1398('0xa')]('/',auth[_0x1398('0xb')](),controller['index']);router[_0x1398('0xa')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller['show']);router[_0x1398('0xd')]('/',auth[_0x1398('0xb')](),controller[_0x1398('0xe')]);router[_0x1398('0xf')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller['update']);router[_0x1398('0x10')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller[_0x1398('0x11')]);module[_0x1398('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 4be8cc8..3daeb74 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 _0xb55a=['sequelize','exports'];(function(_0x1bd57f,_0x349a10){var _0x4ed358=function(_0x2d816e){while(--_0x2d816e){_0x1bd57f['push'](_0x1bd57f['shift']());}};_0x4ed358(++_0x349a10);}(_0xb55a,0x184));var _0xab55=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xb55a[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xab55('0x0'));module[_0xab55('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xd98c=['sequelize','exports','TEXT'];(function(_0x3dd0b9,_0x1d6c92){var _0x4c0351=function(_0x2cf6a8){while(--_0x2cf6a8){_0x3dd0b9['push'](_0x3dd0b9['shift']());}};_0x4c0351(++_0x1d6c92);}(_0xd98c,0x168));var _0xcd98=function(_0x20cf58,_0x2bd1a9){_0x20cf58=_0x20cf58-0x0;var _0x5d192b=_0xd98c[_0x20cf58];return _0x5d192b;};'use strict';var Sequelize=require(_0xcd98('0x0'));module[_0xcd98('0x1')]={'tree':{'type':Sequelize[_0xcd98('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f35443d..04447ff 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 _0x4793=['save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x4793,0x159));var _0x3479=function(_0x40e86c,_0x4d963c){_0x40e86c=_0x40e86c-0x0;var _0x26555f=_0x4793[_0x40e86c];return _0x26555f;};'use strict';var emlformat=require(_0x3479('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3479('0x1'));var rp=require(_0x3479('0x2'));var moment=require(_0x3479('0x3'));var BPromise=require(_0x3479('0x4'));var Mustache=require(_0x3479('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3479('0x6'));var csv=require(_0x3479('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3479('0x8'));var _=require(_0x3479('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3479('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3479('0x7'));var querystring=require(_0x3479('0xb'));var Papa=require(_0x3479('0xc'));var Redis=require(_0x3479('0xd'));var authService=require(_0x3479('0xe'));var qs=require(_0x3479('0xf'));var as=require(_0x3479('0x10'));var hardwareService=require(_0x3479('0x11'));var logger=require(_0x3479('0x12'))('api');var utils=require(_0x3479('0x13'));var config=require(_0x3479('0x14'));var licenseUtil=require(_0x3479('0x15'));var db=require(_0x3479('0x16'))['db'];function respondWithStatusCode(_0x4f337c,_0x444e9f){_0x444e9f=_0x444e9f||0xcc;return function(_0x410141){if(_0x410141){return _0x4f337c[_0x3479('0x17')](_0x444e9f);}return _0x4f337c['status'](_0x444e9f)[_0x3479('0x18')]();};}function respondWithResult(_0xa69dce,_0x43246f){_0x43246f=_0x43246f||0xc8;return function(_0x3b3da5){if(_0x3b3da5){return _0xa69dce[_0x3479('0x19')](_0x43246f)[_0x3479('0x1a')](_0x3b3da5);}};}function respondWithFilteredResult(_0x3d37fd,_0x16440c){return function(_0x582dd6){if(_0x582dd6){var _0x5cb924=typeof _0x16440c[_0x3479('0x1b')]===_0x3479('0x1c')&&typeof _0x16440c[_0x3479('0x1d')]===_0x3479('0x1c');var _0x3f9c5d=_0x582dd6[_0x3479('0x1e')];var _0x3afa36=_0x5cb924?0x0:_0x16440c[_0x3479('0x1b')];var _0x39b0f2=_0x5cb924?_0x582dd6[_0x3479('0x1e')]:_0x16440c[_0x3479('0x1b')]+_0x16440c[_0x3479('0x1d')];var _0x158eaa;if(_0x39b0f2>=_0x3f9c5d){_0x39b0f2=_0x3f9c5d;_0x158eaa=0xc8;}else{_0x158eaa=0xce;}_0x3d37fd[_0x3479('0x19')](_0x158eaa);return _0x3d37fd[_0x3479('0x1f')](_0x3479('0x20'),_0x3afa36+'-'+_0x39b0f2+'/'+_0x3f9c5d)[_0x3479('0x1a')](_0x582dd6);}return null;};}function patchUpdates(_0x53666d){return function(_0x4de5ca){try{jsonpatch[_0x3479('0x21')](_0x4de5ca,_0x53666d,!![]);}catch(_0x5da660){return BPromise[_0x3479('0x22')](_0x5da660);}return _0x4de5ca[_0x3479('0x23')]();};}function saveUpdates(_0x569d14,_0x12ca2a){return function(_0x35df76){if(_0x35df76){return _0x35df76['update'](_0x569d14)[_0x3479('0x24')](function(_0x4c82ce){return _0x4c82ce;});}return null;};}function removeEntity(_0x3f1287,_0x4d8832){return function(_0xc94ae1){if(_0xc94ae1){return _0xc94ae1[_0x3479('0x25')]()[_0x3479('0x24')](function(){_0x3f1287['status'](0xcc)[_0x3479('0x18')]();});}};}function handleEntityNotFound(_0x1a5b03,_0x54a4ca){return function(_0x3d65f3){if(!_0x3d65f3){_0x1a5b03[_0x3479('0x17')](0x194);}return _0x3d65f3;};}function handleError(_0x50a196,_0x2541c6){_0x2541c6=_0x2541c6||0x1f4;return function(_0x1fc5c3){logger[_0x3479('0x26')](_0x1fc5c3['stack']);if(_0x1fc5c3['name']){delete _0x1fc5c3[_0x3479('0x27')];}_0x50a196[_0x3479('0x19')](_0x2541c6)[_0x3479('0x28')](_0x1fc5c3);};}exports[_0x3479('0x29')]=function(_0x4574e1,_0x314656){var _0x1772af={},_0x411bc9={},_0x49ef36={'count':0x0,'rows':[]};var _0x3a683b=_[_0x3479('0x2a')](db['AnalyticTreeReport'][_0x3479('0x2b')],function(_0x4762c9){return{'name':_0x4762c9[_0x3479('0x2c')],'type':_0x4762c9[_0x3479('0x2d')][_0x3479('0x2e')]};});_0x411bc9['model']=_[_0x3479('0x2a')](_0x3a683b,_0x3479('0x27'));_0x411bc9[_0x3479('0x2f')]=_['keys'](_0x4574e1[_0x3479('0x2f')]);_0x411bc9[_0x3479('0x30')]=_[_0x3479('0x31')](_0x411bc9[_0x3479('0x32')],_0x411bc9['query']);_0x1772af[_0x3479('0x33')]=_[_0x3479('0x31')](_0x411bc9[_0x3479('0x32')],qs[_0x3479('0x34')](_0x4574e1['query'][_0x3479('0x34')]));_0x1772af[_0x3479('0x33')]=_0x1772af[_0x3479('0x33')][_0x3479('0x35')]?_0x1772af['attributes']:_0x411bc9[_0x3479('0x32')];if(!_0x4574e1[_0x3479('0x2f')][_0x3479('0x36')](_0x3479('0x37'))){_0x1772af[_0x3479('0x1d')]=qs[_0x3479('0x1d')](_0x4574e1[_0x3479('0x2f')]['limit']);_0x1772af['offset']=qs['offset'](_0x4574e1[_0x3479('0x2f')][_0x3479('0x1b')]);}_0x1772af[_0x3479('0x38')]=qs[_0x3479('0x39')](_0x4574e1[_0x3479('0x2f')][_0x3479('0x39')]);_0x1772af[_0x3479('0x3a')]=qs[_0x3479('0x30')](_[_0x3479('0x3b')](_0x4574e1[_0x3479('0x2f')],_0x411bc9['filters']),_0x3a683b);if(_0x4574e1['query'][_0x3479('0x3c')]){_0x1772af[_0x3479('0x3a')]=_[_0x3479('0x3d')](_0x1772af['where'],{'$or':_['map'](_0x3a683b,function(_0x524bab){if(_0x524bab[_0x3479('0x2d')]!==_0x3479('0x3e')){var _0x14263c={};_0x14263c[_0x524bab[_0x3479('0x27')]]={'$like':'%'+_0x4574e1[_0x3479('0x2f')]['filter']+'%'};return _0x14263c;}})});}_0x1772af=_[_0x3479('0x3d')]({},_0x1772af,_0x4574e1[_0x3479('0x3f')]);var _0x249253={'where':_0x1772af[_0x3479('0x3a')]};return db[_0x3479('0x40')][_0x3479('0x1e')](_0x249253)['then'](function(_0x4038a5){_0x49ef36[_0x3479('0x1e')]=_0x4038a5;if(_0x4574e1['query'][_0x3479('0x41')]){_0x1772af['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x3479('0x42')](_0x1772af);})['then'](function(_0x27bc47){_0x49ef36[_0x3479('0x43')]=_0x27bc47;return _0x49ef36;})[_0x3479('0x24')](respondWithFilteredResult(_0x314656,_0x1772af))[_0x3479('0x44')](handleError(_0x314656,null));};exports[_0x3479('0x45')]=function(_0x3ab048,_0x49abcb){var _0x3fbbfd={'raw':!![],'where':{'id':_0x3ab048[_0x3479('0x46')]['id']}},_0xf8951a={};_0xf8951a[_0x3479('0x32')]=_['keys'](db['AnalyticTreeReport'][_0x3479('0x2b')]);_0xf8951a[_0x3479('0x2f')]=_['keys'](_0x3ab048['query']);_0xf8951a['filters']=_[_0x3479('0x31')](_0xf8951a['model'],_0xf8951a[_0x3479('0x2f')]);_0x3fbbfd[_0x3479('0x33')]=_[_0x3479('0x31')](_0xf8951a[_0x3479('0x32')],qs[_0x3479('0x34')](_0x3ab048[_0x3479('0x2f')][_0x3479('0x34')]));_0x3fbbfd[_0x3479('0x33')]=_0x3fbbfd[_0x3479('0x33')]['length']?_0x3fbbfd['attributes']:_0xf8951a[_0x3479('0x32')];if(_0x3ab048[_0x3479('0x2f')][_0x3479('0x41')]){_0x3fbbfd[_0x3479('0x47')]=[{'all':!![]}];}_0x3fbbfd=_[_0x3479('0x3d')]({},_0x3fbbfd,_0x3ab048[_0x3479('0x3f')]);return db['AnalyticTreeReport'][_0x3479('0x48')](_0x3fbbfd)['then'](handleEntityNotFound(_0x49abcb,null))[_0x3479('0x24')](respondWithResult(_0x49abcb,null))[_0x3479('0x44')](handleError(_0x49abcb,null));};exports['create']=function(_0x4274a5,_0x8519ec){return db[_0x3479('0x40')][_0x3479('0x49')](_0x4274a5[_0x3479('0x4a')],{})[_0x3479('0x24')](respondWithResult(_0x8519ec,0xc9))[_0x3479('0x44')](handleError(_0x8519ec,null));};exports[_0x3479('0x4b')]=function(_0x5be356,_0x39ffd8){if(_0x5be356['body']['id']){delete _0x5be356['body']['id'];}return db[_0x3479('0x40')]['find']({'where':{'id':_0x5be356['params']['id']}})['then'](handleEntityNotFound(_0x39ffd8,null))[_0x3479('0x24')](saveUpdates(_0x5be356[_0x3479('0x4a')],null))[_0x3479('0x24')](respondWithResult(_0x39ffd8,null))[_0x3479('0x44')](handleError(_0x39ffd8,null));};exports['destroy']=function(_0x1eed14,_0x4ef6fe){return db[_0x3479('0x40')][_0x3479('0x48')]({'where':{'id':_0x1eed14[_0x3479('0x46')]['id']}})[_0x3479('0x24')](handleEntityNotFound(_0x4ef6fe,null))[_0x3479('0x24')](removeEntity(_0x4ef6fe,null))['catch'](handleError(_0x4ef6fe,null));}; \ No newline at end of file +var _0xcefd=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','reject','update','error','stack','send','index','map','AnalyticTreeReport','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','include','findAll','then','catch','show','params','rawAttributes','includeAll','options','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x267ce8,_0x4dd75c){var _0x5877a1=function(_0x1add15){while(--_0x1add15){_0x267ce8['push'](_0x267ce8['shift']());}};_0x5877a1(++_0x4dd75c);}(_0xcefd,0x12a));var _0xdcef=function(_0x19ebef,_0x451d2c){_0x19ebef=_0x19ebef-0x0;var _0x4aac24=_0xcefd[_0x19ebef];return _0x4aac24;};'use strict';var emlformat=require(_0xdcef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcef('0x1'));var jsonpatch=require(_0xdcef('0x2'));var rp=require(_0xdcef('0x3'));var moment=require(_0xdcef('0x4'));var BPromise=require(_0xdcef('0x5'));var Mustache=require(_0xdcef('0x6'));var util=require(_0xdcef('0x7'));var path=require(_0xdcef('0x8'));var sox=require(_0xdcef('0x9'));var csv=require(_0xdcef('0xa'));var ejs=require(_0xdcef('0xb'));var fs=require('fs');var fs_extra=require(_0xdcef('0xc'));var _=require('lodash');var squel=require(_0xdcef('0xd'));var crypto=require(_0xdcef('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdcef('0xf'));var toCsv=require(_0xdcef('0xa'));var querystring=require('querystring');var Papa=require(_0xdcef('0x10'));var Redis=require(_0xdcef('0x11'));var authService=require(_0xdcef('0x12'));var qs=require(_0xdcef('0x13'));var as=require(_0xdcef('0x14'));var hardwareService=require(_0xdcef('0x15'));var logger=require(_0xdcef('0x16'))(_0xdcef('0x17'));var utils=require(_0xdcef('0x18'));var config=require(_0xdcef('0x19'));var licenseUtil=require(_0xdcef('0x1a'));var db=require(_0xdcef('0x1b'))['db'];function respondWithStatusCode(_0x928c5,_0x202695){_0x202695=_0x202695||0xcc;return function(_0x1ef92e){if(_0x1ef92e){return _0x928c5[_0xdcef('0x1c')](_0x202695);}return _0x928c5[_0xdcef('0x1d')](_0x202695)[_0xdcef('0x1e')]();};}function respondWithResult(_0x3a5c92,_0x70db35){_0x70db35=_0x70db35||0xc8;return function(_0x223c07){if(_0x223c07){return _0x3a5c92[_0xdcef('0x1d')](_0x70db35)['json'](_0x223c07);}};}function respondWithFilteredResult(_0x4e61d7,_0x2de880){return function(_0x56c421){if(_0x56c421){var _0x1b7864=typeof _0x2de880['offset']==='undefined'&&typeof _0x2de880[_0xdcef('0x1f')]===_0xdcef('0x20');var _0xdae725=_0x56c421[_0xdcef('0x21')];var _0x142c67=_0x1b7864?0x0:_0x2de880['offset'];var _0x16814d=_0x1b7864?_0x56c421[_0xdcef('0x21')]:_0x2de880[_0xdcef('0x22')]+_0x2de880[_0xdcef('0x1f')];var _0x2986fb;if(_0x16814d>=_0xdae725){_0x16814d=_0xdae725;_0x2986fb=0xc8;}else{_0x2986fb=0xce;}_0x4e61d7[_0xdcef('0x1d')](_0x2986fb);return _0x4e61d7[_0xdcef('0x23')](_0xdcef('0x24'),_0x142c67+'-'+_0x16814d+'/'+_0xdae725)['json'](_0x56c421);}return null;};}function patchUpdates(_0x2d7021){return function(_0x17a6cc){try{jsonpatch[_0xdcef('0x25')](_0x17a6cc,_0x2d7021,!![]);}catch(_0x704da8){return BPromise[_0xdcef('0x26')](_0x704da8);}return _0x17a6cc['save']();};}function saveUpdates(_0x4eee15,_0x35dcca){return function(_0x48e2d3){if(_0x48e2d3){return _0x48e2d3[_0xdcef('0x27')](_0x4eee15)['then'](function(_0x514b5c){return _0x514b5c;});}return null;};}function removeEntity(_0x575d0d,_0x1fb00d){return function(_0x24b36d){if(_0x24b36d){return _0x24b36d['destroy']()['then'](function(){_0x575d0d['status'](0xcc)[_0xdcef('0x1e')]();});}};}function handleEntityNotFound(_0x363a90,_0x497f32){return function(_0x44497e){if(!_0x44497e){_0x363a90[_0xdcef('0x1c')](0x194);}return _0x44497e;};}function handleError(_0x1badec,_0x49a8df){_0x49a8df=_0x49a8df||0x1f4;return function(_0x1edc0e){logger[_0xdcef('0x28')](_0x1edc0e[_0xdcef('0x29')]);if(_0x1edc0e['name']){delete _0x1edc0e['name'];}_0x1badec[_0xdcef('0x1d')](_0x49a8df)[_0xdcef('0x2a')](_0x1edc0e);};}exports[_0xdcef('0x2b')]=function(_0x1c0681,_0x251ca3){var _0x1e5b3f={},_0x107f1b={},_0x183d81={'count':0x0,'rows':[]};var _0x233040=_[_0xdcef('0x2c')](db[_0xdcef('0x2d')]['rawAttributes'],function(_0x4295b7){return{'name':_0x4295b7['fieldName'],'type':_0x4295b7[_0xdcef('0x2e')][_0xdcef('0x2f')]};});_0x107f1b[_0xdcef('0x30')]=_['map'](_0x233040,_0xdcef('0x31'));_0x107f1b[_0xdcef('0x32')]=_[_0xdcef('0x33')](_0x1c0681[_0xdcef('0x32')]);_0x107f1b[_0xdcef('0x34')]=_[_0xdcef('0x35')](_0x107f1b[_0xdcef('0x30')],_0x107f1b[_0xdcef('0x32')]);_0x1e5b3f[_0xdcef('0x36')]=_[_0xdcef('0x35')](_0x107f1b['model'],qs[_0xdcef('0x37')](_0x1c0681[_0xdcef('0x32')]['fields']));_0x1e5b3f['attributes']=_0x1e5b3f[_0xdcef('0x36')][_0xdcef('0x38')]?_0x1e5b3f[_0xdcef('0x36')]:_0x107f1b[_0xdcef('0x30')];if(!_0x1c0681[_0xdcef('0x32')][_0xdcef('0x39')]('nolimit')){_0x1e5b3f[_0xdcef('0x1f')]=qs[_0xdcef('0x1f')](_0x1c0681[_0xdcef('0x32')][_0xdcef('0x1f')]);_0x1e5b3f[_0xdcef('0x22')]=qs[_0xdcef('0x22')](_0x1c0681[_0xdcef('0x32')][_0xdcef('0x22')]);}_0x1e5b3f[_0xdcef('0x3a')]=qs['sort'](_0x1c0681[_0xdcef('0x32')][_0xdcef('0x3b')]);_0x1e5b3f[_0xdcef('0x3c')]=qs[_0xdcef('0x34')](_['pick'](_0x1c0681[_0xdcef('0x32')],_0x107f1b['filters']),_0x233040);if(_0x1c0681[_0xdcef('0x32')]['filter']){_0x1e5b3f[_0xdcef('0x3c')]=_['merge'](_0x1e5b3f[_0xdcef('0x3c')],{'$or':_['map'](_0x233040,function(_0x368e48){if(_0x368e48[_0xdcef('0x2e')]!==_0xdcef('0x3d')){var _0x1f25db={};_0x1f25db[_0x368e48['name']]={'$like':'%'+_0x1c0681[_0xdcef('0x32')]['filter']+'%'};return _0x1f25db;}})});}_0x1e5b3f=_[_0xdcef('0x3e')]({},_0x1e5b3f,_0x1c0681['options']);var _0x3ce371={'where':_0x1e5b3f[_0xdcef('0x3c')]};return db[_0xdcef('0x2d')]['count'](_0x3ce371)['then'](function(_0x275d92){_0x183d81[_0xdcef('0x21')]=_0x275d92;if(_0x1c0681[_0xdcef('0x32')]['includeAll']){_0x1e5b3f[_0xdcef('0x3f')]=[{'all':!![]}];}return db[_0xdcef('0x2d')][_0xdcef('0x40')](_0x1e5b3f);})[_0xdcef('0x41')](function(_0x150753){_0x183d81['rows']=_0x150753;return _0x183d81;})[_0xdcef('0x41')](respondWithFilteredResult(_0x251ca3,_0x1e5b3f))[_0xdcef('0x42')](handleError(_0x251ca3,null));};exports[_0xdcef('0x43')]=function(_0xe83aff,_0x3e6eef){var _0x1c3416={'raw':!![],'where':{'id':_0xe83aff[_0xdcef('0x44')]['id']}},_0x3a0f7d={};_0x3a0f7d[_0xdcef('0x30')]=_[_0xdcef('0x33')](db[_0xdcef('0x2d')][_0xdcef('0x45')]);_0x3a0f7d[_0xdcef('0x32')]=_[_0xdcef('0x33')](_0xe83aff[_0xdcef('0x32')]);_0x3a0f7d[_0xdcef('0x34')]=_[_0xdcef('0x35')](_0x3a0f7d[_0xdcef('0x30')],_0x3a0f7d[_0xdcef('0x32')]);_0x1c3416[_0xdcef('0x36')]=_[_0xdcef('0x35')](_0x3a0f7d['model'],qs[_0xdcef('0x37')](_0xe83aff['query']['fields']));_0x1c3416[_0xdcef('0x36')]=_0x1c3416[_0xdcef('0x36')][_0xdcef('0x38')]?_0x1c3416[_0xdcef('0x36')]:_0x3a0f7d[_0xdcef('0x30')];if(_0xe83aff['query'][_0xdcef('0x46')]){_0x1c3416[_0xdcef('0x3f')]=[{'all':!![]}];}_0x1c3416=_[_0xdcef('0x3e')]({},_0x1c3416,_0xe83aff[_0xdcef('0x47')]);return db[_0xdcef('0x2d')]['find'](_0x1c3416)[_0xdcef('0x41')](handleEntityNotFound(_0x3e6eef,null))[_0xdcef('0x41')](respondWithResult(_0x3e6eef,null))[_0xdcef('0x42')](handleError(_0x3e6eef,null));};exports[_0xdcef('0x48')]=function(_0x3e7cb8,_0x2fbf3f){return db[_0xdcef('0x2d')][_0xdcef('0x48')](_0x3e7cb8[_0xdcef('0x49')],{})[_0xdcef('0x41')](respondWithResult(_0x2fbf3f,0xc9))[_0xdcef('0x42')](handleError(_0x2fbf3f,null));};exports[_0xdcef('0x27')]=function(_0x17b732,_0x35bfaf){if(_0x17b732['body']['id']){delete _0x17b732['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x17b732['params']['id']}})[_0xdcef('0x41')](handleEntityNotFound(_0x35bfaf,null))[_0xdcef('0x41')](saveUpdates(_0x17b732[_0xdcef('0x49')],null))['then'](respondWithResult(_0x35bfaf,null))[_0xdcef('0x42')](handleError(_0x35bfaf,null));};exports[_0xdcef('0x4a')]=function(_0x1f8f54,_0x3f894f){return db[_0xdcef('0x2d')][_0xdcef('0x4b')]({'where':{'id':_0x1f8f54[_0xdcef('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f894f,null))[_0xdcef('0x41')](removeEntity(_0x3f894f,null))[_0xdcef('0x42')](handleError(_0x3f894f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5f125cc..4dd0610 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 _0x3946=['request-promise','define','analytics_report_trees','../../config/logger','api','bluebird'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3946,0x111));var _0x6394=function(_0x27b6e3,_0x3445d1){_0x27b6e3=_0x27b6e3-0x0;var _0x3b2f1a=_0x3946[_0x27b6e3];return _0x3b2f1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6394('0x0'))(_0x6394('0x1'));var moment=require('moment');var BPromise=require(_0x6394('0x2'));var rp=require(_0x6394('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x51e3f9,_0x31ea0d){return _0x51e3f9[_0x6394('0x4')]('AnalyticTreeReport',attributes,{'tableName':_0x6394('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79fc=['api','moment','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','lodash','util'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x79fc,0x1a5));var _0xc79f=function(_0x38fea3,_0x4601cf){_0x38fea3=_0x38fea3-0x0;var _0x5de2d5=_0x79fc[_0x38fea3];return _0x5de2d5;};'use strict';var _=require(_0xc79f('0x0'));var util=require(_0xc79f('0x1'));var logger=require('../../config/logger')(_0xc79f('0x2'));var moment=require(_0xc79f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc79f('0x4'));var config=require(_0xc79f('0x5'));var attributes=require(_0xc79f('0x6'));module[_0xc79f('0x7')]=function(_0x7f815b,_0x11fe3c){return _0x7f815b['define'](_0xc79f('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 58b1e51..56fad57 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x51812c,_0x4e3782){var _0xe5465b=function(_0x57f41f){while(--_0x57f41f){_0x51812c['push'](_0x51812c['shift']());}};_0xe5465b(++_0x4e3782);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xee91f1,_0x59e7ce){var _0x477e68=function(_0x4df252){while(--_0x4df252){_0xee91f1['push'](_0xee91f1['shift']());}};_0x477e68(++_0x59e7ce);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c37e737..1e18548 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 _0x2f9b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','index','get','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','express','Router'];(function(_0x3d2977,_0x35289d){var _0x39392f=function(_0x5a28ee){while(--_0x5a28ee){_0x3d2977['push'](_0x3d2977['shift']());}};_0x39392f(++_0x35289d);}(_0x2f9b,0x10b));var _0xb2f9=function(_0x3ca095,_0xddb00c){_0x3ca095=_0x3ca095-0x0;var _0x494a59=_0x2f9b[_0x3ca095];return _0x494a59;};'use strict';var multer=require(_0xb2f9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2f9('0x1'));var router=express[_0xb2f9('0x2')]();var fs_extra=require(_0xb2f9('0x3'));var auth=require(_0xb2f9('0x4'));var interaction=require(_0xb2f9('0x5'));var config=require(_0xb2f9('0x6'));var controller=require(_0xb2f9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb2f9('0x8')]);router[_0xb2f9('0x9')]('/:id',auth[_0xb2f9('0xa')](),controller[_0xb2f9('0xb')]);router['post']('/',auth[_0xb2f9('0xa')](),controller[_0xb2f9('0xc')]);router[_0xb2f9('0xd')]('/:id',auth[_0xb2f9('0xa')](),controller[_0xb2f9('0xe')]);router[_0xb2f9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb2f9('0x10')]);module[_0xb2f9('0x11')]=router; \ No newline at end of file +var _0x1d61=['get','isAuthenticated','index','/:id','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x1af9ac,_0xf22e96){var _0x526b39=function(_0x2e6b51){while(--_0x2e6b51){_0x1af9ac['push'](_0x1af9ac['shift']());}};_0x526b39(++_0xf22e96);}(_0x1d61,0x170));var _0x11d6=function(_0x5cfb27,_0x1c4a9e){_0x5cfb27=_0x5cfb27-0x0;var _0x5a96e3=_0x1d61[_0x5cfb27];return _0x5a96e3;};'use strict';var multer=require(_0x11d6('0x0'));var util=require(_0x11d6('0x1'));var path=require('path');var timeout=require(_0x11d6('0x2'));var express=require(_0x11d6('0x3'));var router=express[_0x11d6('0x4')]();var fs_extra=require(_0x11d6('0x5'));var auth=require(_0x11d6('0x6'));var interaction=require(_0x11d6('0x7'));var config=require(_0x11d6('0x8'));var controller=require(_0x11d6('0x9'));router[_0x11d6('0xa')]('/',auth[_0x11d6('0xb')](),controller[_0x11d6('0xc')]);router[_0x11d6('0xa')](_0x11d6('0xd'),auth[_0x11d6('0xb')](),controller['show']);router['post']('/',auth[_0x11d6('0xb')](),controller['create']);router[_0x11d6('0xe')](_0x11d6('0xd'),auth['isAuthenticated'](),controller[_0x11d6('0xf')]);router[_0x11d6('0x10')](_0x11d6('0xd'),auth[_0x11d6('0xb')](),controller['destroy']);module[_0x11d6('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1ff25df..f780c66 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 _0xc368=['STRING','exports'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc368,0x7b));var _0x8c36=function(_0x4c6bf5,_0x565c2d){_0x4c6bf5=_0x4c6bf5-0x0;var _0x12b2c7=_0xc368[_0x4c6bf5];return _0x12b2c7;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x8c36('0x1')]},'type':{'type':Sequelize[_0x8c36('0x1')]}}; \ No newline at end of file +var _0x6873=['STRING'];(function(_0x1cc06f,_0x53634b){var _0x4956e7=function(_0x452b4a){while(--_0x452b4a){_0x1cc06f['push'](_0x1cc06f['shift']());}};_0x4956e7(++_0x53634b);}(_0x6873,0xac));var _0x3687=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0x6873[_0xa041de];return _0x1d654c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3687('0x0')]},'basename':{'type':Sequelize[_0x3687('0x0')]},'type':{'type':Sequelize[_0x3687('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 697cb20..81f3377 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 _0xd830=['Attachment','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','clone','rawAttributes','get','omit','updatedAt','body','create','update','find','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map'];(function(_0x3fec6a,_0x4e1ace){var _0x4f1f30=function(_0x4c6d42){while(--_0x4c6d42){_0x3fec6a['push'](_0x3fec6a['shift']());}};_0x4f1f30(++_0x4e1ace);}(_0xd830,0x130));var _0x0d83=function(_0x201947,_0x2d1a5c){_0x201947=_0x201947-0x0;var _0x56f416=_0xd830[_0x201947];return _0x56f416;};'use strict';var emlformat=require(_0x0d83('0x0'));var rimraf=require(_0x0d83('0x1'));var zipdir=require(_0x0d83('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d83('0x3'));var moment=require(_0x0d83('0x4'));var BPromise=require(_0x0d83('0x5'));var Mustache=require(_0x0d83('0x6'));var util=require(_0x0d83('0x7'));var path=require(_0x0d83('0x8'));var sox=require(_0x0d83('0x9'));var csv=require(_0x0d83('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d83('0xb'));var _=require('lodash');var squel=require(_0x0d83('0xc'));var crypto=require(_0x0d83('0xd'));var jsforce=require(_0x0d83('0xe'));var deskjs=require(_0x0d83('0xf'));var toCsv=require(_0x0d83('0xa'));var querystring=require(_0x0d83('0x10'));var Papa=require(_0x0d83('0x11'));var Redis=require(_0x0d83('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d83('0x13'));var logger=require(_0x0d83('0x14'))(_0x0d83('0x15'));var utils=require(_0x0d83('0x16'));var config=require(_0x0d83('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d83('0x18'))['db'];function respondWithStatusCode(_0x79b01f,_0x21350e){_0x21350e=_0x21350e||0xcc;return function(_0x3531fa){if(_0x3531fa){return _0x79b01f[_0x0d83('0x19')](_0x21350e);}return _0x79b01f[_0x0d83('0x1a')](_0x21350e)['end']();};}function respondWithResult(_0x2f90f0,_0x5c2b5f){_0x5c2b5f=_0x5c2b5f||0xc8;return function(_0x377b41){if(_0x377b41){return _0x2f90f0[_0x0d83('0x1a')](_0x5c2b5f)[_0x0d83('0x1b')](_0x377b41);}};}function respondWithFilteredResult(_0x1ad61d,_0x4781ad){return function(_0x10fdbc){if(_0x10fdbc){var _0x27928a=typeof _0x4781ad[_0x0d83('0x1c')]==='undefined'&&typeof _0x4781ad['limit']===_0x0d83('0x1d');var _0x5509b4=_0x10fdbc['count'];var _0x2b6e2a=_0x27928a?0x0:_0x4781ad['offset'];var _0xf1d83c=_0x27928a?_0x10fdbc[_0x0d83('0x1e')]:_0x4781ad['offset']+_0x4781ad[_0x0d83('0x1f')];var _0x39da79;if(_0xf1d83c>=_0x5509b4){_0xf1d83c=_0x5509b4;_0x39da79=0xc8;}else{_0x39da79=0xce;}_0x1ad61d['status'](_0x39da79);return _0x1ad61d[_0x0d83('0x20')](_0x0d83('0x21'),_0x2b6e2a+'-'+_0xf1d83c+'/'+_0x5509b4)[_0x0d83('0x1b')](_0x10fdbc);}return null;};}function patchUpdates(_0x12bcb7){return function(_0x3f2fb8){try{jsonpatch[_0x0d83('0x22')](_0x3f2fb8,_0x12bcb7,!![]);}catch(_0x4bdd40){return BPromise[_0x0d83('0x23')](_0x4bdd40);}return _0x3f2fb8[_0x0d83('0x24')]();};}function saveUpdates(_0x2ab2d6,_0x1171b4){return function(_0x5a0b45){if(_0x5a0b45){return _0x5a0b45['update'](_0x2ab2d6)[_0x0d83('0x25')](function(_0x2f64d6){return _0x2f64d6;});}return null;};}function removeEntity(_0x329364,_0x29d688){return function(_0x29c1c0){if(_0x29c1c0){return _0x29c1c0[_0x0d83('0x26')]()['then'](function(){_0x329364[_0x0d83('0x1a')](0xcc)[_0x0d83('0x27')]();});}};}function handleEntityNotFound(_0x49e3ea,_0x3bb57c){return function(_0x2ff642){if(!_0x2ff642){_0x49e3ea[_0x0d83('0x19')](0x194);}return _0x2ff642;};}function handleError(_0x5da92e,_0x442793){_0x442793=_0x442793||0x1f4;return function(_0x17b154){logger['error'](_0x17b154['stack']);if(_0x17b154['name']){delete _0x17b154[_0x0d83('0x28')];}_0x5da92e[_0x0d83('0x1a')](_0x442793)[_0x0d83('0x29')](_0x17b154);};}exports[_0x0d83('0x2a')]=function(_0x83686a,_0xc69f57){var _0x192947={},_0x561c32={},_0x5c8523={'count':0x0,'rows':[]};var _0x3ba1f1=_[_0x0d83('0x2b')](db[_0x0d83('0x2c')]['rawAttributes'],function(_0x5b55be){return{'name':_0x5b55be['fieldName'],'type':_0x5b55be['type'][_0x0d83('0x2d')]};});_0x561c32[_0x0d83('0x2e')]=_['map'](_0x3ba1f1,_0x0d83('0x28'));_0x561c32['query']=_[_0x0d83('0x2f')](_0x83686a['query']);_0x561c32[_0x0d83('0x30')]=_[_0x0d83('0x31')](_0x561c32['model'],_0x561c32[_0x0d83('0x32')]);_0x192947[_0x0d83('0x33')]=_[_0x0d83('0x31')](_0x561c32[_0x0d83('0x2e')],qs[_0x0d83('0x34')](_0x83686a[_0x0d83('0x32')][_0x0d83('0x34')]));_0x192947[_0x0d83('0x33')]=_0x192947['attributes'][_0x0d83('0x35')]?_0x192947[_0x0d83('0x33')]:_0x561c32[_0x0d83('0x2e')];if(!_0x83686a[_0x0d83('0x32')][_0x0d83('0x36')](_0x0d83('0x37'))){_0x192947['limit']=qs[_0x0d83('0x1f')](_0x83686a[_0x0d83('0x32')][_0x0d83('0x1f')]);_0x192947['offset']=qs[_0x0d83('0x1c')](_0x83686a[_0x0d83('0x32')][_0x0d83('0x1c')]);}_0x192947[_0x0d83('0x38')]=qs['sort'](_0x83686a['query']['sort']);_0x192947[_0x0d83('0x39')]=qs[_0x0d83('0x30')](_['pick'](_0x83686a[_0x0d83('0x32')],_0x561c32[_0x0d83('0x30')]),_0x3ba1f1);if(_0x83686a[_0x0d83('0x32')][_0x0d83('0x3a')]){_0x192947[_0x0d83('0x39')]=_[_0x0d83('0x3b')](_0x192947[_0x0d83('0x39')],{'$or':_[_0x0d83('0x2b')](_0x3ba1f1,function(_0x162c24){if(_0x162c24[_0x0d83('0x3c')]!==_0x0d83('0x3d')){var _0x299ec7={};_0x299ec7[_0x162c24[_0x0d83('0x28')]]={'$like':'%'+_0x83686a[_0x0d83('0x32')][_0x0d83('0x3a')]+'%'};return _0x299ec7;}})});}_0x192947=_['merge']({},_0x192947,_0x83686a[_0x0d83('0x3e')]);var _0x13b0ec={'where':_0x192947[_0x0d83('0x39')]};return db[_0x0d83('0x2c')][_0x0d83('0x1e')](_0x13b0ec)['then'](function(_0x349d06){_0x5c8523[_0x0d83('0x1e')]=_0x349d06;if(_0x83686a['query'][_0x0d83('0x3f')]){_0x192947['include']=[{'all':!![]}];}return db['Attachment'][_0x0d83('0x40')](_0x192947);})[_0x0d83('0x25')](function(_0x5c356f){_0x5c8523[_0x0d83('0x41')]=_0x5c356f;return _0x5c8523;})[_0x0d83('0x25')](respondWithFilteredResult(_0xc69f57,_0x192947))[_0x0d83('0x42')](handleError(_0xc69f57,null));};exports['show']=function(_0x492ee9,_0x584145){var _0x40aee5={'raw':!![],'where':{'id':_0x492ee9[_0x0d83('0x43')]['id']}},_0x1e1915={};_0x1e1915[_0x0d83('0x2e')]=_[_0x0d83('0x2f')](db[_0x0d83('0x2c')]['rawAttributes']);_0x1e1915[_0x0d83('0x32')]=_['keys'](_0x492ee9[_0x0d83('0x32')]);_0x1e1915[_0x0d83('0x30')]=_[_0x0d83('0x31')](_0x1e1915['model'],_0x1e1915[_0x0d83('0x32')]);_0x40aee5[_0x0d83('0x33')]=_[_0x0d83('0x31')](_0x1e1915['model'],qs['fields'](_0x492ee9[_0x0d83('0x32')][_0x0d83('0x34')]));_0x40aee5[_0x0d83('0x33')]=_0x40aee5[_0x0d83('0x33')][_0x0d83('0x35')]?_0x40aee5[_0x0d83('0x33')]:_0x1e1915[_0x0d83('0x2e')];if(_0x492ee9[_0x0d83('0x32')][_0x0d83('0x3f')]){_0x40aee5[_0x0d83('0x44')]=[{'all':!![]}];}_0x40aee5=_[_0x0d83('0x3b')]({},_0x40aee5,_0x492ee9['options']);return db['Attachment']['find'](_0x40aee5)[_0x0d83('0x25')](handleEntityNotFound(_0x584145,null))[_0x0d83('0x25')](respondWithResult(_0x584145,null))[_0x0d83('0x42')](handleError(_0x584145,null));};exports[_0x0d83('0x45')]=function(_0x16dfe9,_0x12339a){var _0x55e67f={'where':{'id':_0x16dfe9[_0x0d83('0x43')]['id']}},_0x5b584a={};_0x5b584a['model']=_[_0x0d83('0x2f')](db[_0x0d83('0x2c')][_0x0d83('0x46')]);_0x55e67f[_0x0d83('0x33')]=_[_0x0d83('0x31')](_0x5b584a[_0x0d83('0x2e')],qs[_0x0d83('0x34')](_0x16dfe9[_0x0d83('0x32')][_0x0d83('0x34')]));_0x55e67f[_0x0d83('0x33')]=_0x55e67f['attributes'][_0x0d83('0x35')]?_0x55e67f[_0x0d83('0x33')]:_0x5b584a['model'];if(_0x16dfe9[_0x0d83('0x32')][_0x0d83('0x3f')]){_0x55e67f[_0x0d83('0x44')]=[{'all':!![]}];}_0x55e67f=_[_0x0d83('0x3b')]({},_0x55e67f,_0x16dfe9[_0x0d83('0x3e')]);return db[_0x0d83('0x2c')]['find'](_0x55e67f)[_0x0d83('0x25')](handleEntityNotFound(_0x12339a,null))[_0x0d83('0x25')](function(_0x36cc1d){if(_0x36cc1d){var _0x19ab96=_0x36cc1d[_0x0d83('0x47')]({'plain':!![]});_0x19ab96=qs[_0x0d83('0x48')](_0x19ab96,['id','createdAt',_0x0d83('0x49')]);_0x16dfe9[_0x0d83('0x4a')]=_['omit'](_0x16dfe9['body'],['id','createdAt','updatedAt']);return db[_0x0d83('0x2c')][_0x0d83('0x4b')](_[_0x0d83('0x3b')](_0x19ab96,_0x16dfe9[_0x0d83('0x4a')]),{'include':_0x16dfe9[_0x0d83('0x32')][_0x0d83('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x12339a,0xc9))[_0x0d83('0x42')](handleError(_0x12339a,null));};exports[_0x0d83('0x4c')]=function(_0x31609a,_0x1bfbde){if(_0x31609a[_0x0d83('0x4a')]['id']){delete _0x31609a[_0x0d83('0x4a')]['id'];}return db[_0x0d83('0x2c')]['find']({'where':{'id':_0x31609a[_0x0d83('0x43')]['id']}})[_0x0d83('0x25')](handleEntityNotFound(_0x1bfbde,null))[_0x0d83('0x25')](saveUpdates(_0x31609a[_0x0d83('0x4a')],null))[_0x0d83('0x25')](respondWithResult(_0x1bfbde,null))[_0x0d83('0x42')](handleError(_0x1bfbde,null));};exports[_0x0d83('0x26')]=function(_0x590ce1,_0x24ab1b){return db['Attachment'][_0x0d83('0x4d')]({'where':{'id':_0x590ce1[_0x0d83('0x43')]['id']}})['then'](handleEntityNotFound(_0x24ab1b,null))['then'](removeEntity(_0x24ab1b,null))['catch'](handleError(_0x24ab1b,null));};exports['create']=function(_0x2c058e,_0x280600,_0x4546fc){_0x2c058e[_0x0d83('0x4a')][_0x0d83('0x28')]=_0x2c058e[_0x0d83('0x4e')][_0x0d83('0x4f')];_0x2c058e[_0x0d83('0x4a')][_0x0d83('0x50')]=_0x2c058e[_0x0d83('0x4e')][_0x0d83('0x51')];_0x2c058e['body'][_0x0d83('0x3c')]=_0x2c058e[_0x0d83('0x4e')][_0x0d83('0x52')];return db['Attachment'][_0x0d83('0x4b')](_0x2c058e[_0x0d83('0x4a')])[_0x0d83('0x25')](respondWithResult(_0x280600,0xc9))[_0x0d83('0x42')](handleError(_0x280600,null));};exports[_0x0d83('0x53')]=function(_0x4c3224,_0x2b60f8,_0x933efd){return db[_0x0d83('0x2c')]['findOne']({'where':{'id':_0x4c3224[_0x0d83('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2b60f8,null))['then'](function(_0x4c56fa){if(_0x4c56fa){var _0x3b8ee6=_0x4c56fa[_0x0d83('0x54')]!==null;var _0x39f7bb=path[_0x0d83('0x55')](config[_0x0d83('0x56')],'server/files/attachments/');if(_0x3b8ee6){_0x39f7bb=path[_0x0d83('0x55')](_0x39f7bb,'offline-chat/');}var _0x301a71=path[_0x0d83('0x55')](_0x39f7bb,_0x4c56fa[_0x0d83('0x50')]);return _0x2b60f8[_0x0d83('0x53')](_0x301a71);}})['catch'](handleError(_0x2b60f8,null));}; \ No newline at end of file +var _0xa410=['map','filters','intersection','query','fields','attributes','length','nolimit','where','filter','merge','VIRTUAL','Attachment','includeAll','include','findAll','rows','catch','show','params','keys','find','clone','options','omit','updatedAt','body','createdAt','create','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xa410,0xdd));var _0x0a41=function(_0x4d3374,_0x11350d){_0x4d3374=_0x4d3374-0x0;var _0x1a2d8d=_0xa410[_0x4d3374];return _0x1a2d8d;};'use strict';var emlformat=require(_0x0a41('0x0'));var rimraf=require(_0x0a41('0x1'));var zipdir=require(_0x0a41('0x2'));var jsonpatch=require(_0x0a41('0x3'));var rp=require(_0x0a41('0x4'));var moment=require(_0x0a41('0x5'));var BPromise=require(_0x0a41('0x6'));var Mustache=require('mustache');var util=require(_0x0a41('0x7'));var path=require(_0x0a41('0x8'));var sox=require('sox');var csv=require(_0x0a41('0x9'));var ejs=require(_0x0a41('0xa'));var fs=require('fs');var fs_extra=require(_0x0a41('0xb'));var _=require(_0x0a41('0xc'));var squel=require('squel');var crypto=require(_0x0a41('0xd'));var jsforce=require(_0x0a41('0xe'));var deskjs=require(_0x0a41('0xf'));var toCsv=require(_0x0a41('0x9'));var querystring=require(_0x0a41('0x10'));var Papa=require(_0x0a41('0x11'));var Redis=require(_0x0a41('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0a41('0x13'));var as=require(_0x0a41('0x14'));var hardwareService=require(_0x0a41('0x15'));var logger=require(_0x0a41('0x16'))(_0x0a41('0x17'));var utils=require(_0x0a41('0x18'));var config=require(_0x0a41('0x19'));var licenseUtil=require(_0x0a41('0x1a'));var db=require(_0x0a41('0x1b'))['db'];function respondWithStatusCode(_0x19ce65,_0x3d8a8b){_0x3d8a8b=_0x3d8a8b||0xcc;return function(_0x50fcf6){if(_0x50fcf6){return _0x19ce65[_0x0a41('0x1c')](_0x3d8a8b);}return _0x19ce65[_0x0a41('0x1d')](_0x3d8a8b)[_0x0a41('0x1e')]();};}function respondWithResult(_0x5dac04,_0xb7de30){_0xb7de30=_0xb7de30||0xc8;return function(_0x3f1c1e){if(_0x3f1c1e){return _0x5dac04['status'](_0xb7de30)['json'](_0x3f1c1e);}};}function respondWithFilteredResult(_0x1e6af0,_0x29bdde){return function(_0x28411b){if(_0x28411b){var _0x3b8163=typeof _0x29bdde[_0x0a41('0x1f')]===_0x0a41('0x20')&&typeof _0x29bdde['limit']===_0x0a41('0x20');var _0x384a01=_0x28411b[_0x0a41('0x21')];var _0x3a0945=_0x3b8163?0x0:_0x29bdde[_0x0a41('0x1f')];var _0x1061a7=_0x3b8163?_0x28411b['count']:_0x29bdde[_0x0a41('0x1f')]+_0x29bdde[_0x0a41('0x22')];var _0x2bf93f;if(_0x1061a7>=_0x384a01){_0x1061a7=_0x384a01;_0x2bf93f=0xc8;}else{_0x2bf93f=0xce;}_0x1e6af0[_0x0a41('0x1d')](_0x2bf93f);return _0x1e6af0[_0x0a41('0x23')](_0x0a41('0x24'),_0x3a0945+'-'+_0x1061a7+'/'+_0x384a01)['json'](_0x28411b);}return null;};}function patchUpdates(_0x18c00d){return function(_0x551880){try{jsonpatch[_0x0a41('0x25')](_0x551880,_0x18c00d,!![]);}catch(_0x114672){return BPromise[_0x0a41('0x26')](_0x114672);}return _0x551880[_0x0a41('0x27')]();};}function saveUpdates(_0xa1c68a,_0x306e81){return function(_0xa68f44){if(_0xa68f44){return _0xa68f44[_0x0a41('0x28')](_0xa1c68a)[_0x0a41('0x29')](function(_0xa2d7e8){return _0xa2d7e8;});}return null;};}function removeEntity(_0x169d7b,_0x4dcc64){return function(_0x5be95f){if(_0x5be95f){return _0x5be95f[_0x0a41('0x2a')]()[_0x0a41('0x29')](function(){_0x169d7b[_0x0a41('0x1d')](0xcc)[_0x0a41('0x1e')]();});}};}function handleEntityNotFound(_0x94ef14,_0x28c9b5){return function(_0x5f2a4a){if(!_0x5f2a4a){_0x94ef14[_0x0a41('0x1c')](0x194);}return _0x5f2a4a;};}function handleError(_0x40bb21,_0x3de4a5){_0x3de4a5=_0x3de4a5||0x1f4;return function(_0x12458c){logger[_0x0a41('0x2b')](_0x12458c['stack']);if(_0x12458c['name']){delete _0x12458c[_0x0a41('0x2c')];}_0x40bb21[_0x0a41('0x1d')](_0x3de4a5)[_0x0a41('0x2d')](_0x12458c);};}exports[_0x0a41('0x2e')]=function(_0x8934f0,_0x435375){var _0x2f81fd={},_0x5ff1b4={},_0x33da49={'count':0x0,'rows':[]};var _0x533b7b=_['map'](db['Attachment'][_0x0a41('0x2f')],function(_0x976ea7){return{'name':_0x976ea7[_0x0a41('0x30')],'type':_0x976ea7[_0x0a41('0x31')][_0x0a41('0x32')]};});_0x5ff1b4[_0x0a41('0x33')]=_[_0x0a41('0x34')](_0x533b7b,_0x0a41('0x2c'));_0x5ff1b4['query']=_['keys'](_0x8934f0['query']);_0x5ff1b4[_0x0a41('0x35')]=_[_0x0a41('0x36')](_0x5ff1b4[_0x0a41('0x33')],_0x5ff1b4[_0x0a41('0x37')]);_0x2f81fd['attributes']=_['intersection'](_0x5ff1b4[_0x0a41('0x33')],qs['fields'](_0x8934f0['query'][_0x0a41('0x38')]));_0x2f81fd[_0x0a41('0x39')]=_0x2f81fd[_0x0a41('0x39')][_0x0a41('0x3a')]?_0x2f81fd[_0x0a41('0x39')]:_0x5ff1b4[_0x0a41('0x33')];if(!_0x8934f0[_0x0a41('0x37')]['hasOwnProperty'](_0x0a41('0x3b'))){_0x2f81fd[_0x0a41('0x22')]=qs['limit'](_0x8934f0['query'][_0x0a41('0x22')]);_0x2f81fd[_0x0a41('0x1f')]=qs[_0x0a41('0x1f')](_0x8934f0['query'][_0x0a41('0x1f')]);}_0x2f81fd['order']=qs['sort'](_0x8934f0['query']['sort']);_0x2f81fd[_0x0a41('0x3c')]=qs[_0x0a41('0x35')](_['pick'](_0x8934f0['query'],_0x5ff1b4['filters']),_0x533b7b);if(_0x8934f0[_0x0a41('0x37')][_0x0a41('0x3d')]){_0x2f81fd[_0x0a41('0x3c')]=_[_0x0a41('0x3e')](_0x2f81fd['where'],{'$or':_[_0x0a41('0x34')](_0x533b7b,function(_0xf6d5bd){if(_0xf6d5bd['type']!==_0x0a41('0x3f')){var _0xdaada4={};_0xdaada4[_0xf6d5bd[_0x0a41('0x2c')]]={'$like':'%'+_0x8934f0[_0x0a41('0x37')][_0x0a41('0x3d')]+'%'};return _0xdaada4;}})});}_0x2f81fd=_[_0x0a41('0x3e')]({},_0x2f81fd,_0x8934f0['options']);var _0x342fc6={'where':_0x2f81fd[_0x0a41('0x3c')]};return db[_0x0a41('0x40')][_0x0a41('0x21')](_0x342fc6)['then'](function(_0x1dbcf4){_0x33da49[_0x0a41('0x21')]=_0x1dbcf4;if(_0x8934f0['query'][_0x0a41('0x41')]){_0x2f81fd[_0x0a41('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x0a41('0x43')](_0x2f81fd);})['then'](function(_0x2c1e83){_0x33da49[_0x0a41('0x44')]=_0x2c1e83;return _0x33da49;})[_0x0a41('0x29')](respondWithFilteredResult(_0x435375,_0x2f81fd))[_0x0a41('0x45')](handleError(_0x435375,null));};exports[_0x0a41('0x46')]=function(_0x358b3d,_0x7dde7){var _0x40ff3d={'raw':!![],'where':{'id':_0x358b3d[_0x0a41('0x47')]['id']}},_0x138dbc={};_0x138dbc['model']=_[_0x0a41('0x48')](db['Attachment'][_0x0a41('0x2f')]);_0x138dbc['query']=_['keys'](_0x358b3d[_0x0a41('0x37')]);_0x138dbc[_0x0a41('0x35')]=_[_0x0a41('0x36')](_0x138dbc[_0x0a41('0x33')],_0x138dbc['query']);_0x40ff3d[_0x0a41('0x39')]=_[_0x0a41('0x36')](_0x138dbc[_0x0a41('0x33')],qs[_0x0a41('0x38')](_0x358b3d['query'][_0x0a41('0x38')]));_0x40ff3d[_0x0a41('0x39')]=_0x40ff3d['attributes'][_0x0a41('0x3a')]?_0x40ff3d[_0x0a41('0x39')]:_0x138dbc[_0x0a41('0x33')];if(_0x358b3d[_0x0a41('0x37')][_0x0a41('0x41')]){_0x40ff3d[_0x0a41('0x42')]=[{'all':!![]}];}_0x40ff3d=_[_0x0a41('0x3e')]({},_0x40ff3d,_0x358b3d['options']);return db['Attachment'][_0x0a41('0x49')](_0x40ff3d)['then'](handleEntityNotFound(_0x7dde7,null))[_0x0a41('0x29')](respondWithResult(_0x7dde7,null))[_0x0a41('0x45')](handleError(_0x7dde7,null));};exports[_0x0a41('0x4a')]=function(_0x8360da,_0x18ac99){var _0x3d31a2={'where':{'id':_0x8360da['params']['id']}},_0x51f3e5={};_0x51f3e5['model']=_[_0x0a41('0x48')](db[_0x0a41('0x40')][_0x0a41('0x2f')]);_0x3d31a2['attributes']=_[_0x0a41('0x36')](_0x51f3e5['model'],qs[_0x0a41('0x38')](_0x8360da[_0x0a41('0x37')][_0x0a41('0x38')]));_0x3d31a2[_0x0a41('0x39')]=_0x3d31a2[_0x0a41('0x39')]['length']?_0x3d31a2[_0x0a41('0x39')]:_0x51f3e5[_0x0a41('0x33')];if(_0x8360da['query'][_0x0a41('0x41')]){_0x3d31a2['include']=[{'all':!![]}];}_0x3d31a2=_[_0x0a41('0x3e')]({},_0x3d31a2,_0x8360da[_0x0a41('0x4b')]);return db[_0x0a41('0x40')]['find'](_0x3d31a2)['then'](handleEntityNotFound(_0x18ac99,null))['then'](function(_0xa98666){if(_0xa98666){var _0x5687c0=_0xa98666['get']({'plain':!![]});_0x5687c0=qs[_0x0a41('0x4c')](_0x5687c0,['id','createdAt',_0x0a41('0x4d')]);_0x8360da[_0x0a41('0x4e')]=_[_0x0a41('0x4c')](_0x8360da[_0x0a41('0x4e')],['id',_0x0a41('0x4f'),_0x0a41('0x4d')]);return db[_0x0a41('0x40')][_0x0a41('0x50')](_['merge'](_0x5687c0,_0x8360da[_0x0a41('0x4e')]),{'include':_0x8360da['query'][_0x0a41('0x41')]?[{'all':!![]}]:undefined});}})[_0x0a41('0x29')](respondWithResult(_0x18ac99,0xc9))[_0x0a41('0x45')](handleError(_0x18ac99,null));};exports[_0x0a41('0x28')]=function(_0x3c16ac,_0x435610){if(_0x3c16ac[_0x0a41('0x4e')]['id']){delete _0x3c16ac[_0x0a41('0x4e')]['id'];}return db['Attachment'][_0x0a41('0x49')]({'where':{'id':_0x3c16ac[_0x0a41('0x47')]['id']}})[_0x0a41('0x29')](handleEntityNotFound(_0x435610,null))[_0x0a41('0x29')](saveUpdates(_0x3c16ac[_0x0a41('0x4e')],null))[_0x0a41('0x29')](respondWithResult(_0x435610,null))[_0x0a41('0x45')](handleError(_0x435610,null));};exports[_0x0a41('0x2a')]=function(_0x3ba400,_0xf371a3){return db[_0x0a41('0x40')][_0x0a41('0x49')]({'where':{'id':_0x3ba400[_0x0a41('0x47')]['id']}})['then'](handleEntityNotFound(_0xf371a3,null))[_0x0a41('0x29')](removeEntity(_0xf371a3,null))[_0x0a41('0x45')](handleError(_0xf371a3,null));};exports[_0x0a41('0x50')]=function(_0x206791,_0x2ad972,_0x5c724b){_0x206791[_0x0a41('0x4e')]['name']=_0x206791[_0x0a41('0x51')]['originalname'];_0x206791[_0x0a41('0x4e')][_0x0a41('0x52')]=_0x206791[_0x0a41('0x51')][_0x0a41('0x53')];_0x206791[_0x0a41('0x4e')]['type']=_0x206791[_0x0a41('0x51')][_0x0a41('0x54')];return db[_0x0a41('0x40')][_0x0a41('0x50')](_0x206791[_0x0a41('0x4e')])[_0x0a41('0x29')](respondWithResult(_0x2ad972,0xc9))[_0x0a41('0x45')](handleError(_0x2ad972,null));};exports[_0x0a41('0x55')]=function(_0x3fb9c3,_0x18e947,_0x22020b){return db[_0x0a41('0x40')][_0x0a41('0x56')]({'where':{'id':_0x3fb9c3[_0x0a41('0x47')]['id']},'raw':!![]})[_0x0a41('0x29')](handleEntityNotFound(_0x18e947,null))[_0x0a41('0x29')](function(_0xbc9761){if(_0xbc9761){var _0x4156ad=_0xbc9761[_0x0a41('0x57')]!==null;var _0x452150=path[_0x0a41('0x58')](config[_0x0a41('0x59')],_0x0a41('0x5a'));if(_0x4156ad){_0x452150=path['join'](_0x452150,'offline-chat/');}var _0x2c6ae9=path[_0x0a41('0x58')](_0x452150,_0xbc9761[_0x0a41('0x52')]);return _0x18e947[_0x0a41('0x55')](_0x2c6ae9);}})[_0x0a41('0x45')](handleError(_0x18e947,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 72df8e6..6eff7c1 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 _0x0d33=['rimraf','./attachment.attributes','exports','attachments','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x0d33,0x159));var _0x30d3=function(_0x3b7e6f,_0x1565b5){_0x3b7e6f=_0x3b7e6f-0x0;var _0x4873c3=_0x0d33[_0x3b7e6f];return _0x4873c3;};'use strict';var _=require(_0x30d3('0x0'));var util=require(_0x30d3('0x1'));var logger=require(_0x30d3('0x2'))(_0x30d3('0x3'));var moment=require(_0x30d3('0x4'));var BPromise=require(_0x30d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d3('0x6'));var rimraf=require(_0x30d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x30d3('0x8'));module[_0x30d3('0x9')]=function(_0x5e419b,_0x360246){return _0x5e419b['define']('Attachment',attributes,{'tableName':_0x30d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85c2=['util','../../config/logger','bluebird','request-promise','path','rimraf','exports','Attachment','attachments','lodash'];(function(_0x71af84,_0x5f514d){var _0x1d550d=function(_0x17f9f4){while(--_0x17f9f4){_0x71af84['push'](_0x71af84['shift']());}};_0x1d550d(++_0x5f514d);}(_0x85c2,0x77));var _0x285c=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x85c2[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x285c('0x0'));var util=require(_0x285c('0x1'));var logger=require(_0x285c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x285c('0x3'));var rp=require(_0x285c('0x4'));var fs=require('fs');var path=require(_0x285c('0x5'));var rimraf=require(_0x285c('0x6'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x285c('0x7')]=function(_0x342d60,_0x191e62){return _0x342d60['define'](_0x285c('0x8'),attributes,{'tableName':_0x285c('0x9'),'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 fa064af..46b0d58 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 _0x4a47=['debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','Attachment,\x20%s,\x20%s','result','catch','CreateAttachment','Attachment','create','options','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0xca9418,_0x13825d){var _0x2b7ab2=function(_0x4ccd0f){while(--_0x4ccd0f){_0xca9418['push'](_0xca9418['shift']());}};_0x2b7ab2(++_0x13825d);}(_0x4a47,0xb5));var _0x74a4=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0x4a47[_0x3452eb];return _0x4244fd;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require(_0x74a4('0x2'));var BPromise=require(_0x74a4('0x3'));var rs=require(_0x74a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x6'))(_0x74a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x8'));var client=jayson[_0x74a4('0x9')][_0x74a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebaa6,_0x41ef5a,_0x55e8a1){return new BPromise(function(_0x3122ba,_0x58e307){return client[_0x74a4('0xb')](_0x4ebaa6,_0x55e8a1)[_0x74a4('0xc')](function(_0x19f82b){logger[_0x74a4('0xd')]('Attachment,\x20%s,\x20%s',_0x41ef5a,_0x74a4('0xe'));logger[_0x74a4('0xf')](_0x74a4('0x10'),_0x41ef5a,_0x74a4('0xe'),JSON['stringify'](_0x19f82b));if(_0x19f82b[_0x74a4('0x11')]){if(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x12')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x58e307(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x3122ba(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}else{logger[_0x74a4('0xd')](_0x74a4('0x14'),_0x41ef5a,_0x74a4('0xe'));_0x3122ba(_0x19f82b[_0x74a4('0x15')][_0x74a4('0x13')]);}})[_0x74a4('0x16')](function(_0x5d6dad){logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x5d6dad);_0x58e307(_0x5d6dad);});});}exports[_0x74a4('0x17')]=function(_0x2c9130){var _0x55cf53=this;return new Promise(function(_0xf224ef,_0x105998){return db[_0x74a4('0x18')][_0x74a4('0x19')](_0x2c9130['body'],{'raw':_0x2c9130[_0x74a4('0x1a')]?_0x2c9130[_0x74a4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x74a4('0xc')](function(_0x2d3075){logger['info']('CreateAttachment',_0x2c9130);logger[_0x74a4('0xf')](_0x74a4('0x17'),_0x2c9130,JSON[_0x74a4('0x1b')](_0x2d3075));_0xf224ef(_0x2d3075);})[_0x74a4('0x16')](function(_0x484802){logger[_0x74a4('0x11')]('CreateAttachment',_0x484802['message'],_0x2c9130);_0x105998(_0x55cf53[_0x74a4('0x11')](0x1f4,_0x484802[_0x74a4('0x13')]));});});}; \ No newline at end of file +var _0xe9ad=['Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Attachment','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x453695,_0x5d23de){var _0x26b944=function(_0x508765){while(--_0x508765){_0x453695['push'](_0x453695['shift']());}};_0x26b944(++_0x5d23de);}(_0xe9ad,0x82));var _0xde9a=function(_0x114efe,_0x29836c){_0x114efe=_0x114efe-0x0;var _0x1d46ed=_0xe9ad[_0x114efe];return _0x1d46ed;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var moment=require(_0xde9a('0x2'));var BPromise=require(_0xde9a('0x3'));var rs=require(_0xde9a('0x4'));var fs=require('fs');var Redis=require(_0xde9a('0x5'));var db=require(_0xde9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xde9a('0x7'))(_0xde9a('0x8'));var config=require(_0xde9a('0x9'));var jayson=require(_0xde9a('0xa'));var client=jayson['client'][_0xde9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb666,_0xd47b9c,_0x5d4412){return new BPromise(function(_0x45d4a7,_0x17f89b){return client[_0xde9a('0xc')](_0x2bb666,_0x5d4412)[_0xde9a('0xd')](function(_0x297975){logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));logger[_0xde9a('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0xd47b9c,_0xde9a('0x10'),JSON[_0xde9a('0x12')](_0x297975));if(_0x297975[_0xde9a('0x13')]){if(_0x297975[_0xde9a('0x13')][_0xde9a('0x14')]===0x1f4){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x17f89b(_0x297975['error'][_0xde9a('0x15')]);}logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);return _0x45d4a7(_0x297975[_0xde9a('0x13')][_0xde9a('0x15')]);}else{logger[_0xde9a('0xe')](_0xde9a('0xf'),_0xd47b9c,_0xde9a('0x10'));_0x45d4a7(_0x297975[_0xde9a('0x16')][_0xde9a('0x15')]);}})[_0xde9a('0x17')](function(_0x39e1d0){logger[_0xde9a('0x13')](_0xde9a('0xf'),_0xd47b9c,_0x39e1d0);_0x17f89b(_0x39e1d0);});});}exports['CreateAttachment']=function(_0x12ba7f){var _0x2714a9=this;return new Promise(function(_0x3b89ef,_0x57613b){return db[_0xde9a('0x18')]['create'](_0x12ba7f[_0xde9a('0x19')],{'raw':_0x12ba7f['options']?_0x12ba7f[_0xde9a('0x1a')][_0xde9a('0x1b')]===undefined?!![]:![]:!![]})[_0xde9a('0xd')](function(_0x4add81){logger[_0xde9a('0xe')](_0xde9a('0x1c'),_0x12ba7f);logger['debug']('CreateAttachment',_0x12ba7f,JSON[_0xde9a('0x12')](_0x4add81));_0x3b89ef(_0x4add81);})[_0xde9a('0x17')](function(_0x56550b){logger[_0xde9a('0x13')](_0xde9a('0x1c'),_0x56550b[_0xde9a('0x15')],_0x12ba7f);_0x57613b(_0x2714a9[_0xde9a('0x13')](0x1f4,_0x56550b[_0xde9a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f1ff497..f9e1939 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 _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x5c3ff9,_0x5536bd){var _0x3a72d3=function(_0x3214b0){while(--_0x3214b0){_0x5c3ff9['push'](_0x5c3ff9['shift']());}};_0x3a72d3(++_0x5536bd);}(_0x757a,0xde));var _0xa757=function(_0x2d42fc,_0x21a024){_0x2d42fc=_0x2d42fc-0x0;var _0x2b6712=_0x757a[_0x2d42fc];return _0x2b6712;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x2f7b0a,_0x5bd99c){var _0x8294db=function(_0x397f1c){while(--_0x397f1c){_0x2f7b0a['push'](_0x2f7b0a['shift']());}};_0x8294db(++_0x5bd99c);}(_0xb10b,0x12a));var _0xbb10=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0xb10b[_0x52b91f];return _0x15f8f5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 214a5ac..c3deac3 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 _0xcc66=['disabled','blocked','blockedAt','online','user','agent','minutes','clearBlockUser','getLicense','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','../../config/logger','api','activedirectory','undefined','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled','findOne','name','password','salt'];(function(_0x4fa969,_0x21bf85){var _0x2ebba5=function(_0x487ae0){while(--_0x487ae0){_0x4fa969['push'](_0x4fa969['shift']());}};_0x2ebba5(++_0x21bf85);}(_0xcc66,0x1f4));var _0x6cc6=function(_0xaa8fca,_0x1044ef){_0xaa8fca=_0xaa8fca-0x0;var _0x20d459=_0xcc66[_0xaa8fca];return _0x20d459;};'use strict';var passport=require(_0x6cc6('0x0'));var LocalStrategy=require(_0x6cc6('0x1'))[_0x6cc6('0x2')];var moment=require(_0x6cc6('0x3'));var ActiveDirectory=require(_0x6cc6('0x4'));var BPromise=require(_0x6cc6('0x5'));var util=require(_0x6cc6('0x6'));var db=require(_0x6cc6('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x6cc6('0x8'));var logger=require(_0x6cc6('0x9'))(_0x6cc6('0xa'));function isActiveDirectoryConfigured(_0x3cb107){var _0x586a8b=![];if(typeof _0x3cb107[_0x6cc6('0xb')]!==_0x6cc6('0xc')){_0x586a8b=_0x3cb107['activedirectory']['baseDN']&&_0x3cb107[_0x6cc6('0xb')]['url']&&_0x3cb107[_0x6cc6('0xb')]['domain'];}return _0x586a8b;}function adAuthenticate(_0xafdf82,_0x32615c,_0x5a3faf){return new BPromise(function(_0x4e7f5b,_0x3e9a0a){try{var _0x3a1236=new ActiveDirectory(_0xafdf82);_0x3a1236[_0x6cc6('0xd')](_0x32615c,_0x5a3faf,function(_0x4b7237,_0x41cbee){if(_0x4b7237){logger['error'](_0x6cc6('0xe'),_0x32615c,util[_0x6cc6('0xf')](_0x4b7237,{'showHidden':![],'depth':null}));_0x3e9a0a(_0x6cc6('0x10'));}else if(!_0x41cbee){logger['error'](_0x6cc6('0x11'),_0x32615c);_0x3e9a0a(_0x6cc6('0x10'));}else{_0x4e7f5b(_0x41cbee);}});}catch(_0x1f2981){_0x3e9a0a(_0x1f2981);}});}function ActiveDirectoryAuthenticate(_0x20a85c,_0x1f9dad,_0x47172e,_0x3ad593){var _0x137742,_0x38c6a8;if(!isActiveDirectoryConfigured(config)){logger[_0x6cc6('0x12')](_0x6cc6('0x13'),_0x1f9dad);return _0x3ad593(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x6cc6('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x6cc6('0x15')],'raw':!![]})[_0x6cc6('0x16')](function(_0x486043){_0x137742=_0x486043;if(!_0x137742[_0x6cc6('0x17')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1f9dad);throw new Error(_0x6cc6('0x10'));}return _0x20a85c[_0x6cc6('0x18')]({'attributes':['id',_0x6cc6('0x19'),_0x6cc6('0x1a'),_0x6cc6('0x1b'),'role',_0x6cc6('0x1c'),_0x6cc6('0x1d'),_0x6cc6('0x1e'),_0x6cc6('0x1f')],'where':{'name':_0x1f9dad,'role':{'$or':['admin',_0x6cc6('0x20'),_0x6cc6('0x21')]},'adSsoEnabled':!![]}});})[_0x6cc6('0x16')](function(_0x61580){if(!_0x61580||_0x61580&&_0x61580[_0x6cc6('0x19')]!==_0x1f9dad){throw new Error(_0x6cc6('0x10'));}_0x38c6a8=_0x61580;var _0x2ee714=_0x38c6a8['name']+'@'+config[_0x6cc6('0xb')]['domain'];return adAuthenticate(config[_0x6cc6('0xb')],_0x2ee714,_0x47172e);})[_0x6cc6('0x16')](function(_0x144c5d){if(_0x38c6a8[_0x6cc6('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x137742['blockDuration']>0x0){if(_0x38c6a8['blocked']){if(moment(_0x38c6a8[_0x6cc6('0x1e')])['add'](_0x137742[_0x6cc6('0x15')],_0x6cc6('0x22'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x6cc6('0x23')](_0x38c6a8,0x0,![],null)[_0x6cc6('0x16')](function(){return utils[_0x6cc6('0x24')](_0x38c6a8);})[_0x6cc6('0x16')](function(){return _0x3ad593(null,_0x38c6a8);});}else{return utils['getLicense'](_0x38c6a8)[_0x6cc6('0x16')](function(){return _0x3ad593(null,_0x38c6a8);});}}else{return utils['getLicense'](_0x38c6a8)['then'](function(){return _0x3ad593(null,_0x38c6a8);});}})['catch'](function(_0x380957){return _0x3ad593(null,![],_0x380957);});}function handleError(_0x24ebc1,_0x32544c,_0x45b657){return _0x24ebc1[_0x6cc6('0x25')](_0x32544c||0x1f4)['send']({'message':_0x45b657?_0x45b657[_0x6cc6('0x26')]||_0x45b657:''});}exports[_0x6cc6('0x27')]=function(_0x42f73d,_0x46c692,_0x4b3ef2){passport[_0x6cc6('0xd')](_0x6cc6('0x28'),function(_0xad9fe6,_0x18eb96,_0x1602cd){var _0x659b2=_0xad9fe6||_0x1602cd;if(_0x659b2){return handleError(_0x46c692,0x191,_0x659b2);}if(!_0x18eb96){return handleError(_0x46c692,0x194,{'message':_0x6cc6('0x29')});}else{var _0x4da2a7={'payload':{'id':_0x18eb96['id'],'role':_0x18eb96['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4da2a7)[_0x6cc6('0x16')](function(_0x5d2f84){_0x46c692['json']({'id':_0x18eb96['id'],'token':_0x5d2f84,'statusCall':'','isAlreadyLogged':_0x18eb96['online']});});}})(_0x42f73d,_0x46c692,_0x4b3ef2);};passport[_0x6cc6('0x2a')](_0x6cc6('0x28'),new LocalStrategy({'usernameField':_0x6cc6('0x19'),'passwordField':_0x6cc6('0x1a')},function(_0xc5724,_0x562bc3,_0x3ce9ee){return ActiveDirectoryAuthenticate(db[_0x6cc6('0x2b')],_0xc5724,_0x562bc3,_0x3ce9ee);})); \ No newline at end of file +var _0x544f=['online','use','ad-login','User','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','name','password','role','disabled','blocked','blockedAt','admin','user','then','add','clearBlockUser','getLicense','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x5ac60c,_0x437c16){var _0x10692a=function(_0x3e1937){while(--_0x3e1937){_0x5ac60c['push'](_0x5ac60c['shift']());}};_0x10692a(++_0x437c16);}(_0x544f,0xbc));var _0xf544=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x544f[_0x29d94e];return _0x106237;};'use strict';var passport=require(_0xf544('0x0'));var LocalStrategy=require(_0xf544('0x1'))[_0xf544('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xf544('0x3'));var BPromise=require(_0xf544('0x4'));var util=require(_0xf544('0x5'));var db=require(_0xf544('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xf544('0x7'));var logger=require(_0xf544('0x8'))(_0xf544('0x9'));function isActiveDirectoryConfigured(_0x1b93c3){var _0x57ff7a=![];if(typeof _0x1b93c3[_0xf544('0xa')]!==_0xf544('0xb')){_0x57ff7a=_0x1b93c3['activedirectory'][_0xf544('0xc')]&&_0x1b93c3[_0xf544('0xa')]['url']&&_0x1b93c3[_0xf544('0xa')][_0xf544('0xd')];}return _0x57ff7a;}function adAuthenticate(_0x547c94,_0x591db2,_0x4f9ff0){return new BPromise(function(_0x15d603,_0x43a691){try{var _0x28ec8e=new ActiveDirectory(_0x547c94);_0x28ec8e[_0xf544('0xe')](_0x591db2,_0x4f9ff0,function(_0x55ffe1,_0x597d8d){if(_0x55ffe1){logger[_0xf544('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x591db2,util[_0xf544('0x10')](_0x55ffe1,{'showHidden':![],'depth':null}));_0x43a691('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x597d8d){logger[_0xf544('0xf')](_0xf544('0x11'),_0x591db2);_0x43a691(_0xf544('0x12'));}else{_0x15d603(_0x597d8d);}});}catch(_0xb4e95f){_0x43a691(_0xb4e95f);}});}function ActiveDirectoryAuthenticate(_0x13f2b7,_0x240f07,_0x415c48,_0x1ef0fd){var _0x1e1844,_0x2b14e6;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xf544('0x13'),_0x240f07);return _0x1ef0fd(null,![],{'message':_0xf544('0x12')});}return db['Setting'][_0xf544('0x14')]({'where':{'id':0x1},'attributes':[_0xf544('0x15'),_0xf544('0x16')],'raw':!![]})['then'](function(_0x5aee58){_0x1e1844=_0x5aee58;if(!_0x1e1844[_0xf544('0x15')]){logger[_0xf544('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x240f07);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x13f2b7['findOne']({'attributes':['id',_0xf544('0x17'),_0xf544('0x18'),'salt',_0xf544('0x19'),_0xf544('0x1a'),_0xf544('0x1b'),_0xf544('0x1c'),'online'],'where':{'name':_0x240f07,'role':{'$or':[_0xf544('0x1d'),_0xf544('0x1e'),'agent']},'adSsoEnabled':!![]}});})[_0xf544('0x1f')](function(_0x389223){if(!_0x389223||_0x389223&&_0x389223['name']!==_0x240f07){throw new Error(_0xf544('0x12'));}_0x2b14e6=_0x389223;var _0xb01c23=_0x2b14e6[_0xf544('0x17')]+'@'+config[_0xf544('0xa')]['domain'];return adAuthenticate(config[_0xf544('0xa')],_0xb01c23,_0x415c48);})[_0xf544('0x1f')](function(_0x19e5d7){if(_0x2b14e6[_0xf544('0x1a')]){throw new Error(_0xf544('0x12'));}if(_0x1e1844[_0xf544('0x16')]>0x0){if(_0x2b14e6['blocked']){if(moment(_0x2b14e6[_0xf544('0x1c')])[_0xf544('0x20')](_0x1e1844[_0xf544('0x16')],'minutes')>moment()){throw new Error(_0xf544('0x12'));}return utils[_0xf544('0x21')](_0x2b14e6,0x0,![],null)[_0xf544('0x1f')](function(){return utils['getLicense'](_0x2b14e6);})[_0xf544('0x1f')](function(){return _0x1ef0fd(null,_0x2b14e6);});}else{return utils['getLicense'](_0x2b14e6)[_0xf544('0x1f')](function(){return _0x1ef0fd(null,_0x2b14e6);});}}else{return utils[_0xf544('0x22')](_0x2b14e6)[_0xf544('0x1f')](function(){return _0x1ef0fd(null,_0x2b14e6);});}})['catch'](function(_0x40a14b){return _0x1ef0fd(null,![],_0x40a14b);});}function handleError(_0x4becef,_0x40c35e,_0x4c8728){return _0x4becef[_0xf544('0x23')](_0x40c35e||0x1f4)[_0xf544('0x24')]({'message':_0x4c8728?_0x4c8728[_0xf544('0x25')]||_0x4c8728:''});}exports[_0xf544('0x26')]=function(_0x56a7f2,_0x1495aa,_0x455b67){passport[_0xf544('0xe')]('ad-login',function(_0x19f60e,_0x4c38c3,_0x233c39){var _0x21c20c=_0x19f60e||_0x233c39;if(_0x21c20c){return handleError(_0x1495aa,0x191,_0x21c20c);}if(!_0x4c38c3){return handleError(_0x1495aa,0x194,{'message':_0xf544('0x27')});}else{var _0xfd1308={'payload':{'id':_0x4c38c3['id'],'role':_0x4c38c3[_0xf544('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0xf544('0x28')](_0xfd1308)['then'](function(_0xb4aaa3){_0x1495aa[_0xf544('0x29')]({'id':_0x4c38c3['id'],'token':_0xb4aaa3,'statusCall':'','isAlreadyLogged':_0x4c38c3[_0xf544('0x2a')]});});}})(_0x56a7f2,_0x1495aa,_0x455b67);};passport[_0xf544('0x2b')](_0xf544('0x2c'),new LocalStrategy({'usernameField':_0xf544('0x17'),'passwordField':'password'},function(_0x398374,_0xe2ff09,_0x46c7de){return ActiveDirectoryAuthenticate(db[_0xf544('0x2d')],_0x398374,_0xe2ff09,_0x46c7de);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4c9e448..37376e4 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 _0xd696=['Router','./authActiveDirectory.controller','post','login'];(function(_0x1a8882,_0x7b0f4b){var _0x599a51=function(_0x57b0d4){while(--_0x57b0d4){_0x1a8882['push'](_0x1a8882['shift']());}};_0x599a51(++_0x7b0f4b);}(_0xd696,0x10c));var _0x6d69=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0xd696[_0x45862f];return _0x35b20b;};'use strict';var express=require('express');var router=express[_0x6d69('0x0')]();var controller=require(_0x6d69('0x1'));router[_0x6d69('0x2')]('/',controller[_0x6d69('0x3')]);module['exports']=router; \ No newline at end of file +var _0xd3f0=['exports','express','Router','./authActiveDirectory.controller','login'];(function(_0x10766c,_0x488946){var _0x277a88=function(_0x3294f6){while(--_0x3294f6){_0x10766c['push'](_0x10766c['shift']());}};_0x277a88(++_0x488946);}(_0xd3f0,0xa6));var _0x0d3f=function(_0x18c3c0,_0x3aada9){_0x18c3c0=_0x18c3c0-0x0;var _0x37b4f5=_0xd3f0[_0x18c3c0];return _0x37b4f5;};'use strict';var express=require(_0x0d3f('0x0'));var router=express[_0x0d3f('0x1')]();var controller=require(_0x0d3f('0x2'));router['post']('/',controller[_0x0d3f('0x3')]);module[_0x0d3f('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3dd0cb3..e7c25ca 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(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7a54,0x106));var _0x47a5=function(_0x31005c,_0x113bde){_0x31005c=_0x31005c-0x0;var _0x5e1f9d=_0x7a54[_0x31005c];return _0x5e1f9d;};'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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7a54,0x106));var _0x47a5=function(_0x12bab6,_0x3f2e71){_0x12bab6=_0x12bab6-0x0;var _0x1dc1d7=_0x7a54[_0x12bab6];return _0x1dc1d7;};'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 c5197ef..8c6ac54 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 _0x5577=['get','login','/callback','callback','setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5577,0x1b4));var _0x7557=function(_0x3fd6d7,_0x5391a9){_0x3fd6d7=_0x3fd6d7-0x0;var _0x5a323f=_0x5577[_0x3fd6d7];return _0x5a323f;};'use strict';var express=require(_0x7557('0x0'));var passport=require('passport');var router=express[_0x7557('0x1')]();var controller=require(_0x7557('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x7557('0x3'));router[_0x7557('0x4')]('/',controller[_0x7557('0x5')]);router[_0x7557('0x4')](_0x7557('0x6'),controller[_0x7557('0x7')],authService['isMiddleware'],userController[_0x7557('0x5')],authService[_0x7557('0x8')]);module[_0x7557('0x9')]=router; \ No newline at end of file +var _0xd8a1=['isMiddleware','setTokenCookie','passport','Router','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x1d6b61,_0x5842fa){var _0x290a2b=function(_0x4be489){while(--_0x4be489){_0x1d6b61['push'](_0x1d6b61['shift']());}};_0x290a2b(++_0x5842fa);}(_0xd8a1,0x174));var _0x1d8a=function(_0xcedc33,_0x2949cc){_0xcedc33=_0xcedc33-0x0;var _0x49c3c7=_0xd8a1[_0xcedc33];return _0x49c3c7;};'use strict';var express=require('express');var passport=require(_0x1d8a('0x0'));var router=express[_0x1d8a('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x1d8a('0x2'));var authService=require(_0x1d8a('0x3'));router[_0x1d8a('0x4')]('/',controller[_0x1d8a('0x5')]);router[_0x1d8a('0x4')](_0x1d8a('0x6'),controller[_0x1d8a('0x7')],authService[_0x1d8a('0x8')],userController['login'],authService[_0x1d8a('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index e63cd54..37903e8 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 _0x3f15=['trim','User','This\x20email\x20is\x20not\x20registered.','resetPasswordExpires','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','save','use','util','passport','passport-local','lodash','randomstring','moment','../../config/utils','client','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','generate'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3f15,0xb1));var _0x53f1=function(_0x5db5e6,_0x105f6e){_0x5db5e6=_0x5db5e6-0x0;var _0x1adadd=_0x3f15[_0x5db5e6];return _0x1adadd;};'use strict';var util=require(_0x53f1('0x0'));var passport=require(_0x53f1('0x1'));var LocalStrategy=require(_0x53f1('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x53f1('0x3'));var rs=require(_0x53f1('0x4'));var moment=require(_0x53f1('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x53f1('0x6'));var client=jayson[_0x53f1('0x7')][_0x53f1('0x8')]({'port':0x232b});function localAuthenticate(_0x35e36f,_0x5f2317,_0x1f536e,_0x15dd6b){var _0x2f29e1,_0x1bc198;return db[_0x53f1('0x9')][_0x53f1('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x53f1('0xb')](function(_0x524ac4){_0x2f29e1=_0x524ac4;return _0x35e36f[_0x53f1('0xa')]({'attributes':['id',_0x53f1('0xc'),_0x53f1('0xd'),_0x53f1('0xe'),_0x53f1('0xf'),_0x53f1('0x10'),_0x53f1('0x11'),_0x53f1('0x12'),_0x53f1('0x13')],'where':{'name':_0x5f2317,'role':{'$or':[_0x53f1('0x14'),_0x53f1('0x15'),_0x53f1('0x16')]}}});})[_0x53f1('0xb')](function(_0x1cac16){if(!_0x1cac16||_0x1cac16&&_0x1cac16[_0x53f1('0xc')]!==_0x5f2317){throw new Error(_0x53f1('0x17'));}else{_0x1bc198=_0x1cac16;return _0x1bc198;}})[_0x53f1('0xb')](function(){_0x1bc198['authenticate'](_0x1f536e,function(_0x534b9c,_0x807f67){var _0x1ee04f=_0x1bc198[_0x53f1('0x13')]+0x1;if(_0x534b9c){return _0x15dd6b(_0x534b9c);}else if(!_0x807f67){if(_0x1bc198[_0x53f1('0x10')]){return _0x15dd6b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2f29e1[_0x53f1('0x18')]>0x0){if(_0x1bc198[_0x53f1('0x11')]){if(_0x2f29e1[_0x53f1('0x19')]>0x0){if(moment(_0x1bc198[_0x53f1('0x12')])[_0x53f1('0x1a')](_0x2f29e1[_0x53f1('0x19')],_0x53f1('0x1b'))>moment()){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}else{return utils[_0x53f1('0x1c')](_0x1bc198,_0x1ee04f,![],null)['then'](function(){return _0x15dd6b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}}else{if(_0x1ee04f>=_0x2f29e1[_0x53f1('0x18')]){return utils[_0x53f1('0x1c')](_0x1bc198,0x0,!![],moment())['then'](function(){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});});}else{return utils[_0x53f1('0x1c')](_0x1bc198,_0x1ee04f,![],null)[_0x53f1('0xb')](function(){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});});}}}else{return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}}else{if(_0x1bc198['disabled']){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}else if(_0x2f29e1[_0x53f1('0x18')]>0x0){if(_0x1bc198['blocked']){if(_0x2f29e1[_0x53f1('0x19')]>0x0){if(moment(_0x1bc198[_0x53f1('0x12')])[_0x53f1('0x1a')](_0x2f29e1[_0x53f1('0x19')],_0x53f1('0x1b'))>moment()){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}else{return utils['clearBlockUser'](_0x1bc198,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1bc198);})[_0x53f1('0xb')](function(){return _0x15dd6b(null,_0x1bc198);});}}else{return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}}else{return utils['clearBlockUser'](_0x1bc198,0x0,![],null)[_0x53f1('0xb')](function(){return utils[_0x53f1('0x1d')](_0x1bc198);})[_0x53f1('0xb')](function(){return _0x15dd6b(null,_0x1bc198);})[_0x53f1('0x1e')](function(_0x4e06bf){return _0x15dd6b(null,![],_0x4e06bf);});}}else{if(_0x1bc198[_0x53f1('0x11')]){return _0x15dd6b(null,![],{'message':_0x53f1('0x17')});}else{return utils[_0x53f1('0x1d')](_0x1bc198)[_0x53f1('0xb')](function(){return _0x15dd6b(null,_0x1bc198);});}}}});})[_0x53f1('0x1e')](function(_0x47679a){return _0x15dd6b(null,![],_0x47679a);});}function sendServiceMail(_0x156bd7){return db[_0x53f1('0x1f')][_0x53f1('0x20')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x53f1('0x21')}]}]})[_0x53f1('0xb')](function(_0x67eeca){if(!_0x67eeca){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1bff26=_0x67eeca[_0x53f1('0x22')]();var _0xf9ea0c={'account':_0x1bff26,'message':_[_0x53f1('0x23')]({'from':util[_0x53f1('0x24')](_0x53f1('0x25'),_0x67eeca[_0x53f1('0xc')],_0x67eeca[_0x53f1('0x26')]||_0x67eeca[_0x53f1('0x27')][_0x53f1('0x15')])},_0x156bd7)};return client['request'](_0x53f1('0x28'),_0xf9ea0c);})['then'](function(_0x8532ed){if(_0x8532ed[_0x53f1('0x29')]){throw new Error(util[_0x53f1('0x24')](_0x53f1('0x2a'),_0x8532ed[_0x53f1('0x29')][_0x53f1('0x2b')]||JSON[_0x53f1('0x2c')](_0x8532ed[_0x53f1('0x29')])));}return!![];});}function handleError(_0x14215a,_0x141835,_0x3bf0a1){return _0x14215a[_0x53f1('0x2d')](_0x141835||0x1f4)[_0x53f1('0x2e')]({'message':_0x3bf0a1?_0x3bf0a1[_0x53f1('0x2b')]||_0x3bf0a1:''});}exports['login']=function(_0x47e826,_0x1663a7,_0x282697){passport[_0x53f1('0x2f')]('local-login',function(_0x5a5b6a,_0x5064ab,_0x42c062){var _0x32e48d=_0x5a5b6a||_0x42c062;if(_0x32e48d){return handleError(_0x1663a7,0x191,_0x32e48d);}if(!_0x5064ab){return handleError(_0x1663a7,0x194,{'message':_0x53f1('0x30')});}else{var _0x40c99e={'payload':{'id':_0x5064ab['id'],'role':_0x5064ab['role']},'options':{'expiresIn':0x15180}};return authService[_0x53f1('0x31')](_0x40c99e)['then'](function(_0x4ecce1){_0x1663a7['json']({'id':_0x5064ab['id'],'token':_0x4ecce1,'statusCall':'','isAlreadyLogged':_0x5064ab[_0x53f1('0x32')]});});}})(_0x47e826,_0x1663a7,_0x282697);};exports[_0x53f1('0x33')]=function(_0x28cfec,_0x18738d){if(!_0x28cfec[_0x53f1('0x34')][_0x53f1('0x26')]){return handleError(_0x18738d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xa7167f=rs[_0x53f1('0x35')]();_0x28cfec[_0x53f1('0x34')][_0x53f1('0x26')]=_0x28cfec[_0x53f1('0x34')][_0x53f1('0x26')][_0x53f1('0x36')]()['toLowerCase']();var _0x5a127e;return db['Setting'][_0x53f1('0xa')]({'where':{'id':0x1},'attributes':[_0x53f1('0x18'),_0x53f1('0x19')],'raw':!![]})[_0x53f1('0xb')](function(_0xa1f0df){_0x5a127e=_0xa1f0df;return db[_0x53f1('0x37')][_0x53f1('0x20')]({'where':{'email':_0x28cfec['body'][_0x53f1('0x26')]}});})['then'](function(_0x299453){if(!_0x299453){throw new Error(_0x53f1('0x38'));}if(_0x299453['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x299453[_0x53f1('0x11')]){if(moment(_0x299453['blockedAt'])[_0x53f1('0x1a')](_0x5a127e[_0x53f1('0x19')],_0x53f1('0x1b'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x299453[_0x53f1('0x11')]=![];_0x299453[_0x53f1('0x12')]=null;}}_0x299453['resetPasswordToken']=_0xa7167f;_0x299453[_0x53f1('0x39')]=Date['now']()+0x36ee80;return _0x299453['save']();})[_0x53f1('0xb')](function(){return sendServiceMail({'to':_0x28cfec['body'][_0x53f1('0x26')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x53f1('0x3a')+_0x53f1('0x3b')+'https://'+_0x28cfec[_0x53f1('0x3c')][_0x53f1('0x3d')]+_0x53f1('0x3e')+_0xa7167f+'\x0a\x0a'+_0x53f1('0x3f')});})[_0x53f1('0xb')](function(){_0x18738d[_0x53f1('0x2d')](0xc8)[_0x53f1('0x2e')]({'message':_0x53f1('0x40')});})[_0x53f1('0x1e')](function(_0x5a38ee){return handleError(_0x18738d,0x1f4,_0x5a38ee);});};exports[_0x53f1('0x41')]=function(_0x1cb712,_0x155399){return db['User'][_0x53f1('0x20')]({'where':{'resetPasswordToken':_0x1cb712[_0x53f1('0x42')][_0x53f1('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3c3a48){if(!_0x3c3a48){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0x53f1('0x44'),_0x53f1('0x45'),_0x53f1('0x46')]})[_0x53f1('0xb')](function(_0xa6f722){if(_0xa6f722['securePassword'])authService[_0x53f1('0x47')](_0x1cb712[_0x53f1('0x34')][_0x53f1('0xd')]);if(!_0xa6f722[_0x53f1('0x45')]||!_0x3c3a48[_0x53f1('0x48')])return _0x3c3a48;authService[_0x53f1('0x49')](_0x1cb712[_0x53f1('0x34')][_0x53f1('0xd')],_0x3c3a48[_0x53f1('0x48')],_0xa6f722['passwordHistoryLimit']);return _0x3c3a48;})[_0x53f1('0xb')](function(){_0x3c3a48[_0x53f1('0xd')]=_0x1cb712[_0x53f1('0x34')][_0x53f1('0xd')];_0x3c3a48[_0x53f1('0x4a')]=null;_0x3c3a48[_0x53f1('0x39')]=null;return _0x3c3a48[_0x53f1('0x4b')]();});})[_0x53f1('0xb')](function(){_0x155399[_0x53f1('0x2d')](0xc8)[_0x53f1('0x2e')]({'message':'Password\x20reset!'});})[_0x53f1('0x1e')](function(_0x50f828){return handleError(_0x155399,0x1f4,_0x50f828);});};passport[_0x53f1('0x4c')]('local-login',new LocalStrategy({'usernameField':_0x53f1('0xc'),'passwordField':_0x53f1('0xd')},function(_0x335cb8,_0x41a229,_0x1cf7df){return localAuthenticate(db['User'],_0x335cb8,_0x41a229,_0x1cf7df);})); \ No newline at end of file +var _0xa666=['add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','\x22%s\x22\x20<%s>','email','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','User','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','minutes','clearBlockUser'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa666,0xd1));var _0x6a66=function(_0x5cf4ce,_0x2e9d93){_0x5cf4ce=_0x5cf4ce-0x0;var _0x2ee73f=_0xa666[_0x5cf4ce];return _0x2ee73f;};'use strict';var util=require(_0x6a66('0x0'));var passport=require('passport');var LocalStrategy=require(_0x6a66('0x1'))[_0x6a66('0x2')];var jayson=require(_0x6a66('0x3'));var _=require('lodash');var rs=require(_0x6a66('0x4'));var moment=require(_0x6a66('0x5'));var db=require(_0x6a66('0x6'))['db'];var authService=require(_0x6a66('0x7'));var utils=require(_0x6a66('0x8'));var client=jayson[_0x6a66('0x9')][_0x6a66('0xa')]({'port':0x232b});function localAuthenticate(_0x418303,_0x5a8ca7,_0x795d67,_0x4d9b52){var _0x1f2e0f,_0x1816fe;return db[_0x6a66('0xb')][_0x6a66('0xc')]({'where':{'id':0x1},'attributes':[_0x6a66('0xd'),_0x6a66('0xe')],'raw':!![]})[_0x6a66('0xf')](function(_0x50e112){_0x1f2e0f=_0x50e112;return _0x418303[_0x6a66('0xc')]({'attributes':['id',_0x6a66('0x10'),_0x6a66('0x11'),_0x6a66('0x12'),_0x6a66('0x13'),_0x6a66('0x14'),'blocked',_0x6a66('0x15'),'loginAttempts'],'where':{'name':_0x5a8ca7,'role':{'$or':[_0x6a66('0x16'),_0x6a66('0x17'),_0x6a66('0x18')]}}});})[_0x6a66('0xf')](function(_0x402ae2){if(!_0x402ae2||_0x402ae2&&_0x402ae2[_0x6a66('0x10')]!==_0x5a8ca7){throw new Error(_0x6a66('0x19'));}else{_0x1816fe=_0x402ae2;return _0x1816fe;}})[_0x6a66('0xf')](function(){_0x1816fe[_0x6a66('0x1a')](_0x795d67,function(_0x174458,_0x1450c6){var _0x3e0bdc=_0x1816fe[_0x6a66('0x1b')]+0x1;if(_0x174458){return _0x4d9b52(_0x174458);}else if(!_0x1450c6){if(_0x1816fe[_0x6a66('0x14')]){return _0x4d9b52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x1f2e0f[_0x6a66('0xd')]>0x0){if(_0x1816fe[_0x6a66('0x1c')]){if(_0x1f2e0f['blockDuration']>0x0){if(moment(_0x1816fe[_0x6a66('0x15')])['add'](_0x1f2e0f[_0x6a66('0xe')],_0x6a66('0x1d'))>moment()){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});}else{return utils[_0x6a66('0x1e')](_0x1816fe,_0x3e0bdc,![],null)[_0x6a66('0xf')](function(){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});});}}else{return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});}}else{if(_0x3e0bdc>=_0x1f2e0f[_0x6a66('0xd')]){return utils[_0x6a66('0x1e')](_0x1816fe,0x0,!![],moment())[_0x6a66('0xf')](function(){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});});}else{return utils[_0x6a66('0x1e')](_0x1816fe,_0x3e0bdc,![],null)[_0x6a66('0xf')](function(){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});});}}}else{return _0x4d9b52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1816fe['disabled']){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});}else if(_0x1f2e0f[_0x6a66('0xd')]>0x0){if(_0x1816fe['blocked']){if(_0x1f2e0f[_0x6a66('0xe')]>0x0){if(moment(_0x1816fe[_0x6a66('0x15')])[_0x6a66('0x1f')](_0x1f2e0f[_0x6a66('0xe')],_0x6a66('0x1d'))>moment()){return _0x4d9b52(null,![],{'message':_0x6a66('0x19')});}else{return utils[_0x6a66('0x1e')](_0x1816fe,0x0,![],null)[_0x6a66('0xf')](function(){return utils[_0x6a66('0x20')](_0x1816fe);})['then'](function(){return _0x4d9b52(null,_0x1816fe);});}}else{return _0x4d9b52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6a66('0x1e')](_0x1816fe,0x0,![],null)[_0x6a66('0xf')](function(){return utils[_0x6a66('0x20')](_0x1816fe);})[_0x6a66('0xf')](function(){return _0x4d9b52(null,_0x1816fe);})[_0x6a66('0x21')](function(_0xcb671c){return _0x4d9b52(null,![],_0xcb671c);});}}else{if(_0x1816fe['blocked']){return _0x4d9b52(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6a66('0x20')](_0x1816fe)[_0x6a66('0xf')](function(){return _0x4d9b52(null,_0x1816fe);});}}}});})[_0x6a66('0x21')](function(_0x4d13da){return _0x4d9b52(null,![],_0x4d13da);});}function sendServiceMail(_0x26a0a4){return db[_0x6a66('0x22')][_0x6a66('0x23')]({'where':{'service':!![]},'attributes':['id',_0x6a66('0x10'),'email'],'include':[{'model':db[_0x6a66('0x24')],'as':_0x6a66('0x25'),'include':[{'model':db[_0x6a66('0x26')],'as':_0x6a66('0x26')}]}]})[_0x6a66('0xf')](function(_0x2a67ef){if(!_0x2a67ef){throw new Error(_0x6a66('0x27'));}var _0x3ed8a1=_0x2a67ef['getSmtpOptions']();var _0x58d3de={'account':_0x3ed8a1,'message':_['merge']({'from':util['format'](_0x6a66('0x28'),_0x2a67ef[_0x6a66('0x10')],_0x2a67ef[_0x6a66('0x29')]||_0x2a67ef[_0x6a66('0x25')][_0x6a66('0x17')])},_0x26a0a4)};return client[_0x6a66('0x2a')](_0x6a66('0x2b'),_0x58d3de);})[_0x6a66('0xf')](function(_0x379298){if(_0x379298[_0x6a66('0x2c')]){throw new Error(util[_0x6a66('0x2d')](_0x6a66('0x2e'),_0x379298[_0x6a66('0x2c')][_0x6a66('0x2f')]||JSON[_0x6a66('0x30')](_0x379298[_0x6a66('0x2c')])));}return!![];});}function handleError(_0x1834cf,_0x5146fb,_0x2e1d86){return _0x1834cf[_0x6a66('0x31')](_0x5146fb||0x1f4)['send']({'message':_0x2e1d86?_0x2e1d86[_0x6a66('0x2f')]||_0x2e1d86:''});}exports[_0x6a66('0x32')]=function(_0x81d6bf,_0x114c3d,_0x40a75c){passport[_0x6a66('0x1a')](_0x6a66('0x33'),function(_0x4fc3ff,_0x3ccb05,_0x71cd94){var _0x2cc0cf=_0x4fc3ff||_0x71cd94;if(_0x2cc0cf){return handleError(_0x114c3d,0x191,_0x2cc0cf);}if(!_0x3ccb05){return handleError(_0x114c3d,0x194,{'message':_0x6a66('0x34')});}else{var _0x2206f6={'payload':{'id':_0x3ccb05['id'],'role':_0x3ccb05[_0x6a66('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0x6a66('0x35')](_0x2206f6)['then'](function(_0x2cd514){_0x114c3d[_0x6a66('0x36')]({'id':_0x3ccb05['id'],'token':_0x2cd514,'statusCall':'','isAlreadyLogged':_0x3ccb05['online']});});}})(_0x81d6bf,_0x114c3d,_0x40a75c);};exports[_0x6a66('0x37')]=function(_0x62287a,_0x27feb0){if(!_0x62287a[_0x6a66('0x38')][_0x6a66('0x29')]){return handleError(_0x27feb0,0x1f4,{'message':_0x6a66('0x39')});}var _0x1cb815=rs[_0x6a66('0x3a')]();_0x62287a[_0x6a66('0x38')]['email']=_0x62287a[_0x6a66('0x38')][_0x6a66('0x29')][_0x6a66('0x3b')]()[_0x6a66('0x3c')]();var _0x19e41f;return db['Setting'][_0x6a66('0xc')]({'where':{'id':0x1},'attributes':[_0x6a66('0xd'),'blockDuration'],'raw':!![]})[_0x6a66('0xf')](function(_0x33a123){_0x19e41f=_0x33a123;return db['User'][_0x6a66('0x23')]({'where':{'email':_0x62287a[_0x6a66('0x38')][_0x6a66('0x29')]}});})[_0x6a66('0xf')](function(_0x39bc27){if(!_0x39bc27){throw new Error(_0x6a66('0x3d'));}if(_0x39bc27[_0x6a66('0x14')]){throw new Error(_0x6a66('0x3e'));}if(_0x39bc27[_0x6a66('0x1c')]){if(moment(_0x39bc27[_0x6a66('0x15')])[_0x6a66('0x1f')](_0x19e41f[_0x6a66('0xe')],_0x6a66('0x1d'))>moment()){throw new Error(_0x6a66('0x3f'));}else{_0x39bc27[_0x6a66('0x1c')]=![];_0x39bc27[_0x6a66('0x15')]=null;}}_0x39bc27[_0x6a66('0x40')]=_0x1cb815;_0x39bc27[_0x6a66('0x41')]=Date['now']()+0x36ee80;return _0x39bc27[_0x6a66('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x62287a[_0x6a66('0x38')][_0x6a66('0x29')],'subject':'xCally\x20Motion\x20Password\x20Reset','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'+'https://'+_0x62287a['headers']['host']+_0x6a66('0x43')+_0x1cb815+'\x0a\x0a'+_0x6a66('0x44')});})[_0x6a66('0xf')](function(){_0x27feb0[_0x6a66('0x31')](0xc8)[_0x6a66('0x45')]({'message':'Reset\x20Email\x20sent!'});})[_0x6a66('0x21')](function(_0x1753c0){return handleError(_0x27feb0,0x1f4,_0x1753c0);});};exports['reset']=function(_0x59f903,_0x4a6cd2){return db[_0x6a66('0x46')][_0x6a66('0x23')]({'where':{'resetPasswordToken':_0x59f903['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x6a66('0x47')]()}}})['then'](function(_0x1d4c48){if(!_0x1d4c48){throw new Error(_0x6a66('0x48'));}return db[_0x6a66('0xb')]['findOne']({'attributes':['id',_0x6a66('0x49'),_0x6a66('0x4a'),_0x6a66('0x4b')]})[_0x6a66('0xf')](function(_0xe80c0a){if(_0xe80c0a['securePassword'])authService[_0x6a66('0x4c')](_0x59f903[_0x6a66('0x38')]['password']);if(!_0xe80c0a[_0x6a66('0x4a')]||!_0x1d4c48[_0x6a66('0x4d')])return _0x1d4c48;authService[_0x6a66('0x4e')](_0x59f903[_0x6a66('0x38')][_0x6a66('0x11')],_0x1d4c48['previousPasswords'],_0xe80c0a[_0x6a66('0x4b')]);return _0x1d4c48;})[_0x6a66('0xf')](function(){_0x1d4c48[_0x6a66('0x11')]=_0x59f903[_0x6a66('0x38')][_0x6a66('0x11')];_0x1d4c48['resetPasswordToken']=null;_0x1d4c48[_0x6a66('0x41')]=null;return _0x1d4c48['save']();});})[_0x6a66('0xf')](function(){_0x4a6cd2[_0x6a66('0x31')](0xc8)['send']({'message':_0x6a66('0x4f')});})['catch'](function(_0x4e1a69){return handleError(_0x4a6cd2,0x1f4,_0x4e1a69);});};passport['use'](_0x6a66('0x33'),new LocalStrategy({'usernameField':_0x6a66('0x10'),'passwordField':_0x6a66('0x11')},function(_0x3121d4,_0x3a86a6,_0x249b6e){return localAuthenticate(db['User'],_0x3121d4,_0x3a86a6,_0x249b6e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 2d5a867..0c2b112 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 _0x3d41=['/forgot','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x3b58e2,_0x4fbf5f){var _0x5a6677=function(_0x1bf45f){while(--_0x1bf45f){_0x3b58e2['push'](_0x3b58e2['shift']());}};_0x5a6677(++_0x4fbf5f);}(_0x3d41,0x1eb));var _0x13d4=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x3d41[_0x314a8c];return _0x1d4607;};'use strict';var express=require(_0x13d4('0x0'));var router=express[_0x13d4('0x1')]();var controller=require(_0x13d4('0x2'));router[_0x13d4('0x3')]('/',controller[_0x13d4('0x4')]);router['post'](_0x13d4('0x5'),controller['forgot']);router[_0x13d4('0x3')]('/reset/:token',controller[_0x13d4('0x6')]);module[_0x13d4('0x7')]=router; \ No newline at end of file +var _0xd474=['reset','post','login','forgot'];(function(_0x4b0297,_0x3de513){var _0x86b55b=function(_0x3c17da){while(--_0x3c17da){_0x4b0297['push'](_0x4b0297['shift']());}};_0x86b55b(++_0x3de513);}(_0xd474,0x1dd));var _0x4d47=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0xd474[_0x3585fb];return _0x48fb79;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x4d47('0x0')]('/',controller[_0x4d47('0x1')]);router['post']('/forgot',controller[_0x4d47('0x2')]);router[_0x4d47('0x0')]('/reset/:token',controller[_0x4d47('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e53b981..b3c6646 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 _0xca30=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x38d8e2,_0x48603c){var _0x5afbee=function(_0x2eca5e){while(--_0x2eca5e){_0x38d8e2['push'](_0x38d8e2['shift']());}};_0x5afbee(++_0x48603c);}(_0xca30,0x171));var _0x0ca3=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xca30[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x0ca3('0x0'));module[_0x0ca3('0x1')]={'name':{'type':Sequelize[_0x0ca3('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x0ca3('0x2')]},'description':{'type':Sequelize[_0x0ca3('0x2')]},'status':{'type':Sequelize[_0x0ca3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0ca3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xfed9=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfed9,0x1cc));var _0x9fed=function(_0x318309,_0x430ab9){_0x318309=_0x318309-0x0;var _0x4c25ff=_0xfed9[_0x318309];return _0x4c25ff;};'use strict';var Sequelize=require(_0x9fed('0x0'));module[_0x9fed('0x1')]={'name':{'type':Sequelize[_0x9fed('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x9fed('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x9fed('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9fed('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 62498a4..b173539 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 _0xef1a=['omit','ids','order','getConditions','addActions','Action','findOne','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','send','Automation','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','Condition'];(function(_0x3388d8,_0x256024){var _0x2bbe73=function(_0x3c0cb2){while(--_0x3c0cb2){_0x3388d8['push'](_0x3388d8['shift']());}};_0x2bbe73(++_0x256024);}(_0xef1a,0xb0));var _0xaef1=function(_0x2599ff,_0x168b1d){_0x2599ff=_0x2599ff-0x0;var _0x28d485=_0xef1a[_0x2599ff];return _0x28d485;};'use strict';var emlformat=require(_0xaef1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaef1('0x1'));var rp=require(_0xaef1('0x2'));var moment=require(_0xaef1('0x3'));var BPromise=require(_0xaef1('0x4'));var Mustache=require(_0xaef1('0x5'));var util=require('util');var path=require(_0xaef1('0x6'));var sox=require(_0xaef1('0x7'));var csv=require(_0xaef1('0x8'));var ejs=require(_0xaef1('0x9'));var fs=require('fs');var fs_extra=require(_0xaef1('0xa'));var _=require(_0xaef1('0xb'));var squel=require(_0xaef1('0xc'));var crypto=require('crypto');var jsforce=require(_0xaef1('0xd'));var deskjs=require(_0xaef1('0xe'));var toCsv=require(_0xaef1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaef1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaef1('0x10'));var as=require(_0xaef1('0x11'));var hardwareService=require(_0xaef1('0x12'));var logger=require(_0xaef1('0x13'))(_0xaef1('0x14'));var utils=require('../../config/utils');var config=require(_0xaef1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaef1('0x16'))['db'];function respondWithStatusCode(_0x4e2035,_0x5933a4){_0x5933a4=_0x5933a4||0xcc;return function(_0x52beb0){if(_0x52beb0){return _0x4e2035[_0xaef1('0x17')](_0x5933a4);}return _0x4e2035[_0xaef1('0x18')](_0x5933a4)['end']();};}function respondWithResult(_0x528e71,_0x3d006f){_0x3d006f=_0x3d006f||0xc8;return function(_0x43333f){if(_0x43333f){return _0x528e71[_0xaef1('0x18')](_0x3d006f)['json'](_0x43333f);}};}function respondWithFilteredResult(_0x5046f6,_0x443c98){return function(_0x1db188){if(_0x1db188){var _0x1608ef=typeof _0x443c98['offset']===_0xaef1('0x19')&&typeof _0x443c98[_0xaef1('0x1a')]===_0xaef1('0x19');var _0x1e72ab=_0x1db188['count'];var _0x440866=_0x1608ef?0x0:_0x443c98['offset'];var _0x84ecad=_0x1608ef?_0x1db188['count']:_0x443c98[_0xaef1('0x1b')]+_0x443c98[_0xaef1('0x1a')];var _0x4e6e4a;if(_0x84ecad>=_0x1e72ab){_0x84ecad=_0x1e72ab;_0x4e6e4a=0xc8;}else{_0x4e6e4a=0xce;}_0x5046f6[_0xaef1('0x18')](_0x4e6e4a);return _0x5046f6['set'](_0xaef1('0x1c'),_0x440866+'-'+_0x84ecad+'/'+_0x1e72ab)[_0xaef1('0x1d')](_0x1db188);}return null;};}function patchUpdates(_0x1ae5f8){return function(_0x22d9ed){try{jsonpatch[_0xaef1('0x1e')](_0x22d9ed,_0x1ae5f8,!![]);}catch(_0x54f2b7){return BPromise[_0xaef1('0x1f')](_0x54f2b7);}return _0x22d9ed[_0xaef1('0x20')]();};}function saveUpdates(_0x44cb3e,_0x4e0b8d){return function(_0x21b970){if(_0x21b970){return _0x21b970['update'](_0x44cb3e)[_0xaef1('0x21')](function(_0x33cf48){return _0x33cf48;});}return null;};}function removeEntity(_0x2e11f7,_0xd33b58){return function(_0x2b39d9){if(_0x2b39d9){return _0x2b39d9[_0xaef1('0x22')]()['then'](function(){_0x2e11f7[_0xaef1('0x18')](0xcc)[_0xaef1('0x23')]();});}};}function handleEntityNotFound(_0x3237e2,_0xe525b3){return function(_0x110ab3){if(!_0x110ab3){_0x3237e2[_0xaef1('0x17')](0x194);}return _0x110ab3;};}function handleError(_0x2417bb,_0x4e27e7){_0x4e27e7=_0x4e27e7||0x1f4;return function(_0x19b751){logger[_0xaef1('0x24')](_0x19b751[_0xaef1('0x25')]);if(_0x19b751['name']){delete _0x19b751['name'];}_0x2417bb[_0xaef1('0x18')](_0x4e27e7)[_0xaef1('0x26')](_0x19b751);};}exports['index']=function(_0x42b595,_0x1e865e){var _0x4cee6a={},_0x69c3cc={},_0x25b482={'count':0x0,'rows':[]};var _0x13dc7b=_['map'](db[_0xaef1('0x27')][_0xaef1('0x28')],function(_0x26f2e5){return{'name':_0x26f2e5[_0xaef1('0x29')],'type':_0x26f2e5[_0xaef1('0x2a')][_0xaef1('0x2b')]};});_0x69c3cc[_0xaef1('0x2c')]=_[_0xaef1('0x2d')](_0x13dc7b,_0xaef1('0x2e'));_0x69c3cc[_0xaef1('0x2f')]=_[_0xaef1('0x30')](_0x42b595[_0xaef1('0x2f')]);_0x69c3cc[_0xaef1('0x31')]=_[_0xaef1('0x32')](_0x69c3cc['model'],_0x69c3cc['query']);_0x4cee6a[_0xaef1('0x33')]=_[_0xaef1('0x32')](_0x69c3cc[_0xaef1('0x2c')],qs['fields'](_0x42b595[_0xaef1('0x2f')][_0xaef1('0x34')]));_0x4cee6a['attributes']=_0x4cee6a[_0xaef1('0x33')][_0xaef1('0x35')]?_0x4cee6a[_0xaef1('0x33')]:_0x69c3cc[_0xaef1('0x2c')];if(!_0x42b595[_0xaef1('0x2f')][_0xaef1('0x36')](_0xaef1('0x37'))){_0x4cee6a[_0xaef1('0x1a')]=qs[_0xaef1('0x1a')](_0x42b595['query'][_0xaef1('0x1a')]);_0x4cee6a[_0xaef1('0x1b')]=qs['offset'](_0x42b595['query'][_0xaef1('0x1b')]);}_0x4cee6a['order']=qs['sort'](_0x42b595[_0xaef1('0x2f')][_0xaef1('0x38')]);_0x4cee6a[_0xaef1('0x39')]=qs[_0xaef1('0x31')](_[_0xaef1('0x3a')](_0x42b595[_0xaef1('0x2f')],_0x69c3cc[_0xaef1('0x31')]),_0x13dc7b);if(_0x42b595[_0xaef1('0x2f')][_0xaef1('0x3b')]){_0x4cee6a['where']=_[_0xaef1('0x3c')](_0x4cee6a[_0xaef1('0x39')],{'$or':_[_0xaef1('0x2d')](_0x13dc7b,function(_0x4fd37e){if(_0x4fd37e[_0xaef1('0x2a')]!==_0xaef1('0x3d')){var _0x5b1efd={};_0x5b1efd[_0x4fd37e['name']]={'$like':'%'+_0x42b595[_0xaef1('0x2f')][_0xaef1('0x3b')]+'%'};return _0x5b1efd;}})});}_0x4cee6a=_[_0xaef1('0x3c')]({},_0x4cee6a,_0x42b595[_0xaef1('0x3e')]);var _0xbcb3a5={'where':_0x4cee6a['where']};return db[_0xaef1('0x27')][_0xaef1('0x3f')](_0xbcb3a5)['then'](function(_0x368cb5){_0x25b482[_0xaef1('0x3f')]=_0x368cb5;if(_0x42b595[_0xaef1('0x2f')][_0xaef1('0x40')]){_0x4cee6a[_0xaef1('0x41')]=[{'all':!![]}];}return db['Automation'][_0xaef1('0x42')](_0x4cee6a);})['then'](function(_0x3a7fe4){_0x25b482[_0xaef1('0x43')]=_0x3a7fe4;return _0x25b482;})[_0xaef1('0x21')](respondWithFilteredResult(_0x1e865e,_0x4cee6a))[_0xaef1('0x44')](handleError(_0x1e865e,null));};exports[_0xaef1('0x45')]=function(_0x50ace6,_0x1e9679){var _0x5bb926={'raw':![],'where':{'id':_0x50ace6['params']['id']}},_0x90a982={};_0x90a982[_0xaef1('0x2c')]=_[_0xaef1('0x30')](db[_0xaef1('0x27')][_0xaef1('0x28')]);_0x90a982[_0xaef1('0x2f')]=_['keys'](_0x50ace6['query']);_0x90a982[_0xaef1('0x31')]=_['intersection'](_0x90a982[_0xaef1('0x2c')],_0x90a982['query']);_0x5bb926[_0xaef1('0x33')]=_[_0xaef1('0x32')](_0x90a982['model'],qs['fields'](_0x50ace6['query'][_0xaef1('0x34')]));_0x5bb926['attributes']=_0x5bb926[_0xaef1('0x33')][_0xaef1('0x35')]?_0x5bb926[_0xaef1('0x33')]:_0x90a982[_0xaef1('0x2c')];if(_0x50ace6[_0xaef1('0x2f')][_0xaef1('0x40')]){_0x5bb926['include']=[{'all':!![]}];}_0x5bb926=_['merge']({},_0x5bb926,_0x50ace6[_0xaef1('0x3e')]);return db[_0xaef1('0x27')][_0xaef1('0x46')](_0x5bb926)[_0xaef1('0x21')](handleEntityNotFound(_0x1e9679,null))[_0xaef1('0x21')](respondWithResult(_0x1e9679,null))['catch'](handleError(_0x1e9679,null));};exports['create']=function(_0x3c4088,_0x18e86c){return db[_0xaef1('0x27')][_0xaef1('0x47')](_0x3c4088[_0xaef1('0x48')],{})['then'](respondWithResult(_0x18e86c,0xc9))['catch'](handleError(_0x18e86c,null));};exports[_0xaef1('0x49')]=function(_0x2b3a20,_0x3d2633){if(_0x2b3a20[_0xaef1('0x48')]['id']){delete _0x2b3a20[_0xaef1('0x48')]['id'];}return db[_0xaef1('0x27')][_0xaef1('0x46')]({'where':{'id':_0x2b3a20['params']['id']}})[_0xaef1('0x21')](handleEntityNotFound(_0x3d2633,null))['then'](saveUpdates(_0x2b3a20[_0xaef1('0x48')],null))['then'](respondWithResult(_0x3d2633,null))['catch'](handleError(_0x3d2633,null));};exports[_0xaef1('0x22')]=function(_0x564c6c,_0x2cb7ce){return db[_0xaef1('0x27')][_0xaef1('0x46')]({'where':{'id':_0x564c6c[_0xaef1('0x4a')]['id']}})[_0xaef1('0x21')](handleEntityNotFound(_0x2cb7ce,null))[_0xaef1('0x21')](removeEntity(_0x2cb7ce,null))[_0xaef1('0x44')](handleError(_0x2cb7ce,null));};exports['addConditions']=function(_0x163321,_0x438d5e,_0x3ad8a2){return db[_0xaef1('0x4b')][_0xaef1('0x46')]({'where':{'id':_0x163321[_0xaef1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x438d5e,null))['then'](function(_0x53d2bf){if(_0x53d2bf){return _0x53d2bf['addConditions'](_0x163321['body']['ids'],_[_0xaef1('0x4c')](_0x163321[_0xaef1('0x48')],[_0xaef1('0x4d'),'id'])||{});}})[_0xaef1('0x21')](respondWithResult(_0x438d5e,null))[_0xaef1('0x44')](handleError(_0x438d5e,null));};exports['getConditions']=function(_0x1e2545,_0x58301f,_0x2f2cf2){var _0x5dd33d={};var _0x345e54={};var _0x47a26b;var _0xed8fa5;return db[_0xaef1('0x27')]['findOne']({'where':{'id':_0x1e2545['params']['id']}})['then'](handleEntityNotFound(_0x58301f,null))[_0xaef1('0x21')](function(_0x196ef8){if(_0x196ef8){_0x47a26b=_0x196ef8;_0x345e54[_0xaef1('0x2c')]=_['keys'](db[_0xaef1('0x4b')][_0xaef1('0x28')]);_0x345e54[_0xaef1('0x2f')]=_[_0xaef1('0x30')](_0x1e2545[_0xaef1('0x2f')]);_0x345e54[_0xaef1('0x31')]=_[_0xaef1('0x32')](_0x345e54[_0xaef1('0x2c')],_0x345e54['query']);_0x5dd33d[_0xaef1('0x33')]=_['intersection'](_0x345e54[_0xaef1('0x2c')],qs[_0xaef1('0x34')](_0x1e2545[_0xaef1('0x2f')]['fields']));_0x5dd33d['attributes']=_0x5dd33d[_0xaef1('0x33')][_0xaef1('0x35')]?_0x5dd33d[_0xaef1('0x33')]:_0x345e54[_0xaef1('0x2c')];_0x5dd33d[_0xaef1('0x4e')]=qs['sort'](_0x1e2545['query'][_0xaef1('0x38')]);_0x5dd33d[_0xaef1('0x39')]=qs[_0xaef1('0x31')](_[_0xaef1('0x3a')](_0x1e2545[_0xaef1('0x2f')],_0x345e54[_0xaef1('0x31')]));if(_0x1e2545['query'][_0xaef1('0x3b')]){_0x5dd33d['where']=_[_0xaef1('0x3c')](_0x5dd33d[_0xaef1('0x39')],{'$or':_[_0xaef1('0x2d')](_0x5dd33d[_0xaef1('0x33')],function(_0x3950a4){var _0x2a403d={};_0x2a403d[_0x3950a4]={'$like':'%'+_0x1e2545['query'][_0xaef1('0x3b')]+'%'};return _0x2a403d;})});}_0x5dd33d=_[_0xaef1('0x3c')]({},_0x5dd33d,_0x1e2545['options']);return _0x47a26b[_0xaef1('0x4f')](_0x5dd33d);}})[_0xaef1('0x21')](function(_0x365143){if(_0x365143){_0xed8fa5=_0x365143['length'];if(!_0x1e2545[_0xaef1('0x2f')][_0xaef1('0x36')]('nolimit')){_0x5dd33d[_0xaef1('0x1a')]=qs[_0xaef1('0x1a')](_0x1e2545[_0xaef1('0x2f')]['limit']);_0x5dd33d[_0xaef1('0x1b')]=qs[_0xaef1('0x1b')](_0x1e2545[_0xaef1('0x2f')][_0xaef1('0x1b')]);}return _0x47a26b[_0xaef1('0x4f')](_0x5dd33d);}})[_0xaef1('0x21')](function(_0x5b8bfb){if(_0x5b8bfb){return _0x5b8bfb?{'count':_0xed8fa5,'rows':_0x5b8bfb}:null;}})[_0xaef1('0x21')](respondWithResult(_0x58301f,null))[_0xaef1('0x44')](handleError(_0x58301f,null));};exports[_0xaef1('0x50')]=function(_0x4a12fa,_0xd458aa,_0x22e480){return db[_0xaef1('0x51')]['find']({'where':{'id':_0x4a12fa[_0xaef1('0x4a')]['id']}})[_0xaef1('0x21')](handleEntityNotFound(_0xd458aa,null))[_0xaef1('0x21')](function(_0x426e60){if(_0x426e60){return _0x426e60['addActions'](_0x4a12fa[_0xaef1('0x48')][_0xaef1('0x4d')],_[_0xaef1('0x4c')](_0x4a12fa['body'],[_0xaef1('0x4d'),'id'])||{});}})['then'](respondWithResult(_0xd458aa,null))[_0xaef1('0x44')](handleError(_0xd458aa,null));};exports['getActions']=function(_0x575c17,_0x26215b,_0x59c1d2){var _0x9e719e={};var _0x45919e={};var _0x1cd985;var _0x1982de;return db['Automation'][_0xaef1('0x52')]({'where':{'id':_0x575c17[_0xaef1('0x4a')]['id']}})[_0xaef1('0x21')](handleEntityNotFound(_0x26215b,null))['then'](function(_0x4461c6){if(_0x4461c6){_0x1cd985=_0x4461c6;_0x45919e[_0xaef1('0x2c')]=_[_0xaef1('0x30')](db['Action']['rawAttributes']);_0x45919e[_0xaef1('0x2f')]=_[_0xaef1('0x30')](_0x575c17[_0xaef1('0x2f')]);_0x45919e[_0xaef1('0x31')]=_[_0xaef1('0x32')](_0x45919e[_0xaef1('0x2c')],_0x45919e['query']);_0x9e719e[_0xaef1('0x33')]=_['intersection'](_0x45919e['model'],qs['fields'](_0x575c17[_0xaef1('0x2f')][_0xaef1('0x34')]));_0x9e719e['attributes']=_0x9e719e[_0xaef1('0x33')][_0xaef1('0x35')]?_0x9e719e['attributes']:_0x45919e[_0xaef1('0x2c')];_0x9e719e['order']=qs['sort'](_0x575c17[_0xaef1('0x2f')][_0xaef1('0x38')]);_0x9e719e[_0xaef1('0x39')]=qs['filters'](_[_0xaef1('0x3a')](_0x575c17[_0xaef1('0x2f')],_0x45919e[_0xaef1('0x31')]));if(_0x575c17[_0xaef1('0x2f')]['filter']){_0x9e719e[_0xaef1('0x39')]=_[_0xaef1('0x3c')](_0x9e719e[_0xaef1('0x39')],{'$or':_[_0xaef1('0x2d')](_0x9e719e[_0xaef1('0x33')],function(_0x5f4aed){var _0x4f2003={};_0x4f2003[_0x5f4aed]={'$like':'%'+_0x575c17[_0xaef1('0x2f')][_0xaef1('0x3b')]+'%'};return _0x4f2003;})});}_0x9e719e=_[_0xaef1('0x3c')]({},_0x9e719e,_0x575c17[_0xaef1('0x3e')]);return _0x1cd985['getActions'](_0x9e719e);}})[_0xaef1('0x21')](function(_0x5680aa){if(_0x5680aa){_0x1982de=_0x5680aa[_0xaef1('0x35')];if(!_0x575c17['query']['hasOwnProperty'](_0xaef1('0x37'))){_0x9e719e[_0xaef1('0x1a')]=qs[_0xaef1('0x1a')](_0x575c17[_0xaef1('0x2f')][_0xaef1('0x1a')]);_0x9e719e[_0xaef1('0x1b')]=qs[_0xaef1('0x1b')](_0x575c17['query']['offset']);}return _0x1cd985[_0xaef1('0x53')](_0x9e719e);}})['then'](function(_0x5c66e3){if(_0x5c66e3){return _0x5c66e3?{'count':_0x1982de,'rows':_0x5c66e3}:null;}})['then'](respondWithResult(_0x26215b,null))[_0xaef1('0x44')](handleError(_0x26215b,null));}; \ No newline at end of file +var _0xc00b=['where','merge','options','Automation','include','findAll','rows','catch','params','length','create','body','find','addConditions','ids','omit','getConditions','findOne','order','hasOwnProperty','nolimit','addActions','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','sort','pick','filter'];(function(_0x56f09a,_0x224490){var _0x300555=function(_0x2d0e7f){while(--_0x2d0e7f){_0x56f09a['push'](_0x56f09a['shift']());}};_0x300555(++_0x224490);}(_0xc00b,0x102));var _0xbc00=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xc00b[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc00('0x0'));var zipdir=require(_0xbc00('0x1'));var jsonpatch=require(_0xbc00('0x2'));var rp=require(_0xbc00('0x3'));var moment=require('moment');var BPromise=require(_0xbc00('0x4'));var Mustache=require(_0xbc00('0x5'));var util=require(_0xbc00('0x6'));var path=require('path');var sox=require(_0xbc00('0x7'));var csv=require(_0xbc00('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc00('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc00('0xa'));var jsforce=require(_0xbc00('0xb'));var deskjs=require(_0xbc00('0xc'));var toCsv=require(_0xbc00('0x8'));var querystring=require(_0xbc00('0xd'));var Papa=require(_0xbc00('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbc00('0xf'));var hardwareService=require(_0xbc00('0x10'));var logger=require(_0xbc00('0x11'))(_0xbc00('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbc00('0x13'));var db=require(_0xbc00('0x14'))['db'];function respondWithStatusCode(_0x25b597,_0x43d27b){_0x43d27b=_0x43d27b||0xcc;return function(_0x1eee0d){if(_0x1eee0d){return _0x25b597[_0xbc00('0x15')](_0x43d27b);}return _0x25b597[_0xbc00('0x16')](_0x43d27b)['end']();};}function respondWithResult(_0x49c568,_0x45dba7){_0x45dba7=_0x45dba7||0xc8;return function(_0x4121f5){if(_0x4121f5){return _0x49c568[_0xbc00('0x16')](_0x45dba7)[_0xbc00('0x17')](_0x4121f5);}};}function respondWithFilteredResult(_0x818241,_0x5e2e7b){return function(_0x4adb96){if(_0x4adb96){var _0x50919b=typeof _0x5e2e7b[_0xbc00('0x18')]===_0xbc00('0x19')&&typeof _0x5e2e7b[_0xbc00('0x1a')]==='undefined';var _0x3f4b22=_0x4adb96[_0xbc00('0x1b')];var _0x36ffc8=_0x50919b?0x0:_0x5e2e7b[_0xbc00('0x18')];var _0x3fca31=_0x50919b?_0x4adb96[_0xbc00('0x1b')]:_0x5e2e7b['offset']+_0x5e2e7b[_0xbc00('0x1a')];var _0x51a81e;if(_0x3fca31>=_0x3f4b22){_0x3fca31=_0x3f4b22;_0x51a81e=0xc8;}else{_0x51a81e=0xce;}_0x818241[_0xbc00('0x16')](_0x51a81e);return _0x818241[_0xbc00('0x1c')]('Content-Range',_0x36ffc8+'-'+_0x3fca31+'/'+_0x3f4b22)['json'](_0x4adb96);}return null;};}function patchUpdates(_0x2bd67b){return function(_0x107abf){try{jsonpatch[_0xbc00('0x1d')](_0x107abf,_0x2bd67b,!![]);}catch(_0x391540){return BPromise['reject'](_0x391540);}return _0x107abf[_0xbc00('0x1e')]();};}function saveUpdates(_0x3a5fd3,_0x24769b){return function(_0x4fc942){if(_0x4fc942){return _0x4fc942[_0xbc00('0x1f')](_0x3a5fd3)[_0xbc00('0x20')](function(_0x158062){return _0x158062;});}return null;};}function removeEntity(_0x31690d,_0x301cff){return function(_0x1ea9a0){if(_0x1ea9a0){return _0x1ea9a0[_0xbc00('0x21')]()[_0xbc00('0x20')](function(){_0x31690d[_0xbc00('0x16')](0xcc)[_0xbc00('0x22')]();});}};}function handleEntityNotFound(_0x44aada,_0x2d7a8a){return function(_0x4202df){if(!_0x4202df){_0x44aada[_0xbc00('0x15')](0x194);}return _0x4202df;};}function handleError(_0x59c036,_0x3838f1){_0x3838f1=_0x3838f1||0x1f4;return function(_0x45c7cb){logger['error'](_0x45c7cb[_0xbc00('0x23')]);if(_0x45c7cb['name']){delete _0x45c7cb[_0xbc00('0x24')];}_0x59c036[_0xbc00('0x16')](_0x3838f1)[_0xbc00('0x25')](_0x45c7cb);};}exports[_0xbc00('0x26')]=function(_0x5d302b,_0x2bec88){var _0x40685e={},_0xd69478={},_0x512c67={'count':0x0,'rows':[]};var _0x55b067=_[_0xbc00('0x27')](db['Automation'][_0xbc00('0x28')],function(_0x1eebb3){return{'name':_0x1eebb3[_0xbc00('0x29')],'type':_0x1eebb3[_0xbc00('0x2a')][_0xbc00('0x2b')]};});_0xd69478['model']=_[_0xbc00('0x27')](_0x55b067,_0xbc00('0x24'));_0xd69478[_0xbc00('0x2c')]=_[_0xbc00('0x2d')](_0x5d302b['query']);_0xd69478[_0xbc00('0x2e')]=_[_0xbc00('0x2f')](_0xd69478[_0xbc00('0x30')],_0xd69478[_0xbc00('0x2c')]);_0x40685e[_0xbc00('0x31')]=_['intersection'](_0xd69478['model'],qs[_0xbc00('0x32')](_0x5d302b[_0xbc00('0x2c')][_0xbc00('0x32')]));_0x40685e[_0xbc00('0x31')]=_0x40685e[_0xbc00('0x31')]['length']?_0x40685e[_0xbc00('0x31')]:_0xd69478[_0xbc00('0x30')];if(!_0x5d302b[_0xbc00('0x2c')]['hasOwnProperty']('nolimit')){_0x40685e['limit']=qs[_0xbc00('0x1a')](_0x5d302b[_0xbc00('0x2c')][_0xbc00('0x1a')]);_0x40685e[_0xbc00('0x18')]=qs[_0xbc00('0x18')](_0x5d302b['query'][_0xbc00('0x18')]);}_0x40685e['order']=qs[_0xbc00('0x33')](_0x5d302b[_0xbc00('0x2c')][_0xbc00('0x33')]);_0x40685e['where']=qs[_0xbc00('0x2e')](_[_0xbc00('0x34')](_0x5d302b[_0xbc00('0x2c')],_0xd69478[_0xbc00('0x2e')]),_0x55b067);if(_0x5d302b[_0xbc00('0x2c')][_0xbc00('0x35')]){_0x40685e[_0xbc00('0x36')]=_['merge'](_0x40685e[_0xbc00('0x36')],{'$or':_['map'](_0x55b067,function(_0x558ab5){if(_0x558ab5[_0xbc00('0x2a')]!=='VIRTUAL'){var _0x44f9be={};_0x44f9be[_0x558ab5[_0xbc00('0x24')]]={'$like':'%'+_0x5d302b[_0xbc00('0x2c')][_0xbc00('0x35')]+'%'};return _0x44f9be;}})});}_0x40685e=_[_0xbc00('0x37')]({},_0x40685e,_0x5d302b[_0xbc00('0x38')]);var _0x3bd185={'where':_0x40685e[_0xbc00('0x36')]};return db[_0xbc00('0x39')]['count'](_0x3bd185)[_0xbc00('0x20')](function(_0x5f1ab9){_0x512c67[_0xbc00('0x1b')]=_0x5f1ab9;if(_0x5d302b['query']['includeAll']){_0x40685e[_0xbc00('0x3a')]=[{'all':!![]}];}return db[_0xbc00('0x39')][_0xbc00('0x3b')](_0x40685e);})[_0xbc00('0x20')](function(_0x5cc426){_0x512c67[_0xbc00('0x3c')]=_0x5cc426;return _0x512c67;})['then'](respondWithFilteredResult(_0x2bec88,_0x40685e))[_0xbc00('0x3d')](handleError(_0x2bec88,null));};exports['show']=function(_0x11351f,_0x543a37){var _0x4e8831={'raw':![],'where':{'id':_0x11351f[_0xbc00('0x3e')]['id']}},_0x74a8af={};_0x74a8af[_0xbc00('0x30')]=_[_0xbc00('0x2d')](db[_0xbc00('0x39')][_0xbc00('0x28')]);_0x74a8af[_0xbc00('0x2c')]=_['keys'](_0x11351f[_0xbc00('0x2c')]);_0x74a8af[_0xbc00('0x2e')]=_['intersection'](_0x74a8af[_0xbc00('0x30')],_0x74a8af[_0xbc00('0x2c')]);_0x4e8831[_0xbc00('0x31')]=_[_0xbc00('0x2f')](_0x74a8af[_0xbc00('0x30')],qs[_0xbc00('0x32')](_0x11351f[_0xbc00('0x2c')][_0xbc00('0x32')]));_0x4e8831[_0xbc00('0x31')]=_0x4e8831[_0xbc00('0x31')][_0xbc00('0x3f')]?_0x4e8831[_0xbc00('0x31')]:_0x74a8af[_0xbc00('0x30')];if(_0x11351f[_0xbc00('0x2c')]['includeAll']){_0x4e8831[_0xbc00('0x3a')]=[{'all':!![]}];}_0x4e8831=_[_0xbc00('0x37')]({},_0x4e8831,_0x11351f[_0xbc00('0x38')]);return db['Automation']['find'](_0x4e8831)[_0xbc00('0x20')](handleEntityNotFound(_0x543a37,null))[_0xbc00('0x20')](respondWithResult(_0x543a37,null))[_0xbc00('0x3d')](handleError(_0x543a37,null));};exports['create']=function(_0x82f1f7,_0x16382d){return db[_0xbc00('0x39')][_0xbc00('0x40')](_0x82f1f7[_0xbc00('0x41')],{})[_0xbc00('0x20')](respondWithResult(_0x16382d,0xc9))['catch'](handleError(_0x16382d,null));};exports['update']=function(_0xd66f3e,_0x3e24e3){if(_0xd66f3e[_0xbc00('0x41')]['id']){delete _0xd66f3e[_0xbc00('0x41')]['id'];}return db['Automation'][_0xbc00('0x42')]({'where':{'id':_0xd66f3e[_0xbc00('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3e24e3,null))[_0xbc00('0x20')](saveUpdates(_0xd66f3e[_0xbc00('0x41')],null))[_0xbc00('0x20')](respondWithResult(_0x3e24e3,null))[_0xbc00('0x3d')](handleError(_0x3e24e3,null));};exports['destroy']=function(_0x35a3fb,_0x46e3af){return db['Automation'][_0xbc00('0x42')]({'where':{'id':_0x35a3fb['params']['id']}})[_0xbc00('0x20')](handleEntityNotFound(_0x46e3af,null))[_0xbc00('0x20')](removeEntity(_0x46e3af,null))[_0xbc00('0x3d')](handleError(_0x46e3af,null));};exports[_0xbc00('0x43')]=function(_0x5c9a3d,_0x1a7660,_0x2578d8){return db['Condition'][_0xbc00('0x42')]({'where':{'id':_0x5c9a3d[_0xbc00('0x3e')]['id']}})[_0xbc00('0x20')](handleEntityNotFound(_0x1a7660,null))[_0xbc00('0x20')](function(_0x51509a){if(_0x51509a){return _0x51509a['addConditions'](_0x5c9a3d['body'][_0xbc00('0x44')],_[_0xbc00('0x45')](_0x5c9a3d['body'],[_0xbc00('0x44'),'id'])||{});}})[_0xbc00('0x20')](respondWithResult(_0x1a7660,null))['catch'](handleError(_0x1a7660,null));};exports[_0xbc00('0x46')]=function(_0x3a6a43,_0x43a6ea,_0x7c20f9){var _0x21b692={};var _0x506917={};var _0xb5c2b2;var _0x5d0a33;return db[_0xbc00('0x39')][_0xbc00('0x47')]({'where':{'id':_0x3a6a43[_0xbc00('0x3e')]['id']}})[_0xbc00('0x20')](handleEntityNotFound(_0x43a6ea,null))[_0xbc00('0x20')](function(_0x344c04){if(_0x344c04){_0xb5c2b2=_0x344c04;_0x506917['model']=_[_0xbc00('0x2d')](db['Condition'][_0xbc00('0x28')]);_0x506917[_0xbc00('0x2c')]=_['keys'](_0x3a6a43['query']);_0x506917['filters']=_['intersection'](_0x506917['model'],_0x506917[_0xbc00('0x2c')]);_0x21b692['attributes']=_['intersection'](_0x506917[_0xbc00('0x30')],qs[_0xbc00('0x32')](_0x3a6a43[_0xbc00('0x2c')]['fields']));_0x21b692[_0xbc00('0x31')]=_0x21b692[_0xbc00('0x31')][_0xbc00('0x3f')]?_0x21b692[_0xbc00('0x31')]:_0x506917[_0xbc00('0x30')];_0x21b692[_0xbc00('0x48')]=qs[_0xbc00('0x33')](_0x3a6a43['query'][_0xbc00('0x33')]);_0x21b692[_0xbc00('0x36')]=qs['filters'](_[_0xbc00('0x34')](_0x3a6a43[_0xbc00('0x2c')],_0x506917['filters']));if(_0x3a6a43[_0xbc00('0x2c')][_0xbc00('0x35')]){_0x21b692[_0xbc00('0x36')]=_['merge'](_0x21b692[_0xbc00('0x36')],{'$or':_['map'](_0x21b692[_0xbc00('0x31')],function(_0x57833d){var _0x48eeff={};_0x48eeff[_0x57833d]={'$like':'%'+_0x3a6a43[_0xbc00('0x2c')][_0xbc00('0x35')]+'%'};return _0x48eeff;})});}_0x21b692=_[_0xbc00('0x37')]({},_0x21b692,_0x3a6a43['options']);return _0xb5c2b2['getConditions'](_0x21b692);}})[_0xbc00('0x20')](function(_0x4d9687){if(_0x4d9687){_0x5d0a33=_0x4d9687[_0xbc00('0x3f')];if(!_0x3a6a43['query'][_0xbc00('0x49')](_0xbc00('0x4a'))){_0x21b692['limit']=qs[_0xbc00('0x1a')](_0x3a6a43[_0xbc00('0x2c')]['limit']);_0x21b692[_0xbc00('0x18')]=qs[_0xbc00('0x18')](_0x3a6a43['query'][_0xbc00('0x18')]);}return _0xb5c2b2[_0xbc00('0x46')](_0x21b692);}})['then'](function(_0x575865){if(_0x575865){return _0x575865?{'count':_0x5d0a33,'rows':_0x575865}:null;}})[_0xbc00('0x20')](respondWithResult(_0x43a6ea,null))[_0xbc00('0x3d')](handleError(_0x43a6ea,null));};exports['addActions']=function(_0x397c42,_0x5ef492,_0x37c747){return db['Action'][_0xbc00('0x42')]({'where':{'id':_0x397c42['params']['id']}})[_0xbc00('0x20')](handleEntityNotFound(_0x5ef492,null))['then'](function(_0x5b4177){if(_0x5b4177){return _0x5b4177[_0xbc00('0x4b')](_0x397c42[_0xbc00('0x41')][_0xbc00('0x44')],_[_0xbc00('0x45')](_0x397c42[_0xbc00('0x41')],[_0xbc00('0x44'),'id'])||{});}})[_0xbc00('0x20')](respondWithResult(_0x5ef492,null))[_0xbc00('0x3d')](handleError(_0x5ef492,null));};exports[_0xbc00('0x4c')]=function(_0x24ca71,_0x4edda9,_0x3d784c){var _0xb29f74={};var _0xa12d4={};var _0x457592;var _0x23aee0;return db[_0xbc00('0x39')][_0xbc00('0x47')]({'where':{'id':_0x24ca71[_0xbc00('0x3e')]['id']}})[_0xbc00('0x20')](handleEntityNotFound(_0x4edda9,null))[_0xbc00('0x20')](function(_0x563cbb){if(_0x563cbb){_0x457592=_0x563cbb;_0xa12d4[_0xbc00('0x30')]=_['keys'](db[_0xbc00('0x4d')][_0xbc00('0x28')]);_0xa12d4[_0xbc00('0x2c')]=_['keys'](_0x24ca71[_0xbc00('0x2c')]);_0xa12d4['filters']=_[_0xbc00('0x2f')](_0xa12d4[_0xbc00('0x30')],_0xa12d4[_0xbc00('0x2c')]);_0xb29f74[_0xbc00('0x31')]=_['intersection'](_0xa12d4[_0xbc00('0x30')],qs[_0xbc00('0x32')](_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x32')]));_0xb29f74['attributes']=_0xb29f74[_0xbc00('0x31')]['length']?_0xb29f74['attributes']:_0xa12d4[_0xbc00('0x30')];_0xb29f74['order']=qs['sort'](_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x33')]);_0xb29f74[_0xbc00('0x36')]=qs[_0xbc00('0x2e')](_[_0xbc00('0x34')](_0x24ca71[_0xbc00('0x2c')],_0xa12d4[_0xbc00('0x2e')]));if(_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x35')]){_0xb29f74[_0xbc00('0x36')]=_[_0xbc00('0x37')](_0xb29f74[_0xbc00('0x36')],{'$or':_[_0xbc00('0x27')](_0xb29f74[_0xbc00('0x31')],function(_0x5b7f72){var _0x54b7cb={};_0x54b7cb[_0x5b7f72]={'$like':'%'+_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x35')]+'%'};return _0x54b7cb;})});}_0xb29f74=_[_0xbc00('0x37')]({},_0xb29f74,_0x24ca71[_0xbc00('0x38')]);return _0x457592[_0xbc00('0x4c')](_0xb29f74);}})[_0xbc00('0x20')](function(_0x36483b){if(_0x36483b){_0x23aee0=_0x36483b[_0xbc00('0x3f')];if(!_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x49')](_0xbc00('0x4a'))){_0xb29f74[_0xbc00('0x1a')]=qs[_0xbc00('0x1a')](_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x1a')]);_0xb29f74['offset']=qs[_0xbc00('0x18')](_0x24ca71[_0xbc00('0x2c')][_0xbc00('0x18')]);}return _0x457592[_0xbc00('0x4c')](_0xb29f74);}})[_0xbc00('0x20')](function(_0x201893){if(_0x201893){return _0x201893?{'count':_0x23aee0,'rows':_0x201893}:null;}})[_0xbc00('0x20')](respondWithResult(_0x4edda9,null))[_0xbc00('0x3d')](handleError(_0x4edda9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f2302a1..8126c7d 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 _0x4caa=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_automations'];(function(_0xa2a43,_0x22044d){var _0x5b6d77=function(_0x1c5926){while(--_0x1c5926){_0xa2a43['push'](_0xa2a43['shift']());}};_0x5b6d77(++_0x22044d);}(_0x4caa,0x1ad));var _0xa4ca=function(_0xff9b9d,_0x55eb38){_0xff9b9d=_0xff9b9d-0x0;var _0x267e23=_0x4caa[_0xff9b9d];return _0x267e23;};'use strict';var _=require(_0xa4ca('0x0'));var util=require(_0xa4ca('0x1'));var logger=require(_0xa4ca('0x2'))(_0xa4ca('0x3'));var moment=require('moment');var BPromise=require(_0xa4ca('0x4'));var rp=require(_0xa4ca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4ca('0x6'));var config=require(_0xa4ca('0x7'));var attributes=require('./automation.attributes');module[_0xa4ca('0x8')]=function(_0x4c48c4,_0x505edb){return _0x4c48c4[_0xa4ca('0x9')]('Automation',attributes,{'tableName':_0xa4ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb583=['moment','bluebird','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','api'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xb583,0x11a));var _0x3b58=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb583[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3b58('0x0'));var util=require(_0x3b58('0x1'));var logger=require(_0x3b58('0x2'))(_0x3b58('0x3'));var moment=require(_0x3b58('0x4'));var BPromise=require(_0x3b58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b58('0x6'));var attributes=require(_0x3b58('0x7'));module[_0x3b58('0x8')]=function(_0x2d5d97,_0x2af659){return _0x2d5d97[_0x3b58('0x9')]('Automation',attributes,{'tableName':_0x3b58('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 913d741..417f447 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 _0x160f=['http','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('Automation,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});} \ No newline at end of file +var _0xb0ee=['../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54e079,_0x4b35d0){var _0x45eaff=function(_0x4cca2b){while(--_0x4cca2b){_0x54e079['push'](_0x54e079['shift']());}};_0x45eaff(++_0x4b35d0);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb0ee[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var moment=require(_0xeb0e('0x1'));var BPromise=require(_0xeb0e('0x2'));var rs=require(_0xeb0e('0x3'));var fs=require('fs');var Redis=require(_0xeb0e('0x4'));var db=require(_0xeb0e('0x5'))['db'];var utils=require(_0xeb0e('0x6'));var logger=require(_0xeb0e('0x7'))(_0xeb0e('0x8'));var config=require(_0xeb0e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb0e('0xa')][_0xeb0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423095,_0x3e7872,_0x572ee1){return new BPromise(function(_0x3b3c6e,_0x1dcf56){return client[_0xeb0e('0xc')](_0x423095,_0x572ee1)[_0xeb0e('0xd')](function(_0x2b90ba){logger[_0xeb0e('0xe')](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));logger[_0xeb0e('0x11')](_0xeb0e('0x12'),_0x3e7872,_0xeb0e('0x10'),JSON[_0xeb0e('0x13')](_0x2b90ba));if(_0x2b90ba[_0xeb0e('0x14')]){if(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x15')]===0x1f4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0x2b90ba[_0xeb0e('0x14')]['message']);return _0x1dcf56(_0x2b90ba['error'][_0xeb0e('0x16')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3e7872,_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);return _0x3b3c6e(_0x2b90ba[_0xeb0e('0x14')][_0xeb0e('0x16')]);}else{logger['info'](_0xeb0e('0xf'),_0x3e7872,_0xeb0e('0x10'));_0x3b3c6e(_0x2b90ba['result'][_0xeb0e('0x16')]);}})[_0xeb0e('0x17')](function(_0xa9a9c4){logger[_0xeb0e('0x14')](_0xeb0e('0xf'),_0x3e7872,_0xa9a9c4);_0x1dcf56(_0xa9a9c4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index dbb5b29..5b05f1e 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 _0xcb97=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','create','addActions','put','update','delete','multer'];(function(_0x543fcd,_0x3c7dc4){var _0xf58b27=function(_0x312fe6){while(--_0x312fe6){_0x543fcd['push'](_0x543fcd['shift']());}};_0xf58b27(++_0x3c7dc4);}(_0xcb97,0x14f));var _0x7cb9=function(_0x230754,_0x68aa94){_0x230754=_0x230754-0x0;var _0x12c3cf=_0xcb97[_0x230754];return _0x12c3cf;};'use strict';var multer=require(_0x7cb9('0x0'));var util=require(_0x7cb9('0x1'));var path=require(_0x7cb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7cb9('0x3'));var auth=require(_0x7cb9('0x4'));var interaction=require(_0x7cb9('0x5'));var config=require(_0x7cb9('0x6'));var controller=require(_0x7cb9('0x7'));router[_0x7cb9('0x8')]('/',auth[_0x7cb9('0x9')](),controller[_0x7cb9('0xa')]);router[_0x7cb9('0x8')](_0x7cb9('0xb'),auth[_0x7cb9('0x9')](),controller[_0x7cb9('0xc')]);router['get'](_0x7cb9('0xd'),auth[_0x7cb9('0x9')](),controller['getConditions']);router['get'](_0x7cb9('0xe'),auth[_0x7cb9('0x9')](),controller['getActions']);router[_0x7cb9('0xf')]('/',auth[_0x7cb9('0x9')](),controller[_0x7cb9('0x10')]);router[_0x7cb9('0xf')](_0x7cb9('0xd'),auth[_0x7cb9('0x9')](),controller['addConditions']);router[_0x7cb9('0xf')](_0x7cb9('0xe'),auth[_0x7cb9('0x9')](),controller[_0x7cb9('0x11')]);router[_0x7cb9('0x12')](_0x7cb9('0xb'),auth[_0x7cb9('0x9')](),controller[_0x7cb9('0x13')]);router[_0x7cb9('0x14')](_0x7cb9('0xb'),auth[_0x7cb9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xacb8=['addActions','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','getActions','post','addConditions','/:id/actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacb8,0x119));var _0x8acb=function(_0x5034cb,_0x322be8){_0x5034cb=_0x5034cb-0x0;var _0x44c8e2=_0xacb8[_0x5034cb];return _0x44c8e2;};'use strict';var multer=require(_0x8acb('0x0'));var util=require('util');var path=require(_0x8acb('0x1'));var timeout=require(_0x8acb('0x2'));var express=require(_0x8acb('0x3'));var router=express['Router']();var fs_extra=require(_0x8acb('0x4'));var auth=require(_0x8acb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8acb('0x6'));var controller=require(_0x8acb('0x7'));router[_0x8acb('0x8')]('/',auth[_0x8acb('0x9')](),controller[_0x8acb('0xa')]);router[_0x8acb('0x8')]('/:id',auth[_0x8acb('0x9')](),controller[_0x8acb('0xb')]);router[_0x8acb('0x8')](_0x8acb('0xc'),auth[_0x8acb('0x9')](),controller[_0x8acb('0xd')]);router['get']('/:id/actions',auth[_0x8acb('0x9')](),controller[_0x8acb('0xe')]);router[_0x8acb('0xf')]('/',auth[_0x8acb('0x9')](),controller['create']);router[_0x8acb('0xf')](_0x8acb('0xc'),auth['isAuthenticated'](),controller[_0x8acb('0x10')]);router[_0x8acb('0xf')](_0x8acb('0x11'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x12')]);router['put'](_0x8acb('0x13'),auth[_0x8acb('0x9')](),controller[_0x8acb('0x14')]);router[_0x8acb('0x15')](_0x8acb('0x13'),auth[_0x8acb('0x9')](),controller['destroy']);module[_0x8acb('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5816835..0e127fe 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 _0x1dd8=['onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never'];(function(_0x43bf1a,_0x42c020){var _0x1b3ad6=function(_0x211a9f){while(--_0x211a9f){_0x43bf1a['push'](_0x43bf1a['shift']());}};_0x1b3ad6(++_0x42c020);}(_0x1dd8,0x13c));var _0x81dd=function(_0x460ea3,_0x42970b){_0x460ea3=_0x460ea3-0x0;var _0x1b6b53=_0x1dd8[_0x460ea3];return _0x1b6b53;};'use strict';var Sequelize=require(_0x81dd('0x0'));module[_0x81dd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x81dd('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x81dd('0x3')](_0x81dd('0x4')),'allowNull':![],'defaultValue':_0x81dd('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x81dd('0x5')](0x4)[_0x81dd('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x81dd('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x81dd('0x8')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x81dd('0x8')]},'dialOriginateTimeout':{'type':Sequelize[_0x81dd('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x81dd('0x5')](0x5)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x81dd('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x81dd('0x5')](0x5)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x81dd('0xe')},'dialTimezone':{'type':Sequelize[_0x81dd('0x8')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x81dd('0x8')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x81dd('0xf'),_0x81dd('0x10'),_0x81dd('0x11')),'defaultValue':_0x81dd('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x81dd('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x81dd('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x81dd('0x5')](0x9)[_0x81dd('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x81dd('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x81dd('0x5')](0x9)[_0x81dd('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x81dd('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x81dd('0x5')](0x9)[_0x81dd('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x81dd('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x81dd('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x81dd('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x81dd('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x81dd('0x5')](0x9)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x81dd('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x81dd('0x5')](0x5)[_0x81dd('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x81dd('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x81dd('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x81dd('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x81dd('0x3')](_0x81dd('0x1a'),'ASC'),'defaultValue':_0x81dd('0x1a')},'dialPrefix':{'type':Sequelize[_0x81dd('0x8')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81dd('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x81dd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x81dd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x81dd('0x5')](0x3)[_0x81dd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81dd('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x81dd('0x5')](0x5)[_0x81dd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81dd('0x24')}}; \ No newline at end of file +var _0x4463=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED'];(function(_0x3a1db7,_0x2138a8){var _0x12acf8=function(_0x263a72){while(--_0x263a72){_0x3a1db7['push'](_0x3a1db7['shift']());}};_0x12acf8(++_0x2138a8);}(_0x4463,0x186));var _0x3446=function(_0x915228,_0x1abb38){_0x915228=_0x915228-0x0;var _0x2cff4f=_0x4463[_0x915228];return _0x2cff4f;};'use strict';var Sequelize=require('sequelize');module[_0x3446('0x0')]={'name':{'type':Sequelize[_0x3446('0x1')],'unique':_0x3446('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x3446('0x3')](_0x3446('0x4')),'allowNull':![],'defaultValue':_0x3446('0x4')},'description':{'type':Sequelize[_0x3446('0x1')]},'active':{'type':Sequelize[_0x3446('0x5')],'defaultValue':0x0,'comment':_0x3446('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3446('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3446('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3446('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3446('0x9')],'defaultValue':0x3,'comment':_0x3446('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x3446('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3446('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3446('0x10'),_0x3446('0x11'),_0x3446('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x3446('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3446('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3446('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3446('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3446('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3446('0x8')](0x9)[_0x3446('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3446('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3446('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3446('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3446('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x3446('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3446('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3446('0x3')](_0x3446('0x1b'),'ASC'),'defaultValue':_0x3446('0x1b')},'dialPrefix':{'type':Sequelize[_0x3446('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3446('0x1c')},'dialCutDigit':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3446('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x3446('0x8')](0x3)[_0x3446('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3446('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3446('0x8')](0x5)[_0x3446('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3446('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index a177dfb..dc68ad5 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 _0x641b=['getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','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?','COALESCE(phone,\x27\x27)','onlyIfOpen','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','Campaign','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','role','user','IvrCampaigns','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal'];(function(_0x5e55d5,_0x5c36de){var _0x5dba45=function(_0x18bad9){while(--_0x18bad9){_0x5e55d5['push'](_0x5e55d5['shift']());}};_0x5dba45(++_0x5c36de);}(_0x641b,0xca));var _0xb641=function(_0x2005a1,_0x470842){_0x2005a1=_0x2005a1-0x0;var _0x2e5af3=_0x641b[_0x2005a1];return _0x2e5af3;};'use strict';var emlformat=require(_0xb641('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb641('0x1'));var jsonpatch=require(_0xb641('0x2'));var rp=require(_0xb641('0x3'));var moment=require(_0xb641('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb641('0x5'));var util=require(_0xb641('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb641('0x7'));var ejs=require(_0xb641('0x8'));var fs=require('fs');var fs_extra=require(_0xb641('0x9'));var _=require(_0xb641('0xa'));var squel=require(_0xb641('0xb'));var crypto=require(_0xb641('0xc'));var jsforce=require(_0xb641('0xd'));var deskjs=require(_0xb641('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb641('0xf'));var Papa=require(_0xb641('0x10'));var Redis=require(_0xb641('0x11'));var authService=require(_0xb641('0x12'));var qs=require(_0xb641('0x13'));var as=require(_0xb641('0x14'));var hardwareService=require(_0xb641('0x15'));var logger=require(_0xb641('0x16'))(_0xb641('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb641('0x18'));var db=require(_0xb641('0x19'))['db'];function respondWithStatusCode(_0x5ea5f4,_0x3289ca){_0x3289ca=_0x3289ca||0xcc;return function(_0x5a1fbb){if(_0x5a1fbb){return _0x5ea5f4[_0xb641('0x1a')](_0x3289ca);}return _0x5ea5f4[_0xb641('0x1b')](_0x3289ca)['end']();};}function respondWithResult(_0x4d8ac7,_0x5484b2){_0x5484b2=_0x5484b2||0xc8;return function(_0x3603c8){if(_0x3603c8){return _0x4d8ac7[_0xb641('0x1b')](_0x5484b2)[_0xb641('0x1c')](_0x3603c8);}};}function respondWithFilteredResult(_0xd9dfd,_0x189d42){return function(_0x482ac3){if(_0x482ac3){var _0x5abb97=typeof _0x189d42[_0xb641('0x1d')]==='undefined'&&typeof _0x189d42[_0xb641('0x1e')]===_0xb641('0x1f');var _0x39886c=_0x482ac3[_0xb641('0x20')];var _0x4a8c1c=_0x5abb97?0x0:_0x189d42['offset'];var _0x329a55=_0x5abb97?_0x482ac3[_0xb641('0x20')]:_0x189d42[_0xb641('0x1d')]+_0x189d42['limit'];var _0x2bb074;if(_0x329a55>=_0x39886c){_0x329a55=_0x39886c;_0x2bb074=0xc8;}else{_0x2bb074=0xce;}_0xd9dfd['status'](_0x2bb074);return _0xd9dfd['set']('Content-Range',_0x4a8c1c+'-'+_0x329a55+'/'+_0x39886c)[_0xb641('0x1c')](_0x482ac3);}return null;};}function patchUpdates(_0x1c4d6c){return function(_0x3d0cae){try{jsonpatch['apply'](_0x3d0cae,_0x1c4d6c,!![]);}catch(_0x22ccdb){return BPromise[_0xb641('0x21')](_0x22ccdb);}return _0x3d0cae[_0xb641('0x22')]();};}function saveUpdates(_0x558739,_0x34d364){return function(_0x1d0b00){if(_0x1d0b00){return _0x1d0b00[_0xb641('0x23')](_0x558739)['then'](function(_0xd99d27){return _0xd99d27;});}return null;};}function removeEntity(_0x56aa9d,_0x51b49b){return function(_0x1fde2b){if(_0x1fde2b){return _0x1fde2b[_0xb641('0x24')]()[_0xb641('0x25')](function(){var _0x178dc3=_0x1fde2b[_0xb641('0x26')]({'plain':!![]});var _0x55c26f='IvrCampaigns';return db[_0xb641('0x27')][_0xb641('0x24')]({'where':{'type':_0x55c26f,'resourceId':_0x178dc3['id']}})[_0xb641('0x25')](function(){return _0x1fde2b;});})[_0xb641('0x25')](function(){_0x56aa9d[_0xb641('0x1b')](0xcc)[_0xb641('0x28')]();});}};}function handleEntityNotFound(_0x3e9b7f,_0x5b9147){return function(_0x1999a2){if(!_0x1999a2){_0x3e9b7f[_0xb641('0x1a')](0x194);}return _0x1999a2;};}function handleError(_0xf8d4fd,_0x360185){_0x360185=_0x360185||0x1f4;return function(_0x3a28ca){logger['error'](_0x3a28ca[_0xb641('0x29')]);if(_0x3a28ca[_0xb641('0x2a')]){delete _0x3a28ca[_0xb641('0x2a')];}_0xf8d4fd[_0xb641('0x1b')](_0x360185)[_0xb641('0x2b')](_0x3a28ca);};}exports[_0xb641('0x2c')]=function(_0x567137,_0x2815d2){var _0x3991d5={},_0x1e1b21={},_0x157ad1={'count':0x0,'rows':[]};var _0x2fa23a=_[_0xb641('0x2d')](db[_0xb641('0x2e')][_0xb641('0x2f')],function(_0x1a2cdd){return{'name':_0x1a2cdd['fieldName'],'type':_0x1a2cdd[_0xb641('0x30')]['key']};});_0x1e1b21[_0xb641('0x31')]=_[_0xb641('0x2d')](_0x2fa23a,_0xb641('0x2a'));_0x1e1b21[_0xb641('0x32')]=_['keys'](_0x567137[_0xb641('0x32')]);_0x1e1b21['filters']=_[_0xb641('0x33')](_0x1e1b21[_0xb641('0x31')],_0x1e1b21[_0xb641('0x32')]);_0x3991d5[_0xb641('0x34')]=_[_0xb641('0x33')](_0x1e1b21['model'],qs[_0xb641('0x35')](_0x567137[_0xb641('0x32')][_0xb641('0x35')]));_0x3991d5[_0xb641('0x34')]=_0x3991d5['attributes'][_0xb641('0x36')]?_0x3991d5[_0xb641('0x34')]:_0x1e1b21[_0xb641('0x31')];if(!_0x567137[_0xb641('0x32')][_0xb641('0x37')](_0xb641('0x38'))){_0x3991d5[_0xb641('0x1e')]=qs[_0xb641('0x1e')](_0x567137[_0xb641('0x32')][_0xb641('0x1e')]);_0x3991d5[_0xb641('0x1d')]=qs['offset'](_0x567137[_0xb641('0x32')][_0xb641('0x1d')]);}_0x3991d5[_0xb641('0x39')]=qs['sort'](_0x567137[_0xb641('0x32')][_0xb641('0x3a')]);_0x3991d5[_0xb641('0x3b')]=qs[_0xb641('0x3c')](_[_0xb641('0x3d')](_0x567137[_0xb641('0x32')],_0x1e1b21[_0xb641('0x3c')]),_0x2fa23a);if(_0x567137['query'][_0xb641('0x3e')]){_0x3991d5[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x3991d5['where'],{'$or':_[_0xb641('0x2d')](_0x2fa23a,function(_0x4bf855){if(_0x4bf855['type']!==_0xb641('0x40')){var _0x3e09c0={};_0x3e09c0[_0x4bf855[_0xb641('0x2a')]]={'$like':'%'+_0x567137[_0xb641('0x32')]['filter']+'%'};return _0x3e09c0;}})});}_0x3991d5=_[_0xb641('0x3f')]({},_0x3991d5,_0x567137[_0xb641('0x41')]);var _0x82c93a={'where':_0x3991d5[_0xb641('0x3b')]};return db[_0xb641('0x2e')][_0xb641('0x20')](_0x82c93a)['then'](function(_0x387faa){_0x157ad1[_0xb641('0x20')]=_0x387faa;if(_0x567137['query'][_0xb641('0x42')]){_0x3991d5['include']=[{'all':!![]}];}return db[_0xb641('0x2e')][_0xb641('0x43')](_0x3991d5);})['then'](function(_0x570b98){_0x157ad1[_0xb641('0x44')]=_0x570b98;return _0x157ad1;})['then'](respondWithFilteredResult(_0x2815d2,_0x3991d5))[_0xb641('0x45')](handleError(_0x2815d2,null));};exports[_0xb641('0x46')]=function(_0x299d2a,_0x450843){var _0x3cf412={'raw':![],'where':{'id':_0x299d2a[_0xb641('0x47')]['id']}},_0x58d063={};_0x58d063[_0xb641('0x31')]=_[_0xb641('0x48')](db[_0xb641('0x2e')][_0xb641('0x2f')]);_0x58d063['query']=_[_0xb641('0x48')](_0x299d2a[_0xb641('0x32')]);_0x58d063[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x58d063[_0xb641('0x31')],_0x58d063[_0xb641('0x32')]);_0x3cf412[_0xb641('0x34')]=_[_0xb641('0x33')](_0x58d063[_0xb641('0x31')],qs['fields'](_0x299d2a['query'][_0xb641('0x35')]));_0x3cf412[_0xb641('0x34')]=_0x3cf412[_0xb641('0x34')]['length']?_0x3cf412[_0xb641('0x34')]:_0x58d063[_0xb641('0x31')];if(_0x299d2a['query']['includeAll']){_0x3cf412[_0xb641('0x49')]=[{'all':!![]}];}_0x3cf412=_['merge']({},_0x3cf412,_0x299d2a[_0xb641('0x41')]);return db[_0xb641('0x2e')][_0xb641('0x4a')](_0x3cf412)[_0xb641('0x25')](handleEntityNotFound(_0x450843,null))[_0xb641('0x25')](respondWithResult(_0x450843,null))[_0xb641('0x45')](handleError(_0x450843,null));};exports[_0xb641('0x4b')]=function(_0x1e5613,_0xe9c52d){return db[_0xb641('0x2e')]['create'](_0x1e5613['body'],{})[_0xb641('0x25')](function(_0xac9a5f){var _0x2cc415=_0x1e5613['user'][_0xb641('0x26')]({'plain':!![]});if(!_0x2cc415)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cc415[_0xb641('0x4c')]===_0xb641('0x4d')){var _0x4a1c78=_0xac9a5f[_0xb641('0x26')]({'plain':!![]});var _0x37069b=_0xb641('0x4e');return db[_0xb641('0x4f')][_0xb641('0x4a')]({'where':{'name':_0x37069b,'userProfileId':_0x2cc415[_0xb641('0x50')]},'raw':!![]})[_0xb641('0x25')](function(_0x232256){if(_0x232256&&_0x232256['autoAssociation']===0x0){return db[_0xb641('0x27')][_0xb641('0x4b')]({'name':_0x4a1c78[_0xb641('0x2a')],'resourceId':_0x4a1c78['id'],'type':_0x232256[_0xb641('0x2a')],'sectionId':_0x232256['id']},{})[_0xb641('0x25')](function(){return _0xac9a5f;});}else{return _0xac9a5f;}})[_0xb641('0x45')](function(_0x688ff0){logger[_0xb641('0x51')](_0xb641('0x52'),_0x688ff0);throw _0x688ff0;});}return _0xac9a5f;})[_0xb641('0x25')](respondWithResult(_0xe9c52d,0xc9))[_0xb641('0x45')](handleError(_0xe9c52d,null));};exports[_0xb641('0x53')]=function(_0x20d5dc,_0x3435ab){var _0x2e0e28={'where':{'id':_0x20d5dc['params']['id']}},_0x24105f={};_0x24105f[_0xb641('0x31')]=_[_0xb641('0x48')](db['Campaign'][_0xb641('0x2f')]);_0x2e0e28[_0xb641('0x34')]=_[_0xb641('0x33')](_0x24105f[_0xb641('0x31')],qs['fields'](_0x20d5dc['query'][_0xb641('0x35')]));_0x2e0e28[_0xb641('0x34')]=_0x2e0e28[_0xb641('0x34')][_0xb641('0x36')]?_0x2e0e28[_0xb641('0x34')]:_0x24105f[_0xb641('0x31')];if(_0x20d5dc[_0xb641('0x32')][_0xb641('0x42')]){_0x2e0e28[_0xb641('0x49')]=[{'all':!![]}];}_0x2e0e28=_[_0xb641('0x3f')]({},_0x2e0e28,_0x20d5dc[_0xb641('0x41')]);return db[_0xb641('0x2e')]['find'](_0x2e0e28)[_0xb641('0x25')](handleEntityNotFound(_0x3435ab,null))[_0xb641('0x25')](function(_0x3f4f2a){if(_0x3f4f2a){var _0x140207=_0x3f4f2a[_0xb641('0x26')]({'plain':!![]});_0x140207=qs['omit'](_0x140207,['id',_0xb641('0x54'),_0xb641('0x55')]);_0x20d5dc[_0xb641('0x56')]=_[_0xb641('0x57')](_0x20d5dc[_0xb641('0x56')],['id',_0xb641('0x54'),_0xb641('0x55')]);return db[_0xb641('0x2e')][_0xb641('0x4b')](_['merge'](_0x140207,_0x20d5dc['body']),{'include':_0x20d5dc['query'][_0xb641('0x42')]?[{'all':!![]}]:undefined})[_0xb641('0x25')](function(_0x432366){var _0x4e385d=_0x20d5dc[_0xb641('0x4d')][_0xb641('0x26')]({'plain':!![]});if(!_0x4e385d)throw new Error(_0xb641('0x58'));if(_0x4e385d[_0xb641('0x4c')]===_0xb641('0x4d')){var _0xe183cb=_0x432366['get']({'plain':!![]});var _0x59fdcb=_0xb641('0x4e');return db[_0xb641('0x4f')][_0xb641('0x4a')]({'where':{'name':_0x59fdcb,'userProfileId':_0x4e385d[_0xb641('0x50')]},'raw':!![]})[_0xb641('0x25')](function(_0x1b0a2a){if(_0x1b0a2a&&_0x1b0a2a[_0xb641('0x59')]===0x0){return db[_0xb641('0x27')][_0xb641('0x4b')]({'name':_0xe183cb['name'],'resourceId':_0xe183cb['id'],'type':_0x1b0a2a[_0xb641('0x2a')],'sectionId':_0x1b0a2a['id']},{})['then'](function(){return _0x432366;});}else{return _0x432366;}})[_0xb641('0x45')](function(_0x43f475){logger[_0xb641('0x51')](_0xb641('0x52'),_0x43f475);throw _0x43f475;});}return _0x432366;});}})[_0xb641('0x25')](respondWithResult(_0x3435ab,0xc9))[_0xb641('0x45')](handleError(_0x3435ab,null));};exports[_0xb641('0x23')]=function(_0x1a70bb,_0x3570a7){if(_0x1a70bb['body']['id']){delete _0x1a70bb[_0xb641('0x56')]['id'];}return db[_0xb641('0x2e')][_0xb641('0x4a')]({'where':{'id':_0x1a70bb['params']['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x3570a7,null))[_0xb641('0x25')](saveUpdates(_0x1a70bb[_0xb641('0x56')],null))['then'](respondWithResult(_0x3570a7,null))['catch'](handleError(_0x3570a7,null));};exports['destroy']=function(_0x3a6307,_0xedc83a){return db[_0xb641('0x2e')][_0xb641('0x4a')]({'where':{'id':_0x3a6307['params']['id']}})[_0xb641('0x25')](handleEntityNotFound(_0xedc83a,null))['then'](removeEntity(_0xedc83a,null))[_0xb641('0x45')](handleError(_0xedc83a,null));};exports[_0xb641('0x5a')]=function(_0x5bacd7,_0x500d1c,_0x2458fc){var _0x1645f9={'raw':!![],'where':{}};var _0x5a20b2={};var _0x119180={'count':0x0,'rows':[]};return db['Campaign'][_0xb641('0x5b')]({'where':{'id':_0x5bacd7[_0xb641('0x47')]['id']}})['then'](handleEntityNotFound(_0x500d1c,null))[_0xb641('0x25')](function(_0x3a66b2){if(_0x3a66b2){_0x5a20b2[_0xb641('0x31')]=_['keys'](db[_0xb641('0x5c')][_0xb641('0x2f')]);_0x5a20b2['query']=_[_0xb641('0x48')](_0x5bacd7['query']);_0x5a20b2[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x5a20b2[_0xb641('0x31')],_0x5a20b2[_0xb641('0x32')]);_0x1645f9[_0xb641('0x34')]=_[_0xb641('0x33')](_0x5a20b2[_0xb641('0x31')],qs[_0xb641('0x35')](_0x5bacd7['query']['fields']));_0x1645f9[_0xb641('0x34')]=_0x1645f9['attributes'][_0xb641('0x36')]?_0x1645f9['attributes']:_0x5a20b2[_0xb641('0x31')];if(!_0x5bacd7[_0xb641('0x32')][_0xb641('0x37')](_0xb641('0x38'))){_0x1645f9[_0xb641('0x1e')]=qs[_0xb641('0x1e')](_0x5bacd7[_0xb641('0x32')][_0xb641('0x1e')]);_0x1645f9[_0xb641('0x1d')]=qs[_0xb641('0x1d')](_0x5bacd7[_0xb641('0x32')][_0xb641('0x1d')]);}_0x1645f9[_0xb641('0x39')]=qs['sort'](_0x5bacd7[_0xb641('0x32')]['sort']);_0x1645f9[_0xb641('0x3b')]=qs[_0xb641('0x3c')](_[_0xb641('0x3d')](_0x5bacd7[_0xb641('0x32')],_0x5a20b2[_0xb641('0x3c')]));_0x1645f9[_0xb641('0x3b')][_0xb641('0x5d')]=_0x3a66b2['id'];if(_0x5bacd7[_0xb641('0x32')][_0xb641('0x3e')]){_0x1645f9[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x1645f9[_0xb641('0x3b')],{'$or':_['map'](_0x1645f9[_0xb641('0x34')],function(_0xaa9c8b){var _0x246286={};_0x246286[_0xaa9c8b]={'$like':'%'+_0x5bacd7[_0xb641('0x32')][_0xb641('0x3e')]+'%'};return _0x246286;})});}_0x1645f9=_[_0xb641('0x3f')]({},_0x1645f9,_0x5bacd7[_0xb641('0x41')]);return db[_0xb641('0x5c')]['count']({'where':_0x1645f9['where']})[_0xb641('0x25')](function(_0x4460a4){_0x119180['count']=_0x4460a4;if(_0x5bacd7[_0xb641('0x32')][_0xb641('0x42')]){_0x1645f9['include']=[{'all':!![]}];}return db['CmHopper'][_0xb641('0x43')](_0x1645f9);})[_0xb641('0x25')](function(_0x3764b2){_0x119180['rows']=_0x3764b2;return _0x119180;});}})['then'](respondWithFilteredResult(_0x500d1c,_0x1645f9))[_0xb641('0x45')](handleError(_0x500d1c,null));};exports[_0xb641('0x5e')]=function(_0x5cc549,_0x1aa366,_0x1efa2b){var _0x3a9590={'raw':!![],'where':{}};var _0x154cc9={};var _0x3a0d8f={'count':0x0,'rows':[]};return db[_0xb641('0x2e')]['findOne']({'where':{'id':_0x5cc549[_0xb641('0x47')]['id']}})['then'](handleEntityNotFound(_0x1aa366,null))[_0xb641('0x25')](function(_0xccef65){if(_0xccef65){_0x154cc9[_0xb641('0x31')]=_['keys'](db[_0xb641('0x5f')]['rawAttributes']);_0x154cc9['query']=_[_0xb641('0x48')](_0x5cc549[_0xb641('0x32')]);_0x154cc9[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x154cc9['model'],_0x154cc9['query']);_0x3a9590[_0xb641('0x34')]=_[_0xb641('0x33')](_0x154cc9[_0xb641('0x31')],qs[_0xb641('0x35')](_0x5cc549[_0xb641('0x32')][_0xb641('0x35')]));_0x3a9590[_0xb641('0x34')]=_0x3a9590[_0xb641('0x34')][_0xb641('0x36')]?_0x3a9590['attributes']:_0x154cc9[_0xb641('0x31')];if(!_0x5cc549['query'][_0xb641('0x37')](_0xb641('0x38'))){_0x3a9590[_0xb641('0x1e')]=qs[_0xb641('0x1e')](_0x5cc549[_0xb641('0x32')][_0xb641('0x1e')]);_0x3a9590[_0xb641('0x1d')]=qs[_0xb641('0x1d')](_0x5cc549[_0xb641('0x32')][_0xb641('0x1d')]);}_0x3a9590[_0xb641('0x39')]=qs[_0xb641('0x3a')](_0x5cc549[_0xb641('0x32')][_0xb641('0x3a')]);_0x3a9590[_0xb641('0x3b')]=qs['filters'](_['pick'](_0x5cc549[_0xb641('0x32')],_0x154cc9['filters']));_0x3a9590['where'][_0xb641('0x5d')]=_0xccef65['id'];if(_0x5cc549[_0xb641('0x32')][_0xb641('0x3e')]){_0x3a9590[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x3a9590['where'],{'$or':_[_0xb641('0x2d')](_0x3a9590[_0xb641('0x34')],function(_0x108290){var _0x12e32b={};_0x12e32b[_0x108290]={'$like':'%'+_0x5cc549[_0xb641('0x32')]['filter']+'%'};return _0x12e32b;})});}_0x3a9590=_['merge']({},_0x3a9590,_0x5cc549[_0xb641('0x41')]);return db[_0xb641('0x5f')][_0xb641('0x20')]({'where':_0x3a9590[_0xb641('0x3b')]})[_0xb641('0x25')](function(_0x125a8f){_0x3a0d8f[_0xb641('0x20')]=_0x125a8f;if(_0x5cc549[_0xb641('0x32')][_0xb641('0x42')]){_0x3a9590['include']=[{'all':!![]}];}return db[_0xb641('0x5f')][_0xb641('0x43')](_0x3a9590);})[_0xb641('0x25')](function(_0x41a809){_0x3a0d8f['rows']=_0x41a809;return _0x3a0d8f;});}})['then'](respondWithFilteredResult(_0x1aa366,_0x3a9590))[_0xb641('0x45')](handleError(_0x1aa366,null));};exports[_0xb641('0x60')]=function(_0x163e0a,_0x27fcf6,_0x1ec0d0){var _0x5ed630={'raw':!![],'where':{}};var _0x420658={};var _0x266d77={'count':0x0,'rows':[]};return db['Campaign'][_0xb641('0x5b')]({'where':{'id':_0x163e0a[_0xb641('0x47')]['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x27fcf6,null))[_0xb641('0x25')](function(_0x2b65e3){if(_0x2b65e3){_0x420658[_0xb641('0x31')]=_['keys'](db[_0xb641('0x61')][_0xb641('0x2f')]);_0x420658[_0xb641('0x32')]=_['keys'](_0x163e0a['query']);_0x420658[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x420658[_0xb641('0x31')],_0x420658[_0xb641('0x32')]);_0x5ed630[_0xb641('0x34')]=_[_0xb641('0x33')](_0x420658['model'],qs['fields'](_0x163e0a['query'][_0xb641('0x35')]));_0x5ed630[_0xb641('0x34')]=_0x5ed630[_0xb641('0x34')][_0xb641('0x36')]?_0x5ed630[_0xb641('0x34')]:_0x420658[_0xb641('0x31')];if(!_0x163e0a[_0xb641('0x32')][_0xb641('0x37')](_0xb641('0x38'))){_0x5ed630[_0xb641('0x1e')]=qs[_0xb641('0x1e')](_0x163e0a[_0xb641('0x32')][_0xb641('0x1e')]);_0x5ed630[_0xb641('0x1d')]=qs['offset'](_0x163e0a[_0xb641('0x32')]['offset']);}_0x5ed630[_0xb641('0x39')]=qs[_0xb641('0x3a')](_0x163e0a[_0xb641('0x32')][_0xb641('0x3a')]);_0x5ed630[_0xb641('0x3b')]=qs[_0xb641('0x3c')](_[_0xb641('0x3d')](_0x163e0a[_0xb641('0x32')],_0x420658[_0xb641('0x3c')]));_0x5ed630['where'][_0xb641('0x5d')]=_0x2b65e3['id'];if(_0x163e0a['query'][_0xb641('0x3e')]){_0x5ed630[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x5ed630[_0xb641('0x3b')],{'$or':_[_0xb641('0x2d')](_0x5ed630['attributes'],function(_0x596314){var _0x37a268={};_0x37a268[_0x596314]={'$like':'%'+_0x163e0a['query']['filter']+'%'};return _0x37a268;})});}_0x5ed630=_[_0xb641('0x3f')]({},_0x5ed630,_0x163e0a['options']);return db['CmHopperFinal'][_0xb641('0x20')]({'where':_0x5ed630[_0xb641('0x3b')]})[_0xb641('0x25')](function(_0x2edcb9){_0x266d77[_0xb641('0x20')]=_0x2edcb9;if(_0x163e0a[_0xb641('0x32')][_0xb641('0x42')]){_0x5ed630['include']=[{'all':!![]}];}return db[_0xb641('0x61')][_0xb641('0x43')](_0x5ed630);})[_0xb641('0x25')](function(_0x3fcd56){_0x266d77['rows']=_0x3fcd56;return _0x266d77;});}})[_0xb641('0x25')](respondWithFilteredResult(_0x27fcf6,_0x5ed630))[_0xb641('0x45')](handleError(_0x27fcf6,null));};exports[_0xb641('0x62')]=function(_0x39943a,_0x15bc8d,_0x4c6a50){var _0x2800f9={'raw':!![],'where':{}};var _0x1731c5={};var _0x359b83={'count':0x0,'rows':[]};return db[_0xb641('0x2e')][_0xb641('0x5b')]({'where':{'id':_0x39943a['params']['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x15bc8d,null))[_0xb641('0x25')](function(_0x5bd846){if(_0x5bd846){_0x1731c5['model']=_['keys'](db['CmHopperBlack'][_0xb641('0x2f')]);_0x1731c5[_0xb641('0x32')]=_[_0xb641('0x48')](_0x39943a[_0xb641('0x32')]);_0x1731c5['filters']=_[_0xb641('0x33')](_0x1731c5[_0xb641('0x31')],_0x1731c5[_0xb641('0x32')]);_0x2800f9['attributes']=_[_0xb641('0x33')](_0x1731c5[_0xb641('0x31')],qs[_0xb641('0x35')](_0x39943a[_0xb641('0x32')]['fields']));_0x2800f9[_0xb641('0x34')]=_0x2800f9[_0xb641('0x34')][_0xb641('0x36')]?_0x2800f9[_0xb641('0x34')]:_0x1731c5['model'];if(!_0x39943a[_0xb641('0x32')][_0xb641('0x37')](_0xb641('0x38'))){_0x2800f9[_0xb641('0x1e')]=qs[_0xb641('0x1e')](_0x39943a['query'][_0xb641('0x1e')]);_0x2800f9[_0xb641('0x1d')]=qs[_0xb641('0x1d')](_0x39943a[_0xb641('0x32')][_0xb641('0x1d')]);}_0x2800f9['order']=qs[_0xb641('0x3a')](_0x39943a[_0xb641('0x32')]['sort']);_0x2800f9['where']=qs[_0xb641('0x3c')](_['pick'](_0x39943a['query'],_0x1731c5[_0xb641('0x3c')]));_0x2800f9[_0xb641('0x3b')]['CampaignId']=_0x5bd846['id'];if(_0x39943a[_0xb641('0x32')][_0xb641('0x3e')]){_0x2800f9[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x2800f9[_0xb641('0x3b')],{'$or':_['map'](_0x2800f9['attributes'],function(_0x3e57e8){var _0xcc0349={};_0xcc0349[_0x3e57e8]={'$like':'%'+_0x39943a[_0xb641('0x32')]['filter']+'%'};return _0xcc0349;})});}_0x2800f9=_[_0xb641('0x3f')]({},_0x2800f9,_0x39943a[_0xb641('0x41')]);return db[_0xb641('0x63')][_0xb641('0x20')]({'where':_0x2800f9[_0xb641('0x3b')]})[_0xb641('0x25')](function(_0x14c9bc){_0x359b83['count']=_0x14c9bc;if(_0x39943a[_0xb641('0x32')]['includeAll']){_0x2800f9[_0xb641('0x49')]=[{'all':!![]}];}return db[_0xb641('0x63')][_0xb641('0x43')](_0x2800f9);})[_0xb641('0x25')](function(_0x830923){_0x359b83[_0xb641('0x44')]=_0x830923;return _0x359b83;});}})[_0xb641('0x25')](respondWithFilteredResult(_0x15bc8d,_0x2800f9))['catch'](handleError(_0x15bc8d,null));};exports[_0xb641('0x64')]=function(_0x40efe3,_0x3474f6,_0x262ac3){var _0x36d785={};var _0x18b95c={};var _0xb1844b;var _0x3a8c5d;return db[_0xb641('0x2e')][_0xb641('0x5b')]({'where':{'id':_0x40efe3['params']['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x3474f6,null))[_0xb641('0x25')](function(_0x49deee){if(_0x49deee){_0xb1844b=_0x49deee;_0x18b95c[_0xb641('0x31')]=_[_0xb641('0x48')](db[_0xb641('0x65')]['rawAttributes']);_0x18b95c[_0xb641('0x32')]=_[_0xb641('0x48')](_0x40efe3[_0xb641('0x32')]);_0x18b95c[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x18b95c['model'],_0x18b95c[_0xb641('0x32')]);_0x36d785['attributes']=_[_0xb641('0x33')](_0x18b95c[_0xb641('0x31')],qs[_0xb641('0x35')](_0x40efe3[_0xb641('0x32')][_0xb641('0x35')]));_0x36d785[_0xb641('0x34')]=_0x36d785[_0xb641('0x34')][_0xb641('0x36')]?_0x36d785[_0xb641('0x34')]:_0x18b95c['model'];_0x36d785[_0xb641('0x39')]=qs['sort'](_0x40efe3[_0xb641('0x32')][_0xb641('0x3a')]);_0x36d785[_0xb641('0x3b')]=qs[_0xb641('0x3c')](_[_0xb641('0x3d')](_0x40efe3['query'],_0x18b95c[_0xb641('0x3c')]));if(_0x40efe3['query']['filter']){_0x36d785['where']=_[_0xb641('0x3f')](_0x36d785[_0xb641('0x3b')],{'$or':_[_0xb641('0x2d')](_0x36d785[_0xb641('0x34')],function(_0x52ed62){var _0x14ad36={};_0x14ad36[_0x52ed62]={'$like':'%'+_0x40efe3['query'][_0xb641('0x3e')]+'%'};return _0x14ad36;})});}_0x36d785=_[_0xb641('0x3f')]({},_0x36d785,_0x40efe3['options']);return _0xb1844b[_0xb641('0x64')](_0x36d785);}})[_0xb641('0x25')](function(_0x15dfe3){if(_0x15dfe3){_0x3a8c5d=_0x15dfe3[_0xb641('0x36')];if(!_0x40efe3['query'][_0xb641('0x37')](_0xb641('0x38'))){_0x36d785[_0xb641('0x1e')]=qs['limit'](_0x40efe3[_0xb641('0x32')][_0xb641('0x1e')]);_0x36d785[_0xb641('0x1d')]=qs['offset'](_0x40efe3['query'][_0xb641('0x1d')]);}return _0xb1844b[_0xb641('0x64')](_0x36d785);}})[_0xb641('0x25')](function(_0x4c29c0){if(_0x4c29c0){return _0x4c29c0?{'count':_0x3a8c5d,'rows':_0x4c29c0}:null;}})[_0xb641('0x25')](respondWithResult(_0x3474f6,null))[_0xb641('0x45')](handleError(_0x3474f6,null));};exports[_0xb641('0x66')]=function(_0x576b7f,_0x3cdb30,_0x5e6f74){var _0x3b4a6b,_0x264362;var _0x296ae8=[];var _0x4470f7=moment()[_0xb641('0x67')](_0xb641('0x68'));return db[_0xb641('0x2e')][_0xb641('0x4a')]({'where':{'id':_0x576b7f[_0xb641('0x47')]['id']}})['then'](handleEntityNotFound(_0x3cdb30,null))[_0xb641('0x25')](function(_0x5e7313){if(_0x5e7313){_0x264362=_0x5e7313;return _0x5e7313[_0xb641('0x66')](_0x576b7f[_0xb641('0x56')][_0xb641('0x69')],_[_0xb641('0x57')](_0x576b7f[_0xb641('0x56')],[_0xb641('0x69'),'id'])||{});}return null;})[_0xb641('0x6a')](function(_0x24c759){var _0x105c3f;var _0x2e38dc;_0x3b4a6b=_0x24c759||[];var _0x24fa34=[];if(_0x24c759){for(var _0x1f30cc=0x0;_0x1f30cc<_0x24c759['length'];_0x1f30cc+=0x1){var _0x11526e=_0x24c759[_0x1f30cc]['get']({'plain':!![]});_0x264362[_0xb641('0x6b')]=_0x576b7f[_0xb641('0x56')][_0xb641('0x6b')]?_0x576b7f[_0xb641('0x56')][_0xb641('0x6b')]:_0x264362['dialCheckDuplicateType'];switch(_0x264362['dialCheckDuplicateType']){case'always':_0x105c3f=squel[_0xb641('0x6c')]()[_0xb641('0x6d')](_0xb641('0x6e'))[_0xb641('0x6f')]([_0xb641('0x70'),_0xb641('0x71'),'ContactId',_0xb641('0x72'),_0xb641('0x5d'),'createdAt','updatedAt'],squel[_0xb641('0x73')]()[_0xb641('0x74')](_0xb641('0x70'),'phone')['field'](_0xb641('0x75'),_0xb641('0x71'))[_0xb641('0x74')]('id',_0xb641('0x76'))[_0xb641('0x74')](_0x11526e[_0xb641('0x77')]['toString'](),_0xb641('0x72'))[_0xb641('0x74')](_0x576b7f['params']['id'][_0xb641('0x78')](),_0xb641('0x5d'))[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27',_0xb641('0x54'))[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27','updatedAt')[_0xb641('0x79')](_0xb641('0x7a'))[_0xb641('0x3b')](_0xb641('0x7b'))[_0xb641('0x3b')](_0xb641('0x7c'),_0x11526e['CmListId'][_0xb641('0x78')]())[_0xb641('0x3b')](_0xb641('0x7d'))[_0xb641('0x3b')](_0xb641('0x7e'),squel[_0xb641('0x73')]()['field'](_0xb641('0x7f'))['from'](_0xb641('0x80'))[_0xb641('0x3b')](_0xb641('0x81'),_0x576b7f[_0xb641('0x47')]['id'][_0xb641('0x78')]()))[_0xb641('0x3b')](_0xb641('0x7e'),squel[_0xb641('0x73')]()[_0xb641('0x74')](_0xb641('0x82'))[_0xb641('0x79')](_0xb641('0x6e'))[_0xb641('0x3b')](_0xb641('0x81'),_0x576b7f['params']['id']['toString']())))['toString']();break;case _0xb641('0x83'):_0x105c3f=squel[_0xb641('0x6c')]()['into'](_0xb641('0x6e'))[_0xb641('0x6f')]([_0xb641('0x70'),_0xb641('0x71'),_0xb641('0x76'),_0xb641('0x72'),_0xb641('0x5d'),_0xb641('0x54'),'updatedAt'],squel['select']()[_0xb641('0x74')](_0xb641('0x70'),_0xb641('0x70'))[_0xb641('0x74')](_0xb641('0x75'),_0xb641('0x71'))[_0xb641('0x74')]('id','ContactId')[_0xb641('0x74')](_0x11526e[_0xb641('0x77')][_0xb641('0x78')](),_0xb641('0x72'))[_0xb641('0x74')](_0x576b7f[_0xb641('0x47')]['id'][_0xb641('0x78')](),_0xb641('0x5d'))['field']('\x27'+_0x4470f7+'\x27','createdAt')['field']('\x27'+_0x4470f7+'\x27',_0xb641('0x55'))[_0xb641('0x79')](_0xb641('0x7a'))[_0xb641('0x3b')](_0xb641('0x7b'))['where'](_0xb641('0x7c'),_0x11526e[_0xb641('0x77')][_0xb641('0x78')]())[_0xb641('0x3b')](_0xb641('0x7d'))[_0xb641('0x3b')](_0xb641('0x7e'),squel[_0xb641('0x73')]()[_0xb641('0x74')](_0xb641('0x82'))[_0xb641('0x79')](_0xb641('0x6e'))['where']('CampaignId\x20=\x20?',_0x576b7f[_0xb641('0x47')]['id'][_0xb641('0x78')]())))[_0xb641('0x78')]();break;default:_0x105c3f=squel[_0xb641('0x6c')]()[_0xb641('0x6d')](_0xb641('0x6e'))['fromQuery']([_0xb641('0x70'),_0xb641('0x71'),_0xb641('0x76'),_0xb641('0x72'),_0xb641('0x5d'),'createdAt','updatedAt'],squel[_0xb641('0x73')]()[_0xb641('0x74')](_0xb641('0x70'),_0xb641('0x70'))[_0xb641('0x74')](_0xb641('0x75'),_0xb641('0x71'))[_0xb641('0x74')]('id',_0xb641('0x76'))[_0xb641('0x74')](_0x11526e['CmListId'][_0xb641('0x78')](),'ListId')['field'](_0x576b7f[_0xb641('0x47')]['id'][_0xb641('0x78')](),_0xb641('0x5d'))[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27',_0xb641('0x54'))[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27','updatedAt')[_0xb641('0x79')](_0xb641('0x7a'))[_0xb641('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0xb641('0x7c'),_0x11526e['CmListId']['toString']())[_0xb641('0x3b')](_0xb641('0x7d')))[_0xb641('0x78')]();}_0x2e38dc=squel['insert']()[_0xb641('0x6d')]('cm_hopper_additional_phones')['fromQuery']([_0xb641('0x84'),_0xb641('0x71'),_0xb641('0x70'),_0xb641('0x85'),'createdAt',_0xb641('0x55')],squel[_0xb641('0x73')]()['field'](_0xb641('0x86'),'id')[_0xb641('0x74')](_0xb641('0x75'),'scheduledAt')[_0xb641('0x74')]('ci.item',_0xb641('0x70'))[_0xb641('0x74')](_0xb641('0x87'),_0xb641('0x85'))[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27','createdAt')[_0xb641('0x74')]('\x27'+_0x4470f7+'\x27',_0xb641('0x55'))[_0xb641('0x79')](_0xb641('0x88'),'ci')[_0xb641('0x89')]('cm_hopper','h',_0xb641('0x8a'))[_0xb641('0x3b')](_0xb641('0x8b'),_0x11526e['CmListId'][_0xb641('0x78')]())['where'](_0xb641('0x8c'),_0x576b7f[_0xb641('0x47')]['id'][_0xb641('0x78')]())['where'](_0xb641('0x8d'),_0x4470f7))[_0xb641('0x78')]();_0x24fa34[_0xb641('0x8e')](db['sequelize']['query'](_0x105c3f));_0x296ae8['push'](db['sequelize'][_0xb641('0x32')](_0x2e38dc));}return BPromise[_0xb641('0x8f')](_0x24fa34);}})[_0xb641('0x25')](function(){return BPromise[_0xb641('0x8f')](_0x296ae8);})[_0xb641('0x25')](function(){return _0x3b4a6b;})[_0xb641('0x25')](respondWithResult(_0x3cdb30,null))[_0xb641('0x45')](handleError(_0x3cdb30,null));};exports[_0xb641('0x90')]=function(_0x1f31a2,_0x46e64e,_0xe03443){return db['Campaign'][_0xb641('0x4a')]({'where':{'id':_0x1f31a2[_0xb641('0x47')]['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x46e64e,null))[_0xb641('0x25')](function(_0xc5c987){if(_0xc5c987){return _0xc5c987[_0xb641('0x90')](_0x1f31a2[_0xb641('0x32')][_0xb641('0x69')]);}})['then'](function(_0x3b69de){if(_0x3b69de){return db[_0xb641('0x5c')][_0xb641('0x24')]({'where':{'ListId':_0x1f31a2[_0xb641('0x32')][_0xb641('0x69')],'CampaignId':_0x1f31a2[_0xb641('0x47')]['id']}})[_0xb641('0x25')](function(){return _0x3b69de;});}})[_0xb641('0x25')](respondWithStatusCode(_0x46e64e,null))[_0xb641('0x45')](handleError(_0x46e64e,null));};exports['getBlackLists']=function(_0x3fca48,_0xa09415,_0x106a46){var _0x12e3cf={};var _0x59063b={};var _0x294f85;var _0x4cc0a0;return db[_0xb641('0x2e')][_0xb641('0x5b')]({'where':{'id':_0x3fca48[_0xb641('0x47')]['id']}})['then'](handleEntityNotFound(_0xa09415,null))[_0xb641('0x25')](function(_0x349da9){if(_0x349da9){_0x294f85=_0x349da9;_0x59063b[_0xb641('0x31')]=_[_0xb641('0x48')](db[_0xb641('0x65')][_0xb641('0x2f')]);_0x59063b[_0xb641('0x32')]=_[_0xb641('0x48')](_0x3fca48[_0xb641('0x32')]);_0x59063b[_0xb641('0x3c')]=_[_0xb641('0x33')](_0x59063b[_0xb641('0x31')],_0x59063b[_0xb641('0x32')]);_0x12e3cf[_0xb641('0x34')]=_[_0xb641('0x33')](_0x59063b['model'],qs[_0xb641('0x35')](_0x3fca48[_0xb641('0x32')]['fields']));_0x12e3cf['attributes']=_0x12e3cf[_0xb641('0x34')][_0xb641('0x36')]?_0x12e3cf['attributes']:_0x59063b[_0xb641('0x31')];_0x12e3cf['order']=qs[_0xb641('0x3a')](_0x3fca48[_0xb641('0x32')][_0xb641('0x3a')]);_0x12e3cf[_0xb641('0x3b')]=qs['filters'](_[_0xb641('0x3d')](_0x3fca48[_0xb641('0x32')],_0x59063b[_0xb641('0x3c')]));if(_0x3fca48['query'][_0xb641('0x3e')]){_0x12e3cf[_0xb641('0x3b')]=_[_0xb641('0x3f')](_0x12e3cf['where'],{'$or':_['map'](_0x12e3cf[_0xb641('0x34')],function(_0x66883c){var _0x5fdd19={};_0x5fdd19[_0x66883c]={'$like':'%'+_0x3fca48[_0xb641('0x32')]['filter']+'%'};return _0x5fdd19;})});}_0x12e3cf=_[_0xb641('0x3f')]({},_0x12e3cf,_0x3fca48[_0xb641('0x41')]);return _0x294f85[_0xb641('0x91')](_0x12e3cf);}})[_0xb641('0x25')](function(_0x49283a){if(_0x49283a){_0x4cc0a0=_0x49283a[_0xb641('0x36')];if(!_0x3fca48[_0xb641('0x32')]['hasOwnProperty'](_0xb641('0x38'))){_0x12e3cf[_0xb641('0x1e')]=qs['limit'](_0x3fca48[_0xb641('0x32')][_0xb641('0x1e')]);_0x12e3cf[_0xb641('0x1d')]=qs[_0xb641('0x1d')](_0x3fca48[_0xb641('0x32')][_0xb641('0x1d')]);}return _0x294f85[_0xb641('0x91')](_0x12e3cf);}})[_0xb641('0x25')](function(_0x56e865){if(_0x56e865){return _0x56e865?{'count':_0x4cc0a0,'rows':_0x56e865}:null;}})[_0xb641('0x25')](respondWithResult(_0xa09415,null))['catch'](handleError(_0xa09415,null));};exports[_0xb641('0x92')]=function(_0x4f9f6f,_0x27e613,_0x55f3b8){var _0x2a97b3,_0x2f4914;var _0x4c4f5d=[];var _0x17f325=moment()['format'](_0xb641('0x68'));return db[_0xb641('0x2e')][_0xb641('0x4a')]({'where':{'id':_0x4f9f6f['params']['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x27e613,null))['then'](function(_0x3b88dd){if(_0x3b88dd){_0x2f4914=_0x3b88dd;return _0x3b88dd[_0xb641('0x92')](_0x4f9f6f[_0xb641('0x56')][_0xb641('0x69')],_[_0xb641('0x57')](_0x4f9f6f['body'],[_0xb641('0x69'),'id'])||{});}return null;})[_0xb641('0x6a')](function(_0x4b4531){var _0x5a8e51;var _0x481cab;_0x2a97b3=_0x4b4531||[];var _0x18face=[];if(_0x4b4531){for(var _0x42e3af=0x0;_0x42e3af<_0x4b4531[_0xb641('0x36')];_0x42e3af+=0x1){var _0x175127=_0x4b4531[_0x42e3af][_0xb641('0x26')]({'plain':!![]});_0x5a8e51=squel[_0xb641('0x6c')]()[_0xb641('0x6d')](_0xb641('0x93'))[_0xb641('0x6f')](['phone',_0xb641('0x76'),_0xb641('0x72'),_0xb641('0x5d'),_0xb641('0x54'),'updatedAt'],squel[_0xb641('0x73')]()[_0xb641('0x74')]('phone',_0xb641('0x70'))[_0xb641('0x74')]('id',_0xb641('0x76'))[_0xb641('0x74')](_0x175127[_0xb641('0x77')][_0xb641('0x78')](),_0xb641('0x72'))[_0xb641('0x74')](_0x4f9f6f[_0xb641('0x47')]['id'][_0xb641('0x78')](),_0xb641('0x5d'))[_0xb641('0x74')]('NOW()',_0xb641('0x54'))[_0xb641('0x74')]('NOW()',_0xb641('0x55'))[_0xb641('0x79')](_0xb641('0x7a'))[_0xb641('0x3b')](_0xb641('0x7b'))[_0xb641('0x3b')](_0xb641('0x7c'),_0x175127[_0xb641('0x77')][_0xb641('0x78')]())[_0xb641('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0xb641('0x78')]();_0x18face['push'](db[_0xb641('0x94')][_0xb641('0x32')](_0x5a8e51));}return BPromise[_0xb641('0x8f')](_0x18face);}})[_0xb641('0x25')](function(){return _0x2a97b3;})['then'](respondWithResult(_0x27e613,null))[_0xb641('0x45')](handleError(_0x27e613,null));};exports[_0xb641('0x95')]=function(_0x27c650,_0x4b75a4,_0x3ed484){return db['Campaign'][_0xb641('0x4a')]({'where':{'id':_0x27c650[_0xb641('0x47')]['id']}})[_0xb641('0x25')](handleEntityNotFound(_0x4b75a4,null))[_0xb641('0x25')](function(_0x195488){if(_0x195488){return _0x195488[_0xb641('0x95')](_0x27c650[_0xb641('0x32')][_0xb641('0x69')]);}})[_0xb641('0x25')](function(_0x3affce){if(_0x3affce){return db[_0xb641('0x63')][_0xb641('0x24')]({'where':{'ListId':_0x27c650[_0xb641('0x32')][_0xb641('0x69')],'CampaignId':_0x27c650[_0xb641('0x47')]['id']}})[_0xb641('0x25')](function(){return _0x3affce;});}})[_0xb641('0x25')](respondWithStatusCode(_0x4b75a4,null))['catch'](handleError(_0x4b75a4,null));}; \ No newline at end of file +var _0x0d90=['sequelize','all','removeLists','ids','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','count','limit','status','set','json','reject','update','then','get','IvrCampaigns','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','order','sort','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CampaignId','CmList','getLists','addLists','format','omit','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?'];(function(_0x5ca357,_0x558c33){var _0x5b0287=function(_0xe44927){while(--_0xe44927){_0x5ca357['push'](_0x5ca357['shift']());}};_0x5b0287(++_0x558c33);}(_0x0d90,0xa0));var _0x00d9=function(_0x20fa83,_0x1a38e9){_0x20fa83=_0x20fa83-0x0;var _0x18ab58=_0x0d90[_0x20fa83];return _0x18ab58;};'use strict';var emlformat=require(_0x00d9('0x0'));var rimraf=require(_0x00d9('0x1'));var zipdir=require(_0x00d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00d9('0x3'));var moment=require(_0x00d9('0x4'));var BPromise=require(_0x00d9('0x5'));var Mustache=require('mustache');var util=require(_0x00d9('0x6'));var path=require(_0x00d9('0x7'));var sox=require(_0x00d9('0x8'));var csv=require(_0x00d9('0x9'));var ejs=require(_0x00d9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00d9('0xb'));var squel=require(_0x00d9('0xc'));var crypto=require(_0x00d9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x00d9('0xe'));var toCsv=require(_0x00d9('0x9'));var querystring=require('querystring');var Papa=require(_0x00d9('0xf'));var Redis=require(_0x00d9('0x10'));var authService=require(_0x00d9('0x11'));var qs=require(_0x00d9('0x12'));var as=require(_0x00d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00d9('0x14'))(_0x00d9('0x15'));var utils=require(_0x00d9('0x16'));var config=require(_0x00d9('0x17'));var licenseUtil=require(_0x00d9('0x18'));var db=require(_0x00d9('0x19'))['db'];function respondWithStatusCode(_0x217b29,_0xca42d8){_0xca42d8=_0xca42d8||0xcc;return function(_0x498346){if(_0x498346){return _0x217b29['sendStatus'](_0xca42d8);}return _0x217b29['status'](_0xca42d8)[_0x00d9('0x1a')]();};}function respondWithResult(_0x3fab95,_0x49f0b0){_0x49f0b0=_0x49f0b0||0xc8;return function(_0x4b0719){if(_0x4b0719){return _0x3fab95['status'](_0x49f0b0)['json'](_0x4b0719);}};}function respondWithFilteredResult(_0x2bf2d8,_0x476d19){return function(_0xccb344){if(_0xccb344){var _0x15206b=typeof _0x476d19[_0x00d9('0x1b')]===_0x00d9('0x1c')&&typeof _0x476d19['limit']===_0x00d9('0x1c');var _0x3bd27d=_0xccb344[_0x00d9('0x1d')];var _0x3fe22e=_0x15206b?0x0:_0x476d19[_0x00d9('0x1b')];var _0x53ddec=_0x15206b?_0xccb344[_0x00d9('0x1d')]:_0x476d19[_0x00d9('0x1b')]+_0x476d19[_0x00d9('0x1e')];var _0x109088;if(_0x53ddec>=_0x3bd27d){_0x53ddec=_0x3bd27d;_0x109088=0xc8;}else{_0x109088=0xce;}_0x2bf2d8[_0x00d9('0x1f')](_0x109088);return _0x2bf2d8[_0x00d9('0x20')]('Content-Range',_0x3fe22e+'-'+_0x53ddec+'/'+_0x3bd27d)[_0x00d9('0x21')](_0xccb344);}return null;};}function patchUpdates(_0x3124e3){return function(_0x163e82){try{jsonpatch['apply'](_0x163e82,_0x3124e3,!![]);}catch(_0x250944){return BPromise[_0x00d9('0x22')](_0x250944);}return _0x163e82['save']();};}function saveUpdates(_0x269cc9,_0x425f97){return function(_0x45007a){if(_0x45007a){return _0x45007a[_0x00d9('0x23')](_0x269cc9)[_0x00d9('0x24')](function(_0x26ab9a){return _0x26ab9a;});}return null;};}function removeEntity(_0x5e7482,_0x571a21){return function(_0x35101a){if(_0x35101a){return _0x35101a['destroy']()[_0x00d9('0x24')](function(){var _0xf06159=_0x35101a[_0x00d9('0x25')]({'plain':!![]});var _0x3542c5=_0x00d9('0x26');return db[_0x00d9('0x27')][_0x00d9('0x28')]({'where':{'type':_0x3542c5,'resourceId':_0xf06159['id']}})[_0x00d9('0x24')](function(){return _0x35101a;});})[_0x00d9('0x24')](function(){_0x5e7482[_0x00d9('0x1f')](0xcc)[_0x00d9('0x1a')]();});}};}function handleEntityNotFound(_0x54f100,_0x1a3989){return function(_0x5c5938){if(!_0x5c5938){_0x54f100[_0x00d9('0x29')](0x194);}return _0x5c5938;};}function handleError(_0x198fb7,_0x134662){_0x134662=_0x134662||0x1f4;return function(_0x2ec808){logger[_0x00d9('0x2a')](_0x2ec808[_0x00d9('0x2b')]);if(_0x2ec808[_0x00d9('0x2c')]){delete _0x2ec808[_0x00d9('0x2c')];}_0x198fb7[_0x00d9('0x1f')](_0x134662)[_0x00d9('0x2d')](_0x2ec808);};}exports[_0x00d9('0x2e')]=function(_0x2bdb60,_0x38eb09){var _0x496c97={},_0x22d89a={},_0x412210={'count':0x0,'rows':[]};var _0x341da1=_[_0x00d9('0x2f')](db['Campaign'][_0x00d9('0x30')],function(_0x2cad65){return{'name':_0x2cad65['fieldName'],'type':_0x2cad65[_0x00d9('0x31')][_0x00d9('0x32')]};});_0x22d89a[_0x00d9('0x33')]=_[_0x00d9('0x2f')](_0x341da1,_0x00d9('0x2c'));_0x22d89a[_0x00d9('0x34')]=_[_0x00d9('0x35')](_0x2bdb60['query']);_0x22d89a[_0x00d9('0x36')]=_[_0x00d9('0x37')](_0x22d89a[_0x00d9('0x33')],_0x22d89a[_0x00d9('0x34')]);_0x496c97[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x22d89a[_0x00d9('0x33')],qs['fields'](_0x2bdb60[_0x00d9('0x34')][_0x00d9('0x39')]));_0x496c97[_0x00d9('0x38')]=_0x496c97[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x496c97[_0x00d9('0x38')]:_0x22d89a[_0x00d9('0x33')];if(!_0x2bdb60[_0x00d9('0x34')]['hasOwnProperty']('nolimit')){_0x496c97[_0x00d9('0x1e')]=qs[_0x00d9('0x1e')](_0x2bdb60[_0x00d9('0x34')]['limit']);_0x496c97[_0x00d9('0x1b')]=qs[_0x00d9('0x1b')](_0x2bdb60[_0x00d9('0x34')][_0x00d9('0x1b')]);}_0x496c97['order']=qs['sort'](_0x2bdb60[_0x00d9('0x34')]['sort']);_0x496c97[_0x00d9('0x3b')]=qs['filters'](_[_0x00d9('0x3c')](_0x2bdb60[_0x00d9('0x34')],_0x22d89a[_0x00d9('0x36')]),_0x341da1);if(_0x2bdb60[_0x00d9('0x34')][_0x00d9('0x3d')]){_0x496c97[_0x00d9('0x3b')]=_[_0x00d9('0x3e')](_0x496c97['where'],{'$or':_[_0x00d9('0x2f')](_0x341da1,function(_0x2029aa){if(_0x2029aa[_0x00d9('0x31')]!==_0x00d9('0x3f')){var _0x1b7c3a={};_0x1b7c3a[_0x2029aa[_0x00d9('0x2c')]]={'$like':'%'+_0x2bdb60[_0x00d9('0x34')]['filter']+'%'};return _0x1b7c3a;}})});}_0x496c97=_[_0x00d9('0x3e')]({},_0x496c97,_0x2bdb60[_0x00d9('0x40')]);var _0x402c42={'where':_0x496c97['where']};return db[_0x00d9('0x41')][_0x00d9('0x1d')](_0x402c42)[_0x00d9('0x24')](function(_0x41e786){_0x412210[_0x00d9('0x1d')]=_0x41e786;if(_0x2bdb60[_0x00d9('0x34')][_0x00d9('0x42')]){_0x496c97[_0x00d9('0x43')]=[{'all':!![]}];}return db['Campaign'][_0x00d9('0x44')](_0x496c97);})[_0x00d9('0x24')](function(_0x40252d){_0x412210['rows']=_0x40252d;return _0x412210;})[_0x00d9('0x24')](respondWithFilteredResult(_0x38eb09,_0x496c97))[_0x00d9('0x45')](handleError(_0x38eb09,null));};exports[_0x00d9('0x46')]=function(_0x2f4eb3,_0x1682d9){var _0x4276b9={'raw':![],'where':{'id':_0x2f4eb3['params']['id']}},_0x2bf5a5={};_0x2bf5a5[_0x00d9('0x33')]=_['keys'](db[_0x00d9('0x41')]['rawAttributes']);_0x2bf5a5[_0x00d9('0x34')]=_[_0x00d9('0x35')](_0x2f4eb3[_0x00d9('0x34')]);_0x2bf5a5['filters']=_[_0x00d9('0x37')](_0x2bf5a5[_0x00d9('0x33')],_0x2bf5a5[_0x00d9('0x34')]);_0x4276b9[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x2bf5a5[_0x00d9('0x33')],qs['fields'](_0x2f4eb3['query']['fields']));_0x4276b9['attributes']=_0x4276b9['attributes'][_0x00d9('0x3a')]?_0x4276b9[_0x00d9('0x38')]:_0x2bf5a5[_0x00d9('0x33')];if(_0x2f4eb3[_0x00d9('0x34')][_0x00d9('0x42')]){_0x4276b9[_0x00d9('0x43')]=[{'all':!![]}];}_0x4276b9=_[_0x00d9('0x3e')]({},_0x4276b9,_0x2f4eb3[_0x00d9('0x40')]);return db['Campaign'][_0x00d9('0x47')](_0x4276b9)['then'](handleEntityNotFound(_0x1682d9,null))[_0x00d9('0x24')](respondWithResult(_0x1682d9,null))['catch'](handleError(_0x1682d9,null));};exports[_0x00d9('0x48')]=function(_0x56c419,_0x21ad43){return db[_0x00d9('0x41')][_0x00d9('0x48')](_0x56c419[_0x00d9('0x49')],{})['then'](function(_0x4ece35){var _0x1c7f00=_0x56c419[_0x00d9('0x4a')][_0x00d9('0x25')]({'plain':!![]});if(!_0x1c7f00)throw new Error(_0x00d9('0x4b'));if(_0x1c7f00[_0x00d9('0x4c')]==='user'){var _0x59b6e3=_0x4ece35[_0x00d9('0x25')]({'plain':!![]});var _0x37fb98='IvrCampaigns';return db['UserProfileSection'][_0x00d9('0x47')]({'where':{'name':_0x37fb98,'userProfileId':_0x1c7f00[_0x00d9('0x4d')]},'raw':!![]})[_0x00d9('0x24')](function(_0x5a367b){if(_0x5a367b&&_0x5a367b[_0x00d9('0x4e')]===0x0){return db[_0x00d9('0x27')][_0x00d9('0x48')]({'name':_0x59b6e3[_0x00d9('0x2c')],'resourceId':_0x59b6e3['id'],'type':_0x5a367b[_0x00d9('0x2c')],'sectionId':_0x5a367b['id']},{})['then'](function(){return _0x4ece35;});}else{return _0x4ece35;}})[_0x00d9('0x45')](function(_0x4dda73){logger[_0x00d9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dda73);throw _0x4dda73;});}return _0x4ece35;})[_0x00d9('0x24')](respondWithResult(_0x21ad43,0xc9))[_0x00d9('0x45')](handleError(_0x21ad43,null));};exports['clone']=function(_0x69beda,_0x22898d){var _0x2fa4e8={'where':{'id':_0x69beda[_0x00d9('0x4f')]['id']}},_0x1091cc={};_0x1091cc['model']=_['keys'](db[_0x00d9('0x41')][_0x00d9('0x30')]);_0x2fa4e8[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x1091cc[_0x00d9('0x33')],qs[_0x00d9('0x39')](_0x69beda[_0x00d9('0x34')][_0x00d9('0x39')]));_0x2fa4e8['attributes']=_0x2fa4e8[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x2fa4e8[_0x00d9('0x38')]:_0x1091cc['model'];if(_0x69beda['query'][_0x00d9('0x42')]){_0x2fa4e8[_0x00d9('0x43')]=[{'all':!![]}];}_0x2fa4e8=_[_0x00d9('0x3e')]({},_0x2fa4e8,_0x69beda['options']);return db['Campaign']['find'](_0x2fa4e8)[_0x00d9('0x24')](handleEntityNotFound(_0x22898d,null))[_0x00d9('0x24')](function(_0x2de9a5){if(_0x2de9a5){var _0x34ee8b=_0x2de9a5[_0x00d9('0x25')]({'plain':!![]});_0x34ee8b=qs['omit'](_0x34ee8b,['id',_0x00d9('0x50'),_0x00d9('0x51')]);_0x69beda['body']=_['omit'](_0x69beda[_0x00d9('0x49')],['id',_0x00d9('0x50'),_0x00d9('0x51')]);return db['Campaign'][_0x00d9('0x48')](_[_0x00d9('0x3e')](_0x34ee8b,_0x69beda['body']),{'include':_0x69beda[_0x00d9('0x34')][_0x00d9('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x2e5c91){var _0x2edb62=_0x69beda[_0x00d9('0x4a')][_0x00d9('0x25')]({'plain':!![]});if(!_0x2edb62)throw new Error(_0x00d9('0x4b'));if(_0x2edb62[_0x00d9('0x4c')]===_0x00d9('0x4a')){var _0x19a9ef=_0x2e5c91['get']({'plain':!![]});var _0x503f96=_0x00d9('0x26');return db['UserProfileSection'][_0x00d9('0x47')]({'where':{'name':_0x503f96,'userProfileId':_0x2edb62[_0x00d9('0x4d')]},'raw':!![]})[_0x00d9('0x24')](function(_0x406c49){if(_0x406c49&&_0x406c49[_0x00d9('0x4e')]===0x0){return db[_0x00d9('0x27')][_0x00d9('0x48')]({'name':_0x19a9ef['name'],'resourceId':_0x19a9ef['id'],'type':_0x406c49[_0x00d9('0x2c')],'sectionId':_0x406c49['id']},{})[_0x00d9('0x24')](function(){return _0x2e5c91;});}else{return _0x2e5c91;}})[_0x00d9('0x45')](function(_0x271d0b){logger[_0x00d9('0x2a')](_0x00d9('0x52'),_0x271d0b);throw _0x271d0b;});}return _0x2e5c91;});}})['then'](respondWithResult(_0x22898d,0xc9))['catch'](handleError(_0x22898d,null));};exports[_0x00d9('0x23')]=function(_0x17e874,_0x3884a4){if(_0x17e874[_0x00d9('0x49')]['id']){delete _0x17e874[_0x00d9('0x49')]['id'];}return db['Campaign']['find']({'where':{'id':_0x17e874[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x3884a4,null))['then'](saveUpdates(_0x17e874['body'],null))['then'](respondWithResult(_0x3884a4,null))['catch'](handleError(_0x3884a4,null));};exports['destroy']=function(_0x31aa4c,_0x39dbe2){return db[_0x00d9('0x41')][_0x00d9('0x47')]({'where':{'id':_0x31aa4c[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x39dbe2,null))['then'](removeEntity(_0x39dbe2,null))[_0x00d9('0x45')](handleError(_0x39dbe2,null));};exports[_0x00d9('0x53')]=function(_0x28bd00,_0xe1bc88,_0x4e30c9){var _0x458231={'raw':!![],'where':{}};var _0x1d89bf={};var _0x32ba9d={'count':0x0,'rows':[]};return db['Campaign'][_0x00d9('0x54')]({'where':{'id':_0x28bd00['params']['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0xe1bc88,null))['then'](function(_0x3f65cd){if(_0x3f65cd){_0x1d89bf['model']=_['keys'](db[_0x00d9('0x55')][_0x00d9('0x30')]);_0x1d89bf['query']=_['keys'](_0x28bd00[_0x00d9('0x34')]);_0x1d89bf[_0x00d9('0x36')]=_['intersection'](_0x1d89bf['model'],_0x1d89bf[_0x00d9('0x34')]);_0x458231[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x1d89bf[_0x00d9('0x33')],qs[_0x00d9('0x39')](_0x28bd00[_0x00d9('0x34')][_0x00d9('0x39')]));_0x458231[_0x00d9('0x38')]=_0x458231['attributes'][_0x00d9('0x3a')]?_0x458231['attributes']:_0x1d89bf['model'];if(!_0x28bd00[_0x00d9('0x34')][_0x00d9('0x56')](_0x00d9('0x57'))){_0x458231[_0x00d9('0x1e')]=qs['limit'](_0x28bd00['query'][_0x00d9('0x1e')]);_0x458231[_0x00d9('0x1b')]=qs[_0x00d9('0x1b')](_0x28bd00[_0x00d9('0x34')][_0x00d9('0x1b')]);}_0x458231[_0x00d9('0x58')]=qs[_0x00d9('0x59')](_0x28bd00[_0x00d9('0x34')]['sort']);_0x458231[_0x00d9('0x3b')]=qs[_0x00d9('0x36')](_['pick'](_0x28bd00['query'],_0x1d89bf[_0x00d9('0x36')]));_0x458231[_0x00d9('0x3b')]['CampaignId']=_0x3f65cd['id'];if(_0x28bd00['query'][_0x00d9('0x3d')]){_0x458231['where']=_[_0x00d9('0x3e')](_0x458231['where'],{'$or':_[_0x00d9('0x2f')](_0x458231[_0x00d9('0x38')],function(_0x50d46e){var _0x22d0dc={};_0x22d0dc[_0x50d46e]={'$like':'%'+_0x28bd00['query']['filter']+'%'};return _0x22d0dc;})});}_0x458231=_['merge']({},_0x458231,_0x28bd00[_0x00d9('0x40')]);return db[_0x00d9('0x55')][_0x00d9('0x1d')]({'where':_0x458231[_0x00d9('0x3b')]})[_0x00d9('0x24')](function(_0x146f1d){_0x32ba9d[_0x00d9('0x1d')]=_0x146f1d;if(_0x28bd00[_0x00d9('0x34')][_0x00d9('0x42')]){_0x458231[_0x00d9('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x458231);})['then'](function(_0xf09637){_0x32ba9d[_0x00d9('0x5a')]=_0xf09637;return _0x32ba9d;});}})[_0x00d9('0x24')](respondWithFilteredResult(_0xe1bc88,_0x458231))[_0x00d9('0x45')](handleError(_0xe1bc88,null));};exports[_0x00d9('0x5b')]=function(_0x5a51d8,_0x555dec,_0x540d3d){var _0x47615b={'raw':!![],'where':{}};var _0x5887a6={};var _0x513641={'count':0x0,'rows':[]};return db['Campaign'][_0x00d9('0x54')]({'where':{'id':_0x5a51d8[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x555dec,null))[_0x00d9('0x24')](function(_0x1c214c){if(_0x1c214c){_0x5887a6[_0x00d9('0x33')]=_[_0x00d9('0x35')](db[_0x00d9('0x5c')][_0x00d9('0x30')]);_0x5887a6[_0x00d9('0x34')]=_['keys'](_0x5a51d8[_0x00d9('0x34')]);_0x5887a6['filters']=_[_0x00d9('0x37')](_0x5887a6['model'],_0x5887a6[_0x00d9('0x34')]);_0x47615b[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x5887a6[_0x00d9('0x33')],qs[_0x00d9('0x39')](_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x39')]));_0x47615b[_0x00d9('0x38')]=_0x47615b[_0x00d9('0x38')]['length']?_0x47615b['attributes']:_0x5887a6[_0x00d9('0x33')];if(!_0x5a51d8['query'][_0x00d9('0x56')]('nolimit')){_0x47615b[_0x00d9('0x1e')]=qs[_0x00d9('0x1e')](_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x1e')]);_0x47615b[_0x00d9('0x1b')]=qs[_0x00d9('0x1b')](_0x5a51d8[_0x00d9('0x34')]['offset']);}_0x47615b['order']=qs[_0x00d9('0x59')](_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x59')]);_0x47615b[_0x00d9('0x3b')]=qs[_0x00d9('0x36')](_[_0x00d9('0x3c')](_0x5a51d8[_0x00d9('0x34')],_0x5887a6[_0x00d9('0x36')]));_0x47615b[_0x00d9('0x3b')]['CampaignId']=_0x1c214c['id'];if(_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x3d')]){_0x47615b[_0x00d9('0x3b')]=_[_0x00d9('0x3e')](_0x47615b['where'],{'$or':_[_0x00d9('0x2f')](_0x47615b['attributes'],function(_0x4dca48){var _0x31c400={};_0x31c400[_0x4dca48]={'$like':'%'+_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x3d')]+'%'};return _0x31c400;})});}_0x47615b=_['merge']({},_0x47615b,_0x5a51d8[_0x00d9('0x40')]);return db[_0x00d9('0x5c')]['count']({'where':_0x47615b['where']})[_0x00d9('0x24')](function(_0x4db569){_0x513641[_0x00d9('0x1d')]=_0x4db569;if(_0x5a51d8[_0x00d9('0x34')][_0x00d9('0x42')]){_0x47615b['include']=[{'all':!![]}];}return db[_0x00d9('0x5c')][_0x00d9('0x44')](_0x47615b);})[_0x00d9('0x24')](function(_0x15a6d1){_0x513641[_0x00d9('0x5a')]=_0x15a6d1;return _0x513641;});}})[_0x00d9('0x24')](respondWithFilteredResult(_0x555dec,_0x47615b))[_0x00d9('0x45')](handleError(_0x555dec,null));};exports[_0x00d9('0x5d')]=function(_0x264419,_0x2d5561,_0x4b34a3){var _0x28bf78={'raw':!![],'where':{}};var _0x3fae3a={};var _0x14ce17={'count':0x0,'rows':[]};return db[_0x00d9('0x41')][_0x00d9('0x54')]({'where':{'id':_0x264419[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x2d5561,null))['then'](function(_0x46c6e2){if(_0x46c6e2){_0x3fae3a[_0x00d9('0x33')]=_['keys'](db[_0x00d9('0x5e')][_0x00d9('0x30')]);_0x3fae3a['query']=_[_0x00d9('0x35')](_0x264419[_0x00d9('0x34')]);_0x3fae3a[_0x00d9('0x36')]=_[_0x00d9('0x37')](_0x3fae3a[_0x00d9('0x33')],_0x3fae3a[_0x00d9('0x34')]);_0x28bf78[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x3fae3a[_0x00d9('0x33')],qs['fields'](_0x264419['query'][_0x00d9('0x39')]));_0x28bf78[_0x00d9('0x38')]=_0x28bf78[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x28bf78[_0x00d9('0x38')]:_0x3fae3a[_0x00d9('0x33')];if(!_0x264419[_0x00d9('0x34')]['hasOwnProperty'](_0x00d9('0x57'))){_0x28bf78[_0x00d9('0x1e')]=qs[_0x00d9('0x1e')](_0x264419[_0x00d9('0x34')][_0x00d9('0x1e')]);_0x28bf78[_0x00d9('0x1b')]=qs['offset'](_0x264419[_0x00d9('0x34')][_0x00d9('0x1b')]);}_0x28bf78[_0x00d9('0x58')]=qs[_0x00d9('0x59')](_0x264419[_0x00d9('0x34')][_0x00d9('0x59')]);_0x28bf78[_0x00d9('0x3b')]=qs['filters'](_[_0x00d9('0x3c')](_0x264419['query'],_0x3fae3a[_0x00d9('0x36')]));_0x28bf78['where']['CampaignId']=_0x46c6e2['id'];if(_0x264419[_0x00d9('0x34')][_0x00d9('0x3d')]){_0x28bf78[_0x00d9('0x3b')]=_['merge'](_0x28bf78[_0x00d9('0x3b')],{'$or':_['map'](_0x28bf78[_0x00d9('0x38')],function(_0x6a8013){var _0x20f6c6={};_0x20f6c6[_0x6a8013]={'$like':'%'+_0x264419[_0x00d9('0x34')][_0x00d9('0x3d')]+'%'};return _0x20f6c6;})});}_0x28bf78=_[_0x00d9('0x3e')]({},_0x28bf78,_0x264419[_0x00d9('0x40')]);return db[_0x00d9('0x5e')][_0x00d9('0x1d')]({'where':_0x28bf78[_0x00d9('0x3b')]})[_0x00d9('0x24')](function(_0xa18c19){_0x14ce17[_0x00d9('0x1d')]=_0xa18c19;if(_0x264419['query'][_0x00d9('0x42')]){_0x28bf78['include']=[{'all':!![]}];}return db[_0x00d9('0x5e')][_0x00d9('0x44')](_0x28bf78);})[_0x00d9('0x24')](function(_0x61fbe9){_0x14ce17['rows']=_0x61fbe9;return _0x14ce17;});}})[_0x00d9('0x24')](respondWithFilteredResult(_0x2d5561,_0x28bf78))[_0x00d9('0x45')](handleError(_0x2d5561,null));};exports[_0x00d9('0x5f')]=function(_0x523395,_0x57af31,_0x31e86b){var _0x45bc1d={'raw':!![],'where':{}};var _0x56e500={};var _0x37c558={'count':0x0,'rows':[]};return db[_0x00d9('0x41')][_0x00d9('0x54')]({'where':{'id':_0x523395['params']['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x57af31,null))[_0x00d9('0x24')](function(_0xb20996){if(_0xb20996){_0x56e500['model']=_[_0x00d9('0x35')](db[_0x00d9('0x60')][_0x00d9('0x30')]);_0x56e500[_0x00d9('0x34')]=_[_0x00d9('0x35')](_0x523395['query']);_0x56e500[_0x00d9('0x36')]=_[_0x00d9('0x37')](_0x56e500[_0x00d9('0x33')],_0x56e500[_0x00d9('0x34')]);_0x45bc1d[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x56e500[_0x00d9('0x33')],qs[_0x00d9('0x39')](_0x523395[_0x00d9('0x34')][_0x00d9('0x39')]));_0x45bc1d[_0x00d9('0x38')]=_0x45bc1d[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x45bc1d[_0x00d9('0x38')]:_0x56e500[_0x00d9('0x33')];if(!_0x523395['query'][_0x00d9('0x56')]('nolimit')){_0x45bc1d[_0x00d9('0x1e')]=qs[_0x00d9('0x1e')](_0x523395[_0x00d9('0x34')][_0x00d9('0x1e')]);_0x45bc1d[_0x00d9('0x1b')]=qs[_0x00d9('0x1b')](_0x523395[_0x00d9('0x34')][_0x00d9('0x1b')]);}_0x45bc1d['order']=qs[_0x00d9('0x59')](_0x523395['query'][_0x00d9('0x59')]);_0x45bc1d['where']=qs[_0x00d9('0x36')](_[_0x00d9('0x3c')](_0x523395[_0x00d9('0x34')],_0x56e500[_0x00d9('0x36')]));_0x45bc1d[_0x00d9('0x3b')][_0x00d9('0x61')]=_0xb20996['id'];if(_0x523395['query'][_0x00d9('0x3d')]){_0x45bc1d['where']=_[_0x00d9('0x3e')](_0x45bc1d['where'],{'$or':_[_0x00d9('0x2f')](_0x45bc1d[_0x00d9('0x38')],function(_0x744ca4){var _0x2fe7df={};_0x2fe7df[_0x744ca4]={'$like':'%'+_0x523395['query']['filter']+'%'};return _0x2fe7df;})});}_0x45bc1d=_[_0x00d9('0x3e')]({},_0x45bc1d,_0x523395[_0x00d9('0x40')]);return db[_0x00d9('0x60')]['count']({'where':_0x45bc1d[_0x00d9('0x3b')]})['then'](function(_0x621a78){_0x37c558[_0x00d9('0x1d')]=_0x621a78;if(_0x523395['query'][_0x00d9('0x42')]){_0x45bc1d['include']=[{'all':!![]}];}return db[_0x00d9('0x60')]['findAll'](_0x45bc1d);})[_0x00d9('0x24')](function(_0x2ab0cf){_0x37c558[_0x00d9('0x5a')]=_0x2ab0cf;return _0x37c558;});}})[_0x00d9('0x24')](respondWithFilteredResult(_0x57af31,_0x45bc1d))[_0x00d9('0x45')](handleError(_0x57af31,null));};exports['getLists']=function(_0x1085f2,_0x4f291b,_0x331cca){var _0x226a10={};var _0x2a78cd={};var _0x5e986e;var _0x6c8672;return db[_0x00d9('0x41')][_0x00d9('0x54')]({'where':{'id':_0x1085f2[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x4f291b,null))[_0x00d9('0x24')](function(_0x210ed9){if(_0x210ed9){_0x5e986e=_0x210ed9;_0x2a78cd[_0x00d9('0x33')]=_[_0x00d9('0x35')](db[_0x00d9('0x62')][_0x00d9('0x30')]);_0x2a78cd['query']=_[_0x00d9('0x35')](_0x1085f2['query']);_0x2a78cd[_0x00d9('0x36')]=_[_0x00d9('0x37')](_0x2a78cd[_0x00d9('0x33')],_0x2a78cd['query']);_0x226a10[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x2a78cd['model'],qs[_0x00d9('0x39')](_0x1085f2[_0x00d9('0x34')]['fields']));_0x226a10['attributes']=_0x226a10[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x226a10[_0x00d9('0x38')]:_0x2a78cd[_0x00d9('0x33')];_0x226a10[_0x00d9('0x58')]=qs[_0x00d9('0x59')](_0x1085f2[_0x00d9('0x34')][_0x00d9('0x59')]);_0x226a10[_0x00d9('0x3b')]=qs[_0x00d9('0x36')](_[_0x00d9('0x3c')](_0x1085f2['query'],_0x2a78cd[_0x00d9('0x36')]));if(_0x1085f2[_0x00d9('0x34')]['filter']){_0x226a10[_0x00d9('0x3b')]=_[_0x00d9('0x3e')](_0x226a10[_0x00d9('0x3b')],{'$or':_['map'](_0x226a10[_0x00d9('0x38')],function(_0x15b449){var _0x9477a8={};_0x9477a8[_0x15b449]={'$like':'%'+_0x1085f2[_0x00d9('0x34')][_0x00d9('0x3d')]+'%'};return _0x9477a8;})});}_0x226a10=_[_0x00d9('0x3e')]({},_0x226a10,_0x1085f2[_0x00d9('0x40')]);return _0x5e986e[_0x00d9('0x63')](_0x226a10);}})[_0x00d9('0x24')](function(_0x397114){if(_0x397114){_0x6c8672=_0x397114[_0x00d9('0x3a')];if(!_0x1085f2[_0x00d9('0x34')]['hasOwnProperty'](_0x00d9('0x57'))){_0x226a10['limit']=qs['limit'](_0x1085f2[_0x00d9('0x34')]['limit']);_0x226a10[_0x00d9('0x1b')]=qs[_0x00d9('0x1b')](_0x1085f2[_0x00d9('0x34')][_0x00d9('0x1b')]);}return _0x5e986e[_0x00d9('0x63')](_0x226a10);}})['then'](function(_0x36119e){if(_0x36119e){return _0x36119e?{'count':_0x6c8672,'rows':_0x36119e}:null;}})['then'](respondWithResult(_0x4f291b,null))[_0x00d9('0x45')](handleError(_0x4f291b,null));};exports[_0x00d9('0x64')]=function(_0x5e165c,_0x2a3c1d,_0x248413){var _0x16c883,_0x16189f;var _0x5b2719=[];var _0x19cbeb=moment()[_0x00d9('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x00d9('0x47')]({'where':{'id':_0x5e165c['params']['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x2a3c1d,null))[_0x00d9('0x24')](function(_0x2bce2a){if(_0x2bce2a){_0x16189f=_0x2bce2a;return _0x2bce2a[_0x00d9('0x64')](_0x5e165c[_0x00d9('0x49')]['ids'],_[_0x00d9('0x66')](_0x5e165c[_0x00d9('0x49')],['ids','id'])||{});}return null;})['spread'](function(_0x4b2078){var _0x332223;var _0x13986d;_0x16c883=_0x4b2078||[];var _0x23467b=[];if(_0x4b2078){for(var _0x259e79=0x0;_0x259e79<_0x4b2078['length'];_0x259e79+=0x1){var _0x2c9e70=_0x4b2078[_0x259e79]['get']({'plain':!![]});_0x16189f[_0x00d9('0x67')]=_0x5e165c['body']['dialCheckDuplicateType']?_0x5e165c[_0x00d9('0x49')]['dialCheckDuplicateType']:_0x16189f[_0x00d9('0x67')];switch(_0x16189f[_0x00d9('0x67')]){case _0x00d9('0x68'):_0x332223=squel[_0x00d9('0x69')]()[_0x00d9('0x6a')](_0x00d9('0x6b'))['fromQuery']([_0x00d9('0x6c'),_0x00d9('0x6d'),'ContactId',_0x00d9('0x6e'),_0x00d9('0x61'),_0x00d9('0x50'),_0x00d9('0x51')],squel[_0x00d9('0x6f')]()[_0x00d9('0x70')](_0x00d9('0x6c'),_0x00d9('0x6c'))['field'](_0x00d9('0x71'),_0x00d9('0x6d'))[_0x00d9('0x70')]('id',_0x00d9('0x72'))[_0x00d9('0x70')](_0x2c9e70[_0x00d9('0x73')][_0x00d9('0x74')](),_0x00d9('0x6e'))[_0x00d9('0x70')](_0x5e165c['params']['id'][_0x00d9('0x74')](),_0x00d9('0x61'))[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x50'))[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x51'))[_0x00d9('0x75')](_0x00d9('0x76'))[_0x00d9('0x3b')](_0x00d9('0x77'))['where'](_0x00d9('0x78'),_0x2c9e70['CmListId'][_0x00d9('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x00d9('0x79'),squel[_0x00d9('0x6f')]()[_0x00d9('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x00d9('0x75')](_0x00d9('0x7a'))[_0x00d9('0x3b')](_0x00d9('0x7b'),_0x5e165c[_0x00d9('0x4f')]['id'][_0x00d9('0x74')]()))['where'](_0x00d9('0x79'),squel['select']()['field'](_0x00d9('0x7c'))[_0x00d9('0x75')](_0x00d9('0x6b'))[_0x00d9('0x3b')](_0x00d9('0x7b'),_0x5e165c[_0x00d9('0x4f')]['id'][_0x00d9('0x74')]())))[_0x00d9('0x74')]();break;case _0x00d9('0x7d'):_0x332223=squel['insert']()[_0x00d9('0x6a')](_0x00d9('0x6b'))[_0x00d9('0x7e')]([_0x00d9('0x6c'),_0x00d9('0x6d'),_0x00d9('0x72'),_0x00d9('0x6e'),'CampaignId',_0x00d9('0x50'),_0x00d9('0x51')],squel[_0x00d9('0x6f')]()[_0x00d9('0x70')](_0x00d9('0x6c'),'phone')[_0x00d9('0x70')](_0x00d9('0x71'),_0x00d9('0x6d'))[_0x00d9('0x70')]('id','ContactId')[_0x00d9('0x70')](_0x2c9e70[_0x00d9('0x73')][_0x00d9('0x74')](),_0x00d9('0x6e'))[_0x00d9('0x70')](_0x5e165c[_0x00d9('0x4f')]['id']['toString'](),'CampaignId')[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x50'))['field']('\x27'+_0x19cbeb+'\x27',_0x00d9('0x51'))[_0x00d9('0x75')](_0x00d9('0x76'))[_0x00d9('0x3b')](_0x00d9('0x77'))['where'](_0x00d9('0x78'),_0x2c9e70[_0x00d9('0x73')][_0x00d9('0x74')]())[_0x00d9('0x3b')](_0x00d9('0x7f'))[_0x00d9('0x3b')](_0x00d9('0x79'),squel[_0x00d9('0x6f')]()[_0x00d9('0x70')](_0x00d9('0x7c'))[_0x00d9('0x75')](_0x00d9('0x6b'))['where'](_0x00d9('0x7b'),_0x5e165c['params']['id'][_0x00d9('0x74')]())))[_0x00d9('0x74')]();break;default:_0x332223=squel[_0x00d9('0x69')]()['into'](_0x00d9('0x6b'))[_0x00d9('0x7e')]([_0x00d9('0x6c'),_0x00d9('0x6d'),_0x00d9('0x72'),_0x00d9('0x6e'),_0x00d9('0x61'),'createdAt',_0x00d9('0x51')],squel['select']()['field']('phone',_0x00d9('0x6c'))[_0x00d9('0x70')](_0x00d9('0x71'),'scheduledAt')[_0x00d9('0x70')]('id',_0x00d9('0x72'))[_0x00d9('0x70')](_0x2c9e70[_0x00d9('0x73')][_0x00d9('0x74')](),_0x00d9('0x6e'))[_0x00d9('0x70')](_0x5e165c[_0x00d9('0x4f')]['id'][_0x00d9('0x74')](),'CampaignId')[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x50'))['field']('\x27'+_0x19cbeb+'\x27',_0x00d9('0x51'))[_0x00d9('0x75')](_0x00d9('0x76'))['where'](_0x00d9('0x77'))[_0x00d9('0x3b')](_0x00d9('0x78'),_0x2c9e70['CmListId'][_0x00d9('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x13986d=squel[_0x00d9('0x69')]()[_0x00d9('0x6a')](_0x00d9('0x80'))['fromQuery']([_0x00d9('0x81'),_0x00d9('0x6d'),'phone',_0x00d9('0x82'),_0x00d9('0x50'),_0x00d9('0x51')],squel[_0x00d9('0x6f')]()[_0x00d9('0x70')](_0x00d9('0x83'),'id')[_0x00d9('0x70')](_0x00d9('0x71'),'scheduledAt')[_0x00d9('0x70')](_0x00d9('0x84'),'phone')[_0x00d9('0x70')]('ci.OrderBY',_0x00d9('0x82'))[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x50'))[_0x00d9('0x70')]('\x27'+_0x19cbeb+'\x27',_0x00d9('0x51'))[_0x00d9('0x75')](_0x00d9('0x85'),'ci')['join'](_0x00d9('0x6b'),'h',_0x00d9('0x86'))[_0x00d9('0x3b')](_0x00d9('0x87'),_0x2c9e70[_0x00d9('0x73')][_0x00d9('0x74')]())['where'](_0x00d9('0x88'),_0x5e165c[_0x00d9('0x4f')]['id'][_0x00d9('0x74')]())[_0x00d9('0x3b')](_0x00d9('0x89'),_0x19cbeb))[_0x00d9('0x74')]();_0x23467b['push'](db['sequelize'][_0x00d9('0x34')](_0x332223));_0x5b2719['push'](db[_0x00d9('0x8a')][_0x00d9('0x34')](_0x13986d));}return BPromise[_0x00d9('0x8b')](_0x23467b);}})['then'](function(){return BPromise[_0x00d9('0x8b')](_0x5b2719);})[_0x00d9('0x24')](function(){return _0x16c883;})[_0x00d9('0x24')](respondWithResult(_0x2a3c1d,null))['catch'](handleError(_0x2a3c1d,null));};exports['removeLists']=function(_0x419fe5,_0x3e319f,_0x1bf483){return db[_0x00d9('0x41')]['find']({'where':{'id':_0x419fe5[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x3e319f,null))[_0x00d9('0x24')](function(_0x31ab3e){if(_0x31ab3e){return _0x31ab3e[_0x00d9('0x8c')](_0x419fe5[_0x00d9('0x34')][_0x00d9('0x8d')]);}})[_0x00d9('0x24')](function(_0x282ca6){if(_0x282ca6){return db[_0x00d9('0x55')]['destroy']({'where':{'ListId':_0x419fe5[_0x00d9('0x34')][_0x00d9('0x8d')],'CampaignId':_0x419fe5['params']['id']}})[_0x00d9('0x24')](function(){return _0x282ca6;});}})[_0x00d9('0x24')](respondWithStatusCode(_0x3e319f,null))[_0x00d9('0x45')](handleError(_0x3e319f,null));};exports[_0x00d9('0x8e')]=function(_0x42ba89,_0x144359,_0x4c9671){var _0x51c17a={};var _0x1131e5={};var _0x120c7c;var _0x19bcb7;return db['Campaign']['findOne']({'where':{'id':_0x42ba89['params']['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x144359,null))[_0x00d9('0x24')](function(_0x145305){if(_0x145305){_0x120c7c=_0x145305;_0x1131e5['model']=_[_0x00d9('0x35')](db[_0x00d9('0x62')][_0x00d9('0x30')]);_0x1131e5['query']=_['keys'](_0x42ba89[_0x00d9('0x34')]);_0x1131e5['filters']=_[_0x00d9('0x37')](_0x1131e5[_0x00d9('0x33')],_0x1131e5[_0x00d9('0x34')]);_0x51c17a[_0x00d9('0x38')]=_[_0x00d9('0x37')](_0x1131e5[_0x00d9('0x33')],qs[_0x00d9('0x39')](_0x42ba89[_0x00d9('0x34')][_0x00d9('0x39')]));_0x51c17a['attributes']=_0x51c17a[_0x00d9('0x38')][_0x00d9('0x3a')]?_0x51c17a[_0x00d9('0x38')]:_0x1131e5['model'];_0x51c17a[_0x00d9('0x58')]=qs[_0x00d9('0x59')](_0x42ba89[_0x00d9('0x34')][_0x00d9('0x59')]);_0x51c17a['where']=qs[_0x00d9('0x36')](_[_0x00d9('0x3c')](_0x42ba89[_0x00d9('0x34')],_0x1131e5['filters']));if(_0x42ba89[_0x00d9('0x34')]['filter']){_0x51c17a[_0x00d9('0x3b')]=_[_0x00d9('0x3e')](_0x51c17a[_0x00d9('0x3b')],{'$or':_[_0x00d9('0x2f')](_0x51c17a['attributes'],function(_0x3f560a){var _0x141665={};_0x141665[_0x3f560a]={'$like':'%'+_0x42ba89[_0x00d9('0x34')]['filter']+'%'};return _0x141665;})});}_0x51c17a=_[_0x00d9('0x3e')]({},_0x51c17a,_0x42ba89['options']);return _0x120c7c['getBlackLists'](_0x51c17a);}})[_0x00d9('0x24')](function(_0x240f02){if(_0x240f02){_0x19bcb7=_0x240f02[_0x00d9('0x3a')];if(!_0x42ba89['query'][_0x00d9('0x56')](_0x00d9('0x57'))){_0x51c17a[_0x00d9('0x1e')]=qs['limit'](_0x42ba89['query']['limit']);_0x51c17a['offset']=qs[_0x00d9('0x1b')](_0x42ba89[_0x00d9('0x34')]['offset']);}return _0x120c7c[_0x00d9('0x8e')](_0x51c17a);}})[_0x00d9('0x24')](function(_0xd1395){if(_0xd1395){return _0xd1395?{'count':_0x19bcb7,'rows':_0xd1395}:null;}})['then'](respondWithResult(_0x144359,null))[_0x00d9('0x45')](handleError(_0x144359,null));};exports[_0x00d9('0x8f')]=function(_0x5b7ba0,_0x2bc749,_0x206745){var _0x55dbac,_0x9f84a2;var _0x18b6a1=[];var _0x388b25=moment()[_0x00d9('0x65')](_0x00d9('0x90'));return db[_0x00d9('0x41')]['find']({'where':{'id':_0x5b7ba0['params']['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x2bc749,null))[_0x00d9('0x24')](function(_0xfb539d){if(_0xfb539d){_0x9f84a2=_0xfb539d;return _0xfb539d[_0x00d9('0x8f')](_0x5b7ba0[_0x00d9('0x49')]['ids'],_[_0x00d9('0x66')](_0x5b7ba0[_0x00d9('0x49')],[_0x00d9('0x8d'),'id'])||{});}return null;})[_0x00d9('0x91')](function(_0x4cf106){var _0x27647d;var _0x319bcb;_0x55dbac=_0x4cf106||[];var _0x3e27ef=[];if(_0x4cf106){for(var _0x577e93=0x0;_0x577e93<_0x4cf106[_0x00d9('0x3a')];_0x577e93+=0x1){var _0x5c8487=_0x4cf106[_0x577e93]['get']({'plain':!![]});_0x27647d=squel[_0x00d9('0x69')]()[_0x00d9('0x6a')](_0x00d9('0x92'))[_0x00d9('0x7e')]([_0x00d9('0x6c'),'ContactId',_0x00d9('0x6e'),'CampaignId',_0x00d9('0x50'),_0x00d9('0x51')],squel['select']()[_0x00d9('0x70')](_0x00d9('0x6c'),_0x00d9('0x6c'))[_0x00d9('0x70')]('id','ContactId')[_0x00d9('0x70')](_0x5c8487[_0x00d9('0x73')][_0x00d9('0x74')](),'ListId')[_0x00d9('0x70')](_0x5b7ba0[_0x00d9('0x4f')]['id'][_0x00d9('0x74')](),_0x00d9('0x61'))[_0x00d9('0x70')](_0x00d9('0x71'),'createdAt')[_0x00d9('0x70')](_0x00d9('0x71'),_0x00d9('0x51'))[_0x00d9('0x75')](_0x00d9('0x76'))[_0x00d9('0x3b')](_0x00d9('0x77'))['where']('ListId\x20=\x20?',_0x5c8487[_0x00d9('0x73')][_0x00d9('0x74')]())[_0x00d9('0x3b')](_0x00d9('0x7f')))[_0x00d9('0x74')]();_0x3e27ef[_0x00d9('0x93')](db[_0x00d9('0x8a')]['query'](_0x27647d));}return BPromise['all'](_0x3e27ef);}})[_0x00d9('0x24')](function(){return _0x55dbac;})[_0x00d9('0x24')](respondWithResult(_0x2bc749,null))[_0x00d9('0x45')](handleError(_0x2bc749,null));};exports[_0x00d9('0x94')]=function(_0x2be06a,_0x551710,_0x4982bf){return db['Campaign']['find']({'where':{'id':_0x2be06a[_0x00d9('0x4f')]['id']}})[_0x00d9('0x24')](handleEntityNotFound(_0x551710,null))[_0x00d9('0x24')](function(_0x19a1e5){if(_0x19a1e5){return _0x19a1e5[_0x00d9('0x94')](_0x2be06a['query'][_0x00d9('0x8d')]);}})[_0x00d9('0x24')](function(_0x219b80){if(_0x219b80){return db[_0x00d9('0x60')][_0x00d9('0x28')]({'where':{'ListId':_0x2be06a['query'][_0x00d9('0x8d')],'CampaignId':_0x2be06a['params']['id']}})['then'](function(){return _0x219b80;});}})[_0x00d9('0x24')](respondWithStatusCode(_0x551710,null))[_0x00d9('0x45')](handleError(_0x551710,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 44d0bf1..aab47d9 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xd16d61,_0x2a7235){var _0x4902fa=function(_0x485208){while(--_0x485208){_0xd16d61['push'](_0xd16d61['shift']());}};_0x4902fa(++_0x2a7235);}(_0x7a54,0x106));var _0x47a5=function(_0x455c50,_0x354129){_0x455c50=_0x455c50-0x0;var _0x3fb191=_0x7a54[_0x455c50];return _0x3fb191;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2ef2cf,_0x55b72b){var _0x1ba4a0=function(_0x5131bb){while(--_0x5131bb){_0x2ef2cf['push'](_0x2ef2cf['shift']());}};_0x1ba4a0(++_0x55b72b);}(_0x7a54,0x106));var _0x47a5=function(_0x51a9c8,_0x797974){_0x51a9c8=_0x51a9c8-0x0;var _0x490f2e=_0x7a54[_0x51a9c8];return _0x490f2e;};'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 477880a..ce6cbdd 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 _0xfc1e=['result','GetCampaign','findAll','options','attributes','limit','include','map','model','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3d523f,_0xf0c784){var _0x22bf42=function(_0x30b638){while(--_0x30b638){_0x3d523f['push'](_0x3d523f['shift']());}};_0x22bf42(++_0xf0c784);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xfc1e[_0x33a694];return _0x41ff01;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefc1('0x0'));var rs=require(_0xefc1('0x1'));var fs=require('fs');var Redis=require(_0xefc1('0x2'));var db=require(_0xefc1('0x3'))['db'];var utils=require(_0xefc1('0x4'));var logger=require('../../config/logger')(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38927c,_0x44d15b,_0x3ff4a7){return new BPromise(function(_0x45bec4,_0x77f637){return client[_0xefc1('0x8')](_0x38927c,_0x3ff4a7)[_0xefc1('0x9')](function(_0x244927){logger[_0xefc1('0xa')](_0xefc1('0xb'),_0x44d15b,'request\x20sent');logger[_0xefc1('0xc')](_0xefc1('0xd'),_0x44d15b,_0xefc1('0xe'),JSON[_0xefc1('0xf')](_0x244927));if(_0x244927[_0xefc1('0x10')]){if(_0x244927[_0xefc1('0x10')][_0xefc1('0x11')]===0x1f4){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x77f637(_0x244927['error'][_0xefc1('0x12')]);}logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x45bec4(_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);}else{logger[_0xefc1('0xa')]('Campaign,\x20%s,\x20%s',_0x44d15b,_0xefc1('0xe'));_0x45bec4(_0x244927[_0xefc1('0x13')][_0xefc1('0x12')]);}})['catch'](function(_0x159adb){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x159adb);_0x77f637(_0x159adb);});});}exports[_0xefc1('0x14')]=function(_0x257914){var _0x38923c=this;return new Promise(function(_0x3b5a6e,_0x126052){return db['Campaign'][_0xefc1('0x15')]({'raw':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x257914['options']?_0x257914[_0xefc1('0x16')]['where']||null:null,'attributes':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x17')]||null:null,'limit':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x18')]||null:null,'include':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')][_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x257914[_0xefc1('0x16')]['include'],function(_0x2f4935){return{'model':db[_0x2f4935[_0xefc1('0x1b')]],'as':_0x2f4935['as'],'attributes':_0x2f4935['attributes'],'include':_0x2f4935[_0xefc1('0x19')]?_['map'](_0x2f4935['include'],function(_0x21aa3b){return{'model':db[_0x21aa3b[_0xefc1('0x1b')]],'as':_0x21aa3b['as'],'attributes':_0x21aa3b[_0xefc1('0x17')],'include':_0x21aa3b[_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x21aa3b[_0xefc1('0x19')],function(_0x538145){return{'model':db[_0x538145['model']],'as':_0x538145['as'],'attributes':_0x538145[_0xefc1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xefc1('0x9')](function(_0x20e438){logger[_0xefc1('0xa')](_0xefc1('0x14'),_0x257914);logger['debug'](_0xefc1('0x14'),_0x257914,JSON[_0xefc1('0xf')](_0x20e438));_0x3b5a6e(_0x20e438);})['catch'](function(_0x486a5b){logger[_0xefc1('0x10')](_0xefc1('0x14'),_0x486a5b[_0xefc1('0x12')],_0x257914);_0x126052(_0x38923c['error'](0x1f4,_0x486a5b[_0xefc1('0x12')]));});});}; \ No newline at end of file +var _0x38c3=['findAll','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetCampaign','Campaign'];(function(_0x2c581d,_0x29c4fd){var _0x16f9fe=function(_0x362415){while(--_0x362415){_0x2c581d['push'](_0x2c581d['shift']());}};_0x16f9fe(++_0x29c4fd);}(_0x38c3,0x13d));var _0x338c=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x38c3[_0x1f0724];return _0x253ffb;};'use strict';var _=require(_0x338c('0x0'));var util=require(_0x338c('0x1'));var moment=require('moment');var BPromise=require(_0x338c('0x2'));var rs=require(_0x338c('0x3'));var fs=require('fs');var Redis=require(_0x338c('0x4'));var db=require(_0x338c('0x5'))['db'];var utils=require(_0x338c('0x6'));var logger=require(_0x338c('0x7'))('rpc');var config=require(_0x338c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x338c('0x9')][_0x338c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c021d,_0x39dacd,_0x2864c3){return new BPromise(function(_0x46286d,_0x5f285b){return client[_0x338c('0xb')](_0x4c021d,_0x2864c3)[_0x338c('0xc')](function(_0x212690){logger[_0x338c('0xd')](_0x338c('0xe'),_0x39dacd,_0x338c('0xf'));logger[_0x338c('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x39dacd,_0x338c('0xf'),JSON[_0x338c('0x11')](_0x212690));if(_0x212690['error']){if(_0x212690[_0x338c('0x12')]['code']===0x1f4){logger[_0x338c('0x12')](_0x338c('0xe'),_0x39dacd,_0x212690['error'][_0x338c('0x13')]);return _0x5f285b(_0x212690[_0x338c('0x12')][_0x338c('0x13')]);}logger[_0x338c('0x12')](_0x338c('0xe'),_0x39dacd,_0x212690[_0x338c('0x12')][_0x338c('0x13')]);return _0x46286d(_0x212690[_0x338c('0x12')][_0x338c('0x13')]);}else{logger[_0x338c('0xd')]('Campaign,\x20%s,\x20%s',_0x39dacd,'request\x20sent');_0x46286d(_0x212690[_0x338c('0x14')][_0x338c('0x13')]);}})[_0x338c('0x15')](function(_0x21cbd4){logger['error'](_0x338c('0xe'),_0x39dacd,_0x21cbd4);_0x5f285b(_0x21cbd4);});});}exports[_0x338c('0x16')]=function(_0x3a0784){var _0x307f7b=this;return new Promise(function(_0x190919,_0x3c988a){return db[_0x338c('0x17')][_0x338c('0x18')]({'raw':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')][_0x338c('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')]['where']||null:null,'attributes':_0x3a0784['options']?_0x3a0784[_0x338c('0x19')][_0x338c('0x1b')]||null:null,'limit':_0x3a0784[_0x338c('0x19')]?_0x3a0784[_0x338c('0x19')]['limit']||null:null,'include':_0x3a0784[_0x338c('0x19')]?_0x3a0784['options'][_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x3a0784['options'][_0x338c('0x1c')],function(_0x144db9){return{'model':db[_0x144db9['model']],'as':_0x144db9['as'],'attributes':_0x144db9[_0x338c('0x1b')],'include':_0x144db9[_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x144db9[_0x338c('0x1c')],function(_0x26013d){return{'model':db[_0x26013d[_0x338c('0x1e')]],'as':_0x26013d['as'],'attributes':_0x26013d[_0x338c('0x1b')],'include':_0x26013d[_0x338c('0x1c')]?_[_0x338c('0x1d')](_0x26013d['include'],function(_0x30edb0){return{'model':db[_0x30edb0[_0x338c('0x1e')]],'as':_0x30edb0['as'],'attributes':_0x30edb0[_0x338c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae957){logger[_0x338c('0xd')]('GetCampaign',_0x3a0784);logger[_0x338c('0x10')](_0x338c('0x16'),_0x3a0784,JSON[_0x338c('0x11')](_0x3ae957));_0x190919(_0x3ae957);})[_0x338c('0x15')](function(_0x1b7339){logger[_0x338c('0x12')]('GetCampaign',_0x1b7339['message'],_0x3a0784);_0x3c988a(_0x307f7b[_0x338c('0x12')](0x1f4,_0x1b7339[_0x338c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 407c249..662a43b 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 _0x1f71=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','show','/:id/hoppers','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f71,0xaa));var _0x11f7=function(_0x5e05d0,_0x3dfc9b){_0x5e05d0=_0x5e05d0-0x0;var _0x82d556=_0x1f71[_0x5e05d0];return _0x82d556;};'use strict';var multer=require('multer');var util=require(_0x11f7('0x0'));var path=require(_0x11f7('0x1'));var timeout=require(_0x11f7('0x2'));var express=require(_0x11f7('0x3'));var router=express[_0x11f7('0x4')]();var fs_extra=require(_0x11f7('0x5'));var auth=require(_0x11f7('0x6'));var interaction=require(_0x11f7('0x7'));var config=require(_0x11f7('0x8'));var controller=require(_0x11f7('0x9'));router[_0x11f7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x11f7('0xa')](_0x11f7('0xb'),auth['isAuthenticated'](),controller[_0x11f7('0xc')]);router['get'](_0x11f7('0xd'),auth[_0x11f7('0xe')](),controller[_0x11f7('0xf')]);router['get'](_0x11f7('0x10'),auth['isAuthenticated'](),controller[_0x11f7('0x11')]);router['get'](_0x11f7('0x12'),auth[_0x11f7('0xe')](),controller[_0x11f7('0x13')]);router['get'](_0x11f7('0x14'),auth['isAuthenticated'](),controller[_0x11f7('0x15')]);router[_0x11f7('0xa')]('/:id/lists',auth[_0x11f7('0xe')](),controller[_0x11f7('0x16')]);router['get'](_0x11f7('0x17'),auth[_0x11f7('0xe')](),controller[_0x11f7('0x18')]);router[_0x11f7('0x19')]('/',auth[_0x11f7('0xe')](),controller[_0x11f7('0x1a')]);router['post'](_0x11f7('0x1b'),auth[_0x11f7('0xe')](),controller[_0x11f7('0x1c')]);router[_0x11f7('0x19')]('/:id/lists',auth['isAuthenticated'](),controller[_0x11f7('0x1d')]);router[_0x11f7('0x19')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x11f7('0x1e')]);router[_0x11f7('0x1f')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x11f7('0x20')](_0x11f7('0xb'),auth[_0x11f7('0xe')](),controller[_0x11f7('0x21')]);router[_0x11f7('0x20')]('/:id/lists',auth[_0x11f7('0xe')](),controller[_0x11f7('0x22')]);router[_0x11f7('0x20')](_0x11f7('0x17'),auth[_0x11f7('0xe')](),controller[_0x11f7('0x23')]);module[_0x11f7('0x24')]=router; \ No newline at end of file +var _0x00a6=['delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','get','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update'];(function(_0x47ca39,_0x199e16){var _0x2a24a0=function(_0x470879){while(--_0x470879){_0x47ca39['push'](_0x47ca39['shift']());}};_0x2a24a0(++_0x199e16);}(_0x00a6,0x1a5));var _0x600a=function(_0x2266eb,_0xd0524b){_0x2266eb=_0x2266eb-0x0;var _0x28f8c5=_0x00a6[_0x2266eb];return _0x28f8c5;};'use strict';var multer=require('multer');var util=require(_0x600a('0x0'));var path=require(_0x600a('0x1'));var timeout=require(_0x600a('0x2'));var express=require(_0x600a('0x3'));var router=express['Router']();var fs_extra=require(_0x600a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x600a('0x5'));var config=require(_0x600a('0x6'));var controller=require(_0x600a('0x7'));router['get']('/',auth[_0x600a('0x8')](),controller['index']);router[_0x600a('0x9')]('/:id',auth[_0x600a('0x8')](),controller[_0x600a('0xa')]);router[_0x600a('0x9')](_0x600a('0xb'),auth[_0x600a('0x8')](),controller[_0x600a('0xc')]);router[_0x600a('0x9')]('/:id/hopper_histories',auth[_0x600a('0x8')](),controller['getHopperHistories']);router['get'](_0x600a('0xd'),auth[_0x600a('0x8')](),controller[_0x600a('0xe')]);router[_0x600a('0x9')](_0x600a('0xf'),auth[_0x600a('0x8')](),controller[_0x600a('0x10')]);router[_0x600a('0x9')](_0x600a('0x11'),auth[_0x600a('0x8')](),controller['getLists']);router[_0x600a('0x9')](_0x600a('0x12'),auth[_0x600a('0x8')](),controller[_0x600a('0x13')]);router[_0x600a('0x14')]('/',auth[_0x600a('0x8')](),controller['create']);router[_0x600a('0x14')](_0x600a('0x15'),auth[_0x600a('0x8')](),controller[_0x600a('0x16')]);router['post'](_0x600a('0x11'),auth[_0x600a('0x8')](),controller[_0x600a('0x17')]);router[_0x600a('0x14')](_0x600a('0x12'),auth[_0x600a('0x8')](),controller[_0x600a('0x18')]);router[_0x600a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x600a('0x1a')]);router[_0x600a('0x1b')]('/:id',auth[_0x600a('0x8')](),controller[_0x600a('0x1c')]);router['delete'](_0x600a('0x11'),auth['isAuthenticated'](),controller[_0x600a('0x1d')]);router['delete'](_0x600a('0x12'),auth[_0x600a('0x8')](),controller[_0x600a('0x1e')]);module[_0x600a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ee775e3..c25d1d3 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 _0x08bc=['TEXT','medium','STRING','getDataValue','key','sequelize','exports'];(function(_0x48788c,_0x22c6cf){var _0x111b0f=function(_0x4087db){while(--_0x4087db){_0x48788c['push'](_0x48788c['shift']());}};_0x111b0f(++_0x22c6cf);}(_0x08bc,0x140));var _0xc08b=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x08bc[_0x10c51f];return _0x56a0cd;};'use strict';var Sequelize=require(_0xc08b('0x0'));module[_0xc08b('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xc08b('0x2')],'length':_0xc08b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc08b('0x4')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc08b('0x5')](_0xc08b('0x6'));}}}; \ No newline at end of file +var _0x6e08=['sequelize','STRING','TEXT','getDataValue','key'];(function(_0x575eba,_0xfb5aab){var _0x2a0c37=function(_0x420d48){while(--_0x420d48){_0x575eba['push'](_0x575eba['shift']());}};_0x2a0c37(++_0xfb5aab);}(_0x6e08,0x10e));var _0x86e0=function(_0x5e6487,_0x2718b8){_0x5e6487=_0x5e6487-0x0;var _0x70c092=_0x6e08[_0x5e6487];return _0x70c092;};'use strict';var Sequelize=require(_0x86e0('0x0'));module['exports']={'key':{'type':Sequelize[_0x86e0('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x86e0('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x86e0('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x86e0('0x3')](_0x86e0('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 88c1a78..481ccc5 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 _0x85dc=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','catch','rawAttributes','intersection','CannedAnswer','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x364d6c,_0x21025d){var _0x55156d=function(_0x4fe817){while(--_0x4fe817){_0x364d6c['push'](_0x364d6c['shift']());}};_0x55156d(++_0x21025d);}(_0x85dc,0x93));var _0xc85d=function(_0x563234,_0x129043){_0x563234=_0x563234-0x0;var _0x1e9d85=_0x85dc[_0x563234];return _0x1e9d85;};'use strict';var emlformat=require(_0xc85d('0x0'));var rimraf=require(_0xc85d('0x1'));var zipdir=require(_0xc85d('0x2'));var jsonpatch=require(_0xc85d('0x3'));var rp=require(_0xc85d('0x4'));var moment=require(_0xc85d('0x5'));var BPromise=require(_0xc85d('0x6'));var Mustache=require('mustache');var util=require(_0xc85d('0x7'));var path=require('path');var sox=require(_0xc85d('0x8'));var csv=require(_0xc85d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc85d('0xb'));var jsforce=require(_0xc85d('0xc'));var deskjs=require(_0xc85d('0xd'));var toCsv=require(_0xc85d('0x9'));var querystring=require(_0xc85d('0xe'));var Papa=require(_0xc85d('0xf'));var Redis=require('ioredis');var authService=require(_0xc85d('0x10'));var qs=require(_0xc85d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc85d('0x12'));var logger=require(_0xc85d('0x13'))(_0xc85d('0x14'));var utils=require(_0xc85d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc85d('0x16'))['db'];function respondWithStatusCode(_0x56c045,_0x5e8a12){_0x5e8a12=_0x5e8a12||0xcc;return function(_0x317595){if(_0x317595){return _0x56c045[_0xc85d('0x17')](_0x5e8a12);}return _0x56c045['status'](_0x5e8a12)[_0xc85d('0x18')]();};}function respondWithResult(_0x2dc079,_0x414d31){_0x414d31=_0x414d31||0xc8;return function(_0x1fb974){if(_0x1fb974){return _0x2dc079[_0xc85d('0x19')](_0x414d31)[_0xc85d('0x1a')](_0x1fb974);}};}function respondWithFilteredResult(_0x73fada,_0x354e0b){return function(_0x4ae4f0){if(_0x4ae4f0){var _0x5739bd=typeof _0x354e0b[_0xc85d('0x1b')]===_0xc85d('0x1c')&&typeof _0x354e0b[_0xc85d('0x1d')]===_0xc85d('0x1c');var _0x291731=_0x4ae4f0[_0xc85d('0x1e')];var _0x3a6f5a=_0x5739bd?0x0:_0x354e0b[_0xc85d('0x1b')];var _0x4d0cc5=_0x5739bd?_0x4ae4f0[_0xc85d('0x1e')]:_0x354e0b['offset']+_0x354e0b[_0xc85d('0x1d')];var _0x5870fd;if(_0x4d0cc5>=_0x291731){_0x4d0cc5=_0x291731;_0x5870fd=0xc8;}else{_0x5870fd=0xce;}_0x73fada['status'](_0x5870fd);return _0x73fada[_0xc85d('0x1f')](_0xc85d('0x20'),_0x3a6f5a+'-'+_0x4d0cc5+'/'+_0x291731)['json'](_0x4ae4f0);}return null;};}function patchUpdates(_0x45b7eb){return function(_0x49a23e){try{jsonpatch[_0xc85d('0x21')](_0x49a23e,_0x45b7eb,!![]);}catch(_0x240d6c){return BPromise['reject'](_0x240d6c);}return _0x49a23e['save']();};}function saveUpdates(_0x6fd74e,_0x196176){return function(_0x4a5bac){if(_0x4a5bac){return _0x4a5bac[_0xc85d('0x22')](_0x6fd74e)[_0xc85d('0x23')](function(_0x32e799){return _0x32e799;});}return null;};}function removeEntity(_0x861cb9,_0x3dfe94){return function(_0x3451a3){if(_0x3451a3){return _0x3451a3[_0xc85d('0x24')]()[_0xc85d('0x23')](function(){var _0x479902=_0x3451a3['get']({'plain':!![]});var _0x186eb0=_0xc85d('0x25');return db[_0xc85d('0x26')][_0xc85d('0x24')]({'where':{'type':_0x186eb0,'resourceId':_0x479902['id']}})['then'](function(){return _0x3451a3;});})['then'](function(){_0x861cb9[_0xc85d('0x19')](0xcc)[_0xc85d('0x18')]();});}};}function handleEntityNotFound(_0x327a5a,_0x1b96c2){return function(_0x1313ea){if(!_0x1313ea){_0x327a5a[_0xc85d('0x17')](0x194);}return _0x1313ea;};}function handleError(_0xa88aed,_0x2f8adf){_0x2f8adf=_0x2f8adf||0x1f4;return function(_0x1f60df){logger[_0xc85d('0x27')](_0x1f60df[_0xc85d('0x28')]);if(_0x1f60df[_0xc85d('0x29')]){delete _0x1f60df[_0xc85d('0x29')];}_0xa88aed[_0xc85d('0x19')](_0x2f8adf)['send'](_0x1f60df);};}exports[_0xc85d('0x2a')]=function(_0x3f9a21,_0x338e50){var _0x176c6a={},_0x236331={},_0x2bd00d={'count':0x0,'rows':[]};var _0x4d972f=_[_0xc85d('0x2b')](db['CannedAnswer']['rawAttributes'],function(_0x5058d1){return{'name':_0x5058d1[_0xc85d('0x2c')],'type':_0x5058d1[_0xc85d('0x2d')][_0xc85d('0x2e')]};});_0x236331[_0xc85d('0x2f')]=_['map'](_0x4d972f,_0xc85d('0x29'));_0x236331[_0xc85d('0x30')]=_[_0xc85d('0x31')](_0x3f9a21[_0xc85d('0x30')]);_0x236331[_0xc85d('0x32')]=_['intersection'](_0x236331[_0xc85d('0x2f')],_0x236331[_0xc85d('0x30')]);_0x176c6a[_0xc85d('0x33')]=_['intersection'](_0x236331[_0xc85d('0x2f')],qs[_0xc85d('0x34')](_0x3f9a21[_0xc85d('0x30')][_0xc85d('0x34')]));_0x176c6a['attributes']=_0x176c6a['attributes'][_0xc85d('0x35')]?_0x176c6a[_0xc85d('0x33')]:_0x236331[_0xc85d('0x2f')];if(!_0x3f9a21['query'][_0xc85d('0x36')]('nolimit')){_0x176c6a[_0xc85d('0x1d')]=qs['limit'](_0x3f9a21['query'][_0xc85d('0x1d')]);_0x176c6a[_0xc85d('0x1b')]=qs[_0xc85d('0x1b')](_0x3f9a21[_0xc85d('0x30')][_0xc85d('0x1b')]);}_0x176c6a[_0xc85d('0x37')]=qs[_0xc85d('0x38')](_0x3f9a21[_0xc85d('0x30')][_0xc85d('0x38')]);_0x176c6a[_0xc85d('0x39')]=qs['filters'](_['pick'](_0x3f9a21[_0xc85d('0x30')],_0x236331[_0xc85d('0x32')]),_0x4d972f);if(_0x3f9a21['query']['filter']){_0x176c6a[_0xc85d('0x39')]=_[_0xc85d('0x3a')](_0x176c6a[_0xc85d('0x39')],{'$or':[{'key':{'$like':'%'+_0x3f9a21['query'][_0xc85d('0x3b')]+'%'}},{'value':{'$like':'%'+_0x3f9a21[_0xc85d('0x30')][_0xc85d('0x3b')]+'%'}}]});}_0x176c6a=_[_0xc85d('0x3a')]({},_0x176c6a,_0x3f9a21[_0xc85d('0x3c')]);var _0x18241c={'where':_0x176c6a[_0xc85d('0x39')]};return db['CannedAnswer'][_0xc85d('0x1e')](_0x18241c)['then'](function(_0x589563){_0x2bd00d[_0xc85d('0x1e')]=_0x589563;if(_0x3f9a21[_0xc85d('0x30')][_0xc85d('0x3d')]){_0x176c6a[_0xc85d('0x3e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x176c6a);})[_0xc85d('0x23')](function(_0x1248c3){_0x2bd00d['rows']=_0x1248c3;return _0x2bd00d;})[_0xc85d('0x23')](respondWithFilteredResult(_0x338e50,_0x176c6a))[_0xc85d('0x3f')](handleError(_0x338e50,null));};exports['show']=function(_0x2398af,_0x251ace){var _0x5af0d4={'raw':!![],'where':{'id':_0x2398af['params']['id']}},_0x1d7d0c={};_0x1d7d0c['model']=_[_0xc85d('0x31')](db['CannedAnswer'][_0xc85d('0x40')]);_0x1d7d0c[_0xc85d('0x30')]=_[_0xc85d('0x31')](_0x2398af[_0xc85d('0x30')]);_0x1d7d0c[_0xc85d('0x32')]=_[_0xc85d('0x41')](_0x1d7d0c[_0xc85d('0x2f')],_0x1d7d0c[_0xc85d('0x30')]);_0x5af0d4[_0xc85d('0x33')]=_[_0xc85d('0x41')](_0x1d7d0c[_0xc85d('0x2f')],qs[_0xc85d('0x34')](_0x2398af[_0xc85d('0x30')]['fields']));_0x5af0d4[_0xc85d('0x33')]=_0x5af0d4[_0xc85d('0x33')][_0xc85d('0x35')]?_0x5af0d4[_0xc85d('0x33')]:_0x1d7d0c[_0xc85d('0x2f')];if(_0x2398af[_0xc85d('0x30')][_0xc85d('0x3d')]){_0x5af0d4['include']=[{'all':!![]}];}_0x5af0d4=_[_0xc85d('0x3a')]({},_0x5af0d4,_0x2398af[_0xc85d('0x3c')]);return db[_0xc85d('0x42')][_0xc85d('0x43')](_0x5af0d4)['then'](handleEntityNotFound(_0x251ace,null))[_0xc85d('0x23')](respondWithResult(_0x251ace,null))[_0xc85d('0x3f')](handleError(_0x251ace,null));};exports[_0xc85d('0x22')]=function(_0x2ab943,_0x5218a3){if(_0x2ab943[_0xc85d('0x44')]['id']){delete _0x2ab943[_0xc85d('0x44')]['id'];}return db['CannedAnswer'][_0xc85d('0x43')]({'where':{'id':_0x2ab943[_0xc85d('0x45')]['id']}})[_0xc85d('0x23')](handleEntityNotFound(_0x5218a3,null))[_0xc85d('0x23')](saveUpdates(_0x2ab943[_0xc85d('0x44')],null))[_0xc85d('0x23')](respondWithResult(_0x5218a3,null))[_0xc85d('0x3f')](handleError(_0x5218a3,null));};exports[_0xc85d('0x24')]=function(_0x524d90,_0x299f25){return db[_0xc85d('0x42')][_0xc85d('0x43')]({'where':{'id':_0x524d90['params']['id']}})[_0xc85d('0x23')](handleEntityNotFound(_0x299f25,null))['then'](removeEntity(_0x299f25,null))['catch'](handleError(_0x299f25,null));};exports[_0xc85d('0x46')]=function(_0x3885b6,_0x49a056){var _0x70b656={'key':_0x3885b6['body']['key']};if(_0x3885b6[_0xc85d('0x44')]['MailAccountId']){_0x70b656[_0xc85d('0x47')]=_0x3885b6[_0xc85d('0x44')][_0xc85d('0x47')];}else if(_0x3885b6['body']['SmsAccountId']){_0x70b656['SmsAccountId']=_0x3885b6[_0xc85d('0x44')][_0xc85d('0x48')];}else if(_0x3885b6[_0xc85d('0x44')][_0xc85d('0x49')]){_0x70b656[_0xc85d('0x49')]=_0x3885b6[_0xc85d('0x44')][_0xc85d('0x49')];}else if(_0x3885b6[_0xc85d('0x44')]['ChatWebsiteId']){_0x70b656[_0xc85d('0x4a')]=_0x3885b6['body'][_0xc85d('0x4a')];}return db['CannedAnswer'][_0xc85d('0x43')]({'where':_0x70b656})[_0xc85d('0x23')](function(_0x102a8d){if(_0x102a8d){throw new db[(_0xc85d('0x4b'))][(_0xc85d('0x4c'))](_0xc85d('0x4d'));}return db[_0xc85d('0x42')]['create'](_0x3885b6[_0xc85d('0x44')]);})[_0xc85d('0x23')](function(_0x14d3d3){var _0x2d6e7c=_0x3885b6[_0xc85d('0x4e')][_0xc85d('0x4f')]({'plain':!![]});if(!_0x2d6e7c)throw new Error(_0xc85d('0x50'));if(_0x2d6e7c['role']===_0xc85d('0x4e')){var _0x2a80dd=_0x14d3d3[_0xc85d('0x4f')]({'plain':!![]});return db[_0xc85d('0x51')][_0xc85d('0x43')]({'where':{'name':_0xc85d('0x25'),'userProfileId':_0x2d6e7c[_0xc85d('0x52')]},'raw':!![]})[_0xc85d('0x23')](function(_0x501793){if(_0x501793&&_0x501793[_0xc85d('0x53')]===0x0){return db['UserProfileResource'][_0xc85d('0x46')]({'name':_0x2a80dd[_0xc85d('0x29')],'resourceId':_0x2a80dd['id'],'type':_0x501793[_0xc85d('0x29')],'sectionId':_0x501793['id']},{})[_0xc85d('0x23')](function(){return _0x14d3d3;});}else{return _0x14d3d3;}})[_0xc85d('0x3f')](function(_0x361a6f){logger[_0xc85d('0x27')](_0xc85d('0x54'),_0x361a6f);throw _0x361a6f;});}return _0x14d3d3;})[_0xc85d('0x23')](respondWithResult(_0x49a056,0xc9))['catch'](handleError(_0x49a056,null));}; \ No newline at end of file +var _0xe1c4=['include','findAll','rows','catch','show','params','rawAttributes','fields','length','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','sendStatus','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options'];(function(_0x20bee5,_0x52defe){var _0x116c5d=function(_0xa84a23){while(--_0xa84a23){_0x20bee5['push'](_0x20bee5['shift']());}};_0x116c5d(++_0x52defe);}(_0xe1c4,0x7e));var _0x4e1c=function(_0x32e919,_0x4fd27c){_0x32e919=_0x32e919-0x0;var _0x2fc4cb=_0xe1c4[_0x32e919];return _0x2fc4cb;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require(_0x4e1c('0x3'));var rp=require(_0x4e1c('0x4'));var moment=require(_0x4e1c('0x5'));var BPromise=require(_0x4e1c('0x6'));var Mustache=require(_0x4e1c('0x7'));var util=require(_0x4e1c('0x8'));var path=require(_0x4e1c('0x9'));var sox=require(_0x4e1c('0xa'));var csv=require(_0x4e1c('0xb'));var ejs=require(_0x4e1c('0xc'));var fs=require('fs');var fs_extra=require(_0x4e1c('0xd'));var _=require(_0x4e1c('0xe'));var squel=require(_0x4e1c('0xf'));var crypto=require(_0x4e1c('0x10'));var jsforce=require(_0x4e1c('0x11'));var deskjs=require(_0x4e1c('0x12'));var toCsv=require('to-csv');var querystring=require(_0x4e1c('0x13'));var Papa=require(_0x4e1c('0x14'));var Redis=require('ioredis');var authService=require(_0x4e1c('0x15'));var qs=require(_0x4e1c('0x16'));var as=require(_0x4e1c('0x17'));var hardwareService=require(_0x4e1c('0x18'));var logger=require(_0x4e1c('0x19'))(_0x4e1c('0x1a'));var utils=require(_0x4e1c('0x1b'));var config=require(_0x4e1c('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20c2c5,_0x10b503){_0x10b503=_0x10b503||0xcc;return function(_0x3b055c){if(_0x3b055c){return _0x20c2c5['sendStatus'](_0x10b503);}return _0x20c2c5['status'](_0x10b503)[_0x4e1c('0x1d')]();};}function respondWithResult(_0x5d4743,_0x23b5eb){_0x23b5eb=_0x23b5eb||0xc8;return function(_0x5c542d){if(_0x5c542d){return _0x5d4743[_0x4e1c('0x1e')](_0x23b5eb)[_0x4e1c('0x1f')](_0x5c542d);}};}function respondWithFilteredResult(_0x30569b,_0x57e748){return function(_0x3fdcb5){if(_0x3fdcb5){var _0x28c091=typeof _0x57e748[_0x4e1c('0x20')]==='undefined'&&typeof _0x57e748[_0x4e1c('0x21')]===_0x4e1c('0x22');var _0x35a4b0=_0x3fdcb5['count'];var _0x4a2989=_0x28c091?0x0:_0x57e748[_0x4e1c('0x20')];var _0x479e6c=_0x28c091?_0x3fdcb5[_0x4e1c('0x23')]:_0x57e748[_0x4e1c('0x20')]+_0x57e748[_0x4e1c('0x21')];var _0x126f82;if(_0x479e6c>=_0x35a4b0){_0x479e6c=_0x35a4b0;_0x126f82=0xc8;}else{_0x126f82=0xce;}_0x30569b[_0x4e1c('0x1e')](_0x126f82);return _0x30569b[_0x4e1c('0x24')](_0x4e1c('0x25'),_0x4a2989+'-'+_0x479e6c+'/'+_0x35a4b0)['json'](_0x3fdcb5);}return null;};}function patchUpdates(_0x5c72c5){return function(_0x5283c7){try{jsonpatch['apply'](_0x5283c7,_0x5c72c5,!![]);}catch(_0x8025c4){return BPromise[_0x4e1c('0x26')](_0x8025c4);}return _0x5283c7[_0x4e1c('0x27')]();};}function saveUpdates(_0x1b2493,_0x2b123e){return function(_0x33a71e){if(_0x33a71e){return _0x33a71e[_0x4e1c('0x28')](_0x1b2493)['then'](function(_0x374001){return _0x374001;});}return null;};}function removeEntity(_0x95b347,_0x5b07e2){return function(_0x213e0a){if(_0x213e0a){return _0x213e0a[_0x4e1c('0x29')]()[_0x4e1c('0x2a')](function(){var _0x2c0479=_0x213e0a[_0x4e1c('0x2b')]({'plain':!![]});var _0x5d8370=_0x4e1c('0x2c');return db[_0x4e1c('0x2d')][_0x4e1c('0x29')]({'where':{'type':_0x5d8370,'resourceId':_0x2c0479['id']}})[_0x4e1c('0x2a')](function(){return _0x213e0a;});})['then'](function(){_0x95b347[_0x4e1c('0x1e')](0xcc)[_0x4e1c('0x1d')]();});}};}function handleEntityNotFound(_0x470052,_0x39cbb1){return function(_0x739837){if(!_0x739837){_0x470052[_0x4e1c('0x2e')](0x194);}return _0x739837;};}function handleError(_0x4ce326,_0x13c676){_0x13c676=_0x13c676||0x1f4;return function(_0x2ce04c){logger['error'](_0x2ce04c['stack']);if(_0x2ce04c[_0x4e1c('0x2f')]){delete _0x2ce04c['name'];}_0x4ce326['status'](_0x13c676)[_0x4e1c('0x30')](_0x2ce04c);};}exports[_0x4e1c('0x31')]=function(_0x59d4ab,_0x23813c){var _0x20076b={},_0x46ecc4={},_0x2ad0f6={'count':0x0,'rows':[]};var _0x2b4b24=_['map'](db[_0x4e1c('0x32')]['rawAttributes'],function(_0x437e03){return{'name':_0x437e03[_0x4e1c('0x33')],'type':_0x437e03[_0x4e1c('0x34')][_0x4e1c('0x35')]};});_0x46ecc4[_0x4e1c('0x36')]=_[_0x4e1c('0x37')](_0x2b4b24,'name');_0x46ecc4[_0x4e1c('0x38')]=_[_0x4e1c('0x39')](_0x59d4ab[_0x4e1c('0x38')]);_0x46ecc4[_0x4e1c('0x3a')]=_['intersection'](_0x46ecc4['model'],_0x46ecc4[_0x4e1c('0x38')]);_0x20076b[_0x4e1c('0x3b')]=_[_0x4e1c('0x3c')](_0x46ecc4[_0x4e1c('0x36')],qs['fields'](_0x59d4ab[_0x4e1c('0x38')]['fields']));_0x20076b['attributes']=_0x20076b[_0x4e1c('0x3b')]['length']?_0x20076b[_0x4e1c('0x3b')]:_0x46ecc4['model'];if(!_0x59d4ab[_0x4e1c('0x38')][_0x4e1c('0x3d')](_0x4e1c('0x3e'))){_0x20076b[_0x4e1c('0x21')]=qs[_0x4e1c('0x21')](_0x59d4ab[_0x4e1c('0x38')][_0x4e1c('0x21')]);_0x20076b[_0x4e1c('0x20')]=qs[_0x4e1c('0x20')](_0x59d4ab[_0x4e1c('0x38')][_0x4e1c('0x20')]);}_0x20076b[_0x4e1c('0x3f')]=qs[_0x4e1c('0x40')](_0x59d4ab[_0x4e1c('0x38')]['sort']);_0x20076b[_0x4e1c('0x41')]=qs['filters'](_[_0x4e1c('0x42')](_0x59d4ab['query'],_0x46ecc4[_0x4e1c('0x3a')]),_0x2b4b24);if(_0x59d4ab[_0x4e1c('0x38')]['filter']){_0x20076b[_0x4e1c('0x41')]=_[_0x4e1c('0x43')](_0x20076b[_0x4e1c('0x41')],{'$or':[{'key':{'$like':'%'+_0x59d4ab[_0x4e1c('0x38')][_0x4e1c('0x44')]+'%'}},{'value':{'$like':'%'+_0x59d4ab['query'][_0x4e1c('0x44')]+'%'}}]});}_0x20076b=_[_0x4e1c('0x43')]({},_0x20076b,_0x59d4ab[_0x4e1c('0x45')]);var _0x1d49f2={'where':_0x20076b[_0x4e1c('0x41')]};return db[_0x4e1c('0x32')][_0x4e1c('0x23')](_0x1d49f2)[_0x4e1c('0x2a')](function(_0x1efe18){_0x2ad0f6[_0x4e1c('0x23')]=_0x1efe18;if(_0x59d4ab[_0x4e1c('0x38')]['includeAll']){_0x20076b[_0x4e1c('0x46')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4e1c('0x47')](_0x20076b);})[_0x4e1c('0x2a')](function(_0x305aa6){_0x2ad0f6[_0x4e1c('0x48')]=_0x305aa6;return _0x2ad0f6;})[_0x4e1c('0x2a')](respondWithFilteredResult(_0x23813c,_0x20076b))[_0x4e1c('0x49')](handleError(_0x23813c,null));};exports[_0x4e1c('0x4a')]=function(_0x1cfefd,_0x145a9c){var _0x2bb029={'raw':!![],'where':{'id':_0x1cfefd[_0x4e1c('0x4b')]['id']}},_0x339913={};_0x339913[_0x4e1c('0x36')]=_['keys'](db[_0x4e1c('0x32')][_0x4e1c('0x4c')]);_0x339913[_0x4e1c('0x38')]=_['keys'](_0x1cfefd[_0x4e1c('0x38')]);_0x339913[_0x4e1c('0x3a')]=_[_0x4e1c('0x3c')](_0x339913['model'],_0x339913[_0x4e1c('0x38')]);_0x2bb029[_0x4e1c('0x3b')]=_[_0x4e1c('0x3c')](_0x339913[_0x4e1c('0x36')],qs[_0x4e1c('0x4d')](_0x1cfefd[_0x4e1c('0x38')][_0x4e1c('0x4d')]));_0x2bb029[_0x4e1c('0x3b')]=_0x2bb029[_0x4e1c('0x3b')][_0x4e1c('0x4e')]?_0x2bb029[_0x4e1c('0x3b')]:_0x339913[_0x4e1c('0x36')];if(_0x1cfefd['query'][_0x4e1c('0x4f')]){_0x2bb029[_0x4e1c('0x46')]=[{'all':!![]}];}_0x2bb029=_[_0x4e1c('0x43')]({},_0x2bb029,_0x1cfefd['options']);return db[_0x4e1c('0x32')][_0x4e1c('0x50')](_0x2bb029)[_0x4e1c('0x2a')](handleEntityNotFound(_0x145a9c,null))[_0x4e1c('0x2a')](respondWithResult(_0x145a9c,null))['catch'](handleError(_0x145a9c,null));};exports['update']=function(_0x5129ab,_0x5d0010){if(_0x5129ab['body']['id']){delete _0x5129ab[_0x4e1c('0x51')]['id'];}return db['CannedAnswer'][_0x4e1c('0x50')]({'where':{'id':_0x5129ab[_0x4e1c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d0010,null))[_0x4e1c('0x2a')](saveUpdates(_0x5129ab[_0x4e1c('0x51')],null))[_0x4e1c('0x2a')](respondWithResult(_0x5d0010,null))[_0x4e1c('0x49')](handleError(_0x5d0010,null));};exports[_0x4e1c('0x29')]=function(_0x176608,_0xb8b3b6){return db[_0x4e1c('0x32')][_0x4e1c('0x50')]({'where':{'id':_0x176608[_0x4e1c('0x4b')]['id']}})[_0x4e1c('0x2a')](handleEntityNotFound(_0xb8b3b6,null))[_0x4e1c('0x2a')](removeEntity(_0xb8b3b6,null))[_0x4e1c('0x49')](handleError(_0xb8b3b6,null));};exports[_0x4e1c('0x52')]=function(_0x3234ba,_0x6d79f5){var _0x22b98d={'key':_0x3234ba[_0x4e1c('0x51')][_0x4e1c('0x35')]};if(_0x3234ba['body'][_0x4e1c('0x53')]){_0x22b98d['MailAccountId']=_0x3234ba[_0x4e1c('0x51')][_0x4e1c('0x53')];}else if(_0x3234ba[_0x4e1c('0x51')]['SmsAccountId']){_0x22b98d['SmsAccountId']=_0x3234ba['body'][_0x4e1c('0x54')];}else if(_0x3234ba['body'][_0x4e1c('0x55')]){_0x22b98d[_0x4e1c('0x55')]=_0x3234ba[_0x4e1c('0x51')][_0x4e1c('0x55')];}else if(_0x3234ba[_0x4e1c('0x51')][_0x4e1c('0x56')]){_0x22b98d[_0x4e1c('0x56')]=_0x3234ba['body'][_0x4e1c('0x56')];}return db[_0x4e1c('0x32')][_0x4e1c('0x50')]({'where':_0x22b98d})['then'](function(_0x20cc04){if(_0x20cc04){throw new db[(_0x4e1c('0x57'))][(_0x4e1c('0x58'))](_0x4e1c('0x59'));}return db[_0x4e1c('0x32')][_0x4e1c('0x52')](_0x3234ba[_0x4e1c('0x51')]);})[_0x4e1c('0x2a')](function(_0x2c9e08){var _0x5be6e8=_0x3234ba[_0x4e1c('0x5a')][_0x4e1c('0x2b')]({'plain':!![]});if(!_0x5be6e8)throw new Error(_0x4e1c('0x5b'));if(_0x5be6e8[_0x4e1c('0x5c')]===_0x4e1c('0x5a')){var _0x40cfd3=_0x2c9e08['get']({'plain':!![]});return db[_0x4e1c('0x5d')][_0x4e1c('0x50')]({'where':{'name':'CannedAnswers','userProfileId':_0x5be6e8[_0x4e1c('0x5e')]},'raw':!![]})[_0x4e1c('0x2a')](function(_0x4472f4){if(_0x4472f4&&_0x4472f4[_0x4e1c('0x5f')]===0x0){return db[_0x4e1c('0x2d')][_0x4e1c('0x52')]({'name':_0x40cfd3[_0x4e1c('0x2f')],'resourceId':_0x40cfd3['id'],'type':_0x4472f4[_0x4e1c('0x2f')],'sectionId':_0x4472f4['id']},{})[_0x4e1c('0x2a')](function(){return _0x2c9e08;});}else{return _0x2c9e08;}})[_0x4e1c('0x49')](function(_0x3f20cd){logger[_0x4e1c('0x60')](_0x4e1c('0x61'),_0x3f20cd);throw _0x3f20cd;});}return _0x2c9e08;})[_0x4e1c('0x2a')](respondWithResult(_0x6d79f5,0xc9))[_0x4e1c('0x49')](handleError(_0x6d79f5,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b2278ea..8119fac 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 _0x65b0=['../../config/logger','moment','bluebird','rimraf','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x65b0,0x18f));var _0x065b=function(_0x9f1282,_0x1576cb){_0x9f1282=_0x9f1282-0x0;var _0x2cd1f3=_0x65b0[_0x9f1282];return _0x2cd1f3;};'use strict';var _=require('lodash');var util=require(_0x065b('0x0'));var logger=require(_0x065b('0x1'))('api');var moment=require(_0x065b('0x2'));var BPromise=require(_0x065b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x065b('0x4'));var config=require('../../config/environment');var attributes=require(_0x065b('0x5'));module[_0x065b('0x6')]=function(_0x47136a,_0x1b9f46){return _0x47136a['define'](_0x065b('0x7'),attributes,{'tableName':_0x065b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x065b('0x9')});}; \ No newline at end of file +var _0x6fbb=['rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','moment','bluebird','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6fbb,0x13b));var _0xb6fb=function(_0x1315e2,_0xd8ae26){_0x1315e2=_0x1315e2-0x0;var _0x45dbe6=_0x6fbb[_0x1315e2];return _0x45dbe6;};'use strict';var _=require(_0xb6fb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6fb('0x1'));var BPromise=require(_0xb6fb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fb('0x3'));var rimraf=require(_0xb6fb('0x4'));var config=require(_0xb6fb('0x5'));var attributes=require(_0xb6fb('0x6'));module['exports']=function(_0x5807e7,_0x27b7ca){return _0x5807e7[_0xb6fb('0x7')](_0xb6fb('0x8'),attributes,{'tableName':_0xb6fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6fb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 59a1cd4..fd8e3b4 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(_0x1a9322,_0x4e3755){var _0x277f3f=function(_0x15f266){while(--_0x15f266){_0x1a9322['push'](_0x1a9322['shift']());}};_0x277f3f(++_0x4e3755);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x63608c,_0x41dfdb){var _0x3977f8=function(_0x1788a5){while(--_0x1788a5){_0x63608c['push'](_0x63608c['shift']());}};_0x3977f8(++_0x41dfdb);}(_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/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 67231b4..f0b8306 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 _0xd743=['../../config/environment','./cannedAnswer.controller','get','index','/:id','show','isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xc8e56e,_0x27450a){var _0x3e44b3=function(_0x547533){while(--_0x547533){_0xc8e56e['push'](_0xc8e56e['shift']());}};_0x3e44b3(++_0x27450a);}(_0xd743,0x1ce));var _0x3d74=function(_0x450aa1,_0x370a37){_0x450aa1=_0x450aa1-0x0;var _0xeadef4=_0xd743[_0x450aa1];return _0xeadef4;};'use strict';var multer=require(_0x3d74('0x0'));var util=require(_0x3d74('0x1'));var path=require('path');var timeout=require(_0x3d74('0x2'));var express=require(_0x3d74('0x3'));var router=express[_0x3d74('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3d74('0x5'));var config=require(_0x3d74('0x6'));var controller=require(_0x3d74('0x7'));router[_0x3d74('0x8')]('/',auth['isAuthenticated'](),controller[_0x3d74('0x9')]);router[_0x3d74('0x8')](_0x3d74('0xa'),auth['isAuthenticated'](),controller[_0x3d74('0xb')]);router['post']('/',auth[_0x3d74('0xc')](),controller[_0x3d74('0xd')]);router['put']('/:id',auth[_0x3d74('0xc')](),controller[_0x3d74('0xe')]);router[_0x3d74('0xf')](_0x3d74('0xa'),auth[_0x3d74('0xc')](),controller[_0x3d74('0x10')]);module[_0x3d74('0x11')]=router; \ No newline at end of file +var _0x883d=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x201920,_0x23a42e){var _0x11ca83=function(_0x14cde0){while(--_0x14cde0){_0x201920['push'](_0x201920['shift']());}};_0x11ca83(++_0x23a42e);}(_0x883d,0x18a));var _0xd883=function(_0x46a40a,_0x2e4db2){_0x46a40a=_0x46a40a-0x0;var _0xe9f4ea=_0x883d[_0x46a40a];return _0xe9f4ea;};'use strict';var multer=require(_0xd883('0x0'));var util=require(_0xd883('0x1'));var path=require(_0xd883('0x2'));var timeout=require(_0xd883('0x3'));var express=require('express');var router=express[_0xd883('0x4')]();var fs_extra=require(_0xd883('0x5'));var auth=require(_0xd883('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd883('0x7'));router[_0xd883('0x8')]('/',auth[_0xd883('0x9')](),controller['index']);router['get'](_0xd883('0xa'),auth[_0xd883('0x9')](),controller[_0xd883('0xb')]);router[_0xd883('0xc')]('/',auth[_0xd883('0x9')](),controller[_0xd883('0xd')]);router[_0xd883('0xe')]('/:id',auth[_0xd883('0x9')](),controller['update']);router[_0xd883('0xf')]('/:id',auth[_0xd883('0x9')](),controller[_0xd883('0x10')]);module[_0xd883('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4780510..6420cfc 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 _0x0f61=['INTEGER','exports','STRING'];(function(_0x579f17,_0x1984cb){var _0x25e10e=function(_0x34d900){while(--_0x34d900){_0x579f17['push'](_0x579f17['shift']());}};_0x25e10e(++_0x1984cb);}(_0x0f61,0xa6));var _0x10f6=function(_0x24d95b,_0x3a25a7){_0x24d95b=_0x24d95b-0x0;var _0x876fc5=_0x0f61[_0x24d95b];return _0x876fc5;};'use strict';var Sequelize=require('sequelize');module[_0x10f6('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x10f6('0x1')]},'src':{'type':Sequelize[_0x10f6('0x1')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x10f6('0x1')]},'channel':{'type':Sequelize[_0x10f6('0x1')]},'dstchannel':{'type':Sequelize[_0x10f6('0x1')]},'lastapp':{'type':Sequelize[_0x10f6('0x1')]},'lastdata':{'type':Sequelize[_0x10f6('0x1')]},'duration':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x10f6('0x1')]},'amaflags':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x10f6('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x10f6('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x10f6('0x1')]},'peeraccount':{'type':Sequelize[_0x10f6('0x1')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x10f6('0x1')]}}; \ No newline at end of file +var _0x7846=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x15d4d7,_0x906f5a){var _0x321017=function(_0x13517e){while(--_0x13517e){_0x15d4d7['push'](_0x15d4d7['shift']());}};_0x321017(++_0x906f5a);}(_0x7846,0xf4));var _0x6784=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x7846[_0x5a27e8];return _0x4e38f7;};'use strict';var Sequelize=require('sequelize');module[_0x6784('0x0')]={'calldate':{'type':Sequelize[_0x6784('0x1')],'allowNull':![],'defaultValue':_0x6784('0x2')},'clid':{'type':Sequelize[_0x6784('0x3')]},'src':{'type':Sequelize[_0x6784('0x3')]},'dst':{'type':Sequelize[_0x6784('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6784('0x3')]},'dstchannel':{'type':Sequelize[_0x6784('0x3')]},'lastapp':{'type':Sequelize[_0x6784('0x3')]},'lastdata':{'type':Sequelize[_0x6784('0x3')]},'duration':{'type':Sequelize[_0x6784('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6784('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6784('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6784('0x3')]},'uniqueid':{'type':Sequelize[_0x6784('0x3')]},'linkedid':{'type':Sequelize[_0x6784('0x3')]},'sequence':{'type':Sequelize[_0x6784('0x3')]},'peeraccount':{'type':Sequelize[_0x6784('0x3')]},'type':{'type':Sequelize[_0x6784('0x3')]},'tag':{'type':Sequelize[_0x6784('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index fc8d2d7..fff470d 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 _0x8085=['name','send','index','map','Cdr','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x52c6ec,_0x401b11){var _0x47813e=function(_0x11a6c2){while(--_0x11a6c2){_0x52c6ec['push'](_0x52c6ec['shift']());}};_0x47813e(++_0x401b11);}(_0x8085,0x71));var _0x5808=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x8085[_0x5e4563];return _0x8d1bf5;};'use strict';var emlformat=require(_0x5808('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5808('0x1'));var rp=require(_0x5808('0x2'));var moment=require(_0x5808('0x3'));var BPromise=require(_0x5808('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5808('0x5'));var sox=require(_0x5808('0x6'));var csv=require('to-csv');var ejs=require(_0x5808('0x7'));var fs=require('fs');var fs_extra=require(_0x5808('0x8'));var _=require(_0x5808('0x9'));var squel=require(_0x5808('0xa'));var crypto=require(_0x5808('0xb'));var jsforce=require(_0x5808('0xc'));var deskjs=require(_0x5808('0xd'));var toCsv=require(_0x5808('0xe'));var querystring=require(_0x5808('0xf'));var Papa=require(_0x5808('0x10'));var Redis=require(_0x5808('0x11'));var authService=require(_0x5808('0x12'));var qs=require(_0x5808('0x13'));var as=require(_0x5808('0x14'));var hardwareService=require(_0x5808('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5808('0x16'));var config=require(_0x5808('0x17'));var licenseUtil=require(_0x5808('0x18'));var db=require(_0x5808('0x19'))['db'];function respondWithStatusCode(_0xab4f46,_0x19be03){_0x19be03=_0x19be03||0xcc;return function(_0x10572d){if(_0x10572d){return _0xab4f46['sendStatus'](_0x19be03);}return _0xab4f46['status'](_0x19be03)[_0x5808('0x1a')]();};}function respondWithResult(_0x19252b,_0x3582d6){_0x3582d6=_0x3582d6||0xc8;return function(_0x3e7c09){if(_0x3e7c09){return _0x19252b[_0x5808('0x1b')](_0x3582d6)[_0x5808('0x1c')](_0x3e7c09);}};}function respondWithFilteredResult(_0x299b22,_0x2af9da){return function(_0x1dda8d){if(_0x1dda8d){var _0x46dd8a=typeof _0x2af9da[_0x5808('0x1d')]==='undefined'&&typeof _0x2af9da[_0x5808('0x1e')]==='undefined';var _0x406e65=_0x1dda8d[_0x5808('0x1f')];var _0x3bf0ee=_0x46dd8a?0x0:_0x2af9da['offset'];var _0x9e58d4=_0x46dd8a?_0x1dda8d[_0x5808('0x1f')]:_0x2af9da['offset']+_0x2af9da['limit'];var _0x3c7c02;if(_0x9e58d4>=_0x406e65){_0x9e58d4=_0x406e65;_0x3c7c02=0xc8;}else{_0x3c7c02=0xce;}_0x299b22['status'](_0x3c7c02);return _0x299b22[_0x5808('0x20')](_0x5808('0x21'),_0x3bf0ee+'-'+_0x9e58d4+'/'+_0x406e65)[_0x5808('0x1c')](_0x1dda8d);}return null;};}function patchUpdates(_0xaac16a){return function(_0x578d70){try{jsonpatch['apply'](_0x578d70,_0xaac16a,!![]);}catch(_0xe82ad0){return BPromise[_0x5808('0x22')](_0xe82ad0);}return _0x578d70[_0x5808('0x23')]();};}function saveUpdates(_0x39bca3,_0x409337){return function(_0x33b583){if(_0x33b583){return _0x33b583[_0x5808('0x24')](_0x39bca3)[_0x5808('0x25')](function(_0x3a575e){return _0x3a575e;});}return null;};}function removeEntity(_0x4e1dfc,_0x5b5175){return function(_0x130590){if(_0x130590){return _0x130590[_0x5808('0x26')]()['then'](function(){_0x4e1dfc['status'](0xcc)[_0x5808('0x1a')]();});}};}function handleEntityNotFound(_0x467500,_0x1dddbd){return function(_0x4a4d05){if(!_0x4a4d05){_0x467500['sendStatus'](0x194);}return _0x4a4d05;};}function handleError(_0x24ee0f,_0x2c2cb5){_0x2c2cb5=_0x2c2cb5||0x1f4;return function(_0x27c991){logger[_0x5808('0x27')](_0x27c991[_0x5808('0x28')]);if(_0x27c991['name']){delete _0x27c991[_0x5808('0x29')];}_0x24ee0f[_0x5808('0x1b')](_0x2c2cb5)[_0x5808('0x2a')](_0x27c991);};}exports[_0x5808('0x2b')]=function(_0x28c1eb,_0x19ac63){var _0x1117ac={},_0x4ad6d8={},_0x560e83={'count':0x0,'rows':[]};var _0x4f6342=_[_0x5808('0x2c')](db[_0x5808('0x2d')]['rawAttributes'],function(_0x3faa07){return{'name':_0x3faa07[_0x5808('0x2e')],'type':_0x3faa07[_0x5808('0x2f')][_0x5808('0x30')]};});_0x4ad6d8[_0x5808('0x31')]=_[_0x5808('0x2c')](_0x4f6342,'name');_0x4ad6d8[_0x5808('0x32')]=_[_0x5808('0x33')](_0x28c1eb[_0x5808('0x32')]);_0x4ad6d8['filters']=_['intersection'](_0x4ad6d8[_0x5808('0x31')],_0x4ad6d8['query']);_0x1117ac[_0x5808('0x34')]=_[_0x5808('0x35')](_0x4ad6d8['model'],qs[_0x5808('0x36')](_0x28c1eb[_0x5808('0x32')]['fields']));_0x1117ac['attributes']=_0x1117ac[_0x5808('0x34')]['length']?_0x1117ac[_0x5808('0x34')]:_0x4ad6d8['model'];if(!_0x28c1eb[_0x5808('0x32')][_0x5808('0x37')](_0x5808('0x38'))){_0x1117ac['limit']=qs[_0x5808('0x1e')](_0x28c1eb['query'][_0x5808('0x1e')]);_0x1117ac['offset']=qs['offset'](_0x28c1eb[_0x5808('0x32')][_0x5808('0x1d')]);}_0x1117ac[_0x5808('0x39')]=qs['sort'](_0x28c1eb['query'][_0x5808('0x3a')]);_0x1117ac[_0x5808('0x3b')]=qs['filters'](_[_0x5808('0x3c')](_0x28c1eb[_0x5808('0x32')],_0x4ad6d8[_0x5808('0x3d')]),_0x4f6342);if(_0x28c1eb['query'][_0x5808('0x3e')]){_0x1117ac[_0x5808('0x3b')]=_[_0x5808('0x3f')](_0x1117ac['where'],{'$or':_[_0x5808('0x2c')](_0x4f6342,function(_0x12a045){if(_0x12a045['type']!=='VIRTUAL'){var _0x477278={};_0x477278[_0x12a045['name']]={'$like':'%'+_0x28c1eb[_0x5808('0x32')][_0x5808('0x3e')]+'%'};return _0x477278;}})});}_0x1117ac=_[_0x5808('0x3f')]({},_0x1117ac,_0x28c1eb[_0x5808('0x40')]);var _0x21fc36={'where':_0x1117ac['where']};return db['Cdr'][_0x5808('0x1f')](_0x21fc36)[_0x5808('0x25')](function(_0x402b4e){_0x560e83['count']=_0x402b4e;if(_0x28c1eb[_0x5808('0x32')][_0x5808('0x41')]){_0x1117ac[_0x5808('0x42')]=[{'all':!![]}];}return db[_0x5808('0x2d')][_0x5808('0x43')](_0x1117ac);})['then'](function(_0x1130c8){_0x560e83[_0x5808('0x44')]=_0x1130c8;return _0x560e83;})[_0x5808('0x25')](respondWithFilteredResult(_0x19ac63,_0x1117ac))['catch'](handleError(_0x19ac63,null));};exports[_0x5808('0x45')]=function(_0x287e07,_0xc62608){var _0x5e1230={'raw':!![],'where':{'id':_0x287e07[_0x5808('0x46')]['id']}},_0x5dcb50={};_0x5dcb50[_0x5808('0x31')]=_[_0x5808('0x33')](db[_0x5808('0x2d')][_0x5808('0x47')]);_0x5dcb50[_0x5808('0x32')]=_[_0x5808('0x33')](_0x287e07[_0x5808('0x32')]);_0x5dcb50[_0x5808('0x3d')]=_[_0x5808('0x35')](_0x5dcb50[_0x5808('0x31')],_0x5dcb50[_0x5808('0x32')]);_0x5e1230[_0x5808('0x34')]=_['intersection'](_0x5dcb50['model'],qs[_0x5808('0x36')](_0x287e07[_0x5808('0x32')][_0x5808('0x36')]));_0x5e1230[_0x5808('0x34')]=_0x5e1230[_0x5808('0x34')][_0x5808('0x48')]?_0x5e1230[_0x5808('0x34')]:_0x5dcb50['model'];if(_0x287e07[_0x5808('0x32')]['includeAll']){_0x5e1230[_0x5808('0x42')]=[{'all':!![]}];}_0x5e1230=_['merge']({},_0x5e1230,_0x287e07[_0x5808('0x40')]);return db['Cdr']['find'](_0x5e1230)['then'](handleEntityNotFound(_0xc62608,null))[_0x5808('0x25')](respondWithResult(_0xc62608,null))[_0x5808('0x49')](handleError(_0xc62608,null));};exports['create']=function(_0x46c8ed,_0x4568d0){return db[_0x5808('0x2d')]['create'](_0x46c8ed[_0x5808('0x4a')],{})['then'](respondWithResult(_0x4568d0,0xc9))[_0x5808('0x49')](handleError(_0x4568d0,null));};exports[_0x5808('0x24')]=function(_0x13fe11,_0x5cc977){if(_0x13fe11[_0x5808('0x4a')]['id']){delete _0x13fe11[_0x5808('0x4a')]['id'];}return db[_0x5808('0x2d')][_0x5808('0x4b')]({'where':{'id':_0x13fe11['params']['id']}})[_0x5808('0x25')](handleEntityNotFound(_0x5cc977,null))[_0x5808('0x25')](saveUpdates(_0x13fe11[_0x5808('0x4a')],null))[_0x5808('0x25')](respondWithResult(_0x5cc977,null))[_0x5808('0x49')](handleError(_0x5cc977,null));};exports[_0x5808('0x26')]=function(_0x5572f3,_0x23d2fe){return db[_0x5808('0x2d')][_0x5808('0x4b')]({'where':{'id':_0x5572f3[_0x5808('0x46')]['id']}})[_0x5808('0x25')](handleEntityNotFound(_0x23d2fe,null))['then'](removeEntity(_0x23d2fe,null))[_0x5808('0x49')](handleError(_0x23d2fe,null));};exports[_0x5808('0x4c')]=function(_0xc2c5d7,_0x44ff0a){return db[_0x5808('0x2d')][_0x5808('0x4c')]()['then'](respondWithResult(_0x44ff0a,null))[_0x5808('0x49')](handleError(_0x44ff0a,null));}; \ No newline at end of file +var _0xee14=['params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x1b8689,_0x3df511){var _0x1a153e=function(_0x6d7e5c){while(--_0x6d7e5c){_0x1b8689['push'](_0x1b8689['shift']());}};_0x1a153e(++_0x3df511);}(_0xee14,0x13a));var _0x4ee1=function(_0x10eade,_0x176c3a){_0x10eade=_0x10eade-0x0;var _0x19ab06=_0xee14[_0x10eade];return _0x19ab06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['Cdr'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x2e')](_0x13944c,'name');_0x1d91be[_0x4ee1('0x34')]=_[_0x4ee1('0x35')](_0x4746c2[_0x4ee1('0x34')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x1d91be[_0x4ee1('0x33')],_0x1d91be['query']);_0x3dc870['attributes']=_[_0x4ee1('0x37')](_0x1d91be[_0x4ee1('0x33')],qs[_0x4ee1('0x38')](_0x4746c2['query'][_0x4ee1('0x38')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3a')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3b')](_0x4ee1('0x3c'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x20')]);_0x3dc870['offset']=qs[_0x4ee1('0x1e')](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x1e')]);}_0x3dc870['order']=qs['sort'](_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3d')]);_0x3dc870[_0x4ee1('0x3e')]=qs[_0x4ee1('0x36')](_['pick'](_0x4746c2[_0x4ee1('0x34')],_0x1d91be[_0x4ee1('0x36')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3f')]){_0x3dc870[_0x4ee1('0x3e')]=_[_0x4ee1('0x40')](_0x3dc870[_0x4ee1('0x3e')],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x59b5cc){if(_0x59b5cc[_0x4ee1('0x31')]!==_0x4ee1('0x41')){var _0x345003={};_0x345003[_0x59b5cc[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x3f')]+'%'};return _0x345003;}})});}_0x3dc870=_['merge']({},_0x3dc870,_0x4746c2[_0x4ee1('0x42')]);var _0x37176a={'where':_0x3dc870[_0x4ee1('0x3e')]};return db[_0x4ee1('0x43')][_0x4ee1('0x21')](_0x37176a)[_0x4ee1('0x29')](function(_0x3f0d8b){_0x59a34e[_0x4ee1('0x21')]=_0x3f0d8b;if(_0x4746c2[_0x4ee1('0x34')][_0x4ee1('0x44')]){_0x3dc870[_0x4ee1('0x45')]=[{'all':!![]}];}return db[_0x4ee1('0x43')][_0x4ee1('0x46')](_0x3dc870);})['then'](function(_0x3b3bed){_0x59a34e[_0x4ee1('0x47')]=_0x3b3bed;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x48')](handleError(_0x4ec408,null));};exports['show']=function(_0x174167,_0x52ebc0){var _0x14c333={'raw':!![],'where':{'id':_0x174167['params']['id']}},_0xc7580c={};_0xc7580c[_0x4ee1('0x33')]=_[_0x4ee1('0x35')](db[_0x4ee1('0x43')][_0x4ee1('0x2f')]);_0xc7580c['query']=_[_0x4ee1('0x35')](_0x174167[_0x4ee1('0x34')]);_0xc7580c[_0x4ee1('0x36')]=_['intersection'](_0xc7580c['model'],_0xc7580c[_0x4ee1('0x34')]);_0x14c333[_0x4ee1('0x39')]=_[_0x4ee1('0x37')](_0xc7580c[_0x4ee1('0x33')],qs[_0x4ee1('0x38')](_0x174167['query']['fields']));_0x14c333[_0x4ee1('0x39')]=_0x14c333[_0x4ee1('0x39')][_0x4ee1('0x3a')]?_0x14c333[_0x4ee1('0x39')]:_0xc7580c['model'];if(_0x174167[_0x4ee1('0x34')][_0x4ee1('0x44')]){_0x14c333['include']=[{'all':!![]}];}_0x14c333=_[_0x4ee1('0x40')]({},_0x14c333,_0x174167[_0x4ee1('0x42')]);return db[_0x4ee1('0x43')][_0x4ee1('0x49')](_0x14c333)[_0x4ee1('0x29')](handleEntityNotFound(_0x52ebc0,null))[_0x4ee1('0x29')](respondWithResult(_0x52ebc0,null))[_0x4ee1('0x48')](handleError(_0x52ebc0,null));};exports[_0x4ee1('0x4a')]=function(_0x390051,_0x4ebb28){return db['Cdr'][_0x4ee1('0x4a')](_0x390051[_0x4ee1('0x4b')],{})[_0x4ee1('0x29')](respondWithResult(_0x4ebb28,0xc9))[_0x4ee1('0x48')](handleError(_0x4ebb28,null));};exports['update']=function(_0x35edf5,_0x3c66d1){if(_0x35edf5[_0x4ee1('0x4b')]['id']){delete _0x35edf5[_0x4ee1('0x4b')]['id'];}return db[_0x4ee1('0x43')]['find']({'where':{'id':_0x35edf5[_0x4ee1('0x4c')]['id']}})[_0x4ee1('0x29')](handleEntityNotFound(_0x3c66d1,null))[_0x4ee1('0x29')](saveUpdates(_0x35edf5['body'],null))[_0x4ee1('0x29')](respondWithResult(_0x3c66d1,null))['catch'](handleError(_0x3c66d1,null));};exports[_0x4ee1('0x28')]=function(_0x5a1114,_0x30a1cd){return db['Cdr'][_0x4ee1('0x49')]({'where':{'id':_0x5a1114['params']['id']}})[_0x4ee1('0x29')](handleEntityNotFound(_0x30a1cd,null))[_0x4ee1('0x29')](removeEntity(_0x30a1cd,null))[_0x4ee1('0x48')](handleError(_0x30a1cd,null));};exports['describe']=function(_0x3368ed,_0x4118d7){return db[_0x4ee1('0x43')][_0x4ee1('0x4d')]()[_0x4ee1('0x29')](respondWithResult(_0x4118d7,null))[_0x4ee1('0x48')](handleError(_0x4118d7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 14baa66..3eed475 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 _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1e2dc5,_0x4f7353){var _0x1d881d=function(_0x4e8ab4){while(--_0x4e8ab4){_0x1e2dc5['push'](_0x1e2dc5['shift']());}};_0x1d881d(++_0x4f7353);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x438380,_0x15b3e7){var _0x50ba87=function(_0x4fa67d){while(--_0x4fa67d){_0x438380['push'](_0x438380['shift']());}};_0x50ba87(++_0x15b3e7);}(_0x7a54,0x106));var _0x47a5=function(_0x5502f0,_0x312d7f){_0x5502f0=_0x5502f0-0x0;var _0x5b84af=_0x7a54[_0x5502f0];return _0x5b84af;};'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 e10dbbc..abd4feb 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 _0x59d4=['../../config/logger','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e0e8f,_0x1f9544){var _0x4f2799=function(_0x1637df){while(--_0x1637df){_0x4e0e8f['push'](_0x4e0e8f['shift']());}};_0x4f2799(++_0x1f9544);}(_0x59d4,0x1b1));var _0x459d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x59d4[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x459d('0x0'));var util=require(_0x459d('0x1'));var moment=require('moment');var BPromise=require(_0x459d('0x2'));var rs=require(_0x459d('0x3'));var fs=require('fs');var Redis=require(_0x459d('0x4'));var db=require(_0x459d('0x5'))['db'];var utils=require(_0x459d('0x6'));var logger=require(_0x459d('0x7'))('rpc');var config=require(_0x459d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x459d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9adc,_0x45c701,_0x19f1c3){return new BPromise(function(_0x390938,_0x4b6cbd){return client[_0x459d('0xa')](_0x1f9adc,_0x19f1c3)[_0x459d('0xb')](function(_0x5dd0a3){logger[_0x459d('0xc')](_0x459d('0xd'),_0x45c701,_0x459d('0xe'));logger[_0x459d('0xf')](_0x459d('0x10'),_0x45c701,_0x459d('0xe'),JSON[_0x459d('0x11')](_0x5dd0a3));if(_0x5dd0a3[_0x459d('0x12')]){if(_0x5dd0a3['error']['code']===0x1f4){logger[_0x459d('0x12')](_0x459d('0xd'),_0x45c701,_0x5dd0a3[_0x459d('0x12')][_0x459d('0x13')]);return _0x4b6cbd(_0x5dd0a3[_0x459d('0x12')][_0x459d('0x13')]);}logger[_0x459d('0x12')]('Cdr,\x20%s,\x20%s',_0x45c701,_0x5dd0a3[_0x459d('0x12')][_0x459d('0x13')]);return _0x390938(_0x5dd0a3[_0x459d('0x12')][_0x459d('0x13')]);}else{logger[_0x459d('0xc')](_0x459d('0xd'),_0x45c701,_0x459d('0xe'));_0x390938(_0x5dd0a3[_0x459d('0x14')][_0x459d('0x13')]);}})[_0x459d('0x15')](function(_0x2c2390){logger[_0x459d('0x12')](_0x459d('0xd'),_0x45c701,_0x2c2390);_0x4b6cbd(_0x2c2390);});});} \ No newline at end of file +var _0xab44=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x1f706a,_0x3b6032){var _0x190572=function(_0x47fbe0){while(--_0x47fbe0){_0x1f706a['push'](_0x1f706a['shift']());}};_0x190572(++_0x3b6032);}(_0xab44,0xcb));var _0x4ab4=function(_0x2cf042,_0x32342f){_0x2cf042=_0x2cf042-0x0;var _0x204543=_0xab44[_0x2cf042];return _0x204543;};'use strict';var _=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var moment=require(_0x4ab4('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ab4('0x3'));var fs=require('fs');var Redis=require(_0x4ab4('0x4'));var db=require(_0x4ab4('0x5'))['db'];var utils=require(_0x4ab4('0x6'));var logger=require(_0x4ab4('0x7'))(_0x4ab4('0x8'));var config=require(_0x4ab4('0x9'));var jayson=require(_0x4ab4('0xa'));var client=jayson[_0x4ab4('0xb')][_0x4ab4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20ed69,_0x1160db,_0x941b25){return new BPromise(function(_0x16d9a5,_0x468267){return client[_0x4ab4('0xd')](_0x20ed69,_0x941b25)[_0x4ab4('0xe')](function(_0x4fac5e){logger['info'](_0x4ab4('0xf'),_0x1160db,_0x4ab4('0x10'));logger[_0x4ab4('0x11')](_0x4ab4('0x12'),_0x1160db,_0x4ab4('0x10'),JSON[_0x4ab4('0x13')](_0x4fac5e));if(_0x4fac5e[_0x4ab4('0x14')]){if(_0x4fac5e[_0x4ab4('0x14')][_0x4ab4('0x15')]===0x1f4){logger[_0x4ab4('0x14')]('Cdr,\x20%s,\x20%s',_0x1160db,_0x4fac5e[_0x4ab4('0x14')][_0x4ab4('0x16')]);return _0x468267(_0x4fac5e[_0x4ab4('0x14')]['message']);}logger[_0x4ab4('0x14')](_0x4ab4('0xf'),_0x1160db,_0x4fac5e[_0x4ab4('0x14')][_0x4ab4('0x16')]);return _0x16d9a5(_0x4fac5e['error']['message']);}else{logger[_0x4ab4('0x17')](_0x4ab4('0xf'),_0x1160db,_0x4ab4('0x10'));_0x16d9a5(_0x4fac5e[_0x4ab4('0x18')][_0x4ab4('0x16')]);}})[_0x4ab4('0x19')](function(_0x46c71f){logger[_0x4ab4('0x14')](_0x4ab4('0xf'),_0x1160db,_0x46c71f);_0x468267(_0x46c71f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6285871..b11f7f7 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x25c2e9,_0x3d4f7d){var _0x3769b3=function(_0x5e0dd6){while(--_0x5e0dd6){_0x25c2e9['push'](_0x25c2e9['shift']());}};_0x3769b3(++_0x3d4f7d);}(_0xb10b,0x12a));var _0xbb10=function(_0x41da6,_0x42431b){_0x41da6=_0x41da6-0x0;var _0x282340=_0xb10b[_0x41da6];return _0x282340;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +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(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_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 0904d15..84e50ad 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 _0x3bc7=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x22c291,_0xddc5ae){var _0x2bb430=function(_0x47eb52){while(--_0x47eb52){_0x22c291['push'](_0x22c291['shift']());}};_0x2bb430(++_0xddc5ae);}(_0x3bc7,0x95));var _0x73bc=function(_0x172ec3,_0x5e1d72){_0x172ec3=_0x172ec3-0x0;var _0x3d6538=_0x3bc7[_0x172ec3];return _0x3d6538;};'use strict';var Sequelize=require(_0x73bc('0x0'));module['exports']={'priority':{'type':Sequelize[_0x73bc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x73bc('0x2')],'allowNull':![],'defaultValue':_0x73bc('0x3')},'appdata':{'type':Sequelize[_0x73bc('0x4')]()},'description':{'type':Sequelize[_0x73bc('0x2')]},'interval':{'type':Sequelize[_0x73bc('0x2')],'defaultValue':_0x73bc('0x5')}}; \ No newline at end of file +var _0x8d59=['STRING','noop','TEXT','exports'];(function(_0x1af7ab,_0x39a461){var _0x211f82=function(_0x50975b){while(--_0x50975b){_0x1af7ab['push'](_0x1af7ab['shift']());}};_0x211f82(++_0x39a461);}(_0x8d59,0xab));var _0x98d5=function(_0x3305f1,_0x14ddc2){_0x3305f1=_0x3305f1-0x0;var _0x4d2661=_0x8d59[_0x3305f1];return _0x4d2661;};'use strict';var Sequelize=require('sequelize');module[_0x98d5('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x98d5('0x1')],'allowNull':![],'defaultValue':_0x98d5('0x2')},'appdata':{'type':Sequelize[_0x98d5('0x3')]()},'description':{'type':Sequelize[_0x98d5('0x1')]},'interval':{'type':Sequelize[_0x98d5('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ea33760..37cb581 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 _0xc820=['save','update','then','destroy','sendStatus','name','send','show','model','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','ChatApplication','params','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','Content-Range','apply'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0xc820,0x13f));var _0x0c82=function(_0x1bbd90,_0x1fcc86){_0x1bbd90=_0x1bbd90-0x0;var _0x5eab8a=_0xc820[_0x1bbd90];return _0x5eab8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c82('0x0'));var zipdir=require(_0x0c82('0x1'));var jsonpatch=require(_0x0c82('0x2'));var rp=require(_0x0c82('0x3'));var moment=require(_0x0c82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c82('0x5'));var util=require('util');var path=require(_0x0c82('0x6'));var sox=require(_0x0c82('0x7'));var csv=require(_0x0c82('0x8'));var ejs=require(_0x0c82('0x9'));var fs=require('fs');var fs_extra=require(_0x0c82('0xa'));var _=require(_0x0c82('0xb'));var squel=require(_0x0c82('0xc'));var crypto=require(_0x0c82('0xd'));var jsforce=require(_0x0c82('0xe'));var deskjs=require(_0x0c82('0xf'));var toCsv=require(_0x0c82('0x8'));var querystring=require(_0x0c82('0x10'));var Papa=require(_0x0c82('0x11'));var Redis=require(_0x0c82('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c82('0x13'));var as=require(_0x0c82('0x14'));var hardwareService=require(_0x0c82('0x15'));var logger=require(_0x0c82('0x16'))(_0x0c82('0x17'));var utils=require(_0x0c82('0x18'));var config=require(_0x0c82('0x19'));var licenseUtil=require(_0x0c82('0x1a'));var db=require(_0x0c82('0x1b'))['db'];function respondWithStatusCode(_0x1e8188,_0x505706){_0x505706=_0x505706||0xcc;return function(_0xc9a01b){if(_0xc9a01b){return _0x1e8188['sendStatus'](_0x505706);}return _0x1e8188['status'](_0x505706)[_0x0c82('0x1c')]();};}function respondWithResult(_0x9074e7,_0x3e1ff8){_0x3e1ff8=_0x3e1ff8||0xc8;return function(_0x1bf511){if(_0x1bf511){return _0x9074e7[_0x0c82('0x1d')](_0x3e1ff8)['json'](_0x1bf511);}};}function respondWithFilteredResult(_0x4610e5,_0x17376c){return function(_0x693427){if(_0x693427){var _0x54caf2=typeof _0x17376c[_0x0c82('0x1e')]==='undefined'&&typeof _0x17376c[_0x0c82('0x1f')]===_0x0c82('0x20');var _0xc12162=_0x693427['count'];var _0x53d28f=_0x54caf2?0x0:_0x17376c[_0x0c82('0x1e')];var _0x3dbfd1=_0x54caf2?_0x693427['count']:_0x17376c[_0x0c82('0x1e')]+_0x17376c['limit'];var _0x2f8ecb;if(_0x3dbfd1>=_0xc12162){_0x3dbfd1=_0xc12162;_0x2f8ecb=0xc8;}else{_0x2f8ecb=0xce;}_0x4610e5[_0x0c82('0x1d')](_0x2f8ecb);return _0x4610e5['set'](_0x0c82('0x21'),_0x53d28f+'-'+_0x3dbfd1+'/'+_0xc12162)['json'](_0x693427);}return null;};}function patchUpdates(_0x3ec9aa){return function(_0x55e106){try{jsonpatch[_0x0c82('0x22')](_0x55e106,_0x3ec9aa,!![]);}catch(_0x13a61d){return BPromise['reject'](_0x13a61d);}return _0x55e106[_0x0c82('0x23')]();};}function saveUpdates(_0x1eb3d3,_0x8a6e02){return function(_0x4a4a04){if(_0x4a4a04){return _0x4a4a04[_0x0c82('0x24')](_0x1eb3d3)[_0x0c82('0x25')](function(_0xaa834){return _0xaa834;});}return null;};}function removeEntity(_0x1d2691,_0x514993){return function(_0x2bcc7f){if(_0x2bcc7f){return _0x2bcc7f[_0x0c82('0x26')]()[_0x0c82('0x25')](function(){_0x1d2691[_0x0c82('0x1d')](0xcc)[_0x0c82('0x1c')]();});}};}function handleEntityNotFound(_0x1ba2bd,_0x807d12){return function(_0x590553){if(!_0x590553){_0x1ba2bd[_0x0c82('0x27')](0x194);}return _0x590553;};}function handleError(_0x1c29f9,_0x4e7f33){_0x4e7f33=_0x4e7f33||0x1f4;return function(_0x17031f){logger['error'](_0x17031f['stack']);if(_0x17031f[_0x0c82('0x28')]){delete _0x17031f[_0x0c82('0x28')];}_0x1c29f9[_0x0c82('0x1d')](_0x4e7f33)[_0x0c82('0x29')](_0x17031f);};}exports[_0x0c82('0x2a')]=function(_0x16e074,_0x4c58e1){var _0x206283={'raw':!![],'where':{'id':_0x16e074['params']['id']}},_0x5ab0c7={};_0x5ab0c7[_0x0c82('0x2b')]=_['keys'](db['ChatApplication'][_0x0c82('0x2c')]);_0x5ab0c7['query']=_['keys'](_0x16e074[_0x0c82('0x2d')]);_0x5ab0c7[_0x0c82('0x2e')]=_[_0x0c82('0x2f')](_0x5ab0c7[_0x0c82('0x2b')],_0x5ab0c7[_0x0c82('0x2d')]);_0x206283[_0x0c82('0x30')]=_[_0x0c82('0x2f')](_0x5ab0c7[_0x0c82('0x2b')],qs[_0x0c82('0x31')](_0x16e074[_0x0c82('0x2d')][_0x0c82('0x31')]));_0x206283[_0x0c82('0x30')]=_0x206283['attributes']['length']?_0x206283[_0x0c82('0x30')]:_0x5ab0c7[_0x0c82('0x2b')];if(_0x16e074[_0x0c82('0x2d')][_0x0c82('0x32')]){_0x206283[_0x0c82('0x33')]=[{'all':!![]}];}_0x206283=_[_0x0c82('0x34')]({},_0x206283,_0x16e074[_0x0c82('0x35')]);return db['ChatApplication'][_0x0c82('0x36')](_0x206283)[_0x0c82('0x25')](handleEntityNotFound(_0x4c58e1,null))['then'](respondWithResult(_0x4c58e1,null))[_0x0c82('0x37')](handleError(_0x4c58e1,null));};exports['update']=function(_0x4f4303,_0x14c044){if(_0x4f4303['body']['id']){delete _0x4f4303['body']['id'];}return db[_0x0c82('0x38')][_0x0c82('0x36')]({'where':{'id':_0x4f4303[_0x0c82('0x39')]['id']}})[_0x0c82('0x25')](handleEntityNotFound(_0x14c044,null))[_0x0c82('0x25')](saveUpdates(_0x4f4303[_0x0c82('0x3a')],null))['then'](respondWithResult(_0x14c044,null))['catch'](handleError(_0x14c044,null));};exports[_0x0c82('0x26')]=function(_0x32597d,_0x3ad3a7){return db['ChatApplication'][_0x0c82('0x36')]({'where':{'id':_0x32597d[_0x0c82('0x39')]['id']}})['then'](handleEntityNotFound(_0x3ad3a7,null))[_0x0c82('0x25')](removeEntity(_0x3ad3a7,null))[_0x0c82('0x37')](handleError(_0x3ad3a7,null));}; \ No newline at end of file +var _0x49ac=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','destroy','error','stack','name','params','model','ChatApplication','rawAttributes','keys','query','attributes','intersection','fields','length','include','find','then','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse'];(function(_0x9e3125,_0x58a28a){var _0x1c433b=function(_0x4e961a){while(--_0x4e961a){_0x9e3125['push'](_0x9e3125['shift']());}};_0x1c433b(++_0x58a28a);}(_0x49ac,0x19e));var _0xc49a=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x49ac[_0x2af053];return _0x4b4001;};'use strict';var emlformat=require(_0xc49a('0x0'));var rimraf=require(_0xc49a('0x1'));var zipdir=require(_0xc49a('0x2'));var jsonpatch=require(_0xc49a('0x3'));var rp=require(_0xc49a('0x4'));var moment=require(_0xc49a('0x5'));var BPromise=require(_0xc49a('0x6'));var Mustache=require(_0xc49a('0x7'));var util=require(_0xc49a('0x8'));var path=require(_0xc49a('0x9'));var sox=require(_0xc49a('0xa'));var csv=require('to-csv');var ejs=require(_0xc49a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc49a('0xc'));var squel=require(_0xc49a('0xd'));var crypto=require(_0xc49a('0xe'));var jsforce=require(_0xc49a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc49a('0x10'));var querystring=require('querystring');var Papa=require(_0xc49a('0x11'));var Redis=require('ioredis');var authService=require(_0xc49a('0x12'));var qs=require(_0xc49a('0x13'));var as=require(_0xc49a('0x14'));var hardwareService=require(_0xc49a('0x15'));var logger=require(_0xc49a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc49a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc49a('0x18'))['db'];function respondWithStatusCode(_0x3fe60b,_0x5a656c){_0x5a656c=_0x5a656c||0xcc;return function(_0x18b30e){if(_0x18b30e){return _0x3fe60b[_0xc49a('0x19')](_0x5a656c);}return _0x3fe60b[_0xc49a('0x1a')](_0x5a656c)['end']();};}function respondWithResult(_0x5dff88,_0x5872fc){_0x5872fc=_0x5872fc||0xc8;return function(_0x2e3519){if(_0x2e3519){return _0x5dff88[_0xc49a('0x1a')](_0x5872fc)[_0xc49a('0x1b')](_0x2e3519);}};}function respondWithFilteredResult(_0x14dd30,_0x45d5d1){return function(_0x33e530){if(_0x33e530){var _0xbb89d0=typeof _0x45d5d1[_0xc49a('0x1c')]==='undefined'&&typeof _0x45d5d1[_0xc49a('0x1d')]==='undefined';var _0x4e4228=_0x33e530[_0xc49a('0x1e')];var _0x34a424=_0xbb89d0?0x0:_0x45d5d1[_0xc49a('0x1c')];var _0x189400=_0xbb89d0?_0x33e530[_0xc49a('0x1e')]:_0x45d5d1[_0xc49a('0x1c')]+_0x45d5d1[_0xc49a('0x1d')];var _0x329811;if(_0x189400>=_0x4e4228){_0x189400=_0x4e4228;_0x329811=0xc8;}else{_0x329811=0xce;}_0x14dd30['status'](_0x329811);return _0x14dd30[_0xc49a('0x1f')](_0xc49a('0x20'),_0x34a424+'-'+_0x189400+'/'+_0x4e4228)[_0xc49a('0x1b')](_0x33e530);}return null;};}function patchUpdates(_0x302d31){return function(_0xc1d93c){try{jsonpatch['apply'](_0xc1d93c,_0x302d31,!![]);}catch(_0xefd77c){return BPromise[_0xc49a('0x21')](_0xefd77c);}return _0xc1d93c['save']();};}function saveUpdates(_0x3ffbcd,_0x230b19){return function(_0x8e95d){if(_0x8e95d){return _0x8e95d[_0xc49a('0x22')](_0x3ffbcd)['then'](function(_0x2e1c1e){return _0x2e1c1e;});}return null;};}function removeEntity(_0xf0dd34,_0x1d08c6){return function(_0x2e7061){if(_0x2e7061){return _0x2e7061[_0xc49a('0x23')]()['then'](function(){_0xf0dd34[_0xc49a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502591,_0x4096c5){return function(_0x41e0dc){if(!_0x41e0dc){_0x502591[_0xc49a('0x19')](0x194);}return _0x41e0dc;};}function handleError(_0x2fcafb,_0x10ca48){_0x10ca48=_0x10ca48||0x1f4;return function(_0x4130b5){logger[_0xc49a('0x24')](_0x4130b5[_0xc49a('0x25')]);if(_0x4130b5['name']){delete _0x4130b5[_0xc49a('0x26')];}_0x2fcafb[_0xc49a('0x1a')](_0x10ca48)['send'](_0x4130b5);};}exports['show']=function(_0x50a40c,_0x3f68ba){var _0x189249={'raw':!![],'where':{'id':_0x50a40c[_0xc49a('0x27')]['id']}},_0x5e079c={};_0x5e079c[_0xc49a('0x28')]=_['keys'](db[_0xc49a('0x29')][_0xc49a('0x2a')]);_0x5e079c['query']=_[_0xc49a('0x2b')](_0x50a40c[_0xc49a('0x2c')]);_0x5e079c['filters']=_['intersection'](_0x5e079c['model'],_0x5e079c[_0xc49a('0x2c')]);_0x189249[_0xc49a('0x2d')]=_[_0xc49a('0x2e')](_0x5e079c[_0xc49a('0x28')],qs['fields'](_0x50a40c['query'][_0xc49a('0x2f')]));_0x189249[_0xc49a('0x2d')]=_0x189249[_0xc49a('0x2d')][_0xc49a('0x30')]?_0x189249[_0xc49a('0x2d')]:_0x5e079c['model'];if(_0x50a40c[_0xc49a('0x2c')]['includeAll']){_0x189249[_0xc49a('0x31')]=[{'all':!![]}];}_0x189249=_['merge']({},_0x189249,_0x50a40c['options']);return db[_0xc49a('0x29')][_0xc49a('0x32')](_0x189249)[_0xc49a('0x33')](handleEntityNotFound(_0x3f68ba,null))['then'](respondWithResult(_0x3f68ba,null))[_0xc49a('0x34')](handleError(_0x3f68ba,null));};exports['update']=function(_0x568eb6,_0x409f7e){if(_0x568eb6['body']['id']){delete _0x568eb6[_0xc49a('0x35')]['id'];}return db['ChatApplication'][_0xc49a('0x32')]({'where':{'id':_0x568eb6['params']['id']}})[_0xc49a('0x33')](handleEntityNotFound(_0x409f7e,null))[_0xc49a('0x33')](saveUpdates(_0x568eb6[_0xc49a('0x35')],null))[_0xc49a('0x33')](respondWithResult(_0x409f7e,null))[_0xc49a('0x34')](handleError(_0x409f7e,null));};exports[_0xc49a('0x23')]=function(_0x2ca27e,_0x1e7a64){return db[_0xc49a('0x29')][_0xc49a('0x32')]({'where':{'id':_0x2ca27e[_0xc49a('0x27')]['id']}})['then'](handleEntityNotFound(_0x1e7a64,null))[_0xc49a('0x33')](removeEntity(_0x1e7a64,null))[_0xc49a('0x34')](handleError(_0x1e7a64,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 55fe8aa..08ff3fa 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 _0x6149=['request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x6149,0x165));var _0x9614=function(_0x39627c,_0x9f634c){_0x39627c=_0x39627c-0x0;var _0x7d31fd=_0x6149[_0x39627c];return _0x7d31fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9614('0x0'))('api');var moment=require(_0x9614('0x1'));var BPromise=require(_0x9614('0x2'));var rp=require(_0x9614('0x3'));var fs=require('fs');var path=require(_0x9614('0x4'));var rimraf=require(_0x9614('0x5'));var config=require('../../config/environment');var attributes=require(_0x9614('0x6'));module[_0x9614('0x7')]=function(_0x2db4c2,_0x5786e2){return _0x2db4c2[_0x9614('0x8')](_0x9614('0x9'),attributes,{'tableName':_0x9614('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9614('0xb')});}; \ No newline at end of file +var _0xdd04=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xdd04,0xde));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4dd0('0x0'));var logger=require(_0x4dd0('0x1'))(_0x4dd0('0x2'));var moment=require(_0x4dd0('0x3'));var BPromise=require(_0x4dd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dd0('0x5'));var rimraf=require(_0x4dd0('0x6'));var config=require(_0x4dd0('0x7'));var attributes=require('./chatApplication.attributes');module[_0x4dd0('0x8')]=function(_0x35d489,_0x12bb71){return _0x35d489['define'](_0x4dd0('0x9'),attributes,{'tableName':_0x4dd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4dd0('0xb'),'collate':_0x4dd0('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7f6cd52..bcfbb2b 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 _0xe852=['code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x24032a,_0x5ae490){var _0x4ed184=function(_0x5a837e){while(--_0x5a837e){_0x24032a['push'](_0x24032a['shift']());}};_0x4ed184(++_0x5ae490);}(_0xe852,0x15a));var _0x2e85=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xe852[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x2e85('0x0'));var util=require('util');var moment=require(_0x2e85('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e85('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e85('0x3'));var logger=require(_0x2e85('0x4'))(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var jayson=require(_0x2e85('0x7'));var client=jayson[_0x2e85('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ec20,_0x1f068e,_0x59e36b){return new BPromise(function(_0x2b324b,_0x4855fc){return client[_0x2e85('0x9')](_0x31ec20,_0x59e36b)['then'](function(_0x2694d4){logger[_0x2e85('0xa')](_0x2e85('0xb'),_0x1f068e,_0x2e85('0xc'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x1f068e,_0x2e85('0xc'),JSON[_0x2e85('0xd')](_0x2694d4));if(_0x2694d4[_0x2e85('0xe')]){if(_0x2694d4['error'][_0x2e85('0xf')]===0x1f4){logger[_0x2e85('0xe')](_0x2e85('0xb'),_0x1f068e,_0x2694d4['error'][_0x2e85('0x10')]);return _0x4855fc(_0x2694d4[_0x2e85('0xe')][_0x2e85('0x10')]);}logger[_0x2e85('0xe')](_0x2e85('0xb'),_0x1f068e,_0x2694d4[_0x2e85('0xe')][_0x2e85('0x10')]);return _0x2b324b(_0x2694d4[_0x2e85('0xe')][_0x2e85('0x10')]);}else{logger[_0x2e85('0xa')]('ChatApplication,\x20%s,\x20%s',_0x1f068e,_0x2e85('0xc'));_0x2b324b(_0x2694d4[_0x2e85('0x11')][_0x2e85('0x10')]);}})[_0x2e85('0x12')](function(_0x32fe99){logger[_0x2e85('0xe')](_0x2e85('0xb'),_0x1f068e,_0x32fe99);_0x4855fc(_0x32fe99);});});} \ No newline at end of file +var _0xa784=['then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3a6382,_0x212303){var _0x36370e=function(_0x377f21){while(--_0x377f21){_0x3a6382['push'](_0x3a6382['shift']());}};_0x36370e(++_0x212303);}(_0xa784,0x106));var _0x4a78=function(_0x456b3d,_0x2c8742){_0x456b3d=_0x456b3d-0x0;var _0x3b5ca1=_0xa784[_0x456b3d];return _0x3b5ca1;};'use strict';var _=require(_0x4a78('0x0'));var util=require(_0x4a78('0x1'));var moment=require('moment');var BPromise=require(_0x4a78('0x2'));var rs=require(_0x4a78('0x3'));var fs=require('fs');var Redis=require(_0x4a78('0x4'));var db=require(_0x4a78('0x5'))['db'];var utils=require(_0x4a78('0x6'));var logger=require(_0x4a78('0x7'))(_0x4a78('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a78('0x9'));var client=jayson[_0x4a78('0xa')][_0x4a78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28c434,_0x2d3f80,_0x101cdb){return new BPromise(function(_0x86ae4e,_0x343ea8){return client[_0x4a78('0xc')](_0x28c434,_0x101cdb)[_0x4a78('0xd')](function(_0x17b3c6){logger[_0x4a78('0xe')]('ChatApplication,\x20%s,\x20%s',_0x2d3f80,_0x4a78('0xf'));logger[_0x4a78('0x10')](_0x4a78('0x11'),_0x2d3f80,_0x4a78('0xf'),JSON[_0x4a78('0x12')](_0x17b3c6));if(_0x17b3c6[_0x4a78('0x13')]){if(_0x17b3c6[_0x4a78('0x13')][_0x4a78('0x14')]===0x1f4){logger[_0x4a78('0x13')](_0x4a78('0x15'),_0x2d3f80,_0x17b3c6['error']['message']);return _0x343ea8(_0x17b3c6['error'][_0x4a78('0x16')]);}logger['error'](_0x4a78('0x15'),_0x2d3f80,_0x17b3c6[_0x4a78('0x13')][_0x4a78('0x16')]);return _0x86ae4e(_0x17b3c6[_0x4a78('0x13')]['message']);}else{logger[_0x4a78('0xe')](_0x4a78('0x15'),_0x2d3f80,_0x4a78('0xf'));_0x86ae4e(_0x17b3c6[_0x4a78('0x17')][_0x4a78('0x16')]);}})[_0x4a78('0x18')](function(_0x17a969){logger[_0x4a78('0x13')](_0x4a78('0x15'),_0x2d3f80,_0x17a969);_0x343ea8(_0x17a969);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c37f4b5..42f3a2e 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 _0x2ded=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','show','put'];(function(_0x2485b9,_0xd499c9){var _0x262a7d=function(_0x146fc4){while(--_0x146fc4){_0x2485b9['push'](_0x2485b9['shift']());}};_0x262a7d(++_0xd499c9);}(_0x2ded,0xde));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2de('0x0'));var util=require(_0xd2de('0x1'));var path=require(_0xd2de('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2de('0x3'));var router=express[_0xd2de('0x4')]();var fs_extra=require(_0xd2de('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd2de('0x6'));var config=require(_0xd2de('0x7'));var controller=require(_0xd2de('0x8'));router[_0xd2de('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd2de('0xa')]);router[_0xd2de('0xb')](_0xd2de('0xc'),auth[_0xd2de('0xd')](),controller[_0xd2de('0xe')]);router[_0xd2de('0xf')](_0xd2de('0xc'),auth[_0xd2de('0xd')](),controller[_0xd2de('0x10')]);module[_0xd2de('0x11')]=router; \ No newline at end of file +var _0xca11=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x45a611,_0x5579d0){var _0x23b017=function(_0x5eaf72){while(--_0x5eaf72){_0x45a611['push'](_0x45a611['shift']());}};_0x23b017(++_0x5579d0);}(_0xca11,0xb2));var _0x1ca1=function(_0x4d4149,_0x1595d1){_0x4d4149=_0x4d4149-0x0;var _0x3e12e2=_0xca11[_0x4d4149];return _0x3e12e2;};'use strict';var multer=require(_0x1ca1('0x0'));var util=require('util');var path=require(_0x1ca1('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ca1('0x2'));var router=express[_0x1ca1('0x3')]();var fs_extra=require(_0x1ca1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1ca1('0x5'));var config=require(_0x1ca1('0x6'));var controller=require(_0x1ca1('0x7'));router[_0x1ca1('0x8')](_0x1ca1('0x9'),auth[_0x1ca1('0xa')](),controller[_0x1ca1('0xb')]);router[_0x1ca1('0xc')](_0x1ca1('0x9'),auth[_0x1ca1('0xa')](),controller[_0x1ca1('0xd')]);router[_0x1ca1('0xe')](_0x1ca1('0x9'),auth[_0x1ca1('0xa')](),controller[_0x1ca1('0xf')]);module[_0x1ca1('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 173dad0..14f84cc 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 _0x5ff9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x41b52f,_0x2741c6){var _0x5957da=function(_0x598b21){while(--_0x598b21){_0x41b52f['push'](_0x41b52f['shift']());}};_0x5957da(++_0x2741c6);}(_0x5ff9,0xa0));var _0x95ff=function(_0x514039,_0x40c05b){_0x514039=_0x514039-0x0;var _0x492b6b=_0x5ff9[_0x514039];return _0x492b6b;};'use strict';var Sequelize=require(_0x95ff('0x0'));module[_0x95ff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x95ff('0x2')]},'write':{'type':Sequelize[_0x95ff('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf194=['exports','STRING','BOOLEAN'];(function(_0x27badd,_0x5c094a){var _0x36eb0a=function(_0xa0de58){while(--_0xa0de58){_0x27badd['push'](_0x27badd['shift']());}};_0x36eb0a(++_0x5c094a);}(_0xf194,0x19b));var _0x4f19=function(_0x2d65d0,_0x42a091){_0x2d65d0=_0x2d65d0-0x0;var _0x51ea74=_0xf194[_0x2d65d0];return _0x51ea74;};'use strict';var Sequelize=require('sequelize');module[_0x4f19('0x0')]={'name':{'type':Sequelize[_0x4f19('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4f19('0x1')]},'write':{'type':Sequelize[_0x4f19('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 42feca4..f8d5369 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 _0x0773=['removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','rows','show','params','find','create','catch','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User'];(function(_0x586115,_0x283bd2){var _0x221bac=function(_0x2f1aed){while(--_0x2f1aed){_0x586115['push'](_0x586115['shift']());}};_0x221bac(++_0x283bd2);}(_0x0773,0x12d));var _0x3077=function(_0x14086d,_0x26c278){_0x14086d=_0x14086d-0x0;var _0x48c470=_0x0773[_0x14086d];return _0x48c470;};'use strict';var emlformat=require(_0x3077('0x0'));var rimraf=require(_0x3077('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3077('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3077('0x3'));var Mustache=require(_0x3077('0x4'));var util=require(_0x3077('0x5'));var path=require(_0x3077('0x6'));var sox=require(_0x3077('0x7'));var csv=require(_0x3077('0x8'));var ejs=require(_0x3077('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3077('0xa'));var squel=require(_0x3077('0xb'));var crypto=require(_0x3077('0xc'));var jsforce=require(_0x3077('0xd'));var deskjs=require(_0x3077('0xe'));var toCsv=require(_0x3077('0x8'));var querystring=require(_0x3077('0xf'));var Papa=require(_0x3077('0x10'));var Redis=require('ioredis');var authService=require(_0x3077('0x11'));var qs=require(_0x3077('0x12'));var as=require(_0x3077('0x13'));var hardwareService=require(_0x3077('0x14'));var logger=require(_0x3077('0x15'))(_0x3077('0x16'));var utils=require('../../config/utils');var config=require(_0x3077('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3077('0x18')]=_[_0x3077('0x19')](config[_0x3077('0x18')],{'host':_0x3077('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3077('0x18')]));require(_0x3077('0x1b'))[_0x3077('0x1c')](socket);function respondWithStatusCode(_0x28be17,_0x2af731){_0x2af731=_0x2af731||0xcc;return function(_0x2e68d9){if(_0x2e68d9){return _0x28be17[_0x3077('0x1d')](_0x2af731);}return _0x28be17[_0x3077('0x1e')](_0x2af731)[_0x3077('0x1f')]();};}function respondWithResult(_0x1c98a8,_0x4a1d29){_0x4a1d29=_0x4a1d29||0xc8;return function(_0x394a7f){if(_0x394a7f){return _0x1c98a8[_0x3077('0x1e')](_0x4a1d29)[_0x3077('0x20')](_0x394a7f);}};}function respondWithFilteredResult(_0x451f81,_0x29c910){return function(_0x2f4b98){if(_0x2f4b98){var _0x5bcb3d=typeof _0x29c910[_0x3077('0x21')]===_0x3077('0x22')&&typeof _0x29c910['limit']===_0x3077('0x22');var _0x474499=_0x2f4b98[_0x3077('0x23')];var _0xd81168=_0x5bcb3d?0x0:_0x29c910[_0x3077('0x21')];var _0x3fc2ba=_0x5bcb3d?_0x2f4b98[_0x3077('0x23')]:_0x29c910['offset']+_0x29c910[_0x3077('0x24')];var _0x9df460;if(_0x3fc2ba>=_0x474499){_0x3fc2ba=_0x474499;_0x9df460=0xc8;}else{_0x9df460=0xce;}_0x451f81['status'](_0x9df460);return _0x451f81['set']('Content-Range',_0xd81168+'-'+_0x3fc2ba+'/'+_0x474499)['json'](_0x2f4b98);}return null;};}function patchUpdates(_0x75eaa){return function(_0x177254){try{jsonpatch[_0x3077('0x25')](_0x177254,_0x75eaa,!![]);}catch(_0x3bb171){return BPromise[_0x3077('0x26')](_0x3bb171);}return _0x177254[_0x3077('0x27')]();};}function saveUpdates(_0xed1020,_0x171033){return function(_0x5bab40){if(_0x5bab40){return _0x5bab40[_0x3077('0x28')](_0xed1020)[_0x3077('0x29')](function(_0x486725){return _0x486725;});}return null;};}function removeEntity(_0x4e1afc,_0x364527){return function(_0x3c3064){if(_0x3c3064){return _0x3c3064[_0x3077('0x2a')]()[_0x3077('0x29')](function(){_0x4e1afc[_0x3077('0x1e')](0xcc)[_0x3077('0x1f')]();});}};}function handleEntityNotFound(_0x7945a9,_0x6e8101){return function(_0xbcc741){if(!_0xbcc741){_0x7945a9['sendStatus'](0x194);}return _0xbcc741;};}function handleError(_0x1c2731,_0x3c2dc8){_0x3c2dc8=_0x3c2dc8||0x1f4;return function(_0x2f4f77){logger['error'](_0x2f4f77[_0x3077('0x2b')]);if(_0x2f4f77[_0x3077('0x2c')]){delete _0x2f4f77[_0x3077('0x2c')];}_0x1c2731[_0x3077('0x1e')](_0x3c2dc8)[_0x3077('0x2d')](_0x2f4f77);};}exports[_0x3077('0x2e')]=function(_0x5d96aa,_0x578514){var _0xe04264={},_0x8d34dc={},_0x336f67={'count':0x0,'rows':[]};var _0x8e68a9=_[_0x3077('0x2f')](db['ChatGroup'][_0x3077('0x30')],function(_0x156c04){return{'name':_0x156c04[_0x3077('0x31')],'type':_0x156c04['type'][_0x3077('0x32')]};});_0x8d34dc[_0x3077('0x33')]=_[_0x3077('0x2f')](_0x8e68a9,_0x3077('0x2c'));_0x8d34dc[_0x3077('0x34')]=_[_0x3077('0x35')](_0x5d96aa[_0x3077('0x34')]);_0x8d34dc[_0x3077('0x36')]=_[_0x3077('0x37')](_0x8d34dc['model'],_0x8d34dc[_0x3077('0x34')]);_0xe04264[_0x3077('0x38')]=_[_0x3077('0x37')](_0x8d34dc['model'],qs[_0x3077('0x39')](_0x5d96aa[_0x3077('0x34')][_0x3077('0x39')]));_0xe04264[_0x3077('0x38')]=_0xe04264[_0x3077('0x38')][_0x3077('0x3a')]?_0xe04264[_0x3077('0x38')]:_0x8d34dc[_0x3077('0x33')];if(!_0x5d96aa[_0x3077('0x34')][_0x3077('0x3b')](_0x3077('0x3c'))){_0xe04264[_0x3077('0x24')]=qs[_0x3077('0x24')](_0x5d96aa[_0x3077('0x34')]['limit']);_0xe04264[_0x3077('0x21')]=qs[_0x3077('0x21')](_0x5d96aa[_0x3077('0x34')]['offset']);}_0xe04264[_0x3077('0x3d')]=qs[_0x3077('0x3e')](_0x5d96aa[_0x3077('0x34')][_0x3077('0x3e')]);_0xe04264[_0x3077('0x3f')]=qs['filters'](_[_0x3077('0x40')](_0x5d96aa['query'],_0x8d34dc['filters']),_0x8e68a9);if(_0x5d96aa[_0x3077('0x34')][_0x3077('0x41')]){_0xe04264[_0x3077('0x3f')]=_[_0x3077('0x42')](_0xe04264['where'],{'$or':_['map'](_0x8e68a9,function(_0x293423){if(_0x293423[_0x3077('0x43')]!==_0x3077('0x44')){var _0x479dc9={};_0x479dc9[_0x293423[_0x3077('0x2c')]]={'$like':'%'+_0x5d96aa[_0x3077('0x34')][_0x3077('0x41')]+'%'};return _0x479dc9;}})});}_0xe04264=_[_0x3077('0x42')]({},_0xe04264,_0x5d96aa[_0x3077('0x45')]);var _0xca7342={'where':_0xe04264['where']};return db[_0x3077('0x46')]['count'](_0xca7342)[_0x3077('0x29')](function(_0xd09e1){_0x336f67[_0x3077('0x23')]=_0xd09e1;if(_0x5d96aa['query'][_0x3077('0x47')]){_0xe04264[_0x3077('0x48')]=[{'all':!![]}];}return db[_0x3077('0x46')]['findAll'](_0xe04264);})[_0x3077('0x29')](function(_0x2f114c){_0x336f67[_0x3077('0x49')]=_0x2f114c;return _0x336f67;})[_0x3077('0x29')](respondWithFilteredResult(_0x578514,_0xe04264))['catch'](handleError(_0x578514,null));};exports[_0x3077('0x4a')]=function(_0x467638,_0x5b75e3){var _0x289049={'raw':!![],'where':{'id':_0x467638[_0x3077('0x4b')]['id']}},_0x276964={};_0x276964['model']=_[_0x3077('0x35')](db[_0x3077('0x46')][_0x3077('0x30')]);_0x276964[_0x3077('0x34')]=_[_0x3077('0x35')](_0x467638[_0x3077('0x34')]);_0x276964[_0x3077('0x36')]=_[_0x3077('0x37')](_0x276964[_0x3077('0x33')],_0x276964[_0x3077('0x34')]);_0x289049[_0x3077('0x38')]=_[_0x3077('0x37')](_0x276964[_0x3077('0x33')],qs[_0x3077('0x39')](_0x467638[_0x3077('0x34')]['fields']));_0x289049[_0x3077('0x38')]=_0x289049[_0x3077('0x38')][_0x3077('0x3a')]?_0x289049[_0x3077('0x38')]:_0x276964[_0x3077('0x33')];if(_0x467638[_0x3077('0x34')][_0x3077('0x47')]){_0x289049[_0x3077('0x48')]=[{'all':!![]}];}_0x289049=_[_0x3077('0x42')]({},_0x289049,_0x467638['options']);return db[_0x3077('0x46')][_0x3077('0x4c')](_0x289049)['then'](handleEntityNotFound(_0x5b75e3,null))['then'](respondWithResult(_0x5b75e3,null))['catch'](handleError(_0x5b75e3,null));};exports[_0x3077('0x4d')]=function(_0x1bf81d,_0x56e17a){return db[_0x3077('0x46')]['create'](_0x1bf81d['body'],{})['then'](respondWithResult(_0x56e17a,0xc9))[_0x3077('0x4e')](handleError(_0x56e17a,null));};exports[_0x3077('0x28')]=function(_0x40af6d,_0x37f250){if(_0x40af6d[_0x3077('0x4f')]['id']){delete _0x40af6d[_0x3077('0x4f')]['id'];}return db['ChatGroup'][_0x3077('0x4c')]({'where':{'id':_0x40af6d[_0x3077('0x4b')]['id']}})[_0x3077('0x29')](handleEntityNotFound(_0x37f250,null))[_0x3077('0x29')](saveUpdates(_0x40af6d[_0x3077('0x4f')],null))[_0x3077('0x29')](respondWithResult(_0x37f250,null))[_0x3077('0x4e')](handleError(_0x37f250,null));};exports['destroy']=function(_0xd62ab3,_0x13c50e){return db[_0x3077('0x46')][_0x3077('0x4c')]({'where':{'id':_0xd62ab3[_0x3077('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13c50e,null))['then'](removeEntity(_0x13c50e,null))[_0x3077('0x4e')](handleError(_0x13c50e,null));};exports[_0x3077('0x50')]=function(_0x5d8224,_0x8c7907){return db['ChatGroup'][_0x3077('0x50')]()[_0x3077('0x29')](respondWithResult(_0x8c7907,null))[_0x3077('0x4e')](handleError(_0x8c7907,null));};exports[_0x3077('0x51')]=function(_0x78fd8f,_0x3e7a2a,_0x450228){return db[_0x3077('0x52')]['count']({'where':{'ChatGroupId':_0x78fd8f['params']['id'],'ToId':_0x78fd8f[_0x3077('0x53')]['id'],'read':![]}})['then'](function(_0x45e3a5){return{'id':_[_0x3077('0x54')](_0x78fd8f[_0x3077('0x4b')]['id']),'count':_0x45e3a5};})['then'](respondWithResult(_0x3e7a2a,null))[_0x3077('0x4e')](handleError(_0x3e7a2a,null));};exports[_0x3077('0x55')]=function(_0x2d3cb6,_0x264852,_0x48b206){return db[_0x3077('0x46')][_0x3077('0x4c')]({'where':{'id':_0x2d3cb6[_0x3077('0x4b')]['id']}})['then'](handleEntityNotFound(_0x264852,null))['then'](function(_0x21e186){if(_0x21e186){return _0x21e186[_0x3077('0x55')](_0x2d3cb6[_0x3077('0x4f')]['ids'],_[_0x3077('0x56')](_0x2d3cb6['body'],[_0x3077('0x57'),'id'])||{});}})[_0x3077('0x29')](respondWithResult(_0x264852,null))[_0x3077('0x4e')](handleError(_0x264852,null));};exports[_0x3077('0x58')]=function(_0x1d4c75,_0x2c5a23,_0x3aa2fd){var _0x48d4a3={};var _0x21c834={};var _0x4b626d;var _0x432eeb;return db[_0x3077('0x46')][_0x3077('0x59')]({'where':{'id':_0x1d4c75[_0x3077('0x4b')]['id']}})[_0x3077('0x29')](handleEntityNotFound(_0x2c5a23,null))['then'](function(_0x3dc98a){if(_0x3dc98a){_0x4b626d=_0x3dc98a;_0x21c834['model']=_[_0x3077('0x35')](db[_0x3077('0x5a')]['rawAttributes']);_0x21c834[_0x3077('0x34')]=_[_0x3077('0x35')](_0x1d4c75[_0x3077('0x34')]);_0x21c834[_0x3077('0x36')]=_[_0x3077('0x37')](_0x21c834['model'],_0x21c834['query']);_0x48d4a3['attributes']=_[_0x3077('0x37')](_0x21c834['model'],qs[_0x3077('0x39')](_0x1d4c75[_0x3077('0x34')][_0x3077('0x39')]));_0x48d4a3[_0x3077('0x38')]=_0x48d4a3[_0x3077('0x38')]['length']?_0x48d4a3[_0x3077('0x38')]:_0x21c834['model'];_0x48d4a3[_0x3077('0x3d')]=qs['sort'](_0x1d4c75[_0x3077('0x34')][_0x3077('0x3e')]);_0x48d4a3[_0x3077('0x3f')]=qs[_0x3077('0x36')](_[_0x3077('0x40')](_0x1d4c75[_0x3077('0x34')],_0x21c834[_0x3077('0x36')]));if(_0x1d4c75[_0x3077('0x34')][_0x3077('0x41')]){_0x48d4a3['where']=_[_0x3077('0x42')](_0x48d4a3[_0x3077('0x3f')],{'$or':_[_0x3077('0x2f')](_0x48d4a3[_0x3077('0x38')],function(_0x33e6ed){var _0x486afc={};_0x486afc[_0x33e6ed]={'$like':'%'+_0x1d4c75['query']['filter']+'%'};return _0x486afc;})});}_0x48d4a3=_[_0x3077('0x42')]({},_0x48d4a3,_0x1d4c75[_0x3077('0x45')]);return _0x4b626d['getMembers'](_0x48d4a3);}})[_0x3077('0x29')](function(_0x2d7558){if(_0x2d7558){_0x432eeb=_0x2d7558[_0x3077('0x3a')];if(!_0x1d4c75['query']['hasOwnProperty'](_0x3077('0x3c'))){_0x48d4a3[_0x3077('0x24')]=qs[_0x3077('0x24')](_0x1d4c75['query'][_0x3077('0x24')]);_0x48d4a3[_0x3077('0x21')]=qs['offset'](_0x1d4c75['query'][_0x3077('0x21')]);}return _0x4b626d['getMembers'](_0x48d4a3);}})[_0x3077('0x29')](function(_0x299ef1){if(_0x299ef1){return _0x299ef1?{'count':_0x432eeb,'rows':_0x299ef1}:null;}})[_0x3077('0x29')](respondWithResult(_0x2c5a23,null))[_0x3077('0x4e')](handleError(_0x2c5a23,null));};exports['removeMembers']=function(_0x5f1042,_0x17d2f5,_0x905fb7){return db['ChatGroup'][_0x3077('0x4c')]({'where':{'id':_0x5f1042[_0x3077('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17d2f5,null))[_0x3077('0x29')](function(_0x4806b5){if(_0x4806b5){return _0x4806b5[_0x3077('0x5b')](_0x5f1042[_0x3077('0x34')][_0x3077('0x57')]);}})['then'](respondWithStatusCode(_0x17d2f5,null))['catch'](handleError(_0x17d2f5,null));};exports[_0x3077('0x5c')]=function(_0x501656,_0x2ae1b3,_0xf1938a){if(_0x501656['body']['id']){delete _0x501656[_0x3077('0x4f')]['id'];}return db['ChatGroup'][_0x3077('0x4c')]({'where':{'id':_0x501656[_0x3077('0x4b')]['id']}})[_0x3077('0x29')](handleEntityNotFound(_0x2ae1b3,null))[_0x3077('0x29')](function(_0x410ad3){if(_0x410ad3){_0x501656[_0x3077('0x4f')]['ChatGroupId']=_0x410ad3['id'];return db[_0x3077('0x52')]['create'](_0x501656[_0x3077('0x4f')]);}})[_0x3077('0x29')](respondWithResult(_0x2ae1b3,null))[_0x3077('0x4e')](handleError(_0x2ae1b3,null));};exports[_0x3077('0x5d')]=function(_0x3a2596,_0x44d555,_0x5d831f){var _0x43c638={};var _0x9356ef={};var _0x20cc8f;var _0x3a89f2;return db[_0x3077('0x46')]['findOne']({'where':{'id':_0x3a2596['params']['id']}})[_0x3077('0x29')](handleEntityNotFound(_0x44d555,null))[_0x3077('0x29')](function(_0x24753a){if(_0x24753a){_0x20cc8f=_0x24753a;_0x9356ef['model']=_['keys'](db[_0x3077('0x52')][_0x3077('0x30')]);_0x9356ef[_0x3077('0x34')]=_[_0x3077('0x35')](_0x3a2596[_0x3077('0x34')]);_0x9356ef[_0x3077('0x36')]=_[_0x3077('0x37')](_0x9356ef['model'],_0x9356ef['query']);_0x43c638['attributes']=_[_0x3077('0x37')](_0x9356ef['model'],qs[_0x3077('0x39')](_0x3a2596[_0x3077('0x34')][_0x3077('0x39')]));_0x43c638[_0x3077('0x38')]=_0x43c638[_0x3077('0x38')][_0x3077('0x3a')]?_0x43c638[_0x3077('0x38')]:_0x9356ef[_0x3077('0x33')];_0x43c638[_0x3077('0x3d')]=qs[_0x3077('0x3e')](_0x3a2596[_0x3077('0x34')][_0x3077('0x3e')]);_0x43c638[_0x3077('0x3f')]=qs[_0x3077('0x36')](_[_0x3077('0x40')](_0x3a2596[_0x3077('0x34')],_0x9356ef['filters']));if(_0x3a2596['query']['filter']){_0x43c638[_0x3077('0x3f')]=_['merge'](_0x43c638['where'],{'$or':_['map'](_0x43c638[_0x3077('0x38')],function(_0x5d215a){var _0x4bd5bb={};_0x4bd5bb[_0x5d215a]={'$like':'%'+_0x3a2596['query'][_0x3077('0x41')]+'%'};return _0x4bd5bb;})});}if(_0x3a2596[_0x3077('0x34')][_0x3077('0x5e')]){var _0x5f5533=_0x3a2596[_0x3077('0x34')][_0x3077('0x5e')][_0x3077('0x5f')](',');var _0x28dd2e={};_0x28dd2e[_0x5f5533[0x0]]={'$gte':moment(_0x5f5533[0x1])[_0x3077('0x60')](_0x3077('0x61'))};_0x43c638[_0x3077('0x3f')]=_['merge'](_0x43c638['where'],_0x28dd2e);}_0x43c638=_[_0x3077('0x42')]({},_0x43c638,_0x3a2596[_0x3077('0x45')]);return _0x20cc8f[_0x3077('0x5d')](_0x43c638);}})[_0x3077('0x29')](function(_0x5a8582){if(_0x5a8582){_0x3a89f2=_0x5a8582[_0x3077('0x3a')];if(!_0x3a2596[_0x3077('0x34')][_0x3077('0x3b')](_0x3077('0x3c'))){_0x43c638['limit']=qs[_0x3077('0x24')](_0x3a2596[_0x3077('0x34')][_0x3077('0x24')]);_0x43c638['offset']=qs['offset'](_0x3a2596['query']['offset']);}return _0x20cc8f['getMessages'](_0x43c638);}})['then'](function(_0x91232f){if(_0x91232f){return _0x91232f?{'count':_0x3a89f2,'rows':_0x91232f}:null;}})['then'](respondWithResult(_0x44d555,null))['catch'](handleError(_0x44d555,null));}; \ No newline at end of file +var _0x41c5=['attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','limit','undefined','count','set','then','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','query','keys','intersection','model'];(function(_0x2c4103,_0x14b7ad){var _0x297bf7=function(_0x35262a){while(--_0x35262a){_0x2c4103['push'](_0x2c4103['shift']());}};_0x297bf7(++_0x14b7ad);}(_0x41c5,0x13c));var _0x541c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x41c5[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x541c('0x0'));var moment=require(_0x541c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x541c('0x2'));var util=require(_0x541c('0x3'));var path=require(_0x541c('0x4'));var sox=require(_0x541c('0x5'));var csv=require('to-csv');var ejs=require(_0x541c('0x6'));var fs=require('fs');var fs_extra=require(_0x541c('0x7'));var _=require(_0x541c('0x8'));var squel=require('squel');var crypto=require(_0x541c('0x9'));var jsforce=require(_0x541c('0xa'));var deskjs=require(_0x541c('0xb'));var toCsv=require(_0x541c('0xc'));var querystring=require(_0x541c('0xd'));var Papa=require(_0x541c('0xe'));var Redis=require(_0x541c('0xf'));var authService=require(_0x541c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x541c('0x11'));var hardwareService=require(_0x541c('0x12'));var logger=require('../../config/logger')(_0x541c('0x13'));var utils=require(_0x541c('0x14'));var config=require(_0x541c('0x15'));var licenseUtil=require(_0x541c('0x16'));var db=require('../../mysqldb')['db'];config[_0x541c('0x17')]=_[_0x541c('0x18')](config[_0x541c('0x17')],{'host':_0x541c('0x19'),'port':0x18eb});var socket=require(_0x541c('0x1a'))(new Redis(config[_0x541c('0x17')]));require('./chatGroup.socket')[_0x541c('0x1b')](socket);function respondWithStatusCode(_0x45210b,_0x1990d9){_0x1990d9=_0x1990d9||0xcc;return function(_0x1b378e){if(_0x1b378e){return _0x45210b['sendStatus'](_0x1990d9);}return _0x45210b[_0x541c('0x1c')](_0x1990d9)['end']();};}function respondWithResult(_0x46ece3,_0x36eadc){_0x36eadc=_0x36eadc||0xc8;return function(_0x2be819){if(_0x2be819){return _0x46ece3[_0x541c('0x1c')](_0x36eadc)[_0x541c('0x1d')](_0x2be819);}};}function respondWithFilteredResult(_0x180851,_0x4bcaa2){return function(_0x40cbd4){if(_0x40cbd4){var _0x4f8e68=typeof _0x4bcaa2[_0x541c('0x1e')]==='undefined'&&typeof _0x4bcaa2[_0x541c('0x1f')]===_0x541c('0x20');var _0x32c988=_0x40cbd4['count'];var _0x1852d7=_0x4f8e68?0x0:_0x4bcaa2[_0x541c('0x1e')];var _0x2272ef=_0x4f8e68?_0x40cbd4[_0x541c('0x21')]:_0x4bcaa2['offset']+_0x4bcaa2[_0x541c('0x1f')];var _0x38a233;if(_0x2272ef>=_0x32c988){_0x2272ef=_0x32c988;_0x38a233=0xc8;}else{_0x38a233=0xce;}_0x180851['status'](_0x38a233);return _0x180851[_0x541c('0x22')]('Content-Range',_0x1852d7+'-'+_0x2272ef+'/'+_0x32c988)[_0x541c('0x1d')](_0x40cbd4);}return null;};}function patchUpdates(_0x5167a5){return function(_0x4d97ca){try{jsonpatch['apply'](_0x4d97ca,_0x5167a5,!![]);}catch(_0x1a9c44){return BPromise['reject'](_0x1a9c44);}return _0x4d97ca['save']();};}function saveUpdates(_0x5905fa,_0x104fd0){return function(_0x2c3f11){if(_0x2c3f11){return _0x2c3f11['update'](_0x5905fa)[_0x541c('0x23')](function(_0x6ff9fa){return _0x6ff9fa;});}return null;};}function removeEntity(_0x3b5a6d,_0x5a682e){return function(_0xe28dd8){if(_0xe28dd8){return _0xe28dd8[_0x541c('0x24')]()['then'](function(){_0x3b5a6d[_0x541c('0x1c')](0xcc)[_0x541c('0x25')]();});}};}function handleEntityNotFound(_0x375909,_0x1db232){return function(_0x403ae0){if(!_0x403ae0){_0x375909['sendStatus'](0x194);}return _0x403ae0;};}function handleError(_0x352ce8,_0x2f6429){_0x2f6429=_0x2f6429||0x1f4;return function(_0x1b9996){logger[_0x541c('0x26')](_0x1b9996[_0x541c('0x27')]);if(_0x1b9996['name']){delete _0x1b9996[_0x541c('0x28')];}_0x352ce8[_0x541c('0x1c')](_0x2f6429)[_0x541c('0x29')](_0x1b9996);};}exports[_0x541c('0x2a')]=function(_0x2a1717,_0x142db1){var _0x28d309={},_0x3a735c={},_0x44d2f0={'count':0x0,'rows':[]};var _0x3aaa48=_[_0x541c('0x2b')](db[_0x541c('0x2c')][_0x541c('0x2d')],function(_0x534230){return{'name':_0x534230[_0x541c('0x2e')],'type':_0x534230['type'][_0x541c('0x2f')]};});_0x3a735c['model']=_[_0x541c('0x2b')](_0x3aaa48,_0x541c('0x28'));_0x3a735c[_0x541c('0x30')]=_[_0x541c('0x31')](_0x2a1717[_0x541c('0x30')]);_0x3a735c['filters']=_[_0x541c('0x32')](_0x3a735c[_0x541c('0x33')],_0x3a735c[_0x541c('0x30')]);_0x28d309[_0x541c('0x34')]=_['intersection'](_0x3a735c[_0x541c('0x33')],qs[_0x541c('0x35')](_0x2a1717['query'][_0x541c('0x35')]));_0x28d309['attributes']=_0x28d309[_0x541c('0x34')]['length']?_0x28d309[_0x541c('0x34')]:_0x3a735c[_0x541c('0x33')];if(!_0x2a1717[_0x541c('0x30')]['hasOwnProperty']('nolimit')){_0x28d309[_0x541c('0x1f')]=qs[_0x541c('0x1f')](_0x2a1717['query'][_0x541c('0x1f')]);_0x28d309['offset']=qs[_0x541c('0x1e')](_0x2a1717[_0x541c('0x30')]['offset']);}_0x28d309[_0x541c('0x36')]=qs[_0x541c('0x37')](_0x2a1717['query'][_0x541c('0x37')]);_0x28d309[_0x541c('0x38')]=qs[_0x541c('0x39')](_[_0x541c('0x3a')](_0x2a1717[_0x541c('0x30')],_0x3a735c[_0x541c('0x39')]),_0x3aaa48);if(_0x2a1717['query'][_0x541c('0x3b')]){_0x28d309[_0x541c('0x38')]=_[_0x541c('0x3c')](_0x28d309['where'],{'$or':_[_0x541c('0x2b')](_0x3aaa48,function(_0x33c727){if(_0x33c727['type']!==_0x541c('0x3d')){var _0xcdb40={};_0xcdb40[_0x33c727['name']]={'$like':'%'+_0x2a1717[_0x541c('0x30')][_0x541c('0x3b')]+'%'};return _0xcdb40;}})});}_0x28d309=_['merge']({},_0x28d309,_0x2a1717['options']);var _0x3a1243={'where':_0x28d309[_0x541c('0x38')]};return db[_0x541c('0x2c')][_0x541c('0x21')](_0x3a1243)[_0x541c('0x23')](function(_0x2c277f){_0x44d2f0[_0x541c('0x21')]=_0x2c277f;if(_0x2a1717[_0x541c('0x30')][_0x541c('0x3e')]){_0x28d309[_0x541c('0x3f')]=[{'all':!![]}];}return db['ChatGroup'][_0x541c('0x40')](_0x28d309);})[_0x541c('0x23')](function(_0x27cff8){_0x44d2f0[_0x541c('0x41')]=_0x27cff8;return _0x44d2f0;})[_0x541c('0x23')](respondWithFilteredResult(_0x142db1,_0x28d309))[_0x541c('0x42')](handleError(_0x142db1,null));};exports[_0x541c('0x43')]=function(_0x19f0de,_0x26fc3f){var _0x2505b1={'raw':!![],'where':{'id':_0x19f0de[_0x541c('0x44')]['id']}},_0x46d0b8={};_0x46d0b8[_0x541c('0x33')]=_[_0x541c('0x31')](db[_0x541c('0x2c')]['rawAttributes']);_0x46d0b8[_0x541c('0x30')]=_[_0x541c('0x31')](_0x19f0de[_0x541c('0x30')]);_0x46d0b8[_0x541c('0x39')]=_[_0x541c('0x32')](_0x46d0b8[_0x541c('0x33')],_0x46d0b8['query']);_0x2505b1[_0x541c('0x34')]=_[_0x541c('0x32')](_0x46d0b8[_0x541c('0x33')],qs[_0x541c('0x35')](_0x19f0de[_0x541c('0x30')][_0x541c('0x35')]));_0x2505b1['attributes']=_0x2505b1[_0x541c('0x34')][_0x541c('0x45')]?_0x2505b1['attributes']:_0x46d0b8[_0x541c('0x33')];if(_0x19f0de['query'][_0x541c('0x3e')]){_0x2505b1['include']=[{'all':!![]}];}_0x2505b1=_[_0x541c('0x3c')]({},_0x2505b1,_0x19f0de[_0x541c('0x46')]);return db[_0x541c('0x2c')][_0x541c('0x47')](_0x2505b1)['then'](handleEntityNotFound(_0x26fc3f,null))[_0x541c('0x23')](respondWithResult(_0x26fc3f,null))[_0x541c('0x42')](handleError(_0x26fc3f,null));};exports[_0x541c('0x48')]=function(_0x114f64,_0x442c70){return db[_0x541c('0x2c')][_0x541c('0x48')](_0x114f64[_0x541c('0x49')],{})[_0x541c('0x23')](respondWithResult(_0x442c70,0xc9))[_0x541c('0x42')](handleError(_0x442c70,null));};exports[_0x541c('0x4a')]=function(_0x2d5335,_0x480693){if(_0x2d5335[_0x541c('0x49')]['id']){delete _0x2d5335[_0x541c('0x49')]['id'];}return db['ChatGroup'][_0x541c('0x47')]({'where':{'id':_0x2d5335[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0x480693,null))[_0x541c('0x23')](saveUpdates(_0x2d5335[_0x541c('0x49')],null))['then'](respondWithResult(_0x480693,null))[_0x541c('0x42')](handleError(_0x480693,null));};exports[_0x541c('0x24')]=function(_0x4024d7,_0xb31ec8){return db[_0x541c('0x2c')][_0x541c('0x47')]({'where':{'id':_0x4024d7[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0xb31ec8,null))['then'](removeEntity(_0xb31ec8,null))[_0x541c('0x42')](handleError(_0xb31ec8,null));};exports[_0x541c('0x4b')]=function(_0x51002d,_0x1fbc05){return db[_0x541c('0x2c')][_0x541c('0x4b')]()[_0x541c('0x23')](respondWithResult(_0x1fbc05,null))[_0x541c('0x42')](handleError(_0x1fbc05,null));};exports['getUnread']=function(_0x23608b,_0x1df95a,_0x506b9b){return db[_0x541c('0x4c')][_0x541c('0x21')]({'where':{'ChatGroupId':_0x23608b[_0x541c('0x44')]['id'],'ToId':_0x23608b['user']['id'],'read':![]}})[_0x541c('0x23')](function(_0x42b379){return{'id':_[_0x541c('0x4d')](_0x23608b['params']['id']),'count':_0x42b379};})[_0x541c('0x23')](respondWithResult(_0x1df95a,null))[_0x541c('0x42')](handleError(_0x1df95a,null));};exports[_0x541c('0x4e')]=function(_0xc453ba,_0x2aac28,_0x3e58da){return db[_0x541c('0x2c')][_0x541c('0x47')]({'where':{'id':_0xc453ba[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0x2aac28,null))[_0x541c('0x23')](function(_0xfba927){if(_0xfba927){return _0xfba927[_0x541c('0x4e')](_0xc453ba[_0x541c('0x49')][_0x541c('0x4f')],_[_0x541c('0x50')](_0xc453ba[_0x541c('0x49')],[_0x541c('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x2aac28,null))[_0x541c('0x42')](handleError(_0x2aac28,null));};exports[_0x541c('0x51')]=function(_0x41aabf,_0x479215,_0x1ac413){var _0x479591={};var _0x4f2f23={};var _0x177b6c;var _0x575ec5;return db[_0x541c('0x2c')]['findOne']({'where':{'id':_0x41aabf[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0x479215,null))[_0x541c('0x23')](function(_0x50176d){if(_0x50176d){_0x177b6c=_0x50176d;_0x4f2f23[_0x541c('0x33')]=_[_0x541c('0x31')](db[_0x541c('0x52')][_0x541c('0x2d')]);_0x4f2f23[_0x541c('0x30')]=_[_0x541c('0x31')](_0x41aabf[_0x541c('0x30')]);_0x4f2f23[_0x541c('0x39')]=_[_0x541c('0x32')](_0x4f2f23[_0x541c('0x33')],_0x4f2f23['query']);_0x479591[_0x541c('0x34')]=_[_0x541c('0x32')](_0x4f2f23[_0x541c('0x33')],qs[_0x541c('0x35')](_0x41aabf[_0x541c('0x30')][_0x541c('0x35')]));_0x479591[_0x541c('0x34')]=_0x479591[_0x541c('0x34')][_0x541c('0x45')]?_0x479591[_0x541c('0x34')]:_0x4f2f23[_0x541c('0x33')];_0x479591[_0x541c('0x36')]=qs[_0x541c('0x37')](_0x41aabf[_0x541c('0x30')][_0x541c('0x37')]);_0x479591[_0x541c('0x38')]=qs['filters'](_[_0x541c('0x3a')](_0x41aabf[_0x541c('0x30')],_0x4f2f23['filters']));if(_0x41aabf[_0x541c('0x30')]['filter']){_0x479591[_0x541c('0x38')]=_[_0x541c('0x3c')](_0x479591[_0x541c('0x38')],{'$or':_['map'](_0x479591[_0x541c('0x34')],function(_0xe39da5){var _0x321601={};_0x321601[_0xe39da5]={'$like':'%'+_0x41aabf['query'][_0x541c('0x3b')]+'%'};return _0x321601;})});}_0x479591=_[_0x541c('0x3c')]({},_0x479591,_0x41aabf[_0x541c('0x46')]);return _0x177b6c[_0x541c('0x51')](_0x479591);}})[_0x541c('0x23')](function(_0x4573cc){if(_0x4573cc){_0x575ec5=_0x4573cc[_0x541c('0x45')];if(!_0x41aabf[_0x541c('0x30')][_0x541c('0x53')](_0x541c('0x54'))){_0x479591[_0x541c('0x1f')]=qs[_0x541c('0x1f')](_0x41aabf[_0x541c('0x30')]['limit']);_0x479591[_0x541c('0x1e')]=qs[_0x541c('0x1e')](_0x41aabf[_0x541c('0x30')][_0x541c('0x1e')]);}return _0x177b6c['getMembers'](_0x479591);}})[_0x541c('0x23')](function(_0x1607ab){if(_0x1607ab){return _0x1607ab?{'count':_0x575ec5,'rows':_0x1607ab}:null;}})[_0x541c('0x23')](respondWithResult(_0x479215,null))[_0x541c('0x42')](handleError(_0x479215,null));};exports[_0x541c('0x55')]=function(_0x349c3e,_0x5f2b6c,_0x1c476f){return db['ChatGroup'][_0x541c('0x47')]({'where':{'id':_0x349c3e[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0x5f2b6c,null))[_0x541c('0x23')](function(_0x47e897){if(_0x47e897){return _0x47e897[_0x541c('0x55')](_0x349c3e[_0x541c('0x30')][_0x541c('0x4f')]);}})[_0x541c('0x23')](respondWithStatusCode(_0x5f2b6c,null))['catch'](handleError(_0x5f2b6c,null));};exports[_0x541c('0x56')]=function(_0x407090,_0x5bbaae,_0x1acb85){if(_0x407090[_0x541c('0x49')]['id']){delete _0x407090['body']['id'];}return db[_0x541c('0x2c')][_0x541c('0x47')]({'where':{'id':_0x407090[_0x541c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bbaae,null))[_0x541c('0x23')](function(_0x167383){if(_0x167383){_0x407090[_0x541c('0x49')][_0x541c('0x57')]=_0x167383['id'];return db[_0x541c('0x4c')][_0x541c('0x48')](_0x407090['body']);}})[_0x541c('0x23')](respondWithResult(_0x5bbaae,null))['catch'](handleError(_0x5bbaae,null));};exports[_0x541c('0x58')]=function(_0x508423,_0x326065,_0x4c1d5c){var _0x34af03={};var _0x3a6db8={};var _0xadff38;var _0x1126ce;return db['ChatGroup']['findOne']({'where':{'id':_0x508423[_0x541c('0x44')]['id']}})[_0x541c('0x23')](handleEntityNotFound(_0x326065,null))[_0x541c('0x23')](function(_0x15c049){if(_0x15c049){_0xadff38=_0x15c049;_0x3a6db8[_0x541c('0x33')]=_['keys'](db[_0x541c('0x4c')][_0x541c('0x2d')]);_0x3a6db8['query']=_['keys'](_0x508423['query']);_0x3a6db8[_0x541c('0x39')]=_['intersection'](_0x3a6db8[_0x541c('0x33')],_0x3a6db8[_0x541c('0x30')]);_0x34af03[_0x541c('0x34')]=_[_0x541c('0x32')](_0x3a6db8[_0x541c('0x33')],qs[_0x541c('0x35')](_0x508423[_0x541c('0x30')][_0x541c('0x35')]));_0x34af03['attributes']=_0x34af03[_0x541c('0x34')][_0x541c('0x45')]?_0x34af03[_0x541c('0x34')]:_0x3a6db8['model'];_0x34af03[_0x541c('0x36')]=qs['sort'](_0x508423[_0x541c('0x30')]['sort']);_0x34af03[_0x541c('0x38')]=qs[_0x541c('0x39')](_[_0x541c('0x3a')](_0x508423[_0x541c('0x30')],_0x3a6db8[_0x541c('0x39')]));if(_0x508423['query'][_0x541c('0x3b')]){_0x34af03[_0x541c('0x38')]=_[_0x541c('0x3c')](_0x34af03[_0x541c('0x38')],{'$or':_[_0x541c('0x2b')](_0x34af03[_0x541c('0x34')],function(_0x57fcd8){var _0x1ad737={};_0x1ad737[_0x57fcd8]={'$like':'%'+_0x508423[_0x541c('0x30')][_0x541c('0x3b')]+'%'};return _0x1ad737;})});}if(_0x508423[_0x541c('0x30')][_0x541c('0x59')]){var _0x21d787=_0x508423[_0x541c('0x30')]['$gte']['split'](',');var _0x1320f6={};_0x1320f6[_0x21d787[0x0]]={'$gte':moment(_0x21d787[0x1])[_0x541c('0x5a')](_0x541c('0x5b'))};_0x34af03[_0x541c('0x38')]=_[_0x541c('0x3c')](_0x34af03[_0x541c('0x38')],_0x1320f6);}_0x34af03=_[_0x541c('0x3c')]({},_0x34af03,_0x508423['options']);return _0xadff38[_0x541c('0x58')](_0x34af03);}})[_0x541c('0x23')](function(_0x559f20){if(_0x559f20){_0x1126ce=_0x559f20['length'];if(!_0x508423['query'][_0x541c('0x53')]('nolimit')){_0x34af03[_0x541c('0x1f')]=qs['limit'](_0x508423[_0x541c('0x30')][_0x541c('0x1f')]);_0x34af03['offset']=qs[_0x541c('0x1e')](_0x508423[_0x541c('0x30')][_0x541c('0x1e')]);}return _0xadff38[_0x541c('0x58')](_0x34af03);}})[_0x541c('0x23')](function(_0x51ca8d){if(_0x51ca8d){return _0x51ca8d?{'count':_0x1126ce,'rows':_0x51ca8d}:null;}})['then'](respondWithResult(_0x326065,null))[_0x541c('0x42')](handleError(_0x326065,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e3a7db3..0805654 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 _0x50c1=['save','remove','emit','hasOwnProperty','exports','events','ChatGroup'];(function(_0x426d33,_0x2cfb45){var _0x279c96=function(_0x2d9673){while(--_0x2d9673){_0x426d33['push'](_0x426d33['shift']());}};_0x279c96(++_0x2cfb45);}(_0x50c1,0x171));var _0x150c=function(_0x20e149,_0x20036d){_0x20e149=_0x20e149-0x0;var _0x20f8aa=_0x50c1[_0x20e149];return _0x20f8aa;};'use strict';var EventEmitter=require(_0x150c('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x150c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x150c('0x2'),'afterUpdate':'update','afterDestroy':_0x150c('0x3')};function emitEvent(_0x57e7ca){return function(_0x1f8076,_0x47ef37,_0x446fe1){ChatGroupEvents['emit'](_0x57e7ca+':'+_0x1f8076['id'],_0x1f8076);ChatGroupEvents[_0x150c('0x4')](_0x57e7ca,_0x1f8076);_0x446fe1(null);};}for(var e in events){if(events[_0x150c('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x150c('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x36d4=['exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x36d4,0x17d));var _0x436d=function(_0x4f4521,_0x14ac9e){_0x4f4521=_0x4f4521-0x0;var _0x1294da=_0x36d4[_0x4f4521];return _0x1294da;};'use strict';var EventEmitter=require(_0x436d('0x0'));var ChatGroup=require(_0x436d('0x1'))['db'][_0x436d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x436d('0x3')](0x0);var events={'afterCreate':_0x436d('0x4'),'afterUpdate':_0x436d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x296d0a){return function(_0x29af36,_0x201144,_0x8250e6){ChatGroupEvents[_0x436d('0x6')](_0x296d0a+':'+_0x29af36['id'],_0x29af36);ChatGroupEvents['emit'](_0x296d0a,_0x29af36);_0x8250e6(null);};}for(var e in events){if(events[_0x436d('0x7')](e)){var event=events[e];ChatGroup[_0x436d('0x8')](e,emitEvent(event));}}module[_0x436d('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 99208d7..2cfdfd2 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 _0x1a0f=['lodash','util','../../config/logger','api','moment','bluebird','path','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x14bacc,_0x40fe93){var _0x47367b=function(_0x17d337){while(--_0x17d337){_0x14bacc['push'](_0x14bacc['shift']());}};_0x47367b(++_0x40fe93);}(_0x1a0f,0x6c));var _0xf1a0=function(_0x38ac0c,_0x5b11ec){_0x38ac0c=_0x38ac0c-0x0;var _0x173e56=_0x1a0f[_0x38ac0c];return _0x173e56;};'use strict';var _=require(_0xf1a0('0x0'));var util=require(_0xf1a0('0x1'));var logger=require(_0xf1a0('0x2'))(_0xf1a0('0x3'));var moment=require(_0xf1a0('0x4'));var BPromise=require(_0xf1a0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1a0('0x7'));module[_0xf1a0('0x8')]=function(_0x115c85,_0x41dc21){return _0x115c85[_0xf1a0('0x9')](_0xf1a0('0xa'),attributes,{'tableName':_0xf1a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaabb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','api'];(function(_0x39ffbc,_0x25eaba){var _0x26be80=function(_0x2370b7){while(--_0x2370b7){_0x39ffbc['push'](_0x39ffbc['shift']());}};_0x26be80(++_0x25eaba);}(_0xaabb,0x1ea));var _0xbaab=function(_0x193d1a,_0x249662){_0x193d1a=_0x193d1a-0x0;var _0x35399a=_0xaabb[_0x193d1a];return _0x35399a;};'use strict';var _=require(_0xbaab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbaab('0x1'));var moment=require(_0xbaab('0x2'));var BPromise=require(_0xbaab('0x3'));var rp=require(_0xbaab('0x4'));var fs=require('fs');var path=require(_0xbaab('0x5'));var rimraf=require(_0xbaab('0x6'));var config=require(_0xbaab('0x7'));var attributes=require(_0xbaab('0x8'));module[_0xbaab('0x9')]=function(_0x21d786,_0x5e2af7){return _0x21d786['define'](_0xbaab('0xa'),attributes,{'tableName':_0xbaab('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 ebdedf6..a36898f 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 _0x0bde=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring'];(function(_0x171c8b,_0xea7a5c){var _0x2ccd5f=function(_0x4cad54){while(--_0x4cad54){_0x171c8b['push'](_0x171c8b['shift']());}};_0x2ccd5f(++_0xea7a5c);}(_0x0bde,0xe7));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xe0bd('0x0'));var moment=require('moment');var BPromise=require(_0xe0bd('0x1'));var rs=require(_0xe0bd('0x2'));var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});config[_0xe0bd('0xb')]=_[_0xe0bd('0xc')](config['redis'],{'host':_0xe0bd('0xd'),'port':0x18eb});var socket=require(_0xe0bd('0xe'))(new Redis(config[_0xe0bd('0xb')]));require(_0xe0bd('0xf'))[_0xe0bd('0x10')](socket);function respondWithRpcPromise(_0x3c47c4,_0x475265,_0x58d892){return new BPromise(function(_0x561b74,_0x595dac){return client['request'](_0x3c47c4,_0x58d892)[_0xe0bd('0x11')](function(_0x5e2a24){logger['info'](_0xe0bd('0x12'),_0x475265,_0xe0bd('0x13'));logger['debug'](_0xe0bd('0x14'),_0x475265,'request\x20sent',JSON[_0xe0bd('0x15')](_0x5e2a24));if(_0x5e2a24[_0xe0bd('0x16')]){if(_0x5e2a24[_0xe0bd('0x16')][_0xe0bd('0x17')]===0x1f4){logger[_0xe0bd('0x16')](_0xe0bd('0x12'),_0x475265,_0x5e2a24[_0xe0bd('0x16')][_0xe0bd('0x18')]);return _0x595dac(_0x5e2a24['error']['message']);}logger['error'](_0xe0bd('0x12'),_0x475265,_0x5e2a24[_0xe0bd('0x16')][_0xe0bd('0x18')]);return _0x561b74(_0x5e2a24[_0xe0bd('0x16')][_0xe0bd('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x475265,_0xe0bd('0x13'));_0x561b74(_0x5e2a24['result'][_0xe0bd('0x18')]);}})[_0xe0bd('0x19')](function(_0xec158d){logger[_0xe0bd('0x16')]('ChatGroup,\x20%s,\x20%s',_0x475265,_0xec158d);_0x595dac(_0xec158d);});});} \ No newline at end of file +var _0x5d55=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4d44aa,_0x213c9f){var _0x18460c=function(_0x5568b7){while(--_0x5568b7){_0x4d44aa['push'](_0x4d44aa['shift']());}};_0x18460c(++_0x213c9f);}(_0x5d55,0x1a4));var _0x55d5=function(_0x2509bd,_0x3de0d4){_0x2509bd=_0x2509bd-0x0;var _0xf6ce81=_0x5d55[_0x2509bd];return _0xf6ce81;};'use strict';var _=require('lodash');var util=require(_0x55d5('0x0'));var moment=require('moment');var BPromise=require(_0x55d5('0x1'));var rs=require(_0x55d5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55d5('0x3'))['db'];var utils=require(_0x55d5('0x4'));var logger=require(_0x55d5('0x5'))('rpc');var config=require(_0x55d5('0x6'));var jayson=require(_0x55d5('0x7'));var client=jayson[_0x55d5('0x8')][_0x55d5('0x9')]({'port':0x232a});config[_0x55d5('0xa')]=_[_0x55d5('0xb')](config[_0x55d5('0xa')],{'host':_0x55d5('0xc'),'port':0x18eb});var socket=require(_0x55d5('0xd'))(new Redis(config['redis']));require(_0x55d5('0xe'))[_0x55d5('0xf')](socket);function respondWithRpcPromise(_0x448938,_0x64f70a,_0xdac85){return new BPromise(function(_0x4db860,_0x45569e){return client['request'](_0x448938,_0xdac85)[_0x55d5('0x10')](function(_0x21d7c0){logger[_0x55d5('0x11')](_0x55d5('0x12'),_0x64f70a,_0x55d5('0x13'));logger['debug'](_0x55d5('0x14'),_0x64f70a,_0x55d5('0x13'),JSON[_0x55d5('0x15')](_0x21d7c0));if(_0x21d7c0['error']){if(_0x21d7c0[_0x55d5('0x16')]['code']===0x1f4){logger[_0x55d5('0x16')](_0x55d5('0x12'),_0x64f70a,_0x21d7c0[_0x55d5('0x16')][_0x55d5('0x17')]);return _0x45569e(_0x21d7c0['error'][_0x55d5('0x17')]);}logger[_0x55d5('0x16')](_0x55d5('0x12'),_0x64f70a,_0x21d7c0['error'][_0x55d5('0x17')]);return _0x4db860(_0x21d7c0['error'][_0x55d5('0x17')]);}else{logger['info'](_0x55d5('0x12'),_0x64f70a,_0x55d5('0x13'));_0x4db860(_0x21d7c0['result'][_0x55d5('0x17')]);}})[_0x55d5('0x18')](function(_0x2c0324){logger[_0x55d5('0x16')]('ChatGroup,\x20%s,\x20%s',_0x64f70a,_0x2c0324);_0x45569e(_0x2c0324);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e470bd8..56d51d7 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 _0xa55a=['update','emit','register','length','chatGroup:','save','remove'];(function(_0x257d22,_0x3fc88b){var _0x43d194=function(_0xad8fe){while(--_0xad8fe){_0x257d22['push'](_0x257d22['shift']());}};_0x43d194(++_0x3fc88b);}(_0xa55a,0x1a9));var _0xaa55=function(_0x4d6406,_0x5c0b07){_0x4d6406=_0x4d6406-0x0;var _0x1f53cd=_0xa55a[_0x4d6406];return _0x1f53cd;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xaa55('0x0'),_0xaa55('0x1'),_0xaa55('0x2')];function createListener(_0x42e1f0,_0x52724c){return function(_0x693cd){_0x52724c[_0xaa55('0x3')](_0x42e1f0,_0x693cd);};}function removeListener(_0x57a5e2,_0x1aa136){return function(){ChatGroupEvents['removeListener'](_0x57a5e2,_0x1aa136);};}exports[_0xaa55('0x4')]=function(_0x1d3eb9){for(var _0x34027d=0x0,_0x3299e3=events[_0xaa55('0x5')];_0x34027d<_0x3299e3;_0x34027d++){var _0xdd10e7=events[_0x34027d];var _0x665d9a=createListener(_0xaa55('0x6')+_0xdd10e7,_0x1d3eb9);ChatGroupEvents['on'](_0xdd10e7,_0x665d9a);}}; \ No newline at end of file +var _0xaa10=['register','./chatGroup.events','save','remove','update','removeListener'];(function(_0x21b9da,_0x5d09d4){var _0x46c544=function(_0x5c73b9){while(--_0x5c73b9){_0x21b9da['push'](_0x21b9da['shift']());}};_0x46c544(++_0x5d09d4);}(_0xaa10,0xfd));var _0x0aa1=function(_0x24cb64,_0x5f4f1b){_0x24cb64=_0x24cb64-0x0;var _0x33cc93=_0xaa10[_0x24cb64];return _0x33cc93;};'use strict';var ChatGroupEvents=require(_0x0aa1('0x0'));var events=[_0x0aa1('0x1'),_0x0aa1('0x2'),_0x0aa1('0x3')];function createListener(_0x5a5f94,_0x1d54d8){return function(_0x4cfb10){_0x1d54d8['emit'](_0x5a5f94,_0x4cfb10);};}function removeListener(_0x58945e,_0x39a297){return function(){ChatGroupEvents[_0x0aa1('0x4')](_0x58945e,_0x39a297);};}exports[_0x0aa1('0x5')]=function(_0x417325){for(var _0x5c48e4=0x0,_0x50068f=events['length'];_0x5c48e4<_0x50068f;_0x5c48e4++){var _0x45e5ec=events[_0x5c48e4];var _0x3c20d0=createListener('chatGroup:'+_0x45e5ec,_0x417325);ChatGroupEvents['on'](_0x45e5ec,_0x3c20d0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fa3b4ec..7c12e06 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 _0xecb8=['show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','put','update','delete','destroy','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','/:id'];(function(_0x3cc732,_0x2799cf){var _0x1fca7f=function(_0x37a6e5){while(--_0x37a6e5){_0x3cc732['push'](_0x3cc732['shift']());}};_0x1fca7f(++_0x2799cf);}(_0xecb8,0xb6));var _0x8ecb=function(_0x2d28dd,_0x10b362){_0x2d28dd=_0x2d28dd-0x0;var _0x6c1ec6=_0xecb8[_0x2d28dd];return _0x6c1ec6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ecb('0x0'));var timeout=require(_0x8ecb('0x1'));var express=require(_0x8ecb('0x2'));var router=express[_0x8ecb('0x3')]();var fs_extra=require(_0x8ecb('0x4'));var auth=require(_0x8ecb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ecb('0x6'));router[_0x8ecb('0x7')]('/',auth[_0x8ecb('0x8')](),controller['index']);router['get']('/describe',auth[_0x8ecb('0x8')](),controller['describe']);router[_0x8ecb('0x7')](_0x8ecb('0x9'),auth[_0x8ecb('0x8')](),controller[_0x8ecb('0xa')]);router['get'](_0x8ecb('0xb'),auth[_0x8ecb('0x8')](),controller[_0x8ecb('0xc')]);router[_0x8ecb('0x7')](_0x8ecb('0xd'),auth[_0x8ecb('0x8')](),controller['getMembers']);router[_0x8ecb('0x7')](_0x8ecb('0xe'),auth['isAuthenticated'](),controller[_0x8ecb('0xf')]);router[_0x8ecb('0x10')]('/',auth[_0x8ecb('0x8')](),controller[_0x8ecb('0x11')]);router[_0x8ecb('0x10')](_0x8ecb('0xd'),auth[_0x8ecb('0x8')](),controller['addMembers']);router[_0x8ecb('0x10')]('/:id/messages',auth[_0x8ecb('0x8')](),controller['addMessage']);router[_0x8ecb('0x12')](_0x8ecb('0x9'),auth[_0x8ecb('0x8')](),controller[_0x8ecb('0x13')]);router[_0x8ecb('0x14')]('/:id',auth[_0x8ecb('0x8')](),controller[_0x8ecb('0x15')]);router[_0x8ecb('0x14')](_0x8ecb('0xd'),auth['isAuthenticated'](),controller[_0x8ecb('0x16')]);module[_0x8ecb('0x17')]=router; \ No newline at end of file +var _0x790a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','/:id/unread','getMembers','/:id/messages','getMessages','post','addMembers','put','update','destroy','delete','removeMembers','multer','path'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x790a,0x14e));var _0xa790=function(_0x5489c4,_0x1e7a17){_0x5489c4=_0x5489c4-0x0;var _0x2c4624=_0x790a[_0x5489c4];return _0x2c4624;};'use strict';var multer=require(_0xa790('0x0'));var util=require('util');var path=require(_0xa790('0x1'));var timeout=require(_0xa790('0x2'));var express=require('express');var router=express[_0xa790('0x3')]();var fs_extra=require(_0xa790('0x4'));var auth=require(_0xa790('0x5'));var interaction=require(_0xa790('0x6'));var config=require('../../config/environment');var controller=require(_0xa790('0x7'));router[_0xa790('0x8')]('/',auth[_0xa790('0x9')](),controller['index']);router[_0xa790('0x8')](_0xa790('0xa'),auth[_0xa790('0x9')](),controller[_0xa790('0xb')]);router[_0xa790('0x8')](_0xa790('0xc'),auth[_0xa790('0x9')](),controller['show']);router[_0xa790('0x8')](_0xa790('0xd'),auth[_0xa790('0x9')](),controller['getUnread']);router[_0xa790('0x8')]('/:id/members',auth[_0xa790('0x9')](),controller[_0xa790('0xe')]);router['get'](_0xa790('0xf'),auth[_0xa790('0x9')](),controller[_0xa790('0x10')]);router[_0xa790('0x11')]('/',auth[_0xa790('0x9')](),controller['create']);router[_0xa790('0x11')]('/:id/members',auth[_0xa790('0x9')](),controller[_0xa790('0x12')]);router[_0xa790('0x11')](_0xa790('0xf'),auth[_0xa790('0x9')](),controller['addMessage']);router[_0xa790('0x13')]('/:id',auth[_0xa790('0x9')](),controller[_0xa790('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa790('0x15')]);router[_0xa790('0x16')]('/:id/members',auth['isAuthenticated'](),controller[_0xa790('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f4e0398..843d7fc 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 _0x2952=['DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','TEXT','STRING'];(function(_0x55d289,_0x27ec2a){var _0x2d11e9=function(_0x55b6a7){while(--_0x55b6a7){_0x55d289['push'](_0x55d289['shift']());}};_0x2d11e9(++_0x27ec2a);}(_0x2952,0x158));var _0x2295=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x2952[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x2295('0x0'));module[_0x2295('0x1')]={'closed':{'type':Sequelize[_0x2295('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2295('0x3')]},'ratingType':{'type':Sequelize[_0x2295('0x4')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x2295('0x5')]},'mailTranscript':{'type':Sequelize[_0x2295('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2295('0x7')]},'disposition':{'type':Sequelize[_0x2295('0x6')]},'secondDisposition':{'type':Sequelize[_0x2295('0x6')]},'thirdDisposition':{'type':Sequelize[_0x2295('0x6')]},'note':{'type':Sequelize[_0x2295('0x6')]},'browserName':{'type':Sequelize[_0x2295('0x6')]},'browserVersion':{'type':Sequelize[_0x2295('0x6')]},'osName':{'type':Sequelize[_0x2295('0x6')]},'osVersion':{'type':Sequelize[_0x2295('0x6')]},'deviceModel':{'type':Sequelize[_0x2295('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x2295('0x5')]},'customerIp':{'type':Sequelize[_0x2295('0x6')]},'formData':{'type':Sequelize[_0x2295('0x5')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x2295('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x2295('0x4')]('in',_0x2295('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2295('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x2295('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x2295('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1129=['thumb','TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0x1129,0xf6));var _0x9112=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1129[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9112('0x0'));module[_0x9112('0x1')]={'closed':{'type':Sequelize[_0x9112('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9112('0x3')]},'ratingType':{'type':Sequelize[_0x9112('0x4')](_0x9112('0x5'),_0x9112('0x6')),'defaultValue':_0x9112('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x9112('0x7')]},'mailTranscript':{'type':Sequelize[_0x9112('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9112('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9112('0x8')]},'note':{'type':Sequelize[_0x9112('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x9112('0x8')]},'osName':{'type':Sequelize[_0x9112('0x8')]},'osVersion':{'type':Sequelize[_0x9112('0x8')]},'deviceModel':{'type':Sequelize[_0x9112('0x8')]},'deviceVendor':{'type':Sequelize[_0x9112('0x8')]},'deviceType':{'type':Sequelize[_0x9112('0x8')]},'referer':{'type':Sequelize[_0x9112('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9112('0x7')](_0x9112('0x9'))},'read1stAt':{'type':Sequelize[_0x9112('0xa')]},'lastMsgAt':{'type':Sequelize[_0x9112('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x9112('0x4')]('in',_0x9112('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x9112('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x9112('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9112('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6fba5e4..ff6d740 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 _0xb69b=['account','index','map','ChatInteraction','fieldName','type','findAll','chat','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','Attachment','attachmentDownload','json','ChatOfflineMessageId','offline-chat/','basename','download','close','mailTranscript','join','root','server/files/chat/upload/','format','now','User','CmContact','ContactId','Messages','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','%s%d','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','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','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','include','rows','getMyMessages','ChatInteractionId','secret','includeAgent','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','server','attachments','Contact','firstName','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','osName','customerIp','customerPort','tail','pipe','createWriteStream','lastName','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','request-promise','bluebird','mustache','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','undefined','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','render','merge','contact','agent','interaction'];(function(_0x116d1f,_0x229ba8){var _0x52c253=function(_0x325a05){while(--_0x325a05){_0x116d1f['push'](_0x116d1f['shift']());}};_0x52c253(++_0x229ba8);}(_0xb69b,0x174));var _0xbb69=function(_0x2b5caa,_0xc7b7e4){_0x2b5caa=_0x2b5caa-0x0;var _0x515030=_0xb69b[_0x2b5caa];return _0x515030;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xbb69('0x0'));var rp=require(_0xbb69('0x1'));var moment=require('moment');var BPromise=require(_0xbb69('0x2'));var Mustache=require(_0xbb69('0x3'));var util=require(_0xbb69('0x4'));var path=require(_0xbb69('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xbb69('0x6'));var interaction=require(_0xbb69('0x7'));var qs=require(_0xbb69('0x8'));var pdf=require(_0xbb69('0x9'));var logger=require(_0xbb69('0xa'))(_0xbb69('0xb'));var config=require('../../config/environment');var db=require(_0xbb69('0xc'))['db'];config[_0xbb69('0xd')]=_[_0xbb69('0xe')](config[_0xbb69('0xd')],{'host':_0xbb69('0xf'),'port':0x18eb});var socket=require(_0xbb69('0x10'))(new Redis(config[_0xbb69('0xd')]));require(_0xbb69('0x11'))[_0xbb69('0x12')](socket);var jayson=require(_0xbb69('0x13'));var client=jayson[_0xbb69('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xbb69('0x14')][_0xbb69('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x2c98d6,_0x266ae3,_0x428bf7,_0x4f9a85){return new BPromise(function(_0x878f7e,_0x217449){var _0x27d3a7=_0x4f9a85||client;return _0x27d3a7[_0xbb69('0x16')](_0x2c98d6,_0x428bf7)[_0xbb69('0x17')](function(_0x5383d3){logger[_0xbb69('0x18')](_0xbb69('0x19'),_0x266ae3,_0xbb69('0x1a'));logger[_0xbb69('0x1b')](_0xbb69('0x1c'),_0x266ae3,_0xbb69('0x1a'),JSON['stringify'](_0x5383d3));if(_0x5383d3['error']){if(_0x5383d3[_0xbb69('0x1d')][_0xbb69('0x1e')]===0x1f4){logger[_0xbb69('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x266ae3,_0x5383d3[_0xbb69('0x1d')][_0xbb69('0x1f')]);return _0x217449(_0x5383d3[_0xbb69('0x1d')][_0xbb69('0x1f')]);}logger['error'](_0xbb69('0x19'),_0x266ae3,_0x5383d3[_0xbb69('0x1d')][_0xbb69('0x1f')]);return _0x878f7e(_0x5383d3[_0xbb69('0x1d')]['message']);}else{logger[_0xbb69('0x18')](_0xbb69('0x19'),_0x266ae3,'request\x20sent');_0x878f7e(_0x5383d3[_0xbb69('0x20')][_0xbb69('0x1f')]);}})['catch'](function(_0x1b69c3){logger[_0xbb69('0x1d')](_0xbb69('0x19'),_0x266ae3,_0x1b69c3);_0x217449(_0x1b69c3);});});}function respondWithStatusCode(_0x1fe4f4,_0x5d2e52){_0x5d2e52=_0x5d2e52||0xcc;return function(_0x24cae0){if(_0x24cae0){return _0x1fe4f4['sendStatus'](_0x5d2e52);}return _0x1fe4f4[_0xbb69('0x21')](_0x5d2e52)['end']();};}function respondWithResult(_0x245997,_0x1488a2){_0x1488a2=_0x1488a2||0xc8;return function(_0x33b313){if(_0x33b313){return _0x245997['status'](_0x1488a2)['json'](_0x33b313);}};}function respondWithFilteredResult(_0x6f314,_0x291058){return function(_0x520ac3){if(_0x520ac3){var _0x3c05af=typeof _0x291058[_0xbb69('0x22')]===_0xbb69('0x23')&&typeof _0x291058['limit']==='undefined';var _0x3aadf3=_0x520ac3['count'];var _0x4cb188=_0x3c05af?0x0:_0x291058['offset'];var _0x4d60fa=_0x3c05af?_0x520ac3['count']:_0x291058[_0xbb69('0x22')]+_0x291058[_0xbb69('0x24')];var _0x2ecdc1;if(_0x4d60fa>=_0x3aadf3){_0x4d60fa=_0x3aadf3;_0x2ecdc1=0xc8;}else{_0x2ecdc1=0xce;}_0x6f314[_0xbb69('0x21')](_0x2ecdc1);return _0x6f314[_0xbb69('0x25')](_0xbb69('0x26'),_0x4cb188+'-'+_0x4d60fa+'/'+_0x3aadf3)['json'](_0x520ac3);}return null;};}function saveUpdates(_0xcb5fd5){return function(_0xe8f1b0){if(_0xe8f1b0){return _0xe8f1b0[_0xbb69('0x27')](_0xcb5fd5)[_0xbb69('0x17')](function(_0x49cc11){return _0x49cc11;});}return null;};}function removeEntity(_0x136de5){return function(_0xaf0d04){if(_0xaf0d04){return _0xaf0d04[_0xbb69('0x28')]()[_0xbb69('0x17')](function(){_0x136de5[_0xbb69('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3e31){return function(_0x5772dd){if(!_0x5772dd){_0x3a3e31[_0xbb69('0x29')](0x194);}return _0x5772dd;};}function handleError(_0x5ac2f7,_0x52af56){_0x52af56=_0x52af56||0x1f4;return function(_0x475c43){logger[_0xbb69('0x1d')](_0x475c43[_0xbb69('0x2a')]);if(_0x475c43[_0xbb69('0x2b')]){delete _0x475c43[_0xbb69('0x2b')];}_0x5ac2f7[_0xbb69('0x21')](_0x52af56)[_0xbb69('0x2c')](_0x475c43);};}function getMustacheRender(_0x125d6b,_0x536dbe){return Mustache[_0xbb69('0x2d')](_0x125d6b,_[_0xbb69('0x2e')](_0x536dbe['body'],{'contact':_0x536dbe[_0xbb69('0x2f')],'message':_0x536dbe[_0xbb69('0x1f')],'agent':_0x536dbe[_0xbb69('0x30')],'interaction':_0x536dbe[_0xbb69('0x31')],'account':_0x536dbe[_0xbb69('0x32')]}))||'';}exports[_0xbb69('0x33')]=function(_0x1f37ae,_0x5367f7){var _0x35034a={};var _0x197f62=_[_0xbb69('0x34')](db[_0xbb69('0x35')]['rawAttributes'],function(_0x4c3111){return{'name':_0x4c3111[_0xbb69('0x36')],'type':_0x4c3111[_0xbb69('0x37')]['key']};});_0x35034a=qs['getOptions'](_0x197f62,_0x1f37ae);return interaction[_0xbb69('0x38')](_0xbb69('0x39'),_0x1f37ae[_0xbb69('0x3a')],_0x1f37ae[_0xbb69('0x3b')],_0x35034a,_0x197f62)[_0xbb69('0x17')](respondWithFilteredResult(_0x5367f7,_0x35034a))[_0xbb69('0x3c')](handleError(_0x5367f7,null));};exports[_0xbb69('0x3d')]=function(_0x3969c9,_0x537f8f){var _0x1340a4={'raw':![],'where':{'id':_0x3969c9[_0xbb69('0x3e')]['id']}},_0x37ff61={};_0x37ff61[_0xbb69('0x3f')]=_[_0xbb69('0x40')](db[_0xbb69('0x35')]['rawAttributes']);_0x37ff61[_0xbb69('0x3a')]=_[_0xbb69('0x40')](_0x3969c9['query']);_0x37ff61[_0xbb69('0x41')]=_[_0xbb69('0x42')](_0x37ff61['model'],_0x37ff61[_0xbb69('0x3a')]);_0x1340a4[_0xbb69('0x43')]=_[_0xbb69('0x42')](_0x37ff61[_0xbb69('0x3f')],qs[_0xbb69('0x44')](_0x3969c9[_0xbb69('0x3a')][_0xbb69('0x44')]));_0x1340a4[_0xbb69('0x43')]=_0x1340a4[_0xbb69('0x43')][_0xbb69('0x45')]?_0x1340a4[_0xbb69('0x43')]:_0x37ff61['model'];if(_0x3969c9['query'][_0xbb69('0x46')]){_0x1340a4['include']=[{'all':!![]}];}_0x1340a4=_[_0xbb69('0x2e')]({},_0x1340a4,_0x3969c9[_0xbb69('0x47')]);return db[_0xbb69('0x35')][_0xbb69('0x48')](_0x1340a4)['then'](handleEntityNotFound(_0x537f8f,null))[_0xbb69('0x17')](respondWithResult(_0x537f8f,null))['catch'](handleError(_0x537f8f,null));};exports[_0xbb69('0x49')]=function(_0xeae3fb,_0x1969f6){return db[_0xbb69('0x35')]['create'](_0xeae3fb[_0xbb69('0x4a')],{})[_0xbb69('0x17')](respondWithResult(_0x1969f6,0xc9))[_0xbb69('0x3c')](handleError(_0x1969f6,null));};exports[_0xbb69('0x27')]=function(_0x1095d4,_0x5ced34){if(_0x1095d4[_0xbb69('0x4a')]['id']){delete _0x1095d4[_0xbb69('0x4a')]['id'];}return db[_0xbb69('0x35')]['find']({'where':{'id':_0x1095d4[_0xbb69('0x3e')]['id']}})[_0xbb69('0x17')](handleEntityNotFound(_0x5ced34,null))[_0xbb69('0x17')](saveUpdates(_0x1095d4[_0xbb69('0x4a')],null))[_0xbb69('0x17')](respondWithResult(_0x5ced34,null))['catch'](handleError(_0x5ced34,null));};exports[_0xbb69('0x28')]=function(_0xcadf7b,_0x546734){return db[_0xbb69('0x35')][_0xbb69('0x48')]({'where':{'id':_0xcadf7b[_0xbb69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x546734,null))[_0xbb69('0x17')](removeEntity(_0x546734,null))[_0xbb69('0x3c')](handleError(_0x546734,null));};exports[_0xbb69('0x4b')]=function(_0x331c30,_0x1de92c){return db[_0xbb69('0x35')]['describe']()[_0xbb69('0x17')](respondWithResult(_0x1de92c,null))[_0xbb69('0x3c')](handleError(_0x1de92c,null));};exports[_0xbb69('0x4c')]=function(_0x3b033f,_0x24b31e){var _0x4ea942=_0x3b033f['params']['id'];var _0x5a6640;var _0x46e907;var _0x3c1c33;return db[_0xbb69('0x35')][_0xbb69('0x4d')]({'where':{'id':_0x4ea942}})[_0xbb69('0x17')](function(_0x4aefef){_0x5a6640=_0x4aefef;return db[_0xbb69('0x4e')][_0xbb69('0x4d')]({'where':{'id':_0x4aefef[_0xbb69('0x4f')]},'attributes':['id',_0xbb69('0x50'),_0xbb69('0x51'),_0xbb69('0x52'),'vidaooNote',_0xbb69('0x53')],'raw':!![]});})['then'](function(_0x4c46d9){if(_0x4c46d9&&_0x4c46d9[_0xbb69('0x50')]&&_0x4c46d9[_0xbb69('0x51')]){_0x46e907=_0x4c46d9;var _0x124287={'interaction':{'id':_0x4ea942},'agent':{'id':_0x3b033f[_0xbb69('0x3b')]['id'],'name':_0x3b033f['user'][_0xbb69('0x2b')],'fullname':_0x3b033f[_0xbb69('0x3b')][_0xbb69('0x54')],'email':_0x3b033f[_0xbb69('0x3b')][_0xbb69('0x55')]},'contact':_0x3b033f['body'][_0xbb69('0x2f')],'account':_0x3b033f[_0xbb69('0x4a')][_0xbb69('0x32')]};var _0x42f874={'rejectUnauthorized':![],'method':_0xbb69('0x56'),'url':_0xbb69('0x57'),'headers':{'X-APIKEY':_0x4c46d9['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3b033f[_0xbb69('0x3b')][_0xbb69('0x55')]],'buttons':null,'topic':_0x46e907[_0xbb69('0x52')],'note':_[_0xbb69('0x58')](_0x46e907[_0xbb69('0x59')])?null:getMustacheRender(_0x46e907[_0xbb69('0x59')],_0x124287),'metadata':null},'redirect':_0xbb69('0x5a'),'json':!![]};try{if(!_['isNull'](_0x46e907[_0xbb69('0x53')])){var _0x4c591b=getMustacheRender(_0x46e907[_0xbb69('0x53')],_0x124287);var _0x374755=JSON[_0xbb69('0x5b')](_0x4c591b);_0x42f874[_0xbb69('0x4a')][_0xbb69('0x5c')]=_0x374755;}}catch(_0x28ea56){throw new db[(_0xbb69('0x5d'))][(_0xbb69('0x5e'))](_0xbb69('0x5f'));}return rp(_0x42f874);}else{throw new db['Sequelize'][(_0xbb69('0x5e'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x304084){_0x3c1c33=_0x304084;if(_0x3c1c33['id']){var _0x1d9638={'body':_0x3c1c33['join_url'],'ChatWebsiteId':_0x46e907['id'],'ChatInteractionId':_0x5a6640['id'],'direction':_0xbb69('0x60'),'UserId':_0x3b033f['user']['id']};return db[_0xbb69('0x61')][_0xbb69('0x49')](_0x1d9638,{});}else{throw new db[(_0xbb69('0x5d'))][(_0xbb69('0x5e'))](_0xbb69('0x62'));}})['then'](function(){return _0x5a6640[_0xbb69('0x63')]({'vidaooSessionId':_0x3c1c33['id']});})['then'](respondWithResult(_0x24b31e,null))[_0xbb69('0x3c')](handleError(_0x24b31e,null));};exports[_0xbb69('0x64')]=function(_0x248dca,_0x438470){if(_0x248dca['body']['id']){delete _0x248dca[_0xbb69('0x4a')]['id'];}return db[_0xbb69('0x35')][_0xbb69('0x48')]({'where':{'id':_0x248dca[_0xbb69('0x3e')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xbb69('0x17')](handleEntityNotFound(_0x438470,null))[_0xbb69('0x17')](saveUpdates(_0x248dca[_0xbb69('0x4a')],null))['then'](respondWithResult(_0x438470,null))[_0xbb69('0x3c')](handleError(_0x438470,null));};exports[_0xbb69('0x65')]=function(_0x5aae0a,_0x14dac0){if(_0x5aae0a['body']['id']){delete _0x5aae0a[_0xbb69('0x4a')]['id'];}return db[_0xbb69('0x35')]['find']({'where':{'id':_0x5aae0a[_0xbb69('0x3e')]['id']}})['then'](function(_0x35d073){if(!_0x35d073){logger[_0xbb69('0x1d')](_0xbb69('0x66'),'abandon',0x194,_0xbb69('0x67'));_0x14dac0[_0xbb69('0x29')](0x194);}else{if(_0x35d073[_0xbb69('0x68')]){throw new db[(_0xbb69('0x5d'))][(_0xbb69('0x5e'))](_0xbb69('0x69'));}}return _0x35d073;})[_0xbb69('0x17')](function(_0x5aa1cc){if(_0x5aa1cc){return _0x5aa1cc[_0xbb69('0x27')]({'closed':_0x5aae0a['body'][_0xbb69('0x6a')],'disposition':_0x5aae0a[_0xbb69('0x4a')][_0xbb69('0x6b')]})['then'](function(_0x88da7){return _0x88da7;});}})[_0xbb69('0x17')](function(){return respondWithRpcPromise(_0xbb69('0x6c'),'abandon',_0x5aae0a['body'],client9004);})[_0xbb69('0x17')](respondWithResult(_0x14dac0,null))[_0xbb69('0x3c')](handleError(_0x14dac0,null));};exports[_0xbb69('0x6d')]=function(_0x4be592,_0x139593){_0x4be592[_0xbb69('0x4a')][_0xbb69('0x2b')]=_0x4be592[_0xbb69('0x6e')][_0xbb69('0x6f')];_0x4be592[_0xbb69('0x4a')]['basename']=_0x4be592[_0xbb69('0x6e')]['filename'];_0x4be592[_0xbb69('0x4a')]['type']=_0x4be592[_0xbb69('0x6e')]['mimetype'];return db[_0xbb69('0x70')]['create'](_0x4be592['body'])[_0xbb69('0x17')](respondWithResult(_0x139593,0xc9))['catch'](handleError(_0x139593,null));};exports[_0xbb69('0x71')]=function(_0x30e4a9,_0x4c9874){return db['ChatInteraction']['findOne']({'where':{'id':_0x30e4a9['params']['id']},'raw':!![]})[_0xbb69('0x17')](handleEntityNotFound(_0x4c9874,null))['then'](function(_0x35abe4){if(_0x35abe4){if(_0x35abe4[_0xbb69('0x6a')]){return _0x4c9874[_0xbb69('0x21')](0x193)[_0xbb69('0x72')]({'status':0x193,'message':'Unauthorized'});}return db[_0xbb69('0x70')][_0xbb69('0x4d')]({'where':{'id':_0x30e4a9[_0xbb69('0x3a')]['attachId']},'raw':!![]})[_0xbb69('0x17')](handleEntityNotFound(_0x4c9874,null));}})[_0xbb69('0x17')](function(_0x337cdb){if(_0x337cdb){var _0x2ff842=_0x337cdb[_0xbb69('0x73')]!==null;var _0x2c1ae1=path['join'](config['root'],'server/files/attachments/');if(_0x2ff842){_0x2c1ae1=path['join'](_0x2c1ae1,_0xbb69('0x74'));}var _0xba7922=path['join'](_0x2c1ae1,_0x337cdb[_0xbb69('0x75')]);return _0x4c9874[_0xbb69('0x76')](_0xba7922);}})[_0xbb69('0x3c')](handleError(_0x4c9874,null));};exports[_0xbb69('0x77')]=function(_0xeccc85,_0x53a7dd){var _0x5ad7cf=null;var _0x284bde=null;var _0x4b8c14=null;if(_0xeccc85[_0xbb69('0x4a')]['id']){delete _0xeccc85[_0xbb69('0x4a')]['id'];}if(_0xeccc85[_0xbb69('0x4a')][_0xbb69('0x78')]){_0x4b8c14=path[_0xbb69('0x79')](config[_0xbb69('0x7a')],_0xbb69('0x7b'),util[_0xbb69('0x7c')]('transcript-%s.txt',Date[_0xbb69('0x7d')]()));_0xeccc85[_0xbb69('0x4a')]['pathTranscript']=_0x4b8c14;}return db[_0xbb69('0x35')][_0xbb69('0x48')]({'where':{'id':_0xeccc85[_0xbb69('0x3e')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xbb69('0x7e')}]}]})[_0xbb69('0x17')](handleEntityNotFound(_0x53a7dd,null))[_0xbb69('0x17')](saveUpdates(_0xeccc85[_0xbb69('0x4a')],null))[_0xbb69('0x17')](function(_0xfd7465){if(_0xfd7465){_0x5ad7cf=_0xfd7465;return db[_0xbb69('0x4e')][_0xbb69('0x48')]({'where':{'id':_0x5ad7cf[_0xbb69('0x4f')]}});}})[_0xbb69('0x17')](function(_0x54644e){if(_0x54644e){_0x284bde=_0x54644e;return db[_0xbb69('0x7f')]['find']({'where':{'id':_0x5ad7cf[_0xbb69('0x80')]}});}})[_0xbb69('0x17')](function(_0x4a3689){if(_0x4a3689){if(_0x4b8c14){var _0x1f1493=null;for(var _0x44212c=0x1;_0x44212c<_0x5ad7cf[_0xbb69('0x81')]['length'];++_0x44212c){_0x1f1493=_0x5ad7cf[_0xbb69('0x81')][_0x44212c];var _0x37882d=_0x1f1493['UserId']?util[_0xbb69('0x7c')]('%s%d',_0x284bde[_0xbb69('0x82')],_0x1f1493[_0xbb69('0x68')]):_0xbb69('0x83');var _0x4754b9=_0xeccc85[_0xbb69('0x4a')][_0xbb69('0x84')]||util[_0xbb69('0x7c')]('%s%d',_0xbb69('0x85'),_0x1f1493['ContactId']);switch(_0x284bde[_0xbb69('0x86')]){case _0xbb69('0x87'):_0x37882d=_0x1f1493[_0xbb69('0x68')]?util[_0xbb69('0x7c')](_0xbb69('0x88'),_0x284bde[_0xbb69('0x82')],_0x1f1493['UserId']):'System';break;case _0xbb69('0x89'):_0x37882d=_0x1f1493[_0xbb69('0x68')]?_0x1f1493[_0xbb69('0x7e')][_0xbb69('0x8a')]||_0x1f1493['User'][_0xbb69('0x54')]:_0xbb69('0x83');break;case _0xbb69('0x8b'):_0x37882d=_0x1f1493['UserId']?_0x1f1493[_0xbb69('0x7e')][_0xbb69('0x54')]:_0xbb69('0x83');break;default:_0x37882d=_0x1f1493[_0xbb69('0x68')]?util['format']('%s%d',_0x284bde[_0xbb69('0x82')],_0x1f1493[_0xbb69('0x68')]):_0xbb69('0x83');}var _0x324ae1=util[_0xbb69('0x7c')](_0xbb69('0x8c'),moment(_0x1f1493[_0xbb69('0x8d')])[_0xbb69('0x7c')](_0xbb69('0x8e')),_0x1f1493[_0xbb69('0x8f')]==='in'?_0x4754b9:_0x37882d,_0x1f1493['body']);if(!_0x1f1493['secret']){fs[_0xbb69('0x90')](_0x4b8c14,_0x324ae1);}}return db[_0xbb69('0x91')][_0xbb69('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0xbb69('0x92')],'as':_0xbb69('0x93'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xbb69('0x17')](function(_0x253d12){if(!_0x253d12||!_0x253d12[_0xbb69('0x93')]||!_0xeccc85[_0xbb69('0x4a')])return _0x5ad7cf;var _0x159d9a=_0x253d12[_0xbb69('0x94')]();return respondWithRpcPromise(_0xbb69('0x95'),_0xbb69('0x96'),{'account':_0x159d9a,'message':{'from':util[_0xbb69('0x7c')](_0xbb69('0x97'),_0x253d12['name'],_0x253d12[_0xbb69('0x55')]||_0x253d12['Smtp']['user']),'to':_0xeccc85[_0xbb69('0x4a')][_0xbb69('0x78')],'subject':_0xbb69('0x98'),'text':util['format'](_0xbb69('0x99'),_0xeccc85[_0xbb69('0x4a')][_0xbb69('0x78')]),'attachments':[{'path':_0x4b8c14}]}})['then'](function(){return _0x5ad7cf;})[_0xbb69('0x3c')](function(_0x36a719){logger['error'](_0x36a719);});})['then'](respondWithStatusCode(_0x53a7dd,0xc8))[_0xbb69('0x3c')](handleError(_0x53a7dd,null));};exports[_0xbb69('0x9a')]=function(_0x41c1e2,_0x36c887){return db['ChatMessage']['find']({'where':{'id':_0x41c1e2[_0xbb69('0x3e')]['id']}})[_0xbb69('0x17')](handleEntityNotFound(_0x36c887,null))['then'](function(_0x851c22){if(_0x851c22){return _0x851c22[_0xbb69('0x9a')](_0x41c1e2[_0xbb69('0x4a')][_0xbb69('0x9b')],_[_0xbb69('0x9c')](_0x41c1e2[_0xbb69('0x4a')],[_0xbb69('0x9b'),'id'])||{});}})[_0xbb69('0x17')](respondWithResult(_0x36c887,null))[_0xbb69('0x3c')](handleError(_0x36c887,null));};exports['getMessages']=function(_0x15f413,_0x48fe8c){var _0x5303d9={'raw':![],'where':{}};var _0x23c9d4={};var _0x490433={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb69('0x4d')]({'where':{'id':_0x15f413[_0xbb69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48fe8c,null))[_0xbb69('0x17')](function(_0x421efc){if(_0x421efc){_0x23c9d4[_0xbb69('0x3f')]=_['keys'](db[_0xbb69('0x61')][_0xbb69('0x9d')]);_0x23c9d4[_0xbb69('0x3a')]=_[_0xbb69('0x40')](_0x15f413[_0xbb69('0x3a')]);_0x23c9d4[_0xbb69('0x41')]=_[_0xbb69('0x42')](_0x23c9d4[_0xbb69('0x3f')],_0x23c9d4[_0xbb69('0x3a')]);_0x5303d9[_0xbb69('0x43')]=_[_0xbb69('0x42')](_0x23c9d4[_0xbb69('0x3f')],qs[_0xbb69('0x44')](_0x15f413[_0xbb69('0x3a')][_0xbb69('0x44')]));_0x5303d9[_0xbb69('0x43')]=_0x5303d9[_0xbb69('0x43')]['length']?_0x5303d9['attributes']:_0x23c9d4['model'];if(!_0x15f413[_0xbb69('0x3a')][_0xbb69('0x9e')](_0xbb69('0x9f'))){_0x5303d9[_0xbb69('0x24')]=qs[_0xbb69('0x24')](_0x15f413[_0xbb69('0x3a')]['limit']);_0x5303d9['offset']=qs[_0xbb69('0x22')](_0x15f413[_0xbb69('0x3a')][_0xbb69('0x22')]);}_0x5303d9[_0xbb69('0xa0')]=qs[_0xbb69('0xa1')](_0x15f413['query'][_0xbb69('0xa1')]);_0x5303d9['where']=qs[_0xbb69('0x41')](_[_0xbb69('0xa2')](_0x15f413[_0xbb69('0x3a')],_0x23c9d4[_0xbb69('0x41')]));_0x5303d9[_0xbb69('0xa3')]['ChatInteractionId']=_0x421efc['id'];if(_0x15f413[_0xbb69('0x3a')][_0xbb69('0xa4')]){_0x5303d9[_0xbb69('0xa3')]=_['merge'](_0x5303d9['where'],{'$or':_['map'](_0x5303d9[_0xbb69('0x43')],function(_0x234b94){var _0x462310={};_0x462310[_0x234b94]={'$like':'%'+_0x15f413[_0xbb69('0x3a')]['filter']+'%'};return _0x462310;})});}if(_0x15f413['query'][_0xbb69('0xa5')]){var _0x6ce241=_0x15f413['query'][_0xbb69('0xa5')][_0xbb69('0xa6')](',');var _0x4dbe9a={};_0x4dbe9a[_0x6ce241[0x0]]={'$gte':moment(_0x6ce241[0x1])[_0xbb69('0x7c')](_0xbb69('0xa7'))};_0x5303d9[_0xbb69('0xa3')]=_[_0xbb69('0x2e')](_0x5303d9[_0xbb69('0xa3')],_0x4dbe9a);}_0x5303d9=_[_0xbb69('0x2e')]({},_0x5303d9,_0x15f413[_0xbb69('0x47')]);return db[_0xbb69('0x61')][_0xbb69('0xa8')]({'where':_0x5303d9[_0xbb69('0xa3')]})['then'](function(_0x38ab20){_0x490433[_0xbb69('0xa8')]=_0x38ab20;if(_0x15f413['query'][_0xbb69('0x46')]){_0x5303d9[_0xbb69('0xa9')]=[{'all':!![]}];}return db[_0xbb69('0x61')][_0xbb69('0x38')](_0x5303d9);})['then'](function(_0x2aefad){_0x490433[_0xbb69('0xaa')]=_0x2aefad;return _0x490433;});}})[_0xbb69('0x17')](respondWithFilteredResult(_0x48fe8c,_0x5303d9))['catch'](handleError(_0x48fe8c,null));};exports[_0xbb69('0xab')]=function(_0x43afb3,_0x5241de){var _0x2b08e9={'where':{}},_0x49d20e={},_0x3ff0d5={'count':0x0,'rows':[]};return db[_0xbb69('0x35')][_0xbb69('0x4d')]({'where':{'id':_0x43afb3[_0xbb69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5241de,null))[_0xbb69('0x17')](function(_0x260269){if(_0x260269){_0x49d20e[_0xbb69('0x3f')]=_['keys'](db[_0xbb69('0x61')]['rawAttributes']);_0x49d20e[_0xbb69('0x3a')]=_['keys'](_0x43afb3[_0xbb69('0x3a')]);_0x49d20e[_0xbb69('0x41')]=_[_0xbb69('0x42')](_0x49d20e[_0xbb69('0x3f')],_0x49d20e[_0xbb69('0x3a')]);_0x2b08e9[_0xbb69('0x43')]=_[_0xbb69('0x42')](_0x49d20e[_0xbb69('0x3f')],qs[_0xbb69('0x44')](_0x43afb3[_0xbb69('0x3a')][_0xbb69('0x44')]));_0x2b08e9[_0xbb69('0x43')]=_0x2b08e9['attributes'][_0xbb69('0x45')]?_0x2b08e9[_0xbb69('0x43')]:_0x49d20e[_0xbb69('0x3f')];if(!_0x43afb3[_0xbb69('0x3a')][_0xbb69('0x9e')](_0xbb69('0x9f'))){_0x2b08e9[_0xbb69('0x24')]=qs[_0xbb69('0x24')](_0x43afb3[_0xbb69('0x3a')][_0xbb69('0x24')]);_0x2b08e9['offset']=qs[_0xbb69('0x22')](_0x43afb3['query']['offset']);}_0x2b08e9['order']=qs[_0xbb69('0xa1')](_0x43afb3[_0xbb69('0x3a')]['sort']);_0x2b08e9['where']=qs['filters'](_[_0xbb69('0xa2')](_0x43afb3[_0xbb69('0x3a')],_0x49d20e[_0xbb69('0x41')]));_0x2b08e9['where'][_0xbb69('0xac')]=_0x260269['id'];if(_0x43afb3[_0xbb69('0x3a')][_0xbb69('0xa4')]){_0x2b08e9[_0xbb69('0xa3')]=_[_0xbb69('0x2e')](_0x2b08e9[_0xbb69('0xa3')],{'$or':_[_0xbb69('0x34')](_0x2b08e9[_0xbb69('0x43')],function(_0xcdf0b6){var _0x3f6e03={};_0x3f6e03[_0xcdf0b6]={'$like':'%'+_0x43afb3[_0xbb69('0x3a')][_0xbb69('0xa4')]+'%'};return _0x3f6e03;})});}_0x2b08e9[_0xbb69('0xa3')][_0xbb69('0xad')]=![];if(_0x43afb3[_0xbb69('0x3a')]['id']){_0x2b08e9[_0xbb69('0xa3')]['id']={'$gt':_0x43afb3[_0xbb69('0x3a')]['id']};}_0x2b08e9=_['merge']({},_0x2b08e9,_0x43afb3[_0xbb69('0x47')]);return db['ChatMessage']['count']({'where':_0x2b08e9['where']})[_0xbb69('0x17')](function(_0xaad9a9){_0x3ff0d5['count']=_0xaad9a9;_0x2b08e9[_0xbb69('0xa9')]=[];if(_0x43afb3[_0xbb69('0x3a')][_0xbb69('0xae')]){_0x2b08e9[_0xbb69('0xa9')][_0xbb69('0xaf')]({'model':db[_0xbb69('0x7e')],'as':_0xbb69('0x7e'),'attributes':['id','fullname',_0xbb69('0x8a')]});}if(_0x43afb3[_0xbb69('0x3a')][_0xbb69('0x46')]){_0x2b08e9['include']=[{'all':!![]}];}return db[_0xbb69('0x61')][_0xbb69('0x38')](_0x2b08e9);})['then'](function(_0x49b867){_0x3ff0d5[_0xbb69('0xaa')]=_0x49b867;return _0x3ff0d5;});}})['then'](respondWithFilteredResult(_0x5241de,_0x2b08e9))[_0xbb69('0x3c')](handleError(_0x5241de,null));};exports[_0xbb69('0xb0')]=function(_0x125519,_0x3b6c13){return db[_0xbb69('0x35')]['find']({'where':{'id':_0x125519[_0xbb69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b6c13,null))['then'](function(_0x23022b){if(_0x23022b){return _0x23022b[_0xbb69('0xb1')](_0x125519[_0xbb69('0x4a')][_0xbb69('0x9b')],_[_0xbb69('0x9c')](_0x125519[_0xbb69('0x4a')],['ids','id'])||{})['spread'](function(){return db[_0xbb69('0xb2')][_0xbb69('0x38')]({'attributes':['id','name',_0xbb69('0xb3')],'where':{'id':_0x125519[_0xbb69('0x4a')][_0xbb69('0x9b')]}});})[_0xbb69('0x17')](function(_0x54100b){socket[_0xbb69('0xb4')](_0xbb69('0xb5'),{'id':Number(_0x125519[_0xbb69('0x3e')]['id']),'tags':_0x54100b||[]});return{'id':Number(_0x125519[_0xbb69('0x3e')]['id']),'tags':_0x54100b||[]};});}})[_0xbb69('0x17')](respondWithResult(_0x3b6c13,null))['catch'](handleError(_0x3b6c13,null));};exports[_0xbb69('0xb6')]=function(_0x74d7c6,_0x404938){return db[_0xbb69('0x35')]['find']({'where':{'id':_0x74d7c6[_0xbb69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x404938,null))['then'](function(_0x41b0e5){if(_0x41b0e5){return _0x41b0e5['removeTags'](_0x74d7c6[_0xbb69('0x3a')]['ids']);}})[_0xbb69('0x17')](respondWithStatusCode(_0x404938,null))[_0xbb69('0x3c')](handleError(_0x404938,null));};exports[_0xbb69('0x76')]=function(_0x38bfd,_0x10d44b){var _0x87f1f6=moment()[_0xbb69('0xb7')]()['toString']();var _0x31f30b=path['join'](config[_0xbb69('0x7a')],'server',_0xbb69('0xb8'),'tmp');var _0x2c4dd1=path[_0xbb69('0x79')](config[_0xbb69('0x7a')],_0xbb69('0xb9'),'files',_0xbb69('0xba'));var _0x2b3bb4=path['join'](_0x31f30b,_0x87f1f6);var _0xdc21c=util['format']('transcript-%d-%s.zip',_0x38bfd[_0xbb69('0x3e')]['id'],_0x87f1f6);var _0x3fb95d=path[_0xbb69('0x79')](_0x31f30b,_0xdc21c);var _0x35b64c=[];_0x35b64c[_0xbb69('0xaf')]({'model':db[_0xbb69('0x7e')],'as':'User','attributes':['id',_0xbb69('0x54')],'raw':!![]});_0x35b64c[_0xbb69('0xaf')]({'model':db['CmContact'],'as':_0xbb69('0xbb'),'attributes':['id',_0xbb69('0xbc'),'lastName'],'raw':!![]});if(_0x38bfd[_0xbb69('0x3a')][_0xbb69('0xba')]){_0x35b64c[_0xbb69('0xaf')]({'model':db['Attachment'],'as':_0xbb69('0x70'),'raw':!![]});}var _0x3543e4=[{'model':db[_0xbb69('0x61')],'as':_0xbb69('0x81'),'attributes':['id',_0xbb69('0x4a'),'createdAt',_0xbb69('0x8f'),'secret',_0xbb69('0xbd')],'include':_0x35b64c}];_0x3543e4[_0xbb69('0xaf')]({'model':db[_0xbb69('0x4e')],'as':_0xbb69('0xbe'),'attributes':['id',_0xbb69('0x2b')]});_0x3543e4[_0xbb69('0xaf')]({'model':db[_0xbb69('0x7e')],'as':'Owner','attributes':['id',_0xbb69('0x54')]});return db[_0xbb69('0x35')][_0xbb69('0x48')]({'where':{'id':_0x38bfd[_0xbb69('0x3e')]['id']},'include':_0x3543e4})[_0xbb69('0x17')](handleEntityNotFound(_0x10d44b,null))[_0xbb69('0x17')](function(_0x126c09){if(_0x126c09){var _0x3cb750=_0x126c09[_0xbb69('0xbf')]({'plain':!![]});fs[_0xbb69('0xc0')](_0x2b3bb4);var _0x9f72bc={'channel':_0xbb69('0xc1'),'account':_0x3cb750['Account'][_0xbb69('0x2b')],'agent':_0x3cb750[_0xbb69('0xc2')]?_0x3cb750[_0xbb69('0xc2')]['fullname']:_0xbb69('0xc3'),'createdAt':moment(_0x3cb750[_0xbb69('0x8d')])[_0xbb69('0x7c')](_0xbb69('0xa7'))[_0xbb69('0xc4')](),'closedAt':_0x3cb750[_0xbb69('0x6a')]?moment(_0x3cb750[_0xbb69('0xc5')])['format'](_0xbb69('0xa7'))[_0xbb69('0xc4')]():'','disposition':_0x3cb750[_0xbb69('0x6b')],'chatInfo':{'browser':_0x3cb750['browserName'],'os':_0x3cb750[_0xbb69('0xc6')],'referer':_0x3cb750['referer'],'customerIp':_0x3cb750[_0xbb69('0xc7')],'customerPort':_0x3cb750['customerPort']?_0x3cb750[_0xbb69('0xc8')]:_0xbb69('0xc3')},'messages':_(_0x3cb750[_0xbb69('0x81')])[_0xbb69('0xc9')]()[_0xbb69('0xa4')]({'secret':![]})['map'](function(_0x1072c2){if(_0x1072c2[_0xbb69('0x70')]){var _0xd997d6=path[_0xbb69('0x79')](_0x2c4dd1,_0x1072c2[_0xbb69('0x70')][_0xbb69('0x75')]);if(fs['existsSync'](_0xd997d6)){fs['createReadStream'](_0xd997d6)[_0xbb69('0xca')](fs[_0xbb69('0xcb')](path[_0xbb69('0x79')](_0x2b3bb4,_0x1072c2['Attachment'][_0xbb69('0x75')])));}}return{'date':moment(_0x1072c2['createdAt'])[_0xbb69('0x7c')](_0xbb69('0xa7'))[_0xbb69('0xc4')](),'sender':_0x1072c2[_0xbb69('0x8f')]===_0xbb69('0x60')?_0x1072c2[_0xbb69('0x7e')]?_0x1072c2['User'][_0xbb69('0x54')]:'System':_0x1072c2[_0xbb69('0xbb')][_0xbb69('0xbc')]+(_0x1072c2[_0xbb69('0xbb')][_0xbb69('0xcc')]?'\x20'+_0x1072c2[_0xbb69('0xbb')]['lastName']:''),'body':_0x1072c2[_0xbb69('0x70')]?_0x1072c2[_0xbb69('0x70')]['basename']:_0x1072c2[_0xbb69('0x4a')],'direction':_0x1072c2['direction']===_0xbb69('0x60')?'A':'C','secret':_0x1072c2[_0xbb69('0xad')],'read':_0x1072c2['read'],'attachment':_0x1072c2[_0xbb69('0x70')]};})[_0xbb69('0xcd')]()};return ejs['renderFile'](path[_0xbb69('0x79')](config['root'],_0xbb69('0xb9'),'views',_0xbb69('0xce')),{'interaction':_0x9f72bc})[_0xbb69('0x17')](function(_0x3ae7){var _0x1d33bc=path[_0xbb69('0x79')](_0x2b3bb4,_0xbb69('0xcf')+_0x3cb750['id']+'-'+_0x87f1f6+_0xbb69('0xd0'));var _0x16f1e2={'path':_0x1d33bc,'channel':'Chat','interactionId':_0x3cb750['id']};return pdf[_0xbb69('0xd1')](_0x3ae7,_0x16f1e2);})[_0xbb69('0x17')](function(){return new Promise(function(_0xcefef2,_0xdf41c6){zipdir(_0x2b3bb4,{'saveTo':_0x3fb95d},function(_0x35c8b0,_0x35c4e1){if(_0x35c8b0)return _0xdf41c6(_0x35c8b0);return _0xcefef2(_0x35c4e1);});})[_0xbb69('0x17')](function(){return new BPromise(function(_0x459645,_0x94b53){rimraf(_0x2b3bb4,function(_0x44bbd0){if(_0x44bbd0)_0x94b53(_0x44bbd0);return _0x459645();});});})['then'](function(){return _0x10d44b['download'](_0x3fb95d,_0xdc21c,function(_0x345462){if(_0x345462){logger[_0xbb69('0x1d')]('err',_0x345462);}else{fs[_0xbb69('0xd2')](_0x3fb95d);}});});});}else{return _0x10d44b[_0xbb69('0x29')](0xc8);}})[_0xbb69('0x3c')](handleError(_0x10d44b,null));}; \ No newline at end of file +var _0x3a01=['attachmentDownload','closed','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','ChatWebsiteId','ContactId','agentAlias','System','%s%d','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','order','sort','where','pick','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','hasOwnProperty','includeAgent','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','basename','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','moment','bluebird','util','path','ejs','lodash','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','stack','name','send','render','merge','contact','account','index','ChatInteraction','rawAttributes','key','getOptions','findAll','chat','query','user','params','keys','intersection','model','attributes','fields','length','includeAll','include','options','find','create','body','describe','createVidaooSession','findOne','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','AbandonInteraction','attachmentUpload','file','originalname','type','Attachment'];(function(_0xfcddad,_0x58b6f6){var _0x3317d1=function(_0xe99a55){while(--_0xe99a55){_0xfcddad['push'](_0xfcddad['shift']());}};_0x3317d1(++_0x58b6f6);}(_0x3a01,0x12f));var _0x13a0=function(_0x494950,_0x3857cc){_0x494950=_0x494950-0x0;var _0x17df80=_0x3a01[_0x494950];return _0x17df80;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x13a0('0x0'));var moment=require(_0x13a0('0x1'));var BPromise=require(_0x13a0('0x2'));var Mustache=require('mustache');var util=require(_0x13a0('0x3'));var path=require(_0x13a0('0x4'));var ejs=require(_0x13a0('0x5'));var fs=require('fs');var _=require(_0x13a0('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x13a0('0x7'));var logger=require(_0x13a0('0x8'))('api');var config=require(_0x13a0('0x9'));var db=require('../../mysqldb')['db'];config[_0x13a0('0xa')]=_[_0x13a0('0xb')](config[_0x13a0('0xa')],{'host':_0x13a0('0xc'),'port':0x18eb});var socket=require(_0x13a0('0xd'))(new Redis(config[_0x13a0('0xa')]));require('./chatInteraction.socket')[_0x13a0('0xe')](socket);var jayson=require(_0x13a0('0xf'));var client=jayson[_0x13a0('0x10')]['http']({'port':0x232b});var client9004=jayson[_0x13a0('0x10')][_0x13a0('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x4ed0fe,_0x48a762,_0x1a5edd,_0x190347){return new BPromise(function(_0x495afb,_0x307429){var _0x54b6b5=_0x190347||client;return _0x54b6b5[_0x13a0('0x12')](_0x4ed0fe,_0x1a5edd)[_0x13a0('0x13')](function(_0x1331d0){logger[_0x13a0('0x14')](_0x13a0('0x15'),_0x48a762,_0x13a0('0x16'));logger[_0x13a0('0x17')](_0x13a0('0x18'),_0x48a762,_0x13a0('0x16'),JSON[_0x13a0('0x19')](_0x1331d0));if(_0x1331d0[_0x13a0('0x1a')]){if(_0x1331d0['error'][_0x13a0('0x1b')]===0x1f4){logger[_0x13a0('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x48a762,_0x1331d0[_0x13a0('0x1a')][_0x13a0('0x1c')]);return _0x307429(_0x1331d0[_0x13a0('0x1a')][_0x13a0('0x1c')]);}logger[_0x13a0('0x1a')](_0x13a0('0x15'),_0x48a762,_0x1331d0['error']['message']);return _0x495afb(_0x1331d0['error'][_0x13a0('0x1c')]);}else{logger['info'](_0x13a0('0x15'),_0x48a762,_0x13a0('0x16'));_0x495afb(_0x1331d0['result'][_0x13a0('0x1c')]);}})[_0x13a0('0x1d')](function(_0x3d00bb){logger[_0x13a0('0x1a')](_0x13a0('0x15'),_0x48a762,_0x3d00bb);_0x307429(_0x3d00bb);});});}function respondWithStatusCode(_0x3f3c4f,_0x1dcca6){_0x1dcca6=_0x1dcca6||0xcc;return function(_0x292daa){if(_0x292daa){return _0x3f3c4f[_0x13a0('0x1e')](_0x1dcca6);}return _0x3f3c4f[_0x13a0('0x1f')](_0x1dcca6)[_0x13a0('0x20')]();};}function respondWithResult(_0x2660c9,_0x2d5387){_0x2d5387=_0x2d5387||0xc8;return function(_0x351077){if(_0x351077){return _0x2660c9[_0x13a0('0x1f')](_0x2d5387)[_0x13a0('0x21')](_0x351077);}};}function respondWithFilteredResult(_0x1cae53,_0x498426){return function(_0x1da541){if(_0x1da541){var _0x5bb1a4=typeof _0x498426[_0x13a0('0x22')]===_0x13a0('0x23')&&typeof _0x498426['limit']===_0x13a0('0x23');var _0x374fb0=_0x1da541[_0x13a0('0x24')];var _0x481f45=_0x5bb1a4?0x0:_0x498426['offset'];var _0x4d1129=_0x5bb1a4?_0x1da541[_0x13a0('0x24')]:_0x498426[_0x13a0('0x22')]+_0x498426[_0x13a0('0x25')];var _0x34944e;if(_0x4d1129>=_0x374fb0){_0x4d1129=_0x374fb0;_0x34944e=0xc8;}else{_0x34944e=0xce;}_0x1cae53[_0x13a0('0x1f')](_0x34944e);return _0x1cae53[_0x13a0('0x26')](_0x13a0('0x27'),_0x481f45+'-'+_0x4d1129+'/'+_0x374fb0)[_0x13a0('0x21')](_0x1da541);}return null;};}function saveUpdates(_0x1928f3){return function(_0x1eec92){if(_0x1eec92){return _0x1eec92[_0x13a0('0x28')](_0x1928f3)['then'](function(_0x47a42b){return _0x47a42b;});}return null;};}function removeEntity(_0x345bab){return function(_0x11f57c){if(_0x11f57c){return _0x11f57c[_0x13a0('0x29')]()[_0x13a0('0x13')](function(){_0x345bab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x373c3c){return function(_0x22c155){if(!_0x22c155){_0x373c3c['sendStatus'](0x194);}return _0x22c155;};}function handleError(_0x5c478a,_0x105c82){_0x105c82=_0x105c82||0x1f4;return function(_0x373d7b){logger['error'](_0x373d7b[_0x13a0('0x2a')]);if(_0x373d7b[_0x13a0('0x2b')]){delete _0x373d7b['name'];}_0x5c478a[_0x13a0('0x1f')](_0x105c82)[_0x13a0('0x2c')](_0x373d7b);};}function getMustacheRender(_0x66ef3a,_0x539d5a){return Mustache[_0x13a0('0x2d')](_0x66ef3a,_[_0x13a0('0x2e')](_0x539d5a['body'],{'contact':_0x539d5a[_0x13a0('0x2f')],'message':_0x539d5a[_0x13a0('0x1c')],'agent':_0x539d5a['agent'],'interaction':_0x539d5a['interaction'],'account':_0x539d5a[_0x13a0('0x30')]}))||'';}exports[_0x13a0('0x31')]=function(_0x2357af,_0x16fb7d){var _0x36cc40={};var _0x1d45e1=_['map'](db[_0x13a0('0x32')][_0x13a0('0x33')],function(_0x3d3d8a){return{'name':_0x3d3d8a['fieldName'],'type':_0x3d3d8a['type'][_0x13a0('0x34')]};});_0x36cc40=qs[_0x13a0('0x35')](_0x1d45e1,_0x2357af);return interaction[_0x13a0('0x36')](_0x13a0('0x37'),_0x2357af[_0x13a0('0x38')],_0x2357af[_0x13a0('0x39')],_0x36cc40,_0x1d45e1)[_0x13a0('0x13')](respondWithFilteredResult(_0x16fb7d,_0x36cc40))[_0x13a0('0x1d')](handleError(_0x16fb7d,null));};exports['show']=function(_0x150195,_0x35d4bd){var _0x1536b2={'raw':![],'where':{'id':_0x150195[_0x13a0('0x3a')]['id']}},_0x1d6132={};_0x1d6132['model']=_[_0x13a0('0x3b')](db[_0x13a0('0x32')][_0x13a0('0x33')]);_0x1d6132[_0x13a0('0x38')]=_['keys'](_0x150195[_0x13a0('0x38')]);_0x1d6132['filters']=_[_0x13a0('0x3c')](_0x1d6132[_0x13a0('0x3d')],_0x1d6132[_0x13a0('0x38')]);_0x1536b2[_0x13a0('0x3e')]=_[_0x13a0('0x3c')](_0x1d6132[_0x13a0('0x3d')],qs[_0x13a0('0x3f')](_0x150195['query'][_0x13a0('0x3f')]));_0x1536b2['attributes']=_0x1536b2[_0x13a0('0x3e')][_0x13a0('0x40')]?_0x1536b2[_0x13a0('0x3e')]:_0x1d6132[_0x13a0('0x3d')];if(_0x150195[_0x13a0('0x38')][_0x13a0('0x41')]){_0x1536b2[_0x13a0('0x42')]=[{'all':!![]}];}_0x1536b2=_[_0x13a0('0x2e')]({},_0x1536b2,_0x150195[_0x13a0('0x43')]);return db[_0x13a0('0x32')][_0x13a0('0x44')](_0x1536b2)[_0x13a0('0x13')](handleEntityNotFound(_0x35d4bd,null))[_0x13a0('0x13')](respondWithResult(_0x35d4bd,null))['catch'](handleError(_0x35d4bd,null));};exports[_0x13a0('0x45')]=function(_0x9f77b1,_0x2255dd){return db[_0x13a0('0x32')][_0x13a0('0x45')](_0x9f77b1[_0x13a0('0x46')],{})[_0x13a0('0x13')](respondWithResult(_0x2255dd,0xc9))[_0x13a0('0x1d')](handleError(_0x2255dd,null));};exports[_0x13a0('0x28')]=function(_0x56704e,_0xe4b584){if(_0x56704e['body']['id']){delete _0x56704e[_0x13a0('0x46')]['id'];}return db['ChatInteraction'][_0x13a0('0x44')]({'where':{'id':_0x56704e[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0xe4b584,null))[_0x13a0('0x13')](saveUpdates(_0x56704e[_0x13a0('0x46')],null))[_0x13a0('0x13')](respondWithResult(_0xe4b584,null))[_0x13a0('0x1d')](handleError(_0xe4b584,null));};exports['destroy']=function(_0x4dbb42,_0x4b9818){return db[_0x13a0('0x32')][_0x13a0('0x44')]({'where':{'id':_0x4dbb42[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0x4b9818,null))[_0x13a0('0x13')](removeEntity(_0x4b9818,null))[_0x13a0('0x1d')](handleError(_0x4b9818,null));};exports[_0x13a0('0x47')]=function(_0x421dde,_0x2b9eee){return db['ChatInteraction'][_0x13a0('0x47')]()[_0x13a0('0x13')](respondWithResult(_0x2b9eee,null))['catch'](handleError(_0x2b9eee,null));};exports[_0x13a0('0x48')]=function(_0x2b6833,_0x18456d){var _0x58063a=_0x2b6833['params']['id'];var _0x7b680;var _0x3e8c44;var _0x16578d;return db[_0x13a0('0x32')][_0x13a0('0x49')]({'where':{'id':_0x58063a}})[_0x13a0('0x13')](function(_0x5753ed){_0x7b680=_0x5753ed;return db['ChatWebsite'][_0x13a0('0x49')]({'where':{'id':_0x5753ed['ChatWebsiteId']},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0x13a0('0x4a'),_0x13a0('0x4b')],'raw':!![]});})[_0x13a0('0x13')](function(_0xda943c){if(_0xda943c&&_0xda943c['vidaooApiKey']&&_0xda943c[_0x13a0('0x4c')]){_0x3e8c44=_0xda943c;var _0x12391b={'interaction':{'id':_0x58063a},'agent':{'id':_0x2b6833[_0x13a0('0x39')]['id'],'name':_0x2b6833[_0x13a0('0x39')][_0x13a0('0x2b')],'fullname':_0x2b6833['user'][_0x13a0('0x4d')],'email':_0x2b6833[_0x13a0('0x39')][_0x13a0('0x4e')]},'contact':_0x2b6833['body'][_0x13a0('0x2f')],'account':_0x2b6833[_0x13a0('0x46')][_0x13a0('0x30')]};var _0x19dedb={'rejectUnauthorized':![],'method':_0x13a0('0x4f'),'url':_0x13a0('0x50'),'headers':{'X-APIKEY':_0xda943c[_0x13a0('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2b6833[_0x13a0('0x39')][_0x13a0('0x4e')]],'buttons':null,'topic':_0x3e8c44['vidaooTopic'],'note':_[_0x13a0('0x52')](_0x3e8c44['vidaooNote'])?null:getMustacheRender(_0x3e8c44[_0x13a0('0x4a')],_0x12391b),'metadata':null},'redirect':_0x13a0('0x53'),'json':!![]};try{if(!_[_0x13a0('0x52')](_0x3e8c44['vidaooMetadata'])){var _0x2041d1=getMustacheRender(_0x3e8c44[_0x13a0('0x4b')],_0x12391b);var _0x637c55=JSON[_0x13a0('0x54')](_0x2041d1);_0x19dedb[_0x13a0('0x46')][_0x13a0('0x55')]=_0x637c55;}}catch(_0x3d9c64){throw new db[(_0x13a0('0x56'))][(_0x13a0('0x57'))](_0x13a0('0x58'));}return rp(_0x19dedb);}else{throw new db[(_0x13a0('0x56'))][(_0x13a0('0x57'))](_0x13a0('0x59'));}})[_0x13a0('0x13')](function(_0x55f50e){_0x16578d=_0x55f50e;if(_0x16578d['id']){var _0x34bceb={'body':_0x16578d[_0x13a0('0x5a')],'ChatWebsiteId':_0x3e8c44['id'],'ChatInteractionId':_0x7b680['id'],'direction':_0x13a0('0x5b'),'UserId':_0x2b6833[_0x13a0('0x39')]['id']};return db[_0x13a0('0x5c')][_0x13a0('0x45')](_0x34bceb,{});}else{throw new db['Sequelize'][(_0x13a0('0x57'))](_0x13a0('0x5d'));}})[_0x13a0('0x13')](function(){return _0x7b680[_0x13a0('0x5e')]({'vidaooSessionId':_0x16578d['id']});})['then'](respondWithResult(_0x18456d,null))[_0x13a0('0x1d')](handleError(_0x18456d,null));};exports[_0x13a0('0x5f')]=function(_0x299f15,_0x28edf2){if(_0x299f15[_0x13a0('0x46')]['id']){delete _0x299f15[_0x13a0('0x46')]['id'];}return db['ChatInteraction'][_0x13a0('0x44')]({'where':{'id':_0x299f15[_0x13a0('0x3a')]['id']},'include':[{'model':db[_0x13a0('0x60')],'as':_0x13a0('0x61')}]})['then'](handleEntityNotFound(_0x28edf2,null))[_0x13a0('0x13')](saveUpdates(_0x299f15[_0x13a0('0x46')],null))[_0x13a0('0x13')](respondWithResult(_0x28edf2,null))['catch'](handleError(_0x28edf2,null));};exports[_0x13a0('0x62')]=function(_0x514d45,_0x1ffa56){if(_0x514d45[_0x13a0('0x46')]['id']){delete _0x514d45['body']['id'];}return db[_0x13a0('0x32')]['find']({'where':{'id':_0x514d45[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](function(_0x1820d5){if(!_0x1820d5){logger[_0x13a0('0x1a')](_0x13a0('0x63'),'abandon',0x194,'entity\x20not\x20found');_0x1ffa56[_0x13a0('0x1e')](0x194);}else{if(_0x1820d5[_0x13a0('0x64')]){throw new db[(_0x13a0('0x56'))][(_0x13a0('0x57'))]('Interaction\x20already\x20assigned');}}return _0x1820d5;})['then'](function(_0x47f481){if(_0x47f481){return _0x47f481[_0x13a0('0x28')]({'closed':_0x514d45['body']['closed'],'disposition':_0x514d45['body']['disposition']})[_0x13a0('0x13')](function(_0xb70d87){return _0xb70d87;});}})[_0x13a0('0x13')](function(){return respondWithRpcPromise(_0x13a0('0x65'),'abandon',_0x514d45[_0x13a0('0x46')],client9004);})[_0x13a0('0x13')](respondWithResult(_0x1ffa56,null))[_0x13a0('0x1d')](handleError(_0x1ffa56,null));};exports[_0x13a0('0x66')]=function(_0x921843,_0x232120){_0x921843['body'][_0x13a0('0x2b')]=_0x921843[_0x13a0('0x67')][_0x13a0('0x68')];_0x921843[_0x13a0('0x46')]['basename']=_0x921843[_0x13a0('0x67')]['filename'];_0x921843[_0x13a0('0x46')][_0x13a0('0x69')]=_0x921843[_0x13a0('0x67')]['mimetype'];return db[_0x13a0('0x6a')][_0x13a0('0x45')](_0x921843[_0x13a0('0x46')])[_0x13a0('0x13')](respondWithResult(_0x232120,0xc9))[_0x13a0('0x1d')](handleError(_0x232120,null));};exports[_0x13a0('0x6b')]=function(_0x329fb3,_0x314f5c){return db['ChatInteraction'][_0x13a0('0x49')]({'where':{'id':_0x329fb3[_0x13a0('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x314f5c,null))[_0x13a0('0x13')](function(_0x4bd172){if(_0x4bd172){if(_0x4bd172[_0x13a0('0x6c')]){return _0x314f5c[_0x13a0('0x1f')](0x193)[_0x13a0('0x21')]({'status':0x193,'message':_0x13a0('0x6d')});}return db[_0x13a0('0x6a')]['findOne']({'where':{'id':_0x329fb3['query']['attachId']},'raw':!![]})[_0x13a0('0x13')](handleEntityNotFound(_0x314f5c,null));}})[_0x13a0('0x13')](function(_0x4e32bc){if(_0x4e32bc){var _0x40a5c5=_0x4e32bc[_0x13a0('0x6e')]!==null;var _0x1c47c2=path[_0x13a0('0x6f')](config[_0x13a0('0x70')],_0x13a0('0x71'));if(_0x40a5c5){_0x1c47c2=path[_0x13a0('0x6f')](_0x1c47c2,_0x13a0('0x72'));}var _0x120aaf=path[_0x13a0('0x6f')](_0x1c47c2,_0x4e32bc['basename']);return _0x314f5c[_0x13a0('0x73')](_0x120aaf);}})['catch'](handleError(_0x314f5c,null));};exports[_0x13a0('0x74')]=function(_0x2ba043,_0x2a86c3){var _0x1be34f=null;var _0x5466a1=null;var _0x1166a5=null;if(_0x2ba043[_0x13a0('0x46')]['id']){delete _0x2ba043[_0x13a0('0x46')]['id'];}if(_0x2ba043[_0x13a0('0x46')][_0x13a0('0x75')]){_0x1166a5=path[_0x13a0('0x6f')](config['root'],'server/files/chat/upload/',util[_0x13a0('0x76')](_0x13a0('0x77'),Date[_0x13a0('0x78')]()));_0x2ba043[_0x13a0('0x46')][_0x13a0('0x79')]=_0x1166a5;}return db[_0x13a0('0x32')][_0x13a0('0x44')]({'where':{'id':_0x2ba043['params']['id']},'include':[{'model':db[_0x13a0('0x5c')],'as':_0x13a0('0x7a'),'include':[{'model':db['User'],'as':_0x13a0('0x7b')}]}]})[_0x13a0('0x13')](handleEntityNotFound(_0x2a86c3,null))['then'](saveUpdates(_0x2ba043[_0x13a0('0x46')],null))[_0x13a0('0x13')](function(_0x8b6d76){if(_0x8b6d76){_0x1be34f=_0x8b6d76;return db[_0x13a0('0x7c')][_0x13a0('0x44')]({'where':{'id':_0x1be34f[_0x13a0('0x7d')]}});}})[_0x13a0('0x13')](function(_0x535cb4){if(_0x535cb4){_0x5466a1=_0x535cb4;return db[_0x13a0('0x60')][_0x13a0('0x44')]({'where':{'id':_0x1be34f[_0x13a0('0x7e')]}});}})['then'](function(_0x5b0491){if(_0x5b0491){if(_0x1166a5){var _0x181f08=null;for(var _0x19c445=0x1;_0x19c445<_0x1be34f[_0x13a0('0x7a')][_0x13a0('0x40')];++_0x19c445){_0x181f08=_0x1be34f[_0x13a0('0x7a')][_0x19c445];var _0x2b40f1=_0x181f08[_0x13a0('0x64')]?util[_0x13a0('0x76')]('%s%d',_0x5466a1[_0x13a0('0x7f')],_0x181f08['UserId']):_0x13a0('0x80');var _0x3522f4=_0x2ba043[_0x13a0('0x46')]['customer']||util[_0x13a0('0x76')](_0x13a0('0x81'),'Visitor',_0x181f08['ContactId']);switch(_0x5466a1[_0x13a0('0x82')]){case _0x13a0('0x83'):_0x2b40f1=_0x181f08['UserId']?util[_0x13a0('0x76')](_0x13a0('0x81'),_0x5466a1[_0x13a0('0x7f')],_0x181f08['UserId']):_0x13a0('0x80');break;case _0x13a0('0x84'):_0x2b40f1=_0x181f08[_0x13a0('0x64')]?_0x181f08[_0x13a0('0x7b')][_0x13a0('0x85')]||_0x181f08['User'][_0x13a0('0x4d')]:_0x13a0('0x80');break;case'agent_fullname':_0x2b40f1=_0x181f08[_0x13a0('0x64')]?_0x181f08[_0x13a0('0x7b')][_0x13a0('0x4d')]:_0x13a0('0x80');break;default:_0x2b40f1=_0x181f08[_0x13a0('0x64')]?util[_0x13a0('0x76')]('%s%d',_0x5466a1[_0x13a0('0x7f')],_0x181f08[_0x13a0('0x64')]):'System';}var _0x3d1e1f=util['format'](_0x13a0('0x86'),moment(_0x181f08[_0x13a0('0x87')])[_0x13a0('0x76')](_0x13a0('0x88')),_0x181f08[_0x13a0('0x89')]==='in'?_0x3522f4:_0x2b40f1,_0x181f08[_0x13a0('0x46')]);if(!_0x181f08[_0x13a0('0x8a')]){fs[_0x13a0('0x8b')](_0x1166a5,_0x3d1e1f);}}return db['MailAccount'][_0x13a0('0x49')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x13a0('0x13')](function(_0x9d9aa8){if(!_0x9d9aa8||!_0x9d9aa8[_0x13a0('0x8c')]||!_0x2ba043[_0x13a0('0x46')])return _0x1be34f;var _0x345d9e=_0x9d9aa8[_0x13a0('0x8d')]();return respondWithRpcPromise(_0x13a0('0x8e'),_0x13a0('0x8f'),{'account':_0x345d9e,'message':{'from':util['format'](_0x13a0('0x90'),_0x9d9aa8[_0x13a0('0x2b')],_0x9d9aa8['email']||_0x9d9aa8['Smtp'][_0x13a0('0x39')]),'to':_0x2ba043[_0x13a0('0x46')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util['format'](_0x13a0('0x91'),_0x2ba043[_0x13a0('0x46')][_0x13a0('0x75')]),'attachments':[{'path':_0x1166a5}]}})[_0x13a0('0x13')](function(){return _0x1be34f;})['catch'](function(_0x337abe){logger[_0x13a0('0x1a')](_0x337abe);});})[_0x13a0('0x13')](respondWithStatusCode(_0x2a86c3,0xc8))['catch'](handleError(_0x2a86c3,null));};exports['addMessage']=function(_0xa95053,_0x2ed4fd){return db[_0x13a0('0x5c')]['find']({'where':{'id':_0xa95053[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0x2ed4fd,null))[_0x13a0('0x13')](function(_0x17da83){if(_0x17da83){return _0x17da83[_0x13a0('0x92')](_0xa95053[_0x13a0('0x46')][_0x13a0('0x93')],_[_0x13a0('0x94')](_0xa95053['body'],[_0x13a0('0x93'),'id'])||{});}})['then'](respondWithResult(_0x2ed4fd,null))['catch'](handleError(_0x2ed4fd,null));};exports[_0x13a0('0x95')]=function(_0xd6268,_0x19cb49){var _0x5c6e8b={'raw':![],'where':{}};var _0x3b8e87={};var _0x249d1c={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x13a0('0x49')]({'where':{'id':_0xd6268['params']['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0x19cb49,null))['then'](function(_0xbafd5a){if(_0xbafd5a){_0x3b8e87[_0x13a0('0x3d')]=_[_0x13a0('0x3b')](db[_0x13a0('0x5c')]['rawAttributes']);_0x3b8e87[_0x13a0('0x38')]=_[_0x13a0('0x3b')](_0xd6268[_0x13a0('0x38')]);_0x3b8e87[_0x13a0('0x96')]=_['intersection'](_0x3b8e87['model'],_0x3b8e87[_0x13a0('0x38')]);_0x5c6e8b[_0x13a0('0x3e')]=_[_0x13a0('0x3c')](_0x3b8e87['model'],qs[_0x13a0('0x3f')](_0xd6268[_0x13a0('0x38')]['fields']));_0x5c6e8b['attributes']=_0x5c6e8b[_0x13a0('0x3e')][_0x13a0('0x40')]?_0x5c6e8b[_0x13a0('0x3e')]:_0x3b8e87[_0x13a0('0x3d')];if(!_0xd6268[_0x13a0('0x38')]['hasOwnProperty']('nolimit')){_0x5c6e8b[_0x13a0('0x25')]=qs[_0x13a0('0x25')](_0xd6268[_0x13a0('0x38')][_0x13a0('0x25')]);_0x5c6e8b['offset']=qs['offset'](_0xd6268[_0x13a0('0x38')]['offset']);}_0x5c6e8b[_0x13a0('0x97')]=qs['sort'](_0xd6268[_0x13a0('0x38')][_0x13a0('0x98')]);_0x5c6e8b[_0x13a0('0x99')]=qs['filters'](_[_0x13a0('0x9a')](_0xd6268['query'],_0x3b8e87[_0x13a0('0x96')]));_0x5c6e8b[_0x13a0('0x99')][_0x13a0('0x9b')]=_0xbafd5a['id'];if(_0xd6268['query'][_0x13a0('0x9c')]){_0x5c6e8b[_0x13a0('0x99')]=_[_0x13a0('0x2e')](_0x5c6e8b[_0x13a0('0x99')],{'$or':_[_0x13a0('0x9d')](_0x5c6e8b[_0x13a0('0x3e')],function(_0x371672){var _0x1888a3={};_0x1888a3[_0x371672]={'$like':'%'+_0xd6268['query']['filter']+'%'};return _0x1888a3;})});}if(_0xd6268['query'][_0x13a0('0x9e')]){var _0x3936d2=_0xd6268[_0x13a0('0x38')][_0x13a0('0x9e')][_0x13a0('0x9f')](',');var _0x27693b={};_0x27693b[_0x3936d2[0x0]]={'$gte':moment(_0x3936d2[0x1])['format'](_0x13a0('0xa0'))};_0x5c6e8b['where']=_[_0x13a0('0x2e')](_0x5c6e8b[_0x13a0('0x99')],_0x27693b);}_0x5c6e8b=_[_0x13a0('0x2e')]({},_0x5c6e8b,_0xd6268[_0x13a0('0x43')]);return db['ChatMessage']['count']({'where':_0x5c6e8b['where']})['then'](function(_0x16244b){_0x249d1c[_0x13a0('0x24')]=_0x16244b;if(_0xd6268[_0x13a0('0x38')][_0x13a0('0x41')]){_0x5c6e8b[_0x13a0('0x42')]=[{'all':!![]}];}return db[_0x13a0('0x5c')][_0x13a0('0x36')](_0x5c6e8b);})[_0x13a0('0x13')](function(_0x146200){_0x249d1c[_0x13a0('0xa1')]=_0x146200;return _0x249d1c;});}})[_0x13a0('0x13')](respondWithFilteredResult(_0x19cb49,_0x5c6e8b))[_0x13a0('0x1d')](handleError(_0x19cb49,null));};exports['getMyMessages']=function(_0x5dc376,_0x107b1f){var _0x5c0f8b={'where':{}},_0xe3f784={},_0x35e40b={'count':0x0,'rows':[]};return db[_0x13a0('0x32')][_0x13a0('0x49')]({'where':{'id':_0x5dc376[_0x13a0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x107b1f,null))[_0x13a0('0x13')](function(_0x52f496){if(_0x52f496){_0xe3f784[_0x13a0('0x3d')]=_[_0x13a0('0x3b')](db[_0x13a0('0x5c')][_0x13a0('0x33')]);_0xe3f784[_0x13a0('0x38')]=_[_0x13a0('0x3b')](_0x5dc376['query']);_0xe3f784[_0x13a0('0x96')]=_[_0x13a0('0x3c')](_0xe3f784[_0x13a0('0x3d')],_0xe3f784[_0x13a0('0x38')]);_0x5c0f8b['attributes']=_[_0x13a0('0x3c')](_0xe3f784[_0x13a0('0x3d')],qs[_0x13a0('0x3f')](_0x5dc376[_0x13a0('0x38')][_0x13a0('0x3f')]));_0x5c0f8b[_0x13a0('0x3e')]=_0x5c0f8b[_0x13a0('0x3e')]['length']?_0x5c0f8b[_0x13a0('0x3e')]:_0xe3f784[_0x13a0('0x3d')];if(!_0x5dc376[_0x13a0('0x38')][_0x13a0('0xa2')]('nolimit')){_0x5c0f8b[_0x13a0('0x25')]=qs[_0x13a0('0x25')](_0x5dc376['query'][_0x13a0('0x25')]);_0x5c0f8b[_0x13a0('0x22')]=qs[_0x13a0('0x22')](_0x5dc376[_0x13a0('0x38')]['offset']);}_0x5c0f8b[_0x13a0('0x97')]=qs[_0x13a0('0x98')](_0x5dc376['query']['sort']);_0x5c0f8b[_0x13a0('0x99')]=qs[_0x13a0('0x96')](_[_0x13a0('0x9a')](_0x5dc376[_0x13a0('0x38')],_0xe3f784['filters']));_0x5c0f8b[_0x13a0('0x99')]['ChatInteractionId']=_0x52f496['id'];if(_0x5dc376[_0x13a0('0x38')][_0x13a0('0x9c')]){_0x5c0f8b['where']=_[_0x13a0('0x2e')](_0x5c0f8b[_0x13a0('0x99')],{'$or':_[_0x13a0('0x9d')](_0x5c0f8b[_0x13a0('0x3e')],function(_0x285aaf){var _0xc9b210={};_0xc9b210[_0x285aaf]={'$like':'%'+_0x5dc376[_0x13a0('0x38')][_0x13a0('0x9c')]+'%'};return _0xc9b210;})});}_0x5c0f8b[_0x13a0('0x99')]['secret']=![];if(_0x5dc376[_0x13a0('0x38')]['id']){_0x5c0f8b[_0x13a0('0x99')]['id']={'$gt':_0x5dc376['query']['id']};}_0x5c0f8b=_[_0x13a0('0x2e')]({},_0x5c0f8b,_0x5dc376['options']);return db[_0x13a0('0x5c')][_0x13a0('0x24')]({'where':_0x5c0f8b[_0x13a0('0x99')]})[_0x13a0('0x13')](function(_0x2e4fe0){_0x35e40b[_0x13a0('0x24')]=_0x2e4fe0;_0x5c0f8b[_0x13a0('0x42')]=[];if(_0x5dc376['query'][_0x13a0('0xa3')]){_0x5c0f8b['include']['push']({'model':db[_0x13a0('0x7b')],'as':_0x13a0('0x7b'),'attributes':['id','fullname',_0x13a0('0x85')]});}if(_0x5dc376[_0x13a0('0x38')][_0x13a0('0x41')]){_0x5c0f8b[_0x13a0('0x42')]=[{'all':!![]}];}return db[_0x13a0('0x5c')][_0x13a0('0x36')](_0x5c0f8b);})[_0x13a0('0x13')](function(_0x46149a){_0x35e40b['rows']=_0x46149a;return _0x35e40b;});}})['then'](respondWithFilteredResult(_0x107b1f,_0x5c0f8b))['catch'](handleError(_0x107b1f,null));};exports[_0x13a0('0xa4')]=function(_0x5d9ffd,_0x1dd539){return db[_0x13a0('0x32')][_0x13a0('0x44')]({'where':{'id':_0x5d9ffd[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0x1dd539,null))['then'](function(_0x3a65d6){if(_0x3a65d6){return _0x3a65d6[_0x13a0('0xa5')](_0x5d9ffd['body'][_0x13a0('0x93')],_[_0x13a0('0x94')](_0x5d9ffd[_0x13a0('0x46')],['ids','id'])||{})[_0x13a0('0xa6')](function(){return db['Tag'][_0x13a0('0x36')]({'attributes':['id',_0x13a0('0x2b'),_0x13a0('0xa7')],'where':{'id':_0x5d9ffd[_0x13a0('0x46')][_0x13a0('0x93')]}});})[_0x13a0('0x13')](function(_0x3ad0fa){socket[_0x13a0('0xa8')](_0x13a0('0xa9'),{'id':Number(_0x5d9ffd[_0x13a0('0x3a')]['id']),'tags':_0x3ad0fa||[]});return{'id':Number(_0x5d9ffd[_0x13a0('0x3a')]['id']),'tags':_0x3ad0fa||[]};});}})['then'](respondWithResult(_0x1dd539,null))[_0x13a0('0x1d')](handleError(_0x1dd539,null));};exports[_0x13a0('0xaa')]=function(_0x20ca90,_0x4a46fd){return db['ChatInteraction'][_0x13a0('0x44')]({'where':{'id':_0x20ca90[_0x13a0('0x3a')]['id']}})[_0x13a0('0x13')](handleEntityNotFound(_0x4a46fd,null))[_0x13a0('0x13')](function(_0x205e3b){if(_0x205e3b){return _0x205e3b['removeTags'](_0x20ca90[_0x13a0('0x38')]['ids']);}})[_0x13a0('0x13')](respondWithStatusCode(_0x4a46fd,null))[_0x13a0('0x1d')](handleError(_0x4a46fd,null));};exports[_0x13a0('0x73')]=function(_0x1e58fa,_0x2854a0){var _0x414257=moment()[_0x13a0('0xab')]()[_0x13a0('0xac')]();var _0x17f996=path[_0x13a0('0x6f')](config[_0x13a0('0x70')],_0x13a0('0xad'),'files',_0x13a0('0xae'));var _0x1c478b=path[_0x13a0('0x6f')](config[_0x13a0('0x70')],_0x13a0('0xad'),'files',_0x13a0('0xaf'));var _0x1e8f77=path['join'](_0x17f996,_0x414257);var _0x16fa6a=util[_0x13a0('0x76')](_0x13a0('0xb0'),_0x1e58fa[_0x13a0('0x3a')]['id'],_0x414257);var _0x93c21f=path[_0x13a0('0x6f')](_0x17f996,_0x16fa6a);var _0x45e34c=[];_0x45e34c['push']({'model':db[_0x13a0('0x7b')],'as':_0x13a0('0x7b'),'attributes':['id',_0x13a0('0x4d')],'raw':!![]});_0x45e34c[_0x13a0('0xb1')]({'model':db[_0x13a0('0x60')],'as':'Contact','attributes':['id',_0x13a0('0xb2'),_0x13a0('0xb3')],'raw':!![]});if(_0x1e58fa[_0x13a0('0x38')][_0x13a0('0xaf')]){_0x45e34c[_0x13a0('0xb1')]({'model':db[_0x13a0('0x6a')],'as':'Attachment','raw':!![]});}var _0x515f63=[{'model':db[_0x13a0('0x5c')],'as':_0x13a0('0x7a'),'attributes':['id','body',_0x13a0('0x87'),_0x13a0('0x89'),_0x13a0('0x8a'),_0x13a0('0xb4')],'include':_0x45e34c}];_0x515f63[_0x13a0('0xb1')]({'model':db[_0x13a0('0x7c')],'as':_0x13a0('0xb5'),'attributes':['id',_0x13a0('0x2b')]});_0x515f63[_0x13a0('0xb1')]({'model':db[_0x13a0('0x7b')],'as':_0x13a0('0xb6'),'attributes':['id',_0x13a0('0x4d')]});return db[_0x13a0('0x32')]['find']({'where':{'id':_0x1e58fa[_0x13a0('0x3a')]['id']},'include':_0x515f63})[_0x13a0('0x13')](handleEntityNotFound(_0x2854a0,null))['then'](function(_0x40f897){if(_0x40f897){var _0x17168b=_0x40f897['get']({'plain':!![]});fs['mkdirSync'](_0x1e8f77);var _0x2f3252={'channel':_0x13a0('0xb7'),'account':_0x17168b[_0x13a0('0xb5')][_0x13a0('0x2b')],'agent':_0x17168b['Owner']?_0x17168b[_0x13a0('0xb6')]['fullname']:_0x13a0('0xb8'),'createdAt':moment(_0x17168b[_0x13a0('0x87')])[_0x13a0('0x76')](_0x13a0('0xa0'))['toString'](),'closedAt':_0x17168b[_0x13a0('0x6c')]?moment(_0x17168b[_0x13a0('0xb9')])[_0x13a0('0x76')](_0x13a0('0xa0'))[_0x13a0('0xac')]():'','disposition':_0x17168b['disposition'],'chatInfo':{'browser':_0x17168b[_0x13a0('0xba')],'os':_0x17168b[_0x13a0('0xbb')],'referer':_0x17168b[_0x13a0('0xbc')],'customerIp':_0x17168b[_0x13a0('0xbd')],'customerPort':_0x17168b['customerPort']?_0x17168b[_0x13a0('0xbe')]:_0x13a0('0xb8')},'messages':_(_0x17168b[_0x13a0('0x7a')])[_0x13a0('0xbf')]()[_0x13a0('0x9c')]({'secret':![]})[_0x13a0('0x9d')](function(_0x2dda2d){if(_0x2dda2d[_0x13a0('0x6a')]){var _0x26c424=path[_0x13a0('0x6f')](_0x1c478b,_0x2dda2d[_0x13a0('0x6a')][_0x13a0('0xc0')]);if(fs[_0x13a0('0xc1')](_0x26c424)){fs[_0x13a0('0xc2')](_0x26c424)[_0x13a0('0xc3')](fs[_0x13a0('0xc4')](path['join'](_0x1e8f77,_0x2dda2d[_0x13a0('0x6a')][_0x13a0('0xc0')])));}}return{'date':moment(_0x2dda2d[_0x13a0('0x87')])[_0x13a0('0x76')](_0x13a0('0xa0'))['toString'](),'sender':_0x2dda2d[_0x13a0('0x89')]===_0x13a0('0x5b')?_0x2dda2d[_0x13a0('0x7b')]?_0x2dda2d['User'][_0x13a0('0x4d')]:'System':_0x2dda2d['Contact'][_0x13a0('0xb2')]+(_0x2dda2d[_0x13a0('0x61')][_0x13a0('0xb3')]?'\x20'+_0x2dda2d[_0x13a0('0x61')][_0x13a0('0xb3')]:''),'body':_0x2dda2d[_0x13a0('0x6a')]?_0x2dda2d[_0x13a0('0x6a')][_0x13a0('0xc0')]:_0x2dda2d[_0x13a0('0x46')],'direction':_0x2dda2d[_0x13a0('0x89')]==='out'?'A':'C','secret':_0x2dda2d[_0x13a0('0x8a')],'read':_0x2dda2d['read'],'attachment':_0x2dda2d['Attachment']};})[_0x13a0('0xc5')]()};return ejs[_0x13a0('0xc6')](path['join'](config['root'],'server',_0x13a0('0xc7'),'downloadInteraction.ejs'),{'interaction':_0x2f3252})['then'](function(_0x3926a7){var _0xfe5f81=path[_0x13a0('0x6f')](_0x1e8f77,_0x13a0('0xc8')+_0x17168b['id']+'-'+_0x414257+_0x13a0('0xc9'));var _0x2b5697={'path':_0xfe5f81,'channel':'Chat','interactionId':_0x17168b['id']};return pdf[_0x13a0('0xca')](_0x3926a7,_0x2b5697);})['then'](function(){return new Promise(function(_0x153da8,_0x390cb2){zipdir(_0x1e8f77,{'saveTo':_0x93c21f},function(_0x4a67ee,_0x572e31){if(_0x4a67ee)return _0x390cb2(_0x4a67ee);return _0x153da8(_0x572e31);});})[_0x13a0('0x13')](function(){return new BPromise(function(_0x82152e,_0x3494d3){rimraf(_0x1e8f77,function(_0x38f833){if(_0x38f833)_0x3494d3(_0x38f833);return _0x82152e();});});})[_0x13a0('0x13')](function(){return _0x2854a0[_0x13a0('0x73')](_0x93c21f,_0x16fa6a,function(_0x458a04){if(_0x458a04){logger[_0x13a0('0x1a')](_0x13a0('0xcb'),_0x458a04);}else{fs[_0x13a0('0xcc')](_0x93c21f);}});});});}else{return _0x2854a0['sendStatus'](0xc8);}})[_0x13a0('0x1d')](handleError(_0x2854a0,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 29392b8..3756919 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 _0x25b0=['Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x25b0,0x171));var _0x025b=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x25b0[_0x2fdce0];return _0x36f07e;};'use strict';var EventEmitter=require(_0x025b('0x0'));var ChatInteraction=require(_0x025b('0x1'))['db'][_0x025b('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x025b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x025b('0x4')](0x0);var events={'afterCreate':_0x025b('0x5'),'afterUpdate':_0x025b('0x6'),'afterDestroy':_0x025b('0x7')};function emitEvent(_0x3faa4a){return function(_0x30b4f8,_0x4daa26,_0x48ea27){_0x30b4f8[_0x025b('0x8')]({'attributes':['id'],'raw':!![]})[_0x025b('0x9')](function(_0x20866b){_0x30b4f8[_0x025b('0xa')](_0x025b('0xb'),_0x20866b[_0x025b('0xc')](function(_0x58d850){return{'id':_0x58d850['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x30b4f8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x33866e){_0x30b4f8[_0x025b('0xa')](_0x025b('0xd'),_0x33866e[_0x025b('0xe')]);ChatInteractionEvents[_0x025b('0xf')](_0x3faa4a+':'+_0x30b4f8['id'],_0x30b4f8);ChatInteractionEvents['emit'](_0x3faa4a,_0x30b4f8);_0x48ea27(null);})[_0x025b('0x10')](_0x48ea27(null));};}for(var e in events){if(events[_0x025b('0x11')](e)){var event=events[e];ChatInteraction[_0x025b('0x12')](e,emitEvent(event));}}module[_0x025b('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x0a42=['setDataValue','unreadMessages','length','emit','catch','events','../../mysqldb','ChatMessage','setMaxListeners','remove','getUsers','then','Users','map','findAll'];(function(_0x5affdd,_0xe6a38d){var _0xbbf06=function(_0x5ec3cf){while(--_0x5ec3cf){_0x5affdd['push'](_0x5affdd['shift']());}};_0xbbf06(++_0xe6a38d);}(_0x0a42,0x18b));var _0x20a4=function(_0x9a5233,_0x5a24f8){_0x9a5233=_0x9a5233-0x0;var _0x1185a8=_0x0a42[_0x9a5233];return _0x1185a8;};'use strict';var EventEmitter=require(_0x20a4('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x20a4('0x1'))['db'][_0x20a4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x20a4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x20a4('0x4')};function emitEvent(_0x3bb8ec){return function(_0x5504a3,_0x22801d,_0xdf5a5e){_0x5504a3[_0x20a4('0x5')]({'attributes':['id'],'raw':!![]})[_0x20a4('0x6')](function(_0x6f41ee){_0x5504a3['setDataValue'](_0x20a4('0x7'),_0x6f41ee[_0x20a4('0x8')](function(_0x4d968c){return{'id':_0x4d968c['id']};}));return ChatMessage[_0x20a4('0x9')]({'where':{'ChatInteractionId':_0x5504a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x20a4('0x6')](function(_0x135ee7){_0x5504a3[_0x20a4('0xa')](_0x20a4('0xb'),_0x135ee7[_0x20a4('0xc')]);ChatInteractionEvents['emit'](_0x3bb8ec+':'+_0x5504a3['id'],_0x5504a3);ChatInteractionEvents[_0x20a4('0xd')](_0x3bb8ec,_0x5504a3);_0xdf5a5e(null);})[_0x20a4('0xe')](_0xdf5a5e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1ca8484..ac63f93 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 _0x0c61=['bluebird','request-promise','path','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x4e471c,_0x59adec){var _0x3bcb52=function(_0x48aa67){while(--_0x48aa67){_0x4e471c['push'](_0x4e471c['shift']());}};_0x3bcb52(++_0x59adec);}(_0x0c61,0xfd));var _0x10c6=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x0c61[_0x33554b];return _0x256954;};'use strict';var _=require(_0x10c6('0x0'));var util=require('util');var logger=require(_0x10c6('0x1'))(_0x10c6('0x2'));var moment=require('moment');var BPromise=require(_0x10c6('0x3'));var rp=require(_0x10c6('0x4'));var fs=require('fs');var path=require(_0x10c6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10c6('0x6'));module[_0x10c6('0x7')]=function(_0x520de2,_0x5eb94c){return _0x520de2[_0x10c6('0x8')](_0x10c6('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2578c7,_0x45312f,_0x4f58f6){if(_0x2578c7[_0x10c6('0xa')](_0x10c6('0xb'))){_0x2578c7[_0x10c6('0xc')]=moment()[_0x10c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f58f6(null,_0x2578c7);}},'charset':_0x10c6('0xe'),'collate':_0x10c6('0xf')});}; \ No newline at end of file +var _0xf52f=['ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0xedf695,_0x40a10e){var _0x40ceda=function(_0x6e3a9a){while(--_0x6e3a9a){_0xedf695['push'](_0xedf695['shift']());}};_0x40ceda(++_0x40a10e);}(_0xf52f,0x1b2));var _0xff52=function(_0x1f8a2a,_0x906b0f){_0x1f8a2a=_0x1f8a2a-0x0;var _0x4dcaa7=_0xf52f[_0x1f8a2a];return _0x4dcaa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff52('0x0'))('api');var moment=require(_0xff52('0x1'));var BPromise=require('bluebird');var rp=require(_0xff52('0x2'));var fs=require('fs');var path=require(_0xff52('0x3'));var rimraf=require('rimraf');var config=require(_0xff52('0x4'));var attributes=require(_0xff52('0x5'));module[_0xff52('0x6')]=function(_0x32ca50,_0x18e315){return _0x32ca50[_0xff52('0x7')](_0xff52('0x8'),attributes,{'tableName':_0xff52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x308647,_0x4a4050,_0x9f0bde){if(_0x308647[_0xff52('0xa')](_0xff52('0xb'))){_0x308647[_0xff52('0xc')]=moment()[_0xff52('0xd')](_0xff52('0xe'));}_0x9f0bde(null,_0x308647);}},'charset':_0xff52('0xf'),'collate':_0xff52('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0e2c9c9..0b9fcec 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 _0x31ce=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','code','error','message','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','addTags','omit','AddTags','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x31ce,0xaf));var _0xe31c=function(_0x18daeb,_0x1b8ff3){_0x18daeb=_0x18daeb-0x0;var _0x425a30=_0x31ce[_0x18daeb];return _0x425a30;};'use strict';var _=require('lodash');var util=require(_0xe31c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe31c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe31c('0x2'))['db'];var utils=require(_0xe31c('0x3'));var logger=require(_0xe31c('0x4'))(_0xe31c('0x5'));var config=require(_0xe31c('0x6'));var jayson=require(_0xe31c('0x7'));var client=jayson[_0xe31c('0x8')][_0xe31c('0x9')]({'port':0x232a});config[_0xe31c('0xa')]=_[_0xe31c('0xb')](config[_0xe31c('0xa')],{'host':_0xe31c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe31c('0xa')]));require(_0xe31c('0xd'))[_0xe31c('0xe')](socket);function respondWithRpcPromise(_0x367b1b,_0x29ee72,_0x43dc29){return new BPromise(function(_0x193258,_0x2b8a19){return client['request'](_0x367b1b,_0x43dc29)[_0xe31c('0xf')](function(_0x219d3b){logger[_0xe31c('0x10')](_0xe31c('0x11'),_0x29ee72,'request\x20sent');logger[_0xe31c('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x29ee72,_0xe31c('0x13'),JSON['stringify'](_0x219d3b));if(_0x219d3b['error']){if(_0x219d3b['error'][_0xe31c('0x14')]===0x1f4){logger['error'](_0xe31c('0x11'),_0x29ee72,_0x219d3b[_0xe31c('0x15')][_0xe31c('0x16')]);return _0x2b8a19(_0x219d3b[_0xe31c('0x15')][_0xe31c('0x16')]);}logger[_0xe31c('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x29ee72,_0x219d3b[_0xe31c('0x15')]['message']);return _0x193258(_0x219d3b[_0xe31c('0x15')]['message']);}else{logger[_0xe31c('0x10')](_0xe31c('0x11'),_0x29ee72,'request\x20sent');_0x193258(_0x219d3b['result']['message']);}})[_0xe31c('0x17')](function(_0x3069ab){logger[_0xe31c('0x15')](_0xe31c('0x11'),_0x29ee72,_0x3069ab);_0x2b8a19(_0x3069ab);});});}exports[_0xe31c('0x18')]=function(_0x10e673){var _0x55587b=this;return new Promise(function(_0x39a8bf,_0x2bae8c){return db['ChatInteraction'][_0xe31c('0x19')](_0x10e673[_0xe31c('0x1a')],{'raw':_0x10e673[_0xe31c('0x1b')]?_0x10e673[_0xe31c('0x1b')][_0xe31c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e673[_0xe31c('0x1b')]?_0x10e673[_0xe31c('0x1b')][_0xe31c('0x1d')]||null:null,'attributes':_0x10e673[_0xe31c('0x1b')]?_0x10e673['options'][_0xe31c('0x1e')]||null:null,'limit':_0x10e673[_0xe31c('0x1b')]?_0x10e673[_0xe31c('0x1b')][_0xe31c('0x1f')]||null:null})[_0xe31c('0xf')](function(_0x2acb60){logger[_0xe31c('0x10')](_0xe31c('0x18'),_0x10e673);logger[_0xe31c('0x12')](_0xe31c('0x18'),_0x10e673,JSON['stringify'](_0x2acb60));_0x39a8bf(_0x2acb60);})['catch'](function(_0x345ae2){logger[_0xe31c('0x15')](_0xe31c('0x18'),_0x345ae2['message'],_0x10e673);_0x2bae8c(_0x55587b[_0xe31c('0x15')](0x1f4,_0x345ae2[_0xe31c('0x16')]));});});};exports[_0xe31c('0x20')]=function(_0x139e53){return new Promise(function(_0x37abd6,_0x2a7f47){return db['ChatInteraction']['find']({'where':_0x139e53[_0xe31c('0x1b')]?_0x139e53['options']['where']||null:null})[_0xe31c('0xf')](function(_0x210006){if(_0x210006){return _0x210006[_0xe31c('0x21')](_0x139e53[_0xe31c('0x1a')]['ids'],_[_0xe31c('0x22')](_0x139e53[_0xe31c('0x1a')],['ids','id'])||{});}})['spread'](function(_0x31e51d){logger[_0xe31c('0x10')]('AddTags',_0x139e53);logger[_0xe31c('0x12')](_0xe31c('0x23'),_0x139e53,JSON['stringify'](_0x31e51d));_0x37abd6(_0x31e51d);})['catch'](function(_0x478a7d){logger[_0xe31c('0x15')]('AddTags',_0x478a7d[_0xe31c('0x16')],_0x139e53);_0x2a7f47(_this[_0xe31c('0x15')](0x1f4,_0x478a7d['message']));});});}; \ No newline at end of file +var _0x2cb9=['AddTags','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','request','then','request\x20sent','debug','code','ChatInteraction,\x20%s,\x20%s','error','message','info','result','ChatInteraction','options','raw','where','attributes','UpdateChatInteraction','catch','AddTagsToChatInteraction','find','body','omit'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x2cb9,0xb1));var _0x92cb=function(_0x5788c6,_0x1c4789){_0x5788c6=_0x5788c6-0x0;var _0x106973=_0x2cb9[_0x5788c6];return _0x106973;};'use strict';var _=require(_0x92cb('0x0'));var util=require(_0x92cb('0x1'));var moment=require(_0x92cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x92cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x92cb('0x4'));var logger=require(_0x92cb('0x5'))(_0x92cb('0x6'));var config=require(_0x92cb('0x7'));var jayson=require(_0x92cb('0x8'));var client=jayson['client'][_0x92cb('0x9')]({'port':0x232a});config[_0x92cb('0xa')]=_['defaults'](config[_0x92cb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x92cb('0xb'))(new Redis(config[_0x92cb('0xa')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x39e96b,_0x3bbd97,_0x27fb4a){return new BPromise(function(_0x5d08f6,_0x1bffb4){return client[_0x92cb('0xc')](_0x39e96b,_0x27fb4a)[_0x92cb('0xd')](function(_0x2767a1){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3bbd97,_0x92cb('0xe'));logger[_0x92cb('0xf')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3bbd97,_0x92cb('0xe'),JSON['stringify'](_0x2767a1));if(_0x2767a1['error']){if(_0x2767a1['error'][_0x92cb('0x10')]===0x1f4){logger['error'](_0x92cb('0x11'),_0x3bbd97,_0x2767a1[_0x92cb('0x12')][_0x92cb('0x13')]);return _0x1bffb4(_0x2767a1[_0x92cb('0x12')][_0x92cb('0x13')]);}logger[_0x92cb('0x12')](_0x92cb('0x11'),_0x3bbd97,_0x2767a1[_0x92cb('0x12')][_0x92cb('0x13')]);return _0x5d08f6(_0x2767a1[_0x92cb('0x12')][_0x92cb('0x13')]);}else{logger[_0x92cb('0x14')](_0x92cb('0x11'),_0x3bbd97,'request\x20sent');_0x5d08f6(_0x2767a1[_0x92cb('0x15')][_0x92cb('0x13')]);}})['catch'](function(_0x485a4d){logger[_0x92cb('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x3bbd97,_0x485a4d);_0x1bffb4(_0x485a4d);});});}exports['UpdateChatInteraction']=function(_0x2023c1){var _0x4b303c=this;return new Promise(function(_0x4a0200,_0xff2ea){return db[_0x92cb('0x16')]['update'](_0x2023c1['body'],{'raw':_0x2023c1[_0x92cb('0x17')]?_0x2023c1[_0x92cb('0x17')][_0x92cb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2023c1[_0x92cb('0x17')]?_0x2023c1[_0x92cb('0x17')][_0x92cb('0x19')]||null:null,'attributes':_0x2023c1['options']?_0x2023c1[_0x92cb('0x17')][_0x92cb('0x1a')]||null:null,'limit':_0x2023c1[_0x92cb('0x17')]?_0x2023c1[_0x92cb('0x17')]['limit']||null:null})[_0x92cb('0xd')](function(_0x57dc51){logger[_0x92cb('0x14')](_0x92cb('0x1b'),_0x2023c1);logger[_0x92cb('0xf')](_0x92cb('0x1b'),_0x2023c1,JSON['stringify'](_0x57dc51));_0x4a0200(_0x57dc51);})[_0x92cb('0x1c')](function(_0x5e75c0){logger[_0x92cb('0x12')](_0x92cb('0x1b'),_0x5e75c0[_0x92cb('0x13')],_0x2023c1);_0xff2ea(_0x4b303c[_0x92cb('0x12')](0x1f4,_0x5e75c0[_0x92cb('0x13')]));});});};exports[_0x92cb('0x1d')]=function(_0x14cdcf){return new Promise(function(_0x25deaa,_0xafc9fa){return db[_0x92cb('0x16')][_0x92cb('0x1e')]({'where':_0x14cdcf[_0x92cb('0x17')]?_0x14cdcf[_0x92cb('0x17')][_0x92cb('0x19')]||null:null})['then'](function(_0x1d79aa){if(_0x1d79aa){return _0x1d79aa['addTags'](_0x14cdcf[_0x92cb('0x1f')]['ids'],_[_0x92cb('0x20')](_0x14cdcf['body'],['ids','id'])||{});}})['spread'](function(_0x493a10){logger[_0x92cb('0x14')]('AddTags',_0x14cdcf);logger[_0x92cb('0xf')](_0x92cb('0x21'),_0x14cdcf,JSON[_0x92cb('0x22')](_0x493a10));_0x25deaa(_0x493a10);})[_0x92cb('0x1c')](function(_0x4efc79){logger[_0x92cb('0x12')](_0x92cb('0x21'),_0x4efc79[_0x92cb('0x13')],_0x14cdcf);_0xafc9fa(_this['error'](0x1f4,_0x4efc79[_0x92cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b518ad6..a10ff8d 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 _0xf12b=['save','update','emit','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x2040e3,_0x58adb2){var _0x781add=function(_0x4b0423){while(--_0x4b0423){_0x2040e3['push'](_0x2040e3['shift']());}};_0x781add(++_0x58adb2);}(_0xf12b,0x133));var _0xbf12=function(_0x414a4e,_0x2441b2){_0x414a4e=_0x414a4e-0x0;var _0x5e4e15=_0xf12b[_0x414a4e];return _0x5e4e15;};'use strict';var ChatInteractionEvents=require(_0xbf12('0x0'));var events=[_0xbf12('0x1'),'remove',_0xbf12('0x2')];function createListener(_0x1ca3a9,_0x2d3f25){return function(_0x559e65){_0x2d3f25[_0xbf12('0x3')](_0x1ca3a9,_0x559e65);};}function removeListener(_0x370724,_0x3a0949){return function(){ChatInteractionEvents[_0xbf12('0x4')](_0x370724,_0x3a0949);};}exports['register']=function(_0x2853ad){for(var _0x45d4ee=0x0,_0x4bd615=events[_0xbf12('0x5')];_0x45d4ee<_0x4bd615;_0x45d4ee++){var _0x4190c1=events[_0x45d4ee];var _0x1c26ca=createListener(_0xbf12('0x6')+_0x4190c1,_0x2853ad);ChatInteractionEvents['on'](_0x4190c1,_0x1c26ca);}}; \ No newline at end of file +var _0x68f8=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0x68f8,0x10c));var _0x868f=function(_0x1214d9,_0x2ef96b){_0x1214d9=_0x1214d9-0x0;var _0x482309=_0x68f8[_0x1214d9];return _0x482309;};'use strict';var ChatInteractionEvents=require(_0x868f('0x0'));var events=[_0x868f('0x1'),_0x868f('0x2'),_0x868f('0x3')];function createListener(_0x22b2e7,_0x1f4f09){return function(_0x4d894f){_0x1f4f09[_0x868f('0x4')](_0x22b2e7,_0x4d894f);};}function removeListener(_0x4f4e58,_0x22dae1){return function(){ChatInteractionEvents[_0x868f('0x5')](_0x4f4e58,_0x22dae1);};}exports[_0x868f('0x6')]=function(_0x37d706){for(var _0x3f7e54=0x0,_0x535a8e=events[_0x868f('0x7')];_0x3f7e54<_0x535a8e;_0x3f7e54++){var _0x3d14a9=events[_0x3f7e54];var _0x3cd26f=createListener(_0x868f('0x8')+_0x3d14a9,_0x37d706);ChatInteractionEvents['on'](_0x3d14a9,_0x3cd26f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c202e20..ad7b531 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 _0xfb8d=['addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xfb8d,0x19c));var _0xdfb8=function(_0x4b3547,_0x7898aa){_0x4b3547=_0x4b3547-0x0;var _0x1394c8=_0xfb8d[_0x4b3547];return _0x1394c8;};'use strict';var multer=require(_0xdfb8('0x0'));var util=require(_0xdfb8('0x1'));var path=require('path');var timeout=require(_0xdfb8('0x2'));var express=require('express');var router=express[_0xdfb8('0x3')]();var fs_extra=require(_0xdfb8('0x4'));var auth=require(_0xdfb8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdfb8('0x6'));var controller=require(_0xdfb8('0x7'));router['get']('/',auth[_0xdfb8('0x8')](),controller[_0xdfb8('0x9')]);router[_0xdfb8('0xa')](_0xdfb8('0xb'),auth[_0xdfb8('0x8')](),controller['describe']);router[_0xdfb8('0xa')](_0xdfb8('0xc'),auth[_0xdfb8('0xd')](),controller[_0xdfb8('0xe')]);router[_0xdfb8('0xa')](_0xdfb8('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0xdfb8('0x8')](),controller[_0xdfb8('0x10')]);router['get'](_0xdfb8('0x11'),auth[_0xdfb8('0xd')](),controller[_0xdfb8('0x12')]);router[_0xdfb8('0xa')](_0xdfb8('0x13'),auth['isAuthenticated'](),controller[_0xdfb8('0x14')]);router[_0xdfb8('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdfb8('0x15')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xdfb8('0x16')]);var upload=multer({'storage':multer[_0xdfb8('0x17')]({'destination':function(_0x3edb0d,_0x229d04,_0x3bc909){_0x3bc909(null,path[_0xdfb8('0x18')](config[_0xdfb8('0x19')],_0xdfb8('0x1a')));},'filename':function(_0x41a288,_0x466a5b,_0x5516ec){_0x5516ec(null,util['format'](_0xdfb8('0x1b'),Date[_0xdfb8('0x1c')](),_0x466a5b[_0xdfb8('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xdfb8('0x1e'),upload['single'](_0xdfb8('0x1f')),controller[_0xdfb8('0x20')]);router[_0xdfb8('0x15')](_0xdfb8('0x21'),auth['isChatInteractionAuthorized'](),controller[_0xdfb8('0x22')]);router[_0xdfb8('0x15')](_0xdfb8('0x23'),auth[_0xdfb8('0x8')](),interaction['tracked'](_0xdfb8('0x24'),_0xdfb8('0x25')),controller[_0xdfb8('0x26')]);router[_0xdfb8('0x27')]('/:id',auth[_0xdfb8('0x8')](),interaction[_0xdfb8('0x28')](_0xdfb8('0x24'),_0xdfb8('0x29')),controller[_0xdfb8('0x2a')]);router[_0xdfb8('0x27')](_0xdfb8('0x2b'),controller[_0xdfb8('0x2c')]);router[_0xdfb8('0x27')](_0xdfb8('0x2d'),auth[_0xdfb8('0xd')](),controller['abandon']);router[_0xdfb8('0x27')](_0xdfb8('0x2e'),controller['close']);router['delete'](_0xdfb8('0xc'),auth['isAuthenticated'](),interaction[_0xdfb8('0x28')](_0xdfb8('0x24'),'chatinteraction:destroy'),controller[_0xdfb8('0x2f')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xdfb8('0x30')]);module[_0xdfb8('0x31')]=router; \ No newline at end of file +var _0xf09f=['delete','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','update','/:id/custom_update','customUpdate','/:id/close','close','destroy'];(function(_0x1e868b,_0x3f6482){var _0x3a1c61=function(_0x51dc89){while(--_0x51dc89){_0x1e868b['push'](_0x1e868b['shift']());}};_0x3a1c61(++_0x3f6482);}(_0xf09f,0x1ed));var _0xff09=function(_0x372aba,_0x107bbe){_0x372aba=_0x372aba-0x0;var _0xf92f2d=_0xf09f[_0x372aba];return _0xf92f2d;};'use strict';var multer=require(_0xff09('0x0'));var util=require('util');var path=require(_0xff09('0x1'));var timeout=require(_0xff09('0x2'));var express=require(_0xff09('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xff09('0x4'));var interaction=require(_0xff09('0x5'));var config=require(_0xff09('0x6'));var controller=require(_0xff09('0x7'));router[_0xff09('0x8')]('/',auth['isAuthenticated'](),controller[_0xff09('0x9')]);router[_0xff09('0x8')](_0xff09('0xa'),auth[_0xff09('0xb')](),controller['describe']);router[_0xff09('0x8')](_0xff09('0xc'),auth[_0xff09('0xd')](),controller[_0xff09('0xe')]);router[_0xff09('0x8')]('/:id/attachment_download',auth[_0xff09('0xd')](),controller[_0xff09('0xf')]);router['get'](_0xff09('0x10'),auth[_0xff09('0xb')](),controller['getMessages']);router[_0xff09('0x8')]('/:id/my_messages',auth[_0xff09('0xd')](),controller[_0xff09('0x11')]);router[_0xff09('0x8')](_0xff09('0x12'),auth['isAuthenticated'](),controller[_0xff09('0x13')]);router[_0xff09('0x14')]('/',auth[_0xff09('0xb')](),controller[_0xff09('0x15')]);router[_0xff09('0x14')](_0xff09('0x16'),auth['isAuthenticated'](),controller[_0xff09('0x17')]);var upload=multer({'storage':multer[_0xff09('0x18')]({'destination':function(_0x5c83a6,_0x2364fe,_0x59df77){_0x59df77(null,path[_0xff09('0x19')](config[_0xff09('0x1a')],_0xff09('0x1b')));},'filename':function(_0x5cf3b2,_0x2e9b77,_0x47ce6b){_0x47ce6b(null,util[_0xff09('0x1c')](_0xff09('0x1d'),Date[_0xff09('0x1e')](),_0x2e9b77[_0xff09('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xff09('0x14')](_0xff09('0x20'),upload[_0xff09('0x21')]('file'),controller['attachmentUpload']);router[_0xff09('0x14')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xff09('0x14')](_0xff09('0x22'),auth[_0xff09('0xb')](),interaction['tracked'](_0xff09('0x23'),_0xff09('0x24')),controller[_0xff09('0x25')]);router[_0xff09('0x26')](_0xff09('0xc'),auth[_0xff09('0xb')](),interaction[_0xff09('0x27')](_0xff09('0x23'),'chatinteraction:update'),controller[_0xff09('0x28')]);router[_0xff09('0x26')](_0xff09('0x29'),controller[_0xff09('0x2a')]);router[_0xff09('0x26')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xff09('0x26')](_0xff09('0x2b'),controller[_0xff09('0x2c')]);router['delete'](_0xff09('0xc'),auth[_0xff09('0xb')](),interaction[_0xff09('0x27')](_0xff09('0x23'),'chatinteraction:destroy'),controller[_0xff09('0x2d')]);router[_0xff09('0x2e')](_0xff09('0x22'),auth[_0xff09('0xb')](),controller[_0xff09('0x2f')]);module[_0xff09('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 483aeac..4c50f23 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 _0xe250=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x598bbb,_0x3a78b6){var _0x16d8c3=function(_0x1d468d){while(--_0x1d468d){_0x598bbb['push'](_0x598bbb['shift']());}};_0x16d8c3(++_0x3a78b6);}(_0xe250,0xa2));var _0x0e25=function(_0x406254,_0x5bbe66){_0x406254=_0x406254-0x0;var _0x2d0d40=_0xe250[_0x406254];return _0x2d0d40;};'use strict';var Sequelize=require(_0x0e25('0x0'));module[_0x0e25('0x1')]={'body':{'type':Sequelize[_0x0e25('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0e25('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbf11=['sequelize','exports','medium','BOOLEAN'];(function(_0x50fb37,_0x2f0f72){var _0x1212ee=function(_0x4079b4){while(--_0x4079b4){_0x50fb37['push'](_0x50fb37['shift']());}};_0x1212ee(++_0x2f0f72);}(_0xbf11,0x1f4));var _0x1bf1=function(_0x5ae5f7,_0x57076b){_0x5ae5f7=_0x5ae5f7-0x0;var _0x190b76=_0xbf11[_0x5ae5f7];return _0x190b76;};'use strict';var Sequelize=require(_0x1bf1('0x0'));module[_0x1bf1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1bf1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1bf1('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9dd1f0b..8da8eac 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 _0x965f=['FromId','ToId','-createdAt','eml-format','zip-dir','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','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','then','destroy','error','name','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','length','options','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','User','agent','user','fullname','role','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','push'];(function(_0x285f75,_0x29a0fe){var _0x4da0d2=function(_0x471933){while(--_0x471933){_0x285f75['push'](_0x285f75['shift']());}};_0x4da0d2(++_0x29a0fe);}(_0x965f,0x13e));var _0xf965=function(_0x5e9b7e,_0x4b1959){_0x5e9b7e=_0x5e9b7e-0x0;var _0x2c03c6=_0x965f[_0x5e9b7e];return _0x2c03c6;};'use strict';var emlformat=require(_0xf965('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf965('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf965('0x2'));var moment=require(_0xf965('0x3'));var BPromise=require(_0xf965('0x4'));var Mustache=require(_0xf965('0x5'));var util=require(_0xf965('0x6'));var path=require(_0xf965('0x7'));var sox=require(_0xf965('0x8'));var csv=require(_0xf965('0x9'));var ejs=require(_0xf965('0xa'));var fs=require('fs');var fs_extra=require(_0xf965('0xb'));var _=require(_0xf965('0xc'));var squel=require(_0xf965('0xd'));var crypto=require(_0xf965('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf965('0xf'));var toCsv=require(_0xf965('0x9'));var querystring=require(_0xf965('0x10'));var Papa=require(_0xf965('0x11'));var Redis=require(_0xf965('0x12'));var authService=require(_0xf965('0x13'));var qs=require(_0xf965('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf965('0x15'));var logger=require('../../config/logger')(_0xf965('0x16'));var utils=require('../../config/utils');var config=require(_0xf965('0x17'));var licenseUtil=require(_0xf965('0x18'));var db=require(_0xf965('0x19'))['db'];config[_0xf965('0x1a')]=_[_0xf965('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf965('0x1c'))(new Redis(config[_0xf965('0x1a')]));require(_0xf965('0x1d'))[_0xf965('0x1e')](socket);function respondWithStatusCode(_0x43ec67,_0x466bfd){_0x466bfd=_0x466bfd||0xcc;return function(_0x2a953f){if(_0x2a953f){return _0x43ec67[_0xf965('0x1f')](_0x466bfd);}return _0x43ec67[_0xf965('0x20')](_0x466bfd)[_0xf965('0x21')]();};}function respondWithResult(_0x2a477a,_0x3c91ef){_0x3c91ef=_0x3c91ef||0xc8;return function(_0x348b8d){if(_0x348b8d){return _0x2a477a['status'](_0x3c91ef)['json'](_0x348b8d);}};}function respondWithFilteredResult(_0x570548,_0x4642fd){return function(_0x358e5f){if(_0x358e5f){var _0x533fe6=typeof _0x4642fd[_0xf965('0x22')]===_0xf965('0x23')&&typeof _0x4642fd['limit']==='undefined';var _0x1c6f91=_0x358e5f[_0xf965('0x24')];var _0x52ef10=_0x533fe6?0x0:_0x4642fd[_0xf965('0x22')];var _0x2ca178=_0x533fe6?_0x358e5f[_0xf965('0x24')]:_0x4642fd[_0xf965('0x22')]+_0x4642fd[_0xf965('0x25')];var _0x1f66ca;if(_0x2ca178>=_0x1c6f91){_0x2ca178=_0x1c6f91;_0x1f66ca=0xc8;}else{_0x1f66ca=0xce;}_0x570548[_0xf965('0x20')](_0x1f66ca);return _0x570548['set'](_0xf965('0x26'),_0x52ef10+'-'+_0x2ca178+'/'+_0x1c6f91)[_0xf965('0x27')](_0x358e5f);}return null;};}function patchUpdates(_0x218f34){return function(_0x1dd4ee){try{jsonpatch['apply'](_0x1dd4ee,_0x218f34,!![]);}catch(_0x5b062a){return BPromise[_0xf965('0x28')](_0x5b062a);}return _0x1dd4ee['save']();};}function saveUpdates(_0x545fa6,_0x578293){return function(_0x420388){if(_0x420388){return _0x420388['update'](_0x545fa6)[_0xf965('0x29')](function(_0x14b5fb){return _0x14b5fb;});}return null;};}function removeEntity(_0x545095,_0x5f292c){return function(_0x3e3354){if(_0x3e3354){return _0x3e3354[_0xf965('0x2a')]()[_0xf965('0x29')](function(){_0x545095[_0xf965('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x361421,_0x353dcc){return function(_0x560033){if(!_0x560033){_0x361421[_0xf965('0x1f')](0x194);}return _0x560033;};}function handleError(_0x956e7b,_0x4cdef9){_0x4cdef9=_0x4cdef9||0x1f4;return function(_0x3d45d8){logger[_0xf965('0x2b')](_0x3d45d8['stack']);if(_0x3d45d8[_0xf965('0x2c')]){delete _0x3d45d8['name'];}_0x956e7b[_0xf965('0x20')](_0x4cdef9)['send'](_0x3d45d8);};}exports[_0xf965('0x2d')]=function(_0x486730,_0x52fa39){var _0x39a786={},_0x35650e={},_0x25e9c5={'count':0x0,'rows':[]};var _0x2d5545=_[_0xf965('0x2e')](db[_0xf965('0x2f')][_0xf965('0x30')],function(_0x57e75a){return{'name':_0x57e75a['fieldName'],'type':_0x57e75a[_0xf965('0x31')][_0xf965('0x32')]};});_0x35650e[_0xf965('0x33')]=_[_0xf965('0x2e')](_0x2d5545,_0xf965('0x2c'));_0x35650e[_0xf965('0x34')]=_['keys'](_0x486730[_0xf965('0x34')]);_0x35650e[_0xf965('0x35')]=_['intersection'](_0x35650e[_0xf965('0x33')],_0x35650e[_0xf965('0x34')]);_0x39a786['attributes']=_[_0xf965('0x36')](_0x35650e['model'],qs[_0xf965('0x37')](_0x486730[_0xf965('0x34')][_0xf965('0x37')]));_0x39a786[_0xf965('0x38')]=_0x39a786['attributes']['length']?_0x39a786[_0xf965('0x38')]:_0x35650e['model'];if(!_0x486730[_0xf965('0x34')][_0xf965('0x39')](_0xf965('0x3a'))){_0x39a786['limit']=qs[_0xf965('0x25')](_0x486730[_0xf965('0x34')][_0xf965('0x25')]);_0x39a786[_0xf965('0x22')]=qs['offset'](_0x486730[_0xf965('0x34')][_0xf965('0x22')]);}_0x39a786[_0xf965('0x3b')]=qs[_0xf965('0x3c')](_0x486730[_0xf965('0x34')][_0xf965('0x3c')]);_0x39a786[_0xf965('0x3d')]=qs[_0xf965('0x35')](_[_0xf965('0x3e')](_0x486730['query'],_0x35650e['filters']),_0x2d5545);if(_0x486730[_0xf965('0x34')][_0xf965('0x3f')]){_0x39a786[_0xf965('0x3d')]=_[_0xf965('0x40')](_0x39a786[_0xf965('0x3d')],{'$or':_[_0xf965('0x2e')](_0x2d5545,function(_0x12801e){if(_0x12801e['type']!==_0xf965('0x41')){var _0x39c385={};_0x39c385[_0x12801e[_0xf965('0x2c')]]={'$like':'%'+_0x486730['query']['filter']+'%'};return _0x39c385;}})});}_0x39a786=_[_0xf965('0x40')]({},_0x39a786,_0x486730['options']);var _0x22633a={'where':_0x39a786[_0xf965('0x3d')]};return db[_0xf965('0x2f')][_0xf965('0x24')](_0x22633a)['then'](function(_0x3e04f6){_0x25e9c5[_0xf965('0x24')]=_0x3e04f6;if(_0x486730['query'][_0xf965('0x42')]){_0x39a786[_0xf965('0x43')]=[{'all':!![]}];}return db[_0xf965('0x2f')][_0xf965('0x44')](_0x39a786);})[_0xf965('0x29')](function(_0x47ac54){_0x25e9c5[_0xf965('0x45')]=_0x47ac54;return _0x25e9c5;})['then'](respondWithFilteredResult(_0x52fa39,_0x39a786))[_0xf965('0x46')](handleError(_0x52fa39,null));};exports['show']=function(_0x20e197,_0x43cadd){var _0x39ad8c={'raw':!![],'where':{'id':_0x20e197[_0xf965('0x47')]['id']}},_0x347fbb={};_0x347fbb[_0xf965('0x33')]=_[_0xf965('0x48')](db['ChatInternalMessage'][_0xf965('0x30')]);_0x347fbb[_0xf965('0x34')]=_[_0xf965('0x48')](_0x20e197[_0xf965('0x34')]);_0x347fbb[_0xf965('0x35')]=_[_0xf965('0x36')](_0x347fbb['model'],_0x347fbb[_0xf965('0x34')]);_0x39ad8c[_0xf965('0x38')]=_[_0xf965('0x36')](_0x347fbb[_0xf965('0x33')],qs[_0xf965('0x37')](_0x20e197['query']['fields']));_0x39ad8c[_0xf965('0x38')]=_0x39ad8c['attributes'][_0xf965('0x49')]?_0x39ad8c[_0xf965('0x38')]:_0x347fbb[_0xf965('0x33')];if(_0x20e197[_0xf965('0x34')]['includeAll']){_0x39ad8c[_0xf965('0x43')]=[{'all':!![]}];}_0x39ad8c=_[_0xf965('0x40')]({},_0x39ad8c,_0x20e197[_0xf965('0x4a')]);return db[_0xf965('0x2f')]['find'](_0x39ad8c)[_0xf965('0x29')](handleEntityNotFound(_0x43cadd,null))['then'](respondWithResult(_0x43cadd,null))[_0xf965('0x46')](handleError(_0x43cadd,null));};exports[_0xf965('0x4b')]=function(_0x4b64bb,_0x35d32c){return db[_0xf965('0x2f')][_0xf965('0x4b')](_0x4b64bb[_0xf965('0x4c')],{})['then'](respondWithResult(_0x35d32c,0xc9))[_0xf965('0x46')](handleError(_0x35d32c,null));};exports[_0xf965('0x4d')]=function(_0x4960ea,_0x6d91cb){if(_0x4960ea[_0xf965('0x4c')]['id']){delete _0x4960ea['body']['id'];}return db['ChatInternalMessage'][_0xf965('0x4e')]({'where':{'id':_0x4960ea[_0xf965('0x47')]['id']}})[_0xf965('0x29')](handleEntityNotFound(_0x6d91cb,null))[_0xf965('0x29')](saveUpdates(_0x4960ea[_0xf965('0x4c')],null))['then'](respondWithResult(_0x6d91cb,null))[_0xf965('0x46')](handleError(_0x6d91cb,null));};exports[_0xf965('0x2a')]=function(_0x1af4bc,_0x292816){return db[_0xf965('0x2f')][_0xf965('0x4e')]({'where':{'id':_0x1af4bc[_0xf965('0x47')]['id']}})[_0xf965('0x29')](handleEntityNotFound(_0x292816,null))[_0xf965('0x29')](removeEntity(_0x292816,null))[_0xf965('0x46')](handleError(_0x292816,null));};exports[_0xf965('0x4f')]=function(_0x3fd464,_0x12b959){return db[_0xf965('0x2f')][_0xf965('0x4f')]()['then'](respondWithResult(_0x12b959,null))[_0xf965('0x46')](handleError(_0x12b959,null));};function wrapUser(_0x4d2547){return function(_0x2a9f32){var _0x2d941a=_0x4d2547[_0xf965('0x50')]({'plain':!![]});_0x2d941a[_0xf965('0x51')]=[];if(_0x2a9f32){_0x2d941a[_0xf965('0x52')]=_0x2a9f32[_0xf965('0x53')];_0x2d941a['lastMessage']=_0x2a9f32;}else{_0x2d941a[_0xf965('0x52')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2d941a['lastMessage']={};}return _0x2d941a;};}exports['getUsers']=function(_0x38ce5c,_0x751fec,_0x4fd125){var _0x3eb676=[];return db[_0xf965('0x54')][_0xf965('0x44')]({'where':{'role':[_0xf965('0x55'),'admin',_0xf965('0x56')]},'attributes':['id',_0xf965('0x57'),_0xf965('0x2c'),_0xf965('0x58'),_0xf965('0x59'),_0xf965('0x5a'),_0xf965('0x5b'),_0xf965('0x5c'),'allowmessenger','showWebBar'],'order':qs['sort'](_0xf965('0x5d')),'include':[{'model':db[_0xf965('0x5e')],'as':_0xf965('0x5f'),'attributes':['id','name',_0xf965('0x31')],'through':{'attributes':[]}}]})[_0xf965('0x29')](function(_0x48cc9e){if(_0x48cc9e){var _0x1c9cf6=_0x38ce5c[_0xf965('0x56')][_0xf965('0x50')]({'plain':!![]});if(!_0x1c9cf6)throw new Error(_0xf965('0x60'));if(_0x1c9cf6['role']===_0xf965('0x56')){return db[_0xf965('0x61')][_0xf965('0x4e')]({'where':{'name':_0xf965('0x62'),'userProfileId':_0x1c9cf6['userProfileId']},'raw':!![]})['then'](function(_0x24849d){if(_0x24849d){if(_0x24849d[_0xf965('0x63')]===0x0){return db['UserProfileResource'][_0xf965('0x44')]({'where':{'sectionId':_0x24849d['id']},'raw':!![]})[_0xf965('0x29')](function(_0x11b469){var _0x2e7047=[];if(_[_0xf965('0x64')](_0x11b469)){_0x2e7047=_['filter'](_0x48cc9e,function(_0xa2cefe){if(_0xa2cefe['role']!=='agent'){return _0xa2cefe;}});return _0x2e7047;}else{for(var _0x1ada38=0x0;_0x1ada38<_0x48cc9e['length'];_0x1ada38++){var _0x291d3e=_0x48cc9e[_0x1ada38];if(_0x291d3e[_0xf965('0x58')]===_0xf965('0x55')){var _0x5e6b95=_[_0xf965('0x4e')](_0x11b469,function(_0x519a93){return _0x519a93['resourceId']===_0x291d3e['id'];});if(_0x5e6b95)_0x2e7047[_0xf965('0x65')](_0x291d3e);}else{_0x2e7047[_0xf965('0x65')](_0x291d3e);}}return _0x2e7047;}});}else{return _0x48cc9e;}}else{var _0x3e594e=_[_0xf965('0x3f')](_0x48cc9e,function(_0x1c9e77){if(_0x1c9e77['role']!==_0xf965('0x55')){return _0x1c9e77;}});return _0x3e594e;}});}else{return _0x48cc9e;}}})[_0xf965('0x29')](function(_0x209654){var _0x321c69=[];if(_0x209654){_0x3eb676=_0x209654;for(var _0x4bd5b2=0x0;_0x4bd5b2<_0x209654[_0xf965('0x49')];_0x4bd5b2+=0x1){_0x3eb676[_0x4bd5b2][_0xf965('0x51')]=[];_0x321c69['push'](db[_0xf965('0x2f')][_0xf965('0x4e')]({'where':{'FromId':[_0x38ce5c[_0xf965('0x56')]['id'],_0x209654[_0x4bd5b2]['id']],'ToId':[_0x38ce5c['user']['id'],_0x209654[_0x4bd5b2]['id']],'ChatGroupId':null},'attributes':['id',_0xf965('0x53'),_0xf965('0x66'),_0xf965('0x67'),'read',_0xf965('0x4c')],'order':qs[_0xf965('0x3c')](_0xf965('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf965('0x29')](wrapUser(_0x209654[_0x4bd5b2])));}return BPromise['all'](_0x321c69);}return[];})[_0xf965('0x29')](function(_0x278125){return{'rows':_0x278125,'count':_0x278125[_0xf965('0x49')]};})[_0xf965('0x29')](respondWithResult(_0x751fec,null))[_0xf965('0x46')](handleError(_0x751fec,null));}; \ No newline at end of file +var _0xfa0e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt'];(function(_0x22ef5a,_0x255279){var _0x5c6589=function(_0x1f5b45){while(--_0x1f5b45){_0x22ef5a['push'](_0x22ef5a['shift']());}};_0x5c6589(++_0x255279);}(_0xfa0e,0x72));var _0xefa0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfa0e[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xefa0('0x0'));var jsonpatch=require(_0xefa0('0x1'));var rp=require(_0xefa0('0x2'));var moment=require(_0xefa0('0x3'));var BPromise=require(_0xefa0('0x4'));var Mustache=require(_0xefa0('0x5'));var util=require(_0xefa0('0x6'));var path=require(_0xefa0('0x7'));var sox=require(_0xefa0('0x8'));var csv=require(_0xefa0('0x9'));var ejs=require(_0xefa0('0xa'));var fs=require('fs');var fs_extra=require(_0xefa0('0xb'));var _=require(_0xefa0('0xc'));var squel=require('squel');var crypto=require(_0xefa0('0xd'));var jsforce=require(_0xefa0('0xe'));var deskjs=require(_0xefa0('0xf'));var toCsv=require(_0xefa0('0x9'));var querystring=require(_0xefa0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xefa0('0x11'));var as=require(_0xefa0('0x12'));var hardwareService=require(_0xefa0('0x13'));var logger=require(_0xefa0('0x14'))(_0xefa0('0x15'));var utils=require('../../config/utils');var config=require(_0xefa0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xefa0('0x17'))['db'];config['redis']=_['defaults'](config[_0xefa0('0x18')],{'host':_0xefa0('0x19'),'port':0x18eb});var socket=require(_0xefa0('0x1a'))(new Redis(config[_0xefa0('0x18')]));require(_0xefa0('0x1b'))['register'](socket);function respondWithStatusCode(_0x1538c0,_0x2eff3c){_0x2eff3c=_0x2eff3c||0xcc;return function(_0x17fecd){if(_0x17fecd){return _0x1538c0['sendStatus'](_0x2eff3c);}return _0x1538c0['status'](_0x2eff3c)[_0xefa0('0x1c')]();};}function respondWithResult(_0x518b1a,_0x5189b6){_0x5189b6=_0x5189b6||0xc8;return function(_0x227725){if(_0x227725){return _0x518b1a[_0xefa0('0x1d')](_0x5189b6)[_0xefa0('0x1e')](_0x227725);}};}function respondWithFilteredResult(_0x3359ac,_0x4203fa){return function(_0xd80a69){if(_0xd80a69){var _0x5be6a9=typeof _0x4203fa[_0xefa0('0x1f')]===_0xefa0('0x20')&&typeof _0x4203fa['limit']===_0xefa0('0x20');var _0x160045=_0xd80a69[_0xefa0('0x21')];var _0x51e8ba=_0x5be6a9?0x0:_0x4203fa[_0xefa0('0x1f')];var _0x36ddac=_0x5be6a9?_0xd80a69[_0xefa0('0x21')]:_0x4203fa[_0xefa0('0x1f')]+_0x4203fa[_0xefa0('0x22')];var _0x3576d3;if(_0x36ddac>=_0x160045){_0x36ddac=_0x160045;_0x3576d3=0xc8;}else{_0x3576d3=0xce;}_0x3359ac[_0xefa0('0x1d')](_0x3576d3);return _0x3359ac['set']('Content-Range',_0x51e8ba+'-'+_0x36ddac+'/'+_0x160045)[_0xefa0('0x1e')](_0xd80a69);}return null;};}function patchUpdates(_0x3a88b2){return function(_0x5bdbea){try{jsonpatch[_0xefa0('0x23')](_0x5bdbea,_0x3a88b2,!![]);}catch(_0x5b557f){return BPromise[_0xefa0('0x24')](_0x5b557f);}return _0x5bdbea[_0xefa0('0x25')]();};}function saveUpdates(_0x616b36,_0x428825){return function(_0x201d27){if(_0x201d27){return _0x201d27[_0xefa0('0x26')](_0x616b36)[_0xefa0('0x27')](function(_0x6844ba){return _0x6844ba;});}return null;};}function removeEntity(_0x199884,_0x1f9d50){return function(_0x1f3536){if(_0x1f3536){return _0x1f3536[_0xefa0('0x28')]()[_0xefa0('0x27')](function(){_0x199884[_0xefa0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e345,_0x150261){return function(_0x5c2019){if(!_0x5c2019){_0x25e345[_0xefa0('0x29')](0x194);}return _0x5c2019;};}function handleError(_0x1b8c72,_0x198b80){_0x198b80=_0x198b80||0x1f4;return function(_0x55294c){logger[_0xefa0('0x2a')](_0x55294c[_0xefa0('0x2b')]);if(_0x55294c[_0xefa0('0x2c')]){delete _0x55294c[_0xefa0('0x2c')];}_0x1b8c72['status'](_0x198b80)[_0xefa0('0x2d')](_0x55294c);};}exports['index']=function(_0x8fd451,_0x57bc02){var _0xa7ea4={},_0x5ba955={},_0x3db37b={'count':0x0,'rows':[]};var _0xf4bc6f=_[_0xefa0('0x2e')](db['ChatInternalMessage'][_0xefa0('0x2f')],function(_0x2ecfca){return{'name':_0x2ecfca[_0xefa0('0x30')],'type':_0x2ecfca[_0xefa0('0x31')][_0xefa0('0x32')]};});_0x5ba955['model']=_[_0xefa0('0x2e')](_0xf4bc6f,_0xefa0('0x2c'));_0x5ba955[_0xefa0('0x33')]=_[_0xefa0('0x34')](_0x8fd451[_0xefa0('0x33')]);_0x5ba955[_0xefa0('0x35')]=_[_0xefa0('0x36')](_0x5ba955[_0xefa0('0x37')],_0x5ba955[_0xefa0('0x33')]);_0xa7ea4[_0xefa0('0x38')]=_[_0xefa0('0x36')](_0x5ba955[_0xefa0('0x37')],qs['fields'](_0x8fd451[_0xefa0('0x33')][_0xefa0('0x39')]));_0xa7ea4[_0xefa0('0x38')]=_0xa7ea4[_0xefa0('0x38')][_0xefa0('0x3a')]?_0xa7ea4['attributes']:_0x5ba955[_0xefa0('0x37')];if(!_0x8fd451[_0xefa0('0x33')][_0xefa0('0x3b')](_0xefa0('0x3c'))){_0xa7ea4['limit']=qs[_0xefa0('0x22')](_0x8fd451[_0xefa0('0x33')][_0xefa0('0x22')]);_0xa7ea4['offset']=qs[_0xefa0('0x1f')](_0x8fd451['query']['offset']);}_0xa7ea4[_0xefa0('0x3d')]=qs[_0xefa0('0x3e')](_0x8fd451['query']['sort']);_0xa7ea4[_0xefa0('0x3f')]=qs[_0xefa0('0x35')](_['pick'](_0x8fd451[_0xefa0('0x33')],_0x5ba955[_0xefa0('0x35')]),_0xf4bc6f);if(_0x8fd451[_0xefa0('0x33')][_0xefa0('0x40')]){_0xa7ea4[_0xefa0('0x3f')]=_[_0xefa0('0x41')](_0xa7ea4[_0xefa0('0x3f')],{'$or':_[_0xefa0('0x2e')](_0xf4bc6f,function(_0x15b771){if(_0x15b771[_0xefa0('0x31')]!==_0xefa0('0x42')){var _0xf88178={};_0xf88178[_0x15b771['name']]={'$like':'%'+_0x8fd451['query'][_0xefa0('0x40')]+'%'};return _0xf88178;}})});}_0xa7ea4=_[_0xefa0('0x41')]({},_0xa7ea4,_0x8fd451[_0xefa0('0x43')]);var _0x488a20={'where':_0xa7ea4[_0xefa0('0x3f')]};return db[_0xefa0('0x44')]['count'](_0x488a20)['then'](function(_0x160bcf){_0x3db37b[_0xefa0('0x21')]=_0x160bcf;if(_0x8fd451[_0xefa0('0x33')][_0xefa0('0x45')]){_0xa7ea4[_0xefa0('0x46')]=[{'all':!![]}];}return db[_0xefa0('0x44')][_0xefa0('0x47')](_0xa7ea4);})[_0xefa0('0x27')](function(_0x2d69aa){_0x3db37b[_0xefa0('0x48')]=_0x2d69aa;return _0x3db37b;})['then'](respondWithFilteredResult(_0x57bc02,_0xa7ea4))[_0xefa0('0x49')](handleError(_0x57bc02,null));};exports[_0xefa0('0x4a')]=function(_0x3e713f,_0x45cfec){var _0x4cd370={'raw':!![],'where':{'id':_0x3e713f[_0xefa0('0x4b')]['id']}},_0x2ec706={};_0x2ec706['model']=_[_0xefa0('0x34')](db['ChatInternalMessage'][_0xefa0('0x2f')]);_0x2ec706[_0xefa0('0x33')]=_[_0xefa0('0x34')](_0x3e713f[_0xefa0('0x33')]);_0x2ec706[_0xefa0('0x35')]=_[_0xefa0('0x36')](_0x2ec706[_0xefa0('0x37')],_0x2ec706['query']);_0x4cd370[_0xefa0('0x38')]=_['intersection'](_0x2ec706[_0xefa0('0x37')],qs[_0xefa0('0x39')](_0x3e713f[_0xefa0('0x33')][_0xefa0('0x39')]));_0x4cd370[_0xefa0('0x38')]=_0x4cd370[_0xefa0('0x38')][_0xefa0('0x3a')]?_0x4cd370['attributes']:_0x2ec706[_0xefa0('0x37')];if(_0x3e713f[_0xefa0('0x33')][_0xefa0('0x45')]){_0x4cd370[_0xefa0('0x46')]=[{'all':!![]}];}_0x4cd370=_['merge']({},_0x4cd370,_0x3e713f[_0xefa0('0x43')]);return db['ChatInternalMessage'][_0xefa0('0x4c')](_0x4cd370)[_0xefa0('0x27')](handleEntityNotFound(_0x45cfec,null))['then'](respondWithResult(_0x45cfec,null))[_0xefa0('0x49')](handleError(_0x45cfec,null));};exports[_0xefa0('0x4d')]=function(_0x3732f5,_0x6007cf){return db[_0xefa0('0x44')][_0xefa0('0x4d')](_0x3732f5[_0xefa0('0x4e')],{})[_0xefa0('0x27')](respondWithResult(_0x6007cf,0xc9))[_0xefa0('0x49')](handleError(_0x6007cf,null));};exports[_0xefa0('0x26')]=function(_0x26bc25,_0x11808a){if(_0x26bc25[_0xefa0('0x4e')]['id']){delete _0x26bc25[_0xefa0('0x4e')]['id'];}return db[_0xefa0('0x44')]['find']({'where':{'id':_0x26bc25['params']['id']}})[_0xefa0('0x27')](handleEntityNotFound(_0x11808a,null))[_0xefa0('0x27')](saveUpdates(_0x26bc25['body'],null))[_0xefa0('0x27')](respondWithResult(_0x11808a,null))['catch'](handleError(_0x11808a,null));};exports[_0xefa0('0x28')]=function(_0x52a99e,_0x1fd2ba){return db['ChatInternalMessage'][_0xefa0('0x4c')]({'where':{'id':_0x52a99e[_0xefa0('0x4b')]['id']}})[_0xefa0('0x27')](handleEntityNotFound(_0x1fd2ba,null))[_0xefa0('0x27')](removeEntity(_0x1fd2ba,null))[_0xefa0('0x49')](handleError(_0x1fd2ba,null));};exports['describe']=function(_0x4a7ede,_0x22195a){return db['ChatInternalMessage'][_0xefa0('0x4f')]()[_0xefa0('0x27')](respondWithResult(_0x22195a,null))[_0xefa0('0x49')](handleError(_0x22195a,null));};function wrapUser(_0xc1f119){return function(_0xa14dc2){var _0x157b23=_0xc1f119[_0xefa0('0x50')]({'plain':!![]});_0x157b23[_0xefa0('0x51')]=[];if(_0xa14dc2){_0x157b23[_0xefa0('0x52')]=_0xa14dc2[_0xefa0('0x53')];_0x157b23[_0xefa0('0x54')]=_0xa14dc2;}else{_0x157b23[_0xefa0('0x52')]=moment(0x0)[_0xefa0('0x55')](_0xefa0('0x56'));_0x157b23['lastMessage']={};}return _0x157b23;};}exports[_0xefa0('0x57')]=function(_0x16f037,_0x1ca499,_0x3b8fc0){var _0x19d390=[];return db[_0xefa0('0x58')]['findAll']({'where':{'role':['agent','admin',_0xefa0('0x59')]},'attributes':['id',_0xefa0('0x5a'),_0xefa0('0x2c'),'role',_0xefa0('0x5b'),_0xefa0('0x5c'),_0xefa0('0x5d'),_0xefa0('0x5e'),'allowmessenger',_0xefa0('0x5f')],'order':qs[_0xefa0('0x3e')](_0xefa0('0x60')),'include':[{'model':db[_0xefa0('0x61')],'as':_0xefa0('0x62'),'attributes':['id',_0xefa0('0x2c'),_0xefa0('0x31')],'through':{'attributes':[]}}]})[_0xefa0('0x27')](function(_0x5c643d){if(_0x5c643d){var _0x3ec4e1=_0x16f037['user']['get']({'plain':!![]});if(!_0x3ec4e1)throw new Error(_0xefa0('0x63'));if(_0x3ec4e1[_0xefa0('0x64')]===_0xefa0('0x59')){return db[_0xefa0('0x65')]['find']({'where':{'name':_0xefa0('0x66'),'userProfileId':_0x3ec4e1[_0xefa0('0x67')]},'raw':!![]})[_0xefa0('0x27')](function(_0x3aa931){if(_0x3aa931){if(_0x3aa931[_0xefa0('0x68')]===0x0){return db[_0xefa0('0x69')][_0xefa0('0x47')]({'where':{'sectionId':_0x3aa931['id']},'raw':!![]})['then'](function(_0x5136f1){var _0x35b54b=[];if(_[_0xefa0('0x6a')](_0x5136f1)){_0x35b54b=_['filter'](_0x5c643d,function(_0x2b3b4b){if(_0x2b3b4b['role']!==_0xefa0('0x6b')){return _0x2b3b4b;}});return _0x35b54b;}else{for(var _0x4d1180=0x0;_0x4d1180<_0x5c643d[_0xefa0('0x3a')];_0x4d1180++){var _0x2bc90a=_0x5c643d[_0x4d1180];if(_0x2bc90a[_0xefa0('0x64')]===_0xefa0('0x6b')){var _0xf68592=_['find'](_0x5136f1,function(_0x301503){return _0x301503[_0xefa0('0x6c')]===_0x2bc90a['id'];});if(_0xf68592)_0x35b54b['push'](_0x2bc90a);}else{_0x35b54b['push'](_0x2bc90a);}}return _0x35b54b;}});}else{return _0x5c643d;}}else{var _0x1ae9c0=_[_0xefa0('0x40')](_0x5c643d,function(_0x5c3243){if(_0x5c3243[_0xefa0('0x64')]!=='agent'){return _0x5c3243;}});return _0x1ae9c0;}});}else{return _0x5c643d;}}})[_0xefa0('0x27')](function(_0x54f83c){var _0x1de083=[];if(_0x54f83c){_0x19d390=_0x54f83c;for(var _0x27b43e=0x0;_0x27b43e<_0x54f83c['length'];_0x27b43e+=0x1){_0x19d390[_0x27b43e][_0xefa0('0x51')]=[];_0x1de083[_0xefa0('0x6d')](db[_0xefa0('0x44')][_0xefa0('0x4c')]({'where':{'FromId':[_0x16f037[_0xefa0('0x59')]['id'],_0x54f83c[_0x27b43e]['id']],'ToId':[_0x16f037[_0xefa0('0x59')]['id'],_0x54f83c[_0x27b43e]['id']],'ChatGroupId':null},'attributes':['id',_0xefa0('0x53'),_0xefa0('0x6e'),_0xefa0('0x6f'),_0xefa0('0x70'),_0xefa0('0x4e')],'order':qs[_0xefa0('0x3e')](_0xefa0('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xefa0('0x27')](wrapUser(_0x54f83c[_0x27b43e])));}return BPromise['all'](_0x1de083);}return[];})[_0xefa0('0x27')](function(_0x1d306b){return{'rows':_0x1d306b,'count':_0x1d306b[_0xefa0('0x3a')]};})['then'](respondWithResult(_0x1ca499,null))['catch'](handleError(_0x1ca499,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 24e6f5d..4f4faf7 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 _0x4ead=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x7de0fb,_0x1ba300){var _0x358bd8=function(_0x5a4ae3){while(--_0x5a4ae3){_0x7de0fb['push'](_0x7de0fb['shift']());}};_0x358bd8(++_0x1ba300);}(_0x4ead,0x19b));var _0xd4ea=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x4ead[_0x45c48f];return _0xaf5037;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xd4ea('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd4ea('0x1')](0x0);var events={'afterCreate':_0xd4ea('0x2'),'afterUpdate':_0xd4ea('0x3'),'afterDestroy':_0xd4ea('0x4')};function emitEvent(_0x142ebe){return function(_0x12ff31,_0x520d61,_0x46600a){ChatInternalMessageEvents[_0xd4ea('0x5')](_0x142ebe+':'+_0x12ff31['id'],_0x12ff31);ChatInternalMessageEvents[_0xd4ea('0x5')](_0x142ebe,_0x12ff31);_0x46600a(null);};}for(var e in events){if(events[_0xd4ea('0x6')](e)){var event=events[e];ChatInternalMessage[_0xd4ea('0x7')](e,emitEvent(event));}}module[_0xd4ea('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc759=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x44c159,_0x276fa0){var _0x5c804d=function(_0xed23c9){while(--_0xed23c9){_0x44c159['push'](_0x44c159['shift']());}};_0x5c804d(++_0x276fa0);}(_0xc759,0xa0));var _0x9c75=function(_0x4c8957,_0x3a6069){_0x4c8957=_0x4c8957-0x0;var _0x2fac66=_0xc759[_0x4c8957];return _0x2fac66;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x9c75('0x0'))['db'][_0x9c75('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9c75('0x2')](0x0);var events={'afterCreate':_0x9c75('0x3'),'afterUpdate':'update','afterDestroy':_0x9c75('0x4')};function emitEvent(_0x1650fb){return function(_0x3ba338,_0x4efc3d,_0x540d2b){ChatInternalMessageEvents[_0x9c75('0x5')](_0x1650fb+':'+_0x3ba338['id'],_0x3ba338);ChatInternalMessageEvents[_0x9c75('0x5')](_0x1650fb,_0x3ba338);_0x540d2b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x9c75('0x6')](e,emitEvent(event));}}module[_0x9c75('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 03316cd..f6227bd 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 _0x5a54=['ChatInternalMessage','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x10316a,_0x125dc8){var _0x36ac2e=function(_0x140e35){while(--_0x140e35){_0x10316a['push'](_0x10316a['shift']());}};_0x36ac2e(++_0x125dc8);}(_0x5a54,0x1a6));var _0x45a5=function(_0x5c330e,_0x224bbe){_0x5c330e=_0x5c330e-0x0;var _0x23b0d8=_0x5a54[_0x5c330e];return _0x23b0d8;};'use strict';var _=require(_0x45a5('0x0'));var util=require(_0x45a5('0x1'));var logger=require(_0x45a5('0x2'))(_0x45a5('0x3'));var moment=require(_0x45a5('0x4'));var BPromise=require(_0x45a5('0x5'));var rp=require(_0x45a5('0x6'));var fs=require('fs');var path=require(_0x45a5('0x7'));var rimraf=require(_0x45a5('0x8'));var config=require(_0x45a5('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x45a5('0xa')]=function(_0x3e0df4,_0x1575f1){return _0x3e0df4[_0x45a5('0xb')](_0x45a5('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x45a5('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdccf=['moment','bluebird','path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x4a7302,_0x139ce7){var _0x4a2f36=function(_0x545fcb){while(--_0x545fcb){_0x4a7302['push'](_0x4a7302['shift']());}};_0x4a2f36(++_0x139ce7);}(_0xdccf,0x71));var _0xfdcc=function(_0xa1afdd,_0x545768){_0xa1afdd=_0xa1afdd-0x0;var _0x4a9722=_0xdccf[_0xa1afdd];return _0x4a9722;};'use strict';var _=require(_0xfdcc('0x0'));var util=require(_0xfdcc('0x1'));var logger=require(_0xfdcc('0x2'))(_0xfdcc('0x3'));var moment=require(_0xfdcc('0x4'));var BPromise=require(_0xfdcc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdcc('0x6'));var rimraf=require(_0xfdcc('0x7'));var config=require('../../config/environment');var attributes=require(_0xfdcc('0x8'));module[_0xfdcc('0x9')]=function(_0x1c5582,_0x560eb2){return _0x1c5582[_0xfdcc('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xfdcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfdcc('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 2108dc0..b8687cb 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 _0x0b78=['request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x335914,_0x13fae1){var _0x102a1d=function(_0x2130de){while(--_0x2130de){_0x335914['push'](_0x335914['shift']());}};_0x102a1d(++_0x13fae1);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var moment=require('moment');var BPromise=require(_0x80b7('0x2'));var rs=require(_0x80b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x80b7('0x5'))(_0x80b7('0x6'));var config=require(_0x80b7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x80b7('0x8')]({'port':0x232a});config['redis']=_[_0x80b7('0x9')](config[_0x80b7('0xa')],{'host':_0x80b7('0xb'),'port':0x18eb});var socket=require(_0x80b7('0xc'))(new Redis(config['redis']));require(_0x80b7('0xd'))[_0x80b7('0xe')](socket);function respondWithRpcPromise(_0x374c52,_0x5176b2,_0x467f38){return new BPromise(function(_0x522a21,_0x2b1a00){return client[_0x80b7('0xf')](_0x374c52,_0x467f38)[_0x80b7('0x10')](function(_0x7b971b){logger[_0x80b7('0x11')](_0x80b7('0x12'),_0x5176b2,_0x80b7('0x13'));logger[_0x80b7('0x14')](_0x80b7('0x15'),_0x5176b2,_0x80b7('0x13'),JSON[_0x80b7('0x16')](_0x7b971b));if(_0x7b971b['error']){if(_0x7b971b[_0x80b7('0x17')][_0x80b7('0x18')]===0x1f4){logger['error'](_0x80b7('0x12'),_0x5176b2,_0x7b971b[_0x80b7('0x17')]['message']);return _0x2b1a00(_0x7b971b[_0x80b7('0x17')][_0x80b7('0x19')]);}logger[_0x80b7('0x17')](_0x80b7('0x12'),_0x5176b2,_0x7b971b[_0x80b7('0x17')][_0x80b7('0x19')]);return _0x522a21(_0x7b971b[_0x80b7('0x17')][_0x80b7('0x19')]);}else{logger[_0x80b7('0x11')](_0x80b7('0x12'),_0x5176b2,'request\x20sent');_0x522a21(_0x7b971b[_0x80b7('0x1a')][_0x80b7('0x19')]);}})[_0x80b7('0x1b')](function(_0x125c47){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x5176b2,_0x125c47);_0x2b1a00(_0x125c47);});});} \ No newline at end of file +var _0x5b7f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x30903f,_0x2588a0){var _0x28ef6c=function(_0x31d549){while(--_0x31d549){_0x30903f['push'](_0x30903f['shift']());}};_0x28ef6c(++_0x2588a0);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x400fae,_0x297cd4){_0x400fae=_0x400fae-0x0;var _0x572441=_0x5b7f[_0x400fae];return _0x572441;};'use strict';var _=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var moment=require(_0xf5b7('0x2'));var BPromise=require(_0xf5b7('0x3'));var rs=require(_0xf5b7('0x4'));var fs=require('fs');var Redis=require(_0xf5b7('0x5'));var db=require(_0xf5b7('0x6'))['db'];var utils=require(_0xf5b7('0x7'));var logger=require(_0xf5b7('0x8'))(_0xf5b7('0x9'));var config=require(_0xf5b7('0xa'));var jayson=require(_0xf5b7('0xb'));var client=jayson[_0xf5b7('0xc')][_0xf5b7('0xd')]({'port':0x232a});config[_0xf5b7('0xe')]=_[_0xf5b7('0xf')](config[_0xf5b7('0xe')],{'host':_0xf5b7('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xf5b7('0x11')](socket);function respondWithRpcPromise(_0x15f7f8,_0x2e3315,_0x4595c1){return new BPromise(function(_0x299eba,_0x3d2a12){return client[_0xf5b7('0x12')](_0x15f7f8,_0x4595c1)[_0xf5b7('0x13')](function(_0x43da63){logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));logger['debug'](_0xf5b7('0x17'),_0x2e3315,_0xf5b7('0x16'),JSON[_0xf5b7('0x18')](_0x43da63));if(_0x43da63[_0xf5b7('0x19')]){if(_0x43da63[_0xf5b7('0x19')]['code']===0x1f4){logger[_0xf5b7('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x2e3315,_0x43da63['error']['message']);return _0x3d2a12(_0x43da63['error'][_0xf5b7('0x1a')]);}logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x43da63[_0xf5b7('0x19')][_0xf5b7('0x1a')]);return _0x299eba(_0x43da63['error'][_0xf5b7('0x1a')]);}else{logger[_0xf5b7('0x14')](_0xf5b7('0x15'),_0x2e3315,_0xf5b7('0x16'));_0x299eba(_0x43da63[_0xf5b7('0x1b')][_0xf5b7('0x1a')]);}})['catch'](function(_0x2d112f){logger[_0xf5b7('0x19')](_0xf5b7('0x15'),_0x2e3315,_0x2d112f);_0x3d2a12(_0x2d112f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e396695..01d6b59 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 _0x9eeb=['remove','update','register','length','./chatInternalMessage.events','save'];(function(_0x2f6aea,_0x12b87b){var _0x481fbe=function(_0x434fc4){while(--_0x434fc4){_0x2f6aea['push'](_0x2f6aea['shift']());}};_0x481fbe(++_0x12b87b);}(_0x9eeb,0x7c));var _0xb9ee=function(_0xf0588a,_0x5cb015){_0xf0588a=_0xf0588a-0x0;var _0x50396c=_0x9eeb[_0xf0588a];return _0x50396c;};'use strict';var ChatInternalMessageEvents=require(_0xb9ee('0x0'));var events=[_0xb9ee('0x1'),_0xb9ee('0x2'),_0xb9ee('0x3')];function createListener(_0x48ef04,_0x1b3ab0){return function(_0x39e146){_0x1b3ab0['emit'](_0x48ef04,_0x39e146);};}function removeListener(_0x5171e6,_0x686346){return function(){ChatInternalMessageEvents['removeListener'](_0x5171e6,_0x686346);};}exports[_0xb9ee('0x4')]=function(_0x3c5e8f){for(var _0x385c48=0x0,_0x3a9316=events[_0xb9ee('0x5')];_0x385c48<_0x3a9316;_0x385c48++){var _0x2a9f29=events[_0x385c48];var _0x7fb741=createListener('chatInternalMessage:'+_0x2a9f29,_0x3c5e8f);ChatInternalMessageEvents['on'](_0x2a9f29,_0x7fb741);}}; \ No newline at end of file +var _0xbdca=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x329ca7,_0x29a097){var _0x4dfe68=function(_0x2db944){while(--_0x2db944){_0x329ca7['push'](_0x329ca7['shift']());}};_0x4dfe68(++_0x29a097);}(_0xbdca,0x173));var _0xabdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbdca[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xabdc('0x0'));var events=[_0xabdc('0x1'),'remove',_0xabdc('0x2')];function createListener(_0x23c6e9,_0x3aefc4){return function(_0x799584){_0x3aefc4[_0xabdc('0x3')](_0x23c6e9,_0x799584);};}function removeListener(_0x59f816,_0x2d2241){return function(){ChatInternalMessageEvents[_0xabdc('0x4')](_0x59f816,_0x2d2241);};}exports[_0xabdc('0x5')]=function(_0x2e515c){for(var _0x3369da=0x0,_0x46b423=events[_0xabdc('0x6')];_0x3369da<_0x46b423;_0x3369da++){var _0x3cacec=events[_0x3369da];var _0x277984=createListener(_0xabdc('0x7')+_0x3cacec,_0x2e515c);ChatInternalMessageEvents['on'](_0x3cacec,_0x277984);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index bf00c8c..c795bd3 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 _0x00ab=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post'];(function(_0x483d7d,_0x49047c){var _0x5357dc=function(_0x48d42b){while(--_0x48d42b){_0x483d7d['push'](_0x483d7d['shift']());}};_0x5357dc(++_0x49047c);}(_0x00ab,0x1e3));var _0xb00a=function(_0x319dd2,_0x21aa1c){_0x319dd2=_0x319dd2-0x0;var _0x5c5a7b=_0x00ab[_0x319dd2];return _0x5c5a7b;};'use strict';var multer=require(_0xb00a('0x0'));var util=require(_0xb00a('0x1'));var path=require(_0xb00a('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00a('0x3'));var router=express[_0xb00a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb00a('0x5'));var interaction=require(_0xb00a('0x6'));var config=require('../../config/environment');var controller=require(_0xb00a('0x7'));router[_0xb00a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb00a('0x8')](_0xb00a('0x9'),auth[_0xb00a('0xa')](),controller[_0xb00a('0xb')]);router['get'](_0xb00a('0xc'),auth[_0xb00a('0xa')](),controller[_0xb00a('0xd')]);router[_0xb00a('0x8')](_0xb00a('0xe'),auth[_0xb00a('0xa')](),controller[_0xb00a('0xf')]);router[_0xb00a('0x10')]('/',auth[_0xb00a('0xa')](),controller['create']);router['put']('/:id',controller[_0xb00a('0x11')]);router['delete'](_0xb00a('0xe'),auth[_0xb00a('0xa')](),controller[_0xb00a('0x12')]);module[_0xb00a('0x13')]=router; \ No newline at end of file +var _0x653f=['index','/users','getUsers','post','create','update','delete','/:id','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x7386c6,_0x19dc06){var _0x2a20a7=function(_0x1b6ec3){while(--_0x1b6ec3){_0x7386c6['push'](_0x7386c6['shift']());}};_0x2a20a7(++_0x19dc06);}(_0x653f,0xbe));var _0xf653=function(_0x8262d1,_0x298925){_0x8262d1=_0x8262d1-0x0;var _0x2a58f1=_0x653f[_0x8262d1];return _0x2a58f1;};'use strict';var multer=require('multer');var util=require(_0xf653('0x0'));var path=require('path');var timeout=require(_0xf653('0x1'));var express=require('express');var router=express[_0xf653('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf653('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf653('0x4'));var controller=require(_0xf653('0x5'));router[_0xf653('0x6')]('/',auth[_0xf653('0x7')](),controller[_0xf653('0x8')]);router[_0xf653('0x6')]('/describe',auth[_0xf653('0x7')](),controller['describe']);router[_0xf653('0x6')](_0xf653('0x9'),auth[_0xf653('0x7')](),controller[_0xf653('0xa')]);router[_0xf653('0x6')]('/:id',auth[_0xf653('0x7')](),controller['show']);router[_0xf653('0xb')]('/',auth[_0xf653('0x7')](),controller[_0xf653('0xc')]);router['put']('/:id',controller[_0xf653('0xd')]);router[_0xf653('0xe')](_0xf653('0xf'),auth[_0xf653('0x7')](),controller[_0xf653('0x10')]);module[_0xf653('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9de0c2c..299a29e 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 _0x0447=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4604ad,_0x2c516e){var _0x3ed8ef=function(_0x2cb13e){while(--_0x2cb13e){_0x4604ad['push'](_0x4604ad['shift']());}};_0x3ed8ef(++_0x2c516e);}(_0x0447,0x8b));var _0x7044=function(_0x326b39,_0x4143c9){_0x326b39=_0x326b39-0x0;var _0x5b62d1=_0x0447[_0x326b39];return _0x5b62d1;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'body':{'type':Sequelize[_0x7044('0x2')](_0x7044('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7044('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7044('0x5')]('in',_0x7044('0x6')),'defaultValue':_0x7044('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7044('0x7')]},'providerName':{'type':Sequelize[_0x7044('0x8')]},'providerResponse':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file +var _0x8c7a=['sequelize','medium','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x3a2ad5,_0xdd11fa){_0x3a2ad5=_0x3a2ad5-0x0;var _0x358ff3=_0x8c7a[_0x3a2ad5];return _0x358ff3;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xa8c7('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8c7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8c7('0x3')]('in',_0xa8c7('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8c7('0x5')]},'providerResponse':{'type':Sequelize[_0xa8c7('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 3d8316e..9f82652 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 _0xb108=['QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','parse','formData','chat','role','RejectMessage','User','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','create','body','describe','../../config/logger','chat-interactions','accept','read','readAt','format','UserId','agent','find','get','ChatInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x372f55,_0x452d0a){var _0x2074f4=function(_0x344ff0){while(--_0x344ff0){_0x372f55['push'](_0x372f55['shift']());}};_0x2074f4(++_0x452d0a);}(_0xb108,0x11e));var _0x8b10=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb108[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x8b10('0x0'));var rimraf=require(_0x8b10('0x1'));var zipdir=require(_0x8b10('0x2'));var jsonpatch=require(_0x8b10('0x3'));var rp=require(_0x8b10('0x4'));var moment=require(_0x8b10('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b10('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8b10('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b10('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b10('0x9'));var jsforce=require(_0x8b10('0xa'));var deskjs=require(_0x8b10('0xb'));var toCsv=require(_0x8b10('0x7'));var querystring=require(_0x8b10('0xc'));var Papa=require(_0x8b10('0xd'));var Redis=require(_0x8b10('0xe'));var authService=require(_0x8b10('0xf'));var qs=require(_0x8b10('0x10'));var as=require(_0x8b10('0x11'));var hardwareService=require(_0x8b10('0x12'));var logger=require('../../config/logger')(_0x8b10('0x13'));var utils=require('../../config/utils');var config=require(_0x8b10('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b10('0x15'))['db'];config[_0x8b10('0x16')]=_[_0x8b10('0x17')](config[_0x8b10('0x16')],{'host':_0x8b10('0x18'),'port':0x18eb});var socket=require(_0x8b10('0x19'))(new Redis(config[_0x8b10('0x16')]));require(_0x8b10('0x1a'))[_0x8b10('0x1b')](socket);var jayson=require(_0x8b10('0x1c'));var client=jayson[_0x8b10('0x1d')][_0x8b10('0x1e')]({'port':0x232c});var client9002=jayson[_0x8b10('0x1d')][_0x8b10('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3cacec,_0xbb59ca,_0x2334e1,_0x28bb27){return new BPromise(function(_0x16e68e,_0x478cf1){var _0x5c096f=_0x28bb27||client;return _0x5c096f[_0x8b10('0x1f')](_0x3cacec,_0x2334e1)[_0x8b10('0x20')](function(_0x451ac1){logger[_0x8b10('0x21')](_0x8b10('0x22'),_0xbb59ca,_0x8b10('0x23'));logger[_0x8b10('0x24')](_0x8b10('0x25'),_0xbb59ca,_0x8b10('0x23'),JSON['stringify'](_0x451ac1));if(_0x451ac1[_0x8b10('0x26')]){if(_0x451ac1[_0x8b10('0x26')][_0x8b10('0x27')]===0x1f4){logger[_0x8b10('0x26')]('ChatMessage,\x20%s,\x20%s',_0xbb59ca,_0x451ac1[_0x8b10('0x26')][_0x8b10('0x28')]);return _0x478cf1(_0x451ac1[_0x8b10('0x26')]['message']);}logger[_0x8b10('0x26')](_0x8b10('0x22'),_0xbb59ca,_0x451ac1[_0x8b10('0x26')][_0x8b10('0x28')]);return _0x16e68e(_0x451ac1[_0x8b10('0x26')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xbb59ca,_0x8b10('0x23'));_0x16e68e(_0x451ac1[_0x8b10('0x29')]['message']);}})[_0x8b10('0x2a')](function(_0x4c8218){logger[_0x8b10('0x26')](_0x8b10('0x22'),_0xbb59ca,_0x4c8218);_0x478cf1(_0x4c8218);});});}function respondWithStatusCode(_0x4b5f07,_0x364860){_0x364860=_0x364860||0xcc;return function(_0x4b3247){if(_0x4b3247){return _0x4b5f07[_0x8b10('0x2b')](_0x364860);}return _0x4b5f07[_0x8b10('0x2c')](_0x364860)[_0x8b10('0x2d')]();};}function respondWithResult(_0x4b2e91,_0x184922){_0x184922=_0x184922||0xc8;return function(_0x354a13){if(_0x354a13){return _0x4b2e91['status'](_0x184922)[_0x8b10('0x2e')](_0x354a13);}};}function respondWithFilteredResult(_0x397752,_0x1afb9a){return function(_0x3afd26){if(_0x3afd26){var _0x30bace=typeof _0x1afb9a[_0x8b10('0x2f')]==='undefined'&&typeof _0x1afb9a[_0x8b10('0x30')]===_0x8b10('0x31');var _0x51223b=_0x3afd26['count'];var _0xbd6481=_0x30bace?0x0:_0x1afb9a[_0x8b10('0x2f')];var _0xf57714=_0x30bace?_0x3afd26[_0x8b10('0x32')]:_0x1afb9a[_0x8b10('0x2f')]+_0x1afb9a[_0x8b10('0x30')];var _0x1c19c4;if(_0xf57714>=_0x51223b){_0xf57714=_0x51223b;_0x1c19c4=0xc8;}else{_0x1c19c4=0xce;}_0x397752['status'](_0x1c19c4);return _0x397752['set'](_0x8b10('0x33'),_0xbd6481+'-'+_0xf57714+'/'+_0x51223b)['json'](_0x3afd26);}return null;};}function patchUpdates(_0x4a10c2){return function(_0x544c72){try{jsonpatch[_0x8b10('0x34')](_0x544c72,_0x4a10c2,!![]);}catch(_0xaceafb){return BPromise[_0x8b10('0x35')](_0xaceafb);}return _0x544c72[_0x8b10('0x36')]();};}function saveUpdates(_0x35982f,_0x549b02){return function(_0x22fa8b){if(_0x22fa8b){return _0x22fa8b[_0x8b10('0x37')](_0x35982f)[_0x8b10('0x20')](function(_0x16495b){return _0x16495b;});}return null;};}function removeEntity(_0x2806d3,_0x31101f){return function(_0x2e03bc){if(_0x2e03bc){return _0x2e03bc[_0x8b10('0x38')]()[_0x8b10('0x20')](function(){_0x2806d3[_0x8b10('0x2c')](0xcc)[_0x8b10('0x2d')]();});}};}function handleEntityNotFound(_0x1edbfc,_0x47e00d){return function(_0x3d6b4f){if(!_0x3d6b4f){_0x1edbfc['sendStatus'](0x194);}return _0x3d6b4f;};}function handleError(_0x24547b,_0x435530){_0x435530=_0x435530||0x1f4;return function(_0x1899c2){logger[_0x8b10('0x26')](_0x1899c2[_0x8b10('0x39')]);if(_0x1899c2[_0x8b10('0x3a')]){delete _0x1899c2[_0x8b10('0x3a')];}_0x24547b[_0x8b10('0x2c')](_0x435530)[_0x8b10('0x3b')](_0x1899c2);};}exports[_0x8b10('0x3c')]=function(_0x201d40,_0x37db3b){var _0x2158bd={},_0x4ae5ec={},_0x44a9d4={'count':0x0,'rows':[]};var _0x586890=_[_0x8b10('0x3d')](db[_0x8b10('0x3e')]['rawAttributes'],function(_0x436c80){return{'name':_0x436c80[_0x8b10('0x3f')],'type':_0x436c80[_0x8b10('0x40')][_0x8b10('0x41')]};});_0x4ae5ec[_0x8b10('0x42')]=_[_0x8b10('0x3d')](_0x586890,_0x8b10('0x3a'));_0x4ae5ec[_0x8b10('0x43')]=_[_0x8b10('0x44')](_0x201d40['query']);_0x4ae5ec[_0x8b10('0x45')]=_[_0x8b10('0x46')](_0x4ae5ec['model'],_0x4ae5ec['query']);_0x2158bd['attributes']=_[_0x8b10('0x46')](_0x4ae5ec[_0x8b10('0x42')],qs['fields'](_0x201d40[_0x8b10('0x43')][_0x8b10('0x47')]));_0x2158bd[_0x8b10('0x48')]=_0x2158bd[_0x8b10('0x48')][_0x8b10('0x49')]?_0x2158bd[_0x8b10('0x48')]:_0x4ae5ec[_0x8b10('0x42')];if(!_0x201d40[_0x8b10('0x43')][_0x8b10('0x4a')]('nolimit')){_0x2158bd['limit']=qs[_0x8b10('0x30')](_0x201d40['query']['limit']);_0x2158bd['offset']=qs[_0x8b10('0x2f')](_0x201d40[_0x8b10('0x43')][_0x8b10('0x2f')]);}_0x2158bd['order']=qs[_0x8b10('0x4b')](_0x201d40[_0x8b10('0x43')]['sort']);_0x2158bd[_0x8b10('0x4c')]=qs['filters'](_[_0x8b10('0x4d')](_0x201d40[_0x8b10('0x43')],_0x4ae5ec[_0x8b10('0x45')]),_0x586890);if(_0x201d40[_0x8b10('0x43')][_0x8b10('0x4e')]){_0x2158bd[_0x8b10('0x4c')]=_[_0x8b10('0x4f')](_0x2158bd[_0x8b10('0x4c')],{'$or':_[_0x8b10('0x3d')](_0x586890,function(_0x35fb49){if(_0x35fb49['type']!=='VIRTUAL'){var _0xa1a656={};_0xa1a656[_0x35fb49[_0x8b10('0x3a')]]={'$like':'%'+_0x201d40[_0x8b10('0x43')][_0x8b10('0x4e')]+'%'};return _0xa1a656;}})});}_0x2158bd=_[_0x8b10('0x4f')]({},_0x2158bd,_0x201d40[_0x8b10('0x50')]);var _0x5e3f4c={'where':_0x2158bd[_0x8b10('0x4c')]};return db[_0x8b10('0x3e')][_0x8b10('0x32')](_0x5e3f4c)[_0x8b10('0x20')](function(_0x358a67){_0x44a9d4[_0x8b10('0x32')]=_0x358a67;if(_0x201d40[_0x8b10('0x43')]['includeAll']){_0x2158bd[_0x8b10('0x51')]=[{'all':!![]}];}return db[_0x8b10('0x3e')][_0x8b10('0x52')](_0x2158bd);})[_0x8b10('0x20')](function(_0x595855){_0x44a9d4[_0x8b10('0x53')]=_0x595855;return _0x44a9d4;})[_0x8b10('0x20')](respondWithFilteredResult(_0x37db3b,_0x2158bd))['catch'](handleError(_0x37db3b,null));};exports[_0x8b10('0x54')]=function(_0x3eb930,_0x27cc42){var _0x4b2182={'raw':!![],'where':{'id':_0x3eb930[_0x8b10('0x55')]['id']}},_0x329c4e={};_0x329c4e['model']=_['keys'](db[_0x8b10('0x3e')][_0x8b10('0x56')]);_0x329c4e[_0x8b10('0x43')]=_[_0x8b10('0x44')](_0x3eb930[_0x8b10('0x43')]);_0x329c4e[_0x8b10('0x45')]=_[_0x8b10('0x46')](_0x329c4e[_0x8b10('0x42')],_0x329c4e[_0x8b10('0x43')]);_0x4b2182[_0x8b10('0x48')]=_[_0x8b10('0x46')](_0x329c4e[_0x8b10('0x42')],qs[_0x8b10('0x47')](_0x3eb930['query'][_0x8b10('0x47')]));_0x4b2182['attributes']=_0x4b2182[_0x8b10('0x48')][_0x8b10('0x49')]?_0x4b2182['attributes']:_0x329c4e[_0x8b10('0x42')];if(_0x3eb930['query']['includeAll']){_0x4b2182[_0x8b10('0x51')]=[{'all':!![]}];}_0x4b2182=_['merge']({},_0x4b2182,_0x3eb930[_0x8b10('0x50')]);return db[_0x8b10('0x3e')]['find'](_0x4b2182)[_0x8b10('0x20')](handleEntityNotFound(_0x27cc42,null))[_0x8b10('0x20')](respondWithResult(_0x27cc42,null))[_0x8b10('0x2a')](handleError(_0x27cc42,null));};exports['create']=function(_0x75f2ea,_0xe8666b){return db[_0x8b10('0x3e')][_0x8b10('0x57')](_0x75f2ea[_0x8b10('0x58')],{})[_0x8b10('0x20')](respondWithResult(_0xe8666b,0xc9))[_0x8b10('0x2a')](handleError(_0xe8666b,null));};exports[_0x8b10('0x37')]=function(_0x53b07c,_0x13520b){if(_0x53b07c['body']['id']){delete _0x53b07c[_0x8b10('0x58')]['id'];}return db[_0x8b10('0x3e')]['find']({'where':{'id':_0x53b07c[_0x8b10('0x55')]['id']}})[_0x8b10('0x20')](handleEntityNotFound(_0x13520b,null))['then'](saveUpdates(_0x53b07c['body'],null))[_0x8b10('0x20')](respondWithResult(_0x13520b,null))['catch'](handleError(_0x13520b,null));};exports[_0x8b10('0x38')]=function(_0x16d2a0,_0x211259){return db[_0x8b10('0x3e')]['find']({'where':{'id':_0x16d2a0[_0x8b10('0x55')]['id']}})[_0x8b10('0x20')](handleEntityNotFound(_0x211259,null))[_0x8b10('0x20')](removeEntity(_0x211259,null))[_0x8b10('0x2a')](handleError(_0x211259,null));};exports[_0x8b10('0x59')]=function(_0x233c43,_0x1b9c10){return db[_0x8b10('0x3e')]['describe']()[_0x8b10('0x20')](respondWithResult(_0x1b9c10,null))['catch'](handleError(_0x1b9c10,null));};var interaction_log=require(_0x8b10('0x5a'))(_0x8b10('0x5b'));exports[_0x8b10('0x5c')]=function(_0x50e916,_0x5e5436,_0x2a17b8){var _0x30dc52={'agent':{},'channel':'chat'};if(_0x50e916[_0x8b10('0x58')]['id']){delete _0x50e916[_0x8b10('0x58')]['id'];}_0x50e916[_0x8b10('0x58')][_0x8b10('0x5d')]=!![];_0x50e916['body'][_0x8b10('0x5e')]=moment()[_0x8b10('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x50e916['body']['UserId']=_0x50e916[_0x8b10('0x58')][_0x8b10('0x60')]||_0x50e916['user']['id'];_0x30dc52[_0x8b10('0x61')]['id']=_0x50e916[_0x8b10('0x58')][_0x8b10('0x60')];return db[_0x8b10('0x3e')][_0x8b10('0x62')]({'where':{'id':_0x50e916[_0x8b10('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e5436,null))['then'](saveUpdates(_0x50e916[_0x8b10('0x58')],null))[_0x8b10('0x20')](function(_0x336657){if(_0x336657){_0x30dc52[_0x8b10('0x28')]=_0x336657[_0x8b10('0x63')]({'plain':!![]});return db[_0x8b10('0x64')][_0x8b10('0x62')]({'where':{'id':_0x336657['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5e5436,null))['then'](function(_0x54a7a8){if(_0x54a7a8){return _0x54a7a8[_0x8b10('0x37')]({'UserId':_0x50e916[_0x8b10('0x58')][_0x8b10('0x60')],'read1stAt':_[_0x8b10('0x65')](_0x54a7a8['read1stAt'])?moment()[_0x8b10('0x5f')](_0x8b10('0x66')):undefined});}return null;})['then'](function(_0x116f63){if(_0x116f63){_0x30dc52[_0x8b10('0x67')]=_0x116f63[_0x8b10('0x63')]({'plain':!![]});interaction_log[_0x8b10('0x21')](_0x8b10('0x68'),_0x50e916[_0x8b10('0x69')]['id'],_0x50e916['user'][_0x8b10('0x3a')],_0x50e916[_0x8b10('0x69')]['role'],_0x30dc52[_0x8b10('0x67')]['id'],_0x50e916[_0x8b10('0x58')]?JSON[_0x8b10('0x6a')](_0x50e916[_0x8b10('0x58')]):_0x8b10('0x6b'));return respondWithRpcPromise(_0x8b10('0x6c'),'acceptMessage',_0x30dc52);}return null;})[_0x8b10('0x20')](function(_0x2eab26){var _0x33b7f7=_0x8b10('0x6d')+_0x2eab26[_0x8b10('0x28')][_0x8b10('0x6e')];return db[_0x8b10('0x6f')][_0x8b10('0x43')](_0x33b7f7,{'type':db[_0x8b10('0x70')][_0x8b10('0x71')][_0x8b10('0x72')],'raw':!![]})[_0x8b10('0x20')](function(_0x4130be){return _0x4130be;});})[_0x8b10('0x20')](function(_0x3cb152){if(_0x3cb152){_0x30dc52[_0x8b10('0x28')][_0x8b10('0x73')]=_0x3cb152[0x0];if(!_0x50e916[_0x8b10('0x58')]['UserId'])return;return db['User'][_0x8b10('0x62')]({'where':{'id':_0x50e916[_0x8b10('0x58')]['UserId'],'role':_0x8b10('0x61')},'attributes':['id',_0x8b10('0x3a'),_0x8b10('0x74'),_0x8b10('0x75'),_0x8b10('0x76')],'raw':!![]});}return null;})['then'](function(_0x2ed8d9){if(!_0x2ed8d9)return null;_0x30dc52[_0x8b10('0x28')][_0x8b10('0x61')]=_0x2ed8d9;return _0x30dc52;})['then'](function(_0x1d7712){if(_0x1d7712){if(_0x50e916[_0x8b10('0x58')][_0x8b10('0x77')]){_0x30dc52[_0x8b10('0x28')][_0x8b10('0x78')]=util[_0x8b10('0x5f')](_0x8b10('0x79'),_0x50e916[_0x8b10('0x69')][_0x8b10('0x3a')]);_0x30dc52[_0x8b10('0x28')][_0x8b10('0x7a')]=_0x30dc52[_0x8b10('0x7a')];_0x30dc52[_0x8b10('0x28')][_0x8b10('0x7b')]=_0x30dc52[_0x8b10('0x7a')];_0x30dc52[_0x8b10('0x28')]['event']='accept';return respondWithRpcPromise(_0x8b10('0x7c'),_0x8b10('0x7c'),{'event':'acceptmessage','message':_[_0x8b10('0x4f')](_0x30dc52[_0x8b10('0x28')],JSON[_0x8b10('0x7d')](_0x30dc52[_0x8b10('0x67')][_0x8b10('0x7e')]))},client9002)[_0x8b10('0x20')](function(){return _0x30dc52;});}return _0x30dc52;}return null;})[_0x8b10('0x20')](respondWithResult(_0x5e5436,null))[_0x8b10('0x2a')](handleError(_0x5e5436,null));};var interaction_log=require(_0x8b10('0x5a'))(_0x8b10('0x5b'));exports[_0x8b10('0x35')]=function(_0x4bab6d,_0x10daa6,_0x7d1814){var _0x32c009={'agent':{},'channel':_0x8b10('0x7f')};if(_0x4bab6d['body']['id']){delete _0x4bab6d['body']['id'];}_0x4bab6d[_0x8b10('0x58')][_0x8b10('0x60')]=_0x4bab6d[_0x8b10('0x58')][_0x8b10('0x60')]||_0x4bab6d['user']['id'];_0x32c009['agent']['id']=_0x4bab6d['body']['UserId'];return db[_0x8b10('0x3e')]['find']({'where':{'id':_0x4bab6d[_0x8b10('0x55')]['id'],'UserId':null}})[_0x8b10('0x20')](handleEntityNotFound(_0x10daa6,null))[_0x8b10('0x20')](function(_0x248205){if(_0x248205){_0x32c009[_0x8b10('0x28')]=_0x248205['get']({'plain':!![]});return db[_0x8b10('0x64')][_0x8b10('0x62')]({'where':{'id':_0x248205['ChatInteractionId']}});}return null;})[_0x8b10('0x20')](handleEntityNotFound(_0x10daa6,null))['then'](function(_0x5129c0){if(_0x5129c0){_0x32c009['interaction']=_0x5129c0['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4bab6d[_0x8b10('0x69')]['id'],_0x4bab6d[_0x8b10('0x69')][_0x8b10('0x3a')],_0x4bab6d[_0x8b10('0x69')][_0x8b10('0x80')],_0x32c009[_0x8b10('0x67')]['id'],_0x4bab6d[_0x8b10('0x58')]?JSON['stringify'](_0x4bab6d[_0x8b10('0x58')]):_0x8b10('0x6b'));return respondWithRpcPromise(_0x8b10('0x81'),'rejectMessage',_0x32c009);}return null;})[_0x8b10('0x20')](function(_0x44cc6d){var _0x312dee=_0x8b10('0x6d')+_0x44cc6d[_0x8b10('0x28')]['ContactId'];return db['sequelize']['query'](_0x312dee,{'type':db[_0x8b10('0x70')][_0x8b10('0x71')][_0x8b10('0x72')],'raw':!![]})[_0x8b10('0x20')](function(_0x4013f4){return _0x4013f4;});})[_0x8b10('0x20')](function(_0xcb3d6d){if(_0xcb3d6d){_0x32c009[_0x8b10('0x28')][_0x8b10('0x73')]=_0xcb3d6d[0x0];if(!_0x4bab6d[_0x8b10('0x58')][_0x8b10('0x60')])return;return db[_0x8b10('0x82')][_0x8b10('0x62')]({'where':{'id':_0x4bab6d['body']['UserId'],'role':'agent'},'attributes':['id',_0x8b10('0x3a'),'fullname','email',_0x8b10('0x76')],'raw':!![]});}return null;})[_0x8b10('0x20')](function(_0x51511c){if(!_0x51511c)return null;_0x32c009['message'][_0x8b10('0x61')]=_0x51511c;return _0x32c009;})[_0x8b10('0x20')](function(_0x54e970){if(_0x54e970){_0x54e970['message'][_0x8b10('0x78')]=util['format'](_0x8b10('0x79'),_0x4bab6d['user'][_0x8b10('0x3a')]);_0x54e970[_0x8b10('0x28')][_0x8b10('0x7a')]=_0x32c009[_0x8b10('0x7a')];_0x54e970[_0x8b10('0x28')][_0x8b10('0x7b')]=_0x32c009[_0x8b10('0x7a')];_0x54e970['message'][_0x8b10('0x83')]=_0x8b10('0x35');respondWithRpcPromise('EventManager',_0x8b10('0x7c'),{'event':_0x8b10('0x84'),'message':_[_0x8b10('0x4f')](_0x32c009['message'],JSON[_0x8b10('0x7d')](_0x32c009[_0x8b10('0x67')][_0x8b10('0x7e')]))},client9002);return _0x32c009;}return null;})['then'](respondWithResult(_0x10daa6,null))['catch'](handleError(_0x10daa6,null));}; \ No newline at end of file +var _0xf795=['type','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','create','update','body','find','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','email','internal','manual','SIP/%s','channel','event','EventManager','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','fullname','rejectmessage','parse','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','index','map','fieldName','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x185622,_0x235cd2){var _0x419976=function(_0xbb6d1e){while(--_0xbb6d1e){_0x185622['push'](_0x185622['shift']());}};_0x419976(++_0x235cd2);}(_0xf795,0x13c));var _0x5f79=function(_0x282442,_0x135555){_0x282442=_0x282442-0x0;var _0xf97807=_0xf795[_0x282442];return _0xf97807;};'use strict';var emlformat=require(_0x5f79('0x0'));var rimraf=require(_0x5f79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5f79('0x2'));var BPromise=require(_0x5f79('0x3'));var Mustache=require('mustache');var util=require(_0x5f79('0x4'));var path=require(_0x5f79('0x5'));var sox=require(_0x5f79('0x6'));var csv=require('to-csv');var ejs=require(_0x5f79('0x7'));var fs=require('fs');var fs_extra=require(_0x5f79('0x8'));var _=require(_0x5f79('0x9'));var squel=require('squel');var crypto=require(_0x5f79('0xa'));var jsforce=require(_0x5f79('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f79('0xc'));var authService=require(_0x5f79('0xd'));var qs=require(_0x5f79('0xe'));var as=require(_0x5f79('0xf'));var hardwareService=require(_0x5f79('0x10'));var logger=require(_0x5f79('0x11'))(_0x5f79('0x12'));var utils=require(_0x5f79('0x13'));var config=require(_0x5f79('0x14'));var licenseUtil=require(_0x5f79('0x15'));var db=require(_0x5f79('0x16'))['db'];config[_0x5f79('0x17')]=_['defaults'](config[_0x5f79('0x17')],{'host':_0x5f79('0x18'),'port':0x18eb});var socket=require(_0x5f79('0x19'))(new Redis(config[_0x5f79('0x17')]));require('./chatMessage.socket')[_0x5f79('0x1a')](socket);var jayson=require(_0x5f79('0x1b'));var client=jayson[_0x5f79('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x5f79('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ffccf,_0x78db14,_0x29d53b,_0xbf7e61){return new BPromise(function(_0x19c3a2,_0x4aaec5){var _0x26724e=_0xbf7e61||client;return _0x26724e[_0x5f79('0x1d')](_0x1ffccf,_0x29d53b)[_0x5f79('0x1e')](function(_0x4b9c0d){logger[_0x5f79('0x1f')](_0x5f79('0x20'),_0x78db14,'request\x20sent');logger[_0x5f79('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x78db14,'request\x20sent',JSON[_0x5f79('0x22')](_0x4b9c0d));if(_0x4b9c0d[_0x5f79('0x23')]){if(_0x4b9c0d[_0x5f79('0x23')][_0x5f79('0x24')]===0x1f4){logger[_0x5f79('0x23')]('ChatMessage,\x20%s,\x20%s',_0x78db14,_0x4b9c0d['error'][_0x5f79('0x25')]);return _0x4aaec5(_0x4b9c0d[_0x5f79('0x23')]['message']);}logger[_0x5f79('0x23')]('ChatMessage,\x20%s,\x20%s',_0x78db14,_0x4b9c0d['error'][_0x5f79('0x25')]);return _0x19c3a2(_0x4b9c0d[_0x5f79('0x23')][_0x5f79('0x25')]);}else{logger[_0x5f79('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x78db14,_0x5f79('0x26'));_0x19c3a2(_0x4b9c0d[_0x5f79('0x27')][_0x5f79('0x25')]);}})[_0x5f79('0x28')](function(_0x231dcf){logger[_0x5f79('0x23')](_0x5f79('0x20'),_0x78db14,_0x231dcf);_0x4aaec5(_0x231dcf);});});}function respondWithStatusCode(_0x2d9ff1,_0x4d239f){_0x4d239f=_0x4d239f||0xcc;return function(_0x42a639){if(_0x42a639){return _0x2d9ff1[_0x5f79('0x29')](_0x4d239f);}return _0x2d9ff1[_0x5f79('0x2a')](_0x4d239f)[_0x5f79('0x2b')]();};}function respondWithResult(_0x10cf7f,_0x50238c){_0x50238c=_0x50238c||0xc8;return function(_0x2a727c){if(_0x2a727c){return _0x10cf7f[_0x5f79('0x2a')](_0x50238c)[_0x5f79('0x2c')](_0x2a727c);}};}function respondWithFilteredResult(_0x529d0a,_0x3181ec){return function(_0x51db67){if(_0x51db67){var _0x5e9921=typeof _0x3181ec[_0x5f79('0x2d')]===_0x5f79('0x2e')&&typeof _0x3181ec[_0x5f79('0x2f')]==='undefined';var _0xe5bd87=_0x51db67[_0x5f79('0x30')];var _0x3d2867=_0x5e9921?0x0:_0x3181ec[_0x5f79('0x2d')];var _0x2cc015=_0x5e9921?_0x51db67['count']:_0x3181ec[_0x5f79('0x2d')]+_0x3181ec[_0x5f79('0x2f')];var _0x276448;if(_0x2cc015>=_0xe5bd87){_0x2cc015=_0xe5bd87;_0x276448=0xc8;}else{_0x276448=0xce;}_0x529d0a[_0x5f79('0x2a')](_0x276448);return _0x529d0a[_0x5f79('0x31')](_0x5f79('0x32'),_0x3d2867+'-'+_0x2cc015+'/'+_0xe5bd87)['json'](_0x51db67);}return null;};}function patchUpdates(_0x458196){return function(_0x519a28){try{jsonpatch[_0x5f79('0x33')](_0x519a28,_0x458196,!![]);}catch(_0x588bd3){return BPromise[_0x5f79('0x34')](_0x588bd3);}return _0x519a28[_0x5f79('0x35')]();};}function saveUpdates(_0x2b5d8a,_0x4183dd){return function(_0x2b5b22){if(_0x2b5b22){return _0x2b5b22['update'](_0x2b5d8a)[_0x5f79('0x1e')](function(_0x185db1){return _0x185db1;});}return null;};}function removeEntity(_0x20a080,_0x5d2424){return function(_0x5b1831){if(_0x5b1831){return _0x5b1831[_0x5f79('0x36')]()['then'](function(){_0x20a080[_0x5f79('0x2a')](0xcc)[_0x5f79('0x2b')]();});}};}function handleEntityNotFound(_0xe74aad,_0x409280){return function(_0x2d8d31){if(!_0x2d8d31){_0xe74aad[_0x5f79('0x29')](0x194);}return _0x2d8d31;};}function handleError(_0x1dc831,_0x123a4e){_0x123a4e=_0x123a4e||0x1f4;return function(_0x5358c3){logger[_0x5f79('0x23')](_0x5358c3['stack']);if(_0x5358c3[_0x5f79('0x37')]){delete _0x5358c3[_0x5f79('0x37')];}_0x1dc831[_0x5f79('0x2a')](_0x123a4e)[_0x5f79('0x38')](_0x5358c3);};}exports[_0x5f79('0x39')]=function(_0xdbf48b,_0x391ea8){var _0x3c9539={},_0x2b804f={},_0xdedbc9={'count':0x0,'rows':[]};var _0x189acf=_[_0x5f79('0x3a')](db['ChatMessage']['rawAttributes'],function(_0x162d66){return{'name':_0x162d66[_0x5f79('0x3b')],'type':_0x162d66['type']['key']};});_0x2b804f['model']=_[_0x5f79('0x3a')](_0x189acf,_0x5f79('0x37'));_0x2b804f[_0x5f79('0x3c')]=_['keys'](_0xdbf48b[_0x5f79('0x3c')]);_0x2b804f['filters']=_[_0x5f79('0x3d')](_0x2b804f[_0x5f79('0x3e')],_0x2b804f[_0x5f79('0x3c')]);_0x3c9539[_0x5f79('0x3f')]=_[_0x5f79('0x3d')](_0x2b804f[_0x5f79('0x3e')],qs[_0x5f79('0x40')](_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x40')]));_0x3c9539[_0x5f79('0x3f')]=_0x3c9539[_0x5f79('0x3f')][_0x5f79('0x41')]?_0x3c9539[_0x5f79('0x3f')]:_0x2b804f[_0x5f79('0x3e')];if(!_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x42')]('nolimit')){_0x3c9539[_0x5f79('0x2f')]=qs[_0x5f79('0x2f')](_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x2f')]);_0x3c9539[_0x5f79('0x2d')]=qs[_0x5f79('0x2d')](_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x2d')]);}_0x3c9539[_0x5f79('0x43')]=qs[_0x5f79('0x44')](_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x44')]);_0x3c9539[_0x5f79('0x45')]=qs[_0x5f79('0x46')](_[_0x5f79('0x47')](_0xdbf48b[_0x5f79('0x3c')],_0x2b804f[_0x5f79('0x46')]),_0x189acf);if(_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x48')]){_0x3c9539[_0x5f79('0x45')]=_[_0x5f79('0x49')](_0x3c9539[_0x5f79('0x45')],{'$or':_['map'](_0x189acf,function(_0x44f820){if(_0x44f820[_0x5f79('0x4a')]!==_0x5f79('0x4b')){var _0x140593={};_0x140593[_0x44f820[_0x5f79('0x37')]]={'$like':'%'+_0xdbf48b[_0x5f79('0x3c')]['filter']+'%'};return _0x140593;}})});}_0x3c9539=_[_0x5f79('0x49')]({},_0x3c9539,_0xdbf48b['options']);var _0x170521={'where':_0x3c9539[_0x5f79('0x45')]};return db[_0x5f79('0x4c')]['count'](_0x170521)[_0x5f79('0x1e')](function(_0x3c6c33){_0xdedbc9[_0x5f79('0x30')]=_0x3c6c33;if(_0xdbf48b[_0x5f79('0x3c')][_0x5f79('0x4d')]){_0x3c9539[_0x5f79('0x4e')]=[{'all':!![]}];}return db[_0x5f79('0x4c')][_0x5f79('0x4f')](_0x3c9539);})['then'](function(_0x39a872){_0xdedbc9[_0x5f79('0x50')]=_0x39a872;return _0xdedbc9;})['then'](respondWithFilteredResult(_0x391ea8,_0x3c9539))['catch'](handleError(_0x391ea8,null));};exports[_0x5f79('0x51')]=function(_0x5f2bb9,_0x497296){var _0x565275={'raw':!![],'where':{'id':_0x5f2bb9[_0x5f79('0x52')]['id']}},_0x14b751={};_0x14b751[_0x5f79('0x3e')]=_[_0x5f79('0x53')](db[_0x5f79('0x4c')][_0x5f79('0x54')]);_0x14b751[_0x5f79('0x3c')]=_[_0x5f79('0x53')](_0x5f2bb9[_0x5f79('0x3c')]);_0x14b751[_0x5f79('0x46')]=_[_0x5f79('0x3d')](_0x14b751[_0x5f79('0x3e')],_0x14b751[_0x5f79('0x3c')]);_0x565275[_0x5f79('0x3f')]=_[_0x5f79('0x3d')](_0x14b751[_0x5f79('0x3e')],qs[_0x5f79('0x40')](_0x5f2bb9[_0x5f79('0x3c')][_0x5f79('0x40')]));_0x565275[_0x5f79('0x3f')]=_0x565275[_0x5f79('0x3f')][_0x5f79('0x41')]?_0x565275[_0x5f79('0x3f')]:_0x14b751[_0x5f79('0x3e')];if(_0x5f2bb9[_0x5f79('0x3c')][_0x5f79('0x4d')]){_0x565275['include']=[{'all':!![]}];}_0x565275=_[_0x5f79('0x49')]({},_0x565275,_0x5f2bb9[_0x5f79('0x55')]);return db[_0x5f79('0x4c')]['find'](_0x565275)[_0x5f79('0x1e')](handleEntityNotFound(_0x497296,null))[_0x5f79('0x1e')](respondWithResult(_0x497296,null))[_0x5f79('0x28')](handleError(_0x497296,null));};exports[_0x5f79('0x56')]=function(_0x2a5d8c,_0x478a5f){return db[_0x5f79('0x4c')]['create'](_0x2a5d8c['body'],{})[_0x5f79('0x1e')](respondWithResult(_0x478a5f,0xc9))[_0x5f79('0x28')](handleError(_0x478a5f,null));};exports[_0x5f79('0x57')]=function(_0x249290,_0x553ede){if(_0x249290[_0x5f79('0x58')]['id']){delete _0x249290['body']['id'];}return db['ChatMessage'][_0x5f79('0x59')]({'where':{'id':_0x249290[_0x5f79('0x52')]['id']}})[_0x5f79('0x1e')](handleEntityNotFound(_0x553ede,null))[_0x5f79('0x1e')](saveUpdates(_0x249290[_0x5f79('0x58')],null))[_0x5f79('0x1e')](respondWithResult(_0x553ede,null))['catch'](handleError(_0x553ede,null));};exports['destroy']=function(_0x5aba28,_0x46c1aa){return db['ChatMessage'][_0x5f79('0x59')]({'where':{'id':_0x5aba28[_0x5f79('0x52')]['id']}})[_0x5f79('0x1e')](handleEntityNotFound(_0x46c1aa,null))['then'](removeEntity(_0x46c1aa,null))[_0x5f79('0x28')](handleError(_0x46c1aa,null));};exports[_0x5f79('0x5a')]=function(_0x17248f,_0x38b2da){return db[_0x5f79('0x4c')][_0x5f79('0x5a')]()[_0x5f79('0x1e')](respondWithResult(_0x38b2da,null))['catch'](handleError(_0x38b2da,null));};var interaction_log=require(_0x5f79('0x11'))(_0x5f79('0x5b'));exports[_0x5f79('0x5c')]=function(_0xa19b7c,_0x3ef882,_0x526374){var _0x33d097={'agent':{},'channel':_0x5f79('0x5d')};if(_0xa19b7c['body']['id']){delete _0xa19b7c[_0x5f79('0x58')]['id'];}_0xa19b7c[_0x5f79('0x58')]['read']=!![];_0xa19b7c[_0x5f79('0x58')][_0x5f79('0x5e')]=moment()[_0x5f79('0x5f')](_0x5f79('0x60'));_0xa19b7c[_0x5f79('0x58')]['UserId']=_0xa19b7c[_0x5f79('0x58')]['UserId']||_0xa19b7c[_0x5f79('0x61')]['id'];_0x33d097[_0x5f79('0x62')]['id']=_0xa19b7c[_0x5f79('0x58')][_0x5f79('0x63')];return db[_0x5f79('0x4c')][_0x5f79('0x59')]({'where':{'id':_0xa19b7c[_0x5f79('0x52')]['id'],'UserId':null}})[_0x5f79('0x1e')](handleEntityNotFound(_0x3ef882,null))['then'](saveUpdates(_0xa19b7c['body'],null))[_0x5f79('0x1e')](function(_0x1a5115){if(_0x1a5115){_0x33d097[_0x5f79('0x25')]=_0x1a5115[_0x5f79('0x64')]({'plain':!![]});return db[_0x5f79('0x65')][_0x5f79('0x59')]({'where':{'id':_0x1a5115[_0x5f79('0x66')]}});}return null;})[_0x5f79('0x1e')](handleEntityNotFound(_0x3ef882,null))[_0x5f79('0x1e')](function(_0x161e85){if(_0x161e85){return _0x161e85['update']({'UserId':_0xa19b7c['body'][_0x5f79('0x63')],'read1stAt':_['isNil'](_0x161e85[_0x5f79('0x67')])?moment()[_0x5f79('0x5f')](_0x5f79('0x60')):undefined});}return null;})[_0x5f79('0x1e')](function(_0x5db50a){if(_0x5db50a){_0x33d097['interaction']=_0x5db50a['get']({'plain':!![]});interaction_log[_0x5f79('0x1f')](_0x5f79('0x68'),_0xa19b7c[_0x5f79('0x61')]['id'],_0xa19b7c[_0x5f79('0x61')][_0x5f79('0x37')],_0xa19b7c[_0x5f79('0x61')][_0x5f79('0x69')],_0x33d097[_0x5f79('0x6a')]['id'],_0xa19b7c[_0x5f79('0x58')]?JSON[_0x5f79('0x22')](_0xa19b7c[_0x5f79('0x58')]):_0x5f79('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x5f79('0x6c'),_0x33d097);}return null;})[_0x5f79('0x1e')](function(_0x5bdaf6){var _0x324c0e=_0x5f79('0x6d')+_0x5bdaf6[_0x5f79('0x25')][_0x5f79('0x6e')];return db['sequelize'][_0x5f79('0x3c')](_0x324c0e,{'type':db[_0x5f79('0x6f')][_0x5f79('0x70')]['SELECT'],'raw':!![]})[_0x5f79('0x1e')](function(_0x57b409){return _0x57b409;});})['then'](function(_0xcf1076){if(_0xcf1076){_0x33d097[_0x5f79('0x25')]['contact']=_0xcf1076[0x0];if(!_0xa19b7c[_0x5f79('0x58')][_0x5f79('0x63')])return;return db[_0x5f79('0x71')][_0x5f79('0x59')]({'where':{'id':_0xa19b7c[_0x5f79('0x58')][_0x5f79('0x63')],'role':_0x5f79('0x62')},'attributes':['id','name','fullname',_0x5f79('0x72'),_0x5f79('0x73')],'raw':!![]});}return null;})[_0x5f79('0x1e')](function(_0x4e0ab2){if(!_0x4e0ab2)return null;_0x33d097['message'][_0x5f79('0x62')]=_0x4e0ab2;return _0x33d097;})[_0x5f79('0x1e')](function(_0x18d89f){if(_0x18d89f){if(_0xa19b7c[_0x5f79('0x58')][_0x5f79('0x74')]){_0x33d097[_0x5f79('0x25')]['interface']=util[_0x5f79('0x5f')](_0x5f79('0x75'),_0xa19b7c[_0x5f79('0x61')][_0x5f79('0x37')]);_0x33d097['message'][_0x5f79('0x76')]=_0x33d097[_0x5f79('0x76')];_0x33d097[_0x5f79('0x25')]['motionChannel']=_0x33d097[_0x5f79('0x76')];_0x33d097['message'][_0x5f79('0x77')]=_0x5f79('0x5c');return respondWithRpcPromise('EventManager',_0x5f79('0x78'),{'event':'acceptmessage','message':_[_0x5f79('0x49')](_0x33d097[_0x5f79('0x25')],JSON['parse'](_0x33d097[_0x5f79('0x6a')][_0x5f79('0x79')]))},client9002)[_0x5f79('0x1e')](function(){return _0x33d097;});}return _0x33d097;}return null;})['then'](respondWithResult(_0x3ef882,null))[_0x5f79('0x28')](handleError(_0x3ef882,null));};var interaction_log=require(_0x5f79('0x11'))(_0x5f79('0x5b'));exports[_0x5f79('0x34')]=function(_0x202c44,_0xe035fe,_0x2cf189){var _0x4056a9={'agent':{},'channel':_0x5f79('0x5d')};if(_0x202c44[_0x5f79('0x58')]['id']){delete _0x202c44['body']['id'];}_0x202c44[_0x5f79('0x58')]['UserId']=_0x202c44[_0x5f79('0x58')][_0x5f79('0x63')]||_0x202c44[_0x5f79('0x61')]['id'];_0x4056a9[_0x5f79('0x62')]['id']=_0x202c44[_0x5f79('0x58')][_0x5f79('0x63')];return db['ChatMessage'][_0x5f79('0x59')]({'where':{'id':_0x202c44[_0x5f79('0x52')]['id'],'UserId':null}})[_0x5f79('0x1e')](handleEntityNotFound(_0xe035fe,null))[_0x5f79('0x1e')](function(_0x2e30b0){if(_0x2e30b0){_0x4056a9[_0x5f79('0x25')]=_0x2e30b0[_0x5f79('0x64')]({'plain':!![]});return db[_0x5f79('0x65')][_0x5f79('0x59')]({'where':{'id':_0x2e30b0[_0x5f79('0x66')]}});}return null;})['then'](handleEntityNotFound(_0xe035fe,null))[_0x5f79('0x1e')](function(_0x209549){if(_0x209549){_0x4056a9['interaction']=_0x209549[_0x5f79('0x64')]({'plain':!![]});interaction_log['info'](_0x5f79('0x7a'),_0x202c44[_0x5f79('0x61')]['id'],_0x202c44[_0x5f79('0x61')]['name'],_0x202c44['user']['role'],_0x4056a9[_0x5f79('0x6a')]['id'],_0x202c44['body']?JSON['stringify'](_0x202c44[_0x5f79('0x58')]):_0x5f79('0x6b'));return respondWithRpcPromise(_0x5f79('0x7b'),_0x5f79('0x7c'),_0x4056a9);}return null;})['then'](function(_0x5e824d){var _0x23b78e=_0x5f79('0x6d')+_0x5e824d[_0x5f79('0x25')]['ContactId'];return db['sequelize']['query'](_0x23b78e,{'type':db['Sequelize']['QueryTypes'][_0x5f79('0x7d')],'raw':!![]})[_0x5f79('0x1e')](function(_0x9fccae){return _0x9fccae;});})[_0x5f79('0x1e')](function(_0x41c357){if(_0x41c357){_0x4056a9[_0x5f79('0x25')][_0x5f79('0x7e')]=_0x41c357[0x0];if(!_0x202c44[_0x5f79('0x58')]['UserId'])return;return db[_0x5f79('0x71')][_0x5f79('0x59')]({'where':{'id':_0x202c44[_0x5f79('0x58')][_0x5f79('0x63')],'role':_0x5f79('0x62')},'attributes':['id',_0x5f79('0x37'),_0x5f79('0x7f'),'email',_0x5f79('0x73')],'raw':!![]});}return null;})['then'](function(_0x28c0f0){if(!_0x28c0f0)return null;_0x4056a9[_0x5f79('0x25')]['agent']=_0x28c0f0;return _0x4056a9;})[_0x5f79('0x1e')](function(_0x28a143){if(_0x28a143){_0x28a143['message']['interface']=util['format'](_0x5f79('0x75'),_0x202c44['user'][_0x5f79('0x37')]);_0x28a143[_0x5f79('0x25')][_0x5f79('0x76')]=_0x4056a9['channel'];_0x28a143[_0x5f79('0x25')]['motionChannel']=_0x4056a9[_0x5f79('0x76')];_0x28a143['message']['event']='reject';respondWithRpcPromise(_0x5f79('0x78'),_0x5f79('0x78'),{'event':_0x5f79('0x80'),'message':_[_0x5f79('0x49')](_0x4056a9[_0x5f79('0x25')],JSON[_0x5f79('0x81')](_0x4056a9[_0x5f79('0x6a')][_0x5f79('0x79')]))},client9002);return _0x4056a9;}return null;})[_0x5f79('0x1e')](respondWithResult(_0xe035fe,null))[_0x5f79('0x28')](handleError(_0xe035fe,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 84a65ee..77f2574 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 _0xacf0=['update','emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x87dd0e,_0x390eec){var _0x3f6891=function(_0x23b531){while(--_0x23b531){_0x87dd0e['push'](_0x87dd0e['shift']());}};_0x3f6891(++_0x390eec);}(_0xacf0,0x185));var _0x0acf=function(_0x278fa6,_0x59feac){_0x278fa6=_0x278fa6-0x0;var _0x262a91=_0xacf0[_0x278fa6];return _0x262a91;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0acf('0x0'))['db'][_0x0acf('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0acf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0acf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x502457){return function(_0x503f91,_0x3ee6da,_0x340b4e){ChatMessageEvents[_0x0acf('0x4')](_0x502457+':'+_0x503f91['id'],_0x503f91);ChatMessageEvents[_0x0acf('0x4')](_0x502457,_0x503f91);_0x340b4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x0acf('0x5')](e,emitEvent(event));}}module[_0x0acf('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x3213=['hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x483260,_0x3c7ba3){var _0x3db1a2=function(_0x4c358d){while(--_0x4c358d){_0x483260['push'](_0x483260['shift']());}};_0x3db1a2(++_0x3c7ba3);}(_0x3213,0x124));var _0x3321=function(_0x3685e9,_0x100b3a){_0x3685e9=_0x3685e9-0x0;var _0x2164a5=_0x3213[_0x3685e9];return _0x2164a5;};'use strict';var EventEmitter=require(_0x3321('0x0'));var ChatMessage=require(_0x3321('0x1'))['db'][_0x3321('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3321('0x3')](0x0);var events={'afterCreate':_0x3321('0x4'),'afterUpdate':_0x3321('0x5'),'afterDestroy':_0x3321('0x6')};function emitEvent(_0x58562b){return function(_0xad6e2b,_0x25d056,_0x5ade3e){ChatMessageEvents[_0x3321('0x7')](_0x58562b+':'+_0xad6e2b['id'],_0xad6e2b);ChatMessageEvents[_0x3321('0x7')](_0x58562b,_0xad6e2b);_0x5ade3e(null);};}for(var e in events){if(events[_0x3321('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3321('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6a553b5..bb0e4ab 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 _0x3bd5=['UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','toLowerCase','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','out','secret','isNil'];(function(_0x27c24b,_0x335de8){var _0x2237bf=function(_0x5cab96){while(--_0x5cab96){_0x27c24b['push'](_0x27c24b['shift']());}};_0x2237bf(++_0x335de8);}(_0x3bd5,0x13e));var _0x53bd=function(_0xa102e6,_0x3e557c){_0xa102e6=_0xa102e6-0x0;var _0xa7d73d=_0x3bd5[_0xa102e6];return _0xa7d73d;};'use strict';var _=require(_0x53bd('0x0'));var util=require(_0x53bd('0x1'));var logger=require('../../config/logger')(_0x53bd('0x2'));var moment=require(_0x53bd('0x3'));var BPromise=require(_0x53bd('0x4'));var rp=require(_0x53bd('0x5'));var fs=require('fs');var path=require(_0x53bd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53bd('0x7'));module[_0x53bd('0x8')]=function(_0x471fea,_0x2f999f){return _0x471fea['define'](_0x53bd('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x53bd('0xa'),'fields':['body'],'type':_0x53bd('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49de07,_0x331b50,_0x100203){var _0x3e327c=_0x471fea[_0x53bd('0xc')];var _0x464a2d=_0x49de07[_0x53bd('0xd')]({'plain':!![]});if(_0x464a2d[_0x53bd('0xe')]['toLowerCase']()==='in'||_0x464a2d[_0x53bd('0xe')]['toLowerCase']()===_0x53bd('0xf')&&!_0x464a2d[_0x53bd('0x10')]&&!_[_0x53bd('0x11')](_0x464a2d[_0x53bd('0x12')])){_0x3e327c[_0x53bd('0x13')][_0x53bd('0x14')]({'where':{'id':_0x464a2d[_0x53bd('0x15')]}})[_0x53bd('0x16')](function(_0x35d237){if(_0x35d237){_0x35d237[_0x53bd('0x17')]({'lastMsgAt':_0x464a2d[_0x53bd('0x18')],'lastMsgDirection':_0x464a2d[_0x53bd('0xe')][_0x53bd('0x19')]()});}})['catch'](function(_0x59172a){console[_0x53bd('0x1a')](_0x59172a);});}_0x100203();}},'charset':_0x53bd('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0bc7=['toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x0bc7,0x1dc));var _0x70bc=function(_0x20bb15,_0x537275){_0x20bb15=_0x20bb15-0x0;var _0x2814df=_0x0bc7[_0x20bb15];return _0x2814df;};'use strict';var _=require(_0x70bc('0x0'));var util=require(_0x70bc('0x1'));var logger=require(_0x70bc('0x2'))(_0x70bc('0x3'));var moment=require(_0x70bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x70bc('0x5'));var fs=require('fs');var path=require(_0x70bc('0x6'));var rimraf=require(_0x70bc('0x7'));var config=require(_0x70bc('0x8'));var attributes=require(_0x70bc('0x9'));module[_0x70bc('0xa')]=function(_0x606c5c,_0x3a874b){return _0x606c5c['define'](_0x70bc('0xb'),attributes,{'tableName':_0x70bc('0xc'),'paranoid':![],'indexes':[{'name':_0x70bc('0xd'),'fields':[_0x70bc('0xe')],'type':_0x70bc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f4e3a,_0x3d1d5e,_0x18b395){var _0x53b5a3=_0x606c5c[_0x70bc('0x10')];var _0x1fed2b=_0x3f4e3a[_0x70bc('0x11')]({'plain':!![]});if(_0x1fed2b[_0x70bc('0x12')][_0x70bc('0x13')]()==='in'||_0x1fed2b['direction'][_0x70bc('0x13')]()===_0x70bc('0x14')&&!_0x1fed2b[_0x70bc('0x15')]&&!_[_0x70bc('0x16')](_0x1fed2b[_0x70bc('0x17')])){_0x53b5a3[_0x70bc('0x18')][_0x70bc('0x19')]({'where':{'id':_0x1fed2b[_0x70bc('0x1a')]}})['then'](function(_0x128c5c){if(_0x128c5c){_0x128c5c[_0x70bc('0x1b')]({'lastMsgAt':_0x1fed2b[_0x70bc('0x1c')],'lastMsgDirection':_0x1fed2b[_0x70bc('0x12')][_0x70bc('0x13')]()});}})[_0x70bc('0x1d')](function(_0x45c6ba){console[_0x70bc('0x1e')](_0x45c6ba);});}_0x18b395();}},'charset':_0x70bc('0x1f'),'collate':_0x70bc('0x20')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 63f1b34..7f3b373 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 _0x071a=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','body','raw','CreateChatMessage','util','moment','bluebird'];(function(_0x2145bf,_0x440573){var _0x528116=function(_0x49ac96){while(--_0x49ac96){_0x2145bf['push'](_0x2145bf['shift']());}};_0x528116(++_0x440573);}(_0x071a,0x1af));var _0xa071=function(_0x434339,_0x2abf5e){_0x434339=_0x434339-0x0;var _0x507ca6=_0x071a[_0x434339];return _0x507ca6;};'use strict';var _=require('lodash');var util=require(_0xa071('0x0'));var moment=require(_0xa071('0x1'));var BPromise=require(_0xa071('0x2'));var rs=require(_0xa071('0x3'));var fs=require('fs');var Redis=require(_0xa071('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa071('0x5'));var logger=require(_0xa071('0x6'))(_0xa071('0x7'));var config=require('../../config/environment');var jayson=require(_0xa071('0x8'));var client=jayson[_0xa071('0x9')][_0xa071('0xa')]({'port':0x232a});config['redis']=_[_0xa071('0xb')](config[_0xa071('0xc')],{'host':_0xa071('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa071('0xc')]));require(_0xa071('0xe'))[_0xa071('0xf')](socket);function respondWithRpcPromise(_0x48dca2,_0x443cb4,_0x4aca3f){return new BPromise(function(_0x5400eb,_0x499bce){return client['request'](_0x48dca2,_0x4aca3f)[_0xa071('0x10')](function(_0x1cdc16){logger[_0xa071('0x11')](_0xa071('0x12'),_0x443cb4,_0xa071('0x13'));logger[_0xa071('0x14')](_0xa071('0x15'),_0x443cb4,_0xa071('0x13'),JSON[_0xa071('0x16')](_0x1cdc16));if(_0x1cdc16[_0xa071('0x17')]){if(_0x1cdc16[_0xa071('0x17')][_0xa071('0x18')]===0x1f4){logger[_0xa071('0x17')]('ChatMessage,\x20%s,\x20%s',_0x443cb4,_0x1cdc16[_0xa071('0x17')][_0xa071('0x19')]);return _0x499bce(_0x1cdc16[_0xa071('0x17')][_0xa071('0x19')]);}logger[_0xa071('0x17')]('ChatMessage,\x20%s,\x20%s',_0x443cb4,_0x1cdc16[_0xa071('0x17')][_0xa071('0x19')]);return _0x5400eb(_0x1cdc16[_0xa071('0x17')][_0xa071('0x19')]);}else{logger['info'](_0xa071('0x12'),_0x443cb4,'request\x20sent');_0x5400eb(_0x1cdc16['result'][_0xa071('0x19')]);}})[_0xa071('0x1a')](function(_0x50486c){logger[_0xa071('0x17')](_0xa071('0x12'),_0x443cb4,_0x50486c);_0x499bce(_0x50486c);});});}exports['CreateChatMessage']=function(_0x9609ed){var _0x31b9fc=this;return new Promise(function(_0x140703,_0x2ef6db){return db[_0xa071('0x1b')]['create'](_0x9609ed[_0xa071('0x1c')],{'raw':_0x9609ed['options']?_0x9609ed['options'][_0xa071('0x1d')]===undefined?!![]:![]:!![]})[_0xa071('0x10')](function(_0x2e6972){logger['info'](_0xa071('0x1e'),_0x9609ed);logger['debug']('CreateChatMessage',_0x9609ed,JSON['stringify'](_0x2e6972));_0x140703(_0x2e6972);})['catch'](function(_0x513216){logger[_0xa071('0x17')](_0xa071('0x1e'),_0x513216[_0xa071('0x19')],_0x9609ed);_0x2ef6db(_0x31b9fc[_0xa071('0x17')](0x1f4,_0x513216[_0xa071('0x19')]));});});}; \ No newline at end of file +var _0x8c15=['options','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','create','body'];(function(_0x168ded,_0x34f11b){var _0x838b5f=function(_0x182ce4){while(--_0x182ce4){_0x168ded['push'](_0x168ded['shift']());}};_0x838b5f(++_0x34f11b);}(_0x8c15,0x1d1));var _0x58c1=function(_0x5a3f6f,_0x1491d6){_0x5a3f6f=_0x5a3f6f-0x0;var _0x3cefe7=_0x8c15[_0x5a3f6f];return _0x3cefe7;};'use strict';var _=require(_0x58c1('0x0'));var util=require('util');var moment=require(_0x58c1('0x1'));var BPromise=require(_0x58c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x58c1('0x4'));var logger=require(_0x58c1('0x5'))(_0x58c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x58c1('0x7'));var client=jayson[_0x58c1('0x8')][_0x58c1('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58c1('0xa')]));require(_0x58c1('0xb'))[_0x58c1('0xc')](socket);function respondWithRpcPromise(_0x5b41f0,_0xac92b5,_0x3a5e9a){return new BPromise(function(_0x8f27d0,_0x3ebabd){return client[_0x58c1('0xd')](_0x5b41f0,_0x3a5e9a)[_0x58c1('0xe')](function(_0x352f5d){logger[_0x58c1('0xf')](_0x58c1('0x10'),_0xac92b5,_0x58c1('0x11'));logger[_0x58c1('0x12')](_0x58c1('0x13'),_0xac92b5,_0x58c1('0x11'),JSON[_0x58c1('0x14')](_0x352f5d));if(_0x352f5d['error']){if(_0x352f5d[_0x58c1('0x15')]['code']===0x1f4){logger[_0x58c1('0x15')]('ChatMessage,\x20%s,\x20%s',_0xac92b5,_0x352f5d[_0x58c1('0x15')][_0x58c1('0x16')]);return _0x3ebabd(_0x352f5d[_0x58c1('0x15')]['message']);}logger[_0x58c1('0x15')](_0x58c1('0x10'),_0xac92b5,_0x352f5d[_0x58c1('0x15')][_0x58c1('0x16')]);return _0x8f27d0(_0x352f5d['error']['message']);}else{logger['info'](_0x58c1('0x10'),_0xac92b5,_0x58c1('0x11'));_0x8f27d0(_0x352f5d[_0x58c1('0x17')][_0x58c1('0x16')]);}})[_0x58c1('0x18')](function(_0x3b3e09){logger[_0x58c1('0x15')]('ChatMessage,\x20%s,\x20%s',_0xac92b5,_0x3b3e09);_0x3ebabd(_0x3b3e09);});});}exports[_0x58c1('0x19')]=function(_0x345ff9){var _0xa045a4=this;return new Promise(function(_0x260963,_0x85b2c6){return db['ChatMessage'][_0x58c1('0x1a')](_0x345ff9[_0x58c1('0x1b')],{'raw':_0x345ff9[_0x58c1('0x1c')]?_0x345ff9['options']['raw']===undefined?!![]:![]:!![]})[_0x58c1('0xe')](function(_0x241c4f){logger[_0x58c1('0xf')](_0x58c1('0x19'),_0x345ff9);logger[_0x58c1('0x12')](_0x58c1('0x19'),_0x345ff9,JSON[_0x58c1('0x14')](_0x241c4f));_0x260963(_0x241c4f);})[_0x58c1('0x18')](function(_0x223443){logger[_0x58c1('0x15')]('CreateChatMessage',_0x223443[_0x58c1('0x16')],_0x345ff9);_0x85b2c6(_0xa045a4[_0x58c1('0x15')](0x1f4,_0x223443[_0x58c1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6c82b26..9582cf7 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 _0x689c=['emit','length','chatMessage:','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x689c,0x9e));var _0xc689=function(_0x42a72e,_0x5182d5){_0x42a72e=_0x42a72e-0x0;var _0x1d513a=_0x689c[_0x42a72e];return _0x1d513a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xc689('0x0'),_0xc689('0x1')];function createListener(_0x91491e,_0xe6811d){return function(_0x44533d){_0xe6811d[_0xc689('0x2')](_0x91491e,_0x44533d);};}function removeListener(_0x4b863b,_0x3d106f){return function(){ChatMessageEvents['removeListener'](_0x4b863b,_0x3d106f);};}exports['register']=function(_0x3a4916){for(var _0x28ce4c=0x0,_0x2b9f8a=events[_0xc689('0x3')];_0x28ce4c<_0x2b9f8a;_0x28ce4c++){var _0x2e7400=events[_0x28ce4c];var _0x57f82f=createListener(_0xc689('0x4')+_0x2e7400,_0x3a4916);ChatMessageEvents['on'](_0x2e7400,_0x57f82f);}}; \ No newline at end of file +var _0x64f5=['removeListener','register','length','chatMessage:','./chatMessage.events','emit'];(function(_0x57a402,_0x40596b){var _0x753a36=function(_0x13b76b){while(--_0x13b76b){_0x57a402['push'](_0x57a402['shift']());}};_0x753a36(++_0x40596b);}(_0x64f5,0x17e));var _0x564f=function(_0x1a18cc,_0x8dd51b){_0x1a18cc=_0x1a18cc-0x0;var _0x15e226=_0x64f5[_0x1a18cc];return _0x15e226;};'use strict';var ChatMessageEvents=require(_0x564f('0x0'));var events=['save','remove','update'];function createListener(_0x39903b,_0x493091){return function(_0x2e7142){_0x493091[_0x564f('0x1')](_0x39903b,_0x2e7142);};}function removeListener(_0x59c424,_0x2607d6){return function(){ChatMessageEvents[_0x564f('0x2')](_0x59c424,_0x2607d6);};}exports[_0x564f('0x3')]=function(_0x72b009){for(var _0x4bbedf=0x0,_0x4d3dae=events[_0x564f('0x4')];_0x4bbedf<_0x4d3dae;_0x4bbedf++){var _0x28db5a=events[_0x4bbedf];var _0x275bd6=createListener(_0x564f('0x5')+_0x28db5a,_0x72b009);ChatMessageEvents['on'](_0x28db5a,_0x275bd6);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 812d270..1fef776 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 _0x5037=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x5037,0x1cb));var _0x7503=function(_0xe72a4,_0x287cf9){_0xe72a4=_0xe72a4-0x0;var _0x909bc2=_0x5037[_0xe72a4];return _0x909bc2;};'use strict';var multer=require(_0x7503('0x0'));var util=require(_0x7503('0x1'));var path=require(_0x7503('0x2'));var timeout=require(_0x7503('0x3'));var express=require(_0x7503('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7503('0x5'));var interaction=require(_0x7503('0x6'));var config=require(_0x7503('0x7'));var controller=require(_0x7503('0x8'));router['get']('/',auth[_0x7503('0x9')](),controller[_0x7503('0xa')]);router[_0x7503('0xb')](_0x7503('0xc'),auth[_0x7503('0x9')](),controller[_0x7503('0xd')]);router[_0x7503('0xb')](_0x7503('0xe'),auth[_0x7503('0x9')](),controller[_0x7503('0xf')]);router[_0x7503('0x10')]('/',auth[_0x7503('0x9')](),interaction[_0x7503('0x11')](_0x7503('0x12'),_0x7503('0x13')),controller[_0x7503('0x14')]);router['put'](_0x7503('0xe'),controller[_0x7503('0x15')]);router[_0x7503('0x16')](_0x7503('0x17'),auth['isAuthenticated'](),controller[_0x7503('0x18')]);router[_0x7503('0x16')](_0x7503('0x19'),auth[_0x7503('0x9')](),controller['reject']);router[_0x7503('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x78a8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','chat','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util'];(function(_0x5d99bb,_0x10e04b){var _0xdfe846=function(_0x2e3377){while(--_0x2e3377){_0x5d99bb['push'](_0x5d99bb['shift']());}};_0xdfe846(++_0x10e04b);}(_0x78a8,0x136));var _0x878a=function(_0x40063b,_0x934e64){_0x40063b=_0x40063b-0x0;var _0x2ea58b=_0x78a8[_0x40063b];return _0x2ea58b;};'use strict';var multer=require(_0x878a('0x0'));var util=require(_0x878a('0x1'));var path=require('path');var timeout=require(_0x878a('0x2'));var express=require(_0x878a('0x3'));var router=express[_0x878a('0x4')]();var fs_extra=require(_0x878a('0x5'));var auth=require(_0x878a('0x6'));var interaction=require(_0x878a('0x7'));var config=require(_0x878a('0x8'));var controller=require(_0x878a('0x9'));router[_0x878a('0xa')]('/',auth[_0x878a('0xb')](),controller[_0x878a('0xc')]);router[_0x878a('0xa')](_0x878a('0xd'),auth[_0x878a('0xb')](),controller['describe']);router['get']('/:id',auth[_0x878a('0xb')](),controller[_0x878a('0xe')]);router[_0x878a('0xf')]('/',auth[_0x878a('0xb')](),interaction[_0x878a('0x10')](_0x878a('0x11'),'chatmessage:create'),controller['create']);router[_0x878a('0x12')](_0x878a('0x13'),controller[_0x878a('0x14')]);router[_0x878a('0x12')](_0x878a('0x15'),auth[_0x878a('0xb')](),controller[_0x878a('0x16')]);router[_0x878a('0x12')](_0x878a('0x17'),auth[_0x878a('0xb')](),controller['reject']);router[_0x878a('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x878a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b0abaf5..d3ef90d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4817f9,_0x4070d1){_0x4817f9=_0x4817f9-0x0;var _0x2dcfa6=_0x0b0e[_0x4817f9];return _0x2dcfa6;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x98eefc,_0x59e26d){var _0x4bfc79=function(_0x358670){while(--_0x358670){_0x98eefc['push'](_0x98eefc['shift']());}};_0x4bfc79(++_0x59e26d);}(_0xadb5,0xad));var _0x5adb=function(_0x25e58c,_0x1453e6){_0x25e58c=_0x25e58c-0x0;var _0x213ef5=_0xadb5[_0x25e58c];return _0x213ef5;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 59a2613..dea61a2 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(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x167c0d,_0x2b1aca){_0x167c0d=_0x167c0d-0x0;var _0x53cad3=_0x7a54[_0x167c0d];return _0x53cad3;};'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(_0x5e1fa3,_0x35f103){var _0x3b2771=function(_0x496434){while(--_0x496434){_0x5e1fa3['push'](_0x5e1fa3['shift']());}};_0x3b2771(++_0x35f103);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 14c1e5a..510b59b 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 _0x430a=['remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x3c149f,_0x2cb990){var _0x73c3fb=function(_0x25e3a1){while(--_0x25e3a1){_0x3c149f['push'](_0x3c149f['shift']());}};_0x73c3fb(++_0x2cb990);}(_0x430a,0xaf));var _0xa430=function(_0x53c699,_0x2eb707){_0x53c699=_0x53c699-0x0;var _0x35dbb0=_0x430a[_0x53c699];return _0x35dbb0;};'use strict';var EventEmitter=require(_0xa430('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xa430('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa430('0x2')](0x0);var events={'afterCreate':_0xa430('0x3'),'afterUpdate':_0xa430('0x4'),'afterDestroy':_0xa430('0x5')};function emitEvent(_0x59ffea){return function(_0x5be567,_0x5dbc29,_0x4aa979){ChatOfflineMessageEvents[_0xa430('0x6')](_0x59ffea+':'+_0x5be567['id'],_0x5be567);ChatOfflineMessageEvents[_0xa430('0x6')](_0x59ffea,_0x5be567);_0x4aa979(null);};}for(var e in events){if(events[_0xa430('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xa430('0x8')](e,emitEvent(event));}}module[_0xa430('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8be8=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x407a9b,_0x40f99e){var _0x5d3446=function(_0x488de2){while(--_0x488de2){_0x407a9b['push'](_0x407a9b['shift']());}};_0x5d3446(++_0x40f99e);}(_0x8be8,0xf6));var _0x88be=function(_0x1a193a,_0xca4f48){_0x1a193a=_0x1a193a-0x0;var _0x2d5806=_0x8be8[_0x1a193a];return _0x2d5806;};'use strict';var EventEmitter=require(_0x88be('0x0'));var ChatOfflineMessage=require(_0x88be('0x1'))['db'][_0x88be('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x88be('0x3')](0x0);var events={'afterCreate':_0x88be('0x4'),'afterUpdate':_0x88be('0x5'),'afterDestroy':_0x88be('0x6')};function emitEvent(_0x3a60b8){return function(_0x1d256d,_0x4caaef,_0x142ac3){ChatOfflineMessageEvents['emit'](_0x3a60b8+':'+_0x1d256d['id'],_0x1d256d);ChatOfflineMessageEvents[_0x88be('0x7')](_0x3a60b8,_0x1d256d);_0x142ac3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x88be('0x8')](e,emitEvent(event));}}module[_0x88be('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a6c1aa7..de62074 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 _0x2cc1=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2cc1,0xff));var _0x12cc=function(_0x4dcac4,_0x10e48a){_0x4dcac4=_0x4dcac4-0x0;var _0x2a238d=_0x2cc1[_0x4dcac4];return _0x2a238d;};'use strict';var attributes=require(_0x12cc('0x0'));module[_0x12cc('0x1')]=function(_0x5ca102){return _0x5ca102[_0x12cc('0x2')](_0x12cc('0x3'),attributes,{'tableName':_0x12cc('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x12cc('0x5')});}; \ No newline at end of file +var _0x84e8=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0x84e8,0x18d));var _0x884e=function(_0x5846e6,_0x22af18){_0x5846e6=_0x5846e6-0x0;var _0xae42ad=_0x84e8[_0x5846e6];return _0xae42ad;};'use strict';var attributes=require(_0x884e('0x0'));module['exports']=function(_0x19950e){return _0x19950e['define'](_0x884e('0x1'),attributes,{'tableName':_0x884e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x884e('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bc1685b..ce0a971 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 _0x6dd1=['debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x6dd1,0x111));var _0x16dd=function(_0xd34cda,_0x166dc7){_0xd34cda=_0xd34cda-0x0;var _0x210016=_0x6dd1[_0xd34cda];return _0x210016;};'use strict';var _=require(_0x16dd('0x0'));var util=require('util');var moment=require(_0x16dd('0x1'));var BPromise=require(_0x16dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16dd('0x3'));var db=require(_0x16dd('0x4'))['db'];var utils=require(_0x16dd('0x5'));var logger=require(_0x16dd('0x6'))(_0x16dd('0x7'));var config=require(_0x16dd('0x8'));var jayson=require(_0x16dd('0x9'));var client=jayson[_0x16dd('0xa')][_0x16dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f532c,_0x589f69,_0x5ad29a){return new BPromise(function(_0x490566,_0x41bca0){return client[_0x16dd('0xc')](_0x4f532c,_0x5ad29a)[_0x16dd('0xd')](function(_0x19595a){logger['info'](_0x16dd('0xe'),_0x589f69,'request\x20sent');logger[_0x16dd('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x589f69,'request\x20sent',JSON[_0x16dd('0x10')](_0x19595a));if(_0x19595a[_0x16dd('0x11')]){if(_0x19595a['error'][_0x16dd('0x12')]===0x1f4){logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error'][_0x16dd('0x13')]);return _0x41bca0(_0x19595a[_0x16dd('0x11')][_0x16dd('0x13')]);}logger[_0x16dd('0x11')](_0x16dd('0xe'),_0x589f69,_0x19595a['error']['message']);return _0x490566(_0x19595a[_0x16dd('0x11')]['message']);}else{logger[_0x16dd('0x14')](_0x16dd('0xe'),_0x589f69,_0x16dd('0x15'));_0x490566(_0x19595a[_0x16dd('0x16')][_0x16dd('0x13')]);}})[_0x16dd('0x17')](function(_0x17a646){logger[_0x16dd('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x589f69,_0x17a646);_0x41bca0(_0x17a646);});});} \ No newline at end of file +var _0x5f1e=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x5ae0d4,_0x13619c){var _0x4ab006=function(_0x34c85e){while(--_0x34c85e){_0x5ae0d4['push'](_0x5ae0d4['shift']());}};_0x4ab006(++_0x13619c);}(_0x5f1e,0x71));var _0xe5f1=function(_0x54cc08,_0x38d3ef){_0x54cc08=_0x54cc08-0x0;var _0x28989a=_0x5f1e[_0x54cc08];return _0x28989a;};'use strict';var _=require('lodash');var util=require(_0xe5f1('0x0'));var moment=require(_0xe5f1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5f1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5f1('0x3'));var logger=require(_0xe5f1('0x4'))(_0xe5f1('0x5'));var config=require(_0xe5f1('0x6'));var jayson=require(_0xe5f1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e66cb,_0x485e10,_0x339fd2){return new BPromise(function(_0x1eea62,_0x365065){return client['request'](_0x4e66cb,_0x339fd2)[_0xe5f1('0x8')](function(_0x344014){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x485e10,_0xe5f1('0x9'));logger[_0xe5f1('0xa')](_0xe5f1('0xb'),_0x485e10,_0xe5f1('0x9'),JSON['stringify'](_0x344014));if(_0x344014[_0xe5f1('0xc')]){if(_0x344014[_0xe5f1('0xc')][_0xe5f1('0xd')]===0x1f4){logger[_0xe5f1('0xc')](_0xe5f1('0xe'),_0x485e10,_0x344014[_0xe5f1('0xc')][_0xe5f1('0xf')]);return _0x365065(_0x344014[_0xe5f1('0xc')][_0xe5f1('0xf')]);}logger[_0xe5f1('0xc')](_0xe5f1('0xe'),_0x485e10,_0x344014['error']['message']);return _0x1eea62(_0x344014[_0xe5f1('0xc')]['message']);}else{logger[_0xe5f1('0x10')](_0xe5f1('0xe'),_0x485e10,_0xe5f1('0x9'));_0x1eea62(_0x344014[_0xe5f1('0x11')][_0xe5f1('0xf')]);}})[_0xe5f1('0x12')](function(_0x29f33a){logger[_0xe5f1('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x485e10,_0x29f33a);_0x365065(_0x29f33a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 385c99f..0560dd0 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 _0xa5a7=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','post','create','put','/:id','exports'];(function(_0xf4d05e,_0x5f1796){var _0x16aea9=function(_0x22e99d){while(--_0x22e99d){_0xf4d05e['push'](_0xf4d05e['shift']());}};_0x16aea9(++_0x5f1796);}(_0xa5a7,0x143));var _0x7a5a=function(_0x3ba5e5,_0x1fbf79){_0x3ba5e5=_0x3ba5e5-0x0;var _0x3e9579=_0xa5a7[_0x3ba5e5];return _0x3e9579;};'use strict';var multer=require(_0x7a5a('0x0'));var util=require(_0x7a5a('0x1'));var path=require(_0x7a5a('0x2'));var timeout=require(_0x7a5a('0x3'));var express=require(_0x7a5a('0x4'));var router=express[_0x7a5a('0x5')]();var fs_extra=require(_0x7a5a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7a5a('0x7'));var config=require(_0x7a5a('0x8'));var controller=require(_0x7a5a('0x9'));router[_0x7a5a('0xa')]('/',auth[_0x7a5a('0xb')](),controller[_0x7a5a('0xc')]);router['get']('/describe',auth[_0x7a5a('0xb')](),controller[_0x7a5a('0xd')]);router[_0x7a5a('0xa')]('/:id',auth[_0x7a5a('0xb')](),controller['show']);router[_0x7a5a('0xe')]('/',auth['isAuthenticated'](),controller[_0x7a5a('0xf')]);router[_0x7a5a('0x10')](_0x7a5a('0x11'),auth[_0x7a5a('0xb')](),controller['update']);router['delete']('/:id',auth[_0x7a5a('0xb')](),controller['destroy']);module[_0x7a5a('0x12')]=router; \ No newline at end of file +var _0xdc9f=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x4bbb4,_0x46d3a6){var _0x528527=function(_0x5d5b60){while(--_0x5d5b60){_0x4bbb4['push'](_0x4bbb4['shift']());}};_0x528527(++_0x46d3a6);}(_0xdc9f,0x1b9));var _0xfdc9=function(_0x451b73,_0x1259a4){_0x451b73=_0x451b73-0x0;var _0x5142a8=_0xdc9f[_0x451b73];return _0x5142a8;};'use strict';var multer=require(_0xfdc9('0x0'));var util=require(_0xfdc9('0x1'));var path=require(_0xfdc9('0x2'));var timeout=require(_0xfdc9('0x3'));var express=require(_0xfdc9('0x4'));var router=express[_0xfdc9('0x5')]();var fs_extra=require(_0xfdc9('0x6'));var auth=require(_0xfdc9('0x7'));var interaction=require(_0xfdc9('0x8'));var config=require(_0xfdc9('0x9'));var controller=require(_0xfdc9('0xa'));router[_0xfdc9('0xb')]('/',auth[_0xfdc9('0xc')](),controller[_0xfdc9('0xd')]);router[_0xfdc9('0xb')](_0xfdc9('0xe'),auth[_0xfdc9('0xc')](),controller[_0xfdc9('0xf')]);router['get']('/:id',auth[_0xfdc9('0xc')](),controller[_0xfdc9('0x10')]);router[_0xfdc9('0x11')]('/',auth[_0xfdc9('0xc')](),controller[_0xfdc9('0x12')]);router['put'](_0xfdc9('0x13'),auth[_0xfdc9('0xc')](),controller['update']);router[_0xfdc9('0x14')]('/:id',auth[_0xfdc9('0xc')](),controller[_0xfdc9('0x15')]);module[_0xfdc9('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 35be8bb..992dec0 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 _0x6d4a=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x4bf953,_0x51dc7f){var _0x319f8f=function(_0xd1c3f9){while(--_0xd1c3f9){_0x4bf953['push'](_0x4bf953['shift']());}};_0x319f8f(++_0x51dc7f);}(_0x6d4a,0x173));var _0xa6d4=function(_0x473999,_0x244df9){_0x473999=_0x473999-0x0;var _0x38116c=_0x6d4a[_0x473999];return _0x38116c;};'use strict';var Sequelize=require('sequelize');module[_0xa6d4('0x0')]={'name':{'type':Sequelize[_0xa6d4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa6d4('0x2')](_0xa6d4('0x3'),_0xa6d4('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa6d4('0x5')]}}; \ No newline at end of file +var _0x088a=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x326273,_0xfa5842){var _0x32f10c=function(_0x192366){while(--_0x192366){_0x326273['push'](_0x326273['shift']());}};_0x32f10c(++_0xfa5842);}(_0x088a,0x120));var _0xa088=function(_0x1c8222,_0x13db80){_0x1c8222=_0x1c8222-0x0;var _0x4f0256=_0x088a[_0x1c8222];return _0x4f0256;};'use strict';var Sequelize=require('sequelize');module[_0xa088('0x0')]={'name':{'type':Sequelize[_0xa088('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa088('0x2')](_0xa088('0x3'),_0xa088('0x4')),'defaultValue':_0xa088('0x3')},'selector':{'type':Sequelize[_0xa088('0x1')]},'timeout':{'type':Sequelize[_0xa088('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e86b76d..fd20403 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 _0x535f=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../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','params','model','ChatProactiveAction','query','keys','filters','intersection','fields','attributes','length','options','find','catch','create','body','rimraf','zip-dir'];(function(_0x4fd82a,_0x29d9d5){var _0x21d2a8=function(_0x11f85f){while(--_0x11f85f){_0x4fd82a['push'](_0x4fd82a['shift']());}};_0x21d2a8(++_0x29d9d5);}(_0x535f,0x111));var _0xf535=function(_0x378549,_0x3abf7a){_0x378549=_0x378549-0x0;var _0x4fde3b=_0x535f[_0x378549];return _0x4fde3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf535('0x0'));var zipdir=require(_0xf535('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf535('0x2'));var moment=require(_0xf535('0x3'));var BPromise=require(_0xf535('0x4'));var Mustache=require(_0xf535('0x5'));var util=require('util');var path=require(_0xf535('0x6'));var sox=require(_0xf535('0x7'));var csv=require(_0xf535('0x8'));var ejs=require(_0xf535('0x9'));var fs=require('fs');var fs_extra=require(_0xf535('0xa'));var _=require(_0xf535('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf535('0xc'));var deskjs=require(_0xf535('0xd'));var toCsv=require(_0xf535('0x8'));var querystring=require('querystring');var Papa=require(_0xf535('0xe'));var Redis=require(_0xf535('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf535('0x10'));var hardwareService=require(_0xf535('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf535('0x12'));var config=require(_0xf535('0x13'));var licenseUtil=require(_0xf535('0x14'));var db=require(_0xf535('0x15'))['db'];function respondWithStatusCode(_0x471d53,_0x5e4cbd){_0x5e4cbd=_0x5e4cbd||0xcc;return function(_0x11928e){if(_0x11928e){return _0x471d53[_0xf535('0x16')](_0x5e4cbd);}return _0x471d53[_0xf535('0x17')](_0x5e4cbd)[_0xf535('0x18')]();};}function respondWithResult(_0x46792d,_0x338f06){_0x338f06=_0x338f06||0xc8;return function(_0x183049){if(_0x183049){return _0x46792d[_0xf535('0x17')](_0x338f06)[_0xf535('0x19')](_0x183049);}};}function respondWithFilteredResult(_0xb52d7f,_0xc3db30){return function(_0x4dacbb){if(_0x4dacbb){var _0x938e7f=typeof _0xc3db30[_0xf535('0x1a')]===_0xf535('0x1b')&&typeof _0xc3db30[_0xf535('0x1c')]===_0xf535('0x1b');var _0x1fb901=_0x4dacbb[_0xf535('0x1d')];var _0x33a8c3=_0x938e7f?0x0:_0xc3db30[_0xf535('0x1a')];var _0x477c1d=_0x938e7f?_0x4dacbb['count']:_0xc3db30[_0xf535('0x1a')]+_0xc3db30[_0xf535('0x1c')];var _0x6f757f;if(_0x477c1d>=_0x1fb901){_0x477c1d=_0x1fb901;_0x6f757f=0xc8;}else{_0x6f757f=0xce;}_0xb52d7f[_0xf535('0x17')](_0x6f757f);return _0xb52d7f['set'](_0xf535('0x1e'),_0x33a8c3+'-'+_0x477c1d+'/'+_0x1fb901)[_0xf535('0x19')](_0x4dacbb);}return null;};}function patchUpdates(_0x5c45bf){return function(_0x4ff009){try{jsonpatch['apply'](_0x4ff009,_0x5c45bf,!![]);}catch(_0x12f5d0){return BPromise[_0xf535('0x1f')](_0x12f5d0);}return _0x4ff009[_0xf535('0x20')]();};}function saveUpdates(_0x5e0ff4,_0x5b4980){return function(_0x438cb1){if(_0x438cb1){return _0x438cb1[_0xf535('0x21')](_0x5e0ff4)[_0xf535('0x22')](function(_0x16bd23){return _0x16bd23;});}return null;};}function removeEntity(_0x138cbd,_0x273ad0){return function(_0x358c91){if(_0x358c91){return _0x358c91[_0xf535('0x23')]()[_0xf535('0x22')](function(){_0x138cbd[_0xf535('0x17')](0xcc)[_0xf535('0x18')]();});}};}function handleEntityNotFound(_0x5b3917,_0x44ce19){return function(_0x28e761){if(!_0x28e761){_0x5b3917[_0xf535('0x16')](0x194);}return _0x28e761;};}function handleError(_0x46ce43,_0x407c5b){_0x407c5b=_0x407c5b||0x1f4;return function(_0x1250a0){logger[_0xf535('0x24')](_0x1250a0[_0xf535('0x25')]);if(_0x1250a0[_0xf535('0x26')]){delete _0x1250a0[_0xf535('0x26')];}_0x46ce43[_0xf535('0x17')](_0x407c5b)[_0xf535('0x27')](_0x1250a0);};}exports['show']=function(_0x5d1887,_0x47151e){var _0x12a94a={'raw':!![],'where':{'id':_0x5d1887[_0xf535('0x28')]['id']}},_0xfba892={};_0xfba892[_0xf535('0x29')]=_['keys'](db[_0xf535('0x2a')]['rawAttributes']);_0xfba892[_0xf535('0x2b')]=_[_0xf535('0x2c')](_0x5d1887[_0xf535('0x2b')]);_0xfba892[_0xf535('0x2d')]=_[_0xf535('0x2e')](_0xfba892[_0xf535('0x29')],_0xfba892[_0xf535('0x2b')]);_0x12a94a['attributes']=_[_0xf535('0x2e')](_0xfba892[_0xf535('0x29')],qs[_0xf535('0x2f')](_0x5d1887[_0xf535('0x2b')][_0xf535('0x2f')]));_0x12a94a[_0xf535('0x30')]=_0x12a94a[_0xf535('0x30')][_0xf535('0x31')]?_0x12a94a[_0xf535('0x30')]:_0xfba892['model'];if(_0x5d1887[_0xf535('0x2b')]['includeAll']){_0x12a94a['include']=[{'all':!![]}];}_0x12a94a=_['merge']({},_0x12a94a,_0x5d1887[_0xf535('0x32')]);return db[_0xf535('0x2a')][_0xf535('0x33')](_0x12a94a)['then'](handleEntityNotFound(_0x47151e,null))[_0xf535('0x22')](respondWithResult(_0x47151e,null))[_0xf535('0x34')](handleError(_0x47151e,null));};exports[_0xf535('0x35')]=function(_0x38f421,_0xc24fb0){return db[_0xf535('0x2a')]['create'](_0x38f421['body'],{})['then'](respondWithResult(_0xc24fb0,0xc9))['catch'](handleError(_0xc24fb0,null));};exports['update']=function(_0x4a1b36,_0x538e9f){if(_0x4a1b36['body']['id']){delete _0x4a1b36[_0xf535('0x36')]['id'];}return db[_0xf535('0x2a')]['find']({'where':{'id':_0x4a1b36[_0xf535('0x28')]['id']}})[_0xf535('0x22')](handleEntityNotFound(_0x538e9f,null))['then'](saveUpdates(_0x4a1b36[_0xf535('0x36')],null))[_0xf535('0x22')](respondWithResult(_0x538e9f,null))[_0xf535('0x34')](handleError(_0x538e9f,null));};exports['destroy']=function(_0x6fcb30,_0x241685){return db[_0xf535('0x2a')][_0xf535('0x33')]({'where':{'id':_0x6fcb30['params']['id']}})[_0xf535('0x22')](handleEntityNotFound(_0x241685,null))[_0xf535('0x22')](removeEntity(_0x241685,null))[_0xf535('0x34')](handleError(_0x241685,null));}; \ No newline at end of file +var _0x6dc0=['create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','apply','update','then','destroy','end','error','stack','name','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','options','find'];(function(_0x27f355,_0x4fd1cb){var _0x4972e8=function(_0x15adb7){while(--_0x15adb7){_0x27f355['push'](_0x27f355['shift']());}};_0x4972e8(++_0x4fd1cb);}(_0x6dc0,0x18c));var _0x06dc=function(_0x22f20b,_0x22ef2a){_0x22f20b=_0x22f20b-0x0;var _0x1b3f11=_0x6dc0[_0x22f20b];return _0x1b3f11;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06dc('0x1'));var jsonpatch=require(_0x06dc('0x2'));var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x06dc('0x6'));var sox=require(_0x06dc('0x7'));var csv=require('to-csv');var ejs=require(_0x06dc('0x8'));var fs=require('fs');var fs_extra=require(_0x06dc('0x9'));var _=require('lodash');var squel=require(_0x06dc('0xa'));var crypto=require('crypto');var jsforce=require(_0x06dc('0xb'));var deskjs=require(_0x06dc('0xc'));var toCsv=require(_0x06dc('0xd'));var querystring=require(_0x06dc('0xe'));var Papa=require(_0x06dc('0xf'));var Redis=require('ioredis');var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require('../../config/logger')(_0x06dc('0x13'));var utils=require(_0x06dc('0x14'));var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce891,_0x3ffc60){_0x3ffc60=_0x3ffc60||0xcc;return function(_0x387c19){if(_0x387c19){return _0x3ce891[_0x06dc('0x17')](_0x3ffc60);}return _0x3ce891[_0x06dc('0x18')](_0x3ffc60)['end']();};}function respondWithResult(_0x17129d,_0xfc22f0){_0xfc22f0=_0xfc22f0||0xc8;return function(_0x9806ef){if(_0x9806ef){return _0x17129d[_0x06dc('0x18')](_0xfc22f0)[_0x06dc('0x19')](_0x9806ef);}};}function respondWithFilteredResult(_0x44a252,_0x42414d){return function(_0x592cb7){if(_0x592cb7){var _0xc2eb3c=typeof _0x42414d[_0x06dc('0x1a')]===_0x06dc('0x1b')&&typeof _0x42414d['limit']===_0x06dc('0x1b');var _0x46a57c=_0x592cb7[_0x06dc('0x1c')];var _0x32a5ae=_0xc2eb3c?0x0:_0x42414d[_0x06dc('0x1a')];var _0x1dd929=_0xc2eb3c?_0x592cb7[_0x06dc('0x1c')]:_0x42414d[_0x06dc('0x1a')]+_0x42414d['limit'];var _0x2d5e70;if(_0x1dd929>=_0x46a57c){_0x1dd929=_0x46a57c;_0x2d5e70=0xc8;}else{_0x2d5e70=0xce;}_0x44a252['status'](_0x2d5e70);return _0x44a252[_0x06dc('0x1d')]('Content-Range',_0x32a5ae+'-'+_0x1dd929+'/'+_0x46a57c)[_0x06dc('0x19')](_0x592cb7);}return null;};}function patchUpdates(_0x461b34){return function(_0x1a231b){try{jsonpatch[_0x06dc('0x1e')](_0x1a231b,_0x461b34,!![]);}catch(_0x15d32b){return BPromise['reject'](_0x15d32b);}return _0x1a231b['save']();};}function saveUpdates(_0x591cc3,_0x4dd262){return function(_0x4ab33b){if(_0x4ab33b){return _0x4ab33b[_0x06dc('0x1f')](_0x591cc3)[_0x06dc('0x20')](function(_0x4cee44){return _0x4cee44;});}return null;};}function removeEntity(_0x288d03,_0x411d8f){return function(_0xb6335b){if(_0xb6335b){return _0xb6335b[_0x06dc('0x21')]()['then'](function(){_0x288d03[_0x06dc('0x18')](0xcc)[_0x06dc('0x22')]();});}};}function handleEntityNotFound(_0x3851d5,_0x29d4bf){return function(_0x20f761){if(!_0x20f761){_0x3851d5['sendStatus'](0x194);}return _0x20f761;};}function handleError(_0x53f9a3,_0x2b517c){_0x2b517c=_0x2b517c||0x1f4;return function(_0x387818){logger[_0x06dc('0x23')](_0x387818[_0x06dc('0x24')]);if(_0x387818['name']){delete _0x387818[_0x06dc('0x25')];}_0x53f9a3[_0x06dc('0x18')](_0x2b517c)['send'](_0x387818);};}exports['show']=function(_0x1cf29b,_0x6b3c0c){var _0x4a3e76={'raw':!![],'where':{'id':_0x1cf29b['params']['id']}},_0x46c89b={};_0x46c89b[_0x06dc('0x26')]=_[_0x06dc('0x27')](db[_0x06dc('0x28')][_0x06dc('0x29')]);_0x46c89b[_0x06dc('0x2a')]=_[_0x06dc('0x27')](_0x1cf29b[_0x06dc('0x2a')]);_0x46c89b[_0x06dc('0x2b')]=_['intersection'](_0x46c89b[_0x06dc('0x26')],_0x46c89b[_0x06dc('0x2a')]);_0x4a3e76[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x46c89b[_0x06dc('0x26')],qs[_0x06dc('0x2e')](_0x1cf29b[_0x06dc('0x2a')][_0x06dc('0x2e')]));_0x4a3e76['attributes']=_0x4a3e76['attributes']['length']?_0x4a3e76[_0x06dc('0x2c')]:_0x46c89b[_0x06dc('0x26')];if(_0x1cf29b['query'][_0x06dc('0x2f')]){_0x4a3e76[_0x06dc('0x30')]=[{'all':!![]}];}_0x4a3e76=_[_0x06dc('0x31')]({},_0x4a3e76,_0x1cf29b[_0x06dc('0x32')]);return db[_0x06dc('0x28')][_0x06dc('0x33')](_0x4a3e76)['then'](handleEntityNotFound(_0x6b3c0c,null))[_0x06dc('0x20')](respondWithResult(_0x6b3c0c,null))['catch'](handleError(_0x6b3c0c,null));};exports[_0x06dc('0x34')]=function(_0x51fd61,_0x5f216a){return db['ChatProactiveAction'][_0x06dc('0x34')](_0x51fd61[_0x06dc('0x35')],{})[_0x06dc('0x20')](respondWithResult(_0x5f216a,0xc9))[_0x06dc('0x36')](handleError(_0x5f216a,null));};exports['update']=function(_0x51d2e5,_0x463a56){if(_0x51d2e5[_0x06dc('0x35')]['id']){delete _0x51d2e5['body']['id'];}return db[_0x06dc('0x28')][_0x06dc('0x33')]({'where':{'id':_0x51d2e5[_0x06dc('0x37')]['id']}})['then'](handleEntityNotFound(_0x463a56,null))[_0x06dc('0x20')](saveUpdates(_0x51d2e5[_0x06dc('0x35')],null))['then'](respondWithResult(_0x463a56,null))[_0x06dc('0x36')](handleError(_0x463a56,null));};exports['destroy']=function(_0x4d1e6e,_0x3688ad){return db[_0x06dc('0x28')]['find']({'where':{'id':_0x4d1e6e['params']['id']}})[_0x06dc('0x20')](handleEntityNotFound(_0x3688ad,null))[_0x06dc('0x20')](removeEntity(_0x3688ad,null))['catch'](handleError(_0x3688ad,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 29c6030..7de8f06 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 _0xb73d=['ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x458214,_0x338c28){var _0x11bc59=function(_0x2729ea){while(--_0x2729ea){_0x458214['push'](_0x458214['shift']());}};_0x11bc59(++_0x338c28);}(_0xb73d,0x13a));var _0xdb73=function(_0x6cfbf6,_0x594cf1){_0x6cfbf6=_0x6cfbf6-0x0;var _0x537202=_0xb73d[_0x6cfbf6];return _0x537202;};'use strict';var _=require('lodash');var util=require(_0xdb73('0x0'));var logger=require(_0xdb73('0x1'))(_0xdb73('0x2'));var moment=require(_0xdb73('0x3'));var BPromise=require(_0xdb73('0x4'));var rp=require(_0xdb73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb73('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb73('0x7'));module[_0xdb73('0x8')]=function(_0x227eb8,_0x279b1b){return _0x227eb8[_0xdb73('0x9')](_0xdb73('0xa'),attributes,{'tableName':_0xdb73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x129b=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x2d41b9,_0xc4ceef){var _0x3709d3=function(_0xdfef4){while(--_0xdfef4){_0x2d41b9['push'](_0x2d41b9['shift']());}};_0x3709d3(++_0xc4ceef);}(_0x129b,0x104));var _0xb129=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x129b[_0x79a6e8];return _0xeeb993;};'use strict';var _=require('lodash');var util=require(_0xb129('0x0'));var logger=require(_0xb129('0x1'))(_0xb129('0x2'));var moment=require(_0xb129('0x3'));var BPromise=require('bluebird');var rp=require(_0xb129('0x4'));var fs=require('fs');var path=require(_0xb129('0x5'));var rimraf=require(_0xb129('0x6'));var config=require(_0xb129('0x7'));var attributes=require(_0xb129('0x8'));module[_0xb129('0x9')]=function(_0x5194f9,_0x443af0){return _0x5194f9[_0xb129('0xa')](_0xb129('0xb'),attributes,{'tableName':_0xb129('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 6b91e55..489d8cf 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 _0xf4d4=['then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4d4,0x1af));var _0x4f4d=function(_0x5ca965,_0x494dba){_0x5ca965=_0x5ca965-0x0;var _0x2361b6=_0xf4d4[_0x5ca965];return _0x2361b6;};'use strict';var _=require(_0x4f4d('0x0'));var util=require('util');var moment=require(_0x4f4d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f4d('0x2'));var db=require(_0x4f4d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f4d('0x4'))(_0x4f4d('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f4d('0x6'));var client=jayson[_0x4f4d('0x7')][_0x4f4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5356f3,_0x46ae2e,_0x1e7b1b){return new BPromise(function(_0x3f6bf9,_0x36bafe){return client['request'](_0x5356f3,_0x1e7b1b)[_0x4f4d('0x9')](function(_0x25cf38){logger[_0x4f4d('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x46ae2e,_0x4f4d('0xb'));logger[_0x4f4d('0xc')](_0x4f4d('0xd'),_0x46ae2e,_0x4f4d('0xb'),JSON['stringify'](_0x25cf38));if(_0x25cf38[_0x4f4d('0xe')]){if(_0x25cf38['error'][_0x4f4d('0xf')]===0x1f4){logger[_0x4f4d('0xe')](_0x4f4d('0x10'),_0x46ae2e,_0x25cf38[_0x4f4d('0xe')][_0x4f4d('0x11')]);return _0x36bafe(_0x25cf38[_0x4f4d('0xe')]['message']);}logger[_0x4f4d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x46ae2e,_0x25cf38['error']['message']);return _0x3f6bf9(_0x25cf38[_0x4f4d('0xe')]['message']);}else{logger[_0x4f4d('0xa')](_0x4f4d('0x10'),_0x46ae2e,_0x4f4d('0xb'));_0x3f6bf9(_0x25cf38[_0x4f4d('0x12')][_0x4f4d('0x11')]);}})[_0x4f4d('0x13')](function(_0x19d2ac){logger[_0x4f4d('0xe')](_0x4f4d('0x10'),_0x46ae2e,_0x19d2ac);_0x36bafe(_0x19d2ac);});});} \ No newline at end of file +var _0x0e2b=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x32a84b,_0x231fb6){var _0x3c60dd=function(_0x42ed6a){while(--_0x42ed6a){_0x32a84b['push'](_0x32a84b['shift']());}};_0x3c60dd(++_0x231fb6);}(_0x0e2b,0x122));var _0xb0e2=function(_0x2693ee,_0x3d725b){_0x2693ee=_0x2693ee-0x0;var _0x3d391a=_0x0e2b[_0x2693ee];return _0x3d391a;};'use strict';var _=require(_0xb0e2('0x0'));var util=require('util');var moment=require(_0xb0e2('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0e2('0x2'));var fs=require('fs');var Redis=require(_0xb0e2('0x3'));var db=require(_0xb0e2('0x4'))['db'];var utils=require(_0xb0e2('0x5'));var logger=require('../../config/logger')(_0xb0e2('0x6'));var config=require('../../config/environment');var jayson=require(_0xb0e2('0x7'));var client=jayson[_0xb0e2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a4272,_0x2bf753,_0x14f11f){return new BPromise(function(_0x179a75,_0x5dbc0f){return client[_0xb0e2('0x9')](_0x5a4272,_0x14f11f)[_0xb0e2('0xa')](function(_0xbb3023){logger['info'](_0xb0e2('0xb'),_0x2bf753,_0xb0e2('0xc'));logger[_0xb0e2('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2bf753,'request\x20sent',JSON[_0xb0e2('0xe')](_0xbb3023));if(_0xbb3023[_0xb0e2('0xf')]){if(_0xbb3023[_0xb0e2('0xf')][_0xb0e2('0x10')]===0x1f4){logger['error'](_0xb0e2('0xb'),_0x2bf753,_0xbb3023[_0xb0e2('0xf')][_0xb0e2('0x11')]);return _0x5dbc0f(_0xbb3023[_0xb0e2('0xf')][_0xb0e2('0x11')]);}logger[_0xb0e2('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bf753,_0xbb3023[_0xb0e2('0xf')][_0xb0e2('0x11')]);return _0x179a75(_0xbb3023[_0xb0e2('0xf')][_0xb0e2('0x11')]);}else{logger[_0xb0e2('0x12')](_0xb0e2('0xb'),_0x2bf753,_0xb0e2('0xc'));_0x179a75(_0xbb3023[_0xb0e2('0x13')][_0xb0e2('0x11')]);}})[_0xb0e2('0x14')](function(_0x396be7){logger[_0xb0e2('0xf')](_0xb0e2('0xb'),_0x2bf753,_0x396be7);_0x5dbc0f(_0x396be7);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8168569..130b395 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x25404c,_0x447c31){_0x25404c=_0x25404c-0x0;var _0x43b777=_0xb4c7[_0x25404c];return _0x43b777;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x1e8402,_0x3ca008){var _0x5f07a2=function(_0x2cdcdf){while(--_0x2cdcdf){_0x1e8402['push'](_0x1e8402['shift']());}};_0x5f07a2(++_0x3ca008);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4815cc,_0x22728e){_0x4815cc=_0x4815cc-0x0;var _0x6dc82a=_0x1cb9[_0x4815cc];return _0x6dc82a;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('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 85f2feb..35d5abc 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 _0x3e54=['name','STRING','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x3e54,0x178));var _0x43e5=function(_0x37fcdd,_0x1f3094){_0x37fcdd=_0x37fcdd-0x0;var _0x25da0f=_0x3e54[_0x37fcdd];return _0x25da0f;};'use strict';var Sequelize=require(_0x43e5('0x0'));module[_0x43e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x43e5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x43e5('0x3')]},'timeout':{'type':Sequelize[_0x43e5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x43e5('0x5')]('rrmemory','beepall',_0x43e5('0x6'))}}; \ No newline at end of file +var _0xf8d0=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0xa993c2,_0x5d7109){var _0x43deb1=function(_0x293375){while(--_0x293375){_0xa993c2['push'](_0xa993c2['shift']());}};_0x43deb1(++_0x5d7109);}(_0xf8d0,0x1bb));var _0x0f8d=function(_0x59ce56,_0x56e4dd){_0x59ce56=_0x59ce56-0x0;var _0x4f7764=_0xf8d0[_0x59ce56];return _0x4f7764;};'use strict';var Sequelize=require(_0x0f8d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0f8d('0x1')]},'timeout':{'type':Sequelize[_0x0f8d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0f8d('0x3'),_0x0f8d('0x4'),_0x0f8d('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 98f6c4e..dffc79f 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 _0x3249=['order','sort','pick','ChatQueueId','filter','options','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','format','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','find','sequelize','transaction','each','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','ChatQueues','UserProfileResource','destroy','then','error','stack','name','send','map','rawAttributes','type','getOptions','where','ChatQueue','include','query','rows','catch','params','model','keys','intersection','fields','attributes','length','includeAll','merge','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','filters','nolimit'];(function(_0x164f0b,_0x12d07e){var _0x3ce70e=function(_0x1e42c1){while(--_0x1e42c1){_0x164f0b['push'](_0x164f0b['shift']());}};_0x3ce70e(++_0x12d07e);}(_0x3249,0x1a0));var _0x9324=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x3249[_0xbf8ebe];return _0x1e25e8;};'use strict';var BPromise=require(_0x9324('0x0'));var util=require(_0x9324('0x1'));var _=require(_0x9324('0x2'));var squel=require(_0x9324('0x3'));var Redis=require(_0x9324('0x4'));var qs=require(_0x9324('0x5'));var logger=require(_0x9324('0x6'))(_0x9324('0x7'));var config=require(_0x9324('0x8'));var db=require(_0x9324('0x9'))['db'];config[_0x9324('0xa')]=_[_0x9324('0xb')](config[_0x9324('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9324('0xc'))(new Redis(config[_0x9324('0xa')]));require('./chatQueue.socket')[_0x9324('0xd')](socket);function respondWithStatusCode(_0x106dbf,_0x2f8491){_0x2f8491=_0x2f8491||0xcc;return function(_0x4ffabf){if(_0x4ffabf){return _0x106dbf[_0x9324('0xe')](_0x2f8491);}return _0x106dbf[_0x9324('0xf')](_0x2f8491)[_0x9324('0x10')]();};}function respondWithResult(_0x528005,_0x219067){_0x219067=_0x219067||0xc8;return function(_0x20484b){if(_0x20484b){return _0x528005[_0x9324('0xf')](_0x219067)[_0x9324('0x11')](_0x20484b);}};}function respondWithFilteredResult(_0x40e06e,_0x35bbf4){return function(_0x114e44){if(_0x114e44){var _0x50c3bc=typeof _0x35bbf4[_0x9324('0x12')]===_0x9324('0x13')&&typeof _0x35bbf4[_0x9324('0x14')]==='undefined';var _0x20d1aa=_0x114e44['count'];var _0x2846e1=_0x50c3bc?0x0:_0x35bbf4[_0x9324('0x12')];var _0x3c4443=_0x50c3bc?_0x114e44[_0x9324('0x15')]:_0x35bbf4[_0x9324('0x12')]+_0x35bbf4[_0x9324('0x14')];var _0x1195a3;if(_0x3c4443>=_0x20d1aa){_0x3c4443=_0x20d1aa;_0x1195a3=0xc8;}else{_0x1195a3=0xce;}_0x40e06e[_0x9324('0xf')](_0x1195a3);return _0x40e06e[_0x9324('0x16')]('Content-Range',_0x2846e1+'-'+_0x3c4443+'/'+_0x20d1aa)[_0x9324('0x11')](_0x114e44);}return null;};}function saveUpdates(_0xd9f7f6){return function(_0x1fadce){if(_0x1fadce){return _0x1fadce['update'](_0xd9f7f6)['then'](function(_0x54aba5){return _0x54aba5;});}return null;};}function removeEntity(_0x1f988b){return function(_0xb43306){if(_0xb43306){return _0xb43306['destroy']()['then'](function(){var _0x3e7e66=_0xb43306['get']({'plain':!![]});var _0x5a7300=_0x9324('0x17');return db[_0x9324('0x18')][_0x9324('0x19')]({'where':{'type':_0x5a7300,'resourceId':_0x3e7e66['id']}})[_0x9324('0x1a')](function(){return _0xb43306;});})[_0x9324('0x1a')](function(){_0x1f988b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x295194){return function(_0x747b66){if(!_0x747b66){_0x295194['sendStatus'](0x194);}return _0x747b66;};}function handleError(_0x5ed906,_0x670c93){_0x670c93=_0x670c93||0x1f4;return function(_0x566111){logger[_0x9324('0x1b')](_0x566111[_0x9324('0x1c')]);if(_0x566111[_0x9324('0x1d')]){delete _0x566111[_0x9324('0x1d')];}_0x5ed906[_0x9324('0xf')](_0x670c93)[_0x9324('0x1e')](_0x566111);};}exports['index']=function(_0x37ab3e,_0x299a7a){var _0x20cc75={};var _0xe8e0f9={'count':0x0,'rows':[]};var _0x19d859=_[_0x9324('0x1f')](db['ChatQueue'][_0x9324('0x20')],function(_0x31d567){return{'name':_0x31d567['fieldName'],'type':_0x31d567[_0x9324('0x21')]['key']};});_0x20cc75=qs[_0x9324('0x22')](_0x19d859,_0x37ab3e);var _0x12fe52={'where':_0x20cc75[_0x9324('0x23')]};return db[_0x9324('0x24')][_0x9324('0x15')](_0x12fe52)['then'](function(_0x53ab59){_0xe8e0f9[_0x9324('0x15')]=_0x53ab59;_0x20cc75[_0x9324('0x25')]=qs[_0x9324('0x25')](_0x37ab3e[_0x9324('0x26')]);return db[_0x9324('0x24')]['findAll'](_0x20cc75);})[_0x9324('0x1a')](function(_0x2c4795){_0xe8e0f9[_0x9324('0x27')]=_0x2c4795;return _0xe8e0f9;})[_0x9324('0x1a')](respondWithFilteredResult(_0x299a7a,_0x20cc75))[_0x9324('0x28')](handleError(_0x299a7a,null));};exports['show']=function(_0x2972e6,_0x38eaac){var _0x21db6c={'raw':!![],'where':{'id':_0x2972e6[_0x9324('0x29')]['id']}},_0x522f50={};_0x522f50[_0x9324('0x2a')]=_[_0x9324('0x2b')](db[_0x9324('0x24')]['rawAttributes']);_0x522f50['query']=_['keys'](_0x2972e6[_0x9324('0x26')]);_0x522f50['filters']=_[_0x9324('0x2c')](_0x522f50[_0x9324('0x2a')],_0x522f50[_0x9324('0x26')]);_0x21db6c['attributes']=_[_0x9324('0x2c')](_0x522f50[_0x9324('0x2a')],qs[_0x9324('0x2d')](_0x2972e6['query'][_0x9324('0x2d')]));_0x21db6c['attributes']=_0x21db6c[_0x9324('0x2e')][_0x9324('0x2f')]?_0x21db6c[_0x9324('0x2e')]:_0x522f50[_0x9324('0x2a')];if(_0x2972e6[_0x9324('0x26')][_0x9324('0x30')]){_0x21db6c[_0x9324('0x25')]=[{'all':!![]}];}_0x21db6c=_[_0x9324('0x31')]({},_0x21db6c,_0x2972e6['options']);return db[_0x9324('0x24')]['find'](_0x21db6c)[_0x9324('0x1a')](handleEntityNotFound(_0x38eaac,null))[_0x9324('0x1a')](respondWithResult(_0x38eaac,null))[_0x9324('0x28')](handleError(_0x38eaac,null));};exports[_0x9324('0x32')]=function(_0x65c307,_0x3a8736){return db['ChatQueue'][_0x9324('0x32')](_0x65c307['body'],{})[_0x9324('0x1a')](function(_0x312a7d){var _0x21ae82=_0x65c307['user'][_0x9324('0x33')]({'plain':!![]});if(!_0x21ae82)throw new Error(_0x9324('0x34'));if(_0x21ae82[_0x9324('0x35')]===_0x9324('0x36')){var _0x4df713=_0x312a7d['get']({'plain':!![]});var _0x4c89d1='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4c89d1,'userProfileId':_0x21ae82[_0x9324('0x37')]},'raw':!![]})['then'](function(_0x26d020){if(_0x26d020&&_0x26d020[_0x9324('0x38')]===0x0){return db[_0x9324('0x18')][_0x9324('0x32')]({'name':_0x4df713[_0x9324('0x1d')],'resourceId':_0x4df713['id'],'type':_0x26d020[_0x9324('0x1d')],'sectionId':_0x26d020['id']},{})[_0x9324('0x1a')](function(){return _0x312a7d;});}else{return _0x312a7d;}})[_0x9324('0x28')](function(_0x1443b1){logger[_0x9324('0x1b')](_0x9324('0x39'),_0x1443b1);throw _0x1443b1;});}return _0x312a7d;})[_0x9324('0x1a')](respondWithResult(_0x3a8736,0xc9))[_0x9324('0x28')](handleError(_0x3a8736,null));};exports['update']=function(_0x2520ab,_0x1a0fe9){if(_0x2520ab['body']['id']){delete _0x2520ab[_0x9324('0x3a')]['id'];}return db[_0x9324('0x24')]['find']({'where':{'id':_0x2520ab[_0x9324('0x29')]['id']}})['then'](handleEntityNotFound(_0x1a0fe9,null))[_0x9324('0x1a')](saveUpdates(_0x2520ab[_0x9324('0x3a')],null))[_0x9324('0x1a')](respondWithResult(_0x1a0fe9,null))[_0x9324('0x28')](handleError(_0x1a0fe9,null));};exports[_0x9324('0x19')]=function(_0x490f76,_0x1210a7){return db[_0x9324('0x24')]['find']({'where':{'id':_0x490f76[_0x9324('0x29')]['id']}})[_0x9324('0x1a')](handleEntityNotFound(_0x1210a7,null))[_0x9324('0x1a')](removeEntity(_0x1210a7,null))[_0x9324('0x28')](handleError(_0x1210a7,null));};exports[_0x9324('0x3b')]=function(_0x60c7f4,_0x7b7482){return db[_0x9324('0x24')][_0x9324('0x3b')]()['then'](respondWithResult(_0x7b7482,null))[_0x9324('0x28')](handleError(_0x7b7482,null));};exports[_0x9324('0x3c')]=function(_0x3d29a0,_0x5aa6db){var _0x8a8786={'raw':!![],'where':{}},_0x24f376={},_0x5f5204;return db[_0x9324('0x24')]['findOne']({'where':{'id':_0x3d29a0[_0x9324('0x29')]['id']}})['then'](handleEntityNotFound(_0x5aa6db,null))[_0x9324('0x1a')](function(_0x3266cc){if(_0x3266cc){_0x5f5204=_0x3266cc['get']({'plain':!![]});_0x24f376[_0x9324('0x2a')]=_[_0x9324('0x2b')](db[_0x9324('0x3d')]['rawAttributes']);_0x24f376[_0x9324('0x26')]=_[_0x9324('0x2b')](_0x3d29a0[_0x9324('0x26')]);_0x24f376[_0x9324('0x3e')]=_['intersection'](_0x24f376[_0x9324('0x2a')],_0x24f376['query']);_0x8a8786[_0x9324('0x2e')]=_['intersection'](_0x24f376[_0x9324('0x2a')],qs['fields'](_0x3d29a0['query']['fields']));_0x8a8786['attributes']=_0x8a8786[_0x9324('0x2e')][_0x9324('0x2f')]?_0x8a8786[_0x9324('0x2e')]:_0x24f376[_0x9324('0x2a')];if(!_0x3d29a0[_0x9324('0x26')]['hasOwnProperty'](_0x9324('0x3f'))){_0x8a8786[_0x9324('0x14')]=qs[_0x9324('0x14')](_0x3d29a0['query'][_0x9324('0x14')]);_0x8a8786[_0x9324('0x12')]=qs[_0x9324('0x12')](_0x3d29a0[_0x9324('0x26')]['offset']);}_0x8a8786[_0x9324('0x40')]=qs[_0x9324('0x41')](_0x3d29a0[_0x9324('0x26')]['sort']);_0x8a8786[_0x9324('0x23')]=qs[_0x9324('0x3e')](_[_0x9324('0x42')](_0x3d29a0['query'],_0x24f376[_0x9324('0x3e')]));_0x8a8786[_0x9324('0x23')][_0x9324('0x43')]=_0x3266cc['id'];if(_0x3d29a0['query'][_0x9324('0x44')]){_0x8a8786[_0x9324('0x23')]=_[_0x9324('0x31')](_0x8a8786[_0x9324('0x23')],{'$or':_[_0x9324('0x1f')](_0x8a8786[_0x9324('0x2e')],function(_0x2a4ee5){var _0x58be51={};_0x58be51[_0x2a4ee5]={'$like':'%'+_0x3d29a0[_0x9324('0x26')][_0x9324('0x44')]+'%'};return _0x58be51;})});}_0x8a8786=_[_0x9324('0x31')]({},_0x8a8786,_0x3d29a0[_0x9324('0x45')]);return db[_0x9324('0x3d')][_0x9324('0x46')](_0x8a8786);}})[_0x9324('0x1a')](function(_0x405d1a){if(_0x405d1a){return db['User'][_0x9324('0x47')]({'where':{'id':_[_0x9324('0x1f')](_0x405d1a,_0x9324('0x48')),'role':_0x9324('0x49')},'attributes':['id',_0x9324('0x1d'),_0x9324('0x4a'),_0x9324('0x4b'),'createdAt']});}})[_0x9324('0x1a')](function(_0x35abf7){if(_0x35abf7){return{'count':_0x35abf7[_0x9324('0x15')],'rows':_['map'](_0x35abf7[_0x9324('0x27')],function(_0x135a19){return{'membername':_0x135a19[_0x9324('0x1d')],'UserId':_0x135a19['id'],'queue_name':_0x5f5204['name'],'ChatQueueId':_0x5f5204['id'],'interface':util[_0x9324('0x4c')]('%s/%s',_0x9324('0x4d'),_0x135a19[_0x9324('0x1d')]),'penalty':0x0,'paused':_0x135a19[_0x9324('0x4a')],'createdAt':_0x135a19['createdAt'],'updatedAt':_0x135a19['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9324('0x1a')](respondWithFilteredResult(_0x5aa6db,_0x8a8786))[_0x9324('0x28')](handleError(_0x5aa6db,null));};exports[_0x9324('0x4e')]=function(_0x349cf4,_0x494074){var _0x2b5a82={};var _0x542b81={};var _0x235313;var _0x3d0c9d;return db[_0x9324('0x24')][_0x9324('0x4f')]({'where':{'id':_0x349cf4[_0x9324('0x29')]['id']}})['then'](handleEntityNotFound(_0x494074,null))['then'](function(_0x4347a2){if(_0x4347a2){_0x235313=_0x4347a2;_0x542b81[_0x9324('0x2a')]=_[_0x9324('0x2b')](db[_0x9324('0x50')][_0x9324('0x20')]);_0x542b81['query']=_[_0x9324('0x2b')](_0x349cf4[_0x9324('0x26')]);_0x542b81[_0x9324('0x3e')]=_[_0x9324('0x2c')](_0x542b81['model'],_0x542b81[_0x9324('0x26')]);_0x2b5a82[_0x9324('0x2e')]=_['intersection'](_0x542b81['model'],qs[_0x9324('0x2d')](_0x349cf4['query'][_0x9324('0x2d')]));_0x2b5a82['attributes']=_0x2b5a82[_0x9324('0x2e')][_0x9324('0x2f')]?_0x2b5a82['attributes']:_0x542b81[_0x9324('0x2a')];_0x2b5a82['order']=qs[_0x9324('0x41')](_0x349cf4[_0x9324('0x26')][_0x9324('0x41')]);_0x2b5a82['where']=qs['filters'](_[_0x9324('0x42')](_0x349cf4[_0x9324('0x26')],_0x542b81['filters']));if(_0x349cf4['query'][_0x9324('0x44')]){_0x2b5a82[_0x9324('0x23')]=_[_0x9324('0x31')](_0x2b5a82[_0x9324('0x23')],{'$or':_['map'](_0x2b5a82['attributes'],function(_0x15f0f7){var _0x463a3d={};_0x463a3d[_0x15f0f7]={'$like':'%'+_0x349cf4[_0x9324('0x26')][_0x9324('0x44')]+'%'};return _0x463a3d;})});}_0x2b5a82=_['merge']({},_0x2b5a82,_0x349cf4[_0x9324('0x45')]);return _0x235313[_0x9324('0x4e')](_0x2b5a82);}})[_0x9324('0x1a')](function(_0x41d49b){if(_0x41d49b){_0x3d0c9d=_0x41d49b[_0x9324('0x2f')];if(!_0x349cf4['query']['hasOwnProperty'](_0x9324('0x3f'))){_0x2b5a82[_0x9324('0x14')]=qs[_0x9324('0x14')](_0x349cf4[_0x9324('0x26')]['limit']);_0x2b5a82[_0x9324('0x12')]=qs[_0x9324('0x12')](_0x349cf4['query'][_0x9324('0x12')]);}return _0x235313[_0x9324('0x4e')](_0x2b5a82);}})[_0x9324('0x1a')](function(_0x2f1f16){if(_0x2f1f16){return _0x2f1f16?{'count':_0x3d0c9d,'rows':_0x2f1f16}:null;}})['then'](respondWithResult(_0x494074,null))[_0x9324('0x28')](handleError(_0x494074,null));};exports[_0x9324('0x51')]=function(_0x510aec,_0x2d20e2){var _0x376dac=_0x510aec[_0x9324('0x3a')][_0x9324('0x52')];return db[_0x9324('0x50')]['findAll']({'where':{'id':_0x376dac},'attributes':['id'],'include':[{'model':db[_0x9324('0x53')],'as':_0x9324('0x54'),'attributes':['id',_0x9324('0x1d'),_0x9324('0x55'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x29607b){if(_0x29607b){var _0x30a533=_['flatMap'](_0x29607b,function(_0x1c9312){var _0x2d9d53=_0x1c9312[_0x9324('0x33')]({'plain':!![]});return _0x2d9d53['Agents'];});return db['ChatQueue'][_0x9324('0x56')]({'where':{'id':_0x510aec[_0x9324('0x29')]['id']}})['then'](function(_0x46a54c){return db[_0x9324('0x57')][_0x9324('0x58')](function(_0x37e26a){return _0x46a54c[_0x9324('0x51')](_0x376dac,{'transaction':_0x37e26a})[_0x9324('0x1a')](function(){return BPromise[_0x9324('0x59')](_0x30a533,function(_0x54aebf){return db[_0x9324('0x3d')]['findOrCreate']({'where':{'UserId':_0x54aebf['id'],'ChatQueueId':_0x510aec[_0x9324('0x29')]['id']},'transaction':_0x37e26a});});})['then'](function(){_0x30a533['forEach'](function(_0x3e734c){socket[_0x9324('0x5a')](_0x9324('0x5b'),{'UserId':_0x3e734c['id'],'ChatQueueId':_0x46a54c['id']});});});});});}})[_0x9324('0x1a')](respondWithStatusCode(_0x2d20e2,null))[_0x9324('0x28')](handleError(_0x2d20e2,null));};exports[_0x9324('0x5c')]=function(_0x479380,_0x7abee8){return db[_0x9324('0x50')][_0x9324('0x46')]({'where':{'id':_0x479380[_0x9324('0x26')][_0x9324('0x52')]},'attributes':['id'],'include':[{'model':db[_0x9324('0x53')],'as':_0x9324('0x54'),'attributes':['id'],'raw':!![]}]})[_0x9324('0x1a')](handleEntityNotFound(_0x7abee8,null))[_0x9324('0x1a')](function(_0x42270e){var _0x1fa1e4=_[_0x9324('0x1f')](_0x42270e,'id');var _0x26525e=[];var _0x4b303f=[];var _0x2dc333=squel[_0x9324('0x5d')]();_0x2dc333[_0x9324('0x5e')](_0x9324('0x5f'))[_0x9324('0x60')](_0x9324('0x61'),'tq')[_0x9324('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9324('0x23')](_0x9324('0x63'),_0x479380[_0x9324('0x29')]['id']);for(var _0xce04f1=0x0;_0xce04f1<_0x42270e[_0x9324('0x2f')];_0xce04f1+=0x1){let _0x57bb62=_0x42270e[_0xce04f1];for(var _0x478b21=0x0;_0x478b21<_0x57bb62[_0x9324('0x54')][_0x9324('0x2f')];_0x478b21+=0x1){let _0x932447=_0x57bb62[_0x9324('0x54')][_0x478b21];var _0x44f57c=_0x2dc333[_0x9324('0x64')]();_0x44f57c['where'](_0x9324('0x65'),_0x932447['id']);_0x4b303f[_0x9324('0x66')](db[_0x9324('0x57')][_0x9324('0x26')](_0x44f57c[_0x9324('0x67')](),{'type':db[_0x9324('0x57')]['QueryTypes']['SELECT']})['then'](function(_0x5f30a5){if(_0x5f30a5[_0x9324('0x2f')]===0x1){return _0x932447['id'];}else{var _0x54af56=_[_0x9324('0x68')](_[_0x9324('0x1f')](_0x5f30a5,_0x9324('0x69')),function(_0x2a8314){return _[_0x9324('0x6a')](_0x1fa1e4,_0x2a8314);});if(_0x54af56){return _0x932447['id'];}}}));}}return BPromise[_0x9324('0x6b')](_0x4b303f)[_0x9324('0x1a')](function(_0x61cab5){_0x26525e=_(_0x26525e)[_0x9324('0x6c')](_0x61cab5)[_0x9324('0x6d')]()[_0x9324('0x6e')]();return db[_0x9324('0x24')][_0x9324('0x56')]({'where':{'id':_0x479380[_0x9324('0x29')]['id']}})[_0x9324('0x1a')](function(_0x6524dd){return db['sequelize'][_0x9324('0x58')](function(_0x3c1ff8){return _0x6524dd[_0x9324('0x5c')](_0x479380[_0x9324('0x26')][_0x9324('0x52')],{'transaction':_0x3c1ff8})[_0x9324('0x1a')](function(){if(!_['isEmpty'](_0x26525e)){return _0x6524dd[_0x9324('0x6f')](_0x26525e,{'transaction':_0x3c1ff8});}})['then'](function(){_0x26525e[_0x9324('0x70')](function(_0x511be1){socket[_0x9324('0x5a')](_0x9324('0x71'),{'UserId':_0x511be1,'ChatQueueId':_0x6524dd['id']});});});});});});})[_0x9324('0x1a')](respondWithStatusCode(_0x7abee8,null))[_0x9324('0x28')](handleError(_0x7abee8,null));};exports[_0x9324('0x72')]=function(_0xa677e1,_0x4f1f2a){return db['ChatQueue'][_0x9324('0x56')]({'where':{'id':_0xa677e1[_0x9324('0x29')]['id']}})['then'](handleEntityNotFound(_0x4f1f2a,null))[_0x9324('0x1a')](function(_0x5a27bc){if(_0x5a27bc){return _0x5a27bc['addAgents'](_0xa677e1['body']['ids'],_[_0x9324('0x73')](_0xa677e1['body'],['ids','id'])||{})[_0x9324('0x74')](function(_0x28006b){for(var _0x160c91=0x0;_0x160c91<_0xa677e1['body'][_0x9324('0x52')]['length'];_0x160c91+=0x1){socket[_0x9324('0x5a')](_0x9324('0x5b'),{'UserId':Number(_0xa677e1['body'][_0x9324('0x52')][_0x160c91]),'ChatQueueId':Number(_0xa677e1['params']['id'])});}return _0x28006b;});}})['then'](respondWithResult(_0x4f1f2a,null))['catch'](handleError(_0x4f1f2a,null));};exports['removeAgents']=function(_0x5345a5,_0x38ae2c){return db[_0x9324('0x24')][_0x9324('0x56')]({'where':{'id':_0x5345a5[_0x9324('0x29')]['id']}})[_0x9324('0x1a')](handleEntityNotFound(_0x38ae2c,null))[_0x9324('0x1a')](function(_0x52d052){if(_0x52d052){return _0x52d052[_0x9324('0x6f')](_0x5345a5['query']['ids'])[_0x9324('0x1a')](function(){if(_[_0x9324('0x75')](_0x5345a5[_0x9324('0x26')]['ids'])){for(var _0x4a4b9a=0x0;_0x4a4b9a<_0x5345a5['query']['ids'][_0x9324('0x2f')];_0x4a4b9a+=0x1){socket[_0x9324('0x5a')](_0x9324('0x71'),{'UserId':Number(_0x5345a5['query'][_0x9324('0x52')][_0x4a4b9a]),'ChatQueueId':Number(_0x5345a5[_0x9324('0x29')]['id'])});}}else{socket[_0x9324('0x5a')]('userChatQueue:remove',{'UserId':Number(_0x5345a5['query'][_0x9324('0x52')]),'ChatQueueId':Number(_0x5345a5['params']['id'])});}});}})[_0x9324('0x1a')](respondWithStatusCode(_0x38ae2c,null))[_0x9324('0x28')](handleError(_0x38ae2c,null));};exports[_0x9324('0x76')]=function(_0x1efb5b,_0x38e205){var _0x2c0523={};var _0x5bb583={};var _0x355030;var _0x297d1e;return db[_0x9324('0x24')][_0x9324('0x4f')]({'where':{'id':_0x1efb5b[_0x9324('0x29')]['id']}})[_0x9324('0x1a')](handleEntityNotFound(_0x38e205,null))[_0x9324('0x1a')](function(_0x24092b){if(_0x24092b){_0x355030=_0x24092b;_0x5bb583[_0x9324('0x2a')]=_[_0x9324('0x2b')](db[_0x9324('0x53')][_0x9324('0x20')]);_0x5bb583[_0x9324('0x26')]=_[_0x9324('0x2b')](_0x1efb5b[_0x9324('0x26')]);_0x5bb583['filters']=_[_0x9324('0x2c')](_0x5bb583[_0x9324('0x2a')],_0x5bb583[_0x9324('0x26')]);_0x2c0523[_0x9324('0x2e')]=_['intersection'](_0x5bb583['model'],qs[_0x9324('0x2d')](_0x1efb5b[_0x9324('0x26')][_0x9324('0x2d')]));_0x2c0523[_0x9324('0x2e')]=_0x2c0523[_0x9324('0x2e')][_0x9324('0x2f')]?_0x2c0523['attributes']:_0x5bb583['model'];_0x2c0523['order']=qs[_0x9324('0x41')](_0x1efb5b[_0x9324('0x26')]['sort']);_0x2c0523[_0x9324('0x23')]=qs[_0x9324('0x3e')](_[_0x9324('0x42')](_0x1efb5b['query'],_0x5bb583['filters']));if(_0x1efb5b[_0x9324('0x26')][_0x9324('0x44')]){_0x2c0523[_0x9324('0x23')]=_[_0x9324('0x31')](_0x2c0523[_0x9324('0x23')],{'$or':_[_0x9324('0x1f')](_0x2c0523[_0x9324('0x2e')],function(_0x5033ce){var _0x5b2884={};_0x5b2884[_0x5033ce]={'$like':'%'+_0x1efb5b[_0x9324('0x26')]['filter']+'%'};return _0x5b2884;})});}_0x2c0523=_[_0x9324('0x31')]({},_0x2c0523,_0x1efb5b[_0x9324('0x45')]);return _0x355030[_0x9324('0x76')](_0x2c0523);}})[_0x9324('0x1a')](function(_0x47272b){if(_0x47272b){_0x297d1e=_0x47272b[_0x9324('0x2f')];if(!_0x1efb5b[_0x9324('0x26')][_0x9324('0x77')](_0x9324('0x3f'))){_0x2c0523[_0x9324('0x14')]=qs[_0x9324('0x14')](_0x1efb5b[_0x9324('0x26')][_0x9324('0x14')]);_0x2c0523[_0x9324('0x12')]=qs[_0x9324('0x12')](_0x1efb5b[_0x9324('0x26')][_0x9324('0x12')]);}return _0x355030[_0x9324('0x76')](_0x2c0523);}})['then'](function(_0x5df533){if(_0x5df533){return _0x5df533?{'count':_0x297d1e,'rows':_0x5df533}:null;}})['then'](respondWithResult(_0x38e205,null))['catch'](handleError(_0x38e205,null));}; \ No newline at end of file +var _0xa1a0=['length','includeAll','merge','find','create','body','user','get','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','order','where','options','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','SIP','createdAt','getTeams','sort','pick','filter','hasOwnProperty','nolimit','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','sequelize','SELECT','every','TeamId','union','compact','value','transaction','forEach','addAgents','spread','removeAgents','userChatQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','UserProfileResource','end','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','params','model','keys','intersection','fields','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1a0,0xbc));var _0x0a1a=function(_0x54e856,_0x313d5c){_0x54e856=_0x54e856-0x0;var _0x124873=_0xa1a0[_0x54e856];return _0x124873;};'use strict';var BPromise=require(_0x0a1a('0x0'));var util=require('util');var _=require(_0x0a1a('0x1'));var squel=require(_0x0a1a('0x2'));var Redis=require(_0x0a1a('0x3'));var qs=require(_0x0a1a('0x4'));var logger=require(_0x0a1a('0x5'))(_0x0a1a('0x6'));var config=require(_0x0a1a('0x7'));var db=require(_0x0a1a('0x8'))['db'];config['redis']=_[_0x0a1a('0x9')](config[_0x0a1a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a1a('0xb'))(new Redis(config['redis']));require(_0x0a1a('0xc'))[_0x0a1a('0xd')](socket);function respondWithStatusCode(_0x925f28,_0x2992ec){_0x2992ec=_0x2992ec||0xcc;return function(_0x1f48c3){if(_0x1f48c3){return _0x925f28[_0x0a1a('0xe')](_0x2992ec);}return _0x925f28[_0x0a1a('0xf')](_0x2992ec)['end']();};}function respondWithResult(_0x5b8744,_0x5c4c8a){_0x5c4c8a=_0x5c4c8a||0xc8;return function(_0x2c5deb){if(_0x2c5deb){return _0x5b8744['status'](_0x5c4c8a)['json'](_0x2c5deb);}};}function respondWithFilteredResult(_0x522582,_0x21acf1){return function(_0x1b6f71){if(_0x1b6f71){var _0x4b8411=typeof _0x21acf1[_0x0a1a('0x10')]===_0x0a1a('0x11')&&typeof _0x21acf1[_0x0a1a('0x12')]===_0x0a1a('0x11');var _0x587860=_0x1b6f71[_0x0a1a('0x13')];var _0xbc8d39=_0x4b8411?0x0:_0x21acf1[_0x0a1a('0x10')];var _0x3011ae=_0x4b8411?_0x1b6f71['count']:_0x21acf1[_0x0a1a('0x10')]+_0x21acf1[_0x0a1a('0x12')];var _0x3ee676;if(_0x3011ae>=_0x587860){_0x3011ae=_0x587860;_0x3ee676=0xc8;}else{_0x3ee676=0xce;}_0x522582['status'](_0x3ee676);return _0x522582[_0x0a1a('0x14')]('Content-Range',_0xbc8d39+'-'+_0x3011ae+'/'+_0x587860)[_0x0a1a('0x15')](_0x1b6f71);}return null;};}function saveUpdates(_0x1ce9a0){return function(_0x4a0dad){if(_0x4a0dad){return _0x4a0dad[_0x0a1a('0x16')](_0x1ce9a0)[_0x0a1a('0x17')](function(_0x2f7831){return _0x2f7831;});}return null;};}function removeEntity(_0x3888a6){return function(_0x3cbfa2){if(_0x3cbfa2){return _0x3cbfa2[_0x0a1a('0x18')]()['then'](function(){var _0x82f13f=_0x3cbfa2['get']({'plain':!![]});var _0x3dbe66='ChatQueues';return db[_0x0a1a('0x19')][_0x0a1a('0x18')]({'where':{'type':_0x3dbe66,'resourceId':_0x82f13f['id']}})[_0x0a1a('0x17')](function(){return _0x3cbfa2;});})[_0x0a1a('0x17')](function(){_0x3888a6['status'](0xcc)[_0x0a1a('0x1a')]();});}};}function handleEntityNotFound(_0x43885e){return function(_0x4fcf6a){if(!_0x4fcf6a){_0x43885e[_0x0a1a('0xe')](0x194);}return _0x4fcf6a;};}function handleError(_0x1f31c4,_0x58fea6){_0x58fea6=_0x58fea6||0x1f4;return function(_0x29dba6){logger[_0x0a1a('0x1b')](_0x29dba6['stack']);if(_0x29dba6[_0x0a1a('0x1c')]){delete _0x29dba6[_0x0a1a('0x1c')];}_0x1f31c4[_0x0a1a('0xf')](_0x58fea6)[_0x0a1a('0x1d')](_0x29dba6);};}exports[_0x0a1a('0x1e')]=function(_0x504f7e,_0x1c090a){var _0x1b1b11={};var _0x354dde={'count':0x0,'rows':[]};var _0x2a31c6=_[_0x0a1a('0x1f')](db[_0x0a1a('0x20')][_0x0a1a('0x21')],function(_0x33dae3){return{'name':_0x33dae3[_0x0a1a('0x22')],'type':_0x33dae3[_0x0a1a('0x23')][_0x0a1a('0x24')]};});_0x1b1b11=qs[_0x0a1a('0x25')](_0x2a31c6,_0x504f7e);var _0x1461f8={'where':_0x1b1b11['where']};return db[_0x0a1a('0x20')]['count'](_0x1461f8)[_0x0a1a('0x17')](function(_0x47d597){_0x354dde[_0x0a1a('0x13')]=_0x47d597;_0x1b1b11[_0x0a1a('0x26')]=qs[_0x0a1a('0x26')](_0x504f7e[_0x0a1a('0x27')]);return db[_0x0a1a('0x20')]['findAll'](_0x1b1b11);})[_0x0a1a('0x17')](function(_0x5948e7){_0x354dde[_0x0a1a('0x28')]=_0x5948e7;return _0x354dde;})[_0x0a1a('0x17')](respondWithFilteredResult(_0x1c090a,_0x1b1b11))[_0x0a1a('0x29')](handleError(_0x1c090a,null));};exports['show']=function(_0xef457c,_0x39562a){var _0x464d80={'raw':!![],'where':{'id':_0xef457c[_0x0a1a('0x2a')]['id']}},_0x3edf40={};_0x3edf40[_0x0a1a('0x2b')]=_[_0x0a1a('0x2c')](db['ChatQueue'][_0x0a1a('0x21')]);_0x3edf40[_0x0a1a('0x27')]=_[_0x0a1a('0x2c')](_0xef457c[_0x0a1a('0x27')]);_0x3edf40['filters']=_[_0x0a1a('0x2d')](_0x3edf40[_0x0a1a('0x2b')],_0x3edf40[_0x0a1a('0x27')]);_0x464d80['attributes']=_[_0x0a1a('0x2d')](_0x3edf40['model'],qs['fields'](_0xef457c[_0x0a1a('0x27')][_0x0a1a('0x2e')]));_0x464d80[_0x0a1a('0x2f')]=_0x464d80[_0x0a1a('0x2f')][_0x0a1a('0x30')]?_0x464d80[_0x0a1a('0x2f')]:_0x3edf40[_0x0a1a('0x2b')];if(_0xef457c[_0x0a1a('0x27')][_0x0a1a('0x31')]){_0x464d80[_0x0a1a('0x26')]=[{'all':!![]}];}_0x464d80=_[_0x0a1a('0x32')]({},_0x464d80,_0xef457c['options']);return db[_0x0a1a('0x20')][_0x0a1a('0x33')](_0x464d80)[_0x0a1a('0x17')](handleEntityNotFound(_0x39562a,null))[_0x0a1a('0x17')](respondWithResult(_0x39562a,null))[_0x0a1a('0x29')](handleError(_0x39562a,null));};exports[_0x0a1a('0x34')]=function(_0x417932,_0x2ea716){return db['ChatQueue'][_0x0a1a('0x34')](_0x417932[_0x0a1a('0x35')],{})['then'](function(_0xef275b){var _0x4317c2=_0x417932[_0x0a1a('0x36')][_0x0a1a('0x37')]({'plain':!![]});if(!_0x4317c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4317c2[_0x0a1a('0x38')]===_0x0a1a('0x36')){var _0x20bd01=_0xef275b['get']({'plain':!![]});var _0x1357d4=_0x0a1a('0x39');return db[_0x0a1a('0x3a')][_0x0a1a('0x33')]({'where':{'name':_0x1357d4,'userProfileId':_0x4317c2[_0x0a1a('0x3b')]},'raw':!![]})['then'](function(_0x3f79fe){if(_0x3f79fe&&_0x3f79fe[_0x0a1a('0x3c')]===0x0){return db[_0x0a1a('0x19')]['create']({'name':_0x20bd01['name'],'resourceId':_0x20bd01['id'],'type':_0x3f79fe[_0x0a1a('0x1c')],'sectionId':_0x3f79fe['id']},{})[_0x0a1a('0x17')](function(){return _0xef275b;});}else{return _0xef275b;}})[_0x0a1a('0x29')](function(_0xd998a9){logger[_0x0a1a('0x1b')](_0x0a1a('0x3d'),_0xd998a9);throw _0xd998a9;});}return _0xef275b;})[_0x0a1a('0x17')](respondWithResult(_0x2ea716,0xc9))[_0x0a1a('0x29')](handleError(_0x2ea716,null));};exports[_0x0a1a('0x16')]=function(_0x52f34c,_0x2ebb75){if(_0x52f34c[_0x0a1a('0x35')]['id']){delete _0x52f34c[_0x0a1a('0x35')]['id'];}return db[_0x0a1a('0x20')][_0x0a1a('0x33')]({'where':{'id':_0x52f34c['params']['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x2ebb75,null))[_0x0a1a('0x17')](saveUpdates(_0x52f34c[_0x0a1a('0x35')],null))[_0x0a1a('0x17')](respondWithResult(_0x2ebb75,null))[_0x0a1a('0x29')](handleError(_0x2ebb75,null));};exports[_0x0a1a('0x18')]=function(_0x4e979a,_0x5b5843){return db[_0x0a1a('0x20')][_0x0a1a('0x33')]({'where':{'id':_0x4e979a[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x5b5843,null))[_0x0a1a('0x17')](removeEntity(_0x5b5843,null))[_0x0a1a('0x29')](handleError(_0x5b5843,null));};exports[_0x0a1a('0x3e')]=function(_0x1b45f9,_0x2fa5e8){return db[_0x0a1a('0x20')][_0x0a1a('0x3e')]()[_0x0a1a('0x17')](respondWithResult(_0x2fa5e8,null))[_0x0a1a('0x29')](handleError(_0x2fa5e8,null));};exports[_0x0a1a('0x3f')]=function(_0x2132e2,_0x54a503){var _0x39339d={'raw':!![],'where':{}},_0x577c24={},_0x43ae94;return db['ChatQueue'][_0x0a1a('0x40')]({'where':{'id':_0x2132e2[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x54a503,null))[_0x0a1a('0x17')](function(_0x229092){if(_0x229092){_0x43ae94=_0x229092[_0x0a1a('0x37')]({'plain':!![]});_0x577c24[_0x0a1a('0x2b')]=_[_0x0a1a('0x2c')](db['UserChatQueue'][_0x0a1a('0x21')]);_0x577c24[_0x0a1a('0x27')]=_[_0x0a1a('0x2c')](_0x2132e2[_0x0a1a('0x27')]);_0x577c24[_0x0a1a('0x41')]=_[_0x0a1a('0x2d')](_0x577c24['model'],_0x577c24[_0x0a1a('0x27')]);_0x39339d[_0x0a1a('0x2f')]=_[_0x0a1a('0x2d')](_0x577c24[_0x0a1a('0x2b')],qs['fields'](_0x2132e2[_0x0a1a('0x27')][_0x0a1a('0x2e')]));_0x39339d[_0x0a1a('0x2f')]=_0x39339d[_0x0a1a('0x2f')][_0x0a1a('0x30')]?_0x39339d['attributes']:_0x577c24[_0x0a1a('0x2b')];if(!_0x2132e2[_0x0a1a('0x27')]['hasOwnProperty']('nolimit')){_0x39339d[_0x0a1a('0x12')]=qs[_0x0a1a('0x12')](_0x2132e2[_0x0a1a('0x27')][_0x0a1a('0x12')]);_0x39339d[_0x0a1a('0x10')]=qs[_0x0a1a('0x10')](_0x2132e2[_0x0a1a('0x27')][_0x0a1a('0x10')]);}_0x39339d[_0x0a1a('0x42')]=qs['sort'](_0x2132e2['query']['sort']);_0x39339d[_0x0a1a('0x43')]=qs[_0x0a1a('0x41')](_['pick'](_0x2132e2[_0x0a1a('0x27')],_0x577c24['filters']));_0x39339d['where']['ChatQueueId']=_0x229092['id'];if(_0x2132e2['query']['filter']){_0x39339d[_0x0a1a('0x43')]=_[_0x0a1a('0x32')](_0x39339d[_0x0a1a('0x43')],{'$or':_['map'](_0x39339d['attributes'],function(_0x7e07c6){var _0x7c3a2e={};_0x7c3a2e[_0x7e07c6]={'$like':'%'+_0x2132e2[_0x0a1a('0x27')]['filter']+'%'};return _0x7c3a2e;})});}_0x39339d=_[_0x0a1a('0x32')]({},_0x39339d,_0x2132e2[_0x0a1a('0x44')]);return db[_0x0a1a('0x45')][_0x0a1a('0x46')](_0x39339d);}})[_0x0a1a('0x17')](function(_0x592498){if(_0x592498){return db[_0x0a1a('0x47')][_0x0a1a('0x48')]({'where':{'id':_[_0x0a1a('0x1f')](_0x592498,_0x0a1a('0x49')),'role':_0x0a1a('0x4a')},'attributes':['id',_0x0a1a('0x1c'),_0x0a1a('0x4b'),_0x0a1a('0x4c'),'createdAt']});}})[_0x0a1a('0x17')](function(_0x55504d){if(_0x55504d){return{'count':_0x55504d[_0x0a1a('0x13')],'rows':_[_0x0a1a('0x1f')](_0x55504d[_0x0a1a('0x28')],function(_0x287beb){return{'membername':_0x287beb['name'],'UserId':_0x287beb['id'],'queue_name':_0x43ae94[_0x0a1a('0x1c')],'ChatQueueId':_0x43ae94['id'],'interface':util['format']('%s/%s',_0x0a1a('0x4d'),_0x287beb[_0x0a1a('0x1c')]),'penalty':0x0,'paused':_0x287beb[_0x0a1a('0x4b')],'createdAt':_0x287beb[_0x0a1a('0x4e')],'updatedAt':_0x287beb[_0x0a1a('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a1a('0x17')](respondWithFilteredResult(_0x54a503,_0x39339d))['catch'](handleError(_0x54a503,null));};exports[_0x0a1a('0x4f')]=function(_0x1ab902,_0x5635ec){var _0x8f535={};var _0x3ba14e={};var _0x30f2ca;var _0x2b5aff;return db[_0x0a1a('0x20')][_0x0a1a('0x40')]({'where':{'id':_0x1ab902[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x5635ec,null))['then'](function(_0x137c64){if(_0x137c64){_0x30f2ca=_0x137c64;_0x3ba14e[_0x0a1a('0x2b')]=_[_0x0a1a('0x2c')](db['Team'][_0x0a1a('0x21')]);_0x3ba14e[_0x0a1a('0x27')]=_[_0x0a1a('0x2c')](_0x1ab902[_0x0a1a('0x27')]);_0x3ba14e[_0x0a1a('0x41')]=_[_0x0a1a('0x2d')](_0x3ba14e['model'],_0x3ba14e[_0x0a1a('0x27')]);_0x8f535[_0x0a1a('0x2f')]=_[_0x0a1a('0x2d')](_0x3ba14e[_0x0a1a('0x2b')],qs[_0x0a1a('0x2e')](_0x1ab902['query'][_0x0a1a('0x2e')]));_0x8f535[_0x0a1a('0x2f')]=_0x8f535[_0x0a1a('0x2f')][_0x0a1a('0x30')]?_0x8f535[_0x0a1a('0x2f')]:_0x3ba14e[_0x0a1a('0x2b')];_0x8f535[_0x0a1a('0x42')]=qs[_0x0a1a('0x50')](_0x1ab902[_0x0a1a('0x27')]['sort']);_0x8f535[_0x0a1a('0x43')]=qs[_0x0a1a('0x41')](_[_0x0a1a('0x51')](_0x1ab902[_0x0a1a('0x27')],_0x3ba14e[_0x0a1a('0x41')]));if(_0x1ab902[_0x0a1a('0x27')][_0x0a1a('0x52')]){_0x8f535[_0x0a1a('0x43')]=_['merge'](_0x8f535['where'],{'$or':_[_0x0a1a('0x1f')](_0x8f535[_0x0a1a('0x2f')],function(_0x5cf2ce){var _0x49ee10={};_0x49ee10[_0x5cf2ce]={'$like':'%'+_0x1ab902[_0x0a1a('0x27')]['filter']+'%'};return _0x49ee10;})});}_0x8f535=_[_0x0a1a('0x32')]({},_0x8f535,_0x1ab902[_0x0a1a('0x44')]);return _0x30f2ca['getTeams'](_0x8f535);}})[_0x0a1a('0x17')](function(_0x353d37){if(_0x353d37){_0x2b5aff=_0x353d37['length'];if(!_0x1ab902[_0x0a1a('0x27')][_0x0a1a('0x53')](_0x0a1a('0x54'))){_0x8f535[_0x0a1a('0x12')]=qs[_0x0a1a('0x12')](_0x1ab902[_0x0a1a('0x27')][_0x0a1a('0x12')]);_0x8f535[_0x0a1a('0x10')]=qs[_0x0a1a('0x10')](_0x1ab902[_0x0a1a('0x27')]['offset']);}return _0x30f2ca['getTeams'](_0x8f535);}})['then'](function(_0x26981f){if(_0x26981f){return _0x26981f?{'count':_0x2b5aff,'rows':_0x26981f}:null;}})[_0x0a1a('0x17')](respondWithResult(_0x5635ec,null))['catch'](handleError(_0x5635ec,null));};exports[_0x0a1a('0x55')]=function(_0x580f9c,_0x5232d3){var _0x2fbcf8=_0x580f9c[_0x0a1a('0x35')][_0x0a1a('0x56')];return db['Team'][_0x0a1a('0x46')]({'where':{'id':_0x2fbcf8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a1a('0x57'),'attributes':['id',_0x0a1a('0x1c'),_0x0a1a('0x58'),'voicePause',_0x0a1a('0x59')],'raw':!![]}]})[_0x0a1a('0x17')](function(_0x41a3c5){if(_0x41a3c5){var _0x2606b1=_[_0x0a1a('0x5a')](_0x41a3c5,function(_0x303295){var _0x421d80=_0x303295[_0x0a1a('0x37')]({'plain':!![]});return _0x421d80[_0x0a1a('0x57')];});return db['ChatQueue'][_0x0a1a('0x33')]({'where':{'id':_0x580f9c[_0x0a1a('0x2a')]['id']}})['then'](function(_0x348949){return db['sequelize']['transaction'](function(_0x18c13c){return _0x348949['addTeams'](_0x2fbcf8,{'transaction':_0x18c13c})[_0x0a1a('0x17')](function(){return BPromise[_0x0a1a('0x5b')](_0x2606b1,function(_0x5c6915){return db[_0x0a1a('0x45')][_0x0a1a('0x5c')]({'where':{'UserId':_0x5c6915['id'],'ChatQueueId':_0x580f9c[_0x0a1a('0x2a')]['id']},'transaction':_0x18c13c});});})[_0x0a1a('0x17')](function(){_0x2606b1['forEach'](function(_0x3da386){socket[_0x0a1a('0x5d')](_0x0a1a('0x5e'),{'UserId':_0x3da386['id'],'ChatQueueId':_0x348949['id']});});});});});}})['then'](respondWithStatusCode(_0x5232d3,null))['catch'](handleError(_0x5232d3,null));};exports[_0x0a1a('0x5f')]=function(_0x5bfd66,_0x21a39e){return db['Team'][_0x0a1a('0x46')]({'where':{'id':_0x5bfd66['query'][_0x0a1a('0x56')]},'attributes':['id'],'include':[{'model':db[_0x0a1a('0x47')],'as':_0x0a1a('0x57'),'attributes':['id'],'raw':!![]}]})[_0x0a1a('0x17')](handleEntityNotFound(_0x21a39e,null))['then'](function(_0xcb64ad){var _0x483965=_[_0x0a1a('0x1f')](_0xcb64ad,'id');var _0x422a11=[];var _0xc01c21=[];var _0x168e4=squel[_0x0a1a('0x60')]();_0x168e4[_0x0a1a('0x61')](_0x0a1a('0x62'))['from']('team_has_chat_queues','tq')[_0x0a1a('0x63')](_0x0a1a('0x64'),'ut',_0x0a1a('0x65'))[_0x0a1a('0x43')](_0x0a1a('0x66'),_0x5bfd66[_0x0a1a('0x2a')]['id']);for(var _0x2a6579=0x0;_0x2a6579<_0xcb64ad[_0x0a1a('0x30')];_0x2a6579+=0x1){let _0x19caeb=_0xcb64ad[_0x2a6579];for(var _0x8c9ab6=0x0;_0x8c9ab6<_0x19caeb[_0x0a1a('0x57')][_0x0a1a('0x30')];_0x8c9ab6+=0x1){let _0x408f08=_0x19caeb[_0x0a1a('0x57')][_0x8c9ab6];var _0x1e2781=_0x168e4['clone']();_0x1e2781[_0x0a1a('0x43')]('ut.UserId\x20=\x20?',_0x408f08['id']);_0xc01c21[_0x0a1a('0x67')](db[_0x0a1a('0x68')]['query'](_0x1e2781['toString'](),{'type':db[_0x0a1a('0x68')]['QueryTypes'][_0x0a1a('0x69')]})[_0x0a1a('0x17')](function(_0x2e2677){if(_0x2e2677['length']===0x1){return _0x408f08['id'];}else{var _0x3ba3d6=_[_0x0a1a('0x6a')](_[_0x0a1a('0x1f')](_0x2e2677,_0x0a1a('0x6b')),function(_0x272224){return _['includes'](_0x483965,_0x272224);});if(_0x3ba3d6){return _0x408f08['id'];}}}));}}return BPromise['all'](_0xc01c21)[_0x0a1a('0x17')](function(_0x3d4993){_0x422a11=_(_0x422a11)[_0x0a1a('0x6c')](_0x3d4993)[_0x0a1a('0x6d')]()[_0x0a1a('0x6e')]();return db[_0x0a1a('0x20')][_0x0a1a('0x33')]({'where':{'id':_0x5bfd66[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](function(_0x1fb2b5){return db[_0x0a1a('0x68')][_0x0a1a('0x6f')](function(_0x1406dd){return _0x1fb2b5[_0x0a1a('0x5f')](_0x5bfd66['query']['ids'],{'transaction':_0x1406dd})['then'](function(){if(!_['isEmpty'](_0x422a11)){return _0x1fb2b5['removeAgents'](_0x422a11,{'transaction':_0x1406dd});}})[_0x0a1a('0x17')](function(){_0x422a11[_0x0a1a('0x70')](function(_0x3f27ba){socket[_0x0a1a('0x5d')]('userChatQueue:remove',{'UserId':_0x3f27ba,'ChatQueueId':_0x1fb2b5['id']});});});});});});})[_0x0a1a('0x17')](respondWithStatusCode(_0x21a39e,null))['catch'](handleError(_0x21a39e,null));};exports[_0x0a1a('0x71')]=function(_0x570c12,_0x3f6ec6){return db[_0x0a1a('0x20')][_0x0a1a('0x33')]({'where':{'id':_0x570c12[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x3f6ec6,null))['then'](function(_0x5bb06c){if(_0x5bb06c){return _0x5bb06c[_0x0a1a('0x71')](_0x570c12[_0x0a1a('0x35')][_0x0a1a('0x56')],_['omit'](_0x570c12['body'],[_0x0a1a('0x56'),'id'])||{})[_0x0a1a('0x72')](function(_0x18325a){for(var _0x3749f1=0x0;_0x3749f1<_0x570c12['body'][_0x0a1a('0x56')][_0x0a1a('0x30')];_0x3749f1+=0x1){socket[_0x0a1a('0x5d')](_0x0a1a('0x5e'),{'UserId':Number(_0x570c12[_0x0a1a('0x35')][_0x0a1a('0x56')][_0x3749f1]),'ChatQueueId':Number(_0x570c12['params']['id'])});}return _0x18325a;});}})[_0x0a1a('0x17')](respondWithResult(_0x3f6ec6,null))[_0x0a1a('0x29')](handleError(_0x3f6ec6,null));};exports[_0x0a1a('0x73')]=function(_0x202b1a,_0x2b18c2){return db[_0x0a1a('0x20')][_0x0a1a('0x33')]({'where':{'id':_0x202b1a[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x2b18c2,null))[_0x0a1a('0x17')](function(_0xac9afb){if(_0xac9afb){return _0xac9afb[_0x0a1a('0x73')](_0x202b1a[_0x0a1a('0x27')][_0x0a1a('0x56')])['then'](function(){if(_['isArray'](_0x202b1a['query'][_0x0a1a('0x56')])){for(var _0x1f7e15=0x0;_0x1f7e15<_0x202b1a['query']['ids'][_0x0a1a('0x30')];_0x1f7e15+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x202b1a[_0x0a1a('0x27')][_0x0a1a('0x56')][_0x1f7e15]),'ChatQueueId':Number(_0x202b1a[_0x0a1a('0x2a')]['id'])});}}else{socket[_0x0a1a('0x5d')](_0x0a1a('0x74'),{'UserId':Number(_0x202b1a[_0x0a1a('0x27')][_0x0a1a('0x56')]),'ChatQueueId':Number(_0x202b1a[_0x0a1a('0x2a')]['id'])});}});}})[_0x0a1a('0x17')](respondWithStatusCode(_0x2b18c2,null))[_0x0a1a('0x29')](handleError(_0x2b18c2,null));};exports[_0x0a1a('0x75')]=function(_0x287f29,_0x5a5e24){var _0x276a73={};var _0x12839c={};var _0xa56a27;var _0x5cc3d1;return db[_0x0a1a('0x20')]['findOne']({'where':{'id':_0x287f29[_0x0a1a('0x2a')]['id']}})[_0x0a1a('0x17')](handleEntityNotFound(_0x5a5e24,null))[_0x0a1a('0x17')](function(_0x2e9b4b){if(_0x2e9b4b){_0xa56a27=_0x2e9b4b;_0x12839c[_0x0a1a('0x2b')]=_[_0x0a1a('0x2c')](db['User'][_0x0a1a('0x21')]);_0x12839c[_0x0a1a('0x27')]=_['keys'](_0x287f29[_0x0a1a('0x27')]);_0x12839c[_0x0a1a('0x41')]=_['intersection'](_0x12839c['model'],_0x12839c['query']);_0x276a73[_0x0a1a('0x2f')]=_[_0x0a1a('0x2d')](_0x12839c[_0x0a1a('0x2b')],qs[_0x0a1a('0x2e')](_0x287f29[_0x0a1a('0x27')]['fields']));_0x276a73[_0x0a1a('0x2f')]=_0x276a73['attributes'][_0x0a1a('0x30')]?_0x276a73[_0x0a1a('0x2f')]:_0x12839c[_0x0a1a('0x2b')];_0x276a73[_0x0a1a('0x42')]=qs[_0x0a1a('0x50')](_0x287f29[_0x0a1a('0x27')]['sort']);_0x276a73['where']=qs[_0x0a1a('0x41')](_['pick'](_0x287f29[_0x0a1a('0x27')],_0x12839c['filters']));if(_0x287f29[_0x0a1a('0x27')][_0x0a1a('0x52')]){_0x276a73[_0x0a1a('0x43')]=_[_0x0a1a('0x32')](_0x276a73[_0x0a1a('0x43')],{'$or':_[_0x0a1a('0x1f')](_0x276a73[_0x0a1a('0x2f')],function(_0xebc424){var _0x3532bf={};_0x3532bf[_0xebc424]={'$like':'%'+_0x287f29['query'][_0x0a1a('0x52')]+'%'};return _0x3532bf;})});}_0x276a73=_[_0x0a1a('0x32')]({},_0x276a73,_0x287f29[_0x0a1a('0x44')]);return _0xa56a27[_0x0a1a('0x75')](_0x276a73);}})[_0x0a1a('0x17')](function(_0x1c0408){if(_0x1c0408){_0x5cc3d1=_0x1c0408[_0x0a1a('0x30')];if(!_0x287f29['query'][_0x0a1a('0x53')]('nolimit')){_0x276a73[_0x0a1a('0x12')]=qs['limit'](_0x287f29[_0x0a1a('0x27')][_0x0a1a('0x12')]);_0x276a73[_0x0a1a('0x10')]=qs[_0x0a1a('0x10')](_0x287f29[_0x0a1a('0x27')][_0x0a1a('0x10')]);}return _0xa56a27[_0x0a1a('0x75')](_0x276a73);}})['then'](function(_0x3ad13c){if(_0x3ad13c){return _0x3ad13c?{'count':_0x5cc3d1,'rows':_0x3ad13c}:null;}})[_0x0a1a('0x17')](respondWithResult(_0x5a5e24,null))['catch'](handleError(_0x5a5e24,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a423144..52d7bd3 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 _0xcb24=['remove','emit','hook','exports','events','../../mysqldb','ChatQueue','update'];(function(_0xd1fa3,_0x28f704){var _0x3ec57e=function(_0x2c68d4){while(--_0x2c68d4){_0xd1fa3['push'](_0xd1fa3['shift']());}};_0x3ec57e(++_0x28f704);}(_0xcb24,0x94));var _0x4cb2=function(_0xae8a4d,_0x37da44){_0xae8a4d=_0xae8a4d-0x0;var _0x34289f=_0xcb24[_0xae8a4d];return _0x34289f;};'use strict';var EventEmitter=require(_0x4cb2('0x0'));var ChatQueue=require(_0x4cb2('0x1'))['db'][_0x4cb2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4cb2('0x3'),'afterDestroy':_0x4cb2('0x4')};function emitEvent(_0x417a6b){return function(_0x29d26e,_0x44dcd5,_0x3839ac){ChatQueueEvents['emit'](_0x417a6b+':'+_0x29d26e['id'],_0x29d26e);ChatQueueEvents[_0x4cb2('0x5')](_0x417a6b,_0x29d26e);_0x3839ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4cb2('0x6')](e,emitEvent(event));}}module[_0x4cb2('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xab73=['events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x394ce5,_0x679d25){var _0x39c13d=function(_0xce4c26){while(--_0xce4c26){_0x394ce5['push'](_0x394ce5['shift']());}};_0x39c13d(++_0x679d25);}(_0xab73,0x1a4));var _0x3ab7=function(_0x139da8,_0x93f0c0){_0x139da8=_0x139da8-0x0;var _0x466083=_0xab73[_0x139da8];return _0x466083;};'use strict';var EventEmitter=require(_0x3ab7('0x0'));var ChatQueue=require(_0x3ab7('0x1'))['db'][_0x3ab7('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3ab7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3ab7('0x4'),'afterDestroy':_0x3ab7('0x5')};function emitEvent(_0x548fda){return function(_0x416339,_0x3fc3bd,_0xda3a5b){ChatQueueEvents[_0x3ab7('0x6')](_0x548fda+':'+_0x416339['id'],_0x416339);ChatQueueEvents[_0x3ab7('0x6')](_0x548fda,_0x416339);_0xda3a5b(null);};}for(var e in events){if(events[_0x3ab7('0x7')](e)){var event=events[e];ChatQueue[_0x3ab7('0x8')](e,emitEvent(event));}}module[_0x3ab7('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d8b23c2..6060f66 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 _0x2d31=['ChatQueue','chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports'];(function(_0x49331c,_0x5a0f4d){var _0x200932=function(_0x4e231c){while(--_0x4e231c){_0x49331c['push'](_0x49331c['shift']());}};_0x200932(++_0x5a0f4d);}(_0x2d31,0x91));var _0x12d3=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x2d31[_0x12a554];return _0x244ba0;};'use strict';var _=require(_0x12d3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12d3('0x1'));var moment=require(_0x12d3('0x2'));var BPromise=require(_0x12d3('0x3'));var rp=require(_0x12d3('0x4'));var fs=require('fs');var path=require(_0x12d3('0x5'));var rimraf=require(_0x12d3('0x6'));var config=require('../../config/environment');var attributes=require(_0x12d3('0x7'));module[_0x12d3('0x8')]=function(_0x3c5b73,_0x5258bf){return _0x3c5b73['define'](_0x12d3('0x9'),attributes,{'tableName':_0x12d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8012=['rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x8012,0x156));var _0x2801=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x8012[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x2801('0x0'));var util=require(_0x2801('0x1'));var logger=require(_0x2801('0x2'))(_0x2801('0x3'));var moment=require(_0x2801('0x4'));var BPromise=require(_0x2801('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2801('0x6'));var config=require(_0x2801('0x7'));var attributes=require(_0x2801('0x8'));module[_0x2801('0x9')]=function(_0x56c170,_0x438ea2){return _0x56c170['define'](_0x2801('0xa'),attributes,{'tableName':_0x2801('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index fa8a8b8..735a7b6 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 _0x15f9=['client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetChatQueue','findAll','options','raw','attributes','limit','include','map','stringify','ShowChatQueue','find','where','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x15f9,0xf7));var _0x915f=function(_0x44e0c4,_0x5b59f7){_0x44e0c4=_0x44e0c4-0x0;var _0x556148=_0x15f9[_0x44e0c4];return _0x556148;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var moment=require(_0x915f('0x2'));var BPromise=require(_0x915f('0x3'));var rs=require(_0x915f('0x4'));var fs=require('fs');var Redis=require(_0x915f('0x5'));var db=require(_0x915f('0x6'))['db'];var utils=require(_0x915f('0x7'));var logger=require(_0x915f('0x8'))('rpc');var config=require(_0x915f('0x9'));var jayson=require(_0x915f('0xa'));var client=jayson[_0x915f('0xb')][_0x915f('0xc')]({'port':0x232a});config['redis']=_[_0x915f('0xd')](config[_0x915f('0xe')],{'host':_0x915f('0xf'),'port':0x18eb});var socket=require(_0x915f('0x10'))(new Redis(config['redis']));require(_0x915f('0x11'))[_0x915f('0x12')](socket);function respondWithRpcPromise(_0x57daf8,_0x5da141,_0x3d038f){return new BPromise(function(_0x3746f9,_0x1b125c){return client[_0x915f('0x13')](_0x57daf8,_0x3d038f)[_0x915f('0x14')](function(_0x340a91){logger[_0x915f('0x15')](_0x915f('0x16'),_0x5da141,_0x915f('0x17'));logger[_0x915f('0x18')](_0x915f('0x19'),_0x5da141,_0x915f('0x17'),JSON['stringify'](_0x340a91));if(_0x340a91[_0x915f('0x1a')]){if(_0x340a91[_0x915f('0x1a')][_0x915f('0x1b')]===0x1f4){logger[_0x915f('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x5da141,_0x340a91[_0x915f('0x1a')]['message']);return _0x1b125c(_0x340a91[_0x915f('0x1a')][_0x915f('0x1c')]);}logger['error'](_0x915f('0x16'),_0x5da141,_0x340a91[_0x915f('0x1a')]['message']);return _0x3746f9(_0x340a91[_0x915f('0x1a')][_0x915f('0x1c')]);}else{logger[_0x915f('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5da141,_0x915f('0x17'));_0x3746f9(_0x340a91['result'][_0x915f('0x1c')]);}})[_0x915f('0x1d')](function(_0x4c04c8){logger[_0x915f('0x1a')](_0x915f('0x16'),_0x5da141,_0x4c04c8);_0x1b125c(_0x4c04c8);});});}exports[_0x915f('0x1e')]=function(_0x67e37f){var _0x15d065=this;return new Promise(function(_0x2d65c6,_0x2ba00c){return db['ChatQueue'][_0x915f('0x1f')]({'raw':_0x67e37f[_0x915f('0x20')]?_0x67e37f['options'][_0x915f('0x21')]===undefined?!![]:![]:!![],'where':_0x67e37f[_0x915f('0x20')]?_0x67e37f[_0x915f('0x20')]['where']||null:null,'attributes':_0x67e37f[_0x915f('0x20')]?_0x67e37f[_0x915f('0x20')][_0x915f('0x22')]||null:null,'limit':_0x67e37f[_0x915f('0x20')]?_0x67e37f[_0x915f('0x20')][_0x915f('0x23')]||null:null,'include':_0x67e37f['options']?_0x67e37f[_0x915f('0x20')][_0x915f('0x24')]?_[_0x915f('0x25')](_0x67e37f[_0x915f('0x20')][_0x915f('0x24')],function(_0x1a19e1){return{'model':db[_0x1a19e1['model']],'as':_0x1a19e1['as'],'attributes':_0x1a19e1[_0x915f('0x22')],'include':_0x1a19e1['include']?_['map'](_0x1a19e1[_0x915f('0x24')],function(_0x4ef141){return{'model':db[_0x4ef141['model']],'as':_0x4ef141['as'],'attributes':_0x4ef141[_0x915f('0x22')],'include':_0x4ef141[_0x915f('0x24')]?_[_0x915f('0x25')](_0x4ef141[_0x915f('0x24')],function(_0x5a5ee2){return{'model':db[_0x5a5ee2['model']],'as':_0x5a5ee2['as'],'attributes':_0x5a5ee2[_0x915f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x915f('0x14')](function(_0x258b09){logger[_0x915f('0x15')](_0x915f('0x1e'),_0x67e37f);logger[_0x915f('0x18')]('GetChatQueue',_0x67e37f,JSON[_0x915f('0x26')](_0x258b09));_0x2d65c6(_0x258b09);})['catch'](function(_0x3cc1e0){logger['error'](_0x915f('0x1e'),_0x3cc1e0[_0x915f('0x1c')],_0x67e37f);_0x2ba00c(_0x15d065[_0x915f('0x1a')](0x1f4,_0x3cc1e0[_0x915f('0x1c')]));});});};exports[_0x915f('0x27')]=function(_0x2aac98){var _0x4ca577=this;return new Promise(function(_0x122388,_0x5c0c3){return db['ChatQueue'][_0x915f('0x28')]({'raw':_0x2aac98['options']?_0x2aac98[_0x915f('0x20')][_0x915f('0x21')]===undefined?!![]:![]:!![],'where':_0x2aac98[_0x915f('0x20')]?_0x2aac98[_0x915f('0x20')][_0x915f('0x29')]||null:null,'attributes':_0x2aac98['options']?_0x2aac98[_0x915f('0x20')][_0x915f('0x22')]||null:null,'include':_0x2aac98[_0x915f('0x20')]?_0x2aac98['options'][_0x915f('0x24')]?_[_0x915f('0x25')](_0x2aac98[_0x915f('0x20')][_0x915f('0x24')],function(_0xddfaf1){return{'model':db[_0xddfaf1[_0x915f('0x2a')]],'as':_0xddfaf1['as'],'attributes':_0xddfaf1['attributes'],'include':_0xddfaf1[_0x915f('0x24')]?_['map'](_0xddfaf1[_0x915f('0x24')],function(_0x49e1a8){return{'model':db[_0x49e1a8[_0x915f('0x2a')]],'as':_0x49e1a8['as'],'attributes':_0x49e1a8[_0x915f('0x22')],'include':_0x49e1a8[_0x915f('0x24')]?_['map'](_0x49e1a8[_0x915f('0x24')],function(_0x1f8558){return{'model':db[_0x1f8558[_0x915f('0x2a')]],'as':_0x1f8558['as'],'attributes':_0x1f8558['attributes']};}):[]};}):[]};}):[]:[]})[_0x915f('0x14')](function(_0x2af883){logger['info'](_0x915f('0x27'),_0x2aac98);logger['debug'](_0x915f('0x27'),_0x2aac98,JSON[_0x915f('0x26')](_0x2af883));_0x122388(_0x2af883);})[_0x915f('0x1d')](function(_0x43472f){logger['error'](_0x915f('0x27'),_0x43472f[_0x915f('0x1c')],_0x2aac98);_0x5c0c3(_0x4ca577[_0x915f('0x1a')](0x1f4,_0x43472f[_0x915f('0x1c')]));});});}; \ No newline at end of file +var _0xd523=['debug','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x27b7d2,_0x56c091){var _0x3ef6be=function(_0x6e8a35){while(--_0x6e8a35){_0x27b7d2['push'](_0x27b7d2['shift']());}};_0x3ef6be(++_0x56c091);}(_0xd523,0x153));var _0x3d52=function(_0x5ecedf,_0x4e9c48){_0x5ecedf=_0x5ecedf-0x0;var _0x2804c8=_0xd523[_0x5ecedf];return _0x2804c8;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3d52('0xb')](config[_0x3d52('0xc')],{'host':_0x3d52('0xd'),'port':0x18eb});var socket=require(_0x3d52('0xe'))(new Redis(config[_0x3d52('0xc')]));require(_0x3d52('0xf'))[_0x3d52('0x10')](socket);function respondWithRpcPromise(_0x2d966e,_0x30ee09,_0x4a5a9a){return new BPromise(function(_0x46c2e6,_0x873de6){return client[_0x3d52('0x11')](_0x2d966e,_0x4a5a9a)[_0x3d52('0x12')](function(_0x2675d2){logger['info'](_0x3d52('0x13'),_0x30ee09,'request\x20sent');logger['debug'](_0x3d52('0x14'),_0x30ee09,_0x3d52('0x15'),JSON['stringify'](_0x2675d2));if(_0x2675d2['error']){if(_0x2675d2['error'][_0x3d52('0x16')]===0x1f4){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x873de6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x46c2e6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}else{logger[_0x3d52('0x19')](_0x3d52('0x13'),_0x30ee09,'request\x20sent');_0x46c2e6(_0x2675d2[_0x3d52('0x1a')][_0x3d52('0x18')]);}})[_0x3d52('0x1b')](function(_0x54a514){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x54a514);_0x873de6(_0x54a514);});});}exports[_0x3d52('0x1c')]=function(_0x534fc4){var _0x34e160=this;return new Promise(function(_0x326a74,_0x1163c5){return db[_0x3d52('0x1d')][_0x3d52('0x1e')]({'raw':_0x534fc4[_0x3d52('0x1f')]?_0x534fc4[_0x3d52('0x1f')][_0x3d52('0x20')]===undefined?!![]:![]:!![],'where':_0x534fc4['options']?_0x534fc4[_0x3d52('0x1f')][_0x3d52('0x21')]||null:null,'attributes':_0x534fc4[_0x3d52('0x1f')]?_0x534fc4['options'][_0x3d52('0x22')]||null:null,'limit':_0x534fc4[_0x3d52('0x1f')]?_0x534fc4[_0x3d52('0x1f')][_0x3d52('0x23')]||null:null,'include':_0x534fc4[_0x3d52('0x1f')]?_0x534fc4[_0x3d52('0x1f')][_0x3d52('0x24')]?_[_0x3d52('0x25')](_0x534fc4[_0x3d52('0x1f')][_0x3d52('0x24')],function(_0x1ef6db){return{'model':db[_0x1ef6db['model']],'as':_0x1ef6db['as'],'attributes':_0x1ef6db[_0x3d52('0x22')],'include':_0x1ef6db[_0x3d52('0x24')]?_[_0x3d52('0x25')](_0x1ef6db[_0x3d52('0x24')],function(_0x490ce5){return{'model':db[_0x490ce5['model']],'as':_0x490ce5['as'],'attributes':_0x490ce5[_0x3d52('0x22')],'include':_0x490ce5[_0x3d52('0x24')]?_[_0x3d52('0x25')](_0x490ce5['include'],function(_0x209cca){return{'model':db[_0x209cca[_0x3d52('0x26')]],'as':_0x209cca['as'],'attributes':_0x209cca[_0x3d52('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3d52('0x12')](function(_0x5deee2){logger[_0x3d52('0x19')](_0x3d52('0x1c'),_0x534fc4);logger[_0x3d52('0x27')](_0x3d52('0x1c'),_0x534fc4,JSON['stringify'](_0x5deee2));_0x326a74(_0x5deee2);})[_0x3d52('0x1b')](function(_0x5a7455){logger[_0x3d52('0x17')](_0x3d52('0x1c'),_0x5a7455[_0x3d52('0x18')],_0x534fc4);_0x1163c5(_0x34e160['error'](0x1f4,_0x5a7455[_0x3d52('0x18')]));});});};exports['ShowChatQueue']=function(_0x2dd85f){var _0x4c0273=this;return new Promise(function(_0x56ac79,_0x2fc78d){return db[_0x3d52('0x1d')][_0x3d52('0x28')]({'raw':_0x2dd85f[_0x3d52('0x1f')]?_0x2dd85f[_0x3d52('0x1f')][_0x3d52('0x20')]===undefined?!![]:![]:!![],'where':_0x2dd85f[_0x3d52('0x1f')]?_0x2dd85f[_0x3d52('0x1f')][_0x3d52('0x21')]||null:null,'attributes':_0x2dd85f['options']?_0x2dd85f[_0x3d52('0x1f')][_0x3d52('0x22')]||null:null,'include':_0x2dd85f[_0x3d52('0x1f')]?_0x2dd85f[_0x3d52('0x1f')]['include']?_[_0x3d52('0x25')](_0x2dd85f[_0x3d52('0x1f')]['include'],function(_0x3f8bb6){return{'model':db[_0x3f8bb6['model']],'as':_0x3f8bb6['as'],'attributes':_0x3f8bb6[_0x3d52('0x22')],'include':_0x3f8bb6[_0x3d52('0x24')]?_[_0x3d52('0x25')](_0x3f8bb6['include'],function(_0x2798a7){return{'model':db[_0x2798a7['model']],'as':_0x2798a7['as'],'attributes':_0x2798a7[_0x3d52('0x22')],'include':_0x2798a7[_0x3d52('0x24')]?_[_0x3d52('0x25')](_0x2798a7['include'],function(_0x50dbd8){return{'model':db[_0x50dbd8[_0x3d52('0x26')]],'as':_0x50dbd8['as'],'attributes':_0x50dbd8[_0x3d52('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3d52('0x12')](function(_0x5a3492){logger[_0x3d52('0x19')](_0x3d52('0x29'),_0x2dd85f);logger[_0x3d52('0x27')](_0x3d52('0x29'),_0x2dd85f,JSON['stringify'](_0x5a3492));_0x56ac79(_0x5a3492);})[_0x3d52('0x1b')](function(_0x4dc059){logger['error'](_0x3d52('0x29'),_0x4dc059['message'],_0x2dd85f);_0x2fc78d(_0x4c0273[_0x3d52('0x17')](0x1f4,_0x4dc059['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8d9b4a3..d9925fd 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 _0x70e0=['chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x533ae4,_0x126df2){var _0x19e750=function(_0x3f9606){while(--_0x3f9606){_0x533ae4['push'](_0x533ae4['shift']());}};_0x19e750(++_0x126df2);}(_0x70e0,0x17b));var _0x070e=function(_0xdc5573,_0x24a7fc){_0xdc5573=_0xdc5573-0x0;var _0x2abe75=_0x70e0[_0xdc5573];return _0x2abe75;};'use strict';var ChatQueueEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){ChatQueueEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);ChatQueueEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x53e592,_0x16ce15){var _0x425070=function(_0x2fe5aa){while(--_0x2fe5aa){_0x53e592['push'](_0x53e592['shift']());}};_0x425070(++_0x16ce15);}(_0x5636,0x102));var _0x6563=function(_0x271586,_0x2c84f5){_0x271586=_0x271586-0x0;var _0x59c8a6=_0x5636[_0x271586];return _0x59c8a6;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 2582dee..eadb40c 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x36b77a,_0x2ef645){var _0x451707=function(_0x4159b4){while(--_0x4159b4){_0x36b77a['push'](_0x36b77a['shift']());}};_0x451707(++_0x2ef645);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5d3ab6,_0x31296e){var _0x52bbf=function(_0xd94d34){while(--_0xd94d34){_0x5d3ab6['push'](_0x5d3ab6['shift']());}};_0x52bbf(++_0x31296e);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 331a8ec..4ac4ed3 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 _0x709e=['DATE','moment','sequelize','exports','STRING'];(function(_0x3853ac,_0x37152d){var _0x43d0de=function(_0x1a3889){while(--_0x1a3889){_0x3853ac['push'](_0x3853ac['shift']());}};_0x43d0de(++_0x37152d);}(_0x709e,0xab));var _0xe709=function(_0x58e610,_0x3acc22){_0x58e610=_0x58e610-0x0;var _0x253abd=_0x709e[_0x58e610];return _0x253abd;};'use strict';var moment=require(_0xe709('0x0'));var Sequelize=require(_0xe709('0x1'));module[_0xe709('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe709('0x3')]},'joinAt':{'type':Sequelize[_0xe709('0x4')]},'leaveAt':{'type':Sequelize[_0xe709('0x4')]},'acceptAt':{'type':Sequelize[_0xe709('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe709('0x3')]}}; \ No newline at end of file +var _0x6873=['DATE','exports','STRING'];(function(_0x12c3f8,_0x4df4ea){var _0x4bb87b=function(_0x1886c0){while(--_0x1886c0){_0x12c3f8['push'](_0x12c3f8['shift']());}};_0x4bb87b(++_0x4df4ea);}(_0x6873,0xac));var _0x3687=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x6873[_0x4bfcbe];return _0x5b65e6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3687('0x0')]={'uniqueid':{'type':Sequelize[_0x3687('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3687('0x1')]},'joinAt':{'type':Sequelize[_0x3687('0x2')]},'leaveAt':{'type':Sequelize[_0x3687('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3687('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index e1289df..008158d 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 _0x1fcc=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','destroy','error','stack','name','send','map','ChatQueueReport','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch'];(function(_0x338251,_0x5422de){var _0x3d6a8f=function(_0x33b311){while(--_0x33b311){_0x338251['push'](_0x338251['shift']());}};_0x3d6a8f(++_0x5422de);}(_0x1fcc,0x125));var _0xc1fc=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0x1fcc[_0x2db667];return _0x83ff9;};'use strict';var emlformat=require(_0xc1fc('0x0'));var rimraf=require(_0xc1fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1fc('0x2'));var rp=require(_0xc1fc('0x3'));var moment=require(_0xc1fc('0x4'));var BPromise=require(_0xc1fc('0x5'));var Mustache=require(_0xc1fc('0x6'));var util=require(_0xc1fc('0x7'));var path=require(_0xc1fc('0x8'));var sox=require('sox');var csv=require(_0xc1fc('0x9'));var ejs=require(_0xc1fc('0xa'));var fs=require('fs');var fs_extra=require(_0xc1fc('0xb'));var _=require('lodash');var squel=require(_0xc1fc('0xc'));var crypto=require(_0xc1fc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc1fc('0xe'));var toCsv=require(_0xc1fc('0x9'));var querystring=require('querystring');var Papa=require(_0xc1fc('0xf'));var Redis=require('ioredis');var authService=require(_0xc1fc('0x10'));var qs=require(_0xc1fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1fc('0x12'));var logger=require(_0xc1fc('0x13'))(_0xc1fc('0x14'));var utils=require(_0xc1fc('0x15'));var config=require(_0xc1fc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1fc('0x17'))['db'];function respondWithStatusCode(_0x10d1d3,_0x354393){_0x354393=_0x354393||0xcc;return function(_0x55c62b){if(_0x55c62b){return _0x10d1d3[_0xc1fc('0x18')](_0x354393);}return _0x10d1d3[_0xc1fc('0x19')](_0x354393)[_0xc1fc('0x1a')]();};}function respondWithResult(_0x52b0bb,_0x2a8519){_0x2a8519=_0x2a8519||0xc8;return function(_0x338ca8){if(_0x338ca8){return _0x52b0bb[_0xc1fc('0x19')](_0x2a8519)[_0xc1fc('0x1b')](_0x338ca8);}};}function respondWithFilteredResult(_0x232bc2,_0xd04a31){return function(_0x476bcf){if(_0x476bcf){var _0x427326=typeof _0xd04a31[_0xc1fc('0x1c')]===_0xc1fc('0x1d')&&typeof _0xd04a31['limit']===_0xc1fc('0x1d');var _0x5626d6=_0x476bcf['count'];var _0x6c0e26=_0x427326?0x0:_0xd04a31[_0xc1fc('0x1c')];var _0x3fba13=_0x427326?_0x476bcf[_0xc1fc('0x1e')]:_0xd04a31[_0xc1fc('0x1c')]+_0xd04a31[_0xc1fc('0x1f')];var _0x28e2d2;if(_0x3fba13>=_0x5626d6){_0x3fba13=_0x5626d6;_0x28e2d2=0xc8;}else{_0x28e2d2=0xce;}_0x232bc2[_0xc1fc('0x19')](_0x28e2d2);return _0x232bc2[_0xc1fc('0x20')]('Content-Range',_0x6c0e26+'-'+_0x3fba13+'/'+_0x5626d6)[_0xc1fc('0x1b')](_0x476bcf);}return null;};}function patchUpdates(_0x36122b){return function(_0x56b0f3){try{jsonpatch['apply'](_0x56b0f3,_0x36122b,!![]);}catch(_0x36345c){return BPromise[_0xc1fc('0x21')](_0x36345c);}return _0x56b0f3[_0xc1fc('0x22')]();};}function saveUpdates(_0x528900,_0x474c8f){return function(_0x54d500){if(_0x54d500){return _0x54d500['update'](_0x528900)[_0xc1fc('0x23')](function(_0x8b5912){return _0x8b5912;});}return null;};}function removeEntity(_0x34aaa4,_0x3aacf2){return function(_0x214ddd){if(_0x214ddd){return _0x214ddd[_0xc1fc('0x24')]()['then'](function(){_0x34aaa4[_0xc1fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27723f,_0x38fd5c){return function(_0x489f41){if(!_0x489f41){_0x27723f[_0xc1fc('0x18')](0x194);}return _0x489f41;};}function handleError(_0x2d6f4a,_0x281d16){_0x281d16=_0x281d16||0x1f4;return function(_0x23594f){logger[_0xc1fc('0x25')](_0x23594f[_0xc1fc('0x26')]);if(_0x23594f['name']){delete _0x23594f[_0xc1fc('0x27')];}_0x2d6f4a[_0xc1fc('0x19')](_0x281d16)[_0xc1fc('0x28')](_0x23594f);};}exports['index']=function(_0xf45540,_0x47ad51){var _0x3c0da5={},_0x1977a4={},_0x11afe8={'count':0x0,'rows':[]};var _0x16d15c=_[_0xc1fc('0x29')](db[_0xc1fc('0x2a')]['rawAttributes'],function(_0x39f60d){return{'name':_0x39f60d['fieldName'],'type':_0x39f60d[_0xc1fc('0x2b')][_0xc1fc('0x2c')]};});_0x1977a4['model']=_['map'](_0x16d15c,_0xc1fc('0x27'));_0x1977a4['query']=_[_0xc1fc('0x2d')](_0xf45540[_0xc1fc('0x2e')]);_0x1977a4['filters']=_[_0xc1fc('0x2f')](_0x1977a4['model'],_0x1977a4[_0xc1fc('0x2e')]);_0x3c0da5[_0xc1fc('0x30')]=_['intersection'](_0x1977a4[_0xc1fc('0x31')],qs[_0xc1fc('0x32')](_0xf45540['query'][_0xc1fc('0x32')]));_0x3c0da5[_0xc1fc('0x30')]=_0x3c0da5['attributes'][_0xc1fc('0x33')]?_0x3c0da5['attributes']:_0x1977a4['model'];if(!_0xf45540[_0xc1fc('0x2e')][_0xc1fc('0x34')]('nolimit')){_0x3c0da5[_0xc1fc('0x1f')]=qs[_0xc1fc('0x1f')](_0xf45540[_0xc1fc('0x2e')][_0xc1fc('0x1f')]);_0x3c0da5[_0xc1fc('0x1c')]=qs[_0xc1fc('0x1c')](_0xf45540[_0xc1fc('0x2e')][_0xc1fc('0x1c')]);}_0x3c0da5[_0xc1fc('0x35')]=qs['sort'](_0xf45540['query'][_0xc1fc('0x36')]);_0x3c0da5['where']=qs[_0xc1fc('0x37')](_[_0xc1fc('0x38')](_0xf45540[_0xc1fc('0x2e')],_0x1977a4[_0xc1fc('0x37')]),_0x16d15c);if(_0xf45540['query']['filter']){_0x3c0da5[_0xc1fc('0x39')]=_[_0xc1fc('0x3a')](_0x3c0da5[_0xc1fc('0x39')],{'$or':_[_0xc1fc('0x29')](_0x16d15c,function(_0x722d12){if(_0x722d12[_0xc1fc('0x2b')]!==_0xc1fc('0x3b')){var _0x142e53={};_0x142e53[_0x722d12['name']]={'$like':'%'+_0xf45540['query'][_0xc1fc('0x3c')]+'%'};return _0x142e53;}})});}_0x3c0da5=_['merge']({},_0x3c0da5,_0xf45540[_0xc1fc('0x3d')]);var _0x493831={'where':_0x3c0da5[_0xc1fc('0x39')]};return db['ChatQueueReport']['count'](_0x493831)[_0xc1fc('0x23')](function(_0x46b18d){_0x11afe8[_0xc1fc('0x1e')]=_0x46b18d;if(_0xf45540['query']['includeAll']){_0x3c0da5[_0xc1fc('0x3e')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x3c0da5);})[_0xc1fc('0x23')](function(_0x2366d1){_0x11afe8[_0xc1fc('0x3f')]=_0x2366d1;return _0x11afe8;})['then'](respondWithFilteredResult(_0x47ad51,_0x3c0da5))['catch'](handleError(_0x47ad51,null));};exports[_0xc1fc('0x40')]=function(_0x2e48c1,_0x38fe43){var _0x43017d={'raw':!![],'where':{'id':_0x2e48c1[_0xc1fc('0x41')]['id']}},_0x3fcd72={};_0x3fcd72[_0xc1fc('0x31')]=_[_0xc1fc('0x2d')](db[_0xc1fc('0x2a')][_0xc1fc('0x42')]);_0x3fcd72[_0xc1fc('0x2e')]=_['keys'](_0x2e48c1[_0xc1fc('0x2e')]);_0x3fcd72[_0xc1fc('0x37')]=_[_0xc1fc('0x2f')](_0x3fcd72[_0xc1fc('0x31')],_0x3fcd72[_0xc1fc('0x2e')]);_0x43017d[_0xc1fc('0x30')]=_[_0xc1fc('0x2f')](_0x3fcd72['model'],qs[_0xc1fc('0x32')](_0x2e48c1[_0xc1fc('0x2e')][_0xc1fc('0x32')]));_0x43017d[_0xc1fc('0x30')]=_0x43017d[_0xc1fc('0x30')][_0xc1fc('0x33')]?_0x43017d[_0xc1fc('0x30')]:_0x3fcd72[_0xc1fc('0x31')];if(_0x2e48c1['query'][_0xc1fc('0x43')]){_0x43017d[_0xc1fc('0x3e')]=[{'all':!![]}];}_0x43017d=_[_0xc1fc('0x3a')]({},_0x43017d,_0x2e48c1[_0xc1fc('0x3d')]);return db['ChatQueueReport'][_0xc1fc('0x44')](_0x43017d)[_0xc1fc('0x23')](handleEntityNotFound(_0x38fe43,null))[_0xc1fc('0x23')](respondWithResult(_0x38fe43,null))[_0xc1fc('0x45')](handleError(_0x38fe43,null));};exports[_0xc1fc('0x46')]=function(_0x3b4b8d,_0xe76f74){return db[_0xc1fc('0x2a')][_0xc1fc('0x46')](_0x3b4b8d[_0xc1fc('0x47')],{})[_0xc1fc('0x23')](respondWithResult(_0xe76f74,0xc9))['catch'](handleError(_0xe76f74,null));};exports[_0xc1fc('0x48')]=function(_0x1ca680,_0x89bf6a){if(_0x1ca680[_0xc1fc('0x47')]['id']){delete _0x1ca680['body']['id'];}return db['ChatQueueReport'][_0xc1fc('0x44')]({'where':{'id':_0x1ca680['params']['id']}})['then'](handleEntityNotFound(_0x89bf6a,null))[_0xc1fc('0x23')](saveUpdates(_0x1ca680['body'],null))[_0xc1fc('0x23')](respondWithResult(_0x89bf6a,null))[_0xc1fc('0x45')](handleError(_0x89bf6a,null));};exports['destroy']=function(_0x2930ff,_0x48669c){return db[_0xc1fc('0x2a')]['find']({'where':{'id':_0x2930ff[_0xc1fc('0x41')]['id']}})[_0xc1fc('0x23')](handleEntityNotFound(_0x48669c,null))[_0xc1fc('0x23')](removeEntity(_0x48669c,null))[_0xc1fc('0x45')](handleError(_0x48669c,null));};exports[_0xc1fc('0x49')]=function(_0x36b48e,_0x40fd56){return db[_0xc1fc('0x2a')][_0xc1fc('0x49')]()['then'](respondWithResult(_0x40fd56,null))[_0xc1fc('0x45')](handleError(_0x40fd56,null));}; \ No newline at end of file +var _0xee4a=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x266141,_0x302df6){var _0x3439d8=function(_0x436cfa){while(--_0x436cfa){_0x266141['push'](_0x266141['shift']());}};_0x3439d8(++_0x302df6);}(_0xee4a,0x9e));var _0xaee4=function(_0x4973b2,_0x49e35a){_0x4973b2=_0x4973b2-0x0;var _0x57499d=_0xee4a[_0x4973b2];return _0x57499d;};'use strict';var emlformat=require(_0xaee4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaee4('0x1'));var jsonpatch=require(_0xaee4('0x2'));var rp=require(_0xaee4('0x3'));var moment=require('moment');var BPromise=require(_0xaee4('0x4'));var Mustache=require('mustache');var util=require(_0xaee4('0x5'));var path=require('path');var sox=require(_0xaee4('0x6'));var csv=require('to-csv');var ejs=require(_0xaee4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaee4('0x8'));var squel=require(_0xaee4('0x9'));var crypto=require(_0xaee4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaee4('0xb'));var toCsv=require(_0xaee4('0xc'));var querystring=require('querystring');var Papa=require(_0xaee4('0xd'));var Redis=require(_0xaee4('0xe'));var authService=require(_0xaee4('0xf'));var qs=require(_0xaee4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaee4('0x11'));var utils=require(_0xaee4('0x12'));var config=require(_0xaee4('0x13'));var licenseUtil=require(_0xaee4('0x14'));var db=require(_0xaee4('0x15'))['db'];function respondWithStatusCode(_0x1db3f7,_0x19fab2){_0x19fab2=_0x19fab2||0xcc;return function(_0x32d70e){if(_0x32d70e){return _0x1db3f7['sendStatus'](_0x19fab2);}return _0x1db3f7['status'](_0x19fab2)[_0xaee4('0x16')]();};}function respondWithResult(_0x47b2ed,_0x4ecbd8){_0x4ecbd8=_0x4ecbd8||0xc8;return function(_0x2a3d88){if(_0x2a3d88){return _0x47b2ed[_0xaee4('0x17')](_0x4ecbd8)[_0xaee4('0x18')](_0x2a3d88);}};}function respondWithFilteredResult(_0x457963,_0xd47f9e){return function(_0x3aaaf9){if(_0x3aaaf9){var _0x225f34=typeof _0xd47f9e[_0xaee4('0x19')]==='undefined'&&typeof _0xd47f9e[_0xaee4('0x1a')]==='undefined';var _0x552297=_0x3aaaf9[_0xaee4('0x1b')];var _0x632c0f=_0x225f34?0x0:_0xd47f9e[_0xaee4('0x19')];var _0x45bdf2=_0x225f34?_0x3aaaf9[_0xaee4('0x1b')]:_0xd47f9e['offset']+_0xd47f9e[_0xaee4('0x1a')];var _0x251e0d;if(_0x45bdf2>=_0x552297){_0x45bdf2=_0x552297;_0x251e0d=0xc8;}else{_0x251e0d=0xce;}_0x457963['status'](_0x251e0d);return _0x457963[_0xaee4('0x1c')](_0xaee4('0x1d'),_0x632c0f+'-'+_0x45bdf2+'/'+_0x552297)['json'](_0x3aaaf9);}return null;};}function patchUpdates(_0x506725){return function(_0x4e93e7){try{jsonpatch[_0xaee4('0x1e')](_0x4e93e7,_0x506725,!![]);}catch(_0x31a89d){return BPromise[_0xaee4('0x1f')](_0x31a89d);}return _0x4e93e7['save']();};}function saveUpdates(_0x5cafaf,_0x14091f){return function(_0x5ddf54){if(_0x5ddf54){return _0x5ddf54[_0xaee4('0x20')](_0x5cafaf)[_0xaee4('0x21')](function(_0x58fb83){return _0x58fb83;});}return null;};}function removeEntity(_0x204704,_0x3297e4){return function(_0x1fc4fa){if(_0x1fc4fa){return _0x1fc4fa[_0xaee4('0x22')]()[_0xaee4('0x21')](function(){_0x204704[_0xaee4('0x17')](0xcc)[_0xaee4('0x16')]();});}};}function handleEntityNotFound(_0xcee4c7,_0x406e15){return function(_0x46e629){if(!_0x46e629){_0xcee4c7[_0xaee4('0x23')](0x194);}return _0x46e629;};}function handleError(_0x3ff17c,_0x39c088){_0x39c088=_0x39c088||0x1f4;return function(_0x32bc01){logger[_0xaee4('0x24')](_0x32bc01['stack']);if(_0x32bc01[_0xaee4('0x25')]){delete _0x32bc01[_0xaee4('0x25')];}_0x3ff17c[_0xaee4('0x17')](_0x39c088)['send'](_0x32bc01);};}exports[_0xaee4('0x26')]=function(_0x272747,_0x2388a6){var _0x4a7f3a={},_0x2dbf6f={},_0x41fc45={'count':0x0,'rows':[]};var _0x5c2819=_['map'](db[_0xaee4('0x27')][_0xaee4('0x28')],function(_0x43899d){return{'name':_0x43899d[_0xaee4('0x29')],'type':_0x43899d[_0xaee4('0x2a')]['key']};});_0x2dbf6f[_0xaee4('0x2b')]=_[_0xaee4('0x2c')](_0x5c2819,_0xaee4('0x25'));_0x2dbf6f[_0xaee4('0x2d')]=_[_0xaee4('0x2e')](_0x272747[_0xaee4('0x2d')]);_0x2dbf6f[_0xaee4('0x2f')]=_['intersection'](_0x2dbf6f[_0xaee4('0x2b')],_0x2dbf6f[_0xaee4('0x2d')]);_0x4a7f3a['attributes']=_[_0xaee4('0x30')](_0x2dbf6f['model'],qs[_0xaee4('0x31')](_0x272747['query'][_0xaee4('0x31')]));_0x4a7f3a[_0xaee4('0x32')]=_0x4a7f3a[_0xaee4('0x32')][_0xaee4('0x33')]?_0x4a7f3a['attributes']:_0x2dbf6f[_0xaee4('0x2b')];if(!_0x272747[_0xaee4('0x2d')][_0xaee4('0x34')](_0xaee4('0x35'))){_0x4a7f3a[_0xaee4('0x1a')]=qs['limit'](_0x272747[_0xaee4('0x2d')][_0xaee4('0x1a')]);_0x4a7f3a[_0xaee4('0x19')]=qs[_0xaee4('0x19')](_0x272747[_0xaee4('0x2d')]['offset']);}_0x4a7f3a[_0xaee4('0x36')]=qs[_0xaee4('0x37')](_0x272747[_0xaee4('0x2d')]['sort']);_0x4a7f3a[_0xaee4('0x38')]=qs[_0xaee4('0x2f')](_[_0xaee4('0x39')](_0x272747['query'],_0x2dbf6f[_0xaee4('0x2f')]),_0x5c2819);if(_0x272747['query'][_0xaee4('0x3a')]){_0x4a7f3a[_0xaee4('0x38')]=_[_0xaee4('0x3b')](_0x4a7f3a['where'],{'$or':_[_0xaee4('0x2c')](_0x5c2819,function(_0x33df65){if(_0x33df65[_0xaee4('0x2a')]!==_0xaee4('0x3c')){var _0x3bc51f={};_0x3bc51f[_0x33df65[_0xaee4('0x25')]]={'$like':'%'+_0x272747['query'][_0xaee4('0x3a')]+'%'};return _0x3bc51f;}})});}_0x4a7f3a=_['merge']({},_0x4a7f3a,_0x272747[_0xaee4('0x3d')]);var _0xb65357={'where':_0x4a7f3a[_0xaee4('0x38')]};return db['ChatQueueReport'][_0xaee4('0x1b')](_0xb65357)[_0xaee4('0x21')](function(_0x18a8a4){_0x41fc45[_0xaee4('0x1b')]=_0x18a8a4;if(_0x272747['query'][_0xaee4('0x3e')]){_0x4a7f3a[_0xaee4('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xaee4('0x40')](_0x4a7f3a);})[_0xaee4('0x21')](function(_0x5bd19e){_0x41fc45[_0xaee4('0x41')]=_0x5bd19e;return _0x41fc45;})['then'](respondWithFilteredResult(_0x2388a6,_0x4a7f3a))[_0xaee4('0x42')](handleError(_0x2388a6,null));};exports[_0xaee4('0x43')]=function(_0x37ced3,_0x48c077){var _0x30558d={'raw':!![],'where':{'id':_0x37ced3[_0xaee4('0x44')]['id']}},_0xc3a85f={};_0xc3a85f['model']=_[_0xaee4('0x2e')](db['ChatQueueReport'][_0xaee4('0x28')]);_0xc3a85f['query']=_['keys'](_0x37ced3[_0xaee4('0x2d')]);_0xc3a85f['filters']=_['intersection'](_0xc3a85f[_0xaee4('0x2b')],_0xc3a85f[_0xaee4('0x2d')]);_0x30558d['attributes']=_[_0xaee4('0x30')](_0xc3a85f[_0xaee4('0x2b')],qs[_0xaee4('0x31')](_0x37ced3[_0xaee4('0x2d')][_0xaee4('0x31')]));_0x30558d[_0xaee4('0x32')]=_0x30558d[_0xaee4('0x32')][_0xaee4('0x33')]?_0x30558d[_0xaee4('0x32')]:_0xc3a85f[_0xaee4('0x2b')];if(_0x37ced3['query'][_0xaee4('0x3e')]){_0x30558d[_0xaee4('0x3f')]=[{'all':!![]}];}_0x30558d=_[_0xaee4('0x3b')]({},_0x30558d,_0x37ced3[_0xaee4('0x3d')]);return db[_0xaee4('0x27')][_0xaee4('0x45')](_0x30558d)[_0xaee4('0x21')](handleEntityNotFound(_0x48c077,null))[_0xaee4('0x21')](respondWithResult(_0x48c077,null))[_0xaee4('0x42')](handleError(_0x48c077,null));};exports[_0xaee4('0x46')]=function(_0x159aee,_0x143d29){return db['ChatQueueReport'][_0xaee4('0x46')](_0x159aee[_0xaee4('0x47')],{})[_0xaee4('0x21')](respondWithResult(_0x143d29,0xc9))[_0xaee4('0x42')](handleError(_0x143d29,null));};exports[_0xaee4('0x20')]=function(_0x11980b,_0x11fcc7){if(_0x11980b['body']['id']){delete _0x11980b[_0xaee4('0x47')]['id'];}return db[_0xaee4('0x27')][_0xaee4('0x45')]({'where':{'id':_0x11980b[_0xaee4('0x44')]['id']}})['then'](handleEntityNotFound(_0x11fcc7,null))[_0xaee4('0x21')](saveUpdates(_0x11980b[_0xaee4('0x47')],null))[_0xaee4('0x21')](respondWithResult(_0x11fcc7,null))['catch'](handleError(_0x11fcc7,null));};exports['destroy']=function(_0x4608de,_0x42cfd6){return db[_0xaee4('0x27')]['find']({'where':{'id':_0x4608de['params']['id']}})[_0xaee4('0x21')](handleEntityNotFound(_0x42cfd6,null))[_0xaee4('0x21')](removeEntity(_0x42cfd6,null))['catch'](handleError(_0x42cfd6,null));};exports[_0xaee4('0x48')]=function(_0x5d5a8d,_0x5628eb){return db[_0xaee4('0x27')][_0xaee4('0x48')]()[_0xaee4('0x21')](respondWithResult(_0x5628eb,null))[_0xaee4('0x42')](handleError(_0x5628eb,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7ccb1e6..d333f02 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3f542e,_0x38a004){var _0x3a6a12=function(_0x1c3a87){while(--_0x1c3a87){_0x3f542e['push'](_0x3f542e['shift']());}};_0x3a6a12(++_0x38a004);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xcb91[_0x152449];return _0x5b58b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x149659,_0x4de741){var _0x5d0ab5=function(_0xc1720c){while(--_0xc1720c){_0x149659['push'](_0x149659['shift']());}};_0x5d0ab5(++_0x4de741);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xcb91[_0x2d994d];return _0xd54be4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f2d5ae9..b55cba4 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 _0xd8fb=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','debug','UpdateChatQueueReport','update','body','where','attributes','limit','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x439cc8,_0x3469fe){var _0x47e4b0=function(_0xe86034){while(--_0xe86034){_0x439cc8['push'](_0x439cc8['shift']());}};_0x47e4b0(++_0x3469fe);}(_0xd8fb,0x79));var _0xbd8f=function(_0x182b51,_0x455b54){_0x182b51=_0x182b51-0x0;var _0x102ee6=_0xd8fb[_0x182b51];return _0x102ee6;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require('moment');var BPromise=require(_0xbd8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd8f('0x3'))['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))(_0xbd8f('0x6'));var config=require(_0xbd8f('0x7'));var jayson=require(_0xbd8f('0x8'));var client=jayson[_0xbd8f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541cc6,_0x35a18f,_0x1435da){return new BPromise(function(_0x1da2ab,_0x34e83f){return client[_0xbd8f('0xa')](_0x541cc6,_0x1435da)[_0xbd8f('0xb')](function(_0x2cc18f){logger[_0xbd8f('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x35a18f,_0xbd8f('0xd'));logger['debug'](_0xbd8f('0xe'),_0x35a18f,_0xbd8f('0xd'),JSON['stringify'](_0x2cc18f));if(_0x2cc18f[_0xbd8f('0xf')]){if(_0x2cc18f[_0xbd8f('0xf')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x35a18f,_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);return _0x34e83f(_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);}logger[_0xbd8f('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x35a18f,_0x2cc18f[_0xbd8f('0xf')][_0xbd8f('0x10')]);return _0x1da2ab(_0x2cc18f[_0xbd8f('0xf')]['message']);}else{logger['info'](_0xbd8f('0x11'),_0x35a18f,'request\x20sent');_0x1da2ab(_0x2cc18f[_0xbd8f('0x12')][_0xbd8f('0x10')]);}})[_0xbd8f('0x13')](function(_0x4ece3d){logger[_0xbd8f('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x35a18f,_0x4ece3d);_0x34e83f(_0x4ece3d);});});}exports[_0xbd8f('0x14')]=function(_0xcf50e0){var _0x4ac8bd=this;return new Promise(function(_0x1c3c2c,_0x4c7176){return db[_0xbd8f('0x15')]['create'](_0xcf50e0['body'],{'raw':_0xcf50e0[_0xbd8f('0x16')]?_0xcf50e0['options'][_0xbd8f('0x17')]===undefined?!![]:![]:!![]})[_0xbd8f('0xb')](function(_0x58faae){logger['info'](_0xbd8f('0x14'),_0xcf50e0);logger[_0xbd8f('0x18')](_0xbd8f('0x14'),_0xcf50e0,JSON['stringify'](_0x58faae));_0x1c3c2c(_0x58faae);})[_0xbd8f('0x13')](function(_0x38d697){logger['error'](_0xbd8f('0x14'),_0x38d697[_0xbd8f('0x10')],_0xcf50e0);_0x4c7176(_0x4ac8bd[_0xbd8f('0xf')](0x1f4,_0x38d697[_0xbd8f('0x10')]));});});};exports[_0xbd8f('0x19')]=function(_0x214310){var _0x28c1a1=this;return new Promise(function(_0x2209da,_0x5198e8){return db[_0xbd8f('0x15')][_0xbd8f('0x1a')](_0x214310[_0xbd8f('0x1b')],{'raw':_0x214310[_0xbd8f('0x16')]?_0x214310[_0xbd8f('0x16')][_0xbd8f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x214310[_0xbd8f('0x16')]?_0x214310['options'][_0xbd8f('0x1c')]||null:null,'attributes':_0x214310['options']?_0x214310[_0xbd8f('0x16')][_0xbd8f('0x1d')]||null:null,'limit':_0x214310['options']?_0x214310[_0xbd8f('0x16')][_0xbd8f('0x1e')]||null:null})[_0xbd8f('0xb')](function(_0x364906){logger['info'](_0xbd8f('0x19'),_0x214310);logger['debug'](_0xbd8f('0x19'),_0x214310,JSON[_0xbd8f('0x1f')](_0x364906));_0x2209da(_0x364906);})[_0xbd8f('0x13')](function(_0x5b0092){logger['error'](_0xbd8f('0x19'),_0x5b0092[_0xbd8f('0x10')],_0x214310);_0x5198e8(_0x28c1a1['error'](0x1f4,_0x5b0092[_0xbd8f('0x10')]));});});}; \ No newline at end of file +var _0x85d4=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x85d4,0x121));var _0x485d=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x85d4[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x485d('0x0'));var util=require(_0x485d('0x1'));var moment=require(_0x485d('0x2'));var BPromise=require(_0x485d('0x3'));var rs=require(_0x485d('0x4'));var fs=require('fs');var Redis=require(_0x485d('0x5'));var db=require(_0x485d('0x6'))['db'];var utils=require(_0x485d('0x7'));var logger=require('../../config/logger')(_0x485d('0x8'));var config=require(_0x485d('0x9'));var jayson=require(_0x485d('0xa'));var client=jayson[_0x485d('0xb')][_0x485d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f4c45,_0x531dc9,_0x5ed9cf){return new BPromise(function(_0x1d332e,_0x4ef048){return client[_0x485d('0xd')](_0x2f4c45,_0x5ed9cf)[_0x485d('0xe')](function(_0x4cb8f6){logger[_0x485d('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x531dc9,'request\x20sent');logger[_0x485d('0x10')](_0x485d('0x11'),_0x531dc9,_0x485d('0x12'),JSON[_0x485d('0x13')](_0x4cb8f6));if(_0x4cb8f6[_0x485d('0x14')]){if(_0x4cb8f6[_0x485d('0x14')][_0x485d('0x15')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x531dc9,_0x4cb8f6[_0x485d('0x14')][_0x485d('0x16')]);return _0x4ef048(_0x4cb8f6[_0x485d('0x14')][_0x485d('0x16')]);}logger[_0x485d('0x14')](_0x485d('0x17'),_0x531dc9,_0x4cb8f6[_0x485d('0x14')][_0x485d('0x16')]);return _0x1d332e(_0x4cb8f6['error'][_0x485d('0x16')]);}else{logger[_0x485d('0xf')](_0x485d('0x17'),_0x531dc9,'request\x20sent');_0x1d332e(_0x4cb8f6[_0x485d('0x18')][_0x485d('0x16')]);}})[_0x485d('0x19')](function(_0x4a747f){logger[_0x485d('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x531dc9,_0x4a747f);_0x4ef048(_0x4a747f);});});}exports['CreateChatQueueReport']=function(_0x11bb1c){var _0x5c6008=this;return new Promise(function(_0x8de5e5,_0x5f348c){return db[_0x485d('0x1a')][_0x485d('0x1b')](_0x11bb1c[_0x485d('0x1c')],{'raw':_0x11bb1c[_0x485d('0x1d')]?_0x11bb1c[_0x485d('0x1d')][_0x485d('0x1e')]===undefined?!![]:![]:!![]})[_0x485d('0xe')](function(_0x45e2bd){logger[_0x485d('0xf')](_0x485d('0x1f'),_0x11bb1c);logger['debug'](_0x485d('0x1f'),_0x11bb1c,JSON[_0x485d('0x13')](_0x45e2bd));_0x8de5e5(_0x45e2bd);})['catch'](function(_0x35c169){logger[_0x485d('0x14')](_0x485d('0x1f'),_0x35c169[_0x485d('0x16')],_0x11bb1c);_0x5f348c(_0x5c6008[_0x485d('0x14')](0x1f4,_0x35c169[_0x485d('0x16')]));});});};exports[_0x485d('0x20')]=function(_0x11ad29){var _0x1dc77d=this;return new Promise(function(_0x44e604,_0x54f801){return db['ChatQueueReport']['update'](_0x11ad29['body'],{'raw':_0x11ad29[_0x485d('0x1d')]?_0x11ad29[_0x485d('0x1d')][_0x485d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11ad29[_0x485d('0x1d')]?_0x11ad29['options'][_0x485d('0x21')]||null:null,'attributes':_0x11ad29['options']?_0x11ad29[_0x485d('0x1d')][_0x485d('0x22')]||null:null,'limit':_0x11ad29[_0x485d('0x1d')]?_0x11ad29[_0x485d('0x1d')][_0x485d('0x23')]||null:null})['then'](function(_0x56a07b){logger[_0x485d('0xf')](_0x485d('0x20'),_0x11ad29);logger[_0x485d('0x10')](_0x485d('0x20'),_0x11ad29,JSON[_0x485d('0x13')](_0x56a07b));_0x44e604(_0x56a07b);})[_0x485d('0x19')](function(_0xe6884c){logger['error'](_0x485d('0x20'),_0xe6884c['message'],_0x11ad29);_0x54f801(_0x1dc77d[_0x485d('0x14')](0x1f4,_0xe6884c[_0x485d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 79bae23..7709089 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 _0x3c5a=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x50a1f6,_0x3cb02a){var _0x70d3f3=function(_0x392b9a){while(--_0x392b9a){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x70d3f3(++_0x3cb02a);}(_0x3c5a,0x109));var _0xa3c5=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x3c5a[_0x16ea87];return _0x6e7b1c;};'use strict';var multer=require('multer');var util=require(_0xa3c5('0x0'));var path=require('path');var timeout=require(_0xa3c5('0x1'));var express=require('express');var router=express[_0xa3c5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa3c5('0x3'));var interaction=require(_0xa3c5('0x4'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0xa3c5('0x5')]('/',auth[_0xa3c5('0x6')](),controller['index']);router[_0xa3c5('0x5')](_0xa3c5('0x7'),auth[_0xa3c5('0x6')](),controller[_0xa3c5('0x8')]);router[_0xa3c5('0x5')](_0xa3c5('0x9'),auth[_0xa3c5('0x6')](),controller[_0xa3c5('0xa')]);router['post']('/',auth[_0xa3c5('0x6')](),controller[_0xa3c5('0xb')]);router[_0xa3c5('0xc')](_0xa3c5('0x9'),auth[_0xa3c5('0x6')](),controller[_0xa3c5('0xd')]);router[_0xa3c5('0xe')](_0xa3c5('0x9'),auth[_0xa3c5('0x6')](),controller[_0xa3c5('0xf')]);module[_0xa3c5('0x10')]=router; \ No newline at end of file +var _0xc214=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','create','put','update','/:id','util'];(function(_0x5251b4,_0x31dd9c){var _0x3fc1d5=function(_0xa9650f){while(--_0xa9650f){_0x5251b4['push'](_0x5251b4['shift']());}};_0x3fc1d5(++_0x31dd9c);}(_0xc214,0x1b9));var _0x4c21=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xc214[_0x231e16];return _0x570a7c;};'use strict';var multer=require('multer');var util=require(_0x4c21('0x0'));var path=require(_0x4c21('0x1'));var timeout=require(_0x4c21('0x2'));var express=require(_0x4c21('0x3'));var router=express[_0x4c21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c21('0x5'));var interaction=require(_0x4c21('0x6'));var config=require('../../config/environment');var controller=require(_0x4c21('0x7'));router[_0x4c21('0x8')]('/',auth[_0x4c21('0x9')](),controller['index']);router[_0x4c21('0x8')](_0x4c21('0xa'),auth[_0x4c21('0x9')](),controller[_0x4c21('0xb')]);router[_0x4c21('0x8')]('/:id',auth[_0x4c21('0x9')](),controller[_0x4c21('0xc')]);router['post']('/',auth[_0x4c21('0x9')](),controller[_0x4c21('0xd')]);router[_0x4c21('0xe')]('/:id',auth[_0x4c21('0x9')](),controller[_0x4c21('0xf')]);router['delete'](_0x4c21('0x10'),auth[_0x4c21('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 525ef54..cfd2c2a 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x43bd37,_0x500e36){var _0x546999=function(_0x25885d){while(--_0x25885d){_0x43bd37['push'](_0x43bd37['shift']());}};_0x546999(++_0x500e36);}(_0xaa88,0x137));var _0x8aa8=function(_0x2abaae,_0x29fd8b){_0x2abaae=_0x2abaae-0x0;var _0x5b5745=_0xaa88[_0x2abaae];return _0x5b5745;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x559c7e,_0x2b2694){_0x559c7e=_0x559c7e-0x0;var _0xb8ea03=_0x9bde[_0x559c7e];return _0xb8ea03;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2b57293..f7a019c 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 _0x5194=['filter','options','ChatTransferReport','then','includeAll','include','rows','catch','show','keys','create','body','find','params','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','sendStatus','error','name','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x571a36,_0x5936f2){var _0x4dd68e=function(_0x12d4c7){while(--_0x12d4c7){_0x571a36['push'](_0x571a36['shift']());}};_0x4dd68e(++_0x5936f2);}(_0x5194,0x173));var _0x4519=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5194[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4519('0x0'));var jsonpatch=require(_0x4519('0x1'));var rp=require(_0x4519('0x2'));var moment=require(_0x4519('0x3'));var BPromise=require(_0x4519('0x4'));var Mustache=require(_0x4519('0x5'));var util=require(_0x4519('0x6'));var path=require(_0x4519('0x7'));var sox=require(_0x4519('0x8'));var csv=require('to-csv');var ejs=require(_0x4519('0x9'));var fs=require('fs');var fs_extra=require(_0x4519('0xa'));var _=require(_0x4519('0xb'));var squel=require(_0x4519('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4519('0xd'));var querystring=require(_0x4519('0xe'));var Papa=require(_0x4519('0xf'));var Redis=require('ioredis');var authService=require(_0x4519('0x10'));var qs=require(_0x4519('0x11'));var as=require(_0x4519('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4519('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4519('0x14'));var db=require(_0x4519('0x15'))['db'];function respondWithStatusCode(_0x19a957,_0x41fc25){_0x41fc25=_0x41fc25||0xcc;return function(_0x2c9b8e){if(_0x2c9b8e){return _0x19a957['sendStatus'](_0x41fc25);}return _0x19a957['status'](_0x41fc25)[_0x4519('0x16')]();};}function respondWithResult(_0x1d19f4,_0x37e98a){_0x37e98a=_0x37e98a||0xc8;return function(_0xdf2815){if(_0xdf2815){return _0x1d19f4['status'](_0x37e98a)[_0x4519('0x17')](_0xdf2815);}};}function respondWithFilteredResult(_0x4ca561,_0x42468f){return function(_0x1b0fc9){if(_0x1b0fc9){var _0x51fe35=typeof _0x42468f[_0x4519('0x18')]===_0x4519('0x19')&&typeof _0x42468f[_0x4519('0x1a')]==='undefined';var _0xc10171=_0x1b0fc9['count'];var _0x447c02=_0x51fe35?0x0:_0x42468f[_0x4519('0x18')];var _0x144f42=_0x51fe35?_0x1b0fc9[_0x4519('0x1b')]:_0x42468f['offset']+_0x42468f['limit'];var _0x1cbea4;if(_0x144f42>=_0xc10171){_0x144f42=_0xc10171;_0x1cbea4=0xc8;}else{_0x1cbea4=0xce;}_0x4ca561[_0x4519('0x1c')](_0x1cbea4);return _0x4ca561['set'](_0x4519('0x1d'),_0x447c02+'-'+_0x144f42+'/'+_0xc10171)['json'](_0x1b0fc9);}return null;};}function patchUpdates(_0x2fb298){return function(_0x5a1ca3){try{jsonpatch[_0x4519('0x1e')](_0x5a1ca3,_0x2fb298,!![]);}catch(_0x2d4021){return BPromise[_0x4519('0x1f')](_0x2d4021);}return _0x5a1ca3[_0x4519('0x20')]();};}function saveUpdates(_0x1ac5ed,_0x2304a2){return function(_0x3cfef3){if(_0x3cfef3){return _0x3cfef3[_0x4519('0x21')](_0x1ac5ed)['then'](function(_0x2f9777){return _0x2f9777;});}return null;};}function removeEntity(_0x5a8a47,_0x284cce){return function(_0x2bcfe1){if(_0x2bcfe1){return _0x2bcfe1['destroy']()['then'](function(){_0x5a8a47[_0x4519('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18eb0e,_0x4cfc12){return function(_0x52b630){if(!_0x52b630){_0x18eb0e[_0x4519('0x22')](0x194);}return _0x52b630;};}function handleError(_0x53a32b,_0x4e2fe7){_0x4e2fe7=_0x4e2fe7||0x1f4;return function(_0x3865ec){logger[_0x4519('0x23')](_0x3865ec['stack']);if(_0x3865ec[_0x4519('0x24')]){delete _0x3865ec['name'];}_0x53a32b[_0x4519('0x1c')](_0x4e2fe7)['send'](_0x3865ec);};}exports['index']=function(_0x1061d5,_0x435850){var _0x2631d5={},_0x20d837={},_0x17561b={'count':0x0,'rows':[]};var _0x1cb41e=_[_0x4519('0x25')](db['ChatTransferReport']['rawAttributes'],function(_0x387b3e){return{'name':_0x387b3e[_0x4519('0x26')],'type':_0x387b3e[_0x4519('0x27')][_0x4519('0x28')]};});_0x20d837[_0x4519('0x29')]=_[_0x4519('0x25')](_0x1cb41e,_0x4519('0x24'));_0x20d837[_0x4519('0x2a')]=_['keys'](_0x1061d5[_0x4519('0x2a')]);_0x20d837[_0x4519('0x2b')]=_[_0x4519('0x2c')](_0x20d837['model'],_0x20d837[_0x4519('0x2a')]);_0x2631d5[_0x4519('0x2d')]=_[_0x4519('0x2c')](_0x20d837[_0x4519('0x29')],qs[_0x4519('0x2e')](_0x1061d5[_0x4519('0x2a')][_0x4519('0x2e')]));_0x2631d5['attributes']=_0x2631d5[_0x4519('0x2d')][_0x4519('0x2f')]?_0x2631d5[_0x4519('0x2d')]:_0x20d837[_0x4519('0x29')];if(!_0x1061d5['query'][_0x4519('0x30')](_0x4519('0x31'))){_0x2631d5[_0x4519('0x1a')]=qs[_0x4519('0x1a')](_0x1061d5[_0x4519('0x2a')][_0x4519('0x1a')]);_0x2631d5[_0x4519('0x18')]=qs['offset'](_0x1061d5[_0x4519('0x2a')][_0x4519('0x18')]);}_0x2631d5['order']=qs['sort'](_0x1061d5[_0x4519('0x2a')][_0x4519('0x32')]);_0x2631d5[_0x4519('0x33')]=qs[_0x4519('0x2b')](_[_0x4519('0x34')](_0x1061d5[_0x4519('0x2a')],_0x20d837[_0x4519('0x2b')]),_0x1cb41e);if(_0x1061d5[_0x4519('0x2a')]['filter']){_0x2631d5[_0x4519('0x33')]=_[_0x4519('0x35')](_0x2631d5[_0x4519('0x33')],{'$or':_['map'](_0x1cb41e,function(_0x2fa3c5){if(_0x2fa3c5[_0x4519('0x27')]!==_0x4519('0x36')){var _0x1ad8bb={};_0x1ad8bb[_0x2fa3c5[_0x4519('0x24')]]={'$like':'%'+_0x1061d5[_0x4519('0x2a')][_0x4519('0x37')]+'%'};return _0x1ad8bb;}})});}_0x2631d5=_['merge']({},_0x2631d5,_0x1061d5[_0x4519('0x38')]);var _0x1168c6={'where':_0x2631d5[_0x4519('0x33')]};return db[_0x4519('0x39')][_0x4519('0x1b')](_0x1168c6)[_0x4519('0x3a')](function(_0x2f0928){_0x17561b[_0x4519('0x1b')]=_0x2f0928;if(_0x1061d5[_0x4519('0x2a')][_0x4519('0x3b')]){_0x2631d5[_0x4519('0x3c')]=[{'all':!![]}];}return db[_0x4519('0x39')]['findAll'](_0x2631d5);})[_0x4519('0x3a')](function(_0x4cfbb5){_0x17561b[_0x4519('0x3d')]=_0x4cfbb5;return _0x17561b;})[_0x4519('0x3a')](respondWithFilteredResult(_0x435850,_0x2631d5))[_0x4519('0x3e')](handleError(_0x435850,null));};exports[_0x4519('0x3f')]=function(_0x39cb7d,_0x16b2fa){var _0x59a27b={'raw':!![],'where':{'id':_0x39cb7d['params']['id']}},_0x2be4b5={};_0x2be4b5[_0x4519('0x29')]=_['keys'](db[_0x4519('0x39')]['rawAttributes']);_0x2be4b5[_0x4519('0x2a')]=_[_0x4519('0x40')](_0x39cb7d['query']);_0x2be4b5[_0x4519('0x2b')]=_['intersection'](_0x2be4b5['model'],_0x2be4b5[_0x4519('0x2a')]);_0x59a27b[_0x4519('0x2d')]=_[_0x4519('0x2c')](_0x2be4b5['model'],qs['fields'](_0x39cb7d[_0x4519('0x2a')]['fields']));_0x59a27b['attributes']=_0x59a27b['attributes'][_0x4519('0x2f')]?_0x59a27b[_0x4519('0x2d')]:_0x2be4b5[_0x4519('0x29')];if(_0x39cb7d[_0x4519('0x2a')][_0x4519('0x3b')]){_0x59a27b[_0x4519('0x3c')]=[{'all':!![]}];}_0x59a27b=_['merge']({},_0x59a27b,_0x39cb7d['options']);return db[_0x4519('0x39')]['find'](_0x59a27b)['then'](handleEntityNotFound(_0x16b2fa,null))[_0x4519('0x3a')](respondWithResult(_0x16b2fa,null))[_0x4519('0x3e')](handleError(_0x16b2fa,null));};exports[_0x4519('0x41')]=function(_0x5491a6,_0x5bbca7){return db[_0x4519('0x39')][_0x4519('0x41')](_0x5491a6[_0x4519('0x42')],{})[_0x4519('0x3a')](respondWithResult(_0x5bbca7,0xc9))[_0x4519('0x3e')](handleError(_0x5bbca7,null));};exports[_0x4519('0x21')]=function(_0x4b8dac,_0x2ebca7){if(_0x4b8dac['body']['id']){delete _0x4b8dac['body']['id'];}return db[_0x4519('0x39')][_0x4519('0x43')]({'where':{'id':_0x4b8dac[_0x4519('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ebca7,null))[_0x4519('0x3a')](saveUpdates(_0x4b8dac[_0x4519('0x42')],null))['then'](respondWithResult(_0x2ebca7,null))['catch'](handleError(_0x2ebca7,null));};exports[_0x4519('0x45')]=function(_0x11ec0e,_0x364bb1){return db[_0x4519('0x39')][_0x4519('0x43')]({'where':{'id':_0x11ec0e['params']['id']}})[_0x4519('0x3a')](handleEntityNotFound(_0x364bb1,null))[_0x4519('0x3a')](removeEntity(_0x364bb1,null))['catch'](handleError(_0x364bb1,null));};exports[_0x4519('0x46')]=function(_0x1b800b,_0x132b8f){return db[_0x4519('0x39')][_0x4519('0x46')]()[_0x4519('0x3a')](respondWithResult(_0x132b8f,null))[_0x4519('0x3e')](handleError(_0x132b8f,null));}; \ No newline at end of file +var _0xe590=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','status','apply','save','update','then','stack','name','send','map','ChatTransferReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path'];(function(_0x71089a,_0x275273){var _0x28718e=function(_0x176424){while(--_0x176424){_0x71089a['push'](_0x71089a['shift']());}};_0x28718e(++_0x275273);}(_0xe590,0xce));var _0x0e59=function(_0x2e778b,_0x44be20){_0x2e778b=_0x2e778b-0x0;var _0x532e92=_0xe590[_0x2e778b];return _0x532e92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e59('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e59('0x1'));var moment=require(_0x0e59('0x2'));var BPromise=require(_0x0e59('0x3'));var Mustache=require(_0x0e59('0x4'));var util=require(_0x0e59('0x5'));var path=require(_0x0e59('0x6'));var sox=require('sox');var csv=require(_0x0e59('0x7'));var ejs=require(_0x0e59('0x8'));var fs=require('fs');var fs_extra=require(_0x0e59('0x9'));var _=require(_0x0e59('0xa'));var squel=require(_0x0e59('0xb'));var crypto=require(_0x0e59('0xc'));var jsforce=require(_0x0e59('0xd'));var deskjs=require(_0x0e59('0xe'));var toCsv=require(_0x0e59('0x7'));var querystring=require(_0x0e59('0xf'));var Papa=require(_0x0e59('0x10'));var Redis=require(_0x0e59('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e59('0x12'))(_0x0e59('0x13'));var utils=require('../../config/utils');var config=require(_0x0e59('0x14'));var licenseUtil=require(_0x0e59('0x15'));var db=require(_0x0e59('0x16'))['db'];function respondWithStatusCode(_0x175143,_0x543d31){_0x543d31=_0x543d31||0xcc;return function(_0x53c9a1){if(_0x53c9a1){return _0x175143[_0x0e59('0x17')](_0x543d31);}return _0x175143['status'](_0x543d31)[_0x0e59('0x18')]();};}function respondWithResult(_0x54d7a0,_0x17b465){_0x17b465=_0x17b465||0xc8;return function(_0x4ef248){if(_0x4ef248){return _0x54d7a0['status'](_0x17b465)[_0x0e59('0x19')](_0x4ef248);}};}function respondWithFilteredResult(_0x707ba2,_0x224835){return function(_0x24db32){if(_0x24db32){var _0x632b41=typeof _0x224835['offset']===_0x0e59('0x1a')&&typeof _0x224835[_0x0e59('0x1b')]===_0x0e59('0x1a');var _0x491955=_0x24db32['count'];var _0x58bf04=_0x632b41?0x0:_0x224835[_0x0e59('0x1c')];var _0x51ad11=_0x632b41?_0x24db32['count']:_0x224835[_0x0e59('0x1c')]+_0x224835[_0x0e59('0x1b')];var _0x1596c7;if(_0x51ad11>=_0x491955){_0x51ad11=_0x491955;_0x1596c7=0xc8;}else{_0x1596c7=0xce;}_0x707ba2[_0x0e59('0x1d')](_0x1596c7);return _0x707ba2['set']('Content-Range',_0x58bf04+'-'+_0x51ad11+'/'+_0x491955)[_0x0e59('0x19')](_0x24db32);}return null;};}function patchUpdates(_0x30dc55){return function(_0x327ca0){try{jsonpatch[_0x0e59('0x1e')](_0x327ca0,_0x30dc55,!![]);}catch(_0x51353c){return BPromise['reject'](_0x51353c);}return _0x327ca0[_0x0e59('0x1f')]();};}function saveUpdates(_0x1246ad,_0x2f9266){return function(_0x22b96b){if(_0x22b96b){return _0x22b96b[_0x0e59('0x20')](_0x1246ad)['then'](function(_0x13cc01){return _0x13cc01;});}return null;};}function removeEntity(_0x492270,_0x13410c){return function(_0x53c715){if(_0x53c715){return _0x53c715['destroy']()[_0x0e59('0x21')](function(){_0x492270['status'](0xcc)[_0x0e59('0x18')]();});}};}function handleEntityNotFound(_0x2d1091,_0x50d2ab){return function(_0x43959e){if(!_0x43959e){_0x2d1091['sendStatus'](0x194);}return _0x43959e;};}function handleError(_0x2d9615,_0x539470){_0x539470=_0x539470||0x1f4;return function(_0x4b0518){logger['error'](_0x4b0518[_0x0e59('0x22')]);if(_0x4b0518[_0x0e59('0x23')]){delete _0x4b0518[_0x0e59('0x23')];}_0x2d9615['status'](_0x539470)[_0x0e59('0x24')](_0x4b0518);};}exports['index']=function(_0x5ebbfc,_0x1d4112){var _0x1c51a9={},_0x23a539={},_0x4a1608={'count':0x0,'rows':[]};var _0x2c0499=_[_0x0e59('0x25')](db[_0x0e59('0x26')]['rawAttributes'],function(_0x2fdad5){return{'name':_0x2fdad5[_0x0e59('0x27')],'type':_0x2fdad5[_0x0e59('0x28')]['key']};});_0x23a539[_0x0e59('0x29')]=_[_0x0e59('0x25')](_0x2c0499,_0x0e59('0x23'));_0x23a539[_0x0e59('0x2a')]=_['keys'](_0x5ebbfc[_0x0e59('0x2a')]);_0x23a539[_0x0e59('0x2b')]=_[_0x0e59('0x2c')](_0x23a539['model'],_0x23a539[_0x0e59('0x2a')]);_0x1c51a9[_0x0e59('0x2d')]=_[_0x0e59('0x2c')](_0x23a539['model'],qs[_0x0e59('0x2e')](_0x5ebbfc[_0x0e59('0x2a')]['fields']));_0x1c51a9[_0x0e59('0x2d')]=_0x1c51a9[_0x0e59('0x2d')][_0x0e59('0x2f')]?_0x1c51a9[_0x0e59('0x2d')]:_0x23a539['model'];if(!_0x5ebbfc[_0x0e59('0x2a')][_0x0e59('0x30')](_0x0e59('0x31'))){_0x1c51a9[_0x0e59('0x1b')]=qs['limit'](_0x5ebbfc[_0x0e59('0x2a')][_0x0e59('0x1b')]);_0x1c51a9[_0x0e59('0x1c')]=qs[_0x0e59('0x1c')](_0x5ebbfc['query'][_0x0e59('0x1c')]);}_0x1c51a9[_0x0e59('0x32')]=qs[_0x0e59('0x33')](_0x5ebbfc['query'][_0x0e59('0x33')]);_0x1c51a9[_0x0e59('0x34')]=qs[_0x0e59('0x2b')](_[_0x0e59('0x35')](_0x5ebbfc[_0x0e59('0x2a')],_0x23a539['filters']),_0x2c0499);if(_0x5ebbfc['query'][_0x0e59('0x36')]){_0x1c51a9[_0x0e59('0x34')]=_[_0x0e59('0x37')](_0x1c51a9[_0x0e59('0x34')],{'$or':_[_0x0e59('0x25')](_0x2c0499,function(_0x3b17fe){if(_0x3b17fe[_0x0e59('0x28')]!==_0x0e59('0x38')){var _0x1b5652={};_0x1b5652[_0x3b17fe[_0x0e59('0x23')]]={'$like':'%'+_0x5ebbfc[_0x0e59('0x2a')]['filter']+'%'};return _0x1b5652;}})});}_0x1c51a9=_[_0x0e59('0x37')]({},_0x1c51a9,_0x5ebbfc['options']);var _0x371f8a={'where':_0x1c51a9[_0x0e59('0x34')]};return db[_0x0e59('0x26')][_0x0e59('0x39')](_0x371f8a)[_0x0e59('0x21')](function(_0x2097a8){_0x4a1608[_0x0e59('0x39')]=_0x2097a8;if(_0x5ebbfc[_0x0e59('0x2a')]['includeAll']){_0x1c51a9[_0x0e59('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x0e59('0x3b')](_0x1c51a9);})['then'](function(_0x2ae3c4){_0x4a1608['rows']=_0x2ae3c4;return _0x4a1608;})[_0x0e59('0x21')](respondWithFilteredResult(_0x1d4112,_0x1c51a9))[_0x0e59('0x3c')](handleError(_0x1d4112,null));};exports[_0x0e59('0x3d')]=function(_0x3bd73a,_0x42c0b0){var _0x2024ee={'raw':!![],'where':{'id':_0x3bd73a[_0x0e59('0x3e')]['id']}},_0x305525={};_0x305525[_0x0e59('0x29')]=_[_0x0e59('0x3f')](db[_0x0e59('0x26')][_0x0e59('0x40')]);_0x305525[_0x0e59('0x2a')]=_[_0x0e59('0x3f')](_0x3bd73a[_0x0e59('0x2a')]);_0x305525[_0x0e59('0x2b')]=_['intersection'](_0x305525[_0x0e59('0x29')],_0x305525['query']);_0x2024ee[_0x0e59('0x2d')]=_[_0x0e59('0x2c')](_0x305525[_0x0e59('0x29')],qs[_0x0e59('0x2e')](_0x3bd73a[_0x0e59('0x2a')][_0x0e59('0x2e')]));_0x2024ee[_0x0e59('0x2d')]=_0x2024ee[_0x0e59('0x2d')][_0x0e59('0x2f')]?_0x2024ee[_0x0e59('0x2d')]:_0x305525[_0x0e59('0x29')];if(_0x3bd73a[_0x0e59('0x2a')][_0x0e59('0x41')]){_0x2024ee[_0x0e59('0x3a')]=[{'all':!![]}];}_0x2024ee=_[_0x0e59('0x37')]({},_0x2024ee,_0x3bd73a[_0x0e59('0x42')]);return db['ChatTransferReport'][_0x0e59('0x43')](_0x2024ee)['then'](handleEntityNotFound(_0x42c0b0,null))[_0x0e59('0x21')](respondWithResult(_0x42c0b0,null))[_0x0e59('0x3c')](handleError(_0x42c0b0,null));};exports[_0x0e59('0x44')]=function(_0x34df2a,_0x1a5c8c){return db[_0x0e59('0x26')]['create'](_0x34df2a[_0x0e59('0x45')],{})['then'](respondWithResult(_0x1a5c8c,0xc9))[_0x0e59('0x3c')](handleError(_0x1a5c8c,null));};exports[_0x0e59('0x20')]=function(_0x2fe446,_0x46f385){if(_0x2fe446['body']['id']){delete _0x2fe446[_0x0e59('0x45')]['id'];}return db[_0x0e59('0x26')][_0x0e59('0x43')]({'where':{'id':_0x2fe446[_0x0e59('0x3e')]['id']}})['then'](handleEntityNotFound(_0x46f385,null))[_0x0e59('0x21')](saveUpdates(_0x2fe446[_0x0e59('0x45')],null))[_0x0e59('0x21')](respondWithResult(_0x46f385,null))[_0x0e59('0x3c')](handleError(_0x46f385,null));};exports['destroy']=function(_0x41480a,_0x21db48){return db['ChatTransferReport'][_0x0e59('0x43')]({'where':{'id':_0x41480a[_0x0e59('0x3e')]['id']}})[_0x0e59('0x21')](handleEntityNotFound(_0x21db48,null))[_0x0e59('0x21')](removeEntity(_0x21db48,null))[_0x0e59('0x3c')](handleError(_0x21db48,null));};exports[_0x0e59('0x46')]=function(_0xc9a109,_0x561fdf){return db[_0x0e59('0x26')][_0x0e59('0x46')]()['then'](respondWithResult(_0x561fdf,null))[_0x0e59('0x3c')](handleError(_0x561fdf,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8e2214f..ccbdb8e 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 _0xbf51=['util','../../config/logger','api','bluebird','request-promise','rimraf','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash'];(function(_0x22df76,_0x56676e){var _0x32eda9=function(_0x3f7c47){while(--_0x3f7c47){_0x22df76['push'](_0x22df76['shift']());}};_0x32eda9(++_0x56676e);}(_0xbf51,0xc5));var _0x1bf5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbf51[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x1bf5('0x0'));var util=require(_0x1bf5('0x1'));var logger=require(_0x1bf5('0x2'))(_0x1bf5('0x3'));var moment=require('moment');var BPromise=require(_0x1bf5('0x4'));var rp=require(_0x1bf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bf5('0x6'));var config=require('../../config/environment');var attributes=require(_0x1bf5('0x7'));module['exports']=function(_0x532690,_0xeb0ad4){return _0x532690[_0x1bf5('0x8')](_0x1bf5('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x1bf5('0xa'),'fields':[_0x1bf5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3fd4=['util','../../config/logger','path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3fd4,0xf1));var _0x43fd=function(_0x1aa428,_0x43643f){_0x1aa428=_0x1aa428-0x0;var _0x5c8d13=_0x3fd4[_0x1aa428];return _0x5c8d13;};'use strict';var _=require(_0x43fd('0x0'));var util=require(_0x43fd('0x1'));var logger=require(_0x43fd('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43fd('0x3'));var rimraf=require(_0x43fd('0x4'));var config=require('../../config/environment');var attributes=require(_0x43fd('0x5'));module[_0x43fd('0x6')]=function(_0x1f0e20,_0x33481e){return _0x1f0e20[_0x43fd('0x7')](_0x43fd('0x8'),attributes,{'tableName':_0x43fd('0x9'),'paranoid':![],'indexes':[{'name':_0x43fd('0xa'),'fields':[_0x43fd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index a357615..e3f063f 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 _0x4b6e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b6e,0x14a));var _0xe4b6=function(_0x2abf7f,_0x23b05a){_0x2abf7f=_0x2abf7f-0x0;var _0x248bce=_0x4b6e[_0x2abf7f];return _0x248bce;};'use strict';var _=require(_0xe4b6('0x0'));var util=require(_0xe4b6('0x1'));var moment=require(_0xe4b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4b6('0x3'));var fs=require('fs');var Redis=require(_0xe4b6('0x4'));var db=require(_0xe4b6('0x5'))['db'];var utils=require(_0xe4b6('0x6'));var logger=require(_0xe4b6('0x7'))(_0xe4b6('0x8'));var config=require(_0xe4b6('0x9'));var jayson=require(_0xe4b6('0xa'));var client=jayson[_0xe4b6('0xb')][_0xe4b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe6d42a,_0x11b109,_0x4d9492){return new BPromise(function(_0x2ab13d,_0x4798f1){return client[_0xe4b6('0xd')](_0xe6d42a,_0x4d9492)[_0xe4b6('0xe')](function(_0x50641d){logger[_0xe4b6('0xf')](_0xe4b6('0x10'),_0x11b109,_0xe4b6('0x11'));logger['debug'](_0xe4b6('0x12'),_0x11b109,'request\x20sent',JSON['stringify'](_0x50641d));if(_0x50641d[_0xe4b6('0x13')]){if(_0x50641d['error'][_0xe4b6('0x14')]===0x1f4){logger[_0xe4b6('0x13')](_0xe4b6('0x10'),_0x11b109,_0x50641d[_0xe4b6('0x13')][_0xe4b6('0x15')]);return _0x4798f1(_0x50641d[_0xe4b6('0x13')][_0xe4b6('0x15')]);}logger[_0xe4b6('0x13')](_0xe4b6('0x10'),_0x11b109,_0x50641d[_0xe4b6('0x13')][_0xe4b6('0x15')]);return _0x2ab13d(_0x50641d[_0xe4b6('0x13')][_0xe4b6('0x15')]);}else{logger[_0xe4b6('0xf')](_0xe4b6('0x10'),_0x11b109,_0xe4b6('0x11'));_0x2ab13d(_0x50641d[_0xe4b6('0x16')][_0xe4b6('0x15')]);}})[_0xe4b6('0x17')](function(_0x592bb6){logger[_0xe4b6('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x11b109,_0x592bb6);_0x4798f1(_0x592bb6);});});} \ No newline at end of file +var _0xb53f=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','code','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then'];(function(_0x551229,_0x5c98c5){var _0x41a38c=function(_0xa593e4){while(--_0xa593e4){_0x551229['push'](_0x551229['shift']());}};_0x41a38c(++_0x5c98c5);}(_0xb53f,0x195));var _0xfb53=function(_0x58bfa6,_0x3dfc0b){_0x58bfa6=_0x58bfa6-0x0;var _0x2a215b=_0xb53f[_0x58bfa6];return _0x2a215b;};'use strict';var _=require(_0xfb53('0x0'));var util=require(_0xfb53('0x1'));var moment=require(_0xfb53('0x2'));var BPromise=require(_0xfb53('0x3'));var rs=require(_0xfb53('0x4'));var fs=require('fs');var Redis=require(_0xfb53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb53('0x6'));var logger=require(_0xfb53('0x7'))('rpc');var config=require(_0xfb53('0x8'));var jayson=require(_0xfb53('0x9'));var client=jayson['client'][_0xfb53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48dddc,_0x3f3252,_0x7f71e4){return new BPromise(function(_0x1a1cc6,_0x5a0a73){return client[_0xfb53('0xb')](_0x48dddc,_0x7f71e4)[_0xfb53('0xc')](function(_0x13e46a){logger['info'](_0xfb53('0xd'),_0x3f3252,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x3f3252,_0xfb53('0xe'),JSON['stringify'](_0x13e46a));if(_0x13e46a['error']){if(_0x13e46a['error'][_0xfb53('0xf')]===0x1f4){logger[_0xfb53('0x10')](_0xfb53('0xd'),_0x3f3252,_0x13e46a[_0xfb53('0x10')][_0xfb53('0x11')]);return _0x5a0a73(_0x13e46a[_0xfb53('0x10')][_0xfb53('0x11')]);}logger[_0xfb53('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x3f3252,_0x13e46a[_0xfb53('0x10')]['message']);return _0x1a1cc6(_0x13e46a[_0xfb53('0x10')][_0xfb53('0x11')]);}else{logger[_0xfb53('0x12')](_0xfb53('0xd'),_0x3f3252,_0xfb53('0xe'));_0x1a1cc6(_0x13e46a['result'][_0xfb53('0x11')]);}})['catch'](function(_0x321828){logger[_0xfb53('0x10')](_0xfb53('0xd'),_0x3f3252,_0x321828);_0x5a0a73(_0x321828);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 91d8afd..baf83e9 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 _0x8098=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x503205,_0x2bd7df){var _0x4e328e=function(_0x2794a5){while(--_0x2794a5){_0x503205['push'](_0x503205['shift']());}};_0x4e328e(++_0x2bd7df);}(_0x8098,0x1a4));var _0x8809=function(_0x5ab878,_0x1ad99f){_0x5ab878=_0x5ab878-0x0;var _0x1c01af=_0x8098[_0x5ab878];return _0x1c01af;};'use strict';var multer=require(_0x8809('0x0'));var util=require(_0x8809('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8809('0x2'));var router=express['Router']();var fs_extra=require(_0x8809('0x3'));var auth=require(_0x8809('0x4'));var interaction=require(_0x8809('0x5'));var config=require(_0x8809('0x6'));var controller=require(_0x8809('0x7'));router[_0x8809('0x8')]('/',auth[_0x8809('0x9')](),controller[_0x8809('0xa')]);router['get'](_0x8809('0xb'),auth['isAuthenticated'](),controller[_0x8809('0xc')]);router[_0x8809('0x8')](_0x8809('0xd'),auth[_0x8809('0x9')](),controller[_0x8809('0xe')]);router[_0x8809('0xf')]('/',auth[_0x8809('0x9')](),controller['create']);router[_0x8809('0x10')](_0x8809('0xd'),auth[_0x8809('0x9')](),controller['update']);router['delete'](_0x8809('0xd'),auth[_0x8809('0x9')](),controller[_0x8809('0x11')]);module[_0x8809('0x12')]=router; \ No newline at end of file +var _0x433d=['create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','/describe','isAuthenticated','get','/:id','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x433d,0x140));var _0xd433=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x433d[_0xf91841];return _0x4b9c44;};'use strict';var multer=require(_0xd433('0x0'));var util=require(_0xd433('0x1'));var path=require('path');var timeout=require(_0xd433('0x2'));var express=require(_0xd433('0x3'));var router=express[_0xd433('0x4')]();var fs_extra=require(_0xd433('0x5'));var auth=require(_0xd433('0x6'));var interaction=require(_0xd433('0x7'));var config=require(_0xd433('0x8'));var controller=require(_0xd433('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd433('0xa')]);router['get'](_0xd433('0xb'),auth[_0xd433('0xc')](),controller['describe']);router[_0xd433('0xd')](_0xd433('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xd433('0xf')]('/',auth[_0xd433('0xc')](),controller[_0xd433('0x10')]);router['put']('/:id',auth[_0xd433('0xc')](),controller[_0xd433('0x11')]);router[_0xd433('0x12')](_0xd433('0xe'),auth['isAuthenticated'](),controller[_0xd433('0x13')]);module[_0xd433('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 43a5555..9fc7be2 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 _0x9682=['System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','text','name','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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','alternate','#fafafa'];(function(_0x15262e,_0x30da53){var _0xdd1576=function(_0x508c5f){while(--_0x508c5f){_0x15262e['push'](_0x15262e['shift']());}};_0xdd1576(++_0x30da53);}(_0x9682,0xa6));var _0x2968=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9682[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x2968('0x0'));var rs=require('randomstring');module[_0x2968('0x1')]={'name':{'type':Sequelize[_0x2968('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2968('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x2968('0x4')},'key':{'type':Sequelize[_0x2968('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2968('0x5')},'customerAlias':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2968('0x2')],'allowNull':![],'defaultValue':_0x2968('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2968('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2968('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x2968('0x2')],'allowNull':![],'defaultValue':_0x2968('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2968('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x2968('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2968('0xa')](_0x2968('0xb'),_0x2968('0xc')),'defaultValue':_0x2968('0xb')},'header_online':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0xd')},'start_chat_button':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2968('0xf')},'header_offline':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x2968('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x2968('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2968('0x10')]},'closingQuestion':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x12')},'noteTitle':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x13')},'closingMessageButton':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0xf')},'skipMessageButton':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x14')},'conditionAgreement':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x15')},'ratingType':{'type':Sequelize[_0x2968('0xa')]('star',_0x2968('0x16')),'defaultValue':_0x2968('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x2968('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2968('0x10')],'defaultValue':function(){return JSON[_0x2968('0x18')]({'items':[{'type':_0x2968('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x2968('0x1a'),'required':!![]},'props':{'title':_0x2968('0x1b'),'helpText':''}},{'type':_0x2968('0x19'),'props':{'title':_0x2968('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue'](_0x2968('0x1c'))):{};},'set':function(_0x56485e){return this[_0x2968('0x1d')]('onlineForm',JSON[_0x2968('0x18')](_0x56485e));}},'offlineForm':{'type':Sequelize[_0x2968('0x10')],'defaultValue':function(){return JSON[_0x2968('0x18')]({'items':[{'type':_0x2968('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2968('0x4')},'variable':null},{'type':_0x2968('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0x2968('0x1f'),'helpText':_0x2968('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x2968('0x21')](_0x2968('0x22'))?JSON[_0x2968('0x23')](this[_0x2968('0x21')](_0x2968('0x22'))):{};},'set':function(_0x58d138){return this[_0x2968('0x1d')]('offlineForm',JSON[_0x2968('0x18')](_0x58d138));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2968('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2968('0x2')]},'forwardOffline':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2968('0x2')]},'waitingTitle':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2968('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x28')},'skipUnmanaged':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x14')},'sendUnmanaged':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2968('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2968('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2968('0x10')],'defaultValue':function(){return _0x2968('0x29');}},'notificationSound':{'type':Sequelize[_0x2968('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2968('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2968('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x2968('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x2968('0x2')],'defaultValue':_0x2968('0x2c')},'defaultTitle':{'type':Sequelize[_0x2968('0x2')]},'customerAvatar':{'type':Sequelize[_0x2968('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2968('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2968('0x2')],'allowNull':![],'defaultValue':_0x2968('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2968('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2968('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2968('0x2e')},'systemAvatar':{'type':Sequelize[_0x2968('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2968('0x8')],'comment':_0x2968('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2968('0x30'),'set':function(_0xf5d5d9){if(!_0xf5d5d9)this[_0x2968('0x1d')](_0x2968('0x31'),null);this[_0x2968('0x1d')](_0x2968('0x32'),_0xf5d5d9);}},'vidaooEscalation':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2968('0x2')]},'vidaooTopic':{'type':Sequelize[_0x2968('0x2')],'allowNull':![],'defaultValue':_0x2968('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x2968('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x2968('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x2968('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x2968('0x10')]}}; \ No newline at end of file +var _0xf1d6=['Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','TEXT','stringify','name','text','input','email','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','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','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','rounded','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message'];(function(_0x5ae088,_0x3753c9){var _0x6c837d=function(_0x3ce749){while(--_0x3ce749){_0x5ae088['push'](_0x5ae088['shift']());}};_0x6c837d(++_0x3753c9);}(_0xf1d6,0x1cc));var _0x6f1d=function(_0x54c916,_0x1fb338){_0x54c916=_0x54c916-0x0;var _0x332fc5=_0xf1d6[_0x54c916];return _0x332fc5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6f1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6f1d('0x2')},'description':{'type':Sequelize[_0x6f1d('0x1')]},'mapKey':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6f1d('0x3')},'customerAlias':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6f1d('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![],'defaultValue':_0x6f1d('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6f1d('0x1')]},'animation':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6f1d('0x7'),'squared'),'defaultValue':_0x6f1d('0x7')},'header_online':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x8')},'offline_chat_button':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x9')},'header_offline':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0xa')},'download_transcript':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6f1d('0xb')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0xd')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0xf')},'noteTitle':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x10')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6f1d('0x11')},'closingMessageButton':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6f1d('0x13')},'ratingType':{'type':Sequelize[_0x6f1d('0x14')](_0x6f1d('0x15'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6f1d('0x16')],'defaultValue':function(){return JSON[_0x6f1d('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6f1d('0x18'),'type':_0x6f1d('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6f1d('0x1a'),'props':{'title':_0x6f1d('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':_0x6f1d('0x1b'),'type':_0x6f1d('0x1b')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6f1d('0x1c')]('onlineForm')?JSON[_0x6f1d('0x1d')](this['getDataValue'](_0x6f1d('0x1e'))):{};},'set':function(_0x230421){return this[_0x6f1d('0x1f')](_0x6f1d('0x1e'),JSON[_0x6f1d('0x17')](_0x230421));}},'offlineForm':{'type':Sequelize[_0x6f1d('0x16')],'defaultValue':function(){return JSON[_0x6f1d('0x17')]({'items':[{'type':_0x6f1d('0x1a'),'props':{'title':_0x6f1d('0x1b'),'helpText':''},'config':{'required':!![],'placeholder':_0x6f1d('0x1b'),'type':_0x6f1d('0x1b')},'variable':null},{'type':_0x6f1d('0x20'),'config':{'placeholder':_0x6f1d('0x21')},'props':{'title':_0x6f1d('0x21'),'helpText':_0x6f1d('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x6f1d('0x1c')](_0x6f1d('0x23'))?JSON[_0x6f1d('0x1d')](this['getDataValue']('offlineForm')):{};},'set':function(_0x5a8b42){return this[_0x6f1d('0x1f')](_0x6f1d('0x23'),JSON[_0x6f1d('0x17')](_0x5a8b42));}},'token':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':function(){return rs[_0x6f1d('0x24')]();}},'autoclose':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6f1d('0x1')]},'forwardOffline':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6f1d('0x1')]},'waitingTitle':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6f1d('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x29')},'skipUnmanaged':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6f1d('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6f1d('0x16')],'defaultValue':function(){return _0x6f1d('0x2a');}},'notificationSound':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6f1d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6f1d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x2c')},'verticalAlignment':{'type':Sequelize[_0x6f1d('0xb')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x2d')},'messagesAlignment':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':_0x6f1d('0x2e')},'defaultTitle':{'type':Sequelize[_0x6f1d('0x1')]},'customerAvatar':{'type':Sequelize[_0x6f1d('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6f1d('0xb')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6f1d('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6f1d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6f1d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6f1d('0x30')},'systemAvatar':{'type':Sequelize[_0x6f1d('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f1d('0xb')],'comment':_0x6f1d('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x591a98){if(!_0x591a98)this[_0x6f1d('0x1f')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x6f1d('0x32'),_0x591a98);}},'vidaooEscalation':{'type':Sequelize[_0x6f1d('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6f1d('0x1')]},'vidaooTopic':{'type':Sequelize[_0x6f1d('0x1')],'allowNull':![],'defaultValue':_0x6f1d('0x33')},'vidaooNote':{'type':Sequelize[_0x6f1d('0x1')],'defaultValue':function(){return _0x6f1d('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6f1d('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e0f4696..6c76916 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 _0x946f=['account','applications','orderBy','asc','defaults','contact','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','originalname','mimetype','server','attachments','sequelize','transaction','Attachment','bulkCreate','findOne','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','offline-chat','remove','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getLicense','increment','chatLicenseExceeded','utf8','URL','address','3.5.0','remote','headers','x-real-ip','connection','remoteAddress','virtual','alignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','stack','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','querystring','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../errors/api','APINotFoundError','handleError','redis','localhost','socket.io-emitter','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','name','send','getSnippet','timezone','format','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','OFFLINE','inspect','Interval','Intervals','all','some','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','lastName','browser','%s\x20%s','version','unknown','device','model','vendor','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','rows','show','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','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','DESC','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread'];(function(_0x51ad6d,_0x1096a5){var _0x1d28f1=function(_0x529b8e){while(--_0x529b8e){_0x51ad6d['push'](_0x51ad6d['shift']());}};_0x1d28f1(++_0x1096a5);}(_0x946f,0x7c));var _0xf946=function(_0x27e90c,_0x5d91b3){_0x27e90c=_0x27e90c-0x0;var _0x2510bd=_0x946f[_0x27e90c];return _0x2510bd;};'use strict';var Mustache=require(_0xf946('0x0'));var util=require(_0xf946('0x1'));var path=require(_0xf946('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require(_0xf946('0x3'));var htmlToText=require(_0xf946('0x4'));var Redis=require(_0xf946('0x5'));var jayson=require(_0xf946('0x6'));var url=require(_0xf946('0x7'));var qs=require(_0xf946('0x8'));var logger=require(_0xf946('0x9'))('api');var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xf946('0xa'))['APIOutOfIntervalError'];var APINotFoundError=require(_0xf946('0xa'))[_0xf946('0xb')];var APIHandleError=require(_0xf946('0xa'))[_0xf946('0xc')];var db=require('../../mysqldb')['db'];config[_0xf946('0xd')]=_['defaults'](config[_0xf946('0xd')],{'host':_0xf946('0xe'),'port':0x18eb});var socket=require(_0xf946('0xf'))(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0xf946('0x10')][_0xf946('0x11')]({'port':0x232c});var client9002=jayson[_0xf946('0x10')]['http']({'port':0x232a});var client9003=jayson[_0xf946('0x10')][_0xf946('0x11')]({'port':0x232b});var client9001=jayson[_0xf946('0x10')][_0xf946('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x186ff4,_0x380275,_0x5d2f97,_0x1f369d){return new Promise(function(_0x1a67ff,_0x576ff9){var _0x542bc8=_0x1f369d||client;return _0x542bc8['request'](_0x186ff4,_0x5d2f97)[_0xf946('0x12')](function(_0x5d9c4b){logger['info'](_0xf946('0x13'),_0x380275,_0xf946('0x14'));logger[_0xf946('0x15')](_0xf946('0x16'),_0x380275,_0xf946('0x14'),JSON[_0xf946('0x17')](_0x5d9c4b));if(_0x5d9c4b[_0xf946('0x18')]){if(_0x5d9c4b[_0xf946('0x18')][_0xf946('0x19')]===0x1f4){logger[_0xf946('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x380275,_0x5d9c4b['error'][_0xf946('0x1a')]);return _0x576ff9(_0x5d9c4b[_0xf946('0x18')][_0xf946('0x1a')]);}logger[_0xf946('0x18')](_0xf946('0x13'),_0x380275,_0x5d9c4b['error']['message']);return _0x1a67ff(_0x5d9c4b['error'][_0xf946('0x1a')]);}else{logger[_0xf946('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x380275,'request\x20sent');_0x1a67ff(_0x5d9c4b[_0xf946('0x1c')]['message']);}})[_0xf946('0x1d')](function(_0x475101){logger['error'](_0xf946('0x13'),_0x380275,_0x475101);_0x576ff9(_0x475101);});});}function respondWithStatusCode(_0x1352f3,_0x2519e8){_0x2519e8=_0x2519e8||0xcc;return function(_0x16afa1){if(_0x16afa1){return _0x1352f3[_0xf946('0x1e')](_0x2519e8);}return _0x1352f3[_0xf946('0x1f')](_0x2519e8)['end']();};}function respondWithResult(_0x4539e8,_0x282dbd){_0x282dbd=_0x282dbd||0xc8;return function(_0x3b53d9){if(_0x3b53d9){return _0x4539e8['status'](_0x282dbd)[_0xf946('0x20')](_0x3b53d9);}};}function respondWithFilteredResult(_0x16f203,_0x6dbe9c){return function(_0x46e377){if(_0x46e377){var _0x7a39f2=typeof _0x6dbe9c['offset']===_0xf946('0x21')&&typeof _0x6dbe9c[_0xf946('0x22')]===_0xf946('0x21');var _0x21ed78=_0x46e377['count'];var _0x22cc3b=_0x7a39f2?0x0:_0x6dbe9c['offset'];var _0x5bfce3=_0x7a39f2?_0x46e377[_0xf946('0x23')]:_0x6dbe9c[_0xf946('0x24')]+_0x6dbe9c['limit'];var _0x48af09;if(_0x5bfce3>=_0x21ed78){_0x5bfce3=_0x21ed78;_0x48af09=0xc8;}else{_0x48af09=0xce;}_0x16f203['status'](_0x48af09);return _0x16f203[_0xf946('0x25')](_0xf946('0x26'),_0x22cc3b+'-'+_0x5bfce3+'/'+_0x21ed78)[_0xf946('0x20')](_0x46e377);}return null;};}function saveUpdates(_0x281c55){return function(_0x27bfbf){if(_0x27bfbf){return _0x27bfbf[_0xf946('0x27')](_0x281c55)[_0xf946('0x12')](function(_0xd15426){return _0xd15426;});}return null;};}function removeEntity(_0x3b0428){return function(_0x4baff7){if(_0x4baff7){return _0x4baff7[_0xf946('0x28')]()['then'](function(){var _0x416459=_0x4baff7[_0xf946('0x29')]({'plain':!![]});var _0xa7feba=_0xf946('0x2a');return db[_0xf946('0x2b')][_0xf946('0x28')]({'where':{'type':_0xa7feba,'resourceId':_0x416459['id']}})[_0xf946('0x12')](function(){return _0x4baff7;});})['then'](function(){_0x3b0428[_0xf946('0x1f')](0xcc)[_0xf946('0x2c')]();});}};}function handleEntityNotFound(_0x1b987e){return function(_0x5e2c1a){if(!_0x5e2c1a){_0x1b987e['sendStatus'](0x194);}return _0x5e2c1a;};}function handleError(_0x196789,_0x229b15){_0x229b15=_0x229b15||0x1f4;return function(_0x3904ee){logger[_0xf946('0x18')](_0x3904ee['stack']);if(_0x3904ee[_0xf946('0x2d')]){delete _0x3904ee[_0xf946('0x2d')];}_0x196789[_0xf946('0x1f')](_0x229b15)[_0xf946('0x2e')](_0x3904ee);};}function iftimePromise(_0x26965b,_0x30b790){return respondWithRpcPromise('Command',_0xf946('0x2f'),{'command':_0x30b790[_0xf946('0x30')]?util[_0xf946('0x31')](_0xf946('0x32'),_0x26965b['interval'],_0x30b790['timezone']):util[_0xf946('0x31')](_0xf946('0x33'),_0x26965b[_0xf946('0x34')])},client9002)[_0xf946('0x12')](function(_0x344da8){var _0x31cc94=_0x344da8&&_0x344da8[_0xf946('0x35')](_0xf946('0x36'))>=0x0?!![]:![];logger[_0xf946('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30b790['id'],_0x26965b['id'],_0x26965b['interval'],_0x31cc94?'ONLINE':_0xf946('0x37'),_0x30b790[_0xf946('0x30')]?_0x30b790[_0xf946('0x30')]:'No\x20timezone');return _0x31cc94;})[_0xf946('0x1d')](function(_0x544db5){logger[_0xf946('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x30b790['id'],_0x26965b['id'],_0x26965b['interval'],util[_0xf946('0x38')](_0x544db5,{'showHidden':![],'depth':null}),_0x30b790[_0xf946('0x30')]?_0x30b790[_0xf946('0x30')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0xd27031){var _0x556eca=_['map'](_0xd27031[_0xf946('0x39')][_0xf946('0x3a')],function(_0x277d39){var _0x55261e=_0x277d39[_0xf946('0x29')]({'plain':!![]});return iftimePromise(_0x55261e,_0xd27031);});return Promise[_0xf946('0x3b')](_0x556eca)[_0xf946('0x12')](function(_0x288087){return _[_0xf946('0x3c')](_0x288087);});}function createInteractionObject(_0x5052fd,_0x2a40bc,_0x170889,_0x41a3ae){var _0x3a7280=require(_0xf946('0x3d'));var _0xdbbb9e=new _0x3a7280();var _0x2712bc=_0xdbbb9e[_0xf946('0x3e')](_0x170889[_0xf946('0x3f')])[_0xf946('0x40')]();var _0x33e65c=_0x2a40bc['customerIp'];if(_0x170889[_0xf946('0x41')]){_0x33e65c=_0x170889['cf-connecting-ip'];}else if(_0x170889[_0xf946('0x42')]){_0x33e65c=_[_0xf946('0x43')](_0x170889[_0xf946('0x42')][_0xf946('0x44')](','));}return{'ContactId':_0x41a3ae['id'],'ChatWebsiteId':_0x5052fd,'from':(_0x41a3ae['firstName']||'')+'\x20'+(_0x41a3ae[_0xf946('0x45')]||''),'customerIp':_0x33e65c,'customerPort':_0x170889['x-real-port']?_0x170889['x-real-port']:null,'referer':_0x2a40bc['referer'],'browserName':_0x2712bc[_0xf946('0x46')]['name']&&_0x2712bc['browser']['version']?util[_0xf946('0x31')](_0xf946('0x47'),_0x2712bc[_0xf946('0x46')]['name'],_0x2712bc[_0xf946('0x46')][_0xf946('0x48')]):_0xf946('0x49'),'browserVersion':_0x2712bc[_0xf946('0x46')][_0xf946('0x48')]||'unknown','osName':util[_0xf946('0x31')](_0xf946('0x47'),_0x2712bc['os']['name'],_0x2712bc['os'][_0xf946('0x48')]),'osVersion':_0x2712bc['os'][_0xf946('0x48')],'deviceModel':_0x2712bc[_0xf946('0x4a')][_0xf946('0x4b')]&&_0x2712bc['device']['vendor']?util[_0xf946('0x31')]('%s\x20%s\x20%s',_0x2712bc[_0xf946('0x4a')]['model'],_0x2712bc[_0xf946('0x4a')][_0xf946('0x4c')],_0x2712bc['device']['type']):null,'deviceVendor':_0x2712bc[_0xf946('0x4a')]['vendor'],'deviceType':_0x2712bc[_0xf946('0x4a')]['type'],'formData':JSON[_0xf946('0x17')](_0x2a40bc)};}exports['index']=function(_0x3fdf38,_0x562d79){var _0x4b9cc5={'include':[{'model':db[_0xf946('0x4d')],'as':_0xf946('0x4e')}]},_0x32e812={},_0x4ba7ca={'count':0x0,'rows':[]};var _0x576f2b=_[_0xf946('0x4f')](db[_0xf946('0x50')][_0xf946('0x51')],function(_0x20ca96){return{'name':_0x20ca96[_0xf946('0x52')],'type':_0x20ca96['type'][_0xf946('0x53')]};});_0x32e812[_0xf946('0x4b')]=_['map'](_0x576f2b,_0xf946('0x2d'));_0x32e812['query']=_[_0xf946('0x54')](_0x3fdf38['query']);_0x32e812[_0xf946('0x55')]=_[_0xf946('0x56')](_0x32e812['model'],_0x32e812[_0xf946('0x57')]);_0x4b9cc5[_0xf946('0x58')]=_[_0xf946('0x56')](_0x32e812[_0xf946('0x4b')],qs['fields'](_0x3fdf38[_0xf946('0x57')][_0xf946('0x59')]));_0x4b9cc5[_0xf946('0x58')]=_0x4b9cc5[_0xf946('0x58')][_0xf946('0x5a')]?_0x4b9cc5[_0xf946('0x58')]:_0x32e812[_0xf946('0x4b')];if(!_0x3fdf38[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x4b9cc5[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x3fdf38[_0xf946('0x57')][_0xf946('0x22')]);_0x4b9cc5['offset']=qs['offset'](_0x3fdf38['query'][_0xf946('0x24')]);}_0x4b9cc5[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x3fdf38[_0xf946('0x57')]['sort']);_0x4b9cc5[_0xf946('0x5f')]=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x3fdf38[_0xf946('0x57')],_0x32e812['filters']),_0x576f2b);if(_0x3fdf38['query'][_0xf946('0x61')]){_0x4b9cc5[_0xf946('0x5f')]=_['merge'](_0x4b9cc5['where'],{'$or':_['map'](_0x576f2b,function(_0x546c95){if(_0x546c95[_0xf946('0x62')]!==_0xf946('0x63')){var _0x302acd={};_0x302acd[_0x546c95[_0xf946('0x2d')]]={'$like':'%'+_0x3fdf38[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0x302acd;}})});}_0x4b9cc5=_['merge']({},_0x4b9cc5,_0x3fdf38['options']);var _0x388a58={'where':_0x4b9cc5[_0xf946('0x5f')]};return db['ChatWebsite'][_0xf946('0x23')](_0x388a58)[_0xf946('0x12')](function(_0x571189){_0x4ba7ca[_0xf946('0x23')]=_0x571189;if(_0x3fdf38['query'][_0xf946('0x64')]){_0x4b9cc5[_0xf946('0x65')]=[{'all':!![]}];}return db[_0xf946('0x50')]['findAll'](_0x4b9cc5);})[_0xf946('0x12')](function(_0x16492e){_0x4ba7ca[_0xf946('0x66')]=_0x16492e;return _0x4ba7ca;})[_0xf946('0x12')](respondWithFilteredResult(_0x562d79,_0x4b9cc5))[_0xf946('0x1d')](handleError(_0x562d79,null));};exports[_0xf946('0x67')]=function(_0x362a2e,_0x307f5c){var _0x23d760={'raw':![],'where':{'id':_0x362a2e['params']['id']},'include':[{'model':db[_0xf946('0x4d')],'as':_0xf946('0x4e')}]},_0x3f72cc={};_0x3f72cc[_0xf946('0x4b')]=_[_0xf946('0x54')](db[_0xf946('0x50')][_0xf946('0x51')]);_0x3f72cc[_0xf946('0x57')]=_[_0xf946('0x54')](_0x362a2e[_0xf946('0x57')]);_0x3f72cc[_0xf946('0x55')]=_[_0xf946('0x56')](_0x3f72cc[_0xf946('0x4b')],_0x3f72cc[_0xf946('0x57')]);_0x23d760[_0xf946('0x58')]=_['intersection'](_0x3f72cc[_0xf946('0x4b')],qs[_0xf946('0x59')](_0x362a2e[_0xf946('0x57')][_0xf946('0x59')]));_0x23d760['attributes']=_0x23d760[_0xf946('0x58')][_0xf946('0x5a')]?_0x23d760[_0xf946('0x58')]:_0x3f72cc[_0xf946('0x4b')];if(_0x362a2e[_0xf946('0x57')][_0xf946('0x64')]){_0x23d760[_0xf946('0x65')]=[{'all':!![]}];}_0x23d760=_[_0xf946('0x68')]({},_0x23d760,_0x362a2e[_0xf946('0x69')]);return db[_0xf946('0x50')][_0xf946('0x6a')](_0x23d760)['then'](handleEntityNotFound(_0x307f5c,null))[_0xf946('0x12')](respondWithResult(_0x307f5c,null))[_0xf946('0x1d')](handleError(_0x307f5c,null));};exports['create']=function(_0x2a6cf3,_0x40514f){return db[_0xf946('0x50')][_0xf946('0x6b')](_0x2a6cf3[_0xf946('0x6c')],{})[_0xf946('0x12')](function(_0x902d6b){var _0xcee220=_0x2a6cf3[_0xf946('0x6d')][_0xf946('0x29')]({'plain':!![]});if(!_0xcee220)throw new Error(_0xf946('0x6e'));if(_0xcee220[_0xf946('0x6f')]===_0xf946('0x6d')){var _0x312704=_0x902d6b[_0xf946('0x29')]({'plain':!![]});var _0x573534=_0xf946('0x2a');return db['UserProfileSection'][_0xf946('0x6a')]({'where':{'name':_0x573534,'userProfileId':_0xcee220[_0xf946('0x70')]},'raw':!![]})['then'](function(_0x33c9d3){if(_0x33c9d3&&_0x33c9d3[_0xf946('0x71')]===0x0){return db[_0xf946('0x2b')][_0xf946('0x6b')]({'name':_0x312704[_0xf946('0x2d')],'resourceId':_0x312704['id'],'type':_0x33c9d3[_0xf946('0x2d')],'sectionId':_0x33c9d3['id']},{})['then'](function(){return _0x902d6b;});}else{return _0x902d6b;}})['catch'](function(_0x58e3){logger[_0xf946('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58e3);throw _0x58e3;});}return _0x902d6b;})[_0xf946('0x12')](respondWithResult(_0x40514f,0xc9))['catch'](handleError(_0x40514f,null));};exports[_0xf946('0x27')]=function(_0x49ecea,_0x15e182){if(_0x49ecea[_0xf946('0x6c')]['id']){delete _0x49ecea[_0xf946('0x6c')]['id'];}return db[_0xf946('0x50')]['find']({'where':{'id':_0x49ecea[_0xf946('0x72')]['id']},'include':[{'model':db[_0xf946('0x4d')],'as':'mandatoryDispositionPause'}]})[_0xf946('0x12')](handleEntityNotFound(_0x15e182,null))[_0xf946('0x12')](saveUpdates(_0x49ecea['body'],null))[_0xf946('0x12')](respondWithResult(_0x15e182,null))['catch'](handleError(_0x15e182,null));};exports['destroy']=function(_0x37abc0,_0x5b35e9){return db['ChatWebsite'][_0xf946('0x6a')]({'where':{'id':_0x37abc0[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x5b35e9,null))[_0xf946('0x12')](removeEntity(_0x5b35e9,null))[_0xf946('0x1d')](handleError(_0x5b35e9,null));};exports['describe']=function(_0x3d7147,_0x257e78){return db[_0xf946('0x50')]['describe']()[_0xf946('0x12')](respondWithResult(_0x257e78,null))['catch'](handleError(_0x257e78,null));};exports[_0xf946('0x73')]=function(_0x7ec009,_0x1865fc){if(_0x7ec009['body']['id']){delete _0x7ec009['body']['id'];}return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x7ec009['params']['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x1865fc,null))[_0xf946('0x12')](function(_0x1bf24a){if(_0x1bf24a){_0x7ec009[_0xf946('0x6c')][_0xf946('0x74')]=_0x1bf24a['id'];return db[_0xf946('0x75')][_0xf946('0x6b')](_0x7ec009[_0xf946('0x6c')]);}})[_0xf946('0x12')](respondWithResult(_0x1865fc,null))[_0xf946('0x1d')](handleError(_0x1865fc,null));};exports[_0xf946('0x76')]=function(_0x35b007,_0x13f886){var _0x54315a={'raw':![],'where':{}};var _0x33d7b9={};var _0x3b44a9={'count':0x0,'rows':[]};return db[_0xf946('0x50')]['findOne']({'where':{'id':_0x35b007[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x13f886,null))[_0xf946('0x12')](function(_0x5e9354){if(_0x5e9354){_0x33d7b9[_0xf946('0x4b')]=_[_0xf946('0x54')](db[_0xf946('0x75')][_0xf946('0x51')]);_0x33d7b9['query']=_[_0xf946('0x54')](_0x35b007['query']);_0x33d7b9[_0xf946('0x55')]=_[_0xf946('0x56')](_0x33d7b9['model'],_0x33d7b9[_0xf946('0x57')]);_0x54315a['attributes']=_[_0xf946('0x56')](_0x33d7b9[_0xf946('0x4b')],qs['fields'](_0x35b007[_0xf946('0x57')][_0xf946('0x59')]));_0x54315a[_0xf946('0x58')]=_0x54315a[_0xf946('0x58')][_0xf946('0x5a')]?_0x54315a[_0xf946('0x58')]:_0x33d7b9[_0xf946('0x4b')];if(!_0x35b007[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x54315a['limit']=qs[_0xf946('0x22')](_0x35b007[_0xf946('0x57')][_0xf946('0x22')]);_0x54315a[_0xf946('0x24')]=qs['offset'](_0x35b007[_0xf946('0x57')][_0xf946('0x24')]);}_0x54315a[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x35b007[_0xf946('0x57')][_0xf946('0x5e')]);_0x54315a['where']=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x35b007[_0xf946('0x57')],_0x33d7b9[_0xf946('0x55')]));_0x54315a['where']['ChatWebsiteId']=_0x5e9354['id'];if(_0x35b007['query'][_0xf946('0x61')]){_0x54315a['where']=_[_0xf946('0x68')](_0x54315a[_0xf946('0x5f')],{'$or':_['map'](_0x54315a['attributes'],function(_0x88a8f){var _0x50a3f4={};_0x50a3f4[_0x88a8f]={'$like':'%'+_0x35b007[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0x50a3f4;})});}_0x54315a=_[_0xf946('0x68')]({},_0x54315a,_0x35b007[_0xf946('0x69')]);return db['Disposition'][_0xf946('0x23')]({'where':_0x54315a[_0xf946('0x5f')]})[_0xf946('0x12')](function(_0x4a8502){_0x3b44a9[_0xf946('0x23')]=_0x4a8502;if(_0x35b007[_0xf946('0x57')][_0xf946('0x64')]){_0x54315a[_0xf946('0x65')]=[{'all':!![]}];}return db[_0xf946('0x75')]['findAll'](_0x54315a);})[_0xf946('0x12')](function(_0x731301){_0x3b44a9[_0xf946('0x66')]=_0x731301;return _0x3b44a9;});}})[_0xf946('0x12')](respondWithFilteredResult(_0x13f886,_0x54315a))[_0xf946('0x1d')](handleError(_0x13f886,null));};exports[_0xf946('0x77')]=function(_0x396f08,_0x58df0c){return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x396f08['params']['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x58df0c,null))[_0xf946('0x12')](function(_0x1cd5e5){if(_0x1cd5e5){return _0x1cd5e5['removeDispositions'](_0x396f08[_0xf946('0x57')][_0xf946('0x78')]);}})[_0xf946('0x12')](respondWithStatusCode(_0x58df0c,null))[_0xf946('0x1d')](handleError(_0x58df0c,null));};exports[_0xf946('0x79')]=function(_0xf8c437,_0x5840c2){if(_0xf8c437[_0xf946('0x6c')]['id']){delete _0xf8c437[_0xf946('0x6c')]['id'];}return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0xf8c437[_0xf946('0x72')]['id']}})['then'](handleEntityNotFound(_0x5840c2,null))['then'](function(_0x1c37dc){if(_0x1c37dc){_0xf8c437[_0xf946('0x6c')][_0xf946('0x74')]=_0x1c37dc['id'];return db[_0xf946('0x7a')][_0xf946('0x6b')](_0xf8c437[_0xf946('0x6c')]);}})['then'](respondWithResult(_0x5840c2,null))[_0xf946('0x1d')](handleError(_0x5840c2,null));};exports[_0xf946('0x7b')]=function(_0x42b6ed,_0x21f998){var _0x34a9a4={'raw':![],'where':{}};var _0x2c58f3={};var _0x7fdcd7={'count':0x0,'rows':[]};return db[_0xf946('0x50')]['findOne']({'where':{'id':_0x42b6ed[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x21f998,null))[_0xf946('0x12')](function(_0x3043f0){if(_0x3043f0){_0x2c58f3[_0xf946('0x4b')]=_['keys'](db[_0xf946('0x7a')][_0xf946('0x51')]);_0x2c58f3[_0xf946('0x57')]=_[_0xf946('0x54')](_0x42b6ed[_0xf946('0x57')]);_0x2c58f3[_0xf946('0x55')]=_[_0xf946('0x56')](_0x2c58f3[_0xf946('0x4b')],_0x2c58f3['query']);_0x34a9a4[_0xf946('0x58')]=_[_0xf946('0x56')](_0x2c58f3[_0xf946('0x4b')],qs[_0xf946('0x59')](_0x42b6ed[_0xf946('0x57')][_0xf946('0x59')]));_0x34a9a4[_0xf946('0x58')]=_0x34a9a4[_0xf946('0x58')]['length']?_0x34a9a4[_0xf946('0x58')]:_0x2c58f3[_0xf946('0x4b')];if(!_0x42b6ed[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x34a9a4[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x42b6ed[_0xf946('0x57')][_0xf946('0x22')]);_0x34a9a4[_0xf946('0x24')]=qs[_0xf946('0x24')](_0x42b6ed[_0xf946('0x57')][_0xf946('0x24')]);}_0x34a9a4[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x42b6ed['query']['sort']);_0x34a9a4[_0xf946('0x5f')]=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x42b6ed[_0xf946('0x57')],_0x2c58f3[_0xf946('0x55')]));_0x34a9a4[_0xf946('0x5f')][_0xf946('0x74')]=_0x3043f0['id'];if(_0x42b6ed['query'][_0xf946('0x61')]){_0x34a9a4[_0xf946('0x5f')]=_[_0xf946('0x68')](_0x34a9a4[_0xf946('0x5f')],{'$or':_[_0xf946('0x4f')](_0x34a9a4[_0xf946('0x58')],function(_0x55bdf3){var _0x559f6e={};_0x559f6e[_0x55bdf3]={'$like':'%'+_0x42b6ed[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0x559f6e;})});}_0x34a9a4=_[_0xf946('0x68')]({},_0x34a9a4,_0x42b6ed[_0xf946('0x69')]);return db[_0xf946('0x7a')][_0xf946('0x23')]({'where':_0x34a9a4['where']})[_0xf946('0x12')](function(_0x1a7aa3){_0x7fdcd7[_0xf946('0x23')]=_0x1a7aa3;if(_0x42b6ed[_0xf946('0x57')][_0xf946('0x64')]){_0x34a9a4[_0xf946('0x65')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf946('0x7c')](_0x34a9a4);})[_0xf946('0x12')](function(_0xcd1f02){_0x7fdcd7['rows']=_0xcd1f02;return _0x7fdcd7;});}})[_0xf946('0x12')](respondWithFilteredResult(_0x21f998,_0x34a9a4))[_0xf946('0x1d')](handleError(_0x21f998,null));};exports[_0xf946('0x7d')]=function(_0xe3a91b,_0x2f82c3){return db[_0xf946('0x50')]['find']({'where':{'id':_0xe3a91b[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x2f82c3,null))['then'](function(_0x1b91fe){if(_0x1b91fe){return _0x1b91fe[_0xf946('0x7d')](_0xe3a91b['query'][_0xf946('0x78')]);}})[_0xf946('0x12')](respondWithStatusCode(_0x2f82c3,null))[_0xf946('0x1d')](handleError(_0x2f82c3,null));};exports[_0xf946('0x7e')]=function(_0x9bb56a,_0x21293b){_0x9bb56a[_0xf946('0x6c')][_0xf946('0x7f')]=_0x9bb56a[_0xf946('0x80')][_0xf946('0x81')];return db[_0xf946('0x50')]['find']({'where':{'id':_0x9bb56a[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x21293b,null))[_0xf946('0x12')](saveUpdates(_0x9bb56a['body'],null))[_0xf946('0x12')](respondWithResult(_0x21293b,null))['catch'](handleError(_0x21293b,null));};exports[_0xf946('0x82')]=function(_0x4ada9e,_0x380843){_0x4ada9e[_0xf946('0x6c')][_0xf946('0x83')]=_0x4ada9e['file'][_0xf946('0x81')];return db['ChatWebsite'][_0xf946('0x6a')]({'where':{'id':_0x4ada9e[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x380843,null))['then'](saveUpdates(_0x4ada9e[_0xf946('0x6c')],null))[_0xf946('0x12')](respondWithResult(_0x380843,null))[_0xf946('0x1d')](handleError(_0x380843,null));};exports['addCustomerAvatar']=function(_0x443f4a,_0x2d50da){_0x443f4a[_0xf946('0x6c')][_0xf946('0x84')]=_0x443f4a[_0xf946('0x80')]['filename'];return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x443f4a[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x2d50da,null))['then'](saveUpdates(_0x443f4a['body'],null))[_0xf946('0x12')](respondWithResult(_0x2d50da,null))[_0xf946('0x1d')](handleError(_0x2d50da,null));};exports[_0xf946('0x85')]=function(_0x993429,_0x2428af){_0x993429['body'][_0xf946('0x86')]=_0x993429[_0xf946('0x80')][_0xf946('0x81')];return db['ChatWebsite'][_0xf946('0x6a')]({'where':{'id':_0x993429[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x2428af,null))[_0xf946('0x12')](saveUpdates(_0x993429['body'],null))[_0xf946('0x12')](respondWithResult(_0x2428af,null))[_0xf946('0x1d')](handleError(_0x2428af,null));};exports[_0xf946('0x87')]=function(_0x501159,_0x5e837e){var _0xf293e9=path[_0xf946('0x88')](config[_0xf946('0x89')],'server/files/images/logos/default_logo.svg');var _0x1c39db={'where':{'id':_0x501159[_0xf946('0x72')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2c3bd5=![];return require(_0xf946('0x8a'))['getLicense']()['then'](function(_0x30d300){if(_0x30d300){_0x2c3bd5=_0x30d300[_0xf946('0x8b')];}})[_0xf946('0x12')](function(){return db[_0xf946('0x50')]['find'](_0x1c39db);})['then'](handleEntityNotFound(_0x5e837e,null))[_0xf946('0x12')](function(_0x1f45f7){if(_0x1f45f7){if(!_['isNil'](_0x1f45f7[_0xf946('0x7f')])){if(fs[_0xf946('0x8c')](path['join'](config[_0xf946('0x89')],'server/files/images/logos/',_0x1f45f7['sitepic']))&&_0x2c3bd5){_0xf293e9=path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0x8d'),_0x1f45f7[_0xf946('0x7f')]);}}return _0x5e837e['download'](_0xf293e9);}})[_0xf946('0x1d')](handleError(_0x5e837e,null));};exports[_0xf946('0x8e')]=function(_0x4ecc1b,_0x2ab23a){var _0x4ca273=path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0x8f'));var _0x37cbff={'where':{'id':_0x4ecc1b[_0xf946('0x72')]['id']},'attributes':['id',_0xf946('0x83')],'raw':!![]};return db[_0xf946('0x50')]['find'](_0x37cbff)['then'](handleEntityNotFound(_0x2ab23a,null))[_0xf946('0x12')](function(_0x9182d5){if(_0x9182d5){if(!_[_0xf946('0x90')](_0x9182d5[_0xf946('0x83')])){if(fs[_0xf946('0x8c')](path[_0xf946('0x88')](config['root'],'server/files/images/avatars/',_0x9182d5[_0xf946('0x83')]))){_0x4ca273=path[_0xf946('0x88')](config['root'],_0xf946('0x91'),_0x9182d5[_0xf946('0x83')]);}}return _0x2ab23a[_0xf946('0x92')](_0x4ca273);}})['catch'](handleError(_0x2ab23a,null));};exports[_0xf946('0x93')]=function(_0x26d15e,_0x2611a2){var _0x106a9d=path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0x94'));var _0x3d4ffc={'where':{'id':_0x26d15e[_0xf946('0x72')]['id']},'attributes':['id',_0xf946('0x84'),_0xf946('0x95')],'raw':!![]};return db[_0xf946('0x50')][_0xf946('0x6a')](_0x3d4ffc)['then'](handleEntityNotFound(_0x2611a2,null))[_0xf946('0x12')](function(_0xf9ee52){if(_0xf9ee52){if(!_[_0xf946('0x90')](_0xf9ee52[_0xf946('0x84')])){if(fs[_0xf946('0x8c')](path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0x91'),_0xf9ee52[_0xf946('0x84')]))&&_0xf9ee52[_0xf946('0x95')]){_0x106a9d=path[_0xf946('0x88')](config['root'],_0xf946('0x91'),_0xf9ee52[_0xf946('0x84')]);}}return _0x2611a2[_0xf946('0x92')](_0x106a9d);}})[_0xf946('0x1d')](handleError(_0x2611a2,null));};exports['getSystemAvatar']=function(_0x52faca,_0x1cef30){var _0xfe5998=path['join'](config['root'],_0xf946('0x96'));var _0x29cac2={'where':{'id':_0x52faca[_0xf946('0x72')]['id']},'attributes':['id',_0xf946('0x86')],'raw':!![]};return db[_0xf946('0x50')]['find'](_0x29cac2)[_0xf946('0x12')](handleEntityNotFound(_0x1cef30,null))[_0xf946('0x12')](function(_0x2e777e){if(_0x2e777e){if(!_[_0xf946('0x90')](_0x2e777e[_0xf946('0x86')])){if(fs[_0xf946('0x8c')](path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0x91'),_0x2e777e[_0xf946('0x86')]))){_0xfe5998=path['join'](config['root'],_0xf946('0x91'),_0x2e777e[_0xf946('0x86')]);}}return _0x1cef30['download'](_0xfe5998);}})[_0xf946('0x1d')](handleError(_0x1cef30,null));};exports[_0xf946('0x97')]=function(_0x1efe28,_0x3eca39){var _0x5e734f={'body':_0x1efe28['body'],'channel':_0xf946('0x98')};var _0x4d4e3c=[];var _0x4899a2=[];var _0x4b45c4={};var _0x41639c=![];return db[_0xf946('0x99')][_0xf946('0x9a')]()['then'](function(_0x1115b0){if(!_0x1115b0){throw new db[(_0xf946('0x9b'))]['ValidationError'](_0xf946('0x9c'));}_0x4d4e3c=_[_0xf946('0x9d')](_['keys'](_0x1115b0),[_0xf946('0x9e'),'updatedAt']);_0x4899a2=_[_0xf946('0x9d')](_[_0xf946('0x54')](_0x1115b0),[_0xf946('0x9e'),_0xf946('0x9f'),_0xf946('0xa0'),_0xf946('0xa1')]);if(_0x1efe28[_0xf946('0x6c')]['id']){delete _0x1efe28['body']['id'];}if(_[_0xf946('0x90')](_0x1efe28['body'][_0xf946('0xa2')])){throw new db['Sequelize'][(_0xf946('0xa3'))](_0xf946('0xa4'));}if(_['isNil'](_0x1efe28[_0xf946('0x6c')][_0xf946('0x6c')])||_0x1efe28['body']['body']===''){throw new db[(_0xf946('0x9b'))][(_0xf946('0xa3'))](_0xf946('0xa5'));}if(_[_0xf946('0x90')](_0x1efe28['body'][_0xf946('0xa6')])){throw new db[(_0xf946('0x9b'))]['ValidationError'](_0xf946('0xa7')+_0x4899a2);}if(!_[_0xf946('0xa8')](_0x4899a2,_0x1efe28[_0xf946('0x6c')][_0xf946('0xa6')])){throw new db[(_0xf946('0x9b'))][(_0xf946('0xa3'))](_0xf946('0xa9')+_0x4899a2);}_0x4b45c4[_0x1efe28[_0xf946('0x6c')][_0xf946('0xa6')]]=_0x1efe28[_0xf946('0x6c')][_0xf946('0xa2')];})[_0xf946('0x12')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1efe28[_0xf946('0x72')]['id']},'include':[{'model':db[_0xf946('0xaa')],'as':_0xf946('0xab'),'include':[{'model':db[_0xf946('0x99')],'as':_0xf946('0xac'),'where':_0x4b45c4,'limit':0x1,'order':[['updatedAt',_0xf946('0xad')]]}]},{'model':db['ChatApplication'],'as':_0xf946('0xae')},{'model':db[_0xf946('0x39')],'as':'Interval','include':[{'model':db[_0xf946('0x39')],'as':_0xf946('0x3a'),'attributes':['id',_0xf946('0x34')],'raw':!![]}]}]});})[_0xf946('0x12')](function(_0x49f3f9){if(!_0x49f3f9)throw new APINotFoundError(util[_0xf946('0x31')](_0xf946('0xaf'),_0x1efe28[_0xf946('0x72')]['id']));if(!_0x49f3f9[_0xf946('0x39')]||!_0x49f3f9[_0xf946('0x39')][_0xf946('0x3a')])return[_0x49f3f9,!![]];return[_0x49f3f9,checkWebsiteIntervals(_0x49f3f9)];})[_0xf946('0xb0')](function(_0x2f3ca5,_0x422846){if(!_0x422846)throw new APIOutOfIntervalError();if(!_0x2f3ca5[_0xf946('0xab')])return;_0x5e734f[_0xf946('0xb1')]=_0x2f3ca5;_0x5e734f['list']=_0x2f3ca5[_0xf946('0xab')];_0x5e734f[_0xf946('0xb2')]=_[_0xf946('0xb3')](_0x2f3ca5[_0xf946('0xae')],['priority'],[_0xf946('0xb4')]);if(_0x5e734f['account'][_0xf946('0xae')]){delete _0x5e734f[_0xf946('0xb1')][_0xf946('0xae')];}if(_0x5e734f[_0xf946('0xb1')][_0xf946('0xab')]&&_0x5e734f[_0xf946('0xb1')][_0xf946('0xab')][_0xf946('0xac')]['length']){return _0x5e734f[_0xf946('0xb1')]['List'][_0xf946('0xac')][0x0];}var _0x2eb375=_[_0xf946('0xb5')](_0x1efe28[_0xf946('0x6c')],{'firstName':_0x1efe28['body'][_0xf946('0xa2')],'ListId':_0x2f3ca5[_0xf946('0xa1')]});_0x2eb375[_0x1efe28[_0xf946('0x6c')][_0xf946('0xa6')]]=_0x1efe28['body'][_0xf946('0xa2')];return db['CmContact'][_0xf946('0x6b')](_0x2eb375,{'fields':_0x4d4e3c,'raw':!![]});})[_0xf946('0x12')](function(_0x34d1a9){_0x5e734f[_0xf946('0xb6')]=_0x34d1a9;var _0x7078df=createInteractionObject(_0x1efe28[_0xf946('0x72')]['id'],_0x1efe28[_0xf946('0x6c')],_0x1efe28['headers'],_0x34d1a9);var _0x177d5b={'ChatWebsiteId':_0x1efe28[_0xf946('0x72')]['id'],'closed':![]};if(_0x1efe28[_0xf946('0x6c')][_0xf946('0xb7')]){_0x177d5b['threadId']=_0x1efe28[_0xf946('0x6c')][_0xf946('0xb7')];return db[_0xf946('0xb8')][_0xf946('0x6a')]({'where':_0x177d5b})['then'](function(_0x27eb09){if(_0x27eb09){_0x41639c=!![];return _0x27eb09;}_0x7078df['threadId']=_0x1efe28[_0xf946('0x6c')]['threadId'];_0x7078df[_0xf946('0xb9')]=_0x1efe28[_0xf946('0x6c')][_0xf946('0xb9')];return db['ChatInteraction'][_0xf946('0x6b')](_0x7078df);});}_0x177d5b[_0xf946('0xba')]=_0x34d1a9['id'];if(_0x1efe28[_0xf946('0x6c')][_0xf946('0xbb')]&&_0x1efe28[_0xf946('0x6c')][_0xf946('0xbb')]['id']){_0x177d5b['id']=_0x1efe28[_0xf946('0x6c')][_0xf946('0xbb')]['id'];return db['ChatInteraction'][_0xf946('0x6a')]({'where':_0x177d5b})[_0xf946('0x12')](function(_0x71d818){if(_0x71d818){_0x41639c=!![];return _0x71d818;}return db[_0xf946('0xb8')][_0xf946('0x6b')](_0x7078df);});}return db[_0xf946('0xb8')][_0xf946('0x6b')](_0x7078df);})[_0xf946('0x12')](function(_0x512ca8){if(!_0x41639c)return _0x512ca8;var _0x335b3d={'from':(_0x5e734f[_0xf946('0xb6')][_0xf946('0xbc')]||'')+'\x20'+(_0x5e734f[_0xf946('0xb6')][_0xf946('0x45')]||'')};if(_0x1efe28[_0xf946('0x6c')][_0xf946('0xb7')]&&_0x1efe28['body']['messageId']&&_0x1efe28['body']['threadId']!=_0x1efe28[_0xf946('0x6c')]['messageId']){_0x335b3d[_0xf946('0xb7')]=_0x1efe28[_0xf946('0x6c')][_0xf946('0xbd')];}return _0x512ca8['update'](_0x335b3d);})[_0xf946('0x12')](function(_0x262ec3){_0x5e734f[_0xf946('0xbb')]=_0x262ec3[_0xf946('0x29')]({'plain':!![]});_0x5e734f[_0xf946('0xbb')][_0xf946('0xbe')]=!_0x41639c;if(_0x5e734f[_0xf946('0xbb')]['created']){if(_0x5e734f[_0xf946('0xb1')][_0xf946('0xbf')]){_0x5e734f[_0xf946('0xb2')]['push']({'id':0x0,'priority':_0x5e734f[_0xf946('0xb2')][_0xf946('0x5a')]+0x1,'app':'close','appdata':_0xf946('0xc0'),'interval':_0xf946('0xc1')});}}return db[_0xf946('0xc2')][_0xf946('0x6b')]({'body':_0x1efe28[_0xf946('0x6c')][_0xf946('0x6c')],'ChatWebsiteId':_0x1efe28['params']['id'],'ChatInteractionId':_0x262ec3['id'],'direction':'in','ContactId':_0x5e734f['contact']['id'],'AttachmentId':_0x1efe28[_0xf946('0x6c')]['AttachmentId']});})[_0xf946('0x12')](function(_0x14e616){_0x5e734f['message']=_0x14e616;if(!_0x5e734f[_0xf946('0xbb')]['UserId']){return;}return db[_0xf946('0xc3')][_0xf946('0x6a')]({'attributes':['id',_0xf946('0x2d')],'where':{'id':_0x5e734f[_0xf946('0xbb')][_0xf946('0xc4')]}});})[_0xf946('0x12')](function(_0x238bea){if(_0x238bea){_0x5e734f[_0xf946('0xb2')][_0xf946('0xc5')]({'id':0x0,'priority':0x0,'app':_0xf946('0xc6'),'appdata':_0x238bea[_0xf946('0x2d')]+','+(_0x5e734f[_0xf946('0xb1')][_0xf946('0xc7')]||0xa),'interval':_0xf946('0xc1')});_0x5e734f['forcedOwnership']=!![];}if(!_0x5e734f['interaction'][_0xf946('0xc8')]){return;}return db['ChatQueue'][_0xf946('0x6a')]({'attributes':['id',_0xf946('0x2d')],'where':{'id':_0x5e734f[_0xf946('0xbb')][_0xf946('0xc8')]}});})[_0xf946('0x12')](function(_0x2a52d0){if(_0x2a52d0){_0x5e734f[_0xf946('0xb2')]['unshift']({'id':0x0,'priority':0x1,'app':_0xf946('0xc9'),'appdata':_0x2a52d0[_0xf946('0x2d')]+','+(_0x5e734f[_0xf946('0xb1')][_0xf946('0xca')]||0x12c),'interval':_0xf946('0xc1')});}return respondWithRpcPromise(_0xf946('0xcb'),_0xf946('0xcc'),_0x5e734f);})[_0xf946('0x12')](function(_0xb42079){respondWithRpcPromise('EventManager',_0xf946('0xcd'),{'event':'notify','message':_0xb42079},client9002);return _0xb42079;})[_0xf946('0x12')](respondWithResult(_0x3eca39,null))[_0xf946('0x1d')](APIHandleError(_0x3eca39));};exports[_0xf946('0xce')]=function(_0x1d2abd,_0x34c997){var _0x41fc11,_0x3c04b4,_0x1f852c;var _0x312495=[];var _0x283934={};var _0x5baaa3=_0x1d2abd[_0xf946('0xcf')]||[];var _0x1c4db2=[];var _0x1bb8dc;return db['CmContact'][_0xf946('0x9a')]()['then'](function(_0x4e9d36){if(!_0x4e9d36){throw new db[(_0xf946('0x9b'))]['ValidationError']('no\x20available\x20attributes');}_0x312495=_[_0xf946('0x9d')](_[_0xf946('0x54')](_0x4e9d36),['createdAt',_0xf946('0x9f'),_0xf946('0xa0'),_0xf946('0xa1')]);if(_0x1d2abd['body']['id']){delete _0x1d2abd[_0xf946('0x6c')]['id'];}if(_[_0xf946('0x90')](_0x1d2abd[_0xf946('0x6c')][_0xf946('0xa2')])){throw _0x34c997['status'](0x1f4)[_0xf946('0x2e')](new db['Sequelize'][(_0xf946('0xa3'))]('from\x20is\x20mandatory'));}if(_[_0xf946('0x90')](_0x1d2abd['body'][_0xf946('0x6c')])||_0x1d2abd['body']['body']===''){throw _0x34c997[_0xf946('0x1f')](0x1f4)[_0xf946('0x2e')](new db[(_0xf946('0x9b'))]['ValidationError'](_0xf946('0xa5')));}if(_[_0xf946('0x90')](_0x1d2abd[_0xf946('0x6c')]['mapKeyOffline'])){throw _0x34c997[_0xf946('0x1f')](0x1f4)['send'](new db[(_0xf946('0x9b'))]['ValidationError'](_0xf946('0xd0')+_0x312495));}if(!_['includes'](_0x312495,_0x1d2abd['body']['mapKeyOffline'])){throw _0x34c997[_0xf946('0x1f')](0x1f4)['send'](new db[(_0xf946('0x9b'))][(_0xf946('0xa3'))](_0xf946('0xd1')+_0x312495));}_0x283934[_0x1d2abd[_0xf946('0x6c')][_0xf946('0xd2')]]=_0x1d2abd[_0xf946('0x6c')][_0xf946('0xa2')];})[_0xf946('0x12')](function(){return db['ChatWebsite'][_0xf946('0x6a')]({'where':{'id':_0x1d2abd[_0xf946('0x72')]['id']},'include':[{'model':db[_0xf946('0xaa')],'as':'List'},{'model':db[_0xf946('0xd3')],'as':_0xf946('0xd3')}]});})[_0xf946('0x12')](handleEntityNotFound(_0x34c997,null))[_0xf946('0x12')](function(_0x3b8613){if(_0x3b8613&&_0x3b8613[_0xf946('0xab')]){_0x3c04b4=_0x3b8613;var _0x50ba84=_[_0xf946('0xb5')](_0x1d2abd['body'],{'firstName':_0x1d2abd['body'][_0xf946('0xa2')],'phone':_0x1d2abd[_0xf946('0x6c')][_0xf946('0xa2')],'ListId':_0x3b8613[_0xf946('0xa1')]});_0x50ba84[_0x1d2abd[_0xf946('0x6c')][_0xf946('0xd2')]]=_0x1d2abd['body'][_0xf946('0xa2')];return db[_0xf946('0x99')][_0xf946('0xd4')]({'where':_0x283934,'defaults':_0x50ba84});}})[_0xf946('0xb0')](function(_0x14d26b){if(_0x14d26b){_0x1f852c=_0x14d26b;var _0x2ba746=fs[_0xf946('0xd5')](path['join'](config['root'],_0xf946('0xd6')),'utf8');var _0x286067=ejs[_0xf946('0xd7')](_0x2ba746,{'body':_[_0xf946('0xd8')](_0x1d2abd[_0xf946('0x6c')][_0xf946('0x6c')]),'bodyTitle':_0x3c04b4['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x286067,'plainBody':htmlToText['fromString'](_0x286067),'ContactId':_0x14d26b['id'],'ChatWebsiteId':_0x3c04b4['id']});}})['then'](function(_0x2f85fa){_0x1bb8dc=_0x2f85fa;if(_0x5baaa3[_0xf946('0x5a')]){var _0x2a8a8c=_0x5baaa3[_0xf946('0x4f')](function(_0x4dfcf5){return{'name':_0x4dfcf5[_0xf946('0xd9')],'basename':_0x4dfcf5['filename'],'type':_0x4dfcf5[_0xf946('0xda')],'ChatOfflineMessageId':_0x2f85fa['id']};});_0x1c4db2=_0x2a8a8c['map'](_0x35f4d4=>{var _0x398d61={'filename':_0x35f4d4[_0xf946('0x2d')],'path':path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0xdb'),_0xf946('0xcf'),_0xf946('0xdc'),'offline-chat',_0x35f4d4['basename'])};return _0x398d61;});if(!_0x3c04b4['openNewInteraction']){return db[_0xf946('0xdd')][_0xf946('0xde')](function(_0x44de7b){return db[_0xf946('0xdf')][_0xf946('0xe0')](_0x2a8a8c,{'transaction':_0x44de7b});});}}})[_0xf946('0x12')](function(){if(_0x1bb8dc){_0x41fc11=_0x1bb8dc;return db[_0xf946('0xd3')][_0xf946('0xe1')]({'where':{'service':!![]},'include':[{'model':db[_0xf946('0xe2')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf946('0xe3')],'as':_0xf946('0xe3'),'raw':!![]}]}]});}})[_0xf946('0x12')](function(_0x255382){if(_0x255382&&_0x255382['Smtp']&&_0x3c04b4[_0xf946('0xe4')]&&_0x3c04b4[_0xf946('0xe5')]){var _0x3c2f57=_0x255382['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xf946('0xe6'),{'account':_0x3c2f57,'message':{'from':util[_0xf946('0x31')](_0xf946('0xe7'),_0x255382['name'],_0x255382['email']||_0x255382[_0xf946('0xe8')][_0xf946('0x6d')]),'to':_0x3c04b4['forwardOfflineAddress'],'subject':_0x3c04b4[_0xf946('0xe9')],'html':_0x41fc11[_0xf946('0x6c')],'attachments':_0x1c4db2}},client9003)[_0xf946('0x12')](function(){return _0x41fc11;})[_0xf946('0x1d')](function(_0x455263){logger[_0xf946('0x18')](_0x455263);});}})[_0xf946('0x12')](function(){if(_0x3c04b4&&_0x3c04b4['openNewInteraction']&&_0x3c04b4[_0xf946('0xea')]){var _0x1a4f6f=[];if(_0x5baaa3[_0xf946('0x5a')]){_0x1a4f6f=_0x5baaa3[_0xf946('0x4f')](function(_0x5298a5){return{'name':_0x5298a5[_0xf946('0xd9')],'basename':_0x5298a5[_0xf946('0x81')],'type':_0x5298a5['mimetype'],'ChatOfflineMessageId':_0x1bb8dc['id']};});}var _0x2bf776;if(!_[_0xf946('0x90')](_0x3c04b4[_0xf946('0xeb')])){var _0x54e9c6=_[_0xf946('0x4f')](_0x1d2abd[_0xf946('0x6c')],function(_0x5ea64f){return _0x5ea64f;});var _0x4a42fb=_[_0xf946('0xec')](_0x54e9c6)[0x0];var _0x2f3201=_['mapValues'](_0x4a42fb,function(_0x307d98){return _0x307d98;});_0x2bf776=_0x2f3201[0x1][_0x3c04b4['subjectOffline']];}var _0x3ba675={'from':_0x1f852c['email'],'firstName':_0x1f852c[_0xf946('0xbc')],'lastName':_0x1f852c[_0xf946('0x45')],'mapKey':'email','message':{'from':_0x1f852c[_0xf946('0xed')],'to':_0x3c04b4[_0xf946('0xd3')][_0xf946('0xed')],'cc':'','subject':_['isNil'](_0x2bf776)?_0x3c04b4[_0xf946('0xe9')]:_0x2bf776,'messageId':'','sentAt':new Date(),'attach':_0x1a4f6f[_0xf946('0x5a')],'attachments':_0x1a4f6f,'originChannel':_0xf946('0xee'),'ChatWebsiteId':_0x3c04b4['id'],'ChatOfflineMessageId':_0x41fc11['id'],'originTo':_0x3c04b4[_0xf946('0xd3')][_0xf946('0xed')]},'body':_0x41fc11[_0xf946('0x6c')]};var _0x3f517={'account':{'id':_0x3c04b4[_0xf946('0xea')]},'body':_0x3ba675,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xf946('0xef'),'notifyMail',_0x3f517,client9001)['then'](function(){return _0x41fc11;})[_0xf946('0x1d')](function(_0xbd7d17){logger[_0xf946('0x18')](_0xbd7d17);});}return;})[_0xf946('0x12')](function(){if(_0x41fc11){return _0x41fc11;}})['then'](respondWithResult(_0x34c997,null))[_0xf946('0x1d')](function(){for(var _0x5d3d93 of _0x5baaa3){var _0x52bfa5=path[_0xf946('0x88')](config[_0xf946('0x89')],_0xf946('0xdb'),_0xf946('0xcf'),_0xf946('0xdc'),_0xf946('0xf0'),_0x5d3d93[_0xf946('0x81')]);fs_extra[_0xf946('0xf1')](_0x52bfa5)[_0xf946('0x1d')](function(_0x3a79ed){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x52bfa5,_0x3a79ed);});}});};exports[_0xf946('0xf2')]=function(_0x534bcc,_0x1d3d3d){return db['ChatInteraction']['find']({'where':{'id':_0x534bcc[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x1d3d3d,null))[_0xf946('0x12')](function(_0x534caf){if(_0x534caf){return _0x534caf[_0xf946('0xf2')](_0x534bcc[_0xf946('0x6c')][_0xf946('0x78')],_[_0xf946('0xf3')](_0x534bcc['body'],[_0xf946('0x78'),'id'])||{});}})[_0xf946('0x12')](respondWithResult(_0x1d3d3d,null))[_0xf946('0x1d')](handleError(_0x1d3d3d,null));};exports[_0xf946('0xf4')]=function(_0x17d065,_0x43985){var _0x2d20c1={'raw':![],'where':{}};var _0x354414={};var _0x505834={'count':0x0,'rows':[]};return db[_0xf946('0x50')][_0xf946('0xe1')]({'where':{'id':_0x17d065['params']['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x43985,null))[_0xf946('0x12')](function(_0x3c0cde){if(_0x3c0cde){_0x354414[_0xf946('0x4b')]=_['keys'](db['ChatInteraction'][_0xf946('0x51')]);_0x354414[_0xf946('0x57')]=_[_0xf946('0x54')](_0x17d065['query']);_0x354414[_0xf946('0x55')]=_[_0xf946('0x56')](_0x354414['model'],_0x354414['query']);_0x2d20c1[_0xf946('0x58')]=_[_0xf946('0x56')](_0x354414[_0xf946('0x4b')],qs['fields'](_0x17d065[_0xf946('0x57')][_0xf946('0x59')]));_0x2d20c1[_0xf946('0x58')]=_0x2d20c1['attributes'][_0xf946('0x5a')]?_0x2d20c1['attributes']:_0x354414[_0xf946('0x4b')];if(!_0x17d065[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x2d20c1[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x17d065[_0xf946('0x57')][_0xf946('0x22')]);_0x2d20c1[_0xf946('0x24')]=qs['offset'](_0x17d065[_0xf946('0x57')]['offset']);}_0x2d20c1[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x17d065[_0xf946('0x57')][_0xf946('0x5e')]);_0x2d20c1[_0xf946('0x5f')]=qs['filters'](_[_0xf946('0x60')](_0x17d065[_0xf946('0x57')],_0x354414[_0xf946('0x55')]));_0x2d20c1['where']['ChatWebsiteId']=_0x3c0cde['id'];if(_0x17d065['query']['filter']){_0x2d20c1['where']=_[_0xf946('0x68')](_0x2d20c1[_0xf946('0x5f')],{'$or':_['map'](_0x2d20c1[_0xf946('0x58')],function(_0x53bce0){var _0x2a5c6e={};_0x2a5c6e[_0x53bce0]={'$like':'%'+_0x17d065['query'][_0xf946('0x61')]+'%'};return _0x2a5c6e;})});}_0x2d20c1=_['merge']({},_0x2d20c1,_0x17d065[_0xf946('0x69')]);return db[_0xf946('0xb8')][_0xf946('0x23')]({'where':_0x2d20c1['where']})[_0xf946('0x12')](function(_0x5e9f48){_0x505834[_0xf946('0x23')]=_0x5e9f48;if(_0x17d065['query'][_0xf946('0x64')]){_0x2d20c1[_0xf946('0x65')]=[{'model':db[_0xf946('0x99')],'as':_0xf946('0xf5'),'required':![]},{'model':db[_0xf946('0xc3')],'as':_0xf946('0xf6'),'attributes':[_0xf946('0x2d'),_0xf946('0xf7'),_0xf946('0xf8')],'required':![]},{'model':db[_0xf946('0xf9')],'as':_0xf946('0xfa'),'attributes':['id','name','color'],'where':_0x17d065[_0xf946('0x57')][_0xf946('0xfb')]?{'id':_0x17d065['query'][_0xf946('0xfb')]}:undefined,'required':_0x17d065[_0xf946('0x57')][_0xf946('0xfb')]?!![]:![]}];}return db[_0xf946('0xb8')][_0xf946('0x7c')](_0x2d20c1);})['then'](function(_0x63e018){_0x505834[_0xf946('0x66')]=_0x63e018;return _0x505834;});}})['then'](respondWithFilteredResult(_0x43985,_0x2d20c1))[_0xf946('0x1d')](handleError(_0x43985,null));};exports[_0xf946('0x2f')]=function(_0x25a6c7,_0x114ca2){var _0x22ddf6=0x0;var _0x186e2c=0x0;var _0x3fd2f9=![];var _0x489b60;var _0x42a673;return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x25a6c7[_0xf946('0x72')]['id']},'include':[{'model':db[_0xf946('0x39')],'as':_0xf946('0x39'),'include':[{'model':db[_0xf946('0x39')],'as':_0xf946('0x3a'),'attributes':['id',_0xf946('0x34')]}]}]})['then'](handleEntityNotFound(_0x114ca2,null))[_0xf946('0x12')](function(_0x46c4e5){if(_0x46c4e5){_0x489b60=_0x46c4e5;return _0x46c4e5['getProactiveActions']({'raw':!![]});}})[_0xf946('0x12')](function(_0x5e03d4){if(_0x489b60){if(_0x5e03d4){_0x42a673=_0x5e03d4;}}return require('../../config/license/util')[_0xf946('0xfc')]();})[_0xf946('0x12')](function(_0x5ae739){if(_0x5ae739){_0x186e2c=_0x5ae739['virtual'];_0x3fd2f9=_0x5ae739['custom'];}})[_0xf946('0x12')](function(){return db[_0xf946('0xb8')][_0xf946('0x23')]({'where':{'closed':![]}});})['then'](function(_0x4ccb23){_0x22ddf6=_0x4ccb23;if(_0x186e2c&&_0x4ccb23>_0x186e2c){return db['License'][_0xf946('0xe1')]({'where':{'id':0x1}})[_0xf946('0x12')](function(_0x22fddc){if(_0x22fddc){_0x22fddc[_0xf946('0xfd')](_0xf946('0xfe'));}});}})[_0xf946('0x12')](function(){if(!_0x489b60[_0xf946('0x39')]||!_0x489b60[_0xf946('0x39')][_0xf946('0x3a')])return!![];return checkWebsiteIntervals(_0x489b60);})[_0xf946('0x12')](function(_0x43cebe){var _0x20ab20=fs[_0xf946('0xd5')](path[_0xf946('0x88')](config[_0xf946('0x89')],'server/files/chat/iframe.ejs'),_0xf946('0xff'));var _0x2e6b2b=new url[(_0xf946('0x100'))](_0x489b60[_0xf946('0x101')])['origin'];var _0x4a41c0=_0xf946('0x102');var _0x2e1cea=![];var _0x15f8ec={'chatVersion':_0x4a41c0,'chatWebsiteAddressOrigin':_0x2e6b2b,'remote':_0x489b60[_0xf946('0x103')],'query':querystring[_0xf946('0x17')](_[_0xf946('0x68')](_0x489b60[_0xf946('0x29')]({'plain':!![]}),{'customerIp':_0x25a6c7[_0xf946('0x104')][_0xf946('0x42')]||_0x25a6c7[_0xf946('0x104')][_0xf946('0x105')]||_0x25a6c7[_0xf946('0x106')][_0xf946('0x107')]||_0x25a6c7['ip'],'referer':_0x25a6c7[_0xf946('0x104')]['referer'],'openedInteractions':_0x22ddf6,'maxInteractions':_0x186e2c,'virtual':_0x3fd2f9[_0xf946('0x108')],'online':_0x43cebe,'custom':_0x3fd2f9}))['replace'](/'/g,'\x5c\x27')};_0x114ca2[_0xf946('0x2e')](ejs[_0xf946('0xd7')](Mustache['render'](_0x20ab20,_0x15f8ec),{'proactiveActions':_0x42a673,'alignment':_0x489b60[_0xf946('0x109')],'verticalAlignment':_0x489b60['verticalAlignment'],'div_color':_0x489b60[_0xf946('0x10a')],'labelText':_0x489b60[_0xf946('0x10b')],'text_color':_0x489b60[_0xf946('0x10c')],'text_button_color':_0x489b60[_0xf946('0x10d')],'button_color':_0x489b60[_0xf946('0x10e')],'background_color':_0x489b60[_0xf946('0x10f')],'hideWhenOffline':_0x489b60[_0xf946('0x110')],'intervalId':_0x489b60[_0xf946('0x111')],'isDevelopment':_0x2e1cea,'chatVersion':_0x4a41c0}));})['catch'](handleError(_0x114ca2,null));};exports[_0xf946('0x112')]=function(_0x43e0dc,_0xbe8c52){var _0x244e74=_0x43e0dc[_0xf946('0x72')]['id'];var _0x52fbbf=_0x43e0dc['body'];var _0x7a280e=0xc8;var _0x4d4891=null;return db['sequelize'][_0xf946('0xde')]({'isolationLevel':db['sequelize'][_0xf946('0x113')][_0xf946('0x114')][_0xf946('0x115')]},function(_0xb2702a){return db[_0xf946('0x50')][_0xf946('0xe1')]({'where':{'id':_0x244e74},'transaction':_0xb2702a})[_0xf946('0x12')](function(_0x5dc834){if(_0x5dc834){return db[_0xf946('0x116')][_0xf946('0x28')]({'where':{'ChatWebsiteId':_0x244e74},'transaction':_0xb2702a})[_0xf946('0x12')](function(){var _0x249471=_[_0xf946('0x4f')](_0x52fbbf,function(_0x4d47c8){_0x4d47c8[_0xf946('0x74')]=_0x244e74;return _0x4d47c8;});return db['ChatApplication'][_0xf946('0xe0')](_0x249471,{'transaction':_0xb2702a});});}else{_0x7a280e=0x194;_0x4d4891=[];}});})[_0xf946('0x12')](function(){if(_0x7a280e!==0x194){return db['ChatApplication'][_0xf946('0x117')]({'where':{'ChatWebsiteId':_0x244e74},'order':_0xf946('0x118')})[_0xf946('0x12')](function(_0x11549d){_0x4d4891=_0x11549d;});}})['catch'](function(_0x383856){_0x7a280e=0x1f4;logger[_0xf946('0x18')](_0x383856[_0xf946('0x119')]);if(_0x383856[_0xf946('0x2d')]){delete _0x383856['name'];}_0x4d4891=_0x383856;})['finally'](function(){if(_0x4d4891===null){_0xbe8c52['sendStatus'](_0x7a280e);}else{if(_0x7a280e===0x1f4){_0xbe8c52[_0xf946('0x1f')](_0x7a280e)[_0xf946('0x2e')](_0x4d4891);}else{_0xbe8c52[_0xf946('0x1f')](_0x7a280e)[_0xf946('0x20')](_0x4d4891);}}});};exports['getApplications']=function(_0x4c9c12,_0x4c3905){var _0x49dcac={};var _0x2e5f48={};var _0x913394;var _0x47179d;return db[_0xf946('0x50')][_0xf946('0xe1')]({'where':{'id':_0x4c9c12[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x4c3905,null))[_0xf946('0x12')](function(_0x40fd7b){if(_0x40fd7b){_0x913394=_0x40fd7b;_0x2e5f48[_0xf946('0x4b')]=_['keys'](db[_0xf946('0x116')][_0xf946('0x51')]);_0x2e5f48[_0xf946('0x57')]=_[_0xf946('0x54')](_0x4c9c12[_0xf946('0x57')]);_0x2e5f48[_0xf946('0x55')]=_['intersection'](_0x2e5f48[_0xf946('0x4b')],_0x2e5f48['query']);_0x49dcac[_0xf946('0x58')]=_[_0xf946('0x56')](_0x2e5f48['model'],qs[_0xf946('0x59')](_0x4c9c12[_0xf946('0x57')][_0xf946('0x59')]));_0x49dcac[_0xf946('0x58')]=_0x49dcac[_0xf946('0x58')][_0xf946('0x5a')]?_0x49dcac[_0xf946('0x58')]:_0x2e5f48[_0xf946('0x4b')];_0x49dcac[_0xf946('0x5d')]=qs['sort'](_0x4c9c12[_0xf946('0x57')][_0xf946('0x5e')]);_0x49dcac[_0xf946('0x5f')]=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x4c9c12[_0xf946('0x57')],_0x2e5f48[_0xf946('0x55')]));if(_0x4c9c12[_0xf946('0x57')]['filter']){_0x49dcac['where']=_[_0xf946('0x68')](_0x49dcac[_0xf946('0x5f')],{'$or':_[_0xf946('0x4f')](_0x49dcac[_0xf946('0x58')],function(_0x54e13d){var _0x3046a4={};_0x3046a4[_0x54e13d]={'$like':'%'+_0x4c9c12[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0x3046a4;})});}_0x49dcac=_[_0xf946('0x68')]({},_0x49dcac,_0x4c9c12[_0xf946('0x69')]);return _0x913394[_0xf946('0x11a')](_0x49dcac);}})[_0xf946('0x12')](function(_0x9866bc){if(_0x9866bc){_0x47179d=_0x9866bc[_0xf946('0x5a')];if(!_0x4c9c12['query'][_0xf946('0x5b')](_0xf946('0x5c'))){_0x49dcac[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x4c9c12[_0xf946('0x57')][_0xf946('0x22')]);_0x49dcac['offset']=qs[_0xf946('0x24')](_0x4c9c12['query'][_0xf946('0x24')]);}return _0x913394[_0xf946('0x11a')](_0x49dcac);}})[_0xf946('0x12')](function(_0x36fb6f){if(_0x36fb6f){return _0x36fb6f?{'count':_0x47179d,'rows':_0x36fb6f}:null;}})[_0xf946('0x12')](respondWithResult(_0x4c3905,null))[_0xf946('0x1d')](handleError(_0x4c3905,null));};exports['addProactiveActions']=function(_0x59d486,_0x317660){return db[_0xf946('0x11b')][_0xf946('0x6a')]({'where':{'id':_0x59d486[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x317660,null))['then'](function(_0x4df85e){if(_0x4df85e){return _0x4df85e[_0xf946('0x11c')](_0x59d486['body'][_0xf946('0x78')],_[_0xf946('0xf3')](_0x59d486[_0xf946('0x6c')],[_0xf946('0x78'),'id'])||{});}})[_0xf946('0x12')](respondWithResult(_0x317660,null))['catch'](handleError(_0x317660,null));};exports['getProactiveActions']=function(_0x49f9ab,_0x45f150){var _0x13a1ff={};var _0xffafa6={};var _0x5c0dad;var _0x185792;return db[_0xf946('0x50')]['findOne']({'where':{'id':_0x49f9ab[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x45f150,null))['then'](function(_0xfd4977){if(_0xfd4977){_0x5c0dad=_0xfd4977;_0xffafa6[_0xf946('0x4b')]=_[_0xf946('0x54')](db[_0xf946('0x11d')][_0xf946('0x51')]);_0xffafa6['query']=_[_0xf946('0x54')](_0x49f9ab[_0xf946('0x57')]);_0xffafa6['filters']=_['intersection'](_0xffafa6[_0xf946('0x4b')],_0xffafa6[_0xf946('0x57')]);_0x13a1ff[_0xf946('0x58')]=_[_0xf946('0x56')](_0xffafa6['model'],qs[_0xf946('0x59')](_0x49f9ab['query'][_0xf946('0x59')]));_0x13a1ff['attributes']=_0x13a1ff[_0xf946('0x58')][_0xf946('0x5a')]?_0x13a1ff[_0xf946('0x58')]:_0xffafa6[_0xf946('0x4b')];_0x13a1ff[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x49f9ab[_0xf946('0x57')][_0xf946('0x5e')]);_0x13a1ff[_0xf946('0x5f')]=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x49f9ab['query'],_0xffafa6[_0xf946('0x55')]));if(_0x49f9ab[_0xf946('0x57')][_0xf946('0x61')]){_0x13a1ff[_0xf946('0x5f')]=_['merge'](_0x13a1ff['where'],{'$or':_['map'](_0x13a1ff[_0xf946('0x58')],function(_0x193051){var _0x721712={};_0x721712[_0x193051]={'$like':'%'+_0x49f9ab['query']['filter']+'%'};return _0x721712;})});}_0x13a1ff=_['merge']({},_0x13a1ff,_0x49f9ab[_0xf946('0x69')]);return _0x5c0dad['getProactiveActions'](_0x13a1ff);}})[_0xf946('0x12')](function(_0x295e7d){if(_0x295e7d){_0x185792=_0x295e7d[_0xf946('0x5a')];if(!_0x49f9ab[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x13a1ff[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x49f9ab[_0xf946('0x57')]['limit']);_0x13a1ff[_0xf946('0x24')]=qs[_0xf946('0x24')](_0x49f9ab[_0xf946('0x57')][_0xf946('0x24')]);}return _0x5c0dad['getProactiveActions'](_0x13a1ff);}})[_0xf946('0x12')](function(_0x4fe9b8){if(_0x4fe9b8){return _0x4fe9b8?{'count':_0x185792,'rows':_0x4fe9b8}:null;}})[_0xf946('0x12')](respondWithResult(_0x45f150,null))[_0xf946('0x1d')](handleError(_0x45f150,null));};exports['getFields']=function(_0x1c9a6c,_0x18db1d){var _0x2225a9=_0x1c9a6c['query'][_0xf946('0x11e')]===_0xf946('0x11f')?_0xf946('0x120'):_0xf946('0x121');return db['ChatWebsite']['find']({'attributes':['id',_0x2225a9],'where':{'id':_0x1c9a6c[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x18db1d,null))[_0xf946('0x12')](function(_0x53cf4a){if(_0x53cf4a){var _0x49db16=_0x53cf4a[_0x2225a9];var _0x537962=_0x49db16&&_0x49db16[_0xf946('0x122')]?_0x49db16['items']:[];_0x18db1d[_0xf946('0x2e')]({'fromKey':_[_0xf946('0x90')](_0x49db16[_0xf946('0x123')])?undefined:_0x49db16[_0xf946('0x123')],'count':_0x537962[_0xf946('0x5a')],'rows':_0x537962});}})[_0xf946('0x1d')](handleError(_0x18db1d,null));};exports[_0xf946('0x124')]=function(_0x5770f9,_0x4d0e12){var _0x1fa156={'raw':![],'where':{}};var _0x888bcd={};var _0x1739a8={'count':0x0,'rows':[]};return db[_0xf946('0x50')][_0xf946('0xe1')]({'where':{'id':_0x5770f9[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x4d0e12,null))['then'](function(_0x7cba72){if(_0x7cba72){_0x888bcd[_0xf946('0x4b')]=_['keys'](db[_0xf946('0x125')]['rawAttributes']);_0x888bcd['query']=_[_0xf946('0x54')](_0x5770f9[_0xf946('0x57')]);_0x888bcd[_0xf946('0x55')]=_[_0xf946('0x56')](_0x888bcd['model'],_0x888bcd[_0xf946('0x57')]);_0x1fa156[_0xf946('0x58')]=_[_0xf946('0x56')](_0x888bcd[_0xf946('0x4b')],qs[_0xf946('0x59')](_0x5770f9[_0xf946('0x57')][_0xf946('0x59')]));_0x1fa156[_0xf946('0x58')]=_0x1fa156[_0xf946('0x58')]['length']?_0x1fa156[_0xf946('0x58')]:_0x888bcd[_0xf946('0x4b')];if(!_0x5770f9[_0xf946('0x57')][_0xf946('0x5b')](_0xf946('0x5c'))){_0x1fa156[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x5770f9[_0xf946('0x57')][_0xf946('0x22')]);_0x1fa156[_0xf946('0x24')]=qs[_0xf946('0x24')](_0x5770f9[_0xf946('0x57')][_0xf946('0x24')]);}_0x1fa156[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x5770f9[_0xf946('0x57')][_0xf946('0x5e')]);_0x1fa156[_0xf946('0x5f')]=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x5770f9[_0xf946('0x57')],_0x888bcd[_0xf946('0x55')]));_0x1fa156[_0xf946('0x5f')]['ChatWebsiteId']=_0x7cba72['id'];if(_0x5770f9['query'][_0xf946('0x61')]){_0x1fa156['where']=_[_0xf946('0x68')](_0x1fa156[_0xf946('0x5f')],{'$or':_['map'](_0x1fa156[_0xf946('0x58')],function(_0x229c9f){var _0x31b5af={};_0x31b5af[_0x229c9f]={'$like':'%'+_0x5770f9[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0x31b5af;})});}_0x1fa156=_[_0xf946('0x68')]({},_0x1fa156,_0x5770f9[_0xf946('0x69')]);return db[_0xf946('0x125')][_0xf946('0x23')]({'where':_0x1fa156[_0xf946('0x5f')]})[_0xf946('0x12')](function(_0x30cd1e){_0x1739a8[_0xf946('0x23')]=_0x30cd1e;if(_0x5770f9[_0xf946('0x57')][_0xf946('0x64')]){_0x1fa156['include']=[{'all':!![]}];}else{_0x1fa156[_0xf946('0x65')]=[{'model':db[_0xf946('0x99')],'as':_0xf946('0xf5'),'required':![]},{'model':db[_0xf946('0xdf')],'as':'Attachments','required':![]}];}return db[_0xf946('0x125')][_0xf946('0x7c')](_0x1fa156);})[_0xf946('0x12')](function(_0x162ad2){_0x1739a8[_0xf946('0x66')]=_0x162ad2;return _0x1739a8;});}})[_0xf946('0x12')](respondWithFilteredResult(_0x4d0e12,_0x1fa156))['catch'](handleError(_0x4d0e12,null));};exports[_0xf946('0x126')]=function(_0x410900,_0x356976){return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x410900[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x356976,null))[_0xf946('0x12')](function(_0x354275){if(_0x354275){return _0x354275['addAgents'](_0x410900[_0xf946('0x6c')][_0xf946('0x78')],_[_0xf946('0xf3')](_0x410900[_0xf946('0x6c')],[_0xf946('0x78'),'id'])||{})[_0xf946('0xb0')](function(_0x5d5f0e){for(var _0x42234e=0x0;_0x42234e<_0x410900[_0xf946('0x6c')][_0xf946('0x78')][_0xf946('0x5a')];_0x42234e+=0x1){socket[_0xf946('0x127')](_0xf946('0x128'),{'UserId':Number(_0x410900[_0xf946('0x6c')][_0xf946('0x78')][_0x42234e]),'ChatWebsiteId':Number(_0x410900[_0xf946('0x72')]['id'])});}return _0x5d5f0e;});}})[_0xf946('0x12')](respondWithResult(_0x356976,null))[_0xf946('0x1d')](handleError(_0x356976,null));};exports[_0xf946('0x129')]=function(_0x51cb65,_0x467cdd){return db[_0xf946('0x50')][_0xf946('0x6a')]({'where':{'id':_0x51cb65[_0xf946('0x72')]['id']}})['then'](handleEntityNotFound(_0x467cdd,null))[_0xf946('0x12')](function(_0x3680fa){if(_0x3680fa){return _0x3680fa[_0xf946('0x129')](_0x51cb65['query']['ids'])[_0xf946('0x12')](function(){if(_[_0xf946('0x12a')](_0x51cb65[_0xf946('0x57')][_0xf946('0x78')])){for(var _0x59306f=0x0;_0x59306f<_0x51cb65['query']['ids'][_0xf946('0x5a')];_0x59306f+=0x1){socket[_0xf946('0x127')](_0xf946('0x12b'),{'UserId':Number(_0x51cb65[_0xf946('0x57')][_0xf946('0x78')][_0x59306f]),'ChatWebsiteId':Number(_0x51cb65[_0xf946('0x72')]['id'])});}}else{socket[_0xf946('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x51cb65[_0xf946('0x57')][_0xf946('0x78')]),'ChatWebsiteId':Number(_0x51cb65[_0xf946('0x72')]['id'])});}});}})[_0xf946('0x12')](respondWithStatusCode(_0x467cdd,null))[_0xf946('0x1d')](handleError(_0x467cdd,null));};exports['getAgents']=function(_0x2360ea,_0x1d92c3){var _0x411124={};var _0x4efd41={};var _0x4d00a5;var _0x79c392;return db[_0xf946('0x50')][_0xf946('0xe1')]({'where':{'id':_0x2360ea[_0xf946('0x72')]['id']}})[_0xf946('0x12')](handleEntityNotFound(_0x1d92c3,null))[_0xf946('0x12')](function(_0x42a61f){if(_0x42a61f){_0x4d00a5=_0x42a61f;_0x4efd41[_0xf946('0x4b')]=_[_0xf946('0x54')](db['User'][_0xf946('0x51')]);_0x4efd41[_0xf946('0x57')]=_['keys'](_0x2360ea[_0xf946('0x57')]);_0x4efd41[_0xf946('0x55')]=_[_0xf946('0x56')](_0x4efd41['model'],_0x4efd41[_0xf946('0x57')]);_0x411124[_0xf946('0x58')]=_[_0xf946('0x56')](_0x4efd41[_0xf946('0x4b')],qs[_0xf946('0x59')](_0x2360ea[_0xf946('0x57')][_0xf946('0x59')]));_0x411124[_0xf946('0x58')]=_0x411124[_0xf946('0x58')][_0xf946('0x5a')]?_0x411124['attributes']:_0x4efd41['model'];_0x411124[_0xf946('0x5d')]=qs[_0xf946('0x5e')](_0x2360ea[_0xf946('0x57')]['sort']);_0x411124['where']=qs[_0xf946('0x55')](_[_0xf946('0x60')](_0x2360ea[_0xf946('0x57')],_0x4efd41[_0xf946('0x55')]));if(_0x2360ea[_0xf946('0x57')][_0xf946('0x61')]){_0x411124['where']=_[_0xf946('0x68')](_0x411124['where'],{'$or':_[_0xf946('0x4f')](_0x411124[_0xf946('0x58')],function(_0x543c5d){var _0xb7b34d={};_0xb7b34d[_0x543c5d]={'$like':'%'+_0x2360ea[_0xf946('0x57')][_0xf946('0x61')]+'%'};return _0xb7b34d;})});}_0x411124=_[_0xf946('0x68')]({},_0x411124,_0x2360ea[_0xf946('0x69')]);return _0x4d00a5[_0xf946('0x12c')](_0x411124);}})[_0xf946('0x12')](function(_0x1fb179){if(_0x1fb179){_0x79c392=_0x1fb179[_0xf946('0x5a')];if(!_0x2360ea[_0xf946('0x57')][_0xf946('0x5b')]('nolimit')){_0x411124[_0xf946('0x22')]=qs[_0xf946('0x22')](_0x2360ea[_0xf946('0x57')][_0xf946('0x22')]);_0x411124[_0xf946('0x24')]=qs['offset'](_0x2360ea[_0xf946('0x57')][_0xf946('0x24')]);}return _0x4d00a5['getAgents'](_0x411124);}})[_0xf946('0x12')](function(_0x28c21a){if(_0x28c21a){return _0x28c21a?{'count':_0x79c392,'rows':_0x28c21a}:null;}})[_0xf946('0x12')](respondWithResult(_0x1d92c3,null))[_0xf946('0x1d')](handleError(_0x1d92c3,null));}; \ No newline at end of file +var _0x97a8=['ids','addLogo','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','asc','Contacts','headers','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','lastName','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','basename','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Smtp','user','offlineMessageSubject','subjectOffline','toPairsIn','email','MailAccountId','NotifyMailAccount','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','labelText','textButtonColor','color_button','backgroundColor','IntervalId','sequelize','Transaction','findAndCountAll','priority','json','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','mustache','util','ejs','fs-extra','querystring','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','redis','defaults','localhost','./chatWebsite.socket','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','offset','limit','count','status','set','then','destroy','ChatWebsites','stack','name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','map','Interval','Intervals','get','all','some','user-agent-parser','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','browser','version','%s\x20%s','unknown','device','vendor','type','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','Pause','includeAll','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','length','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers'];(function(_0x6beff7,_0x5432ed){var _0x2489fd=function(_0x595ee8){while(--_0x595ee8){_0x6beff7['push'](_0x6beff7['shift']());}};_0x2489fd(++_0x5432ed);}(_0x97a8,0x1df));var _0x897a=function(_0x36b9a6,_0x264956){_0x36b9a6=_0x36b9a6-0x0;var _0x3177a9=_0x97a8[_0x36b9a6];return _0x3177a9;};'use strict';var Mustache=require(_0x897a('0x0'));var util=require(_0x897a('0x1'));var path=require('path');var ejs=require(_0x897a('0x2'));var fs=require('fs');var fs_extra=require(_0x897a('0x3'));var _=require('lodash');var querystring=require(_0x897a('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0x897a('0x5'));var jayson=require(_0x897a('0x6'));var url=require(_0x897a('0x7'));var qs=require(_0x897a('0x8'));var logger=require(_0x897a('0x9'))('api');var config=require(_0x897a('0xa'));var APIOutOfIntervalError=require(_0x897a('0xb'))[_0x897a('0xc')];var APINotFoundError=require(_0x897a('0xb'))[_0x897a('0xd')];var APIHandleError=require(_0x897a('0xb'))[_0x897a('0xe')];var db=require('../../mysqldb')['db'];config[_0x897a('0xf')]=_[_0x897a('0x10')](config['redis'],{'host':_0x897a('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x897a('0xf')]));require(_0x897a('0x12'))['register'](socket);var client=jayson[_0x897a('0x13')][_0x897a('0x14')]({'port':0x232c});var client9002=jayson[_0x897a('0x13')][_0x897a('0x14')]({'port':0x232a});var client9003=jayson['client'][_0x897a('0x14')]({'port':0x232b});var client9001=jayson[_0x897a('0x13')][_0x897a('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x29f282,_0x449ea2,_0x2d9b60,_0x48f7cf){return new Promise(function(_0x23018e,_0x1eeb2a){var _0x148b08=_0x48f7cf||client;return _0x148b08['request'](_0x29f282,_0x2d9b60)['then'](function(_0x35dd46){logger[_0x897a('0x15')](_0x897a('0x16'),_0x449ea2,_0x897a('0x17'));logger['debug'](_0x897a('0x18'),_0x449ea2,_0x897a('0x17'),JSON[_0x897a('0x19')](_0x35dd46));if(_0x35dd46[_0x897a('0x1a')]){if(_0x35dd46[_0x897a('0x1a')][_0x897a('0x1b')]===0x1f4){logger['error'](_0x897a('0x16'),_0x449ea2,_0x35dd46[_0x897a('0x1a')][_0x897a('0x1c')]);return _0x1eeb2a(_0x35dd46[_0x897a('0x1a')]['message']);}logger[_0x897a('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x449ea2,_0x35dd46[_0x897a('0x1a')][_0x897a('0x1c')]);return _0x23018e(_0x35dd46[_0x897a('0x1a')][_0x897a('0x1c')]);}else{logger[_0x897a('0x15')](_0x897a('0x16'),_0x449ea2,_0x897a('0x17'));_0x23018e(_0x35dd46['result'][_0x897a('0x1c')]);}})[_0x897a('0x1d')](function(_0x3de768){logger[_0x897a('0x1a')](_0x897a('0x16'),_0x449ea2,_0x3de768);_0x1eeb2a(_0x3de768);});});}function respondWithStatusCode(_0x3a60f2,_0x1ea766){_0x1ea766=_0x1ea766||0xcc;return function(_0x17f449){if(_0x17f449){return _0x3a60f2[_0x897a('0x1e')](_0x1ea766);}return _0x3a60f2['status'](_0x1ea766)[_0x897a('0x1f')]();};}function respondWithResult(_0x444f80,_0x557281){_0x557281=_0x557281||0xc8;return function(_0x4be4ff){if(_0x4be4ff){return _0x444f80['status'](_0x557281)['json'](_0x4be4ff);}};}function respondWithFilteredResult(_0xc9d7b6,_0x4e5b43){return function(_0x5d8673){if(_0x5d8673){var _0x302cb8=typeof _0x4e5b43[_0x897a('0x20')]==='undefined'&&typeof _0x4e5b43[_0x897a('0x21')]==='undefined';var _0x254ed3=_0x5d8673[_0x897a('0x22')];var _0x32704a=_0x302cb8?0x0:_0x4e5b43[_0x897a('0x20')];var _0x4d65e9=_0x302cb8?_0x5d8673[_0x897a('0x22')]:_0x4e5b43[_0x897a('0x20')]+_0x4e5b43[_0x897a('0x21')];var _0x310540;if(_0x4d65e9>=_0x254ed3){_0x4d65e9=_0x254ed3;_0x310540=0xc8;}else{_0x310540=0xce;}_0xc9d7b6[_0x897a('0x23')](_0x310540);return _0xc9d7b6[_0x897a('0x24')]('Content-Range',_0x32704a+'-'+_0x4d65e9+'/'+_0x254ed3)['json'](_0x5d8673);}return null;};}function saveUpdates(_0x355b12){return function(_0x4d4282){if(_0x4d4282){return _0x4d4282['update'](_0x355b12)[_0x897a('0x25')](function(_0x2c7ec9){return _0x2c7ec9;});}return null;};}function removeEntity(_0x300346){return function(_0x2cc06e){if(_0x2cc06e){return _0x2cc06e[_0x897a('0x26')]()[_0x897a('0x25')](function(){var _0x46de45=_0x2cc06e['get']({'plain':!![]});var _0x4e61e7=_0x897a('0x27');return db['UserProfileResource'][_0x897a('0x26')]({'where':{'type':_0x4e61e7,'resourceId':_0x46de45['id']}})['then'](function(){return _0x2cc06e;});})[_0x897a('0x25')](function(){_0x300346[_0x897a('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x236290){return function(_0x23b201){if(!_0x23b201){_0x236290[_0x897a('0x1e')](0x194);}return _0x23b201;};}function handleError(_0x18f61d,_0x771280){_0x771280=_0x771280||0x1f4;return function(_0x52de93){logger[_0x897a('0x1a')](_0x52de93[_0x897a('0x28')]);if(_0x52de93[_0x897a('0x29')]){delete _0x52de93[_0x897a('0x29')];}_0x18f61d[_0x897a('0x23')](_0x771280)[_0x897a('0x2a')](_0x52de93);};}function iftimePromise(_0x2ce145,_0x17b4b7){return respondWithRpcPromise(_0x897a('0x2b'),_0x897a('0x2c'),{'command':_0x17b4b7[_0x897a('0x2d')]?util[_0x897a('0x2e')](_0x897a('0x2f'),_0x2ce145[_0x897a('0x30')],_0x17b4b7[_0x897a('0x2d')]):util[_0x897a('0x2e')](_0x897a('0x31'),_0x2ce145[_0x897a('0x30')])},client9002)[_0x897a('0x25')](function(_0x246791){var _0x5a608d=_0x246791&&_0x246791[_0x897a('0x32')]('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x17b4b7['id'],_0x2ce145['id'],_0x2ce145[_0x897a('0x30')],_0x5a608d?_0x897a('0x33'):'OFFLINE',_0x17b4b7[_0x897a('0x2d')]?_0x17b4b7[_0x897a('0x2d')]:_0x897a('0x34'));return _0x5a608d;})['catch'](function(_0xfa3444){logger['error'](_0x897a('0x35'),_0x17b4b7['id'],_0x2ce145['id'],_0x2ce145[_0x897a('0x30')],util[_0x897a('0x36')](_0xfa3444,{'showHidden':![],'depth':null}),_0x17b4b7[_0x897a('0x2d')]?_0x17b4b7['timezone']:_0x897a('0x34'));return![];});}function checkWebsiteIntervals(_0x227157){var _0x20b668=_[_0x897a('0x37')](_0x227157[_0x897a('0x38')][_0x897a('0x39')],function(_0x3f24a7){var _0x17ff7f=_0x3f24a7[_0x897a('0x3a')]({'plain':!![]});return iftimePromise(_0x17ff7f,_0x227157);});return Promise[_0x897a('0x3b')](_0x20b668)[_0x897a('0x25')](function(_0x38052c){return _[_0x897a('0x3c')](_0x38052c);});}function createInteractionObject(_0x2143a4,_0x55425a,_0x84a770,_0x2f448c){var _0x40e8ca=require(_0x897a('0x3d'));var _0x33688c=new _0x40e8ca();var _0x46b652=_0x33688c['setUA'](_0x84a770[_0x897a('0x3e')])[_0x897a('0x3f')]();var _0x14ebc6=_0x55425a['customerIp'];if(_0x84a770['cf-connecting-ip']){_0x14ebc6=_0x84a770[_0x897a('0x40')];}else if(_0x84a770[_0x897a('0x41')]){_0x14ebc6=_[_0x897a('0x42')](_0x84a770[_0x897a('0x41')][_0x897a('0x43')](','));}return{'ContactId':_0x2f448c['id'],'ChatWebsiteId':_0x2143a4,'from':(_0x2f448c[_0x897a('0x44')]||'')+'\x20'+(_0x2f448c['lastName']||''),'customerIp':_0x14ebc6,'customerPort':_0x84a770[_0x897a('0x45')]?_0x84a770[_0x897a('0x45')]:null,'referer':_0x55425a['referer'],'browserName':_0x46b652[_0x897a('0x46')][_0x897a('0x29')]&&_0x46b652[_0x897a('0x46')][_0x897a('0x47')]?util[_0x897a('0x2e')](_0x897a('0x48'),_0x46b652['browser'][_0x897a('0x29')],_0x46b652[_0x897a('0x46')][_0x897a('0x47')]):_0x897a('0x49'),'browserVersion':_0x46b652[_0x897a('0x46')]['version']||'unknown','osName':util[_0x897a('0x2e')]('%s\x20%s',_0x46b652['os'][_0x897a('0x29')],_0x46b652['os'][_0x897a('0x47')]),'osVersion':_0x46b652['os'][_0x897a('0x47')],'deviceModel':_0x46b652['device']['model']&&_0x46b652[_0x897a('0x4a')][_0x897a('0x4b')]?util[_0x897a('0x2e')]('%s\x20%s\x20%s',_0x46b652[_0x897a('0x4a')]['model'],_0x46b652[_0x897a('0x4a')][_0x897a('0x4b')],_0x46b652[_0x897a('0x4a')][_0x897a('0x4c')]):null,'deviceVendor':_0x46b652[_0x897a('0x4a')][_0x897a('0x4b')],'deviceType':_0x46b652['device'][_0x897a('0x4c')],'formData':JSON[_0x897a('0x19')](_0x55425a)};}exports[_0x897a('0x4d')]=function(_0x54d134,_0x1c123b){var _0x2af123={'include':[{'model':db['Pause'],'as':_0x897a('0x4e')}]},_0x254cc0={},_0x57f20f={'count':0x0,'rows':[]};var _0x3fb463=_[_0x897a('0x37')](db[_0x897a('0x4f')][_0x897a('0x50')],function(_0x3c3932){return{'name':_0x3c3932[_0x897a('0x51')],'type':_0x3c3932[_0x897a('0x4c')]['key']};});_0x254cc0['model']=_[_0x897a('0x37')](_0x3fb463,_0x897a('0x29'));_0x254cc0[_0x897a('0x52')]=_[_0x897a('0x53')](_0x54d134[_0x897a('0x52')]);_0x254cc0[_0x897a('0x54')]=_[_0x897a('0x55')](_0x254cc0['model'],_0x254cc0[_0x897a('0x52')]);_0x2af123[_0x897a('0x56')]=_[_0x897a('0x55')](_0x254cc0[_0x897a('0x57')],qs[_0x897a('0x58')](_0x54d134[_0x897a('0x52')][_0x897a('0x58')]));_0x2af123[_0x897a('0x56')]=_0x2af123[_0x897a('0x56')]['length']?_0x2af123[_0x897a('0x56')]:_0x254cc0[_0x897a('0x57')];if(!_0x54d134[_0x897a('0x52')][_0x897a('0x59')](_0x897a('0x5a'))){_0x2af123['limit']=qs['limit'](_0x54d134['query'][_0x897a('0x21')]);_0x2af123[_0x897a('0x20')]=qs[_0x897a('0x20')](_0x54d134[_0x897a('0x52')]['offset']);}_0x2af123[_0x897a('0x5b')]=qs[_0x897a('0x5c')](_0x54d134['query'][_0x897a('0x5c')]);_0x2af123[_0x897a('0x5d')]=qs['filters'](_[_0x897a('0x5e')](_0x54d134['query'],_0x254cc0[_0x897a('0x54')]),_0x3fb463);if(_0x54d134[_0x897a('0x52')]['filter']){_0x2af123[_0x897a('0x5d')]=_[_0x897a('0x5f')](_0x2af123[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x3fb463,function(_0x5f5a2f){if(_0x5f5a2f[_0x897a('0x4c')]!==_0x897a('0x60')){var _0x557a46={};_0x557a46[_0x5f5a2f['name']]={'$like':'%'+_0x54d134['query'][_0x897a('0x61')]+'%'};return _0x557a46;}})});}_0x2af123=_[_0x897a('0x5f')]({},_0x2af123,_0x54d134[_0x897a('0x62')]);var _0x29c33c={'where':_0x2af123[_0x897a('0x5d')]};return db[_0x897a('0x4f')]['count'](_0x29c33c)[_0x897a('0x25')](function(_0x2d200f){_0x57f20f[_0x897a('0x22')]=_0x2d200f;if(_0x54d134[_0x897a('0x52')]['includeAll']){_0x2af123['include']=[{'all':!![]}];}return db[_0x897a('0x4f')][_0x897a('0x63')](_0x2af123);})[_0x897a('0x25')](function(_0x523bf7){_0x57f20f[_0x897a('0x64')]=_0x523bf7;return _0x57f20f;})['then'](respondWithFilteredResult(_0x1c123b,_0x2af123))[_0x897a('0x1d')](handleError(_0x1c123b,null));};exports[_0x897a('0x65')]=function(_0x531aaf,_0x5a659c){var _0x26a329={'raw':![],'where':{'id':_0x531aaf['params']['id']},'include':[{'model':db[_0x897a('0x66')],'as':_0x897a('0x4e')}]},_0x42e7b2={};_0x42e7b2['model']=_[_0x897a('0x53')](db['ChatWebsite'][_0x897a('0x50')]);_0x42e7b2[_0x897a('0x52')]=_[_0x897a('0x53')](_0x531aaf[_0x897a('0x52')]);_0x42e7b2[_0x897a('0x54')]=_[_0x897a('0x55')](_0x42e7b2[_0x897a('0x57')],_0x42e7b2[_0x897a('0x52')]);_0x26a329[_0x897a('0x56')]=_[_0x897a('0x55')](_0x42e7b2['model'],qs['fields'](_0x531aaf[_0x897a('0x52')][_0x897a('0x58')]));_0x26a329['attributes']=_0x26a329[_0x897a('0x56')]['length']?_0x26a329[_0x897a('0x56')]:_0x42e7b2['model'];if(_0x531aaf[_0x897a('0x52')][_0x897a('0x67')]){_0x26a329[_0x897a('0x68')]=[{'all':!![]}];}_0x26a329=_['merge']({},_0x26a329,_0x531aaf[_0x897a('0x62')]);return db[_0x897a('0x4f')]['find'](_0x26a329)[_0x897a('0x25')](handleEntityNotFound(_0x5a659c,null))[_0x897a('0x25')](respondWithResult(_0x5a659c,null))[_0x897a('0x1d')](handleError(_0x5a659c,null));};exports[_0x897a('0x69')]=function(_0x507fc2,_0x5a11f5){return db[_0x897a('0x4f')][_0x897a('0x69')](_0x507fc2[_0x897a('0x6a')],{})[_0x897a('0x25')](function(_0x543a0a){var _0x265a31=_0x507fc2['user'][_0x897a('0x3a')]({'plain':!![]});if(!_0x265a31)throw new Error(_0x897a('0x6b'));if(_0x265a31[_0x897a('0x6c')]==='user'){var _0x233327=_0x543a0a[_0x897a('0x3a')]({'plain':!![]});var _0x56e7e4='ChatWebsites';return db['UserProfileSection'][_0x897a('0x6d')]({'where':{'name':_0x56e7e4,'userProfileId':_0x265a31[_0x897a('0x6e')]},'raw':!![]})[_0x897a('0x25')](function(_0x5a0134){if(_0x5a0134&&_0x5a0134[_0x897a('0x6f')]===0x0){return db[_0x897a('0x70')][_0x897a('0x69')]({'name':_0x233327[_0x897a('0x29')],'resourceId':_0x233327['id'],'type':_0x5a0134[_0x897a('0x29')],'sectionId':_0x5a0134['id']},{})[_0x897a('0x25')](function(){return _0x543a0a;});}else{return _0x543a0a;}})[_0x897a('0x1d')](function(_0x32e98e){logger[_0x897a('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32e98e);throw _0x32e98e;});}return _0x543a0a;})[_0x897a('0x25')](respondWithResult(_0x5a11f5,0xc9))['catch'](handleError(_0x5a11f5,null));};exports[_0x897a('0x71')]=function(_0x191036,_0x3eef87){if(_0x191036[_0x897a('0x6a')]['id']){delete _0x191036[_0x897a('0x6a')]['id'];}return db['ChatWebsite'][_0x897a('0x6d')]({'where':{'id':_0x191036['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3eef87,null))['then'](saveUpdates(_0x191036[_0x897a('0x6a')],null))['then'](respondWithResult(_0x3eef87,null))[_0x897a('0x1d')](handleError(_0x3eef87,null));};exports[_0x897a('0x26')]=function(_0xd1dc19,_0x1c5a11){return db['ChatWebsite'][_0x897a('0x6d')]({'where':{'id':_0xd1dc19[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x1c5a11,null))[_0x897a('0x25')](removeEntity(_0x1c5a11,null))[_0x897a('0x1d')](handleError(_0x1c5a11,null));};exports[_0x897a('0x73')]=function(_0x2ce11c,_0x38f70e){return db[_0x897a('0x4f')][_0x897a('0x73')]()[_0x897a('0x25')](respondWithResult(_0x38f70e,null))[_0x897a('0x1d')](handleError(_0x38f70e,null));};exports[_0x897a('0x74')]=function(_0x19e9d7,_0x2ede0a){if(_0x19e9d7[_0x897a('0x6a')]['id']){delete _0x19e9d7[_0x897a('0x6a')]['id'];}return db[_0x897a('0x4f')]['find']({'where':{'id':_0x19e9d7[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x2ede0a,null))[_0x897a('0x25')](function(_0x3e46b9){if(_0x3e46b9){_0x19e9d7[_0x897a('0x6a')][_0x897a('0x75')]=_0x3e46b9['id'];return db[_0x897a('0x76')][_0x897a('0x69')](_0x19e9d7[_0x897a('0x6a')]);}})[_0x897a('0x25')](respondWithResult(_0x2ede0a,null))['catch'](handleError(_0x2ede0a,null));};exports[_0x897a('0x77')]=function(_0x30d54a,_0x8514ea){var _0x2da941={'raw':![],'where':{}};var _0x2ddfb7={};var _0x180616={'count':0x0,'rows':[]};return db[_0x897a('0x4f')][_0x897a('0x78')]({'where':{'id':_0x30d54a[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x8514ea,null))[_0x897a('0x25')](function(_0x32497a){if(_0x32497a){_0x2ddfb7[_0x897a('0x57')]=_[_0x897a('0x53')](db['Disposition']['rawAttributes']);_0x2ddfb7[_0x897a('0x52')]=_['keys'](_0x30d54a[_0x897a('0x52')]);_0x2ddfb7[_0x897a('0x54')]=_['intersection'](_0x2ddfb7[_0x897a('0x57')],_0x2ddfb7['query']);_0x2da941[_0x897a('0x56')]=_[_0x897a('0x55')](_0x2ddfb7[_0x897a('0x57')],qs[_0x897a('0x58')](_0x30d54a[_0x897a('0x52')][_0x897a('0x58')]));_0x2da941[_0x897a('0x56')]=_0x2da941[_0x897a('0x56')][_0x897a('0x79')]?_0x2da941['attributes']:_0x2ddfb7[_0x897a('0x57')];if(!_0x30d54a[_0x897a('0x52')]['hasOwnProperty'](_0x897a('0x5a'))){_0x2da941['limit']=qs[_0x897a('0x21')](_0x30d54a['query'][_0x897a('0x21')]);_0x2da941[_0x897a('0x20')]=qs['offset'](_0x30d54a['query'][_0x897a('0x20')]);}_0x2da941[_0x897a('0x5b')]=qs['sort'](_0x30d54a[_0x897a('0x52')][_0x897a('0x5c')]);_0x2da941['where']=qs[_0x897a('0x54')](_[_0x897a('0x5e')](_0x30d54a[_0x897a('0x52')],_0x2ddfb7['filters']));_0x2da941[_0x897a('0x5d')][_0x897a('0x75')]=_0x32497a['id'];if(_0x30d54a['query'][_0x897a('0x61')]){_0x2da941[_0x897a('0x5d')]=_['merge'](_0x2da941[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x2da941['attributes'],function(_0x4848ab){var _0x5f1d6a={};_0x5f1d6a[_0x4848ab]={'$like':'%'+_0x30d54a[_0x897a('0x52')][_0x897a('0x61')]+'%'};return _0x5f1d6a;})});}_0x2da941=_[_0x897a('0x5f')]({},_0x2da941,_0x30d54a['options']);return db['Disposition']['count']({'where':_0x2da941[_0x897a('0x5d')]})[_0x897a('0x25')](function(_0x116478){_0x180616[_0x897a('0x22')]=_0x116478;if(_0x30d54a[_0x897a('0x52')]['includeAll']){_0x2da941[_0x897a('0x68')]=[{'all':!![]}];}return db[_0x897a('0x76')][_0x897a('0x63')](_0x2da941);})[_0x897a('0x25')](function(_0x494804){_0x180616[_0x897a('0x64')]=_0x494804;return _0x180616;});}})[_0x897a('0x25')](respondWithFilteredResult(_0x8514ea,_0x2da941))[_0x897a('0x1d')](handleError(_0x8514ea,null));};exports[_0x897a('0x7a')]=function(_0x57d168,_0x529aca){return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x57d168[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x529aca,null))[_0x897a('0x25')](function(_0x4c6e34){if(_0x4c6e34){return _0x4c6e34[_0x897a('0x7a')](_0x57d168[_0x897a('0x52')]['ids']);}})[_0x897a('0x25')](respondWithStatusCode(_0x529aca,null))[_0x897a('0x1d')](handleError(_0x529aca,null));};exports[_0x897a('0x7b')]=function(_0x3eb9f3,_0x2942cf){if(_0x3eb9f3[_0x897a('0x6a')]['id']){delete _0x3eb9f3[_0x897a('0x6a')]['id'];}return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x3eb9f3['params']['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x2942cf,null))['then'](function(_0x504380){if(_0x504380){_0x3eb9f3[_0x897a('0x6a')][_0x897a('0x75')]=_0x504380['id'];return db[_0x897a('0x7c')][_0x897a('0x69')](_0x3eb9f3['body']);}})[_0x897a('0x25')](respondWithResult(_0x2942cf,null))[_0x897a('0x1d')](handleError(_0x2942cf,null));};exports[_0x897a('0x7d')]=function(_0x3ee4c9,_0x317d2c){var _0x2741b7={'raw':![],'where':{}};var _0xd0bffc={};var _0x26e797={'count':0x0,'rows':[]};return db[_0x897a('0x4f')][_0x897a('0x78')]({'where':{'id':_0x3ee4c9[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x317d2c,null))[_0x897a('0x25')](function(_0x42c6e1){if(_0x42c6e1){_0xd0bffc[_0x897a('0x57')]=_[_0x897a('0x53')](db[_0x897a('0x7c')][_0x897a('0x50')]);_0xd0bffc['query']=_[_0x897a('0x53')](_0x3ee4c9['query']);_0xd0bffc['filters']=_[_0x897a('0x55')](_0xd0bffc[_0x897a('0x57')],_0xd0bffc[_0x897a('0x52')]);_0x2741b7[_0x897a('0x56')]=_[_0x897a('0x55')](_0xd0bffc['model'],qs[_0x897a('0x58')](_0x3ee4c9[_0x897a('0x52')]['fields']));_0x2741b7[_0x897a('0x56')]=_0x2741b7[_0x897a('0x56')][_0x897a('0x79')]?_0x2741b7['attributes']:_0xd0bffc[_0x897a('0x57')];if(!_0x3ee4c9[_0x897a('0x52')][_0x897a('0x59')](_0x897a('0x5a'))){_0x2741b7['limit']=qs['limit'](_0x3ee4c9['query'][_0x897a('0x21')]);_0x2741b7['offset']=qs[_0x897a('0x20')](_0x3ee4c9[_0x897a('0x52')][_0x897a('0x20')]);}_0x2741b7[_0x897a('0x5b')]=qs[_0x897a('0x5c')](_0x3ee4c9[_0x897a('0x52')][_0x897a('0x5c')]);_0x2741b7[_0x897a('0x5d')]=qs[_0x897a('0x54')](_[_0x897a('0x5e')](_0x3ee4c9['query'],_0xd0bffc[_0x897a('0x54')]));_0x2741b7['where'][_0x897a('0x75')]=_0x42c6e1['id'];if(_0x3ee4c9['query'][_0x897a('0x61')]){_0x2741b7[_0x897a('0x5d')]=_[_0x897a('0x5f')](_0x2741b7[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x2741b7[_0x897a('0x56')],function(_0x3e82f0){var _0x356340={};_0x356340[_0x3e82f0]={'$like':'%'+_0x3ee4c9[_0x897a('0x52')][_0x897a('0x61')]+'%'};return _0x356340;})});}_0x2741b7=_['merge']({},_0x2741b7,_0x3ee4c9['options']);return db[_0x897a('0x7c')][_0x897a('0x22')]({'where':_0x2741b7['where']})[_0x897a('0x25')](function(_0x529d22){_0x26e797[_0x897a('0x22')]=_0x529d22;if(_0x3ee4c9['query'][_0x897a('0x67')]){_0x2741b7[_0x897a('0x68')]=[{'all':!![]}];}return db[_0x897a('0x7c')][_0x897a('0x63')](_0x2741b7);})[_0x897a('0x25')](function(_0x5ee43a){_0x26e797[_0x897a('0x64')]=_0x5ee43a;return _0x26e797;});}})[_0x897a('0x25')](respondWithFilteredResult(_0x317d2c,_0x2741b7))[_0x897a('0x1d')](handleError(_0x317d2c,null));};exports[_0x897a('0x7e')]=function(_0x1e3bee,_0x5cc65d){return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x1e3bee[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x5cc65d,null))[_0x897a('0x25')](function(_0x1acbf4){if(_0x1acbf4){return _0x1acbf4[_0x897a('0x7e')](_0x1e3bee[_0x897a('0x52')][_0x897a('0x7f')]);}})['then'](respondWithStatusCode(_0x5cc65d,null))['catch'](handleError(_0x5cc65d,null));};exports[_0x897a('0x80')]=function(_0x1a2f9c,_0x214f7d){_0x1a2f9c[_0x897a('0x6a')]['sitepic']=_0x1a2f9c['file'][_0x897a('0x81')];return db[_0x897a('0x4f')]['find']({'where':{'id':_0x1a2f9c[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x214f7d,null))[_0x897a('0x25')](saveUpdates(_0x1a2f9c[_0x897a('0x6a')],null))[_0x897a('0x25')](respondWithResult(_0x214f7d,null))[_0x897a('0x1d')](handleError(_0x214f7d,null));};exports['addAvatar']=function(_0x396ffd,_0x191957){_0x396ffd[_0x897a('0x6a')][_0x897a('0x82')]=_0x396ffd[_0x897a('0x83')]['filename'];return db['ChatWebsite'][_0x897a('0x6d')]({'where':{'id':_0x396ffd[_0x897a('0x72')]['id']}})['then'](handleEntityNotFound(_0x191957,null))['then'](saveUpdates(_0x396ffd[_0x897a('0x6a')],null))['then'](respondWithResult(_0x191957,null))[_0x897a('0x1d')](handleError(_0x191957,null));};exports[_0x897a('0x84')]=function(_0xa92936,_0x9634b2){_0xa92936['body'][_0x897a('0x85')]=_0xa92936[_0x897a('0x83')][_0x897a('0x81')];return db[_0x897a('0x4f')]['find']({'where':{'id':_0xa92936[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x9634b2,null))[_0x897a('0x25')](saveUpdates(_0xa92936[_0x897a('0x6a')],null))[_0x897a('0x25')](respondWithResult(_0x9634b2,null))[_0x897a('0x1d')](handleError(_0x9634b2,null));};exports[_0x897a('0x86')]=function(_0x5d0d6c,_0x4c1839){_0x5d0d6c[_0x897a('0x6a')][_0x897a('0x87')]=_0x5d0d6c[_0x897a('0x83')][_0x897a('0x81')];return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x5d0d6c[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x4c1839,null))['then'](saveUpdates(_0x5d0d6c[_0x897a('0x6a')],null))[_0x897a('0x25')](respondWithResult(_0x4c1839,null))[_0x897a('0x1d')](handleError(_0x4c1839,null));};exports[_0x897a('0x88')]=function(_0x1795f2,_0xa91d31){var _0x5ca3fa=path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x8b'));var _0x4dbbbb={'where':{'id':_0x1795f2[_0x897a('0x72')]['id']},'attributes':['id',_0x897a('0x8c')],'raw':!![]};var _0x1d9fde=![];return require(_0x897a('0x8d'))['getLicense']()['then'](function(_0x505856){if(_0x505856){_0x1d9fde=_0x505856[_0x897a('0x8e')];}})[_0x897a('0x25')](function(){return db[_0x897a('0x4f')][_0x897a('0x6d')](_0x4dbbbb);})[_0x897a('0x25')](handleEntityNotFound(_0xa91d31,null))[_0x897a('0x25')](function(_0x202190){if(_0x202190){if(!_[_0x897a('0x8f')](_0x202190[_0x897a('0x8c')])){if(fs['existsSync'](path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x90'),_0x202190[_0x897a('0x8c')]))&&_0x1d9fde){_0x5ca3fa=path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x90'),_0x202190['sitepic']);}}return _0xa91d31[_0x897a('0x91')](_0x5ca3fa);}})[_0x897a('0x1d')](handleError(_0xa91d31,null));};exports[_0x897a('0x92')]=function(_0x44ebfa,_0x4c3981){var _0x393b77=path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x93'));var _0x5a868c={'where':{'id':_0x44ebfa[_0x897a('0x72')]['id']},'attributes':['id',_0x897a('0x82')],'raw':!![]};return db[_0x897a('0x4f')][_0x897a('0x6d')](_0x5a868c)[_0x897a('0x25')](handleEntityNotFound(_0x4c3981,null))[_0x897a('0x25')](function(_0x308ae7){if(_0x308ae7){if(!_[_0x897a('0x8f')](_0x308ae7['agentAvatar'])){if(fs[_0x897a('0x94')](path['join'](config[_0x897a('0x8a')],_0x897a('0x95'),_0x308ae7['agentAvatar']))){_0x393b77=path[_0x897a('0x89')](config['root'],_0x897a('0x95'),_0x308ae7[_0x897a('0x82')]);}}return _0x4c3981[_0x897a('0x91')](_0x393b77);}})[_0x897a('0x1d')](handleError(_0x4c3981,null));};exports[_0x897a('0x96')]=function(_0x57c929,_0x4a6d74){var _0x472489=path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x97'));var _0x534a40={'where':{'id':_0x57c929['params']['id']},'attributes':['id',_0x897a('0x85'),_0x897a('0x98')],'raw':!![]};return db[_0x897a('0x4f')]['find'](_0x534a40)[_0x897a('0x25')](handleEntityNotFound(_0x4a6d74,null))[_0x897a('0x25')](function(_0x231ccd){if(_0x231ccd){if(!_['isNil'](_0x231ccd[_0x897a('0x85')])){if(fs[_0x897a('0x94')](path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x95'),_0x231ccd[_0x897a('0x85')]))&&_0x231ccd['showCustomerAvatar']){_0x472489=path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0x95'),_0x231ccd[_0x897a('0x85')]);}}return _0x4a6d74[_0x897a('0x91')](_0x472489);}})[_0x897a('0x1d')](handleError(_0x4a6d74,null));};exports[_0x897a('0x99')]=function(_0x2821e9,_0x46f122){var _0x3df72e=path['join'](config[_0x897a('0x8a')],_0x897a('0x9a'));var _0xddff2b={'where':{'id':_0x2821e9[_0x897a('0x72')]['id']},'attributes':['id',_0x897a('0x87')],'raw':!![]};return db[_0x897a('0x4f')][_0x897a('0x6d')](_0xddff2b)['then'](handleEntityNotFound(_0x46f122,null))[_0x897a('0x25')](function(_0x563586){if(_0x563586){if(!_[_0x897a('0x8f')](_0x563586[_0x897a('0x87')])){if(fs[_0x897a('0x94')](path['join'](config[_0x897a('0x8a')],_0x897a('0x95'),_0x563586[_0x897a('0x87')]))){_0x3df72e=path[_0x897a('0x89')](config['root'],_0x897a('0x95'),_0x563586[_0x897a('0x87')]);}}return _0x46f122['download'](_0x3df72e);}})[_0x897a('0x1d')](handleError(_0x46f122,null));};exports[_0x897a('0x9b')]=function(_0x2ed71a,_0x5ccf3a){var _0x28371b={'body':_0x2ed71a['body'],'channel':_0x897a('0x9c')};var _0x3027d8=[];var _0xcea4fe=[];var _0x33d1f2={};var _0x1458bc=![];return db[_0x897a('0x9d')][_0x897a('0x73')]()['then'](function(_0x2e4d52){if(!_0x2e4d52){throw new db[(_0x897a('0x9e'))][(_0x897a('0x9f'))](_0x897a('0xa0'));}_0x3027d8=_[_0x897a('0xa1')](_['keys'](_0x2e4d52),[_0x897a('0xa2'),'updatedAt']);_0xcea4fe=_[_0x897a('0xa1')](_[_0x897a('0x53')](_0x2e4d52),[_0x897a('0xa2'),_0x897a('0xa3'),_0x897a('0xa4'),_0x897a('0xa5')]);if(_0x2ed71a[_0x897a('0x6a')]['id']){delete _0x2ed71a[_0x897a('0x6a')]['id'];}if(_[_0x897a('0x8f')](_0x2ed71a['body']['from'])){throw new db[(_0x897a('0x9e'))][(_0x897a('0x9f'))](_0x897a('0xa6'));}if(_[_0x897a('0x8f')](_0x2ed71a[_0x897a('0x6a')][_0x897a('0x6a')])||_0x2ed71a[_0x897a('0x6a')]['body']===''){throw new db[(_0x897a('0x9e'))][(_0x897a('0x9f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x897a('0x8f')](_0x2ed71a[_0x897a('0x6a')]['mapKey'])){throw new db[(_0x897a('0x9e'))]['ValidationError'](_0x897a('0xa7')+_0xcea4fe);}if(!_[_0x897a('0xa8')](_0xcea4fe,_0x2ed71a[_0x897a('0x6a')][_0x897a('0xa9')])){throw new db['Sequelize'][(_0x897a('0x9f'))](_0x897a('0xaa')+_0xcea4fe);}_0x33d1f2[_0x2ed71a['body'][_0x897a('0xa9')]]=_0x2ed71a[_0x897a('0x6a')][_0x897a('0xab')];})['then'](function(){return db[_0x897a('0x4f')]['find']({'where':{'id':_0x2ed71a[_0x897a('0x72')]['id']},'include':[{'model':db[_0x897a('0xac')],'as':_0x897a('0xad'),'include':[{'model':db[_0x897a('0x9d')],'as':'Contacts','where':_0x33d1f2,'limit':0x1,'order':[[_0x897a('0xa3'),_0x897a('0xae')]]}]},{'model':db[_0x897a('0xaf')],'as':_0x897a('0xb0')},{'model':db[_0x897a('0x38')],'as':_0x897a('0x38'),'include':[{'model':db[_0x897a('0x38')],'as':_0x897a('0x39'),'attributes':['id',_0x897a('0x30')],'raw':!![]}]}]});})[_0x897a('0x25')](function(_0x694c0){if(!_0x694c0)throw new APINotFoundError(util['format'](_0x897a('0xb1'),_0x2ed71a[_0x897a('0x72')]['id']));if(!_0x694c0[_0x897a('0x38')]||!_0x694c0[_0x897a('0x38')][_0x897a('0x39')])return[_0x694c0,!![]];return[_0x694c0,checkWebsiteIntervals(_0x694c0)];})[_0x897a('0xb2')](function(_0x5942eb,_0x3f5a9e){if(!_0x3f5a9e)throw new APIOutOfIntervalError();if(!_0x5942eb[_0x897a('0xad')])return;_0x28371b[_0x897a('0xb3')]=_0x5942eb;_0x28371b[_0x897a('0xb4')]=_0x5942eb[_0x897a('0xad')];_0x28371b[_0x897a('0xb5')]=_[_0x897a('0xb6')](_0x5942eb['Applications'],['priority'],[_0x897a('0xb7')]);if(_0x28371b['account']['Applications']){delete _0x28371b[_0x897a('0xb3')][_0x897a('0xb0')];}if(_0x28371b[_0x897a('0xb3')][_0x897a('0xad')]&&_0x28371b[_0x897a('0xb3')]['List'][_0x897a('0xb8')]['length']){return _0x28371b[_0x897a('0xb3')][_0x897a('0xad')][_0x897a('0xb8')][0x0];}var _0x1e6d24=_['defaults'](_0x2ed71a[_0x897a('0x6a')],{'firstName':_0x2ed71a[_0x897a('0x6a')][_0x897a('0xab')],'ListId':_0x5942eb[_0x897a('0xa5')]});_0x1e6d24[_0x2ed71a[_0x897a('0x6a')][_0x897a('0xa9')]]=_0x2ed71a[_0x897a('0x6a')]['from'];return db[_0x897a('0x9d')][_0x897a('0x69')](_0x1e6d24,{'fields':_0x3027d8,'raw':!![]});})[_0x897a('0x25')](function(_0x4d5fb2){_0x28371b['contact']=_0x4d5fb2;var _0x894daf=createInteractionObject(_0x2ed71a['params']['id'],_0x2ed71a['body'],_0x2ed71a[_0x897a('0xb9')],_0x4d5fb2);var _0x32e93e={'ChatWebsiteId':_0x2ed71a[_0x897a('0x72')]['id'],'closed':![]};if(_0x2ed71a[_0x897a('0x6a')][_0x897a('0xba')]){_0x32e93e[_0x897a('0xba')]=_0x2ed71a[_0x897a('0x6a')][_0x897a('0xba')];return db['ChatInteraction'][_0x897a('0x6d')]({'where':_0x32e93e})[_0x897a('0x25')](function(_0x4cb7cc){if(_0x4cb7cc){_0x1458bc=!![];return _0x4cb7cc;}_0x894daf[_0x897a('0xba')]=_0x2ed71a['body']['threadId'];_0x894daf['externalUrl']=_0x2ed71a[_0x897a('0x6a')][_0x897a('0xbb')];return db[_0x897a('0xbc')][_0x897a('0x69')](_0x894daf);});}_0x32e93e[_0x897a('0xbd')]=_0x4d5fb2['id'];if(_0x2ed71a[_0x897a('0x6a')]['interaction']&&_0x2ed71a[_0x897a('0x6a')][_0x897a('0xbe')]['id']){_0x32e93e['id']=_0x2ed71a[_0x897a('0x6a')]['interaction']['id'];return db[_0x897a('0xbc')][_0x897a('0x6d')]({'where':_0x32e93e})[_0x897a('0x25')](function(_0x4170e){if(_0x4170e){_0x1458bc=!![];return _0x4170e;}return db['ChatInteraction'][_0x897a('0x69')](_0x894daf);});}return db['ChatInteraction']['create'](_0x894daf);})[_0x897a('0x25')](function(_0x1806c5){if(!_0x1458bc)return _0x1806c5;var _0x23b91c={'from':(_0x28371b[_0x897a('0xbf')]['firstName']||'')+'\x20'+(_0x28371b[_0x897a('0xbf')][_0x897a('0xc0')]||'')};if(_0x2ed71a[_0x897a('0x6a')]['threadId']&&_0x2ed71a[_0x897a('0x6a')][_0x897a('0xc1')]&&_0x2ed71a[_0x897a('0x6a')][_0x897a('0xba')]!=_0x2ed71a[_0x897a('0x6a')][_0x897a('0xc1')]){_0x23b91c[_0x897a('0xba')]=_0x2ed71a[_0x897a('0x6a')]['messageId'];}return _0x1806c5[_0x897a('0x71')](_0x23b91c);})[_0x897a('0x25')](function(_0x59e966){_0x28371b['interaction']=_0x59e966[_0x897a('0x3a')]({'plain':!![]});_0x28371b['interaction'][_0x897a('0xc2')]=!_0x1458bc;if(_0x28371b['interaction'][_0x897a('0xc2')]){if(_0x28371b[_0x897a('0xb3')][_0x897a('0xc3')]){_0x28371b[_0x897a('0xb5')][_0x897a('0xc4')]({'id':0x0,'priority':_0x28371b[_0x897a('0xb5')]['length']+0x1,'app':_0x897a('0xc5'),'appdata':'unmanaged','interval':_0x897a('0xc6')});}}return db[_0x897a('0xc7')][_0x897a('0x69')]({'body':_0x2ed71a[_0x897a('0x6a')][_0x897a('0x6a')],'ChatWebsiteId':_0x2ed71a[_0x897a('0x72')]['id'],'ChatInteractionId':_0x59e966['id'],'direction':'in','ContactId':_0x28371b[_0x897a('0xbf')]['id'],'AttachmentId':_0x2ed71a[_0x897a('0x6a')][_0x897a('0xc8')]});})['then'](function(_0x2b87b3){_0x28371b[_0x897a('0x1c')]=_0x2b87b3;if(!_0x28371b[_0x897a('0xbe')]['UserId']){return;}return db[_0x897a('0xc9')][_0x897a('0x6d')]({'attributes':['id',_0x897a('0x29')],'where':{'id':_0x28371b[_0x897a('0xbe')][_0x897a('0xca')]}});})[_0x897a('0x25')](function(_0x26149c){if(_0x26149c){_0x28371b[_0x897a('0xb5')][_0x897a('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x26149c[_0x897a('0x29')]+','+(_0x28371b[_0x897a('0xb3')][_0x897a('0xcc')]||0xa),'interval':'*,*,*,*'});_0x28371b['forcedOwnership']=!![];}if(!_0x28371b[_0x897a('0xbe')][_0x897a('0xcd')]){return;}return db[_0x897a('0xce')][_0x897a('0x6d')]({'attributes':['id',_0x897a('0x29')],'where':{'id':_0x28371b[_0x897a('0xbe')][_0x897a('0xcd')]}});})[_0x897a('0x25')](function(_0x361c9a){if(_0x361c9a){_0x28371b[_0x897a('0xb5')][_0x897a('0xcb')]({'id':0x0,'priority':0x1,'app':_0x897a('0xcf'),'appdata':_0x361c9a[_0x897a('0x29')]+','+(_0x28371b[_0x897a('0xb3')][_0x897a('0xd0')]||0x12c),'interval':_0x897a('0xc6')});}return respondWithRpcPromise('Start',_0x897a('0xd1'),_0x28371b);})[_0x897a('0x25')](function(_0x2ed300){respondWithRpcPromise(_0x897a('0xd2'),_0x897a('0xd2'),{'event':_0x897a('0x9b'),'message':_0x2ed300},client9002);return _0x2ed300;})[_0x897a('0x25')](respondWithResult(_0x5ccf3a,null))[_0x897a('0x1d')](APIHandleError(_0x5ccf3a));};exports[_0x897a('0xd3')]=function(_0x1edb47,_0x42d1b5){var _0x227f23,_0x2045ce,_0x2349e3;var _0x5926fd=[];var _0x2ee5d9={};var _0x45e36d=_0x1edb47['files']||[];var _0xa90bc5=[];var _0x260bdb;return db[_0x897a('0x9d')][_0x897a('0x73')]()[_0x897a('0x25')](function(_0x7a6ceb){if(!_0x7a6ceb){throw new db[(_0x897a('0x9e'))][(_0x897a('0x9f'))](_0x897a('0xa0'));}_0x5926fd=_[_0x897a('0xa1')](_[_0x897a('0x53')](_0x7a6ceb),['createdAt',_0x897a('0xa3'),_0x897a('0xa4'),_0x897a('0xa5')]);if(_0x1edb47['body']['id']){delete _0x1edb47[_0x897a('0x6a')]['id'];}if(_[_0x897a('0x8f')](_0x1edb47[_0x897a('0x6a')][_0x897a('0xab')])){throw _0x42d1b5['status'](0x1f4)[_0x897a('0x2a')](new db[(_0x897a('0x9e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x897a('0x8f')](_0x1edb47[_0x897a('0x6a')]['body'])||_0x1edb47[_0x897a('0x6a')][_0x897a('0x6a')]===''){throw _0x42d1b5[_0x897a('0x23')](0x1f4)[_0x897a('0x2a')](new db[(_0x897a('0x9e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x897a('0x8f')](_0x1edb47[_0x897a('0x6a')][_0x897a('0xd4')])){throw _0x42d1b5[_0x897a('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x897a('0x9f'))](_0x897a('0xd5')+_0x5926fd));}if(!_[_0x897a('0xa8')](_0x5926fd,_0x1edb47[_0x897a('0x6a')][_0x897a('0xd4')])){throw _0x42d1b5[_0x897a('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x897a('0x9f'))](_0x897a('0xd6')+_0x5926fd));}_0x2ee5d9[_0x1edb47[_0x897a('0x6a')][_0x897a('0xd4')]]=_0x1edb47[_0x897a('0x6a')][_0x897a('0xab')];})[_0x897a('0x25')](function(){return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x1edb47[_0x897a('0x72')]['id']},'include':[{'model':db[_0x897a('0xac')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x897a('0x25')](handleEntityNotFound(_0x42d1b5,null))[_0x897a('0x25')](function(_0x1ba1cd){if(_0x1ba1cd&&_0x1ba1cd[_0x897a('0xad')]){_0x2045ce=_0x1ba1cd;var _0x6fa20f=_['defaults'](_0x1edb47[_0x897a('0x6a')],{'firstName':_0x1edb47['body'][_0x897a('0xab')],'phone':_0x1edb47[_0x897a('0x6a')][_0x897a('0xab')],'ListId':_0x1ba1cd[_0x897a('0xa5')]});_0x6fa20f[_0x1edb47['body'][_0x897a('0xd4')]]=_0x1edb47[_0x897a('0x6a')][_0x897a('0xab')];return db[_0x897a('0x9d')]['findOrCreate']({'where':_0x2ee5d9,'defaults':_0x6fa20f});}})[_0x897a('0xb2')](function(_0x47d47e){if(_0x47d47e){_0x2349e3=_0x47d47e;var _0x42f80e=fs['readFileSync'](path[_0x897a('0x89')](config[_0x897a('0x8a')],_0x897a('0xd7')),'utf8');var _0x542366=ejs['render'](_0x42f80e,{'body':_[_0x897a('0xd8')](_0x1edb47['body'][_0x897a('0x6a')]),'bodyTitle':_0x2045ce[_0x897a('0xd9')]});return db[_0x897a('0xda')][_0x897a('0x69')]({'body':_0x542366,'plainBody':htmlToText[_0x897a('0xdb')](_0x542366),'ContactId':_0x47d47e['id'],'ChatWebsiteId':_0x2045ce['id']});}})[_0x897a('0x25')](function(_0x4712ca){_0x260bdb=_0x4712ca;if(_0x45e36d['length']){var _0x1233a8=_0x45e36d[_0x897a('0x37')](function(_0x4d6a69){return{'name':_0x4d6a69[_0x897a('0xdc')],'basename':_0x4d6a69[_0x897a('0x81')],'type':_0x4d6a69[_0x897a('0xdd')],'ChatOfflineMessageId':_0x4712ca['id']};});_0xa90bc5=_0x1233a8[_0x897a('0x37')](_0x16c884=>{var _0x30037a={'filename':_0x16c884[_0x897a('0x29')],'path':path['join'](config[_0x897a('0x8a')],_0x897a('0xde'),_0x897a('0xdf'),'attachments','offline-chat',_0x16c884[_0x897a('0xe0')])};return _0x30037a;});if(!_0x2045ce['openNewInteraction']){return db['sequelize'][_0x897a('0xe1')](function(_0x1acf98){return db[_0x897a('0xe2')][_0x897a('0xe3')](_0x1233a8,{'transaction':_0x1acf98});});}}})['then'](function(){if(_0x260bdb){_0x227f23=_0x260bdb;return db[_0x897a('0xe4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x897a('0xe5')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x897a('0xe6')],'as':_0x897a('0xe6'),'raw':!![]}]}]});}})[_0x897a('0x25')](function(_0x1b57f8){if(_0x1b57f8&&_0x1b57f8['Smtp']&&_0x2045ce[_0x897a('0xe7')]&&_0x2045ce[_0x897a('0xe8')]){var _0x412604=_0x1b57f8[_0x897a('0xe9')]();return respondWithRpcPromise('SendMail',_0x897a('0xea'),{'account':_0x412604,'message':{'from':util[_0x897a('0x2e')](_0x897a('0xeb'),_0x1b57f8['name'],_0x1b57f8['email']||_0x1b57f8[_0x897a('0xec')][_0x897a('0xed')]),'to':_0x2045ce[_0x897a('0xe8')],'subject':_0x2045ce[_0x897a('0xee')],'html':_0x227f23['body'],'attachments':_0xa90bc5}},client9003)['then'](function(){return _0x227f23;})[_0x897a('0x1d')](function(_0x3a1083){logger[_0x897a('0x1a')](_0x3a1083);});}})[_0x897a('0x25')](function(){if(_0x2045ce&&_0x2045ce['openNewInteraction']&&_0x2045ce['MailAccountId']){var _0xc1fa2=[];if(_0x45e36d['length']){_0xc1fa2=_0x45e36d[_0x897a('0x37')](function(_0x2640f5){return{'name':_0x2640f5[_0x897a('0xdc')],'basename':_0x2640f5[_0x897a('0x81')],'type':_0x2640f5[_0x897a('0xdd')],'ChatOfflineMessageId':_0x260bdb['id']};});}var _0x4e56a6;if(!_['isNil'](_0x2045ce[_0x897a('0xef')])){var _0xb56f81=_[_0x897a('0x37')](_0x1edb47[_0x897a('0x6a')],function(_0x14a967){return _0x14a967;});var _0x39137a=_[_0x897a('0xf0')](_0xb56f81)[0x0];var _0x9f20fc=_['mapValues'](_0x39137a,function(_0xa473b3){return _0xa473b3;});_0x4e56a6=_0x9f20fc[0x1][_0x2045ce[_0x897a('0xef')]];}var _0x2394c3={'from':_0x2349e3[_0x897a('0xf1')],'firstName':_0x2349e3[_0x897a('0x44')],'lastName':_0x2349e3['lastName'],'mapKey':'email','message':{'from':_0x2349e3[_0x897a('0xf1')],'to':_0x2045ce[_0x897a('0xe4')]['email'],'cc':'','subject':_[_0x897a('0x8f')](_0x4e56a6)?_0x2045ce[_0x897a('0xee')]:_0x4e56a6,'messageId':'','sentAt':new Date(),'attach':_0xc1fa2[_0x897a('0x79')],'attachments':_0xc1fa2,'originChannel':'Chat','ChatWebsiteId':_0x2045ce['id'],'ChatOfflineMessageId':_0x227f23['id'],'originTo':_0x2045ce['MailAccount'][_0x897a('0xf1')]},'body':_0x227f23[_0x897a('0x6a')]};var _0x325ce4={'account':{'id':_0x2045ce[_0x897a('0xf2')]},'body':_0x2394c3,'log':_0x897a('0xf3')};return respondWithRpcPromise(_0x897a('0xf3'),'notifyMail',_0x325ce4,client9001)[_0x897a('0x25')](function(){return _0x227f23;})['catch'](function(_0x2d8023){logger[_0x897a('0x1a')](_0x2d8023);});}return;})[_0x897a('0x25')](function(){if(_0x227f23){return _0x227f23;}})['then'](respondWithResult(_0x42d1b5,null))['catch'](function(){for(var _0x205bdd of _0x45e36d){var _0x41c063=path[_0x897a('0x89')](config['root'],_0x897a('0xde'),_0x897a('0xdf'),_0x897a('0xf4'),'offline-chat',_0x205bdd['filename']);fs_extra[_0x897a('0xf5')](_0x41c063)[_0x897a('0x1d')](function(_0x1a3d52){logger[_0x897a('0x1a')](_0x897a('0xf6'),_0x41c063,_0x1a3d52);});}});};exports[_0x897a('0xf7')]=function(_0x401ea8,_0x2d1a3a){return db[_0x897a('0xbc')][_0x897a('0x6d')]({'where':{'id':_0x401ea8[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x2d1a3a,null))[_0x897a('0x25')](function(_0xa0486e){if(_0xa0486e){return _0xa0486e[_0x897a('0xf7')](_0x401ea8[_0x897a('0x6a')][_0x897a('0x7f')],_[_0x897a('0xf8')](_0x401ea8[_0x897a('0x6a')],['ids','id'])||{});}})[_0x897a('0x25')](respondWithResult(_0x2d1a3a,null))[_0x897a('0x1d')](handleError(_0x2d1a3a,null));};exports[_0x897a('0xf9')]=function(_0x3b5d60,_0x2780d8){var _0x2c76e3={'raw':![],'where':{}};var _0x20e8cc={};var _0x4b93f0={'count':0x0,'rows':[]};return db[_0x897a('0x4f')]['findOne']({'where':{'id':_0x3b5d60[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x2780d8,null))[_0x897a('0x25')](function(_0x3bae7c){if(_0x3bae7c){_0x20e8cc[_0x897a('0x57')]=_[_0x897a('0x53')](db[_0x897a('0xbc')][_0x897a('0x50')]);_0x20e8cc[_0x897a('0x52')]=_['keys'](_0x3b5d60[_0x897a('0x52')]);_0x20e8cc[_0x897a('0x54')]=_[_0x897a('0x55')](_0x20e8cc['model'],_0x20e8cc[_0x897a('0x52')]);_0x2c76e3[_0x897a('0x56')]=_[_0x897a('0x55')](_0x20e8cc['model'],qs[_0x897a('0x58')](_0x3b5d60[_0x897a('0x52')]['fields']));_0x2c76e3[_0x897a('0x56')]=_0x2c76e3[_0x897a('0x56')][_0x897a('0x79')]?_0x2c76e3[_0x897a('0x56')]:_0x20e8cc['model'];if(!_0x3b5d60[_0x897a('0x52')]['hasOwnProperty']('nolimit')){_0x2c76e3[_0x897a('0x21')]=qs[_0x897a('0x21')](_0x3b5d60['query']['limit']);_0x2c76e3[_0x897a('0x20')]=qs[_0x897a('0x20')](_0x3b5d60[_0x897a('0x52')][_0x897a('0x20')]);}_0x2c76e3['order']=qs['sort'](_0x3b5d60['query'][_0x897a('0x5c')]);_0x2c76e3[_0x897a('0x5d')]=qs[_0x897a('0x54')](_['pick'](_0x3b5d60[_0x897a('0x52')],_0x20e8cc[_0x897a('0x54')]));_0x2c76e3['where'][_0x897a('0x75')]=_0x3bae7c['id'];if(_0x3b5d60[_0x897a('0x52')][_0x897a('0x61')]){_0x2c76e3[_0x897a('0x5d')]=_['merge'](_0x2c76e3[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x2c76e3[_0x897a('0x56')],function(_0x128fec){var _0x240fc5={};_0x240fc5[_0x128fec]={'$like':'%'+_0x3b5d60[_0x897a('0x52')][_0x897a('0x61')]+'%'};return _0x240fc5;})});}_0x2c76e3=_['merge']({},_0x2c76e3,_0x3b5d60[_0x897a('0x62')]);return db[_0x897a('0xbc')][_0x897a('0x22')]({'where':_0x2c76e3[_0x897a('0x5d')]})[_0x897a('0x25')](function(_0x4e1dfa){_0x4b93f0[_0x897a('0x22')]=_0x4e1dfa;if(_0x3b5d60['query'][_0x897a('0x67')]){_0x2c76e3[_0x897a('0x68')]=[{'model':db[_0x897a('0x9d')],'as':_0x897a('0xfa'),'required':![]},{'model':db['User'],'as':_0x897a('0xfb'),'attributes':[_0x897a('0x29'),_0x897a('0xfc'),_0x897a('0xfd')],'required':![]},{'model':db[_0x897a('0xfe')],'as':_0x897a('0xff'),'attributes':['id','name',_0x897a('0x100')],'where':_0x3b5d60[_0x897a('0x52')][_0x897a('0x101')]?{'id':_0x3b5d60[_0x897a('0x52')][_0x897a('0x101')]}:undefined,'required':_0x3b5d60[_0x897a('0x52')][_0x897a('0x101')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x2c76e3);})[_0x897a('0x25')](function(_0x4dc7e6){_0x4b93f0[_0x897a('0x64')]=_0x4dc7e6;return _0x4b93f0;});}})[_0x897a('0x25')](respondWithFilteredResult(_0x2780d8,_0x2c76e3))[_0x897a('0x1d')](handleError(_0x2780d8,null));};exports[_0x897a('0x2c')]=function(_0x149a74,_0x408436){var _0x320fea=0x0;var _0x45e907=0x0;var _0xd55688=![];var _0xb303bf;var _0x426c05;return db[_0x897a('0x4f')]['find']({'where':{'id':_0x149a74['params']['id']},'include':[{'model':db[_0x897a('0x38')],'as':_0x897a('0x38'),'include':[{'model':db[_0x897a('0x38')],'as':_0x897a('0x39'),'attributes':['id','interval']}]}]})[_0x897a('0x25')](handleEntityNotFound(_0x408436,null))[_0x897a('0x25')](function(_0x3c7d67){if(_0x3c7d67){_0xb303bf=_0x3c7d67;return _0x3c7d67[_0x897a('0x102')]({'raw':!![]});}})[_0x897a('0x25')](function(_0x461b97){if(_0xb303bf){if(_0x461b97){_0x426c05=_0x461b97;}}return require(_0x897a('0x8d'))[_0x897a('0x103')]();})[_0x897a('0x25')](function(_0x2a8c86){if(_0x2a8c86){_0x45e907=_0x2a8c86[_0x897a('0x104')];_0xd55688=_0x2a8c86[_0x897a('0x8e')];}})[_0x897a('0x25')](function(){return db['ChatInteraction'][_0x897a('0x22')]({'where':{'closed':![]}});})[_0x897a('0x25')](function(_0x3c95b9){_0x320fea=_0x3c95b9;if(_0x45e907&&_0x3c95b9>_0x45e907){return db[_0x897a('0x105')][_0x897a('0x78')]({'where':{'id':0x1}})[_0x897a('0x25')](function(_0x2301fe){if(_0x2301fe){_0x2301fe[_0x897a('0x106')](_0x897a('0x107'));}});}})[_0x897a('0x25')](function(){if(!_0xb303bf[_0x897a('0x38')]||!_0xb303bf[_0x897a('0x38')][_0x897a('0x39')])return!![];return checkWebsiteIntervals(_0xb303bf);})['then'](function(_0x482515){var _0x45801a=fs['readFileSync'](path[_0x897a('0x89')](config['root'],_0x897a('0x108')),_0x897a('0x109'));var _0x29e8ae=new url['URL'](_0xb303bf['address'])[_0x897a('0x10a')];var _0x5bec77=_0x897a('0x10b');var _0x48e439=![];var _0x255071={'chatVersion':_0x5bec77,'chatWebsiteAddressOrigin':_0x29e8ae,'remote':_0xb303bf[_0x897a('0x10c')],'query':querystring[_0x897a('0x19')](_['merge'](_0xb303bf['get']({'plain':!![]}),{'customerIp':_0x149a74[_0x897a('0xb9')]['x-forwarded-for']||_0x149a74['headers'][_0x897a('0x10d')]||_0x149a74[_0x897a('0x10e')][_0x897a('0x10f')]||_0x149a74['ip'],'referer':_0x149a74['headers'][_0x897a('0x110')],'openedInteractions':_0x320fea,'maxInteractions':_0x45e907,'virtual':_0xd55688[_0x897a('0x104')],'online':_0x482515,'custom':_0xd55688}))[_0x897a('0x111')](/'/g,'\x5c\x27')};_0x408436[_0x897a('0x2a')](ejs[_0x897a('0x112')](Mustache[_0x897a('0x112')](_0x45801a,_0x255071),{'proactiveActions':_0x426c05,'alignment':_0xb303bf[_0x897a('0x113')],'verticalAlignment':_0xb303bf['verticalAlignment'],'div_color':_0xb303bf[_0x897a('0x100')],'labelText':_0xb303bf[_0x897a('0x114')],'text_color':_0xb303bf['textColor'],'text_button_color':_0xb303bf[_0x897a('0x115')],'button_color':_0xb303bf[_0x897a('0x116')],'background_color':_0xb303bf[_0x897a('0x117')],'hideWhenOffline':_0xb303bf['hideWhenOffline'],'intervalId':_0xb303bf[_0x897a('0x118')],'isDevelopment':_0x48e439,'chatVersion':_0x5bec77}));})['catch'](handleError(_0x408436,null));};exports['addApplications']=function(_0x594516,_0x1106fd){var _0x471cd3=_0x594516[_0x897a('0x72')]['id'];var _0x2e952a=_0x594516['body'];var _0x4e5a10=0xc8;var _0x1aa08b=null;return db[_0x897a('0x119')]['transaction']({'isolationLevel':db['sequelize'][_0x897a('0x11a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x10b868){return db['ChatWebsite'][_0x897a('0x78')]({'where':{'id':_0x471cd3},'transaction':_0x10b868})['then'](function(_0x52723b){if(_0x52723b){return db[_0x897a('0xaf')][_0x897a('0x26')]({'where':{'ChatWebsiteId':_0x471cd3},'transaction':_0x10b868})['then'](function(){var _0x497abe=_[_0x897a('0x37')](_0x2e952a,function(_0x5e4a6c){_0x5e4a6c[_0x897a('0x75')]=_0x471cd3;return _0x5e4a6c;});return db['ChatApplication'][_0x897a('0xe3')](_0x497abe,{'transaction':_0x10b868});});}else{_0x4e5a10=0x194;_0x1aa08b=[];}});})[_0x897a('0x25')](function(){if(_0x4e5a10!==0x194){return db[_0x897a('0xaf')][_0x897a('0x11b')]({'where':{'ChatWebsiteId':_0x471cd3},'order':_0x897a('0x11c')})['then'](function(_0xaaa310){_0x1aa08b=_0xaaa310;});}})[_0x897a('0x1d')](function(_0x1aa6de){_0x4e5a10=0x1f4;logger[_0x897a('0x1a')](_0x1aa6de['stack']);if(_0x1aa6de[_0x897a('0x29')]){delete _0x1aa6de[_0x897a('0x29')];}_0x1aa08b=_0x1aa6de;})['finally'](function(){if(_0x1aa08b===null){_0x1106fd[_0x897a('0x1e')](_0x4e5a10);}else{if(_0x4e5a10===0x1f4){_0x1106fd[_0x897a('0x23')](_0x4e5a10)['send'](_0x1aa08b);}else{_0x1106fd[_0x897a('0x23')](_0x4e5a10)[_0x897a('0x11d')](_0x1aa08b);}}});};exports[_0x897a('0x11e')]=function(_0x1357ec,_0xf72f13){var _0x1bdfd6={};var _0x2633ba={};var _0x195e1f;var _0x4b1a2a;return db['ChatWebsite']['findOne']({'where':{'id':_0x1357ec['params']['id']}})['then'](handleEntityNotFound(_0xf72f13,null))[_0x897a('0x25')](function(_0x8e4b93){if(_0x8e4b93){_0x195e1f=_0x8e4b93;_0x2633ba[_0x897a('0x57')]=_[_0x897a('0x53')](db[_0x897a('0xaf')][_0x897a('0x50')]);_0x2633ba[_0x897a('0x52')]=_[_0x897a('0x53')](_0x1357ec[_0x897a('0x52')]);_0x2633ba[_0x897a('0x54')]=_[_0x897a('0x55')](_0x2633ba['model'],_0x2633ba[_0x897a('0x52')]);_0x1bdfd6[_0x897a('0x56')]=_['intersection'](_0x2633ba[_0x897a('0x57')],qs[_0x897a('0x58')](_0x1357ec['query'][_0x897a('0x58')]));_0x1bdfd6[_0x897a('0x56')]=_0x1bdfd6[_0x897a('0x56')]['length']?_0x1bdfd6[_0x897a('0x56')]:_0x2633ba[_0x897a('0x57')];_0x1bdfd6[_0x897a('0x5b')]=qs['sort'](_0x1357ec[_0x897a('0x52')][_0x897a('0x5c')]);_0x1bdfd6[_0x897a('0x5d')]=qs[_0x897a('0x54')](_[_0x897a('0x5e')](_0x1357ec[_0x897a('0x52')],_0x2633ba[_0x897a('0x54')]));if(_0x1357ec[_0x897a('0x52')]['filter']){_0x1bdfd6[_0x897a('0x5d')]=_[_0x897a('0x5f')](_0x1bdfd6[_0x897a('0x5d')],{'$or':_['map'](_0x1bdfd6[_0x897a('0x56')],function(_0x21e218){var _0x5784a3={};_0x5784a3[_0x21e218]={'$like':'%'+_0x1357ec[_0x897a('0x52')][_0x897a('0x61')]+'%'};return _0x5784a3;})});}_0x1bdfd6=_[_0x897a('0x5f')]({},_0x1bdfd6,_0x1357ec[_0x897a('0x62')]);return _0x195e1f['getApplications'](_0x1bdfd6);}})[_0x897a('0x25')](function(_0x3418fa){if(_0x3418fa){_0x4b1a2a=_0x3418fa[_0x897a('0x79')];if(!_0x1357ec[_0x897a('0x52')]['hasOwnProperty'](_0x897a('0x5a'))){_0x1bdfd6[_0x897a('0x21')]=qs[_0x897a('0x21')](_0x1357ec[_0x897a('0x52')][_0x897a('0x21')]);_0x1bdfd6[_0x897a('0x20')]=qs['offset'](_0x1357ec[_0x897a('0x52')][_0x897a('0x20')]);}return _0x195e1f[_0x897a('0x11e')](_0x1bdfd6);}})[_0x897a('0x25')](function(_0x3de532){if(_0x3de532){return _0x3de532?{'count':_0x4b1a2a,'rows':_0x3de532}:null;}})[_0x897a('0x25')](respondWithResult(_0xf72f13,null))['catch'](handleError(_0xf72f13,null));};exports[_0x897a('0x11f')]=function(_0x169fce,_0x2f2504){return db[_0x897a('0x120')][_0x897a('0x6d')]({'where':{'id':_0x169fce[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x2f2504,null))[_0x897a('0x25')](function(_0x1181e6){if(_0x1181e6){return _0x1181e6[_0x897a('0x11f')](_0x169fce['body'][_0x897a('0x7f')],_[_0x897a('0xf8')](_0x169fce[_0x897a('0x6a')],[_0x897a('0x7f'),'id'])||{});}})[_0x897a('0x25')](respondWithResult(_0x2f2504,null))['catch'](handleError(_0x2f2504,null));};exports[_0x897a('0x102')]=function(_0x231e65,_0x27a61c){var _0x288762={};var _0x5a3538={};var _0x4162d5;var _0x3991f6;return db['ChatWebsite'][_0x897a('0x78')]({'where':{'id':_0x231e65[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x27a61c,null))['then'](function(_0xa61322){if(_0xa61322){_0x4162d5=_0xa61322;_0x5a3538[_0x897a('0x57')]=_[_0x897a('0x53')](db[_0x897a('0x121')]['rawAttributes']);_0x5a3538[_0x897a('0x52')]=_['keys'](_0x231e65[_0x897a('0x52')]);_0x5a3538['filters']=_[_0x897a('0x55')](_0x5a3538[_0x897a('0x57')],_0x5a3538[_0x897a('0x52')]);_0x288762['attributes']=_['intersection'](_0x5a3538[_0x897a('0x57')],qs[_0x897a('0x58')](_0x231e65[_0x897a('0x52')][_0x897a('0x58')]));_0x288762['attributes']=_0x288762[_0x897a('0x56')][_0x897a('0x79')]?_0x288762[_0x897a('0x56')]:_0x5a3538[_0x897a('0x57')];_0x288762[_0x897a('0x5b')]=qs[_0x897a('0x5c')](_0x231e65['query'][_0x897a('0x5c')]);_0x288762[_0x897a('0x5d')]=qs['filters'](_[_0x897a('0x5e')](_0x231e65['query'],_0x5a3538[_0x897a('0x54')]));if(_0x231e65[_0x897a('0x52')][_0x897a('0x61')]){_0x288762['where']=_[_0x897a('0x5f')](_0x288762[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x288762['attributes'],function(_0x204970){var _0x389d50={};_0x389d50[_0x204970]={'$like':'%'+_0x231e65[_0x897a('0x52')][_0x897a('0x61')]+'%'};return _0x389d50;})});}_0x288762=_[_0x897a('0x5f')]({},_0x288762,_0x231e65[_0x897a('0x62')]);return _0x4162d5[_0x897a('0x102')](_0x288762);}})[_0x897a('0x25')](function(_0x1b18a5){if(_0x1b18a5){_0x3991f6=_0x1b18a5['length'];if(!_0x231e65[_0x897a('0x52')][_0x897a('0x59')](_0x897a('0x5a'))){_0x288762[_0x897a('0x21')]=qs['limit'](_0x231e65[_0x897a('0x52')][_0x897a('0x21')]);_0x288762[_0x897a('0x20')]=qs[_0x897a('0x20')](_0x231e65[_0x897a('0x52')][_0x897a('0x20')]);}return _0x4162d5[_0x897a('0x102')](_0x288762);}})['then'](function(_0xa7b4d8){if(_0xa7b4d8){return _0xa7b4d8?{'count':_0x3991f6,'rows':_0xa7b4d8}:null;}})[_0x897a('0x25')](respondWithResult(_0x27a61c,null))[_0x897a('0x1d')](handleError(_0x27a61c,null));};exports[_0x897a('0x122')]=function(_0x31e4f3,_0x3ab77c){var _0x1ba583=_0x31e4f3['query'][_0x897a('0x123')]===_0x897a('0x124')?_0x897a('0x125'):'onlineForm';return db[_0x897a('0x4f')]['find']({'attributes':['id',_0x1ba583],'where':{'id':_0x31e4f3[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x3ab77c,null))[_0x897a('0x25')](function(_0x491dae){if(_0x491dae){var _0xd77e61=_0x491dae[_0x1ba583];var _0x5874ca=_0xd77e61&&_0xd77e61[_0x897a('0x126')]?_0xd77e61[_0x897a('0x126')]:[];_0x3ab77c[_0x897a('0x2a')]({'fromKey':_[_0x897a('0x8f')](_0xd77e61[_0x897a('0x127')])?undefined:_0xd77e61[_0x897a('0x127')],'count':_0x5874ca[_0x897a('0x79')],'rows':_0x5874ca});}})['catch'](handleError(_0x3ab77c,null));};exports[_0x897a('0x128')]=function(_0x5917a6,_0x103d25){var _0x46bbe0={'raw':![],'where':{}};var _0x2d92f7={};var _0x4c6648={'count':0x0,'rows':[]};return db[_0x897a('0x4f')][_0x897a('0x78')]({'where':{'id':_0x5917a6[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x103d25,null))[_0x897a('0x25')](function(_0x5806c8){if(_0x5806c8){_0x2d92f7[_0x897a('0x57')]=_[_0x897a('0x53')](db[_0x897a('0xda')][_0x897a('0x50')]);_0x2d92f7['query']=_[_0x897a('0x53')](_0x5917a6[_0x897a('0x52')]);_0x2d92f7[_0x897a('0x54')]=_[_0x897a('0x55')](_0x2d92f7[_0x897a('0x57')],_0x2d92f7[_0x897a('0x52')]);_0x46bbe0[_0x897a('0x56')]=_[_0x897a('0x55')](_0x2d92f7['model'],qs[_0x897a('0x58')](_0x5917a6['query']['fields']));_0x46bbe0[_0x897a('0x56')]=_0x46bbe0[_0x897a('0x56')][_0x897a('0x79')]?_0x46bbe0[_0x897a('0x56')]:_0x2d92f7['model'];if(!_0x5917a6[_0x897a('0x52')][_0x897a('0x59')](_0x897a('0x5a'))){_0x46bbe0[_0x897a('0x21')]=qs['limit'](_0x5917a6['query'][_0x897a('0x21')]);_0x46bbe0['offset']=qs[_0x897a('0x20')](_0x5917a6[_0x897a('0x52')][_0x897a('0x20')]);}_0x46bbe0[_0x897a('0x5b')]=qs['sort'](_0x5917a6[_0x897a('0x52')][_0x897a('0x5c')]);_0x46bbe0[_0x897a('0x5d')]=qs[_0x897a('0x54')](_[_0x897a('0x5e')](_0x5917a6[_0x897a('0x52')],_0x2d92f7['filters']));_0x46bbe0[_0x897a('0x5d')][_0x897a('0x75')]=_0x5806c8['id'];if(_0x5917a6[_0x897a('0x52')]['filter']){_0x46bbe0[_0x897a('0x5d')]=_[_0x897a('0x5f')](_0x46bbe0[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x46bbe0[_0x897a('0x56')],function(_0x909717){var _0x2d8b3d={};_0x2d8b3d[_0x909717]={'$like':'%'+_0x5917a6[_0x897a('0x52')]['filter']+'%'};return _0x2d8b3d;})});}_0x46bbe0=_[_0x897a('0x5f')]({},_0x46bbe0,_0x5917a6[_0x897a('0x62')]);return db[_0x897a('0xda')][_0x897a('0x22')]({'where':_0x46bbe0[_0x897a('0x5d')]})['then'](function(_0x483bbb){_0x4c6648['count']=_0x483bbb;if(_0x5917a6[_0x897a('0x52')][_0x897a('0x67')]){_0x46bbe0['include']=[{'all':!![]}];}else{_0x46bbe0['include']=[{'model':db[_0x897a('0x9d')],'as':_0x897a('0xfa'),'required':![]},{'model':db[_0x897a('0xe2')],'as':_0x897a('0x129'),'required':![]}];}return db[_0x897a('0xda')][_0x897a('0x63')](_0x46bbe0);})[_0x897a('0x25')](function(_0x1f5d9){_0x4c6648['rows']=_0x1f5d9;return _0x4c6648;});}})[_0x897a('0x25')](respondWithFilteredResult(_0x103d25,_0x46bbe0))[_0x897a('0x1d')](handleError(_0x103d25,null));};exports[_0x897a('0x12a')]=function(_0x4516cb,_0x2bca3a){return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x4516cb[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x2bca3a,null))[_0x897a('0x25')](function(_0x1b88e7){if(_0x1b88e7){return _0x1b88e7[_0x897a('0x12a')](_0x4516cb[_0x897a('0x6a')][_0x897a('0x7f')],_[_0x897a('0xf8')](_0x4516cb[_0x897a('0x6a')],[_0x897a('0x7f'),'id'])||{})[_0x897a('0xb2')](function(_0x164f7b){for(var _0x335749=0x0;_0x335749<_0x4516cb[_0x897a('0x6a')][_0x897a('0x7f')][_0x897a('0x79')];_0x335749+=0x1){socket[_0x897a('0x12b')](_0x897a('0x12c'),{'UserId':Number(_0x4516cb['body'][_0x897a('0x7f')][_0x335749]),'ChatWebsiteId':Number(_0x4516cb['params']['id'])});}return _0x164f7b;});}})['then'](respondWithResult(_0x2bca3a,null))[_0x897a('0x1d')](handleError(_0x2bca3a,null));};exports['removeAgents']=function(_0x4351ec,_0xb70288){return db[_0x897a('0x4f')][_0x897a('0x6d')]({'where':{'id':_0x4351ec[_0x897a('0x72')]['id']}})[_0x897a('0x25')](handleEntityNotFound(_0xb70288,null))[_0x897a('0x25')](function(_0x1cae52){if(_0x1cae52){return _0x1cae52[_0x897a('0x12d')](_0x4351ec['query'][_0x897a('0x7f')])[_0x897a('0x25')](function(){if(_['isArray'](_0x4351ec[_0x897a('0x52')][_0x897a('0x7f')])){for(var _0x7b1789=0x0;_0x7b1789<_0x4351ec[_0x897a('0x52')][_0x897a('0x7f')]['length'];_0x7b1789+=0x1){socket[_0x897a('0x12b')](_0x897a('0x12e'),{'UserId':Number(_0x4351ec['query'][_0x897a('0x7f')][_0x7b1789]),'ChatWebsiteId':Number(_0x4351ec[_0x897a('0x72')]['id'])});}}else{socket['emit'](_0x897a('0x12e'),{'UserId':Number(_0x4351ec[_0x897a('0x52')][_0x897a('0x7f')]),'ChatWebsiteId':Number(_0x4351ec[_0x897a('0x72')]['id'])});}});}})['then'](respondWithStatusCode(_0xb70288,null))[_0x897a('0x1d')](handleError(_0xb70288,null));};exports['getAgents']=function(_0x1906f0,_0x26dfbd){var _0x104b45={};var _0x8eaff9={};var _0x2321c1;var _0x1e49e7;return db[_0x897a('0x4f')]['findOne']({'where':{'id':_0x1906f0['params']['id']}})[_0x897a('0x25')](handleEntityNotFound(_0x26dfbd,null))[_0x897a('0x25')](function(_0x1837ff){if(_0x1837ff){_0x2321c1=_0x1837ff;_0x8eaff9['model']=_[_0x897a('0x53')](db['User'][_0x897a('0x50')]);_0x8eaff9[_0x897a('0x52')]=_[_0x897a('0x53')](_0x1906f0[_0x897a('0x52')]);_0x8eaff9['filters']=_['intersection'](_0x8eaff9[_0x897a('0x57')],_0x8eaff9[_0x897a('0x52')]);_0x104b45[_0x897a('0x56')]=_[_0x897a('0x55')](_0x8eaff9[_0x897a('0x57')],qs['fields'](_0x1906f0[_0x897a('0x52')][_0x897a('0x58')]));_0x104b45[_0x897a('0x56')]=_0x104b45['attributes']['length']?_0x104b45[_0x897a('0x56')]:_0x8eaff9[_0x897a('0x57')];_0x104b45[_0x897a('0x5b')]=qs['sort'](_0x1906f0[_0x897a('0x52')]['sort']);_0x104b45['where']=qs[_0x897a('0x54')](_[_0x897a('0x5e')](_0x1906f0[_0x897a('0x52')],_0x8eaff9[_0x897a('0x54')]));if(_0x1906f0[_0x897a('0x52')][_0x897a('0x61')]){_0x104b45['where']=_[_0x897a('0x5f')](_0x104b45[_0x897a('0x5d')],{'$or':_[_0x897a('0x37')](_0x104b45[_0x897a('0x56')],function(_0x448637){var _0x30420d={};_0x30420d[_0x448637]={'$like':'%'+_0x1906f0['query'][_0x897a('0x61')]+'%'};return _0x30420d;})});}_0x104b45=_[_0x897a('0x5f')]({},_0x104b45,_0x1906f0[_0x897a('0x62')]);return _0x2321c1['getAgents'](_0x104b45);}})['then'](function(_0x8256a3){if(_0x8256a3){_0x1e49e7=_0x8256a3[_0x897a('0x79')];if(!_0x1906f0[_0x897a('0x52')]['hasOwnProperty'](_0x897a('0x5a'))){_0x104b45[_0x897a('0x21')]=qs[_0x897a('0x21')](_0x1906f0[_0x897a('0x52')][_0x897a('0x21')]);_0x104b45[_0x897a('0x20')]=qs[_0x897a('0x20')](_0x1906f0[_0x897a('0x52')][_0x897a('0x20')]);}return _0x2321c1['getAgents'](_0x104b45);}})[_0x897a('0x25')](function(_0x30b2ad){if(_0x30b2ad){return _0x30b2ad?{'count':_0x1e49e7,'rows':_0x30b2ad}:null;}})[_0x897a('0x25')](respondWithResult(_0x26dfbd,null))[_0x897a('0x1d')](handleError(_0x26dfbd,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3bfd3c0..5917c52 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 _0x8098=['hasOwnProperty','hook','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x554129,_0x2c3d20){var _0x4de573=function(_0x4d1b9b){while(--_0x4d1b9b){_0x554129['push'](_0x554129['shift']());}};_0x4de573(++_0x2c3d20);}(_0x8098,0x1ba));var _0x8809=function(_0x450aeb,_0x94d48c){_0x450aeb=_0x450aeb-0x0;var _0x491819=_0x8098[_0x450aeb];return _0x491819;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x8809('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8809('0x1')](0x0);var events={'afterCreate':_0x8809('0x2'),'afterUpdate':_0x8809('0x3'),'afterDestroy':_0x8809('0x4')};function emitEvent(_0x4b0838){return function(_0x2bb438,_0x1d7425,_0x13c03d){ChatWebsiteEvents[_0x8809('0x5')](_0x4b0838+':'+_0x2bb438['id'],_0x2bb438);ChatWebsiteEvents['emit'](_0x4b0838,_0x2bb438);_0x13c03d(null);};}for(var e in events){if(events[_0x8809('0x6')](e)){var event=events[e];ChatWebsite[_0x8809('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xa8a8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x324edb,_0x5f0d60){var _0x79d90c=function(_0x1c1a70){while(--_0x1c1a70){_0x324edb['push'](_0x324edb['shift']());}};_0x79d90c(++_0x5f0d60);}(_0xa8a8,0xec));var _0x8a8a=function(_0x69859f,_0x15bc92){_0x69859f=_0x69859f-0x0;var _0x197a59=_0xa8a8[_0x69859f];return _0x197a59;};'use strict';var EventEmitter=require(_0x8a8a('0x0'));var ChatWebsite=require(_0x8a8a('0x1'))['db'][_0x8a8a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8a8a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a8a('0x4'),'afterDestroy':_0x8a8a('0x5')};function emitEvent(_0xf11a08){return function(_0x3ed1de,_0x45515d,_0x1cecd4){ChatWebsiteEvents[_0x8a8a('0x6')](_0xf11a08+':'+_0x3ed1de['id'],_0x3ed1de);ChatWebsiteEvents[_0x8a8a('0x6')](_0xf11a08,_0x3ed1de);_0x1cecd4(null);};}for(var e in events){if(events[_0x8a8a('0x7')](e)){var event=events[e];ChatWebsite[_0x8a8a('0x8')](e,emitEvent(event));}}module[_0x8a8a('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6e1ead2..038a06a 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 _0x6222=['../../config/environment','./chatWebsite.attributes','define','chat_websites','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6222,0x7d));var _0x2622=function(_0x113f3c,_0xbbf92a){_0x113f3c=_0x113f3c-0x0;var _0x4b7380=_0x6222[_0x113f3c];return _0x4b7380;};'use strict';var _=require(_0x2622('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2622('0x1'));var moment=require(_0x2622('0x2'));var BPromise=require(_0x2622('0x3'));var rp=require(_0x2622('0x4'));var fs=require('fs');var path=require(_0x2622('0x5'));var rimraf=require(_0x2622('0x6'));var config=require(_0x2622('0x7'));var attributes=require(_0x2622('0x8'));module['exports']=function(_0x50cf25,_0x1c2f4f){return _0x50cf25[_0x2622('0x9')]('ChatWebsite',attributes,{'tableName':_0x2622('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6808=['../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x6808,0x1a6));var _0x8680=function(_0x55107e,_0x210c83){_0x55107e=_0x55107e-0x0;var _0x118ef9=_0x6808[_0x55107e];return _0x118ef9;};'use strict';var _=require('lodash');var util=require(_0x8680('0x0'));var logger=require(_0x8680('0x1'))(_0x8680('0x2'));var moment=require(_0x8680('0x3'));var BPromise=require(_0x8680('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8680('0x5'));var rimraf=require(_0x8680('0x6'));var config=require(_0x8680('0x7'));var attributes=require(_0x8680('0x8'));module['exports']=function(_0x578350,_0xd7143c){return _0x578350['define'](_0x8680('0x9'),attributes,{'tableName':_0x8680('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 8309f1f..d90506e 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 _0x2045=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5029fa,_0x4d1e7d){var _0x395dfb=function(_0x453e01){while(--_0x453e01){_0x5029fa['push'](_0x5029fa['shift']());}};_0x395dfb(++_0x4d1e7d);}(_0x2045,0x72));var _0x5204=function(_0x27889f,_0x4809b9){_0x27889f=_0x27889f-0x0;var _0x201713=_0x2045[_0x27889f];return _0x201713;};'use strict';var _=require(_0x5204('0x0'));var util=require(_0x5204('0x1'));var moment=require(_0x5204('0x2'));var BPromise=require(_0x5204('0x3'));var rs=require(_0x5204('0x4'));var fs=require('fs');var Redis=require(_0x5204('0x5'));var db=require(_0x5204('0x6'))['db'];var utils=require(_0x5204('0x7'));var logger=require(_0x5204('0x8'))(_0x5204('0x9'));var config=require(_0x5204('0xa'));var jayson=require(_0x5204('0xb'));var client=jayson[_0x5204('0xc')][_0x5204('0xd')]({'port':0x232a});config[_0x5204('0xe')]=_[_0x5204('0xf')](config[_0x5204('0xe')],{'host':_0x5204('0x10'),'port':0x18eb});var socket=require(_0x5204('0x11'))(new Redis(config[_0x5204('0xe')]));require('./chatWebsite.socket')[_0x5204('0x12')](socket);function respondWithRpcPromise(_0x92f99c,_0x23de2f,_0x46c538){return new BPromise(function(_0x4728ee,_0x13d858){return client[_0x5204('0x13')](_0x92f99c,_0x46c538)[_0x5204('0x14')](function(_0x3c05f2){logger[_0x5204('0x15')](_0x5204('0x16'),_0x23de2f,'request\x20sent');logger[_0x5204('0x17')](_0x5204('0x18'),_0x23de2f,_0x5204('0x19'),JSON[_0x5204('0x1a')](_0x3c05f2));if(_0x3c05f2[_0x5204('0x1b')]){if(_0x3c05f2['error'][_0x5204('0x1c')]===0x1f4){logger[_0x5204('0x1b')](_0x5204('0x16'),_0x23de2f,_0x3c05f2[_0x5204('0x1b')][_0x5204('0x1d')]);return _0x13d858(_0x3c05f2[_0x5204('0x1b')][_0x5204('0x1d')]);}logger[_0x5204('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x23de2f,_0x3c05f2[_0x5204('0x1b')][_0x5204('0x1d')]);return _0x4728ee(_0x3c05f2[_0x5204('0x1b')][_0x5204('0x1d')]);}else{logger[_0x5204('0x15')](_0x5204('0x16'),_0x23de2f,'request\x20sent');_0x4728ee(_0x3c05f2[_0x5204('0x1e')][_0x5204('0x1d')]);}})[_0x5204('0x1f')](function(_0xba7154){logger[_0x5204('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x23de2f,_0xba7154);_0x13d858(_0xba7154);});});} \ No newline at end of file +var _0xd060=['../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2219ac,_0x129a88){var _0x158bbb=function(_0x113671){while(--_0x113671){_0x2219ac['push'](_0x2219ac['shift']());}};_0x158bbb(++_0x129a88);}(_0xd060,0x6e));var _0x0d06=function(_0x484ab4,_0x56be12){_0x484ab4=_0x484ab4-0x0;var _0x253428=_0xd060[_0x484ab4];return _0x253428;};'use strict';var _=require(_0x0d06('0x0'));var util=require(_0x0d06('0x1'));var moment=require(_0x0d06('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d06('0x3'));var fs=require('fs');var Redis=require(_0x0d06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d06('0x5'));var logger=require('../../config/logger')(_0x0d06('0x6'));var config=require(_0x0d06('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d06('0x8')]['http']({'port':0x232a});config[_0x0d06('0x9')]=_[_0x0d06('0xa')](config[_0x0d06('0x9')],{'host':_0x0d06('0xb'),'port':0x18eb});var socket=require(_0x0d06('0xc'))(new Redis(config[_0x0d06('0x9')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0xbee78e,_0x3ebd52,_0x3d53be){return new BPromise(function(_0x109250,_0xbdca7b){return client['request'](_0xbee78e,_0x3d53be)['then'](function(_0x96209e){logger[_0x0d06('0xd')](_0x0d06('0xe'),_0x3ebd52,_0x0d06('0xf'));logger[_0x0d06('0x10')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3ebd52,_0x0d06('0xf'),JSON[_0x0d06('0x11')](_0x96209e));if(_0x96209e[_0x0d06('0x12')]){if(_0x96209e[_0x0d06('0x12')][_0x0d06('0x13')]===0x1f4){logger[_0x0d06('0x12')](_0x0d06('0xe'),_0x3ebd52,_0x96209e[_0x0d06('0x12')][_0x0d06('0x14')]);return _0xbdca7b(_0x96209e['error']['message']);}logger[_0x0d06('0x12')](_0x0d06('0xe'),_0x3ebd52,_0x96209e[_0x0d06('0x12')]['message']);return _0x109250(_0x96209e[_0x0d06('0x12')][_0x0d06('0x14')]);}else{logger[_0x0d06('0xd')]('ChatWebsite,\x20%s,\x20%s',_0x3ebd52,_0x0d06('0xf'));_0x109250(_0x96209e[_0x0d06('0x15')][_0x0d06('0x14')]);}})[_0x0d06('0x16')](function(_0x1f9df9){logger[_0x0d06('0x12')](_0x0d06('0xe'),_0x3ebd52,_0x1f9df9);_0xbdca7b(_0x1f9df9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e6f1d24..7ea1c02 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 _0x8bcd=['length','chatWebsite:','./chatWebsite.events','remove','update','emit','removeListener'];(function(_0x39ab14,_0x1c6d59){var _0x5a661e=function(_0x39297e){while(--_0x39297e){_0x39ab14['push'](_0x39ab14['shift']());}};_0x5a661e(++_0x1c6d59);}(_0x8bcd,0x1d7));var _0xd8bc=function(_0x486461,_0xa44925){_0x486461=_0x486461-0x0;var _0x50fda4=_0x8bcd[_0x486461];return _0x50fda4;};'use strict';var ChatWebsiteEvents=require(_0xd8bc('0x0'));var events=['save',_0xd8bc('0x1'),_0xd8bc('0x2')];function createListener(_0x3226f7,_0x28055d){return function(_0x570d0f){_0x28055d[_0xd8bc('0x3')](_0x3226f7,_0x570d0f);};}function removeListener(_0xf6fe9e,_0x2e0b8c){return function(){ChatWebsiteEvents[_0xd8bc('0x4')](_0xf6fe9e,_0x2e0b8c);};}exports['register']=function(_0x3b1789){for(var _0x4b64a5=0x0,_0x3558e3=events[_0xd8bc('0x5')];_0x4b64a5<_0x3558e3;_0x4b64a5++){var _0x3190dd=events[_0x4b64a5];var _0x5a0e77=createListener(_0xd8bc('0x6')+_0x3190dd,_0x3b1789);ChatWebsiteEvents['on'](_0x3190dd,_0x5a0e77);}}; \ No newline at end of file +var _0xf131=['emit','register','chatWebsite:','./chatWebsite.events','save','update'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xf131,0x1ad));var _0x1f13=function(_0x13077c,_0x51c626){_0x13077c=_0x13077c-0x0;var _0x470b57=_0xf131[_0x13077c];return _0x470b57;};'use strict';var ChatWebsiteEvents=require(_0x1f13('0x0'));var events=[_0x1f13('0x1'),'remove',_0x1f13('0x2')];function createListener(_0x265310,_0x570d54){return function(_0x527c67){_0x570d54[_0x1f13('0x3')](_0x265310,_0x527c67);};}function removeListener(_0x257a56,_0xf5d8ba){return function(){ChatWebsiteEvents['removeListener'](_0x257a56,_0xf5d8ba);};}exports[_0x1f13('0x4')]=function(_0x3c8aed){for(var _0x5f45fb=0x0,_0x38b297=events['length'];_0x5f45fb<_0x38b297;_0x5f45fb++){var _0x19fc0d=events[_0x5f45fb];var _0x1d8f32=createListener(_0x1f13('0x5')+_0x19fc0d,_0x3c8aed);ChatWebsiteEvents['on'](_0x19fc0d,_0x1d8f32);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c090003..67fe81a 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 _0xfde9=['file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','format','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','%s-%s','now','originalname','single'];(function(_0x30927f,_0x1a6b55){var _0x4dd593=function(_0x515645){while(--_0x515645){_0x30927f['push'](_0x30927f['shift']());}};_0x4dd593(++_0x1a6b55);}(_0xfde9,0x14b));var _0x9fde=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xfde9[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x9fde('0x0'));var util=require('util');var path=require(_0x9fde('0x1'));var timeout=require(_0x9fde('0x2'));var express=require(_0x9fde('0x3'));var router=express[_0x9fde('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9fde('0x5'));var interaction=require(_0x9fde('0x6'));var config=require('../../config/environment');var controller=require(_0x9fde('0x7'));router[_0x9fde('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fde('0x9')]);router[_0x9fde('0x8')]('/describe',auth[_0x9fde('0xa')](),controller[_0x9fde('0xb')]);router[_0x9fde('0x8')](_0x9fde('0xc'),auth[_0x9fde('0xa')](),controller[_0x9fde('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9fde('0xe')]);router[_0x9fde('0x8')](_0x9fde('0xf'),auth[_0x9fde('0xa')](),controller['getAnswers']);router[_0x9fde('0x8')](_0x9fde('0x10'),controller[_0x9fde('0x11')]);router[_0x9fde('0x8')](_0x9fde('0x12'),controller[_0x9fde('0x13')]);router['get'](_0x9fde('0x14'),controller[_0x9fde('0x15')]);router['get'](_0x9fde('0x16'),controller[_0x9fde('0x17')]);router[_0x9fde('0x8')](_0x9fde('0x18'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x19')]);router['get'](_0x9fde('0x1a'),controller['getSnippet']);router['get'](_0x9fde('0x1b'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x1c')]);router['get'](_0x9fde('0x1d'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x1e')]);router[_0x9fde('0x8')](_0x9fde('0x1f'),controller[_0x9fde('0x20')]);router[_0x9fde('0x8')](_0x9fde('0x21'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x22')]);router[_0x9fde('0x8')](_0x9fde('0x23'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x24')]);router[_0x9fde('0x25')]('/',auth[_0x9fde('0xa')](),controller[_0x9fde('0x26')]);router['post'](_0x9fde('0x27'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x28')]);router[_0x9fde('0x25')]('/:id/canned_answers',auth[_0x9fde('0xa')](),controller[_0x9fde('0x29')]);var upload=multer({'storage':multer[_0x9fde('0x2a')]({'destination':function(_0x5474ad,_0x4dcd6e,_0x372af3){_0x372af3(null,path[_0x9fde('0x2b')](config[_0x9fde('0x2c')],'server/files/images/logos/'));},'filename':function(_0x23d517,_0x1de365,_0x2bc344){_0x2bc344(null,util['format'](_0x9fde('0x2d'),Date[_0x9fde('0x2e')](),_0x1de365[_0x9fde('0x2f')]));}})});router[_0x9fde('0x25')]('/:id/logo',upload[_0x9fde('0x30')](_0x9fde('0x31')),controller[_0x9fde('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2023c2,_0x2fe1b8,_0x385d5f){_0x385d5f(null,path[_0x9fde('0x2b')](config['root'],_0x9fde('0x33')));},'filename':function(_0x3be884,_0x1c4a1a,_0x94781){_0x94781(null,util['format'](_0x9fde('0x2d'),Date[_0x9fde('0x2e')](),_0x1c4a1a['originalname']));}})});router[_0x9fde('0x25')](_0x9fde('0x12'),upload[_0x9fde('0x30')](_0x9fde('0x31')),controller[_0x9fde('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3eebc3,_0x32868d,_0x4e2d92){_0x4e2d92(null,path[_0x9fde('0x2b')](config[_0x9fde('0x2c')],_0x9fde('0x33')));},'filename':function(_0x54b839,_0x31de10,_0x2edcea){_0x2edcea(null,util['format'](_0x9fde('0x2d'),Date[_0x9fde('0x2e')](),_0x31de10[_0x9fde('0x2f')]));}})});router[_0x9fde('0x25')](_0x9fde('0x14'),upload['single'](_0x9fde('0x31')),controller[_0x9fde('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30eec4,_0x1d9abe,_0x497486){_0x497486(null,path[_0x9fde('0x2b')](config[_0x9fde('0x2c')],_0x9fde('0x33')));},'filename':function(_0x55a3b7,_0x5e72ad,_0x3d1849){_0x3d1849(null,util[_0x9fde('0x36')]('%s-%s',Date['now'](),_0x5e72ad[_0x9fde('0x2f')]));}})});router['post'](_0x9fde('0x16'),upload[_0x9fde('0x30')](_0x9fde('0x31')),controller[_0x9fde('0x37')]);router[_0x9fde('0x25')](_0x9fde('0x38'),controller[_0x9fde('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0x9fde('0x2a')]({'destination':function(_0x42098f,_0x30a574,_0x37e64d){const _0x47f426=path[_0x9fde('0x2b')](config[_0x9fde('0x2c')],_0x9fde('0x3a'),_0x9fde('0x3b'),_0x9fde('0x3c'));fs_extra['ensureDir'](_0x47f426,function(){_0x37e64d(null,_0x47f426);});},'filename':function(_0x2921c4,_0x464981,_0x41dc8a){const _0x55ca8e=_0x464981[_0x9fde('0x2f')][_0x9fde('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x524a54=path[_0x9fde('0x3e')](_0x55ca8e);const _0x40f2a1=Date[_0x9fde('0x2e')]()+'-'+_0x55ca8e['replace'](_0x524a54,'')+_0x524a54;_0x41dc8a(null,_0x40f2a1);}})});router[_0x9fde('0x25')](_0x9fde('0x3f'),offlineUploadMulter[_0x9fde('0x40')](),controller[_0x9fde('0x41')]);router['post'](_0x9fde('0x18'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x42')]);router[_0x9fde('0x25')]('/:id/applications',auth[_0x9fde('0xa')](),controller['addApplications']);router[_0x9fde('0x25')](_0x9fde('0x1d'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x43')]);router[_0x9fde('0x25')](_0x9fde('0x23'),auth['isAuthenticated'](),controller[_0x9fde('0x44')]);router[_0x9fde('0x45')](_0x9fde('0xc'),auth['isAuthenticated'](),controller[_0x9fde('0x46')]);router['delete'](_0x9fde('0xc'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x47')]);router[_0x9fde('0x48')](_0x9fde('0x27'),auth[_0x9fde('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x9fde('0xa')](),controller[_0x9fde('0x49')]);router[_0x9fde('0x48')](_0x9fde('0x23'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x4a')]);module[_0x9fde('0x4b')]=router; \ No newline at end of file +var _0xc328=['getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','server/files/images/logos/','format','%s-%s','now','originalname','single','diskStorage','root','server/files/images/avatars/','file','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','any','offline','/:id/interactions','addApplications','addAgents','put','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields'];(function(_0x3cc983,_0x40ed52){var _0x145328=function(_0xb608){while(--_0xb608){_0x3cc983['push'](_0x3cc983['shift']());}};_0x145328(++_0x40ed52);}(_0xc328,0xb3));var _0x8c32=function(_0x56fa5c,_0x46b71e){_0x56fa5c=_0x56fa5c-0x0;var _0x5cf91b=_0xc328[_0x56fa5c];return _0x5cf91b;};'use strict';var multer=require('multer');var util=require(_0x8c32('0x0'));var path=require(_0x8c32('0x1'));var timeout=require(_0x8c32('0x2'));var express=require('express');var router=express[_0x8c32('0x3')]();var fs_extra=require(_0x8c32('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8c32('0x5'));var config=require(_0x8c32('0x6'));var controller=require(_0x8c32('0x7'));router[_0x8c32('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c32('0x9')]);router[_0x8c32('0x8')]('/describe',auth[_0x8c32('0xa')](),controller[_0x8c32('0xb')]);router[_0x8c32('0x8')](_0x8c32('0xc'),auth[_0x8c32('0xa')](),controller[_0x8c32('0xd')]);router[_0x8c32('0x8')](_0x8c32('0xe'),auth[_0x8c32('0xa')](),controller['getDispositions']);router[_0x8c32('0x8')](_0x8c32('0xf'),auth['isAuthenticated'](),controller[_0x8c32('0x10')]);router['get']('/:id/logo',controller['getLogo']);router['get'](_0x8c32('0x11'),controller[_0x8c32('0x12')]);router[_0x8c32('0x8')](_0x8c32('0x13'),controller[_0x8c32('0x14')]);router[_0x8c32('0x8')](_0x8c32('0x15'),controller['getSystemAvatar']);router[_0x8c32('0x8')]('/:id/interactions',auth[_0x8c32('0xa')](),controller[_0x8c32('0x16')]);router[_0x8c32('0x8')](_0x8c32('0x17'),controller['getSnippet']);router[_0x8c32('0x8')](_0x8c32('0x18'),auth[_0x8c32('0xa')](),controller['getApplications']);router[_0x8c32('0x8')](_0x8c32('0x19'),auth[_0x8c32('0xa')](),controller[_0x8c32('0x1a')]);router['get'](_0x8c32('0x1b'),controller[_0x8c32('0x1c')]);router['get'](_0x8c32('0x1d'),auth['isAuthenticated'](),controller[_0x8c32('0x1e')]);router[_0x8c32('0x8')](_0x8c32('0x1f'),auth['isAuthenticated'](),controller[_0x8c32('0x20')]);router[_0x8c32('0x21')]('/',auth[_0x8c32('0xa')](),controller[_0x8c32('0x22')]);router[_0x8c32('0x21')](_0x8c32('0xe'),auth[_0x8c32('0xa')](),controller[_0x8c32('0x23')]);router[_0x8c32('0x21')]('/:id/canned_answers',auth[_0x8c32('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e504e,_0x395a8f,_0x215bee){_0x215bee(null,path[_0x8c32('0x24')](config['root'],_0x8c32('0x25')));},'filename':function(_0x3927d3,_0x4795e1,_0x3b0125){_0x3b0125(null,util[_0x8c32('0x26')](_0x8c32('0x27'),Date[_0x8c32('0x28')](),_0x4795e1[_0x8c32('0x29')]));}})});router['post']('/:id/logo',upload[_0x8c32('0x2a')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x8c32('0x2b')]({'destination':function(_0x58ad71,_0x3ff9fc,_0x1ab7e6){_0x1ab7e6(null,path[_0x8c32('0x24')](config[_0x8c32('0x2c')],_0x8c32('0x2d')));},'filename':function(_0x22c11f,_0x3421fd,_0x23b5e8){_0x23b5e8(null,util[_0x8c32('0x26')]('%s-%s',Date[_0x8c32('0x28')](),_0x3421fd[_0x8c32('0x29')]));}})});router['post'](_0x8c32('0x11'),upload[_0x8c32('0x2a')](_0x8c32('0x2e')),controller[_0x8c32('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x579115,_0x23e4dd,_0x282154){_0x282154(null,path[_0x8c32('0x24')](config[_0x8c32('0x2c')],_0x8c32('0x2d')));},'filename':function(_0xe9c800,_0x93ea81,_0x5f31a4){_0x5f31a4(null,util[_0x8c32('0x26')](_0x8c32('0x27'),Date[_0x8c32('0x28')](),_0x93ea81[_0x8c32('0x29')]));}})});router[_0x8c32('0x21')]('/:id/customer_avatar',upload[_0x8c32('0x2a')](_0x8c32('0x2e')),controller[_0x8c32('0x30')]);var upload=multer({'storage':multer[_0x8c32('0x2b')]({'destination':function(_0x2bd086,_0x1fdb48,_0x5aedc6){_0x5aedc6(null,path['join'](config[_0x8c32('0x2c')],_0x8c32('0x2d')));},'filename':function(_0x28476a,_0x301428,_0x26e9d4){_0x26e9d4(null,util[_0x8c32('0x26')](_0x8c32('0x27'),Date['now'](),_0x301428[_0x8c32('0x29')]));}})});router['post'](_0x8c32('0x15'),upload[_0x8c32('0x2a')](_0x8c32('0x2e')),controller[_0x8c32('0x31')]);router[_0x8c32('0x21')](_0x8c32('0x32'),controller[_0x8c32('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x8c32('0x2b')]({'destination':function(_0x1b0cf8,_0x5ec1ec,_0x46728a){const _0x52cfc9=path[_0x8c32('0x24')](config[_0x8c32('0x2c')],_0x8c32('0x34'),_0x8c32('0x35'),_0x8c32('0x36'));fs_extra[_0x8c32('0x37')](_0x52cfc9,function(){_0x46728a(null,_0x52cfc9);});},'filename':function(_0x2d0ec7,_0x409d21,_0x40cde1){const _0x1c3a35=_0x409d21['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x275a19=path[_0x8c32('0x38')](_0x1c3a35);const _0x5b3201=Date[_0x8c32('0x28')]()+'-'+_0x1c3a35['replace'](_0x275a19,'')+_0x275a19;_0x40cde1(null,_0x5b3201);}})});router['post'](_0x8c32('0x39'),offlineUploadMulter[_0x8c32('0x3a')](),controller[_0x8c32('0x3b')]);router[_0x8c32('0x21')](_0x8c32('0x3c'),auth[_0x8c32('0xa')](),controller['addInteraction']);router['post'](_0x8c32('0x18'),auth[_0x8c32('0xa')](),controller[_0x8c32('0x3d')]);router[_0x8c32('0x21')](_0x8c32('0x19'),auth[_0x8c32('0xa')](),controller['addProactiveActions']);router['post'](_0x8c32('0x1f'),auth['isAuthenticated'](),controller[_0x8c32('0x3e')]);router[_0x8c32('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0x8c32('0x40')]);router[_0x8c32('0x41')](_0x8c32('0xc'),auth[_0x8c32('0xa')](),controller[_0x8c32('0x42')]);router['delete'](_0x8c32('0xe'),auth[_0x8c32('0xa')](),controller[_0x8c32('0x43')]);router[_0x8c32('0x41')](_0x8c32('0xf'),auth[_0x8c32('0xa')](),controller['removeAnswers']);router[_0x8c32('0x41')](_0x8c32('0x1f'),auth[_0x8c32('0xa')](),controller['removeAgents']);module[_0x8c32('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d518e78..f773f84 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 _0xdd9c=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','../config/environment','Router','env','production'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xdd9c,0x14d));var _0xcdd9=function(_0x7ca77d,_0x3ad1ed){_0x7ca77d=_0x7ca77d-0x0;var _0x40e85b=_0xdd9c[_0x7ca77d];return _0x40e85b;};var beaverLogger=require(_0xcdd9('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0xcdd9('0x1'));var router=express[_0xcdd9('0x2')]();var isProduction=config[_0xcdd9('0x3')]===_0xcdd9('0x4')||![];function clientSideLogs(_0x34ce9f,_0x59a70a,_0xccfb39){var _0x5b5f41=_0x34ce9f[_0xcdd9('0x5')][_0xcdd9('0x6')](_0xcdd9('0x7'));if(!_0x5b5f41){throw new Error(_0xcdd9('0x8'));}return beaverLogger[_0xcdd9('0x9')]({'uri':_0xcdd9('0xa'),'logger':_0x5b5f41,'enableCors':!isProduction})(_0x34ce9f,_0x59a70a,_0xccfb39);}router['use'](auth[_0xcdd9('0xb')](),clientSideLogs);module[_0xcdd9('0xc')]=router; \ No newline at end of file +var _0x6010=['exports','beaver-logger/server','express','../config/environment','Router','env','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6010,0x145));var _0x0601=function(_0x5b59f5,_0x36bf1a){_0x5b59f5=_0x5b59f5-0x0;var _0x484a52=_0x6010[_0x5b59f5];return _0x484a52;};var beaverLogger=require(_0x0601('0x0'));var express=require(_0x0601('0x1'));var auth=require('../components/auth/service');var config=require(_0x0601('0x2'));var router=express[_0x0601('0x3')]();var isProduction=config[_0x0601('0x4')]==='production'||![];function clientSideLogs(_0x568dc0,_0x118501,_0x89186c){var _0x4351db=_0x568dc0[_0x0601('0x5')]['get']('client-side-logger');if(!_0x4351db){throw new Error(_0x0601('0x6'));}return beaverLogger[_0x0601('0x7')]({'uri':_0x0601('0x8'),'logger':_0x4351db,'enableCors':!isProduction})(_0x568dc0,_0x118501,_0x89186c);}router[_0x0601('0x9')](auth[_0x0601('0xa')](),clientSideLogs);module[_0x0601('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 41b7f8a..068a9d7 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 _0x5e0d=['MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0xa0bad7,_0x145b2e){var _0x50ab20=function(_0x80b2eb){while(--_0x80b2eb){_0xa0bad7['push'](_0xa0bad7['shift']());}};_0x50ab20(++_0x145b2e);}(_0x5e0d,0x145));var _0xd5e0=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x5e0d[_0x4e93a9];return _0x43013c;};'use strict';var Sequelize=require(_0xd5e0('0x0'));module[_0xd5e0('0x1')]={'name':{'type':Sequelize[_0xd5e0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd5e0('0x3')](_0xd5e0('0x4'),_0xd5e0('0x5'),_0xd5e0('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xd5e0('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0xd5e0('0x2')],'comment':_0xd5e0('0x8')},'data2':{'type':Sequelize[_0xd5e0('0x2')],'comment':_0xd5e0('0x9')},'data3':{'type':Sequelize[_0xd5e0('0x2')],'comment':_0xd5e0('0xa')},'data4':{'type':Sequelize[_0xd5e0('0x2')],'comment':_0xd5e0('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xd5e0('0xc')},'data6':{'type':Sequelize[_0xd5e0('0xd')],'comment':_0xd5e0('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':_0xd5e0('0xf')}}; \ No newline at end of file +var _0xb841=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x43c8d9,_0x750f46){var _0x3eb896=function(_0x2ae674){while(--_0x2ae674){_0x43c8d9['push'](_0x43c8d9['shift']());}};_0x3eb896(++_0x750f46);}(_0xb841,0x17b));var _0x1b84=function(_0x34dd30,_0x20f106){_0x34dd30=_0x34dd30-0x0;var _0x2b1f5d=_0xb841[_0x34dd30];return _0x2b1f5d;};'use strict';var Sequelize=require(_0x1b84('0x0'));module[_0x1b84('0x1')]={'name':{'type':Sequelize[_0x1b84('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1b84('0x3')](_0x1b84('0x4'),'Google',_0x1b84('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1b84('0x6'),_0x1b84('0x7'))},'data1':{'type':Sequelize[_0x1b84('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x1b84('0x8')},'data3':{'type':Sequelize[_0x1b84('0x2')],'comment':_0x1b84('0x9')},'data4':{'type':Sequelize[_0x1b84('0x2')],'comment':_0x1b84('0xa')},'data5':{'type':Sequelize[_0x1b84('0xb')],'comment':_0x1b84('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0x1b84('0xd')},'data7':{'type':Sequelize[_0x1b84('0xb')],'comment':_0x1b84('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d03b90a..f14dc25 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 _0x91a9=['Unable\x20to\x20validate\x20id_token','del','code','access_token','data6','refresh_token','update','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','stack','name','send','padEnd','slice','index','map','CloudProvider','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','findAll','decryptString','data3','show','fields','include','options','find','service','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','params','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','from','toString','ascii','parse','oauth2Claims'];(function(_0x527bf7,_0x326b0b){var _0xf96393=function(_0x3e9455){while(--_0x3e9455){_0x527bf7['push'](_0x527bf7['shift']());}};_0xf96393(++_0x326b0b);}(_0x91a9,0x190));var _0x991a=function(_0x1dc1b1,_0x11b2f2){_0x1dc1b1=_0x1dc1b1-0x0;var _0x22e85a=_0x91a9[_0x1dc1b1];return _0x22e85a;};'use strict';var _=require('lodash');var Redis=require(_0x991a('0x0'));var qs=require(_0x991a('0x1'));var encryptor=require(_0x991a('0x2'));var config=require('../../config/environment');var logger=require(_0x991a('0x3'))(_0x991a('0x4'));var db=require(_0x991a('0x5'))['db'];var oauth=require(_0x991a('0x6'));config[_0x991a('0x7')]=_[_0x991a('0x8')](config['redis'],{'host':_0x991a('0x9'),'port':0x18eb});var socket=require(_0x991a('0xa'))(new Redis(config[_0x991a('0x7')]));var redis=new Redis(config[_0x991a('0x7')]);function respondWithStatusCode(_0x5a9a11,_0x5b8871){_0x5b8871=_0x5b8871||0xcc;return function(_0x1f0c1f){if(_0x1f0c1f){return _0x5a9a11[_0x991a('0xb')](_0x5b8871);}return _0x5a9a11[_0x991a('0xc')](_0x5b8871)[_0x991a('0xd')]();};}function respondWithResult(_0x54e05e,_0x45e877){_0x45e877=_0x45e877||0xc8;return function(_0x546bb7){if(_0x546bb7){return _0x54e05e[_0x991a('0xc')](_0x45e877)[_0x991a('0xe')](_0x546bb7);}};}function respondWithFilteredResult(_0x146732,_0x56ebf8){return function(_0x4a2f43){if(_0x4a2f43){var _0x580be8=typeof _0x56ebf8[_0x991a('0xf')]==='undefined'&&typeof _0x56ebf8[_0x991a('0x10')]===_0x991a('0x11');var _0x221ac3=_0x4a2f43[_0x991a('0x12')];var _0x579912=_0x580be8?0x0:_0x56ebf8['offset'];var _0x2188a9=_0x580be8?_0x4a2f43[_0x991a('0x12')]:_0x56ebf8['offset']+_0x56ebf8[_0x991a('0x10')];var _0x5df7ee;if(_0x2188a9>=_0x221ac3){_0x2188a9=_0x221ac3;_0x5df7ee=0xc8;}else{_0x5df7ee=0xce;}_0x146732['status'](_0x5df7ee);return _0x146732[_0x991a('0x13')](_0x991a('0x14'),_0x579912+'-'+_0x2188a9+'/'+_0x221ac3)[_0x991a('0xe')](_0x4a2f43);}return null;};}function saveUpdates(_0x32cab2){return function(_0x10c6bd){if(_0x10c6bd){return _0x10c6bd['update'](_0x32cab2)[_0x991a('0x15')](function(_0x3f0219){return _0x3f0219;});}return null;};}function removeEntity(_0x34d1a0){return function(_0xcfdd7f){if(_0xcfdd7f){return _0xcfdd7f[_0x991a('0x16')]()[_0x991a('0x15')](function(){_0x34d1a0[_0x991a('0xc')](0xcc)[_0x991a('0xd')]();});}};}function handleEntityNotFound(_0x19706c){return function(_0x3c6956){if(!_0x3c6956){_0x19706c['sendStatus'](0x194);}return _0x3c6956;};}function handleError(_0x27e288,_0x2264d4){_0x2264d4=_0x2264d4||0x1f4;return function(_0x2f43e2){logger['error'](_0x2f43e2[_0x991a('0x17')]);if(_0x2f43e2[_0x991a('0x18')]){delete _0x2f43e2[_0x991a('0x18')];}_0x27e288[_0x991a('0xc')](_0x2264d4)[_0x991a('0x19')](_0x2f43e2);};}function maskClientSecret(_0x188bba){return _[_0x991a('0x1a')](_0x188bba[_0x991a('0x1b')](0x0,0x3),0x14,'*');}exports[_0x991a('0x1c')]=function(_0x1a7074,_0x4c5303){var _0x58d0a2={},_0x486021={},_0x2a4be5={'count':0x0,'rows':[]};var _0x1a205b=_[_0x991a('0x1d')](db[_0x991a('0x1e')]['rawAttributes'],function(_0x5e285a){return{'name':_0x5e285a['fieldName'],'type':_0x5e285a[_0x991a('0x1f')]['key']};});_0x486021[_0x991a('0x20')]=_[_0x991a('0x1d')](_0x1a205b,_0x991a('0x18'));_0x486021[_0x991a('0x21')]=_[_0x991a('0x22')](_0x1a7074[_0x991a('0x21')]);_0x486021[_0x991a('0x23')]=_[_0x991a('0x24')](_0x486021[_0x991a('0x20')],_0x486021[_0x991a('0x21')]);_0x58d0a2[_0x991a('0x25')]=_['intersection'](_0x486021['model'],qs['fields'](_0x1a7074[_0x991a('0x21')]['fields']));_0x58d0a2[_0x991a('0x25')]=_0x58d0a2[_0x991a('0x25')][_0x991a('0x26')]?_0x58d0a2[_0x991a('0x25')]:_0x486021[_0x991a('0x20')];if(!_0x1a7074[_0x991a('0x21')][_0x991a('0x27')](_0x991a('0x28'))){_0x58d0a2['limit']=qs['limit'](_0x1a7074[_0x991a('0x21')][_0x991a('0x10')]);_0x58d0a2['offset']=qs[_0x991a('0xf')](_0x1a7074[_0x991a('0x21')]['offset']);}_0x58d0a2[_0x991a('0x29')]=qs[_0x991a('0x2a')](_0x1a7074[_0x991a('0x21')]['sort']);_0x58d0a2['where']=qs[_0x991a('0x23')](_[_0x991a('0x2b')](_0x1a7074[_0x991a('0x21')],_0x486021[_0x991a('0x23')]),_0x1a205b);if(_0x1a7074[_0x991a('0x21')]['filter']){_0x58d0a2[_0x991a('0x2c')]=_[_0x991a('0x2d')](_0x58d0a2[_0x991a('0x2c')],{'$or':_[_0x991a('0x1d')](_0x1a205b,function(_0x23f1af){if(_0x23f1af[_0x991a('0x1f')]!==_0x991a('0x2e')){var _0x2a083e={};_0x2a083e[_0x23f1af[_0x991a('0x18')]]={'$like':'%'+_0x1a7074[_0x991a('0x21')]['filter']+'%'};return _0x2a083e;}})});}_0x58d0a2=_[_0x991a('0x2d')]({},_0x58d0a2,_0x1a7074['options']);var _0x5874df={'where':_0x58d0a2['where']};return db[_0x991a('0x1e')][_0x991a('0x12')](_0x5874df)[_0x991a('0x15')](function(_0xb8211a){_0x2a4be5['count']=_0xb8211a;if(_0x1a7074['query']['includeAll']){_0x58d0a2['include']=[{'all':!![]}];}return db[_0x991a('0x1e')][_0x991a('0x2f')](_0x58d0a2);})[_0x991a('0x15')](function(_0x6beaab){_0x2a4be5['rows']=_[_0x991a('0x1d')](_0x6beaab,function(_0x45638c){if(_0x45638c['service']==='MicrosoftAzure'){var _0x829557=encryptor[_0x991a('0x30')](_0x45638c['data3']);_0x45638c[_0x991a('0x31')]=maskClientSecret(_0x829557);}return _0x45638c;});return _0x2a4be5;})[_0x991a('0x15')](respondWithFilteredResult(_0x4c5303,_0x58d0a2))['catch'](handleError(_0x4c5303,null));};exports[_0x991a('0x32')]=function(_0x4c0235,_0x4e8c22){var _0x5378b3={'raw':!![],'where':{'id':_0x4c0235['params']['id']}},_0x2fcde3={};_0x2fcde3[_0x991a('0x20')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x2fcde3[_0x991a('0x21')]=_[_0x991a('0x22')](_0x4c0235[_0x991a('0x21')]);_0x2fcde3[_0x991a('0x23')]=_[_0x991a('0x24')](_0x2fcde3[_0x991a('0x20')],_0x2fcde3[_0x991a('0x21')]);_0x5378b3[_0x991a('0x25')]=_[_0x991a('0x24')](_0x2fcde3['model'],qs[_0x991a('0x33')](_0x4c0235['query'][_0x991a('0x33')]));_0x5378b3['attributes']=_0x5378b3[_0x991a('0x25')][_0x991a('0x26')]?_0x5378b3[_0x991a('0x25')]:_0x2fcde3[_0x991a('0x20')];if(_0x4c0235[_0x991a('0x21')]['includeAll']){_0x5378b3[_0x991a('0x34')]=[{'all':!![]}];}_0x5378b3=_['merge']({},_0x5378b3,_0x4c0235[_0x991a('0x35')]);return db[_0x991a('0x1e')][_0x991a('0x36')](_0x5378b3)[_0x991a('0x15')](handleEntityNotFound(_0x4e8c22,null))[_0x991a('0x15')](function(_0x5a3641){if(_0x5a3641[_0x991a('0x37')]==='MicrosoftAzure'){var _0x5c1e99=encryptor['decryptString'](_0x5a3641[_0x991a('0x31')]);_0x5a3641[_0x991a('0x31')]=maskClientSecret(_0x5c1e99);}return _0x5a3641;})['then'](respondWithResult(_0x4e8c22,null))[_0x991a('0x38')](handleError(_0x4e8c22,null));};exports[_0x991a('0x39')]=function(_0x56d2bf,_0x350179){if(!_0x56d2bf[_0x991a('0x3a')][_0x991a('0x18')])throw new Error(_0x991a('0x3b'));if(!_0x56d2bf[_0x991a('0x3a')][_0x991a('0x37')])throw new Error(_0x991a('0x3c'));var _0x4d103b=db[_0x991a('0x1e')][_0x991a('0x3d')]['service'][_0x991a('0x3e')];if(!_0x4d103b['includes'](_0x56d2bf[_0x991a('0x3a')]['service']))throw new Error(_0x991a('0x3f')+_0x4d103b[_0x991a('0x40')](',\x20'));if(_0x56d2bf[_0x991a('0x3a')][_0x991a('0x37')]===_0x991a('0x41')&&_0x56d2bf[_0x991a('0x3a')][_0x991a('0x31')]){_0x56d2bf['body'][_0x991a('0x31')]=encryptor[_0x991a('0x42')](_0x56d2bf[_0x991a('0x3a')]['data3']);}return db[_0x991a('0x1e')][_0x991a('0x39')](_0x56d2bf[_0x991a('0x3a')],{})[_0x991a('0x15')](respondWithResult(_0x350179,0xc9))['catch'](handleError(_0x350179,null));};exports['update']=function(_0x1f3fc3,_0x179ad0){if(_0x1f3fc3['body']['id']){delete _0x1f3fc3[_0x991a('0x3a')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x1f3fc3[_0x991a('0x43')]['id']}})[_0x991a('0x15')](handleEntityNotFound(_0x179ad0,null))[_0x991a('0x15')](function(_0x41e41e){if(_0x41e41e[_0x991a('0x37')]==='MicrosoftAzure'&&_0x1f3fc3[_0x991a('0x3a')][_0x991a('0x31')]){_0x1f3fc3[_0x991a('0x3a')][_0x991a('0x31')]=encryptor['encryptString'](_0x1f3fc3[_0x991a('0x3a')][_0x991a('0x31')]);}return _0x41e41e;})[_0x991a('0x15')](saveUpdates(_0x1f3fc3['body'],null))[_0x991a('0x15')](respondWithResult(_0x179ad0,null))[_0x991a('0x38')](handleError(_0x179ad0,null));};exports[_0x991a('0x16')]=function(_0x34f9d0,_0x409caf){return db[_0x991a('0x1e')][_0x991a('0x36')]({'where':{'id':_0x34f9d0[_0x991a('0x43')]['id']}})[_0x991a('0x15')](handleEntityNotFound(_0x409caf,null))['then'](removeEntity(_0x409caf,null))['catch'](handleError(_0x409caf,null));};exports[_0x991a('0x44')]=function(_0x4c529f,_0x4c6252){return db[_0x991a('0x1e')]['findOne']({'where':{'id':_0x4c529f[_0x991a('0x43')]['id']},'raw':!![]})[_0x991a('0x15')](function(_0x57fad0){if(!_0x57fad0)return _0x4c6252[_0x991a('0xb')](0x194);return{'url':oauth[_0x991a('0x45')](_0x57fad0,_0x4c529f[_0x991a('0x46')]['id'])};})[_0x991a('0x15')](respondWithResult(_0x4c6252,null))[_0x991a('0x38')](handleError(_0x4c6252,null));};exports[_0x991a('0x47')]=function(_0x5609a0,_0x2f9ab7){var _0x318f62=_0x5609a0[_0x991a('0x3a')];var _0x9d53ed;var _0x2105bc;if(_0x318f62[_0x991a('0x48')])throw _0x318f62;redis['get'](_0x318f62[_0x991a('0x49')])[_0x991a('0x15')](function(_0x46d9cd){if(!_0x46d9cd)throw new Error(_0x991a('0x4a'));_0x9d53ed=JSON['parse'](_0x46d9cd);var _0x3255c7=Buffer[_0x991a('0x4b')](_0x318f62[_0x991a('0x49')],'base64')[_0x991a('0x4c')](_0x991a('0x4d'));_0x2105bc=JSON[_0x991a('0x4e')](_0x3255c7);if(!oauth['isValidIdToken'](_0x318f62['id_token'],_0x9d53ed[_0x991a('0x4f')]))throw new Error(_0x991a('0x50'));redis[_0x991a('0x51')](_0x318f62[_0x991a('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x318f62[_0x991a('0x52')],_0x9d53ed);})[_0x991a('0x15')](function(_0x349256){_0x9d53ed['data5']=_0x349256[_0x991a('0x53')];_0x9d53ed[_0x991a('0x54')]=_0x349256[_0x991a('0x55')];return db[_0x991a('0x1e')][_0x991a('0x56')]({'data5':_0x9d53ed[_0x991a('0x57')],'data6':_0x9d53ed[_0x991a('0x54')]},{'where':{'id':_0x9d53ed['id']}});})[_0x991a('0x15')](function(){oauth[_0x991a('0x58')](_0x9d53ed);socket[_0x991a('0x59')](_0x991a('0x5a'),{'id':_0x2105bc['id']});return;})[_0x991a('0x15')](respondWithStatusCode(_0x2f9ab7,null))[_0x991a('0x38')](function(_0x5a56fc){if(_0x2105bc){socket['emit'](_0x991a('0x5b'),{'id':_0x2105bc['id']});}if(!_0x9d53ed){logger['error'](_0x991a('0x5c'),_0x5a56fc);return _0x2f9ab7[_0x991a('0xc')](0x1f4)['send'](_0x5a56fc[_0x991a('0x5d')]);}logger[_0x991a('0x48')](_0x991a('0x5e'),_0x9d53ed['id'],JSON[_0x991a('0x5f')](_0x5a56fc));});}; \ No newline at end of file +var _0x47ee=['sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','service','MicrosoftAzure','data3','catch','show','params','length','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','limit','undefined','count','offset','set','update','then','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order'];(function(_0x3dacf8,_0x4d6188){var _0x9cb0fa=function(_0x1098bd){while(--_0x1098bd){_0x3dacf8['push'](_0x3dacf8['shift']());}};_0x9cb0fa(++_0x4d6188);}(_0x47ee,0x148));var _0xe47e=function(_0x4f1210,_0x4ab68a){_0x4f1210=_0x4f1210-0x0;var _0x5c24ed=_0x47ee[_0x4f1210];return _0x5c24ed;};'use strict';var _=require(_0xe47e('0x0'));var Redis=require('ioredis');var qs=require(_0xe47e('0x1'));var encryptor=require(_0xe47e('0x2'));var config=require('../../config/environment');var logger=require(_0xe47e('0x3'))(_0xe47e('0x4'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xe47e('0x5')]=_[_0xe47e('0x6')](config['redis'],{'host':_0xe47e('0x7'),'port':0x18eb});var socket=require(_0xe47e('0x8'))(new Redis(config[_0xe47e('0x5')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1f3aab,_0x2bdf09){_0x2bdf09=_0x2bdf09||0xcc;return function(_0x57cd75){if(_0x57cd75){return _0x1f3aab[_0xe47e('0x9')](_0x2bdf09);}return _0x1f3aab[_0xe47e('0xa')](_0x2bdf09)[_0xe47e('0xb')]();};}function respondWithResult(_0x1f4058,_0x483751){_0x483751=_0x483751||0xc8;return function(_0x19952f){if(_0x19952f){return _0x1f4058[_0xe47e('0xa')](_0x483751)['json'](_0x19952f);}};}function respondWithFilteredResult(_0x2e1024,_0x53abff){return function(_0x2092c5){if(_0x2092c5){var _0x23c29c=typeof _0x53abff['offset']==='undefined'&&typeof _0x53abff[_0xe47e('0xc')]===_0xe47e('0xd');var _0x2985db=_0x2092c5[_0xe47e('0xe')];var _0x5c1b04=_0x23c29c?0x0:_0x53abff[_0xe47e('0xf')];var _0x5abd16=_0x23c29c?_0x2092c5[_0xe47e('0xe')]:_0x53abff[_0xe47e('0xf')]+_0x53abff[_0xe47e('0xc')];var _0x2675c0;if(_0x5abd16>=_0x2985db){_0x5abd16=_0x2985db;_0x2675c0=0xc8;}else{_0x2675c0=0xce;}_0x2e1024[_0xe47e('0xa')](_0x2675c0);return _0x2e1024[_0xe47e('0x10')]('Content-Range',_0x5c1b04+'-'+_0x5abd16+'/'+_0x2985db)['json'](_0x2092c5);}return null;};}function saveUpdates(_0x3c92ce){return function(_0x507bcc){if(_0x507bcc){return _0x507bcc[_0xe47e('0x11')](_0x3c92ce)[_0xe47e('0x12')](function(_0x27b27d){return _0x27b27d;});}return null;};}function removeEntity(_0x481660){return function(_0x257d43){if(_0x257d43){return _0x257d43['destroy']()['then'](function(){_0x481660[_0xe47e('0xa')](0xcc)[_0xe47e('0xb')]();});}};}function handleEntityNotFound(_0x1c8d0d){return function(_0x16c08b){if(!_0x16c08b){_0x1c8d0d[_0xe47e('0x9')](0x194);}return _0x16c08b;};}function handleError(_0x494c7e,_0x3fdc1c){_0x3fdc1c=_0x3fdc1c||0x1f4;return function(_0x2403e7){logger[_0xe47e('0x13')](_0x2403e7['stack']);if(_0x2403e7['name']){delete _0x2403e7[_0xe47e('0x14')];}_0x494c7e[_0xe47e('0xa')](_0x3fdc1c)[_0xe47e('0x15')](_0x2403e7);};}function maskClientSecret(_0x33edbf){return _[_0xe47e('0x16')](_0x33edbf[_0xe47e('0x17')](0x0,0x3),0x14,'*');}exports[_0xe47e('0x18')]=function(_0xb9e661,_0x13ccdb){var _0x1b34fa={},_0x2b7342={},_0x526c11={'count':0x0,'rows':[]};var _0x252a44=_[_0xe47e('0x19')](db[_0xe47e('0x1a')][_0xe47e('0x1b')],function(_0x1ec852){return{'name':_0x1ec852[_0xe47e('0x1c')],'type':_0x1ec852[_0xe47e('0x1d')][_0xe47e('0x1e')]};});_0x2b7342[_0xe47e('0x1f')]=_[_0xe47e('0x19')](_0x252a44,_0xe47e('0x14'));_0x2b7342[_0xe47e('0x20')]=_[_0xe47e('0x21')](_0xb9e661[_0xe47e('0x20')]);_0x2b7342[_0xe47e('0x22')]=_[_0xe47e('0x23')](_0x2b7342['model'],_0x2b7342[_0xe47e('0x20')]);_0x1b34fa[_0xe47e('0x24')]=_[_0xe47e('0x23')](_0x2b7342[_0xe47e('0x1f')],qs['fields'](_0xb9e661[_0xe47e('0x20')][_0xe47e('0x25')]));_0x1b34fa[_0xe47e('0x24')]=_0x1b34fa['attributes']['length']?_0x1b34fa[_0xe47e('0x24')]:_0x2b7342[_0xe47e('0x1f')];if(!_0xb9e661[_0xe47e('0x20')][_0xe47e('0x26')]('nolimit')){_0x1b34fa[_0xe47e('0xc')]=qs[_0xe47e('0xc')](_0xb9e661[_0xe47e('0x20')]['limit']);_0x1b34fa[_0xe47e('0xf')]=qs[_0xe47e('0xf')](_0xb9e661[_0xe47e('0x20')][_0xe47e('0xf')]);}_0x1b34fa[_0xe47e('0x27')]=qs[_0xe47e('0x28')](_0xb9e661[_0xe47e('0x20')][_0xe47e('0x28')]);_0x1b34fa[_0xe47e('0x29')]=qs[_0xe47e('0x22')](_[_0xe47e('0x2a')](_0xb9e661['query'],_0x2b7342[_0xe47e('0x22')]),_0x252a44);if(_0xb9e661[_0xe47e('0x20')][_0xe47e('0x2b')]){_0x1b34fa['where']=_['merge'](_0x1b34fa[_0xe47e('0x29')],{'$or':_[_0xe47e('0x19')](_0x252a44,function(_0x338026){if(_0x338026['type']!==_0xe47e('0x2c')){var _0x50075e={};_0x50075e[_0x338026[_0xe47e('0x14')]]={'$like':'%'+_0xb9e661[_0xe47e('0x20')][_0xe47e('0x2b')]+'%'};return _0x50075e;}})});}_0x1b34fa=_[_0xe47e('0x2d')]({},_0x1b34fa,_0xb9e661[_0xe47e('0x2e')]);var _0x4c4f68={'where':_0x1b34fa[_0xe47e('0x29')]};return db[_0xe47e('0x1a')][_0xe47e('0xe')](_0x4c4f68)['then'](function(_0x4e7a4d){_0x526c11[_0xe47e('0xe')]=_0x4e7a4d;if(_0xb9e661[_0xe47e('0x20')][_0xe47e('0x2f')]){_0x1b34fa[_0xe47e('0x30')]=[{'all':!![]}];}return db[_0xe47e('0x1a')]['findAll'](_0x1b34fa);})[_0xe47e('0x12')](function(_0x3e05aa){_0x526c11[_0xe47e('0x31')]=_[_0xe47e('0x19')](_0x3e05aa,function(_0x260478){if(_0x260478[_0xe47e('0x32')]===_0xe47e('0x33')){var _0x4d08b0=encryptor['decryptString'](_0x260478[_0xe47e('0x34')]);_0x260478[_0xe47e('0x34')]=maskClientSecret(_0x4d08b0);}return _0x260478;});return _0x526c11;})[_0xe47e('0x12')](respondWithFilteredResult(_0x13ccdb,_0x1b34fa))[_0xe47e('0x35')](handleError(_0x13ccdb,null));};exports[_0xe47e('0x36')]=function(_0x1973f6,_0x540de5){var _0x232ba0={'raw':!![],'where':{'id':_0x1973f6[_0xe47e('0x37')]['id']}},_0x184be0={};_0x184be0[_0xe47e('0x1f')]=_[_0xe47e('0x21')](db[_0xe47e('0x1a')][_0xe47e('0x1b')]);_0x184be0[_0xe47e('0x20')]=_[_0xe47e('0x21')](_0x1973f6[_0xe47e('0x20')]);_0x184be0['filters']=_['intersection'](_0x184be0[_0xe47e('0x1f')],_0x184be0[_0xe47e('0x20')]);_0x232ba0[_0xe47e('0x24')]=_['intersection'](_0x184be0[_0xe47e('0x1f')],qs['fields'](_0x1973f6[_0xe47e('0x20')][_0xe47e('0x25')]));_0x232ba0[_0xe47e('0x24')]=_0x232ba0[_0xe47e('0x24')][_0xe47e('0x38')]?_0x232ba0[_0xe47e('0x24')]:_0x184be0[_0xe47e('0x1f')];if(_0x1973f6[_0xe47e('0x20')][_0xe47e('0x2f')]){_0x232ba0[_0xe47e('0x30')]=[{'all':!![]}];}_0x232ba0=_[_0xe47e('0x2d')]({},_0x232ba0,_0x1973f6[_0xe47e('0x2e')]);return db[_0xe47e('0x1a')][_0xe47e('0x39')](_0x232ba0)[_0xe47e('0x12')](handleEntityNotFound(_0x540de5,null))[_0xe47e('0x12')](function(_0x1392a0){if(_0x1392a0[_0xe47e('0x32')]==='MicrosoftAzure'){var _0x1a9552=encryptor[_0xe47e('0x3a')](_0x1392a0[_0xe47e('0x34')]);_0x1392a0[_0xe47e('0x34')]=maskClientSecret(_0x1a9552);}return _0x1392a0;})[_0xe47e('0x12')](respondWithResult(_0x540de5,null))[_0xe47e('0x35')](handleError(_0x540de5,null));};exports[_0xe47e('0x3b')]=function(_0x363aeb,_0x5f0881){if(!_0x363aeb[_0xe47e('0x3c')][_0xe47e('0x14')])throw new Error(_0xe47e('0x3d'));if(!_0x363aeb[_0xe47e('0x3c')][_0xe47e('0x32')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x382830=db[_0xe47e('0x1a')][_0xe47e('0x1b')][_0xe47e('0x32')][_0xe47e('0x3e')];if(!_0x382830['includes'](_0x363aeb['body'][_0xe47e('0x32')]))throw new Error(_0xe47e('0x3f')+_0x382830[_0xe47e('0x40')](',\x20'));if(_0x363aeb[_0xe47e('0x3c')][_0xe47e('0x32')]===_0xe47e('0x33')&&_0x363aeb['body'][_0xe47e('0x34')]){_0x363aeb[_0xe47e('0x3c')]['data3']=encryptor['encryptString'](_0x363aeb['body']['data3']);}return db[_0xe47e('0x1a')]['create'](_0x363aeb[_0xe47e('0x3c')],{})[_0xe47e('0x12')](respondWithResult(_0x5f0881,0xc9))[_0xe47e('0x35')](handleError(_0x5f0881,null));};exports['update']=function(_0x59faf1,_0x1d6357){if(_0x59faf1[_0xe47e('0x3c')]['id']){delete _0x59faf1[_0xe47e('0x3c')]['id'];}return db[_0xe47e('0x1a')][_0xe47e('0x39')]({'where':{'id':_0x59faf1[_0xe47e('0x37')]['id']}})['then'](handleEntityNotFound(_0x1d6357,null))[_0xe47e('0x12')](function(_0x3529c5){if(_0x3529c5[_0xe47e('0x32')]===_0xe47e('0x33')&&_0x59faf1[_0xe47e('0x3c')][_0xe47e('0x34')]){_0x59faf1[_0xe47e('0x3c')][_0xe47e('0x34')]=encryptor[_0xe47e('0x41')](_0x59faf1[_0xe47e('0x3c')][_0xe47e('0x34')]);}return _0x3529c5;})[_0xe47e('0x12')](saveUpdates(_0x59faf1['body'],null))[_0xe47e('0x12')](respondWithResult(_0x1d6357,null))[_0xe47e('0x35')](handleError(_0x1d6357,null));};exports[_0xe47e('0x42')]=function(_0x3dbb65,_0x222bb5){return db['CloudProvider']['find']({'where':{'id':_0x3dbb65[_0xe47e('0x37')]['id']}})[_0xe47e('0x12')](handleEntityNotFound(_0x222bb5,null))[_0xe47e('0x12')](removeEntity(_0x222bb5,null))[_0xe47e('0x35')](handleError(_0x222bb5,null));};exports[_0xe47e('0x43')]=function(_0x3067ad,_0x2842f2){return db[_0xe47e('0x1a')][_0xe47e('0x44')]({'where':{'id':_0x3067ad[_0xe47e('0x37')]['id']},'raw':!![]})[_0xe47e('0x12')](function(_0xeb692e){if(!_0xeb692e)return _0x2842f2[_0xe47e('0x9')](0x194);return{'url':oauth[_0xe47e('0x45')](_0xeb692e,_0x3067ad['user']['id'])};})[_0xe47e('0x12')](respondWithResult(_0x2842f2,null))[_0xe47e('0x35')](handleError(_0x2842f2,null));};exports[_0xe47e('0x46')]=function(_0x8468b4,_0x32b0c1){var _0x293007=_0x8468b4[_0xe47e('0x3c')];var _0x5e463d;var _0x4e1ce9;if(_0x293007[_0xe47e('0x13')])throw _0x293007;redis[_0xe47e('0x47')](_0x293007[_0xe47e('0x48')])['then'](function(_0x36dd16){if(!_0x36dd16)throw new Error(_0xe47e('0x49'));_0x5e463d=JSON[_0xe47e('0x4a')](_0x36dd16);var _0x14864c=Buffer[_0xe47e('0x4b')](_0x293007[_0xe47e('0x48')],_0xe47e('0x4c'))[_0xe47e('0x4d')]('ascii');_0x4e1ce9=JSON[_0xe47e('0x4a')](_0x14864c);if(!oauth['isValidIdToken'](_0x293007[_0xe47e('0x4e')],_0x5e463d[_0xe47e('0x4f')]))throw new Error(_0xe47e('0x50'));redis[_0xe47e('0x51')](_0x293007[_0xe47e('0x48')]);return oauth[_0xe47e('0x52')](_0x293007[_0xe47e('0x53')],_0x5e463d);})[_0xe47e('0x12')](function(_0x34b825){_0x5e463d[_0xe47e('0x54')]=_0x34b825['access_token'];_0x5e463d[_0xe47e('0x55')]=_0x34b825[_0xe47e('0x56')];return db[_0xe47e('0x1a')][_0xe47e('0x11')]({'data5':_0x5e463d[_0xe47e('0x54')],'data6':_0x5e463d[_0xe47e('0x55')]},{'where':{'id':_0x5e463d['id']}});})['then'](function(){oauth[_0xe47e('0x57')](_0x5e463d);socket[_0xe47e('0x58')](_0xe47e('0x59'),{'id':_0x4e1ce9['id']});return;})[_0xe47e('0x12')](respondWithStatusCode(_0x32b0c1,null))[_0xe47e('0x35')](function(_0x73b466){if(_0x4e1ce9){socket[_0xe47e('0x58')]('microsoftAuthorization:error',{'id':_0x4e1ce9['id']});}if(!_0x5e463d){logger[_0xe47e('0x13')]('Invalid\x20authentication\x20state\x20parameter',_0x73b466);return _0x32b0c1[_0xe47e('0xa')](0x1f4)[_0xe47e('0x15')](_0x73b466[_0xe47e('0x5a')]);}logger[_0xe47e('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x5e463d['id'],JSON[_0xe47e('0x5b')](_0x73b466));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 422f336..a194245 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 _0x53ed=['./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2f6c84,_0x2d0559){var _0x2d686f=function(_0x12641c){while(--_0x12641c){_0x2f6c84['push'](_0x2f6c84['shift']());}};_0x2d686f(++_0x2d0559);}(_0x53ed,0x1b4));var _0xd53e=function(_0x164274,_0x478d54){_0x164274=_0x164274-0x0;var _0x3a31e9=_0x53ed[_0x164274];return _0x3a31e9;};'use strict';var _=require(_0xd53e('0x0'));var util=require(_0xd53e('0x1'));var logger=require(_0xd53e('0x2'))(_0xd53e('0x3'));var moment=require('moment');var BPromise=require(_0xd53e('0x4'));var rp=require(_0xd53e('0x5'));var fs=require('fs');var path=require(_0xd53e('0x6'));var rimraf=require(_0xd53e('0x7'));var config=require('../../config/environment');var attributes=require(_0xd53e('0x8'));module[_0xd53e('0x9')]=function(_0x39c7aa,_0x170445){return _0x39c7aa[_0xd53e('0xa')]('CloudProvider',attributes,{'tableName':_0xd53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x169b6d,_0x1580d0){var _0x3b3a31=function(_0x3cb6f9){while(--_0x3cb6f9){_0x169b6d['push'](_0x169b6d['shift']());}};_0x3b3a31(++_0x1580d0);}(_0xb458,0xca));var _0x8b45=function(_0x46b392,_0x59e8bd){_0x46b392=_0x46b392-0x0;var _0x30963a=_0xb458[_0x46b392];return _0x30963a;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))(_0x8b45('0x3'));var moment=require('moment');var BPromise=require(_0x8b45('0x4'));var rp=require(_0x8b45('0x5'));var fs=require('fs');var path=require(_0x8b45('0x6'));var rimraf=require(_0x8b45('0x7'));var config=require(_0x8b45('0x8'));var attributes=require(_0x8b45('0x9'));module[_0x8b45('0xa')]=function(_0x35680c,_0x2a5b3c){return _0x35680c[_0x8b45('0xb')](_0x8b45('0xc'),attributes,{'tableName':_0x8b45('0xd'),'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 acbd29c..44db2f6 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 _0xe19a=['bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','util','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','push','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','data1','response_type','response_mode','form_post','state','nonce','prompt','login','map','key','value','oauth2Claims','decode','iss','audience','isAfter','unix','exp','then','data3','findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','CloudProvider','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals'];(function(_0x5b24a5,_0x35591c){var _0x51736d=function(_0x4d6b48){while(--_0x4d6b48){_0x5b24a5['push'](_0x5b24a5['shift']());}};_0x51736d(++_0x35591c);}(_0xe19a,0xa3));var _0xae19=function(_0x42774c,_0x54b775){_0x42774c=_0x42774c-0x0;var _0x167bbf=_0xe19a[_0x42774c];return _0x167bbf;};'use strict';var _=require(_0xae19('0x0'));var crypto=require(_0xae19('0x1'));var jwt=require(_0xae19('0x2'));var moment=require(_0xae19('0x3'));var Redis=require(_0xae19('0x4'));var rp=require('request-promise');var util=require(_0xae19('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0xae19('0x6'));var logger=require('../../config/logger')('api');var schedule=require(_0xae19('0x7'));var db=require(_0xae19('0x8'))['db'];config['redis']=_[_0xae19('0x9')](config[_0xae19('0xa')],{'host':_0xae19('0xb'),'port':0x18eb});var redis=new Redis(config[_0xae19('0xa')]);var MICROSOFT_AUTH_URL=_0xae19('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xae19('0xd'),'profile',_0xae19('0xe'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0xae19('0xf'),_0xae19('0x10')],'Dynamics365':[_0xae19('0xd'),_0xae19('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xae19('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xae19('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x114180){var _0x540c2a=_['map'](AZURE_AUTH_SCOPES[_0x114180[_0xae19('0x14')]]);if(_0x114180[_0xae19('0x14')]==='Dynamics365')_0x540c2a[_0xae19('0x15')](_0x114180[_0xae19('0x16')]+_0xae19('0x17'));return _0x540c2a[_0xae19('0x18')]('\x20');}function getAccessTokenScope(_0x148755){if(_0x148755['type']===_0xae19('0x19'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x148755[_0xae19('0x14')]===_0xae19('0x1a'))return _0x148755[_0xae19('0x16')]+_0xae19('0x17');}function generateMicrosoftAuthorizationUrl(_0x4dac1f,_0x57168f){var _0x29558d=MICROSOFT_AUTH_URL[_0xae19('0x1b')](_0xae19('0x1c'),_0x4dac1f[_0xae19('0x1d')]);var _0x5992b8=[_0xae19('0x1e'),_0xae19('0x1f')];var _0xc49353=Buffer[_0xae19('0x20')](JSON[_0xae19('0x21')]({'id':_0x57168f}))[_0xae19('0x22')](_0xae19('0x23'));var _0x10d500=crypto[_0xae19('0x24')](0x10)[_0xae19('0x22')](_0xae19('0x25'));var _0x33fde3=getAuthorizationScopes(_0x4dac1f);var _0xfc2670=[{'key':'client_id','value':_0x4dac1f[_0xae19('0x26')]},{'key':_0xae19('0x27'),'value':encodeURIComponent(_0x5992b8[_0xae19('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x4dac1f['data4']},{'key':_0xae19('0x28'),'value':_0xae19('0x29')},{'key':'scope','value':encodeURIComponent(_0x33fde3)},{'key':_0xae19('0x2a'),'value':_0xc49353},{'key':_0xae19('0x2b'),'value':_0x10d500},{'key':_0xae19('0x2c'),'value':_0xae19('0x2d')}];var _0x116eea=_0x29558d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xae19('0x2e')](_0xfc2670,function(_0x1ce0eb){return _0x1ce0eb[_0xae19('0x2f')]+'='+_0x1ce0eb[_0xae19('0x30')];})[_0xae19('0x18')]('&');_0x4dac1f[_0xae19('0x31')]={'issuer':_0x29558d[_0xae19('0x1b')]('oauth2/',''),'audience':_0x4dac1f[_0xae19('0x26')],'state':_0xc49353,'nonce':_0x10d500};redis['set'](_0xc49353,JSON[_0xae19('0x21')](_0x4dac1f));return _0x116eea;}function isValidIdToken(_0x2a8eef,_0x40f431){try{var _0x44db46=jwt[_0xae19('0x32')](_0x2a8eef,{'complete':!![]});var _0x573f85=_0x44db46['payload'];if(_0x573f85[_0xae19('0x33')]!==_0x40f431['issuer'])return![];if(_0x573f85['aud']!==_0x40f431[_0xae19('0x34')])return![];if(_0x573f85[_0xae19('0x2b')]!==_0x40f431[_0xae19('0x2b')])return![];if(moment()[_0xae19('0x35')](moment[_0xae19('0x36')](_0x573f85[_0xae19('0x37')])))return![];return!![];}catch(_0x4f1c8e){throw _0x4f1c8e;}}function refreshOauth2MicrosoftAccessToken(_0x1d97f0){return Promise['resolve']()[_0xae19('0x38')](function(){if(_0x1d97f0[_0xae19('0x39')])return _0x1d97f0;return db['CloudProvider'][_0xae19('0x3a')]({'where':{'id':_0x1d97f0['id']},'raw':!![]});})[_0xae19('0x38')](function(_0x161a9f){var _0x596b72={'grant_type':_0xae19('0x3b'),'refresh_token':_0x161a9f[_0xae19('0x3c')],'scope':getAccessTokenScope(_0x161a9f),'redirect_uri':_0x161a9f[_0xae19('0x3d')],'client_id':_0x161a9f[_0xae19('0x26')],'client_secret':encryptor[_0xae19('0x3e')](_0x161a9f['data3'])};var _0x5e9d84={'method':_0xae19('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xae19('0x1b')](_0xae19('0x1c'),_0x161a9f[_0xae19('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x596b72,'json':!![]};return rp(_0x5e9d84);})[_0xae19('0x38')](function(_0x42709a){_0x1d97f0[_0xae19('0x40')]=_0x42709a[_0xae19('0x41')];_0x1d97f0[_0xae19('0x3c')]=_0x42709a[_0xae19('0x3b')];return db[_0xae19('0x42')][_0xae19('0x43')]({'data5':_0x1d97f0[_0xae19('0x40')],'data6':_0x1d97f0[_0xae19('0x3c')]},{'where':{'id':_0x1d97f0['id']}});})['then'](function(){return _0x1d97f0;})[_0xae19('0x44')](function(_0x2b7750){logger['error'](_0xae19('0x45'),_0x1d97f0['id'],_0x2b7750);});}function getOauth2MicrosoftAccessToken(_0x394409,_0x576e61){var _0x12cc8c={'grant_type':'authorization_code','code':_0x394409,'scope':getAccessTokenScope(_0x576e61),'redirect_uri':_0x576e61[_0xae19('0x3d')],'client_id':_0x576e61[_0xae19('0x26')],'client_secret':encryptor['decryptString'](_0x576e61[_0xae19('0x39')])};var _0x163e54={'method':_0xae19('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xae19('0x1c'),_0x576e61['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12cc8c,'json':!![]};return rp(_0x163e54);}function startRefreshInterval(_0x56019a){var _0x37dfaf=schedule[_0xae19('0x46')];if(_0x37dfaf[_0x56019a['id']])clearInterval(_0x37dfaf[_0x56019a['id']]);_0x37dfaf[_0x56019a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xae19('0x47')](this,{'id':_0x56019a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xae19('0x46')]=_0x37dfaf;}function startAllRefreshIntervals(){return db[_0xae19('0x42')][_0xae19('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xae19('0x38')](function(_0x1f4c82){var _0x222512=_0x1f4c82[_0xae19('0x2e')](function(_0x59b75b){return refreshOauth2MicrosoftAccessToken(_0x59b75b)[_0xae19('0x38')](function(_0x1436d8){startRefreshInterval(_0x1436d8);});});return Promise[_0xae19('0x49')](_0x222512);})[_0xae19('0x44')](function(_0x2e64be){var _0x3c47b7=_0x2e64be?util[_0xae19('0x4a')](_0x2e64be,{'showHidden':![],'depth':null}):'';logger[_0xae19('0x4b')](_0xae19('0x4c'),_0x3c47b7);});}module[_0xae19('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8c48=['isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','data6','data4','decryptString','access_token','refresh_token','data5','catch','authorization_code','POST','bind','intervals','findAll','inspect','exports','lodash','crypto','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','id_token','from','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','scope','state','prompt','login','value','oauth2/','set','decode','payload','iss','issuer','aud','audience'];(function(_0x2bd631,_0x34146e){var _0xfe899a=function(_0x54e093){while(--_0x54e093){_0x2bd631['push'](_0x2bd631['shift']());}};_0xfe899a(++_0x34146e);}(_0x8c48,0xac));var _0x88c4=function(_0x359c24,_0x1328c9){_0x359c24=_0x359c24-0x0;var _0x3d1984=_0x8c48[_0x359c24];return _0x3d1984;};'use strict';var _=require(_0x88c4('0x0'));var crypto=require(_0x88c4('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x88c4('0x2'));var Redis=require(_0x88c4('0x3'));var rp=require(_0x88c4('0x4'));var util=require('util');var encryptor=require(_0x88c4('0x5'));var config=require(_0x88c4('0x6'));var logger=require(_0x88c4('0x7'))(_0x88c4('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x88c4('0x9')]=_[_0x88c4('0xa')](config['redis'],{'host':_0x88c4('0xb'),'port':0x18eb});var redis=new Redis(config[_0x88c4('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x88c4('0xc'),_0x88c4('0xd'),_0x88c4('0xe'),'offline_access',_0x88c4('0xf'),_0x88c4('0x10'),_0x88c4('0x11')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x88c4('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2e3fe8){var _0x3144f6=_[_0x88c4('0x13')](AZURE_AUTH_SCOPES[_0x2e3fe8['type']]);if(_0x2e3fe8[_0x88c4('0x14')]===_0x88c4('0x15'))_0x3144f6[_0x88c4('0x16')](_0x2e3fe8[_0x88c4('0x17')]+_0x88c4('0x18'));return _0x3144f6[_0x88c4('0x19')]('\x20');}function getAccessTokenScope(_0x2fefbe){if(_0x2fefbe[_0x88c4('0x14')]==='Outlook365')return _0x88c4('0xf');if(_0x2fefbe[_0x88c4('0x14')]===_0x88c4('0x15'))return _0x2fefbe[_0x88c4('0x17')]+_0x88c4('0x18');}function generateMicrosoftAuthorizationUrl(_0xc389f6,_0x9b4870){var _0x31ffc8=MICROSOFT_AUTH_URL[_0x88c4('0x1a')](_0x88c4('0x1b'),_0xc389f6[_0x88c4('0x1c')]);var _0x5defcb=[_0x88c4('0x1d'),_0x88c4('0x1e')];var _0x1543c7=Buffer[_0x88c4('0x1f')](JSON['stringify']({'id':_0x9b4870}))[_0x88c4('0x20')]('base64');var _0x174cbc=crypto[_0x88c4('0x21')](0x10)[_0x88c4('0x20')](_0x88c4('0x22'));var _0x58e30f=getAuthorizationScopes(_0xc389f6);var _0x4efd51=[{'key':_0x88c4('0x23'),'value':_0xc389f6[_0x88c4('0x24')]},{'key':_0x88c4('0x25'),'value':encodeURIComponent(_0x5defcb[_0x88c4('0x19')]('\x20'))},{'key':_0x88c4('0x26'),'value':_0xc389f6['data4']},{'key':_0x88c4('0x27'),'value':'form_post'},{'key':_0x88c4('0x28'),'value':encodeURIComponent(_0x58e30f)},{'key':_0x88c4('0x29'),'value':_0x1543c7},{'key':'nonce','value':_0x174cbc},{'key':_0x88c4('0x2a'),'value':_0x88c4('0x2b')}];var _0x4efe04=_0x31ffc8+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4efd51,function(_0x494789){return _0x494789['key']+'='+_0x494789[_0x88c4('0x2c')];})[_0x88c4('0x19')]('&');_0xc389f6['oauth2Claims']={'issuer':_0x31ffc8['replace'](_0x88c4('0x2d'),''),'audience':_0xc389f6[_0x88c4('0x24')],'state':_0x1543c7,'nonce':_0x174cbc};redis[_0x88c4('0x2e')](_0x1543c7,JSON['stringify'](_0xc389f6));return _0x4efe04;}function isValidIdToken(_0x2ecb1c,_0x49b3e8){try{var _0x271535=jwt[_0x88c4('0x2f')](_0x2ecb1c,{'complete':!![]});var _0x3dee13=_0x271535[_0x88c4('0x30')];if(_0x3dee13[_0x88c4('0x31')]!==_0x49b3e8[_0x88c4('0x32')])return![];if(_0x3dee13[_0x88c4('0x33')]!==_0x49b3e8[_0x88c4('0x34')])return![];if(_0x3dee13['nonce']!==_0x49b3e8['nonce'])return![];if(moment()[_0x88c4('0x35')](moment[_0x88c4('0x36')](_0x3dee13[_0x88c4('0x37')])))return![];return!![];}catch(_0x27d587){throw _0x27d587;}}function refreshOauth2MicrosoftAccessToken(_0x490c59){return Promise[_0x88c4('0x38')]()[_0x88c4('0x39')](function(){if(_0x490c59[_0x88c4('0x3a')])return _0x490c59;return db[_0x88c4('0x3b')][_0x88c4('0x3c')]({'where':{'id':_0x490c59['id']},'raw':!![]});})['then'](function(_0x4ce586){var _0x8b0cce={'grant_type':'refresh_token','refresh_token':_0x4ce586[_0x88c4('0x3d')],'scope':getAccessTokenScope(_0x4ce586),'redirect_uri':_0x4ce586[_0x88c4('0x3e')],'client_id':_0x4ce586[_0x88c4('0x24')],'client_secret':encryptor[_0x88c4('0x3f')](_0x4ce586[_0x88c4('0x3a')])};var _0x196a5f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x88c4('0x1a')](_0x88c4('0x1b'),_0x4ce586[_0x88c4('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x8b0cce,'json':!![]};return rp(_0x196a5f);})[_0x88c4('0x39')](function(_0x3934d4){_0x490c59['data5']=_0x3934d4[_0x88c4('0x40')];_0x490c59[_0x88c4('0x3d')]=_0x3934d4[_0x88c4('0x41')];return db[_0x88c4('0x3b')]['update']({'data5':_0x490c59[_0x88c4('0x42')],'data6':_0x490c59[_0x88c4('0x3d')]},{'where':{'id':_0x490c59['id']}});})[_0x88c4('0x39')](function(){return _0x490c59;})[_0x88c4('0x43')](function(_0x4a1aa0){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x490c59['id'],_0x4a1aa0);});}function getOauth2MicrosoftAccessToken(_0x55d5d8,_0x4d510f){var _0x321026={'grant_type':_0x88c4('0x44'),'code':_0x55d5d8,'scope':getAccessTokenScope(_0x4d510f),'redirect_uri':_0x4d510f[_0x88c4('0x3e')],'client_id':_0x4d510f[_0x88c4('0x24')],'client_secret':encryptor['decryptString'](_0x4d510f['data3'])};var _0x4de286={'method':_0x88c4('0x45'),'uri':MICROSOFT_AUTH_URL[_0x88c4('0x1a')]('{TENANT_ID}',_0x4d510f[_0x88c4('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x321026,'json':!![]};return rp(_0x4de286);}function startRefreshInterval(_0x2488dc){var _0x6c198e=schedule['intervals'];if(_0x6c198e[_0x2488dc['id']])clearInterval(_0x6c198e[_0x2488dc['id']]);_0x6c198e[_0x2488dc['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x88c4('0x46')](this,{'id':_0x2488dc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x88c4('0x47')]=_0x6c198e;}function startAllRefreshIntervals(){return db[_0x88c4('0x3b')][_0x88c4('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x88c4('0x39')](function(_0x2cbad8){var _0x3c6e3e=_0x2cbad8[_0x88c4('0x13')](function(_0x160033){return refreshOauth2MicrosoftAccessToken(_0x160033)[_0x88c4('0x39')](function(_0x16775c){startRefreshInterval(_0x16775c);});});return Promise['all'](_0x3c6e3e);})['catch'](function(_0x17b89f){var _0x5bc925=_0x17b89f?util[_0x88c4('0x49')](_0x17b89f,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x5bc925);});}module[_0x88c4('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 0377c66..843b2ed 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 _0x09d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x479e5e,_0x81eb82){var _0x1066ba=function(_0xb84d29){while(--_0xb84d29){_0x479e5e['push'](_0x479e5e['shift']());}};_0x1066ba(++_0x81eb82);}(_0x09d2,0x1d2));var _0x209d=function(_0x5aa687,_0x13ac13){_0x5aa687=_0x5aa687-0x0;var _0x37f63e=_0x09d2[_0x5aa687];return _0x37f63e;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require(_0x209d('0x4'));var fs=require('fs');var Redis=require(_0x209d('0x5'));var db=require(_0x209d('0x6'))['db'];var utils=require(_0x209d('0x7'));var logger=require(_0x209d('0x8'))(_0x209d('0x9'));var config=require('../../config/environment');var jayson=require(_0x209d('0xa'));var client=jayson[_0x209d('0xb')][_0x209d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x204ab9,_0xc141e6,_0x5b460d){return new BPromise(function(_0x49cd7a,_0x306753){return client[_0x209d('0xd')](_0x204ab9,_0x5b460d)[_0x209d('0xe')](function(_0x48c52d){logger[_0x209d('0xf')]('CloudProvider,\x20%s,\x20%s',_0xc141e6,_0x209d('0x10'));logger[_0x209d('0x11')](_0x209d('0x12'),_0xc141e6,_0x209d('0x10'),JSON[_0x209d('0x13')](_0x48c52d));if(_0x48c52d[_0x209d('0x14')]){if(_0x48c52d[_0x209d('0x14')][_0x209d('0x15')]===0x1f4){logger[_0x209d('0x14')](_0x209d('0x16'),_0xc141e6,_0x48c52d[_0x209d('0x14')][_0x209d('0x17')]);return _0x306753(_0x48c52d['error'][_0x209d('0x17')]);}logger[_0x209d('0x14')](_0x209d('0x16'),_0xc141e6,_0x48c52d['error']['message']);return _0x49cd7a(_0x48c52d[_0x209d('0x14')]['message']);}else{logger['info'](_0x209d('0x16'),_0xc141e6,_0x209d('0x10'));_0x49cd7a(_0x48c52d[_0x209d('0x18')]['message']);}})[_0x209d('0x19')](function(_0xe0721){logger[_0x209d('0x14')](_0x209d('0x16'),_0xc141e6,_0xe0721);_0x306753(_0xe0721);});});} \ No newline at end of file +var _0x3fc6=['http','request','then','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x3fc6,0x115));var _0x63fc=function(_0x4b8b88,_0x2a81b8){_0x4b8b88=_0x4b8b88-0x0;var _0x79c20=_0x3fc6[_0x4b8b88];return _0x79c20;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c7f72,_0x3e8157,_0x571ab6){return new BPromise(function(_0x3ec832,_0xffe000){return client[_0x63fc('0xa')](_0x1c7f72,_0x571ab6)[_0x63fc('0xb')](function(_0x32749b){logger['info'](_0x63fc('0xc'),_0x3e8157,'request\x20sent');logger['debug'](_0x63fc('0xd'),_0x3e8157,_0x63fc('0xe'),JSON[_0x63fc('0xf')](_0x32749b));if(_0x32749b[_0x63fc('0x10')]){if(_0x32749b[_0x63fc('0x10')][_0x63fc('0x11')]===0x1f4){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x32749b['error'][_0x63fc('0x12')]);return _0xffe000(_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);}logger['error'](_0x63fc('0xc'),_0x3e8157,_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);return _0x3ec832(_0x32749b['error'][_0x63fc('0x12')]);}else{logger[_0x63fc('0x13')](_0x63fc('0xc'),_0x3e8157,_0x63fc('0xe'));_0x3ec832(_0x32749b[_0x63fc('0x14')][_0x63fc('0x12')]);}})[_0x63fc('0x15')](function(_0x19a3f2){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x19a3f2);_0xffe000(_0x19a3f2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bc07e8d..1b4972f 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x2381db,_0x4ff285){var _0x17ba66=function(_0x2d874a){while(--_0x2d874a){_0x2381db['push'](_0x2381db['shift']());}};_0x17ba66(++_0x4ff285);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x3f555b,_0x5bc688){var _0x112df6=function(_0x509f47){while(--_0x509f47){_0x3f555b['push'](_0x3f555b['shift']());}};_0x112df6(++_0x5bc688);}(_0x2ef3,0xba));var _0x32ef=function(_0x31a414,_0x24d750){_0x31a414=_0x31a414-0x0;var _0x2584d4=_0x2ef3[_0x31a414];return _0x2584d4;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b3f51a8..f8f0197 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 _0x7284=['STRING','name','exports'];(function(_0x31cf5b,_0x3405c7){var _0x3f8bc6=function(_0xc41e88){while(--_0xc41e88){_0x31cf5b['push'](_0x31cf5b['shift']());}};_0x3f8bc6(++_0x3405c7);}(_0x7284,0xe6));var _0x4728=function(_0x12e476,_0x1878a0){_0x12e476=_0x12e476-0x0;var _0x31c3d3=_0x7284[_0x12e476];return _0x31c3d3;};'use strict';var Sequelize=require('sequelize');module[_0x4728('0x0')]={'name':{'type':Sequelize[_0x4728('0x1')],'unique':_0x4728('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4728('0x1')]},'companyId':{'type':Sequelize[_0x4728('0x1')]},'website':{'type':Sequelize[_0x4728('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x4728('0x1')]},'type':{'type':Sequelize[_0x4728('0x1')]},'street':{'type':Sequelize[_0x4728('0x1')]},'postalCode':{'type':Sequelize[_0x4728('0x1')]},'city':{'type':Sequelize[_0x4728('0x1')]},'country':{'type':Sequelize[_0x4728('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4728('0x1')]},'sStreet':{'type':Sequelize[_0x4728('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4728('0x1')]},'sCountry':{'type':Sequelize[_0x4728('0x1')]},'description':{'type':Sequelize[_0x4728('0x1')]}}; \ No newline at end of file +var _0xb30b=['name','exports','STRING'];(function(_0x528733,_0x26f73a){var _0x68a7b4=function(_0xc89351){while(--_0xc89351){_0x528733['push'](_0x528733['shift']());}};_0x68a7b4(++_0x26f73a);}(_0xb30b,0xf4));var _0xbb30=function(_0x33ae87,_0x1389c2){_0x33ae87=_0x33ae87-0x0;var _0x408461=_0xb30b[_0x33ae87];return _0x408461;};'use strict';var Sequelize=require('sequelize');module[_0xbb30('0x0')]={'name':{'type':Sequelize[_0xbb30('0x1')],'unique':_0xbb30('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbb30('0x1')]},'companyId':{'type':Sequelize[_0xbb30('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbb30('0x1')]},'fax':{'type':Sequelize[_0xbb30('0x1')]},'type':{'type':Sequelize[_0xbb30('0x1')]},'street':{'type':Sequelize[_0xbb30('0x1')]},'postalCode':{'type':Sequelize[_0xbb30('0x1')]},'city':{'type':Sequelize[_0xbb30('0x1')]},'country':{'type':Sequelize[_0xbb30('0x1')]},'email':{'type':Sequelize[_0xbb30('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbb30('0x1')]},'sStreet':{'type':Sequelize[_0xbb30('0x1')]},'sPostalCode':{'type':Sequelize[_0xbb30('0x1')]},'sCity':{'type':Sequelize[_0xbb30('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb30('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cf2c6a1..aaf475b 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 _0x5a20=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','params','rawAttributes','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','ids','omit','findOne','getContacts','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4e2322,_0x455fc9){var _0x35a55b=function(_0x38396d){while(--_0x38396d){_0x4e2322['push'](_0x4e2322['shift']());}};_0x35a55b(++_0x455fc9);}(_0x5a20,0xfd));var _0x05a2=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x5a20[_0x3fcc20];return _0x15d3ce;};'use strict';var emlformat=require(_0x05a2('0x0'));var rimraf=require(_0x05a2('0x1'));var zipdir=require(_0x05a2('0x2'));var jsonpatch=require(_0x05a2('0x3'));var rp=require('request-promise');var moment=require(_0x05a2('0x4'));var BPromise=require(_0x05a2('0x5'));var Mustache=require('mustache');var util=require(_0x05a2('0x6'));var path=require(_0x05a2('0x7'));var sox=require(_0x05a2('0x8'));var csv=require(_0x05a2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05a2('0xa'));var _=require(_0x05a2('0xb'));var squel=require(_0x05a2('0xc'));var crypto=require(_0x05a2('0xd'));var jsforce=require(_0x05a2('0xe'));var deskjs=require(_0x05a2('0xf'));var toCsv=require(_0x05a2('0x9'));var querystring=require(_0x05a2('0x10'));var Papa=require(_0x05a2('0x11'));var Redis=require(_0x05a2('0x12'));var authService=require(_0x05a2('0x13'));var qs=require(_0x05a2('0x14'));var as=require(_0x05a2('0x15'));var hardwareService=require(_0x05a2('0x16'));var logger=require(_0x05a2('0x17'))(_0x05a2('0x18'));var utils=require(_0x05a2('0x19'));var config=require(_0x05a2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6f7b,_0x1e0ee2){_0x1e0ee2=_0x1e0ee2||0xcc;return function(_0x5a2b66){if(_0x5a2b66){return _0x3c6f7b['sendStatus'](_0x1e0ee2);}return _0x3c6f7b[_0x05a2('0x1b')](_0x1e0ee2)[_0x05a2('0x1c')]();};}function respondWithResult(_0x325781,_0x24879e){_0x24879e=_0x24879e||0xc8;return function(_0x2fd67c){if(_0x2fd67c){return _0x325781[_0x05a2('0x1b')](_0x24879e)[_0x05a2('0x1d')](_0x2fd67c);}};}function respondWithFilteredResult(_0x3bc984,_0x42e141){return function(_0x3f19e4){if(_0x3f19e4){var _0x4129a2=typeof _0x42e141[_0x05a2('0x1e')]===_0x05a2('0x1f')&&typeof _0x42e141['limit']===_0x05a2('0x1f');var _0x4fa824=_0x3f19e4[_0x05a2('0x20')];var _0x4cc114=_0x4129a2?0x0:_0x42e141[_0x05a2('0x1e')];var _0x5821bf=_0x4129a2?_0x3f19e4[_0x05a2('0x20')]:_0x42e141[_0x05a2('0x1e')]+_0x42e141[_0x05a2('0x21')];var _0x9d33a3;if(_0x5821bf>=_0x4fa824){_0x5821bf=_0x4fa824;_0x9d33a3=0xc8;}else{_0x9d33a3=0xce;}_0x3bc984['status'](_0x9d33a3);return _0x3bc984[_0x05a2('0x22')](_0x05a2('0x23'),_0x4cc114+'-'+_0x5821bf+'/'+_0x4fa824)[_0x05a2('0x1d')](_0x3f19e4);}return null;};}function patchUpdates(_0x5243e0){return function(_0x3c6317){try{jsonpatch[_0x05a2('0x24')](_0x3c6317,_0x5243e0,!![]);}catch(_0x1f78da){return BPromise[_0x05a2('0x25')](_0x1f78da);}return _0x3c6317['save']();};}function saveUpdates(_0x55f44a,_0x4a63ec){return function(_0x4c7aa9){if(_0x4c7aa9){return _0x4c7aa9['update'](_0x55f44a)[_0x05a2('0x26')](function(_0x173c47){return _0x173c47;});}return null;};}function removeEntity(_0x31e86b,_0x3a732c){return function(_0x2160e3){if(_0x2160e3){return _0x2160e3[_0x05a2('0x27')]()['then'](function(){var _0x27c7eb=_0x2160e3[_0x05a2('0x28')]({'plain':!![]});var _0x2cd140='Companies';return db[_0x05a2('0x29')]['destroy']({'where':{'type':_0x2cd140,'resourceId':_0x27c7eb['id']}})['then'](function(){return _0x2160e3;});})[_0x05a2('0x26')](function(){_0x31e86b[_0x05a2('0x1b')](0xcc)[_0x05a2('0x1c')]();});}};}function handleEntityNotFound(_0x3edc22,_0xbf67ff){return function(_0x44b5ff){if(!_0x44b5ff){_0x3edc22[_0x05a2('0x2a')](0x194);}return _0x44b5ff;};}function handleError(_0x28989b,_0x539058){_0x539058=_0x539058||0x1f4;return function(_0x4e362e){logger[_0x05a2('0x2b')](_0x4e362e[_0x05a2('0x2c')]);if(_0x4e362e[_0x05a2('0x2d')]){delete _0x4e362e[_0x05a2('0x2d')];}_0x28989b[_0x05a2('0x1b')](_0x539058)['send'](_0x4e362e);};}exports[_0x05a2('0x2e')]=function(_0x3b6480,_0x28d23b){var _0x1ff812={},_0x5e2d12={},_0x18e280={'count':0x0,'rows':[]};return db[_0x05a2('0x2f')][_0x05a2('0x30')]()['then'](function(_0x1a32af){_0x5e2d12[_0x05a2('0x31')]=_[_0x05a2('0x32')](_0x1a32af);_0x5e2d12[_0x05a2('0x33')]=_[_0x05a2('0x32')](_0x3b6480['query']);_0x5e2d12[_0x05a2('0x34')]=_[_0x05a2('0x35')](_0x5e2d12['model'],_0x5e2d12['query']);_0x1ff812['attributes']=_[_0x05a2('0x35')](_0x5e2d12[_0x05a2('0x31')],qs['fields'](_0x3b6480['query'][_0x05a2('0x36')]));_0x1ff812['attributes']=_0x1ff812['attributes'][_0x05a2('0x37')]?_0x1ff812[_0x05a2('0x38')]:_0x5e2d12[_0x05a2('0x31')];if(!_0x3b6480[_0x05a2('0x33')][_0x05a2('0x39')]('nolimit')){_0x1ff812[_0x05a2('0x21')]=qs[_0x05a2('0x21')](_0x3b6480['query'][_0x05a2('0x21')]);_0x1ff812[_0x05a2('0x1e')]=qs[_0x05a2('0x1e')](_0x3b6480['query'][_0x05a2('0x1e')]);}_0x1ff812[_0x05a2('0x3a')]=qs[_0x05a2('0x3b')](_0x3b6480[_0x05a2('0x33')]['sort']);_0x1ff812[_0x05a2('0x3c')]=qs[_0x05a2('0x34')](_[_0x05a2('0x3d')](_0x3b6480[_0x05a2('0x33')],_0x5e2d12[_0x05a2('0x34')]),_0x1a32af);if(_0x3b6480[_0x05a2('0x33')][_0x05a2('0x3e')]){_0x1ff812['where']=_[_0x05a2('0x3f')](_0x1ff812[_0x05a2('0x3c')],{'$or':_[_0x05a2('0x40')](_0x1ff812['attributes'],function(_0x2f0257){var _0x2ec751={};_0x2ec751[_0x2f0257]={'$like':'%'+_0x3b6480[_0x05a2('0x33')][_0x05a2('0x3e')]+'%'};return _0x2ec751;})});}_0x1ff812=_[_0x05a2('0x3f')]({},_0x1ff812,_0x3b6480[_0x05a2('0x41')]);var _0x30dc25={'where':_0x1ff812[_0x05a2('0x3c')]};return db[_0x05a2('0x2f')][_0x05a2('0x20')](_0x30dc25)[_0x05a2('0x26')](function(_0x1e2f3f){_0x18e280[_0x05a2('0x20')]=_0x1e2f3f;if(_0x3b6480[_0x05a2('0x33')]['includeAll']){_0x1ff812[_0x05a2('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0x05a2('0x43')](_0x1ff812);})[_0x05a2('0x26')](function(_0x264da3){_0x18e280[_0x05a2('0x44')]=_0x264da3;return _0x18e280;})['then'](respondWithFilteredResult(_0x28d23b,_0x1ff812))['catch'](handleError(_0x28d23b,null));})[_0x05a2('0x45')](handleError(_0x28d23b,null));};exports['show']=function(_0x1bd145,_0x540b61){var _0x5af3df={'raw':![],'where':{'id':_0x1bd145[_0x05a2('0x46')]['id']}},_0x4b8b19={};_0x4b8b19[_0x05a2('0x31')]=_[_0x05a2('0x32')](db[_0x05a2('0x2f')][_0x05a2('0x47')]);_0x4b8b19[_0x05a2('0x33')]=_['keys'](_0x1bd145[_0x05a2('0x33')]);_0x4b8b19[_0x05a2('0x34')]=_['intersection'](_0x4b8b19[_0x05a2('0x31')],_0x4b8b19[_0x05a2('0x33')]);_0x5af3df[_0x05a2('0x38')]=_['intersection'](_0x4b8b19[_0x05a2('0x31')],qs[_0x05a2('0x36')](_0x1bd145['query'][_0x05a2('0x36')]));_0x5af3df['attributes']=_0x5af3df[_0x05a2('0x38')]['length']?_0x5af3df['attributes']:_0x4b8b19[_0x05a2('0x31')];if(_0x1bd145[_0x05a2('0x33')][_0x05a2('0x48')]){_0x5af3df[_0x05a2('0x42')]=[{'all':!![]}];}_0x5af3df=_[_0x05a2('0x3f')]({},_0x5af3df,_0x1bd145['options']);return db[_0x05a2('0x2f')]['find'](_0x5af3df)[_0x05a2('0x26')](handleEntityNotFound(_0x540b61,null))[_0x05a2('0x26')](respondWithResult(_0x540b61,null))[_0x05a2('0x45')](handleError(_0x540b61,null));};exports[_0x05a2('0x49')]=function(_0x5f1b43,_0x58f5bf){return db['CmCompany'][_0x05a2('0x49')](_0x5f1b43[_0x05a2('0x4a')],{})['then'](function(_0x1252a8){var _0x3cdc52=_0x5f1b43['user'][_0x05a2('0x28')]({'plain':!![]});if(!_0x3cdc52)throw new Error(_0x05a2('0x4b'));if(_0x3cdc52[_0x05a2('0x4c')]==='user'){var _0x150ddf=_0x1252a8['get']({'plain':!![]});var _0x373a27=_0x05a2('0x4d');return db[_0x05a2('0x4e')][_0x05a2('0x4f')]({'where':{'name':_0x373a27,'userProfileId':_0x3cdc52[_0x05a2('0x50')]},'raw':!![]})[_0x05a2('0x26')](function(_0x18a6fc){if(_0x18a6fc&&_0x18a6fc[_0x05a2('0x51')]===0x0){return db[_0x05a2('0x29')]['create']({'name':_0x150ddf['name'],'resourceId':_0x150ddf['id'],'type':_0x18a6fc[_0x05a2('0x2d')],'sectionId':_0x18a6fc['id']},{})[_0x05a2('0x26')](function(){return _0x1252a8;});}else{return _0x1252a8;}})[_0x05a2('0x45')](function(_0x1f7eb7){logger[_0x05a2('0x2b')](_0x05a2('0x52'),_0x1f7eb7);throw _0x1f7eb7;});}return _0x1252a8;})[_0x05a2('0x26')](respondWithResult(_0x58f5bf,0xc9))[_0x05a2('0x45')](handleError(_0x58f5bf,null));};exports[_0x05a2('0x53')]=function(_0x1a1206,_0x1b8385){if(_0x1a1206[_0x05a2('0x4a')]['id']){delete _0x1a1206[_0x05a2('0x4a')]['id'];}return db[_0x05a2('0x2f')][_0x05a2('0x4f')]({'where':{'id':_0x1a1206[_0x05a2('0x46')]['id']}})[_0x05a2('0x26')](handleEntityNotFound(_0x1b8385,null))[_0x05a2('0x26')](saveUpdates(_0x1a1206[_0x05a2('0x4a')],null))[_0x05a2('0x26')](respondWithResult(_0x1b8385,null))[_0x05a2('0x45')](handleError(_0x1b8385,null));};exports[_0x05a2('0x27')]=function(_0x26abbe,_0x22a579){return db[_0x05a2('0x2f')][_0x05a2('0x4f')]({'where':{'id':_0x26abbe[_0x05a2('0x46')]['id']}})[_0x05a2('0x26')](handleEntityNotFound(_0x22a579,null))[_0x05a2('0x26')](removeEntity(_0x22a579,null))[_0x05a2('0x45')](handleError(_0x22a579,null));};exports['describe']=function(_0x170ac2,_0x1e35d3){return db[_0x05a2('0x2f')]['describe']()[_0x05a2('0x26')](respondWithResult(_0x1e35d3,null))[_0x05a2('0x45')](handleError(_0x1e35d3,null));};exports[_0x05a2('0x54')]=function(_0x10fa43,_0x5e2be9,_0x44486f){return db['CmContact'][_0x05a2('0x4f')]({'where':{'id':_0x10fa43[_0x05a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e2be9,null))[_0x05a2('0x26')](function(_0x3e9ff6){if(_0x3e9ff6){return _0x3e9ff6['addContacts'](_0x10fa43[_0x05a2('0x4a')][_0x05a2('0x55')],_[_0x05a2('0x56')](_0x10fa43[_0x05a2('0x4a')],[_0x05a2('0x55'),'id'])||{});}})[_0x05a2('0x26')](respondWithResult(_0x5e2be9,null))['catch'](handleError(_0x5e2be9,null));};exports['getContacts']=function(_0x31f9c0,_0x255633,_0x1dd808){var _0xdae087={};var _0x17e81d={};var _0xf75f1b;var _0x52163c;return db[_0x05a2('0x2f')][_0x05a2('0x57')]({'where':{'id':_0x31f9c0[_0x05a2('0x46')]['id']}})['then'](handleEntityNotFound(_0x255633,null))[_0x05a2('0x26')](function(_0x5b48e2){if(_0x5b48e2){_0xf75f1b=_0x5b48e2;_0x17e81d[_0x05a2('0x31')]=_[_0x05a2('0x32')](db['CmContact']['rawAttributes']);_0x17e81d[_0x05a2('0x33')]=_[_0x05a2('0x32')](_0x31f9c0['query']);_0x17e81d[_0x05a2('0x34')]=_[_0x05a2('0x35')](_0x17e81d[_0x05a2('0x31')],_0x17e81d['query']);_0xdae087[_0x05a2('0x38')]=_[_0x05a2('0x35')](_0x17e81d['model'],qs['fields'](_0x31f9c0[_0x05a2('0x33')]['fields']));_0xdae087['attributes']=_0xdae087[_0x05a2('0x38')]['length']?_0xdae087[_0x05a2('0x38')]:_0x17e81d[_0x05a2('0x31')];_0xdae087[_0x05a2('0x3a')]=qs[_0x05a2('0x3b')](_0x31f9c0[_0x05a2('0x33')][_0x05a2('0x3b')]);_0xdae087['where']=qs[_0x05a2('0x34')](_[_0x05a2('0x3d')](_0x31f9c0[_0x05a2('0x33')],_0x17e81d[_0x05a2('0x34')]));if(_0x31f9c0['query']['filter']){_0xdae087[_0x05a2('0x3c')]=_[_0x05a2('0x3f')](_0xdae087['where'],{'$or':_[_0x05a2('0x40')](_0xdae087[_0x05a2('0x38')],function(_0x4f8b6e){var _0x3ab254={};_0x3ab254[_0x4f8b6e]={'$like':'%'+_0x31f9c0[_0x05a2('0x33')]['filter']+'%'};return _0x3ab254;})});}_0xdae087=_[_0x05a2('0x3f')]({},_0xdae087,_0x31f9c0['options']);return _0xf75f1b[_0x05a2('0x58')](_0xdae087);}})[_0x05a2('0x26')](function(_0x52eba3){if(_0x52eba3){_0x52163c=_0x52eba3[_0x05a2('0x37')];if(!_0x31f9c0[_0x05a2('0x33')][_0x05a2('0x39')](_0x05a2('0x59'))){_0xdae087[_0x05a2('0x21')]=qs[_0x05a2('0x21')](_0x31f9c0[_0x05a2('0x33')]['limit']);_0xdae087[_0x05a2('0x1e')]=qs['offset'](_0x31f9c0[_0x05a2('0x33')][_0x05a2('0x1e')]);}return _0xf75f1b[_0x05a2('0x58')](_0xdae087);}})['then'](function(_0x38729b){if(_0x38729b){return _0x38729b?{'count':_0x52163c,'rows':_0x38729b}:null;}})[_0x05a2('0x26')](respondWithResult(_0x255633,null))['catch'](handleError(_0x255633,null));}; \ No newline at end of file +var _0x8436=['length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','filter','options','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','create','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','CmContact','ids','getContacts','findOne','map','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','name','send','index','CmCompany','describe','model','keys','query','attributes','fields'];(function(_0x5a3bfa,_0x1bf7c9){var _0x5e3af4=function(_0x34d24e){while(--_0x34d24e){_0x5a3bfa['push'](_0x5a3bfa['shift']());}};_0x5e3af4(++_0x1bf7c9);}(_0x8436,0x1c9));var _0x6843=function(_0x19d7da,_0x2a79ca){_0x19d7da=_0x19d7da-0x0;var _0x34ee5d=_0x8436[_0x19d7da];return _0x34ee5d;};'use strict';var emlformat=require(_0x6843('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6843('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6843('0x2'));var moment=require(_0x6843('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6843('0x4'));var util=require('util');var path=require(_0x6843('0x5'));var sox=require(_0x6843('0x6'));var csv=require(_0x6843('0x7'));var ejs=require(_0x6843('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6843('0x9'));var squel=require(_0x6843('0xa'));var crypto=require(_0x6843('0xb'));var jsforce=require(_0x6843('0xc'));var deskjs=require(_0x6843('0xd'));var toCsv=require(_0x6843('0x7'));var querystring=require(_0x6843('0xe'));var Papa=require('papaparse');var Redis=require(_0x6843('0xf'));var authService=require(_0x6843('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6843('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6843('0x12'))(_0x6843('0x13'));var utils=require(_0x6843('0x14'));var config=require(_0x6843('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6843('0x16'))['db'];function respondWithStatusCode(_0x31ffd6,_0x22daee){_0x22daee=_0x22daee||0xcc;return function(_0x2fe741){if(_0x2fe741){return _0x31ffd6[_0x6843('0x17')](_0x22daee);}return _0x31ffd6[_0x6843('0x18')](_0x22daee)[_0x6843('0x19')]();};}function respondWithResult(_0x3d0c13,_0x38cc5d){_0x38cc5d=_0x38cc5d||0xc8;return function(_0x3a8ed0){if(_0x3a8ed0){return _0x3d0c13[_0x6843('0x18')](_0x38cc5d)[_0x6843('0x1a')](_0x3a8ed0);}};}function respondWithFilteredResult(_0x215097,_0x22558c){return function(_0x3890d0){if(_0x3890d0){var _0x1e5772=typeof _0x22558c[_0x6843('0x1b')]===_0x6843('0x1c')&&typeof _0x22558c[_0x6843('0x1d')]==='undefined';var _0x3e4120=_0x3890d0[_0x6843('0x1e')];var _0x3f0dcf=_0x1e5772?0x0:_0x22558c[_0x6843('0x1b')];var _0x3d18ba=_0x1e5772?_0x3890d0[_0x6843('0x1e')]:_0x22558c[_0x6843('0x1b')]+_0x22558c[_0x6843('0x1d')];var _0x4234d9;if(_0x3d18ba>=_0x3e4120){_0x3d18ba=_0x3e4120;_0x4234d9=0xc8;}else{_0x4234d9=0xce;}_0x215097[_0x6843('0x18')](_0x4234d9);return _0x215097[_0x6843('0x1f')](_0x6843('0x20'),_0x3f0dcf+'-'+_0x3d18ba+'/'+_0x3e4120)[_0x6843('0x1a')](_0x3890d0);}return null;};}function patchUpdates(_0x518fad){return function(_0x542d77){try{jsonpatch[_0x6843('0x21')](_0x542d77,_0x518fad,!![]);}catch(_0x1c0a0d){return BPromise[_0x6843('0x22')](_0x1c0a0d);}return _0x542d77[_0x6843('0x23')]();};}function saveUpdates(_0x10c7ea,_0x3ef757){return function(_0x5744a6){if(_0x5744a6){return _0x5744a6[_0x6843('0x24')](_0x10c7ea)[_0x6843('0x25')](function(_0x4eb9c0){return _0x4eb9c0;});}return null;};}function removeEntity(_0x397960,_0x112093){return function(_0x2dbdae){if(_0x2dbdae){return _0x2dbdae['destroy']()[_0x6843('0x25')](function(){var _0x54b275=_0x2dbdae[_0x6843('0x26')]({'plain':!![]});var _0x40dbd6=_0x6843('0x27');return db[_0x6843('0x28')][_0x6843('0x29')]({'where':{'type':_0x40dbd6,'resourceId':_0x54b275['id']}})[_0x6843('0x25')](function(){return _0x2dbdae;});})['then'](function(){_0x397960['status'](0xcc)[_0x6843('0x19')]();});}};}function handleEntityNotFound(_0xb0ef18,_0xea42a8){return function(_0x56cf32){if(!_0x56cf32){_0xb0ef18['sendStatus'](0x194);}return _0x56cf32;};}function handleError(_0x1b5dde,_0xdbd543){_0xdbd543=_0xdbd543||0x1f4;return function(_0x244de0){logger[_0x6843('0x2a')](_0x244de0['stack']);if(_0x244de0[_0x6843('0x2b')]){delete _0x244de0[_0x6843('0x2b')];}_0x1b5dde['status'](_0xdbd543)[_0x6843('0x2c')](_0x244de0);};}exports[_0x6843('0x2d')]=function(_0x540bb5,_0x25c830){var _0x20ef8e={},_0x87b787={},_0x502358={'count':0x0,'rows':[]};return db[_0x6843('0x2e')][_0x6843('0x2f')]()[_0x6843('0x25')](function(_0x977a5e){_0x87b787[_0x6843('0x30')]=_[_0x6843('0x31')](_0x977a5e);_0x87b787[_0x6843('0x32')]=_[_0x6843('0x31')](_0x540bb5['query']);_0x87b787['filters']=_['intersection'](_0x87b787[_0x6843('0x30')],_0x87b787[_0x6843('0x32')]);_0x20ef8e[_0x6843('0x33')]=_['intersection'](_0x87b787[_0x6843('0x30')],qs[_0x6843('0x34')](_0x540bb5[_0x6843('0x32')][_0x6843('0x34')]));_0x20ef8e[_0x6843('0x33')]=_0x20ef8e['attributes'][_0x6843('0x35')]?_0x20ef8e['attributes']:_0x87b787[_0x6843('0x30')];if(!_0x540bb5[_0x6843('0x32')][_0x6843('0x36')](_0x6843('0x37'))){_0x20ef8e[_0x6843('0x1d')]=qs[_0x6843('0x1d')](_0x540bb5[_0x6843('0x32')][_0x6843('0x1d')]);_0x20ef8e[_0x6843('0x1b')]=qs[_0x6843('0x1b')](_0x540bb5['query'][_0x6843('0x1b')]);}_0x20ef8e['order']=qs[_0x6843('0x38')](_0x540bb5[_0x6843('0x32')][_0x6843('0x38')]);_0x20ef8e[_0x6843('0x39')]=qs['filters'](_[_0x6843('0x3a')](_0x540bb5['query'],_0x87b787[_0x6843('0x3b')]),_0x977a5e);if(_0x540bb5[_0x6843('0x32')]['filter']){_0x20ef8e['where']=_[_0x6843('0x3c')](_0x20ef8e[_0x6843('0x39')],{'$or':_['map'](_0x20ef8e[_0x6843('0x33')],function(_0x54a314){var _0x4d91d4={};_0x4d91d4[_0x54a314]={'$like':'%'+_0x540bb5[_0x6843('0x32')][_0x6843('0x3d')]+'%'};return _0x4d91d4;})});}_0x20ef8e=_[_0x6843('0x3c')]({},_0x20ef8e,_0x540bb5[_0x6843('0x3e')]);var _0x216205={'where':_0x20ef8e[_0x6843('0x39')]};return db[_0x6843('0x2e')][_0x6843('0x1e')](_0x216205)['then'](function(_0x4d0427){_0x502358[_0x6843('0x1e')]=_0x4d0427;if(_0x540bb5[_0x6843('0x32')]['includeAll']){_0x20ef8e['include']=[{'all':!![]}];}return db[_0x6843('0x2e')][_0x6843('0x3f')](_0x20ef8e);})['then'](function(_0x502d7c){_0x502358[_0x6843('0x40')]=_0x502d7c;return _0x502358;})[_0x6843('0x25')](respondWithFilteredResult(_0x25c830,_0x20ef8e))[_0x6843('0x41')](handleError(_0x25c830,null));})[_0x6843('0x41')](handleError(_0x25c830,null));};exports[_0x6843('0x42')]=function(_0x4f8396,_0x1b442f){var _0x2550d6={'raw':![],'where':{'id':_0x4f8396[_0x6843('0x43')]['id']}},_0x4400e3={};_0x4400e3['model']=_[_0x6843('0x31')](db[_0x6843('0x2e')][_0x6843('0x44')]);_0x4400e3['query']=_[_0x6843('0x31')](_0x4f8396[_0x6843('0x32')]);_0x4400e3[_0x6843('0x3b')]=_[_0x6843('0x45')](_0x4400e3[_0x6843('0x30')],_0x4400e3[_0x6843('0x32')]);_0x2550d6[_0x6843('0x33')]=_[_0x6843('0x45')](_0x4400e3[_0x6843('0x30')],qs[_0x6843('0x34')](_0x4f8396[_0x6843('0x32')][_0x6843('0x34')]));_0x2550d6[_0x6843('0x33')]=_0x2550d6[_0x6843('0x33')]['length']?_0x2550d6[_0x6843('0x33')]:_0x4400e3[_0x6843('0x30')];if(_0x4f8396['query'][_0x6843('0x46')]){_0x2550d6['include']=[{'all':!![]}];}_0x2550d6=_[_0x6843('0x3c')]({},_0x2550d6,_0x4f8396[_0x6843('0x3e')]);return db[_0x6843('0x2e')]['find'](_0x2550d6)[_0x6843('0x25')](handleEntityNotFound(_0x1b442f,null))['then'](respondWithResult(_0x1b442f,null))[_0x6843('0x41')](handleError(_0x1b442f,null));};exports[_0x6843('0x47')]=function(_0x5eb8b6,_0x455463){return db[_0x6843('0x2e')][_0x6843('0x47')](_0x5eb8b6['body'],{})[_0x6843('0x25')](function(_0x483f8a){var _0x106a67=_0x5eb8b6['user'][_0x6843('0x26')]({'plain':!![]});if(!_0x106a67)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106a67[_0x6843('0x48')]===_0x6843('0x49')){var _0x214912=_0x483f8a[_0x6843('0x26')]({'plain':!![]});var _0x59fef5='Companies';return db[_0x6843('0x4a')][_0x6843('0x4b')]({'where':{'name':_0x59fef5,'userProfileId':_0x106a67['userProfileId']},'raw':!![]})[_0x6843('0x25')](function(_0x4adf02){if(_0x4adf02&&_0x4adf02[_0x6843('0x4c')]===0x0){return db['UserProfileResource'][_0x6843('0x47')]({'name':_0x214912['name'],'resourceId':_0x214912['id'],'type':_0x4adf02[_0x6843('0x2b')],'sectionId':_0x4adf02['id']},{})[_0x6843('0x25')](function(){return _0x483f8a;});}else{return _0x483f8a;}})[_0x6843('0x41')](function(_0x1a6f8d){logger[_0x6843('0x2a')](_0x6843('0x4d'),_0x1a6f8d);throw _0x1a6f8d;});}return _0x483f8a;})[_0x6843('0x25')](respondWithResult(_0x455463,0xc9))[_0x6843('0x41')](handleError(_0x455463,null));};exports['update']=function(_0x3b75e9,_0x3583f8){if(_0x3b75e9[_0x6843('0x4e')]['id']){delete _0x3b75e9[_0x6843('0x4e')]['id'];}return db[_0x6843('0x2e')][_0x6843('0x4b')]({'where':{'id':_0x3b75e9[_0x6843('0x43')]['id']}})['then'](handleEntityNotFound(_0x3583f8,null))['then'](saveUpdates(_0x3b75e9[_0x6843('0x4e')],null))['then'](respondWithResult(_0x3583f8,null))[_0x6843('0x41')](handleError(_0x3583f8,null));};exports[_0x6843('0x29')]=function(_0x3947de,_0x1f69fc){return db['CmCompany'][_0x6843('0x4b')]({'where':{'id':_0x3947de[_0x6843('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f69fc,null))[_0x6843('0x25')](removeEntity(_0x1f69fc,null))['catch'](handleError(_0x1f69fc,null));};exports[_0x6843('0x2f')]=function(_0x6e3d3b,_0x5a7b40){return db[_0x6843('0x2e')][_0x6843('0x2f')]()[_0x6843('0x25')](respondWithResult(_0x5a7b40,null))[_0x6843('0x41')](handleError(_0x5a7b40,null));};exports[_0x6843('0x4f')]=function(_0x5792a9,_0x357503,_0x16dc3e){return db[_0x6843('0x50')]['find']({'where':{'id':_0x5792a9['params']['id']}})[_0x6843('0x25')](handleEntityNotFound(_0x357503,null))[_0x6843('0x25')](function(_0x1d1fbe){if(_0x1d1fbe){return _0x1d1fbe[_0x6843('0x4f')](_0x5792a9[_0x6843('0x4e')][_0x6843('0x51')],_['omit'](_0x5792a9[_0x6843('0x4e')],[_0x6843('0x51'),'id'])||{});}})[_0x6843('0x25')](respondWithResult(_0x357503,null))[_0x6843('0x41')](handleError(_0x357503,null));};exports[_0x6843('0x52')]=function(_0xc80dc6,_0x5cd61c,_0x58aacd){var _0x25883f={};var _0x62e093={};var _0x525dec;var _0x269a87;return db[_0x6843('0x2e')][_0x6843('0x53')]({'where':{'id':_0xc80dc6[_0x6843('0x43')]['id']}})[_0x6843('0x25')](handleEntityNotFound(_0x5cd61c,null))['then'](function(_0x5105ea){if(_0x5105ea){_0x525dec=_0x5105ea;_0x62e093[_0x6843('0x30')]=_['keys'](db[_0x6843('0x50')]['rawAttributes']);_0x62e093['query']=_[_0x6843('0x31')](_0xc80dc6[_0x6843('0x32')]);_0x62e093[_0x6843('0x3b')]=_[_0x6843('0x45')](_0x62e093[_0x6843('0x30')],_0x62e093[_0x6843('0x32')]);_0x25883f[_0x6843('0x33')]=_[_0x6843('0x45')](_0x62e093[_0x6843('0x30')],qs[_0x6843('0x34')](_0xc80dc6['query']['fields']));_0x25883f[_0x6843('0x33')]=_0x25883f['attributes'][_0x6843('0x35')]?_0x25883f[_0x6843('0x33')]:_0x62e093[_0x6843('0x30')];_0x25883f['order']=qs[_0x6843('0x38')](_0xc80dc6[_0x6843('0x32')][_0x6843('0x38')]);_0x25883f[_0x6843('0x39')]=qs[_0x6843('0x3b')](_[_0x6843('0x3a')](_0xc80dc6['query'],_0x62e093[_0x6843('0x3b')]));if(_0xc80dc6['query'][_0x6843('0x3d')]){_0x25883f[_0x6843('0x39')]=_[_0x6843('0x3c')](_0x25883f[_0x6843('0x39')],{'$or':_[_0x6843('0x54')](_0x25883f[_0x6843('0x33')],function(_0x485f3a){var _0x2c412e={};_0x2c412e[_0x485f3a]={'$like':'%'+_0xc80dc6['query'][_0x6843('0x3d')]+'%'};return _0x2c412e;})});}_0x25883f=_['merge']({},_0x25883f,_0xc80dc6['options']);return _0x525dec['getContacts'](_0x25883f);}})[_0x6843('0x25')](function(_0x2f62d4){if(_0x2f62d4){_0x269a87=_0x2f62d4[_0x6843('0x35')];if(!_0xc80dc6[_0x6843('0x32')]['hasOwnProperty'](_0x6843('0x37'))){_0x25883f['limit']=qs[_0x6843('0x1d')](_0xc80dc6[_0x6843('0x32')]['limit']);_0x25883f[_0x6843('0x1b')]=qs[_0x6843('0x1b')](_0xc80dc6[_0x6843('0x32')][_0x6843('0x1b')]);}return _0x525dec[_0x6843('0x52')](_0x25883f);}})['then'](function(_0x3b621d){if(_0x3b621d){return _0x3b621d?{'count':_0x269a87,'rows':_0x3b621d}:null;}})[_0x6843('0x25')](respondWithResult(_0x5cd61c,null))[_0x6843('0x41')](handleError(_0x5cd61c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9ba974a..774826c 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 _0x5feb=['cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5feb,0x139));var _0xb5fe=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0x5feb[_0x4b6a01];return _0xc374a3;};'use strict';var _=require(_0xb5fe('0x0'));var util=require(_0xb5fe('0x1'));var logger=require(_0xb5fe('0x2'))('api');var moment=require(_0xb5fe('0x3'));var BPromise=require(_0xb5fe('0x4'));var rp=require(_0xb5fe('0x5'));var fs=require('fs');var path=require(_0xb5fe('0x6'));var rimraf=require(_0xb5fe('0x7'));var config=require(_0xb5fe('0x8'));var attributes=require(_0xb5fe('0x9'));module[_0xb5fe('0xa')]=function(_0x267309,_0x32961d){return _0x267309[_0xb5fe('0xb')]('CmCompany',attributes,{'tableName':_0xb5fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85ff=['cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x484475,_0x5953ad){var _0x595d7f=function(_0x19ef55){while(--_0x19ef55){_0x484475['push'](_0x484475['shift']());}};_0x595d7f(++_0x5953ad);}(_0x85ff,0x139));var _0xf85f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x85ff[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xf85f('0x0'));var util=require(_0xf85f('0x1'));var logger=require(_0xf85f('0x2'))(_0xf85f('0x3'));var moment=require(_0xf85f('0x4'));var BPromise=require(_0xf85f('0x5'));var rp=require(_0xf85f('0x6'));var fs=require('fs');var path=require(_0xf85f('0x7'));var rimraf=require(_0xf85f('0x8'));var config=require(_0xf85f('0x9'));var attributes=require(_0xf85f('0xa'));module[_0xf85f('0xb')]=function(_0x5b0a60,_0x4eb39b){return _0x5b0a60['define']('CmCompany',attributes,{'tableName':_0xf85f('0xc'),'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 887aff8..2c9cce2 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 _0x91f5=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','request','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x15f5bc,_0x4433bf){var _0x3b9832=function(_0x51cfc6){while(--_0x51cfc6){_0x15f5bc['push'](_0x15f5bc['shift']());}};_0x3b9832(++_0x4433bf);}(_0x91f5,0x162));var _0x591f=function(_0x3835d3,_0x2510f5){_0x3835d3=_0x3835d3-0x0;var _0x3c028e=_0x91f5[_0x3835d3];return _0x3c028e;};'use strict';var _=require(_0x591f('0x0'));var util=require(_0x591f('0x1'));var moment=require(_0x591f('0x2'));var BPromise=require(_0x591f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x591f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x591f('0x5'));var logger=require('../../config/logger')(_0x591f('0x6'));var config=require('../../config/environment');var jayson=require(_0x591f('0x7'));var client=jayson[_0x591f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c465,_0x448453,_0xb34a1f){return new BPromise(function(_0x55d3f7,_0xc21929){return client[_0x591f('0x9')](_0x59c465,_0xb34a1f)['then'](function(_0x5cb3cc){logger['info']('CmCompany,\x20%s,\x20%s',_0x448453,_0x591f('0xa'));logger[_0x591f('0xb')](_0x591f('0xc'),_0x448453,_0x591f('0xa'),JSON[_0x591f('0xd')](_0x5cb3cc));if(_0x5cb3cc[_0x591f('0xe')]){if(_0x5cb3cc[_0x591f('0xe')][_0x591f('0xf')]===0x1f4){logger[_0x591f('0xe')](_0x591f('0x10'),_0x448453,_0x5cb3cc['error'][_0x591f('0x11')]);return _0xc21929(_0x5cb3cc[_0x591f('0xe')][_0x591f('0x11')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x448453,_0x5cb3cc[_0x591f('0xe')][_0x591f('0x11')]);return _0x55d3f7(_0x5cb3cc[_0x591f('0xe')]['message']);}else{logger[_0x591f('0x12')](_0x591f('0x10'),_0x448453,_0x591f('0xa'));_0x55d3f7(_0x5cb3cc[_0x591f('0x13')][_0x591f('0x11')]);}})[_0x591f('0x14')](function(_0x24313e){logger[_0x591f('0xe')](_0x591f('0x10'),_0x448453,_0x24313e);_0xc21929(_0x24313e);});});} \ No newline at end of file +var _0xa194=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info'];(function(_0x5e81ea,_0x2c6893){var _0x4c19ed=function(_0x21ee0f){while(--_0x21ee0f){_0x5e81ea['push'](_0x5e81ea['shift']());}};_0x4c19ed(++_0x2c6893);}(_0xa194,0x198));var _0x4a19=function(_0xc00b74,_0xccb10d){_0xc00b74=_0xc00b74-0x0;var _0xa991c5=_0xa194[_0xc00b74];return _0xa991c5;};'use strict';var _=require(_0x4a19('0x0'));var util=require('util');var moment=require(_0x4a19('0x1'));var BPromise=require('bluebird');var rs=require(_0x4a19('0x2'));var fs=require('fs');var Redis=require(_0x4a19('0x3'));var db=require(_0x4a19('0x4'))['db'];var utils=require(_0x4a19('0x5'));var logger=require('../../config/logger')(_0x4a19('0x6'));var config=require(_0x4a19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6e66,_0x2aa3be,_0x1fd72e){return new BPromise(function(_0x246ee9,_0x1333ee){return client[_0x4a19('0x9')](_0x4d6e66,_0x1fd72e)[_0x4a19('0xa')](function(_0x1bdc2c){logger[_0x4a19('0xb')](_0x4a19('0xc'),_0x2aa3be,_0x4a19('0xd'));logger[_0x4a19('0xe')](_0x4a19('0xf'),_0x2aa3be,_0x4a19('0xd'),JSON[_0x4a19('0x10')](_0x1bdc2c));if(_0x1bdc2c[_0x4a19('0x11')]){if(_0x1bdc2c[_0x4a19('0x11')]['code']===0x1f4){logger[_0x4a19('0x11')](_0x4a19('0xc'),_0x2aa3be,_0x1bdc2c[_0x4a19('0x11')][_0x4a19('0x12')]);return _0x1333ee(_0x1bdc2c['error'][_0x4a19('0x12')]);}logger[_0x4a19('0x11')](_0x4a19('0xc'),_0x2aa3be,_0x1bdc2c['error'][_0x4a19('0x12')]);return _0x246ee9(_0x1bdc2c[_0x4a19('0x11')][_0x4a19('0x12')]);}else{logger[_0x4a19('0xb')](_0x4a19('0xc'),_0x2aa3be,'request\x20sent');_0x246ee9(_0x1bdc2c[_0x4a19('0x13')]['message']);}})[_0x4a19('0x14')](function(_0x1656ff){logger['error'](_0x4a19('0xc'),_0x2aa3be,_0x1656ff);_0x1333ee(_0x1656ff);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 3870a51..501df8a 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 _0xbab3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x9c3c24,_0x4972dd){var _0x4b51e9=function(_0x38574e){while(--_0x38574e){_0x9c3c24['push'](_0x9c3c24['shift']());}};_0x4b51e9(++_0x4972dd);}(_0xbab3,0x1f4));var _0x3bab=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xbab3[_0x5a3cf0];return _0x5a64ee;};'use strict';var multer=require(_0x3bab('0x0'));var util=require('util');var path=require(_0x3bab('0x1'));var timeout=require(_0x3bab('0x2'));var express=require('express');var router=express[_0x3bab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3bab('0x4'));var interaction=require(_0x3bab('0x5'));var config=require(_0x3bab('0x6'));var controller=require('./cmCompany.controller');router[_0x3bab('0x7')]('/',auth[_0x3bab('0x8')](),controller[_0x3bab('0x9')]);router['get']('/describe',auth[_0x3bab('0x8')](),controller[_0x3bab('0xa')]);router['get'](_0x3bab('0xb'),auth['isAuthenticated'](),controller[_0x3bab('0xc')]);router[_0x3bab('0x7')](_0x3bab('0xd'),auth['isAuthenticated'](),controller[_0x3bab('0xe')]);router[_0x3bab('0xf')]('/',auth[_0x3bab('0x8')](),controller[_0x3bab('0x10')]);router[_0x3bab('0xf')](_0x3bab('0xd'),auth[_0x3bab('0x8')](),controller[_0x3bab('0x11')]);router['put'](_0x3bab('0xb'),auth[_0x3bab('0x8')](),controller[_0x3bab('0x12')]);router['delete'](_0x3bab('0xb'),auth['isAuthenticated'](),controller[_0x3bab('0x13')]);module[_0x3bab('0x14')]=router; \ No newline at end of file +var _0xc838=['get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0x475637,_0x4f613a){var _0xe26048=function(_0xd0575e){while(--_0xd0575e){_0x475637['push'](_0x475637['shift']());}};_0xe26048(++_0x4f613a);}(_0xc838,0xbd));var _0x8c83=function(_0x244aa1,_0x7da15f){_0x244aa1=_0x244aa1-0x0;var _0x208578=_0xc838[_0x244aa1];return _0x208578;};'use strict';var multer=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var path=require(_0x8c83('0x2'));var timeout=require(_0x8c83('0x3'));var express=require(_0x8c83('0x4'));var router=express[_0x8c83('0x5')]();var fs_extra=require(_0x8c83('0x6'));var auth=require(_0x8c83('0x7'));var interaction=require(_0x8c83('0x8'));var config=require(_0x8c83('0x9'));var controller=require(_0x8c83('0xa'));router[_0x8c83('0xb')]('/',auth[_0x8c83('0xc')](),controller[_0x8c83('0xd')]);router[_0x8c83('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x8c83('0xe')]);router['get'](_0x8c83('0xf'),auth[_0x8c83('0xc')](),controller[_0x8c83('0x10')]);router[_0x8c83('0xb')](_0x8c83('0x11'),auth[_0x8c83('0xc')](),controller[_0x8c83('0x12')]);router[_0x8c83('0x13')]('/',auth[_0x8c83('0xc')](),controller[_0x8c83('0x14')]);router[_0x8c83('0x13')]('/:id/contacts',auth[_0x8c83('0xc')](),controller['addContacts']);router['put'](_0x8c83('0xf'),auth['isAuthenticated'](),controller[_0x8c83('0x15')]);router[_0x8c83('0x16')](_0x8c83('0xf'),auth[_0x8c83('0xc')](),controller[_0x8c83('0x17')]);module[_0x8c83('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4251f5e..e49ad6a 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 _0x1798=['lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x40a812,_0x46c78f){var _0x44c655=function(_0x1b7c35){while(--_0x1b7c35){_0x40a812['push'](_0x40a812['shift']());}};_0x44c655(++_0x46c78f);}(_0x1798,0x1f0));var _0x8179=function(_0xb9bec0,_0x3f8a92){_0xb9bec0=_0xb9bec0-0x0;var _0x2d0f42=_0x1798[_0xb9bec0];return _0x2d0f42;};'use strict';var _=require(_0x8179('0x0'));var Sequelize=require(_0x8179('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8179('0x2')]},'street':{'type':Sequelize[_0x8179('0x2')]},'postalCode':{'type':Sequelize[_0x8179('0x2')]},'city':{'type':Sequelize[_0x8179('0x2')]},'country':{'type':Sequelize[_0x8179('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8179('0x3')]},'phone':{'type':Sequelize[_0x8179('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8179('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8179('0x2')]},'facebook':{'type':Sequelize[_0x8179('0x2')]},'fb_data':{'type':Sequelize[_0x8179('0x2')]},'twitter':{'type':Sequelize[_0x8179('0x2')]},'skype':{'type':Sequelize[_0x8179('0x2')]},'teams':{'type':Sequelize[_0x8179('0x2')]},'viber':{'type':Sequelize[_0x8179('0x2')]},'line':{'type':Sequelize[_0x8179('0x2')]},'wechat':{'type':Sequelize[_0x8179('0x2')]},'telegram':{'type':Sequelize[_0x8179('0x2')]},'UserId':{'type':Sequelize[_0x8179('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8179('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8179('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8179('0x6')],'defaultValue':Sequelize[_0x8179('0x7')]},'dialTimezone':{'type':Sequelize[_0x8179('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc775=['INTEGER','lodash','sequelize','exports','STRING','TEXT'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xc775,0x97));var _0x5c77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5c77('0x0'));var Sequelize=require(_0x5c77('0x1'));module[_0x5c77('0x2')]={'firstName':{'type':Sequelize[_0x5c77('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5c77('0x3')]},'city':{'type':Sequelize[_0x5c77('0x3')]},'country':{'type':Sequelize[_0x5c77('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c77('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5c77('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5c77('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5c77('0x3')]},'fb_data':{'type':Sequelize[_0x5c77('0x3')]},'twitter':{'type':Sequelize[_0x5c77('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x5c77('0x3')]},'viber':{'type':Sequelize[_0x5c77('0x3')]},'line':{'type':Sequelize[_0x5c77('0x3')]},'wechat':{'type':Sequelize[_0x5c77('0x3')]},'telegram':{'type':Sequelize[_0x5c77('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x5c77('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x5c77('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1503129..b9ce6fa 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 _0xd690=['`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','PHONE','literal','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','whatsapp','voice','-createdAt','resolve','channel','includes','Invalid\x20channel','parse','isValid','callerid','starttime','endtime','duration','note','createdAt','userDisposition','fullname','DESC','range','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','color','browserName','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','Owner','flatten','sortBy','reverse','value','bluebird','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','json','limit','undefined','count','offset','set','Content-Range','update','then','end','stack','name','index','getOptions','findAll','user','catch','destroy','find','describe','CmContact','tags','length','keys','startsWith','cf_','columnName','query','CmCustomField','displayName','alias','custom','type','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','tag','params','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','format','cf_%d','pickBy','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','phone','getTags','findOne','model','Tag','rawAttributes','intersection','fields','attributes','order','sort','filters','pick','filter','merge','options','nolimit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopper','item'];(function(_0xd8813a,_0x315766){var _0x487db6=function(_0x538ca9){while(--_0x538ca9){_0xd8813a['push'](_0xd8813a['shift']());}};_0x487db6(++_0x315766);}(_0xd690,0x166));var _0x0d69=function(_0x43efcb,_0x2f209a){_0x43efcb=_0x43efcb-0x0;var _0x28b8d0=_0xd690[_0x43efcb];return _0x28b8d0;};'use strict';var moment=require('moment');var BPromise=require(_0x0d69('0x0'));var util=require('util');var path=require(_0x0d69('0x1'));var fs=require('fs');var _=require(_0x0d69('0x2'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d69('0x3'));var contacts=require(_0x0d69('0x4'));var qs=require(_0x0d69('0x5'));var logger=require(_0x0d69('0x6'))(_0x0d69('0x7'));var config=require(_0x0d69('0x8'));var shared=require(_0x0d69('0x9'));var db=require(_0x0d69('0xa'))['db'];config[_0x0d69('0xb')]=_[_0x0d69('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0d69('0xd'))(new Redis(config[_0x0d69('0xb')]));require(_0x0d69('0xe'))[_0x0d69('0xf')](socket);function respondWithResult(_0x452d52,_0x4ea563){_0x4ea563=_0x4ea563||0xc8;return function(_0x28ac98){if(_0x28ac98){return _0x452d52[_0x0d69('0x10')](_0x4ea563)[_0x0d69('0x11')](_0x28ac98);}};}function respondWithFilteredResult(_0x215445,_0x14111d){return function(_0x2e6dcc){if(_0x2e6dcc){var _0x332e96=typeof _0x14111d['offset']==='undefined'&&typeof _0x14111d[_0x0d69('0x12')]===_0x0d69('0x13');var _0x3b2d53=_0x2e6dcc[_0x0d69('0x14')];var _0x573bcf=_0x332e96?0x0:_0x14111d['offset'];var _0x5776dd=_0x332e96?_0x2e6dcc[_0x0d69('0x14')]:_0x14111d[_0x0d69('0x15')]+_0x14111d[_0x0d69('0x12')];var _0x2acf7;if(_0x5776dd>=_0x3b2d53){_0x5776dd=_0x3b2d53;_0x2acf7=0xc8;}else{_0x2acf7=0xce;}_0x215445[_0x0d69('0x10')](_0x2acf7);return _0x215445[_0x0d69('0x16')](_0x0d69('0x17'),_0x573bcf+'-'+_0x5776dd+'/'+_0x3b2d53)[_0x0d69('0x11')](_0x2e6dcc);}return null;};}function saveUpdates(_0x509621){return function(_0x232303){if(_0x232303){return _0x232303[_0x0d69('0x18')](_0x509621)[_0x0d69('0x19')](function(_0x16e887){return _0x16e887;});}return null;};}function removeEntity(_0x15e5d0){return function(_0x370255){if(_0x370255){return _0x370255['destroy']()[_0x0d69('0x19')](function(){_0x15e5d0[_0x0d69('0x10')](0xcc)[_0x0d69('0x1a')]();});}};}function handleEntityNotFound(_0x4334a0){return function(_0x3baa2e){if(!_0x3baa2e){_0x4334a0['sendStatus'](0x194);}return _0x3baa2e;};}function handleError(_0x56fc7a,_0x369d2c){_0x369d2c=_0x369d2c||0x1f4;return function(_0x5ad57b){logger['error'](_0x5ad57b[_0x0d69('0x1b')]);if(_0x5ad57b[_0x0d69('0x1c')]){delete _0x5ad57b[_0x0d69('0x1c')];}_0x56fc7a['status'](_0x369d2c)['send'](_0x5ad57b);};}exports[_0x0d69('0x1d')]=function(_0x1980c3,_0x592111){var _0x4ae85f={};return contacts['describe']()[_0x0d69('0x19')](function(_0x2aeaa4){_0x4ae85f=qs[_0x0d69('0x1e')](_0x2aeaa4,_0x1980c3);return contacts[_0x0d69('0x1f')](_0x1980c3['query'],_0x1980c3[_0x0d69('0x20')],_0x4ae85f,_0x2aeaa4);})[_0x0d69('0x19')](respondWithFilteredResult(_0x592111,_0x4ae85f))[_0x0d69('0x21')](handleError(_0x592111,null));};exports[_0x0d69('0x22')]=function(_0xf9b893,_0x151811){return db['CmContact'][_0x0d69('0x23')]({'where':{'id':_0xf9b893['params']['id']}})['then'](handleEntityNotFound(_0x151811,null))[_0x0d69('0x19')](removeEntity(_0x151811,null))[_0x0d69('0x21')](handleError(_0x151811,null));};exports[_0x0d69('0x24')]=function(_0x58a0b0,_0x283f39){return db[_0x0d69('0x25')][_0x0d69('0x24')]()['then'](function(_0x42c707){delete _0x42c707[_0x0d69('0x26')];for(var _0x290c00=0x0;_0x290c000x0){return new Promise(function(_0x2e5f39){var _0x6bd92b=[];for(var _0x2212dc=0x0;_0x2212dc<_0x14250c[_0x0d69('0x27')];_0x2212dc++){_0x6bd92b[_0x0d69('0x61')](insertAdditionalPhones(_0x14250c[_0x2212dc][_0x0d69('0x65')],_0x14250c[_0x2212dc]['additionalPhones']));}Promise[_0x0d69('0x66')](_0x6bd92b)[_0x0d69('0x19')](function(){_0x2e5f39(0x1);});})['then'](function(){return{'success':_0x123cfb,'failure':_0x274504,'duplicates':_0x23fa30};});}else{return{'success':_0x123cfb,'failure':_0x274504,'duplicates':_0x23fa30};}}})['then'](respondWithResult(_0x2fe9c5,0xc9))[_0x0d69('0x21')](handleError(_0x2fe9c5,null));};exports[_0x0d69('0x67')]=function(_0x1fc43b,_0x268c76){var _0x20cb9e;return db['CmContact'][_0x0d69('0x24')]()[_0x0d69('0x19')](function(_0xfbabcd){return db[_0x0d69('0x25')][_0x0d69('0x23')]({'where':{'id':_0x1fc43b['params']['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0d69('0x1c'),'color'],'required':_0x1fc43b['query'][_0x0d69('0x68')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x1fc43b[_0x0d69('0x69')]['id']},'required':![],'include':[{'model':db[_0x0d69('0x6a')],'as':_0x0d69('0x6b')}]}],'order':[db[_0x0d69('0x6c')]['literal'](_0x0d69('0x6d'))],'attributes':_['keys'](_0xfbabcd)});})[_0x0d69('0x19')](function(_0x28af30){if(!_[_0x0d69('0x57')](_0x28af30)){_0x20cb9e=_0x28af30[_0x0d69('0x37')]({'plain':!![]});var _0x5d4594={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x28af30&&_0x28af30[_0x0d69('0x62')]){if(_0x28af30['ListId']){_0x5d4594['where'][_0x0d69('0x6e')][_0x0d69('0x61')]({'ListId':{'$ne':_0x28af30[_0x0d69('0x62')]}});}}return db[_0x0d69('0x2d')]['findAll'](_0x5d4594);}})[_0x0d69('0x19')](function(_0x1d4861){if(!_[_0x0d69('0x57')](_0x1d4861)){return _[_0x0d69('0x6f')](_0x20cb9e,_['map'](_0x1d4861,function(_0xc883ee){return util[_0x0d69('0x70')](_0x0d69('0x71'),_0xc883ee['id']);}));}})[_0x0d69('0x19')](handleEntityNotFound(_0x268c76,null))[_0x0d69('0x19')](respondWithResult(_0x268c76,null))[_0x0d69('0x21')](handleError(_0x268c76,null));};exports['update']=function(_0x216f5a,_0x52597a){var _0x3fda16;if(_0x216f5a[_0x0d69('0x35')]['id']){delete _0x216f5a['body']['id'];}if(!_[_0x0d69('0x57')](_0x216f5a[_0x0d69('0x35')][_0x0d69('0x58')])){var _0x14dd34=_0x216f5a[_0x0d69('0x35')][_0x0d69('0x58')];if(!_[_0x0d69('0x57')](shared[_0x0d69('0x59')][_0x14dd34]))_0x216f5a['body'][_0x0d69('0x5a')]=shared[_0x0d69('0x59')][_0x14dd34][_0x0d69('0x5a')];}return db['CmContact'][_0x0d69('0x23')]({'where':{'id':_0x216f5a['params']['id']}})[_0x0d69('0x19')](handleEntityNotFound(_0x52597a,null))[_0x0d69('0x19')](saveUpdates(_0x216f5a['body'],null))[_0x0d69('0x19')](function(_0x474ec2){_0x3fda16=_0x474ec2;var _0xae5410={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x474ec2&&_0x474ec2[_0x0d69('0x62')]){if(_0x474ec2[_0x0d69('0x62')]){_0xae5410['where']['$and'][_0x0d69('0x61')]({'ListId':{'$ne':_0x474ec2['ListId']}});}}return db[_0x0d69('0x2d')][_0x0d69('0x1f')](_0xae5410);})[_0x0d69('0x19')](function(_0x574fc0){if(_0x574fc0){return _[_0x0d69('0x6f')](_[_0x0d69('0x72')](_0x216f5a['body'],function(_0x2fb345,_0x3cfcce){return _[_0x0d69('0x29')](_0x3cfcce,'cf_');}),_[_0x0d69('0x73')](_0x574fc0,function(_0x44f0cb){return util[_0x0d69('0x70')](_0x0d69('0x71'),_0x44f0cb['id']);}));}})[_0x0d69('0x19')](function(_0x1b1f40){if(_0x1b1f40&&!_[_0x0d69('0x74')](_0x1b1f40)){var _0x5c0423=squel['update']()[_0x0d69('0x75')](_0x0d69('0x76'))[_0x0d69('0x77')](_0x1b1f40)[_0x0d69('0x5f')](_0x0d69('0x78'),_0x216f5a[_0x0d69('0x69')]['id'])['toParam']();return db[_0x0d69('0x6c')][_0x0d69('0x2c')](_0x5c0423['text'],{'replacements':_0x5c0423['values']});}})['then'](function(){if(_0x216f5a[_0x0d69('0x35')][_0x0d69('0x79')]&&_0x3fda16){return db['CmHopper']['update']({'phone':_0x216f5a[_0x0d69('0x35')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x3fda16['id']}});}})['then'](function(){return _0x3fda16;})[_0x0d69('0x19')](respondWithResult(_0x52597a,null))['catch'](handleError(_0x52597a,null));};exports[_0x0d69('0x7a')]=function(_0x4819f4,_0xa60158){var _0xc40dd7={};var _0x4bd7ee={};var _0x202f48;var _0x3db3c0;return db[_0x0d69('0x25')][_0x0d69('0x7b')]({'where':{'id':_0x4819f4[_0x0d69('0x69')]['id']}})['then'](handleEntityNotFound(_0xa60158,null))['then'](function(_0x242b4e){if(_0x242b4e){_0x202f48=_0x242b4e;_0x4bd7ee[_0x0d69('0x7c')]=_[_0x0d69('0x28')](db[_0x0d69('0x7d')][_0x0d69('0x7e')]);_0x4bd7ee['query']=_[_0x0d69('0x28')](_0x4819f4[_0x0d69('0x2c')]);_0x4bd7ee['filters']=_[_0x0d69('0x7f')](_0x4bd7ee[_0x0d69('0x7c')],_0x4bd7ee[_0x0d69('0x2c')]);_0xc40dd7['attributes']=_[_0x0d69('0x7f')](_0x4bd7ee[_0x0d69('0x7c')],qs[_0x0d69('0x80')](_0x4819f4[_0x0d69('0x2c')]['fields']));_0xc40dd7[_0x0d69('0x81')]=_0xc40dd7[_0x0d69('0x81')][_0x0d69('0x27')]?_0xc40dd7['attributes']:_0x4bd7ee[_0x0d69('0x7c')];_0xc40dd7[_0x0d69('0x82')]=qs[_0x0d69('0x83')](_0x4819f4[_0x0d69('0x2c')]['sort']);_0xc40dd7['where']=qs[_0x0d69('0x84')](_[_0x0d69('0x85')](_0x4819f4[_0x0d69('0x2c')],_0x4bd7ee[_0x0d69('0x84')]));if(_0x4819f4['query'][_0x0d69('0x86')]){_0xc40dd7['where']=_[_0x0d69('0x87')](_0xc40dd7[_0x0d69('0x5f')],{'$or':_['map'](_0xc40dd7[_0x0d69('0x81')],function(_0x56425d){var _0x3796e8={};_0x3796e8[_0x56425d]={'$like':'%'+_0x4819f4[_0x0d69('0x2c')]['filter']+'%'};return _0x3796e8;})});}_0xc40dd7=_[_0x0d69('0x87')]({},_0xc40dd7,_0x4819f4[_0x0d69('0x88')]);return _0x202f48[_0x0d69('0x7a')](_0xc40dd7);}})[_0x0d69('0x19')](function(_0x4498cc){if(_0x4498cc){_0x3db3c0=_0x4498cc[_0x0d69('0x27')];if(!_0x4819f4[_0x0d69('0x2c')][_0x0d69('0x34')](_0x0d69('0x89'))){_0xc40dd7[_0x0d69('0x12')]=qs[_0x0d69('0x12')](_0x4819f4['query'][_0x0d69('0x12')]);_0xc40dd7['offset']=qs[_0x0d69('0x15')](_0x4819f4[_0x0d69('0x2c')][_0x0d69('0x15')]);}return _0x202f48[_0x0d69('0x7a')](_0xc40dd7);}})[_0x0d69('0x19')](function(_0x5711e8){if(_0x5711e8){return _0x5711e8?{'count':_0x3db3c0,'rows':_0x5711e8}:null;}})[_0x0d69('0x19')](respondWithResult(_0xa60158,null))[_0x0d69('0x21')](handleError(_0xa60158,null));};exports['setTags']=function(_0x246ee1,_0x471942){if(_0x246ee1['body']['id']){delete _0x246ee1['body']['id'];}return db[_0x0d69('0x25')][_0x0d69('0x7b')]({'where':{'id':_0x246ee1[_0x0d69('0x69')]['id']}})[_0x0d69('0x19')](handleEntityNotFound(_0x471942,null))[_0x0d69('0x19')](function(_0x5c51b2){if(_0x5c51b2){return _0x5c51b2[_0x0d69('0x8a')](_0x246ee1[_0x0d69('0x35')]['ids']||[]);}return null;})[_0x0d69('0x19')](respondWithResult(_0x471942,null))[_0x0d69('0x21')](handleError(_0x471942,null));};exports[_0x0d69('0x8b')]=function(_0x20c83a,_0x8f5efd){var _0x1dbae1=[];_0x1dbae1[_0x0d69('0x61')](addAdditionalPhones(_0x20c83a[_0x0d69('0x35')]));Promise[_0x0d69('0x66')](_0x1dbae1)[_0x0d69('0x19')](function(){_0x1dbae1=[];_0x1dbae1[_0x0d69('0x61')](deleteCmHopperPhones(_0x20c83a[_0x0d69('0x35')]['id']));_0x1dbae1['push'](addCmHopperPhones(_0x20c83a['body']['id']));Promise[_0x0d69('0x66')](_0x1dbae1)['then'](function(){return[0x1];})[_0x0d69('0x19')](respondWithResult(_0x8f5efd,null));});};function addAdditionalPhones(_0x317c0b){var _0x4d8add;return new Promise(function(_0xb21839){return db['CmContactHasItem'][_0x0d69('0x22')]({'where':{'CmContactId':_0x317c0b['id']}})[_0x0d69('0x19')](function(){db[_0x0d69('0x6a')][_0x0d69('0x1f')]({'raw':!![],'attributes':['id',_0x0d69('0x8c')]})['then'](function(_0x4d3e9d){var _0xbc1c0=[];for(var _0x269e93=0x0;_0x269e93<_0x317c0b[_0x0d69('0x8d')][_0x0d69('0x27')];_0x269e93++){var _0x5dfc6e=_0x317c0b[_0x0d69('0x8e')]?_[_0x0d69('0x57')](_0x317c0b['item_types'][_0x269e93])?'':_0x317c0b[_0x0d69('0x8e')][_0x269e93]:_0x317c0b[_0x0d69('0x8d')][_0x269e93][_0x0d69('0x8f')]?_0x317c0b[_0x0d69('0x8d')][_0x269e93]['ItemTypeId']:'';var _0x238d26=_['isNil'](_0x317c0b['items'][_0x269e93][_0x0d69('0x90')])?'':_0x317c0b['items'][_0x269e93][_0x0d69('0x90')];var _0x2aa6d4=_0x5dfc6e+':'+_0x317c0b[_0x0d69('0x8d')][_0x269e93][_0x0d69('0x79')]+'§'+_0x238d26;if(_[_0x0d69('0x57')](_0x4d8add))_0x4d8add=_0x2aa6d4;else _0x4d8add+=';'+_0x2aa6d4;var _0x5d5ce4=null;var _0x2b9df6=null;if(_0x317c0b[_0x0d69('0x8e')]){if(!_[_0x0d69('0x57')](_0x317c0b[_0x0d69('0x8e')][_0x269e93])){_0x2b9df6=_[_0x0d69('0x23')](_0x4d3e9d,function(_0x56725b){return _0x56725b['id']===_0x317c0b['item_types'][_0x269e93];});if(!_[_0x0d69('0x57')](_0x2b9df6)){_0x5d5ce4=_0x2b9df6['OrderBy'];}}}else{if(!_[_0x0d69('0x57')](_0x317c0b[_0x0d69('0x8d')][_0x269e93])){_0x2b9df6=_['find'](_0x4d3e9d,function(_0xa6e2a8){return _0xa6e2a8['id']===_0x317c0b['items'][_0x269e93][_0x0d69('0x8f')];});if(!_[_0x0d69('0x57')](_0x2b9df6)){_0x5d5ce4=_0x269e93;}}}if(_[_0x0d69('0x57')](_0x5d5ce4)){_0x5d5ce4=0x64;}_0xbc1c0[_0x0d69('0x61')](addAdditionalPhone(_0x317c0b['id'],_0x317c0b[_0x0d69('0x8d')][_0x269e93][_0x0d69('0x79')],_0x317c0b['item_types']?_[_0x0d69('0x57')](_0x317c0b[_0x0d69('0x8e')][_0x269e93])?null:_0x317c0b['item_types'][_0x269e93]:_0x317c0b[_0x0d69('0x8d')][_0x269e93]['ItemTypeId']?_0x317c0b['items'][_0x269e93]['ItemTypeId']:null,_0x5d5ce4,_0x238d26));}Promise['all'](_0xbc1c0)[_0x0d69('0x19')](function(){db[_0x0d69('0x25')][_0x0d69('0x18')]({'AdditionalPhones':_0x4d8add},{'where':{'id':_0x317c0b['id']}})['then'](function(){_0xb21839(0x1);});});});});});}function addAdditionalPhone(_0x536bcc,_0x48717c,_0x2a8b57,_0x392b63,_0x4ebaa4){return db[_0x0d69('0x4c')][_0x0d69('0x23')]({'where':{'CmContactId':_0x536bcc,'item':_0x48717c}})[_0x0d69('0x19')](function(_0x2ec7aa){if(_0x2ec7aa)logger[_0x0d69('0x3b')](_0x0d69('0x91'),_0x2ec7aa);else{db[_0x0d69('0x4c')]['create']({'CmContactId':_0x536bcc,'item':_0x48717c,'ItemTypeId':_0x2a8b57,'OrderBy':_0x392b63,'ItemClass':'PHONE','description':_0x4ebaa4});}});}function deleteCmHopperPhones(_0x52f580){return new Promise(function(_0x2df18c){return db[_0x0d69('0x92')][_0x0d69('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x52f580}})['then'](function(_0x2b67d3){db['CmHopperAdditionalPhone'][_0x0d69('0x22')]({'where':{'CmHopperId':{'$in':_['map'](_0x2b67d3,'id')}}});})[_0x0d69('0x19')](function(){_0x2df18c(0x1);});});}function addCmHopperPhones(_0x433ab4){return new Promise(function(_0x5bfee4){return db[_0x0d69('0x92')][_0x0d69('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x433ab4}})[_0x0d69('0x19')](function(_0x13f61f){var _0x23086d=[];_['map'](_0x13f61f,function(_0xb02f60){_0x23086d[_0x0d69('0x61')](createCmHopperPhone(_0x433ab4,_0xb02f60['id']));});Promise[_0x0d69('0x66')](_0x23086d)['then'](function(){_0x5bfee4(0x1);});});});}function createCmHopperPhone(_0x2f2085,_0x359afe){return new Promise(function(_0x55b264){db[_0x0d69('0x4c')][_0x0d69('0x1f')]({'raw':!![],'attributes':[_0x0d69('0x93'),'OrderBy'],'where':{'CmContactId':_0x2f2085,'ItemClass':'PHONE'},'include':[{'model':db[_0x0d69('0x6a')],'attributes':[_0x0d69('0x8c')],'as':_0x0d69('0x6b')}],'order':[_0x0d69('0x8c'),db[_0x0d69('0x6c')]['literal'](_0x0d69('0x94'))]})[_0x0d69('0x19')](function(_0xf5a145){var _0x27cf6b=0x1;var _0x199668=_[_0x0d69('0x73')](_0xf5a145,function(_0x44c0af){_0x44c0af[_0x0d69('0x95')]=_0x359afe;_0x44c0af[_0x0d69('0x79')]=_0x44c0af[_0x0d69('0x93')];_0x44c0af[_0x0d69('0x8c')]=_0x27cf6b;delete _0x44c0af[_0x0d69('0x96')];_0x27cf6b=_0x27cf6b+0x1;return _0x44c0af;});return db[_0x0d69('0x97')][_0x0d69('0x5c')](_0x199668,{});})[_0x0d69('0x19')](function(){_0x55b264(0x1);});});}function insertAdditionalPhones(_0x350050,_0x59218e){return new Promise(function(_0x201652){var _0x50f1b1=[];for(var _0x3760e1=0x0;_0x3760e1<_0x59218e[_0x0d69('0x27')];_0x3760e1++){var _0x1837c8=_0x59218e[_0x3760e1];_0x50f1b1['push'](parseContactItemType(_0x1837c8));}Promise[_0x0d69('0x66')](_0x50f1b1)[_0x0d69('0x19')](function(){var _0x471aa6={'id':_0x350050['id'],'items':_0x59218e};return addAdditionalPhones(_0x471aa6)[_0x0d69('0x19')](function(){return addCmHopperPhones(_0x350050['id']);});})[_0x0d69('0x19')](function(){_0x201652(_0x350050);});});}function parseContactItemType(_0x453221){return new Promise(function(_0x3b0bf8){if(_0x453221['hasOwnProperty'](_0x0d69('0x8f'))){_0x3b0bf8(_0x453221);}else{return db['ContactItemType']['find']({'where':{'name':_0x453221[_0x0d69('0x6b')]}})[_0x0d69('0x19')](function(_0x23c61d){if(_[_0x0d69('0x57')](_0x23c61d))_0x453221[_0x0d69('0x8f')]=null;else _0x453221[_0x0d69('0x8f')]=_0x23c61d['id'];_0x3b0bf8(_0x453221);});}});}exports[_0x0d69('0x98')]=function(_0x59c940,_0x56bf73){return db['CmContactHasItem'][_0x0d69('0x1f')]({'raw':!![],'where':{'CmContactId':_0x59c940[_0x0d69('0x69')]['id'],'ItemClass':_0x0d69('0x99')},'include':[{'model':db[_0x0d69('0x6a')],'as':_0x0d69('0x6b')}],'order':[['OrderBy'],[db[_0x0d69('0x6c')][_0x0d69('0x9a')](_0x0d69('0x94'))]]})['then'](function(_0x2ae412){return _0x2ae412;})[_0x0d69('0x19')](respondWithResult(_0x56bf73,null))[_0x0d69('0x21')](handleError(_0x56bf73,null));};exports[_0x0d69('0x9b')]=function(_0xf3c2ac,_0x2d6230){return db[_0x0d69('0x4c')]['findAll']({'raw':!![],'where':{'CmContactId':_0xf3c2ac[_0x0d69('0x35')][_0x0d69('0x9c')]}})[_0x0d69('0x19')](function(_0x3823d8){var _0x564142=_[_0x0d69('0x73')](_0x3823d8,function(_0x4828db){_0x4828db[_0x0d69('0x9d')]=_0xf3c2ac['body'][_0x0d69('0x9e')];return _0x4828db;});return db['CmContactHasItem'][_0x0d69('0x5c')](_0x564142,{});})[_0x0d69('0x19')](function(){return addCmHopperPhones(_0xf3c2ac[_0x0d69('0x35')][_0x0d69('0x9e')]);})[_0x0d69('0x19')](function(){return['ok'];})[_0x0d69('0x19')](respondWithResult(_0x2d6230,null))[_0x0d69('0x21')](handleError(_0x2d6230,null));};exports[_0x0d69('0x9f')]=function(_0x51dcb2,_0x4a3d9f){var _0x118003=[];_0x118003[_0x0d69('0x61')](createCmHopperPhone(_0x51dcb2['body']['id'],_0x51dcb2[_0x0d69('0x35')]['hopperId']));Promise['all'](_0x118003)['then'](function(){return[0x1];})[_0x0d69('0x19')](respondWithResult(_0x4a3d9f,null));};exports[_0x0d69('0xa0')]=function(_0x3d6af6,_0x20ddae){var _0x51d5b6={'raw':![],'where':{}};var _0x22f797={};var _0x1a8d87={'count':0x0,'rows':[]};return db['CmContact'][_0x0d69('0x7b')]({'where':{'id':_0x3d6af6[_0x0d69('0x69')]['id']}})[_0x0d69('0x19')](handleEntityNotFound(_0x20ddae,null))[_0x0d69('0x19')](function(_0x33abc1){if(_0x33abc1){_0x22f797['model']=_[_0x0d69('0x28')](db[_0x0d69('0x92')][_0x0d69('0x7e')]);_0x22f797[_0x0d69('0x2c')]=_[_0x0d69('0x28')](_0x3d6af6[_0x0d69('0x2c')]);_0x22f797['filters']=_['intersection'](_0x22f797['model'],_0x22f797[_0x0d69('0x2c')]);_0x51d5b6['attributes']=_['intersection'](_0x22f797[_0x0d69('0x7c')],qs[_0x0d69('0x80')](_0x3d6af6[_0x0d69('0x2c')][_0x0d69('0x80')]));_0x51d5b6[_0x0d69('0x81')]=_0x51d5b6[_0x0d69('0x81')][_0x0d69('0x27')]?_0x51d5b6[_0x0d69('0x81')]:_0x22f797[_0x0d69('0x7c')];if(!_0x3d6af6['query'][_0x0d69('0x34')](_0x0d69('0x89'))){_0x51d5b6[_0x0d69('0x12')]=qs[_0x0d69('0x12')](_0x3d6af6[_0x0d69('0x2c')][_0x0d69('0x12')]);_0x51d5b6['offset']=qs['offset'](_0x3d6af6[_0x0d69('0x2c')]['offset']);}_0x51d5b6[_0x0d69('0x82')]=qs[_0x0d69('0x83')](_0x3d6af6[_0x0d69('0x2c')][_0x0d69('0x83')]);_0x51d5b6[_0x0d69('0x5f')]=qs[_0x0d69('0x84')](_['pick'](_0x3d6af6[_0x0d69('0x2c')],_0x22f797[_0x0d69('0x84')]));_0x51d5b6['where'][_0x0d69('0xa1')]=_0x33abc1['id'];if(_0x3d6af6[_0x0d69('0x2c')]['filter']){_0x51d5b6[_0x0d69('0x5f')]=_[_0x0d69('0x87')](_0x51d5b6[_0x0d69('0x5f')],{'$or':_['map'](_0x51d5b6[_0x0d69('0x81')],function(_0x149ec5){var _0x1db6f3={};_0x1db6f3[_0x149ec5]={'$like':'%'+_0x3d6af6['query'][_0x0d69('0x86')]+'%'};return _0x1db6f3;})});}_0x51d5b6=_[_0x0d69('0x87')]({},_0x51d5b6,_0x3d6af6[_0x0d69('0x88')]);return db[_0x0d69('0x92')][_0x0d69('0x14')]({'where':_0x51d5b6[_0x0d69('0x5f')]})['then'](function(_0x5cad40){_0x1a8d87[_0x0d69('0x14')]=_0x5cad40;if(_0x3d6af6['query'][_0x0d69('0xa2')]){_0x51d5b6[_0x0d69('0xa3')]=[{'all':!![]}];}return db[_0x0d69('0x92')][_0x0d69('0x1f')](_0x51d5b6);})[_0x0d69('0x19')](function(_0x515b1d){_0x1a8d87['rows']=_0x515b1d;return _0x1a8d87;});}})[_0x0d69('0x19')](respondWithFilteredResult(_0x20ddae,_0x51d5b6))[_0x0d69('0x21')](handleError(_0x20ddae,null));};exports[_0x0d69('0xa4')]=function(_0x2ebc99,_0x4e8a44){var _0x1a60f7={'raw':!![],'where':{}};var _0x323a61={};var _0x2b7570={'count':0x0,'rows':[]};return db[_0x0d69('0x25')][_0x0d69('0x7b')]({'where':{'id':_0x2ebc99['params']['id']}})['then'](handleEntityNotFound(_0x4e8a44,null))[_0x0d69('0x19')](function(_0x4559d8){if(_0x4559d8){_0x323a61[_0x0d69('0x7c')]=_[_0x0d69('0x28')](db[_0x0d69('0x4e')][_0x0d69('0x7e')]);_0x323a61[_0x0d69('0x2c')]=_[_0x0d69('0x28')](_0x2ebc99[_0x0d69('0x2c')]);_0x323a61[_0x0d69('0x84')]=_[_0x0d69('0x7f')](_0x323a61[_0x0d69('0x7c')],_0x323a61['query']);_0x1a60f7[_0x0d69('0x81')]=_[_0x0d69('0x7f')](_0x323a61[_0x0d69('0x7c')],qs['fields'](_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0x80')]));_0x1a60f7[_0x0d69('0x81')]=_0x1a60f7[_0x0d69('0x81')][_0x0d69('0x27')]?_0x1a60f7[_0x0d69('0x81')]:_0x323a61[_0x0d69('0x7c')];if(!_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0x34')](_0x0d69('0x89'))){_0x1a60f7[_0x0d69('0x12')]=qs['limit'](_0x2ebc99['query']['limit']);_0x1a60f7[_0x0d69('0x15')]=qs[_0x0d69('0x15')](_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0x15')]);}_0x1a60f7[_0x0d69('0x82')]=qs[_0x0d69('0x83')](_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0x83')]);_0x1a60f7['where']=qs['filters'](_[_0x0d69('0x85')](_0x2ebc99[_0x0d69('0x2c')],_0x323a61[_0x0d69('0x84')]));_0x1a60f7['where'][_0x0d69('0xa1')]=_0x4559d8['id'];if(_0x2ebc99['query']['filter']){_0x1a60f7[_0x0d69('0x5f')]=_['merge'](_0x1a60f7[_0x0d69('0x5f')],{'$or':_[_0x0d69('0x73')](_0x1a60f7[_0x0d69('0x81')],function(_0x2cc74b){var _0x9b3b2f={};_0x9b3b2f[_0x2cc74b]={'$like':'%'+_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0x86')]+'%'};return _0x9b3b2f;})});}_0x1a60f7=_['merge']({},_0x1a60f7,_0x2ebc99['options']);return db[_0x0d69('0x4e')][_0x0d69('0x14')]({'where':_0x1a60f7[_0x0d69('0x5f')]})[_0x0d69('0x19')](function(_0x4bdb95){_0x2b7570[_0x0d69('0x14')]=_0x4bdb95;if(_0x2ebc99[_0x0d69('0x2c')][_0x0d69('0xa2')]){_0x1a60f7[_0x0d69('0xa3')]=[{'all':!![]}];}return db[_0x0d69('0x4e')][_0x0d69('0x1f')](_0x1a60f7);})[_0x0d69('0x19')](function(_0xf94800){_0x2b7570[_0x0d69('0xa5')]=_0xf94800;return _0x2b7570;});}})['then'](respondWithFilteredResult(_0x4e8a44,_0x1a60f7))[_0x0d69('0x21')](handleError(_0x4e8a44,null));};exports[_0x0d69('0xa6')]=function(_0x43d532,_0x4db37b){var _0x51b476={'raw':!![],'where':{}};var _0x898716={};var _0x45a355={'count':0x0,'rows':[]};return db[_0x0d69('0x25')]['findOne']({'where':{'id':_0x43d532[_0x0d69('0x69')]['id']}})[_0x0d69('0x19')](handleEntityNotFound(_0x4db37b,null))[_0x0d69('0x19')](function(_0x17ccb0){if(_0x17ccb0){_0x898716['model']=_['keys'](db[_0x0d69('0x4d')][_0x0d69('0x7e')]);_0x898716[_0x0d69('0x2c')]=_[_0x0d69('0x28')](_0x43d532[_0x0d69('0x2c')]);_0x898716[_0x0d69('0x84')]=_[_0x0d69('0x7f')](_0x898716[_0x0d69('0x7c')],_0x898716[_0x0d69('0x2c')]);_0x51b476[_0x0d69('0x81')]=_[_0x0d69('0x7f')](_0x898716[_0x0d69('0x7c')],qs[_0x0d69('0x80')](_0x43d532['query']['fields']));_0x51b476[_0x0d69('0x81')]=_0x51b476['attributes'][_0x0d69('0x27')]?_0x51b476[_0x0d69('0x81')]:_0x898716[_0x0d69('0x7c')];if(!_0x43d532[_0x0d69('0x2c')][_0x0d69('0x34')](_0x0d69('0x89'))){_0x51b476['limit']=qs[_0x0d69('0x12')](_0x43d532[_0x0d69('0x2c')][_0x0d69('0x12')]);_0x51b476[_0x0d69('0x15')]=qs[_0x0d69('0x15')](_0x43d532[_0x0d69('0x2c')]['offset']);}_0x51b476[_0x0d69('0x82')]=qs['sort'](_0x43d532[_0x0d69('0x2c')]['sort']);_0x51b476[_0x0d69('0x5f')]=qs[_0x0d69('0x84')](_['pick'](_0x43d532[_0x0d69('0x2c')],_0x898716['filters']));_0x51b476[_0x0d69('0x5f')][_0x0d69('0xa1')]=_0x17ccb0['id'];if(_0x43d532[_0x0d69('0x2c')][_0x0d69('0x86')]){_0x51b476[_0x0d69('0x5f')]=_[_0x0d69('0x87')](_0x51b476[_0x0d69('0x5f')],{'$or':_['map'](_0x51b476[_0x0d69('0x81')],function(_0x549eda){var _0x29e7ea={};_0x29e7ea[_0x549eda]={'$like':'%'+_0x43d532['query'][_0x0d69('0x86')]+'%'};return _0x29e7ea;})});}_0x51b476=_['merge']({},_0x51b476,_0x43d532[_0x0d69('0x88')]);return db['CmHopperFinal'][_0x0d69('0x14')]({'where':_0x51b476['where']})[_0x0d69('0x19')](function(_0x38f3b0){_0x45a355['count']=_0x38f3b0;if(_0x43d532[_0x0d69('0x2c')][_0x0d69('0xa2')]){_0x51b476[_0x0d69('0xa3')]=[{'all':!![]}];}return db[_0x0d69('0x4d')]['findAll'](_0x51b476);})[_0x0d69('0x19')](function(_0x1aedbe){_0x45a355[_0x0d69('0xa5')]=_0x1aedbe;return _0x45a355;});}})['then'](respondWithFilteredResult(_0x4db37b,_0x51b476))[_0x0d69('0x21')](handleError(_0x4db37b,null));};exports[_0x0d69('0xa7')]=function(_0x28d97d,_0x47817a){var _0x50763c={'raw':!![],'where':{}};var _0x177f79={};var _0x273e9d={'count':0x0,'rows':[]};return db[_0x0d69('0x25')][_0x0d69('0x7b')]({'where':{'id':_0x28d97d[_0x0d69('0x69')]['id']}})[_0x0d69('0x19')](handleEntityNotFound(_0x47817a,null))[_0x0d69('0x19')](function(_0x404184){if(_0x404184){_0x177f79[_0x0d69('0x7c')]=_['keys'](db[_0x0d69('0x53')]['rawAttributes']);_0x177f79['query']=_[_0x0d69('0x28')](_0x28d97d[_0x0d69('0x2c')]);_0x177f79[_0x0d69('0x84')]=_[_0x0d69('0x7f')](_0x177f79[_0x0d69('0x7c')],_0x177f79[_0x0d69('0x2c')]);_0x50763c[_0x0d69('0x81')]=_[_0x0d69('0x7f')](_0x177f79[_0x0d69('0x7c')],qs[_0x0d69('0x80')](_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x80')]));_0x50763c[_0x0d69('0x81')]=_0x50763c[_0x0d69('0x81')]['length']?_0x50763c[_0x0d69('0x81')]:_0x177f79[_0x0d69('0x7c')];if(!_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x34')](_0x0d69('0x89'))){_0x50763c['limit']=qs[_0x0d69('0x12')](_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x12')]);_0x50763c[_0x0d69('0x15')]=qs[_0x0d69('0x15')](_0x28d97d['query'][_0x0d69('0x15')]);}_0x50763c['order']=qs[_0x0d69('0x83')](_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x83')]);_0x50763c[_0x0d69('0x5f')]=qs[_0x0d69('0x84')](_[_0x0d69('0x85')](_0x28d97d[_0x0d69('0x2c')],_0x177f79['filters']));_0x50763c['where']['ContactId']=_0x404184['id'];if(_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x86')]){_0x50763c['where']=_[_0x0d69('0x87')](_0x50763c[_0x0d69('0x5f')],{'$or':_[_0x0d69('0x73')](_0x50763c[_0x0d69('0x81')],function(_0x10a168){var _0x1fa834={};_0x1fa834[_0x10a168]={'$like':'%'+_0x28d97d[_0x0d69('0x2c')][_0x0d69('0x86')]+'%'};return _0x1fa834;})});}_0x50763c=_[_0x0d69('0x87')]({},_0x50763c,_0x28d97d[_0x0d69('0x88')]);return db['JscriptySessionReport']['count']({'where':_0x50763c[_0x0d69('0x5f')]})[_0x0d69('0x19')](function(_0xb2111a){_0x273e9d[_0x0d69('0x14')]=_0xb2111a;if(_0x28d97d[_0x0d69('0x2c')][_0x0d69('0xa2')]){_0x50763c['include']=[{'all':!![]}];}return db[_0x0d69('0x53')]['findAll'](_0x50763c);})[_0x0d69('0x19')](function(_0x13e844){_0x273e9d[_0x0d69('0xa5')]=_0x13e844;return _0x273e9d;});}})[_0x0d69('0x19')](respondWithFilteredResult(_0x47817a,_0x50763c))[_0x0d69('0x21')](handleError(_0x47817a,null));};exports['uploadCsv']=function(_0x34d607,_0x5032fe){try{if(!_0x34d607[_0x0d69('0x35')][_0x0d69('0x62')]){throw new Error(_0x0d69('0xa8'));}if(!_0x34d607['body']['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x34d607[_0x0d69('0x35')][_0x0d69('0xa9')]){throw new Error(_0x0d69('0xaa'));}if(!_0x34d607[_0x0d69('0x35')][_0x0d69('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x233d13=_0x34d607['body']['binding_keys'][_0x0d69('0xac')](',');var _0x48adbc=_0x34d607['body'][_0x0d69('0xa9')][_0x0d69('0xac')](',');if(!_0x233d13[_0x0d69('0x27')]||!_0x48adbc[_0x0d69('0x27')]||_0x233d13[_0x0d69('0x27')]!==_0x48adbc[_0x0d69('0x27')]){throw new Error(_0x0d69('0xad'));}_0x34d607[_0x0d69('0x35')][_0x0d69('0x80')]=_[_0x0d69('0xae')](_0x233d13,_0x48adbc);if(!_0x34d607[_0x0d69('0x35')]['fields'][_0x0d69('0x79')]){throw new Error(_0x0d69('0xaf'));}if(!_0x34d607['body']['fields'][_0x0d69('0xb0')]){throw new Error(_0x0d69('0xb1'));}var _0x3168e9=path[_0x0d69('0x3a')](config[_0x0d69('0xb2')],_0x0d69('0xb3'),_0x34d607[_0x0d69('0xb4')]['filename']);fs['chmodSync'](_0x3168e9,parseInt(_0x0d69('0xb5'),0x8));var _0x143085=require(_0x0d69('0xb6'))[_0x0d69('0xb7')](path[_0x0d69('0x3a')](__dirname,_0x0d69('0xb8')),[_0x3168e9,_0x34d607[_0x0d69('0x35')]['binding_keys'],_0x34d607[_0x0d69('0x35')][_0x0d69('0xa9')],_0x34d607[_0x0d69('0x35')][_0x0d69('0x62')],_0x34d607['body']['CompanyId'],_0x34d607[_0x0d69('0x35')][_0x0d69('0x5e')],_0x34d607[_0x0d69('0x35')]['socket_timestamp']]);return _0x5032fe[_0x0d69('0x10')](0xc8)[_0x0d69('0x11')]({'message':_0x0d69('0xb9'),'pid':_0x143085[_0x0d69('0xba')]});}catch(_0x48bfb4){return _0x5032fe[_0x0d69('0x10')](0x1f4)[_0x0d69('0xbb')](_0x48bfb4);}};exports[_0x0d69('0xbc')]=function(_0xd8ce3d,_0x4b2ddd){var _0x260b0e=fs[_0x0d69('0xbd')](_0xd8ce3d[_0x0d69('0xb4')][_0x0d69('0x1')]);Papa['parse'](_0x260b0e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x17b363){return _0x4b2ddd[_0x0d69('0x10')](0xc8)[_0x0d69('0x11')]({'file':_0xd8ce3d[_0x0d69('0xb4')],'fields':_0x17b363['meta'][_0x0d69('0x80')]});}});};exports[_0x0d69('0xbe')]=function(_0x4edbfb,_0x1ed899){return db[_0x0d69('0xbf')][_0x0d69('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0d69('0xc0')}})[_0x0d69('0x19')](function(_0x47da26){var _0x1b2182=![];if(!_0x4edbfb['body'][_0x0d69('0x62')]){throw new Error(_0x0d69('0xa8'));}if(!_0x4edbfb['body'][_0x0d69('0xc1')][_0x0d69('0x79')]){throw new Error(_0x0d69('0xaf'));}if(!_0x4edbfb[_0x0d69('0x35')][_0x0d69('0xc1')][_0x0d69('0xb0')]){throw new Error(_0x0d69('0xb1'));}if(!_0x4edbfb[_0x0d69('0x35')]['socket_timestamp']){throw new Error(_0x0d69('0xc2'));}var _0x4dbde6=require(_0x0d69('0xb6'))[_0x0d69('0xb7')](path[_0x0d69('0x3a')](__dirname,_0x0d69('0xc3')),[_0x4edbfb[_0x0d69('0x69')]['id'],JSON[_0x0d69('0xc4')](_0x4edbfb[_0x0d69('0x35')]),JSON[_0x0d69('0xc4')](_0x47da26)]);_0x4dbde6['on'](_0x0d69('0xc5'),function(){_0x1b2182=!![];return _0x1ed899[_0x0d69('0x10')](0xc8)['json']({'message':_0x0d69('0xc6'),'pid':_0x4dbde6[_0x0d69('0xba')]});});_0x4dbde6['on'](_0x0d69('0xc7'),function(_0x3f0772){if(_0x3f0772&&!_0x1b2182){return _0x1ed899['status'](0x1f4)[_0x0d69('0x11')]({'message':_0x0d69('0xc8'),'pid':_0x4dbde6['pid']});}});})[_0x0d69('0x21')](handleError(_0x1ed899,null));};exports[_0x0d69('0xc9')]=function(_0x300fe5,_0x3ce886){return db[_0x0d69('0xbf')][_0x0d69('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x334e5c){var _0x3c7d48=![];if(!_0x300fe5[_0x0d69('0x35')][_0x0d69('0x62')]){throw new Error('No\x20ListId\x20specified');}if(!_0x300fe5[_0x0d69('0x35')]['binding'][_0x0d69('0x79')]){throw new Error(_0x0d69('0xaf'));}if(!_0x300fe5[_0x0d69('0x35')][_0x0d69('0xc1')][_0x0d69('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x300fe5[_0x0d69('0x35')][_0x0d69('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x110adb=require(_0x0d69('0xb6'))[_0x0d69('0xb7')](path[_0x0d69('0x3a')](__dirname,_0x0d69('0xca')),[_0x300fe5[_0x0d69('0x69')]['id'],JSON[_0x0d69('0xc4')](_0x300fe5['body']),JSON[_0x0d69('0xc4')](_0x334e5c)]);_0x110adb['on'](_0x0d69('0xc5'),function(){_0x3c7d48=!![];return _0x3ce886[_0x0d69('0x10')](0xc8)[_0x0d69('0x11')]({'message':_0x0d69('0xc6'),'pid':_0x110adb['pid']});});_0x110adb['on']('exit',function(_0x411a96){if(_0x411a96&&!_0x3c7d48){return _0x3ce886[_0x0d69('0x10')](0x1f4)['json']({'message':_0x0d69('0xc8'),'pid':_0x110adb[_0x0d69('0xba')]});}});})[_0x0d69('0x21')](handleError(_0x3ce886,null));};exports[_0x0d69('0xcb')]=function(_0x18e438,_0x35ff02){var _0x104fdf=[_0x0d69('0xcc'),_0x0d69('0xcd'),_0x0d69('0xce'),'openchannel','fax',_0x0d69('0xcf'),_0x0d69('0xd0')];var _0x18499d={'offset':0x0,'order':qs[_0x0d69('0x83')](_0x0d69('0xd1'))},_0x21392b={'count':0x0,'rows':[]};Promise[_0x0d69('0xd2')]()[_0x0d69('0x19')](function(){if(_0x18e438[_0x0d69('0x2c')][_0x0d69('0xd3')]){if(!_[_0x0d69('0xd4')](_0x104fdf,_0x18e438[_0x0d69('0x2c')][_0x0d69('0xd3')]['toLowerCase']())){throw new Error(_0x0d69('0xd5'));}_0x104fdf=[_0x18e438[_0x0d69('0x2c')][_0x0d69('0xd3')]['toLowerCase']()];}if(_0x18e438[_0x0d69('0x2c')]['range']){try{var _0x3b47ce=JSON[_0x0d69('0xd6')](_0x18e438[_0x0d69('0x2c')]['range']);if(!moment(_0x3b47ce[_0x0d69('0x36')])[_0x0d69('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3b47ce['to'])[_0x0d69('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x5eb1bc){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x18e438[_0x0d69('0x2c')][_0x0d69('0x34')](_0x0d69('0x89'))){_0x18499d[_0x0d69('0x12')]=qs[_0x0d69('0x12')](_0x18e438[_0x0d69('0x2c')][_0x0d69('0x12')]||0xa);_0x18499d[_0x0d69('0x15')]=qs[_0x0d69('0x15')](_0x18e438['query'][_0x0d69('0x15')]);}var _0x41c1da=_0x104fdf[_0x0d69('0x73')](function(_0x20222e){if(_0x20222e===_0x0d69('0xd0')){var _0x369ba4={'attributes':['id','uniqueid',_0x0d69('0x31'),'source','destination',_0x0d69('0xd8'),_0x0d69('0xd9'),_0x0d69('0xda'),_0x0d69('0xdb'),_0x0d69('0xdc'),_0x0d69('0xdd'),_0x0d69('0xde'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x18e438[_0x0d69('0x69')]['id']},'include':[{'model':db[_0x0d69('0xbf')],'as':_0x0d69('0xbf'),'attributes':['id',_0x0d69('0x1c'),_0x0d69('0xdf'),_0x0d69('0x2f')]}],'order':[[_0x0d69('0xdd'),_0x0d69('0xe0')]]};if(_0x18e438[_0x0d69('0x2c')][_0x0d69('0xe1')]){_0x369ba4[_0x0d69('0x5f')][_0x0d69('0xdd')]={'$gte':_0x3b47ce[_0x0d69('0x36')],'$lte':_0x3b47ce['to']};}return db[_0x0d69('0x50')][_0x0d69('0xe2')](_0x369ba4)[_0x0d69('0x19')](function(_0x21fb6c){_0x21392b[_0x0d69('0x14')]+=_0x21fb6c[_0x0d69('0x14')];return _[_0x0d69('0x73')](_0x21fb6c[_0x0d69('0xa5')],function(_0x4c1252){var _0x2ff9ef=_0x4c1252['get']({'plain':!![]});_0x2ff9ef[_0x0d69('0xd3')]=_0x20222e;if(_0x2ff9ef[_0x0d69('0xbf')]){_0x2ff9ef[_0x0d69('0xbf')]={'id':_0x2ff9ef['User']['id'],'name':_0x2ff9ef['User'][_0x0d69('0x1c')],'fullname':_0x2ff9ef[_0x0d69('0xbf')][_0x0d69('0xdf')],'alias':_0x2ff9ef[_0x0d69('0xbf')][_0x0d69('0x2f')]};}return _0x2ff9ef;});});}else{var _0x1118cc=_[_0x0d69('0xe3')](_0x20222e)+(_0x20222e==='chat'?_0x0d69('0xe4'):_0x0d69('0xe5'));var _0xb29e93={'attributes':['id',_0x0d69('0xe6'),_0x0d69('0xe7'),_0x0d69('0xdd'),'note',_0x0d69('0xe8'),_0x0d69('0xe9'),_0x0d69('0xea'),_0x0d69('0xeb'),_0x1118cc+'Id'],'where':{'ContactId':_0x18e438[_0x0d69('0x69')]['id']},'include':[{'model':db[_0x1118cc],'as':_0x0d69('0xe5'),'attributes':['id','name','key']},{'model':db[_0x0d69('0xbf')],'as':'Owner','attributes':['id','name','fullname']},{'model':db[_0x0d69('0x7d')],'as':'Tags','attributes':['id',_0x0d69('0x1c'),_0x0d69('0xec')],'through':{'attributes':[]}}],'order':[['createdAt',_0x0d69('0xe0')]]};if(_0x18e438[_0x0d69('0x2c')][_0x0d69('0xe1')]){_0xb29e93[_0x0d69('0x5f')][_0x0d69('0xdd')]={'$gte':_0x3b47ce[_0x0d69('0x36')],'$lte':_0x3b47ce['to']};}switch(_0x20222e){case _0x0d69('0xcd'):_0xb29e93[_0x0d69('0x81')][_0x0d69('0x61')](_0x0d69('0xed'),_0x0d69('0xee'),'customerPort',_0x0d69('0xef'),_0x0d69('0xf0'),_0x0d69('0xf1'),_0x0d69('0xf2'),_0x0d69('0xf3'),_0x0d69('0xf4'));break;case'mail':_0xb29e93[_0x0d69('0x81')][_0x0d69('0x61')](_0x0d69('0xf5'),_0x0d69('0xf6'));break;case _0x0d69('0xf7'):_0xb29e93[_0x0d69('0x81')][_0x0d69('0x61')]('externalUrl','threadId');break;}return db[_[_0x0d69('0xe3')](_0x20222e)+'Interaction'][_0x0d69('0xe2')](_0xb29e93)[_0x0d69('0x19')](function(_0x55f2bf){_0x21392b[_0x0d69('0x14')]+=_0x55f2bf[_0x0d69('0x14')];return _[_0x0d69('0x73')](_0x55f2bf['rows'],function(_0x347c78){var _0x5ca69c=_0x347c78[_0x0d69('0x37')]({'plain':!![]});_0x5ca69c['channel']=_0x20222e;if(_0x5ca69c[_0x0d69('0xf8')]){_0x5ca69c[_0x0d69('0xf8')]={'id':_0x5ca69c[_0x0d69('0xf8')]['id'],'name':_0x5ca69c[_0x0d69('0xf8')][_0x0d69('0x1c')],'fullname':_0x5ca69c['Owner'][_0x0d69('0xdf')]};}return _0x5ca69c;});});}});return Promise[_0x0d69('0x66')](_0x41c1da);})['then'](function(_0x21fe19){return _(_0x21fe19)[_0x0d69('0xf9')]()[_0x0d69('0xfa')](_0x0d69('0xdd'))[_0x0d69('0xfb')]()[_0x0d69('0xfc')]();})['then'](function(_0x39e6ce){_0x21392b[_0x0d69('0xa5')]=_0x18499d['limit']?_0x39e6ce['slice'](_0x18499d[_0x0d69('0x15')],_0x18499d[_0x0d69('0x15')]+_0x18499d[_0x0d69('0x12')]):_0x39e6ce;return _0x21392b;})[_0x0d69('0x19')](respondWithFilteredResult(_0x35ff02,_0x18499d))[_0x0d69('0x21')](handleError(_0x35ff02,null));}; \ No newline at end of file +var _0x33d4=['literal','$and','omit','map','format','cf_%d','pickBy','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','values','getTags','findOne','model','rawAttributes','filters','intersection','fields','attributes','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','OrderBy','phone','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','rows','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','root','file','chmodSync','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','import','agent','binding','No\x20phone\x20column\x20specified','firstName','socket_timestamp','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','No\x20firstName\x20column\x20specified','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','UserId','User','alias','DESC','findAndCountAll','fullname','Account','closedAt','disposition','secondDisposition','key','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','threadId','startCase','Interaction','Owner','flatten','sortBy','slice','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','offset','limit','count','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','columnName','analytics','CmCustomField','length','displayName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','get','isArray','CmHopper','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','contact','all','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize'];(function(_0x4e9689,_0x1c5cd8){var _0x2dbda2=function(_0x131fd7){while(--_0x131fd7){_0x4e9689['push'](_0x4e9689['shift']());}};_0x2dbda2(++_0x1c5cd8);}(_0x33d4,0x188));var _0x433d=function(_0x5a34f7,_0x58e002){_0x5a34f7=_0x5a34f7-0x0;var _0x499d73=_0x33d4[_0x5a34f7];return _0x499d73;};'use strict';var moment=require('moment');var BPromise=require(_0x433d('0x0'));var util=require(_0x433d('0x1'));var path=require(_0x433d('0x2'));var fs=require('fs');var _=require(_0x433d('0x3'));var squel=require(_0x433d('0x4'));var Papa=require(_0x433d('0x5'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x433d('0x6'));var logger=require(_0x433d('0x7'))(_0x433d('0x8'));var config=require('../../config/environment');var shared=require(_0x433d('0x9'));var db=require(_0x433d('0xa'))['db'];config[_0x433d('0xb')]=_[_0x433d('0xc')](config[_0x433d('0xb')],{'host':_0x433d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x433d('0xb')]));require(_0x433d('0xe'))[_0x433d('0xf')](socket);function respondWithResult(_0x26835f,_0x3329a0){_0x3329a0=_0x3329a0||0xc8;return function(_0x45d64c){if(_0x45d64c){return _0x26835f[_0x433d('0x10')](_0x3329a0)['json'](_0x45d64c);}};}function respondWithFilteredResult(_0xca481c,_0x3a0709){return function(_0x2011f3){if(_0x2011f3){var _0x155a07=typeof _0x3a0709[_0x433d('0x11')]==='undefined'&&typeof _0x3a0709[_0x433d('0x12')]==='undefined';var _0x54928a=_0x2011f3[_0x433d('0x13')];var _0x1173d4=_0x155a07?0x0:_0x3a0709[_0x433d('0x11')];var _0x20fb94=_0x155a07?_0x2011f3[_0x433d('0x13')]:_0x3a0709[_0x433d('0x11')]+_0x3a0709['limit'];var _0x4749b6;if(_0x20fb94>=_0x54928a){_0x20fb94=_0x54928a;_0x4749b6=0xc8;}else{_0x4749b6=0xce;}_0xca481c[_0x433d('0x10')](_0x4749b6);return _0xca481c['set'](_0x433d('0x14'),_0x1173d4+'-'+_0x20fb94+'/'+_0x54928a)[_0x433d('0x15')](_0x2011f3);}return null;};}function saveUpdates(_0x4ae968){return function(_0x526d83){if(_0x526d83){return _0x526d83[_0x433d('0x16')](_0x4ae968)[_0x433d('0x17')](function(_0x52c872){return _0x52c872;});}return null;};}function removeEntity(_0x10abe6){return function(_0x368e38){if(_0x368e38){return _0x368e38[_0x433d('0x18')]()[_0x433d('0x17')](function(){_0x10abe6['status'](0xcc)[_0x433d('0x19')]();});}};}function handleEntityNotFound(_0x372f5a){return function(_0x391dc5){if(!_0x391dc5){_0x372f5a[_0x433d('0x1a')](0x194);}return _0x391dc5;};}function handleError(_0x386ef2,_0x9d2104){_0x9d2104=_0x9d2104||0x1f4;return function(_0x1df531){logger['error'](_0x1df531[_0x433d('0x1b')]);if(_0x1df531[_0x433d('0x1c')]){delete _0x1df531[_0x433d('0x1c')];}_0x386ef2[_0x433d('0x10')](_0x9d2104)[_0x433d('0x1d')](_0x1df531);};}exports[_0x433d('0x1e')]=function(_0x79a56d,_0x497b88){var _0x329e1a={};return contacts[_0x433d('0x1f')]()[_0x433d('0x17')](function(_0x23e191){_0x329e1a=qs[_0x433d('0x20')](_0x23e191,_0x79a56d);return contacts[_0x433d('0x21')](_0x79a56d[_0x433d('0x22')],_0x79a56d[_0x433d('0x23')],_0x329e1a,_0x23e191);})['then'](respondWithFilteredResult(_0x497b88,_0x329e1a))[_0x433d('0x24')](handleError(_0x497b88,null));};exports[_0x433d('0x18')]=function(_0x386320,_0x198b60){return db[_0x433d('0x25')][_0x433d('0x26')]({'where':{'id':_0x386320[_0x433d('0x27')]['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x198b60,null))[_0x433d('0x17')](removeEntity(_0x198b60,null))[_0x433d('0x24')](handleError(_0x198b60,null));};exports[_0x433d('0x1f')]=function(_0x3b97ad,_0x2765e7){return db['CmContact'][_0x433d('0x1f')]()[_0x433d('0x17')](function(_0xfd5c90){delete _0xfd5c90[_0x433d('0x28')];for(var _0x2f6731=0x0;_0x2f67310x0){return new Promise(function(_0x2f0fcc){var _0x55a169=[];for(var _0x1559fc=0x0;_0x1559fc<_0x3e084a[_0x433d('0x2f')];_0x1559fc++){_0x55a169[_0x433d('0x5d')](insertAdditionalPhones(_0x3e084a[_0x1559fc][_0x433d('0x60')],_0x3e084a[_0x1559fc][_0x433d('0x57')]));}Promise[_0x433d('0x61')](_0x55a169)[_0x433d('0x17')](function(){_0x2f0fcc(0x1);});})[_0x433d('0x17')](function(){return{'success':_0x5ed600,'failure':_0x5dd2b6,'duplicates':_0x156285};});}else{return{'success':_0x5ed600,'failure':_0x5dd2b6,'duplicates':_0x156285};}}})['then'](respondWithResult(_0x2683d7,0xc9))['catch'](handleError(_0x2683d7,null));};exports[_0x433d('0x62')]=function(_0x25edec,_0x3ea443){var _0x22b3ca;return db[_0x433d('0x25')][_0x433d('0x1f')]()[_0x433d('0x17')](function(_0x281093){return db[_0x433d('0x25')][_0x433d('0x26')]({'where':{'id':_0x25edec['params']['id']},'include':[{'model':db[_0x433d('0x63')],'as':_0x433d('0x64'),'attributes':['id',_0x433d('0x1c'),_0x433d('0x65')],'required':_0x25edec['query'][_0x433d('0x66')]?!![]:![]},{'model':db[_0x433d('0x67')],'as':_0x433d('0x68'),'where':{'CmContactId':_0x25edec[_0x433d('0x27')]['id']},'required':![],'include':[{'model':db[_0x433d('0x69')],'as':_0x433d('0x6a')}]}],'order':[db[_0x433d('0x6b')][_0x433d('0x6c')]('Phones.OrderBy')],'attributes':_[_0x433d('0x29')](_0x281093)});})['then'](function(_0x5210cb){if(!_[_0x433d('0x53')](_0x5210cb)){_0x22b3ca=_0x5210cb['get']({'plain':!![]});var _0x126c15={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5210cb&&_0x5210cb[_0x433d('0x5e')]){if(_0x5210cb[_0x433d('0x5e')]){_0x126c15['where'][_0x433d('0x6d')]['push']({'ListId':{'$ne':_0x5210cb[_0x433d('0x5e')]}});}}return db[_0x433d('0x2e')][_0x433d('0x21')](_0x126c15);}})[_0x433d('0x17')](function(_0x6cad9){if(!_[_0x433d('0x53')](_0x6cad9)){return _[_0x433d('0x6e')](_0x22b3ca,_[_0x433d('0x6f')](_0x6cad9,function(_0x3499d3){return util[_0x433d('0x70')](_0x433d('0x71'),_0x3499d3['id']);}));}})[_0x433d('0x17')](handleEntityNotFound(_0x3ea443,null))[_0x433d('0x17')](respondWithResult(_0x3ea443,null))[_0x433d('0x24')](handleError(_0x3ea443,null));};exports['update']=function(_0xb84eb2,_0x540f5d){var _0x4ca02a;if(_0xb84eb2['body']['id']){delete _0xb84eb2['body']['id'];}if(!_['isNil'](_0xb84eb2['body'][_0x433d('0x54')])){var _0x5ae2db=_0xb84eb2[_0x433d('0x37')][_0x433d('0x54')];if(!_['isNil'](shared[_0x433d('0x55')][_0x5ae2db]))_0xb84eb2[_0x433d('0x37')][_0x433d('0x56')]=shared[_0x433d('0x55')][_0x5ae2db]['utcOffset'];}return db['CmContact']['find']({'where':{'id':_0xb84eb2['params']['id']}})['then'](handleEntityNotFound(_0x540f5d,null))[_0x433d('0x17')](saveUpdates(_0xb84eb2[_0x433d('0x37')],null))[_0x433d('0x17')](function(_0x18cd8f){_0x4ca02a=_0x18cd8f;var _0x4d4880={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x18cd8f&&_0x18cd8f[_0x433d('0x5e')]){if(_0x18cd8f[_0x433d('0x5e')]){_0x4d4880[_0x433d('0x5b')][_0x433d('0x6d')]['push']({'ListId':{'$ne':_0x18cd8f[_0x433d('0x5e')]}});}}return db['CmCustomField'][_0x433d('0x21')](_0x4d4880);})[_0x433d('0x17')](function(_0x59c6a0){if(_0x59c6a0){return _[_0x433d('0x6e')](_[_0x433d('0x72')](_0xb84eb2[_0x433d('0x37')],function(_0x986664,_0x499426){return _[_0x433d('0x2a')](_0x499426,_0x433d('0x2b'));}),_[_0x433d('0x6f')](_0x59c6a0,function(_0x24c7cc){return util['format'](_0x433d('0x71'),_0x24c7cc['id']);}));}})[_0x433d('0x17')](function(_0x330ccd){if(_0x330ccd&&!_[_0x433d('0x73')](_0x330ccd)){var _0x13a527=squel[_0x433d('0x16')]()['table'](_0x433d('0x74'))[_0x433d('0x75')](_0x330ccd)['where'](_0x433d('0x76'),_0xb84eb2['params']['id'])[_0x433d('0x77')]();return db[_0x433d('0x6b')][_0x433d('0x22')](_0x13a527[_0x433d('0x78')],{'replacements':_0x13a527[_0x433d('0x79')]});}})[_0x433d('0x17')](function(){if(_0xb84eb2[_0x433d('0x37')]['phone']&&_0x4ca02a){return db[_0x433d('0x3a')][_0x433d('0x16')]({'phone':_0xb84eb2[_0x433d('0x37')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x4ca02a['id']}});}})[_0x433d('0x17')](function(){return _0x4ca02a;})[_0x433d('0x17')](respondWithResult(_0x540f5d,null))[_0x433d('0x24')](handleError(_0x540f5d,null));};exports[_0x433d('0x7a')]=function(_0x1e96c3,_0x59cb35){var _0x107314={};var _0x21ccae={};var _0x297c12;var _0x544cd9;return db[_0x433d('0x25')][_0x433d('0x7b')]({'where':{'id':_0x1e96c3[_0x433d('0x27')]['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x59cb35,null))['then'](function(_0x31922e){if(_0x31922e){_0x297c12=_0x31922e;_0x21ccae[_0x433d('0x7c')]=_[_0x433d('0x29')](db[_0x433d('0x63')][_0x433d('0x7d')]);_0x21ccae[_0x433d('0x22')]=_[_0x433d('0x29')](_0x1e96c3['query']);_0x21ccae[_0x433d('0x7e')]=_[_0x433d('0x7f')](_0x21ccae[_0x433d('0x7c')],_0x21ccae[_0x433d('0x22')]);_0x107314['attributes']=_['intersection'](_0x21ccae[_0x433d('0x7c')],qs[_0x433d('0x80')](_0x1e96c3[_0x433d('0x22')][_0x433d('0x80')]));_0x107314['attributes']=_0x107314[_0x433d('0x81')]['length']?_0x107314[_0x433d('0x81')]:_0x21ccae['model'];_0x107314[_0x433d('0x82')]=qs[_0x433d('0x83')](_0x1e96c3[_0x433d('0x22')][_0x433d('0x83')]);_0x107314[_0x433d('0x5b')]=qs['filters'](_[_0x433d('0x84')](_0x1e96c3[_0x433d('0x22')],_0x21ccae[_0x433d('0x7e')]));if(_0x1e96c3[_0x433d('0x22')]['filter']){_0x107314[_0x433d('0x5b')]=_['merge'](_0x107314[_0x433d('0x5b')],{'$or':_[_0x433d('0x6f')](_0x107314['attributes'],function(_0x5f12c7){var _0x3c20a5={};_0x3c20a5[_0x5f12c7]={'$like':'%'+_0x1e96c3[_0x433d('0x22')][_0x433d('0x85')]+'%'};return _0x3c20a5;})});}_0x107314=_[_0x433d('0x36')]({},_0x107314,_0x1e96c3[_0x433d('0x86')]);return _0x297c12['getTags'](_0x107314);}})[_0x433d('0x17')](function(_0x55304a){if(_0x55304a){_0x544cd9=_0x55304a['length'];if(!_0x1e96c3[_0x433d('0x22')][_0x433d('0x35')](_0x433d('0x87'))){_0x107314[_0x433d('0x12')]=qs[_0x433d('0x12')](_0x1e96c3[_0x433d('0x22')][_0x433d('0x12')]);_0x107314[_0x433d('0x11')]=qs[_0x433d('0x11')](_0x1e96c3[_0x433d('0x22')][_0x433d('0x11')]);}return _0x297c12[_0x433d('0x7a')](_0x107314);}})[_0x433d('0x17')](function(_0x5d45e8){if(_0x5d45e8){return _0x5d45e8?{'count':_0x544cd9,'rows':_0x5d45e8}:null;}})['then'](respondWithResult(_0x59cb35,null))[_0x433d('0x24')](handleError(_0x59cb35,null));};exports[_0x433d('0x88')]=function(_0x2a7013,_0x41ce15){if(_0x2a7013[_0x433d('0x37')]['id']){delete _0x2a7013[_0x433d('0x37')]['id'];}return db[_0x433d('0x25')][_0x433d('0x7b')]({'where':{'id':_0x2a7013[_0x433d('0x27')]['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x41ce15,null))['then'](function(_0x548a5f){if(_0x548a5f){return _0x548a5f[_0x433d('0x88')](_0x2a7013[_0x433d('0x37')][_0x433d('0x89')]||[]);}return null;})[_0x433d('0x17')](respondWithResult(_0x41ce15,null))['catch'](handleError(_0x41ce15,null));};exports[_0x433d('0x8a')]=function(_0x35a56e,_0x1d9fc8){var _0x55e1d4=[];_0x55e1d4[_0x433d('0x5d')](addAdditionalPhones(_0x35a56e[_0x433d('0x37')]));Promise[_0x433d('0x61')](_0x55e1d4)[_0x433d('0x17')](function(){_0x55e1d4=[];_0x55e1d4[_0x433d('0x5d')](deleteCmHopperPhones(_0x35a56e[_0x433d('0x37')]['id']));_0x55e1d4[_0x433d('0x5d')](addCmHopperPhones(_0x35a56e[_0x433d('0x37')]['id']));Promise[_0x433d('0x61')](_0x55e1d4)[_0x433d('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x1d9fc8,null));});};function addAdditionalPhones(_0xd5d699){var _0x14179e;return new Promise(function(_0x3c6403){return db[_0x433d('0x67')][_0x433d('0x18')]({'where':{'CmContactId':_0xd5d699['id']}})[_0x433d('0x17')](function(){db[_0x433d('0x69')][_0x433d('0x21')]({'raw':!![],'attributes':['id','OrderBy']})[_0x433d('0x17')](function(_0x528a5b){var _0x2d89c4=[];for(var _0x37fc44=0x0;_0x37fc44<_0xd5d699[_0x433d('0x8b')][_0x433d('0x2f')];_0x37fc44++){var _0x14d36c=_0xd5d699[_0x433d('0x8c')]?_[_0x433d('0x53')](_0xd5d699['item_types'][_0x37fc44])?'':_0xd5d699['item_types'][_0x37fc44]:_0xd5d699[_0x433d('0x8b')][_0x37fc44][_0x433d('0x8d')]?_0xd5d699[_0x433d('0x8b')][_0x37fc44][_0x433d('0x8d')]:'';var _0x76dfe2=_['isNil'](_0xd5d699['items'][_0x37fc44]['description'])?'':_0xd5d699[_0x433d('0x8b')][_0x37fc44]['description'];var _0x3e5229=_0x14d36c+':'+_0xd5d699['items'][_0x37fc44]['phone']+'§'+_0x76dfe2;if(_['isNil'](_0x14179e))_0x14179e=_0x3e5229;else _0x14179e+=';'+_0x3e5229;var _0x2c17c2=null;var _0x433f3b=null;if(_0xd5d699[_0x433d('0x8c')]){if(!_['isNil'](_0xd5d699[_0x433d('0x8c')][_0x37fc44])){_0x433f3b=_[_0x433d('0x26')](_0x528a5b,function(_0x571597){return _0x571597['id']===_0xd5d699[_0x433d('0x8c')][_0x37fc44];});if(!_[_0x433d('0x53')](_0x433f3b)){_0x2c17c2=_0x433f3b[_0x433d('0x8e')];}}}else{if(!_['isNil'](_0xd5d699['items'][_0x37fc44])){_0x433f3b=_[_0x433d('0x26')](_0x528a5b,function(_0x337a00){return _0x337a00['id']===_0xd5d699[_0x433d('0x8b')][_0x37fc44][_0x433d('0x8d')];});if(!_[_0x433d('0x53')](_0x433f3b)){_0x2c17c2=_0x37fc44;}}}if(_['isNil'](_0x2c17c2)){_0x2c17c2=0x64;}_0x2d89c4[_0x433d('0x5d')](addAdditionalPhone(_0xd5d699['id'],_0xd5d699[_0x433d('0x8b')][_0x37fc44][_0x433d('0x8f')],_0xd5d699[_0x433d('0x8c')]?_[_0x433d('0x53')](_0xd5d699['item_types'][_0x37fc44])?null:_0xd5d699[_0x433d('0x8c')][_0x37fc44]:_0xd5d699['items'][_0x37fc44]['ItemTypeId']?_0xd5d699['items'][_0x37fc44][_0x433d('0x8d')]:null,_0x2c17c2,_0x76dfe2));}Promise[_0x433d('0x61')](_0x2d89c4)[_0x433d('0x17')](function(){db[_0x433d('0x25')]['update']({'AdditionalPhones':_0x14179e},{'where':{'id':_0xd5d699['id']}})[_0x433d('0x17')](function(){_0x3c6403(0x1);});});});});});}function addAdditionalPhone(_0x3a4d0c,_0xec0fe4,_0x2c0bb3,_0x343f4e,_0x33fc78){return db[_0x433d('0x67')]['find']({'where':{'CmContactId':_0x3a4d0c,'item':_0xec0fe4}})['then'](function(_0x32b367){if(_0x32b367)logger[_0x433d('0x33')](_0x433d('0x90'),_0x32b367);else{db[_0x433d('0x67')][_0x433d('0x3d')]({'CmContactId':_0x3a4d0c,'item':_0xec0fe4,'ItemTypeId':_0x2c0bb3,'OrderBy':_0x343f4e,'ItemClass':_0x433d('0x91'),'description':_0x33fc78});}});}function deleteCmHopperPhones(_0x1adb4b){return new Promise(function(_0xeaa5f8){return db[_0x433d('0x3a')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1adb4b}})[_0x433d('0x17')](function(_0x452540){db[_0x433d('0x92')][_0x433d('0x18')]({'where':{'CmHopperId':{'$in':_[_0x433d('0x6f')](_0x452540,'id')}}});})[_0x433d('0x17')](function(){_0xeaa5f8(0x1);});});}function addCmHopperPhones(_0x54c99d){return new Promise(function(_0x2c63d1){return db[_0x433d('0x3a')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x54c99d}})[_0x433d('0x17')](function(_0x466bc7){var _0x583507=[];_[_0x433d('0x6f')](_0x466bc7,function(_0x5849b6){_0x583507[_0x433d('0x5d')](createCmHopperPhone(_0x54c99d,_0x5849b6['id']));});Promise[_0x433d('0x61')](_0x583507)[_0x433d('0x17')](function(){_0x2c63d1(0x1);});});});}function createCmHopperPhone(_0x11c1e0,_0x23d00d){return new Promise(function(_0x55376e){db['CmContactHasItem'][_0x433d('0x21')]({'raw':!![],'attributes':[_0x433d('0x93'),_0x433d('0x8e')],'where':{'CmContactId':_0x11c1e0,'ItemClass':_0x433d('0x91')},'include':[{'model':db[_0x433d('0x69')],'attributes':[_0x433d('0x8e')],'as':_0x433d('0x6a')}],'order':[_0x433d('0x8e'),db[_0x433d('0x6b')][_0x433d('0x6c')](_0x433d('0x94'))]})['then'](function(_0x396992){var _0x49307a=0x1;var _0x31fed4=_[_0x433d('0x6f')](_0x396992,function(_0x2d26b0){_0x2d26b0[_0x433d('0x95')]=_0x23d00d;_0x2d26b0[_0x433d('0x8f')]=_0x2d26b0[_0x433d('0x93')];_0x2d26b0['OrderBy']=_0x49307a;delete _0x2d26b0['ItemType.OrderBy'];_0x49307a=_0x49307a+0x1;return _0x2d26b0;});return db[_0x433d('0x92')][_0x433d('0x58')](_0x31fed4,{});})[_0x433d('0x17')](function(){_0x55376e(0x1);});});}function insertAdditionalPhones(_0xb40a98,_0x48d971){return new Promise(function(_0x3c3e8e){var _0x23ec83=[];for(var _0x40f424=0x0;_0x40f424<_0x48d971['length'];_0x40f424++){var _0x1459fb=_0x48d971[_0x40f424];_0x23ec83[_0x433d('0x5d')](parseContactItemType(_0x1459fb));}Promise['all'](_0x23ec83)['then'](function(){var _0x2d616f={'id':_0xb40a98['id'],'items':_0x48d971};return addAdditionalPhones(_0x2d616f)[_0x433d('0x17')](function(){return addCmHopperPhones(_0xb40a98['id']);});})[_0x433d('0x17')](function(){_0x3c3e8e(_0xb40a98);});});}function parseContactItemType(_0x3f1766){return new Promise(function(_0x11014b){if(_0x3f1766[_0x433d('0x35')](_0x433d('0x8d'))){_0x11014b(_0x3f1766);}else{return db[_0x433d('0x69')][_0x433d('0x26')]({'where':{'name':_0x3f1766[_0x433d('0x6a')]}})['then'](function(_0x5863ca){if(_[_0x433d('0x53')](_0x5863ca))_0x3f1766[_0x433d('0x8d')]=null;else _0x3f1766[_0x433d('0x8d')]=_0x5863ca['id'];_0x11014b(_0x3f1766);});}});}exports['getAdditionalPhones']=function(_0x2e5366,_0x21b9e0){return db[_0x433d('0x67')]['findAll']({'raw':!![],'where':{'CmContactId':_0x2e5366[_0x433d('0x27')]['id'],'ItemClass':_0x433d('0x91')},'include':[{'model':db[_0x433d('0x69')],'as':_0x433d('0x6a')}],'order':[[_0x433d('0x8e')],[db[_0x433d('0x6b')][_0x433d('0x6c')](_0x433d('0x94'))]]})[_0x433d('0x17')](function(_0x57cc8e){return _0x57cc8e;})[_0x433d('0x17')](respondWithResult(_0x21b9e0,null))[_0x433d('0x24')](handleError(_0x21b9e0,null));};exports[_0x433d('0x96')]=function(_0x3d8c98,_0x31c680){return db[_0x433d('0x67')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3d8c98[_0x433d('0x37')][_0x433d('0x97')]}})[_0x433d('0x17')](function(_0x22144b){var _0x3aff29=_[_0x433d('0x6f')](_0x22144b,function(_0x1466e3){_0x1466e3[_0x433d('0x98')]=_0x3d8c98[_0x433d('0x37')][_0x433d('0x99')];return _0x1466e3;});return db[_0x433d('0x67')][_0x433d('0x58')](_0x3aff29,{});})[_0x433d('0x17')](function(){return addCmHopperPhones(_0x3d8c98[_0x433d('0x37')][_0x433d('0x99')]);})[_0x433d('0x17')](function(){return['ok'];})[_0x433d('0x17')](respondWithResult(_0x31c680,null))['catch'](handleError(_0x31c680,null));};exports[_0x433d('0x9a')]=function(_0x29b4d7,_0x31c935){var _0x964fe8=[];_0x964fe8[_0x433d('0x5d')](createCmHopperPhone(_0x29b4d7[_0x433d('0x37')]['id'],_0x29b4d7[_0x433d('0x37')][_0x433d('0x9b')]));Promise[_0x433d('0x61')](_0x964fe8)[_0x433d('0x17')](function(){return[0x1];})[_0x433d('0x17')](respondWithResult(_0x31c935,null));};exports['getHoppers']=function(_0x3018a1,_0x133dbb){var _0xc865ed={'raw':![],'where':{}};var _0x12a6e8={};var _0x56780f={'count':0x0,'rows':[]};return db[_0x433d('0x25')]['findOne']({'where':{'id':_0x3018a1[_0x433d('0x27')]['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x133dbb,null))['then'](function(_0x1bf652){if(_0x1bf652){_0x12a6e8['model']=_[_0x433d('0x29')](db['CmHopper'][_0x433d('0x7d')]);_0x12a6e8[_0x433d('0x22')]=_[_0x433d('0x29')](_0x3018a1[_0x433d('0x22')]);_0x12a6e8[_0x433d('0x7e')]=_[_0x433d('0x7f')](_0x12a6e8[_0x433d('0x7c')],_0x12a6e8[_0x433d('0x22')]);_0xc865ed['attributes']=_[_0x433d('0x7f')](_0x12a6e8[_0x433d('0x7c')],qs[_0x433d('0x80')](_0x3018a1[_0x433d('0x22')][_0x433d('0x80')]));_0xc865ed[_0x433d('0x81')]=_0xc865ed['attributes']['length']?_0xc865ed[_0x433d('0x81')]:_0x12a6e8['model'];if(!_0x3018a1[_0x433d('0x22')][_0x433d('0x35')](_0x433d('0x87'))){_0xc865ed[_0x433d('0x12')]=qs[_0x433d('0x12')](_0x3018a1[_0x433d('0x22')][_0x433d('0x12')]);_0xc865ed['offset']=qs[_0x433d('0x11')](_0x3018a1['query'][_0x433d('0x11')]);}_0xc865ed['order']=qs[_0x433d('0x83')](_0x3018a1[_0x433d('0x22')][_0x433d('0x83')]);_0xc865ed['where']=qs[_0x433d('0x7e')](_['pick'](_0x3018a1[_0x433d('0x22')],_0x12a6e8[_0x433d('0x7e')]));_0xc865ed[_0x433d('0x5b')][_0x433d('0x9c')]=_0x1bf652['id'];if(_0x3018a1[_0x433d('0x22')][_0x433d('0x85')]){_0xc865ed[_0x433d('0x5b')]=_[_0x433d('0x36')](_0xc865ed[_0x433d('0x5b')],{'$or':_[_0x433d('0x6f')](_0xc865ed[_0x433d('0x81')],function(_0x499015){var _0x281ea9={};_0x281ea9[_0x499015]={'$like':'%'+_0x3018a1[_0x433d('0x22')][_0x433d('0x85')]+'%'};return _0x281ea9;})});}_0xc865ed=_[_0x433d('0x36')]({},_0xc865ed,_0x3018a1[_0x433d('0x86')]);return db[_0x433d('0x3a')][_0x433d('0x13')]({'where':_0xc865ed[_0x433d('0x5b')]})[_0x433d('0x17')](function(_0x4bc18e){_0x56780f['count']=_0x4bc18e;if(_0x3018a1[_0x433d('0x22')][_0x433d('0x9d')]){_0xc865ed[_0x433d('0x9e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xc865ed);})[_0x433d('0x17')](function(_0x11cc0c){_0x56780f[_0x433d('0x9f')]=_0x11cc0c;return _0x56780f;});}})[_0x433d('0x17')](respondWithFilteredResult(_0x133dbb,_0xc865ed))['catch'](handleError(_0x133dbb,null));};exports['getHopperHistories']=function(_0x4d8032,_0x4b8d5d){var _0x42978f={'raw':!![],'where':{}};var _0x4cec17={};var _0x471022={'count':0x0,'rows':[]};return db['CmContact'][_0x433d('0x7b')]({'where':{'id':_0x4d8032[_0x433d('0x27')]['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x4b8d5d,null))['then'](function(_0x18af1b){if(_0x18af1b){_0x4cec17[_0x433d('0x7c')]=_[_0x433d('0x29')](db[_0x433d('0x47')][_0x433d('0x7d')]);_0x4cec17[_0x433d('0x22')]=_[_0x433d('0x29')](_0x4d8032[_0x433d('0x22')]);_0x4cec17['filters']=_[_0x433d('0x7f')](_0x4cec17[_0x433d('0x7c')],_0x4cec17[_0x433d('0x22')]);_0x42978f[_0x433d('0x81')]=_['intersection'](_0x4cec17[_0x433d('0x7c')],qs['fields'](_0x4d8032['query'][_0x433d('0x80')]));_0x42978f[_0x433d('0x81')]=_0x42978f[_0x433d('0x81')][_0x433d('0x2f')]?_0x42978f[_0x433d('0x81')]:_0x4cec17[_0x433d('0x7c')];if(!_0x4d8032[_0x433d('0x22')][_0x433d('0x35')]('nolimit')){_0x42978f['limit']=qs[_0x433d('0x12')](_0x4d8032[_0x433d('0x22')][_0x433d('0x12')]);_0x42978f[_0x433d('0x11')]=qs['offset'](_0x4d8032[_0x433d('0x22')][_0x433d('0x11')]);}_0x42978f[_0x433d('0x82')]=qs['sort'](_0x4d8032[_0x433d('0x22')]['sort']);_0x42978f[_0x433d('0x5b')]=qs[_0x433d('0x7e')](_[_0x433d('0x84')](_0x4d8032[_0x433d('0x22')],_0x4cec17[_0x433d('0x7e')]));_0x42978f[_0x433d('0x5b')][_0x433d('0x9c')]=_0x18af1b['id'];if(_0x4d8032[_0x433d('0x22')][_0x433d('0x85')]){_0x42978f['where']=_['merge'](_0x42978f[_0x433d('0x5b')],{'$or':_[_0x433d('0x6f')](_0x42978f['attributes'],function(_0x457dea){var _0x452a83={};_0x452a83[_0x457dea]={'$like':'%'+_0x4d8032[_0x433d('0x22')][_0x433d('0x85')]+'%'};return _0x452a83;})});}_0x42978f=_[_0x433d('0x36')]({},_0x42978f,_0x4d8032[_0x433d('0x86')]);return db['CmHopperHistory']['count']({'where':_0x42978f[_0x433d('0x5b')]})[_0x433d('0x17')](function(_0x4e3892){_0x471022[_0x433d('0x13')]=_0x4e3892;if(_0x4d8032['query'][_0x433d('0x9d')]){_0x42978f['include']=[{'all':!![]}];}return db[_0x433d('0x47')][_0x433d('0x21')](_0x42978f);})['then'](function(_0x497d52){_0x471022[_0x433d('0x9f')]=_0x497d52;return _0x471022;});}})[_0x433d('0x17')](respondWithFilteredResult(_0x4b8d5d,_0x42978f))[_0x433d('0x24')](handleError(_0x4b8d5d,null));};exports[_0x433d('0xa0')]=function(_0x349d58,_0x271ff0){var _0xf7776f={'raw':!![],'where':{}};var _0x1535ee={};var _0x5f3ed6={'count':0x0,'rows':[]};return db[_0x433d('0x25')][_0x433d('0x7b')]({'where':{'id':_0x349d58['params']['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x271ff0,null))[_0x433d('0x17')](function(_0x2afdb4){if(_0x2afdb4){_0x1535ee[_0x433d('0x7c')]=_[_0x433d('0x29')](db[_0x433d('0xa1')][_0x433d('0x7d')]);_0x1535ee[_0x433d('0x22')]=_[_0x433d('0x29')](_0x349d58['query']);_0x1535ee[_0x433d('0x7e')]=_['intersection'](_0x1535ee[_0x433d('0x7c')],_0x1535ee[_0x433d('0x22')]);_0xf7776f[_0x433d('0x81')]=_['intersection'](_0x1535ee[_0x433d('0x7c')],qs['fields'](_0x349d58[_0x433d('0x22')][_0x433d('0x80')]));_0xf7776f[_0x433d('0x81')]=_0xf7776f['attributes'][_0x433d('0x2f')]?_0xf7776f['attributes']:_0x1535ee[_0x433d('0x7c')];if(!_0x349d58[_0x433d('0x22')][_0x433d('0x35')](_0x433d('0x87'))){_0xf7776f['limit']=qs[_0x433d('0x12')](_0x349d58[_0x433d('0x22')][_0x433d('0x12')]);_0xf7776f[_0x433d('0x11')]=qs[_0x433d('0x11')](_0x349d58[_0x433d('0x22')][_0x433d('0x11')]);}_0xf7776f[_0x433d('0x82')]=qs['sort'](_0x349d58['query']['sort']);_0xf7776f['where']=qs[_0x433d('0x7e')](_[_0x433d('0x84')](_0x349d58[_0x433d('0x22')],_0x1535ee[_0x433d('0x7e')]));_0xf7776f['where'][_0x433d('0x9c')]=_0x2afdb4['id'];if(_0x349d58[_0x433d('0x22')][_0x433d('0x85')]){_0xf7776f['where']=_[_0x433d('0x36')](_0xf7776f[_0x433d('0x5b')],{'$or':_[_0x433d('0x6f')](_0xf7776f[_0x433d('0x81')],function(_0x5b0667){var _0xd19460={};_0xd19460[_0x5b0667]={'$like':'%'+_0x349d58['query']['filter']+'%'};return _0xd19460;})});}_0xf7776f=_[_0x433d('0x36')]({},_0xf7776f,_0x349d58[_0x433d('0x86')]);return db[_0x433d('0xa1')]['count']({'where':_0xf7776f[_0x433d('0x5b')]})[_0x433d('0x17')](function(_0x2f4e3b){_0x5f3ed6[_0x433d('0x13')]=_0x2f4e3b;if(_0x349d58['query'][_0x433d('0x9d')]){_0xf7776f['include']=[{'all':!![]}];}return db[_0x433d('0xa1')]['findAll'](_0xf7776f);})[_0x433d('0x17')](function(_0x357eba){_0x5f3ed6[_0x433d('0x9f')]=_0x357eba;return _0x5f3ed6;});}})['then'](respondWithFilteredResult(_0x271ff0,_0xf7776f))[_0x433d('0x24')](handleError(_0x271ff0,null));};exports['getJscriptySessions']=function(_0x202bd9,_0x51c546){var _0x3ed26e={'raw':!![],'where':{}};var _0x15be8e={};var _0x357423={'count':0x0,'rows':[]};return db['CmContact'][_0x433d('0x7b')]({'where':{'id':_0x202bd9['params']['id']}})[_0x433d('0x17')](handleEntityNotFound(_0x51c546,null))[_0x433d('0x17')](function(_0x178c78){if(_0x178c78){_0x15be8e[_0x433d('0x7c')]=_[_0x433d('0x29')](db[_0x433d('0x4e')]['rawAttributes']);_0x15be8e['query']=_[_0x433d('0x29')](_0x202bd9[_0x433d('0x22')]);_0x15be8e[_0x433d('0x7e')]=_[_0x433d('0x7f')](_0x15be8e[_0x433d('0x7c')],_0x15be8e[_0x433d('0x22')]);_0x3ed26e['attributes']=_[_0x433d('0x7f')](_0x15be8e['model'],qs['fields'](_0x202bd9[_0x433d('0x22')]['fields']));_0x3ed26e[_0x433d('0x81')]=_0x3ed26e[_0x433d('0x81')][_0x433d('0x2f')]?_0x3ed26e[_0x433d('0x81')]:_0x15be8e[_0x433d('0x7c')];if(!_0x202bd9[_0x433d('0x22')][_0x433d('0x35')](_0x433d('0x87'))){_0x3ed26e[_0x433d('0x12')]=qs[_0x433d('0x12')](_0x202bd9['query'][_0x433d('0x12')]);_0x3ed26e[_0x433d('0x11')]=qs[_0x433d('0x11')](_0x202bd9[_0x433d('0x22')][_0x433d('0x11')]);}_0x3ed26e['order']=qs['sort'](_0x202bd9[_0x433d('0x22')][_0x433d('0x83')]);_0x3ed26e[_0x433d('0x5b')]=qs[_0x433d('0x7e')](_['pick'](_0x202bd9[_0x433d('0x22')],_0x15be8e[_0x433d('0x7e')]));_0x3ed26e['where'][_0x433d('0x9c')]=_0x178c78['id'];if(_0x202bd9['query'][_0x433d('0x85')]){_0x3ed26e[_0x433d('0x5b')]=_[_0x433d('0x36')](_0x3ed26e[_0x433d('0x5b')],{'$or':_['map'](_0x3ed26e['attributes'],function(_0x172ef3){var _0x5095c2={};_0x5095c2[_0x172ef3]={'$like':'%'+_0x202bd9[_0x433d('0x22')][_0x433d('0x85')]+'%'};return _0x5095c2;})});}_0x3ed26e=_[_0x433d('0x36')]({},_0x3ed26e,_0x202bd9['options']);return db[_0x433d('0x4e')][_0x433d('0x13')]({'where':_0x3ed26e['where']})[_0x433d('0x17')](function(_0x55d3a1){_0x357423[_0x433d('0x13')]=_0x55d3a1;if(_0x202bd9[_0x433d('0x22')][_0x433d('0x9d')]){_0x3ed26e['include']=[{'all':!![]}];}return db[_0x433d('0x4e')][_0x433d('0x21')](_0x3ed26e);})[_0x433d('0x17')](function(_0x561748){_0x357423[_0x433d('0x9f')]=_0x561748;return _0x357423;});}})[_0x433d('0x17')](respondWithFilteredResult(_0x51c546,_0x3ed26e))[_0x433d('0x24')](handleError(_0x51c546,null));};exports[_0x433d('0xa2')]=function(_0x425d49,_0x4f8325){try{if(!_0x425d49[_0x433d('0x37')][_0x433d('0x5e')]){throw new Error(_0x433d('0xa3'));}if(!_0x425d49[_0x433d('0x37')][_0x433d('0xa4')]){throw new Error(_0x433d('0xa5'));}if(!_0x425d49[_0x433d('0x37')][_0x433d('0xa6')]){throw new Error(_0x433d('0xa7'));}if(!_0x425d49['body']['socket_timestamp']){throw new Error(_0x433d('0xa8'));}var _0x41516f=_0x425d49['body'][_0x433d('0xa4')][_0x433d('0xa9')](',');var _0x327fe2=_0x425d49[_0x433d('0x37')][_0x433d('0xa6')][_0x433d('0xa9')](',');if(!_0x41516f[_0x433d('0x2f')]||!_0x327fe2[_0x433d('0x2f')]||_0x41516f[_0x433d('0x2f')]!==_0x327fe2[_0x433d('0x2f')]){throw new Error(_0x433d('0xaa'));}_0x425d49['body']['fields']=_[_0x433d('0xab')](_0x41516f,_0x327fe2);if(!_0x425d49['body']['fields'][_0x433d('0x8f')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x425d49['body'][_0x433d('0x80')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0xf40341=path[_0x433d('0x52')](config[_0x433d('0xac')],'server/files/tmp',_0x425d49[_0x433d('0xad')]['filename']);fs[_0x433d('0xae')](_0xf40341,parseInt('0777',0x8));var _0x2d527=require('child_process')[_0x433d('0xaf')](path[_0x433d('0x52')](__dirname,_0x433d('0xb0')),[_0xf40341,_0x425d49[_0x433d('0x37')]['binding_keys'],_0x425d49['body'][_0x433d('0xa6')],_0x425d49[_0x433d('0x37')][_0x433d('0x5e')],_0x425d49[_0x433d('0x37')][_0x433d('0xb1')],_0x425d49[_0x433d('0x37')][_0x433d('0x5a')],_0x425d49[_0x433d('0x37')]['socket_timestamp']]);return _0x4f8325[_0x433d('0x10')](0xc8)[_0x433d('0x15')]({'message':_0x433d('0xb2'),'pid':_0x2d527[_0x433d('0xb3')]});}catch(_0x53e9df){return _0x4f8325[_0x433d('0x10')](0x1f4)[_0x433d('0x1d')](_0x53e9df);}};exports[_0x433d('0xb4')]=function(_0x5d4cc5,_0x34e3ea){var _0x58e5c9=fs[_0x433d('0xb5')](_0x5d4cc5[_0x433d('0xad')]['path']);Papa['parse'](_0x58e5c9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2f4925){return _0x34e3ea[_0x433d('0x10')](0xc8)['json']({'file':_0x5d4cc5['file'],'fields':_0x2f4925['meta'][_0x433d('0x80')]});}});};exports[_0x433d('0xb6')]=function(_0x5051d8,_0x1f682d){return db['User'][_0x433d('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x433d('0xb7')}})[_0x433d('0x17')](function(_0x46c406){var _0x5a4c72=![];if(!_0x5051d8[_0x433d('0x37')][_0x433d('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5051d8[_0x433d('0x37')][_0x433d('0xb8')][_0x433d('0x8f')]){throw new Error(_0x433d('0xb9'));}if(!_0x5051d8['body'][_0x433d('0xb8')][_0x433d('0xba')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5051d8[_0x433d('0x37')][_0x433d('0xbb')]){throw new Error(_0x433d('0xa8'));}var _0x50de92=require(_0x433d('0xbc'))[_0x433d('0xaf')](path[_0x433d('0x52')](__dirname,_0x433d('0xbd')),[_0x5051d8[_0x433d('0x27')]['id'],JSON[_0x433d('0xbe')](_0x5051d8[_0x433d('0x37')]),JSON[_0x433d('0xbe')](_0x46c406)]);_0x50de92['on'](_0x433d('0xbf'),function(){_0x5a4c72=!![];return _0x1f682d[_0x433d('0x10')](0xc8)['json']({'message':_0x433d('0xc0'),'pid':_0x50de92[_0x433d('0xb3')]});});_0x50de92['on']('exit',function(_0x45c3af){if(_0x45c3af&&!_0x5a4c72){return _0x1f682d[_0x433d('0x10')](0x1f4)[_0x433d('0x15')]({'message':_0x433d('0xc1'),'pid':_0x50de92[_0x433d('0xb3')]});}});})[_0x433d('0x24')](handleError(_0x1f682d,null));};exports['importUpdates']=function(_0x9f1c15,_0x2ad035){return db['User'][_0x433d('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x433d('0xb7')}})[_0x433d('0x17')](function(_0x4af308){var _0x23b598=![];if(!_0x9f1c15[_0x433d('0x37')][_0x433d('0x5e')]){throw new Error(_0x433d('0xa3'));}if(!_0x9f1c15[_0x433d('0x37')]['binding'][_0x433d('0x8f')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x9f1c15[_0x433d('0x37')][_0x433d('0xb8')][_0x433d('0xba')]){throw new Error(_0x433d('0xc2'));}if(!_0x9f1c15[_0x433d('0x37')][_0x433d('0xbb')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2288dc=require(_0x433d('0xbc'))[_0x433d('0xaf')](path[_0x433d('0x52')](__dirname,'../../components/import/cm/csvUpdates'),[_0x9f1c15['params']['id'],JSON[_0x433d('0xbe')](_0x9f1c15['body']),JSON[_0x433d('0xbe')](_0x4af308)]);_0x2288dc['on']('message',function(){_0x23b598=!![];return _0x2ad035[_0x433d('0x10')](0xc8)[_0x433d('0x15')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x2288dc['pid']});});_0x2288dc['on']('exit',function(_0x148c76){if(_0x148c76&&!_0x23b598){return _0x2ad035[_0x433d('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x2288dc[_0x433d('0xb3')]});}});})[_0x433d('0x24')](handleError(_0x2ad035,null));};exports[_0x433d('0xc3')]=function(_0x5d9da8,_0x1c4c40){var _0x2b48a6=[_0x433d('0xc4'),_0x433d('0xc5'),_0x433d('0xc6'),_0x433d('0xc7'),_0x433d('0xc8'),_0x433d('0xc9'),'voice'];var _0x2eb762={'offset':0x0,'order':qs[_0x433d('0x83')](_0x433d('0xca'))},_0x23b67d={'count':0x0,'rows':[]};Promise[_0x433d('0xcb')]()[_0x433d('0x17')](function(){if(_0x5d9da8[_0x433d('0x22')][_0x433d('0xcc')]){if(!_[_0x433d('0xcd')](_0x2b48a6,_0x5d9da8[_0x433d('0x22')][_0x433d('0xcc')][_0x433d('0xce')]())){throw new Error(_0x433d('0xcf'));}_0x2b48a6=[_0x5d9da8[_0x433d('0x22')][_0x433d('0xcc')]['toLowerCase']()];}if(_0x5d9da8[_0x433d('0x22')]['range']){try{var _0x1a9d08=JSON[_0x433d('0xd0')](_0x5d9da8[_0x433d('0x22')][_0x433d('0xd1')]);if(!moment(_0x1a9d08[_0x433d('0x3b')])[_0x433d('0xd2')]()){throw new Error(_0x433d('0xd3'));}if(!moment(_0x1a9d08['to'])[_0x433d('0xd2')]()){throw new Error(_0x433d('0xd4'));}}catch(_0x2cb1e7){throw new Error(_0x433d('0xd5'));}}if(!_0x5d9da8['query'][_0x433d('0x35')](_0x433d('0x87'))){_0x2eb762[_0x433d('0x12')]=qs[_0x433d('0x12')](_0x5d9da8['query']['limit']||0xa);_0x2eb762[_0x433d('0x11')]=qs[_0x433d('0x11')](_0x5d9da8[_0x433d('0x22')][_0x433d('0x11')]);}var _0x3b7e94=_0x2b48a6['map'](function(_0x509c8e){if(_0x509c8e===_0x433d('0xd6')){var _0x1c2323={'attributes':['id',_0x433d('0xd7'),'type',_0x433d('0xd8'),_0x433d('0xd9'),'callerid',_0x433d('0xda'),_0x433d('0xdb'),_0x433d('0xdc'),_0x433d('0xdd'),_0x433d('0xde'),_0x433d('0xdf'),'userSecondDisposition','userThirdDisposition',_0x433d('0xe0')],'where':{'ContactId':_0x5d9da8[_0x433d('0x27')]['id']},'include':[{'model':db[_0x433d('0xe1')],'as':_0x433d('0xe1'),'attributes':['id','name','fullname',_0x433d('0xe2')]}],'order':[['createdAt',_0x433d('0xe3')]]};if(_0x5d9da8['query'][_0x433d('0xd1')]){_0x1c2323['where'][_0x433d('0xde')]={'$gte':_0x1a9d08[_0x433d('0x3b')],'$lte':_0x1a9d08['to']};}return db[_0x433d('0x49')][_0x433d('0xe4')](_0x1c2323)['then'](function(_0x20fd5a){_0x23b67d[_0x433d('0x13')]+=_0x20fd5a[_0x433d('0x13')];return _['map'](_0x20fd5a[_0x433d('0x9f')],function(_0x4fcb1b){var _0x591d4c=_0x4fcb1b[_0x433d('0x38')]({'plain':!![]});_0x591d4c[_0x433d('0xcc')]=_0x509c8e;if(_0x591d4c[_0x433d('0xe1')]){_0x591d4c['User']={'id':_0x591d4c[_0x433d('0xe1')]['id'],'name':_0x591d4c[_0x433d('0xe1')][_0x433d('0x1c')],'fullname':_0x591d4c[_0x433d('0xe1')][_0x433d('0xe5')],'alias':_0x591d4c[_0x433d('0xe1')]['alias']};}return _0x591d4c;});});}else{var _0x280f1f=_['startCase'](_0x509c8e)+(_0x509c8e==='chat'?'Website':_0x433d('0xe6'));var _0x497bb6={'attributes':['id','closed',_0x433d('0xe7'),'createdAt','note',_0x433d('0xe8'),_0x433d('0xe9'),'thirdDisposition',_0x433d('0xe0'),_0x280f1f+'Id'],'where':{'ContactId':_0x5d9da8[_0x433d('0x27')]['id']},'include':[{'model':db[_0x280f1f],'as':_0x433d('0xe6'),'attributes':['id',_0x433d('0x1c'),_0x433d('0xea')]},{'model':db[_0x433d('0xe1')],'as':'Owner','attributes':['id',_0x433d('0x1c'),_0x433d('0xe5')]},{'model':db[_0x433d('0x63')],'as':_0x433d('0x64'),'attributes':['id',_0x433d('0x1c'),_0x433d('0x65')],'through':{'attributes':[]}}],'order':[[_0x433d('0xde'),_0x433d('0xe3')]]};if(_0x5d9da8[_0x433d('0x22')][_0x433d('0xd1')]){_0x497bb6[_0x433d('0x5b')]['createdAt']={'$gte':_0x1a9d08[_0x433d('0x3b')],'$lte':_0x1a9d08['to']};}switch(_0x509c8e){case _0x433d('0xc5'):_0x497bb6[_0x433d('0x81')]['push'](_0x433d('0xeb'),_0x433d('0xec'),'customerPort',_0x433d('0xed'),_0x433d('0xee'),_0x433d('0xef'),'ratingType',_0x433d('0xf0'),_0x433d('0xf1'));break;case'mail':_0x497bb6[_0x433d('0x81')][_0x433d('0x5d')](_0x433d('0xf2'),'substatus');break;case'openchannel':_0x497bb6[_0x433d('0x81')][_0x433d('0x5d')]('externalUrl',_0x433d('0xf3'));break;}return db[_[_0x433d('0xf4')](_0x509c8e)+_0x433d('0xf5')][_0x433d('0xe4')](_0x497bb6)[_0x433d('0x17')](function(_0x51aa86){_0x23b67d[_0x433d('0x13')]+=_0x51aa86[_0x433d('0x13')];return _[_0x433d('0x6f')](_0x51aa86[_0x433d('0x9f')],function(_0x229c12){var _0x4ec3bb=_0x229c12[_0x433d('0x38')]({'plain':!![]});_0x4ec3bb[_0x433d('0xcc')]=_0x509c8e;if(_0x4ec3bb['Owner']){_0x4ec3bb[_0x433d('0xf6')]={'id':_0x4ec3bb[_0x433d('0xf6')]['id'],'name':_0x4ec3bb['Owner'][_0x433d('0x1c')],'fullname':_0x4ec3bb[_0x433d('0xf6')][_0x433d('0xe5')]};}return _0x4ec3bb;});});}});return Promise[_0x433d('0x61')](_0x3b7e94);})['then'](function(_0x50230d){return _(_0x50230d)[_0x433d('0xf7')]()[_0x433d('0xf8')](_0x433d('0xde'))['reverse']()['value']();})['then'](function(_0xf77ef5){_0x23b67d[_0x433d('0x9f')]=_0x2eb762[_0x433d('0x12')]?_0xf77ef5[_0x433d('0xf9')](_0x2eb762[_0x433d('0x11')],_0x2eb762[_0x433d('0x11')]+_0x2eb762[_0x433d('0x12')]):_0xf77ef5;return _0x23b67d;})[_0x433d('0x17')](respondWithFilteredResult(_0x1c4c40,_0x2eb762))[_0x433d('0x24')](handleError(_0x1c4c40,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 97e7591..7cff37e 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 _0x4a6e=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update','remove'];(function(_0x2ef9fb,_0x49cc4e){var _0x453567=function(_0x25eea6){while(--_0x25eea6){_0x2ef9fb['push'](_0x2ef9fb['shift']());}};_0x453567(++_0x49cc4e);}(_0x4a6e,0x123));var _0xe4a6=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x4a6e[_0x2f87cd];return _0x5d7eda;};'use strict';var EventEmitter=require(_0xe4a6('0x0'));var CmContact=require(_0xe4a6('0x1'))['db'][_0xe4a6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4a6('0x3'),'afterUpdate':_0xe4a6('0x4'),'afterDestroy':_0xe4a6('0x5')};function emitEvent(_0x9cdade){return function(_0x446ddb,_0x150c96,_0x1664b7){CmContactEvents['emit'](_0x9cdade+':'+_0x446ddb['id'],_0x446ddb);CmContactEvents['emit'](_0x9cdade,_0x446ddb);_0x1664b7(null);};}for(var e in events){if(events[_0xe4a6('0x6')](e)){var event=events[e];CmContact[_0xe4a6('0x7')](e,emitEvent(event));}}module[_0xe4a6('0x8')]=CmContactEvents; \ No newline at end of file +var _0x30b0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30b0,0x177));var _0x030b=function(_0x1acc41,_0x3fd32c){_0x1acc41=_0x1acc41-0x0;var _0x1434f9=_0x30b0[_0x1acc41];return _0x1434f9;};'use strict';var EventEmitter=require(_0x030b('0x0'));var CmContact=require(_0x030b('0x1'))['db'][_0x030b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x030b('0x3'),'afterUpdate':_0x030b('0x4'),'afterDestroy':_0x030b('0x5')};function emitEvent(_0x5ede10){return function(_0x177cfc,_0x5561c9,_0x149992){CmContactEvents[_0x030b('0x6')](_0x5ede10+':'+_0x177cfc['id'],_0x177cfc);CmContactEvents['emit'](_0x5ede10,_0x177cfc);_0x149992(null);};}for(var e in events){if(events[_0x030b('0x7')](e)){var event=events[e];CmContact[_0x030b('0x8')](e,emitEvent(event));}}module[_0x030b('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 065d878..8ffbc58 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 _0xccd9=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContact.attributes','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','utcOffset','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','dialTimezone','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','findAll','CmList','BlackLists','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','CampaignId','push','all','info'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xccd9,0x118));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ccd('0x0'));var util=require(_0x9ccd('0x1'));var logger=require(_0x9ccd('0x2'))(_0x9ccd('0x3'));var moment=require('moment');var BPromise=require(_0x9ccd('0x4'));var rp=require(_0x9ccd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ccd('0x6'));var config=require(_0x9ccd('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x9ccd('0x8'));module['exports']=function(_0x570de5,_0x45eb7e){return _0x570de5[_0x9ccd('0x9')]('CmContact',attributes,{'tableName':_0x9ccd('0xa'),'paranoid':!![],'indexes':[{'name':_0x9ccd('0xb'),'fields':[_0x9ccd('0xb')]},{'name':_0x9ccd('0xc'),'fields':[_0x9ccd('0xd'),_0x9ccd('0xe'),_0x9ccd('0xb'),'mobile',_0x9ccd('0xf'),_0x9ccd('0x10')],'type':_0x9ccd('0x11')}],'timestamps':!![],'charset':_0x9ccd('0x12'),'collate':_0x9ccd('0x13'),'hooks':{'afterCreate':function(_0x346abb,_0xf3c730,_0x52090f){var _0x389c48=_0x570de5[_0x9ccd('0x14')];var _0xd5e070=_0x346abb[_0x9ccd('0x15')]({'plain':!![]});function _0x3f1a8d(){return function(_0x54611a){logger[_0x9ccd('0x16')]('cmContact',_0x9ccd('0x17'),util[_0x9ccd('0x18')](_0x54611a,{'showHidden':![],'depth':null}));};}function _0x117858(_0x327841,_0x413396){var _0x4a2f36=_0x413396[_0x9ccd('0x19')]?_0x413396[_0x9ccd('0x19')]:moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b'));return new BPromise(function(_0x55fbd,_0x54e2ac){if(_[_0x9ccd('0x1c')](_0x413396['dialTimezone'])){_0x55fbd({'ret':_0x4a2f36});}else{_0x389c48[_0x9ccd('0x1d')][_0x9ccd('0x1e')]({'where':{'id':_0x327841['id']}})[_0x9ccd('0x1f')](function(_0x2fd857){if(!_[_0x9ccd('0x1c')](_0x2fd857)){var _0x44a496=_0x2fd857['dialTimezone'];if(!_[_0x9ccd('0x1c')](_0x44a496)){var _0x5661d9=shared['timezones'];var _0x1fa1b0=_0x5661d9[_0x44a496];var _0x25ead3=_0x5661d9[_0x413396['dialTimezone']];if(!_[_0x9ccd('0x1c')](_0x1fa1b0)&&!_['isNil'](_0x25ead3)){var _0x422c06=_0x1fa1b0['utcOffset']-_0x25ead3[_0x9ccd('0x20')];_0x4a2f36=_0x413396[_0x9ccd('0x19')]?_0x413396[_0x9ccd('0x19')]:moment();var _0x113d89=moment(_0x4a2f36)['add'](_0x422c06,'minutes');_0x55fbd({'ret':_0x113d89[_0x9ccd('0x1a')](_0x9ccd('0x1b'))});}else _0x55fbd({'ret':_0x4a2f36});}else _0x55fbd({'ret':_0x4a2f36});}else{_0x55fbd({'ret':_0x4a2f36});}});}});return 0xa;}var _0x4ee577=function(_0x12ef53){return new BPromise(function(_0x1c6a8b,_0x1a4a7e){_0x117858(_0x12ef53,_0xd5e070)[_0x9ccd('0x1f')](function(_0x13e1dd){_0xd5e070['scheduledat']=_0x13e1dd[_0x9ccd('0x21')];_0x389c48[_0x9ccd('0x22')]['findOne']({'where':{'phone':_0xd5e070[_0x9ccd('0xb')],'VoiceQueueId':_0x12ef53['id']}})[_0x9ccd('0x1f')](function(_0x1758c3){if(!_[_0x9ccd('0x1c')](_0x1758c3)){throw new Error(_0x9ccd('0x23')+_0xd5e070['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x12ef53['id']);}return _0x389c48[_0x9ccd('0x22')][_0x9ccd('0x24')]({'phone':_0xd5e070['phone'],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070[_0x9ccd('0x25')],'priority':_0xd5e070['priority']?_0xd5e070[_0x9ccd('0x26')]:0x2,'scheduledat':_0xd5e070['scheduledat']?_0xd5e070[_0x9ccd('0x19')]:moment()['format'](_0x9ccd('0x1b')),'callback':_0xd5e070['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xd5e070[_0x9ccd('0x27')]?_0xd5e070[_0x9ccd('0x27')]:undefined,'callbackat':_0xd5e070['callbackUniqueid']?moment()['format'](_0x9ccd('0x1b')):undefined,'VoiceQueueId':_0x12ef53['id']});})[_0x9ccd('0x28')](function(_0x2b4af1){_0x1a4a7e(_0x2b4af1);});});});};var _0x180f67=function(_0x1a1e34){return new BPromise(function(_0x50b1e8,_0x3d1120){_0x117858(_0x1a1e34,_0xd5e070)['then'](function(_0x68c47e){_0xd5e070[_0x9ccd('0x19')]=_0x68c47e['ret'];_0x389c48[_0x9ccd('0x22')][_0x9ccd('0x1e')]({'where':{'phone':_0xd5e070[_0x9ccd('0xb')],'VoiceQueueId':_0x1a1e34['id']}})[_0x9ccd('0x1f')](function(_0x17ed9a){if(!_['isNil'](_0x17ed9a)){throw new Error(_0x9ccd('0x23')+_0xd5e070[_0x9ccd('0xb')]+_0x9ccd('0x29')+_0x1a1e34['id']);}return _0x389c48[_0x9ccd('0x2a')][_0x9ccd('0x1e')]({'where':{'calleridnum':_0xd5e070[_0x9ccd('0xb')],'VoiceQueueId':_0x1a1e34['id']}});})[_0x9ccd('0x1f')](function(_0x11592a){if(!_[_0x9ccd('0x1c')](_0x11592a)){throw new Error(_0x9ccd('0x2b')+_0xd5e070[_0x9ccd('0xb')]+_0x9ccd('0x2c')+_0x1a1e34['id']);}return _0x389c48[_0x9ccd('0x22')]['create']({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070['ListId'],'priority':_0xd5e070[_0x9ccd('0x26')]?_0xd5e070['priority']:0x2,'scheduledat':_0xd5e070[_0x9ccd('0x19')]?_0xd5e070[_0x9ccd('0x19')]:moment()[_0x9ccd('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xd5e070['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xd5e070[_0x9ccd('0x27')]?_0xd5e070[_0x9ccd('0x27')]:undefined,'callbackat':_0xd5e070[_0x9ccd('0x27')]?moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')):undefined,'VoiceQueueId':_0x1a1e34['id']});})['catch'](function(_0x575ca2){_0x3d1120(_0x575ca2);});});});};function _0x5357ca(){return function(_0x1600dc){logger['error']('cmContact',_0x9ccd('0x17'),util['inspect'](_0x1600dc,{'showHidden':![],'depth':null}));};}function _0x3acda0(_0x17fc14,_0x300ebe){var _0xb2f191=_0x300ebe[_0x9ccd('0x19')]?_0x300ebe['scheduledat']:moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b'));return new BPromise(function(_0x1a8211,_0xf2b823){if(_['isNil'](_0x300ebe[_0x9ccd('0x2d')])){_0x1a8211({'ret':_0xb2f191});}else{_0x389c48[_0x9ccd('0x2e')]['findOne']({'where':{'id':_0x17fc14['id']}})[_0x9ccd('0x1f')](function(_0x28ad5a){if(!_[_0x9ccd('0x1c')](_0x28ad5a)){var _0x54721e=_0x28ad5a['dialTimezone'];if(!_[_0x9ccd('0x1c')](_0x54721e)){var _0x31c00f=shared[_0x9ccd('0x2f')];var _0x41bacd=_0x31c00f[_0x54721e];var _0x11c08b=_0x31c00f[_0x300ebe[_0x9ccd('0x2d')]];if(!_[_0x9ccd('0x1c')](_0x41bacd)&&!_[_0x9ccd('0x1c')](_0x11c08b)){var _0x595b42=_0x41bacd[_0x9ccd('0x20')]-_0x11c08b['utcOffset'];_0xb2f191=_0x300ebe[_0x9ccd('0x19')]?_0x300ebe['scheduledat']:moment();var _0x50cb85=moment(_0xb2f191)['add'](_0x595b42,'minutes');_0x1a8211({'ret':_0x50cb85[_0x9ccd('0x1a')](_0x9ccd('0x1b'))});}else _0x1a8211({'ret':_0xb2f191});}else _0x1a8211({'ret':_0xb2f191});}else{_0x1a8211({'ret':_0xb2f191});}});}});return 0xa;}var _0x50ff05=function(_0x227a35){return new BPromise(function(_0x28c3ed,_0x1ca09c){_0x3acda0(_0x227a35,_0xd5e070)[_0x9ccd('0x1f')](function(_0x2edab8){_0xd5e070['scheduledat']=_0x2edab8[_0x9ccd('0x21')];_0x389c48[_0x9ccd('0x22')][_0x9ccd('0x1e')]({'where':{'phone':_0xd5e070[_0x9ccd('0xb')],'CampaignId':_0x227a35['id']}})['then'](function(_0x376d99){if(!_[_0x9ccd('0x1c')](_0x376d99)){throw new Error(_0x9ccd('0x23')+_0xd5e070[_0x9ccd('0xb')]+_0x9ccd('0x30')+_0x227a35['id']);}return _0x389c48['CmHopper']['create']({'phone':_0xd5e070['phone'],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070[_0x9ccd('0x25')],'priority':_0xd5e070[_0x9ccd('0x26')]?_0xd5e070[_0x9ccd('0x26')]:0x2,'scheduledat':_0xd5e070[_0x9ccd('0x19')]?_0xd5e070[_0x9ccd('0x19')]:moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')),'callback':_0xd5e070[_0x9ccd('0x27')]?!![]:![],'callbackuniqueid':_0xd5e070['callbackUniqueid']?_0xd5e070[_0x9ccd('0x27')]:undefined,'callbackat':_0xd5e070['callbackUniqueid']?moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')):undefined,'CampaignId':_0x227a35['id']});})[_0x9ccd('0x28')](function(_0x2b94ce){_0x1ca09c(_0x2b94ce);});});});};var _0x41695a=function(_0x349b8f){return new BPromise(function(_0x9adbf3,_0x30593c){_0x3acda0(_0x349b8f,_0xd5e070)['then'](function(_0x4aa019){_0xd5e070[_0x9ccd('0x19')]=_0x4aa019[_0x9ccd('0x21')];_0x389c48[_0x9ccd('0x22')]['findOne']({'where':{'phone':_0xd5e070[_0x9ccd('0xb')],'CampaignId':_0x349b8f['id']}})['then'](function(_0x561fd4){if(!_[_0x9ccd('0x1c')](_0x561fd4)){throw new Error(_0x9ccd('0x23')+_0xd5e070[_0x9ccd('0xb')]+_0x9ccd('0x31')+_0x349b8f['id']);}return _0x389c48[_0x9ccd('0x2a')][_0x9ccd('0x1e')]({'where':{'calleridnum':_0xd5e070['phone'],'CampaignId':_0x349b8f['id']}});})[_0x9ccd('0x1f')](function(_0x3ced84){if(!_[_0x9ccd('0x1c')](_0x3ced84)){throw new Error(_0x9ccd('0x2b')+_0xd5e070[_0x9ccd('0xb')]+_0x9ccd('0x32')+_0x349b8f['id']);}return _0x389c48[_0x9ccd('0x22')][_0x9ccd('0x24')]({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070['ListId'],'priority':_0xd5e070[_0x9ccd('0x26')]?_0xd5e070['priority']:0x2,'scheduledat':_0xd5e070[_0x9ccd('0x19')]?_0xd5e070[_0x9ccd('0x19')]:moment()['format'](_0x9ccd('0x1b')),'callback':_0xd5e070[_0x9ccd('0x27')]?!![]:![],'callbackuniqueid':_0xd5e070['callbackUniqueid']?_0xd5e070[_0x9ccd('0x27')]:undefined,'callbackat':_0xd5e070[_0x9ccd('0x27')]?moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')):undefined,'CampaignId':_0x349b8f['id']});})['catch'](function(_0x5316a5){_0x30593c(_0x5316a5);});});});};if(_0xd5e070['ListId']){_0x389c48[_0x9ccd('0x1d')]['findAll']({'where':{'type':_0x9ccd('0x33')},'attributes':['id','dialCheckDuplicateType',_0x9ccd('0x2d')],'include':[{'model':_0x389c48['CmList'],'as':_0x9ccd('0x34'),'where':{'id':_0xd5e070[_0x9ccd('0x25')]}}]})['then'](function(_0x4f529e){if(_0x4f529e){var _0x108851=[];for(var _0x2423c2=0x0,_0x45adf3;_0x2423c2<_0x4f529e[_0x9ccd('0x35')];_0x2423c2+=0x1){_0x45adf3=_0x4f529e[_0x2423c2][_0x9ccd('0x15')]({'plain':!![]});switch(_0x45adf3[_0x9ccd('0x36')]){case _0x9ccd('0x37'):_0x180f67(_0x45adf3)[_0x9ccd('0x28')](_0x3f1a8d());break;case _0x9ccd('0x38'):_0x4ee577(_0x45adf3)[_0x9ccd('0x28')](_0x3f1a8d());break;default:_0x3acda0(_0x45adf3,_0xd5e070)[_0x9ccd('0x1f')](function(_0xc3a81b){_0xd5e070[_0x9ccd('0x19')]=_0xc3a81b[_0x9ccd('0x21')];_0x389c48[_0x9ccd('0x22')]['create']({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070['ListId'],'scheduledat':_0xd5e070[_0x9ccd('0x19')]?_0xd5e070[_0x9ccd('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xd5e070[_0x9ccd('0x26')]?_0xd5e070[_0x9ccd('0x26')]:0x2,'callback':_0xd5e070[_0x9ccd('0x27')]?!![]:![],'callbackuniqueid':_0xd5e070[_0x9ccd('0x27')]?_0xd5e070['callbackUniqueid']:undefined,'callbackat':_0xd5e070[_0x9ccd('0x27')]?moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')):undefined,'VoiceQueueId':_0x45adf3['id']})[_0x9ccd('0x28')](_0x3f1a8d());});}}}})['then'](function(){return _0x389c48[_0x9ccd('0x1d')][_0x9ccd('0x39')]({'where':{'type':_0x9ccd('0x33')},'attributes':['id'],'include':[{'model':_0x389c48[_0x9ccd('0x3a')],'as':_0x9ccd('0x3b'),'where':{'id':_0xd5e070[_0x9ccd('0x25')]}}]})[_0x9ccd('0x1f')](function(_0x1f07a5){if(_0x1f07a5){var _0x37eb9f=[];for(var _0xd645f6=0x0,_0x1e5d6c;_0xd645f6<_0x1f07a5[_0x9ccd('0x35')];_0xd645f6+=0x1){_0x1e5d6c=_0x1f07a5[_0xd645f6][_0x9ccd('0x15')]({'plain':!![]});_0x389c48[_0x9ccd('0x3c')][_0x9ccd('0x24')]({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070[_0x9ccd('0x25')],'VoiceQueueId':_0x1e5d6c['id']})[_0x9ccd('0x28')](function(_0x43e000){logger[_0x9ccd('0x16')]('cmContact,\x20%s,\x20%s',_0x9ccd('0x17'),_0x43e000[_0x9ccd('0x3d')]);});}}});})[_0x9ccd('0x1f')](function(){return _0x389c48[_0x9ccd('0x2e')][_0x9ccd('0x39')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x389c48[_0x9ccd('0x3a')],'as':_0x9ccd('0x34'),'where':{'id':_0xd5e070[_0x9ccd('0x25')]}}]})[_0x9ccd('0x1f')](function(_0x2e342d){if(_0x2e342d){var _0xd077ad=[];for(var _0x26125e=0x0,_0x3911f8;_0x26125e<_0x2e342d[_0x9ccd('0x35')];_0x26125e+=0x1){_0x3911f8=_0x2e342d[_0x26125e]['get']({'plain':!![]});switch(_0x3911f8[_0x9ccd('0x36')]){case _0x9ccd('0x37'):_0x41695a(_0x3911f8)[_0x9ccd('0x28')](_0x5357ca());break;case _0x9ccd('0x38'):_0x50ff05(_0x3911f8)[_0x9ccd('0x28')](_0x5357ca());break;default:_0x389c48['CmHopper'][_0x9ccd('0x24')]({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070[_0x9ccd('0x25')],'scheduledat':_0xd5e070[_0x9ccd('0x19')]?_0xd5e070['scheduledat']:moment()[_0x9ccd('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xd5e070['priority']?_0xd5e070[_0x9ccd('0x26')]:0x2,'callback':_0xd5e070[_0x9ccd('0x27')]?!![]:![],'callbackuniqueid':_0xd5e070[_0x9ccd('0x27')]?_0xd5e070[_0x9ccd('0x27')]:undefined,'callbackat':_0xd5e070['callbackUniqueid']?moment()[_0x9ccd('0x1a')](_0x9ccd('0x1b')):undefined,'CampaignId':_0x3911f8['id']})[_0x9ccd('0x28')](_0x5357ca());}}}});})[_0x9ccd('0x1f')](function(){return _0x389c48['Campaign'][_0x9ccd('0x39')]({'attributes':['id'],'include':[{'model':_0x389c48[_0x9ccd('0x3a')],'as':'BlackLists','where':{'id':_0xd5e070[_0x9ccd('0x25')]}}]})['then'](function(_0x3cf06e){if(_0x3cf06e){var _0x36f066=[];for(var _0x2bedd6=0x0,_0xd69de6;_0x2bedd6<_0x3cf06e[_0x9ccd('0x35')];_0x2bedd6+=0x1){_0xd69de6=_0x3cf06e[_0x2bedd6][_0x9ccd('0x15')]({'plain':!![]});_0x389c48[_0x9ccd('0x3c')][_0x9ccd('0x24')]({'phone':_0xd5e070[_0x9ccd('0xb')],'ContactId':_0xd5e070['id'],'ListId':_0xd5e070[_0x9ccd('0x25')],'CampaignId':_0xd69de6['id']})['catch'](function(_0xc67058){logger[_0x9ccd('0x16')](_0x9ccd('0x3e'),_0x9ccd('0x17'),_0xc67058[_0x9ccd('0x3d')]);});}}});})['then'](function(){_0x52090f();})[_0x9ccd('0x28')](function(_0x221e8a){logger[_0x9ccd('0x16')]('cmContact,\x20%s,\x20%s',_0x9ccd('0x17'),_0x221e8a['message']);_0x52090f(_0x221e8a);});}else{_0x52090f(new Error(_0x9ccd('0x3f')));}},'afterDestroy':function(_0x3e11bf,_0xb9bb4e,_0x13dba9){var _0x267867=_0x570de5[_0x9ccd('0x14')];var _0x4a64d2=_0x3e11bf[_0x9ccd('0x15')]({'plain':!![]});return _0x267867['CmHopper'][_0x9ccd('0x39')]({'raw':!![],'where':{'ListId':_0x4a64d2[_0x9ccd('0x25')],'ContactId':_0x4a64d2['id']}})['then'](function(_0x498cfc){if(!_[_0x9ccd('0x40')](_0x498cfc)){var _0x578d32=[];for(var _0x492dde=0x0;_0x492dde<_0x498cfc[_0x9ccd('0x35')];_0x492dde+=0x1){var _0x4bd386=_0x267867['CmHopper'][_0x9ccd('0x41')]({'where':{'ListId':_0x498cfc[_0x492dde][_0x9ccd('0x25')],'ContactId':_0x498cfc[_0x492dde]['ContactId'],'VoiceQueueId':_0x498cfc[_0x492dde]['VoiceQueueId'],'CampaignId':_0x498cfc[_0x492dde][_0x9ccd('0x42')]}});_0x578d32[_0x9ccd('0x43')](_0x4bd386);}return BPromise[_0x9ccd('0x44')](_0x578d32);}})[_0x9ccd('0x1f')](function(_0x2769f0){logger[_0x9ccd('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0x9ccd('0x18')](_0x2769f0,{'showHidden':![],'depth':null}));_0x13dba9();})[_0x9ccd('0x28')](function(_0x5d09d0){logger[_0x9ccd('0x16')]('[CmContact][afterDestroy][Error]',util['inspect'](_0x5d09d0,{'showHidden':![],'depth':null}));_0x13dba9(_0x5d09d0);});}}});}; \ No newline at end of file +var _0x5fec=['mobile','fax','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','add','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','format','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','inspect','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','lastName','phone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5fec,0x80));var _0xc5fe=function(_0x5270b9,_0x16f7dd){_0x5270b9=_0x5270b9-0x0;var _0x5ee3a3=_0x5fec[_0x5270b9];return _0x5ee3a3;};'use strict';var _=require(_0xc5fe('0x0'));var util=require('util');var logger=require(_0xc5fe('0x1'))(_0xc5fe('0x2'));var moment=require('moment');var BPromise=require(_0xc5fe('0x3'));var rp=require(_0xc5fe('0x4'));var fs=require('fs');var path=require(_0xc5fe('0x5'));var rimraf=require(_0xc5fe('0x6'));var config=require('../../config/environment');var shared=require(_0xc5fe('0x7'));var attributes=require(_0xc5fe('0x8'));module[_0xc5fe('0x9')]=function(_0x4cf65d,_0x3910c8){return _0x4cf65d[_0xc5fe('0xa')]('CmContact',attributes,{'tableName':_0xc5fe('0xb'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':'fti_cm_contacts','fields':['firstName',_0xc5fe('0xc'),_0xc5fe('0xd'),_0xc5fe('0xe'),_0xc5fe('0xf'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xc5fe('0x10'),'collate':_0xc5fe('0x11'),'hooks':{'afterCreate':function(_0x216844,_0x4e5b64,_0x5e6347){var _0x2a434d=_0x4cf65d[_0xc5fe('0x12')];var _0x1e5213=_0x216844[_0xc5fe('0x13')]({'plain':!![]});function _0x25ffc1(){return function(_0x19c4ec){logger[_0xc5fe('0x14')](_0xc5fe('0x15'),_0xc5fe('0x16'),util['inspect'](_0x19c4ec,{'showHidden':![],'depth':null}));};}function _0x28fe8a(_0x503b74,_0x19ad72){var _0x592369=_0x19ad72[_0xc5fe('0x17')]?_0x19ad72[_0xc5fe('0x17')]:moment()['format'](_0xc5fe('0x18'));return new BPromise(function(_0x400531,_0x2e8e79){if(_[_0xc5fe('0x19')](_0x19ad72[_0xc5fe('0x1a')])){_0x400531({'ret':_0x592369});}else{_0x2a434d[_0xc5fe('0x1b')][_0xc5fe('0x1c')]({'where':{'id':_0x503b74['id']}})[_0xc5fe('0x1d')](function(_0x1c366a){if(!_[_0xc5fe('0x19')](_0x1c366a)){var _0x5db7a0=_0x1c366a[_0xc5fe('0x1a')];if(!_[_0xc5fe('0x19')](_0x5db7a0)){var _0x3fae6b=shared['timezones'];var _0x49be50=_0x3fae6b[_0x5db7a0];var _0x378679=_0x3fae6b[_0x19ad72[_0xc5fe('0x1a')]];if(!_[_0xc5fe('0x19')](_0x49be50)&&!_[_0xc5fe('0x19')](_0x378679)){var _0x4873e6=_0x49be50['utcOffset']-_0x378679[_0xc5fe('0x1e')];_0x592369=_0x19ad72[_0xc5fe('0x17')]?_0x19ad72[_0xc5fe('0x17')]:moment();var _0xd28a5e=moment(_0x592369)[_0xc5fe('0x1f')](_0x4873e6,'minutes');_0x400531({'ret':_0xd28a5e['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x400531({'ret':_0x592369});}else _0x400531({'ret':_0x592369});}else{_0x400531({'ret':_0x592369});}});}});return 0xa;}var _0x38f523=function(_0x523682){return new BPromise(function(_0x8487c,_0x4f0f06){_0x28fe8a(_0x523682,_0x1e5213)[_0xc5fe('0x1d')](function(_0x30c462){_0x1e5213['scheduledat']=_0x30c462[_0xc5fe('0x20')];_0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x1c')]({'where':{'phone':_0x1e5213['phone'],'VoiceQueueId':_0x523682['id']}})[_0xc5fe('0x1d')](function(_0x4a66e8){if(!_[_0xc5fe('0x19')](_0x4a66e8)){throw new Error(_0xc5fe('0x22')+_0x1e5213[_0xc5fe('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x523682['id']);}return _0x2a434d['CmHopper'][_0xc5fe('0x23')]({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213[_0xc5fe('0x24')],'priority':_0x1e5213[_0xc5fe('0x25')]?_0x1e5213[_0xc5fe('0x25')]:0x2,'scheduledat':_0x1e5213[_0xc5fe('0x17')]?_0x1e5213[_0xc5fe('0x17')]:moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1e5213[_0xc5fe('0x27')]?!![]:![],'callbackuniqueid':_0x1e5213[_0xc5fe('0x27')]?_0x1e5213[_0xc5fe('0x27')]:undefined,'callbackat':_0x1e5213['callbackUniqueid']?moment()[_0xc5fe('0x26')](_0xc5fe('0x18')):undefined,'VoiceQueueId':_0x523682['id']});})[_0xc5fe('0x28')](function(_0x953f00){_0x4f0f06(_0x953f00);});});});};var _0x2b2074=function(_0x4fb64c){return new BPromise(function(_0x4b90a3,_0x10319f){_0x28fe8a(_0x4fb64c,_0x1e5213)[_0xc5fe('0x1d')](function(_0x1aa6f2){_0x1e5213[_0xc5fe('0x17')]=_0x1aa6f2[_0xc5fe('0x20')];_0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x1c')]({'where':{'phone':_0x1e5213[_0xc5fe('0xd')],'VoiceQueueId':_0x4fb64c['id']}})['then'](function(_0x589643){if(!_['isNil'](_0x589643)){throw new Error(_0xc5fe('0x22')+_0x1e5213[_0xc5fe('0xd')]+_0xc5fe('0x29')+_0x4fb64c['id']);}return _0x2a434d[_0xc5fe('0x2a')]['findOne']({'where':{'calleridnum':_0x1e5213[_0xc5fe('0xd')],'VoiceQueueId':_0x4fb64c['id']}});})[_0xc5fe('0x1d')](function(_0xc01d9a){if(!_[_0xc5fe('0x19')](_0xc01d9a)){throw new Error(_0xc5fe('0x2b')+_0x1e5213[_0xc5fe('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x4fb64c['id']);}return _0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x23')]({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213[_0xc5fe('0x24')],'priority':_0x1e5213[_0xc5fe('0x25')]?_0x1e5213['priority']:0x2,'scheduledat':_0x1e5213[_0xc5fe('0x17')]?_0x1e5213[_0xc5fe('0x17')]:moment()['format'](_0xc5fe('0x18')),'callback':_0x1e5213['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1e5213[_0xc5fe('0x27')]?_0x1e5213[_0xc5fe('0x27')]:undefined,'callbackat':_0x1e5213[_0xc5fe('0x27')]?moment()[_0xc5fe('0x26')](_0xc5fe('0x18')):undefined,'VoiceQueueId':_0x4fb64c['id']});})[_0xc5fe('0x28')](function(_0x266402){_0x10319f(_0x266402);});});});};function _0x46b493(){return function(_0x5ee530){logger['error'](_0xc5fe('0x15'),'afterCreate',util[_0xc5fe('0x2c')](_0x5ee530,{'showHidden':![],'depth':null}));};}function _0x4fe803(_0xc43230,_0x5e9957){var _0x5ace29=_0x5e9957[_0xc5fe('0x17')]?_0x5e9957[_0xc5fe('0x17')]:moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x26e7de,_0x30e0f4){if(_['isNil'](_0x5e9957[_0xc5fe('0x1a')])){_0x26e7de({'ret':_0x5ace29});}else{_0x2a434d[_0xc5fe('0x2d')][_0xc5fe('0x1c')]({'where':{'id':_0xc43230['id']}})[_0xc5fe('0x1d')](function(_0x30557b){if(!_[_0xc5fe('0x19')](_0x30557b)){var _0x39a748=_0x30557b[_0xc5fe('0x1a')];if(!_[_0xc5fe('0x19')](_0x39a748)){var _0x446e20=shared['timezones'];var _0x41e79f=_0x446e20[_0x39a748];var _0x10dd15=_0x446e20[_0x5e9957[_0xc5fe('0x1a')]];if(!_[_0xc5fe('0x19')](_0x41e79f)&&!_['isNil'](_0x10dd15)){var _0xd599be=_0x41e79f[_0xc5fe('0x1e')]-_0x10dd15[_0xc5fe('0x1e')];_0x5ace29=_0x5e9957[_0xc5fe('0x17')]?_0x5e9957['scheduledat']:moment();var _0x4a8d45=moment(_0x5ace29)['add'](_0xd599be,_0xc5fe('0x2e'));_0x26e7de({'ret':_0x4a8d45['format'](_0xc5fe('0x18'))});}else _0x26e7de({'ret':_0x5ace29});}else _0x26e7de({'ret':_0x5ace29});}else{_0x26e7de({'ret':_0x5ace29});}});}});return 0xa;}var _0x474797=function(_0x5dddfc){return new BPromise(function(_0x1fcf84,_0x31d7ed){_0x4fe803(_0x5dddfc,_0x1e5213)['then'](function(_0x41775f){_0x1e5213['scheduledat']=_0x41775f[_0xc5fe('0x20')];_0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x1c')]({'where':{'phone':_0x1e5213[_0xc5fe('0xd')],'CampaignId':_0x5dddfc['id']}})[_0xc5fe('0x1d')](function(_0x31a760){if(!_[_0xc5fe('0x19')](_0x31a760)){throw new Error(_0xc5fe('0x22')+_0x1e5213[_0xc5fe('0xd')]+_0xc5fe('0x2f')+_0x5dddfc['id']);}return _0x2a434d[_0xc5fe('0x21')]['create']({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213['ListId'],'priority':_0x1e5213[_0xc5fe('0x25')]?_0x1e5213[_0xc5fe('0x25')]:0x2,'scheduledat':_0x1e5213[_0xc5fe('0x17')]?_0x1e5213[_0xc5fe('0x17')]:moment()[_0xc5fe('0x26')](_0xc5fe('0x18')),'callback':_0x1e5213[_0xc5fe('0x27')]?!![]:![],'callbackuniqueid':_0x1e5213[_0xc5fe('0x27')]?_0x1e5213[_0xc5fe('0x27')]:undefined,'callbackat':_0x1e5213[_0xc5fe('0x27')]?moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5dddfc['id']});})[_0xc5fe('0x28')](function(_0x15d34b){_0x31d7ed(_0x15d34b);});});});};var _0x2a8f87=function(_0xd23a7a){return new BPromise(function(_0x396edd,_0x2ee66c){_0x4fe803(_0xd23a7a,_0x1e5213)['then'](function(_0x372fa8){_0x1e5213['scheduledat']=_0x372fa8['ret'];_0x2a434d['CmHopper']['findOne']({'where':{'phone':_0x1e5213[_0xc5fe('0xd')],'CampaignId':_0xd23a7a['id']}})['then'](function(_0x5d38e8){if(!_[_0xc5fe('0x19')](_0x5d38e8)){throw new Error(_0xc5fe('0x22')+_0x1e5213[_0xc5fe('0xd')]+_0xc5fe('0x30')+_0xd23a7a['id']);}return _0x2a434d[_0xc5fe('0x2a')][_0xc5fe('0x1c')]({'where':{'calleridnum':_0x1e5213[_0xc5fe('0xd')],'CampaignId':_0xd23a7a['id']}});})[_0xc5fe('0x1d')](function(_0x11f832){if(!_['isNil'](_0x11f832)){throw new Error(_0xc5fe('0x2b')+_0x1e5213['phone']+_0xc5fe('0x31')+_0xd23a7a['id']);}return _0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x23')]({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213['ListId'],'priority':_0x1e5213['priority']?_0x1e5213[_0xc5fe('0x25')]:0x2,'scheduledat':_0x1e5213[_0xc5fe('0x17')]?_0x1e5213[_0xc5fe('0x17')]:moment()[_0xc5fe('0x26')](_0xc5fe('0x18')),'callback':_0x1e5213[_0xc5fe('0x27')]?!![]:![],'callbackuniqueid':_0x1e5213[_0xc5fe('0x27')]?_0x1e5213[_0xc5fe('0x27')]:undefined,'callbackat':_0x1e5213['callbackUniqueid']?moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xd23a7a['id']});})['catch'](function(_0x439ca9){_0x2ee66c(_0x439ca9);});});});};if(_0x1e5213[_0xc5fe('0x24')]){_0x2a434d[_0xc5fe('0x1b')][_0xc5fe('0x32')]({'where':{'type':_0xc5fe('0x33')},'attributes':['id',_0xc5fe('0x34'),_0xc5fe('0x1a')],'include':[{'model':_0x2a434d['CmList'],'as':_0xc5fe('0x35'),'where':{'id':_0x1e5213[_0xc5fe('0x24')]}}]})[_0xc5fe('0x1d')](function(_0x54e0d1){if(_0x54e0d1){var _0x3a772d=[];for(var _0x1b5749=0x0,_0x1bead0;_0x1b5749<_0x54e0d1[_0xc5fe('0x36')];_0x1b5749+=0x1){_0x1bead0=_0x54e0d1[_0x1b5749][_0xc5fe('0x13')]({'plain':!![]});switch(_0x1bead0['dialCheckDuplicateType']){case _0xc5fe('0x37'):_0x2b2074(_0x1bead0)[_0xc5fe('0x28')](_0x25ffc1());break;case _0xc5fe('0x38'):_0x38f523(_0x1bead0)[_0xc5fe('0x28')](_0x25ffc1());break;default:_0x4fe803(_0x1bead0,_0x1e5213)[_0xc5fe('0x1d')](function(_0x239654){_0x1e5213[_0xc5fe('0x17')]=_0x239654[_0xc5fe('0x20')];_0x2a434d[_0xc5fe('0x21')][_0xc5fe('0x23')]({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213['ListId'],'scheduledat':_0x1e5213['scheduledat']?_0x1e5213[_0xc5fe('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1e5213[_0xc5fe('0x25')]?_0x1e5213[_0xc5fe('0x25')]:0x2,'callback':_0x1e5213[_0xc5fe('0x27')]?!![]:![],'callbackuniqueid':_0x1e5213['callbackUniqueid']?_0x1e5213['callbackUniqueid']:undefined,'callbackat':_0x1e5213[_0xc5fe('0x27')]?moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1bead0['id']})[_0xc5fe('0x28')](_0x25ffc1());});}}}})[_0xc5fe('0x1d')](function(){return _0x2a434d[_0xc5fe('0x1b')][_0xc5fe('0x32')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x2a434d[_0xc5fe('0x39')],'as':'BlackLists','where':{'id':_0x1e5213['ListId']}}]})[_0xc5fe('0x1d')](function(_0x353dab){if(_0x353dab){var _0x4d3626=[];for(var _0x441a11=0x0,_0x402284;_0x441a11<_0x353dab[_0xc5fe('0x36')];_0x441a11+=0x1){_0x402284=_0x353dab[_0x441a11]['get']({'plain':!![]});_0x2a434d[_0xc5fe('0x3a')]['create']({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213['ListId'],'VoiceQueueId':_0x402284['id']})[_0xc5fe('0x28')](function(_0x26bece){logger['error'](_0xc5fe('0x3b'),_0xc5fe('0x16'),_0x26bece[_0xc5fe('0x3c')]);});}}});})['then'](function(){return _0x2a434d[_0xc5fe('0x2d')][_0xc5fe('0x32')]({'attributes':['id',_0xc5fe('0x34'),'dialTimezone'],'include':[{'model':_0x2a434d[_0xc5fe('0x39')],'as':_0xc5fe('0x35'),'where':{'id':_0x1e5213[_0xc5fe('0x24')]}}]})['then'](function(_0x1c86bf){if(_0x1c86bf){var _0x2457ee=[];for(var _0x4cbb26=0x0,_0x5026a2;_0x4cbb26<_0x1c86bf[_0xc5fe('0x36')];_0x4cbb26+=0x1){_0x5026a2=_0x1c86bf[_0x4cbb26][_0xc5fe('0x13')]({'plain':!![]});switch(_0x5026a2['dialCheckDuplicateType']){case'always':_0x2a8f87(_0x5026a2)[_0xc5fe('0x28')](_0x46b493());break;case'onlyIfOpen':_0x474797(_0x5026a2)[_0xc5fe('0x28')](_0x46b493());break;default:_0x2a434d[_0xc5fe('0x21')]['create']({'phone':_0x1e5213[_0xc5fe('0xd')],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213['ListId'],'scheduledat':_0x1e5213[_0xc5fe('0x17')]?_0x1e5213['scheduledat']:moment()[_0xc5fe('0x26')](_0xc5fe('0x18')),'priority':_0x1e5213[_0xc5fe('0x25')]?_0x1e5213[_0xc5fe('0x25')]:0x2,'callback':_0x1e5213[_0xc5fe('0x27')]?!![]:![],'callbackuniqueid':_0x1e5213['callbackUniqueid']?_0x1e5213[_0xc5fe('0x27')]:undefined,'callbackat':_0x1e5213[_0xc5fe('0x27')]?moment()[_0xc5fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5026a2['id']})['catch'](_0x46b493());}}}});})['then'](function(){return _0x2a434d[_0xc5fe('0x2d')][_0xc5fe('0x32')]({'attributes':['id'],'include':[{'model':_0x2a434d[_0xc5fe('0x39')],'as':_0xc5fe('0x3d'),'where':{'id':_0x1e5213['ListId']}}]})['then'](function(_0x2bbd3e){if(_0x2bbd3e){var _0x1f3bf4=[];for(var _0x13d364=0x0,_0x335a26;_0x13d364<_0x2bbd3e[_0xc5fe('0x36')];_0x13d364+=0x1){_0x335a26=_0x2bbd3e[_0x13d364]['get']({'plain':!![]});_0x2a434d[_0xc5fe('0x3a')][_0xc5fe('0x23')]({'phone':_0x1e5213['phone'],'ContactId':_0x1e5213['id'],'ListId':_0x1e5213[_0xc5fe('0x24')],'CampaignId':_0x335a26['id']})[_0xc5fe('0x28')](function(_0x54d772){logger['error']('cmContact,\x20%s,\x20%s',_0xc5fe('0x16'),_0x54d772['message']);});}}});})[_0xc5fe('0x1d')](function(){_0x5e6347();})[_0xc5fe('0x28')](function(_0x69947){logger[_0xc5fe('0x14')]('cmContact,\x20%s,\x20%s',_0xc5fe('0x16'),_0x69947['message']);_0x5e6347(_0x69947);});}else{_0x5e6347(new Error(_0xc5fe('0x3e')));}},'afterDestroy':function(_0x39f855,_0x4207f0,_0x547ffa){var _0x19135f=_0x4cf65d[_0xc5fe('0x12')];var _0x423d2b=_0x39f855['get']({'plain':!![]});return _0x19135f[_0xc5fe('0x21')][_0xc5fe('0x32')]({'raw':!![],'where':{'ListId':_0x423d2b['ListId'],'ContactId':_0x423d2b['id']}})['then'](function(_0x535407){if(!_[_0xc5fe('0x3f')](_0x535407)){var _0x2d28a6=[];for(var _0x119fb6=0x0;_0x119fb6<_0x535407[_0xc5fe('0x36')];_0x119fb6+=0x1){var _0x288aa7=_0x19135f[_0xc5fe('0x21')][_0xc5fe('0x40')]({'where':{'ListId':_0x535407[_0x119fb6][_0xc5fe('0x24')],'ContactId':_0x535407[_0x119fb6][_0xc5fe('0x41')],'VoiceQueueId':_0x535407[_0x119fb6][_0xc5fe('0x42')],'CampaignId':_0x535407[_0x119fb6][_0xc5fe('0x43')]}});_0x2d28a6[_0xc5fe('0x44')](_0x288aa7);}return BPromise['all'](_0x2d28a6);}})['then'](function(_0x4983db){logger[_0xc5fe('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0xc5fe('0x2c')](_0x4983db,{'showHidden':![],'depth':null}));_0x547ffa();})[_0xc5fe('0x28')](function(_0x4ed470){logger[_0xc5fe('0x14')](_0xc5fe('0x46'),util['inspect'](_0x4ed470,{'showHidden':![],'depth':null}));_0x547ffa(_0x4ed470);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 6353181..0f4de93 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x263e8b,_0x9a2d4e){var _0x594643=function(_0x1c3ec0){while(--_0x1c3ec0){_0x263e8b['push'](_0x263e8b['shift']());}};_0x594643(++_0x9a2d4e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x4227d7,_0x22d067){var _0x4e44dc=function(_0x5717c8){while(--_0x5717c8){_0x4227d7['push'](_0x4227d7['shift']());}};_0x4e44dc(++_0x22d067);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 e8f56fd..eec81b4 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 _0x257e=['exports','INTEGER','PHONE','STRING'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x257e,0x1dc));var _0xe257=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x257e[_0x53f964];return _0x17be6c;};'use strict';var Sequelize=require('sequelize');module[_0xe257('0x0')]={'CmContactId':{'type':Sequelize[_0xe257('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xe257('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xe257('0x2')},'OrderBy':{'type':Sequelize[_0xe257('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xe257('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x7914=['STRING','INTEGER','PHONE','sequelize','exports'];(function(_0xcd07c,_0x8f566c){var _0xb99e27=function(_0x2d19d2){while(--_0x2d19d2){_0xcd07c['push'](_0xcd07c['shift']());}};_0xb99e27(++_0x8f566c);}(_0x7914,0x107));var _0x4791=function(_0x26ebe7,_0x46a05d){_0x26ebe7=_0x26ebe7-0x0;var _0x32b550=_0x7914[_0x26ebe7];return _0x32b550;};'use strict';var Sequelize=require(_0x4791('0x0'));module[_0x4791('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x4791('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4791('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4791('0x2')],'defaultValue':_0x4791('0x4')},'OrderBy':{'type':Sequelize[_0x4791('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x4791('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 777b1ff..4a51f84 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 _0x9411=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','CmContactHasItems','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','CmContactHasItem','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x578ce9,_0x230a69){var _0x315689=function(_0x41fa9d){while(--_0x41fa9d){_0x578ce9['push'](_0x578ce9['shift']());}};_0x315689(++_0x230a69);}(_0x9411,0x13c));var _0x1941=function(_0x351ee0,_0x3be8a3){_0x351ee0=_0x351ee0-0x0;var _0x2a1de7=_0x9411[_0x351ee0];return _0x2a1de7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1941('0x0'));var jsonpatch=require(_0x1941('0x1'));var rp=require(_0x1941('0x2'));var moment=require('moment');var BPromise=require(_0x1941('0x3'));var Mustache=require('mustache');var util=require(_0x1941('0x4'));var path=require(_0x1941('0x5'));var sox=require(_0x1941('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1941('0x7'));var _=require('lodash');var squel=require(_0x1941('0x8'));var crypto=require(_0x1941('0x9'));var jsforce=require(_0x1941('0xa'));var deskjs=require(_0x1941('0xb'));var toCsv=require(_0x1941('0xc'));var querystring=require(_0x1941('0xd'));var Papa=require(_0x1941('0xe'));var Redis=require(_0x1941('0xf'));var authService=require(_0x1941('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1941('0x11'));var hardwareService=require(_0x1941('0x12'));var logger=require(_0x1941('0x13'))(_0x1941('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1941('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265fca,_0x4397d4){_0x4397d4=_0x4397d4||0xcc;return function(_0x1df99c){if(_0x1df99c){return _0x265fca[_0x1941('0x16')](_0x4397d4);}return _0x265fca[_0x1941('0x17')](_0x4397d4)['end']();};}function respondWithResult(_0x420f0c,_0x238512){_0x238512=_0x238512||0xc8;return function(_0x389446){if(_0x389446){return _0x420f0c['status'](_0x238512)[_0x1941('0x18')](_0x389446);}};}function respondWithFilteredResult(_0x3a3c37,_0x1a0718){return function(_0x4a1a6f){if(_0x4a1a6f){var _0x30441b=typeof _0x1a0718['offset']===_0x1941('0x19')&&typeof _0x1a0718[_0x1941('0x1a')]==='undefined';var _0x1db452=_0x4a1a6f[_0x1941('0x1b')];var _0x5925f4=_0x30441b?0x0:_0x1a0718[_0x1941('0x1c')];var _0xb54ea4=_0x30441b?_0x4a1a6f[_0x1941('0x1b')]:_0x1a0718[_0x1941('0x1c')]+_0x1a0718[_0x1941('0x1a')];var _0x4c1b5e;if(_0xb54ea4>=_0x1db452){_0xb54ea4=_0x1db452;_0x4c1b5e=0xc8;}else{_0x4c1b5e=0xce;}_0x3a3c37[_0x1941('0x17')](_0x4c1b5e);return _0x3a3c37[_0x1941('0x1d')](_0x1941('0x1e'),_0x5925f4+'-'+_0xb54ea4+'/'+_0x1db452)[_0x1941('0x18')](_0x4a1a6f);}return null;};}function patchUpdates(_0xad0a57){return function(_0x5b7330){try{jsonpatch['apply'](_0x5b7330,_0xad0a57,!![]);}catch(_0x4258f3){return BPromise[_0x1941('0x1f')](_0x4258f3);}return _0x5b7330[_0x1941('0x20')]();};}function saveUpdates(_0x136653,_0x3618c8){return function(_0x53616c){if(_0x53616c){return _0x53616c[_0x1941('0x21')](_0x136653)['then'](function(_0x1fc0e7){return _0x1fc0e7;});}return null;};}function removeEntity(_0x5c7f8c,_0x3e0201){return function(_0x1ea015){if(_0x1ea015){return _0x1ea015[_0x1941('0x22')]()[_0x1941('0x23')](function(){var _0x5e3444=_0x1ea015['get']({'plain':!![]});var _0x2f6eb4=_0x1941('0x24');return db[_0x1941('0x25')][_0x1941('0x22')]({'where':{'type':_0x2f6eb4,'resourceId':_0x5e3444['id']}})['then'](function(){return _0x1ea015;});})[_0x1941('0x23')](function(){_0x5c7f8c['status'](0xcc)[_0x1941('0x26')]();});}};}function handleEntityNotFound(_0xdde740,_0x374d19){return function(_0x15f89e){if(!_0x15f89e){_0xdde740[_0x1941('0x16')](0x194);}return _0x15f89e;};}function handleError(_0x251936,_0x175db9){_0x175db9=_0x175db9||0x1f4;return function(_0x3f1abf){logger[_0x1941('0x27')](_0x3f1abf['stack']);if(_0x3f1abf[_0x1941('0x28')]){delete _0x3f1abf[_0x1941('0x28')];}_0x251936[_0x1941('0x17')](_0x175db9)[_0x1941('0x29')](_0x3f1abf);};}exports[_0x1941('0x2a')]=function(_0x5a246a,_0x3820da){var _0x321aca={},_0x3efed0={},_0x582302={'count':0x0,'rows':[]};var _0x11037a=_[_0x1941('0x2b')](db['CmContactHasItem'][_0x1941('0x2c')],function(_0x27fa6a){return{'name':_0x27fa6a[_0x1941('0x2d')],'type':_0x27fa6a[_0x1941('0x2e')]['key']};});_0x3efed0[_0x1941('0x2f')]=_[_0x1941('0x2b')](_0x11037a,_0x1941('0x28'));_0x3efed0[_0x1941('0x30')]=_[_0x1941('0x31')](_0x5a246a[_0x1941('0x30')]);_0x3efed0[_0x1941('0x32')]=_[_0x1941('0x33')](_0x3efed0['model'],_0x3efed0['query']);_0x321aca['attributes']=_['intersection'](_0x3efed0[_0x1941('0x2f')],qs[_0x1941('0x34')](_0x5a246a[_0x1941('0x30')]['fields']));_0x321aca['attributes']=_0x321aca[_0x1941('0x35')]['length']?_0x321aca[_0x1941('0x35')]:_0x3efed0[_0x1941('0x2f')];if(!_0x5a246a[_0x1941('0x30')][_0x1941('0x36')](_0x1941('0x37'))){_0x321aca[_0x1941('0x1a')]=qs[_0x1941('0x1a')](_0x5a246a[_0x1941('0x30')]['limit']);_0x321aca[_0x1941('0x1c')]=qs[_0x1941('0x1c')](_0x5a246a[_0x1941('0x30')][_0x1941('0x1c')]);}_0x321aca['order']=qs[_0x1941('0x38')](_0x5a246a[_0x1941('0x30')][_0x1941('0x38')]);_0x321aca[_0x1941('0x39')]=qs[_0x1941('0x32')](_[_0x1941('0x3a')](_0x5a246a[_0x1941('0x30')],_0x3efed0[_0x1941('0x32')]),_0x11037a);if(_0x5a246a['query']['filter']){_0x321aca[_0x1941('0x39')]=_[_0x1941('0x3b')](_0x321aca['where'],{'$or':_[_0x1941('0x2b')](_0x11037a,function(_0x931dfa){if(_0x931dfa['type']!==_0x1941('0x3c')){var _0x583034={};_0x583034[_0x931dfa[_0x1941('0x28')]]={'$like':'%'+_0x5a246a[_0x1941('0x30')][_0x1941('0x3d')]+'%'};return _0x583034;}})});}_0x321aca=_[_0x1941('0x3b')]({},_0x321aca,_0x5a246a[_0x1941('0x3e')]);var _0x5e462={'where':_0x321aca['where']};return db[_0x1941('0x3f')][_0x1941('0x1b')](_0x5e462)[_0x1941('0x23')](function(_0xf37b73){_0x582302[_0x1941('0x1b')]=_0xf37b73;if(_0x5a246a[_0x1941('0x30')]['includeAll']){_0x321aca[_0x1941('0x40')]=[{'all':!![]}];}return db[_0x1941('0x3f')][_0x1941('0x41')](_0x321aca);})[_0x1941('0x23')](function(_0x2f110e){_0x582302[_0x1941('0x42')]=_0x2f110e;return _0x582302;})[_0x1941('0x23')](respondWithFilteredResult(_0x3820da,_0x321aca))[_0x1941('0x43')](handleError(_0x3820da,null));};exports[_0x1941('0x44')]=function(_0x1c682a,_0x472bd7){var _0x44a718={'raw':!![],'where':{'id':_0x1c682a[_0x1941('0x45')]['id']}},_0xfd1cae={};_0xfd1cae[_0x1941('0x2f')]=_[_0x1941('0x31')](db[_0x1941('0x3f')]['rawAttributes']);_0xfd1cae[_0x1941('0x30')]=_[_0x1941('0x31')](_0x1c682a['query']);_0xfd1cae[_0x1941('0x32')]=_['intersection'](_0xfd1cae[_0x1941('0x2f')],_0xfd1cae[_0x1941('0x30')]);_0x44a718[_0x1941('0x35')]=_[_0x1941('0x33')](_0xfd1cae[_0x1941('0x2f')],qs[_0x1941('0x34')](_0x1c682a[_0x1941('0x30')][_0x1941('0x34')]));_0x44a718['attributes']=_0x44a718['attributes'][_0x1941('0x46')]?_0x44a718['attributes']:_0xfd1cae['model'];if(_0x1c682a[_0x1941('0x30')][_0x1941('0x47')]){_0x44a718[_0x1941('0x40')]=[{'all':!![]}];}_0x44a718=_[_0x1941('0x3b')]({},_0x44a718,_0x1c682a[_0x1941('0x3e')]);return db[_0x1941('0x3f')][_0x1941('0x48')](_0x44a718)[_0x1941('0x23')](handleEntityNotFound(_0x472bd7,null))['then'](respondWithResult(_0x472bd7,null))[_0x1941('0x43')](handleError(_0x472bd7,null));};exports['create']=function(_0xe2e81c,_0x3c9c76){return db[_0x1941('0x3f')][_0x1941('0x49')](_0xe2e81c[_0x1941('0x4a')],{})['then'](function(_0xd86e15){var _0x34cfde=_0xe2e81c[_0x1941('0x4b')][_0x1941('0x4c')]({'plain':!![]});if(!_0x34cfde)throw new Error(_0x1941('0x4d'));if(_0x34cfde[_0x1941('0x4e')]==='user'){var _0xd5eb7=_0xd86e15[_0x1941('0x4c')]({'plain':!![]});var _0x51dbcd=_0x1941('0x24');return db[_0x1941('0x4f')][_0x1941('0x48')]({'where':{'name':_0x51dbcd,'userProfileId':_0x34cfde[_0x1941('0x50')]},'raw':!![]})[_0x1941('0x23')](function(_0xfe1166){if(_0xfe1166&&_0xfe1166[_0x1941('0x51')]===0x0){return db['UserProfileResource'][_0x1941('0x49')]({'name':_0xd5eb7['name'],'resourceId':_0xd5eb7['id'],'type':_0xfe1166[_0x1941('0x28')],'sectionId':_0xfe1166['id']},{})[_0x1941('0x23')](function(){return _0xd86e15;});}else{return _0xd86e15;}})[_0x1941('0x43')](function(_0x2b9433){logger[_0x1941('0x27')](_0x1941('0x52'),_0x2b9433);throw _0x2b9433;});}return _0xd86e15;})[_0x1941('0x23')](respondWithResult(_0x3c9c76,0xc9))['catch'](handleError(_0x3c9c76,null));};exports[_0x1941('0x21')]=function(_0x2fc015,_0x490d21){if(_0x2fc015['body']['id']){delete _0x2fc015[_0x1941('0x4a')]['id'];}return db[_0x1941('0x3f')][_0x1941('0x48')]({'where':{'id':_0x2fc015[_0x1941('0x45')]['id']}})['then'](handleEntityNotFound(_0x490d21,null))[_0x1941('0x23')](saveUpdates(_0x2fc015[_0x1941('0x4a')],null))[_0x1941('0x23')](respondWithResult(_0x490d21,null))[_0x1941('0x43')](handleError(_0x490d21,null));};exports[_0x1941('0x22')]=function(_0x40489a,_0x3a5a6e){return db[_0x1941('0x3f')][_0x1941('0x48')]({'where':{'id':_0x40489a['params']['id']}})[_0x1941('0x23')](handleEntityNotFound(_0x3a5a6e,null))[_0x1941('0x23')](removeEntity(_0x3a5a6e,null))[_0x1941('0x43')](handleError(_0x3a5a6e,null));}; \ No newline at end of file +var _0x1809=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CmContactHasItems','end','error','stack','name','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user'];(function(_0x41b3aa,_0x33d6c7){var _0x5532ff=function(_0x3d87af){while(--_0x3d87af){_0x41b3aa['push'](_0x41b3aa['shift']());}};_0x5532ff(++_0x33d6c7);}(_0x1809,0xab));var _0x9180=function(_0x1a17d8,_0x197bcb){_0x1a17d8=_0x1a17d8-0x0;var _0x407fa8=_0x1809[_0x1a17d8];return _0x407fa8;};'use strict';var emlformat=require(_0x9180('0x0'));var rimraf=require(_0x9180('0x1'));var zipdir=require(_0x9180('0x2'));var jsonpatch=require(_0x9180('0x3'));var rp=require(_0x9180('0x4'));var moment=require('moment');var BPromise=require(_0x9180('0x5'));var Mustache=require(_0x9180('0x6'));var util=require('util');var path=require(_0x9180('0x7'));var sox=require('sox');var csv=require(_0x9180('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9180('0x9'));var squel=require(_0x9180('0xa'));var crypto=require(_0x9180('0xb'));var jsforce=require(_0x9180('0xc'));var deskjs=require(_0x9180('0xd'));var toCsv=require(_0x9180('0x8'));var querystring=require(_0x9180('0xe'));var Papa=require(_0x9180('0xf'));var Redis=require(_0x9180('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9180('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9180('0x12'));var config=require(_0x9180('0x13'));var licenseUtil=require(_0x9180('0x14'));var db=require(_0x9180('0x15'))['db'];function respondWithStatusCode(_0x1d0482,_0x29946c){_0x29946c=_0x29946c||0xcc;return function(_0xf13c8a){if(_0xf13c8a){return _0x1d0482[_0x9180('0x16')](_0x29946c);}return _0x1d0482[_0x9180('0x17')](_0x29946c)['end']();};}function respondWithResult(_0x4c5265,_0x48a10c){_0x48a10c=_0x48a10c||0xc8;return function(_0x192c93){if(_0x192c93){return _0x4c5265['status'](_0x48a10c)[_0x9180('0x18')](_0x192c93);}};}function respondWithFilteredResult(_0x44a366,_0x59bb68){return function(_0x599cce){if(_0x599cce){var _0x43934f=typeof _0x59bb68[_0x9180('0x19')]===_0x9180('0x1a')&&typeof _0x59bb68[_0x9180('0x1b')]==='undefined';var _0x2b9226=_0x599cce[_0x9180('0x1c')];var _0x46d576=_0x43934f?0x0:_0x59bb68[_0x9180('0x19')];var _0x241c59=_0x43934f?_0x599cce[_0x9180('0x1c')]:_0x59bb68['offset']+_0x59bb68[_0x9180('0x1b')];var _0x13404e;if(_0x241c59>=_0x2b9226){_0x241c59=_0x2b9226;_0x13404e=0xc8;}else{_0x13404e=0xce;}_0x44a366[_0x9180('0x17')](_0x13404e);return _0x44a366[_0x9180('0x1d')]('Content-Range',_0x46d576+'-'+_0x241c59+'/'+_0x2b9226)[_0x9180('0x18')](_0x599cce);}return null;};}function patchUpdates(_0x409d7a){return function(_0x55a83c){try{jsonpatch[_0x9180('0x1e')](_0x55a83c,_0x409d7a,!![]);}catch(_0x10011e){return BPromise[_0x9180('0x1f')](_0x10011e);}return _0x55a83c[_0x9180('0x20')]();};}function saveUpdates(_0x3ba5a5,_0x16f835){return function(_0xf097cb){if(_0xf097cb){return _0xf097cb[_0x9180('0x21')](_0x3ba5a5)[_0x9180('0x22')](function(_0x2ddbb8){return _0x2ddbb8;});}return null;};}function removeEntity(_0x1dd571,_0x1a104a){return function(_0x2f3fbb){if(_0x2f3fbb){return _0x2f3fbb[_0x9180('0x23')]()['then'](function(){var _0x17cc2a=_0x2f3fbb[_0x9180('0x24')]({'plain':!![]});var _0x254764=_0x9180('0x25');return db['UserProfileResource'][_0x9180('0x23')]({'where':{'type':_0x254764,'resourceId':_0x17cc2a['id']}})[_0x9180('0x22')](function(){return _0x2f3fbb;});})[_0x9180('0x22')](function(){_0x1dd571['status'](0xcc)[_0x9180('0x26')]();});}};}function handleEntityNotFound(_0x211c8c,_0x198647){return function(_0x368237){if(!_0x368237){_0x211c8c[_0x9180('0x16')](0x194);}return _0x368237;};}function handleError(_0x3f20c3,_0x59c6fe){_0x59c6fe=_0x59c6fe||0x1f4;return function(_0x3b7036){logger[_0x9180('0x27')](_0x3b7036[_0x9180('0x28')]);if(_0x3b7036['name']){delete _0x3b7036[_0x9180('0x29')];}_0x3f20c3[_0x9180('0x17')](_0x59c6fe)['send'](_0x3b7036);};}exports[_0x9180('0x2a')]=function(_0x3d88fa,_0x193ee8){var _0x4c7458={},_0x3d151c={},_0x4c0e88={'count':0x0,'rows':[]};var _0x22b02c=_[_0x9180('0x2b')](db[_0x9180('0x2c')][_0x9180('0x2d')],function(_0x554a77){return{'name':_0x554a77['fieldName'],'type':_0x554a77[_0x9180('0x2e')][_0x9180('0x2f')]};});_0x3d151c['model']=_[_0x9180('0x2b')](_0x22b02c,_0x9180('0x29'));_0x3d151c[_0x9180('0x30')]=_[_0x9180('0x31')](_0x3d88fa[_0x9180('0x30')]);_0x3d151c[_0x9180('0x32')]=_[_0x9180('0x33')](_0x3d151c['model'],_0x3d151c[_0x9180('0x30')]);_0x4c7458['attributes']=_[_0x9180('0x33')](_0x3d151c[_0x9180('0x34')],qs['fields'](_0x3d88fa['query']['fields']));_0x4c7458[_0x9180('0x35')]=_0x4c7458[_0x9180('0x35')][_0x9180('0x36')]?_0x4c7458[_0x9180('0x35')]:_0x3d151c['model'];if(!_0x3d88fa[_0x9180('0x30')][_0x9180('0x37')](_0x9180('0x38'))){_0x4c7458[_0x9180('0x1b')]=qs[_0x9180('0x1b')](_0x3d88fa[_0x9180('0x30')][_0x9180('0x1b')]);_0x4c7458['offset']=qs[_0x9180('0x19')](_0x3d88fa[_0x9180('0x30')]['offset']);}_0x4c7458['order']=qs[_0x9180('0x39')](_0x3d88fa[_0x9180('0x30')]['sort']);_0x4c7458[_0x9180('0x3a')]=qs[_0x9180('0x32')](_[_0x9180('0x3b')](_0x3d88fa[_0x9180('0x30')],_0x3d151c[_0x9180('0x32')]),_0x22b02c);if(_0x3d88fa[_0x9180('0x30')]['filter']){_0x4c7458['where']=_['merge'](_0x4c7458[_0x9180('0x3a')],{'$or':_[_0x9180('0x2b')](_0x22b02c,function(_0x1e62dc){if(_0x1e62dc[_0x9180('0x2e')]!==_0x9180('0x3c')){var _0x18ef65={};_0x18ef65[_0x1e62dc['name']]={'$like':'%'+_0x3d88fa[_0x9180('0x30')][_0x9180('0x3d')]+'%'};return _0x18ef65;}})});}_0x4c7458=_[_0x9180('0x3e')]({},_0x4c7458,_0x3d88fa['options']);var _0x43d95e={'where':_0x4c7458[_0x9180('0x3a')]};return db[_0x9180('0x2c')]['count'](_0x43d95e)[_0x9180('0x22')](function(_0x52e8c9){_0x4c0e88[_0x9180('0x1c')]=_0x52e8c9;if(_0x3d88fa[_0x9180('0x30')][_0x9180('0x3f')]){_0x4c7458[_0x9180('0x40')]=[{'all':!![]}];}return db[_0x9180('0x2c')][_0x9180('0x41')](_0x4c7458);})[_0x9180('0x22')](function(_0x2fdbf8){_0x4c0e88[_0x9180('0x42')]=_0x2fdbf8;return _0x4c0e88;})[_0x9180('0x22')](respondWithFilteredResult(_0x193ee8,_0x4c7458))[_0x9180('0x43')](handleError(_0x193ee8,null));};exports[_0x9180('0x44')]=function(_0x3b8d3a,_0x1cb6b6){var _0x380c8d={'raw':!![],'where':{'id':_0x3b8d3a[_0x9180('0x45')]['id']}},_0x414ed3={};_0x414ed3[_0x9180('0x34')]=_[_0x9180('0x31')](db[_0x9180('0x2c')][_0x9180('0x2d')]);_0x414ed3[_0x9180('0x30')]=_[_0x9180('0x31')](_0x3b8d3a['query']);_0x414ed3[_0x9180('0x32')]=_[_0x9180('0x33')](_0x414ed3[_0x9180('0x34')],_0x414ed3[_0x9180('0x30')]);_0x380c8d['attributes']=_[_0x9180('0x33')](_0x414ed3[_0x9180('0x34')],qs[_0x9180('0x46')](_0x3b8d3a[_0x9180('0x30')][_0x9180('0x46')]));_0x380c8d[_0x9180('0x35')]=_0x380c8d['attributes'][_0x9180('0x36')]?_0x380c8d['attributes']:_0x414ed3['model'];if(_0x3b8d3a[_0x9180('0x30')]['includeAll']){_0x380c8d[_0x9180('0x40')]=[{'all':!![]}];}_0x380c8d=_[_0x9180('0x3e')]({},_0x380c8d,_0x3b8d3a['options']);return db['CmContactHasItem'][_0x9180('0x47')](_0x380c8d)[_0x9180('0x22')](handleEntityNotFound(_0x1cb6b6,null))[_0x9180('0x22')](respondWithResult(_0x1cb6b6,null))[_0x9180('0x43')](handleError(_0x1cb6b6,null));};exports['create']=function(_0x20a119,_0x1cd73c){return db[_0x9180('0x2c')][_0x9180('0x48')](_0x20a119[_0x9180('0x49')],{})[_0x9180('0x22')](function(_0x51f149){var _0x1aaa25=_0x20a119[_0x9180('0x4a')][_0x9180('0x24')]({'plain':!![]});if(!_0x1aaa25)throw new Error(_0x9180('0x4b'));if(_0x1aaa25[_0x9180('0x4c')]===_0x9180('0x4a')){var _0xc68b56=_0x51f149[_0x9180('0x24')]({'plain':!![]});var _0x181793='CmContactHasItems';return db[_0x9180('0x4d')][_0x9180('0x47')]({'where':{'name':_0x181793,'userProfileId':_0x1aaa25[_0x9180('0x4e')]},'raw':!![]})['then'](function(_0xa07ee1){if(_0xa07ee1&&_0xa07ee1[_0x9180('0x4f')]===0x0){return db[_0x9180('0x50')]['create']({'name':_0xc68b56[_0x9180('0x29')],'resourceId':_0xc68b56['id'],'type':_0xa07ee1[_0x9180('0x29')],'sectionId':_0xa07ee1['id']},{})[_0x9180('0x22')](function(){return _0x51f149;});}else{return _0x51f149;}})[_0x9180('0x43')](function(_0x3209a0){logger[_0x9180('0x27')](_0x9180('0x51'),_0x3209a0);throw _0x3209a0;});}return _0x51f149;})[_0x9180('0x22')](respondWithResult(_0x1cd73c,0xc9))['catch'](handleError(_0x1cd73c,null));};exports[_0x9180('0x21')]=function(_0x376b28,_0x7abf20){if(_0x376b28[_0x9180('0x49')]['id']){delete _0x376b28[_0x9180('0x49')]['id'];}return db[_0x9180('0x2c')][_0x9180('0x47')]({'where':{'id':_0x376b28[_0x9180('0x45')]['id']}})[_0x9180('0x22')](handleEntityNotFound(_0x7abf20,null))[_0x9180('0x22')](saveUpdates(_0x376b28[_0x9180('0x49')],null))['then'](respondWithResult(_0x7abf20,null))['catch'](handleError(_0x7abf20,null));};exports['destroy']=function(_0x262600,_0x2f0f2f){return db[_0x9180('0x2c')][_0x9180('0x47')]({'where':{'id':_0x262600[_0x9180('0x45')]['id']}})[_0x9180('0x22')](handleEntityNotFound(_0x2f0f2f,null))[_0x9180('0x22')](removeEntity(_0x2f0f2f,null))['catch'](handleError(_0x2f0f2f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 893a596..e5e0011 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 _0x0f2b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes','exports','cm_contact_has_items','lodash','util'];(function(_0x175f1b,_0x1a7de0){var _0x2da79a=function(_0x9a0ed7){while(--_0x9a0ed7){_0x175f1b['push'](_0x175f1b['shift']());}};_0x2da79a(++_0x1a7de0);}(_0x0f2b,0x127));var _0xb0f2=function(_0x595ab7,_0x3a7304){_0x595ab7=_0x595ab7-0x0;var _0x1b564c=_0x0f2b[_0x595ab7];return _0x1b564c;};'use strict';var _=require(_0xb0f2('0x0'));var util=require(_0xb0f2('0x1'));var logger=require(_0xb0f2('0x2'))(_0xb0f2('0x3'));var moment=require(_0xb0f2('0x4'));var BPromise=require(_0xb0f2('0x5'));var rp=require(_0xb0f2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xb0f2('0x8'));module[_0xb0f2('0x9')]=function(_0x3b083c,_0x7f73f2){return _0x3b083c['define']('CmContactHasItem',attributes,{'tableName':_0xb0f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a21=['bluebird','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','util','../../config/logger','moment'];(function(_0x5d23f0,_0x530496){var _0x83949=function(_0x347bab){while(--_0x347bab){_0x5d23f0['push'](_0x5d23f0['shift']());}};_0x83949(++_0x530496);}(_0x4a21,0xb1));var _0x14a2=function(_0x12a62c,_0xc9c41a){_0x12a62c=_0x12a62c-0x0;var _0x268a58=_0x4a21[_0x12a62c];return _0x268a58;};'use strict';var _=require('lodash');var util=require(_0x14a2('0x0'));var logger=require(_0x14a2('0x1'))('api');var moment=require(_0x14a2('0x2'));var BPromise=require(_0x14a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14a2('0x4'));var config=require(_0x14a2('0x5'));var attributes=require(_0x14a2('0x6'));module[_0x14a2('0x7')]=function(_0x35f388,_0x5682c4){return _0x35f388[_0x14a2('0x8')](_0x14a2('0x9'),attributes,{'tableName':'cm_contact_has_items','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 b934fd7..0a1c813 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 _0x0a1e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','bluebird','ioredis'];(function(_0x59a8a1,_0x5122fc){var _0x1dec66=function(_0x31b3dd){while(--_0x31b3dd){_0x59a8a1['push'](_0x59a8a1['shift']());}};_0x1dec66(++_0x5122fc);}(_0x0a1e,0x1a0));var _0xe0a1=function(_0x2a8f81,_0x156b6c){_0x2a8f81=_0x2a8f81-0x0;var _0x2ec2f0=_0x0a1e[_0x2a8f81];return _0x2ec2f0;};'use strict';var _=require(_0xe0a1('0x0'));var util=require(_0xe0a1('0x1'));var moment=require('moment');var BPromise=require(_0xe0a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0a1('0x3'));var db=require(_0xe0a1('0x4'))['db'];var utils=require(_0xe0a1('0x5'));var logger=require(_0xe0a1('0x6'))(_0xe0a1('0x7'));var config=require(_0xe0a1('0x8'));var jayson=require(_0xe0a1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x509f73,_0x4395d6,_0x460577){return new BPromise(function(_0x4c77b9,_0x4a207b){return client[_0xe0a1('0xa')](_0x509f73,_0x460577)['then'](function(_0x14015b){logger[_0xe0a1('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4395d6,_0xe0a1('0xc'));logger[_0xe0a1('0xd')](_0xe0a1('0xe'),_0x4395d6,_0xe0a1('0xc'),JSON[_0xe0a1('0xf')](_0x14015b));if(_0x14015b['error']){if(_0x14015b[_0xe0a1('0x10')][_0xe0a1('0x11')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4395d6,_0x14015b[_0xe0a1('0x10')][_0xe0a1('0x12')]);return _0x4a207b(_0x14015b[_0xe0a1('0x10')][_0xe0a1('0x12')]);}logger['error'](_0xe0a1('0x13'),_0x4395d6,_0x14015b[_0xe0a1('0x10')][_0xe0a1('0x12')]);return _0x4c77b9(_0x14015b['error'][_0xe0a1('0x12')]);}else{logger[_0xe0a1('0xb')](_0xe0a1('0x13'),_0x4395d6,_0xe0a1('0xc'));_0x4c77b9(_0x14015b['result'][_0xe0a1('0x12')]);}})[_0xe0a1('0x14')](function(_0x4d130b){logger['error'](_0xe0a1('0x13'),_0x4395d6,_0x4d130b);_0x4a207b(_0x4d130b);});});} \ No newline at end of file +var _0x884b=['rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1360c0,_0x50da6d){var _0x2777af=function(_0x554de2){while(--_0x554de2){_0x1360c0['push'](_0x1360c0['shift']());}};_0x2777af(++_0x50da6d);}(_0x884b,0x6d));var _0xb884=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x884b[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0xb884('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb884('0x1'));var fs=require('fs');var Redis=require(_0xb884('0x2'));var db=require(_0xb884('0x3'))['db'];var utils=require(_0xb884('0x4'));var logger=require(_0xb884('0x5'))(_0xb884('0x6'));var config=require(_0xb884('0x7'));var jayson=require(_0xb884('0x8'));var client=jayson[_0xb884('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4560bc,_0x30ff49,_0x5a9ce9){return new BPromise(function(_0x4fe655,_0x26cdf0){return client[_0xb884('0xa')](_0x4560bc,_0x5a9ce9)[_0xb884('0xb')](function(_0x4bbe94){logger[_0xb884('0xc')](_0xb884('0xd'),_0x30ff49,_0xb884('0xe'));logger[_0xb884('0xf')](_0xb884('0x10'),_0x30ff49,_0xb884('0xe'),JSON[_0xb884('0x11')](_0x4bbe94));if(_0x4bbe94[_0xb884('0x12')]){if(_0x4bbe94[_0xb884('0x12')][_0xb884('0x13')]===0x1f4){logger['error'](_0xb884('0xd'),_0x30ff49,_0x4bbe94[_0xb884('0x12')][_0xb884('0x14')]);return _0x26cdf0(_0x4bbe94[_0xb884('0x12')][_0xb884('0x14')]);}logger['error'](_0xb884('0xd'),_0x30ff49,_0x4bbe94[_0xb884('0x12')][_0xb884('0x14')]);return _0x4fe655(_0x4bbe94[_0xb884('0x12')][_0xb884('0x14')]);}else{logger[_0xb884('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x30ff49,_0xb884('0xe'));_0x4fe655(_0x4bbe94[_0xb884('0x15')][_0xb884('0x14')]);}})[_0xb884('0x16')](function(_0x599d62){logger[_0xb884('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x30ff49,_0x599d62);_0x26cdf0(_0x599d62);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1184041..659b866 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 _0x5fb4=['index','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x5fb4,0x183));var _0x45fb=function(_0x3f040d,_0x560d9e){_0x3f040d=_0x3f040d-0x0;var _0x3bfc4d=_0x5fb4[_0x3f040d];return _0x3bfc4d;};'use strict';var multer=require(_0x45fb('0x0'));var util=require(_0x45fb('0x1'));var path=require(_0x45fb('0x2'));var timeout=require(_0x45fb('0x3'));var express=require(_0x45fb('0x4'));var router=express[_0x45fb('0x5')]();var fs_extra=require(_0x45fb('0x6'));var auth=require(_0x45fb('0x7'));var interaction=require(_0x45fb('0x8'));var config=require(_0x45fb('0x9'));var controller=require('./cmContactHasItem.controller');router[_0x45fb('0xa')]('/',auth[_0x45fb('0xb')](),controller[_0x45fb('0xc')]);router[_0x45fb('0xa')](_0x45fb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x45fb('0xe')]('/',auth[_0x45fb('0xb')](),controller[_0x45fb('0xf')]);router['put'](_0x45fb('0xd'),auth[_0x45fb('0xb')](),controller[_0x45fb('0x10')]);router[_0x45fb('0x11')](_0x45fb('0xd'),auth[_0x45fb('0xb')](),controller[_0x45fb('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb612=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x944296,_0x32e292){var _0x241578=function(_0x187a5d){while(--_0x187a5d){_0x944296['push'](_0x944296['shift']());}};_0x241578(++_0x32e292);}(_0xb612,0x1a7));var _0x2b61=function(_0x15dba5,_0x5d2fbe){_0x15dba5=_0x15dba5-0x0;var _0x12e9f9=_0xb612[_0x15dba5];return _0x12e9f9;};'use strict';var multer=require('multer');var util=require(_0x2b61('0x0'));var path=require(_0x2b61('0x1'));var timeout=require(_0x2b61('0x2'));var express=require(_0x2b61('0x3'));var router=express[_0x2b61('0x4')]();var fs_extra=require(_0x2b61('0x5'));var auth=require(_0x2b61('0x6'));var interaction=require(_0x2b61('0x7'));var config=require(_0x2b61('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x2b61('0x9')]('/',auth['isAuthenticated'](),controller[_0x2b61('0xa')]);router[_0x2b61('0x9')](_0x2b61('0xb'),auth[_0x2b61('0xc')](),controller[_0x2b61('0xd')]);router[_0x2b61('0xe')]('/',auth['isAuthenticated'](),controller[_0x2b61('0xf')]);router[_0x2b61('0x10')](_0x2b61('0xb'),auth[_0x2b61('0xc')](),controller[_0x2b61('0x11')]);router[_0x2b61('0x12')]('/:id',auth[_0x2b61('0xc')](),controller['destroy']);module[_0x2b61('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 302b2f3..4b55e53 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 _0x7de5=['parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x7de5,0x1a4));var _0x57de=function(_0x5f073a,_0xc5ac31){_0x5f073a=_0x5f073a-0x0;var _0x3c70a9=_0x7de5[_0x5f073a];return _0x3c70a9;};'use strict';var Sequelize=require(_0x57de('0x0'));var _=require(_0x57de('0x1'));module[_0x57de('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x553f02){return this[_0x57de('0x3')](_0x57de('0x4'));}},'alias':{'type':Sequelize[_0x57de('0x5')],'allowNull':![],'set':function(_0x2213f4){this[_0x57de('0x6')](_0x57de('0x4'),_0x2213f4?_0x2213f4:this['getDataValue'](_0x57de('0x7')));}},'type':{'type':Sequelize[_0x57de('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x57de('0x8')](_0x57de('0x9')),'get':function(){if(this[_0x57de('0x3')](_0x57de('0xa'))===_0x57de('0xb')){return JSON[_0x57de('0xc')](this[_0x57de('0x3')](_0x57de('0xd')));}else{return this[_0x57de('0x3')]('values');}},'set':function(_0x4a5675){if(Array[_0x57de('0xe')](_0x4a5675)){this[_0x57de('0x6')](_0x57de('0xd'),JSON[_0x57de('0xf')](_0x4a5675));}else{this[_0x57de('0x6')](_0x57de('0xd'),_0x4a5675);}}},'required':{'type':Sequelize[_0x57de('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x57de('0x11')]('voice')}}; \ No newline at end of file +var _0x2a8a=['parse','values','BOOLEAN','voice','sequelize','lodash','getDataValue','alias','STRING','setDataValue'];(function(_0x57cdb5,_0x388ce0){var _0x20cc66=function(_0x91a784){while(--_0x91a784){_0x57cdb5['push'](_0x57cdb5['shift']());}};_0x20cc66(++_0x388ce0);}(_0x2a8a,0xcc));var _0xa2a8=function(_0x221c49,_0x35d450){_0x221c49=_0x221c49-0x0;var _0x5bc0bb=_0x2a8a[_0x221c49];return _0x5bc0bb;};'use strict';var Sequelize=require(_0xa2a8('0x0'));var _=require(_0xa2a8('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x24002a){return this[_0xa2a8('0x2')](_0xa2a8('0x3'));}},'alias':{'type':Sequelize[_0xa2a8('0x4')],'allowNull':![],'set':function(_0x1b0081){this[_0xa2a8('0x5')](_0xa2a8('0x3'),_0x1b0081?_0x1b0081:this[_0xa2a8('0x2')]('name'));}},'type':{'type':Sequelize[_0xa2a8('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xa2a8('0x2')]('type')==='select'){return JSON[_0xa2a8('0x6')](this['getDataValue'](_0xa2a8('0x7')));}else{return this['getDataValue'](_0xa2a8('0x7'));}},'set':function(_0x2e23de){if(Array['isArray'](_0x2e23de)){this[_0xa2a8('0x5')](_0xa2a8('0x7'),JSON['stringify'](_0x2e23de));}else{this[_0xa2a8('0x5')](_0xa2a8('0x7'),_0x2e23de);}}},'required':{'type':Sequelize[_0xa2a8('0x8')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xa2a8('0x9'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5dfae9e..0485dba 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 _0x085f=['differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','update','body','catch','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','key','model'];(function(_0x1b1b70,_0x468ec0){var _0x1e7686=function(_0x409a74){while(--_0x409a74){_0x1b1b70['push'](_0x1b1b70['shift']());}};_0x1e7686(++_0x468ec0);}(_0x085f,0x83));var _0xf085=function(_0x55bbfa,_0x3c2514){_0x55bbfa=_0x55bbfa-0x0;var _0x4ac956=_0x085f[_0x55bbfa];return _0x4ac956;};'use strict';var emlformat=require(_0xf085('0x0'));var rimraf=require(_0xf085('0x1'));var zipdir=require(_0xf085('0x2'));var jsonpatch=require(_0xf085('0x3'));var rp=require('request-promise');var moment=require(_0xf085('0x4'));var BPromise=require(_0xf085('0x5'));var Mustache=require(_0xf085('0x6'));var util=require(_0xf085('0x7'));var path=require(_0xf085('0x8'));var sox=require('sox');var csv=require(_0xf085('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf085('0xa'));var _=require(_0xf085('0xb'));var squel=require(_0xf085('0xc'));var crypto=require('crypto');var jsforce=require(_0xf085('0xd'));var deskjs=require(_0xf085('0xe'));var toCsv=require(_0xf085('0x9'));var querystring=require(_0xf085('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf085('0x10'));var qs=require(_0xf085('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf085('0x12'));var logger=require(_0xf085('0x13'))('api');var utils=require(_0xf085('0x14'));var config=require(_0xf085('0x15'));var licenseUtil=require(_0xf085('0x16'));var db=require(_0xf085('0x17'))['db'];function respondWithStatusCode(_0x50b99a,_0x9c6902){_0x9c6902=_0x9c6902||0xcc;return function(_0x4ded3e){if(_0x4ded3e){return _0x50b99a[_0xf085('0x18')](_0x9c6902);}return _0x50b99a[_0xf085('0x19')](_0x9c6902)[_0xf085('0x1a')]();};}function respondWithResult(_0x36470d,_0x1ca916){_0x1ca916=_0x1ca916||0xc8;return function(_0x531b93){if(_0x531b93){return _0x36470d['status'](_0x1ca916)[_0xf085('0x1b')](_0x531b93);}};}function respondWithFilteredResult(_0x576352,_0x3f0c6f){return function(_0x10c4dd){if(_0x10c4dd){var _0x1a30fc=typeof _0x3f0c6f[_0xf085('0x1c')]===_0xf085('0x1d')&&typeof _0x3f0c6f[_0xf085('0x1e')]===_0xf085('0x1d');var _0x5dc06d=_0x10c4dd[_0xf085('0x1f')];var _0x5b94d6=_0x1a30fc?0x0:_0x3f0c6f['offset'];var _0x33c955=_0x1a30fc?_0x10c4dd[_0xf085('0x1f')]:_0x3f0c6f[_0xf085('0x1c')]+_0x3f0c6f['limit'];var _0x458184;if(_0x33c955>=_0x5dc06d){_0x33c955=_0x5dc06d;_0x458184=0xc8;}else{_0x458184=0xce;}_0x576352['status'](_0x458184);return _0x576352[_0xf085('0x20')](_0xf085('0x21'),_0x5b94d6+'-'+_0x33c955+'/'+_0x5dc06d)[_0xf085('0x1b')](_0x10c4dd);}return null;};}function patchUpdates(_0xa95a75){return function(_0x4675da){try{jsonpatch[_0xf085('0x22')](_0x4675da,_0xa95a75,!![]);}catch(_0x2f38bb){return BPromise[_0xf085('0x23')](_0x2f38bb);}return _0x4675da[_0xf085('0x24')]();};}function saveUpdates(_0x3b75cf,_0x153aef){return function(_0x5243a7){if(_0x5243a7){return _0x5243a7['update'](_0x3b75cf)['then'](function(_0x2f2dfe){return _0x2f2dfe;});}return null;};}function removeEntity(_0x54849f,_0x5e2e1b){return function(_0x108194){if(_0x108194){return _0x108194[_0xf085('0x25')]()[_0xf085('0x26')](function(){_0x54849f[_0xf085('0x19')](0xcc)[_0xf085('0x1a')]();});}};}function handleEntityNotFound(_0xfd9c41,_0x1536ed){return function(_0x1342e9){if(!_0x1342e9){_0xfd9c41[_0xf085('0x18')](0x194);}return _0x1342e9;};}function handleError(_0x3d3604,_0x582460){_0x582460=_0x582460||0x1f4;return function(_0x396582){logger[_0xf085('0x27')](_0x396582[_0xf085('0x28')]);if(_0x396582[_0xf085('0x29')]){delete _0x396582[_0xf085('0x29')];}_0x3d3604[_0xf085('0x19')](_0x582460)[_0xf085('0x2a')](_0x396582);};}exports['index']=function(_0x1542aa,_0xecdf54){var _0x2d5582={},_0x349b6a={},_0x2480c7={'count':0x0,'rows':[]};var _0x469282=_[_0xf085('0x2b')](db[_0xf085('0x2c')][_0xf085('0x2d')],function(_0x3d182c){return{'name':_0x3d182c[_0xf085('0x2e')],'type':_0x3d182c['type'][_0xf085('0x2f')]};});_0x349b6a[_0xf085('0x30')]=_[_0xf085('0x31')](_[_0xf085('0x2b')](_0x469282,_0xf085('0x29')),['name']);_0x349b6a[_0xf085('0x32')]=_[_0xf085('0x33')](_0x1542aa['query']);_0x349b6a['filters']=_[_0xf085('0x34')](_0x349b6a[_0xf085('0x30')],_0x349b6a[_0xf085('0x32')]);_0x2d5582[_0xf085('0x35')]=_['intersection'](_0x349b6a['model'],qs['fields'](_0x1542aa['query'][_0xf085('0x36')]));_0x2d5582[_0xf085('0x35')]=_0x2d5582['attributes'][_0xf085('0x37')]?_0x2d5582['attributes']:_0x349b6a['model'];if(!_0x1542aa['query'][_0xf085('0x38')](_0xf085('0x39'))){_0x2d5582[_0xf085('0x1e')]=qs[_0xf085('0x1e')](_0x1542aa[_0xf085('0x32')][_0xf085('0x1e')]);_0x2d5582[_0xf085('0x1c')]=qs[_0xf085('0x1c')](_0x1542aa[_0xf085('0x32')][_0xf085('0x1c')]);}_0x2d5582[_0xf085('0x3a')]=qs['sort'](_0x1542aa['query'][_0xf085('0x3b')]);_0x2d5582['where']=qs['filters'](_[_0xf085('0x3c')](_0x1542aa[_0xf085('0x32')],_0x349b6a[_0xf085('0x3d')]),_0x469282);if(_0x1542aa[_0xf085('0x32')][_0xf085('0x3e')]){_0x2d5582[_0xf085('0x3f')]=_[_0xf085('0x40')](_0x2d5582['where'],{'$or':_[_0xf085('0x2b')](_0x469282,function(_0x3d6074){if(_0x3d6074[_0xf085('0x41')]!==_0xf085('0x42')){var _0x560c46={};_0x560c46[_0x3d6074[_0xf085('0x29')]]={'$like':'%'+_0x1542aa[_0xf085('0x32')][_0xf085('0x3e')]+'%'};return _0x560c46;}})});}_0x2d5582=_['merge']({},_0x2d5582,_0x1542aa[_0xf085('0x43')]);var _0x57da7a={'where':_0x2d5582[_0xf085('0x3f')]};return db[_0xf085('0x2c')][_0xf085('0x1f')](_0x57da7a)[_0xf085('0x26')](function(_0x548866){_0x2480c7[_0xf085('0x1f')]=_0x548866;if(_0x1542aa[_0xf085('0x32')][_0xf085('0x44')]){_0x2d5582[_0xf085('0x45')]=[{'all':!![]}];}return db[_0xf085('0x2c')][_0xf085('0x46')](_0x2d5582);})[_0xf085('0x26')](function(_0x20cfdb){_0x2480c7['rows']=_0x20cfdb;return _0x2480c7;})[_0xf085('0x26')](respondWithFilteredResult(_0xecdf54,_0x2d5582))['catch'](handleError(_0xecdf54,null));};exports[_0xf085('0x47')]=function(_0x21dd08,_0x41ab1a){var _0x1d4a36={'raw':!![],'where':{'id':_0x21dd08[_0xf085('0x48')]['id']}},_0x5adfdf={};_0x5adfdf[_0xf085('0x30')]=_[_0xf085('0x33')](db['CmCustomField'][_0xf085('0x2d')]);_0x5adfdf['query']=_['keys'](_0x21dd08[_0xf085('0x32')]);_0x5adfdf['filters']=_[_0xf085('0x34')](_0x5adfdf[_0xf085('0x30')],_0x5adfdf['query']);_0x1d4a36[_0xf085('0x35')]=_[_0xf085('0x34')](_0x5adfdf[_0xf085('0x30')],qs[_0xf085('0x36')](_0x21dd08[_0xf085('0x32')][_0xf085('0x36')]));_0x1d4a36[_0xf085('0x35')]=_0x1d4a36['attributes'][_0xf085('0x37')]?_0x1d4a36[_0xf085('0x35')]:_0x5adfdf[_0xf085('0x30')];if(_0x21dd08[_0xf085('0x32')]['includeAll']){_0x1d4a36[_0xf085('0x45')]=[{'all':!![]}];}_0x1d4a36=_[_0xf085('0x40')]({},_0x1d4a36,_0x21dd08['options']);return db[_0xf085('0x2c')][_0xf085('0x49')](_0x1d4a36)[_0xf085('0x26')](handleEntityNotFound(_0x41ab1a,null))[_0xf085('0x26')](respondWithResult(_0x41ab1a,null))['catch'](handleError(_0x41ab1a,null));};exports[_0xf085('0x4a')]=function(_0x232e14,_0x3178c5){if(_0x232e14['body']['id']){delete _0x232e14[_0xf085('0x4b')]['id'];}return db['CmCustomField'][_0xf085('0x49')]({'where':{'id':_0x232e14['params']['id']}})[_0xf085('0x26')](handleEntityNotFound(_0x3178c5,null))[_0xf085('0x26')](saveUpdates(_0x232e14['body'],null))[_0xf085('0x26')](respondWithResult(_0x3178c5,null))[_0xf085('0x4c')](handleError(_0x3178c5,null));};exports[_0xf085('0x25')]=function(_0x153825,_0xeaa1c0){return db[_0xf085('0x2c')]['find']({'where':{'id':_0x153825[_0xf085('0x48')]['id']}})[_0xf085('0x26')](handleEntityNotFound(_0xeaa1c0,null))['then'](removeEntity(_0xeaa1c0,null))[_0xf085('0x4c')](handleError(_0xeaa1c0,null));};exports[_0xf085('0x4d')]=function(_0x5262ff,_0x4b0c9c){var _0x13d17f;return db['sequelize'][_0xf085('0x4e')](function(_0x104c93){return db[_0xf085('0x2c')][_0xf085('0x4d')](_0x5262ff[_0xf085('0x4b')],{'transaction':_0x104c93})['then'](function(_0x4b20e0){_0x13d17f=_0x4b20e0;var _0x47b00d={'type':db[_0xf085('0x4f')][_0xf085('0x50')],'transaction':_0x104c93};switch(_0x5262ff[_0xf085('0x4b')][_0xf085('0x41')]){case _0xf085('0x51'):_0x47b00d[_0xf085('0x41')]=db[_0xf085('0x4f')][_0xf085('0x50')];break;case _0xf085('0x52'):_0x47b00d[_0xf085('0x41')]=db[_0xf085('0x4f')][_0xf085('0x53')];break;case _0xf085('0x54'):_0x47b00d['type']=db['Sequelize']['BOOLEAN'];_0x47b00d[_0xf085('0x55')]=![];break;default:}return db[_0xf085('0x56')][_0xf085('0x57')][_0xf085('0x58')]('cm_contacts',util['format'](_0xf085('0x59'),_0x13d17f['id']),_0x47b00d);})['then'](function(){return _0x13d17f;});})['then'](respondWithResult(_0x4b0c9c,0xc9))['catch'](handleError(_0x4b0c9c,null));}; \ No newline at end of file +var _0x315e=['name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','body','find','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','sendStatus','error','stack'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x315e,0x1ed));var _0xe315=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x315e[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xe315('0x0'));var rimraf=require(_0xe315('0x1'));var zipdir=require(_0xe315('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe315('0x3'));var moment=require('moment');var BPromise=require(_0xe315('0x4'));var Mustache=require(_0xe315('0x5'));var util=require(_0xe315('0x6'));var path=require(_0xe315('0x7'));var sox=require(_0xe315('0x8'));var csv=require('to-csv');var ejs=require(_0xe315('0x9'));var fs=require('fs');var fs_extra=require(_0xe315('0xa'));var _=require(_0xe315('0xb'));var squel=require(_0xe315('0xc'));var crypto=require('crypto');var jsforce=require(_0xe315('0xd'));var deskjs=require(_0xe315('0xe'));var toCsv=require(_0xe315('0xf'));var querystring=require('querystring');var Papa=require(_0xe315('0x10'));var Redis=require(_0xe315('0x11'));var authService=require(_0xe315('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe315('0x13'));var hardwareService=require(_0xe315('0x14'));var logger=require(_0xe315('0x15'))(_0xe315('0x16'));var utils=require(_0xe315('0x17'));var config=require(_0xe315('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe315('0x19'))['db'];function respondWithStatusCode(_0x2af9e2,_0x57e6f5){_0x57e6f5=_0x57e6f5||0xcc;return function(_0x25bb5b){if(_0x25bb5b){return _0x2af9e2['sendStatus'](_0x57e6f5);}return _0x2af9e2[_0xe315('0x1a')](_0x57e6f5)[_0xe315('0x1b')]();};}function respondWithResult(_0xe871f6,_0x2736cb){_0x2736cb=_0x2736cb||0xc8;return function(_0x5f3c22){if(_0x5f3c22){return _0xe871f6[_0xe315('0x1a')](_0x2736cb)[_0xe315('0x1c')](_0x5f3c22);}};}function respondWithFilteredResult(_0x3e05cb,_0x50ab12){return function(_0x1e1ba3){if(_0x1e1ba3){var _0x164e57=typeof _0x50ab12[_0xe315('0x1d')]===_0xe315('0x1e')&&typeof _0x50ab12[_0xe315('0x1f')]===_0xe315('0x1e');var _0x764f1a=_0x1e1ba3[_0xe315('0x20')];var _0x1b9897=_0x164e57?0x0:_0x50ab12['offset'];var _0x447af1=_0x164e57?_0x1e1ba3['count']:_0x50ab12[_0xe315('0x1d')]+_0x50ab12[_0xe315('0x1f')];var _0x2c19ba;if(_0x447af1>=_0x764f1a){_0x447af1=_0x764f1a;_0x2c19ba=0xc8;}else{_0x2c19ba=0xce;}_0x3e05cb['status'](_0x2c19ba);return _0x3e05cb[_0xe315('0x21')]('Content-Range',_0x1b9897+'-'+_0x447af1+'/'+_0x764f1a)[_0xe315('0x1c')](_0x1e1ba3);}return null;};}function patchUpdates(_0xc3d703){return function(_0x1d1153){try{jsonpatch[_0xe315('0x22')](_0x1d1153,_0xc3d703,!![]);}catch(_0x34887b){return BPromise['reject'](_0x34887b);}return _0x1d1153['save']();};}function saveUpdates(_0x488a34,_0x198f81){return function(_0xcd824d){if(_0xcd824d){return _0xcd824d[_0xe315('0x23')](_0x488a34)[_0xe315('0x24')](function(_0x586f2e){return _0x586f2e;});}return null;};}function removeEntity(_0x592619,_0x140f6d){return function(_0x489eab){if(_0x489eab){return _0x489eab[_0xe315('0x25')]()[_0xe315('0x24')](function(){_0x592619['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x483f7b,_0x591cf5){return function(_0x634a5d){if(!_0x634a5d){_0x483f7b[_0xe315('0x26')](0x194);}return _0x634a5d;};}function handleError(_0x4576ca,_0x554269){_0x554269=_0x554269||0x1f4;return function(_0x438f4b){logger[_0xe315('0x27')](_0x438f4b[_0xe315('0x28')]);if(_0x438f4b[_0xe315('0x29')]){delete _0x438f4b[_0xe315('0x29')];}_0x4576ca[_0xe315('0x1a')](_0x554269)[_0xe315('0x2a')](_0x438f4b);};}exports['index']=function(_0x33fdec,_0x574c96){var _0x15ad9e={},_0x525a4f={},_0x3ae21a={'count':0x0,'rows':[]};var _0x323ba3=_[_0xe315('0x2b')](db[_0xe315('0x2c')][_0xe315('0x2d')],function(_0x2dfb3b){return{'name':_0x2dfb3b[_0xe315('0x2e')],'type':_0x2dfb3b[_0xe315('0x2f')][_0xe315('0x30')]};});_0x525a4f[_0xe315('0x31')]=_[_0xe315('0x32')](_[_0xe315('0x2b')](_0x323ba3,_0xe315('0x29')),[_0xe315('0x29')]);_0x525a4f[_0xe315('0x33')]=_[_0xe315('0x34')](_0x33fdec[_0xe315('0x33')]);_0x525a4f[_0xe315('0x35')]=_[_0xe315('0x36')](_0x525a4f['model'],_0x525a4f[_0xe315('0x33')]);_0x15ad9e[_0xe315('0x37')]=_['intersection'](_0x525a4f[_0xe315('0x31')],qs[_0xe315('0x38')](_0x33fdec[_0xe315('0x33')]['fields']));_0x15ad9e[_0xe315('0x37')]=_0x15ad9e[_0xe315('0x37')][_0xe315('0x39')]?_0x15ad9e[_0xe315('0x37')]:_0x525a4f[_0xe315('0x31')];if(!_0x33fdec['query'][_0xe315('0x3a')]('nolimit')){_0x15ad9e[_0xe315('0x1f')]=qs[_0xe315('0x1f')](_0x33fdec[_0xe315('0x33')][_0xe315('0x1f')]);_0x15ad9e[_0xe315('0x1d')]=qs[_0xe315('0x1d')](_0x33fdec[_0xe315('0x33')][_0xe315('0x1d')]);}_0x15ad9e['order']=qs[_0xe315('0x3b')](_0x33fdec[_0xe315('0x33')][_0xe315('0x3b')]);_0x15ad9e[_0xe315('0x3c')]=qs['filters'](_[_0xe315('0x3d')](_0x33fdec[_0xe315('0x33')],_0x525a4f['filters']),_0x323ba3);if(_0x33fdec['query'][_0xe315('0x3e')]){_0x15ad9e[_0xe315('0x3c')]=_[_0xe315('0x3f')](_0x15ad9e['where'],{'$or':_[_0xe315('0x2b')](_0x323ba3,function(_0x1f486c){if(_0x1f486c[_0xe315('0x2f')]!==_0xe315('0x40')){var _0x4dcb06={};_0x4dcb06[_0x1f486c[_0xe315('0x29')]]={'$like':'%'+_0x33fdec[_0xe315('0x33')]['filter']+'%'};return _0x4dcb06;}})});}_0x15ad9e=_[_0xe315('0x3f')]({},_0x15ad9e,_0x33fdec['options']);var _0x32c08a={'where':_0x15ad9e[_0xe315('0x3c')]};return db[_0xe315('0x2c')][_0xe315('0x20')](_0x32c08a)[_0xe315('0x24')](function(_0x3c592e){_0x3ae21a['count']=_0x3c592e;if(_0x33fdec[_0xe315('0x33')][_0xe315('0x41')]){_0x15ad9e[_0xe315('0x42')]=[{'all':!![]}];}return db[_0xe315('0x2c')][_0xe315('0x43')](_0x15ad9e);})[_0xe315('0x24')](function(_0x4ae6e3){_0x3ae21a[_0xe315('0x44')]=_0x4ae6e3;return _0x3ae21a;})['then'](respondWithFilteredResult(_0x574c96,_0x15ad9e))[_0xe315('0x45')](handleError(_0x574c96,null));};exports['show']=function(_0x3e12a1,_0x4e56ff){var _0x330270={'raw':!![],'where':{'id':_0x3e12a1[_0xe315('0x46')]['id']}},_0x4a5c2b={};_0x4a5c2b[_0xe315('0x31')]=_[_0xe315('0x34')](db[_0xe315('0x2c')]['rawAttributes']);_0x4a5c2b[_0xe315('0x33')]=_[_0xe315('0x34')](_0x3e12a1[_0xe315('0x33')]);_0x4a5c2b[_0xe315('0x35')]=_['intersection'](_0x4a5c2b['model'],_0x4a5c2b['query']);_0x330270[_0xe315('0x37')]=_[_0xe315('0x36')](_0x4a5c2b['model'],qs[_0xe315('0x38')](_0x3e12a1[_0xe315('0x33')][_0xe315('0x38')]));_0x330270[_0xe315('0x37')]=_0x330270[_0xe315('0x37')][_0xe315('0x39')]?_0x330270[_0xe315('0x37')]:_0x4a5c2b[_0xe315('0x31')];if(_0x3e12a1[_0xe315('0x33')][_0xe315('0x41')]){_0x330270['include']=[{'all':!![]}];}_0x330270=_['merge']({},_0x330270,_0x3e12a1[_0xe315('0x47')]);return db[_0xe315('0x2c')]['find'](_0x330270)[_0xe315('0x24')](handleEntityNotFound(_0x4e56ff,null))[_0xe315('0x24')](respondWithResult(_0x4e56ff,null))[_0xe315('0x45')](handleError(_0x4e56ff,null));};exports[_0xe315('0x23')]=function(_0x3f5d2f,_0x2fed3e){if(_0x3f5d2f[_0xe315('0x48')]['id']){delete _0x3f5d2f['body']['id'];}return db['CmCustomField'][_0xe315('0x49')]({'where':{'id':_0x3f5d2f[_0xe315('0x46')]['id']}})[_0xe315('0x24')](handleEntityNotFound(_0x2fed3e,null))[_0xe315('0x24')](saveUpdates(_0x3f5d2f['body'],null))[_0xe315('0x24')](respondWithResult(_0x2fed3e,null))[_0xe315('0x45')](handleError(_0x2fed3e,null));};exports[_0xe315('0x25')]=function(_0xd2f781,_0xe6992d){return db[_0xe315('0x2c')][_0xe315('0x49')]({'where':{'id':_0xd2f781[_0xe315('0x46')]['id']}})[_0xe315('0x24')](handleEntityNotFound(_0xe6992d,null))['then'](removeEntity(_0xe6992d,null))['catch'](handleError(_0xe6992d,null));};exports['create']=function(_0xcb5c55,_0x5271dd){var _0x2f3273;return db['sequelize'][_0xe315('0x4a')](function(_0x4c6dd0){return db[_0xe315('0x2c')][_0xe315('0x4b')](_0xcb5c55[_0xe315('0x48')],{'transaction':_0x4c6dd0})[_0xe315('0x24')](function(_0x5e8118){_0x2f3273=_0x5e8118;var _0x5058a3={'type':db[_0xe315('0x4c')][_0xe315('0x4d')],'transaction':_0x4c6dd0};switch(_0xcb5c55['body'][_0xe315('0x2f')]){case _0xe315('0x4e'):_0x5058a3[_0xe315('0x2f')]=db[_0xe315('0x4c')][_0xe315('0x4d')];break;case _0xe315('0x4f'):_0x5058a3['type']=db['Sequelize'][_0xe315('0x50')];break;case _0xe315('0x51'):_0x5058a3['type']=db['Sequelize'][_0xe315('0x52')];_0x5058a3[_0xe315('0x53')]=![];break;default:}return db[_0xe315('0x54')][_0xe315('0x55')][_0xe315('0x56')](_0xe315('0x57'),util[_0xe315('0x58')]('cf_%d',_0x2f3273['id']),_0x5058a3);})[_0xe315('0x24')](function(){return _0x2f3273;});})[_0xe315('0x24')](respondWithResult(_0x5271dd,0xc9))[_0xe315('0x45')](handleError(_0x5271dd,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f203310..b5f2186 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 _0x947a=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x947a,0xd7));var _0xa947=function(_0x3366c5,_0x597f9a){_0x3366c5=_0x3366c5-0x0;var _0x18500d=_0x947a[_0x3366c5];return _0x18500d;};'use strict';var _=require(_0xa947('0x0'));var util=require(_0xa947('0x1'));var logger=require(_0xa947('0x2'))(_0xa947('0x3'));var moment=require(_0xa947('0x4'));var BPromise=require(_0xa947('0x5'));var rp=require(_0xa947('0x6'));var fs=require('fs');var path=require(_0xa947('0x7'));var rimraf=require(_0xa947('0x8'));var config=require(_0xa947('0x9'));var attributes=require(_0xa947('0xa'));module[_0xa947('0xb')]=function(_0x539803,_0x3b4a23){return _0x539803['define'](_0xa947('0xc'),attributes,{'tableName':_0xa947('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ea6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util'];(function(_0x1cf96f,_0x22623f){var _0x3606db=function(_0x28af37){while(--_0x28af37){_0x1cf96f['push'](_0x1cf96f['shift']());}};_0x3606db(++_0x22623f);}(_0x9ea6,0x1a2));var _0x69ea=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9ea6[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x69ea('0x0'));var util=require(_0x69ea('0x1'));var logger=require('../../config/logger')(_0x69ea('0x2'));var moment=require(_0x69ea('0x3'));var BPromise=require(_0x69ea('0x4'));var rp=require(_0x69ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69ea('0x6'));var config=require(_0x69ea('0x7'));var attributes=require(_0x69ea('0x8'));module[_0x69ea('0x9')]=function(_0x32992f,_0x1ff0ca){return _0x32992f[_0x69ea('0xa')](_0x69ea('0xb'),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 53c05ef..f8d569e 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 _0x0aef=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xcfaa77,_0x495e9b){var _0x5f1566=function(_0x1fadec){while(--_0x1fadec){_0xcfaa77['push'](_0xcfaa77['shift']());}};_0x5f1566(++_0x495e9b);}(_0x0aef,0x154));var _0xf0ae=function(_0x52c43e,_0x5ca978){_0x52c43e=_0x52c43e-0x0;var _0x5016a5=_0x0aef[_0x52c43e];return _0x5016a5;};'use strict';var _=require('lodash');var util=require(_0xf0ae('0x0'));var moment=require('moment');var BPromise=require(_0xf0ae('0x1'));var rs=require(_0xf0ae('0x2'));var fs=require('fs');var Redis=require(_0xf0ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0ae('0x4'));var logger=require(_0xf0ae('0x5'))(_0xf0ae('0x6'));var config=require(_0xf0ae('0x7'));var jayson=require(_0xf0ae('0x8'));var client=jayson[_0xf0ae('0x9')][_0xf0ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5668ce,_0x24f82d,_0x356359){return new BPromise(function(_0x727d94,_0x1d4b20){return client[_0xf0ae('0xb')](_0x5668ce,_0x356359)[_0xf0ae('0xc')](function(_0x1f387a){logger['info'](_0xf0ae('0xd'),_0x24f82d,_0xf0ae('0xe'));logger[_0xf0ae('0xf')](_0xf0ae('0x10'),_0x24f82d,_0xf0ae('0xe'),JSON[_0xf0ae('0x11')](_0x1f387a));if(_0x1f387a[_0xf0ae('0x12')]){if(_0x1f387a[_0xf0ae('0x12')][_0xf0ae('0x13')]===0x1f4){logger[_0xf0ae('0x12')](_0xf0ae('0xd'),_0x24f82d,_0x1f387a[_0xf0ae('0x12')][_0xf0ae('0x14')]);return _0x1d4b20(_0x1f387a[_0xf0ae('0x12')]['message']);}logger[_0xf0ae('0x12')](_0xf0ae('0xd'),_0x24f82d,_0x1f387a[_0xf0ae('0x12')]['message']);return _0x727d94(_0x1f387a[_0xf0ae('0x12')]['message']);}else{logger['info'](_0xf0ae('0xd'),_0x24f82d,_0xf0ae('0xe'));_0x727d94(_0x1f387a[_0xf0ae('0x15')][_0xf0ae('0x14')]);}})[_0xf0ae('0x16')](function(_0x8ab533){logger['error'](_0xf0ae('0xd'),_0x24f82d,_0x8ab533);_0x1d4b20(_0x8ab533);});});} \ No newline at end of file +var _0xf5a8=['client','http','request','then','request\x20sent','debug','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x409d46,_0x1d6074){var _0x170a4f=function(_0x4b7628){while(--_0x4b7628){_0x409d46['push'](_0x409d46['shift']());}};_0x170a4f(++_0x1d6074);}(_0xf5a8,0x91));var _0x8f5a=function(_0x503287,_0x252ead){_0x503287=_0x503287-0x0;var _0x3709ef=_0xf5a8[_0x503287];return _0x3709ef;};'use strict';var _=require(_0x8f5a('0x0'));var util=require(_0x8f5a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f5a('0x2'));var fs=require('fs');var Redis=require(_0x8f5a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f5a('0x4'));var logger=require('../../config/logger')(_0x8f5a('0x5'));var config=require(_0x8f5a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8f5a('0x7')][_0x8f5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd52588,_0x259a24,_0x148f57){return new BPromise(function(_0x3cac47,_0x5a2863){return client[_0x8f5a('0x9')](_0xd52588,_0x148f57)[_0x8f5a('0xa')](function(_0x196ce2){logger['info']('CmCustomField,\x20%s,\x20%s',_0x259a24,_0x8f5a('0xb'));logger[_0x8f5a('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x259a24,_0x8f5a('0xb'),JSON[_0x8f5a('0xd')](_0x196ce2));if(_0x196ce2['error']){if(_0x196ce2[_0x8f5a('0xe')]['code']===0x1f4){logger['error'](_0x8f5a('0xf'),_0x259a24,_0x196ce2[_0x8f5a('0xe')][_0x8f5a('0x10')]);return _0x5a2863(_0x196ce2[_0x8f5a('0xe')]['message']);}logger[_0x8f5a('0xe')](_0x8f5a('0xf'),_0x259a24,_0x196ce2[_0x8f5a('0xe')][_0x8f5a('0x10')]);return _0x3cac47(_0x196ce2[_0x8f5a('0xe')][_0x8f5a('0x10')]);}else{logger[_0x8f5a('0x11')](_0x8f5a('0xf'),_0x259a24,_0x8f5a('0xb'));_0x3cac47(_0x196ce2[_0x8f5a('0x12')][_0x8f5a('0x10')]);}})['catch'](function(_0x5bdd35){logger['error'](_0x8f5a('0xf'),_0x259a24,_0x5bdd35);_0x5a2863(_0x5bdd35);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d118057..dd9f549 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 _0x23f4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','delete','destroy','util'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x23f4,0x1ee));var _0x423f=function(_0x774e5b,_0x41a1a5){_0x774e5b=_0x774e5b-0x0;var _0x53c386=_0x23f4[_0x774e5b];return _0x53c386;};'use strict';var multer=require('multer');var util=require(_0x423f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x423f('0x1'));var router=express[_0x423f('0x2')]();var fs_extra=require(_0x423f('0x3'));var auth=require(_0x423f('0x4'));var interaction=require(_0x423f('0x5'));var config=require(_0x423f('0x6'));var controller=require(_0x423f('0x7'));router[_0x423f('0x8')]('/',auth[_0x423f('0x9')](),controller['index']);router[_0x423f('0x8')](_0x423f('0xa'),auth['isAuthenticated'](),controller[_0x423f('0xb')]);router[_0x423f('0xc')]('/',auth[_0x423f('0x9')](),controller['create']);router['put']('/:id',auth[_0x423f('0x9')](),controller['update']);router[_0x423f('0xd')](_0x423f('0xa'),auth[_0x423f('0x9')](),controller[_0x423f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2171=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util'];(function(_0x15bcb4,_0x32e304){var _0x91e10a=function(_0x523931){while(--_0x523931){_0x15bcb4['push'](_0x15bcb4['shift']());}};_0x91e10a(++_0x32e304);}(_0x2171,0x143));var _0x1217=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x2171[_0x178f52];return _0x556f99;};'use strict';var multer=require('multer');var util=require(_0x1217('0x0'));var path=require(_0x1217('0x1'));var timeout=require(_0x1217('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1217('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1217('0x4'));var config=require(_0x1217('0x5'));var controller=require(_0x1217('0x6'));router[_0x1217('0x7')]('/',auth['isAuthenticated'](),controller[_0x1217('0x8')]);router[_0x1217('0x7')](_0x1217('0x9'),auth['isAuthenticated'](),controller[_0x1217('0xa')]);router[_0x1217('0xb')]('/',auth[_0x1217('0xc')](),controller[_0x1217('0xd')]);router[_0x1217('0xe')](_0x1217('0x9'),auth['isAuthenticated'](),controller[_0x1217('0xf')]);router['delete'](_0x1217('0x9'),auth[_0x1217('0xc')](),controller[_0x1217('0x10')]);module[_0x1217('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index d6fa4b4..61b0915 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 _0x5493=['BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x5493,0x13c));var _0x3549=function(_0x5c8efb,_0x41a155){_0x5c8efb=_0x5c8efb-0x0;var _0x3bb2b2=_0x5493[_0x5c8efb];return _0x3bb2b2;};'use strict';var moment=require(_0x3549('0x0'));var Sequelize=require(_0x3549('0x1'));module[_0x3549('0x2')]={'phone':{'type':Sequelize[_0x3549('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x3549('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x3549('0x5'))},'countbusyretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3549('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3549('0x7')]},'priority':{'type':Sequelize[_0x3549('0x6')](0x2)[_0x3549('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3549('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3549('0x6')],'unique':_0x3549('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3549('0x9')},'UserId':{'type':Sequelize[_0x3549('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x3549('0x6')],'unique':_0x3549('0x9')},'CampaignId':{'type':Sequelize[_0x3549('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3549('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3549('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3549('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x3549('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x10ac=['BOOLEAN','UNSIGNED','contactListQueue','STRING','sequelize','exports','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10ac,0xe0));var _0xc10a=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0x10ac[_0x3789b9];return _0x4d020d;};'use strict';var moment=require('moment');var Sequelize=require(_0xc10a('0x0'));module[_0xc10a('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc10a('0x2')],'defaultValue':moment()[_0xc10a('0x3')](_0xc10a('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc10a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc10a('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xc10a('0x5')](0x2)[_0xc10a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc10a('0x5')],'unique':_0xc10a('0x8')},'ListId':{'type':Sequelize[_0xc10a('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xc10a('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xc10a('0x5')],'unique':_0xc10a('0x8')},'CampaignId':{'type':Sequelize[_0xc10a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xc10a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc10a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc10a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc10a('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc10a('0x9')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc10a('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 e3311d6..ec2e377 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 _0xeec6=['isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','CmCompany','Company','List','Queue','getPreviewRecall','UPDATE','CmList','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','json','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialPreviewAutoRecallMe','value','direction','prev'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2316b9,_0x87059b){_0x2316b9=_0x2316b9-0x0;var _0x4405a9=_0xeec6[_0x2316b9];return _0x4405a9;};'use strict';var moment=require(_0x6eec('0x0'));var _=require(_0x6eec('0x1'));var qs=require(_0x6eec('0x2'));var logger=require(_0x6eec('0x3'))('api');var shared=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];function respondWithResult(_0x1699ce,_0x2d7a15){_0x2d7a15=_0x2d7a15||0xc8;return function(_0x3e7b6b){if(_0x3e7b6b){return _0x1699ce[_0x6eec('0x6')](_0x2d7a15)['json'](_0x3e7b6b);}};}function respondWithFilteredResult(_0x185f31,_0x3c6eda){return function(_0x48064a){if(_0x48064a){var _0x5a5e47=typeof _0x3c6eda[_0x6eec('0x7')]===_0x6eec('0x8')&&typeof _0x3c6eda[_0x6eec('0x9')]==='undefined';var _0x2be38f=_0x48064a[_0x6eec('0xa')];var _0x1c774d=_0x5a5e47?0x0:_0x3c6eda['offset'];var _0x595dd4=_0x5a5e47?_0x48064a['count']:_0x3c6eda[_0x6eec('0x7')]+_0x3c6eda[_0x6eec('0x9')];var _0x51a9e3;if(_0x595dd4>=_0x2be38f){_0x595dd4=_0x2be38f;_0x51a9e3=0xc8;}else{_0x51a9e3=0xce;}_0x185f31['status'](_0x51a9e3);return _0x185f31[_0x6eec('0xb')]('Content-Range',_0x1c774d+'-'+_0x595dd4+'/'+_0x2be38f)[_0x6eec('0xc')](_0x48064a);}return null;};}function saveUpdates(_0x3387c2,_0x162db1){return function(_0x3fe94b){if(_0x3fe94b){return _0x3fe94b[_0x6eec('0xd')](_0x3387c2)['then'](function(_0x25e2a5){return _0x25e2a5;});}return null;};}function handleEntityNotFound(_0x3b2972,_0x462dbb){return function(_0xc35914){if(!_0xc35914){_0x3b2972[_0x6eec('0xe')](0x194);}return _0xc35914;};}function handleError(_0x2b35d6,_0x345852){_0x345852=_0x345852||0x1f4;return function(_0x393271){logger[_0x6eec('0xf')](_0x393271[_0x6eec('0x10')]);if(_0x393271['name']){delete _0x393271[_0x6eec('0x11')];}_0x2b35d6['status'](_0x345852)[_0x6eec('0x12')](_0x393271);};}exports[_0x6eec('0x13')]=function(_0x512619,_0x3ee353){var _0x80736b={},_0xb1eab7={},_0x56c78b={'count':0x0,'rows':[]};var _0x87f3be=_[_0x6eec('0x14')](db[_0x6eec('0x15')][_0x6eec('0x16')],function(_0xd86135){return{'name':_0xd86135[_0x6eec('0x17')],'type':_0xd86135['type'][_0x6eec('0x18')]};});_0xb1eab7[_0x6eec('0x19')]=_[_0x6eec('0x14')](_0x87f3be,_0x6eec('0x11'));_0xb1eab7[_0x6eec('0x1a')]=_[_0x6eec('0x1b')](_0x512619['query']);_0xb1eab7[_0x6eec('0x1c')]=_[_0x6eec('0x1d')](_0xb1eab7[_0x6eec('0x19')],_0xb1eab7[_0x6eec('0x1a')]);_0xb1eab7[_0x6eec('0x1c')]=_[_0x6eec('0x1e')](_0xb1eab7['filters'],[_0x6eec('0x1f'),_0x6eec('0x20'),_0x6eec('0x21'),_0x6eec('0x22'),_0x6eec('0x23'),_0x6eec('0x24'),_0x6eec('0x25'),_0x6eec('0x26'),_0x6eec('0x27'),'$between',_0x6eec('0x28'),_0x6eec('0x29'),_0x6eec('0x2a'),_0x6eec('0x2b'),'$notLike',_0x6eec('0x2c'),_0x6eec('0x2d'),'$like','$overlap',_0x6eec('0x2e'),'$contained',_0x6eec('0x2f')]);_0x80736b[_0x6eec('0x30')]=_[_0x6eec('0x1d')](_0xb1eab7[_0x6eec('0x19')],qs[_0x6eec('0x31')](_0x512619[_0x6eec('0x1a')][_0x6eec('0x31')]));_0x80736b[_0x6eec('0x30')]=_0x80736b[_0x6eec('0x30')][_0x6eec('0x32')]?_0x80736b['attributes']:_0xb1eab7[_0x6eec('0x19')];if(!_0x512619['query'][_0x6eec('0x33')](_0x6eec('0x34'))){_0x80736b[_0x6eec('0x9')]=qs['limit'](_0x512619['query']['limit']);_0x80736b[_0x6eec('0x7')]=qs[_0x6eec('0x7')](_0x512619[_0x6eec('0x1a')][_0x6eec('0x7')]);}_0x80736b[_0x6eec('0x35')]=qs[_0x6eec('0x36')](_0x512619[_0x6eec('0x1a')][_0x6eec('0x36')]);_0x80736b[_0x6eec('0x37')]=qs[_0x6eec('0x1c')](_[_0x6eec('0x38')](_0x512619[_0x6eec('0x1a')],_0xb1eab7['filters']),_0x87f3be);if(_0x512619[_0x6eec('0x1a')][_0x6eec('0x39')]){_0x80736b[_0x6eec('0x37')]=_['merge'](_0x80736b[_0x6eec('0x37')],{'$or':_[_0x6eec('0x14')](_0x87f3be,function(_0xd857fa){if(_0xd857fa[_0x6eec('0x3a')]!==_0x6eec('0x3b')){var _0x34d3b1={};_0x34d3b1[_0xd857fa['name']]={'$like':'%'+_0x512619[_0x6eec('0x1a')][_0x6eec('0x39')]+'%'};return _0x34d3b1;}})});}_0x80736b=_[_0x6eec('0x3c')]({},_0x80736b,_0x512619['options']);var _0x53acd9={'where':_0x80736b[_0x6eec('0x37')]};return db[_0x6eec('0x15')][_0x6eec('0xa')](_0x53acd9)[_0x6eec('0x3d')](function(_0x402bac){_0x56c78b['count']=_0x402bac;if(_0x512619[_0x6eec('0x1a')][_0x6eec('0x3e')]){_0x80736b[_0x6eec('0x3f')]=[{'all':!![]}];}return db[_0x6eec('0x15')][_0x6eec('0x40')](_0x80736b);})[_0x6eec('0x3d')](function(_0x36cfe1){_0x56c78b[_0x6eec('0x41')]=_0x36cfe1;return _0x56c78b;})['then'](respondWithFilteredResult(_0x3ee353,_0x80736b))[_0x6eec('0x42')](handleError(_0x3ee353,null));};exports[_0x6eec('0x43')]=function(_0x4d30c9,_0x5b3283){var _0x160fc0={'raw':!![],'where':{'id':_0x4d30c9[_0x6eec('0x44')]['id']}},_0x66f786={};_0x66f786[_0x6eec('0x19')]=_['keys'](db['CmHopper'][_0x6eec('0x16')]);_0x66f786['query']=_['keys'](_0x4d30c9[_0x6eec('0x1a')]);_0x66f786[_0x6eec('0x1c')]=_[_0x6eec('0x1d')](_0x66f786[_0x6eec('0x19')],_0x66f786[_0x6eec('0x1a')]);_0x160fc0['attributes']=_[_0x6eec('0x1d')](_0x66f786[_0x6eec('0x19')],qs['fields'](_0x4d30c9[_0x6eec('0x1a')][_0x6eec('0x31')]));_0x160fc0['attributes']=_0x160fc0[_0x6eec('0x30')][_0x6eec('0x32')]?_0x160fc0['attributes']:_0x66f786[_0x6eec('0x19')];if(_0x4d30c9[_0x6eec('0x1a')][_0x6eec('0x3e')]){_0x160fc0[_0x6eec('0x3f')]=[{'all':!![]}];}_0x160fc0=_['merge']({},_0x160fc0,_0x4d30c9[_0x6eec('0x45')]);return db[_0x6eec('0x15')][_0x6eec('0x46')](_0x160fc0)[_0x6eec('0x3d')](handleEntityNotFound(_0x5b3283,null))[_0x6eec('0x3d')](respondWithResult(_0x5b3283,null))['catch'](handleError(_0x5b3283,null));};exports['create']=function(_0x1edb5f,_0x3d5c80){return db[_0x6eec('0x15')][_0x6eec('0x47')](_0x1edb5f[_0x6eec('0x48')],{})['then'](respondWithResult(_0x3d5c80,0xc9))[_0x6eec('0x42')](handleError(_0x3d5c80,null));};exports['update']=function(_0x20524a,_0x408295){if(_0x20524a[_0x6eec('0x48')]['id']){delete _0x20524a['body']['id'];}return db[_0x6eec('0x15')][_0x6eec('0x46')]({'where':{'id':_0x20524a[_0x6eec('0x44')]['id']}})[_0x6eec('0x3d')](handleEntityNotFound(_0x408295,null))[_0x6eec('0x3d')](saveUpdates(_0x20524a['body'],null))[_0x6eec('0x3d')](respondWithResult(_0x408295,null))['catch'](handleError(_0x408295,null));};exports['describe']=function(_0x2529ad,_0x535d96){return db[_0x6eec('0x15')][_0x6eec('0x49')]()[_0x6eec('0x3d')](respondWithResult(_0x535d96,null))['catch'](handleError(_0x535d96,null));};exports['destroy']=function(_0x6b200d,_0x142914){var _0x1d6626;var _0x2d0fc0=_0x6b200d[_0x6eec('0x44')]['id'];return db[_0x6eec('0x15')][_0x6eec('0x46')]({'where':{'id':_0x6b200d[_0x6eec('0x44')]['id']}})[_0x6eec('0x3d')](handleEntityNotFound(_0x142914,null))[_0x6eec('0x3d')](function(_0x4e1be2){if(_0x4e1be2){return _0x4e1be2['destroy']()[_0x6eec('0x3d')](function(_0x2270ce){return _0x2270ce;});}})[_0x6eec('0x3d')](function(_0x577fb6){_0x1d6626=_0x577fb6;if(_0x577fb6){if(_0x577fb6[_0x6eec('0x4a')]||_0x577fb6[_0x6eec('0x4b')]){return db[_0x577fb6[_0x6eec('0x4a')]?_0x6eec('0x4c'):_0x6eec('0x4d')][_0x6eec('0x46')]({'where':{'id':_0x577fb6[_0x6eec('0x4a')]?_0x577fb6[_0x6eec('0x4a')]:_0x577fb6['CampaignId']},'attributes':['id',_0x6eec('0x11')],'raw':!![]});}}})[_0x6eec('0x3d')](function(_0x3374ef){var _0x3e77f3={};if(_0x3374ef){_['merge'](_0x3e77f3,_['omit'](_0x1d6626['dataValues'],[_0x6eec('0x4e'),_0x6eec('0x4f'),'id']));_0x3e77f3[_0x6eec('0x50')]=0x15;_0x3e77f3[_0x6eec('0x51')]='deleted';_0x3e77f3['campaign']=_0x3374ef[_0x6eec('0x11')];_0x3e77f3[_0x6eec('0x52')]=_0x6b200d[_0x6eec('0x53')]['name'];_0x3e77f3[_0x6eec('0x54')]=_0x6b200d[_0x6eec('0x53')]['id'];_0x3e77f3[_0x6eec('0x55')]=!![];_0x3e77f3[_0x6eec('0x56')]=moment()[_0x6eec('0x57')](_0x6eec('0x58'));_0x3e77f3[_0x6eec('0x59')]=_0x1d6626[_0x6eec('0x5a')];_0x3e77f3[_0x6eec('0x5b')]=_0x1d6626['VoiceQueueId']?_0x6eec('0x5c'):'ivr';return db[_0x6eec('0x5d')][_0x6eec('0x46')]({'where':{'id':_0x3e77f3[_0x6eec('0x5e')]},'attributes':[_0x6eec('0x5f'),_0x6eec('0x60')]})[_0x6eec('0x3d')](function(_0x274975){if(!_['isNil'](_0x142914)&&!_[_0x6eec('0x61')](_0x274975['firstName'])){_0x3e77f3[_0x6eec('0x62')]=_0x274975['firstName'];if(!_[_0x6eec('0x61')](_0x274975[_0x6eec('0x60')])){_0x3e77f3[_0x6eec('0x62')]+='\x20'+_0x274975[_0x6eec('0x60')];}}})[_0x6eec('0x63')](function(){return db[_0x6eec('0x64')][_0x6eec('0x47')](_0x3e77f3);});}})[_0x6eec('0x3d')](function(_0x130002){return db[_0x6eec('0x65')]['destroy']({'where':{'CmHopperId':_0x2d0fc0}});})['then'](function(){return _0x142914[_0x6eec('0x6')](0xcc)[_0x6eec('0x66')]();})[_0x6eec('0x42')](handleError(_0x142914,null));};exports[_0x6eec('0x67')]=function(_0x20b040,_0x4a8fca){var _0x1d8fb1=[];return db[_0x6eec('0x5d')]['describe']()['then'](function(_0x5dc8b3){_0x1d8fb1=_[_0x6eec('0x1b')](_0x5dc8b3);return _0x20b040[_0x6eec('0x53')]['getVoiceQueues']({'where':{'type':_0x6eec('0x68'),'dialActive':!![],'dialMethod':_0x6eec('0x69')},'attributes':['id','dialOrderByScheduledAt',_0x6eec('0x6a')],'raw':!![]});})[_0x6eec('0x3d')](function(_0xc852b3){if(_0xc852b3&&_0xc852b3[_0x6eec('0x32')]){return db['sequelize']['transaction'](function(_0x54fcd0){var _0x1230fc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6eec('0x57')](_0x6eec('0x58'))},'VoiceQueueId':{'$in':_[_0x6eec('0x14')](_0xc852b3,'id')},'$or':[{'UserId':null},{'UserId':_0x20b040[_0x6eec('0x53')]['id']}]};var _0x169607={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xc852b3)[_0x6eec('0x39')]([_0x6eec('0x6a'),0x0])[_0x6eec('0x14')]('id')[_0x6eec('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x20b040[_0x6eec('0x53')]['id']}]};var _0x2799ca={'$or':[_0x1230fc,_0x169607]};var _0x386a67=[];if(_0x20b040[_0x6eec('0x48')][_0x6eec('0x6c')]&&_0x20b040[_0x6eec('0x48')]['direction']===_0x6eec('0x6d')){if(!_[_0x6eec('0x6e')](_0x20b040['body'][_0x6eec('0x6f')])){_0x2799ca['id']={'$in':_0x20b040[_0x6eec('0x48')]['hopperIds']};}_0x386a67=[[_0x6eec('0x70'),_0x6eec('0x71')],[_0x6eec('0x72'),_0xc852b3[0x0][_0x6eec('0x73')]==='ASC'?_0x6eec('0x74'):_0x6eec('0x71')],db[_0x6eec('0x75')][_0x6eec('0x76')](_0x6eec('0x77')),['id',_0x6eec('0x74')]];}else{if(!_['isEmpty'](_0x20b040[_0x6eec('0x48')]['hopperIds'])){_0x2799ca['id']={'$notIn':_0x20b040[_0x6eec('0x48')][_0x6eec('0x6f')]};}_0x386a67=[[_0x6eec('0x70'),_0x6eec('0x74')],[_0x6eec('0x72'),_0xc852b3[0x0][_0x6eec('0x73')]],db[_0x6eec('0x75')][_0x6eec('0x76')](_0x6eec('0x78')),['id','ASC']];}return db[_0x6eec('0x15')][_0x6eec('0x79')]({'attributes':['id',_0x6eec('0x7a'),'phone',_0x6eec('0x7b')],'where':_0x2799ca,'order':_0x386a67,'transaction':_0x54fcd0,'lock':_0x54fcd0[_0x6eec('0x7c')]['UPDATE'],'include':[{'model':db[_0x6eec('0x5d')],'as':_0x6eec('0x7d'),'attributes':_0x1d8fb1,'include':[{'model':db[_0x6eec('0x7e')],'as':_0x6eec('0x7f'),'attributes':['id',_0x6eec('0x11')]}]},{'model':db['CmList'],'as':_0x6eec('0x80'),'attributes':['id',_0x6eec('0x11')]},{'model':db[_0x6eec('0x4c')],'as':_0x6eec('0x81'),'attributes':['id',_0x6eec('0x11'),'dialActive']}]})[_0x6eec('0x3d')](function(_0x16e5dd){if(_0x16e5dd){return _0x16e5dd[_0x6eec('0xd')]({'UserId':_0x20b040[_0x6eec('0x53')]['id']},{'transaction':_0x54fcd0});}});});}})[_0x6eec('0x3d')](handleEntityNotFound(_0x4a8fca,null))[_0x6eec('0x3d')](respondWithResult(_0x4a8fca,null))[_0x6eec('0x42')](handleError(_0x4a8fca,null));};exports[_0x6eec('0x82')]=function(_0x59feac,_0x43d89a,_0x59341a){var _0x55b7bb=[];var _0xd209bc=_0x59feac[_0x6eec('0x44')]['id'];var _0x23a2ba=_0x59feac['user']['id'];return db[_0x6eec('0x5d')]['describe']()[_0x6eec('0x3d')](function(_0x185793){_0x55b7bb=_[_0x6eec('0x1b')](_0x185793);return db[_0x6eec('0x75')]['transaction'](function(_0x4a64ed){const _0x5e0824={'id':_0xd209bc};return db[_0x6eec('0x15')][_0x6eec('0x79')]({'attributes':['id',_0x6eec('0x7a'),_0x6eec('0x7b')],'where':_0x5e0824,'transaction':_0x4a64ed,'lock':_0x4a64ed['LOCK'][_0x6eec('0x83')],'include':[{'model':db['CmContact'],'as':_0x6eec('0x7d'),'attributes':_0x55b7bb,'include':[{'model':db[_0x6eec('0x7e')],'as':'Company','attributes':['id',_0x6eec('0x11')]}]},{'model':db[_0x6eec('0x84')],'as':_0x6eec('0x80'),'attributes':['id',_0x6eec('0x11')]},{'model':db[_0x6eec('0x4c')],'as':_0x6eec('0x81'),'attributes':['id','name',_0x6eec('0x85')]}]})['then'](function(_0x64c2ef){if(_0x64c2ef){return _0x64c2ef[_0x6eec('0xd')]({'UserId':_0x23a2ba},{'transaction':_0x4a64ed});}});});})['then'](handleEntityNotFound(_0x43d89a,null))[_0x6eec('0x3d')](respondWithResult(_0x43d89a,null))['catch'](handleError(_0x43d89a,null));};exports[_0x6eec('0x86')]=function(_0x1d1683,_0x8a4166){return _0x1d1683[_0x6eec('0x53')]['getVoiceQueues']({'where':{'type':_0x6eec('0x68'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x6eec('0x3d')](function(_0x2c0a85){if(_0x2c0a85&&_0x2c0a85['length']){return db[_0x6eec('0x15')][_0x6eec('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6eec('0x57')](_0x6eec('0x58'))},'VoiceQueueId':{'$in':_[_0x6eec('0x14')](_0x2c0a85,'id')},'$or':[{'UserId':null},{'UserId':_0x1d1683['user']['id']}]}});}return 0x0;})[_0x6eec('0x3d')](function(_0x18e949){if(!_[_0x6eec('0x61')](_0x18e949)&&_[_0x6eec('0x87')](_0x18e949)){return _0x8a4166[_0x6eec('0x6')](0xc8)[_0x6eec('0xc')]({'contacts':_0x18e949});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x6eec('0x86'),0x194,_0x6eec('0x88'));_0x8a4166['sendStatus'](0x194);}})['catch'](handleError(_0x8a4166,null));};exports[_0x6eec('0x89')]=function(_0x1b62ba,_0x52b8b4){var _0x2c7853=shared[_0x6eec('0x8a')];var _0x1e69a0=[];_['map'](_0x2c7853,function(_0xcd62ad){_0x1e69a0['push']({'id':_0xcd62ad[_0x6eec('0x11')],'name':_0xcd62ad[_0x6eec('0x11')],'utcOffset':_0xcd62ad['utcOffset']});});return _0x52b8b4[_0x6eec('0x6')](0xc8)[_0x6eec('0xc')]({'tz':_0x1e69a0});};exports[_0x6eec('0x8b')]=function(_0x4a7a37,_0xf4f91){var _0xc4e3bc=shared[_0x6eec('0x8a')];var _0x1bdf2b={};if(!_[_0x6eec('0x61')](_0xc4e3bc[_0x4a7a37[_0x6eec('0x48')]['id']]))_0x1bdf2b=_0xc4e3bc[_0x4a7a37['body']['id']];return _0xf4f91[_0x6eec('0x6')](0xc8)[_0x6eec('0xc')](_0x1bdf2b);}; \ No newline at end of file +var _0x1dcc=['destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','direction','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','List','VoiceQueue','findOne','Company','CmList','Queue','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','offset','undefined','count','limit','status','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x1a6da5,_0x389640){_0x1a6da5=_0x1a6da5-0x0;var _0x563d6e=_0x1dcc[_0x1a6da5];return _0x563d6e;};'use strict';var moment=require(_0xc1dc('0x0'));var _=require(_0xc1dc('0x1'));var qs=require(_0xc1dc('0x2'));var logger=require(_0xc1dc('0x3'))('api');var shared=require(_0xc1dc('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x20abc9,_0x3eb139){_0x3eb139=_0x3eb139||0xc8;return function(_0x2a8ff9){if(_0x2a8ff9){return _0x20abc9['status'](_0x3eb139)['json'](_0x2a8ff9);}};}function respondWithFilteredResult(_0x1e57ba,_0x381ab6){return function(_0x41b667){if(_0x41b667){var _0x4dab41=typeof _0x381ab6[_0xc1dc('0x5')]===_0xc1dc('0x6')&&typeof _0x381ab6['limit']===_0xc1dc('0x6');var _0x51c02b=_0x41b667[_0xc1dc('0x7')];var _0x49ef48=_0x4dab41?0x0:_0x381ab6[_0xc1dc('0x5')];var _0x16520d=_0x4dab41?_0x41b667[_0xc1dc('0x7')]:_0x381ab6[_0xc1dc('0x5')]+_0x381ab6[_0xc1dc('0x8')];var _0x616175;if(_0x16520d>=_0x51c02b){_0x16520d=_0x51c02b;_0x616175=0xc8;}else{_0x616175=0xce;}_0x1e57ba[_0xc1dc('0x9')](_0x616175);return _0x1e57ba[_0xc1dc('0xa')](_0xc1dc('0xb'),_0x49ef48+'-'+_0x16520d+'/'+_0x51c02b)['json'](_0x41b667);}return null;};}function saveUpdates(_0x226ba3,_0x2c5f41){return function(_0xb7e667){if(_0xb7e667){return _0xb7e667['update'](_0x226ba3)[_0xc1dc('0xc')](function(_0x7d7257){return _0x7d7257;});}return null;};}function handleEntityNotFound(_0x299520,_0xd51b1e){return function(_0x145708){if(!_0x145708){_0x299520[_0xc1dc('0xd')](0x194);}return _0x145708;};}function handleError(_0x188182,_0x21aed1){_0x21aed1=_0x21aed1||0x1f4;return function(_0x265929){logger[_0xc1dc('0xe')](_0x265929[_0xc1dc('0xf')]);if(_0x265929['name']){delete _0x265929[_0xc1dc('0x10')];}_0x188182[_0xc1dc('0x9')](_0x21aed1)[_0xc1dc('0x11')](_0x265929);};}exports[_0xc1dc('0x12')]=function(_0x47c72e,_0x332400){var _0xc01137={},_0x499a42={},_0x484f6c={'count':0x0,'rows':[]};var _0x3f96d3=_[_0xc1dc('0x13')](db[_0xc1dc('0x14')][_0xc1dc('0x15')],function(_0x1707dc){return{'name':_0x1707dc[_0xc1dc('0x16')],'type':_0x1707dc[_0xc1dc('0x17')][_0xc1dc('0x18')]};});_0x499a42['model']=_['map'](_0x3f96d3,'name');_0x499a42[_0xc1dc('0x19')]=_[_0xc1dc('0x1a')](_0x47c72e['query']);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],_0x499a42[_0xc1dc('0x19')]);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1e')](_0x499a42[_0xc1dc('0x1b')],[_0xc1dc('0x1f'),_0xc1dc('0x20'),_0xc1dc('0x21'),'$gte',_0xc1dc('0x22'),_0xc1dc('0x23'),_0xc1dc('0x24'),_0xc1dc('0x25'),'$not',_0xc1dc('0x26'),_0xc1dc('0x27'),_0xc1dc('0x28'),_0xc1dc('0x29'),_0xc1dc('0x2a'),_0xc1dc('0x2b'),_0xc1dc('0x2c'),_0xc1dc('0x2d'),_0xc1dc('0x2a'),'$overlap',_0xc1dc('0x2e'),_0xc1dc('0x2f'),_0xc1dc('0x30')]);_0xc01137[_0xc1dc('0x31')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x32')]));_0xc01137[_0xc1dc('0x31')]=_0xc01137[_0xc1dc('0x31')]['length']?_0xc01137[_0xc1dc('0x31')]:_0x499a42[_0xc1dc('0x1d')];if(!_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x33')](_0xc1dc('0x34'))){_0xc01137[_0xc1dc('0x8')]=qs[_0xc1dc('0x8')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x8')]);_0xc01137['offset']=qs['offset'](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x5')]);}_0xc01137[_0xc1dc('0x35')]=qs[_0xc1dc('0x36')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x36')]);_0xc01137['where']=qs[_0xc1dc('0x1b')](_[_0xc1dc('0x37')](_0x47c72e['query'],_0x499a42[_0xc1dc('0x1b')]),_0x3f96d3);if(_0x47c72e[_0xc1dc('0x19')]['filter']){_0xc01137[_0xc1dc('0x38')]=_[_0xc1dc('0x39')](_0xc01137[_0xc1dc('0x38')],{'$or':_['map'](_0x3f96d3,function(_0x1ee0ba){if(_0x1ee0ba[_0xc1dc('0x17')]!==_0xc1dc('0x3a')){var _0x341bb3={};_0x341bb3[_0x1ee0ba[_0xc1dc('0x10')]]={'$like':'%'+_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3b')]+'%'};return _0x341bb3;}})});}_0xc01137=_[_0xc1dc('0x39')]({},_0xc01137,_0x47c72e[_0xc1dc('0x3c')]);var _0x4e3051={'where':_0xc01137[_0xc1dc('0x38')]};return db[_0xc1dc('0x14')][_0xc1dc('0x7')](_0x4e3051)['then'](function(_0x19bde9){_0x484f6c[_0xc1dc('0x7')]=_0x19bde9;if(_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3d')]){_0xc01137[_0xc1dc('0x3e')]=[{'all':!![]}];}return db[_0xc1dc('0x14')][_0xc1dc('0x3f')](_0xc01137);})[_0xc1dc('0xc')](function(_0x5967b2){_0x484f6c[_0xc1dc('0x40')]=_0x5967b2;return _0x484f6c;})[_0xc1dc('0xc')](respondWithFilteredResult(_0x332400,_0xc01137))[_0xc1dc('0x41')](handleError(_0x332400,null));};exports[_0xc1dc('0x42')]=function(_0x1d8107,_0x1fbdb8){var _0x503ec8={'raw':!![],'where':{'id':_0x1d8107[_0xc1dc('0x43')]['id']}},_0x12a92d={};_0x12a92d[_0xc1dc('0x1d')]=_[_0xc1dc('0x1a')](db[_0xc1dc('0x14')]['rawAttributes']);_0x12a92d['query']=_[_0xc1dc('0x1a')](_0x1d8107[_0xc1dc('0x19')]);_0x12a92d[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x12a92d[_0xc1dc('0x1d')],_0x12a92d[_0xc1dc('0x19')]);_0x503ec8[_0xc1dc('0x31')]=_['intersection'](_0x12a92d[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x1d8107[_0xc1dc('0x19')]['fields']));_0x503ec8[_0xc1dc('0x31')]=_0x503ec8[_0xc1dc('0x31')][_0xc1dc('0x44')]?_0x503ec8[_0xc1dc('0x31')]:_0x12a92d['model'];if(_0x1d8107['query'][_0xc1dc('0x3d')]){_0x503ec8[_0xc1dc('0x3e')]=[{'all':!![]}];}_0x503ec8=_['merge']({},_0x503ec8,_0x1d8107[_0xc1dc('0x3c')]);return db[_0xc1dc('0x14')][_0xc1dc('0x45')](_0x503ec8)[_0xc1dc('0xc')](handleEntityNotFound(_0x1fbdb8,null))[_0xc1dc('0xc')](respondWithResult(_0x1fbdb8,null))[_0xc1dc('0x41')](handleError(_0x1fbdb8,null));};exports[_0xc1dc('0x46')]=function(_0x54bb1f,_0x5a74a0){return db[_0xc1dc('0x14')]['create'](_0x54bb1f[_0xc1dc('0x47')],{})[_0xc1dc('0xc')](respondWithResult(_0x5a74a0,0xc9))[_0xc1dc('0x41')](handleError(_0x5a74a0,null));};exports[_0xc1dc('0x48')]=function(_0x452303,_0x40eb12){if(_0x452303[_0xc1dc('0x47')]['id']){delete _0x452303[_0xc1dc('0x47')]['id'];}return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x452303[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x40eb12,null))[_0xc1dc('0xc')](saveUpdates(_0x452303[_0xc1dc('0x47')],null))[_0xc1dc('0xc')](respondWithResult(_0x40eb12,null))[_0xc1dc('0x41')](handleError(_0x40eb12,null));};exports[_0xc1dc('0x49')]=function(_0x2ca7f1,_0x29417d){return db['CmHopper']['describe']()['then'](respondWithResult(_0x29417d,null))[_0xc1dc('0x41')](handleError(_0x29417d,null));};exports[_0xc1dc('0x4a')]=function(_0x57b792,_0x129e23){var _0x6ab7fc;var _0x505272=_0x57b792[_0xc1dc('0x43')]['id'];return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x57b792[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0xc')](function(_0x331d24){if(_0x331d24){return _0x331d24[_0xc1dc('0x4a')]()[_0xc1dc('0xc')](function(_0x34667b){return _0x34667b;});}})['then'](function(_0x21b385){_0x6ab7fc=_0x21b385;if(_0x21b385){if(_0x21b385[_0xc1dc('0x4b')]||_0x21b385[_0xc1dc('0x4c')]){return db[_0x21b385[_0xc1dc('0x4b')]?'VoiceQueue':_0xc1dc('0x4d')][_0xc1dc('0x45')]({'where':{'id':_0x21b385[_0xc1dc('0x4b')]?_0x21b385[_0xc1dc('0x4b')]:_0x21b385[_0xc1dc('0x4c')]},'attributes':['id',_0xc1dc('0x10')],'raw':!![]});}}})[_0xc1dc('0xc')](function(_0x17d80f){var _0x512ec1={};if(_0x17d80f){_[_0xc1dc('0x39')](_0x512ec1,_[_0xc1dc('0x4e')](_0x6ab7fc[_0xc1dc('0x4f')],[_0xc1dc('0x50'),_0xc1dc('0x51'),'id']));_0x512ec1[_0xc1dc('0x52')]=0x15;_0x512ec1[_0xc1dc('0x53')]='deleted';_0x512ec1[_0xc1dc('0x54')]=_0x17d80f[_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x55')]=_0x57b792[_0xc1dc('0x56')][_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x57')]=_0x57b792[_0xc1dc('0x56')]['id'];_0x512ec1[_0xc1dc('0x58')]=!![];_0x512ec1[_0xc1dc('0x59')]=moment()['format'](_0xc1dc('0x5a'));_0x512ec1['calleridnum']=_0x6ab7fc[_0xc1dc('0x5b')];_0x512ec1[_0xc1dc('0x5c')]=_0x6ab7fc[_0xc1dc('0x4b')]?_0xc1dc('0x5d'):_0xc1dc('0x5e');return db[_0xc1dc('0x5f')][_0xc1dc('0x45')]({'where':{'id':_0x512ec1['ContactId']},'attributes':[_0xc1dc('0x60'),_0xc1dc('0x61')]})['then'](function(_0x5635a6){if(!_[_0xc1dc('0x62')](_0x129e23)&&!_[_0xc1dc('0x62')](_0x5635a6[_0xc1dc('0x60')])){_0x512ec1[_0xc1dc('0x63')]=_0x5635a6['firstName'];if(!_['isNil'](_0x5635a6[_0xc1dc('0x61')])){_0x512ec1[_0xc1dc('0x63')]+='\x20'+_0x5635a6[_0xc1dc('0x61')];}}})['finally'](function(){return db[_0xc1dc('0x64')][_0xc1dc('0x46')](_0x512ec1);});}})[_0xc1dc('0xc')](function(_0x4476eb){return db[_0xc1dc('0x65')]['destroy']({'where':{'CmHopperId':_0x505272}});})[_0xc1dc('0xc')](function(){return _0x129e23[_0xc1dc('0x9')](0xcc)[_0xc1dc('0x66')]();})[_0xc1dc('0x41')](handleError(_0x129e23,null));};exports[_0xc1dc('0x67')]=function(_0x2a1a44,_0x166d59){var _0x145b62=[];return db[_0xc1dc('0x5f')]['describe']()['then'](function(_0x3c1bf8){_0x145b62=_[_0xc1dc('0x1a')](_0x3c1bf8);return _0x2a1a44[_0xc1dc('0x56')][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':_0xc1dc('0x6a')},'attributes':['id',_0xc1dc('0x6b'),_0xc1dc('0x6c')],'raw':!![]});})[_0xc1dc('0xc')](function(_0x4de18d){if(_0x4de18d&&_0x4de18d[_0xc1dc('0x44')]){return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x20a96b){var _0x45ff61={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc1dc('0x6f')](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_[_0xc1dc('0x13')](_0x4de18d,'id')},'$or':[{'UserId':null},{'UserId':_0x2a1a44[_0xc1dc('0x56')]['id']}]};var _0x5c2942={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4de18d)[_0xc1dc('0x3b')]([_0xc1dc('0x6c'),0x0])[_0xc1dc('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2a1a44['user']['id']}]};var _0x32038f={'$or':[_0x45ff61,_0x5c2942]};var _0x5dd75b=[];if(_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]&&_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]==='prev'){if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$in':_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x73')],[_0xc1dc('0x74'),_0x4de18d[0x0]['dialOrderByScheduledAt']===_0xc1dc('0x73')?'DESC':_0xc1dc('0x73')],db[_0xc1dc('0x6d')]['literal'](_0xc1dc('0x75')),['id',_0xc1dc('0x76')]];}else{if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$notIn':_0x2a1a44['body'][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x76')],[_0xc1dc('0x74'),_0x4de18d[0x0][_0xc1dc('0x6b')]],db[_0xc1dc('0x6d')][_0xc1dc('0x77')](_0xc1dc('0x78')),['id','ASC']];}return db[_0xc1dc('0x14')]['findOne']({'attributes':['id',_0xc1dc('0x79'),'phone',_0xc1dc('0x7a')],'where':_0x32038f,'order':_0x5dd75b,'transaction':_0x20a96b,'lock':_0x20a96b[_0xc1dc('0x7b')][_0xc1dc('0x7c')],'include':[{'model':db[_0xc1dc('0x5f')],'as':_0xc1dc('0x7d'),'attributes':_0x145b62,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xc1dc('0x10')]}]},{'model':db['CmList'],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':'Queue','attributes':['id',_0xc1dc('0x10'),'dialActive']}]})[_0xc1dc('0xc')](function(_0x320441){if(_0x320441){return _0x320441[_0xc1dc('0x48')]({'UserId':_0x2a1a44['user']['id']},{'transaction':_0x20a96b});}});});}})[_0xc1dc('0xc')](handleEntityNotFound(_0x166d59,null))[_0xc1dc('0xc')](respondWithResult(_0x166d59,null))[_0xc1dc('0x41')](handleError(_0x166d59,null));};exports['getPreviewRecall']=function(_0x51d4ce,_0x2c6f8b,_0x2ab121){var _0x5d07dc=[];var _0x3a3e3e=_0x51d4ce[_0xc1dc('0x43')]['id'];var _0x813307=_0x51d4ce[_0xc1dc('0x56')]['id'];return db['CmContact'][_0xc1dc('0x49')]()[_0xc1dc('0xc')](function(_0x12c155){_0x5d07dc=_[_0xc1dc('0x1a')](_0x12c155);return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x33e810){const _0x42d1fb={'id':_0x3a3e3e};return db[_0xc1dc('0x14')][_0xc1dc('0x80')]({'attributes':['id',_0xc1dc('0x79'),_0xc1dc('0x7a')],'where':_0x42d1fb,'transaction':_0x33e810,'lock':_0x33e810['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5d07dc,'include':[{'model':db['CmCompany'],'as':_0xc1dc('0x81'),'attributes':['id','name']}]},{'model':db[_0xc1dc('0x82')],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':_0xc1dc('0x83'),'attributes':['id','name','dialActive']}]})[_0xc1dc('0xc')](function(_0x264989){if(_0x264989){return _0x264989['update']({'UserId':_0x813307},{'transaction':_0x33e810});}});});})[_0xc1dc('0xc')](handleEntityNotFound(_0x2c6f8b,null))['then'](respondWithResult(_0x2c6f8b,null))['catch'](handleError(_0x2c6f8b,null));};exports['getOpenContacts']=function(_0x4e3bf2,_0x43634f){return _0x4e3bf2['user'][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc1dc('0xc')](function(_0x31f9bc){if(_0x31f9bc&&_0x31f9bc[_0xc1dc('0x44')]){return db[_0xc1dc('0x14')][_0xc1dc('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x31f9bc,'id')},'$or':[{'UserId':null},{'UserId':_0x4e3bf2['user']['id']}]}});}return 0x0;})['then'](function(_0x2c22a7){if(!_[_0xc1dc('0x62')](_0x2c22a7)&&_[_0xc1dc('0x84')](_0x2c22a7)){return _0x43634f[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'contacts':_0x2c22a7});}else{logger[_0xc1dc('0xe')](_0xc1dc('0x86'),'getOpenContacts',0x194,_0xc1dc('0x87'));_0x43634f[_0xc1dc('0xd')](0x194);}})[_0xc1dc('0x41')](handleError(_0x43634f,null));};exports[_0xc1dc('0x88')]=function(_0x413c40,_0x247cc1){var _0x4bca30=shared[_0xc1dc('0x89')];var _0x1d9dfb=[];_['map'](_0x4bca30,function(_0x5d3625){_0x1d9dfb[_0xc1dc('0x8a')]({'id':_0x5d3625[_0xc1dc('0x10')],'name':_0x5d3625[_0xc1dc('0x10')],'utcOffset':_0x5d3625[_0xc1dc('0x8b')]});});return _0x247cc1[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'tz':_0x1d9dfb});};exports[_0xc1dc('0x8c')]=function(_0x48d6a7,_0x551195){var _0x3750d4=shared['timezones'];var _0x24efce={};if(!_[_0xc1dc('0x62')](_0x3750d4[_0x48d6a7[_0xc1dc('0x47')]['id']]))_0x24efce=_0x3750d4[_0x48d6a7['body']['id']];return _0x551195[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')](_0x24efce);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b06d93a..a3c0501 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 _0x5fc3=['scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x4d2d3b,_0x6ea545){var _0x4bef6a=function(_0x575752){while(--_0x575752){_0x4d2d3b['push'](_0x4d2d3b['shift']());}};_0x4bef6a(++_0x6ea545);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x5fc3[_0x4480b9];return _0x3f0f02;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('CmHopper',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]},{'name':_0x35fc('0xd'),'fields':[_0x35fc('0xd')]},{'name':_0x35fc('0xe'),'fields':[_0x35fc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x814b,0x1a2));var _0xb814=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0x814b[_0x2bc400];return _0x36ab53;};'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':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]},{'name':_0xb814('0xe'),'fields':[_0xb814('0xe')]},{'name':_0xb814('0xf'),'fields':[_0xb814('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0d859fe..eceb0da 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 _0x5272=['GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','\x20MINUTE','name','CmList','NOW()','lodash','util','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','map','model','then','info','stringify','catch','error','message','find','where','ShowCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','debug','DestroyCmHopper','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','User','Agent','length','push','includes','all'];(function(_0x3151af,_0x393990){var _0x2aa0b0=function(_0x39c37c){while(--_0x39c37c){_0x3151af['push'](_0x3151af['shift']());}};_0x2aa0b0(++_0x393990);}(_0x5272,0x14a));var _0x2527=function(_0x1db8e5,_0x379f17){_0x1db8e5=_0x1db8e5-0x0;var _0x5e0e38=_0x5272[_0x1db8e5];return _0x5e0e38;};'use strict';var _=require(_0x2527('0x0'));var util=require(_0x2527('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require(_0x2527('0x2'))['db'];var logger=require('../../config/logger')(_0x2527('0x3'));exports[_0x2527('0x4')]=function(_0x43feab){var _0x2ff9f3=this;return new Promise(function(_0x4526c7,_0x414f95){return db[_0x2527('0x5')][_0x2527('0x6')]({'raw':_0x43feab[_0x2527('0x7')]?_0x43feab[_0x2527('0x7')][_0x2527('0x8')]===undefined?!![]:![]:!![],'where':_0x43feab[_0x2527('0x7')]?_0x43feab[_0x2527('0x7')]['where']||null:null,'attributes':_0x43feab[_0x2527('0x7')]?_0x43feab[_0x2527('0x7')][_0x2527('0x9')]||null:null,'limit':_0x43feab[_0x2527('0x7')]?_0x43feab[_0x2527('0x7')][_0x2527('0xa')]||null:null,'include':_0x43feab[_0x2527('0x7')]?_0x43feab[_0x2527('0x7')][_0x2527('0xb')]?_[_0x2527('0xc')](_0x43feab[_0x2527('0x7')][_0x2527('0xb')],function(_0x4d5485){return{'model':db[_0x4d5485[_0x2527('0xd')]],'as':_0x4d5485['as'],'attributes':_0x4d5485[_0x2527('0x9')],'include':_0x4d5485[_0x2527('0xb')]?_[_0x2527('0xc')](_0x4d5485[_0x2527('0xb')],function(_0x5530c4){return{'model':db[_0x5530c4[_0x2527('0xd')]],'as':_0x5530c4['as'],'attributes':_0x5530c4[_0x2527('0x9')],'include':_0x5530c4[_0x2527('0xb')]?_[_0x2527('0xc')](_0x5530c4[_0x2527('0xb')],function(_0x1065ad){return{'model':db[_0x1065ad[_0x2527('0xd')]],'as':_0x1065ad['as'],'attributes':_0x1065ad[_0x2527('0x9')]};}):[]};}):[]};}):[]:[]})[_0x2527('0xe')](function(_0x165900){logger[_0x2527('0xf')](_0x2527('0x4'),_0x43feab);logger['debug'](_0x2527('0x4'),_0x43feab,JSON[_0x2527('0x10')](_0x165900));_0x4526c7(_0x165900);})[_0x2527('0x11')](function(_0x31f937){logger[_0x2527('0x12')](_0x2527('0x4'),_0x31f937[_0x2527('0x13')],_0x43feab);_0x414f95(_0x2ff9f3[_0x2527('0x12')](0x1f4,_0x31f937['message']));});});};exports['ShowCmHopper']=function(_0x243959){var _0x2b6f74=this;return new Promise(function(_0xeba6e7,_0xbb70a1){return db['CmHopper'][_0x2527('0x14')]({'raw':_0x243959['options']?_0x243959[_0x2527('0x7')][_0x2527('0x8')]===undefined?!![]:![]:!![],'where':_0x243959[_0x2527('0x7')]?_0x243959[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':_0x243959[_0x2527('0x7')]?_0x243959[_0x2527('0x7')]['attributes']||null:null,'include':_0x243959['options']?_0x243959[_0x2527('0x7')][_0x2527('0xb')]?_[_0x2527('0xc')](_0x243959['options'][_0x2527('0xb')],function(_0x515a6e){return{'model':db[_0x515a6e[_0x2527('0xd')]],'as':_0x515a6e['as'],'attributes':_0x515a6e[_0x2527('0x9')],'include':_0x515a6e[_0x2527('0xb')]?_[_0x2527('0xc')](_0x515a6e[_0x2527('0xb')],function(_0x5af1d6){return{'model':db[_0x5af1d6['model']],'as':_0x5af1d6['as'],'attributes':_0x5af1d6['attributes'],'include':_0x5af1d6['include']?_[_0x2527('0xc')](_0x5af1d6[_0x2527('0xb')],function(_0x54b9f9){return{'model':db[_0x54b9f9['model']],'as':_0x54b9f9['as'],'attributes':_0x54b9f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x2527('0xe')](function(_0x3a6858){logger[_0x2527('0xf')](_0x2527('0x16'),_0x243959);logger['debug'](_0x2527('0x16'),_0x243959,JSON[_0x2527('0x10')](_0x3a6858));_0xeba6e7(_0x3a6858);})[_0x2527('0x11')](function(_0x21f7d6){logger['error']('ShowCmHopper',_0x21f7d6[_0x2527('0x13')],_0x243959);_0xbb70a1(_0x2b6f74[_0x2527('0x12')](0x1f4,_0x21f7d6[_0x2527('0x13')]));});});};exports['CreateCmHopper']=function(_0x4ea60b){var _0x362efa=this;return new Promise(function(_0x16da11,_0x236cf8){return db['CmHopper'][_0x2527('0x17')](_0x4ea60b[_0x2527('0x18')],{'raw':_0x4ea60b[_0x2527('0x7')]?_0x4ea60b[_0x2527('0x7')]['raw']===undefined?!![]:![]:!![]})[_0x2527('0xe')](function(_0x10c7a8){logger[_0x2527('0xf')]('CreateCmHopper',_0x4ea60b);logger['debug']('CreateCmHopper',_0x4ea60b,JSON[_0x2527('0x10')](_0x10c7a8));_0x16da11(_0x10c7a8);})[_0x2527('0x11')](function(_0x1d2bee){logger['error']('CreateCmHopper',_0x1d2bee[_0x2527('0x13')],_0x4ea60b);_0x236cf8(_0x362efa['error'](0x1f4,_0x1d2bee[_0x2527('0x13')]));});});};exports[_0x2527('0x19')]=function(_0x2f4e12){var _0x40d83d=this;return new Promise(function(_0x40a9a9,_0x675d34){return db[_0x2527('0x5')][_0x2527('0x1a')](_0x2f4e12[_0x2527('0x18')],{'raw':_0x2f4e12[_0x2527('0x7')]?_0x2f4e12['options'][_0x2527('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f4e12['options']?_0x2f4e12[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':_0x2f4e12[_0x2527('0x7')]?_0x2f4e12[_0x2527('0x7')][_0x2527('0x9')]||null:null,'limit':_0x2f4e12[_0x2527('0x7')]?_0x2f4e12[_0x2527('0x7')][_0x2527('0xa')]||null:null})[_0x2527('0xe')](function(_0x1ab680){logger[_0x2527('0xf')](_0x2527('0x19'),_0x2f4e12);logger[_0x2527('0xf')](_0x2527('0x1b'),JSON[_0x2527('0x10')](_0x2f4e12[_0x2527('0x7')][_0x2527('0x15')]),_0x2f4e12[_0x2527('0x18')][_0x2527('0x1c')]);logger[_0x2527('0x1d')](_0x2527('0x19'),_0x2f4e12,JSON[_0x2527('0x10')](_0x1ab680));_0x40a9a9(_0x1ab680);})[_0x2527('0x11')](function(_0x356bf1){logger[_0x2527('0x12')](_0x2527('0x19'),_0x356bf1['message'],_0x2f4e12);_0x675d34(_0x40d83d[_0x2527('0x12')](0x1f4,_0x356bf1['message']));});});};exports[_0x2527('0x1e')]=function(_0x577969){var _0x2e6857=this;return new Promise(function(_0x14ef0a,_0x509a9a){return db[_0x2527('0x5')]['destroy']({'where':_0x577969['options']?_0x577969[_0x2527('0x7')][_0x2527('0x15')]||null:null})['then'](function(_0x31dc57){logger['info'](_0x2527('0x1e'),_0x577969);logger[_0x2527('0x1d')](_0x2527('0x1e'),_0x577969,JSON[_0x2527('0x10')](_0x31dc57));_0x14ef0a(_0x31dc57);})[_0x2527('0x11')](function(_0xb66c59){logger[_0x2527('0x12')](_0x2527('0x1e'),_0xb66c59['message'],_0x577969);_0x509a9a(_0x2e6857[_0x2527('0x12')](0x1f4,_0xb66c59['message']));});});};exports['GetContactDialer']=function(_0x3bbd88){var _0x6f1340=this;return new Promise(function(_0x118fb5,_0x55cb10){return db['CmContact'][_0x2527('0x1f')]()['then'](function(_0x45dffd){return db[_0x2527('0x20')][_0x2527('0x21')](function(_0xf64be0){return db[_0x2527('0x5')][_0x2527('0x6')]({'where':_0x3bbd88[_0x2527('0x7')]?_0x3bbd88[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':_0x3bbd88[_0x2527('0x7')]?_0x3bbd88['options'][_0x2527('0x9')]||null:null,'limit':_0x3bbd88[_0x2527('0x7')]?_0x3bbd88[_0x2527('0x7')]['limit']||null:null,'order':_0x3bbd88['options']?_0x3bbd88[_0x2527('0x7')][_0x2527('0x22')]||null:null,'transaction':_0xf64be0,'lock':_0xf64be0['LOCK'][_0x2527('0x23')],'include':[{'model':db[_0x2527('0x24')],'as':_0x2527('0x25'),'attributes':_[_0x2527('0x26')](_0x45dffd)},{'model':db[_0x2527('0x27')],'as':_0x2527('0x28'),'attributes':['id','name','voicePause']}]})['then'](function(_0x375796){var _0x2fe6be=[];var _0x53f2f3=[];for(var _0x5be0bc=0x0;_0x5be0bc<_0x375796[_0x2527('0x29')];_0x5be0bc+=0x1){var _0x5d0e39=_0x375796[_0x5be0bc]['UserId'];if(_0x5d0e39===null){_0x2fe6be[_0x2527('0x2a')](_0x375796[_0x5be0bc][_0x2527('0x1a')](_0x3bbd88[_0x2527('0x18')],{'transaction':_0xf64be0}));}else if(!_0x53f2f3[_0x2527('0x2b')](_0x5d0e39)){_0x53f2f3[_0x2527('0x2a')](_0x5d0e39);_0x2fe6be['push'](_0x375796[_0x5be0bc][_0x2527('0x1a')](_0x3bbd88[_0x2527('0x18')],{'transaction':_0xf64be0}));}}return BPromise[_0x2527('0x2c')](_0x2fe6be);});})['then'](function(_0x4e30c9){logger[_0x2527('0xf')](_0x2527('0x2d'),_0x3bbd88);if(_0x4e30c9['length']>0x0){logger[_0x2527('0xf')](_0x2527('0x2e'),_0x4e30c9[0x0][_0x2527('0x2f')]['id'],_0x4e30c9[0x0][_0x2527('0x2f')]['ContactId'],_0x4e30c9[0x0]['dataValues'][_0x2527('0x1c')]);}logger[_0x2527('0x1d')](_0x2527('0x2d'),_0x3bbd88,JSON[_0x2527('0x10')](_0x4e30c9));_0x118fb5(_0x4e30c9);})[_0x2527('0x11')](function(_0x5edf94){logger[_0x2527('0x12')](_0x2527('0x2d'),_0x5edf94['message'],_0x3bbd88);_0x55cb10(_0x6f1340[_0x2527('0x12')](0x1f4,_0x5edf94[_0x2527('0x13')]));});});});};exports[_0x2527('0x30')]=function(_0x252b51){var _0x3a3f4e=this;return new Promise(function(_0x484dbb,_0x4510d5){return db['sequelize']['transaction'](function(_0x46c655){return db[_0x2527('0x31')]['create'](_0x252b51[_0x2527('0x18')],{'raw':_0x252b51['options']?_0x252b51[_0x2527('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x46c655})[_0x2527('0xe')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2527('0x10')](_0x252b51['options'][_0x2527('0x15')]),_0x252b51[_0x2527('0x7')]['where'][_0x2527('0x1c')]);return db['CmHopper'][_0x2527('0x32')]({'where':_0x252b51[_0x2527('0x7')]?_0x252b51[_0x2527('0x7')][_0x2527('0x15')]||null:null,'transaction':_0x46c655});});})['then'](function(_0x1abe0e){logger[_0x2527('0xf')](_0x2527('0x30'),_0x252b51);logger[_0x2527('0x1d')](_0x2527('0x30'),_0x252b51,JSON[_0x2527('0x10')](_0x1abe0e));_0x484dbb(_0x1abe0e);})[_0x2527('0x11')](function(_0x15a03f){logger['error'](_0x2527('0x30'),_0x15a03f[_0x2527('0x13')],_0x252b51);_0x4510d5(_0x3a3f4e[_0x2527('0x12')](0x1f4,_0x15a03f['message']));});});};exports[_0x2527('0x33')]=function(_0x9a374b){var _0xca94cd=this;return new Promise(function(_0xfc7776,_0x940a3c){return db[_0x2527('0x5')][_0x2527('0x6')]({'raw':_0x9a374b[_0x2527('0x7')]?_0x9a374b[_0x2527('0x7')][_0x2527('0x8')]===undefined?!![]:![]:!![],'where':_0x9a374b[_0x2527('0x7')]?_0x9a374b[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':[[db[_0x2527('0x20')]['fn'](_0x2527('0x34'),db[_0x2527('0x20')]['fn']('IF',db[_0x2527('0x20')]['literal']('`scheduledat`\x20>=\x20'+util[_0x2527('0x35')](_0x2527('0x36'),moment()[_0x2527('0x35')](_0x2527('0x37')))+_0x2527('0x38')))),'contactsRescheduled']]})[_0x2527('0xe')](function(_0xc4bbb5){logger[_0x2527('0xf')]('CountReScheduled',_0x9a374b);logger[_0x2527('0x1d')]('CountReScheduled',_0x9a374b,JSON['stringify'](_0xc4bbb5));_0xfc7776(_0xc4bbb5);})[_0x2527('0x11')](function(_0x2aedb7){logger[_0x2527('0x12')](_0x2527('0x33'),_0x2aedb7[_0x2527('0x13')],_0x9a374b);_0x940a3c(_0xca94cd[_0x2527('0x12')](0x1f4,_0x2aedb7[_0x2527('0x13')]));});});};exports[_0x2527('0x39')]=function(_0x56ef82){var _0x517614=this;return new Promise(function(_0x386f08,_0x2546ae){return db['CmContact'][_0x2527('0x1f')]()[_0x2527('0xe')](function(){return db[_0x2527('0x20')][_0x2527('0x21')](function(_0x1a27db){return db[_0x2527('0x5')][_0x2527('0x6')]({'where':_0x56ef82[_0x2527('0x7')]?_0x56ef82[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':_0x56ef82[_0x2527('0x7')]?_0x56ef82[_0x2527('0x7')][_0x2527('0x9')]||null:null,'limit':0x1,'order':_0x56ef82[_0x2527('0x7')]?_0x56ef82['options'][_0x2527('0x22')]||null:null,'group':db[_0x2527('0x5')][_0x2527('0x3a')],'transaction':_0x1a27db,'lock':_0x1a27db[_0x2527('0x3b')][_0x2527('0x23')],'include':_0x56ef82[_0x2527('0x7')]?_0x56ef82['options']['include']?_[_0x2527('0xc')](_0x56ef82[_0x2527('0x7')][_0x2527('0xb')],function(_0x583c64){return{'model':db[_0x583c64['model']],'as':_0x583c64['as'],'attributes':_0x583c64[_0x2527('0x9')],'include':_0x583c64[_0x2527('0xb')]?_[_0x2527('0xc')](_0x583c64[_0x2527('0xb')],function(_0x3854aa){return{'model':db[_0x3854aa['model']],'as':_0x3854aa['as'],'attributes':_0x3854aa[_0x2527('0x9')],'include':_0x3854aa[_0x2527('0xb')]?_['map'](_0x3854aa[_0x2527('0xb')],function(_0xe3240f){return{'model':db[_0xe3240f[_0x2527('0xd')]],'as':_0xe3240f['as'],'attributes':_0xe3240f[_0x2527('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x484d2b){var _0x52cb81=[];for(var _0x45d67c=0x0;_0x45d67c<_0x484d2b[_0x2527('0x29')];_0x45d67c+=0x1){_0x52cb81[_0x2527('0x2a')](_0x484d2b[_0x45d67c][_0x2527('0x1a')](_0x56ef82[_0x2527('0x18')],{'transaction':_0x1a27db}));}return BPromise[_0x2527('0x2c')](_0x52cb81);});})[_0x2527('0xe')](function(_0x569a0e){logger[_0x2527('0xf')](_0x2527('0x39'),_0x56ef82);logger[_0x2527('0x1d')](_0x2527('0x39'),_0x56ef82,JSON[_0x2527('0x10')](_0x569a0e));_0x386f08(_0x569a0e);})[_0x2527('0x11')](function(_0x36b18d){logger[_0x2527('0x12')](_0x2527('0x39'),_0x36b18d[_0x2527('0x13')],_0x56ef82);_0x2546ae(_0x517614[_0x2527('0x12')](0x1f4,_0x36b18d[_0x2527('0x13')]));});});});};exports[_0x2527('0x3c')]=function(_0x1e94ee){var _0x162c25=this;return new Promise(function(_0x3fe2a3,_0x55ac44){db[_0x2527('0x24')][_0x2527('0x1f')]()['then'](function(_0x4fd12d){return db[_0x2527('0x5')][_0x2527('0x6')]({'raw':_0x1e94ee[_0x2527('0x7')]?_0x1e94ee['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e94ee[_0x2527('0x7')]?_0x1e94ee[_0x2527('0x7')][_0x2527('0x15')]||null:null,'attributes':_0x1e94ee[_0x2527('0x7')]?_0x1e94ee[_0x2527('0x7')][_0x2527('0x9')]||null:null,'limit':_0x1e94ee['options']?_0x1e94ee['options'][_0x2527('0xa')]||null:null,'include':_0x1e94ee[_0x2527('0x7')]?_0x1e94ee[_0x2527('0x7')][_0x2527('0xb')]?_[_0x2527('0xc')](_0x1e94ee[_0x2527('0x7')]['include'],function(_0x5e8347){return{'model':db[_0x5e8347[_0x2527('0xd')]],'as':_0x5e8347['as'],'attributes':_0x5e8347['as']===_0x2527('0x25')?_[_0x2527('0x26')](_0x4fd12d):_0x5e8347[_0x2527('0x9')],'include':_0x5e8347[_0x2527('0xb')]?_[_0x2527('0xc')](_0x5e8347['include'],function(_0xd334be){return{'model':db[_0xd334be[_0x2527('0xd')]],'as':_0xd334be['as'],'attributes':_0xd334be[_0x2527('0x9')],'include':_0xd334be[_0x2527('0xb')]?_[_0x2527('0xc')](_0xd334be[_0x2527('0xb')],function(_0x38a47e){return{'model':db[_0x38a47e[_0x2527('0xd')]],'as':_0x38a47e['as'],'attributes':_0x38a47e[_0x2527('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3414fe){logger[_0x2527('0xf')](_0x2527('0x4'),_0x1e94ee);logger[_0x2527('0x1d')](_0x2527('0x4'),_0x1e94ee,JSON[_0x2527('0x10')](_0x3414fe));_0x3fe2a3(_0x3414fe);})[_0x2527('0x11')](function(_0x2f74b1){logger['error'](_0x2527('0x4'),_0x2f74b1[_0x2527('0x13')],_0x1e94ee);_0x55ac44(_0x162c25[_0x2527('0x12')](0x1f4,_0x2f74b1['message']));});});});};exports[_0x2527('0x3d')]=function(_0x1aac6f){var _0x57882a=this;return new Promise(function(_0x278a93,_0x33e28c){return db[_0x2527('0x24')]['findOne']({'raw':!![],'where':{'phone':_0x1aac6f['options'][_0x2527('0x15')][_0x2527('0x3e')]},'attributes':['id',_0x2527('0x3f')],'order':[['id','DESC']]})[_0x2527('0xe')](function(_0x5ce266){logger[_0x2527('0xf')](_0x2527('0x40'),_0x1aac6f);logger[_0x2527('0x1d')](_0x2527('0x40'),_0x1aac6f,JSON[_0x2527('0x10')](_0x5ce266));_0x278a93(_0x5ce266);})[_0x2527('0x11')](function(_0x359715){logger['error'](_0x2527('0x40'),_0x359715[_0x2527('0x13')],_0x1aac6f);_0x33e28c(_0x57882a[_0x2527('0x12')](0x1f4,_0x359715[_0x2527('0x13')]));});});};exports['ResetActiveCalls']=function(_0x431aef){var _0x29a6db=this;return new Promise(function(_0x44add5,_0x5d2397){return db[_0x2527('0x20')]['transaction'](function(_0x521782){var _0x32a6c9=_0x431aef['options']&&_0x431aef[_0x2527('0x7')][_0x2527('0x15')]?_0x431aef[_0x2527('0x7')][_0x2527('0x15')]:{};return db[_0x2527('0x5')][_0x2527('0x1a')](_0x431aef[_0x2527('0x18')],{'where':_0x32a6c9,'transaction':_0x521782})['then'](function(_0x491625){logger[_0x2527('0xf')](_0x2527('0x41'),_0x431aef);logger['debug'](_0x2527('0x41'),_0x431aef,JSON[_0x2527('0x10')](_0x491625));_0x44add5(_0x491625);})[_0x2527('0x11')](function(_0x49e1f9){logger[_0x2527('0x12')](_0x2527('0x41'),_0x49e1f9[_0x2527('0x13')],_0x431aef);_0x5d2397(_0x29a6db[_0x2527('0x12')](0x1f4,_0x49e1f9[_0x2527('0x13')]));});});});};exports[_0x2527('0x42')]=function(_0x3a1072){var _0x3de570=this;var _0x1f0b66=_0x3a1072[_0x2527('0x18')][_0x2527('0x15')][_0x2527('0x43')];var _0x17cc19=_0x3a1072[_0x2527('0x18')][_0x2527('0x15')][_0x2527('0x44')];var _0x32e918=_0x3a1072[_0x2527('0x18')][_0x2527('0x15')][_0x2527('0x45')];return new Promise(function(_0x1954b2,_0x362be9){return db['CmHopper'][_0x2527('0x6')]({'where':{'voiceQueueId':{'$in':_0x1f0b66},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2527('0x20')][_0x2527('0x46')]('NOW()\x20+\x20INTERVAL\x20'+_0x17cc19+_0x2527('0x47')),'$gt':db[_0x2527('0x20')][_0x2527('0x46')]('NOW()')}},'UserId':{'$in':_0x32e918}},'include':[{'model':db['CmContact'],'as':_0x2527('0x25')},{'model':db[_0x2527('0x27')],'as':'Agent','attributes':['id',_0x2527('0x48'),'voicePause']},{'model':db[_0x2527('0x49')],'as':'List'}]})[_0x2527('0xe')](function(_0x247d3d){if(_0x247d3d[_0x2527('0x29')]>0x0){return db[_0x2527('0x20')][_0x2527('0x21')](function(_0xc56254){return db[_0x2527('0x5')][_0x2527('0x1a')]({'recallmeNotifiedDate':db['sequelize'][_0x2527('0x46')](_0x2527('0x4a'))},{'where':{'id':{'$in':_[_0x2527('0xc')](_0x247d3d,'id')}},'transaction':_0xc56254})[_0x2527('0xe')](function(){_0x1954b2(_0x247d3d);})[_0x2527('0x11')](function(_0x245396){logger['error'](_0x2527('0x42'),_0x245396[_0x2527('0x13')],_0x3a1072);_0x362be9(_0x3de570[_0x2527('0x12')](0x1f4,_0x245396[_0x2527('0x13')]));});})['catch'](function(_0x51e719){logger[_0x2527('0x12')](_0x2527('0x42'),_0x51e719[_0x2527('0x13')],_0x3a1072);_0x362be9(_0x3de570[_0x2527('0x12')](0x1f4,_0x51e719[_0x2527('0x13')]));});}else{_0x1954b2(_0x247d3d);}});});}; \ No newline at end of file +var _0xf576=['describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','name','voicePause','length','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','order','UserId','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','CmHopper','findAll','options','raw','attributes','limit','include','map','model','info','GetCmHopper','debug','stringify','catch','error','message','where','then','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer'];(function(_0x895d11,_0x307122){var _0x3bffdd=function(_0x13d387){while(--_0x13d387){_0x895d11['push'](_0x895d11['shift']());}};_0x3bffdd(++_0x307122);}(_0xf576,0x1ba));var _0x6f57=function(_0x1d936e,_0x2185c8){_0x1d936e=_0x1d936e-0x0;var _0xb1feb0=_0xf576[_0x1d936e];return _0xb1feb0;};'use strict';var _=require(_0x6f57('0x0'));var util=require(_0x6f57('0x1'));var moment=require(_0x6f57('0x2'));var BPromise=require(_0x6f57('0x3'));var db=require(_0x6f57('0x4'))['db'];var logger=require(_0x6f57('0x5'))('rpc');exports['GetCmHopper']=function(_0x4dc18d){var _0x6fc3d=this;return new Promise(function(_0x1384ae,_0x1c1e11){return db[_0x6f57('0x6')][_0x6f57('0x7')]({'raw':_0x4dc18d[_0x6f57('0x8')]?_0x4dc18d[_0x6f57('0x8')][_0x6f57('0x9')]===undefined?!![]:![]:!![],'where':_0x4dc18d[_0x6f57('0x8')]?_0x4dc18d[_0x6f57('0x8')]['where']||null:null,'attributes':_0x4dc18d[_0x6f57('0x8')]?_0x4dc18d[_0x6f57('0x8')][_0x6f57('0xa')]||null:null,'limit':_0x4dc18d[_0x6f57('0x8')]?_0x4dc18d[_0x6f57('0x8')][_0x6f57('0xb')]||null:null,'include':_0x4dc18d['options']?_0x4dc18d[_0x6f57('0x8')][_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x4dc18d[_0x6f57('0x8')][_0x6f57('0xc')],function(_0x2aaa07){return{'model':db[_0x2aaa07[_0x6f57('0xe')]],'as':_0x2aaa07['as'],'attributes':_0x2aaa07[_0x6f57('0xa')],'include':_0x2aaa07[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x2aaa07['include'],function(_0xdb6795){return{'model':db[_0xdb6795[_0x6f57('0xe')]],'as':_0xdb6795['as'],'attributes':_0xdb6795[_0x6f57('0xa')],'include':_0xdb6795['include']?_[_0x6f57('0xd')](_0xdb6795['include'],function(_0x364d2b){return{'model':db[_0x364d2b[_0x6f57('0xe')]],'as':_0x364d2b['as'],'attributes':_0x364d2b[_0x6f57('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55252f){logger[_0x6f57('0xf')](_0x6f57('0x10'),_0x4dc18d);logger[_0x6f57('0x11')](_0x6f57('0x10'),_0x4dc18d,JSON[_0x6f57('0x12')](_0x55252f));_0x1384ae(_0x55252f);})[_0x6f57('0x13')](function(_0xcfc5b){logger[_0x6f57('0x14')](_0x6f57('0x10'),_0xcfc5b[_0x6f57('0x15')],_0x4dc18d);_0x1c1e11(_0x6fc3d['error'](0x1f4,_0xcfc5b[_0x6f57('0x15')]));});});};exports['ShowCmHopper']=function(_0x11c24d){var _0x33131e=this;return new Promise(function(_0x4ac122,_0x3a7614){return db[_0x6f57('0x6')]['find']({'raw':_0x11c24d['options']?_0x11c24d[_0x6f57('0x8')][_0x6f57('0x9')]===undefined?!![]:![]:!![],'where':_0x11c24d[_0x6f57('0x8')]?_0x11c24d[_0x6f57('0x8')][_0x6f57('0x16')]||null:null,'attributes':_0x11c24d[_0x6f57('0x8')]?_0x11c24d[_0x6f57('0x8')][_0x6f57('0xa')]||null:null,'include':_0x11c24d[_0x6f57('0x8')]?_0x11c24d[_0x6f57('0x8')][_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x11c24d[_0x6f57('0x8')][_0x6f57('0xc')],function(_0x42134b){return{'model':db[_0x42134b[_0x6f57('0xe')]],'as':_0x42134b['as'],'attributes':_0x42134b[_0x6f57('0xa')],'include':_0x42134b[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x42134b[_0x6f57('0xc')],function(_0x5a48b2){return{'model':db[_0x5a48b2[_0x6f57('0xe')]],'as':_0x5a48b2['as'],'attributes':_0x5a48b2[_0x6f57('0xa')],'include':_0x5a48b2[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x5a48b2[_0x6f57('0xc')],function(_0x4ab319){return{'model':db[_0x4ab319['model']],'as':_0x4ab319['as'],'attributes':_0x4ab319[_0x6f57('0xa')]};}):[]};}):[]};}):[]:[]})[_0x6f57('0x17')](function(_0x30ad46){logger['info'](_0x6f57('0x18'),_0x11c24d);logger[_0x6f57('0x11')]('ShowCmHopper',_0x11c24d,JSON[_0x6f57('0x12')](_0x30ad46));_0x4ac122(_0x30ad46);})[_0x6f57('0x13')](function(_0x40bab8){logger[_0x6f57('0x14')](_0x6f57('0x18'),_0x40bab8[_0x6f57('0x15')],_0x11c24d);_0x3a7614(_0x33131e[_0x6f57('0x14')](0x1f4,_0x40bab8[_0x6f57('0x15')]));});});};exports['CreateCmHopper']=function(_0x1d288e){var _0x2b7c5e=this;return new Promise(function(_0x3e478d,_0x2bea3a){return db[_0x6f57('0x6')][_0x6f57('0x19')](_0x1d288e[_0x6f57('0x1a')],{'raw':_0x1d288e[_0x6f57('0x8')]?_0x1d288e[_0x6f57('0x8')][_0x6f57('0x9')]===undefined?!![]:![]:!![]})[_0x6f57('0x17')](function(_0x38b777){logger[_0x6f57('0xf')]('CreateCmHopper',_0x1d288e);logger[_0x6f57('0x11')]('CreateCmHopper',_0x1d288e,JSON[_0x6f57('0x12')](_0x38b777));_0x3e478d(_0x38b777);})['catch'](function(_0x30d4b9){logger[_0x6f57('0x14')](_0x6f57('0x1b'),_0x30d4b9[_0x6f57('0x15')],_0x1d288e);_0x2bea3a(_0x2b7c5e[_0x6f57('0x14')](0x1f4,_0x30d4b9[_0x6f57('0x15')]));});});};exports[_0x6f57('0x1c')]=function(_0x46e82c){var _0x1afedf=this;return new Promise(function(_0x2e0bb0,_0x1c85d8){return db[_0x6f57('0x6')][_0x6f57('0x1d')](_0x46e82c[_0x6f57('0x1a')],{'raw':_0x46e82c[_0x6f57('0x8')]?_0x46e82c['options'][_0x6f57('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e82c[_0x6f57('0x8')]?_0x46e82c[_0x6f57('0x8')][_0x6f57('0x16')]||null:null,'attributes':_0x46e82c['options']?_0x46e82c[_0x6f57('0x8')][_0x6f57('0xa')]||null:null,'limit':_0x46e82c[_0x6f57('0x8')]?_0x46e82c[_0x6f57('0x8')][_0x6f57('0xb')]||null:null})[_0x6f57('0x17')](function(_0x3c5eff){logger['info']('UpdateCmHopper',_0x46e82c);logger[_0x6f57('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6f57('0x12')](_0x46e82c[_0x6f57('0x8')][_0x6f57('0x16')]),_0x46e82c['body']['active']);logger['debug'](_0x6f57('0x1c'),_0x46e82c,JSON[_0x6f57('0x12')](_0x3c5eff));_0x2e0bb0(_0x3c5eff);})['catch'](function(_0x1738ac){logger[_0x6f57('0x14')](_0x6f57('0x1c'),_0x1738ac[_0x6f57('0x15')],_0x46e82c);_0x1c85d8(_0x1afedf['error'](0x1f4,_0x1738ac[_0x6f57('0x15')]));});});};exports[_0x6f57('0x1e')]=function(_0x1a05be){var _0x5d3265=this;return new Promise(function(_0x261c12,_0x5981fe){return db[_0x6f57('0x6')]['destroy']({'where':_0x1a05be[_0x6f57('0x8')]?_0x1a05be[_0x6f57('0x8')][_0x6f57('0x16')]||null:null})[_0x6f57('0x17')](function(_0x2b2e15){logger[_0x6f57('0xf')]('DestroyCmHopper',_0x1a05be);logger['debug'](_0x6f57('0x1e'),_0x1a05be,JSON[_0x6f57('0x12')](_0x2b2e15));_0x261c12(_0x2b2e15);})[_0x6f57('0x13')](function(_0xcd5a76){logger['error'](_0x6f57('0x1e'),_0xcd5a76[_0x6f57('0x15')],_0x1a05be);_0x5981fe(_0x5d3265['error'](0x1f4,_0xcd5a76['message']));});});};exports[_0x6f57('0x1f')]=function(_0x3b24ee){var _0x29ba84=this;return new Promise(function(_0x6c44c8,_0x45b58c){return db['CmContact'][_0x6f57('0x20')]()[_0x6f57('0x17')](function(_0x110884){return db[_0x6f57('0x21')][_0x6f57('0x22')](function(_0x5e9714){return db[_0x6f57('0x6')][_0x6f57('0x7')]({'where':_0x3b24ee[_0x6f57('0x8')]?_0x3b24ee[_0x6f57('0x8')][_0x6f57('0x16')]||null:null,'attributes':_0x3b24ee[_0x6f57('0x8')]?_0x3b24ee[_0x6f57('0x8')][_0x6f57('0xa')]||null:null,'limit':_0x3b24ee[_0x6f57('0x8')]?_0x3b24ee['options'][_0x6f57('0xb')]||null:null,'order':_0x3b24ee['options']?_0x3b24ee[_0x6f57('0x8')]['order']||null:null,'transaction':_0x5e9714,'lock':_0x5e9714[_0x6f57('0x23')][_0x6f57('0x24')],'include':[{'model':db['CmContact'],'as':_0x6f57('0x25'),'attributes':_[_0x6f57('0x26')](_0x110884)},{'model':db[_0x6f57('0x27')],'as':'Agent','attributes':['id',_0x6f57('0x28'),_0x6f57('0x29')]}]})[_0x6f57('0x17')](function(_0x178f7f){var _0x47ebc1=[];var _0x1fa460=[];for(var _0x1c727a=0x0;_0x1c727a<_0x178f7f[_0x6f57('0x2a')];_0x1c727a+=0x1){var _0x1df8a2=_0x178f7f[_0x1c727a]['UserId'];if(_0x1df8a2===null){_0x47ebc1[_0x6f57('0x2b')](_0x178f7f[_0x1c727a][_0x6f57('0x1d')](_0x3b24ee['body'],{'transaction':_0x5e9714}));}else if(!_0x1fa460['includes'](_0x1df8a2)){_0x1fa460[_0x6f57('0x2b')](_0x1df8a2);_0x47ebc1[_0x6f57('0x2b')](_0x178f7f[_0x1c727a][_0x6f57('0x1d')](_0x3b24ee[_0x6f57('0x1a')],{'transaction':_0x5e9714}));}}return BPromise[_0x6f57('0x2c')](_0x47ebc1);});})[_0x6f57('0x17')](function(_0x3b3994){logger[_0x6f57('0xf')](_0x6f57('0x1f'),_0x3b24ee);if(_0x3b3994[_0x6f57('0x2a')]>0x0){logger[_0x6f57('0xf')](_0x6f57('0x2d'),_0x3b3994[0x0][_0x6f57('0x2e')]['id'],_0x3b3994[0x0]['dataValues'][_0x6f57('0x2f')],_0x3b3994[0x0][_0x6f57('0x2e')][_0x6f57('0x30')]);}logger[_0x6f57('0x11')](_0x6f57('0x1f'),_0x3b24ee,JSON[_0x6f57('0x12')](_0x3b3994));_0x6c44c8(_0x3b3994);})[_0x6f57('0x13')](function(_0x333fd9){logger[_0x6f57('0x14')](_0x6f57('0x1f'),_0x333fd9[_0x6f57('0x15')],_0x3b24ee);_0x45b58c(_0x29ba84[_0x6f57('0x14')](0x1f4,_0x333fd9[_0x6f57('0x15')]));});});});};exports[_0x6f57('0x31')]=function(_0x2043ef){var _0x21c91c=this;return new Promise(function(_0x2d9839,_0x9c5d22){return db['sequelize'][_0x6f57('0x22')](function(_0x9635f1){return db[_0x6f57('0x32')]['create'](_0x2043ef[_0x6f57('0x1a')],{'raw':_0x2043ef['options']?_0x2043ef[_0x6f57('0x8')][_0x6f57('0x9')]===undefined?!![]:![]:!![],'transaction':_0x9635f1})[_0x6f57('0x17')](function(){logger[_0x6f57('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x6f57('0x12')](_0x2043ef['options']['where']),_0x2043ef[_0x6f57('0x8')][_0x6f57('0x16')][_0x6f57('0x30')]);return db[_0x6f57('0x6')]['destroy']({'where':_0x2043ef['options']?_0x2043ef[_0x6f57('0x8')][_0x6f57('0x16')]||null:null,'transaction':_0x9635f1});});})[_0x6f57('0x17')](function(_0xfd5e1f){logger['info'](_0x6f57('0x31'),_0x2043ef);logger['debug'](_0x6f57('0x31'),_0x2043ef,JSON[_0x6f57('0x12')](_0xfd5e1f));_0x2d9839(_0xfd5e1f);})[_0x6f57('0x13')](function(_0x2b053a){logger[_0x6f57('0x14')]('MoveContactManagedDialer',_0x2b053a[_0x6f57('0x15')],_0x2043ef);_0x9c5d22(_0x21c91c['error'](0x1f4,_0x2b053a['message']));});});};exports[_0x6f57('0x33')]=function(_0x5750d3){var _0xb6f518=this;return new Promise(function(_0x5815e2,_0x58e60f){return db['CmHopper'][_0x6f57('0x7')]({'raw':_0x5750d3[_0x6f57('0x8')]?_0x5750d3[_0x6f57('0x8')][_0x6f57('0x9')]===undefined?!![]:![]:!![],'where':_0x5750d3['options']?_0x5750d3['options'][_0x6f57('0x16')]||null:null,'attributes':[[db[_0x6f57('0x21')]['fn'](_0x6f57('0x34'),db['sequelize']['fn']('IF',db[_0x6f57('0x21')][_0x6f57('0x35')](_0x6f57('0x36')+util[_0x6f57('0x37')]('\x22%s\x22',moment()[_0x6f57('0x37')](_0x6f57('0x38')))+_0x6f57('0x39')))),_0x6f57('0x3a')]]})[_0x6f57('0x17')](function(_0x244cad){logger[_0x6f57('0xf')]('CountReScheduled',_0x5750d3);logger[_0x6f57('0x11')](_0x6f57('0x33'),_0x5750d3,JSON['stringify'](_0x244cad));_0x5815e2(_0x244cad);})['catch'](function(_0x7b7663){logger['error'](_0x6f57('0x33'),_0x7b7663[_0x6f57('0x15')],_0x5750d3);_0x58e60f(_0xb6f518[_0x6f57('0x14')](0x1f4,_0x7b7663[_0x6f57('0x15')]));});});};exports[_0x6f57('0x3b')]=function(_0x77d66c){var _0x4c6e4d=this;return new Promise(function(_0x181e29,_0x34adb7){return db[_0x6f57('0x3c')][_0x6f57('0x20')]()[_0x6f57('0x17')](function(){return db[_0x6f57('0x21')][_0x6f57('0x22')](function(_0x29e349){return db[_0x6f57('0x6')][_0x6f57('0x7')]({'where':_0x77d66c[_0x6f57('0x8')]?_0x77d66c['options'][_0x6f57('0x16')]||null:null,'attributes':_0x77d66c[_0x6f57('0x8')]?_0x77d66c[_0x6f57('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x77d66c['options']?_0x77d66c['options'][_0x6f57('0x3d')]||null:null,'group':db[_0x6f57('0x6')][_0x6f57('0x3e')],'transaction':_0x29e349,'lock':_0x29e349['LOCK'][_0x6f57('0x24')],'include':_0x77d66c[_0x6f57('0x8')]?_0x77d66c[_0x6f57('0x8')]['include']?_[_0x6f57('0xd')](_0x77d66c[_0x6f57('0x8')][_0x6f57('0xc')],function(_0x2f5282){return{'model':db[_0x2f5282[_0x6f57('0xe')]],'as':_0x2f5282['as'],'attributes':_0x2f5282['attributes'],'include':_0x2f5282[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x2f5282['include'],function(_0x3df445){return{'model':db[_0x3df445[_0x6f57('0xe')]],'as':_0x3df445['as'],'attributes':_0x3df445[_0x6f57('0xa')],'include':_0x3df445[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x3df445[_0x6f57('0xc')],function(_0x554b47){return{'model':db[_0x554b47[_0x6f57('0xe')]],'as':_0x554b47['as'],'attributes':_0x554b47['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f57('0x17')](function(_0x1732f3){var _0x46d73e=[];for(var _0x434735=0x0;_0x434735<_0x1732f3[_0x6f57('0x2a')];_0x434735+=0x1){_0x46d73e[_0x6f57('0x2b')](_0x1732f3[_0x434735]['update'](_0x77d66c['body'],{'transaction':_0x29e349}));}return BPromise[_0x6f57('0x2c')](_0x46d73e);});})[_0x6f57('0x17')](function(_0x22ca79){logger['info']('GetContactRecallMe',_0x77d66c);logger[_0x6f57('0x11')](_0x6f57('0x3b'),_0x77d66c,JSON[_0x6f57('0x12')](_0x22ca79));_0x181e29(_0x22ca79);})[_0x6f57('0x13')](function(_0x43baaf){logger[_0x6f57('0x14')](_0x6f57('0x3b'),_0x43baaf['message'],_0x77d66c);_0x34adb7(_0x4c6e4d[_0x6f57('0x14')](0x1f4,_0x43baaf[_0x6f57('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x51777d){var _0x309b92=this;return new Promise(function(_0x25f7ac,_0xffd824){db[_0x6f57('0x3c')][_0x6f57('0x20')]()[_0x6f57('0x17')](function(_0xb38e37){return db[_0x6f57('0x6')][_0x6f57('0x7')]({'raw':_0x51777d[_0x6f57('0x8')]?_0x51777d['options'][_0x6f57('0x9')]===undefined?!![]:![]:!![],'where':_0x51777d['options']?_0x51777d[_0x6f57('0x8')][_0x6f57('0x16')]||null:null,'attributes':_0x51777d[_0x6f57('0x8')]?_0x51777d[_0x6f57('0x8')][_0x6f57('0xa')]||null:null,'limit':_0x51777d['options']?_0x51777d['options'][_0x6f57('0xb')]||null:null,'include':_0x51777d['options']?_0x51777d[_0x6f57('0x8')][_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x51777d['options'][_0x6f57('0xc')],function(_0x509ee4){return{'model':db[_0x509ee4[_0x6f57('0xe')]],'as':_0x509ee4['as'],'attributes':_0x509ee4['as']===_0x6f57('0x25')?_[_0x6f57('0x26')](_0xb38e37):_0x509ee4[_0x6f57('0xa')],'include':_0x509ee4[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x509ee4[_0x6f57('0xc')],function(_0x4a3181){return{'model':db[_0x4a3181[_0x6f57('0xe')]],'as':_0x4a3181['as'],'attributes':_0x4a3181[_0x6f57('0xa')],'include':_0x4a3181[_0x6f57('0xc')]?_[_0x6f57('0xd')](_0x4a3181[_0x6f57('0xc')],function(_0x329fd4){return{'model':db[_0x329fd4[_0x6f57('0xe')]],'as':_0x329fd4['as'],'attributes':_0x329fd4[_0x6f57('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa1900e){logger['info']('GetCmHopper',_0x51777d);logger['debug'](_0x6f57('0x10'),_0x51777d,JSON[_0x6f57('0x12')](_0xa1900e));_0x25f7ac(_0xa1900e);})[_0x6f57('0x13')](function(_0x44bc2f){logger['error'](_0x6f57('0x10'),_0x44bc2f[_0x6f57('0x15')],_0x51777d);_0xffd824(_0x309b92[_0x6f57('0x14')](0x1f4,_0x44bc2f['message']));});});});};exports[_0x6f57('0x3f')]=function(_0x1027a3){var _0x1949dd=this;return new Promise(function(_0x1240b6,_0x2a1484){return db[_0x6f57('0x3c')][_0x6f57('0x40')]({'raw':!![],'where':{'phone':_0x1027a3[_0x6f57('0x8')][_0x6f57('0x16')]['phone']},'attributes':['id',_0x6f57('0x41')],'order':[['id',_0x6f57('0x42')]]})[_0x6f57('0x17')](function(_0xbf1c5d){logger[_0x6f57('0xf')](_0x6f57('0x43'),_0x1027a3);logger['debug'](_0x6f57('0x43'),_0x1027a3,JSON['stringify'](_0xbf1c5d));_0x1240b6(_0xbf1c5d);})[_0x6f57('0x13')](function(_0x535892){logger[_0x6f57('0x14')]('getContactByPhone',_0x535892['message'],_0x1027a3);_0x2a1484(_0x1949dd[_0x6f57('0x14')](0x1f4,_0x535892[_0x6f57('0x15')]));});});};exports[_0x6f57('0x44')]=function(_0x19fd5e){var _0x5ddbc6=this;return new Promise(function(_0x322059,_0x213779){return db[_0x6f57('0x21')][_0x6f57('0x22')](function(_0x2c29f6){var _0x11a36f=_0x19fd5e['options']&&_0x19fd5e[_0x6f57('0x8')]['where']?_0x19fd5e[_0x6f57('0x8')]['where']:{};return db[_0x6f57('0x6')][_0x6f57('0x1d')](_0x19fd5e[_0x6f57('0x1a')],{'where':_0x11a36f,'transaction':_0x2c29f6})['then'](function(_0x2c5182){logger[_0x6f57('0xf')]('ResetActiveCalls',_0x19fd5e);logger[_0x6f57('0x11')](_0x6f57('0x44'),_0x19fd5e,JSON[_0x6f57('0x12')](_0x2c5182));_0x322059(_0x2c5182);})['catch'](function(_0x29b960){logger['error'](_0x6f57('0x44'),_0x29b960[_0x6f57('0x15')],_0x19fd5e);_0x213779(_0x5ddbc6[_0x6f57('0x14')](0x1f4,_0x29b960[_0x6f57('0x15')]));});});});};exports[_0x6f57('0x45')]=function(_0x55011b){var _0x36bcd7=this;var _0x26e36f=_0x55011b[_0x6f57('0x1a')][_0x6f57('0x16')][_0x6f57('0x46')];var _0x114ad0=_0x55011b[_0x6f57('0x1a')][_0x6f57('0x16')][_0x6f57('0x47')];var _0x41bb0c=_0x55011b[_0x6f57('0x1a')][_0x6f57('0x16')][_0x6f57('0x48')];return new Promise(function(_0x406327,_0x3ba4a7){return db[_0x6f57('0x6')][_0x6f57('0x7')]({'where':{'voiceQueueId':{'$in':_0x26e36f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6f57('0x21')][_0x6f57('0x35')](_0x6f57('0x49')+_0x114ad0+_0x6f57('0x4a')),'$gt':db[_0x6f57('0x21')]['literal'](_0x6f57('0x4b'))}},'UserId':{'$in':_0x41bb0c}},'include':[{'model':db[_0x6f57('0x3c')],'as':_0x6f57('0x25')},{'model':db[_0x6f57('0x27')],'as':_0x6f57('0x4c'),'attributes':['id','name',_0x6f57('0x29')]},{'model':db[_0x6f57('0x4d')],'as':_0x6f57('0x4e')}]})[_0x6f57('0x17')](function(_0x3023ab){if(_0x3023ab[_0x6f57('0x2a')]>0x0){return db['sequelize']['transaction'](function(_0x317be2){return db[_0x6f57('0x6')][_0x6f57('0x1d')]({'recallmeNotifiedDate':db[_0x6f57('0x21')][_0x6f57('0x35')]('NOW()')},{'where':{'id':{'$in':_[_0x6f57('0xd')](_0x3023ab,'id')}},'transaction':_0x317be2})[_0x6f57('0x17')](function(){_0x406327(_0x3023ab);})[_0x6f57('0x13')](function(_0x3ee947){logger[_0x6f57('0x14')](_0x6f57('0x45'),_0x3ee947[_0x6f57('0x15')],_0x55011b);_0x3ba4a7(_0x36bcd7[_0x6f57('0x14')](0x1f4,_0x3ee947[_0x6f57('0x15')]));});})[_0x6f57('0x13')](function(_0x2ebeb4){logger[_0x6f57('0x14')](_0x6f57('0x45'),_0x2ebeb4[_0x6f57('0x15')],_0x55011b);_0x3ba4a7(_0x36bcd7[_0x6f57('0x14')](0x1f4,_0x2ebeb4['message']));});}else{_0x406327(_0x3023ab);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 523ab12..f01ac84 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 _0xb45c=['post','/preview','getPreview','/timezone','getTimezone','put','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','getTimezones','/:id','show','getPreviewRecall'];(function(_0x512eb8,_0x19509e){var _0x317d8c=function(_0x38f9fa){while(--_0x38f9fa){_0x512eb8['push'](_0x512eb8['shift']());}};_0x317d8c(++_0x19509e);}(_0xb45c,0x110));var _0xcb45=function(_0x5a34d2,_0x58ca41){_0x5a34d2=_0x5a34d2-0x0;var _0x29ac07=_0xb45c[_0x5a34d2];return _0x29ac07;};'use strict';var express=require(_0xcb45('0x0'));var router=express[_0xcb45('0x1')]();var auth=require(_0xcb45('0x2'));var controller=require(_0xcb45('0x3'));router[_0xcb45('0x4')]('/',auth['isAuthenticated'](),controller[_0xcb45('0x5')]);router[_0xcb45('0x4')](_0xcb45('0x6'),auth[_0xcb45('0x7')](),controller[_0xcb45('0x8')]);router['get'](_0xcb45('0x9'),auth[_0xcb45('0x7')](),controller['getOpenContacts']);router[_0xcb45('0x4')]('/timezones',auth[_0xcb45('0x7')](),controller[_0xcb45('0xa')]);router[_0xcb45('0x4')](_0xcb45('0xb'),auth[_0xcb45('0x7')](),controller[_0xcb45('0xc')]);router[_0xcb45('0x4')]('/:id/previewrecall',auth[_0xcb45('0x7')](),controller[_0xcb45('0xd')]);router[_0xcb45('0xe')]('/',auth[_0xcb45('0x7')](),controller['create']);router[_0xcb45('0xe')](_0xcb45('0xf'),auth[_0xcb45('0x7')](),controller[_0xcb45('0x10')]);router[_0xcb45('0xe')](_0xcb45('0x11'),auth[_0xcb45('0x7')](),controller[_0xcb45('0x12')]);router[_0xcb45('0x13')]('/:id',auth[_0xcb45('0x7')](),controller['update']);router[_0xcb45('0x14')](_0xcb45('0xb'),auth[_0xcb45('0x7')](),controller['destroy']);module[_0xcb45('0x15')]=router; \ No newline at end of file +var _0xcbd1=['destroy','exports','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcbd1,0x66));var _0x1cbd=function(_0x59590b,_0x31d6de){_0x59590b=_0x59590b-0x0;var _0x16e2e4=_0xcbd1[_0x59590b];return _0x16e2e4;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1cbd('0x0'));router[_0x1cbd('0x1')]('/',auth[_0x1cbd('0x2')](),controller[_0x1cbd('0x3')]);router[_0x1cbd('0x1')](_0x1cbd('0x4'),auth[_0x1cbd('0x2')](),controller[_0x1cbd('0x5')]);router[_0x1cbd('0x1')]('/opencontacts',auth['isAuthenticated'](),controller[_0x1cbd('0x6')]);router[_0x1cbd('0x1')](_0x1cbd('0x7'),auth[_0x1cbd('0x2')](),controller[_0x1cbd('0x8')]);router[_0x1cbd('0x1')](_0x1cbd('0x9'),auth[_0x1cbd('0x2')](),controller['show']);router[_0x1cbd('0x1')]('/:id/previewrecall',auth[_0x1cbd('0x2')](),controller[_0x1cbd('0xa')]);router[_0x1cbd('0xb')]('/',auth[_0x1cbd('0x2')](),controller[_0x1cbd('0xc')]);router['post'](_0x1cbd('0xd'),auth[_0x1cbd('0x2')](),controller[_0x1cbd('0xe')]);router[_0x1cbd('0xb')](_0x1cbd('0xf'),auth[_0x1cbd('0x2')](),controller['getTimezone']);router[_0x1cbd('0x10')]('/:id',auth[_0x1cbd('0x2')](),controller[_0x1cbd('0x11')]);router['delete'](_0x1cbd('0x9'),auth[_0x1cbd('0x2')](),controller[_0x1cbd('0x12')]);module[_0x1cbd('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ed15ba2..f42c92d 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 _0xa7e8=['sequelize','INTEGER','STRING','DATE','moment'];(function(_0x33db0c,_0x1dd7f5){var _0x3ce823=function(_0x5949fb){while(--_0x5949fb){_0x33db0c['push'](_0x33db0c['shift']());}};_0x3ce823(++_0x1dd7f5);}(_0xa7e8,0x11c));var _0x8a7e=function(_0x402b80,_0x556412){_0x402b80=_0x402b80-0x0;var _0x327d64=_0xa7e8[_0x402b80];return _0x327d64;};'use strict';var moment=require(_0x8a7e('0x0'));var Sequelize=require(_0x8a7e('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x8a7e('0x2')]},'phone':{'type':Sequelize[_0x8a7e('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8a7e('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a7e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb6fb=['INTEGER','moment','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x45c5f9,_0x1ad8c9){var _0x22cc60=function(_0x292959){while(--_0x292959){_0x45c5f9['push'](_0x45c5f9['shift']());}};_0x22cc60(++_0x1ad8c9);}(_0xb6fb,0x189));var _0xbb6f=function(_0x13828e,_0x32cdf1){_0x13828e=_0x13828e-0x0;var _0x4ac126=_0xb6fb[_0x13828e];return _0x4ac126;};'use strict';var moment=require(_0xbb6f('0x0'));var Sequelize=require(_0xbb6f('0x1'));module[_0xbb6f('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xbb6f('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xbb6f('0x4')],'defaultValue':moment()['format'](_0xbb6f('0x5'))},'countbusyretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb6f('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb6f('0x6')],'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 00c0a37..d03eaed 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 _0xef29=['filter','merge','type','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','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/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','get','CmHopperAdditionalPhones','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef29,0x64));var _0x9ef2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xef29[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ef2('0x0'));var zipdir=require(_0x9ef2('0x1'));var jsonpatch=require(_0x9ef2('0x2'));var rp=require(_0x9ef2('0x3'));var moment=require(_0x9ef2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9ef2('0x5'));var sox=require(_0x9ef2('0x6'));var csv=require(_0x9ef2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ef2('0x8'));var _=require(_0x9ef2('0x9'));var squel=require(_0x9ef2('0xa'));var crypto=require(_0x9ef2('0xb'));var jsforce=require(_0x9ef2('0xc'));var deskjs=require(_0x9ef2('0xd'));var toCsv=require(_0x9ef2('0x7'));var querystring=require(_0x9ef2('0xe'));var Papa=require('papaparse');var Redis=require(_0x9ef2('0xf'));var authService=require(_0x9ef2('0x10'));var qs=require(_0x9ef2('0x11'));var as=require(_0x9ef2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ef2('0x13'))(_0x9ef2('0x14'));var utils=require(_0x9ef2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9ef2('0x16'));var db=require(_0x9ef2('0x17'))['db'];function respondWithStatusCode(_0x1f31f3,_0x2d9248){_0x2d9248=_0x2d9248||0xcc;return function(_0x547baf){if(_0x547baf){return _0x1f31f3['sendStatus'](_0x2d9248);}return _0x1f31f3[_0x9ef2('0x18')](_0x2d9248)[_0x9ef2('0x19')]();};}function respondWithResult(_0x16408f,_0x3921df){_0x3921df=_0x3921df||0xc8;return function(_0x173d3a){if(_0x173d3a){return _0x16408f[_0x9ef2('0x18')](_0x3921df)['json'](_0x173d3a);}};}function respondWithFilteredResult(_0x46f183,_0x55fc8c){return function(_0x2468b9){if(_0x2468b9){var _0x15fe44=typeof _0x55fc8c[_0x9ef2('0x1a')]===_0x9ef2('0x1b')&&typeof _0x55fc8c[_0x9ef2('0x1c')]==='undefined';var _0x186903=_0x2468b9['count'];var _0x116ae3=_0x15fe44?0x0:_0x55fc8c[_0x9ef2('0x1a')];var _0x242b94=_0x15fe44?_0x2468b9[_0x9ef2('0x1d')]:_0x55fc8c['offset']+_0x55fc8c['limit'];var _0x35f44b;if(_0x242b94>=_0x186903){_0x242b94=_0x186903;_0x35f44b=0xc8;}else{_0x35f44b=0xce;}_0x46f183[_0x9ef2('0x18')](_0x35f44b);return _0x46f183['set']('Content-Range',_0x116ae3+'-'+_0x242b94+'/'+_0x186903)[_0x9ef2('0x1e')](_0x2468b9);}return null;};}function patchUpdates(_0x2bede3){return function(_0x160321){try{jsonpatch[_0x9ef2('0x1f')](_0x160321,_0x2bede3,!![]);}catch(_0x21e340){return BPromise[_0x9ef2('0x20')](_0x21e340);}return _0x160321[_0x9ef2('0x21')]();};}function saveUpdates(_0x4f9273,_0x1f1723){return function(_0x203c33){if(_0x203c33){return _0x203c33[_0x9ef2('0x22')](_0x4f9273)[_0x9ef2('0x23')](function(_0x4da3ab){return _0x4da3ab;});}return null;};}function removeEntity(_0x119ae1,_0x185d1a){return function(_0x351c53){if(_0x351c53){return _0x351c53['destroy']()[_0x9ef2('0x23')](function(){var _0x4244ac=_0x351c53[_0x9ef2('0x24')]({'plain':!![]});var _0x1da100=_0x9ef2('0x25');return db['UserProfileResource'][_0x9ef2('0x26')]({'where':{'type':_0x1da100,'resourceId':_0x4244ac['id']}})[_0x9ef2('0x23')](function(){return _0x351c53;});})[_0x9ef2('0x23')](function(){_0x119ae1[_0x9ef2('0x18')](0xcc)[_0x9ef2('0x19')]();});}};}function handleEntityNotFound(_0x59793e,_0x3efc00){return function(_0x350a3e){if(!_0x350a3e){_0x59793e[_0x9ef2('0x27')](0x194);}return _0x350a3e;};}function handleError(_0x2fb554,_0x2ec8f1){_0x2ec8f1=_0x2ec8f1||0x1f4;return function(_0x1f62b5){logger[_0x9ef2('0x28')](_0x1f62b5[_0x9ef2('0x29')]);if(_0x1f62b5['name']){delete _0x1f62b5[_0x9ef2('0x2a')];}_0x2fb554[_0x9ef2('0x18')](_0x2ec8f1)[_0x9ef2('0x2b')](_0x1f62b5);};}exports[_0x9ef2('0x2c')]=function(_0x368f12,_0x5017a8){var _0x25414d={},_0x23d49d={},_0x1824c1={'count':0x0,'rows':[]};var _0x14c5b4=_['map'](db['CmHopperAdditionalPhone'][_0x9ef2('0x2d')],function(_0x41363f){return{'name':_0x41363f[_0x9ef2('0x2e')],'type':_0x41363f['type']['key']};});_0x23d49d[_0x9ef2('0x2f')]=_[_0x9ef2('0x30')](_0x14c5b4,'name');_0x23d49d[_0x9ef2('0x31')]=_[_0x9ef2('0x32')](_0x368f12['query']);_0x23d49d[_0x9ef2('0x33')]=_[_0x9ef2('0x34')](_0x23d49d[_0x9ef2('0x2f')],_0x23d49d[_0x9ef2('0x31')]);_0x25414d[_0x9ef2('0x35')]=_[_0x9ef2('0x34')](_0x23d49d[_0x9ef2('0x2f')],qs[_0x9ef2('0x36')](_0x368f12['query']['fields']));_0x25414d[_0x9ef2('0x35')]=_0x25414d[_0x9ef2('0x35')][_0x9ef2('0x37')]?_0x25414d['attributes']:_0x23d49d['model'];if(!_0x368f12[_0x9ef2('0x31')][_0x9ef2('0x38')]('nolimit')){_0x25414d['limit']=qs[_0x9ef2('0x1c')](_0x368f12['query'][_0x9ef2('0x1c')]);_0x25414d[_0x9ef2('0x1a')]=qs['offset'](_0x368f12[_0x9ef2('0x31')][_0x9ef2('0x1a')]);}_0x25414d['order']=qs[_0x9ef2('0x39')](_0x368f12[_0x9ef2('0x31')][_0x9ef2('0x39')]);_0x25414d[_0x9ef2('0x3a')]=qs[_0x9ef2('0x33')](_[_0x9ef2('0x3b')](_0x368f12[_0x9ef2('0x31')],_0x23d49d[_0x9ef2('0x33')]),_0x14c5b4);if(_0x368f12[_0x9ef2('0x31')][_0x9ef2('0x3c')]){_0x25414d['where']=_[_0x9ef2('0x3d')](_0x25414d[_0x9ef2('0x3a')],{'$or':_['map'](_0x14c5b4,function(_0x217872){if(_0x217872[_0x9ef2('0x3e')]!=='VIRTUAL'){var _0x3a0eae={};_0x3a0eae[_0x217872['name']]={'$like':'%'+_0x368f12[_0x9ef2('0x31')]['filter']+'%'};return _0x3a0eae;}})});}_0x25414d=_[_0x9ef2('0x3d')]({},_0x25414d,_0x368f12[_0x9ef2('0x3f')]);var _0xd88d2f={'where':_0x25414d[_0x9ef2('0x3a')]};return db[_0x9ef2('0x40')][_0x9ef2('0x1d')](_0xd88d2f)[_0x9ef2('0x23')](function(_0x40a034){_0x1824c1[_0x9ef2('0x1d')]=_0x40a034;if(_0x368f12[_0x9ef2('0x31')][_0x9ef2('0x41')]){_0x25414d[_0x9ef2('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x9ef2('0x43')](_0x25414d);})[_0x9ef2('0x23')](function(_0xbe2286){_0x1824c1[_0x9ef2('0x44')]=_0xbe2286;return _0x1824c1;})['then'](respondWithFilteredResult(_0x5017a8,_0x25414d))[_0x9ef2('0x45')](handleError(_0x5017a8,null));};exports[_0x9ef2('0x46')]=function(_0x2446d8,_0x177877){var _0x200285={'raw':!![],'where':{'id':_0x2446d8[_0x9ef2('0x47')]['id']}},_0x2bfc44={};_0x2bfc44[_0x9ef2('0x2f')]=_[_0x9ef2('0x32')](db[_0x9ef2('0x40')][_0x9ef2('0x2d')]);_0x2bfc44['query']=_[_0x9ef2('0x32')](_0x2446d8[_0x9ef2('0x31')]);_0x2bfc44['filters']=_[_0x9ef2('0x34')](_0x2bfc44[_0x9ef2('0x2f')],_0x2bfc44[_0x9ef2('0x31')]);_0x200285['attributes']=_['intersection'](_0x2bfc44[_0x9ef2('0x2f')],qs[_0x9ef2('0x36')](_0x2446d8[_0x9ef2('0x31')][_0x9ef2('0x36')]));_0x200285[_0x9ef2('0x35')]=_0x200285['attributes'][_0x9ef2('0x37')]?_0x200285[_0x9ef2('0x35')]:_0x2bfc44[_0x9ef2('0x2f')];if(_0x2446d8[_0x9ef2('0x31')]['includeAll']){_0x200285[_0x9ef2('0x42')]=[{'all':!![]}];}_0x200285=_[_0x9ef2('0x3d')]({},_0x200285,_0x2446d8[_0x9ef2('0x3f')]);return db[_0x9ef2('0x40')]['find'](_0x200285)[_0x9ef2('0x23')](handleEntityNotFound(_0x177877,null))[_0x9ef2('0x23')](respondWithResult(_0x177877,null))[_0x9ef2('0x45')](handleError(_0x177877,null));};exports[_0x9ef2('0x48')]=function(_0x1c6bb8,_0x39c92d){return db[_0x9ef2('0x40')]['create'](_0x1c6bb8[_0x9ef2('0x49')],{})[_0x9ef2('0x23')](function(_0x30f609){var _0x30f82c=_0x1c6bb8[_0x9ef2('0x4a')]['get']({'plain':!![]});if(!_0x30f82c)throw new Error(_0x9ef2('0x4b'));if(_0x30f82c[_0x9ef2('0x4c')]===_0x9ef2('0x4a')){var _0x1402ed=_0x30f609[_0x9ef2('0x24')]({'plain':!![]});var _0x27eaa7=_0x9ef2('0x25');return db['UserProfileSection'][_0x9ef2('0x4d')]({'where':{'name':_0x27eaa7,'userProfileId':_0x30f82c['userProfileId']},'raw':!![]})[_0x9ef2('0x23')](function(_0x229b75){if(_0x229b75&&_0x229b75[_0x9ef2('0x4e')]===0x0){return db[_0x9ef2('0x4f')][_0x9ef2('0x48')]({'name':_0x1402ed[_0x9ef2('0x2a')],'resourceId':_0x1402ed['id'],'type':_0x229b75[_0x9ef2('0x2a')],'sectionId':_0x229b75['id']},{})[_0x9ef2('0x23')](function(){return _0x30f609;});}else{return _0x30f609;}})[_0x9ef2('0x45')](function(_0x2cf605){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cf605);throw _0x2cf605;});}return _0x30f609;})[_0x9ef2('0x23')](respondWithResult(_0x39c92d,0xc9))[_0x9ef2('0x45')](handleError(_0x39c92d,null));};exports[_0x9ef2('0x22')]=function(_0x4ef45f,_0x2ca42b){if(_0x4ef45f[_0x9ef2('0x49')]['id']){delete _0x4ef45f[_0x9ef2('0x49')]['id'];}return db['CmHopperAdditionalPhone'][_0x9ef2('0x4d')]({'where':{'id':_0x4ef45f[_0x9ef2('0x47')]['id']}})[_0x9ef2('0x23')](handleEntityNotFound(_0x2ca42b,null))[_0x9ef2('0x23')](saveUpdates(_0x4ef45f[_0x9ef2('0x49')],null))[_0x9ef2('0x23')](respondWithResult(_0x2ca42b,null))[_0x9ef2('0x45')](handleError(_0x2ca42b,null));};exports['destroy']=function(_0x534f5a,_0x10bc4d){return db[_0x9ef2('0x40')][_0x9ef2('0x4d')]({'where':{'id':_0x534f5a[_0x9ef2('0x47')]['id']}})[_0x9ef2('0x23')](handleEntityNotFound(_0x10bc4d,null))[_0x9ef2('0x23')](removeEntity(_0x10bc4d,null))[_0x9ef2('0x45')](handleError(_0x10bc4d,null));}; \ No newline at end of file +var _0x4586=['set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../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','limit','count'];(function(_0x18afb5,_0x9f0654){var _0x2c5a6b=function(_0x36b2e6){while(--_0x36b2e6){_0x18afb5['push'](_0x18afb5['shift']());}};_0x2c5a6b(++_0x9f0654);}(_0x4586,0xd5));var _0x6458=function(_0x4633ee,_0xc061fe){_0x4633ee=_0x4633ee-0x0;var _0x5c5ac0=_0x4586[_0x4633ee];return _0x5c5ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6458('0x0'));var jsonpatch=require(_0x6458('0x1'));var rp=require(_0x6458('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6458('0x3'));var util=require(_0x6458('0x4'));var path=require(_0x6458('0x5'));var sox=require(_0x6458('0x6'));var csv=require('to-csv');var ejs=require(_0x6458('0x7'));var fs=require('fs');var fs_extra=require(_0x6458('0x8'));var _=require(_0x6458('0x9'));var squel=require(_0x6458('0xa'));var crypto=require('crypto');var jsforce=require(_0x6458('0xb'));var deskjs=require(_0x6458('0xc'));var toCsv=require(_0x6458('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6458('0xe'));var qs=require(_0x6458('0xf'));var as=require(_0x6458('0x10'));var hardwareService=require(_0x6458('0x11'));var logger=require(_0x6458('0x12'))(_0x6458('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6458('0x14'));var db=require(_0x6458('0x15'))['db'];function respondWithStatusCode(_0x15bf64,_0xdb0b43){_0xdb0b43=_0xdb0b43||0xcc;return function(_0x52dbfb){if(_0x52dbfb){return _0x15bf64[_0x6458('0x16')](_0xdb0b43);}return _0x15bf64[_0x6458('0x17')](_0xdb0b43)[_0x6458('0x18')]();};}function respondWithResult(_0x22c509,_0x574f1f){_0x574f1f=_0x574f1f||0xc8;return function(_0x139de7){if(_0x139de7){return _0x22c509[_0x6458('0x17')](_0x574f1f)[_0x6458('0x19')](_0x139de7);}};}function respondWithFilteredResult(_0x3e94d1,_0x5aa0a8){return function(_0x279442){if(_0x279442){var _0x20002f=typeof _0x5aa0a8[_0x6458('0x1a')]===_0x6458('0x1b')&&typeof _0x5aa0a8[_0x6458('0x1c')]==='undefined';var _0x278fd3=_0x279442[_0x6458('0x1d')];var _0x116cc2=_0x20002f?0x0:_0x5aa0a8['offset'];var _0x3120bc=_0x20002f?_0x279442[_0x6458('0x1d')]:_0x5aa0a8[_0x6458('0x1a')]+_0x5aa0a8[_0x6458('0x1c')];var _0x2b3cc1;if(_0x3120bc>=_0x278fd3){_0x3120bc=_0x278fd3;_0x2b3cc1=0xc8;}else{_0x2b3cc1=0xce;}_0x3e94d1[_0x6458('0x17')](_0x2b3cc1);return _0x3e94d1[_0x6458('0x1e')](_0x6458('0x1f'),_0x116cc2+'-'+_0x3120bc+'/'+_0x278fd3)['json'](_0x279442);}return null;};}function patchUpdates(_0x58a978){return function(_0x56b881){try{jsonpatch[_0x6458('0x20')](_0x56b881,_0x58a978,!![]);}catch(_0x31a689){return BPromise[_0x6458('0x21')](_0x31a689);}return _0x56b881[_0x6458('0x22')]();};}function saveUpdates(_0x468d65,_0xf37e15){return function(_0x5a189e){if(_0x5a189e){return _0x5a189e[_0x6458('0x23')](_0x468d65)[_0x6458('0x24')](function(_0x55366e){return _0x55366e;});}return null;};}function removeEntity(_0x54ead0,_0x31f788){return function(_0x3ffd52){if(_0x3ffd52){return _0x3ffd52[_0x6458('0x25')]()[_0x6458('0x24')](function(){var _0x2538d5=_0x3ffd52[_0x6458('0x26')]({'plain':!![]});var _0x25886c='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x6458('0x25')]({'where':{'type':_0x25886c,'resourceId':_0x2538d5['id']}})[_0x6458('0x24')](function(){return _0x3ffd52;});})[_0x6458('0x24')](function(){_0x54ead0[_0x6458('0x17')](0xcc)[_0x6458('0x18')]();});}};}function handleEntityNotFound(_0x144fd1,_0x18b1b2){return function(_0x4519d2){if(!_0x4519d2){_0x144fd1[_0x6458('0x16')](0x194);}return _0x4519d2;};}function handleError(_0x53f57a,_0x516513){_0x516513=_0x516513||0x1f4;return function(_0x4e0960){logger[_0x6458('0x27')](_0x4e0960[_0x6458('0x28')]);if(_0x4e0960['name']){delete _0x4e0960[_0x6458('0x29')];}_0x53f57a[_0x6458('0x17')](_0x516513)[_0x6458('0x2a')](_0x4e0960);};}exports[_0x6458('0x2b')]=function(_0x574bba,_0x3e2cb1){var _0x5c4d7c={},_0x1c82d8={},_0x18e28f={'count':0x0,'rows':[]};var _0x3e24a4=_[_0x6458('0x2c')](db[_0x6458('0x2d')][_0x6458('0x2e')],function(_0x55e208){return{'name':_0x55e208[_0x6458('0x2f')],'type':_0x55e208['type']['key']};});_0x1c82d8[_0x6458('0x30')]=_[_0x6458('0x2c')](_0x3e24a4,_0x6458('0x29'));_0x1c82d8[_0x6458('0x31')]=_[_0x6458('0x32')](_0x574bba[_0x6458('0x31')]);_0x1c82d8[_0x6458('0x33')]=_[_0x6458('0x34')](_0x1c82d8['model'],_0x1c82d8['query']);_0x5c4d7c[_0x6458('0x35')]=_[_0x6458('0x34')](_0x1c82d8[_0x6458('0x30')],qs[_0x6458('0x36')](_0x574bba[_0x6458('0x31')]['fields']));_0x5c4d7c[_0x6458('0x35')]=_0x5c4d7c['attributes'][_0x6458('0x37')]?_0x5c4d7c[_0x6458('0x35')]:_0x1c82d8[_0x6458('0x30')];if(!_0x574bba[_0x6458('0x31')]['hasOwnProperty'](_0x6458('0x38'))){_0x5c4d7c[_0x6458('0x1c')]=qs[_0x6458('0x1c')](_0x574bba['query'][_0x6458('0x1c')]);_0x5c4d7c[_0x6458('0x1a')]=qs['offset'](_0x574bba[_0x6458('0x31')][_0x6458('0x1a')]);}_0x5c4d7c['order']=qs['sort'](_0x574bba[_0x6458('0x31')][_0x6458('0x39')]);_0x5c4d7c['where']=qs[_0x6458('0x33')](_[_0x6458('0x3a')](_0x574bba[_0x6458('0x31')],_0x1c82d8[_0x6458('0x33')]),_0x3e24a4);if(_0x574bba[_0x6458('0x31')][_0x6458('0x3b')]){_0x5c4d7c['where']=_[_0x6458('0x3c')](_0x5c4d7c[_0x6458('0x3d')],{'$or':_[_0x6458('0x2c')](_0x3e24a4,function(_0x5abd5f){if(_0x5abd5f[_0x6458('0x3e')]!==_0x6458('0x3f')){var _0x18df73={};_0x18df73[_0x5abd5f[_0x6458('0x29')]]={'$like':'%'+_0x574bba[_0x6458('0x31')][_0x6458('0x3b')]+'%'};return _0x18df73;}})});}_0x5c4d7c=_[_0x6458('0x3c')]({},_0x5c4d7c,_0x574bba['options']);var _0x54195a={'where':_0x5c4d7c['where']};return db[_0x6458('0x2d')]['count'](_0x54195a)[_0x6458('0x24')](function(_0x331c54){_0x18e28f['count']=_0x331c54;if(_0x574bba['query'][_0x6458('0x40')]){_0x5c4d7c[_0x6458('0x41')]=[{'all':!![]}];}return db[_0x6458('0x2d')][_0x6458('0x42')](_0x5c4d7c);})[_0x6458('0x24')](function(_0x2e179a){_0x18e28f[_0x6458('0x43')]=_0x2e179a;return _0x18e28f;})['then'](respondWithFilteredResult(_0x3e2cb1,_0x5c4d7c))['catch'](handleError(_0x3e2cb1,null));};exports[_0x6458('0x44')]=function(_0x35c315,_0x559e62){var _0xadb53f={'raw':!![],'where':{'id':_0x35c315[_0x6458('0x45')]['id']}},_0x21e1aa={};_0x21e1aa[_0x6458('0x30')]=_[_0x6458('0x32')](db[_0x6458('0x2d')][_0x6458('0x2e')]);_0x21e1aa[_0x6458('0x31')]=_['keys'](_0x35c315[_0x6458('0x31')]);_0x21e1aa[_0x6458('0x33')]=_[_0x6458('0x34')](_0x21e1aa[_0x6458('0x30')],_0x21e1aa[_0x6458('0x31')]);_0xadb53f[_0x6458('0x35')]=_['intersection'](_0x21e1aa[_0x6458('0x30')],qs['fields'](_0x35c315['query'][_0x6458('0x36')]));_0xadb53f['attributes']=_0xadb53f[_0x6458('0x35')][_0x6458('0x37')]?_0xadb53f[_0x6458('0x35')]:_0x21e1aa['model'];if(_0x35c315[_0x6458('0x31')]['includeAll']){_0xadb53f['include']=[{'all':!![]}];}_0xadb53f=_[_0x6458('0x3c')]({},_0xadb53f,_0x35c315['options']);return db['CmHopperAdditionalPhone'][_0x6458('0x46')](_0xadb53f)['then'](handleEntityNotFound(_0x559e62,null))[_0x6458('0x24')](respondWithResult(_0x559e62,null))['catch'](handleError(_0x559e62,null));};exports[_0x6458('0x47')]=function(_0x106304,_0x5e694e){return db[_0x6458('0x2d')][_0x6458('0x47')](_0x106304[_0x6458('0x48')],{})[_0x6458('0x24')](function(_0x43e19b){var _0x9f9295=_0x106304[_0x6458('0x49')]['get']({'plain':!![]});if(!_0x9f9295)throw new Error(_0x6458('0x4a'));if(_0x9f9295[_0x6458('0x4b')]===_0x6458('0x49')){var _0x40f845=_0x43e19b[_0x6458('0x26')]({'plain':!![]});var _0x291d70=_0x6458('0x4c');return db[_0x6458('0x4d')][_0x6458('0x46')]({'where':{'name':_0x291d70,'userProfileId':_0x9f9295[_0x6458('0x4e')]},'raw':!![]})['then'](function(_0x5acb6b){if(_0x5acb6b&&_0x5acb6b['autoAssociation']===0x0){return db['UserProfileResource'][_0x6458('0x47')]({'name':_0x40f845['name'],'resourceId':_0x40f845['id'],'type':_0x5acb6b[_0x6458('0x29')],'sectionId':_0x5acb6b['id']},{})[_0x6458('0x24')](function(){return _0x43e19b;});}else{return _0x43e19b;}})['catch'](function(_0x1ec0e3){logger[_0x6458('0x27')](_0x6458('0x4f'),_0x1ec0e3);throw _0x1ec0e3;});}return _0x43e19b;})['then'](respondWithResult(_0x5e694e,0xc9))[_0x6458('0x50')](handleError(_0x5e694e,null));};exports[_0x6458('0x23')]=function(_0x40638a,_0x3db432){if(_0x40638a[_0x6458('0x48')]['id']){delete _0x40638a['body']['id'];}return db[_0x6458('0x2d')][_0x6458('0x46')]({'where':{'id':_0x40638a['params']['id']}})[_0x6458('0x24')](handleEntityNotFound(_0x3db432,null))[_0x6458('0x24')](saveUpdates(_0x40638a['body'],null))[_0x6458('0x24')](respondWithResult(_0x3db432,null))[_0x6458('0x50')](handleError(_0x3db432,null));};exports[_0x6458('0x25')]=function(_0x2ce032,_0x4ddc07){return db['CmHopperAdditionalPhone'][_0x6458('0x46')]({'where':{'id':_0x2ce032['params']['id']}})[_0x6458('0x24')](handleEntityNotFound(_0x4ddc07,null))[_0x6458('0x24')](removeEntity(_0x4ddc07,null))[_0x6458('0x50')](handleError(_0x4ddc07,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ed5ca20..953b3b4 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 _0x749a=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x749a,0xbe));var _0xa749=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x749a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa749('0x0'));var util=require(_0xa749('0x1'));var logger=require(_0xa749('0x2'))('api');var moment=require(_0xa749('0x3'));var BPromise=require('bluebird');var rp=require(_0xa749('0x4'));var fs=require('fs');var path=require(_0xa749('0x5'));var rimraf=require(_0xa749('0x6'));var config=require(_0xa749('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xa749('0x8')]=function(_0x334ae4,_0xe73bed){return _0x334ae4[_0xa749('0x9')](_0xa749('0xa'),attributes,{'tableName':_0xa749('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78a7=['path','rimraf','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird'];(function(_0x1082e3,_0x39cc74){var _0x2bfa10=function(_0x392b71){while(--_0x392b71){_0x1082e3['push'](_0x1082e3['shift']());}};_0x2bfa10(++_0x39cc74);}(_0x78a7,0x1bd));var _0x778a=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x78a7[_0xa4b8e1];return _0x507e42;};'use strict';var _=require(_0x778a('0x0'));var util=require(_0x778a('0x1'));var logger=require(_0x778a('0x2'))(_0x778a('0x3'));var moment=require('moment');var BPromise=require(_0x778a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x778a('0x5'));var rimraf=require(_0x778a('0x6'));var config=require('../../config/environment');var attributes=require(_0x778a('0x7'));module['exports']=function(_0x5b3c51,_0x5c2c62){return _0x5b3c51[_0x778a('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x778a('0x9'),'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 c0ff69b..fd210be 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 _0x2cd5=['error','code','message','info','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','entity','dialGlobalMaxRetry','countabandonedretry','catch','SwapAdditionalPhones','ContactId','VoiceQueueId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','countmachineretry','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2cd5,0x9b));var _0x52cd=function(_0x17e2e7,_0xe9e1d0){_0x17e2e7=_0x17e2e7-0x0;var _0x2ed751=_0x2cd5[_0x17e2e7];return _0x2ed751;};'use strict';var _=require('lodash');var util=require(_0x52cd('0x0'));var moment=require('moment');var BPromise=require(_0x52cd('0x1'));var rs=require(_0x52cd('0x2'));var fs=require('fs');var Redis=require(_0x52cd('0x3'));var db=require(_0x52cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52cd('0x5'))(_0x52cd('0x6'));var config=require(_0x52cd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x52cd('0x8')][_0x52cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47d0a5,_0x271320,_0x1a8307){return new BPromise(function(_0x18f775,_0x20b8c9){return client[_0x52cd('0xa')](_0x47d0a5,_0x1a8307)[_0x52cd('0xb')](function(_0x1393fd){logger['info'](_0x52cd('0xc'),_0x271320,_0x52cd('0xd'));logger[_0x52cd('0xe')](_0x52cd('0xf'),_0x271320,_0x52cd('0xd'),JSON['stringify'](_0x1393fd));if(_0x1393fd[_0x52cd('0x10')]){if(_0x1393fd[_0x52cd('0x10')][_0x52cd('0x11')]===0x1f4){logger[_0x52cd('0x10')](_0x52cd('0xc'),_0x271320,_0x1393fd[_0x52cd('0x10')][_0x52cd('0x12')]);return _0x20b8c9(_0x1393fd[_0x52cd('0x10')][_0x52cd('0x12')]);}logger[_0x52cd('0x10')](_0x52cd('0xc'),_0x271320,_0x1393fd[_0x52cd('0x10')]['message']);return _0x18f775(_0x1393fd[_0x52cd('0x10')][_0x52cd('0x12')]);}else{logger[_0x52cd('0x13')](_0x52cd('0xc'),_0x271320,_0x52cd('0xd'));_0x18f775(_0x1393fd['result'][_0x52cd('0x12')]);}})['catch'](function(_0x32ce48){logger['error'](_0x52cd('0xc'),_0x271320,_0x32ce48);_0x20b8c9(_0x32ce48);});});}exports[_0x52cd('0x14')]=function(_0x11804a){var _0x2155bd=this;return new Promise(function(_0x2f18e0,_0x2a4edd){return db[_0x52cd('0x15')][_0x52cd('0x16')]({'raw':!![],'where':{'ContactId':_0x11804a[_0x52cd('0x17')]['ContactId'],'ListId':_0x11804a[_0x52cd('0x17')][_0x52cd('0x18')],'VoiceQueueId':_0x11804a[_0x52cd('0x17')]['VoiceQueueId']===undefined?null:_0x11804a[_0x52cd('0x17')]['VoiceQueueId'],'CampaignId':_0x11804a[_0x52cd('0x17')][_0x52cd('0x19')]===undefined?null:_0x11804a[_0x52cd('0x17')][_0x52cd('0x19')]}})['then'](function(_0xadab72){if(_0xadab72!=null){return db[_0x52cd('0x1a')][_0x52cd('0x16')]({'raw':!![],'where':{'CmHopperId':_0xadab72['id'],'OrderBy':{'$gt':_0xadab72[_0x52cd('0x1b')]}},'order':[[_0x52cd('0x1b'),_0x52cd('0x1c')]]})['then'](function(_0x3cad12){var _0x151701=0x0;if(_0x3cad12){if(_0x3cad12[_0x52cd('0x1d')]+_0x3cad12[_0x52cd('0x1e')]+_0x3cad12[_0x52cd('0x1f')]+_0x3cad12[_0x52cd('0x20')]+_0x3cad12[_0x52cd('0x21')]+_0x3cad12['countabandonedretry']+_0x3cad12['countmachineretry']+_0x3cad12['countagentrejectretry']<_0x11804a[_0x52cd('0x22')][_0x52cd('0x23')])_0x151701=0x1;_0x2f18e0({'additional':_0x151701});}else{return db[_0x52cd('0x1a')][_0x52cd('0x16')]({'raw':!![],'where':{'CmHopperId':_0xadab72['id']},'order':[['OrderBy',_0x52cd('0x1c')]]})[_0x52cd('0xb')](function(_0x1da9c2){var _0x387204=0x0;if(_0x1da9c2){if(_0x1da9c2[_0x52cd('0x1d')]+_0x1da9c2[_0x52cd('0x1e')]+_0x1da9c2['countnoanswerretry']+_0x1da9c2[_0x52cd('0x20')]+_0x1da9c2[_0x52cd('0x21')]+_0x1da9c2[_0x52cd('0x24')]+_0x1da9c2['countmachineretry']+_0x1da9c2['countagentrejectretry']<_0x11804a[_0x52cd('0x22')][_0x52cd('0x23')])_0x387204=0x1;_0x2f18e0({'additional':_0x387204});}else{_0x2f18e0({'additional':0x0});}})[_0x52cd('0x25')](function(_0x2bde58){logger['error'](_0x52cd('0x14'),_0x2bde58[_0x52cd('0x12')]);_0x2a4edd(_0x2155bd[_0x52cd('0x10')](0x1f4,_0x2bde58['message']));});}})[_0x52cd('0x25')](function(_0x23191b){logger[_0x52cd('0x10')]('VerifyAdditionalPhones',_0x23191b[_0x52cd('0x12')]);_0x2a4edd(_0x2155bd[_0x52cd('0x10')](0x1f4,_0x23191b['message']));});}else _0x2f18e0({'additional':0x0});});});};exports[_0x52cd('0x26')]=function(_0x1ae8b8){var _0x1692fd=this;return new Promise(function(_0x336443,_0x5003a7){return db[_0x52cd('0x15')][_0x52cd('0x16')]({'raw':!![],'where':{'ContactId':_0x1ae8b8[_0x52cd('0x17')][_0x52cd('0x27')],'ListId':_0x1ae8b8[_0x52cd('0x17')]['ListId'],'VoiceQueueId':_0x1ae8b8['body'][_0x52cd('0x28')]===undefined?null:_0x1ae8b8['body'][_0x52cd('0x28')],'CampaignId':_0x1ae8b8['body'][_0x52cd('0x19')]===undefined?null:_0x1ae8b8[_0x52cd('0x17')]['CampaignId']}})[_0x52cd('0xb')](function(_0x7aa280){if(_0x7aa280!=null){return db[_0x52cd('0x1a')][_0x52cd('0x16')]({'raw':!![],'where':{'CmHopperId':_0x7aa280['id'],'OrderBy':{'$gte':_0x7aa280[_0x52cd('0x1b')]}},'order':[[_0x52cd('0x1b'),_0x52cd('0x1c')]]})['then'](function(_0x53f824){if(_0x53f824)return activateAdditionalPhone(_0x7aa280,_0x1ae8b8[_0x52cd('0x17')],_0x53f824,_0x1ae8b8[_0x52cd('0x29')],_0x1ae8b8[_0x52cd('0x2a')])['then'](function(_0x12722e){_0x336443(_0x12722e);});else{return db[_0x52cd('0x1a')][_0x52cd('0x16')]({'raw':!![],'where':{'CmHopperId':_0x7aa280['id']},'order':[[_0x52cd('0x1b'),_0x52cd('0x1c')]]})['then'](function(_0x297112){if(_0x297112)return activateAdditionalPhone(_0x7aa280,_0x1ae8b8['body'],_0x297112,_0x1ae8b8[_0x52cd('0x29')],_0x1ae8b8['waitTime'])['then'](function(_0x41ef31){_0x336443(_0x41ef31);});else{_0x336443({'id':_0x7aa280['id'],'phone':''});}})[_0x52cd('0x25')](function(_0x250576){logger[_0x52cd('0x10')](_0x52cd('0x14'),_0x250576[_0x52cd('0x12')]);_0x5003a7(_0x1692fd['error'](0x1f4,_0x250576[_0x52cd('0x12')]));});}})[_0x52cd('0x25')](function(_0x7b77c3){logger[_0x52cd('0x10')]('VerifyAdditionalPhones',_0x7b77c3[_0x52cd('0x12')]);_0x5003a7(_0x1692fd[_0x52cd('0x10')](0x1f4,_0x7b77c3['message']));});}else _0x336443(0x1);});});};function activateAdditionalPhone(_0x492d7a,_0x476931,_0x17b157,_0x514e77,_0xbc8717){return new Promise(function(_0x456e54,_0x384192){var _0x3abaa9;if(_[_0x52cd('0x2b')](_0x17b157['scheduledat'])){_0x17b157[_0x52cd('0x2c')]=moment();}if(moment()>moment(_0x17b157['scheduledat'])){_0x3abaa9=moment()[_0x52cd('0x2d')](_0xbc8717||0x3,_0x52cd('0x2e'));}else{if(_0x17b157[_0x52cd('0x1b')]==0x0){_0x3abaa9=moment(_0x17b157[_0x52cd('0x2c')]);}else{_0x3abaa9=moment()[_0x52cd('0x2d')](_0xbc8717||0x3,_0x52cd('0x2e'));}}if(_[_0x52cd('0x2b')](_0x3abaa9)){_0x3abaa9=moment()[_0x52cd('0x2d')](_0xbc8717||0x3,'minutes');}var _0x309a36={'phone':_0x492d7a[_0x52cd('0x2f')],'active':0x0,'OrderBy':_[_0x52cd('0x2b')](_0x492d7a[_0x52cd('0x1b')])?0x0:_0x492d7a[_0x52cd('0x1b')],'scheduledat':moment()[_0x52cd('0x2d')](_0x514e77||0x1,_0x52cd('0x2e')),'countbusyretry':_0x476931[_0x52cd('0x1d')],'countcongestionretry':_0x476931['countcongestionretry'],'countnoanswerretry':_0x476931[_0x52cd('0x1f')],'countnosuchnumberretry':_0x476931['countnosuchnumberretry'],'countdropretry':_0x476931['countdropretry'],'countabandonedretry':_0x476931['countabandonedretry'],'countmachineretry':_0x476931['countmachineretry'],'countagentrejectretry':_0x476931[_0x52cd('0x30')],'createdAt':_0x476931[_0x52cd('0x31')],'updatedAt':_0x476931[_0x52cd('0x32')]};var _0x6d9042={'CmHopperId':_0x492d7a['id'],'phone':_0x17b157[_0x52cd('0x2f')],'active':0x0,'OrderBy':_[_0x52cd('0x2b')](_0x17b157[_0x52cd('0x1b')])?0x0:_0x17b157['OrderBy'],'scheduledat':_0x3abaa9,'countbusyretry':_0x17b157[_0x52cd('0x1d')],'countcongestionretry':_0x17b157[_0x52cd('0x1e')],'countnoanswerretry':_0x17b157[_0x52cd('0x1f')],'countnosuchnumberretry':_0x17b157[_0x52cd('0x20')],'countdropretry':_0x17b157[_0x52cd('0x21')],'countabandonedretry':_0x17b157[_0x52cd('0x24')],'countmachineretry':_0x17b157[_0x52cd('0x33')],'countagentrejectretry':_0x17b157['countagentrejectretry'],'createdAt':_0x17b157[_0x52cd('0x31')],'updatedAt':_0x17b157['updatedAt']};return db[_0x52cd('0x34')][_0x52cd('0x35')](function(_0x5b79f7){return db['CmHopperAdditionalPhone'][_0x52cd('0x36')](_0x309a36,{'where':{'id':_0x17b157['id']}},{'transaction':_0x5b79f7})[_0x52cd('0xb')](function(){return db[_0x52cd('0x15')][_0x52cd('0x36')](_0x6d9042,{'where':{'id':_0x492d7a['id']}},{'transaction':_0x5b79f7});});})['then'](function(_0x16e6a7){_0x456e54({'id':_0x492d7a['id'],'phone':_0x17b157['phone']});})[_0x52cd('0x25')](function(_0x21d6da){logger['error'](_0x52cd('0x37'),_0x21d6da[_0x52cd('0x12')]);_0x384192({'error':_0x21d6da[_0x52cd('0x12')]});});});}exports['IncrementPreviewCounters']=function(_0x595d79){var _0x4ac202=this;return new Promise(function(_0x15d112,_0x2939eb){return db[_0x52cd('0x15')][_0x52cd('0x36')](_0x595d79[_0x52cd('0x17')]['field'],{'where':{'id':_0x595d79[_0x52cd('0x17')]['id']}})[_0x52cd('0xb')](function(_0x52ea34){_0x15d112(_0x52ea34);})[_0x52cd('0x25')](function(_0x50e765){logger[_0x52cd('0x10')](_0x52cd('0x38'),_0x50e765[_0x52cd('0x12')]);_0x2939eb(_0x4ac202['error'](0x1f4,_0x50e765['message']));});});}; \ No newline at end of file +var _0x2843=['add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','body','ContactId','ListId','VoiceQueueId','then','CmHopperAdditionalPhone','findOne','OrderBy','countbusyretry','countdropretry','entity','dialGlobalMaxRetry','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','CmHopper','CampaignId','duration','waitTime','isNil','scheduledat'];(function(_0xdcd2f4,_0x38e5c3){var _0x55a05d=function(_0x170024){while(--_0x170024){_0xdcd2f4['push'](_0xdcd2f4['shift']());}};_0x55a05d(++_0x38e5c3);}(_0x2843,0x74));var _0x3284=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x2843[_0x368e09];return _0x14b7df;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3284('0x0'));var BPromise=require(_0x3284('0x1'));var rs=require(_0x3284('0x2'));var fs=require('fs');var Redis=require(_0x3284('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3284('0x4'))(_0x3284('0x5'));var config=require(_0x3284('0x6'));var jayson=require(_0x3284('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x676698,_0x499b60,_0x4a65d0){return new BPromise(function(_0x11d0b3,_0xec45a6){return client[_0x3284('0x8')](_0x676698,_0x4a65d0)['then'](function(_0x3d4fb9){logger[_0x3284('0x9')](_0x3284('0xa'),_0x499b60,_0x3284('0xb'));logger['debug'](_0x3284('0xc'),_0x499b60,_0x3284('0xb'),JSON[_0x3284('0xd')](_0x3d4fb9));if(_0x3d4fb9[_0x3284('0xe')]){if(_0x3d4fb9[_0x3284('0xe')]['code']===0x1f4){logger[_0x3284('0xe')](_0x3284('0xa'),_0x499b60,_0x3d4fb9[_0x3284('0xe')][_0x3284('0xf')]);return _0xec45a6(_0x3d4fb9['error']['message']);}logger[_0x3284('0xe')](_0x3284('0xa'),_0x499b60,_0x3d4fb9[_0x3284('0xe')][_0x3284('0xf')]);return _0x11d0b3(_0x3d4fb9[_0x3284('0xe')][_0x3284('0xf')]);}else{logger[_0x3284('0x9')](_0x3284('0xa'),_0x499b60,_0x3284('0xb'));_0x11d0b3(_0x3d4fb9['result'][_0x3284('0xf')]);}})[_0x3284('0x10')](function(_0x31f9bc){logger[_0x3284('0xe')](_0x3284('0xa'),_0x499b60,_0x31f9bc);_0xec45a6(_0x31f9bc);});});}exports[_0x3284('0x11')]=function(_0x1a63f7){var _0xaab198=this;return new Promise(function(_0x5258f1,_0x347040){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x1a63f7[_0x3284('0x12')][_0x3284('0x13')],'ListId':_0x1a63f7[_0x3284('0x12')][_0x3284('0x14')],'VoiceQueueId':_0x1a63f7[_0x3284('0x12')][_0x3284('0x15')]===undefined?null:_0x1a63f7['body'][_0x3284('0x15')],'CampaignId':_0x1a63f7['body']['CampaignId']===undefined?null:_0x1a63f7['body']['CampaignId']}})[_0x3284('0x16')](function(_0xc768e6){if(_0xc768e6!=null){return db[_0x3284('0x17')][_0x3284('0x18')]({'raw':!![],'where':{'CmHopperId':_0xc768e6['id'],'OrderBy':{'$gt':_0xc768e6['OrderBy']}},'order':[[_0x3284('0x19'),'ASC']]})[_0x3284('0x16')](function(_0x3ccd5c){var _0x395232=0x0;if(_0x3ccd5c){if(_0x3ccd5c[_0x3284('0x1a')]+_0x3ccd5c['countcongestionretry']+_0x3ccd5c['countnoanswerretry']+_0x3ccd5c['countnosuchnumberretry']+_0x3ccd5c[_0x3284('0x1b')]+_0x3ccd5c['countabandonedretry']+_0x3ccd5c['countmachineretry']+_0x3ccd5c['countagentrejectretry']<_0x1a63f7[_0x3284('0x1c')][_0x3284('0x1d')])_0x395232=0x1;_0x5258f1({'additional':_0x395232});}else{return db[_0x3284('0x17')][_0x3284('0x18')]({'raw':!![],'where':{'CmHopperId':_0xc768e6['id']},'order':[[_0x3284('0x19'),_0x3284('0x1e')]]})['then'](function(_0x4e43ef){var _0x277d1d=0x0;if(_0x4e43ef){if(_0x4e43ef['countbusyretry']+_0x4e43ef[_0x3284('0x1f')]+_0x4e43ef[_0x3284('0x20')]+_0x4e43ef[_0x3284('0x21')]+_0x4e43ef[_0x3284('0x1b')]+_0x4e43ef['countabandonedretry']+_0x4e43ef[_0x3284('0x22')]+_0x4e43ef[_0x3284('0x23')]<_0x1a63f7[_0x3284('0x1c')][_0x3284('0x1d')])_0x277d1d=0x1;_0x5258f1({'additional':_0x277d1d});}else{_0x5258f1({'additional':0x0});}})[_0x3284('0x10')](function(_0x1c752c){logger[_0x3284('0xe')](_0x3284('0x11'),_0x1c752c['message']);_0x347040(_0xaab198['error'](0x1f4,_0x1c752c['message']));});}})[_0x3284('0x10')](function(_0x466d8a){logger['error']('VerifyAdditionalPhones',_0x466d8a[_0x3284('0xf')]);_0x347040(_0xaab198[_0x3284('0xe')](0x1f4,_0x466d8a[_0x3284('0xf')]));});}else _0x5258f1({'additional':0x0});});});};exports[_0x3284('0x24')]=function(_0x26cbcf){var _0x50a8f1=this;return new Promise(function(_0x3549c8,_0x500baa){return db[_0x3284('0x25')][_0x3284('0x18')]({'raw':!![],'where':{'ContactId':_0x26cbcf[_0x3284('0x12')][_0x3284('0x13')],'ListId':_0x26cbcf[_0x3284('0x12')]['ListId'],'VoiceQueueId':_0x26cbcf['body'][_0x3284('0x15')]===undefined?null:_0x26cbcf['body'][_0x3284('0x15')],'CampaignId':_0x26cbcf[_0x3284('0x12')][_0x3284('0x26')]===undefined?null:_0x26cbcf['body'][_0x3284('0x26')]}})[_0x3284('0x16')](function(_0x6a158d){if(_0x6a158d!=null){return db[_0x3284('0x17')][_0x3284('0x18')]({'raw':!![],'where':{'CmHopperId':_0x6a158d['id'],'OrderBy':{'$gte':_0x6a158d['OrderBy']}},'order':[[_0x3284('0x19'),_0x3284('0x1e')]]})[_0x3284('0x16')](function(_0x6ab128){if(_0x6ab128)return activateAdditionalPhone(_0x6a158d,_0x26cbcf[_0x3284('0x12')],_0x6ab128,_0x26cbcf['duration'],_0x26cbcf['waitTime'])['then'](function(_0x1b8981){_0x3549c8(_0x1b8981);});else{return db[_0x3284('0x17')][_0x3284('0x18')]({'raw':!![],'where':{'CmHopperId':_0x6a158d['id']},'order':[[_0x3284('0x19'),_0x3284('0x1e')]]})[_0x3284('0x16')](function(_0x4b6c92){if(_0x4b6c92)return activateAdditionalPhone(_0x6a158d,_0x26cbcf[_0x3284('0x12')],_0x4b6c92,_0x26cbcf[_0x3284('0x27')],_0x26cbcf[_0x3284('0x28')])[_0x3284('0x16')](function(_0x3e345c){_0x3549c8(_0x3e345c);});else{_0x3549c8({'id':_0x6a158d['id'],'phone':''});}})[_0x3284('0x10')](function(_0x315c43){logger[_0x3284('0xe')]('VerifyAdditionalPhones',_0x315c43['message']);_0x500baa(_0x50a8f1['error'](0x1f4,_0x315c43[_0x3284('0xf')]));});}})['catch'](function(_0x3b18bd){logger[_0x3284('0xe')]('VerifyAdditionalPhones',_0x3b18bd[_0x3284('0xf')]);_0x500baa(_0x50a8f1[_0x3284('0xe')](0x1f4,_0x3b18bd[_0x3284('0xf')]));});}else _0x3549c8(0x1);});});};function activateAdditionalPhone(_0x6a77f7,_0x411f87,_0x5146da,_0x973b2c,_0x4f77b9){return new Promise(function(_0x45271d,_0x23105a){var _0xd5923f;if(_[_0x3284('0x29')](_0x5146da[_0x3284('0x2a')])){_0x5146da[_0x3284('0x2a')]=moment();}if(moment()>moment(_0x5146da['scheduledat'])){_0xd5923f=moment()[_0x3284('0x2b')](_0x4f77b9||0x3,_0x3284('0x2c'));}else{if(_0x5146da['OrderBy']==0x0){_0xd5923f=moment(_0x5146da[_0x3284('0x2a')]);}else{_0xd5923f=moment()['add'](_0x4f77b9||0x3,_0x3284('0x2c'));}}if(_['isNil'](_0xd5923f)){_0xd5923f=moment()[_0x3284('0x2b')](_0x4f77b9||0x3,_0x3284('0x2c'));}var _0x5d1fb1={'phone':_0x6a77f7[_0x3284('0x2d')],'active':0x0,'OrderBy':_[_0x3284('0x29')](_0x6a77f7[_0x3284('0x19')])?0x0:_0x6a77f7[_0x3284('0x19')],'scheduledat':moment()[_0x3284('0x2b')](_0x973b2c||0x1,'minutes'),'countbusyretry':_0x411f87[_0x3284('0x1a')],'countcongestionretry':_0x411f87[_0x3284('0x1f')],'countnoanswerretry':_0x411f87['countnoanswerretry'],'countnosuchnumberretry':_0x411f87[_0x3284('0x21')],'countdropretry':_0x411f87[_0x3284('0x1b')],'countabandonedretry':_0x411f87['countabandonedretry'],'countmachineretry':_0x411f87[_0x3284('0x22')],'countagentrejectretry':_0x411f87['countagentrejectretry'],'createdAt':_0x411f87[_0x3284('0x2e')],'updatedAt':_0x411f87[_0x3284('0x2f')]};var _0x4ec2cf={'CmHopperId':_0x6a77f7['id'],'phone':_0x5146da[_0x3284('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x5146da['OrderBy'])?0x0:_0x5146da[_0x3284('0x19')],'scheduledat':_0xd5923f,'countbusyretry':_0x5146da[_0x3284('0x1a')],'countcongestionretry':_0x5146da[_0x3284('0x1f')],'countnoanswerretry':_0x5146da[_0x3284('0x20')],'countnosuchnumberretry':_0x5146da[_0x3284('0x21')],'countdropretry':_0x5146da[_0x3284('0x1b')],'countabandonedretry':_0x5146da['countabandonedretry'],'countmachineretry':_0x5146da['countmachineretry'],'countagentrejectretry':_0x5146da[_0x3284('0x23')],'createdAt':_0x5146da[_0x3284('0x2e')],'updatedAt':_0x5146da[_0x3284('0x2f')]};return db[_0x3284('0x30')][_0x3284('0x31')](function(_0x3d379d){return db[_0x3284('0x17')][_0x3284('0x32')](_0x5d1fb1,{'where':{'id':_0x5146da['id']}},{'transaction':_0x3d379d})['then'](function(){return db['CmHopper']['update'](_0x4ec2cf,{'where':{'id':_0x6a77f7['id']}},{'transaction':_0x3d379d});});})['then'](function(_0x20a566){_0x45271d({'id':_0x6a77f7['id'],'phone':_0x5146da[_0x3284('0x2d')]});})[_0x3284('0x10')](function(_0x3e9622){logger[_0x3284('0xe')](_0x3284('0x33'),_0x3e9622[_0x3284('0xf')]);_0x23105a({'error':_0x3e9622[_0x3284('0xf')]});});});}exports[_0x3284('0x34')]=function(_0x3b3107){var _0x347729=this;return new Promise(function(_0x19bb87,_0x19ce40){return db['CmHopper'][_0x3284('0x32')](_0x3b3107[_0x3284('0x12')]['field'],{'where':{'id':_0x3b3107[_0x3284('0x12')]['id']}})[_0x3284('0x16')](function(_0x576cdb){_0x19bb87(_0x576cdb);})[_0x3284('0x10')](function(_0x248d03){logger['error'](_0x3284('0x34'),_0x248d03['message']);_0x19ce40(_0x347729[_0x3284('0xe')](0x1f4,_0x248d03[_0x3284('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index a391d9b..71450e2 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 _0xdd8f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','util'];(function(_0x29b25d,_0x7f7e39){var _0x164741=function(_0x3b9921){while(--_0x3b9921){_0x29b25d['push'](_0x29b25d['shift']());}};_0x164741(++_0x7f7e39);}(_0xdd8f,0x6b));var _0xfdd8=function(_0x1d1f23,_0x5ab63a){_0x1d1f23=_0x1d1f23-0x0;var _0x57ea2c=_0xdd8f[_0x1d1f23];return _0x57ea2c;};'use strict';var multer=require('multer');var util=require(_0xfdd8('0x0'));var path=require('path');var timeout=require(_0xfdd8('0x1'));var express=require(_0xfdd8('0x2'));var router=express[_0xfdd8('0x3')]();var fs_extra=require(_0xfdd8('0x4'));var auth=require(_0xfdd8('0x5'));var interaction=require(_0xfdd8('0x6'));var config=require('../../config/environment');var controller=require(_0xfdd8('0x7'));router[_0xfdd8('0x8')]('/',auth[_0xfdd8('0x9')](),controller[_0xfdd8('0xa')]);router['get'](_0xfdd8('0xb'),auth[_0xfdd8('0x9')](),controller[_0xfdd8('0xc')]);router[_0xfdd8('0xd')]('/',auth['isAuthenticated'](),controller[_0xfdd8('0xe')]);router[_0xfdd8('0xf')](_0xfdd8('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfdd8('0x10')](_0xfdd8('0xb'),auth['isAuthenticated'](),controller[_0xfdd8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7b08=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','path'];(function(_0x2dae68,_0x246230){var _0x4f2bf8=function(_0x2ca55f){while(--_0x2ca55f){_0x2dae68['push'](_0x2dae68['shift']());}};_0x4f2bf8(++_0x246230);}(_0x7b08,0x163));var _0x87b0=function(_0xea2b04,_0x4e06a4){_0xea2b04=_0xea2b04-0x0;var _0x5b863d=_0x7b08[_0xea2b04];return _0x5b863d;};'use strict';var multer=require(_0x87b0('0x0'));var util=require('util');var path=require(_0x87b0('0x1'));var timeout=require(_0x87b0('0x2'));var express=require(_0x87b0('0x3'));var router=express['Router']();var fs_extra=require(_0x87b0('0x4'));var auth=require(_0x87b0('0x5'));var interaction=require(_0x87b0('0x6'));var config=require(_0x87b0('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x87b0('0x8')]('/',auth[_0x87b0('0x9')](),controller[_0x87b0('0xa')]);router[_0x87b0('0x8')](_0x87b0('0xb'),auth[_0x87b0('0x9')](),controller[_0x87b0('0xc')]);router[_0x87b0('0xd')]('/',auth[_0x87b0('0x9')](),controller[_0x87b0('0xe')]);router['put'](_0x87b0('0xb'),auth[_0x87b0('0x9')](),controller[_0x87b0('0xf')]);router[_0x87b0('0x10')](_0x87b0('0xb'),auth[_0x87b0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b0dc5ac..9058418 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 _0xa897=['moment','exports','STRING','INTEGER'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0xa897,0x17c));var _0x7a89=function(_0x12ae5d,_0x2e8cff){_0x12ae5d=_0x12ae5d-0x0;var _0x5b325f=_0xa897[_0x12ae5d];return _0x5b325f;};'use strict';var moment=require(_0x7a89('0x0'));var Sequelize=require('sequelize');module[_0x7a89('0x1')]={'phone':{'type':Sequelize[_0x7a89('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x7a89('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x4b57=['contactListQueue','INTEGER','moment','sequelize','exports','STRING'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x4b57,0xaa));var _0x74b5=function(_0x3c1ca2,_0x3428ae){_0x3c1ca2=_0x3c1ca2-0x0;var _0x310c01=_0x4b57[_0x3c1ca2];return _0x310c01;};'use strict';var moment=require(_0x74b5('0x0'));var Sequelize=require(_0x74b5('0x1'));module[_0x74b5('0x2')]={'phone':{'type':Sequelize[_0x74b5('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x74b5('0x4')},'ListId':{'type':Sequelize[_0x74b5('0x5')],'unique':_0x74b5('0x4')},'VoiceQueueId':{'type':Sequelize[_0x74b5('0x5')],'unique':_0x74b5('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0f331c3..e5ee60d 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 _0x4f00=['name','index','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','CmHopperBlack','intersection','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x4f00,0x1ea));var _0x04f0=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x4f00[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0x04f0('0x0'));var rimraf=require(_0x04f0('0x1'));var zipdir=require(_0x04f0('0x2'));var jsonpatch=require(_0x04f0('0x3'));var rp=require(_0x04f0('0x4'));var moment=require('moment');var BPromise=require(_0x04f0('0x5'));var Mustache=require(_0x04f0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x04f0('0x7'));var csv=require('to-csv');var ejs=require(_0x04f0('0x8'));var fs=require('fs');var fs_extra=require(_0x04f0('0x9'));var _=require('lodash');var squel=require(_0x04f0('0xa'));var crypto=require(_0x04f0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04f0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x04f0('0xd'));var Papa=require(_0x04f0('0xe'));var Redis=require(_0x04f0('0xf'));var authService=require(_0x04f0('0x10'));var qs=require(_0x04f0('0x11'));var as=require(_0x04f0('0x12'));var hardwareService=require(_0x04f0('0x13'));var logger=require('../../config/logger')(_0x04f0('0x14'));var utils=require(_0x04f0('0x15'));var config=require(_0x04f0('0x16'));var licenseUtil=require(_0x04f0('0x17'));var db=require(_0x04f0('0x18'))['db'];function respondWithStatusCode(_0x35e215,_0xd4e4cc){_0xd4e4cc=_0xd4e4cc||0xcc;return function(_0x215992){if(_0x215992){return _0x35e215['sendStatus'](_0xd4e4cc);}return _0x35e215[_0x04f0('0x19')](_0xd4e4cc)[_0x04f0('0x1a')]();};}function respondWithResult(_0x2f13f0,_0x721bfb){_0x721bfb=_0x721bfb||0xc8;return function(_0x4975e2){if(_0x4975e2){return _0x2f13f0[_0x04f0('0x19')](_0x721bfb)[_0x04f0('0x1b')](_0x4975e2);}};}function respondWithFilteredResult(_0x3fc263,_0x1b7f23){return function(_0xb69d29){if(_0xb69d29){var _0x3d71ff=typeof _0x1b7f23[_0x04f0('0x1c')]===_0x04f0('0x1d')&&typeof _0x1b7f23['limit']==='undefined';var _0x447574=_0xb69d29[_0x04f0('0x1e')];var _0x1f7e1d=_0x3d71ff?0x0:_0x1b7f23[_0x04f0('0x1c')];var _0x1fbb41=_0x3d71ff?_0xb69d29[_0x04f0('0x1e')]:_0x1b7f23[_0x04f0('0x1c')]+_0x1b7f23[_0x04f0('0x1f')];var _0x507899;if(_0x1fbb41>=_0x447574){_0x1fbb41=_0x447574;_0x507899=0xc8;}else{_0x507899=0xce;}_0x3fc263[_0x04f0('0x19')](_0x507899);return _0x3fc263['set'](_0x04f0('0x20'),_0x1f7e1d+'-'+_0x1fbb41+'/'+_0x447574)[_0x04f0('0x1b')](_0xb69d29);}return null;};}function patchUpdates(_0x34b70e){return function(_0x5f08cd){try{jsonpatch[_0x04f0('0x21')](_0x5f08cd,_0x34b70e,!![]);}catch(_0x4cb7fb){return BPromise[_0x04f0('0x22')](_0x4cb7fb);}return _0x5f08cd[_0x04f0('0x23')]();};}function saveUpdates(_0x2d495b,_0x554278){return function(_0x11bf80){if(_0x11bf80){return _0x11bf80[_0x04f0('0x24')](_0x2d495b)[_0x04f0('0x25')](function(_0x3e054e){return _0x3e054e;});}return null;};}function removeEntity(_0x1a6232,_0x49d265){return function(_0x437986){if(_0x437986){return _0x437986[_0x04f0('0x26')]()[_0x04f0('0x25')](function(){_0x1a6232[_0x04f0('0x19')](0xcc)[_0x04f0('0x1a')]();});}};}function handleEntityNotFound(_0x86bf05,_0x5d83f1){return function(_0x546d9e){if(!_0x546d9e){_0x86bf05[_0x04f0('0x27')](0x194);}return _0x546d9e;};}function handleError(_0x3f542c,_0x304d85){_0x304d85=_0x304d85||0x1f4;return function(_0xc94b84){logger[_0x04f0('0x28')](_0xc94b84[_0x04f0('0x29')]);if(_0xc94b84['name']){delete _0xc94b84[_0x04f0('0x2a')];}_0x3f542c[_0x04f0('0x19')](_0x304d85)['send'](_0xc94b84);};}exports[_0x04f0('0x2b')]=function(_0x49b28d,_0x3b5b48){var _0x14279a={},_0x27a618={},_0x2947aa={'count':0x0,'rows':[]};var _0x32f136=_['map'](db['CmHopperBlack'][_0x04f0('0x2c')],function(_0x38a1c2){return{'name':_0x38a1c2[_0x04f0('0x2d')],'type':_0x38a1c2[_0x04f0('0x2e')]['key']};});_0x27a618[_0x04f0('0x2f')]=_[_0x04f0('0x30')](_0x32f136,_0x04f0('0x2a'));_0x27a618[_0x04f0('0x31')]=_[_0x04f0('0x32')](_0x49b28d['query']);_0x27a618['filters']=_['intersection'](_0x27a618[_0x04f0('0x2f')],_0x27a618[_0x04f0('0x31')]);_0x14279a[_0x04f0('0x33')]=_['intersection'](_0x27a618[_0x04f0('0x2f')],qs[_0x04f0('0x34')](_0x49b28d[_0x04f0('0x31')][_0x04f0('0x34')]));_0x14279a[_0x04f0('0x33')]=_0x14279a[_0x04f0('0x33')][_0x04f0('0x35')]?_0x14279a[_0x04f0('0x33')]:_0x27a618[_0x04f0('0x2f')];if(!_0x49b28d[_0x04f0('0x31')][_0x04f0('0x36')](_0x04f0('0x37'))){_0x14279a[_0x04f0('0x1f')]=qs[_0x04f0('0x1f')](_0x49b28d[_0x04f0('0x31')][_0x04f0('0x1f')]);_0x14279a[_0x04f0('0x1c')]=qs[_0x04f0('0x1c')](_0x49b28d['query'][_0x04f0('0x1c')]);}_0x14279a[_0x04f0('0x38')]=qs[_0x04f0('0x39')](_0x49b28d[_0x04f0('0x31')][_0x04f0('0x39')]);_0x14279a['where']=qs[_0x04f0('0x3a')](_[_0x04f0('0x3b')](_0x49b28d[_0x04f0('0x31')],_0x27a618[_0x04f0('0x3a')]),_0x32f136);if(_0x49b28d[_0x04f0('0x31')]['filter']){_0x14279a[_0x04f0('0x3c')]=_[_0x04f0('0x3d')](_0x14279a['where'],{'$or':_[_0x04f0('0x30')](_0x32f136,function(_0x3bd013){if(_0x3bd013[_0x04f0('0x2e')]!==_0x04f0('0x3e')){var _0x9b35a0={};_0x9b35a0[_0x3bd013[_0x04f0('0x2a')]]={'$like':'%'+_0x49b28d[_0x04f0('0x31')][_0x04f0('0x3f')]+'%'};return _0x9b35a0;}})});}_0x14279a=_[_0x04f0('0x3d')]({},_0x14279a,_0x49b28d[_0x04f0('0x40')]);var _0x401ffb={'where':_0x14279a[_0x04f0('0x3c')]};return db['CmHopperBlack'][_0x04f0('0x1e')](_0x401ffb)[_0x04f0('0x25')](function(_0x524e83){_0x2947aa[_0x04f0('0x1e')]=_0x524e83;if(_0x49b28d[_0x04f0('0x31')][_0x04f0('0x41')]){_0x14279a[_0x04f0('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x04f0('0x43')](_0x14279a);})[_0x04f0('0x25')](function(_0x4c321d){_0x2947aa[_0x04f0('0x44')]=_0x4c321d;return _0x2947aa;})[_0x04f0('0x25')](respondWithFilteredResult(_0x3b5b48,_0x14279a))['catch'](handleError(_0x3b5b48,null));};exports['show']=function(_0x214d4e,_0x199466){var _0x3a2c3f={'raw':!![],'where':{'id':_0x214d4e[_0x04f0('0x45')]['id']}},_0x491297={};_0x491297[_0x04f0('0x2f')]=_[_0x04f0('0x32')](db[_0x04f0('0x46')][_0x04f0('0x2c')]);_0x491297[_0x04f0('0x31')]=_[_0x04f0('0x32')](_0x214d4e[_0x04f0('0x31')]);_0x491297[_0x04f0('0x3a')]=_['intersection'](_0x491297['model'],_0x491297[_0x04f0('0x31')]);_0x3a2c3f[_0x04f0('0x33')]=_[_0x04f0('0x47')](_0x491297[_0x04f0('0x2f')],qs[_0x04f0('0x34')](_0x214d4e[_0x04f0('0x31')][_0x04f0('0x34')]));_0x3a2c3f[_0x04f0('0x33')]=_0x3a2c3f['attributes'][_0x04f0('0x35')]?_0x3a2c3f[_0x04f0('0x33')]:_0x491297[_0x04f0('0x2f')];if(_0x214d4e[_0x04f0('0x31')][_0x04f0('0x41')]){_0x3a2c3f['include']=[{'all':!![]}];}_0x3a2c3f=_['merge']({},_0x3a2c3f,_0x214d4e[_0x04f0('0x40')]);return db[_0x04f0('0x46')][_0x04f0('0x48')](_0x3a2c3f)[_0x04f0('0x25')](handleEntityNotFound(_0x199466,null))[_0x04f0('0x25')](respondWithResult(_0x199466,null))[_0x04f0('0x49')](handleError(_0x199466,null));};exports['update']=function(_0x4ed424,_0x5c43f7){if(_0x4ed424['body']['id']){delete _0x4ed424[_0x04f0('0x4a')]['id'];}return db[_0x04f0('0x46')][_0x04f0('0x48')]({'where':{'id':_0x4ed424[_0x04f0('0x45')]['id']}})[_0x04f0('0x25')](handleEntityNotFound(_0x5c43f7,null))[_0x04f0('0x25')](saveUpdates(_0x4ed424['body'],null))[_0x04f0('0x25')](respondWithResult(_0x5c43f7,null))[_0x04f0('0x49')](handleError(_0x5c43f7,null));};exports['destroy']=function(_0x1c37e6,_0x216c52){return db['CmHopperBlack'][_0x04f0('0x48')]({'where':{'id':_0x1c37e6[_0x04f0('0x45')]['id']}})['then'](handleEntityNotFound(_0x216c52,null))[_0x04f0('0x25')](removeEntity(_0x216c52,null))['catch'](handleError(_0x216c52,null));};exports[_0x04f0('0x4b')]=function(_0x450b27,_0x46ecb8){return db[_0x04f0('0x46')][_0x04f0('0x4b')]()[_0x04f0('0x25')](respondWithResult(_0x46ecb8,null))['catch'](handleError(_0x46ecb8,null));}; \ No newline at end of file +var _0x8ddb=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','CmHopperBlack','findAll','catch','params','rawAttributes','fields','find','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x8ddb,0xc9));var _0xb8dd=function(_0x11262c,_0x20d80b){_0x11262c=_0x11262c-0x0;var _0x23977b=_0x8ddb[_0x11262c];return _0x23977b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb8dd('0x1'));var moment=require(_0xb8dd('0x2'));var BPromise=require(_0xb8dd('0x3'));var Mustache=require(_0xb8dd('0x4'));var util=require(_0xb8dd('0x5'));var path=require(_0xb8dd('0x6'));var sox=require(_0xb8dd('0x7'));var csv=require(_0xb8dd('0x8'));var ejs=require(_0xb8dd('0x9'));var fs=require('fs');var fs_extra=require(_0xb8dd('0xa'));var _=require(_0xb8dd('0xb'));var squel=require(_0xb8dd('0xc'));var crypto=require(_0xb8dd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb8dd('0x8'));var querystring=require(_0xb8dd('0xe'));var Papa=require(_0xb8dd('0xf'));var Redis=require('ioredis');var authService=require(_0xb8dd('0x10'));var qs=require(_0xb8dd('0x11'));var as=require(_0xb8dd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8dd('0x13'))(_0xb8dd('0x14'));var utils=require(_0xb8dd('0x15'));var config=require(_0xb8dd('0x16'));var licenseUtil=require(_0xb8dd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509ca1,_0x2501a9){_0x2501a9=_0x2501a9||0xcc;return function(_0x16ac69){if(_0x16ac69){return _0x509ca1[_0xb8dd('0x18')](_0x2501a9);}return _0x509ca1[_0xb8dd('0x19')](_0x2501a9)['end']();};}function respondWithResult(_0x4edfdd,_0x191120){_0x191120=_0x191120||0xc8;return function(_0x2a30a3){if(_0x2a30a3){return _0x4edfdd[_0xb8dd('0x19')](_0x191120)[_0xb8dd('0x1a')](_0x2a30a3);}};}function respondWithFilteredResult(_0x242b4f,_0x299df3){return function(_0xd89e52){if(_0xd89e52){var _0x17843c=typeof _0x299df3[_0xb8dd('0x1b')]===_0xb8dd('0x1c')&&typeof _0x299df3[_0xb8dd('0x1d')]===_0xb8dd('0x1c');var _0x937685=_0xd89e52[_0xb8dd('0x1e')];var _0x4cea50=_0x17843c?0x0:_0x299df3[_0xb8dd('0x1b')];var _0x24bccb=_0x17843c?_0xd89e52['count']:_0x299df3['offset']+_0x299df3[_0xb8dd('0x1d')];var _0x122354;if(_0x24bccb>=_0x937685){_0x24bccb=_0x937685;_0x122354=0xc8;}else{_0x122354=0xce;}_0x242b4f['status'](_0x122354);return _0x242b4f[_0xb8dd('0x1f')]('Content-Range',_0x4cea50+'-'+_0x24bccb+'/'+_0x937685)['json'](_0xd89e52);}return null;};}function patchUpdates(_0x113609){return function(_0x5e0c0a){try{jsonpatch[_0xb8dd('0x20')](_0x5e0c0a,_0x113609,!![]);}catch(_0x2fa0b2){return BPromise[_0xb8dd('0x21')](_0x2fa0b2);}return _0x5e0c0a[_0xb8dd('0x22')]();};}function saveUpdates(_0x11e15d,_0xf25842){return function(_0x353810){if(_0x353810){return _0x353810[_0xb8dd('0x23')](_0x11e15d)['then'](function(_0x9e9f3d){return _0x9e9f3d;});}return null;};}function removeEntity(_0x19f494,_0x2116c6){return function(_0x360d61){if(_0x360d61){return _0x360d61[_0xb8dd('0x24')]()[_0xb8dd('0x25')](function(){_0x19f494['status'](0xcc)[_0xb8dd('0x26')]();});}};}function handleEntityNotFound(_0xe7593,_0x1797d3){return function(_0x208dea){if(!_0x208dea){_0xe7593[_0xb8dd('0x18')](0x194);}return _0x208dea;};}function handleError(_0x1f02d3,_0x4e546a){_0x4e546a=_0x4e546a||0x1f4;return function(_0x29c7ce){logger[_0xb8dd('0x27')](_0x29c7ce[_0xb8dd('0x28')]);if(_0x29c7ce[_0xb8dd('0x29')]){delete _0x29c7ce[_0xb8dd('0x29')];}_0x1f02d3[_0xb8dd('0x19')](_0x4e546a)['send'](_0x29c7ce);};}exports[_0xb8dd('0x2a')]=function(_0x5bed0a,_0x2e1bd7){var _0x3a019b={},_0x2727aa={},_0x455fdb={'count':0x0,'rows':[]};var _0x1d7f4b=_[_0xb8dd('0x2b')](db['CmHopperBlack']['rawAttributes'],function(_0x6d61b1){return{'name':_0x6d61b1[_0xb8dd('0x2c')],'type':_0x6d61b1[_0xb8dd('0x2d')][_0xb8dd('0x2e')]};});_0x2727aa['model']=_[_0xb8dd('0x2b')](_0x1d7f4b,_0xb8dd('0x29'));_0x2727aa['query']=_[_0xb8dd('0x2f')](_0x5bed0a[_0xb8dd('0x30')]);_0x2727aa[_0xb8dd('0x31')]=_[_0xb8dd('0x32')](_0x2727aa[_0xb8dd('0x33')],_0x2727aa[_0xb8dd('0x30')]);_0x3a019b['attributes']=_[_0xb8dd('0x32')](_0x2727aa[_0xb8dd('0x33')],qs['fields'](_0x5bed0a[_0xb8dd('0x30')]['fields']));_0x3a019b[_0xb8dd('0x34')]=_0x3a019b[_0xb8dd('0x34')][_0xb8dd('0x35')]?_0x3a019b[_0xb8dd('0x34')]:_0x2727aa[_0xb8dd('0x33')];if(!_0x5bed0a[_0xb8dd('0x30')][_0xb8dd('0x36')]('nolimit')){_0x3a019b[_0xb8dd('0x1d')]=qs['limit'](_0x5bed0a[_0xb8dd('0x30')][_0xb8dd('0x1d')]);_0x3a019b[_0xb8dd('0x1b')]=qs[_0xb8dd('0x1b')](_0x5bed0a['query']['offset']);}_0x3a019b[_0xb8dd('0x37')]=qs[_0xb8dd('0x38')](_0x5bed0a['query']['sort']);_0x3a019b[_0xb8dd('0x39')]=qs[_0xb8dd('0x31')](_[_0xb8dd('0x3a')](_0x5bed0a[_0xb8dd('0x30')],_0x2727aa['filters']),_0x1d7f4b);if(_0x5bed0a['query']['filter']){_0x3a019b['where']=_[_0xb8dd('0x3b')](_0x3a019b[_0xb8dd('0x39')],{'$or':_['map'](_0x1d7f4b,function(_0x4c7e25){if(_0x4c7e25[_0xb8dd('0x2d')]!==_0xb8dd('0x3c')){var _0x2a0f24={};_0x2a0f24[_0x4c7e25[_0xb8dd('0x29')]]={'$like':'%'+_0x5bed0a[_0xb8dd('0x30')][_0xb8dd('0x3d')]+'%'};return _0x2a0f24;}})});}_0x3a019b=_[_0xb8dd('0x3b')]({},_0x3a019b,_0x5bed0a[_0xb8dd('0x3e')]);var _0x283d43={'where':_0x3a019b['where']};return db['CmHopperBlack']['count'](_0x283d43)[_0xb8dd('0x25')](function(_0x192289){_0x455fdb[_0xb8dd('0x1e')]=_0x192289;if(_0x5bed0a[_0xb8dd('0x30')][_0xb8dd('0x3f')]){_0x3a019b[_0xb8dd('0x40')]=[{'all':!![]}];}return db[_0xb8dd('0x41')][_0xb8dd('0x42')](_0x3a019b);})[_0xb8dd('0x25')](function(_0x1b504c){_0x455fdb['rows']=_0x1b504c;return _0x455fdb;})[_0xb8dd('0x25')](respondWithFilteredResult(_0x2e1bd7,_0x3a019b))[_0xb8dd('0x43')](handleError(_0x2e1bd7,null));};exports['show']=function(_0x31c913,_0x1e612f){var _0x2afd35={'raw':!![],'where':{'id':_0x31c913[_0xb8dd('0x44')]['id']}},_0x7e8861={};_0x7e8861['model']=_[_0xb8dd('0x2f')](db[_0xb8dd('0x41')][_0xb8dd('0x45')]);_0x7e8861[_0xb8dd('0x30')]=_[_0xb8dd('0x2f')](_0x31c913[_0xb8dd('0x30')]);_0x7e8861[_0xb8dd('0x31')]=_[_0xb8dd('0x32')](_0x7e8861[_0xb8dd('0x33')],_0x7e8861['query']);_0x2afd35[_0xb8dd('0x34')]=_['intersection'](_0x7e8861['model'],qs[_0xb8dd('0x46')](_0x31c913[_0xb8dd('0x30')][_0xb8dd('0x46')]));_0x2afd35['attributes']=_0x2afd35[_0xb8dd('0x34')][_0xb8dd('0x35')]?_0x2afd35['attributes']:_0x7e8861[_0xb8dd('0x33')];if(_0x31c913['query'][_0xb8dd('0x3f')]){_0x2afd35[_0xb8dd('0x40')]=[{'all':!![]}];}_0x2afd35=_[_0xb8dd('0x3b')]({},_0x2afd35,_0x31c913[_0xb8dd('0x3e')]);return db['CmHopperBlack'][_0xb8dd('0x47')](_0x2afd35)[_0xb8dd('0x25')](handleEntityNotFound(_0x1e612f,null))[_0xb8dd('0x25')](respondWithResult(_0x1e612f,null))[_0xb8dd('0x43')](handleError(_0x1e612f,null));};exports['update']=function(_0x166a6e,_0x3ed81f){if(_0x166a6e[_0xb8dd('0x48')]['id']){delete _0x166a6e[_0xb8dd('0x48')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x166a6e[_0xb8dd('0x44')]['id']}})[_0xb8dd('0x25')](handleEntityNotFound(_0x3ed81f,null))[_0xb8dd('0x25')](saveUpdates(_0x166a6e[_0xb8dd('0x48')],null))[_0xb8dd('0x25')](respondWithResult(_0x3ed81f,null))[_0xb8dd('0x43')](handleError(_0x3ed81f,null));};exports['destroy']=function(_0x20e4d4,_0x4234ad){return db[_0xb8dd('0x41')]['find']({'where':{'id':_0x20e4d4['params']['id']}})[_0xb8dd('0x25')](handleEntityNotFound(_0x4234ad,null))[_0xb8dd('0x25')](removeEntity(_0x4234ad,null))[_0xb8dd('0x43')](handleError(_0x4234ad,null));};exports[_0xb8dd('0x49')]=function(_0x49d0af,_0x5404b3){return db[_0xb8dd('0x41')][_0xb8dd('0x49')]()[_0xb8dd('0x25')](respondWithResult(_0x5404b3,null))[_0xb8dd('0x43')](handleError(_0x5404b3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6126516..9c72485 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 _0x4559=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x42c6e1,_0x4e5610){var _0x137642=function(_0x4a73b1){while(--_0x4a73b1){_0x42c6e1['push'](_0x42c6e1['shift']());}};_0x137642(++_0x4e5610);}(_0x4559,0x1bd));var _0x9455=function(_0x1f8069,_0x10b62c){_0x1f8069=_0x1f8069-0x0;var _0x1c2603=_0x4559[_0x1f8069];return _0x1c2603;};'use strict';var _=require('lodash');var util=require(_0x9455('0x0'));var logger=require(_0x9455('0x1'))(_0x9455('0x2'));var moment=require('moment');var BPromise=require(_0x9455('0x3'));var rp=require(_0x9455('0x4'));var fs=require('fs');var path=require(_0x9455('0x5'));var rimraf=require(_0x9455('0x6'));var config=require(_0x9455('0x7'));var attributes=require(_0x9455('0x8'));module[_0x9455('0x9')]=function(_0x1f003a,_0x2910ef){return _0x1f003a[_0x9455('0xa')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f82=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x13fecc,_0x50b69c){var _0x17b328=function(_0x34f8a5){while(--_0x34f8a5){_0x13fecc['push'](_0x13fecc['shift']());}};_0x17b328(++_0x50b69c);}(_0x8f82,0x6d));var _0x28f8=function(_0x5b8558,_0x3a5418){_0x5b8558=_0x5b8558-0x0;var _0xef52ae=_0x8f82[_0x5b8558];return _0xef52ae;};'use strict';var _=require(_0x28f8('0x0'));var util=require(_0x28f8('0x1'));var logger=require(_0x28f8('0x2'))(_0x28f8('0x3'));var moment=require(_0x28f8('0x4'));var BPromise=require(_0x28f8('0x5'));var rp=require(_0x28f8('0x6'));var fs=require('fs');var path=require(_0x28f8('0x7'));var rimraf=require(_0x28f8('0x8'));var config=require(_0x28f8('0x9'));var attributes=require('./cmHopperBlack.attributes');module[_0x28f8('0xa')]=function(_0x18d48e,_0x16438f){return _0x18d48e[_0x28f8('0xb')](_0x28f8('0xc'),attributes,{'tableName':_0x28f8('0xd'),'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 da1ed1a..597155f 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 _0x98ef=['rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x3dda5c,_0x13ce16){var _0x3daf7a=function(_0xd3338c){while(--_0xd3338c){_0x3dda5c['push'](_0x3dda5c['shift']());}};_0x3daf7a(++_0x13ce16);}(_0x98ef,0x158));var _0xf98e=function(_0x2fcc9c,_0x1d84fb){_0x2fcc9c=_0x2fcc9c-0x0;var _0x2e79d8=_0x98ef[_0x2fcc9c];return _0x2e79d8;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var moment=require(_0xf98e('0x2'));var BPromise=require(_0xf98e('0x3'));var rs=require(_0xf98e('0x4'));var fs=require('fs');var Redis=require(_0xf98e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf98e('0x6'))(_0xf98e('0x7'));var config=require('../../config/environment');var jayson=require(_0xf98e('0x8'));var client=jayson[_0xf98e('0x9')][_0xf98e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fbe14,_0x2bee68,_0x44f228){return new BPromise(function(_0x85c4d,_0x252f73){return client[_0xf98e('0xb')](_0x4fbe14,_0x44f228)[_0xf98e('0xc')](function(_0x4f713d){logger[_0xf98e('0xd')](_0xf98e('0xe'),_0x2bee68,_0xf98e('0xf'));logger[_0xf98e('0x10')](_0xf98e('0x11'),_0x2bee68,_0xf98e('0xf'),JSON['stringify'](_0x4f713d));if(_0x4f713d['error']){if(_0x4f713d[_0xf98e('0x12')][_0xf98e('0x13')]===0x1f4){logger[_0xf98e('0x12')](_0xf98e('0xe'),_0x2bee68,_0x4f713d[_0xf98e('0x12')]['message']);return _0x252f73(_0x4f713d[_0xf98e('0x12')]['message']);}logger[_0xf98e('0x12')](_0xf98e('0xe'),_0x2bee68,_0x4f713d['error'][_0xf98e('0x14')]);return _0x85c4d(_0x4f713d[_0xf98e('0x12')][_0xf98e('0x14')]);}else{logger[_0xf98e('0xd')](_0xf98e('0xe'),_0x2bee68,_0xf98e('0xf'));_0x85c4d(_0x4f713d[_0xf98e('0x15')][_0xf98e('0x14')]);}})[_0xf98e('0x16')](function(_0x3f4ad8){logger[_0xf98e('0x12')](_0xf98e('0xe'),_0x2bee68,_0x3f4ad8);_0x252f73(_0x3f4ad8);});});}exports[_0xf98e('0x17')]=function(_0x1646de){var _0xc306ad=this;return new Promise(function(_0x1ae7fe,_0x1c1b09){return db[_0xf98e('0x18')][_0xf98e('0x19')]({'raw':_0x1646de[_0xf98e('0x1a')]?_0x1646de[_0xf98e('0x1a')][_0xf98e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1646de[_0xf98e('0x1a')]?_0x1646de['options'][_0xf98e('0x1c')]||null:null,'attributes':_0x1646de[_0xf98e('0x1a')]?_0x1646de['options'][_0xf98e('0x1d')]||null:null,'limit':_0x1646de[_0xf98e('0x1a')]?_0x1646de[_0xf98e('0x1a')][_0xf98e('0x1e')]||null:null,'include':_0x1646de[_0xf98e('0x1a')]?_0x1646de[_0xf98e('0x1a')][_0xf98e('0x1f')]?_['map'](_0x1646de['options'][_0xf98e('0x1f')],function(_0x4c38d1){return{'model':db[_0x4c38d1[_0xf98e('0x20')]],'as':_0x4c38d1['as'],'attributes':_0x4c38d1[_0xf98e('0x1d')],'include':_0x4c38d1[_0xf98e('0x1f')]?_[_0xf98e('0x21')](_0x4c38d1[_0xf98e('0x1f')],function(_0x385590){return{'model':db[_0x385590[_0xf98e('0x20')]],'as':_0x385590['as'],'attributes':_0x385590[_0xf98e('0x1d')],'include':_0x385590[_0xf98e('0x1f')]?_[_0xf98e('0x21')](_0x385590[_0xf98e('0x1f')],function(_0x140a28){return{'model':db[_0x140a28[_0xf98e('0x20')]],'as':_0x140a28['as'],'attributes':_0x140a28[_0xf98e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf98e('0xc')](function(_0x5f506e){logger[_0xf98e('0xd')](_0xf98e('0x17'),_0x1646de);logger[_0xf98e('0x10')](_0xf98e('0x17'),_0x1646de,JSON[_0xf98e('0x22')](_0x5f506e));_0x1ae7fe(_0x5f506e);})['catch'](function(_0x33bc9d){logger[_0xf98e('0x12')]('GetCmHopperBlack',_0x33bc9d[_0xf98e('0x14')],_0x1646de);_0x1c1b09(_0xc306ad[_0xf98e('0x12')](0x1f4,_0x33bc9d['message']));});});};exports[_0xf98e('0x23')]=function(_0x572129){var _0x3ca88e=this;return new Promise(function(_0x18d299,_0x45e2ff){return db[_0xf98e('0x18')][_0xf98e('0x24')](_0x572129['body'],{'raw':_0x572129[_0xf98e('0x1a')]?_0x572129[_0xf98e('0x1a')][_0xf98e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x572129[_0xf98e('0x1a')]?_0x572129['options']['where']||null:null,'attributes':_0x572129[_0xf98e('0x1a')]?_0x572129['options'][_0xf98e('0x1d')]||null:null,'limit':_0x572129[_0xf98e('0x1a')]?_0x572129[_0xf98e('0x1a')][_0xf98e('0x1e')]||null:null})['then'](function(_0x2731ba){logger['info']('UpdateCmHopperBlack',_0x572129);logger[_0xf98e('0x10')]('UpdateCmHopperBlack',_0x572129,JSON[_0xf98e('0x22')](_0x2731ba));_0x18d299(_0x2731ba);})[_0xf98e('0x16')](function(_0x1d3f3f){logger[_0xf98e('0x12')](_0xf98e('0x23'),_0x1d3f3f[_0xf98e('0x14')],_0x572129);_0x45e2ff(_0x3ca88e[_0xf98e('0x12')](0x1f4,_0x1d3f3f[_0xf98e('0x14')]));});});};exports[_0xf98e('0x25')]=function(_0xb89b29){var _0x4d00ee=this;return new Promise(function(_0x13e578,_0x3e7d93){return db[_0xf98e('0x18')][_0xf98e('0x26')]({'where':_0xb89b29[_0xf98e('0x1a')]?_0xb89b29[_0xf98e('0x1a')][_0xf98e('0x1c')]||null:null})[_0xf98e('0xc')](function(_0x32af0d){logger[_0xf98e('0xd')]('DestroyCmHopperBlack',_0xb89b29);logger[_0xf98e('0x10')]('DestroyCmHopperBlack',_0xb89b29,JSON['stringify'](_0x32af0d));_0x13e578(_0x32af0d);})[_0xf98e('0x16')](function(_0x14343e){logger[_0xf98e('0x12')](_0xf98e('0x25'),_0x14343e[_0xf98e('0x14')],_0xb89b29);_0x3e7d93(_0x4d00ee[_0xf98e('0x12')](0x1f4,_0x14343e[_0xf98e('0x14')]));});});}; \ No newline at end of file +var _0xbbea=['catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','then','debug','update','body','raw','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f04fb,_0x1a80d9){var _0x3f77e3=function(_0x3cdc23){while(--_0x3cdc23){_0x2f04fb['push'](_0x2f04fb['shift']());}};_0x3f77e3(++_0x1a80d9);}(_0xbbea,0x1f3));var _0xabbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xabbe('0x0'));var util=require('util');var moment=require(_0xabbe('0x1'));var BPromise=require(_0xabbe('0x2'));var rs=require(_0xabbe('0x3'));var fs=require('fs');var Redis=require(_0xabbe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabbe('0x5'));var logger=require('../../config/logger')(_0xabbe('0x6'));var config=require('../../config/environment');var jayson=require(_0xabbe('0x7'));var client=jayson[_0xabbe('0x8')][_0xabbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446fdc,_0x2ce4b1,_0x43dda0){return new BPromise(function(_0x191978,_0x3837c3){return client[_0xabbe('0xa')](_0x446fdc,_0x43dda0)['then'](function(_0x2bfcab){logger[_0xabbe('0xb')](_0xabbe('0xc'),_0x2ce4b1,_0xabbe('0xd'));logger['debug'](_0xabbe('0xe'),_0x2ce4b1,_0xabbe('0xd'),JSON[_0xabbe('0xf')](_0x2bfcab));if(_0x2bfcab[_0xabbe('0x10')]){if(_0x2bfcab[_0xabbe('0x10')][_0xabbe('0x11')]===0x1f4){logger['error'](_0xabbe('0xc'),_0x2ce4b1,_0x2bfcab[_0xabbe('0x10')][_0xabbe('0x12')]);return _0x3837c3(_0x2bfcab[_0xabbe('0x10')][_0xabbe('0x12')]);}logger[_0xabbe('0x10')](_0xabbe('0xc'),_0x2ce4b1,_0x2bfcab[_0xabbe('0x10')]['message']);return _0x191978(_0x2bfcab[_0xabbe('0x10')][_0xabbe('0x12')]);}else{logger[_0xabbe('0xb')](_0xabbe('0xc'),_0x2ce4b1,_0xabbe('0xd'));_0x191978(_0x2bfcab['result'][_0xabbe('0x12')]);}})[_0xabbe('0x13')](function(_0x419689){logger[_0xabbe('0x10')](_0xabbe('0xc'),_0x2ce4b1,_0x419689);_0x3837c3(_0x419689);});});}exports[_0xabbe('0x14')]=function(_0x513995){var _0x100139=this;return new Promise(function(_0x169539,_0xde08c8){return db[_0xabbe('0x15')]['findAll']({'raw':_0x513995[_0xabbe('0x16')]?_0x513995[_0xabbe('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x513995['options']?_0x513995['options'][_0xabbe('0x17')]||null:null,'attributes':_0x513995[_0xabbe('0x16')]?_0x513995[_0xabbe('0x16')][_0xabbe('0x18')]||null:null,'limit':_0x513995[_0xabbe('0x16')]?_0x513995[_0xabbe('0x16')][_0xabbe('0x19')]||null:null,'include':_0x513995[_0xabbe('0x16')]?_0x513995[_0xabbe('0x16')][_0xabbe('0x1a')]?_[_0xabbe('0x1b')](_0x513995[_0xabbe('0x16')][_0xabbe('0x1a')],function(_0x2344e0){return{'model':db[_0x2344e0[_0xabbe('0x1c')]],'as':_0x2344e0['as'],'attributes':_0x2344e0[_0xabbe('0x18')],'include':_0x2344e0[_0xabbe('0x1a')]?_[_0xabbe('0x1b')](_0x2344e0[_0xabbe('0x1a')],function(_0x1ff3a2){return{'model':db[_0x1ff3a2[_0xabbe('0x1c')]],'as':_0x1ff3a2['as'],'attributes':_0x1ff3a2[_0xabbe('0x18')],'include':_0x1ff3a2['include']?_[_0xabbe('0x1b')](_0x1ff3a2['include'],function(_0x5edf99){return{'model':db[_0x5edf99[_0xabbe('0x1c')]],'as':_0x5edf99['as'],'attributes':_0x5edf99['attributes']};}):[]};}):[]};}):[]:[]})[_0xabbe('0x1d')](function(_0x2a5a94){logger[_0xabbe('0xb')](_0xabbe('0x14'),_0x513995);logger[_0xabbe('0x1e')](_0xabbe('0x14'),_0x513995,JSON[_0xabbe('0xf')](_0x2a5a94));_0x169539(_0x2a5a94);})[_0xabbe('0x13')](function(_0x3ebc34){logger[_0xabbe('0x10')](_0xabbe('0x14'),_0x3ebc34[_0xabbe('0x12')],_0x513995);_0xde08c8(_0x100139[_0xabbe('0x10')](0x1f4,_0x3ebc34[_0xabbe('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x57a9dd){var _0x5ca2b1=this;return new Promise(function(_0x3de9f4,_0x586202){return db[_0xabbe('0x15')][_0xabbe('0x1f')](_0x57a9dd[_0xabbe('0x20')],{'raw':_0x57a9dd[_0xabbe('0x16')]?_0x57a9dd[_0xabbe('0x16')][_0xabbe('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a9dd[_0xabbe('0x16')]?_0x57a9dd['options'][_0xabbe('0x17')]||null:null,'attributes':_0x57a9dd[_0xabbe('0x16')]?_0x57a9dd[_0xabbe('0x16')][_0xabbe('0x18')]||null:null,'limit':_0x57a9dd[_0xabbe('0x16')]?_0x57a9dd[_0xabbe('0x16')][_0xabbe('0x19')]||null:null})['then'](function(_0x52daa8){logger['info'](_0xabbe('0x22'),_0x57a9dd);logger['debug'](_0xabbe('0x22'),_0x57a9dd,JSON[_0xabbe('0xf')](_0x52daa8));_0x3de9f4(_0x52daa8);})['catch'](function(_0x2f2608){logger[_0xabbe('0x10')](_0xabbe('0x22'),_0x2f2608[_0xabbe('0x12')],_0x57a9dd);_0x586202(_0x5ca2b1['error'](0x1f4,_0x2f2608[_0xabbe('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x2e4eb6){var _0x261180=this;return new Promise(function(_0x149b47,_0x3735e5){return db[_0xabbe('0x15')][_0xabbe('0x23')]({'where':_0x2e4eb6['options']?_0x2e4eb6[_0xabbe('0x16')][_0xabbe('0x17')]||null:null})['then'](function(_0x18e4b5){logger['info']('DestroyCmHopperBlack',_0x2e4eb6);logger[_0xabbe('0x1e')]('DestroyCmHopperBlack',_0x2e4eb6,JSON[_0xabbe('0xf')](_0x18e4b5));_0x149b47(_0x18e4b5);})['catch'](function(_0x4ac0d2){logger[_0xabbe('0x10')](_0xabbe('0x24'),_0x4ac0d2[_0xabbe('0x12')],_0x2e4eb6);_0x3735e5(_0x261180[_0xabbe('0x10')](0x1f4,_0x4ac0d2[_0xabbe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 756bb37..7212452 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x3ee7ae,_0x23432b){var _0xe94659=function(_0x55dd38){while(--_0x55dd38){_0x3ee7ae['push'](_0x3ee7ae['shift']());}};_0xe94659(++_0x23432b);}(_0x814b,0x1a2));var _0xb814=function(_0x4bcfa6,_0x1c7e43){_0x4bcfa6=_0x4bcfa6-0x0;var _0x1c0165=_0x814b[_0x4bcfa6];return _0x1c0165;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd101,0xc1));var _0x1d10=function(_0x480d59,_0x54c0e7){_0x480d59=_0x480d59-0x0;var _0x58898e=_0xd101[_0x480d59];return _0x58898e;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c5bb4f9..9c9a120 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 _0x8347=['STRING','DATE','getDataValue','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x5b1990,_0xf9a5cb){var _0x44cb98=function(_0x2f4332){while(--_0x2f4332){_0x5b1990['push'](_0x5b1990['shift']());}};_0x44cb98(++_0xf9a5cb);}(_0x8347,0xac));var _0x7834=function(_0x1d8764,_0x1d05c8){_0x1d8764=_0x1d8764-0x0;var _0x538ec8=_0x8347[_0x1d8764];return _0x538ec8;};'use strict';var Sequelize=require(_0x7834('0x0'));var moment=require(_0x7834('0x1'));module[_0x7834('0x2')]={'state':{'type':Sequelize[_0x7834('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7834('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x7834('0x4')]},'originatecalleridname':{'type':Sequelize[_0x7834('0x4')]},'calleridnum':{'type':Sequelize[_0x7834('0x4')]},'calleridname':{'type':Sequelize[_0x7834('0x4')]},'starttime':{'type':Sequelize[_0x7834('0x5')]},'responsetime':{'type':Sequelize[_0x7834('0x5')]},'answertime':{'type':Sequelize[_0x7834('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7834('0x5')]},'ringtime':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7834('0x4')]},'campaign':{'type':Sequelize[_0x7834('0x4')]},'campaigntype':{'type':Sequelize[_0x7834('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7834('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7834('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7834('0x4')]},'dispositionat':{'type':Sequelize[_0x7834('0x5')],'set':function(_0x29a424){var _0x3209da=this[_0x7834('0x6')]('endtime');if(_0x3209da&&_0x29a424){this[_0x7834('0x7')](_0x7834('0x8'),moment(_0x29a424)['diff'](moment(_0x3209da),_0x7834('0x9')));}}},'amd':{'type':Sequelize[_0x7834('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7834('0x5')]},'callback':{'type':Sequelize[_0x7834('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7834('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x7834('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7834('0x5')]},'recallme':{'type':Sequelize[_0x7834('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7834('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7834('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7132=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','moment','INTEGER'];(function(_0x4c460f,_0x2e2e97){var _0x453910=function(_0x4ea918){while(--_0x4ea918){_0x4c460f['push'](_0x4c460f['shift']());}};_0x453910(++_0x2e2e97);}(_0x7132,0xc6));var _0x2713=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x7132[_0x5c18ef];return _0x33789d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2713('0x0'));module['exports']={'state':{'type':Sequelize[_0x2713('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2713('0x2')]},'scheduledat':{'type':Sequelize[_0x2713('0x3')]},'countbusyretry':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2713('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2713('0x2')]},'calleridnum':{'type':Sequelize[_0x2713('0x2')]},'calleridname':{'type':Sequelize[_0x2713('0x2')]},'starttime':{'type':Sequelize[_0x2713('0x3')]},'responsetime':{'type':Sequelize[_0x2713('0x3')]},'answertime':{'type':Sequelize[_0x2713('0x3')]},'droptime':{'type':Sequelize[_0x2713('0x3')]},'endtime':{'type':Sequelize[_0x2713('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2713('0x2')]},'campaign':{'type':Sequelize[_0x2713('0x2')]},'campaigntype':{'type':Sequelize[_0x2713('0x2')]},'membername':{'type':Sequelize[_0x2713('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2713('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2713('0x2')]},'dispositionat':{'type':Sequelize[_0x2713('0x3')],'set':function(_0x376fc6){var _0x33b3a5=this[_0x2713('0x4')](_0x2713('0x5'));if(_0x33b3a5&&_0x376fc6){this[_0x2713('0x6')](_0x2713('0x7'),moment(_0x376fc6)[_0x2713('0x8')](moment(_0x33b3a5),'seconds'));}}},'amd':{'type':Sequelize[_0x2713('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2713('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2713('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2713('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x2713('0x3')]},'callback':{'type':Sequelize[_0x2713('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2713('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2713('0x3')]},'deleted':{'type':Sequelize[_0x2713('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2713('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2713('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2713('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2713('0x1')],'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 de0f8cf..e709fc0 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 _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x187d,0x93));var _0xd187=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x187d[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file +var _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x2beb01,_0x18d9c0){var _0x26b149=function(_0x1f37db){while(--_0x1f37db){_0x2beb01['push'](_0x2beb01['shift']());}};_0x26b149(++_0x18d9c0);}(_0x57ca,0x108));var _0xa57c=function(_0xdb8fed,_0x99fbf1){_0xdb8fed=_0xdb8fed-0x0;var _0x81c22f=_0x57ca[_0xdb8fed];return _0x81c22f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6df564e..2312836 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 _0x1306=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xc9e7d1,_0x1eb347){var _0x3e2333=function(_0x7e4797){while(--_0x7e4797){_0xc9e7d1['push'](_0xc9e7d1['shift']());}};_0x3e2333(++_0x1eb347);}(_0x1306,0x186));var _0x6130=function(_0x1bf084,_0xf690d0){_0x1bf084=_0x1bf084-0x0;var _0x4a96be=_0x1306[_0x1bf084];return _0x4a96be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6130('0x0'))(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var fs=require('fs');var path=require(_0x6130('0x5'));var rimraf=require(_0x6130('0x6'));var config=require(_0x6130('0x7'));var attributes=require(_0x6130('0x8'));module[_0x6130('0x9')]=function(_0x1afdd7,_0x740d5a){return _0x1afdd7[_0x6130('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0e3=['./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4eae42,_0x381d71){var _0x5139d2=function(_0x44b2a2){while(--_0x44b2a2){_0x4eae42['push'](_0x4eae42['shift']());}};_0x5139d2(++_0x381d71);}(_0xb0e3,0xe2));var _0x3b0e=function(_0x34ac66,_0x256061){_0x34ac66=_0x34ac66-0x0;var _0x51344d=_0xb0e3[_0x34ac66];return _0x51344d;};'use strict';var _=require(_0x3b0e('0x0'));var util=require(_0x3b0e('0x1'));var logger=require(_0x3b0e('0x2'))(_0x3b0e('0x3'));var moment=require(_0x3b0e('0x4'));var BPromise=require(_0x3b0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b0e('0x6'));var rimraf=require(_0x3b0e('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b0e('0x8'));module[_0x3b0e('0x9')]=function(_0x3e05a9,_0x19a959){return _0x3e05a9['define'](_0x3b0e('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x3b0e('0xb'),'fields':['calleridnum']},{'name':_0x3b0e('0xc'),'fields':[_0x3b0e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 63c1eab..aa7543f 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(_0x37cefb,_0xf80332){var _0xe44ed6=function(_0x1d2689){while(--_0x1d2689){_0x37cefb['push'](_0x37cefb['shift']());}};_0xe44ed6(++_0xf80332);}(_0xb10b,0x12a));var _0xbb10=function(_0x38eb22,_0x458a8c){_0x38eb22=_0x38eb22-0x0;var _0x49553e=_0xb10b[_0x38eb22];return _0x49553e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x18a0ec,_0x3bb4e7){var _0x2426bb=function(_0x38747c){while(--_0x38747c){_0x18a0ec['push'](_0x18a0ec['shift']());}};_0x2426bb(++_0x3bb4e7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0xb10b[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 4a326b3..e1bac1d 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 _0xa775=['/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post'];(function(_0x4ff24f,_0x5b177e){var _0x1413ab=function(_0x20c9ff){while(--_0x20c9ff){_0x4ff24f['push'](_0x4ff24f['shift']());}};_0x1413ab(++_0x5b177e);}(_0xa775,0xf6));var _0x5a77=function(_0x19e6d5,_0x4cfde4){_0x19e6d5=_0x19e6d5-0x0;var _0x334c3e=_0xa775[_0x19e6d5];return _0x334c3e;};'use strict';var multer=require(_0x5a77('0x0'));var util=require('util');var path=require(_0x5a77('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a77('0x2')]();var fs_extra=require(_0x5a77('0x3'));var auth=require(_0x5a77('0x4'));var interaction=require(_0x5a77('0x5'));var config=require('../../config/environment');var controller=require(_0x5a77('0x6'));router[_0x5a77('0x7')]('/',auth[_0x5a77('0x8')](),controller[_0x5a77('0x9')]);router[_0x5a77('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x5a77('0xa'),auth[_0x5a77('0x8')](),controller[_0x5a77('0xb')]);router[_0x5a77('0x7')](_0x5a77('0xc'),auth[_0x5a77('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x5a77('0x7')](_0x5a77('0xd'),auth['isAuthenticated'](),controller[_0x5a77('0xe')]);router['post'](_0x5a77('0xf'),auth[_0x5a77('0x8')](),controller[_0x5a77('0x10')]);router[_0x5a77('0x11')](_0x5a77('0x12'),auth[_0x5a77('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x5a77('0x11')](_0x5a77('0x13'),auth[_0x5a77('0x8')](),controller[_0x5a77('0x14')]);router['put'](_0x5a77('0xa'),auth[_0x5a77('0x8')](),controller['update']);module[_0x5a77('0x15')]=router; \ No newline at end of file +var _0x9fda=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','connect-timeout','express','Router'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9fda,0x8c));var _0xa9fd=function(_0x3e8970,_0x48f87b){_0x3e8970=_0x3e8970-0x0;var _0x1a499d=_0x9fda[_0x3e8970];return _0x1a499d;};'use strict';var multer=require(_0xa9fd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa9fd('0x1'));var express=require(_0xa9fd('0x2'));var router=express[_0xa9fd('0x3')]();var fs_extra=require(_0xa9fd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa9fd('0x5'));var config=require(_0xa9fd('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xa9fd('0x7')]('/',auth[_0xa9fd('0x8')](),controller['index']);router['get'](_0xa9fd('0x9'),auth[_0xa9fd('0x8')](),controller[_0xa9fd('0xa')]);router[_0xa9fd('0x7')](_0xa9fd('0xb'),auth['isAuthenticated'](),controller[_0xa9fd('0xc')]);router[_0xa9fd('0x7')](_0xa9fd('0xd'),auth['isAuthenticated'](),controller[_0xa9fd('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0xa9fd('0x8')](),controller[_0xa9fd('0xf')]);router[_0xa9fd('0x10')]('/voice/queue/moveContacts/:id',auth[_0xa9fd('0x8')](),controller[_0xa9fd('0x11')]);router[_0xa9fd('0x10')](_0xa9fd('0x12'),auth['isAuthenticated'](),controller[_0xa9fd('0x13')]);router[_0xa9fd('0x10')](_0xa9fd('0x14'),auth[_0xa9fd('0x8')](),controller[_0xa9fd('0x15')]);router[_0xa9fd('0x16')](_0xa9fd('0xb'),auth[_0xa9fd('0x8')](),controller['update']);module[_0xa9fd('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a47ce1a..946f452 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 _0x9167=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x56d790,_0x17ba8a){var _0x148305=function(_0x3b335e){while(--_0x3b335e){_0x56d790['push'](_0x56d790['shift']());}};_0x148305(++_0x17ba8a);}(_0x9167,0x16b));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7916('0x0'));module[_0x7916('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7916('0x2')]},'scheduledat':{'type':Sequelize[_0x7916('0x3')]},'countbusyretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7916('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x7916('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7916('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7916('0x2')]},'starttime':{'type':Sequelize[_0x7916('0x3')]},'responsetime':{'type':Sequelize[_0x7916('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7916('0x3')]},'endtime':{'type':Sequelize[_0x7916('0x3')]},'ringtime':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7916('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7916('0x2')]},'reason':{'type':Sequelize[_0x7916('0x2')]},'amd':{'type':Sequelize[_0x7916('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7916('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7916('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7916('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7916('0x3')]},'recallme':{'type':Sequelize[_0x7916('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7916('0x3')]},'edited':{'type':Sequelize[_0x7916('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7916('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7916('0x2')]}}; \ No newline at end of file +var _0x533b=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3aa1d6,_0x146b62){var _0x118f15=function(_0x318430){while(--_0x318430){_0x3aa1d6['push'](_0x3aa1d6['shift']());}};_0x118f15(++_0x146b62);}(_0x533b,0x18b));var _0xb533=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x533b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb533('0x0')]={'state':{'type':Sequelize[_0xb533('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb533('0x2')]},'scheduledat':{'type':Sequelize[_0xb533('0x3')]},'countbusyretry':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb533('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xb533('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb533('0x2')]},'calleridnum':{'type':Sequelize[_0xb533('0x2')]},'calleridname':{'type':Sequelize[_0xb533('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb533('0x3')]},'droptime':{'type':Sequelize[_0xb533('0x3')]},'endtime':{'type':Sequelize[_0xb533('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb533('0x2')]},'campaign':{'type':Sequelize[_0xb533('0x2')]},'campaigntype':{'type':Sequelize[_0xb533('0x2')]},'membername':{'type':Sequelize[_0xb533('0x2')]},'reason':{'type':Sequelize[_0xb533('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb533('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb533('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb533('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb533('0x3')]},'recallme':{'type':Sequelize[_0xb533('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb533('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb533('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb533('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0caddda..ee6dc51 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 _0x5bcc=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0xf14892,_0x88c487){var _0x5b5cd5=function(_0xf1ac7){while(--_0xf1ac7){_0xf14892['push'](_0xf14892['shift']());}};_0x5b5cd5(++_0x88c487);}(_0x5bcc,0x8a));var _0xc5bc=function(_0x23eaf1,_0x3eb57b){_0x23eaf1=_0x23eaf1-0x0;var _0xdbb28=_0x5bcc[_0x23eaf1];return _0xdbb28;};'use strict';var emlformat=require(_0xc5bc('0x0'));var rimraf=require(_0xc5bc('0x1'));var zipdir=require(_0xc5bc('0x2'));var jsonpatch=require(_0xc5bc('0x3'));var rp=require(_0xc5bc('0x4'));var moment=require(_0xc5bc('0x5'));var BPromise=require(_0xc5bc('0x6'));var Mustache=require(_0xc5bc('0x7'));var util=require(_0xc5bc('0x8'));var path=require('path');var sox=require(_0xc5bc('0x9'));var csv=require(_0xc5bc('0xa'));var ejs=require(_0xc5bc('0xb'));var fs=require('fs');var fs_extra=require(_0xc5bc('0xc'));var _=require(_0xc5bc('0xd'));var squel=require('squel');var crypto=require(_0xc5bc('0xe'));var jsforce=require(_0xc5bc('0xf'));var deskjs=require(_0xc5bc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5bc('0x11'));var Redis=require(_0xc5bc('0x12'));var authService=require(_0xc5bc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc5bc('0x14'));var hardwareService=require(_0xc5bc('0x15'));var logger=require('../../config/logger')(_0xc5bc('0x16'));var utils=require('../../config/utils');var config=require(_0xc5bc('0x17'));var licenseUtil=require(_0xc5bc('0x18'));var db=require(_0xc5bc('0x19'))['db'];function respondWithStatusCode(_0x5e3a00,_0x2a3174){_0x2a3174=_0x2a3174||0xcc;return function(_0x2a6091){if(_0x2a6091){return _0x5e3a00[_0xc5bc('0x1a')](_0x2a3174);}return _0x5e3a00[_0xc5bc('0x1b')](_0x2a3174)[_0xc5bc('0x1c')]();};}function respondWithResult(_0x594e4f,_0x5767b6){_0x5767b6=_0x5767b6||0xc8;return function(_0x3bf7b3){if(_0x3bf7b3){return _0x594e4f['status'](_0x5767b6)[_0xc5bc('0x1d')](_0x3bf7b3);}};}function respondWithFilteredResult(_0x5dff6a,_0x1a9de4){return function(_0x326570){if(_0x326570){var _0xa21a3=typeof _0x1a9de4[_0xc5bc('0x1e')]===_0xc5bc('0x1f')&&typeof _0x1a9de4[_0xc5bc('0x20')]===_0xc5bc('0x1f');var _0x2547f8=_0x326570['count'];var _0xd86c89=_0xa21a3?0x0:_0x1a9de4[_0xc5bc('0x1e')];var _0x17f6ee=_0xa21a3?_0x326570[_0xc5bc('0x21')]:_0x1a9de4['offset']+_0x1a9de4[_0xc5bc('0x20')];var _0x2f1030;if(_0x17f6ee>=_0x2547f8){_0x17f6ee=_0x2547f8;_0x2f1030=0xc8;}else{_0x2f1030=0xce;}_0x5dff6a[_0xc5bc('0x1b')](_0x2f1030);return _0x5dff6a['set'](_0xc5bc('0x22'),_0xd86c89+'-'+_0x17f6ee+'/'+_0x2547f8)[_0xc5bc('0x1d')](_0x326570);}return null;};}function patchUpdates(_0x495502){return function(_0x44d743){try{jsonpatch[_0xc5bc('0x23')](_0x44d743,_0x495502,!![]);}catch(_0x4b0143){return BPromise[_0xc5bc('0x24')](_0x4b0143);}return _0x44d743[_0xc5bc('0x25')]();};}function saveUpdates(_0x3b337e,_0x5e290d){return function(_0x61bc19){if(_0x61bc19){return _0x61bc19[_0xc5bc('0x26')](_0x3b337e)[_0xc5bc('0x27')](function(_0x863f04){return _0x863f04;});}return null;};}function removeEntity(_0xa91e6e,_0x14ef8d){return function(_0x205234){if(_0x205234){return _0x205234[_0xc5bc('0x28')]()['then'](function(){_0xa91e6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e62,_0x3568b0){return function(_0x4b5632){if(!_0x4b5632){_0x50e62[_0xc5bc('0x1a')](0x194);}return _0x4b5632;};}function handleError(_0x1965ab,_0x5750cc){_0x5750cc=_0x5750cc||0x1f4;return function(_0x1c11c3){logger[_0xc5bc('0x29')](_0x1c11c3[_0xc5bc('0x2a')]);if(_0x1c11c3[_0xc5bc('0x2b')]){delete _0x1c11c3['name'];}_0x1965ab[_0xc5bc('0x1b')](_0x5750cc)[_0xc5bc('0x2c')](_0x1c11c3);};}exports[_0xc5bc('0x2d')]=function(_0x3e59c8,_0xdbf5d){var _0x44dfd2={},_0x4edb7b={},_0x4db48a={'count':0x0,'rows':[]};var _0x31bec8=_['map'](db[_0xc5bc('0x2e')][_0xc5bc('0x2f')],function(_0x1d95c5){return{'name':_0x1d95c5[_0xc5bc('0x30')],'type':_0x1d95c5[_0xc5bc('0x31')][_0xc5bc('0x32')]};});_0x4edb7b[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x31bec8,'name');_0x4edb7b['query']=_['keys'](_0x3e59c8[_0xc5bc('0x35')]);_0x4edb7b[_0xc5bc('0x36')]=_[_0xc5bc('0x37')](_0x4edb7b[_0xc5bc('0x33')],_0x4edb7b['query']);_0x44dfd2[_0xc5bc('0x38')]=_['intersection'](_0x4edb7b[_0xc5bc('0x33')],qs[_0xc5bc('0x39')](_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x39')]));_0x44dfd2[_0xc5bc('0x38')]=_0x44dfd2[_0xc5bc('0x38')][_0xc5bc('0x3a')]?_0x44dfd2[_0xc5bc('0x38')]:_0x4edb7b[_0xc5bc('0x33')];if(!_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x3b')](_0xc5bc('0x3c'))){_0x44dfd2[_0xc5bc('0x20')]=qs[_0xc5bc('0x20')](_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x20')]);_0x44dfd2[_0xc5bc('0x1e')]=qs[_0xc5bc('0x1e')](_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x1e')]);}_0x44dfd2[_0xc5bc('0x3d')]=qs[_0xc5bc('0x3e')](_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x3e')]);_0x44dfd2[_0xc5bc('0x3f')]=qs['filters'](_[_0xc5bc('0x40')](_0x3e59c8['query'],_0x4edb7b[_0xc5bc('0x36')]),_0x31bec8);if(_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x41')]){_0x44dfd2[_0xc5bc('0x3f')]=_[_0xc5bc('0x42')](_0x44dfd2['where'],{'$or':_['map'](_0x31bec8,function(_0x32f0b5){if(_0x32f0b5[_0xc5bc('0x31')]!=='VIRTUAL'){var _0x26f1fd={};_0x26f1fd[_0x32f0b5[_0xc5bc('0x2b')]]={'$like':'%'+_0x3e59c8['query'][_0xc5bc('0x41')]+'%'};return _0x26f1fd;}})});}_0x44dfd2=_[_0xc5bc('0x42')]({},_0x44dfd2,_0x3e59c8[_0xc5bc('0x43')]);var _0x3aa2b9={'where':_0x44dfd2[_0xc5bc('0x3f')]};return db['CmHopperHistory'][_0xc5bc('0x21')](_0x3aa2b9)[_0xc5bc('0x27')](function(_0x21aa3e){_0x4db48a[_0xc5bc('0x21')]=_0x21aa3e;if(_0x3e59c8[_0xc5bc('0x35')][_0xc5bc('0x44')]){_0x44dfd2[_0xc5bc('0x45')]=[{'all':!![]}];}return db[_0xc5bc('0x2e')][_0xc5bc('0x46')](_0x44dfd2);})[_0xc5bc('0x27')](function(_0x3e690f){_0x4db48a[_0xc5bc('0x47')]=_0x3e690f;return _0x4db48a;})['then'](respondWithFilteredResult(_0xdbf5d,_0x44dfd2))[_0xc5bc('0x48')](handleError(_0xdbf5d,null));};exports[_0xc5bc('0x49')]=function(_0x19ddc3,_0x19c0f4){var _0x5f6ff5={'raw':!![],'where':{'id':_0x19ddc3[_0xc5bc('0x4a')]['id']}},_0x480254={};_0x480254[_0xc5bc('0x33')]=_[_0xc5bc('0x4b')](db['CmHopperHistory'][_0xc5bc('0x2f')]);_0x480254[_0xc5bc('0x35')]=_[_0xc5bc('0x4b')](_0x19ddc3[_0xc5bc('0x35')]);_0x480254[_0xc5bc('0x36')]=_[_0xc5bc('0x37')](_0x480254[_0xc5bc('0x33')],_0x480254[_0xc5bc('0x35')]);_0x5f6ff5['attributes']=_[_0xc5bc('0x37')](_0x480254[_0xc5bc('0x33')],qs[_0xc5bc('0x39')](_0x19ddc3[_0xc5bc('0x35')]['fields']));_0x5f6ff5[_0xc5bc('0x38')]=_0x5f6ff5[_0xc5bc('0x38')][_0xc5bc('0x3a')]?_0x5f6ff5[_0xc5bc('0x38')]:_0x480254[_0xc5bc('0x33')];if(_0x19ddc3['query'][_0xc5bc('0x44')]){_0x5f6ff5[_0xc5bc('0x45')]=[{'all':!![]}];}_0x5f6ff5=_[_0xc5bc('0x42')]({},_0x5f6ff5,_0x19ddc3[_0xc5bc('0x43')]);return db['CmHopperHistory'][_0xc5bc('0x4c')](_0x5f6ff5)['then'](handleEntityNotFound(_0x19c0f4,null))[_0xc5bc('0x27')](respondWithResult(_0x19c0f4,null))[_0xc5bc('0x48')](handleError(_0x19c0f4,null));};exports[_0xc5bc('0x4d')]=function(_0x200b89,_0x1506bf){return db[_0xc5bc('0x2e')][_0xc5bc('0x4d')](_0x200b89[_0xc5bc('0x4e')],{})['then'](respondWithResult(_0x1506bf,0xc9))[_0xc5bc('0x48')](handleError(_0x1506bf,null));};exports[_0xc5bc('0x4f')]=function(_0x2b8d3e,_0x53f078){return db[_0xc5bc('0x2e')][_0xc5bc('0x4f')]()['then'](respondWithResult(_0x53f078,null))[_0xc5bc('0x48')](handleError(_0x53f078,null));};exports[_0xc5bc('0x26')]=function(_0x331e60,_0x2d4f1e){if(_0x331e60[_0xc5bc('0x4e')][_0xc5bc('0x50')]){delete _0x331e60[_0xc5bc('0x4e')][_0xc5bc('0x50')];}return db[_0xc5bc('0x2e')][_0xc5bc('0x4c')]({'where':{'uniqueid':_0x331e60['params']['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x2d4f1e,null))[_0xc5bc('0x27')](saveUpdates(_0x331e60[_0xc5bc('0x4e')],null))[_0xc5bc('0x27')](respondWithResult(_0x2d4f1e,null))[_0xc5bc('0x48')](handleError(_0x2d4f1e,null));}; \ No newline at end of file +var _0x4e5f=['request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','filters','query','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','CmHopperHistory','includeAll','include','findAll','show','params','rawAttributes','keys','find','catch','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x56f1e3,_0x202614){var _0x1b6798=function(_0x18a700){while(--_0x18a700){_0x56f1e3['push'](_0x56f1e3['shift']());}};_0x1b6798(++_0x202614);}(_0x4e5f,0x1be));var _0xf4e5=function(_0x1fed6c,_0x574a42){_0x1fed6c=_0x1fed6c-0x0;var _0x39325=_0x4e5f[_0x1fed6c];return _0x39325;};'use strict';var emlformat=require(_0xf4e5('0x0'));var rimraf=require(_0xf4e5('0x1'));var zipdir=require(_0xf4e5('0x2'));var jsonpatch=require(_0xf4e5('0x3'));var rp=require(_0xf4e5('0x4'));var moment=require(_0xf4e5('0x5'));var BPromise=require(_0xf4e5('0x6'));var Mustache=require(_0xf4e5('0x7'));var util=require(_0xf4e5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf4e5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4e5('0xa'));var _=require(_0xf4e5('0xb'));var squel=require(_0xf4e5('0xc'));var crypto=require(_0xf4e5('0xd'));var jsforce=require(_0xf4e5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf4e5('0x9'));var querystring=require(_0xf4e5('0xf'));var Papa=require(_0xf4e5('0x10'));var Redis=require(_0xf4e5('0x11'));var authService=require(_0xf4e5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf4e5('0x13'));var hardwareService=require(_0xf4e5('0x14'));var logger=require(_0xf4e5('0x15'))('api');var utils=require(_0xf4e5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf4e5('0x17'))['db'];function respondWithStatusCode(_0x542f17,_0x1b3956){_0x1b3956=_0x1b3956||0xcc;return function(_0xbf69aa){if(_0xbf69aa){return _0x542f17[_0xf4e5('0x18')](_0x1b3956);}return _0x542f17[_0xf4e5('0x19')](_0x1b3956)[_0xf4e5('0x1a')]();};}function respondWithResult(_0x26890a,_0x5330bc){_0x5330bc=_0x5330bc||0xc8;return function(_0x3bd401){if(_0x3bd401){return _0x26890a['status'](_0x5330bc)[_0xf4e5('0x1b')](_0x3bd401);}};}function respondWithFilteredResult(_0x301ed7,_0x480195){return function(_0xce3ade){if(_0xce3ade){var _0x3bf0b7=typeof _0x480195[_0xf4e5('0x1c')]===_0xf4e5('0x1d')&&typeof _0x480195[_0xf4e5('0x1e')]===_0xf4e5('0x1d');var _0x2fe53c=_0xce3ade['count'];var _0x316d91=_0x3bf0b7?0x0:_0x480195['offset'];var _0xb41c01=_0x3bf0b7?_0xce3ade[_0xf4e5('0x1f')]:_0x480195[_0xf4e5('0x1c')]+_0x480195[_0xf4e5('0x1e')];var _0x3b4dbe;if(_0xb41c01>=_0x2fe53c){_0xb41c01=_0x2fe53c;_0x3b4dbe=0xc8;}else{_0x3b4dbe=0xce;}_0x301ed7[_0xf4e5('0x19')](_0x3b4dbe);return _0x301ed7[_0xf4e5('0x20')]('Content-Range',_0x316d91+'-'+_0xb41c01+'/'+_0x2fe53c)['json'](_0xce3ade);}return null;};}function patchUpdates(_0x3fa367){return function(_0x1b2b6d){try{jsonpatch['apply'](_0x1b2b6d,_0x3fa367,!![]);}catch(_0xa4b9a9){return BPromise[_0xf4e5('0x21')](_0xa4b9a9);}return _0x1b2b6d['save']();};}function saveUpdates(_0x13f4f3,_0x1fc491){return function(_0x4cf8a7){if(_0x4cf8a7){return _0x4cf8a7[_0xf4e5('0x22')](_0x13f4f3)[_0xf4e5('0x23')](function(_0x23e450){return _0x23e450;});}return null;};}function removeEntity(_0x151818,_0x51300d){return function(_0x448254){if(_0x448254){return _0x448254[_0xf4e5('0x24')]()[_0xf4e5('0x23')](function(){_0x151818[_0xf4e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ae5d,_0x4d341e){return function(_0x3ff421){if(!_0x3ff421){_0x46ae5d[_0xf4e5('0x18')](0x194);}return _0x3ff421;};}function handleError(_0x8fe380,_0x113ddf){_0x113ddf=_0x113ddf||0x1f4;return function(_0x591192){logger[_0xf4e5('0x25')](_0x591192[_0xf4e5('0x26')]);if(_0x591192[_0xf4e5('0x27')]){delete _0x591192[_0xf4e5('0x27')];}_0x8fe380['status'](_0x113ddf)[_0xf4e5('0x28')](_0x591192);};}exports[_0xf4e5('0x29')]=function(_0x9e24e,_0x532005){var _0x175f79={},_0x12e43b={},_0x495916={'count':0x0,'rows':[]};var _0x2df47c=_[_0xf4e5('0x2a')](db['CmHopperHistory']['rawAttributes'],function(_0x440f18){return{'name':_0x440f18[_0xf4e5('0x2b')],'type':_0x440f18['type'][_0xf4e5('0x2c')]};});_0x12e43b[_0xf4e5('0x2d')]=_[_0xf4e5('0x2a')](_0x2df47c,'name');_0x12e43b['query']=_['keys'](_0x9e24e['query']);_0x12e43b[_0xf4e5('0x2e')]=_['intersection'](_0x12e43b[_0xf4e5('0x2d')],_0x12e43b[_0xf4e5('0x2f')]);_0x175f79[_0xf4e5('0x30')]=_[_0xf4e5('0x31')](_0x12e43b[_0xf4e5('0x2d')],qs[_0xf4e5('0x32')](_0x9e24e['query'][_0xf4e5('0x32')]));_0x175f79[_0xf4e5('0x30')]=_0x175f79[_0xf4e5('0x30')][_0xf4e5('0x33')]?_0x175f79[_0xf4e5('0x30')]:_0x12e43b[_0xf4e5('0x2d')];if(!_0x9e24e['query']['hasOwnProperty'](_0xf4e5('0x34'))){_0x175f79[_0xf4e5('0x1e')]=qs['limit'](_0x9e24e[_0xf4e5('0x2f')][_0xf4e5('0x1e')]);_0x175f79['offset']=qs[_0xf4e5('0x1c')](_0x9e24e[_0xf4e5('0x2f')][_0xf4e5('0x1c')]);}_0x175f79[_0xf4e5('0x35')]=qs['sort'](_0x9e24e['query'][_0xf4e5('0x36')]);_0x175f79['where']=qs[_0xf4e5('0x2e')](_[_0xf4e5('0x37')](_0x9e24e[_0xf4e5('0x2f')],_0x12e43b['filters']),_0x2df47c);if(_0x9e24e['query'][_0xf4e5('0x38')]){_0x175f79[_0xf4e5('0x39')]=_[_0xf4e5('0x3a')](_0x175f79['where'],{'$or':_[_0xf4e5('0x2a')](_0x2df47c,function(_0x38657f){if(_0x38657f[_0xf4e5('0x3b')]!=='VIRTUAL'){var _0x3b9c48={};_0x3b9c48[_0x38657f[_0xf4e5('0x27')]]={'$like':'%'+_0x9e24e[_0xf4e5('0x2f')][_0xf4e5('0x38')]+'%'};return _0x3b9c48;}})});}_0x175f79=_['merge']({},_0x175f79,_0x9e24e[_0xf4e5('0x3c')]);var _0x44ca90={'where':_0x175f79[_0xf4e5('0x39')]};return db[_0xf4e5('0x3d')][_0xf4e5('0x1f')](_0x44ca90)[_0xf4e5('0x23')](function(_0x4978a0){_0x495916[_0xf4e5('0x1f')]=_0x4978a0;if(_0x9e24e[_0xf4e5('0x2f')][_0xf4e5('0x3e')]){_0x175f79[_0xf4e5('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf4e5('0x40')](_0x175f79);})['then'](function(_0x551710){_0x495916['rows']=_0x551710;return _0x495916;})[_0xf4e5('0x23')](respondWithFilteredResult(_0x532005,_0x175f79))['catch'](handleError(_0x532005,null));};exports[_0xf4e5('0x41')]=function(_0x49fb75,_0x363349){var _0x39cf5d={'raw':!![],'where':{'id':_0x49fb75[_0xf4e5('0x42')]['id']}},_0x8bf803={};_0x8bf803[_0xf4e5('0x2d')]=_['keys'](db[_0xf4e5('0x3d')][_0xf4e5('0x43')]);_0x8bf803[_0xf4e5('0x2f')]=_[_0xf4e5('0x44')](_0x49fb75[_0xf4e5('0x2f')]);_0x8bf803[_0xf4e5('0x2e')]=_[_0xf4e5('0x31')](_0x8bf803[_0xf4e5('0x2d')],_0x8bf803['query']);_0x39cf5d[_0xf4e5('0x30')]=_['intersection'](_0x8bf803[_0xf4e5('0x2d')],qs[_0xf4e5('0x32')](_0x49fb75[_0xf4e5('0x2f')][_0xf4e5('0x32')]));_0x39cf5d[_0xf4e5('0x30')]=_0x39cf5d[_0xf4e5('0x30')][_0xf4e5('0x33')]?_0x39cf5d[_0xf4e5('0x30')]:_0x8bf803['model'];if(_0x49fb75[_0xf4e5('0x2f')][_0xf4e5('0x3e')]){_0x39cf5d[_0xf4e5('0x3f')]=[{'all':!![]}];}_0x39cf5d=_[_0xf4e5('0x3a')]({},_0x39cf5d,_0x49fb75[_0xf4e5('0x3c')]);return db[_0xf4e5('0x3d')][_0xf4e5('0x45')](_0x39cf5d)['then'](handleEntityNotFound(_0x363349,null))[_0xf4e5('0x23')](respondWithResult(_0x363349,null))[_0xf4e5('0x46')](handleError(_0x363349,null));};exports[_0xf4e5('0x47')]=function(_0x2b3dca,_0x5e8cad){return db[_0xf4e5('0x3d')]['create'](_0x2b3dca['body'],{})[_0xf4e5('0x23')](respondWithResult(_0x5e8cad,0xc9))[_0xf4e5('0x46')](handleError(_0x5e8cad,null));};exports[_0xf4e5('0x48')]=function(_0x5236f4,_0x21be9b){return db[_0xf4e5('0x3d')][_0xf4e5('0x48')]()[_0xf4e5('0x23')](respondWithResult(_0x21be9b,null))[_0xf4e5('0x46')](handleError(_0x21be9b,null));};exports[_0xf4e5('0x22')]=function(_0x162bc9,_0x28b1c4){if(_0x162bc9['body']['uniqueid']){delete _0x162bc9[_0xf4e5('0x49')][_0xf4e5('0x4a')];}return db[_0xf4e5('0x3d')]['find']({'where':{'uniqueid':_0x162bc9[_0xf4e5('0x42')]['id']}})[_0xf4e5('0x23')](handleEntityNotFound(_0x28b1c4,null))[_0xf4e5('0x23')](saveUpdates(_0x162bc9[_0xf4e5('0x49')],null))[_0xf4e5('0x23')](respondWithResult(_0x28b1c4,null))[_0xf4e5('0x46')](handleError(_0x28b1c4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f67764e..fea7310 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 _0x955f=['util','../../config/logger','api','moment','request-promise','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x3ad30b,_0xc4390c){var _0x4af49c=function(_0x374e3a){while(--_0x374e3a){_0x3ad30b['push'](_0x3ad30b['shift']());}};_0x4af49c(++_0xc4390c);}(_0x955f,0x1eb));var _0xf955=function(_0x2cb852,_0x3b1f98){_0x2cb852=_0x2cb852-0x0;var _0xd60572=_0x955f[_0x2cb852];return _0xd60572;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf955('0xa')]},{'name':_0xf955('0xb'),'fields':[_0xf955('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad07=['util','api','moment','path','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0xde9d67,_0x53606b){var _0x1e28c8=function(_0x47185e){while(--_0x47185e){_0xde9d67['push'](_0xde9d67['shift']());}};_0x1e28c8(++_0x53606b);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var logger=require('../../config/logger')(_0x7ad0('0x2'));var moment=require(_0x7ad0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ad0('0x4'));var rimraf=require(_0x7ad0('0x5'));var config=require(_0x7ad0('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x7ad0('0x7')]=function(_0x4bff98,_0x5e81bd){return _0x4bff98[_0x7ad0('0x8')](_0x7ad0('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7ad0('0xa')]},{'name':_0x7ad0('0xb'),'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 46c6c0f..25b9159 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 _0xf485=['name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','catch','CmHopperHistory','body','options','raw','then','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory'];(function(_0x43c62a,_0x125d82){var _0x367fb8=function(_0x163f52){while(--_0x163f52){_0x43c62a['push'](_0x43c62a['shift']());}};_0x367fb8(++_0x125d82);}(_0xf485,0x1af));var _0x5f48=function(_0x15d066,_0x539c8a){_0x15d066=_0x15d066-0x0;var _0x453b3e=_0xf485[_0x15d066];return _0x453b3e;};'use strict';var _=require(_0x5f48('0x0'));var util=require('util');var moment=require(_0x5f48('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f48('0x2'));var fs=require('fs');var Redis=require(_0x5f48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f48('0x4'));var logger=require(_0x5f48('0x5'))(_0x5f48('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f48('0x7'));var client=jayson[_0x5f48('0x8')][_0x5f48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x427713,_0x2013b2,_0x475a1a){return new BPromise(function(_0x1c33dd,_0x3ea948){return client[_0x5f48('0xa')](_0x427713,_0x475a1a)['then'](function(_0x1cfc7f){logger[_0x5f48('0xb')](_0x5f48('0xc'),_0x2013b2,_0x5f48('0xd'));logger[_0x5f48('0xe')](_0x5f48('0xf'),_0x2013b2,_0x5f48('0xd'),JSON['stringify'](_0x1cfc7f));if(_0x1cfc7f[_0x5f48('0x10')]){if(_0x1cfc7f[_0x5f48('0x10')]['code']===0x1f4){logger[_0x5f48('0x10')](_0x5f48('0xc'),_0x2013b2,_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);return _0x3ea948(_0x1cfc7f[_0x5f48('0x10')]['message']);}logger['error'](_0x5f48('0xc'),_0x2013b2,_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);return _0x1c33dd(_0x1cfc7f[_0x5f48('0x10')][_0x5f48('0x11')]);}else{logger[_0x5f48('0xb')](_0x5f48('0xc'),_0x2013b2,_0x5f48('0xd'));_0x1c33dd(_0x1cfc7f['result'][_0x5f48('0x11')]);}})[_0x5f48('0x12')](function(_0x29adc2){logger[_0x5f48('0x10')](_0x5f48('0xc'),_0x2013b2,_0x29adc2);_0x3ea948(_0x29adc2);});});}exports['CreateCmHopperHistory']=function(_0x1d6054){var _0x761798=this;return new Promise(function(_0x36896c,_0x20ad28){return db[_0x5f48('0x13')]['create'](_0x1d6054[_0x5f48('0x14')],{'raw':_0x1d6054[_0x5f48('0x15')]?_0x1d6054[_0x5f48('0x15')][_0x5f48('0x16')]===undefined?!![]:![]:!![]})[_0x5f48('0x17')](function(_0x1c0e83){logger[_0x5f48('0xb')](_0x5f48('0x18'),_0x1d6054);logger['debug']('CreateCmHopperHistory',_0x1d6054,JSON[_0x5f48('0x19')](_0x1c0e83));_0x36896c(_0x1c0e83);})[_0x5f48('0x12')](function(_0x535830){logger[_0x5f48('0x10')](_0x5f48('0x18'),_0x535830['message'],_0x1d6054);_0x20ad28(_0x761798[_0x5f48('0x10')](0x1f4,_0x535830['message']));});});};exports[_0x5f48('0x1a')]=function(_0x315b72){var _0x181fc5=this;return new Promise(function(_0x4b99a7,_0x48520f){return db[_0x5f48('0x13')][_0x5f48('0x1b')]({'raw':_0x315b72['options']?_0x315b72['options'][_0x5f48('0x16')]===undefined?!![]:![]:!![],'where':_0x315b72['options']?_0x315b72[_0x5f48('0x15')][_0x5f48('0x1c')]||null:null,'attributes':[[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')][_0x5f48('0x1f')]('id')),_0x5f48('0x20')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x22')))),_0x5f48('0x23')],[db['sequelize']['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')]['literal'](_0x5f48('0x24')))),_0x5f48('0x25')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db['sequelize'][_0x5f48('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x5f48('0x26')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x27'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x28')))),_0x5f48('0x29')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x27'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')]['literal'](_0x5f48('0x2a')))),_0x5f48('0x2b')]]})[_0x5f48('0x17')](function(_0x5275fa){logger[_0x5f48('0xb')]('AvgHandleTime',_0x315b72);logger[_0x5f48('0xe')](_0x5f48('0x1a'),_0x315b72,JSON[_0x5f48('0x19')](_0x5275fa));_0x4b99a7(_0x5275fa);})[_0x5f48('0x12')](function(_0x3101eb){logger[_0x5f48('0x10')]('AvgHandleTime',_0x3101eb['message'],_0x315b72);_0x48520f(_0x181fc5['error'](0x1f4,_0x3101eb[_0x5f48('0x11')]));});});};exports[_0x5f48('0x2c')]=function(_0x53de1d){var _0x43a9a9=this;return new Promise(function(_0x225d30,_0x131931){return db[_0x5f48('0x13')][_0x5f48('0x1b')]({'raw':_0x53de1d[_0x5f48('0x15')]?_0x53de1d[_0x5f48('0x15')][_0x5f48('0x16')]===undefined?!![]:![]:!![],'where':_0x53de1d[_0x5f48('0x15')]?_0x53de1d['options']['where']||null:null,'attributes':[['campaign',_0x5f48('0x2d')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')]['literal'](_0x5f48('0x2e')))),_0x5f48('0x2f')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0x5f48('0x30')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x5f48('0x31')],[db[_0x5f48('0x1d')]['fn']('COUNT',db[_0x5f48('0x1d')]['fn']('IF',db['sequelize'][_0x5f48('0x21')](_0x5f48('0x32')))),'outboundBusyCallsDay'],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x5f48('0x21')](_0x5f48('0x33')))),_0x5f48('0x34')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x35')))),_0x5f48('0x36')],[db[_0x5f48('0x1d')]['fn']('COUNT',db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x5f48('0x1d')]['fn']('COUNT',db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')]['literal'](_0x5f48('0x38')))),_0x5f48('0x39')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db['sequelize']['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x3a')))),_0x5f48('0x3b')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x5f48('0x3c')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db['sequelize'][_0x5f48('0x21')](_0x5f48('0x3d')))),'outboundRejectCallsDay'],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db['sequelize']['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x3e')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x3f')))),'outboundRejectCallsDay'],[db[_0x5f48('0x1d')]['fn']('COUNT',db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5f48('0x40')]],'group':[_0x5f48('0x41')]})[_0x5f48('0x17')](function(_0x22302c){logger[_0x5f48('0xb')](_0x5f48('0x2c'),_0x53de1d);logger[_0x5f48('0xe')](_0x5f48('0x2c'),_0x53de1d,JSON[_0x5f48('0x19')](_0x22302c));_0x225d30(_0x22302c);})[_0x5f48('0x12')](function(_0x2015cb){logger[_0x5f48('0x10')]('GetVoiceQueueHopperHistory',_0x2015cb['message'],_0x53de1d);_0x131931(_0x43a9a9[_0x5f48('0x10')](0x1f4,_0x2015cb[_0x5f48('0x11')]));});});};exports[_0x5f48('0x42')]=function(_0x3b2b66){var _0x102641=this;return new Promise(function(_0xce1dea,_0x5d40e9){return db[_0x5f48('0x13')][_0x5f48('0x1b')]({'raw':_0x3b2b66['options']?_0x3b2b66['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b2b66[_0x5f48('0x15')]?_0x3b2b66[_0x5f48('0x15')][_0x5f48('0x1c')]||null:null,'attributes':[['campaign',_0x5f48('0x2d')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')][_0x5f48('0x1f')]('id')),_0x5f48('0x43')],[db[_0x5f48('0x1d')]['fn'](_0x5f48('0x1e'),db[_0x5f48('0x1d')]['fn']('IF',db[_0x5f48('0x1d')][_0x5f48('0x21')](_0x5f48('0x22')))),'ivrAnswerCallsDay']],'group':[_0x5f48('0x41')]})[_0x5f48('0x17')](function(_0x278ed7){logger[_0x5f48('0xb')](_0x5f48('0x42'),_0x3b2b66);logger['debug'](_0x5f48('0x42'),_0x3b2b66,JSON['stringify'](_0x278ed7));_0xce1dea(_0x278ed7);})[_0x5f48('0x12')](function(_0x5888eb){logger['error'](_0x5f48('0x42'),_0x5888eb['message'],_0x3b2b66);_0x5d40e9(_0x102641[_0x5f48('0x10')](0x1f4,_0x5888eb[_0x5f48('0x11')]));});});}; \ No newline at end of file +var _0x3378=['predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','then','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','debug','catch','AvgHandleTime','findAll','sequelize','predictiveIntervalTotalCalls','COUNT','literal'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x3378,0xc2));var _0x8337=function(_0x5517c0,_0x358609){_0x5517c0=_0x5517c0-0x0;var _0x33803b=_0x3378[_0x5517c0];return _0x33803b;};'use strict';var _=require(_0x8337('0x0'));var util=require(_0x8337('0x1'));var moment=require(_0x8337('0x2'));var BPromise=require(_0x8337('0x3'));var rs=require(_0x8337('0x4'));var fs=require('fs');var Redis=require(_0x8337('0x5'));var db=require(_0x8337('0x6'))['db'];var utils=require(_0x8337('0x7'));var logger=require(_0x8337('0x8'))(_0x8337('0x9'));var config=require(_0x8337('0xa'));var jayson=require(_0x8337('0xb'));var client=jayson[_0x8337('0xc')][_0x8337('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x62d897,_0x35bb36,_0x4810ae){return new BPromise(function(_0x49706b,_0x57310f){return client[_0x8337('0xe')](_0x62d897,_0x4810ae)['then'](function(_0xa6a50f){logger['info'](_0x8337('0xf'),_0x35bb36,_0x8337('0x10'));logger['debug'](_0x8337('0x11'),_0x35bb36,_0x8337('0x10'),JSON[_0x8337('0x12')](_0xa6a50f));if(_0xa6a50f[_0x8337('0x13')]){if(_0xa6a50f[_0x8337('0x13')][_0x8337('0x14')]===0x1f4){logger[_0x8337('0x13')](_0x8337('0xf'),_0x35bb36,_0xa6a50f[_0x8337('0x13')][_0x8337('0x15')]);return _0x57310f(_0xa6a50f[_0x8337('0x13')][_0x8337('0x15')]);}logger[_0x8337('0x13')](_0x8337('0xf'),_0x35bb36,_0xa6a50f[_0x8337('0x13')][_0x8337('0x15')]);return _0x49706b(_0xa6a50f['error'][_0x8337('0x15')]);}else{logger[_0x8337('0x16')](_0x8337('0xf'),_0x35bb36,_0x8337('0x10'));_0x49706b(_0xa6a50f[_0x8337('0x17')][_0x8337('0x15')]);}})['catch'](function(_0x42bdf0){logger[_0x8337('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x35bb36,_0x42bdf0);_0x57310f(_0x42bdf0);});});}exports['CreateCmHopperHistory']=function(_0x1e8457){var _0x260104=this;return new Promise(function(_0x174fd7,_0x4e874d){return db[_0x8337('0x18')]['create'](_0x1e8457[_0x8337('0x19')],{'raw':_0x1e8457[_0x8337('0x1a')]?_0x1e8457[_0x8337('0x1a')][_0x8337('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1a9cff){logger[_0x8337('0x16')](_0x8337('0x1c'),_0x1e8457);logger[_0x8337('0x1d')](_0x8337('0x1c'),_0x1e8457,JSON[_0x8337('0x12')](_0x1a9cff));_0x174fd7(_0x1a9cff);})[_0x8337('0x1e')](function(_0x52e49c){logger['error']('CreateCmHopperHistory',_0x52e49c[_0x8337('0x15')],_0x1e8457);_0x4e874d(_0x260104['error'](0x1f4,_0x52e49c[_0x8337('0x15')]));});});};exports[_0x8337('0x1f')]=function(_0x464238){var _0x52312e=this;return new Promise(function(_0x439901,_0x31afde){return db[_0x8337('0x18')][_0x8337('0x20')]({'raw':_0x464238[_0x8337('0x1a')]?_0x464238[_0x8337('0x1a')][_0x8337('0x1b')]===undefined?!![]:![]:!![],'where':_0x464238[_0x8337('0x1a')]?_0x464238[_0x8337('0x1a')]['where']||null:null,'attributes':[[db[_0x8337('0x21')]['fn']('COUNT',db[_0x8337('0x21')]['col']('id')),_0x8337('0x22')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x8337('0x25')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')]['literal'](_0x8337('0x26')))),_0x8337('0x27')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x28')))),_0x8337('0x29')],[db[_0x8337('0x21')]['fn'](_0x8337('0x2a'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x2b')))),_0x8337('0x2c')],[db['sequelize']['fn'](_0x8337('0x2a'),db['sequelize']['fn']('IF',db[_0x8337('0x21')]['literal'](_0x8337('0x2d')))),_0x8337('0x2e')]]})['then'](function(_0x398371){logger[_0x8337('0x16')](_0x8337('0x1f'),_0x464238);logger[_0x8337('0x1d')](_0x8337('0x1f'),_0x464238,JSON[_0x8337('0x12')](_0x398371));_0x439901(_0x398371);})[_0x8337('0x1e')](function(_0x10aede){logger['error'](_0x8337('0x1f'),_0x10aede['message'],_0x464238);_0x31afde(_0x52312e['error'](0x1f4,_0x10aede[_0x8337('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1dbdde){var _0x2f7135=this;return new Promise(function(_0x1fc840,_0x387705){return db['CmHopperHistory']['findAll']({'raw':_0x1dbdde[_0x8337('0x1a')]?_0x1dbdde[_0x8337('0x1a')][_0x8337('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dbdde[_0x8337('0x1a')]?_0x1dbdde[_0x8337('0x1a')]['where']||null:null,'attributes':[[_0x8337('0x2f'),_0x8337('0x30')],[db['sequelize']['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x31')))),_0x8337('0x32')],[db[_0x8337('0x21')]['fn']('COUNT',db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x33')))),_0x8337('0x34')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db['sequelize']['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x8337('0x35')],[db[_0x8337('0x21')]['fn']('COUNT',db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')]['literal'](_0x8337('0x36')))),'outboundBusyCallsDay'],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x37')))),_0x8337('0x38')],[db[_0x8337('0x21')]['fn']('COUNT',db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')]['literal'](_0x8337('0x39')))),'outboundDropCallsDayTimeout'],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x3a')))),_0x8337('0x3b')],[db['sequelize']['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x3c')))),_0x8337('0x3d')],[db[_0x8337('0x21')]['fn']('COUNT',db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x3e')))),_0x8337('0x3f')],[db['sequelize']['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db['sequelize'][_0x8337('0x24')](_0x8337('0x40')))),_0x8337('0x41')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x42')))),_0x8337('0x43')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db['sequelize']['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x44')))),'outboundAnswerAgiCallsDay'],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x45')))),_0x8337('0x43')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')]['literal'](_0x8337('0x46')))),'outboundReCallsDay']],'group':[_0x8337('0x2f')]})[_0x8337('0x47')](function(_0x2ecc9b){logger[_0x8337('0x16')](_0x8337('0x48'),_0x1dbdde);logger[_0x8337('0x1d')](_0x8337('0x48'),_0x1dbdde,JSON['stringify'](_0x2ecc9b));_0x1fc840(_0x2ecc9b);})[_0x8337('0x1e')](function(_0x500292){logger[_0x8337('0x13')](_0x8337('0x48'),_0x500292[_0x8337('0x15')],_0x1dbdde);_0x387705(_0x2f7135[_0x8337('0x13')](0x1f4,_0x500292[_0x8337('0x15')]));});});};exports[_0x8337('0x49')]=function(_0x559c8d){var _0x21ea0c=this;return new Promise(function(_0x31fefd,_0xec441c){return db[_0x8337('0x18')][_0x8337('0x20')]({'raw':_0x559c8d[_0x8337('0x1a')]?_0x559c8d[_0x8337('0x1a')][_0x8337('0x1b')]===undefined?!![]:![]:!![],'where':_0x559c8d[_0x8337('0x1a')]?_0x559c8d['options']['where']||null:null,'attributes':[[_0x8337('0x2f'),_0x8337('0x30')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db['sequelize'][_0x8337('0x4a')]('id')),_0x8337('0x4b')],[db[_0x8337('0x21')]['fn'](_0x8337('0x23'),db[_0x8337('0x21')]['fn']('IF',db[_0x8337('0x21')][_0x8337('0x24')](_0x8337('0x4c')))),'ivrAnswerCallsDay']],'group':[_0x8337('0x2f')]})['then'](function(_0x463933){logger[_0x8337('0x16')](_0x8337('0x49'),_0x559c8d);logger['debug']('GetCampaignHopperHistory',_0x559c8d,JSON[_0x8337('0x12')](_0x463933));_0x31fefd(_0x463933);})[_0x8337('0x1e')](function(_0x3cae0a){logger[_0x8337('0x13')](_0x8337('0x49'),_0x3cae0a[_0x8337('0x15')],_0x559c8d);_0xec441c(_0x21ea0c['error'](0x1f4,_0x3cae0a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 39b8f17..9fef957 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 _0x43ba=['isAuthenticated','index','/:id','post','create','put','exports','util','path','fs-extra','./cmHopperHistory.controller','get'];(function(_0x3713a6,_0x5320a5){var _0x11af49=function(_0x4ac147){while(--_0x4ac147){_0x3713a6['push'](_0x3713a6['shift']());}};_0x11af49(++_0x5320a5);}(_0x43ba,0x14b));var _0xa43b=function(_0x421776,_0x8c2ff2){_0x421776=_0x421776-0x0;var _0x3a4ca3=_0x43ba[_0x421776];return _0x3a4ca3;};'use strict';var multer=require('multer');var util=require(_0xa43b('0x0'));var path=require(_0xa43b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa43b('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa43b('0x3'));router[_0xa43b('0x4')]('/',auth[_0xa43b('0x5')](),controller[_0xa43b('0x6')]);router[_0xa43b('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa43b('0x4')](_0xa43b('0x7'),auth[_0xa43b('0x5')](),controller['show']);router[_0xa43b('0x8')]('/',auth[_0xa43b('0x5')](),controller[_0xa43b('0x9')]);router[_0xa43b('0xa')](_0xa43b('0x7'),auth[_0xa43b('0x5')](),controller['update']);module[_0xa43b('0xb')]=router; \ No newline at end of file +var _0xa083=['describe','/:id','show','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xa083,0x148));var _0x3a08=function(_0x26c79f,_0x58e5b0){_0x26c79f=_0x26c79f-0x0;var _0xb36938=_0xa083[_0x26c79f];return _0xb36938;};'use strict';var multer=require(_0x3a08('0x0'));var util=require(_0x3a08('0x1'));var path=require(_0x3a08('0x2'));var timeout=require(_0x3a08('0x3'));var express=require(_0x3a08('0x4'));var router=express[_0x3a08('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3a08('0x6'));var interaction=require(_0x3a08('0x7'));var config=require(_0x3a08('0x8'));var controller=require(_0x3a08('0x9'));router[_0x3a08('0xa')]('/',auth[_0x3a08('0xb')](),controller[_0x3a08('0xc')]);router['get'](_0x3a08('0xd'),auth[_0x3a08('0xb')](),controller[_0x3a08('0xe')]);router[_0x3a08('0xa')](_0x3a08('0xf'),auth['isAuthenticated'](),controller[_0x3a08('0x10')]);router['post']('/',auth[_0x3a08('0xb')](),controller['create']);router['put'](_0x3a08('0xf'),auth[_0x3a08('0xb')](),controller[_0x3a08('0x11')]);module[_0x3a08('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1a321cc..bebed53 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 _0xe9e8=['name','sequelize','exports','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xe9e8,0x179));var _0x8e9e=function(_0x3356eb,_0x23861f){_0x3356eb=_0x3356eb-0x0;var _0x563bb1=_0xe9e8[_0x3356eb];return _0x563bb1;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'unique':_0x8e9e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8e9e('0x2')]},'dialPrefix':{'type':Sequelize[_0x8e9e('0x2')]}}; \ No newline at end of file +var _0xee39=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xee39,0x1e6));var _0x9ee3=function(_0x42d561,_0x4c16e0){_0x42d561=_0x42d561-0x0;var _0x56ec4a=_0xee39[_0x42d561];return _0x56ec4a;};'use strict';var Sequelize=require(_0x9ee3('0x0'));module[_0x9ee3('0x1')]={'name':{'type':Sequelize[_0x9ee3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9ee3('0x2')]},'dialPrefix':{'type':Sequelize[_0x9ee3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cf05573..47e8ce3 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 _0xdf28=['Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','index','CmList','rawAttributes','key','model','map','name','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','hasOwnProperty','findAll','removeDispositions','ids','CmContact','tags','join','isArray','push','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','message','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x156b14,_0x308ebc){var _0x4b13d9=function(_0x1dff94){while(--_0x1dff94){_0x156b14['push'](_0x156b14['shift']());}};_0x4b13d9(++_0x308ebc);}(_0xdf28,0x124));var _0x8df2=function(_0x133fc0,_0x1edda8){_0x133fc0=_0x133fc0-0x0;var _0x4ce619=_0xdf28[_0x133fc0];return _0x4ce619;};'use strict';var emlformat=require(_0x8df2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8df2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8df2('0x2'));var BPromise=require(_0x8df2('0x3'));var Mustache=require('mustache');var util=require(_0x8df2('0x4'));var path=require('path');var sox=require(_0x8df2('0x5'));var csv=require(_0x8df2('0x6'));var ejs=require(_0x8df2('0x7'));var fs=require('fs');var fs_extra=require(_0x8df2('0x8'));var _=require(_0x8df2('0x9'));var squel=require(_0x8df2('0xa'));var crypto=require('crypto');var jsforce=require(_0x8df2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8df2('0xc'));var Papa=require(_0x8df2('0xd'));var Redis=require('ioredis');var authService=require(_0x8df2('0xe'));var qs=require(_0x8df2('0xf'));var as=require(_0x8df2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8df2('0x11'))(_0x8df2('0x12'));var utils=require('../../config/utils');var config=require(_0x8df2('0x13'));var licenseUtil=require(_0x8df2('0x14'));var db=require(_0x8df2('0x15'))['db'];var csv_results;config[_0x8df2('0x16')]=_[_0x8df2('0x17')](config[_0x8df2('0x16')],{'host':_0x8df2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8df2('0x16')]));require(_0x8df2('0x19'))[_0x8df2('0x1a')](socket);function respondWithStatusCode(_0x2e7116,_0x174acb){_0x174acb=_0x174acb||0xcc;return function(_0x2870c5){if(_0x2870c5){return _0x2e7116[_0x8df2('0x1b')](_0x174acb);}return _0x2e7116[_0x8df2('0x1c')](_0x174acb)[_0x8df2('0x1d')]();};}function respondWithResult(_0x47cfaa,_0x3579a3){_0x3579a3=_0x3579a3||0xc8;return function(_0x316c33){if(_0x316c33){return _0x47cfaa['status'](_0x3579a3)[_0x8df2('0x1e')](_0x316c33);}};}function respondWithFilteredResult(_0x5b2b19,_0x52cf48){return function(_0x2c7c31){if(_0x2c7c31){var _0x339c9e=typeof _0x52cf48['offset']===_0x8df2('0x1f')&&typeof _0x52cf48[_0x8df2('0x20')]==='undefined';var _0x77884d=_0x2c7c31[_0x8df2('0x21')];var _0x11327d=_0x339c9e?0x0:_0x52cf48[_0x8df2('0x22')];var _0x5db648=_0x339c9e?_0x2c7c31['count']:_0x52cf48[_0x8df2('0x22')]+_0x52cf48[_0x8df2('0x20')];var _0x2cf28f;if(_0x5db648>=_0x77884d){_0x5db648=_0x77884d;_0x2cf28f=0xc8;}else{_0x2cf28f=0xce;}_0x5b2b19[_0x8df2('0x1c')](_0x2cf28f);return _0x5b2b19[_0x8df2('0x23')](_0x8df2('0x24'),_0x11327d+'-'+_0x5db648+'/'+_0x77884d)[_0x8df2('0x1e')](_0x2c7c31);}return null;};}function patchUpdates(_0x524bbb){return function(_0x46801f){try{jsonpatch[_0x8df2('0x25')](_0x46801f,_0x524bbb,!![]);}catch(_0xf9bb0a){return BPromise[_0x8df2('0x26')](_0xf9bb0a);}return _0x46801f[_0x8df2('0x27')]();};}function saveUpdates(_0x3f7270,_0x3cdccf){return function(_0x5d18b9){if(_0x5d18b9){return _0x5d18b9[_0x8df2('0x28')](_0x3f7270)['then'](function(_0x4f46be){return _0x4f46be;});}return null;};}function removeEntity(_0x153c0f,_0x4f6cb6){return function(_0x2c0007){if(_0x2c0007){return _0x2c0007[_0x8df2('0x29')]()[_0x8df2('0x2a')](function(){var _0x23aa44=_0x2c0007[_0x8df2('0x2b')]({'plain':!![]});var _0x54e33e=_0x8df2('0x2c');return db[_0x8df2('0x2d')][_0x8df2('0x29')]({'where':{'type':_0x54e33e,'resourceId':_0x23aa44['id']}})[_0x8df2('0x2a')](function(){return _0x2c0007;});})[_0x8df2('0x2a')](function(){_0x153c0f[_0x8df2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e84ac,_0x527218){return function(_0x22858b){if(!_0x22858b){_0x5e84ac[_0x8df2('0x1b')](0x194);}return _0x22858b;};}function handleError(_0x579e11,_0x143f12){_0x143f12=_0x143f12||0x1f4;return function(_0x2dc8d1){logger[_0x8df2('0x2e')](_0x2dc8d1[_0x8df2('0x2f')]);if(_0x2dc8d1['name']){delete _0x2dc8d1['name'];}_0x579e11[_0x8df2('0x1c')](_0x143f12)['send'](_0x2dc8d1);};}exports[_0x8df2('0x30')]=function(_0x16f236,_0x124356){var _0x87f8d3={},_0x20d9d3={},_0x23b39c={'count':0x0,'rows':[]};var _0x3c8acc=_['map'](db[_0x8df2('0x31')][_0x8df2('0x32')],function(_0x388657){return{'name':_0x388657['fieldName'],'type':_0x388657['type'][_0x8df2('0x33')]};});_0x20d9d3[_0x8df2('0x34')]=_[_0x8df2('0x35')](_0x3c8acc,_0x8df2('0x36'));_0x20d9d3[_0x8df2('0x37')]=_[_0x8df2('0x38')](_0x16f236[_0x8df2('0x37')]);_0x20d9d3['filters']=_[_0x8df2('0x39')](_0x20d9d3[_0x8df2('0x34')],_0x20d9d3[_0x8df2('0x37')]);_0x87f8d3[_0x8df2('0x3a')]=_[_0x8df2('0x39')](_0x20d9d3[_0x8df2('0x34')],qs[_0x8df2('0x3b')](_0x16f236[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x87f8d3[_0x8df2('0x3a')]=_0x87f8d3[_0x8df2('0x3a')]['length']?_0x87f8d3[_0x8df2('0x3a')]:_0x20d9d3[_0x8df2('0x34')];if(!_0x16f236[_0x8df2('0x37')]['hasOwnProperty'](_0x8df2('0x3c'))){_0x87f8d3[_0x8df2('0x20')]=qs['limit'](_0x16f236['query'][_0x8df2('0x20')]);_0x87f8d3[_0x8df2('0x22')]=qs[_0x8df2('0x22')](_0x16f236[_0x8df2('0x37')][_0x8df2('0x22')]);}_0x87f8d3[_0x8df2('0x3d')]=qs['sort'](_0x16f236[_0x8df2('0x37')][_0x8df2('0x3e')]);_0x87f8d3[_0x8df2('0x3f')]=qs[_0x8df2('0x40')](_[_0x8df2('0x41')](_0x16f236[_0x8df2('0x37')],_0x20d9d3[_0x8df2('0x40')]),_0x3c8acc);if(_0x16f236[_0x8df2('0x37')][_0x8df2('0x42')]){_0x87f8d3[_0x8df2('0x3f')]=_[_0x8df2('0x43')](_0x87f8d3['where'],{'$or':_[_0x8df2('0x35')](_0x3c8acc,function(_0x50a04a){if(_0x50a04a[_0x8df2('0x44')]!==_0x8df2('0x45')){var _0x54862d={};_0x54862d[_0x50a04a[_0x8df2('0x36')]]={'$like':'%'+_0x16f236[_0x8df2('0x37')][_0x8df2('0x42')]+'%'};return _0x54862d;}})});}_0x87f8d3=_[_0x8df2('0x43')]({},_0x87f8d3,_0x16f236[_0x8df2('0x46')]);var _0x540373={'where':_0x87f8d3['where']};return db[_0x8df2('0x31')][_0x8df2('0x21')](_0x540373)['then'](function(_0x3ecdd4){_0x23b39c[_0x8df2('0x21')]=_0x3ecdd4;if(_0x16f236[_0x8df2('0x37')][_0x8df2('0x47')]){_0x87f8d3[_0x8df2('0x48')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x87f8d3);})['then'](function(_0x3992d9){_0x23b39c[_0x8df2('0x49')]=_0x3992d9;return _0x23b39c;})[_0x8df2('0x2a')](respondWithFilteredResult(_0x124356,_0x87f8d3))[_0x8df2('0x4a')](handleError(_0x124356,null));};exports[_0x8df2('0x4b')]=function(_0x50a1c8,_0x255e3d){var _0x456fcd={'raw':![],'where':{'id':_0x50a1c8['params']['id']}},_0x1a8531={};_0x1a8531[_0x8df2('0x34')]=_[_0x8df2('0x38')](db['CmList'][_0x8df2('0x32')]);_0x1a8531['query']=_[_0x8df2('0x38')](_0x50a1c8[_0x8df2('0x37')]);_0x1a8531[_0x8df2('0x40')]=_['intersection'](_0x1a8531['model'],_0x1a8531['query']);_0x456fcd[_0x8df2('0x3a')]=_[_0x8df2('0x39')](_0x1a8531['model'],qs['fields'](_0x50a1c8[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x456fcd[_0x8df2('0x3a')]=_0x456fcd[_0x8df2('0x3a')][_0x8df2('0x4c')]?_0x456fcd[_0x8df2('0x3a')]:_0x1a8531[_0x8df2('0x34')];if(_0x50a1c8[_0x8df2('0x37')][_0x8df2('0x47')]){_0x456fcd[_0x8df2('0x48')]=[{'all':!![]}];}_0x456fcd=_[_0x8df2('0x43')]({},_0x456fcd,_0x50a1c8[_0x8df2('0x46')]);return db[_0x8df2('0x31')]['find'](_0x456fcd)[_0x8df2('0x2a')](handleEntityNotFound(_0x255e3d,null))['then'](respondWithResult(_0x255e3d,null))['catch'](handleError(_0x255e3d,null));};exports[_0x8df2('0x4d')]=function(_0x2f28f5,_0x526a59){return db[_0x8df2('0x31')][_0x8df2('0x4d')](_0x2f28f5[_0x8df2('0x4e')],{})['then'](function(_0x409cea){var _0x36b356=_0x2f28f5['user'][_0x8df2('0x2b')]({'plain':!![]});if(!_0x36b356)throw new Error(_0x8df2('0x4f'));if(_0x36b356[_0x8df2('0x50')]===_0x8df2('0x51')){var _0x1352d8=_0x409cea['get']({'plain':!![]});var _0x230e9f=_0x8df2('0x2c');return db[_0x8df2('0x52')]['find']({'where':{'name':_0x230e9f,'userProfileId':_0x36b356['userProfileId']},'raw':!![]})[_0x8df2('0x2a')](function(_0xe15bc){if(_0xe15bc&&_0xe15bc[_0x8df2('0x53')]===0x0){return db['UserProfileResource'][_0x8df2('0x4d')]({'name':_0x1352d8[_0x8df2('0x36')],'resourceId':_0x1352d8['id'],'type':_0xe15bc[_0x8df2('0x36')],'sectionId':_0xe15bc['id']},{})[_0x8df2('0x2a')](function(){return _0x409cea;});}else{return _0x409cea;}})[_0x8df2('0x4a')](function(_0x228edf){logger[_0x8df2('0x2e')](_0x8df2('0x54'),_0x228edf);throw _0x228edf;});}return _0x409cea;})[_0x8df2('0x2a')](respondWithResult(_0x526a59,0xc9))[_0x8df2('0x4a')](handleError(_0x526a59,null));};exports['update']=function(_0x32cd6b,_0x1a0b49){if(_0x32cd6b['body']['id']){delete _0x32cd6b[_0x8df2('0x4e')]['id'];}return db['CmList'][_0x8df2('0x55')]({'where':{'id':_0x32cd6b[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x1a0b49,null))[_0x8df2('0x2a')](saveUpdates(_0x32cd6b[_0x8df2('0x4e')],null))[_0x8df2('0x2a')](respondWithResult(_0x1a0b49,null))[_0x8df2('0x4a')](handleError(_0x1a0b49,null));};exports[_0x8df2('0x29')]=function(_0x2c474c,_0x4f081f){return db[_0x8df2('0x31')][_0x8df2('0x55')]({'where':{'id':_0x2c474c[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x4f081f,null))[_0x8df2('0x2a')](removeEntity(_0x4f081f,null))[_0x8df2('0x4a')](handleError(_0x4f081f,null));};exports[_0x8df2('0x57')]=function(_0x3e50c8,_0x18fdc6){return db[_0x8df2('0x31')][_0x8df2('0x57')]()[_0x8df2('0x2a')](respondWithResult(_0x18fdc6,null))[_0x8df2('0x4a')](handleError(_0x18fdc6,null));};exports[_0x8df2('0x58')]=function(_0x588677,_0x1ebd73,_0x1bdc9f){if(_0x588677[_0x8df2('0x4e')]['id']){delete _0x588677[_0x8df2('0x4e')]['id'];}return db[_0x8df2('0x31')]['find']({'where':{'id':_0x588677[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x1ebd73,null))[_0x8df2('0x2a')](function(_0x45ebc9){if(_0x45ebc9){_0x588677[_0x8df2('0x4e')][_0x8df2('0x59')]=_0x45ebc9['id'];return db['Disposition'][_0x8df2('0x4d')](_0x588677[_0x8df2('0x4e')]);}})[_0x8df2('0x2a')](respondWithResult(_0x1ebd73,null))[_0x8df2('0x4a')](handleError(_0x1ebd73,null));};exports[_0x8df2('0x5a')]=function(_0x598ca1,_0x3f6f54,_0x219a54){var _0x5930c9={'raw':![],'where':{}};var _0x49117c={};var _0x5366b0={'count':0x0,'rows':[]};return db[_0x8df2('0x31')][_0x8df2('0x5b')]({'where':{'id':_0x598ca1[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x3f6f54,null))['then'](function(_0x9093c7){if(_0x9093c7){_0x49117c['model']=_['keys'](db[_0x8df2('0x5c')][_0x8df2('0x32')]);_0x49117c[_0x8df2('0x37')]=_[_0x8df2('0x38')](_0x598ca1[_0x8df2('0x37')]);_0x49117c[_0x8df2('0x40')]=_['intersection'](_0x49117c[_0x8df2('0x34')],_0x49117c['query']);_0x5930c9[_0x8df2('0x3a')]=_[_0x8df2('0x39')](_0x49117c['model'],qs[_0x8df2('0x3b')](_0x598ca1[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x5930c9[_0x8df2('0x3a')]=_0x5930c9[_0x8df2('0x3a')]['length']?_0x5930c9['attributes']:_0x49117c[_0x8df2('0x34')];if(!_0x598ca1[_0x8df2('0x37')][_0x8df2('0x5d')](_0x8df2('0x3c'))){_0x5930c9[_0x8df2('0x20')]=qs[_0x8df2('0x20')](_0x598ca1[_0x8df2('0x37')][_0x8df2('0x20')]);_0x5930c9['offset']=qs['offset'](_0x598ca1['query']['offset']);}_0x5930c9[_0x8df2('0x3d')]=qs[_0x8df2('0x3e')](_0x598ca1['query'][_0x8df2('0x3e')]);_0x5930c9[_0x8df2('0x3f')]=qs['filters'](_['pick'](_0x598ca1[_0x8df2('0x37')],_0x49117c[_0x8df2('0x40')]));_0x5930c9[_0x8df2('0x3f')]['ListId']=_0x9093c7['id'];if(_0x598ca1['query'][_0x8df2('0x42')]){_0x5930c9[_0x8df2('0x3f')]=_[_0x8df2('0x43')](_0x5930c9[_0x8df2('0x3f')],{'$or':_[_0x8df2('0x35')](_0x5930c9['attributes'],function(_0x1caae9){var _0x645fb4={};_0x645fb4[_0x1caae9]={'$like':'%'+_0x598ca1[_0x8df2('0x37')][_0x8df2('0x42')]+'%'};return _0x645fb4;})});}_0x5930c9=_[_0x8df2('0x43')]({},_0x5930c9,_0x598ca1[_0x8df2('0x46')]);return db[_0x8df2('0x5c')][_0x8df2('0x21')]({'where':_0x5930c9['where']})['then'](function(_0x2c3089){_0x5366b0[_0x8df2('0x21')]=_0x2c3089;if(_0x598ca1[_0x8df2('0x37')][_0x8df2('0x47')]){_0x5930c9[_0x8df2('0x48')]=[{'all':!![]}];}return db[_0x8df2('0x5c')][_0x8df2('0x5e')](_0x5930c9);})[_0x8df2('0x2a')](function(_0x51a7b5){_0x5366b0[_0x8df2('0x49')]=_0x51a7b5;return _0x5366b0;});}})[_0x8df2('0x2a')](respondWithFilteredResult(_0x3f6f54,_0x5930c9))['catch'](handleError(_0x3f6f54,null));};exports[_0x8df2('0x5f')]=function(_0x24ffb3,_0x383fdc,_0x4517ec){return db[_0x8df2('0x31')][_0x8df2('0x55')]({'where':{'id':_0x24ffb3['params']['id']}})['then'](handleEntityNotFound(_0x383fdc,null))[_0x8df2('0x2a')](function(_0x376bfc){if(_0x376bfc){return _0x376bfc[_0x8df2('0x5f')](_0x24ffb3[_0x8df2('0x37')][_0x8df2('0x60')]);}})['then'](respondWithStatusCode(_0x383fdc,null))[_0x8df2('0x4a')](handleError(_0x383fdc,null));};exports['addContacts']=function(_0x225a7e,_0x43b5a1,_0x4e1f73){return db[_0x8df2('0x31')][_0x8df2('0x55')]({'where':{'id':_0x225a7e[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x43b5a1,null))[_0x8df2('0x2a')](function(_0x5944f9){if(_0x5944f9){var _0x135f3c=[];var _0x2636ae={'success':[],'errors':[]};return db[_0x8df2('0x61')][_0x8df2('0x57')]()[_0x8df2('0x2a')](function(_0x57e940){if(_0x225a7e[_0x8df2('0x4e')][_0x8df2('0x62')]&&_['isArray'](_0x225a7e[_0x8df2('0x4e')][_0x8df2('0x62')])){if(_0x225a7e[_0x8df2('0x4e')][_0x8df2('0x62')]['length']){_0x225a7e['body'][_0x8df2('0x62')]=_0x225a7e[_0x8df2('0x4e')][_0x8df2('0x62')][_0x8df2('0x63')](';')+';';}else{_0x225a7e['body'][_0x8df2('0x62')]=null;}}else{_0x225a7e[_0x8df2('0x4e')][_0x8df2('0x62')]=null;}if(_0x225a7e[_0x8df2('0x4e')]&&_[_0x8df2('0x64')](_0x225a7e['body'])){for(var _0x58dbd6=0x0;_0x58dbd6<_0x225a7e['body'][_0x8df2('0x4c')];_0x58dbd6+=0x1){_0x225a7e['body'][_0x58dbd6][_0x8df2('0x59')]=_0x225a7e[_0x8df2('0x56')]['id'];_0x135f3c[_0x8df2('0x65')](_0x225a7e['body'][_0x58dbd6]);}return BPromise['each'](_0x135f3c,function(_0xf4e385){return db['CmContact'][_0x8df2('0x4d')](_[_0x8df2('0x66')](_0xf4e385,[_0x8df2('0x60'),'id'])||{},{'fields':_[_0x8df2('0x38')](_0x57e940),'raw':!![]})[_0x8df2('0x2a')](function(_0x216e7b){_0x2636ae[_0x8df2('0x67')][_0x8df2('0x65')](_0x216e7b[_0x8df2('0x68')]);})[_0x8df2('0x4a')](function(_0x421a26){_0x2636ae[_0x8df2('0x69')][_0x8df2('0x65')]({'data':_0xf4e385,'error':_0x421a26['message']});});})['then'](function(_0x38253d){return _0x2636ae;})['catch'](function(_0x3573cb){return _0x3573cb;});}else{_0x43b5a1[_0x8df2('0x1c')](0x190)[_0x8df2('0x1e')]({'message':_0x8df2('0x6a')});}});}})['then'](respondWithResult(_0x43b5a1,null))[_0x8df2('0x4a')](handleError(_0x43b5a1,null));};exports[_0x8df2('0x6b')]=function(_0x3ff48e,_0x2a7a3b,_0x11d1f5){var _0x1519f6;return db[_0x8df2('0x31')][_0x8df2('0x55')]({'where':{'id':_0x3ff48e[_0x8df2('0x56')]['id']},'include':[{'model':db[_0x8df2('0x6c')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x2a7a3b,null))['then'](function(_0x36fb92){if(_0x36fb92){_0x1519f6=_0x36fb92;return db[_0x8df2('0x61')]['rawAttributes'];}})[_0x8df2('0x2a')](function(_0x1a71cb){if(_0x1a71cb){var _0x554c91={};var _0x3df56a={};_0x3df56a[_0x8df2('0x34')]=_['concat'](_[_0x8df2('0x38')](_0x1a71cb),_[_0x8df2('0x35')](_0x1519f6[_0x8df2('0x6d')],function(_0x5b2da6){return util[_0x8df2('0x6e')](_0x8df2('0x6f'),_0x5b2da6['id']);}));_0x3df56a[_0x8df2('0x37')]=_['keys'](_0x3ff48e['query']);_0x3df56a[_0x8df2('0x40')]=_[_0x8df2('0x39')](_0x3df56a[_0x8df2('0x34')],_0x3df56a['query']);_0x554c91[_0x8df2('0x3a')]=_[_0x8df2('0x39')](_0x3df56a[_0x8df2('0x34')],qs[_0x8df2('0x3b')](_0x3ff48e[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x554c91['attributes']=_0x554c91[_0x8df2('0x3a')][_0x8df2('0x4c')]?_0x554c91[_0x8df2('0x3a')]:_0x3df56a[_0x8df2('0x34')];if(!_0x3ff48e[_0x8df2('0x37')][_0x8df2('0x5d')](_0x8df2('0x3c'))){_0x554c91['limit']=qs[_0x8df2('0x20')](_0x3ff48e[_0x8df2('0x37')][_0x8df2('0x20')]);_0x554c91[_0x8df2('0x22')]=qs[_0x8df2('0x22')](_0x3ff48e['query'][_0x8df2('0x22')]);}_0x554c91[_0x8df2('0x3d')]=qs[_0x8df2('0x3e')](_0x3ff48e[_0x8df2('0x37')][_0x8df2('0x3e')]);_0x554c91[_0x8df2('0x3f')]=qs[_0x8df2('0x40')](_[_0x8df2('0x41')](_0x3ff48e[_0x8df2('0x37')],_0x3df56a[_0x8df2('0x40')]));_0x554c91[_0x8df2('0x70')]=!![];if(_0x3ff48e['query'][_0x8df2('0x42')]){_0x554c91['where']=_[_0x8df2('0x43')](_0x554c91[_0x8df2('0x3f')],{'$or':_[_0x8df2('0x35')](_0x554c91[_0x8df2('0x3a')],function(_0x32454e){var _0x7abf11={};_0x7abf11[_0x32454e]={'$like':'%'+_0x3ff48e['query'][_0x8df2('0x42')]+'%'};return _0x7abf11;})});}_0x554c91=_[_0x8df2('0x43')]({},_0x554c91,_0x3ff48e[_0x8df2('0x46')]);return _0x1519f6[_0x8df2('0x6b')](_0x554c91);}})[_0x8df2('0x2a')](respondWithResult(_0x2a7a3b,null))['catch'](handleError(_0x2a7a3b,null));};exports[_0x8df2('0x71')]=function(_0x4ef6fb,_0x5e4280,_0x3e329b){var _0x20c924;var _0xb86aef;var _0x37b844;var _0x3c90c6=_0x4ef6fb[_0x8df2('0x56')]['id'];csv_results=[];return db[_0x8df2('0x72')][_0x8df2('0x5e')]({'attributes':['id',_0x8df2('0x36')],'raw':!![],'order':[_0x8df2('0x73')]})[_0x8df2('0x2a')](function(_0x340529){_0x20c924=_0x340529;var _0xc7dfa4=_['keys'](db[_0x8df2('0x61')][_0x8df2('0x32')]);return db[_0x8df2('0x6c')][_0x8df2('0x5e')]({'raw':!![],'attributes':['id',_0x8df2('0x74')]})[_0x8df2('0x2a')](function(_0x4b363f){_0xb86aef=_0x4b363f;var _0x2b61a6=squel[_0x8df2('0x75')]()[_0x8df2('0x3b')](_0xc7dfa4)[_0x8df2('0x76')](_0x8df2('0x77'),'c')[_0x8df2('0x3f')]('c.ListId\x20=\x20?',_0x3c90c6)[_0x8df2('0x3f')](_0x8df2('0x78'))[_0x8df2('0x79')]();for(var _0x3bb470=0x0;_0x3bb470<_0xb86aef[_0x8df2('0x4c')];_0x3bb470++){_0x2b61a6['field'](_0x8df2('0x7a')+_0xb86aef[_0x3bb470]['id'],_0x8df2('0x7b')+_0xb86aef[_0x3bb470][_0x8df2('0x74')]);}for(var _0x3bb470=0x0;_0x3bb470<_0x20c924[_0x8df2('0x4c')];_0x3bb470++){_0x2b61a6['field'](squel[_0x8df2('0x75')]()[_0x8df2('0x7c')](_0x8df2('0x7d'))[_0x8df2('0x76')](_0x8df2('0x7e'))[_0x8df2('0x3f')](_0x8df2('0x7f'),_0x20c924[_0x3bb470]['id'])[_0x8df2('0x3f')](_0x8df2('0x80')),'additionalPhone_'+_0x20c924[_0x3bb470][_0x8df2('0x36')]);_0x2b61a6[_0x8df2('0x7c')](squel[_0x8df2('0x75')]()[_0x8df2('0x7c')](_0x8df2('0x81'))['from'](_0x8df2('0x7e'))['where'](_0x8df2('0x7f'),_0x20c924[_0x3bb470]['id'])[_0x8df2('0x3f')](_0x8df2('0x80')),_0x8df2('0x82')+_0x20c924[_0x3bb470][_0x8df2('0x36')]);}var _0x116bbd=[];_0x116bbd[_0x8df2('0x65')](_0x2b61a6['toString']());BPromise['each'](_0x116bbd,handleQuery)[_0x8df2('0x2a')](function(_0x29b076){handleQuery(_0x2b61a6[_0x8df2('0x83')]());var _0x51fc86=csv_results[0x0];if(!_[_0x8df2('0x84')](_0x51fc86)){var _0x39bebc=toCsv(_0x51fc86);var _0x365d18=Date['now']();fs[_0x8df2('0x85')](util['format'](_0x8df2('0x86'),_0x3c90c6,_0x365d18),_0x39bebc);_0x5e4280[_0x8df2('0x87')](_0x8df2('0x88'),'attachment;\x20filename='+util[_0x8df2('0x6e')]('list_%d_%s.csv',_0x3c90c6,_0x365d18));_0x5e4280['setHeader'](_0x8df2('0x89'),_0x8df2('0x8a'));return _0x5e4280['download'](util[_0x8df2('0x6e')]('/tmp/list_%d_%s.csv',_0x3c90c6,_0x365d18));}else{return _0x5e4280[_0x8df2('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x500a42,_0x414d2a,_0x279feb){var _0x3915a8;delete _0x500a42[_0x8df2('0x4e')]['id'];return db[_0x8df2('0x31')][_0x8df2('0x5b')]({'where':{'id':_0x500a42[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x414d2a,null))['then'](function(_0x262d6f){if(_0x262d6f){return db[_0x8df2('0x8b')][_0x8df2('0x8c')](function(_0x49e751){return db['CmCustomField'][_0x8df2('0x4d')](_0x500a42[_0x8df2('0x4e')],{'transaction':_0x49e751})[_0x8df2('0x2a')](function(_0x1cf2ca){_0x3915a8=_0x1cf2ca;return _0x262d6f[_0x8df2('0x8d')](_0x1cf2ca,{'transaction':_0x49e751});})[_0x8df2('0x2a')](function(){var _0x2a973d={'type':db[_0x8df2('0x8e')]['TEXT'],'transaction':_0x49e751};switch(_0x500a42[_0x8df2('0x4e')][_0x8df2('0x44')]){case _0x8df2('0x8f'):_0x2a973d[_0x8df2('0x44')]=db[_0x8df2('0x8e')][_0x8df2('0x90')];break;case _0x8df2('0x91'):_0x2a973d[_0x8df2('0x44')]=db[_0x8df2('0x8e')][_0x8df2('0x92')];break;case _0x8df2('0x93'):_0x2a973d[_0x8df2('0x44')]=db['Sequelize'][_0x8df2('0x94')];_0x2a973d[_0x8df2('0x95')]=![];break;default:}return db[_0x8df2('0x8b')][_0x8df2('0x96')][_0x8df2('0x97')](_0x8df2('0x77'),util['format'](_0x8df2('0x98'),_0x3915a8['id']),_0x2a973d);})[_0x8df2('0x2a')](function(){return _0x3915a8;});});}})[_0x8df2('0x2a')](respondWithResult(_0x414d2a,null))[_0x8df2('0x4a')](handleError(_0x414d2a,null));};exports[_0x8df2('0x99')]=function(_0x5510a0,_0x42d542,_0x1dc05f){var _0x174f10={};var _0x456918={};var _0x2e5645;var _0x5dda15;return db['CmList']['findOne']({'where':{'id':_0x5510a0[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x42d542,null))['then'](function(_0x3aff86){if(_0x3aff86){_0x2e5645=_0x3aff86;_0x456918[_0x8df2('0x34')]=_[_0x8df2('0x38')](db[_0x8df2('0x6c')][_0x8df2('0x32')]);_0x456918[_0x8df2('0x37')]=_['keys'](_0x5510a0[_0x8df2('0x37')]);_0x456918['filters']=_[_0x8df2('0x39')](_0x456918[_0x8df2('0x34')],_0x456918['query']);_0x174f10[_0x8df2('0x3a')]=_[_0x8df2('0x39')](_0x456918[_0x8df2('0x34')],qs['fields'](_0x5510a0[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x174f10[_0x8df2('0x3a')]=_0x174f10[_0x8df2('0x3a')][_0x8df2('0x4c')]?_0x174f10[_0x8df2('0x3a')]:_0x456918['model'];_0x174f10[_0x8df2('0x3d')]=qs[_0x8df2('0x3e')](_0x5510a0[_0x8df2('0x37')][_0x8df2('0x3e')]);_0x174f10['where']=qs[_0x8df2('0x40')](_['pick'](_0x5510a0[_0x8df2('0x37')],_0x456918[_0x8df2('0x40')]));_0x174f10['where']=_[_0x8df2('0x43')](_0x174f10[_0x8df2('0x3f')],{'$or':[{'ListId':_0x3aff86['id']},{'ListId':null}]});if(_0x5510a0[_0x8df2('0x37')][_0x8df2('0x42')]){_0x174f10[_0x8df2('0x3f')]=_['merge'](_0x174f10[_0x8df2('0x3f')],{'$or':_[_0x8df2('0x35')](_0x174f10['attributes'],function(_0x38b680){var _0x18cef3={};_0x18cef3[_0x38b680]={'$like':'%'+_0x5510a0[_0x8df2('0x37')]['filter']+'%'};return _0x18cef3;})});}_0x174f10=_[_0x8df2('0x43')]({},_0x174f10,_0x5510a0[_0x8df2('0x46')]);return db[_0x8df2('0x6c')][_0x8df2('0x9a')](_0x174f10);}})['then'](respondWithResult(_0x42d542,null))[_0x8df2('0x4a')](handleError(_0x42d542,null));};exports['getGlobalCustomFields']=function(_0x42a4a4,_0x444a20){return db[_0x8df2('0x6c')][_0x8df2('0x9a')]({'where':{'ListId':null}})[_0x8df2('0x2a')](handleEntityNotFound(_0x444a20,null))[_0x8df2('0x2a')](function(_0x41f34f){return _0x41f34f;})[_0x8df2('0x2a')](respondWithResult(_0x444a20,null))[_0x8df2('0x4a')](handleError(_0x444a20,null));};exports[_0x8df2('0x9b')]=function(_0x40ddbc,_0x4d4a18,_0xd79a7c){return db['CmList']['find']({'where':{'id':_0x40ddbc[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x4d4a18,null))[_0x8df2('0x2a')](function(_0x30ad1b){if(_0x30ad1b){return _0x30ad1b[_0x8df2('0x9b')](_0x40ddbc['body'][_0x8df2('0x60')],_[_0x8df2('0x66')](_0x40ddbc[_0x8df2('0x4e')],[_0x8df2('0x60'),'id'])||{})[_0x8df2('0x9c')](function(_0x1fc0bc){for(var _0x2c9e62=0x0;_0x2c9e62<_0x40ddbc[_0x8df2('0x4e')][_0x8df2('0x60')]['length'];_0x2c9e62+=0x1){socket['emit'](_0x8df2('0x9d'),{'UserId':Number(_0x40ddbc[_0x8df2('0x4e')][_0x8df2('0x60')][_0x2c9e62]),'CmListId':Number(_0x40ddbc[_0x8df2('0x56')]['id'])});}return _0x1fc0bc;});}})[_0x8df2('0x2a')](respondWithResult(_0x4d4a18,null))[_0x8df2('0x4a')](handleError(_0x4d4a18,null));};exports[_0x8df2('0x9e')]=function(_0x4d1655,_0x1b53ae,_0x4b1ecc){return db[_0x8df2('0x31')][_0x8df2('0x55')]({'where':{'id':_0x4d1655[_0x8df2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b53ae,null))[_0x8df2('0x2a')](function(_0x2d8f52){if(_0x2d8f52){return _0x2d8f52['removeAgents'](_0x4d1655['query'][_0x8df2('0x60')])[_0x8df2('0x2a')](function(){if(_['isArray'](_0x4d1655['query']['ids'])){for(var _0x3aee38=0x0;_0x3aee38<_0x4d1655['query'][_0x8df2('0x60')][_0x8df2('0x4c')];_0x3aee38+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x4d1655[_0x8df2('0x37')][_0x8df2('0x60')][_0x3aee38]),'CmListId':Number(_0x4d1655['params']['id'])});}}else{socket[_0x8df2('0x9f')](_0x8df2('0xa0'),{'UserId':Number(_0x4d1655[_0x8df2('0x37')][_0x8df2('0x60')]),'CmListId':Number(_0x4d1655[_0x8df2('0x56')]['id'])});}});}})[_0x8df2('0x2a')](respondWithStatusCode(_0x1b53ae,null))[_0x8df2('0x4a')](handleError(_0x1b53ae,null));};exports[_0x8df2('0xa1')]=function(_0x37fb26,_0x132220,_0xb0262){var _0x7fdde3={};var _0xaf13a6={};var _0x568f69;var _0x4ad88c;return db[_0x8df2('0x31')][_0x8df2('0x5b')]({'where':{'id':_0x37fb26[_0x8df2('0x56')]['id']}})[_0x8df2('0x2a')](handleEntityNotFound(_0x132220,null))['then'](function(_0x4101fe){if(_0x4101fe){_0x568f69=_0x4101fe;_0xaf13a6[_0x8df2('0x34')]=_[_0x8df2('0x38')](db[_0x8df2('0xa2')][_0x8df2('0x32')]);_0xaf13a6[_0x8df2('0x37')]=_['keys'](_0x37fb26[_0x8df2('0x37')]);_0xaf13a6[_0x8df2('0x40')]=_[_0x8df2('0x39')](_0xaf13a6[_0x8df2('0x34')],_0xaf13a6['query']);_0x7fdde3[_0x8df2('0x3a')]=_['intersection'](_0xaf13a6['model'],qs[_0x8df2('0x3b')](_0x37fb26[_0x8df2('0x37')][_0x8df2('0x3b')]));_0x7fdde3['attributes']=_0x7fdde3['attributes'][_0x8df2('0x4c')]?_0x7fdde3[_0x8df2('0x3a')]:_0xaf13a6['model'];_0x7fdde3[_0x8df2('0x3d')]=qs['sort'](_0x37fb26[_0x8df2('0x37')][_0x8df2('0x3e')]);_0x7fdde3[_0x8df2('0x3f')]=qs[_0x8df2('0x40')](_[_0x8df2('0x41')](_0x37fb26['query'],_0xaf13a6[_0x8df2('0x40')]));if(_0x37fb26[_0x8df2('0x37')][_0x8df2('0x42')]){_0x7fdde3[_0x8df2('0x3f')]=_[_0x8df2('0x43')](_0x7fdde3[_0x8df2('0x3f')],{'$or':_['map'](_0x7fdde3['attributes'],function(_0x7e502a){var _0x1a78e4={};_0x1a78e4[_0x7e502a]={'$like':'%'+_0x37fb26[_0x8df2('0x37')][_0x8df2('0x42')]+'%'};return _0x1a78e4;})});}_0x7fdde3=_[_0x8df2('0x43')]({},_0x7fdde3,_0x37fb26['options']);return _0x568f69['getAgents'](_0x7fdde3);}})[_0x8df2('0x2a')](function(_0x583b80){if(_0x583b80){_0x4ad88c=_0x583b80['length'];if(!_0x37fb26[_0x8df2('0x37')][_0x8df2('0x5d')](_0x8df2('0x3c'))){_0x7fdde3[_0x8df2('0x20')]=qs[_0x8df2('0x20')](_0x37fb26['query'][_0x8df2('0x20')]);_0x7fdde3[_0x8df2('0x22')]=qs[_0x8df2('0x22')](_0x37fb26[_0x8df2('0x37')][_0x8df2('0x22')]);}return _0x568f69[_0x8df2('0xa1')](_0x7fdde3);}})[_0x8df2('0x2a')](function(_0x45496a){if(_0x45496a){return _0x45496a?{'count':_0x4ad88c,'rows':_0x45496a}:null;}})[_0x8df2('0x2a')](respondWithResult(_0x132220,null))['catch'](handleError(_0x132220,null));};function handleQuery(_0x50e8a5){logger['info'](_0x50e8a5);return db[_0x8df2('0x8b')]['query'](_0x50e8a5)[_0x8df2('0x9c')](function(_0x222405){csv_results[_0x8df2('0x65')](_0x222405);})[_0x8df2('0x4a')](function(_0x42f77a){logger[_0x8df2('0x2e')](_0x42f77a[_0x8df2('0xa3')]);});} \ No newline at end of file +var _0x35d8=['update','destroy','then','UserProfileResource','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','rows','show','params','includeAll','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Lists','find','userProfileId','autoAssociation','error','describe','ListId','findOne','Disposition','hasOwnProperty','include','findAll','removeDispositions','ids','addContacts','tags','isArray','join','CmContact','omit','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','order','pick','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','cm_contact_has_items','description_additionalPhone_','toString','each','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','save'];(function(_0x4af362,_0xe32fba){var _0x3009e1=function(_0x12c441){while(--_0x12c441){_0x4af362['push'](_0x4af362['shift']());}};_0x3009e1(++_0xe32fba);}(_0x35d8,0x118));var _0x835d=function(_0x4165d2,_0x20a517){_0x4165d2=_0x4165d2-0x0;var _0x36eafa=_0x35d8[_0x4165d2];return _0x36eafa;};'use strict';var emlformat=require(_0x835d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x835d('0x1'));var jsonpatch=require(_0x835d('0x2'));var rp=require(_0x835d('0x3'));var moment=require(_0x835d('0x4'));var BPromise=require(_0x835d('0x5'));var Mustache=require(_0x835d('0x6'));var util=require(_0x835d('0x7'));var path=require(_0x835d('0x8'));var sox=require('sox');var csv=require(_0x835d('0x9'));var ejs=require(_0x835d('0xa'));var fs=require('fs');var fs_extra=require(_0x835d('0xb'));var _=require(_0x835d('0xc'));var squel=require(_0x835d('0xd'));var crypto=require(_0x835d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x835d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x835d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x835d('0x11'));var qs=require(_0x835d('0x12'));var as=require(_0x835d('0x13'));var hardwareService=require(_0x835d('0x14'));var logger=require(_0x835d('0x15'))(_0x835d('0x16'));var utils=require(_0x835d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x835d('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x835d('0x19')]=_[_0x835d('0x1a')](config[_0x835d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x835d('0x1b'))(new Redis(config[_0x835d('0x19')]));require(_0x835d('0x1c'))['register'](socket);function respondWithStatusCode(_0xab7e9e,_0x3276f7){_0x3276f7=_0x3276f7||0xcc;return function(_0x14b652){if(_0x14b652){return _0xab7e9e[_0x835d('0x1d')](_0x3276f7);}return _0xab7e9e['status'](_0x3276f7)[_0x835d('0x1e')]();};}function respondWithResult(_0x22ede5,_0x457653){_0x457653=_0x457653||0xc8;return function(_0x4ccee7){if(_0x4ccee7){return _0x22ede5['status'](_0x457653)[_0x835d('0x1f')](_0x4ccee7);}};}function respondWithFilteredResult(_0x182985,_0x71fce8){return function(_0x30704f){if(_0x30704f){var _0x45b4da=typeof _0x71fce8['offset']===_0x835d('0x20')&&typeof _0x71fce8['limit']==='undefined';var _0x228455=_0x30704f[_0x835d('0x21')];var _0x3ad872=_0x45b4da?0x0:_0x71fce8[_0x835d('0x22')];var _0x5930f3=_0x45b4da?_0x30704f[_0x835d('0x21')]:_0x71fce8['offset']+_0x71fce8[_0x835d('0x23')];var _0x55255f;if(_0x5930f3>=_0x228455){_0x5930f3=_0x228455;_0x55255f=0xc8;}else{_0x55255f=0xce;}_0x182985[_0x835d('0x24')](_0x55255f);return _0x182985[_0x835d('0x25')]('Content-Range',_0x3ad872+'-'+_0x5930f3+'/'+_0x228455)[_0x835d('0x1f')](_0x30704f);}return null;};}function patchUpdates(_0x58b160){return function(_0x245810){try{jsonpatch[_0x835d('0x26')](_0x245810,_0x58b160,!![]);}catch(_0x48c4bc){return BPromise['reject'](_0x48c4bc);}return _0x245810[_0x835d('0x27')]();};}function saveUpdates(_0x8fc84f,_0x22df70){return function(_0x3fdc34){if(_0x3fdc34){return _0x3fdc34[_0x835d('0x28')](_0x8fc84f)['then'](function(_0x103aae){return _0x103aae;});}return null;};}function removeEntity(_0xfe8438,_0x49aea3){return function(_0x366d84){if(_0x366d84){return _0x366d84[_0x835d('0x29')]()[_0x835d('0x2a')](function(){var _0x25e669=_0x366d84['get']({'plain':!![]});var _0x47f2f0='Lists';return db[_0x835d('0x2b')]['destroy']({'where':{'type':_0x47f2f0,'resourceId':_0x25e669['id']}})['then'](function(){return _0x366d84;});})[_0x835d('0x2a')](function(){_0xfe8438['status'](0xcc)[_0x835d('0x1e')]();});}};}function handleEntityNotFound(_0x48f130,_0x428926){return function(_0x48275f){if(!_0x48275f){_0x48f130[_0x835d('0x1d')](0x194);}return _0x48275f;};}function handleError(_0x241fc6,_0x40cfa9){_0x40cfa9=_0x40cfa9||0x1f4;return function(_0x1e5b82){logger['error'](_0x1e5b82['stack']);if(_0x1e5b82[_0x835d('0x2c')]){delete _0x1e5b82[_0x835d('0x2c')];}_0x241fc6[_0x835d('0x24')](_0x40cfa9)[_0x835d('0x2d')](_0x1e5b82);};}exports[_0x835d('0x2e')]=function(_0x4a4a65,_0x50e557){var _0x4db4c5={},_0xa1decf={},_0x2bd9de={'count':0x0,'rows':[]};var _0x44b8c1=_[_0x835d('0x2f')](db[_0x835d('0x30')][_0x835d('0x31')],function(_0x2db8ad){return{'name':_0x2db8ad['fieldName'],'type':_0x2db8ad[_0x835d('0x32')][_0x835d('0x33')]};});_0xa1decf[_0x835d('0x34')]=_[_0x835d('0x2f')](_0x44b8c1,_0x835d('0x2c'));_0xa1decf[_0x835d('0x35')]=_[_0x835d('0x36')](_0x4a4a65[_0x835d('0x35')]);_0xa1decf[_0x835d('0x37')]=_[_0x835d('0x38')](_0xa1decf[_0x835d('0x34')],_0xa1decf[_0x835d('0x35')]);_0x4db4c5[_0x835d('0x39')]=_[_0x835d('0x38')](_0xa1decf[_0x835d('0x34')],qs[_0x835d('0x3a')](_0x4a4a65['query'][_0x835d('0x3a')]));_0x4db4c5[_0x835d('0x39')]=_0x4db4c5['attributes'][_0x835d('0x3b')]?_0x4db4c5[_0x835d('0x39')]:_0xa1decf[_0x835d('0x34')];if(!_0x4a4a65['query']['hasOwnProperty'](_0x835d('0x3c'))){_0x4db4c5[_0x835d('0x23')]=qs[_0x835d('0x23')](_0x4a4a65[_0x835d('0x35')][_0x835d('0x23')]);_0x4db4c5[_0x835d('0x22')]=qs[_0x835d('0x22')](_0x4a4a65[_0x835d('0x35')][_0x835d('0x22')]);}_0x4db4c5['order']=qs[_0x835d('0x3d')](_0x4a4a65[_0x835d('0x35')][_0x835d('0x3d')]);_0x4db4c5[_0x835d('0x3e')]=qs[_0x835d('0x37')](_['pick'](_0x4a4a65[_0x835d('0x35')],_0xa1decf['filters']),_0x44b8c1);if(_0x4a4a65[_0x835d('0x35')][_0x835d('0x3f')]){_0x4db4c5[_0x835d('0x3e')]=_[_0x835d('0x40')](_0x4db4c5[_0x835d('0x3e')],{'$or':_[_0x835d('0x2f')](_0x44b8c1,function(_0x4d431d){if(_0x4d431d['type']!==_0x835d('0x41')){var _0x3cfab7={};_0x3cfab7[_0x4d431d[_0x835d('0x2c')]]={'$like':'%'+_0x4a4a65[_0x835d('0x35')][_0x835d('0x3f')]+'%'};return _0x3cfab7;}})});}_0x4db4c5=_[_0x835d('0x40')]({},_0x4db4c5,_0x4a4a65[_0x835d('0x42')]);var _0x37d752={'where':_0x4db4c5[_0x835d('0x3e')]};return db[_0x835d('0x30')][_0x835d('0x21')](_0x37d752)[_0x835d('0x2a')](function(_0x254ffe){_0x2bd9de['count']=_0x254ffe;if(_0x4a4a65[_0x835d('0x35')]['includeAll']){_0x4db4c5['include']=[{'all':!![]}];}return db[_0x835d('0x30')]['findAll'](_0x4db4c5);})[_0x835d('0x2a')](function(_0x2d2dad){_0x2bd9de[_0x835d('0x43')]=_0x2d2dad;return _0x2bd9de;})[_0x835d('0x2a')](respondWithFilteredResult(_0x50e557,_0x4db4c5))['catch'](handleError(_0x50e557,null));};exports[_0x835d('0x44')]=function(_0x3ca52e,_0x359395){var _0x256754={'raw':![],'where':{'id':_0x3ca52e[_0x835d('0x45')]['id']}},_0x40f6f5={};_0x40f6f5[_0x835d('0x34')]=_[_0x835d('0x36')](db[_0x835d('0x30')]['rawAttributes']);_0x40f6f5[_0x835d('0x35')]=_[_0x835d('0x36')](_0x3ca52e[_0x835d('0x35')]);_0x40f6f5[_0x835d('0x37')]=_[_0x835d('0x38')](_0x40f6f5[_0x835d('0x34')],_0x40f6f5[_0x835d('0x35')]);_0x256754[_0x835d('0x39')]=_[_0x835d('0x38')](_0x40f6f5['model'],qs[_0x835d('0x3a')](_0x3ca52e['query']['fields']));_0x256754['attributes']=_0x256754['attributes'][_0x835d('0x3b')]?_0x256754[_0x835d('0x39')]:_0x40f6f5[_0x835d('0x34')];if(_0x3ca52e[_0x835d('0x35')][_0x835d('0x46')]){_0x256754['include']=[{'all':!![]}];}_0x256754=_[_0x835d('0x40')]({},_0x256754,_0x3ca52e[_0x835d('0x42')]);return db['CmList']['find'](_0x256754)['then'](handleEntityNotFound(_0x359395,null))['then'](respondWithResult(_0x359395,null))[_0x835d('0x47')](handleError(_0x359395,null));};exports['create']=function(_0x480dab,_0x5df150){return db[_0x835d('0x30')][_0x835d('0x48')](_0x480dab[_0x835d('0x49')],{})[_0x835d('0x2a')](function(_0x55e75){var _0x158925=_0x480dab['user'][_0x835d('0x4a')]({'plain':!![]});if(!_0x158925)throw new Error(_0x835d('0x4b'));if(_0x158925[_0x835d('0x4c')]===_0x835d('0x4d')){var _0x35cbd5=_0x55e75[_0x835d('0x4a')]({'plain':!![]});var _0x52d49d=_0x835d('0x4e');return db['UserProfileSection'][_0x835d('0x4f')]({'where':{'name':_0x52d49d,'userProfileId':_0x158925[_0x835d('0x50')]},'raw':!![]})['then'](function(_0x7577b8){if(_0x7577b8&&_0x7577b8[_0x835d('0x51')]===0x0){return db[_0x835d('0x2b')][_0x835d('0x48')]({'name':_0x35cbd5[_0x835d('0x2c')],'resourceId':_0x35cbd5['id'],'type':_0x7577b8[_0x835d('0x2c')],'sectionId':_0x7577b8['id']},{})['then'](function(){return _0x55e75;});}else{return _0x55e75;}})[_0x835d('0x47')](function(_0x464730){logger[_0x835d('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464730);throw _0x464730;});}return _0x55e75;})[_0x835d('0x2a')](respondWithResult(_0x5df150,0xc9))[_0x835d('0x47')](handleError(_0x5df150,null));};exports[_0x835d('0x28')]=function(_0x21fa7b,_0x178b81){if(_0x21fa7b['body']['id']){delete _0x21fa7b[_0x835d('0x49')]['id'];}return db['CmList'][_0x835d('0x4f')]({'where':{'id':_0x21fa7b[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x178b81,null))['then'](saveUpdates(_0x21fa7b[_0x835d('0x49')],null))[_0x835d('0x2a')](respondWithResult(_0x178b81,null))[_0x835d('0x47')](handleError(_0x178b81,null));};exports[_0x835d('0x29')]=function(_0x18828d,_0x5aae9e){return db['CmList'][_0x835d('0x4f')]({'where':{'id':_0x18828d[_0x835d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aae9e,null))[_0x835d('0x2a')](removeEntity(_0x5aae9e,null))[_0x835d('0x47')](handleError(_0x5aae9e,null));};exports[_0x835d('0x53')]=function(_0x1d5e6f,_0x57d3b5){return db[_0x835d('0x30')][_0x835d('0x53')]()[_0x835d('0x2a')](respondWithResult(_0x57d3b5,null))['catch'](handleError(_0x57d3b5,null));};exports['addDisposition']=function(_0x2c949a,_0x5a3082,_0x13cd1c){if(_0x2c949a[_0x835d('0x49')]['id']){delete _0x2c949a[_0x835d('0x49')]['id'];}return db['CmList'][_0x835d('0x4f')]({'where':{'id':_0x2c949a[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x5a3082,null))['then'](function(_0xbb5e20){if(_0xbb5e20){_0x2c949a[_0x835d('0x49')][_0x835d('0x54')]=_0xbb5e20['id'];return db['Disposition'][_0x835d('0x48')](_0x2c949a[_0x835d('0x49')]);}})[_0x835d('0x2a')](respondWithResult(_0x5a3082,null))[_0x835d('0x47')](handleError(_0x5a3082,null));};exports['getDispositions']=function(_0x292bf8,_0x26a215,_0x34672a){var _0x4f86bd={'raw':![],'where':{}};var _0x57d9ca={};var _0x463282={'count':0x0,'rows':[]};return db[_0x835d('0x30')][_0x835d('0x55')]({'where':{'id':_0x292bf8[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x26a215,null))[_0x835d('0x2a')](function(_0x4eaf99){if(_0x4eaf99){_0x57d9ca[_0x835d('0x34')]=_[_0x835d('0x36')](db[_0x835d('0x56')][_0x835d('0x31')]);_0x57d9ca['query']=_[_0x835d('0x36')](_0x292bf8[_0x835d('0x35')]);_0x57d9ca['filters']=_['intersection'](_0x57d9ca[_0x835d('0x34')],_0x57d9ca[_0x835d('0x35')]);_0x4f86bd[_0x835d('0x39')]=_[_0x835d('0x38')](_0x57d9ca['model'],qs['fields'](_0x292bf8[_0x835d('0x35')][_0x835d('0x3a')]));_0x4f86bd[_0x835d('0x39')]=_0x4f86bd[_0x835d('0x39')][_0x835d('0x3b')]?_0x4f86bd[_0x835d('0x39')]:_0x57d9ca[_0x835d('0x34')];if(!_0x292bf8[_0x835d('0x35')][_0x835d('0x57')](_0x835d('0x3c'))){_0x4f86bd[_0x835d('0x23')]=qs[_0x835d('0x23')](_0x292bf8[_0x835d('0x35')]['limit']);_0x4f86bd['offset']=qs[_0x835d('0x22')](_0x292bf8[_0x835d('0x35')][_0x835d('0x22')]);}_0x4f86bd['order']=qs[_0x835d('0x3d')](_0x292bf8[_0x835d('0x35')][_0x835d('0x3d')]);_0x4f86bd[_0x835d('0x3e')]=qs[_0x835d('0x37')](_['pick'](_0x292bf8[_0x835d('0x35')],_0x57d9ca[_0x835d('0x37')]));_0x4f86bd[_0x835d('0x3e')][_0x835d('0x54')]=_0x4eaf99['id'];if(_0x292bf8[_0x835d('0x35')]['filter']){_0x4f86bd['where']=_[_0x835d('0x40')](_0x4f86bd[_0x835d('0x3e')],{'$or':_[_0x835d('0x2f')](_0x4f86bd['attributes'],function(_0x47ec75){var _0x208030={};_0x208030[_0x47ec75]={'$like':'%'+_0x292bf8[_0x835d('0x35')][_0x835d('0x3f')]+'%'};return _0x208030;})});}_0x4f86bd=_[_0x835d('0x40')]({},_0x4f86bd,_0x292bf8['options']);return db['Disposition'][_0x835d('0x21')]({'where':_0x4f86bd[_0x835d('0x3e')]})[_0x835d('0x2a')](function(_0x55f19e){_0x463282['count']=_0x55f19e;if(_0x292bf8[_0x835d('0x35')][_0x835d('0x46')]){_0x4f86bd[_0x835d('0x58')]=[{'all':!![]}];}return db[_0x835d('0x56')][_0x835d('0x59')](_0x4f86bd);})[_0x835d('0x2a')](function(_0x2d2d15){_0x463282[_0x835d('0x43')]=_0x2d2d15;return _0x463282;});}})[_0x835d('0x2a')](respondWithFilteredResult(_0x26a215,_0x4f86bd))['catch'](handleError(_0x26a215,null));};exports[_0x835d('0x5a')]=function(_0x31fda2,_0x566c62,_0x2cc088){return db[_0x835d('0x30')][_0x835d('0x4f')]({'where':{'id':_0x31fda2[_0x835d('0x45')]['id']}})['then'](handleEntityNotFound(_0x566c62,null))[_0x835d('0x2a')](function(_0x419555){if(_0x419555){return _0x419555[_0x835d('0x5a')](_0x31fda2[_0x835d('0x35')][_0x835d('0x5b')]);}})[_0x835d('0x2a')](respondWithStatusCode(_0x566c62,null))[_0x835d('0x47')](handleError(_0x566c62,null));};exports[_0x835d('0x5c')]=function(_0x432cab,_0x4b7e0c,_0x22ddbd){return db['CmList'][_0x835d('0x4f')]({'where':{'id':_0x432cab[_0x835d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b7e0c,null))[_0x835d('0x2a')](function(_0x316dfe){if(_0x316dfe){var _0x39af72=[];var _0x3e8b27={'success':[],'errors':[]};return db['CmContact'][_0x835d('0x53')]()[_0x835d('0x2a')](function(_0x132337){if(_0x432cab['body'][_0x835d('0x5d')]&&_[_0x835d('0x5e')](_0x432cab['body'][_0x835d('0x5d')])){if(_0x432cab[_0x835d('0x49')][_0x835d('0x5d')]['length']){_0x432cab[_0x835d('0x49')][_0x835d('0x5d')]=_0x432cab[_0x835d('0x49')]['tags'][_0x835d('0x5f')](';')+';';}else{_0x432cab[_0x835d('0x49')][_0x835d('0x5d')]=null;}}else{_0x432cab[_0x835d('0x49')]['tags']=null;}if(_0x432cab[_0x835d('0x49')]&&_[_0x835d('0x5e')](_0x432cab[_0x835d('0x49')])){for(var _0x2d19c2=0x0;_0x2d19c2<_0x432cab[_0x835d('0x49')][_0x835d('0x3b')];_0x2d19c2+=0x1){_0x432cab[_0x835d('0x49')][_0x2d19c2][_0x835d('0x54')]=_0x432cab['params']['id'];_0x39af72['push'](_0x432cab[_0x835d('0x49')][_0x2d19c2]);}return BPromise['each'](_0x39af72,function(_0x3bbd31){return db[_0x835d('0x60')][_0x835d('0x48')](_[_0x835d('0x61')](_0x3bbd31,[_0x835d('0x5b'),'id'])||{},{'fields':_[_0x835d('0x36')](_0x132337),'raw':!![]})[_0x835d('0x2a')](function(_0xb499ec){_0x3e8b27['success'][_0x835d('0x62')](_0xb499ec['dataValues']);})[_0x835d('0x47')](function(_0x444788){_0x3e8b27['errors'][_0x835d('0x62')]({'data':_0x3bbd31,'error':_0x444788[_0x835d('0x63')]});});})[_0x835d('0x2a')](function(_0x2ac7f1){return _0x3e8b27;})['catch'](function(_0x397e9b){return _0x397e9b;});}else{_0x4b7e0c['status'](0x190)[_0x835d('0x1f')]({'message':_0x835d('0x64')});}});}})[_0x835d('0x2a')](respondWithResult(_0x4b7e0c,null))[_0x835d('0x47')](handleError(_0x4b7e0c,null));};exports[_0x835d('0x65')]=function(_0x853556,_0x3bd61b,_0x1cbc5d){var _0xb00a28;return db[_0x835d('0x30')][_0x835d('0x4f')]({'where':{'id':_0x853556[_0x835d('0x45')]['id']},'include':[{'model':db[_0x835d('0x66')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x3bd61b,null))[_0x835d('0x2a')](function(_0x230f4c){if(_0x230f4c){_0xb00a28=_0x230f4c;return db[_0x835d('0x60')][_0x835d('0x31')];}})[_0x835d('0x2a')](function(_0x1af7f8){if(_0x1af7f8){var _0x11f4a3={};var _0x3e9456={};_0x3e9456[_0x835d('0x34')]=_['concat'](_[_0x835d('0x36')](_0x1af7f8),_[_0x835d('0x2f')](_0xb00a28[_0x835d('0x67')],function(_0x463ec1){return util['format']('cf_%d',_0x463ec1['id']);}));_0x3e9456[_0x835d('0x35')]=_[_0x835d('0x36')](_0x853556[_0x835d('0x35')]);_0x3e9456[_0x835d('0x37')]=_[_0x835d('0x38')](_0x3e9456[_0x835d('0x34')],_0x3e9456['query']);_0x11f4a3[_0x835d('0x39')]=_[_0x835d('0x38')](_0x3e9456['model'],qs[_0x835d('0x3a')](_0x853556['query'][_0x835d('0x3a')]));_0x11f4a3['attributes']=_0x11f4a3[_0x835d('0x39')][_0x835d('0x3b')]?_0x11f4a3['attributes']:_0x3e9456['model'];if(!_0x853556[_0x835d('0x35')][_0x835d('0x57')](_0x835d('0x3c'))){_0x11f4a3['limit']=qs[_0x835d('0x23')](_0x853556[_0x835d('0x35')]['limit']);_0x11f4a3[_0x835d('0x22')]=qs[_0x835d('0x22')](_0x853556['query'][_0x835d('0x22')]);}_0x11f4a3[_0x835d('0x68')]=qs[_0x835d('0x3d')](_0x853556[_0x835d('0x35')][_0x835d('0x3d')]);_0x11f4a3[_0x835d('0x3e')]=qs[_0x835d('0x37')](_[_0x835d('0x69')](_0x853556['query'],_0x3e9456[_0x835d('0x37')]));_0x11f4a3['raw']=!![];if(_0x853556[_0x835d('0x35')][_0x835d('0x3f')]){_0x11f4a3[_0x835d('0x3e')]=_[_0x835d('0x40')](_0x11f4a3[_0x835d('0x3e')],{'$or':_[_0x835d('0x2f')](_0x11f4a3[_0x835d('0x39')],function(_0x3df706){var _0x3c01cf={};_0x3c01cf[_0x3df706]={'$like':'%'+_0x853556[_0x835d('0x35')][_0x835d('0x3f')]+'%'};return _0x3c01cf;})});}_0x11f4a3=_['merge']({},_0x11f4a3,_0x853556[_0x835d('0x42')]);return _0xb00a28[_0x835d('0x65')](_0x11f4a3);}})[_0x835d('0x2a')](respondWithResult(_0x3bd61b,null))['catch'](handleError(_0x3bd61b,null));};exports[_0x835d('0x6a')]=function(_0xc9acfb,_0x4bd0ef,_0x4d09c1){var _0x36c077;var _0x3c5385;var _0x25cb62;var _0x2c6b58=_0xc9acfb['params']['id'];csv_results=[];return db[_0x835d('0x6b')][_0x835d('0x59')]({'attributes':['id',_0x835d('0x2c')],'raw':!![],'order':[_0x835d('0x6c')]})[_0x835d('0x2a')](function(_0x1bfc98){_0x36c077=_0x1bfc98;var _0x45a71f=_['keys'](db[_0x835d('0x60')]['rawAttributes']);return db['CmCustomField'][_0x835d('0x59')]({'raw':!![],'attributes':['id',_0x835d('0x6d')]})[_0x835d('0x2a')](function(_0x222d1a){_0x3c5385=_0x222d1a;var _0x12a51e=squel[_0x835d('0x6e')]()[_0x835d('0x3a')](_0x45a71f)[_0x835d('0x6f')](_0x835d('0x70'),'c')[_0x835d('0x3e')](_0x835d('0x71'),_0x2c6b58)['where'](_0x835d('0x72'))[_0x835d('0x73')]();for(var _0x5aa423=0x0;_0x5aa423<_0x3c5385['length'];_0x5aa423++){_0x12a51e['field'](_0x835d('0x74')+_0x3c5385[_0x5aa423]['id'],_0x835d('0x75')+_0x3c5385[_0x5aa423][_0x835d('0x6d')]);}for(var _0x5aa423=0x0;_0x5aa423<_0x36c077[_0x835d('0x3b')];_0x5aa423++){_0x12a51e[_0x835d('0x76')](squel[_0x835d('0x6e')]()[_0x835d('0x76')](_0x835d('0x77'))[_0x835d('0x6f')]('cm_contact_has_items')[_0x835d('0x3e')](_0x835d('0x78'),_0x36c077[_0x5aa423]['id'])[_0x835d('0x3e')](_0x835d('0x79')),'additionalPhone_'+_0x36c077[_0x5aa423][_0x835d('0x2c')]);_0x12a51e['field'](squel[_0x835d('0x6e')]()[_0x835d('0x76')](_0x835d('0x7a'))[_0x835d('0x6f')](_0x835d('0x7b'))[_0x835d('0x3e')](_0x835d('0x78'),_0x36c077[_0x5aa423]['id'])['where']('CmContactId\x20=\x20c.id'),_0x835d('0x7c')+_0x36c077[_0x5aa423][_0x835d('0x2c')]);}var _0x210aae=[];_0x210aae['push'](_0x12a51e[_0x835d('0x7d')]());BPromise[_0x835d('0x7e')](_0x210aae,handleQuery)[_0x835d('0x2a')](function(_0x5d35b3){handleQuery(_0x12a51e['toString']());var _0x89e624=csv_results[0x0];if(!_['isEmpty'](_0x89e624)){var _0x377027=toCsv(_0x89e624);var _0x2bd1c0=Date[_0x835d('0x7f')]();fs[_0x835d('0x80')](util[_0x835d('0x81')](_0x835d('0x82'),_0x2c6b58,_0x2bd1c0),_0x377027);_0x4bd0ef[_0x835d('0x83')](_0x835d('0x84'),_0x835d('0x85')+util[_0x835d('0x81')](_0x835d('0x86'),_0x2c6b58,_0x2bd1c0));_0x4bd0ef[_0x835d('0x83')]('Content-type',_0x835d('0x87'));return _0x4bd0ef[_0x835d('0x88')](util['format'](_0x835d('0x82'),_0x2c6b58,_0x2bd1c0));}else{return _0x4bd0ef[_0x835d('0x1d')](0xcc);}});});});};exports[_0x835d('0x89')]=function(_0x4c1ded,_0x153f2e,_0x36ac25){var _0x58ca41;delete _0x4c1ded[_0x835d('0x49')]['id'];return db[_0x835d('0x30')]['findOne']({'where':{'id':_0x4c1ded[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x153f2e,null))['then'](function(_0x1a76e7){if(_0x1a76e7){return db[_0x835d('0x8a')]['transaction'](function(_0x13471f){return db['CmCustomField'][_0x835d('0x48')](_0x4c1ded[_0x835d('0x49')],{'transaction':_0x13471f})[_0x835d('0x2a')](function(_0x48fffd){_0x58ca41=_0x48fffd;return _0x1a76e7[_0x835d('0x8b')](_0x48fffd,{'transaction':_0x13471f});})[_0x835d('0x2a')](function(){var _0x364d16={'type':db[_0x835d('0x8c')][_0x835d('0x8d')],'transaction':_0x13471f};switch(_0x4c1ded[_0x835d('0x49')][_0x835d('0x32')]){case _0x835d('0x8e'):_0x364d16[_0x835d('0x32')]=db[_0x835d('0x8c')]['TEXT'];break;case _0x835d('0x8f'):_0x364d16[_0x835d('0x32')]=db[_0x835d('0x8c')][_0x835d('0x90')];break;case _0x835d('0x91'):_0x364d16[_0x835d('0x32')]=db[_0x835d('0x8c')][_0x835d('0x92')];_0x364d16[_0x835d('0x93')]=![];break;default:}return db['sequelize'][_0x835d('0x94')][_0x835d('0x95')](_0x835d('0x70'),util[_0x835d('0x81')](_0x835d('0x96'),_0x58ca41['id']),_0x364d16);})[_0x835d('0x2a')](function(){return _0x58ca41;});});}})[_0x835d('0x2a')](respondWithResult(_0x153f2e,null))[_0x835d('0x47')](handleError(_0x153f2e,null));};exports[_0x835d('0x97')]=function(_0xf7f1e7,_0x1c3d1c,_0x17af15){var _0x36fd73={};var _0x162b7f={};var _0x8225c9;var _0xc8f888;return db[_0x835d('0x30')][_0x835d('0x55')]({'where':{'id':_0xf7f1e7['params']['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x1c3d1c,null))[_0x835d('0x2a')](function(_0x3a8f4e){if(_0x3a8f4e){_0x8225c9=_0x3a8f4e;_0x162b7f[_0x835d('0x34')]=_['keys'](db[_0x835d('0x66')][_0x835d('0x31')]);_0x162b7f['query']=_[_0x835d('0x36')](_0xf7f1e7[_0x835d('0x35')]);_0x162b7f[_0x835d('0x37')]=_['intersection'](_0x162b7f[_0x835d('0x34')],_0x162b7f[_0x835d('0x35')]);_0x36fd73['attributes']=_[_0x835d('0x38')](_0x162b7f[_0x835d('0x34')],qs[_0x835d('0x3a')](_0xf7f1e7[_0x835d('0x35')][_0x835d('0x3a')]));_0x36fd73['attributes']=_0x36fd73[_0x835d('0x39')][_0x835d('0x3b')]?_0x36fd73[_0x835d('0x39')]:_0x162b7f['model'];_0x36fd73[_0x835d('0x68')]=qs[_0x835d('0x3d')](_0xf7f1e7[_0x835d('0x35')][_0x835d('0x3d')]);_0x36fd73[_0x835d('0x3e')]=qs[_0x835d('0x37')](_[_0x835d('0x69')](_0xf7f1e7[_0x835d('0x35')],_0x162b7f[_0x835d('0x37')]));_0x36fd73['where']=_[_0x835d('0x40')](_0x36fd73['where'],{'$or':[{'ListId':_0x3a8f4e['id']},{'ListId':null}]});if(_0xf7f1e7[_0x835d('0x35')]['filter']){_0x36fd73[_0x835d('0x3e')]=_[_0x835d('0x40')](_0x36fd73[_0x835d('0x3e')],{'$or':_[_0x835d('0x2f')](_0x36fd73['attributes'],function(_0x52a3c8){var _0x1dce63={};_0x1dce63[_0x52a3c8]={'$like':'%'+_0xf7f1e7[_0x835d('0x35')]['filter']+'%'};return _0x1dce63;})});}_0x36fd73=_['merge']({},_0x36fd73,_0xf7f1e7[_0x835d('0x42')]);return db[_0x835d('0x66')]['findAndCountAll'](_0x36fd73);}})[_0x835d('0x2a')](respondWithResult(_0x1c3d1c,null))[_0x835d('0x47')](handleError(_0x1c3d1c,null));};exports['getGlobalCustomFields']=function(_0x50594a,_0x146337){return db[_0x835d('0x66')][_0x835d('0x98')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x146337,null))['then'](function(_0x1c73b6){return _0x1c73b6;})[_0x835d('0x2a')](respondWithResult(_0x146337,null))[_0x835d('0x47')](handleError(_0x146337,null));};exports[_0x835d('0x99')]=function(_0x43f7eb,_0x1ac382,_0x5b2184){return db['CmList']['find']({'where':{'id':_0x43f7eb[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x1ac382,null))['then'](function(_0x203ccf){if(_0x203ccf){return _0x203ccf[_0x835d('0x99')](_0x43f7eb[_0x835d('0x49')][_0x835d('0x5b')],_[_0x835d('0x61')](_0x43f7eb[_0x835d('0x49')],['ids','id'])||{})[_0x835d('0x9a')](function(_0x55aa7a){for(var _0x26395=0x0;_0x26395<_0x43f7eb[_0x835d('0x49')][_0x835d('0x5b')][_0x835d('0x3b')];_0x26395+=0x1){socket[_0x835d('0x9b')](_0x835d('0x9c'),{'UserId':Number(_0x43f7eb['body'][_0x835d('0x5b')][_0x26395]),'CmListId':Number(_0x43f7eb[_0x835d('0x45')]['id'])});}return _0x55aa7a;});}})[_0x835d('0x2a')](respondWithResult(_0x1ac382,null))[_0x835d('0x47')](handleError(_0x1ac382,null));};exports['removeAgents']=function(_0x38e17e,_0x260c2b,_0x2d97f4){return db['CmList'][_0x835d('0x4f')]({'where':{'id':_0x38e17e[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x260c2b,null))[_0x835d('0x2a')](function(_0x474cd4){if(_0x474cd4){return _0x474cd4['removeAgents'](_0x38e17e[_0x835d('0x35')]['ids'])[_0x835d('0x2a')](function(){if(_[_0x835d('0x5e')](_0x38e17e[_0x835d('0x35')][_0x835d('0x5b')])){for(var _0x5e821d=0x0;_0x5e821d<_0x38e17e[_0x835d('0x35')][_0x835d('0x5b')][_0x835d('0x3b')];_0x5e821d+=0x1){socket[_0x835d('0x9b')](_0x835d('0x9d'),{'UserId':Number(_0x38e17e[_0x835d('0x35')][_0x835d('0x5b')][_0x5e821d]),'CmListId':Number(_0x38e17e[_0x835d('0x45')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x38e17e[_0x835d('0x35')][_0x835d('0x5b')]),'CmListId':Number(_0x38e17e['params']['id'])});}});}})[_0x835d('0x2a')](respondWithStatusCode(_0x260c2b,null))[_0x835d('0x47')](handleError(_0x260c2b,null));};exports[_0x835d('0x9e')]=function(_0x30f0a3,_0x1dad98,_0x46d088){var _0x47858c={};var _0x4c0bf0={};var _0x5b29c4;var _0x4479cd;return db[_0x835d('0x30')][_0x835d('0x55')]({'where':{'id':_0x30f0a3[_0x835d('0x45')]['id']}})[_0x835d('0x2a')](handleEntityNotFound(_0x1dad98,null))['then'](function(_0x213ea7){if(_0x213ea7){_0x5b29c4=_0x213ea7;_0x4c0bf0['model']=_[_0x835d('0x36')](db[_0x835d('0x9f')][_0x835d('0x31')]);_0x4c0bf0[_0x835d('0x35')]=_[_0x835d('0x36')](_0x30f0a3[_0x835d('0x35')]);_0x4c0bf0[_0x835d('0x37')]=_['intersection'](_0x4c0bf0[_0x835d('0x34')],_0x4c0bf0['query']);_0x47858c[_0x835d('0x39')]=_[_0x835d('0x38')](_0x4c0bf0[_0x835d('0x34')],qs[_0x835d('0x3a')](_0x30f0a3[_0x835d('0x35')][_0x835d('0x3a')]));_0x47858c[_0x835d('0x39')]=_0x47858c[_0x835d('0x39')]['length']?_0x47858c[_0x835d('0x39')]:_0x4c0bf0[_0x835d('0x34')];_0x47858c['order']=qs[_0x835d('0x3d')](_0x30f0a3[_0x835d('0x35')][_0x835d('0x3d')]);_0x47858c['where']=qs[_0x835d('0x37')](_['pick'](_0x30f0a3['query'],_0x4c0bf0['filters']));if(_0x30f0a3[_0x835d('0x35')]['filter']){_0x47858c[_0x835d('0x3e')]=_[_0x835d('0x40')](_0x47858c[_0x835d('0x3e')],{'$or':_[_0x835d('0x2f')](_0x47858c[_0x835d('0x39')],function(_0x5d3b15){var _0x502ddc={};_0x502ddc[_0x5d3b15]={'$like':'%'+_0x30f0a3['query'][_0x835d('0x3f')]+'%'};return _0x502ddc;})});}_0x47858c=_[_0x835d('0x40')]({},_0x47858c,_0x30f0a3[_0x835d('0x42')]);return _0x5b29c4[_0x835d('0x9e')](_0x47858c);}})['then'](function(_0x351497){if(_0x351497){_0x4479cd=_0x351497[_0x835d('0x3b')];if(!_0x30f0a3[_0x835d('0x35')][_0x835d('0x57')]('nolimit')){_0x47858c[_0x835d('0x23')]=qs[_0x835d('0x23')](_0x30f0a3[_0x835d('0x35')][_0x835d('0x23')]);_0x47858c[_0x835d('0x22')]=qs[_0x835d('0x22')](_0x30f0a3[_0x835d('0x35')][_0x835d('0x22')]);}return _0x5b29c4['getAgents'](_0x47858c);}})['then'](function(_0x37532d){if(_0x37532d){return _0x37532d?{'count':_0x4479cd,'rows':_0x37532d}:null;}})[_0x835d('0x2a')](respondWithResult(_0x1dad98,null))[_0x835d('0x47')](handleError(_0x1dad98,null));};function handleQuery(_0x2252b1){logger['info'](_0x2252b1);return db[_0x835d('0x8a')][_0x835d('0x35')](_0x2252b1)[_0x835d('0x9a')](function(_0x5c9dbd){csv_results[_0x835d('0x62')](_0x5c9dbd);})[_0x835d('0x47')](function(_0x4f31cd){logger[_0x835d('0x52')](_0x4f31cd[_0x835d('0x63')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 2c3098f..943ad19 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x235e2b,_0x232235){var _0x4e9f0a=function(_0x2f5bf2){while(--_0x2f5bf2){_0x235e2b['push'](_0x235e2b['shift']());}};_0x4e9f0a(++_0x232235);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x1940c5,_0x2db10f){_0x1940c5=_0x1940c5-0x0;var _0x1a82c3=_0xe14b[_0x1940c5];return _0x1a82c3;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cab3258..2d67935 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 _0xf4eb=['./cmList.attributes','exports','define','cm_lists','lodash','bluebird','rimraf','../../config/environment'];(function(_0x3970a3,_0x5978fe){var _0x2b7af4=function(_0x1d7639){while(--_0x1d7639){_0x3970a3['push'](_0x3970a3['shift']());}};_0x2b7af4(++_0x5978fe);}(_0xf4eb,0xec));var _0xbf4e=function(_0x99d433,_0x5762fe){_0x99d433=_0x99d433-0x0;var _0x328d0a=_0xf4eb[_0x99d433];return _0x328d0a;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('CmList',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0x91a7,0xe7));var _0x791a=function(_0x3f658,_0x4535f7){_0x3f658=_0x3f658-0x0;var _0xd3a6db=_0x91a7[_0x3f658];return _0xd3a6db;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 43018b6..72ed925 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 _0xce6b=['../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./cmList.socket','info','debug','request\x20sent','error','code','CmList,\x20%s,\x20%s','message','bluebird','randomstring','ioredis'];(function(_0x7ad542,_0x4475dd){var _0x9bbb60=function(_0x39bae8){while(--_0x39bae8){_0x7ad542['push'](_0x7ad542['shift']());}};_0x9bbb60(++_0x4475dd);}(_0xce6b,0x9f));var _0xbce6=function(_0x424b2e,_0x2b88a8){_0x424b2e=_0x424b2e-0x0;var _0x443840=_0xce6b[_0x424b2e];return _0x443840;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbce6('0x0'));var rs=require(_0xbce6('0x1'));var fs=require('fs');var Redis=require(_0xbce6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbce6('0x3'));var logger=require('../../config/logger')(_0xbce6('0x4'));var config=require(_0xbce6('0x5'));var jayson=require(_0xbce6('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xbce6('0x7')]=_[_0xbce6('0x8')](config[_0xbce6('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xbce6('0x9'))(new Redis(config[_0xbce6('0x7')]));require(_0xbce6('0xa'))['register'](socket);function respondWithRpcPromise(_0x469ea9,_0xa79116,_0x57a800){return new BPromise(function(_0x12d68e,_0x1deef7){return client['request'](_0x469ea9,_0x57a800)['then'](function(_0x38b460){logger[_0xbce6('0xb')]('CmList,\x20%s,\x20%s',_0xa79116,'request\x20sent');logger[_0xbce6('0xc')]('CmList,\x20%s,\x20%s,\x20%s',_0xa79116,_0xbce6('0xd'),JSON['stringify'](_0x38b460));if(_0x38b460[_0xbce6('0xe')]){if(_0x38b460[_0xbce6('0xe')][_0xbce6('0xf')]===0x1f4){logger['error'](_0xbce6('0x10'),_0xa79116,_0x38b460[_0xbce6('0xe')]['message']);return _0x1deef7(_0x38b460[_0xbce6('0xe')][_0xbce6('0x11')]);}logger[_0xbce6('0xe')](_0xbce6('0x10'),_0xa79116,_0x38b460['error'][_0xbce6('0x11')]);return _0x12d68e(_0x38b460['error']['message']);}else{logger[_0xbce6('0xb')](_0xbce6('0x10'),_0xa79116,'request\x20sent');_0x12d68e(_0x38b460['result'][_0xbce6('0x11')]);}})['catch'](function(_0x495448){logger[_0xbce6('0xe')](_0xbce6('0x10'),_0xa79116,_0x495448);_0x1deef7(_0x495448);});});} \ No newline at end of file +var _0x9b3c=['client','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9b3c,0xfa));var _0xc9b3=function(_0x55d480,_0x297c95){_0x55d480=_0x55d480-0x0;var _0x3943c4=_0x9b3c[_0x55d480];return _0x3943c4;};'use strict';var _=require(_0xc9b3('0x0'));var util=require(_0xc9b3('0x1'));var moment=require(_0xc9b3('0x2'));var BPromise=require(_0xc9b3('0x3'));var rs=require(_0xc9b3('0x4'));var fs=require('fs');var Redis=require(_0xc9b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9b3('0x6'));var logger=require(_0xc9b3('0x7'))(_0xc9b3('0x8'));var config=require(_0xc9b3('0x9'));var jayson=require(_0xc9b3('0xa'));var client=jayson[_0xc9b3('0xb')]['http']({'port':0x232a});config[_0xc9b3('0xc')]=_[_0xc9b3('0xd')](config[_0xc9b3('0xc')],{'host':_0xc9b3('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0xc9b3('0xf')](socket);function respondWithRpcPromise(_0x33040f,_0x1d3826,_0x2c050c){return new BPromise(function(_0x605968,_0x56960b){return client[_0xc9b3('0x10')](_0x33040f,_0x2c050c)[_0xc9b3('0x11')](function(_0x408220){logger[_0xc9b3('0x12')]('CmList,\x20%s,\x20%s',_0x1d3826,_0xc9b3('0x13'));logger[_0xc9b3('0x14')](_0xc9b3('0x15'),_0x1d3826,_0xc9b3('0x13'),JSON[_0xc9b3('0x16')](_0x408220));if(_0x408220[_0xc9b3('0x17')]){if(_0x408220[_0xc9b3('0x17')][_0xc9b3('0x18')]===0x1f4){logger[_0xc9b3('0x17')](_0xc9b3('0x19'),_0x1d3826,_0x408220[_0xc9b3('0x17')]['message']);return _0x56960b(_0x408220['error']['message']);}logger[_0xc9b3('0x17')](_0xc9b3('0x19'),_0x1d3826,_0x408220['error']['message']);return _0x605968(_0x408220[_0xc9b3('0x17')][_0xc9b3('0x1a')]);}else{logger[_0xc9b3('0x12')](_0xc9b3('0x19'),_0x1d3826,_0xc9b3('0x13'));_0x605968(_0x408220[_0xc9b3('0x1b')][_0xc9b3('0x1a')]);}})[_0xc9b3('0x1c')](function(_0x540198){logger[_0xc9b3('0x17')](_0xc9b3('0x19'),_0x1d3826,_0x540198);_0x56960b(_0x540198);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 09937b7..41fc8d2 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 _0x74d6=['removeListener','register','length','emit'];(function(_0x9f761c,_0x130457){var _0x399f3b=function(_0x3af3a8){while(--_0x3af3a8){_0x9f761c['push'](_0x9f761c['shift']());}};_0x399f3b(++_0x130457);}(_0x74d6,0xeb));var _0x674d=function(_0x4c7c7c,_0x5a639b){_0x4c7c7c=_0x4c7c7c-0x0;var _0x2e6b21=_0x74d6[_0x4c7c7c];return _0x2e6b21;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove','update'];function createListener(_0x510d15,_0xec160){return function(_0x59bb74){_0xec160[_0x674d('0x0')](_0x510d15,_0x59bb74);};}function removeListener(_0x835a1b,_0x54773a){return function(){CmListEvents[_0x674d('0x1')](_0x835a1b,_0x54773a);};}exports[_0x674d('0x2')]=function(_0x48af44){for(var _0x529af7=0x0,_0x4b4ae0=events[_0x674d('0x3')];_0x529af7<_0x4b4ae0;_0x529af7++){var _0x5061b7=events[_0x529af7];var _0x4d37f7=createListener('cmList:'+_0x5061b7,_0x48af44);CmListEvents['on'](_0x5061b7,_0x4d37f7);}}; \ No newline at end of file +var _0xf808=['update','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0xf808,0xb5));var _0x8f80=function(_0x1cae0b,_0x5203df){_0x1cae0b=_0x1cae0b-0x0;var _0xf9db2a=_0xf808[_0x1cae0b];return _0xf9db2a;};'use strict';var CmListEvents=require(_0x8f80('0x0'));var events=[_0x8f80('0x1'),_0x8f80('0x2'),_0x8f80('0x3')];function createListener(_0x32899f,_0x2a396c){return function(_0x2a10ec){_0x2a396c['emit'](_0x32899f,_0x2a10ec);};}function removeListener(_0x1f7119,_0x3a5df4){return function(){CmListEvents[_0x8f80('0x4')](_0x1f7119,_0x3a5df4);};}exports[_0x8f80('0x5')]=function(_0x137cf4){for(var _0x85eecc=0x0,_0xb22ee1=events[_0x8f80('0x6')];_0x85eecc<_0xb22ee1;_0x85eecc++){var _0x85cb1c=events[_0x85eecc];var _0x31029c=createListener(_0x8f80('0x7')+_0x85cb1c,_0x137cf4);CmListEvents['on'](_0x85cb1c,_0x31029c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 817f8f4..e4b801c 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 _0x85ff=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','addDisposition','addCustomField','/:id/users','addAgents','update','delete','destroy','removeDispositions','exports'];(function(_0x5ab018,_0x44e106){var _0x25a5b1=function(_0xb677da){while(--_0xb677da){_0x5ab018['push'](_0x5ab018['shift']());}};_0x25a5b1(++_0x44e106);}(_0x85ff,0x1d1));var _0xf85f=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x85ff[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xf85f('0x0'));var util=require(_0xf85f('0x1'));var path=require('path');var timeout=require(_0xf85f('0x2'));var express=require(_0xf85f('0x3'));var router=express[_0xf85f('0x4')]();var fs_extra=require(_0xf85f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf85f('0x6'));var config=require(_0xf85f('0x7'));var controller=require(_0xf85f('0x8'));router[_0xf85f('0x9')]('/',auth[_0xf85f('0xa')](),controller[_0xf85f('0xb')]);router[_0xf85f('0x9')]('/describe',auth[_0xf85f('0xa')](),controller[_0xf85f('0xc')]);router[_0xf85f('0x9')](_0xf85f('0xd'),auth[_0xf85f('0xa')](),controller[_0xf85f('0xe')]);router[_0xf85f('0x9')](_0xf85f('0xf'),auth[_0xf85f('0xa')](),controller['show']);router[_0xf85f('0x9')](_0xf85f('0x10'),auth[_0xf85f('0xa')](),controller['getDispositions']);router[_0xf85f('0x9')]('/:id/contacts',auth[_0xf85f('0xa')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0xf85f('0xa')](),controller[_0xf85f('0x11')]);router['get'](_0xf85f('0x12'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x13')]);router['get']('/:id/users',auth[_0xf85f('0xa')](),controller[_0xf85f('0x14')]);router[_0xf85f('0x15')]('/',auth[_0xf85f('0xa')](),controller['create']);router[_0xf85f('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf85f('0x16')]);router[_0xf85f('0x15')]('/:id/contacts',auth[_0xf85f('0xa')](),controller['addContacts']);router[_0xf85f('0x15')](_0xf85f('0x12'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x17')]);router['post'](_0xf85f('0x18'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x19')]);router['put'](_0xf85f('0xf'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1a')]);router[_0xf85f('0x1b')](_0xf85f('0xf'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1c')]);router[_0xf85f('0x1b')](_0xf85f('0x10'),auth[_0xf85f('0xa')](),controller[_0xf85f('0x1d')]);router[_0xf85f('0x1b')](_0xf85f('0x18'),auth[_0xf85f('0xa')](),controller['removeAgents']);module[_0xf85f('0x1e')]=router; \ No newline at end of file +var _0xfa47=['destroy','delete','/:id/dispositions','removeDispositions','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update'];(function(_0x255e54,_0x4df79){var _0x2186bd=function(_0x5bc52e){while(--_0x5bc52e){_0x255e54['push'](_0x255e54['shift']());}};_0x2186bd(++_0x4df79);}(_0xfa47,0x1db));var _0x7fa4=function(_0x202b05,_0x5a246c){_0x202b05=_0x202b05-0x0;var _0x22a0a7=_0xfa47[_0x202b05];return _0x22a0a7;};'use strict';var multer=require(_0x7fa4('0x0'));var util=require(_0x7fa4('0x1'));var path=require('path');var timeout=require(_0x7fa4('0x2'));var express=require(_0x7fa4('0x3'));var router=express[_0x7fa4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7fa4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7fa4('0x6'));var controller=require('./cmList.controller');router[_0x7fa4('0x7')]('/',auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x9')]);router[_0x7fa4('0x7')](_0x7fa4('0xa'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0xb')]);router[_0x7fa4('0x7')](_0x7fa4('0xc'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0xd')]);router['get'](_0x7fa4('0xe'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0xf')]);router[_0x7fa4('0x7')]('/:id/dispositions',auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x10')]);router[_0x7fa4('0x7')](_0x7fa4('0x11'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x12')]);router[_0x7fa4('0x7')](_0x7fa4('0x13'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x14')]);router[_0x7fa4('0x7')](_0x7fa4('0x15'),auth['isAuthenticated'](),controller[_0x7fa4('0x16')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7fa4('0x17')]);router[_0x7fa4('0x18')]('/',auth['isAuthenticated'](),controller[_0x7fa4('0x19')]);router['post']('/:id/dispositions',auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x1a')]);router[_0x7fa4('0x18')](_0x7fa4('0x11'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x1b')]);router[_0x7fa4('0x18')](_0x7fa4('0x15'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x1c')]);router[_0x7fa4('0x18')]('/:id/users',auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x1d')]);router[_0x7fa4('0x1e')](_0x7fa4('0xe'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x1f')]);router['delete'](_0x7fa4('0xe'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x20')]);router[_0x7fa4('0x21')](_0x7fa4('0x22'),auth[_0x7fa4('0x8')](),controller[_0x7fa4('0x23')]);router[_0x7fa4('0x21')](_0x7fa4('0x24'),auth['isAuthenticated'](),controller[_0x7fa4('0x25')]);module[_0x7fa4('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4798a52..a190071 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 _0x67f7=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0x67f7,0x126));var _0x767f=function(_0x2881d3,_0x4adedc){_0x2881d3=_0x2881d3-0x0;var _0x17af86=_0x67f7[_0x2881d3];return _0x17af86;};'use strict';var Sequelize=require(_0x767f('0x0'));module[_0x767f('0x1')]={'name':{'type':Sequelize[_0x767f('0x2')],'get':function(_0x41b0f9){return this[_0x767f('0x3')](_0x767f('0x4'));}},'field':{'type':Sequelize[_0x767f('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x767f('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x767f('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x45db=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4d6df4,_0x261456){var _0x2e5435=function(_0x45ce1c){while(--_0x45ce1c){_0x4d6df4['push'](_0x4d6df4['shift']());}};_0x2e5435(++_0x261456);}(_0x45db,0x1b0));var _0xb45d=function(_0x253618,_0x2b36b2){_0x253618=_0x253618-0x0;var _0x9ec67b=_0x45db[_0x253618];return _0x9ec67b;};'use strict';var Sequelize=require(_0xb45d('0x0'));module[_0xb45d('0x1')]={'name':{'type':Sequelize[_0xb45d('0x2')],'get':function(_0x2b09d3){return this[_0xb45d('0x3')](_0xb45d('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xb45d('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xb45d('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index be1a847..07973f8 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x36b797,_0x3b4ae8){var _0x215ec7=function(_0x19ab34){while(--_0x19ab34){_0x36b797['push'](_0x36b797['shift']());}};_0x215ec7(++_0x3b4ae8);}(_0x7a54,0x106));var _0x47a5=function(_0x5b27f3,_0x103953){_0x5b27f3=_0x5b27f3-0x0;var _0x1307ec=_0x7a54[_0x5b27f3];return _0x1307ec;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x434e96,_0x4c831b){var _0x19d2a3=function(_0x2beab7){while(--_0x2beab7){_0x434e96['push'](_0x434e96['shift']());}};_0x19d2a3(++_0x4c831b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 43ea1ca..28e0fc4 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 _0x7045=['exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x39a2be,_0x5482c0){var _0x33c3e5=function(_0x493ef4){while(--_0x493ef4){_0x39a2be['push'](_0x39a2be['shift']());}};_0x33c3e5(++_0x5482c0);}(_0x7045,0x18b));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5704('0x0'));var util=require(_0x5704('0x1'));var logger=require(_0x5704('0x2'))(_0x5704('0x3'));var moment=require(_0x5704('0x4'));var BPromise=require(_0x5704('0x5'));var rp=require(_0x5704('0x6'));var fs=require('fs');var path=require(_0x5704('0x7'));var rimraf=require(_0x5704('0x8'));var config=require(_0x5704('0x9'));var attributes=require(_0x5704('0xa'));module[_0x5704('0xb')]=function(_0x206973,_0x26836e){return _0x206973['define'](_0x5704('0xc'),attributes,{'tableName':_0x5704('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51e3=['Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x9a4438,_0x331a79){var _0x15bd1a=function(_0x5cf1d9){while(--_0x5cf1d9){_0x9a4438['push'](_0x9a4438['shift']());}};_0x15bd1a(++_0x331a79);}(_0x51e3,0x152));var _0x351e=function(_0x27f1a1,_0x5d2b49){_0x27f1a1=_0x27f1a1-0x0;var _0x4d99fe=_0x51e3[_0x27f1a1];return _0x4d99fe;};'use strict';var _=require(_0x351e('0x0'));var util=require(_0x351e('0x1'));var logger=require(_0x351e('0x2'))(_0x351e('0x3'));var moment=require('moment');var BPromise=require(_0x351e('0x4'));var rp=require(_0x351e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x351e('0x6'));var config=require(_0x351e('0x7'));var attributes=require(_0x351e('0x8'));module[_0x351e('0x9')]=function(_0x36705e,_0x242f4d){return _0x36705e['define'](_0x351e('0xa'),attributes,{'tableName':_0x351e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 40fd2de..23c1759 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 _0xec38=['Condition,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Condition,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5d02f4,_0x11bad4){var _0x1b8e62=function(_0xc54cb){while(--_0xc54cb){_0x5d02f4['push'](_0x5d02f4['shift']());}};_0x1b8e62(++_0x11bad4);}(_0xec38,0x8a));var _0x8ec3=function(_0x1f3280,_0xec6845){_0x1f3280=_0x1f3280-0x0;var _0x50770f=_0xec38[_0x1f3280];return _0x50770f;};'use strict';var _=require('lodash');var util=require(_0x8ec3('0x0'));var moment=require(_0x8ec3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ec3('0x2'));var db=require(_0x8ec3('0x3'))['db'];var utils=require(_0x8ec3('0x4'));var logger=require(_0x8ec3('0x5'))(_0x8ec3('0x6'));var config=require(_0x8ec3('0x7'));var jayson=require(_0x8ec3('0x8'));var client=jayson[_0x8ec3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6a1e,_0x4933a2,_0x3c04e1){return new BPromise(function(_0x24adc5,_0x488424){return client['request'](_0x5d6a1e,_0x3c04e1)['then'](function(_0x2cd462){logger[_0x8ec3('0xa')](_0x8ec3('0xb'),_0x4933a2,_0x8ec3('0xc'));logger[_0x8ec3('0xd')](_0x8ec3('0xe'),_0x4933a2,_0x8ec3('0xc'),JSON['stringify'](_0x2cd462));if(_0x2cd462[_0x8ec3('0xf')]){if(_0x2cd462['error'][_0x8ec3('0x10')]===0x1f4){logger[_0x8ec3('0xf')](_0x8ec3('0xb'),_0x4933a2,_0x2cd462[_0x8ec3('0xf')]['message']);return _0x488424(_0x2cd462[_0x8ec3('0xf')]['message']);}logger[_0x8ec3('0xf')]('Condition,\x20%s,\x20%s',_0x4933a2,_0x2cd462[_0x8ec3('0xf')][_0x8ec3('0x11')]);return _0x24adc5(_0x2cd462[_0x8ec3('0xf')][_0x8ec3('0x11')]);}else{logger[_0x8ec3('0xa')](_0x8ec3('0xb'),_0x4933a2,'request\x20sent');_0x24adc5(_0x2cd462[_0x8ec3('0x12')][_0x8ec3('0x11')]);}})['catch'](function(_0x352a71){logger[_0x8ec3('0xf')](_0x8ec3('0xb'),_0x4933a2,_0x352a71);_0x488424(_0x352a71);});});} \ No newline at end of file +var _0xe7c8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0xbc8873,_0x160489){var _0x5289fd=function(_0x35583f){while(--_0x35583f){_0xbc8873['push'](_0xbc8873['shift']());}};_0x5289fd(++_0x160489);}(_0xe7c8,0xd6));var _0x8e7c=function(_0xbd18d4,_0x112df4){_0xbd18d4=_0xbd18d4-0x0;var _0xec2e4a=_0xe7c8[_0xbd18d4];return _0xec2e4a;};'use strict';var _=require(_0x8e7c('0x0'));var util=require(_0x8e7c('0x1'));var moment=require(_0x8e7c('0x2'));var BPromise=require(_0x8e7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e7c('0x5'));var logger=require(_0x8e7c('0x6'))(_0x8e7c('0x7'));var config=require(_0x8e7c('0x8'));var jayson=require(_0x8e7c('0x9'));var client=jayson[_0x8e7c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39229e,_0x1e6237,_0x416a2d){return new BPromise(function(_0x1fb5b5,_0x4f3776){return client[_0x8e7c('0xb')](_0x39229e,_0x416a2d)['then'](function(_0x474226){logger[_0x8e7c('0xc')](_0x8e7c('0xd'),_0x1e6237,_0x8e7c('0xe'));logger[_0x8e7c('0xf')](_0x8e7c('0x10'),_0x1e6237,_0x8e7c('0xe'),JSON[_0x8e7c('0x11')](_0x474226));if(_0x474226[_0x8e7c('0x12')]){if(_0x474226[_0x8e7c('0x12')][_0x8e7c('0x13')]===0x1f4){logger['error'](_0x8e7c('0xd'),_0x1e6237,_0x474226[_0x8e7c('0x12')][_0x8e7c('0x14')]);return _0x4f3776(_0x474226[_0x8e7c('0x12')][_0x8e7c('0x14')]);}logger[_0x8e7c('0x12')](_0x8e7c('0xd'),_0x1e6237,_0x474226[_0x8e7c('0x12')][_0x8e7c('0x14')]);return _0x1fb5b5(_0x474226[_0x8e7c('0x12')]['message']);}else{logger[_0x8e7c('0xc')](_0x8e7c('0xd'),_0x1e6237,_0x8e7c('0xe'));_0x1fb5b5(_0x474226[_0x8e7c('0x15')][_0x8e7c('0x14')]);}})['catch'](function(_0x562373){logger[_0x8e7c('0x12')]('Condition,\x20%s,\x20%s',_0x1e6237,_0x562373);_0x4f3776(_0x562373);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 15a60f1..a73943d 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 _0xaee6=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','multer'];(function(_0x4934da,_0x456420){var _0x37ba9e=function(_0x329cff){while(--_0x329cff){_0x4934da['push'](_0x4934da['shift']());}};_0x37ba9e(++_0x456420);}(_0xaee6,0x187));var _0x6aee=function(_0x21144d,_0x7dee0e){_0x21144d=_0x21144d-0x0;var _0x5e1119=_0xaee6[_0x21144d];return _0x5e1119;};'use strict';var multer=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var path=require(_0x6aee('0x2'));var timeout=require(_0x6aee('0x3'));var express=require(_0x6aee('0x4'));var router=express[_0x6aee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6aee('0x6'));var interaction=require(_0x6aee('0x7'));var config=require(_0x6aee('0x8'));var controller=require('./condition.controller');router[_0x6aee('0x9')](_0x6aee('0xa'),auth[_0x6aee('0xb')](),controller[_0x6aee('0xc')]);router[_0x6aee('0xd')](_0x6aee('0xa'),auth[_0x6aee('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x593d=['path','express','fs-extra','../../components/auth/service','./condition.controller','put','isAuthenticated','delete','/:id','destroy','exports'];(function(_0x56ab74,_0x15319b){var _0x349688=function(_0x5957ce){while(--_0x5957ce){_0x56ab74['push'](_0x56ab74['shift']());}};_0x349688(++_0x15319b);}(_0x593d,0x11e));var _0xd593=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x593d[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd593('0x0'));var timeout=require('connect-timeout');var express=require(_0xd593('0x1'));var router=express['Router']();var fs_extra=require(_0xd593('0x2'));var auth=require(_0xd593('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd593('0x4'));router[_0xd593('0x5')]('/:id',auth[_0xd593('0x6')](),controller['update']);router[_0xd593('0x7')](_0xd593('0x8'),auth[_0xd593('0x6')](),controller[_0xd593('0x9')]);module[_0xd593('0xa')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 47d4ff4..a14f379 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 _0xc2c2=['sequelize','exports','name','INTEGER','STRING'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xc2c2,0x1d1));var _0x2c2c=function(_0x1709a6,_0x421a6f){_0x1709a6=_0x1709a6-0x0;var _0x1ab7de=_0xc2c2[_0x1709a6];return _0x1ab7de;};'use strict';var Sequelize=require(_0x2c2c('0x0'));module[_0x2c2c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2c2c('0x2')},'OrderBy':{'type':Sequelize[_0x2c2c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x2c2c('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0xe955=['name','sequelize','exports','STRING'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xe955,0x115));var _0x5e95=function(_0x4fdebe,_0x10f10c){_0x4fdebe=_0x4fdebe-0x0;var _0x5c60bd=_0xe955[_0x4fdebe];return _0x5c60bd;};'use strict';var Sequelize=require(_0x5e95('0x0'));module[_0x5e95('0x1')]={'name':{'type':Sequelize[_0x5e95('0x2')],'allowNull':![],'unique':_0x5e95('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5e95('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6d7a901..570db9e 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 _0x236c=['CmContactHasItem','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','name','send','index','map','ContactItemType','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2c1be4,_0xe6abd6){var _0x1e6b3b=function(_0x3130be){while(--_0x3130be){_0x2c1be4['push'](_0x2c1be4['shift']());}};_0x1e6b3b(++_0xe6abd6);}(_0x236c,0x155));var _0xc236=function(_0x109085,_0x5655ab){_0x109085=_0x109085-0x0;var _0x402668=_0x236c[_0x109085];return _0x402668;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){var _0x17cb3b=_0xf921e6['get']({'plain':!![]});var _0x308cd6=_0xc236('0x26');return db[_0xc236('0x27')][_0xc236('0x25')]({'where':{'type':_0x308cd6,'resourceId':_0x17cb3b['id']}})['then'](function(){return _0xf921e6;});})[_0xc236('0x24')](function(){_0x21fab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ead8,_0x4eace8){return function(_0x36e578){if(!_0x36e578){_0x15ead8['sendStatus'](0x194);}return _0x36e578;};}function handleError(_0x54365,_0x5c79d6){_0x5c79d6=_0x5c79d6||0x1f4;return function(_0x423842){logger[_0xc236('0x28')](_0x423842['stack']);if(_0x423842['name']){delete _0x423842[_0xc236('0x29')];}_0x54365[_0xc236('0x18')](_0x5c79d6)[_0xc236('0x2a')](_0x423842);};}exports[_0xc236('0x2b')]=function(_0x5f3891,_0x4e3262){var _0x28ffa5={},_0x53b767={},_0x2c756f={'count':0x0,'rows':[]};var _0x4ddc87=_[_0xc236('0x2c')](db[_0xc236('0x2d')]['rawAttributes'],function(_0x5a5ec3){return{'name':_0x5a5ec3[_0xc236('0x2e')],'type':_0x5a5ec3[_0xc236('0x2f')][_0xc236('0x30')]};});_0x53b767[_0xc236('0x31')]=_[_0xc236('0x2c')](_0x4ddc87,_0xc236('0x29'));_0x53b767[_0xc236('0x32')]=_[_0xc236('0x33')](_0x5f3891[_0xc236('0x32')]);_0x53b767['filters']=_['intersection'](_0x53b767['model'],_0x53b767[_0xc236('0x32')]);_0x28ffa5[_0xc236('0x34')]=_[_0xc236('0x35')](_0x53b767[_0xc236('0x31')],qs[_0xc236('0x36')](_0x5f3891[_0xc236('0x32')][_0xc236('0x36')]));_0x28ffa5['attributes']=_0x28ffa5[_0xc236('0x34')][_0xc236('0x37')]?_0x28ffa5[_0xc236('0x34')]:_0x53b767['model'];if(!_0x5f3891[_0xc236('0x32')][_0xc236('0x38')](_0xc236('0x39'))){_0x28ffa5[_0xc236('0x3a')]=qs['limit'](_0x5f3891[_0xc236('0x32')][_0xc236('0x3a')]);_0x28ffa5[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x5f3891[_0xc236('0x32')][_0xc236('0x1a')]);}_0x28ffa5[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x5f3891[_0xc236('0x32')][_0xc236('0x3c')]);_0x28ffa5[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_[_0xc236('0x3f')](_0x5f3891[_0xc236('0x32')],_0x53b767[_0xc236('0x3e')]),_0x4ddc87);if(_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]){_0x28ffa5['where']=_['merge'](_0x28ffa5['where'],{'$or':_['map'](_0x4ddc87,function(_0x369a79){if(_0x369a79['type']!==_0xc236('0x41')){var _0x361526={};_0x361526[_0x369a79[_0xc236('0x29')]]={'$like':'%'+_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]+'%'};return _0x361526;}})});}_0x28ffa5=_[_0xc236('0x42')]({},_0x28ffa5,_0x5f3891[_0xc236('0x43')]);var _0x201ba3={'where':_0x28ffa5[_0xc236('0x3d')]};return db[_0xc236('0x2d')][_0xc236('0x1c')](_0x201ba3)[_0xc236('0x24')](function(_0x3b2f2f){_0x2c756f[_0xc236('0x1c')]=_0x3b2f2f;if(_0x5f3891[_0xc236('0x32')]['includeAll']){_0x28ffa5[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x2d')]['findAll'](_0x28ffa5);})[_0xc236('0x24')](function(_0x5b0bc5){_0x2c756f[_0xc236('0x45')]=_0x5b0bc5;return _0x2c756f;})['then'](respondWithFilteredResult(_0x4e3262,_0x28ffa5))[_0xc236('0x46')](handleError(_0x4e3262,null));};exports[_0xc236('0x47')]=function(_0x8d04c9,_0x479e02){var _0x11e3dd={'raw':!![],'where':{'id':_0x8d04c9[_0xc236('0x48')]['id']}},_0x429e08={};_0x429e08['model']=_[_0xc236('0x33')](db[_0xc236('0x2d')][_0xc236('0x49')]);_0x429e08[_0xc236('0x32')]=_[_0xc236('0x33')](_0x8d04c9[_0xc236('0x32')]);_0x429e08['filters']=_[_0xc236('0x35')](_0x429e08['model'],_0x429e08[_0xc236('0x32')]);_0x11e3dd[_0xc236('0x34')]=_[_0xc236('0x35')](_0x429e08[_0xc236('0x31')],qs[_0xc236('0x36')](_0x8d04c9[_0xc236('0x32')][_0xc236('0x36')]));_0x11e3dd['attributes']=_0x11e3dd[_0xc236('0x34')]['length']?_0x11e3dd[_0xc236('0x34')]:_0x429e08[_0xc236('0x31')];if(_0x8d04c9['query'][_0xc236('0x4a')]){_0x11e3dd[_0xc236('0x44')]=[{'all':!![]}];}_0x11e3dd=_[_0xc236('0x42')]({},_0x11e3dd,_0x8d04c9[_0xc236('0x43')]);return db[_0xc236('0x2d')][_0xc236('0x4b')](_0x11e3dd)[_0xc236('0x24')](handleEntityNotFound(_0x479e02,null))['then'](respondWithResult(_0x479e02,null))['catch'](handleError(_0x479e02,null));};exports[_0xc236('0x4c')]=function(_0x2afed2,_0x510f7f){return db[_0xc236('0x2d')][_0xc236('0x4c')](_0x2afed2[_0xc236('0x4d')],{})[_0xc236('0x24')](function(_0x45fa20){var _0x1683f4=_0x2afed2[_0xc236('0x4e')][_0xc236('0x4f')]({'plain':!![]});if(!_0x1683f4)throw new Error(_0xc236('0x50'));if(_0x1683f4['role']===_0xc236('0x4e')){var _0x307663=_0x45fa20[_0xc236('0x4f')]({'plain':!![]});var _0x447a83=_0xc236('0x26');return db[_0xc236('0x51')][_0xc236('0x4b')]({'where':{'name':_0x447a83,'userProfileId':_0x1683f4['userProfileId']},'raw':!![]})[_0xc236('0x24')](function(_0x3788ff){if(_0x3788ff&&_0x3788ff[_0xc236('0x52')]===0x0){return db[_0xc236('0x27')]['create']({'name':_0x307663[_0xc236('0x29')],'resourceId':_0x307663['id'],'type':_0x3788ff[_0xc236('0x29')],'sectionId':_0x3788ff['id']},{})[_0xc236('0x24')](function(){return _0x45fa20;});}else{return _0x45fa20;}})[_0xc236('0x46')](function(_0x9d81c8){logger['error'](_0xc236('0x53'),_0x9d81c8);throw _0x9d81c8;});}return _0x45fa20;})['then'](respondWithResult(_0x510f7f,0xc9))[_0xc236('0x46')](handleError(_0x510f7f,null));};exports[_0xc236('0x23')]=function(_0x3f9e85,_0x15defc){if(_0x3f9e85[_0xc236('0x4d')]['id']){delete _0x3f9e85['body']['id'];}return db['ContactItemType'][_0xc236('0x4b')]({'where':{'id':_0x3f9e85[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x15defc,null))[_0xc236('0x24')](saveUpdates(_0x3f9e85[_0xc236('0x4d')],null))[_0xc236('0x24')](respondWithResult(_0x15defc,null))[_0xc236('0x46')](handleError(_0x15defc,null));};exports[_0xc236('0x25')]=function(_0x24af08,_0x2d27e7){return db['ContactItemType']['find']({'where':{'id':_0x24af08[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x2d27e7,null))[_0xc236('0x24')](db[_0xc236('0x54')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x24af08[_0xc236('0x48')]['id']}}))[_0xc236('0x24')](removeEntity(_0x2d27e7,null))['catch'](handleError(_0x2d27e7,null));}; \ No newline at end of file +var _0x781d=['find','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','get','stack','name','send','index','ContactItemType','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x684eac,_0x27ffe2){var _0x45a326=function(_0x456785){while(--_0x456785){_0x684eac['push'](_0x684eac['shift']());}};_0x45a326(++_0x27ffe2);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){var _0x221f14=_0x31bf57[_0xd781('0x27')]({'plain':!![]});var _0x10940b='ContactItemTypes';return db['UserProfileResource'][_0xd781('0x25')]({'where':{'type':_0x10940b,'resourceId':_0x221f14['id']}})[_0xd781('0x26')](function(){return _0x31bf57;});})[_0xd781('0x26')](function(){_0x101480['status'](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x5a431b,_0x47c609){return function(_0x1e29c8){if(!_0x1e29c8){_0x5a431b['sendStatus'](0x194);}return _0x1e29c8;};}function handleError(_0x3e868,_0x123a6a){_0x123a6a=_0x123a6a||0x1f4;return function(_0x5c3848){logger['error'](_0x5c3848[_0xd781('0x28')]);if(_0x5c3848['name']){delete _0x5c3848[_0xd781('0x29')];}_0x3e868['status'](_0x123a6a)[_0xd781('0x2a')](_0x5c3848);};}exports[_0xd781('0x2b')]=function(_0x556127,_0x54521e){var _0x432d14={},_0x29e81a={},_0x1c7d83={'count':0x0,'rows':[]};var _0x5a389c=_['map'](db[_0xd781('0x2c')][_0xd781('0x2d')],function(_0x36a889){return{'name':_0x36a889['fieldName'],'type':_0x36a889['type'][_0xd781('0x2e')]};});_0x29e81a[_0xd781('0x2f')]=_['map'](_0x5a389c,_0xd781('0x29'));_0x29e81a[_0xd781('0x30')]=_['keys'](_0x556127[_0xd781('0x30')]);_0x29e81a[_0xd781('0x31')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],_0x29e81a['query']);_0x432d14[_0xd781('0x33')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x556127['query'][_0xd781('0x34')]));_0x432d14[_0xd781('0x33')]=_0x432d14['attributes'][_0xd781('0x35')]?_0x432d14['attributes']:_0x29e81a[_0xd781('0x2f')];if(!_0x556127[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x36'))){_0x432d14[_0xd781('0x1e')]=qs['limit'](_0x556127[_0xd781('0x30')]['limit']);_0x432d14[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x556127['query'][_0xd781('0x1c')]);}_0x432d14[_0xd781('0x37')]=qs['sort'](_0x556127[_0xd781('0x30')][_0xd781('0x38')]);_0x432d14[_0xd781('0x39')]=qs['filters'](_[_0xd781('0x3a')](_0x556127[_0xd781('0x30')],_0x29e81a[_0xd781('0x31')]),_0x5a389c);if(_0x556127[_0xd781('0x30')][_0xd781('0x3b')]){_0x432d14[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x432d14[_0xd781('0x39')],{'$or':_[_0xd781('0x3d')](_0x5a389c,function(_0x5c6026){if(_0x5c6026[_0xd781('0x3e')]!=='VIRTUAL'){var _0x2504ac={};_0x2504ac[_0x5c6026[_0xd781('0x29')]]={'$like':'%'+_0x556127['query'][_0xd781('0x3b')]+'%'};return _0x2504ac;}})});}_0x432d14=_[_0xd781('0x3c')]({},_0x432d14,_0x556127[_0xd781('0x3f')]);var _0x402c9c={'where':_0x432d14['where']};return db[_0xd781('0x2c')]['count'](_0x402c9c)[_0xd781('0x26')](function(_0xcdaacf){_0x1c7d83['count']=_0xcdaacf;if(_0x556127['query'][_0xd781('0x40')]){_0x432d14[_0xd781('0x41')]=[{'all':!![]}];}return db[_0xd781('0x2c')][_0xd781('0x42')](_0x432d14);})['then'](function(_0x46e7f6){_0x1c7d83[_0xd781('0x43')]=_0x46e7f6;return _0x1c7d83;})['then'](respondWithFilteredResult(_0x54521e,_0x432d14))['catch'](handleError(_0x54521e,null));};exports[_0xd781('0x44')]=function(_0x1d901e,_0xaa552){var _0x4e2eea={'raw':!![],'where':{'id':_0x1d901e[_0xd781('0x45')]['id']}},_0x594f85={};_0x594f85[_0xd781('0x2f')]=_[_0xd781('0x46')](db[_0xd781('0x2c')][_0xd781('0x2d')]);_0x594f85[_0xd781('0x30')]=_['keys'](_0x1d901e['query']);_0x594f85[_0xd781('0x31')]=_[_0xd781('0x32')](_0x594f85[_0xd781('0x2f')],_0x594f85[_0xd781('0x30')]);_0x4e2eea[_0xd781('0x33')]=_['intersection'](_0x594f85[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x1d901e[_0xd781('0x30')]['fields']));_0x4e2eea[_0xd781('0x33')]=_0x4e2eea[_0xd781('0x33')][_0xd781('0x35')]?_0x4e2eea['attributes']:_0x594f85[_0xd781('0x2f')];if(_0x1d901e[_0xd781('0x30')]['includeAll']){_0x4e2eea['include']=[{'all':!![]}];}_0x4e2eea=_[_0xd781('0x3c')]({},_0x4e2eea,_0x1d901e[_0xd781('0x3f')]);return db[_0xd781('0x2c')]['find'](_0x4e2eea)[_0xd781('0x26')](handleEntityNotFound(_0xaa552,null))[_0xd781('0x26')](respondWithResult(_0xaa552,null))[_0xd781('0x47')](handleError(_0xaa552,null));};exports[_0xd781('0x48')]=function(_0x336d30,_0x3828ad){return db[_0xd781('0x2c')]['create'](_0x336d30[_0xd781('0x49')],{})[_0xd781('0x26')](function(_0x1d54bd){var _0x4c7cb6=_0x336d30[_0xd781('0x4a')][_0xd781('0x27')]({'plain':!![]});if(!_0x4c7cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7cb6[_0xd781('0x4b')]===_0xd781('0x4a')){var _0x41caac=_0x1d54bd[_0xd781('0x27')]({'plain':!![]});var _0x42a2f9='ContactItemTypes';return db[_0xd781('0x4c')]['find']({'where':{'name':_0x42a2f9,'userProfileId':_0x4c7cb6[_0xd781('0x4d')]},'raw':!![]})['then'](function(_0x2ce1f6){if(_0x2ce1f6&&_0x2ce1f6[_0xd781('0x4e')]===0x0){return db['UserProfileResource'][_0xd781('0x48')]({'name':_0x41caac['name'],'resourceId':_0x41caac['id'],'type':_0x2ce1f6['name'],'sectionId':_0x2ce1f6['id']},{})['then'](function(){return _0x1d54bd;});}else{return _0x1d54bd;}})[_0xd781('0x47')](function(_0x174fcd){logger['error'](_0xd781('0x4f'),_0x174fcd);throw _0x174fcd;});}return _0x1d54bd;})['then'](respondWithResult(_0x3828ad,0xc9))[_0xd781('0x47')](handleError(_0x3828ad,null));};exports[_0xd781('0x24')]=function(_0x39d47d,_0x19a6c2){if(_0x39d47d['body']['id']){delete _0x39d47d[_0xd781('0x49')]['id'];}return db['ContactItemType'][_0xd781('0x50')]({'where':{'id':_0x39d47d['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x19a6c2,null))[_0xd781('0x26')](saveUpdates(_0x39d47d['body'],null))[_0xd781('0x26')](respondWithResult(_0x19a6c2,null))[_0xd781('0x47')](handleError(_0x19a6c2,null));};exports[_0xd781('0x25')]=function(_0x32fd9f,_0xfc466c){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x32fd9f['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0xfc466c,null))[_0xd781('0x26')](db[_0xd781('0x51')][_0xd781('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x32fd9f['params']['id']}}))[_0xd781('0x26')](removeEntity(_0xfc466c,null))['catch'](handleError(_0xfc466c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 67bfd14..0ad2751 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 _0xd74c=['rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','api','moment','bluebird','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xd74c,0xd7));var _0xcd74=function(_0x563723,_0x5972cf){_0x563723=_0x563723-0x0;var _0x213e62=_0xd74c[_0x563723];return _0x213e62;};'use strict';var _=require(_0xcd74('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcd74('0x1'));var moment=require(_0xcd74('0x2'));var BPromise=require(_0xcd74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd74('0x4'));var rimraf=require(_0xcd74('0x5'));var config=require(_0xcd74('0x6'));var attributes=require(_0xcd74('0x7'));module['exports']=function(_0x3a4f42,_0x238048){return _0x3a4f42['define'](_0xcd74('0x8'),attributes,{'tableName':_0xcd74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8767=['exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','path','../../config/environment','./contactItemType.attributes'];(function(_0x1fe11b,_0x141289){var _0x2070c4=function(_0x5daa9f){while(--_0x5daa9f){_0x1fe11b['push'](_0x1fe11b['shift']());}};_0x2070c4(++_0x141289);}(_0x8767,0x1d8));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7876('0x0'));var util=require(_0x7876('0x1'));var logger=require(_0x7876('0x2'))(_0x7876('0x3'));var moment=require(_0x7876('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7876('0x5'));var rimraf=require('rimraf');var config=require(_0x7876('0x6'));var attributes=require(_0x7876('0x7'));module[_0x7876('0x8')]=function(_0xaac6ec,_0xe05e48){return _0xaac6ec[_0x7876('0x9')](_0x7876('0xa'),attributes,{'tableName':_0x7876('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 79e5e21..950d890 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 _0xe845=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe845,0x101));var _0x5e84=function(_0x3e7fc1,_0x4d44cc){_0x3e7fc1=_0x3e7fc1-0x0;var _0x35ce7a=_0xe845[_0x3e7fc1];return _0x35ce7a;};'use strict';var _=require('lodash');var util=require(_0x5e84('0x0'));var moment=require('moment');var BPromise=require(_0x5e84('0x1'));var rs=require(_0x5e84('0x2'));var fs=require('fs');var Redis=require(_0x5e84('0x3'));var db=require(_0x5e84('0x4'))['db'];var utils=require(_0x5e84('0x5'));var logger=require('../../config/logger')(_0x5e84('0x6'));var config=require('../../config/environment');var jayson=require(_0x5e84('0x7'));var client=jayson[_0x5e84('0x8')][_0x5e84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdb13c5,_0x1f3aed,_0x5bc887){return new BPromise(function(_0x1a2437,_0x319cb3){return client[_0x5e84('0xa')](_0xdb13c5,_0x5bc887)[_0x5e84('0xb')](function(_0x38c274){logger[_0x5e84('0xc')]('ContactItemType,\x20%s,\x20%s',_0x1f3aed,_0x5e84('0xd'));logger[_0x5e84('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1f3aed,_0x5e84('0xd'),JSON[_0x5e84('0xf')](_0x38c274));if(_0x38c274[_0x5e84('0x10')]){if(_0x38c274[_0x5e84('0x10')][_0x5e84('0x11')]===0x1f4){logger[_0x5e84('0x10')](_0x5e84('0x12'),_0x1f3aed,_0x38c274[_0x5e84('0x10')]['message']);return _0x319cb3(_0x38c274['error'][_0x5e84('0x13')]);}logger[_0x5e84('0x10')](_0x5e84('0x12'),_0x1f3aed,_0x38c274[_0x5e84('0x10')][_0x5e84('0x13')]);return _0x1a2437(_0x38c274[_0x5e84('0x10')][_0x5e84('0x13')]);}else{logger[_0x5e84('0xc')](_0x5e84('0x12'),_0x1f3aed,_0x5e84('0xd'));_0x1a2437(_0x38c274[_0x5e84('0x14')][_0x5e84('0x13')]);}})[_0x5e84('0x15')](function(_0x41b937){logger[_0x5e84('0x10')]('ContactItemType,\x20%s,\x20%s',_0x1f3aed,_0x41b937);_0x319cb3(_0x41b937);});});} \ No newline at end of file +var _0x3095=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x3095,0x158));var _0x5309=function(_0x4c062e,_0x20f461){_0x4c062e=_0x4c062e-0x0;var _0x16e86e=_0x3095[_0x4c062e];return _0x16e86e;};'use strict';var _=require(_0x5309('0x0'));var util=require(_0x5309('0x1'));var moment=require(_0x5309('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5309('0x3'));var db=require(_0x5309('0x4'))['db'];var utils=require(_0x5309('0x5'));var logger=require(_0x5309('0x6'))(_0x5309('0x7'));var config=require(_0x5309('0x8'));var jayson=require(_0x5309('0x9'));var client=jayson[_0x5309('0xa')][_0x5309('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cc90d,_0x26c4eb,_0x40c392){return new BPromise(function(_0x4e522f,_0x384b6e){return client[_0x5309('0xc')](_0x3cc90d,_0x40c392)[_0x5309('0xd')](function(_0x36bbf4){logger['info'](_0x5309('0xe'),_0x26c4eb,_0x5309('0xf'));logger[_0x5309('0x10')](_0x5309('0x11'),_0x26c4eb,_0x5309('0xf'),JSON[_0x5309('0x12')](_0x36bbf4));if(_0x36bbf4[_0x5309('0x13')]){if(_0x36bbf4[_0x5309('0x13')][_0x5309('0x14')]===0x1f4){logger[_0x5309('0x13')](_0x5309('0xe'),_0x26c4eb,_0x36bbf4['error']['message']);return _0x384b6e(_0x36bbf4[_0x5309('0x13')]['message']);}logger['error'](_0x5309('0xe'),_0x26c4eb,_0x36bbf4[_0x5309('0x13')][_0x5309('0x15')]);return _0x4e522f(_0x36bbf4[_0x5309('0x13')][_0x5309('0x15')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x26c4eb,_0x5309('0xf'));_0x4e522f(_0x36bbf4[_0x5309('0x16')][_0x5309('0x15')]);}})[_0x5309('0x17')](function(_0x145451){logger['error']('ContactItemType,\x20%s,\x20%s',_0x26c4eb,_0x145451);_0x384b6e(_0x145451);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 31db75b..ee84910 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 _0x8453=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2b3939,_0x499ea0){var _0x2d20c3=function(_0x475290){while(--_0x475290){_0x2b3939['push'](_0x2b3939['shift']());}};_0x2d20c3(++_0x499ea0);}(_0x8453,0x1b9));var _0x3845=function(_0x241290,_0x305d76){_0x241290=_0x241290-0x0;var _0x1f76b9=_0x8453[_0x241290];return _0x1f76b9;};'use strict';var multer=require(_0x3845('0x0'));var util=require('util');var path=require(_0x3845('0x1'));var timeout=require(_0x3845('0x2'));var express=require(_0x3845('0x3'));var router=express[_0x3845('0x4')]();var fs_extra=require(_0x3845('0x5'));var auth=require(_0x3845('0x6'));var interaction=require(_0x3845('0x7'));var config=require(_0x3845('0x8'));var controller=require(_0x3845('0x9'));router[_0x3845('0xa')]('/',auth[_0x3845('0xb')](),controller[_0x3845('0xc')]);router[_0x3845('0xa')](_0x3845('0xd'),auth[_0x3845('0xb')](),controller[_0x3845('0xe')]);router[_0x3845('0xf')]('/',auth['isAuthenticated'](),controller[_0x3845('0x10')]);router[_0x3845('0x11')](_0x3845('0xd'),auth[_0x3845('0xb')](),controller[_0x3845('0x12')]);router['delete']('/:id',auth[_0x3845('0xb')](),controller['destroy']);module[_0x3845('0x13')]=router; \ No newline at end of file +var _0x415c=['show','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','index','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x415c,0xb1));var _0xc415=function(_0x3723c7,_0x54fede){_0x3723c7=_0x3723c7-0x0;var _0x414b4d=_0x415c[_0x3723c7];return _0x414b4d;};'use strict';var multer=require(_0xc415('0x0'));var util=require('util');var path=require(_0xc415('0x1'));var timeout=require(_0xc415('0x2'));var express=require(_0xc415('0x3'));var router=express['Router']();var fs_extra=require(_0xc415('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc415('0x5'));var config=require(_0xc415('0x6'));var controller=require(_0xc415('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc415('0x8')]);router['get']('/:id',auth[_0xc415('0x9')](),controller[_0xc415('0xa')]);router['post']('/',auth[_0xc415('0x9')](),controller[_0xc415('0xb')]);router[_0xc415('0xc')]('/:id',auth[_0xc415('0x9')](),controller['update']);router[_0xc415('0xd')](_0xc415('0xe'),auth[_0xc415('0x9')](),controller[_0xc415('0xf')]);module[_0xc415('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 0156d9e..857a400 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x51a393,_0x593fff){var _0x3fb3d7=function(_0x3e1f36){while(--_0x3e1f36){_0x51a393['push'](_0x51a393['shift']());}};_0x3fb3d7(++_0x593fff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x242cdc,_0x5d7636){var _0x64c44a=function(_0x55ef09){while(--_0x55ef09){_0x242cdc['push'](_0x242cdc['shift']());}};_0x64c44a(++_0x5d7636);}(_0x2032,0xd9));var _0x2203=function(_0x56a126,_0x53886d){_0x56a126=_0x56a126-0x0;var _0x20fa40=_0x2032[_0x56a126];return _0x20fa40;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3cb8aa0..c2d71a1 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 _0x9cb2=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','find','omit','createdAt','updatedAt','destroy','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x355bb9,_0x1f5e7d){var _0x4679ec=function(_0x227672){while(--_0x227672){_0x355bb9['push'](_0x355bb9['shift']());}};_0x4679ec(++_0x1f5e7d);}(_0x9cb2,0x113));var _0x29cb=function(_0x1c58fa,_0x182728){_0x1c58fa=_0x1c58fa-0x0;var _0x4f88ec=_0x9cb2[_0x1c58fa];return _0x4f88ec;};'use strict';var emlformat=require(_0x29cb('0x0'));var rimraf=require(_0x29cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x29cb('0x2'));var moment=require(_0x29cb('0x3'));var BPromise=require(_0x29cb('0x4'));var Mustache=require(_0x29cb('0x5'));var util=require(_0x29cb('0x6'));var path=require(_0x29cb('0x7'));var sox=require('sox');var csv=require(_0x29cb('0x8'));var ejs=require(_0x29cb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29cb('0xa'));var squel=require(_0x29cb('0xb'));var crypto=require(_0x29cb('0xc'));var jsforce=require(_0x29cb('0xd'));var deskjs=require(_0x29cb('0xe'));var toCsv=require(_0x29cb('0x8'));var querystring=require('querystring');var Papa=require(_0x29cb('0xf'));var Redis=require('ioredis');var authService=require(_0x29cb('0x10'));var qs=require(_0x29cb('0x11'));var as=require(_0x29cb('0x12'));var hardwareService=require(_0x29cb('0x13'));var logger=require(_0x29cb('0x14'))(_0x29cb('0x15'));var utils=require(_0x29cb('0x16'));var config=require(_0x29cb('0x17'));var licenseUtil=require(_0x29cb('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x29cb('0x19')](config[_0x29cb('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x29cb('0x1b'))(new Redis(config[_0x29cb('0x1a')]));require(_0x29cb('0x1c'))[_0x29cb('0x1d')](socket);function respondWithStatusCode(_0x3212da,_0x2e835f){_0x2e835f=_0x2e835f||0xcc;return function(_0x22435b){if(_0x22435b){return _0x3212da[_0x29cb('0x1e')](_0x2e835f);}return _0x3212da[_0x29cb('0x1f')](_0x2e835f)[_0x29cb('0x20')]();};}function respondWithResult(_0x3f789d,_0x2a69f4){_0x2a69f4=_0x2a69f4||0xc8;return function(_0x426006){if(_0x426006){return _0x3f789d[_0x29cb('0x1f')](_0x2a69f4)[_0x29cb('0x21')](_0x426006);}};}function respondWithFilteredResult(_0x1f8691,_0x5316a6){return function(_0x43c633){if(_0x43c633){var _0xb77137=typeof _0x5316a6[_0x29cb('0x22')]===_0x29cb('0x23')&&typeof _0x5316a6[_0x29cb('0x24')]===_0x29cb('0x23');var _0xbaa0b1=_0x43c633[_0x29cb('0x25')];var _0x10868b=_0xb77137?0x0:_0x5316a6[_0x29cb('0x22')];var _0x5b54c8=_0xb77137?_0x43c633['count']:_0x5316a6[_0x29cb('0x22')]+_0x5316a6['limit'];var _0x38f203;if(_0x5b54c8>=_0xbaa0b1){_0x5b54c8=_0xbaa0b1;_0x38f203=0xc8;}else{_0x38f203=0xce;}_0x1f8691[_0x29cb('0x1f')](_0x38f203);return _0x1f8691[_0x29cb('0x26')]('Content-Range',_0x10868b+'-'+_0x5b54c8+'/'+_0xbaa0b1)[_0x29cb('0x21')](_0x43c633);}return null;};}function patchUpdates(_0x3c4039){return function(_0x24bdc0){try{jsonpatch[_0x29cb('0x27')](_0x24bdc0,_0x3c4039,!![]);}catch(_0x478778){return BPromise[_0x29cb('0x28')](_0x478778);}return _0x24bdc0[_0x29cb('0x29')]();};}function saveUpdates(_0x4b5244,_0x3f0689){return function(_0x5710d4){if(_0x5710d4){return _0x5710d4[_0x29cb('0x2a')](_0x4b5244)[_0x29cb('0x2b')](function(_0x1d43e7){return _0x1d43e7;});}return null;};}function removeEntity(_0x4e2882,_0x4fc08e){return function(_0x5c78c9){if(_0x5c78c9){return _0x5c78c9['destroy']()[_0x29cb('0x2b')](function(){var _0x529e20=_0x5c78c9[_0x29cb('0x2c')]({'plain':!![]});var _0x99d293=_0x29cb('0x2d');return db[_0x29cb('0x2e')]['destroy']({'where':{'type':_0x99d293,'resourceId':_0x529e20['id']}})[_0x29cb('0x2b')](function(){return _0x5c78c9;});})[_0x29cb('0x2b')](function(){_0x4e2882[_0x29cb('0x1f')](0xcc)[_0x29cb('0x20')]();});}};}function handleEntityNotFound(_0x18f1af,_0x3509a0){return function(_0x56f8c1){if(!_0x56f8c1){_0x18f1af[_0x29cb('0x1e')](0x194);}return _0x56f8c1;};}function handleError(_0x3464e8,_0x52d9ba){_0x52d9ba=_0x52d9ba||0x1f4;return function(_0x528d16){logger['error'](_0x528d16['stack']);if(_0x528d16['name']){delete _0x528d16[_0x29cb('0x2f')];}_0x3464e8[_0x29cb('0x1f')](_0x52d9ba)['send'](_0x528d16);};}exports['index']=function(_0x2c6169,_0x104472){var _0x5cdf9f={},_0xd9ec8e={},_0x175b50={'count':0x0,'rows':[]};var _0x250571=_[_0x29cb('0x30')](db[_0x29cb('0x31')][_0x29cb('0x32')],function(_0x49c7c6){return{'name':_0x49c7c6[_0x29cb('0x33')],'type':_0x49c7c6[_0x29cb('0x34')][_0x29cb('0x35')]};});_0xd9ec8e[_0x29cb('0x36')]=_['map'](_0x250571,_0x29cb('0x2f'));_0xd9ec8e[_0x29cb('0x37')]=_[_0x29cb('0x38')](_0x2c6169[_0x29cb('0x37')]);_0xd9ec8e[_0x29cb('0x39')]=_[_0x29cb('0x3a')](_0xd9ec8e[_0x29cb('0x36')],_0xd9ec8e[_0x29cb('0x37')]);_0x5cdf9f[_0x29cb('0x3b')]=_[_0x29cb('0x3a')](_0xd9ec8e[_0x29cb('0x36')],qs['fields'](_0x2c6169['query']['fields']));_0x5cdf9f[_0x29cb('0x3b')]=_0x5cdf9f['attributes'][_0x29cb('0x3c')]?_0x5cdf9f[_0x29cb('0x3b')]:_0xd9ec8e[_0x29cb('0x36')];if(!_0x2c6169[_0x29cb('0x37')][_0x29cb('0x3d')](_0x29cb('0x3e'))){_0x5cdf9f['limit']=qs[_0x29cb('0x24')](_0x2c6169[_0x29cb('0x37')][_0x29cb('0x24')]);_0x5cdf9f[_0x29cb('0x22')]=qs[_0x29cb('0x22')](_0x2c6169[_0x29cb('0x37')][_0x29cb('0x22')]);}_0x5cdf9f[_0x29cb('0x3f')]=qs[_0x29cb('0x40')](_0x2c6169[_0x29cb('0x37')][_0x29cb('0x40')]);_0x5cdf9f[_0x29cb('0x41')]=qs['filters'](_[_0x29cb('0x42')](_0x2c6169[_0x29cb('0x37')],_0xd9ec8e[_0x29cb('0x39')]),_0x250571);if(_0x2c6169[_0x29cb('0x37')][_0x29cb('0x43')]){_0x5cdf9f[_0x29cb('0x41')]=_[_0x29cb('0x44')](_0x5cdf9f[_0x29cb('0x41')],{'$or':_[_0x29cb('0x30')](_0x250571,function(_0x375ca4){if(_0x375ca4[_0x29cb('0x34')]!==_0x29cb('0x45')){var _0x1eb400={};_0x1eb400[_0x375ca4['name']]={'$like':'%'+_0x2c6169[_0x29cb('0x37')][_0x29cb('0x43')]+'%'};return _0x1eb400;}})});}_0x5cdf9f=_[_0x29cb('0x44')]({},_0x5cdf9f,_0x2c6169[_0x29cb('0x46')]);var _0x511bf6={'where':_0x5cdf9f['where']};return db['Dashboard']['count'](_0x511bf6)['then'](function(_0x59dccb){_0x175b50['count']=_0x59dccb;if(_0x2c6169[_0x29cb('0x37')][_0x29cb('0x47')]){_0x5cdf9f[_0x29cb('0x48')]=[{'all':!![]}];}return db[_0x29cb('0x31')][_0x29cb('0x49')](_0x5cdf9f);})[_0x29cb('0x2b')](function(_0x1f1f54){_0x175b50['rows']=_0x1f1f54;return _0x175b50;})[_0x29cb('0x2b')](respondWithFilteredResult(_0x104472,_0x5cdf9f))[_0x29cb('0x4a')](handleError(_0x104472,null));};exports[_0x29cb('0x4b')]=function(_0x2158f7,_0xa9161f){var _0x5c119c={'raw':![],'where':{'id':_0x2158f7[_0x29cb('0x4c')]['id']}},_0xc5dd02={};_0xc5dd02['model']=_['keys'](db[_0x29cb('0x31')]['rawAttributes']);_0xc5dd02[_0x29cb('0x37')]=_[_0x29cb('0x38')](_0x2158f7[_0x29cb('0x37')]);_0xc5dd02[_0x29cb('0x39')]=_[_0x29cb('0x3a')](_0xc5dd02[_0x29cb('0x36')],_0xc5dd02[_0x29cb('0x37')]);_0x5c119c[_0x29cb('0x3b')]=_[_0x29cb('0x3a')](_0xc5dd02[_0x29cb('0x36')],qs[_0x29cb('0x4d')](_0x2158f7['query']['fields']));_0x5c119c[_0x29cb('0x3b')]=_0x5c119c[_0x29cb('0x3b')][_0x29cb('0x3c')]?_0x5c119c[_0x29cb('0x3b')]:_0xc5dd02[_0x29cb('0x36')];if(_0x2158f7[_0x29cb('0x37')]['includeAll']){_0x5c119c['include']=[{'all':!![]}];}_0x5c119c=_[_0x29cb('0x44')]({},_0x5c119c,_0x2158f7['options']);return db[_0x29cb('0x31')]['find'](_0x5c119c)[_0x29cb('0x2b')](handleEntityNotFound(_0xa9161f,null))[_0x29cb('0x2b')](respondWithResult(_0xa9161f,null))[_0x29cb('0x4a')](handleError(_0xa9161f,null));};exports[_0x29cb('0x4e')]=function(_0x43aa2c,_0x365674){return db[_0x29cb('0x31')][_0x29cb('0x4e')](_0x43aa2c[_0x29cb('0x4f')],{})[_0x29cb('0x2b')](function(_0x2e2b50){var _0x4ae48d=_0x43aa2c[_0x29cb('0x50')]['get']({'plain':!![]});if(!_0x4ae48d)throw new Error(_0x29cb('0x51'));if(_0x4ae48d[_0x29cb('0x52')]===_0x29cb('0x50')){var _0x1fb636=_0x2e2b50[_0x29cb('0x2c')]({'plain':!![]});var _0x5af0b4='CustomDashboards';return db[_0x29cb('0x53')]['find']({'where':{'name':_0x5af0b4,'userProfileId':_0x4ae48d[_0x29cb('0x54')]},'raw':!![]})[_0x29cb('0x2b')](function(_0x3bb921){if(_0x3bb921&&_0x3bb921[_0x29cb('0x55')]===0x0){return db[_0x29cb('0x2e')][_0x29cb('0x4e')]({'name':_0x1fb636['name'],'resourceId':_0x1fb636['id'],'type':_0x3bb921[_0x29cb('0x2f')],'sectionId':_0x3bb921['id']},{})[_0x29cb('0x2b')](function(){return _0x2e2b50;});}else{return _0x2e2b50;}})[_0x29cb('0x4a')](function(_0xfad9b){logger[_0x29cb('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfad9b);throw _0xfad9b;});}return _0x2e2b50;})[_0x29cb('0x2b')](respondWithResult(_0x365674,0xc9))[_0x29cb('0x4a')](handleError(_0x365674,null));};exports['clone']=function(_0x81074d,_0x2d3507){var _0x25ba0b={'where':{'id':_0x81074d[_0x29cb('0x4c')]['id']}},_0x36e784={};_0x36e784[_0x29cb('0x36')]=_[_0x29cb('0x38')](db['Dashboard'][_0x29cb('0x32')]);_0x25ba0b[_0x29cb('0x3b')]=_[_0x29cb('0x3a')](_0x36e784[_0x29cb('0x36')],qs['fields'](_0x81074d['query'][_0x29cb('0x4d')]));_0x25ba0b['attributes']=_0x25ba0b['attributes']['length']?_0x25ba0b['attributes']:_0x36e784['model'];if(_0x81074d[_0x29cb('0x37')][_0x29cb('0x47')]){_0x25ba0b['include']=[{'all':!![]}];}_0x25ba0b=_[_0x29cb('0x44')]({},_0x25ba0b,_0x81074d[_0x29cb('0x46')]);return db[_0x29cb('0x31')][_0x29cb('0x57')](_0x25ba0b)[_0x29cb('0x2b')](handleEntityNotFound(_0x2d3507,null))['then'](function(_0x36804e){if(_0x36804e){var _0x56b7a0=_0x36804e[_0x29cb('0x2c')]({'plain':!![]});_0x56b7a0=qs[_0x29cb('0x58')](_0x56b7a0,['id',_0x29cb('0x59'),_0x29cb('0x5a')]);_0x81074d['body']=_[_0x29cb('0x58')](_0x81074d[_0x29cb('0x4f')],['id',_0x29cb('0x59'),_0x29cb('0x5a')]);return db[_0x29cb('0x31')][_0x29cb('0x4e')](_[_0x29cb('0x44')](_0x56b7a0,_0x81074d[_0x29cb('0x4f')]),{'include':_0x81074d[_0x29cb('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x29cb('0x2b')](function(_0x19c34d){var _0x59afa7=_0x81074d[_0x29cb('0x50')][_0x29cb('0x2c')]({'plain':!![]});if(!_0x59afa7)throw new Error(_0x29cb('0x51'));if(_0x59afa7[_0x29cb('0x52')]===_0x29cb('0x50')){var _0x571c10=_0x19c34d[_0x29cb('0x2c')]({'plain':!![]});var _0x3193b8=_0x29cb('0x2d');return db[_0x29cb('0x53')][_0x29cb('0x57')]({'where':{'name':_0x3193b8,'userProfileId':_0x59afa7['userProfileId']},'raw':!![]})[_0x29cb('0x2b')](function(_0x414df3){if(_0x414df3&&_0x414df3['autoAssociation']===0x0){return db[_0x29cb('0x2e')][_0x29cb('0x4e')]({'name':_0x571c10[_0x29cb('0x2f')],'resourceId':_0x571c10['id'],'type':_0x414df3[_0x29cb('0x2f')],'sectionId':_0x414df3['id']},{})['then'](function(){return _0x19c34d;});}else{return _0x19c34d;}})[_0x29cb('0x4a')](function(_0x9b224e){logger[_0x29cb('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b224e);throw _0x9b224e;});}return _0x19c34d;});}})[_0x29cb('0x2b')](respondWithResult(_0x2d3507,0xc9))[_0x29cb('0x4a')](handleError(_0x2d3507,null));};exports[_0x29cb('0x2a')]=function(_0x151604,_0x495e4a){if(_0x151604['body']['id']){delete _0x151604[_0x29cb('0x4f')]['id'];}return db[_0x29cb('0x31')][_0x29cb('0x57')]({'where':{'id':_0x151604['params']['id']}})[_0x29cb('0x2b')](handleEntityNotFound(_0x495e4a,null))[_0x29cb('0x2b')](saveUpdates(_0x151604['body'],null))[_0x29cb('0x2b')](respondWithResult(_0x495e4a,null))[_0x29cb('0x4a')](handleError(_0x495e4a,null));};exports[_0x29cb('0x5b')]=function(_0x15f0b2,_0x325edb){return db[_0x29cb('0x31')][_0x29cb('0x57')]({'where':{'id':_0x15f0b2[_0x29cb('0x4c')]['id']}})[_0x29cb('0x2b')](handleEntityNotFound(_0x325edb,null))[_0x29cb('0x2b')](removeEntity(_0x325edb,null))[_0x29cb('0x4a')](handleError(_0x325edb,null));};function widgetAttributes(_0x18d17e){try{switch(_0x18d17e[_0x29cb('0x34')]){case _0x29cb('0x5c'):return[{'name':_0x29cb('0x5d'),'value':_0x18d17e[_0x29cb('0x5d')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0]['value']:undefined)||_0x29cb('0x5f')}];case _0x29cb('0x60'):return[{'name':'attrPath','value':_0x18d17e[_0x29cb('0x61')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0][_0x29cb('0x62')]:undefined)||''}];case'clock':return[{'name':_0x29cb('0x63'),'value':_0x18d17e['attrHourFormat']||(_0x18d17e['attrs']&&_0x18d17e[_0x29cb('0x5e')][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0][_0x29cb('0x62')]:undefined)||'HH:mm:ss'},{'name':_0x29cb('0x64'),'value':_0x18d17e[_0x29cb('0x64')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x1]?_0x18d17e[_0x29cb('0x5e')][0x1][_0x29cb('0x62')]:undefined)||_0x29cb('0x65')},{'name':_0x29cb('0x66'),'value':_0x18d17e[_0x29cb('0x66')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x2]?_0x18d17e[_0x29cb('0x5e')][0x2][_0x29cb('0x62')]:undefined)||0xc}];case'counter':return[{'name':_0x29cb('0x67'),'value':_0x18d17e['attrMetric']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0][_0x29cb('0x62')]:undefined)||_0x29cb('0x68')},{'name':_0x29cb('0x69'),'value':_0x18d17e['attrVoiceQueues']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x1]?_0x18d17e['attrs'][0x1][_0x29cb('0x62')]:undefined)||[]},{'name':_0x29cb('0x66'),'value':_0x18d17e['attrFontSize']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x2]?_0x18d17e['attrs'][0x2][_0x29cb('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0x18d17e[_0x29cb('0x6a')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x3]?_0x18d17e[_0x29cb('0x5e')][0x3][_0x29cb('0x62')]:undefined)||_0x29cb('0x6b')},{'name':_0x29cb('0x6c'),'value':_0x18d17e[_0x29cb('0x6c')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x4]?_0x18d17e[_0x29cb('0x5e')][0x4][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x6d'),'value':_0x18d17e['attrFaxAccounts']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x5]?_0x18d17e['attrs'][0x5]['value']:undefined)||''},{'name':_0x29cb('0x6e'),'value':_0x18d17e[_0x29cb('0x6e')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x6]?_0x18d17e[_0x29cb('0x5e')][0x6][_0x29cb('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x18d17e[_0x29cb('0x6f')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x7]?_0x18d17e[_0x29cb('0x5e')][0x7][_0x29cb('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x18d17e['attrWhatsappAccounts']||(_0x18d17e['attrs']&&_0x18d17e[_0x29cb('0x5e')][0x8]?_0x18d17e[_0x29cb('0x5e')][0x8][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x70'),'value':_0x18d17e[_0x29cb('0x70')]||(_0x18d17e['attrs']&&_0x18d17e['attrs'][0x9]?_0x18d17e['attrs'][0x9][_0x29cb('0x62')]:undefined)||''}];case _0x29cb('0x71'):case _0x29cb('0x72'):return[{'name':_0x29cb('0x73'),'value':_0x18d17e['attrSerie1']||(_0x18d17e['attrs']&&_0x18d17e['attrs'][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0][_0x29cb('0x62')]:undefined)||'total'},{'name':_0x29cb('0x74'),'value':_0x18d17e[_0x29cb('0x74')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x1]?_0x18d17e[_0x29cb('0x5e')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x18d17e[_0x29cb('0x75')]||(_0x18d17e['attrs']&&_0x18d17e[_0x29cb('0x5e')][0x2]?_0x18d17e[_0x29cb('0x5e')][0x2][_0x29cb('0x62')]:undefined)||null},{'name':_0x29cb('0x69'),'value':_0x18d17e['attrVoiceQueues']||(_0x18d17e['attrs']&&_0x18d17e[_0x29cb('0x5e')][0x3]?_0x18d17e[_0x29cb('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x29cb('0x6a'),'value':_0x18d17e['attrChannel']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x4]?_0x18d17e[_0x29cb('0x5e')][0x4][_0x29cb('0x62')]:undefined)||_0x29cb('0x6b')},{'name':_0x29cb('0x6c'),'value':_0x18d17e[_0x29cb('0x6c')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x5]?_0x18d17e[_0x29cb('0x5e')][0x5][_0x29cb('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x18d17e[_0x29cb('0x6d')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x6]?_0x18d17e[_0x29cb('0x5e')][0x6][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x6e'),'value':_0x18d17e['attrSmsAccounts']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x7]?_0x18d17e[_0x29cb('0x5e')][0x7][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x6f'),'value':_0x18d17e[_0x29cb('0x6f')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x8]?_0x18d17e[_0x29cb('0x5e')][0x8][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x76'),'value':_0x18d17e['attrWhatsappAccounts']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e['attrs'][0x9]?_0x18d17e[_0x29cb('0x5e')][0x9][_0x29cb('0x62')]:undefined)||''},{'name':_0x29cb('0x70'),'value':_0x18d17e[_0x29cb('0x70')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0xa]?_0x18d17e[_0x29cb('0x5e')][0xa]['value']:undefined)||''}];case _0x29cb('0x77'):return[{'name':_0x29cb('0x78'),'type':_0x18d17e[_0x29cb('0x79')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x0]?_0x18d17e[_0x29cb('0x5e')][0x0][_0x29cb('0x34')]:undefined)||null,'value':_0x18d17e[_0x29cb('0x78')]||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x0]?_0x18d17e['attrs'][0x0][_0x29cb('0x62')]:undefined)||null},{'name':_0x29cb('0x7a'),'value':_0x18d17e['attrRefresh']||(_0x18d17e[_0x29cb('0x5e')]&&_0x18d17e[_0x29cb('0x5e')][0x1]?_0x18d17e[_0x29cb('0x5e')][0x1][_0x29cb('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x4a9048){logger[_0x29cb('0x56')](_0x29cb('0x7b'),JSON[_0x29cb('0x7c')](_0x4a9048));return[];}}exports[_0x29cb('0x7d')]=function(_0x1e4e46,_0x198adc,_0x560212){if(_0x1e4e46['body']['id']){delete _0x1e4e46[_0x29cb('0x4f')]['id'];}return db[_0x29cb('0x31')][_0x29cb('0x57')]({'where':{'id':_0x1e4e46[_0x29cb('0x4c')]['id']}})[_0x29cb('0x2b')](handleEntityNotFound(_0x198adc,null))[_0x29cb('0x2b')](function(_0x4f4ebb){if(_0x4f4ebb){_0x1e4e46[_0x29cb('0x4f')][_0x29cb('0x7e')]=_0x4f4ebb['id'];_0x1e4e46['body']['attrs']=widgetAttributes(_0x1e4e46[_0x29cb('0x4f')]);return db['DashboardItem'][_0x29cb('0x4e')](_0x1e4e46[_0x29cb('0x4f')]);}})[_0x29cb('0x2b')](respondWithResult(_0x198adc,null))[_0x29cb('0x4a')](handleError(_0x198adc,null));};exports[_0x29cb('0x7f')]=function(_0x224f62,_0xaf497c,_0x5da404){var _0x2b113f={};var _0xc8eb72={};var _0x321587;var _0xe67fc3;return db[_0x29cb('0x31')][_0x29cb('0x80')]({'where':{'id':_0x224f62[_0x29cb('0x4c')]['id']}})[_0x29cb('0x2b')](handleEntityNotFound(_0xaf497c,null))[_0x29cb('0x2b')](function(_0x3054e1){if(_0x3054e1){_0x321587=_0x3054e1;_0xc8eb72[_0x29cb('0x36')]=_['keys'](db['DashboardItem']['rawAttributes']);_0xc8eb72[_0x29cb('0x37')]=_[_0x29cb('0x38')](_0x224f62[_0x29cb('0x37')]);_0xc8eb72['filters']=_['intersection'](_0xc8eb72['model'],_0xc8eb72[_0x29cb('0x37')]);_0x2b113f[_0x29cb('0x3b')]=_[_0x29cb('0x3a')](_0xc8eb72[_0x29cb('0x36')],qs['fields'](_0x224f62[_0x29cb('0x37')]['fields']));_0x2b113f[_0x29cb('0x3b')]=_0x2b113f[_0x29cb('0x3b')][_0x29cb('0x3c')]?_0x2b113f[_0x29cb('0x3b')]:_0xc8eb72['model'];_0x2b113f['order']=qs[_0x29cb('0x40')](_0x224f62[_0x29cb('0x37')]['sort']);_0x2b113f[_0x29cb('0x41')]=qs[_0x29cb('0x39')](_['pick'](_0x224f62[_0x29cb('0x37')],_0xc8eb72[_0x29cb('0x39')]));if(_0x224f62[_0x29cb('0x37')][_0x29cb('0x43')]){_0x2b113f['where']=_[_0x29cb('0x44')](_0x2b113f[_0x29cb('0x41')],{'$or':_['map'](_0x2b113f['attributes'],function(_0x2171fd){var _0xf5a136={};_0xf5a136[_0x2171fd]={'$like':'%'+_0x224f62['query']['filter']+'%'};return _0xf5a136;})});}_0x2b113f=_['merge']({},_0x2b113f,_0x224f62['options']);return _0x321587[_0x29cb('0x7f')](_0x2b113f);}})[_0x29cb('0x2b')](function(_0xbf45a5){if(_0xbf45a5){_0xe67fc3=_0xbf45a5[_0x29cb('0x3c')];if(!_0x224f62[_0x29cb('0x37')][_0x29cb('0x3d')](_0x29cb('0x3e'))){_0x2b113f['limit']=qs[_0x29cb('0x24')](_0x224f62[_0x29cb('0x37')]['limit']);_0x2b113f[_0x29cb('0x22')]=qs['offset'](_0x224f62[_0x29cb('0x37')]['offset']);}return _0x321587['getItems'](_0x2b113f);}})[_0x29cb('0x2b')](function(_0x586986){if(_0x586986){return _0x586986?{'count':_0xe67fc3,'rows':_0x586986}:null;}})[_0x29cb('0x2b')](respondWithResult(_0xaf497c,null))['catch'](handleError(_0xaf497c,null));}; \ No newline at end of file +var _0x95d4=['getItems','findOne','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','error','name','send','index','map','Dashboard','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','body','UserProfileResource','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x95d4,0x113));var _0x495d=function(_0x45cbcf,_0xfbdbc2){_0x45cbcf=_0x45cbcf-0x0;var _0x52ece8=_0x95d4[_0x45cbcf];return _0x52ece8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x495d('0x0'));var zipdir=require(_0x495d('0x1'));var jsonpatch=require(_0x495d('0x2'));var rp=require(_0x495d('0x3'));var moment=require(_0x495d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x495d('0x5'));var util=require(_0x495d('0x6'));var path=require(_0x495d('0x7'));var sox=require(_0x495d('0x8'));var csv=require(_0x495d('0x9'));var ejs=require(_0x495d('0xa'));var fs=require('fs');var fs_extra=require(_0x495d('0xb'));var _=require(_0x495d('0xc'));var squel=require(_0x495d('0xd'));var crypto=require(_0x495d('0xe'));var jsforce=require(_0x495d('0xf'));var deskjs=require(_0x495d('0x10'));var toCsv=require(_0x495d('0x9'));var querystring=require(_0x495d('0x11'));var Papa=require(_0x495d('0x12'));var Redis=require(_0x495d('0x13'));var authService=require(_0x495d('0x14'));var qs=require(_0x495d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x495d('0x16'));var logger=require(_0x495d('0x17'))(_0x495d('0x18'));var utils=require('../../config/utils');var config=require(_0x495d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x495d('0x1a'))['db'];config[_0x495d('0x1b')]=_[_0x495d('0x1c')](config['redis'],{'host':_0x495d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x495d('0x1b')]));require(_0x495d('0x1e'))[_0x495d('0x1f')](socket);function respondWithStatusCode(_0x56fae7,_0xe3359f){_0xe3359f=_0xe3359f||0xcc;return function(_0x4fa465){if(_0x4fa465){return _0x56fae7[_0x495d('0x20')](_0xe3359f);}return _0x56fae7[_0x495d('0x21')](_0xe3359f)[_0x495d('0x22')]();};}function respondWithResult(_0xf2e2a6,_0x3de032){_0x3de032=_0x3de032||0xc8;return function(_0xa1f81b){if(_0xa1f81b){return _0xf2e2a6[_0x495d('0x21')](_0x3de032)[_0x495d('0x23')](_0xa1f81b);}};}function respondWithFilteredResult(_0x453a5c,_0x2e3b7a){return function(_0x32d6a6){if(_0x32d6a6){var _0x27a305=typeof _0x2e3b7a['offset']===_0x495d('0x24')&&typeof _0x2e3b7a[_0x495d('0x25')]===_0x495d('0x24');var _0x38c545=_0x32d6a6['count'];var _0x49b0a3=_0x27a305?0x0:_0x2e3b7a[_0x495d('0x26')];var _0x25e2ff=_0x27a305?_0x32d6a6[_0x495d('0x27')]:_0x2e3b7a['offset']+_0x2e3b7a['limit'];var _0x1f5d90;if(_0x25e2ff>=_0x38c545){_0x25e2ff=_0x38c545;_0x1f5d90=0xc8;}else{_0x1f5d90=0xce;}_0x453a5c[_0x495d('0x21')](_0x1f5d90);return _0x453a5c[_0x495d('0x28')](_0x495d('0x29'),_0x49b0a3+'-'+_0x25e2ff+'/'+_0x38c545)[_0x495d('0x23')](_0x32d6a6);}return null;};}function patchUpdates(_0x4083ae){return function(_0x5f4a54){try{jsonpatch['apply'](_0x5f4a54,_0x4083ae,!![]);}catch(_0x3fa338){return BPromise[_0x495d('0x2a')](_0x3fa338);}return _0x5f4a54[_0x495d('0x2b')]();};}function saveUpdates(_0x3beb62,_0x57d640){return function(_0x2af489){if(_0x2af489){return _0x2af489[_0x495d('0x2c')](_0x3beb62)[_0x495d('0x2d')](function(_0x57f307){return _0x57f307;});}return null;};}function removeEntity(_0xc6988c,_0xbac451){return function(_0xa4e746){if(_0xa4e746){return _0xa4e746[_0x495d('0x2e')]()[_0x495d('0x2d')](function(){var _0x4ffce9=_0xa4e746[_0x495d('0x2f')]({'plain':!![]});var _0x390d68='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x390d68,'resourceId':_0x4ffce9['id']}})[_0x495d('0x2d')](function(){return _0xa4e746;});})[_0x495d('0x2d')](function(){_0xc6988c[_0x495d('0x21')](0xcc)[_0x495d('0x22')]();});}};}function handleEntityNotFound(_0x14b22d,_0x1c4394){return function(_0x1a5326){if(!_0x1a5326){_0x14b22d[_0x495d('0x20')](0x194);}return _0x1a5326;};}function handleError(_0x2e09e6,_0xdd0547){_0xdd0547=_0xdd0547||0x1f4;return function(_0x1139a3){logger[_0x495d('0x30')](_0x1139a3['stack']);if(_0x1139a3[_0x495d('0x31')]){delete _0x1139a3[_0x495d('0x31')];}_0x2e09e6[_0x495d('0x21')](_0xdd0547)[_0x495d('0x32')](_0x1139a3);};}exports[_0x495d('0x33')]=function(_0x245ee4,_0x24777c){var _0x5f2d1e={},_0x15549f={},_0x228143={'count':0x0,'rows':[]};var _0x3593f9=_[_0x495d('0x34')](db[_0x495d('0x35')]['rawAttributes'],function(_0x24c198){return{'name':_0x24c198['fieldName'],'type':_0x24c198[_0x495d('0x36')][_0x495d('0x37')]};});_0x15549f['model']=_[_0x495d('0x34')](_0x3593f9,_0x495d('0x31'));_0x15549f[_0x495d('0x38')]=_[_0x495d('0x39')](_0x245ee4['query']);_0x15549f[_0x495d('0x3a')]=_['intersection'](_0x15549f[_0x495d('0x3b')],_0x15549f['query']);_0x5f2d1e[_0x495d('0x3c')]=_['intersection'](_0x15549f['model'],qs[_0x495d('0x3d')](_0x245ee4[_0x495d('0x38')][_0x495d('0x3d')]));_0x5f2d1e[_0x495d('0x3c')]=_0x5f2d1e['attributes'][_0x495d('0x3e')]?_0x5f2d1e[_0x495d('0x3c')]:_0x15549f[_0x495d('0x3b')];if(!_0x245ee4[_0x495d('0x38')][_0x495d('0x3f')]('nolimit')){_0x5f2d1e[_0x495d('0x25')]=qs['limit'](_0x245ee4['query']['limit']);_0x5f2d1e['offset']=qs[_0x495d('0x26')](_0x245ee4['query'][_0x495d('0x26')]);}_0x5f2d1e[_0x495d('0x40')]=qs[_0x495d('0x41')](_0x245ee4[_0x495d('0x38')][_0x495d('0x41')]);_0x5f2d1e[_0x495d('0x42')]=qs[_0x495d('0x3a')](_[_0x495d('0x43')](_0x245ee4['query'],_0x15549f['filters']),_0x3593f9);if(_0x245ee4[_0x495d('0x38')][_0x495d('0x44')]){_0x5f2d1e[_0x495d('0x42')]=_[_0x495d('0x45')](_0x5f2d1e[_0x495d('0x42')],{'$or':_[_0x495d('0x34')](_0x3593f9,function(_0x145764){if(_0x145764['type']!=='VIRTUAL'){var _0x57e0e7={};_0x57e0e7[_0x145764[_0x495d('0x31')]]={'$like':'%'+_0x245ee4[_0x495d('0x38')][_0x495d('0x44')]+'%'};return _0x57e0e7;}})});}_0x5f2d1e=_['merge']({},_0x5f2d1e,_0x245ee4['options']);var _0x34b09b={'where':_0x5f2d1e[_0x495d('0x42')]};return db[_0x495d('0x35')]['count'](_0x34b09b)[_0x495d('0x2d')](function(_0x485021){_0x228143['count']=_0x485021;if(_0x245ee4[_0x495d('0x38')]['includeAll']){_0x5f2d1e[_0x495d('0x46')]=[{'all':!![]}];}return db[_0x495d('0x35')][_0x495d('0x47')](_0x5f2d1e);})[_0x495d('0x2d')](function(_0x291d22){_0x228143[_0x495d('0x48')]=_0x291d22;return _0x228143;})[_0x495d('0x2d')](respondWithFilteredResult(_0x24777c,_0x5f2d1e))[_0x495d('0x49')](handleError(_0x24777c,null));};exports[_0x495d('0x4a')]=function(_0x4d7198,_0x326cb4){var _0x37ed26={'raw':![],'where':{'id':_0x4d7198['params']['id']}},_0x37c1ee={};_0x37c1ee[_0x495d('0x3b')]=_['keys'](db[_0x495d('0x35')][_0x495d('0x4b')]);_0x37c1ee['query']=_['keys'](_0x4d7198['query']);_0x37c1ee[_0x495d('0x3a')]=_[_0x495d('0x4c')](_0x37c1ee['model'],_0x37c1ee['query']);_0x37ed26['attributes']=_['intersection'](_0x37c1ee[_0x495d('0x3b')],qs[_0x495d('0x3d')](_0x4d7198[_0x495d('0x38')][_0x495d('0x3d')]));_0x37ed26[_0x495d('0x3c')]=_0x37ed26['attributes'][_0x495d('0x3e')]?_0x37ed26[_0x495d('0x3c')]:_0x37c1ee['model'];if(_0x4d7198['query'][_0x495d('0x4d')]){_0x37ed26[_0x495d('0x46')]=[{'all':!![]}];}_0x37ed26=_[_0x495d('0x45')]({},_0x37ed26,_0x4d7198[_0x495d('0x4e')]);return db['Dashboard'][_0x495d('0x4f')](_0x37ed26)[_0x495d('0x2d')](handleEntityNotFound(_0x326cb4,null))[_0x495d('0x2d')](respondWithResult(_0x326cb4,null))[_0x495d('0x49')](handleError(_0x326cb4,null));};exports[_0x495d('0x50')]=function(_0x18a8fc,_0x383a77){return db[_0x495d('0x35')][_0x495d('0x50')](_0x18a8fc['body'],{})['then'](function(_0x49c662){var _0x25b4c7=_0x18a8fc[_0x495d('0x51')]['get']({'plain':!![]});if(!_0x25b4c7)throw new Error(_0x495d('0x52'));if(_0x25b4c7[_0x495d('0x53')]===_0x495d('0x51')){var _0x18e5cb=_0x49c662[_0x495d('0x2f')]({'plain':!![]});var _0x5c3bdd=_0x495d('0x54');return db[_0x495d('0x55')][_0x495d('0x4f')]({'where':{'name':_0x5c3bdd,'userProfileId':_0x25b4c7[_0x495d('0x56')]},'raw':!![]})[_0x495d('0x2d')](function(_0x3b235f){if(_0x3b235f&&_0x3b235f[_0x495d('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x18e5cb[_0x495d('0x31')],'resourceId':_0x18e5cb['id'],'type':_0x3b235f[_0x495d('0x31')],'sectionId':_0x3b235f['id']},{})[_0x495d('0x2d')](function(){return _0x49c662;});}else{return _0x49c662;}})['catch'](function(_0x555553){logger[_0x495d('0x30')](_0x495d('0x58'),_0x555553);throw _0x555553;});}return _0x49c662;})[_0x495d('0x2d')](respondWithResult(_0x383a77,0xc9))[_0x495d('0x49')](handleError(_0x383a77,null));};exports[_0x495d('0x59')]=function(_0x24c5e7,_0x52c966){var _0x1946de={'where':{'id':_0x24c5e7[_0x495d('0x5a')]['id']}},_0x2d3388={};_0x2d3388[_0x495d('0x3b')]=_[_0x495d('0x39')](db['Dashboard'][_0x495d('0x4b')]);_0x1946de['attributes']=_['intersection'](_0x2d3388[_0x495d('0x3b')],qs[_0x495d('0x3d')](_0x24c5e7[_0x495d('0x38')][_0x495d('0x3d')]));_0x1946de[_0x495d('0x3c')]=_0x1946de[_0x495d('0x3c')][_0x495d('0x3e')]?_0x1946de[_0x495d('0x3c')]:_0x2d3388[_0x495d('0x3b')];if(_0x24c5e7['query'][_0x495d('0x4d')]){_0x1946de[_0x495d('0x46')]=[{'all':!![]}];}_0x1946de=_[_0x495d('0x45')]({},_0x1946de,_0x24c5e7['options']);return db[_0x495d('0x35')][_0x495d('0x4f')](_0x1946de)[_0x495d('0x2d')](handleEntityNotFound(_0x52c966,null))[_0x495d('0x2d')](function(_0x6586da){if(_0x6586da){var _0x361d80=_0x6586da['get']({'plain':!![]});_0x361d80=qs['omit'](_0x361d80,['id',_0x495d('0x5b'),_0x495d('0x5c')]);_0x24c5e7['body']=_['omit'](_0x24c5e7[_0x495d('0x5d')],['id','createdAt',_0x495d('0x5c')]);return db[_0x495d('0x35')]['create'](_['merge'](_0x361d80,_0x24c5e7['body']),{'include':_0x24c5e7['query'][_0x495d('0x4d')]?[{'all':!![]}]:undefined})[_0x495d('0x2d')](function(_0x3c3e45){var _0x506ed9=_0x24c5e7[_0x495d('0x51')]['get']({'plain':!![]});if(!_0x506ed9)throw new Error(_0x495d('0x52'));if(_0x506ed9[_0x495d('0x53')]===_0x495d('0x51')){var _0x1cc669=_0x3c3e45[_0x495d('0x2f')]({'plain':!![]});var _0x5c8b5c=_0x495d('0x54');return db[_0x495d('0x55')][_0x495d('0x4f')]({'where':{'name':_0x5c8b5c,'userProfileId':_0x506ed9['userProfileId']},'raw':!![]})['then'](function(_0x29a5e6){if(_0x29a5e6&&_0x29a5e6[_0x495d('0x57')]===0x0){return db[_0x495d('0x5e')][_0x495d('0x50')]({'name':_0x1cc669[_0x495d('0x31')],'resourceId':_0x1cc669['id'],'type':_0x29a5e6['name'],'sectionId':_0x29a5e6['id']},{})[_0x495d('0x2d')](function(){return _0x3c3e45;});}else{return _0x3c3e45;}})[_0x495d('0x49')](function(_0x2ffc91){logger[_0x495d('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ffc91);throw _0x2ffc91;});}return _0x3c3e45;});}})['then'](respondWithResult(_0x52c966,0xc9))[_0x495d('0x49')](handleError(_0x52c966,null));};exports['update']=function(_0x441e7c,_0x1f2ac3){if(_0x441e7c[_0x495d('0x5d')]['id']){delete _0x441e7c['body']['id'];}return db['Dashboard'][_0x495d('0x4f')]({'where':{'id':_0x441e7c['params']['id']}})[_0x495d('0x2d')](handleEntityNotFound(_0x1f2ac3,null))[_0x495d('0x2d')](saveUpdates(_0x441e7c[_0x495d('0x5d')],null))[_0x495d('0x2d')](respondWithResult(_0x1f2ac3,null))[_0x495d('0x49')](handleError(_0x1f2ac3,null));};exports[_0x495d('0x2e')]=function(_0xa8f951,_0x3339ec){return db[_0x495d('0x35')]['find']({'where':{'id':_0xa8f951[_0x495d('0x5a')]['id']}})[_0x495d('0x2d')](handleEntityNotFound(_0x3339ec,null))[_0x495d('0x2d')](removeEntity(_0x3339ec,null))[_0x495d('0x49')](handleError(_0x3339ec,null));};function widgetAttributes(_0x1b0840){try{switch(_0x1b0840[_0x495d('0x36')]){case _0x495d('0x5f'):return[{'name':'attrUrl','value':_0x1b0840[_0x495d('0x60')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x0]?_0x1b0840[_0x495d('0x61')][0x0][_0x495d('0x62')]:undefined)||_0x495d('0x63')}];case _0x495d('0x64'):return[{'name':_0x495d('0x65'),'value':_0x1b0840[_0x495d('0x65')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x0]?_0x1b0840['attrs'][0x0][_0x495d('0x62')]:undefined)||''}];case _0x495d('0x66'):return[{'name':_0x495d('0x67'),'value':_0x1b0840['attrHourFormat']||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x0]?_0x1b0840[_0x495d('0x61')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x495d('0x68'),'value':_0x1b0840[_0x495d('0x68')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x1]?_0x1b0840[_0x495d('0x61')][0x1][_0x495d('0x62')]:undefined)||_0x495d('0x69')},{'name':_0x495d('0x6a'),'value':_0x1b0840[_0x495d('0x6a')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x2]?_0x1b0840[_0x495d('0x61')][0x2][_0x495d('0x62')]:undefined)||0xc}];case _0x495d('0x6b'):return[{'name':'attrMetric','value':_0x1b0840[_0x495d('0x6c')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x0]?_0x1b0840['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x495d('0x6d'),'value':_0x1b0840[_0x495d('0x6d')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x1]?_0x1b0840[_0x495d('0x61')][0x1]['value']:undefined)||[]},{'name':_0x495d('0x6a'),'value':_0x1b0840[_0x495d('0x6a')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x2]?_0x1b0840[_0x495d('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x495d('0x6e'),'value':_0x1b0840['attrChannel']||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x3]?_0x1b0840['attrs'][0x3][_0x495d('0x62')]:undefined)||_0x495d('0x6f')},{'name':_0x495d('0x70'),'value':_0x1b0840[_0x495d('0x70')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x4]?_0x1b0840[_0x495d('0x61')][0x4][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x71'),'value':_0x1b0840[_0x495d('0x71')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x5]?_0x1b0840[_0x495d('0x61')][0x5][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x72'),'value':_0x1b0840['attrSmsAccounts']||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x6]?_0x1b0840[_0x495d('0x61')][0x6][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x73'),'value':_0x1b0840['attrOpenchannelAccounts']||(_0x1b0840['attrs']&&_0x1b0840['attrs'][0x7]?_0x1b0840[_0x495d('0x61')][0x7]['value']:undefined)||''},{'name':_0x495d('0x74'),'value':_0x1b0840[_0x495d('0x74')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x8]?_0x1b0840[_0x495d('0x61')][0x8][_0x495d('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1b0840[_0x495d('0x75')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x9]?_0x1b0840[_0x495d('0x61')][0x9][_0x495d('0x62')]:undefined)||''}];case _0x495d('0x76'):case _0x495d('0x77'):return[{'name':_0x495d('0x78'),'value':_0x1b0840[_0x495d('0x78')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x0]?_0x1b0840['attrs'][0x0]['value']:undefined)||_0x495d('0x79')},{'name':_0x495d('0x7a'),'value':_0x1b0840['attrSerie2']||(_0x1b0840['attrs']&&_0x1b0840[_0x495d('0x61')][0x1]?_0x1b0840[_0x495d('0x61')][0x1][_0x495d('0x62')]:undefined)||null},{'name':_0x495d('0x7b'),'value':_0x1b0840['attrSerie3']||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x2]?_0x1b0840[_0x495d('0x61')][0x2][_0x495d('0x62')]:undefined)||null},{'name':_0x495d('0x6d'),'value':_0x1b0840[_0x495d('0x6d')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x3]?_0x1b0840[_0x495d('0x61')][0x3][_0x495d('0x62')]:undefined)||[]},{'name':_0x495d('0x6e'),'value':_0x1b0840[_0x495d('0x6e')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x4]?_0x1b0840[_0x495d('0x61')][0x4][_0x495d('0x62')]:undefined)||'voice'},{'name':_0x495d('0x70'),'value':_0x1b0840[_0x495d('0x70')]||(_0x1b0840['attrs']&&_0x1b0840[_0x495d('0x61')][0x5]?_0x1b0840[_0x495d('0x61')][0x5][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x71'),'value':_0x1b0840[_0x495d('0x71')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x6]?_0x1b0840[_0x495d('0x61')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x1b0840[_0x495d('0x72')]||(_0x1b0840['attrs']&&_0x1b0840[_0x495d('0x61')][0x7]?_0x1b0840[_0x495d('0x61')][0x7]['value']:undefined)||''},{'name':_0x495d('0x73'),'value':_0x1b0840['attrOpenchannelAccounts']||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x8]?_0x1b0840['attrs'][0x8][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x74'),'value':_0x1b0840[_0x495d('0x74')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840['attrs'][0x9]?_0x1b0840[_0x495d('0x61')][0x9][_0x495d('0x62')]:undefined)||''},{'name':_0x495d('0x75'),'value':_0x1b0840[_0x495d('0x75')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0xa]?_0x1b0840['attrs'][0xa]['value']:undefined)||''}];case _0x495d('0x7c'):return[{'name':'attrReport','type':_0x1b0840[_0x495d('0x7d')]||(_0x1b0840['attrs']&&_0x1b0840[_0x495d('0x61')][0x0]?_0x1b0840[_0x495d('0x61')][0x0]['type']:undefined)||null,'value':_0x1b0840[_0x495d('0x7e')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x0]?_0x1b0840[_0x495d('0x61')][0x0][_0x495d('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x1b0840[_0x495d('0x7f')]||(_0x1b0840[_0x495d('0x61')]&&_0x1b0840[_0x495d('0x61')][0x1]?_0x1b0840[_0x495d('0x61')][0x1][_0x495d('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x3e729a){logger[_0x495d('0x30')](_0x495d('0x80'),JSON[_0x495d('0x81')](_0x3e729a));return[];}}exports[_0x495d('0x82')]=function(_0x53b979,_0x590cb7,_0x1731a6){if(_0x53b979[_0x495d('0x5d')]['id']){delete _0x53b979[_0x495d('0x5d')]['id'];}return db[_0x495d('0x35')][_0x495d('0x4f')]({'where':{'id':_0x53b979[_0x495d('0x5a')]['id']}})[_0x495d('0x2d')](handleEntityNotFound(_0x590cb7,null))[_0x495d('0x2d')](function(_0x1343d8){if(_0x1343d8){_0x53b979['body'][_0x495d('0x83')]=_0x1343d8['id'];_0x53b979[_0x495d('0x5d')][_0x495d('0x61')]=widgetAttributes(_0x53b979[_0x495d('0x5d')]);return db[_0x495d('0x84')]['create'](_0x53b979[_0x495d('0x5d')]);}})[_0x495d('0x2d')](respondWithResult(_0x590cb7,null))[_0x495d('0x49')](handleError(_0x590cb7,null));};exports[_0x495d('0x85')]=function(_0x6ef190,_0x57a5a8,_0x39289a){var _0x1fd805={};var _0x529fab={};var _0x13aada;var _0x31106d;return db['Dashboard'][_0x495d('0x86')]({'where':{'id':_0x6ef190[_0x495d('0x5a')]['id']}})[_0x495d('0x2d')](handleEntityNotFound(_0x57a5a8,null))[_0x495d('0x2d')](function(_0x29f50d){if(_0x29f50d){_0x13aada=_0x29f50d;_0x529fab[_0x495d('0x3b')]=_['keys'](db[_0x495d('0x84')][_0x495d('0x4b')]);_0x529fab[_0x495d('0x38')]=_[_0x495d('0x39')](_0x6ef190[_0x495d('0x38')]);_0x529fab[_0x495d('0x3a')]=_['intersection'](_0x529fab[_0x495d('0x3b')],_0x529fab[_0x495d('0x38')]);_0x1fd805[_0x495d('0x3c')]=_[_0x495d('0x4c')](_0x529fab['model'],qs[_0x495d('0x3d')](_0x6ef190[_0x495d('0x38')][_0x495d('0x3d')]));_0x1fd805['attributes']=_0x1fd805[_0x495d('0x3c')][_0x495d('0x3e')]?_0x1fd805[_0x495d('0x3c')]:_0x529fab[_0x495d('0x3b')];_0x1fd805[_0x495d('0x40')]=qs['sort'](_0x6ef190[_0x495d('0x38')][_0x495d('0x41')]);_0x1fd805[_0x495d('0x42')]=qs['filters'](_[_0x495d('0x43')](_0x6ef190[_0x495d('0x38')],_0x529fab[_0x495d('0x3a')]));if(_0x6ef190[_0x495d('0x38')]['filter']){_0x1fd805[_0x495d('0x42')]=_[_0x495d('0x45')](_0x1fd805[_0x495d('0x42')],{'$or':_['map'](_0x1fd805['attributes'],function(_0x4363ab){var _0x59d397={};_0x59d397[_0x4363ab]={'$like':'%'+_0x6ef190[_0x495d('0x38')][_0x495d('0x44')]+'%'};return _0x59d397;})});}_0x1fd805=_[_0x495d('0x45')]({},_0x1fd805,_0x6ef190[_0x495d('0x4e')]);return _0x13aada[_0x495d('0x85')](_0x1fd805);}})['then'](function(_0x1f331a){if(_0x1f331a){_0x31106d=_0x1f331a[_0x495d('0x3e')];if(!_0x6ef190[_0x495d('0x38')][_0x495d('0x3f')](_0x495d('0x87'))){_0x1fd805[_0x495d('0x25')]=qs[_0x495d('0x25')](_0x6ef190[_0x495d('0x38')][_0x495d('0x25')]);_0x1fd805[_0x495d('0x26')]=qs['offset'](_0x6ef190[_0x495d('0x38')]['offset']);}return _0x13aada['getItems'](_0x1fd805);}})['then'](function(_0x1048ba){if(_0x1048ba){return _0x1048ba?{'count':_0x31106d,'rows':_0x1048ba}:null;}})[_0x495d('0x2d')](respondWithResult(_0x57a5a8,null))[_0x495d('0x49')](handleError(_0x57a5a8,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 26c1dc9..2b07670 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 _0xc4b3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xa4ad8a,_0x34640e){var _0x5d0453=function(_0x23a168){while(--_0x23a168){_0xa4ad8a['push'](_0xa4ad8a['shift']());}};_0x5d0453(++_0x34640e);}(_0xc4b3,0x179));var _0x3c4b=function(_0x4c375b,_0x1cb0ac){_0x4c375b=_0x4c375b-0x0;var _0x2aafe7=_0xc4b3[_0x4c375b];return _0x2aafe7;};'use strict';var EventEmitter=require(_0x3c4b('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3c4b('0x1')](0x0);var events={'afterCreate':_0x3c4b('0x2'),'afterUpdate':_0x3c4b('0x3'),'afterDestroy':_0x3c4b('0x4')};function emitEvent(_0x4b1d0e){return function(_0x954aed,_0x4b8cd6,_0x37b4b0){DashboardEvents[_0x3c4b('0x5')](_0x4b1d0e+':'+_0x954aed['id'],_0x954aed);DashboardEvents[_0x3c4b('0x5')](_0x4b1d0e,_0x954aed);_0x37b4b0(null);};}for(var e in events){if(events[_0x3c4b('0x6')](e)){var event=events[e];Dashboard[_0x3c4b('0x7')](e,emitEvent(event));}}module[_0x3c4b('0x8')]=DashboardEvents; \ No newline at end of file +var _0xd114=['events','../../mysqldb','Dashboard','update','remove','emit','exports'];(function(_0x5413fd,_0x34fc0f){var _0x2025f5=function(_0x3e6e65){while(--_0x3e6e65){_0x5413fd['push'](_0x5413fd['shift']());}};_0x2025f5(++_0x34fc0f);}(_0xd114,0x157));var _0x4d11=function(_0x36b80e,_0x4ed32b){_0x36b80e=_0x36b80e-0x0;var _0x388f1f=_0xd114[_0x36b80e];return _0x388f1f;};'use strict';var EventEmitter=require(_0x4d11('0x0'));var Dashboard=require(_0x4d11('0x1'))['db'][_0x4d11('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d11('0x3'),'afterDestroy':_0x4d11('0x4')};function emitEvent(_0x68e8b8){return function(_0x1c0c6f,_0x1d5b41,_0x388e41){DashboardEvents[_0x4d11('0x5')](_0x68e8b8+':'+_0x1c0c6f['id'],_0x1c0c6f);DashboardEvents[_0x4d11('0x5')](_0x68e8b8,_0x1c0c6f);_0x388e41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x4d11('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 d74ee86..cb7fb1c 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 _0xceda=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xceda,0x1c4));var _0xaced=function(_0x390b74,_0x3ae372){_0x390b74=_0x390b74-0x0;var _0x25a4b5=_0xceda[_0x390b74];return _0x25a4b5;};'use strict';var _=require(_0xaced('0x0'));var util=require(_0xaced('0x1'));var logger=require(_0xaced('0x2'))(_0xaced('0x3'));var moment=require(_0xaced('0x4'));var BPromise=require(_0xaced('0x5'));var rp=require(_0xaced('0x6'));var fs=require('fs');var path=require(_0xaced('0x7'));var rimraf=require(_0xaced('0x8'));var config=require(_0xaced('0x9'));var attributes=require(_0xaced('0xa'));module[_0xaced('0xb')]=function(_0x106c62,_0x4bd96d){return _0x106c62[_0xaced('0xc')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8b2=['rimraf','./dashboard.attributes','define','dashboards','../../config/logger','api','moment','bluebird','path'];(function(_0x222472,_0x33ea87){var _0x5d601f=function(_0x53fc6f){while(--_0x53fc6f){_0x222472['push'](_0x222472['shift']());}};_0x5d601f(++_0x33ea87);}(_0xb8b2,0x124));var _0x2b8b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb8b2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b8b('0x0'))(_0x2b8b('0x1'));var moment=require(_0x2b8b('0x2'));var BPromise=require(_0x2b8b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b8b('0x4'));var rimraf=require(_0x2b8b('0x5'));var config=require('../../config/environment');var attributes=require(_0x2b8b('0x6'));module['exports']=function(_0x231449,_0x2edd2e){return _0x231449[_0x2b8b('0x7')]('Dashboard',attributes,{'tableName':_0x2b8b('0x8'),'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 06e862b..4a2dd3f 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 _0x8456=['then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8456,0xfd));var _0x6845=function(_0x3b9ad2,_0x35a7e6){_0x3b9ad2=_0x3b9ad2-0x0;var _0x58c058=_0x8456[_0x3b9ad2];return _0x58c058;};'use strict';var _=require(_0x6845('0x0'));var util=require(_0x6845('0x1'));var moment=require(_0x6845('0x2'));var BPromise=require('bluebird');var rs=require(_0x6845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6845('0x4'))['db'];var utils=require(_0x6845('0x5'));var logger=require(_0x6845('0x6'))(_0x6845('0x7'));var config=require(_0x6845('0x8'));var jayson=require(_0x6845('0x9'));var client=jayson[_0x6845('0xa')][_0x6845('0xb')]({'port':0x232a});config[_0x6845('0xc')]=_[_0x6845('0xd')](config['redis'],{'host':_0x6845('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6845('0xc')]));require(_0x6845('0xf'))['register'](socket);function respondWithRpcPromise(_0x317cee,_0x52ec64,_0xcc540){return new BPromise(function(_0x578d62,_0x1bcdbd){return client[_0x6845('0x10')](_0x317cee,_0xcc540)[_0x6845('0x11')](function(_0x348a05){logger[_0x6845('0x12')](_0x6845('0x13'),_0x52ec64,'request\x20sent');logger[_0x6845('0x14')](_0x6845('0x15'),_0x52ec64,_0x6845('0x16'),JSON[_0x6845('0x17')](_0x348a05));if(_0x348a05[_0x6845('0x18')]){if(_0x348a05['error']['code']===0x1f4){logger[_0x6845('0x18')](_0x6845('0x13'),_0x52ec64,_0x348a05[_0x6845('0x18')]['message']);return _0x1bcdbd(_0x348a05[_0x6845('0x18')][_0x6845('0x19')]);}logger[_0x6845('0x18')](_0x6845('0x13'),_0x52ec64,_0x348a05[_0x6845('0x18')][_0x6845('0x19')]);return _0x578d62(_0x348a05[_0x6845('0x18')]['message']);}else{logger[_0x6845('0x12')]('Dashboard,\x20%s,\x20%s',_0x52ec64,'request\x20sent');_0x578d62(_0x348a05[_0x6845('0x1a')][_0x6845('0x19')]);}})['catch'](function(_0x3056a4){logger[_0x6845('0x18')](_0x6845('0x13'),_0x52ec64,_0x3056a4);_0x1bcdbd(_0x3056a4);});});} \ No newline at end of file +var _0xa60a=['defaults','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa60a,0x90));var _0xaa60=function(_0x481619,_0x43ec55){_0x481619=_0x481619-0x0;var _0x54b24d=_0xa60a[_0x481619];return _0x54b24d;};'use strict';var _=require(_0xaa60('0x0'));var util=require(_0xaa60('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa60('0x2'));var fs=require('fs');var Redis=require(_0xaa60('0x3'));var db=require(_0xaa60('0x4'))['db'];var utils=require(_0xaa60('0x5'));var logger=require(_0xaa60('0x6'))(_0xaa60('0x7'));var config=require(_0xaa60('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xaa60('0x9')]=_[_0xaa60('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaa60('0xb'))(new Redis(config['redis']));require(_0xaa60('0xc'))['register'](socket);function respondWithRpcPromise(_0xfa4f19,_0x828648,_0x5a8e73){return new BPromise(function(_0x3d574c,_0x32bd52){return client[_0xaa60('0xd')](_0xfa4f19,_0x5a8e73)['then'](function(_0x5988ac){logger[_0xaa60('0xe')](_0xaa60('0xf'),_0x828648,_0xaa60('0x10'));logger['debug'](_0xaa60('0x11'),_0x828648,_0xaa60('0x10'),JSON['stringify'](_0x5988ac));if(_0x5988ac[_0xaa60('0x12')]){if(_0x5988ac[_0xaa60('0x12')]['code']===0x1f4){logger[_0xaa60('0x12')](_0xaa60('0xf'),_0x828648,_0x5988ac[_0xaa60('0x12')][_0xaa60('0x13')]);return _0x32bd52(_0x5988ac[_0xaa60('0x12')][_0xaa60('0x13')]);}logger['error'](_0xaa60('0xf'),_0x828648,_0x5988ac[_0xaa60('0x12')][_0xaa60('0x13')]);return _0x3d574c(_0x5988ac[_0xaa60('0x12')][_0xaa60('0x13')]);}else{logger[_0xaa60('0xe')](_0xaa60('0xf'),_0x828648,'request\x20sent');_0x3d574c(_0x5988ac[_0xaa60('0x14')][_0xaa60('0x13')]);}})[_0xaa60('0x15')](function(_0x45e769){logger['error'](_0xaa60('0xf'),_0x828648,_0x45e769);_0x32bd52(_0x45e769);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 098464d..6920ce4 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 _0x58fe=['save','remove','update','emit','removeListener','length','./dashboard.events'];(function(_0x70b8d,_0x107f60){var _0x4b3595=function(_0x5a7f59){while(--_0x5a7f59){_0x70b8d['push'](_0x70b8d['shift']());}};_0x4b3595(++_0x107f60);}(_0x58fe,0x84));var _0xe58f=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x58fe[_0x4d7f3f];return _0x5d67cc;};'use strict';var DashboardEvents=require(_0xe58f('0x0'));var events=[_0xe58f('0x1'),_0xe58f('0x2'),_0xe58f('0x3')];function createListener(_0x2ea572,_0x28cf29){return function(_0x53c172){_0x28cf29[_0xe58f('0x4')](_0x2ea572,_0x53c172);};}function removeListener(_0x1a91f9,_0x44c27f){return function(){DashboardEvents[_0xe58f('0x5')](_0x1a91f9,_0x44c27f);};}exports['register']=function(_0x3eed2c){for(var _0xea714c=0x0,_0x4aa6d9=events[_0xe58f('0x6')];_0xea714c<_0x4aa6d9;_0xea714c++){var _0x5c5015=events[_0xea714c];var _0xe9fbb4=createListener('dashboard:'+_0x5c5015,_0x3eed2c);DashboardEvents['on'](_0x5c5015,_0xe9fbb4);}}; \ No newline at end of file +var _0x0c47=['removeListener','register','./dashboard.events','remove','update','emit'];(function(_0x157559,_0x3e1b99){var _0x165e17=function(_0x59cdcd){while(--_0x59cdcd){_0x157559['push'](_0x157559['shift']());}};_0x165e17(++_0x3e1b99);}(_0x0c47,0x122));var _0x70c4=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x0c47[_0x1e91eb];return _0x2af75a;};'use strict';var DashboardEvents=require(_0x70c4('0x0'));var events=['save',_0x70c4('0x1'),_0x70c4('0x2')];function createListener(_0x3f34d0,_0x24be19){return function(_0x4b1f91){_0x24be19[_0x70c4('0x3')](_0x3f34d0,_0x4b1f91);};}function removeListener(_0x264a01,_0x439b54){return function(){DashboardEvents[_0x70c4('0x4')](_0x264a01,_0x439b54);};}exports[_0x70c4('0x5')]=function(_0x40512d){for(var _0x44a157=0x0,_0x5d5994=events['length'];_0x44a157<_0x5d5994;_0x44a157++){var _0x499917=events[_0x44a157];var _0x4dbc59=createListener('dashboard:'+_0x499917,_0x40512d);DashboardEvents['on'](_0x499917,_0x4dbc59);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a041cc8..b512792 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 _0x7e24=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','addItem','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2b5aaf,_0x3e25f4){var _0x91deff=function(_0x5ccf9d){while(--_0x5ccf9d){_0x2b5aaf['push'](_0x2b5aaf['shift']());}};_0x91deff(++_0x3e25f4);}(_0x7e24,0x1f4));var _0x47e2=function(_0x3946f4,_0x298424){_0x3946f4=_0x3946f4-0x0;var _0x42f0c0=_0x7e24[_0x3946f4];return _0x42f0c0;};'use strict';var multer=require('multer');var util=require(_0x47e2('0x0'));var path=require('path');var timeout=require(_0x47e2('0x1'));var express=require(_0x47e2('0x2'));var router=express[_0x47e2('0x3')]();var fs_extra=require(_0x47e2('0x4'));var auth=require(_0x47e2('0x5'));var interaction=require(_0x47e2('0x6'));var config=require(_0x47e2('0x7'));var controller=require(_0x47e2('0x8'));router[_0x47e2('0x9')]('/',auth[_0x47e2('0xa')](),controller[_0x47e2('0xb')]);router[_0x47e2('0x9')](_0x47e2('0xc'),auth['isAuthenticated'](),controller[_0x47e2('0xd')]);router[_0x47e2('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0x47e2('0xe')]);router[_0x47e2('0xf')]('/',auth[_0x47e2('0xa')](),controller['create']);router['post']('/:id/clone',auth[_0x47e2('0xa')](),controller['clone']);router[_0x47e2('0xf')]('/:id/items',auth[_0x47e2('0xa')](),controller[_0x47e2('0x10')]);router[_0x47e2('0x11')](_0x47e2('0xc'),auth[_0x47e2('0xa')](),controller['update']);router[_0x47e2('0x12')](_0x47e2('0xc'),auth[_0x47e2('0xa')](),controller[_0x47e2('0x13')]);module[_0x47e2('0x14')]=router; \ No newline at end of file +var _0x0832=['show','/:id/clone','clone','post','put','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id'];(function(_0x3a2bc6,_0xb3d543){var _0x2781d8=function(_0x4321af){while(--_0x4321af){_0x3a2bc6['push'](_0x3a2bc6['shift']());}};_0x2781d8(++_0xb3d543);}(_0x0832,0x1e2));var _0x2083=function(_0x3f1e4c,_0x30d1ed){_0x3f1e4c=_0x3f1e4c-0x0;var _0x1b5a86=_0x0832[_0x3f1e4c];return _0x1b5a86;};'use strict';var multer=require(_0x2083('0x0'));var util=require('util');var path=require(_0x2083('0x1'));var timeout=require('connect-timeout');var express=require(_0x2083('0x2'));var router=express['Router']();var fs_extra=require(_0x2083('0x3'));var auth=require(_0x2083('0x4'));var interaction=require(_0x2083('0x5'));var config=require(_0x2083('0x6'));var controller=require(_0x2083('0x7'));router[_0x2083('0x8')]('/',auth[_0x2083('0x9')](),controller[_0x2083('0xa')]);router['get'](_0x2083('0xb'),auth['isAuthenticated'](),controller[_0x2083('0xc')]);router['get']('/:id/items',auth[_0x2083('0x9')](),controller['getItems']);router['post']('/',auth[_0x2083('0x9')](),controller['create']);router['post'](_0x2083('0xd'),auth[_0x2083('0x9')](),controller[_0x2083('0xe')]);router[_0x2083('0xf')]('/:id/items',auth[_0x2083('0x9')](),controller['addItem']);router[_0x2083('0x10')](_0x2083('0xb'),auth[_0x2083('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2083('0x11')]);module[_0x2083('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6d58932..f3539c0 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x596a8e,_0x591f5d){var _0x5d1024=function(_0x3f9596){while(--_0x3f9596){_0x596a8e['push'](_0x596a8e['shift']());}};_0x5d1024(++_0x591f5d);}(_0x5fab,0x177));var _0xb5fa=function(_0x2f7231,_0x20670d){_0x2f7231=_0x2f7231-0x0;var _0x1a9d86=_0x5fab[_0x2f7231];return _0x1a9d86;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x814b=['lodash','exports','STRING','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel'];(function(_0x5a4473,_0xf868f2){var _0x4016ca=function(_0x2f691f){while(--_0x2f691f){_0x5a4473['push'](_0x5a4473['shift']());}};_0x4016ca(++_0xf868f2);}(_0x814b,0x1a2));var _0xb814=function(_0x503306,_0x356f2f){_0x503306=_0x503306-0x0;var _0x44a99d=_0x814b[_0x503306];return _0x44a99d;};'use strict';var Sequelize=require(_0xb814('0x0'));var squel=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));module[_0xb814('0x3')]={'title':{'type':Sequelize[_0xb814('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xb814('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xb814('0x5')),'get':function(){try{return JSON[_0xb814('0x6')](this[_0xb814('0x7')](_0xb814('0x8')));}catch(_0x44931c){return[];}},'set':function(_0x322a70){try{this['setDataValue'](_0xb814('0x8'),JSON[_0xb814('0x9')](_0x322a70));}catch(_0x5c8539){this[_0xb814('0xa')](_0xb814('0x8'),JSON[_0xb814('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb814('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb814('0xb')]},'col':{'type':Sequelize[_0xb814('0xb')]},'background':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'defaultValue':_0xb814('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xb814('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 79ee222..df9fa6f 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 _0xc61d=['stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','find','catch','type','iframe','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','count','set','Content-Range','save','update','then','destroy','error'];(function(_0x2fefe2,_0x3d461c){var _0xcd97a=function(_0x4bacba){while(--_0x4bacba){_0x2fefe2['push'](_0x2fefe2['shift']());}};_0xcd97a(++_0x3d461c);}(_0xc61d,0xfb));var _0xdc61=function(_0x45a1c1,_0x3a40f2){_0x45a1c1=_0x45a1c1-0x0;var _0x3428b6=_0xc61d[_0x45a1c1];return _0x3428b6;};'use strict';var emlformat=require(_0xdc61('0x0'));var rimraf=require(_0xdc61('0x1'));var zipdir=require(_0xdc61('0x2'));var jsonpatch=require(_0xdc61('0x3'));var rp=require(_0xdc61('0x4'));var moment=require(_0xdc61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc61('0x6'));var util=require(_0xdc61('0x7'));var path=require('path');var sox=require(_0xdc61('0x8'));var csv=require(_0xdc61('0x9'));var ejs=require(_0xdc61('0xa'));var fs=require('fs');var fs_extra=require(_0xdc61('0xb'));var _=require(_0xdc61('0xc'));var squel=require(_0xdc61('0xd'));var crypto=require(_0xdc61('0xe'));var jsforce=require(_0xdc61('0xf'));var deskjs=require(_0xdc61('0x10'));var toCsv=require(_0xdc61('0x9'));var querystring=require('querystring');var Papa=require(_0xdc61('0x11'));var Redis=require(_0xdc61('0x12'));var authService=require(_0xdc61('0x13'));var qs=require(_0xdc61('0x14'));var as=require(_0xdc61('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc61('0x16'))('api');var utils=require(_0xdc61('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdc61('0x18'));var db=require(_0xdc61('0x19'))['db'];config[_0xdc61('0x1a')]=_[_0xdc61('0x1b')](config[_0xdc61('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc61('0x1c'))(new Redis(config[_0xdc61('0x1a')]));require('./dashboardItem.socket')[_0xdc61('0x1d')](socket);function respondWithStatusCode(_0x85d82d,_0x42798c){_0x42798c=_0x42798c||0xcc;return function(_0x386b7f){if(_0x386b7f){return _0x85d82d[_0xdc61('0x1e')](_0x42798c);}return _0x85d82d[_0xdc61('0x1f')](_0x42798c)[_0xdc61('0x20')]();};}function respondWithResult(_0x191d06,_0x2805d0){_0x2805d0=_0x2805d0||0xc8;return function(_0x53c185){if(_0x53c185){return _0x191d06[_0xdc61('0x1f')](_0x2805d0)[_0xdc61('0x21')](_0x53c185);}};}function respondWithFilteredResult(_0x1de932,_0x2cd1a4){return function(_0x45b7b7){if(_0x45b7b7){var _0x393205=typeof _0x2cd1a4[_0xdc61('0x22')]==='undefined'&&typeof _0x2cd1a4['limit']==='undefined';var _0x17120b=_0x45b7b7['count'];var _0x319d93=_0x393205?0x0:_0x2cd1a4[_0xdc61('0x22')];var _0xf9aa4e=_0x393205?_0x45b7b7[_0xdc61('0x23')]:_0x2cd1a4[_0xdc61('0x22')]+_0x2cd1a4['limit'];var _0x2c687d;if(_0xf9aa4e>=_0x17120b){_0xf9aa4e=_0x17120b;_0x2c687d=0xc8;}else{_0x2c687d=0xce;}_0x1de932[_0xdc61('0x1f')](_0x2c687d);return _0x1de932[_0xdc61('0x24')](_0xdc61('0x25'),_0x319d93+'-'+_0xf9aa4e+'/'+_0x17120b)[_0xdc61('0x21')](_0x45b7b7);}return null;};}function patchUpdates(_0x5a733a){return function(_0x447a46){try{jsonpatch['apply'](_0x447a46,_0x5a733a,!![]);}catch(_0x53cad0){return BPromise['reject'](_0x53cad0);}return _0x447a46[_0xdc61('0x26')]();};}function saveUpdates(_0x2571bc,_0x495dae){return function(_0x230d58){if(_0x230d58){return _0x230d58[_0xdc61('0x27')](_0x2571bc)[_0xdc61('0x28')](function(_0x40cf53){return _0x40cf53;});}return null;};}function removeEntity(_0x290790,_0x2e15f6){return function(_0xda80ca){if(_0xda80ca){return _0xda80ca[_0xdc61('0x29')]()['then'](function(){_0x290790[_0xdc61('0x1f')](0xcc)[_0xdc61('0x20')]();});}};}function handleEntityNotFound(_0x3988ec,_0x8977d2){return function(_0x27109a){if(!_0x27109a){_0x3988ec[_0xdc61('0x1e')](0x194);}return _0x27109a;};}function handleError(_0x217bbd,_0x5bb7e5){_0x5bb7e5=_0x5bb7e5||0x1f4;return function(_0xfc12ac){logger[_0xdc61('0x2a')](_0xfc12ac[_0xdc61('0x2b')]);if(_0xfc12ac[_0xdc61('0x2c')]){delete _0xfc12ac['name'];}_0x217bbd[_0xdc61('0x1f')](_0x5bb7e5)[_0xdc61('0x2d')](_0xfc12ac);};}exports[_0xdc61('0x2e')]=function(_0x5915b7,_0x45fa46){var _0x6305c1={'raw':![],'where':{'id':_0x5915b7[_0xdc61('0x2f')]['id']}},_0x593887={};_0x593887[_0xdc61('0x30')]=_[_0xdc61('0x31')](db[_0xdc61('0x32')][_0xdc61('0x33')]);_0x593887[_0xdc61('0x34')]=_[_0xdc61('0x31')](_0x5915b7['query']);_0x593887[_0xdc61('0x35')]=_['intersection'](_0x593887[_0xdc61('0x30')],_0x593887[_0xdc61('0x34')]);_0x6305c1[_0xdc61('0x36')]=_[_0xdc61('0x37')](_0x593887[_0xdc61('0x30')],qs[_0xdc61('0x38')](_0x5915b7[_0xdc61('0x34')]['fields']));_0x6305c1[_0xdc61('0x36')]=_0x6305c1[_0xdc61('0x36')][_0xdc61('0x39')]?_0x6305c1[_0xdc61('0x36')]:_0x593887[_0xdc61('0x30')];if(_0x5915b7['query'][_0xdc61('0x3a')]){_0x6305c1[_0xdc61('0x3b')]=[{'all':!![]}];}_0x6305c1=_[_0xdc61('0x3c')]({},_0x6305c1,_0x5915b7['options']);return db[_0xdc61('0x32')][_0xdc61('0x3d')](_0x6305c1)[_0xdc61('0x28')](handleEntityNotFound(_0x45fa46,null))[_0xdc61('0x28')](respondWithResult(_0x45fa46,null))[_0xdc61('0x3e')](handleError(_0x45fa46,null));};exports[_0xdc61('0x29')]=function(_0x45d9aa,_0x57fe16){return db[_0xdc61('0x32')]['find']({'where':{'id':_0x45d9aa[_0xdc61('0x2f')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x57fe16,null))[_0xdc61('0x28')](removeEntity(_0x57fe16,null))['catch'](handleError(_0x57fe16,null));};function widgetAttributes(_0x376271){try{switch(_0x376271[_0xdc61('0x3f')]){case _0xdc61('0x40'):return[{'name':'attrUrl','value':_0x376271['attrUrl']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x0]?_0x376271['attrs'][0x0]['value']:undefined)||_0xdc61('0x42')}];case _0xdc61('0x43'):return[{'name':_0xdc61('0x44'),'value':_0x376271['attrPath']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x0]?_0x376271[_0xdc61('0x41')][0x0][_0xdc61('0x45')]:undefined)||''}];case'clock':return[{'name':_0xdc61('0x46'),'value':_0x376271[_0xdc61('0x46')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x0]?_0x376271[_0xdc61('0x41')][0x0]['value']:undefined)||_0xdc61('0x47')},{'name':_0xdc61('0x48'),'value':_0x376271[_0xdc61('0x48')]||(_0x376271['attrs']&&_0x376271['attrs'][0x1]?_0x376271[_0xdc61('0x41')][0x1][_0xdc61('0x45')]:undefined)||_0xdc61('0x49')},{'name':_0xdc61('0x4a'),'value':_0x376271[_0xdc61('0x4a')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x2]?_0x376271[_0xdc61('0x41')][0x2]['value']:undefined)||0xc}];case _0xdc61('0x4b'):return[{'name':_0xdc61('0x4c'),'value':_0x376271[_0xdc61('0x4c')]||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x0]?_0x376271[_0xdc61('0x41')][0x0][_0xdc61('0x45')]:undefined)||_0xdc61('0x4d')},{'name':'attrVoiceQueues','value':_0x376271[_0xdc61('0x4e')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x1]?_0x376271[_0xdc61('0x41')][0x1][_0xdc61('0x45')]:undefined)||[]},{'name':_0xdc61('0x4a'),'value':_0x376271['attrFontSize']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x2]?_0x376271[_0xdc61('0x41')][0x2][_0xdc61('0x45')]:undefined)||0x14},{'name':_0xdc61('0x4f'),'value':_0x376271['attrChannel']||(_0x376271['attrs']&&_0x376271['attrs'][0x3]?_0x376271[_0xdc61('0x41')][0x3]['value']:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x376271['attrEmailAccounts']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x4]?_0x376271[_0xdc61('0x41')][0x4][_0xdc61('0x45')]:undefined)||''},{'name':_0xdc61('0x50'),'value':_0x376271[_0xdc61('0x50')]||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x5]?_0x376271[_0xdc61('0x41')][0x5][_0xdc61('0x45')]:undefined)||''},{'name':_0xdc61('0x51'),'value':_0x376271[_0xdc61('0x51')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x6]?_0x376271[_0xdc61('0x41')][0x6][_0xdc61('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x376271['attrOpenchannelAccounts']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x7]?_0x376271[_0xdc61('0x41')][0x7]['value']:undefined)||''},{'name':_0xdc61('0x52'),'value':_0x376271[_0xdc61('0x52')]||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x8]?_0x376271['attrs'][0x8][_0xdc61('0x45')]:undefined)||''},{'name':'attrChatWebsites','value':_0x376271[_0xdc61('0x53')]||(_0x376271['attrs']&&_0x376271['attrs'][0x9]?_0x376271[_0xdc61('0x41')][0x9][_0xdc61('0x45')]:undefined)||''}];case _0xdc61('0x54'):case _0xdc61('0x55'):return[{'name':_0xdc61('0x56'),'value':_0x376271['attrSerie1']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x0]?_0x376271[_0xdc61('0x41')][0x0]['value']:undefined)||_0xdc61('0x4d')},{'name':_0xdc61('0x57'),'value':_0x376271[_0xdc61('0x57')]||(_0x376271['attrs']&&_0x376271['attrs'][0x1]?_0x376271[_0xdc61('0x41')][0x1][_0xdc61('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x376271[_0xdc61('0x58')]||(_0x376271['attrs']&&_0x376271[_0xdc61('0x41')][0x2]?_0x376271[_0xdc61('0x41')][0x2][_0xdc61('0x45')]:undefined)||null},{'name':_0xdc61('0x4e'),'value':_0x376271['attrVoiceQueues']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x3]?_0x376271[_0xdc61('0x41')][0x3]['value']:undefined)||[]},{'name':_0xdc61('0x4f'),'value':_0x376271[_0xdc61('0x4f')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x4]?_0x376271[_0xdc61('0x41')][0x4][_0xdc61('0x45')]:undefined)||'voice'},{'name':_0xdc61('0x59'),'value':_0x376271['attrEmailAccounts']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x5]?_0x376271[_0xdc61('0x41')][0x5]['value']:undefined)||''},{'name':_0xdc61('0x50'),'value':_0x376271[_0xdc61('0x50')]||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x6]?_0x376271[_0xdc61('0x41')][0x6][_0xdc61('0x45')]:undefined)||''},{'name':_0xdc61('0x51'),'value':_0x376271['attrSmsAccounts']||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x7]?_0x376271['attrs'][0x7][_0xdc61('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x376271[_0xdc61('0x5a')]||(_0x376271['attrs']&&_0x376271[_0xdc61('0x41')][0x8]?_0x376271[_0xdc61('0x41')][0x8][_0xdc61('0x45')]:undefined)||''},{'name':_0xdc61('0x52'),'value':_0x376271[_0xdc61('0x52')]||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x9]?_0x376271[_0xdc61('0x41')][0x9][_0xdc61('0x45')]:undefined)||''},{'name':_0xdc61('0x53'),'value':_0x376271[_0xdc61('0x53')]||(_0x376271['attrs']&&_0x376271[_0xdc61('0x41')][0xa]?_0x376271[_0xdc61('0x41')][0xa][_0xdc61('0x45')]:undefined)||''}];case _0xdc61('0x5b'):return[{'name':_0xdc61('0x5c'),'type':_0x376271['reportType']||(_0x376271['attrs']&&_0x376271[_0xdc61('0x41')][0x0]?_0x376271[_0xdc61('0x41')][0x0][_0xdc61('0x3f')]:undefined)||null,'value':_0x376271['attrReport']||(_0x376271[_0xdc61('0x41')]&&_0x376271['attrs'][0x0]?_0x376271[_0xdc61('0x41')][0x0]['value']:undefined)||null},{'name':_0xdc61('0x5d'),'value':_0x376271[_0xdc61('0x5d')]||(_0x376271[_0xdc61('0x41')]&&_0x376271[_0xdc61('0x41')][0x1]?_0x376271[_0xdc61('0x41')][0x1][_0xdc61('0x45')]:undefined)||0x0}];default:return[];}}catch(_0xe446ec){logger[_0xdc61('0x2a')](_0xdc61('0x5e'),JSON[_0xdc61('0x5f')](_0xe446ec));return[];}}exports[_0xdc61('0x60')]=function(_0x561d90,_0x1421d6){if(_0x561d90['body']){_0x561d90['body'][_0xdc61('0x41')]=widgetAttributes(_0x561d90['body']);}return db[_0xdc61('0x32')][_0xdc61('0x60')](_0x561d90[_0xdc61('0x61')],{})['then'](respondWithResult(_0x1421d6,0xc9))[_0xdc61('0x3e')](handleError(_0x1421d6,null));};exports[_0xdc61('0x27')]=function(_0x344307,_0xd47102){if(_0x344307[_0xdc61('0x61')]['id']){delete _0x344307['body']['id'];}_0x344307[_0xdc61('0x61')]['attrs']=widgetAttributes(_0x344307[_0xdc61('0x61')]);return db['DashboardItem'][_0xdc61('0x3d')]({'where':{'id':_0x344307['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0xd47102,null))[_0xdc61('0x28')](saveUpdates(_0x344307[_0xdc61('0x61')],null))['then'](respondWithResult(_0xd47102,null))[_0xdc61('0x3e')](handleError(_0xd47102,null));}; \ No newline at end of file +var _0xfba8=['apply','reject','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','destroy','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2f64d5,_0x2e5ad3){var _0x5dd553=function(_0x14fb61){while(--_0x14fb61){_0x2f64d5['push'](_0x2f64d5['shift']());}};_0x5dd553(++_0x2e5ad3);}(_0xfba8,0x1d6));var _0x8fba=function(_0x370781,_0x50f0b1){_0x370781=_0x370781-0x0;var _0x106c8b=_0xfba8[_0x370781];return _0x106c8b;};'use strict';var emlformat=require(_0x8fba('0x0'));var rimraf=require(_0x8fba('0x1'));var zipdir=require(_0x8fba('0x2'));var jsonpatch=require(_0x8fba('0x3'));var rp=require(_0x8fba('0x4'));var moment=require(_0x8fba('0x5'));var BPromise=require(_0x8fba('0x6'));var Mustache=require(_0x8fba('0x7'));var util=require(_0x8fba('0x8'));var path=require('path');var sox=require(_0x8fba('0x9'));var csv=require('to-csv');var ejs=require(_0x8fba('0xa'));var fs=require('fs');var fs_extra=require(_0x8fba('0xb'));var _=require(_0x8fba('0xc'));var squel=require(_0x8fba('0xd'));var crypto=require(_0x8fba('0xe'));var jsforce=require(_0x8fba('0xf'));var deskjs=require(_0x8fba('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8fba('0x11'));var Papa=require('papaparse');var Redis=require(_0x8fba('0x12'));var authService=require(_0x8fba('0x13'));var qs=require(_0x8fba('0x14'));var as=require(_0x8fba('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fba('0x16'))(_0x8fba('0x17'));var utils=require('../../config/utils');var config=require(_0x8fba('0x18'));var licenseUtil=require(_0x8fba('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8fba('0x1a')](config['redis'],{'host':_0x8fba('0x1b'),'port':0x18eb});var socket=require(_0x8fba('0x1c'))(new Redis(config[_0x8fba('0x1d')]));require(_0x8fba('0x1e'))[_0x8fba('0x1f')](socket);function respondWithStatusCode(_0x3029c4,_0x5efa9e){_0x5efa9e=_0x5efa9e||0xcc;return function(_0x54b4d1){if(_0x54b4d1){return _0x3029c4[_0x8fba('0x20')](_0x5efa9e);}return _0x3029c4[_0x8fba('0x21')](_0x5efa9e)[_0x8fba('0x22')]();};}function respondWithResult(_0x56cc5,_0x259c3e){_0x259c3e=_0x259c3e||0xc8;return function(_0x2eeaef){if(_0x2eeaef){return _0x56cc5['status'](_0x259c3e)[_0x8fba('0x23')](_0x2eeaef);}};}function respondWithFilteredResult(_0x389d8a,_0x2b7456){return function(_0x3194e7){if(_0x3194e7){var _0x37a826=typeof _0x2b7456[_0x8fba('0x24')]===_0x8fba('0x25')&&typeof _0x2b7456[_0x8fba('0x26')]==='undefined';var _0x2564cc=_0x3194e7[_0x8fba('0x27')];var _0x7beb17=_0x37a826?0x0:_0x2b7456[_0x8fba('0x24')];var _0x9479d3=_0x37a826?_0x3194e7['count']:_0x2b7456[_0x8fba('0x24')]+_0x2b7456[_0x8fba('0x26')];var _0x532406;if(_0x9479d3>=_0x2564cc){_0x9479d3=_0x2564cc;_0x532406=0xc8;}else{_0x532406=0xce;}_0x389d8a[_0x8fba('0x21')](_0x532406);return _0x389d8a['set']('Content-Range',_0x7beb17+'-'+_0x9479d3+'/'+_0x2564cc)[_0x8fba('0x23')](_0x3194e7);}return null;};}function patchUpdates(_0x5bc97a){return function(_0x245845){try{jsonpatch[_0x8fba('0x28')](_0x245845,_0x5bc97a,!![]);}catch(_0x393f24){return BPromise[_0x8fba('0x29')](_0x393f24);}return _0x245845['save']();};}function saveUpdates(_0x31eaee,_0x35dc65){return function(_0x316f18){if(_0x316f18){return _0x316f18['update'](_0x31eaee)[_0x8fba('0x2a')](function(_0x5030c4){return _0x5030c4;});}return null;};}function removeEntity(_0x35e22e,_0x11bcd6){return function(_0x948150){if(_0x948150){return _0x948150['destroy']()['then'](function(){_0x35e22e[_0x8fba('0x21')](0xcc)[_0x8fba('0x22')]();});}};}function handleEntityNotFound(_0x4a128c,_0x241d9b){return function(_0x964d27){if(!_0x964d27){_0x4a128c[_0x8fba('0x20')](0x194);}return _0x964d27;};}function handleError(_0x4e9209,_0x4ac126){_0x4ac126=_0x4ac126||0x1f4;return function(_0x877157){logger[_0x8fba('0x2b')](_0x877157[_0x8fba('0x2c')]);if(_0x877157[_0x8fba('0x2d')]){delete _0x877157[_0x8fba('0x2d')];}_0x4e9209[_0x8fba('0x21')](_0x4ac126)[_0x8fba('0x2e')](_0x877157);};}exports[_0x8fba('0x2f')]=function(_0x5bec19,_0x16baa3){var _0x4cf857={'raw':![],'where':{'id':_0x5bec19[_0x8fba('0x30')]['id']}},_0x3774a0={};_0x3774a0[_0x8fba('0x31')]=_[_0x8fba('0x32')](db[_0x8fba('0x33')][_0x8fba('0x34')]);_0x3774a0[_0x8fba('0x35')]=_['keys'](_0x5bec19['query']);_0x3774a0[_0x8fba('0x36')]=_[_0x8fba('0x37')](_0x3774a0[_0x8fba('0x31')],_0x3774a0[_0x8fba('0x35')]);_0x4cf857['attributes']=_[_0x8fba('0x37')](_0x3774a0[_0x8fba('0x31')],qs[_0x8fba('0x38')](_0x5bec19[_0x8fba('0x35')][_0x8fba('0x38')]));_0x4cf857[_0x8fba('0x39')]=_0x4cf857[_0x8fba('0x39')][_0x8fba('0x3a')]?_0x4cf857[_0x8fba('0x39')]:_0x3774a0[_0x8fba('0x31')];if(_0x5bec19[_0x8fba('0x35')][_0x8fba('0x3b')]){_0x4cf857[_0x8fba('0x3c')]=[{'all':!![]}];}_0x4cf857=_[_0x8fba('0x3d')]({},_0x4cf857,_0x5bec19[_0x8fba('0x3e')]);return db[_0x8fba('0x33')]['find'](_0x4cf857)[_0x8fba('0x2a')](handleEntityNotFound(_0x16baa3,null))[_0x8fba('0x2a')](respondWithResult(_0x16baa3,null))[_0x8fba('0x3f')](handleError(_0x16baa3,null));};exports[_0x8fba('0x40')]=function(_0x126842,_0x4b73a0){return db[_0x8fba('0x33')][_0x8fba('0x41')]({'where':{'id':_0x126842[_0x8fba('0x30')]['id']}})[_0x8fba('0x2a')](handleEntityNotFound(_0x4b73a0,null))['then'](removeEntity(_0x4b73a0,null))[_0x8fba('0x3f')](handleError(_0x4b73a0,null));};function widgetAttributes(_0x498ade){try{switch(_0x498ade[_0x8fba('0x42')]){case _0x8fba('0x43'):return[{'name':_0x8fba('0x44'),'value':_0x498ade[_0x8fba('0x44')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade['attrs'][0x0][_0x8fba('0x46')]:undefined)||_0x8fba('0x47')}];case _0x8fba('0x48'):return[{'name':_0x8fba('0x49'),'value':_0x498ade[_0x8fba('0x49')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade[_0x8fba('0x45')][0x0][_0x8fba('0x46')]:undefined)||''}];case _0x8fba('0x4a'):return[{'name':_0x8fba('0x4b'),'value':_0x498ade[_0x8fba('0x4b')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade[_0x8fba('0x45')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x8fba('0x4c'),'value':_0x498ade[_0x8fba('0x4c')]||(_0x498ade['attrs']&&_0x498ade[_0x8fba('0x45')][0x1]?_0x498ade['attrs'][0x1]['value']:undefined)||_0x8fba('0x4d')},{'name':_0x8fba('0x4e'),'value':_0x498ade[_0x8fba('0x4e')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x2]?_0x498ade[_0x8fba('0x45')][0x2][_0x8fba('0x46')]:undefined)||0xc}];case _0x8fba('0x4f'):return[{'name':_0x8fba('0x50'),'value':_0x498ade['attrMetric']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade[_0x8fba('0x45')][0x0][_0x8fba('0x46')]:undefined)||_0x8fba('0x51')},{'name':'attrVoiceQueues','value':_0x498ade[_0x8fba('0x52')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x1]?_0x498ade['attrs'][0x1][_0x8fba('0x46')]:undefined)||[]},{'name':'attrFontSize','value':_0x498ade[_0x8fba('0x4e')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x2]?_0x498ade[_0x8fba('0x45')][0x2][_0x8fba('0x46')]:undefined)||0x14},{'name':_0x8fba('0x53'),'value':_0x498ade[_0x8fba('0x53')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x3]?_0x498ade['attrs'][0x3][_0x8fba('0x46')]:undefined)||'voice'},{'name':_0x8fba('0x54'),'value':_0x498ade[_0x8fba('0x54')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x4]?_0x498ade[_0x8fba('0x45')][0x4][_0x8fba('0x46')]:undefined)||''},{'name':_0x8fba('0x55'),'value':_0x498ade[_0x8fba('0x55')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x5]?_0x498ade['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x498ade[_0x8fba('0x56')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x6]?_0x498ade['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x498ade[_0x8fba('0x57')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x7]?_0x498ade['attrs'][0x7][_0x8fba('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x498ade[_0x8fba('0x58')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x8]?_0x498ade[_0x8fba('0x45')][0x8][_0x8fba('0x46')]:undefined)||''},{'name':_0x8fba('0x59'),'value':_0x498ade[_0x8fba('0x59')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x9]?_0x498ade['attrs'][0x9][_0x8fba('0x46')]:undefined)||''}];case _0x8fba('0x5a'):case'pie-chart':return[{'name':_0x8fba('0x5b'),'value':_0x498ade['attrSerie1']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x0]?_0x498ade['attrs'][0x0][_0x8fba('0x46')]:undefined)||'total'},{'name':_0x8fba('0x5c'),'value':_0x498ade[_0x8fba('0x5c')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x1]?_0x498ade[_0x8fba('0x45')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x498ade[_0x8fba('0x5d')]||(_0x498ade['attrs']&&_0x498ade[_0x8fba('0x45')][0x2]?_0x498ade[_0x8fba('0x45')][0x2]['value']:undefined)||null},{'name':_0x8fba('0x52'),'value':_0x498ade[_0x8fba('0x52')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x3]?_0x498ade['attrs'][0x3][_0x8fba('0x46')]:undefined)||[]},{'name':_0x8fba('0x53'),'value':_0x498ade['attrChannel']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x4]?_0x498ade[_0x8fba('0x45')][0x4][_0x8fba('0x46')]:undefined)||'voice'},{'name':_0x8fba('0x54'),'value':_0x498ade[_0x8fba('0x54')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x5]?_0x498ade[_0x8fba('0x45')][0x5][_0x8fba('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x498ade['attrFaxAccounts']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x6]?_0x498ade['attrs'][0x6]['value']:undefined)||''},{'name':_0x8fba('0x56'),'value':_0x498ade['attrSmsAccounts']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x7]?_0x498ade[_0x8fba('0x45')][0x7][_0x8fba('0x46')]:undefined)||''},{'name':_0x8fba('0x57'),'value':_0x498ade['attrOpenchannelAccounts']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x8]?_0x498ade[_0x8fba('0x45')][0x8][_0x8fba('0x46')]:undefined)||''},{'name':_0x8fba('0x58'),'value':_0x498ade[_0x8fba('0x58')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x9]?_0x498ade['attrs'][0x9][_0x8fba('0x46')]:undefined)||''},{'name':_0x8fba('0x59'),'value':_0x498ade[_0x8fba('0x59')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0xa]?_0x498ade[_0x8fba('0x45')][0xa]['value']:undefined)||''}];case _0x8fba('0x5e'):return[{'name':_0x8fba('0x5f'),'type':_0x498ade['reportType']||(_0x498ade['attrs']&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade[_0x8fba('0x45')][0x0][_0x8fba('0x42')]:undefined)||null,'value':_0x498ade['attrReport']||(_0x498ade[_0x8fba('0x45')]&&_0x498ade[_0x8fba('0x45')][0x0]?_0x498ade[_0x8fba('0x45')][0x0][_0x8fba('0x46')]:undefined)||null},{'name':_0x8fba('0x60'),'value':_0x498ade[_0x8fba('0x60')]||(_0x498ade[_0x8fba('0x45')]&&_0x498ade['attrs'][0x1]?_0x498ade['attrs'][0x1][_0x8fba('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x2b1868){logger[_0x8fba('0x2b')](_0x8fba('0x61'),JSON[_0x8fba('0x62')](_0x2b1868));return[];}}exports[_0x8fba('0x63')]=function(_0x4ee1c9,_0x4f849a){if(_0x4ee1c9['body']){_0x4ee1c9['body'][_0x8fba('0x45')]=widgetAttributes(_0x4ee1c9[_0x8fba('0x64')]);}return db['DashboardItem'][_0x8fba('0x63')](_0x4ee1c9['body'],{})[_0x8fba('0x2a')](respondWithResult(_0x4f849a,0xc9))[_0x8fba('0x3f')](handleError(_0x4f849a,null));};exports[_0x8fba('0x65')]=function(_0x1ef8fb,_0x52e18c){if(_0x1ef8fb[_0x8fba('0x64')]['id']){delete _0x1ef8fb[_0x8fba('0x64')]['id'];}_0x1ef8fb[_0x8fba('0x64')][_0x8fba('0x45')]=widgetAttributes(_0x1ef8fb[_0x8fba('0x64')]);return db[_0x8fba('0x33')]['find']({'where':{'id':_0x1ef8fb[_0x8fba('0x30')]['id']}})[_0x8fba('0x2a')](handleEntityNotFound(_0x52e18c,null))['then'](saveUpdates(_0x1ef8fb[_0x8fba('0x64')],null))[_0x8fba('0x2a')](respondWithResult(_0x52e18c,null))[_0x8fba('0x3f')](handleError(_0x52e18c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 13535a6..6bae2b5 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 _0x4fcd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x45ec0b,_0x260c5d){var _0x99a3d8=function(_0x524391){while(--_0x524391){_0x45ec0b['push'](_0x45ec0b['shift']());}};_0x99a3d8(++_0x260c5d);}(_0x4fcd,0x1ca));var _0xd4fc=function(_0x1d903c,_0x54e286){_0x1d903c=_0x1d903c-0x0;var _0x5c0d58=_0x4fcd[_0x1d903c];return _0x5c0d58;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd4fc('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd4fc('0x1')](0x0);var events={'afterCreate':_0xd4fc('0x2'),'afterUpdate':_0xd4fc('0x3'),'afterDestroy':_0xd4fc('0x4')};function emitEvent(_0x58dd47){return function(_0x50a137,_0x2b8171,_0x2ae825){DashboardItemEvents[_0xd4fc('0x5')](_0x58dd47+':'+_0x50a137['id'],_0x50a137);DashboardItemEvents[_0xd4fc('0x5')](_0x58dd47,_0x50a137);_0x2ae825(null);};}for(var e in events){if(events[_0xd4fc('0x6')](e)){var event=events[e];DashboardItem[_0xd4fc('0x7')](e,emitEvent(event));}}module[_0xd4fc('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x940d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x940d,0x74));var _0xd940=function(_0xef8da7,_0x1e96eb){_0xef8da7=_0xef8da7-0x0;var _0x34a43a=_0x940d[_0xef8da7];return _0x34a43a;};'use strict';var EventEmitter=require(_0xd940('0x0'));var DashboardItem=require(_0xd940('0x1'))['db'][_0xd940('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd940('0x3')](0x0);var events={'afterCreate':_0xd940('0x4'),'afterUpdate':_0xd940('0x5'),'afterDestroy':_0xd940('0x6')};function emitEvent(_0x51d3e5){return function(_0x935e80,_0x59933d,_0x76d1d9){DashboardItemEvents[_0xd940('0x7')](_0x51d3e5+':'+_0x935e80['id'],_0x935e80);DashboardItemEvents[_0xd940('0x7')](_0x51d3e5,_0x935e80);_0x76d1d9(null);};}for(var e in events){if(events[_0xd940('0x8')](e)){var event=events[e];DashboardItem[_0xd940('0x9')](e,emitEvent(event));}}module[_0xd940('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index b64233a..4be76ac 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 _0xe79a=['../../config/environment','./dashboardItem.attributes','exports','define','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3d9d55,_0xb0c76e){var _0x1a6eb4=function(_0x90a2c6){while(--_0x90a2c6){_0x3d9d55['push'](_0x3d9d55['shift']());}};_0x1a6eb4(++_0xb0c76e);}(_0xe79a,0x70));var _0xae79=function(_0x331085,_0x46ef3b){_0x331085=_0x331085-0x0;var _0x1547f4=_0xe79a[_0x331085];return _0x1547f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae79('0x0'))('api');var moment=require(_0xae79('0x1'));var BPromise=require(_0xae79('0x2'));var rp=require(_0xae79('0x3'));var fs=require('fs');var path=require(_0xae79('0x4'));var rimraf=require('rimraf');var config=require(_0xae79('0x5'));var attributes=require(_0xae79('0x6'));module[_0xae79('0x7')]=function(_0x590be7,_0x1a9185){return _0x590be7[_0xae79('0x8')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6005=['request-promise','rimraf','./dashboardItem.attributes','exports','define','dashboard_items','lodash','moment','bluebird'];(function(_0x235aa0,_0x213b3c){var _0x237c53=function(_0x4b1e27){while(--_0x4b1e27){_0x235aa0['push'](_0x235aa0['shift']());}};_0x237c53(++_0x213b3c);}(_0x6005,0x1c8));var _0x5600=function(_0x1c212a,_0x512bd1){_0x1c212a=_0x1c212a-0x0;var _0x18c6f2=_0x6005[_0x1c212a];return _0x18c6f2;};'use strict';var _=require(_0x5600('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5600('0x1'));var BPromise=require(_0x5600('0x2'));var rp=require(_0x5600('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5600('0x4'));var config=require('../../config/environment');var attributes=require(_0x5600('0x5'));module[_0x5600('0x6')]=function(_0x2df798,_0x43912f){return _0x2df798[_0x5600('0x7')]('DashboardItem',attributes,{'tableName':_0x5600('0x8'),'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 693648d..cbe367d 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 _0xb22b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util','moment','bluebird'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0xb22b,0x6c));var _0xbb22=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb22b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbb22('0x0'));var util=require(_0xbb22('0x1'));var moment=require(_0xbb22('0x2'));var BPromise=require(_0xbb22('0x3'));var rs=require(_0xbb22('0x4'));var fs=require('fs');var Redis=require(_0xbb22('0x5'));var db=require(_0xbb22('0x6'))['db'];var utils=require(_0xbb22('0x7'));var logger=require(_0xbb22('0x8'))(_0xbb22('0x9'));var config=require(_0xbb22('0xa'));var jayson=require(_0xbb22('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbb22('0xc')](config[_0xbb22('0xd')],{'host':_0xbb22('0xe'),'port':0x18eb});var socket=require(_0xbb22('0xf'))(new Redis(config['redis']));require(_0xbb22('0x10'))[_0xbb22('0x11')](socket);function respondWithRpcPromise(_0x5a059d,_0x5d9dc4,_0x39e71b){return new BPromise(function(_0xfa9639,_0x57b400){return client[_0xbb22('0x12')](_0x5a059d,_0x39e71b)['then'](function(_0x42ce96){logger[_0xbb22('0x13')](_0xbb22('0x14'),_0x5d9dc4,_0xbb22('0x15'));logger[_0xbb22('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5d9dc4,_0xbb22('0x15'),JSON[_0xbb22('0x17')](_0x42ce96));if(_0x42ce96['error']){if(_0x42ce96['error'][_0xbb22('0x18')]===0x1f4){logger['error'](_0xbb22('0x14'),_0x5d9dc4,_0x42ce96[_0xbb22('0x19')][_0xbb22('0x1a')]);return _0x57b400(_0x42ce96[_0xbb22('0x19')]['message']);}logger[_0xbb22('0x19')](_0xbb22('0x14'),_0x5d9dc4,_0x42ce96[_0xbb22('0x19')]['message']);return _0xfa9639(_0x42ce96[_0xbb22('0x19')][_0xbb22('0x1a')]);}else{logger['info'](_0xbb22('0x14'),_0x5d9dc4,_0xbb22('0x15'));_0xfa9639(_0x42ce96['result'][_0xbb22('0x1a')]);}})[_0xbb22('0x1b')](function(_0x584838){logger[_0xbb22('0x19')]('DashboardItem,\x20%s,\x20%s',_0x5d9dc4,_0x584838);_0x57b400(_0x584838);});});} \ No newline at end of file +var _0x1b9c=['result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1b9c,0x120));var _0xc1b9=function(_0x4fb38d,_0x341c33){_0x4fb38d=_0x4fb38d-0x0;var _0xeaf9ab=_0x1b9c[_0x4fb38d];return _0xeaf9ab;};'use strict';var _=require('lodash');var util=require(_0xc1b9('0x0'));var moment=require(_0xc1b9('0x1'));var BPromise=require(_0xc1b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1b9('0x3'))['db'];var utils=require(_0xc1b9('0x4'));var logger=require('../../config/logger')(_0xc1b9('0x5'));var config=require('../../config/environment');var jayson=require(_0xc1b9('0x6'));var client=jayson[_0xc1b9('0x7')]['http']({'port':0x232a});config['redis']=_[_0xc1b9('0x8')](config[_0xc1b9('0x9')],{'host':_0xc1b9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc1b9('0xb'))[_0xc1b9('0xc')](socket);function respondWithRpcPromise(_0x5202af,_0x443f5c,_0x193392){return new BPromise(function(_0x25c0d2,_0x4307ff){return client[_0xc1b9('0xd')](_0x5202af,_0x193392)[_0xc1b9('0xe')](function(_0x257c77){logger[_0xc1b9('0xf')]('DashboardItem,\x20%s,\x20%s',_0x443f5c,_0xc1b9('0x10'));logger[_0xc1b9('0x11')](_0xc1b9('0x12'),_0x443f5c,_0xc1b9('0x10'),JSON[_0xc1b9('0x13')](_0x257c77));if(_0x257c77[_0xc1b9('0x14')]){if(_0x257c77['error'][_0xc1b9('0x15')]===0x1f4){logger[_0xc1b9('0x14')]('DashboardItem,\x20%s,\x20%s',_0x443f5c,_0x257c77[_0xc1b9('0x14')]['message']);return _0x4307ff(_0x257c77[_0xc1b9('0x14')][_0xc1b9('0x16')]);}logger[_0xc1b9('0x14')](_0xc1b9('0x17'),_0x443f5c,_0x257c77[_0xc1b9('0x14')][_0xc1b9('0x16')]);return _0x25c0d2(_0x257c77[_0xc1b9('0x14')][_0xc1b9('0x16')]);}else{logger[_0xc1b9('0xf')]('DashboardItem,\x20%s,\x20%s',_0x443f5c,_0xc1b9('0x10'));_0x25c0d2(_0x257c77[_0xc1b9('0x18')][_0xc1b9('0x16')]);}})[_0xc1b9('0x19')](function(_0x1737db){logger['error']('DashboardItem,\x20%s,\x20%s',_0x443f5c,_0x1737db);_0x4307ff(_0x1737db);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d9f1c27..55a8bf8 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 _0x5cdd=['emit','length','dashboardItem:','save','remove'];(function(_0x162ec2,_0xd573ef){var _0x3ff0fc=function(_0x45f3cd){while(--_0x45f3cd){_0x162ec2['push'](_0x162ec2['shift']());}};_0x3ff0fc(++_0xd573ef);}(_0x5cdd,0x12a));var _0xd5cd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5cdd[_0xfae23b];return _0x200640;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xd5cd('0x0'),_0xd5cd('0x1'),'update'];function createListener(_0x17e399,_0x3ce05e){return function(_0x8552cc){_0x3ce05e[_0xd5cd('0x2')](_0x17e399,_0x8552cc);};}function removeListener(_0x2c5981,_0x195231){return function(){DashboardItemEvents['removeListener'](_0x2c5981,_0x195231);};}exports['register']=function(_0x745beb){for(var _0x5ea99c=0x0,_0x47e230=events[_0xd5cd('0x3')];_0x5ea99c<_0x47e230;_0x5ea99c++){var _0x3f5199=events[_0x5ea99c];var _0x529b73=createListener(_0xd5cd('0x4')+_0x3f5199,_0x745beb);DashboardItemEvents['on'](_0x3f5199,_0x529b73);}}; \ No newline at end of file +var _0x54b4=['removeListener','register','length','./dashboardItem.events','update','emit'];(function(_0x31506d,_0xbe2756){var _0x1a3299=function(_0x5e1fa7){while(--_0x5e1fa7){_0x31506d['push'](_0x31506d['shift']());}};_0x1a3299(++_0xbe2756);}(_0x54b4,0xe1));var _0x454b=function(_0x17608e,_0x250fb7){_0x17608e=_0x17608e-0x0;var _0x3150d0=_0x54b4[_0x17608e];return _0x3150d0;};'use strict';var DashboardItemEvents=require(_0x454b('0x0'));var events=['save','remove',_0x454b('0x1')];function createListener(_0x5905cc,_0x47005d){return function(_0x36acd1){_0x47005d[_0x454b('0x2')](_0x5905cc,_0x36acd1);};}function removeListener(_0x3fab8b,_0x54a44d){return function(){DashboardItemEvents[_0x454b('0x3')](_0x3fab8b,_0x54a44d);};}exports[_0x454b('0x4')]=function(_0x5c243b){for(var _0x1fdd9e=0x0,_0x30a975=events[_0x454b('0x5')];_0x1fdd9e<_0x30a975;_0x1fdd9e++){var _0x111d76=events[_0x1fdd9e];var _0x1fe2c5=createListener('dashboardItem:'+_0x111d76,_0x5c243b);DashboardItemEvents['on'](_0x111d76,_0x1fe2c5);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index df1e4e4..7e54aef 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 _0x8e76=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','put','destroy','multer','util','path'];(function(_0x508019,_0x107804){var _0x16486c=function(_0x4f90fd){while(--_0x4f90fd){_0x508019['push'](_0x508019['shift']());}};_0x16486c(++_0x107804);}(_0x8e76,0x13d));var _0x68e7=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8e76[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var path=require(_0x68e7('0x2'));var timeout=require(_0x68e7('0x3'));var express=require(_0x68e7('0x4'));var router=express[_0x68e7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x68e7('0x6'));var interaction=require(_0x68e7('0x7'));var config=require(_0x68e7('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0x68e7('0x9'),auth[_0x68e7('0xa')](),controller[_0x68e7('0xb')]);router[_0x68e7('0xc')]('/',auth[_0x68e7('0xa')](),controller[_0x68e7('0xd')]);router[_0x68e7('0xe')](_0x68e7('0x9'),auth[_0x68e7('0xa')](),controller['update']);router['delete'](_0x68e7('0x9'),auth[_0x68e7('0xa')](),controller[_0x68e7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcccd=['show','post','create','update','exports','multer','util','connect-timeout','express','fs-extra','get','/:id','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xcccd,0x1bf));var _0xdccc=function(_0x1e3f14,_0x18c586){_0x1e3f14=_0x1e3f14-0x0;var _0x60e5b5=_0xcccd[_0x1e3f14];return _0x60e5b5;};'use strict';var multer=require(_0xdccc('0x0'));var util=require(_0xdccc('0x1'));var path=require('path');var timeout=require(_0xdccc('0x2'));var express=require(_0xdccc('0x3'));var router=express['Router']();var fs_extra=require(_0xdccc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xdccc('0x5')](_0xdccc('0x6'),auth[_0xdccc('0x7')](),controller[_0xdccc('0x8')]);router[_0xdccc('0x9')]('/',auth[_0xdccc('0x7')](),controller[_0xdccc('0xa')]);router['put'](_0xdccc('0x6'),auth[_0xdccc('0x7')](),controller[_0xdccc('0xb')]);router['delete'](_0xdccc('0x6'),auth[_0xdccc('0x7')](),controller['destroy']);module[_0xdccc('0xc')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index fbdc197..e56461c 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 _0x50a3=['STRING','first','second','third','sequelize','exports'];(function(_0x373263,_0x44ce04){var _0x3ff19c=function(_0x44345d){while(--_0x44345d){_0x373263['push'](_0x373263['shift']());}};_0x3ff19c(++_0x44ce04);}(_0x50a3,0x11e));var _0x350a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x50a3[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x350a('0x0'));module[_0x350a('0x1')]={'name':{'type':Sequelize[_0x350a('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x350a('0x3'),_0x350a('0x4'),_0x350a('0x5')),'allowNull':![],'defaultValue':_0x350a('0x3')},'description':{'type':Sequelize[_0x350a('0x2')]}}; \ No newline at end of file +var _0x412d=['exports','STRING','second','third','first','sequelize'];(function(_0xdfef8c,_0x1692fe){var _0x3a16f9=function(_0x31bd85){while(--_0x31bd85){_0xdfef8c['push'](_0xdfef8c['shift']());}};_0x3a16f9(++_0x1692fe);}(_0x412d,0x155));var _0xd412=function(_0x12d33e,_0x3118d5){_0x12d33e=_0x12d33e-0x0;var _0xcddb24=_0x412d[_0x12d33e];return _0xcddb24;};'use strict';var Sequelize=require(_0xd412('0x0'));module[_0xd412('0x1')]={'name':{'type':Sequelize[_0xd412('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xd412('0x3'),_0xd412('0x4')),'allowNull':![],'defaultValue':_0xd412('0x5')},'description':{'type':Sequelize[_0xd412('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 05ad5a3..1278575 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 _0x0af5=['../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','Disposition','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','update','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x3d3379,_0x4c9bc1){var _0x358633=function(_0x54510c){while(--_0x54510c){_0x3d3379['push'](_0x3d3379['shift']());}};_0x358633(++_0x4c9bc1);}(_0x0af5,0x180));var _0x50af=function(_0x3143a3,_0x3936d9){_0x3143a3=_0x3143a3-0x0;var _0x22164e=_0x0af5[_0x3143a3];return _0x22164e;};'use strict';var emlformat=require(_0x50af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x50af('0x1'));var jsonpatch=require(_0x50af('0x2'));var rp=require(_0x50af('0x3'));var moment=require(_0x50af('0x4'));var BPromise=require(_0x50af('0x5'));var Mustache=require(_0x50af('0x6'));var util=require(_0x50af('0x7'));var path=require(_0x50af('0x8'));var sox=require(_0x50af('0x9'));var csv=require(_0x50af('0xa'));var ejs=require(_0x50af('0xb'));var fs=require('fs');var fs_extra=require(_0x50af('0xc'));var _=require(_0x50af('0xd'));var squel=require(_0x50af('0xe'));var crypto=require(_0x50af('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x50af('0x10'));var toCsv=require(_0x50af('0xa'));var querystring=require(_0x50af('0x11'));var Papa=require(_0x50af('0x12'));var Redis=require(_0x50af('0x13'));var authService=require(_0x50af('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50af('0x15'));var logger=require(_0x50af('0x16'))(_0x50af('0x17'));var utils=require(_0x50af('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x50af('0x19'));var db=require(_0x50af('0x1a'))['db'];function respondWithStatusCode(_0x4b4c75,_0x2e1f2d){_0x2e1f2d=_0x2e1f2d||0xcc;return function(_0x1c73d4){if(_0x1c73d4){return _0x4b4c75['sendStatus'](_0x2e1f2d);}return _0x4b4c75[_0x50af('0x1b')](_0x2e1f2d)[_0x50af('0x1c')]();};}function respondWithResult(_0x41813c,_0x5beb89){_0x5beb89=_0x5beb89||0xc8;return function(_0x4151f6){if(_0x4151f6){return _0x41813c[_0x50af('0x1b')](_0x5beb89)[_0x50af('0x1d')](_0x4151f6);}};}function respondWithFilteredResult(_0x656e77,_0xf42c83){return function(_0x104315){if(_0x104315){var _0x48e5a4=typeof _0xf42c83[_0x50af('0x1e')]===_0x50af('0x1f')&&typeof _0xf42c83['limit']===_0x50af('0x1f');var _0x4491c8=_0x104315['count'];var _0x4725f0=_0x48e5a4?0x0:_0xf42c83['offset'];var _0x6567e3=_0x48e5a4?_0x104315[_0x50af('0x20')]:_0xf42c83[_0x50af('0x1e')]+_0xf42c83[_0x50af('0x21')];var _0x130738;if(_0x6567e3>=_0x4491c8){_0x6567e3=_0x4491c8;_0x130738=0xc8;}else{_0x130738=0xce;}_0x656e77['status'](_0x130738);return _0x656e77[_0x50af('0x22')]('Content-Range',_0x4725f0+'-'+_0x6567e3+'/'+_0x4491c8)[_0x50af('0x1d')](_0x104315);}return null;};}function patchUpdates(_0xefe6f6){return function(_0x123d13){try{jsonpatch['apply'](_0x123d13,_0xefe6f6,!![]);}catch(_0x5b9796){return BPromise[_0x50af('0x23')](_0x5b9796);}return _0x123d13[_0x50af('0x24')]();};}function saveUpdates(_0x29d6a2,_0x1088b0){return function(_0x50df44){if(_0x50df44){return _0x50df44['update'](_0x29d6a2)[_0x50af('0x25')](function(_0x4d9a57){return _0x4d9a57;});}return null;};}function removeEntity(_0x27e8f0,_0x842c39){return function(_0x4bb6b3){if(_0x4bb6b3){return _0x4bb6b3[_0x50af('0x26')]()[_0x50af('0x25')](function(){var _0x5c9c77=_0x4bb6b3[_0x50af('0x27')]({'plain':!![]});var _0x5a215b=_0x50af('0x28');return db[_0x50af('0x29')][_0x50af('0x26')]({'where':{'type':_0x5a215b,'resourceId':_0x5c9c77['id']}})['then'](function(){return _0x4bb6b3;});})[_0x50af('0x25')](function(){_0x27e8f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2e20,_0xf97e3f){return function(_0x5995d4){if(!_0x5995d4){_0x1b2e20['sendStatus'](0x194);}return _0x5995d4;};}function handleError(_0x5e2089,_0x3f2fa7){_0x3f2fa7=_0x3f2fa7||0x1f4;return function(_0x1ad89c){logger[_0x50af('0x2a')](_0x1ad89c[_0x50af('0x2b')]);if(_0x1ad89c[_0x50af('0x2c')]){delete _0x1ad89c[_0x50af('0x2c')];}_0x5e2089['status'](_0x3f2fa7)[_0x50af('0x2d')](_0x1ad89c);};}exports['index']=function(_0x35c508,_0x3b7b25){var _0x5b2934={},_0x2c78fe={},_0x3d9061={'count':0x0,'rows':[]};var _0x2fd0c6=_[_0x50af('0x2e')](db['Disposition']['rawAttributes'],function(_0x2e8971){return{'name':_0x2e8971[_0x50af('0x2f')],'type':_0x2e8971[_0x50af('0x30')]['key']};});_0x2c78fe[_0x50af('0x31')]=_['map'](_0x2fd0c6,'name');_0x2c78fe[_0x50af('0x32')]=_[_0x50af('0x33')](_0x35c508[_0x50af('0x32')]);_0x2c78fe[_0x50af('0x34')]=_[_0x50af('0x35')](_0x2c78fe['model'],_0x2c78fe[_0x50af('0x32')]);_0x5b2934[_0x50af('0x36')]=_['intersection'](_0x2c78fe['model'],qs[_0x50af('0x37')](_0x35c508[_0x50af('0x32')][_0x50af('0x37')]));_0x5b2934['attributes']=_0x5b2934[_0x50af('0x36')][_0x50af('0x38')]?_0x5b2934[_0x50af('0x36')]:_0x2c78fe['model'];if(!_0x35c508[_0x50af('0x32')]['hasOwnProperty'](_0x50af('0x39'))){_0x5b2934[_0x50af('0x21')]=qs['limit'](_0x35c508[_0x50af('0x32')][_0x50af('0x21')]);_0x5b2934[_0x50af('0x1e')]=qs[_0x50af('0x1e')](_0x35c508[_0x50af('0x32')][_0x50af('0x1e')]);}_0x5b2934[_0x50af('0x3a')]=qs['sort'](_0x35c508['query'][_0x50af('0x3b')]);_0x5b2934[_0x50af('0x3c')]=qs['filters'](_['pick'](_0x35c508[_0x50af('0x32')],_0x2c78fe[_0x50af('0x34')]),_0x2fd0c6);if(_0x35c508[_0x50af('0x32')][_0x50af('0x3d')]){_0x5b2934[_0x50af('0x3c')]=_['merge'](_0x5b2934[_0x50af('0x3c')],{'$or':_['map'](_0x2fd0c6,function(_0x247345){if(_0x247345[_0x50af('0x30')]!==_0x50af('0x3e')){var _0x39b07d={};_0x39b07d[_0x247345[_0x50af('0x2c')]]={'$like':'%'+_0x35c508[_0x50af('0x32')]['filter']+'%'};return _0x39b07d;}})});}_0x5b2934=_[_0x50af('0x3f')]({},_0x5b2934,_0x35c508['options']);var _0x4db07d={'where':_0x5b2934[_0x50af('0x3c')]};return db[_0x50af('0x40')][_0x50af('0x20')](_0x4db07d)[_0x50af('0x25')](function(_0x1083b2){_0x3d9061[_0x50af('0x20')]=_0x1083b2;if(_0x35c508[_0x50af('0x32')][_0x50af('0x41')]){_0x5b2934[_0x50af('0x42')]=[{'all':!![]}];}return db[_0x50af('0x40')][_0x50af('0x43')](_0x5b2934);})[_0x50af('0x25')](function(_0x5eef91){_0x3d9061['rows']=_0x5eef91;return _0x3d9061;})[_0x50af('0x25')](respondWithFilteredResult(_0x3b7b25,_0x5b2934))[_0x50af('0x44')](handleError(_0x3b7b25,null));};exports[_0x50af('0x45')]=function(_0x31ab92,_0x42cc63){var _0x3db91c={'raw':!![],'where':{'id':_0x31ab92[_0x50af('0x46')]['id']}},_0x55547b={};_0x55547b[_0x50af('0x31')]=_[_0x50af('0x33')](db['Disposition'][_0x50af('0x47')]);_0x55547b[_0x50af('0x32')]=_[_0x50af('0x33')](_0x31ab92['query']);_0x55547b[_0x50af('0x34')]=_[_0x50af('0x35')](_0x55547b[_0x50af('0x31')],_0x55547b[_0x50af('0x32')]);_0x3db91c[_0x50af('0x36')]=_[_0x50af('0x35')](_0x55547b['model'],qs[_0x50af('0x37')](_0x31ab92[_0x50af('0x32')]['fields']));_0x3db91c[_0x50af('0x36')]=_0x3db91c[_0x50af('0x36')]['length']?_0x3db91c[_0x50af('0x36')]:_0x55547b[_0x50af('0x31')];if(_0x31ab92[_0x50af('0x32')][_0x50af('0x41')]){_0x3db91c['include']=[{'all':!![]}];}_0x3db91c=_[_0x50af('0x3f')]({},_0x3db91c,_0x31ab92[_0x50af('0x48')]);return db[_0x50af('0x40')][_0x50af('0x49')](_0x3db91c)[_0x50af('0x25')](handleEntityNotFound(_0x42cc63,null))[_0x50af('0x25')](respondWithResult(_0x42cc63,null))[_0x50af('0x44')](handleError(_0x42cc63,null));};exports['create']=function(_0x230990,_0x49eb6e){return db[_0x50af('0x40')][_0x50af('0x4a')](_0x230990[_0x50af('0x4b')],{})[_0x50af('0x25')](function(_0x485b68){var _0xce531e=_0x230990['user'][_0x50af('0x27')]({'plain':!![]});if(!_0xce531e)throw new Error(_0x50af('0x4c'));if(_0xce531e[_0x50af('0x4d')]===_0x50af('0x4e')){var _0x2b840a=_0x485b68['get']({'plain':!![]});var _0x2ca430=_0x50af('0x28');return db['UserProfileSection'][_0x50af('0x49')]({'where':{'name':_0x2ca430,'userProfileId':_0xce531e[_0x50af('0x4f')]},'raw':!![]})[_0x50af('0x25')](function(_0x28c631){if(_0x28c631&&_0x28c631[_0x50af('0x50')]===0x0){return db['UserProfileResource'][_0x50af('0x4a')]({'name':_0x2b840a[_0x50af('0x2c')],'resourceId':_0x2b840a['id'],'type':_0x28c631[_0x50af('0x2c')],'sectionId':_0x28c631['id']},{})[_0x50af('0x25')](function(){return _0x485b68;});}else{return _0x485b68;}})[_0x50af('0x44')](function(_0x5ca231){logger[_0x50af('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ca231);throw _0x5ca231;});}return _0x485b68;})[_0x50af('0x25')](respondWithResult(_0x49eb6e,0xc9))[_0x50af('0x44')](handleError(_0x49eb6e,null));};exports[_0x50af('0x51')]=function(_0x4ab9c9,_0x3333fd){if(_0x4ab9c9[_0x50af('0x4b')]['id']){delete _0x4ab9c9[_0x50af('0x4b')]['id'];}return db[_0x50af('0x40')][_0x50af('0x49')]({'where':{'id':_0x4ab9c9[_0x50af('0x46')]['id']}})[_0x50af('0x25')](handleEntityNotFound(_0x3333fd,null))[_0x50af('0x25')](saveUpdates(_0x4ab9c9['body'],null))[_0x50af('0x25')](respondWithResult(_0x3333fd,null))[_0x50af('0x44')](handleError(_0x3333fd,null));};exports['destroy']=function(_0x31283d,_0x2ec32f){return db['Disposition'][_0x50af('0x49')]({'where':{'id':_0x31283d[_0x50af('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ec32f,null))[_0x50af('0x25')](removeEntity(_0x2ec32f,null))[_0x50af('0x44')](handleError(_0x2ec32f,null));}; \ No newline at end of file +var _0xb76d=['sort','where','filters','pick','filter','type','merge','options','includeAll','rows','show','params','keys','length','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','sendStatus','error','stack','name','send','index','Disposition','rawAttributes','fieldName','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xb76d,0x119));var _0xdb76=function(_0x13fdf9,_0x3960d1){_0x13fdf9=_0x13fdf9-0x0;var _0x159938=_0xb76d[_0x13fdf9];return _0x159938;};'use strict';var emlformat=require(_0xdb76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb76('0x1'));var jsonpatch=require(_0xdb76('0x2'));var rp=require(_0xdb76('0x3'));var moment=require('moment');var BPromise=require(_0xdb76('0x4'));var Mustache=require(_0xdb76('0x5'));var util=require(_0xdb76('0x6'));var path=require(_0xdb76('0x7'));var sox=require(_0xdb76('0x8'));var csv=require(_0xdb76('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb76('0xa'));var _=require(_0xdb76('0xb'));var squel=require(_0xdb76('0xc'));var crypto=require(_0xdb76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdb76('0xe'));var toCsv=require(_0xdb76('0x9'));var querystring=require('querystring');var Papa=require(_0xdb76('0xf'));var Redis=require(_0xdb76('0x10'));var authService=require(_0xdb76('0x11'));var qs=require(_0xdb76('0x12'));var as=require(_0xdb76('0x13'));var hardwareService=require(_0xdb76('0x14'));var logger=require(_0xdb76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdb76('0x16'));var licenseUtil=require(_0xdb76('0x17'));var db=require(_0xdb76('0x18'))['db'];function respondWithStatusCode(_0x579435,_0x4efbbd){_0x4efbbd=_0x4efbbd||0xcc;return function(_0x35c8ba){if(_0x35c8ba){return _0x579435['sendStatus'](_0x4efbbd);}return _0x579435[_0xdb76('0x19')](_0x4efbbd)['end']();};}function respondWithResult(_0x4d2970,_0xcc589e){_0xcc589e=_0xcc589e||0xc8;return function(_0x28d3a5){if(_0x28d3a5){return _0x4d2970[_0xdb76('0x19')](_0xcc589e)[_0xdb76('0x1a')](_0x28d3a5);}};}function respondWithFilteredResult(_0x4e6963,_0x7fd0ef){return function(_0x2f1e41){if(_0x2f1e41){var _0x5a1017=typeof _0x7fd0ef[_0xdb76('0x1b')]===_0xdb76('0x1c')&&typeof _0x7fd0ef[_0xdb76('0x1d')]===_0xdb76('0x1c');var _0x388fb0=_0x2f1e41[_0xdb76('0x1e')];var _0x557649=_0x5a1017?0x0:_0x7fd0ef[_0xdb76('0x1b')];var _0x11ae59=_0x5a1017?_0x2f1e41[_0xdb76('0x1e')]:_0x7fd0ef['offset']+_0x7fd0ef[_0xdb76('0x1d')];var _0xf06f1c;if(_0x11ae59>=_0x388fb0){_0x11ae59=_0x388fb0;_0xf06f1c=0xc8;}else{_0xf06f1c=0xce;}_0x4e6963[_0xdb76('0x19')](_0xf06f1c);return _0x4e6963['set'](_0xdb76('0x1f'),_0x557649+'-'+_0x11ae59+'/'+_0x388fb0)[_0xdb76('0x1a')](_0x2f1e41);}return null;};}function patchUpdates(_0x3c786c){return function(_0x468cd1){try{jsonpatch[_0xdb76('0x20')](_0x468cd1,_0x3c786c,!![]);}catch(_0xa574d4){return BPromise[_0xdb76('0x21')](_0xa574d4);}return _0x468cd1[_0xdb76('0x22')]();};}function saveUpdates(_0x54706a,_0x389668){return function(_0x3718e1){if(_0x3718e1){return _0x3718e1[_0xdb76('0x23')](_0x54706a)[_0xdb76('0x24')](function(_0x560433){return _0x560433;});}return null;};}function removeEntity(_0xd3f54f,_0x5cbf51){return function(_0x12f479){if(_0x12f479){return _0x12f479[_0xdb76('0x25')]()[_0xdb76('0x24')](function(){var _0x402a53=_0x12f479[_0xdb76('0x26')]({'plain':!![]});var _0x25d904=_0xdb76('0x27');return db[_0xdb76('0x28')][_0xdb76('0x25')]({'where':{'type':_0x25d904,'resourceId':_0x402a53['id']}})[_0xdb76('0x24')](function(){return _0x12f479;});})[_0xdb76('0x24')](function(){_0xd3f54f['status'](0xcc)[_0xdb76('0x29')]();});}};}function handleEntityNotFound(_0x57549a,_0x295317){return function(_0x25d034){if(!_0x25d034){_0x57549a[_0xdb76('0x2a')](0x194);}return _0x25d034;};}function handleError(_0x55d8c4,_0x5960cb){_0x5960cb=_0x5960cb||0x1f4;return function(_0x1ffce7){logger[_0xdb76('0x2b')](_0x1ffce7[_0xdb76('0x2c')]);if(_0x1ffce7['name']){delete _0x1ffce7[_0xdb76('0x2d')];}_0x55d8c4[_0xdb76('0x19')](_0x5960cb)[_0xdb76('0x2e')](_0x1ffce7);};}exports[_0xdb76('0x2f')]=function(_0x296ec5,_0x13b7a0){var _0x1f152d={},_0x12c9b9={},_0x155494={'count':0x0,'rows':[]};var _0x1c34f0=_['map'](db[_0xdb76('0x30')][_0xdb76('0x31')],function(_0x10719d){return{'name':_0x10719d[_0xdb76('0x32')],'type':_0x10719d['type']['key']};});_0x12c9b9[_0xdb76('0x33')]=_[_0xdb76('0x34')](_0x1c34f0,_0xdb76('0x2d'));_0x12c9b9['query']=_['keys'](_0x296ec5[_0xdb76('0x35')]);_0x12c9b9['filters']=_['intersection'](_0x12c9b9[_0xdb76('0x33')],_0x12c9b9[_0xdb76('0x35')]);_0x1f152d[_0xdb76('0x36')]=_[_0xdb76('0x37')](_0x12c9b9[_0xdb76('0x33')],qs['fields'](_0x296ec5['query'][_0xdb76('0x38')]));_0x1f152d[_0xdb76('0x36')]=_0x1f152d[_0xdb76('0x36')]['length']?_0x1f152d['attributes']:_0x12c9b9[_0xdb76('0x33')];if(!_0x296ec5[_0xdb76('0x35')][_0xdb76('0x39')](_0xdb76('0x3a'))){_0x1f152d[_0xdb76('0x1d')]=qs[_0xdb76('0x1d')](_0x296ec5[_0xdb76('0x35')][_0xdb76('0x1d')]);_0x1f152d[_0xdb76('0x1b')]=qs['offset'](_0x296ec5[_0xdb76('0x35')][_0xdb76('0x1b')]);}_0x1f152d['order']=qs[_0xdb76('0x3b')](_0x296ec5[_0xdb76('0x35')][_0xdb76('0x3b')]);_0x1f152d[_0xdb76('0x3c')]=qs[_0xdb76('0x3d')](_[_0xdb76('0x3e')](_0x296ec5[_0xdb76('0x35')],_0x12c9b9['filters']),_0x1c34f0);if(_0x296ec5['query'][_0xdb76('0x3f')]){_0x1f152d[_0xdb76('0x3c')]=_['merge'](_0x1f152d[_0xdb76('0x3c')],{'$or':_['map'](_0x1c34f0,function(_0x428c39){if(_0x428c39[_0xdb76('0x40')]!=='VIRTUAL'){var _0x1f8485={};_0x1f8485[_0x428c39[_0xdb76('0x2d')]]={'$like':'%'+_0x296ec5[_0xdb76('0x35')][_0xdb76('0x3f')]+'%'};return _0x1f8485;}})});}_0x1f152d=_[_0xdb76('0x41')]({},_0x1f152d,_0x296ec5[_0xdb76('0x42')]);var _0x5428de={'where':_0x1f152d['where']};return db['Disposition'][_0xdb76('0x1e')](_0x5428de)[_0xdb76('0x24')](function(_0x8c79e6){_0x155494['count']=_0x8c79e6;if(_0x296ec5['query'][_0xdb76('0x43')]){_0x1f152d['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1f152d);})[_0xdb76('0x24')](function(_0x92f567){_0x155494[_0xdb76('0x44')]=_0x92f567;return _0x155494;})[_0xdb76('0x24')](respondWithFilteredResult(_0x13b7a0,_0x1f152d))['catch'](handleError(_0x13b7a0,null));};exports[_0xdb76('0x45')]=function(_0x46cc59,_0x3c2208){var _0x56f43b={'raw':!![],'where':{'id':_0x46cc59[_0xdb76('0x46')]['id']}},_0x5c37aa={};_0x5c37aa[_0xdb76('0x33')]=_[_0xdb76('0x47')](db['Disposition']['rawAttributes']);_0x5c37aa[_0xdb76('0x35')]=_[_0xdb76('0x47')](_0x46cc59[_0xdb76('0x35')]);_0x5c37aa[_0xdb76('0x3d')]=_[_0xdb76('0x37')](_0x5c37aa[_0xdb76('0x33')],_0x5c37aa[_0xdb76('0x35')]);_0x56f43b['attributes']=_[_0xdb76('0x37')](_0x5c37aa['model'],qs[_0xdb76('0x38')](_0x46cc59[_0xdb76('0x35')][_0xdb76('0x38')]));_0x56f43b['attributes']=_0x56f43b[_0xdb76('0x36')][_0xdb76('0x48')]?_0x56f43b['attributes']:_0x5c37aa['model'];if(_0x46cc59[_0xdb76('0x35')][_0xdb76('0x43')]){_0x56f43b[_0xdb76('0x49')]=[{'all':!![]}];}_0x56f43b=_['merge']({},_0x56f43b,_0x46cc59[_0xdb76('0x42')]);return db[_0xdb76('0x30')][_0xdb76('0x4a')](_0x56f43b)['then'](handleEntityNotFound(_0x3c2208,null))[_0xdb76('0x24')](respondWithResult(_0x3c2208,null))[_0xdb76('0x4b')](handleError(_0x3c2208,null));};exports[_0xdb76('0x4c')]=function(_0x31e5fd,_0x265d9c){return db['Disposition'][_0xdb76('0x4c')](_0x31e5fd[_0xdb76('0x4d')],{})[_0xdb76('0x24')](function(_0x10c565){var _0x3023a5=_0x31e5fd['user'][_0xdb76('0x26')]({'plain':!![]});if(!_0x3023a5)throw new Error(_0xdb76('0x4e'));if(_0x3023a5[_0xdb76('0x4f')]===_0xdb76('0x50')){var _0x14a780=_0x10c565[_0xdb76('0x26')]({'plain':!![]});var _0x4b1eb8=_0xdb76('0x27');return db[_0xdb76('0x51')][_0xdb76('0x4a')]({'where':{'name':_0x4b1eb8,'userProfileId':_0x3023a5[_0xdb76('0x52')]},'raw':!![]})[_0xdb76('0x24')](function(_0x163817){if(_0x163817&&_0x163817[_0xdb76('0x53')]===0x0){return db[_0xdb76('0x28')][_0xdb76('0x4c')]({'name':_0x14a780[_0xdb76('0x2d')],'resourceId':_0x14a780['id'],'type':_0x163817[_0xdb76('0x2d')],'sectionId':_0x163817['id']},{})[_0xdb76('0x24')](function(){return _0x10c565;});}else{return _0x10c565;}})[_0xdb76('0x4b')](function(_0x51c391){logger[_0xdb76('0x2b')](_0xdb76('0x54'),_0x51c391);throw _0x51c391;});}return _0x10c565;})[_0xdb76('0x24')](respondWithResult(_0x265d9c,0xc9))['catch'](handleError(_0x265d9c,null));};exports[_0xdb76('0x23')]=function(_0x4ee8bf,_0x51f3d2){if(_0x4ee8bf[_0xdb76('0x4d')]['id']){delete _0x4ee8bf[_0xdb76('0x4d')]['id'];}return db['Disposition'][_0xdb76('0x4a')]({'where':{'id':_0x4ee8bf[_0xdb76('0x46')]['id']}})['then'](handleEntityNotFound(_0x51f3d2,null))[_0xdb76('0x24')](saveUpdates(_0x4ee8bf['body'],null))[_0xdb76('0x24')](respondWithResult(_0x51f3d2,null))[_0xdb76('0x4b')](handleError(_0x51f3d2,null));};exports[_0xdb76('0x25')]=function(_0x15fef5,_0x39c617){return db['Disposition'][_0xdb76('0x4a')]({'where':{'id':_0x15fef5[_0xdb76('0x46')]['id']}})[_0xdb76('0x24')](handleEntityNotFound(_0x39c617,null))[_0xdb76('0x24')](removeEntity(_0x39c617,null))['catch'](handleError(_0x39c617,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 40f6f6a..f753083 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 _0xfff1=['SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','lodash','util','api','moment','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_sms'];(function(_0x39b133,_0x59c10f){var _0x44dc73=function(_0x5b268e){while(--_0x5b268e){_0x39b133['push'](_0x39b133['shift']());}};_0x44dc73(++_0x59c10f);}(_0xfff1,0xdc));var _0x1fff=function(_0x43c520,_0x421439){_0x43c520=_0x43c520-0x0;var _0x342174=_0xfff1[_0x43c520];return _0x342174;};'use strict';var _=require(_0x1fff('0x0'));var util=require(_0x1fff('0x1'));var logger=require('../../config/logger')(_0x1fff('0x2'));var moment=require(_0x1fff('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fff('0x4'));var rimraf=require(_0x1fff('0x5'));var config=require(_0x1fff('0x6'));var attributes=require(_0x1fff('0x7'));module[_0x1fff('0x8')]=function(_0x47fbf4,_0x2a2f99){return _0x47fbf4[_0x1fff('0x9')](_0x1fff('0xa'),attributes,{'tableName':_0x1fff('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1fff('0xc'),'fields':['name',_0x1fff('0xd')]},{'unique':!![],'name':_0x1fff('0xe'),'fields':['name',_0x1fff('0xf')]},{'unique':!![],'name':_0x1fff('0x10'),'fields':[_0x1fff('0x11'),_0x1fff('0x12')]},{'unique':!![],'name':_0x1fff('0x13'),'fields':[_0x1fff('0x11'),_0x1fff('0x14')]},{'unique':!![],'name':_0x1fff('0x15'),'fields':[_0x1fff('0x11'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0x1fff('0x16')]},{'unique':!![],'name':_0x1fff('0x17'),'fields':[_0x1fff('0x11'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xab8d=['name_voice','ListId','name_chat','name','MailAccountId','name_fax','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0xab8d,0x15c));var _0xdab8=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xab8d[_0x28d18d];return _0x470640;};'use strict';var _=require(_0xdab8('0x0'));var util=require(_0xdab8('0x1'));var logger=require(_0xdab8('0x2'))(_0xdab8('0x3'));var moment=require('moment');var BPromise=require(_0xdab8('0x4'));var rp=require(_0xdab8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdab8('0x6'));var config=require(_0xdab8('0x7'));var attributes=require(_0xdab8('0x8'));module[_0xdab8('0x9')]=function(_0x105175,_0x456fe7){return _0x105175[_0xdab8('0xa')](_0xdab8('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xdab8('0xc'),'fields':['name',_0xdab8('0xd')]},{'unique':!![],'name':_0xdab8('0xe'),'fields':[_0xdab8('0xf'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xdab8('0xf'),_0xdab8('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xdab8('0xf'),'SmsAccountId']},{'unique':!![],'name':_0xdab8('0x11'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xdab8('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0xdab8('0x12'),'fields':[_0xdab8('0xf'),_0xdab8('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 1b7a320..b6c80f6 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(_0x2135af,_0x3b550d){var _0x4d7551=function(_0x4b6aba){while(--_0x4b6aba){_0x2135af['push'](_0x2135af['shift']());}};_0x4d7551(++_0x3b550d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x54eadd,_0x2ae863){var _0x5ddc79=function(_0x3ed1dd){while(--_0x3ed1dd){_0x54eadd['push'](_0x54eadd['shift']());}};_0x5ddc79(++_0x2ae863);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 2c826ad..fbcddd5 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 _0x9e18=['post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x36366f,_0x5d5815){var _0x54a9be=function(_0x4f5ad4){while(--_0x4f5ad4){_0x36366f['push'](_0x36366f['shift']());}};_0x54a9be(++_0x5d5815);}(_0x9e18,0x1aa));var _0x89e1=function(_0x1b26ac,_0x5ea577){_0x1b26ac=_0x1b26ac-0x0;var _0x2d88ec=_0x9e18[_0x1b26ac];return _0x2d88ec;};'use strict';var multer=require(_0x89e1('0x0'));var util=require('util');var path=require(_0x89e1('0x1'));var timeout=require(_0x89e1('0x2'));var express=require('express');var router=express[_0x89e1('0x3')]();var fs_extra=require(_0x89e1('0x4'));var auth=require(_0x89e1('0x5'));var interaction=require(_0x89e1('0x6'));var config=require(_0x89e1('0x7'));var controller=require(_0x89e1('0x8'));router[_0x89e1('0x9')]('/',auth[_0x89e1('0xa')](),controller[_0x89e1('0xb')]);router[_0x89e1('0x9')](_0x89e1('0xc'),auth[_0x89e1('0xa')](),controller[_0x89e1('0xd')]);router[_0x89e1('0xe')]('/',auth[_0x89e1('0xa')](),controller[_0x89e1('0xf')]);router[_0x89e1('0x10')](_0x89e1('0xc'),auth[_0x89e1('0xa')](),controller['update']);router[_0x89e1('0x11')](_0x89e1('0xc'),auth[_0x89e1('0xa')](),controller[_0x89e1('0x12')]);module[_0x89e1('0x13')]=router; \ No newline at end of file +var _0xeee8=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','./disposition.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0xcb0856,_0x283368){var _0x30e654=function(_0x458c99){while(--_0x458c99){_0xcb0856['push'](_0xcb0856['shift']());}};_0x30e654(++_0x283368);}(_0xeee8,0x18c));var _0x8eee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xeee8[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8eee('0x0'));var timeout=require(_0x8eee('0x1'));var express=require(_0x8eee('0x2'));var router=express['Router']();var fs_extra=require(_0x8eee('0x3'));var auth=require(_0x8eee('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8eee('0x5'));router['get']('/',auth[_0x8eee('0x6')](),controller[_0x8eee('0x7')]);router[_0x8eee('0x8')](_0x8eee('0x9'),auth['isAuthenticated'](),controller[_0x8eee('0xa')]);router['post']('/',auth[_0x8eee('0x6')](),controller[_0x8eee('0xb')]);router[_0x8eee('0xc')]('/:id',auth[_0x8eee('0x6')](),controller[_0x8eee('0xd')]);router[_0x8eee('0xe')]('/:id',auth[_0x8eee('0x6')](),controller[_0x8eee('0xf')]);module[_0x8eee('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 9fc2657..634811b 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 _0x15ef=['setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','14400','2400','4800','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x34fd25,_0x1e7f7f){var _0x4927ef=function(_0x53e646){while(--_0x53e646){_0x34fd25['push'](_0x34fd25['shift']());}};_0x4927ef(++_0x1e7f7f);}(_0x15ef,0x80));var _0xf15e=function(_0xd08542,_0x5e6fcb){_0xd08542=_0xd08542-0x0;var _0x5cef3f=_0x15ef[_0xd08542];return _0x5cef3f;};'use strict';var Sequelize=require('sequelize');module[_0xf15e('0x0')]={'name':{'type':Sequelize[_0xf15e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf15e('0x2')](_0xf15e('0x3'),'no'),'defaultValue':_0xf15e('0x3')},'headerinfo':{'type':Sequelize[_0xf15e('0x1')],'defaultValue':_0xf15e('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf15e('0x5')},'minrate':{'type':Sequelize[_0xf15e('0x2')]('2400','4800',_0xf15e('0x6'),_0xf15e('0x7'),'12000',_0xf15e('0x8')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xf15e('0x2')](_0xf15e('0x9'),_0xf15e('0xa'),_0xf15e('0x6'),'9600','12000','14400'),'defaultValue':_0xf15e('0x8')},'modem':{'type':Sequelize[_0xf15e('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf15e('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf15e('0x2')](_0xf15e('0xc'),'IAX',_0xf15e('0xd'),_0xf15e('0xe')),'defaultValue':_0xf15e('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf15e('0xf')],'defaultValue':function(){return _0xf15e('0x10');}},'notificationSound':{'type':Sequelize[_0xf15e('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf15e('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf15e('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf15e('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf15e('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf15e('0x11')],'defaultValue':![],'comment':_0xf15e('0x12'),'set':function(_0x45e418){if(!_0x45e418)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf15e('0x13')](_0xf15e('0x14'),_0x45e418);}}}; \ No newline at end of file +var _0x39e6=['BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x24d813,_0x2817a9){var _0x2db282=function(_0x365bd1){while(--_0x365bd1){_0x24d813['push'](_0x24d813['shift']());}};_0x2db282(++_0x2817a9);}(_0x39e6,0x9e));var _0x639e=function(_0x1ea44c,_0x166e48){_0x1ea44c=_0x1ea44c-0x0;var _0x436b7d=_0x39e6[_0x1ea44c];return _0x436b7d;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x639e('0x2'),'no'),'defaultValue':_0x639e('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x639e('0x3')},'localstationid':{'type':Sequelize[_0x639e('0x1')],'unique':_0x639e('0x4')},'minrate':{'type':Sequelize[_0x639e('0x5')](_0x639e('0x6'),_0x639e('0x7'),_0x639e('0x8'),_0x639e('0x9'),_0x639e('0xa'),_0x639e('0xb')),'defaultValue':_0x639e('0x7')},'maxrate':{'type':Sequelize[_0x639e('0x5')](_0x639e('0x6'),_0x639e('0x7'),_0x639e('0x8'),_0x639e('0x9'),_0x639e('0xa'),_0x639e('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x639e('0xc')},'gateway':{'type':Sequelize[_0x639e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x639e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x639e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x639e('0x5')](_0x639e('0xe'),_0x639e('0xf'),'DADHI','KHOMP'),'defaultValue':_0x639e('0xe')},'key':{'type':Sequelize[_0x639e('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x639e('0x10')],'defaultValue':function(){return _0x639e('0x11');}},'notificationSound':{'type':Sequelize[_0x639e('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x639e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x639e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x639e('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x639e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x639e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x639e('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x639e('0x12')],'defaultValue':![],'comment':_0x639e('0x13'),'set':function(_0x391957){if(!_0x391957)this[_0x639e('0x14')](_0x639e('0x15'),null);this[_0x639e('0x14')]('mandatoryDisposition',_0x391957);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d814ce0..2ade9a5 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 _0x9745=['SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','Pause','FaxAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','mandatoryDispositionPause','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','localstationid','app','system','description','Fax\x20Extension','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax'];(function(_0x124bd0,_0x428386){var _0x47b289=function(_0x290e5d){while(--_0x290e5d){_0x124bd0['push'](_0x124bd0['shift']());}};_0x47b289(++_0x428386);}(_0x9745,0xcd));var _0x5974=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x9745[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require(_0x5974('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5974('0x1'));var jsonpatch=require(_0x5974('0x2'));var rp=require('request-promise');var moment=require(_0x5974('0x3'));var BPromise=require(_0x5974('0x4'));var Mustache=require(_0x5974('0x5'));var util=require(_0x5974('0x6'));var path=require(_0x5974('0x7'));var sox=require('sox');var csv=require(_0x5974('0x8'));var ejs=require(_0x5974('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5974('0xa'));var squel=require(_0x5974('0xb'));var crypto=require('crypto');var jsforce=require(_0x5974('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5974('0x8'));var querystring=require(_0x5974('0xd'));var Papa=require('papaparse');var Redis=require(_0x5974('0xe'));var authService=require(_0x5974('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5974('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5974('0x11'));var utils=require(_0x5974('0x12'));var config=require(_0x5974('0x13'));var licenseUtil=require(_0x5974('0x14'));var db=require(_0x5974('0x15'))['db'];config[_0x5974('0x16')]=_[_0x5974('0x17')](config[_0x5974('0x16')],{'host':_0x5974('0x18'),'port':0x18eb});var socket=require(_0x5974('0x19'))(new Redis(config[_0x5974('0x16')]));require(_0x5974('0x1a'))[_0x5974('0x1b')](socket);var jayson=require(_0x5974('0x1c'));var client=jayson['client'][_0x5974('0x1d')]({'port':0x232c});var client9002=jayson[_0x5974('0x1e')][_0x5974('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xddde65,_0x5b5e99,_0x568a3b,_0x14e591){return new BPromise(function(_0x27aa8d,_0x63aec1){var _0x4a58fb=_0x14e591||client;return _0x4a58fb[_0x5974('0x1f')](_0xddde65,_0x568a3b)[_0x5974('0x20')](function(_0x3c5f30){logger[_0x5974('0x21')](_0x5974('0x22'),_0x5b5e99,'request\x20sent');logger[_0x5974('0x23')](_0x5974('0x24'),_0x5b5e99,_0x5974('0x25'),JSON[_0x5974('0x26')](_0x3c5f30));if(_0x3c5f30[_0x5974('0x27')]){if(_0x3c5f30[_0x5974('0x27')][_0x5974('0x28')]===0x1f4){logger['error'](_0x5974('0x22'),_0x5b5e99,_0x3c5f30[_0x5974('0x27')]['message']);return _0x63aec1(_0x3c5f30['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5b5e99,_0x3c5f30[_0x5974('0x27')]['message']);return _0x27aa8d(_0x3c5f30[_0x5974('0x27')][_0x5974('0x29')]);}else{logger[_0x5974('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5b5e99,_0x5974('0x25'));_0x27aa8d(_0x3c5f30[_0x5974('0x2a')][_0x5974('0x29')]);}})['catch'](function(_0x278c31){logger[_0x5974('0x27')](_0x5974('0x22'),_0x5b5e99,_0x278c31);_0x63aec1(_0x278c31);});});}function respondWithStatusCode(_0x22514c,_0x59d53e){_0x59d53e=_0x59d53e||0xcc;return function(_0x538783){if(_0x538783){return _0x22514c[_0x5974('0x2b')](_0x59d53e);}return _0x22514c[_0x5974('0x2c')](_0x59d53e)[_0x5974('0x2d')]();};}function respondWithResult(_0x50c865,_0x20d12a){_0x20d12a=_0x20d12a||0xc8;return function(_0x455d56){if(_0x455d56){return _0x50c865[_0x5974('0x2c')](_0x20d12a)[_0x5974('0x2e')](_0x455d56);}};}function respondWithFilteredResult(_0x485c2a,_0x2cd9ee){return function(_0x375960){if(_0x375960){var _0x5ba96b=typeof _0x2cd9ee[_0x5974('0x2f')]==='undefined'&&typeof _0x2cd9ee['limit']===_0x5974('0x30');var _0x2410a3=_0x375960[_0x5974('0x31')];var _0x48a7c0=_0x5ba96b?0x0:_0x2cd9ee['offset'];var _0x3c4843=_0x5ba96b?_0x375960['count']:_0x2cd9ee[_0x5974('0x2f')]+_0x2cd9ee[_0x5974('0x32')];var _0x51748d;if(_0x3c4843>=_0x2410a3){_0x3c4843=_0x2410a3;_0x51748d=0xc8;}else{_0x51748d=0xce;}_0x485c2a[_0x5974('0x2c')](_0x51748d);return _0x485c2a['set'](_0x5974('0x33'),_0x48a7c0+'-'+_0x3c4843+'/'+_0x2410a3)[_0x5974('0x2e')](_0x375960);}return null;};}function patchUpdates(_0x4d406e){return function(_0x1b08c1){try{jsonpatch[_0x5974('0x34')](_0x1b08c1,_0x4d406e,!![]);}catch(_0x34f47b){return BPromise[_0x5974('0x35')](_0x34f47b);}return _0x1b08c1[_0x5974('0x36')]();};}function saveUpdates(_0x483a58,_0x80eda){return function(_0xf47332){if(_0xf47332){return _0xf47332[_0x5974('0x37')](_0x483a58)[_0x5974('0x20')](function(_0x280a3a){return _0x280a3a;});}return null;};}function removeEntity(_0x3377da,_0x5ec5d5){return function(_0x3c39be){if(_0x3c39be){return _0x3c39be['destroy']()['then'](function(){var _0x3c989e=_0x3c39be[_0x5974('0x38')]({'plain':!![]});var _0x15d7db=_0x5974('0x39');return db[_0x5974('0x3a')][_0x5974('0x3b')]({'where':{'type':_0x15d7db,'resourceId':_0x3c989e['id']}})[_0x5974('0x20')](function(){return _0x3c39be;});})[_0x5974('0x20')](function(){_0x3377da[_0x5974('0x2c')](0xcc)[_0x5974('0x2d')]();});}};}function handleEntityNotFound(_0x54ab72,_0x44f0d1){return function(_0x1bcc03){if(!_0x1bcc03){_0x54ab72[_0x5974('0x2b')](0x194);}return _0x1bcc03;};}function handleError(_0x928a9a,_0x36980e){_0x36980e=_0x36980e||0x1f4;return function(_0x2cf31f){logger['error'](_0x2cf31f[_0x5974('0x3c')]);if(_0x2cf31f[_0x5974('0x3d')]){delete _0x2cf31f[_0x5974('0x3d')];}_0x928a9a[_0x5974('0x2c')](_0x36980e)[_0x5974('0x3e')](_0x2cf31f);};}exports['index']=function(_0x246fb0,_0x1ef503){var _0x5e6595={'include':[{'model':db[_0x5974('0x3f')],'as':'mandatoryDispositionPause'}]},_0x419a9e={},_0x1f40e2={'count':0x0,'rows':[]};var _0x4a7156=_['map'](db[_0x5974('0x40')][_0x5974('0x41')],function(_0x25cdcf){return{'name':_0x25cdcf[_0x5974('0x42')],'type':_0x25cdcf[_0x5974('0x43')]['key']};});_0x419a9e[_0x5974('0x44')]=_[_0x5974('0x45')](_0x4a7156,_0x5974('0x3d'));_0x419a9e[_0x5974('0x46')]=_[_0x5974('0x47')](_0x246fb0[_0x5974('0x46')]);_0x419a9e[_0x5974('0x48')]=_[_0x5974('0x49')](_0x419a9e[_0x5974('0x44')],_0x419a9e[_0x5974('0x46')]);_0x5e6595[_0x5974('0x4a')]=_[_0x5974('0x49')](_0x419a9e[_0x5974('0x44')],qs[_0x5974('0x4b')](_0x246fb0[_0x5974('0x46')][_0x5974('0x4b')]));_0x5e6595[_0x5974('0x4a')]=_0x5e6595[_0x5974('0x4a')][_0x5974('0x4c')]?_0x5e6595['attributes']:_0x419a9e[_0x5974('0x44')];if(!_0x246fb0[_0x5974('0x46')][_0x5974('0x4d')](_0x5974('0x4e'))){_0x5e6595[_0x5974('0x32')]=qs[_0x5974('0x32')](_0x246fb0[_0x5974('0x46')][_0x5974('0x32')]);_0x5e6595[_0x5974('0x2f')]=qs[_0x5974('0x2f')](_0x246fb0[_0x5974('0x46')][_0x5974('0x2f')]);}_0x5e6595[_0x5974('0x4f')]=qs[_0x5974('0x50')](_0x246fb0['query'][_0x5974('0x50')]);_0x5e6595[_0x5974('0x51')]=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x246fb0[_0x5974('0x46')],_0x419a9e[_0x5974('0x48')]),_0x4a7156);if(_0x246fb0['query'][_0x5974('0x53')]){_0x5e6595[_0x5974('0x51')]=_['merge'](_0x5e6595[_0x5974('0x51')],{'$or':_[_0x5974('0x45')](_0x4a7156,function(_0x478e4c){if(_0x478e4c[_0x5974('0x43')]!==_0x5974('0x54')){var _0x2f7b1d={};_0x2f7b1d[_0x478e4c[_0x5974('0x3d')]]={'$like':'%'+_0x246fb0[_0x5974('0x46')][_0x5974('0x53')]+'%'};return _0x2f7b1d;}})});}_0x5e6595=_[_0x5974('0x55')]({},_0x5e6595,_0x246fb0[_0x5974('0x56')]);var _0x51f511={'where':_0x5e6595[_0x5974('0x51')]};return db['FaxAccount']['count'](_0x51f511)[_0x5974('0x20')](function(_0x4d6936){_0x1f40e2[_0x5974('0x31')]=_0x4d6936;if(_0x246fb0[_0x5974('0x46')][_0x5974('0x57')]){_0x5e6595['include']=[{'all':!![]}];}return db[_0x5974('0x40')][_0x5974('0x58')](_0x5e6595);})['then'](function(_0xba28ea){_0x1f40e2['rows']=_0xba28ea;return _0x1f40e2;})[_0x5974('0x20')](respondWithFilteredResult(_0x1ef503,_0x5e6595))[_0x5974('0x59')](handleError(_0x1ef503,null));};exports[_0x5974('0x5a')]=function(_0x38f797,_0x56859d){var _0x772f7={'raw':![],'where':{'id':_0x38f797[_0x5974('0x5b')]['id']},'include':[{'model':db[_0x5974('0x3f')],'as':_0x5974('0x5c')}]},_0x510777={};_0x510777['model']=_['keys'](db[_0x5974('0x40')][_0x5974('0x41')]);_0x510777[_0x5974('0x46')]=_[_0x5974('0x47')](_0x38f797[_0x5974('0x46')]);_0x510777['filters']=_[_0x5974('0x49')](_0x510777[_0x5974('0x44')],_0x510777[_0x5974('0x46')]);_0x772f7[_0x5974('0x4a')]=_[_0x5974('0x49')](_0x510777[_0x5974('0x44')],qs[_0x5974('0x4b')](_0x38f797[_0x5974('0x46')][_0x5974('0x4b')]));_0x772f7['attributes']=_0x772f7[_0x5974('0x4a')][_0x5974('0x4c')]?_0x772f7[_0x5974('0x4a')]:_0x510777[_0x5974('0x44')];if(_0x38f797[_0x5974('0x46')][_0x5974('0x57')]){_0x772f7[_0x5974('0x5d')]=[{'all':!![]}];}_0x772f7=_[_0x5974('0x55')]({},_0x772f7,_0x38f797[_0x5974('0x56')]);return db[_0x5974('0x40')][_0x5974('0x5e')](_0x772f7)[_0x5974('0x20')](handleEntityNotFound(_0x56859d,null))[_0x5974('0x20')](respondWithResult(_0x56859d,null))[_0x5974('0x59')](handleError(_0x56859d,null));};exports['create']=function(_0x55f8c5,_0x4bb18d){return db['FaxAccount'][_0x5974('0x5f')](_0x55f8c5[_0x5974('0x60')],{})[_0x5974('0x20')](function(_0x26dac9){var _0x5ad72a=_0x55f8c5['user'][_0x5974('0x38')]({'plain':!![]});if(!_0x5ad72a)throw new Error(_0x5974('0x61'));if(_0x5ad72a[_0x5974('0x62')]===_0x5974('0x63')){var _0x4e659d=_0x26dac9['get']({'plain':!![]});var _0x2c673e=_0x5974('0x39');return db[_0x5974('0x64')][_0x5974('0x5e')]({'where':{'name':_0x2c673e,'userProfileId':_0x5ad72a['userProfileId']},'raw':!![]})[_0x5974('0x20')](function(_0x27c47c){if(_0x27c47c&&_0x27c47c[_0x5974('0x65')]===0x0){return db[_0x5974('0x3a')]['create']({'name':_0x4e659d['name'],'resourceId':_0x4e659d['id'],'type':_0x27c47c['name'],'sectionId':_0x27c47c['id']},{})[_0x5974('0x20')](function(){return _0x26dac9;});}else{return _0x26dac9;}})['catch'](function(_0x3cbd60){logger[_0x5974('0x27')](_0x5974('0x66'),_0x3cbd60);throw _0x3cbd60;});}return _0x26dac9;})[_0x5974('0x20')](respondWithResult(_0x4bb18d,0xc9))[_0x5974('0x59')](handleError(_0x4bb18d,null));};exports[_0x5974('0x37')]=function(_0x3a8517,_0x125ec6){if(_0x3a8517['body']['id']){delete _0x3a8517[_0x5974('0x60')]['id'];}return db[_0x5974('0x40')]['find']({'where':{'id':_0x3a8517[_0x5974('0x5b')]['id']},'include':[{'model':db[_0x5974('0x3f')],'as':_0x5974('0x5c')}]})[_0x5974('0x20')](handleEntityNotFound(_0x125ec6,null))[_0x5974('0x20')](saveUpdates(_0x3a8517['body'],null))[_0x5974('0x20')](respondWithResult(_0x125ec6,null))['catch'](handleError(_0x125ec6,null));};exports[_0x5974('0x3b')]=function(_0x3e7d1d,_0xe3e385){return db[_0x5974('0x40')][_0x5974('0x5e')]({'where':{'id':_0x3e7d1d[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0xe3e385,null))[_0x5974('0x20')](removeEntity(_0xe3e385,null))[_0x5974('0x59')](handleError(_0xe3e385,null));};exports[_0x5974('0x67')]=function(_0x2cc972,_0x2edd67){return db[_0x5974('0x40')][_0x5974('0x67')]()[_0x5974('0x20')](respondWithResult(_0x2edd67,null))[_0x5974('0x59')](handleError(_0x2edd67,null));};exports[_0x5974('0x68')]=function(_0x34a635,_0x599622,_0x42fbb){if(_0x34a635['body']['id']){delete _0x34a635[_0x5974('0x60')]['id'];}return db[_0x5974('0x40')][_0x5974('0x5e')]({'where':{'id':_0x34a635[_0x5974('0x5b')]['id']}})['then'](handleEntityNotFound(_0x599622,null))[_0x5974('0x20')](function(_0x589a01){if(_0x589a01){_0x34a635[_0x5974('0x60')][_0x5974('0x69')]=_0x589a01['id'];return db[_0x5974('0x6a')][_0x5974('0x5f')](_0x34a635['body']);}})[_0x5974('0x20')](respondWithResult(_0x599622,null))['catch'](handleError(_0x599622,null));};exports[_0x5974('0x6b')]=function(_0x5f5ae6,_0x3078c9,_0x5da8c8){var _0x592a99={'raw':![],'where':{}};var _0x3030eb={};var _0x281343={'count':0x0,'rows':[]};return db[_0x5974('0x40')][_0x5974('0x6c')]({'where':{'id':_0x5f5ae6[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x3078c9,null))[_0x5974('0x20')](function(_0x31088e){if(_0x31088e){_0x3030eb[_0x5974('0x44')]=_['keys'](db[_0x5974('0x6a')]['rawAttributes']);_0x3030eb['query']=_[_0x5974('0x47')](_0x5f5ae6[_0x5974('0x46')]);_0x3030eb['filters']=_['intersection'](_0x3030eb[_0x5974('0x44')],_0x3030eb['query']);_0x592a99[_0x5974('0x4a')]=_['intersection'](_0x3030eb[_0x5974('0x44')],qs[_0x5974('0x4b')](_0x5f5ae6[_0x5974('0x46')][_0x5974('0x4b')]));_0x592a99[_0x5974('0x4a')]=_0x592a99[_0x5974('0x4a')][_0x5974('0x4c')]?_0x592a99[_0x5974('0x4a')]:_0x3030eb[_0x5974('0x44')];if(!_0x5f5ae6[_0x5974('0x46')][_0x5974('0x4d')](_0x5974('0x4e'))){_0x592a99['limit']=qs['limit'](_0x5f5ae6['query'][_0x5974('0x32')]);_0x592a99[_0x5974('0x2f')]=qs[_0x5974('0x2f')](_0x5f5ae6['query']['offset']);}_0x592a99[_0x5974('0x4f')]=qs[_0x5974('0x50')](_0x5f5ae6[_0x5974('0x46')]['sort']);_0x592a99[_0x5974('0x51')]=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x5f5ae6[_0x5974('0x46')],_0x3030eb[_0x5974('0x48')]));_0x592a99[_0x5974('0x51')][_0x5974('0x69')]=_0x31088e['id'];if(_0x5f5ae6[_0x5974('0x46')][_0x5974('0x53')]){_0x592a99[_0x5974('0x51')]=_[_0x5974('0x55')](_0x592a99[_0x5974('0x51')],{'$or':_['map'](_0x592a99[_0x5974('0x4a')],function(_0x12cf42){var _0xe152e0={};_0xe152e0[_0x12cf42]={'$like':'%'+_0x5f5ae6[_0x5974('0x46')][_0x5974('0x53')]+'%'};return _0xe152e0;})});}_0x592a99=_[_0x5974('0x55')]({},_0x592a99,_0x5f5ae6[_0x5974('0x56')]);return db[_0x5974('0x6a')]['count']({'where':_0x592a99[_0x5974('0x51')]})[_0x5974('0x20')](function(_0x4924c5){_0x281343['count']=_0x4924c5;if(_0x5f5ae6['query'][_0x5974('0x57')]){_0x592a99['include']=[{'all':!![]}];}return db['Disposition'][_0x5974('0x58')](_0x592a99);})[_0x5974('0x20')](function(_0x6f120){_0x281343['rows']=_0x6f120;return _0x281343;});}})[_0x5974('0x20')](respondWithFilteredResult(_0x3078c9,_0x592a99))[_0x5974('0x59')](handleError(_0x3078c9,null));};exports[_0x5974('0x6d')]=function(_0xacff3,_0x15a107,_0x26af0f){return db[_0x5974('0x40')][_0x5974('0x5e')]({'where':{'id':_0xacff3[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x15a107,null))[_0x5974('0x20')](function(_0x3258dd){if(_0x3258dd){return _0x3258dd[_0x5974('0x6d')](_0xacff3[_0x5974('0x46')][_0x5974('0x6e')]);}})['then'](respondWithStatusCode(_0x15a107,null))['catch'](handleError(_0x15a107,null));};exports[_0x5974('0x6f')]=function(_0x48f5ee,_0x5b1d29,_0x1d4ca7){if(_0x48f5ee['body']['id']){delete _0x48f5ee[_0x5974('0x60')]['id'];}return db['FaxAccount'][_0x5974('0x5e')]({'where':{'id':_0x48f5ee[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x5b1d29,null))[_0x5974('0x20')](function(_0x16176b){if(_0x16176b){_0x48f5ee[_0x5974('0x60')][_0x5974('0x69')]=_0x16176b['id'];return db[_0x5974('0x70')]['create'](_0x48f5ee[_0x5974('0x60')]);}})[_0x5974('0x20')](respondWithResult(_0x5b1d29,null))[_0x5974('0x59')](handleError(_0x5b1d29,null));};exports[_0x5974('0x71')]=function(_0x4361fd,_0x582981,_0x5908de){var _0x778bb5={'raw':![],'where':{}};var _0x173de2={};var _0x3ec760={'count':0x0,'rows':[]};return db[_0x5974('0x40')][_0x5974('0x6c')]({'where':{'id':_0x4361fd[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x582981,null))['then'](function(_0x380549){if(_0x380549){_0x173de2[_0x5974('0x44')]=_['keys'](db[_0x5974('0x70')][_0x5974('0x41')]);_0x173de2['query']=_['keys'](_0x4361fd[_0x5974('0x46')]);_0x173de2[_0x5974('0x48')]=_['intersection'](_0x173de2[_0x5974('0x44')],_0x173de2[_0x5974('0x46')]);_0x778bb5['attributes']=_[_0x5974('0x49')](_0x173de2[_0x5974('0x44')],qs['fields'](_0x4361fd[_0x5974('0x46')][_0x5974('0x4b')]));_0x778bb5[_0x5974('0x4a')]=_0x778bb5[_0x5974('0x4a')][_0x5974('0x4c')]?_0x778bb5[_0x5974('0x4a')]:_0x173de2[_0x5974('0x44')];if(!_0x4361fd['query'][_0x5974('0x4d')](_0x5974('0x4e'))){_0x778bb5[_0x5974('0x32')]=qs[_0x5974('0x32')](_0x4361fd[_0x5974('0x46')][_0x5974('0x32')]);_0x778bb5[_0x5974('0x2f')]=qs[_0x5974('0x2f')](_0x4361fd[_0x5974('0x46')]['offset']);}_0x778bb5[_0x5974('0x4f')]=qs['sort'](_0x4361fd[_0x5974('0x46')][_0x5974('0x50')]);_0x778bb5[_0x5974('0x51')]=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x4361fd[_0x5974('0x46')],_0x173de2[_0x5974('0x48')]));_0x778bb5[_0x5974('0x51')][_0x5974('0x69')]=_0x380549['id'];if(_0x4361fd['query']['filter']){_0x778bb5[_0x5974('0x51')]=_['merge'](_0x778bb5['where'],{'$or':_[_0x5974('0x45')](_0x778bb5[_0x5974('0x4a')],function(_0x1afe31){var _0x266ad2={};_0x266ad2[_0x1afe31]={'$like':'%'+_0x4361fd[_0x5974('0x46')]['filter']+'%'};return _0x266ad2;})});}_0x778bb5=_[_0x5974('0x55')]({},_0x778bb5,_0x4361fd[_0x5974('0x56')]);return db['CannedAnswer'][_0x5974('0x31')]({'where':_0x778bb5[_0x5974('0x51')]})[_0x5974('0x20')](function(_0x63af46){_0x3ec760['count']=_0x63af46;if(_0x4361fd[_0x5974('0x46')][_0x5974('0x57')]){_0x778bb5[_0x5974('0x5d')]=[{'all':!![]}];}return db[_0x5974('0x70')][_0x5974('0x58')](_0x778bb5);})[_0x5974('0x20')](function(_0x5ece4){_0x3ec760[_0x5974('0x72')]=_0x5ece4;return _0x3ec760;});}})[_0x5974('0x20')](respondWithFilteredResult(_0x582981,_0x778bb5))[_0x5974('0x59')](handleError(_0x582981,null));};exports[_0x5974('0x73')]=function(_0x55e9ac,_0x47f1a6,_0xf89121){return db['FaxAccount'][_0x5974('0x5e')]({'where':{'id':_0x55e9ac[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x47f1a6,null))[_0x5974('0x20')](function(_0x1159ed){if(_0x1159ed){return _0x1159ed[_0x5974('0x73')](_0x55e9ac[_0x5974('0x46')][_0x5974('0x6e')]);}})['then'](respondWithStatusCode(_0x47f1a6,null))[_0x5974('0x59')](handleError(_0x47f1a6,null));};exports[_0x5974('0x74')]=function(_0x39dc24,_0x4176d4,_0x3fb8e6){return db[_0x5974('0x75')][_0x5974('0x5e')]({'where':{'id':_0x39dc24[_0x5974('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4176d4,null))[_0x5974('0x20')](function(_0x3b4a97){if(_0x3b4a97){return _0x3b4a97[_0x5974('0x74')](_0x39dc24[_0x5974('0x60')][_0x5974('0x6e')],_[_0x5974('0x76')](_0x39dc24[_0x5974('0x60')],['ids','id'])||{});}})[_0x5974('0x20')](respondWithResult(_0x4176d4,null))[_0x5974('0x59')](handleError(_0x4176d4,null));};exports['getInteractions']=function(_0x5533d7,_0x4b1e43,_0x27ed94){var _0x88537e={'raw':![],'where':{}};var _0x24e98e={};var _0x37b929={'count':0x0,'rows':[]};return db[_0x5974('0x40')]['findOne']({'where':{'id':_0x5533d7[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x4b1e43,null))[_0x5974('0x20')](function(_0x32c1d2){if(_0x32c1d2){_0x24e98e[_0x5974('0x44')]=_[_0x5974('0x47')](db[_0x5974('0x75')][_0x5974('0x41')]);_0x24e98e[_0x5974('0x46')]=_[_0x5974('0x47')](_0x5533d7[_0x5974('0x46')]);_0x24e98e[_0x5974('0x48')]=_[_0x5974('0x49')](_0x24e98e[_0x5974('0x44')],_0x24e98e[_0x5974('0x46')]);_0x88537e[_0x5974('0x4a')]=_[_0x5974('0x49')](_0x24e98e[_0x5974('0x44')],qs['fields'](_0x5533d7[_0x5974('0x46')][_0x5974('0x4b')]));_0x88537e[_0x5974('0x4a')]=_0x88537e[_0x5974('0x4a')][_0x5974('0x4c')]?_0x88537e[_0x5974('0x4a')]:_0x24e98e[_0x5974('0x44')];if(!_0x5533d7[_0x5974('0x46')][_0x5974('0x4d')](_0x5974('0x4e'))){_0x88537e[_0x5974('0x32')]=qs[_0x5974('0x32')](_0x5533d7[_0x5974('0x46')]['limit']);_0x88537e[_0x5974('0x2f')]=qs[_0x5974('0x2f')](_0x5533d7['query'][_0x5974('0x2f')]);}_0x88537e[_0x5974('0x4f')]=qs[_0x5974('0x50')](_0x5533d7[_0x5974('0x46')][_0x5974('0x50')]);_0x88537e['where']=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x5533d7[_0x5974('0x46')],_0x24e98e[_0x5974('0x48')]));_0x88537e[_0x5974('0x51')][_0x5974('0x69')]=_0x32c1d2['id'];if(_0x5533d7[_0x5974('0x46')][_0x5974('0x53')]){_0x88537e['where']=_['merge'](_0x88537e[_0x5974('0x51')],{'$or':_[_0x5974('0x45')](_0x88537e['attributes'],function(_0x384cae){var _0x3f384b={};_0x3f384b[_0x384cae]={'$like':'%'+_0x5533d7['query'][_0x5974('0x53')]+'%'};return _0x3f384b;})});}_0x88537e=_[_0x5974('0x55')]({},_0x88537e,_0x5533d7[_0x5974('0x56')]);return db[_0x5974('0x75')]['count']({'where':_0x88537e[_0x5974('0x51')]})[_0x5974('0x20')](function(_0x1a4571){_0x37b929[_0x5974('0x31')]=_0x1a4571;if(_0x5533d7[_0x5974('0x46')]['includeAll']){_0x88537e[_0x5974('0x5d')]=[{'model':db[_0x5974('0x77')],'as':_0x5974('0x78'),'required':![]},{'model':db[_0x5974('0x79')],'as':_0x5974('0x7a'),'attributes':[_0x5974('0x3d'),_0x5974('0x7b'),_0x5974('0x7c')],'required':![]},{'model':db['Tag'],'as':_0x5974('0x7d'),'attributes':['id','name','color'],'where':_0x5533d7[_0x5974('0x46')][_0x5974('0x7e')]?{'id':_0x5533d7[_0x5974('0x46')][_0x5974('0x7e')]}:undefined,'required':_0x5533d7[_0x5974('0x46')][_0x5974('0x7e')]?!![]:![]}];}return db[_0x5974('0x75')]['findAll'](_0x88537e);})['then'](function(_0x1a84ec){_0x37b929['rows']=_0x1a84ec;return _0x37b929;});}})[_0x5974('0x20')](respondWithFilteredResult(_0x4b1e43,_0x88537e))['catch'](handleError(_0x4b1e43,null));};exports[_0x5974('0x7f')]=function(_0x9eaeb8,_0x48d880){var _0x9b7c07=_0x9eaeb8[_0x5974('0x5b')]['id'];var _0x79a7ee=_0x9eaeb8[_0x5974('0x60')];var _0x447a5d=0xc8;var _0x194f39=null;return db[_0x5974('0x80')][_0x5974('0x81')]({'isolationLevel':db['sequelize'][_0x5974('0x82')][_0x5974('0x83')]['READ_COMMITTED']},function(_0x1628f9){return db['FaxAccount']['findOne']({'where':{'id':_0x9b7c07},'transaction':_0x1628f9})[_0x5974('0x20')](function(_0x3069aa){if(_0x3069aa){return db[_0x5974('0x84')]['destroy']({'where':{'FaxAccountId':_0x9b7c07},'transaction':_0x1628f9})[_0x5974('0x20')](function(){var _0xd1c333=_[_0x5974('0x45')](_0x79a7ee,function(_0x3fd23d){_0x3fd23d[_0x5974('0x69')]=_0x9b7c07;return _0x3fd23d;});return db['FaxApplication'][_0x5974('0x85')](_0xd1c333,{'transaction':_0x1628f9});});}else{_0x447a5d=0x194;_0x194f39=[];}});})['then'](function(){if(_0x447a5d!==0x194){return db[_0x5974('0x84')][_0x5974('0x86')]({'where':{'FaxAccountId':_0x9b7c07},'order':_0x5974('0x87')})[_0x5974('0x20')](function(_0x43634e){_0x194f39=_0x43634e;});}})[_0x5974('0x59')](function(_0x1d2372){_0x447a5d=0x1f4;logger[_0x5974('0x27')](_0x1d2372[_0x5974('0x3c')]);if(_0x1d2372[_0x5974('0x3d')]){delete _0x1d2372[_0x5974('0x3d')];}_0x194f39=_0x1d2372;})[_0x5974('0x88')](function(){if(_0x194f39===null){_0x48d880[_0x5974('0x2b')](_0x447a5d);}else{if(_0x447a5d===0x1f4){_0x48d880['status'](_0x447a5d)[_0x5974('0x3e')](_0x194f39);}else{_0x48d880[_0x5974('0x2c')](_0x447a5d)[_0x5974('0x2e')](_0x194f39);}}});};exports[_0x5974('0x89')]=function(_0x47da66,_0x36ee88,_0x2b0850){var _0x346bf2={};var _0x5c1f88={};var _0x2ca325;var _0x1566da;return db[_0x5974('0x40')][_0x5974('0x6c')]({'where':{'id':_0x47da66[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x36ee88,null))['then'](function(_0x8f54eb){if(_0x8f54eb){_0x2ca325=_0x8f54eb;_0x5c1f88[_0x5974('0x44')]=_[_0x5974('0x47')](db['FaxApplication'][_0x5974('0x41')]);_0x5c1f88[_0x5974('0x46')]=_[_0x5974('0x47')](_0x47da66[_0x5974('0x46')]);_0x5c1f88[_0x5974('0x48')]=_[_0x5974('0x49')](_0x5c1f88[_0x5974('0x44')],_0x5c1f88[_0x5974('0x46')]);_0x346bf2[_0x5974('0x4a')]=_[_0x5974('0x49')](_0x5c1f88[_0x5974('0x44')],qs[_0x5974('0x4b')](_0x47da66[_0x5974('0x46')]['fields']));_0x346bf2[_0x5974('0x4a')]=_0x346bf2['attributes'][_0x5974('0x4c')]?_0x346bf2[_0x5974('0x4a')]:_0x5c1f88[_0x5974('0x44')];_0x346bf2[_0x5974('0x4f')]=qs[_0x5974('0x50')](_0x47da66[_0x5974('0x46')][_0x5974('0x50')]);_0x346bf2['where']=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x47da66[_0x5974('0x46')],_0x5c1f88[_0x5974('0x48')]));if(_0x47da66[_0x5974('0x46')][_0x5974('0x53')]){_0x346bf2[_0x5974('0x51')]=_[_0x5974('0x55')](_0x346bf2[_0x5974('0x51')],{'$or':_[_0x5974('0x45')](_0x346bf2['attributes'],function(_0x3bef07){var _0x4863c1={};_0x4863c1[_0x3bef07]={'$like':'%'+_0x47da66[_0x5974('0x46')][_0x5974('0x53')]+'%'};return _0x4863c1;})});}_0x346bf2=_[_0x5974('0x55')]({},_0x346bf2,_0x47da66[_0x5974('0x56')]);return _0x2ca325[_0x5974('0x89')](_0x346bf2);}})['then'](function(_0x4be07a){if(_0x4be07a){_0x1566da=_0x4be07a[_0x5974('0x4c')];if(!_0x47da66['query'][_0x5974('0x4d')](_0x5974('0x4e'))){_0x346bf2[_0x5974('0x32')]=qs[_0x5974('0x32')](_0x47da66[_0x5974('0x46')]['limit']);_0x346bf2[_0x5974('0x2f')]=qs[_0x5974('0x2f')](_0x47da66[_0x5974('0x46')]['offset']);}return _0x2ca325[_0x5974('0x89')](_0x346bf2);}})[_0x5974('0x20')](function(_0x11317d){if(_0x11317d){return _0x11317d?{'count':_0x1566da,'rows':_0x11317d}:null;}})['then'](respondWithResult(_0x36ee88,null))[_0x5974('0x59')](handleError(_0x36ee88,null));};function Extension(_0x53706a,_0x451e45,_0x2eae83,_0x469bc1){this['context']='from-voip-provider';this['exten']=_0x53706a[_0x5974('0x8a')];this[_0x5974('0x8b')]=_0x469bc1;this[_0x5974('0x43')]=_0x5974('0x8c');this[_0x5974('0x8d')]=_0x5974('0x8e');this[_0x5974('0x69')]=_0x53706a['id'];this[_0x5974('0x87')]=_0x451e45;this['appdata']=_0x2eae83;}function createExtensionsReciveFax(_0x7b5b4){var _0x4156bb=0x1;var _0x2a2344=[];_0x2a2344['push'](new Extension(_0x7b5b4,_0x4156bb,'',_0x5974('0x8f')));_0x4156bb+=0x1;_0x2a2344[_0x5974('0x90')](new Extension(_0x7b5b4,_0x4156bb,_0x5974('0x91'),_0x5974('0x92')));_0x4156bb+=0x1;for(var _0x37fc15 in _0x7b5b4){if(_0x7b5b4[_0x5974('0x4d')](_0x37fc15)&&(_0x37fc15===_0x5974('0x93')||_0x37fc15===_0x5974('0x8a')||_0x37fc15===_0x5974('0x94')||_0x37fc15==='faxdetect'||_0x37fc15==='headerinfo'||_0x37fc15===_0x5974('0x95')||_0x37fc15===_0x5974('0x96')||_0x37fc15==='modem'||_0x37fc15===_0x5974('0x97'))){_0x2a2344[_0x5974('0x90')](new Extension(_0x7b5b4,_0x4156bb,_0x5974('0x98')+_0x37fc15+')='+_0x7b5b4[_0x37fc15],'Set'));_0x4156bb+=0x1;}}_0x2a2344[_0x5974('0x90')](new Extension(_0x7b5b4,_0x4156bb,'6',_0x5974('0x99')));_0x4156bb+=0x1;_0x2a2344[_0x5974('0x90')](new Extension(_0x7b5b4,_0x4156bb,_0x5974('0x9a'),'ReceiveFax'));_0x4156bb=0x0;return _0x2a2344;}exports['addAccountApplications']=function(_0x2eba2e,_0x20d3f4,_0x4e3cae){var _0x128b95;return db['sequelize'][_0x5974('0x81')](function(_0x92e4be){return db[_0x5974('0x40')]['create'](_0x2eba2e[_0x5974('0x60')],{'transaction':_0x92e4be})['then'](function(_0xec6345){_0x128b95=_0xec6345['get']({'plain':!![]});return db[_0x5974('0x9b')][_0x5974('0x85')](createExtensionsReciveFax(_0x128b95),{'transaction':_0x92e4be});});})['then'](function(){return _0x128b95;})['then'](respondWithResult(_0x20d3f4,null))[_0x5974('0x59')](handleError(_0x20d3f4,null));};exports[_0x5974('0x9c')]=function(_0x3f9ed2,_0x51e803,_0x232fe1){var _0x1580d0;return db[_0x5974('0x80')][_0x5974('0x81')](function(_0x4b23a1){return db[_0x5974('0x40')]['update'](_0x3f9ed2['body'],{'where':{'id':_0x3f9ed2[_0x5974('0x60')]['id']},'transaction':_0x4b23a1})[_0x5974('0x20')](function(_0x10813c){return db['VoiceExtension'][_0x5974('0x3b')]({'where':{'FaxAccountId':_0x3f9ed2[_0x5974('0x60')]['id']},'transaction':_0x4b23a1})[_0x5974('0x20')](function(_0x55a8e5){return db[_0x5974('0x9b')][_0x5974('0x85')](createExtensionsReciveFax(_[_0x5974('0x76')](_0x3f9ed2[_0x5974('0x60')],['tech','key',_0x5974('0x9d'),'updatedAt',_0x5974('0x9e'),_0x5974('0x9f')])),{'transaction':_0x4b23a1});});});})[_0x5974('0x20')](function(){return db['FaxAccount'][_0x5974('0xa0')](_0x3f9ed2[_0x5974('0x60')]['id']);})[_0x5974('0x20')](respondWithResult(_0x51e803,null))[_0x5974('0x59')](handleError(_0x51e803,null));};exports[_0x5974('0xa1')]=function(_0x1a34c8,_0x149b18,_0x16a7c8){var _0x232177={'raw':!![],'where':{}};var _0x1a3f2b={};var _0x38a4ab={'count':0x0,'rows':[]};return db[_0x5974('0x40')][_0x5974('0x6c')]({'where':{'id':_0x1a34c8[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x149b18,null))[_0x5974('0x20')](function(_0x83c2d4){if(_0x83c2d4){_0x1a3f2b['model']=_[_0x5974('0x47')](db[_0x5974('0xa2')]['rawAttributes']);_0x1a3f2b[_0x5974('0x46')]=_[_0x5974('0x47')](_0x1a34c8[_0x5974('0x46')]);_0x1a3f2b[_0x5974('0x48')]=_[_0x5974('0x49')](_0x1a3f2b[_0x5974('0x44')],_0x1a3f2b[_0x5974('0x46')]);_0x232177[_0x5974('0x4a')]=_[_0x5974('0x49')](_0x1a3f2b[_0x5974('0x44')],qs[_0x5974('0x4b')](_0x1a34c8[_0x5974('0x46')][_0x5974('0x4b')]));_0x232177[_0x5974('0x4a')]=_0x232177[_0x5974('0x4a')][_0x5974('0x4c')]?_0x232177[_0x5974('0x4a')]:_0x1a3f2b[_0x5974('0x44')];if(!_0x1a34c8[_0x5974('0x46')][_0x5974('0x4d')](_0x5974('0x4e'))){_0x232177[_0x5974('0x32')]=qs[_0x5974('0x32')](_0x1a34c8[_0x5974('0x46')][_0x5974('0x32')]);_0x232177['offset']=qs[_0x5974('0x2f')](_0x1a34c8[_0x5974('0x46')]['offset']);}_0x232177[_0x5974('0x4f')]=qs['sort'](_0x1a34c8[_0x5974('0x46')][_0x5974('0x50')]);_0x232177[_0x5974('0x51')]=qs[_0x5974('0x48')](_['pick'](_0x1a34c8['query'],_0x1a3f2b[_0x5974('0x48')]));_0x232177[_0x5974('0x51')][_0x5974('0x69')]=_0x83c2d4['id'];if(_0x1a34c8[_0x5974('0x46')]['filter']){_0x232177['where']=_[_0x5974('0x55')](_0x232177['where'],{'$or':_[_0x5974('0x45')](_0x232177[_0x5974('0x4a')],function(_0x3b6ae2){var _0x32b622={};_0x32b622[_0x3b6ae2]={'$like':'%'+_0x1a34c8['query']['filter']+'%'};return _0x32b622;})});}if(_0x1a34c8[_0x5974('0x46')][_0x5974('0xa3')]){var _0x507019=_0x1a34c8[_0x5974('0x46')][_0x5974('0xa3')][_0x5974('0xa4')](',');var _0x2c7aef={};_0x2c7aef[_0x507019[0x0]]={'$gte':moment(_0x507019[0x1])[_0x5974('0xa5')](_0x5974('0xa6'))};_0x232177[_0x5974('0x51')]=_[_0x5974('0x55')](_0x232177[_0x5974('0x51')],_0x2c7aef);}_0x232177=_[_0x5974('0x55')]({},_0x232177,_0x1a34c8[_0x5974('0x56')]);return db['FaxMessage'][_0x5974('0x31')]({'where':_0x232177[_0x5974('0x51')]})[_0x5974('0x20')](function(_0xa64abb){_0x38a4ab['count']=_0xa64abb;if(_0x1a34c8[_0x5974('0x46')][_0x5974('0x57')]){_0x232177[_0x5974('0x5d')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x232177);})[_0x5974('0x20')](function(_0x74562c){_0x38a4ab[_0x5974('0x72')]=_0x74562c;return _0x38a4ab;});}})[_0x5974('0x20')](respondWithFilteredResult(_0x149b18,_0x232177))[_0x5974('0x59')](handleError(_0x149b18,null));};exports[_0x5974('0x3e')]=function(_0x1b050b,_0x27c06c,_0x42fc70){var _0x479cc3,_0x709caa={},_0x5bbe89;if(_0x1b050b[_0x5974('0x60')]['to']){_0x5bbe89=_0x1b050b[_0x5974('0x60')]['to'][0x0];}return db['FaxAccount'][_0x5974('0x5e')]({'where':{'id':_0x1b050b[_0x5974('0x5b')]['id']},'include':[{'model':db[_0x5974('0xa7')],'as':_0x5974('0xa8'),'include':[{'model':db[_0x5974('0x77')],'as':_0x5974('0xa9'),'where':{'fax':_0x5bbe89},'limit':0x1,'order':[[_0x5974('0xaa'),_0x5974('0xab')]]}]}]})[_0x5974('0x20')](handleEntityNotFound(_0x27c06c,null))[_0x5974('0x20')](function(_0x327784){_0x479cc3=_0x327784;if(_0x1b050b[_0x5974('0x60')][_0x5974('0xac')]&&_0x1b050b[_0x5974('0x60')]['attachments'][_0x5974('0x4c')]){for(var _0x44cddc=0x0;_0x44cddc<_0x1b050b['body'][_0x5974('0xac')]['length'];_0x44cddc+=0x1){_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][_0x44cddc]={'filename':_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][_0x44cddc][_0x5974('0x3d')],'id':_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][_0x44cddc]['id'],'path':path[_0x5974('0xad')](config[_0x5974('0xae')],_0x5974('0xaf'),_0x1b050b[_0x5974('0x60')]['attachments'][_0x44cddc]['basename'])};}}return respondWithRpcPromise(_0x5974('0xb0'),_0x5974('0xb0'),{'FaxAccountId':_[_0x5974('0xb1')](_0x1b050b[_0x5974('0x5b')]['id'])?undefined:_0x1b050b[_0x5974('0x5b')]['id'],'path':_[_0x5974('0xb1')](_0x1b050b['body']['attachments'][0x0]['path'])?undefined:_0x1b050b['body'][_0x5974('0xac')][0x0]['path'],'fax':_[_0x5974('0xb1')](_0x1b050b[_0x5974('0x60')]['to'][0x0])?undefined:_0x1b050b[_0x5974('0x60')]['to'][0x0]},client9002);})[_0x5974('0x20')](function(){if(_0x479cc3){if(_[_0x5974('0xb1')](_0x1b050b[_0x5974('0x60')]['from'])){_0x1b050b[_0x5974('0x60')][_0x5974('0xb2')]=util['format']('\x22%s\x22\x20<%s>',_0x479cc3['name'],_0x479cc3[_0x5974('0xb3')]);}if(_0x479cc3[_0x5974('0xa8')]){if(_0x479cc3[_0x5974('0xa8')]['Contacts'][_0x5974('0x4c')]){return _0x479cc3[_0x5974('0xa8')][_0x5974('0xa9')][0x0];}else{return db[_0x5974('0x77')][_0x5974('0x5f')](_[_0x5974('0x17')](_0x1b050b[_0x5974('0x60')],{'firstName':_0x1b050b[_0x5974('0x60')]['to'][0x0],'phone':_0x1b050b['body']['to'][0x0],'fax':_0x1b050b['body']['to'][0x0],'ListId':_0x479cc3[_0x5974('0x9f')]}));}}else{throw new Error(_0x5974('0xb4'));}}else{throw new Error(_0x5974('0xb5'));}})[_0x5974('0x20')](function(_0x4e873e){if(_0x4e873e){return db[_0x5974('0x75')][_0x5974('0x5e')]({'where':{'ContactId':_0x4e873e['id'],'closed':![],'FaxAccountId':_0x479cc3['id']}})[_0x5974('0x20')](function(_0x344045){if(_0x344045){return[_0x344045,![]];}return db[_0x5974('0x75')][_0x5974('0x5f')]({'UserId':_0x1b050b[_0x5974('0x63')]['id'],'ContactId':_0x4e873e['id'],'FaxAccountId':_0x479cc3['id'],'fax':_0x1b050b[_0x5974('0x60')]['to'][0x0],'firstMsgDirection':_0x5974('0xb6'),'Messages':[_['merge'](_0x1b050b[_0x5974('0x60')],{'read':![],'body':_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][0x0][_0x5974('0xb7')],'FaxAccountId':_0x479cc3['id'],'UserId':_0x1b050b[_0x5974('0x63')]['id'],'ContactId':_0x4e873e['id'],'AttachmentId':_0x1b050b['body'][_0x5974('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x5974('0xb8')}]})[_0x5974('0x20')](function(_0x51d07c){return[_0x51d07c,!![]];});});}else{throw new Error(_0x5974('0xb9'));}})['spread'](function(_0x2f50f1,_0x116950){if(_0x116950){return _0x2f50f1;}return db[_0x5974('0xa2')][_0x5974('0x5f')]({'direction':_0x5974('0xb6'),'read':![],'body':_0x1b050b[_0x5974('0x60')]['attachments'][0x0][_0x5974('0xb7')],'FaxAccountId':_0x479cc3['id'],'FaxInteractionId':_0x2f50f1['id'],'UserId':_0x1b050b['user']['id'],'ContactId':_0x2f50f1[_0x5974('0xba')],'AttachmentId':_0x1b050b['body'][_0x5974('0xac')][0x0]['id']})['then'](function(_0x158472){_0x2f50f1[_0x5974('0xbb')][_0x5974('0xb8')]=[];_0x2f50f1[_0x5974('0xbb')][_0x5974('0xb8')][_0x5974('0x90')](_0x158472[_0x5974('0xbb')]);return _0x2f50f1;});})[_0x5974('0x20')](function(_0x2ab1dc){respondWithRpcPromise(_0x5974('0xbc'),'SendFax',{'FaxAccountId':_[_0x5974('0xb1')](_0x1b050b['params']['id'])?undefined:_0x1b050b[_0x5974('0x5b')]['id'],'path':_[_0x5974('0xb1')](_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][0x0][_0x5974('0x7')])?undefined:_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][0x0]['path'],'fax':_[_0x5974('0xb1')](_0x1b050b[_0x5974('0x60')]['to'][0x0])?undefined:_0x1b050b['body']['to'][0x0],'AttachmentId':_0x1b050b[_0x5974('0x60')][_0x5974('0xac')][0x0]['id']},client9002)[_0x5974('0x20')](function(_0x43df7d){logger[_0x5974('0x21')](_0x5974('0xbd'),_0x43df7d);})[_0x5974('0x59')](function(_0x1b3bf4){logger[_0x5974('0x21')](_0x5974('0xbd'),_0x1b3bf4);});return _0x2ab1dc;})[_0x5974('0x20')](respondWithResult(_0x27c06c,null))['catch'](handleError(_0x27c06c,null));};exports[_0x5974('0xbe')]=function(_0x49d0c4,_0x43aba9,_0x142826){return db[_0x5974('0x40')][_0x5974('0x5e')]({'where':{'id':_0x49d0c4[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x43aba9,null))[_0x5974('0x20')](function(_0x1cb5d6){if(_0x1cb5d6){return _0x1cb5d6[_0x5974('0xbe')](_0x49d0c4[_0x5974('0x60')][_0x5974('0x6e')],_['omit'](_0x49d0c4['body'],['ids','id'])||{})['spread'](function(_0x5e0f3a){for(var _0x40d057=0x0;_0x40d057<_0x49d0c4[_0x5974('0x60')][_0x5974('0x6e')][_0x5974('0x4c')];_0x40d057+=0x1){socket[_0x5974('0xbf')](_0x5974('0xc0'),{'UserId':Number(_0x49d0c4[_0x5974('0x60')]['ids'][_0x40d057]),'FaxAccountId':Number(_0x49d0c4['params']['id'])});}return _0x5e0f3a;});}})[_0x5974('0x20')](respondWithResult(_0x43aba9,null))['catch'](handleError(_0x43aba9,null));};exports[_0x5974('0xc1')]=function(_0x39e703,_0x3e66d7,_0x36181e){return db[_0x5974('0x40')]['find']({'where':{'id':_0x39e703[_0x5974('0x5b')]['id']}})[_0x5974('0x20')](handleEntityNotFound(_0x3e66d7,null))[_0x5974('0x20')](function(_0x203f35){if(_0x203f35){return _0x203f35[_0x5974('0xc1')](_0x39e703['query']['ids'])[_0x5974('0x20')](function(){if(_[_0x5974('0xc2')](_0x39e703[_0x5974('0x46')][_0x5974('0x6e')])){for(var _0x5984f6=0x0;_0x5984f6<_0x39e703[_0x5974('0x46')][_0x5974('0x6e')][_0x5974('0x4c')];_0x5984f6+=0x1){socket[_0x5974('0xbf')](_0x5974('0xc3'),{'UserId':Number(_0x39e703[_0x5974('0x46')]['ids'][_0x5984f6]),'FaxAccountId':Number(_0x39e703[_0x5974('0x5b')]['id'])});}}else{socket[_0x5974('0xbf')](_0x5974('0xc3'),{'UserId':Number(_0x39e703['query'][_0x5974('0x6e')]),'FaxAccountId':Number(_0x39e703[_0x5974('0x5b')]['id'])});}});}})[_0x5974('0x20')](respondWithStatusCode(_0x3e66d7,null))[_0x5974('0x59')](handleError(_0x3e66d7,null));};exports[_0x5974('0xc4')]=function(_0x27517d,_0x260d56,_0x16a44f){var _0x45da44={};var _0x1c4aa5={};var _0x41a875;var _0x1d9ffa;return db[_0x5974('0x40')]['findOne']({'where':{'id':_0x27517d[_0x5974('0x5b')]['id']}})['then'](handleEntityNotFound(_0x260d56,null))[_0x5974('0x20')](function(_0x52cded){if(_0x52cded){_0x41a875=_0x52cded;_0x1c4aa5['model']=_['keys'](db[_0x5974('0x79')]['rawAttributes']);_0x1c4aa5[_0x5974('0x46')]=_[_0x5974('0x47')](_0x27517d[_0x5974('0x46')]);_0x1c4aa5['filters']=_[_0x5974('0x49')](_0x1c4aa5['model'],_0x1c4aa5['query']);_0x45da44['attributes']=_['intersection'](_0x1c4aa5['model'],qs[_0x5974('0x4b')](_0x27517d[_0x5974('0x46')][_0x5974('0x4b')]));_0x45da44[_0x5974('0x4a')]=_0x45da44[_0x5974('0x4a')][_0x5974('0x4c')]?_0x45da44['attributes']:_0x1c4aa5[_0x5974('0x44')];_0x45da44[_0x5974('0x4f')]=qs[_0x5974('0x50')](_0x27517d[_0x5974('0x46')][_0x5974('0x50')]);_0x45da44[_0x5974('0x51')]=qs[_0x5974('0x48')](_[_0x5974('0x52')](_0x27517d[_0x5974('0x46')],_0x1c4aa5[_0x5974('0x48')]));if(_0x27517d[_0x5974('0x46')][_0x5974('0x53')]){_0x45da44['where']=_[_0x5974('0x55')](_0x45da44[_0x5974('0x51')],{'$or':_[_0x5974('0x45')](_0x45da44['attributes'],function(_0x2d88ba){var _0x371a92={};_0x371a92[_0x2d88ba]={'$like':'%'+_0x27517d[_0x5974('0x46')][_0x5974('0x53')]+'%'};return _0x371a92;})});}_0x45da44=_[_0x5974('0x55')]({},_0x45da44,_0x27517d[_0x5974('0x56')]);return _0x41a875[_0x5974('0xc4')](_0x45da44);}})[_0x5974('0x20')](function(_0x3de35d){if(_0x3de35d){_0x1d9ffa=_0x3de35d[_0x5974('0x4c')];if(!_0x27517d[_0x5974('0x46')][_0x5974('0x4d')](_0x5974('0x4e'))){_0x45da44['limit']=qs[_0x5974('0x32')](_0x27517d['query'][_0x5974('0x32')]);_0x45da44[_0x5974('0x2f')]=qs['offset'](_0x27517d['query'][_0x5974('0x2f')]);}return _0x41a875[_0x5974('0xc4')](_0x45da44);}})[_0x5974('0x20')](function(_0x378823){if(_0x378823){return _0x378823?{'count':_0x1d9ffa,'rows':_0x378823}:null;}})[_0x5974('0x20')](respondWithResult(_0x260d56,null))[_0x5974('0x59')](handleError(_0x260d56,null));}; \ No newline at end of file +var _0xdb25=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','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','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','options','Contact','Owner','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','finally','getApplications','context','exten','localstationid','app','Fax\x20Extension','appdata','Answer','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','tech','key','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Contact\x20not\x20found','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x3def05,_0xcb8497){var _0x372773=function(_0x22a4cb){while(--_0x22a4cb){_0x3def05['push'](_0x3def05['shift']());}};_0x372773(++_0xcb8497);}(_0xdb25,0xaf));var _0x5db2=function(_0x53f89c,_0x34de7a){_0x53f89c=_0x53f89c-0x0;var _0x352dc9=_0xdb25[_0x53f89c];return _0x352dc9;};'use strict';var emlformat=require(_0x5db2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5db2('0x1'));var moment=require(_0x5db2('0x2'));var BPromise=require(_0x5db2('0x3'));var Mustache=require(_0x5db2('0x4'));var util=require(_0x5db2('0x5'));var path=require(_0x5db2('0x6'));var sox=require(_0x5db2('0x7'));var csv=require(_0x5db2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db2('0x9'));var _=require(_0x5db2('0xa'));var squel=require('squel');var crypto=require(_0x5db2('0xb'));var jsforce=require(_0x5db2('0xc'));var deskjs=require(_0x5db2('0xd'));var toCsv=require(_0x5db2('0x8'));var querystring=require(_0x5db2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5db2('0xf'));var authService=require(_0x5db2('0x10'));var qs=require(_0x5db2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5db2('0x12'));var logger=require(_0x5db2('0x13'))('api');var utils=require(_0x5db2('0x14'));var config=require(_0x5db2('0x15'));var licenseUtil=require(_0x5db2('0x16'));var db=require(_0x5db2('0x17'))['db'];config[_0x5db2('0x18')]=_['defaults'](config[_0x5db2('0x18')],{'host':_0x5db2('0x19'),'port':0x18eb});var socket=require(_0x5db2('0x1a'))(new Redis(config[_0x5db2('0x18')]));require(_0x5db2('0x1b'))[_0x5db2('0x1c')](socket);var jayson=require(_0x5db2('0x1d'));var client=jayson[_0x5db2('0x1e')][_0x5db2('0x1f')]({'port':0x232c});var client9002=jayson[_0x5db2('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3425d9,_0xbd7aa8,_0x4d8d2b,_0x5c163d){return new BPromise(function(_0x209020,_0x2bfe05){var _0x532acf=_0x5c163d||client;return _0x532acf['request'](_0x3425d9,_0x4d8d2b)[_0x5db2('0x20')](function(_0x9f9759){logger[_0x5db2('0x21')](_0x5db2('0x22'),_0xbd7aa8,_0x5db2('0x23'));logger[_0x5db2('0x24')](_0x5db2('0x25'),_0xbd7aa8,_0x5db2('0x23'),JSON['stringify'](_0x9f9759));if(_0x9f9759[_0x5db2('0x26')]){if(_0x9f9759[_0x5db2('0x26')][_0x5db2('0x27')]===0x1f4){logger[_0x5db2('0x26')](_0x5db2('0x22'),_0xbd7aa8,_0x9f9759[_0x5db2('0x26')][_0x5db2('0x28')]);return _0x2bfe05(_0x9f9759[_0x5db2('0x26')][_0x5db2('0x28')]);}logger[_0x5db2('0x26')](_0x5db2('0x22'),_0xbd7aa8,_0x9f9759[_0x5db2('0x26')]['message']);return _0x209020(_0x9f9759[_0x5db2('0x26')]['message']);}else{logger[_0x5db2('0x21')](_0x5db2('0x22'),_0xbd7aa8,_0x5db2('0x23'));_0x209020(_0x9f9759['result'][_0x5db2('0x28')]);}})[_0x5db2('0x29')](function(_0x3321bf){logger[_0x5db2('0x26')](_0x5db2('0x22'),_0xbd7aa8,_0x3321bf);_0x2bfe05(_0x3321bf);});});}function respondWithStatusCode(_0x356f4a,_0xf35996){_0xf35996=_0xf35996||0xcc;return function(_0x5a668f){if(_0x5a668f){return _0x356f4a[_0x5db2('0x2a')](_0xf35996);}return _0x356f4a[_0x5db2('0x2b')](_0xf35996)[_0x5db2('0x2c')]();};}function respondWithResult(_0x61a6da,_0xf44cb3){_0xf44cb3=_0xf44cb3||0xc8;return function(_0x108f7a){if(_0x108f7a){return _0x61a6da[_0x5db2('0x2b')](_0xf44cb3)[_0x5db2('0x2d')](_0x108f7a);}};}function respondWithFilteredResult(_0x40f222,_0x415388){return function(_0x274689){if(_0x274689){var _0x571820=typeof _0x415388['offset']===_0x5db2('0x2e')&&typeof _0x415388[_0x5db2('0x2f')]===_0x5db2('0x2e');var _0x558a56=_0x274689[_0x5db2('0x30')];var _0x14e4eb=_0x571820?0x0:_0x415388[_0x5db2('0x31')];var _0x52287f=_0x571820?_0x274689[_0x5db2('0x30')]:_0x415388[_0x5db2('0x31')]+_0x415388[_0x5db2('0x2f')];var _0x2bed67;if(_0x52287f>=_0x558a56){_0x52287f=_0x558a56;_0x2bed67=0xc8;}else{_0x2bed67=0xce;}_0x40f222[_0x5db2('0x2b')](_0x2bed67);return _0x40f222[_0x5db2('0x32')]('Content-Range',_0x14e4eb+'-'+_0x52287f+'/'+_0x558a56)['json'](_0x274689);}return null;};}function patchUpdates(_0x52f0d8){return function(_0x21e11a){try{jsonpatch['apply'](_0x21e11a,_0x52f0d8,!![]);}catch(_0x4a1e58){return BPromise[_0x5db2('0x33')](_0x4a1e58);}return _0x21e11a[_0x5db2('0x34')]();};}function saveUpdates(_0x345cd4,_0x48c8d7){return function(_0x1f85e0){if(_0x1f85e0){return _0x1f85e0[_0x5db2('0x35')](_0x345cd4)[_0x5db2('0x20')](function(_0x36fe11){return _0x36fe11;});}return null;};}function removeEntity(_0x2e3938,_0x5f1e3a){return function(_0x2bf1c3){if(_0x2bf1c3){return _0x2bf1c3[_0x5db2('0x36')]()[_0x5db2('0x20')](function(){var _0x11413f=_0x2bf1c3[_0x5db2('0x37')]({'plain':!![]});var _0x50c206=_0x5db2('0x38');return db[_0x5db2('0x39')][_0x5db2('0x36')]({'where':{'type':_0x50c206,'resourceId':_0x11413f['id']}})[_0x5db2('0x20')](function(){return _0x2bf1c3;});})['then'](function(){_0x2e3938[_0x5db2('0x2b')](0xcc)[_0x5db2('0x2c')]();});}};}function handleEntityNotFound(_0x423349,_0xb7ef46){return function(_0x50615d){if(!_0x50615d){_0x423349['sendStatus'](0x194);}return _0x50615d;};}function handleError(_0x3b0339,_0x20a38f){_0x20a38f=_0x20a38f||0x1f4;return function(_0x16ac9f){logger[_0x5db2('0x26')](_0x16ac9f[_0x5db2('0x3a')]);if(_0x16ac9f[_0x5db2('0x3b')]){delete _0x16ac9f[_0x5db2('0x3b')];}_0x3b0339[_0x5db2('0x2b')](_0x20a38f)[_0x5db2('0x3c')](_0x16ac9f);};}exports['index']=function(_0xa4c8e6,_0x392550){var _0x14eccf={'include':[{'model':db[_0x5db2('0x3d')],'as':_0x5db2('0x3e')}]},_0x189e7d={},_0x27332f={'count':0x0,'rows':[]};var _0x2e3c56=_[_0x5db2('0x3f')](db[_0x5db2('0x40')][_0x5db2('0x41')],function(_0x418d4e){return{'name':_0x418d4e[_0x5db2('0x42')],'type':_0x418d4e[_0x5db2('0x43')]['key']};});_0x189e7d[_0x5db2('0x44')]=_['map'](_0x2e3c56,'name');_0x189e7d[_0x5db2('0x45')]=_[_0x5db2('0x46')](_0xa4c8e6[_0x5db2('0x45')]);_0x189e7d[_0x5db2('0x47')]=_[_0x5db2('0x48')](_0x189e7d[_0x5db2('0x44')],_0x189e7d[_0x5db2('0x45')]);_0x14eccf[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0x189e7d[_0x5db2('0x44')],qs[_0x5db2('0x4a')](_0xa4c8e6[_0x5db2('0x45')][_0x5db2('0x4a')]));_0x14eccf['attributes']=_0x14eccf['attributes'][_0x5db2('0x4b')]?_0x14eccf[_0x5db2('0x49')]:_0x189e7d[_0x5db2('0x44')];if(!_0xa4c8e6[_0x5db2('0x45')][_0x5db2('0x4c')]('nolimit')){_0x14eccf['limit']=qs[_0x5db2('0x2f')](_0xa4c8e6['query'][_0x5db2('0x2f')]);_0x14eccf[_0x5db2('0x31')]=qs['offset'](_0xa4c8e6[_0x5db2('0x45')]['offset']);}_0x14eccf[_0x5db2('0x4d')]=qs[_0x5db2('0x4e')](_0xa4c8e6[_0x5db2('0x45')][_0x5db2('0x4e')]);_0x14eccf[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0xa4c8e6[_0x5db2('0x45')],_0x189e7d['filters']),_0x2e3c56);if(_0xa4c8e6[_0x5db2('0x45')]['filter']){_0x14eccf[_0x5db2('0x4f')]=_['merge'](_0x14eccf[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x2e3c56,function(_0x16f55c){if(_0x16f55c[_0x5db2('0x43')]!=='VIRTUAL'){var _0x31d5f6={};_0x31d5f6[_0x16f55c[_0x5db2('0x3b')]]={'$like':'%'+_0xa4c8e6[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x31d5f6;}})});}_0x14eccf=_[_0x5db2('0x52')]({},_0x14eccf,_0xa4c8e6['options']);var _0x3b4668={'where':_0x14eccf[_0x5db2('0x4f')]};return db[_0x5db2('0x40')]['count'](_0x3b4668)[_0x5db2('0x20')](function(_0x10ef63){_0x27332f[_0x5db2('0x30')]=_0x10ef63;if(_0xa4c8e6['query'][_0x5db2('0x53')]){_0x14eccf[_0x5db2('0x54')]=[{'all':!![]}];}return db[_0x5db2('0x40')][_0x5db2('0x55')](_0x14eccf);})[_0x5db2('0x20')](function(_0x6850cc){_0x27332f[_0x5db2('0x56')]=_0x6850cc;return _0x27332f;})[_0x5db2('0x20')](respondWithFilteredResult(_0x392550,_0x14eccf))[_0x5db2('0x29')](handleError(_0x392550,null));};exports[_0x5db2('0x57')]=function(_0x23eb31,_0x20f217){var _0x3acaed={'raw':![],'where':{'id':_0x23eb31[_0x5db2('0x58')]['id']},'include':[{'model':db[_0x5db2('0x3d')],'as':_0x5db2('0x3e')}]},_0x55f38e={};_0x55f38e['model']=_[_0x5db2('0x46')](db['FaxAccount'][_0x5db2('0x41')]);_0x55f38e[_0x5db2('0x45')]=_[_0x5db2('0x46')](_0x23eb31[_0x5db2('0x45')]);_0x55f38e[_0x5db2('0x47')]=_['intersection'](_0x55f38e['model'],_0x55f38e[_0x5db2('0x45')]);_0x3acaed[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0x55f38e[_0x5db2('0x44')],qs[_0x5db2('0x4a')](_0x23eb31['query'][_0x5db2('0x4a')]));_0x3acaed[_0x5db2('0x49')]=_0x3acaed[_0x5db2('0x49')]['length']?_0x3acaed[_0x5db2('0x49')]:_0x55f38e[_0x5db2('0x44')];if(_0x23eb31['query']['includeAll']){_0x3acaed[_0x5db2('0x54')]=[{'all':!![]}];}_0x3acaed=_[_0x5db2('0x52')]({},_0x3acaed,_0x23eb31['options']);return db[_0x5db2('0x40')][_0x5db2('0x59')](_0x3acaed)[_0x5db2('0x20')](handleEntityNotFound(_0x20f217,null))[_0x5db2('0x20')](respondWithResult(_0x20f217,null))[_0x5db2('0x29')](handleError(_0x20f217,null));};exports[_0x5db2('0x5a')]=function(_0x36cd6c,_0x25d5b4){return db['FaxAccount'][_0x5db2('0x5a')](_0x36cd6c[_0x5db2('0x5b')],{})['then'](function(_0x51e8c4){var _0x2d6eec=_0x36cd6c[_0x5db2('0x5c')][_0x5db2('0x37')]({'plain':!![]});if(!_0x2d6eec)throw new Error(_0x5db2('0x5d'));if(_0x2d6eec[_0x5db2('0x5e')]==='user'){var _0x3dcc6a=_0x51e8c4['get']({'plain':!![]});var _0x227cab=_0x5db2('0x38');return db[_0x5db2('0x5f')][_0x5db2('0x59')]({'where':{'name':_0x227cab,'userProfileId':_0x2d6eec[_0x5db2('0x60')]},'raw':!![]})['then'](function(_0x5deda3){if(_0x5deda3&&_0x5deda3[_0x5db2('0x61')]===0x0){return db[_0x5db2('0x39')][_0x5db2('0x5a')]({'name':_0x3dcc6a[_0x5db2('0x3b')],'resourceId':_0x3dcc6a['id'],'type':_0x5deda3['name'],'sectionId':_0x5deda3['id']},{})[_0x5db2('0x20')](function(){return _0x51e8c4;});}else{return _0x51e8c4;}})[_0x5db2('0x29')](function(_0x36672d){logger[_0x5db2('0x26')](_0x5db2('0x62'),_0x36672d);throw _0x36672d;});}return _0x51e8c4;})[_0x5db2('0x20')](respondWithResult(_0x25d5b4,0xc9))[_0x5db2('0x29')](handleError(_0x25d5b4,null));};exports[_0x5db2('0x35')]=function(_0x4daed4,_0xe92ef6){if(_0x4daed4['body']['id']){delete _0x4daed4[_0x5db2('0x5b')]['id'];}return db[_0x5db2('0x40')][_0x5db2('0x59')]({'where':{'id':_0x4daed4[_0x5db2('0x58')]['id']},'include':[{'model':db[_0x5db2('0x3d')],'as':_0x5db2('0x3e')}]})[_0x5db2('0x20')](handleEntityNotFound(_0xe92ef6,null))['then'](saveUpdates(_0x4daed4[_0x5db2('0x5b')],null))[_0x5db2('0x20')](respondWithResult(_0xe92ef6,null))['catch'](handleError(_0xe92ef6,null));};exports[_0x5db2('0x36')]=function(_0x3dc37c,_0x2aa5d9){return db['FaxAccount'][_0x5db2('0x59')]({'where':{'id':_0x3dc37c[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x2aa5d9,null))['then'](removeEntity(_0x2aa5d9,null))[_0x5db2('0x29')](handleError(_0x2aa5d9,null));};exports[_0x5db2('0x63')]=function(_0x55251c,_0x86b443){return db[_0x5db2('0x40')][_0x5db2('0x63')]()[_0x5db2('0x20')](respondWithResult(_0x86b443,null))[_0x5db2('0x29')](handleError(_0x86b443,null));};exports[_0x5db2('0x64')]=function(_0xdd0bc,_0x17bb16,_0x4a4bc7){if(_0xdd0bc[_0x5db2('0x5b')]['id']){delete _0xdd0bc[_0x5db2('0x5b')]['id'];}return db[_0x5db2('0x40')]['find']({'where':{'id':_0xdd0bc['params']['id']}})['then'](handleEntityNotFound(_0x17bb16,null))[_0x5db2('0x20')](function(_0x10cc72){if(_0x10cc72){_0xdd0bc[_0x5db2('0x5b')][_0x5db2('0x65')]=_0x10cc72['id'];return db[_0x5db2('0x66')][_0x5db2('0x5a')](_0xdd0bc[_0x5db2('0x5b')]);}})[_0x5db2('0x20')](respondWithResult(_0x17bb16,null))[_0x5db2('0x29')](handleError(_0x17bb16,null));};exports[_0x5db2('0x67')]=function(_0x10847c,_0x500878,_0x117bce){var _0x1637b5={'raw':![],'where':{}};var _0x3d280b={};var _0x5c2be1={'count':0x0,'rows':[]};return db[_0x5db2('0x40')][_0x5db2('0x68')]({'where':{'id':_0x10847c[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x500878,null))[_0x5db2('0x20')](function(_0x109a50){if(_0x109a50){_0x3d280b['model']=_[_0x5db2('0x46')](db[_0x5db2('0x66')]['rawAttributes']);_0x3d280b[_0x5db2('0x45')]=_['keys'](_0x10847c[_0x5db2('0x45')]);_0x3d280b[_0x5db2('0x47')]=_[_0x5db2('0x48')](_0x3d280b['model'],_0x3d280b[_0x5db2('0x45')]);_0x1637b5[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0x3d280b[_0x5db2('0x44')],qs['fields'](_0x10847c[_0x5db2('0x45')][_0x5db2('0x4a')]));_0x1637b5[_0x5db2('0x49')]=_0x1637b5['attributes'][_0x5db2('0x4b')]?_0x1637b5['attributes']:_0x3d280b['model'];if(!_0x10847c[_0x5db2('0x45')][_0x5db2('0x4c')](_0x5db2('0x69'))){_0x1637b5[_0x5db2('0x2f')]=qs[_0x5db2('0x2f')](_0x10847c[_0x5db2('0x45')]['limit']);_0x1637b5[_0x5db2('0x31')]=qs['offset'](_0x10847c[_0x5db2('0x45')][_0x5db2('0x31')]);}_0x1637b5[_0x5db2('0x4d')]=qs[_0x5db2('0x4e')](_0x10847c[_0x5db2('0x45')][_0x5db2('0x4e')]);_0x1637b5[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_['pick'](_0x10847c[_0x5db2('0x45')],_0x3d280b[_0x5db2('0x47')]));_0x1637b5[_0x5db2('0x4f')]['FaxAccountId']=_0x109a50['id'];if(_0x10847c[_0x5db2('0x45')][_0x5db2('0x51')]){_0x1637b5[_0x5db2('0x4f')]=_[_0x5db2('0x52')](_0x1637b5[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x1637b5['attributes'],function(_0x3a6bb1){var _0xdcb2e1={};_0xdcb2e1[_0x3a6bb1]={'$like':'%'+_0x10847c['query'][_0x5db2('0x51')]+'%'};return _0xdcb2e1;})});}_0x1637b5=_['merge']({},_0x1637b5,_0x10847c['options']);return db[_0x5db2('0x66')][_0x5db2('0x30')]({'where':_0x1637b5['where']})[_0x5db2('0x20')](function(_0x2b9b5f){_0x5c2be1[_0x5db2('0x30')]=_0x2b9b5f;if(_0x10847c['query'][_0x5db2('0x53')]){_0x1637b5[_0x5db2('0x54')]=[{'all':!![]}];}return db[_0x5db2('0x66')][_0x5db2('0x55')](_0x1637b5);})[_0x5db2('0x20')](function(_0x2ed5e1){_0x5c2be1[_0x5db2('0x56')]=_0x2ed5e1;return _0x5c2be1;});}})[_0x5db2('0x20')](respondWithFilteredResult(_0x500878,_0x1637b5))[_0x5db2('0x29')](handleError(_0x500878,null));};exports[_0x5db2('0x6a')]=function(_0x48e1e0,_0x2484ed,_0x1cb357){return db[_0x5db2('0x40')][_0x5db2('0x59')]({'where':{'id':_0x48e1e0['params']['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x2484ed,null))['then'](function(_0x437d09){if(_0x437d09){return _0x437d09[_0x5db2('0x6a')](_0x48e1e0[_0x5db2('0x45')][_0x5db2('0x6b')]);}})[_0x5db2('0x20')](respondWithStatusCode(_0x2484ed,null))[_0x5db2('0x29')](handleError(_0x2484ed,null));};exports[_0x5db2('0x6c')]=function(_0x305c6f,_0x582963,_0x52d75b){if(_0x305c6f['body']['id']){delete _0x305c6f[_0x5db2('0x5b')]['id'];}return db[_0x5db2('0x40')][_0x5db2('0x59')]({'where':{'id':_0x305c6f[_0x5db2('0x58')]['id']}})['then'](handleEntityNotFound(_0x582963,null))[_0x5db2('0x20')](function(_0x33f8e4){if(_0x33f8e4){_0x305c6f[_0x5db2('0x5b')]['FaxAccountId']=_0x33f8e4['id'];return db[_0x5db2('0x6d')]['create'](_0x305c6f['body']);}})[_0x5db2('0x20')](respondWithResult(_0x582963,null))[_0x5db2('0x29')](handleError(_0x582963,null));};exports['getAnswers']=function(_0x27f3c4,_0x133cf5,_0x345a5c){var _0x5335f0={'raw':![],'where':{}};var _0x354cde={};var _0x3c8c46={'count':0x0,'rows':[]};return db[_0x5db2('0x40')][_0x5db2('0x68')]({'where':{'id':_0x27f3c4[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x133cf5,null))[_0x5db2('0x20')](function(_0x1b165e){if(_0x1b165e){_0x354cde[_0x5db2('0x44')]=_['keys'](db['CannedAnswer'][_0x5db2('0x41')]);_0x354cde['query']=_[_0x5db2('0x46')](_0x27f3c4[_0x5db2('0x45')]);_0x354cde[_0x5db2('0x47')]=_[_0x5db2('0x48')](_0x354cde[_0x5db2('0x44')],_0x354cde[_0x5db2('0x45')]);_0x5335f0['attributes']=_[_0x5db2('0x48')](_0x354cde['model'],qs['fields'](_0x27f3c4[_0x5db2('0x45')]['fields']));_0x5335f0['attributes']=_0x5335f0[_0x5db2('0x49')]['length']?_0x5335f0[_0x5db2('0x49')]:_0x354cde[_0x5db2('0x44')];if(!_0x27f3c4[_0x5db2('0x45')][_0x5db2('0x4c')](_0x5db2('0x69'))){_0x5335f0[_0x5db2('0x2f')]=qs[_0x5db2('0x2f')](_0x27f3c4[_0x5db2('0x45')][_0x5db2('0x2f')]);_0x5335f0[_0x5db2('0x31')]=qs['offset'](_0x27f3c4[_0x5db2('0x45')]['offset']);}_0x5335f0['order']=qs[_0x5db2('0x4e')](_0x27f3c4['query'][_0x5db2('0x4e')]);_0x5335f0[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0x27f3c4[_0x5db2('0x45')],_0x354cde['filters']));_0x5335f0[_0x5db2('0x4f')][_0x5db2('0x65')]=_0x1b165e['id'];if(_0x27f3c4[_0x5db2('0x45')]['filter']){_0x5335f0[_0x5db2('0x4f')]=_['merge'](_0x5335f0[_0x5db2('0x4f')],{'$or':_['map'](_0x5335f0['attributes'],function(_0x2f56cf){var _0x554088={};_0x554088[_0x2f56cf]={'$like':'%'+_0x27f3c4[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x554088;})});}_0x5335f0=_[_0x5db2('0x52')]({},_0x5335f0,_0x27f3c4['options']);return db[_0x5db2('0x6d')][_0x5db2('0x30')]({'where':_0x5335f0[_0x5db2('0x4f')]})[_0x5db2('0x20')](function(_0xf933c3){_0x3c8c46[_0x5db2('0x30')]=_0xf933c3;if(_0x27f3c4[_0x5db2('0x45')][_0x5db2('0x53')]){_0x5335f0[_0x5db2('0x54')]=[{'all':!![]}];}return db[_0x5db2('0x6d')][_0x5db2('0x55')](_0x5335f0);})[_0x5db2('0x20')](function(_0x531925){_0x3c8c46[_0x5db2('0x56')]=_0x531925;return _0x3c8c46;});}})[_0x5db2('0x20')](respondWithFilteredResult(_0x133cf5,_0x5335f0))[_0x5db2('0x29')](handleError(_0x133cf5,null));};exports[_0x5db2('0x6e')]=function(_0x106aa4,_0x3b2d60,_0x5ebd33){return db['FaxAccount']['find']({'where':{'id':_0x106aa4[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x3b2d60,null))['then'](function(_0x2d8340){if(_0x2d8340){return _0x2d8340[_0x5db2('0x6e')](_0x106aa4[_0x5db2('0x45')]['ids']);}})[_0x5db2('0x20')](respondWithStatusCode(_0x3b2d60,null))[_0x5db2('0x29')](handleError(_0x3b2d60,null));};exports[_0x5db2('0x6f')]=function(_0xeab184,_0x8b6653,_0x4ef7e4){return db[_0x5db2('0x70')][_0x5db2('0x59')]({'where':{'id':_0xeab184[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x8b6653,null))['then'](function(_0x45c772){if(_0x45c772){return _0x45c772[_0x5db2('0x6f')](_0xeab184['body']['ids'],_[_0x5db2('0x71')](_0xeab184['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x8b6653,null))[_0x5db2('0x29')](handleError(_0x8b6653,null));};exports['getInteractions']=function(_0x14d253,_0x2d4373,_0xe83535){var _0x5a3a6f={'raw':![],'where':{}};var _0x12d25a={};var _0x424f7d={'count':0x0,'rows':[]};return db[_0x5db2('0x40')][_0x5db2('0x68')]({'where':{'id':_0x14d253[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x2d4373,null))['then'](function(_0x5b6041){if(_0x5b6041){_0x12d25a[_0x5db2('0x44')]=_[_0x5db2('0x46')](db[_0x5db2('0x70')]['rawAttributes']);_0x12d25a[_0x5db2('0x45')]=_[_0x5db2('0x46')](_0x14d253[_0x5db2('0x45')]);_0x12d25a[_0x5db2('0x47')]=_['intersection'](_0x12d25a[_0x5db2('0x44')],_0x12d25a[_0x5db2('0x45')]);_0x5a3a6f[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0x12d25a[_0x5db2('0x44')],qs[_0x5db2('0x4a')](_0x14d253[_0x5db2('0x45')]['fields']));_0x5a3a6f[_0x5db2('0x49')]=_0x5a3a6f[_0x5db2('0x49')]['length']?_0x5a3a6f['attributes']:_0x12d25a['model'];if(!_0x14d253[_0x5db2('0x45')][_0x5db2('0x4c')](_0x5db2('0x69'))){_0x5a3a6f[_0x5db2('0x2f')]=qs['limit'](_0x14d253[_0x5db2('0x45')][_0x5db2('0x2f')]);_0x5a3a6f['offset']=qs['offset'](_0x14d253[_0x5db2('0x45')][_0x5db2('0x31')]);}_0x5a3a6f[_0x5db2('0x4d')]=qs[_0x5db2('0x4e')](_0x14d253[_0x5db2('0x45')]['sort']);_0x5a3a6f[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0x14d253[_0x5db2('0x45')],_0x12d25a[_0x5db2('0x47')]));_0x5a3a6f[_0x5db2('0x4f')][_0x5db2('0x65')]=_0x5b6041['id'];if(_0x14d253[_0x5db2('0x45')]['filter']){_0x5a3a6f[_0x5db2('0x4f')]=_[_0x5db2('0x52')](_0x5a3a6f[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x5a3a6f[_0x5db2('0x49')],function(_0x527bac){var _0x1f8a40={};_0x1f8a40[_0x527bac]={'$like':'%'+_0x14d253[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x1f8a40;})});}_0x5a3a6f=_['merge']({},_0x5a3a6f,_0x14d253[_0x5db2('0x72')]);return db['FaxInteraction'][_0x5db2('0x30')]({'where':_0x5a3a6f[_0x5db2('0x4f')]})[_0x5db2('0x20')](function(_0x1e4367){_0x424f7d[_0x5db2('0x30')]=_0x1e4367;if(_0x14d253[_0x5db2('0x45')][_0x5db2('0x53')]){_0x5a3a6f[_0x5db2('0x54')]=[{'model':db['CmContact'],'as':_0x5db2('0x73'),'required':![]},{'model':db['User'],'as':_0x5db2('0x74'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x5db2('0x75')],'as':_0x5db2('0x76'),'attributes':['id',_0x5db2('0x3b'),'color'],'where':_0x14d253['query'][_0x5db2('0x77')]?{'id':_0x14d253[_0x5db2('0x45')]['tag']}:undefined,'required':_0x14d253[_0x5db2('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5a3a6f);})[_0x5db2('0x20')](function(_0x1d276e){_0x424f7d['rows']=_0x1d276e;return _0x424f7d;});}})['then'](respondWithFilteredResult(_0x2d4373,_0x5a3a6f))[_0x5db2('0x29')](handleError(_0x2d4373,null));};exports['addApplications']=function(_0x5c1a8b,_0x4cc338){var _0xde35cc=_0x5c1a8b[_0x5db2('0x58')]['id'];var _0x145c12=_0x5c1a8b[_0x5db2('0x5b')];var _0xf9e465=0xc8;var _0x4adf7a=null;return db[_0x5db2('0x78')][_0x5db2('0x79')]({'isolationLevel':db[_0x5db2('0x78')]['Transaction'][_0x5db2('0x7a')][_0x5db2('0x7b')]},function(_0x454d16){return db[_0x5db2('0x40')][_0x5db2('0x68')]({'where':{'id':_0xde35cc},'transaction':_0x454d16})[_0x5db2('0x20')](function(_0x4aa174){if(_0x4aa174){return db['FaxApplication'][_0x5db2('0x36')]({'where':{'FaxAccountId':_0xde35cc},'transaction':_0x454d16})[_0x5db2('0x20')](function(){var _0x11d181=_[_0x5db2('0x3f')](_0x145c12,function(_0x538f99){_0x538f99['FaxAccountId']=_0xde35cc;return _0x538f99;});return db[_0x5db2('0x7c')][_0x5db2('0x7d')](_0x11d181,{'transaction':_0x454d16});});}else{_0xf9e465=0x194;_0x4adf7a=[];}});})[_0x5db2('0x20')](function(){if(_0xf9e465!==0x194){return db[_0x5db2('0x7c')]['findAndCountAll']({'where':{'FaxAccountId':_0xde35cc},'order':'priority'})[_0x5db2('0x20')](function(_0x47a2c0){_0x4adf7a=_0x47a2c0;});}})['catch'](function(_0x1fb28b){_0xf9e465=0x1f4;logger[_0x5db2('0x26')](_0x1fb28b[_0x5db2('0x3a')]);if(_0x1fb28b[_0x5db2('0x3b')]){delete _0x1fb28b[_0x5db2('0x3b')];}_0x4adf7a=_0x1fb28b;})[_0x5db2('0x7e')](function(){if(_0x4adf7a===null){_0x4cc338[_0x5db2('0x2a')](_0xf9e465);}else{if(_0xf9e465===0x1f4){_0x4cc338['status'](_0xf9e465)[_0x5db2('0x3c')](_0x4adf7a);}else{_0x4cc338['status'](_0xf9e465)[_0x5db2('0x2d')](_0x4adf7a);}}});};exports[_0x5db2('0x7f')]=function(_0x5e3141,_0x4a6ba5,_0x4c9903){var _0x1f6f63={};var _0xa2d726={};var _0x590cc0;var _0x550085;return db[_0x5db2('0x40')][_0x5db2('0x68')]({'where':{'id':_0x5e3141[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x4a6ba5,null))['then'](function(_0x14a875){if(_0x14a875){_0x590cc0=_0x14a875;_0xa2d726[_0x5db2('0x44')]=_[_0x5db2('0x46')](db['FaxApplication'][_0x5db2('0x41')]);_0xa2d726[_0x5db2('0x45')]=_['keys'](_0x5e3141[_0x5db2('0x45')]);_0xa2d726[_0x5db2('0x47')]=_[_0x5db2('0x48')](_0xa2d726[_0x5db2('0x44')],_0xa2d726['query']);_0x1f6f63[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0xa2d726[_0x5db2('0x44')],qs['fields'](_0x5e3141['query'][_0x5db2('0x4a')]));_0x1f6f63[_0x5db2('0x49')]=_0x1f6f63[_0x5db2('0x49')][_0x5db2('0x4b')]?_0x1f6f63[_0x5db2('0x49')]:_0xa2d726[_0x5db2('0x44')];_0x1f6f63[_0x5db2('0x4d')]=qs[_0x5db2('0x4e')](_0x5e3141[_0x5db2('0x45')][_0x5db2('0x4e')]);_0x1f6f63[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0x5e3141[_0x5db2('0x45')],_0xa2d726['filters']));if(_0x5e3141[_0x5db2('0x45')][_0x5db2('0x51')]){_0x1f6f63[_0x5db2('0x4f')]=_[_0x5db2('0x52')](_0x1f6f63[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x1f6f63['attributes'],function(_0x497d2c){var _0x17bc2b={};_0x17bc2b[_0x497d2c]={'$like':'%'+_0x5e3141[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x17bc2b;})});}_0x1f6f63=_[_0x5db2('0x52')]({},_0x1f6f63,_0x5e3141[_0x5db2('0x72')]);return _0x590cc0[_0x5db2('0x7f')](_0x1f6f63);}})[_0x5db2('0x20')](function(_0x3fafeb){if(_0x3fafeb){_0x550085=_0x3fafeb['length'];if(!_0x5e3141[_0x5db2('0x45')][_0x5db2('0x4c')](_0x5db2('0x69'))){_0x1f6f63['limit']=qs[_0x5db2('0x2f')](_0x5e3141[_0x5db2('0x45')][_0x5db2('0x2f')]);_0x1f6f63[_0x5db2('0x31')]=qs[_0x5db2('0x31')](_0x5e3141['query'][_0x5db2('0x31')]);}return _0x590cc0[_0x5db2('0x7f')](_0x1f6f63);}})[_0x5db2('0x20')](function(_0x1f8766){if(_0x1f8766){return _0x1f8766?{'count':_0x550085,'rows':_0x1f8766}:null;}})[_0x5db2('0x20')](respondWithResult(_0x4a6ba5,null))[_0x5db2('0x29')](handleError(_0x4a6ba5,null));};function Extension(_0x3e3cb8,_0x8b3d63,_0x17a2cf,_0x301e2d){this[_0x5db2('0x80')]='from-voip-provider';this[_0x5db2('0x81')]=_0x3e3cb8[_0x5db2('0x82')];this[_0x5db2('0x83')]=_0x301e2d;this['type']='system';this['description']=_0x5db2('0x84');this[_0x5db2('0x65')]=_0x3e3cb8['id'];this['priority']=_0x8b3d63;this[_0x5db2('0x85')]=_0x17a2cf;}function createExtensionsReciveFax(_0x36e6a9){var _0x2f3349=0x1;var _0x13b81e=[];_0x13b81e['push'](new Extension(_0x36e6a9,_0x2f3349,'',_0x5db2('0x86')));_0x2f3349+=0x1;_0x13b81e[_0x5db2('0x87')](new Extension(_0x36e6a9,_0x2f3349,'CDR(type)=inbound-fax',_0x5db2('0x88')));_0x2f3349+=0x1;for(var _0x568462 in _0x36e6a9){if(_0x36e6a9['hasOwnProperty'](_0x568462)&&(_0x568462===_0x5db2('0x89')||_0x568462===_0x5db2('0x82')||_0x568462===_0x5db2('0x8a')||_0x568462===_0x5db2('0x8b')||_0x568462===_0x5db2('0x8c')||_0x568462===_0x5db2('0x8d')||_0x568462===_0x5db2('0x8e')||_0x568462===_0x5db2('0x8f')||_0x568462==='t38timeout')){_0x13b81e[_0x5db2('0x87')](new Extension(_0x36e6a9,_0x2f3349,_0x5db2('0x90')+_0x568462+')='+_0x36e6a9[_0x568462],_0x5db2('0x88')));_0x2f3349+=0x1;}}_0x13b81e['push'](new Extension(_0x36e6a9,_0x2f3349,'6',_0x5db2('0x91')));_0x2f3349+=0x1;_0x13b81e[_0x5db2('0x87')](new Extension(_0x36e6a9,_0x2f3349,'/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',_0x5db2('0x92')));_0x2f3349=0x0;return _0x13b81e;}exports['addAccountApplications']=function(_0x514a95,_0x198bcd,_0x53b6bd){var _0x19e2bf;return db[_0x5db2('0x78')][_0x5db2('0x79')](function(_0x139fc7){return db[_0x5db2('0x40')][_0x5db2('0x5a')](_0x514a95[_0x5db2('0x5b')],{'transaction':_0x139fc7})[_0x5db2('0x20')](function(_0x3699a7){_0x19e2bf=_0x3699a7[_0x5db2('0x37')]({'plain':!![]});return db[_0x5db2('0x93')]['bulkCreate'](createExtensionsReciveFax(_0x19e2bf),{'transaction':_0x139fc7});});})[_0x5db2('0x20')](function(){return _0x19e2bf;})['then'](respondWithResult(_0x198bcd,null))[_0x5db2('0x29')](handleError(_0x198bcd,null));};exports[_0x5db2('0x94')]=function(_0x57444d,_0x130d55,_0x13e279){var _0x12476c;return db[_0x5db2('0x78')][_0x5db2('0x79')](function(_0x3859de){return db['FaxAccount'][_0x5db2('0x35')](_0x57444d[_0x5db2('0x5b')],{'where':{'id':_0x57444d[_0x5db2('0x5b')]['id']},'transaction':_0x3859de})[_0x5db2('0x20')](function(_0x822be6){return db[_0x5db2('0x93')]['destroy']({'where':{'FaxAccountId':_0x57444d[_0x5db2('0x5b')]['id']},'transaction':_0x3859de})['then'](function(_0x400e76){return db[_0x5db2('0x93')]['bulkCreate'](createExtensionsReciveFax(_[_0x5db2('0x71')](_0x57444d[_0x5db2('0x5b')],[_0x5db2('0x95'),_0x5db2('0x96'),'createdAt',_0x5db2('0x97'),'TrunkId',_0x5db2('0x98')])),{'transaction':_0x3859de});});});})[_0x5db2('0x20')](function(){return db[_0x5db2('0x40')][_0x5db2('0x99')](_0x57444d[_0x5db2('0x5b')]['id']);})[_0x5db2('0x20')](respondWithResult(_0x130d55,null))[_0x5db2('0x29')](handleError(_0x130d55,null));};exports[_0x5db2('0x9a')]=function(_0x2de876,_0x1449fc,_0xb745c9){var _0x26fc73={'raw':!![],'where':{}};var _0x3eb4e9={};var _0x3526f2={'count':0x0,'rows':[]};return db[_0x5db2('0x40')]['findOne']({'where':{'id':_0x2de876[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x1449fc,null))[_0x5db2('0x20')](function(_0x2158b9){if(_0x2158b9){_0x3eb4e9[_0x5db2('0x44')]=_[_0x5db2('0x46')](db[_0x5db2('0x9b')][_0x5db2('0x41')]);_0x3eb4e9[_0x5db2('0x45')]=_['keys'](_0x2de876['query']);_0x3eb4e9[_0x5db2('0x47')]=_['intersection'](_0x3eb4e9[_0x5db2('0x44')],_0x3eb4e9[_0x5db2('0x45')]);_0x26fc73['attributes']=_[_0x5db2('0x48')](_0x3eb4e9[_0x5db2('0x44')],qs[_0x5db2('0x4a')](_0x2de876[_0x5db2('0x45')]['fields']));_0x26fc73[_0x5db2('0x49')]=_0x26fc73[_0x5db2('0x49')]['length']?_0x26fc73[_0x5db2('0x49')]:_0x3eb4e9['model'];if(!_0x2de876[_0x5db2('0x45')]['hasOwnProperty'](_0x5db2('0x69'))){_0x26fc73[_0x5db2('0x2f')]=qs[_0x5db2('0x2f')](_0x2de876[_0x5db2('0x45')][_0x5db2('0x2f')]);_0x26fc73[_0x5db2('0x31')]=qs[_0x5db2('0x31')](_0x2de876[_0x5db2('0x45')][_0x5db2('0x31')]);}_0x26fc73['order']=qs['sort'](_0x2de876[_0x5db2('0x45')][_0x5db2('0x4e')]);_0x26fc73[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0x2de876['query'],_0x3eb4e9[_0x5db2('0x47')]));_0x26fc73[_0x5db2('0x4f')]['FaxAccountId']=_0x2158b9['id'];if(_0x2de876[_0x5db2('0x45')]['filter']){_0x26fc73['where']=_['merge'](_0x26fc73[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x26fc73[_0x5db2('0x49')],function(_0x458c0e){var _0x131939={};_0x131939[_0x458c0e]={'$like':'%'+_0x2de876[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x131939;})});}if(_0x2de876[_0x5db2('0x45')][_0x5db2('0x9c')]){var _0x24372a=_0x2de876[_0x5db2('0x45')][_0x5db2('0x9c')][_0x5db2('0x9d')](',');var _0x32c478={};_0x32c478[_0x24372a[0x0]]={'$gte':moment(_0x24372a[0x1])['format'](_0x5db2('0x9e'))};_0x26fc73[_0x5db2('0x4f')]=_[_0x5db2('0x52')](_0x26fc73[_0x5db2('0x4f')],_0x32c478);}_0x26fc73=_[_0x5db2('0x52')]({},_0x26fc73,_0x2de876['options']);return db[_0x5db2('0x9b')][_0x5db2('0x30')]({'where':_0x26fc73['where']})[_0x5db2('0x20')](function(_0x2c1bd8){_0x3526f2[_0x5db2('0x30')]=_0x2c1bd8;if(_0x2de876[_0x5db2('0x45')][_0x5db2('0x53')]){_0x26fc73[_0x5db2('0x54')]=[{'all':!![]}];}return db[_0x5db2('0x9b')][_0x5db2('0x55')](_0x26fc73);})['then'](function(_0x34d507){_0x3526f2[_0x5db2('0x56')]=_0x34d507;return _0x3526f2;});}})[_0x5db2('0x20')](respondWithFilteredResult(_0x1449fc,_0x26fc73))[_0x5db2('0x29')](handleError(_0x1449fc,null));};exports[_0x5db2('0x3c')]=function(_0x1c2bcc,_0x5eacce,_0x23f58b){var _0x1e8ddb,_0x161d6b={},_0x5029af;if(_0x1c2bcc['body']['to']){_0x5029af=_0x1c2bcc['body']['to'][0x0];}return db['FaxAccount'][_0x5db2('0x59')]({'where':{'id':_0x1c2bcc[_0x5db2('0x58')]['id']},'include':[{'model':db[_0x5db2('0x9f')],'as':'List','include':[{'model':db[_0x5db2('0xa0')],'as':_0x5db2('0xa1'),'where':{'fax':_0x5029af},'limit':0x1,'order':[[_0x5db2('0x97'),_0x5db2('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x5eacce,null))['then'](function(_0x315e10){_0x1e8ddb=_0x315e10;if(_0x1c2bcc[_0x5db2('0x5b')]['attachments']&&_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][_0x5db2('0x4b')]){for(var _0x5d3312=0x0;_0x5d3312<_0x1c2bcc['body']['attachments'][_0x5db2('0x4b')];_0x5d3312+=0x1){_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][_0x5d3312]={'filename':_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][_0x5d3312][_0x5db2('0x3b')],'id':_0x1c2bcc[_0x5db2('0x5b')]['attachments'][_0x5d3312]['id'],'path':path['join'](config[_0x5db2('0xa4')],_0x5db2('0xa5'),_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][_0x5d3312]['basename'])};}}return respondWithRpcPromise(_0x5db2('0xa6'),'CheckAfterSend',{'FaxAccountId':_[_0x5db2('0xa7')](_0x1c2bcc['params']['id'])?undefined:_0x1c2bcc[_0x5db2('0x58')]['id'],'path':_[_0x5db2('0xa7')](_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0][_0x5db2('0x6')])?undefined:_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0][_0x5db2('0x6')],'fax':_[_0x5db2('0xa7')](_0x1c2bcc[_0x5db2('0x5b')]['to'][0x0])?undefined:_0x1c2bcc[_0x5db2('0x5b')]['to'][0x0]},client9002);})[_0x5db2('0x20')](function(){if(_0x1e8ddb){if(_[_0x5db2('0xa7')](_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa8')])){_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa8')]=util['format'](_0x5db2('0xa9'),_0x1e8ddb['name'],_0x1e8ddb[_0x5db2('0xaa')]);}if(_0x1e8ddb['List']){if(_0x1e8ddb['List'][_0x5db2('0xa1')][_0x5db2('0x4b')]){return _0x1e8ddb['List'][_0x5db2('0xa1')][0x0];}else{return db[_0x5db2('0xa0')][_0x5db2('0x5a')](_['defaults'](_0x1c2bcc[_0x5db2('0x5b')],{'firstName':_0x1c2bcc['body']['to'][0x0],'phone':_0x1c2bcc[_0x5db2('0x5b')]['to'][0x0],'fax':_0x1c2bcc[_0x5db2('0x5b')]['to'][0x0],'ListId':_0x1e8ddb[_0x5db2('0x98')]}));}}else{throw new Error(_0x5db2('0xab'));}}else{throw new Error(_0x5db2('0xac'));}})[_0x5db2('0x20')](function(_0xe86fbe){if(_0xe86fbe){return db['FaxInteraction'][_0x5db2('0x59')]({'where':{'ContactId':_0xe86fbe['id'],'closed':![],'FaxAccountId':_0x1e8ddb['id']}})[_0x5db2('0x20')](function(_0x5873d4){if(_0x5873d4){return[_0x5873d4,![]];}return db['FaxInteraction'][_0x5db2('0x5a')]({'UserId':_0x1c2bcc[_0x5db2('0x5c')]['id'],'ContactId':_0xe86fbe['id'],'FaxAccountId':_0x1e8ddb['id'],'fax':_0x1c2bcc['body']['to'][0x0],'firstMsgDirection':_0x5db2('0xad'),'Messages':[_[_0x5db2('0x52')](_0x1c2bcc[_0x5db2('0x5b')],{'read':![],'body':_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0]['filename'],'FaxAccountId':_0x1e8ddb['id'],'UserId':_0x1c2bcc['user']['id'],'ContactId':_0xe86fbe['id'],'AttachmentId':_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x281ca3){return[_0x281ca3,!![]];});});}else{throw new Error(_0x5db2('0xae'));}})['spread'](function(_0x3fd931,_0x4fa105){if(_0x4fa105){return _0x3fd931;}return db['FaxMessage'][_0x5db2('0x5a')]({'direction':'out','read':![],'body':_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0][_0x5db2('0xaf')],'FaxAccountId':_0x1e8ddb['id'],'FaxInteractionId':_0x3fd931['id'],'UserId':_0x1c2bcc['user']['id'],'ContactId':_0x3fd931[_0x5db2('0xb0')],'AttachmentId':_0x1c2bcc[_0x5db2('0x5b')][_0x5db2('0xa3')][0x0]['id']})['then'](function(_0x11bc88){_0x3fd931[_0x5db2('0xb1')][_0x5db2('0xb2')]=[];_0x3fd931[_0x5db2('0xb1')][_0x5db2('0xb2')][_0x5db2('0x87')](_0x11bc88[_0x5db2('0xb1')]);return _0x3fd931;});})['then'](function(_0x5c6cce){respondWithRpcPromise('SendFax',_0x5db2('0xb3'),{'FaxAccountId':_['isNil'](_0x1c2bcc[_0x5db2('0x58')]['id'])?undefined:_0x1c2bcc['params']['id'],'path':_[_0x5db2('0xa7')](_0x1c2bcc[_0x5db2('0x5b')]['attachments'][0x0][_0x5db2('0x6')])?undefined:_0x1c2bcc['body']['attachments'][0x0]['path'],'fax':_[_0x5db2('0xa7')](_0x1c2bcc['body']['to'][0x0])?undefined:_0x1c2bcc['body']['to'][0x0],'AttachmentId':_0x1c2bcc['body'][_0x5db2('0xa3')][0x0]['id']},client9002)[_0x5db2('0x20')](function(_0x34ba61){logger[_0x5db2('0x21')](_0x5db2('0xb4'),_0x34ba61);})[_0x5db2('0x29')](function(_0x2c2537){logger[_0x5db2('0x21')](_0x5db2('0xb4'),_0x2c2537);});return _0x5c6cce;})['then'](respondWithResult(_0x5eacce,null))[_0x5db2('0x29')](handleError(_0x5eacce,null));};exports[_0x5db2('0xb5')]=function(_0x490ec2,_0x5d76d5,_0x3c37c5){return db[_0x5db2('0x40')][_0x5db2('0x59')]({'where':{'id':_0x490ec2[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x5d76d5,null))['then'](function(_0x59366a){if(_0x59366a){return _0x59366a['addAgents'](_0x490ec2[_0x5db2('0x5b')]['ids'],_[_0x5db2('0x71')](_0x490ec2['body'],[_0x5db2('0x6b'),'id'])||{})[_0x5db2('0xb6')](function(_0x18131a){for(var _0x2b122c=0x0;_0x2b122c<_0x490ec2[_0x5db2('0x5b')]['ids'][_0x5db2('0x4b')];_0x2b122c+=0x1){socket['emit'](_0x5db2('0xb7'),{'UserId':Number(_0x490ec2[_0x5db2('0x5b')]['ids'][_0x2b122c]),'FaxAccountId':Number(_0x490ec2[_0x5db2('0x58')]['id'])});}return _0x18131a;});}})[_0x5db2('0x20')](respondWithResult(_0x5d76d5,null))[_0x5db2('0x29')](handleError(_0x5d76d5,null));};exports[_0x5db2('0xb8')]=function(_0x2e1050,_0x54f6d1,_0x23d7b9){return db[_0x5db2('0x40')]['find']({'where':{'id':_0x2e1050[_0x5db2('0x58')]['id']}})[_0x5db2('0x20')](handleEntityNotFound(_0x54f6d1,null))['then'](function(_0x34a8f0){if(_0x34a8f0){return _0x34a8f0[_0x5db2('0xb8')](_0x2e1050['query'][_0x5db2('0x6b')])['then'](function(){if(_[_0x5db2('0xb9')](_0x2e1050['query']['ids'])){for(var _0x42d070=0x0;_0x42d070<_0x2e1050[_0x5db2('0x45')][_0x5db2('0x6b')]['length'];_0x42d070+=0x1){socket[_0x5db2('0xba')](_0x5db2('0xbb'),{'UserId':Number(_0x2e1050[_0x5db2('0x45')][_0x5db2('0x6b')][_0x42d070]),'FaxAccountId':Number(_0x2e1050[_0x5db2('0x58')]['id'])});}}else{socket[_0x5db2('0xba')](_0x5db2('0xbb'),{'UserId':Number(_0x2e1050[_0x5db2('0x45')][_0x5db2('0x6b')]),'FaxAccountId':Number(_0x2e1050[_0x5db2('0x58')]['id'])});}});}})[_0x5db2('0x20')](respondWithStatusCode(_0x54f6d1,null))[_0x5db2('0x29')](handleError(_0x54f6d1,null));};exports[_0x5db2('0xbc')]=function(_0x580712,_0x339fad,_0x22fd87){var _0x35a8ca={};var _0x3d46b4={};var _0x2b807b;var _0x27c0f6;return db[_0x5db2('0x40')]['findOne']({'where':{'id':_0x580712[_0x5db2('0x58')]['id']}})['then'](handleEntityNotFound(_0x339fad,null))[_0x5db2('0x20')](function(_0x1653de){if(_0x1653de){_0x2b807b=_0x1653de;_0x3d46b4[_0x5db2('0x44')]=_[_0x5db2('0x46')](db[_0x5db2('0xbd')][_0x5db2('0x41')]);_0x3d46b4[_0x5db2('0x45')]=_['keys'](_0x580712[_0x5db2('0x45')]);_0x3d46b4[_0x5db2('0x47')]=_[_0x5db2('0x48')](_0x3d46b4[_0x5db2('0x44')],_0x3d46b4[_0x5db2('0x45')]);_0x35a8ca[_0x5db2('0x49')]=_[_0x5db2('0x48')](_0x3d46b4[_0x5db2('0x44')],qs[_0x5db2('0x4a')](_0x580712[_0x5db2('0x45')]['fields']));_0x35a8ca[_0x5db2('0x49')]=_0x35a8ca[_0x5db2('0x49')][_0x5db2('0x4b')]?_0x35a8ca[_0x5db2('0x49')]:_0x3d46b4['model'];_0x35a8ca[_0x5db2('0x4d')]=qs['sort'](_0x580712[_0x5db2('0x45')]['sort']);_0x35a8ca[_0x5db2('0x4f')]=qs[_0x5db2('0x47')](_[_0x5db2('0x50')](_0x580712[_0x5db2('0x45')],_0x3d46b4[_0x5db2('0x47')]));if(_0x580712[_0x5db2('0x45')]['filter']){_0x35a8ca['where']=_[_0x5db2('0x52')](_0x35a8ca[_0x5db2('0x4f')],{'$or':_[_0x5db2('0x3f')](_0x35a8ca['attributes'],function(_0x3facd6){var _0x27c143={};_0x27c143[_0x3facd6]={'$like':'%'+_0x580712[_0x5db2('0x45')][_0x5db2('0x51')]+'%'};return _0x27c143;})});}_0x35a8ca=_[_0x5db2('0x52')]({},_0x35a8ca,_0x580712['options']);return _0x2b807b[_0x5db2('0xbc')](_0x35a8ca);}})[_0x5db2('0x20')](function(_0x56c0dd){if(_0x56c0dd){_0x27c0f6=_0x56c0dd[_0x5db2('0x4b')];if(!_0x580712['query'][_0x5db2('0x4c')](_0x5db2('0x69'))){_0x35a8ca[_0x5db2('0x2f')]=qs['limit'](_0x580712[_0x5db2('0x45')][_0x5db2('0x2f')]);_0x35a8ca[_0x5db2('0x31')]=qs[_0x5db2('0x31')](_0x580712['query'][_0x5db2('0x31')]);}return _0x2b807b[_0x5db2('0xbc')](_0x35a8ca);}})[_0x5db2('0x20')](function(_0x32d46e){if(_0x32d46e){return _0x32d46e?{'count':_0x27c0f6,'rows':_0x32d46e}:null;}})[_0x5db2('0x20')](respondWithResult(_0x339fad,null))[_0x5db2('0x29')](handleError(_0x339fad,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 74280f3..3299f16 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 _0xb829=['hook','events','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x51e1ef,_0x59fff6){var _0x3e7c65=function(_0x562d0f){while(--_0x562d0f){_0x51e1ef['push'](_0x51e1ef['shift']());}};_0x3e7c65(++_0x59fff6);}(_0xb829,0xf7));var _0x9b82=function(_0x46f064,_0x142861){_0x46f064=_0x46f064-0x0;var _0x19ab0a=_0xb829[_0x46f064];return _0x19ab0a;};'use strict';var EventEmitter=require(_0x9b82('0x0'));var FaxAccount=require(_0x9b82('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x43a5db){return function(_0x20d9aa,_0x5062ea,_0x53bb90){FaxAccountEvents['emit'](_0x43a5db+':'+_0x20d9aa['id'],_0x20d9aa);FaxAccountEvents[_0x9b82('0x3')](_0x43a5db,_0x20d9aa);_0x53bb90(null);};}for(var e in events){if(events[_0x9b82('0x4')](e)){var event=events[e];FaxAccount[_0x9b82('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x06fb=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06fb,0x1ad));var _0xb06f=function(_0x23345f,_0xc1cd34){_0x23345f=_0x23345f-0x0;var _0x1865e0=_0x06fb[_0x23345f];return _0x1865e0;};'use strict';var EventEmitter=require(_0xb06f('0x0'));var FaxAccount=require(_0xb06f('0x1'))['db'][_0xb06f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb06f('0x3')](0x0);var events={'afterCreate':_0xb06f('0x4'),'afterUpdate':_0xb06f('0x5'),'afterDestroy':_0xb06f('0x6')};function emitEvent(_0x345c4f){return function(_0x3ce0e0,_0x317761,_0x4d15ed){FaxAccountEvents[_0xb06f('0x7')](_0x345c4f+':'+_0x3ce0e0['id'],_0x3ce0e0);FaxAccountEvents[_0xb06f('0x7')](_0x345c4f,_0x3ce0e0);_0x4d15ed(null);};}for(var e in events){if(events[_0xb06f('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xb06f('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5634ddd..f70a777 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 _0x44f8=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2335cc,_0x30ad2f){var _0x2abbca=function(_0x152d80){while(--_0x152d80){_0x2335cc['push'](_0x2335cc['shift']());}};_0x2abbca(++_0x30ad2f);}(_0x44f8,0x137));var _0x844f=function(_0x544637,_0x5bfec3){_0x544637=_0x544637-0x0;var _0xf0bbf=_0x44f8[_0x544637];return _0xf0bbf;};'use strict';var _=require(_0x844f('0x0'));var util=require('util');var logger=require(_0x844f('0x1'))(_0x844f('0x2'));var moment=require(_0x844f('0x3'));var BPromise=require(_0x844f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x844f('0x5'));var rimraf=require(_0x844f('0x6'));var config=require(_0x844f('0x7'));var attributes=require('./faxAccount.attributes');module[_0x844f('0x8')]=function(_0x1e2d44,_0x22a298){return _0x1e2d44[_0x844f('0x9')](_0x844f('0xa'),attributes,{'tableName':_0x844f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5045=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x32031a,_0x1eddee){var _0x2702ce=function(_0x44f6ce){while(--_0x44f6ce){_0x32031a['push'](_0x32031a['shift']());}};_0x2702ce(++_0x1eddee);}(_0x5045,0x1b5));var _0x5504=function(_0x54d2bb,_0x323685){_0x54d2bb=_0x54d2bb-0x0;var _0x5c1b27=_0x5045[_0x54d2bb];return _0x5c1b27;};'use strict';var _=require(_0x5504('0x0'));var util=require(_0x5504('0x1'));var logger=require(_0x5504('0x2'))(_0x5504('0x3'));var moment=require('moment');var BPromise=require(_0x5504('0x4'));var rp=require(_0x5504('0x5'));var fs=require('fs');var path=require(_0x5504('0x6'));var rimraf=require(_0x5504('0x7'));var config=require(_0x5504('0x8'));var attributes=require(_0x5504('0x9'));module[_0x5504('0xa')]=function(_0x23953a,_0x3e0c23){return _0x23953a['define'](_0x5504('0xb'),attributes,{'tableName':_0x5504('0xc'),'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 02afff9..694cf55 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 _0xbe99=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','FaxApplication','Applications','List','applications','list','asc','length','fax','FaxInteraction','create','spread','get','push','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','queueId','find','queue','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','updatedAt','keys','createdAt','CompanyId','ListId','from','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xbe99,0x1e1));var _0x9be9=function(_0x3eaf5e,_0x3c9120){_0x3eaf5e=_0x3eaf5e-0x0;var _0x2e7aad=_0xbe99[_0x3eaf5e];return _0x2e7aad;};'use strict';var _=require(_0x9be9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9be9('0x1'));var rs=require(_0x9be9('0x2'));var fs=require('fs');var Redis=require(_0x9be9('0x3'));var db=require(_0x9be9('0x4'))['db'];var utils=require(_0x9be9('0x5'));var logger=require('../../config/logger')(_0x9be9('0x6'));var config=require(_0x9be9('0x7'));var jayson=require(_0x9be9('0x8'));var client=jayson[_0x9be9('0x9')][_0x9be9('0xa')]({'port':0x232c});config[_0x9be9('0xb')]=_[_0x9be9('0xc')](config[_0x9be9('0xb')],{'host':_0x9be9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9be9('0xb')]));require(_0x9be9('0xe'))[_0x9be9('0xf')](socket);function respondWithRpcPromise(_0x2930ed,_0x36276d,_0x20bbdd){return new BPromise(function(_0x1d0d16,_0x3dcdb1){return client[_0x9be9('0x10')](_0x2930ed,_0x20bbdd)[_0x9be9('0x11')](function(_0x15b388){logger['info']('FaxAccount,\x20%s,\x20%s',_0x36276d,_0x9be9('0x12'));logger[_0x9be9('0x13')](_0x9be9('0x14'),_0x36276d,_0x9be9('0x12'),JSON[_0x9be9('0x15')](_0x15b388));if(_0x15b388[_0x9be9('0x16')]){if(_0x15b388[_0x9be9('0x16')]['code']===0x1f4){logger['error'](_0x9be9('0x17'),_0x36276d,_0x15b388[_0x9be9('0x16')]['message']);return _0x3dcdb1(_0x15b388[_0x9be9('0x16')][_0x9be9('0x18')]);}logger['error'](_0x9be9('0x17'),_0x36276d,_0x15b388['error'][_0x9be9('0x18')]);return _0x1d0d16(_0x15b388[_0x9be9('0x16')]['message']);}else{logger[_0x9be9('0x19')](_0x9be9('0x17'),_0x36276d,'request\x20sent');_0x1d0d16(_0x15b388['result'][_0x9be9('0x18')]);}})[_0x9be9('0x1a')](function(_0x40d80a){logger[_0x9be9('0x16')](_0x9be9('0x17'),_0x36276d,_0x40d80a);_0x3dcdb1(_0x40d80a);});});}exports[_0x9be9('0x1b')]=function(_0x4b6225){var _0x414eb5=this;return new Promise(function(_0x4a4f40,_0x39cbfc){return db[_0x9be9('0x1c')][_0x9be9('0x1d')]({'raw':_0x4b6225[_0x9be9('0x1e')]?_0x4b6225['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b6225[_0x9be9('0x1e')]?_0x4b6225[_0x9be9('0x1e')]['where']||null:null,'attributes':_0x4b6225[_0x9be9('0x1e')]?_0x4b6225[_0x9be9('0x1e')][_0x9be9('0x1f')]||null:null,'limit':_0x4b6225[_0x9be9('0x1e')]?_0x4b6225['options'][_0x9be9('0x20')]||null:null,'include':_0x4b6225[_0x9be9('0x1e')]?_0x4b6225[_0x9be9('0x1e')][_0x9be9('0x21')]?_[_0x9be9('0x22')](_0x4b6225[_0x9be9('0x1e')][_0x9be9('0x21')],function(_0x54ad2){return{'model':db[_0x54ad2[_0x9be9('0x23')]],'as':_0x54ad2['as'],'attributes':_0x54ad2[_0x9be9('0x1f')],'include':_0x54ad2[_0x9be9('0x21')]?_[_0x9be9('0x22')](_0x54ad2[_0x9be9('0x21')],function(_0x2cb9cd){return{'model':db[_0x2cb9cd[_0x9be9('0x23')]],'as':_0x2cb9cd['as'],'attributes':_0x2cb9cd['attributes'],'include':_0x2cb9cd['include']?_[_0x9be9('0x22')](_0x2cb9cd[_0x9be9('0x21')],function(_0x27f670){return{'model':db[_0x27f670[_0x9be9('0x23')]],'as':_0x27f670['as'],'attributes':_0x27f670[_0x9be9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43e9b4){logger['info'](_0x9be9('0x1b'),_0x4b6225);logger[_0x9be9('0x13')](_0x9be9('0x1b'),_0x4b6225,JSON[_0x9be9('0x15')](_0x43e9b4));_0x4a4f40(_0x43e9b4);})['catch'](function(_0x196f85){logger[_0x9be9('0x16')](_0x9be9('0x1b'),_0x196f85[_0x9be9('0x18')],_0x4b6225);_0x39cbfc(_0x414eb5[_0x9be9('0x16')](0x1f4,_0x196f85['message']));});});};exports[_0x9be9('0x24')]=function(_0x40ee4e,_0x3112bb,_0x2a9044){var _0x565ffb=this;return new Promise(function(_0x7f6f15,_0x6e0f76){var _0x2494c2={'body':_0x40ee4e[_0x9be9('0x25')],'channel':'fax'};var _0x42064d=[];var _0x356f29=[];var _0x3441bd={};return db[_0x9be9('0x26')][_0x9be9('0x27')]()[_0x9be9('0x11')](function(_0x55b87c){if(!_0x55b87c){throw new db[(_0x9be9('0x28'))]['ValidationError'](_0x9be9('0x29'));}_0x42064d=_[_0x9be9('0x2a')](_['keys'](_0x55b87c),['createdAt',_0x9be9('0x2b')]);_0x356f29=_['difference'](_[_0x9be9('0x2c')](_0x55b87c),[_0x9be9('0x2d'),_0x9be9('0x2b'),_0x9be9('0x2e'),_0x9be9('0x2f')]);if(_0x40ee4e['body']['id']){delete _0x40ee4e[_0x9be9('0x25')]['id'];}if(_['isNil'](_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x30')])){throw new db[(_0x9be9('0x28'))][(_0x9be9('0x31'))]('from\x20is\x20mandatory');}if(_[_0x9be9('0x32')](_0x40ee4e['body'][_0x9be9('0x25')])||_0x40ee4e[_0x9be9('0x25')]['body']===''){throw new db[(_0x9be9('0x28'))][(_0x9be9('0x31'))](_0x9be9('0x33'));}if(_[_0x9be9('0x32')](_0x40ee4e['body'][_0x9be9('0x34')])){throw new db[(_0x9be9('0x28'))][(_0x9be9('0x31'))](_0x9be9('0x35')+_0x356f29);}if(!_[_0x9be9('0x36')](_0x356f29,_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x34')])){throw new db[(_0x9be9('0x28'))]['ValidationError'](_0x9be9('0x37')+_0x356f29);}_0x3441bd[_0x40ee4e[_0x9be9('0x25')]['mapKey']]=_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x30')];})[_0x9be9('0x11')](function(){return db[_0x9be9('0x1c')]['find']({'where':{'id':_0x40ee4e[_0x9be9('0x38')]['id']},'include':[{'model':db[_0x9be9('0x39')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9be9('0x3a'),'where':_0x3441bd,'limit':0x1,'order':[[_0x9be9('0x2b'),_0x9be9('0x3b')]]}]},{'model':db[_0x9be9('0x3c')],'as':_0x9be9('0x3d')}]});})[_0x9be9('0x11')](function(_0x81e2cd){if(_0x81e2cd&&_0x81e2cd[_0x9be9('0x3e')]){var _0x35c178=_0x81e2cd['get']({'plain':!![]});_0x2494c2[_0x9be9('0x38')]=_0x35c178;_0x2494c2[_0x9be9('0x3f')]=_0x35c178[_0x9be9('0x3d')];_0x2494c2[_0x9be9('0x40')]=_0x35c178[_0x9be9('0x3e')];_0x2494c2[_0x9be9('0x3f')]=_['orderBy'](_0x2494c2['applications'],['priority'],[_0x9be9('0x41')]);if(_0x2494c2[_0x9be9('0x38')][_0x9be9('0x3d')]){delete _0x2494c2[_0x9be9('0x38')]['Applications'];}if(_0x2494c2['account'][_0x9be9('0x3e')]&&_0x2494c2['account'][_0x9be9('0x3e')][_0x9be9('0x3a')][_0x9be9('0x42')]){return _0x2494c2['account'][_0x9be9('0x3e')]['Contacts'][0x0];}var _0x34dada=_[_0x9be9('0xc')](_0x40ee4e[_0x9be9('0x25')],{'firstName':_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x30')],'ListId':_0x35c178[_0x9be9('0x2f')]});_0x34dada[_0x40ee4e[_0x9be9('0x25')]['mapKey']]=_0x40ee4e[_0x9be9('0x25')]['from'];return db[_0x9be9('0x26')]['create'](_0x34dada,{'fields':_0x42064d,'raw':!![]});}})[_0x9be9('0x11')](function(_0x409d73){_0x2494c2['contact']=_0x409d73;if(_0x409d73){var _0x3255ca={'ContactId':_0x409d73['id'],'FaxAccountId':_0x40ee4e[_0x9be9('0x38')]['id'],'fax':_0x409d73[_0x9be9('0x43')]};return db[_0x9be9('0x44')]['find']({'where':{'ContactId':_0x409d73['id'],'closed':![],'FaxAccountId':_0x40ee4e[_0x9be9('0x38')]['id']}})['then'](function(_0x1fd902){if(_0x1fd902){return[_0x1fd902,![]];}return db[_0x9be9('0x44')][_0x9be9('0x45')](_0x3255ca)[_0x9be9('0x11')](function(_0x146b33){return[_0x146b33,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9be9('0x46')](function(_0x5102c3,_0x117eab){var _0x7ee206=_0x5102c3[_0x9be9('0x47')]({'plain':!![]});if(_0x117eab){if(_0x2494c2[_0x9be9('0x38')]['autoclose']){_0x2494c2[_0x9be9('0x3f')][_0x9be9('0x48')]({'id':0x0,'priority':_0x2494c2['applications'][_0x9be9('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9be9('0x49')});}_0x7ee206[_0x9be9('0x4a')]=!![];}else{_0x7ee206[_0x9be9('0x4a')]=![];}_0x2494c2[_0x9be9('0x4b')]=_0x7ee206;return db[_0x9be9('0x4c')][_0x9be9('0x45')]({'body':_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x25')],'FaxAccountId':_0x40ee4e[_0x9be9('0x38')]['id'],'FaxInteractionId':_0x5102c3['id'],'direction':'in','ContactId':_0x5102c3[_0x9be9('0x4d')],'AttachmentId':_0x40ee4e[_0x9be9('0x25')][_0x9be9('0x4e')]});})[_0x9be9('0x11')](function(_0x389967){_0x2494c2['message']=_0x389967;if(!_0x2494c2['interaction']['UserId'])return;return db[_0x9be9('0x4f')]['find']({'attributes':['id',_0x9be9('0x50')],'where':{'id':_0x2494c2['interaction'][_0x9be9('0x51')]}});})[_0x9be9('0x11')](function(_0x52415e){if(_0x52415e){_0x2494c2[_0x9be9('0x3f')][_0x9be9('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x52415e[_0x9be9('0x50')]+','+(_0x2494c2[_0x9be9('0x38')][_0x9be9('0x53')]||0xa),'interval':_0x9be9('0x49')});}if(!_0x2494c2[_0x9be9('0x4b')][_0x9be9('0x54')])return;return db['FaxQueue'][_0x9be9('0x55')]({'attributes':['id',_0x9be9('0x50')],'where':{'id':_0x2494c2['interaction'][_0x9be9('0x54')]}});})[_0x9be9('0x11')](function(_0x3d21b5){if(_0x3d21b5){_0x2494c2['applications'][_0x9be9('0x52')]({'id':0x0,'priority':0x1,'app':_0x9be9('0x56'),'appdata':_0x3d21b5[_0x9be9('0x50')]+','+(_0x2494c2[_0x9be9('0x38')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9be9('0x49')});}return respondWithRpcPromise(_0x9be9('0x57'),_0x9be9('0x58'),_0x2494c2);})['then'](function(_0x50921f){_0x7f6f15(_0x50921f);})[_0x9be9('0x1a')](function(_0x351fe6){_0x6e0f76(_0x565ffb[_0x9be9('0x16')](0x1f4,_0x351fe6[_0x9be9('0x18')]));});});}; \ No newline at end of file +var _0xbe67=['ListId','FaxInteraction','create','Contact\x20not\x20found','spread','push','length','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','priority'];(function(_0x1cb264,_0xe6726b){var _0x1ba5b4=function(_0x5a4e52){while(--_0x5a4e52){_0x1cb264['push'](_0x1cb264['shift']());}};_0x1ba5b4(++_0xe6726b);}(_0xbe67,0x127));var _0x7be6=function(_0xee3405,_0x322026){_0xee3405=_0xee3405-0x0;var _0x5466f5=_0xbe67[_0xee3405];return _0x5466f5;};'use strict';var _=require(_0x7be6('0x0'));var util=require(_0x7be6('0x1'));var moment=require(_0x7be6('0x2'));var BPromise=require(_0x7be6('0x3'));var rs=require(_0x7be6('0x4'));var fs=require('fs');var Redis=require(_0x7be6('0x5'));var db=require(_0x7be6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7be6('0x7'));var config=require('../../config/environment');var jayson=require(_0x7be6('0x8'));var client=jayson['client'][_0x7be6('0x9')]({'port':0x232c});config[_0x7be6('0xa')]=_[_0x7be6('0xb')](config[_0x7be6('0xa')],{'host':_0x7be6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7be6('0xd'))['register'](socket);function respondWithRpcPromise(_0x42c9ae,_0x1bcff4,_0x11b69f){return new BPromise(function(_0x2a1916,_0x38cc07){return client[_0x7be6('0xe')](_0x42c9ae,_0x11b69f)[_0x7be6('0xf')](function(_0x362697){logger[_0x7be6('0x10')](_0x7be6('0x11'),_0x1bcff4,_0x7be6('0x12'));logger[_0x7be6('0x13')](_0x7be6('0x14'),_0x1bcff4,_0x7be6('0x12'),JSON[_0x7be6('0x15')](_0x362697));if(_0x362697[_0x7be6('0x16')]){if(_0x362697[_0x7be6('0x16')][_0x7be6('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1bcff4,_0x362697[_0x7be6('0x16')][_0x7be6('0x18')]);return _0x38cc07(_0x362697['error']['message']);}logger['error'](_0x7be6('0x11'),_0x1bcff4,_0x362697['error'][_0x7be6('0x18')]);return _0x2a1916(_0x362697['error'][_0x7be6('0x18')]);}else{logger[_0x7be6('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1bcff4,'request\x20sent');_0x2a1916(_0x362697['result'][_0x7be6('0x18')]);}})[_0x7be6('0x19')](function(_0x14141f){logger[_0x7be6('0x16')](_0x7be6('0x11'),_0x1bcff4,_0x14141f);_0x38cc07(_0x14141f);});});}exports['GetFaxAccount']=function(_0x9eb7d4){var _0x1deac4=this;return new Promise(function(_0x4e879e,_0x51e48d){return db[_0x7be6('0x1a')][_0x7be6('0x1b')]({'raw':_0x9eb7d4[_0x7be6('0x1c')]?_0x9eb7d4[_0x7be6('0x1c')][_0x7be6('0x1d')]===undefined?!![]:![]:!![],'where':_0x9eb7d4[_0x7be6('0x1c')]?_0x9eb7d4[_0x7be6('0x1c')][_0x7be6('0x1e')]||null:null,'attributes':_0x9eb7d4['options']?_0x9eb7d4[_0x7be6('0x1c')][_0x7be6('0x1f')]||null:null,'limit':_0x9eb7d4['options']?_0x9eb7d4['options']['limit']||null:null,'include':_0x9eb7d4[_0x7be6('0x1c')]?_0x9eb7d4[_0x7be6('0x1c')][_0x7be6('0x20')]?_[_0x7be6('0x21')](_0x9eb7d4[_0x7be6('0x1c')][_0x7be6('0x20')],function(_0x2bbb91){return{'model':db[_0x2bbb91[_0x7be6('0x22')]],'as':_0x2bbb91['as'],'attributes':_0x2bbb91[_0x7be6('0x1f')],'include':_0x2bbb91['include']?_[_0x7be6('0x21')](_0x2bbb91[_0x7be6('0x20')],function(_0x4c29d6){return{'model':db[_0x4c29d6[_0x7be6('0x22')]],'as':_0x4c29d6['as'],'attributes':_0x4c29d6[_0x7be6('0x1f')],'include':_0x4c29d6[_0x7be6('0x20')]?_[_0x7be6('0x21')](_0x4c29d6[_0x7be6('0x20')],function(_0x2647b1){return{'model':db[_0x2647b1['model']],'as':_0x2647b1['as'],'attributes':_0x2647b1[_0x7be6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7be6('0xf')](function(_0x49b299){logger['info'](_0x7be6('0x23'),_0x9eb7d4);logger['debug'](_0x7be6('0x23'),_0x9eb7d4,JSON['stringify'](_0x49b299));_0x4e879e(_0x49b299);})['catch'](function(_0x5f42c8){logger[_0x7be6('0x16')](_0x7be6('0x23'),_0x5f42c8[_0x7be6('0x18')],_0x9eb7d4);_0x51e48d(_0x1deac4[_0x7be6('0x16')](0x1f4,_0x5f42c8[_0x7be6('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x1381d6,_0x1a73cc,_0xd31254){var _0x25dcac=this;return new Promise(function(_0x168bfc,_0x482821){var _0x193e41={'body':_0x1381d6[_0x7be6('0x24')],'channel':_0x7be6('0x25')};var _0x48dfa6=[];var _0x47a15a=[];var _0x1c5cf9={};return db[_0x7be6('0x26')][_0x7be6('0x27')]()[_0x7be6('0xf')](function(_0x1d8910){if(!_0x1d8910){throw new db['Sequelize'][(_0x7be6('0x28'))](_0x7be6('0x29'));}_0x48dfa6=_[_0x7be6('0x2a')](_[_0x7be6('0x2b')](_0x1d8910),[_0x7be6('0x2c'),_0x7be6('0x2d')]);_0x47a15a=_[_0x7be6('0x2a')](_[_0x7be6('0x2b')](_0x1d8910),['createdAt',_0x7be6('0x2d'),'CompanyId','ListId']);if(_0x1381d6[_0x7be6('0x24')]['id']){delete _0x1381d6[_0x7be6('0x24')]['id'];}if(_[_0x7be6('0x2e')](_0x1381d6[_0x7be6('0x24')][_0x7be6('0x2f')])){throw new db['Sequelize'][(_0x7be6('0x28'))](_0x7be6('0x30'));}if(_[_0x7be6('0x2e')](_0x1381d6['body'][_0x7be6('0x24')])||_0x1381d6[_0x7be6('0x24')][_0x7be6('0x24')]===''){throw new db[(_0x7be6('0x31'))][(_0x7be6('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7be6('0x2e')](_0x1381d6[_0x7be6('0x24')][_0x7be6('0x32')])){throw new db[(_0x7be6('0x31'))]['ValidationError'](_0x7be6('0x33')+_0x47a15a);}if(!_[_0x7be6('0x34')](_0x47a15a,_0x1381d6[_0x7be6('0x24')]['mapKey'])){throw new db[(_0x7be6('0x31'))][(_0x7be6('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47a15a);}_0x1c5cf9[_0x1381d6['body']['mapKey']]=_0x1381d6['body']['from'];})[_0x7be6('0xf')](function(){return db[_0x7be6('0x1a')][_0x7be6('0x35')]({'where':{'id':_0x1381d6[_0x7be6('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0x7be6('0x37'),'include':[{'model':db[_0x7be6('0x26')],'as':_0x7be6('0x38'),'where':_0x1c5cf9,'limit':0x1,'order':[['updatedAt',_0x7be6('0x39')]]}]},{'model':db[_0x7be6('0x3a')],'as':_0x7be6('0x3b')}]});})[_0x7be6('0xf')](function(_0x1eb6d2){if(_0x1eb6d2&&_0x1eb6d2[_0x7be6('0x37')]){var _0x352417=_0x1eb6d2[_0x7be6('0x3c')]({'plain':!![]});_0x193e41[_0x7be6('0x36')]=_0x352417;_0x193e41['applications']=_0x352417[_0x7be6('0x3b')];_0x193e41[_0x7be6('0x3d')]=_0x352417[_0x7be6('0x37')];_0x193e41[_0x7be6('0x3e')]=_[_0x7be6('0x3f')](_0x193e41[_0x7be6('0x3e')],[_0x7be6('0x40')],['asc']);if(_0x193e41['account'][_0x7be6('0x3b')]){delete _0x193e41[_0x7be6('0x36')][_0x7be6('0x3b')];}if(_0x193e41[_0x7be6('0x36')][_0x7be6('0x37')]&&_0x193e41['account'][_0x7be6('0x37')][_0x7be6('0x38')]['length']){return _0x193e41[_0x7be6('0x36')][_0x7be6('0x37')]['Contacts'][0x0];}var _0x57caa6=_[_0x7be6('0xb')](_0x1381d6[_0x7be6('0x24')],{'firstName':_0x1381d6[_0x7be6('0x24')][_0x7be6('0x2f')],'ListId':_0x352417[_0x7be6('0x41')]});_0x57caa6[_0x1381d6[_0x7be6('0x24')][_0x7be6('0x32')]]=_0x1381d6['body'][_0x7be6('0x2f')];return db['CmContact']['create'](_0x57caa6,{'fields':_0x48dfa6,'raw':!![]});}})['then'](function(_0x51ac95){_0x193e41['contact']=_0x51ac95;if(_0x51ac95){var _0x21ed8b={'ContactId':_0x51ac95['id'],'FaxAccountId':_0x1381d6[_0x7be6('0x36')]['id'],'fax':_0x51ac95[_0x7be6('0x25')]};return db[_0x7be6('0x42')][_0x7be6('0x35')]({'where':{'ContactId':_0x51ac95['id'],'closed':![],'FaxAccountId':_0x1381d6[_0x7be6('0x36')]['id']}})['then'](function(_0x12d09a){if(_0x12d09a){return[_0x12d09a,![]];}return db['FaxInteraction'][_0x7be6('0x43')](_0x21ed8b)['then'](function(_0x19091e){return[_0x19091e,!![]];});});}else{throw new Error(_0x7be6('0x44'));}})[_0x7be6('0x45')](function(_0x391ebf,_0x11777a){var _0x5a77e3=_0x391ebf[_0x7be6('0x3c')]({'plain':!![]});if(_0x11777a){if(_0x193e41[_0x7be6('0x36')]['autoclose']){_0x193e41['applications'][_0x7be6('0x46')]({'id':0x0,'priority':_0x193e41[_0x7be6('0x3e')][_0x7be6('0x47')]+0x1,'app':_0x7be6('0x48'),'appdata':'unmanaged','interval':_0x7be6('0x49')});}_0x5a77e3[_0x7be6('0x4a')]=!![];}else{_0x5a77e3['created']=![];}_0x193e41[_0x7be6('0x4b')]=_0x5a77e3;return db[_0x7be6('0x4c')]['create']({'body':_0x1381d6[_0x7be6('0x24')][_0x7be6('0x24')],'FaxAccountId':_0x1381d6[_0x7be6('0x36')]['id'],'FaxInteractionId':_0x391ebf['id'],'direction':'in','ContactId':_0x391ebf['ContactId'],'AttachmentId':_0x1381d6[_0x7be6('0x24')][_0x7be6('0x4d')]});})['then'](function(_0x29f1f6){_0x193e41[_0x7be6('0x18')]=_0x29f1f6;if(!_0x193e41[_0x7be6('0x4b')][_0x7be6('0x4e')])return;return db[_0x7be6('0x4f')][_0x7be6('0x35')]({'attributes':['id',_0x7be6('0x50')],'where':{'id':_0x193e41[_0x7be6('0x4b')][_0x7be6('0x4e')]}});})[_0x7be6('0xf')](function(_0x201634){if(_0x201634){_0x193e41['applications'][_0x7be6('0x51')]({'id':0x0,'priority':0x0,'app':_0x7be6('0x52'),'appdata':_0x201634['name']+','+(_0x193e41['account'][_0x7be6('0x53')]||0xa),'interval':_0x7be6('0x49')});}if(!_0x193e41[_0x7be6('0x4b')][_0x7be6('0x54')])return;return db[_0x7be6('0x55')][_0x7be6('0x35')]({'attributes':['id',_0x7be6('0x50')],'where':{'id':_0x193e41[_0x7be6('0x4b')][_0x7be6('0x54')]}});})[_0x7be6('0xf')](function(_0x3ff288){if(_0x3ff288){_0x193e41['applications'][_0x7be6('0x51')]({'id':0x0,'priority':0x1,'app':_0x7be6('0x56'),'appdata':_0x3ff288['name']+','+(_0x193e41['account'][_0x7be6('0x57')]||0x12c),'interval':_0x7be6('0x49')});}return respondWithRpcPromise(_0x7be6('0x58'),_0x7be6('0x59'),_0x193e41);})['then'](function(_0x5d031a){_0x168bfc(_0x5d031a);})[_0x7be6('0x19')](function(_0x47f9ad){_0x482821(_0x25dcac[_0x7be6('0x16')](0x1f4,_0x47f9ad[_0x7be6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a292793..bef1fc0 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 _0xe106=['emit','removeListener','register','length','faxAccount:','save','remove','update'];(function(_0x2a2114,_0x440fa3){var _0x515f85=function(_0xcd85dc){while(--_0xcd85dc){_0x2a2114['push'](_0x2a2114['shift']());}};_0x515f85(++_0x440fa3);}(_0xe106,0xf5));var _0x6e10=function(_0x59b48b,_0x584733){_0x59b48b=_0x59b48b-0x0;var _0x4c3f79=_0xe106[_0x59b48b];return _0x4c3f79;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6e10('0x0'),_0x6e10('0x1'),_0x6e10('0x2')];function createListener(_0x2296e5,_0x2c7039){return function(_0x1108b7){_0x2c7039[_0x6e10('0x3')](_0x2296e5,_0x1108b7);};}function removeListener(_0x5cc5c5,_0x15ed7e){return function(){FaxAccountEvents[_0x6e10('0x4')](_0x5cc5c5,_0x15ed7e);};}exports[_0x6e10('0x5')]=function(_0x166284){for(var _0x3ef304=0x0,_0x4eceb0=events[_0x6e10('0x6')];_0x3ef304<_0x4eceb0;_0x3ef304++){var _0x5f161f=events[_0x3ef304];var _0x505865=createListener(_0x6e10('0x7')+_0x5f161f,_0x166284);FaxAccountEvents['on'](_0x5f161f,_0x505865);}}; \ No newline at end of file +var _0xa39c=['faxAccount:','./faxAccount.events','remove','update','removeListener','register','length'];(function(_0x17f7e1,_0x561bf4){var _0x556d66=function(_0xd871eb){while(--_0xd871eb){_0x17f7e1['push'](_0x17f7e1['shift']());}};_0x556d66(++_0x561bf4);}(_0xa39c,0x1dd));var _0xca39=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa39c[_0x40a045];return _0x1a687c;};'use strict';var FaxAccountEvents=require(_0xca39('0x0'));var events=['save',_0xca39('0x1'),_0xca39('0x2')];function createListener(_0x2ce615,_0x1baf21){return function(_0x34eb66){_0x1baf21['emit'](_0x2ce615,_0x34eb66);};}function removeListener(_0x159d7a,_0x39f1e0){return function(){FaxAccountEvents[_0xca39('0x3')](_0x159d7a,_0x39f1e0);};}exports[_0xca39('0x4')]=function(_0x358523){for(var _0x5886fe=0x0,_0x40163c=events[_0xca39('0x5')];_0x5886fe<_0x40163c;_0x5886fe++){var _0x37223d=events[_0x5886fe];var _0x47601c=createListener(_0xca39('0x6')+_0x37223d,_0x358523);FaxAccountEvents['on'](_0x37223d,_0x47601c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0709a11..a6ea1ec 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 _0x40f4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','updateAccountApplications','/:id/send','addAgents','update','delete','destroy','removeDispositions','exports','multer','path','express','Router','fs-extra'];(function(_0x363819,_0x453a08){var _0x2afcd7=function(_0x585d55){while(--_0x585d55){_0x363819['push'](_0x363819['shift']());}};_0x2afcd7(++_0x453a08);}(_0x40f4,0x113));var _0x440f=function(_0x3210f9,_0x1d80ae){_0x3210f9=_0x3210f9-0x0;var _0xb3afe0=_0x40f4[_0x3210f9];return _0xb3afe0;};'use strict';var multer=require(_0x440f('0x0'));var util=require('util');var path=require(_0x440f('0x1'));var timeout=require('connect-timeout');var express=require(_0x440f('0x2'));var router=express[_0x440f('0x3')]();var fs_extra=require(_0x440f('0x4'));var auth=require(_0x440f('0x5'));var interaction=require(_0x440f('0x6'));var config=require(_0x440f('0x7'));var controller=require(_0x440f('0x8'));router[_0x440f('0x9')]('/',auth[_0x440f('0xa')](),controller[_0x440f('0xb')]);router[_0x440f('0x9')](_0x440f('0xc'),auth[_0x440f('0xa')](),controller[_0x440f('0xd')]);router['get'](_0x440f('0xe'),auth[_0x440f('0xa')](),controller[_0x440f('0xf')]);router['get'](_0x440f('0x10'),auth[_0x440f('0xa')](),controller['getDispositions']);router[_0x440f('0x9')](_0x440f('0x11'),auth['isAuthenticated'](),controller[_0x440f('0x12')]);router[_0x440f('0x9')](_0x440f('0x13'),auth[_0x440f('0xa')](),controller[_0x440f('0x14')]);router[_0x440f('0x9')](_0x440f('0x15'),auth[_0x440f('0xa')](),controller[_0x440f('0x16')]);router[_0x440f('0x9')](_0x440f('0x17'),auth['isAuthenticated'](),controller[_0x440f('0x18')]);router['get'](_0x440f('0x19'),auth[_0x440f('0xa')](),controller[_0x440f('0x1a')]);router[_0x440f('0x1b')]('/',auth['isAuthenticated'](),controller[_0x440f('0x1c')]);router[_0x440f('0x1b')](_0x440f('0x10'),auth[_0x440f('0xa')](),controller['addDisposition']);router[_0x440f('0x1b')]('/:id/canned_answers',auth[_0x440f('0xa')](),controller[_0x440f('0x1d')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x440f('0x1e')]);router[_0x440f('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller[_0x440f('0x1f')]);router[_0x440f('0x1b')]('/addaccountapplications',auth[_0x440f('0xa')](),controller['addAccountApplications']);router[_0x440f('0x1b')]('/updateaccountapplications',auth[_0x440f('0xa')](),controller[_0x440f('0x20')]);router['post'](_0x440f('0x21'),auth[_0x440f('0xa')](),controller['send']);router['post'](_0x440f('0x19'),auth[_0x440f('0xa')](),controller[_0x440f('0x22')]);router['put'](_0x440f('0xe'),auth[_0x440f('0xa')](),controller[_0x440f('0x23')]);router[_0x440f('0x24')](_0x440f('0xe'),auth[_0x440f('0xa')](),controller[_0x440f('0x25')]);router[_0x440f('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x440f('0x26')]);router[_0x440f('0x24')](_0x440f('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x440f('0x24')](_0x440f('0x19'),auth[_0x440f('0xa')](),controller['removeAgents']);module[_0x440f('0x27')]=router; \ No newline at end of file +var _0x12cb=['/:id/users','getAgents','post','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x12cb,0x88));var _0xb12c=function(_0x210829,_0x1633f8){_0x210829=_0x210829-0x0;var _0x3314eb=_0x12cb[_0x210829];return _0x3314eb;};'use strict';var multer=require(_0xb12c('0x0'));var util=require(_0xb12c('0x1'));var path=require(_0xb12c('0x2'));var timeout=require(_0xb12c('0x3'));var express=require(_0xb12c('0x4'));var router=express[_0xb12c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb12c('0x6'));var interaction=require(_0xb12c('0x7'));var config=require(_0xb12c('0x8'));var controller=require('./faxAccount.controller');router[_0xb12c('0x9')]('/',auth['isAuthenticated'](),controller[_0xb12c('0xa')]);router[_0xb12c('0x9')](_0xb12c('0xb'),auth['isAuthenticated'](),controller[_0xb12c('0xc')]);router[_0xb12c('0x9')](_0xb12c('0xd'),auth[_0xb12c('0xe')](),controller[_0xb12c('0xf')]);router[_0xb12c('0x9')](_0xb12c('0x10'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x11')]);router[_0xb12c('0x9')](_0xb12c('0x12'),auth[_0xb12c('0xe')](),controller['getAnswers']);router[_0xb12c('0x9')]('/:id/interactions',auth[_0xb12c('0xe')](),controller[_0xb12c('0x13')]);router[_0xb12c('0x9')](_0xb12c('0x14'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x15')]);router[_0xb12c('0x9')](_0xb12c('0x16'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x17')]);router[_0xb12c('0x9')](_0xb12c('0x18'),auth['isAuthenticated'](),controller[_0xb12c('0x19')]);router[_0xb12c('0x1a')]('/',auth[_0xb12c('0xe')](),controller['create']);router['post'](_0xb12c('0x10'),auth[_0xb12c('0xe')](),controller['addDisposition']);router['post'](_0xb12c('0x12'),auth[_0xb12c('0xe')](),controller['addAnswer']);router[_0xb12c('0x1a')]('/:id/interactions',auth[_0xb12c('0xe')](),controller[_0xb12c('0x1b')]);router[_0xb12c('0x1a')](_0xb12c('0x14'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x1c')]);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller[_0xb12c('0x1d')]);router[_0xb12c('0x1a')](_0xb12c('0x1e'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x1f')]);router[_0xb12c('0x1a')](_0xb12c('0x20'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x21')]);router[_0xb12c('0x1a')](_0xb12c('0x18'),auth['isAuthenticated'](),controller[_0xb12c('0x22')]);router['put'](_0xb12c('0xd'),auth[_0xb12c('0xe')](),controller['update']);router[_0xb12c('0x23')](_0xb12c('0xd'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x24')]);router['delete']('/:id/dispositions',auth[_0xb12c('0xe')](),controller[_0xb12c('0x25')]);router[_0xb12c('0x23')](_0xb12c('0x12'),auth[_0xb12c('0xe')](),controller['removeAnswers']);router[_0xb12c('0x23')](_0xb12c('0x18'),auth[_0xb12c('0xe')](),controller[_0xb12c('0x26')]);module[_0xb12c('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5328b55..c97d658 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 _0xd83f=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x5bb3e4,_0x306899){var _0x23a27a=function(_0x41c7df){while(--_0x41c7df){_0x5bb3e4['push'](_0x5bb3e4['shift']());}};_0x23a27a(++_0x306899);}(_0xd83f,0xca));var _0xfd83=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd83f[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xfd83('0x0'));module[_0xfd83('0x1')]={'priority':{'type':Sequelize[_0xfd83('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd83('0x3')},'appdata':{'type':Sequelize[_0xfd83('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfd83('0x5')],'defaultValue':_0xfd83('0x6')}}; \ No newline at end of file +var _0xc0ec=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0xacf571,_0x331ff8){var _0x532192=function(_0x32c23b){while(--_0x32c23b){_0xacf571['push'](_0xacf571['shift']());}};_0x532192(++_0x331ff8);}(_0xc0ec,0x73));var _0xcc0e=function(_0x4091d7,_0xea2f09){_0x4091d7=_0x4091d7-0x0;var _0x1cac13=_0xc0ec[_0x4091d7];return _0x1cac13;};'use strict';var Sequelize=require(_0xcc0e('0x0'));module[_0xcc0e('0x1')]={'priority':{'type':Sequelize[_0xcc0e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc0e('0x3')},'appdata':{'type':Sequelize[_0xcc0e('0x4')]()},'description':{'type':Sequelize[_0xcc0e('0x5')]},'interval':{'type':Sequelize[_0xcc0e('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 45c6c3a..33710ff 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 _0xba90=['set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xba90,0x1b9));var _0x0ba9=function(_0x34cfda,_0x303a33){_0x34cfda=_0x34cfda-0x0;var _0x2f2ecc=_0xba90[_0x34cfda];return _0x2f2ecc;};'use strict';var emlformat=require(_0x0ba9('0x0'));var rimraf=require(_0x0ba9('0x1'));var zipdir=require(_0x0ba9('0x2'));var jsonpatch=require(_0x0ba9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0ba9('0x4'));var util=require('util');var path=require(_0x0ba9('0x5'));var sox=require(_0x0ba9('0x6'));var csv=require(_0x0ba9('0x7'));var ejs=require(_0x0ba9('0x8'));var fs=require('fs');var fs_extra=require(_0x0ba9('0x9'));var _=require(_0x0ba9('0xa'));var squel=require(_0x0ba9('0xb'));var crypto=require(_0x0ba9('0xc'));var jsforce=require(_0x0ba9('0xd'));var deskjs=require(_0x0ba9('0xe'));var toCsv=require(_0x0ba9('0x7'));var querystring=require(_0x0ba9('0xf'));var Papa=require(_0x0ba9('0x10'));var Redis=require('ioredis');var authService=require(_0x0ba9('0x11'));var qs=require(_0x0ba9('0x12'));var as=require(_0x0ba9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ba9('0x14'))('api');var utils=require(_0x0ba9('0x15'));var config=require(_0x0ba9('0x16'));var licenseUtil=require(_0x0ba9('0x17'));var db=require(_0x0ba9('0x18'))['db'];function respondWithStatusCode(_0x13e959,_0x3f753b){_0x3f753b=_0x3f753b||0xcc;return function(_0x11ad15){if(_0x11ad15){return _0x13e959[_0x0ba9('0x19')](_0x3f753b);}return _0x13e959[_0x0ba9('0x1a')](_0x3f753b)[_0x0ba9('0x1b')]();};}function respondWithResult(_0x3865e1,_0x5c92a8){_0x5c92a8=_0x5c92a8||0xc8;return function(_0x236fba){if(_0x236fba){return _0x3865e1[_0x0ba9('0x1a')](_0x5c92a8)[_0x0ba9('0x1c')](_0x236fba);}};}function respondWithFilteredResult(_0x389c31,_0x464532){return function(_0xe22df){if(_0xe22df){var _0x4110aa=typeof _0x464532[_0x0ba9('0x1d')]===_0x0ba9('0x1e')&&typeof _0x464532[_0x0ba9('0x1f')]===_0x0ba9('0x1e');var _0x4c9461=_0xe22df[_0x0ba9('0x20')];var _0x405376=_0x4110aa?0x0:_0x464532[_0x0ba9('0x1d')];var _0x1d5f88=_0x4110aa?_0xe22df[_0x0ba9('0x20')]:_0x464532['offset']+_0x464532['limit'];var _0x14583e;if(_0x1d5f88>=_0x4c9461){_0x1d5f88=_0x4c9461;_0x14583e=0xc8;}else{_0x14583e=0xce;}_0x389c31['status'](_0x14583e);return _0x389c31[_0x0ba9('0x21')](_0x0ba9('0x22'),_0x405376+'-'+_0x1d5f88+'/'+_0x4c9461)['json'](_0xe22df);}return null;};}function patchUpdates(_0x31f70b){return function(_0xad70e3){try{jsonpatch[_0x0ba9('0x23')](_0xad70e3,_0x31f70b,!![]);}catch(_0x494888){return BPromise[_0x0ba9('0x24')](_0x494888);}return _0xad70e3[_0x0ba9('0x25')]();};}function saveUpdates(_0x41d34b,_0x2a8f6b){return function(_0x2869dd){if(_0x2869dd){return _0x2869dd['update'](_0x41d34b)[_0x0ba9('0x26')](function(_0x49df6c){return _0x49df6c;});}return null;};}function removeEntity(_0x2f1b14,_0xd92e55){return function(_0x8158a){if(_0x8158a){return _0x8158a[_0x0ba9('0x27')]()[_0x0ba9('0x26')](function(){_0x2f1b14[_0x0ba9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6399,_0x386959){return function(_0x386535){if(!_0x386535){_0x4d6399[_0x0ba9('0x19')](0x194);}return _0x386535;};}function handleError(_0x3b8373,_0x2443d1){_0x2443d1=_0x2443d1||0x1f4;return function(_0xef108c){logger[_0x0ba9('0x28')](_0xef108c[_0x0ba9('0x29')]);if(_0xef108c[_0x0ba9('0x2a')]){delete _0xef108c[_0x0ba9('0x2a')];}_0x3b8373[_0x0ba9('0x1a')](_0x2443d1)[_0x0ba9('0x2b')](_0xef108c);};}exports[_0x0ba9('0x2c')]=function(_0x2b286b,_0x53b4a9){var _0x4e726c={},_0xf207ef={},_0x472c19={'count':0x0,'rows':[]};var _0x3dd1fd=_['map'](db[_0x0ba9('0x2d')][_0x0ba9('0x2e')],function(_0x4a7311){return{'name':_0x4a7311[_0x0ba9('0x2f')],'type':_0x4a7311['type'][_0x0ba9('0x30')]};});_0xf207ef[_0x0ba9('0x31')]=_['map'](_0x3dd1fd,'name');_0xf207ef[_0x0ba9('0x32')]=_[_0x0ba9('0x33')](_0x2b286b[_0x0ba9('0x32')]);_0xf207ef[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0xf207ef[_0x0ba9('0x31')],_0xf207ef[_0x0ba9('0x32')]);_0x4e726c['attributes']=_[_0x0ba9('0x35')](_0xf207ef[_0x0ba9('0x31')],qs[_0x0ba9('0x36')](_0x2b286b[_0x0ba9('0x32')]['fields']));_0x4e726c[_0x0ba9('0x37')]=_0x4e726c['attributes'][_0x0ba9('0x38')]?_0x4e726c[_0x0ba9('0x37')]:_0xf207ef[_0x0ba9('0x31')];if(!_0x2b286b[_0x0ba9('0x32')][_0x0ba9('0x39')](_0x0ba9('0x3a'))){_0x4e726c[_0x0ba9('0x1f')]=qs[_0x0ba9('0x1f')](_0x2b286b[_0x0ba9('0x32')][_0x0ba9('0x1f')]);_0x4e726c[_0x0ba9('0x1d')]=qs[_0x0ba9('0x1d')](_0x2b286b['query'][_0x0ba9('0x1d')]);}_0x4e726c[_0x0ba9('0x3b')]=qs[_0x0ba9('0x3c')](_0x2b286b[_0x0ba9('0x32')][_0x0ba9('0x3c')]);_0x4e726c['where']=qs[_0x0ba9('0x34')](_[_0x0ba9('0x3d')](_0x2b286b[_0x0ba9('0x32')],_0xf207ef[_0x0ba9('0x34')]),_0x3dd1fd);if(_0x2b286b[_0x0ba9('0x32')][_0x0ba9('0x3e')]){_0x4e726c[_0x0ba9('0x3f')]=_[_0x0ba9('0x40')](_0x4e726c[_0x0ba9('0x3f')],{'$or':_[_0x0ba9('0x41')](_0x3dd1fd,function(_0x288c03){if(_0x288c03[_0x0ba9('0x42')]!==_0x0ba9('0x43')){var _0x7aa7ec={};_0x7aa7ec[_0x288c03[_0x0ba9('0x2a')]]={'$like':'%'+_0x2b286b[_0x0ba9('0x32')][_0x0ba9('0x3e')]+'%'};return _0x7aa7ec;}})});}_0x4e726c=_[_0x0ba9('0x40')]({},_0x4e726c,_0x2b286b[_0x0ba9('0x44')]);var _0x4e7e74={'where':_0x4e726c['where']};return db['FaxApplication'][_0x0ba9('0x20')](_0x4e7e74)['then'](function(_0x2e0348){_0x472c19['count']=_0x2e0348;if(_0x2b286b[_0x0ba9('0x32')]['includeAll']){_0x4e726c[_0x0ba9('0x45')]=[{'all':!![]}];}return db[_0x0ba9('0x2d')][_0x0ba9('0x46')](_0x4e726c);})['then'](function(_0x5ce674){_0x472c19['rows']=_0x5ce674;return _0x472c19;})[_0x0ba9('0x26')](respondWithFilteredResult(_0x53b4a9,_0x4e726c))[_0x0ba9('0x47')](handleError(_0x53b4a9,null));};exports[_0x0ba9('0x48')]=function(_0x50d54c,_0xce19cd){var _0x573004={'raw':!![],'where':{'id':_0x50d54c[_0x0ba9('0x49')]['id']}},_0x46891d={};_0x46891d[_0x0ba9('0x31')]=_[_0x0ba9('0x33')](db[_0x0ba9('0x2d')]['rawAttributes']);_0x46891d[_0x0ba9('0x32')]=_['keys'](_0x50d54c[_0x0ba9('0x32')]);_0x46891d[_0x0ba9('0x34')]=_[_0x0ba9('0x35')](_0x46891d['model'],_0x46891d[_0x0ba9('0x32')]);_0x573004[_0x0ba9('0x37')]=_[_0x0ba9('0x35')](_0x46891d[_0x0ba9('0x31')],qs[_0x0ba9('0x36')](_0x50d54c[_0x0ba9('0x32')][_0x0ba9('0x36')]));_0x573004[_0x0ba9('0x37')]=_0x573004[_0x0ba9('0x37')]['length']?_0x573004['attributes']:_0x46891d[_0x0ba9('0x31')];if(_0x50d54c[_0x0ba9('0x32')][_0x0ba9('0x4a')]){_0x573004[_0x0ba9('0x45')]=[{'all':!![]}];}_0x573004=_[_0x0ba9('0x40')]({},_0x573004,_0x50d54c[_0x0ba9('0x44')]);return db['FaxApplication'][_0x0ba9('0x4b')](_0x573004)[_0x0ba9('0x26')](handleEntityNotFound(_0xce19cd,null))['then'](respondWithResult(_0xce19cd,null))[_0x0ba9('0x47')](handleError(_0xce19cd,null));};exports[_0x0ba9('0x4c')]=function(_0x308dee,_0x5eb15b){return db[_0x0ba9('0x2d')][_0x0ba9('0x4c')](_0x308dee['body'],{})['then'](respondWithResult(_0x5eb15b,0xc9))[_0x0ba9('0x47')](handleError(_0x5eb15b,null));};exports[_0x0ba9('0x4d')]=function(_0x3a4e28,_0x2843c7){if(_0x3a4e28[_0x0ba9('0x4e')]['id']){delete _0x3a4e28['body']['id'];}return db[_0x0ba9('0x2d')]['find']({'where':{'id':_0x3a4e28[_0x0ba9('0x49')]['id']}})['then'](handleEntityNotFound(_0x2843c7,null))[_0x0ba9('0x26')](saveUpdates(_0x3a4e28[_0x0ba9('0x4e')],null))['then'](respondWithResult(_0x2843c7,null))['catch'](handleError(_0x2843c7,null));};exports[_0x0ba9('0x27')]=function(_0x2ed890,_0x527b2b){return db['FaxApplication'][_0x0ba9('0x4b')]({'where':{'id':_0x2ed890[_0x0ba9('0x49')]['id']}})[_0x0ba9('0x26')](handleEntityNotFound(_0x527b2b,null))['then'](removeEntity(_0x527b2b,null))[_0x0ba9('0x47')](handleError(_0x527b2b,null));}; \ No newline at end of file +var _0x0d9a=['util','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','index','map','FaxApplication','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','count','then','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0d9a,0x117));var _0xa0d9=function(_0x1fae65,_0x43391d){_0x1fae65=_0x1fae65-0x0;var _0x56805f=_0x0d9a[_0x1fae65];return _0x56805f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0d9('0x1'));var rp=require(_0xa0d9('0x2'));var moment=require(_0xa0d9('0x3'));var BPromise=require(_0xa0d9('0x4'));var Mustache=require('mustache');var util=require(_0xa0d9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa0d9('0x6'));var ejs=require(_0xa0d9('0x7'));var fs=require('fs');var fs_extra=require(_0xa0d9('0x8'));var _=require('lodash');var squel=require(_0xa0d9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa0d9('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0d9('0xb'));var Redis=require(_0xa0d9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xa0d9('0xd'));var as=require(_0xa0d9('0xe'));var hardwareService=require(_0xa0d9('0xf'));var logger=require('../../config/logger')(_0xa0d9('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa0d9('0x11'));var db=require(_0xa0d9('0x12'))['db'];function respondWithStatusCode(_0x3dedf8,_0xa197fa){_0xa197fa=_0xa197fa||0xcc;return function(_0x363084){if(_0x363084){return _0x3dedf8['sendStatus'](_0xa197fa);}return _0x3dedf8['status'](_0xa197fa)[_0xa0d9('0x13')]();};}function respondWithResult(_0x53e09a,_0x3f6b4d){_0x3f6b4d=_0x3f6b4d||0xc8;return function(_0x4cf592){if(_0x4cf592){return _0x53e09a[_0xa0d9('0x14')](_0x3f6b4d)[_0xa0d9('0x15')](_0x4cf592);}};}function respondWithFilteredResult(_0x57c863,_0x42bf20){return function(_0x54588e){if(_0x54588e){var _0x26e50a=typeof _0x42bf20[_0xa0d9('0x16')]===_0xa0d9('0x17')&&typeof _0x42bf20['limit']===_0xa0d9('0x17');var _0x3196a3=_0x54588e['count'];var _0x43fdd8=_0x26e50a?0x0:_0x42bf20[_0xa0d9('0x16')];var _0x55ada5=_0x26e50a?_0x54588e['count']:_0x42bf20[_0xa0d9('0x16')]+_0x42bf20[_0xa0d9('0x18')];var _0x546ec1;if(_0x55ada5>=_0x3196a3){_0x55ada5=_0x3196a3;_0x546ec1=0xc8;}else{_0x546ec1=0xce;}_0x57c863[_0xa0d9('0x14')](_0x546ec1);return _0x57c863[_0xa0d9('0x19')](_0xa0d9('0x1a'),_0x43fdd8+'-'+_0x55ada5+'/'+_0x3196a3)[_0xa0d9('0x15')](_0x54588e);}return null;};}function patchUpdates(_0x1f3abb){return function(_0x64efbb){try{jsonpatch[_0xa0d9('0x1b')](_0x64efbb,_0x1f3abb,!![]);}catch(_0x3f6f54){return BPromise[_0xa0d9('0x1c')](_0x3f6f54);}return _0x64efbb[_0xa0d9('0x1d')]();};}function saveUpdates(_0x557f03,_0x3710e5){return function(_0x42189b){if(_0x42189b){return _0x42189b[_0xa0d9('0x1e')](_0x557f03)['then'](function(_0x1aadbf){return _0x1aadbf;});}return null;};}function removeEntity(_0xc97e49,_0x5c2695){return function(_0x330173){if(_0x330173){return _0x330173[_0xa0d9('0x1f')]()['then'](function(){_0xc97e49[_0xa0d9('0x14')](0xcc)[_0xa0d9('0x13')]();});}};}function handleEntityNotFound(_0xba21bf,_0x3c54c2){return function(_0x4640cc){if(!_0x4640cc){_0xba21bf[_0xa0d9('0x20')](0x194);}return _0x4640cc;};}function handleError(_0x558d71,_0x2e6dcf){_0x2e6dcf=_0x2e6dcf||0x1f4;return function(_0x2dadbe){logger[_0xa0d9('0x21')](_0x2dadbe[_0xa0d9('0x22')]);if(_0x2dadbe['name']){delete _0x2dadbe['name'];}_0x558d71[_0xa0d9('0x14')](_0x2e6dcf)['send'](_0x2dadbe);};}exports[_0xa0d9('0x23')]=function(_0xb82350,_0x45be1c){var _0x14bba6={},_0x4ab16f={},_0x2c0dca={'count':0x0,'rows':[]};var _0x23d3c5=_[_0xa0d9('0x24')](db[_0xa0d9('0x25')][_0xa0d9('0x26')],function(_0x139bd2){return{'name':_0x139bd2[_0xa0d9('0x27')],'type':_0x139bd2['type'][_0xa0d9('0x28')]};});_0x4ab16f[_0xa0d9('0x29')]=_['map'](_0x23d3c5,_0xa0d9('0x2a'));_0x4ab16f[_0xa0d9('0x2b')]=_[_0xa0d9('0x2c')](_0xb82350['query']);_0x4ab16f[_0xa0d9('0x2d')]=_[_0xa0d9('0x2e')](_0x4ab16f[_0xa0d9('0x29')],_0x4ab16f[_0xa0d9('0x2b')]);_0x14bba6['attributes']=_[_0xa0d9('0x2e')](_0x4ab16f[_0xa0d9('0x29')],qs['fields'](_0xb82350[_0xa0d9('0x2b')][_0xa0d9('0x2f')]));_0x14bba6[_0xa0d9('0x30')]=_0x14bba6[_0xa0d9('0x30')]['length']?_0x14bba6[_0xa0d9('0x30')]:_0x4ab16f[_0xa0d9('0x29')];if(!_0xb82350[_0xa0d9('0x2b')][_0xa0d9('0x31')]('nolimit')){_0x14bba6['limit']=qs[_0xa0d9('0x18')](_0xb82350[_0xa0d9('0x2b')][_0xa0d9('0x18')]);_0x14bba6[_0xa0d9('0x16')]=qs[_0xa0d9('0x16')](_0xb82350['query']['offset']);}_0x14bba6[_0xa0d9('0x32')]=qs[_0xa0d9('0x33')](_0xb82350['query'][_0xa0d9('0x33')]);_0x14bba6['where']=qs['filters'](_[_0xa0d9('0x34')](_0xb82350[_0xa0d9('0x2b')],_0x4ab16f[_0xa0d9('0x2d')]),_0x23d3c5);if(_0xb82350[_0xa0d9('0x2b')]['filter']){_0x14bba6[_0xa0d9('0x35')]=_[_0xa0d9('0x36')](_0x14bba6[_0xa0d9('0x35')],{'$or':_[_0xa0d9('0x24')](_0x23d3c5,function(_0x236977){if(_0x236977[_0xa0d9('0x37')]!==_0xa0d9('0x38')){var _0x37d44c={};_0x37d44c[_0x236977[_0xa0d9('0x2a')]]={'$like':'%'+_0xb82350[_0xa0d9('0x2b')][_0xa0d9('0x39')]+'%'};return _0x37d44c;}})});}_0x14bba6=_['merge']({},_0x14bba6,_0xb82350['options']);var _0x54a6ed={'where':_0x14bba6[_0xa0d9('0x35')]};return db[_0xa0d9('0x25')][_0xa0d9('0x3a')](_0x54a6ed)[_0xa0d9('0x3b')](function(_0x18e7e6){_0x2c0dca[_0xa0d9('0x3a')]=_0x18e7e6;if(_0xb82350[_0xa0d9('0x2b')][_0xa0d9('0x3c')]){_0x14bba6['include']=[{'all':!![]}];}return db[_0xa0d9('0x25')][_0xa0d9('0x3d')](_0x14bba6);})['then'](function(_0x5b3a3d){_0x2c0dca[_0xa0d9('0x3e')]=_0x5b3a3d;return _0x2c0dca;})[_0xa0d9('0x3b')](respondWithFilteredResult(_0x45be1c,_0x14bba6))[_0xa0d9('0x3f')](handleError(_0x45be1c,null));};exports['show']=function(_0x9cf9e9,_0x3d3443){var _0x2269ad={'raw':!![],'where':{'id':_0x9cf9e9[_0xa0d9('0x40')]['id']}},_0x3f7dd1={};_0x3f7dd1[_0xa0d9('0x29')]=_['keys'](db[_0xa0d9('0x25')][_0xa0d9('0x26')]);_0x3f7dd1[_0xa0d9('0x2b')]=_[_0xa0d9('0x2c')](_0x9cf9e9[_0xa0d9('0x2b')]);_0x3f7dd1[_0xa0d9('0x2d')]=_[_0xa0d9('0x2e')](_0x3f7dd1['model'],_0x3f7dd1[_0xa0d9('0x2b')]);_0x2269ad[_0xa0d9('0x30')]=_[_0xa0d9('0x2e')](_0x3f7dd1[_0xa0d9('0x29')],qs[_0xa0d9('0x2f')](_0x9cf9e9[_0xa0d9('0x2b')][_0xa0d9('0x2f')]));_0x2269ad[_0xa0d9('0x30')]=_0x2269ad[_0xa0d9('0x30')][_0xa0d9('0x41')]?_0x2269ad[_0xa0d9('0x30')]:_0x3f7dd1[_0xa0d9('0x29')];if(_0x9cf9e9['query'][_0xa0d9('0x3c')]){_0x2269ad[_0xa0d9('0x42')]=[{'all':!![]}];}_0x2269ad=_[_0xa0d9('0x36')]({},_0x2269ad,_0x9cf9e9[_0xa0d9('0x43')]);return db[_0xa0d9('0x25')][_0xa0d9('0x44')](_0x2269ad)[_0xa0d9('0x3b')](handleEntityNotFound(_0x3d3443,null))['then'](respondWithResult(_0x3d3443,null))['catch'](handleError(_0x3d3443,null));};exports[_0xa0d9('0x45')]=function(_0x1711c3,_0x35f6a0){return db[_0xa0d9('0x25')][_0xa0d9('0x45')](_0x1711c3[_0xa0d9('0x46')],{})[_0xa0d9('0x3b')](respondWithResult(_0x35f6a0,0xc9))[_0xa0d9('0x3f')](handleError(_0x35f6a0,null));};exports[_0xa0d9('0x1e')]=function(_0x4aa8dc,_0x46f2ca){if(_0x4aa8dc[_0xa0d9('0x46')]['id']){delete _0x4aa8dc[_0xa0d9('0x46')]['id'];}return db[_0xa0d9('0x25')][_0xa0d9('0x44')]({'where':{'id':_0x4aa8dc[_0xa0d9('0x40')]['id']}})[_0xa0d9('0x3b')](handleEntityNotFound(_0x46f2ca,null))[_0xa0d9('0x3b')](saveUpdates(_0x4aa8dc[_0xa0d9('0x46')],null))[_0xa0d9('0x3b')](respondWithResult(_0x46f2ca,null))[_0xa0d9('0x3f')](handleError(_0x46f2ca,null));};exports[_0xa0d9('0x1f')]=function(_0x4d8bae,_0x108567){return db[_0xa0d9('0x25')][_0xa0d9('0x44')]({'where':{'id':_0x4d8bae['params']['id']}})[_0xa0d9('0x3b')](handleEntityNotFound(_0x108567,null))[_0xa0d9('0x3b')](removeEntity(_0x108567,null))[_0xa0d9('0x3f')](handleError(_0x108567,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 77b1a73..b7c006a 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 _0x0b33=['rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2fa3e4,_0x13ab3d){var _0x2b2e23=function(_0x298387){while(--_0x298387){_0x2fa3e4['push'](_0x2fa3e4['shift']());}};_0x2b2e23(++_0x13ab3d);}(_0x0b33,0x70));var _0x30b3=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x0b33[_0x31b5a5];return _0x364cc9;};'use strict';var _=require(_0x30b3('0x0'));var util=require(_0x30b3('0x1'));var logger=require(_0x30b3('0x2'))(_0x30b3('0x3'));var moment=require(_0x30b3('0x4'));var BPromise=require(_0x30b3('0x5'));var rp=require(_0x30b3('0x6'));var fs=require('fs');var path=require(_0x30b3('0x7'));var rimraf=require(_0x30b3('0x8'));var config=require(_0x30b3('0x9'));var attributes=require(_0x30b3('0xa'));module['exports']=function(_0x4a95f7,_0x2cc771){return _0x4a95f7[_0x30b3('0xb')](_0x30b3('0xc'),attributes,{'tableName':_0x30b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x30b3('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4aed=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x4aed,0x167));var _0xd4ae=function(_0x135b81,_0x39db4b){_0x135b81=_0x135b81-0x0;var _0x5d8a8e=_0x4aed[_0x135b81];return _0x5d8a8e;};'use strict';var _=require(_0xd4ae('0x0'));var util=require(_0xd4ae('0x1'));var logger=require(_0xd4ae('0x2'))('api');var moment=require(_0xd4ae('0x3'));var BPromise=require(_0xd4ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4ae('0x5'));var rimraf=require(_0xd4ae('0x6'));var config=require(_0xd4ae('0x7'));var attributes=require(_0xd4ae('0x8'));module[_0xd4ae('0x9')]=function(_0x4fccbf,_0x2442e6){return _0x4fccbf[_0xd4ae('0xa')](_0xd4ae('0xb'),attributes,{'tableName':_0xd4ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd4ae('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 35ecdc7..8ac65c7 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 _0xa0e7=['info','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x3a2e0e,_0x5d557f){var _0x363ddc=function(_0x3adec0){while(--_0x3adec0){_0x3a2e0e['push'](_0x3a2e0e['shift']());}};_0x363ddc(++_0x5d557f);}(_0xa0e7,0x141));var _0x7a0e=function(_0x3ba025,_0xc174f7){_0x3ba025=_0x3ba025-0x0;var _0x1d03a2=_0xa0e7[_0x3ba025];return _0x1d03a2;};'use strict';var _=require(_0x7a0e('0x0'));var util=require(_0x7a0e('0x1'));var moment=require(_0x7a0e('0x2'));var BPromise=require(_0x7a0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a0e('0x4'));var db=require(_0x7a0e('0x5'))['db'];var utils=require(_0x7a0e('0x6'));var logger=require(_0x7a0e('0x7'))(_0x7a0e('0x8'));var config=require(_0x7a0e('0x9'));var jayson=require(_0x7a0e('0xa'));var client=jayson[_0x7a0e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x228a09,_0x43adfe,_0x53a19a){return new BPromise(function(_0x19cd14,_0x7c4652){return client[_0x7a0e('0xc')](_0x228a09,_0x53a19a)['then'](function(_0x2235c8){logger['info'](_0x7a0e('0xd'),_0x43adfe,_0x7a0e('0xe'));logger[_0x7a0e('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x43adfe,_0x7a0e('0xe'),JSON[_0x7a0e('0x10')](_0x2235c8));if(_0x2235c8['error']){if(_0x2235c8['error'][_0x7a0e('0x11')]===0x1f4){logger[_0x7a0e('0x12')](_0x7a0e('0xd'),_0x43adfe,_0x2235c8[_0x7a0e('0x12')][_0x7a0e('0x13')]);return _0x7c4652(_0x2235c8[_0x7a0e('0x12')]['message']);}logger['error'](_0x7a0e('0xd'),_0x43adfe,_0x2235c8[_0x7a0e('0x12')][_0x7a0e('0x13')]);return _0x19cd14(_0x2235c8['error'][_0x7a0e('0x13')]);}else{logger[_0x7a0e('0x14')](_0x7a0e('0xd'),_0x43adfe,_0x7a0e('0xe'));_0x19cd14(_0x2235c8[_0x7a0e('0x15')]['message']);}})[_0x7a0e('0x16')](function(_0x54b89e){logger[_0x7a0e('0x12')](_0x7a0e('0xd'),_0x43adfe,_0x54b89e);_0x7c4652(_0x54b89e);});});}exports[_0x7a0e('0x17')]=function(_0xa6c087){var _0x521e22=this;return new Promise(function(_0x3332e6,_0x1338fc){return db[_0x7a0e('0x18')][_0x7a0e('0x19')](_0xa6c087['body'],{'raw':_0xa6c087[_0x7a0e('0x1a')]?_0xa6c087[_0x7a0e('0x1a')][_0x7a0e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa6c087['options']?_0xa6c087['options'][_0x7a0e('0x1c')]||null:null,'attributes':_0xa6c087['options']?_0xa6c087['options'][_0x7a0e('0x1d')]||null:null,'limit':_0xa6c087['options']?_0xa6c087['options']['limit']||null:null})[_0x7a0e('0x1e')](function(_0xf9d80f){logger[_0x7a0e('0x14')](_0x7a0e('0x17'),_0xa6c087);logger[_0x7a0e('0xf')](_0x7a0e('0x17'),_0xa6c087,JSON[_0x7a0e('0x10')](_0xf9d80f));_0x3332e6(_0xf9d80f);})['catch'](function(_0x24c481){logger[_0x7a0e('0x12')](_0x7a0e('0x17'),_0x24c481[_0x7a0e('0x13')],_0xa6c087);_0x1338fc(_0x521e22[_0x7a0e('0x12')](0x1f4,_0x24c481[_0x7a0e('0x13')]));});});}; \ No newline at end of file +var _0x25e5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','code','error','message','catch','FaxApplication','update','options','raw','where','attributes','limit','UpdateFaxApplication','stringify','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x4dfd10,_0x3169d5){var _0x267950=function(_0x15b4ae){while(--_0x15b4ae){_0x4dfd10['push'](_0x4dfd10['shift']());}};_0x267950(++_0x3169d5);}(_0x25e5,0xb5));var _0x525e=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x25e5[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x525e('0x0'));var util=require(_0x525e('0x1'));var moment=require(_0x525e('0x2'));var BPromise=require('bluebird');var rs=require(_0x525e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x525e('0x4'))['db'];var utils=require(_0x525e('0x5'));var logger=require('../../config/logger')(_0x525e('0x6'));var config=require(_0x525e('0x7'));var jayson=require(_0x525e('0x8'));var client=jayson[_0x525e('0x9')][_0x525e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x108dd2,_0x14a349,_0x40252b){return new BPromise(function(_0x3b1740,_0x1e7d36){return client[_0x525e('0xb')](_0x108dd2,_0x40252b)[_0x525e('0xc')](function(_0x365720){logger[_0x525e('0xd')](_0x525e('0xe'),_0x14a349,_0x525e('0xf'));logger[_0x525e('0x10')](_0x525e('0x11'),_0x14a349,_0x525e('0xf'),JSON['stringify'](_0x365720));if(_0x365720['error']){if(_0x365720['error'][_0x525e('0x12')]===0x1f4){logger[_0x525e('0x13')](_0x525e('0xe'),_0x14a349,_0x365720[_0x525e('0x13')][_0x525e('0x14')]);return _0x1e7d36(_0x365720[_0x525e('0x13')][_0x525e('0x14')]);}logger['error'](_0x525e('0xe'),_0x14a349,_0x365720[_0x525e('0x13')][_0x525e('0x14')]);return _0x3b1740(_0x365720[_0x525e('0x13')][_0x525e('0x14')]);}else{logger['info'](_0x525e('0xe'),_0x14a349,_0x525e('0xf'));_0x3b1740(_0x365720['result'][_0x525e('0x14')]);}})[_0x525e('0x15')](function(_0x2384b1){logger[_0x525e('0x13')](_0x525e('0xe'),_0x14a349,_0x2384b1);_0x1e7d36(_0x2384b1);});});}exports['UpdateFaxApplication']=function(_0x657f2c){var _0x1989e4=this;return new Promise(function(_0x1880a8,_0x46dae2){return db[_0x525e('0x16')][_0x525e('0x17')](_0x657f2c['body'],{'raw':_0x657f2c[_0x525e('0x18')]?_0x657f2c[_0x525e('0x18')][_0x525e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x657f2c[_0x525e('0x18')]?_0x657f2c['options'][_0x525e('0x1a')]||null:null,'attributes':_0x657f2c[_0x525e('0x18')]?_0x657f2c[_0x525e('0x18')][_0x525e('0x1b')]||null:null,'limit':_0x657f2c['options']?_0x657f2c[_0x525e('0x18')][_0x525e('0x1c')]||null:null})[_0x525e('0xc')](function(_0x2d8a76){logger[_0x525e('0xd')](_0x525e('0x1d'),_0x657f2c);logger['debug']('UpdateFaxApplication',_0x657f2c,JSON[_0x525e('0x1e')](_0x2d8a76));_0x1880a8(_0x2d8a76);})[_0x525e('0x15')](function(_0x4d30bd){logger[_0x525e('0x13')](_0x525e('0x1d'),_0x4d30bd[_0x525e('0x14')],_0x657f2c);_0x46dae2(_0x1989e4[_0x525e('0x13')](0x1f4,_0x4d30bd[_0x525e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3347d50..a2f77a8 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x284807,_0x2cfa31){var _0x4adfb5=function(_0x12b8aa){while(--_0x12b8aa){_0x284807['push'](_0x284807['shift']());}};_0x4adfb5(++_0x2cfa31);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','path','express'];(function(_0x4fe328,_0x5e456d){var _0x11a53b=function(_0x42f8cb){while(--_0x42f8cb){_0x4fe328['push'](_0x4fe328['shift']());}};_0x11a53b(++_0x5e456d);}(_0x36ee,0xe8));var _0xe36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['post']('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xd')]);router[_0xe36e('0xe')]('/:id',auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0xf')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x10')]);module[_0xe36e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index acd67a4..4fbc4fe 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 _0x9582=['DATE','STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x2c20c0,_0x2a5a33){var _0x30840f=function(_0x4d8a1a){while(--_0x4d8a1a){_0x2c20c0['push'](_0x2c20c0['shift']());}};_0x30840f(++_0x2a5a33);}(_0x9582,0x95));var _0x2958=function(_0x582e2c,_0x5220c2){_0x582e2c=_0x582e2c-0x0;var _0xc53b0e=_0x9582[_0x582e2c];return _0xc53b0e;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'closed':{'type':Sequelize[_0x2958('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2958('0x3')]},'disposition':{'type':Sequelize[_0x2958('0x4')]},'secondDisposition':{'type':Sequelize[_0x2958('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2958('0x4')]},'read1stAt':{'type':Sequelize[_0x2958('0x3')]},'fax':{'type':Sequelize[_0x2958('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2958('0x5')]('in',_0x2958('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2958('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2958('0x5')]('in',_0x2958('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2958('0x7')]}}; \ No newline at end of file +var _0xcf2f=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x33f57c,_0x39a843){var _0xb864de=function(_0x435439){while(--_0x435439){_0x33f57c['push'](_0x33f57c['shift']());}};_0xb864de(++_0x39a843);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x440a09,_0x303fb0){_0x440a09=_0x440a09-0x0;var _0x495be4=_0xcf2f[_0x440a09];return _0x495be4;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'closed':{'type':Sequelize[_0xfcf2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfcf2('0x3')]},'disposition':{'type':Sequelize[_0xfcf2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfcf2('0x4')]},'note':{'type':Sequelize[_0xfcf2('0x4')]},'read1stAt':{'type':Sequelize[_0xfcf2('0x3')]},'fax':{'type':Sequelize[_0xfcf2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfcf2('0x5')]('in',_0xfcf2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfcf2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfcf2('0x5')]('in',_0xfcf2('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xfcf2('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 33d72eb..045022e 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 _0x1cb7=['status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','show','model','keys','intersection','fields','attributes','includeAll','merge','options','FaxInteraction','find','catch','create','body','params','describe','FaxMessage','addMessage','ids','omit','findOne','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','mkdirSync','basename','existsSync','resolve','log','err','unlinkSync','rimraf','moment','bluebird','path','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus'];(function(_0x18deef,_0x5b8774){var _0x3f4361=function(_0xc61e4d){while(--_0xc61e4d){_0x18deef['push'](_0x18deef['shift']());}};_0x3f4361(++_0x5b8774);}(_0x1cb7,0x185));var _0x71cb=function(_0x4302ab,_0x2f56a7){_0x4302ab=_0x4302ab-0x0;var _0x4b0da5=_0x1cb7[_0x4302ab];return _0x4b0da5;};'use strict';var rimraf=require(_0x71cb('0x0'));var zipdir=require('zip-dir');var moment=require(_0x71cb('0x1'));var BPromise=require(_0x71cb('0x2'));var util=require('util');var path=require(_0x71cb('0x3'));var fs=require('fs');var _=require(_0x71cb('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x71cb('0x5'));var logger=require('../../config/logger')(_0x71cb('0x6'));var config=require(_0x71cb('0x7'));var db=require(_0x71cb('0x8'))['db'];config[_0x71cb('0x9')]=_[_0x71cb('0xa')](config[_0x71cb('0x9')],{'host':_0x71cb('0xb'),'port':0x18eb});var socket=require(_0x71cb('0xc'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x71cb('0xd')](socket);function respondWithStatusCode(_0x195273,_0xa5cd41){_0xa5cd41=_0xa5cd41||0xcc;return function(_0x23137c){if(_0x23137c){return _0x195273[_0x71cb('0xe')](_0xa5cd41);}return _0x195273[_0x71cb('0xf')](_0xa5cd41)[_0x71cb('0x10')]();};}function respondWithResult(_0x8fe1b9,_0x6e70e1){_0x6e70e1=_0x6e70e1||0xc8;return function(_0x56d986){if(_0x56d986){return _0x8fe1b9[_0x71cb('0xf')](_0x6e70e1)[_0x71cb('0x11')](_0x56d986);}};}function respondWithFilteredResult(_0x1879e3,_0x585cb0){return function(_0x3da33e){if(_0x3da33e){var _0x4576a2=typeof _0x585cb0[_0x71cb('0x12')]===_0x71cb('0x13')&&typeof _0x585cb0[_0x71cb('0x14')]===_0x71cb('0x13');var _0x3cdbb3=_0x3da33e[_0x71cb('0x15')];var _0x463f3e=_0x4576a2?0x0:_0x585cb0['offset'];var _0x266f7e=_0x4576a2?_0x3da33e[_0x71cb('0x15')]:_0x585cb0[_0x71cb('0x12')]+_0x585cb0[_0x71cb('0x14')];var _0x27269e;if(_0x266f7e>=_0x3cdbb3){_0x266f7e=_0x3cdbb3;_0x27269e=0xc8;}else{_0x27269e=0xce;}_0x1879e3[_0x71cb('0xf')](_0x27269e);return _0x1879e3['set'](_0x71cb('0x16'),_0x463f3e+'-'+_0x266f7e+'/'+_0x3cdbb3)[_0x71cb('0x11')](_0x3da33e);}return null;};}function saveUpdates(_0x285e05){return function(_0x5daccb){if(_0x5daccb){return _0x5daccb[_0x71cb('0x17')](_0x285e05)['then'](function(_0x5ea3f7){return _0x5ea3f7;});}return null;};}function removeEntity(_0x51ba08){return function(_0x3fe8d5){if(_0x3fe8d5){return _0x3fe8d5[_0x71cb('0x18')]()[_0x71cb('0x19')](function(){_0x51ba08[_0x71cb('0xf')](0xcc)[_0x71cb('0x10')]();});}};}function handleEntityNotFound(_0x3c18c1){return function(_0x333a92){if(!_0x333a92){_0x3c18c1[_0x71cb('0xe')](0x194);}return _0x333a92;};}function handleError(_0x3dfad5,_0x5acef8){_0x5acef8=_0x5acef8||0x1f4;return function(_0x161581){logger[_0x71cb('0x1a')](_0x161581[_0x71cb('0x1b')]);if(_0x161581[_0x71cb('0x1c')]){delete _0x161581[_0x71cb('0x1c')];}_0x3dfad5['status'](_0x5acef8)[_0x71cb('0x1d')](_0x161581);};}exports['index']=function(_0x163c33,_0x1ab148){var _0x4fdc00={};var _0x10d6ad=_[_0x71cb('0x1e')](db['FaxInteraction'][_0x71cb('0x1f')],function(_0x530cf1){return{'name':_0x530cf1[_0x71cb('0x20')],'type':_0x530cf1['type'][_0x71cb('0x21')]};});_0x4fdc00=qs[_0x71cb('0x22')](_0x10d6ad,_0x163c33);return interaction[_0x71cb('0x23')](_0x71cb('0x24'),_0x163c33[_0x71cb('0x25')],_0x163c33[_0x71cb('0x26')],_0x4fdc00,_0x10d6ad)[_0x71cb('0x19')](respondWithFilteredResult(_0x1ab148,_0x4fdc00))['catch'](handleError(_0x1ab148,null));};exports[_0x71cb('0x27')]=function(_0xde9a,_0x2caba2){var _0x1d1aab={'raw':![],'where':{'id':_0xde9a['params']['id']}},_0x1d2ba3={};_0x1d2ba3[_0x71cb('0x28')]=_[_0x71cb('0x29')](db['FaxInteraction'][_0x71cb('0x1f')]);_0x1d2ba3[_0x71cb('0x25')]=_[_0x71cb('0x29')](_0xde9a[_0x71cb('0x25')]);_0x1d2ba3['filters']=_[_0x71cb('0x2a')](_0x1d2ba3[_0x71cb('0x28')],_0x1d2ba3[_0x71cb('0x25')]);_0x1d1aab['attributes']=_[_0x71cb('0x2a')](_0x1d2ba3[_0x71cb('0x28')],qs[_0x71cb('0x2b')](_0xde9a[_0x71cb('0x25')][_0x71cb('0x2b')]));_0x1d1aab[_0x71cb('0x2c')]=_0x1d1aab['attributes']['length']?_0x1d1aab[_0x71cb('0x2c')]:_0x1d2ba3[_0x71cb('0x28')];if(_0xde9a[_0x71cb('0x25')][_0x71cb('0x2d')]){_0x1d1aab['include']=[{'all':!![]}];}_0x1d1aab=_[_0x71cb('0x2e')]({},_0x1d1aab,_0xde9a[_0x71cb('0x2f')]);return db[_0x71cb('0x30')][_0x71cb('0x31')](_0x1d1aab)['then'](handleEntityNotFound(_0x2caba2,null))['then'](respondWithResult(_0x2caba2,null))[_0x71cb('0x32')](handleError(_0x2caba2,null));};exports[_0x71cb('0x33')]=function(_0x162772,_0xf1d49f){return db[_0x71cb('0x30')]['create'](_0x162772[_0x71cb('0x34')],{})[_0x71cb('0x19')](respondWithResult(_0xf1d49f,0xc9))[_0x71cb('0x32')](handleError(_0xf1d49f,null));};exports['update']=function(_0x30094c,_0x274715){if(_0x30094c['body']['id']){delete _0x30094c[_0x71cb('0x34')]['id'];}return db[_0x71cb('0x30')][_0x71cb('0x31')]({'where':{'id':_0x30094c[_0x71cb('0x35')]['id']}})['then'](handleEntityNotFound(_0x274715,null))[_0x71cb('0x19')](saveUpdates(_0x30094c['body'],null))[_0x71cb('0x19')](respondWithResult(_0x274715,null))['catch'](handleError(_0x274715,null));};exports['destroy']=function(_0x539031,_0x53a00a){return db['FaxInteraction']['find']({'where':{'id':_0x539031[_0x71cb('0x35')]['id']}})[_0x71cb('0x19')](handleEntityNotFound(_0x53a00a,null))[_0x71cb('0x19')](removeEntity(_0x53a00a,null))[_0x71cb('0x32')](handleError(_0x53a00a,null));};exports['describe']=function(_0x320adb,_0x5aede1){return db[_0x71cb('0x30')][_0x71cb('0x36')]()[_0x71cb('0x19')](respondWithResult(_0x5aede1,null))[_0x71cb('0x32')](handleError(_0x5aede1,null));};exports['addMessage']=function(_0x1b2e99,_0x19fc9e){return db[_0x71cb('0x37')][_0x71cb('0x31')]({'where':{'id':_0x1b2e99[_0x71cb('0x35')]['id']}})[_0x71cb('0x19')](handleEntityNotFound(_0x19fc9e,null))[_0x71cb('0x19')](function(_0x1aee53){if(_0x1aee53){return _0x1aee53[_0x71cb('0x38')](_0x1b2e99[_0x71cb('0x34')][_0x71cb('0x39')],_[_0x71cb('0x3a')](_0x1b2e99[_0x71cb('0x34')],[_0x71cb('0x39'),'id'])||{});}})[_0x71cb('0x19')](respondWithResult(_0x19fc9e,null))[_0x71cb('0x32')](handleError(_0x19fc9e,null));};exports['getMessages']=function(_0x511215,_0x9b4850){var _0x5b2012={'raw':![],'where':{}};var _0x3970ce={};var _0x35de30={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x71cb('0x3b')]({'where':{'id':_0x511215['params']['id']}})[_0x71cb('0x19')](handleEntityNotFound(_0x9b4850,null))[_0x71cb('0x19')](function(_0x19cd3d){if(_0x19cd3d){_0x3970ce[_0x71cb('0x28')]=_['keys'](db['FaxMessage'][_0x71cb('0x1f')]);_0x3970ce[_0x71cb('0x25')]=_['keys'](_0x511215[_0x71cb('0x25')]);_0x3970ce['filters']=_[_0x71cb('0x2a')](_0x3970ce[_0x71cb('0x28')],_0x3970ce[_0x71cb('0x25')]);_0x5b2012['attributes']=_[_0x71cb('0x2a')](_0x3970ce[_0x71cb('0x28')],qs['fields'](_0x511215['query'][_0x71cb('0x2b')]));_0x5b2012[_0x71cb('0x2c')]=_0x5b2012[_0x71cb('0x2c')][_0x71cb('0x3c')]?_0x5b2012['attributes']:_0x3970ce[_0x71cb('0x28')];if(!_0x511215[_0x71cb('0x25')][_0x71cb('0x3d')](_0x71cb('0x3e'))){_0x5b2012['limit']=qs[_0x71cb('0x14')](_0x511215[_0x71cb('0x25')][_0x71cb('0x14')]);_0x5b2012[_0x71cb('0x12')]=qs[_0x71cb('0x12')](_0x511215[_0x71cb('0x25')][_0x71cb('0x12')]);}_0x5b2012[_0x71cb('0x3f')]=qs[_0x71cb('0x40')](_0x511215[_0x71cb('0x25')][_0x71cb('0x40')]);_0x5b2012[_0x71cb('0x41')]=qs[_0x71cb('0x42')](_[_0x71cb('0x43')](_0x511215[_0x71cb('0x25')],_0x3970ce['filters']));_0x5b2012[_0x71cb('0x41')][_0x71cb('0x44')]=_0x19cd3d['id'];if(_0x511215['query'][_0x71cb('0x45')]){_0x5b2012['where']=_[_0x71cb('0x2e')](_0x5b2012['where'],{'$or':_[_0x71cb('0x1e')](_0x5b2012[_0x71cb('0x2c')],function(_0x3b42b0){var _0x7dd63c={};_0x7dd63c[_0x3b42b0]={'$like':'%'+_0x511215[_0x71cb('0x25')][_0x71cb('0x45')]+'%'};return _0x7dd63c;})});}if(_0x511215[_0x71cb('0x25')]['$gte']){var _0x2d1cdc=_0x511215[_0x71cb('0x25')]['$gte'][_0x71cb('0x46')](',');var _0x5b7b31={};_0x5b7b31[_0x2d1cdc[0x0]]={'$gte':moment(_0x2d1cdc[0x1])[_0x71cb('0x47')](_0x71cb('0x48'))};_0x5b2012['where']=_[_0x71cb('0x2e')](_0x5b2012['where'],_0x5b7b31);}_0x5b2012=_['merge']({},_0x5b2012,_0x511215[_0x71cb('0x2f')]);return db[_0x71cb('0x37')]['count']({'where':_0x5b2012[_0x71cb('0x41')]})[_0x71cb('0x19')](function(_0x21fc93){_0x35de30[_0x71cb('0x15')]=_0x21fc93;if(_0x511215[_0x71cb('0x25')]['includeAll']){_0x5b2012['include']=[{'all':!![]}];}return db[_0x71cb('0x37')][_0x71cb('0x23')](_0x5b2012);})[_0x71cb('0x19')](function(_0x3a4ded){_0x35de30[_0x71cb('0x49')]=_0x3a4ded;return _0x35de30;});}})[_0x71cb('0x19')](respondWithFilteredResult(_0x9b4850,_0x5b2012))[_0x71cb('0x32')](handleError(_0x9b4850,null));};exports[_0x71cb('0x4a')]=function(_0x465f9d,_0xe1b02){return db[_0x71cb('0x30')]['find']({'where':{'id':_0x465f9d[_0x71cb('0x35')]['id']}})[_0x71cb('0x19')](handleEntityNotFound(_0xe1b02,null))['then'](function(_0x24f6d4){if(_0x24f6d4){return _0x24f6d4['setTags'](_0x465f9d['body']['ids'],_[_0x71cb('0x3a')](_0x465f9d[_0x71cb('0x34')],[_0x71cb('0x39'),'id'])||{})[_0x71cb('0x4b')](function(){return db[_0x71cb('0x4c')][_0x71cb('0x23')]({'attributes':['id',_0x71cb('0x1c'),_0x71cb('0x4d')],'where':{'id':_0x465f9d[_0x71cb('0x34')][_0x71cb('0x39')]}});})[_0x71cb('0x19')](function(_0x536c20){socket[_0x71cb('0x4e')](_0x71cb('0x4f'),{'id':Number(_0x465f9d[_0x71cb('0x35')]['id']),'tags':_0x536c20||[]});return{'id':Number(_0x465f9d[_0x71cb('0x35')]['id']),'tags':_0x536c20||[]};});}})[_0x71cb('0x19')](respondWithResult(_0xe1b02,null))[_0x71cb('0x32')](handleError(_0xe1b02,null));};exports[_0x71cb('0x50')]=function(_0x190017,_0x389f0f){return db[_0x71cb('0x30')][_0x71cb('0x31')]({'where':{'id':_0x190017[_0x71cb('0x35')]['id']}})[_0x71cb('0x19')](handleEntityNotFound(_0x389f0f,null))['then'](function(_0x1baf5d){if(_0x1baf5d){return _0x1baf5d['removeTags'](_0x190017[_0x71cb('0x25')][_0x71cb('0x39')]);}})['then'](respondWithStatusCode(_0x389f0f,null))[_0x71cb('0x32')](handleError(_0x389f0f,null));};exports[_0x71cb('0x51')]=function(_0x24520e,_0x4580a4){var _0x3f0871=moment()[_0x71cb('0x52')]()[_0x71cb('0x53')]();var _0x3a266a=path['join'](config['root'],_0x71cb('0x54'),_0x71cb('0x55'),_0x71cb('0x56'));var _0x303516=path[_0x71cb('0x57')](config['root'],'server',_0x71cb('0x55'),_0x71cb('0x58'));var _0x2528d5=path[_0x71cb('0x57')](_0x3a266a,_0x3f0871);var _0x313729=util[_0x71cb('0x47')](_0x71cb('0x59'),_0x24520e[_0x71cb('0x35')]['id'],_0x3f0871);var _0x32a1c2=path['join'](_0x3a266a,_0x313729);var _0x150801=[];_0x150801[_0x71cb('0x5a')]({'model':db[_0x71cb('0x5b')],'as':_0x71cb('0x5b'),'raw':!![]});var _0x5d79d2=[{'model':db[_0x71cb('0x37')],'as':'Messages','attributes':['id',_0x71cb('0x34'),_0x71cb('0x5c')],'include':_0x150801}];return db['FaxInteraction'][_0x71cb('0x31')]({'where':{'id':_0x24520e[_0x71cb('0x35')]['id']},'include':_0x5d79d2})['then'](handleEntityNotFound(_0x4580a4,null))['then'](function(_0x5b8e3d){if(_0x5b8e3d&&_0x5b8e3d[_0x71cb('0x5d')]){var _0x125d29=_0x5b8e3d['get']({'plain':!![]});fs[_0x71cb('0x5e')](_0x2528d5);for(var _0x5dd35f=0x0;_0x5dd35f<_0x125d29['Messages'][_0x71cb('0x3c')];_0x5dd35f++){var _0x56d206=_0x125d29[_0x71cb('0x5d')][_0x5dd35f][_0x71cb('0x5b')];if(_0x56d206){var _0x4bce77=path[_0x71cb('0x57')](_0x303516,_0x56d206[_0x71cb('0x5f')]);if(fs[_0x71cb('0x60')](_0x4bce77)){fs['createReadStream'](_0x4bce77)['pipe'](fs['createWriteStream'](path[_0x71cb('0x57')](_0x2528d5,_0x56d206['basename'])));}}}return BPromise[_0x71cb('0x61')]()[_0x71cb('0x19')](function(){return new BPromise(function(_0xaa0ab4,_0x9796b2){zipdir(_0x2528d5,{'saveTo':_0x32a1c2},function(_0x55f714,_0x1597db){if(_0x55f714)return _0x9796b2(_0x55f714);return _0xaa0ab4(_0x1597db);});})[_0x71cb('0x19')](function(){return new BPromise(function(_0x4bd98e,_0x6faa98){rimraf(_0x2528d5,function(_0x4a6513){if(_0x4a6513)_0x6faa98(_0x4a6513);return _0x4bd98e();});});})[_0x71cb('0x19')](function(){return _0x4580a4[_0x71cb('0x51')](_0x32a1c2,_0x313729,function(_0x269f66){if(_0x269f66){console[_0x71cb('0x62')](_0x71cb('0x63'),_0x269f66);}else{fs[_0x71cb('0x64')](_0x32a1c2);}});});});}else{return _0x4580a4[_0x71cb('0xe')](0xc8);}})[_0x71cb('0x32')](handleError(_0x4580a4,null));}; \ No newline at end of file +var _0xa611=['body','params','destroy','describe','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','Tag','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','FaxMessage','Messages','createdAt','get','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','model','keys','FaxInteraction','intersection','attributes','fields','length','includeAll','include','merge','find','create'];(function(_0x46f00d,_0x3667b2){var _0xb3299e=function(_0x23d2ce){while(--_0x23d2ce){_0x46f00d['push'](_0x46f00d['shift']());}};_0xb3299e(++_0x3667b2);}(_0xa611,0x17a));var _0x1a61=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa611[_0x6c993a];return _0x27f547;};'use strict';var rimraf=require(_0x1a61('0x0'));var zipdir=require(_0x1a61('0x1'));var moment=require(_0x1a61('0x2'));var BPromise=require(_0x1a61('0x3'));var util=require(_0x1a61('0x4'));var path=require(_0x1a61('0x5'));var fs=require('fs');var _=require(_0x1a61('0x6'));var Redis=require(_0x1a61('0x7'));var interaction=require(_0x1a61('0x8'));var qs=require(_0x1a61('0x9'));var logger=require(_0x1a61('0xa'))('api');var config=require(_0x1a61('0xb'));var db=require(_0x1a61('0xc'))['db'];config['redis']=_[_0x1a61('0xd')](config[_0x1a61('0xe')],{'host':_0x1a61('0xf'),'port':0x18eb});var socket=require(_0x1a61('0x10'))(new Redis(config[_0x1a61('0xe')]));require(_0x1a61('0x11'))[_0x1a61('0x12')](socket);function respondWithStatusCode(_0x10ded2,_0x2065b2){_0x2065b2=_0x2065b2||0xcc;return function(_0x38d026){if(_0x38d026){return _0x10ded2[_0x1a61('0x13')](_0x2065b2);}return _0x10ded2['status'](_0x2065b2)[_0x1a61('0x14')]();};}function respondWithResult(_0x22468c,_0x42aba8){_0x42aba8=_0x42aba8||0xc8;return function(_0x52cae5){if(_0x52cae5){return _0x22468c[_0x1a61('0x15')](_0x42aba8)[_0x1a61('0x16')](_0x52cae5);}};}function respondWithFilteredResult(_0xc374f,_0x918ffb){return function(_0x5790f7){if(_0x5790f7){var _0x84a2f6=typeof _0x918ffb[_0x1a61('0x17')]===_0x1a61('0x18')&&typeof _0x918ffb[_0x1a61('0x19')]===_0x1a61('0x18');var _0x1bdcb2=_0x5790f7[_0x1a61('0x1a')];var _0x57b580=_0x84a2f6?0x0:_0x918ffb['offset'];var _0x389b87=_0x84a2f6?_0x5790f7[_0x1a61('0x1a')]:_0x918ffb[_0x1a61('0x17')]+_0x918ffb[_0x1a61('0x19')];var _0x1b921e;if(_0x389b87>=_0x1bdcb2){_0x389b87=_0x1bdcb2;_0x1b921e=0xc8;}else{_0x1b921e=0xce;}_0xc374f[_0x1a61('0x15')](_0x1b921e);return _0xc374f['set'](_0x1a61('0x1b'),_0x57b580+'-'+_0x389b87+'/'+_0x1bdcb2)[_0x1a61('0x16')](_0x5790f7);}return null;};}function saveUpdates(_0x18bee2){return function(_0x3aed74){if(_0x3aed74){return _0x3aed74[_0x1a61('0x1c')](_0x18bee2)[_0x1a61('0x1d')](function(_0x3afeea){return _0x3afeea;});}return null;};}function removeEntity(_0x1ed882){return function(_0x555564){if(_0x555564){return _0x555564['destroy']()['then'](function(){_0x1ed882[_0x1a61('0x15')](0xcc)[_0x1a61('0x14')]();});}};}function handleEntityNotFound(_0x31707b){return function(_0xb1090a){if(!_0xb1090a){_0x31707b[_0x1a61('0x13')](0x194);}return _0xb1090a;};}function handleError(_0x450630,_0x1f1644){_0x1f1644=_0x1f1644||0x1f4;return function(_0x33b47d){logger['error'](_0x33b47d[_0x1a61('0x1e')]);if(_0x33b47d[_0x1a61('0x1f')]){delete _0x33b47d['name'];}_0x450630[_0x1a61('0x15')](_0x1f1644)[_0x1a61('0x20')](_0x33b47d);};}exports[_0x1a61('0x21')]=function(_0x78c269,_0x11279b){var _0x274207={};var _0x353043=_[_0x1a61('0x22')](db['FaxInteraction'][_0x1a61('0x23')],function(_0x3cbc3e){return{'name':_0x3cbc3e[_0x1a61('0x24')],'type':_0x3cbc3e[_0x1a61('0x25')][_0x1a61('0x26')]};});_0x274207=qs[_0x1a61('0x27')](_0x353043,_0x78c269);return interaction[_0x1a61('0x28')](_0x1a61('0x29'),_0x78c269[_0x1a61('0x2a')],_0x78c269[_0x1a61('0x2b')],_0x274207,_0x353043)[_0x1a61('0x1d')](respondWithFilteredResult(_0x11279b,_0x274207))[_0x1a61('0x2c')](handleError(_0x11279b,null));};exports[_0x1a61('0x2d')]=function(_0x414192,_0x27b5d7){var _0x3135d5={'raw':![],'where':{'id':_0x414192['params']['id']}},_0x5de6c8={};_0x5de6c8[_0x1a61('0x2e')]=_[_0x1a61('0x2f')](db[_0x1a61('0x30')][_0x1a61('0x23')]);_0x5de6c8[_0x1a61('0x2a')]=_[_0x1a61('0x2f')](_0x414192[_0x1a61('0x2a')]);_0x5de6c8['filters']=_[_0x1a61('0x31')](_0x5de6c8['model'],_0x5de6c8['query']);_0x3135d5[_0x1a61('0x32')]=_[_0x1a61('0x31')](_0x5de6c8[_0x1a61('0x2e')],qs[_0x1a61('0x33')](_0x414192['query'][_0x1a61('0x33')]));_0x3135d5[_0x1a61('0x32')]=_0x3135d5[_0x1a61('0x32')][_0x1a61('0x34')]?_0x3135d5[_0x1a61('0x32')]:_0x5de6c8[_0x1a61('0x2e')];if(_0x414192[_0x1a61('0x2a')][_0x1a61('0x35')]){_0x3135d5[_0x1a61('0x36')]=[{'all':!![]}];}_0x3135d5=_[_0x1a61('0x37')]({},_0x3135d5,_0x414192['options']);return db[_0x1a61('0x30')][_0x1a61('0x38')](_0x3135d5)[_0x1a61('0x1d')](handleEntityNotFound(_0x27b5d7,null))['then'](respondWithResult(_0x27b5d7,null))[_0x1a61('0x2c')](handleError(_0x27b5d7,null));};exports[_0x1a61('0x39')]=function(_0x2ecbc7,_0x2c9189){return db['FaxInteraction'][_0x1a61('0x39')](_0x2ecbc7['body'],{})[_0x1a61('0x1d')](respondWithResult(_0x2c9189,0xc9))[_0x1a61('0x2c')](handleError(_0x2c9189,null));};exports[_0x1a61('0x1c')]=function(_0x161b54,_0x12ecd5){if(_0x161b54['body']['id']){delete _0x161b54[_0x1a61('0x3a')]['id'];}return db[_0x1a61('0x30')]['find']({'where':{'id':_0x161b54[_0x1a61('0x3b')]['id']}})[_0x1a61('0x1d')](handleEntityNotFound(_0x12ecd5,null))[_0x1a61('0x1d')](saveUpdates(_0x161b54[_0x1a61('0x3a')],null))[_0x1a61('0x1d')](respondWithResult(_0x12ecd5,null))[_0x1a61('0x2c')](handleError(_0x12ecd5,null));};exports[_0x1a61('0x3c')]=function(_0x2bda75,_0x18a94a){return db[_0x1a61('0x30')]['find']({'where':{'id':_0x2bda75[_0x1a61('0x3b')]['id']}})[_0x1a61('0x1d')](handleEntityNotFound(_0x18a94a,null))[_0x1a61('0x1d')](removeEntity(_0x18a94a,null))[_0x1a61('0x2c')](handleError(_0x18a94a,null));};exports[_0x1a61('0x3d')]=function(_0x356287,_0x3287b5){return db[_0x1a61('0x30')][_0x1a61('0x3d')]()[_0x1a61('0x1d')](respondWithResult(_0x3287b5,null))[_0x1a61('0x2c')](handleError(_0x3287b5,null));};exports['addMessage']=function(_0xe9d1d8,_0x20a8b8){return db['FaxMessage'][_0x1a61('0x38')]({'where':{'id':_0xe9d1d8[_0x1a61('0x3b')]['id']}})['then'](handleEntityNotFound(_0x20a8b8,null))['then'](function(_0x307c1e){if(_0x307c1e){return _0x307c1e['addMessage'](_0xe9d1d8[_0x1a61('0x3a')][_0x1a61('0x3e')],_[_0x1a61('0x3f')](_0xe9d1d8['body'],['ids','id'])||{});}})[_0x1a61('0x1d')](respondWithResult(_0x20a8b8,null))['catch'](handleError(_0x20a8b8,null));};exports[_0x1a61('0x40')]=function(_0x29783a,_0x20d452){var _0x55b449={'raw':![],'where':{}};var _0x57ffa7={};var _0x5570fa={'count':0x0,'rows':[]};return db[_0x1a61('0x30')][_0x1a61('0x41')]({'where':{'id':_0x29783a[_0x1a61('0x3b')]['id']}})['then'](handleEntityNotFound(_0x20d452,null))['then'](function(_0x2d1725){if(_0x2d1725){_0x57ffa7['model']=_[_0x1a61('0x2f')](db['FaxMessage'][_0x1a61('0x23')]);_0x57ffa7[_0x1a61('0x2a')]=_['keys'](_0x29783a[_0x1a61('0x2a')]);_0x57ffa7[_0x1a61('0x42')]=_[_0x1a61('0x31')](_0x57ffa7[_0x1a61('0x2e')],_0x57ffa7[_0x1a61('0x2a')]);_0x55b449[_0x1a61('0x32')]=_[_0x1a61('0x31')](_0x57ffa7[_0x1a61('0x2e')],qs['fields'](_0x29783a[_0x1a61('0x2a')][_0x1a61('0x33')]));_0x55b449[_0x1a61('0x32')]=_0x55b449[_0x1a61('0x32')]['length']?_0x55b449['attributes']:_0x57ffa7[_0x1a61('0x2e')];if(!_0x29783a[_0x1a61('0x2a')][_0x1a61('0x43')](_0x1a61('0x44'))){_0x55b449[_0x1a61('0x19')]=qs[_0x1a61('0x19')](_0x29783a['query']['limit']);_0x55b449[_0x1a61('0x17')]=qs[_0x1a61('0x17')](_0x29783a[_0x1a61('0x2a')]['offset']);}_0x55b449['order']=qs[_0x1a61('0x45')](_0x29783a[_0x1a61('0x2a')][_0x1a61('0x45')]);_0x55b449['where']=qs['filters'](_[_0x1a61('0x46')](_0x29783a[_0x1a61('0x2a')],_0x57ffa7[_0x1a61('0x42')]));_0x55b449[_0x1a61('0x47')][_0x1a61('0x48')]=_0x2d1725['id'];if(_0x29783a[_0x1a61('0x2a')]['filter']){_0x55b449[_0x1a61('0x47')]=_[_0x1a61('0x37')](_0x55b449[_0x1a61('0x47')],{'$or':_[_0x1a61('0x22')](_0x55b449[_0x1a61('0x32')],function(_0x247642){var _0x3fa201={};_0x3fa201[_0x247642]={'$like':'%'+_0x29783a[_0x1a61('0x2a')][_0x1a61('0x49')]+'%'};return _0x3fa201;})});}if(_0x29783a[_0x1a61('0x2a')][_0x1a61('0x4a')]){var _0x4dcb97=_0x29783a[_0x1a61('0x2a')]['$gte'][_0x1a61('0x4b')](',');var _0x784013={};_0x784013[_0x4dcb97[0x0]]={'$gte':moment(_0x4dcb97[0x1])[_0x1a61('0x4c')](_0x1a61('0x4d'))};_0x55b449[_0x1a61('0x47')]=_['merge'](_0x55b449[_0x1a61('0x47')],_0x784013);}_0x55b449=_['merge']({},_0x55b449,_0x29783a[_0x1a61('0x4e')]);return db['FaxMessage']['count']({'where':_0x55b449[_0x1a61('0x47')]})[_0x1a61('0x1d')](function(_0x15014d){_0x5570fa[_0x1a61('0x1a')]=_0x15014d;if(_0x29783a[_0x1a61('0x2a')][_0x1a61('0x35')]){_0x55b449[_0x1a61('0x36')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x55b449);})[_0x1a61('0x1d')](function(_0x4b202b){_0x5570fa['rows']=_0x4b202b;return _0x5570fa;});}})[_0x1a61('0x1d')](respondWithFilteredResult(_0x20d452,_0x55b449))[_0x1a61('0x2c')](handleError(_0x20d452,null));};exports[_0x1a61('0x4f')]=function(_0x181f4f,_0x4309ca){return db[_0x1a61('0x30')]['find']({'where':{'id':_0x181f4f[_0x1a61('0x3b')]['id']}})[_0x1a61('0x1d')](handleEntityNotFound(_0x4309ca,null))[_0x1a61('0x1d')](function(_0x1fde83){if(_0x1fde83){return _0x1fde83['setTags'](_0x181f4f[_0x1a61('0x3a')][_0x1a61('0x3e')],_[_0x1a61('0x3f')](_0x181f4f[_0x1a61('0x3a')],[_0x1a61('0x3e'),'id'])||{})[_0x1a61('0x50')](function(){return db[_0x1a61('0x51')][_0x1a61('0x28')]({'attributes':['id',_0x1a61('0x1f'),'color'],'where':{'id':_0x181f4f[_0x1a61('0x3a')][_0x1a61('0x3e')]}});})[_0x1a61('0x1d')](function(_0x449e38){socket[_0x1a61('0x52')](_0x1a61('0x53'),{'id':Number(_0x181f4f[_0x1a61('0x3b')]['id']),'tags':_0x449e38||[]});return{'id':Number(_0x181f4f[_0x1a61('0x3b')]['id']),'tags':_0x449e38||[]};});}})[_0x1a61('0x1d')](respondWithResult(_0x4309ca,null))[_0x1a61('0x2c')](handleError(_0x4309ca,null));};exports['removeTags']=function(_0x25406c,_0xc9c743){return db['FaxInteraction']['find']({'where':{'id':_0x25406c[_0x1a61('0x3b')]['id']}})[_0x1a61('0x1d')](handleEntityNotFound(_0xc9c743,null))['then'](function(_0xf33767){if(_0xf33767){return _0xf33767[_0x1a61('0x54')](_0x25406c[_0x1a61('0x2a')][_0x1a61('0x3e')]);}})[_0x1a61('0x1d')](respondWithStatusCode(_0xc9c743,null))[_0x1a61('0x2c')](handleError(_0xc9c743,null));};exports['download']=function(_0x33cbe4,_0x50b18f){var _0x44d59e=moment()['unix']()[_0x1a61('0x55')]();var _0x38be4b=path[_0x1a61('0x56')](config[_0x1a61('0x57')],_0x1a61('0x58'),_0x1a61('0x59'),_0x1a61('0x5a'));var _0x35b3b9=path[_0x1a61('0x56')](config[_0x1a61('0x57')],_0x1a61('0x58'),'files',_0x1a61('0x5b'));var _0x34338e=path[_0x1a61('0x56')](_0x38be4b,_0x44d59e);var _0x4bca7d=util[_0x1a61('0x4c')](_0x1a61('0x5c'),_0x33cbe4['params']['id'],_0x44d59e);var _0x52c8d5=path[_0x1a61('0x56')](_0x38be4b,_0x4bca7d);var _0x8975df=[];_0x8975df[_0x1a61('0x5d')]({'model':db[_0x1a61('0x5e')],'as':_0x1a61('0x5e'),'raw':!![]});var _0x1e0ea0=[{'model':db[_0x1a61('0x5f')],'as':_0x1a61('0x60'),'attributes':['id','body',_0x1a61('0x61')],'include':_0x8975df}];return db[_0x1a61('0x30')][_0x1a61('0x38')]({'where':{'id':_0x33cbe4['params']['id']},'include':_0x1e0ea0})['then'](handleEntityNotFound(_0x50b18f,null))[_0x1a61('0x1d')](function(_0x3a6c60){if(_0x3a6c60&&_0x3a6c60[_0x1a61('0x60')]){var _0x15bbb9=_0x3a6c60[_0x1a61('0x62')]({'plain':!![]});fs['mkdirSync'](_0x34338e);for(var _0x982921=0x0;_0x982921<_0x15bbb9[_0x1a61('0x60')][_0x1a61('0x34')];_0x982921++){var _0x25942b=_0x15bbb9[_0x1a61('0x60')][_0x982921]['Attachment'];if(_0x25942b){var _0xf19e0=path[_0x1a61('0x56')](_0x35b3b9,_0x25942b['basename']);if(fs[_0x1a61('0x63')](_0xf19e0)){fs[_0x1a61('0x64')](_0xf19e0)[_0x1a61('0x65')](fs[_0x1a61('0x66')](path[_0x1a61('0x56')](_0x34338e,_0x25942b[_0x1a61('0x67')])));}}}return BPromise[_0x1a61('0x68')]()[_0x1a61('0x1d')](function(){return new BPromise(function(_0x547bb0,_0x1c6562){zipdir(_0x34338e,{'saveTo':_0x52c8d5},function(_0x2ff925,_0x5da659){if(_0x2ff925)return _0x1c6562(_0x2ff925);return _0x547bb0(_0x5da659);});})[_0x1a61('0x1d')](function(){return new BPromise(function(_0x15796b,_0x552cd0){rimraf(_0x34338e,function(_0x2034b9){if(_0x2034b9)_0x552cd0(_0x2034b9);return _0x15796b();});});})['then'](function(){return _0x50b18f[_0x1a61('0x69')](_0x52c8d5,_0x4bca7d,function(_0x563f18){if(_0x563f18){console[_0x1a61('0x6a')](_0x1a61('0x6b'),_0x563f18);}else{fs[_0x1a61('0x6c')](_0x52c8d5);}});});});}else{return _0x50b18f[_0x1a61('0x13')](0xc8);}})[_0x1a61('0x2c')](handleError(_0x50b18f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 10c2a7a..4e03fbf 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 _0xd1a9=['setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','getUsers','then','map','findAll'];(function(_0x3502a7,_0x5d7e36){var _0x2d81c2=function(_0x2a277c){while(--_0x2a277c){_0x3502a7['push'](_0x3502a7['shift']());}};_0x2d81c2(++_0x5d7e36);}(_0xd1a9,0x1d2));var _0x9d1a=function(_0x48fa3f,_0x700760){_0x48fa3f=_0x48fa3f-0x0;var _0x16037d=_0xd1a9[_0x48fa3f];return _0x16037d;};'use strict';var EventEmitter=require(_0x9d1a('0x0'));var FaxInteraction=require(_0x9d1a('0x1'))['db'][_0x9d1a('0x2')];var FaxMessage=require(_0x9d1a('0x1'))['db'][_0x9d1a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9d1a('0x4')](0x0);var events={'afterCreate':_0x9d1a('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x43d665){return function(_0x10ed39,_0x5eb4c7,_0x15b9dc){_0x10ed39[_0x9d1a('0x6')]({'attributes':['id'],'raw':!![]})[_0x9d1a('0x7')](function(_0x10cc52){_0x10ed39['setDataValue']('Users',_0x10cc52[_0x9d1a('0x8')](function(_0xb5ffe1){return{'id':_0xb5ffe1['id']};}));return FaxMessage[_0x9d1a('0x9')]({'where':{'FaxInteractionId':_0x10ed39['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9d1a('0x7')](function(_0x4cf26b){_0x10ed39[_0x9d1a('0xa')](_0x9d1a('0xb'),_0x4cf26b[_0x9d1a('0xc')]);FaxInteractionEvents[_0x9d1a('0xd')](_0x43d665+':'+_0x10ed39['id'],_0x10ed39);FaxInteractionEvents[_0x9d1a('0xd')](_0x43d665,_0x10ed39);_0x15b9dc(null);})[_0x9d1a('0xe')](_0x15b9dc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x9d1a('0xf')](e,emitEvent(event));}}module[_0x9d1a('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x2cae=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove'];(function(_0x520138,_0x28b48e){var _0x46b0bf=function(_0x13798e){while(--_0x13798e){_0x520138['push'](_0x520138['shift']());}};_0x46b0bf(++_0x28b48e);}(_0x2cae,0x12a));var _0xe2ca=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x2cae[_0x4ca6a4];return _0x120555;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xe2ca('0x0'))['db'][_0xe2ca('0x1')];var FaxMessage=require(_0xe2ca('0x0'))['db'][_0xe2ca('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe2ca('0x3')](0x0);var events={'afterCreate':_0xe2ca('0x4'),'afterUpdate':'update','afterDestroy':_0xe2ca('0x5')};function emitEvent(_0x21c866){return function(_0x3bd926,_0x3c79b8,_0xa97ec3){_0x3bd926[_0xe2ca('0x6')]({'attributes':['id'],'raw':!![]})[_0xe2ca('0x7')](function(_0x159645){_0x3bd926[_0xe2ca('0x8')](_0xe2ca('0x9'),_0x159645[_0xe2ca('0xa')](function(_0x2df761){return{'id':_0x2df761['id']};}));return FaxMessage[_0xe2ca('0xb')]({'where':{'FaxInteractionId':_0x3bd926['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe2ca('0x7')](function(_0x1ffd20){_0x3bd926[_0xe2ca('0x8')](_0xe2ca('0xc'),_0x1ffd20['length']);FaxInteractionEvents['emit'](_0x21c866+':'+_0x3bd926['id'],_0x3bd926);FaxInteractionEvents[_0xe2ca('0xd')](_0x21c866,_0x3bd926);_0xa97ec3(null);})['catch'](_0xa97ec3(null));};}for(var e in events){if(events[_0xe2ca('0xe')](e)){var event=events[e];FaxInteraction[_0xe2ca('0xf')](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 030c236..4836d1e 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 _0x6d38=['changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction'];(function(_0x3bb76a,_0x34569d){var _0x3ad3ee=function(_0x316930){while(--_0x316930){_0x3bb76a['push'](_0x3bb76a['shift']());}};_0x3ad3ee(++_0x34569d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x552b07,_0x2aea31,_0x3ab01e){if(_0x552b07[_0x86d3('0x9')]('closed')){_0x552b07['closedAt']=moment()[_0x86d3('0xa')](_0x86d3('0xb'));}_0x3ab01e(null,_0x552b07);}}});}; \ No newline at end of file +var _0x9a55=['../../config/environment','exports','define','FaxInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise'];(function(_0x831028,_0x427138){var _0x53bd98=function(_0x2e9c97){while(--_0x2e9c97){_0x831028['push'](_0x831028['shift']());}};_0x53bd98(++_0x427138);}(_0x9a55,0xe2));var _0x59a5=function(_0x1657f8,_0x4edac6){_0x1657f8=_0x1657f8-0x0;var _0x4137be=_0x9a55[_0x1657f8];return _0x4137be;};'use strict';var _=require(_0x59a5('0x0'));var util=require('util');var logger=require(_0x59a5('0x1'))(_0x59a5('0x2'));var moment=require(_0x59a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x59a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59a5('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x59a5('0x6')]=function(_0x2c5bfd,_0xef3fda){return _0x2c5bfd[_0x59a5('0x7')](_0x59a5('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x491d2d,_0x299dfa,_0x481be7){if(_0x491d2d['changed']('closed')){_0x491d2d[_0x59a5('0x9')]=moment()['format'](_0x59a5('0xa'));}_0x481be7(null,_0x491d2d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 77f7a69..9537a27 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 _0xa1df=['socket.io-emitter','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','then','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa1df,0x1bb));var _0xfa1d=function(_0x45d5c5,_0x109612){_0x45d5c5=_0x45d5c5-0x0;var _0x3a8401=_0xa1df[_0x45d5c5];return _0x3a8401;};'use strict';var _=require(_0xfa1d('0x0'));var util=require('util');var moment=require(_0xfa1d('0x1'));var BPromise=require(_0xfa1d('0x2'));var rs=require(_0xfa1d('0x3'));var fs=require('fs');var Redis=require(_0xfa1d('0x4'));var db=require(_0xfa1d('0x5'))['db'];var utils=require(_0xfa1d('0x6'));var logger=require(_0xfa1d('0x7'))(_0xfa1d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa1d('0x9')][_0xfa1d('0xa')]({'port':0x232a});config[_0xfa1d('0xb')]=_['defaults'](config[_0xfa1d('0xb')],{'host':_0xfa1d('0xc'),'port':0x18eb});var socket=require(_0xfa1d('0xd'))(new Redis(config[_0xfa1d('0xb')]));require('./faxInteraction.socket')[_0xfa1d('0xe')](socket);function respondWithRpcPromise(_0x43c125,_0x51bfee,_0x19a499){return new BPromise(function(_0xa3bc91,_0x31c6c4){return client[_0xfa1d('0xf')](_0x43c125,_0x19a499)['then'](function(_0x3c1aaf){logger[_0xfa1d('0x10')](_0xfa1d('0x11'),_0x51bfee,_0xfa1d('0x12'));logger[_0xfa1d('0x13')](_0xfa1d('0x14'),_0x51bfee,_0xfa1d('0x12'),JSON[_0xfa1d('0x15')](_0x3c1aaf));if(_0x3c1aaf[_0xfa1d('0x16')]){if(_0x3c1aaf[_0xfa1d('0x16')][_0xfa1d('0x17')]===0x1f4){logger[_0xfa1d('0x16')](_0xfa1d('0x11'),_0x51bfee,_0x3c1aaf[_0xfa1d('0x16')][_0xfa1d('0x18')]);return _0x31c6c4(_0x3c1aaf[_0xfa1d('0x16')]['message']);}logger[_0xfa1d('0x16')](_0xfa1d('0x11'),_0x51bfee,_0x3c1aaf[_0xfa1d('0x16')]['message']);return _0xa3bc91(_0x3c1aaf['error'][_0xfa1d('0x18')]);}else{logger[_0xfa1d('0x10')](_0xfa1d('0x11'),_0x51bfee,_0xfa1d('0x12'));_0xa3bc91(_0x3c1aaf[_0xfa1d('0x19')]['message']);}})[_0xfa1d('0x1a')](function(_0x3388f8){logger[_0xfa1d('0x16')](_0xfa1d('0x11'),_0x51bfee,_0x3388f8);_0x31c6c4(_0x3388f8);});});}exports[_0xfa1d('0x1b')]=function(_0x53f5f6){var _0x354e22=this;return new Promise(function(_0x554f36,_0x3ad7d3){return db[_0xfa1d('0x1c')][_0xfa1d('0x1d')](_0x53f5f6[_0xfa1d('0x1e')],{'raw':_0x53f5f6['options']?_0x53f5f6[_0xfa1d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f5f6['options']?_0x53f5f6[_0xfa1d('0x1f')][_0xfa1d('0x20')]||null:null,'attributes':_0x53f5f6[_0xfa1d('0x1f')]?_0x53f5f6[_0xfa1d('0x1f')][_0xfa1d('0x21')]||null:null,'limit':_0x53f5f6[_0xfa1d('0x1f')]?_0x53f5f6[_0xfa1d('0x1f')][_0xfa1d('0x22')]||null:null})['then'](function(_0x366019){logger[_0xfa1d('0x10')](_0xfa1d('0x1b'),_0x53f5f6);logger['debug'](_0xfa1d('0x1b'),_0x53f5f6,JSON[_0xfa1d('0x15')](_0x366019));_0x554f36(_0x366019);})[_0xfa1d('0x1a')](function(_0x3173ef){logger[_0xfa1d('0x16')](_0xfa1d('0x1b'),_0x3173ef[_0xfa1d('0x18')],_0x53f5f6);_0x3ad7d3(_0x354e22[_0xfa1d('0x16')](0x1f4,_0x3173ef[_0xfa1d('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1c0381){return new Promise(function(_0x12a52a,_0x1dcbb3){return db[_0xfa1d('0x1c')]['find']({'where':_0x1c0381[_0xfa1d('0x1f')]?_0x1c0381['options'][_0xfa1d('0x20')]||null:null})[_0xfa1d('0x23')](function(_0x5857cd){if(_0x5857cd){return _0x5857cd['addTags'](_0x1c0381[_0xfa1d('0x1e')][_0xfa1d('0x24')],_['omit'](_0x1c0381[_0xfa1d('0x1e')],[_0xfa1d('0x24'),'id'])||{});}})['spread'](function(_0x260b59){logger['info'](_0xfa1d('0x25'),_0x1c0381);logger[_0xfa1d('0x13')](_0xfa1d('0x25'),_0x1c0381,JSON['stringify'](_0x260b59));_0x12a52a(_0x260b59);})[_0xfa1d('0x1a')](function(_0xbcb82b){logger[_0xfa1d('0x16')]('AddTags',_0xbcb82b['message'],_0x1c0381);_0x1dcbb3(_this[_0xfa1d('0x16')](0x1f4,_0xbcb82b[_0xfa1d('0x18')]));});});}; \ No newline at end of file +var _0x274c=['message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s'];(function(_0x494452,_0x5b9635){var _0x456e08=function(_0xf79cd4){while(--_0xf79cd4){_0x494452['push'](_0x494452['shift']());}};_0x456e08(++_0x5b9635);}(_0x274c,0xf3));var _0xc274=function(_0x18546c,_0x4daf94){_0x18546c=_0x18546c-0x0;var _0x46ef43=_0x274c[_0x18546c];return _0x46ef43;};'use strict';var _=require(_0xc274('0x0'));var util=require(_0xc274('0x1'));var moment=require(_0xc274('0x2'));var BPromise=require(_0xc274('0x3'));var rs=require(_0xc274('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc274('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc274('0x6'));var config=require(_0xc274('0x7'));var jayson=require(_0xc274('0x8'));var client=jayson[_0xc274('0x9')][_0xc274('0xa')]({'port':0x232a});config[_0xc274('0xb')]=_[_0xc274('0xc')](config[_0xc274('0xb')],{'host':_0xc274('0xd'),'port':0x18eb});var socket=require(_0xc274('0xe'))(new Redis(config['redis']));require(_0xc274('0xf'))[_0xc274('0x10')](socket);function respondWithRpcPromise(_0x1bf810,_0x5a5a97,_0x45f05c){return new BPromise(function(_0x39ee32,_0x7080ca){return client[_0xc274('0x11')](_0x1bf810,_0x45f05c)[_0xc274('0x12')](function(_0x30fb49){logger[_0xc274('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5a5a97,_0xc274('0x14'));logger[_0xc274('0x15')](_0xc274('0x16'),_0x5a5a97,'request\x20sent',JSON[_0xc274('0x17')](_0x30fb49));if(_0x30fb49[_0xc274('0x18')]){if(_0x30fb49[_0xc274('0x18')][_0xc274('0x19')]===0x1f4){logger[_0xc274('0x18')](_0xc274('0x1a'),_0x5a5a97,_0x30fb49[_0xc274('0x18')][_0xc274('0x1b')]);return _0x7080ca(_0x30fb49[_0xc274('0x18')][_0xc274('0x1b')]);}logger[_0xc274('0x18')](_0xc274('0x1a'),_0x5a5a97,_0x30fb49[_0xc274('0x18')][_0xc274('0x1b')]);return _0x39ee32(_0x30fb49[_0xc274('0x18')][_0xc274('0x1b')]);}else{logger['info'](_0xc274('0x1a'),_0x5a5a97,_0xc274('0x14'));_0x39ee32(_0x30fb49[_0xc274('0x1c')]['message']);}})[_0xc274('0x1d')](function(_0x5abfa3){logger[_0xc274('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5a5a97,_0x5abfa3);_0x7080ca(_0x5abfa3);});});}exports[_0xc274('0x1e')]=function(_0x5357af){var _0x1588fc=this;return new Promise(function(_0x4235ea,_0x5ae166){return db[_0xc274('0x1f')][_0xc274('0x20')](_0x5357af[_0xc274('0x21')],{'raw':_0x5357af[_0xc274('0x22')]?_0x5357af[_0xc274('0x22')][_0xc274('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5357af[_0xc274('0x22')]?_0x5357af['options'][_0xc274('0x24')]||null:null,'attributes':_0x5357af['options']?_0x5357af[_0xc274('0x22')][_0xc274('0x25')]||null:null,'limit':_0x5357af[_0xc274('0x22')]?_0x5357af[_0xc274('0x22')][_0xc274('0x26')]||null:null})['then'](function(_0x3ccc93){logger[_0xc274('0x13')]('UpdateFaxInteraction',_0x5357af);logger[_0xc274('0x15')](_0xc274('0x1e'),_0x5357af,JSON[_0xc274('0x17')](_0x3ccc93));_0x4235ea(_0x3ccc93);})[_0xc274('0x1d')](function(_0x480188){logger[_0xc274('0x18')](_0xc274('0x1e'),_0x480188[_0xc274('0x1b')],_0x5357af);_0x5ae166(_0x1588fc[_0xc274('0x18')](0x1f4,_0x480188[_0xc274('0x1b')]));});});};exports[_0xc274('0x27')]=function(_0x4b3ef6){return new Promise(function(_0x2056cb,_0x475a60){return db[_0xc274('0x1f')][_0xc274('0x28')]({'where':_0x4b3ef6['options']?_0x4b3ef6[_0xc274('0x22')][_0xc274('0x24')]||null:null})['then'](function(_0x5a552c){if(_0x5a552c){return _0x5a552c[_0xc274('0x29')](_0x4b3ef6[_0xc274('0x21')][_0xc274('0x2a')],_['omit'](_0x4b3ef6[_0xc274('0x21')],['ids','id'])||{});}})[_0xc274('0x2b')](function(_0x3715bc){logger['info'](_0xc274('0x2c'),_0x4b3ef6);logger[_0xc274('0x15')](_0xc274('0x2c'),_0x4b3ef6,JSON[_0xc274('0x17')](_0x3715bc));_0x2056cb(_0x3715bc);})[_0xc274('0x1d')](function(_0x2b607c){logger[_0xc274('0x18')](_0xc274('0x2c'),_0x2b607c['message'],_0x4b3ef6);_0x475a60(_this[_0xc274('0x18')](0x1f4,_0x2b607c[_0xc274('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 133f15d..c5575b6 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 _0xf739=['length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register'];(function(_0x4414e0,_0x165cec){var _0x4b714e=function(_0x12ad6d){while(--_0x12ad6d){_0x4414e0['push'](_0x4414e0['shift']());}};_0x4b714e(++_0x165cec);}(_0xf739,0x9a));var _0x9f73=function(_0x55df0b,_0x166a76){_0x55df0b=_0x55df0b-0x0;var _0x582dfb=_0xf739[_0x55df0b];return _0x582dfb;};'use strict';var FaxInteractionEvents=require(_0x9f73('0x0'));var events=[_0x9f73('0x1'),_0x9f73('0x2'),_0x9f73('0x3')];function createListener(_0x3229d6,_0xc8566a){return function(_0x1a977b){_0xc8566a['emit'](_0x3229d6,_0x1a977b);};}function removeListener(_0x59693a,_0x44d7e8){return function(){FaxInteractionEvents[_0x9f73('0x4')](_0x59693a,_0x44d7e8);};}exports[_0x9f73('0x5')]=function(_0x18f532){for(var _0x42f1b2=0x0,_0xad3b7c=events[_0x9f73('0x6')];_0x42f1b2<_0xad3b7c;_0x42f1b2++){var _0x3025b1=events[_0x42f1b2];var _0x4932a2=createListener(_0x9f73('0x7')+_0x3025b1,_0x18f532);FaxInteractionEvents['on'](_0x3025b1,_0x4932a2);}}; \ No newline at end of file +var _0x5979=['removeListener','register','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x2f0f9d,_0x2adf2e){var _0x1bfbb4=function(_0x1520a6){while(--_0x1520a6){_0x2f0f9d['push'](_0x2f0f9d['shift']());}};_0x1bfbb4(++_0x2adf2e);}(_0x5979,0x6c));var _0x9597=function(_0x26bf1e,_0x3587c3){_0x26bf1e=_0x26bf1e-0x0;var _0x3f6b80=_0x5979[_0x26bf1e];return _0x3f6b80;};'use strict';var FaxInteractionEvents=require(_0x9597('0x0'));var events=[_0x9597('0x1'),'remove',_0x9597('0x2')];function createListener(_0x25f9db,_0xe3ac37){return function(_0xf98e2){_0xe3ac37[_0x9597('0x3')](_0x25f9db,_0xf98e2);};}function removeListener(_0x144245,_0x2d6b62){return function(){FaxInteractionEvents[_0x9597('0x4')](_0x144245,_0x2d6b62);};}exports[_0x9597('0x5')]=function(_0x3fe05f){for(var _0x3b5da0=0x0,_0x18bd65=events['length'];_0x3b5da0<_0x18bd65;_0x3b5da0++){var _0xbc25e6=events[_0x3b5da0];var _0x4c323e=createListener(_0x9597('0x6')+_0xbc25e6,_0x3fe05f);FaxInteractionEvents['on'](_0xbc25e6,_0x4c323e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8b21e07..7ff8917 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 _0x3a43=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','tracked','fax','addTags','put','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x3a43,0x197));var _0x33a4=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x3a43[_0x43f881];return _0x365c14;};'use strict';var multer=require(_0x33a4('0x0'));var util=require(_0x33a4('0x1'));var path=require(_0x33a4('0x2'));var timeout=require(_0x33a4('0x3'));var express=require(_0x33a4('0x4'));var router=express['Router']();var fs_extra=require(_0x33a4('0x5'));var auth=require(_0x33a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x33a4('0x7'));var controller=require(_0x33a4('0x8'));router[_0x33a4('0x9')]('/',auth[_0x33a4('0xa')](),controller[_0x33a4('0xb')]);router[_0x33a4('0x9')](_0x33a4('0xc'),auth[_0x33a4('0xa')](),controller[_0x33a4('0xd')]);router[_0x33a4('0x9')](_0x33a4('0xe'),auth[_0x33a4('0xa')](),controller[_0x33a4('0xf')]);router[_0x33a4('0x9')](_0x33a4('0x10'),auth[_0x33a4('0xa')](),controller['getMessages']);router['get'](_0x33a4('0x11'),auth[_0x33a4('0xa')](),controller[_0x33a4('0x12')]);router['post']('/',auth[_0x33a4('0xa')](),controller[_0x33a4('0x13')]);router[_0x33a4('0x14')](_0x33a4('0x10'),auth[_0x33a4('0xa')](),controller[_0x33a4('0x15')]);router[_0x33a4('0x14')]('/:id/tags',auth[_0x33a4('0xa')](),interaction[_0x33a4('0x16')](_0x33a4('0x17'),'faxinteraction:addtags'),controller[_0x33a4('0x18')]);router[_0x33a4('0x19')](_0x33a4('0xe'),auth[_0x33a4('0xa')](),interaction[_0x33a4('0x16')](_0x33a4('0x17'),'faxinteraction:update'),controller['update']);router[_0x33a4('0x1a')](_0x33a4('0xe'),auth[_0x33a4('0xa')](),interaction['tracked'](_0x33a4('0x17'),_0x33a4('0x1b')),controller[_0x33a4('0x1c')]);router[_0x33a4('0x1a')](_0x33a4('0x1d'),auth['isAuthenticated'](),controller[_0x33a4('0x1e')]);module[_0x33a4('0x1f')]=router; \ No newline at end of file +var _0xec47=['faxinteraction:addtags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','fax'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xec47,0x170));var _0x7ec4=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xec47[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x7ec4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ec4('0x1'));var express=require(_0x7ec4('0x2'));var router=express[_0x7ec4('0x3')]();var fs_extra=require(_0x7ec4('0x4'));var auth=require(_0x7ec4('0x5'));var interaction=require(_0x7ec4('0x6'));var config=require(_0x7ec4('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7ec4('0x8')]);router[_0x7ec4('0x9')](_0x7ec4('0xa'),auth[_0x7ec4('0xb')](),controller[_0x7ec4('0xc')]);router[_0x7ec4('0x9')](_0x7ec4('0xd'),auth[_0x7ec4('0xb')](),controller['show']);router[_0x7ec4('0x9')]('/:id/messages',auth[_0x7ec4('0xb')](),controller[_0x7ec4('0xe')]);router[_0x7ec4('0x9')](_0x7ec4('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x7ec4('0x10')]('/',auth[_0x7ec4('0xb')](),controller['create']);router['post'](_0x7ec4('0x11'),auth[_0x7ec4('0xb')](),controller[_0x7ec4('0x12')]);router[_0x7ec4('0x10')](_0x7ec4('0x13'),auth[_0x7ec4('0xb')](),interaction[_0x7ec4('0x14')](_0x7ec4('0x15'),_0x7ec4('0x16')),controller['addTags']);router['put']('/:id',auth[_0x7ec4('0xb')](),interaction[_0x7ec4('0x14')](_0x7ec4('0x15'),_0x7ec4('0x17')),controller[_0x7ec4('0x18')]);router[_0x7ec4('0x19')](_0x7ec4('0xd'),auth[_0x7ec4('0xb')](),interaction[_0x7ec4('0x14')](_0x7ec4('0x15'),_0x7ec4('0x1a')),controller[_0x7ec4('0x1b')]);router[_0x7ec4('0x19')](_0x7ec4('0x13'),auth[_0x7ec4('0xb')](),controller[_0x7ec4('0x1c')]);module[_0x7ec4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c1179c7..a0c591f 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 _0xfd28=['exports','TEXT','BOOLEAN','out'];(function(_0x5e95cf,_0x17cb52){var _0x1603fa=function(_0x591fb2){while(--_0x591fb2){_0x5e95cf['push'](_0x5e95cf['shift']());}};_0x1603fa(++_0x17cb52);}(_0xfd28,0x148));var _0x8fd2=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfd28[_0x1e9424];return _0x1bd96c;};'use strict';var Sequelize=require('sequelize');module[_0x8fd2('0x0')]={'body':{'type':Sequelize[_0x8fd2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8fd2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8fd2('0x3')),'defaultValue':_0x8fd2('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8fd2('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7a2c=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xa22981,_0x2a7cc8){var _0x425b3c=function(_0x5c825b){while(--_0x5c825b){_0xa22981['push'](_0xa22981['shift']());}};_0x425b3c(++_0x2a7cc8);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x4ad952,_0x5c900e){_0x4ad952=_0x4ad952-0x0;var _0x3aa752=_0x7a2c[_0x4ad952];return _0x3aa752;};'use strict';var Sequelize=require(_0xc7a2('0x0'));module['exports']={'body':{'type':Sequelize[_0xc7a2('0x1')](_0xc7a2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc7a2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc7a2('0x4')]('in',_0xc7a2('0x5')),'defaultValue':_0xc7a2('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc7a2('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc7a2('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 4cfb2c5..97cd16c 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 _0x8158=['where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','body','destroy','describe','fax-interactions','accept','read','readAt','format','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','fax','FaxInteractionId','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','join','root','server','attachments','Attachment','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','stack','name','send','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x8158,0xc8));var _0x8815=function(_0x153e9f,_0x2033be){_0x153e9f=_0x153e9f-0x0;var _0x482713=_0x8158[_0x153e9f];return _0x482713;};'use strict';var emlformat=require(_0x8815('0x0'));var rimraf=require(_0x8815('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8815('0x2'));var rp=require(_0x8815('0x3'));var moment=require(_0x8815('0x4'));var BPromise=require(_0x8815('0x5'));var Mustache=require(_0x8815('0x6'));var util=require(_0x8815('0x7'));var path=require('path');var sox=require(_0x8815('0x8'));var csv=require(_0x8815('0x9'));var ejs=require(_0x8815('0xa'));var fs=require('fs');var fs_extra=require(_0x8815('0xb'));var _=require('lodash');var squel=require(_0x8815('0xc'));var crypto=require(_0x8815('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8815('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8815('0xf'));var Papa=require('papaparse');var Redis=require(_0x8815('0x10'));var authService=require(_0x8815('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8815('0x12'));var hardwareService=require(_0x8815('0x13'));var logger=require(_0x8815('0x14'))(_0x8815('0x15'));var utils=require(_0x8815('0x16'));var config=require(_0x8815('0x17'));var licenseUtil=require(_0x8815('0x18'));var db=require(_0x8815('0x19'))['db'];config[_0x8815('0x1a')]=_['defaults'](config[_0x8815('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8815('0x1b'))(new Redis(config[_0x8815('0x1a')]));require(_0x8815('0x1c'))[_0x8815('0x1d')](socket);var jayson=require(_0x8815('0x1e'));var client=jayson[_0x8815('0x1f')][_0x8815('0x20')]({'port':0x232c});var client9002=jayson[_0x8815('0x1f')][_0x8815('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1d6908,_0x5b2bc0,_0x209369,_0x2fd737){return new BPromise(function(_0x428ebd,_0x192b08){var _0x3f97b5=_0x2fd737||client;return _0x3f97b5[_0x8815('0x21')](_0x1d6908,_0x209369)[_0x8815('0x22')](function(_0x1812a0){logger[_0x8815('0x23')](_0x8815('0x24'),_0x5b2bc0,_0x8815('0x25'));logger[_0x8815('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5b2bc0,_0x8815('0x25'),JSON[_0x8815('0x27')](_0x1812a0));if(_0x1812a0[_0x8815('0x28')]){if(_0x1812a0[_0x8815('0x28')][_0x8815('0x29')]===0x1f4){logger['error'](_0x8815('0x24'),_0x5b2bc0,_0x1812a0[_0x8815('0x28')]['message']);return _0x192b08(_0x1812a0[_0x8815('0x28')][_0x8815('0x2a')]);}logger[_0x8815('0x28')]('FaxMessage,\x20%s,\x20%s',_0x5b2bc0,_0x1812a0[_0x8815('0x28')][_0x8815('0x2a')]);return _0x428ebd(_0x1812a0['error']['message']);}else{logger[_0x8815('0x23')](_0x8815('0x24'),_0x5b2bc0,_0x8815('0x25'));_0x428ebd(_0x1812a0[_0x8815('0x2b')][_0x8815('0x2a')]);}})[_0x8815('0x2c')](function(_0x4a8a74){logger['error'](_0x8815('0x24'),_0x5b2bc0,_0x4a8a74);_0x192b08(_0x4a8a74);});});}function respondWithStatusCode(_0x1ebe83,_0x5a6fbf){_0x5a6fbf=_0x5a6fbf||0xcc;return function(_0x359b35){if(_0x359b35){return _0x1ebe83[_0x8815('0x2d')](_0x5a6fbf);}return _0x1ebe83[_0x8815('0x2e')](_0x5a6fbf)[_0x8815('0x2f')]();};}function respondWithResult(_0x4ef120,_0x25a8df){_0x25a8df=_0x25a8df||0xc8;return function(_0x48bfdd){if(_0x48bfdd){return _0x4ef120[_0x8815('0x2e')](_0x25a8df)[_0x8815('0x30')](_0x48bfdd);}};}function respondWithFilteredResult(_0x2d7671,_0x23ebf4){return function(_0x14911c){if(_0x14911c){var _0x456f45=typeof _0x23ebf4['offset']===_0x8815('0x31')&&typeof _0x23ebf4['limit']==='undefined';var _0x3c3d96=_0x14911c[_0x8815('0x32')];var _0x2bdc0c=_0x456f45?0x0:_0x23ebf4[_0x8815('0x33')];var _0x7e4f89=_0x456f45?_0x14911c['count']:_0x23ebf4[_0x8815('0x33')]+_0x23ebf4[_0x8815('0x34')];var _0x5a14c4;if(_0x7e4f89>=_0x3c3d96){_0x7e4f89=_0x3c3d96;_0x5a14c4=0xc8;}else{_0x5a14c4=0xce;}_0x2d7671['status'](_0x5a14c4);return _0x2d7671['set'](_0x8815('0x35'),_0x2bdc0c+'-'+_0x7e4f89+'/'+_0x3c3d96)[_0x8815('0x30')](_0x14911c);}return null;};}function patchUpdates(_0xc6c8ae){return function(_0x58e813){try{jsonpatch[_0x8815('0x36')](_0x58e813,_0xc6c8ae,!![]);}catch(_0x2fd8f8){return BPromise[_0x8815('0x37')](_0x2fd8f8);}return _0x58e813['save']();};}function saveUpdates(_0x5875ef,_0x2b522d){return function(_0x19d50d){if(_0x19d50d){return _0x19d50d[_0x8815('0x38')](_0x5875ef)[_0x8815('0x22')](function(_0x3b3c5a){return _0x3b3c5a;});}return null;};}function removeEntity(_0x320d57,_0x84738f){return function(_0x1ade9c){if(_0x1ade9c){return _0x1ade9c['destroy']()[_0x8815('0x22')](function(){_0x320d57[_0x8815('0x2e')](0xcc)[_0x8815('0x2f')]();});}};}function handleEntityNotFound(_0x38db55,_0x59b02c){return function(_0x371bfc){if(!_0x371bfc){_0x38db55[_0x8815('0x2d')](0x194);}return _0x371bfc;};}function handleError(_0x29c0f6,_0x20f507){_0x20f507=_0x20f507||0x1f4;return function(_0x10dc73){logger[_0x8815('0x28')](_0x10dc73[_0x8815('0x39')]);if(_0x10dc73[_0x8815('0x3a')]){delete _0x10dc73['name'];}_0x29c0f6[_0x8815('0x2e')](_0x20f507)[_0x8815('0x3b')](_0x10dc73);};}exports['index']=function(_0x19211e,_0x4b59a5){var _0x187d97={},_0x288630={},_0x28022f={'count':0x0,'rows':[]};var _0x34c606=_['map'](db[_0x8815('0x3c')][_0x8815('0x3d')],function(_0x56cfee){return{'name':_0x56cfee[_0x8815('0x3e')],'type':_0x56cfee[_0x8815('0x3f')][_0x8815('0x40')]};});_0x288630[_0x8815('0x41')]=_[_0x8815('0x42')](_0x34c606,_0x8815('0x3a'));_0x288630[_0x8815('0x43')]=_[_0x8815('0x44')](_0x19211e[_0x8815('0x43')]);_0x288630['filters']=_['intersection'](_0x288630[_0x8815('0x41')],_0x288630[_0x8815('0x43')]);_0x187d97['attributes']=_[_0x8815('0x45')](_0x288630[_0x8815('0x41')],qs[_0x8815('0x46')](_0x19211e[_0x8815('0x43')]['fields']));_0x187d97[_0x8815('0x47')]=_0x187d97[_0x8815('0x47')][_0x8815('0x48')]?_0x187d97[_0x8815('0x47')]:_0x288630[_0x8815('0x41')];if(!_0x19211e['query']['hasOwnProperty'](_0x8815('0x49'))){_0x187d97[_0x8815('0x34')]=qs[_0x8815('0x34')](_0x19211e[_0x8815('0x43')][_0x8815('0x34')]);_0x187d97[_0x8815('0x33')]=qs[_0x8815('0x33')](_0x19211e[_0x8815('0x43')]['offset']);}_0x187d97[_0x8815('0x4a')]=qs[_0x8815('0x4b')](_0x19211e[_0x8815('0x43')]['sort']);_0x187d97[_0x8815('0x4c')]=qs[_0x8815('0x4d')](_[_0x8815('0x4e')](_0x19211e[_0x8815('0x43')],_0x288630[_0x8815('0x4d')]),_0x34c606);if(_0x19211e['query'][_0x8815('0x4f')]){_0x187d97[_0x8815('0x4c')]=_[_0x8815('0x50')](_0x187d97[_0x8815('0x4c')],{'$or':_[_0x8815('0x42')](_0x34c606,function(_0x1f0489){if(_0x1f0489[_0x8815('0x3f')]!==_0x8815('0x51')){var _0x4b8970={};_0x4b8970[_0x1f0489[_0x8815('0x3a')]]={'$like':'%'+_0x19211e[_0x8815('0x43')][_0x8815('0x4f')]+'%'};return _0x4b8970;}})});}_0x187d97=_['merge']({},_0x187d97,_0x19211e['options']);var _0xaa2fc2={'where':_0x187d97['where']};return db[_0x8815('0x3c')][_0x8815('0x32')](_0xaa2fc2)['then'](function(_0x5515e){_0x28022f[_0x8815('0x32')]=_0x5515e;if(_0x19211e[_0x8815('0x43')][_0x8815('0x52')]){_0x187d97[_0x8815('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0x8815('0x54')](_0x187d97);})[_0x8815('0x22')](function(_0x2e3db8){_0x28022f[_0x8815('0x55')]=_0x2e3db8;return _0x28022f;})[_0x8815('0x22')](respondWithFilteredResult(_0x4b59a5,_0x187d97))[_0x8815('0x2c')](handleError(_0x4b59a5,null));};exports['show']=function(_0x2d34a3,_0x5b88b3){var _0x14e60b={'raw':!![],'where':{'id':_0x2d34a3[_0x8815('0x56')]['id']}},_0x24db78={};_0x24db78['model']=_[_0x8815('0x44')](db[_0x8815('0x3c')][_0x8815('0x3d')]);_0x24db78[_0x8815('0x43')]=_['keys'](_0x2d34a3['query']);_0x24db78[_0x8815('0x4d')]=_[_0x8815('0x45')](_0x24db78[_0x8815('0x41')],_0x24db78[_0x8815('0x43')]);_0x14e60b[_0x8815('0x47')]=_[_0x8815('0x45')](_0x24db78[_0x8815('0x41')],qs[_0x8815('0x46')](_0x2d34a3[_0x8815('0x43')][_0x8815('0x46')]));_0x14e60b[_0x8815('0x47')]=_0x14e60b[_0x8815('0x47')][_0x8815('0x48')]?_0x14e60b[_0x8815('0x47')]:_0x24db78[_0x8815('0x41')];if(_0x2d34a3['query'][_0x8815('0x52')]){_0x14e60b[_0x8815('0x53')]=[{'all':!![]}];}_0x14e60b=_[_0x8815('0x50')]({},_0x14e60b,_0x2d34a3[_0x8815('0x57')]);return db[_0x8815('0x3c')][_0x8815('0x58')](_0x14e60b)[_0x8815('0x22')](handleEntityNotFound(_0x5b88b3,null))[_0x8815('0x22')](respondWithResult(_0x5b88b3,null))[_0x8815('0x2c')](handleError(_0x5b88b3,null));};exports[_0x8815('0x38')]=function(_0x527e9b,_0xd9bed3){if(_0x527e9b['body']['id']){delete _0x527e9b[_0x8815('0x59')]['id'];}return db[_0x8815('0x3c')][_0x8815('0x58')]({'where':{'id':_0x527e9b['params']['id']}})[_0x8815('0x22')](handleEntityNotFound(_0xd9bed3,null))[_0x8815('0x22')](saveUpdates(_0x527e9b['body'],null))[_0x8815('0x22')](respondWithResult(_0xd9bed3,null))[_0x8815('0x2c')](handleError(_0xd9bed3,null));};exports[_0x8815('0x5a')]=function(_0x5cea30,_0x5e4396){return db['FaxMessage']['find']({'where':{'id':_0x5cea30[_0x8815('0x56')]['id']}})[_0x8815('0x22')](handleEntityNotFound(_0x5e4396,null))[_0x8815('0x22')](removeEntity(_0x5e4396,null))[_0x8815('0x2c')](handleError(_0x5e4396,null));};exports[_0x8815('0x5b')]=function(_0x2023d9,_0x5a74b7){return db['FaxMessage'][_0x8815('0x5b')]()[_0x8815('0x22')](respondWithResult(_0x5a74b7,null))[_0x8815('0x2c')](handleError(_0x5a74b7,null));};var interaction_log=require(_0x8815('0x14'))(_0x8815('0x5c'));exports[_0x8815('0x5d')]=function(_0x531fc8,_0x2958b3,_0x1a7915){var _0x14ff37={'agent':{},'channel':'fax'};if(_0x531fc8['body']['id']){delete _0x531fc8[_0x8815('0x59')]['id'];}_0x531fc8[_0x8815('0x59')][_0x8815('0x5e')]=!![];_0x531fc8[_0x8815('0x59')][_0x8815('0x5f')]=moment()[_0x8815('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x531fc8[_0x8815('0x59')][_0x8815('0x61')]=_0x531fc8[_0x8815('0x59')][_0x8815('0x61')]||_0x531fc8[_0x8815('0x62')]['id'];_0x14ff37[_0x8815('0x63')]['id']=_0x531fc8['body'][_0x8815('0x61')];return db[_0x8815('0x3c')][_0x8815('0x58')]({'where':{'id':_0x531fc8[_0x8815('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2958b3,null))[_0x8815('0x22')](saveUpdates(_0x531fc8['body'],null))[_0x8815('0x22')](function(_0x20e582){if(_0x20e582){_0x14ff37['message']=_0x20e582[_0x8815('0x64')]({'plain':!![]});return db[_0x8815('0x65')][_0x8815('0x58')]({'where':{'id':_0x20e582['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2958b3,null))[_0x8815('0x22')](function(_0x2bd017){if(_0x2bd017){return _0x2bd017[_0x8815('0x38')]({'UserId':_0x531fc8['body'][_0x8815('0x61')],'read1stAt':_[_0x8815('0x66')](_0x2bd017[_0x8815('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4ddf50){if(_0x4ddf50){_0x14ff37[_0x8815('0x68')]=_0x4ddf50['get']({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x531fc8[_0x8815('0x62')]['id'],_0x531fc8[_0x8815('0x62')][_0x8815('0x3a')],_0x531fc8[_0x8815('0x62')][_0x8815('0x69')],_0x14ff37['interaction']['id'],_0x531fc8[_0x8815('0x59')]?JSON[_0x8815('0x27')](_0x531fc8[_0x8815('0x59')]):_0x8815('0x6a'));return respondWithRpcPromise(_0x8815('0x6b'),'acceptMessage',_0x14ff37);}return null;})[_0x8815('0x22')](function(_0x10aa12){var _0x258834=_0x8815('0x6c')+_0x10aa12['message'][_0x8815('0x6d')];return db[_0x8815('0x6e')][_0x8815('0x43')](_0x258834,{'type':db[_0x8815('0x6f')]['QueryTypes'][_0x8815('0x70')],'raw':!![]})['then'](function(_0x16d77e){return _0x16d77e;});})[_0x8815('0x22')](function(_0x7428a1){if(_0x7428a1){_0x14ff37[_0x8815('0x2a')][_0x8815('0x71')]=_0x7428a1[0x0];if(!_0x531fc8['body'][_0x8815('0x61')])return;return db[_0x8815('0x72')][_0x8815('0x58')]({'where':{'id':_0x531fc8['body'][_0x8815('0x61')],'role':_0x8815('0x63')},'attributes':['id',_0x8815('0x3a'),_0x8815('0x73'),_0x8815('0x74'),_0x8815('0x75')],'raw':!![]});}return null;})['then'](function(_0x590c43){if(!_0x590c43)return null;_0x14ff37[_0x8815('0x2a')][_0x8815('0x63')]=_0x590c43;return _0x14ff37;})['then'](function(_0x28ef03){if(_0x28ef03){if(_0x531fc8[_0x8815('0x59')]['manual']){_0x14ff37[_0x8815('0x2a')][_0x8815('0x76')]=util[_0x8815('0x60')](_0x8815('0x77'),_0x531fc8['user'][_0x8815('0x3a')]);_0x14ff37[_0x8815('0x2a')][_0x8815('0x78')]=_0x14ff37[_0x8815('0x78')];_0x14ff37[_0x8815('0x2a')][_0x8815('0x79')]=_0x14ff37['channel'];_0x14ff37[_0x8815('0x2a')][_0x8815('0x7a')]='accept';return respondWithRpcPromise(_0x8815('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x14ff37[_0x8815('0x2a')]},client9002)[_0x8815('0x22')](function(){return _0x14ff37;});}return _0x14ff37;}return null;})[_0x8815('0x22')](respondWithResult(_0x2958b3,null))['catch'](handleError(_0x2958b3,null));};var interaction_log=require('../../config/logger')(_0x8815('0x5c'));exports['reject']=function(_0x395dae,_0x5bce2b,_0x55e9c6){var _0x26ec1f={'agent':{},'channel':_0x8815('0x7c')};if(_0x395dae[_0x8815('0x59')]['id']){delete _0x395dae[_0x8815('0x59')]['id'];}_0x395dae[_0x8815('0x59')]['UserId']=_0x395dae[_0x8815('0x59')][_0x8815('0x61')]||_0x395dae['user']['id'];_0x26ec1f['agent']['id']=_0x395dae[_0x8815('0x59')][_0x8815('0x61')];return db[_0x8815('0x3c')]['find']({'where':{'id':_0x395dae['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bce2b,null))[_0x8815('0x22')](function(_0x465d1a){if(_0x465d1a){_0x26ec1f[_0x8815('0x2a')]=_0x465d1a[_0x8815('0x64')]({'plain':!![]});return db[_0x8815('0x65')][_0x8815('0x58')]({'where':{'id':_0x465d1a[_0x8815('0x7d')]}});}return null;})[_0x8815('0x22')](handleEntityNotFound(_0x5bce2b,null))[_0x8815('0x22')](function(_0x7d6439){if(_0x7d6439){_0x26ec1f[_0x8815('0x68')]=_0x7d6439['get']({'plain':!![]});interaction_log[_0x8815('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x395dae[_0x8815('0x62')]['id'],_0x395dae['user'][_0x8815('0x3a')],_0x395dae[_0x8815('0x62')]['role'],_0x26ec1f[_0x8815('0x68')]['id'],_0x395dae[_0x8815('0x59')]?JSON[_0x8815('0x27')](_0x395dae['body']):_0x8815('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x26ec1f);}return null;})[_0x8815('0x22')](function(_0x224102){var _0x4aca95=_0x8815('0x6c')+_0x224102['message'][_0x8815('0x6d')];return db['sequelize'][_0x8815('0x43')](_0x4aca95,{'type':db[_0x8815('0x6f')]['QueryTypes'][_0x8815('0x70')],'raw':!![]})[_0x8815('0x22')](function(_0x411520){return _0x411520;});})[_0x8815('0x22')](function(_0x4d1070){if(_0x4d1070){_0x26ec1f[_0x8815('0x2a')][_0x8815('0x71')]=_0x4d1070[0x0];if(!_0x395dae[_0x8815('0x59')][_0x8815('0x61')])return;return db[_0x8815('0x72')][_0x8815('0x58')]({'where':{'id':_0x395dae[_0x8815('0x59')][_0x8815('0x61')],'role':'agent'},'attributes':['id',_0x8815('0x3a'),_0x8815('0x73'),'email',_0x8815('0x75')],'raw':!![]});}return null;})[_0x8815('0x22')](function(_0x3baaf9){if(!_0x3baaf9)return null;_0x26ec1f['message'][_0x8815('0x63')]=_0x3baaf9;return _0x26ec1f;})[_0x8815('0x22')](function(_0x525127){if(_0x525127){_0x525127[_0x8815('0x2a')][_0x8815('0x76')]=util[_0x8815('0x60')](_0x8815('0x77'),_0x395dae['user'][_0x8815('0x3a')]);_0x525127[_0x8815('0x2a')][_0x8815('0x78')]=_0x26ec1f[_0x8815('0x78')];_0x525127[_0x8815('0x2a')][_0x8815('0x79')]=_0x26ec1f[_0x8815('0x78')];_0x525127[_0x8815('0x2a')]['event']='reject';respondWithRpcPromise(_0x8815('0x7b'),'EventManager',{'event':'rejectmessage','message':_0x525127[_0x8815('0x2a')]},client9002);return _0x26ec1f;}return null;})[_0x8815('0x22')](respondWithResult(_0x5bce2b,null))[_0x8815('0x2c')](handleError(_0x5bce2b,null));};exports['create']=function(_0x228ec4,_0xa2e108){var _0x41d581;return db[_0x8815('0x3c')][_0x8815('0x7e')](_0x228ec4['body'],{})[_0x8815('0x22')](function(_0x2e5927){_0x41d581=_0x2e5927;return db['CmContact'][_0x8815('0x7f')]({'where':{'id':_0x41d581[_0x8815('0x6d')]}});})[_0x8815('0x22')](function(_0x311633){if(_['isNil'](_0x311633)){return;}else{_0x41d581[_0x8815('0x7c')]=_0x311633[_0x8815('0x7c')];return db['Attachment'][_0x8815('0x7f')]({'where':{'id':_0x41d581[_0x8815('0x80')]}});}})[_0x8815('0x22')](function(_0x5556fe){return respondWithRpcPromise('SendFax',_0x8815('0x81'),{'FaxAccountId':_[_0x8815('0x66')](_0x228ec4[_0x8815('0x59')])?undefined:_0x228ec4['body'][_0x8815('0x82')],'path':_[_0x8815('0x66')](_0x5556fe)?undefined:util['format'](_0x8815('0x83'),_0x5556fe['basename']),'fax':_[_0x8815('0x66')](_0x41d581[_0x8815('0x7c')])?undefined:_0x41d581[_0x8815('0x7c')],'AttachmentId':_0x41d581[_0x8815('0x80')]},client9002);})[_0x8815('0x22')](respondWithResult(_0xa2e108,0xc9))['catch'](handleError(_0xa2e108,null));};exports['download']=function(_0x80aa5b,_0x3a49d9){var _0x12aadd=path[_0x8815('0x84')](config[_0x8815('0x85')],_0x8815('0x86'),'files',_0x8815('0x87'));return db[_0x8815('0x3c')][_0x8815('0x58')]({'where':{'id':_0x80aa5b[_0x8815('0x56')]['id']},'include':[{'model':db[_0x8815('0x88')],'as':'Attachment'}]})[_0x8815('0x22')](handleEntityNotFound(_0x3a49d9,null))[_0x8815('0x22')](function(_0x8c814d){if(_0x8c814d){return _0x3a49d9[_0x8815('0x89')](path[_0x8815('0x84')](_0x12aadd,_0x8c814d[_0x8815('0x88')]['basename']));}})[_0x8815('0x2c')](handleError(_0x3a49d9,null));}; \ No newline at end of file +var _0x3403=['where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','body','destroy','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE: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','SELECT','contact','User','agent','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','sort'];(function(_0x5e745e,_0xde2931){var _0x122dab=function(_0xe396a5){while(--_0xe396a5){_0x5e745e['push'](_0x5e745e['shift']());}};_0x122dab(++_0xde2931);}(_0x3403,0x16f));var _0x3340=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3403[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0x3340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3340('0x1'));var jsonpatch=require(_0x3340('0x2'));var rp=require('request-promise');var moment=require(_0x3340('0x3'));var BPromise=require(_0x3340('0x4'));var Mustache=require('mustache');var util=require(_0x3340('0x5'));var path=require(_0x3340('0x6'));var sox=require(_0x3340('0x7'));var csv=require('to-csv');var ejs=require(_0x3340('0x8'));var fs=require('fs');var fs_extra=require(_0x3340('0x9'));var _=require(_0x3340('0xa'));var squel=require(_0x3340('0xb'));var crypto=require(_0x3340('0xc'));var jsforce=require(_0x3340('0xd'));var deskjs=require(_0x3340('0xe'));var toCsv=require(_0x3340('0xf'));var querystring=require(_0x3340('0x10'));var Papa=require(_0x3340('0x11'));var Redis=require(_0x3340('0x12'));var authService=require(_0x3340('0x13'));var qs=require(_0x3340('0x14'));var as=require(_0x3340('0x15'));var hardwareService=require(_0x3340('0x16'));var logger=require('../../config/logger')(_0x3340('0x17'));var utils=require(_0x3340('0x18'));var config=require(_0x3340('0x19'));var licenseUtil=require(_0x3340('0x1a'));var db=require(_0x3340('0x1b'))['db'];config['redis']=_[_0x3340('0x1c')](config[_0x3340('0x1d')],{'host':_0x3340('0x1e'),'port':0x18eb});var socket=require(_0x3340('0x1f'))(new Redis(config['redis']));require(_0x3340('0x20'))[_0x3340('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3340('0x22')][_0x3340('0x23')]({'port':0x232c});var client9002=jayson[_0x3340('0x22')][_0x3340('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x47e203,_0x3e9496,_0x28d1ab,_0x4ba48f){return new BPromise(function(_0x2985bb,_0x297e2e){var _0x278b49=_0x4ba48f||client;return _0x278b49[_0x3340('0x24')](_0x47e203,_0x28d1ab)['then'](function(_0x51f563){logger['info'](_0x3340('0x25'),_0x3e9496,_0x3340('0x26'));logger[_0x3340('0x27')](_0x3340('0x28'),_0x3e9496,'request\x20sent',JSON[_0x3340('0x29')](_0x51f563));if(_0x51f563['error']){if(_0x51f563[_0x3340('0x2a')][_0x3340('0x2b')]===0x1f4){logger[_0x3340('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x3e9496,_0x51f563[_0x3340('0x2a')][_0x3340('0x2c')]);return _0x297e2e(_0x51f563[_0x3340('0x2a')]['message']);}logger[_0x3340('0x2a')](_0x3340('0x25'),_0x3e9496,_0x51f563[_0x3340('0x2a')]['message']);return _0x2985bb(_0x51f563[_0x3340('0x2a')]['message']);}else{logger['info'](_0x3340('0x25'),_0x3e9496,_0x3340('0x26'));_0x2985bb(_0x51f563[_0x3340('0x2d')][_0x3340('0x2c')]);}})[_0x3340('0x2e')](function(_0x2f3311){logger[_0x3340('0x2a')](_0x3340('0x25'),_0x3e9496,_0x2f3311);_0x297e2e(_0x2f3311);});});}function respondWithStatusCode(_0x4ecf85,_0x246bdb){_0x246bdb=_0x246bdb||0xcc;return function(_0x5c415f){if(_0x5c415f){return _0x4ecf85[_0x3340('0x2f')](_0x246bdb);}return _0x4ecf85[_0x3340('0x30')](_0x246bdb)['end']();};}function respondWithResult(_0x3d15f3,_0x8ba370){_0x8ba370=_0x8ba370||0xc8;return function(_0x11dea8){if(_0x11dea8){return _0x3d15f3[_0x3340('0x30')](_0x8ba370)[_0x3340('0x31')](_0x11dea8);}};}function respondWithFilteredResult(_0x4adc80,_0x16a4e3){return function(_0x5e13ff){if(_0x5e13ff){var _0x3740e1=typeof _0x16a4e3[_0x3340('0x32')]===_0x3340('0x33')&&typeof _0x16a4e3[_0x3340('0x34')]===_0x3340('0x33');var _0x50ef52=_0x5e13ff[_0x3340('0x35')];var _0x5644c4=_0x3740e1?0x0:_0x16a4e3[_0x3340('0x32')];var _0x2223ec=_0x3740e1?_0x5e13ff[_0x3340('0x35')]:_0x16a4e3[_0x3340('0x32')]+_0x16a4e3[_0x3340('0x34')];var _0x5893cb;if(_0x2223ec>=_0x50ef52){_0x2223ec=_0x50ef52;_0x5893cb=0xc8;}else{_0x5893cb=0xce;}_0x4adc80[_0x3340('0x30')](_0x5893cb);return _0x4adc80[_0x3340('0x36')](_0x3340('0x37'),_0x5644c4+'-'+_0x2223ec+'/'+_0x50ef52)[_0x3340('0x31')](_0x5e13ff);}return null;};}function patchUpdates(_0x37fbbc){return function(_0x20c636){try{jsonpatch['apply'](_0x20c636,_0x37fbbc,!![]);}catch(_0x4197a0){return BPromise[_0x3340('0x38')](_0x4197a0);}return _0x20c636['save']();};}function saveUpdates(_0x14b641,_0x1f9af6){return function(_0x176cf3){if(_0x176cf3){return _0x176cf3[_0x3340('0x39')](_0x14b641)[_0x3340('0x3a')](function(_0x26c73d){return _0x26c73d;});}return null;};}function removeEntity(_0x532d53,_0x5dea1a){return function(_0x85d141){if(_0x85d141){return _0x85d141['destroy']()['then'](function(){_0x532d53[_0x3340('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8f1f,_0x507e06){return function(_0x33b1e3){if(!_0x33b1e3){_0x1c8f1f[_0x3340('0x2f')](0x194);}return _0x33b1e3;};}function handleError(_0x524b64,_0x13a8f1){_0x13a8f1=_0x13a8f1||0x1f4;return function(_0x5b464c){logger[_0x3340('0x2a')](_0x5b464c[_0x3340('0x3b')]);if(_0x5b464c[_0x3340('0x3c')]){delete _0x5b464c[_0x3340('0x3c')];}_0x524b64[_0x3340('0x30')](_0x13a8f1)[_0x3340('0x3d')](_0x5b464c);};}exports[_0x3340('0x3e')]=function(_0x1cd0bf,_0x54c286){var _0x44ead0={},_0x410d66={},_0x5ac4d6={'count':0x0,'rows':[]};var _0x59ce08=_[_0x3340('0x3f')](db[_0x3340('0x40')][_0x3340('0x41')],function(_0x513fc1){return{'name':_0x513fc1['fieldName'],'type':_0x513fc1[_0x3340('0x42')][_0x3340('0x43')]};});_0x410d66['model']=_[_0x3340('0x3f')](_0x59ce08,_0x3340('0x3c'));_0x410d66[_0x3340('0x44')]=_[_0x3340('0x45')](_0x1cd0bf['query']);_0x410d66['filters']=_[_0x3340('0x46')](_0x410d66['model'],_0x410d66[_0x3340('0x44')]);_0x44ead0[_0x3340('0x47')]=_[_0x3340('0x46')](_0x410d66['model'],qs['fields'](_0x1cd0bf[_0x3340('0x44')][_0x3340('0x48')]));_0x44ead0['attributes']=_0x44ead0[_0x3340('0x47')][_0x3340('0x49')]?_0x44ead0[_0x3340('0x47')]:_0x410d66[_0x3340('0x4a')];if(!_0x1cd0bf[_0x3340('0x44')][_0x3340('0x4b')]('nolimit')){_0x44ead0[_0x3340('0x34')]=qs[_0x3340('0x34')](_0x1cd0bf[_0x3340('0x44')][_0x3340('0x34')]);_0x44ead0['offset']=qs[_0x3340('0x32')](_0x1cd0bf[_0x3340('0x44')][_0x3340('0x32')]);}_0x44ead0['order']=qs[_0x3340('0x4c')](_0x1cd0bf[_0x3340('0x44')][_0x3340('0x4c')]);_0x44ead0[_0x3340('0x4d')]=qs[_0x3340('0x4e')](_[_0x3340('0x4f')](_0x1cd0bf[_0x3340('0x44')],_0x410d66[_0x3340('0x4e')]),_0x59ce08);if(_0x1cd0bf[_0x3340('0x44')][_0x3340('0x50')]){_0x44ead0[_0x3340('0x4d')]=_[_0x3340('0x51')](_0x44ead0[_0x3340('0x4d')],{'$or':_[_0x3340('0x3f')](_0x59ce08,function(_0x1650cf){if(_0x1650cf[_0x3340('0x42')]!==_0x3340('0x52')){var _0x10c0a4={};_0x10c0a4[_0x1650cf[_0x3340('0x3c')]]={'$like':'%'+_0x1cd0bf['query'][_0x3340('0x50')]+'%'};return _0x10c0a4;}})});}_0x44ead0=_[_0x3340('0x51')]({},_0x44ead0,_0x1cd0bf[_0x3340('0x53')]);var _0x2bb163={'where':_0x44ead0[_0x3340('0x4d')]};return db[_0x3340('0x40')][_0x3340('0x35')](_0x2bb163)[_0x3340('0x3a')](function(_0xd9f663){_0x5ac4d6[_0x3340('0x35')]=_0xd9f663;if(_0x1cd0bf['query']['includeAll']){_0x44ead0[_0x3340('0x54')]=[{'all':!![]}];}return db[_0x3340('0x40')]['findAll'](_0x44ead0);})[_0x3340('0x3a')](function(_0x171dc0){_0x5ac4d6[_0x3340('0x55')]=_0x171dc0;return _0x5ac4d6;})[_0x3340('0x3a')](respondWithFilteredResult(_0x54c286,_0x44ead0))[_0x3340('0x2e')](handleError(_0x54c286,null));};exports[_0x3340('0x56')]=function(_0x22c987,_0x4c0518){var _0x104793={'raw':!![],'where':{'id':_0x22c987[_0x3340('0x57')]['id']}},_0x583b5a={};_0x583b5a[_0x3340('0x4a')]=_[_0x3340('0x45')](db[_0x3340('0x40')][_0x3340('0x41')]);_0x583b5a['query']=_[_0x3340('0x45')](_0x22c987[_0x3340('0x44')]);_0x583b5a[_0x3340('0x4e')]=_[_0x3340('0x46')](_0x583b5a['model'],_0x583b5a[_0x3340('0x44')]);_0x104793[_0x3340('0x47')]=_['intersection'](_0x583b5a[_0x3340('0x4a')],qs[_0x3340('0x48')](_0x22c987[_0x3340('0x44')]['fields']));_0x104793['attributes']=_0x104793[_0x3340('0x47')][_0x3340('0x49')]?_0x104793[_0x3340('0x47')]:_0x583b5a[_0x3340('0x4a')];if(_0x22c987['query'][_0x3340('0x58')]){_0x104793[_0x3340('0x54')]=[{'all':!![]}];}_0x104793=_['merge']({},_0x104793,_0x22c987[_0x3340('0x53')]);return db[_0x3340('0x40')][_0x3340('0x59')](_0x104793)[_0x3340('0x3a')](handleEntityNotFound(_0x4c0518,null))[_0x3340('0x3a')](respondWithResult(_0x4c0518,null))[_0x3340('0x2e')](handleError(_0x4c0518,null));};exports[_0x3340('0x39')]=function(_0x2d78e3,_0x82e8e3){if(_0x2d78e3[_0x3340('0x5a')]['id']){delete _0x2d78e3[_0x3340('0x5a')]['id'];}return db['FaxMessage'][_0x3340('0x59')]({'where':{'id':_0x2d78e3[_0x3340('0x57')]['id']}})[_0x3340('0x3a')](handleEntityNotFound(_0x82e8e3,null))[_0x3340('0x3a')](saveUpdates(_0x2d78e3[_0x3340('0x5a')],null))[_0x3340('0x3a')](respondWithResult(_0x82e8e3,null))[_0x3340('0x2e')](handleError(_0x82e8e3,null));};exports[_0x3340('0x5b')]=function(_0x5bb386,_0x31393d){return db['FaxMessage'][_0x3340('0x59')]({'where':{'id':_0x5bb386['params']['id']}})[_0x3340('0x3a')](handleEntityNotFound(_0x31393d,null))[_0x3340('0x3a')](removeEntity(_0x31393d,null))[_0x3340('0x2e')](handleError(_0x31393d,null));};exports[_0x3340('0x5c')]=function(_0x232445,_0x9103a4){return db[_0x3340('0x40')][_0x3340('0x5c')]()[_0x3340('0x3a')](respondWithResult(_0x9103a4,null))[_0x3340('0x2e')](handleError(_0x9103a4,null));};var interaction_log=require('../../config/logger')(_0x3340('0x5d'));exports[_0x3340('0x5e')]=function(_0x13fbe7,_0x101102,_0x19ef17){var _0x4feae6={'agent':{},'channel':_0x3340('0x5f')};if(_0x13fbe7[_0x3340('0x5a')]['id']){delete _0x13fbe7[_0x3340('0x5a')]['id'];}_0x13fbe7[_0x3340('0x5a')]['read']=!![];_0x13fbe7[_0x3340('0x5a')][_0x3340('0x60')]=moment()[_0x3340('0x61')](_0x3340('0x62'));_0x13fbe7[_0x3340('0x5a')][_0x3340('0x63')]=_0x13fbe7[_0x3340('0x5a')]['UserId']||_0x13fbe7[_0x3340('0x64')]['id'];_0x4feae6['agent']['id']=_0x13fbe7[_0x3340('0x5a')][_0x3340('0x63')];return db[_0x3340('0x40')][_0x3340('0x59')]({'where':{'id':_0x13fbe7['params']['id'],'UserId':null}})[_0x3340('0x3a')](handleEntityNotFound(_0x101102,null))[_0x3340('0x3a')](saveUpdates(_0x13fbe7['body'],null))[_0x3340('0x3a')](function(_0x5a2044){if(_0x5a2044){_0x4feae6[_0x3340('0x2c')]=_0x5a2044[_0x3340('0x65')]({'plain':!![]});return db[_0x3340('0x66')]['find']({'where':{'id':_0x5a2044[_0x3340('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x101102,null))[_0x3340('0x3a')](function(_0x31ccc6){if(_0x31ccc6){return _0x31ccc6[_0x3340('0x39')]({'UserId':_0x13fbe7[_0x3340('0x5a')]['UserId'],'read1stAt':_[_0x3340('0x68')](_0x31ccc6[_0x3340('0x69')])?moment()[_0x3340('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3340('0x3a')](function(_0x2f5128){if(_0x2f5128){_0x4feae6[_0x3340('0x6a')]=_0x2f5128[_0x3340('0x65')]({'plain':!![]});interaction_log['info'](_0x3340('0x6b'),_0x13fbe7['user']['id'],_0x13fbe7[_0x3340('0x64')][_0x3340('0x3c')],_0x13fbe7[_0x3340('0x64')][_0x3340('0x6c')],_0x4feae6[_0x3340('0x6a')]['id'],_0x13fbe7[_0x3340('0x5a')]?JSON[_0x3340('0x29')](_0x13fbe7[_0x3340('0x5a')]):_0x3340('0x6d'));return respondWithRpcPromise(_0x3340('0x6e'),_0x3340('0x6f'),_0x4feae6);}return null;})['then'](function(_0x58c5fe){var _0x28203f=_0x3340('0x70')+_0x58c5fe['message'][_0x3340('0x71')];return db[_0x3340('0x72')][_0x3340('0x44')](_0x28203f,{'type':db[_0x3340('0x73')]['QueryTypes'][_0x3340('0x74')],'raw':!![]})[_0x3340('0x3a')](function(_0x4a0224){return _0x4a0224;});})[_0x3340('0x3a')](function(_0x51328b){if(_0x51328b){_0x4feae6[_0x3340('0x2c')][_0x3340('0x75')]=_0x51328b[0x0];if(!_0x13fbe7[_0x3340('0x5a')][_0x3340('0x63')])return;return db[_0x3340('0x76')][_0x3340('0x59')]({'where':{'id':_0x13fbe7[_0x3340('0x5a')][_0x3340('0x63')],'role':_0x3340('0x77')},'attributes':['id','name','fullname',_0x3340('0x78'),_0x3340('0x79')],'raw':!![]});}return null;})['then'](function(_0x3039e9){if(!_0x3039e9)return null;_0x4feae6[_0x3340('0x2c')][_0x3340('0x77')]=_0x3039e9;return _0x4feae6;})[_0x3340('0x3a')](function(_0x550744){if(_0x550744){if(_0x13fbe7['body']['manual']){_0x4feae6[_0x3340('0x2c')][_0x3340('0x7a')]=util[_0x3340('0x61')](_0x3340('0x7b'),_0x13fbe7['user'][_0x3340('0x3c')]);_0x4feae6[_0x3340('0x2c')][_0x3340('0x7c')]=_0x4feae6[_0x3340('0x7c')];_0x4feae6['message']['motionChannel']=_0x4feae6['channel'];_0x4feae6[_0x3340('0x2c')][_0x3340('0x7d')]=_0x3340('0x5e');return respondWithRpcPromise('EventManager',_0x3340('0x7e'),{'event':_0x3340('0x7f'),'message':_0x4feae6[_0x3340('0x2c')]},client9002)[_0x3340('0x3a')](function(){return _0x4feae6;});}return _0x4feae6;}return null;})[_0x3340('0x3a')](respondWithResult(_0x101102,null))['catch'](handleError(_0x101102,null));};var interaction_log=require(_0x3340('0x80'))(_0x3340('0x5d'));exports[_0x3340('0x38')]=function(_0x26c5db,_0x32ab40,_0x14a3be){var _0x285ab8={'agent':{},'channel':'fax'};if(_0x26c5db[_0x3340('0x5a')]['id']){delete _0x26c5db[_0x3340('0x5a')]['id'];}_0x26c5db[_0x3340('0x5a')]['UserId']=_0x26c5db['body']['UserId']||_0x26c5db[_0x3340('0x64')]['id'];_0x285ab8[_0x3340('0x77')]['id']=_0x26c5db[_0x3340('0x5a')]['UserId'];return db[_0x3340('0x40')]['find']({'where':{'id':_0x26c5db['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32ab40,null))[_0x3340('0x3a')](function(_0x28ee0f){if(_0x28ee0f){_0x285ab8[_0x3340('0x2c')]=_0x28ee0f['get']({'plain':!![]});return db['FaxInteraction'][_0x3340('0x59')]({'where':{'id':_0x28ee0f[_0x3340('0x67')]}});}return null;})[_0x3340('0x3a')](handleEntityNotFound(_0x32ab40,null))[_0x3340('0x3a')](function(_0x1f329d){if(_0x1f329d){_0x285ab8[_0x3340('0x6a')]=_0x1f329d[_0x3340('0x65')]({'plain':!![]});interaction_log['info'](_0x3340('0x81'),_0x26c5db['user']['id'],_0x26c5db['user'][_0x3340('0x3c')],_0x26c5db[_0x3340('0x64')][_0x3340('0x6c')],_0x285ab8[_0x3340('0x6a')]['id'],_0x26c5db['body']?JSON['stringify'](_0x26c5db[_0x3340('0x5a')]):'null');return respondWithRpcPromise(_0x3340('0x82'),'rejectMessage',_0x285ab8);}return null;})[_0x3340('0x3a')](function(_0x2b06b){var _0xde61a4=_0x3340('0x70')+_0x2b06b[_0x3340('0x2c')]['ContactId'];return db[_0x3340('0x72')][_0x3340('0x44')](_0xde61a4,{'type':db[_0x3340('0x73')][_0x3340('0x83')][_0x3340('0x74')],'raw':!![]})['then'](function(_0x3d47b2){return _0x3d47b2;});})['then'](function(_0x42a5bf){if(_0x42a5bf){_0x285ab8['message'][_0x3340('0x75')]=_0x42a5bf[0x0];if(!_0x26c5db[_0x3340('0x5a')][_0x3340('0x63')])return;return db['User']['find']({'where':{'id':_0x26c5db['body'][_0x3340('0x63')],'role':_0x3340('0x77')},'attributes':['id',_0x3340('0x3c'),'fullname','email',_0x3340('0x79')],'raw':!![]});}return null;})[_0x3340('0x3a')](function(_0x2fa29b){if(!_0x2fa29b)return null;_0x285ab8[_0x3340('0x2c')]['agent']=_0x2fa29b;return _0x285ab8;})[_0x3340('0x3a')](function(_0x123275){if(_0x123275){_0x123275[_0x3340('0x2c')]['interface']=util['format'](_0x3340('0x7b'),_0x26c5db['user']['name']);_0x123275[_0x3340('0x2c')][_0x3340('0x7c')]=_0x285ab8[_0x3340('0x7c')];_0x123275[_0x3340('0x2c')]['motionChannel']=_0x285ab8[_0x3340('0x7c')];_0x123275[_0x3340('0x2c')][_0x3340('0x7d')]=_0x3340('0x38');respondWithRpcPromise(_0x3340('0x7e'),_0x3340('0x7e'),{'event':_0x3340('0x84'),'message':_0x123275[_0x3340('0x2c')]},client9002);return _0x285ab8;}return null;})['then'](respondWithResult(_0x32ab40,null))[_0x3340('0x2e')](handleError(_0x32ab40,null));};exports[_0x3340('0x85')]=function(_0x491466,_0x2fac49){var _0x51cf01;return db['FaxMessage'][_0x3340('0x85')](_0x491466[_0x3340('0x5a')],{})['then'](function(_0x3ea5e6){_0x51cf01=_0x3ea5e6;return db[_0x3340('0x86')][_0x3340('0x87')]({'where':{'id':_0x51cf01['ContactId']}});})[_0x3340('0x3a')](function(_0x5948a2){if(_['isNil'](_0x5948a2)){return;}else{_0x51cf01[_0x3340('0x5f')]=_0x5948a2[_0x3340('0x5f')];return db[_0x3340('0x88')][_0x3340('0x87')]({'where':{'id':_0x51cf01[_0x3340('0x89')]}});}})[_0x3340('0x3a')](function(_0x4599e1){return respondWithRpcPromise(_0x3340('0x8a'),_0x3340('0x8a'),{'FaxAccountId':_[_0x3340('0x68')](_0x491466[_0x3340('0x5a')])?undefined:_0x491466[_0x3340('0x5a')][_0x3340('0x8b')],'path':_[_0x3340('0x68')](_0x4599e1)?undefined:util[_0x3340('0x61')](_0x3340('0x8c'),_0x4599e1['basename']),'fax':_['isNil'](_0x51cf01['fax'])?undefined:_0x51cf01['fax'],'AttachmentId':_0x51cf01[_0x3340('0x89')]},client9002);})['then'](respondWithResult(_0x2fac49,0xc9))['catch'](handleError(_0x2fac49,null));};exports[_0x3340('0x8d')]=function(_0x392892,_0x5ddfc6){var _0x189e0e=path[_0x3340('0x8e')](config[_0x3340('0x8f')],_0x3340('0x90'),_0x3340('0x91'),_0x3340('0x92'));return db[_0x3340('0x40')][_0x3340('0x59')]({'where':{'id':_0x392892[_0x3340('0x57')]['id']},'include':[{'model':db[_0x3340('0x88')],'as':_0x3340('0x88')}]})[_0x3340('0x3a')](handleEntityNotFound(_0x5ddfc6,null))[_0x3340('0x3a')](function(_0x91606){if(_0x91606){return _0x5ddfc6[_0x3340('0x8d')](path[_0x3340('0x8e')](_0x189e0e,_0x91606[_0x3340('0x88')][_0x3340('0x93')]));}})[_0x3340('0x2e')](handleError(_0x5ddfc6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9232535..e89eb96 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 _0x15c6=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x38c406,_0x36390f){var _0x243a79=function(_0x520491){while(--_0x520491){_0x38c406['push'](_0x38c406['shift']());}};_0x243a79(++_0x36390f);}(_0x15c6,0x1cd));var _0x615c=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x15c6[_0x11deef];return _0xe9ba85;};'use strict';var EventEmitter=require(_0x615c('0x0'));var FaxMessage=require(_0x615c('0x1'))['db'][_0x615c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x615c('0x3')](0x0);var events={'afterCreate':_0x615c('0x4'),'afterUpdate':_0x615c('0x5'),'afterDestroy':_0x615c('0x6')};function emitEvent(_0x28cf45){return function(_0x4bb54c,_0x5143f9,_0x5ea94e){FaxMessageEvents[_0x615c('0x7')](_0x28cf45+':'+_0x4bb54c['id'],_0x4bb54c);FaxMessageEvents[_0x615c('0x7')](_0x28cf45,_0x4bb54c);_0x5ea94e(null);};}for(var e in events){if(events[_0x615c('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x615c('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xed5c=['remove','emit','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x2a40b2,_0x35c0c1){var _0x6c4056=function(_0xa1a401){while(--_0xa1a401){_0x2a40b2['push'](_0x2a40b2['shift']());}};_0x6c4056(++_0x35c0c1);}(_0xed5c,0x81));var _0xced5=function(_0x59a819,_0x35091b){_0x59a819=_0x59a819-0x0;var _0x5c88e2=_0xed5c[_0x59a819];return _0x5c88e2;};'use strict';var EventEmitter=require(_0xced5('0x0'));var FaxMessage=require(_0xced5('0x1'))['db'][_0xced5('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xced5('0x3')](0x0);var events={'afterCreate':_0xced5('0x4'),'afterUpdate':_0xced5('0x5'),'afterDestroy':_0xced5('0x6')};function emitEvent(_0x395c27){return function(_0x2b8184,_0x2ec4f9,_0x583a62){FaxMessageEvents[_0xced5('0x7')](_0x395c27+':'+_0x2b8184['id'],_0x2b8184);FaxMessageEvents[_0xced5('0x7')](_0x395c27,_0x2b8184);_0x583a62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xced5('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 a8918bd..0d29e2d 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 _0xd7dd=['FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0xd7dd,0x11d));var _0xdd7d=function(_0x1f27f6,_0x1d018a){_0x1f27f6=_0x1f27f6-0x0;var _0x2fb1d7=_0xd7dd[_0x1f27f6];return _0x2fb1d7;};'use strict';var _=require(_0xdd7d('0x0'));var util=require(_0xdd7d('0x1'));var logger=require(_0xdd7d('0x2'))(_0xdd7d('0x3'));var moment=require('moment');var BPromise=require(_0xdd7d('0x4'));var rp=require(_0xdd7d('0x5'));var fs=require('fs');var path=require(_0xdd7d('0x6'));var rimraf=require(_0xdd7d('0x7'));var config=require(_0xdd7d('0x8'));var attributes=require(_0xdd7d('0x9'));module[_0xdd7d('0xa')]=function(_0x547c7a,_0x58f1fe){return _0x547c7a[_0xdd7d('0xb')](_0xdd7d('0xc'),attributes,{'tableName':_0xdd7d('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xdd7d('0xe')],'type':_0xdd7d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x227b1b,_0xda0bb7,_0x16bf4d){var _0x40999a=_0x547c7a[_0xdd7d('0x10')];var _0x4de5d9=_0x227b1b[_0xdd7d('0x11')]({'plain':!![]});if(_0x4de5d9[_0xdd7d('0x12')][_0xdd7d('0x13')]()==='in'||_0x4de5d9[_0xdd7d('0x12')][_0xdd7d('0x13')]()==='out'&&!_0x4de5d9[_0xdd7d('0x14')]&&!_[_0xdd7d('0x15')](_0x4de5d9[_0xdd7d('0x16')])){_0x40999a['FaxInteraction']['findOne']({'where':{'id':_0x4de5d9[_0xdd7d('0x17')]}})[_0xdd7d('0x18')](function(_0x4b473d){if(_0x4b473d){_0x4b473d[_0xdd7d('0x19')]({'lastMsgAt':_0x4de5d9[_0xdd7d('0x1a')],'lastMsgDirection':_0x4de5d9[_0xdd7d('0x12')][_0xdd7d('0x13')]()});}})[_0xdd7d('0x1b')](function(_0x346ee0){console[_0xdd7d('0x1c')](_0x346ee0);});}_0x16bf4d();}},'charset':_0xdd7d('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9974=['FULLTEXT','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path','rimraf','exports','FaxMessage','fax_messages','fti_fax_messages'];(function(_0x5f53a1,_0x345576){var _0x2aa2b3=function(_0x624c3){while(--_0x624c3){_0x5f53a1['push'](_0x5f53a1['shift']());}};_0x2aa2b3(++_0x345576);}(_0x9974,0x97));var _0x4997=function(_0x493394,_0x3d9cc6){_0x493394=_0x493394-0x0;var _0x181efb=_0x9974[_0x493394];return _0x181efb;};'use strict';var _=require(_0x4997('0x0'));var util=require('util');var logger=require(_0x4997('0x1'))(_0x4997('0x2'));var moment=require('moment');var BPromise=require(_0x4997('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4997('0x4'));var rimraf=require(_0x4997('0x5'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x4997('0x6')]=function(_0xc6a8e3,_0x41e3d7){return _0xc6a8e3['define'](_0x4997('0x7'),attributes,{'tableName':_0x4997('0x8'),'paranoid':![],'indexes':[{'name':_0x4997('0x9'),'fields':['body'],'type':_0x4997('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45d7c8,_0xeb21fb,_0xe517e0){var _0x14839c=_0xc6a8e3['models'];var _0x4e86c6=_0x45d7c8['get']({'plain':!![]});if(_0x4e86c6[_0x4997('0xb')][_0x4997('0xc')]()==='in'||_0x4e86c6[_0x4997('0xb')]['toLowerCase']()===_0x4997('0xd')&&!_0x4e86c6[_0x4997('0xe')]&&!_['isNil'](_0x4e86c6[_0x4997('0xf')])){_0x14839c[_0x4997('0x10')][_0x4997('0x11')]({'where':{'id':_0x4e86c6[_0x4997('0x12')]}})[_0x4997('0x13')](function(_0x2cba36){if(_0x2cba36){_0x2cba36['update']({'lastMsgAt':_0x4e86c6[_0x4997('0x14')],'lastMsgDirection':_0x4e86c6[_0x4997('0xb')]['toLowerCase']()});}})['catch'](function(_0x4c1c6c){console[_0x4997('0x15')](_0x4c1c6c);});}_0xe517e0();}},'charset':'utf8mb4','collate':_0x4997('0x16')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e2e60c4..c31d1a8 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d0366,_0x50211a){var _0x5ce75e=function(_0xc70777){while(--_0xc70777){_0x3d0366['push'](_0x3d0366['shift']());}};_0x5ce75e(++_0x50211a);}(_0x4ea3,0x70));var _0x34ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ea3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file +var _0xeec6=['FaxMessage','create','body','options','then','catch','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage'];(function(_0x581cad,_0x355b2e){var _0x1a9f4b=function(_0x5c8461){while(--_0x5c8461){_0x581cad['push'](_0x581cad['shift']());}};_0x1a9f4b(++_0x355b2e);}(_0xeec6,0x1c2));var _0x6eec=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0xeec6[_0x4b5409];return _0x90b623;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});config['redis']=_[_0x6eec('0xc')](config[_0x6eec('0xd')],{'host':_0x6eec('0xe'),'port':0x18eb});var socket=require(_0x6eec('0xf'))(new Redis(config['redis']));require(_0x6eec('0x10'))[_0x6eec('0x11')](socket);function respondWithRpcPromise(_0x1c774d,_0x49ad4c,_0x595dd4){return new BPromise(function(_0x5e8aba,_0x295cae){return client[_0x6eec('0x12')](_0x1c774d,_0x595dd4)['then'](function(_0x4b8de1){logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));logger[_0x6eec('0x15')](_0x6eec('0x16'),_0x49ad4c,_0x6eec('0x14'),JSON[_0x6eec('0x17')](_0x4b8de1));if(_0x4b8de1['error']){if(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x19')]===0x1f4){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);return _0x295cae(_0x4b8de1[_0x6eec('0x18')][_0x6eec('0x1b')]);}logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x4b8de1['error'][_0x6eec('0x1b')]);return _0x5e8aba(_0x4b8de1['error'][_0x6eec('0x1b')]);}else{logger[_0x6eec('0x13')]('FaxMessage,\x20%s,\x20%s',_0x49ad4c,_0x6eec('0x14'));_0x5e8aba(_0x4b8de1[_0x6eec('0x1c')][_0x6eec('0x1b')]);}})['catch'](function(_0x87f3be){logger[_0x6eec('0x18')](_0x6eec('0x1a'),_0x49ad4c,_0x87f3be);_0x295cae(_0x87f3be);});});}exports[_0x6eec('0x1d')]=function(_0xd86135){var _0x1761f4=this;return new Promise(function(_0x536429,_0x328693){return db[_0x6eec('0x1e')][_0x6eec('0x1f')](_0xd86135[_0x6eec('0x20')],{'raw':_0xd86135[_0x6eec('0x21')]?_0xd86135[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x6eec('0x22')](function(_0x852d08){logger[_0x6eec('0x13')](_0x6eec('0x1d'),_0xd86135);logger[_0x6eec('0x15')](_0x6eec('0x1d'),_0xd86135,JSON['stringify'](_0x852d08));_0x536429(_0x852d08);})[_0x6eec('0x23')](function(_0x2ad14b){logger[_0x6eec('0x18')](_0x6eec('0x1d'),_0x2ad14b[_0x6eec('0x1b')],_0xd86135);_0x328693(_0x1761f4[_0x6eec('0x18')](0x1f4,_0x2ad14b[_0x6eec('0x1b')]));});});};exports[_0x6eec('0x24')]=function(_0x316317){var _0x58f95c=this;return new Promise(function(_0x1d750c,_0x44b31c){return db[_0x6eec('0x1e')][_0x6eec('0x25')](_0x316317['body'],{'raw':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316317['options']?_0x316317[_0x6eec('0x21')]['where']||null:null,'attributes':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x26')]||null:null,'limit':_0x316317[_0x6eec('0x21')]?_0x316317[_0x6eec('0x21')][_0x6eec('0x27')]||null:null})[_0x6eec('0x22')](function(_0x33e4a1){logger[_0x6eec('0x13')](_0x6eec('0x24'),_0x316317);logger['debug'](_0x6eec('0x24'),_0x316317,JSON['stringify'](_0x33e4a1));_0x1d750c(_0x33e4a1);})[_0x6eec('0x23')](function(_0x125bfc){logger[_0x6eec('0x18')]('UpdateFaxMessage',_0x125bfc['message'],_0x316317);_0x44b31c(_0x58f95c['error'](0x1f4,_0x125bfc[_0x6eec('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b9e6c8d..8681ce4 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 _0x2891=['emit','register','./faxMessage.events','save','remove','update'];(function(_0x389254,_0x466270){var _0x5b51b4=function(_0x5bf508){while(--_0x5bf508){_0x389254['push'](_0x389254['shift']());}};_0x5b51b4(++_0x466270);}(_0x2891,0x98));var _0x1289=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2891[_0x3a6efd];return _0x487b9a;};'use strict';var FaxMessageEvents=require(_0x1289('0x0'));var events=[_0x1289('0x1'),_0x1289('0x2'),_0x1289('0x3')];function createListener(_0x56cbee,_0x1a169a){return function(_0x60fe16){_0x1a169a[_0x1289('0x4')](_0x56cbee,_0x60fe16);};}function removeListener(_0x2fe7ad,_0x39041c){return function(){FaxMessageEvents['removeListener'](_0x2fe7ad,_0x39041c);};}exports[_0x1289('0x5')]=function(_0xf529f1){for(var _0x486e09=0x0,_0x5e421c=events['length'];_0x486e09<_0x5e421c;_0x486e09++){var _0x3acda3=events[_0x486e09];var _0x11a75a=createListener('faxMessage:'+_0x3acda3,_0xf529f1);FaxMessageEvents['on'](_0x3acda3,_0x11a75a);}}; \ No newline at end of file +var _0x09c5=['remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x61e3e7,_0xe0e3e8){var _0x38bf26=function(_0x476803){while(--_0x476803){_0x61e3e7['push'](_0x61e3e7['shift']());}};_0x38bf26(++_0xe0e3e8);}(_0x09c5,0xff));var _0x509c=function(_0x1ad279,_0x42d157){_0x1ad279=_0x1ad279-0x0;var _0x272861=_0x09c5[_0x1ad279];return _0x272861;};'use strict';var FaxMessageEvents=require(_0x509c('0x0'));var events=['save',_0x509c('0x1'),_0x509c('0x2')];function createListener(_0x168b04,_0x291f77){return function(_0xdab7dd){_0x291f77[_0x509c('0x3')](_0x168b04,_0xdab7dd);};}function removeListener(_0x380346,_0x2cc544){return function(){FaxMessageEvents[_0x509c('0x4')](_0x380346,_0x2cc544);};}exports[_0x509c('0x5')]=function(_0x2d8f37){for(var _0xf4f86d=0x0,_0x3d6946=events[_0x509c('0x6')];_0xf4f86d<_0x3d6946;_0xf4f86d++){var _0xc0e4de=events[_0xf4f86d];var _0x576a29=createListener(_0x509c('0x7')+_0xc0e4de,_0x2d8f37);FaxMessageEvents['on'](_0xc0e4de,_0x576a29);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 780abff..f6d34fa 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 _0xf4eb=['/:id/accept','accept','/:id/reject','delete','exports','multer','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put'];(function(_0x162a3c,_0x54f601){var _0x57703d=function(_0x781c98){while(--_0x781c98){_0x162a3c['push'](_0x162a3c['shift']());}};_0x57703d(++_0x54f601);}(_0xf4eb,0xec));var _0xbf4e=function(_0x45c879,_0x58593e){_0x45c879=_0x45c879-0x0;var _0x2b4cf9=_0xf4eb[_0x45c879];return _0x2b4cf9;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/describe',auth[_0xbf4e('0x6')](),controller['describe']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xbf4e('0xc')]('fax',_0xbf4e('0xd')),controller[_0xbf4e('0xe')]);router['put'](_0xbf4e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xbf4e('0xf')](_0xbf4e('0x10'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x11')]);router[_0xbf4e('0xf')](_0xbf4e('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xbf4e('0x13')](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller['destroy']);module[_0xbf4e('0x14')]=router; \ No newline at end of file +var _0x6f0d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','post','tracked','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x55ebbc,_0x1cdbe3){var _0x1d93d4=function(_0x590c1a){while(--_0x590c1a){_0x55ebbc['push'](_0x55ebbc['shift']());}};_0x1d93d4(++_0x1cdbe3);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5a612c,_0x33e310){_0x5a612c=_0x5a612c-0x0;var _0x4a8e51=_0x6f0d[_0x5a612c];return _0x4a8e51;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xa')](_0xd6f0('0xe'),auth[_0xd6f0('0x9')](),controller['download']);router[_0xd6f0('0xf')]('/',auth[_0xd6f0('0x9')](),interaction[_0xd6f0('0x10')](_0xd6f0('0x11'),'faxmessage:create'),controller[_0xd6f0('0x12')]);router[_0xd6f0('0x13')](_0xd6f0('0x14'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x15')]);router[_0xd6f0('0x13')](_0xd6f0('0x16'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x17')]);router['put'](_0xd6f0('0x18'),auth[_0xd6f0('0x9')](),controller['reject']);router[_0xd6f0('0x19')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x1a')]);module[_0xd6f0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0b97e5c..46e4850 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 _0x6237=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0x6237,0xc4));var _0x7623=function(_0x5b083b,_0x145a9b){_0x5b083b=_0x5b083b-0x0;var _0x6c2225=_0x6237[_0x5b083b];return _0x6c2225;};'use strict';var Sequelize=require(_0x7623('0x0'));module[_0x7623('0x1')]={'name':{'type':Sequelize[_0x7623('0x2')],'unique':_0x7623('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7623('0x2')]},'timeout':{'type':Sequelize[_0x7623('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7623('0x5'),_0x7623('0x6'),_0x7623('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xed5e=['sequelize','STRING','name','ENUM','rrmemory'];(function(_0x560924,_0x258a47){var _0x5c694d=function(_0x599a81){while(--_0x599a81){_0x560924['push'](_0x560924['shift']());}};_0x5c694d(++_0x258a47);}(_0xed5e,0xff));var _0xeed5=function(_0x584683,_0x46a0a4){_0x584683=_0x584683-0x0;var _0x57bbf4=_0xed5e[_0x584683];return _0x57bbf4;};'use strict';var Sequelize=require(_0xeed5('0x0'));module['exports']={'name':{'type':Sequelize[_0xeed5('0x1')],'unique':_0xeed5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeed5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeed5('0x3')](_0xeed5('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 80eeece..bfb70f7 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 _0x3914=['offset','undefined','limit','count','set','Content-Range','update','then','get','FaxQueues','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','where','include','query','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','findAll','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','end','json'];(function(_0x26ed95,_0x3bfdb8){var _0x421b19=function(_0xbccf8b){while(--_0xbccf8b){_0x26ed95['push'](_0x26ed95['shift']());}};_0x421b19(++_0x3bfdb8);}(_0x3914,0xeb));var _0x4391=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x3914[_0x25b24a];return _0x224e68;};'use strict';var BPromise=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var _=require('lodash');var squel=require(_0x4391('0x2'));var Redis=require(_0x4391('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x4391('0x4'))(_0x4391('0x5'));var config=require(_0x4391('0x6'));var db=require('../../mysqldb')['db'];config[_0x4391('0x7')]=_[_0x4391('0x8')](config['redis'],{'host':_0x4391('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4391('0x7')]));require('./faxQueue.socket')[_0x4391('0xa')](socket);function respondWithStatusCode(_0x17bcfb,_0x57c763){_0x57c763=_0x57c763||0xcc;return function(_0x485c75){if(_0x485c75){return _0x17bcfb[_0x4391('0xb')](_0x57c763);}return _0x17bcfb[_0x4391('0xc')](_0x57c763)[_0x4391('0xd')]();};}function respondWithResult(_0x537a92,_0x2dc345){_0x2dc345=_0x2dc345||0xc8;return function(_0x2e2293){if(_0x2e2293){return _0x537a92[_0x4391('0xc')](_0x2dc345)[_0x4391('0xe')](_0x2e2293);}};}function respondWithFilteredResult(_0x5c932f,_0x144ce3){return function(_0x1e3786){if(_0x1e3786){var _0x1577bc=typeof _0x144ce3[_0x4391('0xf')]===_0x4391('0x10')&&typeof _0x144ce3[_0x4391('0x11')]===_0x4391('0x10');var _0x30a975=_0x1e3786['count'];var _0x1a49ba=_0x1577bc?0x0:_0x144ce3[_0x4391('0xf')];var _0x3f82fb=_0x1577bc?_0x1e3786[_0x4391('0x12')]:_0x144ce3['offset']+_0x144ce3[_0x4391('0x11')];var _0x4ff882;if(_0x3f82fb>=_0x30a975){_0x3f82fb=_0x30a975;_0x4ff882=0xc8;}else{_0x4ff882=0xce;}_0x5c932f[_0x4391('0xc')](_0x4ff882);return _0x5c932f[_0x4391('0x13')](_0x4391('0x14'),_0x1a49ba+'-'+_0x3f82fb+'/'+_0x30a975)[_0x4391('0xe')](_0x1e3786);}return null;};}function saveUpdates(_0x2a79a4){return function(_0x15e884){if(_0x15e884){return _0x15e884[_0x4391('0x15')](_0x2a79a4)[_0x4391('0x16')](function(_0x58a311){return _0x58a311;});}return null;};}function removeEntity(_0x4cfa6b){return function(_0x2ecb23){if(_0x2ecb23){return _0x2ecb23['destroy']()[_0x4391('0x16')](function(){var _0x13d63f=_0x2ecb23[_0x4391('0x17')]({'plain':!![]});var _0x10271e=_0x4391('0x18');return db['UserProfileResource']['destroy']({'where':{'type':_0x10271e,'resourceId':_0x13d63f['id']}})[_0x4391('0x16')](function(){return _0x2ecb23;});})[_0x4391('0x16')](function(){_0x4cfa6b[_0x4391('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x347b11){return function(_0x23fe8c){if(!_0x23fe8c){_0x347b11[_0x4391('0xb')](0x194);}return _0x23fe8c;};}function handleError(_0x3e1e0b,_0x505d2c){_0x505d2c=_0x505d2c||0x1f4;return function(_0x105ef8){logger[_0x4391('0x19')](_0x105ef8[_0x4391('0x1a')]);if(_0x105ef8[_0x4391('0x1b')]){delete _0x105ef8[_0x4391('0x1b')];}_0x3e1e0b[_0x4391('0xc')](_0x505d2c)['send'](_0x105ef8);};}exports[_0x4391('0x1c')]=function(_0x224e13,_0x23d8a1){var _0x333ca6={};var _0x540339={'count':0x0,'rows':[]};var _0x4b0c28=_[_0x4391('0x1d')](db[_0x4391('0x1e')][_0x4391('0x1f')],function(_0x197408){return{'name':_0x197408[_0x4391('0x20')],'type':_0x197408['type']['key']};});_0x333ca6=qs['getOptions'](_0x4b0c28,_0x224e13);var _0x5a03ee={'where':_0x333ca6[_0x4391('0x21')]};return db[_0x4391('0x1e')][_0x4391('0x12')](_0x5a03ee)[_0x4391('0x16')](function(_0x49aa36){_0x540339[_0x4391('0x12')]=_0x49aa36;_0x333ca6[_0x4391('0x22')]=qs[_0x4391('0x22')](_0x224e13[_0x4391('0x23')]);return db[_0x4391('0x1e')]['findAll'](_0x333ca6);})[_0x4391('0x16')](function(_0x3edb24){_0x540339[_0x4391('0x24')]=_0x3edb24;return _0x540339;})[_0x4391('0x16')](respondWithFilteredResult(_0x23d8a1,_0x333ca6))[_0x4391('0x25')](handleError(_0x23d8a1,null));};exports[_0x4391('0x26')]=function(_0x35eaa3,_0x1b4f0d){var _0x1e3f42={'raw':!![],'where':{'id':_0x35eaa3[_0x4391('0x27')]['id']}},_0x8851cb={};_0x8851cb['model']=_[_0x4391('0x28')](db['FaxQueue'][_0x4391('0x1f')]);_0x8851cb['query']=_['keys'](_0x35eaa3[_0x4391('0x23')]);_0x8851cb[_0x4391('0x29')]=_[_0x4391('0x2a')](_0x8851cb[_0x4391('0x2b')],_0x8851cb[_0x4391('0x23')]);_0x1e3f42[_0x4391('0x2c')]=_[_0x4391('0x2a')](_0x8851cb['model'],qs[_0x4391('0x2d')](_0x35eaa3['query'][_0x4391('0x2d')]));_0x1e3f42['attributes']=_0x1e3f42[_0x4391('0x2c')][_0x4391('0x2e')]?_0x1e3f42[_0x4391('0x2c')]:_0x8851cb[_0x4391('0x2b')];if(_0x35eaa3[_0x4391('0x23')][_0x4391('0x2f')]){_0x1e3f42[_0x4391('0x22')]=[{'all':!![]}];}_0x1e3f42=_[_0x4391('0x30')]({},_0x1e3f42,_0x35eaa3[_0x4391('0x31')]);return db[_0x4391('0x1e')][_0x4391('0x32')](_0x1e3f42)[_0x4391('0x16')](handleEntityNotFound(_0x1b4f0d,null))[_0x4391('0x16')](respondWithResult(_0x1b4f0d,null))[_0x4391('0x25')](handleError(_0x1b4f0d,null));};exports[_0x4391('0x33')]=function(_0x459415,_0x7f513a){return db[_0x4391('0x1e')]['create'](_0x459415['body'],{})[_0x4391('0x16')](function(_0x3c0740){var _0x58e161=_0x459415[_0x4391('0x34')][_0x4391('0x17')]({'plain':!![]});if(!_0x58e161)throw new Error(_0x4391('0x35'));if(_0x58e161[_0x4391('0x36')]===_0x4391('0x34')){var _0x4a09ee=_0x3c0740[_0x4391('0x17')]({'plain':!![]});var _0x4cdace='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4cdace,'userProfileId':_0x58e161[_0x4391('0x37')]},'raw':!![]})[_0x4391('0x16')](function(_0x33736a){if(_0x33736a&&_0x33736a[_0x4391('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a09ee[_0x4391('0x1b')],'resourceId':_0x4a09ee['id'],'type':_0x33736a['name'],'sectionId':_0x33736a['id']},{})[_0x4391('0x16')](function(){return _0x3c0740;});}else{return _0x3c0740;}})[_0x4391('0x25')](function(_0x3bfcdc){logger[_0x4391('0x19')](_0x4391('0x39'),_0x3bfcdc);throw _0x3bfcdc;});}return _0x3c0740;})[_0x4391('0x16')](respondWithResult(_0x7f513a,0xc9))['catch'](handleError(_0x7f513a,null));};exports[_0x4391('0x15')]=function(_0x3da701,_0x361f44){if(_0x3da701[_0x4391('0x3a')]['id']){delete _0x3da701[_0x4391('0x3a')]['id'];}return db[_0x4391('0x1e')][_0x4391('0x32')]({'where':{'id':_0x3da701['params']['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x361f44,null))[_0x4391('0x16')](saveUpdates(_0x3da701[_0x4391('0x3a')],null))[_0x4391('0x16')](respondWithResult(_0x361f44,null))[_0x4391('0x25')](handleError(_0x361f44,null));};exports[_0x4391('0x3b')]=function(_0x354007,_0x57cc66){return db[_0x4391('0x1e')]['find']({'where':{'id':_0x354007[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x57cc66,null))[_0x4391('0x16')](removeEntity(_0x57cc66,null))[_0x4391('0x25')](handleError(_0x57cc66,null));};exports[_0x4391('0x3c')]=function(_0x356cd4,_0x34272b){return db[_0x4391('0x1e')][_0x4391('0x3c')]()[_0x4391('0x16')](respondWithResult(_0x34272b,null))[_0x4391('0x25')](handleError(_0x34272b,null));};exports[_0x4391('0x3d')]=function(_0x125bd7,_0x566cf8){var _0x5901cf={'raw':!![],'where':{}},_0x14c559={},_0x33bc3b;return db[_0x4391('0x1e')][_0x4391('0x3e')]({'where':{'id':_0x125bd7[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x566cf8,null))['then'](function(_0x2a347c){if(_0x2a347c){_0x33bc3b=_0x2a347c['get']({'plain':!![]});_0x14c559[_0x4391('0x2b')]=_['keys'](db[_0x4391('0x3f')][_0x4391('0x1f')]);_0x14c559[_0x4391('0x23')]=_[_0x4391('0x28')](_0x125bd7[_0x4391('0x23')]);_0x14c559[_0x4391('0x29')]=_['intersection'](_0x14c559[_0x4391('0x2b')],_0x14c559[_0x4391('0x23')]);_0x5901cf[_0x4391('0x2c')]=_[_0x4391('0x2a')](_0x14c559[_0x4391('0x2b')],qs[_0x4391('0x2d')](_0x125bd7[_0x4391('0x23')][_0x4391('0x2d')]));_0x5901cf[_0x4391('0x2c')]=_0x5901cf[_0x4391('0x2c')][_0x4391('0x2e')]?_0x5901cf[_0x4391('0x2c')]:_0x14c559[_0x4391('0x2b')];if(!_0x125bd7['query'][_0x4391('0x40')](_0x4391('0x41'))){_0x5901cf[_0x4391('0x11')]=qs['limit'](_0x125bd7[_0x4391('0x23')][_0x4391('0x11')]);_0x5901cf[_0x4391('0xf')]=qs['offset'](_0x125bd7[_0x4391('0x23')][_0x4391('0xf')]);}_0x5901cf['order']=qs[_0x4391('0x42')](_0x125bd7[_0x4391('0x23')][_0x4391('0x42')]);_0x5901cf[_0x4391('0x21')]=qs[_0x4391('0x29')](_[_0x4391('0x43')](_0x125bd7[_0x4391('0x23')],_0x14c559['filters']));_0x5901cf[_0x4391('0x21')][_0x4391('0x44')]=_0x2a347c['id'];if(_0x125bd7[_0x4391('0x23')][_0x4391('0x45')]){_0x5901cf[_0x4391('0x21')]=_['merge'](_0x5901cf[_0x4391('0x21')],{'$or':_[_0x4391('0x1d')](_0x5901cf[_0x4391('0x2c')],function(_0x37d701){var _0x1e65b2={};_0x1e65b2[_0x37d701]={'$like':'%'+_0x125bd7[_0x4391('0x23')]['filter']+'%'};return _0x1e65b2;})});}_0x5901cf=_[_0x4391('0x30')]({},_0x5901cf,_0x125bd7['options']);return db[_0x4391('0x3f')][_0x4391('0x46')](_0x5901cf);}})['then'](function(_0xc0676d){if(_0xc0676d){return db[_0x4391('0x47')][_0x4391('0x48')]({'where':{'id':_[_0x4391('0x1d')](_0xc0676d,_0x4391('0x49')),'role':_0x4391('0x4a')},'attributes':['id',_0x4391('0x1b'),_0x4391('0x4b'),'updatedAt',_0x4391('0x4c')]});}})[_0x4391('0x16')](function(_0x258642){if(_0x258642){return{'count':_0x258642[_0x4391('0x12')],'rows':_[_0x4391('0x1d')](_0x258642[_0x4391('0x24')],function(_0x297582){return{'membername':_0x297582['name'],'UserId':_0x297582['id'],'queue_name':_0x33bc3b[_0x4391('0x1b')],'FaxQueueId':_0x33bc3b['id'],'interface':util[_0x4391('0x4d')](_0x4391('0x4e'),_0x4391('0x4f'),_0x297582[_0x4391('0x1b')]),'penalty':0x0,'paused':_0x297582[_0x4391('0x4b')],'createdAt':_0x297582['createdAt'],'updatedAt':_0x297582[_0x4391('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4391('0x16')](respondWithFilteredResult(_0x566cf8,_0x5901cf))[_0x4391('0x25')](handleError(_0x566cf8,null));};exports[_0x4391('0x51')]=function(_0x39735f,_0x1fa57e){var _0x2cf09b={};var _0x5801c2={};var _0x3f9b7b;var _0x288fdd;return db[_0x4391('0x1e')][_0x4391('0x3e')]({'where':{'id':_0x39735f[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x1fa57e,null))[_0x4391('0x16')](function(_0xd12a69){if(_0xd12a69){_0x3f9b7b=_0xd12a69;_0x5801c2[_0x4391('0x2b')]=_[_0x4391('0x28')](db[_0x4391('0x52')][_0x4391('0x1f')]);_0x5801c2[_0x4391('0x23')]=_[_0x4391('0x28')](_0x39735f[_0x4391('0x23')]);_0x5801c2['filters']=_[_0x4391('0x2a')](_0x5801c2[_0x4391('0x2b')],_0x5801c2[_0x4391('0x23')]);_0x2cf09b[_0x4391('0x2c')]=_['intersection'](_0x5801c2['model'],qs[_0x4391('0x2d')](_0x39735f[_0x4391('0x23')][_0x4391('0x2d')]));_0x2cf09b[_0x4391('0x2c')]=_0x2cf09b['attributes'][_0x4391('0x2e')]?_0x2cf09b[_0x4391('0x2c')]:_0x5801c2[_0x4391('0x2b')];_0x2cf09b['order']=qs[_0x4391('0x42')](_0x39735f[_0x4391('0x23')][_0x4391('0x42')]);_0x2cf09b[_0x4391('0x21')]=qs['filters'](_[_0x4391('0x43')](_0x39735f[_0x4391('0x23')],_0x5801c2[_0x4391('0x29')]));if(_0x39735f[_0x4391('0x23')][_0x4391('0x45')]){_0x2cf09b[_0x4391('0x21')]=_['merge'](_0x2cf09b[_0x4391('0x21')],{'$or':_[_0x4391('0x1d')](_0x2cf09b['attributes'],function(_0x500ea5){var _0x4d071b={};_0x4d071b[_0x500ea5]={'$like':'%'+_0x39735f[_0x4391('0x23')][_0x4391('0x45')]+'%'};return _0x4d071b;})});}_0x2cf09b=_[_0x4391('0x30')]({},_0x2cf09b,_0x39735f[_0x4391('0x31')]);return _0x3f9b7b['getTeams'](_0x2cf09b);}})[_0x4391('0x16')](function(_0x5cdfed){if(_0x5cdfed){_0x288fdd=_0x5cdfed[_0x4391('0x2e')];if(!_0x39735f['query'][_0x4391('0x40')](_0x4391('0x41'))){_0x2cf09b[_0x4391('0x11')]=qs[_0x4391('0x11')](_0x39735f[_0x4391('0x23')][_0x4391('0x11')]);_0x2cf09b[_0x4391('0xf')]=qs[_0x4391('0xf')](_0x39735f['query'][_0x4391('0xf')]);}return _0x3f9b7b[_0x4391('0x51')](_0x2cf09b);}})[_0x4391('0x16')](function(_0x11fd4b){if(_0x11fd4b){return _0x11fd4b?{'count':_0x288fdd,'rows':_0x11fd4b}:null;}})['then'](respondWithResult(_0x1fa57e,null))['catch'](handleError(_0x1fa57e,null));};exports[_0x4391('0x53')]=function(_0x453a86,_0x33c129){var _0x4c2a69=_0x453a86[_0x4391('0x3a')][_0x4391('0x54')];return db[_0x4391('0x52')][_0x4391('0x46')]({'where':{'id':_0x4c2a69},'attributes':['id'],'include':[{'model':db[_0x4391('0x47')],'as':_0x4391('0x55'),'attributes':['id',_0x4391('0x1b'),_0x4391('0x56'),_0x4391('0x57'),_0x4391('0x58')],'raw':!![]}]})[_0x4391('0x16')](function(_0x53080c){if(_0x53080c){var _0x662359=_[_0x4391('0x59')](_0x53080c,function(_0x207851){var _0x27b1c6=_0x207851[_0x4391('0x17')]({'plain':!![]});return _0x27b1c6[_0x4391('0x55')];});return db[_0x4391('0x1e')][_0x4391('0x32')]({'where':{'id':_0x453a86[_0x4391('0x27')]['id']}})[_0x4391('0x16')](function(_0x261496){return db['sequelize']['transaction'](function(_0x1de6c4){return _0x261496[_0x4391('0x53')](_0x4c2a69,{'transaction':_0x1de6c4})[_0x4391('0x16')](function(){return BPromise[_0x4391('0x5a')](_0x662359,function(_0x5b3649){return db[_0x4391('0x3f')][_0x4391('0x5b')]({'where':{'UserId':_0x5b3649['id'],'FaxQueueId':_0x453a86['params']['id']},'transaction':_0x1de6c4});});})[_0x4391('0x16')](function(){_0x662359['forEach'](function(_0x489b3f){socket[_0x4391('0x5c')](_0x4391('0x5d'),{'UserId':_0x489b3f['id'],'FaxQueueId':_0x261496['id']});});});});});}})[_0x4391('0x16')](respondWithStatusCode(_0x33c129,null))[_0x4391('0x25')](handleError(_0x33c129,null));};exports[_0x4391('0x5e')]=function(_0x1e017d,_0x5b37ef){return db[_0x4391('0x52')][_0x4391('0x46')]({'where':{'id':_0x1e017d[_0x4391('0x23')][_0x4391('0x54')]},'attributes':['id'],'include':[{'model':db[_0x4391('0x47')],'as':_0x4391('0x55'),'attributes':['id'],'raw':!![]}]})[_0x4391('0x16')](handleEntityNotFound(_0x5b37ef,null))[_0x4391('0x16')](function(_0x345036){var _0x2eb0da=_[_0x4391('0x1d')](_0x345036,'id');var _0x1ed862=[];var _0x1b9430=[];var _0x129d9b=squel[_0x4391('0x5f')]();_0x129d9b[_0x4391('0x60')](_0x4391('0x61'))[_0x4391('0x62')](_0x4391('0x63'),'tq')[_0x4391('0x64')]('user_has_teams','ut',_0x4391('0x65'))['where'](_0x4391('0x66'),_0x1e017d[_0x4391('0x27')]['id']);for(var _0x2bbf13=0x0;_0x2bbf13<_0x345036[_0x4391('0x2e')];_0x2bbf13+=0x1){let _0x2c93db=_0x345036[_0x2bbf13];for(var _0xb88898=0x0;_0xb88898<_0x2c93db['Agents'][_0x4391('0x2e')];_0xb88898+=0x1){let _0x8953f0=_0x2c93db[_0x4391('0x55')][_0xb88898];var _0x38bb4c=_0x129d9b['clone']();_0x38bb4c[_0x4391('0x21')](_0x4391('0x67'),_0x8953f0['id']);_0x1b9430[_0x4391('0x68')](db[_0x4391('0x69')][_0x4391('0x23')](_0x38bb4c[_0x4391('0x6a')](),{'type':db[_0x4391('0x69')][_0x4391('0x6b')][_0x4391('0x6c')]})[_0x4391('0x16')](function(_0x44d313){if(_0x44d313['length']===0x1){return _0x8953f0['id'];}else{var _0x5a0f79=_[_0x4391('0x6d')](_['map'](_0x44d313,_0x4391('0x6e')),function(_0x142143){return _[_0x4391('0x6f')](_0x2eb0da,_0x142143);});if(_0x5a0f79){return _0x8953f0['id'];}}}));}}return BPromise['all'](_0x1b9430)[_0x4391('0x16')](function(_0x30ef9c){_0x1ed862=_(_0x1ed862)[_0x4391('0x70')](_0x30ef9c)[_0x4391('0x71')]()[_0x4391('0x72')]();return db[_0x4391('0x1e')]['find']({'where':{'id':_0x1e017d[_0x4391('0x27')]['id']}})[_0x4391('0x16')](function(_0x20f334){return db[_0x4391('0x69')][_0x4391('0x73')](function(_0x5c4488){return _0x20f334[_0x4391('0x5e')](_0x1e017d['query']['ids'],{'transaction':_0x5c4488})['then'](function(){if(!_[_0x4391('0x74')](_0x1ed862)){return _0x20f334[_0x4391('0x75')](_0x1ed862,{'transaction':_0x5c4488});}})['then'](function(){_0x1ed862['forEach'](function(_0x396574){socket[_0x4391('0x5c')](_0x4391('0x76'),{'UserId':_0x396574,'FaxQueueId':_0x20f334['id']});});});});});});})[_0x4391('0x16')](respondWithStatusCode(_0x5b37ef,null))[_0x4391('0x25')](handleError(_0x5b37ef,null));};exports[_0x4391('0x77')]=function(_0x58caec,_0x5e3383){return db[_0x4391('0x1e')][_0x4391('0x32')]({'where':{'id':_0x58caec[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x5e3383,null))[_0x4391('0x16')](function(_0x133a96){if(_0x133a96){return _0x133a96[_0x4391('0x77')](_0x58caec[_0x4391('0x3a')]['ids'],_[_0x4391('0x78')](_0x58caec[_0x4391('0x3a')],[_0x4391('0x54'),'id'])||{})[_0x4391('0x79')](function(_0x170f9b){for(var _0x4c7b96=0x0;_0x4c7b96<_0x58caec['body'][_0x4391('0x54')][_0x4391('0x2e')];_0x4c7b96+=0x1){socket['emit'](_0x4391('0x5d'),{'UserId':Number(_0x58caec['body'][_0x4391('0x54')][_0x4c7b96]),'FaxQueueId':Number(_0x58caec[_0x4391('0x27')]['id'])});}return _0x170f9b;});}})[_0x4391('0x16')](respondWithResult(_0x5e3383,null))['catch'](handleError(_0x5e3383,null));};exports[_0x4391('0x75')]=function(_0x2f51cd,_0x37fafa){return db[_0x4391('0x1e')][_0x4391('0x32')]({'where':{'id':_0x2f51cd[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x37fafa,null))[_0x4391('0x16')](function(_0x372f9c){if(_0x372f9c){return _0x372f9c[_0x4391('0x75')](_0x2f51cd[_0x4391('0x23')][_0x4391('0x54')])[_0x4391('0x16')](function(){if(_[_0x4391('0x7a')](_0x2f51cd[_0x4391('0x23')]['ids'])){for(var _0x46be7b=0x0;_0x46be7b<_0x2f51cd['query'][_0x4391('0x54')]['length'];_0x46be7b+=0x1){socket[_0x4391('0x5c')]('userFaxQueue:remove',{'UserId':Number(_0x2f51cd[_0x4391('0x23')][_0x4391('0x54')][_0x46be7b]),'FaxQueueId':Number(_0x2f51cd['params']['id'])});}}else{socket[_0x4391('0x5c')](_0x4391('0x76'),{'UserId':Number(_0x2f51cd['query']['ids']),'FaxQueueId':Number(_0x2f51cd[_0x4391('0x27')]['id'])});}});}})[_0x4391('0x16')](respondWithStatusCode(_0x37fafa,null))[_0x4391('0x25')](handleError(_0x37fafa,null));};exports[_0x4391('0x7b')]=function(_0x3f128f,_0x28db10){var _0x445dc0={};var _0x52cdc6={};var _0x135d9c;var _0x1c9161;return db[_0x4391('0x1e')][_0x4391('0x3e')]({'where':{'id':_0x3f128f[_0x4391('0x27')]['id']}})[_0x4391('0x16')](handleEntityNotFound(_0x28db10,null))[_0x4391('0x16')](function(_0x4320ca){if(_0x4320ca){_0x135d9c=_0x4320ca;_0x52cdc6[_0x4391('0x2b')]=_[_0x4391('0x28')](db[_0x4391('0x47')][_0x4391('0x1f')]);_0x52cdc6['query']=_['keys'](_0x3f128f['query']);_0x52cdc6['filters']=_[_0x4391('0x2a')](_0x52cdc6[_0x4391('0x2b')],_0x52cdc6[_0x4391('0x23')]);_0x445dc0[_0x4391('0x2c')]=_['intersection'](_0x52cdc6[_0x4391('0x2b')],qs[_0x4391('0x2d')](_0x3f128f[_0x4391('0x23')][_0x4391('0x2d')]));_0x445dc0[_0x4391('0x2c')]=_0x445dc0[_0x4391('0x2c')][_0x4391('0x2e')]?_0x445dc0['attributes']:_0x52cdc6[_0x4391('0x2b')];_0x445dc0[_0x4391('0x7c')]=qs[_0x4391('0x42')](_0x3f128f[_0x4391('0x23')][_0x4391('0x42')]);_0x445dc0['where']=qs[_0x4391('0x29')](_[_0x4391('0x43')](_0x3f128f[_0x4391('0x23')],_0x52cdc6[_0x4391('0x29')]));if(_0x3f128f['query'][_0x4391('0x45')]){_0x445dc0[_0x4391('0x21')]=_[_0x4391('0x30')](_0x445dc0[_0x4391('0x21')],{'$or':_[_0x4391('0x1d')](_0x445dc0[_0x4391('0x2c')],function(_0x161f29){var _0x3b251f={};_0x3b251f[_0x161f29]={'$like':'%'+_0x3f128f['query'][_0x4391('0x45')]+'%'};return _0x3b251f;})});}_0x445dc0=_[_0x4391('0x30')]({},_0x445dc0,_0x3f128f[_0x4391('0x31')]);return _0x135d9c[_0x4391('0x7b')](_0x445dc0);}})[_0x4391('0x16')](function(_0x4e8d3c){if(_0x4e8d3c){_0x1c9161=_0x4e8d3c[_0x4391('0x2e')];if(!_0x3f128f[_0x4391('0x23')][_0x4391('0x40')](_0x4391('0x41'))){_0x445dc0[_0x4391('0x11')]=qs[_0x4391('0x11')](_0x3f128f[_0x4391('0x23')]['limit']);_0x445dc0['offset']=qs[_0x4391('0xf')](_0x3f128f[_0x4391('0x23')][_0x4391('0xf')]);}return _0x135d9c[_0x4391('0x7b')](_0x445dc0);}})[_0x4391('0x16')](function(_0x45da57){if(_0x45da57){return _0x45da57?{'count':_0x1c9161,'rows':_0x45da57}:null;}})[_0x4391('0x16')](respondWithResult(_0x28db10,null))[_0x4391('0x25')](handleError(_0x28db10,null));}; \ No newline at end of file +var _0xdded=['addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','end','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','user','role','FaxQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','findOne','Team','rawAttributes','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','isEmpty','removeAgents'];(function(_0x58771a,_0x4b76a4){var _0xf5548c=function(_0x56c094){while(--_0x56c094){_0x58771a['push'](_0x58771a['shift']());}};_0xf5548c(++_0x4b76a4);}(_0xdded,0x17a));var _0xddde=function(_0x5538eb,_0x39e558){_0x5538eb=_0x5538eb-0x0;var _0x54cf03=_0xdded[_0x5538eb];return _0x54cf03;};'use strict';var BPromise=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var _=require(_0xddde('0x2'));var squel=require(_0xddde('0x3'));var Redis=require(_0xddde('0x4'));var qs=require(_0xddde('0x5'));var logger=require('../../config/logger')(_0xddde('0x6'));var config=require(_0xddde('0x7'));var db=require(_0xddde('0x8'))['db'];config[_0xddde('0x9')]=_[_0xddde('0xa')](config[_0xddde('0x9')],{'host':_0xddde('0xb'),'port':0x18eb});var socket=require(_0xddde('0xc'))(new Redis(config[_0xddde('0x9')]));require(_0xddde('0xd'))[_0xddde('0xe')](socket);function respondWithStatusCode(_0x5f1a34,_0x32723a){_0x32723a=_0x32723a||0xcc;return function(_0x4f0f3c){if(_0x4f0f3c){return _0x5f1a34['sendStatus'](_0x32723a);}return _0x5f1a34['status'](_0x32723a)[_0xddde('0xf')]();};}function respondWithResult(_0x567859,_0x247097){_0x247097=_0x247097||0xc8;return function(_0x5a01fc){if(_0x5a01fc){return _0x567859[_0xddde('0x10')](_0x247097)[_0xddde('0x11')](_0x5a01fc);}};}function respondWithFilteredResult(_0xaaed0c,_0x27a882){return function(_0x29a446){if(_0x29a446){var _0xb8ed21=typeof _0x27a882[_0xddde('0x12')]===_0xddde('0x13')&&typeof _0x27a882['limit']===_0xddde('0x13');var _0x218779=_0x29a446[_0xddde('0x14')];var _0x860ff4=_0xb8ed21?0x0:_0x27a882[_0xddde('0x12')];var _0x31c111=_0xb8ed21?_0x29a446['count']:_0x27a882[_0xddde('0x12')]+_0x27a882[_0xddde('0x15')];var _0x3698d4;if(_0x31c111>=_0x218779){_0x31c111=_0x218779;_0x3698d4=0xc8;}else{_0x3698d4=0xce;}_0xaaed0c['status'](_0x3698d4);return _0xaaed0c['set'](_0xddde('0x16'),_0x860ff4+'-'+_0x31c111+'/'+_0x218779)['json'](_0x29a446);}return null;};}function saveUpdates(_0x30a9da){return function(_0x441bc9){if(_0x441bc9){return _0x441bc9[_0xddde('0x17')](_0x30a9da)[_0xddde('0x18')](function(_0x2f0e58){return _0x2f0e58;});}return null;};}function removeEntity(_0x55349b){return function(_0x249f19){if(_0x249f19){return _0x249f19[_0xddde('0x19')]()['then'](function(){var _0x221df0=_0x249f19[_0xddde('0x1a')]({'plain':!![]});var _0x556a47='FaxQueues';return db[_0xddde('0x1b')]['destroy']({'where':{'type':_0x556a47,'resourceId':_0x221df0['id']}})[_0xddde('0x18')](function(){return _0x249f19;});})['then'](function(){_0x55349b[_0xddde('0x10')](0xcc)[_0xddde('0xf')]();});}};}function handleEntityNotFound(_0x558e37){return function(_0x4ae0a8){if(!_0x4ae0a8){_0x558e37[_0xddde('0x1c')](0x194);}return _0x4ae0a8;};}function handleError(_0x107bca,_0x97bb0f){_0x97bb0f=_0x97bb0f||0x1f4;return function(_0x275f76){logger[_0xddde('0x1d')](_0x275f76[_0xddde('0x1e')]);if(_0x275f76[_0xddde('0x1f')]){delete _0x275f76['name'];}_0x107bca['status'](_0x97bb0f)[_0xddde('0x20')](_0x275f76);};}exports[_0xddde('0x21')]=function(_0x40f2d6,_0x306c01){var _0xdb57ef={};var _0x533332={'count':0x0,'rows':[]};var _0x394da0=_[_0xddde('0x22')](db['FaxQueue']['rawAttributes'],function(_0xa60e85){return{'name':_0xa60e85[_0xddde('0x23')],'type':_0xa60e85['type'][_0xddde('0x24')]};});_0xdb57ef=qs[_0xddde('0x25')](_0x394da0,_0x40f2d6);var _0x5328ac={'where':_0xdb57ef[_0xddde('0x26')]};return db[_0xddde('0x27')][_0xddde('0x14')](_0x5328ac)[_0xddde('0x18')](function(_0x477d44){_0x533332[_0xddde('0x14')]=_0x477d44;_0xdb57ef[_0xddde('0x28')]=qs[_0xddde('0x28')](_0x40f2d6[_0xddde('0x29')]);return db[_0xddde('0x27')][_0xddde('0x2a')](_0xdb57ef);})[_0xddde('0x18')](function(_0xe3d006){_0x533332[_0xddde('0x2b')]=_0xe3d006;return _0x533332;})[_0xddde('0x18')](respondWithFilteredResult(_0x306c01,_0xdb57ef))[_0xddde('0x2c')](handleError(_0x306c01,null));};exports[_0xddde('0x2d')]=function(_0x24f01b,_0x2969b0){var _0x2c5d25={'raw':!![],'where':{'id':_0x24f01b['params']['id']}},_0x483c9d={};_0x483c9d[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x27')]['rawAttributes']);_0x483c9d['query']=_[_0xddde('0x2f')](_0x24f01b[_0xddde('0x29')]);_0x483c9d[_0xddde('0x30')]=_[_0xddde('0x31')](_0x483c9d['model'],_0x483c9d[_0xddde('0x29')]);_0x2c5d25['attributes']=_[_0xddde('0x31')](_0x483c9d[_0xddde('0x2e')],qs[_0xddde('0x32')](_0x24f01b[_0xddde('0x29')][_0xddde('0x32')]));_0x2c5d25[_0xddde('0x33')]=_0x2c5d25[_0xddde('0x33')][_0xddde('0x34')]?_0x2c5d25[_0xddde('0x33')]:_0x483c9d[_0xddde('0x2e')];if(_0x24f01b[_0xddde('0x29')][_0xddde('0x35')]){_0x2c5d25['include']=[{'all':!![]}];}_0x2c5d25=_[_0xddde('0x36')]({},_0x2c5d25,_0x24f01b[_0xddde('0x37')]);return db['FaxQueue']['find'](_0x2c5d25)['then'](handleEntityNotFound(_0x2969b0,null))[_0xddde('0x18')](respondWithResult(_0x2969b0,null))[_0xddde('0x2c')](handleError(_0x2969b0,null));};exports[_0xddde('0x38')]=function(_0x12431d,_0x2825c6){return db[_0xddde('0x27')][_0xddde('0x38')](_0x12431d['body'],{})['then'](function(_0x2d7936){var _0x5595a7=_0x12431d[_0xddde('0x39')][_0xddde('0x1a')]({'plain':!![]});if(!_0x5595a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5595a7[_0xddde('0x3a')]===_0xddde('0x39')){var _0x616bc6=_0x2d7936['get']({'plain':!![]});var _0x5cb615=_0xddde('0x3b');return db['UserProfileSection'][_0xddde('0x3c')]({'where':{'name':_0x5cb615,'userProfileId':_0x5595a7[_0xddde('0x3d')]},'raw':!![]})[_0xddde('0x18')](function(_0x216b12){if(_0x216b12&&_0x216b12[_0xddde('0x3e')]===0x0){return db[_0xddde('0x1b')]['create']({'name':_0x616bc6[_0xddde('0x1f')],'resourceId':_0x616bc6['id'],'type':_0x216b12[_0xddde('0x1f')],'sectionId':_0x216b12['id']},{})[_0xddde('0x18')](function(){return _0x2d7936;});}else{return _0x2d7936;}})[_0xddde('0x2c')](function(_0x10d9d3){logger['error'](_0xddde('0x3f'),_0x10d9d3);throw _0x10d9d3;});}return _0x2d7936;})[_0xddde('0x18')](respondWithResult(_0x2825c6,0xc9))[_0xddde('0x2c')](handleError(_0x2825c6,null));};exports[_0xddde('0x17')]=function(_0x21b469,_0xb0c016){if(_0x21b469[_0xddde('0x40')]['id']){delete _0x21b469[_0xddde('0x40')]['id'];}return db[_0xddde('0x27')]['find']({'where':{'id':_0x21b469[_0xddde('0x41')]['id']}})['then'](handleEntityNotFound(_0xb0c016,null))[_0xddde('0x18')](saveUpdates(_0x21b469[_0xddde('0x40')],null))['then'](respondWithResult(_0xb0c016,null))[_0xddde('0x2c')](handleError(_0xb0c016,null));};exports[_0xddde('0x19')]=function(_0x3b154b,_0x4c70ae){return db['FaxQueue']['find']({'where':{'id':_0x3b154b[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x4c70ae,null))[_0xddde('0x18')](removeEntity(_0x4c70ae,null))[_0xddde('0x2c')](handleError(_0x4c70ae,null));};exports['describe']=function(_0xc26795,_0x338f93){return db[_0xddde('0x27')]['describe']()[_0xddde('0x18')](respondWithResult(_0x338f93,null))[_0xddde('0x2c')](handleError(_0x338f93,null));};exports[_0xddde('0x42')]=function(_0x42371e,_0x42388c){var _0x4dbf84={'raw':!![],'where':{}},_0x3ac8c3={},_0x497898;return db[_0xddde('0x27')]['findOne']({'where':{'id':_0x42371e[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x42388c,null))[_0xddde('0x18')](function(_0x83ee21){if(_0x83ee21){_0x497898=_0x83ee21[_0xddde('0x1a')]({'plain':!![]});_0x3ac8c3[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x43')]['rawAttributes']);_0x3ac8c3[_0xddde('0x29')]=_[_0xddde('0x2f')](_0x42371e[_0xddde('0x29')]);_0x3ac8c3[_0xddde('0x30')]=_[_0xddde('0x31')](_0x3ac8c3[_0xddde('0x2e')],_0x3ac8c3['query']);_0x4dbf84[_0xddde('0x33')]=_[_0xddde('0x31')](_0x3ac8c3[_0xddde('0x2e')],qs[_0xddde('0x32')](_0x42371e[_0xddde('0x29')]['fields']));_0x4dbf84[_0xddde('0x33')]=_0x4dbf84[_0xddde('0x33')][_0xddde('0x34')]?_0x4dbf84[_0xddde('0x33')]:_0x3ac8c3[_0xddde('0x2e')];if(!_0x42371e[_0xddde('0x29')][_0xddde('0x44')](_0xddde('0x45'))){_0x4dbf84[_0xddde('0x15')]=qs[_0xddde('0x15')](_0x42371e[_0xddde('0x29')][_0xddde('0x15')]);_0x4dbf84[_0xddde('0x12')]=qs[_0xddde('0x12')](_0x42371e[_0xddde('0x29')][_0xddde('0x12')]);}_0x4dbf84[_0xddde('0x46')]=qs[_0xddde('0x47')](_0x42371e['query']['sort']);_0x4dbf84[_0xddde('0x26')]=qs[_0xddde('0x30')](_[_0xddde('0x48')](_0x42371e[_0xddde('0x29')],_0x3ac8c3[_0xddde('0x30')]));_0x4dbf84['where'][_0xddde('0x49')]=_0x83ee21['id'];if(_0x42371e[_0xddde('0x29')][_0xddde('0x4a')]){_0x4dbf84[_0xddde('0x26')]=_[_0xddde('0x36')](_0x4dbf84[_0xddde('0x26')],{'$or':_['map'](_0x4dbf84[_0xddde('0x33')],function(_0x14dcc3){var _0x15ab38={};_0x15ab38[_0x14dcc3]={'$like':'%'+_0x42371e['query'][_0xddde('0x4a')]+'%'};return _0x15ab38;})});}_0x4dbf84=_[_0xddde('0x36')]({},_0x4dbf84,_0x42371e['options']);return db['UserFaxQueue']['findAll'](_0x4dbf84);}})[_0xddde('0x18')](function(_0x4c8fef){if(_0x4c8fef){return db[_0xddde('0x4b')][_0xddde('0x4c')]({'where':{'id':_[_0xddde('0x22')](_0x4c8fef,_0xddde('0x4d')),'role':_0xddde('0x4e')},'attributes':['id','name','faxPause',_0xddde('0x4f'),_0xddde('0x50')]});}})['then'](function(_0xcc5e3a){if(_0xcc5e3a){return{'count':_0xcc5e3a[_0xddde('0x14')],'rows':_[_0xddde('0x22')](_0xcc5e3a[_0xddde('0x2b')],function(_0x34e3d9){return{'membername':_0x34e3d9[_0xddde('0x1f')],'UserId':_0x34e3d9['id'],'queue_name':_0x497898[_0xddde('0x1f')],'FaxQueueId':_0x497898['id'],'interface':util[_0xddde('0x51')](_0xddde('0x52'),_0xddde('0x53'),_0x34e3d9['name']),'penalty':0x0,'paused':_0x34e3d9[_0xddde('0x54')],'createdAt':_0x34e3d9['createdAt'],'updatedAt':_0x34e3d9[_0xddde('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xddde('0x18')](respondWithFilteredResult(_0x42388c,_0x4dbf84))['catch'](handleError(_0x42388c,null));};exports['getTeams']=function(_0x5725ef,_0x1430bb){var _0x51589c={};var _0x31eb36={};var _0x20f512;var _0x1fbca9;return db['FaxQueue'][_0xddde('0x55')]({'where':{'id':_0x5725ef[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x1430bb,null))['then'](function(_0x460b04){if(_0x460b04){_0x20f512=_0x460b04;_0x31eb36[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x56')][_0xddde('0x57')]);_0x31eb36['query']=_[_0xddde('0x2f')](_0x5725ef['query']);_0x31eb36[_0xddde('0x30')]=_[_0xddde('0x31')](_0x31eb36[_0xddde('0x2e')],_0x31eb36['query']);_0x51589c['attributes']=_[_0xddde('0x31')](_0x31eb36['model'],qs[_0xddde('0x32')](_0x5725ef[_0xddde('0x29')][_0xddde('0x32')]));_0x51589c[_0xddde('0x33')]=_0x51589c[_0xddde('0x33')][_0xddde('0x34')]?_0x51589c[_0xddde('0x33')]:_0x31eb36[_0xddde('0x2e')];_0x51589c[_0xddde('0x46')]=qs['sort'](_0x5725ef[_0xddde('0x29')]['sort']);_0x51589c[_0xddde('0x26')]=qs[_0xddde('0x30')](_['pick'](_0x5725ef[_0xddde('0x29')],_0x31eb36[_0xddde('0x30')]));if(_0x5725ef[_0xddde('0x29')][_0xddde('0x4a')]){_0x51589c[_0xddde('0x26')]=_[_0xddde('0x36')](_0x51589c[_0xddde('0x26')],{'$or':_[_0xddde('0x22')](_0x51589c['attributes'],function(_0x207baf){var _0x141103={};_0x141103[_0x207baf]={'$like':'%'+_0x5725ef[_0xddde('0x29')]['filter']+'%'};return _0x141103;})});}_0x51589c=_[_0xddde('0x36')]({},_0x51589c,_0x5725ef['options']);return _0x20f512[_0xddde('0x58')](_0x51589c);}})[_0xddde('0x18')](function(_0x3ca2cf){if(_0x3ca2cf){_0x1fbca9=_0x3ca2cf['length'];if(!_0x5725ef[_0xddde('0x29')]['hasOwnProperty'](_0xddde('0x45'))){_0x51589c['limit']=qs['limit'](_0x5725ef[_0xddde('0x29')][_0xddde('0x15')]);_0x51589c[_0xddde('0x12')]=qs['offset'](_0x5725ef[_0xddde('0x29')][_0xddde('0x12')]);}return _0x20f512['getTeams'](_0x51589c);}})[_0xddde('0x18')](function(_0x5440d4){if(_0x5440d4){return _0x5440d4?{'count':_0x1fbca9,'rows':_0x5440d4}:null;}})['then'](respondWithResult(_0x1430bb,null))[_0xddde('0x2c')](handleError(_0x1430bb,null));};exports[_0xddde('0x59')]=function(_0x38b5d1,_0x497989){var _0x55a315=_0x38b5d1['body'][_0xddde('0x5a')];return db[_0xddde('0x56')][_0xddde('0x2a')]({'where':{'id':_0x55a315},'attributes':['id'],'include':[{'model':db[_0xddde('0x4b')],'as':_0xddde('0x5b'),'attributes':['id',_0xddde('0x1f'),_0xddde('0x5c'),'voicePause',_0xddde('0x5d')],'raw':!![]}]})['then'](function(_0x970ea6){if(_0x970ea6){var _0x45db05=_[_0xddde('0x5e')](_0x970ea6,function(_0x1c5cf6){var _0x16e211=_0x1c5cf6['get']({'plain':!![]});return _0x16e211[_0xddde('0x5b')];});return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x38b5d1['params']['id']}})[_0xddde('0x18')](function(_0x86dcad){return db[_0xddde('0x5f')][_0xddde('0x60')](function(_0x121837){return _0x86dcad[_0xddde('0x59')](_0x55a315,{'transaction':_0x121837})[_0xddde('0x18')](function(){return BPromise[_0xddde('0x61')](_0x45db05,function(_0x12422a){return db[_0xddde('0x43')][_0xddde('0x62')]({'where':{'UserId':_0x12422a['id'],'FaxQueueId':_0x38b5d1[_0xddde('0x41')]['id']},'transaction':_0x121837});});})['then'](function(){_0x45db05[_0xddde('0x63')](function(_0x5ca8cb){socket[_0xddde('0x64')](_0xddde('0x65'),{'UserId':_0x5ca8cb['id'],'FaxQueueId':_0x86dcad['id']});});});});});}})[_0xddde('0x18')](respondWithStatusCode(_0x497989,null))[_0xddde('0x2c')](handleError(_0x497989,null));};exports[_0xddde('0x66')]=function(_0x56ebba,_0x18bc86){return db['Team'][_0xddde('0x2a')]({'where':{'id':_0x56ebba['query'][_0xddde('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xddde('0x4b')],'as':_0xddde('0x5b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x18bc86,null))['then'](function(_0x2708bc){var _0x30b9e6=_[_0xddde('0x22')](_0x2708bc,'id');var _0x4d9ee0=[];var _0x38c130=[];var _0x5ae4c1=squel['select']();_0x5ae4c1['field'](_0xddde('0x67'))[_0xddde('0x68')]('team_has_fax_queues','tq')[_0xddde('0x69')](_0xddde('0x6a'),'ut',_0xddde('0x6b'))[_0xddde('0x26')](_0xddde('0x6c'),_0x56ebba[_0xddde('0x41')]['id']);for(var _0x570912=0x0;_0x570912<_0x2708bc['length'];_0x570912+=0x1){let _0x562bf9=_0x2708bc[_0x570912];for(var _0x76548d=0x0;_0x76548d<_0x562bf9['Agents'][_0xddde('0x34')];_0x76548d+=0x1){let _0x747553=_0x562bf9[_0xddde('0x5b')][_0x76548d];var _0x3dcd02=_0x5ae4c1[_0xddde('0x6d')]();_0x3dcd02[_0xddde('0x26')]('ut.UserId\x20=\x20?',_0x747553['id']);_0x38c130[_0xddde('0x6e')](db[_0xddde('0x5f')]['query'](_0x3dcd02[_0xddde('0x6f')](),{'type':db[_0xddde('0x5f')][_0xddde('0x70')][_0xddde('0x71')]})[_0xddde('0x18')](function(_0x232a7e){if(_0x232a7e[_0xddde('0x34')]===0x1){return _0x747553['id'];}else{var _0x2ff77b=_['every'](_[_0xddde('0x22')](_0x232a7e,_0xddde('0x72')),function(_0x2c38a0){return _[_0xddde('0x73')](_0x30b9e6,_0x2c38a0);});if(_0x2ff77b){return _0x747553['id'];}}}));}}return BPromise['all'](_0x38c130)[_0xddde('0x18')](function(_0x1bf965){_0x4d9ee0=_(_0x4d9ee0)['union'](_0x1bf965)['compact']()['value']();return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x56ebba['params']['id']}})[_0xddde('0x18')](function(_0x29e936){return db['sequelize'][_0xddde('0x60')](function(_0x4e4226){return _0x29e936[_0xddde('0x66')](_0x56ebba[_0xddde('0x29')]['ids'],{'transaction':_0x4e4226})['then'](function(){if(!_[_0xddde('0x74')](_0x4d9ee0)){return _0x29e936[_0xddde('0x75')](_0x4d9ee0,{'transaction':_0x4e4226});}})[_0xddde('0x18')](function(){_0x4d9ee0[_0xddde('0x63')](function(_0x3272ba){socket['emit']('userFaxQueue:remove',{'UserId':_0x3272ba,'FaxQueueId':_0x29e936['id']});});});});});});})['then'](respondWithStatusCode(_0x18bc86,null))[_0xddde('0x2c')](handleError(_0x18bc86,null));};exports[_0xddde('0x76')]=function(_0x241fc1,_0x335291){return db['FaxQueue']['find']({'where':{'id':_0x241fc1[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x335291,null))[_0xddde('0x18')](function(_0xeca6a3){if(_0xeca6a3){return _0xeca6a3['addAgents'](_0x241fc1['body']['ids'],_[_0xddde('0x77')](_0x241fc1['body'],[_0xddde('0x5a'),'id'])||{})[_0xddde('0x78')](function(_0x10b4b8){for(var _0x437ebb=0x0;_0x437ebb<_0x241fc1[_0xddde('0x40')][_0xddde('0x5a')][_0xddde('0x34')];_0x437ebb+=0x1){socket[_0xddde('0x64')]('userFaxQueue:save',{'UserId':Number(_0x241fc1[_0xddde('0x40')]['ids'][_0x437ebb]),'FaxQueueId':Number(_0x241fc1['params']['id'])});}return _0x10b4b8;});}})[_0xddde('0x18')](respondWithResult(_0x335291,null))[_0xddde('0x2c')](handleError(_0x335291,null));};exports['removeAgents']=function(_0x38503b,_0x53bb31){return db[_0xddde('0x27')][_0xddde('0x3c')]({'where':{'id':_0x38503b[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0x53bb31,null))[_0xddde('0x18')](function(_0x51869e){if(_0x51869e){return _0x51869e[_0xddde('0x75')](_0x38503b[_0xddde('0x29')][_0xddde('0x5a')])[_0xddde('0x18')](function(){if(_[_0xddde('0x79')](_0x38503b['query'][_0xddde('0x5a')])){for(var _0x4fe083=0x0;_0x4fe083<_0x38503b[_0xddde('0x29')][_0xddde('0x5a')][_0xddde('0x34')];_0x4fe083+=0x1){socket[_0xddde('0x64')](_0xddde('0x7a'),{'UserId':Number(_0x38503b[_0xddde('0x29')][_0xddde('0x5a')][_0x4fe083]),'FaxQueueId':Number(_0x38503b[_0xddde('0x41')]['id'])});}}else{socket[_0xddde('0x64')](_0xddde('0x7a'),{'UserId':Number(_0x38503b[_0xddde('0x29')][_0xddde('0x5a')]),'FaxQueueId':Number(_0x38503b[_0xddde('0x41')]['id'])});}});}})[_0xddde('0x18')](respondWithStatusCode(_0x53bb31,null))[_0xddde('0x2c')](handleError(_0x53bb31,null));};exports[_0xddde('0x7b')]=function(_0x5d3c69,_0xa1f102){var _0x257a07={};var _0x524d63={};var _0x5048fd;var _0x34a2f6;return db['FaxQueue'][_0xddde('0x55')]({'where':{'id':_0x5d3c69[_0xddde('0x41')]['id']}})[_0xddde('0x18')](handleEntityNotFound(_0xa1f102,null))[_0xddde('0x18')](function(_0x591289){if(_0x591289){_0x5048fd=_0x591289;_0x524d63[_0xddde('0x2e')]=_[_0xddde('0x2f')](db[_0xddde('0x4b')][_0xddde('0x57')]);_0x524d63[_0xddde('0x29')]=_[_0xddde('0x2f')](_0x5d3c69[_0xddde('0x29')]);_0x524d63[_0xddde('0x30')]=_[_0xddde('0x31')](_0x524d63[_0xddde('0x2e')],_0x524d63['query']);_0x257a07['attributes']=_[_0xddde('0x31')](_0x524d63['model'],qs[_0xddde('0x32')](_0x5d3c69[_0xddde('0x29')][_0xddde('0x32')]));_0x257a07[_0xddde('0x33')]=_0x257a07[_0xddde('0x33')][_0xddde('0x34')]?_0x257a07['attributes']:_0x524d63['model'];_0x257a07[_0xddde('0x46')]=qs[_0xddde('0x47')](_0x5d3c69[_0xddde('0x29')][_0xddde('0x47')]);_0x257a07[_0xddde('0x26')]=qs[_0xddde('0x30')](_[_0xddde('0x48')](_0x5d3c69[_0xddde('0x29')],_0x524d63[_0xddde('0x30')]));if(_0x5d3c69[_0xddde('0x29')][_0xddde('0x4a')]){_0x257a07[_0xddde('0x26')]=_[_0xddde('0x36')](_0x257a07[_0xddde('0x26')],{'$or':_[_0xddde('0x22')](_0x257a07[_0xddde('0x33')],function(_0x3c779c){var _0x4e9cff={};_0x4e9cff[_0x3c779c]={'$like':'%'+_0x5d3c69[_0xddde('0x29')][_0xddde('0x4a')]+'%'};return _0x4e9cff;})});}_0x257a07=_[_0xddde('0x36')]({},_0x257a07,_0x5d3c69[_0xddde('0x37')]);return _0x5048fd[_0xddde('0x7b')](_0x257a07);}})['then'](function(_0x2e9fe8){if(_0x2e9fe8){_0x34a2f6=_0x2e9fe8[_0xddde('0x34')];if(!_0x5d3c69[_0xddde('0x29')][_0xddde('0x44')](_0xddde('0x45'))){_0x257a07[_0xddde('0x15')]=qs['limit'](_0x5d3c69[_0xddde('0x29')]['limit']);_0x257a07[_0xddde('0x12')]=qs['offset'](_0x5d3c69[_0xddde('0x29')][_0xddde('0x12')]);}return _0x5048fd[_0xddde('0x7b')](_0x257a07);}})[_0xddde('0x18')](function(_0x416988){if(_0x416988){return _0x416988?{'count':_0x34a2f6,'rows':_0x416988}:null;}})[_0xddde('0x18')](respondWithResult(_0xa1f102,null))[_0xddde('0x2c')](handleError(_0xa1f102,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c023189..8414180 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 _0x11b2=['hook','exports','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1b574e,_0x3fbab6){var _0x3b1eb8=function(_0x3b2345){while(--_0x3b2345){_0x1b574e['push'](_0x1b574e['shift']());}};_0x3b1eb8(++_0x3fbab6);}(_0x11b2,0x16a));var _0x211b=function(_0x2e6763,_0x5ab104){_0x2e6763=_0x2e6763-0x0;var _0x3c6830=_0x11b2[_0x2e6763];return _0x3c6830;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x211b('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x211b('0x1')](0x0);var events={'afterCreate':_0x211b('0x2'),'afterUpdate':'update','afterDestroy':_0x211b('0x3')};function emitEvent(_0x3dc100){return function(_0x5e0728,_0x20e385,_0x25d47e){FaxQueueEvents[_0x211b('0x4')](_0x3dc100+':'+_0x5e0728['id'],_0x5e0728);FaxQueueEvents[_0x211b('0x4')](_0x3dc100,_0x5e0728);_0x25d47e(null);};}for(var e in events){if(events[_0x211b('0x5')](e)){var event=events[e];FaxQueue[_0x211b('0x6')](e,emitEvent(event));}}module[_0x211b('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xddd5=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2fc3b1,_0x4a127d){var _0x3eadff=function(_0x355a25){while(--_0x355a25){_0x2fc3b1['push'](_0x2fc3b1['shift']());}};_0x3eadff(++_0x4a127d);}(_0xddd5,0x1e1));var _0x5ddd=function(_0x2b11db,_0x2ca47a){_0x2b11db=_0x2b11db-0x0;var _0x5f5909=_0xddd5[_0x2b11db];return _0x5f5909;};'use strict';var EventEmitter=require(_0x5ddd('0x0'));var FaxQueue=require(_0x5ddd('0x1'))['db'][_0x5ddd('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5ddd('0x3')](0x0);var events={'afterCreate':_0x5ddd('0x4'),'afterUpdate':_0x5ddd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x59eed0){return function(_0x271457,_0x648c41,_0x56cd39){FaxQueueEvents[_0x5ddd('0x6')](_0x59eed0+':'+_0x271457['id'],_0x271457);FaxQueueEvents[_0x5ddd('0x6')](_0x59eed0,_0x271457);_0x56cd39(null);};}for(var e in events){if(events[_0x5ddd('0x7')](e)){var event=events[e];FaxQueue[_0x5ddd('0x8')](e,emitEvent(event));}}module[_0x5ddd('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c1e34cb..c665dac 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 _0x5f09=['exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5d7dd3,_0x5736ea){var _0x24df5b=function(_0x38b985){while(--_0x38b985){_0x5d7dd3['push'](_0x5d7dd3['shift']());}};_0x24df5b(++_0x5736ea);}(_0x5f09,0xcf));var _0x95f0=function(_0x3e8846,_0x277090){_0x3e8846=_0x3e8846-0x0;var _0x3a7801=_0x5f09[_0x3e8846];return _0x3a7801;};'use strict';var _=require(_0x95f0('0x0'));var util=require(_0x95f0('0x1'));var logger=require(_0x95f0('0x2'))(_0x95f0('0x3'));var moment=require(_0x95f0('0x4'));var BPromise=require(_0x95f0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95f0('0x6'));var rimraf=require(_0x95f0('0x7'));var config=require(_0x95f0('0x8'));var attributes=require('./faxQueue.attributes');module[_0x95f0('0x9')]=function(_0x4818ed,_0x2c19e7){return _0x4818ed[_0x95f0('0xa')](_0x95f0('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98fd=['FaxQueue','fax_queues','../../config/logger','rimraf','./faxQueue.attributes','exports','define'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x98fd,0x6b));var _0xd98f=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x98fd[_0x576266];return _0x18234f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd98f('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd98f('0x1'));var config=require('../../config/environment');var attributes=require(_0xd98f('0x2'));module[_0xd98f('0x3')]=function(_0x39d088,_0x502b12){return _0x39d088[_0xd98f('0x4')](_0xd98f('0x5'),attributes,{'tableName':_0xd98f('0x6'),'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 4174708..4898c73 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 _0xdef3=['jayson/promise','http','redis','defaults','localhost','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2e31be,_0x54ac27){var _0x3c2bf8=function(_0x42f76e){while(--_0x42f76e){_0x2e31be['push'](_0x2e31be['shift']());}};_0x3c2bf8(++_0x54ac27);}(_0xdef3,0x14c));var _0x3def=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xdef3[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0x3def('0x0'));var util=require(_0x3def('0x1'));var moment=require(_0x3def('0x2'));var BPromise=require(_0x3def('0x3'));var rs=require(_0x3def('0x4'));var fs=require('fs');var Redis=require(_0x3def('0x5'));var db=require(_0x3def('0x6'))['db'];var utils=require(_0x3def('0x7'));var logger=require('../../config/logger')(_0x3def('0x8'));var config=require(_0x3def('0x9'));var jayson=require(_0x3def('0xa'));var client=jayson['client'][_0x3def('0xb')]({'port':0x232a});config[_0x3def('0xc')]=_[_0x3def('0xd')](config['redis'],{'host':_0x3def('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3def('0xc')]));require(_0x3def('0xf'))['register'](socket);function respondWithRpcPromise(_0x5a79fb,_0x3426c0,_0x4a5edf){return new BPromise(function(_0xd1aad8,_0x3b4a12){return client['request'](_0x5a79fb,_0x4a5edf)[_0x3def('0x10')](function(_0x3ffa20){logger[_0x3def('0x11')](_0x3def('0x12'),_0x3426c0,_0x3def('0x13'));logger[_0x3def('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3426c0,_0x3def('0x13'),JSON[_0x3def('0x15')](_0x3ffa20));if(_0x3ffa20[_0x3def('0x16')]){if(_0x3ffa20[_0x3def('0x16')]['code']===0x1f4){logger[_0x3def('0x16')](_0x3def('0x12'),_0x3426c0,_0x3ffa20[_0x3def('0x16')][_0x3def('0x17')]);return _0x3b4a12(_0x3ffa20['error'][_0x3def('0x17')]);}logger['error'](_0x3def('0x12'),_0x3426c0,_0x3ffa20[_0x3def('0x16')][_0x3def('0x17')]);return _0xd1aad8(_0x3ffa20[_0x3def('0x16')][_0x3def('0x17')]);}else{logger[_0x3def('0x11')](_0x3def('0x12'),_0x3426c0,_0x3def('0x13'));_0xd1aad8(_0x3ffa20[_0x3def('0x18')][_0x3def('0x17')]);}})[_0x3def('0x19')](function(_0x1a30f2){logger[_0x3def('0x16')](_0x3def('0x12'),_0x3426c0,_0x1a30f2);_0x3b4a12(_0x1a30f2);});});}exports[_0x3def('0x1a')]=function(_0x30bc4f){var _0x577327=this;return new Promise(function(_0x9eea27,_0x1bf9b0){return db[_0x3def('0x1b')][_0x3def('0x1c')]({'raw':_0x30bc4f['options']?_0x30bc4f[_0x3def('0x1d')][_0x3def('0x1e')]===undefined?!![]:![]:!![],'where':_0x30bc4f[_0x3def('0x1d')]?_0x30bc4f['options'][_0x3def('0x1f')]||null:null,'attributes':_0x30bc4f[_0x3def('0x1d')]?_0x30bc4f[_0x3def('0x1d')][_0x3def('0x20')]||null:null,'limit':_0x30bc4f['options']?_0x30bc4f[_0x3def('0x1d')]['limit']||null:null,'include':_0x30bc4f['options']?_0x30bc4f[_0x3def('0x1d')]['include']?_['map'](_0x30bc4f[_0x3def('0x1d')][_0x3def('0x21')],function(_0x7b5424){return{'model':db[_0x7b5424[_0x3def('0x22')]],'as':_0x7b5424['as'],'attributes':_0x7b5424[_0x3def('0x20')],'include':_0x7b5424['include']?_[_0x3def('0x23')](_0x7b5424[_0x3def('0x21')],function(_0x109929){return{'model':db[_0x109929[_0x3def('0x22')]],'as':_0x109929['as'],'attributes':_0x109929[_0x3def('0x20')],'include':_0x109929[_0x3def('0x21')]?_[_0x3def('0x23')](_0x109929[_0x3def('0x21')],function(_0x40143d){return{'model':db[_0x40143d[_0x3def('0x22')]],'as':_0x40143d['as'],'attributes':_0x40143d[_0x3def('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3def('0x10')](function(_0x244070){logger[_0x3def('0x11')](_0x3def('0x1a'),_0x30bc4f);logger[_0x3def('0x14')]('GetFaxQueue',_0x30bc4f,JSON[_0x3def('0x15')](_0x244070));_0x9eea27(_0x244070);})[_0x3def('0x19')](function(_0x4383b2){logger[_0x3def('0x16')](_0x3def('0x1a'),_0x4383b2[_0x3def('0x17')],_0x30bc4f);_0x1bf9b0(_0x577327[_0x3def('0x16')](0x1f4,_0x4383b2[_0x3def('0x17')]));});});};exports[_0x3def('0x24')]=function(_0x3f22d2){var _0x58a6d3=this;return new Promise(function(_0x1cb1ca,_0x2f893d){return db[_0x3def('0x1b')][_0x3def('0x25')]({'raw':_0x3f22d2[_0x3def('0x1d')]?_0x3f22d2['options']['raw']===undefined?!![]:![]:!![],'where':_0x3f22d2[_0x3def('0x1d')]?_0x3f22d2['options'][_0x3def('0x1f')]||null:null,'attributes':_0x3f22d2[_0x3def('0x1d')]?_0x3f22d2[_0x3def('0x1d')][_0x3def('0x20')]||null:null,'include':_0x3f22d2[_0x3def('0x1d')]?_0x3f22d2[_0x3def('0x1d')][_0x3def('0x21')]?_[_0x3def('0x23')](_0x3f22d2[_0x3def('0x1d')]['include'],function(_0x5d61b3){return{'model':db[_0x5d61b3[_0x3def('0x22')]],'as':_0x5d61b3['as'],'attributes':_0x5d61b3[_0x3def('0x20')],'include':_0x5d61b3[_0x3def('0x21')]?_[_0x3def('0x23')](_0x5d61b3[_0x3def('0x21')],function(_0x30431f){return{'model':db[_0x30431f[_0x3def('0x22')]],'as':_0x30431f['as'],'attributes':_0x30431f[_0x3def('0x20')],'include':_0x30431f[_0x3def('0x21')]?_[_0x3def('0x23')](_0x30431f[_0x3def('0x21')],function(_0x8a8bfb){return{'model':db[_0x8a8bfb['model']],'as':_0x8a8bfb['as'],'attributes':_0x8a8bfb[_0x3def('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x577d6e){logger['info']('ShowFaxQueue',_0x3f22d2);logger[_0x3def('0x14')]('ShowFaxQueue',_0x3f22d2,JSON[_0x3def('0x15')](_0x577d6e));_0x1cb1ca(_0x577d6e);})[_0x3def('0x19')](function(_0x110045){logger[_0x3def('0x16')](_0x3def('0x24'),_0x110045[_0x3def('0x17')],_0x3f22d2);_0x2f893d(_0x58a6d3[_0x3def('0x16')](0x1f4,_0x110045['message']));});});}; \ No newline at end of file +var _0xbebd=['FaxQueue','findAll','options','raw','where','include','map','attributes','model','catch','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxQueue'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbebd,0xfc));var _0xdbeb=function(_0x3aeafd,_0xc48af7){_0x3aeafd=_0x3aeafd-0x0;var _0xdd2ae7=_0xbebd[_0x3aeafd];return _0xdd2ae7;};'use strict';var _=require(_0xdbeb('0x0'));var util=require('util');var moment=require(_0xdbeb('0x1'));var BPromise=require(_0xdbeb('0x2'));var rs=require(_0xdbeb('0x3'));var fs=require('fs');var Redis=require(_0xdbeb('0x4'));var db=require(_0xdbeb('0x5'))['db'];var utils=require(_0xdbeb('0x6'));var logger=require(_0xdbeb('0x7'))(_0xdbeb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdbeb('0x9')][_0xdbeb('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdbeb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdbeb('0xc'))(new Redis(config[_0xdbeb('0xb')]));require(_0xdbeb('0xd'))[_0xdbeb('0xe')](socket);function respondWithRpcPromise(_0x87f985,_0x255b7d,_0x5cdcbf){return new BPromise(function(_0x47bbb5,_0x259647){return client[_0xdbeb('0xf')](_0x87f985,_0x5cdcbf)[_0xdbeb('0x10')](function(_0x15672b){logger[_0xdbeb('0x11')](_0xdbeb('0x12'),_0x255b7d,'request\x20sent');logger[_0xdbeb('0x13')](_0xdbeb('0x14'),_0x255b7d,_0xdbeb('0x15'),JSON[_0xdbeb('0x16')](_0x15672b));if(_0x15672b[_0xdbeb('0x17')]){if(_0x15672b[_0xdbeb('0x17')][_0xdbeb('0x18')]===0x1f4){logger[_0xdbeb('0x17')](_0xdbeb('0x12'),_0x255b7d,_0x15672b[_0xdbeb('0x17')][_0xdbeb('0x19')]);return _0x259647(_0x15672b[_0xdbeb('0x17')]['message']);}logger['error'](_0xdbeb('0x12'),_0x255b7d,_0x15672b[_0xdbeb('0x17')][_0xdbeb('0x19')]);return _0x47bbb5(_0x15672b[_0xdbeb('0x17')][_0xdbeb('0x19')]);}else{logger[_0xdbeb('0x11')](_0xdbeb('0x12'),_0x255b7d,'request\x20sent');_0x47bbb5(_0x15672b[_0xdbeb('0x1a')][_0xdbeb('0x19')]);}})['catch'](function(_0x3daa74){logger[_0xdbeb('0x17')](_0xdbeb('0x12'),_0x255b7d,_0x3daa74);_0x259647(_0x3daa74);});});}exports[_0xdbeb('0x1b')]=function(_0x2db2e8){var _0x3ea8bd=this;return new Promise(function(_0x30aa8d,_0x173cab){return db[_0xdbeb('0x1c')][_0xdbeb('0x1d')]({'raw':_0x2db2e8[_0xdbeb('0x1e')]?_0x2db2e8[_0xdbeb('0x1e')][_0xdbeb('0x1f')]===undefined?!![]:![]:!![],'where':_0x2db2e8[_0xdbeb('0x1e')]?_0x2db2e8[_0xdbeb('0x1e')][_0xdbeb('0x20')]||null:null,'attributes':_0x2db2e8[_0xdbeb('0x1e')]?_0x2db2e8[_0xdbeb('0x1e')]['attributes']||null:null,'limit':_0x2db2e8[_0xdbeb('0x1e')]?_0x2db2e8['options']['limit']||null:null,'include':_0x2db2e8[_0xdbeb('0x1e')]?_0x2db2e8[_0xdbeb('0x1e')][_0xdbeb('0x21')]?_[_0xdbeb('0x22')](_0x2db2e8[_0xdbeb('0x1e')]['include'],function(_0x4e4556){return{'model':db[_0x4e4556['model']],'as':_0x4e4556['as'],'attributes':_0x4e4556[_0xdbeb('0x23')],'include':_0x4e4556[_0xdbeb('0x21')]?_[_0xdbeb('0x22')](_0x4e4556[_0xdbeb('0x21')],function(_0xd0d3df){return{'model':db[_0xd0d3df[_0xdbeb('0x24')]],'as':_0xd0d3df['as'],'attributes':_0xd0d3df[_0xdbeb('0x23')],'include':_0xd0d3df['include']?_[_0xdbeb('0x22')](_0xd0d3df['include'],function(_0x51d66e){return{'model':db[_0x51d66e['model']],'as':_0x51d66e['as'],'attributes':_0x51d66e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x104356){logger[_0xdbeb('0x11')](_0xdbeb('0x1b'),_0x2db2e8);logger[_0xdbeb('0x13')](_0xdbeb('0x1b'),_0x2db2e8,JSON[_0xdbeb('0x16')](_0x104356));_0x30aa8d(_0x104356);})[_0xdbeb('0x25')](function(_0x3bb89a){logger['error'](_0xdbeb('0x1b'),_0x3bb89a[_0xdbeb('0x19')],_0x2db2e8);_0x173cab(_0x3ea8bd[_0xdbeb('0x17')](0x1f4,_0x3bb89a['message']));});});};exports[_0xdbeb('0x26')]=function(_0x4ddb10){var _0x2a0cd4=this;return new Promise(function(_0x337f3b,_0x2a8f8a){return db['FaxQueue'][_0xdbeb('0x27')]({'raw':_0x4ddb10[_0xdbeb('0x1e')]?_0x4ddb10['options'][_0xdbeb('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ddb10[_0xdbeb('0x1e')]?_0x4ddb10[_0xdbeb('0x1e')][_0xdbeb('0x20')]||null:null,'attributes':_0x4ddb10[_0xdbeb('0x1e')]?_0x4ddb10[_0xdbeb('0x1e')][_0xdbeb('0x23')]||null:null,'include':_0x4ddb10['options']?_0x4ddb10[_0xdbeb('0x1e')][_0xdbeb('0x21')]?_['map'](_0x4ddb10[_0xdbeb('0x1e')]['include'],function(_0x29a693){return{'model':db[_0x29a693[_0xdbeb('0x24')]],'as':_0x29a693['as'],'attributes':_0x29a693['attributes'],'include':_0x29a693[_0xdbeb('0x21')]?_['map'](_0x29a693[_0xdbeb('0x21')],function(_0x3bff96){return{'model':db[_0x3bff96['model']],'as':_0x3bff96['as'],'attributes':_0x3bff96[_0xdbeb('0x23')],'include':_0x3bff96[_0xdbeb('0x21')]?_[_0xdbeb('0x22')](_0x3bff96['include'],function(_0x2d1548){return{'model':db[_0x2d1548[_0xdbeb('0x24')]],'as':_0x2d1548['as'],'attributes':_0x2d1548[_0xdbeb('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31bc07){logger[_0xdbeb('0x11')](_0xdbeb('0x26'),_0x4ddb10);logger[_0xdbeb('0x13')]('ShowFaxQueue',_0x4ddb10,JSON[_0xdbeb('0x16')](_0x31bc07));_0x337f3b(_0x31bc07);})[_0xdbeb('0x25')](function(_0x3ec039){logger[_0xdbeb('0x17')](_0xdbeb('0x26'),_0x3ec039[_0xdbeb('0x19')],_0x4ddb10);_0x2a8f8a(_0x2a0cd4['error'](0x1f4,_0x3ec039['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 91adee8..1c4c1e1 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 _0xc1f1=['save','remove','removeListener','length','faxQueue:'];(function(_0xc09f49,_0x39eba3){var _0x5c8b60=function(_0x55ffd0){while(--_0x55ffd0){_0xc09f49['push'](_0xc09f49['shift']());}};_0x5c8b60(++_0x39eba3);}(_0xc1f1,0x122));var _0x1c1f=function(_0x16ccc4,_0x439e40){_0x16ccc4=_0x16ccc4-0x0;var _0x2d3fd0=_0xc1f1[_0x16ccc4];return _0x2d3fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x1c1f('0x0'),_0x1c1f('0x1'),'update'];function createListener(_0x293182,_0x5c0aec){return function(_0x218bc8){_0x5c0aec['emit'](_0x293182,_0x218bc8);};}function removeListener(_0x223189,_0x5f1d2e){return function(){FaxQueueEvents[_0x1c1f('0x2')](_0x223189,_0x5f1d2e);};}exports['register']=function(_0x1940d7){for(var _0x2d91a5=0x0,_0x3d44be=events[_0x1c1f('0x3')];_0x2d91a5<_0x3d44be;_0x2d91a5++){var _0x2dd1e4=events[_0x2d91a5];var _0x34b9fc=createListener(_0x1c1f('0x4')+_0x2dd1e4,_0x1940d7);FaxQueueEvents['on'](_0x2dd1e4,_0x34b9fc);}}; \ No newline at end of file +var _0x5fdc=['./faxQueue.events','update','emit','removeListener','register','length','faxQueue:'];(function(_0x197401,_0x4f34f1){var _0x4e9daf=function(_0x267485){while(--_0x267485){_0x197401['push'](_0x197401['shift']());}};_0x4e9daf(++_0x4f34f1);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x4c9c55,_0x23b6f8){_0x4c9c55=_0x4c9c55-0x0;var _0x32b352=_0x5fdc[_0x4c9c55];return _0x32b352;};'use strict';var FaxQueueEvents=require(_0xc5fd('0x0'));var events=['save','remove',_0xc5fd('0x1')];function createListener(_0x3dc4c0,_0x1e042a){return function(_0x517c4c){_0x1e042a[_0xc5fd('0x2')](_0x3dc4c0,_0x517c4c);};}function removeListener(_0x2a36a4,_0x3d4575){return function(){FaxQueueEvents[_0xc5fd('0x3')](_0x2a36a4,_0x3d4575);};}exports[_0xc5fd('0x4')]=function(_0x2a2f9c){for(var _0x34d4d5=0x0,_0x2146df=events[_0xc5fd('0x5')];_0x34d4d5<_0x2146df;_0x34d4d5++){var _0x13d010=events[_0x34d4d5];var _0x494fb3=createListener(_0xc5fd('0x6')+_0x13d010,_0x2a2f9c);FaxQueueEvents['on'](_0x13d010,_0x494fb3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 08e517f..2e258e0 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 _0xcb22=['/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xcb22,0xc8));var _0x2cb2=function(_0x3e23e8,_0x57b812){_0x3e23e8=_0x3e23e8-0x0;var _0x16ab10=_0xcb22[_0x3e23e8];return _0x16ab10;};'use strict';var multer=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var path=require(_0x2cb2('0x2'));var timeout=require(_0x2cb2('0x3'));var express=require(_0x2cb2('0x4'));var router=express[_0x2cb2('0x5')]();var fs_extra=require(_0x2cb2('0x6'));var auth=require(_0x2cb2('0x7'));var interaction=require(_0x2cb2('0x8'));var config=require(_0x2cb2('0x9'));var controller=require(_0x2cb2('0xa'));router['get']('/',auth[_0x2cb2('0xb')](),controller[_0x2cb2('0xc')]);router[_0x2cb2('0xd')](_0x2cb2('0xe'),auth[_0x2cb2('0xb')](),controller['describe']);router[_0x2cb2('0xd')](_0x2cb2('0xf'),auth['isAuthenticated'](),controller[_0x2cb2('0x10')]);router[_0x2cb2('0xd')](_0x2cb2('0x11'),auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x12')]);router[_0x2cb2('0xd')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2cb2('0x13')]);router[_0x2cb2('0xd')]('/:id/users',auth['isAuthenticated'](),controller[_0x2cb2('0x14')]);router['post']('/',auth[_0x2cb2('0xb')](),controller['create']);router[_0x2cb2('0x15')](_0x2cb2('0x16'),auth['isAuthenticated'](),controller[_0x2cb2('0x17')]);router[_0x2cb2('0x15')](_0x2cb2('0x18'),auth['isAuthenticated'](),controller[_0x2cb2('0x19')]);router[_0x2cb2('0x1a')]('/:id',auth[_0x2cb2('0xb')](),controller['update']);router[_0x2cb2('0x1b')](_0x2cb2('0xf'),auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x1c')]);router[_0x2cb2('0x1b')](_0x2cb2('0x16'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x1d')]);module[_0x2cb2('0x1e')]=router; \ No newline at end of file +var _0xb934=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb934,0x92));var _0x4b93=function(_0x426b29,_0x4369e3){_0x426b29=_0x426b29-0x0;var _0x165cb6=_0xb934[_0x426b29];return _0x165cb6;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0x8')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller['getMembers']);router[_0x4b93('0x8')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x8')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);router[_0x4b93('0x13')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0x14')]);router[_0x4b93('0x13')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x15')]);router['post'](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x16')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x17')]);router[_0x4b93('0x18')](_0x4b93('0xc'),auth['isAuthenticated'](),controller[_0x4b93('0x19')]);router[_0x4b93('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4b93('0x1a')]);router[_0x4b93('0x18')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x1b')]);module[_0x4b93('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 8d87baf..97df994 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 _0xdcb8=['STRING','DATE','sequelize','exports'];(function(_0x10dea8,_0x4f4adf){var _0x28c5bc=function(_0x3ba356){while(--_0x3ba356){_0x10dea8['push'](_0x10dea8['shift']());}};_0x28c5bc(++_0x4f4adf);}(_0xdcb8,0x7a));var _0x8dcb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcb8[_0x1facfa];return _0x9ec701;};'use strict';var moment=require('moment');var Sequelize=require(_0x8dcb('0x0'));module[_0x8dcb('0x1')]={'uniqueid':{'type':Sequelize[_0x8dcb('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8dcb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8dcb('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8dcb('0x2')]}}; \ No newline at end of file +var _0x3ee1=['exports','STRING','DATE','moment'];(function(_0xdbfec2,_0x5ccf5a){var _0x3b0ac7=function(_0x4bb75c){while(--_0x4bb75c){_0xdbfec2['push'](_0xdbfec2['shift']());}};_0x3b0ac7(++_0x5ccf5a);}(_0x3ee1,0xdb));var _0x13ee=function(_0x524bee,_0x18994d){_0x524bee=_0x524bee-0x0;var _0x36c366=_0x3ee1[_0x524bee];return _0x36c366;};'use strict';var moment=require(_0x13ee('0x0'));var Sequelize=require('sequelize');module[_0x13ee('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x13ee('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x13ee('0x3')]},'acceptAt':{'type':Sequelize[_0x13ee('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c3c1c88..890fb0c 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 _0xc577=['send','FaxQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','end','sendStatus','error','name'];(function(_0x38641a,_0x4e867e){var _0x318a9b=function(_0x1fdb3b){while(--_0x1fdb3b){_0x38641a['push'](_0x38641a['shift']());}};_0x318a9b(++_0x4e867e);}(_0xc577,0x172));var _0x7c57=function(_0x12b294,_0x192e53){_0x12b294=_0x12b294-0x0;var _0x7b92cb=_0xc577[_0x12b294];return _0x7b92cb;};'use strict';var emlformat=require(_0x7c57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c57('0x1'));var rp=require(_0x7c57('0x2'));var moment=require(_0x7c57('0x3'));var BPromise=require(_0x7c57('0x4'));var Mustache=require(_0x7c57('0x5'));var util=require(_0x7c57('0x6'));var path=require(_0x7c57('0x7'));var sox=require('sox');var csv=require(_0x7c57('0x8'));var ejs=require(_0x7c57('0x9'));var fs=require('fs');var fs_extra=require(_0x7c57('0xa'));var _=require(_0x7c57('0xb'));var squel=require(_0x7c57('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c57('0x8'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require(_0x7c57('0xf'));var qs=require(_0x7c57('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c57('0x11'));var logger=require(_0x7c57('0x12'))('api');var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require(_0x7c57('0x16'))['db'];function respondWithStatusCode(_0xbd2172,_0x10a675){_0x10a675=_0x10a675||0xcc;return function(_0x296cef){if(_0x296cef){return _0xbd2172['sendStatus'](_0x10a675);}return _0xbd2172['status'](_0x10a675)['end']();};}function respondWithResult(_0x46cae6,_0x373a4b){_0x373a4b=_0x373a4b||0xc8;return function(_0x4c5af2){if(_0x4c5af2){return _0x46cae6[_0x7c57('0x17')](_0x373a4b)[_0x7c57('0x18')](_0x4c5af2);}};}function respondWithFilteredResult(_0x11903b,_0x1ba2d0){return function(_0x14ce67){if(_0x14ce67){var _0x517d8a=typeof _0x1ba2d0['offset']===_0x7c57('0x19')&&typeof _0x1ba2d0[_0x7c57('0x1a')]===_0x7c57('0x19');var _0x3c40d3=_0x14ce67[_0x7c57('0x1b')];var _0x48cf4f=_0x517d8a?0x0:_0x1ba2d0[_0x7c57('0x1c')];var _0x30f5b1=_0x517d8a?_0x14ce67[_0x7c57('0x1b')]:_0x1ba2d0[_0x7c57('0x1c')]+_0x1ba2d0[_0x7c57('0x1a')];var _0x3e2dc0;if(_0x30f5b1>=_0x3c40d3){_0x30f5b1=_0x3c40d3;_0x3e2dc0=0xc8;}else{_0x3e2dc0=0xce;}_0x11903b[_0x7c57('0x17')](_0x3e2dc0);return _0x11903b[_0x7c57('0x1d')](_0x7c57('0x1e'),_0x48cf4f+'-'+_0x30f5b1+'/'+_0x3c40d3)['json'](_0x14ce67);}return null;};}function patchUpdates(_0x45221e){return function(_0x3472b8){try{jsonpatch[_0x7c57('0x1f')](_0x3472b8,_0x45221e,!![]);}catch(_0x373b5b){return BPromise['reject'](_0x373b5b);}return _0x3472b8['save']();};}function saveUpdates(_0x4c4140,_0x140376){return function(_0x368bb6){if(_0x368bb6){return _0x368bb6['update'](_0x4c4140)[_0x7c57('0x20')](function(_0x13f696){return _0x13f696;});}return null;};}function removeEntity(_0x260d58,_0xfb0f2e){return function(_0x4734de){if(_0x4734de){return _0x4734de[_0x7c57('0x21')]()[_0x7c57('0x20')](function(){_0x260d58['status'](0xcc)[_0x7c57('0x22')]();});}};}function handleEntityNotFound(_0x3232f8,_0x16a517){return function(_0x1641f1){if(!_0x1641f1){_0x3232f8[_0x7c57('0x23')](0x194);}return _0x1641f1;};}function handleError(_0x984924,_0x41125b){_0x41125b=_0x41125b||0x1f4;return function(_0x1219f2){logger[_0x7c57('0x24')](_0x1219f2['stack']);if(_0x1219f2['name']){delete _0x1219f2[_0x7c57('0x25')];}_0x984924[_0x7c57('0x17')](_0x41125b)[_0x7c57('0x26')](_0x1219f2);};}exports['index']=function(_0x9b9d1f,_0x59ae2f){var _0x5acc20={},_0x5ad979={},_0x1d5b54={'count':0x0,'rows':[]};var _0x50c5fa=_['map'](db[_0x7c57('0x27')][_0x7c57('0x28')],function(_0x1ce1fd){return{'name':_0x1ce1fd['fieldName'],'type':_0x1ce1fd[_0x7c57('0x29')][_0x7c57('0x2a')]};});_0x5ad979[_0x7c57('0x2b')]=_['map'](_0x50c5fa,_0x7c57('0x25'));_0x5ad979[_0x7c57('0x2c')]=_[_0x7c57('0x2d')](_0x9b9d1f[_0x7c57('0x2c')]);_0x5ad979[_0x7c57('0x2e')]=_[_0x7c57('0x2f')](_0x5ad979[_0x7c57('0x2b')],_0x5ad979[_0x7c57('0x2c')]);_0x5acc20[_0x7c57('0x30')]=_[_0x7c57('0x2f')](_0x5ad979['model'],qs[_0x7c57('0x31')](_0x9b9d1f[_0x7c57('0x2c')]['fields']));_0x5acc20[_0x7c57('0x30')]=_0x5acc20[_0x7c57('0x30')][_0x7c57('0x32')]?_0x5acc20['attributes']:_0x5ad979[_0x7c57('0x2b')];if(!_0x9b9d1f[_0x7c57('0x2c')]['hasOwnProperty'](_0x7c57('0x33'))){_0x5acc20[_0x7c57('0x1a')]=qs['limit'](_0x9b9d1f[_0x7c57('0x2c')][_0x7c57('0x1a')]);_0x5acc20[_0x7c57('0x1c')]=qs[_0x7c57('0x1c')](_0x9b9d1f['query'][_0x7c57('0x1c')]);}_0x5acc20['order']=qs['sort'](_0x9b9d1f[_0x7c57('0x2c')][_0x7c57('0x34')]);_0x5acc20[_0x7c57('0x35')]=qs[_0x7c57('0x2e')](_['pick'](_0x9b9d1f[_0x7c57('0x2c')],_0x5ad979[_0x7c57('0x2e')]),_0x50c5fa);if(_0x9b9d1f[_0x7c57('0x2c')][_0x7c57('0x36')]){_0x5acc20[_0x7c57('0x35')]=_[_0x7c57('0x37')](_0x5acc20[_0x7c57('0x35')],{'$or':_['map'](_0x50c5fa,function(_0x3cbdc7){if(_0x3cbdc7[_0x7c57('0x29')]!==_0x7c57('0x38')){var _0x35377a={};_0x35377a[_0x3cbdc7['name']]={'$like':'%'+_0x9b9d1f[_0x7c57('0x2c')][_0x7c57('0x36')]+'%'};return _0x35377a;}})});}_0x5acc20=_[_0x7c57('0x37')]({},_0x5acc20,_0x9b9d1f[_0x7c57('0x39')]);var _0x4ebbec={'where':_0x5acc20[_0x7c57('0x35')]};return db[_0x7c57('0x27')][_0x7c57('0x1b')](_0x4ebbec)[_0x7c57('0x20')](function(_0xae3f4c){_0x1d5b54[_0x7c57('0x1b')]=_0xae3f4c;if(_0x9b9d1f[_0x7c57('0x2c')][_0x7c57('0x3a')]){_0x5acc20[_0x7c57('0x3b')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x7c57('0x3c')](_0x5acc20);})['then'](function(_0x27cca7){_0x1d5b54[_0x7c57('0x3d')]=_0x27cca7;return _0x1d5b54;})[_0x7c57('0x20')](respondWithFilteredResult(_0x59ae2f,_0x5acc20))[_0x7c57('0x3e')](handleError(_0x59ae2f,null));};exports['show']=function(_0x5d99bf,_0x54982b){var _0x286cd2={'raw':!![],'where':{'id':_0x5d99bf[_0x7c57('0x3f')]['id']}},_0x2f59c0={};_0x2f59c0[_0x7c57('0x2b')]=_[_0x7c57('0x2d')](db[_0x7c57('0x27')][_0x7c57('0x28')]);_0x2f59c0['query']=_[_0x7c57('0x2d')](_0x5d99bf[_0x7c57('0x2c')]);_0x2f59c0['filters']=_[_0x7c57('0x2f')](_0x2f59c0['model'],_0x2f59c0[_0x7c57('0x2c')]);_0x286cd2[_0x7c57('0x30')]=_[_0x7c57('0x2f')](_0x2f59c0['model'],qs[_0x7c57('0x31')](_0x5d99bf[_0x7c57('0x2c')]['fields']));_0x286cd2[_0x7c57('0x30')]=_0x286cd2['attributes']['length']?_0x286cd2[_0x7c57('0x30')]:_0x2f59c0[_0x7c57('0x2b')];if(_0x5d99bf[_0x7c57('0x2c')]['includeAll']){_0x286cd2[_0x7c57('0x3b')]=[{'all':!![]}];}_0x286cd2=_[_0x7c57('0x37')]({},_0x286cd2,_0x5d99bf[_0x7c57('0x39')]);return db['FaxQueueReport'][_0x7c57('0x40')](_0x286cd2)[_0x7c57('0x20')](handleEntityNotFound(_0x54982b,null))[_0x7c57('0x20')](respondWithResult(_0x54982b,null))['catch'](handleError(_0x54982b,null));};exports[_0x7c57('0x41')]=function(_0x2bb4d2,_0x1d2ed4){return db[_0x7c57('0x27')]['create'](_0x2bb4d2[_0x7c57('0x42')],{})[_0x7c57('0x20')](respondWithResult(_0x1d2ed4,0xc9))[_0x7c57('0x3e')](handleError(_0x1d2ed4,null));};exports['update']=function(_0x236ae5,_0x35b350){if(_0x236ae5[_0x7c57('0x42')]['id']){delete _0x236ae5[_0x7c57('0x42')]['id'];}return db['FaxQueueReport'][_0x7c57('0x40')]({'where':{'id':_0x236ae5['params']['id']}})[_0x7c57('0x20')](handleEntityNotFound(_0x35b350,null))[_0x7c57('0x20')](saveUpdates(_0x236ae5[_0x7c57('0x42')],null))[_0x7c57('0x20')](respondWithResult(_0x35b350,null))[_0x7c57('0x3e')](handleError(_0x35b350,null));};exports['destroy']=function(_0x2a953e,_0x4f6d05){return db['FaxQueueReport'][_0x7c57('0x40')]({'where':{'id':_0x2a953e[_0x7c57('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4f6d05,null))[_0x7c57('0x20')](removeEntity(_0x4f6d05,null))['catch'](handleError(_0x4f6d05,null));};exports[_0x7c57('0x43')]=function(_0x3b66f3,_0x422bd6){return db['FaxQueueReport'][_0x7c57('0x43')]()[_0x7c57('0x20')](respondWithResult(_0x422bd6,null))[_0x7c57('0x3e')](handleError(_0x422bd6,null));}; \ No newline at end of file +var _0x6594=['api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','FaxQueueReport','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','merge','find','create','body','describe','request-promise','moment','bluebird','mustache','util','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'];(function(_0x1ba3c7,_0x292411){var _0x23550d=function(_0x1a9e40){while(--_0x1a9e40){_0x1ba3c7['push'](_0x1ba3c7['shift']());}};_0x23550d(++_0x292411);}(_0x6594,0xcb));var _0x4659=function(_0x3b601a,_0x1fcc08){_0x3b601a=_0x3b601a-0x0;var _0x3b4d2b=_0x6594[_0x3b601a];return _0x3b4d2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4659('0x0'));var moment=require(_0x4659('0x1'));var BPromise=require(_0x4659('0x2'));var Mustache=require(_0x4659('0x3'));var util=require(_0x4659('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4659('0x5'));var ejs=require(_0x4659('0x6'));var fs=require('fs');var fs_extra=require(_0x4659('0x7'));var _=require(_0x4659('0x8'));var squel=require('squel');var crypto=require(_0x4659('0x9'));var jsforce=require(_0x4659('0xa'));var deskjs=require(_0x4659('0xb'));var toCsv=require(_0x4659('0x5'));var querystring=require(_0x4659('0xc'));var Papa=require(_0x4659('0xd'));var Redis=require('ioredis');var authService=require(_0x4659('0xe'));var qs=require(_0x4659('0xf'));var as=require(_0x4659('0x10'));var hardwareService=require(_0x4659('0x11'));var logger=require(_0x4659('0x12'))(_0x4659('0x13'));var utils=require(_0x4659('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4659('0x15'))['db'];function respondWithStatusCode(_0x22941b,_0x1f89cf){_0x1f89cf=_0x1f89cf||0xcc;return function(_0x5389a0){if(_0x5389a0){return _0x22941b[_0x4659('0x16')](_0x1f89cf);}return _0x22941b[_0x4659('0x17')](_0x1f89cf)['end']();};}function respondWithResult(_0x5d303e,_0x1a9e9c){_0x1a9e9c=_0x1a9e9c||0xc8;return function(_0x4c3c05){if(_0x4c3c05){return _0x5d303e[_0x4659('0x17')](_0x1a9e9c)[_0x4659('0x18')](_0x4c3c05);}};}function respondWithFilteredResult(_0x37d37d,_0x5c099c){return function(_0x3d9a17){if(_0x3d9a17){var _0x429b72=typeof _0x5c099c[_0x4659('0x19')]===_0x4659('0x1a')&&typeof _0x5c099c['limit']===_0x4659('0x1a');var _0xb9e922=_0x3d9a17[_0x4659('0x1b')];var _0x2fdd7a=_0x429b72?0x0:_0x5c099c['offset'];var _0x434282=_0x429b72?_0x3d9a17[_0x4659('0x1b')]:_0x5c099c['offset']+_0x5c099c[_0x4659('0x1c')];var _0x3c7bd0;if(_0x434282>=_0xb9e922){_0x434282=_0xb9e922;_0x3c7bd0=0xc8;}else{_0x3c7bd0=0xce;}_0x37d37d[_0x4659('0x17')](_0x3c7bd0);return _0x37d37d[_0x4659('0x1d')]('Content-Range',_0x2fdd7a+'-'+_0x434282+'/'+_0xb9e922)['json'](_0x3d9a17);}return null;};}function patchUpdates(_0x494261){return function(_0x157f1a){try{jsonpatch[_0x4659('0x1e')](_0x157f1a,_0x494261,!![]);}catch(_0xd6012e){return BPromise[_0x4659('0x1f')](_0xd6012e);}return _0x157f1a[_0x4659('0x20')]();};}function saveUpdates(_0x428e2c,_0x2e773b){return function(_0x1a016e){if(_0x1a016e){return _0x1a016e['update'](_0x428e2c)['then'](function(_0x31273d){return _0x31273d;});}return null;};}function removeEntity(_0x4c40b3,_0x1e9c93){return function(_0x47c73d){if(_0x47c73d){return _0x47c73d[_0x4659('0x21')]()[_0x4659('0x22')](function(){_0x4c40b3[_0x4659('0x17')](0xcc)[_0x4659('0x23')]();});}};}function handleEntityNotFound(_0x20fc37,_0x1fe661){return function(_0x2b4ad8){if(!_0x2b4ad8){_0x20fc37[_0x4659('0x16')](0x194);}return _0x2b4ad8;};}function handleError(_0x376e34,_0x507598){_0x507598=_0x507598||0x1f4;return function(_0x428dd5){logger[_0x4659('0x24')](_0x428dd5[_0x4659('0x25')]);if(_0x428dd5[_0x4659('0x26')]){delete _0x428dd5[_0x4659('0x26')];}_0x376e34[_0x4659('0x17')](_0x507598)[_0x4659('0x27')](_0x428dd5);};}exports[_0x4659('0x28')]=function(_0x5c152b,_0x479a2e){var _0x5d0c89={},_0xde3c49={},_0x26d67f={'count':0x0,'rows':[]};var _0x5c5a31=_['map'](db[_0x4659('0x29')]['rawAttributes'],function(_0x4843f4){return{'name':_0x4843f4[_0x4659('0x2a')],'type':_0x4843f4[_0x4659('0x2b')]['key']};});_0xde3c49[_0x4659('0x2c')]=_[_0x4659('0x2d')](_0x5c5a31,_0x4659('0x26'));_0xde3c49[_0x4659('0x2e')]=_[_0x4659('0x2f')](_0x5c152b[_0x4659('0x2e')]);_0xde3c49[_0x4659('0x30')]=_['intersection'](_0xde3c49[_0x4659('0x2c')],_0xde3c49[_0x4659('0x2e')]);_0x5d0c89[_0x4659('0x31')]=_[_0x4659('0x32')](_0xde3c49['model'],qs[_0x4659('0x33')](_0x5c152b[_0x4659('0x2e')][_0x4659('0x33')]));_0x5d0c89[_0x4659('0x31')]=_0x5d0c89[_0x4659('0x31')][_0x4659('0x34')]?_0x5d0c89['attributes']:_0xde3c49['model'];if(!_0x5c152b['query'][_0x4659('0x35')](_0x4659('0x36'))){_0x5d0c89['limit']=qs[_0x4659('0x1c')](_0x5c152b[_0x4659('0x2e')]['limit']);_0x5d0c89[_0x4659('0x19')]=qs[_0x4659('0x19')](_0x5c152b['query']['offset']);}_0x5d0c89[_0x4659('0x37')]=qs[_0x4659('0x38')](_0x5c152b[_0x4659('0x2e')][_0x4659('0x38')]);_0x5d0c89[_0x4659('0x39')]=qs[_0x4659('0x30')](_[_0x4659('0x3a')](_0x5c152b[_0x4659('0x2e')],_0xde3c49[_0x4659('0x30')]),_0x5c5a31);if(_0x5c152b['query'][_0x4659('0x3b')]){_0x5d0c89[_0x4659('0x39')]=_['merge'](_0x5d0c89['where'],{'$or':_['map'](_0x5c5a31,function(_0x5f170f){if(_0x5f170f[_0x4659('0x2b')]!==_0x4659('0x3c')){var _0x26bbdd={};_0x26bbdd[_0x5f170f['name']]={'$like':'%'+_0x5c152b[_0x4659('0x2e')][_0x4659('0x3b')]+'%'};return _0x26bbdd;}})});}_0x5d0c89=_['merge']({},_0x5d0c89,_0x5c152b[_0x4659('0x3d')]);var _0x4fbabc={'where':_0x5d0c89[_0x4659('0x39')]};return db[_0x4659('0x29')]['count'](_0x4fbabc)['then'](function(_0x4142ea){_0x26d67f[_0x4659('0x1b')]=_0x4142ea;if(_0x5c152b[_0x4659('0x2e')]['includeAll']){_0x5d0c89[_0x4659('0x3e')]=[{'all':!![]}];}return db[_0x4659('0x29')]['findAll'](_0x5d0c89);})[_0x4659('0x22')](function(_0x960b61){_0x26d67f[_0x4659('0x3f')]=_0x960b61;return _0x26d67f;})[_0x4659('0x22')](respondWithFilteredResult(_0x479a2e,_0x5d0c89))[_0x4659('0x40')](handleError(_0x479a2e,null));};exports[_0x4659('0x41')]=function(_0x5a051c,_0x11e413){var _0x22e2bb={'raw':!![],'where':{'id':_0x5a051c[_0x4659('0x42')]['id']}},_0xd38f94={};_0xd38f94['model']=_['keys'](db[_0x4659('0x29')][_0x4659('0x43')]);_0xd38f94[_0x4659('0x2e')]=_[_0x4659('0x2f')](_0x5a051c[_0x4659('0x2e')]);_0xd38f94[_0x4659('0x30')]=_[_0x4659('0x32')](_0xd38f94['model'],_0xd38f94[_0x4659('0x2e')]);_0x22e2bb[_0x4659('0x31')]=_[_0x4659('0x32')](_0xd38f94[_0x4659('0x2c')],qs['fields'](_0x5a051c[_0x4659('0x2e')]['fields']));_0x22e2bb['attributes']=_0x22e2bb['attributes']['length']?_0x22e2bb['attributes']:_0xd38f94[_0x4659('0x2c')];if(_0x5a051c[_0x4659('0x2e')][_0x4659('0x44')]){_0x22e2bb[_0x4659('0x3e')]=[{'all':!![]}];}_0x22e2bb=_[_0x4659('0x45')]({},_0x22e2bb,_0x5a051c['options']);return db[_0x4659('0x29')][_0x4659('0x46')](_0x22e2bb)[_0x4659('0x22')](handleEntityNotFound(_0x11e413,null))[_0x4659('0x22')](respondWithResult(_0x11e413,null))['catch'](handleError(_0x11e413,null));};exports[_0x4659('0x47')]=function(_0x18b1d8,_0x374df3){return db[_0x4659('0x29')][_0x4659('0x47')](_0x18b1d8['body'],{})[_0x4659('0x22')](respondWithResult(_0x374df3,0xc9))[_0x4659('0x40')](handleError(_0x374df3,null));};exports['update']=function(_0x3839cc,_0x51e4ad){if(_0x3839cc[_0x4659('0x48')]['id']){delete _0x3839cc['body']['id'];}return db[_0x4659('0x29')]['find']({'where':{'id':_0x3839cc[_0x4659('0x42')]['id']}})[_0x4659('0x22')](handleEntityNotFound(_0x51e4ad,null))[_0x4659('0x22')](saveUpdates(_0x3839cc[_0x4659('0x48')],null))[_0x4659('0x22')](respondWithResult(_0x51e4ad,null))[_0x4659('0x40')](handleError(_0x51e4ad,null));};exports[_0x4659('0x21')]=function(_0x2b3716,_0x722dea){return db['FaxQueueReport'][_0x4659('0x46')]({'where':{'id':_0x2b3716[_0x4659('0x42')]['id']}})[_0x4659('0x22')](handleEntityNotFound(_0x722dea,null))[_0x4659('0x22')](removeEntity(_0x722dea,null))['catch'](handleError(_0x722dea,null));};exports[_0x4659('0x49')]=function(_0x4a8a0d,_0x1d8b61){return db[_0x4659('0x29')][_0x4659('0x49')]()[_0x4659('0x22')](respondWithResult(_0x1d8b61,null))['catch'](handleError(_0x1d8b61,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index bb6d453..5c87c6a 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x57817d,_0xc20688){var _0x20284e=function(_0x4ea152){while(--_0x4ea152){_0x57817d['push'](_0x57817d['shift']());}};_0x20284e(++_0xc20688);}(_0x326f,0xd1));var _0xf326=function(_0x229c54,_0x4642eb){_0x229c54=_0x229c54-0x0;var _0x415b8b=_0x326f[_0x229c54];return _0x415b8b;};'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','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x2397b5,_0x1e59b1){var _0x33036e=function(_0x1af69a){while(--_0x1af69a){_0x2397b5['push'](_0x2397b5['shift']());}};_0x33036e(++_0x1e59b1);}(_0x1261,0x144));var _0x1126=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x1261[_0x44c844];return _0x1d51b7;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3a12044..623eba0 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 _0xfeb2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','update','where','attributes','limit','lodash','moment','../../mysqldb','../../config/utils'];(function(_0x38f21b,_0x4d5b4b){var _0x2f2b84=function(_0x4076d1){while(--_0x4076d1){_0x38f21b['push'](_0x38f21b['shift']());}};_0x2f2b84(++_0x4d5b4b);}(_0xfeb2,0x11c));var _0x2feb=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xfeb2[_0x4394b6];return _0x360244;};'use strict';var _=require(_0x2feb('0x0'));var util=require('util');var moment=require(_0x2feb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2feb('0x2'))['db'];var utils=require(_0x2feb('0x3'));var logger=require('../../config/logger')(_0x2feb('0x4'));var config=require(_0x2feb('0x5'));var jayson=require(_0x2feb('0x6'));var client=jayson[_0x2feb('0x7')][_0x2feb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x319362,_0x4595b2,_0x585b8e){return new BPromise(function(_0x2b48ee,_0x279e8a){return client[_0x2feb('0x9')](_0x319362,_0x585b8e)[_0x2feb('0xa')](function(_0x49e0d5){logger[_0x2feb('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4595b2,_0x2feb('0xc'));logger['debug'](_0x2feb('0xd'),_0x4595b2,_0x2feb('0xc'),JSON[_0x2feb('0xe')](_0x49e0d5));if(_0x49e0d5[_0x2feb('0xf')]){if(_0x49e0d5[_0x2feb('0xf')][_0x2feb('0x10')]===0x1f4){logger[_0x2feb('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4595b2,_0x49e0d5[_0x2feb('0xf')][_0x2feb('0x11')]);return _0x279e8a(_0x49e0d5['error'][_0x2feb('0x11')]);}logger[_0x2feb('0xf')](_0x2feb('0x12'),_0x4595b2,_0x49e0d5[_0x2feb('0xf')]['message']);return _0x2b48ee(_0x49e0d5[_0x2feb('0xf')][_0x2feb('0x11')]);}else{logger[_0x2feb('0xb')](_0x2feb('0x12'),_0x4595b2,_0x2feb('0xc'));_0x2b48ee(_0x49e0d5[_0x2feb('0x13')][_0x2feb('0x11')]);}})[_0x2feb('0x14')](function(_0x58d6a7){logger['error'](_0x2feb('0x12'),_0x4595b2,_0x58d6a7);_0x279e8a(_0x58d6a7);});});}exports[_0x2feb('0x15')]=function(_0xb22e25){var _0x35c656=this;return new Promise(function(_0x47aec7,_0x20255e){return db['FaxQueueReport'][_0x2feb('0x16')](_0xb22e25[_0x2feb('0x17')],{'raw':_0xb22e25[_0x2feb('0x18')]?_0xb22e25[_0x2feb('0x18')][_0x2feb('0x19')]===undefined?!![]:![]:!![]})[_0x2feb('0xa')](function(_0x522a2b){logger['info'](_0x2feb('0x15'),_0xb22e25);logger[_0x2feb('0x1a')](_0x2feb('0x15'),_0xb22e25,JSON[_0x2feb('0xe')](_0x522a2b));_0x47aec7(_0x522a2b);})[_0x2feb('0x14')](function(_0x1e5004){logger['error']('CreateFaxQueueReport',_0x1e5004[_0x2feb('0x11')],_0xb22e25);_0x20255e(_0x35c656[_0x2feb('0xf')](0x1f4,_0x1e5004[_0x2feb('0x11')]));});});};exports[_0x2feb('0x1b')]=function(_0x3edfd1){var _0x40cd66=this;return new Promise(function(_0x1c2e1c,_0x54a821){return db['FaxQueueReport'][_0x2feb('0x1c')](_0x3edfd1[_0x2feb('0x17')],{'raw':_0x3edfd1[_0x2feb('0x18')]?_0x3edfd1['options'][_0x2feb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3edfd1[_0x2feb('0x18')]?_0x3edfd1[_0x2feb('0x18')][_0x2feb('0x1d')]||null:null,'attributes':_0x3edfd1['options']?_0x3edfd1[_0x2feb('0x18')][_0x2feb('0x1e')]||null:null,'limit':_0x3edfd1[_0x2feb('0x18')]?_0x3edfd1[_0x2feb('0x18')][_0x2feb('0x1f')]||null:null})[_0x2feb('0xa')](function(_0x18776d){logger[_0x2feb('0xb')](_0x2feb('0x1b'),_0x3edfd1);logger['debug'](_0x2feb('0x1b'),_0x3edfd1,JSON[_0x2feb('0xe')](_0x18776d));_0x1c2e1c(_0x18776d);})[_0x2feb('0x14')](function(_0x5f3995){logger[_0x2feb('0xf')]('UpdateFaxQueueReport',_0x5f3995[_0x2feb('0x11')],_0x3edfd1);_0x54a821(_0x40cd66[_0x2feb('0xf')](0x1f4,_0x5f3995['message']));});});}; \ No newline at end of file +var _0x9c11=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x446dae,_0xf93658){var _0x4ee16d=function(_0x1c2010){while(--_0x1c2010){_0x446dae['push'](_0x446dae['shift']());}};_0x4ee16d(++_0xf93658);}(_0x9c11,0x167));var _0x19c1=function(_0x25ae1c,_0x38cb01){_0x25ae1c=_0x25ae1c-0x0;var _0x2a76ed=_0x9c11[_0x25ae1c];return _0x2a76ed;};'use strict';var _=require(_0x19c1('0x0'));var util=require(_0x19c1('0x1'));var moment=require(_0x19c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x19c1('0x3'));var fs=require('fs');var Redis=require(_0x19c1('0x4'));var db=require(_0x19c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x19c1('0x6'))(_0x19c1('0x7'));var config=require(_0x19c1('0x8'));var jayson=require(_0x19c1('0x9'));var client=jayson[_0x19c1('0xa')][_0x19c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x324765,_0x2ae8c3,_0x516442){return new BPromise(function(_0x5a18a3,_0x35dd03){return client[_0x19c1('0xc')](_0x324765,_0x516442)[_0x19c1('0xd')](function(_0x47015f){logger[_0x19c1('0xe')](_0x19c1('0xf'),_0x2ae8c3,_0x19c1('0x10'));logger[_0x19c1('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2ae8c3,_0x19c1('0x10'),JSON[_0x19c1('0x12')](_0x47015f));if(_0x47015f[_0x19c1('0x13')]){if(_0x47015f['error'][_0x19c1('0x14')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2ae8c3,_0x47015f[_0x19c1('0x13')][_0x19c1('0x15')]);return _0x35dd03(_0x47015f[_0x19c1('0x13')][_0x19c1('0x15')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x2ae8c3,_0x47015f[_0x19c1('0x13')][_0x19c1('0x15')]);return _0x5a18a3(_0x47015f[_0x19c1('0x13')][_0x19c1('0x15')]);}else{logger[_0x19c1('0xe')](_0x19c1('0xf'),_0x2ae8c3,_0x19c1('0x10'));_0x5a18a3(_0x47015f[_0x19c1('0x16')][_0x19c1('0x15')]);}})['catch'](function(_0x2b1857){logger[_0x19c1('0x13')](_0x19c1('0xf'),_0x2ae8c3,_0x2b1857);_0x35dd03(_0x2b1857);});});}exports[_0x19c1('0x17')]=function(_0x360ad4){var _0x451eba=this;return new Promise(function(_0x2951c7,_0x2ff747){return db['FaxQueueReport'][_0x19c1('0x18')](_0x360ad4[_0x19c1('0x19')],{'raw':_0x360ad4[_0x19c1('0x1a')]?_0x360ad4[_0x19c1('0x1a')][_0x19c1('0x1b')]===undefined?!![]:![]:!![]})[_0x19c1('0xd')](function(_0x124509){logger[_0x19c1('0xe')](_0x19c1('0x17'),_0x360ad4);logger['debug'](_0x19c1('0x17'),_0x360ad4,JSON[_0x19c1('0x12')](_0x124509));_0x2951c7(_0x124509);})[_0x19c1('0x1c')](function(_0x5ef8fc){logger[_0x19c1('0x13')](_0x19c1('0x17'),_0x5ef8fc[_0x19c1('0x15')],_0x360ad4);_0x2ff747(_0x451eba[_0x19c1('0x13')](0x1f4,_0x5ef8fc[_0x19c1('0x15')]));});});};exports[_0x19c1('0x1d')]=function(_0x32d8ff){var _0x455275=this;return new Promise(function(_0x3f4440,_0x3b35e6){return db[_0x19c1('0x1e')][_0x19c1('0x1f')](_0x32d8ff[_0x19c1('0x19')],{'raw':_0x32d8ff[_0x19c1('0x1a')]?_0x32d8ff['options'][_0x19c1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d8ff[_0x19c1('0x1a')]?_0x32d8ff[_0x19c1('0x1a')][_0x19c1('0x20')]||null:null,'attributes':_0x32d8ff[_0x19c1('0x1a')]?_0x32d8ff[_0x19c1('0x1a')][_0x19c1('0x21')]||null:null,'limit':_0x32d8ff[_0x19c1('0x1a')]?_0x32d8ff[_0x19c1('0x1a')]['limit']||null:null})[_0x19c1('0xd')](function(_0x49d43d){logger[_0x19c1('0xe')](_0x19c1('0x1d'),_0x32d8ff);logger['debug'](_0x19c1('0x1d'),_0x32d8ff,JSON[_0x19c1('0x12')](_0x49d43d));_0x3f4440(_0x49d43d);})[_0x19c1('0x1c')](function(_0x4d73d7){logger['error']('UpdateFaxQueueReport',_0x4d73d7[_0x19c1('0x15')],_0x32d8ff);_0x3b35e6(_0x455275[_0x19c1('0x13')](0x1f4,_0x4d73d7[_0x19c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 52238c4..4740770 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 _0xe284=['describe','/:id','show','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xe284,0x147));var _0x4e28=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xe284[_0x2af053];return _0x4b4001;};'use strict';var multer=require(_0x4e28('0x0'));var util=require(_0x4e28('0x1'));var path=require('path');var timeout=require(_0x4e28('0x2'));var express=require(_0x4e28('0x3'));var router=express[_0x4e28('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e28('0x5'));var interaction=require(_0x4e28('0x6'));var config=require(_0x4e28('0x7'));var controller=require(_0x4e28('0x8'));router[_0x4e28('0x9')]('/',auth[_0x4e28('0xa')](),controller[_0x4e28('0xb')]);router[_0x4e28('0x9')](_0x4e28('0xc'),auth[_0x4e28('0xa')](),controller[_0x4e28('0xd')]);router[_0x4e28('0x9')](_0x4e28('0xe'),auth[_0x4e28('0xa')](),controller[_0x4e28('0xf')]);router['post']('/',auth[_0x4e28('0xa')](),controller[_0x4e28('0x10')]);router['put'](_0x4e28('0xe'),auth['isAuthenticated'](),controller[_0x4e28('0x11')]);router['delete'](_0x4e28('0xe'),auth['isAuthenticated'](),controller[_0x4e28('0x12')]);module[_0x4e28('0x13')]=router; \ No newline at end of file +var _0x5097=['/describe','/:id','show','create','put','update','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3dc6fc,_0x152687){var _0x944cc0=function(_0x1726ae){while(--_0x1726ae){_0x3dc6fc['push'](_0x3dc6fc['shift']());}};_0x944cc0(++_0x152687);}(_0x5097,0x96));var _0x7509=function(_0x5cc9b3,_0x554745){_0x5cc9b3=_0x5cc9b3-0x0;var _0x53d8b2=_0x5097[_0x5cc9b3];return _0x53d8b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7509('0x0'));var timeout=require(_0x7509('0x1'));var express=require(_0x7509('0x2'));var router=express[_0x7509('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7509('0x4'));var interaction=require(_0x7509('0x5'));var config=require(_0x7509('0x6'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x7509('0x7')](),controller[_0x7509('0x8')]);router[_0x7509('0x9')](_0x7509('0xa'),auth[_0x7509('0x7')](),controller['describe']);router[_0x7509('0x9')](_0x7509('0xb'),auth[_0x7509('0x7')](),controller[_0x7509('0xc')]);router['post']('/',auth[_0x7509('0x7')](),controller[_0x7509('0xd')]);router[_0x7509('0xe')](_0x7509('0xb'),auth[_0x7509('0x7')](),controller[_0x7509('0xf')]);router['delete'](_0x7509('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 32cec84..7d33b16 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x45c0be,_0x177e4f){var _0x3457c8=function(_0x528cec){while(--_0x528cec){_0x45c0be['push'](_0x45c0be['shift']());}};_0x3457c8(++_0x177e4f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xf3cd[_0x564821];return _0x2b604d;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x65ac9,_0x45668c){var _0x4c7df8=function(_0x47d500){while(--_0x47d500){_0x65ac9['push'](_0x65ac9['shift']());}};_0x4c7df8(++_0x45668c);}(_0xaa88,0x137));var _0x8aa8=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xaa88[_0x233cb1];return _0x29ee7e;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8f9a8db..0a2af25 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 _0x1712=['send','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','options','FaxTransferReport','includeAll','include','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name'];(function(_0x5cb254,_0x45eb30){var _0x16fcc9=function(_0x4b73f0){while(--_0x4b73f0){_0x5cb254['push'](_0x5cb254['shift']());}};_0x16fcc9(++_0x45eb30);}(_0x1712,0x183));var _0x2171=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x1712[_0x59710f];return _0xaae66a;};'use strict';var emlformat=require(_0x2171('0x0'));var rimraf=require(_0x2171('0x1'));var zipdir=require(_0x2171('0x2'));var jsonpatch=require(_0x2171('0x3'));var rp=require('request-promise');var moment=require(_0x2171('0x4'));var BPromise=require(_0x2171('0x5'));var Mustache=require(_0x2171('0x6'));var util=require(_0x2171('0x7'));var path=require(_0x2171('0x8'));var sox=require(_0x2171('0x9'));var csv=require(_0x2171('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2171('0xb'));var _=require(_0x2171('0xc'));var squel=require('squel');var crypto=require(_0x2171('0xd'));var jsforce=require(_0x2171('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2171('0xf'));var Papa=require('papaparse');var Redis=require(_0x2171('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2171('0x11'));var as=require(_0x2171('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2171('0x13'));var utils=require(_0x2171('0x14'));var config=require(_0x2171('0x15'));var licenseUtil=require(_0x2171('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b0b6,_0x599de5){_0x599de5=_0x599de5||0xcc;return function(_0x5d33bc){if(_0x5d33bc){return _0x30b0b6[_0x2171('0x17')](_0x599de5);}return _0x30b0b6[_0x2171('0x18')](_0x599de5)[_0x2171('0x19')]();};}function respondWithResult(_0x5124df,_0x2fd988){_0x2fd988=_0x2fd988||0xc8;return function(_0x2e5bc0){if(_0x2e5bc0){return _0x5124df[_0x2171('0x18')](_0x2fd988)[_0x2171('0x1a')](_0x2e5bc0);}};}function respondWithFilteredResult(_0x388867,_0x169497){return function(_0x1bd4fd){if(_0x1bd4fd){var _0x24df44=typeof _0x169497[_0x2171('0x1b')]==='undefined'&&typeof _0x169497[_0x2171('0x1c')]==='undefined';var _0x44f4ff=_0x1bd4fd[_0x2171('0x1d')];var _0x2d95ed=_0x24df44?0x0:_0x169497[_0x2171('0x1b')];var _0x219843=_0x24df44?_0x1bd4fd[_0x2171('0x1d')]:_0x169497[_0x2171('0x1b')]+_0x169497[_0x2171('0x1c')];var _0x2daabe;if(_0x219843>=_0x44f4ff){_0x219843=_0x44f4ff;_0x2daabe=0xc8;}else{_0x2daabe=0xce;}_0x388867[_0x2171('0x18')](_0x2daabe);return _0x388867['set'](_0x2171('0x1e'),_0x2d95ed+'-'+_0x219843+'/'+_0x44f4ff)['json'](_0x1bd4fd);}return null;};}function patchUpdates(_0xce1b73){return function(_0x8429fe){try{jsonpatch[_0x2171('0x1f')](_0x8429fe,_0xce1b73,!![]);}catch(_0x2b87ab){return BPromise[_0x2171('0x20')](_0x2b87ab);}return _0x8429fe['save']();};}function saveUpdates(_0x34242f,_0x222081){return function(_0x275a91){if(_0x275a91){return _0x275a91[_0x2171('0x21')](_0x34242f)[_0x2171('0x22')](function(_0x916054){return _0x916054;});}return null;};}function removeEntity(_0x5bbd0f,_0x1a049c){return function(_0x28fa0c){if(_0x28fa0c){return _0x28fa0c[_0x2171('0x23')]()[_0x2171('0x22')](function(){_0x5bbd0f[_0x2171('0x18')](0xcc)[_0x2171('0x19')]();});}};}function handleEntityNotFound(_0x585c16,_0x2aae8e){return function(_0x4f99d0){if(!_0x4f99d0){_0x585c16[_0x2171('0x17')](0x194);}return _0x4f99d0;};}function handleError(_0x45bb0a,_0x306a6f){_0x306a6f=_0x306a6f||0x1f4;return function(_0x531729){logger[_0x2171('0x24')](_0x531729[_0x2171('0x25')]);if(_0x531729[_0x2171('0x26')]){delete _0x531729[_0x2171('0x26')];}_0x45bb0a[_0x2171('0x18')](_0x306a6f)[_0x2171('0x27')](_0x531729);};}exports['index']=function(_0x52bb35,_0x3b278b){var _0x3c62c9={},_0x3cdc76={},_0x443f89={'count':0x0,'rows':[]};var _0x182317=_['map'](db['FaxTransferReport'][_0x2171('0x28')],function(_0x42efa4){return{'name':_0x42efa4[_0x2171('0x29')],'type':_0x42efa4[_0x2171('0x2a')][_0x2171('0x2b')]};});_0x3cdc76[_0x2171('0x2c')]=_['map'](_0x182317,_0x2171('0x26'));_0x3cdc76[_0x2171('0x2d')]=_[_0x2171('0x2e')](_0x52bb35[_0x2171('0x2d')]);_0x3cdc76['filters']=_[_0x2171('0x2f')](_0x3cdc76[_0x2171('0x2c')],_0x3cdc76[_0x2171('0x2d')]);_0x3c62c9[_0x2171('0x30')]=_[_0x2171('0x2f')](_0x3cdc76[_0x2171('0x2c')],qs[_0x2171('0x31')](_0x52bb35[_0x2171('0x2d')][_0x2171('0x31')]));_0x3c62c9['attributes']=_0x3c62c9[_0x2171('0x30')][_0x2171('0x32')]?_0x3c62c9[_0x2171('0x30')]:_0x3cdc76[_0x2171('0x2c')];if(!_0x52bb35[_0x2171('0x2d')][_0x2171('0x33')]('nolimit')){_0x3c62c9[_0x2171('0x1c')]=qs[_0x2171('0x1c')](_0x52bb35['query'][_0x2171('0x1c')]);_0x3c62c9[_0x2171('0x1b')]=qs[_0x2171('0x1b')](_0x52bb35[_0x2171('0x2d')][_0x2171('0x1b')]);}_0x3c62c9[_0x2171('0x34')]=qs[_0x2171('0x35')](_0x52bb35[_0x2171('0x2d')][_0x2171('0x35')]);_0x3c62c9[_0x2171('0x36')]=qs[_0x2171('0x37')](_['pick'](_0x52bb35[_0x2171('0x2d')],_0x3cdc76[_0x2171('0x37')]),_0x182317);if(_0x52bb35['query'][_0x2171('0x38')]){_0x3c62c9[_0x2171('0x36')]=_[_0x2171('0x39')](_0x3c62c9['where'],{'$or':_[_0x2171('0x3a')](_0x182317,function(_0xf353d6){if(_0xf353d6['type']!=='VIRTUAL'){var _0x1a320e={};_0x1a320e[_0xf353d6['name']]={'$like':'%'+_0x52bb35[_0x2171('0x2d')][_0x2171('0x38')]+'%'};return _0x1a320e;}})});}_0x3c62c9=_['merge']({},_0x3c62c9,_0x52bb35[_0x2171('0x3b')]);var _0xfd6fde={'where':_0x3c62c9['where']};return db[_0x2171('0x3c')][_0x2171('0x1d')](_0xfd6fde)['then'](function(_0xf538c8){_0x443f89['count']=_0xf538c8;if(_0x52bb35[_0x2171('0x2d')][_0x2171('0x3d')]){_0x3c62c9[_0x2171('0x3e')]=[{'all':!![]}];}return db[_0x2171('0x3c')]['findAll'](_0x3c62c9);})[_0x2171('0x22')](function(_0x274f66){_0x443f89[_0x2171('0x3f')]=_0x274f66;return _0x443f89;})['then'](respondWithFilteredResult(_0x3b278b,_0x3c62c9))['catch'](handleError(_0x3b278b,null));};exports[_0x2171('0x40')]=function(_0x5c9c7d,_0xeaa994){var _0x12a7bf={'raw':!![],'where':{'id':_0x5c9c7d[_0x2171('0x41')]['id']}},_0x2e9a75={};_0x2e9a75[_0x2171('0x2c')]=_['keys'](db[_0x2171('0x3c')][_0x2171('0x28')]);_0x2e9a75[_0x2171('0x2d')]=_['keys'](_0x5c9c7d[_0x2171('0x2d')]);_0x2e9a75[_0x2171('0x37')]=_[_0x2171('0x2f')](_0x2e9a75[_0x2171('0x2c')],_0x2e9a75[_0x2171('0x2d')]);_0x12a7bf[_0x2171('0x30')]=_['intersection'](_0x2e9a75['model'],qs[_0x2171('0x31')](_0x5c9c7d[_0x2171('0x2d')][_0x2171('0x31')]));_0x12a7bf[_0x2171('0x30')]=_0x12a7bf[_0x2171('0x30')]['length']?_0x12a7bf[_0x2171('0x30')]:_0x2e9a75['model'];if(_0x5c9c7d['query'][_0x2171('0x3d')]){_0x12a7bf[_0x2171('0x3e')]=[{'all':!![]}];}_0x12a7bf=_[_0x2171('0x39')]({},_0x12a7bf,_0x5c9c7d[_0x2171('0x3b')]);return db[_0x2171('0x3c')]['find'](_0x12a7bf)[_0x2171('0x22')](handleEntityNotFound(_0xeaa994,null))[_0x2171('0x22')](respondWithResult(_0xeaa994,null))[_0x2171('0x42')](handleError(_0xeaa994,null));};exports[_0x2171('0x43')]=function(_0x5868fb,_0x42d844){return db[_0x2171('0x3c')][_0x2171('0x43')](_0x5868fb[_0x2171('0x44')],{})[_0x2171('0x22')](respondWithResult(_0x42d844,0xc9))['catch'](handleError(_0x42d844,null));};exports[_0x2171('0x21')]=function(_0x5f176b,_0x4a739b){if(_0x5f176b[_0x2171('0x44')]['id']){delete _0x5f176b[_0x2171('0x44')]['id'];}return db[_0x2171('0x3c')][_0x2171('0x45')]({'where':{'id':_0x5f176b[_0x2171('0x41')]['id']}})[_0x2171('0x22')](handleEntityNotFound(_0x4a739b,null))[_0x2171('0x22')](saveUpdates(_0x5f176b[_0x2171('0x44')],null))[_0x2171('0x22')](respondWithResult(_0x4a739b,null))[_0x2171('0x42')](handleError(_0x4a739b,null));};exports[_0x2171('0x23')]=function(_0x4b1cd0,_0x5570aa){return db[_0x2171('0x3c')][_0x2171('0x45')]({'where':{'id':_0x4b1cd0[_0x2171('0x41')]['id']}})[_0x2171('0x22')](handleEntityNotFound(_0x5570aa,null))[_0x2171('0x22')](removeEntity(_0x5570aa,null))[_0x2171('0x42')](handleError(_0x5570aa,null));};exports['describe']=function(_0x3127f5,_0x580b56){return db['FaxTransferReport'][_0x2171('0x46')]()['then'](respondWithResult(_0x580b56,null))[_0x2171('0x42')](handleError(_0x580b56,null));}; \ No newline at end of file +var _0x91bc=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','keys'];(function(_0x3b7ba8,_0x1f9cbd){var _0x1aa709=function(_0x592055){while(--_0x592055){_0x3b7ba8['push'](_0x3b7ba8['shift']());}};_0x1aa709(++_0x1f9cbd);}(_0x91bc,0x6b));var _0xc91b=function(_0x4cfc3b,_0x256649){_0x4cfc3b=_0x4cfc3b-0x0;var _0x53ec58=_0x91bc[_0x4cfc3b];return _0x53ec58;};'use strict';var emlformat=require(_0xc91b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc91b('0x1'));var jsonpatch=require(_0xc91b('0x2'));var rp=require(_0xc91b('0x3'));var moment=require(_0xc91b('0x4'));var BPromise=require(_0xc91b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc91b('0x6'));var sox=require(_0xc91b('0x7'));var csv=require('to-csv');var ejs=require(_0xc91b('0x8'));var fs=require('fs');var fs_extra=require(_0xc91b('0x9'));var _=require(_0xc91b('0xa'));var squel=require('squel');var crypto=require(_0xc91b('0xb'));var jsforce=require(_0xc91b('0xc'));var deskjs=require(_0xc91b('0xd'));var toCsv=require(_0xc91b('0xe'));var querystring=require(_0xc91b('0xf'));var Papa=require(_0xc91b('0x10'));var Redis=require(_0xc91b('0x11'));var authService=require(_0xc91b('0x12'));var qs=require(_0xc91b('0x13'));var as=require(_0xc91b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc91b('0x15'))(_0xc91b('0x16'));var utils=require(_0xc91b('0x17'));var config=require(_0xc91b('0x18'));var licenseUtil=require(_0xc91b('0x19'));var db=require(_0xc91b('0x1a'))['db'];function respondWithStatusCode(_0x375ace,_0xea358b){_0xea358b=_0xea358b||0xcc;return function(_0x56a476){if(_0x56a476){return _0x375ace[_0xc91b('0x1b')](_0xea358b);}return _0x375ace[_0xc91b('0x1c')](_0xea358b)[_0xc91b('0x1d')]();};}function respondWithResult(_0x91843a,_0x10184){_0x10184=_0x10184||0xc8;return function(_0x2cdf3f){if(_0x2cdf3f){return _0x91843a[_0xc91b('0x1c')](_0x10184)['json'](_0x2cdf3f);}};}function respondWithFilteredResult(_0x53e05f,_0x4f7e75){return function(_0xca0319){if(_0xca0319){var _0x581c55=typeof _0x4f7e75[_0xc91b('0x1e')]===_0xc91b('0x1f')&&typeof _0x4f7e75['limit']===_0xc91b('0x1f');var _0x5bb47e=_0xca0319[_0xc91b('0x20')];var _0x3b760b=_0x581c55?0x0:_0x4f7e75[_0xc91b('0x1e')];var _0x551eee=_0x581c55?_0xca0319[_0xc91b('0x20')]:_0x4f7e75['offset']+_0x4f7e75[_0xc91b('0x21')];var _0x561525;if(_0x551eee>=_0x5bb47e){_0x551eee=_0x5bb47e;_0x561525=0xc8;}else{_0x561525=0xce;}_0x53e05f[_0xc91b('0x1c')](_0x561525);return _0x53e05f[_0xc91b('0x22')](_0xc91b('0x23'),_0x3b760b+'-'+_0x551eee+'/'+_0x5bb47e)[_0xc91b('0x24')](_0xca0319);}return null;};}function patchUpdates(_0x967726){return function(_0x160ebe){try{jsonpatch['apply'](_0x160ebe,_0x967726,!![]);}catch(_0x11a86b){return BPromise[_0xc91b('0x25')](_0x11a86b);}return _0x160ebe[_0xc91b('0x26')]();};}function saveUpdates(_0x2bd486,_0x2b80c6){return function(_0x2b4857){if(_0x2b4857){return _0x2b4857[_0xc91b('0x27')](_0x2bd486)['then'](function(_0x16b8f8){return _0x16b8f8;});}return null;};}function removeEntity(_0x2e8539,_0x37a86c){return function(_0x5d1a40){if(_0x5d1a40){return _0x5d1a40[_0xc91b('0x28')]()[_0xc91b('0x29')](function(){_0x2e8539[_0xc91b('0x1c')](0xcc)[_0xc91b('0x1d')]();});}};}function handleEntityNotFound(_0x4812b7,_0x389abf){return function(_0x3510b8){if(!_0x3510b8){_0x4812b7[_0xc91b('0x1b')](0x194);}return _0x3510b8;};}function handleError(_0x5c8112,_0x43c1ce){_0x43c1ce=_0x43c1ce||0x1f4;return function(_0x42e95e){logger[_0xc91b('0x2a')](_0x42e95e[_0xc91b('0x2b')]);if(_0x42e95e['name']){delete _0x42e95e[_0xc91b('0x2c')];}_0x5c8112['status'](_0x43c1ce)['send'](_0x42e95e);};}exports[_0xc91b('0x2d')]=function(_0x313e21,_0x184906){var _0x314512={},_0x3fcc6e={},_0x273249={'count':0x0,'rows':[]};var _0x51d29f=_[_0xc91b('0x2e')](db[_0xc91b('0x2f')][_0xc91b('0x30')],function(_0x537551){return{'name':_0x537551[_0xc91b('0x31')],'type':_0x537551['type']['key']};});_0x3fcc6e[_0xc91b('0x32')]=_[_0xc91b('0x2e')](_0x51d29f,'name');_0x3fcc6e[_0xc91b('0x33')]=_[_0xc91b('0x34')](_0x313e21[_0xc91b('0x33')]);_0x3fcc6e[_0xc91b('0x35')]=_[_0xc91b('0x36')](_0x3fcc6e[_0xc91b('0x32')],_0x3fcc6e[_0xc91b('0x33')]);_0x314512[_0xc91b('0x37')]=_[_0xc91b('0x36')](_0x3fcc6e[_0xc91b('0x32')],qs[_0xc91b('0x38')](_0x313e21['query'][_0xc91b('0x38')]));_0x314512[_0xc91b('0x37')]=_0x314512[_0xc91b('0x37')][_0xc91b('0x39')]?_0x314512[_0xc91b('0x37')]:_0x3fcc6e[_0xc91b('0x32')];if(!_0x313e21[_0xc91b('0x33')][_0xc91b('0x3a')](_0xc91b('0x3b'))){_0x314512['limit']=qs['limit'](_0x313e21[_0xc91b('0x33')][_0xc91b('0x21')]);_0x314512['offset']=qs['offset'](_0x313e21[_0xc91b('0x33')][_0xc91b('0x1e')]);}_0x314512[_0xc91b('0x3c')]=qs[_0xc91b('0x3d')](_0x313e21[_0xc91b('0x33')][_0xc91b('0x3d')]);_0x314512[_0xc91b('0x3e')]=qs[_0xc91b('0x35')](_[_0xc91b('0x3f')](_0x313e21['query'],_0x3fcc6e[_0xc91b('0x35')]),_0x51d29f);if(_0x313e21[_0xc91b('0x33')]['filter']){_0x314512['where']=_[_0xc91b('0x40')](_0x314512[_0xc91b('0x3e')],{'$or':_[_0xc91b('0x2e')](_0x51d29f,function(_0x3d981a){if(_0x3d981a[_0xc91b('0x41')]!==_0xc91b('0x42')){var _0x8241fb={};_0x8241fb[_0x3d981a['name']]={'$like':'%'+_0x313e21[_0xc91b('0x33')][_0xc91b('0x43')]+'%'};return _0x8241fb;}})});}_0x314512=_[_0xc91b('0x40')]({},_0x314512,_0x313e21[_0xc91b('0x44')]);var _0x4a95f7={'where':_0x314512[_0xc91b('0x3e')]};return db[_0xc91b('0x2f')]['count'](_0x4a95f7)['then'](function(_0x40129c){_0x273249[_0xc91b('0x20')]=_0x40129c;if(_0x313e21['query'][_0xc91b('0x45')]){_0x314512[_0xc91b('0x46')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xc91b('0x47')](_0x314512);})[_0xc91b('0x29')](function(_0xb7c2c4){_0x273249[_0xc91b('0x48')]=_0xb7c2c4;return _0x273249;})[_0xc91b('0x29')](respondWithFilteredResult(_0x184906,_0x314512))[_0xc91b('0x49')](handleError(_0x184906,null));};exports[_0xc91b('0x4a')]=function(_0x378a9f,_0x3958af){var _0x19a0ce={'raw':!![],'where':{'id':_0x378a9f['params']['id']}},_0xe9d37={};_0xe9d37['model']=_[_0xc91b('0x34')](db[_0xc91b('0x2f')]['rawAttributes']);_0xe9d37[_0xc91b('0x33')]=_[_0xc91b('0x34')](_0x378a9f[_0xc91b('0x33')]);_0xe9d37[_0xc91b('0x35')]=_[_0xc91b('0x36')](_0xe9d37[_0xc91b('0x32')],_0xe9d37['query']);_0x19a0ce[_0xc91b('0x37')]=_[_0xc91b('0x36')](_0xe9d37[_0xc91b('0x32')],qs[_0xc91b('0x38')](_0x378a9f[_0xc91b('0x33')]['fields']));_0x19a0ce['attributes']=_0x19a0ce['attributes'][_0xc91b('0x39')]?_0x19a0ce[_0xc91b('0x37')]:_0xe9d37['model'];if(_0x378a9f[_0xc91b('0x33')][_0xc91b('0x45')]){_0x19a0ce[_0xc91b('0x46')]=[{'all':!![]}];}_0x19a0ce=_[_0xc91b('0x40')]({},_0x19a0ce,_0x378a9f[_0xc91b('0x44')]);return db[_0xc91b('0x2f')][_0xc91b('0x4b')](_0x19a0ce)[_0xc91b('0x29')](handleEntityNotFound(_0x3958af,null))['then'](respondWithResult(_0x3958af,null))[_0xc91b('0x49')](handleError(_0x3958af,null));};exports[_0xc91b('0x4c')]=function(_0x53c249,_0xca4fac){return db[_0xc91b('0x2f')][_0xc91b('0x4c')](_0x53c249[_0xc91b('0x4d')],{})['then'](respondWithResult(_0xca4fac,0xc9))[_0xc91b('0x49')](handleError(_0xca4fac,null));};exports[_0xc91b('0x27')]=function(_0x2b82f5,_0x568c75){if(_0x2b82f5[_0xc91b('0x4d')]['id']){delete _0x2b82f5[_0xc91b('0x4d')]['id'];}return db[_0xc91b('0x2f')][_0xc91b('0x4b')]({'where':{'id':_0x2b82f5[_0xc91b('0x4e')]['id']}})[_0xc91b('0x29')](handleEntityNotFound(_0x568c75,null))[_0xc91b('0x29')](saveUpdates(_0x2b82f5[_0xc91b('0x4d')],null))[_0xc91b('0x29')](respondWithResult(_0x568c75,null))['catch'](handleError(_0x568c75,null));};exports['destroy']=function(_0x300ce6,_0xc6a9aa){return db[_0xc91b('0x2f')]['find']({'where':{'id':_0x300ce6['params']['id']}})['then'](handleEntityNotFound(_0xc6a9aa,null))[_0xc91b('0x29')](removeEntity(_0xc6a9aa,null))[_0xc91b('0x49')](handleError(_0xc6a9aa,null));};exports[_0xc91b('0x4f')]=function(_0xb86673,_0x3e83e2){return db[_0xc91b('0x2f')]['describe']()[_0xc91b('0x29')](respondWithResult(_0x3e83e2,null))[_0xc91b('0x49')](handleError(_0x3e83e2,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 675964f..e8b9fc1 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 _0x5673=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer'];(function(_0x11a485,_0x44430f){var _0x19308b=function(_0x337eb6){while(--_0x337eb6){_0x11a485['push'](_0x11a485['shift']());}};_0x19308b(++_0x44430f);}(_0x5673,0x145));var _0x3567=function(_0x150fa2,_0x156632){_0x150fa2=_0x150fa2-0x0;var _0x88e6ba=_0x5673[_0x150fa2];return _0x88e6ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3567('0x0'))(_0x3567('0x1'));var moment=require(_0x3567('0x2'));var BPromise=require(_0x3567('0x3'));var rp=require(_0x3567('0x4'));var fs=require('fs');var path=require(_0x3567('0x5'));var rimraf=require(_0x3567('0x6'));var config=require(_0x3567('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x503b4d,_0x5ac8ae){return _0x503b4d[_0x3567('0x8')](_0x3567('0x9'),attributes,{'tableName':_0x3567('0xa'),'paranoid':![],'indexes':[{'name':_0x3567('0xb'),'fields':[_0x3567('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe05d=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xe05d,0x143));var _0xde05=function(_0x35c0a9,_0x4f810d){_0x35c0a9=_0x35c0a9-0x0;var _0x2c2509=_0xe05d[_0x35c0a9];return _0x2c2509;};'use strict';var _=require(_0xde05('0x0'));var util=require(_0xde05('0x1'));var logger=require(_0xde05('0x2'))(_0xde05('0x3'));var moment=require(_0xde05('0x4'));var BPromise=require(_0xde05('0x5'));var rp=require(_0xde05('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde05('0x7'));var config=require(_0xde05('0x8'));var attributes=require(_0xde05('0x9'));module[_0xde05('0xa')]=function(_0x16e88b,_0x95251b){return _0x16e88b[_0xde05('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xde05('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4729400..ecc7d38 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 _0x7518=['util','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7518,0x110));var _0x8751=function(_0x308de4,_0x55b6e2){_0x308de4=_0x308de4-0x0;var _0x5e569f=_0x7518[_0x308de4];return _0x5e569f;};'use strict';var _=require(_0x8751('0x0'));var util=require(_0x8751('0x1'));var moment=require('moment');var BPromise=require(_0x8751('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8751('0x3'));var db=require(_0x8751('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8751('0x5'));var client=jayson[_0x8751('0x6')][_0x8751('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36e743,_0x415ed0,_0x241240){return new BPromise(function(_0xa34006,_0x53373b){return client[_0x8751('0x8')](_0x36e743,_0x241240)[_0x8751('0x9')](function(_0x3edd22){logger[_0x8751('0xa')](_0x8751('0xb'),_0x415ed0,_0x8751('0xc'));logger[_0x8751('0xd')](_0x8751('0xe'),_0x415ed0,_0x8751('0xc'),JSON[_0x8751('0xf')](_0x3edd22));if(_0x3edd22[_0x8751('0x10')]){if(_0x3edd22[_0x8751('0x10')][_0x8751('0x11')]===0x1f4){logger[_0x8751('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x415ed0,_0x3edd22[_0x8751('0x10')][_0x8751('0x12')]);return _0x53373b(_0x3edd22['error'][_0x8751('0x12')]);}logger[_0x8751('0x10')](_0x8751('0xb'),_0x415ed0,_0x3edd22[_0x8751('0x10')]['message']);return _0xa34006(_0x3edd22[_0x8751('0x10')][_0x8751('0x12')]);}else{logger[_0x8751('0xa')](_0x8751('0xb'),_0x415ed0,_0x8751('0xc'));_0xa34006(_0x3edd22[_0x8751('0x13')][_0x8751('0x12')]);}})[_0x8751('0x14')](function(_0x368bf1){logger[_0x8751('0x10')](_0x8751('0xb'),_0x415ed0,_0x368bf1);_0x53373b(_0x368bf1);});});} \ No newline at end of file +var _0xeb31=['code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb31,0x193));var _0x1eb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb31[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1eb3('0x0'));var util=require(_0x1eb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1eb3('0x2'));var fs=require('fs');var Redis=require(_0x1eb3('0x3'));var db=require(_0x1eb3('0x4'))['db'];var utils=require(_0x1eb3('0x5'));var logger=require(_0x1eb3('0x6'))(_0x1eb3('0x7'));var config=require(_0x1eb3('0x8'));var jayson=require(_0x1eb3('0x9'));var client=jayson[_0x1eb3('0xa')][_0x1eb3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5975ee,_0x431c9b,_0x442a85){return new BPromise(function(_0x2c1446,_0xd49ce2){return client['request'](_0x5975ee,_0x442a85)['then'](function(_0xce038e){logger[_0x1eb3('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x431c9b,_0x1eb3('0xd'));logger['debug'](_0x1eb3('0xe'),_0x431c9b,'request\x20sent',JSON[_0x1eb3('0xf')](_0xce038e));if(_0xce038e[_0x1eb3('0x10')]){if(_0xce038e[_0x1eb3('0x10')][_0x1eb3('0x11')]===0x1f4){logger[_0x1eb3('0x10')](_0x1eb3('0x12'),_0x431c9b,_0xce038e[_0x1eb3('0x10')]['message']);return _0xd49ce2(_0xce038e['error']['message']);}logger[_0x1eb3('0x10')](_0x1eb3('0x12'),_0x431c9b,_0xce038e[_0x1eb3('0x10')][_0x1eb3('0x13')]);return _0x2c1446(_0xce038e[_0x1eb3('0x10')][_0x1eb3('0x13')]);}else{logger[_0x1eb3('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x431c9b,_0x1eb3('0xd'));_0x2c1446(_0xce038e[_0x1eb3('0x14')][_0x1eb3('0x13')]);}})['catch'](function(_0x4e3771){logger['error'](_0x1eb3('0x12'),_0x431c9b,_0x4e3771);_0xd49ce2(_0x4e3771);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1f8178d..6c35621 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 _0x87c1=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x34b48c,_0xe97afa){var _0x3b9957=function(_0x33095d){while(--_0x33095d){_0x34b48c['push'](_0x34b48c['shift']());}};_0x3b9957(++_0xe97afa);}(_0x87c1,0xfa));var _0x187c=function(_0x59bf33,_0x786dcc){_0x59bf33=_0x59bf33-0x0;var _0x34d3a9=_0x87c1[_0x59bf33];return _0x34d3a9;};'use strict';var multer=require(_0x187c('0x0'));var util=require(_0x187c('0x1'));var path=require(_0x187c('0x2'));var timeout=require(_0x187c('0x3'));var express=require(_0x187c('0x4'));var router=express[_0x187c('0x5')]();var fs_extra=require(_0x187c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x187c('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x187c('0x8')](),controller[_0x187c('0x9')]);router[_0x187c('0xa')](_0x187c('0xb'),auth[_0x187c('0x8')](),controller[_0x187c('0xc')]);router[_0x187c('0xa')](_0x187c('0xd'),auth[_0x187c('0x8')](),controller[_0x187c('0xe')]);router[_0x187c('0xf')]('/',auth[_0x187c('0x8')](),controller[_0x187c('0x10')]);router[_0x187c('0x11')](_0x187c('0xd'),auth[_0x187c('0x8')](),controller[_0x187c('0x12')]);router[_0x187c('0x13')]('/:id',auth[_0x187c('0x8')](),controller[_0x187c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xadda=['create','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0xadda,0x1d7));var _0xaadd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xadda[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xaadd('0x0'));var path=require(_0xaadd('0x1'));var timeout=require(_0xaadd('0x2'));var express=require('express');var router=express[_0xaadd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaadd('0x4'));var interaction=require(_0xaadd('0x5'));var config=require(_0xaadd('0x6'));var controller=require(_0xaadd('0x7'));router[_0xaadd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaadd('0x9')]);router[_0xaadd('0x8')](_0xaadd('0xa'),auth[_0xaadd('0xb')](),controller[_0xaadd('0xc')]);router[_0xaadd('0x8')](_0xaadd('0xd'),auth[_0xaadd('0xb')](),controller['show']);router[_0xaadd('0xe')]('/',auth[_0xaadd('0xb')](),controller[_0xaadd('0xf')]);router['put'](_0xaadd('0xd'),auth[_0xaadd('0xb')](),controller['update']);router['delete'](_0xaadd('0xd'),auth[_0xaadd('0xb')](),controller[_0xaadd('0x10')]);module[_0xaadd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d537c55..20f8946 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 _0xa20b=['post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xa20b,0x90));var _0xba20=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa20b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xba20('0x0'));var util=require(_0xba20('0x1'));var path=require(_0xba20('0x2'));var timeout=require(_0xba20('0x3'));var express=require(_0xba20('0x4'));var router=express['Router']();var fs_extra=require(_0xba20('0x5'));var auth=require(_0xba20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xba20('0x7'));var controller=require(_0xba20('0x8'));router[_0xba20('0x9')]('/',auth[_0xba20('0xa')](),controller[_0xba20('0xb')]);router[_0xba20('0x9')](_0xba20('0xc'),auth[_0xba20('0xa')](),controller[_0xba20('0xd')]);router['get'](_0xba20('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xba20('0x9')](_0xba20('0xf'),auth['isAuthenticated'](),controller[_0xba20('0x10')]);router[_0xba20('0x11')]('/',auth[_0xba20('0xa')](),controller[_0xba20('0x12')]);router['post'](_0xba20('0xe'),auth[_0xba20('0xa')](),controller[_0xba20('0x13')]);router[_0xba20('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xba20('0x15')]);router['delete'](_0xba20('0xc'),auth[_0xba20('0xa')](),controller[_0xba20('0x16')]);module['exports']=router; \ No newline at end of file +var _0x712b=['get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x13ae92,_0x15a978){var _0x37dbd7=function(_0x2be39b){while(--_0x2be39b){_0x13ae92['push'](_0x13ae92['shift']());}};_0x37dbd7(++_0x15a978);}(_0x712b,0xfa));var _0xb712=function(_0x44bd5f,_0x58bbe8){_0x44bd5f=_0x44bd5f-0x0;var _0x1f5a9a=_0x712b[_0x44bd5f];return _0x1f5a9a;};'use strict';var multer=require('multer');var util=require(_0xb712('0x0'));var path=require(_0xb712('0x1'));var timeout=require(_0xb712('0x2'));var express=require(_0xb712('0x3'));var router=express[_0xb712('0x4')]();var fs_extra=require(_0xb712('0x5'));var auth=require(_0xb712('0x6'));var interaction=require(_0xb712('0x7'));var config=require(_0xb712('0x8'));var controller=require(_0xb712('0x9'));router[_0xb712('0xa')]('/',auth['isAuthenticated'](),controller[_0xb712('0xb')]);router[_0xb712('0xa')](_0xb712('0xc'),auth['isAuthenticated'](),controller[_0xb712('0xd')]);router['get'](_0xb712('0xe'),auth[_0xb712('0xf')](),controller[_0xb712('0x10')]);router['get'](_0xb712('0x11'),auth[_0xb712('0xf')](),controller[_0xb712('0x12')]);router['post']('/',auth[_0xb712('0xf')](),controller[_0xb712('0x13')]);router[_0xb712('0x14')](_0xb712('0xe'),auth[_0xb712('0xf')](),controller[_0xb712('0x15')]);router['put'](_0xb712('0xc'),auth[_0xb712('0xf')](),controller[_0xb712('0x16')]);router[_0xb712('0x17')](_0xb712('0xc'),auth['isAuthenticated'](),controller[_0xb712('0x18')]);module[_0xb712('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index fdb8e33..2c43fe8 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 _0xb6f6=['ENUM','integrationTab','sequelize','exports','STRING','basic'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xb6f6,0xf8));var _0x6b6f=function(_0x557c63,_0x33054a){_0x557c63=_0x557c63-0x0;var _0x2a2677=_0xb6f6[_0x557c63];return _0x2a2677;};'use strict';var Sequelize=require(_0x6b6f('0x0'));module[_0x6b6f('0x1')]={'name':{'type':Sequelize[_0x6b6f('0x2')]},'description':{'type':Sequelize[_0x6b6f('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6b6f('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x6b6f('0x3')),'defaultValue':_0x6b6f('0x3')},'password':{'type':Sequelize[_0x6b6f('0x2')]},'consumerKey':{'type':Sequelize[_0x6b6f('0x2')]},'consumerSecret':{'type':Sequelize[_0x6b6f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x6b6f('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6b6f('0x4')](_0x6b6f('0x5'),'newTab'),'defaultValue':_0x6b6f('0x5')}}; \ No newline at end of file +var _0xab91=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x586c2c,_0x949ffe){var _0x5a4451=function(_0x2ab33b){while(--_0x2ab33b){_0x586c2c['push'](_0x586c2c['shift']());}};_0x5a4451(++_0x949ffe);}(_0xab91,0x147));var _0x1ab9=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xab91[_0x4a2ba2];return _0x1d09fd;};'use strict';var Sequelize=require(_0x1ab9('0x0'));module[_0x1ab9('0x1')]={'name':{'type':Sequelize[_0x1ab9('0x2')]},'description':{'type':Sequelize[_0x1ab9('0x2')]},'username':{'type':Sequelize[_0x1ab9('0x2')]},'remoteUri':{'type':Sequelize[_0x1ab9('0x2')]},'authType':{'type':Sequelize[_0x1ab9('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x1ab9('0x2')]},'consumerSecret':{'type':Sequelize[_0x1ab9('0x2')]},'token':{'type':Sequelize[_0x1ab9('0x2')]},'tokenSecret':{'type':Sequelize[_0x1ab9('0x2')]},'serverUrl':{'type':Sequelize[_0x1ab9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1ab9('0x3')](_0x1ab9('0x4'),_0x1ab9('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 36d34d6..2643e34 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 _0x79bb=['create','body','DeskConfiguration','order','getConfigurations','addConfiguration','findOne','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','lastIndexOf','GET','format','basic','Authorization','%s:%s','toString','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','DeskAccount','findAll','rows','catch','show','params','includeAll','include','merge','find'];(function(_0x348480,_0x3d3dba){var _0x5501d1=function(_0x36d131){while(--_0x36d131){_0x348480['push'](_0x348480['shift']());}};_0x5501d1(++_0x3d3dba);}(_0x79bb,0x9b));var _0xb79b=function(_0x5510b0,_0x335bc7){_0x5510b0=_0x5510b0-0x0;var _0x5489d3=_0x79bb[_0x5510b0];return _0x5489d3;};'use strict';var emlformat=require(_0xb79b('0x0'));var rimraf=require(_0xb79b('0x1'));var zipdir=require(_0xb79b('0x2'));var jsonpatch=require(_0xb79b('0x3'));var rp=require(_0xb79b('0x4'));var moment=require(_0xb79b('0x5'));var BPromise=require(_0xb79b('0x6'));var Mustache=require(_0xb79b('0x7'));var util=require(_0xb79b('0x8'));var path=require(_0xb79b('0x9'));var sox=require(_0xb79b('0xa'));var csv=require(_0xb79b('0xb'));var ejs=require(_0xb79b('0xc'));var fs=require('fs');var fs_extra=require(_0xb79b('0xd'));var _=require(_0xb79b('0xe'));var squel=require(_0xb79b('0xf'));var crypto=require('crypto');var jsforce=require(_0xb79b('0x10'));var deskjs=require(_0xb79b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xb79b('0x12'));var Papa=require(_0xb79b('0x13'));var Redis=require(_0xb79b('0x14'));var authService=require(_0xb79b('0x15'));var qs=require(_0xb79b('0x16'));var as=require(_0xb79b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb79b('0x18'))(_0xb79b('0x19'));var utils=require(_0xb79b('0x1a'));var config=require(_0xb79b('0x1b'));var licenseUtil=require(_0xb79b('0x1c'));var db=require(_0xb79b('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4d01cb,_0x3393a1){_0x3393a1=_0x3393a1||0xcc;return function(_0x320052){if(_0x320052){return _0x4d01cb[_0xb79b('0x1e')](_0x3393a1);}return _0x4d01cb['status'](_0x3393a1)[_0xb79b('0x1f')]();};}function respondWithResult(_0x505531,_0x4361af){_0x4361af=_0x4361af||0xc8;return function(_0x4095e6){if(_0x4095e6){return _0x505531[_0xb79b('0x20')](_0x4361af)['json'](_0x4095e6);}};}function respondWithFilteredResult(_0x13903b,_0xe03c98){return function(_0x44f272){if(_0x44f272){var _0x2dc77a=typeof _0xe03c98[_0xb79b('0x21')]===_0xb79b('0x22')&&typeof _0xe03c98[_0xb79b('0x23')]===_0xb79b('0x22');var _0x357224=_0x44f272[_0xb79b('0x24')];var _0xc82a5b=_0x2dc77a?0x0:_0xe03c98['offset'];var _0xb9c109=_0x2dc77a?_0x44f272['count']:_0xe03c98['offset']+_0xe03c98[_0xb79b('0x23')];var _0x4178fa;if(_0xb9c109>=_0x357224){_0xb9c109=_0x357224;_0x4178fa=0xc8;}else{_0x4178fa=0xce;}_0x13903b[_0xb79b('0x20')](_0x4178fa);return _0x13903b[_0xb79b('0x25')](_0xb79b('0x26'),_0xc82a5b+'-'+_0xb9c109+'/'+_0x357224)['json'](_0x44f272);}return null;};}function patchUpdates(_0x5cb9b7){return function(_0xb48e24){try{jsonpatch[_0xb79b('0x27')](_0xb48e24,_0x5cb9b7,!![]);}catch(_0x1f859b){return BPromise[_0xb79b('0x28')](_0x1f859b);}return _0xb48e24[_0xb79b('0x29')]();};}function saveUpdates(_0x592a95,_0x31e15c){return function(_0x17315c){if(_0x17315c){return _0x17315c[_0xb79b('0x2a')](_0x592a95)[_0xb79b('0x2b')](function(_0x3f95dd){return _0x3f95dd;});}return null;};}function removeEntity(_0x33ca89,_0x58e803){return function(_0x10477b){if(_0x10477b){return _0x10477b[_0xb79b('0x2c')]()[_0xb79b('0x2b')](function(){_0x33ca89[_0xb79b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c6e8c,_0x24f7c0){return function(_0xac6333){if(!_0xac6333){_0x5c6e8c['sendStatus'](0x194);}return _0xac6333;};}function handleError(_0x3826d5,_0x3375be){_0x3375be=_0x3375be||0x1f4;return function(_0x5b9a0c){logger[_0xb79b('0x2d')](_0x5b9a0c[_0xb79b('0x2e')]);if(_0x5b9a0c['name']){delete _0x5b9a0c['name'];}_0x3826d5[_0xb79b('0x20')](_0x3375be)[_0xb79b('0x2f')](_0x5b9a0c);};}exports['index']=function(_0x36931c,_0x3bb2a8){var _0x34c2a9={},_0x69d6d0={},_0x280382={'count':0x0,'rows':[]};var _0x53d36a=_[_0xb79b('0x30')](db['DeskAccount'][_0xb79b('0x31')],function(_0x3067e2){return{'name':_0x3067e2[_0xb79b('0x32')],'type':_0x3067e2[_0xb79b('0x33')][_0xb79b('0x34')]};});_0x69d6d0['model']=_[_0xb79b('0x30')](_0x53d36a,_0xb79b('0x35'));_0x69d6d0[_0xb79b('0x36')]=_[_0xb79b('0x37')](_0x36931c[_0xb79b('0x36')]);_0x69d6d0[_0xb79b('0x38')]=_[_0xb79b('0x39')](_0x69d6d0[_0xb79b('0x3a')],_0x69d6d0[_0xb79b('0x36')]);_0x34c2a9[_0xb79b('0x3b')]=_['intersection'](_0x69d6d0['model'],qs[_0xb79b('0x3c')](_0x36931c[_0xb79b('0x36')][_0xb79b('0x3c')]));_0x34c2a9[_0xb79b('0x3b')]=_0x34c2a9[_0xb79b('0x3b')][_0xb79b('0x3d')]?_0x34c2a9['attributes']:_0x69d6d0[_0xb79b('0x3a')];if(!_0x36931c[_0xb79b('0x36')]['hasOwnProperty'](_0xb79b('0x3e'))){_0x34c2a9[_0xb79b('0x23')]=qs[_0xb79b('0x23')](_0x36931c[_0xb79b('0x36')]['limit']);_0x34c2a9[_0xb79b('0x21')]=qs[_0xb79b('0x21')](_0x36931c['query'][_0xb79b('0x21')]);}_0x34c2a9['order']=qs[_0xb79b('0x3f')](_0x36931c[_0xb79b('0x36')][_0xb79b('0x3f')]);_0x34c2a9[_0xb79b('0x40')]=qs['filters'](_[_0xb79b('0x41')](_0x36931c[_0xb79b('0x36')],_0x69d6d0[_0xb79b('0x38')]),_0x53d36a);if(_0x36931c[_0xb79b('0x36')][_0xb79b('0x42')]){_0x34c2a9[_0xb79b('0x40')]=_['merge'](_0x34c2a9[_0xb79b('0x40')],{'$or':_['map'](_0x53d36a,function(_0x5c0b67){if(_0x5c0b67[_0xb79b('0x33')]!==_0xb79b('0x43')){var _0x5cf585={};_0x5cf585[_0x5c0b67[_0xb79b('0x35')]]={'$like':'%'+_0x36931c[_0xb79b('0x36')]['filter']+'%'};return _0x5cf585;}})});}_0x34c2a9=_['merge']({},_0x34c2a9,_0x36931c[_0xb79b('0x44')]);var _0x1ecfb3={'where':_0x34c2a9[_0xb79b('0x40')]};return db[_0xb79b('0x45')][_0xb79b('0x24')](_0x1ecfb3)['then'](function(_0x3feb6c){_0x280382[_0xb79b('0x24')]=_0x3feb6c;if(_0x36931c['query']['includeAll']){_0x34c2a9['include']=[{'all':!![]}];}return db['DeskAccount'][_0xb79b('0x46')](_0x34c2a9);})[_0xb79b('0x2b')](function(_0x12d213){_0x280382[_0xb79b('0x47')]=_0x12d213;return _0x280382;})['then'](respondWithFilteredResult(_0x3bb2a8,_0x34c2a9))[_0xb79b('0x48')](handleError(_0x3bb2a8,null));};exports[_0xb79b('0x49')]=function(_0x594957,_0x3f9fda){var _0x2cc5f8={'raw':![],'where':{'id':_0x594957[_0xb79b('0x4a')]['id']}},_0x1c29bc={};_0x1c29bc[_0xb79b('0x3a')]=_['keys'](db[_0xb79b('0x45')][_0xb79b('0x31')]);_0x1c29bc[_0xb79b('0x36')]=_[_0xb79b('0x37')](_0x594957[_0xb79b('0x36')]);_0x1c29bc[_0xb79b('0x38')]=_[_0xb79b('0x39')](_0x1c29bc[_0xb79b('0x3a')],_0x1c29bc[_0xb79b('0x36')]);_0x2cc5f8[_0xb79b('0x3b')]=_[_0xb79b('0x39')](_0x1c29bc[_0xb79b('0x3a')],qs[_0xb79b('0x3c')](_0x594957[_0xb79b('0x36')]['fields']));_0x2cc5f8[_0xb79b('0x3b')]=_0x2cc5f8[_0xb79b('0x3b')][_0xb79b('0x3d')]?_0x2cc5f8['attributes']:_0x1c29bc[_0xb79b('0x3a')];if(_0x594957['query'][_0xb79b('0x4b')]){_0x2cc5f8[_0xb79b('0x4c')]=[{'all':!![]}];}_0x2cc5f8=_[_0xb79b('0x4d')]({},_0x2cc5f8,_0x594957['options']);return db['DeskAccount'][_0xb79b('0x4e')](_0x2cc5f8)['then'](handleEntityNotFound(_0x3f9fda,null))['then'](respondWithResult(_0x3f9fda,null))[_0xb79b('0x48')](handleError(_0x3f9fda,null));};exports[_0xb79b('0x4f')]=function(_0x3363b7,_0x31dbe0){return db[_0xb79b('0x45')][_0xb79b('0x4f')](_0x3363b7[_0xb79b('0x50')],{})[_0xb79b('0x2b')](respondWithResult(_0x31dbe0,0xc9))[_0xb79b('0x48')](handleError(_0x31dbe0,null));};exports[_0xb79b('0x2a')]=function(_0x21fad5,_0x78193b){if(_0x21fad5[_0xb79b('0x50')]['id']){delete _0x21fad5['body']['id'];}return db[_0xb79b('0x45')][_0xb79b('0x4e')]({'where':{'id':_0x21fad5[_0xb79b('0x4a')]['id']}})[_0xb79b('0x2b')](handleEntityNotFound(_0x78193b,null))[_0xb79b('0x2b')](saveUpdates(_0x21fad5[_0xb79b('0x50')],null))['then'](respondWithResult(_0x78193b,null))[_0xb79b('0x48')](handleError(_0x78193b,null));};exports[_0xb79b('0x2c')]=function(_0x11eced,_0x34ad06){return db[_0xb79b('0x45')]['find']({'where':{'id':_0x11eced[_0xb79b('0x4a')]['id']}})[_0xb79b('0x2b')](handleEntityNotFound(_0x34ad06,null))[_0xb79b('0x2b')](removeEntity(_0x34ad06,null))['catch'](handleError(_0x34ad06,null));};exports['getConfigurations']=function(_0x379eef,_0x14c0cb,_0x4e4f87){var _0x303604={};var _0x4a3665={};var _0x3c020f;var _0x576122;return db[_0xb79b('0x45')]['findOne']({'where':{'id':_0x379eef[_0xb79b('0x4a')]['id']}})[_0xb79b('0x2b')](handleEntityNotFound(_0x14c0cb,null))[_0xb79b('0x2b')](function(_0x1cf467){if(_0x1cf467){_0x3c020f=_0x1cf467;_0x4a3665[_0xb79b('0x3a')]=_['keys'](db[_0xb79b('0x51')][_0xb79b('0x31')]);_0x4a3665[_0xb79b('0x36')]=_[_0xb79b('0x37')](_0x379eef['query']);_0x4a3665['filters']=_[_0xb79b('0x39')](_0x4a3665['model'],_0x4a3665[_0xb79b('0x36')]);_0x303604[_0xb79b('0x3b')]=_['intersection'](_0x4a3665[_0xb79b('0x3a')],qs['fields'](_0x379eef[_0xb79b('0x36')][_0xb79b('0x3c')]));_0x303604[_0xb79b('0x3b')]=_0x303604[_0xb79b('0x3b')][_0xb79b('0x3d')]?_0x303604['attributes']:_0x4a3665[_0xb79b('0x3a')];_0x303604[_0xb79b('0x52')]=qs[_0xb79b('0x3f')](_0x379eef[_0xb79b('0x36')][_0xb79b('0x3f')]);_0x303604[_0xb79b('0x40')]=qs[_0xb79b('0x38')](_[_0xb79b('0x41')](_0x379eef['query'],_0x4a3665['filters']));if(_0x379eef[_0xb79b('0x36')][_0xb79b('0x42')]){_0x303604[_0xb79b('0x40')]=_['merge'](_0x303604[_0xb79b('0x40')],{'$or':_[_0xb79b('0x30')](_0x303604[_0xb79b('0x3b')],function(_0x564b98){var _0x4c593a={};_0x4c593a[_0x564b98]={'$like':'%'+_0x379eef['query']['filter']+'%'};return _0x4c593a;})});}_0x303604=_[_0xb79b('0x4d')]({},_0x303604,_0x379eef['options']);return _0x3c020f[_0xb79b('0x53')](_0x303604);}})[_0xb79b('0x2b')](function(_0x596f8f){if(_0x596f8f){_0x576122=_0x596f8f['length'];if(!_0x379eef[_0xb79b('0x36')]['hasOwnProperty'](_0xb79b('0x3e'))){_0x303604[_0xb79b('0x23')]=qs[_0xb79b('0x23')](_0x379eef[_0xb79b('0x36')][_0xb79b('0x23')]);_0x303604[_0xb79b('0x21')]=qs['offset'](_0x379eef[_0xb79b('0x36')][_0xb79b('0x21')]);}return _0x3c020f[_0xb79b('0x53')](_0x303604);}})[_0xb79b('0x2b')](function(_0x44fe5a){if(_0x44fe5a){return _0x44fe5a?{'count':_0x576122,'rows':_0x44fe5a}:null;}})[_0xb79b('0x2b')](respondWithResult(_0x14c0cb,null))['catch'](handleError(_0x14c0cb,null));};exports[_0xb79b('0x54')]=function(_0x47cdb7,_0x89996b,_0x5ddc0d){if(_0x47cdb7[_0xb79b('0x50')]['id']){delete _0x47cdb7[_0xb79b('0x50')]['id'];}return db['DeskAccount'][_0xb79b('0x55')]({'where':{'id':_0x47cdb7['params']['id']}})[_0xb79b('0x2b')](handleEntityNotFound(_0x89996b,null))['then'](function(_0x180b75){if(_0x180b75){_0x47cdb7[_0xb79b('0x50')]['AccountId']=_0x180b75['id'];_0x47cdb7[_0xb79b('0x50')][_0xb79b('0x56')]=integrations['getSubjects'](_0x47cdb7['body'][_0xb79b('0x57')],_0x47cdb7[_0xb79b('0x50')][_0xb79b('0x33')]);_0x47cdb7[_0xb79b('0x50')]['Descriptions']=integrations[_0xb79b('0x58')](_0x47cdb7['body'][_0xb79b('0x57')],_0x47cdb7[_0xb79b('0x50')][_0xb79b('0x33')]);return db[_0xb79b('0x51')]['create'](_0x47cdb7[_0xb79b('0x50')],{'include':[{'model':db[_0xb79b('0x59')],'as':'Subjects'},{'model':db[_0xb79b('0x59')],'as':_0xb79b('0x5a')}]});}return null;})[_0xb79b('0x2b')](respondWithResult(_0x89996b,null))[_0xb79b('0x48')](handleError(_0x89996b,null));};exports[_0xb79b('0x5b')]=function(_0x2055fa,_0x57b00,_0xc6a036){var _0x143477=[{'name':_0xb79b('0x5c'),'label':_0xb79b('0x5c'),'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 _0x569b11='';return db[_0xb79b('0x45')]['findOne']({'where':{'id':_0x2055fa[_0xb79b('0x4a')]['id']},'attributes':['id',_0xb79b('0x5d'),_0xb79b('0x5e'),_0xb79b('0x5f'),_0xb79b('0x60'),_0xb79b('0x61'),_0xb79b('0x62'),'token','tokenSecret']})[_0xb79b('0x2b')](handleEntityNotFound(_0x57b00,null))['then'](function(_0x20d9d6){if(_0x20d9d6){_0x569b11=_0x20d9d6[_0xb79b('0x5d')];var _0x4c66a8=_0x569b11[_0xb79b('0x63')](-0x1);if(_0x4c66a8==='/'){_0x569b11=_0x569b11['substring'](0x0,_0x569b11[_0xb79b('0x64')](_0x4c66a8));}var _0x5c2bfd={'method':_0xb79b('0x65'),'uri':util[_0xb79b('0x66')]('%s/custom_fields',_0x569b11),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x20d9d6['authType']===_0xb79b('0x67')){_0x5c2bfd['headers'][_0xb79b('0x68')]=util[_0xb79b('0x66')]('Basic\x20%s',new Buffer(util[_0xb79b('0x66')](_0xb79b('0x69'),_0x20d9d6['username'],_0x20d9d6['password']))[_0xb79b('0x6a')]('base64'));}return rp(_0x5c2bfd)[_0xb79b('0x2b')](function(_0x5ba69a){return _0x143477[_0xb79b('0x6b')](_[_0xb79b('0x30')](_0x5ba69a[_0xb79b('0x6c')][_0xb79b('0x6d')],function(_0x48a50c){return{'id':_0x48a50c[_0xb79b('0x35')],'name':_0x48a50c['name'],'type':_0x48a50c[_0xb79b('0x33')],'active':_0x48a50c[_0xb79b('0x6e')],'label':_0x48a50c[_0xb79b('0x6f')],'custom':!![]};}));});}})['then'](function(_0x23007a){return{'count':_0x23007a[_0xb79b('0x3d')],'rows':_0x23007a};})[_0xb79b('0x2b')](respondWithResult(_0x57b00,null))[_0xb79b('0x48')](function(_0x4b11d7){var _0x13692b=_0x2055fa[_0xb79b('0x36')][_0xb79b('0x70')]?0x1f4:_0x4b11d7[_0xb79b('0x71')]||0x1f4;logger[_0xb79b('0x2d')](_0xb79b('0x72'),'getFields',_0x13692b,JSON[_0xb79b('0x73')](_0x4b11d7));delete _0x4b11d7['name'];if(_0x13692b===0x191){_0x13692b=0x190;}_0x57b00[_0xb79b('0x20')](_0x13692b)[_0xb79b('0x2f')](_0x2055fa[_0xb79b('0x36')][_0xb79b('0x70')]?{'message':_0xb79b('0x74'),'statusCode':_0x4b11d7[_0xb79b('0x71')]}:_0x4b11d7);});}; \ No newline at end of file +var _0x38d2=['priority','remoteUri','authType','username','password','consumerSecret','token','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','format','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','sendStatus','stack','name','send','index','DeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','getConfigurations','DeskConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields'];(function(_0x29faac,_0x2c5548){var _0x2db0e7=function(_0x4573e8){while(--_0x4573e8){_0x29faac['push'](_0x29faac['shift']());}};_0x2db0e7(++_0x2c5548);}(_0x38d2,0x91));var _0x238d=function(_0x557cee,_0x1cfeeb){_0x557cee=_0x557cee-0x0;var _0x3a4eec=_0x38d2[_0x557cee];return _0x3a4eec;};'use strict';var emlformat=require(_0x238d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x238d('0x1'));var jsonpatch=require(_0x238d('0x2'));var rp=require(_0x238d('0x3'));var moment=require(_0x238d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x238d('0x5'));var util=require(_0x238d('0x6'));var path=require(_0x238d('0x7'));var sox=require(_0x238d('0x8'));var csv=require(_0x238d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x238d('0xa'));var _=require('lodash');var squel=require(_0x238d('0xb'));var crypto=require(_0x238d('0xc'));var jsforce=require(_0x238d('0xd'));var deskjs=require(_0x238d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x238d('0xf'));var Papa=require(_0x238d('0x10'));var Redis=require('ioredis');var authService=require(_0x238d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x238d('0x12'));var hardwareService=require(_0x238d('0x13'));var logger=require(_0x238d('0x14'))(_0x238d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x238d('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x238d('0x17'));function respondWithStatusCode(_0x34dd57,_0x41125d){_0x41125d=_0x41125d||0xcc;return function(_0x3f4d78){if(_0x3f4d78){return _0x34dd57['sendStatus'](_0x41125d);}return _0x34dd57[_0x238d('0x18')](_0x41125d)[_0x238d('0x19')]();};}function respondWithResult(_0x36c2c0,_0x3f31eb){_0x3f31eb=_0x3f31eb||0xc8;return function(_0xfdaf9c){if(_0xfdaf9c){return _0x36c2c0[_0x238d('0x18')](_0x3f31eb)[_0x238d('0x1a')](_0xfdaf9c);}};}function respondWithFilteredResult(_0x2b0cba,_0x3f0b7f){return function(_0x2ab517){if(_0x2ab517){var _0x538c8e=typeof _0x3f0b7f['offset']===_0x238d('0x1b')&&typeof _0x3f0b7f[_0x238d('0x1c')]===_0x238d('0x1b');var _0x149c5b=_0x2ab517[_0x238d('0x1d')];var _0x3a776f=_0x538c8e?0x0:_0x3f0b7f[_0x238d('0x1e')];var _0x3455a0=_0x538c8e?_0x2ab517['count']:_0x3f0b7f[_0x238d('0x1e')]+_0x3f0b7f[_0x238d('0x1c')];var _0x4388c5;if(_0x3455a0>=_0x149c5b){_0x3455a0=_0x149c5b;_0x4388c5=0xc8;}else{_0x4388c5=0xce;}_0x2b0cba['status'](_0x4388c5);return _0x2b0cba[_0x238d('0x1f')]('Content-Range',_0x3a776f+'-'+_0x3455a0+'/'+_0x149c5b)['json'](_0x2ab517);}return null;};}function patchUpdates(_0x450db2){return function(_0xc6abef){try{jsonpatch[_0x238d('0x20')](_0xc6abef,_0x450db2,!![]);}catch(_0x51fbb9){return BPromise['reject'](_0x51fbb9);}return _0xc6abef['save']();};}function saveUpdates(_0x5b3691,_0x401569){return function(_0x25a582){if(_0x25a582){return _0x25a582[_0x238d('0x21')](_0x5b3691)[_0x238d('0x22')](function(_0x13178){return _0x13178;});}return null;};}function removeEntity(_0x4a7959,_0x186024){return function(_0x28c8e6){if(_0x28c8e6){return _0x28c8e6[_0x238d('0x23')]()[_0x238d('0x22')](function(){_0x4a7959[_0x238d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481657,_0x208c26){return function(_0x5165ca){if(!_0x5165ca){_0x481657[_0x238d('0x24')](0x194);}return _0x5165ca;};}function handleError(_0x354d71,_0x5c14c7){_0x5c14c7=_0x5c14c7||0x1f4;return function(_0x5d8e8){logger['error'](_0x5d8e8[_0x238d('0x25')]);if(_0x5d8e8[_0x238d('0x26')]){delete _0x5d8e8[_0x238d('0x26')];}_0x354d71[_0x238d('0x18')](_0x5c14c7)[_0x238d('0x27')](_0x5d8e8);};}exports[_0x238d('0x28')]=function(_0x9b8ea3,_0x5bbd96){var _0x30e09d={},_0x122d27={},_0x4ebb1f={'count':0x0,'rows':[]};var _0x3e63b0=_['map'](db[_0x238d('0x29')][_0x238d('0x2a')],function(_0x5cad52){return{'name':_0x5cad52['fieldName'],'type':_0x5cad52[_0x238d('0x2b')][_0x238d('0x2c')]};});_0x122d27[_0x238d('0x2d')]=_[_0x238d('0x2e')](_0x3e63b0,'name');_0x122d27[_0x238d('0x2f')]=_[_0x238d('0x30')](_0x9b8ea3['query']);_0x122d27[_0x238d('0x31')]=_[_0x238d('0x32')](_0x122d27[_0x238d('0x2d')],_0x122d27[_0x238d('0x2f')]);_0x30e09d[_0x238d('0x33')]=_['intersection'](_0x122d27[_0x238d('0x2d')],qs[_0x238d('0x34')](_0x9b8ea3[_0x238d('0x2f')][_0x238d('0x34')]));_0x30e09d[_0x238d('0x33')]=_0x30e09d[_0x238d('0x33')][_0x238d('0x35')]?_0x30e09d[_0x238d('0x33')]:_0x122d27[_0x238d('0x2d')];if(!_0x9b8ea3['query'][_0x238d('0x36')]('nolimit')){_0x30e09d[_0x238d('0x1c')]=qs[_0x238d('0x1c')](_0x9b8ea3[_0x238d('0x2f')]['limit']);_0x30e09d[_0x238d('0x1e')]=qs[_0x238d('0x1e')](_0x9b8ea3[_0x238d('0x2f')][_0x238d('0x1e')]);}_0x30e09d[_0x238d('0x37')]=qs[_0x238d('0x38')](_0x9b8ea3['query'][_0x238d('0x38')]);_0x30e09d['where']=qs['filters'](_[_0x238d('0x39')](_0x9b8ea3[_0x238d('0x2f')],_0x122d27[_0x238d('0x31')]),_0x3e63b0);if(_0x9b8ea3['query']['filter']){_0x30e09d['where']=_[_0x238d('0x3a')](_0x30e09d[_0x238d('0x3b')],{'$or':_[_0x238d('0x2e')](_0x3e63b0,function(_0x11405c){if(_0x11405c[_0x238d('0x2b')]!==_0x238d('0x3c')){var _0x5458f3={};_0x5458f3[_0x11405c[_0x238d('0x26')]]={'$like':'%'+_0x9b8ea3['query'][_0x238d('0x3d')]+'%'};return _0x5458f3;}})});}_0x30e09d=_['merge']({},_0x30e09d,_0x9b8ea3[_0x238d('0x3e')]);var _0x41b3aa={'where':_0x30e09d[_0x238d('0x3b')]};return db[_0x238d('0x29')][_0x238d('0x1d')](_0x41b3aa)['then'](function(_0x3ba297){_0x4ebb1f[_0x238d('0x1d')]=_0x3ba297;if(_0x9b8ea3[_0x238d('0x2f')][_0x238d('0x3f')]){_0x30e09d[_0x238d('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x238d('0x41')](_0x30e09d);})['then'](function(_0x157e20){_0x4ebb1f['rows']=_0x157e20;return _0x4ebb1f;})[_0x238d('0x22')](respondWithFilteredResult(_0x5bbd96,_0x30e09d))[_0x238d('0x42')](handleError(_0x5bbd96,null));};exports[_0x238d('0x43')]=function(_0xc43a61,_0xdb8c16){var _0x3bf1eb={'raw':![],'where':{'id':_0xc43a61[_0x238d('0x44')]['id']}},_0x10a21a={};_0x10a21a[_0x238d('0x2d')]=_['keys'](db[_0x238d('0x29')][_0x238d('0x2a')]);_0x10a21a[_0x238d('0x2f')]=_[_0x238d('0x30')](_0xc43a61['query']);_0x10a21a[_0x238d('0x31')]=_[_0x238d('0x32')](_0x10a21a[_0x238d('0x2d')],_0x10a21a[_0x238d('0x2f')]);_0x3bf1eb[_0x238d('0x33')]=_['intersection'](_0x10a21a['model'],qs[_0x238d('0x34')](_0xc43a61[_0x238d('0x2f')][_0x238d('0x34')]));_0x3bf1eb[_0x238d('0x33')]=_0x3bf1eb[_0x238d('0x33')][_0x238d('0x35')]?_0x3bf1eb[_0x238d('0x33')]:_0x10a21a['model'];if(_0xc43a61[_0x238d('0x2f')][_0x238d('0x3f')]){_0x3bf1eb[_0x238d('0x40')]=[{'all':!![]}];}_0x3bf1eb=_[_0x238d('0x3a')]({},_0x3bf1eb,_0xc43a61[_0x238d('0x3e')]);return db[_0x238d('0x29')]['find'](_0x3bf1eb)[_0x238d('0x22')](handleEntityNotFound(_0xdb8c16,null))[_0x238d('0x22')](respondWithResult(_0xdb8c16,null))['catch'](handleError(_0xdb8c16,null));};exports[_0x238d('0x45')]=function(_0x2a835b,_0x13cf37){return db[_0x238d('0x29')][_0x238d('0x45')](_0x2a835b['body'],{})[_0x238d('0x22')](respondWithResult(_0x13cf37,0xc9))[_0x238d('0x42')](handleError(_0x13cf37,null));};exports[_0x238d('0x21')]=function(_0xfbb74f,_0x37ab6a){if(_0xfbb74f[_0x238d('0x46')]['id']){delete _0xfbb74f[_0x238d('0x46')]['id'];}return db[_0x238d('0x29')][_0x238d('0x47')]({'where':{'id':_0xfbb74f[_0x238d('0x44')]['id']}})['then'](handleEntityNotFound(_0x37ab6a,null))[_0x238d('0x22')](saveUpdates(_0xfbb74f['body'],null))[_0x238d('0x22')](respondWithResult(_0x37ab6a,null))['catch'](handleError(_0x37ab6a,null));};exports[_0x238d('0x23')]=function(_0x46c0a7,_0x1dd124){return db[_0x238d('0x29')]['find']({'where':{'id':_0x46c0a7['params']['id']}})['then'](handleEntityNotFound(_0x1dd124,null))[_0x238d('0x22')](removeEntity(_0x1dd124,null))[_0x238d('0x42')](handleError(_0x1dd124,null));};exports[_0x238d('0x48')]=function(_0x332d97,_0x35d281,_0x1c4e61){var _0x5941f3={};var _0x1bb314={};var _0x2bf059;var _0x43b9a6;return db[_0x238d('0x29')]['findOne']({'where':{'id':_0x332d97[_0x238d('0x44')]['id']}})[_0x238d('0x22')](handleEntityNotFound(_0x35d281,null))[_0x238d('0x22')](function(_0x368a98){if(_0x368a98){_0x2bf059=_0x368a98;_0x1bb314['model']=_[_0x238d('0x30')](db[_0x238d('0x49')][_0x238d('0x2a')]);_0x1bb314[_0x238d('0x2f')]=_[_0x238d('0x30')](_0x332d97[_0x238d('0x2f')]);_0x1bb314[_0x238d('0x31')]=_[_0x238d('0x32')](_0x1bb314[_0x238d('0x2d')],_0x1bb314[_0x238d('0x2f')]);_0x5941f3[_0x238d('0x33')]=_[_0x238d('0x32')](_0x1bb314[_0x238d('0x2d')],qs['fields'](_0x332d97[_0x238d('0x2f')][_0x238d('0x34')]));_0x5941f3['attributes']=_0x5941f3[_0x238d('0x33')][_0x238d('0x35')]?_0x5941f3[_0x238d('0x33')]:_0x1bb314[_0x238d('0x2d')];_0x5941f3[_0x238d('0x37')]=qs[_0x238d('0x38')](_0x332d97[_0x238d('0x2f')]['sort']);_0x5941f3[_0x238d('0x3b')]=qs[_0x238d('0x31')](_[_0x238d('0x39')](_0x332d97[_0x238d('0x2f')],_0x1bb314[_0x238d('0x31')]));if(_0x332d97[_0x238d('0x2f')][_0x238d('0x3d')]){_0x5941f3[_0x238d('0x3b')]=_[_0x238d('0x3a')](_0x5941f3[_0x238d('0x3b')],{'$or':_[_0x238d('0x2e')](_0x5941f3[_0x238d('0x33')],function(_0x4fabb4){var _0x467d7e={};_0x467d7e[_0x4fabb4]={'$like':'%'+_0x332d97[_0x238d('0x2f')][_0x238d('0x3d')]+'%'};return _0x467d7e;})});}_0x5941f3=_['merge']({},_0x5941f3,_0x332d97[_0x238d('0x3e')]);return _0x2bf059[_0x238d('0x48')](_0x5941f3);}})[_0x238d('0x22')](function(_0x3efe75){if(_0x3efe75){_0x43b9a6=_0x3efe75['length'];if(!_0x332d97['query']['hasOwnProperty'](_0x238d('0x4a'))){_0x5941f3[_0x238d('0x1c')]=qs[_0x238d('0x1c')](_0x332d97[_0x238d('0x2f')][_0x238d('0x1c')]);_0x5941f3[_0x238d('0x1e')]=qs['offset'](_0x332d97[_0x238d('0x2f')][_0x238d('0x1e')]);}return _0x2bf059['getConfigurations'](_0x5941f3);}})[_0x238d('0x22')](function(_0x24d024){if(_0x24d024){return _0x24d024?{'count':_0x43b9a6,'rows':_0x24d024}:null;}})[_0x238d('0x22')](respondWithResult(_0x35d281,null))['catch'](handleError(_0x35d281,null));};exports[_0x238d('0x4b')]=function(_0x15fa9b,_0x177b3e,_0x3b1903){if(_0x15fa9b[_0x238d('0x46')]['id']){delete _0x15fa9b[_0x238d('0x46')]['id'];}return db[_0x238d('0x29')][_0x238d('0x4c')]({'where':{'id':_0x15fa9b['params']['id']}})[_0x238d('0x22')](handleEntityNotFound(_0x177b3e,null))[_0x238d('0x22')](function(_0xba70a0){if(_0xba70a0){_0x15fa9b['body'][_0x238d('0x4d')]=_0xba70a0['id'];_0x15fa9b['body'][_0x238d('0x4e')]=integrations[_0x238d('0x4f')](_0x15fa9b[_0x238d('0x46')]['channel'],_0x15fa9b[_0x238d('0x46')][_0x238d('0x2b')]);_0x15fa9b[_0x238d('0x46')][_0x238d('0x50')]=integrations[_0x238d('0x51')](_0x15fa9b[_0x238d('0x46')][_0x238d('0x52')],_0x15fa9b[_0x238d('0x46')][_0x238d('0x2b')]);return db[_0x238d('0x49')][_0x238d('0x45')](_0x15fa9b[_0x238d('0x46')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x238d('0x53')],'as':_0x238d('0x50')}]});}return null;})['then'](respondWithResult(_0x177b3e,null))[_0x238d('0x42')](handleError(_0x177b3e,null));};exports[_0x238d('0x54')]=function(_0x4147ed,_0xa5ed9e,_0x44ea93){var _0x16de38=[{'name':_0x238d('0x55'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x53a54e='';return db[_0x238d('0x29')][_0x238d('0x4c')]({'where':{'id':_0x4147ed['params']['id']},'attributes':['id',_0x238d('0x56'),_0x238d('0x57'),_0x238d('0x58'),_0x238d('0x59'),'consumerKey',_0x238d('0x5a'),_0x238d('0x5b'),'tokenSecret']})[_0x238d('0x22')](handleEntityNotFound(_0xa5ed9e,null))[_0x238d('0x22')](function(_0x38f2c6){if(_0x38f2c6){_0x53a54e=_0x38f2c6[_0x238d('0x56')];var _0x24461d=_0x53a54e[_0x238d('0x5c')](-0x1);if(_0x24461d==='/'){_0x53a54e=_0x53a54e[_0x238d('0x5d')](0x0,_0x53a54e[_0x238d('0x5e')](_0x24461d));}var _0xc2e178={'method':_0x238d('0x5f'),'uri':util['format'](_0x238d('0x60'),_0x53a54e),'headers':{'Content-Type':_0x238d('0x61'),'Accept':_0x238d('0x61')},'json':!![]};if(_0x38f2c6['authType']===_0x238d('0x62')){_0xc2e178[_0x238d('0x63')][_0x238d('0x64')]=util['format'](_0x238d('0x65'),new Buffer(util[_0x238d('0x66')](_0x238d('0x67'),_0x38f2c6['username'],_0x38f2c6[_0x238d('0x59')]))[_0x238d('0x68')](_0x238d('0x69')));}return rp(_0xc2e178)['then'](function(_0x2108f0){return _0x16de38[_0x238d('0x6a')](_[_0x238d('0x2e')](_0x2108f0[_0x238d('0x6b')][_0x238d('0x6c')],function(_0x111ce7){return{'id':_0x111ce7[_0x238d('0x26')],'name':_0x111ce7[_0x238d('0x26')],'type':_0x111ce7[_0x238d('0x2b')],'active':_0x111ce7[_0x238d('0x6d')],'label':_0x111ce7[_0x238d('0x6e')],'custom':!![]};}));});}})[_0x238d('0x22')](function(_0x8af4f1){return{'count':_0x8af4f1[_0x238d('0x35')],'rows':_0x8af4f1};})[_0x238d('0x22')](respondWithResult(_0xa5ed9e,null))['catch'](function(_0xeec489){var _0x3eed0e=_0x4147ed[_0x238d('0x2f')][_0x238d('0x6f')]?0x1f4:_0xeec489[_0x238d('0x70')]||0x1f4;logger[_0x238d('0x71')](_0x238d('0x72'),_0x238d('0x54'),_0x3eed0e,JSON['stringify'](_0xeec489));delete _0xeec489['name'];if(_0x3eed0e===0x191){_0x3eed0e=0x190;}_0xa5ed9e['status'](_0x3eed0e)[_0x238d('0x27')](_0x4147ed['query'][_0x238d('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0xeec489[_0x238d('0x70')]}:_0xeec489);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 74cac9c..35a15a0 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 _0x44e9=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes'];(function(_0x3d93a0,_0x73f99a){var _0x233b91=function(_0x553b92){while(--_0x553b92){_0x3d93a0['push'](_0x3d93a0['shift']());}};_0x233b91(++_0x73f99a);}(_0x44e9,0x66));var _0x944e=function(_0x817495,_0x4aa026){_0x817495=_0x817495-0x0;var _0x5ea7e0=_0x44e9[_0x817495];return _0x5ea7e0;};'use strict';var _=require(_0x944e('0x0'));var util=require(_0x944e('0x1'));var logger=require(_0x944e('0x2'))(_0x944e('0x3'));var moment=require(_0x944e('0x4'));var BPromise=require('bluebird');var rp=require(_0x944e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x944e('0x6'));var attributes=require(_0x944e('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x318848,_0x5b52a5){return _0x318848['define'](_0x944e('0x8'),attributes,{'tableName':_0x944e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee74=['int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xee74,0xa9));var _0x4ee7=function(_0x28a352,_0x3dbfc6){_0x28a352=_0x28a352-0x0;var _0x24e506=_0xee74[_0x28a352];return _0x24e506;};'use strict';var _=require(_0x4ee7('0x0'));var util=require('util');var logger=require(_0x4ee7('0x1'))(_0x4ee7('0x2'));var moment=require(_0x4ee7('0x3'));var BPromise=require(_0x4ee7('0x4'));var rp=require(_0x4ee7('0x5'));var fs=require('fs');var path=require(_0x4ee7('0x6'));var rimraf=require(_0x4ee7('0x7'));var config=require(_0x4ee7('0x8'));var attributes=require(_0x4ee7('0x9'));var integrations=require(_0x4ee7('0xa'));module[_0x4ee7('0xb')]=function(_0x5b2025,_0x2bee7f){return _0x5b2025[_0x4ee7('0xc')]('DeskAccount',attributes,{'tableName':_0x4ee7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index dfad9d8..a328a2f 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 _0x77da=['limit','include','model','map','GetDeskAccount','ShowDeskAccount','DeskAccount','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','findAll','options','raw','attributes'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x77da,0x17f));var _0xa77d=function(_0x53442d,_0x248cc1){_0x53442d=_0x53442d-0x0;var _0x4ade0e=_0x77da[_0x53442d];return _0x4ade0e;};'use strict';var _=require(_0xa77d('0x0'));var util=require(_0xa77d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa77d('0x2'));var fs=require('fs');var Redis=require(_0xa77d('0x3'));var db=require(_0xa77d('0x4'))['db'];var utils=require(_0xa77d('0x5'));var logger=require('../../config/logger')(_0xa77d('0x6'));var config=require(_0xa77d('0x7'));var jayson=require(_0xa77d('0x8'));var client=jayson['client'][_0xa77d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1444f5,_0x1230c6,_0xb703f3){return new BPromise(function(_0x1a6ecc,_0xd5f904){return client[_0xa77d('0xa')](_0x1444f5,_0xb703f3)[_0xa77d('0xb')](function(_0x2922a6){logger['info']('DeskAccount,\x20%s,\x20%s',_0x1230c6,_0xa77d('0xc'));logger[_0xa77d('0xd')](_0xa77d('0xe'),_0x1230c6,_0xa77d('0xc'),JSON[_0xa77d('0xf')](_0x2922a6));if(_0x2922a6[_0xa77d('0x10')]){if(_0x2922a6[_0xa77d('0x10')][_0xa77d('0x11')]===0x1f4){logger[_0xa77d('0x10')](_0xa77d('0x12'),_0x1230c6,_0x2922a6['error']['message']);return _0xd5f904(_0x2922a6[_0xa77d('0x10')]['message']);}logger[_0xa77d('0x10')](_0xa77d('0x12'),_0x1230c6,_0x2922a6['error'][_0xa77d('0x13')]);return _0x1a6ecc(_0x2922a6['error']['message']);}else{logger[_0xa77d('0x14')]('DeskAccount,\x20%s,\x20%s',_0x1230c6,'request\x20sent');_0x1a6ecc(_0x2922a6['result']['message']);}})['catch'](function(_0x3bc6db){logger[_0xa77d('0x10')]('DeskAccount,\x20%s,\x20%s',_0x1230c6,_0x3bc6db);_0xd5f904(_0x3bc6db);});});}exports['GetDeskAccount']=function(_0x313970){var _0x3d41dd=this;return new Promise(function(_0xd234b0,_0x23541e){return db['DeskAccount'][_0xa77d('0x15')]({'raw':_0x313970[_0xa77d('0x16')]?_0x313970[_0xa77d('0x16')][_0xa77d('0x17')]===undefined?!![]:![]:!![],'where':_0x313970['options']?_0x313970[_0xa77d('0x16')]['where']||null:null,'attributes':_0x313970[_0xa77d('0x16')]?_0x313970[_0xa77d('0x16')][_0xa77d('0x18')]||null:null,'limit':_0x313970[_0xa77d('0x16')]?_0x313970['options'][_0xa77d('0x19')]||null:null,'include':_0x313970['options']?_0x313970[_0xa77d('0x16')][_0xa77d('0x1a')]?_['map'](_0x313970[_0xa77d('0x16')]['include'],function(_0x2dbe99){return{'model':db[_0x2dbe99[_0xa77d('0x1b')]],'as':_0x2dbe99['as'],'attributes':_0x2dbe99[_0xa77d('0x18')],'include':_0x2dbe99['include']?_[_0xa77d('0x1c')](_0x2dbe99['include'],function(_0x7f2ddb){return{'model':db[_0x7f2ddb[_0xa77d('0x1b')]],'as':_0x7f2ddb['as'],'attributes':_0x7f2ddb[_0xa77d('0x18')],'include':_0x7f2ddb[_0xa77d('0x1a')]?_[_0xa77d('0x1c')](_0x7f2ddb[_0xa77d('0x1a')],function(_0x4c2b15){return{'model':db[_0x4c2b15[_0xa77d('0x1b')]],'as':_0x4c2b15['as'],'attributes':_0x4c2b15[_0xa77d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa77d('0xb')](function(_0xb5fa33){logger[_0xa77d('0x14')](_0xa77d('0x1d'),_0x313970);logger[_0xa77d('0xd')](_0xa77d('0x1d'),_0x313970,JSON[_0xa77d('0xf')](_0xb5fa33));_0xd234b0(_0xb5fa33);})['catch'](function(_0x2dc09f){logger['error'](_0xa77d('0x1d'),_0x2dc09f[_0xa77d('0x13')],_0x313970);_0x23541e(_0x3d41dd['error'](0x1f4,_0x2dc09f['message']));});});};exports[_0xa77d('0x1e')]=function(_0x5f5454){var _0x49c29a=this;return new Promise(function(_0x2afafe,_0x3bffc1){return db[_0xa77d('0x1f')][_0xa77d('0x20')]({'raw':_0x5f5454[_0xa77d('0x16')]?_0x5f5454[_0xa77d('0x16')][_0xa77d('0x17')]===undefined?!![]:![]:!![],'where':_0x5f5454[_0xa77d('0x16')]?_0x5f5454[_0xa77d('0x16')][_0xa77d('0x21')]||null:null,'attributes':_0x5f5454['options']?_0x5f5454[_0xa77d('0x16')]['attributes']||null:null,'include':_0x5f5454[_0xa77d('0x16')]?_0x5f5454[_0xa77d('0x16')][_0xa77d('0x1a')]?_[_0xa77d('0x1c')](_0x5f5454[_0xa77d('0x16')][_0xa77d('0x1a')],function(_0x5db58e){return{'model':db[_0x5db58e[_0xa77d('0x1b')]],'as':_0x5db58e['as'],'attributes':_0x5db58e[_0xa77d('0x18')],'include':_0x5db58e[_0xa77d('0x1a')]?_['map'](_0x5db58e[_0xa77d('0x1a')],function(_0x189d13){return{'model':db[_0x189d13[_0xa77d('0x1b')]],'as':_0x189d13['as'],'attributes':_0x189d13['attributes'],'include':_0x189d13[_0xa77d('0x1a')]?_[_0xa77d('0x1c')](_0x189d13[_0xa77d('0x1a')],function(_0x23d038){return{'model':db[_0x23d038[_0xa77d('0x1b')]],'as':_0x23d038['as'],'attributes':_0x23d038[_0xa77d('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa77d('0xb')](function(_0x1bd420){logger['info'](_0xa77d('0x1e'),_0x5f5454);logger[_0xa77d('0xd')](_0xa77d('0x1e'),_0x5f5454,JSON['stringify'](_0x1bd420));_0x2afafe(_0x1bd420);})['catch'](function(_0x30ca76){logger[_0xa77d('0x10')](_0xa77d('0x1e'),_0x30ca76[_0xa77d('0x13')],_0x5f5454);_0x3bffc1(_0x49c29a['error'](0x1f4,_0x30ca76[_0xa77d('0x13')]));});});}; \ No newline at end of file +var _0x3f59=['result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','include','map','model','catch','find','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4d70ba,_0x12348f){var _0x2fa1bf=function(_0x3d2b20){while(--_0x3d2b20){_0x4d70ba['push'](_0x4d70ba['shift']());}};_0x2fa1bf(++_0x12348f);}(_0x3f59,0x12d));var _0x93f5=function(_0x2557df,_0x37f6c2){_0x2557df=_0x2557df-0x0;var _0x2d7006=_0x3f59[_0x2557df];return _0x2d7006;};'use strict';var _=require('lodash');var util=require(_0x93f5('0x0'));var moment=require(_0x93f5('0x1'));var BPromise=require(_0x93f5('0x2'));var rs=require(_0x93f5('0x3'));var fs=require('fs');var Redis=require(_0x93f5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x93f5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f5('0x6'));var client=jayson['client'][_0x93f5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40d57d,_0x2d3041,_0x4fd86c){return new BPromise(function(_0x83dbce,_0x3f56af){return client[_0x93f5('0x8')](_0x40d57d,_0x4fd86c)[_0x93f5('0x9')](function(_0x1e6f20){logger[_0x93f5('0xa')](_0x93f5('0xb'),_0x2d3041,'request\x20sent');logger[_0x93f5('0xc')](_0x93f5('0xd'),_0x2d3041,_0x93f5('0xe'),JSON[_0x93f5('0xf')](_0x1e6f20));if(_0x1e6f20[_0x93f5('0x10')]){if(_0x1e6f20[_0x93f5('0x10')][_0x93f5('0x11')]===0x1f4){logger[_0x93f5('0x10')]('DeskAccount,\x20%s,\x20%s',_0x2d3041,_0x1e6f20[_0x93f5('0x10')][_0x93f5('0x12')]);return _0x3f56af(_0x1e6f20[_0x93f5('0x10')]['message']);}logger[_0x93f5('0x10')](_0x93f5('0xb'),_0x2d3041,_0x1e6f20['error'][_0x93f5('0x12')]);return _0x83dbce(_0x1e6f20['error'][_0x93f5('0x12')]);}else{logger[_0x93f5('0xa')]('DeskAccount,\x20%s,\x20%s',_0x2d3041,_0x93f5('0xe'));_0x83dbce(_0x1e6f20[_0x93f5('0x13')][_0x93f5('0x12')]);}})['catch'](function(_0xe6d2a4){logger[_0x93f5('0x10')](_0x93f5('0xb'),_0x2d3041,_0xe6d2a4);_0x3f56af(_0xe6d2a4);});});}exports[_0x93f5('0x14')]=function(_0x3a3baa){var _0x3cb33b=this;return new Promise(function(_0x570397,_0x11eb13){return db[_0x93f5('0x15')][_0x93f5('0x16')]({'raw':_0x3a3baa['options']?_0x3a3baa[_0x93f5('0x17')][_0x93f5('0x18')]===undefined?!![]:![]:!![],'where':_0x3a3baa[_0x93f5('0x17')]?_0x3a3baa[_0x93f5('0x17')]['where']||null:null,'attributes':_0x3a3baa[_0x93f5('0x17')]?_0x3a3baa['options'][_0x93f5('0x19')]||null:null,'limit':_0x3a3baa[_0x93f5('0x17')]?_0x3a3baa['options']['limit']||null:null,'include':_0x3a3baa[_0x93f5('0x17')]?_0x3a3baa[_0x93f5('0x17')][_0x93f5('0x1a')]?_[_0x93f5('0x1b')](_0x3a3baa['options'][_0x93f5('0x1a')],function(_0x30b97a){return{'model':db[_0x30b97a['model']],'as':_0x30b97a['as'],'attributes':_0x30b97a['attributes'],'include':_0x30b97a[_0x93f5('0x1a')]?_[_0x93f5('0x1b')](_0x30b97a[_0x93f5('0x1a')],function(_0x4f04f2){return{'model':db[_0x4f04f2[_0x93f5('0x1c')]],'as':_0x4f04f2['as'],'attributes':_0x4f04f2['attributes'],'include':_0x4f04f2[_0x93f5('0x1a')]?_[_0x93f5('0x1b')](_0x4f04f2['include'],function(_0x292b9a){return{'model':db[_0x292b9a[_0x93f5('0x1c')]],'as':_0x292b9a['as'],'attributes':_0x292b9a[_0x93f5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4253bf){logger[_0x93f5('0xa')](_0x93f5('0x14'),_0x3a3baa);logger['debug'](_0x93f5('0x14'),_0x3a3baa,JSON[_0x93f5('0xf')](_0x4253bf));_0x570397(_0x4253bf);})[_0x93f5('0x1d')](function(_0x233f46){logger[_0x93f5('0x10')](_0x93f5('0x14'),_0x233f46[_0x93f5('0x12')],_0x3a3baa);_0x11eb13(_0x3cb33b['error'](0x1f4,_0x233f46[_0x93f5('0x12')]));});});};exports['ShowDeskAccount']=function(_0xc5db5){var _0x35b41b=this;return new Promise(function(_0x4d81be,_0x24e961){return db[_0x93f5('0x15')][_0x93f5('0x1e')]({'raw':_0xc5db5[_0x93f5('0x17')]?_0xc5db5[_0x93f5('0x17')][_0x93f5('0x18')]===undefined?!![]:![]:!![],'where':_0xc5db5[_0x93f5('0x17')]?_0xc5db5[_0x93f5('0x17')]['where']||null:null,'attributes':_0xc5db5[_0x93f5('0x17')]?_0xc5db5[_0x93f5('0x17')][_0x93f5('0x19')]||null:null,'include':_0xc5db5[_0x93f5('0x17')]?_0xc5db5['options'][_0x93f5('0x1a')]?_[_0x93f5('0x1b')](_0xc5db5['options'][_0x93f5('0x1a')],function(_0x103f33){return{'model':db[_0x103f33['model']],'as':_0x103f33['as'],'attributes':_0x103f33['attributes'],'include':_0x103f33[_0x93f5('0x1a')]?_[_0x93f5('0x1b')](_0x103f33[_0x93f5('0x1a')],function(_0x396ae3){return{'model':db[_0x396ae3[_0x93f5('0x1c')]],'as':_0x396ae3['as'],'attributes':_0x396ae3[_0x93f5('0x19')],'include':_0x396ae3['include']?_[_0x93f5('0x1b')](_0x396ae3[_0x93f5('0x1a')],function(_0x57198b){return{'model':db[_0x57198b[_0x93f5('0x1c')]],'as':_0x57198b['as'],'attributes':_0x57198b[_0x93f5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20d756){logger[_0x93f5('0xa')]('ShowDeskAccount',_0xc5db5);logger[_0x93f5('0xc')]('ShowDeskAccount',_0xc5db5,JSON[_0x93f5('0xf')](_0x20d756));_0x4d81be(_0x20d756);})[_0x93f5('0x1d')](function(_0xab8a29){logger[_0x93f5('0x10')](_0x93f5('0x1f'),_0xab8a29[_0x93f5('0x12')],_0xc5db5);_0x24e961(_0x35b41b['error'](0x1f4,_0xab8a29[_0x93f5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9b7d484..ccb9aa8 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x24fd0f,_0x2e925e){var _0x3d0bae=function(_0x20c576){while(--_0x20c576){_0x24fd0f['push'](_0x24fd0f['shift']());}};_0x3d0bae(++_0x2e925e);}(_0xedd9,0xfc));var _0x9edd=function(_0x252bbd,_0x344ece){_0x252bbd=_0x252bbd-0x0;var _0x502cf1=_0xedd9[_0x252bbd];return _0x502cf1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _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(_0x4ccde3,_0x38ca57){var _0x3348ac=function(_0x5433f0){while(--_0x5433f0){_0x4ccde3['push'](_0x4ccde3['shift']());}};_0x3348ac(++_0x38ca57);}(_0x55ca,0x126));var _0xa55c=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x55ca[_0x314a8c];return _0x1d4607;};'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 2a8ec7e..5767234 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 _0x0465=['sequelize','STRING'];(function(_0x127e57,_0x2d0c56){var _0xea70c5=function(_0x1aeb49){while(--_0x1aeb49){_0x127e57['push'](_0x127e57['shift']());}};_0xea70c5(++_0x2d0c56);}(_0x0465,0x84));var _0x5046=function(_0x1793a7,_0x2a76c3){_0x1793a7=_0x1793a7-0x0;var _0x441c2f=_0x0465[_0x1793a7];return _0x441c2f;};'use strict';var Sequelize=require(_0x5046('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5046('0x1')]}}; \ No newline at end of file +var _0x9700=['sequelize','STRING'];(function(_0x27a5b8,_0x10b486){var _0x31d17e=function(_0x4e852){while(--_0x4e852){_0x27a5b8['push'](_0x27a5b8['shift']());}};_0x31d17e(++_0x10b486);}(_0x9700,0x1ce));var _0x0970=function(_0x1d292a,_0x4ff387){_0x1d292a=_0x1d292a-0x0;var _0x101dfe=_0x9700[_0x1d292a];return _0x101dfe;};'use strict';var Sequelize=require(_0x0970('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0970('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4d5ee89..2d9e897 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 _0x11df=['then','destroy','error','name','index','map','DeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','rawAttributes','create','body','params','find','getFields','findOne','DeskField','options','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x11df,0x186));var _0xf11d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x11df[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xf11d('0x0'));var rimraf=require(_0xf11d('0x1'));var zipdir=require(_0xf11d('0x2'));var jsonpatch=require(_0xf11d('0x3'));var rp=require(_0xf11d('0x4'));var moment=require(_0xf11d('0x5'));var BPromise=require(_0xf11d('0x6'));var Mustache=require(_0xf11d('0x7'));var util=require(_0xf11d('0x8'));var path=require(_0xf11d('0x9'));var sox=require('sox');var csv=require(_0xf11d('0xa'));var ejs=require(_0xf11d('0xb'));var fs=require('fs');var fs_extra=require(_0xf11d('0xc'));var _=require(_0xf11d('0xd'));var squel=require('squel');var crypto=require(_0xf11d('0xe'));var jsforce=require(_0xf11d('0xf'));var deskjs=require(_0xf11d('0x10'));var toCsv=require(_0xf11d('0xa'));var querystring=require(_0xf11d('0x11'));var Papa=require(_0xf11d('0x12'));var Redis=require(_0xf11d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf11d('0x14'));var hardwareService=require(_0xf11d('0x15'));var logger=require(_0xf11d('0x16'))('api');var utils=require(_0xf11d('0x17'));var config=require(_0xf11d('0x18'));var licenseUtil=require(_0xf11d('0x19'));var db=require(_0xf11d('0x1a'))['db'];function respondWithStatusCode(_0x5ce238,_0x459f23){_0x459f23=_0x459f23||0xcc;return function(_0x58a98b){if(_0x58a98b){return _0x5ce238[_0xf11d('0x1b')](_0x459f23);}return _0x5ce238[_0xf11d('0x1c')](_0x459f23)[_0xf11d('0x1d')]();};}function respondWithResult(_0x5d07c8,_0x2c4883){_0x2c4883=_0x2c4883||0xc8;return function(_0x103e7e){if(_0x103e7e){return _0x5d07c8[_0xf11d('0x1c')](_0x2c4883)[_0xf11d('0x1e')](_0x103e7e);}};}function respondWithFilteredResult(_0x595be8,_0x2f053a){return function(_0x5a66e0){if(_0x5a66e0){var _0x3187a3=typeof _0x2f053a['offset']===_0xf11d('0x1f')&&typeof _0x2f053a[_0xf11d('0x20')]==='undefined';var _0x48004a=_0x5a66e0[_0xf11d('0x21')];var _0x5501d6=_0x3187a3?0x0:_0x2f053a[_0xf11d('0x22')];var _0x10609b=_0x3187a3?_0x5a66e0[_0xf11d('0x21')]:_0x2f053a[_0xf11d('0x22')]+_0x2f053a[_0xf11d('0x20')];var _0x5d6351;if(_0x10609b>=_0x48004a){_0x10609b=_0x48004a;_0x5d6351=0xc8;}else{_0x5d6351=0xce;}_0x595be8[_0xf11d('0x1c')](_0x5d6351);return _0x595be8[_0xf11d('0x23')](_0xf11d('0x24'),_0x5501d6+'-'+_0x10609b+'/'+_0x48004a)[_0xf11d('0x1e')](_0x5a66e0);}return null;};}function patchUpdates(_0x24d6ad){return function(_0x3b960d){try{jsonpatch[_0xf11d('0x25')](_0x3b960d,_0x24d6ad,!![]);}catch(_0x14da5c){return BPromise[_0xf11d('0x26')](_0x14da5c);}return _0x3b960d['save']();};}function saveUpdates(_0x2ebc99,_0x42d0c1){return function(_0x265d0c){if(_0x265d0c){return _0x265d0c[_0xf11d('0x27')](_0x2ebc99)[_0xf11d('0x28')](function(_0xb4f17b){return _0xb4f17b;});}return null;};}function removeEntity(_0x319925,_0x3e5598){return function(_0x31fcd1){if(_0x31fcd1){return _0x31fcd1[_0xf11d('0x29')]()['then'](function(){_0x319925[_0xf11d('0x1c')](0xcc)[_0xf11d('0x1d')]();});}};}function handleEntityNotFound(_0x19f06c,_0x23eae4){return function(_0x1dd6af){if(!_0x1dd6af){_0x19f06c['sendStatus'](0x194);}return _0x1dd6af;};}function handleError(_0x28dc5e,_0x45eb6d){_0x45eb6d=_0x45eb6d||0x1f4;return function(_0x498bcf){logger[_0xf11d('0x2a')](_0x498bcf['stack']);if(_0x498bcf[_0xf11d('0x2b')]){delete _0x498bcf[_0xf11d('0x2b')];}_0x28dc5e[_0xf11d('0x1c')](_0x45eb6d)['send'](_0x498bcf);};}exports[_0xf11d('0x2c')]=function(_0x4cbf3e,_0x470566){var _0x140432={},_0x4bbd56={},_0x428641={'count':0x0,'rows':[]};var _0x4d6109=_[_0xf11d('0x2d')](db[_0xf11d('0x2e')]['rawAttributes'],function(_0x4d78db){return{'name':_0x4d78db[_0xf11d('0x2f')],'type':_0x4d78db['type'][_0xf11d('0x30')]};});_0x4bbd56[_0xf11d('0x31')]=_[_0xf11d('0x2d')](_0x4d6109,_0xf11d('0x2b'));_0x4bbd56[_0xf11d('0x32')]=_[_0xf11d('0x33')](_0x4cbf3e['query']);_0x4bbd56[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0x4bbd56[_0xf11d('0x31')],_0x4bbd56[_0xf11d('0x32')]);_0x140432[_0xf11d('0x36')]=_[_0xf11d('0x35')](_0x4bbd56['model'],qs[_0xf11d('0x37')](_0x4cbf3e[_0xf11d('0x32')]['fields']));_0x140432[_0xf11d('0x36')]=_0x140432['attributes'][_0xf11d('0x38')]?_0x140432[_0xf11d('0x36')]:_0x4bbd56[_0xf11d('0x31')];if(!_0x4cbf3e['query']['hasOwnProperty'](_0xf11d('0x39'))){_0x140432[_0xf11d('0x20')]=qs['limit'](_0x4cbf3e[_0xf11d('0x32')]['limit']);_0x140432['offset']=qs[_0xf11d('0x22')](_0x4cbf3e[_0xf11d('0x32')][_0xf11d('0x22')]);}_0x140432[_0xf11d('0x3a')]=qs[_0xf11d('0x3b')](_0x4cbf3e['query'][_0xf11d('0x3b')]);_0x140432['where']=qs['filters'](_[_0xf11d('0x3c')](_0x4cbf3e[_0xf11d('0x32')],_0x4bbd56['filters']),_0x4d6109);if(_0x4cbf3e[_0xf11d('0x32')][_0xf11d('0x3d')]){_0x140432[_0xf11d('0x3e')]=_[_0xf11d('0x3f')](_0x140432[_0xf11d('0x3e')],{'$or':_[_0xf11d('0x2d')](_0x4d6109,function(_0x5a12b0){if(_0x5a12b0[_0xf11d('0x40')]!==_0xf11d('0x41')){var _0x59d974={};_0x59d974[_0x5a12b0[_0xf11d('0x2b')]]={'$like':'%'+_0x4cbf3e[_0xf11d('0x32')][_0xf11d('0x3d')]+'%'};return _0x59d974;}})});}_0x140432=_[_0xf11d('0x3f')]({},_0x140432,_0x4cbf3e['options']);var _0x1a974c={'where':_0x140432['where']};return db[_0xf11d('0x2e')][_0xf11d('0x21')](_0x1a974c)[_0xf11d('0x28')](function(_0x440a59){_0x428641[_0xf11d('0x21')]=_0x440a59;if(_0x4cbf3e[_0xf11d('0x32')][_0xf11d('0x42')]){_0x140432[_0xf11d('0x43')]=[{'all':!![]}];}return db[_0xf11d('0x2e')]['findAll'](_0x140432);})['then'](function(_0x10d2c3){_0x428641[_0xf11d('0x44')]=_0x10d2c3;return _0x428641;})[_0xf11d('0x28')](respondWithFilteredResult(_0x470566,_0x140432))[_0xf11d('0x45')](handleError(_0x470566,null));};exports['show']=function(_0x22d515,_0x58b7fd){var _0x426163={'raw':![],'where':{'id':_0x22d515['params']['id']}},_0xba18ed={};_0xba18ed['model']=_['keys'](db[_0xf11d('0x2e')][_0xf11d('0x46')]);_0xba18ed[_0xf11d('0x32')]=_['keys'](_0x22d515[_0xf11d('0x32')]);_0xba18ed[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0xba18ed[_0xf11d('0x31')],_0xba18ed['query']);_0x426163[_0xf11d('0x36')]=_[_0xf11d('0x35')](_0xba18ed[_0xf11d('0x31')],qs[_0xf11d('0x37')](_0x22d515[_0xf11d('0x32')]['fields']));_0x426163[_0xf11d('0x36')]=_0x426163['attributes'][_0xf11d('0x38')]?_0x426163[_0xf11d('0x36')]:_0xba18ed[_0xf11d('0x31')];if(_0x22d515[_0xf11d('0x32')][_0xf11d('0x42')]){_0x426163[_0xf11d('0x43')]=[{'all':!![]}];}_0x426163=_[_0xf11d('0x3f')]({},_0x426163,_0x22d515['options']);return db[_0xf11d('0x2e')]['find'](_0x426163)[_0xf11d('0x28')](handleEntityNotFound(_0x58b7fd,null))[_0xf11d('0x28')](respondWithResult(_0x58b7fd,null))[_0xf11d('0x45')](handleError(_0x58b7fd,null));};exports[_0xf11d('0x47')]=function(_0x17f733,_0x53e495){return db[_0xf11d('0x2e')][_0xf11d('0x47')](_0x17f733[_0xf11d('0x48')],{})[_0xf11d('0x28')](respondWithResult(_0x53e495,0xc9))[_0xf11d('0x45')](handleError(_0x53e495,null));};exports[_0xf11d('0x27')]=function(_0x1b18df,_0xc4b57c){if(_0x1b18df[_0xf11d('0x48')]['id']){delete _0x1b18df[_0xf11d('0x48')]['id'];}return db[_0xf11d('0x2e')]['find']({'where':{'id':_0x1b18df[_0xf11d('0x49')]['id']}})['then'](handleEntityNotFound(_0xc4b57c,null))[_0xf11d('0x28')](saveUpdates(_0x1b18df[_0xf11d('0x48')],null))['then'](respondWithResult(_0xc4b57c,null))[_0xf11d('0x45')](handleError(_0xc4b57c,null));};exports[_0xf11d('0x29')]=function(_0x392c1f,_0x1d8f96){return db[_0xf11d('0x2e')][_0xf11d('0x4a')]({'where':{'id':_0x392c1f['params']['id']}})[_0xf11d('0x28')](handleEntityNotFound(_0x1d8f96,null))[_0xf11d('0x28')](removeEntity(_0x1d8f96,null))[_0xf11d('0x45')](handleError(_0x1d8f96,null));};exports[_0xf11d('0x4b')]=function(_0x29032c,_0x4afeec,_0x28f62c){var _0x9f2219={};var _0x3d780d={};var _0x330ae8;var _0x2cc5c9;return db['DeskConfiguration'][_0xf11d('0x4c')]({'where':{'id':_0x29032c['params']['id']}})['then'](handleEntityNotFound(_0x4afeec,null))[_0xf11d('0x28')](function(_0x3d3d9a){if(_0x3d3d9a){_0x330ae8=_0x3d3d9a;_0x3d780d['model']=_[_0xf11d('0x33')](db[_0xf11d('0x4d')][_0xf11d('0x46')]);_0x3d780d[_0xf11d('0x32')]=_['keys'](_0x29032c[_0xf11d('0x32')]);_0x3d780d[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0x3d780d['model'],_0x3d780d[_0xf11d('0x32')]);_0x9f2219[_0xf11d('0x36')]=_[_0xf11d('0x35')](_0x3d780d[_0xf11d('0x31')],qs['fields'](_0x29032c[_0xf11d('0x32')][_0xf11d('0x37')]));_0x9f2219[_0xf11d('0x36')]=_0x9f2219[_0xf11d('0x36')][_0xf11d('0x38')]?_0x9f2219[_0xf11d('0x36')]:_0x3d780d[_0xf11d('0x31')];_0x9f2219['order']=qs[_0xf11d('0x3b')](_0x29032c['query'][_0xf11d('0x3b')]);_0x9f2219['where']=qs[_0xf11d('0x34')](_[_0xf11d('0x3c')](_0x29032c[_0xf11d('0x32')],_0x3d780d['filters']));if(_0x29032c[_0xf11d('0x32')][_0xf11d('0x3d')]){_0x9f2219['where']=_[_0xf11d('0x3f')](_0x9f2219[_0xf11d('0x3e')],{'$or':_[_0xf11d('0x2d')](_0x9f2219[_0xf11d('0x36')],function(_0x15f120){var _0x3010bd={};_0x3010bd[_0x15f120]={'$like':'%'+_0x29032c[_0xf11d('0x32')][_0xf11d('0x3d')]+'%'};return _0x3010bd;})});}_0x9f2219=_[_0xf11d('0x3f')]({},_0x9f2219,_0x29032c[_0xf11d('0x4e')]);return _0x330ae8[_0xf11d('0x4b')](_0x9f2219);}})['then'](function(_0x358444){if(_0x358444){_0x2cc5c9=_0x358444[_0xf11d('0x38')];if(!_0x29032c[_0xf11d('0x32')][_0xf11d('0x4f')](_0xf11d('0x39'))){_0x9f2219[_0xf11d('0x20')]=qs['limit'](_0x29032c[_0xf11d('0x32')][_0xf11d('0x20')]);_0x9f2219[_0xf11d('0x22')]=qs[_0xf11d('0x22')](_0x29032c[_0xf11d('0x32')][_0xf11d('0x22')]);}return _0x330ae8[_0xf11d('0x4b')](_0x9f2219);}})[_0xf11d('0x28')](function(_0x4df217){if(_0x4df217){return _0x4df217?{'count':_0x2cc5c9,'rows':_0x4df217}:null;}})[_0xf11d('0x28')](respondWithResult(_0x4afeec,null))['catch'](handleError(_0x4afeec,null));};exports[_0xf11d('0x50')]=function(_0x23ad35,_0x9defc5,_0x13aa52){var _0x450f31={};var _0x5c6cbe={};var _0x519429;var _0x48bd86;return db[_0xf11d('0x2e')]['findOne']({'where':{'id':_0x23ad35[_0xf11d('0x49')]['id']}})['then'](handleEntityNotFound(_0x9defc5,null))[_0xf11d('0x28')](function(_0x1b14ba){if(_0x1b14ba){_0x519429=_0x1b14ba;_0x5c6cbe[_0xf11d('0x31')]=_['keys'](db[_0xf11d('0x4d')][_0xf11d('0x46')]);_0x5c6cbe['query']=_[_0xf11d('0x33')](_0x23ad35['query']);_0x5c6cbe[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0x5c6cbe['model'],_0x5c6cbe[_0xf11d('0x32')]);_0x450f31['attributes']=_[_0xf11d('0x35')](_0x5c6cbe[_0xf11d('0x31')],qs['fields'](_0x23ad35[_0xf11d('0x32')][_0xf11d('0x37')]));_0x450f31[_0xf11d('0x36')]=_0x450f31[_0xf11d('0x36')][_0xf11d('0x38')]?_0x450f31[_0xf11d('0x36')]:_0x5c6cbe['model'];_0x450f31[_0xf11d('0x3a')]=qs[_0xf11d('0x3b')](_0x23ad35[_0xf11d('0x32')][_0xf11d('0x3b')]);_0x450f31[_0xf11d('0x3e')]=qs[_0xf11d('0x34')](_['pick'](_0x23ad35[_0xf11d('0x32')],_0x5c6cbe[_0xf11d('0x34')]));if(_0x23ad35['query'][_0xf11d('0x3d')]){_0x450f31[_0xf11d('0x3e')]=_[_0xf11d('0x3f')](_0x450f31[_0xf11d('0x3e')],{'$or':_['map'](_0x450f31[_0xf11d('0x36')],function(_0x1f7f91){var _0x112bb9={};_0x112bb9[_0x1f7f91]={'$like':'%'+_0x23ad35['query'][_0xf11d('0x3d')]+'%'};return _0x112bb9;})});}_0x450f31=_[_0xf11d('0x3f')]({},_0x450f31,_0x23ad35[_0xf11d('0x4e')]);return _0x519429['getSubjects'](_0x450f31);}})[_0xf11d('0x28')](function(_0x25a3df){if(_0x25a3df){_0x48bd86=_0x25a3df[_0xf11d('0x38')];if(!_0x23ad35[_0xf11d('0x32')][_0xf11d('0x4f')](_0xf11d('0x39'))){_0x450f31[_0xf11d('0x20')]=qs[_0xf11d('0x20')](_0x23ad35[_0xf11d('0x32')][_0xf11d('0x20')]);_0x450f31[_0xf11d('0x22')]=qs[_0xf11d('0x22')](_0x23ad35['query'][_0xf11d('0x22')]);}return _0x519429[_0xf11d('0x50')](_0x450f31);}})[_0xf11d('0x28')](function(_0x92505){if(_0x92505){return _0x92505?{'count':_0x48bd86,'rows':_0x92505}:null;}})[_0xf11d('0x28')](respondWithResult(_0x9defc5,null))[_0xf11d('0x45')](handleError(_0x9defc5,null));};exports[_0xf11d('0x51')]=function(_0x4b0343,_0x20f0f1,_0x3756f3){var _0x3167e1={};var _0x28c018={};var _0x2c00ea;var _0x10e0df;return db[_0xf11d('0x2e')][_0xf11d('0x4c')]({'where':{'id':_0x4b0343[_0xf11d('0x49')]['id']}})[_0xf11d('0x28')](handleEntityNotFound(_0x20f0f1,null))[_0xf11d('0x28')](function(_0x15f430){if(_0x15f430){_0x2c00ea=_0x15f430;_0x28c018[_0xf11d('0x31')]=_[_0xf11d('0x33')](db['DeskField'][_0xf11d('0x46')]);_0x28c018[_0xf11d('0x32')]=_[_0xf11d('0x33')](_0x4b0343[_0xf11d('0x32')]);_0x28c018[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0x28c018['model'],_0x28c018[_0xf11d('0x32')]);_0x3167e1[_0xf11d('0x36')]=_['intersection'](_0x28c018[_0xf11d('0x31')],qs[_0xf11d('0x37')](_0x4b0343['query'][_0xf11d('0x37')]));_0x3167e1['attributes']=_0x3167e1['attributes'][_0xf11d('0x38')]?_0x3167e1[_0xf11d('0x36')]:_0x28c018['model'];_0x3167e1[_0xf11d('0x3a')]=qs[_0xf11d('0x3b')](_0x4b0343[_0xf11d('0x32')]['sort']);_0x3167e1['where']=qs[_0xf11d('0x34')](_[_0xf11d('0x3c')](_0x4b0343[_0xf11d('0x32')],_0x28c018['filters']));if(_0x4b0343[_0xf11d('0x32')][_0xf11d('0x3d')]){_0x3167e1[_0xf11d('0x3e')]=_['merge'](_0x3167e1['where'],{'$or':_[_0xf11d('0x2d')](_0x3167e1[_0xf11d('0x36')],function(_0x2c97bf){var _0x52b76a={};_0x52b76a[_0x2c97bf]={'$like':'%'+_0x4b0343[_0xf11d('0x32')][_0xf11d('0x3d')]+'%'};return _0x52b76a;})});}_0x3167e1=_[_0xf11d('0x3f')]({},_0x3167e1,_0x4b0343['options']);return _0x2c00ea['getDescriptions'](_0x3167e1);}})['then'](function(_0x1c21c8){if(_0x1c21c8){_0x10e0df=_0x1c21c8['length'];if(!_0x4b0343[_0xf11d('0x32')][_0xf11d('0x4f')](_0xf11d('0x39'))){_0x3167e1['limit']=qs['limit'](_0x4b0343[_0xf11d('0x32')]['limit']);_0x3167e1[_0xf11d('0x22')]=qs[_0xf11d('0x22')](_0x4b0343[_0xf11d('0x32')][_0xf11d('0x22')]);}return _0x2c00ea[_0xf11d('0x51')](_0x3167e1);}})['then'](function(_0x4ad62b){if(_0x4ad62b){return _0x4ad62b?{'count':_0x10e0df,'rows':_0x4ad62b}:null;}})[_0xf11d('0x28')](respondWithResult(_0x20f0f1,null))[_0xf11d('0x45')](handleError(_0x20f0f1,null));};exports[_0xf11d('0x52')]=function(_0x5a3f7f,_0x5dac4f,_0x1dc222){var _0x331839={};var _0x31dc6c={};var _0x10572d;var _0x332656;return db[_0xf11d('0x2e')][_0xf11d('0x4c')]({'where':{'id':_0x5a3f7f[_0xf11d('0x49')]['id']}})[_0xf11d('0x28')](handleEntityNotFound(_0x5dac4f,null))['then'](function(_0x2aca38){if(_0x2aca38){_0x10572d=_0x2aca38;_0x31dc6c[_0xf11d('0x31')]=_[_0xf11d('0x33')](db[_0xf11d('0x53')][_0xf11d('0x46')]);_0x31dc6c[_0xf11d('0x32')]=_[_0xf11d('0x33')](_0x5a3f7f['query']);_0x31dc6c[_0xf11d('0x34')]=_[_0xf11d('0x35')](_0x31dc6c['model'],_0x31dc6c[_0xf11d('0x32')]);_0x331839[_0xf11d('0x36')]=_[_0xf11d('0x35')](_0x31dc6c['model'],qs[_0xf11d('0x37')](_0x5a3f7f[_0xf11d('0x32')][_0xf11d('0x37')]));_0x331839[_0xf11d('0x36')]=_0x331839[_0xf11d('0x36')][_0xf11d('0x38')]?_0x331839[_0xf11d('0x36')]:_0x31dc6c['model'];_0x331839[_0xf11d('0x3a')]=qs[_0xf11d('0x3b')](_0x5a3f7f['query']['sort']);_0x331839[_0xf11d('0x3e')]=qs[_0xf11d('0x34')](_['pick'](_0x5a3f7f['query'],_0x31dc6c[_0xf11d('0x34')]));if(_0x5a3f7f[_0xf11d('0x32')][_0xf11d('0x3d')]){_0x331839[_0xf11d('0x3e')]=_[_0xf11d('0x3f')](_0x331839['where'],{'$or':_[_0xf11d('0x2d')](_0x331839[_0xf11d('0x36')],function(_0x436be0){var _0x4540f4={};_0x4540f4[_0x436be0]={'$like':'%'+_0x5a3f7f['query']['filter']+'%'};return _0x4540f4;})});}_0x331839=_[_0xf11d('0x3f')]({},_0x331839,_0x5a3f7f[_0xf11d('0x4e')]);return _0x10572d[_0xf11d('0x52')](_0x331839);}})[_0xf11d('0x28')](function(_0x18ba40){if(_0x18ba40){_0x332656=_0x18ba40[_0xf11d('0x38')];if(!_0x5a3f7f['query'][_0xf11d('0x4f')](_0xf11d('0x39'))){_0x331839[_0xf11d('0x20')]=qs[_0xf11d('0x20')](_0x5a3f7f['query']['limit']);_0x331839[_0xf11d('0x22')]=qs['offset'](_0x5a3f7f[_0xf11d('0x32')][_0xf11d('0x22')]);}return _0x10572d[_0xf11d('0x52')](_0x331839);}})[_0xf11d('0x28')](function(_0x19af2f){if(_0x19af2f){return _0x19af2f?{'count':_0x332656,'rows':_0x19af2f}:null;}})[_0xf11d('0x28')](respondWithResult(_0x5dac4f,null))[_0xf11d('0x45')](handleError(_0x5dac4f,null));};exports[_0xf11d('0x54')]=function(_0x4eced6,_0x6ab68d,_0x5d84b4){if(_0x4eced6[_0xf11d('0x48')]['id']){delete _0x4eced6[_0xf11d('0x48')]['id'];}return db[_0xf11d('0x2e')]['findOne']({'where':{'id':_0x4eced6[_0xf11d('0x49')]['id']}})[_0xf11d('0x28')](handleEntityNotFound(_0x6ab68d,null))[_0xf11d('0x28')](function(_0x279a8a){if(_0x279a8a){return _0x279a8a[_0xf11d('0x54')](_0x4eced6['body'][_0xf11d('0x55')]||[]);}return null;})[_0xf11d('0x28')](respondWithResult(_0x6ab68d,null))[_0xf11d('0x45')](handleError(_0x6ab68d,null));}; \ No newline at end of file +var _0x41ea=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','getFields','pick','nolimit','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','findOne','ids','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0xb8d56f,_0x2faaf5){var _0x4633d3=function(_0x4490c3){while(--_0x4490c3){_0xb8d56f['push'](_0xb8d56f['shift']());}};_0x4633d3(++_0x2faaf5);}(_0x41ea,0x12f));var _0xa41e=function(_0x7f57d2,_0x1dd696){_0x7f57d2=_0x7f57d2-0x0;var _0x1759da=_0x41ea[_0x7f57d2];return _0x1759da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa41e('0x0'));var jsonpatch=require(_0xa41e('0x1'));var rp=require(_0xa41e('0x2'));var moment=require(_0xa41e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa41e('0x4'));var util=require('util');var path=require(_0xa41e('0x5'));var sox=require('sox');var csv=require(_0xa41e('0x6'));var ejs=require(_0xa41e('0x7'));var fs=require('fs');var fs_extra=require(_0xa41e('0x8'));var _=require('lodash');var squel=require(_0xa41e('0x9'));var crypto=require(_0xa41e('0xa'));var jsforce=require(_0xa41e('0xb'));var deskjs=require(_0xa41e('0xc'));var toCsv=require(_0xa41e('0x6'));var querystring=require(_0xa41e('0xd'));var Papa=require(_0xa41e('0xe'));var Redis=require('ioredis');var authService=require(_0xa41e('0xf'));var qs=require(_0xa41e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa41e('0x11'));var logger=require(_0xa41e('0x12'))(_0xa41e('0x13'));var utils=require('../../config/utils');var config=require(_0xa41e('0x14'));var licenseUtil=require(_0xa41e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25af3a,_0x1ee08b){_0x1ee08b=_0x1ee08b||0xcc;return function(_0x37495d){if(_0x37495d){return _0x25af3a[_0xa41e('0x16')](_0x1ee08b);}return _0x25af3a[_0xa41e('0x17')](_0x1ee08b)[_0xa41e('0x18')]();};}function respondWithResult(_0x54e6e9,_0x399989){_0x399989=_0x399989||0xc8;return function(_0x4f9fa8){if(_0x4f9fa8){return _0x54e6e9['status'](_0x399989)[_0xa41e('0x19')](_0x4f9fa8);}};}function respondWithFilteredResult(_0x554c08,_0x1858c2){return function(_0x271331){if(_0x271331){var _0x1fa5fc=typeof _0x1858c2[_0xa41e('0x1a')]==='undefined'&&typeof _0x1858c2[_0xa41e('0x1b')]==='undefined';var _0x15a2d2=_0x271331['count'];var _0x58412b=_0x1fa5fc?0x0:_0x1858c2[_0xa41e('0x1a')];var _0x547fb1=_0x1fa5fc?_0x271331[_0xa41e('0x1c')]:_0x1858c2[_0xa41e('0x1a')]+_0x1858c2[_0xa41e('0x1b')];var _0x2d9da3;if(_0x547fb1>=_0x15a2d2){_0x547fb1=_0x15a2d2;_0x2d9da3=0xc8;}else{_0x2d9da3=0xce;}_0x554c08[_0xa41e('0x17')](_0x2d9da3);return _0x554c08['set'](_0xa41e('0x1d'),_0x58412b+'-'+_0x547fb1+'/'+_0x15a2d2)[_0xa41e('0x19')](_0x271331);}return null;};}function patchUpdates(_0x3433f2){return function(_0x2fc33f){try{jsonpatch['apply'](_0x2fc33f,_0x3433f2,!![]);}catch(_0x2ce160){return BPromise[_0xa41e('0x1e')](_0x2ce160);}return _0x2fc33f[_0xa41e('0x1f')]();};}function saveUpdates(_0x2a45cd,_0x2e471e){return function(_0x244d66){if(_0x244d66){return _0x244d66[_0xa41e('0x20')](_0x2a45cd)[_0xa41e('0x21')](function(_0x2d1a0a){return _0x2d1a0a;});}return null;};}function removeEntity(_0x368674,_0x5c3808){return function(_0x447a9c){if(_0x447a9c){return _0x447a9c[_0xa41e('0x22')]()['then'](function(){_0x368674[_0xa41e('0x17')](0xcc)[_0xa41e('0x18')]();});}};}function handleEntityNotFound(_0x8c8d70,_0x5d09f8){return function(_0x45be9c){if(!_0x45be9c){_0x8c8d70[_0xa41e('0x16')](0x194);}return _0x45be9c;};}function handleError(_0x339b95,_0x341136){_0x341136=_0x341136||0x1f4;return function(_0x38487a){logger['error'](_0x38487a[_0xa41e('0x23')]);if(_0x38487a[_0xa41e('0x24')]){delete _0x38487a[_0xa41e('0x24')];}_0x339b95['status'](_0x341136)['send'](_0x38487a);};}exports['index']=function(_0xeeaa15,_0x3584a5){var _0x4d86ac={},_0x2eba02={},_0x4444cf={'count':0x0,'rows':[]};var _0x54e37b=_[_0xa41e('0x25')](db[_0xa41e('0x26')][_0xa41e('0x27')],function(_0x36420c){return{'name':_0x36420c[_0xa41e('0x28')],'type':_0x36420c[_0xa41e('0x29')][_0xa41e('0x2a')]};});_0x2eba02[_0xa41e('0x2b')]=_[_0xa41e('0x25')](_0x54e37b,_0xa41e('0x24'));_0x2eba02['query']=_[_0xa41e('0x2c')](_0xeeaa15['query']);_0x2eba02['filters']=_[_0xa41e('0x2d')](_0x2eba02[_0xa41e('0x2b')],_0x2eba02[_0xa41e('0x2e')]);_0x4d86ac[_0xa41e('0x2f')]=_['intersection'](_0x2eba02['model'],qs[_0xa41e('0x30')](_0xeeaa15['query']['fields']));_0x4d86ac[_0xa41e('0x2f')]=_0x4d86ac['attributes'][_0xa41e('0x31')]?_0x4d86ac['attributes']:_0x2eba02[_0xa41e('0x2b')];if(!_0xeeaa15[_0xa41e('0x2e')][_0xa41e('0x32')]('nolimit')){_0x4d86ac['limit']=qs[_0xa41e('0x1b')](_0xeeaa15[_0xa41e('0x2e')]['limit']);_0x4d86ac[_0xa41e('0x1a')]=qs['offset'](_0xeeaa15[_0xa41e('0x2e')][_0xa41e('0x1a')]);}_0x4d86ac[_0xa41e('0x33')]=qs[_0xa41e('0x34')](_0xeeaa15[_0xa41e('0x2e')]['sort']);_0x4d86ac['where']=qs[_0xa41e('0x35')](_['pick'](_0xeeaa15[_0xa41e('0x2e')],_0x2eba02[_0xa41e('0x35')]),_0x54e37b);if(_0xeeaa15['query']['filter']){_0x4d86ac[_0xa41e('0x36')]=_[_0xa41e('0x37')](_0x4d86ac[_0xa41e('0x36')],{'$or':_[_0xa41e('0x25')](_0x54e37b,function(_0x5ae887){if(_0x5ae887[_0xa41e('0x29')]!==_0xa41e('0x38')){var _0x341c24={};_0x341c24[_0x5ae887['name']]={'$like':'%'+_0xeeaa15[_0xa41e('0x2e')][_0xa41e('0x39')]+'%'};return _0x341c24;}})});}_0x4d86ac=_['merge']({},_0x4d86ac,_0xeeaa15['options']);var _0x360711={'where':_0x4d86ac['where']};return db['DeskConfiguration'][_0xa41e('0x1c')](_0x360711)[_0xa41e('0x21')](function(_0x3a4a3e){_0x4444cf['count']=_0x3a4a3e;if(_0xeeaa15[_0xa41e('0x2e')][_0xa41e('0x3a')]){_0x4d86ac[_0xa41e('0x3b')]=[{'all':!![]}];}return db[_0xa41e('0x26')][_0xa41e('0x3c')](_0x4d86ac);})[_0xa41e('0x21')](function(_0x4f7a01){_0x4444cf[_0xa41e('0x3d')]=_0x4f7a01;return _0x4444cf;})[_0xa41e('0x21')](respondWithFilteredResult(_0x3584a5,_0x4d86ac))[_0xa41e('0x3e')](handleError(_0x3584a5,null));};exports['show']=function(_0x548fbf,_0x151fab){var _0x121585={'raw':![],'where':{'id':_0x548fbf[_0xa41e('0x3f')]['id']}},_0x19ddb2={};_0x19ddb2['model']=_[_0xa41e('0x2c')](db[_0xa41e('0x26')][_0xa41e('0x27')]);_0x19ddb2[_0xa41e('0x2e')]=_[_0xa41e('0x2c')](_0x548fbf['query']);_0x19ddb2['filters']=_['intersection'](_0x19ddb2[_0xa41e('0x2b')],_0x19ddb2['query']);_0x121585[_0xa41e('0x2f')]=_[_0xa41e('0x2d')](_0x19ddb2['model'],qs[_0xa41e('0x30')](_0x548fbf[_0xa41e('0x2e')][_0xa41e('0x30')]));_0x121585[_0xa41e('0x2f')]=_0x121585[_0xa41e('0x2f')][_0xa41e('0x31')]?_0x121585['attributes']:_0x19ddb2['model'];if(_0x548fbf['query'][_0xa41e('0x3a')]){_0x121585[_0xa41e('0x3b')]=[{'all':!![]}];}_0x121585=_[_0xa41e('0x37')]({},_0x121585,_0x548fbf[_0xa41e('0x40')]);return db[_0xa41e('0x26')][_0xa41e('0x41')](_0x121585)[_0xa41e('0x21')](handleEntityNotFound(_0x151fab,null))['then'](respondWithResult(_0x151fab,null))[_0xa41e('0x3e')](handleError(_0x151fab,null));};exports[_0xa41e('0x42')]=function(_0x101fa1,_0x43fe7c){return db[_0xa41e('0x26')][_0xa41e('0x42')](_0x101fa1[_0xa41e('0x43')],{})['then'](respondWithResult(_0x43fe7c,0xc9))[_0xa41e('0x3e')](handleError(_0x43fe7c,null));};exports[_0xa41e('0x20')]=function(_0x5b51ea,_0x4006aa){if(_0x5b51ea[_0xa41e('0x43')]['id']){delete _0x5b51ea['body']['id'];}return db[_0xa41e('0x26')][_0xa41e('0x41')]({'where':{'id':_0x5b51ea[_0xa41e('0x3f')]['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x4006aa,null))[_0xa41e('0x21')](saveUpdates(_0x5b51ea[_0xa41e('0x43')],null))[_0xa41e('0x21')](respondWithResult(_0x4006aa,null))['catch'](handleError(_0x4006aa,null));};exports[_0xa41e('0x22')]=function(_0x193069,_0x4e91fc){return db['DeskConfiguration']['find']({'where':{'id':_0x193069['params']['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x4e91fc,null))[_0xa41e('0x21')](removeEntity(_0x4e91fc,null))[_0xa41e('0x3e')](handleError(_0x4e91fc,null));};exports[_0xa41e('0x44')]=function(_0x5d7d08,_0x4466c3,_0x1ea436){var _0x4af33f={};var _0x7057d={};var _0xe8dc24;var _0x491102;return db[_0xa41e('0x26')]['findOne']({'where':{'id':_0x5d7d08[_0xa41e('0x3f')]['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x4466c3,null))[_0xa41e('0x21')](function(_0x55afb2){if(_0x55afb2){_0xe8dc24=_0x55afb2;_0x7057d[_0xa41e('0x2b')]=_[_0xa41e('0x2c')](db['DeskField'][_0xa41e('0x27')]);_0x7057d[_0xa41e('0x2e')]=_[_0xa41e('0x2c')](_0x5d7d08[_0xa41e('0x2e')]);_0x7057d['filters']=_[_0xa41e('0x2d')](_0x7057d[_0xa41e('0x2b')],_0x7057d[_0xa41e('0x2e')]);_0x4af33f['attributes']=_['intersection'](_0x7057d[_0xa41e('0x2b')],qs[_0xa41e('0x30')](_0x5d7d08[_0xa41e('0x2e')][_0xa41e('0x30')]));_0x4af33f[_0xa41e('0x2f')]=_0x4af33f[_0xa41e('0x2f')]['length']?_0x4af33f[_0xa41e('0x2f')]:_0x7057d[_0xa41e('0x2b')];_0x4af33f[_0xa41e('0x33')]=qs[_0xa41e('0x34')](_0x5d7d08['query'][_0xa41e('0x34')]);_0x4af33f['where']=qs[_0xa41e('0x35')](_[_0xa41e('0x45')](_0x5d7d08[_0xa41e('0x2e')],_0x7057d[_0xa41e('0x35')]));if(_0x5d7d08[_0xa41e('0x2e')]['filter']){_0x4af33f[_0xa41e('0x36')]=_['merge'](_0x4af33f[_0xa41e('0x36')],{'$or':_['map'](_0x4af33f[_0xa41e('0x2f')],function(_0x5053e0){var _0x1e6419={};_0x1e6419[_0x5053e0]={'$like':'%'+_0x5d7d08[_0xa41e('0x2e')][_0xa41e('0x39')]+'%'};return _0x1e6419;})});}_0x4af33f=_['merge']({},_0x4af33f,_0x5d7d08['options']);return _0xe8dc24[_0xa41e('0x44')](_0x4af33f);}})['then'](function(_0x2144ec){if(_0x2144ec){_0x491102=_0x2144ec['length'];if(!_0x5d7d08[_0xa41e('0x2e')][_0xa41e('0x32')](_0xa41e('0x46'))){_0x4af33f[_0xa41e('0x1b')]=qs['limit'](_0x5d7d08['query'][_0xa41e('0x1b')]);_0x4af33f[_0xa41e('0x1a')]=qs[_0xa41e('0x1a')](_0x5d7d08[_0xa41e('0x2e')][_0xa41e('0x1a')]);}return _0xe8dc24[_0xa41e('0x44')](_0x4af33f);}})[_0xa41e('0x21')](function(_0x4eda14){if(_0x4eda14){return _0x4eda14?{'count':_0x491102,'rows':_0x4eda14}:null;}})[_0xa41e('0x21')](respondWithResult(_0x4466c3,null))[_0xa41e('0x3e')](handleError(_0x4466c3,null));};exports['getSubjects']=function(_0x7dcd01,_0x3c17aa,_0xb5bd78){var _0x2dec4b={};var _0xfb9902={};var _0x15184e;var _0x173bc;return db[_0xa41e('0x26')]['findOne']({'where':{'id':_0x7dcd01['params']['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x3c17aa,null))['then'](function(_0x2cbf9c){if(_0x2cbf9c){_0x15184e=_0x2cbf9c;_0xfb9902['model']=_[_0xa41e('0x2c')](db[_0xa41e('0x47')]['rawAttributes']);_0xfb9902[_0xa41e('0x2e')]=_[_0xa41e('0x2c')](_0x7dcd01[_0xa41e('0x2e')]);_0xfb9902[_0xa41e('0x35')]=_[_0xa41e('0x2d')](_0xfb9902['model'],_0xfb9902[_0xa41e('0x2e')]);_0x2dec4b[_0xa41e('0x2f')]=_[_0xa41e('0x2d')](_0xfb9902[_0xa41e('0x2b')],qs[_0xa41e('0x30')](_0x7dcd01[_0xa41e('0x2e')][_0xa41e('0x30')]));_0x2dec4b[_0xa41e('0x2f')]=_0x2dec4b[_0xa41e('0x2f')][_0xa41e('0x31')]?_0x2dec4b[_0xa41e('0x2f')]:_0xfb9902['model'];_0x2dec4b['order']=qs[_0xa41e('0x34')](_0x7dcd01[_0xa41e('0x2e')][_0xa41e('0x34')]);_0x2dec4b[_0xa41e('0x36')]=qs[_0xa41e('0x35')](_[_0xa41e('0x45')](_0x7dcd01[_0xa41e('0x2e')],_0xfb9902['filters']));if(_0x7dcd01['query'][_0xa41e('0x39')]){_0x2dec4b[_0xa41e('0x36')]=_['merge'](_0x2dec4b[_0xa41e('0x36')],{'$or':_[_0xa41e('0x25')](_0x2dec4b[_0xa41e('0x2f')],function(_0x5a1dee){var _0x5eb082={};_0x5eb082[_0x5a1dee]={'$like':'%'+_0x7dcd01['query'][_0xa41e('0x39')]+'%'};return _0x5eb082;})});}_0x2dec4b=_[_0xa41e('0x37')]({},_0x2dec4b,_0x7dcd01['options']);return _0x15184e[_0xa41e('0x48')](_0x2dec4b);}})[_0xa41e('0x21')](function(_0x4275c8){if(_0x4275c8){_0x173bc=_0x4275c8['length'];if(!_0x7dcd01[_0xa41e('0x2e')][_0xa41e('0x32')]('nolimit')){_0x2dec4b[_0xa41e('0x1b')]=qs[_0xa41e('0x1b')](_0x7dcd01['query'][_0xa41e('0x1b')]);_0x2dec4b[_0xa41e('0x1a')]=qs['offset'](_0x7dcd01['query'][_0xa41e('0x1a')]);}return _0x15184e[_0xa41e('0x48')](_0x2dec4b);}})[_0xa41e('0x21')](function(_0x704c0c){if(_0x704c0c){return _0x704c0c?{'count':_0x173bc,'rows':_0x704c0c}:null;}})['then'](respondWithResult(_0x3c17aa,null))[_0xa41e('0x3e')](handleError(_0x3c17aa,null));};exports['getDescriptions']=function(_0x4f5689,_0x2de247,_0x27c5b2){var _0x2e69fe={};var _0xaa2cc5={};var _0x28d149;var _0x5f1185;return db[_0xa41e('0x26')]['findOne']({'where':{'id':_0x4f5689['params']['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x2de247,null))[_0xa41e('0x21')](function(_0x10c3a7){if(_0x10c3a7){_0x28d149=_0x10c3a7;_0xaa2cc5['model']=_[_0xa41e('0x2c')](db[_0xa41e('0x47')][_0xa41e('0x27')]);_0xaa2cc5[_0xa41e('0x2e')]=_[_0xa41e('0x2c')](_0x4f5689['query']);_0xaa2cc5[_0xa41e('0x35')]=_[_0xa41e('0x2d')](_0xaa2cc5[_0xa41e('0x2b')],_0xaa2cc5[_0xa41e('0x2e')]);_0x2e69fe['attributes']=_['intersection'](_0xaa2cc5[_0xa41e('0x2b')],qs[_0xa41e('0x30')](_0x4f5689[_0xa41e('0x2e')]['fields']));_0x2e69fe['attributes']=_0x2e69fe[_0xa41e('0x2f')][_0xa41e('0x31')]?_0x2e69fe['attributes']:_0xaa2cc5[_0xa41e('0x2b')];_0x2e69fe[_0xa41e('0x33')]=qs['sort'](_0x4f5689[_0xa41e('0x2e')][_0xa41e('0x34')]);_0x2e69fe[_0xa41e('0x36')]=qs['filters'](_[_0xa41e('0x45')](_0x4f5689[_0xa41e('0x2e')],_0xaa2cc5['filters']));if(_0x4f5689[_0xa41e('0x2e')][_0xa41e('0x39')]){_0x2e69fe[_0xa41e('0x36')]=_[_0xa41e('0x37')](_0x2e69fe[_0xa41e('0x36')],{'$or':_[_0xa41e('0x25')](_0x2e69fe['attributes'],function(_0x4dd6af){var _0x56296f={};_0x56296f[_0x4dd6af]={'$like':'%'+_0x4f5689[_0xa41e('0x2e')][_0xa41e('0x39')]+'%'};return _0x56296f;})});}_0x2e69fe=_[_0xa41e('0x37')]({},_0x2e69fe,_0x4f5689[_0xa41e('0x40')]);return _0x28d149[_0xa41e('0x49')](_0x2e69fe);}})[_0xa41e('0x21')](function(_0x5035a2){if(_0x5035a2){_0x5f1185=_0x5035a2[_0xa41e('0x31')];if(!_0x4f5689[_0xa41e('0x2e')][_0xa41e('0x32')](_0xa41e('0x46'))){_0x2e69fe[_0xa41e('0x1b')]=qs[_0xa41e('0x1b')](_0x4f5689['query']['limit']);_0x2e69fe[_0xa41e('0x1a')]=qs['offset'](_0x4f5689[_0xa41e('0x2e')][_0xa41e('0x1a')]);}return _0x28d149[_0xa41e('0x49')](_0x2e69fe);}})[_0xa41e('0x21')](function(_0x3ff2ea){if(_0x3ff2ea){return _0x3ff2ea?{'count':_0x5f1185,'rows':_0x3ff2ea}:null;}})[_0xa41e('0x21')](respondWithResult(_0x2de247,null))[_0xa41e('0x3e')](handleError(_0x2de247,null));};exports[_0xa41e('0x4a')]=function(_0x38e124,_0x54c53d,_0x216913){var _0x207b6d={};var _0x197715={};var _0x4553cb;var _0x41b3d4;return db[_0xa41e('0x26')]['findOne']({'where':{'id':_0x38e124[_0xa41e('0x3f')]['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x54c53d,null))[_0xa41e('0x21')](function(_0x1e3d3b){if(_0x1e3d3b){_0x4553cb=_0x1e3d3b;_0x197715[_0xa41e('0x2b')]=_[_0xa41e('0x2c')](db[_0xa41e('0x4b')][_0xa41e('0x27')]);_0x197715[_0xa41e('0x2e')]=_[_0xa41e('0x2c')](_0x38e124['query']);_0x197715[_0xa41e('0x35')]=_[_0xa41e('0x2d')](_0x197715[_0xa41e('0x2b')],_0x197715[_0xa41e('0x2e')]);_0x207b6d[_0xa41e('0x2f')]=_[_0xa41e('0x2d')](_0x197715[_0xa41e('0x2b')],qs[_0xa41e('0x30')](_0x38e124[_0xa41e('0x2e')][_0xa41e('0x30')]));_0x207b6d[_0xa41e('0x2f')]=_0x207b6d[_0xa41e('0x2f')]['length']?_0x207b6d[_0xa41e('0x2f')]:_0x197715[_0xa41e('0x2b')];_0x207b6d[_0xa41e('0x33')]=qs['sort'](_0x38e124[_0xa41e('0x2e')][_0xa41e('0x34')]);_0x207b6d[_0xa41e('0x36')]=qs[_0xa41e('0x35')](_[_0xa41e('0x45')](_0x38e124['query'],_0x197715['filters']));if(_0x38e124[_0xa41e('0x2e')][_0xa41e('0x39')]){_0x207b6d[_0xa41e('0x36')]=_[_0xa41e('0x37')](_0x207b6d[_0xa41e('0x36')],{'$or':_[_0xa41e('0x25')](_0x207b6d['attributes'],function(_0x17d8bd){var _0x2dc3ff={};_0x2dc3ff[_0x17d8bd]={'$like':'%'+_0x38e124[_0xa41e('0x2e')][_0xa41e('0x39')]+'%'};return _0x2dc3ff;})});}_0x207b6d=_[_0xa41e('0x37')]({},_0x207b6d,_0x38e124[_0xa41e('0x40')]);return _0x4553cb[_0xa41e('0x4a')](_0x207b6d);}})[_0xa41e('0x21')](function(_0x2d3be7){if(_0x2d3be7){_0x41b3d4=_0x2d3be7[_0xa41e('0x31')];if(!_0x38e124['query'][_0xa41e('0x32')](_0xa41e('0x46'))){_0x207b6d['limit']=qs[_0xa41e('0x1b')](_0x38e124[_0xa41e('0x2e')][_0xa41e('0x1b')]);_0x207b6d['offset']=qs[_0xa41e('0x1a')](_0x38e124[_0xa41e('0x2e')]['offset']);}return _0x4553cb[_0xa41e('0x4a')](_0x207b6d);}})['then'](function(_0x531aa8){if(_0x531aa8){return _0x531aa8?{'count':_0x41b3d4,'rows':_0x531aa8}:null;}})['then'](respondWithResult(_0x54c53d,null))[_0xa41e('0x3e')](handleError(_0x54c53d,null));};exports[_0xa41e('0x4c')]=function(_0x40e343,_0x10b969,_0x194c90){if(_0x40e343[_0xa41e('0x43')]['id']){delete _0x40e343[_0xa41e('0x43')]['id'];}return db['DeskConfiguration'][_0xa41e('0x4d')]({'where':{'id':_0x40e343['params']['id']}})[_0xa41e('0x21')](handleEntityNotFound(_0x10b969,null))[_0xa41e('0x21')](function(_0x1e406b){if(_0x1e406b){return _0x1e406b[_0xa41e('0x4c')](_0x40e343[_0xa41e('0x43')][_0xa41e('0x4e')]||[]);}return null;})[_0xa41e('0x21')](respondWithResult(_0x10b969,null))[_0xa41e('0x3e')](handleError(_0x10b969,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6314bcf..a964096 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 _0x5475=['exports','DeskConfiguration','../../config/logger','moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x530191,_0x52edef){var _0x212d5d=function(_0x3388f0){while(--_0x3388f0){_0x530191['push'](_0x530191['shift']());}};_0x212d5d(++_0x52edef);}(_0x5475,0xea));var _0x5547=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x5475[_0x474bc0];return _0x4b24cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5547('0x0'))('api');var moment=require(_0x5547('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5547('0x2'));var rimraf=require(_0x5547('0x3'));var config=require(_0x5547('0x4'));var attributes=require(_0x5547('0x5'));module[_0x5547('0x6')]=function(_0x481b70,_0x41b26e){return _0x481b70['define'](_0x5547('0x7'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8729=['int_desk_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8729,0x181));var _0x9872=function(_0x26a505,_0xa6e20d){_0x26a505=_0x26a505-0x0;var _0x5a6746=_0x8729[_0x26a505];return _0x5a6746;};'use strict';var _=require(_0x9872('0x0'));var util=require(_0x9872('0x1'));var logger=require('../../config/logger')(_0x9872('0x2'));var moment=require('moment');var BPromise=require(_0x9872('0x3'));var rp=require(_0x9872('0x4'));var fs=require('fs');var path=require(_0x9872('0x5'));var rimraf=require(_0x9872('0x6'));var config=require(_0x9872('0x7'));var attributes=require(_0x9872('0x8'));module['exports']=function(_0x7ef701,_0x33402e){return _0x7ef701[_0x9872('0x9')](_0x9872('0xa'),attributes,{'tableName':_0x9872('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 32a6471..8e4268b 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 _0x1d91=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','randomstring'];(function(_0xbeaac5,_0xc83d02){var _0x41af7f=function(_0x5f1811){while(--_0x5f1811){_0xbeaac5['push'](_0xbeaac5['shift']());}};_0x41af7f(++_0xc83d02);}(_0x1d91,0x150));var _0x11d9=function(_0x15859e,_0x33388d){_0x15859e=_0x15859e-0x0;var _0x43a4ab=_0x1d91[_0x15859e];return _0x43a4ab;};'use strict';var _=require(_0x11d9('0x0'));var util=require(_0x11d9('0x1'));var moment=require(_0x11d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x11d9('0x3'));var fs=require('fs');var Redis=require(_0x11d9('0x4'));var db=require(_0x11d9('0x5'))['db'];var utils=require(_0x11d9('0x6'));var logger=require('../../config/logger')(_0x11d9('0x7'));var config=require(_0x11d9('0x8'));var jayson=require(_0x11d9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3e2f,_0x1f22f8,_0x42667e){return new BPromise(function(_0x274b17,_0x32a4f7){return client[_0x11d9('0xa')](_0x5b3e2f,_0x42667e)['then'](function(_0x311490){logger['info'](_0x11d9('0xb'),_0x1f22f8,'request\x20sent');logger[_0x11d9('0xc')](_0x11d9('0xd'),_0x1f22f8,_0x11d9('0xe'),JSON[_0x11d9('0xf')](_0x311490));if(_0x311490[_0x11d9('0x10')]){if(_0x311490['error'][_0x11d9('0x11')]===0x1f4){logger['error'](_0x11d9('0xb'),_0x1f22f8,_0x311490[_0x11d9('0x10')]['message']);return _0x32a4f7(_0x311490[_0x11d9('0x10')][_0x11d9('0x12')]);}logger[_0x11d9('0x10')](_0x11d9('0xb'),_0x1f22f8,_0x311490['error']['message']);return _0x274b17(_0x311490[_0x11d9('0x10')][_0x11d9('0x12')]);}else{logger[_0x11d9('0x13')](_0x11d9('0xb'),_0x1f22f8,'request\x20sent');_0x274b17(_0x311490['result']['message']);}})['catch'](function(_0x115727){logger[_0x11d9('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x1f22f8,_0x115727);_0x32a4f7(_0x115727);});});} \ No newline at end of file +var _0x4f00=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x334a72,_0xd41ead){var _0x29e86a=function(_0x44abfc){while(--_0x44abfc){_0x334a72['push'](_0x334a72['shift']());}};_0x29e86a(++_0xd41ead);}(_0x4f00,0x1ea));var _0x04f0=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4f00[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x04f0('0x0'));var util=require(_0x04f0('0x1'));var moment=require(_0x04f0('0x2'));var BPromise=require(_0x04f0('0x3'));var rs=require(_0x04f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04f0('0x5'))['db'];var utils=require(_0x04f0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x04f0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x04f0('0x8')][_0x04f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547556,_0x2181cd,_0x2f744a){return new BPromise(function(_0x496cb3,_0x1f910f){return client['request'](_0x547556,_0x2f744a)[_0x04f0('0xa')](function(_0x1db999){logger[_0x04f0('0xb')](_0x04f0('0xc'),_0x2181cd,_0x04f0('0xd'));logger[_0x04f0('0xe')](_0x04f0('0xf'),_0x2181cd,'request\x20sent',JSON[_0x04f0('0x10')](_0x1db999));if(_0x1db999[_0x04f0('0x11')]){if(_0x1db999[_0x04f0('0x11')][_0x04f0('0x12')]===0x1f4){logger[_0x04f0('0x11')](_0x04f0('0xc'),_0x2181cd,_0x1db999[_0x04f0('0x11')][_0x04f0('0x13')]);return _0x1f910f(_0x1db999['error'][_0x04f0('0x13')]);}logger[_0x04f0('0x11')](_0x04f0('0xc'),_0x2181cd,_0x1db999[_0x04f0('0x11')]['message']);return _0x496cb3(_0x1db999[_0x04f0('0x11')][_0x04f0('0x13')]);}else{logger[_0x04f0('0xb')](_0x04f0('0xc'),_0x2181cd,_0x04f0('0xd'));_0x496cb3(_0x1db999[_0x04f0('0x14')][_0x04f0('0x13')]);}})[_0x04f0('0x15')](function(_0x4a761c){logger['error'](_0x04f0('0xc'),_0x2181cd,_0x4a761c);_0x1f910f(_0x4a761c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 8c3c6f1..c5cfc92 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 _0xdb92=['put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4320cb,_0x174c78){var _0x4b3260=function(_0x103fe8){while(--_0x103fe8){_0x4320cb['push'](_0x4320cb['shift']());}};_0x4b3260(++_0x174c78);}(_0xdb92,0x181));var _0x2db9=function(_0x1b661c,_0x47319a){_0x1b661c=_0x1b661c-0x0;var _0x4b8a89=_0xdb92[_0x1b661c];return _0x4b8a89;};'use strict';var multer=require('multer');var util=require(_0x2db9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2db9('0x1'));var router=express[_0x2db9('0x2')]();var fs_extra=require(_0x2db9('0x3'));var auth=require(_0x2db9('0x4'));var interaction=require(_0x2db9('0x5'));var config=require(_0x2db9('0x6'));var controller=require(_0x2db9('0x7'));router[_0x2db9('0x8')]('/',auth[_0x2db9('0x9')](),controller[_0x2db9('0xa')]);router['get'](_0x2db9('0xb'),auth['isAuthenticated'](),controller[_0x2db9('0xc')]);router[_0x2db9('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2db9('0xe')](_0x2db9('0xb'),auth[_0x2db9('0x9')](),controller[_0x2db9('0xf')]);router[_0x2db9('0x10')]('/:id',auth[_0x2db9('0x9')](),controller[_0x2db9('0x11')]);module[_0x2db9('0x12')]=router; \ No newline at end of file +var _0x21fd=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x4174da,_0x4d378f){var _0x300efe=function(_0x36aa57){while(--_0x36aa57){_0x4174da['push'](_0x4174da['shift']());}};_0x300efe(++_0x4d378f);}(_0x21fd,0x1e2));var _0xd21f=function(_0x5415a0,_0x12929c){_0x5415a0=_0x5415a0-0x0;var _0x21d3ca=_0x21fd[_0x5415a0];return _0x21d3ca;};'use strict';var multer=require(_0xd21f('0x0'));var util=require(_0xd21f('0x1'));var path=require(_0xd21f('0x2'));var timeout=require(_0xd21f('0x3'));var express=require(_0xd21f('0x4'));var router=express[_0xd21f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd21f('0x6'));var interaction=require(_0xd21f('0x7'));var config=require('../../config/environment');var controller=require(_0xd21f('0x8'));router[_0xd21f('0x9')]('/',auth[_0xd21f('0xa')](),controller['index']);router[_0xd21f('0x9')](_0xd21f('0xb'),auth[_0xd21f('0xa')](),controller[_0xd21f('0xc')]);router[_0xd21f('0xd')]('/',auth[_0xd21f('0xa')](),controller[_0xd21f('0xe')]);router[_0xd21f('0xf')](_0xd21f('0xb'),auth[_0xd21f('0xa')](),controller[_0xd21f('0x10')]);router[_0xd21f('0x11')](_0xd21f('0xb'),auth[_0xd21f('0xa')](),controller[_0xd21f('0x12')]);module[_0xd21f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index e241664..bd6bc31 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 _0x4f9e=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x4e2e33,_0x367156){var _0x15c179=function(_0x6a6e3d){while(--_0x6a6e3d){_0x4e2e33['push'](_0x4e2e33['shift']());}};_0x15c179(++_0x367156);}(_0x4f9e,0x8a));var _0xe4f9=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x4f9e[_0x2aee2f];return _0x19337f;};'use strict';var Sequelize=require(_0xe4f9('0x0'));module[_0xe4f9('0x1')]={'type':{'type':Sequelize[_0xe4f9('0x2')](_0xe4f9('0x3'),_0xe4f9('0x4'),'customVariable',_0xe4f9('0x5'),'picklist'),'defaultValue':_0xe4f9('0x3')},'content':{'type':Sequelize[_0xe4f9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe4f9('0x2')](_0xe4f9('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xe4f9('0x6')]},'idField':{'type':Sequelize[_0xe4f9('0x6')]},'nameField':{'type':Sequelize[_0xe4f9('0x6')]},'customField':{'type':Sequelize[_0xe4f9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4f9('0x6')]}}; \ No newline at end of file +var _0xc236=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4c6058,_0x4b5868){var _0x8d1b4c=function(_0x3f126f){while(--_0x3f126f){_0x4c6058['push'](_0x4c6058['shift']());}};_0x8d1b4c(++_0x4b5868);}(_0xc236,0x1a7));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6c23('0x0'));module[_0x6c23('0x1')]={'type':{'type':Sequelize[_0x6c23('0x2')](_0x6c23('0x3'),_0x6c23('0x4'),_0x6c23('0x5'),_0x6c23('0x6'),_0x6c23('0x7')),'defaultValue':_0x6c23('0x3')},'content':{'type':Sequelize[_0x6c23('0x8')]},'key':{'type':Sequelize[_0x6c23('0x8')]},'keyType':{'type':Sequelize[_0x6c23('0x2')](_0x6c23('0x3'),_0x6c23('0x4'),_0x6c23('0x5'))},'keyContent':{'type':Sequelize[_0x6c23('0x8')]},'idField':{'type':Sequelize[_0x6c23('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6c23('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c23('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index aabe3e5..334199a 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 _0xf9b7=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','DeskField','findAll','rows','catch','show','params','rawAttributes','create','body'];(function(_0x56a2bc,_0x165f22){var _0x9f8a=function(_0x2a8d83){while(--_0x2a8d83){_0x56a2bc['push'](_0x56a2bc['shift']());}};_0x9f8a(++_0x165f22);}(_0xf9b7,0x91));var _0x7f9b=function(_0x421c42,_0x2b52f3){_0x421c42=_0x421c42-0x0;var _0x11fae8=_0xf9b7[_0x421c42];return _0x11fae8;};'use strict';var emlformat=require(_0x7f9b('0x0'));var rimraf=require(_0x7f9b('0x1'));var zipdir=require(_0x7f9b('0x2'));var jsonpatch=require(_0x7f9b('0x3'));var rp=require(_0x7f9b('0x4'));var moment=require(_0x7f9b('0x5'));var BPromise=require(_0x7f9b('0x6'));var Mustache=require(_0x7f9b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f9b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f9b('0xb'));var jsforce=require(_0x7f9b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f9b('0xd'));var Redis=require(_0x7f9b('0xe'));var authService=require(_0x7f9b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7f9b('0x10'));var hardwareService=require(_0x7f9b('0x11'));var logger=require('../../config/logger')(_0x7f9b('0x12'));var utils=require('../../config/utils');var config=require(_0x7f9b('0x13'));var licenseUtil=require(_0x7f9b('0x14'));var db=require(_0x7f9b('0x15'))['db'];function respondWithStatusCode(_0x911217,_0x2c60e6){_0x2c60e6=_0x2c60e6||0xcc;return function(_0x48ea83){if(_0x48ea83){return _0x911217[_0x7f9b('0x16')](_0x2c60e6);}return _0x911217['status'](_0x2c60e6)[_0x7f9b('0x17')]();};}function respondWithResult(_0x27f63e,_0x38a0b1){_0x38a0b1=_0x38a0b1||0xc8;return function(_0x1f756c){if(_0x1f756c){return _0x27f63e[_0x7f9b('0x18')](_0x38a0b1)[_0x7f9b('0x19')](_0x1f756c);}};}function respondWithFilteredResult(_0x261c4c,_0x2ba158){return function(_0x447255){if(_0x447255){var _0x39ecbd=typeof _0x2ba158[_0x7f9b('0x1a')]===_0x7f9b('0x1b')&&typeof _0x2ba158[_0x7f9b('0x1c')]===_0x7f9b('0x1b');var _0x51debb=_0x447255[_0x7f9b('0x1d')];var _0x575643=_0x39ecbd?0x0:_0x2ba158[_0x7f9b('0x1a')];var _0x4d934b=_0x39ecbd?_0x447255[_0x7f9b('0x1d')]:_0x2ba158['offset']+_0x2ba158['limit'];var _0x5cec50;if(_0x4d934b>=_0x51debb){_0x4d934b=_0x51debb;_0x5cec50=0xc8;}else{_0x5cec50=0xce;}_0x261c4c[_0x7f9b('0x18')](_0x5cec50);return _0x261c4c['set'](_0x7f9b('0x1e'),_0x575643+'-'+_0x4d934b+'/'+_0x51debb)['json'](_0x447255);}return null;};}function patchUpdates(_0x4a1399){return function(_0x262857){try{jsonpatch[_0x7f9b('0x1f')](_0x262857,_0x4a1399,!![]);}catch(_0x318203){return BPromise['reject'](_0x318203);}return _0x262857[_0x7f9b('0x20')]();};}function saveUpdates(_0x12285b,_0x47142f){return function(_0x4e3f37){if(_0x4e3f37){return _0x4e3f37[_0x7f9b('0x21')](_0x12285b)[_0x7f9b('0x22')](function(_0x25b6ac){return _0x25b6ac;});}return null;};}function removeEntity(_0x28d6de,_0x38e7d6){return function(_0x527f30){if(_0x527f30){return _0x527f30['destroy']()[_0x7f9b('0x22')](function(){_0x28d6de[_0x7f9b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62295d,_0x17b31d){return function(_0x22c380){if(!_0x22c380){_0x62295d[_0x7f9b('0x16')](0x194);}return _0x22c380;};}function handleError(_0x3b9da4,_0x214347){_0x214347=_0x214347||0x1f4;return function(_0x1155f6){logger['error'](_0x1155f6[_0x7f9b('0x23')]);if(_0x1155f6[_0x7f9b('0x24')]){delete _0x1155f6[_0x7f9b('0x24')];}_0x3b9da4[_0x7f9b('0x18')](_0x214347)[_0x7f9b('0x25')](_0x1155f6);};}exports[_0x7f9b('0x26')]=function(_0x5f3a5c,_0x4ab6ad){var _0x49a678={},_0xe72154={},_0x122caf={'count':0x0,'rows':[]};var _0x4e5c5d=_[_0x7f9b('0x27')](db['DeskField']['rawAttributes'],function(_0x5aba6e){return{'name':_0x5aba6e[_0x7f9b('0x28')],'type':_0x5aba6e[_0x7f9b('0x29')][_0x7f9b('0x2a')]};});_0xe72154[_0x7f9b('0x2b')]=_[_0x7f9b('0x27')](_0x4e5c5d,_0x7f9b('0x24'));_0xe72154['query']=_[_0x7f9b('0x2c')](_0x5f3a5c['query']);_0xe72154[_0x7f9b('0x2d')]=_[_0x7f9b('0x2e')](_0xe72154[_0x7f9b('0x2b')],_0xe72154[_0x7f9b('0x2f')]);_0x49a678[_0x7f9b('0x30')]=_['intersection'](_0xe72154['model'],qs['fields'](_0x5f3a5c['query'][_0x7f9b('0x31')]));_0x49a678[_0x7f9b('0x30')]=_0x49a678['attributes'][_0x7f9b('0x32')]?_0x49a678[_0x7f9b('0x30')]:_0xe72154[_0x7f9b('0x2b')];if(!_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x33')](_0x7f9b('0x34'))){_0x49a678[_0x7f9b('0x1c')]=qs['limit'](_0x5f3a5c['query']['limit']);_0x49a678[_0x7f9b('0x1a')]=qs[_0x7f9b('0x1a')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x1a')]);}_0x49a678[_0x7f9b('0x35')]=qs[_0x7f9b('0x36')](_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x36')]);_0x49a678['where']=qs[_0x7f9b('0x2d')](_[_0x7f9b('0x37')](_0x5f3a5c[_0x7f9b('0x2f')],_0xe72154[_0x7f9b('0x2d')]),_0x4e5c5d);if(_0x5f3a5c['query'][_0x7f9b('0x38')]){_0x49a678[_0x7f9b('0x39')]=_[_0x7f9b('0x3a')](_0x49a678[_0x7f9b('0x39')],{'$or':_[_0x7f9b('0x27')](_0x4e5c5d,function(_0x325370){if(_0x325370[_0x7f9b('0x29')]!==_0x7f9b('0x3b')){var _0x55d618={};_0x55d618[_0x325370[_0x7f9b('0x24')]]={'$like':'%'+_0x5f3a5c[_0x7f9b('0x2f')][_0x7f9b('0x38')]+'%'};return _0x55d618;}})});}_0x49a678=_[_0x7f9b('0x3a')]({},_0x49a678,_0x5f3a5c['options']);var _0xd937c0={'where':_0x49a678[_0x7f9b('0x39')]};return db['DeskField'][_0x7f9b('0x1d')](_0xd937c0)[_0x7f9b('0x22')](function(_0x413230){_0x122caf['count']=_0x413230;if(_0x5f3a5c['query'][_0x7f9b('0x3c')]){_0x49a678[_0x7f9b('0x3d')]=[{'all':!![]}];}return db[_0x7f9b('0x3e')][_0x7f9b('0x3f')](_0x49a678);})[_0x7f9b('0x22')](function(_0x1e3df5){_0x122caf[_0x7f9b('0x40')]=_0x1e3df5;return _0x122caf;})[_0x7f9b('0x22')](respondWithFilteredResult(_0x4ab6ad,_0x49a678))[_0x7f9b('0x41')](handleError(_0x4ab6ad,null));};exports[_0x7f9b('0x42')]=function(_0x22e485,_0x8ca3a8){var _0x5e2171={'raw':!![],'where':{'id':_0x22e485[_0x7f9b('0x43')]['id']}},_0x190ebc={};_0x190ebc[_0x7f9b('0x2b')]=_[_0x7f9b('0x2c')](db['DeskField'][_0x7f9b('0x44')]);_0x190ebc[_0x7f9b('0x2f')]=_['keys'](_0x22e485[_0x7f9b('0x2f')]);_0x190ebc['filters']=_[_0x7f9b('0x2e')](_0x190ebc[_0x7f9b('0x2b')],_0x190ebc['query']);_0x5e2171[_0x7f9b('0x30')]=_['intersection'](_0x190ebc[_0x7f9b('0x2b')],qs['fields'](_0x22e485['query'][_0x7f9b('0x31')]));_0x5e2171[_0x7f9b('0x30')]=_0x5e2171[_0x7f9b('0x30')][_0x7f9b('0x32')]?_0x5e2171[_0x7f9b('0x30')]:_0x190ebc[_0x7f9b('0x2b')];if(_0x22e485[_0x7f9b('0x2f')][_0x7f9b('0x3c')]){_0x5e2171[_0x7f9b('0x3d')]=[{'all':!![]}];}_0x5e2171=_[_0x7f9b('0x3a')]({},_0x5e2171,_0x22e485['options']);return db[_0x7f9b('0x3e')]['find'](_0x5e2171)[_0x7f9b('0x22')](handleEntityNotFound(_0x8ca3a8,null))[_0x7f9b('0x22')](respondWithResult(_0x8ca3a8,null))['catch'](handleError(_0x8ca3a8,null));};exports[_0x7f9b('0x45')]=function(_0xfe294d,_0x2c9173){return db[_0x7f9b('0x3e')]['create'](_0xfe294d['body'],{})[_0x7f9b('0x22')](respondWithResult(_0x2c9173,0xc9))[_0x7f9b('0x41')](handleError(_0x2c9173,null));};exports['update']=function(_0xd30798,_0x1a211b){if(_0xd30798[_0x7f9b('0x46')]['id']){delete _0xd30798[_0x7f9b('0x46')]['id'];}return db[_0x7f9b('0x3e')][_0x7f9b('0x47')]({'where':{'id':_0xd30798[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x1a211b,null))[_0x7f9b('0x22')](saveUpdates(_0xd30798[_0x7f9b('0x46')],null))[_0x7f9b('0x22')](respondWithResult(_0x1a211b,null))[_0x7f9b('0x41')](handleError(_0x1a211b,null));};exports['destroy']=function(_0x30004f,_0x3e80d1){return db['DeskField']['find']({'where':{'id':_0x30004f[_0x7f9b('0x43')]['id']}})[_0x7f9b('0x22')](handleEntityNotFound(_0x3e80d1,null))[_0x7f9b('0x22')](removeEntity(_0x3e80d1,null))[_0x7f9b('0x41')](handleError(_0x3e80d1,null));}; \ No newline at end of file +var _0x4210=['squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','DeskField','findAll','rows','show','params','includeAll','include','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x4210,0xca));var _0x0421=function(_0x5754dc,_0x49f253){_0x5754dc=_0x5754dc-0x0;var _0x3b88b2=_0x4210[_0x5754dc];return _0x3b88b2;};'use strict';var emlformat=require(_0x0421('0x0'));var rimraf=require(_0x0421('0x1'));var zipdir=require(_0x0421('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0421('0x3'));var moment=require(_0x0421('0x4'));var BPromise=require(_0x0421('0x5'));var Mustache=require('mustache');var util=require(_0x0421('0x6'));var path=require(_0x0421('0x7'));var sox=require(_0x0421('0x8'));var csv=require('to-csv');var ejs=require(_0x0421('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0421('0xa'));var squel=require(_0x0421('0xb'));var crypto=require('crypto');var jsforce=require(_0x0421('0xc'));var deskjs=require(_0x0421('0xd'));var toCsv=require(_0x0421('0xe'));var querystring=require('querystring');var Papa=require(_0x0421('0xf'));var Redis=require('ioredis');var authService=require(_0x0421('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0421('0x11'));var logger=require('../../config/logger')(_0x0421('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0421('0x13'));var db=require(_0x0421('0x14'))['db'];function respondWithStatusCode(_0x142a3a,_0x3d0e26){_0x3d0e26=_0x3d0e26||0xcc;return function(_0xdf67eb){if(_0xdf67eb){return _0x142a3a[_0x0421('0x15')](_0x3d0e26);}return _0x142a3a[_0x0421('0x16')](_0x3d0e26)[_0x0421('0x17')]();};}function respondWithResult(_0x517a41,_0x27ee10){_0x27ee10=_0x27ee10||0xc8;return function(_0x26e14d){if(_0x26e14d){return _0x517a41['status'](_0x27ee10)[_0x0421('0x18')](_0x26e14d);}};}function respondWithFilteredResult(_0x17b1e1,_0x4e8ba8){return function(_0x200b40){if(_0x200b40){var _0x10a60f=typeof _0x4e8ba8[_0x0421('0x19')]===_0x0421('0x1a')&&typeof _0x4e8ba8[_0x0421('0x1b')]===_0x0421('0x1a');var _0x37641a=_0x200b40[_0x0421('0x1c')];var _0x53ddca=_0x10a60f?0x0:_0x4e8ba8[_0x0421('0x19')];var _0x34fe77=_0x10a60f?_0x200b40[_0x0421('0x1c')]:_0x4e8ba8['offset']+_0x4e8ba8[_0x0421('0x1b')];var _0x2d7f3f;if(_0x34fe77>=_0x37641a){_0x34fe77=_0x37641a;_0x2d7f3f=0xc8;}else{_0x2d7f3f=0xce;}_0x17b1e1['status'](_0x2d7f3f);return _0x17b1e1[_0x0421('0x1d')](_0x0421('0x1e'),_0x53ddca+'-'+_0x34fe77+'/'+_0x37641a)['json'](_0x200b40);}return null;};}function patchUpdates(_0x5c43af){return function(_0x3a6bff){try{jsonpatch[_0x0421('0x1f')](_0x3a6bff,_0x5c43af,!![]);}catch(_0x3924a8){return BPromise['reject'](_0x3924a8);}return _0x3a6bff[_0x0421('0x20')]();};}function saveUpdates(_0x18bbda,_0x5a273d){return function(_0x4ca3a6){if(_0x4ca3a6){return _0x4ca3a6[_0x0421('0x21')](_0x18bbda)['then'](function(_0x2b4d2b){return _0x2b4d2b;});}return null;};}function removeEntity(_0x39430e,_0x2751c5){return function(_0x435481){if(_0x435481){return _0x435481[_0x0421('0x22')]()[_0x0421('0x23')](function(){_0x39430e[_0x0421('0x16')](0xcc)[_0x0421('0x17')]();});}};}function handleEntityNotFound(_0x5257bb,_0x2da38e){return function(_0x1d3989){if(!_0x1d3989){_0x5257bb[_0x0421('0x15')](0x194);}return _0x1d3989;};}function handleError(_0x168bde,_0x42dfb7){_0x42dfb7=_0x42dfb7||0x1f4;return function(_0x531c5d){logger['error'](_0x531c5d[_0x0421('0x24')]);if(_0x531c5d['name']){delete _0x531c5d[_0x0421('0x25')];}_0x168bde['status'](_0x42dfb7)[_0x0421('0x26')](_0x531c5d);};}exports[_0x0421('0x27')]=function(_0x3b28c1,_0x296ca8){var _0x2ded50={},_0x4c6bb7={},_0x1e5fa9={'count':0x0,'rows':[]};var _0x1e3f9b=_['map'](db['DeskField']['rawAttributes'],function(_0x4f79d9){return{'name':_0x4f79d9[_0x0421('0x28')],'type':_0x4f79d9[_0x0421('0x29')][_0x0421('0x2a')]};});_0x4c6bb7[_0x0421('0x2b')]=_['map'](_0x1e3f9b,_0x0421('0x25'));_0x4c6bb7[_0x0421('0x2c')]=_[_0x0421('0x2d')](_0x3b28c1[_0x0421('0x2c')]);_0x4c6bb7[_0x0421('0x2e')]=_[_0x0421('0x2f')](_0x4c6bb7[_0x0421('0x2b')],_0x4c6bb7[_0x0421('0x2c')]);_0x2ded50[_0x0421('0x30')]=_[_0x0421('0x2f')](_0x4c6bb7[_0x0421('0x2b')],qs[_0x0421('0x31')](_0x3b28c1[_0x0421('0x2c')][_0x0421('0x31')]));_0x2ded50[_0x0421('0x30')]=_0x2ded50[_0x0421('0x30')]['length']?_0x2ded50[_0x0421('0x30')]:_0x4c6bb7['model'];if(!_0x3b28c1[_0x0421('0x2c')][_0x0421('0x32')](_0x0421('0x33'))){_0x2ded50[_0x0421('0x1b')]=qs[_0x0421('0x1b')](_0x3b28c1[_0x0421('0x2c')][_0x0421('0x1b')]);_0x2ded50[_0x0421('0x19')]=qs[_0x0421('0x19')](_0x3b28c1[_0x0421('0x2c')]['offset']);}_0x2ded50[_0x0421('0x34')]=qs[_0x0421('0x35')](_0x3b28c1[_0x0421('0x2c')][_0x0421('0x35')]);_0x2ded50[_0x0421('0x36')]=qs[_0x0421('0x2e')](_[_0x0421('0x37')](_0x3b28c1[_0x0421('0x2c')],_0x4c6bb7[_0x0421('0x2e')]),_0x1e3f9b);if(_0x3b28c1[_0x0421('0x2c')][_0x0421('0x38')]){_0x2ded50[_0x0421('0x36')]=_[_0x0421('0x39')](_0x2ded50['where'],{'$or':_[_0x0421('0x3a')](_0x1e3f9b,function(_0x1b2636){if(_0x1b2636[_0x0421('0x29')]!=='VIRTUAL'){var _0x4db8bf={};_0x4db8bf[_0x1b2636[_0x0421('0x25')]]={'$like':'%'+_0x3b28c1['query'][_0x0421('0x38')]+'%'};return _0x4db8bf;}})});}_0x2ded50=_['merge']({},_0x2ded50,_0x3b28c1[_0x0421('0x3b')]);var _0x1341a1={'where':_0x2ded50[_0x0421('0x36')]};return db[_0x0421('0x3c')]['count'](_0x1341a1)[_0x0421('0x23')](function(_0x4f3ba4){_0x1e5fa9[_0x0421('0x1c')]=_0x4f3ba4;if(_0x3b28c1[_0x0421('0x2c')]['includeAll']){_0x2ded50['include']=[{'all':!![]}];}return db[_0x0421('0x3c')][_0x0421('0x3d')](_0x2ded50);})[_0x0421('0x23')](function(_0x91a8fe){_0x1e5fa9[_0x0421('0x3e')]=_0x91a8fe;return _0x1e5fa9;})['then'](respondWithFilteredResult(_0x296ca8,_0x2ded50))['catch'](handleError(_0x296ca8,null));};exports[_0x0421('0x3f')]=function(_0x3a6d18,_0x2d181a){var _0x4f8273={'raw':!![],'where':{'id':_0x3a6d18[_0x0421('0x40')]['id']}},_0x12a80c={};_0x12a80c[_0x0421('0x2b')]=_['keys'](db[_0x0421('0x3c')]['rawAttributes']);_0x12a80c['query']=_[_0x0421('0x2d')](_0x3a6d18[_0x0421('0x2c')]);_0x12a80c[_0x0421('0x2e')]=_[_0x0421('0x2f')](_0x12a80c['model'],_0x12a80c['query']);_0x4f8273[_0x0421('0x30')]=_[_0x0421('0x2f')](_0x12a80c[_0x0421('0x2b')],qs['fields'](_0x3a6d18[_0x0421('0x2c')]['fields']));_0x4f8273[_0x0421('0x30')]=_0x4f8273[_0x0421('0x30')]['length']?_0x4f8273['attributes']:_0x12a80c[_0x0421('0x2b')];if(_0x3a6d18[_0x0421('0x2c')][_0x0421('0x41')]){_0x4f8273[_0x0421('0x42')]=[{'all':!![]}];}_0x4f8273=_[_0x0421('0x39')]({},_0x4f8273,_0x3a6d18['options']);return db[_0x0421('0x3c')]['find'](_0x4f8273)[_0x0421('0x23')](handleEntityNotFound(_0x2d181a,null))[_0x0421('0x23')](respondWithResult(_0x2d181a,null))[_0x0421('0x43')](handleError(_0x2d181a,null));};exports[_0x0421('0x44')]=function(_0x5f21e7,_0x324d7b){return db[_0x0421('0x3c')]['create'](_0x5f21e7[_0x0421('0x45')],{})[_0x0421('0x23')](respondWithResult(_0x324d7b,0xc9))['catch'](handleError(_0x324d7b,null));};exports['update']=function(_0x352444,_0x4aaa7a){if(_0x352444[_0x0421('0x45')]['id']){delete _0x352444['body']['id'];}return db[_0x0421('0x3c')][_0x0421('0x46')]({'where':{'id':_0x352444[_0x0421('0x40')]['id']}})[_0x0421('0x23')](handleEntityNotFound(_0x4aaa7a,null))[_0x0421('0x23')](saveUpdates(_0x352444['body'],null))[_0x0421('0x23')](respondWithResult(_0x4aaa7a,null))[_0x0421('0x43')](handleError(_0x4aaa7a,null));};exports[_0x0421('0x22')]=function(_0x27660d,_0x306366){return db[_0x0421('0x3c')][_0x0421('0x46')]({'where':{'id':_0x27660d[_0x0421('0x40')]['id']}})['then'](handleEntityNotFound(_0x306366,null))[_0x0421('0x23')](removeEntity(_0x306366,null))['catch'](handleError(_0x306366,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f98e472..c7297fb 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 _0xd943=['api','moment','bluebird','../../config/environment','DeskField','int_desk_fields','idField','FieldId','util'];(function(_0x27f50d,_0x44bc88){var _0x268168=function(_0x564245){while(--_0x564245){_0x27f50d['push'](_0x27f50d['shift']());}};_0x268168(++_0x44bc88);}(_0xd943,0x1e5));var _0x3d94=function(_0xaf9097,_0x28bade){_0xaf9097=_0xaf9097-0x0;var _0x4d6463=_0xd943[_0xaf9097];return _0x4d6463;};'use strict';var _=require('lodash');var util=require(_0x3d94('0x0'));var logger=require('../../config/logger')(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d94('0x4'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0xf8241f,_0x508fa0){return _0xf8241f['define'](_0x3d94('0x5'),attributes,{'tableName':_0x3d94('0x6'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x3d94('0x7'),_0x3d94('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1c6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','idField','lodash','util'];(function(_0x54ab43,_0x19f4ca){var _0x562005=function(_0x4f7097){while(--_0x4f7097){_0x54ab43['push'](_0x54ab43['shift']());}};_0x562005(++_0x19f4ca);}(_0xf1c6,0x116));var _0x6f1c=function(_0x8f5914,_0xd91e6a){_0x8f5914=_0x8f5914-0x0;var _0x1e4517=_0xf1c6[_0x8f5914];return _0x1e4517;};'use strict';var _=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var logger=require('../../config/logger')(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var rp=require(_0x6f1c('0x5'));var fs=require('fs');var path=require(_0x6f1c('0x6'));var rimraf=require(_0x6f1c('0x7'));var config=require(_0x6f1c('0x8'));var attributes=require(_0x6f1c('0x9'));module[_0x6f1c('0xa')]=function(_0x2820c5,_0x6874aa){return _0x2820c5[_0x6f1c('0xb')](_0x6f1c('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6f1c('0xd'),'FieldId'],'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 e564413..7900367 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 _0x71c6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x54e2f9,_0x46fd8f){var _0x3c3ad5=function(_0x22e336){while(--_0x22e336){_0x54e2f9['push'](_0x54e2f9['shift']());}};_0x3c3ad5(++_0x46fd8f);}(_0x71c6,0x184));var _0x671c=function(_0x2dea3c,_0x2f3680){_0x2dea3c=_0x2dea3c-0x0;var _0x6debb5=_0x71c6[_0x2dea3c];return _0x6debb5;};'use strict';var _=require(_0x671c('0x0'));var util=require(_0x671c('0x1'));var moment=require(_0x671c('0x2'));var BPromise=require(_0x671c('0x3'));var rs=require(_0x671c('0x4'));var fs=require('fs');var Redis=require(_0x671c('0x5'));var db=require(_0x671c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x671c('0x7'))('rpc');var config=require(_0x671c('0x8'));var jayson=require(_0x671c('0x9'));var client=jayson[_0x671c('0xa')][_0x671c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5f93,_0x4fc658,_0x3460c6){return new BPromise(function(_0x3d7cf7,_0x1ded51){return client['request'](_0x4f5f93,_0x3460c6)[_0x671c('0xc')](function(_0x423f5c){logger[_0x671c('0xd')](_0x671c('0xe'),_0x4fc658,_0x671c('0xf'));logger[_0x671c('0x10')](_0x671c('0x11'),_0x4fc658,_0x671c('0xf'),JSON[_0x671c('0x12')](_0x423f5c));if(_0x423f5c[_0x671c('0x13')]){if(_0x423f5c[_0x671c('0x13')]['code']===0x1f4){logger[_0x671c('0x13')]('DeskField,\x20%s,\x20%s',_0x4fc658,_0x423f5c[_0x671c('0x13')][_0x671c('0x14')]);return _0x1ded51(_0x423f5c[_0x671c('0x13')][_0x671c('0x14')]);}logger['error'](_0x671c('0xe'),_0x4fc658,_0x423f5c['error'][_0x671c('0x14')]);return _0x3d7cf7(_0x423f5c['error'][_0x671c('0x14')]);}else{logger[_0x671c('0xd')](_0x671c('0xe'),_0x4fc658,_0x671c('0xf'));_0x3d7cf7(_0x423f5c[_0x671c('0x15')][_0x671c('0x14')]);}})[_0x671c('0x16')](function(_0x4ac752){logger[_0x671c('0x13')](_0x671c('0xe'),_0x4fc658,_0x4ac752);_0x1ded51(_0x4ac752);});});} \ No newline at end of file +var _0x1e05=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x176979,_0x3c8a46){var _0x474a3d=function(_0x391df0){while(--_0x391df0){_0x176979['push'](_0x176979['shift']());}};_0x474a3d(++_0x3c8a46);}(_0x1e05,0xf0));var _0x51e0=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x1e05[_0x2dd390];return _0x3afe47;};'use strict';var _=require(_0x51e0('0x0'));var util=require(_0x51e0('0x1'));var moment=require(_0x51e0('0x2'));var BPromise=require(_0x51e0('0x3'));var rs=require(_0x51e0('0x4'));var fs=require('fs');var Redis=require(_0x51e0('0x5'));var db=require(_0x51e0('0x6'))['db'];var utils=require(_0x51e0('0x7'));var logger=require(_0x51e0('0x8'))(_0x51e0('0x9'));var config=require(_0x51e0('0xa'));var jayson=require(_0x51e0('0xb'));var client=jayson[_0x51e0('0xc')][_0x51e0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x48dbc7,_0x467937,_0x135395){return new BPromise(function(_0x36796e,_0x38084e){return client[_0x51e0('0xe')](_0x48dbc7,_0x135395)[_0x51e0('0xf')](function(_0x16e6c5){logger[_0x51e0('0x10')](_0x51e0('0x11'),_0x467937,_0x51e0('0x12'));logger[_0x51e0('0x13')](_0x51e0('0x14'),_0x467937,_0x51e0('0x12'),JSON[_0x51e0('0x15')](_0x16e6c5));if(_0x16e6c5[_0x51e0('0x16')]){if(_0x16e6c5[_0x51e0('0x16')][_0x51e0('0x17')]===0x1f4){logger[_0x51e0('0x16')](_0x51e0('0x11'),_0x467937,_0x16e6c5[_0x51e0('0x16')][_0x51e0('0x18')]);return _0x38084e(_0x16e6c5[_0x51e0('0x16')][_0x51e0('0x18')]);}logger[_0x51e0('0x16')](_0x51e0('0x11'),_0x467937,_0x16e6c5[_0x51e0('0x16')][_0x51e0('0x18')]);return _0x36796e(_0x16e6c5[_0x51e0('0x16')]['message']);}else{logger[_0x51e0('0x10')](_0x51e0('0x11'),_0x467937,_0x51e0('0x12'));_0x36796e(_0x16e6c5['result']['message']);}})[_0x51e0('0x19')](function(_0x58ed48){logger[_0x51e0('0x16')]('DeskField,\x20%s,\x20%s',_0x467937,_0x58ed48);_0x38084e(_0x58ed48);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6461db4..218ceb4 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 _0x1175=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x2ce5ab,_0x229fbd){var _0x49b785=function(_0x20ca2e){while(--_0x20ca2e){_0x2ce5ab['push'](_0x2ce5ab['shift']());}};_0x49b785(++_0x229fbd);}(_0x1175,0xb2));var _0x5117=function(_0x424a05,_0x1eac7b){_0x424a05=_0x424a05-0x0;var _0x5aecab=_0x1175[_0x424a05];return _0x5aecab;};'use strict';var multer=require(_0x5117('0x0'));var util=require(_0x5117('0x1'));var path=require('path');var timeout=require(_0x5117('0x2'));var express=require('express');var router=express[_0x5117('0x3')]();var fs_extra=require(_0x5117('0x4'));var auth=require(_0x5117('0x5'));var interaction=require(_0x5117('0x6'));var config=require('../../config/environment');var controller=require(_0x5117('0x7'));router[_0x5117('0x8')]('/',auth['isAuthenticated'](),controller[_0x5117('0x9')]);router[_0x5117('0x8')](_0x5117('0xa'),auth[_0x5117('0xb')](),controller[_0x5117('0xc')]);router[_0x5117('0x8')](_0x5117('0xd'),auth[_0x5117('0xb')](),controller[_0x5117('0xe')]);router[_0x5117('0x8')](_0x5117('0xf'),auth[_0x5117('0xb')](),controller[_0x5117('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5117('0x11')]);router[_0x5117('0x12')](_0x5117('0xd'),auth['isAuthenticated'](),controller[_0x5117('0x13')]);router[_0x5117('0x14')](_0x5117('0xa'),auth[_0x5117('0xb')](),controller[_0x5117('0x15')]);router[_0x5117('0x16')]('/:id',auth[_0x5117('0xb')](),controller[_0x5117('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe858=['/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','show','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xe858,0xb6));var _0x8e85=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0xe858[_0x463183];return _0xd5fe56;};'use strict';var multer=require(_0x8e85('0x0'));var util=require(_0x8e85('0x1'));var path=require(_0x8e85('0x2'));var timeout=require(_0x8e85('0x3'));var express=require(_0x8e85('0x4'));var router=express[_0x8e85('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8e85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e85('0x7'));var controller=require(_0x8e85('0x8'));router[_0x8e85('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e85('0xa')]);router[_0x8e85('0x9')]('/:id',auth[_0x8e85('0xb')](),controller[_0x8e85('0xc')]);router[_0x8e85('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8e85('0xd')]);router['get']('/:id/fields',auth[_0x8e85('0xb')](),controller[_0x8e85('0xe')]);router[_0x8e85('0xf')]('/',auth[_0x8e85('0xb')](),controller[_0x8e85('0x10')]);router['post']('/:id/configurations',auth[_0x8e85('0xb')](),controller[_0x8e85('0x11')]);router['put'](_0x8e85('0x12'),auth[_0x8e85('0xb')](),controller['update']);router['delete'](_0x8e85('0x12'),auth[_0x8e85('0xb')](),controller[_0x8e85('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index eee528e..7d87e85 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 _0x5b5a=['exports','STRING','BOOLEAN'];(function(_0x116240,_0x5949fc){var _0x1095a9=function(_0x3b4dc2){while(--_0x3b4dc2){_0x116240['push'](_0x116240['shift']());}};_0x1095a9(++_0x5949fc);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x1a32fe,_0xdab6ac){_0x1a32fe=_0x1a32fe-0x0;var _0x1abca6=_0x5b5a[_0x1a32fe];return _0x1abca6;};'use strict';var Sequelize=require('sequelize');module[_0xa5b5('0x0')]={'name':{'type':Sequelize[_0xa5b5('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa5b5('0x1')]},'remoteUri':{'type':Sequelize[_0xa5b5('0x1')]},'tenantId':{'type':Sequelize[_0xa5b5('0x1')]},'clientId':{'type':Sequelize[_0xa5b5('0x1')]},'clientSecret':{'type':Sequelize[_0xa5b5('0x1')]},'serverUrl':{'type':Sequelize[_0xa5b5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa5b5('0x1')]},'modernAuthentication':{'type':Sequelize[_0xa5b5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbc1c=['exports','STRING','BOOLEAN'];(function(_0x36e299,_0x5f3e95){var _0xa47999=function(_0x57b07f){while(--_0x57b07f){_0x36e299['push'](_0x36e299['shift']());}};_0xa47999(++_0x5f3e95);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xbc1c[_0x20845e];return _0x28cf2b;};'use strict';var Sequelize=require('sequelize');module[_0xcbc1('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcbc1('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcbc1('0x1')]},'tenantId':{'type':Sequelize[_0xcbc1('0x1')]},'clientId':{'type':Sequelize[_0xcbc1('0x1')]},'clientSecret':{'type':Sequelize[_0xcbc1('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcbc1('0x1')]},'modernAuthentication':{'type':Sequelize[_0xcbc1('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9457243..6c73995 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 _0x7a27=['options','findAll','catch','show','rawAttributes','keys','includeAll','include','create','body','update','find','params','getConfigurations','Dynamics365Configuration','length','pick','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','password','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(','includes','@odata.type','PicklistAttributeMetadata','push','MetadataId','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','Dynamics365Account','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x1945a5,_0x50de54){var _0x5817a5=function(_0x2a5a93){while(--_0x2a5a93){_0x1945a5['push'](_0x1945a5['shift']());}};_0x5817a5(++_0x50de54);}(_0x7a27,0x160));var _0x77a2=function(_0x3a533e,_0x390c4e){_0x3a533e=_0x3a533e-0x0;var _0x99efa5=_0x7a27[_0x3a533e];return _0x99efa5;};'use strict';var rp=require(_0x77a2('0x0'));var util=require(_0x77a2('0x1'));var _=require(_0x77a2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x77a2('0x3'))(_0x77a2('0x4'));var db=require(_0x77a2('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x369b70,_0x16c0de){_0x16c0de=_0x16c0de||0xc8;return function(_0x31dbef){if(_0x31dbef){return _0x369b70[_0x77a2('0x6')](_0x16c0de)[_0x77a2('0x7')](_0x31dbef);}};}function respondWithFilteredResult(_0x58df64,_0x78bb77){return function(_0x41b94a){if(_0x41b94a){var _0x66bd4f=typeof _0x78bb77[_0x77a2('0x8')]===_0x77a2('0x9')&&typeof _0x78bb77[_0x77a2('0xa')]==='undefined';var _0x24e723=_0x41b94a[_0x77a2('0xb')];var _0x47fce1=_0x66bd4f?0x0:_0x78bb77[_0x77a2('0x8')];var _0x528502=_0x66bd4f?_0x41b94a[_0x77a2('0xb')]:_0x78bb77['offset']+_0x78bb77[_0x77a2('0xa')];var _0x454f00;if(_0x528502>=_0x24e723){_0x528502=_0x24e723;_0x454f00=0xc8;}else{_0x454f00=0xce;}_0x58df64[_0x77a2('0x6')](_0x454f00);return _0x58df64[_0x77a2('0xc')](_0x77a2('0xd'),_0x47fce1+'-'+_0x528502+'/'+_0x24e723)['json'](_0x41b94a);}return null;};}function saveUpdates(_0x454680){return function(_0x266323){if(_0x266323){return _0x266323['update'](_0x454680)[_0x77a2('0xe')](function(_0x3c56bc){return _0x3c56bc;});}return null;};}function removeEntity(_0x50109a){return function(_0x151f8e){if(_0x151f8e){return _0x151f8e[_0x77a2('0xf')]()[_0x77a2('0xe')](function(){_0x50109a['status'](0xcc)[_0x77a2('0x10')]();});}};}function handleEntityNotFound(_0x636258){return function(_0x12a5cc){if(!_0x12a5cc){_0x636258['sendStatus'](0x194);}return _0x12a5cc;};}function handleError(_0x4abea1,_0x87b94){_0x87b94=_0x87b94||0x1f4;return function(_0x4b49d7){logger['error'](_0x4b49d7[_0x77a2('0x11')]);if(_0x4b49d7[_0x77a2('0x12')]){delete _0x4b49d7[_0x77a2('0x12')];}_0x4abea1[_0x77a2('0x6')](_0x87b94)[_0x77a2('0x13')](_0x4b49d7);};}exports[_0x77a2('0x14')]=function(_0x512f76,_0x161f8c){var _0x267670={},_0x1a13e3={},_0x367ca9={'count':0x0,'rows':[]};var _0x4770d6=_['map'](db[_0x77a2('0x15')]['rawAttributes'],function(_0x12d032){return{'name':_0x12d032[_0x77a2('0x16')],'type':_0x12d032[_0x77a2('0x17')][_0x77a2('0x18')]};});_0x1a13e3[_0x77a2('0x19')]=_[_0x77a2('0x1a')](_0x4770d6,'name');_0x1a13e3[_0x77a2('0x1b')]=_['keys'](_0x512f76[_0x77a2('0x1b')]);_0x1a13e3['filters']=_[_0x77a2('0x1c')](_0x1a13e3[_0x77a2('0x19')],_0x1a13e3[_0x77a2('0x1b')]);_0x267670[_0x77a2('0x1d')]=_[_0x77a2('0x1c')](_0x1a13e3[_0x77a2('0x19')],qs['fields'](_0x512f76[_0x77a2('0x1b')][_0x77a2('0x1e')]));_0x267670[_0x77a2('0x1d')]=_0x267670[_0x77a2('0x1d')]['length']?_0x267670[_0x77a2('0x1d')]:_0x1a13e3[_0x77a2('0x19')];if(!_0x512f76['query'][_0x77a2('0x1f')](_0x77a2('0x20'))){_0x267670[_0x77a2('0xa')]=qs[_0x77a2('0xa')](_0x512f76[_0x77a2('0x1b')]['limit']);_0x267670[_0x77a2('0x8')]=qs[_0x77a2('0x8')](_0x512f76[_0x77a2('0x1b')][_0x77a2('0x8')]);}_0x267670[_0x77a2('0x21')]=qs[_0x77a2('0x22')](_0x512f76['query'][_0x77a2('0x22')]);_0x267670[_0x77a2('0x23')]=qs['filters'](_['pick'](_0x512f76[_0x77a2('0x1b')],_0x1a13e3[_0x77a2('0x24')]),_0x4770d6);if(_0x512f76[_0x77a2('0x1b')][_0x77a2('0x25')]){_0x267670[_0x77a2('0x23')]=_[_0x77a2('0x26')](_0x267670[_0x77a2('0x23')],{'$or':_[_0x77a2('0x1a')](_0x4770d6,function(_0x52fc06){if(_0x52fc06[_0x77a2('0x17')]!==_0x77a2('0x27')){var _0x4e7b89={};_0x4e7b89[_0x52fc06[_0x77a2('0x12')]]={'$like':'%'+_0x512f76[_0x77a2('0x1b')][_0x77a2('0x25')]+'%'};return _0x4e7b89;}})});}_0x267670=_[_0x77a2('0x26')]({},_0x267670,_0x512f76[_0x77a2('0x28')]);var _0x5ab82a={'where':_0x267670[_0x77a2('0x23')]};return db[_0x77a2('0x15')]['count'](_0x5ab82a)[_0x77a2('0xe')](function(_0x497133){_0x367ca9[_0x77a2('0xb')]=_0x497133;if(_0x512f76['query']['includeAll']){_0x267670['include']=[{'all':!![]}];}return db[_0x77a2('0x15')][_0x77a2('0x29')](_0x267670);})[_0x77a2('0xe')](function(_0x56099f){_0x367ca9['rows']=_0x56099f;return _0x367ca9;})[_0x77a2('0xe')](respondWithFilteredResult(_0x161f8c,_0x267670))[_0x77a2('0x2a')](handleError(_0x161f8c,null));};exports[_0x77a2('0x2b')]=function(_0x44f1e4,_0x332958){var _0x312113={'raw':![],'where':{'id':_0x44f1e4['params']['id']}},_0x3bd576={};_0x3bd576['model']=_['keys'](db[_0x77a2('0x15')][_0x77a2('0x2c')]);_0x3bd576[_0x77a2('0x1b')]=_[_0x77a2('0x2d')](_0x44f1e4['query']);_0x3bd576[_0x77a2('0x24')]=_[_0x77a2('0x1c')](_0x3bd576['model'],_0x3bd576['query']);_0x312113[_0x77a2('0x1d')]=_[_0x77a2('0x1c')](_0x3bd576[_0x77a2('0x19')],qs[_0x77a2('0x1e')](_0x44f1e4['query'][_0x77a2('0x1e')]));_0x312113[_0x77a2('0x1d')]=_0x312113['attributes']['length']?_0x312113[_0x77a2('0x1d')]:_0x3bd576['model'];if(_0x44f1e4[_0x77a2('0x1b')][_0x77a2('0x2e')]){_0x312113[_0x77a2('0x2f')]=[{'all':!![]}];}_0x312113=_[_0x77a2('0x26')]({},_0x312113,_0x44f1e4[_0x77a2('0x28')]);return db['Dynamics365Account']['find'](_0x312113)[_0x77a2('0xe')](handleEntityNotFound(_0x332958,null))[_0x77a2('0xe')](respondWithResult(_0x332958,null))[_0x77a2('0x2a')](handleError(_0x332958,null));};exports['create']=function(_0x269e52,_0x3cebf9){return db[_0x77a2('0x15')][_0x77a2('0x30')](_0x269e52[_0x77a2('0x31')],{})[_0x77a2('0xe')](respondWithResult(_0x3cebf9,0xc9))['catch'](handleError(_0x3cebf9,null));};exports[_0x77a2('0x32')]=function(_0x4e695b,_0x5db517){if(_0x4e695b['body']['id']){delete _0x4e695b[_0x77a2('0x31')]['id'];}return db[_0x77a2('0x15')][_0x77a2('0x33')]({'where':{'id':_0x4e695b['params']['id']}})[_0x77a2('0xe')](handleEntityNotFound(_0x5db517,null))[_0x77a2('0xe')](saveUpdates(_0x4e695b[_0x77a2('0x31')],null))[_0x77a2('0xe')](respondWithResult(_0x5db517,null))[_0x77a2('0x2a')](handleError(_0x5db517,null));};exports[_0x77a2('0xf')]=function(_0x5e7481,_0x240180){return db[_0x77a2('0x15')]['find']({'where':{'id':_0x5e7481[_0x77a2('0x34')]['id']}})[_0x77a2('0xe')](handleEntityNotFound(_0x240180,null))[_0x77a2('0xe')](removeEntity(_0x240180,null))[_0x77a2('0x2a')](handleError(_0x240180,null));};exports[_0x77a2('0x35')]=function(_0x1f072c,_0x15dd95){var _0xde8ca5={};var _0x315054={};var _0x465696;var _0x55c718;return db[_0x77a2('0x15')]['findOne']({'where':{'id':_0x1f072c[_0x77a2('0x34')]['id']}})['then'](handleEntityNotFound(_0x15dd95,null))['then'](function(_0x440dd3){if(_0x440dd3){_0x465696=_0x440dd3;_0x315054[_0x77a2('0x19')]=_[_0x77a2('0x2d')](db[_0x77a2('0x36')][_0x77a2('0x2c')]);_0x315054[_0x77a2('0x1b')]=_['keys'](_0x1f072c['query']);_0x315054['filters']=_[_0x77a2('0x1c')](_0x315054[_0x77a2('0x19')],_0x315054[_0x77a2('0x1b')]);_0xde8ca5['attributes']=_[_0x77a2('0x1c')](_0x315054[_0x77a2('0x19')],qs[_0x77a2('0x1e')](_0x1f072c[_0x77a2('0x1b')]['fields']));_0xde8ca5[_0x77a2('0x1d')]=_0xde8ca5[_0x77a2('0x1d')][_0x77a2('0x37')]?_0xde8ca5[_0x77a2('0x1d')]:_0x315054[_0x77a2('0x19')];_0xde8ca5[_0x77a2('0x21')]=qs[_0x77a2('0x22')](_0x1f072c[_0x77a2('0x1b')][_0x77a2('0x22')]);_0xde8ca5[_0x77a2('0x23')]=qs[_0x77a2('0x24')](_[_0x77a2('0x38')](_0x1f072c[_0x77a2('0x1b')],_0x315054[_0x77a2('0x24')]));if(_0x1f072c['query'][_0x77a2('0x25')]){_0xde8ca5[_0x77a2('0x23')]=_[_0x77a2('0x26')](_0xde8ca5[_0x77a2('0x23')],{'$or':_[_0x77a2('0x1a')](_0xde8ca5['attributes'],function(_0x50bd56){var _0xe3aa0f={};_0xe3aa0f[_0x50bd56]={'$like':'%'+_0x1f072c['query'][_0x77a2('0x25')]+'%'};return _0xe3aa0f;})});}_0xde8ca5=_[_0x77a2('0x26')]({},_0xde8ca5,_0x1f072c['options']);return _0x465696['getConfigurations'](_0xde8ca5);}})[_0x77a2('0xe')](function(_0x5b0f40){if(_0x5b0f40){_0x55c718=_0x5b0f40[_0x77a2('0x37')];if(!_0x1f072c[_0x77a2('0x1b')][_0x77a2('0x1f')](_0x77a2('0x20'))){_0xde8ca5['limit']=qs[_0x77a2('0xa')](_0x1f072c[_0x77a2('0x1b')]['limit']);_0xde8ca5[_0x77a2('0x8')]=qs[_0x77a2('0x8')](_0x1f072c[_0x77a2('0x1b')][_0x77a2('0x8')]);}return _0x465696['getConfigurations'](_0xde8ca5);}})[_0x77a2('0xe')](function(_0x1c1ad7){if(_0x1c1ad7){return _0x1c1ad7?{'count':_0x55c718,'rows':_0x1c1ad7}:null;}})[_0x77a2('0xe')](respondWithResult(_0x15dd95,null))[_0x77a2('0x2a')](handleError(_0x15dd95,null));};exports[_0x77a2('0x39')]=function(_0x2e2405,_0x4a723f){if(_0x2e2405[_0x77a2('0x31')]['id']){delete _0x2e2405[_0x77a2('0x31')]['id'];}return db[_0x77a2('0x15')][_0x77a2('0x3a')]({'where':{'id':_0x2e2405[_0x77a2('0x34')]['id']}})[_0x77a2('0xe')](handleEntityNotFound(_0x4a723f,null))[_0x77a2('0xe')](function(_0x50b8c3){if(_0x50b8c3){_0x2e2405[_0x77a2('0x31')]['AccountId']=_0x50b8c3['id'];_0x2e2405[_0x77a2('0x31')][_0x77a2('0x3b')]=integrations[_0x77a2('0x3c')](_0x2e2405['body'][_0x77a2('0x3d')],_0x2e2405[_0x77a2('0x31')]['type']);_0x2e2405['body'][_0x77a2('0x3e')]=integrations['getDescriptions'](_0x2e2405[_0x77a2('0x31')]['channel'],_0x2e2405[_0x77a2('0x31')][_0x77a2('0x17')]);return db[_0x77a2('0x36')]['create'](_0x2e2405['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x77a2('0x3b')},{'model':db[_0x77a2('0x3f')],'as':_0x77a2('0x3e')}]});}return null;})[_0x77a2('0xe')](respondWithResult(_0x4a723f,null))[_0x77a2('0x2a')](handleError(_0x4a723f,null));};function sanitizeRemoteUri(_0x33494a){var _0x1dae50=_0x33494a[_0x77a2('0x40')](-0x1);if(_0x1dae50==='/')return _0x33494a[_0x77a2('0x41')](0x0,_0x33494a[_0x77a2('0x42')](_0x1dae50));return _0x33494a;}function getWebApiUrl(_0x3cc6d6){return util[_0x77a2('0x43')](_0x77a2('0x44'),_0x3cc6d6);}exports['getFields']=function(_0x3e7d41,_0x3309bc){var _0xc6d8bd=_0x3e7d41[_0x77a2('0x1b')][_0x77a2('0x45')];var _0x54d464=_0xc6d8bd===_0x77a2('0x46')?_0x77a2('0x47'):_0x77a2('0x48');var _0x41b904='';var _0x23ac53='';var _0x41124b='';var _0x5f3bde='';var _0x55a0da='';var _0x31c5f1='';var _0x9b28f5='';var _0x495d19='';var _0x5ebf75=[_0x77a2('0x49'),_0x77a2('0x4a'),_0x77a2('0x4b'),_0x77a2('0x4c'),_0x77a2('0x4d'),_0x77a2('0x4e'),_0x77a2('0x4f'),_0x77a2('0x50'),_0x77a2('0x51'),_0x77a2('0x52')];var _0x4b5311=[_0x77a2('0x53'),_0x77a2('0x54'),'actualserviceunits',_0x77a2('0x55'),_0x77a2('0x56'),_0x77a2('0x57'),_0x77a2('0x58'),_0x77a2('0x59'),_0x77a2('0x5a'),_0x77a2('0x5b'),_0x77a2('0x5c'),_0x77a2('0x5d'),_0x77a2('0x5e'),_0x77a2('0x5f'),_0x77a2('0x60'),_0x77a2('0x61'),'customeridtype',_0x77a2('0x62'),_0x77a2('0x63'),_0x77a2('0x64'),_0x77a2('0x65'),_0x77a2('0x66'),_0x77a2('0x67'),_0x77a2('0x68'),_0x77a2('0x69'),_0x77a2('0x6a'),_0x77a2('0x6b'),'influencescore','kbarticleidname',_0x77a2('0x6c'),'masteridname','modifiedbyexternalpartyname',_0x77a2('0x6d'),_0x77a2('0x6e'),_0x77a2('0x6f'),_0x77a2('0x70'),_0x77a2('0x71'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x77a2('0x72'),_0x77a2('0x73'),_0x77a2('0x74'),_0x77a2('0x75'),'owneridname','owneridtype',_0x77a2('0x76'),_0x77a2('0x77'),'primarycontactidname',_0x77a2('0x78'),_0x77a2('0x79'),_0x77a2('0x7a'),_0x77a2('0x7b'),_0x77a2('0x7c'),_0x77a2('0x7d'),_0x77a2('0x7e'),'responsiblecontactidname',_0x77a2('0x7f'),'sentimentvalue',_0x77a2('0x80'),_0x77a2('0x81'),_0x77a2('0x82'),_0x77a2('0x83'),_0x77a2('0x84'),_0x77a2('0x85'),_0x77a2('0x86'),_0x77a2('0x87'),_0x77a2('0x88'),_0x77a2('0x89'),_0x77a2('0x8a'),_0x77a2('0x8b')];var _0x33da62=_0x5ebf75[_0x77a2('0x8c')](_0x4b5311);return db['Dynamics365Account']['findOne']({'where':{'id':_0x3e7d41['params']['id']},'attributes':['id',_0x77a2('0x8d'),'password',_0x77a2('0x8e'),_0x77a2('0x8f'),_0x77a2('0x90'),'clientSecret',_0x77a2('0x91')],'include':[{'model':db[_0x77a2('0x92')],'as':_0x77a2('0x92'),'attributes':['id','data5','data7']}]})[_0x77a2('0xe')](handleEntityNotFound(_0x3309bc,null))[_0x77a2('0xe')](function(_0x2de098){if(_0x2de098){if(_0x2de098[_0x77a2('0x91')]){_0x2de098['access_token']=_0x2de098[_0x77a2('0x92')][_0x77a2('0x93')];_0x495d19=sanitizeRemoteUri(_0x2de098[_0x77a2('0x92')][_0x77a2('0x94')]);_0x9b28f5=getWebApiUrl(_0x495d19);return _0x2de098;}_0x495d19=sanitizeRemoteUri(_0x2de098[_0x77a2('0x8e')]);_0x9b28f5=getWebApiUrl(_0x495d19);var _0x5ea0ff={'method':'POST','uri':_0x77a2('0x95')+_0x2de098[_0x77a2('0x8f')]+'/oauth2/token','form':{'client_id':_0x2de098[_0x77a2('0x90')],'resource':_0x495d19,'username':_0x2de098['username'],'password':_0x2de098[_0x77a2('0x96')],'grant_type':_0x77a2('0x96'),'client_secret':_0x2de098[_0x77a2('0x97')]},'json':!![]};return rp(_0x5ea0ff);}})[_0x77a2('0xe')](function(_0x44dd6d){_0x31c5f1=_0x44dd6d[_0x77a2('0x98')];var _0x444080={'method':_0x77a2('0x99'),'uri':encodeURI(_0x9b28f5+_0x77a2('0x9a')+_0x54d464+'\x27'),'headers':{'Authorization':_0x77a2('0x9b')+_0x31c5f1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x444080);})[_0x77a2('0xe')](function(_0x258431){var _0x4ac219=_0x258431[_0x77a2('0x9c')][0x0];var _0x12a055=_0x4ac219['MetadataId'];var _0x3e33a8={'method':_0x77a2('0x99'),'uri':_0x9b28f5+_0x77a2('0x9d')+_0x12a055+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x31c5f1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3e33a8);})[_0x77a2('0xe')](function(_0xa9085a){_0x41b904=_0xa9085a;_0x23ac53=_0x41b904['Attributes'];_0x23ac53=_['remove'](_0x23ac53,function(_0x2118ed){return!_0x33da62[_0x77a2('0x9e')](_0x2118ed['LogicalName']);});var _0x19de53=[];var _0x53b511=[];_0x23ac53['forEach'](function(_0x34fc63){if(_0x34fc63[_0x77a2('0x9f')]){var _0x12660a=_0x34fc63[_0x77a2('0x9f')][_0x77a2('0x41')](_0x34fc63[_0x77a2('0x9f')][_0x77a2('0x42')]('.')+0x1);if(_0x12660a===_0x77a2('0xa0')){_0x19de53[_0x77a2('0xa1')](getSelectList(_0x9b28f5,_0xc6d8bd,_0x53b511,_0x41b904[_0x77a2('0xa2')],_0x34fc63['MetadataId'],_0x31c5f1));}}});return Promise['all'](_0x19de53);})['then'](function(_0x1fbe92){_0x41124b=_0x1fbe92[0x0];var _0x58b6c6=[];var _0x36926a=[];_0x23ac53[_0x77a2('0xa3')](function(_0x6c30b6){if(!_['isNil'](_0x6c30b6[_0x77a2('0x9f')])){var _0x13df33=_0x6c30b6[_0x77a2('0x9f')]['substring'](_0x6c30b6[_0x77a2('0x9f')][_0x77a2('0x42')]('.')+0x1);if(_0x13df33===_0x77a2('0xa4')){_0x58b6c6[_0x77a2('0xa1')](getBooleanList(_0x9b28f5,_0xc6d8bd,_0x36926a,_0x41b904[_0x77a2('0xa2')],_0x6c30b6['MetadataId'],_0x31c5f1));}}});return Promise['all'](_0x58b6c6);})[_0x77a2('0xe')](function(_0x470387){_0x5f3bde=_0x470387[0x0];var _0xb47ac4=[];var _0x408bb1=[];_0x23ac53[_0x77a2('0xa3')](function(_0x146e0c){if(_0x146e0c['@odata.type']){var _0x17fccd=_0x146e0c['@odata.type'][_0x77a2('0x41')](_0x146e0c['@odata.type'][_0x77a2('0x42')]('.')+0x1);if(_0x17fccd===_0x77a2('0xa5')||_0x17fccd===_0x77a2('0xa6')||_0x17fccd===_0x77a2('0xa7')||_0x17fccd===_0x77a2('0xa8')||_0x17fccd===_0x77a2('0xa9')||_0x17fccd===_0x77a2('0xaa')||_0x17fccd===_0x77a2('0xab')||_0x17fccd===_0x77a2('0xac')||_0x17fccd===_0x77a2('0xad')||_0x17fccd===_0x77a2('0xae')){_0xb47ac4[_0x77a2('0xa1')](getInputList(_0x9b28f5,_0xc6d8bd,_0x17fccd,_0x408bb1,_0x41b904['MetadataId'],_0x146e0c[_0x77a2('0xa2')],_0x31c5f1));}}});return Promise['all'](_0xb47ac4);})['then'](function(_0x3ff96d){_0x55a0da=_0x3ff96d[0x0];var _0x3bf9ae=_0x41124b[_0x77a2('0x8c')](_0x5f3bde)['concat'](_0x55a0da);var _0x455ee9={'count':_0x3bf9ae[_0x77a2('0x37')],'rows':_0x3bf9ae};return _0x455ee9;})[_0x77a2('0xe')](respondWithResult(_0x3309bc,null))[_0x77a2('0x2a')](function(_0x93b8d6){var _0x1ee662=_0x3e7d41[_0x77a2('0x1b')]['test']?0x1f4:_0x93b8d6[_0x77a2('0xaf')]||0x1f4;logger[_0x77a2('0xb0')](_0x93b8d6[_0x77a2('0x11')]);delete _0x93b8d6[_0x77a2('0x12')];if(_0x1ee662===0x191){_0x1ee662=0x190;}_0x3309bc[_0x77a2('0x6')](_0x1ee662)['send'](_0x3e7d41['query'][_0x77a2('0xb1')]?{'message':_0x77a2('0xb2'),'statusCode':_0x93b8d6['statusCode']}:_0x93b8d6);});};function getSelectList(_0x1603a1,_0x559118,_0xb9b7dc,_0x3c2788,_0x2ff607,_0x1161db){var _0x3456f8={'method':_0x77a2('0x99'),'uri':_0x1603a1+'EntityDefinitions('+_0x3c2788+_0x77a2('0xb3')+_0x2ff607+_0x77a2('0xb4')+_0x77a2('0xb5'),'headers':{'Authorization':_0x77a2('0x9b')+_0x1161db,'If-None-Match':null,'OData-Version':_0x77a2('0xb6')},'json':!![]};return rp(_0x3456f8)[_0x77a2('0xe')](function(_0x3d1fbc){var _0x2dc2c4=[];var _0x39b396=_0x3d1fbc[_0x77a2('0xb7')][_0x77a2('0xb8')];_0x39b396[_0x77a2('0xa3')](function(_0x4ecd18){_0x2dc2c4[_0x77a2('0xa1')]({'name':_0x4ecd18[_0x77a2('0xb9')][_0x77a2('0xba')][_0x77a2('0xb9')],'value':String(_0x4ecd18['Value'])});});var _0xc838dd={'id':_0x559118+'_'+_0x3d1fbc[_0x77a2('0xbb')],'name':_0x3d1fbc[_0x77a2('0xbc')]['UserLocalizedLabel'][_0x77a2('0xb9')],'custom':![],'options':_0x2dc2c4};_0xb9b7dc[_0x77a2('0xa1')](_0xc838dd);return _0xb9b7dc;});}function getBooleanList(_0x10bfce,_0x385852,_0x4a1483,_0x3bce47,_0x36e2e3,_0x15b2ad){var _0x282feb={'method':_0x77a2('0x99'),'uri':_0x10bfce+_0x77a2('0x9d')+_0x3bce47+_0x77a2('0xb3')+_0x36e2e3+_0x77a2('0xbd'),'headers':{'Authorization':_0x77a2('0x9b')+_0x15b2ad,'If-None-Match':null,'OData-Version':_0x77a2('0xb6')},'json':!![]};return rp(_0x282feb)['then'](function(_0x2af092){var _0x5e74e4=[];_0x5e74e4[_0x77a2('0xa1')]({'name':_0x2af092[_0x77a2('0xb7')][_0x77a2('0xbe')][_0x77a2('0xb9')][_0x77a2('0xba')][_0x77a2('0xb9')],'value':_0x77a2('0xbf')},{'name':_0x2af092[_0x77a2('0xb7')][_0x77a2('0xc0')]['Label'][_0x77a2('0xba')]['Label'],'value':_0x77a2('0xc1')});var _0x3fc5af={'id':_0x385852+'_'+_0x2af092[_0x77a2('0xbb')],'name':_0x2af092[_0x77a2('0xbc')][_0x77a2('0xba')]['Label'],'custom':![],'options':_0x5e74e4};_0x4a1483[_0x77a2('0xa1')](_0x3fc5af);return _0x4a1483;});}function getInputList(_0x5af824,_0x46961d,_0x1185a4,_0x871189,_0x4bcfeb,_0x3828c7,_0x5566b5){var _0x512f62={'method':'GET','uri':_0x5af824+'EntityDefinitions('+_0x4bcfeb+')/Attributes('+_0x3828c7+_0x77a2('0xc2')+_0x1185a4+_0x77a2('0xc3'),'headers':{'Authorization':'Bearer\x20'+_0x5566b5,'If-None-Match':null,'OData-Version':_0x77a2('0xb6')},'json':!![]};return rp(_0x512f62)[_0x77a2('0xe')](function(_0x13f881){var _0x3fd251={'id':_0x46961d+'_'+_0x13f881[_0x77a2('0xbb')],'name':_0x13f881[_0x77a2('0xbc')][_0x77a2('0xba')]?_0x13f881[_0x77a2('0xbc')][_0x77a2('0xba')][_0x77a2('0xb9')]:_0x13f881[_0x77a2('0xbb')],'custom':![],'options':[]};_0x871189[_0x77a2('0xa1')](_0x3fd251);return _0x871189;});} \ No newline at end of file +var _0xcb2c=['StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','getConfigurations','findOne','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(','Bearer\x20','4.0','Attributes','includes','LogicalName','@odata.type','all','forEach','isNil','substring','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata'];(function(_0x2b1d5a,_0x3e975f){var _0x5cfefa=function(_0x755ab7){while(--_0x755ab7){_0x2b1d5a['push'](_0x2b1d5a['shift']());}};_0x5cfefa(++_0x3e975f);}(_0xcb2c,0x17a));var _0xccb2=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xcb2c[_0x550d12];return _0x12103d;};'use strict';var rp=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var _=require(_0xccb2('0x2'));var qs=require(_0xccb2('0x3'));var logger=require(_0xccb2('0x4'))('api');var db=require(_0xccb2('0x5'))['db'];var integrations=require(_0xccb2('0x6'));function respondWithResult(_0x59586d,_0x2d3d10){_0x2d3d10=_0x2d3d10||0xc8;return function(_0x2adc1a){if(_0x2adc1a){return _0x59586d[_0xccb2('0x7')](_0x2d3d10)['json'](_0x2adc1a);}};}function respondWithFilteredResult(_0x59d154,_0x3e078d){return function(_0x3c1e0e){if(_0x3c1e0e){var _0x172ce0=typeof _0x3e078d[_0xccb2('0x8')]===_0xccb2('0x9')&&typeof _0x3e078d[_0xccb2('0xa')]===_0xccb2('0x9');var _0x29f2cb=_0x3c1e0e[_0xccb2('0xb')];var _0x42ee06=_0x172ce0?0x0:_0x3e078d[_0xccb2('0x8')];var _0x159e40=_0x172ce0?_0x3c1e0e['count']:_0x3e078d[_0xccb2('0x8')]+_0x3e078d[_0xccb2('0xa')];var _0x2594ce;if(_0x159e40>=_0x29f2cb){_0x159e40=_0x29f2cb;_0x2594ce=0xc8;}else{_0x2594ce=0xce;}_0x59d154[_0xccb2('0x7')](_0x2594ce);return _0x59d154[_0xccb2('0xc')]('Content-Range',_0x42ee06+'-'+_0x159e40+'/'+_0x29f2cb)[_0xccb2('0xd')](_0x3c1e0e);}return null;};}function saveUpdates(_0x19f151){return function(_0x4f8aae){if(_0x4f8aae){return _0x4f8aae[_0xccb2('0xe')](_0x19f151)[_0xccb2('0xf')](function(_0x35868d){return _0x35868d;});}return null;};}function removeEntity(_0x3a99c2){return function(_0x26b29b){if(_0x26b29b){return _0x26b29b[_0xccb2('0x10')]()[_0xccb2('0xf')](function(){_0x3a99c2[_0xccb2('0x7')](0xcc)[_0xccb2('0x11')]();});}};}function handleEntityNotFound(_0x279a44){return function(_0x5853f5){if(!_0x5853f5){_0x279a44[_0xccb2('0x12')](0x194);}return _0x5853f5;};}function handleError(_0x1a60ea,_0x4011a0){_0x4011a0=_0x4011a0||0x1f4;return function(_0x590757){logger[_0xccb2('0x13')](_0x590757[_0xccb2('0x14')]);if(_0x590757[_0xccb2('0x15')]){delete _0x590757[_0xccb2('0x15')];}_0x1a60ea[_0xccb2('0x7')](_0x4011a0)[_0xccb2('0x16')](_0x590757);};}exports[_0xccb2('0x17')]=function(_0x2e323a,_0x4604c2){var _0x3b43b4={},_0x429817={},_0x46f0e0={'count':0x0,'rows':[]};var _0x5b411f=_[_0xccb2('0x18')](db[_0xccb2('0x19')][_0xccb2('0x1a')],function(_0x21b4a0){return{'name':_0x21b4a0[_0xccb2('0x1b')],'type':_0x21b4a0['type'][_0xccb2('0x1c')]};});_0x429817[_0xccb2('0x1d')]=_[_0xccb2('0x18')](_0x5b411f,'name');_0x429817[_0xccb2('0x1e')]=_[_0xccb2('0x1f')](_0x2e323a['query']);_0x429817[_0xccb2('0x20')]=_[_0xccb2('0x21')](_0x429817['model'],_0x429817[_0xccb2('0x1e')]);_0x3b43b4[_0xccb2('0x22')]=_[_0xccb2('0x21')](_0x429817[_0xccb2('0x1d')],qs[_0xccb2('0x23')](_0x2e323a[_0xccb2('0x1e')][_0xccb2('0x23')]));_0x3b43b4[_0xccb2('0x22')]=_0x3b43b4[_0xccb2('0x22')]['length']?_0x3b43b4[_0xccb2('0x22')]:_0x429817[_0xccb2('0x1d')];if(!_0x2e323a['query']['hasOwnProperty']('nolimit')){_0x3b43b4[_0xccb2('0xa')]=qs[_0xccb2('0xa')](_0x2e323a[_0xccb2('0x1e')]['limit']);_0x3b43b4[_0xccb2('0x8')]=qs[_0xccb2('0x8')](_0x2e323a['query'][_0xccb2('0x8')]);}_0x3b43b4[_0xccb2('0x24')]=qs['sort'](_0x2e323a['query'][_0xccb2('0x25')]);_0x3b43b4[_0xccb2('0x26')]=qs[_0xccb2('0x20')](_[_0xccb2('0x27')](_0x2e323a['query'],_0x429817['filters']),_0x5b411f);if(_0x2e323a[_0xccb2('0x1e')][_0xccb2('0x28')]){_0x3b43b4[_0xccb2('0x26')]=_[_0xccb2('0x29')](_0x3b43b4[_0xccb2('0x26')],{'$or':_[_0xccb2('0x18')](_0x5b411f,function(_0x3e1356){if(_0x3e1356[_0xccb2('0x2a')]!==_0xccb2('0x2b')){var _0x453d71={};_0x453d71[_0x3e1356[_0xccb2('0x15')]]={'$like':'%'+_0x2e323a[_0xccb2('0x1e')]['filter']+'%'};return _0x453d71;}})});}_0x3b43b4=_[_0xccb2('0x29')]({},_0x3b43b4,_0x2e323a[_0xccb2('0x2c')]);var _0xba866f={'where':_0x3b43b4[_0xccb2('0x26')]};return db[_0xccb2('0x19')][_0xccb2('0xb')](_0xba866f)[_0xccb2('0xf')](function(_0x38a006){_0x46f0e0['count']=_0x38a006;if(_0x2e323a[_0xccb2('0x1e')]['includeAll']){_0x3b43b4[_0xccb2('0x2d')]=[{'all':!![]}];}return db[_0xccb2('0x19')][_0xccb2('0x2e')](_0x3b43b4);})['then'](function(_0x52b629){_0x46f0e0[_0xccb2('0x2f')]=_0x52b629;return _0x46f0e0;})[_0xccb2('0xf')](respondWithFilteredResult(_0x4604c2,_0x3b43b4))[_0xccb2('0x30')](handleError(_0x4604c2,null));};exports[_0xccb2('0x31')]=function(_0x165545,_0x3a1e80){var _0x58edd8={'raw':![],'where':{'id':_0x165545['params']['id']}},_0x35360d={};_0x35360d[_0xccb2('0x1d')]=_['keys'](db[_0xccb2('0x19')][_0xccb2('0x1a')]);_0x35360d[_0xccb2('0x1e')]=_[_0xccb2('0x1f')](_0x165545[_0xccb2('0x1e')]);_0x35360d[_0xccb2('0x20')]=_[_0xccb2('0x21')](_0x35360d[_0xccb2('0x1d')],_0x35360d[_0xccb2('0x1e')]);_0x58edd8[_0xccb2('0x22')]=_[_0xccb2('0x21')](_0x35360d['model'],qs[_0xccb2('0x23')](_0x165545[_0xccb2('0x1e')]['fields']));_0x58edd8[_0xccb2('0x22')]=_0x58edd8['attributes'][_0xccb2('0x32')]?_0x58edd8[_0xccb2('0x22')]:_0x35360d[_0xccb2('0x1d')];if(_0x165545[_0xccb2('0x1e')][_0xccb2('0x33')]){_0x58edd8[_0xccb2('0x2d')]=[{'all':!![]}];}_0x58edd8=_[_0xccb2('0x29')]({},_0x58edd8,_0x165545['options']);return db[_0xccb2('0x19')][_0xccb2('0x34')](_0x58edd8)[_0xccb2('0xf')](handleEntityNotFound(_0x3a1e80,null))[_0xccb2('0xf')](respondWithResult(_0x3a1e80,null))[_0xccb2('0x30')](handleError(_0x3a1e80,null));};exports[_0xccb2('0x35')]=function(_0x268280,_0x2234de){return db[_0xccb2('0x19')][_0xccb2('0x35')](_0x268280[_0xccb2('0x36')],{})[_0xccb2('0xf')](respondWithResult(_0x2234de,0xc9))[_0xccb2('0x30')](handleError(_0x2234de,null));};exports[_0xccb2('0xe')]=function(_0x505814,_0x21ef10){if(_0x505814[_0xccb2('0x36')]['id']){delete _0x505814[_0xccb2('0x36')]['id'];}return db[_0xccb2('0x19')][_0xccb2('0x34')]({'where':{'id':_0x505814[_0xccb2('0x37')]['id']}})[_0xccb2('0xf')](handleEntityNotFound(_0x21ef10,null))['then'](saveUpdates(_0x505814[_0xccb2('0x36')],null))[_0xccb2('0xf')](respondWithResult(_0x21ef10,null))[_0xccb2('0x30')](handleError(_0x21ef10,null));};exports['destroy']=function(_0x2d66b8,_0x4655be){return db[_0xccb2('0x19')][_0xccb2('0x34')]({'where':{'id':_0x2d66b8[_0xccb2('0x37')]['id']}})[_0xccb2('0xf')](handleEntityNotFound(_0x4655be,null))['then'](removeEntity(_0x4655be,null))[_0xccb2('0x30')](handleError(_0x4655be,null));};exports[_0xccb2('0x38')]=function(_0x199397,_0x439a11){var _0x2bfd={};var _0x11d87d={};var _0x1634bb;var _0x3f2876;return db[_0xccb2('0x19')][_0xccb2('0x39')]({'where':{'id':_0x199397[_0xccb2('0x37')]['id']}})[_0xccb2('0xf')](handleEntityNotFound(_0x439a11,null))[_0xccb2('0xf')](function(_0x54b1ef){if(_0x54b1ef){_0x1634bb=_0x54b1ef;_0x11d87d[_0xccb2('0x1d')]=_[_0xccb2('0x1f')](db['Dynamics365Configuration'][_0xccb2('0x1a')]);_0x11d87d[_0xccb2('0x1e')]=_[_0xccb2('0x1f')](_0x199397[_0xccb2('0x1e')]);_0x11d87d[_0xccb2('0x20')]=_[_0xccb2('0x21')](_0x11d87d['model'],_0x11d87d[_0xccb2('0x1e')]);_0x2bfd[_0xccb2('0x22')]=_[_0xccb2('0x21')](_0x11d87d[_0xccb2('0x1d')],qs['fields'](_0x199397['query'][_0xccb2('0x23')]));_0x2bfd[_0xccb2('0x22')]=_0x2bfd[_0xccb2('0x22')]['length']?_0x2bfd[_0xccb2('0x22')]:_0x11d87d[_0xccb2('0x1d')];_0x2bfd['order']=qs[_0xccb2('0x25')](_0x199397[_0xccb2('0x1e')][_0xccb2('0x25')]);_0x2bfd[_0xccb2('0x26')]=qs[_0xccb2('0x20')](_[_0xccb2('0x27')](_0x199397['query'],_0x11d87d[_0xccb2('0x20')]));if(_0x199397['query'][_0xccb2('0x28')]){_0x2bfd['where']=_[_0xccb2('0x29')](_0x2bfd[_0xccb2('0x26')],{'$or':_[_0xccb2('0x18')](_0x2bfd[_0xccb2('0x22')],function(_0x44bd5f){var _0x4b7912={};_0x4b7912[_0x44bd5f]={'$like':'%'+_0x199397['query'][_0xccb2('0x28')]+'%'};return _0x4b7912;})});}_0x2bfd=_[_0xccb2('0x29')]({},_0x2bfd,_0x199397[_0xccb2('0x2c')]);return _0x1634bb[_0xccb2('0x38')](_0x2bfd);}})['then'](function(_0x271077){if(_0x271077){_0x3f2876=_0x271077['length'];if(!_0x199397['query'][_0xccb2('0x3a')](_0xccb2('0x3b'))){_0x2bfd[_0xccb2('0xa')]=qs[_0xccb2('0xa')](_0x199397[_0xccb2('0x1e')][_0xccb2('0xa')]);_0x2bfd['offset']=qs['offset'](_0x199397['query'][_0xccb2('0x8')]);}return _0x1634bb[_0xccb2('0x38')](_0x2bfd);}})[_0xccb2('0xf')](function(_0x409a5a){if(_0x409a5a){return _0x409a5a?{'count':_0x3f2876,'rows':_0x409a5a}:null;}})[_0xccb2('0xf')](respondWithResult(_0x439a11,null))[_0xccb2('0x30')](handleError(_0x439a11,null));};exports[_0xccb2('0x3c')]=function(_0x2b47ce,_0x29237d){if(_0x2b47ce[_0xccb2('0x36')]['id']){delete _0x2b47ce[_0xccb2('0x36')]['id'];}return db['Dynamics365Account'][_0xccb2('0x39')]({'where':{'id':_0x2b47ce[_0xccb2('0x37')]['id']}})[_0xccb2('0xf')](handleEntityNotFound(_0x29237d,null))[_0xccb2('0xf')](function(_0x525e8d){if(_0x525e8d){_0x2b47ce[_0xccb2('0x36')][_0xccb2('0x3d')]=_0x525e8d['id'];_0x2b47ce[_0xccb2('0x36')][_0xccb2('0x3e')]=integrations['getSubjects'](_0x2b47ce[_0xccb2('0x36')]['channel'],_0x2b47ce[_0xccb2('0x36')]['type']);_0x2b47ce[_0xccb2('0x36')]['Descriptions']=integrations[_0xccb2('0x3f')](_0x2b47ce[_0xccb2('0x36')]['channel'],_0x2b47ce[_0xccb2('0x36')][_0xccb2('0x2a')]);return db[_0xccb2('0x40')]['create'](_0x2b47ce[_0xccb2('0x36')],{'include':[{'model':db[_0xccb2('0x41')],'as':_0xccb2('0x3e')},{'model':db[_0xccb2('0x41')],'as':_0xccb2('0x42')}]});}return null;})['then'](respondWithResult(_0x29237d,null))['catch'](handleError(_0x29237d,null));};function sanitizeRemoteUri(_0x51c20b){var _0x1940fa=_0x51c20b[_0xccb2('0x43')](-0x1);if(_0x1940fa==='/')return _0x51c20b['substring'](0x0,_0x51c20b[_0xccb2('0x44')](_0x1940fa));return _0x51c20b;}function getWebApiUrl(_0x56032c){return util[_0xccb2('0x45')](_0xccb2('0x46'),_0x56032c);}exports[_0xccb2('0x47')]=function(_0x4d6299,_0x1db09a){var _0x5cf1a7=_0x4d6299[_0xccb2('0x1e')]['ticketType'];var _0x34c5d3=_0x5cf1a7===_0xccb2('0x48')?_0xccb2('0x49'):'PhoneCall';var _0x5f2ad7='';var _0x3a334f='';var _0x16ee39='';var _0x503532='';var _0x4b0de1='';var _0x1fb804='';var _0x262240='';var _0x16f311='';var _0x3319bc=['title','description',_0xccb2('0x4a'),_0xccb2('0x4b'),_0xccb2('0x4c'),'subject',_0xccb2('0x4d'),_0xccb2('0x4e'),_0xccb2('0x4f'),_0xccb2('0x50')];var _0x487ab3=['accountidname',_0xccb2('0x51'),_0xccb2('0x52'),'billedserviceunits',_0xccb2('0x53'),'contactidyominame',_0xccb2('0x54'),'contractidname',_0xccb2('0x55'),_0xccb2('0x56'),_0xccb2('0x57'),_0xccb2('0x58'),_0xccb2('0x59'),'createdonbehalfbyname',_0xccb2('0x5a'),'customeridname',_0xccb2('0x5b'),_0xccb2('0x5c'),'emailaddress',_0xccb2('0x5d'),'entityimage_timestamp','entityimage_url',_0xccb2('0x5e'),_0xccb2('0x5f'),'firstresponsebykpiidname',_0xccb2('0x60'),_0xccb2('0x61'),'influencescore',_0xccb2('0x62'),'lastonholdtime',_0xccb2('0x63'),_0xccb2('0x64'),'modifiedbyexternalpartyyominame',_0xccb2('0x65'),_0xccb2('0x66'),_0xccb2('0x67'),_0xccb2('0x68'),'modifiedonbehalfbyyominame',_0xccb2('0x69'),_0xccb2('0x6a'),_0xccb2('0x6b'),_0xccb2('0x6c'),_0xccb2('0x6d'),'owneridname','owneridtype',_0xccb2('0x6e'),_0xccb2('0x6f'),'primarycontactidname','primarycontactidyominame',_0xccb2('0x70'),_0xccb2('0x71'),_0xccb2('0x72'),_0xccb2('0x73'),_0xccb2('0x74'),'responseby','responsiblecontactidname',_0xccb2('0x75'),_0xccb2('0x76'),_0xccb2('0x77'),'slaname',_0xccb2('0x78'),_0xccb2('0x79'),_0xccb2('0x7a'),_0xccb2('0x7b'),'ticketnumber',_0xccb2('0x7c'),'transactioncurrencyidname',_0xccb2('0x7d'),_0xccb2('0x7e'),'versionnumber'];var _0x43549e=_0x3319bc[_0xccb2('0x7f')](_0x487ab3);return db[_0xccb2('0x19')][_0xccb2('0x39')]({'where':{'id':_0x4d6299[_0xccb2('0x37')]['id']},'attributes':['id',_0xccb2('0x80'),_0xccb2('0x81'),_0xccb2('0x82'),_0xccb2('0x83'),_0xccb2('0x84'),_0xccb2('0x85'),'modernAuthentication'],'include':[{'model':db[_0xccb2('0x86')],'as':_0xccb2('0x86'),'attributes':['id',_0xccb2('0x87'),_0xccb2('0x88')]}]})['then'](handleEntityNotFound(_0x1db09a,null))[_0xccb2('0xf')](function(_0x78ef9b){if(_0x78ef9b){if(_0x78ef9b['modernAuthentication']){_0x78ef9b[_0xccb2('0x89')]=_0x78ef9b[_0xccb2('0x86')]['data5'];_0x16f311=sanitizeRemoteUri(_0x78ef9b[_0xccb2('0x86')][_0xccb2('0x88')]);_0x262240=getWebApiUrl(_0x16f311);return _0x78ef9b;}_0x16f311=sanitizeRemoteUri(_0x78ef9b[_0xccb2('0x82')]);_0x262240=getWebApiUrl(_0x16f311);var _0x1917bf={'method':_0xccb2('0x8a'),'uri':'https://login.microsoftonline.com/'+_0x78ef9b[_0xccb2('0x83')]+_0xccb2('0x8b'),'form':{'client_id':_0x78ef9b['clientId'],'resource':_0x16f311,'username':_0x78ef9b[_0xccb2('0x80')],'password':_0x78ef9b[_0xccb2('0x81')],'grant_type':'password','client_secret':_0x78ef9b['clientSecret']},'json':!![]};return rp(_0x1917bf);}})[_0xccb2('0xf')](function(_0x3a7a68){_0x1fb804=_0x3a7a68[_0xccb2('0x89')];var _0xcc9af3={'method':_0xccb2('0x8c'),'uri':encodeURI(_0x262240+_0xccb2('0x8d')+_0x34c5d3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1fb804,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xcc9af3);})[_0xccb2('0xf')](function(_0x2bff85){var _0x36d18f=_0x2bff85[_0xccb2('0x8e')][0x0];var _0x722ab3=_0x36d18f[_0xccb2('0x8f')];var _0x5cec7b={'method':_0xccb2('0x8c'),'uri':_0x262240+_0xccb2('0x90')+_0x722ab3+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xccb2('0x91')+_0x1fb804,'If-None-Match':null,'OData-Version':_0xccb2('0x92')},'json':!![]};return rp(_0x5cec7b);})[_0xccb2('0xf')](function(_0x21037b){_0x5f2ad7=_0x21037b;_0x3a334f=_0x5f2ad7[_0xccb2('0x93')];_0x3a334f=_['remove'](_0x3a334f,function(_0x377061){return!_0x43549e[_0xccb2('0x94')](_0x377061[_0xccb2('0x95')]);});var _0x214d5e=[];var _0x37451a=[];_0x3a334f['forEach'](function(_0x50f105){if(_0x50f105['@odata.type']){var _0xbf0eff=_0x50f105[_0xccb2('0x96')]['substring'](_0x50f105[_0xccb2('0x96')][_0xccb2('0x44')]('.')+0x1);if(_0xbf0eff==='PicklistAttributeMetadata'){_0x214d5e['push'](getSelectList(_0x262240,_0x5cf1a7,_0x37451a,_0x5f2ad7[_0xccb2('0x8f')],_0x50f105[_0xccb2('0x8f')],_0x1fb804));}}});return Promise[_0xccb2('0x97')](_0x214d5e);})[_0xccb2('0xf')](function(_0x25da49){_0x16ee39=_0x25da49[0x0];var _0x1bd420=[];var _0x7fb56=[];_0x3a334f[_0xccb2('0x98')](function(_0x3581ba){if(!_[_0xccb2('0x99')](_0x3581ba[_0xccb2('0x96')])){var _0x3551c2=_0x3581ba[_0xccb2('0x96')][_0xccb2('0x9a')](_0x3581ba[_0xccb2('0x96')]['lastIndexOf']('.')+0x1);if(_0x3551c2===_0xccb2('0x9b')){_0x1bd420[_0xccb2('0x9c')](getBooleanList(_0x262240,_0x5cf1a7,_0x7fb56,_0x5f2ad7[_0xccb2('0x8f')],_0x3581ba[_0xccb2('0x8f')],_0x1fb804));}}});return Promise[_0xccb2('0x97')](_0x1bd420);})[_0xccb2('0xf')](function(_0x22987a){_0x503532=_0x22987a[0x0];var _0xa7f28b=[];var _0x46d3d6=[];_0x3a334f[_0xccb2('0x98')](function(_0x168cb0){if(_0x168cb0[_0xccb2('0x96')]){var _0x5d6fab=_0x168cb0[_0xccb2('0x96')][_0xccb2('0x9a')](_0x168cb0[_0xccb2('0x96')][_0xccb2('0x44')]('.')+0x1);if(_0x5d6fab===_0xccb2('0x9d')||_0x5d6fab===_0xccb2('0x9e')||_0x5d6fab===_0xccb2('0x9f')||_0x5d6fab===_0xccb2('0xa0')||_0x5d6fab==='MemoAttributeMetadata'||_0x5d6fab===_0xccb2('0xa1')||_0x5d6fab===_0xccb2('0xa2')||_0x5d6fab===_0xccb2('0xa3')||_0x5d6fab===_0xccb2('0xa4')||_0x5d6fab==='DecimalAttributeMetadata'){_0xa7f28b[_0xccb2('0x9c')](getInputList(_0x262240,_0x5cf1a7,_0x5d6fab,_0x46d3d6,_0x5f2ad7[_0xccb2('0x8f')],_0x168cb0[_0xccb2('0x8f')],_0x1fb804));}}});return Promise[_0xccb2('0x97')](_0xa7f28b);})['then'](function(_0x3b3742){_0x4b0de1=_0x3b3742[0x0];var _0x1e36b7=_0x16ee39[_0xccb2('0x7f')](_0x503532)['concat'](_0x4b0de1);var _0x277202={'count':_0x1e36b7['length'],'rows':_0x1e36b7};return _0x277202;})['then'](respondWithResult(_0x1db09a,null))[_0xccb2('0x30')](function(_0xef3910){var _0x2ae44f=_0x4d6299[_0xccb2('0x1e')]['test']?0x1f4:_0xef3910[_0xccb2('0xa5')]||0x1f4;logger[_0xccb2('0x13')](_0xef3910[_0xccb2('0x14')]);delete _0xef3910[_0xccb2('0x15')];if(_0x2ae44f===0x191){_0x2ae44f=0x190;}_0x1db09a[_0xccb2('0x7')](_0x2ae44f)['send'](_0x4d6299[_0xccb2('0x1e')][_0xccb2('0xa6')]?{'message':_0xccb2('0xa7'),'statusCode':_0xef3910[_0xccb2('0xa5')]}:_0xef3910);});};function getSelectList(_0x4770d2,_0x372565,_0x579dbf,_0x33af5a,_0x450697,_0x5df4e2){var _0x2ce292={'method':_0xccb2('0x8c'),'uri':_0x4770d2+_0xccb2('0x90')+_0x33af5a+_0xccb2('0xa8')+_0x450697+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xccb2('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x5df4e2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2ce292)[_0xccb2('0xf')](function(_0x42658e){var _0x1b25b1=[];var _0x599b22=_0x42658e[_0xccb2('0xaa')][_0xccb2('0xab')];_0x599b22[_0xccb2('0x98')](function(_0x13d59c){_0x1b25b1[_0xccb2('0x9c')]({'name':_0x13d59c[_0xccb2('0xac')][_0xccb2('0xad')][_0xccb2('0xac')],'value':String(_0x13d59c['Value'])});});var _0x3d057b={'id':_0x372565+'_'+_0x42658e['LogicalName'],'name':_0x42658e[_0xccb2('0xae')]['UserLocalizedLabel'][_0xccb2('0xac')],'custom':![],'options':_0x1b25b1};_0x579dbf['push'](_0x3d057b);return _0x579dbf;});}function getBooleanList(_0xb289c1,_0x2b0574,_0x26bb60,_0x4e69f2,_0x14f8d0,_0xef42d8){var _0x371ce8={'method':_0xccb2('0x8c'),'uri':_0xb289c1+_0xccb2('0x90')+_0x4e69f2+_0xccb2('0xa8')+_0x14f8d0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xccb2('0x91')+_0xef42d8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x371ce8)['then'](function(_0x5990d6){var _0x45219c=[];_0x45219c[_0xccb2('0x9c')]({'name':_0x5990d6['OptionSet'][_0xccb2('0xaf')][_0xccb2('0xac')][_0xccb2('0xad')][_0xccb2('0xac')],'value':_0xccb2('0xb0')},{'name':_0x5990d6[_0xccb2('0xaa')]['FalseOption']['Label'][_0xccb2('0xad')][_0xccb2('0xac')],'value':_0xccb2('0xb1')});var _0x4013d7={'id':_0x2b0574+'_'+_0x5990d6[_0xccb2('0x95')],'name':_0x5990d6['DisplayName'][_0xccb2('0xad')][_0xccb2('0xac')],'custom':![],'options':_0x45219c};_0x26bb60[_0xccb2('0x9c')](_0x4013d7);return _0x26bb60;});}function getInputList(_0x2ecceb,_0x483dae,_0x540e12,_0x363efc,_0x1f0a39,_0xcc4734,_0x2e811e){var _0x470130={'method':_0xccb2('0x8c'),'uri':_0x2ecceb+_0xccb2('0x90')+_0x1f0a39+_0xccb2('0xa8')+_0xcc4734+_0xccb2('0xb2')+_0x540e12+_0xccb2('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x2e811e,'If-None-Match':null,'OData-Version':_0xccb2('0x92')},'json':!![]};return rp(_0x470130)[_0xccb2('0xf')](function(_0x5d6aed){var _0x5bc954={'id':_0x483dae+'_'+_0x5d6aed[_0xccb2('0x95')],'name':_0x5d6aed[_0xccb2('0xae')][_0xccb2('0xad')]?_0x5d6aed[_0xccb2('0xae')]['UserLocalizedLabel'][_0xccb2('0xac')]:_0x5d6aed[_0xccb2('0x95')],'custom':![],'options':[]};_0x363efc[_0xccb2('0x9c')](_0x5bc954);return _0x363efc;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 41963b7..1dc446a 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(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x3675ed,_0x3162fa){var _0x738c56=function(_0x1c1ec0){while(--_0x1c1ec0){_0x3675ed['push'](_0x3675ed['shift']());}};_0x738c56(++_0x3162fa);}(_0xe706,0xa3));var _0x6e70=function(_0xbafd5f,_0x27cabb){_0xbafd5f=_0xbafd5f-0x0;var _0x148fad=_0xe706[_0xbafd5f];return _0x148fad;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 01deb15..9c2835e 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 _0x95a0=['where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','then','ShowDynamics365Account','find'];(function(_0x17d6ba,_0x415684){var _0x492b47=function(_0x4deee0){while(--_0x4deee0){_0x17d6ba['push'](_0x17d6ba['shift']());}};_0x492b47(++_0x415684);}(_0x95a0,0x17d));var _0x095a=function(_0x34d6f2,_0x353d28){_0x34d6f2=_0x34d6f2-0x0;var _0x6996d=_0x95a0[_0x34d6f2];return _0x6996d;};'use strict';var _=require(_0x095a('0x0'));var util=require(_0x095a('0x1'));var moment=require(_0x095a('0x2'));var BPromise=require(_0x095a('0x3'));var rs=require(_0x095a('0x4'));var fs=require('fs');var Redis=require(_0x095a('0x5'));var db=require(_0x095a('0x6'))['db'];var utils=require(_0x095a('0x7'));var logger=require('../../config/logger')(_0x095a('0x8'));var config=require(_0x095a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x095a('0xa')][_0x095a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd5ce28,_0x51d111,_0x36ba81){return new BPromise(function(_0x141943,_0x232312){return client[_0x095a('0xc')](_0xd5ce28,_0x36ba81)['then'](function(_0x5c9564){logger[_0x095a('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x51d111,_0x095a('0xe'));logger[_0x095a('0xf')](_0x095a('0x10'),_0x51d111,_0x095a('0xe'),JSON[_0x095a('0x11')](_0x5c9564));if(_0x5c9564[_0x095a('0x12')]){if(_0x5c9564[_0x095a('0x12')][_0x095a('0x13')]===0x1f4){logger[_0x095a('0x12')](_0x095a('0x14'),_0x51d111,_0x5c9564['error'][_0x095a('0x15')]);return _0x232312(_0x5c9564[_0x095a('0x12')][_0x095a('0x15')]);}logger[_0x095a('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x51d111,_0x5c9564[_0x095a('0x12')]['message']);return _0x141943(_0x5c9564[_0x095a('0x12')][_0x095a('0x15')]);}else{logger[_0x095a('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x51d111,_0x095a('0xe'));_0x141943(_0x5c9564[_0x095a('0x16')][_0x095a('0x15')]);}})[_0x095a('0x17')](function(_0x241ea0){logger[_0x095a('0x12')](_0x095a('0x14'),_0x51d111,_0x241ea0);_0x232312(_0x241ea0);});});}exports[_0x095a('0x18')]=function(_0xd00d3d){var _0x3d79c0=this;return new Promise(function(_0x3bf966,_0x32e27a){return db[_0x095a('0x19')][_0x095a('0x1a')]({'raw':_0xd00d3d[_0x095a('0x1b')]?_0xd00d3d[_0x095a('0x1b')][_0x095a('0x1c')]===undefined?!![]:![]:!![],'where':_0xd00d3d['options']?_0xd00d3d[_0x095a('0x1b')]['where']||null:null,'attributes':_0xd00d3d[_0x095a('0x1b')]?_0xd00d3d[_0x095a('0x1b')][_0x095a('0x1d')]||null:null,'limit':_0xd00d3d[_0x095a('0x1b')]?_0xd00d3d[_0x095a('0x1b')][_0x095a('0x1e')]||null:null,'include':_0xd00d3d[_0x095a('0x1b')]?_0xd00d3d[_0x095a('0x1b')][_0x095a('0x1f')]?_[_0x095a('0x20')](_0xd00d3d[_0x095a('0x1b')][_0x095a('0x1f')],function(_0x40bf4d){return{'model':db[_0x40bf4d[_0x095a('0x21')]],'as':_0x40bf4d['as'],'attributes':_0x40bf4d[_0x095a('0x1d')],'include':_0x40bf4d[_0x095a('0x1f')]?_[_0x095a('0x20')](_0x40bf4d[_0x095a('0x1f')],function(_0x4dd31e){return{'model':db[_0x4dd31e[_0x095a('0x21')]],'as':_0x4dd31e['as'],'attributes':_0x4dd31e[_0x095a('0x1d')],'include':_0x4dd31e['include']?_['map'](_0x4dd31e['include'],function(_0xcd8a8b){return{'model':db[_0xcd8a8b[_0x095a('0x21')]],'as':_0xcd8a8b['as'],'attributes':_0xcd8a8b[_0x095a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x095a('0x22')](function(_0x23500d){logger[_0x095a('0xd')](_0x095a('0x18'),_0xd00d3d);logger['debug'](_0x095a('0x18'),_0xd00d3d,JSON[_0x095a('0x11')](_0x23500d));_0x3bf966(_0x23500d);})[_0x095a('0x17')](function(_0x332d70){logger[_0x095a('0x12')](_0x095a('0x18'),_0x332d70[_0x095a('0x15')],_0xd00d3d);_0x32e27a(_0x3d79c0[_0x095a('0x12')](0x1f4,_0x332d70[_0x095a('0x15')]));});});};exports[_0x095a('0x23')]=function(_0x10dfb0){var _0x37c087=this;return new Promise(function(_0x3c44bd,_0x1295c9){return db[_0x095a('0x19')][_0x095a('0x24')]({'raw':_0x10dfb0[_0x095a('0x1b')]?_0x10dfb0[_0x095a('0x1b')][_0x095a('0x1c')]===undefined?!![]:![]:!![],'where':_0x10dfb0[_0x095a('0x1b')]?_0x10dfb0['options'][_0x095a('0x25')]||null:null,'attributes':_0x10dfb0[_0x095a('0x1b')]?_0x10dfb0[_0x095a('0x1b')][_0x095a('0x1d')]||null:null,'include':_0x10dfb0[_0x095a('0x1b')]?_0x10dfb0[_0x095a('0x1b')][_0x095a('0x1f')]?_['map'](_0x10dfb0[_0x095a('0x1b')][_0x095a('0x1f')],function(_0x359d4f){return{'model':db[_0x359d4f['model']],'as':_0x359d4f['as'],'attributes':_0x359d4f['attributes'],'include':_0x359d4f['include']?_[_0x095a('0x20')](_0x359d4f['include'],function(_0x16e951){return{'model':db[_0x16e951[_0x095a('0x21')]],'as':_0x16e951['as'],'attributes':_0x16e951[_0x095a('0x1d')],'include':_0x16e951['include']?_[_0x095a('0x20')](_0x16e951[_0x095a('0x1f')],function(_0x12650a){return{'model':db[_0x12650a[_0x095a('0x21')]],'as':_0x12650a['as'],'attributes':_0x12650a['attributes']};}):[]};}):[]};}):[]:[]})[_0x095a('0x22')](function(_0x1d00c1){logger['info'](_0x095a('0x23'),_0x10dfb0);logger[_0x095a('0xf')](_0x095a('0x23'),_0x10dfb0,JSON[_0x095a('0x11')](_0x1d00c1));_0x3c44bd(_0x1d00c1);})[_0x095a('0x17')](function(_0x346c56){logger[_0x095a('0x12')](_0x095a('0x23'),_0x346c56[_0x095a('0x15')],_0x10dfb0);_0x1295c9(_0x37c087[_0x095a('0x12')](0x1f4,_0x346c56[_0x095a('0x15')]));});});}; \ No newline at end of file +var _0x6fe0=['error','message','Dynamics365Account,\x20%s,\x20%s','catch','findAll','options','raw','where','attributes','limit','map','model','include','GetDynamics365Account','stringify','ShowDynamics365Account','Dynamics365Account','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x51bdda,_0x5666ca){var _0x998aab=function(_0x3f4029){while(--_0x3f4029){_0x51bdda['push'](_0x51bdda['shift']());}};_0x998aab(++_0x5666ca);}(_0x6fe0,0xa2));var _0x06fe=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x6fe0[_0x44afa4];return _0xcad289;};'use strict';var _=require('lodash');var util=require(_0x06fe('0x0'));var moment=require(_0x06fe('0x1'));var BPromise=require('bluebird');var rs=require(_0x06fe('0x2'));var fs=require('fs');var Redis=require(_0x06fe('0x3'));var db=require(_0x06fe('0x4'))['db'];var utils=require(_0x06fe('0x5'));var logger=require(_0x06fe('0x6'))(_0x06fe('0x7'));var config=require(_0x06fe('0x8'));var jayson=require(_0x06fe('0x9'));var client=jayson[_0x06fe('0xa')][_0x06fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b6501,_0x40336a,_0x4dc267){return new BPromise(function(_0x3b2971,_0x65c925){return client[_0x06fe('0xc')](_0x5b6501,_0x4dc267)[_0x06fe('0xd')](function(_0x3c0cf5){logger[_0x06fe('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x40336a,_0x06fe('0xf'));logger[_0x06fe('0x10')](_0x06fe('0x11'),_0x40336a,_0x06fe('0xf'),JSON['stringify'](_0x3c0cf5));if(_0x3c0cf5[_0x06fe('0x12')]){if(_0x3c0cf5[_0x06fe('0x12')]['code']===0x1f4){logger[_0x06fe('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x40336a,_0x3c0cf5[_0x06fe('0x12')][_0x06fe('0x13')]);return _0x65c925(_0x3c0cf5['error'][_0x06fe('0x13')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x40336a,_0x3c0cf5[_0x06fe('0x12')][_0x06fe('0x13')]);return _0x3b2971(_0x3c0cf5[_0x06fe('0x12')][_0x06fe('0x13')]);}else{logger[_0x06fe('0xe')](_0x06fe('0x14'),_0x40336a,'request\x20sent');_0x3b2971(_0x3c0cf5['result']['message']);}})[_0x06fe('0x15')](function(_0xe63d00){logger[_0x06fe('0x12')](_0x06fe('0x14'),_0x40336a,_0xe63d00);_0x65c925(_0xe63d00);});});}exports['GetDynamics365Account']=function(_0x45269e){var _0x55460f=this;return new Promise(function(_0x118e5d,_0x4f9102){return db['Dynamics365Account'][_0x06fe('0x16')]({'raw':_0x45269e[_0x06fe('0x17')]?_0x45269e[_0x06fe('0x17')][_0x06fe('0x18')]===undefined?!![]:![]:!![],'where':_0x45269e[_0x06fe('0x17')]?_0x45269e[_0x06fe('0x17')][_0x06fe('0x19')]||null:null,'attributes':_0x45269e[_0x06fe('0x17')]?_0x45269e[_0x06fe('0x17')][_0x06fe('0x1a')]||null:null,'limit':_0x45269e[_0x06fe('0x17')]?_0x45269e[_0x06fe('0x17')][_0x06fe('0x1b')]||null:null,'include':_0x45269e[_0x06fe('0x17')]?_0x45269e['options']['include']?_[_0x06fe('0x1c')](_0x45269e[_0x06fe('0x17')]['include'],function(_0x16a84c){return{'model':db[_0x16a84c[_0x06fe('0x1d')]],'as':_0x16a84c['as'],'attributes':_0x16a84c[_0x06fe('0x1a')],'include':_0x16a84c[_0x06fe('0x1e')]?_[_0x06fe('0x1c')](_0x16a84c[_0x06fe('0x1e')],function(_0x4ce9b5){return{'model':db[_0x4ce9b5['model']],'as':_0x4ce9b5['as'],'attributes':_0x4ce9b5[_0x06fe('0x1a')],'include':_0x4ce9b5['include']?_[_0x06fe('0x1c')](_0x4ce9b5[_0x06fe('0x1e')],function(_0x49dfee){return{'model':db[_0x49dfee['model']],'as':_0x49dfee['as'],'attributes':_0x49dfee['attributes']};}):[]};}):[]};}):[]:[]})[_0x06fe('0xd')](function(_0xe74453){logger[_0x06fe('0xe')]('GetDynamics365Account',_0x45269e);logger[_0x06fe('0x10')](_0x06fe('0x1f'),_0x45269e,JSON[_0x06fe('0x20')](_0xe74453));_0x118e5d(_0xe74453);})[_0x06fe('0x15')](function(_0x427d46){logger[_0x06fe('0x12')](_0x06fe('0x1f'),_0x427d46[_0x06fe('0x13')],_0x45269e);_0x4f9102(_0x55460f[_0x06fe('0x12')](0x1f4,_0x427d46[_0x06fe('0x13')]));});});};exports[_0x06fe('0x21')]=function(_0x40bcb4){var _0x212a3d=this;return new Promise(function(_0x493388,_0x21a479){return db[_0x06fe('0x22')][_0x06fe('0x23')]({'raw':_0x40bcb4[_0x06fe('0x17')]?_0x40bcb4[_0x06fe('0x17')][_0x06fe('0x18')]===undefined?!![]:![]:!![],'where':_0x40bcb4[_0x06fe('0x17')]?_0x40bcb4[_0x06fe('0x17')][_0x06fe('0x19')]||null:null,'attributes':_0x40bcb4[_0x06fe('0x17')]?_0x40bcb4[_0x06fe('0x17')][_0x06fe('0x1a')]||null:null,'include':_0x40bcb4[_0x06fe('0x17')]?_0x40bcb4[_0x06fe('0x17')][_0x06fe('0x1e')]?_[_0x06fe('0x1c')](_0x40bcb4['options'][_0x06fe('0x1e')],function(_0x22384b){return{'model':db[_0x22384b[_0x06fe('0x1d')]],'as':_0x22384b['as'],'attributes':_0x22384b['attributes'],'include':_0x22384b[_0x06fe('0x1e')]?_['map'](_0x22384b[_0x06fe('0x1e')],function(_0x57389d){return{'model':db[_0x57389d[_0x06fe('0x1d')]],'as':_0x57389d['as'],'attributes':_0x57389d[_0x06fe('0x1a')],'include':_0x57389d[_0x06fe('0x1e')]?_[_0x06fe('0x1c')](_0x57389d[_0x06fe('0x1e')],function(_0x189b1c){return{'model':db[_0x189b1c[_0x06fe('0x1d')]],'as':_0x189b1c['as'],'attributes':_0x189b1c[_0x06fe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x06fe('0xd')](function(_0x8ddd20){logger[_0x06fe('0xe')](_0x06fe('0x21'),_0x40bcb4);logger[_0x06fe('0x10')](_0x06fe('0x21'),_0x40bcb4,JSON[_0x06fe('0x20')](_0x8ddd20));_0x493388(_0x8ddd20);})[_0x06fe('0x15')](function(_0x39693e){logger['error'](_0x06fe('0x21'),_0x39693e[_0x06fe('0x13')],_0x40bcb4);_0x21a479(_0x212a3d[_0x06fe('0x12')](0x1f4,_0x39693e[_0x06fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ec66a20..a337c46 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 _0xc6d3=['post','create','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','getSubjects'];(function(_0x3a6ee1,_0x4de9fe){var _0xbe4556=function(_0x3ab5d0){while(--_0x3ab5d0){_0x3a6ee1['push'](_0x3a6ee1['shift']());}};_0xbe4556(++_0x4de9fe);}(_0xc6d3,0x1e4));var _0x3c6d=function(_0x446ebb,_0x296b3c){_0x446ebb=_0x446ebb-0x0;var _0x4e3671=_0xc6d3[_0x446ebb];return _0x4e3671;};'use strict';var multer=require(_0x3c6d('0x0'));var util=require(_0x3c6d('0x1'));var path=require(_0x3c6d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c6d('0x3'));var router=express[_0x3c6d('0x4')]();var fs_extra=require(_0x3c6d('0x5'));var auth=require(_0x3c6d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3c6d('0x7'));var controller=require(_0x3c6d('0x8'));router['get']('/',auth[_0x3c6d('0x9')](),controller[_0x3c6d('0xa')]);router['get'](_0x3c6d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3c6d('0xc')](_0x3c6d('0xd'),auth['isAuthenticated'](),controller[_0x3c6d('0xe')]);router[_0x3c6d('0xc')]('/:id/subjects',auth[_0x3c6d('0x9')](),controller[_0x3c6d('0xf')]);router[_0x3c6d('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3c6d('0x10')]('/',auth[_0x3c6d('0x9')](),controller[_0x3c6d('0x11')]);router['put'](_0x3c6d('0xb'),auth[_0x3c6d('0x9')](),controller['update']);router[_0x3c6d('0x12')](_0x3c6d('0xb'),auth[_0x3c6d('0x9')](),controller[_0x3c6d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9918=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2289e8,_0xb694c3){var _0x5a0e7b=function(_0x98d4aa){while(--_0x98d4aa){_0x2289e8['push'](_0x2289e8['shift']());}};_0x5a0e7b(++_0xb694c3);}(_0x9918,0x186));var _0x8991=function(_0xa0e1a7,_0x1be43b){_0xa0e1a7=_0xa0e1a7-0x0;var _0x40f6ee=_0x9918[_0xa0e1a7];return _0x40f6ee;};'use strict';var multer=require(_0x8991('0x0'));var util=require(_0x8991('0x1'));var path=require('path');var timeout=require(_0x8991('0x2'));var express=require(_0x8991('0x3'));var router=express[_0x8991('0x4')]();var fs_extra=require(_0x8991('0x5'));var auth=require(_0x8991('0x6'));var interaction=require(_0x8991('0x7'));var config=require(_0x8991('0x8'));var controller=require(_0x8991('0x9'));router[_0x8991('0xa')]('/',auth[_0x8991('0xb')](),controller[_0x8991('0xc')]);router[_0x8991('0xa')](_0x8991('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8991('0xe'),auth[_0x8991('0xb')](),controller['getFields']);router[_0x8991('0xa')](_0x8991('0xf'),auth[_0x8991('0xb')](),controller[_0x8991('0x10')]);router['get'](_0x8991('0x11'),auth[_0x8991('0xb')](),controller['getDescriptions']);router[_0x8991('0x12')]('/',auth[_0x8991('0xb')](),controller['create']);router['put'](_0x8991('0xd'),auth[_0x8991('0xb')](),controller['update']);router['delete'](_0x8991('0xd'),auth[_0x8991('0xb')](),controller[_0x8991('0x13')]);module[_0x8991('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d8e51c1..712655a 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 _0x84b0=['ENUM','contact','nothing','BOOLEAN','sequelize','exports','STRING','incident'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x84b0,0x10c));var _0x084b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x84b0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x084b('0x0'));module[_0x084b('0x1')]={'name':{'type':Sequelize[_0x084b('0x2')]},'description':{'type':Sequelize[_0x084b('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x084b('0x3'),'phonecall'),'defaultValue':_0x084b('0x3')},'moduleCreate':{'type':Sequelize[_0x084b('0x4')](_0x084b('0x5'),_0x084b('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x084b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x084b('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0412=['incident','phonecall','nothing','BOOLEAN','exports','STRING','ENUM'];(function(_0x144dcb,_0x5de51c){var _0x3ca850=function(_0x18f060){while(--_0x18f060){_0x144dcb['push'](_0x144dcb['shift']());}};_0x3ca850(++_0x5de51c);}(_0x0412,0x185));var _0x2041=function(_0x27a847,_0x4f8e5f){_0x27a847=_0x27a847-0x0;var _0x3c4e1d=_0x0412[_0x27a847];return _0x3c4e1d;};'use strict';var Sequelize=require('sequelize');module[_0x2041('0x0')]={'name':{'type':Sequelize[_0x2041('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2041('0x2')](_0x2041('0x3'),_0x2041('0x4')),'defaultValue':_0x2041('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x2041('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2041('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2041('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a88a433..eacbd89 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 _0x7eb5=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','Dynamics365Field','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x7eb5,0x154));var _0x57eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eb5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x57eb('0x0'));var rimraf=require(_0x57eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57eb('0x2'));var moment=require(_0x57eb('0x3'));var BPromise=require(_0x57eb('0x4'));var Mustache=require(_0x57eb('0x5'));var util=require(_0x57eb('0x6'));var path=require(_0x57eb('0x7'));var sox=require(_0x57eb('0x8'));var csv=require(_0x57eb('0x9'));var ejs=require(_0x57eb('0xa'));var fs=require('fs');var fs_extra=require(_0x57eb('0xb'));var _=require(_0x57eb('0xc'));var squel=require('squel');var crypto=require(_0x57eb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x57eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57eb('0xf'));var Papa=require('papaparse');var Redis=require(_0x57eb('0x10'));var authService=require(_0x57eb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x57eb('0x12'));var hardwareService=require(_0x57eb('0x13'));var logger=require('../../config/logger')(_0x57eb('0x14'));var utils=require('../../config/utils');var config=require(_0x57eb('0x15'));var licenseUtil=require(_0x57eb('0x16'));var db=require(_0x57eb('0x17'))['db'];function respondWithStatusCode(_0xf360d9,_0x264add){_0x264add=_0x264add||0xcc;return function(_0x4191eb){if(_0x4191eb){return _0xf360d9[_0x57eb('0x18')](_0x264add);}return _0xf360d9[_0x57eb('0x19')](_0x264add)[_0x57eb('0x1a')]();};}function respondWithResult(_0x351c20,_0x4ad9ee){_0x4ad9ee=_0x4ad9ee||0xc8;return function(_0x580c43){if(_0x580c43){return _0x351c20[_0x57eb('0x19')](_0x4ad9ee)['json'](_0x580c43);}};}function respondWithFilteredResult(_0x5608ea,_0x898c){return function(_0x48bed8){if(_0x48bed8){var _0x425f30=typeof _0x898c['offset']===_0x57eb('0x1b')&&typeof _0x898c[_0x57eb('0x1c')]===_0x57eb('0x1b');var _0x2506c1=_0x48bed8[_0x57eb('0x1d')];var _0x86436=_0x425f30?0x0:_0x898c['offset'];var _0x49563d=_0x425f30?_0x48bed8[_0x57eb('0x1d')]:_0x898c[_0x57eb('0x1e')]+_0x898c['limit'];var _0x2131c0;if(_0x49563d>=_0x2506c1){_0x49563d=_0x2506c1;_0x2131c0=0xc8;}else{_0x2131c0=0xce;}_0x5608ea[_0x57eb('0x19')](_0x2131c0);return _0x5608ea['set'](_0x57eb('0x1f'),_0x86436+'-'+_0x49563d+'/'+_0x2506c1)['json'](_0x48bed8);}return null;};}function patchUpdates(_0x266fb3){return function(_0x32c265){try{jsonpatch[_0x57eb('0x20')](_0x32c265,_0x266fb3,!![]);}catch(_0x55dbe2){return BPromise[_0x57eb('0x21')](_0x55dbe2);}return _0x32c265[_0x57eb('0x22')]();};}function saveUpdates(_0x23150d,_0xba623b){return function(_0x45bd51){if(_0x45bd51){return _0x45bd51[_0x57eb('0x23')](_0x23150d)[_0x57eb('0x24')](function(_0x498642){return _0x498642;});}return null;};}function removeEntity(_0x281173,_0x3a1d33){return function(_0xea1881){if(_0xea1881){return _0xea1881[_0x57eb('0x25')]()['then'](function(){_0x281173[_0x57eb('0x19')](0xcc)[_0x57eb('0x1a')]();});}};}function handleEntityNotFound(_0x9eb7c9,_0x9d1857){return function(_0x2b7987){if(!_0x2b7987){_0x9eb7c9[_0x57eb('0x18')](0x194);}return _0x2b7987;};}function handleError(_0x1ba38d,_0x188c23){_0x188c23=_0x188c23||0x1f4;return function(_0x39493d){logger['error'](_0x39493d[_0x57eb('0x26')]);if(_0x39493d['name']){delete _0x39493d[_0x57eb('0x27')];}_0x1ba38d['status'](_0x188c23)[_0x57eb('0x28')](_0x39493d);};}exports[_0x57eb('0x29')]=function(_0xb6f85f,_0xadc798){var _0x32835d={},_0x2c8a75={},_0x429551={'count':0x0,'rows':[]};var _0x2b0012=_[_0x57eb('0x2a')](db[_0x57eb('0x2b')][_0x57eb('0x2c')],function(_0x3febee){return{'name':_0x3febee[_0x57eb('0x2d')],'type':_0x3febee['type'][_0x57eb('0x2e')]};});_0x2c8a75[_0x57eb('0x2f')]=_[_0x57eb('0x2a')](_0x2b0012,_0x57eb('0x27'));_0x2c8a75[_0x57eb('0x30')]=_[_0x57eb('0x31')](_0xb6f85f[_0x57eb('0x30')]);_0x2c8a75[_0x57eb('0x32')]=_['intersection'](_0x2c8a75[_0x57eb('0x2f')],_0x2c8a75[_0x57eb('0x30')]);_0x32835d[_0x57eb('0x33')]=_[_0x57eb('0x34')](_0x2c8a75['model'],qs[_0x57eb('0x35')](_0xb6f85f[_0x57eb('0x30')][_0x57eb('0x35')]));_0x32835d[_0x57eb('0x33')]=_0x32835d['attributes'][_0x57eb('0x36')]?_0x32835d[_0x57eb('0x33')]:_0x2c8a75[_0x57eb('0x2f')];if(!_0xb6f85f['query'][_0x57eb('0x37')](_0x57eb('0x38'))){_0x32835d[_0x57eb('0x1c')]=qs['limit'](_0xb6f85f['query'][_0x57eb('0x1c')]);_0x32835d[_0x57eb('0x1e')]=qs[_0x57eb('0x1e')](_0xb6f85f[_0x57eb('0x30')][_0x57eb('0x1e')]);}_0x32835d[_0x57eb('0x39')]=qs[_0x57eb('0x3a')](_0xb6f85f[_0x57eb('0x30')][_0x57eb('0x3a')]);_0x32835d[_0x57eb('0x3b')]=qs[_0x57eb('0x32')](_['pick'](_0xb6f85f[_0x57eb('0x30')],_0x2c8a75['filters']),_0x2b0012);if(_0xb6f85f['query'][_0x57eb('0x3c')]){_0x32835d['where']=_[_0x57eb('0x3d')](_0x32835d[_0x57eb('0x3b')],{'$or':_[_0x57eb('0x2a')](_0x2b0012,function(_0x2570c7){if(_0x2570c7['type']!==_0x57eb('0x3e')){var _0x1adbe4={};_0x1adbe4[_0x2570c7['name']]={'$like':'%'+_0xb6f85f[_0x57eb('0x30')][_0x57eb('0x3c')]+'%'};return _0x1adbe4;}})});}_0x32835d=_[_0x57eb('0x3d')]({},_0x32835d,_0xb6f85f[_0x57eb('0x3f')]);var _0x11cc91={'where':_0x32835d[_0x57eb('0x3b')]};return db[_0x57eb('0x2b')]['count'](_0x11cc91)[_0x57eb('0x24')](function(_0x594a55){_0x429551[_0x57eb('0x1d')]=_0x594a55;if(_0xb6f85f[_0x57eb('0x30')][_0x57eb('0x40')]){_0x32835d[_0x57eb('0x41')]=[{'all':!![]}];}return db[_0x57eb('0x2b')][_0x57eb('0x42')](_0x32835d);})[_0x57eb('0x24')](function(_0x3033b9){_0x429551[_0x57eb('0x43')]=_0x3033b9;return _0x429551;})[_0x57eb('0x24')](respondWithFilteredResult(_0xadc798,_0x32835d))[_0x57eb('0x44')](handleError(_0xadc798,null));};exports[_0x57eb('0x45')]=function(_0x158681,_0x34cffc){var _0x5bba5f={'raw':![],'where':{'id':_0x158681[_0x57eb('0x46')]['id']}},_0x19dcc7={};_0x19dcc7[_0x57eb('0x2f')]=_['keys'](db['Dynamics365Configuration'][_0x57eb('0x2c')]);_0x19dcc7[_0x57eb('0x30')]=_[_0x57eb('0x31')](_0x158681[_0x57eb('0x30')]);_0x19dcc7['filters']=_[_0x57eb('0x34')](_0x19dcc7[_0x57eb('0x2f')],_0x19dcc7[_0x57eb('0x30')]);_0x5bba5f[_0x57eb('0x33')]=_[_0x57eb('0x34')](_0x19dcc7[_0x57eb('0x2f')],qs[_0x57eb('0x35')](_0x158681[_0x57eb('0x30')][_0x57eb('0x35')]));_0x5bba5f[_0x57eb('0x33')]=_0x5bba5f[_0x57eb('0x33')]['length']?_0x5bba5f['attributes']:_0x19dcc7[_0x57eb('0x2f')];if(_0x158681['query'][_0x57eb('0x40')]){_0x5bba5f[_0x57eb('0x41')]=[{'all':!![]}];}_0x5bba5f=_['merge']({},_0x5bba5f,_0x158681['options']);return db[_0x57eb('0x2b')][_0x57eb('0x47')](_0x5bba5f)[_0x57eb('0x24')](handleEntityNotFound(_0x34cffc,null))['then'](respondWithResult(_0x34cffc,null))['catch'](handleError(_0x34cffc,null));};exports['create']=function(_0x5de4ed,_0x503432){return db[_0x57eb('0x2b')][_0x57eb('0x48')](_0x5de4ed[_0x57eb('0x49')],{})[_0x57eb('0x24')](respondWithResult(_0x503432,0xc9))['catch'](handleError(_0x503432,null));};exports[_0x57eb('0x23')]=function(_0x201c0c,_0x87451b){if(_0x201c0c[_0x57eb('0x49')]['id']){delete _0x201c0c[_0x57eb('0x49')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x201c0c[_0x57eb('0x46')]['id']}})[_0x57eb('0x24')](handleEntityNotFound(_0x87451b,null))[_0x57eb('0x24')](saveUpdates(_0x201c0c['body'],null))[_0x57eb('0x24')](respondWithResult(_0x87451b,null))[_0x57eb('0x44')](handleError(_0x87451b,null));};exports[_0x57eb('0x25')]=function(_0x3084d2,_0xdbfa7b){return db[_0x57eb('0x2b')][_0x57eb('0x47')]({'where':{'id':_0x3084d2[_0x57eb('0x46')]['id']}})[_0x57eb('0x24')](handleEntityNotFound(_0xdbfa7b,null))['then'](removeEntity(_0xdbfa7b,null))[_0x57eb('0x44')](handleError(_0xdbfa7b,null));};exports['getFields']=function(_0xd642ba,_0xd2bbb5,_0xbc95f8){var _0x11ed90={};var _0x52a2c6={};var _0x1eb78c;var _0x204db0;return db[_0x57eb('0x2b')][_0x57eb('0x4a')]({'where':{'id':_0xd642ba[_0x57eb('0x46')]['id']}})[_0x57eb('0x24')](handleEntityNotFound(_0xd2bbb5,null))[_0x57eb('0x24')](function(_0x3224f2){if(_0x3224f2){_0x1eb78c=_0x3224f2;_0x52a2c6['model']=_[_0x57eb('0x31')](db[_0x57eb('0x4b')][_0x57eb('0x2c')]);_0x52a2c6[_0x57eb('0x30')]=_[_0x57eb('0x31')](_0xd642ba[_0x57eb('0x30')]);_0x52a2c6[_0x57eb('0x32')]=_['intersection'](_0x52a2c6[_0x57eb('0x2f')],_0x52a2c6[_0x57eb('0x30')]);_0x11ed90[_0x57eb('0x33')]=_['intersection'](_0x52a2c6[_0x57eb('0x2f')],qs[_0x57eb('0x35')](_0xd642ba['query'][_0x57eb('0x35')]));_0x11ed90[_0x57eb('0x33')]=_0x11ed90[_0x57eb('0x33')]['length']?_0x11ed90[_0x57eb('0x33')]:_0x52a2c6[_0x57eb('0x2f')];_0x11ed90[_0x57eb('0x39')]=qs['sort'](_0xd642ba[_0x57eb('0x30')][_0x57eb('0x3a')]);_0x11ed90['where']=qs[_0x57eb('0x32')](_[_0x57eb('0x4c')](_0xd642ba[_0x57eb('0x30')],_0x52a2c6[_0x57eb('0x32')]));if(_0xd642ba['query']['filter']){_0x11ed90[_0x57eb('0x3b')]=_['merge'](_0x11ed90['where'],{'$or':_[_0x57eb('0x2a')](_0x11ed90[_0x57eb('0x33')],function(_0x2991c1){var _0x30f04e={};_0x30f04e[_0x2991c1]={'$like':'%'+_0xd642ba[_0x57eb('0x30')][_0x57eb('0x3c')]+'%'};return _0x30f04e;})});}_0x11ed90=_[_0x57eb('0x3d')]({},_0x11ed90,_0xd642ba[_0x57eb('0x3f')]);return _0x1eb78c[_0x57eb('0x4d')](_0x11ed90);}})[_0x57eb('0x24')](function(_0x1512bb){if(_0x1512bb){_0x204db0=_0x1512bb['length'];if(!_0xd642ba[_0x57eb('0x30')][_0x57eb('0x37')]('nolimit')){_0x11ed90[_0x57eb('0x1c')]=qs[_0x57eb('0x1c')](_0xd642ba[_0x57eb('0x30')][_0x57eb('0x1c')]);_0x11ed90[_0x57eb('0x1e')]=qs[_0x57eb('0x1e')](_0xd642ba['query']['offset']);}return _0x1eb78c[_0x57eb('0x4d')](_0x11ed90);}})[_0x57eb('0x24')](function(_0x5bbefa){if(_0x5bbefa){return _0x5bbefa?{'count':_0x204db0,'rows':_0x5bbefa}:null;}})[_0x57eb('0x24')](respondWithResult(_0xd2bbb5,null))[_0x57eb('0x44')](handleError(_0xd2bbb5,null));};exports[_0x57eb('0x4e')]=function(_0x5bf6ec,_0x3531e9,_0x359062){var _0x29036c={};var _0x2901a9={};var _0x53b6c4;var _0x4327fc;return db['Dynamics365Configuration'][_0x57eb('0x4a')]({'where':{'id':_0x5bf6ec[_0x57eb('0x46')]['id']}})[_0x57eb('0x24')](handleEntityNotFound(_0x3531e9,null))[_0x57eb('0x24')](function(_0x4f1091){if(_0x4f1091){_0x53b6c4=_0x4f1091;_0x2901a9['model']=_['keys'](db[_0x57eb('0x4b')]['rawAttributes']);_0x2901a9[_0x57eb('0x30')]=_[_0x57eb('0x31')](_0x5bf6ec[_0x57eb('0x30')]);_0x2901a9[_0x57eb('0x32')]=_[_0x57eb('0x34')](_0x2901a9['model'],_0x2901a9['query']);_0x29036c[_0x57eb('0x33')]=_['intersection'](_0x2901a9[_0x57eb('0x2f')],qs[_0x57eb('0x35')](_0x5bf6ec[_0x57eb('0x30')][_0x57eb('0x35')]));_0x29036c[_0x57eb('0x33')]=_0x29036c[_0x57eb('0x33')][_0x57eb('0x36')]?_0x29036c[_0x57eb('0x33')]:_0x2901a9[_0x57eb('0x2f')];_0x29036c['order']=qs[_0x57eb('0x3a')](_0x5bf6ec['query'][_0x57eb('0x3a')]);_0x29036c['where']=qs[_0x57eb('0x32')](_['pick'](_0x5bf6ec[_0x57eb('0x30')],_0x2901a9['filters']));if(_0x5bf6ec[_0x57eb('0x30')]['filter']){_0x29036c[_0x57eb('0x3b')]=_[_0x57eb('0x3d')](_0x29036c[_0x57eb('0x3b')],{'$or':_[_0x57eb('0x2a')](_0x29036c[_0x57eb('0x33')],function(_0x3d1b7d){var _0x36c3a8={};_0x36c3a8[_0x3d1b7d]={'$like':'%'+_0x5bf6ec[_0x57eb('0x30')][_0x57eb('0x3c')]+'%'};return _0x36c3a8;})});}_0x29036c=_['merge']({},_0x29036c,_0x5bf6ec['options']);return _0x53b6c4[_0x57eb('0x4e')](_0x29036c);}})[_0x57eb('0x24')](function(_0x400d2f){if(_0x400d2f){_0x4327fc=_0x400d2f[_0x57eb('0x36')];if(!_0x5bf6ec['query'][_0x57eb('0x37')](_0x57eb('0x38'))){_0x29036c[_0x57eb('0x1c')]=qs[_0x57eb('0x1c')](_0x5bf6ec[_0x57eb('0x30')][_0x57eb('0x1c')]);_0x29036c[_0x57eb('0x1e')]=qs[_0x57eb('0x1e')](_0x5bf6ec['query'][_0x57eb('0x1e')]);}return _0x53b6c4[_0x57eb('0x4e')](_0x29036c);}})[_0x57eb('0x24')](function(_0x1b7183){if(_0x1b7183){return _0x1b7183?{'count':_0x4327fc,'rows':_0x1b7183}:null;}})[_0x57eb('0x24')](respondWithResult(_0x3531e9,null))[_0x57eb('0x44')](handleError(_0x3531e9,null));};exports['getDescriptions']=function(_0x29e24c,_0x321854,_0x313e79){var _0x375915={};var _0x294430={};var _0x4781c3;var _0x32c441;return db[_0x57eb('0x2b')][_0x57eb('0x4a')]({'where':{'id':_0x29e24c[_0x57eb('0x46')]['id']}})[_0x57eb('0x24')](handleEntityNotFound(_0x321854,null))[_0x57eb('0x24')](function(_0x1576cd){if(_0x1576cd){_0x4781c3=_0x1576cd;_0x294430['model']=_[_0x57eb('0x31')](db[_0x57eb('0x4b')]['rawAttributes']);_0x294430[_0x57eb('0x30')]=_['keys'](_0x29e24c[_0x57eb('0x30')]);_0x294430[_0x57eb('0x32')]=_['intersection'](_0x294430[_0x57eb('0x2f')],_0x294430[_0x57eb('0x30')]);_0x375915['attributes']=_['intersection'](_0x294430['model'],qs['fields'](_0x29e24c[_0x57eb('0x30')]['fields']));_0x375915[_0x57eb('0x33')]=_0x375915[_0x57eb('0x33')][_0x57eb('0x36')]?_0x375915[_0x57eb('0x33')]:_0x294430[_0x57eb('0x2f')];_0x375915['order']=qs['sort'](_0x29e24c[_0x57eb('0x30')][_0x57eb('0x3a')]);_0x375915[_0x57eb('0x3b')]=qs[_0x57eb('0x32')](_[_0x57eb('0x4c')](_0x29e24c['query'],_0x294430['filters']));if(_0x29e24c[_0x57eb('0x30')][_0x57eb('0x3c')]){_0x375915[_0x57eb('0x3b')]=_[_0x57eb('0x3d')](_0x375915[_0x57eb('0x3b')],{'$or':_['map'](_0x375915[_0x57eb('0x33')],function(_0x55b330){var _0x11d2f8={};_0x11d2f8[_0x55b330]={'$like':'%'+_0x29e24c['query'][_0x57eb('0x3c')]+'%'};return _0x11d2f8;})});}_0x375915=_[_0x57eb('0x3d')]({},_0x375915,_0x29e24c[_0x57eb('0x3f')]);return _0x4781c3[_0x57eb('0x4f')](_0x375915);}})[_0x57eb('0x24')](function(_0x283d13){if(_0x283d13){_0x32c441=_0x283d13['length'];if(!_0x29e24c[_0x57eb('0x30')][_0x57eb('0x37')](_0x57eb('0x38'))){_0x375915[_0x57eb('0x1c')]=qs[_0x57eb('0x1c')](_0x29e24c[_0x57eb('0x30')]['limit']);_0x375915[_0x57eb('0x1e')]=qs[_0x57eb('0x1e')](_0x29e24c['query']['offset']);}return _0x4781c3[_0x57eb('0x4f')](_0x375915);}})['then'](function(_0x97b611){if(_0x97b611){return _0x97b611?{'count':_0x32c441,'rows':_0x97b611}:null;}})[_0x57eb('0x24')](respondWithResult(_0x321854,null))[_0x57eb('0x44')](handleError(_0x321854,null));}; \ No newline at end of file +var _0x90d3=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','attributes','include','create','body','find','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x26366b,_0x5db5c0){var _0x186e69=function(_0x3c63a4){while(--_0x3c63a4){_0x26366b['push'](_0x26366b['shift']());}};_0x186e69(++_0x5db5c0);}(_0x90d3,0x124));var _0x390d=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0x90d3[_0x369534];return _0x524bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x390d('0x0'));var zipdir=require(_0x390d('0x1'));var jsonpatch=require(_0x390d('0x2'));var rp=require('request-promise');var moment=require(_0x390d('0x3'));var BPromise=require(_0x390d('0x4'));var Mustache=require(_0x390d('0x5'));var util=require(_0x390d('0x6'));var path=require(_0x390d('0x7'));var sox=require(_0x390d('0x8'));var csv=require(_0x390d('0x9'));var ejs=require(_0x390d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390d('0xb'));var squel=require(_0x390d('0xc'));var crypto=require(_0x390d('0xd'));var jsforce=require(_0x390d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x390d('0x9'));var querystring=require(_0x390d('0xf'));var Papa=require('papaparse');var Redis=require(_0x390d('0x10'));var authService=require(_0x390d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x390d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x390d('0x13'))(_0x390d('0x14'));var utils=require(_0x390d('0x15'));var config=require(_0x390d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x390d('0x17'))['db'];function respondWithStatusCode(_0x40b821,_0x53e287){_0x53e287=_0x53e287||0xcc;return function(_0x44ed00){if(_0x44ed00){return _0x40b821['sendStatus'](_0x53e287);}return _0x40b821[_0x390d('0x18')](_0x53e287)[_0x390d('0x19')]();};}function respondWithResult(_0x17783d,_0x59d61e){_0x59d61e=_0x59d61e||0xc8;return function(_0x212a26){if(_0x212a26){return _0x17783d[_0x390d('0x18')](_0x59d61e)[_0x390d('0x1a')](_0x212a26);}};}function respondWithFilteredResult(_0x156153,_0x5e0aaa){return function(_0x2148af){if(_0x2148af){var _0x26b9be=typeof _0x5e0aaa[_0x390d('0x1b')]===_0x390d('0x1c')&&typeof _0x5e0aaa[_0x390d('0x1d')]==='undefined';var _0x18b19a=_0x2148af[_0x390d('0x1e')];var _0x597a59=_0x26b9be?0x0:_0x5e0aaa['offset'];var _0x1aee21=_0x26b9be?_0x2148af[_0x390d('0x1e')]:_0x5e0aaa[_0x390d('0x1b')]+_0x5e0aaa['limit'];var _0x55956c;if(_0x1aee21>=_0x18b19a){_0x1aee21=_0x18b19a;_0x55956c=0xc8;}else{_0x55956c=0xce;}_0x156153[_0x390d('0x18')](_0x55956c);return _0x156153[_0x390d('0x1f')](_0x390d('0x20'),_0x597a59+'-'+_0x1aee21+'/'+_0x18b19a)[_0x390d('0x1a')](_0x2148af);}return null;};}function patchUpdates(_0x9de2f4){return function(_0x4f9468){try{jsonpatch[_0x390d('0x21')](_0x4f9468,_0x9de2f4,!![]);}catch(_0x4290f6){return BPromise[_0x390d('0x22')](_0x4290f6);}return _0x4f9468[_0x390d('0x23')]();};}function saveUpdates(_0x4bafe9,_0x565db0){return function(_0x21d339){if(_0x21d339){return _0x21d339[_0x390d('0x24')](_0x4bafe9)[_0x390d('0x25')](function(_0x23f577){return _0x23f577;});}return null;};}function removeEntity(_0x1395d3,_0x147c5e){return function(_0x38df61){if(_0x38df61){return _0x38df61[_0x390d('0x26')]()['then'](function(){_0x1395d3[_0x390d('0x18')](0xcc)[_0x390d('0x19')]();});}};}function handleEntityNotFound(_0x7983ac,_0x33f5e8){return function(_0x575668){if(!_0x575668){_0x7983ac[_0x390d('0x27')](0x194);}return _0x575668;};}function handleError(_0x28e637,_0x4572d2){_0x4572d2=_0x4572d2||0x1f4;return function(_0x38cb53){logger[_0x390d('0x28')](_0x38cb53[_0x390d('0x29')]);if(_0x38cb53[_0x390d('0x2a')]){delete _0x38cb53[_0x390d('0x2a')];}_0x28e637[_0x390d('0x18')](_0x4572d2)[_0x390d('0x2b')](_0x38cb53);};}exports[_0x390d('0x2c')]=function(_0xfaf314,_0x485c07){var _0x224a51={},_0x405e27={},_0x513535={'count':0x0,'rows':[]};var _0x201cc5=_[_0x390d('0x2d')](db[_0x390d('0x2e')][_0x390d('0x2f')],function(_0x226986){return{'name':_0x226986['fieldName'],'type':_0x226986[_0x390d('0x30')]['key']};});_0x405e27[_0x390d('0x31')]=_[_0x390d('0x2d')](_0x201cc5,_0x390d('0x2a'));_0x405e27[_0x390d('0x32')]=_[_0x390d('0x33')](_0xfaf314[_0x390d('0x32')]);_0x405e27[_0x390d('0x34')]=_[_0x390d('0x35')](_0x405e27[_0x390d('0x31')],_0x405e27[_0x390d('0x32')]);_0x224a51['attributes']=_[_0x390d('0x35')](_0x405e27['model'],qs[_0x390d('0x36')](_0xfaf314[_0x390d('0x32')][_0x390d('0x36')]));_0x224a51['attributes']=_0x224a51['attributes'][_0x390d('0x37')]?_0x224a51['attributes']:_0x405e27['model'];if(!_0xfaf314[_0x390d('0x32')][_0x390d('0x38')](_0x390d('0x39'))){_0x224a51[_0x390d('0x1d')]=qs[_0x390d('0x1d')](_0xfaf314['query'][_0x390d('0x1d')]);_0x224a51[_0x390d('0x1b')]=qs[_0x390d('0x1b')](_0xfaf314[_0x390d('0x32')][_0x390d('0x1b')]);}_0x224a51[_0x390d('0x3a')]=qs['sort'](_0xfaf314[_0x390d('0x32')][_0x390d('0x3b')]);_0x224a51[_0x390d('0x3c')]=qs[_0x390d('0x34')](_['pick'](_0xfaf314[_0x390d('0x32')],_0x405e27[_0x390d('0x34')]),_0x201cc5);if(_0xfaf314[_0x390d('0x32')][_0x390d('0x3d')]){_0x224a51[_0x390d('0x3c')]=_[_0x390d('0x3e')](_0x224a51[_0x390d('0x3c')],{'$or':_[_0x390d('0x2d')](_0x201cc5,function(_0x32e54f){if(_0x32e54f[_0x390d('0x30')]!==_0x390d('0x3f')){var _0x9d8c4a={};_0x9d8c4a[_0x32e54f[_0x390d('0x2a')]]={'$like':'%'+_0xfaf314[_0x390d('0x32')][_0x390d('0x3d')]+'%'};return _0x9d8c4a;}})});}_0x224a51=_['merge']({},_0x224a51,_0xfaf314[_0x390d('0x40')]);var _0x4337d5={'where':_0x224a51['where']};return db[_0x390d('0x2e')][_0x390d('0x1e')](_0x4337d5)[_0x390d('0x25')](function(_0x4c7845){_0x513535[_0x390d('0x1e')]=_0x4c7845;if(_0xfaf314[_0x390d('0x32')][_0x390d('0x41')]){_0x224a51['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x224a51);})[_0x390d('0x25')](function(_0x14e8a3){_0x513535[_0x390d('0x42')]=_0x14e8a3;return _0x513535;})[_0x390d('0x25')](respondWithFilteredResult(_0x485c07,_0x224a51))[_0x390d('0x43')](handleError(_0x485c07,null));};exports[_0x390d('0x44')]=function(_0x4c5c32,_0xb9cc0){var _0x24dc31={'raw':![],'where':{'id':_0x4c5c32[_0x390d('0x45')]['id']}},_0x398af2={};_0x398af2['model']=_['keys'](db['Dynamics365Configuration'][_0x390d('0x2f')]);_0x398af2['query']=_[_0x390d('0x33')](_0x4c5c32[_0x390d('0x32')]);_0x398af2['filters']=_[_0x390d('0x35')](_0x398af2['model'],_0x398af2[_0x390d('0x32')]);_0x24dc31['attributes']=_[_0x390d('0x35')](_0x398af2[_0x390d('0x31')],qs[_0x390d('0x36')](_0x4c5c32[_0x390d('0x32')][_0x390d('0x36')]));_0x24dc31[_0x390d('0x46')]=_0x24dc31[_0x390d('0x46')]['length']?_0x24dc31['attributes']:_0x398af2[_0x390d('0x31')];if(_0x4c5c32[_0x390d('0x32')][_0x390d('0x41')]){_0x24dc31[_0x390d('0x47')]=[{'all':!![]}];}_0x24dc31=_[_0x390d('0x3e')]({},_0x24dc31,_0x4c5c32[_0x390d('0x40')]);return db['Dynamics365Configuration']['find'](_0x24dc31)[_0x390d('0x25')](handleEntityNotFound(_0xb9cc0,null))['then'](respondWithResult(_0xb9cc0,null))[_0x390d('0x43')](handleError(_0xb9cc0,null));};exports[_0x390d('0x48')]=function(_0x5ba0ea,_0x5a7091){return db[_0x390d('0x2e')]['create'](_0x5ba0ea[_0x390d('0x49')],{})[_0x390d('0x25')](respondWithResult(_0x5a7091,0xc9))[_0x390d('0x43')](handleError(_0x5a7091,null));};exports[_0x390d('0x24')]=function(_0xbb02a6,_0x303c0b){if(_0xbb02a6[_0x390d('0x49')]['id']){delete _0xbb02a6[_0x390d('0x49')]['id'];}return db[_0x390d('0x2e')]['find']({'where':{'id':_0xbb02a6['params']['id']}})[_0x390d('0x25')](handleEntityNotFound(_0x303c0b,null))[_0x390d('0x25')](saveUpdates(_0xbb02a6['body'],null))[_0x390d('0x25')](respondWithResult(_0x303c0b,null))['catch'](handleError(_0x303c0b,null));};exports['destroy']=function(_0x33a7c7,_0x53ed44){return db[_0x390d('0x2e')][_0x390d('0x4a')]({'where':{'id':_0x33a7c7[_0x390d('0x45')]['id']}})['then'](handleEntityNotFound(_0x53ed44,null))['then'](removeEntity(_0x53ed44,null))['catch'](handleError(_0x53ed44,null));};exports[_0x390d('0x4b')]=function(_0x5a4fb2,_0x4a2998,_0x2df57d){var _0x5c0fe5={};var _0x21b9e2={};var _0x24228d;var _0x4e63d1;return db[_0x390d('0x2e')][_0x390d('0x4c')]({'where':{'id':_0x5a4fb2[_0x390d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a2998,null))[_0x390d('0x25')](function(_0x3c334d){if(_0x3c334d){_0x24228d=_0x3c334d;_0x21b9e2[_0x390d('0x31')]=_[_0x390d('0x33')](db[_0x390d('0x4d')]['rawAttributes']);_0x21b9e2['query']=_[_0x390d('0x33')](_0x5a4fb2['query']);_0x21b9e2['filters']=_[_0x390d('0x35')](_0x21b9e2[_0x390d('0x31')],_0x21b9e2[_0x390d('0x32')]);_0x5c0fe5[_0x390d('0x46')]=_['intersection'](_0x21b9e2[_0x390d('0x31')],qs[_0x390d('0x36')](_0x5a4fb2[_0x390d('0x32')][_0x390d('0x36')]));_0x5c0fe5[_0x390d('0x46')]=_0x5c0fe5[_0x390d('0x46')]['length']?_0x5c0fe5['attributes']:_0x21b9e2[_0x390d('0x31')];_0x5c0fe5[_0x390d('0x3a')]=qs['sort'](_0x5a4fb2[_0x390d('0x32')][_0x390d('0x3b')]);_0x5c0fe5[_0x390d('0x3c')]=qs['filters'](_[_0x390d('0x4e')](_0x5a4fb2[_0x390d('0x32')],_0x21b9e2[_0x390d('0x34')]));if(_0x5a4fb2['query']['filter']){_0x5c0fe5[_0x390d('0x3c')]=_[_0x390d('0x3e')](_0x5c0fe5['where'],{'$or':_[_0x390d('0x2d')](_0x5c0fe5['attributes'],function(_0x3b1afe){var _0x1706e9={};_0x1706e9[_0x3b1afe]={'$like':'%'+_0x5a4fb2[_0x390d('0x32')][_0x390d('0x3d')]+'%'};return _0x1706e9;})});}_0x5c0fe5=_[_0x390d('0x3e')]({},_0x5c0fe5,_0x5a4fb2[_0x390d('0x40')]);return _0x24228d[_0x390d('0x4b')](_0x5c0fe5);}})[_0x390d('0x25')](function(_0x1e8572){if(_0x1e8572){_0x4e63d1=_0x1e8572[_0x390d('0x37')];if(!_0x5a4fb2[_0x390d('0x32')][_0x390d('0x38')](_0x390d('0x39'))){_0x5c0fe5[_0x390d('0x1d')]=qs['limit'](_0x5a4fb2['query'][_0x390d('0x1d')]);_0x5c0fe5['offset']=qs[_0x390d('0x1b')](_0x5a4fb2[_0x390d('0x32')][_0x390d('0x1b')]);}return _0x24228d[_0x390d('0x4b')](_0x5c0fe5);}})[_0x390d('0x25')](function(_0x46341e){if(_0x46341e){return _0x46341e?{'count':_0x4e63d1,'rows':_0x46341e}:null;}})['then'](respondWithResult(_0x4a2998,null))[_0x390d('0x43')](handleError(_0x4a2998,null));};exports[_0x390d('0x4f')]=function(_0x51ab5a,_0x1bb23c,_0x54363a){var _0x8ddb0={};var _0x30c0dc={};var _0x512b3c;var _0x3f044a;return db[_0x390d('0x2e')][_0x390d('0x4c')]({'where':{'id':_0x51ab5a['params']['id']}})[_0x390d('0x25')](handleEntityNotFound(_0x1bb23c,null))['then'](function(_0x335525){if(_0x335525){_0x512b3c=_0x335525;_0x30c0dc[_0x390d('0x31')]=_[_0x390d('0x33')](db[_0x390d('0x4d')][_0x390d('0x2f')]);_0x30c0dc['query']=_[_0x390d('0x33')](_0x51ab5a[_0x390d('0x32')]);_0x30c0dc[_0x390d('0x34')]=_[_0x390d('0x35')](_0x30c0dc['model'],_0x30c0dc['query']);_0x8ddb0[_0x390d('0x46')]=_[_0x390d('0x35')](_0x30c0dc[_0x390d('0x31')],qs['fields'](_0x51ab5a[_0x390d('0x32')][_0x390d('0x36')]));_0x8ddb0[_0x390d('0x46')]=_0x8ddb0[_0x390d('0x46')]['length']?_0x8ddb0['attributes']:_0x30c0dc['model'];_0x8ddb0[_0x390d('0x3a')]=qs[_0x390d('0x3b')](_0x51ab5a['query'][_0x390d('0x3b')]);_0x8ddb0[_0x390d('0x3c')]=qs[_0x390d('0x34')](_['pick'](_0x51ab5a['query'],_0x30c0dc[_0x390d('0x34')]));if(_0x51ab5a[_0x390d('0x32')][_0x390d('0x3d')]){_0x8ddb0[_0x390d('0x3c')]=_[_0x390d('0x3e')](_0x8ddb0[_0x390d('0x3c')],{'$or':_[_0x390d('0x2d')](_0x8ddb0['attributes'],function(_0x32c56e){var _0x52602f={};_0x52602f[_0x32c56e]={'$like':'%'+_0x51ab5a[_0x390d('0x32')]['filter']+'%'};return _0x52602f;})});}_0x8ddb0=_[_0x390d('0x3e')]({},_0x8ddb0,_0x51ab5a[_0x390d('0x40')]);return _0x512b3c['getSubjects'](_0x8ddb0);}})[_0x390d('0x25')](function(_0x545fd0){if(_0x545fd0){_0x3f044a=_0x545fd0[_0x390d('0x37')];if(!_0x51ab5a[_0x390d('0x32')][_0x390d('0x38')](_0x390d('0x39'))){_0x8ddb0[_0x390d('0x1d')]=qs[_0x390d('0x1d')](_0x51ab5a[_0x390d('0x32')][_0x390d('0x1d')]);_0x8ddb0[_0x390d('0x1b')]=qs[_0x390d('0x1b')](_0x51ab5a[_0x390d('0x32')][_0x390d('0x1b')]);}return _0x512b3c[_0x390d('0x4f')](_0x8ddb0);}})['then'](function(_0xa4ec46){if(_0xa4ec46){return _0xa4ec46?{'count':_0x3f044a,'rows':_0xa4ec46}:null;}})[_0x390d('0x25')](respondWithResult(_0x1bb23c,null))['catch'](handleError(_0x1bb23c,null));};exports[_0x390d('0x50')]=function(_0x68c24e,_0x5b50b9,_0x5badb0){var _0x44132e={};var _0x356643={};var _0x45f7e0;var _0x4520ba;return db[_0x390d('0x2e')]['findOne']({'where':{'id':_0x68c24e[_0x390d('0x45')]['id']}})[_0x390d('0x25')](handleEntityNotFound(_0x5b50b9,null))['then'](function(_0x282262){if(_0x282262){_0x45f7e0=_0x282262;_0x356643[_0x390d('0x31')]=_[_0x390d('0x33')](db['Dynamics365Field']['rawAttributes']);_0x356643[_0x390d('0x32')]=_[_0x390d('0x33')](_0x68c24e[_0x390d('0x32')]);_0x356643[_0x390d('0x34')]=_['intersection'](_0x356643[_0x390d('0x31')],_0x356643['query']);_0x44132e['attributes']=_[_0x390d('0x35')](_0x356643[_0x390d('0x31')],qs['fields'](_0x68c24e[_0x390d('0x32')]['fields']));_0x44132e[_0x390d('0x46')]=_0x44132e[_0x390d('0x46')][_0x390d('0x37')]?_0x44132e[_0x390d('0x46')]:_0x356643['model'];_0x44132e[_0x390d('0x3a')]=qs[_0x390d('0x3b')](_0x68c24e[_0x390d('0x32')]['sort']);_0x44132e[_0x390d('0x3c')]=qs[_0x390d('0x34')](_[_0x390d('0x4e')](_0x68c24e[_0x390d('0x32')],_0x356643[_0x390d('0x34')]));if(_0x68c24e[_0x390d('0x32')][_0x390d('0x3d')]){_0x44132e['where']=_[_0x390d('0x3e')](_0x44132e[_0x390d('0x3c')],{'$or':_[_0x390d('0x2d')](_0x44132e[_0x390d('0x46')],function(_0x45a402){var _0x30a106={};_0x30a106[_0x45a402]={'$like':'%'+_0x68c24e[_0x390d('0x32')][_0x390d('0x3d')]+'%'};return _0x30a106;})});}_0x44132e=_['merge']({},_0x44132e,_0x68c24e['options']);return _0x45f7e0[_0x390d('0x50')](_0x44132e);}})[_0x390d('0x25')](function(_0x4b86d5){if(_0x4b86d5){_0x4520ba=_0x4b86d5[_0x390d('0x37')];if(!_0x68c24e[_0x390d('0x32')][_0x390d('0x38')](_0x390d('0x39'))){_0x44132e[_0x390d('0x1d')]=qs['limit'](_0x68c24e[_0x390d('0x32')]['limit']);_0x44132e['offset']=qs['offset'](_0x68c24e[_0x390d('0x32')]['offset']);}return _0x45f7e0[_0x390d('0x50')](_0x44132e);}})[_0x390d('0x25')](function(_0x103554){if(_0x103554){return _0x103554?{'count':_0x4520ba,'rows':_0x103554}:null;}})[_0x390d('0x25')](respondWithResult(_0x5b50b9,null))['catch'](handleError(_0x5b50b9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4edb59e..f0036eb 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x1e920b,_0x2a60c7){var _0x524cc8=function(_0x1bb2b3){while(--_0x1bb2b3){_0x1e920b['push'](_0x1e920b['shift']());}};_0x524cc8(++_0x2a60c7);}(_0x9f62,0x154));var _0x29f6=function(_0x3b5c90,_0x57dae4){_0x3b5c90=_0x3b5c90-0x0;var _0x4f0056=_0x9f62[_0x3b5c90];return _0x4f0056;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x38f0d6,_0x530499){var _0x2d0ee6=function(_0x1ed64f){while(--_0x1ed64f){_0x38f0d6['push'](_0x38f0d6['shift']());}};_0x2d0ee6(++_0x530499);}(_0xaa88,0x137));var _0x8aa8=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0xaa88[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 6376353..88aa596 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 _0x55c2=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x18c44d,_0x33976d){var _0x71abcf=function(_0x43072b){while(--_0x43072b){_0x18c44d['push'](_0x18c44d['shift']());}};_0x71abcf(++_0x33976d);}(_0x55c2,0x10e));var _0x255c=function(_0x25e95a,_0x2efe4a){_0x25e95a=_0x25e95a-0x0;var _0x2b35e8=_0x55c2[_0x25e95a];return _0x2b35e8;};'use strict';var _=require(_0x255c('0x0'));var util=require(_0x255c('0x1'));var moment=require('moment');var BPromise=require(_0x255c('0x2'));var rs=require(_0x255c('0x3'));var fs=require('fs');var Redis=require(_0x255c('0x4'));var db=require(_0x255c('0x5'))['db'];var utils=require(_0x255c('0x6'));var logger=require(_0x255c('0x7'))(_0x255c('0x8'));var config=require(_0x255c('0x9'));var jayson=require(_0x255c('0xa'));var client=jayson[_0x255c('0xb')][_0x255c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18239d,_0x2f58c5,_0x1a742c){return new BPromise(function(_0x2944f2,_0x569af0){return client[_0x255c('0xd')](_0x18239d,_0x1a742c)[_0x255c('0xe')](function(_0x5e04e9){logger[_0x255c('0xf')](_0x255c('0x10'),_0x2f58c5,_0x255c('0x11'));logger[_0x255c('0x12')](_0x255c('0x13'),_0x2f58c5,'request\x20sent',JSON['stringify'](_0x5e04e9));if(_0x5e04e9['error']){if(_0x5e04e9[_0x255c('0x14')][_0x255c('0x15')]===0x1f4){logger[_0x255c('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2f58c5,_0x5e04e9[_0x255c('0x14')]['message']);return _0x569af0(_0x5e04e9[_0x255c('0x14')][_0x255c('0x16')]);}logger[_0x255c('0x14')](_0x255c('0x10'),_0x2f58c5,_0x5e04e9[_0x255c('0x14')]['message']);return _0x2944f2(_0x5e04e9[_0x255c('0x14')]['message']);}else{logger[_0x255c('0xf')](_0x255c('0x10'),_0x2f58c5,_0x255c('0x11'));_0x2944f2(_0x5e04e9['result'][_0x255c('0x16')]);}})[_0x255c('0x17')](function(_0xb6ccf4){logger[_0x255c('0x14')](_0x255c('0x10'),_0x2f58c5,_0xb6ccf4);_0x569af0(_0xb6ccf4);});});} \ No newline at end of file +var _0x3ce5=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x3ce5,0x180));var _0x53ce=function(_0x3c0760,_0x289702){_0x3c0760=_0x3c0760-0x0;var _0x42fd9f=_0x3ce5[_0x3c0760];return _0x42fd9f;};'use strict';var _=require(_0x53ce('0x0'));var util=require(_0x53ce('0x1'));var moment=require(_0x53ce('0x2'));var BPromise=require(_0x53ce('0x3'));var rs=require(_0x53ce('0x4'));var fs=require('fs');var Redis=require(_0x53ce('0x5'));var db=require(_0x53ce('0x6'))['db'];var utils=require(_0x53ce('0x7'));var logger=require(_0x53ce('0x8'))(_0x53ce('0x9'));var config=require('../../config/environment');var jayson=require(_0x53ce('0xa'));var client=jayson['client'][_0x53ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c62,_0x273761,_0x31f008){return new BPromise(function(_0x43b00b,_0x21a644){return client[_0x53ce('0xc')](_0x4d6c62,_0x31f008)['then'](function(_0x5ef0ad){logger['info'](_0x53ce('0xd'),_0x273761,_0x53ce('0xe'));logger[_0x53ce('0xf')](_0x53ce('0x10'),_0x273761,_0x53ce('0xe'),JSON['stringify'](_0x5ef0ad));if(_0x5ef0ad[_0x53ce('0x11')]){if(_0x5ef0ad[_0x53ce('0x11')][_0x53ce('0x12')]===0x1f4){logger[_0x53ce('0x11')](_0x53ce('0xd'),_0x273761,_0x5ef0ad[_0x53ce('0x11')]['message']);return _0x21a644(_0x5ef0ad[_0x53ce('0x11')][_0x53ce('0x13')]);}logger[_0x53ce('0x11')](_0x53ce('0xd'),_0x273761,_0x5ef0ad[_0x53ce('0x11')]['message']);return _0x43b00b(_0x5ef0ad['error'][_0x53ce('0x13')]);}else{logger[_0x53ce('0x14')](_0x53ce('0xd'),_0x273761,_0x53ce('0xe'));_0x43b00b(_0x5ef0ad['result'][_0x53ce('0x13')]);}})['catch'](function(_0x588959){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x273761,_0x588959);_0x21a644(_0x588959);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6691e29..69e085a 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 _0x1b29=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x56d71f,_0x4c06a4){var _0x3208df=function(_0x5af38b){while(--_0x5af38b){_0x56d71f['push'](_0x56d71f['shift']());}};_0x3208df(++_0x4c06a4);}(_0x1b29,0x1c7));var _0x91b2=function(_0x35158d,_0x3fe39b){_0x35158d=_0x35158d-0x0;var _0x31f810=_0x1b29[_0x35158d];return _0x31f810;};'use strict';var multer=require(_0x91b2('0x0'));var util=require(_0x91b2('0x1'));var path=require(_0x91b2('0x2'));var timeout=require(_0x91b2('0x3'));var express=require(_0x91b2('0x4'));var router=express['Router']();var fs_extra=require(_0x91b2('0x5'));var auth=require(_0x91b2('0x6'));var interaction=require(_0x91b2('0x7'));var config=require(_0x91b2('0x8'));var controller=require(_0x91b2('0x9'));router[_0x91b2('0xa')]('/',auth[_0x91b2('0xb')](),controller[_0x91b2('0xc')]);router[_0x91b2('0xa')]('/:id',auth[_0x91b2('0xb')](),controller[_0x91b2('0xd')]);router[_0x91b2('0xe')]('/',auth[_0x91b2('0xb')](),controller[_0x91b2('0xf')]);router[_0x91b2('0x10')](_0x91b2('0x11'),auth['isAuthenticated'](),controller[_0x91b2('0x12')]);router['delete'](_0x91b2('0x11'),auth[_0x91b2('0xb')](),controller[_0x91b2('0x13')]);module[_0x91b2('0x14')]=router; \ No newline at end of file +var _0xbe08=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x25f535,_0x2e2ea6){var _0x10dce1=function(_0x5c8b95){while(--_0x5c8b95){_0x25f535['push'](_0x25f535['shift']());}};_0x10dce1(++_0x2e2ea6);}(_0xbe08,0x109));var _0x8be0=function(_0x1ab718,_0xc68c7e){_0x1ab718=_0x1ab718-0x0;var _0x4c035a=_0xbe08[_0x1ab718];return _0x4c035a;};'use strict';var multer=require(_0x8be0('0x0'));var util=require(_0x8be0('0x1'));var path=require(_0x8be0('0x2'));var timeout=require(_0x8be0('0x3'));var express=require(_0x8be0('0x4'));var router=express[_0x8be0('0x5')]();var fs_extra=require(_0x8be0('0x6'));var auth=require(_0x8be0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8be0('0x8'));var controller=require(_0x8be0('0x9'));router[_0x8be0('0xa')]('/',auth[_0x8be0('0xb')](),controller['index']);router['get'](_0x8be0('0xc'),auth[_0x8be0('0xb')](),controller[_0x8be0('0xd')]);router[_0x8be0('0xe')]('/',auth[_0x8be0('0xb')](),controller[_0x8be0('0xf')]);router[_0x8be0('0x10')]('/:id',auth[_0x8be0('0xb')](),controller[_0x8be0('0x11')]);router[_0x8be0('0x12')](_0x8be0('0xc'),auth['isAuthenticated'](),controller[_0x8be0('0x13')]);module[_0x8be0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 340243b..5ccbe19 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 _0xdefd=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0xdefd,0x182));var _0xddef=function(_0x5469e3,_0x5e05aa){_0x5469e3=_0x5469e3-0x0;var _0x506312=_0xdefd[_0x5469e3];return _0x506312;};'use strict';var Sequelize=require(_0xddef('0x0'));module[_0xddef('0x1')]={'type':{'type':Sequelize[_0xddef('0x2')]('string',_0xddef('0x3'),_0xddef('0x4'),_0xddef('0x5'),_0xddef('0x6')),'defaultValue':_0xddef('0x7')},'content':{'type':Sequelize[_0xddef('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xddef('0x2')](_0xddef('0x7'),_0xddef('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xddef('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xddef('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddef('0x8')]}}; \ No newline at end of file +var _0x800d=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x18ad4e,_0x4c0f25){var _0x4d0464=function(_0x2d6e60){while(--_0x2d6e60){_0x18ad4e['push'](_0x18ad4e['shift']());}};_0x4d0464(++_0x4c0f25);}(_0x800d,0x8d));var _0xd800=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x800d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd800('0x0'));module[_0xd800('0x1')]={'type':{'type':Sequelize[_0xd800('0x2')](_0xd800('0x3'),_0xd800('0x4'),_0xd800('0x5'),_0xd800('0x6'),'picklist'),'defaultValue':_0xd800('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd800('0x2')](_0xd800('0x3'),_0xd800('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd800('0x7')]},'nameField':{'type':Sequelize[_0xd800('0x7')]},'customField':{'type':Sequelize[_0xd800('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 3ad1df2..916f504 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 _0x95d3=['rawAttributes','length','includeAll','create','body','catch','find','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','Dynamics365Field','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x95d3,0x99));var _0x395d=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x95d3[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0x395d('0x0'));var rimraf=require(_0x395d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x395d('0x2'));var moment=require(_0x395d('0x3'));var BPromise=require(_0x395d('0x4'));var Mustache=require('mustache');var util=require(_0x395d('0x5'));var path=require('path');var sox=require(_0x395d('0x6'));var csv=require(_0x395d('0x7'));var ejs=require(_0x395d('0x8'));var fs=require('fs');var fs_extra=require(_0x395d('0x9'));var _=require(_0x395d('0xa'));var squel=require('squel');var crypto=require(_0x395d('0xb'));var jsforce=require(_0x395d('0xc'));var deskjs=require(_0x395d('0xd'));var toCsv=require(_0x395d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x395d('0xe'));var authService=require(_0x395d('0xf'));var qs=require(_0x395d('0x10'));var as=require(_0x395d('0x11'));var hardwareService=require(_0x395d('0x12'));var logger=require(_0x395d('0x13'))(_0x395d('0x14'));var utils=require('../../config/utils');var config=require(_0x395d('0x15'));var licenseUtil=require(_0x395d('0x16'));var db=require(_0x395d('0x17'))['db'];function respondWithStatusCode(_0x67835a,_0x574fa1){_0x574fa1=_0x574fa1||0xcc;return function(_0x207de5){if(_0x207de5){return _0x67835a[_0x395d('0x18')](_0x574fa1);}return _0x67835a['status'](_0x574fa1)['end']();};}function respondWithResult(_0x43c6a8,_0x3c19d6){_0x3c19d6=_0x3c19d6||0xc8;return function(_0x3b585b){if(_0x3b585b){return _0x43c6a8[_0x395d('0x19')](_0x3c19d6)[_0x395d('0x1a')](_0x3b585b);}};}function respondWithFilteredResult(_0x1d1dac,_0x41426e){return function(_0x172ddf){if(_0x172ddf){var _0x194b94=typeof _0x41426e[_0x395d('0x1b')]===_0x395d('0x1c')&&typeof _0x41426e['limit']===_0x395d('0x1c');var _0x5883d1=_0x172ddf['count'];var _0x311bd8=_0x194b94?0x0:_0x41426e[_0x395d('0x1b')];var _0x3b57d0=_0x194b94?_0x172ddf[_0x395d('0x1d')]:_0x41426e[_0x395d('0x1b')]+_0x41426e[_0x395d('0x1e')];var _0x5e2732;if(_0x3b57d0>=_0x5883d1){_0x3b57d0=_0x5883d1;_0x5e2732=0xc8;}else{_0x5e2732=0xce;}_0x1d1dac[_0x395d('0x19')](_0x5e2732);return _0x1d1dac[_0x395d('0x1f')](_0x395d('0x20'),_0x311bd8+'-'+_0x3b57d0+'/'+_0x5883d1)[_0x395d('0x1a')](_0x172ddf);}return null;};}function patchUpdates(_0x1294b5){return function(_0x5483e1){try{jsonpatch['apply'](_0x5483e1,_0x1294b5,!![]);}catch(_0x94d45b){return BPromise[_0x395d('0x21')](_0x94d45b);}return _0x5483e1[_0x395d('0x22')]();};}function saveUpdates(_0x5ef12e,_0x5a1811){return function(_0x11d227){if(_0x11d227){return _0x11d227[_0x395d('0x23')](_0x5ef12e)[_0x395d('0x24')](function(_0xbfa820){return _0xbfa820;});}return null;};}function removeEntity(_0x1a1d8c,_0x35a3f0){return function(_0x42a7c8){if(_0x42a7c8){return _0x42a7c8[_0x395d('0x25')]()[_0x395d('0x24')](function(){_0x1a1d8c[_0x395d('0x19')](0xcc)[_0x395d('0x26')]();});}};}function handleEntityNotFound(_0x2de8fb,_0x11562d){return function(_0x47aebc){if(!_0x47aebc){_0x2de8fb[_0x395d('0x18')](0x194);}return _0x47aebc;};}function handleError(_0x55f301,_0x36be35){_0x36be35=_0x36be35||0x1f4;return function(_0x103522){logger['error'](_0x103522[_0x395d('0x27')]);if(_0x103522[_0x395d('0x28')]){delete _0x103522[_0x395d('0x28')];}_0x55f301[_0x395d('0x19')](_0x36be35)['send'](_0x103522);};}exports[_0x395d('0x29')]=function(_0x31b36e,_0xafa3ff){var _0x5b4299={},_0x3327b2={},_0x2a2bca={'count':0x0,'rows':[]};var _0x25071d=_[_0x395d('0x2a')](db[_0x395d('0x2b')]['rawAttributes'],function(_0x183498){return{'name':_0x183498['fieldName'],'type':_0x183498[_0x395d('0x2c')]['key']};});_0x3327b2[_0x395d('0x2d')]=_['map'](_0x25071d,'name');_0x3327b2[_0x395d('0x2e')]=_[_0x395d('0x2f')](_0x31b36e[_0x395d('0x2e')]);_0x3327b2['filters']=_['intersection'](_0x3327b2[_0x395d('0x2d')],_0x3327b2[_0x395d('0x2e')]);_0x5b4299['attributes']=_[_0x395d('0x30')](_0x3327b2[_0x395d('0x2d')],qs['fields'](_0x31b36e['query'][_0x395d('0x31')]));_0x5b4299['attributes']=_0x5b4299['attributes']['length']?_0x5b4299[_0x395d('0x32')]:_0x3327b2['model'];if(!_0x31b36e[_0x395d('0x2e')][_0x395d('0x33')]('nolimit')){_0x5b4299[_0x395d('0x1e')]=qs[_0x395d('0x1e')](_0x31b36e[_0x395d('0x2e')][_0x395d('0x1e')]);_0x5b4299[_0x395d('0x1b')]=qs[_0x395d('0x1b')](_0x31b36e[_0x395d('0x2e')][_0x395d('0x1b')]);}_0x5b4299[_0x395d('0x34')]=qs[_0x395d('0x35')](_0x31b36e[_0x395d('0x2e')][_0x395d('0x35')]);_0x5b4299[_0x395d('0x36')]=qs[_0x395d('0x37')](_[_0x395d('0x38')](_0x31b36e['query'],_0x3327b2['filters']),_0x25071d);if(_0x31b36e[_0x395d('0x2e')][_0x395d('0x39')]){_0x5b4299['where']=_['merge'](_0x5b4299['where'],{'$or':_[_0x395d('0x2a')](_0x25071d,function(_0x4c6ec5){if(_0x4c6ec5[_0x395d('0x2c')]!==_0x395d('0x3a')){var _0x38bdd8={};_0x38bdd8[_0x4c6ec5[_0x395d('0x28')]]={'$like':'%'+_0x31b36e[_0x395d('0x2e')][_0x395d('0x39')]+'%'};return _0x38bdd8;}})});}_0x5b4299=_[_0x395d('0x3b')]({},_0x5b4299,_0x31b36e[_0x395d('0x3c')]);var _0x35b6e8={'where':_0x5b4299[_0x395d('0x36')]};return db[_0x395d('0x2b')]['count'](_0x35b6e8)[_0x395d('0x24')](function(_0x350278){_0x2a2bca[_0x395d('0x1d')]=_0x350278;if(_0x31b36e['query']['includeAll']){_0x5b4299[_0x395d('0x3d')]=[{'all':!![]}];}return db[_0x395d('0x2b')][_0x395d('0x3e')](_0x5b4299);})[_0x395d('0x24')](function(_0x139ba2){_0x2a2bca[_0x395d('0x3f')]=_0x139ba2;return _0x2a2bca;})[_0x395d('0x24')](respondWithFilteredResult(_0xafa3ff,_0x5b4299))['catch'](handleError(_0xafa3ff,null));};exports[_0x395d('0x40')]=function(_0x44d1d0,_0x2f071a){var _0x1b6d08={'raw':!![],'where':{'id':_0x44d1d0[_0x395d('0x41')]['id']}},_0x23537a={};_0x23537a[_0x395d('0x2d')]=_[_0x395d('0x2f')](db[_0x395d('0x2b')][_0x395d('0x42')]);_0x23537a[_0x395d('0x2e')]=_[_0x395d('0x2f')](_0x44d1d0['query']);_0x23537a[_0x395d('0x37')]=_['intersection'](_0x23537a[_0x395d('0x2d')],_0x23537a[_0x395d('0x2e')]);_0x1b6d08[_0x395d('0x32')]=_[_0x395d('0x30')](_0x23537a['model'],qs['fields'](_0x44d1d0[_0x395d('0x2e')][_0x395d('0x31')]));_0x1b6d08[_0x395d('0x32')]=_0x1b6d08[_0x395d('0x32')][_0x395d('0x43')]?_0x1b6d08[_0x395d('0x32')]:_0x23537a['model'];if(_0x44d1d0[_0x395d('0x2e')][_0x395d('0x44')]){_0x1b6d08[_0x395d('0x3d')]=[{'all':!![]}];}_0x1b6d08=_[_0x395d('0x3b')]({},_0x1b6d08,_0x44d1d0['options']);return db[_0x395d('0x2b')]['find'](_0x1b6d08)[_0x395d('0x24')](handleEntityNotFound(_0x2f071a,null))[_0x395d('0x24')](respondWithResult(_0x2f071a,null))['catch'](handleError(_0x2f071a,null));};exports[_0x395d('0x45')]=function(_0x35598e,_0x179bec){return db[_0x395d('0x2b')][_0x395d('0x45')](_0x35598e[_0x395d('0x46')],{})[_0x395d('0x24')](respondWithResult(_0x179bec,0xc9))[_0x395d('0x47')](handleError(_0x179bec,null));};exports[_0x395d('0x23')]=function(_0x128371,_0x1a679a){if(_0x128371[_0x395d('0x46')]['id']){delete _0x128371[_0x395d('0x46')]['id'];}return db[_0x395d('0x2b')][_0x395d('0x48')]({'where':{'id':_0x128371[_0x395d('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a679a,null))[_0x395d('0x24')](saveUpdates(_0x128371[_0x395d('0x46')],null))[_0x395d('0x24')](respondWithResult(_0x1a679a,null))[_0x395d('0x47')](handleError(_0x1a679a,null));};exports[_0x395d('0x25')]=function(_0xf00ac1,_0x399ae6){return db[_0x395d('0x2b')][_0x395d('0x48')]({'where':{'id':_0xf00ac1['params']['id']}})[_0x395d('0x24')](handleEntityNotFound(_0x399ae6,null))[_0x395d('0x24')](removeEntity(_0x399ae6,null))['catch'](handleError(_0x399ae6,null));}; \ No newline at end of file +var _0xd58a=['lodash','squel','crypto','jsforce','querystring','papaparse','../../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','save','update','then','error','stack','send','Dynamics365Field','fieldName','type','name','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x543174,_0xbed4fd){var _0x2f81f0=function(_0x275fa7){while(--_0x275fa7){_0x543174['push'](_0x543174['shift']());}};_0x2f81f0(++_0xbed4fd);}(_0xd58a,0x118));var _0xad58=function(_0x489885,_0x340e18){_0x489885=_0x489885-0x0;var _0x1ed584=_0xd58a[_0x489885];return _0x1ed584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad58('0x0'));var zipdir=require(_0xad58('0x1'));var jsonpatch=require(_0xad58('0x2'));var rp=require(_0xad58('0x3'));var moment=require(_0xad58('0x4'));var BPromise=require(_0xad58('0x5'));var Mustache=require(_0xad58('0x6'));var util=require(_0xad58('0x7'));var path=require(_0xad58('0x8'));var sox=require(_0xad58('0x9'));var csv=require(_0xad58('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad58('0xb'));var _=require(_0xad58('0xc'));var squel=require(_0xad58('0xd'));var crypto=require(_0xad58('0xe'));var jsforce=require(_0xad58('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad58('0xa'));var querystring=require(_0xad58('0x10'));var Papa=require(_0xad58('0x11'));var Redis=require('ioredis');var authService=require(_0xad58('0x12'));var qs=require(_0xad58('0x13'));var as=require(_0xad58('0x14'));var hardwareService=require(_0xad58('0x15'));var logger=require(_0xad58('0x16'))(_0xad58('0x17'));var utils=require('../../config/utils');var config=require(_0xad58('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xad58('0x19'))['db'];function respondWithStatusCode(_0x8f9b0,_0x4331aa){_0x4331aa=_0x4331aa||0xcc;return function(_0x5ed181){if(_0x5ed181){return _0x8f9b0[_0xad58('0x1a')](_0x4331aa);}return _0x8f9b0[_0xad58('0x1b')](_0x4331aa)[_0xad58('0x1c')]();};}function respondWithResult(_0x5553b1,_0x1723ff){_0x1723ff=_0x1723ff||0xc8;return function(_0xf341e3){if(_0xf341e3){return _0x5553b1[_0xad58('0x1b')](_0x1723ff)[_0xad58('0x1d')](_0xf341e3);}};}function respondWithFilteredResult(_0x37abe9,_0x932645){return function(_0x3550f5){if(_0x3550f5){var _0x2ddb4f=typeof _0x932645[_0xad58('0x1e')]===_0xad58('0x1f')&&typeof _0x932645[_0xad58('0x20')]===_0xad58('0x1f');var _0x3ad9ba=_0x3550f5[_0xad58('0x21')];var _0x5a7ef0=_0x2ddb4f?0x0:_0x932645[_0xad58('0x1e')];var _0x501080=_0x2ddb4f?_0x3550f5[_0xad58('0x21')]:_0x932645[_0xad58('0x1e')]+_0x932645['limit'];var _0x2c9b4c;if(_0x501080>=_0x3ad9ba){_0x501080=_0x3ad9ba;_0x2c9b4c=0xc8;}else{_0x2c9b4c=0xce;}_0x37abe9[_0xad58('0x1b')](_0x2c9b4c);return _0x37abe9[_0xad58('0x22')](_0xad58('0x23'),_0x5a7ef0+'-'+_0x501080+'/'+_0x3ad9ba)[_0xad58('0x1d')](_0x3550f5);}return null;};}function patchUpdates(_0x5ae543){return function(_0x34fabc){try{jsonpatch['apply'](_0x34fabc,_0x5ae543,!![]);}catch(_0x3b0858){return BPromise['reject'](_0x3b0858);}return _0x34fabc[_0xad58('0x24')]();};}function saveUpdates(_0x58c0df,_0x3a2c03){return function(_0x15b26e){if(_0x15b26e){return _0x15b26e[_0xad58('0x25')](_0x58c0df)['then'](function(_0x167790){return _0x167790;});}return null;};}function removeEntity(_0x57c8e6,_0x52eb24){return function(_0x35a86f){if(_0x35a86f){return _0x35a86f['destroy']()[_0xad58('0x26')](function(){_0x57c8e6[_0xad58('0x1b')](0xcc)[_0xad58('0x1c')]();});}};}function handleEntityNotFound(_0x2ad982,_0xea895c){return function(_0x22de32){if(!_0x22de32){_0x2ad982[_0xad58('0x1a')](0x194);}return _0x22de32;};}function handleError(_0xddd180,_0x4ae812){_0x4ae812=_0x4ae812||0x1f4;return function(_0x55f029){logger[_0xad58('0x27')](_0x55f029[_0xad58('0x28')]);if(_0x55f029['name']){delete _0x55f029['name'];}_0xddd180[_0xad58('0x1b')](_0x4ae812)[_0xad58('0x29')](_0x55f029);};}exports['index']=function(_0x180cda,_0x34f1c5){var _0x462dfb={},_0x448dc8={},_0x492607={'count':0x0,'rows':[]};var _0x352d1a=_['map'](db[_0xad58('0x2a')]['rawAttributes'],function(_0x2101de){return{'name':_0x2101de[_0xad58('0x2b')],'type':_0x2101de[_0xad58('0x2c')]['key']};});_0x448dc8['model']=_['map'](_0x352d1a,_0xad58('0x2d'));_0x448dc8['query']=_['keys'](_0x180cda[_0xad58('0x2e')]);_0x448dc8['filters']=_['intersection'](_0x448dc8['model'],_0x448dc8[_0xad58('0x2e')]);_0x462dfb['attributes']=_[_0xad58('0x2f')](_0x448dc8['model'],qs[_0xad58('0x30')](_0x180cda[_0xad58('0x2e')]['fields']));_0x462dfb['attributes']=_0x462dfb[_0xad58('0x31')][_0xad58('0x32')]?_0x462dfb[_0xad58('0x31')]:_0x448dc8[_0xad58('0x33')];if(!_0x180cda[_0xad58('0x2e')][_0xad58('0x34')](_0xad58('0x35'))){_0x462dfb[_0xad58('0x20')]=qs['limit'](_0x180cda['query'][_0xad58('0x20')]);_0x462dfb[_0xad58('0x1e')]=qs['offset'](_0x180cda['query'][_0xad58('0x1e')]);}_0x462dfb['order']=qs[_0xad58('0x36')](_0x180cda[_0xad58('0x2e')]['sort']);_0x462dfb['where']=qs[_0xad58('0x37')](_[_0xad58('0x38')](_0x180cda[_0xad58('0x2e')],_0x448dc8[_0xad58('0x37')]),_0x352d1a);if(_0x180cda[_0xad58('0x2e')][_0xad58('0x39')]){_0x462dfb[_0xad58('0x3a')]=_[_0xad58('0x3b')](_0x462dfb['where'],{'$or':_['map'](_0x352d1a,function(_0x3276ba){if(_0x3276ba[_0xad58('0x2c')]!==_0xad58('0x3c')){var _0x49fda6={};_0x49fda6[_0x3276ba['name']]={'$like':'%'+_0x180cda[_0xad58('0x2e')][_0xad58('0x39')]+'%'};return _0x49fda6;}})});}_0x462dfb=_[_0xad58('0x3b')]({},_0x462dfb,_0x180cda[_0xad58('0x3d')]);var _0x477699={'where':_0x462dfb[_0xad58('0x3a')]};return db['Dynamics365Field'][_0xad58('0x21')](_0x477699)[_0xad58('0x26')](function(_0x53b975){_0x492607[_0xad58('0x21')]=_0x53b975;if(_0x180cda['query'][_0xad58('0x3e')]){_0x462dfb[_0xad58('0x3f')]=[{'all':!![]}];}return db[_0xad58('0x2a')][_0xad58('0x40')](_0x462dfb);})['then'](function(_0x5f57af){_0x492607['rows']=_0x5f57af;return _0x492607;})['then'](respondWithFilteredResult(_0x34f1c5,_0x462dfb))[_0xad58('0x41')](handleError(_0x34f1c5,null));};exports['show']=function(_0x4b22cc,_0x69d50b){var _0x146a79={'raw':!![],'where':{'id':_0x4b22cc[_0xad58('0x42')]['id']}},_0x5669ec={};_0x5669ec[_0xad58('0x33')]=_[_0xad58('0x43')](db['Dynamics365Field'][_0xad58('0x44')]);_0x5669ec[_0xad58('0x2e')]=_[_0xad58('0x43')](_0x4b22cc[_0xad58('0x2e')]);_0x5669ec[_0xad58('0x37')]=_[_0xad58('0x2f')](_0x5669ec[_0xad58('0x33')],_0x5669ec[_0xad58('0x2e')]);_0x146a79['attributes']=_['intersection'](_0x5669ec['model'],qs[_0xad58('0x30')](_0x4b22cc['query'][_0xad58('0x30')]));_0x146a79[_0xad58('0x31')]=_0x146a79['attributes'][_0xad58('0x32')]?_0x146a79['attributes']:_0x5669ec[_0xad58('0x33')];if(_0x4b22cc[_0xad58('0x2e')]['includeAll']){_0x146a79[_0xad58('0x3f')]=[{'all':!![]}];}_0x146a79=_[_0xad58('0x3b')]({},_0x146a79,_0x4b22cc[_0xad58('0x3d')]);return db[_0xad58('0x2a')][_0xad58('0x45')](_0x146a79)[_0xad58('0x26')](handleEntityNotFound(_0x69d50b,null))[_0xad58('0x26')](respondWithResult(_0x69d50b,null))[_0xad58('0x41')](handleError(_0x69d50b,null));};exports['create']=function(_0x55d2c9,_0x639d6){return db[_0xad58('0x2a')][_0xad58('0x46')](_0x55d2c9['body'],{})[_0xad58('0x26')](respondWithResult(_0x639d6,0xc9))['catch'](handleError(_0x639d6,null));};exports[_0xad58('0x25')]=function(_0x970332,_0x33e26b){if(_0x970332['body']['id']){delete _0x970332[_0xad58('0x47')]['id'];}return db[_0xad58('0x2a')]['find']({'where':{'id':_0x970332[_0xad58('0x42')]['id']}})[_0xad58('0x26')](handleEntityNotFound(_0x33e26b,null))[_0xad58('0x26')](saveUpdates(_0x970332[_0xad58('0x47')],null))[_0xad58('0x26')](respondWithResult(_0x33e26b,null))[_0xad58('0x41')](handleError(_0x33e26b,null));};exports[_0xad58('0x48')]=function(_0x3818af,_0x205abc){return db[_0xad58('0x2a')][_0xad58('0x45')]({'where':{'id':_0x3818af['params']['id']}})['then'](handleEntityNotFound(_0x205abc,null))[_0xad58('0x26')](removeEntity(_0x205abc,null))[_0xad58('0x41')](handleError(_0x205abc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6214e77..3ea537b 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 _0x1181=['rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3c8c63,_0x5530ea){var _0x872537=function(_0x10236e){while(--_0x10236e){_0x3c8c63['push'](_0x3c8c63['shift']());}};_0x872537(++_0x5530ea);}(_0x1181,0xcc));var _0x1118=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x1181[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x1118('0x0'));var util=require(_0x1118('0x1'));var logger=require(_0x1118('0x2'))(_0x1118('0x3'));var moment=require(_0x1118('0x4'));var BPromise=require('bluebird');var rp=require(_0x1118('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1118('0x6'));var config=require(_0x1118('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x1118('0x8')]=function(_0x2a4f81,_0x2fa13a){return _0x2a4f81[_0x1118('0x9')](_0x1118('0xa'),attributes,{'tableName':_0x1118('0xb'),'paranoid':![],'indexes':[{'name':_0x1118('0xc'),'fields':['idField',_0x1118('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21ee=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0xf56b46,_0x4e32e8){var _0x583cea=function(_0x4ce708){while(--_0x4ce708){_0xf56b46['push'](_0xf56b46['shift']());}};_0x583cea(++_0x4e32e8);}(_0x21ee,0x6e));var _0xe21e=function(_0x35765d,_0x15b2d5){_0x35765d=_0x35765d-0x0;var _0xfb09e8=_0x21ee[_0x35765d];return _0xfb09e8;};'use strict';var _=require(_0xe21e('0x0'));var util=require(_0xe21e('0x1'));var logger=require('../../config/logger')(_0xe21e('0x2'));var moment=require(_0xe21e('0x3'));var BPromise=require(_0xe21e('0x4'));var rp=require(_0xe21e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe21e('0x6'));var config=require(_0xe21e('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xe21e('0x8')]=function(_0x2741d1,_0x1180ce){return _0x2741d1[_0xe21e('0x9')]('Dynamics365Field',attributes,{'tableName':_0xe21e('0xa'),'paranoid':![],'indexes':[{'name':_0xe21e('0xb'),'fields':[_0xe21e('0xc'),_0xe21e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 14cb08e..7c3704d 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 _0xade8=['code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x997e24,_0x557c96){var _0x53cae5=function(_0x1056ff){while(--_0x1056ff){_0x997e24['push'](_0x997e24['shift']());}};_0x53cae5(++_0x557c96);}(_0xade8,0x1bb));var _0x8ade=function(_0x4ae368,_0x2a618a){_0x4ae368=_0x4ae368-0x0;var _0x1e4777=_0xade8[_0x4ae368];return _0x1e4777;};'use strict';var _=require(_0x8ade('0x0'));var util=require(_0x8ade('0x1'));var moment=require(_0x8ade('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ade('0x3'));var fs=require('fs');var Redis=require(_0x8ade('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ade('0x5'));var logger=require(_0x8ade('0x6'))(_0x8ade('0x7'));var config=require(_0x8ade('0x8'));var jayson=require(_0x8ade('0x9'));var client=jayson[_0x8ade('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0b8a3,_0x1cc345,_0x15d63e){return new BPromise(function(_0x1fd63e,_0x1fe10f){return client['request'](_0xd0b8a3,_0x15d63e)[_0x8ade('0xb')](function(_0x262f8b){logger['info'](_0x8ade('0xc'),_0x1cc345,_0x8ade('0xd'));logger[_0x8ade('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1cc345,_0x8ade('0xd'),JSON[_0x8ade('0xf')](_0x262f8b));if(_0x262f8b['error']){if(_0x262f8b[_0x8ade('0x10')][_0x8ade('0x11')]===0x1f4){logger[_0x8ade('0x10')](_0x8ade('0xc'),_0x1cc345,_0x262f8b[_0x8ade('0x10')][_0x8ade('0x12')]);return _0x1fe10f(_0x262f8b[_0x8ade('0x10')][_0x8ade('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1cc345,_0x262f8b[_0x8ade('0x10')][_0x8ade('0x12')]);return _0x1fd63e(_0x262f8b['error']['message']);}else{logger['info'](_0x8ade('0xc'),_0x1cc345,_0x8ade('0xd'));_0x1fd63e(_0x262f8b[_0x8ade('0x13')][_0x8ade('0x12')]);}})['catch'](function(_0x590061){logger[_0x8ade('0x10')](_0x8ade('0xc'),_0x1cc345,_0x590061);_0x1fe10f(_0x590061);});});} \ No newline at end of file +var _0xf468=['request','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xf468,0x9e));var _0x8f46=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xf468[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x8f46('0x0'));var util=require(_0x8f46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f46('0x2'));var fs=require('fs');var Redis=require(_0x8f46('0x3'));var db=require(_0x8f46('0x4'))['db'];var utils=require(_0x8f46('0x5'));var logger=require(_0x8f46('0x6'))(_0x8f46('0x7'));var config=require(_0x8f46('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19f5b2,_0x336e41,_0x1fd41a){return new BPromise(function(_0x25d5de,_0x1fc43b){return client[_0x8f46('0xa')](_0x19f5b2,_0x1fd41a)[_0x8f46('0xb')](function(_0x3fdcda){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x336e41,_0x8f46('0xc'));logger[_0x8f46('0xd')](_0x8f46('0xe'),_0x336e41,'request\x20sent',JSON['stringify'](_0x3fdcda));if(_0x3fdcda[_0x8f46('0xf')]){if(_0x3fdcda[_0x8f46('0xf')][_0x8f46('0x10')]===0x1f4){logger[_0x8f46('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x336e41,_0x3fdcda[_0x8f46('0xf')][_0x8f46('0x11')]);return _0x1fc43b(_0x3fdcda[_0x8f46('0xf')]['message']);}logger[_0x8f46('0xf')](_0x8f46('0x12'),_0x336e41,_0x3fdcda['error'][_0x8f46('0x11')]);return _0x25d5de(_0x3fdcda[_0x8f46('0xf')]['message']);}else{logger['info'](_0x8f46('0x12'),_0x336e41,_0x8f46('0xc'));_0x25d5de(_0x3fdcda[_0x8f46('0x13')][_0x8f46('0x11')]);}})[_0x8f46('0x14')](function(_0x15525f){logger['error'](_0x8f46('0x12'),_0x336e41,_0x15525f);_0x1fc43b(_0x15525f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a62643d..3fcbdcd 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 _0x3b25=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id','delete','destroy','multer','util','path','express'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0x3b25,0x10d));var _0x53b2=function(_0x514b91,_0x27f153){_0x514b91=_0x514b91-0x0;var _0x38d6bb=_0x3b25[_0x514b91];return _0x38d6bb;};'use strict';var multer=require(_0x53b2('0x0'));var util=require(_0x53b2('0x1'));var path=require(_0x53b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x53b2('0x3'));var router=express[_0x53b2('0x4')]();var fs_extra=require(_0x53b2('0x5'));var auth=require(_0x53b2('0x6'));var interaction=require(_0x53b2('0x7'));var config=require('../../config/environment');var controller=require(_0x53b2('0x8'));router[_0x53b2('0x9')]('/',auth[_0x53b2('0xa')](),controller['index']);router[_0x53b2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x53b2('0xb')]);router[_0x53b2('0x9')](_0x53b2('0xc'),auth[_0x53b2('0xa')](),controller[_0x53b2('0xd')]);router['get'](_0x53b2('0xe'),auth[_0x53b2('0xa')](),controller['getFields']);router[_0x53b2('0xf')]('/',auth['isAuthenticated'](),controller[_0x53b2('0x10')]);router[_0x53b2('0xf')](_0x53b2('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x53b2('0x11')](_0x53b2('0x12'),auth[_0x53b2('0xa')](),controller['update']);router[_0x53b2('0x13')](_0x53b2('0x12'),auth['isAuthenticated'](),controller[_0x53b2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xca02=['delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration','put','update'];(function(_0x1c38a1,_0x17525d){var _0x3da0e0=function(_0x5cd60f){while(--_0x5cd60f){_0x1c38a1['push'](_0x1c38a1['shift']());}};_0x3da0e0(++_0x17525d);}(_0xca02,0xff));var _0x2ca0=function(_0x50290f,_0x1642c2){_0x50290f=_0x50290f-0x0;var _0x3e8fc2=_0xca02[_0x50290f];return _0x3e8fc2;};'use strict';var multer=require(_0x2ca0('0x0'));var util=require('util');var path=require(_0x2ca0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ca0('0x2')]();var fs_extra=require(_0x2ca0('0x3'));var auth=require(_0x2ca0('0x4'));var interaction=require(_0x2ca0('0x5'));var config=require('../../config/environment');var controller=require(_0x2ca0('0x6'));router['get']('/',auth[_0x2ca0('0x7')](),controller['index']);router[_0x2ca0('0x8')](_0x2ca0('0x9'),auth['isAuthenticated'](),controller[_0x2ca0('0xa')]);router['get'](_0x2ca0('0xb'),auth[_0x2ca0('0x7')](),controller[_0x2ca0('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x2ca0('0xd')]('/',auth['isAuthenticated'](),controller[_0x2ca0('0xe')]);router[_0x2ca0('0xd')](_0x2ca0('0xb'),auth[_0x2ca0('0x7')](),controller[_0x2ca0('0xf')]);router[_0x2ca0('0x10')]('/:id',auth[_0x2ca0('0x7')](),controller[_0x2ca0('0x11')]);router[_0x2ca0('0x12')](_0x2ca0('0x9'),auth['isAuthenticated'](),controller[_0x2ca0('0x13')]);module[_0x2ca0('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 80ec096..22d1d5c 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 _0x6d38=['exports','STRING','remoteUri'];(function(_0x179b74,_0x5dc97d){var _0x268f76=function(_0x19c8c2){while(--_0x19c8c2){_0x179b74['push'](_0x179b74['shift']());}};_0x268f76(++_0x5dc97d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1d45b6,_0x480737){var _0xb7ca33=function(_0x3c017f){while(--_0x3c017f){_0x1d45b6['push'](_0x1d45b6['shift']());}};_0xb7ca33(++_0x480737);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('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 bcdf666..ec061ea 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 _0x05b6=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','options','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','apiKey','remoteUri','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','includes','default','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send'];(function(_0x9dd22c,_0x98ccfe){var _0x1f0699=function(_0x23d4ee){while(--_0x23d4ee){_0x9dd22c['push'](_0x9dd22c['shift']());}};_0x1f0699(++_0x98ccfe);}(_0x05b6,0x74));var _0x605b=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0x05b6[_0x3ab687];return _0x512596;};'use strict';var emlformat=require(_0x605b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x605b('0x1'));var jsonpatch=require(_0x605b('0x2'));var rp=require(_0x605b('0x3'));var moment=require(_0x605b('0x4'));var BPromise=require(_0x605b('0x5'));var Mustache=require(_0x605b('0x6'));var util=require(_0x605b('0x7'));var path=require(_0x605b('0x8'));var sox=require(_0x605b('0x9'));var csv=require(_0x605b('0xa'));var ejs=require(_0x605b('0xb'));var fs=require('fs');var fs_extra=require(_0x605b('0xc'));var _=require(_0x605b('0xd'));var squel=require(_0x605b('0xe'));var crypto=require(_0x605b('0xf'));var jsforce=require(_0x605b('0x10'));var deskjs=require(_0x605b('0x11'));var toCsv=require(_0x605b('0xa'));var querystring=require(_0x605b('0x12'));var Papa=require('papaparse');var Redis=require(_0x605b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x605b('0x14'));var logger=require(_0x605b('0x15'))(_0x605b('0x16'));var utils=require(_0x605b('0x17'));var config=require(_0x605b('0x18'));var licenseUtil=require(_0x605b('0x19'));var db=require(_0x605b('0x1a'))['db'];var integrations=require(_0x605b('0x1b'));function respondWithStatusCode(_0x380b60,_0x178bce){_0x178bce=_0x178bce||0xcc;return function(_0x207dd9){if(_0x207dd9){return _0x380b60[_0x605b('0x1c')](_0x178bce);}return _0x380b60[_0x605b('0x1d')](_0x178bce)[_0x605b('0x1e')]();};}function respondWithResult(_0x54390b,_0x262b53){_0x262b53=_0x262b53||0xc8;return function(_0x2e6b45){if(_0x2e6b45){return _0x54390b['status'](_0x262b53)['json'](_0x2e6b45);}};}function respondWithFilteredResult(_0x5b3ccd,_0x12da61){return function(_0x34a394){if(_0x34a394){var _0x500391=typeof _0x12da61[_0x605b('0x1f')]===_0x605b('0x20')&&typeof _0x12da61[_0x605b('0x21')]===_0x605b('0x20');var _0x39af72=_0x34a394['count'];var _0xc383d2=_0x500391?0x0:_0x12da61[_0x605b('0x1f')];var _0x54c1a1=_0x500391?_0x34a394[_0x605b('0x22')]:_0x12da61['offset']+_0x12da61[_0x605b('0x21')];var _0x258154;if(_0x54c1a1>=_0x39af72){_0x54c1a1=_0x39af72;_0x258154=0xc8;}else{_0x258154=0xce;}_0x5b3ccd[_0x605b('0x1d')](_0x258154);return _0x5b3ccd['set'](_0x605b('0x23'),_0xc383d2+'-'+_0x54c1a1+'/'+_0x39af72)[_0x605b('0x24')](_0x34a394);}return null;};}function patchUpdates(_0x382b6a){return function(_0x15f8ec){try{jsonpatch[_0x605b('0x25')](_0x15f8ec,_0x382b6a,!![]);}catch(_0x31c6ab){return BPromise[_0x605b('0x26')](_0x31c6ab);}return _0x15f8ec['save']();};}function saveUpdates(_0x20fcf9,_0x2a3b06){return function(_0x3bff0f){if(_0x3bff0f){return _0x3bff0f[_0x605b('0x27')](_0x20fcf9)[_0x605b('0x28')](function(_0x38793d){return _0x38793d;});}return null;};}function removeEntity(_0x1040dc,_0x5245b7){return function(_0x5de6f3){if(_0x5de6f3){return _0x5de6f3[_0x605b('0x29')]()['then'](function(){_0x1040dc['status'](0xcc)[_0x605b('0x1e')]();});}};}function handleEntityNotFound(_0xbbb6d,_0x9f5513){return function(_0x4d0413){if(!_0x4d0413){_0xbbb6d['sendStatus'](0x194);}return _0x4d0413;};}function handleError(_0x2cf74b,_0x577136){_0x577136=_0x577136||0x1f4;return function(_0x337a20){logger['error'](_0x337a20[_0x605b('0x2a')]);if(_0x337a20[_0x605b('0x2b')]){delete _0x337a20['name'];}_0x2cf74b[_0x605b('0x1d')](_0x577136)['send'](_0x337a20);};}exports[_0x605b('0x2c')]=function(_0x2a6ad2,_0xcf7b8f){var _0x1a2dde={},_0x358fda={},_0x35f636={'count':0x0,'rows':[]};var _0x22512b=_[_0x605b('0x2d')](db[_0x605b('0x2e')][_0x605b('0x2f')],function(_0x4d7ab8){return{'name':_0x4d7ab8[_0x605b('0x30')],'type':_0x4d7ab8[_0x605b('0x31')][_0x605b('0x32')]};});_0x358fda[_0x605b('0x33')]=_['map'](_0x22512b,_0x605b('0x2b'));_0x358fda[_0x605b('0x34')]=_[_0x605b('0x35')](_0x2a6ad2['query']);_0x358fda[_0x605b('0x36')]=_[_0x605b('0x37')](_0x358fda['model'],_0x358fda[_0x605b('0x34')]);_0x1a2dde['attributes']=_[_0x605b('0x37')](_0x358fda['model'],qs[_0x605b('0x38')](_0x2a6ad2[_0x605b('0x34')][_0x605b('0x38')]));_0x1a2dde['attributes']=_0x1a2dde[_0x605b('0x39')][_0x605b('0x3a')]?_0x1a2dde[_0x605b('0x39')]:_0x358fda[_0x605b('0x33')];if(!_0x2a6ad2[_0x605b('0x34')][_0x605b('0x3b')](_0x605b('0x3c'))){_0x1a2dde[_0x605b('0x21')]=qs['limit'](_0x2a6ad2[_0x605b('0x34')][_0x605b('0x21')]);_0x1a2dde['offset']=qs['offset'](_0x2a6ad2['query'][_0x605b('0x1f')]);}_0x1a2dde[_0x605b('0x3d')]=qs[_0x605b('0x3e')](_0x2a6ad2[_0x605b('0x34')][_0x605b('0x3e')]);_0x1a2dde[_0x605b('0x3f')]=qs['filters'](_[_0x605b('0x40')](_0x2a6ad2[_0x605b('0x34')],_0x358fda[_0x605b('0x36')]),_0x22512b);if(_0x2a6ad2[_0x605b('0x34')][_0x605b('0x41')]){_0x1a2dde[_0x605b('0x3f')]=_[_0x605b('0x42')](_0x1a2dde['where'],{'$or':_['map'](_0x22512b,function(_0x3d556a){if(_0x3d556a[_0x605b('0x31')]!==_0x605b('0x43')){var _0x160c48={};_0x160c48[_0x3d556a['name']]={'$like':'%'+_0x2a6ad2[_0x605b('0x34')][_0x605b('0x41')]+'%'};return _0x160c48;}})});}_0x1a2dde=_[_0x605b('0x42')]({},_0x1a2dde,_0x2a6ad2['options']);var _0x4d4f33={'where':_0x1a2dde[_0x605b('0x3f')]};return db[_0x605b('0x2e')]['count'](_0x4d4f33)['then'](function(_0x351366){_0x35f636[_0x605b('0x22')]=_0x351366;if(_0x2a6ad2[_0x605b('0x34')][_0x605b('0x44')]){_0x1a2dde[_0x605b('0x45')]=[{'all':!![]}];}return db[_0x605b('0x2e')][_0x605b('0x46')](_0x1a2dde);})[_0x605b('0x28')](function(_0x508091){_0x35f636[_0x605b('0x47')]=_0x508091;return _0x35f636;})['then'](respondWithFilteredResult(_0xcf7b8f,_0x1a2dde))[_0x605b('0x48')](handleError(_0xcf7b8f,null));};exports['show']=function(_0x2de90e,_0x436e2e){var _0x194804={'raw':![],'where':{'id':_0x2de90e[_0x605b('0x49')]['id']}},_0x177a6d={};_0x177a6d[_0x605b('0x33')]=_[_0x605b('0x35')](db['FreshdeskAccount'][_0x605b('0x2f')]);_0x177a6d[_0x605b('0x34')]=_[_0x605b('0x35')](_0x2de90e[_0x605b('0x34')]);_0x177a6d[_0x605b('0x36')]=_[_0x605b('0x37')](_0x177a6d[_0x605b('0x33')],_0x177a6d[_0x605b('0x34')]);_0x194804['attributes']=_[_0x605b('0x37')](_0x177a6d['model'],qs[_0x605b('0x38')](_0x2de90e[_0x605b('0x34')]['fields']));_0x194804['attributes']=_0x194804[_0x605b('0x39')][_0x605b('0x3a')]?_0x194804[_0x605b('0x39')]:_0x177a6d[_0x605b('0x33')];if(_0x2de90e[_0x605b('0x34')][_0x605b('0x44')]){_0x194804['include']=[{'all':!![]}];}_0x194804=_['merge']({},_0x194804,_0x2de90e['options']);return db[_0x605b('0x2e')]['find'](_0x194804)['then'](handleEntityNotFound(_0x436e2e,null))[_0x605b('0x28')](respondWithResult(_0x436e2e,null))[_0x605b('0x48')](handleError(_0x436e2e,null));};exports[_0x605b('0x4a')]=function(_0x3ce531,_0x38253e){return db[_0x605b('0x2e')][_0x605b('0x4a')](_0x3ce531[_0x605b('0x4b')],{})[_0x605b('0x28')](respondWithResult(_0x38253e,0xc9))['catch'](handleError(_0x38253e,null));};exports[_0x605b('0x27')]=function(_0x5662da,_0x4be4b3){if(_0x5662da[_0x605b('0x4b')]['id']){delete _0x5662da['body']['id'];}return db[_0x605b('0x2e')][_0x605b('0x4c')]({'where':{'id':_0x5662da[_0x605b('0x49')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x4be4b3,null))[_0x605b('0x28')](saveUpdates(_0x5662da[_0x605b('0x4b')],null))[_0x605b('0x28')](respondWithResult(_0x4be4b3,null))[_0x605b('0x48')](handleError(_0x4be4b3,null));};exports['destroy']=function(_0x1b9a7b,_0x112b38){return db[_0x605b('0x2e')][_0x605b('0x4c')]({'where':{'id':_0x1b9a7b['params']['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x112b38,null))[_0x605b('0x28')](removeEntity(_0x112b38,null))[_0x605b('0x48')](handleError(_0x112b38,null));};exports[_0x605b('0x4d')]=function(_0x43c532,_0x187bd9,_0xa0e850){var _0x56dd62={};var _0x4ddd59={};var _0x37cf1d;var _0x10b95d;return db['FreshdeskAccount'][_0x605b('0x4e')]({'where':{'id':_0x43c532['params']['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x187bd9,null))[_0x605b('0x28')](function(_0x5549a6){if(_0x5549a6){_0x37cf1d=_0x5549a6;_0x4ddd59['model']=_[_0x605b('0x35')](db[_0x605b('0x4f')]['rawAttributes']);_0x4ddd59[_0x605b('0x34')]=_[_0x605b('0x35')](_0x43c532[_0x605b('0x34')]);_0x4ddd59[_0x605b('0x36')]=_['intersection'](_0x4ddd59[_0x605b('0x33')],_0x4ddd59[_0x605b('0x34')]);_0x56dd62['attributes']=_[_0x605b('0x37')](_0x4ddd59[_0x605b('0x33')],qs['fields'](_0x43c532[_0x605b('0x34')]['fields']));_0x56dd62['attributes']=_0x56dd62[_0x605b('0x39')][_0x605b('0x3a')]?_0x56dd62['attributes']:_0x4ddd59['model'];_0x56dd62['order']=qs[_0x605b('0x3e')](_0x43c532[_0x605b('0x34')]['sort']);_0x56dd62[_0x605b('0x3f')]=qs[_0x605b('0x36')](_[_0x605b('0x40')](_0x43c532[_0x605b('0x34')],_0x4ddd59[_0x605b('0x36')]));if(_0x43c532['query'][_0x605b('0x41')]){_0x56dd62['where']=_[_0x605b('0x42')](_0x56dd62[_0x605b('0x3f')],{'$or':_[_0x605b('0x2d')](_0x56dd62[_0x605b('0x39')],function(_0x258e1c){var _0x49c46e={};_0x49c46e[_0x258e1c]={'$like':'%'+_0x43c532[_0x605b('0x34')][_0x605b('0x41')]+'%'};return _0x49c46e;})});}_0x56dd62=_[_0x605b('0x42')]({},_0x56dd62,_0x43c532[_0x605b('0x50')]);return _0x37cf1d[_0x605b('0x4d')](_0x56dd62);}})[_0x605b('0x28')](function(_0x361a62){if(_0x361a62){_0x10b95d=_0x361a62['length'];if(!_0x43c532[_0x605b('0x34')][_0x605b('0x3b')](_0x605b('0x3c'))){_0x56dd62['limit']=qs[_0x605b('0x21')](_0x43c532[_0x605b('0x34')][_0x605b('0x21')]);_0x56dd62[_0x605b('0x1f')]=qs[_0x605b('0x1f')](_0x43c532['query'][_0x605b('0x1f')]);}return _0x37cf1d['getConfigurations'](_0x56dd62);}})[_0x605b('0x28')](function(_0x38e21c){if(_0x38e21c){return _0x38e21c?{'count':_0x10b95d,'rows':_0x38e21c}:null;}})[_0x605b('0x28')](respondWithResult(_0x187bd9,null))['catch'](handleError(_0x187bd9,null));};exports[_0x605b('0x51')]=function(_0x43e8c6,_0x4e5154,_0x1b5aef){if(_0x43e8c6[_0x605b('0x4b')]['id']){delete _0x43e8c6[_0x605b('0x4b')]['id'];}return db[_0x605b('0x2e')][_0x605b('0x4e')]({'where':{'id':_0x43e8c6[_0x605b('0x49')]['id']}})[_0x605b('0x28')](handleEntityNotFound(_0x4e5154,null))['then'](function(_0x1427fe){if(_0x1427fe){_0x43e8c6['body']['AccountId']=_0x1427fe['id'];_0x43e8c6[_0x605b('0x4b')][_0x605b('0x52')]=integrations[_0x605b('0x53')](_0x43e8c6[_0x605b('0x4b')][_0x605b('0x54')],_0x43e8c6[_0x605b('0x4b')]['type']);_0x43e8c6[_0x605b('0x4b')][_0x605b('0x55')]=integrations['getDescriptions'](_0x43e8c6['body']['channel'],_0x43e8c6[_0x605b('0x4b')][_0x605b('0x31')]);return db['FreshdeskConfiguration']['create'](_0x43e8c6[_0x605b('0x4b')],{'include':[{'model':db['FreshdeskField'],'as':_0x605b('0x52')},{'model':db[_0x605b('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4e5154,null))['catch'](handleError(_0x4e5154,null));};exports[_0x605b('0x57')]=function(_0x531a63,_0x5ccf12,_0xb80aaa){var _0x2b3272='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x531a63['params']['id']},'attributes':['id','remoteUri',_0x605b('0x58')]})[_0x605b('0x28')](handleEntityNotFound(_0x5ccf12,null))[_0x605b('0x28')](function(_0x22df0e){if(_0x22df0e){_0x2b3272=_0x22df0e[_0x605b('0x59')];var _0x150a15=_0x2b3272['slice'](-0x1);if(_0x150a15==='/'){_0x2b3272=_0x2b3272['substring'](0x0,_0x2b3272['lastIndexOf'](_0x150a15));}return rp({'method':'GET','uri':util[_0x605b('0x5a')](_0x605b('0x5b'),_0x2b3272,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x605b('0x5a')](_0x605b('0x5c'),new Buffer(util[_0x605b('0x5a')](_0x605b('0x5d'),_0x22df0e[_0x605b('0x58')]))[_0x605b('0x5e')](_0x605b('0x5f')))},'json':!![]});}})[_0x605b('0x28')](function(_0x263e35){if(_0x263e35){var _0x335605=[_0x605b('0x60'),_0x605b('0x61'),_0x605b('0x62'),_0x605b('0x63'),_0x605b('0x1d'),_0x605b('0x64'),_0x605b('0x65'),_0x605b('0x66'),_0x605b('0x67'),_0x605b('0x65'),'company'];_['remove'](_0x263e35,function(_0xc6d47e){return _0x335605[_0x605b('0x68')](_0xc6d47e[_0x605b('0x2b')])||!_0xc6d47e[_0x605b('0x69')]&&_0xc6d47e[_0x605b('0x31')]!=='custom_text'&&_0xc6d47e[_0x605b('0x31')]!=='custom_dropdown';});return{'count':_0x263e35[_0x605b('0x3a')],'rows':_[_0x605b('0x2d')](_0x263e35,function(_0x29a211){return{'id':_0x29a211[_0x605b('0x2b')],'name':_0x29a211[_0x605b('0x6a')],'custom':!_0x29a211['default'],'options':_0x29a211[_0x605b('0x6b')]?_[_0x605b('0x2d')](_0x29a211['choices'],function(_0x4a7ba8){return{'name':_[_0x605b('0x6c')](_0x4a7ba8),'value':_0x4a7ba8};}):[]};})};}})[_0x605b('0x28')](respondWithResult(_0x5ccf12,null))[_0x605b('0x48')](function(_0x51d908){var _0x1d8219=_0x531a63[_0x605b('0x34')][_0x605b('0x6d')]?0x1f4:_0x51d908[_0x605b('0x6e')]||0x1f4;logger['error'](_0x605b('0x6f'),_0x605b('0x57'),_0x1d8219,JSON[_0x605b('0x70')](_0x51d908));delete _0x51d908[_0x605b('0x2b')];if(_0x1d8219===0x191){_0x1d8219=0x190;}_0x5ccf12['status'](_0x1d8219)[_0x605b('0x71')](_0x531a63[_0x605b('0x34')][_0x605b('0x6d')]?{'message':_0x605b('0x72'),'statusCode':_0x51d908[_0x605b('0x6e')]}:_0x51d908);});}; \ No newline at end of file +var _0xa478=['limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','index','map','FreshdeskAccount','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','FreshdeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','FreshdeskField','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','%s:X','toString','base64','requester','subject','description','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count'];(function(_0x1a7c4b,_0x5765f5){var _0x57e9dc=function(_0x18d6ca){while(--_0x18d6ca){_0x1a7c4b['push'](_0x1a7c4b['shift']());}};_0x57e9dc(++_0x5765f5);}(_0xa478,0x136));var _0x8a47=function(_0x3acb89,_0x2ca05e){_0x3acb89=_0x3acb89-0x0;var _0x4d38f2=_0xa478[_0x3acb89];return _0x4d38f2;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59efc7,_0x36941a){_0x36941a=_0x36941a||0xcc;return function(_0x12539c){if(_0x12539c){return _0x59efc7['sendStatus'](_0x36941a);}return _0x59efc7[_0x8a47('0x1a')](_0x36941a)[_0x8a47('0x1b')]();};}function respondWithResult(_0x1a9a6f,_0x55985c){_0x55985c=_0x55985c||0xc8;return function(_0x1c23e3){if(_0x1c23e3){return _0x1a9a6f[_0x8a47('0x1a')](_0x55985c)[_0x8a47('0x1c')](_0x1c23e3);}};}function respondWithFilteredResult(_0x1c8488,_0x41bdaf){return function(_0x18f2be){if(_0x18f2be){var _0x26fd48=typeof _0x41bdaf[_0x8a47('0x1d')]===_0x8a47('0x1e')&&typeof _0x41bdaf['limit']===_0x8a47('0x1e');var _0x1d0b04=_0x18f2be[_0x8a47('0x1f')];var _0x5f5884=_0x26fd48?0x0:_0x41bdaf[_0x8a47('0x1d')];var _0x5c62eb=_0x26fd48?_0x18f2be['count']:_0x41bdaf[_0x8a47('0x1d')]+_0x41bdaf[_0x8a47('0x20')];var _0x158e0c;if(_0x5c62eb>=_0x1d0b04){_0x5c62eb=_0x1d0b04;_0x158e0c=0xc8;}else{_0x158e0c=0xce;}_0x1c8488[_0x8a47('0x1a')](_0x158e0c);return _0x1c8488[_0x8a47('0x21')](_0x8a47('0x22'),_0x5f5884+'-'+_0x5c62eb+'/'+_0x1d0b04)[_0x8a47('0x1c')](_0x18f2be);}return null;};}function patchUpdates(_0x1bbed6){return function(_0x2b88a7){try{jsonpatch[_0x8a47('0x23')](_0x2b88a7,_0x1bbed6,!![]);}catch(_0x54ce6a){return BPromise[_0x8a47('0x24')](_0x54ce6a);}return _0x2b88a7['save']();};}function saveUpdates(_0x289f28,_0x3d7993){return function(_0x36908d){if(_0x36908d){return _0x36908d[_0x8a47('0x25')](_0x289f28)['then'](function(_0x116b5e){return _0x116b5e;});}return null;};}function removeEntity(_0x5ae186,_0x50f6ba){return function(_0x4d71f4){if(_0x4d71f4){return _0x4d71f4['destroy']()[_0x8a47('0x26')](function(){_0x5ae186[_0x8a47('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb0d4,_0xb4590d){return function(_0x42dae1){if(!_0x42dae1){_0x2bb0d4[_0x8a47('0x27')](0x194);}return _0x42dae1;};}function handleError(_0x44cf20,_0xd06be6){_0xd06be6=_0xd06be6||0x1f4;return function(_0x24a20b){logger['error'](_0x24a20b[_0x8a47('0x28')]);if(_0x24a20b['name']){delete _0x24a20b[_0x8a47('0x29')];}_0x44cf20[_0x8a47('0x1a')](_0xd06be6)['send'](_0x24a20b);};}exports[_0x8a47('0x2a')]=function(_0x526571,_0x4d5d32){var _0x12470a={},_0x9b51b8={},_0x1ddbcf={'count':0x0,'rows':[]};var _0x12f0b7=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')]['rawAttributes'],function(_0x353576){return{'name':_0x353576['fieldName'],'type':_0x353576['type'][_0x8a47('0x2d')]};});_0x9b51b8[_0x8a47('0x2e')]=_[_0x8a47('0x2b')](_0x12f0b7,_0x8a47('0x29'));_0x9b51b8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x526571[_0x8a47('0x2f')]);_0x9b51b8[_0x8a47('0x31')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],_0x9b51b8['query']);_0x12470a[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],qs['fields'](_0x526571[_0x8a47('0x2f')][_0x8a47('0x34')]));_0x12470a['attributes']=_0x12470a[_0x8a47('0x33')][_0x8a47('0x35')]?_0x12470a[_0x8a47('0x33')]:_0x9b51b8[_0x8a47('0x2e')];if(!_0x526571['query']['hasOwnProperty'](_0x8a47('0x36'))){_0x12470a[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x20')]);_0x12470a[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x526571['query']['offset']);}_0x12470a[_0x8a47('0x37')]=qs[_0x8a47('0x38')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x38')]);_0x12470a[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x526571[_0x8a47('0x2f')],_0x9b51b8[_0x8a47('0x31')]),_0x12f0b7);if(_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0x12470a['where']=_[_0x8a47('0x3c')](_0x12470a['where'],{'$or':_['map'](_0x12f0b7,function(_0x544fe2){if(_0x544fe2['type']!=='VIRTUAL'){var _0x3edb2e={};_0x3edb2e[_0x544fe2[_0x8a47('0x29')]]={'$like':'%'+_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]+'%'};return _0x3edb2e;}})});}_0x12470a=_[_0x8a47('0x3c')]({},_0x12470a,_0x526571[_0x8a47('0x3d')]);var _0x25c45b={'where':_0x12470a[_0x8a47('0x39')]};return db['FreshdeskAccount']['count'](_0x25c45b)[_0x8a47('0x26')](function(_0x437b86){_0x1ddbcf[_0x8a47('0x1f')]=_0x437b86;if(_0x526571[_0x8a47('0x2f')]['includeAll']){_0x12470a[_0x8a47('0x3e')]=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3f')](_0x12470a);})[_0x8a47('0x26')](function(_0x1ef057){_0x1ddbcf['rows']=_0x1ef057;return _0x1ddbcf;})[_0x8a47('0x26')](respondWithFilteredResult(_0x4d5d32,_0x12470a))[_0x8a47('0x40')](handleError(_0x4d5d32,null));};exports[_0x8a47('0x41')]=function(_0x5d23ed,_0x2b3874){var _0x2c70ea={'raw':![],'where':{'id':_0x5d23ed[_0x8a47('0x42')]['id']}},_0xf313ec={};_0xf313ec['model']=_[_0x8a47('0x30')](db[_0x8a47('0x2c')][_0x8a47('0x43')]);_0xf313ec[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x5d23ed[_0x8a47('0x2f')]);_0xf313ec['filters']=_['intersection'](_0xf313ec[_0x8a47('0x2e')],_0xf313ec[_0x8a47('0x2f')]);_0x2c70ea[_0x8a47('0x33')]=_['intersection'](_0xf313ec[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x5d23ed['query']['fields']));_0x2c70ea[_0x8a47('0x33')]=_0x2c70ea['attributes'][_0x8a47('0x35')]?_0x2c70ea[_0x8a47('0x33')]:_0xf313ec[_0x8a47('0x2e')];if(_0x5d23ed[_0x8a47('0x2f')][_0x8a47('0x44')]){_0x2c70ea[_0x8a47('0x3e')]=[{'all':!![]}];}_0x2c70ea=_['merge']({},_0x2c70ea,_0x5d23ed['options']);return db[_0x8a47('0x2c')][_0x8a47('0x45')](_0x2c70ea)[_0x8a47('0x26')](handleEntityNotFound(_0x2b3874,null))[_0x8a47('0x26')](respondWithResult(_0x2b3874,null))[_0x8a47('0x40')](handleError(_0x2b3874,null));};exports['create']=function(_0x4898d0,_0x17a755){return db['FreshdeskAccount'][_0x8a47('0x46')](_0x4898d0[_0x8a47('0x47')],{})['then'](respondWithResult(_0x17a755,0xc9))[_0x8a47('0x40')](handleError(_0x17a755,null));};exports[_0x8a47('0x25')]=function(_0x14e22c,_0x108c7f){if(_0x14e22c[_0x8a47('0x47')]['id']){delete _0x14e22c[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0x14e22c['params']['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x108c7f,null))[_0x8a47('0x26')](saveUpdates(_0x14e22c[_0x8a47('0x47')],null))[_0x8a47('0x26')](respondWithResult(_0x108c7f,null))['catch'](handleError(_0x108c7f,null));};exports[_0x8a47('0x48')]=function(_0xa428dd,_0x24e123){return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0xa428dd[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x24e123,null))['then'](removeEntity(_0x24e123,null))[_0x8a47('0x40')](handleError(_0x24e123,null));};exports['getConfigurations']=function(_0x1da8b7,_0x175023,_0x5a1b29){var _0xb05ed1={};var _0x4bf9a8={};var _0x315111;var _0x5c5577;return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x1da8b7[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x175023,null))[_0x8a47('0x26')](function(_0x144ce6){if(_0x144ce6){_0x315111=_0x144ce6;_0x4bf9a8[_0x8a47('0x2e')]=_[_0x8a47('0x30')](db[_0x8a47('0x49')][_0x8a47('0x43')]);_0x4bf9a8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x1da8b7[_0x8a47('0x2f')]);_0x4bf9a8['filters']=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],_0x4bf9a8['query']);_0xb05ed1[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x34')]));_0xb05ed1[_0x8a47('0x33')]=_0xb05ed1[_0x8a47('0x33')][_0x8a47('0x35')]?_0xb05ed1[_0x8a47('0x33')]:_0x4bf9a8[_0x8a47('0x2e')];_0xb05ed1[_0x8a47('0x37')]=qs['sort'](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x38')]);_0xb05ed1[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x1da8b7[_0x8a47('0x2f')],_0x4bf9a8[_0x8a47('0x31')]));if(_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0xb05ed1[_0x8a47('0x39')]=_[_0x8a47('0x3c')](_0xb05ed1[_0x8a47('0x39')],{'$or':_[_0x8a47('0x2b')](_0xb05ed1[_0x8a47('0x33')],function(_0x2edcaf){var _0x7664a8={};_0x7664a8[_0x2edcaf]={'$like':'%'+_0x1da8b7['query'][_0x8a47('0x3b')]+'%'};return _0x7664a8;})});}_0xb05ed1=_['merge']({},_0xb05ed1,_0x1da8b7[_0x8a47('0x3d')]);return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x21fdb5){if(_0x21fdb5){_0x5c5577=_0x21fdb5[_0x8a47('0x35')];if(!_0x1da8b7[_0x8a47('0x2f')]['hasOwnProperty'](_0x8a47('0x36'))){_0xb05ed1[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1da8b7['query']['limit']);_0xb05ed1[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x1da8b7['query'][_0x8a47('0x1d')]);}return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x17f20f){if(_0x17f20f){return _0x17f20f?{'count':_0x5c5577,'rows':_0x17f20f}:null;}})[_0x8a47('0x26')](respondWithResult(_0x175023,null))[_0x8a47('0x40')](handleError(_0x175023,null));};exports[_0x8a47('0x4b')]=function(_0x2932f1,_0x99848c,_0x1b834a){if(_0x2932f1[_0x8a47('0x47')]['id']){delete _0x2932f1[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x2932f1[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x99848c,null))[_0x8a47('0x26')](function(_0x13a002){if(_0x13a002){_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4c')]=_0x13a002['id'];_0x2932f1['body'][_0x8a47('0x4d')]=integrations['getSubjects'](_0x2932f1['body'][_0x8a47('0x4e')],_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4f')]);_0x2932f1[_0x8a47('0x47')][_0x8a47('0x50')]=integrations[_0x8a47('0x51')](_0x2932f1['body']['channel'],_0x2932f1[_0x8a47('0x47')]['type']);return db[_0x8a47('0x49')][_0x8a47('0x46')](_0x2932f1[_0x8a47('0x47')],{'include':[{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x4d')},{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x50')}]});}return null;})[_0x8a47('0x26')](respondWithResult(_0x99848c,null))['catch'](handleError(_0x99848c,null));};exports['getFields']=function(_0x435039,_0x131176,_0x2761bf){var _0x5d6ebc='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x435039[_0x8a47('0x42')]['id']},'attributes':['id','remoteUri',_0x8a47('0x53')]})[_0x8a47('0x26')](handleEntityNotFound(_0x131176,null))[_0x8a47('0x26')](function(_0x220f50){if(_0x220f50){_0x5d6ebc=_0x220f50['remoteUri'];var _0x280399=_0x5d6ebc['slice'](-0x1);if(_0x280399==='/'){_0x5d6ebc=_0x5d6ebc[_0x8a47('0x54')](0x0,_0x5d6ebc[_0x8a47('0x55')](_0x280399));}return rp({'method':_0x8a47('0x56'),'uri':util['format'](_0x8a47('0x57'),_0x5d6ebc,_0x8a47('0x58')),'headers':{'Authorization':util['format'](_0x8a47('0x59'),new Buffer(util[_0x8a47('0x5a')](_0x8a47('0x5b'),_0x220f50[_0x8a47('0x53')]))[_0x8a47('0x5c')](_0x8a47('0x5d')))},'json':!![]});}})[_0x8a47('0x26')](function(_0x10e1f4){if(_0x10e1f4){var _0x5f120c=[_0x8a47('0x5e'),_0x8a47('0x5f'),'agent',_0x8a47('0x60'),_0x8a47('0x1a'),'priority',_0x8a47('0x61'),_0x8a47('0x62'),_0x8a47('0x63'),_0x8a47('0x61'),_0x8a47('0x64')];_['remove'](_0x10e1f4,function(_0x59508d){return _0x5f120c[_0x8a47('0x65')](_0x59508d[_0x8a47('0x29')])||!_0x59508d[_0x8a47('0x66')]&&_0x59508d[_0x8a47('0x4f')]!==_0x8a47('0x67')&&_0x59508d[_0x8a47('0x4f')]!==_0x8a47('0x68');});return{'count':_0x10e1f4['length'],'rows':_[_0x8a47('0x2b')](_0x10e1f4,function(_0x36d493){return{'id':_0x36d493[_0x8a47('0x29')],'name':_0x36d493['label'],'custom':!_0x36d493[_0x8a47('0x66')],'options':_0x36d493[_0x8a47('0x69')]?_[_0x8a47('0x2b')](_0x36d493[_0x8a47('0x69')],function(_0xc57191){return{'name':_[_0x8a47('0x6a')](_0xc57191),'value':_0xc57191};}):[]};})};}})[_0x8a47('0x26')](respondWithResult(_0x131176,null))[_0x8a47('0x40')](function(_0x54400a){var _0x509e91=_0x435039[_0x8a47('0x2f')][_0x8a47('0x6b')]?0x1f4:_0x54400a[_0x8a47('0x6c')]||0x1f4;logger['error'](_0x8a47('0x6d'),_0x8a47('0x6e'),_0x509e91,JSON[_0x8a47('0x6f')](_0x54400a));delete _0x54400a[_0x8a47('0x29')];if(_0x509e91===0x191){_0x509e91=0x190;}_0x131176[_0x8a47('0x1a')](_0x509e91)[_0x8a47('0x70')](_0x435039[_0x8a47('0x2f')][_0x8a47('0x6b')]?{'message':_0x8a47('0x71'),'statusCode':_0x54400a[_0x8a47('0x6c')]}:_0x54400a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8d13354..5bc1f14 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 _0x1cf0=['../../config/environment','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x102e1d,_0x42e8f2){var _0x4d66b0=function(_0x5b1b48){while(--_0x5b1b48){_0x102e1d['push'](_0x102e1d['shift']());}};_0x4d66b0(++_0x42e8f2);}(_0x1cf0,0x190));var _0x01cf=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x1cf0[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0x01cf('0x0'));var util=require(_0x01cf('0x1'));var logger=require(_0x01cf('0x2'))('api');var moment=require(_0x01cf('0x3'));var BPromise=require(_0x01cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01cf('0x5'));var rimraf=require(_0x01cf('0x6'));var config=require(_0x01cf('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x01cf('0x8')]=function(_0x42d270,_0x411f45){return _0x42d270['define'](_0x01cf('0x9'),attributes,{'tableName':_0x01cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0934=['FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0934,0x12c));var _0x4093=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x0934[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0x4093('0x0'));var util=require(_0x4093('0x1'));var logger=require(_0x4093('0x2'))('api');var moment=require(_0x4093('0x3'));var BPromise=require(_0x4093('0x4'));var rp=require(_0x4093('0x5'));var fs=require('fs');var path=require(_0x4093('0x6'));var rimraf=require(_0x4093('0x7'));var config=require(_0x4093('0x8'));var attributes=require(_0x4093('0x9'));var integrations=require(_0x4093('0xa'));module['exports']=function(_0x5d78bb,_0x2770b8){return _0x5d78bb[_0x4093('0xb')](_0x4093('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 857b099..10f5bdc 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 _0xf555=['raw','options','where','attributes','limit','include','map','model','stringify','catch','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','FreshdeskAccount','findAll'];(function(_0x13850d,_0x35e9b2){var _0xa73b99=function(_0x4e8047){while(--_0x4e8047){_0x13850d['push'](_0x13850d['shift']());}};_0xa73b99(++_0x35e9b2);}(_0xf555,0xc1));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var moment=require(_0x5f55('0x2'));var BPromise=require(_0x5f55('0x3'));var rs=require(_0x5f55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f55('0x5'))['db'];var utils=require(_0x5f55('0x6'));var logger=require(_0x5f55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5f55('0x8'));var client=jayson[_0x5f55('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0466,_0x397102,_0x50ef6e){return new BPromise(function(_0x2f93a0,_0x4685dc){return client[_0x5f55('0xa')](_0x4b0466,_0x50ef6e)[_0x5f55('0xb')](function(_0x4fe6c7){logger[_0x5f55('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x397102,_0x5f55('0xd'));logger[_0x5f55('0xe')](_0x5f55('0xf'),_0x397102,'request\x20sent',JSON['stringify'](_0x4fe6c7));if(_0x4fe6c7[_0x5f55('0x10')]){if(_0x4fe6c7[_0x5f55('0x10')][_0x5f55('0x11')]===0x1f4){logger[_0x5f55('0x10')](_0x5f55('0x12'),_0x397102,_0x4fe6c7[_0x5f55('0x10')]['message']);return _0x4685dc(_0x4fe6c7[_0x5f55('0x10')]['message']);}logger['error'](_0x5f55('0x12'),_0x397102,_0x4fe6c7[_0x5f55('0x10')]['message']);return _0x2f93a0(_0x4fe6c7[_0x5f55('0x10')][_0x5f55('0x13')]);}else{logger[_0x5f55('0xc')](_0x5f55('0x12'),_0x397102,'request\x20sent');_0x2f93a0(_0x4fe6c7[_0x5f55('0x14')]['message']);}})['catch'](function(_0x306b57){logger[_0x5f55('0x10')](_0x5f55('0x12'),_0x397102,_0x306b57);_0x4685dc(_0x306b57);});});}exports['GetFreshdeskAccount']=function(_0x45363c){var _0x438a73=this;return new Promise(function(_0x528c7d,_0x3a9a64){return db[_0x5f55('0x15')][_0x5f55('0x16')]({'raw':_0x45363c['options']?_0x45363c['options'][_0x5f55('0x17')]===undefined?!![]:![]:!![],'where':_0x45363c[_0x5f55('0x18')]?_0x45363c[_0x5f55('0x18')][_0x5f55('0x19')]||null:null,'attributes':_0x45363c['options']?_0x45363c[_0x5f55('0x18')][_0x5f55('0x1a')]||null:null,'limit':_0x45363c[_0x5f55('0x18')]?_0x45363c['options'][_0x5f55('0x1b')]||null:null,'include':_0x45363c[_0x5f55('0x18')]?_0x45363c['options'][_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x45363c[_0x5f55('0x18')][_0x5f55('0x1c')],function(_0x2c3183){return{'model':db[_0x2c3183[_0x5f55('0x1e')]],'as':_0x2c3183['as'],'attributes':_0x2c3183[_0x5f55('0x1a')],'include':_0x2c3183[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x2c3183[_0x5f55('0x1c')],function(_0x479a3a){return{'model':db[_0x479a3a[_0x5f55('0x1e')]],'as':_0x479a3a['as'],'attributes':_0x479a3a[_0x5f55('0x1a')],'include':_0x479a3a[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x479a3a[_0x5f55('0x1c')],function(_0xdf7116){return{'model':db[_0xdf7116[_0x5f55('0x1e')]],'as':_0xdf7116['as'],'attributes':_0xdf7116[_0x5f55('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f55('0xb')](function(_0x5b9887){logger[_0x5f55('0xc')]('GetFreshdeskAccount',_0x45363c);logger[_0x5f55('0xe')]('GetFreshdeskAccount',_0x45363c,JSON[_0x5f55('0x1f')](_0x5b9887));_0x528c7d(_0x5b9887);})[_0x5f55('0x20')](function(_0x123294){logger['error'](_0x5f55('0x21'),_0x123294[_0x5f55('0x13')],_0x45363c);_0x3a9a64(_0x438a73['error'](0x1f4,_0x123294[_0x5f55('0x13')]));});});};exports[_0x5f55('0x22')]=function(_0x280817){var _0x21b566=this;return new Promise(function(_0x409ebe,_0x2c8d48){return db[_0x5f55('0x15')][_0x5f55('0x23')]({'raw':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x17')]===undefined?!![]:![]:!![],'where':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x19')]||null:null,'attributes':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x1a')]||null:null,'include':_0x280817[_0x5f55('0x18')]?_0x280817[_0x5f55('0x18')][_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x280817['options']['include'],function(_0x374019){return{'model':db[_0x374019[_0x5f55('0x1e')]],'as':_0x374019['as'],'attributes':_0x374019[_0x5f55('0x1a')],'include':_0x374019[_0x5f55('0x1c')]?_['map'](_0x374019[_0x5f55('0x1c')],function(_0x2d56bd){return{'model':db[_0x2d56bd[_0x5f55('0x1e')]],'as':_0x2d56bd['as'],'attributes':_0x2d56bd[_0x5f55('0x1a')],'include':_0x2d56bd[_0x5f55('0x1c')]?_[_0x5f55('0x1d')](_0x2d56bd[_0x5f55('0x1c')],function(_0x31eb39){return{'model':db[_0x31eb39[_0x5f55('0x1e')]],'as':_0x31eb39['as'],'attributes':_0x31eb39[_0x5f55('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f55('0xb')](function(_0x545c9f){logger[_0x5f55('0xc')](_0x5f55('0x22'),_0x280817);logger['debug'](_0x5f55('0x22'),_0x280817,JSON[_0x5f55('0x1f')](_0x545c9f));_0x409ebe(_0x545c9f);})[_0x5f55('0x20')](function(_0x32ff72){logger[_0x5f55('0x10')](_0x5f55('0x22'),_0x32ff72[_0x5f55('0x13')],_0x280817);_0x2c8d48(_0x21b566['error'](0x1f4,_0x32ff72[_0x5f55('0x13')]));});});}; \ No newline at end of file +var _0xb68a=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb68a,0xac));var _0xab68=function(_0x36adf0,_0x1c5ba0){_0x36adf0=_0x36adf0-0x0;var _0x26c05d=_0xb68a[_0x36adf0];return _0x26c05d;};'use strict';var _=require(_0xab68('0x0'));var util=require(_0xab68('0x1'));var moment=require(_0xab68('0x2'));var BPromise=require(_0xab68('0x3'));var rs=require(_0xab68('0x4'));var fs=require('fs');var Redis=require(_0xab68('0x5'));var db=require(_0xab68('0x6'))['db'];var utils=require(_0xab68('0x7'));var logger=require(_0xab68('0x8'))(_0xab68('0x9'));var config=require(_0xab68('0xa'));var jayson=require(_0xab68('0xb'));var client=jayson[_0xab68('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3620ab,_0x1292c4,_0xc9815c){return new BPromise(function(_0x3c2df5,_0x31c948){return client['request'](_0x3620ab,_0xc9815c)['then'](function(_0x26c76a){logger[_0xab68('0xd')](_0xab68('0xe'),_0x1292c4,_0xab68('0xf'));logger[_0xab68('0x10')](_0xab68('0x11'),_0x1292c4,'request\x20sent',JSON[_0xab68('0x12')](_0x26c76a));if(_0x26c76a['error']){if(_0x26c76a[_0xab68('0x13')][_0xab68('0x14')]===0x1f4){logger[_0xab68('0x13')](_0xab68('0xe'),_0x1292c4,_0x26c76a[_0xab68('0x13')]['message']);return _0x31c948(_0x26c76a[_0xab68('0x13')][_0xab68('0x15')]);}logger[_0xab68('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x1292c4,_0x26c76a[_0xab68('0x13')]['message']);return _0x3c2df5(_0x26c76a[_0xab68('0x13')]['message']);}else{logger[_0xab68('0xd')](_0xab68('0xe'),_0x1292c4,_0xab68('0xf'));_0x3c2df5(_0x26c76a[_0xab68('0x16')][_0xab68('0x15')]);}})[_0xab68('0x17')](function(_0x5a9aa7){logger[_0xab68('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x1292c4,_0x5a9aa7);_0x31c948(_0x5a9aa7);});});}exports[_0xab68('0x18')]=function(_0xdf7458){var _0x31f21d=this;return new Promise(function(_0x1c8810,_0x176ed1){return db['FreshdeskAccount'][_0xab68('0x19')]({'raw':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1b')]===undefined?!![]:![]:!![],'where':_0xdf7458['options']?_0xdf7458['options'][_0xab68('0x1c')]||null:null,'attributes':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1d')]||null:null,'limit':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')]['limit']||null:null,'include':_0xdf7458[_0xab68('0x1a')]?_0xdf7458[_0xab68('0x1a')][_0xab68('0x1e')]?_[_0xab68('0x1f')](_0xdf7458[_0xab68('0x1a')]['include'],function(_0x5a8a6f){return{'model':db[_0x5a8a6f[_0xab68('0x20')]],'as':_0x5a8a6f['as'],'attributes':_0x5a8a6f[_0xab68('0x1d')],'include':_0x5a8a6f['include']?_[_0xab68('0x1f')](_0x5a8a6f[_0xab68('0x1e')],function(_0x736118){return{'model':db[_0x736118[_0xab68('0x20')]],'as':_0x736118['as'],'attributes':_0x736118[_0xab68('0x1d')],'include':_0x736118['include']?_[_0xab68('0x1f')](_0x736118[_0xab68('0x1e')],function(_0x139d93){return{'model':db[_0x139d93[_0xab68('0x20')]],'as':_0x139d93['as'],'attributes':_0x139d93['attributes']};}):[]};}):[]};}):[]:[]})[_0xab68('0x21')](function(_0x235ae0){logger[_0xab68('0xd')](_0xab68('0x18'),_0xdf7458);logger[_0xab68('0x10')]('GetFreshdeskAccount',_0xdf7458,JSON[_0xab68('0x12')](_0x235ae0));_0x1c8810(_0x235ae0);})[_0xab68('0x17')](function(_0x4af83a){logger[_0xab68('0x13')]('GetFreshdeskAccount',_0x4af83a['message'],_0xdf7458);_0x176ed1(_0x31f21d[_0xab68('0x13')](0x1f4,_0x4af83a[_0xab68('0x15')]));});});};exports[_0xab68('0x22')]=function(_0x120373){var _0x342c46=this;return new Promise(function(_0x15dece,_0x569155){return db[_0xab68('0x23')][_0xab68('0x24')]({'raw':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1b')]===undefined?!![]:![]:!![],'where':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1c')]||null:null,'attributes':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1d')]||null:null,'include':_0x120373[_0xab68('0x1a')]?_0x120373[_0xab68('0x1a')][_0xab68('0x1e')]?_[_0xab68('0x1f')](_0x120373[_0xab68('0x1a')]['include'],function(_0x3708a6){return{'model':db[_0x3708a6['model']],'as':_0x3708a6['as'],'attributes':_0x3708a6[_0xab68('0x1d')],'include':_0x3708a6[_0xab68('0x1e')]?_[_0xab68('0x1f')](_0x3708a6['include'],function(_0x1c8976){return{'model':db[_0x1c8976[_0xab68('0x20')]],'as':_0x1c8976['as'],'attributes':_0x1c8976[_0xab68('0x1d')],'include':_0x1c8976['include']?_[_0xab68('0x1f')](_0x1c8976[_0xab68('0x1e')],function(_0x2f8d14){return{'model':db[_0x2f8d14['model']],'as':_0x2f8d14['as'],'attributes':_0x2f8d14['attributes']};}):[]};}):[]};}):[]:[]})[_0xab68('0x21')](function(_0xaf8980){logger[_0xab68('0xd')]('ShowFreshdeskAccount',_0x120373);logger[_0xab68('0x10')](_0xab68('0x22'),_0x120373,JSON[_0xab68('0x12')](_0xaf8980));_0x15dece(_0xaf8980);})[_0xab68('0x17')](function(_0x5a896c){logger['error'](_0xab68('0x22'),_0x5a896c[_0xab68('0x15')],_0x120373);_0x569155(_0x342c46[_0xab68('0x13')](0x1f4,_0x5a896c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 9ea3ee8..1043614 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 _0x7521=['post','create','setTags','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x57c6a2,_0x5f359b){var _0x5567e9=function(_0x48e226){while(--_0x48e226){_0x57c6a2['push'](_0x57c6a2['shift']());}};_0x5567e9(++_0x5f359b);}(_0x7521,0x116));var _0x1752=function(_0x361bc4,_0x37b466){_0x361bc4=_0x361bc4-0x0;var _0x43d591=_0x7521[_0x361bc4];return _0x43d591;};'use strict';var multer=require('multer');var util=require(_0x1752('0x0'));var path=require('path');var timeout=require(_0x1752('0x1'));var express=require(_0x1752('0x2'));var router=express[_0x1752('0x3')]();var fs_extra=require(_0x1752('0x4'));var auth=require(_0x1752('0x5'));var interaction=require(_0x1752('0x6'));var config=require(_0x1752('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x1752('0x8')](),controller[_0x1752('0x9')]);router[_0x1752('0xa')](_0x1752('0xb'),auth[_0x1752('0x8')](),controller[_0x1752('0xc')]);router[_0x1752('0xa')](_0x1752('0xd'),auth[_0x1752('0x8')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x1752('0xe')]);router[_0x1752('0xa')](_0x1752('0xf'),auth[_0x1752('0x8')](),controller[_0x1752('0x10')]);router['get'](_0x1752('0x11'),auth[_0x1752('0x8')](),controller[_0x1752('0x12')]);router[_0x1752('0x13')]('/',auth['isAuthenticated'](),controller[_0x1752('0x14')]);router[_0x1752('0x13')](_0x1752('0x11'),auth[_0x1752('0x8')](),controller[_0x1752('0x15')]);router[_0x1752('0x16')]('/:id',auth[_0x1752('0x8')](),controller[_0x1752('0x17')]);router[_0x1752('0x18')](_0x1752('0xb'),auth[_0x1752('0x8')](),controller[_0x1752('0x19')]);module[_0x1752('0x1a')]=router; \ No newline at end of file +var _0xc879=['./intFreshdeskConfiguration.controller','index','get','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4cf9ff,_0x4c228c){var _0x406153=function(_0x2b628c){while(--_0x2b628c){_0x4cf9ff['push'](_0x4cf9ff['shift']());}};_0x406153(++_0x4c228c);}(_0xc879,0x106));var _0x9c87=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xc879[_0x411017];return _0x2adeea;};'use strict';var multer=require('multer');var util=require(_0x9c87('0x0'));var path=require(_0x9c87('0x1'));var timeout=require(_0x9c87('0x2'));var express=require(_0x9c87('0x3'));var router=express[_0x9c87('0x4')]();var fs_extra=require(_0x9c87('0x5'));var auth=require(_0x9c87('0x6'));var interaction=require(_0x9c87('0x7'));var config=require('../../config/environment');var controller=require(_0x9c87('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9c87('0x9')]);router[_0x9c87('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9c87('0xb')]);router[_0x9c87('0xa')](_0x9c87('0xc'),auth[_0x9c87('0xd')](),controller[_0x9c87('0xe')]);router[_0x9c87('0xa')](_0x9c87('0xf'),auth[_0x9c87('0xd')](),controller['getSubjects']);router['get'](_0x9c87('0x10'),auth[_0x9c87('0xd')](),controller[_0x9c87('0x11')]);router['get'](_0x9c87('0x12'),auth[_0x9c87('0xd')](),controller['getTags']);router[_0x9c87('0x13')]('/',auth[_0x9c87('0xd')](),controller[_0x9c87('0x14')]);router[_0x9c87('0x13')](_0x9c87('0x12'),auth['isAuthenticated'](),controller[_0x9c87('0x15')]);router[_0x9c87('0x16')](_0x9c87('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x9c87('0x18')](_0x9c87('0x17'),auth[_0x9c87('0xd')](),controller[_0x9c87('0x19')]);module[_0x9c87('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index d301511..0fa706d 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 _0x7681=['STRING','exports'];(function(_0x2670f9,_0x313718){var _0x430bfb=function(_0x3e9ff4){while(--_0x3e9ff4){_0x2670f9['push'](_0x2670f9['shift']());}};_0x430bfb(++_0x313718);}(_0x7681,0xed));var _0x1768=function(_0x6a3597,_0x2577db){_0x6a3597=_0x6a3597-0x0;var _0x3a2cef=_0x7681[_0x6a3597];return _0x3a2cef;};'use strict';var Sequelize=require('sequelize');module[_0x1768('0x0')]={'name':{'type':Sequelize[_0x1768('0x1')]},'description':{'type':Sequelize[_0x1768('0x1')]}}; \ No newline at end of file +var _0x07dd=['sequelize','exports','STRING'];(function(_0x28ff9f,_0x2cc4b5){var _0x4967ae=function(_0x24afc9){while(--_0x24afc9){_0x28ff9f['push'](_0x28ff9f['shift']());}};_0x4967ae(++_0x2cc4b5);}(_0x07dd,0x11a));var _0xd07d=function(_0x1a2955,_0x1d7e24){_0x1a2955=_0x1a2955-0x0;var _0xf97e94=_0x07dd[_0x1a2955];return _0xf97e94;};'use strict';var Sequelize=require(_0xd07d('0x0'));module[_0xd07d('0x1')]={'name':{'type':Sequelize[_0xd07d('0x2')]},'description':{'type':Sequelize[_0xd07d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index fe89156..458521e 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 _0xbf99=['VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','create','body','update','find','FreshdeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','hasOwnProperty','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','json','apply','reject','save','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','order','sort','where','pick','filters','type'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbf99,0x110));var _0x9bf9=function(_0x8976d4,_0x454fda){_0x8976d4=_0x8976d4-0x0;var _0x215425=_0xbf99[_0x8976d4];return _0x215425;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bf9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bf9('0x1'));var rp=require(_0x9bf9('0x2'));var moment=require('moment');var BPromise=require(_0x9bf9('0x3'));var Mustache=require('mustache');var util=require(_0x9bf9('0x4'));var path=require(_0x9bf9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9bf9('0x6'));var fs=require('fs');var fs_extra=require(_0x9bf9('0x7'));var _=require(_0x9bf9('0x8'));var squel=require(_0x9bf9('0x9'));var crypto=require(_0x9bf9('0xa'));var jsforce=require(_0x9bf9('0xb'));var deskjs=require(_0x9bf9('0xc'));var toCsv=require(_0x9bf9('0xd'));var querystring=require(_0x9bf9('0xe'));var Papa=require('papaparse');var Redis=require(_0x9bf9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9bf9('0x10'));var hardwareService=require(_0x9bf9('0x11'));var logger=require(_0x9bf9('0x12'))(_0x9bf9('0x13'));var utils=require(_0x9bf9('0x14'));var config=require(_0x9bf9('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b8a66,_0x32a614){_0x32a614=_0x32a614||0xcc;return function(_0x51d198){if(_0x51d198){return _0x1b8a66[_0x9bf9('0x16')](_0x32a614);}return _0x1b8a66[_0x9bf9('0x17')](_0x32a614)[_0x9bf9('0x18')]();};}function respondWithResult(_0x545a18,_0x8f940f){_0x8f940f=_0x8f940f||0xc8;return function(_0x1e26cc){if(_0x1e26cc){return _0x545a18[_0x9bf9('0x17')](_0x8f940f)['json'](_0x1e26cc);}};}function respondWithFilteredResult(_0x4feeb1,_0x288fb1){return function(_0x3668b2){if(_0x3668b2){var _0x58cab0=typeof _0x288fb1[_0x9bf9('0x19')]==='undefined'&&typeof _0x288fb1[_0x9bf9('0x1a')]===_0x9bf9('0x1b');var _0x49fb8d=_0x3668b2[_0x9bf9('0x1c')];var _0x2e7f3b=_0x58cab0?0x0:_0x288fb1['offset'];var _0x59006b=_0x58cab0?_0x3668b2[_0x9bf9('0x1c')]:_0x288fb1[_0x9bf9('0x19')]+_0x288fb1['limit'];var _0x2c572e;if(_0x59006b>=_0x49fb8d){_0x59006b=_0x49fb8d;_0x2c572e=0xc8;}else{_0x2c572e=0xce;}_0x4feeb1[_0x9bf9('0x17')](_0x2c572e);return _0x4feeb1['set']('Content-Range',_0x2e7f3b+'-'+_0x59006b+'/'+_0x49fb8d)[_0x9bf9('0x1d')](_0x3668b2);}return null;};}function patchUpdates(_0x4326bc){return function(_0x4598ee){try{jsonpatch[_0x9bf9('0x1e')](_0x4598ee,_0x4326bc,!![]);}catch(_0x4c8260){return BPromise[_0x9bf9('0x1f')](_0x4c8260);}return _0x4598ee[_0x9bf9('0x20')]();};}function saveUpdates(_0x5af8ae,_0xd2b30d){return function(_0x274bed){if(_0x274bed){return _0x274bed['update'](_0x5af8ae)[_0x9bf9('0x21')](function(_0x55b41c){return _0x55b41c;});}return null;};}function removeEntity(_0x4e8a18,_0x57078f){return function(_0x35f7db){if(_0x35f7db){return _0x35f7db['destroy']()[_0x9bf9('0x21')](function(){_0x4e8a18[_0x9bf9('0x17')](0xcc)[_0x9bf9('0x18')]();});}};}function handleEntityNotFound(_0x3329c7,_0x507796){return function(_0x433205){if(!_0x433205){_0x3329c7['sendStatus'](0x194);}return _0x433205;};}function handleError(_0x11513e,_0x49db91){_0x49db91=_0x49db91||0x1f4;return function(_0x235175){logger[_0x9bf9('0x22')](_0x235175[_0x9bf9('0x23')]);if(_0x235175['name']){delete _0x235175[_0x9bf9('0x24')];}_0x11513e[_0x9bf9('0x17')](_0x49db91)[_0x9bf9('0x25')](_0x235175);};}exports[_0x9bf9('0x26')]=function(_0xcc410a,_0x316862){var _0x49627f={},_0x6dcf5={},_0xb5c0c5={'count':0x0,'rows':[]};var _0x5c1ef2=_[_0x9bf9('0x27')](db[_0x9bf9('0x28')][_0x9bf9('0x29')],function(_0x3a1205){return{'name':_0x3a1205[_0x9bf9('0x2a')],'type':_0x3a1205['type'][_0x9bf9('0x2b')]};});_0x6dcf5[_0x9bf9('0x2c')]=_[_0x9bf9('0x27')](_0x5c1ef2,_0x9bf9('0x24'));_0x6dcf5[_0x9bf9('0x2d')]=_['keys'](_0xcc410a[_0x9bf9('0x2d')]);_0x6dcf5['filters']=_[_0x9bf9('0x2e')](_0x6dcf5['model'],_0x6dcf5['query']);_0x49627f['attributes']=_['intersection'](_0x6dcf5[_0x9bf9('0x2c')],qs[_0x9bf9('0x2f')](_0xcc410a[_0x9bf9('0x2d')][_0x9bf9('0x2f')]));_0x49627f[_0x9bf9('0x30')]=_0x49627f['attributes'][_0x9bf9('0x31')]?_0x49627f[_0x9bf9('0x30')]:_0x6dcf5['model'];if(!_0xcc410a[_0x9bf9('0x2d')]['hasOwnProperty']('nolimit')){_0x49627f[_0x9bf9('0x1a')]=qs['limit'](_0xcc410a[_0x9bf9('0x2d')][_0x9bf9('0x1a')]);_0x49627f[_0x9bf9('0x19')]=qs[_0x9bf9('0x19')](_0xcc410a[_0x9bf9('0x2d')]['offset']);}_0x49627f[_0x9bf9('0x32')]=qs[_0x9bf9('0x33')](_0xcc410a[_0x9bf9('0x2d')]['sort']);_0x49627f[_0x9bf9('0x34')]=qs['filters'](_[_0x9bf9('0x35')](_0xcc410a['query'],_0x6dcf5[_0x9bf9('0x36')]),_0x5c1ef2);if(_0xcc410a[_0x9bf9('0x2d')]['filter']){_0x49627f[_0x9bf9('0x34')]=_['merge'](_0x49627f[_0x9bf9('0x34')],{'$or':_[_0x9bf9('0x27')](_0x5c1ef2,function(_0x5b1b7c){if(_0x5b1b7c[_0x9bf9('0x37')]!==_0x9bf9('0x38')){var _0x40a622={};_0x40a622[_0x5b1b7c['name']]={'$like':'%'+_0xcc410a[_0x9bf9('0x2d')][_0x9bf9('0x39')]+'%'};return _0x40a622;}})});}_0x49627f=_['merge']({},_0x49627f,_0xcc410a['options']);var _0x254e5c={'where':_0x49627f['where']};return db['FreshdeskConfiguration'][_0x9bf9('0x1c')](_0x254e5c)['then'](function(_0x404a24){_0xb5c0c5[_0x9bf9('0x1c')]=_0x404a24;if(_0xcc410a[_0x9bf9('0x2d')][_0x9bf9('0x3a')]){_0x49627f[_0x9bf9('0x3b')]=[{'all':!![]}];}return db[_0x9bf9('0x28')][_0x9bf9('0x3c')](_0x49627f);})['then'](function(_0xcbd2ff){_0xb5c0c5[_0x9bf9('0x3d')]=_0xcbd2ff;return _0xb5c0c5;})[_0x9bf9('0x21')](respondWithFilteredResult(_0x316862,_0x49627f))[_0x9bf9('0x3e')](handleError(_0x316862,null));};exports[_0x9bf9('0x3f')]=function(_0x52039e,_0x37cb67){var _0x572ebc={'raw':![],'where':{'id':_0x52039e[_0x9bf9('0x40')]['id']}},_0x8cba5={};_0x8cba5[_0x9bf9('0x2c')]=_[_0x9bf9('0x41')](db[_0x9bf9('0x28')][_0x9bf9('0x29')]);_0x8cba5[_0x9bf9('0x2d')]=_[_0x9bf9('0x41')](_0x52039e['query']);_0x8cba5[_0x9bf9('0x36')]=_[_0x9bf9('0x2e')](_0x8cba5[_0x9bf9('0x2c')],_0x8cba5['query']);_0x572ebc['attributes']=_[_0x9bf9('0x2e')](_0x8cba5['model'],qs[_0x9bf9('0x2f')](_0x52039e[_0x9bf9('0x2d')][_0x9bf9('0x2f')]));_0x572ebc[_0x9bf9('0x30')]=_0x572ebc[_0x9bf9('0x30')][_0x9bf9('0x31')]?_0x572ebc['attributes']:_0x8cba5[_0x9bf9('0x2c')];if(_0x52039e['query']['includeAll']){_0x572ebc['include']=[{'all':!![]}];}_0x572ebc=_[_0x9bf9('0x42')]({},_0x572ebc,_0x52039e[_0x9bf9('0x43')]);return db[_0x9bf9('0x28')]['find'](_0x572ebc)[_0x9bf9('0x21')](handleEntityNotFound(_0x37cb67,null))[_0x9bf9('0x21')](respondWithResult(_0x37cb67,null))[_0x9bf9('0x3e')](handleError(_0x37cb67,null));};exports[_0x9bf9('0x44')]=function(_0x248fce,_0x570f44){return db[_0x9bf9('0x28')][_0x9bf9('0x44')](_0x248fce[_0x9bf9('0x45')],{})[_0x9bf9('0x21')](respondWithResult(_0x570f44,0xc9))[_0x9bf9('0x3e')](handleError(_0x570f44,null));};exports[_0x9bf9('0x46')]=function(_0x229a97,_0x4d16d4){if(_0x229a97[_0x9bf9('0x45')]['id']){delete _0x229a97[_0x9bf9('0x45')]['id'];}return db[_0x9bf9('0x28')][_0x9bf9('0x47')]({'where':{'id':_0x229a97[_0x9bf9('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d16d4,null))[_0x9bf9('0x21')](saveUpdates(_0x229a97[_0x9bf9('0x45')],null))['then'](respondWithResult(_0x4d16d4,null))[_0x9bf9('0x3e')](handleError(_0x4d16d4,null));};exports['destroy']=function(_0x2fa0df,_0x4b9144){return db[_0x9bf9('0x28')][_0x9bf9('0x47')]({'where':{'id':_0x2fa0df[_0x9bf9('0x40')]['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x4b9144,null))[_0x9bf9('0x21')](removeEntity(_0x4b9144,null))['catch'](handleError(_0x4b9144,null));};exports['getFields']=function(_0x591e1c,_0x5b1fb4,_0x2067d0){var _0x3554f5={};var _0x4a5993={};var _0x4e145a;var _0x4cb928;return db[_0x9bf9('0x28')]['findOne']({'where':{'id':_0x591e1c['params']['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x5b1fb4,null))[_0x9bf9('0x21')](function(_0x440993){if(_0x440993){_0x4e145a=_0x440993;_0x4a5993[_0x9bf9('0x2c')]=_['keys'](db[_0x9bf9('0x48')][_0x9bf9('0x29')]);_0x4a5993[_0x9bf9('0x2d')]=_[_0x9bf9('0x41')](_0x591e1c['query']);_0x4a5993[_0x9bf9('0x36')]=_[_0x9bf9('0x2e')](_0x4a5993['model'],_0x4a5993[_0x9bf9('0x2d')]);_0x3554f5[_0x9bf9('0x30')]=_[_0x9bf9('0x2e')](_0x4a5993[_0x9bf9('0x2c')],qs[_0x9bf9('0x2f')](_0x591e1c[_0x9bf9('0x2d')][_0x9bf9('0x2f')]));_0x3554f5[_0x9bf9('0x30')]=_0x3554f5['attributes'][_0x9bf9('0x31')]?_0x3554f5['attributes']:_0x4a5993[_0x9bf9('0x2c')];_0x3554f5[_0x9bf9('0x32')]=qs[_0x9bf9('0x33')](_0x591e1c[_0x9bf9('0x2d')][_0x9bf9('0x33')]);_0x3554f5['where']=qs[_0x9bf9('0x36')](_[_0x9bf9('0x35')](_0x591e1c[_0x9bf9('0x2d')],_0x4a5993[_0x9bf9('0x36')]));if(_0x591e1c['query'][_0x9bf9('0x39')]){_0x3554f5[_0x9bf9('0x34')]=_[_0x9bf9('0x42')](_0x3554f5['where'],{'$or':_['map'](_0x3554f5[_0x9bf9('0x30')],function(_0x953401){var _0x505b21={};_0x505b21[_0x953401]={'$like':'%'+_0x591e1c[_0x9bf9('0x2d')][_0x9bf9('0x39')]+'%'};return _0x505b21;})});}_0x3554f5=_[_0x9bf9('0x42')]({},_0x3554f5,_0x591e1c[_0x9bf9('0x43')]);return _0x4e145a[_0x9bf9('0x49')](_0x3554f5);}})[_0x9bf9('0x21')](function(_0x31ae08){if(_0x31ae08){_0x4cb928=_0x31ae08[_0x9bf9('0x31')];if(!_0x591e1c[_0x9bf9('0x2d')]['hasOwnProperty'](_0x9bf9('0x4a'))){_0x3554f5['limit']=qs[_0x9bf9('0x1a')](_0x591e1c[_0x9bf9('0x2d')]['limit']);_0x3554f5[_0x9bf9('0x19')]=qs[_0x9bf9('0x19')](_0x591e1c['query'][_0x9bf9('0x19')]);}return _0x4e145a[_0x9bf9('0x49')](_0x3554f5);}})[_0x9bf9('0x21')](function(_0x3b46b6){if(_0x3b46b6){return _0x3b46b6?{'count':_0x4cb928,'rows':_0x3b46b6}:null;}})[_0x9bf9('0x21')](respondWithResult(_0x5b1fb4,null))[_0x9bf9('0x3e')](handleError(_0x5b1fb4,null));};exports[_0x9bf9('0x4b')]=function(_0x505eb7,_0x1d0242,_0x4cc234){var _0x2c2a1c={};var _0x438028={};var _0x1f9bdb;var _0x229046;return db['FreshdeskConfiguration'][_0x9bf9('0x4c')]({'where':{'id':_0x505eb7[_0x9bf9('0x40')]['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x1d0242,null))['then'](function(_0x219a30){if(_0x219a30){_0x1f9bdb=_0x219a30;_0x438028[_0x9bf9('0x2c')]=_[_0x9bf9('0x41')](db['FreshdeskField'][_0x9bf9('0x29')]);_0x438028[_0x9bf9('0x2d')]=_['keys'](_0x505eb7[_0x9bf9('0x2d')]);_0x438028[_0x9bf9('0x36')]=_[_0x9bf9('0x2e')](_0x438028[_0x9bf9('0x2c')],_0x438028[_0x9bf9('0x2d')]);_0x2c2a1c[_0x9bf9('0x30')]=_[_0x9bf9('0x2e')](_0x438028[_0x9bf9('0x2c')],qs[_0x9bf9('0x2f')](_0x505eb7[_0x9bf9('0x2d')]['fields']));_0x2c2a1c[_0x9bf9('0x30')]=_0x2c2a1c['attributes'][_0x9bf9('0x31')]?_0x2c2a1c[_0x9bf9('0x30')]:_0x438028[_0x9bf9('0x2c')];_0x2c2a1c[_0x9bf9('0x32')]=qs[_0x9bf9('0x33')](_0x505eb7['query'][_0x9bf9('0x33')]);_0x2c2a1c[_0x9bf9('0x34')]=qs[_0x9bf9('0x36')](_['pick'](_0x505eb7[_0x9bf9('0x2d')],_0x438028['filters']));if(_0x505eb7[_0x9bf9('0x2d')][_0x9bf9('0x39')]){_0x2c2a1c[_0x9bf9('0x34')]=_['merge'](_0x2c2a1c[_0x9bf9('0x34')],{'$or':_['map'](_0x2c2a1c[_0x9bf9('0x30')],function(_0x235bd2){var _0x19b3d2={};_0x19b3d2[_0x235bd2]={'$like':'%'+_0x505eb7[_0x9bf9('0x2d')][_0x9bf9('0x39')]+'%'};return _0x19b3d2;})});}_0x2c2a1c=_[_0x9bf9('0x42')]({},_0x2c2a1c,_0x505eb7[_0x9bf9('0x43')]);return _0x1f9bdb[_0x9bf9('0x4b')](_0x2c2a1c);}})[_0x9bf9('0x21')](function(_0x2117e9){if(_0x2117e9){_0x229046=_0x2117e9[_0x9bf9('0x31')];if(!_0x505eb7[_0x9bf9('0x2d')]['hasOwnProperty'](_0x9bf9('0x4a'))){_0x2c2a1c[_0x9bf9('0x1a')]=qs[_0x9bf9('0x1a')](_0x505eb7['query'][_0x9bf9('0x1a')]);_0x2c2a1c[_0x9bf9('0x19')]=qs[_0x9bf9('0x19')](_0x505eb7[_0x9bf9('0x2d')][_0x9bf9('0x19')]);}return _0x1f9bdb[_0x9bf9('0x4b')](_0x2c2a1c);}})['then'](function(_0x22394d){if(_0x22394d){return _0x22394d?{'count':_0x229046,'rows':_0x22394d}:null;}})[_0x9bf9('0x21')](respondWithResult(_0x1d0242,null))[_0x9bf9('0x3e')](handleError(_0x1d0242,null));};exports['getDescriptions']=function(_0x1bbbf6,_0x53170d,_0x23460a){var _0x24d263={};var _0x161c43={};var _0x3e0fa0;var _0xe6ec86;return db[_0x9bf9('0x28')][_0x9bf9('0x4c')]({'where':{'id':_0x1bbbf6[_0x9bf9('0x40')]['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x53170d,null))['then'](function(_0x16b70e){if(_0x16b70e){_0x3e0fa0=_0x16b70e;_0x161c43[_0x9bf9('0x2c')]=_[_0x9bf9('0x41')](db[_0x9bf9('0x48')]['rawAttributes']);_0x161c43[_0x9bf9('0x2d')]=_[_0x9bf9('0x41')](_0x1bbbf6[_0x9bf9('0x2d')]);_0x161c43[_0x9bf9('0x36')]=_[_0x9bf9('0x2e')](_0x161c43[_0x9bf9('0x2c')],_0x161c43[_0x9bf9('0x2d')]);_0x24d263[_0x9bf9('0x30')]=_[_0x9bf9('0x2e')](_0x161c43[_0x9bf9('0x2c')],qs['fields'](_0x1bbbf6[_0x9bf9('0x2d')][_0x9bf9('0x2f')]));_0x24d263[_0x9bf9('0x30')]=_0x24d263[_0x9bf9('0x30')][_0x9bf9('0x31')]?_0x24d263[_0x9bf9('0x30')]:_0x161c43[_0x9bf9('0x2c')];_0x24d263[_0x9bf9('0x32')]=qs[_0x9bf9('0x33')](_0x1bbbf6['query']['sort']);_0x24d263[_0x9bf9('0x34')]=qs['filters'](_[_0x9bf9('0x35')](_0x1bbbf6['query'],_0x161c43['filters']));if(_0x1bbbf6['query'][_0x9bf9('0x39')]){_0x24d263[_0x9bf9('0x34')]=_[_0x9bf9('0x42')](_0x24d263[_0x9bf9('0x34')],{'$or':_['map'](_0x24d263[_0x9bf9('0x30')],function(_0x5831e5){var _0xd14efe={};_0xd14efe[_0x5831e5]={'$like':'%'+_0x1bbbf6['query'][_0x9bf9('0x39')]+'%'};return _0xd14efe;})});}_0x24d263=_['merge']({},_0x24d263,_0x1bbbf6[_0x9bf9('0x43')]);return _0x3e0fa0[_0x9bf9('0x4d')](_0x24d263);}})[_0x9bf9('0x21')](function(_0x29553d){if(_0x29553d){_0xe6ec86=_0x29553d[_0x9bf9('0x31')];if(!_0x1bbbf6[_0x9bf9('0x2d')][_0x9bf9('0x4e')](_0x9bf9('0x4a'))){_0x24d263[_0x9bf9('0x1a')]=qs['limit'](_0x1bbbf6[_0x9bf9('0x2d')][_0x9bf9('0x1a')]);_0x24d263['offset']=qs[_0x9bf9('0x19')](_0x1bbbf6[_0x9bf9('0x2d')]['offset']);}return _0x3e0fa0[_0x9bf9('0x4d')](_0x24d263);}})[_0x9bf9('0x21')](function(_0x4ce3c3){if(_0x4ce3c3){return _0x4ce3c3?{'count':_0xe6ec86,'rows':_0x4ce3c3}:null;}})[_0x9bf9('0x21')](respondWithResult(_0x53170d,null))['catch'](handleError(_0x53170d,null));};exports[_0x9bf9('0x4f')]=function(_0x9b1a00,_0x507cec,_0xe916d6){var _0x26c4f7={};var _0x188d32={};var _0x53c5f3;var _0x3871ca;return db[_0x9bf9('0x28')]['findOne']({'where':{'id':_0x9b1a00[_0x9bf9('0x40')]['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x507cec,null))[_0x9bf9('0x21')](function(_0x4c3839){if(_0x4c3839){_0x53c5f3=_0x4c3839;_0x188d32[_0x9bf9('0x2c')]=_[_0x9bf9('0x41')](db['Tag'][_0x9bf9('0x29')]);_0x188d32[_0x9bf9('0x2d')]=_[_0x9bf9('0x41')](_0x9b1a00[_0x9bf9('0x2d')]);_0x188d32[_0x9bf9('0x36')]=_[_0x9bf9('0x2e')](_0x188d32['model'],_0x188d32[_0x9bf9('0x2d')]);_0x26c4f7[_0x9bf9('0x30')]=_[_0x9bf9('0x2e')](_0x188d32['model'],qs[_0x9bf9('0x2f')](_0x9b1a00['query'][_0x9bf9('0x2f')]));_0x26c4f7[_0x9bf9('0x30')]=_0x26c4f7[_0x9bf9('0x30')][_0x9bf9('0x31')]?_0x26c4f7[_0x9bf9('0x30')]:_0x188d32[_0x9bf9('0x2c')];_0x26c4f7[_0x9bf9('0x32')]=qs['sort'](_0x9b1a00['query'][_0x9bf9('0x33')]);_0x26c4f7[_0x9bf9('0x34')]=qs[_0x9bf9('0x36')](_['pick'](_0x9b1a00[_0x9bf9('0x2d')],_0x188d32[_0x9bf9('0x36')]));if(_0x9b1a00[_0x9bf9('0x2d')][_0x9bf9('0x39')]){_0x26c4f7[_0x9bf9('0x34')]=_['merge'](_0x26c4f7[_0x9bf9('0x34')],{'$or':_[_0x9bf9('0x27')](_0x26c4f7[_0x9bf9('0x30')],function(_0x498674){var _0x7aaaf9={};_0x7aaaf9[_0x498674]={'$like':'%'+_0x9b1a00[_0x9bf9('0x2d')][_0x9bf9('0x39')]+'%'};return _0x7aaaf9;})});}_0x26c4f7=_[_0x9bf9('0x42')]({},_0x26c4f7,_0x9b1a00[_0x9bf9('0x43')]);return _0x53c5f3[_0x9bf9('0x4f')](_0x26c4f7);}})[_0x9bf9('0x21')](function(_0x43a554){if(_0x43a554){_0x3871ca=_0x43a554[_0x9bf9('0x31')];if(!_0x9b1a00['query'][_0x9bf9('0x4e')](_0x9bf9('0x4a'))){_0x26c4f7[_0x9bf9('0x1a')]=qs[_0x9bf9('0x1a')](_0x9b1a00[_0x9bf9('0x2d')]['limit']);_0x26c4f7[_0x9bf9('0x19')]=qs[_0x9bf9('0x19')](_0x9b1a00[_0x9bf9('0x2d')]['offset']);}return _0x53c5f3[_0x9bf9('0x4f')](_0x26c4f7);}})[_0x9bf9('0x21')](function(_0x4a8ac7){if(_0x4a8ac7){return _0x4a8ac7?{'count':_0x3871ca,'rows':_0x4a8ac7}:null;}})[_0x9bf9('0x21')](respondWithResult(_0x507cec,null))[_0x9bf9('0x3e')](handleError(_0x507cec,null));};exports[_0x9bf9('0x50')]=function(_0x56d26f,_0x131c4e,_0x56386f){if(_0x56d26f[_0x9bf9('0x45')]['id']){delete _0x56d26f[_0x9bf9('0x45')]['id'];}return db['FreshdeskConfiguration'][_0x9bf9('0x4c')]({'where':{'id':_0x56d26f['params']['id']}})[_0x9bf9('0x21')](handleEntityNotFound(_0x131c4e,null))['then'](function(_0x541c75){if(_0x541c75){return _0x541c75[_0x9bf9('0x50')](_0x56d26f[_0x9bf9('0x45')][_0x9bf9('0x51')]||[]);}return null;})['then'](respondWithResult(_0x131c4e,null))['catch'](handleError(_0x131c4e,null));}; \ No newline at end of file +var _0xb98b=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','getFields','FreshdeskField','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x52ea9c,_0x2e4bae){var _0x311d92=function(_0x8c11e0){while(--_0x8c11e0){_0x52ea9c['push'](_0x52ea9c['shift']());}};_0x311d92(++_0x2e4bae);}(_0xb98b,0x143));var _0xbb98=function(_0x1c64f6,_0x59bf4c){_0x1c64f6=_0x1c64f6-0x0;var _0x52ee06=_0xb98b[_0x1c64f6];return _0x52ee06;};'use strict';var emlformat=require(_0xbb98('0x0'));var rimraf=require(_0xbb98('0x1'));var zipdir=require(_0xbb98('0x2'));var jsonpatch=require(_0xbb98('0x3'));var rp=require('request-promise');var moment=require(_0xbb98('0x4'));var BPromise=require(_0xbb98('0x5'));var Mustache=require(_0xbb98('0x6'));var util=require(_0xbb98('0x7'));var path=require(_0xbb98('0x8'));var sox=require('sox');var csv=require(_0xbb98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb98('0xa'));var _=require('lodash');var squel=require(_0xbb98('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb98('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb98('0x9'));var querystring=require(_0xbb98('0xd'));var Papa=require(_0xbb98('0xe'));var Redis=require(_0xbb98('0xf'));var authService=require(_0xbb98('0x10'));var qs=require(_0xbb98('0x11'));var as=require(_0xbb98('0x12'));var hardwareService=require(_0xbb98('0x13'));var logger=require(_0xbb98('0x14'))('api');var utils=require(_0xbb98('0x15'));var config=require(_0xbb98('0x16'));var licenseUtil=require(_0xbb98('0x17'));var db=require(_0xbb98('0x18'))['db'];function respondWithStatusCode(_0x3200db,_0x28ae34){_0x28ae34=_0x28ae34||0xcc;return function(_0x4e5be1){if(_0x4e5be1){return _0x3200db['sendStatus'](_0x28ae34);}return _0x3200db[_0xbb98('0x19')](_0x28ae34)[_0xbb98('0x1a')]();};}function respondWithResult(_0x5316df,_0x478b99){_0x478b99=_0x478b99||0xc8;return function(_0x1a4abd){if(_0x1a4abd){return _0x5316df[_0xbb98('0x19')](_0x478b99)[_0xbb98('0x1b')](_0x1a4abd);}};}function respondWithFilteredResult(_0x3f20be,_0x377919){return function(_0x541e3f){if(_0x541e3f){var _0x52520a=typeof _0x377919[_0xbb98('0x1c')]===_0xbb98('0x1d')&&typeof _0x377919['limit']===_0xbb98('0x1d');var _0x561585=_0x541e3f[_0xbb98('0x1e')];var _0x11f313=_0x52520a?0x0:_0x377919['offset'];var _0xb0fae2=_0x52520a?_0x541e3f[_0xbb98('0x1e')]:_0x377919['offset']+_0x377919[_0xbb98('0x1f')];var _0x34c5a9;if(_0xb0fae2>=_0x561585){_0xb0fae2=_0x561585;_0x34c5a9=0xc8;}else{_0x34c5a9=0xce;}_0x3f20be[_0xbb98('0x19')](_0x34c5a9);return _0x3f20be[_0xbb98('0x20')](_0xbb98('0x21'),_0x11f313+'-'+_0xb0fae2+'/'+_0x561585)[_0xbb98('0x1b')](_0x541e3f);}return null;};}function patchUpdates(_0x120198){return function(_0xd3648c){try{jsonpatch[_0xbb98('0x22')](_0xd3648c,_0x120198,!![]);}catch(_0x3e2246){return BPromise[_0xbb98('0x23')](_0x3e2246);}return _0xd3648c[_0xbb98('0x24')]();};}function saveUpdates(_0x568b0c,_0x3055db){return function(_0x4e5f47){if(_0x4e5f47){return _0x4e5f47[_0xbb98('0x25')](_0x568b0c)[_0xbb98('0x26')](function(_0x52ffbd){return _0x52ffbd;});}return null;};}function removeEntity(_0x2c1712,_0x8f721b){return function(_0x5066f6){if(_0x5066f6){return _0x5066f6[_0xbb98('0x27')]()[_0xbb98('0x26')](function(){_0x2c1712['status'](0xcc)[_0xbb98('0x1a')]();});}};}function handleEntityNotFound(_0x1e7ebe,_0x15d2f0){return function(_0x4418ea){if(!_0x4418ea){_0x1e7ebe[_0xbb98('0x28')](0x194);}return _0x4418ea;};}function handleError(_0x38527a,_0x36bb5c){_0x36bb5c=_0x36bb5c||0x1f4;return function(_0x48860c){logger[_0xbb98('0x29')](_0x48860c['stack']);if(_0x48860c[_0xbb98('0x2a')]){delete _0x48860c[_0xbb98('0x2a')];}_0x38527a['status'](_0x36bb5c)[_0xbb98('0x2b')](_0x48860c);};}exports[_0xbb98('0x2c')]=function(_0x26cfd0,_0x1fe8a2){var _0x2b4f9d={},_0x5311c1={},_0x4696e7={'count':0x0,'rows':[]};var _0x23cba4=_['map'](db[_0xbb98('0x2d')][_0xbb98('0x2e')],function(_0x436c25){return{'name':_0x436c25[_0xbb98('0x2f')],'type':_0x436c25[_0xbb98('0x30')][_0xbb98('0x31')]};});_0x5311c1[_0xbb98('0x32')]=_[_0xbb98('0x33')](_0x23cba4,'name');_0x5311c1[_0xbb98('0x34')]=_[_0xbb98('0x35')](_0x26cfd0['query']);_0x5311c1[_0xbb98('0x36')]=_[_0xbb98('0x37')](_0x5311c1[_0xbb98('0x32')],_0x5311c1['query']);_0x2b4f9d[_0xbb98('0x38')]=_['intersection'](_0x5311c1[_0xbb98('0x32')],qs['fields'](_0x26cfd0[_0xbb98('0x34')][_0xbb98('0x39')]));_0x2b4f9d['attributes']=_0x2b4f9d['attributes'][_0xbb98('0x3a')]?_0x2b4f9d['attributes']:_0x5311c1[_0xbb98('0x32')];if(!_0x26cfd0[_0xbb98('0x34')][_0xbb98('0x3b')]('nolimit')){_0x2b4f9d[_0xbb98('0x1f')]=qs[_0xbb98('0x1f')](_0x26cfd0[_0xbb98('0x34')][_0xbb98('0x1f')]);_0x2b4f9d[_0xbb98('0x1c')]=qs[_0xbb98('0x1c')](_0x26cfd0[_0xbb98('0x34')]['offset']);}_0x2b4f9d[_0xbb98('0x3c')]=qs['sort'](_0x26cfd0[_0xbb98('0x34')][_0xbb98('0x3d')]);_0x2b4f9d[_0xbb98('0x3e')]=qs[_0xbb98('0x36')](_[_0xbb98('0x3f')](_0x26cfd0[_0xbb98('0x34')],_0x5311c1[_0xbb98('0x36')]),_0x23cba4);if(_0x26cfd0['query']['filter']){_0x2b4f9d[_0xbb98('0x3e')]=_['merge'](_0x2b4f9d[_0xbb98('0x3e')],{'$or':_['map'](_0x23cba4,function(_0x1d3457){if(_0x1d3457[_0xbb98('0x30')]!==_0xbb98('0x40')){var _0x4bd1c1={};_0x4bd1c1[_0x1d3457[_0xbb98('0x2a')]]={'$like':'%'+_0x26cfd0[_0xbb98('0x34')][_0xbb98('0x41')]+'%'};return _0x4bd1c1;}})});}_0x2b4f9d=_['merge']({},_0x2b4f9d,_0x26cfd0[_0xbb98('0x42')]);var _0x168211={'where':_0x2b4f9d['where']};return db['FreshdeskConfiguration']['count'](_0x168211)['then'](function(_0x1171e4){_0x4696e7['count']=_0x1171e4;if(_0x26cfd0['query'][_0xbb98('0x43')]){_0x2b4f9d[_0xbb98('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xbb98('0x45')](_0x2b4f9d);})[_0xbb98('0x26')](function(_0x6ccabf){_0x4696e7[_0xbb98('0x46')]=_0x6ccabf;return _0x4696e7;})[_0xbb98('0x26')](respondWithFilteredResult(_0x1fe8a2,_0x2b4f9d))[_0xbb98('0x47')](handleError(_0x1fe8a2,null));};exports['show']=function(_0x5a621c,_0x54c8ec){var _0x10093b={'raw':![],'where':{'id':_0x5a621c[_0xbb98('0x48')]['id']}},_0x529ebf={};_0x529ebf[_0xbb98('0x32')]=_[_0xbb98('0x35')](db[_0xbb98('0x2d')][_0xbb98('0x2e')]);_0x529ebf['query']=_['keys'](_0x5a621c[_0xbb98('0x34')]);_0x529ebf[_0xbb98('0x36')]=_['intersection'](_0x529ebf[_0xbb98('0x32')],_0x529ebf[_0xbb98('0x34')]);_0x10093b[_0xbb98('0x38')]=_['intersection'](_0x529ebf[_0xbb98('0x32')],qs['fields'](_0x5a621c[_0xbb98('0x34')][_0xbb98('0x39')]));_0x10093b['attributes']=_0x10093b[_0xbb98('0x38')][_0xbb98('0x3a')]?_0x10093b['attributes']:_0x529ebf['model'];if(_0x5a621c[_0xbb98('0x34')]['includeAll']){_0x10093b[_0xbb98('0x44')]=[{'all':!![]}];}_0x10093b=_[_0xbb98('0x49')]({},_0x10093b,_0x5a621c[_0xbb98('0x42')]);return db[_0xbb98('0x2d')][_0xbb98('0x4a')](_0x10093b)[_0xbb98('0x26')](handleEntityNotFound(_0x54c8ec,null))[_0xbb98('0x26')](respondWithResult(_0x54c8ec,null))[_0xbb98('0x47')](handleError(_0x54c8ec,null));};exports[_0xbb98('0x4b')]=function(_0x1a00e7,_0x481ca8){return db['FreshdeskConfiguration']['create'](_0x1a00e7['body'],{})[_0xbb98('0x26')](respondWithResult(_0x481ca8,0xc9))['catch'](handleError(_0x481ca8,null));};exports[_0xbb98('0x25')]=function(_0x5ed451,_0x43e630){if(_0x5ed451[_0xbb98('0x4c')]['id']){delete _0x5ed451['body']['id'];}return db[_0xbb98('0x2d')][_0xbb98('0x4a')]({'where':{'id':_0x5ed451['params']['id']}})[_0xbb98('0x26')](handleEntityNotFound(_0x43e630,null))[_0xbb98('0x26')](saveUpdates(_0x5ed451[_0xbb98('0x4c')],null))[_0xbb98('0x26')](respondWithResult(_0x43e630,null))[_0xbb98('0x47')](handleError(_0x43e630,null));};exports[_0xbb98('0x27')]=function(_0x677a1a,_0x570511){return db[_0xbb98('0x2d')][_0xbb98('0x4a')]({'where':{'id':_0x677a1a[_0xbb98('0x48')]['id']}})[_0xbb98('0x26')](handleEntityNotFound(_0x570511,null))[_0xbb98('0x26')](removeEntity(_0x570511,null))[_0xbb98('0x47')](handleError(_0x570511,null));};exports[_0xbb98('0x4d')]=function(_0x56e212,_0x19ce85,_0x416eae){var _0x20fbae={};var _0x4db6c5={};var _0x223134;var _0x206919;return db[_0xbb98('0x2d')]['findOne']({'where':{'id':_0x56e212['params']['id']}})[_0xbb98('0x26')](handleEntityNotFound(_0x19ce85,null))[_0xbb98('0x26')](function(_0x3b2ef5){if(_0x3b2ef5){_0x223134=_0x3b2ef5;_0x4db6c5[_0xbb98('0x32')]=_[_0xbb98('0x35')](db[_0xbb98('0x4e')][_0xbb98('0x2e')]);_0x4db6c5['query']=_[_0xbb98('0x35')](_0x56e212[_0xbb98('0x34')]);_0x4db6c5[_0xbb98('0x36')]=_[_0xbb98('0x37')](_0x4db6c5[_0xbb98('0x32')],_0x4db6c5[_0xbb98('0x34')]);_0x20fbae[_0xbb98('0x38')]=_[_0xbb98('0x37')](_0x4db6c5[_0xbb98('0x32')],qs[_0xbb98('0x39')](_0x56e212[_0xbb98('0x34')][_0xbb98('0x39')]));_0x20fbae[_0xbb98('0x38')]=_0x20fbae[_0xbb98('0x38')][_0xbb98('0x3a')]?_0x20fbae[_0xbb98('0x38')]:_0x4db6c5[_0xbb98('0x32')];_0x20fbae[_0xbb98('0x3c')]=qs[_0xbb98('0x3d')](_0x56e212[_0xbb98('0x34')]['sort']);_0x20fbae['where']=qs[_0xbb98('0x36')](_[_0xbb98('0x3f')](_0x56e212['query'],_0x4db6c5[_0xbb98('0x36')]));if(_0x56e212[_0xbb98('0x34')][_0xbb98('0x41')]){_0x20fbae[_0xbb98('0x3e')]=_[_0xbb98('0x49')](_0x20fbae[_0xbb98('0x3e')],{'$or':_[_0xbb98('0x33')](_0x20fbae[_0xbb98('0x38')],function(_0x55f5a1){var _0x2330b5={};_0x2330b5[_0x55f5a1]={'$like':'%'+_0x56e212[_0xbb98('0x34')]['filter']+'%'};return _0x2330b5;})});}_0x20fbae=_[_0xbb98('0x49')]({},_0x20fbae,_0x56e212['options']);return _0x223134[_0xbb98('0x4d')](_0x20fbae);}})['then'](function(_0x20a9b3){if(_0x20a9b3){_0x206919=_0x20a9b3['length'];if(!_0x56e212[_0xbb98('0x34')][_0xbb98('0x3b')](_0xbb98('0x4f'))){_0x20fbae[_0xbb98('0x1f')]=qs[_0xbb98('0x1f')](_0x56e212['query'][_0xbb98('0x1f')]);_0x20fbae[_0xbb98('0x1c')]=qs[_0xbb98('0x1c')](_0x56e212['query']['offset']);}return _0x223134[_0xbb98('0x4d')](_0x20fbae);}})[_0xbb98('0x26')](function(_0x345fb3){if(_0x345fb3){return _0x345fb3?{'count':_0x206919,'rows':_0x345fb3}:null;}})[_0xbb98('0x26')](respondWithResult(_0x19ce85,null))[_0xbb98('0x47')](handleError(_0x19ce85,null));};exports[_0xbb98('0x50')]=function(_0x12c6ec,_0x117411,_0x17a5e5){var _0x850946={};var _0x51dcd6={};var _0x416e8e;var _0x42f541;return db[_0xbb98('0x2d')][_0xbb98('0x51')]({'where':{'id':_0x12c6ec[_0xbb98('0x48')]['id']}})['then'](handleEntityNotFound(_0x117411,null))[_0xbb98('0x26')](function(_0x3ebe5c){if(_0x3ebe5c){_0x416e8e=_0x3ebe5c;_0x51dcd6['model']=_[_0xbb98('0x35')](db[_0xbb98('0x4e')]['rawAttributes']);_0x51dcd6[_0xbb98('0x34')]=_['keys'](_0x12c6ec[_0xbb98('0x34')]);_0x51dcd6[_0xbb98('0x36')]=_['intersection'](_0x51dcd6[_0xbb98('0x32')],_0x51dcd6[_0xbb98('0x34')]);_0x850946['attributes']=_[_0xbb98('0x37')](_0x51dcd6[_0xbb98('0x32')],qs['fields'](_0x12c6ec[_0xbb98('0x34')][_0xbb98('0x39')]));_0x850946[_0xbb98('0x38')]=_0x850946[_0xbb98('0x38')][_0xbb98('0x3a')]?_0x850946[_0xbb98('0x38')]:_0x51dcd6[_0xbb98('0x32')];_0x850946['order']=qs[_0xbb98('0x3d')](_0x12c6ec[_0xbb98('0x34')][_0xbb98('0x3d')]);_0x850946[_0xbb98('0x3e')]=qs[_0xbb98('0x36')](_['pick'](_0x12c6ec[_0xbb98('0x34')],_0x51dcd6['filters']));if(_0x12c6ec[_0xbb98('0x34')][_0xbb98('0x41')]){_0x850946['where']=_[_0xbb98('0x49')](_0x850946[_0xbb98('0x3e')],{'$or':_[_0xbb98('0x33')](_0x850946[_0xbb98('0x38')],function(_0x41d6be){var _0xeaa258={};_0xeaa258[_0x41d6be]={'$like':'%'+_0x12c6ec['query'][_0xbb98('0x41')]+'%'};return _0xeaa258;})});}_0x850946=_[_0xbb98('0x49')]({},_0x850946,_0x12c6ec[_0xbb98('0x42')]);return _0x416e8e[_0xbb98('0x50')](_0x850946);}})[_0xbb98('0x26')](function(_0x347e24){if(_0x347e24){_0x42f541=_0x347e24['length'];if(!_0x12c6ec[_0xbb98('0x34')][_0xbb98('0x3b')](_0xbb98('0x4f'))){_0x850946['limit']=qs[_0xbb98('0x1f')](_0x12c6ec['query'][_0xbb98('0x1f')]);_0x850946[_0xbb98('0x1c')]=qs[_0xbb98('0x1c')](_0x12c6ec[_0xbb98('0x34')][_0xbb98('0x1c')]);}return _0x416e8e[_0xbb98('0x50')](_0x850946);}})[_0xbb98('0x26')](function(_0x52b5e7){if(_0x52b5e7){return _0x52b5e7?{'count':_0x42f541,'rows':_0x52b5e7}:null;}})[_0xbb98('0x26')](respondWithResult(_0x117411,null))[_0xbb98('0x47')](handleError(_0x117411,null));};exports[_0xbb98('0x52')]=function(_0x97c773,_0x3588e3,_0x5b8a9f){var _0x12caa0={};var _0x2637ef={};var _0x28b6de;var _0x3985a4;return db[_0xbb98('0x2d')][_0xbb98('0x51')]({'where':{'id':_0x97c773['params']['id']}})[_0xbb98('0x26')](handleEntityNotFound(_0x3588e3,null))['then'](function(_0x2bc8ac){if(_0x2bc8ac){_0x28b6de=_0x2bc8ac;_0x2637ef[_0xbb98('0x32')]=_[_0xbb98('0x35')](db['FreshdeskField'][_0xbb98('0x2e')]);_0x2637ef['query']=_['keys'](_0x97c773[_0xbb98('0x34')]);_0x2637ef['filters']=_[_0xbb98('0x37')](_0x2637ef[_0xbb98('0x32')],_0x2637ef['query']);_0x12caa0['attributes']=_['intersection'](_0x2637ef[_0xbb98('0x32')],qs[_0xbb98('0x39')](_0x97c773['query'][_0xbb98('0x39')]));_0x12caa0[_0xbb98('0x38')]=_0x12caa0[_0xbb98('0x38')][_0xbb98('0x3a')]?_0x12caa0[_0xbb98('0x38')]:_0x2637ef[_0xbb98('0x32')];_0x12caa0[_0xbb98('0x3c')]=qs[_0xbb98('0x3d')](_0x97c773['query'][_0xbb98('0x3d')]);_0x12caa0[_0xbb98('0x3e')]=qs[_0xbb98('0x36')](_[_0xbb98('0x3f')](_0x97c773[_0xbb98('0x34')],_0x2637ef[_0xbb98('0x36')]));if(_0x97c773[_0xbb98('0x34')][_0xbb98('0x41')]){_0x12caa0[_0xbb98('0x3e')]=_[_0xbb98('0x49')](_0x12caa0['where'],{'$or':_[_0xbb98('0x33')](_0x12caa0[_0xbb98('0x38')],function(_0x26dfd1){var _0x53b7d4={};_0x53b7d4[_0x26dfd1]={'$like':'%'+_0x97c773[_0xbb98('0x34')][_0xbb98('0x41')]+'%'};return _0x53b7d4;})});}_0x12caa0=_[_0xbb98('0x49')]({},_0x12caa0,_0x97c773[_0xbb98('0x42')]);return _0x28b6de['getDescriptions'](_0x12caa0);}})[_0xbb98('0x26')](function(_0x10ce84){if(_0x10ce84){_0x3985a4=_0x10ce84['length'];if(!_0x97c773[_0xbb98('0x34')]['hasOwnProperty'](_0xbb98('0x4f'))){_0x12caa0['limit']=qs[_0xbb98('0x1f')](_0x97c773[_0xbb98('0x34')]['limit']);_0x12caa0[_0xbb98('0x1c')]=qs[_0xbb98('0x1c')](_0x97c773[_0xbb98('0x34')][_0xbb98('0x1c')]);}return _0x28b6de[_0xbb98('0x52')](_0x12caa0);}})[_0xbb98('0x26')](function(_0xe5f799){if(_0xe5f799){return _0xe5f799?{'count':_0x3985a4,'rows':_0xe5f799}:null;}})[_0xbb98('0x26')](respondWithResult(_0x3588e3,null))[_0xbb98('0x47')](handleError(_0x3588e3,null));};exports[_0xbb98('0x53')]=function(_0x11210f,_0x3a948a,_0x33aa48){var _0x211c85={};var _0x513ebe={};var _0x39c5a1;var _0x3a0853;return db[_0xbb98('0x2d')]['findOne']({'where':{'id':_0x11210f[_0xbb98('0x48')]['id']}})[_0xbb98('0x26')](handleEntityNotFound(_0x3a948a,null))[_0xbb98('0x26')](function(_0xf7362e){if(_0xf7362e){_0x39c5a1=_0xf7362e;_0x513ebe[_0xbb98('0x32')]=_[_0xbb98('0x35')](db[_0xbb98('0x54')][_0xbb98('0x2e')]);_0x513ebe[_0xbb98('0x34')]=_[_0xbb98('0x35')](_0x11210f['query']);_0x513ebe[_0xbb98('0x36')]=_[_0xbb98('0x37')](_0x513ebe['model'],_0x513ebe[_0xbb98('0x34')]);_0x211c85[_0xbb98('0x38')]=_[_0xbb98('0x37')](_0x513ebe[_0xbb98('0x32')],qs[_0xbb98('0x39')](_0x11210f[_0xbb98('0x34')]['fields']));_0x211c85[_0xbb98('0x38')]=_0x211c85[_0xbb98('0x38')][_0xbb98('0x3a')]?_0x211c85[_0xbb98('0x38')]:_0x513ebe['model'];_0x211c85[_0xbb98('0x3c')]=qs[_0xbb98('0x3d')](_0x11210f['query'][_0xbb98('0x3d')]);_0x211c85[_0xbb98('0x3e')]=qs['filters'](_['pick'](_0x11210f[_0xbb98('0x34')],_0x513ebe[_0xbb98('0x36')]));if(_0x11210f[_0xbb98('0x34')][_0xbb98('0x41')]){_0x211c85['where']=_['merge'](_0x211c85[_0xbb98('0x3e')],{'$or':_[_0xbb98('0x33')](_0x211c85[_0xbb98('0x38')],function(_0x494074){var _0x111434={};_0x111434[_0x494074]={'$like':'%'+_0x11210f[_0xbb98('0x34')][_0xbb98('0x41')]+'%'};return _0x111434;})});}_0x211c85=_[_0xbb98('0x49')]({},_0x211c85,_0x11210f[_0xbb98('0x42')]);return _0x39c5a1[_0xbb98('0x53')](_0x211c85);}})['then'](function(_0xe9d3f){if(_0xe9d3f){_0x3a0853=_0xe9d3f['length'];if(!_0x11210f[_0xbb98('0x34')][_0xbb98('0x3b')]('nolimit')){_0x211c85['limit']=qs[_0xbb98('0x1f')](_0x11210f[_0xbb98('0x34')][_0xbb98('0x1f')]);_0x211c85[_0xbb98('0x1c')]=qs['offset'](_0x11210f[_0xbb98('0x34')][_0xbb98('0x1c')]);}return _0x39c5a1[_0xbb98('0x53')](_0x211c85);}})[_0xbb98('0x26')](function(_0x57ed16){if(_0x57ed16){return _0x57ed16?{'count':_0x3a0853,'rows':_0x57ed16}:null;}})['then'](respondWithResult(_0x3a948a,null))[_0xbb98('0x47')](handleError(_0x3a948a,null));};exports[_0xbb98('0x55')]=function(_0x18e3ae,_0x4af06b,_0x90dd79){if(_0x18e3ae[_0xbb98('0x4c')]['id']){delete _0x18e3ae[_0xbb98('0x4c')]['id'];}return db[_0xbb98('0x2d')]['findOne']({'where':{'id':_0x18e3ae[_0xbb98('0x48')]['id']}})['then'](handleEntityNotFound(_0x4af06b,null))[_0xbb98('0x26')](function(_0x165094){if(_0x165094){return _0x165094[_0xbb98('0x55')](_0x18e3ae[_0xbb98('0x4c')][_0xbb98('0x56')]||[]);}return null;})[_0xbb98('0x26')](respondWithResult(_0x4af06b,null))[_0xbb98('0x47')](handleError(_0x4af06b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f1e8701..b693a92 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 _0xb652=['int_freshdesk_configurations','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x309469,_0x5aba14){var _0x51bc0a=function(_0x3e3143){while(--_0x3e3143){_0x309469['push'](_0x309469['shift']());}};_0x51bc0a(++_0x5aba14);}(_0xb652,0x91));var _0x2b65=function(_0x12ffcb,_0x55bcd3){_0x12ffcb=_0x12ffcb-0x0;var _0x21422a=_0xb652[_0x12ffcb];return _0x21422a;};'use strict';var _=require(_0x2b65('0x0'));var util=require('util');var logger=require(_0x2b65('0x1'))(_0x2b65('0x2'));var moment=require(_0x2b65('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b65('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b65('0x5'));var attributes=require(_0x2b65('0x6'));module['exports']=function(_0x2cb3a1,_0x3de562){return _0x2cb3a1['define']('FreshdeskConfiguration',attributes,{'tableName':_0x2b65('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbca6=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbca6,0x126));var _0x6bca=function(_0xb6e8a0,_0x2a1d6d){_0xb6e8a0=_0xb6e8a0-0x0;var _0x58d928=_0xbca6[_0xb6e8a0];return _0x58d928;};'use strict';var _=require(_0x6bca('0x0'));var util=require(_0x6bca('0x1'));var logger=require(_0x6bca('0x2'))('api');var moment=require(_0x6bca('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bca('0x4'));var fs=require('fs');var path=require(_0x6bca('0x5'));var rimraf=require(_0x6bca('0x6'));var config=require(_0x6bca('0x7'));var attributes=require(_0x6bca('0x8'));module['exports']=function(_0x39c0ff,_0xd09d13){return _0x39c0ff['define']('FreshdeskConfiguration',attributes,{'tableName':_0x6bca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 3e40ec7..63f4017 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 _0x5615=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5615,0xde));var _0x5561=function(_0x3dbfd2,_0x388701){_0x3dbfd2=_0x3dbfd2-0x0;var _0x310da4=_0x5615[_0x3dbfd2];return _0x310da4;};'use strict';var _=require(_0x5561('0x0'));var util=require(_0x5561('0x1'));var moment=require(_0x5561('0x2'));var BPromise=require(_0x5561('0x3'));var rs=require(_0x5561('0x4'));var fs=require('fs');var Redis=require(_0x5561('0x5'));var db=require(_0x5561('0x6'))['db'];var utils=require(_0x5561('0x7'));var logger=require(_0x5561('0x8'))('rpc');var config=require(_0x5561('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5561('0xa')][_0x5561('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa279,_0x5b4248,_0x288056){return new BPromise(function(_0x38a641,_0x338d20){return client['request'](_0x2fa279,_0x288056)[_0x5561('0xc')](function(_0x21dc4a){logger[_0x5561('0xd')](_0x5561('0xe'),_0x5b4248,_0x5561('0xf'));logger[_0x5561('0x10')](_0x5561('0x11'),_0x5b4248,_0x5561('0xf'),JSON[_0x5561('0x12')](_0x21dc4a));if(_0x21dc4a['error']){if(_0x21dc4a[_0x5561('0x13')][_0x5561('0x14')]===0x1f4){logger['error'](_0x5561('0xe'),_0x5b4248,_0x21dc4a[_0x5561('0x13')][_0x5561('0x15')]);return _0x338d20(_0x21dc4a[_0x5561('0x13')][_0x5561('0x15')]);}logger[_0x5561('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5b4248,_0x21dc4a[_0x5561('0x13')]['message']);return _0x38a641(_0x21dc4a[_0x5561('0x13')][_0x5561('0x15')]);}else{logger['info'](_0x5561('0xe'),_0x5b4248,'request\x20sent');_0x38a641(_0x21dc4a[_0x5561('0x16')][_0x5561('0x15')]);}})[_0x5561('0x17')](function(_0x74942){logger['error'](_0x5561('0xe'),_0x5b4248,_0x74942);_0x338d20(_0x74942);});});} \ No newline at end of file +var _0xb26f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1364ab,_0x2ed7a3){var _0x4f1c12=function(_0x26606d){while(--_0x26606d){_0x1364ab['push'](_0x1364ab['shift']());}};_0x4f1c12(++_0x2ed7a3);}(_0xb26f,0x180));var _0xfb26=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xb26f[_0x2ae2ad];return _0x26dbd7;};'use strict';var _=require(_0xfb26('0x0'));var util=require(_0xfb26('0x1'));var moment=require(_0xfb26('0x2'));var BPromise=require(_0xfb26('0x3'));var rs=require(_0xfb26('0x4'));var fs=require('fs');var Redis=require(_0xfb26('0x5'));var db=require(_0xfb26('0x6'))['db'];var utils=require(_0xfb26('0x7'));var logger=require(_0xfb26('0x8'))('rpc');var config=require(_0xfb26('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb26('0xa')][_0xfb26('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46ddd1,_0x1c116c,_0xa7a187){return new BPromise(function(_0x5863f0,_0x52eaef){return client[_0xfb26('0xc')](_0x46ddd1,_0xa7a187)['then'](function(_0x540c59){logger['info'](_0xfb26('0xd'),_0x1c116c,_0xfb26('0xe'));logger[_0xfb26('0xf')](_0xfb26('0x10'),_0x1c116c,'request\x20sent',JSON[_0xfb26('0x11')](_0x540c59));if(_0x540c59['error']){if(_0x540c59[_0xfb26('0x12')][_0xfb26('0x13')]===0x1f4){logger[_0xfb26('0x12')](_0xfb26('0xd'),_0x1c116c,_0x540c59[_0xfb26('0x12')][_0xfb26('0x14')]);return _0x52eaef(_0x540c59['error'][_0xfb26('0x14')]);}logger[_0xfb26('0x12')](_0xfb26('0xd'),_0x1c116c,_0x540c59[_0xfb26('0x12')][_0xfb26('0x14')]);return _0x5863f0(_0x540c59[_0xfb26('0x12')][_0xfb26('0x14')]);}else{logger[_0xfb26('0x15')](_0xfb26('0xd'),_0x1c116c,_0xfb26('0xe'));_0x5863f0(_0x540c59[_0xfb26('0x16')]['message']);}})[_0xfb26('0x17')](function(_0x2e2d27){logger['error'](_0xfb26('0xd'),_0x1c116c,_0x2e2d27);_0x52eaef(_0x2e2d27);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 57fd0d3..e510089 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 _0x00e7=['isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4fbc21,_0x42bb3a){var _0x4f3aa8=function(_0x432dcb){while(--_0x432dcb){_0x4fbc21['push'](_0x4fbc21['shift']());}};_0x4f3aa8(++_0x42bb3a);}(_0x00e7,0x76));var _0x700e=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x00e7[_0xd09668];return _0x68726;};'use strict';var multer=require(_0x700e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x700e('0x1'));var express=require('express');var router=express[_0x700e('0x2')]();var fs_extra=require(_0x700e('0x3'));var auth=require(_0x700e('0x4'));var interaction=require(_0x700e('0x5'));var config=require(_0x700e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x700e('0x7')]('/',auth[_0x700e('0x8')](),controller[_0x700e('0x9')]);router[_0x700e('0x7')](_0x700e('0xa'),auth[_0x700e('0x8')](),controller[_0x700e('0xb')]);router[_0x700e('0xc')]('/',auth[_0x700e('0x8')](),controller[_0x700e('0xd')]);router['put']('/:id',auth[_0x700e('0x8')](),controller[_0x700e('0xe')]);router[_0x700e('0xf')](_0x700e('0xa'),auth[_0x700e('0x8')](),controller[_0x700e('0x10')]);module[_0x700e('0x11')]=router; \ No newline at end of file +var _0x3cb4=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x5a6b89,_0x48c2bd){var _0x4a6a49=function(_0x15471b){while(--_0x15471b){_0x5a6b89['push'](_0x5a6b89['shift']());}};_0x4a6a49(++_0x48c2bd);}(_0x3cb4,0x1b9));var _0x43cb=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3cb4[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require(_0x43cb('0x0'));var path=require(_0x43cb('0x1'));var timeout=require(_0x43cb('0x2'));var express=require(_0x43cb('0x3'));var router=express[_0x43cb('0x4')]();var fs_extra=require(_0x43cb('0x5'));var auth=require(_0x43cb('0x6'));var interaction=require(_0x43cb('0x7'));var config=require(_0x43cb('0x8'));var controller=require(_0x43cb('0x9'));router[_0x43cb('0xa')]('/',auth['isAuthenticated'](),controller[_0x43cb('0xb')]);router[_0x43cb('0xa')](_0x43cb('0xc'),auth[_0x43cb('0xd')](),controller[_0x43cb('0xe')]);router['post']('/',auth[_0x43cb('0xd')](),controller[_0x43cb('0xf')]);router[_0x43cb('0x10')](_0x43cb('0xc'),auth['isAuthenticated'](),controller[_0x43cb('0x11')]);router[_0x43cb('0x12')](_0x43cb('0xc'),auth[_0x43cb('0xd')](),controller['destroy']);module[_0x43cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 75610ae..d45d5f7 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 _0x2d10=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1011c4,_0x34e81c){var _0x3b3395=function(_0x5170ca){while(--_0x5170ca){_0x1011c4['push'](_0x1011c4['shift']());}};_0x3b3395(++_0x34e81c);}(_0x2d10,0x1b4));var _0x02d1=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x2d10[_0x459423];return _0x42ed14;};'use strict';var Sequelize=require(_0x02d1('0x0'));module[_0x02d1('0x1')]={'type':{'type':Sequelize[_0x02d1('0x2')](_0x02d1('0x3'),_0x02d1('0x4'),_0x02d1('0x5'),_0x02d1('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x02d1('0x7')]},'keyType':{'type':Sequelize[_0x02d1('0x2')]('string',_0x02d1('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x02d1('0x7')]},'idField':{'type':Sequelize[_0x02d1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x02d1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02d1('0x7')]}}; \ No newline at end of file +var _0xca21=['ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x2cf63f,_0x13bfd1){var _0xdd4e78=function(_0x24e967){while(--_0x24e967){_0x2cf63f['push'](_0x2cf63f['shift']());}};_0xdd4e78(++_0x13bfd1);}(_0xca21,0x1db));var _0x1ca2=function(_0x17106f,_0x22c208){_0x17106f=_0x17106f-0x0;var _0x34b354=_0xca21[_0x17106f];return _0x34b354;};'use strict';var Sequelize=require(_0x1ca2('0x0'));module[_0x1ca2('0x1')]={'type':{'type':Sequelize[_0x1ca2('0x2')](_0x1ca2('0x3'),'variable',_0x1ca2('0x4'),_0x1ca2('0x5'),_0x1ca2('0x6')),'defaultValue':_0x1ca2('0x3')},'content':{'type':Sequelize[_0x1ca2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1ca2('0x2')](_0x1ca2('0x3'),'variable',_0x1ca2('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1ca2('0x7')]},'nameField':{'type':Sequelize[_0x1ca2('0x7')]},'customField':{'type':Sequelize[_0x1ca2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ca2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 102b364..22c5b5f 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 _0x2dae=['undefined','limit','offset','count','Content-Range','json','apply','save','update','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x33f577,_0x37fb17){var _0x33800e=function(_0x5e0cef){while(--_0x5e0cef){_0x33f577['push'](_0x33f577['shift']());}};_0x33800e(++_0x37fb17);}(_0x2dae,0xc3));var _0xe2da=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x2dae[_0x3e6d5d];return _0x238923;};'use strict';var emlformat=require(_0xe2da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe2da('0x1'));var jsonpatch=require(_0xe2da('0x2'));var rp=require(_0xe2da('0x3'));var moment=require(_0xe2da('0x4'));var BPromise=require(_0xe2da('0x5'));var Mustache=require('mustache');var util=require(_0xe2da('0x6'));var path=require(_0xe2da('0x7'));var sox=require(_0xe2da('0x8'));var csv=require(_0xe2da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2da('0xa'));var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x9'));var querystring=require(_0xe2da('0x10'));var Papa=require(_0xe2da('0x11'));var Redis=require('ioredis');var authService=require(_0xe2da('0x12'));var qs=require(_0xe2da('0x13'));var as=require(_0xe2da('0x14'));var hardwareService=require(_0xe2da('0x15'));var logger=require(_0xe2da('0x16'))(_0xe2da('0x17'));var utils=require(_0xe2da('0x18'));var config=require(_0xe2da('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2da('0x1a'))['db'];function respondWithStatusCode(_0x5200b1,_0x4377c6){_0x4377c6=_0x4377c6||0xcc;return function(_0x245ad7){if(_0x245ad7){return _0x5200b1[_0xe2da('0x1b')](_0x4377c6);}return _0x5200b1[_0xe2da('0x1c')](_0x4377c6)[_0xe2da('0x1d')]();};}function respondWithResult(_0x5660b5,_0x295a86){_0x295a86=_0x295a86||0xc8;return function(_0x48584b){if(_0x48584b){return _0x5660b5[_0xe2da('0x1c')](_0x295a86)['json'](_0x48584b);}};}function respondWithFilteredResult(_0x586b27,_0x403d1c){return function(_0x3dfc52){if(_0x3dfc52){var _0x33f919=typeof _0x403d1c['offset']===_0xe2da('0x1e')&&typeof _0x403d1c[_0xe2da('0x1f')]===_0xe2da('0x1e');var _0x33568f=_0x3dfc52['count'];var _0x45bb92=_0x33f919?0x0:_0x403d1c[_0xe2da('0x20')];var _0x417363=_0x33f919?_0x3dfc52[_0xe2da('0x21')]:_0x403d1c[_0xe2da('0x20')]+_0x403d1c['limit'];var _0x56eeb1;if(_0x417363>=_0x33568f){_0x417363=_0x33568f;_0x56eeb1=0xc8;}else{_0x56eeb1=0xce;}_0x586b27[_0xe2da('0x1c')](_0x56eeb1);return _0x586b27['set'](_0xe2da('0x22'),_0x45bb92+'-'+_0x417363+'/'+_0x33568f)[_0xe2da('0x23')](_0x3dfc52);}return null;};}function patchUpdates(_0x332193){return function(_0x203d36){try{jsonpatch[_0xe2da('0x24')](_0x203d36,_0x332193,!![]);}catch(_0x3e22de){return BPromise['reject'](_0x3e22de);}return _0x203d36[_0xe2da('0x25')]();};}function saveUpdates(_0x53cc4e,_0x30efdc){return function(_0x191d38){if(_0x191d38){return _0x191d38[_0xe2da('0x26')](_0x53cc4e)[_0xe2da('0x27')](function(_0x30dea4){return _0x30dea4;});}return null;};}function removeEntity(_0x1e45e9,_0x38f2c4){return function(_0x221e98){if(_0x221e98){return _0x221e98['destroy']()[_0xe2da('0x27')](function(){_0x1e45e9[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x14704d,_0x3778dc){return function(_0x230fb8){if(!_0x230fb8){_0x14704d[_0xe2da('0x1b')](0x194);}return _0x230fb8;};}function handleError(_0x56c37e,_0x2adc49){_0x2adc49=_0x2adc49||0x1f4;return function(_0x3e23d7){logger[_0xe2da('0x28')](_0x3e23d7[_0xe2da('0x29')]);if(_0x3e23d7[_0xe2da('0x2a')]){delete _0x3e23d7[_0xe2da('0x2a')];}_0x56c37e[_0xe2da('0x1c')](_0x2adc49)[_0xe2da('0x2b')](_0x3e23d7);};}exports['index']=function(_0x487a7c,_0x5e259a){var _0x3c4845={},_0x8c91db={},_0x4146ad={'count':0x0,'rows':[]};var _0x1ab91a=_['map'](db['FreshdeskField'][_0xe2da('0x2c')],function(_0x1ec8ca){return{'name':_0x1ec8ca[_0xe2da('0x2d')],'type':_0x1ec8ca[_0xe2da('0x2e')][_0xe2da('0x2f')]};});_0x8c91db[_0xe2da('0x30')]=_[_0xe2da('0x31')](_0x1ab91a,_0xe2da('0x2a'));_0x8c91db[_0xe2da('0x32')]=_['keys'](_0x487a7c['query']);_0x8c91db[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x8c91db[_0xe2da('0x30')],_0x8c91db[_0xe2da('0x32')]);_0x3c4845[_0xe2da('0x35')]=_[_0xe2da('0x34')](_0x8c91db[_0xe2da('0x30')],qs[_0xe2da('0x36')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x36')]));_0x3c4845[_0xe2da('0x35')]=_0x3c4845[_0xe2da('0x35')][_0xe2da('0x37')]?_0x3c4845[_0xe2da('0x35')]:_0x8c91db[_0xe2da('0x30')];if(!_0x487a7c[_0xe2da('0x32')][_0xe2da('0x38')](_0xe2da('0x39'))){_0x3c4845['limit']=qs[_0xe2da('0x1f')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x1f')]);_0x3c4845['offset']=qs[_0xe2da('0x20')](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x20')]);}_0x3c4845['order']=qs['sort'](_0x487a7c[_0xe2da('0x32')][_0xe2da('0x3a')]);_0x3c4845['where']=qs[_0xe2da('0x33')](_[_0xe2da('0x3b')](_0x487a7c[_0xe2da('0x32')],_0x8c91db[_0xe2da('0x33')]),_0x1ab91a);if(_0x487a7c[_0xe2da('0x32')]['filter']){_0x3c4845[_0xe2da('0x3c')]=_['merge'](_0x3c4845['where'],{'$or':_[_0xe2da('0x31')](_0x1ab91a,function(_0x561afb){if(_0x561afb[_0xe2da('0x2e')]!==_0xe2da('0x3d')){var _0x54d8a3={};_0x54d8a3[_0x561afb[_0xe2da('0x2a')]]={'$like':'%'+_0x487a7c[_0xe2da('0x32')]['filter']+'%'};return _0x54d8a3;}})});}_0x3c4845=_['merge']({},_0x3c4845,_0x487a7c['options']);var _0x2d9c0a={'where':_0x3c4845[_0xe2da('0x3c')]};return db[_0xe2da('0x3e')][_0xe2da('0x21')](_0x2d9c0a)[_0xe2da('0x27')](function(_0xdf6ea6){_0x4146ad[_0xe2da('0x21')]=_0xdf6ea6;if(_0x487a7c['query'][_0xe2da('0x3f')]){_0x3c4845[_0xe2da('0x40')]=[{'all':!![]}];}return db[_0xe2da('0x3e')][_0xe2da('0x41')](_0x3c4845);})[_0xe2da('0x27')](function(_0x5a1550){_0x4146ad[_0xe2da('0x42')]=_0x5a1550;return _0x4146ad;})[_0xe2da('0x27')](respondWithFilteredResult(_0x5e259a,_0x3c4845))[_0xe2da('0x43')](handleError(_0x5e259a,null));};exports['show']=function(_0x24d748,_0x279f67){var _0x1529f4={'raw':!![],'where':{'id':_0x24d748[_0xe2da('0x44')]['id']}},_0x4096c5={};_0x4096c5[_0xe2da('0x30')]=_[_0xe2da('0x45')](db[_0xe2da('0x3e')]['rawAttributes']);_0x4096c5[_0xe2da('0x32')]=_[_0xe2da('0x45')](_0x24d748[_0xe2da('0x32')]);_0x4096c5[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x4096c5['model'],_0x4096c5[_0xe2da('0x32')]);_0x1529f4[_0xe2da('0x35')]=_[_0xe2da('0x34')](_0x4096c5[_0xe2da('0x30')],qs[_0xe2da('0x36')](_0x24d748[_0xe2da('0x32')][_0xe2da('0x36')]));_0x1529f4['attributes']=_0x1529f4[_0xe2da('0x35')]['length']?_0x1529f4[_0xe2da('0x35')]:_0x4096c5[_0xe2da('0x30')];if(_0x24d748[_0xe2da('0x32')]['includeAll']){_0x1529f4[_0xe2da('0x40')]=[{'all':!![]}];}_0x1529f4=_[_0xe2da('0x46')]({},_0x1529f4,_0x24d748['options']);return db[_0xe2da('0x3e')][_0xe2da('0x47')](_0x1529f4)[_0xe2da('0x27')](handleEntityNotFound(_0x279f67,null))['then'](respondWithResult(_0x279f67,null))[_0xe2da('0x43')](handleError(_0x279f67,null));};exports['create']=function(_0x4e9444,_0x16a393){return db['FreshdeskField'][_0xe2da('0x48')](_0x4e9444[_0xe2da('0x49')],{})['then'](respondWithResult(_0x16a393,0xc9))[_0xe2da('0x43')](handleError(_0x16a393,null));};exports[_0xe2da('0x26')]=function(_0x482547,_0x4a6d80){if(_0x482547[_0xe2da('0x49')]['id']){delete _0x482547['body']['id'];}return db[_0xe2da('0x3e')][_0xe2da('0x47')]({'where':{'id':_0x482547[_0xe2da('0x44')]['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x4a6d80,null))[_0xe2da('0x27')](saveUpdates(_0x482547[_0xe2da('0x49')],null))[_0xe2da('0x27')](respondWithResult(_0x4a6d80,null))[_0xe2da('0x43')](handleError(_0x4a6d80,null));};exports[_0xe2da('0x4a')]=function(_0x515f9b,_0x3ce9a8){return db[_0xe2da('0x3e')][_0xe2da('0x47')]({'where':{'id':_0x515f9b['params']['id']}})[_0xe2da('0x27')](handleEntityNotFound(_0x3ce9a8,null))[_0xe2da('0x27')](removeEntity(_0x3ce9a8,null))[_0xe2da('0x43')](handleError(_0x3ce9a8,null));}; \ No newline at end of file +var _0xc901=['save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','includeAll','find','catch','create','body','params','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x3051f7,_0x4eb9a1){var _0x485764=function(_0x408b38){while(--_0x408b38){_0x3051f7['push'](_0x3051f7['shift']());}};_0x485764(++_0x4eb9a1);}(_0xc901,0x142));var _0x1c90=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc901[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x1c90('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c90('0x1'));var BPromise=require(_0x1c90('0x2'));var Mustache=require('mustache');var util=require(_0x1c90('0x3'));var path=require(_0x1c90('0x4'));var sox=require(_0x1c90('0x5'));var csv=require(_0x1c90('0x6'));var ejs=require(_0x1c90('0x7'));var fs=require('fs');var fs_extra=require(_0x1c90('0x8'));var _=require(_0x1c90('0x9'));var squel=require(_0x1c90('0xa'));var crypto=require(_0x1c90('0xb'));var jsforce=require(_0x1c90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1c90('0x6'));var querystring=require(_0x1c90('0xd'));var Papa=require(_0x1c90('0xe'));var Redis=require(_0x1c90('0xf'));var authService=require(_0x1c90('0x10'));var qs=require(_0x1c90('0x11'));var as=require(_0x1c90('0x12'));var hardwareService=require(_0x1c90('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c90('0x14'));var config=require(_0x1c90('0x15'));var licenseUtil=require(_0x1c90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da158,_0x3a38ed){_0x3a38ed=_0x3a38ed||0xcc;return function(_0x3353e3){if(_0x3353e3){return _0x4da158['sendStatus'](_0x3a38ed);}return _0x4da158[_0x1c90('0x17')](_0x3a38ed)[_0x1c90('0x18')]();};}function respondWithResult(_0xf72b98,_0x589c97){_0x589c97=_0x589c97||0xc8;return function(_0x42cb94){if(_0x42cb94){return _0xf72b98['status'](_0x589c97)[_0x1c90('0x19')](_0x42cb94);}};}function respondWithFilteredResult(_0x210ef4,_0x7a88dc){return function(_0x42d8a4){if(_0x42d8a4){var _0x48bd5e=typeof _0x7a88dc[_0x1c90('0x1a')]==='undefined'&&typeof _0x7a88dc[_0x1c90('0x1b')]===_0x1c90('0x1c');var _0x5f1025=_0x42d8a4[_0x1c90('0x1d')];var _0x4ec354=_0x48bd5e?0x0:_0x7a88dc['offset'];var _0x128bf0=_0x48bd5e?_0x42d8a4['count']:_0x7a88dc[_0x1c90('0x1a')]+_0x7a88dc[_0x1c90('0x1b')];var _0x2a5b73;if(_0x128bf0>=_0x5f1025){_0x128bf0=_0x5f1025;_0x2a5b73=0xc8;}else{_0x2a5b73=0xce;}_0x210ef4[_0x1c90('0x17')](_0x2a5b73);return _0x210ef4['set'](_0x1c90('0x1e'),_0x4ec354+'-'+_0x128bf0+'/'+_0x5f1025)['json'](_0x42d8a4);}return null;};}function patchUpdates(_0x525997){return function(_0x38f997){try{jsonpatch[_0x1c90('0x1f')](_0x38f997,_0x525997,!![]);}catch(_0x47fd11){return BPromise[_0x1c90('0x20')](_0x47fd11);}return _0x38f997[_0x1c90('0x21')]();};}function saveUpdates(_0x445664,_0x4074fd){return function(_0x13fc42){if(_0x13fc42){return _0x13fc42[_0x1c90('0x22')](_0x445664)['then'](function(_0x418f4c){return _0x418f4c;});}return null;};}function removeEntity(_0x46baa1,_0xab232a){return function(_0x33c88b){if(_0x33c88b){return _0x33c88b[_0x1c90('0x23')]()[_0x1c90('0x24')](function(){_0x46baa1[_0x1c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x64ca90,_0x435c3a){return function(_0x3923a9){if(!_0x3923a9){_0x64ca90['sendStatus'](0x194);}return _0x3923a9;};}function handleError(_0xb5666e,_0x44387f){_0x44387f=_0x44387f||0x1f4;return function(_0x4abffe){logger[_0x1c90('0x25')](_0x4abffe[_0x1c90('0x26')]);if(_0x4abffe['name']){delete _0x4abffe[_0x1c90('0x27')];}_0xb5666e[_0x1c90('0x17')](_0x44387f)[_0x1c90('0x28')](_0x4abffe);};}exports[_0x1c90('0x29')]=function(_0x395edb,_0x111e20){var _0xd0a607={},_0x35c843={},_0x52c308={'count':0x0,'rows':[]};var _0xc1a571=_[_0x1c90('0x2a')](db[_0x1c90('0x2b')][_0x1c90('0x2c')],function(_0x1979de){return{'name':_0x1979de[_0x1c90('0x2d')],'type':_0x1979de[_0x1c90('0x2e')][_0x1c90('0x2f')]};});_0x35c843[_0x1c90('0x30')]=_[_0x1c90('0x2a')](_0xc1a571,_0x1c90('0x27'));_0x35c843['query']=_[_0x1c90('0x31')](_0x395edb[_0x1c90('0x32')]);_0x35c843['filters']=_[_0x1c90('0x33')](_0x35c843['model'],_0x35c843[_0x1c90('0x32')]);_0xd0a607['attributes']=_[_0x1c90('0x33')](_0x35c843['model'],qs[_0x1c90('0x34')](_0x395edb[_0x1c90('0x32')]['fields']));_0xd0a607[_0x1c90('0x35')]=_0xd0a607[_0x1c90('0x35')]['length']?_0xd0a607[_0x1c90('0x35')]:_0x35c843[_0x1c90('0x30')];if(!_0x395edb[_0x1c90('0x32')][_0x1c90('0x36')](_0x1c90('0x37'))){_0xd0a607['limit']=qs['limit'](_0x395edb['query']['limit']);_0xd0a607['offset']=qs[_0x1c90('0x1a')](_0x395edb[_0x1c90('0x32')][_0x1c90('0x1a')]);}_0xd0a607['order']=qs[_0x1c90('0x38')](_0x395edb['query'][_0x1c90('0x38')]);_0xd0a607[_0x1c90('0x39')]=qs['filters'](_['pick'](_0x395edb[_0x1c90('0x32')],_0x35c843[_0x1c90('0x3a')]),_0xc1a571);if(_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]){_0xd0a607[_0x1c90('0x39')]=_[_0x1c90('0x3c')](_0xd0a607[_0x1c90('0x39')],{'$or':_['map'](_0xc1a571,function(_0x508025){if(_0x508025[_0x1c90('0x2e')]!==_0x1c90('0x3d')){var _0x134501={};_0x134501[_0x508025[_0x1c90('0x27')]]={'$like':'%'+_0x395edb[_0x1c90('0x32')][_0x1c90('0x3b')]+'%'};return _0x134501;}})});}_0xd0a607=_[_0x1c90('0x3c')]({},_0xd0a607,_0x395edb[_0x1c90('0x3e')]);var _0x398ee9={'where':_0xd0a607[_0x1c90('0x39')]};return db['FreshdeskField'][_0x1c90('0x1d')](_0x398ee9)['then'](function(_0x5a8eea){_0x52c308[_0x1c90('0x1d')]=_0x5a8eea;if(_0x395edb['query']['includeAll']){_0xd0a607[_0x1c90('0x3f')]=[{'all':!![]}];}return db[_0x1c90('0x2b')]['findAll'](_0xd0a607);})[_0x1c90('0x24')](function(_0x3271ea){_0x52c308[_0x1c90('0x40')]=_0x3271ea;return _0x52c308;})[_0x1c90('0x24')](respondWithFilteredResult(_0x111e20,_0xd0a607))['catch'](handleError(_0x111e20,null));};exports['show']=function(_0x19e689,_0x171ca0){var _0x5680fe={'raw':!![],'where':{'id':_0x19e689['params']['id']}},_0x35952a={};_0x35952a[_0x1c90('0x30')]=_[_0x1c90('0x31')](db['FreshdeskField'][_0x1c90('0x2c')]);_0x35952a[_0x1c90('0x32')]=_[_0x1c90('0x31')](_0x19e689[_0x1c90('0x32')]);_0x35952a[_0x1c90('0x3a')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],_0x35952a[_0x1c90('0x32')]);_0x5680fe[_0x1c90('0x35')]=_[_0x1c90('0x33')](_0x35952a[_0x1c90('0x30')],qs['fields'](_0x19e689[_0x1c90('0x32')]['fields']));_0x5680fe[_0x1c90('0x35')]=_0x5680fe['attributes']['length']?_0x5680fe[_0x1c90('0x35')]:_0x35952a[_0x1c90('0x30')];if(_0x19e689[_0x1c90('0x32')][_0x1c90('0x41')]){_0x5680fe[_0x1c90('0x3f')]=[{'all':!![]}];}_0x5680fe=_[_0x1c90('0x3c')]({},_0x5680fe,_0x19e689[_0x1c90('0x3e')]);return db[_0x1c90('0x2b')][_0x1c90('0x42')](_0x5680fe)['then'](handleEntityNotFound(_0x171ca0,null))['then'](respondWithResult(_0x171ca0,null))[_0x1c90('0x43')](handleError(_0x171ca0,null));};exports[_0x1c90('0x44')]=function(_0x68fac8,_0x2d30f5){return db[_0x1c90('0x2b')][_0x1c90('0x44')](_0x68fac8[_0x1c90('0x45')],{})[_0x1c90('0x24')](respondWithResult(_0x2d30f5,0xc9))['catch'](handleError(_0x2d30f5,null));};exports[_0x1c90('0x22')]=function(_0x24016a,_0x9524b6){if(_0x24016a['body']['id']){delete _0x24016a['body']['id'];}return db[_0x1c90('0x2b')]['find']({'where':{'id':_0x24016a[_0x1c90('0x46')]['id']}})['then'](handleEntityNotFound(_0x9524b6,null))['then'](saveUpdates(_0x24016a[_0x1c90('0x45')],null))[_0x1c90('0x24')](respondWithResult(_0x9524b6,null))['catch'](handleError(_0x9524b6,null));};exports['destroy']=function(_0x394177,_0x53f158){return db[_0x1c90('0x2b')][_0x1c90('0x42')]({'where':{'id':_0x394177[_0x1c90('0x46')]['id']}})[_0x1c90('0x24')](handleEntityNotFound(_0x53f158,null))['then'](removeEntity(_0x53f158,null))['catch'](handleError(_0x53f158,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 49b5cb3..c116974 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 _0x3a12=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x3d823b,_0x245c0d){var _0x1c23cd=function(_0x179b18){while(--_0x179b18){_0x3d823b['push'](_0x3d823b['shift']());}};_0x1c23cd(++_0x245c0d);}(_0x3a12,0x1ce));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var logger=require(_0x23a1('0x2'))('api');var moment=require(_0x23a1('0x3'));var BPromise=require(_0x23a1('0x4'));var rp=require(_0x23a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23a1('0x6'));var config=require(_0x23a1('0x7'));var attributes=require(_0x23a1('0x8'));module['exports']=function(_0x29775a,_0x3f41d6){return _0x29775a['define'](_0x23a1('0x9'),attributes,{'tableName':_0x23a1('0xa'),'paranoid':![],'indexes':[{'name':_0x23a1('0xb'),'fields':[_0x23a1('0xc'),_0x23a1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe01d=['path','exports','define','FreshdeskField','int_freshdesk_fields','idField','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c2af1,_0x100984){var _0x5b368f=function(_0x14b3a6){while(--_0x14b3a6){_0x4c2af1['push'](_0x4c2af1['shift']());}};_0x5b368f(++_0x100984);}(_0xe01d,0x1c2));var _0xde01=function(_0x507126,_0x3dd5c3){_0x507126=_0x507126-0x0;var _0x5ca642=_0xe01d[_0x507126];return _0x5ca642;};'use strict';var _=require(_0xde01('0x0'));var util=require('util');var logger=require(_0xde01('0x1'))(_0xde01('0x2'));var moment=require(_0xde01('0x3'));var BPromise=require(_0xde01('0x4'));var rp=require(_0xde01('0x5'));var fs=require('fs');var path=require(_0xde01('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xde01('0x7')]=function(_0x6b7a6a,_0x331de0){return _0x6b7a6a[_0xde01('0x8')](_0xde01('0x9'),attributes,{'tableName':_0xde01('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xde01('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 3031042..0bd7a89 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 _0x1312=['util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x1312,0x8b));var _0x2131=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x1312[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0x2131('0x0'));var util=require(_0x2131('0x1'));var moment=require('moment');var BPromise=require(_0x2131('0x2'));var rs=require(_0x2131('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2131('0x4'))['db'];var utils=require(_0x2131('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2131('0x6'));var client=jayson[_0x2131('0x7')][_0x2131('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x348124,_0x244cad,_0x2f694d){return new BPromise(function(_0x625531,_0x1ba04f){return client['request'](_0x348124,_0x2f694d)[_0x2131('0x9')](function(_0x3ba126){logger[_0x2131('0xa')](_0x2131('0xb'),_0x244cad,_0x2131('0xc'));logger[_0x2131('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x244cad,_0x2131('0xc'),JSON[_0x2131('0xe')](_0x3ba126));if(_0x3ba126[_0x2131('0xf')]){if(_0x3ba126[_0x2131('0xf')][_0x2131('0x10')]===0x1f4){logger[_0x2131('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x244cad,_0x3ba126[_0x2131('0xf')][_0x2131('0x11')]);return _0x1ba04f(_0x3ba126['error'][_0x2131('0x11')]);}logger[_0x2131('0xf')](_0x2131('0xb'),_0x244cad,_0x3ba126['error'][_0x2131('0x11')]);return _0x625531(_0x3ba126[_0x2131('0xf')][_0x2131('0x11')]);}else{logger[_0x2131('0xa')](_0x2131('0xb'),_0x244cad,'request\x20sent');_0x625531(_0x3ba126[_0x2131('0x12')]['message']);}})[_0x2131('0x13')](function(_0x24ad5d){logger[_0x2131('0xf')](_0x2131('0xb'),_0x244cad,_0x24ad5d);_0x1ba04f(_0x24ad5d);});});} \ No newline at end of file +var _0xa6a9=['message','catch','lodash','util','../../mysqldb','../../config/environment','jayson/promise','client','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xa6a9,0x1ef));var _0x9a6a=function(_0x403db1,_0x59018e){_0x403db1=_0x403db1-0x0;var _0x47c48f=_0xa6a9[_0x403db1];return _0x47c48f;};'use strict';var _=require(_0x9a6a('0x0'));var util=require(_0x9a6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a6a('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9a6a('0x3'));var jayson=require(_0x9a6a('0x4'));var client=jayson[_0x9a6a('0x5')][_0x9a6a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5be303,_0x2b1fcd,_0x3b91c5){return new BPromise(function(_0x1856c2,_0x13dc93){return client['request'](_0x5be303,_0x3b91c5)['then'](function(_0x546e18){logger[_0x9a6a('0x7')](_0x9a6a('0x8'),_0x2b1fcd,_0x9a6a('0x9'));logger[_0x9a6a('0xa')](_0x9a6a('0xb'),_0x2b1fcd,_0x9a6a('0x9'),JSON[_0x9a6a('0xc')](_0x546e18));if(_0x546e18[_0x9a6a('0xd')]){if(_0x546e18[_0x9a6a('0xd')][_0x9a6a('0xe')]===0x1f4){logger[_0x9a6a('0xd')](_0x9a6a('0x8'),_0x2b1fcd,_0x546e18[_0x9a6a('0xd')][_0x9a6a('0xf')]);return _0x13dc93(_0x546e18[_0x9a6a('0xd')][_0x9a6a('0xf')]);}logger[_0x9a6a('0xd')](_0x9a6a('0x8'),_0x2b1fcd,_0x546e18[_0x9a6a('0xd')][_0x9a6a('0xf')]);return _0x1856c2(_0x546e18[_0x9a6a('0xd')][_0x9a6a('0xf')]);}else{logger['info'](_0x9a6a('0x8'),_0x2b1fcd,_0x9a6a('0x9'));_0x1856c2(_0x546e18['result'][_0x9a6a('0xf')]);}})[_0x9a6a('0x10')](function(_0x1e6cf4){logger[_0x9a6a('0xd')](_0x9a6a('0x8'),_0x2b1fcd,_0x1e6cf4);_0x13dc93(_0x1e6cf4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 839a2e6..0cdf081 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 _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x27e23d,_0x22c4e5){var _0x25ceac=function(_0xf71213){while(--_0xf71213){_0x27e23d['push'](_0x27e23d['shift']());}};_0x25ceac(++_0x22c4e5);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2a7af2,_0x122c17){_0x2a7af2=_0x2a7af2-0x0;var _0x88606d=_0x2e54[_0x2a7af2];return _0x88606d;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','exports','util','path','connect-timeout'];(function(_0x5a3bec,_0x500b01){var _0x2dda2b=function(_0x4592d6){while(--_0x4592d6){_0x5a3bec['push'](_0x5a3bec['shift']());}};_0x2dda2b(++_0x500b01);}(_0x91a7,0xe7));var _0x791a=function(_0x15abd3,_0x1a0030){_0x15abd3=_0x15abd3-0x0;var _0x30d149=_0x91a7[_0x15abd3];return _0x30d149;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/fields',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0xd')]);router[_0x791a('0xe')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router['put']('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['delete'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a7187c2..b5b0f94 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 _0x955f=['exports','STRING','sequelize'];(function(_0x485aea,_0x3863d0){var _0xe06870=function(_0xf472cd){while(--_0xf472cd){_0x485aea['push'](_0x485aea['shift']());}};_0xe06870(++_0x3863d0);}(_0x955f,0x1eb));var _0xf955=function(_0x1d9c6c,_0x25a14f){_0x1d9c6c=_0x1d9c6c-0x0;var _0x15aa30=_0x955f[_0x1d9c6c];return _0x15aa30;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77d4=['exports','STRING','username'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0x77d4,0x108));var _0x477d=function(_0x3bc964,_0x467d77){_0x3bc964=_0x3bc964-0x0;var _0x548e6a=_0x77d4[_0x3bc964];return _0x548e6a;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b685de5..e334107 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 _0xe1de=['addConfiguration','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','include','options','find','catch','create','body','params','getConfigurations','findOne','FreshsalesConfiguration'];(function(_0x39b638,_0xabb0fb){var _0x56a954=function(_0x2ebca6){while(--_0x2ebca6){_0x39b638['push'](_0x39b638['shift']());}};_0x56a954(++_0xabb0fb);}(_0xe1de,0x155));var _0xee1d=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xe1de[_0x2ed8f3];return _0x525a55;};'use strict';var emlformat=require(_0xee1d('0x0'));var rimraf=require(_0xee1d('0x1'));var zipdir=require(_0xee1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee1d('0x3'));var moment=require(_0xee1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xee1d('0x5'));var util=require(_0xee1d('0x6'));var path=require(_0xee1d('0x7'));var sox=require(_0xee1d('0x8'));var csv=require(_0xee1d('0x9'));var ejs=require(_0xee1d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee1d('0xb'));var squel=require(_0xee1d('0xc'));var crypto=require(_0xee1d('0xd'));var jsforce=require(_0xee1d('0xe'));var deskjs=require(_0xee1d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee1d('0x10'));var Papa=require(_0xee1d('0x11'));var Redis=require(_0xee1d('0x12'));var authService=require(_0xee1d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xee1d('0x14'));var hardwareService=require(_0xee1d('0x15'));var logger=require(_0xee1d('0x16'))('api');var utils=require(_0xee1d('0x17'));var config=require(_0xee1d('0x18'));var licenseUtil=require(_0xee1d('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xee1d('0x1a'));function respondWithStatusCode(_0x5a7f30,_0xcda3dd){_0xcda3dd=_0xcda3dd||0xcc;return function(_0x47fb96){if(_0x47fb96){return _0x5a7f30[_0xee1d('0x1b')](_0xcda3dd);}return _0x5a7f30[_0xee1d('0x1c')](_0xcda3dd)[_0xee1d('0x1d')]();};}function respondWithResult(_0x1586bb,_0x10997e){_0x10997e=_0x10997e||0xc8;return function(_0x163cb6){if(_0x163cb6){return _0x1586bb[_0xee1d('0x1c')](_0x10997e)[_0xee1d('0x1e')](_0x163cb6);}};}function respondWithFilteredResult(_0x20afc3,_0x538fd8){return function(_0xae0c22){if(_0xae0c22){var _0x1dc94b=typeof _0x538fd8[_0xee1d('0x1f')]===_0xee1d('0x20')&&typeof _0x538fd8[_0xee1d('0x21')]===_0xee1d('0x20');var _0x1c9742=_0xae0c22[_0xee1d('0x22')];var _0x1ca42a=_0x1dc94b?0x0:_0x538fd8['offset'];var _0xdf9928=_0x1dc94b?_0xae0c22['count']:_0x538fd8[_0xee1d('0x1f')]+_0x538fd8[_0xee1d('0x21')];var _0x243470;if(_0xdf9928>=_0x1c9742){_0xdf9928=_0x1c9742;_0x243470=0xc8;}else{_0x243470=0xce;}_0x20afc3['status'](_0x243470);return _0x20afc3[_0xee1d('0x23')](_0xee1d('0x24'),_0x1ca42a+'-'+_0xdf9928+'/'+_0x1c9742)[_0xee1d('0x1e')](_0xae0c22);}return null;};}function patchUpdates(_0x74c7f3){return function(_0x567ff5){try{jsonpatch['apply'](_0x567ff5,_0x74c7f3,!![]);}catch(_0x3ac816){return BPromise[_0xee1d('0x25')](_0x3ac816);}return _0x567ff5[_0xee1d('0x26')]();};}function saveUpdates(_0x35fd1b,_0x44b160){return function(_0x459ec9){if(_0x459ec9){return _0x459ec9[_0xee1d('0x27')](_0x35fd1b)[_0xee1d('0x28')](function(_0x44e528){return _0x44e528;});}return null;};}function removeEntity(_0x59c6a5,_0x131584){return function(_0x437a21){if(_0x437a21){return _0x437a21[_0xee1d('0x29')]()[_0xee1d('0x28')](function(){_0x59c6a5[_0xee1d('0x1c')](0xcc)[_0xee1d('0x1d')]();});}};}function handleEntityNotFound(_0x33b517,_0x449c98){return function(_0x5cf7be){if(!_0x5cf7be){_0x33b517[_0xee1d('0x1b')](0x194);}return _0x5cf7be;};}function handleError(_0x203796,_0x4ae28f){_0x4ae28f=_0x4ae28f||0x1f4;return function(_0x3bc0dd){logger[_0xee1d('0x2a')](_0x3bc0dd[_0xee1d('0x2b')]);if(_0x3bc0dd[_0xee1d('0x2c')]){delete _0x3bc0dd[_0xee1d('0x2c')];}_0x203796['status'](_0x4ae28f)[_0xee1d('0x2d')](_0x3bc0dd);};}exports[_0xee1d('0x2e')]=function(_0x53fef0,_0x4cec38){var _0x141b8c={},_0x2905c2={},_0x23f4ba={'count':0x0,'rows':[]};var _0x5224e6=_[_0xee1d('0x2f')](db[_0xee1d('0x30')][_0xee1d('0x31')],function(_0x40f00){return{'name':_0x40f00[_0xee1d('0x32')],'type':_0x40f00[_0xee1d('0x33')]['key']};});_0x2905c2['model']=_[_0xee1d('0x2f')](_0x5224e6,'name');_0x2905c2[_0xee1d('0x34')]=_[_0xee1d('0x35')](_0x53fef0['query']);_0x2905c2[_0xee1d('0x36')]=_[_0xee1d('0x37')](_0x2905c2[_0xee1d('0x38')],_0x2905c2[_0xee1d('0x34')]);_0x141b8c[_0xee1d('0x39')]=_[_0xee1d('0x37')](_0x2905c2[_0xee1d('0x38')],qs[_0xee1d('0x3a')](_0x53fef0[_0xee1d('0x34')][_0xee1d('0x3a')]));_0x141b8c['attributes']=_0x141b8c['attributes'][_0xee1d('0x3b')]?_0x141b8c[_0xee1d('0x39')]:_0x2905c2[_0xee1d('0x38')];if(!_0x53fef0[_0xee1d('0x34')][_0xee1d('0x3c')](_0xee1d('0x3d'))){_0x141b8c[_0xee1d('0x21')]=qs[_0xee1d('0x21')](_0x53fef0[_0xee1d('0x34')][_0xee1d('0x21')]);_0x141b8c[_0xee1d('0x1f')]=qs['offset'](_0x53fef0[_0xee1d('0x34')][_0xee1d('0x1f')]);}_0x141b8c[_0xee1d('0x3e')]=qs[_0xee1d('0x3f')](_0x53fef0[_0xee1d('0x34')][_0xee1d('0x3f')]);_0x141b8c['where']=qs[_0xee1d('0x36')](_[_0xee1d('0x40')](_0x53fef0['query'],_0x2905c2[_0xee1d('0x36')]),_0x5224e6);if(_0x53fef0[_0xee1d('0x34')][_0xee1d('0x41')]){_0x141b8c[_0xee1d('0x42')]=_[_0xee1d('0x43')](_0x141b8c['where'],{'$or':_[_0xee1d('0x2f')](_0x5224e6,function(_0x10f716){if(_0x10f716['type']!==_0xee1d('0x44')){var _0x572678={};_0x572678[_0x10f716[_0xee1d('0x2c')]]={'$like':'%'+_0x53fef0[_0xee1d('0x34')][_0xee1d('0x41')]+'%'};return _0x572678;}})});}_0x141b8c=_[_0xee1d('0x43')]({},_0x141b8c,_0x53fef0['options']);var _0x13b939={'where':_0x141b8c[_0xee1d('0x42')]};return db[_0xee1d('0x30')][_0xee1d('0x22')](_0x13b939)[_0xee1d('0x28')](function(_0x2afe56){_0x23f4ba[_0xee1d('0x22')]=_0x2afe56;if(_0x53fef0['query'][_0xee1d('0x45')]){_0x141b8c['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xee1d('0x46')](_0x141b8c);})['then'](function(_0x48a00c){_0x23f4ba[_0xee1d('0x47')]=_0x48a00c;return _0x23f4ba;})[_0xee1d('0x28')](respondWithFilteredResult(_0x4cec38,_0x141b8c))['catch'](handleError(_0x4cec38,null));};exports[_0xee1d('0x48')]=function(_0x46cef1,_0x3cecab){var _0x426b6f={'raw':![],'where':{'id':_0x46cef1['params']['id']}},_0x3ae47a={};_0x3ae47a[_0xee1d('0x38')]=_[_0xee1d('0x35')](db[_0xee1d('0x30')]['rawAttributes']);_0x3ae47a[_0xee1d('0x34')]=_[_0xee1d('0x35')](_0x46cef1[_0xee1d('0x34')]);_0x3ae47a[_0xee1d('0x36')]=_[_0xee1d('0x37')](_0x3ae47a['model'],_0x3ae47a[_0xee1d('0x34')]);_0x426b6f['attributes']=_['intersection'](_0x3ae47a[_0xee1d('0x38')],qs['fields'](_0x46cef1[_0xee1d('0x34')][_0xee1d('0x3a')]));_0x426b6f[_0xee1d('0x39')]=_0x426b6f['attributes'][_0xee1d('0x3b')]?_0x426b6f[_0xee1d('0x39')]:_0x3ae47a[_0xee1d('0x38')];if(_0x46cef1[_0xee1d('0x34')][_0xee1d('0x45')]){_0x426b6f[_0xee1d('0x49')]=[{'all':!![]}];}_0x426b6f=_[_0xee1d('0x43')]({},_0x426b6f,_0x46cef1[_0xee1d('0x4a')]);return db[_0xee1d('0x30')][_0xee1d('0x4b')](_0x426b6f)[_0xee1d('0x28')](handleEntityNotFound(_0x3cecab,null))[_0xee1d('0x28')](respondWithResult(_0x3cecab,null))[_0xee1d('0x4c')](handleError(_0x3cecab,null));};exports[_0xee1d('0x4d')]=function(_0x321c79,_0x21584c){return db[_0xee1d('0x30')][_0xee1d('0x4d')](_0x321c79[_0xee1d('0x4e')],{})['then'](respondWithResult(_0x21584c,0xc9))[_0xee1d('0x4c')](handleError(_0x21584c,null));};exports[_0xee1d('0x27')]=function(_0x135dd5,_0x3a3944){if(_0x135dd5[_0xee1d('0x4e')]['id']){delete _0x135dd5[_0xee1d('0x4e')]['id'];}return db[_0xee1d('0x30')]['find']({'where':{'id':_0x135dd5['params']['id']}})[_0xee1d('0x28')](handleEntityNotFound(_0x3a3944,null))['then'](saveUpdates(_0x135dd5[_0xee1d('0x4e')],null))['then'](respondWithResult(_0x3a3944,null))[_0xee1d('0x4c')](handleError(_0x3a3944,null));};exports['destroy']=function(_0x53ab5d,_0x50432e){return db[_0xee1d('0x30')][_0xee1d('0x4b')]({'where':{'id':_0x53ab5d[_0xee1d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x50432e,null))['then'](removeEntity(_0x50432e,null))[_0xee1d('0x4c')](handleError(_0x50432e,null));};exports[_0xee1d('0x50')]=function(_0x159d6b,_0x4db923,_0x12a3d4){var _0x344a4c={};var _0x4d3e33={};var _0x18d2ee;var _0x4f813c;return db[_0xee1d('0x30')][_0xee1d('0x51')]({'where':{'id':_0x159d6b['params']['id']}})[_0xee1d('0x28')](handleEntityNotFound(_0x4db923,null))['then'](function(_0x1c3220){if(_0x1c3220){_0x18d2ee=_0x1c3220;_0x4d3e33[_0xee1d('0x38')]=_[_0xee1d('0x35')](db[_0xee1d('0x52')]['rawAttributes']);_0x4d3e33[_0xee1d('0x34')]=_['keys'](_0x159d6b[_0xee1d('0x34')]);_0x4d3e33['filters']=_[_0xee1d('0x37')](_0x4d3e33['model'],_0x4d3e33[_0xee1d('0x34')]);_0x344a4c[_0xee1d('0x39')]=_[_0xee1d('0x37')](_0x4d3e33['model'],qs[_0xee1d('0x3a')](_0x159d6b['query'][_0xee1d('0x3a')]));_0x344a4c[_0xee1d('0x39')]=_0x344a4c[_0xee1d('0x39')]['length']?_0x344a4c[_0xee1d('0x39')]:_0x4d3e33[_0xee1d('0x38')];_0x344a4c[_0xee1d('0x3e')]=qs[_0xee1d('0x3f')](_0x159d6b[_0xee1d('0x34')][_0xee1d('0x3f')]);_0x344a4c[_0xee1d('0x42')]=qs[_0xee1d('0x36')](_[_0xee1d('0x40')](_0x159d6b['query'],_0x4d3e33[_0xee1d('0x36')]));if(_0x159d6b['query'][_0xee1d('0x41')]){_0x344a4c['where']=_[_0xee1d('0x43')](_0x344a4c[_0xee1d('0x42')],{'$or':_[_0xee1d('0x2f')](_0x344a4c[_0xee1d('0x39')],function(_0x3a58fc){var _0x2302cf={};_0x2302cf[_0x3a58fc]={'$like':'%'+_0x159d6b['query'][_0xee1d('0x41')]+'%'};return _0x2302cf;})});}_0x344a4c=_[_0xee1d('0x43')]({},_0x344a4c,_0x159d6b['options']);return _0x18d2ee[_0xee1d('0x50')](_0x344a4c);}})[_0xee1d('0x28')](function(_0x26dd59){if(_0x26dd59){_0x4f813c=_0x26dd59[_0xee1d('0x3b')];if(!_0x159d6b[_0xee1d('0x34')][_0xee1d('0x3c')](_0xee1d('0x3d'))){_0x344a4c[_0xee1d('0x21')]=qs['limit'](_0x159d6b[_0xee1d('0x34')][_0xee1d('0x21')]);_0x344a4c['offset']=qs[_0xee1d('0x1f')](_0x159d6b[_0xee1d('0x34')][_0xee1d('0x1f')]);}return _0x18d2ee[_0xee1d('0x50')](_0x344a4c);}})[_0xee1d('0x28')](function(_0x1e40dc){if(_0x1e40dc){return _0x1e40dc?{'count':_0x4f813c,'rows':_0x1e40dc}:null;}})[_0xee1d('0x28')](respondWithResult(_0x4db923,null))[_0xee1d('0x4c')](handleError(_0x4db923,null));};exports[_0xee1d('0x53')]=function(_0x4f3c85,_0xe31cb9,_0x2e0fac){if(_0x4f3c85['body']['id']){delete _0x4f3c85[_0xee1d('0x4e')]['id'];}return db[_0xee1d('0x30')][_0xee1d('0x51')]({'where':{'id':_0x4f3c85['params']['id']}})[_0xee1d('0x28')](handleEntityNotFound(_0xe31cb9,null))[_0xee1d('0x28')](function(_0xd71ba5){if(_0xd71ba5){_0x4f3c85[_0xee1d('0x4e')]['AccountId']=_0xd71ba5['id'];_0x4f3c85[_0xee1d('0x4e')]['Subjects']=integrations[_0xee1d('0x54')](_0x4f3c85[_0xee1d('0x4e')]['channel'],_0x4f3c85[_0xee1d('0x4e')][_0xee1d('0x33')]);_0x4f3c85[_0xee1d('0x4e')][_0xee1d('0x55')]=integrations[_0xee1d('0x56')](_0x4f3c85[_0xee1d('0x4e')]['channel'],_0x4f3c85['body'][_0xee1d('0x33')]);return db['FreshsalesConfiguration'][_0xee1d('0x4d')](_0x4f3c85['body'],{'include':[{'model':db[_0xee1d('0x57')],'as':'Subjects'},{'model':db[_0xee1d('0x57')],'as':_0xee1d('0x55')}]});}return null;})[_0xee1d('0x28')](respondWithResult(_0xe31cb9,null))[_0xee1d('0x4c')](handleError(_0xe31cb9,null));};exports[_0xee1d('0x58')]=function(_0x14af90,_0x403b14,_0x2a280f){var _0x47494e='';var _0x19c519='';return db['FreshsalesAccount'][_0xee1d('0x51')]({'where':{'id':_0x14af90[_0xee1d('0x4f')]['id']},'attributes':['id',_0xee1d('0x59'),'remoteUri','apiKey']})['then'](handleEntityNotFound(_0x403b14,null))[_0xee1d('0x28')](function(_0x33006c){if(_0x33006c){_0x19c519=_0x33006c['username'];_0x47494e=_0x33006c[_0xee1d('0x5a')];var _0x3cfcc4=_0x33006c['remoteUri'][_0xee1d('0x5b')](-0x1);if(_0x3cfcc4==='/'){_0x47494e=_0x47494e[_0xee1d('0x5c')](0x0,_0x47494e[_0xee1d('0x5d')](_0x3cfcc4));}return rp({'method':_0xee1d('0x5e'),'uri':util[_0xee1d('0x5f')](_0xee1d('0x60'),_0x47494e,'/api/selector/owners'),'headers':{'Authorization':_0xee1d('0x61')+_0x33006c[_0xee1d('0x62')]},'json':!![]});}})[_0xee1d('0x28')](function(_0x2ed0af){if(_0x2ed0af){var _0x4013a5=_0x2ed0af[_0xee1d('0x63')];var _0x58a01b=![];var _0x2a99ab=null;for(_0x2a99ab=0x0;_0x2a99ab<_0x4013a5[_0xee1d('0x3b')];_0x2a99ab++){if(_0x4013a5[_0x2a99ab][_0xee1d('0x64')]===_0x19c519){_0x58a01b=!![];}}if(_0x58a01b){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xee1d('0x28')](respondWithResult(_0x403b14,null))[_0xee1d('0x4c')](function(_0x52e74c){var _0x521180=_0x14af90[_0xee1d('0x34')]['test']?0x1f4:_0x52e74c[_0xee1d('0x65')]||0x1f4;logger['error'](_0xee1d('0x66'),_0xee1d('0x58'),_0x521180,JSON[_0xee1d('0x67')](_0x52e74c));delete _0x52e74c[_0xee1d('0x2c')];if(_0x521180===0x191){_0x521180=0x190;}_0x403b14[_0xee1d('0x1c')](_0x521180)[_0xee1d('0x2d')](_0x14af90[_0xee1d('0x34')][_0xee1d('0x68')]?{'message':_0xee1d('0x69'),'statusCode':_0x52e74c['statusCode']}:_0x52e74c);});}; \ No newline at end of file +var _0x4583=['substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','test','statusCode','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshsalesConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice'];(function(_0x1882ce,_0x149aa2){var _0x719086=function(_0x36b3f7){while(--_0x36b3f7){_0x1882ce['push'](_0x1882ce['shift']());}};_0x719086(++_0x149aa2);}(_0x4583,0xd8));var _0x3458=function(_0x4f7b06,_0x25e194){_0x4f7b06=_0x4f7b06-0x0;var _0x24d0e3=_0x4583[_0x4f7b06];return _0x24d0e3;};'use strict';var emlformat=require(_0x3458('0x0'));var rimraf=require(_0x3458('0x1'));var zipdir=require(_0x3458('0x2'));var jsonpatch=require(_0x3458('0x3'));var rp=require(_0x3458('0x4'));var moment=require(_0x3458('0x5'));var BPromise=require(_0x3458('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3458('0x7'));var sox=require('sox');var csv=require(_0x3458('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3458('0x9'));var _=require(_0x3458('0xa'));var squel=require(_0x3458('0xb'));var crypto=require(_0x3458('0xc'));var jsforce=require(_0x3458('0xd'));var deskjs=require(_0x3458('0xe'));var toCsv=require(_0x3458('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3458('0xf'));var authService=require(_0x3458('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3458('0x11'));var hardwareService=require(_0x3458('0x12'));var logger=require(_0x3458('0x13'))(_0x3458('0x14'));var utils=require(_0x3458('0x15'));var config=require(_0x3458('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f4e91,_0x2c6271){_0x2c6271=_0x2c6271||0xcc;return function(_0x53c66f){if(_0x53c66f){return _0x1f4e91[_0x3458('0x17')](_0x2c6271);}return _0x1f4e91[_0x3458('0x18')](_0x2c6271)[_0x3458('0x19')]();};}function respondWithResult(_0x18eb4e,_0x4dff03){_0x4dff03=_0x4dff03||0xc8;return function(_0x173d97){if(_0x173d97){return _0x18eb4e[_0x3458('0x18')](_0x4dff03)[_0x3458('0x1a')](_0x173d97);}};}function respondWithFilteredResult(_0x26a2a7,_0x136b6b){return function(_0x33bf40){if(_0x33bf40){var _0x34904c=typeof _0x136b6b[_0x3458('0x1b')]===_0x3458('0x1c')&&typeof _0x136b6b['limit']===_0x3458('0x1c');var _0xa2ad5a=_0x33bf40[_0x3458('0x1d')];var _0x1deac4=_0x34904c?0x0:_0x136b6b[_0x3458('0x1b')];var _0x43e4e5=_0x34904c?_0x33bf40[_0x3458('0x1d')]:_0x136b6b['offset']+_0x136b6b[_0x3458('0x1e')];var _0x5bd05d;if(_0x43e4e5>=_0xa2ad5a){_0x43e4e5=_0xa2ad5a;_0x5bd05d=0xc8;}else{_0x5bd05d=0xce;}_0x26a2a7['status'](_0x5bd05d);return _0x26a2a7[_0x3458('0x1f')]('Content-Range',_0x1deac4+'-'+_0x43e4e5+'/'+_0xa2ad5a)['json'](_0x33bf40);}return null;};}function patchUpdates(_0x1986a1){return function(_0xb91917){try{jsonpatch['apply'](_0xb91917,_0x1986a1,!![]);}catch(_0x140eb6){return BPromise[_0x3458('0x20')](_0x140eb6);}return _0xb91917[_0x3458('0x21')]();};}function saveUpdates(_0x4ccf23,_0x48d56e){return function(_0x43d669){if(_0x43d669){return _0x43d669[_0x3458('0x22')](_0x4ccf23)['then'](function(_0x305f0e){return _0x305f0e;});}return null;};}function removeEntity(_0x3b0f3f,_0xad298a){return function(_0x863726){if(_0x863726){return _0x863726[_0x3458('0x23')]()[_0x3458('0x24')](function(){_0x3b0f3f[_0x3458('0x18')](0xcc)[_0x3458('0x19')]();});}};}function handleEntityNotFound(_0x44427f,_0x514541){return function(_0x317ae5){if(!_0x317ae5){_0x44427f[_0x3458('0x17')](0x194);}return _0x317ae5;};}function handleError(_0x344899,_0x519027){_0x519027=_0x519027||0x1f4;return function(_0x4312db){logger[_0x3458('0x25')](_0x4312db[_0x3458('0x26')]);if(_0x4312db[_0x3458('0x27')]){delete _0x4312db['name'];}_0x344899[_0x3458('0x18')](_0x519027)['send'](_0x4312db);};}exports[_0x3458('0x28')]=function(_0x3a6809,_0x37958c){var _0x4accf8={},_0x123015={},_0x2ed82e={'count':0x0,'rows':[]};var _0x391bb0=_[_0x3458('0x29')](db['FreshsalesAccount'][_0x3458('0x2a')],function(_0x5bcf18){return{'name':_0x5bcf18[_0x3458('0x2b')],'type':_0x5bcf18[_0x3458('0x2c')][_0x3458('0x2d')]};});_0x123015[_0x3458('0x2e')]=_[_0x3458('0x29')](_0x391bb0,_0x3458('0x27'));_0x123015[_0x3458('0x2f')]=_[_0x3458('0x30')](_0x3a6809[_0x3458('0x2f')]);_0x123015['filters']=_['intersection'](_0x123015[_0x3458('0x2e')],_0x123015['query']);_0x4accf8[_0x3458('0x31')]=_[_0x3458('0x32')](_0x123015[_0x3458('0x2e')],qs[_0x3458('0x33')](_0x3a6809[_0x3458('0x2f')][_0x3458('0x33')]));_0x4accf8[_0x3458('0x31')]=_0x4accf8[_0x3458('0x31')]['length']?_0x4accf8['attributes']:_0x123015[_0x3458('0x2e')];if(!_0x3a6809['query'][_0x3458('0x34')](_0x3458('0x35'))){_0x4accf8[_0x3458('0x1e')]=qs['limit'](_0x3a6809[_0x3458('0x2f')][_0x3458('0x1e')]);_0x4accf8[_0x3458('0x1b')]=qs[_0x3458('0x1b')](_0x3a6809[_0x3458('0x2f')][_0x3458('0x1b')]);}_0x4accf8[_0x3458('0x36')]=qs[_0x3458('0x37')](_0x3a6809[_0x3458('0x2f')][_0x3458('0x37')]);_0x4accf8[_0x3458('0x38')]=qs[_0x3458('0x39')](_[_0x3458('0x3a')](_0x3a6809[_0x3458('0x2f')],_0x123015[_0x3458('0x39')]),_0x391bb0);if(_0x3a6809[_0x3458('0x2f')][_0x3458('0x3b')]){_0x4accf8['where']=_['merge'](_0x4accf8['where'],{'$or':_[_0x3458('0x29')](_0x391bb0,function(_0x441a4a){if(_0x441a4a['type']!==_0x3458('0x3c')){var _0x512177={};_0x512177[_0x441a4a[_0x3458('0x27')]]={'$like':'%'+_0x3a6809[_0x3458('0x2f')][_0x3458('0x3b')]+'%'};return _0x512177;}})});}_0x4accf8=_[_0x3458('0x3d')]({},_0x4accf8,_0x3a6809[_0x3458('0x3e')]);var _0x43d6d6={'where':_0x4accf8[_0x3458('0x38')]};return db['FreshsalesAccount']['count'](_0x43d6d6)[_0x3458('0x24')](function(_0x4fb0e4){_0x2ed82e[_0x3458('0x1d')]=_0x4fb0e4;if(_0x3a6809[_0x3458('0x2f')][_0x3458('0x3f')]){_0x4accf8[_0x3458('0x40')]=[{'all':!![]}];}return db[_0x3458('0x41')][_0x3458('0x42')](_0x4accf8);})[_0x3458('0x24')](function(_0x5a2b30){_0x2ed82e[_0x3458('0x43')]=_0x5a2b30;return _0x2ed82e;})[_0x3458('0x24')](respondWithFilteredResult(_0x37958c,_0x4accf8))[_0x3458('0x44')](handleError(_0x37958c,null));};exports[_0x3458('0x45')]=function(_0x48fcda,_0x519809){var _0x22792d={'raw':![],'where':{'id':_0x48fcda[_0x3458('0x46')]['id']}},_0x59e753={};_0x59e753[_0x3458('0x2e')]=_[_0x3458('0x30')](db['FreshsalesAccount'][_0x3458('0x2a')]);_0x59e753[_0x3458('0x2f')]=_[_0x3458('0x30')](_0x48fcda['query']);_0x59e753[_0x3458('0x39')]=_[_0x3458('0x32')](_0x59e753['model'],_0x59e753[_0x3458('0x2f')]);_0x22792d[_0x3458('0x31')]=_[_0x3458('0x32')](_0x59e753['model'],qs['fields'](_0x48fcda[_0x3458('0x2f')][_0x3458('0x33')]));_0x22792d['attributes']=_0x22792d['attributes'][_0x3458('0x47')]?_0x22792d[_0x3458('0x31')]:_0x59e753['model'];if(_0x48fcda[_0x3458('0x2f')][_0x3458('0x3f')]){_0x22792d[_0x3458('0x40')]=[{'all':!![]}];}_0x22792d=_[_0x3458('0x3d')]({},_0x22792d,_0x48fcda[_0x3458('0x3e')]);return db['FreshsalesAccount'][_0x3458('0x48')](_0x22792d)['then'](handleEntityNotFound(_0x519809,null))[_0x3458('0x24')](respondWithResult(_0x519809,null))['catch'](handleError(_0x519809,null));};exports[_0x3458('0x49')]=function(_0x30a405,_0x5a84ea){return db[_0x3458('0x41')][_0x3458('0x49')](_0x30a405[_0x3458('0x4a')],{})[_0x3458('0x24')](respondWithResult(_0x5a84ea,0xc9))[_0x3458('0x44')](handleError(_0x5a84ea,null));};exports[_0x3458('0x22')]=function(_0x56a844,_0x5a33f9){if(_0x56a844[_0x3458('0x4a')]['id']){delete _0x56a844['body']['id'];}return db['FreshsalesAccount'][_0x3458('0x48')]({'where':{'id':_0x56a844[_0x3458('0x46')]['id']}})[_0x3458('0x24')](handleEntityNotFound(_0x5a33f9,null))[_0x3458('0x24')](saveUpdates(_0x56a844[_0x3458('0x4a')],null))[_0x3458('0x24')](respondWithResult(_0x5a33f9,null))[_0x3458('0x44')](handleError(_0x5a33f9,null));};exports[_0x3458('0x23')]=function(_0x26f807,_0x12077b){return db[_0x3458('0x41')][_0x3458('0x48')]({'where':{'id':_0x26f807[_0x3458('0x46')]['id']}})[_0x3458('0x24')](handleEntityNotFound(_0x12077b,null))[_0x3458('0x24')](removeEntity(_0x12077b,null))[_0x3458('0x44')](handleError(_0x12077b,null));};exports['getConfigurations']=function(_0x2db1f7,_0x3db62f,_0x5037e1){var _0xe313b1={};var _0x5752e7={};var _0x2e2ed6;var _0x163220;return db[_0x3458('0x41')][_0x3458('0x4b')]({'where':{'id':_0x2db1f7[_0x3458('0x46')]['id']}})['then'](handleEntityNotFound(_0x3db62f,null))[_0x3458('0x24')](function(_0x8f80b4){if(_0x8f80b4){_0x2e2ed6=_0x8f80b4;_0x5752e7[_0x3458('0x2e')]=_[_0x3458('0x30')](db[_0x3458('0x4c')]['rawAttributes']);_0x5752e7['query']=_[_0x3458('0x30')](_0x2db1f7['query']);_0x5752e7['filters']=_['intersection'](_0x5752e7[_0x3458('0x2e')],_0x5752e7[_0x3458('0x2f')]);_0xe313b1[_0x3458('0x31')]=_[_0x3458('0x32')](_0x5752e7[_0x3458('0x2e')],qs['fields'](_0x2db1f7['query']['fields']));_0xe313b1[_0x3458('0x31')]=_0xe313b1[_0x3458('0x31')][_0x3458('0x47')]?_0xe313b1[_0x3458('0x31')]:_0x5752e7['model'];_0xe313b1[_0x3458('0x36')]=qs['sort'](_0x2db1f7[_0x3458('0x2f')][_0x3458('0x37')]);_0xe313b1[_0x3458('0x38')]=qs[_0x3458('0x39')](_['pick'](_0x2db1f7[_0x3458('0x2f')],_0x5752e7[_0x3458('0x39')]));if(_0x2db1f7[_0x3458('0x2f')][_0x3458('0x3b')]){_0xe313b1[_0x3458('0x38')]=_[_0x3458('0x3d')](_0xe313b1[_0x3458('0x38')],{'$or':_[_0x3458('0x29')](_0xe313b1[_0x3458('0x31')],function(_0x3b4ed6){var _0x54dd66={};_0x54dd66[_0x3b4ed6]={'$like':'%'+_0x2db1f7['query'][_0x3458('0x3b')]+'%'};return _0x54dd66;})});}_0xe313b1=_[_0x3458('0x3d')]({},_0xe313b1,_0x2db1f7['options']);return _0x2e2ed6[_0x3458('0x4d')](_0xe313b1);}})[_0x3458('0x24')](function(_0x312808){if(_0x312808){_0x163220=_0x312808[_0x3458('0x47')];if(!_0x2db1f7[_0x3458('0x2f')][_0x3458('0x34')](_0x3458('0x35'))){_0xe313b1[_0x3458('0x1e')]=qs['limit'](_0x2db1f7[_0x3458('0x2f')][_0x3458('0x1e')]);_0xe313b1[_0x3458('0x1b')]=qs[_0x3458('0x1b')](_0x2db1f7['query'][_0x3458('0x1b')]);}return _0x2e2ed6['getConfigurations'](_0xe313b1);}})[_0x3458('0x24')](function(_0x1676ac){if(_0x1676ac){return _0x1676ac?{'count':_0x163220,'rows':_0x1676ac}:null;}})['then'](respondWithResult(_0x3db62f,null))['catch'](handleError(_0x3db62f,null));};exports[_0x3458('0x4e')]=function(_0x3af041,_0x3a6259,_0x39b135){if(_0x3af041['body']['id']){delete _0x3af041[_0x3458('0x4a')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3af041['params']['id']}})['then'](handleEntityNotFound(_0x3a6259,null))[_0x3458('0x24')](function(_0x270718){if(_0x270718){_0x3af041[_0x3458('0x4a')][_0x3458('0x4f')]=_0x270718['id'];_0x3af041['body'][_0x3458('0x50')]=integrations[_0x3458('0x51')](_0x3af041[_0x3458('0x4a')]['channel'],_0x3af041[_0x3458('0x4a')]['type']);_0x3af041[_0x3458('0x4a')][_0x3458('0x52')]=integrations['getDescriptions'](_0x3af041['body'][_0x3458('0x53')],_0x3af041[_0x3458('0x4a')]['type']);return db[_0x3458('0x4c')][_0x3458('0x49')](_0x3af041[_0x3458('0x4a')],{'include':[{'model':db[_0x3458('0x54')],'as':'Subjects'},{'model':db[_0x3458('0x54')],'as':_0x3458('0x52')}]});}return null;})['then'](respondWithResult(_0x3a6259,null))[_0x3458('0x44')](handleError(_0x3a6259,null));};exports[_0x3458('0x55')]=function(_0x3f7fca,_0x5ee974,_0x35c6b8){var _0xd2eb17='';var _0x442410='';return db['FreshsalesAccount'][_0x3458('0x4b')]({'where':{'id':_0x3f7fca[_0x3458('0x46')]['id']},'attributes':['id',_0x3458('0x56'),_0x3458('0x57'),_0x3458('0x58')]})[_0x3458('0x24')](handleEntityNotFound(_0x5ee974,null))[_0x3458('0x24')](function(_0x211c42){if(_0x211c42){_0x442410=_0x211c42[_0x3458('0x56')];_0xd2eb17=_0x211c42['remoteUri'];var _0x19b457=_0x211c42[_0x3458('0x57')][_0x3458('0x59')](-0x1);if(_0x19b457==='/'){_0xd2eb17=_0xd2eb17[_0x3458('0x5a')](0x0,_0xd2eb17[_0x3458('0x5b')](_0x19b457));}return rp({'method':_0x3458('0x5c'),'uri':util[_0x3458('0x5d')]('%s%s',_0xd2eb17,_0x3458('0x5e')),'headers':{'Authorization':_0x3458('0x5f')+_0x211c42['apiKey']},'json':!![]});}})['then'](function(_0x3a73d5){if(_0x3a73d5){var _0x3bfe84=_0x3a73d5[_0x3458('0x60')];var _0x4024f2=![];var _0x3ba6ee=null;for(_0x3ba6ee=0x0;_0x3ba6ee<_0x3bfe84[_0x3458('0x47')];_0x3ba6ee++){if(_0x3bfe84[_0x3ba6ee][_0x3458('0x61')]===_0x442410){_0x4024f2=!![];}}if(_0x4024f2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x5ee974,null))[_0x3458('0x44')](function(_0x4b798b){var _0x3e4fbf=_0x3f7fca[_0x3458('0x2f')][_0x3458('0x62')]?0x1f4:_0x4b798b[_0x3458('0x63')]||0x1f4;logger[_0x3458('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x3458('0x55'),_0x3e4fbf,JSON[_0x3458('0x64')](_0x4b798b));delete _0x4b798b[_0x3458('0x27')];if(_0x3e4fbf===0x191){_0x3e4fbf=0x190;}_0x5ee974[_0x3458('0x18')](_0x3e4fbf)[_0x3458('0x65')](_0x3f7fca[_0x3458('0x2f')][_0x3458('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x4b798b[_0x3458('0x63')]}:_0x4b798b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2069650..891065e 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 _0xed1c=['path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','request-promise'];(function(_0x2a72e9,_0x4a094a){var _0x537e2b=function(_0x3d49e7){while(--_0x3d49e7){_0x2a72e9['push'](_0x2a72e9['shift']());}};_0x537e2b(++_0x4a094a);}(_0xed1c,0xe4));var _0xced1=function(_0x28f86a,_0x5614c2){_0x28f86a=_0x28f86a-0x0;var _0x200ab8=_0xed1c[_0x28f86a];return _0x200ab8;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));var integrations=require(_0xced1('0x6'));module[_0xced1('0x7')]=function(_0x37b22b,_0x59399e){return _0x37b22b[_0xced1('0x8')](_0xced1('0x9'),attributes,{'tableName':_0xced1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x5e482e,_0x2363db){var _0x36dff1=function(_0x560db7){while(--_0x560db7){_0x5e482e['push'](_0x5e482e['shift']());}};_0x36dff1(++_0x2363db);}(_0xa456,0x142));var _0x6a45=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xa456[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));var integrations=require(_0x6a45('0x9'));module[_0x6a45('0xa')]=function(_0x4dfbfa,_0x25cf8d){return _0x4dfbfa[_0x6a45('0xb')](_0x6a45('0xc'),attributes,{'tableName':_0x6a45('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 75d15f5..b960ddd 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 _0x0295=['find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount'];(function(_0x3c8985,_0x238ab7){var _0x472f36=function(_0xebdb38){while(--_0xebdb38){_0x3c8985['push'](_0x3c8985['shift']());}};_0x472f36(++_0x238ab7);}(_0x0295,0x1f0));var _0x5029=function(_0x272700,_0x525483){_0x272700=_0x272700-0x0;var _0x3927a4=_0x0295[_0x272700];return _0x3927a4;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['GetFreshsalesAccount']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0x1ed567[_0x5029('0x17')]?_0x1ed567['options'][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')]['attributes']||null:null,'limit':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')]['limit']||null:null,'include':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')],function(_0x125c26){return{'model':db[_0x125c26[_0x5029('0x1c')]],'as':_0x125c26['as'],'attributes':_0x125c26[_0x5029('0x1d')],'include':_0x125c26['include']?_['map'](_0x125c26['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1c')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1b')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x5e45c4){logger[_0x5029('0xb')](_0x5029('0x1e'),_0x1ed567);logger[_0x5029('0xd')]('GetFreshsalesAccount',_0x1ed567,JSON[_0x5029('0xf')](_0x5e45c4));_0x35de81(_0x5e45c4);})[_0x5029('0x14')](function(_0xe5313e){logger['error'](_0x5029('0x1e'),_0xe5313e[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155['error'](0x1f4,_0xe5313e[_0x5029('0x12')]));});});};exports[_0x5029('0x1f')]=function(_0x4434ff){var _0x1c3dd9=this;return new Promise(function(_0x196830,_0x2a1ed6){return db[_0x5029('0x15')][_0x5029('0x20')]({'raw':_0x4434ff[_0x5029('0x17')]?_0x4434ff[_0x5029('0x17')][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x4434ff[_0x5029('0x17')]?_0x4434ff['options'][_0x5029('0x19')]||null:null,'attributes':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')]['attributes']||null:null,'include':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x4434ff['options'][_0x5029('0x1a')],function(_0x15d882){return{'model':db[_0x15d882[_0x5029('0x1c')]],'as':_0x15d882['as'],'attributes':_0x15d882[_0x5029('0x1d')],'include':_0x15d882[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x15d882[_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1c')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x3e2d88){logger['info']('ShowFreshsalesAccount',_0x4434ff);logger[_0x5029('0xd')](_0x5029('0x1f'),_0x4434ff,JSON['stringify'](_0x3e2d88));_0x196830(_0x3e2d88);})['catch'](function(_0x9656f2){logger[_0x5029('0x10')](_0x5029('0x1f'),_0x9656f2[_0x5029('0x12')],_0x4434ff);_0x2a1ed6(_0x1c3dd9[_0x5029('0x10')](0x1f4,_0x9656f2[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','raw','ShowFreshsalesAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')]({'raw':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x531f75[_0x2227('0x1b')]?_0x531f75['options'][_0x2227('0x1c')]||null:null,'attributes':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'limit':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1e')]||null:null,'include':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1f')]?_[_0x2227('0x20')](_0x531f75['options'][_0x2227('0x1f')],function(_0x42d500){return{'model':db[_0x42d500['model']],'as':_0x42d500['as'],'attributes':_0x42d500[_0x2227('0x1d')],'include':_0x42d500[_0x2227('0x1f')]?_['map'](_0x42d500['include'],function(_0x17c7a4){return{'model':db[_0x17c7a4[_0x2227('0x21')]],'as':_0x17c7a4['as'],'attributes':_0x17c7a4[_0x2227('0x1d')],'include':_0x17c7a4[_0x2227('0x1f')]?_['map'](_0x17c7a4[_0x2227('0x1f')],function(_0x301304){return{'model':db[_0x301304[_0x2227('0x21')]],'as':_0x301304['as'],'attributes':_0x301304[_0x2227('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x204def){logger[_0x2227('0xd')](_0x2227('0x18'),_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x204def));_0x620012(_0x204def);})['catch'](function(_0x5d1d56){logger[_0x2227('0x12')]('GetFreshsalesAccount',_0x5d1d56[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0x5d1d56['message']));});});};exports['ShowFreshsalesAccount']=function(_0x1f1ba7){var _0x1818ba=this;return new Promise(function(_0x21838a,_0x4cc1e1){return db[_0x2227('0x19')]['find']({'raw':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x22')]===undefined?!![]:![]:!![],'where':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1c')]||null:null,'attributes':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'include':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')]['include']?_[_0x2227('0x20')](_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1f')],function(_0x6cd5d7){return{'model':db[_0x6cd5d7['model']],'as':_0x6cd5d7['as'],'attributes':_0x6cd5d7[_0x2227('0x1d')],'include':_0x6cd5d7[_0x2227('0x1f')]?_[_0x2227('0x20')](_0x6cd5d7[_0x2227('0x1f')],function(_0x5186a6){return{'model':db[_0x5186a6[_0x2227('0x21')]],'as':_0x5186a6['as'],'attributes':_0x5186a6[_0x2227('0x1d')],'include':_0x5186a6[_0x2227('0x1f')]?_['map'](_0x5186a6['include'],function(_0x35d9f1){return{'model':db[_0x35d9f1[_0x2227('0x21')]],'as':_0x35d9f1['as'],'attributes':_0x35d9f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2227('0xc')](function(_0x9a8cc3){logger['info'](_0x2227('0x23'),_0x1f1ba7);logger['debug'](_0x2227('0x23'),_0x1f1ba7,JSON[_0x2227('0x11')](_0x9a8cc3));_0x21838a(_0x9a8cc3);})[_0x2227('0x17')](function(_0x36db00){logger['error'](_0x2227('0x23'),_0x36db00['message'],_0x1f1ba7);_0x4cc1e1(_0x1818ba[_0x2227('0x12')](0x1f4,_0x36db00[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1afdd35..5f982eb 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 _0x4281=['get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x1cf1c7,_0x1e0f72){var _0x362b0a=function(_0xfec7cd){while(--_0xfec7cd){_0x1cf1c7['push'](_0x1cf1c7['shift']());}};_0x362b0a(++_0x1e0f72);}(_0x4281,0x167));var _0x1428=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x4281[_0x9e0cb3];return _0x5926b7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1428('0x0'));var timeout=require(_0x1428('0x1'));var express=require(_0x1428('0x2'));var router=express[_0x1428('0x3')]();var fs_extra=require(_0x1428('0x4'));var auth=require(_0x1428('0x5'));var interaction=require(_0x1428('0x6'));var config=require(_0x1428('0x7'));var controller=require(_0x1428('0x8'));router[_0x1428('0x9')]('/',auth['isAuthenticated'](),controller[_0x1428('0xa')]);router['get'](_0x1428('0xb'),auth[_0x1428('0xc')](),controller[_0x1428('0xd')]);router['get'](_0x1428('0xe'),auth[_0x1428('0xc')](),controller[_0x1428('0xf')]);router[_0x1428('0x9')](_0x1428('0x10'),auth[_0x1428('0xc')](),controller['getDescriptions']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1428('0x11')]);router[_0x1428('0x12')]('/',auth['isAuthenticated'](),controller[_0x1428('0x13')]);router['put']('/:id',auth[_0x1428('0xc')](),controller[_0x1428('0x14')]);router['delete'](_0x1428('0xb'),auth[_0x1428('0xc')](),controller[_0x1428('0x15')]);module[_0x1428('0x16')]=router; \ No newline at end of file +var _0xb84e=['show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0xbfc438,_0x16b6c8){var _0x48d62f=function(_0x4c8cb5){while(--_0x4c8cb5){_0xbfc438['push'](_0xbfc438['shift']());}};_0x48d62f(++_0x16b6c8);}(_0xb84e,0xb1));var _0xeb84=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0xb84e[_0x1f5887];return _0x21774b;};'use strict';var multer=require(_0xeb84('0x0'));var util=require(_0xeb84('0x1'));var path=require(_0xeb84('0x2'));var timeout=require(_0xeb84('0x3'));var express=require(_0xeb84('0x4'));var router=express[_0xeb84('0x5')]();var fs_extra=require(_0xeb84('0x6'));var auth=require(_0xeb84('0x7'));var interaction=require(_0xeb84('0x8'));var config=require(_0xeb84('0x9'));var controller=require(_0xeb84('0xa'));router[_0xeb84('0xb')]('/',auth[_0xeb84('0xc')](),controller[_0xeb84('0xd')]);router[_0xeb84('0xb')](_0xeb84('0xe'),auth[_0xeb84('0xc')](),controller[_0xeb84('0xf')]);router[_0xeb84('0xb')](_0xeb84('0x10'),auth['isAuthenticated'](),controller[_0xeb84('0x11')]);router[_0xeb84('0xb')](_0xeb84('0x12'),auth[_0xeb84('0xc')](),controller['getDescriptions']);router[_0xeb84('0xb')](_0xeb84('0x13'),auth[_0xeb84('0xc')](),controller[_0xeb84('0x14')]);router['post']('/',auth[_0xeb84('0xc')](),controller['create']);router[_0xeb84('0x15')](_0xeb84('0xe'),auth[_0xeb84('0xc')](),controller['update']);router['delete']('/:id',auth[_0xeb84('0xc')](),controller[_0xeb84('0x16')]);module[_0xeb84('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0729dd2..a710717 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 _0x5bfd=['STRING'];(function(_0x35a4df,_0x5ca614){var _0xc7fe31=function(_0x3d81cd){while(--_0x3d81cd){_0x35a4df['push'](_0x35a4df['shift']());}};_0xc7fe31(++_0x5ca614);}(_0x5bfd,0x187));var _0xd5bf=function(_0x429b33,_0x3ab6ab){_0x429b33=_0x429b33-0x0;var _0x2d8f2d=_0x5bfd[_0x429b33];return _0x2d8f2d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd5bf('0x0')]},'description':{'type':Sequelize[_0xd5bf('0x0')]}}; \ No newline at end of file +var _0xc5af=['STRING','sequelize'];(function(_0x2e04a,_0x34ec6f){var _0x497425=function(_0x56add4){while(--_0x56add4){_0x2e04a['push'](_0x2e04a['shift']());}};_0x497425(++_0x34ec6f);}(_0xc5af,0xcf));var _0xfc5a=function(_0x14ed07,_0x5092c7){_0x14ed07=_0x14ed07-0x0;var _0x35b083=_0xc5af[_0x14ed07];return _0x35b083;};'use strict';var Sequelize=require(_0xfc5a('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc5a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9766f96..b569d6f 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 _0xb697=['type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getSubjects','findOne','order','getDescriptions','hasOwnProperty','getFields','FreshsalesField','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','FreshsalesConfiguration','rawAttributes'];(function(_0xe16f38,_0x24dc91){var _0x4f8639=function(_0x30c70a){while(--_0x30c70a){_0xe16f38['push'](_0xe16f38['shift']());}};_0x4f8639(++_0x24dc91);}(_0xb697,0x73));var _0x7b69=function(_0x357e24,_0x220f27){_0x357e24=_0x357e24-0x0;var _0x128ebb=_0xb697[_0x357e24];return _0x128ebb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b69('0x0'));var zipdir=require(_0x7b69('0x1'));var jsonpatch=require(_0x7b69('0x2'));var rp=require(_0x7b69('0x3'));var moment=require(_0x7b69('0x4'));var BPromise=require(_0x7b69('0x5'));var Mustache=require(_0x7b69('0x6'));var util=require(_0x7b69('0x7'));var path=require(_0x7b69('0x8'));var sox=require(_0x7b69('0x9'));var csv=require(_0x7b69('0xa'));var ejs=require(_0x7b69('0xb'));var fs=require('fs');var fs_extra=require(_0x7b69('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7b69('0xd'));var jsforce=require(_0x7b69('0xe'));var deskjs=require(_0x7b69('0xf'));var toCsv=require(_0x7b69('0xa'));var querystring=require(_0x7b69('0x10'));var Papa=require(_0x7b69('0x11'));var Redis=require(_0x7b69('0x12'));var authService=require(_0x7b69('0x13'));var qs=require(_0x7b69('0x14'));var as=require(_0x7b69('0x15'));var hardwareService=require(_0x7b69('0x16'));var logger=require(_0x7b69('0x17'))(_0x7b69('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b69('0x19'));var db=require(_0x7b69('0x1a'))['db'];function respondWithStatusCode(_0x1f371c,_0x16a958){_0x16a958=_0x16a958||0xcc;return function(_0x16389f){if(_0x16389f){return _0x1f371c['sendStatus'](_0x16a958);}return _0x1f371c[_0x7b69('0x1b')](_0x16a958)['end']();};}function respondWithResult(_0xee3578,_0x5510f){_0x5510f=_0x5510f||0xc8;return function(_0xb45b6b){if(_0xb45b6b){return _0xee3578['status'](_0x5510f)[_0x7b69('0x1c')](_0xb45b6b);}};}function respondWithFilteredResult(_0x183444,_0x3ee9df){return function(_0x5040e1){if(_0x5040e1){var _0x361fba=typeof _0x3ee9df[_0x7b69('0x1d')]===_0x7b69('0x1e')&&typeof _0x3ee9df[_0x7b69('0x1f')]===_0x7b69('0x1e');var _0x355b14=_0x5040e1['count'];var _0x5bbc2a=_0x361fba?0x0:_0x3ee9df[_0x7b69('0x1d')];var _0x3882a5=_0x361fba?_0x5040e1[_0x7b69('0x20')]:_0x3ee9df[_0x7b69('0x1d')]+_0x3ee9df[_0x7b69('0x1f')];var _0x14adca;if(_0x3882a5>=_0x355b14){_0x3882a5=_0x355b14;_0x14adca=0xc8;}else{_0x14adca=0xce;}_0x183444[_0x7b69('0x1b')](_0x14adca);return _0x183444[_0x7b69('0x21')](_0x7b69('0x22'),_0x5bbc2a+'-'+_0x3882a5+'/'+_0x355b14)[_0x7b69('0x1c')](_0x5040e1);}return null;};}function patchUpdates(_0x71d1ba){return function(_0x7a3218){try{jsonpatch[_0x7b69('0x23')](_0x7a3218,_0x71d1ba,!![]);}catch(_0x163d09){return BPromise['reject'](_0x163d09);}return _0x7a3218[_0x7b69('0x24')]();};}function saveUpdates(_0x19a8f3,_0x114593){return function(_0x32029f){if(_0x32029f){return _0x32029f[_0x7b69('0x25')](_0x19a8f3)[_0x7b69('0x26')](function(_0x5d5baa){return _0x5d5baa;});}return null;};}function removeEntity(_0x319da2,_0x278f1b){return function(_0x8aabf8){if(_0x8aabf8){return _0x8aabf8[_0x7b69('0x27')]()['then'](function(){_0x319da2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7c128d,_0x28142e){return function(_0xe647d0){if(!_0xe647d0){_0x7c128d[_0x7b69('0x28')](0x194);}return _0xe647d0;};}function handleError(_0x54d0e6,_0x36cfda){_0x36cfda=_0x36cfda||0x1f4;return function(_0x32e112){logger[_0x7b69('0x29')](_0x32e112['stack']);if(_0x32e112[_0x7b69('0x2a')]){delete _0x32e112['name'];}_0x54d0e6['status'](_0x36cfda)[_0x7b69('0x2b')](_0x32e112);};}exports['index']=function(_0x1f6161,_0x1d5dac){var _0x58e2e7={},_0x264266={},_0x1319dc={'count':0x0,'rows':[]};var _0x4c240e=_[_0x7b69('0x2c')](db[_0x7b69('0x2d')][_0x7b69('0x2e')],function(_0x2cb8e4){return{'name':_0x2cb8e4['fieldName'],'type':_0x2cb8e4[_0x7b69('0x2f')][_0x7b69('0x30')]};});_0x264266[_0x7b69('0x31')]=_['map'](_0x4c240e,'name');_0x264266[_0x7b69('0x32')]=_[_0x7b69('0x33')](_0x1f6161[_0x7b69('0x32')]);_0x264266['filters']=_[_0x7b69('0x34')](_0x264266[_0x7b69('0x31')],_0x264266['query']);_0x58e2e7[_0x7b69('0x35')]=_[_0x7b69('0x34')](_0x264266['model'],qs[_0x7b69('0x36')](_0x1f6161[_0x7b69('0x32')]['fields']));_0x58e2e7[_0x7b69('0x35')]=_0x58e2e7['attributes'][_0x7b69('0x37')]?_0x58e2e7['attributes']:_0x264266[_0x7b69('0x31')];if(!_0x1f6161[_0x7b69('0x32')]['hasOwnProperty'](_0x7b69('0x38'))){_0x58e2e7[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x1f6161[_0x7b69('0x32')][_0x7b69('0x1f')]);_0x58e2e7[_0x7b69('0x1d')]=qs['offset'](_0x1f6161[_0x7b69('0x32')][_0x7b69('0x1d')]);}_0x58e2e7['order']=qs['sort'](_0x1f6161[_0x7b69('0x32')][_0x7b69('0x39')]);_0x58e2e7[_0x7b69('0x3a')]=qs[_0x7b69('0x3b')](_[_0x7b69('0x3c')](_0x1f6161['query'],_0x264266['filters']),_0x4c240e);if(_0x1f6161[_0x7b69('0x32')][_0x7b69('0x3d')]){_0x58e2e7['where']=_[_0x7b69('0x3e')](_0x58e2e7['where'],{'$or':_[_0x7b69('0x2c')](_0x4c240e,function(_0x151226){if(_0x151226[_0x7b69('0x2f')]!==_0x7b69('0x3f')){var _0x3fe97a={};_0x3fe97a[_0x151226[_0x7b69('0x2a')]]={'$like':'%'+_0x1f6161[_0x7b69('0x32')]['filter']+'%'};return _0x3fe97a;}})});}_0x58e2e7=_[_0x7b69('0x3e')]({},_0x58e2e7,_0x1f6161[_0x7b69('0x40')]);var _0x1688cb={'where':_0x58e2e7[_0x7b69('0x3a')]};return db[_0x7b69('0x2d')][_0x7b69('0x20')](_0x1688cb)[_0x7b69('0x26')](function(_0x2e318f){_0x1319dc[_0x7b69('0x20')]=_0x2e318f;if(_0x1f6161[_0x7b69('0x32')]['includeAll']){_0x58e2e7[_0x7b69('0x41')]=[{'all':!![]}];}return db[_0x7b69('0x2d')][_0x7b69('0x42')](_0x58e2e7);})['then'](function(_0x18ff1e){_0x1319dc[_0x7b69('0x43')]=_0x18ff1e;return _0x1319dc;})[_0x7b69('0x26')](respondWithFilteredResult(_0x1d5dac,_0x58e2e7))[_0x7b69('0x44')](handleError(_0x1d5dac,null));};exports['show']=function(_0x34218b,_0x18309c){var _0x133567={'raw':![],'where':{'id':_0x34218b[_0x7b69('0x45')]['id']}},_0x4afad0={};_0x4afad0[_0x7b69('0x31')]=_['keys'](db['FreshsalesConfiguration'][_0x7b69('0x2e')]);_0x4afad0['query']=_['keys'](_0x34218b['query']);_0x4afad0[_0x7b69('0x3b')]=_['intersection'](_0x4afad0['model'],_0x4afad0[_0x7b69('0x32')]);_0x133567[_0x7b69('0x35')]=_[_0x7b69('0x34')](_0x4afad0['model'],qs[_0x7b69('0x36')](_0x34218b[_0x7b69('0x32')]['fields']));_0x133567['attributes']=_0x133567[_0x7b69('0x35')][_0x7b69('0x37')]?_0x133567[_0x7b69('0x35')]:_0x4afad0[_0x7b69('0x31')];if(_0x34218b[_0x7b69('0x32')][_0x7b69('0x46')]){_0x133567[_0x7b69('0x41')]=[{'all':!![]}];}_0x133567=_[_0x7b69('0x3e')]({},_0x133567,_0x34218b[_0x7b69('0x40')]);return db['FreshsalesConfiguration'][_0x7b69('0x47')](_0x133567)['then'](handleEntityNotFound(_0x18309c,null))['then'](respondWithResult(_0x18309c,null))['catch'](handleError(_0x18309c,null));};exports[_0x7b69('0x48')]=function(_0xbbbff5,_0x30f24c){return db['FreshsalesConfiguration'][_0x7b69('0x48')](_0xbbbff5[_0x7b69('0x49')],{})[_0x7b69('0x26')](respondWithResult(_0x30f24c,0xc9))['catch'](handleError(_0x30f24c,null));};exports['update']=function(_0x42f493,_0x55afc9){if(_0x42f493[_0x7b69('0x49')]['id']){delete _0x42f493[_0x7b69('0x49')]['id'];}return db[_0x7b69('0x2d')]['find']({'where':{'id':_0x42f493[_0x7b69('0x45')]['id']}})[_0x7b69('0x26')](handleEntityNotFound(_0x55afc9,null))[_0x7b69('0x26')](saveUpdates(_0x42f493[_0x7b69('0x49')],null))['then'](respondWithResult(_0x55afc9,null))[_0x7b69('0x44')](handleError(_0x55afc9,null));};exports[_0x7b69('0x27')]=function(_0x33e44d,_0xb67edc){return db[_0x7b69('0x2d')]['find']({'where':{'id':_0x33e44d['params']['id']}})[_0x7b69('0x26')](handleEntityNotFound(_0xb67edc,null))[_0x7b69('0x26')](removeEntity(_0xb67edc,null))[_0x7b69('0x44')](handleError(_0xb67edc,null));};exports[_0x7b69('0x4a')]=function(_0x40cc88,_0x462893,_0x3d346f){var _0x4fe0e5={};var _0x46f1c2={};var _0x4d92dc;var _0xa81481;return db[_0x7b69('0x2d')][_0x7b69('0x4b')]({'where':{'id':_0x40cc88[_0x7b69('0x45')]['id']}})['then'](handleEntityNotFound(_0x462893,null))['then'](function(_0x28be4e){if(_0x28be4e){_0x4d92dc=_0x28be4e;_0x46f1c2[_0x7b69('0x31')]=_['keys'](db['FreshsalesField'][_0x7b69('0x2e')]);_0x46f1c2[_0x7b69('0x32')]=_[_0x7b69('0x33')](_0x40cc88[_0x7b69('0x32')]);_0x46f1c2[_0x7b69('0x3b')]=_[_0x7b69('0x34')](_0x46f1c2[_0x7b69('0x31')],_0x46f1c2['query']);_0x4fe0e5[_0x7b69('0x35')]=_[_0x7b69('0x34')](_0x46f1c2[_0x7b69('0x31')],qs[_0x7b69('0x36')](_0x40cc88[_0x7b69('0x32')][_0x7b69('0x36')]));_0x4fe0e5[_0x7b69('0x35')]=_0x4fe0e5['attributes'][_0x7b69('0x37')]?_0x4fe0e5['attributes']:_0x46f1c2['model'];_0x4fe0e5[_0x7b69('0x4c')]=qs[_0x7b69('0x39')](_0x40cc88['query'][_0x7b69('0x39')]);_0x4fe0e5['where']=qs['filters'](_[_0x7b69('0x3c')](_0x40cc88[_0x7b69('0x32')],_0x46f1c2[_0x7b69('0x3b')]));if(_0x40cc88[_0x7b69('0x32')]['filter']){_0x4fe0e5['where']=_[_0x7b69('0x3e')](_0x4fe0e5[_0x7b69('0x3a')],{'$or':_[_0x7b69('0x2c')](_0x4fe0e5[_0x7b69('0x35')],function(_0xe9ad34){var _0x520e24={};_0x520e24[_0xe9ad34]={'$like':'%'+_0x40cc88[_0x7b69('0x32')]['filter']+'%'};return _0x520e24;})});}_0x4fe0e5=_[_0x7b69('0x3e')]({},_0x4fe0e5,_0x40cc88[_0x7b69('0x40')]);return _0x4d92dc[_0x7b69('0x4a')](_0x4fe0e5);}})[_0x7b69('0x26')](function(_0x574c1c){if(_0x574c1c){_0xa81481=_0x574c1c['length'];if(!_0x40cc88[_0x7b69('0x32')]['hasOwnProperty'](_0x7b69('0x38'))){_0x4fe0e5[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x40cc88['query'][_0x7b69('0x1f')]);_0x4fe0e5[_0x7b69('0x1d')]=qs['offset'](_0x40cc88[_0x7b69('0x32')][_0x7b69('0x1d')]);}return _0x4d92dc[_0x7b69('0x4a')](_0x4fe0e5);}})[_0x7b69('0x26')](function(_0x4917a8){if(_0x4917a8){return _0x4917a8?{'count':_0xa81481,'rows':_0x4917a8}:null;}})[_0x7b69('0x26')](respondWithResult(_0x462893,null))[_0x7b69('0x44')](handleError(_0x462893,null));};exports['getDescriptions']=function(_0x500502,_0xe06e1e,_0x10cf35){var _0x22178a={};var _0xe3fe92={};var _0x288657;var _0x58f52d;return db[_0x7b69('0x2d')][_0x7b69('0x4b')]({'where':{'id':_0x500502[_0x7b69('0x45')]['id']}})['then'](handleEntityNotFound(_0xe06e1e,null))['then'](function(_0x12f77a){if(_0x12f77a){_0x288657=_0x12f77a;_0xe3fe92[_0x7b69('0x31')]=_[_0x7b69('0x33')](db['FreshsalesField']['rawAttributes']);_0xe3fe92['query']=_[_0x7b69('0x33')](_0x500502[_0x7b69('0x32')]);_0xe3fe92[_0x7b69('0x3b')]=_[_0x7b69('0x34')](_0xe3fe92[_0x7b69('0x31')],_0xe3fe92[_0x7b69('0x32')]);_0x22178a[_0x7b69('0x35')]=_['intersection'](_0xe3fe92[_0x7b69('0x31')],qs[_0x7b69('0x36')](_0x500502[_0x7b69('0x32')][_0x7b69('0x36')]));_0x22178a['attributes']=_0x22178a[_0x7b69('0x35')]['length']?_0x22178a[_0x7b69('0x35')]:_0xe3fe92[_0x7b69('0x31')];_0x22178a['order']=qs[_0x7b69('0x39')](_0x500502[_0x7b69('0x32')][_0x7b69('0x39')]);_0x22178a['where']=qs['filters'](_['pick'](_0x500502[_0x7b69('0x32')],_0xe3fe92[_0x7b69('0x3b')]));if(_0x500502[_0x7b69('0x32')][_0x7b69('0x3d')]){_0x22178a['where']=_[_0x7b69('0x3e')](_0x22178a[_0x7b69('0x3a')],{'$or':_[_0x7b69('0x2c')](_0x22178a['attributes'],function(_0x24813c){var _0x49828b={};_0x49828b[_0x24813c]={'$like':'%'+_0x500502[_0x7b69('0x32')]['filter']+'%'};return _0x49828b;})});}_0x22178a=_[_0x7b69('0x3e')]({},_0x22178a,_0x500502[_0x7b69('0x40')]);return _0x288657[_0x7b69('0x4d')](_0x22178a);}})['then'](function(_0x14cc48){if(_0x14cc48){_0x58f52d=_0x14cc48['length'];if(!_0x500502[_0x7b69('0x32')][_0x7b69('0x4e')]('nolimit')){_0x22178a[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x500502[_0x7b69('0x32')][_0x7b69('0x1f')]);_0x22178a[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x500502[_0x7b69('0x32')]['offset']);}return _0x288657[_0x7b69('0x4d')](_0x22178a);}})[_0x7b69('0x26')](function(_0x372154){if(_0x372154){return _0x372154?{'count':_0x58f52d,'rows':_0x372154}:null;}})[_0x7b69('0x26')](respondWithResult(_0xe06e1e,null))[_0x7b69('0x44')](handleError(_0xe06e1e,null));};exports[_0x7b69('0x4f')]=function(_0x3091c7,_0x3adb85,_0x25f93d){var _0x471422={};var _0x87b6f4={};var _0x24eac3;var _0x29b183;return db[_0x7b69('0x2d')][_0x7b69('0x4b')]({'where':{'id':_0x3091c7['params']['id']}})[_0x7b69('0x26')](handleEntityNotFound(_0x3adb85,null))[_0x7b69('0x26')](function(_0x263f3a){if(_0x263f3a){_0x24eac3=_0x263f3a;_0x87b6f4[_0x7b69('0x31')]=_['keys'](db[_0x7b69('0x50')][_0x7b69('0x2e')]);_0x87b6f4[_0x7b69('0x32')]=_[_0x7b69('0x33')](_0x3091c7[_0x7b69('0x32')]);_0x87b6f4['filters']=_['intersection'](_0x87b6f4['model'],_0x87b6f4['query']);_0x471422[_0x7b69('0x35')]=_[_0x7b69('0x34')](_0x87b6f4[_0x7b69('0x31')],qs['fields'](_0x3091c7[_0x7b69('0x32')][_0x7b69('0x36')]));_0x471422[_0x7b69('0x35')]=_0x471422['attributes']['length']?_0x471422[_0x7b69('0x35')]:_0x87b6f4['model'];_0x471422['order']=qs['sort'](_0x3091c7[_0x7b69('0x32')][_0x7b69('0x39')]);_0x471422['where']=qs[_0x7b69('0x3b')](_[_0x7b69('0x3c')](_0x3091c7['query'],_0x87b6f4[_0x7b69('0x3b')]));if(_0x3091c7[_0x7b69('0x32')][_0x7b69('0x3d')]){_0x471422[_0x7b69('0x3a')]=_['merge'](_0x471422[_0x7b69('0x3a')],{'$or':_[_0x7b69('0x2c')](_0x471422[_0x7b69('0x35')],function(_0x5d012f){var _0x3ee8f4={};_0x3ee8f4[_0x5d012f]={'$like':'%'+_0x3091c7['query'][_0x7b69('0x3d')]+'%'};return _0x3ee8f4;})});}_0x471422=_[_0x7b69('0x3e')]({},_0x471422,_0x3091c7[_0x7b69('0x40')]);return _0x24eac3[_0x7b69('0x4f')](_0x471422);}})[_0x7b69('0x26')](function(_0x2e6995){if(_0x2e6995){_0x29b183=_0x2e6995[_0x7b69('0x37')];if(!_0x3091c7[_0x7b69('0x32')][_0x7b69('0x4e')]('nolimit')){_0x471422[_0x7b69('0x1f')]=qs[_0x7b69('0x1f')](_0x3091c7[_0x7b69('0x32')]['limit']);_0x471422[_0x7b69('0x1d')]=qs[_0x7b69('0x1d')](_0x3091c7[_0x7b69('0x32')][_0x7b69('0x1d')]);}return _0x24eac3[_0x7b69('0x4f')](_0x471422);}})[_0x7b69('0x26')](function(_0x116fb7){if(_0x116fb7){return _0x116fb7?{'count':_0x29b183,'rows':_0x116fb7}:null;}})['then'](respondWithResult(_0x3adb85,null))[_0x7b69('0x44')](handleError(_0x3adb85,null));}; \ No newline at end of file +var _0x26e5=['getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','catch','params','keys','model','find','create','body','update','findOne','FreshsalesField','hasOwnProperty','getSubjects','getDescriptions'];(function(_0x5e1854,_0x48fb60){var _0x50eaee=function(_0x275807){while(--_0x275807){_0x5e1854['push'](_0x5e1854['shift']());}};_0x50eaee(++_0x48fb60);}(_0x26e5,0x1c9));var _0x526e=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x26e5[_0x5e9876];return _0x576c48;};'use strict';var emlformat=require(_0x526e('0x0'));var rimraf=require(_0x526e('0x1'));var zipdir=require(_0x526e('0x2'));var jsonpatch=require(_0x526e('0x3'));var rp=require(_0x526e('0x4'));var moment=require(_0x526e('0x5'));var BPromise=require(_0x526e('0x6'));var Mustache=require(_0x526e('0x7'));var util=require(_0x526e('0x8'));var path=require(_0x526e('0x9'));var sox=require('sox');var csv=require(_0x526e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x526e('0xb'));var _=require(_0x526e('0xc'));var squel=require(_0x526e('0xd'));var crypto=require(_0x526e('0xe'));var jsforce=require(_0x526e('0xf'));var deskjs=require(_0x526e('0x10'));var toCsv=require(_0x526e('0xa'));var querystring=require(_0x526e('0x11'));var Papa=require(_0x526e('0x12'));var Redis=require('ioredis');var authService=require(_0x526e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x526e('0x14'))('api');var utils=require(_0x526e('0x15'));var config=require(_0x526e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x526e('0x17'))['db'];function respondWithStatusCode(_0x4472c7,_0x55ec08){_0x55ec08=_0x55ec08||0xcc;return function(_0x59128a){if(_0x59128a){return _0x4472c7[_0x526e('0x18')](_0x55ec08);}return _0x4472c7[_0x526e('0x19')](_0x55ec08)[_0x526e('0x1a')]();};}function respondWithResult(_0x2c5675,_0x1e1c1b){_0x1e1c1b=_0x1e1c1b||0xc8;return function(_0x499e17){if(_0x499e17){return _0x2c5675[_0x526e('0x19')](_0x1e1c1b)['json'](_0x499e17);}};}function respondWithFilteredResult(_0x45d1c6,_0x3e283b){return function(_0x3ad64c){if(_0x3ad64c){var _0x43044a=typeof _0x3e283b[_0x526e('0x1b')]==='undefined'&&typeof _0x3e283b[_0x526e('0x1c')]==='undefined';var _0x518ea0=_0x3ad64c['count'];var _0x325627=_0x43044a?0x0:_0x3e283b[_0x526e('0x1b')];var _0x5d3255=_0x43044a?_0x3ad64c['count']:_0x3e283b['offset']+_0x3e283b[_0x526e('0x1c')];var _0x129c3c;if(_0x5d3255>=_0x518ea0){_0x5d3255=_0x518ea0;_0x129c3c=0xc8;}else{_0x129c3c=0xce;}_0x45d1c6[_0x526e('0x19')](_0x129c3c);return _0x45d1c6[_0x526e('0x1d')](_0x526e('0x1e'),_0x325627+'-'+_0x5d3255+'/'+_0x518ea0)['json'](_0x3ad64c);}return null;};}function patchUpdates(_0x1b9311){return function(_0x1f362a){try{jsonpatch[_0x526e('0x1f')](_0x1f362a,_0x1b9311,!![]);}catch(_0x3f4981){return BPromise[_0x526e('0x20')](_0x3f4981);}return _0x1f362a[_0x526e('0x21')]();};}function saveUpdates(_0x5365fc,_0x5872a3){return function(_0x5126c7){if(_0x5126c7){return _0x5126c7['update'](_0x5365fc)[_0x526e('0x22')](function(_0x2b9df9){return _0x2b9df9;});}return null;};}function removeEntity(_0x53565b,_0x2a4efe){return function(_0x3e5d0a){if(_0x3e5d0a){return _0x3e5d0a[_0x526e('0x23')]()[_0x526e('0x22')](function(){_0x53565b[_0x526e('0x19')](0xcc)[_0x526e('0x1a')]();});}};}function handleEntityNotFound(_0x409942,_0x20403a){return function(_0x5dfa91){if(!_0x5dfa91){_0x409942[_0x526e('0x18')](0x194);}return _0x5dfa91;};}function handleError(_0x175e3a,_0x409fb2){_0x409fb2=_0x409fb2||0x1f4;return function(_0x764cbe){logger[_0x526e('0x24')](_0x764cbe['stack']);if(_0x764cbe[_0x526e('0x25')]){delete _0x764cbe[_0x526e('0x25')];}_0x175e3a[_0x526e('0x19')](_0x409fb2)[_0x526e('0x26')](_0x764cbe);};}exports[_0x526e('0x27')]=function(_0xb562ed,_0x1baadb){var _0x4030e4={},_0x4cf3cf={},_0x5a94aa={'count':0x0,'rows':[]};var _0x1a996c=_[_0x526e('0x28')](db[_0x526e('0x29')][_0x526e('0x2a')],function(_0x112b1d){return{'name':_0x112b1d['fieldName'],'type':_0x112b1d[_0x526e('0x2b')][_0x526e('0x2c')]};});_0x4cf3cf['model']=_['map'](_0x1a996c,_0x526e('0x25'));_0x4cf3cf[_0x526e('0x2d')]=_['keys'](_0xb562ed[_0x526e('0x2d')]);_0x4cf3cf[_0x526e('0x2e')]=_[_0x526e('0x2f')](_0x4cf3cf['model'],_0x4cf3cf[_0x526e('0x2d')]);_0x4030e4[_0x526e('0x30')]=_[_0x526e('0x2f')](_0x4cf3cf['model'],qs['fields'](_0xb562ed[_0x526e('0x2d')][_0x526e('0x31')]));_0x4030e4[_0x526e('0x30')]=_0x4030e4[_0x526e('0x30')][_0x526e('0x32')]?_0x4030e4[_0x526e('0x30')]:_0x4cf3cf['model'];if(!_0xb562ed[_0x526e('0x2d')]['hasOwnProperty'](_0x526e('0x33'))){_0x4030e4[_0x526e('0x1c')]=qs['limit'](_0xb562ed['query']['limit']);_0x4030e4['offset']=qs[_0x526e('0x1b')](_0xb562ed['query']['offset']);}_0x4030e4[_0x526e('0x34')]=qs[_0x526e('0x35')](_0xb562ed[_0x526e('0x2d')][_0x526e('0x35')]);_0x4030e4[_0x526e('0x36')]=qs['filters'](_[_0x526e('0x37')](_0xb562ed[_0x526e('0x2d')],_0x4cf3cf[_0x526e('0x2e')]),_0x1a996c);if(_0xb562ed[_0x526e('0x2d')]['filter']){_0x4030e4[_0x526e('0x36')]=_['merge'](_0x4030e4[_0x526e('0x36')],{'$or':_[_0x526e('0x28')](_0x1a996c,function(_0x4b4b95){if(_0x4b4b95[_0x526e('0x2b')]!=='VIRTUAL'){var _0x4d3fa1={};_0x4d3fa1[_0x4b4b95[_0x526e('0x25')]]={'$like':'%'+_0xb562ed[_0x526e('0x2d')][_0x526e('0x38')]+'%'};return _0x4d3fa1;}})});}_0x4030e4=_[_0x526e('0x39')]({},_0x4030e4,_0xb562ed[_0x526e('0x3a')]);var _0x54e7b8={'where':_0x4030e4[_0x526e('0x36')]};return db['FreshsalesConfiguration'][_0x526e('0x3b')](_0x54e7b8)[_0x526e('0x22')](function(_0xc1188){_0x5a94aa[_0x526e('0x3b')]=_0xc1188;if(_0xb562ed[_0x526e('0x2d')][_0x526e('0x3c')]){_0x4030e4['include']=[{'all':!![]}];}return db[_0x526e('0x29')][_0x526e('0x3d')](_0x4030e4);})['then'](function(_0x404ad4){_0x5a94aa['rows']=_0x404ad4;return _0x5a94aa;})[_0x526e('0x22')](respondWithFilteredResult(_0x1baadb,_0x4030e4))[_0x526e('0x3e')](handleError(_0x1baadb,null));};exports['show']=function(_0x3346f6,_0x17f271){var _0x2f2fac={'raw':![],'where':{'id':_0x3346f6[_0x526e('0x3f')]['id']}},_0x37bce2={};_0x37bce2['model']=_[_0x526e('0x40')](db[_0x526e('0x29')][_0x526e('0x2a')]);_0x37bce2['query']=_[_0x526e('0x40')](_0x3346f6[_0x526e('0x2d')]);_0x37bce2[_0x526e('0x2e')]=_['intersection'](_0x37bce2[_0x526e('0x41')],_0x37bce2[_0x526e('0x2d')]);_0x2f2fac[_0x526e('0x30')]=_[_0x526e('0x2f')](_0x37bce2[_0x526e('0x41')],qs[_0x526e('0x31')](_0x3346f6['query']['fields']));_0x2f2fac['attributes']=_0x2f2fac[_0x526e('0x30')][_0x526e('0x32')]?_0x2f2fac[_0x526e('0x30')]:_0x37bce2[_0x526e('0x41')];if(_0x3346f6['query']['includeAll']){_0x2f2fac['include']=[{'all':!![]}];}_0x2f2fac=_['merge']({},_0x2f2fac,_0x3346f6['options']);return db['FreshsalesConfiguration'][_0x526e('0x42')](_0x2f2fac)[_0x526e('0x22')](handleEntityNotFound(_0x17f271,null))[_0x526e('0x22')](respondWithResult(_0x17f271,null))['catch'](handleError(_0x17f271,null));};exports[_0x526e('0x43')]=function(_0x3fac82,_0x6db351){return db[_0x526e('0x29')][_0x526e('0x43')](_0x3fac82[_0x526e('0x44')],{})[_0x526e('0x22')](respondWithResult(_0x6db351,0xc9))[_0x526e('0x3e')](handleError(_0x6db351,null));};exports[_0x526e('0x45')]=function(_0x5a637a,_0x1a7d3c){if(_0x5a637a['body']['id']){delete _0x5a637a[_0x526e('0x44')]['id'];}return db[_0x526e('0x29')]['find']({'where':{'id':_0x5a637a['params']['id']}})[_0x526e('0x22')](handleEntityNotFound(_0x1a7d3c,null))[_0x526e('0x22')](saveUpdates(_0x5a637a[_0x526e('0x44')],null))[_0x526e('0x22')](respondWithResult(_0x1a7d3c,null))['catch'](handleError(_0x1a7d3c,null));};exports[_0x526e('0x23')]=function(_0x4ddd08,_0x4a41fa){return db[_0x526e('0x29')][_0x526e('0x42')]({'where':{'id':_0x4ddd08['params']['id']}})[_0x526e('0x22')](handleEntityNotFound(_0x4a41fa,null))['then'](removeEntity(_0x4a41fa,null))[_0x526e('0x3e')](handleError(_0x4a41fa,null));};exports['getSubjects']=function(_0x373a76,_0x2ab5cc,_0x315cab){var _0x8e4ea8={};var _0x1b10de={};var _0x3f9eae;var _0x39c8fd;return db[_0x526e('0x29')][_0x526e('0x46')]({'where':{'id':_0x373a76[_0x526e('0x3f')]['id']}})[_0x526e('0x22')](handleEntityNotFound(_0x2ab5cc,null))[_0x526e('0x22')](function(_0x5d3536){if(_0x5d3536){_0x3f9eae=_0x5d3536;_0x1b10de[_0x526e('0x41')]=_[_0x526e('0x40')](db[_0x526e('0x47')][_0x526e('0x2a')]);_0x1b10de[_0x526e('0x2d')]=_['keys'](_0x373a76[_0x526e('0x2d')]);_0x1b10de[_0x526e('0x2e')]=_[_0x526e('0x2f')](_0x1b10de[_0x526e('0x41')],_0x1b10de['query']);_0x8e4ea8[_0x526e('0x30')]=_[_0x526e('0x2f')](_0x1b10de['model'],qs[_0x526e('0x31')](_0x373a76[_0x526e('0x2d')][_0x526e('0x31')]));_0x8e4ea8['attributes']=_0x8e4ea8[_0x526e('0x30')][_0x526e('0x32')]?_0x8e4ea8[_0x526e('0x30')]:_0x1b10de[_0x526e('0x41')];_0x8e4ea8[_0x526e('0x34')]=qs['sort'](_0x373a76[_0x526e('0x2d')][_0x526e('0x35')]);_0x8e4ea8[_0x526e('0x36')]=qs[_0x526e('0x2e')](_['pick'](_0x373a76[_0x526e('0x2d')],_0x1b10de[_0x526e('0x2e')]));if(_0x373a76['query'][_0x526e('0x38')]){_0x8e4ea8[_0x526e('0x36')]=_[_0x526e('0x39')](_0x8e4ea8[_0x526e('0x36')],{'$or':_[_0x526e('0x28')](_0x8e4ea8['attributes'],function(_0x33176c){var _0x13c5c4={};_0x13c5c4[_0x33176c]={'$like':'%'+_0x373a76[_0x526e('0x2d')][_0x526e('0x38')]+'%'};return _0x13c5c4;})});}_0x8e4ea8=_['merge']({},_0x8e4ea8,_0x373a76['options']);return _0x3f9eae['getSubjects'](_0x8e4ea8);}})['then'](function(_0x501833){if(_0x501833){_0x39c8fd=_0x501833['length'];if(!_0x373a76[_0x526e('0x2d')][_0x526e('0x48')](_0x526e('0x33'))){_0x8e4ea8[_0x526e('0x1c')]=qs[_0x526e('0x1c')](_0x373a76[_0x526e('0x2d')][_0x526e('0x1c')]);_0x8e4ea8[_0x526e('0x1b')]=qs[_0x526e('0x1b')](_0x373a76['query']['offset']);}return _0x3f9eae[_0x526e('0x49')](_0x8e4ea8);}})['then'](function(_0x2d932e){if(_0x2d932e){return _0x2d932e?{'count':_0x39c8fd,'rows':_0x2d932e}:null;}})['then'](respondWithResult(_0x2ab5cc,null))[_0x526e('0x3e')](handleError(_0x2ab5cc,null));};exports[_0x526e('0x4a')]=function(_0x3723be,_0x2a470a,_0x509fdb){var _0x20fc05={};var _0x2dc4d2={};var _0x140c8b;var _0x2e6489;return db[_0x526e('0x29')][_0x526e('0x46')]({'where':{'id':_0x3723be[_0x526e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2a470a,null))[_0x526e('0x22')](function(_0x1cfd53){if(_0x1cfd53){_0x140c8b=_0x1cfd53;_0x2dc4d2[_0x526e('0x41')]=_[_0x526e('0x40')](db[_0x526e('0x47')][_0x526e('0x2a')]);_0x2dc4d2[_0x526e('0x2d')]=_[_0x526e('0x40')](_0x3723be[_0x526e('0x2d')]);_0x2dc4d2[_0x526e('0x2e')]=_['intersection'](_0x2dc4d2[_0x526e('0x41')],_0x2dc4d2['query']);_0x20fc05[_0x526e('0x30')]=_[_0x526e('0x2f')](_0x2dc4d2[_0x526e('0x41')],qs['fields'](_0x3723be[_0x526e('0x2d')][_0x526e('0x31')]));_0x20fc05[_0x526e('0x30')]=_0x20fc05[_0x526e('0x30')]['length']?_0x20fc05[_0x526e('0x30')]:_0x2dc4d2[_0x526e('0x41')];_0x20fc05[_0x526e('0x34')]=qs[_0x526e('0x35')](_0x3723be['query'][_0x526e('0x35')]);_0x20fc05[_0x526e('0x36')]=qs[_0x526e('0x2e')](_[_0x526e('0x37')](_0x3723be['query'],_0x2dc4d2['filters']));if(_0x3723be['query']['filter']){_0x20fc05[_0x526e('0x36')]=_[_0x526e('0x39')](_0x20fc05[_0x526e('0x36')],{'$or':_['map'](_0x20fc05['attributes'],function(_0x35b424){var _0x53a8fa={};_0x53a8fa[_0x35b424]={'$like':'%'+_0x3723be[_0x526e('0x2d')][_0x526e('0x38')]+'%'};return _0x53a8fa;})});}_0x20fc05=_['merge']({},_0x20fc05,_0x3723be[_0x526e('0x3a')]);return _0x140c8b[_0x526e('0x4a')](_0x20fc05);}})[_0x526e('0x22')](function(_0x54a203){if(_0x54a203){_0x2e6489=_0x54a203[_0x526e('0x32')];if(!_0x3723be[_0x526e('0x2d')][_0x526e('0x48')](_0x526e('0x33'))){_0x20fc05[_0x526e('0x1c')]=qs[_0x526e('0x1c')](_0x3723be['query'][_0x526e('0x1c')]);_0x20fc05[_0x526e('0x1b')]=qs[_0x526e('0x1b')](_0x3723be[_0x526e('0x2d')][_0x526e('0x1b')]);}return _0x140c8b[_0x526e('0x4a')](_0x20fc05);}})['then'](function(_0x3ea6bc){if(_0x3ea6bc){return _0x3ea6bc?{'count':_0x2e6489,'rows':_0x3ea6bc}:null;}})['then'](respondWithResult(_0x2a470a,null))[_0x526e('0x3e')](handleError(_0x2a470a,null));};exports['getFields']=function(_0x4b19be,_0x38541c,_0x2411b4){var _0x4aa081={};var _0x24c465={};var _0x304b19;var _0x4ee20e;return db[_0x526e('0x29')][_0x526e('0x46')]({'where':{'id':_0x4b19be['params']['id']}})['then'](handleEntityNotFound(_0x38541c,null))[_0x526e('0x22')](function(_0x15c763){if(_0x15c763){_0x304b19=_0x15c763;_0x24c465[_0x526e('0x41')]=_[_0x526e('0x40')](db[_0x526e('0x47')]['rawAttributes']);_0x24c465[_0x526e('0x2d')]=_[_0x526e('0x40')](_0x4b19be[_0x526e('0x2d')]);_0x24c465['filters']=_['intersection'](_0x24c465['model'],_0x24c465['query']);_0x4aa081[_0x526e('0x30')]=_[_0x526e('0x2f')](_0x24c465['model'],qs[_0x526e('0x31')](_0x4b19be[_0x526e('0x2d')]['fields']));_0x4aa081[_0x526e('0x30')]=_0x4aa081['attributes'][_0x526e('0x32')]?_0x4aa081[_0x526e('0x30')]:_0x24c465[_0x526e('0x41')];_0x4aa081[_0x526e('0x34')]=qs[_0x526e('0x35')](_0x4b19be[_0x526e('0x2d')][_0x526e('0x35')]);_0x4aa081[_0x526e('0x36')]=qs[_0x526e('0x2e')](_[_0x526e('0x37')](_0x4b19be[_0x526e('0x2d')],_0x24c465[_0x526e('0x2e')]));if(_0x4b19be[_0x526e('0x2d')][_0x526e('0x38')]){_0x4aa081[_0x526e('0x36')]=_[_0x526e('0x39')](_0x4aa081[_0x526e('0x36')],{'$or':_['map'](_0x4aa081['attributes'],function(_0x29d545){var _0x289e05={};_0x289e05[_0x29d545]={'$like':'%'+_0x4b19be['query'][_0x526e('0x38')]+'%'};return _0x289e05;})});}_0x4aa081=_[_0x526e('0x39')]({},_0x4aa081,_0x4b19be[_0x526e('0x3a')]);return _0x304b19[_0x526e('0x4b')](_0x4aa081);}})['then'](function(_0x4e72dc){if(_0x4e72dc){_0x4ee20e=_0x4e72dc[_0x526e('0x32')];if(!_0x4b19be[_0x526e('0x2d')]['hasOwnProperty']('nolimit')){_0x4aa081[_0x526e('0x1c')]=qs[_0x526e('0x1c')](_0x4b19be['query'][_0x526e('0x1c')]);_0x4aa081[_0x526e('0x1b')]=qs['offset'](_0x4b19be[_0x526e('0x2d')][_0x526e('0x1b')]);}return _0x304b19[_0x526e('0x4b')](_0x4aa081);}})[_0x526e('0x22')](function(_0x1eb32b){if(_0x1eb32b){return _0x1eb32b?{'count':_0x4ee20e,'rows':_0x1eb32b}:null;}})[_0x526e('0x22')](respondWithResult(_0x38541c,null))[_0x526e('0x3e')](handleError(_0x38541c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 02e6e58..7b7ac9a 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 _0xc186=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x3a6e7e,_0x417e){var _0x4df5cc=function(_0xbcc02e){while(--_0xbcc02e){_0x3a6e7e['push'](_0x3a6e7e['shift']());}};_0x4df5cc(++_0x417e);}(_0xc186,0x1df));var _0x6c18=function(_0x33ecf7,_0x25adb9){_0x33ecf7=_0x33ecf7-0x0;var _0x355dc2=_0xc186[_0x33ecf7];return _0x355dc2;};'use strict';var _=require(_0x6c18('0x0'));var util=require(_0x6c18('0x1'));var logger=require('../../config/logger')(_0x6c18('0x2'));var moment=require(_0x6c18('0x3'));var BPromise=require(_0x6c18('0x4'));var rp=require(_0x6c18('0x5'));var fs=require('fs');var path=require(_0x6c18('0x6'));var rimraf=require(_0x6c18('0x7'));var config=require(_0x6c18('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x6c18('0x9')]=function(_0x4e9693,_0x259483){return _0x4e9693[_0x6c18('0xa')](_0x6c18('0xb'),attributes,{'tableName':_0x6c18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1799=['./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x9dd37c,_0x3e255e){var _0x2a522c=function(_0x2ce2ca){while(--_0x2ce2ca){_0x9dd37c['push'](_0x9dd37c['shift']());}};_0x2a522c(++_0x3e255e);}(_0x1799,0xf3));var _0x9179=function(_0x3cfcbe,_0x4bf7a8){_0x3cfcbe=_0x3cfcbe-0x0;var _0x479c18=_0x1799[_0x3cfcbe];return _0x479c18;};'use strict';var _=require(_0x9179('0x0'));var util=require(_0x9179('0x1'));var logger=require(_0x9179('0x2'))(_0x9179('0x3'));var moment=require(_0x9179('0x4'));var BPromise=require(_0x9179('0x5'));var rp=require(_0x9179('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9179('0x7'));var config=require(_0x9179('0x8'));var attributes=require(_0x9179('0x9'));module['exports']=function(_0x3b7996,_0x22ee0b){return _0x3b7996[_0x9179('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x9179('0xb'),'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 d82ecbc..7221b3b 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 _0x52db=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x1b42aa,_0x1dbee2){var _0x29e97f=function(_0x156756){while(--_0x156756){_0x1b42aa['push'](_0x1b42aa['shift']());}};_0x29e97f(++_0x1dbee2);}(_0x52db,0xc7));var _0xb52d=function(_0x255ccb,_0x491d17){_0x255ccb=_0x255ccb-0x0;var _0x46e88c=_0x52db[_0x255ccb];return _0x46e88c;};'use strict';var _=require('lodash');var util=require(_0xb52d('0x0'));var moment=require(_0xb52d('0x1'));var BPromise=require(_0xb52d('0x2'));var rs=require(_0xb52d('0x3'));var fs=require('fs');var Redis=require(_0xb52d('0x4'));var db=require(_0xb52d('0x5'))['db'];var utils=require(_0xb52d('0x6'));var logger=require(_0xb52d('0x7'))(_0xb52d('0x8'));var config=require(_0xb52d('0x9'));var jayson=require(_0xb52d('0xa'));var client=jayson[_0xb52d('0xb')][_0xb52d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x572a07,_0x2fb343,_0x500a44){return new BPromise(function(_0x5abc60,_0x1e545d){return client[_0xb52d('0xd')](_0x572a07,_0x500a44)[_0xb52d('0xe')](function(_0x1ec5a7){logger[_0xb52d('0xf')](_0xb52d('0x10'),_0x2fb343,_0xb52d('0x11'));logger['debug'](_0xb52d('0x12'),_0x2fb343,_0xb52d('0x11'),JSON[_0xb52d('0x13')](_0x1ec5a7));if(_0x1ec5a7[_0xb52d('0x14')]){if(_0x1ec5a7['error'][_0xb52d('0x15')]===0x1f4){logger['error'](_0xb52d('0x10'),_0x2fb343,_0x1ec5a7[_0xb52d('0x14')]['message']);return _0x1e545d(_0x1ec5a7[_0xb52d('0x14')][_0xb52d('0x16')]);}logger[_0xb52d('0x14')](_0xb52d('0x10'),_0x2fb343,_0x1ec5a7[_0xb52d('0x14')]['message']);return _0x5abc60(_0x1ec5a7[_0xb52d('0x14')][_0xb52d('0x16')]);}else{logger[_0xb52d('0xf')](_0xb52d('0x10'),_0x2fb343,_0xb52d('0x11'));_0x5abc60(_0x1ec5a7[_0xb52d('0x17')][_0xb52d('0x16')]);}})[_0xb52d('0x18')](function(_0x516d6a){logger[_0xb52d('0x14')](_0xb52d('0x10'),_0x2fb343,_0x516d6a);_0x1e545d(_0x516d6a);});});} \ No newline at end of file +var _0xe1d7=['../../config/logger','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xda2aa5,_0x21b21d){var _0x3445bc=function(_0x1c50ea){while(--_0x1c50ea){_0xda2aa5['push'](_0xda2aa5['shift']());}};_0x3445bc(++_0x21b21d);}(_0xe1d7,0x1dd));var _0x7e1d=function(_0x1e4177,_0x26a73a){_0x1e4177=_0x1e4177-0x0;var _0xa6e76c=_0xe1d7[_0x1e4177];return _0xa6e76c;};'use strict';var _=require(_0x7e1d('0x0'));var util=require('util');var moment=require(_0x7e1d('0x1'));var BPromise=require(_0x7e1d('0x2'));var rs=require(_0x7e1d('0x3'));var fs=require('fs');var Redis=require(_0x7e1d('0x4'));var db=require(_0x7e1d('0x5'))['db'];var utils=require(_0x7e1d('0x6'));var logger=require(_0x7e1d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e1d('0x8')][_0x7e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x256d38,_0x94dabf,_0x36aff9){return new BPromise(function(_0x55e6e6,_0x2363e3){return client[_0x7e1d('0xa')](_0x256d38,_0x36aff9)[_0x7e1d('0xb')](function(_0xdc30f3){logger[_0x7e1d('0xc')](_0x7e1d('0xd'),_0x94dabf,_0x7e1d('0xe'));logger[_0x7e1d('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x94dabf,'request\x20sent',JSON[_0x7e1d('0x10')](_0xdc30f3));if(_0xdc30f3[_0x7e1d('0x11')]){if(_0xdc30f3[_0x7e1d('0x11')][_0x7e1d('0x12')]===0x1f4){logger[_0x7e1d('0x11')](_0x7e1d('0xd'),_0x94dabf,_0xdc30f3[_0x7e1d('0x11')]['message']);return _0x2363e3(_0xdc30f3[_0x7e1d('0x11')][_0x7e1d('0x13')]);}logger[_0x7e1d('0x11')](_0x7e1d('0xd'),_0x94dabf,_0xdc30f3[_0x7e1d('0x11')][_0x7e1d('0x13')]);return _0x55e6e6(_0xdc30f3['error'][_0x7e1d('0x13')]);}else{logger[_0x7e1d('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x94dabf,_0x7e1d('0xe'));_0x55e6e6(_0xdc30f3[_0x7e1d('0x14')][_0x7e1d('0x13')]);}})[_0x7e1d('0x15')](function(_0x3349c0){logger[_0x7e1d('0x11')](_0x7e1d('0xd'),_0x94dabf,_0x3349c0);_0x2363e3(_0x3349c0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index a513079..6fc7517 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 _0x6822=['/:id','show','post','put','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x333e03,_0x34df1f){var _0x14135f=function(_0x3ca433){while(--_0x3ca433){_0x333e03['push'](_0x333e03['shift']());}};_0x14135f(++_0x34df1f);}(_0x6822,0x18c));var _0x2682=function(_0x31a0fe,_0xf1d1aa){_0x31a0fe=_0x31a0fe-0x0;var _0x4c5dad=_0x6822[_0x31a0fe];return _0x4c5dad;};'use strict';var multer=require('multer');var util=require(_0x2682('0x0'));var path=require(_0x2682('0x1'));var timeout=require(_0x2682('0x2'));var express=require(_0x2682('0x3'));var router=express['Router']();var fs_extra=require(_0x2682('0x4'));var auth=require(_0x2682('0x5'));var interaction=require(_0x2682('0x6'));var config=require(_0x2682('0x7'));var controller=require(_0x2682('0x8'));router[_0x2682('0x9')]('/',auth[_0x2682('0xa')](),controller[_0x2682('0xb')]);router[_0x2682('0x9')](_0x2682('0xc'),auth[_0x2682('0xa')](),controller[_0x2682('0xd')]);router[_0x2682('0xe')]('/',auth[_0x2682('0xa')](),controller['create']);router[_0x2682('0xf')](_0x2682('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2682('0xc'),auth[_0x2682('0xa')](),controller['destroy']);module[_0x2682('0x10')]=router; \ No newline at end of file +var _0x04b8=['update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','show','post','create','put','isAuthenticated'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x04b8,0x159));var _0x804b=function(_0x49dc49,_0x5b0a31){_0x49dc49=_0x49dc49-0x0;var _0x2e2af8=_0x04b8[_0x49dc49];return _0x2e2af8;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var fs_extra=require(_0x804b('0x3'));var auth=require(_0x804b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804b('0x5'));var controller=require(_0x804b('0x6'));router[_0x804b('0x7')]('/',auth['isAuthenticated'](),controller[_0x804b('0x8')]);router[_0x804b('0x7')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0xa')]);router[_0x804b('0xb')]('/',auth['isAuthenticated'](),controller[_0x804b('0xc')]);router[_0x804b('0xd')](_0x804b('0x9'),auth[_0x804b('0xe')](),controller[_0x804b('0xf')]);router['delete'](_0x804b('0x9'),auth[_0x804b('0xe')](),controller[_0x804b('0x10')]);module[_0x804b('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 d2e8f74..e0e3936 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 _0x774f=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x1178ae,_0x510501){var _0x32b2f2=function(_0x24b889){while(--_0x24b889){_0x1178ae['push'](_0x1178ae['shift']());}};_0x32b2f2(++_0x510501);}(_0x774f,0x88));var _0xf774=function(_0xd22f1c,_0x1569cf){_0xd22f1c=_0xd22f1c-0x0;var _0x4aafe2=_0x774f[_0xd22f1c];return _0x4aafe2;};'use strict';var Sequelize=require('sequelize');module[_0xf774('0x0')]={'type':{'type':Sequelize[_0xf774('0x1')](_0xf774('0x2'),'variable',_0xf774('0x3'),_0xf774('0x4'),_0xf774('0x5')),'defaultValue':_0xf774('0x2')},'content':{'type':Sequelize[_0xf774('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf774('0x1')](_0xf774('0x2'),_0xf774('0x7'),_0xf774('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf774('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf774('0x6')]}}; \ No newline at end of file +var _0x784e=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x15f477,_0x364fbc){var _0x1727f1=function(_0x4d5bf3){while(--_0x4d5bf3){_0x15f477['push'](_0x15f477['shift']());}};_0x1727f1(++_0x364fbc);}(_0x784e,0x90));var _0xe784=function(_0x437bcf,_0x8a938b){_0x437bcf=_0x437bcf-0x0;var _0x3934bc=_0x784e[_0x437bcf];return _0x3934bc;};'use strict';var Sequelize=require(_0xe784('0x0'));module[_0xe784('0x1')]={'type':{'type':Sequelize[_0xe784('0x2')](_0xe784('0x3'),_0xe784('0x4'),'customVariable','keyValue',_0xe784('0x5')),'defaultValue':_0xe784('0x3')},'content':{'type':Sequelize[_0xe784('0x6')]},'key':{'type':Sequelize[_0xe784('0x6')]},'keyType':{'type':Sequelize[_0xe784('0x2')](_0xe784('0x3'),'variable',_0xe784('0x7'))},'keyContent':{'type':Sequelize[_0xe784('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe784('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe784('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index cf1f1f1..275fad5 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 _0xfcbf=['create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','name','options','where','includeAll','include','rows','show','params','keys','find','catch'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfcbf,0x99));var _0xffcb=function(_0x2676ce,_0x5dd9d3){_0x2676ce=_0x2676ce-0x0;var _0x4338da=_0xfcbf[_0x2676ce];return _0x4338da;};'use strict';var emlformat=require(_0xffcb('0x0'));var rimraf=require(_0xffcb('0x1'));var zipdir=require(_0xffcb('0x2'));var jsonpatch=require(_0xffcb('0x3'));var rp=require(_0xffcb('0x4'));var moment=require('moment');var BPromise=require(_0xffcb('0x5'));var Mustache=require('mustache');var util=require(_0xffcb('0x6'));var path=require('path');var sox=require(_0xffcb('0x7'));var csv=require('to-csv');var ejs=require(_0xffcb('0x8'));var fs=require('fs');var fs_extra=require(_0xffcb('0x9'));var _=require('lodash');var squel=require(_0xffcb('0xa'));var crypto=require(_0xffcb('0xb'));var jsforce=require(_0xffcb('0xc'));var deskjs=require(_0xffcb('0xd'));var toCsv=require(_0xffcb('0xe'));var querystring=require(_0xffcb('0xf'));var Papa=require(_0xffcb('0x10'));var Redis=require(_0xffcb('0x11'));var authService=require(_0xffcb('0x12'));var qs=require(_0xffcb('0x13'));var as=require(_0xffcb('0x14'));var hardwareService=require(_0xffcb('0x15'));var logger=require('../../config/logger')(_0xffcb('0x16'));var utils=require('../../config/utils');var config=require(_0xffcb('0x17'));var licenseUtil=require(_0xffcb('0x18'));var db=require(_0xffcb('0x19'))['db'];function respondWithStatusCode(_0x2bb572,_0x40b208){_0x40b208=_0x40b208||0xcc;return function(_0x49bc3d){if(_0x49bc3d){return _0x2bb572[_0xffcb('0x1a')](_0x40b208);}return _0x2bb572['status'](_0x40b208)['end']();};}function respondWithResult(_0x451d8c,_0x1cd07e){_0x1cd07e=_0x1cd07e||0xc8;return function(_0x187dbc){if(_0x187dbc){return _0x451d8c[_0xffcb('0x1b')](_0x1cd07e)[_0xffcb('0x1c')](_0x187dbc);}};}function respondWithFilteredResult(_0x26be86,_0x302c9b){return function(_0x134d1c){if(_0x134d1c){var _0x143864=typeof _0x302c9b[_0xffcb('0x1d')]===_0xffcb('0x1e')&&typeof _0x302c9b[_0xffcb('0x1f')]==='undefined';var _0x360bb5=_0x134d1c[_0xffcb('0x20')];var _0x4092da=_0x143864?0x0:_0x302c9b[_0xffcb('0x1d')];var _0x2f5ac4=_0x143864?_0x134d1c[_0xffcb('0x20')]:_0x302c9b[_0xffcb('0x1d')]+_0x302c9b['limit'];var _0x2650a5;if(_0x2f5ac4>=_0x360bb5){_0x2f5ac4=_0x360bb5;_0x2650a5=0xc8;}else{_0x2650a5=0xce;}_0x26be86['status'](_0x2650a5);return _0x26be86[_0xffcb('0x21')](_0xffcb('0x22'),_0x4092da+'-'+_0x2f5ac4+'/'+_0x360bb5)[_0xffcb('0x1c')](_0x134d1c);}return null;};}function patchUpdates(_0x3c3626){return function(_0x12a766){try{jsonpatch[_0xffcb('0x23')](_0x12a766,_0x3c3626,!![]);}catch(_0x2462f8){return BPromise[_0xffcb('0x24')](_0x2462f8);}return _0x12a766[_0xffcb('0x25')]();};}function saveUpdates(_0x2c1d84,_0x3f5706){return function(_0x1b171e){if(_0x1b171e){return _0x1b171e['update'](_0x2c1d84)[_0xffcb('0x26')](function(_0x5958c5){return _0x5958c5;});}return null;};}function removeEntity(_0x1455c8,_0x59a7db){return function(_0x36398f){if(_0x36398f){return _0x36398f[_0xffcb('0x27')]()[_0xffcb('0x26')](function(){_0x1455c8[_0xffcb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d44e,_0x5c9413){return function(_0x4fc177){if(!_0x4fc177){_0x50d44e[_0xffcb('0x1a')](0x194);}return _0x4fc177;};}function handleError(_0x430c14,_0x10d5dd){_0x10d5dd=_0x10d5dd||0x1f4;return function(_0x3dfff0){logger[_0xffcb('0x28')](_0x3dfff0['stack']);if(_0x3dfff0['name']){delete _0x3dfff0['name'];}_0x430c14[_0xffcb('0x1b')](_0x10d5dd)['send'](_0x3dfff0);};}exports[_0xffcb('0x29')]=function(_0x36002b,_0x374a11){var _0x17cadd={},_0x29b5bd={},_0x3ede0a={'count':0x0,'rows':[]};var _0xd21bbc=_[_0xffcb('0x2a')](db[_0xffcb('0x2b')][_0xffcb('0x2c')],function(_0x2eb921){return{'name':_0x2eb921[_0xffcb('0x2d')],'type':_0x2eb921[_0xffcb('0x2e')][_0xffcb('0x2f')]};});_0x29b5bd['model']=_[_0xffcb('0x2a')](_0xd21bbc,'name');_0x29b5bd['query']=_['keys'](_0x36002b[_0xffcb('0x30')]);_0x29b5bd[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x29b5bd[_0xffcb('0x33')],_0x29b5bd[_0xffcb('0x30')]);_0x17cadd[_0xffcb('0x34')]=_[_0xffcb('0x32')](_0x29b5bd[_0xffcb('0x33')],qs[_0xffcb('0x35')](_0x36002b[_0xffcb('0x30')][_0xffcb('0x35')]));_0x17cadd['attributes']=_0x17cadd[_0xffcb('0x34')][_0xffcb('0x36')]?_0x17cadd[_0xffcb('0x34')]:_0x29b5bd[_0xffcb('0x33')];if(!_0x36002b[_0xffcb('0x30')][_0xffcb('0x37')](_0xffcb('0x38'))){_0x17cadd[_0xffcb('0x1f')]=qs[_0xffcb('0x1f')](_0x36002b[_0xffcb('0x30')]['limit']);_0x17cadd[_0xffcb('0x1d')]=qs[_0xffcb('0x1d')](_0x36002b[_0xffcb('0x30')]['offset']);}_0x17cadd[_0xffcb('0x39')]=qs[_0xffcb('0x3a')](_0x36002b[_0xffcb('0x30')][_0xffcb('0x3a')]);_0x17cadd['where']=qs['filters'](_[_0xffcb('0x3b')](_0x36002b[_0xffcb('0x30')],_0x29b5bd[_0xffcb('0x31')]),_0xd21bbc);if(_0x36002b[_0xffcb('0x30')]['filter']){_0x17cadd['where']=_[_0xffcb('0x3c')](_0x17cadd['where'],{'$or':_[_0xffcb('0x2a')](_0xd21bbc,function(_0x590cdf){if(_0x590cdf['type']!=='VIRTUAL'){var _0x959a50={};_0x959a50[_0x590cdf[_0xffcb('0x3d')]]={'$like':'%'+_0x36002b[_0xffcb('0x30')]['filter']+'%'};return _0x959a50;}})});}_0x17cadd=_[_0xffcb('0x3c')]({},_0x17cadd,_0x36002b[_0xffcb('0x3e')]);var _0x208643={'where':_0x17cadd[_0xffcb('0x3f')]};return db[_0xffcb('0x2b')][_0xffcb('0x20')](_0x208643)[_0xffcb('0x26')](function(_0x170b8b){_0x3ede0a[_0xffcb('0x20')]=_0x170b8b;if(_0x36002b[_0xffcb('0x30')][_0xffcb('0x40')]){_0x17cadd[_0xffcb('0x41')]=[{'all':!![]}];}return db[_0xffcb('0x2b')]['findAll'](_0x17cadd);})['then'](function(_0x4ca3b2){_0x3ede0a[_0xffcb('0x42')]=_0x4ca3b2;return _0x3ede0a;})['then'](respondWithFilteredResult(_0x374a11,_0x17cadd))['catch'](handleError(_0x374a11,null));};exports[_0xffcb('0x43')]=function(_0x33c71d,_0x462ccb){var _0x21b9e6={'raw':!![],'where':{'id':_0x33c71d[_0xffcb('0x44')]['id']}},_0x3c7c77={};_0x3c7c77['model']=_[_0xffcb('0x45')](db[_0xffcb('0x2b')][_0xffcb('0x2c')]);_0x3c7c77[_0xffcb('0x30')]=_[_0xffcb('0x45')](_0x33c71d['query']);_0x3c7c77[_0xffcb('0x31')]=_[_0xffcb('0x32')](_0x3c7c77['model'],_0x3c7c77['query']);_0x21b9e6[_0xffcb('0x34')]=_[_0xffcb('0x32')](_0x3c7c77[_0xffcb('0x33')],qs['fields'](_0x33c71d['query'][_0xffcb('0x35')]));_0x21b9e6[_0xffcb('0x34')]=_0x21b9e6[_0xffcb('0x34')][_0xffcb('0x36')]?_0x21b9e6[_0xffcb('0x34')]:_0x3c7c77[_0xffcb('0x33')];if(_0x33c71d[_0xffcb('0x30')][_0xffcb('0x40')]){_0x21b9e6[_0xffcb('0x41')]=[{'all':!![]}];}_0x21b9e6=_[_0xffcb('0x3c')]({},_0x21b9e6,_0x33c71d['options']);return db['FreshsalesField'][_0xffcb('0x46')](_0x21b9e6)[_0xffcb('0x26')](handleEntityNotFound(_0x462ccb,null))[_0xffcb('0x26')](respondWithResult(_0x462ccb,null))[_0xffcb('0x47')](handleError(_0x462ccb,null));};exports[_0xffcb('0x48')]=function(_0x3757d3,_0x47b966){return db[_0xffcb('0x2b')][_0xffcb('0x48')](_0x3757d3['body'],{})[_0xffcb('0x26')](respondWithResult(_0x47b966,0xc9))[_0xffcb('0x47')](handleError(_0x47b966,null));};exports[_0xffcb('0x49')]=function(_0x3dc7a6,_0x4d97db){if(_0x3dc7a6[_0xffcb('0x4a')]['id']){delete _0x3dc7a6['body']['id'];}return db['FreshsalesField'][_0xffcb('0x46')]({'where':{'id':_0x3dc7a6[_0xffcb('0x44')]['id']}})[_0xffcb('0x26')](handleEntityNotFound(_0x4d97db,null))[_0xffcb('0x26')](saveUpdates(_0x3dc7a6[_0xffcb('0x4a')],null))[_0xffcb('0x26')](respondWithResult(_0x4d97db,null))[_0xffcb('0x47')](handleError(_0x4d97db,null));};exports['destroy']=function(_0x119301,_0x289268){return db[_0xffcb('0x2b')][_0xffcb('0x46')]({'where':{'id':_0x119301[_0xffcb('0x44')]['id']}})[_0xffcb('0x26')](handleEntityNotFound(_0x289268,null))[_0xffcb('0x26')](removeEntity(_0x289268,null))['catch'](handleError(_0x289268,null));}; \ No newline at end of file +var _0x4961=['../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','FreshsalesField','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4961,0x72));var _0x1496=function(_0x2faa77,_0x2dc940){_0x2faa77=_0x2faa77-0x0;var _0x611ced=_0x4961[_0x2faa77];return _0x611ced;};'use strict';var emlformat=require(_0x1496('0x0'));var rimraf=require(_0x1496('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1496('0x2'));var rp=require(_0x1496('0x3'));var moment=require(_0x1496('0x4'));var BPromise=require(_0x1496('0x5'));var Mustache=require(_0x1496('0x6'));var util=require(_0x1496('0x7'));var path=require('path');var sox=require(_0x1496('0x8'));var csv=require(_0x1496('0x9'));var ejs=require(_0x1496('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1496('0xb'));var squel=require(_0x1496('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1496('0x9'));var querystring=require('querystring');var Papa=require(_0x1496('0xd'));var Redis=require(_0x1496('0xe'));var authService=require(_0x1496('0xf'));var qs=require(_0x1496('0x10'));var as=require(_0x1496('0x11'));var hardwareService=require(_0x1496('0x12'));var logger=require(_0x1496('0x13'))('api');var utils=require(_0x1496('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1496('0x15'))['db'];function respondWithStatusCode(_0x2c542d,_0x3bc920){_0x3bc920=_0x3bc920||0xcc;return function(_0x1eacb0){if(_0x1eacb0){return _0x2c542d[_0x1496('0x16')](_0x3bc920);}return _0x2c542d[_0x1496('0x17')](_0x3bc920)[_0x1496('0x18')]();};}function respondWithResult(_0x554cca,_0x571d42){_0x571d42=_0x571d42||0xc8;return function(_0x5ea0f7){if(_0x5ea0f7){return _0x554cca[_0x1496('0x17')](_0x571d42)['json'](_0x5ea0f7);}};}function respondWithFilteredResult(_0x47f03e,_0x5e5a7e){return function(_0x41f316){if(_0x41f316){var _0x1a7904=typeof _0x5e5a7e['offset']===_0x1496('0x19')&&typeof _0x5e5a7e[_0x1496('0x1a')]===_0x1496('0x19');var _0x4884c2=_0x41f316[_0x1496('0x1b')];var _0x3f1408=_0x1a7904?0x0:_0x5e5a7e[_0x1496('0x1c')];var _0x3da43a=_0x1a7904?_0x41f316[_0x1496('0x1b')]:_0x5e5a7e['offset']+_0x5e5a7e[_0x1496('0x1a')];var _0x5161ce;if(_0x3da43a>=_0x4884c2){_0x3da43a=_0x4884c2;_0x5161ce=0xc8;}else{_0x5161ce=0xce;}_0x47f03e[_0x1496('0x17')](_0x5161ce);return _0x47f03e['set'](_0x1496('0x1d'),_0x3f1408+'-'+_0x3da43a+'/'+_0x4884c2)['json'](_0x41f316);}return null;};}function patchUpdates(_0x50f038){return function(_0x353677){try{jsonpatch['apply'](_0x353677,_0x50f038,!![]);}catch(_0x1317d5){return BPromise[_0x1496('0x1e')](_0x1317d5);}return _0x353677[_0x1496('0x1f')]();};}function saveUpdates(_0x187d94,_0x698b27){return function(_0x2f5652){if(_0x2f5652){return _0x2f5652[_0x1496('0x20')](_0x187d94)[_0x1496('0x21')](function(_0x52b50b){return _0x52b50b;});}return null;};}function removeEntity(_0x45a8f1,_0x10b5ba){return function(_0x8774c3){if(_0x8774c3){return _0x8774c3[_0x1496('0x22')]()['then'](function(){_0x45a8f1[_0x1496('0x17')](0xcc)[_0x1496('0x18')]();});}};}function handleEntityNotFound(_0x477473,_0x28a173){return function(_0x408a3a){if(!_0x408a3a){_0x477473[_0x1496('0x16')](0x194);}return _0x408a3a;};}function handleError(_0x11e3b0,_0x1558fd){_0x1558fd=_0x1558fd||0x1f4;return function(_0x2afc1d){logger['error'](_0x2afc1d['stack']);if(_0x2afc1d[_0x1496('0x23')]){delete _0x2afc1d[_0x1496('0x23')];}_0x11e3b0[_0x1496('0x17')](_0x1558fd)[_0x1496('0x24')](_0x2afc1d);};}exports[_0x1496('0x25')]=function(_0x2a7006,_0xb669bf){var _0x4fd838={},_0x5ee64b={},_0x3bf0c5={'count':0x0,'rows':[]};var _0xba8962=_[_0x1496('0x26')](db['FreshsalesField'][_0x1496('0x27')],function(_0x3f304e){return{'name':_0x3f304e[_0x1496('0x28')],'type':_0x3f304e['type']['key']};});_0x5ee64b[_0x1496('0x29')]=_[_0x1496('0x26')](_0xba8962,_0x1496('0x23'));_0x5ee64b[_0x1496('0x2a')]=_[_0x1496('0x2b')](_0x2a7006[_0x1496('0x2a')]);_0x5ee64b[_0x1496('0x2c')]=_[_0x1496('0x2d')](_0x5ee64b['model'],_0x5ee64b['query']);_0x4fd838[_0x1496('0x2e')]=_[_0x1496('0x2d')](_0x5ee64b[_0x1496('0x29')],qs[_0x1496('0x2f')](_0x2a7006['query']['fields']));_0x4fd838['attributes']=_0x4fd838[_0x1496('0x2e')]['length']?_0x4fd838[_0x1496('0x2e')]:_0x5ee64b[_0x1496('0x29')];if(!_0x2a7006[_0x1496('0x2a')][_0x1496('0x30')](_0x1496('0x31'))){_0x4fd838[_0x1496('0x1a')]=qs[_0x1496('0x1a')](_0x2a7006['query'][_0x1496('0x1a')]);_0x4fd838[_0x1496('0x1c')]=qs['offset'](_0x2a7006[_0x1496('0x2a')][_0x1496('0x1c')]);}_0x4fd838['order']=qs[_0x1496('0x32')](_0x2a7006[_0x1496('0x2a')][_0x1496('0x32')]);_0x4fd838['where']=qs[_0x1496('0x2c')](_[_0x1496('0x33')](_0x2a7006[_0x1496('0x2a')],_0x5ee64b[_0x1496('0x2c')]),_0xba8962);if(_0x2a7006[_0x1496('0x2a')][_0x1496('0x34')]){_0x4fd838[_0x1496('0x35')]=_[_0x1496('0x36')](_0x4fd838['where'],{'$or':_[_0x1496('0x26')](_0xba8962,function(_0x5a5087){if(_0x5a5087['type']!==_0x1496('0x37')){var _0x329639={};_0x329639[_0x5a5087[_0x1496('0x23')]]={'$like':'%'+_0x2a7006['query'][_0x1496('0x34')]+'%'};return _0x329639;}})});}_0x4fd838=_[_0x1496('0x36')]({},_0x4fd838,_0x2a7006[_0x1496('0x38')]);var _0x35e1b5={'where':_0x4fd838[_0x1496('0x35')]};return db[_0x1496('0x39')][_0x1496('0x1b')](_0x35e1b5)['then'](function(_0x3dfb46){_0x3bf0c5[_0x1496('0x1b')]=_0x3dfb46;if(_0x2a7006[_0x1496('0x2a')][_0x1496('0x3a')]){_0x4fd838['include']=[{'all':!![]}];}return db[_0x1496('0x39')][_0x1496('0x3b')](_0x4fd838);})[_0x1496('0x21')](function(_0x5906f3){_0x3bf0c5['rows']=_0x5906f3;return _0x3bf0c5;})['then'](respondWithFilteredResult(_0xb669bf,_0x4fd838))[_0x1496('0x3c')](handleError(_0xb669bf,null));};exports[_0x1496('0x3d')]=function(_0x4f5b0f,_0x5433b5){var _0x562fc8={'raw':!![],'where':{'id':_0x4f5b0f[_0x1496('0x3e')]['id']}},_0x4f9e47={};_0x4f9e47[_0x1496('0x29')]=_[_0x1496('0x2b')](db[_0x1496('0x39')][_0x1496('0x27')]);_0x4f9e47[_0x1496('0x2a')]=_[_0x1496('0x2b')](_0x4f5b0f[_0x1496('0x2a')]);_0x4f9e47[_0x1496('0x2c')]=_[_0x1496('0x2d')](_0x4f9e47['model'],_0x4f9e47[_0x1496('0x2a')]);_0x562fc8[_0x1496('0x2e')]=_['intersection'](_0x4f9e47[_0x1496('0x29')],qs[_0x1496('0x2f')](_0x4f5b0f[_0x1496('0x2a')][_0x1496('0x2f')]));_0x562fc8[_0x1496('0x2e')]=_0x562fc8[_0x1496('0x2e')]['length']?_0x562fc8[_0x1496('0x2e')]:_0x4f9e47[_0x1496('0x29')];if(_0x4f5b0f[_0x1496('0x2a')][_0x1496('0x3a')]){_0x562fc8[_0x1496('0x3f')]=[{'all':!![]}];}_0x562fc8=_[_0x1496('0x36')]({},_0x562fc8,_0x4f5b0f[_0x1496('0x38')]);return db[_0x1496('0x39')][_0x1496('0x40')](_0x562fc8)[_0x1496('0x21')](handleEntityNotFound(_0x5433b5,null))[_0x1496('0x21')](respondWithResult(_0x5433b5,null))[_0x1496('0x3c')](handleError(_0x5433b5,null));};exports[_0x1496('0x41')]=function(_0xfdca50,_0x35b902){return db[_0x1496('0x39')][_0x1496('0x41')](_0xfdca50[_0x1496('0x42')],{})['then'](respondWithResult(_0x35b902,0xc9))[_0x1496('0x3c')](handleError(_0x35b902,null));};exports['update']=function(_0x36dfcc,_0x536286){if(_0x36dfcc[_0x1496('0x42')]['id']){delete _0x36dfcc['body']['id'];}return db[_0x1496('0x39')]['find']({'where':{'id':_0x36dfcc['params']['id']}})[_0x1496('0x21')](handleEntityNotFound(_0x536286,null))[_0x1496('0x21')](saveUpdates(_0x36dfcc[_0x1496('0x42')],null))['then'](respondWithResult(_0x536286,null))[_0x1496('0x3c')](handleError(_0x536286,null));};exports[_0x1496('0x22')]=function(_0x15e3c0,_0x3db865){return db[_0x1496('0x39')][_0x1496('0x40')]({'where':{'id':_0x15e3c0[_0x1496('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3db865,null))['then'](removeEntity(_0x3db865,null))['catch'](handleError(_0x3db865,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index eb98439..7ca5eea 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 _0x5386=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x5386,0x1e1));var _0x6538=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x5386[_0x151418];return _0x40e29a;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var logger=require(_0x6538('0x2'))(_0x6538('0x3'));var moment=require('moment');var BPromise=require(_0x6538('0x4'));var rp=require(_0x6538('0x5'));var fs=require('fs');var path=require(_0x6538('0x6'));var rimraf=require(_0x6538('0x7'));var config=require(_0x6538('0x8'));var attributes=require(_0x6538('0x9'));module[_0x6538('0xa')]=function(_0x2433c9,_0x4ed3fa){return _0x2433c9[_0x6538('0xb')]('FreshsalesField',attributes,{'tableName':_0x6538('0xc'),'paranoid':![],'indexes':[{'name':_0x6538('0xd'),'fields':[_0x6538('0xe'),_0x6538('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc23d=['../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5e05c7,_0x2b811b){var _0x44a163=function(_0xac1bd5){while(--_0xac1bd5){_0x5e05c7['push'](_0x5e05c7['shift']());}};_0x44a163(++_0x2b811b);}(_0xc23d,0x7f));var _0xdc23=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0xc23d[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0xdc23('0x0'));var util=require(_0xdc23('0x1'));var logger=require(_0xdc23('0x2'))(_0xdc23('0x3'));var moment=require(_0xdc23('0x4'));var BPromise=require(_0xdc23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc23('0x6'));var rimraf=require(_0xdc23('0x7'));var config=require(_0xdc23('0x8'));var attributes=require(_0xdc23('0x9'));module[_0xdc23('0xa')]=function(_0x5b6bec,_0x4a153f){return _0x5b6bec[_0xdc23('0xb')]('FreshsalesField',attributes,{'tableName':_0xdc23('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdc23('0xd'),_0xdc23('0xe')],'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 bc05ed2..b8523b8 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 _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3bc9ff,_0x483281){var _0x339524=function(_0x2159d1){while(--_0x2159d1){_0x3bc9ff['push'](_0x3bc9ff['shift']());}};_0x339524(++_0x483281);}(_0x2542,0x169));var _0x2254=function(_0x3c7e74,_0x431a67){_0x3c7e74=_0x3c7e74-0x0;var _0x5e7924=_0x2542[_0x3c7e74];return _0x5e7924;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2152ec,_0xdf9936){var _0x1be97d=function(_0x3d6f4c){while(--_0x3d6f4c){_0x2152ec['push'](_0x2152ec['shift']());}};_0x1be97d(++_0xdf9936);}(_0x1623,0xab));var _0x3162=function(_0x20e341,_0x1df75f){_0x20e341=_0x20e341-0x0;var _0x102de5=_0x1623[_0x20e341];return _0x102de5;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 8e6e7b8..eed067a 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x325ceb,_0x4d64e1){var _0x3750b4=function(_0x36717e){while(--_0x36717e){_0x325ceb['push'](_0x325ceb['shift']());}};_0x3750b4(++_0x4d64e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x43338c,_0x383692){var _0x48a3f8=function(_0x419234){while(--_0x419234){_0x43338c['push'](_0x43338c['shift']());}};_0x48a3f8(++_0x383692);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 99c2ddd..dfee4a4 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 _0xbb8d=['newTab','sequelize','STRING','ENUM','integrationTab'];(function(_0x4ecd45,_0x1a8abe){var _0x2b2354=function(_0x5111e1){while(--_0x5111e1){_0x4ecd45['push'](_0x4ecd45['shift']());}};_0x2b2354(++_0x1a8abe);}(_0xbb8d,0x146));var _0xdbb8=function(_0xa8df59,_0xc5c653){_0xa8df59=_0xa8df59-0x0;var _0xafed7f=_0xbb8d[_0xa8df59];return _0xafed7f;};'use strict';var Sequelize=require(_0xdbb8('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbb8('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0xdbb8('0x1')]},'password':{'type':Sequelize[_0xdbb8('0x1')]},'clientId':{'type':Sequelize[_0xdbb8('0x1')]},'clientSecret':{'type':Sequelize[_0xdbb8('0x1')]},'securityToken':{'type':Sequelize[_0xdbb8('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdbb8('0x2')](_0xdbb8('0x3'),_0xdbb8('0x4')),'defaultValue':_0xdbb8('0x3')}}; \ No newline at end of file +var _0xa169=['newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x5258af,_0x1a7744){var _0x4ad327=function(_0x1b8bce){while(--_0x1b8bce){_0x5258af['push'](_0x5258af['shift']());}};_0x4ad327(++_0x1a7744);}(_0xa169,0xaa));var _0x9a16=function(_0x145399,_0x47de69){_0x145399=_0x145399-0x0;var _0xd37d78=_0xa169[_0x145399];return _0xd37d78;};'use strict';var Sequelize=require(_0x9a16('0x0'));module[_0x9a16('0x1')]={'name':{'type':Sequelize[_0x9a16('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x9a16('0x3')},'remoteUri':{'type':Sequelize[_0x9a16('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9a16('0x2')]},'clientSecret':{'type':Sequelize[_0x9a16('0x2')]},'securityToken':{'type':Sequelize[_0x9a16('0x2')]},'serverUrl':{'type':Sequelize[_0x9a16('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a16('0x4')]('integrationTab',_0x9a16('0x5')),'defaultValue':_0x9a16('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d4e7aad..67b9b74 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 _0xf998=['ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','value','boolean','true','False','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','pick','filter','where','options','rows','catch','show','params','includeAll','include','merge','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getDescriptions','channel','SalesforceField','Descriptions','getFields','Task','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','describe'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0xf998,0x182));var _0x8f99=function(_0x552b03,_0x48e023){_0x552b03=_0x552b03-0x0;var _0x14ab19=_0xf998[_0x552b03];return _0x14ab19;};'use strict';var emlformat=require(_0x8f99('0x0'));var rimraf=require(_0x8f99('0x1'));var zipdir=require(_0x8f99('0x2'));var jsonpatch=require(_0x8f99('0x3'));var rp=require(_0x8f99('0x4'));var moment=require(_0x8f99('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f99('0x6'));var path=require(_0x8f99('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('lodash');var squel=require('squel');var crypto=require(_0x8f99('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x8f99('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8f99('0xa'));var Papa=require(_0x8f99('0xb'));var Redis=require(_0x8f99('0xc'));var authService=require(_0x8f99('0xd'));var qs=require(_0x8f99('0xe'));var as=require(_0x8f99('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f99('0x10'))('api');var utils=require(_0x8f99('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8f99('0x12'));var db=require(_0x8f99('0x13'))['db'];var integrations=require(_0x8f99('0x14'));function respondWithStatusCode(_0xe7941,_0x5743d7){_0x5743d7=_0x5743d7||0xcc;return function(_0x53e5d8){if(_0x53e5d8){return _0xe7941[_0x8f99('0x15')](_0x5743d7);}return _0xe7941[_0x8f99('0x16')](_0x5743d7)[_0x8f99('0x17')]();};}function respondWithResult(_0x5b674e,_0xdd76a7){_0xdd76a7=_0xdd76a7||0xc8;return function(_0x431b95){if(_0x431b95){return _0x5b674e[_0x8f99('0x16')](_0xdd76a7)[_0x8f99('0x18')](_0x431b95);}};}function respondWithFilteredResult(_0x1c1fd1,_0x4c1248){return function(_0x126499){if(_0x126499){var _0x591202=typeof _0x4c1248['offset']==='undefined'&&typeof _0x4c1248['limit']===_0x8f99('0x19');var _0x5b9d96=_0x126499[_0x8f99('0x1a')];var _0x2c5a23=_0x591202?0x0:_0x4c1248['offset'];var _0x1e470f=_0x591202?_0x126499[_0x8f99('0x1a')]:_0x4c1248['offset']+_0x4c1248[_0x8f99('0x1b')];var _0x393eac;if(_0x1e470f>=_0x5b9d96){_0x1e470f=_0x5b9d96;_0x393eac=0xc8;}else{_0x393eac=0xce;}_0x1c1fd1[_0x8f99('0x16')](_0x393eac);return _0x1c1fd1[_0x8f99('0x1c')](_0x8f99('0x1d'),_0x2c5a23+'-'+_0x1e470f+'/'+_0x5b9d96)[_0x8f99('0x18')](_0x126499);}return null;};}function patchUpdates(_0x288507){return function(_0x5b2049){try{jsonpatch[_0x8f99('0x1e')](_0x5b2049,_0x288507,!![]);}catch(_0xd98ab9){return BPromise[_0x8f99('0x1f')](_0xd98ab9);}return _0x5b2049[_0x8f99('0x20')]();};}function saveUpdates(_0x26ba1b,_0xba309b){return function(_0xb2020d){if(_0xb2020d){return _0xb2020d['update'](_0x26ba1b)['then'](function(_0x413467){return _0x413467;});}return null;};}function removeEntity(_0x32e81d,_0x3c02fc){return function(_0x3e6c1c){if(_0x3e6c1c){return _0x3e6c1c[_0x8f99('0x21')]()[_0x8f99('0x22')](function(){_0x32e81d[_0x8f99('0x16')](0xcc)[_0x8f99('0x17')]();});}};}function handleEntityNotFound(_0xbaf8b,_0xba8b6e){return function(_0xdce052){if(!_0xdce052){_0xbaf8b['sendStatus'](0x194);}return _0xdce052;};}function handleError(_0x17e022,_0x39276e){_0x39276e=_0x39276e||0x1f4;return function(_0x1e879e){logger['error'](_0x1e879e[_0x8f99('0x23')]);if(_0x1e879e[_0x8f99('0x24')]){delete _0x1e879e[_0x8f99('0x24')];}_0x17e022['status'](_0x39276e)[_0x8f99('0x25')](_0x1e879e);};}exports['index']=function(_0x57a099,_0x5db87c){var _0x56d14e={},_0x439241={},_0x56132b={'count':0x0,'rows':[]};var _0x10c016=_[_0x8f99('0x26')](db[_0x8f99('0x27')][_0x8f99('0x28')],function(_0x12aa90){return{'name':_0x12aa90[_0x8f99('0x29')],'type':_0x12aa90[_0x8f99('0x2a')][_0x8f99('0x2b')]};});_0x439241[_0x8f99('0x2c')]=_[_0x8f99('0x26')](_0x10c016,_0x8f99('0x24'));_0x439241[_0x8f99('0x2d')]=_[_0x8f99('0x2e')](_0x57a099['query']);_0x439241[_0x8f99('0x2f')]=_['intersection'](_0x439241['model'],_0x439241[_0x8f99('0x2d')]);_0x56d14e[_0x8f99('0x30')]=_[_0x8f99('0x31')](_0x439241[_0x8f99('0x2c')],qs[_0x8f99('0x32')](_0x57a099['query']['fields']));_0x56d14e[_0x8f99('0x30')]=_0x56d14e['attributes'][_0x8f99('0x33')]?_0x56d14e[_0x8f99('0x30')]:_0x439241['model'];if(!_0x57a099['query']['hasOwnProperty'](_0x8f99('0x34'))){_0x56d14e[_0x8f99('0x1b')]=qs['limit'](_0x57a099['query'][_0x8f99('0x1b')]);_0x56d14e[_0x8f99('0x35')]=qs[_0x8f99('0x35')](_0x57a099[_0x8f99('0x2d')]['offset']);}_0x56d14e[_0x8f99('0x36')]=qs[_0x8f99('0x37')](_0x57a099[_0x8f99('0x2d')][_0x8f99('0x37')]);_0x56d14e['where']=qs['filters'](_[_0x8f99('0x38')](_0x57a099['query'],_0x439241['filters']),_0x10c016);if(_0x57a099[_0x8f99('0x2d')][_0x8f99('0x39')]){_0x56d14e[_0x8f99('0x3a')]=_['merge'](_0x56d14e[_0x8f99('0x3a')],{'$or':_[_0x8f99('0x26')](_0x10c016,function(_0x35674b){if(_0x35674b[_0x8f99('0x2a')]!=='VIRTUAL'){var _0x4e59a4={};_0x4e59a4[_0x35674b[_0x8f99('0x24')]]={'$like':'%'+_0x57a099[_0x8f99('0x2d')][_0x8f99('0x39')]+'%'};return _0x4e59a4;}})});}_0x56d14e=_['merge']({},_0x56d14e,_0x57a099[_0x8f99('0x3b')]);var _0x3018fa={'where':_0x56d14e[_0x8f99('0x3a')]};return db[_0x8f99('0x27')][_0x8f99('0x1a')](_0x3018fa)[_0x8f99('0x22')](function(_0x1a5140){_0x56132b[_0x8f99('0x1a')]=_0x1a5140;if(_0x57a099[_0x8f99('0x2d')]['includeAll']){_0x56d14e['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x56d14e);})[_0x8f99('0x22')](function(_0x4de7d0){_0x56132b[_0x8f99('0x3c')]=_0x4de7d0;return _0x56132b;})['then'](respondWithFilteredResult(_0x5db87c,_0x56d14e))[_0x8f99('0x3d')](handleError(_0x5db87c,null));};exports[_0x8f99('0x3e')]=function(_0x2cfcf0,_0xf13722){var _0x580e5d={'raw':![],'where':{'id':_0x2cfcf0[_0x8f99('0x3f')]['id']}},_0x83e92b={};_0x83e92b[_0x8f99('0x2c')]=_[_0x8f99('0x2e')](db[_0x8f99('0x27')][_0x8f99('0x28')]);_0x83e92b['query']=_[_0x8f99('0x2e')](_0x2cfcf0[_0x8f99('0x2d')]);_0x83e92b[_0x8f99('0x2f')]=_[_0x8f99('0x31')](_0x83e92b[_0x8f99('0x2c')],_0x83e92b[_0x8f99('0x2d')]);_0x580e5d[_0x8f99('0x30')]=_[_0x8f99('0x31')](_0x83e92b['model'],qs['fields'](_0x2cfcf0[_0x8f99('0x2d')]['fields']));_0x580e5d[_0x8f99('0x30')]=_0x580e5d[_0x8f99('0x30')][_0x8f99('0x33')]?_0x580e5d[_0x8f99('0x30')]:_0x83e92b[_0x8f99('0x2c')];if(_0x2cfcf0[_0x8f99('0x2d')][_0x8f99('0x40')]){_0x580e5d[_0x8f99('0x41')]=[{'all':!![]}];}_0x580e5d=_[_0x8f99('0x42')]({},_0x580e5d,_0x2cfcf0['options']);return db['SalesforceAccount'][_0x8f99('0x43')](_0x580e5d)[_0x8f99('0x22')](handleEntityNotFound(_0xf13722,null))[_0x8f99('0x22')](respondWithResult(_0xf13722,null))[_0x8f99('0x3d')](handleError(_0xf13722,null));};exports[_0x8f99('0x44')]=function(_0x8cdd97,_0x4a5e45){return db['SalesforceAccount']['create'](_0x8cdd97[_0x8f99('0x45')],{})[_0x8f99('0x22')](respondWithResult(_0x4a5e45,0xc9))[_0x8f99('0x3d')](handleError(_0x4a5e45,null));};exports[_0x8f99('0x46')]=function(_0x31f101,_0x538740){if(_0x31f101[_0x8f99('0x45')]['id']){delete _0x31f101[_0x8f99('0x45')]['id'];}return db[_0x8f99('0x27')][_0x8f99('0x43')]({'where':{'id':_0x31f101[_0x8f99('0x3f')]['id']}})[_0x8f99('0x22')](handleEntityNotFound(_0x538740,null))[_0x8f99('0x22')](saveUpdates(_0x31f101['body'],null))[_0x8f99('0x22')](respondWithResult(_0x538740,null))['catch'](handleError(_0x538740,null));};exports[_0x8f99('0x21')]=function(_0x168c53,_0x523c11){return db[_0x8f99('0x27')][_0x8f99('0x43')]({'where':{'id':_0x168c53[_0x8f99('0x3f')]['id']}})['then'](handleEntityNotFound(_0x523c11,null))[_0x8f99('0x22')](removeEntity(_0x523c11,null))[_0x8f99('0x3d')](handleError(_0x523c11,null));};exports[_0x8f99('0x47')]=function(_0x10aace,_0xe46885,_0x5ba571){var _0x4b73c4={};var _0x22250d={};var _0x49b710;var _0x47c87c;return db[_0x8f99('0x27')][_0x8f99('0x48')]({'where':{'id':_0x10aace[_0x8f99('0x3f')]['id']}})[_0x8f99('0x22')](handleEntityNotFound(_0xe46885,null))[_0x8f99('0x22')](function(_0x119cb3){if(_0x119cb3){_0x49b710=_0x119cb3;_0x22250d[_0x8f99('0x2c')]=_['keys'](db[_0x8f99('0x49')][_0x8f99('0x28')]);_0x22250d['query']=_['keys'](_0x10aace[_0x8f99('0x2d')]);_0x22250d[_0x8f99('0x2f')]=_['intersection'](_0x22250d['model'],_0x22250d[_0x8f99('0x2d')]);_0x4b73c4[_0x8f99('0x30')]=_[_0x8f99('0x31')](_0x22250d[_0x8f99('0x2c')],qs[_0x8f99('0x32')](_0x10aace['query'][_0x8f99('0x32')]));_0x4b73c4[_0x8f99('0x30')]=_0x4b73c4[_0x8f99('0x30')][_0x8f99('0x33')]?_0x4b73c4['attributes']:_0x22250d['model'];_0x4b73c4[_0x8f99('0x36')]=qs[_0x8f99('0x37')](_0x10aace['query'][_0x8f99('0x37')]);_0x4b73c4[_0x8f99('0x3a')]=qs['filters'](_['pick'](_0x10aace['query'],_0x22250d[_0x8f99('0x2f')]));if(_0x10aace['query'][_0x8f99('0x39')]){_0x4b73c4[_0x8f99('0x3a')]=_[_0x8f99('0x42')](_0x4b73c4[_0x8f99('0x3a')],{'$or':_[_0x8f99('0x26')](_0x4b73c4[_0x8f99('0x30')],function(_0x118d9f){var _0x1b1e23={};_0x1b1e23[_0x118d9f]={'$like':'%'+_0x10aace[_0x8f99('0x2d')]['filter']+'%'};return _0x1b1e23;})});}_0x4b73c4=_[_0x8f99('0x42')]({},_0x4b73c4,_0x10aace[_0x8f99('0x3b')]);return _0x49b710[_0x8f99('0x47')](_0x4b73c4);}})['then'](function(_0x36aa93){if(_0x36aa93){_0x47c87c=_0x36aa93[_0x8f99('0x33')];if(!_0x10aace[_0x8f99('0x2d')][_0x8f99('0x4a')](_0x8f99('0x34'))){_0x4b73c4[_0x8f99('0x1b')]=qs['limit'](_0x10aace[_0x8f99('0x2d')]['limit']);_0x4b73c4[_0x8f99('0x35')]=qs[_0x8f99('0x35')](_0x10aace['query'][_0x8f99('0x35')]);}return _0x49b710['getConfigurations'](_0x4b73c4);}})[_0x8f99('0x22')](function(_0x56d506){if(_0x56d506){return _0x56d506?{'count':_0x47c87c,'rows':_0x56d506}:null;}})[_0x8f99('0x22')](respondWithResult(_0xe46885,null))[_0x8f99('0x3d')](handleError(_0xe46885,null));};exports[_0x8f99('0x4b')]=function(_0x2fa11a,_0x207f7e,_0x23bc4a){if(_0x2fa11a[_0x8f99('0x45')]['id']){delete _0x2fa11a[_0x8f99('0x45')]['id'];}return db[_0x8f99('0x27')]['findOne']({'where':{'id':_0x2fa11a[_0x8f99('0x3f')]['id']}})[_0x8f99('0x22')](handleEntityNotFound(_0x207f7e,null))[_0x8f99('0x22')](function(_0xd3151e){if(_0xd3151e){_0x2fa11a['body'][_0x8f99('0x4c')]=_0xd3151e['id'];_0x2fa11a[_0x8f99('0x45')][_0x8f99('0x4d')]=integrations['getSubjects'](_0x2fa11a[_0x8f99('0x45')]['channel'],_0x2fa11a[_0x8f99('0x45')][_0x8f99('0x2a')]);_0x2fa11a[_0x8f99('0x45')]['Descriptions']=integrations[_0x8f99('0x4e')](_0x2fa11a[_0x8f99('0x45')][_0x8f99('0x4f')],_0x2fa11a['body'][_0x8f99('0x2a')]);return db[_0x8f99('0x49')][_0x8f99('0x44')](_0x2fa11a['body'],{'include':[{'model':db[_0x8f99('0x50')],'as':_0x8f99('0x4d')},{'model':db[_0x8f99('0x50')],'as':_0x8f99('0x51')}]});}return null;})[_0x8f99('0x22')](respondWithResult(_0x207f7e,null))[_0x8f99('0x3d')](handleError(_0x207f7e,null));};exports[_0x8f99('0x52')]=function(_0x169861,_0x25679a,_0x639e6){var _0x5a6886;var _0x1ba495='';var _0xfee4d3=_0x8f99('0x53');return db['SalesforceAccount']['findOne']({'where':{'id':_0x169861[_0x8f99('0x3f')]['id']},'attributes':['id','remoteUri','clientId',_0x8f99('0x54'),_0x8f99('0x55'),_0x8f99('0x56'),_0x8f99('0x57')]})['then'](handleEntityNotFound(_0x25679a,null))[_0x8f99('0x22')](function(_0x143cae){if(_0x143cae){_0x1ba495=_0x143cae['remoteUri'];var _0x41883d=_0x1ba495[_0x8f99('0x58')](-0x1);if(_0x41883d==='/'){_0x1ba495=_0x1ba495[_0x8f99('0x59')](0x0,_0x1ba495[_0x8f99('0x5a')](_0x41883d));}_0x5a6886=new jsforce[(_0x8f99('0x5b'))]({'oauth2':{'loginUrl':_0x1ba495,'clientId':_0x143cae[_0x8f99('0x5c')],'clientSecret':_0x143cae[_0x8f99('0x54')]}});return _0x5a6886[_0x8f99('0x5d')](_0x143cae[_0x8f99('0x55')],_0x143cae[_0x8f99('0x56')][_0x8f99('0x5e')](_0x143cae[_0x8f99('0x57')]));}})[_0x8f99('0x22')](function(_0x1563d2){if(_0x1563d2){if(!_[_0x8f99('0x5f')](_0x169861[_0x8f99('0x2d')][_0x8f99('0x60')])){_0xfee4d3=_0x169861[_0x8f99('0x2d')][_0x8f99('0x60')];}return _0x5a6886['sobject'](_0xfee4d3)[_0x8f99('0x61')]();}})[_0x8f99('0x22')](function(_0x4de2ee){var _0x47c8aa=['OwnerId',_0x8f99('0x62'),_0x8f99('0x63'),_0x8f99('0x64'),_0x8f99('0x65'),_0x8f99('0x66')];var _0x36d9d4=[_0x8f99('0x67'),_0x8f99('0x68'),_0x8f99('0x69'),'boolean',_0x8f99('0x6a'),'textarea',_0x8f99('0x6b')];if(_0x4de2ee){_[_0x8f99('0x6c')](_0x4de2ee[_0x8f99('0x32')],function(_0x51a05c){return _0x47c8aa[_0x8f99('0x6d')](_0x51a05c[_0x8f99('0x24')])||!_0x36d9d4[_0x8f99('0x6d')](_0x51a05c[_0x8f99('0x2a')]);});return{'count':_0x4de2ee['fields'][_0x8f99('0x33')],'rows':_[_0x8f99('0x26')](_0x4de2ee['fields'],function(_0x1c769f){return{'id':_0x1c769f[_0x8f99('0x24')],'name':_0x1c769f[_0x8f99('0x6e')],'custom':_0x1c769f[_0x8f99('0x6f')],'options':_0x1c769f[_0x8f99('0x70')]['length']>0x0?_[_0x8f99('0x26')](_0x1c769f[_0x8f99('0x70')],function(_0x365cf9){return{'name':_0x365cf9['label'],'value':_0x365cf9[_0x8f99('0x71')]};}):_0x1c769f[_0x8f99('0x2a')]==_0x8f99('0x72')?[{'name':'True','value':_0x8f99('0x73')},{'name':_0x8f99('0x74'),'value':'false'}]:[]};})};}})[_0x8f99('0x22')](respondWithResult(_0x25679a,null))['catch'](function(_0x39b9f5){var _0x1e8fc9=_0x169861[_0x8f99('0x2d')]['test']?0x1f4:_0x39b9f5[_0x8f99('0x75')]||0x1f4;logger[_0x8f99('0x76')](_0x8f99('0x77'),_0x8f99('0x52'),_0x1e8fc9,JSON['stringify'](_0x39b9f5));delete _0x39b9f5[_0x8f99('0x24')];if(_0x1e8fc9===0x191){_0x1e8fc9=0x190;}_0x25679a[_0x8f99('0x16')](_0x1e8fc9)[_0x8f99('0x25')](_0x169861[_0x8f99('0x2d')]['test']?{'message':_0x8f99('0x78'),'statusCode':_0x39b9f5[_0x8f99('0x75')]}:_0x39b9f5);});}; \ No newline at end of file +var _0xaed6=['order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','SalesforceConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','SalesforceField','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','Connection','login','concat','isNil','ticketType','sobject','ActivityDate','IsRecurrence','Subject','Description','string','int','boolean','phone','includes','label','custom','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x5285f9,_0x2bd7d7){var _0x6edc0c=function(_0x5ae671){while(--_0x5ae671){_0x5285f9['push'](_0x5285f9['shift']());}};_0x6edc0c(++_0x2bd7d7);}(_0xaed6,0xb5));var _0x6aed=function(_0x15ddd8,_0x36d611){_0x15ddd8=_0x15ddd8-0x0;var _0x4de35f=_0xaed6[_0x15ddd8];return _0x4de35f;};'use strict';var emlformat=require(_0x6aed('0x0'));var rimraf=require(_0x6aed('0x1'));var zipdir=require(_0x6aed('0x2'));var jsonpatch=require(_0x6aed('0x3'));var rp=require(_0x6aed('0x4'));var moment=require(_0x6aed('0x5'));var BPromise=require(_0x6aed('0x6'));var Mustache=require(_0x6aed('0x7'));var util=require(_0x6aed('0x8'));var path=require('path');var sox=require(_0x6aed('0x9'));var csv=require('to-csv');var ejs=require(_0x6aed('0xa'));var fs=require('fs');var fs_extra=require(_0x6aed('0xb'));var _=require('lodash');var squel=require(_0x6aed('0xc'));var crypto=require(_0x6aed('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6aed('0xe'));var toCsv=require(_0x6aed('0xf'));var querystring=require('querystring');var Papa=require(_0x6aed('0x10'));var Redis=require(_0x6aed('0x11'));var authService=require(_0x6aed('0x12'));var qs=require(_0x6aed('0x13'));var as=require(_0x6aed('0x14'));var hardwareService=require(_0x6aed('0x15'));var logger=require('../../config/logger')(_0x6aed('0x16'));var utils=require(_0x6aed('0x17'));var config=require(_0x6aed('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6aed('0x19'))['db'];var integrations=require(_0x6aed('0x1a'));function respondWithStatusCode(_0x2febc8,_0x56ed3d){_0x56ed3d=_0x56ed3d||0xcc;return function(_0x1a7ea8){if(_0x1a7ea8){return _0x2febc8[_0x6aed('0x1b')](_0x56ed3d);}return _0x2febc8[_0x6aed('0x1c')](_0x56ed3d)[_0x6aed('0x1d')]();};}function respondWithResult(_0x44c33d,_0x14ee71){_0x14ee71=_0x14ee71||0xc8;return function(_0x58061d){if(_0x58061d){return _0x44c33d['status'](_0x14ee71)['json'](_0x58061d);}};}function respondWithFilteredResult(_0xafad91,_0x2e6362){return function(_0x5e7351){if(_0x5e7351){var _0x4e2a93=typeof _0x2e6362[_0x6aed('0x1e')]==='undefined'&&typeof _0x2e6362[_0x6aed('0x1f')]===_0x6aed('0x20');var _0x2db61f=_0x5e7351[_0x6aed('0x21')];var _0x2785a6=_0x4e2a93?0x0:_0x2e6362['offset'];var _0x1ab6e7=_0x4e2a93?_0x5e7351[_0x6aed('0x21')]:_0x2e6362[_0x6aed('0x1e')]+_0x2e6362['limit'];var _0x39442e;if(_0x1ab6e7>=_0x2db61f){_0x1ab6e7=_0x2db61f;_0x39442e=0xc8;}else{_0x39442e=0xce;}_0xafad91['status'](_0x39442e);return _0xafad91[_0x6aed('0x22')](_0x6aed('0x23'),_0x2785a6+'-'+_0x1ab6e7+'/'+_0x2db61f)[_0x6aed('0x24')](_0x5e7351);}return null;};}function patchUpdates(_0x4e3542){return function(_0x322c7a){try{jsonpatch['apply'](_0x322c7a,_0x4e3542,!![]);}catch(_0x7dbb7c){return BPromise['reject'](_0x7dbb7c);}return _0x322c7a['save']();};}function saveUpdates(_0x2fd8c6,_0x51e216){return function(_0x2c5091){if(_0x2c5091){return _0x2c5091['update'](_0x2fd8c6)[_0x6aed('0x25')](function(_0x43ec4b){return _0x43ec4b;});}return null;};}function removeEntity(_0x195ac3,_0x13d7f3){return function(_0x4fd380){if(_0x4fd380){return _0x4fd380[_0x6aed('0x26')]()[_0x6aed('0x25')](function(){_0x195ac3[_0x6aed('0x1c')](0xcc)[_0x6aed('0x1d')]();});}};}function handleEntityNotFound(_0x394ba7,_0xd89fb0){return function(_0x35c496){if(!_0x35c496){_0x394ba7['sendStatus'](0x194);}return _0x35c496;};}function handleError(_0x2a3b72,_0x3b91de){_0x3b91de=_0x3b91de||0x1f4;return function(_0x12e526){logger[_0x6aed('0x27')](_0x12e526['stack']);if(_0x12e526[_0x6aed('0x28')]){delete _0x12e526[_0x6aed('0x28')];}_0x2a3b72[_0x6aed('0x1c')](_0x3b91de)['send'](_0x12e526);};}exports['index']=function(_0x248acc,_0x2d5472){var _0x5743fd={},_0x3895e4={},_0x26d50b={'count':0x0,'rows':[]};var _0x41a260=_[_0x6aed('0x29')](db['SalesforceAccount'][_0x6aed('0x2a')],function(_0x4f4883){return{'name':_0x4f4883[_0x6aed('0x2b')],'type':_0x4f4883[_0x6aed('0x2c')][_0x6aed('0x2d')]};});_0x3895e4[_0x6aed('0x2e')]=_['map'](_0x41a260,_0x6aed('0x28'));_0x3895e4[_0x6aed('0x2f')]=_[_0x6aed('0x30')](_0x248acc['query']);_0x3895e4[_0x6aed('0x31')]=_[_0x6aed('0x32')](_0x3895e4[_0x6aed('0x2e')],_0x3895e4[_0x6aed('0x2f')]);_0x5743fd[_0x6aed('0x33')]=_[_0x6aed('0x32')](_0x3895e4[_0x6aed('0x2e')],qs[_0x6aed('0x34')](_0x248acc[_0x6aed('0x2f')][_0x6aed('0x34')]));_0x5743fd[_0x6aed('0x33')]=_0x5743fd[_0x6aed('0x33')][_0x6aed('0x35')]?_0x5743fd[_0x6aed('0x33')]:_0x3895e4[_0x6aed('0x2e')];if(!_0x248acc[_0x6aed('0x2f')]['hasOwnProperty'](_0x6aed('0x36'))){_0x5743fd[_0x6aed('0x1f')]=qs[_0x6aed('0x1f')](_0x248acc['query']['limit']);_0x5743fd['offset']=qs[_0x6aed('0x1e')](_0x248acc[_0x6aed('0x2f')][_0x6aed('0x1e')]);}_0x5743fd[_0x6aed('0x37')]=qs[_0x6aed('0x38')](_0x248acc[_0x6aed('0x2f')]['sort']);_0x5743fd[_0x6aed('0x39')]=qs[_0x6aed('0x31')](_[_0x6aed('0x3a')](_0x248acc[_0x6aed('0x2f')],_0x3895e4[_0x6aed('0x31')]),_0x41a260);if(_0x248acc['query'][_0x6aed('0x3b')]){_0x5743fd[_0x6aed('0x39')]=_[_0x6aed('0x3c')](_0x5743fd[_0x6aed('0x39')],{'$or':_[_0x6aed('0x29')](_0x41a260,function(_0xf4628f){if(_0xf4628f[_0x6aed('0x2c')]!==_0x6aed('0x3d')){var _0x43218b={};_0x43218b[_0xf4628f['name']]={'$like':'%'+_0x248acc['query'][_0x6aed('0x3b')]+'%'};return _0x43218b;}})});}_0x5743fd=_['merge']({},_0x5743fd,_0x248acc[_0x6aed('0x3e')]);var _0x18b486={'where':_0x5743fd[_0x6aed('0x39')]};return db[_0x6aed('0x3f')][_0x6aed('0x21')](_0x18b486)[_0x6aed('0x25')](function(_0x4f4a7d){_0x26d50b[_0x6aed('0x21')]=_0x4f4a7d;if(_0x248acc[_0x6aed('0x2f')]['includeAll']){_0x5743fd['include']=[{'all':!![]}];}return db[_0x6aed('0x3f')][_0x6aed('0x40')](_0x5743fd);})['then'](function(_0x151f45){_0x26d50b[_0x6aed('0x41')]=_0x151f45;return _0x26d50b;})[_0x6aed('0x25')](respondWithFilteredResult(_0x2d5472,_0x5743fd))[_0x6aed('0x42')](handleError(_0x2d5472,null));};exports['show']=function(_0x50f18a,_0x38a7fb){var _0x474db9={'raw':![],'where':{'id':_0x50f18a[_0x6aed('0x43')]['id']}},_0x23ede8={};_0x23ede8[_0x6aed('0x2e')]=_[_0x6aed('0x30')](db['SalesforceAccount'][_0x6aed('0x2a')]);_0x23ede8[_0x6aed('0x2f')]=_[_0x6aed('0x30')](_0x50f18a[_0x6aed('0x2f')]);_0x23ede8[_0x6aed('0x31')]=_[_0x6aed('0x32')](_0x23ede8[_0x6aed('0x2e')],_0x23ede8[_0x6aed('0x2f')]);_0x474db9['attributes']=_['intersection'](_0x23ede8[_0x6aed('0x2e')],qs[_0x6aed('0x34')](_0x50f18a['query'][_0x6aed('0x34')]));_0x474db9['attributes']=_0x474db9[_0x6aed('0x33')][_0x6aed('0x35')]?_0x474db9['attributes']:_0x23ede8[_0x6aed('0x2e')];if(_0x50f18a[_0x6aed('0x2f')]['includeAll']){_0x474db9[_0x6aed('0x44')]=[{'all':!![]}];}_0x474db9=_[_0x6aed('0x3c')]({},_0x474db9,_0x50f18a[_0x6aed('0x3e')]);return db[_0x6aed('0x3f')][_0x6aed('0x45')](_0x474db9)['then'](handleEntityNotFound(_0x38a7fb,null))[_0x6aed('0x25')](respondWithResult(_0x38a7fb,null))[_0x6aed('0x42')](handleError(_0x38a7fb,null));};exports['create']=function(_0x4650af,_0x568c2d){return db[_0x6aed('0x3f')][_0x6aed('0x46')](_0x4650af[_0x6aed('0x47')],{})[_0x6aed('0x25')](respondWithResult(_0x568c2d,0xc9))[_0x6aed('0x42')](handleError(_0x568c2d,null));};exports[_0x6aed('0x48')]=function(_0x351de9,_0x171d9f){if(_0x351de9[_0x6aed('0x47')]['id']){delete _0x351de9[_0x6aed('0x47')]['id'];}return db[_0x6aed('0x3f')]['find']({'where':{'id':_0x351de9[_0x6aed('0x43')]['id']}})[_0x6aed('0x25')](handleEntityNotFound(_0x171d9f,null))[_0x6aed('0x25')](saveUpdates(_0x351de9[_0x6aed('0x47')],null))['then'](respondWithResult(_0x171d9f,null))[_0x6aed('0x42')](handleError(_0x171d9f,null));};exports[_0x6aed('0x26')]=function(_0x3afdca,_0x52426a){return db[_0x6aed('0x3f')][_0x6aed('0x45')]({'where':{'id':_0x3afdca[_0x6aed('0x43')]['id']}})[_0x6aed('0x25')](handleEntityNotFound(_0x52426a,null))[_0x6aed('0x25')](removeEntity(_0x52426a,null))[_0x6aed('0x42')](handleError(_0x52426a,null));};exports[_0x6aed('0x49')]=function(_0x12ef93,_0xbbdb4e,_0x4d325d){var _0x29f64d={};var _0x2e9937={};var _0x20d28b;var _0x152c9a;return db[_0x6aed('0x3f')]['findOne']({'where':{'id':_0x12ef93[_0x6aed('0x43')]['id']}})['then'](handleEntityNotFound(_0xbbdb4e,null))[_0x6aed('0x25')](function(_0x867aa8){if(_0x867aa8){_0x20d28b=_0x867aa8;_0x2e9937[_0x6aed('0x2e')]=_[_0x6aed('0x30')](db[_0x6aed('0x4a')][_0x6aed('0x2a')]);_0x2e9937[_0x6aed('0x2f')]=_[_0x6aed('0x30')](_0x12ef93[_0x6aed('0x2f')]);_0x2e9937[_0x6aed('0x31')]=_[_0x6aed('0x32')](_0x2e9937['model'],_0x2e9937['query']);_0x29f64d[_0x6aed('0x33')]=_[_0x6aed('0x32')](_0x2e9937[_0x6aed('0x2e')],qs[_0x6aed('0x34')](_0x12ef93[_0x6aed('0x2f')][_0x6aed('0x34')]));_0x29f64d['attributes']=_0x29f64d[_0x6aed('0x33')][_0x6aed('0x35')]?_0x29f64d[_0x6aed('0x33')]:_0x2e9937[_0x6aed('0x2e')];_0x29f64d['order']=qs[_0x6aed('0x38')](_0x12ef93[_0x6aed('0x2f')][_0x6aed('0x38')]);_0x29f64d[_0x6aed('0x39')]=qs[_0x6aed('0x31')](_[_0x6aed('0x3a')](_0x12ef93['query'],_0x2e9937['filters']));if(_0x12ef93[_0x6aed('0x2f')][_0x6aed('0x3b')]){_0x29f64d['where']=_[_0x6aed('0x3c')](_0x29f64d[_0x6aed('0x39')],{'$or':_[_0x6aed('0x29')](_0x29f64d['attributes'],function(_0x3e4f4c){var _0x20842e={};_0x20842e[_0x3e4f4c]={'$like':'%'+_0x12ef93[_0x6aed('0x2f')]['filter']+'%'};return _0x20842e;})});}_0x29f64d=_[_0x6aed('0x3c')]({},_0x29f64d,_0x12ef93['options']);return _0x20d28b[_0x6aed('0x49')](_0x29f64d);}})['then'](function(_0x16a691){if(_0x16a691){_0x152c9a=_0x16a691[_0x6aed('0x35')];if(!_0x12ef93[_0x6aed('0x2f')]['hasOwnProperty']('nolimit')){_0x29f64d[_0x6aed('0x1f')]=qs[_0x6aed('0x1f')](_0x12ef93[_0x6aed('0x2f')][_0x6aed('0x1f')]);_0x29f64d[_0x6aed('0x1e')]=qs['offset'](_0x12ef93[_0x6aed('0x2f')][_0x6aed('0x1e')]);}return _0x20d28b[_0x6aed('0x49')](_0x29f64d);}})[_0x6aed('0x25')](function(_0x3431c6){if(_0x3431c6){return _0x3431c6?{'count':_0x152c9a,'rows':_0x3431c6}:null;}})[_0x6aed('0x25')](respondWithResult(_0xbbdb4e,null))[_0x6aed('0x42')](handleError(_0xbbdb4e,null));};exports[_0x6aed('0x4b')]=function(_0x5c90a1,_0xdd0124,_0x2ba657){if(_0x5c90a1[_0x6aed('0x47')]['id']){delete _0x5c90a1[_0x6aed('0x47')]['id'];}return db[_0x6aed('0x3f')][_0x6aed('0x4c')]({'where':{'id':_0x5c90a1[_0x6aed('0x43')]['id']}})[_0x6aed('0x25')](handleEntityNotFound(_0xdd0124,null))[_0x6aed('0x25')](function(_0x24e595){if(_0x24e595){_0x5c90a1[_0x6aed('0x47')][_0x6aed('0x4d')]=_0x24e595['id'];_0x5c90a1[_0x6aed('0x47')][_0x6aed('0x4e')]=integrations[_0x6aed('0x4f')](_0x5c90a1[_0x6aed('0x47')][_0x6aed('0x50')],_0x5c90a1['body'][_0x6aed('0x2c')]);_0x5c90a1['body']['Descriptions']=integrations['getDescriptions'](_0x5c90a1[_0x6aed('0x47')][_0x6aed('0x50')],_0x5c90a1[_0x6aed('0x47')][_0x6aed('0x2c')]);return db['SalesforceConfiguration']['create'](_0x5c90a1['body'],{'include':[{'model':db[_0x6aed('0x51')],'as':_0x6aed('0x4e')},{'model':db[_0x6aed('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xdd0124,null))[_0x6aed('0x42')](handleError(_0xdd0124,null));};exports['getFields']=function(_0x442d20,_0x236427,_0x3c530b){var _0x2b996c;var _0x240eb3='';var _0x2c78f7=_0x6aed('0x52');return db[_0x6aed('0x3f')][_0x6aed('0x4c')]({'where':{'id':_0x442d20['params']['id']},'attributes':['id','remoteUri',_0x6aed('0x53'),_0x6aed('0x54'),_0x6aed('0x55'),_0x6aed('0x56'),_0x6aed('0x57')]})[_0x6aed('0x25')](handleEntityNotFound(_0x236427,null))[_0x6aed('0x25')](function(_0x5112b2){if(_0x5112b2){_0x240eb3=_0x5112b2[_0x6aed('0x58')];var _0x4b201a=_0x240eb3[_0x6aed('0x59')](-0x1);if(_0x4b201a==='/'){_0x240eb3=_0x240eb3[_0x6aed('0x5a')](0x0,_0x240eb3['lastIndexOf'](_0x4b201a));}_0x2b996c=new jsforce[(_0x6aed('0x5b'))]({'oauth2':{'loginUrl':_0x240eb3,'clientId':_0x5112b2[_0x6aed('0x53')],'clientSecret':_0x5112b2[_0x6aed('0x54')]}});return _0x2b996c[_0x6aed('0x5c')](_0x5112b2[_0x6aed('0x55')],_0x5112b2[_0x6aed('0x56')][_0x6aed('0x5d')](_0x5112b2[_0x6aed('0x57')]));}})[_0x6aed('0x25')](function(_0x1746b2){if(_0x1746b2){if(!_[_0x6aed('0x5e')](_0x442d20[_0x6aed('0x2f')][_0x6aed('0x5f')])){_0x2c78f7=_0x442d20[_0x6aed('0x2f')][_0x6aed('0x5f')];}return _0x2b996c[_0x6aed('0x60')](_0x2c78f7)['describe']();}})['then'](function(_0x4b51d4){var _0x1f7ec8=['OwnerId',_0x6aed('0x61'),'IsReminderSet',_0x6aed('0x62'),_0x6aed('0x63'),_0x6aed('0x64')];var _0x3d370b=[_0x6aed('0x65'),_0x6aed('0x66'),'picklist',_0x6aed('0x67'),'email','textarea',_0x6aed('0x68')];if(_0x4b51d4){_['remove'](_0x4b51d4[_0x6aed('0x34')],function(_0x22162a){return _0x1f7ec8[_0x6aed('0x69')](_0x22162a[_0x6aed('0x28')])||!_0x3d370b[_0x6aed('0x69')](_0x22162a['type']);});return{'count':_0x4b51d4[_0x6aed('0x34')][_0x6aed('0x35')],'rows':_[_0x6aed('0x29')](_0x4b51d4[_0x6aed('0x34')],function(_0x41ccfd){return{'id':_0x41ccfd[_0x6aed('0x28')],'name':_0x41ccfd[_0x6aed('0x6a')],'custom':_0x41ccfd[_0x6aed('0x6b')],'options':_0x41ccfd[_0x6aed('0x6c')][_0x6aed('0x35')]>0x0?_[_0x6aed('0x29')](_0x41ccfd[_0x6aed('0x6c')],function(_0x1ab945){return{'name':_0x1ab945[_0x6aed('0x6a')],'value':_0x1ab945[_0x6aed('0x6d')]};}):_0x41ccfd[_0x6aed('0x2c')]==_0x6aed('0x67')?[{'name':_0x6aed('0x6e'),'value':_0x6aed('0x6f')},{'name':_0x6aed('0x70'),'value':'false'}]:[]};})};}})[_0x6aed('0x25')](respondWithResult(_0x236427,null))[_0x6aed('0x42')](function(_0x6f51a9){var _0x390619=_0x442d20[_0x6aed('0x2f')]['test']?0x1f4:_0x6f51a9[_0x6aed('0x71')]||0x1f4;logger[_0x6aed('0x27')](_0x6aed('0x72'),'getFields',_0x390619,JSON[_0x6aed('0x73')](_0x6f51a9));delete _0x6f51a9[_0x6aed('0x28')];if(_0x390619===0x191){_0x390619=0x190;}_0x236427[_0x6aed('0x1c')](_0x390619)[_0x6aed('0x74')](_0x442d20[_0x6aed('0x2f')]['test']?{'message':_0x6aed('0x75'),'statusCode':_0x6f51a9['statusCode']}:_0x6f51a9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index aab8c9e..7acc0dc 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 _0xf25a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x638bd1,_0x2ad1c6){var _0x1069ee=function(_0x129c43){while(--_0x129c43){_0x638bd1['push'](_0x638bd1['shift']());}};_0x1069ee(++_0x2ad1c6);}(_0xf25a,0x195));var _0xaf25=function(_0x216515,_0x50a560){_0x216515=_0x216515-0x0;var _0x4dd733=_0xf25a[_0x216515];return _0x4dd733;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))('api');var moment=require(_0xaf25('0x3'));var BPromise=require(_0xaf25('0x4'));var rp=require(_0xaf25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var attributes=require(_0xaf25('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x30eaae,_0x48c6e6){return _0x30eaae['define'](_0xaf25('0x9'),attributes,{'tableName':_0xaf25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdadd=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4780ae,_0x3b5c2f){var _0x3b6849=function(_0x10e144){while(--_0x10e144){_0x4780ae['push'](_0x4780ae['shift']());}};_0x3b6849(++_0x3b5c2f);}(_0xdadd,0x1c8));var _0xddad=function(_0x4fecb6,_0x45ed64){_0x4fecb6=_0x4fecb6-0x0;var _0xa9a47=_0xdadd[_0x4fecb6];return _0xa9a47;};'use strict';var _=require(_0xddad('0x0'));var util=require('util');var logger=require(_0xddad('0x1'))('api');var moment=require(_0xddad('0x2'));var BPromise=require(_0xddad('0x3'));var rp=require(_0xddad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddad('0x5'));var config=require(_0xddad('0x6'));var attributes=require(_0xddad('0x7'));var integrations=require(_0xddad('0x8'));module['exports']=function(_0x50da1c,_0x32fed9){return _0x50da1c[_0xddad('0x9')]('SalesforceAccount',attributes,{'tableName':_0xddad('0xa'),'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 f0d8d9a..9ff0ca7 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 _0xb131=['error','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','include','model','map','info','debug','SalesforceAccount','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x412686,_0x3fde24){var _0x18619e=function(_0x862bd1){while(--_0x862bd1){_0x412686['push'](_0x412686['shift']());}};_0x18619e(++_0x3fde24);}(_0xb131,0x187));var _0x1b13=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0xb131[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x1b13('0x0'));var util=require('util');var moment=require(_0x1b13('0x1'));var BPromise=require(_0x1b13('0x2'));var rs=require(_0x1b13('0x3'));var fs=require('fs');var Redis=require(_0x1b13('0x4'));var db=require(_0x1b13('0x5'))['db'];var utils=require(_0x1b13('0x6'));var logger=require(_0x1b13('0x7'))(_0x1b13('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b13('0x9'));var client=jayson[_0x1b13('0xa')][_0x1b13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a93a2,_0x57a6f7,_0x4af012){return new BPromise(function(_0x46c19a,_0x3c6733){return client['request'](_0x8a93a2,_0x4af012)[_0x1b13('0xc')](function(_0x419111){logger['info'](_0x1b13('0xd'),_0x57a6f7,'request\x20sent');logger['debug'](_0x1b13('0xe'),_0x57a6f7,_0x1b13('0xf'),JSON[_0x1b13('0x10')](_0x419111));if(_0x419111[_0x1b13('0x11')]){if(_0x419111[_0x1b13('0x11')]['code']===0x1f4){logger[_0x1b13('0x11')](_0x1b13('0xd'),_0x57a6f7,_0x419111[_0x1b13('0x11')]['message']);return _0x3c6733(_0x419111[_0x1b13('0x11')][_0x1b13('0x12')]);}logger[_0x1b13('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x57a6f7,_0x419111['error']['message']);return _0x46c19a(_0x419111[_0x1b13('0x11')][_0x1b13('0x12')]);}else{logger['info'](_0x1b13('0xd'),_0x57a6f7,_0x1b13('0xf'));_0x46c19a(_0x419111[_0x1b13('0x13')][_0x1b13('0x12')]);}})[_0x1b13('0x14')](function(_0x160608){logger['error'](_0x1b13('0xd'),_0x57a6f7,_0x160608);_0x3c6733(_0x160608);});});}exports[_0x1b13('0x15')]=function(_0x1ae638){var _0x1d622a=this;return new Promise(function(_0x2323f9,_0x74bdcd){return db['SalesforceAccount'][_0x1b13('0x16')]({'raw':_0x1ae638['options']?_0x1ae638[_0x1b13('0x17')][_0x1b13('0x18')]===undefined?!![]:![]:!![],'where':_0x1ae638[_0x1b13('0x17')]?_0x1ae638[_0x1b13('0x17')][_0x1b13('0x19')]||null:null,'attributes':_0x1ae638[_0x1b13('0x17')]?_0x1ae638[_0x1b13('0x17')][_0x1b13('0x1a')]||null:null,'limit':_0x1ae638[_0x1b13('0x17')]?_0x1ae638[_0x1b13('0x17')]['limit']||null:null,'include':_0x1ae638[_0x1b13('0x17')]?_0x1ae638[_0x1b13('0x17')][_0x1b13('0x1b')]?_['map'](_0x1ae638[_0x1b13('0x17')][_0x1b13('0x1b')],function(_0x53af83){return{'model':db[_0x53af83[_0x1b13('0x1c')]],'as':_0x53af83['as'],'attributes':_0x53af83[_0x1b13('0x1a')],'include':_0x53af83[_0x1b13('0x1b')]?_['map'](_0x53af83[_0x1b13('0x1b')],function(_0x5a4dc6){return{'model':db[_0x5a4dc6[_0x1b13('0x1c')]],'as':_0x5a4dc6['as'],'attributes':_0x5a4dc6[_0x1b13('0x1a')],'include':_0x5a4dc6['include']?_[_0x1b13('0x1d')](_0x5a4dc6['include'],function(_0x1dcf1f){return{'model':db[_0x1dcf1f['model']],'as':_0x1dcf1f['as'],'attributes':_0x1dcf1f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b13('0xc')](function(_0xd5a9a7){logger[_0x1b13('0x1e')]('GetSalesforceAccount',_0x1ae638);logger[_0x1b13('0x1f')]('GetSalesforceAccount',_0x1ae638,JSON[_0x1b13('0x10')](_0xd5a9a7));_0x2323f9(_0xd5a9a7);})[_0x1b13('0x14')](function(_0x16e94f){logger['error']('GetSalesforceAccount',_0x16e94f[_0x1b13('0x12')],_0x1ae638);_0x74bdcd(_0x1d622a['error'](0x1f4,_0x16e94f[_0x1b13('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x98a72b){var _0x49b89e=this;return new Promise(function(_0x85e56b,_0x16bf9e){return db[_0x1b13('0x20')]['find']({'raw':_0x98a72b[_0x1b13('0x17')]?_0x98a72b['options'][_0x1b13('0x18')]===undefined?!![]:![]:!![],'where':_0x98a72b[_0x1b13('0x17')]?_0x98a72b[_0x1b13('0x17')][_0x1b13('0x19')]||null:null,'attributes':_0x98a72b[_0x1b13('0x17')]?_0x98a72b['options'][_0x1b13('0x1a')]||null:null,'include':_0x98a72b['options']?_0x98a72b[_0x1b13('0x17')]['include']?_[_0x1b13('0x1d')](_0x98a72b['options'][_0x1b13('0x1b')],function(_0x56b820){return{'model':db[_0x56b820['model']],'as':_0x56b820['as'],'attributes':_0x56b820[_0x1b13('0x1a')],'include':_0x56b820['include']?_[_0x1b13('0x1d')](_0x56b820[_0x1b13('0x1b')],function(_0x320db4){return{'model':db[_0x320db4[_0x1b13('0x1c')]],'as':_0x320db4['as'],'attributes':_0x320db4[_0x1b13('0x1a')],'include':_0x320db4['include']?_[_0x1b13('0x1d')](_0x320db4['include'],function(_0x1b42c9){return{'model':db[_0x1b42c9[_0x1b13('0x1c')]],'as':_0x1b42c9['as'],'attributes':_0x1b42c9['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b13('0xc')](function(_0x1ec94e){logger[_0x1b13('0x1e')](_0x1b13('0x21'),_0x98a72b);logger[_0x1b13('0x1f')](_0x1b13('0x21'),_0x98a72b,JSON[_0x1b13('0x10')](_0x1ec94e));_0x85e56b(_0x1ec94e);})['catch'](function(_0x496a01){logger[_0x1b13('0x11')](_0x1b13('0x21'),_0x496a01[_0x1b13('0x12')],_0x98a72b);_0x16bf9e(_0x49b89e[_0x1b13('0x11')](0x1f4,_0x496a01['message']));});});}; \ No newline at end of file +var _0xa6f9=['error','code','message','result','catch','GetSalesforceAccount','options','raw','limit','include','map','attributes','then','SalesforceAccount','find','where','model','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4ad38b,_0x2a7e44){var _0x53090e=function(_0x40ae72){while(--_0x40ae72){_0x4ad38b['push'](_0x4ad38b['shift']());}};_0x53090e(++_0x2a7e44);}(_0xa6f9,0x1d9));var _0x9a6f=function(_0x5b98fc,_0x40823c){_0x5b98fc=_0x5b98fc-0x0;var _0x5796e7=_0xa6f9[_0x5b98fc];return _0x5796e7;};'use strict';var _=require(_0x9a6f('0x0'));var util=require(_0x9a6f('0x1'));var moment=require(_0x9a6f('0x2'));var BPromise=require(_0x9a6f('0x3'));var rs=require(_0x9a6f('0x4'));var fs=require('fs');var Redis=require(_0x9a6f('0x5'));var db=require(_0x9a6f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a6f('0x7'))(_0x9a6f('0x8'));var config=require('../../config/environment');var jayson=require(_0x9a6f('0x9'));var client=jayson['client'][_0x9a6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x109396,_0x1a1a47,_0x4d93ad){return new BPromise(function(_0x4c8af8,_0x801db8){return client[_0x9a6f('0xb')](_0x109396,_0x4d93ad)['then'](function(_0x10e941){logger[_0x9a6f('0xc')](_0x9a6f('0xd'),_0x1a1a47,_0x9a6f('0xe'));logger[_0x9a6f('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1a1a47,_0x9a6f('0xe'),JSON[_0x9a6f('0x10')](_0x10e941));if(_0x10e941[_0x9a6f('0x11')]){if(_0x10e941[_0x9a6f('0x11')][_0x9a6f('0x12')]===0x1f4){logger[_0x9a6f('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x1a1a47,_0x10e941['error'][_0x9a6f('0x13')]);return _0x801db8(_0x10e941[_0x9a6f('0x11')][_0x9a6f('0x13')]);}logger['error'](_0x9a6f('0xd'),_0x1a1a47,_0x10e941[_0x9a6f('0x11')][_0x9a6f('0x13')]);return _0x4c8af8(_0x10e941[_0x9a6f('0x11')][_0x9a6f('0x13')]);}else{logger[_0x9a6f('0xc')](_0x9a6f('0xd'),_0x1a1a47,_0x9a6f('0xe'));_0x4c8af8(_0x10e941[_0x9a6f('0x14')][_0x9a6f('0x13')]);}})[_0x9a6f('0x15')](function(_0x2dbef1){logger[_0x9a6f('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x1a1a47,_0x2dbef1);_0x801db8(_0x2dbef1);});});}exports[_0x9a6f('0x16')]=function(_0x3d108f){var _0x103609=this;return new Promise(function(_0x754fe2,_0x4bf375){return db['SalesforceAccount']['findAll']({'raw':_0x3d108f[_0x9a6f('0x17')]?_0x3d108f['options'][_0x9a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x3d108f['options']?_0x3d108f[_0x9a6f('0x17')]['where']||null:null,'attributes':_0x3d108f['options']?_0x3d108f[_0x9a6f('0x17')]['attributes']||null:null,'limit':_0x3d108f['options']?_0x3d108f[_0x9a6f('0x17')][_0x9a6f('0x19')]||null:null,'include':_0x3d108f[_0x9a6f('0x17')]?_0x3d108f[_0x9a6f('0x17')][_0x9a6f('0x1a')]?_[_0x9a6f('0x1b')](_0x3d108f['options'][_0x9a6f('0x1a')],function(_0x48b67a){return{'model':db[_0x48b67a['model']],'as':_0x48b67a['as'],'attributes':_0x48b67a['attributes'],'include':_0x48b67a[_0x9a6f('0x1a')]?_[_0x9a6f('0x1b')](_0x48b67a[_0x9a6f('0x1a')],function(_0x30a9b8){return{'model':db[_0x30a9b8['model']],'as':_0x30a9b8['as'],'attributes':_0x30a9b8[_0x9a6f('0x1c')],'include':_0x30a9b8['include']?_[_0x9a6f('0x1b')](_0x30a9b8[_0x9a6f('0x1a')],function(_0x50982e){return{'model':db[_0x50982e['model']],'as':_0x50982e['as'],'attributes':_0x50982e[_0x9a6f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a6f('0x1d')](function(_0x12756d){logger[_0x9a6f('0xc')](_0x9a6f('0x16'),_0x3d108f);logger[_0x9a6f('0xf')](_0x9a6f('0x16'),_0x3d108f,JSON['stringify'](_0x12756d));_0x754fe2(_0x12756d);})[_0x9a6f('0x15')](function(_0x35fd7a){logger['error']('GetSalesforceAccount',_0x35fd7a[_0x9a6f('0x13')],_0x3d108f);_0x4bf375(_0x103609[_0x9a6f('0x11')](0x1f4,_0x35fd7a['message']));});});};exports['ShowSalesforceAccount']=function(_0x596bcd){var _0x25f0b0=this;return new Promise(function(_0x5aaeae,_0x4cc619){return db[_0x9a6f('0x1e')][_0x9a6f('0x1f')]({'raw':_0x596bcd['options']?_0x596bcd[_0x9a6f('0x17')][_0x9a6f('0x18')]===undefined?!![]:![]:!![],'where':_0x596bcd[_0x9a6f('0x17')]?_0x596bcd[_0x9a6f('0x17')][_0x9a6f('0x20')]||null:null,'attributes':_0x596bcd['options']?_0x596bcd[_0x9a6f('0x17')][_0x9a6f('0x1c')]||null:null,'include':_0x596bcd[_0x9a6f('0x17')]?_0x596bcd[_0x9a6f('0x17')]['include']?_[_0x9a6f('0x1b')](_0x596bcd[_0x9a6f('0x17')][_0x9a6f('0x1a')],function(_0x564aa5){return{'model':db[_0x564aa5[_0x9a6f('0x21')]],'as':_0x564aa5['as'],'attributes':_0x564aa5[_0x9a6f('0x1c')],'include':_0x564aa5[_0x9a6f('0x1a')]?_['map'](_0x564aa5['include'],function(_0x53932c){return{'model':db[_0x53932c['model']],'as':_0x53932c['as'],'attributes':_0x53932c[_0x9a6f('0x1c')],'include':_0x53932c[_0x9a6f('0x1a')]?_[_0x9a6f('0x1b')](_0x53932c['include'],function(_0x2e5cdb){return{'model':db[_0x2e5cdb[_0x9a6f('0x21')]],'as':_0x2e5cdb['as'],'attributes':_0x2e5cdb[_0x9a6f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5cf1){logger['info'](_0x9a6f('0x22'),_0x596bcd);logger[_0x9a6f('0xf')](_0x9a6f('0x22'),_0x596bcd,JSON[_0x9a6f('0x10')](_0x3e5cf1));_0x5aaeae(_0x3e5cf1);})[_0x9a6f('0x15')](function(_0x964a8f){logger[_0x9a6f('0x11')](_0x9a6f('0x22'),_0x964a8f[_0x9a6f('0x13')],_0x596bcd);_0x4cc619(_0x25f0b0[_0x9a6f('0x11')](0x1f4,_0x964a8f[_0x9a6f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1546a79..ea92908 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x1e6b83,_0x38c61d){var _0x2035b7=function(_0x3c855d){while(--_0x3c855d){_0x1e6b83['push'](_0x1e6b83['shift']());}};_0x2035b7(++_0x38c61d);}(_0xadb5,0xad));var _0x5adb=function(_0x360d2a,_0x145dd0){_0x360d2a=_0x360d2a-0x0;var _0x310347=_0xadb5[_0x360d2a];return _0x310347;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x0b0e[_0x584b9d];return _0x172053;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 55e7226..f68568a 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 _0x6c1f=['lead','account_contact_lead','nothing','account','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x6c1f,0x158));var _0xf6c1=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x6c1f[_0x49a57c];return _0x4e0316;};'use strict';var Sequelize=require('sequelize');module[_0xf6c1('0x0')]={'name':{'type':Sequelize[_0xf6c1('0x1')]},'description':{'type':Sequelize[_0xf6c1('0x1')]},'ticketType':{'type':Sequelize[_0xf6c1('0x2')](_0xf6c1('0x3'),_0xf6c1('0x4')),'defaultValue':_0xf6c1('0x3')},'moduleSearch':{'type':Sequelize[_0xf6c1('0x2')](_0xf6c1('0x5'),'contact',_0xf6c1('0x6'),_0xf6c1('0x7'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0xf6c1('0x8'),'contact',_0xf6c1('0x6'),_0xf6c1('0x9')),'defaultValue':_0xf6c1('0x6')},'leadId':{'type':Sequelize[_0xf6c1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xf6c1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xf6c1('0x1')]}}; \ No newline at end of file +var _0x42c6=['Task','contact','lead','account_contact_lead','account','contact_lead','nothing','STRING','ENUM'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x42c6,0x15e));var _0x642c=function(_0x385a73,_0x294ce0){_0x385a73=_0x385a73-0x0;var _0x5c4760=_0x42c6[_0x385a73];return _0x5c4760;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x642c('0x0')]('Task','Case'),'defaultValue':_0x642c('0x1')},'moduleSearch':{'type':Sequelize[_0x642c('0x0')]('contact_lead',_0x642c('0x2'),_0x642c('0x3'),_0x642c('0x4'),_0x642c('0x5')),'defaultValue':_0x642c('0x6')},'moduleCreate':{'type':Sequelize[_0x642c('0x0')](_0x642c('0x7'),_0x642c('0x2'),_0x642c('0x3'),_0x642c('0x5')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x642c('0x8')]},'additionalSearchAccount':{'type':Sequelize[_0x642c('0x8')]},'additionalSearchContact':{'type':Sequelize[_0x642c('0x8')]},'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 6687cc8..b8e61c9 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 _0x9230=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','map','SalesforceConfiguration','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','catch','body','findOne','order','options','getFields','getSubjects','getDescriptions','SalesforceField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3d418d,_0x1517af){var _0x547422=function(_0x2e4df6){while(--_0x2e4df6){_0x3d418d['push'](_0x3d418d['shift']());}};_0x547422(++_0x1517af);}(_0x9230,0x193));var _0x0923=function(_0xe334b5,_0x487479){_0xe334b5=_0xe334b5-0x0;var _0x2b3320=_0x9230[_0xe334b5];return _0x2b3320;};'use strict';var emlformat=require(_0x0923('0x0'));var rimraf=require(_0x0923('0x1'));var zipdir=require(_0x0923('0x2'));var jsonpatch=require(_0x0923('0x3'));var rp=require(_0x0923('0x4'));var moment=require(_0x0923('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0923('0x6'));var util=require('util');var path=require(_0x0923('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0923('0x8'));var fs=require('fs');var fs_extra=require(_0x0923('0x9'));var _=require(_0x0923('0xa'));var squel=require(_0x0923('0xb'));var crypto=require('crypto');var jsforce=require(_0x0923('0xc'));var deskjs=require(_0x0923('0xd'));var toCsv=require(_0x0923('0xe'));var querystring=require(_0x0923('0xf'));var Papa=require(_0x0923('0x10'));var Redis=require(_0x0923('0x11'));var authService=require(_0x0923('0x12'));var qs=require(_0x0923('0x13'));var as=require(_0x0923('0x14'));var hardwareService=require(_0x0923('0x15'));var logger=require(_0x0923('0x16'))(_0x0923('0x17'));var utils=require(_0x0923('0x18'));var config=require(_0x0923('0x19'));var licenseUtil=require(_0x0923('0x1a'));var db=require(_0x0923('0x1b'))['db'];function respondWithStatusCode(_0x19c3f8,_0x3c3929){_0x3c3929=_0x3c3929||0xcc;return function(_0x4d7f33){if(_0x4d7f33){return _0x19c3f8[_0x0923('0x1c')](_0x3c3929);}return _0x19c3f8['status'](_0x3c3929)[_0x0923('0x1d')]();};}function respondWithResult(_0x6d4ed3,_0x46e33d){_0x46e33d=_0x46e33d||0xc8;return function(_0x55b0a1){if(_0x55b0a1){return _0x6d4ed3[_0x0923('0x1e')](_0x46e33d)[_0x0923('0x1f')](_0x55b0a1);}};}function respondWithFilteredResult(_0x18a268,_0x19eedd){return function(_0x510d23){if(_0x510d23){var _0x467e14=typeof _0x19eedd[_0x0923('0x20')]===_0x0923('0x21')&&typeof _0x19eedd[_0x0923('0x22')]==='undefined';var _0x5da46e=_0x510d23[_0x0923('0x23')];var _0x3ca69=_0x467e14?0x0:_0x19eedd[_0x0923('0x20')];var _0x7c1dcf=_0x467e14?_0x510d23['count']:_0x19eedd[_0x0923('0x20')]+_0x19eedd[_0x0923('0x22')];var _0x3e89a7;if(_0x7c1dcf>=_0x5da46e){_0x7c1dcf=_0x5da46e;_0x3e89a7=0xc8;}else{_0x3e89a7=0xce;}_0x18a268[_0x0923('0x1e')](_0x3e89a7);return _0x18a268[_0x0923('0x24')](_0x0923('0x25'),_0x3ca69+'-'+_0x7c1dcf+'/'+_0x5da46e)[_0x0923('0x1f')](_0x510d23);}return null;};}function patchUpdates(_0xd2cdea){return function(_0x25537a){try{jsonpatch[_0x0923('0x26')](_0x25537a,_0xd2cdea,!![]);}catch(_0x57ccec){return BPromise[_0x0923('0x27')](_0x57ccec);}return _0x25537a[_0x0923('0x28')]();};}function saveUpdates(_0x34fe0b,_0x288e18){return function(_0x3aafd5){if(_0x3aafd5){return _0x3aafd5['update'](_0x34fe0b)['then'](function(_0x247212){return _0x247212;});}return null;};}function removeEntity(_0x711018,_0x541ea0){return function(_0x2e9fd9){if(_0x2e9fd9){return _0x2e9fd9[_0x0923('0x29')]()[_0x0923('0x2a')](function(){_0x711018['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9dcbdd,_0x1d6d60){return function(_0x38f0ad){if(!_0x38f0ad){_0x9dcbdd['sendStatus'](0x194);}return _0x38f0ad;};}function handleError(_0x529808,_0x485df8){_0x485df8=_0x485df8||0x1f4;return function(_0x37cfbd){logger[_0x0923('0x2b')](_0x37cfbd[_0x0923('0x2c')]);if(_0x37cfbd['name']){delete _0x37cfbd['name'];}_0x529808[_0x0923('0x1e')](_0x485df8)[_0x0923('0x2d')](_0x37cfbd);};}exports[_0x0923('0x2e')]=function(_0x25ae47,_0x1f0d38){var _0x1b7504={},_0x810fe4={},_0x592ed7={'count':0x0,'rows':[]};var _0x28217e=_[_0x0923('0x2f')](db[_0x0923('0x30')]['rawAttributes'],function(_0x4558c1){return{'name':_0x4558c1['fieldName'],'type':_0x4558c1['type'][_0x0923('0x31')]};});_0x810fe4[_0x0923('0x32')]=_[_0x0923('0x2f')](_0x28217e,_0x0923('0x33'));_0x810fe4[_0x0923('0x34')]=_[_0x0923('0x35')](_0x25ae47['query']);_0x810fe4[_0x0923('0x36')]=_['intersection'](_0x810fe4[_0x0923('0x32')],_0x810fe4[_0x0923('0x34')]);_0x1b7504[_0x0923('0x37')]=_[_0x0923('0x38')](_0x810fe4[_0x0923('0x32')],qs['fields'](_0x25ae47[_0x0923('0x34')][_0x0923('0x39')]));_0x1b7504[_0x0923('0x37')]=_0x1b7504[_0x0923('0x37')][_0x0923('0x3a')]?_0x1b7504[_0x0923('0x37')]:_0x810fe4['model'];if(!_0x25ae47[_0x0923('0x34')][_0x0923('0x3b')](_0x0923('0x3c'))){_0x1b7504['limit']=qs[_0x0923('0x22')](_0x25ae47[_0x0923('0x34')]['limit']);_0x1b7504['offset']=qs[_0x0923('0x20')](_0x25ae47['query'][_0x0923('0x20')]);}_0x1b7504['order']=qs[_0x0923('0x3d')](_0x25ae47['query'][_0x0923('0x3d')]);_0x1b7504[_0x0923('0x3e')]=qs['filters'](_[_0x0923('0x3f')](_0x25ae47['query'],_0x810fe4[_0x0923('0x36')]),_0x28217e);if(_0x25ae47[_0x0923('0x34')][_0x0923('0x40')]){_0x1b7504['where']=_[_0x0923('0x41')](_0x1b7504[_0x0923('0x3e')],{'$or':_[_0x0923('0x2f')](_0x28217e,function(_0x1c483f){if(_0x1c483f[_0x0923('0x42')]!==_0x0923('0x43')){var _0x7339f3={};_0x7339f3[_0x1c483f['name']]={'$like':'%'+_0x25ae47[_0x0923('0x34')][_0x0923('0x40')]+'%'};return _0x7339f3;}})});}_0x1b7504=_[_0x0923('0x41')]({},_0x1b7504,_0x25ae47['options']);var _0x1517c1={'where':_0x1b7504[_0x0923('0x3e')]};return db[_0x0923('0x30')][_0x0923('0x23')](_0x1517c1)['then'](function(_0x23ace0){_0x592ed7[_0x0923('0x23')]=_0x23ace0;if(_0x25ae47['query'][_0x0923('0x44')]){_0x1b7504[_0x0923('0x45')]=[{'all':!![]}];}return db[_0x0923('0x30')][_0x0923('0x46')](_0x1b7504);})[_0x0923('0x2a')](function(_0x3ff44b){_0x592ed7[_0x0923('0x47')]=_0x3ff44b;return _0x592ed7;})['then'](respondWithFilteredResult(_0x1f0d38,_0x1b7504))['catch'](handleError(_0x1f0d38,null));};exports[_0x0923('0x48')]=function(_0x5284ae,_0x454b8d){var _0x13090c={'raw':![],'where':{'id':_0x5284ae[_0x0923('0x49')]['id']}},_0x342af1={};_0x342af1[_0x0923('0x32')]=_[_0x0923('0x35')](db[_0x0923('0x30')][_0x0923('0x4a')]);_0x342af1[_0x0923('0x34')]=_[_0x0923('0x35')](_0x5284ae[_0x0923('0x34')]);_0x342af1['filters']=_['intersection'](_0x342af1['model'],_0x342af1[_0x0923('0x34')]);_0x13090c[_0x0923('0x37')]=_['intersection'](_0x342af1['model'],qs[_0x0923('0x39')](_0x5284ae[_0x0923('0x34')]['fields']));_0x13090c[_0x0923('0x37')]=_0x13090c[_0x0923('0x37')][_0x0923('0x3a')]?_0x13090c['attributes']:_0x342af1[_0x0923('0x32')];if(_0x5284ae[_0x0923('0x34')][_0x0923('0x44')]){_0x13090c[_0x0923('0x45')]=[{'all':!![]}];}_0x13090c=_[_0x0923('0x41')]({},_0x13090c,_0x5284ae['options']);return db['SalesforceConfiguration'][_0x0923('0x4b')](_0x13090c)[_0x0923('0x2a')](handleEntityNotFound(_0x454b8d,null))[_0x0923('0x2a')](respondWithResult(_0x454b8d,null))['catch'](handleError(_0x454b8d,null));};exports[_0x0923('0x4c')]=function(_0x24e478,_0x1b1b75){return db[_0x0923('0x30')][_0x0923('0x4c')](_0x24e478['body'],{})['then'](respondWithResult(_0x1b1b75,0xc9))[_0x0923('0x4d')](handleError(_0x1b1b75,null));};exports['update']=function(_0x201593,_0x5b0121){if(_0x201593[_0x0923('0x4e')]['id']){delete _0x201593[_0x0923('0x4e')]['id'];}return db['SalesforceConfiguration'][_0x0923('0x4b')]({'where':{'id':_0x201593[_0x0923('0x49')]['id']}})[_0x0923('0x2a')](handleEntityNotFound(_0x5b0121,null))[_0x0923('0x2a')](saveUpdates(_0x201593[_0x0923('0x4e')],null))[_0x0923('0x2a')](respondWithResult(_0x5b0121,null))['catch'](handleError(_0x5b0121,null));};exports[_0x0923('0x29')]=function(_0x33c9c9,_0x397b78){return db[_0x0923('0x30')][_0x0923('0x4b')]({'where':{'id':_0x33c9c9[_0x0923('0x49')]['id']}})[_0x0923('0x2a')](handleEntityNotFound(_0x397b78,null))['then'](removeEntity(_0x397b78,null))[_0x0923('0x4d')](handleError(_0x397b78,null));};exports['getFields']=function(_0x4ede02,_0x1a9368,_0x362acf){var _0x18b670={};var _0xd944c1={};var _0x2a6ffe;var _0x90e868;return db[_0x0923('0x30')][_0x0923('0x4f')]({'where':{'id':_0x4ede02[_0x0923('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a9368,null))['then'](function(_0x463c9e){if(_0x463c9e){_0x2a6ffe=_0x463c9e;_0xd944c1[_0x0923('0x32')]=_[_0x0923('0x35')](db['SalesforceField'][_0x0923('0x4a')]);_0xd944c1[_0x0923('0x34')]=_['keys'](_0x4ede02[_0x0923('0x34')]);_0xd944c1[_0x0923('0x36')]=_[_0x0923('0x38')](_0xd944c1['model'],_0xd944c1[_0x0923('0x34')]);_0x18b670[_0x0923('0x37')]=_[_0x0923('0x38')](_0xd944c1['model'],qs['fields'](_0x4ede02[_0x0923('0x34')][_0x0923('0x39')]));_0x18b670[_0x0923('0x37')]=_0x18b670['attributes'][_0x0923('0x3a')]?_0x18b670[_0x0923('0x37')]:_0xd944c1[_0x0923('0x32')];_0x18b670[_0x0923('0x50')]=qs['sort'](_0x4ede02[_0x0923('0x34')][_0x0923('0x3d')]);_0x18b670[_0x0923('0x3e')]=qs[_0x0923('0x36')](_[_0x0923('0x3f')](_0x4ede02['query'],_0xd944c1[_0x0923('0x36')]));if(_0x4ede02[_0x0923('0x34')][_0x0923('0x40')]){_0x18b670[_0x0923('0x3e')]=_[_0x0923('0x41')](_0x18b670[_0x0923('0x3e')],{'$or':_[_0x0923('0x2f')](_0x18b670[_0x0923('0x37')],function(_0x55b49f){var _0x54d477={};_0x54d477[_0x55b49f]={'$like':'%'+_0x4ede02['query'][_0x0923('0x40')]+'%'};return _0x54d477;})});}_0x18b670=_['merge']({},_0x18b670,_0x4ede02[_0x0923('0x51')]);return _0x2a6ffe[_0x0923('0x52')](_0x18b670);}})[_0x0923('0x2a')](function(_0x27ae56){if(_0x27ae56){_0x90e868=_0x27ae56[_0x0923('0x3a')];if(!_0x4ede02['query'][_0x0923('0x3b')]('nolimit')){_0x18b670['limit']=qs[_0x0923('0x22')](_0x4ede02[_0x0923('0x34')][_0x0923('0x22')]);_0x18b670[_0x0923('0x20')]=qs[_0x0923('0x20')](_0x4ede02[_0x0923('0x34')][_0x0923('0x20')]);}return _0x2a6ffe[_0x0923('0x52')](_0x18b670);}})[_0x0923('0x2a')](function(_0x34911a){if(_0x34911a){return _0x34911a?{'count':_0x90e868,'rows':_0x34911a}:null;}})[_0x0923('0x2a')](respondWithResult(_0x1a9368,null))[_0x0923('0x4d')](handleError(_0x1a9368,null));};exports[_0x0923('0x53')]=function(_0x4856cb,_0x1f4635,_0x330c38){var _0x32e820={};var _0xeadb2d={};var _0x556bc9;var _0xc9526;return db[_0x0923('0x30')][_0x0923('0x4f')]({'where':{'id':_0x4856cb['params']['id']}})[_0x0923('0x2a')](handleEntityNotFound(_0x1f4635,null))['then'](function(_0x155102){if(_0x155102){_0x556bc9=_0x155102;_0xeadb2d[_0x0923('0x32')]=_[_0x0923('0x35')](db['SalesforceField'][_0x0923('0x4a')]);_0xeadb2d[_0x0923('0x34')]=_[_0x0923('0x35')](_0x4856cb['query']);_0xeadb2d['filters']=_[_0x0923('0x38')](_0xeadb2d['model'],_0xeadb2d[_0x0923('0x34')]);_0x32e820['attributes']=_['intersection'](_0xeadb2d[_0x0923('0x32')],qs[_0x0923('0x39')](_0x4856cb['query'][_0x0923('0x39')]));_0x32e820['attributes']=_0x32e820['attributes'][_0x0923('0x3a')]?_0x32e820[_0x0923('0x37')]:_0xeadb2d['model'];_0x32e820[_0x0923('0x50')]=qs[_0x0923('0x3d')](_0x4856cb[_0x0923('0x34')]['sort']);_0x32e820[_0x0923('0x3e')]=qs[_0x0923('0x36')](_[_0x0923('0x3f')](_0x4856cb[_0x0923('0x34')],_0xeadb2d[_0x0923('0x36')]));if(_0x4856cb[_0x0923('0x34')]['filter']){_0x32e820[_0x0923('0x3e')]=_['merge'](_0x32e820[_0x0923('0x3e')],{'$or':_[_0x0923('0x2f')](_0x32e820[_0x0923('0x37')],function(_0x35add7){var _0x4d723b={};_0x4d723b[_0x35add7]={'$like':'%'+_0x4856cb[_0x0923('0x34')]['filter']+'%'};return _0x4d723b;})});}_0x32e820=_[_0x0923('0x41')]({},_0x32e820,_0x4856cb[_0x0923('0x51')]);return _0x556bc9['getSubjects'](_0x32e820);}})['then'](function(_0x366717){if(_0x366717){_0xc9526=_0x366717[_0x0923('0x3a')];if(!_0x4856cb[_0x0923('0x34')][_0x0923('0x3b')](_0x0923('0x3c'))){_0x32e820[_0x0923('0x22')]=qs[_0x0923('0x22')](_0x4856cb[_0x0923('0x34')][_0x0923('0x22')]);_0x32e820[_0x0923('0x20')]=qs[_0x0923('0x20')](_0x4856cb[_0x0923('0x34')][_0x0923('0x20')]);}return _0x556bc9['getSubjects'](_0x32e820);}})[_0x0923('0x2a')](function(_0x58b50b){if(_0x58b50b){return _0x58b50b?{'count':_0xc9526,'rows':_0x58b50b}:null;}})[_0x0923('0x2a')](respondWithResult(_0x1f4635,null))[_0x0923('0x4d')](handleError(_0x1f4635,null));};exports[_0x0923('0x54')]=function(_0x31c7f8,_0x27ccc5,_0x9e6f38){var _0x5dccfd={};var _0x1f71bc={};var _0x1ec04e;var _0xd921d3;return db[_0x0923('0x30')][_0x0923('0x4f')]({'where':{'id':_0x31c7f8['params']['id']}})[_0x0923('0x2a')](handleEntityNotFound(_0x27ccc5,null))[_0x0923('0x2a')](function(_0x106965){if(_0x106965){_0x1ec04e=_0x106965;_0x1f71bc[_0x0923('0x32')]=_['keys'](db[_0x0923('0x55')][_0x0923('0x4a')]);_0x1f71bc[_0x0923('0x34')]=_[_0x0923('0x35')](_0x31c7f8[_0x0923('0x34')]);_0x1f71bc['filters']=_[_0x0923('0x38')](_0x1f71bc[_0x0923('0x32')],_0x1f71bc['query']);_0x5dccfd[_0x0923('0x37')]=_[_0x0923('0x38')](_0x1f71bc['model'],qs[_0x0923('0x39')](_0x31c7f8[_0x0923('0x34')]['fields']));_0x5dccfd[_0x0923('0x37')]=_0x5dccfd['attributes'][_0x0923('0x3a')]?_0x5dccfd[_0x0923('0x37')]:_0x1f71bc[_0x0923('0x32')];_0x5dccfd[_0x0923('0x50')]=qs[_0x0923('0x3d')](_0x31c7f8[_0x0923('0x34')]['sort']);_0x5dccfd[_0x0923('0x3e')]=qs[_0x0923('0x36')](_['pick'](_0x31c7f8['query'],_0x1f71bc[_0x0923('0x36')]));if(_0x31c7f8[_0x0923('0x34')][_0x0923('0x40')]){_0x5dccfd[_0x0923('0x3e')]=_[_0x0923('0x41')](_0x5dccfd[_0x0923('0x3e')],{'$or':_[_0x0923('0x2f')](_0x5dccfd[_0x0923('0x37')],function(_0x2e251b){var _0x521cfb={};_0x521cfb[_0x2e251b]={'$like':'%'+_0x31c7f8[_0x0923('0x34')][_0x0923('0x40')]+'%'};return _0x521cfb;})});}_0x5dccfd=_[_0x0923('0x41')]({},_0x5dccfd,_0x31c7f8[_0x0923('0x51')]);return _0x1ec04e[_0x0923('0x54')](_0x5dccfd);}})[_0x0923('0x2a')](function(_0x42caec){if(_0x42caec){_0xd921d3=_0x42caec[_0x0923('0x3a')];if(!_0x31c7f8['query'][_0x0923('0x3b')](_0x0923('0x3c'))){_0x5dccfd[_0x0923('0x22')]=qs[_0x0923('0x22')](_0x31c7f8['query'][_0x0923('0x22')]);_0x5dccfd[_0x0923('0x20')]=qs[_0x0923('0x20')](_0x31c7f8['query'][_0x0923('0x20')]);}return _0x1ec04e['getDescriptions'](_0x5dccfd);}})[_0x0923('0x2a')](function(_0x4125bf){if(_0x4125bf){return _0x4125bf?{'count':_0xd921d3,'rows':_0x4125bf}:null;}})[_0x0923('0x2a')](respondWithResult(_0x27ccc5,null))[_0x0923('0x4d')](handleError(_0x27ccc5,null));}; \ No newline at end of file +var _0xa5c9=['papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','apply','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','SalesforceConfiguration','includeAll','findAll','then','rows','show','find','create','body','catch','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xa5c9,0xda));var _0x9a5c=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xa5c9[_0x1daaa9];return _0x1dd221;};'use strict';var emlformat=require(_0x9a5c('0x0'));var rimraf=require(_0x9a5c('0x1'));var zipdir=require(_0x9a5c('0x2'));var jsonpatch=require(_0x9a5c('0x3'));var rp=require(_0x9a5c('0x4'));var moment=require(_0x9a5c('0x5'));var BPromise=require(_0x9a5c('0x6'));var Mustache=require(_0x9a5c('0x7'));var util=require(_0x9a5c('0x8'));var path=require(_0x9a5c('0x9'));var sox=require(_0x9a5c('0xa'));var csv=require('to-csv');var ejs=require(_0x9a5c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a5c('0xc'));var squel=require(_0x9a5c('0xd'));var crypto=require(_0x9a5c('0xe'));var jsforce=require(_0x9a5c('0xf'));var deskjs=require(_0x9a5c('0x10'));var toCsv=require(_0x9a5c('0x11'));var querystring=require(_0x9a5c('0x12'));var Papa=require(_0x9a5c('0x13'));var Redis=require(_0x9a5c('0x14'));var authService=require(_0x9a5c('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a5c('0x16'))('api');var utils=require(_0x9a5c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9a5c('0x18'))['db'];function respondWithStatusCode(_0x44beaa,_0x30a5fc){_0x30a5fc=_0x30a5fc||0xcc;return function(_0x34864f){if(_0x34864f){return _0x44beaa[_0x9a5c('0x19')](_0x30a5fc);}return _0x44beaa[_0x9a5c('0x1a')](_0x30a5fc)['end']();};}function respondWithResult(_0x21c10c,_0x84d3b7){_0x84d3b7=_0x84d3b7||0xc8;return function(_0xe3a23){if(_0xe3a23){return _0x21c10c[_0x9a5c('0x1a')](_0x84d3b7)[_0x9a5c('0x1b')](_0xe3a23);}};}function respondWithFilteredResult(_0x48736a,_0x7c3e4b){return function(_0x23b71e){if(_0x23b71e){var _0x540e3c=typeof _0x7c3e4b['offset']==='undefined'&&typeof _0x7c3e4b['limit']==='undefined';var _0x2b0175=_0x23b71e[_0x9a5c('0x1c')];var _0x204166=_0x540e3c?0x0:_0x7c3e4b['offset'];var _0x3e0861=_0x540e3c?_0x23b71e['count']:_0x7c3e4b[_0x9a5c('0x1d')]+_0x7c3e4b['limit'];var _0x4a5a37;if(_0x3e0861>=_0x2b0175){_0x3e0861=_0x2b0175;_0x4a5a37=0xc8;}else{_0x4a5a37=0xce;}_0x48736a['status'](_0x4a5a37);return _0x48736a[_0x9a5c('0x1e')]('Content-Range',_0x204166+'-'+_0x3e0861+'/'+_0x2b0175)[_0x9a5c('0x1b')](_0x23b71e);}return null;};}function patchUpdates(_0x4391f4){return function(_0x530b6f){try{jsonpatch[_0x9a5c('0x1f')](_0x530b6f,_0x4391f4,!![]);}catch(_0xf96d04){return BPromise['reject'](_0xf96d04);}return _0x530b6f[_0x9a5c('0x20')]();};}function saveUpdates(_0x23ca0a,_0x13d676){return function(_0x35e2e7){if(_0x35e2e7){return _0x35e2e7[_0x9a5c('0x21')](_0x23ca0a)['then'](function(_0x299abe){return _0x299abe;});}return null;};}function removeEntity(_0x3ad15c,_0x535613){return function(_0x330be7){if(_0x330be7){return _0x330be7[_0x9a5c('0x22')]()['then'](function(){_0x3ad15c[_0x9a5c('0x1a')](0xcc)[_0x9a5c('0x23')]();});}};}function handleEntityNotFound(_0x3911ad,_0x52111e){return function(_0x2b8ec9){if(!_0x2b8ec9){_0x3911ad[_0x9a5c('0x19')](0x194);}return _0x2b8ec9;};}function handleError(_0x5484f8,_0x1efdba){_0x1efdba=_0x1efdba||0x1f4;return function(_0x14bce5){logger[_0x9a5c('0x24')](_0x14bce5[_0x9a5c('0x25')]);if(_0x14bce5[_0x9a5c('0x26')]){delete _0x14bce5[_0x9a5c('0x26')];}_0x5484f8[_0x9a5c('0x1a')](_0x1efdba)[_0x9a5c('0x27')](_0x14bce5);};}exports[_0x9a5c('0x28')]=function(_0x34872f,_0x25db85){var _0x39c73f={},_0x4ffd92={},_0x3e4f22={'count':0x0,'rows':[]};var _0x3813a0=_[_0x9a5c('0x29')](db['SalesforceConfiguration'][_0x9a5c('0x2a')],function(_0x130858){return{'name':_0x130858['fieldName'],'type':_0x130858[_0x9a5c('0x2b')][_0x9a5c('0x2c')]};});_0x4ffd92['model']=_['map'](_0x3813a0,'name');_0x4ffd92[_0x9a5c('0x2d')]=_[_0x9a5c('0x2e')](_0x34872f['query']);_0x4ffd92[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x4ffd92['model'],_0x4ffd92[_0x9a5c('0x2d')]);_0x39c73f[_0x9a5c('0x31')]=_[_0x9a5c('0x30')](_0x4ffd92[_0x9a5c('0x32')],qs[_0x9a5c('0x33')](_0x34872f[_0x9a5c('0x2d')]['fields']));_0x39c73f[_0x9a5c('0x31')]=_0x39c73f[_0x9a5c('0x31')][_0x9a5c('0x34')]?_0x39c73f[_0x9a5c('0x31')]:_0x4ffd92[_0x9a5c('0x32')];if(!_0x34872f[_0x9a5c('0x2d')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x39c73f[_0x9a5c('0x37')]=qs[_0x9a5c('0x37')](_0x34872f[_0x9a5c('0x2d')]['limit']);_0x39c73f[_0x9a5c('0x1d')]=qs[_0x9a5c('0x1d')](_0x34872f[_0x9a5c('0x2d')][_0x9a5c('0x1d')]);}_0x39c73f[_0x9a5c('0x38')]=qs[_0x9a5c('0x39')](_0x34872f[_0x9a5c('0x2d')]['sort']);_0x39c73f[_0x9a5c('0x3a')]=qs[_0x9a5c('0x2f')](_[_0x9a5c('0x3b')](_0x34872f['query'],_0x4ffd92[_0x9a5c('0x2f')]),_0x3813a0);if(_0x34872f[_0x9a5c('0x2d')][_0x9a5c('0x3c')]){_0x39c73f[_0x9a5c('0x3a')]=_[_0x9a5c('0x3d')](_0x39c73f[_0x9a5c('0x3a')],{'$or':_[_0x9a5c('0x29')](_0x3813a0,function(_0x38bc96){if(_0x38bc96['type']!=='VIRTUAL'){var _0x4dd6ad={};_0x4dd6ad[_0x38bc96[_0x9a5c('0x26')]]={'$like':'%'+_0x34872f[_0x9a5c('0x2d')][_0x9a5c('0x3c')]+'%'};return _0x4dd6ad;}})});}_0x39c73f=_[_0x9a5c('0x3d')]({},_0x39c73f,_0x34872f[_0x9a5c('0x3e')]);var _0x12b0f8={'where':_0x39c73f[_0x9a5c('0x3a')]};return db[_0x9a5c('0x3f')][_0x9a5c('0x1c')](_0x12b0f8)['then'](function(_0x3b0046){_0x3e4f22['count']=_0x3b0046;if(_0x34872f['query'][_0x9a5c('0x40')]){_0x39c73f['include']=[{'all':!![]}];}return db[_0x9a5c('0x3f')][_0x9a5c('0x41')](_0x39c73f);})[_0x9a5c('0x42')](function(_0x658321){_0x3e4f22[_0x9a5c('0x43')]=_0x658321;return _0x3e4f22;})['then'](respondWithFilteredResult(_0x25db85,_0x39c73f))['catch'](handleError(_0x25db85,null));};exports[_0x9a5c('0x44')]=function(_0x46028b,_0x34a831){var _0x37412e={'raw':![],'where':{'id':_0x46028b['params']['id']}},_0x37cf40={};_0x37cf40[_0x9a5c('0x32')]=_[_0x9a5c('0x2e')](db[_0x9a5c('0x3f')][_0x9a5c('0x2a')]);_0x37cf40[_0x9a5c('0x2d')]=_['keys'](_0x46028b[_0x9a5c('0x2d')]);_0x37cf40[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x37cf40[_0x9a5c('0x32')],_0x37cf40[_0x9a5c('0x2d')]);_0x37412e[_0x9a5c('0x31')]=_[_0x9a5c('0x30')](_0x37cf40['model'],qs['fields'](_0x46028b[_0x9a5c('0x2d')]['fields']));_0x37412e[_0x9a5c('0x31')]=_0x37412e['attributes']['length']?_0x37412e[_0x9a5c('0x31')]:_0x37cf40[_0x9a5c('0x32')];if(_0x46028b[_0x9a5c('0x2d')][_0x9a5c('0x40')]){_0x37412e['include']=[{'all':!![]}];}_0x37412e=_['merge']({},_0x37412e,_0x46028b[_0x9a5c('0x3e')]);return db[_0x9a5c('0x3f')][_0x9a5c('0x45')](_0x37412e)['then'](handleEntityNotFound(_0x34a831,null))[_0x9a5c('0x42')](respondWithResult(_0x34a831,null))['catch'](handleError(_0x34a831,null));};exports[_0x9a5c('0x46')]=function(_0x15687a,_0x1af8f0){return db[_0x9a5c('0x3f')][_0x9a5c('0x46')](_0x15687a[_0x9a5c('0x47')],{})[_0x9a5c('0x42')](respondWithResult(_0x1af8f0,0xc9))[_0x9a5c('0x48')](handleError(_0x1af8f0,null));};exports[_0x9a5c('0x21')]=function(_0x1423af,_0x34bb80){if(_0x1423af[_0x9a5c('0x47')]['id']){delete _0x1423af['body']['id'];}return db[_0x9a5c('0x3f')][_0x9a5c('0x45')]({'where':{'id':_0x1423af[_0x9a5c('0x49')]['id']}})['then'](handleEntityNotFound(_0x34bb80,null))[_0x9a5c('0x42')](saveUpdates(_0x1423af[_0x9a5c('0x47')],null))[_0x9a5c('0x42')](respondWithResult(_0x34bb80,null))['catch'](handleError(_0x34bb80,null));};exports['destroy']=function(_0x1aa9d1,_0x5ad2e3){return db[_0x9a5c('0x3f')][_0x9a5c('0x45')]({'where':{'id':_0x1aa9d1[_0x9a5c('0x49')]['id']}})[_0x9a5c('0x42')](handleEntityNotFound(_0x5ad2e3,null))[_0x9a5c('0x42')](removeEntity(_0x5ad2e3,null))[_0x9a5c('0x48')](handleError(_0x5ad2e3,null));};exports[_0x9a5c('0x4a')]=function(_0x45f156,_0x95d279,_0x11070b){var _0x189915={};var _0x48e2d9={};var _0x3978ab;var _0x3ffaec;return db['SalesforceConfiguration'][_0x9a5c('0x4b')]({'where':{'id':_0x45f156[_0x9a5c('0x49')]['id']}})['then'](handleEntityNotFound(_0x95d279,null))[_0x9a5c('0x42')](function(_0x1da13f){if(_0x1da13f){_0x3978ab=_0x1da13f;_0x48e2d9[_0x9a5c('0x32')]=_[_0x9a5c('0x2e')](db[_0x9a5c('0x4c')]['rawAttributes']);_0x48e2d9[_0x9a5c('0x2d')]=_[_0x9a5c('0x2e')](_0x45f156[_0x9a5c('0x2d')]);_0x48e2d9[_0x9a5c('0x2f')]=_['intersection'](_0x48e2d9['model'],_0x48e2d9[_0x9a5c('0x2d')]);_0x189915['attributes']=_[_0x9a5c('0x30')](_0x48e2d9['model'],qs[_0x9a5c('0x33')](_0x45f156[_0x9a5c('0x2d')][_0x9a5c('0x33')]));_0x189915[_0x9a5c('0x31')]=_0x189915['attributes']['length']?_0x189915[_0x9a5c('0x31')]:_0x48e2d9[_0x9a5c('0x32')];_0x189915[_0x9a5c('0x38')]=qs[_0x9a5c('0x39')](_0x45f156[_0x9a5c('0x2d')][_0x9a5c('0x39')]);_0x189915[_0x9a5c('0x3a')]=qs[_0x9a5c('0x2f')](_['pick'](_0x45f156['query'],_0x48e2d9[_0x9a5c('0x2f')]));if(_0x45f156['query'][_0x9a5c('0x3c')]){_0x189915[_0x9a5c('0x3a')]=_[_0x9a5c('0x3d')](_0x189915['where'],{'$or':_['map'](_0x189915['attributes'],function(_0x4c55b2){var _0x3f2941={};_0x3f2941[_0x4c55b2]={'$like':'%'+_0x45f156[_0x9a5c('0x2d')]['filter']+'%'};return _0x3f2941;})});}_0x189915=_['merge']({},_0x189915,_0x45f156[_0x9a5c('0x3e')]);return _0x3978ab[_0x9a5c('0x4a')](_0x189915);}})['then'](function(_0x9d157c){if(_0x9d157c){_0x3ffaec=_0x9d157c[_0x9a5c('0x34')];if(!_0x45f156[_0x9a5c('0x2d')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x189915['limit']=qs['limit'](_0x45f156[_0x9a5c('0x2d')][_0x9a5c('0x37')]);_0x189915[_0x9a5c('0x1d')]=qs[_0x9a5c('0x1d')](_0x45f156[_0x9a5c('0x2d')][_0x9a5c('0x1d')]);}return _0x3978ab[_0x9a5c('0x4a')](_0x189915);}})[_0x9a5c('0x42')](function(_0x3de9a6){if(_0x3de9a6){return _0x3de9a6?{'count':_0x3ffaec,'rows':_0x3de9a6}:null;}})['then'](respondWithResult(_0x95d279,null))[_0x9a5c('0x48')](handleError(_0x95d279,null));};exports[_0x9a5c('0x4d')]=function(_0x1dee03,_0x3e3fc2,_0x1d82e9){var _0x3b5a4a={};var _0x32281a={};var _0x278a86;var _0xa7ff4b;return db[_0x9a5c('0x3f')][_0x9a5c('0x4b')]({'where':{'id':_0x1dee03[_0x9a5c('0x49')]['id']}})[_0x9a5c('0x42')](handleEntityNotFound(_0x3e3fc2,null))[_0x9a5c('0x42')](function(_0x4930bd){if(_0x4930bd){_0x278a86=_0x4930bd;_0x32281a[_0x9a5c('0x32')]=_[_0x9a5c('0x2e')](db['SalesforceField'][_0x9a5c('0x2a')]);_0x32281a[_0x9a5c('0x2d')]=_[_0x9a5c('0x2e')](_0x1dee03['query']);_0x32281a[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x32281a[_0x9a5c('0x32')],_0x32281a[_0x9a5c('0x2d')]);_0x3b5a4a[_0x9a5c('0x31')]=_['intersection'](_0x32281a['model'],qs['fields'](_0x1dee03[_0x9a5c('0x2d')]['fields']));_0x3b5a4a[_0x9a5c('0x31')]=_0x3b5a4a['attributes'][_0x9a5c('0x34')]?_0x3b5a4a[_0x9a5c('0x31')]:_0x32281a[_0x9a5c('0x32')];_0x3b5a4a[_0x9a5c('0x38')]=qs[_0x9a5c('0x39')](_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x39')]);_0x3b5a4a[_0x9a5c('0x3a')]=qs['filters'](_[_0x9a5c('0x3b')](_0x1dee03[_0x9a5c('0x2d')],_0x32281a[_0x9a5c('0x2f')]));if(_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x3c')]){_0x3b5a4a[_0x9a5c('0x3a')]=_[_0x9a5c('0x3d')](_0x3b5a4a[_0x9a5c('0x3a')],{'$or':_[_0x9a5c('0x29')](_0x3b5a4a['attributes'],function(_0x554738){var _0x44b9b4={};_0x44b9b4[_0x554738]={'$like':'%'+_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x3c')]+'%'};return _0x44b9b4;})});}_0x3b5a4a=_[_0x9a5c('0x3d')]({},_0x3b5a4a,_0x1dee03[_0x9a5c('0x3e')]);return _0x278a86[_0x9a5c('0x4d')](_0x3b5a4a);}})[_0x9a5c('0x42')](function(_0x3bd198){if(_0x3bd198){_0xa7ff4b=_0x3bd198[_0x9a5c('0x34')];if(!_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x3b5a4a['limit']=qs[_0x9a5c('0x37')](_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x37')]);_0x3b5a4a[_0x9a5c('0x1d')]=qs[_0x9a5c('0x1d')](_0x1dee03[_0x9a5c('0x2d')][_0x9a5c('0x1d')]);}return _0x278a86['getSubjects'](_0x3b5a4a);}})['then'](function(_0x5b9f85){if(_0x5b9f85){return _0x5b9f85?{'count':_0xa7ff4b,'rows':_0x5b9f85}:null;}})[_0x9a5c('0x42')](respondWithResult(_0x3e3fc2,null))[_0x9a5c('0x48')](handleError(_0x3e3fc2,null));};exports[_0x9a5c('0x4e')]=function(_0x1063dc,_0x404603,_0x3d2dcd){var _0x701c80={};var _0x2ce4be={};var _0x4c6569;var _0x4d569f;return db[_0x9a5c('0x3f')]['findOne']({'where':{'id':_0x1063dc['params']['id']}})[_0x9a5c('0x42')](handleEntityNotFound(_0x404603,null))['then'](function(_0x451fc1){if(_0x451fc1){_0x4c6569=_0x451fc1;_0x2ce4be[_0x9a5c('0x32')]=_['keys'](db[_0x9a5c('0x4c')][_0x9a5c('0x2a')]);_0x2ce4be[_0x9a5c('0x2d')]=_['keys'](_0x1063dc[_0x9a5c('0x2d')]);_0x2ce4be[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x2ce4be[_0x9a5c('0x32')],_0x2ce4be[_0x9a5c('0x2d')]);_0x701c80[_0x9a5c('0x31')]=_[_0x9a5c('0x30')](_0x2ce4be['model'],qs[_0x9a5c('0x33')](_0x1063dc[_0x9a5c('0x2d')]['fields']));_0x701c80[_0x9a5c('0x31')]=_0x701c80[_0x9a5c('0x31')]['length']?_0x701c80[_0x9a5c('0x31')]:_0x2ce4be[_0x9a5c('0x32')];_0x701c80[_0x9a5c('0x38')]=qs[_0x9a5c('0x39')](_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x39')]);_0x701c80[_0x9a5c('0x3a')]=qs['filters'](_['pick'](_0x1063dc[_0x9a5c('0x2d')],_0x2ce4be[_0x9a5c('0x2f')]));if(_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x3c')]){_0x701c80[_0x9a5c('0x3a')]=_[_0x9a5c('0x3d')](_0x701c80['where'],{'$or':_[_0x9a5c('0x29')](_0x701c80[_0x9a5c('0x31')],function(_0x5adbab){var _0x5153ef={};_0x5153ef[_0x5adbab]={'$like':'%'+_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x3c')]+'%'};return _0x5153ef;})});}_0x701c80=_[_0x9a5c('0x3d')]({},_0x701c80,_0x1063dc[_0x9a5c('0x3e')]);return _0x4c6569[_0x9a5c('0x4e')](_0x701c80);}})[_0x9a5c('0x42')](function(_0x5b528b){if(_0x5b528b){_0x4d569f=_0x5b528b['length'];if(!_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x701c80[_0x9a5c('0x37')]=qs[_0x9a5c('0x37')](_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x37')]);_0x701c80['offset']=qs[_0x9a5c('0x1d')](_0x1063dc[_0x9a5c('0x2d')][_0x9a5c('0x1d')]);}return _0x4c6569['getDescriptions'](_0x701c80);}})[_0x9a5c('0x42')](function(_0x580372){if(_0x580372){return _0x580372?{'count':_0x4d569f,'rows':_0x580372}:null;}})[_0x9a5c('0x42')](respondWithResult(_0x404603,null))[_0x9a5c('0x48')](handleError(_0x404603,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fe8cb9b..699e9f6 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 _0x28ea=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x28ea,0x170));var _0xa28e=function(_0xac81,_0x40ea99){_0xac81=_0xac81-0x0;var _0x55c283=_0x28ea[_0xac81];return _0x55c283;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa28e('0x0'))(_0xa28e('0x1'));var moment=require('moment');var BPromise=require(_0xa28e('0x2'));var rp=require(_0xa28e('0x3'));var fs=require('fs');var path=require(_0xa28e('0x4'));var rimraf=require(_0xa28e('0x5'));var config=require(_0xa28e('0x6'));var attributes=require(_0xa28e('0x7'));module[_0xa28e('0x8')]=function(_0x21a481,_0x534d88){return _0x21a481['define'](_0xa28e('0x9'),attributes,{'tableName':_0xa28e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd756=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x59d463,_0x15a828){var _0x30edc2=function(_0x1aae1d){while(--_0x1aae1d){_0x59d463['push'](_0x59d463['shift']());}};_0x30edc2(++_0x15a828);}(_0xd756,0xb5));var _0x6d75=function(_0x408b3e,_0x4ccff1){_0x408b3e=_0x408b3e-0x0;var _0x289a56=_0xd756[_0x408b3e];return _0x289a56;};'use strict';var _=require(_0x6d75('0x0'));var util=require(_0x6d75('0x1'));var logger=require(_0x6d75('0x2'))(_0x6d75('0x3'));var moment=require(_0x6d75('0x4'));var BPromise=require(_0x6d75('0x5'));var rp=require(_0x6d75('0x6'));var fs=require('fs');var path=require(_0x6d75('0x7'));var rimraf=require(_0x6d75('0x8'));var config=require(_0x6d75('0x9'));var attributes=require(_0x6d75('0xa'));module[_0x6d75('0xb')]=function(_0x1b8788,_0x58c2cf){return _0x1b8788[_0x6d75('0xc')](_0x6d75('0xd'),attributes,{'tableName':_0x6d75('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 0a10a2e..6bc26da 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 _0xba5a=['code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0xba5a,0xe9));var _0xaba5=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xba5a[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0xaba5('0x0'));var util=require(_0xaba5('0x1'));var moment=require(_0xaba5('0x2'));var BPromise=require('bluebird');var rs=require(_0xaba5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x4'))['db'];var utils=require(_0xaba5('0x5'));var logger=require(_0xaba5('0x6'))(_0xaba5('0x7'));var config=require(_0xaba5('0x8'));var jayson=require(_0xaba5('0x9'));var client=jayson[_0xaba5('0xa')][_0xaba5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5542a9,_0x352df6,_0x2ad983){return new BPromise(function(_0x49a2b2,_0x1656ec){return client[_0xaba5('0xc')](_0x5542a9,_0x2ad983)[_0xaba5('0xd')](function(_0x3c8006){logger[_0xaba5('0xe')](_0xaba5('0xf'),_0x352df6,_0xaba5('0x10'));logger[_0xaba5('0x11')](_0xaba5('0x12'),_0x352df6,_0xaba5('0x10'),JSON['stringify'](_0x3c8006));if(_0x3c8006['error']){if(_0x3c8006[_0xaba5('0x13')][_0xaba5('0x14')]===0x1f4){logger[_0xaba5('0x13')](_0xaba5('0xf'),_0x352df6,_0x3c8006[_0xaba5('0x13')][_0xaba5('0x15')]);return _0x1656ec(_0x3c8006['error'][_0xaba5('0x15')]);}logger[_0xaba5('0x13')](_0xaba5('0xf'),_0x352df6,_0x3c8006[_0xaba5('0x13')][_0xaba5('0x15')]);return _0x49a2b2(_0x3c8006[_0xaba5('0x13')][_0xaba5('0x15')]);}else{logger[_0xaba5('0xe')](_0xaba5('0xf'),_0x352df6,_0xaba5('0x10'));_0x49a2b2(_0x3c8006['result'][_0xaba5('0x15')]);}})[_0xaba5('0x16')](function(_0x5b36e2){logger[_0xaba5('0x13')](_0xaba5('0xf'),_0x352df6,_0x5b36e2);_0x1656ec(_0x5b36e2);});});} \ No newline at end of file +var _0x5e3f=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x5e3f,0xab));var _0xf5e3=function(_0x3ebf12,_0x1199e7){_0x3ebf12=_0x3ebf12-0x0;var _0x39619c=_0x5e3f[_0x3ebf12];return _0x39619c;};'use strict';var _=require('lodash');var util=require(_0xf5e3('0x0'));var moment=require(_0xf5e3('0x1'));var BPromise=require(_0xf5e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5e3('0x3'));var db=require(_0xf5e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5e3('0x5'))(_0xf5e3('0x6'));var config=require(_0xf5e3('0x7'));var jayson=require(_0xf5e3('0x8'));var client=jayson[_0xf5e3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d3e95,_0x1a7a68,_0x13a7ba){return new BPromise(function(_0x30b455,_0x42c1c8){return client[_0xf5e3('0xa')](_0x5d3e95,_0x13a7ba)[_0xf5e3('0xb')](function(_0x246df1){logger[_0xf5e3('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1a7a68,_0xf5e3('0xd'));logger[_0xf5e3('0xe')](_0xf5e3('0xf'),_0x1a7a68,'request\x20sent',JSON['stringify'](_0x246df1));if(_0x246df1[_0xf5e3('0x10')]){if(_0x246df1[_0xf5e3('0x10')]['code']===0x1f4){logger[_0xf5e3('0x10')](_0xf5e3('0x11'),_0x1a7a68,_0x246df1[_0xf5e3('0x10')][_0xf5e3('0x12')]);return _0x42c1c8(_0x246df1[_0xf5e3('0x10')][_0xf5e3('0x12')]);}logger[_0xf5e3('0x10')](_0xf5e3('0x11'),_0x1a7a68,_0x246df1['error'][_0xf5e3('0x12')]);return _0x30b455(_0x246df1['error']['message']);}else{logger[_0xf5e3('0xc')](_0xf5e3('0x11'),_0x1a7a68,'request\x20sent');_0x30b455(_0x246df1[_0xf5e3('0x13')][_0xf5e3('0x12')]);}})[_0xf5e3('0x14')](function(_0x548c9e){logger[_0xf5e3('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1a7a68,_0x548c9e);_0x42c1c8(_0x548c9e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8d054f7..6cb9ab8 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 _0x41f8=['/:id','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x389e0d,_0x4331cb){var _0x5ba01a=function(_0x4baac6){while(--_0x4baac6){_0x389e0d['push'](_0x389e0d['shift']());}};_0x5ba01a(++_0x4331cb);}(_0x41f8,0x1c8));var _0x841f=function(_0x6e1255,_0x3d0c79){_0x6e1255=_0x6e1255-0x0;var _0x3ea544=_0x41f8[_0x6e1255];return _0x3ea544;};'use strict';var multer=require(_0x841f('0x0'));var util=require(_0x841f('0x1'));var path=require('path');var timeout=require(_0x841f('0x2'));var express=require(_0x841f('0x3'));var router=express[_0x841f('0x4')]();var fs_extra=require(_0x841f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x841f('0x6'));var config=require(_0x841f('0x7'));var controller=require(_0x841f('0x8'));router[_0x841f('0x9')]('/',auth[_0x841f('0xa')](),controller[_0x841f('0xb')]);router[_0x841f('0x9')](_0x841f('0xc'),auth['isAuthenticated'](),controller[_0x841f('0xd')]);router[_0x841f('0xe')]('/',auth['isAuthenticated'](),controller[_0x841f('0xf')]);router[_0x841f('0x10')]('/:id',auth[_0x841f('0xa')](),controller['update']);router['delete'](_0x841f('0xc'),auth[_0x841f('0xa')](),controller[_0x841f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9a0a=['get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0xd66b6e,_0x28fc55){var _0x2e1999=function(_0x4accce){while(--_0x4accce){_0xd66b6e['push'](_0xd66b6e['shift']());}};_0x2e1999(++_0x28fc55);}(_0x9a0a,0x15e));var _0xa9a0=function(_0x23dd94,_0x596d27){_0x23dd94=_0x23dd94-0x0;var _0x4aeeb6=_0x9a0a[_0x23dd94];return _0x4aeeb6;};'use strict';var multer=require(_0xa9a0('0x0'));var util=require(_0xa9a0('0x1'));var path=require(_0xa9a0('0x2'));var timeout=require(_0xa9a0('0x3'));var express=require(_0xa9a0('0x4'));var router=express[_0xa9a0('0x5')]();var fs_extra=require(_0xa9a0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa9a0('0x7'));var config=require(_0xa9a0('0x8'));var controller=require(_0xa9a0('0x9'));router[_0xa9a0('0xa')]('/',auth[_0xa9a0('0xb')](),controller[_0xa9a0('0xc')]);router['get'](_0xa9a0('0xd'),auth[_0xa9a0('0xb')](),controller[_0xa9a0('0xe')]);router[_0xa9a0('0xf')]('/',auth['isAuthenticated'](),controller[_0xa9a0('0x10')]);router[_0xa9a0('0x11')]('/:id',auth[_0xa9a0('0xb')](),controller['update']);router[_0xa9a0('0x12')](_0xa9a0('0xd'),auth[_0xa9a0('0xb')](),controller['destroy']);module[_0xa9a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index aa34042..f09d012 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 _0x9972=['STRING','customVariable','exports','ENUM','string','variable','picklist'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9972,0x16e));var _0x2997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9972[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x2997('0x0')]={'type':{'type':Sequelize[_0x2997('0x1')](_0x2997('0x2'),_0x2997('0x3'),'customVariable','keyValue',_0x2997('0x4')),'defaultValue':_0x2997('0x2')},'content':{'type':Sequelize[_0x2997('0x5')]},'key':{'type':Sequelize[_0x2997('0x5')]},'keyType':{'type':Sequelize[_0x2997('0x1')](_0x2997('0x2'),_0x2997('0x3'),_0x2997('0x6'))},'keyContent':{'type':Sequelize[_0x2997('0x5')]},'idField':{'type':Sequelize[_0x2997('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea43=['keyValue','picklist','STRING','sequelize','ENUM','customVariable'];(function(_0x207fc9,_0x5bd278){var _0x269791=function(_0x29f2f7){while(--_0x29f2f7){_0x207fc9['push'](_0x207fc9['shift']());}};_0x269791(++_0x5bd278);}(_0xea43,0x14d));var _0x3ea4=function(_0x11ed06,_0xbc52af){_0x11ed06=_0x11ed06-0x0;var _0x504340=_0xea43[_0x11ed06];return _0x504340;};'use strict';var Sequelize=require(_0x3ea4('0x0'));module['exports']={'type':{'type':Sequelize[_0x3ea4('0x1')]('string','variable',_0x3ea4('0x2'),_0x3ea4('0x3'),_0x3ea4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3ea4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3ea4('0x1')]('string','variable',_0x3ea4('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3ea4('0x5')]},'variableName':{'type':Sequelize[_0x3ea4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 83b247e..60a4054 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 _0x7dce=['query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','status','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','SalesforceField','rawAttributes','fieldName','key','model','map'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x7dce,0x1e9));var _0xe7dc=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x7dce[_0x26d6d9];return _0x1b4875;};'use strict';var emlformat=require(_0xe7dc('0x0'));var rimraf=require(_0xe7dc('0x1'));var zipdir=require(_0xe7dc('0x2'));var jsonpatch=require(_0xe7dc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7dc('0x4'));var Mustache=require(_0xe7dc('0x5'));var util=require(_0xe7dc('0x6'));var path=require(_0xe7dc('0x7'));var sox=require(_0xe7dc('0x8'));var csv=require(_0xe7dc('0x9'));var ejs=require(_0xe7dc('0xa'));var fs=require('fs');var fs_extra=require(_0xe7dc('0xb'));var _=require(_0xe7dc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe7dc('0xd'));var deskjs=require(_0xe7dc('0xe'));var toCsv=require(_0xe7dc('0x9'));var querystring=require(_0xe7dc('0xf'));var Papa=require(_0xe7dc('0x10'));var Redis=require(_0xe7dc('0x11'));var authService=require(_0xe7dc('0x12'));var qs=require(_0xe7dc('0x13'));var as=require(_0xe7dc('0x14'));var hardwareService=require(_0xe7dc('0x15'));var logger=require(_0xe7dc('0x16'))(_0xe7dc('0x17'));var utils=require(_0xe7dc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe7dc('0x19'));var db=require(_0xe7dc('0x1a'))['db'];function respondWithStatusCode(_0x59204a,_0x107c16){_0x107c16=_0x107c16||0xcc;return function(_0xdf233e){if(_0xdf233e){return _0x59204a[_0xe7dc('0x1b')](_0x107c16);}return _0x59204a['status'](_0x107c16)[_0xe7dc('0x1c')]();};}function respondWithResult(_0x505120,_0x4f7b9a){_0x4f7b9a=_0x4f7b9a||0xc8;return function(_0x3106a2){if(_0x3106a2){return _0x505120['status'](_0x4f7b9a)['json'](_0x3106a2);}};}function respondWithFilteredResult(_0x4a3ba4,_0x324e51){return function(_0x256d6d){if(_0x256d6d){var _0x351db1=typeof _0x324e51[_0xe7dc('0x1d')]===_0xe7dc('0x1e')&&typeof _0x324e51[_0xe7dc('0x1f')]===_0xe7dc('0x1e');var _0x158b56=_0x256d6d['count'];var _0x427c69=_0x351db1?0x0:_0x324e51[_0xe7dc('0x1d')];var _0xa1dd1c=_0x351db1?_0x256d6d['count']:_0x324e51[_0xe7dc('0x1d')]+_0x324e51[_0xe7dc('0x1f')];var _0x385e96;if(_0xa1dd1c>=_0x158b56){_0xa1dd1c=_0x158b56;_0x385e96=0xc8;}else{_0x385e96=0xce;}_0x4a3ba4[_0xe7dc('0x20')](_0x385e96);return _0x4a3ba4[_0xe7dc('0x21')](_0xe7dc('0x22'),_0x427c69+'-'+_0xa1dd1c+'/'+_0x158b56)['json'](_0x256d6d);}return null;};}function patchUpdates(_0x3d685a){return function(_0x4dcbaa){try{jsonpatch[_0xe7dc('0x23')](_0x4dcbaa,_0x3d685a,!![]);}catch(_0x17910f){return BPromise[_0xe7dc('0x24')](_0x17910f);}return _0x4dcbaa[_0xe7dc('0x25')]();};}function saveUpdates(_0x10da16,_0x469580){return function(_0x4f8a37){if(_0x4f8a37){return _0x4f8a37['update'](_0x10da16)['then'](function(_0x4e7e69){return _0x4e7e69;});}return null;};}function removeEntity(_0x55f09c,_0x1cbcae){return function(_0x2abf3e){if(_0x2abf3e){return _0x2abf3e[_0xe7dc('0x26')]()[_0xe7dc('0x27')](function(){_0x55f09c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x395720,_0x2eccac){return function(_0x1e922e){if(!_0x1e922e){_0x395720[_0xe7dc('0x1b')](0x194);}return _0x1e922e;};}function handleError(_0x3bc7d2,_0x2ae22c){_0x2ae22c=_0x2ae22c||0x1f4;return function(_0x396f5f){logger[_0xe7dc('0x28')](_0x396f5f[_0xe7dc('0x29')]);if(_0x396f5f[_0xe7dc('0x2a')]){delete _0x396f5f[_0xe7dc('0x2a')];}_0x3bc7d2[_0xe7dc('0x20')](_0x2ae22c)['send'](_0x396f5f);};}exports[_0xe7dc('0x2b')]=function(_0x3cf527,_0x3589da){var _0x2fdc14={},_0x267944={},_0x4f7ff5={'count':0x0,'rows':[]};var _0x214776=_['map'](db[_0xe7dc('0x2c')][_0xe7dc('0x2d')],function(_0x43672f){return{'name':_0x43672f[_0xe7dc('0x2e')],'type':_0x43672f['type'][_0xe7dc('0x2f')]};});_0x267944[_0xe7dc('0x30')]=_[_0xe7dc('0x31')](_0x214776,'name');_0x267944[_0xe7dc('0x32')]=_[_0xe7dc('0x33')](_0x3cf527[_0xe7dc('0x32')]);_0x267944[_0xe7dc('0x34')]=_[_0xe7dc('0x35')](_0x267944[_0xe7dc('0x30')],_0x267944[_0xe7dc('0x32')]);_0x2fdc14[_0xe7dc('0x36')]=_[_0xe7dc('0x35')](_0x267944['model'],qs[_0xe7dc('0x37')](_0x3cf527[_0xe7dc('0x32')]['fields']));_0x2fdc14[_0xe7dc('0x36')]=_0x2fdc14[_0xe7dc('0x36')][_0xe7dc('0x38')]?_0x2fdc14['attributes']:_0x267944['model'];if(!_0x3cf527[_0xe7dc('0x32')]['hasOwnProperty']('nolimit')){_0x2fdc14[_0xe7dc('0x1f')]=qs[_0xe7dc('0x1f')](_0x3cf527['query'][_0xe7dc('0x1f')]);_0x2fdc14['offset']=qs['offset'](_0x3cf527[_0xe7dc('0x32')][_0xe7dc('0x1d')]);}_0x2fdc14[_0xe7dc('0x39')]=qs[_0xe7dc('0x3a')](_0x3cf527[_0xe7dc('0x32')][_0xe7dc('0x3a')]);_0x2fdc14[_0xe7dc('0x3b')]=qs[_0xe7dc('0x34')](_['pick'](_0x3cf527[_0xe7dc('0x32')],_0x267944[_0xe7dc('0x34')]),_0x214776);if(_0x3cf527['query'][_0xe7dc('0x3c')]){_0x2fdc14[_0xe7dc('0x3b')]=_[_0xe7dc('0x3d')](_0x2fdc14['where'],{'$or':_[_0xe7dc('0x31')](_0x214776,function(_0x25ca0a){if(_0x25ca0a[_0xe7dc('0x3e')]!==_0xe7dc('0x3f')){var _0x37be6c={};_0x37be6c[_0x25ca0a[_0xe7dc('0x2a')]]={'$like':'%'+_0x3cf527[_0xe7dc('0x32')][_0xe7dc('0x3c')]+'%'};return _0x37be6c;}})});}_0x2fdc14=_[_0xe7dc('0x3d')]({},_0x2fdc14,_0x3cf527[_0xe7dc('0x40')]);var _0x41158d={'where':_0x2fdc14['where']};return db['SalesforceField'][_0xe7dc('0x41')](_0x41158d)['then'](function(_0xbc429c){_0x4f7ff5[_0xe7dc('0x41')]=_0xbc429c;if(_0x3cf527[_0xe7dc('0x32')][_0xe7dc('0x42')]){_0x2fdc14[_0xe7dc('0x43')]=[{'all':!![]}];}return db[_0xe7dc('0x2c')][_0xe7dc('0x44')](_0x2fdc14);})[_0xe7dc('0x27')](function(_0x1bd886){_0x4f7ff5[_0xe7dc('0x45')]=_0x1bd886;return _0x4f7ff5;})[_0xe7dc('0x27')](respondWithFilteredResult(_0x3589da,_0x2fdc14))[_0xe7dc('0x46')](handleError(_0x3589da,null));};exports[_0xe7dc('0x47')]=function(_0x135887,_0x1b4927){var _0x197dd9={'raw':!![],'where':{'id':_0x135887['params']['id']}},_0x4bd848={};_0x4bd848[_0xe7dc('0x30')]=_[_0xe7dc('0x33')](db[_0xe7dc('0x2c')][_0xe7dc('0x2d')]);_0x4bd848[_0xe7dc('0x32')]=_['keys'](_0x135887[_0xe7dc('0x32')]);_0x4bd848[_0xe7dc('0x34')]=_[_0xe7dc('0x35')](_0x4bd848[_0xe7dc('0x30')],_0x4bd848[_0xe7dc('0x32')]);_0x197dd9[_0xe7dc('0x36')]=_[_0xe7dc('0x35')](_0x4bd848[_0xe7dc('0x30')],qs['fields'](_0x135887[_0xe7dc('0x32')][_0xe7dc('0x37')]));_0x197dd9[_0xe7dc('0x36')]=_0x197dd9[_0xe7dc('0x36')][_0xe7dc('0x38')]?_0x197dd9[_0xe7dc('0x36')]:_0x4bd848[_0xe7dc('0x30')];if(_0x135887['query'][_0xe7dc('0x42')]){_0x197dd9[_0xe7dc('0x43')]=[{'all':!![]}];}_0x197dd9=_[_0xe7dc('0x3d')]({},_0x197dd9,_0x135887[_0xe7dc('0x40')]);return db[_0xe7dc('0x2c')][_0xe7dc('0x48')](_0x197dd9)[_0xe7dc('0x27')](handleEntityNotFound(_0x1b4927,null))[_0xe7dc('0x27')](respondWithResult(_0x1b4927,null))[_0xe7dc('0x46')](handleError(_0x1b4927,null));};exports['create']=function(_0x5124b3,_0x31e6ab){return db[_0xe7dc('0x2c')][_0xe7dc('0x49')](_0x5124b3[_0xe7dc('0x4a')],{})[_0xe7dc('0x27')](respondWithResult(_0x31e6ab,0xc9))[_0xe7dc('0x46')](handleError(_0x31e6ab,null));};exports[_0xe7dc('0x4b')]=function(_0x464fbe,_0x499039){if(_0x464fbe[_0xe7dc('0x4a')]['id']){delete _0x464fbe[_0xe7dc('0x4a')]['id'];}return db[_0xe7dc('0x2c')][_0xe7dc('0x48')]({'where':{'id':_0x464fbe['params']['id']}})[_0xe7dc('0x27')](handleEntityNotFound(_0x499039,null))[_0xe7dc('0x27')](saveUpdates(_0x464fbe[_0xe7dc('0x4a')],null))[_0xe7dc('0x27')](respondWithResult(_0x499039,null))[_0xe7dc('0x46')](handleError(_0x499039,null));};exports[_0xe7dc('0x26')]=function(_0x14799b,_0x32c46a){return db[_0xe7dc('0x2c')][_0xe7dc('0x48')]({'where':{'id':_0x14799b[_0xe7dc('0x4c')]['id']}})[_0xe7dc('0x27')](handleEntityNotFound(_0x32c46a,null))[_0xe7dc('0x27')](removeEntity(_0x32c46a,null))[_0xe7dc('0x46')](handleError(_0x32c46a,null));}; \ No newline at end of file +var _0x79dc=['index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','order','where','pick','filter','merge','options','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send'];(function(_0x3ecc0c,_0x481c07){var _0x1023f2=function(_0x521294){while(--_0x521294){_0x3ecc0c['push'](_0x3ecc0c['shift']());}};_0x1023f2(++_0x481c07);}(_0x79dc,0x1ba));var _0xc79d=function(_0x2ec9a9,_0x3a401c){_0x2ec9a9=_0x2ec9a9-0x0;var _0x2e97be=_0x79dc[_0x2ec9a9];return _0x2e97be;};'use strict';var emlformat=require(_0xc79d('0x0'));var rimraf=require(_0xc79d('0x1'));var zipdir=require(_0xc79d('0x2'));var jsonpatch=require(_0xc79d('0x3'));var rp=require(_0xc79d('0x4'));var moment=require(_0xc79d('0x5'));var BPromise=require(_0xc79d('0x6'));var Mustache=require(_0xc79d('0x7'));var util=require('util');var path=require(_0xc79d('0x8'));var sox=require('sox');var csv=require(_0xc79d('0x9'));var ejs=require(_0xc79d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc79d('0xb'));var squel=require(_0xc79d('0xc'));var crypto=require(_0xc79d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc79d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc79d('0xf'));var Redis=require(_0xc79d('0x10'));var authService=require(_0xc79d('0x11'));var qs=require(_0xc79d('0x12'));var as=require(_0xc79d('0x13'));var hardwareService=require(_0xc79d('0x14'));var logger=require(_0xc79d('0x15'))('api');var utils=require(_0xc79d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x268a90,_0x201ee8){_0x201ee8=_0x201ee8||0xcc;return function(_0x58a44b){if(_0x58a44b){return _0x268a90[_0xc79d('0x17')](_0x201ee8);}return _0x268a90[_0xc79d('0x18')](_0x201ee8)['end']();};}function respondWithResult(_0x26d576,_0x5408c2){_0x5408c2=_0x5408c2||0xc8;return function(_0x90dd40){if(_0x90dd40){return _0x26d576[_0xc79d('0x18')](_0x5408c2)[_0xc79d('0x19')](_0x90dd40);}};}function respondWithFilteredResult(_0x44a100,_0xa2539a){return function(_0x38eb61){if(_0x38eb61){var _0x4d5210=typeof _0xa2539a[_0xc79d('0x1a')]===_0xc79d('0x1b')&&typeof _0xa2539a[_0xc79d('0x1c')]===_0xc79d('0x1b');var _0xdc4b9e=_0x38eb61[_0xc79d('0x1d')];var _0x4544a2=_0x4d5210?0x0:_0xa2539a['offset'];var _0x2e28f3=_0x4d5210?_0x38eb61[_0xc79d('0x1d')]:_0xa2539a[_0xc79d('0x1a')]+_0xa2539a[_0xc79d('0x1c')];var _0x4516a1;if(_0x2e28f3>=_0xdc4b9e){_0x2e28f3=_0xdc4b9e;_0x4516a1=0xc8;}else{_0x4516a1=0xce;}_0x44a100[_0xc79d('0x18')](_0x4516a1);return _0x44a100[_0xc79d('0x1e')](_0xc79d('0x1f'),_0x4544a2+'-'+_0x2e28f3+'/'+_0xdc4b9e)[_0xc79d('0x19')](_0x38eb61);}return null;};}function patchUpdates(_0x1ed969){return function(_0x31ca9f){try{jsonpatch[_0xc79d('0x20')](_0x31ca9f,_0x1ed969,!![]);}catch(_0x1a4bf6){return BPromise['reject'](_0x1a4bf6);}return _0x31ca9f[_0xc79d('0x21')]();};}function saveUpdates(_0x1c6224,_0xb8fd57){return function(_0x461d15){if(_0x461d15){return _0x461d15[_0xc79d('0x22')](_0x1c6224)[_0xc79d('0x23')](function(_0x3bcfd8){return _0x3bcfd8;});}return null;};}function removeEntity(_0x46e5f8,_0x53dfcd){return function(_0x46bc0d){if(_0x46bc0d){return _0x46bc0d[_0xc79d('0x24')]()['then'](function(){_0x46e5f8[_0xc79d('0x18')](0xcc)[_0xc79d('0x25')]();});}};}function handleEntityNotFound(_0x4a0f03,_0x225022){return function(_0x548593){if(!_0x548593){_0x4a0f03[_0xc79d('0x17')](0x194);}return _0x548593;};}function handleError(_0xeee118,_0x425257){_0x425257=_0x425257||0x1f4;return function(_0xb9bc28){logger[_0xc79d('0x26')](_0xb9bc28['stack']);if(_0xb9bc28[_0xc79d('0x27')]){delete _0xb9bc28['name'];}_0xeee118['status'](_0x425257)[_0xc79d('0x28')](_0xb9bc28);};}exports[_0xc79d('0x29')]=function(_0x420e18,_0x558ff2){var _0x2c080b={},_0x5a4969={},_0x171ce6={'count':0x0,'rows':[]};var _0x2627dd=_[_0xc79d('0x2a')](db[_0xc79d('0x2b')][_0xc79d('0x2c')],function(_0x4803ea){return{'name':_0x4803ea[_0xc79d('0x2d')],'type':_0x4803ea[_0xc79d('0x2e')][_0xc79d('0x2f')]};});_0x5a4969[_0xc79d('0x30')]=_[_0xc79d('0x2a')](_0x2627dd,_0xc79d('0x27'));_0x5a4969['query']=_[_0xc79d('0x31')](_0x420e18['query']);_0x5a4969[_0xc79d('0x32')]=_[_0xc79d('0x33')](_0x5a4969[_0xc79d('0x30')],_0x5a4969['query']);_0x2c080b['attributes']=_[_0xc79d('0x33')](_0x5a4969[_0xc79d('0x30')],qs[_0xc79d('0x34')](_0x420e18[_0xc79d('0x35')][_0xc79d('0x34')]));_0x2c080b[_0xc79d('0x36')]=_0x2c080b['attributes'][_0xc79d('0x37')]?_0x2c080b[_0xc79d('0x36')]:_0x5a4969[_0xc79d('0x30')];if(!_0x420e18['query']['hasOwnProperty']('nolimit')){_0x2c080b[_0xc79d('0x1c')]=qs[_0xc79d('0x1c')](_0x420e18[_0xc79d('0x35')][_0xc79d('0x1c')]);_0x2c080b[_0xc79d('0x1a')]=qs[_0xc79d('0x1a')](_0x420e18['query']['offset']);}_0x2c080b[_0xc79d('0x38')]=qs['sort'](_0x420e18['query']['sort']);_0x2c080b[_0xc79d('0x39')]=qs['filters'](_[_0xc79d('0x3a')](_0x420e18[_0xc79d('0x35')],_0x5a4969[_0xc79d('0x32')]),_0x2627dd);if(_0x420e18[_0xc79d('0x35')]['filter']){_0x2c080b[_0xc79d('0x39')]=_['merge'](_0x2c080b[_0xc79d('0x39')],{'$or':_[_0xc79d('0x2a')](_0x2627dd,function(_0x52cb6b){if(_0x52cb6b[_0xc79d('0x2e')]!=='VIRTUAL'){var _0x2e1bc9={};_0x2e1bc9[_0x52cb6b['name']]={'$like':'%'+_0x420e18[_0xc79d('0x35')][_0xc79d('0x3b')]+'%'};return _0x2e1bc9;}})});}_0x2c080b=_[_0xc79d('0x3c')]({},_0x2c080b,_0x420e18[_0xc79d('0x3d')]);var _0x3afceb={'where':_0x2c080b[_0xc79d('0x39')]};return db[_0xc79d('0x2b')][_0xc79d('0x1d')](_0x3afceb)[_0xc79d('0x23')](function(_0x25d528){_0x171ce6[_0xc79d('0x1d')]=_0x25d528;if(_0x420e18[_0xc79d('0x35')]['includeAll']){_0x2c080b['include']=[{'all':!![]}];}return db[_0xc79d('0x2b')][_0xc79d('0x3e')](_0x2c080b);})[_0xc79d('0x23')](function(_0x4bc712){_0x171ce6[_0xc79d('0x3f')]=_0x4bc712;return _0x171ce6;})[_0xc79d('0x23')](respondWithFilteredResult(_0x558ff2,_0x2c080b))[_0xc79d('0x40')](handleError(_0x558ff2,null));};exports['show']=function(_0x3a7f18,_0x1d5c7a){var _0x45b861={'raw':!![],'where':{'id':_0x3a7f18[_0xc79d('0x41')]['id']}},_0x35043c={};_0x35043c['model']=_['keys'](db[_0xc79d('0x2b')]['rawAttributes']);_0x35043c[_0xc79d('0x35')]=_[_0xc79d('0x31')](_0x3a7f18['query']);_0x35043c[_0xc79d('0x32')]=_[_0xc79d('0x33')](_0x35043c[_0xc79d('0x30')],_0x35043c[_0xc79d('0x35')]);_0x45b861['attributes']=_[_0xc79d('0x33')](_0x35043c[_0xc79d('0x30')],qs['fields'](_0x3a7f18[_0xc79d('0x35')][_0xc79d('0x34')]));_0x45b861[_0xc79d('0x36')]=_0x45b861[_0xc79d('0x36')][_0xc79d('0x37')]?_0x45b861[_0xc79d('0x36')]:_0x35043c[_0xc79d('0x30')];if(_0x3a7f18[_0xc79d('0x35')]['includeAll']){_0x45b861['include']=[{'all':!![]}];}_0x45b861=_[_0xc79d('0x3c')]({},_0x45b861,_0x3a7f18[_0xc79d('0x3d')]);return db['SalesforceField'][_0xc79d('0x42')](_0x45b861)['then'](handleEntityNotFound(_0x1d5c7a,null))[_0xc79d('0x23')](respondWithResult(_0x1d5c7a,null))[_0xc79d('0x40')](handleError(_0x1d5c7a,null));};exports[_0xc79d('0x43')]=function(_0x4ad64a,_0x3e066b){return db[_0xc79d('0x2b')]['create'](_0x4ad64a[_0xc79d('0x44')],{})[_0xc79d('0x23')](respondWithResult(_0x3e066b,0xc9))[_0xc79d('0x40')](handleError(_0x3e066b,null));};exports[_0xc79d('0x22')]=function(_0x38603f,_0x2ec738){if(_0x38603f[_0xc79d('0x44')]['id']){delete _0x38603f['body']['id'];}return db[_0xc79d('0x2b')][_0xc79d('0x42')]({'where':{'id':_0x38603f[_0xc79d('0x41')]['id']}})[_0xc79d('0x23')](handleEntityNotFound(_0x2ec738,null))[_0xc79d('0x23')](saveUpdates(_0x38603f[_0xc79d('0x44')],null))[_0xc79d('0x23')](respondWithResult(_0x2ec738,null))['catch'](handleError(_0x2ec738,null));};exports[_0xc79d('0x24')]=function(_0x24d70c,_0x1b248e){return db[_0xc79d('0x2b')][_0xc79d('0x42')]({'where':{'id':_0x24d70c[_0xc79d('0x41')]['id']}})[_0xc79d('0x23')](handleEntityNotFound(_0x1b248e,null))[_0xc79d('0x23')](removeEntity(_0x1b248e,null))[_0xc79d('0x40')](handleError(_0x1b248e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1c24c3e..8830c4d 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 _0x5116=['api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x6148ee,_0x4d2fca){var _0x5afc74=function(_0x351621){while(--_0x351621){_0x6148ee['push'](_0x6148ee['shift']());}};_0x5afc74(++_0x4d2fca);}(_0x5116,0x1ea));var _0x6511=function(_0x33450,_0x21309b){_0x33450=_0x33450-0x0;var _0x43438a=_0x5116[_0x33450];return _0x43438a;};'use strict';var _=require(_0x6511('0x0'));var util=require(_0x6511('0x1'));var logger=require(_0x6511('0x2'))(_0x6511('0x3'));var moment=require(_0x6511('0x4'));var BPromise=require(_0x6511('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6511('0x6'));var rimraf=require(_0x6511('0x7'));var config=require(_0x6511('0x8'));var attributes=require(_0x6511('0x9'));module[_0x6511('0xa')]=function(_0x5101f7,_0x544adb){return _0x5101f7[_0x6511('0xb')](_0x6511('0xc'),attributes,{'tableName':_0x6511('0xd'),'paranoid':![],'indexes':[{'name':_0x6511('0xe'),'fields':[_0x6511('0xf'),_0x6511('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4ea=['SalesforceField','int_salesforce_fields','idField','FieldId','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define'];(function(_0x3f4414,_0x3258ae){var _0x1d7e34=function(_0x29eab4){while(--_0x29eab4){_0x3f4414['push'](_0x3f4414['shift']());}};_0x1d7e34(++_0x3258ae);}(_0xe4ea,0xba));var _0xae4e=function(_0x42bceb,_0x40aadc){_0x42bceb=_0x42bceb-0x0;var _0x58749d=_0xe4ea[_0x42bceb];return _0x58749d;};'use strict';var _=require(_0xae4e('0x0'));var util=require(_0xae4e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae4e('0x2'));var rp=require(_0xae4e('0x3'));var fs=require('fs');var path=require(_0xae4e('0x4'));var rimraf=require(_0xae4e('0x5'));var config=require(_0xae4e('0x6'));var attributes=require(_0xae4e('0x7'));module['exports']=function(_0x1ab35b,_0x1a8962){return _0x1ab35b[_0xae4e('0x8')](_0xae4e('0x9'),attributes,{'tableName':_0xae4e('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xae4e('0xb'),_0xae4e('0xc')],'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 9cc064c..0424891 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 _0x24cc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x24cc,0x89));var _0xc24c=function(_0x2c5ef4,_0x5ecf51){_0x2c5ef4=_0x2c5ef4-0x0;var _0x1cb4cc=_0x24cc[_0x2c5ef4];return _0x1cb4cc;};'use strict';var _=require(_0xc24c('0x0'));var util=require(_0xc24c('0x1'));var moment=require(_0xc24c('0x2'));var BPromise=require(_0xc24c('0x3'));var rs=require(_0xc24c('0x4'));var fs=require('fs');var Redis=require(_0xc24c('0x5'));var db=require(_0xc24c('0x6'))['db'];var utils=require(_0xc24c('0x7'));var logger=require(_0xc24c('0x8'))(_0xc24c('0x9'));var config=require(_0xc24c('0xa'));var jayson=require(_0xc24c('0xb'));var client=jayson[_0xc24c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb68b0e,_0x25cabb,_0x1254a2){return new BPromise(function(_0x268599,_0xfb8442){return client[_0xc24c('0xd')](_0xb68b0e,_0x1254a2)[_0xc24c('0xe')](function(_0x2c69d7){logger['info'](_0xc24c('0xf'),_0x25cabb,_0xc24c('0x10'));logger['debug'](_0xc24c('0x11'),_0x25cabb,_0xc24c('0x10'),JSON['stringify'](_0x2c69d7));if(_0x2c69d7[_0xc24c('0x12')]){if(_0x2c69d7[_0xc24c('0x12')][_0xc24c('0x13')]===0x1f4){logger[_0xc24c('0x12')](_0xc24c('0xf'),_0x25cabb,_0x2c69d7[_0xc24c('0x12')][_0xc24c('0x14')]);return _0xfb8442(_0x2c69d7['error'][_0xc24c('0x14')]);}logger[_0xc24c('0x12')]('SalesforceField,\x20%s,\x20%s',_0x25cabb,_0x2c69d7[_0xc24c('0x12')][_0xc24c('0x14')]);return _0x268599(_0x2c69d7[_0xc24c('0x12')][_0xc24c('0x14')]);}else{logger[_0xc24c('0x15')](_0xc24c('0xf'),_0x25cabb,'request\x20sent');_0x268599(_0x2c69d7[_0xc24c('0x16')][_0xc24c('0x14')]);}})['catch'](function(_0x37c839){logger[_0xc24c('0x12')](_0xc24c('0xf'),_0x25cabb,_0x37c839);_0xfb8442(_0x37c839);});});} \ No newline at end of file +var _0x2c3c=['info','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x54b6ea,_0x209202){var _0x209a28=function(_0x5a22e5){while(--_0x5a22e5){_0x54b6ea['push'](_0x54b6ea['shift']());}};_0x209a28(++_0x209202);}(_0x2c3c,0x153));var _0xc2c3=function(_0x4082d7,_0x963f0c){_0x4082d7=_0x4082d7-0x0;var _0x5a96d7=_0x2c3c[_0x4082d7];return _0x5a96d7;};'use strict';var _=require(_0xc2c3('0x0'));var util=require(_0xc2c3('0x1'));var moment=require(_0xc2c3('0x2'));var BPromise=require(_0xc2c3('0x3'));var rs=require(_0xc2c3('0x4'));var fs=require('fs');var Redis=require(_0xc2c3('0x5'));var db=require(_0xc2c3('0x6'))['db'];var utils=require(_0xc2c3('0x7'));var logger=require('../../config/logger')(_0xc2c3('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2c3('0x9'));var client=jayson[_0xc2c3('0xa')][_0xc2c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x77d4da,_0x2f6e03,_0x3891d8){return new BPromise(function(_0x5a8f01,_0xa4a84){return client[_0xc2c3('0xc')](_0x77d4da,_0x3891d8)['then'](function(_0x1b13ee){logger[_0xc2c3('0xd')]('SalesforceField,\x20%s,\x20%s',_0x2f6e03,_0xc2c3('0xe'));logger[_0xc2c3('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2f6e03,_0xc2c3('0xe'),JSON[_0xc2c3('0x10')](_0x1b13ee));if(_0x1b13ee['error']){if(_0x1b13ee[_0xc2c3('0x11')][_0xc2c3('0x12')]===0x1f4){logger['error'](_0xc2c3('0x13'),_0x2f6e03,_0x1b13ee[_0xc2c3('0x11')][_0xc2c3('0x14')]);return _0xa4a84(_0x1b13ee[_0xc2c3('0x11')][_0xc2c3('0x14')]);}logger[_0xc2c3('0x11')](_0xc2c3('0x13'),_0x2f6e03,_0x1b13ee[_0xc2c3('0x11')][_0xc2c3('0x14')]);return _0x5a8f01(_0x1b13ee[_0xc2c3('0x11')]['message']);}else{logger[_0xc2c3('0xd')](_0xc2c3('0x13'),_0x2f6e03,_0xc2c3('0xe'));_0x5a8f01(_0x1b13ee[_0xc2c3('0x15')][_0xc2c3('0x14')]);}})['catch'](function(_0x1d40dc){logger[_0xc2c3('0x11')](_0xc2c3('0x13'),_0x2f6e03,_0x1d40dc);_0xa4a84(_0x1d40dc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 72875e8..8e2627a 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 _0x9498=['getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x5b0e11,_0x390986){var _0x1f0b77=function(_0xc505f8){while(--_0xc505f8){_0x5b0e11['push'](_0x5b0e11['shift']());}};_0x1f0b77(++_0x390986);}(_0x9498,0x105));var _0x8949=function(_0x59a011,_0x332f15){_0x59a011=_0x59a011-0x0;var _0x3a7882=_0x9498[_0x59a011];return _0x3a7882;};'use strict';var multer=require(_0x8949('0x0'));var util=require(_0x8949('0x1'));var path=require(_0x8949('0x2'));var timeout=require(_0x8949('0x3'));var express=require(_0x8949('0x4'));var router=express[_0x8949('0x5')]();var fs_extra=require(_0x8949('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8949('0x7'));var config=require('../../config/environment');var controller=require(_0x8949('0x8'));router[_0x8949('0x9')]('/',auth[_0x8949('0xa')](),controller[_0x8949('0xb')]);router[_0x8949('0x9')](_0x8949('0xc'),auth[_0x8949('0xa')](),controller['show']);router[_0x8949('0x9')](_0x8949('0xd'),auth[_0x8949('0xa')](),controller[_0x8949('0xe')]);router['get']('/:id/fields',auth[_0x8949('0xa')](),controller[_0x8949('0xf')]);router[_0x8949('0x10')]('/',auth['isAuthenticated'](),controller[_0x8949('0x11')]);router['post'](_0x8949('0xd'),auth[_0x8949('0xa')](),controller['addConfiguration']);router[_0x8949('0x12')](_0x8949('0xc'),auth[_0x8949('0xa')](),controller[_0x8949('0x13')]);router[_0x8949('0x14')](_0x8949('0xc'),auth[_0x8949('0xa')](),controller[_0x8949('0x15')]);module[_0x8949('0x16')]=router; \ No newline at end of file +var _0x94c6=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x12954a,_0x304691){var _0x5ccde2=function(_0x5c3d68){while(--_0x5c3d68){_0x12954a['push'](_0x12954a['shift']());}};_0x5ccde2(++_0x304691);}(_0x94c6,0xa2));var _0x694c=function(_0x166882,_0x5c893e){_0x166882=_0x166882-0x0;var _0x1cb010=_0x94c6[_0x166882];return _0x1cb010;};'use strict';var multer=require(_0x694c('0x0'));var util=require(_0x694c('0x1'));var path=require(_0x694c('0x2'));var timeout=require(_0x694c('0x3'));var express=require(_0x694c('0x4'));var router=express[_0x694c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x694c('0x6'));var config=require('../../config/environment');var controller=require(_0x694c('0x7'));router[_0x694c('0x8')]('/',auth[_0x694c('0x9')](),controller[_0x694c('0xa')]);router[_0x694c('0x8')](_0x694c('0xb'),auth['isAuthenticated'](),controller[_0x694c('0xc')]);router['get'](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0xe')]);router['get'](_0x694c('0xf'),auth[_0x694c('0x9')](),controller[_0x694c('0x10')]);router['post']('/',auth[_0x694c('0x9')](),controller[_0x694c('0x11')]);router[_0x694c('0x12')](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0x13')]);router[_0x694c('0x14')](_0x694c('0xb'),auth[_0x694c('0x9')](),controller[_0x694c('0x15')]);router[_0x694c('0x16')](_0x694c('0xb'),auth[_0x694c('0x9')](),controller[_0x694c('0x17')]);module[_0x694c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2ad6b45..f1ee86a 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 _0x1322=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1322,0x10a));var _0x2132=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x1322[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0x2132('0x0'));module[_0x2132('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2132('0x2')]},'username':{'type':Sequelize[_0x2132('0x2')],'unique':_0x2132('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2132('0x2')],'unique':_0x2132('0x4')},'serverUrl':{'type':Sequelize[_0x2132('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe6eb=['sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6eb,0x8c));var _0xbe6e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe6eb[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xbe6e('0x0'));module[_0xbe6e('0x1')]={'name':{'type':Sequelize[_0xbe6e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbe6e('0x2')],'unique':_0xbe6e('0x3')},'password':{'type':Sequelize[_0xbe6e('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbe6e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7a71839..753b546 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 _0xa670=['../../components/integrations/configuration','sendStatus','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','error','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','options','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','getConfigurations','ServicenowConfiguration','filter','nolimit','addConfiguration','findOne','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','delivery_plan','impact','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','notify','close_notes','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','correlation_id','location','username','password','email','slice','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','push','all','log','remove','label','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x4b12ae,_0xf2b3b){var _0x16957b=function(_0x51932c){while(--_0x51932c){_0x4b12ae['push'](_0x4b12ae['shift']());}};_0x16957b(++_0xf2b3b);}(_0xa670,0x9a));var _0x0a67=function(_0x4203e9,_0x40b824){_0x4203e9=_0x4203e9-0x0;var _0x3f7a78=_0xa670[_0x4203e9];return _0x3f7a78;};'use strict';var emlformat=require(_0x0a67('0x0'));var rimraf=require(_0x0a67('0x1'));var zipdir=require(_0x0a67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a67('0x3'));var moment=require(_0x0a67('0x4'));var BPromise=require(_0x0a67('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0a67('0x6'));var csv=require(_0x0a67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a67('0x8'));var _=require('lodash');var squel=require(_0x0a67('0x9'));var crypto=require(_0x0a67('0xa'));var jsforce=require(_0x0a67('0xb'));var deskjs=require(_0x0a67('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0a67('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a67('0xe'));var qs=require(_0x0a67('0xf'));var as=require(_0x0a67('0x10'));var hardwareService=require(_0x0a67('0x11'));var logger=require(_0x0a67('0x12'))(_0x0a67('0x13'));var utils=require(_0x0a67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0a67('0x15'))['db'];var integrations=require(_0x0a67('0x16'));function respondWithStatusCode(_0x4c5ec7,_0x27a953){_0x27a953=_0x27a953||0xcc;return function(_0x42f1ac){if(_0x42f1ac){return _0x4c5ec7[_0x0a67('0x17')](_0x27a953);}return _0x4c5ec7['status'](_0x27a953)['end']();};}function respondWithResult(_0x4a0010,_0x26728b){_0x26728b=_0x26728b||0xc8;return function(_0x30d89d){if(_0x30d89d){return _0x4a0010['status'](_0x26728b)[_0x0a67('0x18')](_0x30d89d);}};}function respondWithFilteredResult(_0x18a19f,_0x5a8d50){return function(_0x4aea02){if(_0x4aea02){var _0x20d079=typeof _0x5a8d50[_0x0a67('0x19')]===_0x0a67('0x1a')&&typeof _0x5a8d50['limit']===_0x0a67('0x1a');var _0x49eeb3=_0x4aea02[_0x0a67('0x1b')];var _0xe7f57d=_0x20d079?0x0:_0x5a8d50[_0x0a67('0x19')];var _0x2623a4=_0x20d079?_0x4aea02[_0x0a67('0x1b')]:_0x5a8d50['offset']+_0x5a8d50['limit'];var _0x25aba3;if(_0x2623a4>=_0x49eeb3){_0x2623a4=_0x49eeb3;_0x25aba3=0xc8;}else{_0x25aba3=0xce;}_0x18a19f[_0x0a67('0x1c')](_0x25aba3);return _0x18a19f[_0x0a67('0x1d')](_0x0a67('0x1e'),_0xe7f57d+'-'+_0x2623a4+'/'+_0x49eeb3)['json'](_0x4aea02);}return null;};}function patchUpdates(_0x436d19){return function(_0x14707a){try{jsonpatch[_0x0a67('0x1f')](_0x14707a,_0x436d19,!![]);}catch(_0x281a6d){return BPromise[_0x0a67('0x20')](_0x281a6d);}return _0x14707a[_0x0a67('0x21')]();};}function saveUpdates(_0x26a0c2,_0x3beddc){return function(_0x25cf9a){if(_0x25cf9a){return _0x25cf9a[_0x0a67('0x22')](_0x26a0c2)['then'](function(_0x123fe4){return _0x123fe4;});}return null;};}function removeEntity(_0x27c7e2,_0x40a066){return function(_0x16f210){if(_0x16f210){return _0x16f210[_0x0a67('0x23')]()['then'](function(){_0x27c7e2[_0x0a67('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a311,_0xc8d048){return function(_0x436074){if(!_0x436074){_0x15a311[_0x0a67('0x17')](0x194);}return _0x436074;};}function handleError(_0xb7f3a5,_0x295e93){_0x295e93=_0x295e93||0x1f4;return function(_0x27a336){logger[_0x0a67('0x24')](_0x27a336['stack']);if(_0x27a336[_0x0a67('0x25')]){delete _0x27a336[_0x0a67('0x25')];}_0xb7f3a5['status'](_0x295e93)[_0x0a67('0x26')](_0x27a336);};}exports['index']=function(_0x30d80d,_0xd474df){var _0x270f69={},_0x5bb4f9={},_0x40d5fb={'count':0x0,'rows':[]};var _0x3d5bba=_[_0x0a67('0x27')](db[_0x0a67('0x28')][_0x0a67('0x29')],function(_0x20daa4){return{'name':_0x20daa4[_0x0a67('0x2a')],'type':_0x20daa4['type'][_0x0a67('0x2b')]};});_0x5bb4f9[_0x0a67('0x2c')]=_['map'](_0x3d5bba,'name');_0x5bb4f9[_0x0a67('0x2d')]=_[_0x0a67('0x2e')](_0x30d80d[_0x0a67('0x2d')]);_0x5bb4f9[_0x0a67('0x2f')]=_[_0x0a67('0x30')](_0x5bb4f9[_0x0a67('0x2c')],_0x5bb4f9['query']);_0x270f69[_0x0a67('0x31')]=_[_0x0a67('0x30')](_0x5bb4f9[_0x0a67('0x2c')],qs[_0x0a67('0x32')](_0x30d80d[_0x0a67('0x2d')]['fields']));_0x270f69['attributes']=_0x270f69['attributes'][_0x0a67('0x33')]?_0x270f69[_0x0a67('0x31')]:_0x5bb4f9[_0x0a67('0x2c')];if(!_0x30d80d[_0x0a67('0x2d')][_0x0a67('0x34')]('nolimit')){_0x270f69['limit']=qs[_0x0a67('0x35')](_0x30d80d[_0x0a67('0x2d')][_0x0a67('0x35')]);_0x270f69[_0x0a67('0x19')]=qs['offset'](_0x30d80d['query'][_0x0a67('0x19')]);}_0x270f69[_0x0a67('0x36')]=qs[_0x0a67('0x37')](_0x30d80d['query']['sort']);_0x270f69[_0x0a67('0x38')]=qs['filters'](_[_0x0a67('0x39')](_0x30d80d[_0x0a67('0x2d')],_0x5bb4f9[_0x0a67('0x2f')]),_0x3d5bba);if(_0x30d80d[_0x0a67('0x2d')]['filter']){_0x270f69[_0x0a67('0x38')]=_[_0x0a67('0x3a')](_0x270f69['where'],{'$or':_[_0x0a67('0x27')](_0x3d5bba,function(_0x5c868f){if(_0x5c868f['type']!=='VIRTUAL'){var _0x505f03={};_0x505f03[_0x5c868f[_0x0a67('0x25')]]={'$like':'%'+_0x30d80d['query']['filter']+'%'};return _0x505f03;}})});}_0x270f69=_[_0x0a67('0x3a')]({},_0x270f69,_0x30d80d[_0x0a67('0x3b')]);var _0x33951e={'where':_0x270f69[_0x0a67('0x38')]};return db[_0x0a67('0x28')][_0x0a67('0x1b')](_0x33951e)[_0x0a67('0x3c')](function(_0x382503){_0x40d5fb['count']=_0x382503;if(_0x30d80d[_0x0a67('0x2d')][_0x0a67('0x3d')]){_0x270f69[_0x0a67('0x3e')]=[{'all':!![]}];}return db[_0x0a67('0x28')][_0x0a67('0x3f')](_0x270f69);})[_0x0a67('0x3c')](function(_0x5b7409){_0x40d5fb[_0x0a67('0x40')]=_0x5b7409;return _0x40d5fb;})[_0x0a67('0x3c')](respondWithFilteredResult(_0xd474df,_0x270f69))['catch'](handleError(_0xd474df,null));};exports[_0x0a67('0x41')]=function(_0x170071,_0x5ec30a){var _0x59f025={'raw':![],'where':{'id':_0x170071[_0x0a67('0x42')]['id']}},_0x1a1040={};_0x1a1040[_0x0a67('0x2c')]=_[_0x0a67('0x2e')](db['ServicenowAccount'][_0x0a67('0x29')]);_0x1a1040[_0x0a67('0x2d')]=_[_0x0a67('0x2e')](_0x170071[_0x0a67('0x2d')]);_0x1a1040[_0x0a67('0x2f')]=_['intersection'](_0x1a1040['model'],_0x1a1040[_0x0a67('0x2d')]);_0x59f025[_0x0a67('0x31')]=_[_0x0a67('0x30')](_0x1a1040[_0x0a67('0x2c')],qs[_0x0a67('0x32')](_0x170071[_0x0a67('0x2d')][_0x0a67('0x32')]));_0x59f025[_0x0a67('0x31')]=_0x59f025['attributes'][_0x0a67('0x33')]?_0x59f025[_0x0a67('0x31')]:_0x1a1040['model'];if(_0x170071[_0x0a67('0x2d')]['includeAll']){_0x59f025[_0x0a67('0x3e')]=[{'all':!![]}];}_0x59f025=_[_0x0a67('0x3a')]({},_0x59f025,_0x170071[_0x0a67('0x3b')]);return db[_0x0a67('0x28')]['find'](_0x59f025)[_0x0a67('0x3c')](handleEntityNotFound(_0x5ec30a,null))[_0x0a67('0x3c')](respondWithResult(_0x5ec30a,null))['catch'](handleError(_0x5ec30a,null));};exports[_0x0a67('0x43')]=function(_0x3a1787,_0x969199){return db[_0x0a67('0x28')][_0x0a67('0x43')](_0x3a1787[_0x0a67('0x44')],{})[_0x0a67('0x3c')](respondWithResult(_0x969199,0xc9))[_0x0a67('0x45')](handleError(_0x969199,null));};exports[_0x0a67('0x22')]=function(_0x20db62,_0x20528a){if(_0x20db62['body']['id']){delete _0x20db62[_0x0a67('0x44')]['id'];}return db[_0x0a67('0x28')][_0x0a67('0x46')]({'where':{'id':_0x20db62[_0x0a67('0x42')]['id']}})[_0x0a67('0x3c')](handleEntityNotFound(_0x20528a,null))[_0x0a67('0x3c')](saveUpdates(_0x20db62[_0x0a67('0x44')],null))[_0x0a67('0x3c')](respondWithResult(_0x20528a,null))['catch'](handleError(_0x20528a,null));};exports[_0x0a67('0x23')]=function(_0x1b9c23,_0x2d48ea){return db[_0x0a67('0x28')]['find']({'where':{'id':_0x1b9c23['params']['id']}})['then'](handleEntityNotFound(_0x2d48ea,null))[_0x0a67('0x3c')](removeEntity(_0x2d48ea,null))['catch'](handleError(_0x2d48ea,null));};exports[_0x0a67('0x47')]=function(_0x59d615,_0x191f0f,_0x566392){var _0xf67a1d={};var _0x5ef955={};var _0x4a0170;var _0x484bee;return db[_0x0a67('0x28')]['findOne']({'where':{'id':_0x59d615[_0x0a67('0x42')]['id']}})[_0x0a67('0x3c')](handleEntityNotFound(_0x191f0f,null))['then'](function(_0x27ffd7){if(_0x27ffd7){_0x4a0170=_0x27ffd7;_0x5ef955[_0x0a67('0x2c')]=_['keys'](db[_0x0a67('0x48')]['rawAttributes']);_0x5ef955[_0x0a67('0x2d')]=_[_0x0a67('0x2e')](_0x59d615[_0x0a67('0x2d')]);_0x5ef955['filters']=_[_0x0a67('0x30')](_0x5ef955[_0x0a67('0x2c')],_0x5ef955[_0x0a67('0x2d')]);_0xf67a1d['attributes']=_[_0x0a67('0x30')](_0x5ef955[_0x0a67('0x2c')],qs['fields'](_0x59d615[_0x0a67('0x2d')][_0x0a67('0x32')]));_0xf67a1d[_0x0a67('0x31')]=_0xf67a1d[_0x0a67('0x31')][_0x0a67('0x33')]?_0xf67a1d[_0x0a67('0x31')]:_0x5ef955[_0x0a67('0x2c')];_0xf67a1d[_0x0a67('0x36')]=qs[_0x0a67('0x37')](_0x59d615[_0x0a67('0x2d')][_0x0a67('0x37')]);_0xf67a1d[_0x0a67('0x38')]=qs['filters'](_[_0x0a67('0x39')](_0x59d615[_0x0a67('0x2d')],_0x5ef955[_0x0a67('0x2f')]));if(_0x59d615[_0x0a67('0x2d')][_0x0a67('0x49')]){_0xf67a1d[_0x0a67('0x38')]=_[_0x0a67('0x3a')](_0xf67a1d[_0x0a67('0x38')],{'$or':_[_0x0a67('0x27')](_0xf67a1d[_0x0a67('0x31')],function(_0x78d52a){var _0x5f3b08={};_0x5f3b08[_0x78d52a]={'$like':'%'+_0x59d615['query'][_0x0a67('0x49')]+'%'};return _0x5f3b08;})});}_0xf67a1d=_['merge']({},_0xf67a1d,_0x59d615['options']);return _0x4a0170[_0x0a67('0x47')](_0xf67a1d);}})[_0x0a67('0x3c')](function(_0x54ffb8){if(_0x54ffb8){_0x484bee=_0x54ffb8['length'];if(!_0x59d615[_0x0a67('0x2d')][_0x0a67('0x34')](_0x0a67('0x4a'))){_0xf67a1d[_0x0a67('0x35')]=qs[_0x0a67('0x35')](_0x59d615[_0x0a67('0x2d')][_0x0a67('0x35')]);_0xf67a1d[_0x0a67('0x19')]=qs[_0x0a67('0x19')](_0x59d615[_0x0a67('0x2d')][_0x0a67('0x19')]);}return _0x4a0170['getConfigurations'](_0xf67a1d);}})[_0x0a67('0x3c')](function(_0x552873){if(_0x552873){return _0x552873?{'count':_0x484bee,'rows':_0x552873}:null;}})[_0x0a67('0x3c')](respondWithResult(_0x191f0f,null))['catch'](handleError(_0x191f0f,null));};exports[_0x0a67('0x4b')]=function(_0x2aaf42,_0x2ef13b,_0x24dafd){if(_0x2aaf42[_0x0a67('0x44')]['id']){delete _0x2aaf42['body']['id'];}return db['ServicenowAccount'][_0x0a67('0x4c')]({'where':{'id':_0x2aaf42[_0x0a67('0x42')]['id']}})[_0x0a67('0x3c')](handleEntityNotFound(_0x2ef13b,null))[_0x0a67('0x3c')](function(_0x209cf8){if(_0x209cf8){_0x2aaf42[_0x0a67('0x44')]['AccountId']=_0x209cf8['id'];_0x2aaf42[_0x0a67('0x44')][_0x0a67('0x4d')]=integrations[_0x0a67('0x4e')](_0x2aaf42[_0x0a67('0x44')][_0x0a67('0x4f')],_0x2aaf42[_0x0a67('0x44')][_0x0a67('0x50')]);_0x2aaf42[_0x0a67('0x44')][_0x0a67('0x51')]=integrations[_0x0a67('0x52')](_0x2aaf42['body'][_0x0a67('0x4f')],_0x2aaf42[_0x0a67('0x44')]['type']);return db['ServicenowConfiguration'][_0x0a67('0x43')](_0x2aaf42[_0x0a67('0x44')],{'include':[{'model':db[_0x0a67('0x53')],'as':_0x0a67('0x4d')},{'model':db[_0x0a67('0x53')],'as':_0x0a67('0x51')}]});}return null;})[_0x0a67('0x3c')](respondWithResult(_0x2ef13b,null))[_0x0a67('0x45')](handleError(_0x2ef13b,null));};exports[_0x0a67('0x54')]=function(_0x2ad778,_0x167b14,_0x30d904){var _0x1f1b44=[_0x0a67('0x55'),_0x0a67('0x56'),_0x0a67('0x57'),_0x0a67('0x58'),_0x0a67('0x59'),'notify',_0x0a67('0x5a'),_0x0a67('0x5b'),_0x0a67('0x5c')];var _0x31c10f=[_0x0a67('0x5d'),_0x0a67('0x55'),_0x0a67('0x5e'),_0x0a67('0x5f'),_0x0a67('0x60'),_0x0a67('0x61'),_0x0a67('0x62'),'hold_reason',_0x0a67('0x63'),'number',_0x0a67('0x64'),'sys_updated_by',_0x0a67('0x65'),_0x0a67('0x66'),_0x0a67('0x67'),_0x0a67('0x68'),_0x0a67('0x69'),'sys_created_by',_0x0a67('0x57'),_0x0a67('0x36'),_0x0a67('0x6a'),'closed_at','cmdb_ci',_0x0a67('0x6b'),_0x0a67('0x6c'),'active','work_notes_list','business_service',_0x0a67('0x6d'),_0x0a67('0x6e'),_0x0a67('0x6f'),_0x0a67('0x70'),_0x0a67('0x71'),_0x0a67('0x72'),'business_duration',_0x0a67('0x73'),_0x0a67('0x74'),_0x0a67('0x75'),_0x0a67('0x76'),_0x0a67('0x77'),_0x0a67('0x78'),_0x0a67('0x58'),_0x0a67('0x79'),_0x0a67('0x7a'),_0x0a67('0x59'),_0x0a67('0x7b'),'delivery_task','work_start',_0x0a67('0x7c'),'business_stc',_0x0a67('0x7d'),_0x0a67('0x7e'),_0x0a67('0x7f'),_0x0a67('0x80'),'sys_class_name',_0x0a67('0x81'),'closed_by',_0x0a67('0x82'),'parent_incident',_0x0a67('0x83'),_0x0a67('0x84'),_0x0a67('0x85'),_0x0a67('0x5a'),'urgency',_0x0a67('0x86'),_0x0a67('0x87'),_0x0a67('0x88'),'activity_due','assigned_to',_0x0a67('0x5b'),_0x0a67('0x89'),_0x0a67('0x8a'),_0x0a67('0x8b'),_0x0a67('0x8c'),_0x0a67('0x8d'),'sys_mod_count',_0x0a67('0x8e'),'sys_tags',_0x0a67('0x8f'),'upon_approval',_0x0a67('0x90'),_0x0a67('0x91'),_0x0a67('0x5c')];var _0x4f9ed9='';var _0x43b1f2='';var _0x2368a7=[];var _0x358f00='';var _0x54252d='';var _0x47c916=[];var _0x271f0a='';var _0x51dc6d='';var _0xb3391e={};var _0x1b2789='';return db[_0x0a67('0x28')][_0x0a67('0x4c')]({'where':{'id':_0x2ad778[_0x0a67('0x42')]['id']},'attributes':['id',_0x0a67('0x92'),_0x0a67('0x93'),_0x0a67('0x94'),'remoteUri','serverUrl']})[_0x0a67('0x3c')](handleEntityNotFound(_0x167b14,null))['then'](function(_0xf3cd46){if(_0xf3cd46){_0x1b2789=_0xf3cd46['remoteUri'];var _0x10a35e=_0x1b2789[_0x0a67('0x95')](-0x1);if(_0x10a35e==='/'){_0x1b2789=_0x1b2789[_0x0a67('0x96')](0x0,_0x1b2789['lastIndexOf'](_0x10a35e));}_0x51dc6d=util['format'](_0x0a67('0x97'),_0x1b2789);_0x271f0a=util['format'](_0x0a67('0x98'),_0x1b2789);_0xb3391e={'user':_0xf3cd46['username'],'pass':_0xf3cd46[_0x0a67('0x93')]};var _0x495de1={'method':_0x0a67('0x99'),'uri':_0x51dc6d+_0x0a67('0x9a'),'auth':_0xb3391e,'json':!![]};return rp(_0x495de1);}})[_0x0a67('0x3c')](function(_0x3d58f7){if(_0x3d58f7[_0x0a67('0x9b')]['length']>0x0){_0x4f9ed9=_0x3d58f7[_0x0a67('0x9b')];}console['log']('incident\x20table\x20objects',_0x4f9ed9);_0x47c916=[];_0x43b1f2=Object[_0x0a67('0x9c')]([],_0x4f9ed9);_['remove'](_0x43b1f2,function(_0x57bbd7){return!_0x1f1b44[_0x0a67('0x9d')](_0x57bbd7[_0x0a67('0x25')]);});_0x43b1f2[_0x0a67('0x9e')](function(_0x5c01a4){var _0x5b5ad3=createFieldObject(_0x271f0a,_0xb3391e,_0x5c01a4['internalType'],_0x5c01a4[_0x0a67('0x25')],_0x5c01a4['label'],![]);_0x47c916[_0x0a67('0x9f')](_0x5b5ad3);});return Promise[_0x0a67('0xa0')](_0x47c916);})[_0x0a67('0x3c')](function(_0x456748){_0x2368a7=_0x456748;_0x358f00=Object[_0x0a67('0x9c')]([],_0x4f9ed9);console[_0x0a67('0xa1')]('TCL:\x20_object',_0x4f9ed9);_[_0x0a67('0xa2')](_0x358f00,function(_0x55d674){return _0x31c10f['includes'](_0x55d674[_0x0a67('0x25')]);});console[_0x0a67('0xa1')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x358f00);_0x47c916=[];_0x358f00[_0x0a67('0x9e')](function(_0x14c846){var _0x224285=createFieldObject(_0x271f0a,_0xb3391e,_0x14c846['internalType'],_0x14c846[_0x0a67('0x25')],_0x14c846[_0x0a67('0xa3')],!![]);_0x47c916[_0x0a67('0x9f')](_0x224285);});return Promise[_0x0a67('0xa0')](_0x47c916);})[_0x0a67('0x3c')](function(_0x33e37f){_0x54252d=_0x33e37f;var _0x4701cf=_0x2368a7[_0x0a67('0xa4')](_0x54252d);return{'count':_0x4701cf[_0x0a67('0x33')],'rows':_0x4701cf};})[_0x0a67('0x3c')](respondWithResult(_0x167b14,null))[_0x0a67('0x45')](function(_0x193808){console[_0x0a67('0xa1')](_0x0a67('0xa5')+_0x193808);var _0x4dd9ad=_0x2ad778[_0x0a67('0x2d')][_0x0a67('0xa6')]?0x1f4:_0x193808[_0x0a67('0xa7')]||0x1f4;logger[_0x0a67('0x24')](_0x193808['stack']);delete _0x193808[_0x0a67('0x25')];if(_0x4dd9ad===0x191){_0x4dd9ad=0x190;}_0x167b14['status'](_0x4dd9ad)[_0x0a67('0x26')](_0x2ad778[_0x0a67('0x2d')]['test']?{'message':_0x0a67('0xa8'),'statusCode':_0x193808['statusCode']}:_0x193808);});};function createFieldObject(_0x6aaabd,_0x459ce5,_0x52b9fb,_0x2383e4,_0x376e2f,_0x5b3513){return new Promise(function(_0x1bbdf9,_0x1d706b){var _0x5ab9da={'id':_0x2383e4,'name':_0x376e2f,'custom':_0x5b3513};if(_0x52b9fb===_0x0a67('0xa9')){_0x5ab9da[_0x0a67('0x3b')]=[{'name':_0x0a67('0xaa'),'value':_0x0a67('0xab')},{'name':'False','value':_0x0a67('0xac')}];_0x1bbdf9(_0x5ab9da);}else{var _0x23ecc3={'method':'GET','uri':_0x6aaabd+_0x0a67('0xad')+_0x2383e4,'auth':_0x459ce5,'json':!![]};return rp(_0x23ecc3)[_0x0a67('0x3c')](function(_0x2c2f2d){var _0x23fd27=[];if(_0x2c2f2d[_0x0a67('0x9b')][_0x0a67('0x33')]>0x0){_0x2c2f2d['result'][_0x0a67('0x9e')](function(_0x18967b){if(_0x18967b[_0x0a67('0xae')]==='false'){var _0x908b04={'name':_0x18967b[_0x0a67('0xa3')],'value':_0x18967b[_0x0a67('0xaf')]};_0x23fd27['push'](_0x908b04);}});}_0x5ab9da[_0x0a67('0x3b')]=_0x23fd27;if(_0x5ab9da[_0x0a67('0x3b')][_0x0a67('0x33')]>0x0){_0x1bbdf9(_0x5ab9da);}else{if(_0x5b3513==![]){_0x1bbdf9();}else{_0x1bbdf9(_0x5ab9da);}}});}});} \ No newline at end of file +var _0x80b1=['type','Descriptions','getDescriptions','channel','ServicenowField','getFields','hold_reason','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','subcategory','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','sys_id','contact_type','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','correlation_id','username','email','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','internalType','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','ServiceNow\x20error:\x20','statusCode','test','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x1559f8,_0x145114){var _0x14347d=function(_0x25436d){while(--_0x25436d){_0x1559f8['push'](_0x1559f8['shift']());}};_0x14347d(++_0x145114);}(_0x80b1,0x11b));var _0x180b=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0x80b1[_0x828160];return _0x296b5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x180b('0x0'));var zipdir=require(_0x180b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x180b('0x2'));var moment=require(_0x180b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x180b('0x4'));var path=require(_0x180b('0x5'));var sox=require('sox');var csv=require(_0x180b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x180b('0x7'));var _=require(_0x180b('0x8'));var squel=require(_0x180b('0x9'));var crypto=require(_0x180b('0xa'));var jsforce=require(_0x180b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x180b('0x6'));var querystring=require(_0x180b('0xc'));var Papa=require('papaparse');var Redis=require(_0x180b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x180b('0xe'));var hardwareService=require(_0x180b('0xf'));var logger=require(_0x180b('0x10'))('api');var utils=require(_0x180b('0x11'));var config=require(_0x180b('0x12'));var licenseUtil=require(_0x180b('0x13'));var db=require(_0x180b('0x14'))['db'];var integrations=require(_0x180b('0x15'));function respondWithStatusCode(_0x6d98c1,_0x538da1){_0x538da1=_0x538da1||0xcc;return function(_0x179d33){if(_0x179d33){return _0x6d98c1['sendStatus'](_0x538da1);}return _0x6d98c1[_0x180b('0x16')](_0x538da1)['end']();};}function respondWithResult(_0x1e08e5,_0x4e856e){_0x4e856e=_0x4e856e||0xc8;return function(_0x3770c4){if(_0x3770c4){return _0x1e08e5['status'](_0x4e856e)['json'](_0x3770c4);}};}function respondWithFilteredResult(_0x4ab21d,_0x66972c){return function(_0x4f921f){if(_0x4f921f){var _0x2aa427=typeof _0x66972c[_0x180b('0x17')]===_0x180b('0x18')&&typeof _0x66972c[_0x180b('0x19')]===_0x180b('0x18');var _0xab11c6=_0x4f921f['count'];var _0x491904=_0x2aa427?0x0:_0x66972c[_0x180b('0x17')];var _0x4d1e6d=_0x2aa427?_0x4f921f[_0x180b('0x1a')]:_0x66972c[_0x180b('0x17')]+_0x66972c[_0x180b('0x19')];var _0x457621;if(_0x4d1e6d>=_0xab11c6){_0x4d1e6d=_0xab11c6;_0x457621=0xc8;}else{_0x457621=0xce;}_0x4ab21d[_0x180b('0x16')](_0x457621);return _0x4ab21d[_0x180b('0x1b')](_0x180b('0x1c'),_0x491904+'-'+_0x4d1e6d+'/'+_0xab11c6)['json'](_0x4f921f);}return null;};}function patchUpdates(_0x43e296){return function(_0x193d47){try{jsonpatch[_0x180b('0x1d')](_0x193d47,_0x43e296,!![]);}catch(_0x56b964){return BPromise[_0x180b('0x1e')](_0x56b964);}return _0x193d47['save']();};}function saveUpdates(_0x1b46aa,_0x31681d){return function(_0x28f5fb){if(_0x28f5fb){return _0x28f5fb[_0x180b('0x1f')](_0x1b46aa)[_0x180b('0x20')](function(_0x3c9349){return _0x3c9349;});}return null;};}function removeEntity(_0x32e9fc,_0x3b994b){return function(_0x5b1586){if(_0x5b1586){return _0x5b1586['destroy']()[_0x180b('0x20')](function(){_0x32e9fc['status'](0xcc)[_0x180b('0x21')]();});}};}function handleEntityNotFound(_0x3edf92,_0x2270e4){return function(_0x5de9e9){if(!_0x5de9e9){_0x3edf92['sendStatus'](0x194);}return _0x5de9e9;};}function handleError(_0x24b26e,_0x5f32d7){_0x5f32d7=_0x5f32d7||0x1f4;return function(_0xa13df4){logger['error'](_0xa13df4[_0x180b('0x22')]);if(_0xa13df4[_0x180b('0x23')]){delete _0xa13df4[_0x180b('0x23')];}_0x24b26e[_0x180b('0x16')](_0x5f32d7)[_0x180b('0x24')](_0xa13df4);};}exports['index']=function(_0x1df912,_0x51b806){var _0x48c8b2={},_0x547dd3={},_0x5a06d8={'count':0x0,'rows':[]};var _0x36696c=_[_0x180b('0x25')](db[_0x180b('0x26')][_0x180b('0x27')],function(_0x1460f1){return{'name':_0x1460f1[_0x180b('0x28')],'type':_0x1460f1['type'][_0x180b('0x29')]};});_0x547dd3['model']=_[_0x180b('0x25')](_0x36696c,_0x180b('0x23'));_0x547dd3[_0x180b('0x2a')]=_[_0x180b('0x2b')](_0x1df912[_0x180b('0x2a')]);_0x547dd3['filters']=_['intersection'](_0x547dd3[_0x180b('0x2c')],_0x547dd3['query']);_0x48c8b2[_0x180b('0x2d')]=_[_0x180b('0x2e')](_0x547dd3[_0x180b('0x2c')],qs['fields'](_0x1df912[_0x180b('0x2a')][_0x180b('0x2f')]));_0x48c8b2['attributes']=_0x48c8b2[_0x180b('0x2d')][_0x180b('0x30')]?_0x48c8b2[_0x180b('0x2d')]:_0x547dd3[_0x180b('0x2c')];if(!_0x1df912[_0x180b('0x2a')][_0x180b('0x31')](_0x180b('0x32'))){_0x48c8b2[_0x180b('0x19')]=qs['limit'](_0x1df912[_0x180b('0x2a')][_0x180b('0x19')]);_0x48c8b2[_0x180b('0x17')]=qs['offset'](_0x1df912[_0x180b('0x2a')][_0x180b('0x17')]);}_0x48c8b2[_0x180b('0x33')]=qs[_0x180b('0x34')](_0x1df912['query']['sort']);_0x48c8b2[_0x180b('0x35')]=qs[_0x180b('0x36')](_['pick'](_0x1df912[_0x180b('0x2a')],_0x547dd3[_0x180b('0x36')]),_0x36696c);if(_0x1df912[_0x180b('0x2a')][_0x180b('0x37')]){_0x48c8b2[_0x180b('0x35')]=_['merge'](_0x48c8b2[_0x180b('0x35')],{'$or':_[_0x180b('0x25')](_0x36696c,function(_0x251cf9){if(_0x251cf9['type']!==_0x180b('0x38')){var _0x5c78b0={};_0x5c78b0[_0x251cf9[_0x180b('0x23')]]={'$like':'%'+_0x1df912['query'][_0x180b('0x37')]+'%'};return _0x5c78b0;}})});}_0x48c8b2=_[_0x180b('0x39')]({},_0x48c8b2,_0x1df912['options']);var _0x2522cb={'where':_0x48c8b2[_0x180b('0x35')]};return db[_0x180b('0x26')][_0x180b('0x1a')](_0x2522cb)[_0x180b('0x20')](function(_0xc1766c){_0x5a06d8[_0x180b('0x1a')]=_0xc1766c;if(_0x1df912[_0x180b('0x2a')][_0x180b('0x3a')]){_0x48c8b2[_0x180b('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x180b('0x3c')](_0x48c8b2);})[_0x180b('0x20')](function(_0x5be956){_0x5a06d8['rows']=_0x5be956;return _0x5a06d8;})[_0x180b('0x20')](respondWithFilteredResult(_0x51b806,_0x48c8b2))[_0x180b('0x3d')](handleError(_0x51b806,null));};exports[_0x180b('0x3e')]=function(_0x24488e,_0x41d10){var _0x3d44de={'raw':![],'where':{'id':_0x24488e[_0x180b('0x3f')]['id']}},_0x33b8fa={};_0x33b8fa[_0x180b('0x2c')]=_[_0x180b('0x2b')](db[_0x180b('0x26')][_0x180b('0x27')]);_0x33b8fa['query']=_[_0x180b('0x2b')](_0x24488e[_0x180b('0x2a')]);_0x33b8fa[_0x180b('0x36')]=_['intersection'](_0x33b8fa[_0x180b('0x2c')],_0x33b8fa[_0x180b('0x2a')]);_0x3d44de[_0x180b('0x2d')]=_['intersection'](_0x33b8fa[_0x180b('0x2c')],qs[_0x180b('0x2f')](_0x24488e['query']['fields']));_0x3d44de[_0x180b('0x2d')]=_0x3d44de['attributes'][_0x180b('0x30')]?_0x3d44de[_0x180b('0x2d')]:_0x33b8fa['model'];if(_0x24488e[_0x180b('0x2a')]['includeAll']){_0x3d44de['include']=[{'all':!![]}];}_0x3d44de=_['merge']({},_0x3d44de,_0x24488e[_0x180b('0x40')]);return db[_0x180b('0x26')][_0x180b('0x41')](_0x3d44de)[_0x180b('0x20')](handleEntityNotFound(_0x41d10,null))[_0x180b('0x20')](respondWithResult(_0x41d10,null))[_0x180b('0x3d')](handleError(_0x41d10,null));};exports[_0x180b('0x42')]=function(_0x3af7a5,_0x357463){return db[_0x180b('0x26')][_0x180b('0x42')](_0x3af7a5['body'],{})[_0x180b('0x20')](respondWithResult(_0x357463,0xc9))[_0x180b('0x3d')](handleError(_0x357463,null));};exports['update']=function(_0xa155d6,_0x3cf140){if(_0xa155d6[_0x180b('0x43')]['id']){delete _0xa155d6[_0x180b('0x43')]['id'];}return db[_0x180b('0x26')][_0x180b('0x41')]({'where':{'id':_0xa155d6[_0x180b('0x3f')]['id']}})[_0x180b('0x20')](handleEntityNotFound(_0x3cf140,null))[_0x180b('0x20')](saveUpdates(_0xa155d6[_0x180b('0x43')],null))[_0x180b('0x20')](respondWithResult(_0x3cf140,null))[_0x180b('0x3d')](handleError(_0x3cf140,null));};exports[_0x180b('0x44')]=function(_0x4de749,_0x502c28){return db['ServicenowAccount'][_0x180b('0x41')]({'where':{'id':_0x4de749[_0x180b('0x3f')]['id']}})[_0x180b('0x20')](handleEntityNotFound(_0x502c28,null))[_0x180b('0x20')](removeEntity(_0x502c28,null))[_0x180b('0x3d')](handleError(_0x502c28,null));};exports['getConfigurations']=function(_0x5e1f19,_0xbac111,_0x4139ac){var _0x28182a={};var _0x5d6199={};var _0xe38fb3;var _0x4a707b;return db['ServicenowAccount'][_0x180b('0x45')]({'where':{'id':_0x5e1f19[_0x180b('0x3f')]['id']}})[_0x180b('0x20')](handleEntityNotFound(_0xbac111,null))[_0x180b('0x20')](function(_0x58cc69){if(_0x58cc69){_0xe38fb3=_0x58cc69;_0x5d6199[_0x180b('0x2c')]=_[_0x180b('0x2b')](db[_0x180b('0x46')][_0x180b('0x27')]);_0x5d6199['query']=_[_0x180b('0x2b')](_0x5e1f19['query']);_0x5d6199[_0x180b('0x36')]=_[_0x180b('0x2e')](_0x5d6199[_0x180b('0x2c')],_0x5d6199['query']);_0x28182a['attributes']=_[_0x180b('0x2e')](_0x5d6199[_0x180b('0x2c')],qs[_0x180b('0x2f')](_0x5e1f19[_0x180b('0x2a')][_0x180b('0x2f')]));_0x28182a['attributes']=_0x28182a['attributes'][_0x180b('0x30')]?_0x28182a[_0x180b('0x2d')]:_0x5d6199[_0x180b('0x2c')];_0x28182a[_0x180b('0x33')]=qs['sort'](_0x5e1f19[_0x180b('0x2a')][_0x180b('0x34')]);_0x28182a[_0x180b('0x35')]=qs['filters'](_[_0x180b('0x47')](_0x5e1f19[_0x180b('0x2a')],_0x5d6199[_0x180b('0x36')]));if(_0x5e1f19[_0x180b('0x2a')][_0x180b('0x37')]){_0x28182a['where']=_[_0x180b('0x39')](_0x28182a['where'],{'$or':_[_0x180b('0x25')](_0x28182a[_0x180b('0x2d')],function(_0x3c689d){var _0x5ac007={};_0x5ac007[_0x3c689d]={'$like':'%'+_0x5e1f19[_0x180b('0x2a')]['filter']+'%'};return _0x5ac007;})});}_0x28182a=_[_0x180b('0x39')]({},_0x28182a,_0x5e1f19[_0x180b('0x40')]);return _0xe38fb3[_0x180b('0x48')](_0x28182a);}})[_0x180b('0x20')](function(_0x4f9196){if(_0x4f9196){_0x4a707b=_0x4f9196['length'];if(!_0x5e1f19[_0x180b('0x2a')]['hasOwnProperty'](_0x180b('0x32'))){_0x28182a[_0x180b('0x19')]=qs[_0x180b('0x19')](_0x5e1f19['query']['limit']);_0x28182a[_0x180b('0x17')]=qs[_0x180b('0x17')](_0x5e1f19['query']['offset']);}return _0xe38fb3[_0x180b('0x48')](_0x28182a);}})[_0x180b('0x20')](function(_0x58c6ae){if(_0x58c6ae){return _0x58c6ae?{'count':_0x4a707b,'rows':_0x58c6ae}:null;}})[_0x180b('0x20')](respondWithResult(_0xbac111,null))[_0x180b('0x3d')](handleError(_0xbac111,null));};exports[_0x180b('0x49')]=function(_0x4ab411,_0x4999b4,_0x29ac1e){if(_0x4ab411[_0x180b('0x43')]['id']){delete _0x4ab411['body']['id'];}return db[_0x180b('0x26')][_0x180b('0x45')]({'where':{'id':_0x4ab411[_0x180b('0x3f')]['id']}})[_0x180b('0x20')](handleEntityNotFound(_0x4999b4,null))[_0x180b('0x20')](function(_0x569091){if(_0x569091){_0x4ab411[_0x180b('0x43')][_0x180b('0x4a')]=_0x569091['id'];_0x4ab411[_0x180b('0x43')][_0x180b('0x4b')]=integrations[_0x180b('0x4c')](_0x4ab411[_0x180b('0x43')]['channel'],_0x4ab411[_0x180b('0x43')][_0x180b('0x4d')]);_0x4ab411[_0x180b('0x43')][_0x180b('0x4e')]=integrations[_0x180b('0x4f')](_0x4ab411[_0x180b('0x43')][_0x180b('0x50')],_0x4ab411['body'][_0x180b('0x4d')]);return db[_0x180b('0x46')]['create'](_0x4ab411[_0x180b('0x43')],{'include':[{'model':db['ServicenowField'],'as':_0x180b('0x4b')},{'model':db[_0x180b('0x51')],'as':_0x180b('0x4e')}]});}return null;})[_0x180b('0x20')](respondWithResult(_0x4999b4,null))[_0x180b('0x3d')](handleError(_0x4999b4,null));};exports[_0x180b('0x52')]=function(_0x3f5b20,_0x227bab,_0x5f0e03){var _0x2703d5=['made_sla',_0x180b('0x53'),'knowledge','subcategory',_0x180b('0x54'),_0x180b('0x55'),_0x180b('0x56'),_0x180b('0x57'),_0x180b('0x58')];var _0x11737c=['parent','made_sla',_0x180b('0x59'),_0x180b('0x5a'),_0x180b('0x5b'),_0x180b('0x5c'),'child_incidents',_0x180b('0x53'),_0x180b('0x5d'),_0x180b('0x5e'),_0x180b('0x5f'),_0x180b('0x60'),'opened_by',_0x180b('0x61'),'sys_created_on',_0x180b('0x62'),_0x180b('0x63'),_0x180b('0x64'),'knowledge',_0x180b('0x33'),_0x180b('0x65'),_0x180b('0x66'),'cmdb_ci',_0x180b('0x67'),_0x180b('0x68'),_0x180b('0x69'),_0x180b('0x6a'),_0x180b('0x6b'),_0x180b('0x6c'),'sys_domain_path',_0x180b('0x6d'),_0x180b('0x6e'),_0x180b('0x6f'),_0x180b('0x70'),'business_duration',_0x180b('0x71'),_0x180b('0x72'),_0x180b('0x73'),_0x180b('0x74'),'caller_id','approval_set',_0x180b('0x75'),_0x180b('0x76'),_0x180b('0x77'),_0x180b('0x54'),'correlation_display',_0x180b('0x78'),_0x180b('0x79'),_0x180b('0x7a'),_0x180b('0x7b'),_0x180b('0x7c'),_0x180b('0x7d'),_0x180b('0x7e'),_0x180b('0x55'),_0x180b('0x7f'),'close_notes',_0x180b('0x80'),_0x180b('0x81'),'parent_incident',_0x180b('0x82'),_0x180b('0x83'),'reopened_by',_0x180b('0x56'),'urgency',_0x180b('0x84'),_0x180b('0x85'),_0x180b('0x86'),_0x180b('0x87'),_0x180b('0x88'),'severity',_0x180b('0x89'),_0x180b('0x8a'),_0x180b('0x8b'),_0x180b('0x8c'),_0x180b('0x8d'),'sys_mod_count',_0x180b('0x8e'),_0x180b('0x8f'),'escalation',_0x180b('0x90'),_0x180b('0x91'),'location','category'];var _0x5d0299='';var _0x2bccdb='';var _0xb1fb88=[];var _0x21b446='';var _0x11edcd='';var _0xf4385=[];var _0x29f836='';var _0x583406='';var _0x545fa2={};var _0x5e0f9d='';return db[_0x180b('0x26')][_0x180b('0x45')]({'where':{'id':_0x3f5b20[_0x180b('0x3f')]['id']},'attributes':['id',_0x180b('0x92'),'password',_0x180b('0x93'),_0x180b('0x94'),'serverUrl']})[_0x180b('0x20')](handleEntityNotFound(_0x227bab,null))[_0x180b('0x20')](function(_0x2d16ec){if(_0x2d16ec){_0x5e0f9d=_0x2d16ec[_0x180b('0x94')];var _0x16a1b1=_0x5e0f9d[_0x180b('0x95')](-0x1);if(_0x16a1b1==='/'){_0x5e0f9d=_0x5e0f9d['substring'](0x0,_0x5e0f9d[_0x180b('0x96')](_0x16a1b1));}_0x583406=util[_0x180b('0x97')](_0x180b('0x98'),_0x5e0f9d);_0x29f836=util[_0x180b('0x97')](_0x180b('0x99'),_0x5e0f9d);_0x545fa2={'user':_0x2d16ec[_0x180b('0x92')],'pass':_0x2d16ec[_0x180b('0x9a')]};var _0x455efb={'method':'GET','uri':_0x583406+_0x180b('0x9b'),'auth':_0x545fa2,'json':!![]};return rp(_0x455efb);}})[_0x180b('0x20')](function(_0x4a075b){if(_0x4a075b[_0x180b('0x9c')][_0x180b('0x30')]>0x0){_0x5d0299=_0x4a075b['result'];}console[_0x180b('0x9d')](_0x180b('0x9e'),_0x5d0299);_0xf4385=[];_0x2bccdb=Object[_0x180b('0x9f')]([],_0x5d0299);_['remove'](_0x2bccdb,function(_0x4b4700){return!_0x2703d5[_0x180b('0xa0')](_0x4b4700[_0x180b('0x23')]);});_0x2bccdb['forEach'](function(_0x310999){var _0x5630aa=createFieldObject(_0x29f836,_0x545fa2,_0x310999[_0x180b('0xa1')],_0x310999[_0x180b('0x23')],_0x310999[_0x180b('0xa2')],![]);_0xf4385['push'](_0x5630aa);});return Promise[_0x180b('0xa3')](_0xf4385);})[_0x180b('0x20')](function(_0xd6afdc){_0xb1fb88=_0xd6afdc;_0x21b446=Object['assign']([],_0x5d0299);console[_0x180b('0x9d')](_0x180b('0xa4'),_0x5d0299);_[_0x180b('0xa5')](_0x21b446,function(_0x3e7c49){return _0x11737c[_0x180b('0xa0')](_0x3e7c49[_0x180b('0x23')]);});console[_0x180b('0x9d')](_0x180b('0xa6'),_0x21b446);_0xf4385=[];_0x21b446[_0x180b('0xa7')](function(_0x58f46e){var _0x1ad1e6=createFieldObject(_0x29f836,_0x545fa2,_0x58f46e[_0x180b('0xa1')],_0x58f46e[_0x180b('0x23')],_0x58f46e[_0x180b('0xa2')],!![]);_0xf4385['push'](_0x1ad1e6);});return Promise['all'](_0xf4385);})['then'](function(_0x66d972){_0x11edcd=_0x66d972;var _0x37a2ae=_0xb1fb88['concat'](_0x11edcd);return{'count':_0x37a2ae[_0x180b('0x30')],'rows':_0x37a2ae};})[_0x180b('0x20')](respondWithResult(_0x227bab,null))[_0x180b('0x3d')](function(_0x6c46f1){console[_0x180b('0x9d')](_0x180b('0xa8')+_0x6c46f1);var _0x57257f=_0x3f5b20[_0x180b('0x2a')]['test']?0x1f4:_0x6c46f1[_0x180b('0xa9')]||0x1f4;logger['error'](_0x6c46f1[_0x180b('0x22')]);delete _0x6c46f1[_0x180b('0x23')];if(_0x57257f===0x191){_0x57257f=0x190;}_0x227bab['status'](_0x57257f)['send'](_0x3f5b20[_0x180b('0x2a')][_0x180b('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x6c46f1[_0x180b('0xa9')]}:_0x6c46f1);});};function createFieldObject(_0x4e4d50,_0x1c7a2c,_0x533375,_0x36e050,_0x5650e4,_0x5c01b4){return new Promise(function(_0x4ff922,_0x38d17d){var _0x4096db={'id':_0x36e050,'name':_0x5650e4,'custom':_0x5c01b4};if(_0x533375===_0x180b('0xab')){_0x4096db[_0x180b('0x40')]=[{'name':'True','value':_0x180b('0xac')},{'name':_0x180b('0xad'),'value':_0x180b('0xae')}];_0x4ff922(_0x4096db);}else{var _0x488fe7={'method':_0x180b('0xaf'),'uri':_0x4e4d50+_0x180b('0xb0')+_0x36e050,'auth':_0x1c7a2c,'json':!![]};return rp(_0x488fe7)[_0x180b('0x20')](function(_0x4cfdb3){var _0x256404=[];if(_0x4cfdb3['result'][_0x180b('0x30')]>0x0){_0x4cfdb3[_0x180b('0x9c')][_0x180b('0xa7')](function(_0x14c754){if(_0x14c754[_0x180b('0xb1')]===_0x180b('0xae')){var _0xef935a={'name':_0x14c754[_0x180b('0xa2')],'value':_0x14c754[_0x180b('0xb2')]};_0x256404[_0x180b('0xb3')](_0xef935a);}});}_0x4096db[_0x180b('0x40')]=_0x256404;if(_0x4096db[_0x180b('0x40')][_0x180b('0x30')]>0x0){_0x4ff922(_0x4096db);}else{if(_0x5c01b4==![]){_0x4ff922();}else{_0x4ff922(_0x4096db);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 14c76be..f581917 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 _0x1623=['path','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x3e4f85,_0x2d7347){var _0x4bd0dc=function(_0x41937d){while(--_0x41937d){_0x3e4f85['push'](_0x3e4f85['shift']());}};_0x4bd0dc(++_0x2d7347);}(_0x1623,0xab));var _0x3162=function(_0x1332e2,_0x11a7e8){_0x1332e2=_0x1332e2-0x0;var _0x1dcd54=_0x1623[_0x1332e2];return _0x1dcd54;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts'];(function(_0x3dc2a9,_0x2cb428){var _0x282624=function(_0x66f19f){while(--_0x66f19f){_0x3dc2a9['push'](_0x3dc2a9['shift']());}};_0x282624(++_0x2cb428);}(_0x1261,0x144));var _0x1126=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0x1261[_0xc1263e];return _0x471f07;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x40ba58,_0x907180){return _0x40ba58['define'](_0x1126('0xa'),attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 0dd04a1..3906266 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 _0x5a11=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','findAll','options','raw','where','attributes','include','map','model','catch','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xde9512,_0x1e359c){var _0x2d755f=function(_0x18415d){while(--_0x18415d){_0xde9512['push'](_0xde9512['shift']());}};_0x2d755f(++_0x1e359c);}(_0x5a11,0xf2));var _0x15a1=function(_0x5b54ca,_0x5ba132){_0x5b54ca=_0x5b54ca-0x0;var _0x1a56b2=_0x5a11[_0x5b54ca];return _0x1a56b2;};'use strict';var _=require(_0x15a1('0x0'));var util=require(_0x15a1('0x1'));var moment=require(_0x15a1('0x2'));var BPromise=require(_0x15a1('0x3'));var rs=require(_0x15a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15a1('0x5'))['db'];var utils=require(_0x15a1('0x6'));var logger=require(_0x15a1('0x7'))(_0x15a1('0x8'));var config=require('../../config/environment');var jayson=require(_0x15a1('0x9'));var client=jayson[_0x15a1('0xa')][_0x15a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x411480,_0x4c40b0,_0x533ef9){return new BPromise(function(_0x3f5d3f,_0x2ce4e8){return client[_0x15a1('0xc')](_0x411480,_0x533ef9)[_0x15a1('0xd')](function(_0x543e25){logger[_0x15a1('0xe')](_0x15a1('0xf'),_0x4c40b0,_0x15a1('0x10'));logger[_0x15a1('0x11')](_0x15a1('0x12'),_0x4c40b0,_0x15a1('0x10'),JSON[_0x15a1('0x13')](_0x543e25));if(_0x543e25[_0x15a1('0x14')]){if(_0x543e25[_0x15a1('0x14')][_0x15a1('0x15')]===0x1f4){logger[_0x15a1('0x14')](_0x15a1('0xf'),_0x4c40b0,_0x543e25[_0x15a1('0x14')][_0x15a1('0x16')]);return _0x2ce4e8(_0x543e25[_0x15a1('0x14')][_0x15a1('0x16')]);}logger[_0x15a1('0x14')](_0x15a1('0xf'),_0x4c40b0,_0x543e25['error'][_0x15a1('0x16')]);return _0x3f5d3f(_0x543e25[_0x15a1('0x14')]['message']);}else{logger['info'](_0x15a1('0xf'),_0x4c40b0,_0x15a1('0x10'));_0x3f5d3f(_0x543e25[_0x15a1('0x17')][_0x15a1('0x16')]);}})['catch'](function(_0x46ad57){logger[_0x15a1('0x14')](_0x15a1('0xf'),_0x4c40b0,_0x46ad57);_0x2ce4e8(_0x46ad57);});});}exports[_0x15a1('0x18')]=function(_0x273701){var _0x524bd9=this;return new Promise(function(_0x21b98a,_0x5bd5c5){return db['ServicenowAccount'][_0x15a1('0x19')]({'raw':_0x273701[_0x15a1('0x1a')]?_0x273701[_0x15a1('0x1a')][_0x15a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x273701['options']?_0x273701[_0x15a1('0x1a')][_0x15a1('0x1c')]||null:null,'attributes':_0x273701[_0x15a1('0x1a')]?_0x273701['options'][_0x15a1('0x1d')]||null:null,'limit':_0x273701[_0x15a1('0x1a')]?_0x273701[_0x15a1('0x1a')]['limit']||null:null,'include':_0x273701['options']?_0x273701[_0x15a1('0x1a')][_0x15a1('0x1e')]?_[_0x15a1('0x1f')](_0x273701[_0x15a1('0x1a')][_0x15a1('0x1e')],function(_0x4315dd){return{'model':db[_0x4315dd['model']],'as':_0x4315dd['as'],'attributes':_0x4315dd[_0x15a1('0x1d')],'include':_0x4315dd[_0x15a1('0x1e')]?_['map'](_0x4315dd[_0x15a1('0x1e')],function(_0x2710c1){return{'model':db[_0x2710c1[_0x15a1('0x20')]],'as':_0x2710c1['as'],'attributes':_0x2710c1['attributes'],'include':_0x2710c1['include']?_[_0x15a1('0x1f')](_0x2710c1['include'],function(_0x36e528){return{'model':db[_0x36e528[_0x15a1('0x20')]],'as':_0x36e528['as'],'attributes':_0x36e528['attributes']};}):[]};}):[]};}):[]:[]})[_0x15a1('0xd')](function(_0x13f05a){logger[_0x15a1('0xe')](_0x15a1('0x18'),_0x273701);logger[_0x15a1('0x11')](_0x15a1('0x18'),_0x273701,JSON[_0x15a1('0x13')](_0x13f05a));_0x21b98a(_0x13f05a);})[_0x15a1('0x21')](function(_0x8d688){logger['error'](_0x15a1('0x18'),_0x8d688[_0x15a1('0x16')],_0x273701);_0x5bd5c5(_0x524bd9[_0x15a1('0x14')](0x1f4,_0x8d688['message']));});});};exports[_0x15a1('0x22')]=function(_0x48c00e){var _0x4d6ea2=this;return new Promise(function(_0x2afe52,_0x3f0fe4){return db[_0x15a1('0x23')][_0x15a1('0x24')]({'raw':_0x48c00e[_0x15a1('0x1a')]?_0x48c00e['options'][_0x15a1('0x1b')]===undefined?!![]:![]:!![],'where':_0x48c00e[_0x15a1('0x1a')]?_0x48c00e[_0x15a1('0x1a')][_0x15a1('0x1c')]||null:null,'attributes':_0x48c00e[_0x15a1('0x1a')]?_0x48c00e[_0x15a1('0x1a')]['attributes']||null:null,'include':_0x48c00e['options']?_0x48c00e[_0x15a1('0x1a')][_0x15a1('0x1e')]?_[_0x15a1('0x1f')](_0x48c00e['options'][_0x15a1('0x1e')],function(_0x4592c5){return{'model':db[_0x4592c5['model']],'as':_0x4592c5['as'],'attributes':_0x4592c5[_0x15a1('0x1d')],'include':_0x4592c5[_0x15a1('0x1e')]?_['map'](_0x4592c5['include'],function(_0x247d7b){return{'model':db[_0x247d7b['model']],'as':_0x247d7b['as'],'attributes':_0x247d7b[_0x15a1('0x1d')],'include':_0x247d7b[_0x15a1('0x1e')]?_[_0x15a1('0x1f')](_0x247d7b[_0x15a1('0x1e')],function(_0x300804){return{'model':db[_0x300804['model']],'as':_0x300804['as'],'attributes':_0x300804['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x231c1a){logger['info'](_0x15a1('0x22'),_0x48c00e);logger[_0x15a1('0x11')]('ShowServicenowAccount',_0x48c00e,JSON['stringify'](_0x231c1a));_0x2afe52(_0x231c1a);})[_0x15a1('0x21')](function(_0x312076){logger[_0x15a1('0x14')](_0x15a1('0x22'),_0x312076[_0x15a1('0x16')],_0x48c00e);_0x3f0fe4(_0x4d6ea2[_0x15a1('0x14')](0x1f4,_0x312076[_0x15a1('0x16')]));});});}; \ No newline at end of file +var _0xad24=['stringify','ShowServicenowAccount','ServicenowAccount','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','ServicenowAccount,\x20%s,\x20%s','catch','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','then'];(function(_0xe513bd,_0x33b5bd){var _0x58fd88=function(_0x134b6f){while(--_0x134b6f){_0xe513bd['push'](_0xe513bd['shift']());}};_0x58fd88(++_0x33b5bd);}(_0xad24,0xdc));var _0x4ad2=function(_0x150157,_0x5e710c){_0x150157=_0x150157-0x0;var _0x1e225a=_0xad24[_0x150157];return _0x1e225a;};'use strict';var _=require(_0x4ad2('0x0'));var util=require(_0x4ad2('0x1'));var moment=require('moment');var BPromise=require(_0x4ad2('0x2'));var rs=require(_0x4ad2('0x3'));var fs=require('fs');var Redis=require(_0x4ad2('0x4'));var db=require(_0x4ad2('0x5'))['db'];var utils=require(_0x4ad2('0x6'));var logger=require(_0x4ad2('0x7'))(_0x4ad2('0x8'));var config=require(_0x4ad2('0x9'));var jayson=require(_0x4ad2('0xa'));var client=jayson[_0x4ad2('0xb')][_0x4ad2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bad12,_0x5b7db9,_0x3b725e){return new BPromise(function(_0x4a1b5b,_0x36adca){return client[_0x4ad2('0xd')](_0x2bad12,_0x3b725e)['then'](function(_0x52132d){logger[_0x4ad2('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5b7db9,_0x4ad2('0xf'));logger[_0x4ad2('0x10')](_0x4ad2('0x11'),_0x5b7db9,'request\x20sent',JSON['stringify'](_0x52132d));if(_0x52132d['error']){if(_0x52132d[_0x4ad2('0x12')]['code']===0x1f4){logger[_0x4ad2('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5b7db9,_0x52132d[_0x4ad2('0x12')][_0x4ad2('0x13')]);return _0x36adca(_0x52132d['error'][_0x4ad2('0x13')]);}logger['error'](_0x4ad2('0x14'),_0x5b7db9,_0x52132d[_0x4ad2('0x12')][_0x4ad2('0x13')]);return _0x4a1b5b(_0x52132d[_0x4ad2('0x12')][_0x4ad2('0x13')]);}else{logger[_0x4ad2('0xe')](_0x4ad2('0x14'),_0x5b7db9,_0x4ad2('0xf'));_0x4a1b5b(_0x52132d['result'][_0x4ad2('0x13')]);}})[_0x4ad2('0x15')](function(_0x24e3e2){logger[_0x4ad2('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5b7db9,_0x24e3e2);_0x36adca(_0x24e3e2);});});}exports[_0x4ad2('0x16')]=function(_0x1de312){var _0x2db5b9=this;return new Promise(function(_0x3989b5,_0x309e92){return db['ServicenowAccount'][_0x4ad2('0x17')]({'raw':_0x1de312[_0x4ad2('0x18')]?_0x1de312[_0x4ad2('0x18')][_0x4ad2('0x19')]===undefined?!![]:![]:!![],'where':_0x1de312[_0x4ad2('0x18')]?_0x1de312['options']['where']||null:null,'attributes':_0x1de312['options']?_0x1de312[_0x4ad2('0x18')][_0x4ad2('0x1a')]||null:null,'limit':_0x1de312[_0x4ad2('0x18')]?_0x1de312[_0x4ad2('0x18')][_0x4ad2('0x1b')]||null:null,'include':_0x1de312[_0x4ad2('0x18')]?_0x1de312[_0x4ad2('0x18')][_0x4ad2('0x1c')]?_[_0x4ad2('0x1d')](_0x1de312[_0x4ad2('0x18')][_0x4ad2('0x1c')],function(_0x3f036a){return{'model':db[_0x3f036a[_0x4ad2('0x1e')]],'as':_0x3f036a['as'],'attributes':_0x3f036a[_0x4ad2('0x1a')],'include':_0x3f036a['include']?_[_0x4ad2('0x1d')](_0x3f036a['include'],function(_0x5817cb){return{'model':db[_0x5817cb['model']],'as':_0x5817cb['as'],'attributes':_0x5817cb[_0x4ad2('0x1a')],'include':_0x5817cb[_0x4ad2('0x1c')]?_['map'](_0x5817cb[_0x4ad2('0x1c')],function(_0x321e32){return{'model':db[_0x321e32[_0x4ad2('0x1e')]],'as':_0x321e32['as'],'attributes':_0x321e32['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ad2('0x1f')](function(_0x1972f9){logger['info'](_0x4ad2('0x16'),_0x1de312);logger['debug'](_0x4ad2('0x16'),_0x1de312,JSON[_0x4ad2('0x20')](_0x1972f9));_0x3989b5(_0x1972f9);})[_0x4ad2('0x15')](function(_0x33598c){logger['error'](_0x4ad2('0x16'),_0x33598c['message'],_0x1de312);_0x309e92(_0x2db5b9['error'](0x1f4,_0x33598c[_0x4ad2('0x13')]));});});};exports[_0x4ad2('0x21')]=function(_0xde9320){var _0x2d1901=this;return new Promise(function(_0xfba026,_0x395f2e){return db[_0x4ad2('0x22')]['find']({'raw':_0xde9320[_0x4ad2('0x18')]?_0xde9320[_0x4ad2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xde9320[_0x4ad2('0x18')]?_0xde9320[_0x4ad2('0x18')][_0x4ad2('0x23')]||null:null,'attributes':_0xde9320[_0x4ad2('0x18')]?_0xde9320['options'][_0x4ad2('0x1a')]||null:null,'include':_0xde9320[_0x4ad2('0x18')]?_0xde9320[_0x4ad2('0x18')][_0x4ad2('0x1c')]?_['map'](_0xde9320['options'][_0x4ad2('0x1c')],function(_0x246a07){return{'model':db[_0x246a07['model']],'as':_0x246a07['as'],'attributes':_0x246a07[_0x4ad2('0x1a')],'include':_0x246a07[_0x4ad2('0x1c')]?_[_0x4ad2('0x1d')](_0x246a07[_0x4ad2('0x1c')],function(_0x58fa8c){return{'model':db[_0x58fa8c[_0x4ad2('0x1e')]],'as':_0x58fa8c['as'],'attributes':_0x58fa8c['attributes'],'include':_0x58fa8c[_0x4ad2('0x1c')]?_[_0x4ad2('0x1d')](_0x58fa8c['include'],function(_0x578364){return{'model':db[_0x578364[_0x4ad2('0x1e')]],'as':_0x578364['as'],'attributes':_0x578364[_0x4ad2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4ad2('0x1f')](function(_0x13a201){logger['info'](_0x4ad2('0x21'),_0xde9320);logger[_0x4ad2('0x10')](_0x4ad2('0x21'),_0xde9320,JSON[_0x4ad2('0x20')](_0x13a201));_0xfba026(_0x13a201);})[_0x4ad2('0x15')](function(_0x750cff){logger[_0x4ad2('0x12')](_0x4ad2('0x21'),_0x750cff[_0x4ad2('0x13')],_0xde9320);_0x395f2e(_0x2d1901['error'](0x1f4,_0x750cff[_0x4ad2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0380820..eedea6a 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 _0x8155=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x8155,0xf0));var _0x5815=function(_0x36661f,_0x548df9){_0x36661f=_0x36661f-0x0;var _0x5867e4=_0x8155[_0x36661f];return _0x5867e4;};'use strict';var multer=require(_0x5815('0x0'));var util=require(_0x5815('0x1'));var path=require(_0x5815('0x2'));var timeout=require(_0x5815('0x3'));var express=require(_0x5815('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5815('0x5'));var interaction=require(_0x5815('0x6'));var config=require(_0x5815('0x7'));var controller=require(_0x5815('0x8'));router[_0x5815('0x9')]('/',auth[_0x5815('0xa')](),controller[_0x5815('0xb')]);router['get'](_0x5815('0xc'),auth[_0x5815('0xa')](),controller[_0x5815('0xd')]);router[_0x5815('0x9')](_0x5815('0xe'),auth[_0x5815('0xa')](),controller[_0x5815('0xf')]);router[_0x5815('0x9')](_0x5815('0x10'),auth[_0x5815('0xa')](),controller[_0x5815('0x11')]);router[_0x5815('0x9')](_0x5815('0x12'),auth[_0x5815('0xa')](),controller[_0x5815('0x13')]);router[_0x5815('0x14')]('/',auth[_0x5815('0xa')](),controller[_0x5815('0x15')]);router[_0x5815('0x16')](_0x5815('0xc'),auth[_0x5815('0xa')](),controller[_0x5815('0x17')]);router[_0x5815('0x18')](_0x5815('0xc'),auth[_0x5815('0xa')](),controller[_0x5815('0x19')]);module[_0x5815('0x1a')]=router; \ No newline at end of file +var _0xa7c6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x279c59,_0x498169){var _0x1bc90d=function(_0x4245cb){while(--_0x4245cb){_0x279c59['push'](_0x279c59['shift']());}};_0x1bc90d(++_0x498169);}(_0xa7c6,0x76));var _0x6a7c=function(_0x3c7a5b,_0xb364ef){_0x3c7a5b=_0x3c7a5b-0x0;var _0x2529a1=_0xa7c6[_0x3c7a5b];return _0x2529a1;};'use strict';var multer=require(_0x6a7c('0x0'));var util=require(_0x6a7c('0x1'));var path=require(_0x6a7c('0x2'));var timeout=require(_0x6a7c('0x3'));var express=require(_0x6a7c('0x4'));var router=express[_0x6a7c('0x5')]();var fs_extra=require(_0x6a7c('0x6'));var auth=require(_0x6a7c('0x7'));var interaction=require(_0x6a7c('0x8'));var config=require(_0x6a7c('0x9'));var controller=require(_0x6a7c('0xa'));router[_0x6a7c('0xb')]('/',auth[_0x6a7c('0xc')](),controller[_0x6a7c('0xd')]);router['get'](_0x6a7c('0xe'),auth[_0x6a7c('0xc')](),controller['show']);router[_0x6a7c('0xb')](_0x6a7c('0xf'),auth[_0x6a7c('0xc')](),controller[_0x6a7c('0x10')]);router['get'](_0x6a7c('0x11'),auth[_0x6a7c('0xc')](),controller[_0x6a7c('0x12')]);router['get'](_0x6a7c('0x13'),auth['isAuthenticated'](),controller[_0x6a7c('0x14')]);router[_0x6a7c('0x15')]('/',auth[_0x6a7c('0xc')](),controller['create']);router[_0x6a7c('0x16')](_0x6a7c('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6a7c('0xe'),auth['isAuthenticated'](),controller[_0x6a7c('0x17')]);module[_0x6a7c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9544e89..c7f245c 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 _0xe2e8=['STRING','sequelize','exports'];(function(_0x21456e,_0x2ef2cb){var _0x49e7dc=function(_0x4571ba){while(--_0x4571ba){_0x21456e['push'](_0x21456e['shift']());}};_0x49e7dc(++_0x2ef2cb);}(_0xe2e8,0x9a));var _0x8e2e=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xe2e8[_0x3c4f1f];return _0x19cb69;};'use strict';var Sequelize=require(_0x8e2e('0x0'));module[_0x8e2e('0x1')]={'name':{'type':Sequelize[_0x8e2e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc994=['sequelize','STRING'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc994,0x192));var _0x4c99=function(_0x120e21,_0x4e9bc9){_0x120e21=_0x120e21-0x0;var _0x79a3f6=_0xc994[_0x120e21];return _0x79a3f6;};'use strict';var Sequelize=require(_0x4c99('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c99('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 352ffa9..b02a0e9 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 _0x5677=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ServicenowField','getFields','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x24189e,_0x6fa0f7){var _0x4f4902=function(_0x162717){while(--_0x162717){_0x24189e['push'](_0x24189e['shift']());}};_0x4f4902(++_0x6fa0f7);}(_0x5677,0x135));var _0x7567=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x5677[_0x2b31a8];return _0x1175a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7567('0x0'));var zipdir=require(_0x7567('0x1'));var jsonpatch=require(_0x7567('0x2'));var rp=require(_0x7567('0x3'));var moment=require(_0x7567('0x4'));var BPromise=require(_0x7567('0x5'));var Mustache=require(_0x7567('0x6'));var util=require(_0x7567('0x7'));var path=require(_0x7567('0x8'));var sox=require(_0x7567('0x9'));var csv=require(_0x7567('0xa'));var ejs=require(_0x7567('0xb'));var fs=require('fs');var fs_extra=require(_0x7567('0xc'));var _=require(_0x7567('0xd'));var squel=require('squel');var crypto=require(_0x7567('0xe'));var jsforce=require(_0x7567('0xf'));var deskjs=require(_0x7567('0x10'));var toCsv=require(_0x7567('0xa'));var querystring=require(_0x7567('0x11'));var Papa=require(_0x7567('0x12'));var Redis=require(_0x7567('0x13'));var authService=require(_0x7567('0x14'));var qs=require(_0x7567('0x15'));var as=require(_0x7567('0x16'));var hardwareService=require(_0x7567('0x17'));var logger=require('../../config/logger')(_0x7567('0x18'));var utils=require(_0x7567('0x19'));var config=require(_0x7567('0x1a'));var licenseUtil=require(_0x7567('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2476dc,_0x3227f4){_0x3227f4=_0x3227f4||0xcc;return function(_0xd937d7){if(_0xd937d7){return _0x2476dc[_0x7567('0x1c')](_0x3227f4);}return _0x2476dc[_0x7567('0x1d')](_0x3227f4)[_0x7567('0x1e')]();};}function respondWithResult(_0x2fcb64,_0x2e6bf8){_0x2e6bf8=_0x2e6bf8||0xc8;return function(_0x457e1c){if(_0x457e1c){return _0x2fcb64[_0x7567('0x1d')](_0x2e6bf8)[_0x7567('0x1f')](_0x457e1c);}};}function respondWithFilteredResult(_0x58ea34,_0x308944){return function(_0x1c56a4){if(_0x1c56a4){var _0x2f6b4a=typeof _0x308944[_0x7567('0x20')]===_0x7567('0x21')&&typeof _0x308944[_0x7567('0x22')]===_0x7567('0x21');var _0x3be4e8=_0x1c56a4[_0x7567('0x23')];var _0x5ef07e=_0x2f6b4a?0x0:_0x308944[_0x7567('0x20')];var _0x4dbb26=_0x2f6b4a?_0x1c56a4['count']:_0x308944['offset']+_0x308944[_0x7567('0x22')];var _0x4f6405;if(_0x4dbb26>=_0x3be4e8){_0x4dbb26=_0x3be4e8;_0x4f6405=0xc8;}else{_0x4f6405=0xce;}_0x58ea34[_0x7567('0x1d')](_0x4f6405);return _0x58ea34[_0x7567('0x24')](_0x7567('0x25'),_0x5ef07e+'-'+_0x4dbb26+'/'+_0x3be4e8)[_0x7567('0x1f')](_0x1c56a4);}return null;};}function patchUpdates(_0x107e0e){return function(_0x2c020c){try{jsonpatch[_0x7567('0x26')](_0x2c020c,_0x107e0e,!![]);}catch(_0x58815f){return BPromise['reject'](_0x58815f);}return _0x2c020c[_0x7567('0x27')]();};}function saveUpdates(_0x2bec42,_0x1ddc5f){return function(_0x7bdb24){if(_0x7bdb24){return _0x7bdb24[_0x7567('0x28')](_0x2bec42)[_0x7567('0x29')](function(_0x20b236){return _0x20b236;});}return null;};}function removeEntity(_0x2dbd17,_0x306733){return function(_0x545700){if(_0x545700){return _0x545700[_0x7567('0x2a')]()[_0x7567('0x29')](function(){_0x2dbd17[_0x7567('0x1d')](0xcc)[_0x7567('0x1e')]();});}};}function handleEntityNotFound(_0x40a2c4,_0x5c0a58){return function(_0x1460b8){if(!_0x1460b8){_0x40a2c4[_0x7567('0x1c')](0x194);}return _0x1460b8;};}function handleError(_0x23a70a,_0x3d4457){_0x3d4457=_0x3d4457||0x1f4;return function(_0x501c09){logger[_0x7567('0x2b')](_0x501c09[_0x7567('0x2c')]);if(_0x501c09[_0x7567('0x2d')]){delete _0x501c09[_0x7567('0x2d')];}_0x23a70a[_0x7567('0x1d')](_0x3d4457)[_0x7567('0x2e')](_0x501c09);};}exports['index']=function(_0x2e5ca0,_0xf6668b){var _0x37b068={},_0x54ce0e={},_0x40ee3e={'count':0x0,'rows':[]};var _0x2a027d=_[_0x7567('0x2f')](db[_0x7567('0x30')][_0x7567('0x31')],function(_0x57f4e9){return{'name':_0x57f4e9[_0x7567('0x32')],'type':_0x57f4e9[_0x7567('0x33')][_0x7567('0x34')]};});_0x54ce0e[_0x7567('0x35')]=_[_0x7567('0x2f')](_0x2a027d,_0x7567('0x2d'));_0x54ce0e[_0x7567('0x36')]=_[_0x7567('0x37')](_0x2e5ca0[_0x7567('0x36')]);_0x54ce0e[_0x7567('0x38')]=_[_0x7567('0x39')](_0x54ce0e[_0x7567('0x35')],_0x54ce0e[_0x7567('0x36')]);_0x37b068[_0x7567('0x3a')]=_[_0x7567('0x39')](_0x54ce0e['model'],qs[_0x7567('0x3b')](_0x2e5ca0[_0x7567('0x36')][_0x7567('0x3b')]));_0x37b068[_0x7567('0x3a')]=_0x37b068[_0x7567('0x3a')][_0x7567('0x3c')]?_0x37b068[_0x7567('0x3a')]:_0x54ce0e['model'];if(!_0x2e5ca0['query']['hasOwnProperty'](_0x7567('0x3d'))){_0x37b068[_0x7567('0x22')]=qs['limit'](_0x2e5ca0[_0x7567('0x36')][_0x7567('0x22')]);_0x37b068['offset']=qs[_0x7567('0x20')](_0x2e5ca0['query'][_0x7567('0x20')]);}_0x37b068[_0x7567('0x3e')]=qs[_0x7567('0x3f')](_0x2e5ca0['query'][_0x7567('0x3f')]);_0x37b068[_0x7567('0x40')]=qs[_0x7567('0x38')](_[_0x7567('0x41')](_0x2e5ca0[_0x7567('0x36')],_0x54ce0e[_0x7567('0x38')]),_0x2a027d);if(_0x2e5ca0[_0x7567('0x36')][_0x7567('0x42')]){_0x37b068[_0x7567('0x40')]=_[_0x7567('0x43')](_0x37b068[_0x7567('0x40')],{'$or':_['map'](_0x2a027d,function(_0x24ca75){if(_0x24ca75[_0x7567('0x33')]!==_0x7567('0x44')){var _0x2d4729={};_0x2d4729[_0x24ca75[_0x7567('0x2d')]]={'$like':'%'+_0x2e5ca0['query'][_0x7567('0x42')]+'%'};return _0x2d4729;}})});}_0x37b068=_[_0x7567('0x43')]({},_0x37b068,_0x2e5ca0[_0x7567('0x45')]);var _0x557cf7={'where':_0x37b068[_0x7567('0x40')]};return db[_0x7567('0x30')][_0x7567('0x23')](_0x557cf7)[_0x7567('0x29')](function(_0x3eaff7){_0x40ee3e[_0x7567('0x23')]=_0x3eaff7;if(_0x2e5ca0[_0x7567('0x36')][_0x7567('0x46')]){_0x37b068[_0x7567('0x47')]=[{'all':!![]}];}return db[_0x7567('0x30')][_0x7567('0x48')](_0x37b068);})[_0x7567('0x29')](function(_0x2d6e82){_0x40ee3e[_0x7567('0x49')]=_0x2d6e82;return _0x40ee3e;})['then'](respondWithFilteredResult(_0xf6668b,_0x37b068))[_0x7567('0x4a')](handleError(_0xf6668b,null));};exports[_0x7567('0x4b')]=function(_0x52d2c8,_0x101878){var _0x49e998={'raw':![],'where':{'id':_0x52d2c8[_0x7567('0x4c')]['id']}},_0x20f6fe={};_0x20f6fe['model']=_[_0x7567('0x37')](db['ServicenowConfiguration'][_0x7567('0x31')]);_0x20f6fe[_0x7567('0x36')]=_[_0x7567('0x37')](_0x52d2c8[_0x7567('0x36')]);_0x20f6fe['filters']=_[_0x7567('0x39')](_0x20f6fe[_0x7567('0x35')],_0x20f6fe[_0x7567('0x36')]);_0x49e998[_0x7567('0x3a')]=_[_0x7567('0x39')](_0x20f6fe[_0x7567('0x35')],qs[_0x7567('0x3b')](_0x52d2c8['query'][_0x7567('0x3b')]));_0x49e998[_0x7567('0x3a')]=_0x49e998[_0x7567('0x3a')][_0x7567('0x3c')]?_0x49e998['attributes']:_0x20f6fe[_0x7567('0x35')];if(_0x52d2c8[_0x7567('0x36')][_0x7567('0x46')]){_0x49e998['include']=[{'all':!![]}];}_0x49e998=_['merge']({},_0x49e998,_0x52d2c8['options']);return db[_0x7567('0x30')][_0x7567('0x4d')](_0x49e998)[_0x7567('0x29')](handleEntityNotFound(_0x101878,null))[_0x7567('0x29')](respondWithResult(_0x101878,null))[_0x7567('0x4a')](handleError(_0x101878,null));};exports[_0x7567('0x4e')]=function(_0x3ab0cd,_0x3a8129){return db['ServicenowConfiguration'][_0x7567('0x4e')](_0x3ab0cd['body'],{})[_0x7567('0x29')](respondWithResult(_0x3a8129,0xc9))['catch'](handleError(_0x3a8129,null));};exports[_0x7567('0x28')]=function(_0x1b7be8,_0x493366){if(_0x1b7be8[_0x7567('0x4f')]['id']){delete _0x1b7be8[_0x7567('0x4f')]['id'];}return db[_0x7567('0x30')]['find']({'where':{'id':_0x1b7be8[_0x7567('0x4c')]['id']}})[_0x7567('0x29')](handleEntityNotFound(_0x493366,null))[_0x7567('0x29')](saveUpdates(_0x1b7be8[_0x7567('0x4f')],null))[_0x7567('0x29')](respondWithResult(_0x493366,null))[_0x7567('0x4a')](handleError(_0x493366,null));};exports[_0x7567('0x2a')]=function(_0x39c763,_0x1ce230){return db[_0x7567('0x30')][_0x7567('0x4d')]({'where':{'id':_0x39c763['params']['id']}})[_0x7567('0x29')](handleEntityNotFound(_0x1ce230,null))[_0x7567('0x29')](removeEntity(_0x1ce230,null))[_0x7567('0x4a')](handleError(_0x1ce230,null));};exports['getFields']=function(_0x5243d0,_0x5d2cf2,_0x1e9d0c){var _0x37ea35={};var _0x38d9df={};var _0x4ccdcc;var _0x3c00e5;return db[_0x7567('0x30')][_0x7567('0x50')]({'where':{'id':_0x5243d0['params']['id']}})['then'](handleEntityNotFound(_0x5d2cf2,null))[_0x7567('0x29')](function(_0x500ea6){if(_0x500ea6){_0x4ccdcc=_0x500ea6;_0x38d9df['model']=_[_0x7567('0x37')](db[_0x7567('0x51')][_0x7567('0x31')]);_0x38d9df[_0x7567('0x36')]=_['keys'](_0x5243d0[_0x7567('0x36')]);_0x38d9df[_0x7567('0x38')]=_[_0x7567('0x39')](_0x38d9df[_0x7567('0x35')],_0x38d9df[_0x7567('0x36')]);_0x37ea35['attributes']=_[_0x7567('0x39')](_0x38d9df[_0x7567('0x35')],qs['fields'](_0x5243d0['query']['fields']));_0x37ea35[_0x7567('0x3a')]=_0x37ea35[_0x7567('0x3a')][_0x7567('0x3c')]?_0x37ea35[_0x7567('0x3a')]:_0x38d9df['model'];_0x37ea35[_0x7567('0x3e')]=qs['sort'](_0x5243d0[_0x7567('0x36')]['sort']);_0x37ea35['where']=qs[_0x7567('0x38')](_[_0x7567('0x41')](_0x5243d0['query'],_0x38d9df[_0x7567('0x38')]));if(_0x5243d0['query'][_0x7567('0x42')]){_0x37ea35[_0x7567('0x40')]=_[_0x7567('0x43')](_0x37ea35[_0x7567('0x40')],{'$or':_[_0x7567('0x2f')](_0x37ea35[_0x7567('0x3a')],function(_0x2c03b5){var _0x3c2da6={};_0x3c2da6[_0x2c03b5]={'$like':'%'+_0x5243d0[_0x7567('0x36')][_0x7567('0x42')]+'%'};return _0x3c2da6;})});}_0x37ea35=_['merge']({},_0x37ea35,_0x5243d0['options']);return _0x4ccdcc[_0x7567('0x52')](_0x37ea35);}})[_0x7567('0x29')](function(_0x2fbc68){if(_0x2fbc68){_0x3c00e5=_0x2fbc68[_0x7567('0x3c')];if(!_0x5243d0[_0x7567('0x36')][_0x7567('0x53')]('nolimit')){_0x37ea35[_0x7567('0x22')]=qs['limit'](_0x5243d0[_0x7567('0x36')][_0x7567('0x22')]);_0x37ea35[_0x7567('0x20')]=qs[_0x7567('0x20')](_0x5243d0[_0x7567('0x36')][_0x7567('0x20')]);}return _0x4ccdcc[_0x7567('0x52')](_0x37ea35);}})[_0x7567('0x29')](function(_0x5986c1){if(_0x5986c1){return _0x5986c1?{'count':_0x3c00e5,'rows':_0x5986c1}:null;}})[_0x7567('0x29')](respondWithResult(_0x5d2cf2,null))[_0x7567('0x4a')](handleError(_0x5d2cf2,null));};exports[_0x7567('0x54')]=function(_0x379e11,_0x467aa4,_0x2a4200){var _0xcd7168={};var _0xc2d0f6={};var _0x199c7e;var _0x554700;return db[_0x7567('0x30')][_0x7567('0x50')]({'where':{'id':_0x379e11[_0x7567('0x4c')]['id']}})[_0x7567('0x29')](handleEntityNotFound(_0x467aa4,null))[_0x7567('0x29')](function(_0xb46b4c){if(_0xb46b4c){_0x199c7e=_0xb46b4c;_0xc2d0f6[_0x7567('0x35')]=_['keys'](db[_0x7567('0x51')][_0x7567('0x31')]);_0xc2d0f6[_0x7567('0x36')]=_[_0x7567('0x37')](_0x379e11['query']);_0xc2d0f6[_0x7567('0x38')]=_[_0x7567('0x39')](_0xc2d0f6[_0x7567('0x35')],_0xc2d0f6[_0x7567('0x36')]);_0xcd7168[_0x7567('0x3a')]=_[_0x7567('0x39')](_0xc2d0f6[_0x7567('0x35')],qs[_0x7567('0x3b')](_0x379e11[_0x7567('0x36')]['fields']));_0xcd7168[_0x7567('0x3a')]=_0xcd7168[_0x7567('0x3a')][_0x7567('0x3c')]?_0xcd7168[_0x7567('0x3a')]:_0xc2d0f6[_0x7567('0x35')];_0xcd7168[_0x7567('0x3e')]=qs[_0x7567('0x3f')](_0x379e11[_0x7567('0x36')][_0x7567('0x3f')]);_0xcd7168[_0x7567('0x40')]=qs[_0x7567('0x38')](_[_0x7567('0x41')](_0x379e11[_0x7567('0x36')],_0xc2d0f6['filters']));if(_0x379e11[_0x7567('0x36')][_0x7567('0x42')]){_0xcd7168[_0x7567('0x40')]=_['merge'](_0xcd7168[_0x7567('0x40')],{'$or':_[_0x7567('0x2f')](_0xcd7168[_0x7567('0x3a')],function(_0x4f3205){var _0xb18adc={};_0xb18adc[_0x4f3205]={'$like':'%'+_0x379e11['query'][_0x7567('0x42')]+'%'};return _0xb18adc;})});}_0xcd7168=_[_0x7567('0x43')]({},_0xcd7168,_0x379e11[_0x7567('0x45')]);return _0x199c7e[_0x7567('0x54')](_0xcd7168);}})[_0x7567('0x29')](function(_0x1950ee){if(_0x1950ee){_0x554700=_0x1950ee['length'];if(!_0x379e11[_0x7567('0x36')][_0x7567('0x53')]('nolimit')){_0xcd7168[_0x7567('0x22')]=qs[_0x7567('0x22')](_0x379e11[_0x7567('0x36')][_0x7567('0x22')]);_0xcd7168[_0x7567('0x20')]=qs[_0x7567('0x20')](_0x379e11[_0x7567('0x36')][_0x7567('0x20')]);}return _0x199c7e[_0x7567('0x54')](_0xcd7168);}})[_0x7567('0x29')](function(_0x5b2453){if(_0x5b2453){return _0x5b2453?{'count':_0x554700,'rows':_0x5b2453}:null;}})['then'](respondWithResult(_0x467aa4,null))[_0x7567('0x4a')](handleError(_0x467aa4,null));};exports[_0x7567('0x55')]=function(_0x43ca0e,_0x1d9ffd,_0xc03b00){var _0x2fecdf={};var _0x2defb8={};var _0x2ed67d;var _0x1dbab0;return db[_0x7567('0x30')]['findOne']({'where':{'id':_0x43ca0e['params']['id']}})['then'](handleEntityNotFound(_0x1d9ffd,null))['then'](function(_0x47b9e1){if(_0x47b9e1){_0x2ed67d=_0x47b9e1;_0x2defb8['model']=_[_0x7567('0x37')](db[_0x7567('0x51')][_0x7567('0x31')]);_0x2defb8['query']=_[_0x7567('0x37')](_0x43ca0e[_0x7567('0x36')]);_0x2defb8[_0x7567('0x38')]=_[_0x7567('0x39')](_0x2defb8[_0x7567('0x35')],_0x2defb8[_0x7567('0x36')]);_0x2fecdf[_0x7567('0x3a')]=_['intersection'](_0x2defb8[_0x7567('0x35')],qs[_0x7567('0x3b')](_0x43ca0e[_0x7567('0x36')][_0x7567('0x3b')]));_0x2fecdf[_0x7567('0x3a')]=_0x2fecdf[_0x7567('0x3a')][_0x7567('0x3c')]?_0x2fecdf[_0x7567('0x3a')]:_0x2defb8['model'];_0x2fecdf[_0x7567('0x3e')]=qs[_0x7567('0x3f')](_0x43ca0e['query'][_0x7567('0x3f')]);_0x2fecdf[_0x7567('0x40')]=qs[_0x7567('0x38')](_[_0x7567('0x41')](_0x43ca0e[_0x7567('0x36')],_0x2defb8[_0x7567('0x38')]));if(_0x43ca0e['query'][_0x7567('0x42')]){_0x2fecdf[_0x7567('0x40')]=_[_0x7567('0x43')](_0x2fecdf['where'],{'$or':_[_0x7567('0x2f')](_0x2fecdf[_0x7567('0x3a')],function(_0x262ecd){var _0x3433f0={};_0x3433f0[_0x262ecd]={'$like':'%'+_0x43ca0e[_0x7567('0x36')]['filter']+'%'};return _0x3433f0;})});}_0x2fecdf=_[_0x7567('0x43')]({},_0x2fecdf,_0x43ca0e[_0x7567('0x45')]);return _0x2ed67d[_0x7567('0x55')](_0x2fecdf);}})[_0x7567('0x29')](function(_0x304d85){if(_0x304d85){_0x1dbab0=_0x304d85[_0x7567('0x3c')];if(!_0x43ca0e['query'][_0x7567('0x53')](_0x7567('0x3d'))){_0x2fecdf[_0x7567('0x22')]=qs[_0x7567('0x22')](_0x43ca0e[_0x7567('0x36')]['limit']);_0x2fecdf[_0x7567('0x20')]=qs[_0x7567('0x20')](_0x43ca0e[_0x7567('0x36')]['offset']);}return _0x2ed67d[_0x7567('0x55')](_0x2fecdf);}})[_0x7567('0x29')](function(_0x32d71a){if(_0x32d71a){return _0x32d71a?{'count':_0x1dbab0,'rows':_0x32d71a}:null;}})['then'](respondWithResult(_0x1d9ffd,null))[_0x7567('0x4a')](handleError(_0x1d9ffd,null));}; \ No newline at end of file +var _0xc932=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','ServicenowField','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xc932,0x194));var _0x2c93=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xc932[_0x2d3d0d];return _0xca35b6;};'use strict';var emlformat=require(_0x2c93('0x0'));var rimraf=require(_0x2c93('0x1'));var zipdir=require(_0x2c93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2c93('0x3'));var Mustache=require(_0x2c93('0x4'));var util=require('util');var path=require(_0x2c93('0x5'));var sox=require(_0x2c93('0x6'));var csv=require(_0x2c93('0x7'));var ejs=require(_0x2c93('0x8'));var fs=require('fs');var fs_extra=require(_0x2c93('0x9'));var _=require(_0x2c93('0xa'));var squel=require(_0x2c93('0xb'));var crypto=require(_0x2c93('0xc'));var jsforce=require(_0x2c93('0xd'));var deskjs=require(_0x2c93('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c93('0xf'));var Papa=require(_0x2c93('0x10'));var Redis=require(_0x2c93('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2c93('0x12'));var as=require(_0x2c93('0x13'));var hardwareService=require(_0x2c93('0x14'));var logger=require(_0x2c93('0x15'))(_0x2c93('0x16'));var utils=require(_0x2c93('0x17'));var config=require(_0x2c93('0x18'));var licenseUtil=require(_0x2c93('0x19'));var db=require(_0x2c93('0x1a'))['db'];function respondWithStatusCode(_0x521498,_0x38ad96){_0x38ad96=_0x38ad96||0xcc;return function(_0xc1f0d){if(_0xc1f0d){return _0x521498[_0x2c93('0x1b')](_0x38ad96);}return _0x521498['status'](_0x38ad96)[_0x2c93('0x1c')]();};}function respondWithResult(_0x211fcb,_0x2d9a33){_0x2d9a33=_0x2d9a33||0xc8;return function(_0x1b87bd){if(_0x1b87bd){return _0x211fcb[_0x2c93('0x1d')](_0x2d9a33)[_0x2c93('0x1e')](_0x1b87bd);}};}function respondWithFilteredResult(_0xd41d7d,_0x7c75a4){return function(_0x1f003d){if(_0x1f003d){var _0x2b98b2=typeof _0x7c75a4[_0x2c93('0x1f')]===_0x2c93('0x20')&&typeof _0x7c75a4[_0x2c93('0x21')]===_0x2c93('0x20');var _0x5dbbf9=_0x1f003d[_0x2c93('0x22')];var _0x22662b=_0x2b98b2?0x0:_0x7c75a4['offset'];var _0x9ad30b=_0x2b98b2?_0x1f003d[_0x2c93('0x22')]:_0x7c75a4[_0x2c93('0x1f')]+_0x7c75a4[_0x2c93('0x21')];var _0x30f922;if(_0x9ad30b>=_0x5dbbf9){_0x9ad30b=_0x5dbbf9;_0x30f922=0xc8;}else{_0x30f922=0xce;}_0xd41d7d[_0x2c93('0x1d')](_0x30f922);return _0xd41d7d[_0x2c93('0x23')](_0x2c93('0x24'),_0x22662b+'-'+_0x9ad30b+'/'+_0x5dbbf9)[_0x2c93('0x1e')](_0x1f003d);}return null;};}function patchUpdates(_0x50cc56){return function(_0x1b0872){try{jsonpatch[_0x2c93('0x25')](_0x1b0872,_0x50cc56,!![]);}catch(_0x484294){return BPromise[_0x2c93('0x26')](_0x484294);}return _0x1b0872[_0x2c93('0x27')]();};}function saveUpdates(_0x85e01f,_0x5d96f7){return function(_0x4002c6){if(_0x4002c6){return _0x4002c6[_0x2c93('0x28')](_0x85e01f)[_0x2c93('0x29')](function(_0x1f546b){return _0x1f546b;});}return null;};}function removeEntity(_0x587a15,_0x208cd3){return function(_0x35ae51){if(_0x35ae51){return _0x35ae51[_0x2c93('0x2a')]()[_0x2c93('0x29')](function(){_0x587a15[_0x2c93('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3f30,_0x14fb38){return function(_0x3b081d){if(!_0x3b081d){_0x3b3f30['sendStatus'](0x194);}return _0x3b081d;};}function handleError(_0x3387ef,_0x4dc57c){_0x4dc57c=_0x4dc57c||0x1f4;return function(_0x326144){logger[_0x2c93('0x2b')](_0x326144['stack']);if(_0x326144['name']){delete _0x326144[_0x2c93('0x2c')];}_0x3387ef['status'](_0x4dc57c)[_0x2c93('0x2d')](_0x326144);};}exports['index']=function(_0x5cf668,_0x59960a){var _0x36865e={},_0x1fd341={},_0x48a92d={'count':0x0,'rows':[]};var _0x30003a=_[_0x2c93('0x2e')](db[_0x2c93('0x2f')][_0x2c93('0x30')],function(_0x4a47fc){return{'name':_0x4a47fc[_0x2c93('0x31')],'type':_0x4a47fc[_0x2c93('0x32')]['key']};});_0x1fd341[_0x2c93('0x33')]=_[_0x2c93('0x2e')](_0x30003a,'name');_0x1fd341[_0x2c93('0x34')]=_[_0x2c93('0x35')](_0x5cf668[_0x2c93('0x34')]);_0x1fd341['filters']=_[_0x2c93('0x36')](_0x1fd341[_0x2c93('0x33')],_0x1fd341[_0x2c93('0x34')]);_0x36865e['attributes']=_['intersection'](_0x1fd341[_0x2c93('0x33')],qs[_0x2c93('0x37')](_0x5cf668[_0x2c93('0x34')][_0x2c93('0x37')]));_0x36865e[_0x2c93('0x38')]=_0x36865e[_0x2c93('0x38')][_0x2c93('0x39')]?_0x36865e['attributes']:_0x1fd341['model'];if(!_0x5cf668[_0x2c93('0x34')][_0x2c93('0x3a')](_0x2c93('0x3b'))){_0x36865e[_0x2c93('0x21')]=qs[_0x2c93('0x21')](_0x5cf668['query']['limit']);_0x36865e[_0x2c93('0x1f')]=qs[_0x2c93('0x1f')](_0x5cf668['query'][_0x2c93('0x1f')]);}_0x36865e[_0x2c93('0x3c')]=qs['sort'](_0x5cf668['query'][_0x2c93('0x3d')]);_0x36865e[_0x2c93('0x3e')]=qs[_0x2c93('0x3f')](_['pick'](_0x5cf668[_0x2c93('0x34')],_0x1fd341[_0x2c93('0x3f')]),_0x30003a);if(_0x5cf668[_0x2c93('0x34')][_0x2c93('0x40')]){_0x36865e[_0x2c93('0x3e')]=_['merge'](_0x36865e[_0x2c93('0x3e')],{'$or':_[_0x2c93('0x2e')](_0x30003a,function(_0x549d88){if(_0x549d88[_0x2c93('0x32')]!==_0x2c93('0x41')){var _0x212fbe={};_0x212fbe[_0x549d88[_0x2c93('0x2c')]]={'$like':'%'+_0x5cf668['query'][_0x2c93('0x40')]+'%'};return _0x212fbe;}})});}_0x36865e=_[_0x2c93('0x42')]({},_0x36865e,_0x5cf668[_0x2c93('0x43')]);var _0x212457={'where':_0x36865e[_0x2c93('0x3e')]};return db[_0x2c93('0x2f')][_0x2c93('0x22')](_0x212457)[_0x2c93('0x29')](function(_0x244afb){_0x48a92d['count']=_0x244afb;if(_0x5cf668[_0x2c93('0x34')][_0x2c93('0x44')]){_0x36865e[_0x2c93('0x45')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x2c93('0x46')](_0x36865e);})[_0x2c93('0x29')](function(_0x5cc704){_0x48a92d[_0x2c93('0x47')]=_0x5cc704;return _0x48a92d;})[_0x2c93('0x29')](respondWithFilteredResult(_0x59960a,_0x36865e))[_0x2c93('0x48')](handleError(_0x59960a,null));};exports[_0x2c93('0x49')]=function(_0x1689d0,_0x5a9d01){var _0x1f4301={'raw':![],'where':{'id':_0x1689d0[_0x2c93('0x4a')]['id']}},_0x3785aa={};_0x3785aa[_0x2c93('0x33')]=_[_0x2c93('0x35')](db[_0x2c93('0x2f')]['rawAttributes']);_0x3785aa[_0x2c93('0x34')]=_['keys'](_0x1689d0[_0x2c93('0x34')]);_0x3785aa[_0x2c93('0x3f')]=_[_0x2c93('0x36')](_0x3785aa[_0x2c93('0x33')],_0x3785aa['query']);_0x1f4301['attributes']=_['intersection'](_0x3785aa[_0x2c93('0x33')],qs[_0x2c93('0x37')](_0x1689d0[_0x2c93('0x34')][_0x2c93('0x37')]));_0x1f4301[_0x2c93('0x38')]=_0x1f4301[_0x2c93('0x38')][_0x2c93('0x39')]?_0x1f4301[_0x2c93('0x38')]:_0x3785aa[_0x2c93('0x33')];if(_0x1689d0['query'][_0x2c93('0x44')]){_0x1f4301[_0x2c93('0x45')]=[{'all':!![]}];}_0x1f4301=_[_0x2c93('0x42')]({},_0x1f4301,_0x1689d0[_0x2c93('0x43')]);return db[_0x2c93('0x2f')][_0x2c93('0x4b')](_0x1f4301)[_0x2c93('0x29')](handleEntityNotFound(_0x5a9d01,null))['then'](respondWithResult(_0x5a9d01,null))[_0x2c93('0x48')](handleError(_0x5a9d01,null));};exports[_0x2c93('0x4c')]=function(_0x323ac2,_0x49f59a){return db[_0x2c93('0x2f')][_0x2c93('0x4c')](_0x323ac2['body'],{})[_0x2c93('0x29')](respondWithResult(_0x49f59a,0xc9))[_0x2c93('0x48')](handleError(_0x49f59a,null));};exports['update']=function(_0xd8dc93,_0x3c5431){if(_0xd8dc93[_0x2c93('0x4d')]['id']){delete _0xd8dc93[_0x2c93('0x4d')]['id'];}return db[_0x2c93('0x2f')][_0x2c93('0x4b')]({'where':{'id':_0xd8dc93[_0x2c93('0x4a')]['id']}})[_0x2c93('0x29')](handleEntityNotFound(_0x3c5431,null))[_0x2c93('0x29')](saveUpdates(_0xd8dc93[_0x2c93('0x4d')],null))[_0x2c93('0x29')](respondWithResult(_0x3c5431,null))[_0x2c93('0x48')](handleError(_0x3c5431,null));};exports[_0x2c93('0x2a')]=function(_0x392116,_0x51f72a){return db[_0x2c93('0x2f')][_0x2c93('0x4b')]({'where':{'id':_0x392116[_0x2c93('0x4a')]['id']}})[_0x2c93('0x29')](handleEntityNotFound(_0x51f72a,null))[_0x2c93('0x29')](removeEntity(_0x51f72a,null))[_0x2c93('0x48')](handleError(_0x51f72a,null));};exports[_0x2c93('0x4e')]=function(_0x2986e3,_0x24e155,_0x36c2c7){var _0x916005={};var _0x409640={};var _0x30cf62;var _0x9faebb;return db[_0x2c93('0x2f')]['findOne']({'where':{'id':_0x2986e3[_0x2c93('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24e155,null))[_0x2c93('0x29')](function(_0x12886e){if(_0x12886e){_0x30cf62=_0x12886e;_0x409640['model']=_[_0x2c93('0x35')](db[_0x2c93('0x4f')][_0x2c93('0x30')]);_0x409640[_0x2c93('0x34')]=_[_0x2c93('0x35')](_0x2986e3['query']);_0x409640[_0x2c93('0x3f')]=_[_0x2c93('0x36')](_0x409640[_0x2c93('0x33')],_0x409640[_0x2c93('0x34')]);_0x916005[_0x2c93('0x38')]=_[_0x2c93('0x36')](_0x409640[_0x2c93('0x33')],qs[_0x2c93('0x37')](_0x2986e3[_0x2c93('0x34')][_0x2c93('0x37')]));_0x916005[_0x2c93('0x38')]=_0x916005['attributes'][_0x2c93('0x39')]?_0x916005['attributes']:_0x409640[_0x2c93('0x33')];_0x916005['order']=qs[_0x2c93('0x3d')](_0x2986e3[_0x2c93('0x34')][_0x2c93('0x3d')]);_0x916005[_0x2c93('0x3e')]=qs[_0x2c93('0x3f')](_[_0x2c93('0x50')](_0x2986e3['query'],_0x409640['filters']));if(_0x2986e3[_0x2c93('0x34')]['filter']){_0x916005[_0x2c93('0x3e')]=_[_0x2c93('0x42')](_0x916005[_0x2c93('0x3e')],{'$or':_[_0x2c93('0x2e')](_0x916005[_0x2c93('0x38')],function(_0x31d389){var _0x415626={};_0x415626[_0x31d389]={'$like':'%'+_0x2986e3[_0x2c93('0x34')][_0x2c93('0x40')]+'%'};return _0x415626;})});}_0x916005=_[_0x2c93('0x42')]({},_0x916005,_0x2986e3['options']);return _0x30cf62[_0x2c93('0x4e')](_0x916005);}})[_0x2c93('0x29')](function(_0x391610){if(_0x391610){_0x9faebb=_0x391610[_0x2c93('0x39')];if(!_0x2986e3[_0x2c93('0x34')][_0x2c93('0x3a')](_0x2c93('0x3b'))){_0x916005['limit']=qs[_0x2c93('0x21')](_0x2986e3[_0x2c93('0x34')][_0x2c93('0x21')]);_0x916005[_0x2c93('0x1f')]=qs[_0x2c93('0x1f')](_0x2986e3[_0x2c93('0x34')][_0x2c93('0x1f')]);}return _0x30cf62[_0x2c93('0x4e')](_0x916005);}})[_0x2c93('0x29')](function(_0x72a853){if(_0x72a853){return _0x72a853?{'count':_0x9faebb,'rows':_0x72a853}:null;}})['then'](respondWithResult(_0x24e155,null))[_0x2c93('0x48')](handleError(_0x24e155,null));};exports[_0x2c93('0x51')]=function(_0x50b50d,_0x526292,_0x3bcdd3){var _0x212d81={};var _0x439f7d={};var _0x3043d8;var _0x23cc69;return db[_0x2c93('0x2f')]['findOne']({'where':{'id':_0x50b50d[_0x2c93('0x4a')]['id']}})['then'](handleEntityNotFound(_0x526292,null))[_0x2c93('0x29')](function(_0x1cc449){if(_0x1cc449){_0x3043d8=_0x1cc449;_0x439f7d[_0x2c93('0x33')]=_[_0x2c93('0x35')](db[_0x2c93('0x4f')][_0x2c93('0x30')]);_0x439f7d['query']=_['keys'](_0x50b50d[_0x2c93('0x34')]);_0x439f7d[_0x2c93('0x3f')]=_[_0x2c93('0x36')](_0x439f7d[_0x2c93('0x33')],_0x439f7d[_0x2c93('0x34')]);_0x212d81[_0x2c93('0x38')]=_[_0x2c93('0x36')](_0x439f7d[_0x2c93('0x33')],qs['fields'](_0x50b50d[_0x2c93('0x34')][_0x2c93('0x37')]));_0x212d81[_0x2c93('0x38')]=_0x212d81['attributes'][_0x2c93('0x39')]?_0x212d81[_0x2c93('0x38')]:_0x439f7d[_0x2c93('0x33')];_0x212d81[_0x2c93('0x3c')]=qs['sort'](_0x50b50d[_0x2c93('0x34')][_0x2c93('0x3d')]);_0x212d81[_0x2c93('0x3e')]=qs[_0x2c93('0x3f')](_[_0x2c93('0x50')](_0x50b50d[_0x2c93('0x34')],_0x439f7d['filters']));if(_0x50b50d[_0x2c93('0x34')][_0x2c93('0x40')]){_0x212d81[_0x2c93('0x3e')]=_[_0x2c93('0x42')](_0x212d81[_0x2c93('0x3e')],{'$or':_[_0x2c93('0x2e')](_0x212d81[_0x2c93('0x38')],function(_0x677a0c){var _0x14f71a={};_0x14f71a[_0x677a0c]={'$like':'%'+_0x50b50d[_0x2c93('0x34')][_0x2c93('0x40')]+'%'};return _0x14f71a;})});}_0x212d81=_[_0x2c93('0x42')]({},_0x212d81,_0x50b50d['options']);return _0x3043d8[_0x2c93('0x51')](_0x212d81);}})[_0x2c93('0x29')](function(_0x58a881){if(_0x58a881){_0x23cc69=_0x58a881[_0x2c93('0x39')];if(!_0x50b50d[_0x2c93('0x34')][_0x2c93('0x3a')]('nolimit')){_0x212d81['limit']=qs[_0x2c93('0x21')](_0x50b50d[_0x2c93('0x34')][_0x2c93('0x21')]);_0x212d81['offset']=qs[_0x2c93('0x1f')](_0x50b50d[_0x2c93('0x34')][_0x2c93('0x1f')]);}return _0x3043d8[_0x2c93('0x51')](_0x212d81);}})[_0x2c93('0x29')](function(_0x53a90c){if(_0x53a90c){return _0x53a90c?{'count':_0x23cc69,'rows':_0x53a90c}:null;}})[_0x2c93('0x29')](respondWithResult(_0x526292,null))[_0x2c93('0x48')](handleError(_0x526292,null));};exports['getDescriptions']=function(_0x3a5e89,_0x1a5e50,_0x1861cd){var _0x55e2a2={};var _0x369cee={};var _0x1ba23a;var _0x3e833b;return db[_0x2c93('0x2f')][_0x2c93('0x52')]({'where':{'id':_0x3a5e89[_0x2c93('0x4a')]['id']}})[_0x2c93('0x29')](handleEntityNotFound(_0x1a5e50,null))['then'](function(_0x38a0b4){if(_0x38a0b4){_0x1ba23a=_0x38a0b4;_0x369cee['model']=_[_0x2c93('0x35')](db[_0x2c93('0x4f')][_0x2c93('0x30')]);_0x369cee['query']=_['keys'](_0x3a5e89[_0x2c93('0x34')]);_0x369cee[_0x2c93('0x3f')]=_[_0x2c93('0x36')](_0x369cee[_0x2c93('0x33')],_0x369cee[_0x2c93('0x34')]);_0x55e2a2[_0x2c93('0x38')]=_['intersection'](_0x369cee[_0x2c93('0x33')],qs[_0x2c93('0x37')](_0x3a5e89[_0x2c93('0x34')]['fields']));_0x55e2a2[_0x2c93('0x38')]=_0x55e2a2[_0x2c93('0x38')][_0x2c93('0x39')]?_0x55e2a2[_0x2c93('0x38')]:_0x369cee[_0x2c93('0x33')];_0x55e2a2[_0x2c93('0x3c')]=qs['sort'](_0x3a5e89[_0x2c93('0x34')][_0x2c93('0x3d')]);_0x55e2a2[_0x2c93('0x3e')]=qs[_0x2c93('0x3f')](_[_0x2c93('0x50')](_0x3a5e89[_0x2c93('0x34')],_0x369cee[_0x2c93('0x3f')]));if(_0x3a5e89[_0x2c93('0x34')]['filter']){_0x55e2a2[_0x2c93('0x3e')]=_[_0x2c93('0x42')](_0x55e2a2[_0x2c93('0x3e')],{'$or':_['map'](_0x55e2a2[_0x2c93('0x38')],function(_0x403fc5){var _0x450e3e={};_0x450e3e[_0x403fc5]={'$like':'%'+_0x3a5e89[_0x2c93('0x34')][_0x2c93('0x40')]+'%'};return _0x450e3e;})});}_0x55e2a2=_[_0x2c93('0x42')]({},_0x55e2a2,_0x3a5e89[_0x2c93('0x43')]);return _0x1ba23a[_0x2c93('0x53')](_0x55e2a2);}})['then'](function(_0x316f5d){if(_0x316f5d){_0x3e833b=_0x316f5d[_0x2c93('0x39')];if(!_0x3a5e89[_0x2c93('0x34')][_0x2c93('0x3a')](_0x2c93('0x3b'))){_0x55e2a2['limit']=qs['limit'](_0x3a5e89[_0x2c93('0x34')]['limit']);_0x55e2a2['offset']=qs[_0x2c93('0x1f')](_0x3a5e89[_0x2c93('0x34')][_0x2c93('0x1f')]);}return _0x1ba23a[_0x2c93('0x53')](_0x55e2a2);}})[_0x2c93('0x29')](function(_0x2da43c){if(_0x2da43c){return _0x2da43c?{'count':_0x3e833b,'rows':_0x2da43c}:null;}})[_0x2c93('0x29')](respondWithResult(_0x1a5e50,null))[_0x2c93('0x48')](handleError(_0x1a5e50,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 90aa1cb..ce91960 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 _0xc664=['int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var logger=require('../../config/logger')(_0x4c66('0x2'));var moment=require(_0x4c66('0x3'));var BPromise=require(_0x4c66('0x4'));var rp=require(_0x4c66('0x5'));var fs=require('fs');var path=require(_0x4c66('0x6'));var rimraf=require('rimraf');var config=require(_0x4c66('0x7'));var attributes=require(_0x4c66('0x8'));module[_0x4c66('0x9')]=function(_0x28a065,_0x4ecac0){return _0x28a065[_0x4c66('0xa')](_0x4c66('0xb'),attributes,{'tableName':_0x4c66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x4fc2,0x111));var _0x24fc=function(_0x2af84b,_0x18be67){_0x2af84b=_0x2af84b-0x0;var _0x5eaee2=_0x4fc2[_0x2af84b];return _0x5eaee2;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 56b7579..f52d9dd 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 _0x3432=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x50991d,_0x3a5139){var _0x339b26=function(_0x167b86){while(--_0x167b86){_0x50991d['push'](_0x50991d['shift']());}};_0x339b26(++_0x3a5139);}(_0x3432,0x182));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2343('0x0'));var util=require(_0x2343('0x1'));var moment=require(_0x2343('0x2'));var BPromise=require(_0x2343('0x3'));var rs=require(_0x2343('0x4'));var fs=require('fs');var Redis=require(_0x2343('0x5'));var db=require(_0x2343('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2343('0x7'))('rpc');var config=require(_0x2343('0x8'));var jayson=require(_0x2343('0x9'));var client=jayson['client'][_0x2343('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341acd,_0x31ac09,_0x40108a){return new BPromise(function(_0x1498d9,_0x4731b2){return client[_0x2343('0xb')](_0x341acd,_0x40108a)[_0x2343('0xc')](function(_0xa2aa37){logger[_0x2343('0xd')](_0x2343('0xe'),_0x31ac09,_0x2343('0xf'));logger[_0x2343('0x10')](_0x2343('0x11'),_0x31ac09,_0x2343('0xf'),JSON[_0x2343('0x12')](_0xa2aa37));if(_0xa2aa37[_0x2343('0x13')]){if(_0xa2aa37['error']['code']===0x1f4){logger[_0x2343('0x13')](_0x2343('0xe'),_0x31ac09,_0xa2aa37[_0x2343('0x13')][_0x2343('0x14')]);return _0x4731b2(_0xa2aa37[_0x2343('0x13')][_0x2343('0x14')]);}logger['error'](_0x2343('0xe'),_0x31ac09,_0xa2aa37[_0x2343('0x13')][_0x2343('0x14')]);return _0x1498d9(_0xa2aa37[_0x2343('0x13')][_0x2343('0x14')]);}else{logger[_0x2343('0xd')](_0x2343('0xe'),_0x31ac09,_0x2343('0xf'));_0x1498d9(_0xa2aa37[_0x2343('0x15')][_0x2343('0x14')]);}})[_0x2343('0x16')](function(_0x41a35b){logger[_0x2343('0x13')](_0x2343('0xe'),_0x31ac09,_0x41a35b);_0x4731b2(_0x41a35b);});});} \ No newline at end of file +var _0x2087=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4f11a1,_0x307c97){var _0x4a968f=function(_0x25b3bf){while(--_0x25b3bf){_0x4f11a1['push'](_0x4f11a1['shift']());}};_0x4a968f(++_0x307c97);}(_0x2087,0xf3));var _0x7208=function(_0x1b51f9,_0x46240e){_0x1b51f9=_0x1b51f9-0x0;var _0x46cf16=_0x2087[_0x1b51f9];return _0x46cf16;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var moment=require(_0x7208('0x2'));var BPromise=require(_0x7208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7208('0x4'));var db=require(_0x7208('0x5'))['db'];var utils=require(_0x7208('0x6'));var logger=require(_0x7208('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7208('0x8'));var client=jayson['client'][_0x7208('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502ccb,_0x238b30,_0x328f94){return new BPromise(function(_0x2bf5f4,_0x94a960){return client[_0x7208('0xa')](_0x502ccb,_0x328f94)[_0x7208('0xb')](function(_0x19501a){logger['info'](_0x7208('0xc'),_0x238b30,_0x7208('0xd'));logger[_0x7208('0xe')](_0x7208('0xf'),_0x238b30,_0x7208('0xd'),JSON[_0x7208('0x10')](_0x19501a));if(_0x19501a['error']){if(_0x19501a[_0x7208('0x11')][_0x7208('0x12')]===0x1f4){logger[_0x7208('0x11')](_0x7208('0xc'),_0x238b30,_0x19501a[_0x7208('0x11')][_0x7208('0x13')]);return _0x94a960(_0x19501a['error'][_0x7208('0x13')]);}logger[_0x7208('0x11')](_0x7208('0xc'),_0x238b30,_0x19501a[_0x7208('0x11')][_0x7208('0x13')]);return _0x2bf5f4(_0x19501a[_0x7208('0x11')][_0x7208('0x13')]);}else{logger[_0x7208('0x14')](_0x7208('0xc'),_0x238b30,_0x7208('0xd'));_0x2bf5f4(_0x19501a[_0x7208('0x15')]['message']);}})['catch'](function(_0x5a7b8d){logger[_0x7208('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x238b30,_0x5a7b8d);_0x94a960(_0x5a7b8d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 82cbd02..c9b627c 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 _0x845b=['Router','../../components/interaction/service','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3f7281,_0x2a01d3){var _0x3aeb10=function(_0x45702f){while(--_0x45702f){_0x3f7281['push'](_0x3f7281['shift']());}};_0x3aeb10(++_0x2a01d3);}(_0x845b,0xf8));var _0xb845=function(_0x3032e2,_0x26a4e8){_0x3032e2=_0x3032e2-0x0;var _0x427aef=_0x845b[_0x3032e2];return _0x427aef;};'use strict';var multer=require(_0xb845('0x0'));var util=require(_0xb845('0x1'));var path=require(_0xb845('0x2'));var timeout=require(_0xb845('0x3'));var express=require('express');var router=express[_0xb845('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb845('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xb845('0x6')]('/',auth['isAuthenticated'](),controller[_0xb845('0x7')]);router[_0xb845('0x6')](_0xb845('0x8'),auth['isAuthenticated'](),controller[_0xb845('0x9')]);router[_0xb845('0xa')]('/',auth[_0xb845('0xb')](),controller[_0xb845('0xc')]);router[_0xb845('0xd')](_0xb845('0x8'),auth[_0xb845('0xb')](),controller[_0xb845('0xe')]);router[_0xb845('0xf')](_0xb845('0x8'),auth[_0xb845('0xb')](),controller[_0xb845('0x10')]);module[_0xb845('0x11')]=router; \ No newline at end of file +var _0xabf0=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','post','create','delete','/:id','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xabf0,0xb0));var _0x0abf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xabf0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0abf('0x0'));var util=require(_0x0abf('0x1'));var path=require(_0x0abf('0x2'));var timeout=require(_0x0abf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0abf('0x4'));var interaction=require(_0x0abf('0x5'));var config=require(_0x0abf('0x6'));var controller=require(_0x0abf('0x7'));router[_0x0abf('0x8')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0xa')]);router[_0x0abf('0x8')]('/:id',auth[_0x0abf('0x9')](),controller['show']);router[_0x0abf('0xb')]('/',auth[_0x0abf('0x9')](),controller[_0x0abf('0xc')]);router['put']('/:id',auth[_0x0abf('0x9')](),controller['update']);router[_0x0abf('0xd')](_0x0abf('0xe'),auth[_0x0abf('0x9')](),controller['destroy']);module[_0x0abf('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e12d1c9..10e0ce8 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 _0xafd0=['ENUM','string','variable','customVariable','picklist','STRING','sequelize','exports'];(function(_0x361fbf,_0xd5c950){var _0x39b304=function(_0x425a85){while(--_0x425a85){_0x361fbf['push'](_0x361fbf['shift']());}};_0x39b304(++_0xd5c950);}(_0xafd0,0xbe));var _0x0afd=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xafd0[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x0afd('0x0'));module[_0x0afd('0x1')]={'type':{'type':Sequelize[_0x0afd('0x2')](_0x0afd('0x3'),_0x0afd('0x4'),_0x0afd('0x5'),'keyValue',_0x0afd('0x6')),'defaultValue':_0x0afd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0afd('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0afd('0x3'),_0x0afd('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x0afd('0x7')]},'idField':{'type':Sequelize[_0x0afd('0x7')]},'nameField':{'type':Sequelize[_0x0afd('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0afd('0x7')]}}; \ No newline at end of file +var _0xc445=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xc445,0xc5));var _0x5c44=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xc445[_0x120376];return _0x28c529;};'use strict';var Sequelize=require(_0x5c44('0x0'));module[_0x5c44('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5c44('0x2'),_0x5c44('0x3'),_0x5c44('0x4'),_0x5c44('0x5'),'picklist'),'defaultValue':_0x5c44('0x2')},'content':{'type':Sequelize[_0x5c44('0x6')]},'key':{'type':Sequelize[_0x5c44('0x6')]},'keyType':{'type':Sequelize[_0x5c44('0x7')](_0x5c44('0x2'),_0x5c44('0x3'),_0x5c44('0x4'))},'keyContent':{'type':Sequelize[_0x5c44('0x6')]},'idField':{'type':Sequelize[_0x5c44('0x6')]},'nameField':{'type':Sequelize[_0x5c44('0x6')]},'customField':{'type':Sequelize[_0x5c44('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5c44('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a167406..c51cf7d 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 _0x2c3a=['fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','rimraf','zip-dir'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2c3a,0x12a));var _0xa2c3=function(_0x3719e0,_0x1ab27d){_0x3719e0=_0x3719e0-0x0;var _0x5245e9=_0x2c3a[_0x3719e0];return _0x5245e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2c3('0x0'));var zipdir=require(_0xa2c3('0x1'));var jsonpatch=require(_0xa2c3('0x2'));var rp=require('request-promise');var moment=require(_0xa2c3('0x3'));var BPromise=require(_0xa2c3('0x4'));var Mustache=require('mustache');var util=require(_0xa2c3('0x5'));var path=require(_0xa2c3('0x6'));var sox=require(_0xa2c3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2c3('0x8'));var _=require(_0xa2c3('0x9'));var squel=require(_0xa2c3('0xa'));var crypto=require(_0xa2c3('0xb'));var jsforce=require(_0xa2c3('0xc'));var deskjs=require(_0xa2c3('0xd'));var toCsv=require(_0xa2c3('0xe'));var querystring=require(_0xa2c3('0xf'));var Papa=require('papaparse');var Redis=require(_0xa2c3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa2c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa2c3('0x12'));var logger=require('../../config/logger')(_0xa2c3('0x13'));var utils=require('../../config/utils');var config=require(_0xa2c3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2c3('0x15'))['db'];function respondWithStatusCode(_0x54f641,_0x1ad95a){_0x1ad95a=_0x1ad95a||0xcc;return function(_0x1c9aca){if(_0x1c9aca){return _0x54f641[_0xa2c3('0x16')](_0x1ad95a);}return _0x54f641['status'](_0x1ad95a)[_0xa2c3('0x17')]();};}function respondWithResult(_0xe44bd4,_0x3fd5bd){_0x3fd5bd=_0x3fd5bd||0xc8;return function(_0x47bdc6){if(_0x47bdc6){return _0xe44bd4[_0xa2c3('0x18')](_0x3fd5bd)[_0xa2c3('0x19')](_0x47bdc6);}};}function respondWithFilteredResult(_0xb055f3,_0x57ca77){return function(_0x1095e1){if(_0x1095e1){var _0x83d58e=typeof _0x57ca77['offset']==='undefined'&&typeof _0x57ca77[_0xa2c3('0x1a')]==='undefined';var _0x579de1=_0x1095e1[_0xa2c3('0x1b')];var _0x431fb3=_0x83d58e?0x0:_0x57ca77[_0xa2c3('0x1c')];var _0x1e2cbb=_0x83d58e?_0x1095e1[_0xa2c3('0x1b')]:_0x57ca77[_0xa2c3('0x1c')]+_0x57ca77[_0xa2c3('0x1a')];var _0x4653de;if(_0x1e2cbb>=_0x579de1){_0x1e2cbb=_0x579de1;_0x4653de=0xc8;}else{_0x4653de=0xce;}_0xb055f3['status'](_0x4653de);return _0xb055f3[_0xa2c3('0x1d')](_0xa2c3('0x1e'),_0x431fb3+'-'+_0x1e2cbb+'/'+_0x579de1)[_0xa2c3('0x19')](_0x1095e1);}return null;};}function patchUpdates(_0x44616a){return function(_0x142a43){try{jsonpatch[_0xa2c3('0x1f')](_0x142a43,_0x44616a,!![]);}catch(_0x23ff94){return BPromise[_0xa2c3('0x20')](_0x23ff94);}return _0x142a43['save']();};}function saveUpdates(_0x3d1e64,_0x5cf053){return function(_0x75fa){if(_0x75fa){return _0x75fa[_0xa2c3('0x21')](_0x3d1e64)[_0xa2c3('0x22')](function(_0x1465a9){return _0x1465a9;});}return null;};}function removeEntity(_0x57d147,_0x19e141){return function(_0x365083){if(_0x365083){return _0x365083['destroy']()[_0xa2c3('0x22')](function(){_0x57d147[_0xa2c3('0x18')](0xcc)[_0xa2c3('0x17')]();});}};}function handleEntityNotFound(_0x2f837,_0x3fc7a4){return function(_0x28fbc1){if(!_0x28fbc1){_0x2f837['sendStatus'](0x194);}return _0x28fbc1;};}function handleError(_0x3c5a2d,_0x2b2b9d){_0x2b2b9d=_0x2b2b9d||0x1f4;return function(_0x52edda){logger[_0xa2c3('0x23')](_0x52edda[_0xa2c3('0x24')]);if(_0x52edda['name']){delete _0x52edda[_0xa2c3('0x25')];}_0x3c5a2d[_0xa2c3('0x18')](_0x2b2b9d)[_0xa2c3('0x26')](_0x52edda);};}exports[_0xa2c3('0x27')]=function(_0x535326,_0x23f534){var _0x188466={},_0x211780={},_0x18b1f6={'count':0x0,'rows':[]};var _0x3750ef=_[_0xa2c3('0x28')](db[_0xa2c3('0x29')][_0xa2c3('0x2a')],function(_0x2713d3){return{'name':_0x2713d3[_0xa2c3('0x2b')],'type':_0x2713d3[_0xa2c3('0x2c')][_0xa2c3('0x2d')]};});_0x211780['model']=_[_0xa2c3('0x28')](_0x3750ef,_0xa2c3('0x25'));_0x211780[_0xa2c3('0x2e')]=_['keys'](_0x535326['query']);_0x211780[_0xa2c3('0x2f')]=_[_0xa2c3('0x30')](_0x211780[_0xa2c3('0x31')],_0x211780['query']);_0x188466[_0xa2c3('0x32')]=_[_0xa2c3('0x30')](_0x211780[_0xa2c3('0x31')],qs[_0xa2c3('0x33')](_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x33')]));_0x188466[_0xa2c3('0x32')]=_0x188466['attributes'][_0xa2c3('0x34')]?_0x188466[_0xa2c3('0x32')]:_0x211780['model'];if(!_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x35')](_0xa2c3('0x36'))){_0x188466[_0xa2c3('0x1a')]=qs[_0xa2c3('0x1a')](_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x1a')]);_0x188466['offset']=qs[_0xa2c3('0x1c')](_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x1c')]);}_0x188466[_0xa2c3('0x37')]=qs[_0xa2c3('0x38')](_0x535326[_0xa2c3('0x2e')]['sort']);_0x188466[_0xa2c3('0x39')]=qs[_0xa2c3('0x2f')](_[_0xa2c3('0x3a')](_0x535326[_0xa2c3('0x2e')],_0x211780[_0xa2c3('0x2f')]),_0x3750ef);if(_0x535326['query'][_0xa2c3('0x3b')]){_0x188466['where']=_[_0xa2c3('0x3c')](_0x188466[_0xa2c3('0x39')],{'$or':_[_0xa2c3('0x28')](_0x3750ef,function(_0x254643){if(_0x254643[_0xa2c3('0x2c')]!==_0xa2c3('0x3d')){var _0x9c7341={};_0x9c7341[_0x254643[_0xa2c3('0x25')]]={'$like':'%'+_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x3b')]+'%'};return _0x9c7341;}})});}_0x188466=_[_0xa2c3('0x3c')]({},_0x188466,_0x535326[_0xa2c3('0x3e')]);var _0x5672ec={'where':_0x188466['where']};return db['ServicenowField'][_0xa2c3('0x1b')](_0x5672ec)[_0xa2c3('0x22')](function(_0x5ea3ef){_0x18b1f6[_0xa2c3('0x1b')]=_0x5ea3ef;if(_0x535326[_0xa2c3('0x2e')][_0xa2c3('0x3f')]){_0x188466['include']=[{'all':!![]}];}return db[_0xa2c3('0x29')][_0xa2c3('0x40')](_0x188466);})['then'](function(_0x1a2b5a){_0x18b1f6[_0xa2c3('0x41')]=_0x1a2b5a;return _0x18b1f6;})[_0xa2c3('0x22')](respondWithFilteredResult(_0x23f534,_0x188466))[_0xa2c3('0x42')](handleError(_0x23f534,null));};exports[_0xa2c3('0x43')]=function(_0x14b452,_0x367977){var _0x2dd393={'raw':!![],'where':{'id':_0x14b452[_0xa2c3('0x44')]['id']}},_0x414ee3={};_0x414ee3[_0xa2c3('0x31')]=_['keys'](db['ServicenowField'][_0xa2c3('0x2a')]);_0x414ee3['query']=_[_0xa2c3('0x45')](_0x14b452[_0xa2c3('0x2e')]);_0x414ee3[_0xa2c3('0x2f')]=_[_0xa2c3('0x30')](_0x414ee3['model'],_0x414ee3['query']);_0x2dd393[_0xa2c3('0x32')]=_[_0xa2c3('0x30')](_0x414ee3[_0xa2c3('0x31')],qs[_0xa2c3('0x33')](_0x14b452['query'][_0xa2c3('0x33')]));_0x2dd393[_0xa2c3('0x32')]=_0x2dd393[_0xa2c3('0x32')][_0xa2c3('0x34')]?_0x2dd393[_0xa2c3('0x32')]:_0x414ee3[_0xa2c3('0x31')];if(_0x14b452[_0xa2c3('0x2e')][_0xa2c3('0x3f')]){_0x2dd393[_0xa2c3('0x46')]=[{'all':!![]}];}_0x2dd393=_['merge']({},_0x2dd393,_0x14b452[_0xa2c3('0x3e')]);return db['ServicenowField'][_0xa2c3('0x47')](_0x2dd393)['then'](handleEntityNotFound(_0x367977,null))[_0xa2c3('0x22')](respondWithResult(_0x367977,null))[_0xa2c3('0x42')](handleError(_0x367977,null));};exports[_0xa2c3('0x48')]=function(_0x2ee1d1,_0x3c22f7){return db[_0xa2c3('0x29')][_0xa2c3('0x48')](_0x2ee1d1[_0xa2c3('0x49')],{})[_0xa2c3('0x22')](respondWithResult(_0x3c22f7,0xc9))[_0xa2c3('0x42')](handleError(_0x3c22f7,null));};exports[_0xa2c3('0x21')]=function(_0x404707,_0x1d10bb){if(_0x404707[_0xa2c3('0x49')]['id']){delete _0x404707[_0xa2c3('0x49')]['id'];}return db[_0xa2c3('0x29')][_0xa2c3('0x47')]({'where':{'id':_0x404707[_0xa2c3('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d10bb,null))[_0xa2c3('0x22')](saveUpdates(_0x404707[_0xa2c3('0x49')],null))[_0xa2c3('0x22')](respondWithResult(_0x1d10bb,null))[_0xa2c3('0x42')](handleError(_0x1d10bb,null));};exports[_0xa2c3('0x4a')]=function(_0x48ee30,_0x489b1b){return db[_0xa2c3('0x29')][_0xa2c3('0x47')]({'where':{'id':_0x48ee30[_0xa2c3('0x44')]['id']}})[_0xa2c3('0x22')](handleEntityNotFound(_0x489b1b,null))['then'](removeEntity(_0x489b1b,null))[_0xa2c3('0x42')](handleError(_0x489b1b,null));}; \ No newline at end of file +var _0xe82e=['options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x17c0a0,_0x173be3){var _0x3dba06=function(_0x3064b2){while(--_0x3064b2){_0x17c0a0['push'](_0x17c0a0['shift']());}};_0x3dba06(++_0x173be3);}(_0xe82e,0x18c));var _0xee82=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe82e[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0xee82('0x0'));var rimraf=require(_0xee82('0x1'));var zipdir=require(_0xee82('0x2'));var jsonpatch=require(_0xee82('0x3'));var rp=require('request-promise');var moment=require(_0xee82('0x4'));var BPromise=require(_0xee82('0x5'));var Mustache=require('mustache');var util=require(_0xee82('0x6'));var path=require(_0xee82('0x7'));var sox=require(_0xee82('0x8'));var csv=require(_0xee82('0x9'));var ejs=require(_0xee82('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee82('0xb'));var squel=require(_0xee82('0xc'));var crypto=require(_0xee82('0xd'));var jsforce=require(_0xee82('0xe'));var deskjs=require(_0xee82('0xf'));var toCsv=require(_0xee82('0x9'));var querystring=require(_0xee82('0x10'));var Papa=require('papaparse');var Redis=require(_0xee82('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee82('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee82('0x13'));var logger=require(_0xee82('0x14'))(_0xee82('0x15'));var utils=require('../../config/utils');var config=require(_0xee82('0x16'));var licenseUtil=require(_0xee82('0x17'));var db=require(_0xee82('0x18'))['db'];function respondWithStatusCode(_0x50d30e,_0x3bd890){_0x3bd890=_0x3bd890||0xcc;return function(_0x1ec125){if(_0x1ec125){return _0x50d30e[_0xee82('0x19')](_0x3bd890);}return _0x50d30e['status'](_0x3bd890)[_0xee82('0x1a')]();};}function respondWithResult(_0x2a60b2,_0x4b63f4){_0x4b63f4=_0x4b63f4||0xc8;return function(_0x13c138){if(_0x13c138){return _0x2a60b2[_0xee82('0x1b')](_0x4b63f4)[_0xee82('0x1c')](_0x13c138);}};}function respondWithFilteredResult(_0xeb615c,_0xf63714){return function(_0x549c73){if(_0x549c73){var _0x1fd836=typeof _0xf63714[_0xee82('0x1d')]===_0xee82('0x1e')&&typeof _0xf63714[_0xee82('0x1f')]===_0xee82('0x1e');var _0xe59770=_0x549c73[_0xee82('0x20')];var _0x5614fd=_0x1fd836?0x0:_0xf63714[_0xee82('0x1d')];var _0x24f6d4=_0x1fd836?_0x549c73[_0xee82('0x20')]:_0xf63714[_0xee82('0x1d')]+_0xf63714[_0xee82('0x1f')];var _0x4f7831;if(_0x24f6d4>=_0xe59770){_0x24f6d4=_0xe59770;_0x4f7831=0xc8;}else{_0x4f7831=0xce;}_0xeb615c['status'](_0x4f7831);return _0xeb615c[_0xee82('0x21')](_0xee82('0x22'),_0x5614fd+'-'+_0x24f6d4+'/'+_0xe59770)[_0xee82('0x1c')](_0x549c73);}return null;};}function patchUpdates(_0x58d550){return function(_0x4a26db){try{jsonpatch['apply'](_0x4a26db,_0x58d550,!![]);}catch(_0x289c3c){return BPromise[_0xee82('0x23')](_0x289c3c);}return _0x4a26db['save']();};}function saveUpdates(_0xa8282b,_0x27c4ef){return function(_0x136614){if(_0x136614){return _0x136614[_0xee82('0x24')](_0xa8282b)[_0xee82('0x25')](function(_0x13a729){return _0x13a729;});}return null;};}function removeEntity(_0x442cc,_0xcf7c39){return function(_0x53c8af){if(_0x53c8af){return _0x53c8af['destroy']()['then'](function(){_0x442cc['status'](0xcc)[_0xee82('0x1a')]();});}};}function handleEntityNotFound(_0x29dfd4,_0x458b9e){return function(_0x5ec99d){if(!_0x5ec99d){_0x29dfd4['sendStatus'](0x194);}return _0x5ec99d;};}function handleError(_0x19669f,_0x1d45d2){_0x1d45d2=_0x1d45d2||0x1f4;return function(_0x512cde){logger[_0xee82('0x26')](_0x512cde[_0xee82('0x27')]);if(_0x512cde[_0xee82('0x28')]){delete _0x512cde[_0xee82('0x28')];}_0x19669f[_0xee82('0x1b')](_0x1d45d2)[_0xee82('0x29')](_0x512cde);};}exports[_0xee82('0x2a')]=function(_0x5ccde9,_0x520783){var _0xa24184={},_0x48dbfa={},_0x29b135={'count':0x0,'rows':[]};var _0x43ec62=_[_0xee82('0x2b')](db[_0xee82('0x2c')][_0xee82('0x2d')],function(_0x23b43a){return{'name':_0x23b43a[_0xee82('0x2e')],'type':_0x23b43a[_0xee82('0x2f')][_0xee82('0x30')]};});_0x48dbfa[_0xee82('0x31')]=_[_0xee82('0x2b')](_0x43ec62,_0xee82('0x28'));_0x48dbfa['query']=_[_0xee82('0x32')](_0x5ccde9[_0xee82('0x33')]);_0x48dbfa[_0xee82('0x34')]=_[_0xee82('0x35')](_0x48dbfa['model'],_0x48dbfa[_0xee82('0x33')]);_0xa24184[_0xee82('0x36')]=_['intersection'](_0x48dbfa[_0xee82('0x31')],qs['fields'](_0x5ccde9[_0xee82('0x33')][_0xee82('0x37')]));_0xa24184[_0xee82('0x36')]=_0xa24184[_0xee82('0x36')][_0xee82('0x38')]?_0xa24184[_0xee82('0x36')]:_0x48dbfa[_0xee82('0x31')];if(!_0x5ccde9[_0xee82('0x33')][_0xee82('0x39')](_0xee82('0x3a'))){_0xa24184[_0xee82('0x1f')]=qs[_0xee82('0x1f')](_0x5ccde9['query'][_0xee82('0x1f')]);_0xa24184['offset']=qs[_0xee82('0x1d')](_0x5ccde9[_0xee82('0x33')]['offset']);}_0xa24184[_0xee82('0x3b')]=qs[_0xee82('0x3c')](_0x5ccde9[_0xee82('0x33')][_0xee82('0x3c')]);_0xa24184['where']=qs[_0xee82('0x34')](_[_0xee82('0x3d')](_0x5ccde9['query'],_0x48dbfa[_0xee82('0x34')]),_0x43ec62);if(_0x5ccde9[_0xee82('0x33')][_0xee82('0x3e')]){_0xa24184[_0xee82('0x3f')]=_[_0xee82('0x40')](_0xa24184[_0xee82('0x3f')],{'$or':_[_0xee82('0x2b')](_0x43ec62,function(_0x3b121c){if(_0x3b121c['type']!==_0xee82('0x41')){var _0x360fee={};_0x360fee[_0x3b121c['name']]={'$like':'%'+_0x5ccde9[_0xee82('0x33')]['filter']+'%'};return _0x360fee;}})});}_0xa24184=_['merge']({},_0xa24184,_0x5ccde9[_0xee82('0x42')]);var _0x317a5c={'where':_0xa24184['where']};return db[_0xee82('0x2c')][_0xee82('0x20')](_0x317a5c)[_0xee82('0x25')](function(_0xf3e55){_0x29b135[_0xee82('0x20')]=_0xf3e55;if(_0x5ccde9[_0xee82('0x33')][_0xee82('0x43')]){_0xa24184['include']=[{'all':!![]}];}return db['ServicenowField'][_0xee82('0x44')](_0xa24184);})[_0xee82('0x25')](function(_0x4ada8d){_0x29b135[_0xee82('0x45')]=_0x4ada8d;return _0x29b135;})[_0xee82('0x25')](respondWithFilteredResult(_0x520783,_0xa24184))[_0xee82('0x46')](handleError(_0x520783,null));};exports[_0xee82('0x47')]=function(_0x237d00,_0x5e19ea){var _0x2c3238={'raw':!![],'where':{'id':_0x237d00[_0xee82('0x48')]['id']}},_0x1c71d8={};_0x1c71d8['model']=_['keys'](db[_0xee82('0x2c')][_0xee82('0x2d')]);_0x1c71d8[_0xee82('0x33')]=_[_0xee82('0x32')](_0x237d00[_0xee82('0x33')]);_0x1c71d8[_0xee82('0x34')]=_[_0xee82('0x35')](_0x1c71d8[_0xee82('0x31')],_0x1c71d8[_0xee82('0x33')]);_0x2c3238[_0xee82('0x36')]=_['intersection'](_0x1c71d8[_0xee82('0x31')],qs[_0xee82('0x37')](_0x237d00[_0xee82('0x33')][_0xee82('0x37')]));_0x2c3238[_0xee82('0x36')]=_0x2c3238[_0xee82('0x36')]['length']?_0x2c3238[_0xee82('0x36')]:_0x1c71d8[_0xee82('0x31')];if(_0x237d00[_0xee82('0x33')][_0xee82('0x43')]){_0x2c3238['include']=[{'all':!![]}];}_0x2c3238=_['merge']({},_0x2c3238,_0x237d00[_0xee82('0x42')]);return db[_0xee82('0x2c')][_0xee82('0x49')](_0x2c3238)[_0xee82('0x25')](handleEntityNotFound(_0x5e19ea,null))[_0xee82('0x25')](respondWithResult(_0x5e19ea,null))[_0xee82('0x46')](handleError(_0x5e19ea,null));};exports[_0xee82('0x4a')]=function(_0x1a8834,_0x2ae0ab){return db[_0xee82('0x2c')]['create'](_0x1a8834[_0xee82('0x4b')],{})[_0xee82('0x25')](respondWithResult(_0x2ae0ab,0xc9))[_0xee82('0x46')](handleError(_0x2ae0ab,null));};exports[_0xee82('0x24')]=function(_0x3414a6,_0x49320e){if(_0x3414a6['body']['id']){delete _0x3414a6['body']['id'];}return db[_0xee82('0x2c')]['find']({'where':{'id':_0x3414a6['params']['id']}})[_0xee82('0x25')](handleEntityNotFound(_0x49320e,null))['then'](saveUpdates(_0x3414a6['body'],null))[_0xee82('0x25')](respondWithResult(_0x49320e,null))[_0xee82('0x46')](handleError(_0x49320e,null));};exports[_0xee82('0x4c')]=function(_0x535985,_0x510192){return db[_0xee82('0x2c')]['find']({'where':{'id':_0x535985[_0xee82('0x48')]['id']}})['then'](handleEntityNotFound(_0x510192,null))['then'](removeEntity(_0x510192,null))['catch'](handleError(_0x510192,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c5f93de..60a0348 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 _0x801a=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId'];(function(_0x416137,_0x292739){var _0x35b486=function(_0x2d4157){while(--_0x2d4157){_0x416137['push'](_0x416137['shift']());}};_0x35b486(++_0x292739);}(_0x801a,0x68));var _0xa801=function(_0x263028,_0x19a701){_0x263028=_0x263028-0x0;var _0x5daa45=_0x801a[_0x263028];return _0x5daa45;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var logger=require('../../config/logger')(_0xa801('0x2'));var moment=require(_0xa801('0x3'));var BPromise=require('bluebird');var rp=require(_0xa801('0x4'));var fs=require('fs');var path=require(_0xa801('0x5'));var rimraf=require(_0xa801('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0xa801('0x7')]=function(_0x4a8907,_0x18a8ed){return _0x4a8907[_0xa801('0x8')](_0xa801('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xa801('0xa'),'fields':[_0xa801('0xb'),_0xa801('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0880=['servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0880,0x16b));var _0x0088=function(_0x1fd441,_0x2629bf){_0x1fd441=_0x1fd441-0x0;var _0x411a91=_0x0880[_0x1fd441];return _0x411a91;};'use strict';var _=require(_0x0088('0x0'));var util=require(_0x0088('0x1'));var logger=require('../../config/logger')(_0x0088('0x2'));var moment=require(_0x0088('0x3'));var BPromise=require(_0x0088('0x4'));var rp=require(_0x0088('0x5'));var fs=require('fs');var path=require(_0x0088('0x6'));var rimraf=require('rimraf');var config=require(_0x0088('0x7'));var attributes=require(_0x0088('0x8'));module[_0x0088('0x9')]=function(_0x2d302c,_0x4b22e8){return _0x2d302c[_0x0088('0xa')](_0x0088('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0088('0xc'),'fields':[_0x0088('0xd'),_0x0088('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c7c9e30..c6215fb 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xebc67f,_0x60d7e9){var _0x470697=function(_0x3d78a2){while(--_0x3d78a2){_0xebc67f['push'](_0xebc67f['shift']());}};_0x470697(++_0x60d7e9);}(_0xe706,0xa3));var _0x6e70=function(_0x4bdcd8,_0x5b4cd6){_0x4bdcd8=_0x4bdcd8-0x0;var _0x2bf60=_0xe706[_0x4bdcd8];return _0x2bf60;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4e28c0,_0x1ef470){var _0x4039d4=function(_0x740feb){while(--_0x740feb){_0x4e28c0['push'](_0x4e28c0['shift']());}};_0x4039d4(++_0x1ef470);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3ca829,_0x12a3cf){_0x3ca829=_0x3ca829-0x0;var _0x325bdb=_0xf4eb[_0x3ca829];return _0x325bdb;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6f81362..fbcb769 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(_0x23cb62,_0x11a6fd){var _0x483ff9=function(_0x4be1c8){while(--_0x4be1c8){_0x23cb62['push'](_0x23cb62['shift']());}};_0x483ff9(++_0x11a6fd);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x341bab,_0xf9a5e5){var _0x2e905e=function(_0x153452){while(--_0x153452){_0x341bab['push'](_0x341bab['shift']());}};_0x2e905e(++_0xf9a5e5);}(_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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 40e744b..0cf5029 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(_0x1fce1c,_0x381f65){var _0x4c7bfd=function(_0x112e20){while(--_0x112e20){_0x1fce1c['push'](_0x1fce1c['shift']());}};_0x4c7bfd(++_0x381f65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x26b0e2,_0x51c8ef){var _0x2ed0d2=function(_0x196709){while(--_0x196709){_0x26b0e2['push'](_0x26b0e2['shift']());}};_0x2ed0d2(++_0x51c8ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 e6a744d..62093dc 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 _0xe14c=['key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','catch','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','getSubjects','Descriptions','channel','Subjects','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','module_fields','remove','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type'];(function(_0x531c31,_0x30804e){var _0x234a39=function(_0x38f39f){while(--_0x38f39f){_0x531c31['push'](_0x531c31['shift']());}};_0x234a39(++_0x30804e);}(_0xe14c,0x1a1));var _0xce14=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe14c[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce14('0x0'));var zipdir=require(_0xce14('0x1'));var jsonpatch=require(_0xce14('0x2'));var rp=require(_0xce14('0x3'));var moment=require('moment');var BPromise=require(_0xce14('0x4'));var Mustache=require('mustache');var util=require(_0xce14('0x5'));var path=require('path');var sox=require(_0xce14('0x6'));var csv=require('to-csv');var ejs=require(_0xce14('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xce14('0x8'));var crypto=require(_0xce14('0x9'));var jsforce=require(_0xce14('0xa'));var deskjs=require(_0xce14('0xb'));var toCsv=require(_0xce14('0xc'));var querystring=require('querystring');var Papa=require(_0xce14('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce14('0xe'));var hardwareService=require(_0xce14('0xf'));var logger=require(_0xce14('0x10'))(_0xce14('0x11'));var utils=require(_0xce14('0x12'));var config=require(_0xce14('0x13'));var licenseUtil=require(_0xce14('0x14'));var db=require(_0xce14('0x15'))['db'];var integrations=require(_0xce14('0x16'));function respondWithStatusCode(_0x2182c6,_0x17f000){_0x17f000=_0x17f000||0xcc;return function(_0x2ee332){if(_0x2ee332){return _0x2182c6[_0xce14('0x17')](_0x17f000);}return _0x2182c6[_0xce14('0x18')](_0x17f000)[_0xce14('0x19')]();};}function respondWithResult(_0x4482bf,_0x36465b){_0x36465b=_0x36465b||0xc8;return function(_0x5db215){if(_0x5db215){return _0x4482bf[_0xce14('0x18')](_0x36465b)[_0xce14('0x1a')](_0x5db215);}};}function respondWithFilteredResult(_0x53cd37,_0x318f1d){return function(_0x521e2c){if(_0x521e2c){var _0x1bb471=typeof _0x318f1d[_0xce14('0x1b')]===_0xce14('0x1c')&&typeof _0x318f1d[_0xce14('0x1d')]==='undefined';var _0x337f82=_0x521e2c[_0xce14('0x1e')];var _0x10e991=_0x1bb471?0x0:_0x318f1d[_0xce14('0x1b')];var _0x25dfc1=_0x1bb471?_0x521e2c[_0xce14('0x1e')]:_0x318f1d[_0xce14('0x1b')]+_0x318f1d[_0xce14('0x1d')];var _0x100a61;if(_0x25dfc1>=_0x337f82){_0x25dfc1=_0x337f82;_0x100a61=0xc8;}else{_0x100a61=0xce;}_0x53cd37[_0xce14('0x18')](_0x100a61);return _0x53cd37[_0xce14('0x1f')](_0xce14('0x20'),_0x10e991+'-'+_0x25dfc1+'/'+_0x337f82)[_0xce14('0x1a')](_0x521e2c);}return null;};}function patchUpdates(_0x22cb30){return function(_0x16686d){try{jsonpatch['apply'](_0x16686d,_0x22cb30,!![]);}catch(_0x21727f){return BPromise[_0xce14('0x21')](_0x21727f);}return _0x16686d[_0xce14('0x22')]();};}function saveUpdates(_0x29f29d,_0x3c536b){return function(_0x48f55d){if(_0x48f55d){return _0x48f55d[_0xce14('0x23')](_0x29f29d)[_0xce14('0x24')](function(_0x383577){return _0x383577;});}return null;};}function removeEntity(_0x36bb9d,_0x4bc0e7){return function(_0x274d78){if(_0x274d78){return _0x274d78[_0xce14('0x25')]()[_0xce14('0x24')](function(){_0x36bb9d[_0xce14('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545e61,_0x4208fb){return function(_0x337f6f){if(!_0x337f6f){_0x545e61[_0xce14('0x17')](0x194);}return _0x337f6f;};}function handleError(_0x33c4c0,_0x48ab47){_0x48ab47=_0x48ab47||0x1f4;return function(_0x418ee3){logger[_0xce14('0x26')](_0x418ee3[_0xce14('0x27')]);if(_0x418ee3['name']){delete _0x418ee3[_0xce14('0x28')];}_0x33c4c0[_0xce14('0x18')](_0x48ab47)[_0xce14('0x29')](_0x418ee3);};}exports['index']=function(_0x560e6d,_0x1452f5){var _0x2c8ddc={},_0x2bc8fd={},_0x2140a7={'count':0x0,'rows':[]};var _0x5992dd=_[_0xce14('0x2a')](db[_0xce14('0x2b')][_0xce14('0x2c')],function(_0x2d5db0){return{'name':_0x2d5db0[_0xce14('0x2d')],'type':_0x2d5db0[_0xce14('0x2e')][_0xce14('0x2f')]};});_0x2bc8fd['model']=_['map'](_0x5992dd,_0xce14('0x28'));_0x2bc8fd['query']=_[_0xce14('0x30')](_0x560e6d[_0xce14('0x31')]);_0x2bc8fd[_0xce14('0x32')]=_[_0xce14('0x33')](_0x2bc8fd[_0xce14('0x34')],_0x2bc8fd[_0xce14('0x31')]);_0x2c8ddc['attributes']=_[_0xce14('0x33')](_0x2bc8fd[_0xce14('0x34')],qs[_0xce14('0x35')](_0x560e6d[_0xce14('0x31')][_0xce14('0x35')]));_0x2c8ddc[_0xce14('0x36')]=_0x2c8ddc[_0xce14('0x36')][_0xce14('0x37')]?_0x2c8ddc[_0xce14('0x36')]:_0x2bc8fd[_0xce14('0x34')];if(!_0x560e6d[_0xce14('0x31')][_0xce14('0x38')](_0xce14('0x39'))){_0x2c8ddc['limit']=qs[_0xce14('0x1d')](_0x560e6d[_0xce14('0x31')][_0xce14('0x1d')]);_0x2c8ddc['offset']=qs[_0xce14('0x1b')](_0x560e6d[_0xce14('0x31')][_0xce14('0x1b')]);}_0x2c8ddc[_0xce14('0x3a')]=qs[_0xce14('0x3b')](_0x560e6d[_0xce14('0x31')][_0xce14('0x3b')]);_0x2c8ddc[_0xce14('0x3c')]=qs[_0xce14('0x32')](_[_0xce14('0x3d')](_0x560e6d['query'],_0x2bc8fd[_0xce14('0x32')]),_0x5992dd);if(_0x560e6d[_0xce14('0x31')][_0xce14('0x3e')]){_0x2c8ddc[_0xce14('0x3c')]=_['merge'](_0x2c8ddc[_0xce14('0x3c')],{'$or':_['map'](_0x5992dd,function(_0x142099){if(_0x142099[_0xce14('0x2e')]!==_0xce14('0x3f')){var _0x361966={};_0x361966[_0x142099[_0xce14('0x28')]]={'$like':'%'+_0x560e6d['query'][_0xce14('0x3e')]+'%'};return _0x361966;}})});}_0x2c8ddc=_[_0xce14('0x40')]({},_0x2c8ddc,_0x560e6d[_0xce14('0x41')]);var _0x5bb7d5={'where':_0x2c8ddc[_0xce14('0x3c')]};return db[_0xce14('0x2b')]['count'](_0x5bb7d5)[_0xce14('0x24')](function(_0x1a8d95){_0x2140a7[_0xce14('0x1e')]=_0x1a8d95;if(_0x560e6d[_0xce14('0x31')][_0xce14('0x42')]){_0x2c8ddc['include']=[{'all':!![]}];}return db[_0xce14('0x2b')][_0xce14('0x43')](_0x2c8ddc);})['then'](function(_0x48f9f9){_0x2140a7[_0xce14('0x44')]=_0x48f9f9;return _0x2140a7;})['then'](respondWithFilteredResult(_0x1452f5,_0x2c8ddc))['catch'](handleError(_0x1452f5,null));};exports[_0xce14('0x45')]=function(_0xef91f6,_0x4f2376){var _0x5cb4ed={'raw':![],'where':{'id':_0xef91f6['params']['id']}},_0xb791c7={};_0xb791c7[_0xce14('0x34')]=_[_0xce14('0x30')](db[_0xce14('0x2b')][_0xce14('0x2c')]);_0xb791c7['query']=_[_0xce14('0x30')](_0xef91f6[_0xce14('0x31')]);_0xb791c7[_0xce14('0x32')]=_[_0xce14('0x33')](_0xb791c7[_0xce14('0x34')],_0xb791c7['query']);_0x5cb4ed['attributes']=_[_0xce14('0x33')](_0xb791c7[_0xce14('0x34')],qs['fields'](_0xef91f6[_0xce14('0x31')]['fields']));_0x5cb4ed['attributes']=_0x5cb4ed['attributes'][_0xce14('0x37')]?_0x5cb4ed[_0xce14('0x36')]:_0xb791c7[_0xce14('0x34')];if(_0xef91f6[_0xce14('0x31')][_0xce14('0x42')]){_0x5cb4ed[_0xce14('0x46')]=[{'all':!![]}];}_0x5cb4ed=_[_0xce14('0x40')]({},_0x5cb4ed,_0xef91f6[_0xce14('0x41')]);return db[_0xce14('0x2b')]['find'](_0x5cb4ed)['then'](handleEntityNotFound(_0x4f2376,null))[_0xce14('0x24')](respondWithResult(_0x4f2376,null))[_0xce14('0x47')](handleError(_0x4f2376,null));};exports['create']=function(_0x2b4f43,_0x47dc6d){return db[_0xce14('0x2b')][_0xce14('0x48')](_0x2b4f43['body'],{})['then'](respondWithResult(_0x47dc6d,0xc9))[_0xce14('0x47')](handleError(_0x47dc6d,null));};exports[_0xce14('0x23')]=function(_0x3757cf,_0x4e465c){if(_0x3757cf[_0xce14('0x49')]['id']){delete _0x3757cf[_0xce14('0x49')]['id'];}return db[_0xce14('0x2b')][_0xce14('0x4a')]({'where':{'id':_0x3757cf['params']['id']}})[_0xce14('0x24')](handleEntityNotFound(_0x4e465c,null))['then'](saveUpdates(_0x3757cf[_0xce14('0x49')],null))['then'](respondWithResult(_0x4e465c,null))[_0xce14('0x47')](handleError(_0x4e465c,null));};exports[_0xce14('0x25')]=function(_0xccc73f,_0xf76311){return db[_0xce14('0x2b')][_0xce14('0x4a')]({'where':{'id':_0xccc73f[_0xce14('0x4b')]['id']}})[_0xce14('0x24')](handleEntityNotFound(_0xf76311,null))[_0xce14('0x24')](removeEntity(_0xf76311,null))[_0xce14('0x47')](handleError(_0xf76311,null));};exports[_0xce14('0x4c')]=function(_0x11c143,_0xe1e6e,_0xaef40a){var _0xe180ba={};var _0x3bfe1a={};var _0x1f3733;var _0x165859;return db[_0xce14('0x2b')][_0xce14('0x4d')]({'where':{'id':_0x11c143[_0xce14('0x4b')]['id']}})[_0xce14('0x24')](handleEntityNotFound(_0xe1e6e,null))[_0xce14('0x24')](function(_0x4a5e01){if(_0x4a5e01){_0x1f3733=_0x4a5e01;_0x3bfe1a[_0xce14('0x34')]=_[_0xce14('0x30')](db[_0xce14('0x4e')][_0xce14('0x2c')]);_0x3bfe1a[_0xce14('0x31')]=_['keys'](_0x11c143[_0xce14('0x31')]);_0x3bfe1a[_0xce14('0x32')]=_[_0xce14('0x33')](_0x3bfe1a[_0xce14('0x34')],_0x3bfe1a[_0xce14('0x31')]);_0xe180ba[_0xce14('0x36')]=_[_0xce14('0x33')](_0x3bfe1a[_0xce14('0x34')],qs['fields'](_0x11c143[_0xce14('0x31')][_0xce14('0x35')]));_0xe180ba[_0xce14('0x36')]=_0xe180ba[_0xce14('0x36')]['length']?_0xe180ba[_0xce14('0x36')]:_0x3bfe1a['model'];_0xe180ba[_0xce14('0x3a')]=qs[_0xce14('0x3b')](_0x11c143[_0xce14('0x31')][_0xce14('0x3b')]);_0xe180ba[_0xce14('0x3c')]=qs[_0xce14('0x32')](_[_0xce14('0x3d')](_0x11c143[_0xce14('0x31')],_0x3bfe1a[_0xce14('0x32')]));if(_0x11c143[_0xce14('0x31')]['filter']){_0xe180ba['where']=_[_0xce14('0x40')](_0xe180ba[_0xce14('0x3c')],{'$or':_['map'](_0xe180ba['attributes'],function(_0x13ef44){var _0x1d0567={};_0x1d0567[_0x13ef44]={'$like':'%'+_0x11c143[_0xce14('0x31')][_0xce14('0x3e')]+'%'};return _0x1d0567;})});}_0xe180ba=_[_0xce14('0x40')]({},_0xe180ba,_0x11c143[_0xce14('0x41')]);return _0x1f3733[_0xce14('0x4c')](_0xe180ba);}})[_0xce14('0x24')](function(_0x5400c2){if(_0x5400c2){_0x165859=_0x5400c2[_0xce14('0x37')];if(!_0x11c143[_0xce14('0x31')][_0xce14('0x38')](_0xce14('0x39'))){_0xe180ba['limit']=qs[_0xce14('0x1d')](_0x11c143[_0xce14('0x31')][_0xce14('0x1d')]);_0xe180ba[_0xce14('0x1b')]=qs[_0xce14('0x1b')](_0x11c143[_0xce14('0x31')][_0xce14('0x1b')]);}return _0x1f3733[_0xce14('0x4c')](_0xe180ba);}})[_0xce14('0x24')](function(_0x586db4){if(_0x586db4){return _0x586db4?{'count':_0x165859,'rows':_0x586db4}:null;}})[_0xce14('0x24')](respondWithResult(_0xe1e6e,null))[_0xce14('0x47')](handleError(_0xe1e6e,null));};exports['addConfiguration']=function(_0x6301fc,_0x3370f7,_0x416fff){if(_0x6301fc[_0xce14('0x49')]['id']){delete _0x6301fc[_0xce14('0x49')]['id'];}return db[_0xce14('0x2b')][_0xce14('0x4d')]({'where':{'id':_0x6301fc[_0xce14('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3370f7,null))[_0xce14('0x24')](function(_0x15cdba){if(_0x15cdba){_0x6301fc[_0xce14('0x49')][_0xce14('0x4f')]=_0x15cdba['id'];_0x6301fc['body']['Subjects']=integrations[_0xce14('0x50')](_0x6301fc['body']['channel'],_0x6301fc['body'][_0xce14('0x2e')]);_0x6301fc[_0xce14('0x49')][_0xce14('0x51')]=integrations['getDescriptions'](_0x6301fc[_0xce14('0x49')][_0xce14('0x52')],_0x6301fc[_0xce14('0x49')]['type']);return db[_0xce14('0x4e')][_0xce14('0x48')](_0x6301fc[_0xce14('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0xce14('0x53')},{'model':db[_0xce14('0x54')],'as':_0xce14('0x51')}]});}return null;})['then'](respondWithResult(_0x3370f7,null))[_0xce14('0x47')](handleError(_0x3370f7,null));};exports[_0xce14('0x55')]=function(_0x3a97d0,_0x234737,_0x407c1c){var _0x171417='';var _0x1803e2=['id',_0xce14('0x28'),_0xce14('0x56'),'created_by','description',_0xce14('0x57'),_0xce14('0x58'),_0xce14('0x59'),_0xce14('0x5a'),'parent_type',_0xce14('0x5b'),_0xce14('0x5c')];return db[_0xce14('0x2b')][_0xce14('0x4d')]({'where':{'id':_0x3a97d0[_0xce14('0x4b')]['id']},'attributes':['id',_0xce14('0x5d'),_0xce14('0x5e'),_0xce14('0x5f')]})[_0xce14('0x24')](handleEntityNotFound(_0x234737,null))[_0xce14('0x24')](function(_0x2fdd15){if(_0x2fdd15){_0x171417=_0x2fdd15['remoteUri'];var _0x518f0d=_0x171417['slice'](-0x1);if(_0x518f0d==='/'){_0x171417=_0x171417['substring'](0x0,_0x171417[_0xce14('0x60')](_0x518f0d));}return rp({'method':_0xce14('0x61'),'uri':util[_0xce14('0x62')]('%s%s',_0x171417,_0xce14('0x63')),'json':!![],'form':{'method':'login','input_type':_0xce14('0x64'),'response_type':_0xce14('0x64'),'rest_data':JSON[_0xce14('0x65')]({'user_auth':{'user_name':_0x2fdd15[_0xce14('0x5d')],'password':_0x2fdd15['password'],'encryption':'PLAIN'},'application':_0xce14('0x66')})}});}})[_0xce14('0x24')](function(_0x483f21){if(_0x483f21&&_0x483f21['name']!==_0xce14('0x67')&&_0x483f21[_0xce14('0x28')]!==_0xce14('0x68')){return rp({'method':_0xce14('0x61'),'uri':util[_0xce14('0x62')](_0xce14('0x69'),_0x171417,_0xce14('0x63')),'json':!![],'form':{'method':_0xce14('0x6a'),'input_type':_0xce14('0x64'),'response_type':_0xce14('0x64'),'rest_data':JSON[_0xce14('0x65')]({'session':_0x483f21['id'],'module_name':_0xce14('0x6b')})}})[_0xce14('0x24')](function(_0x2e6f51){if(_0x2e6f51){var _0x2893c7=_[_0xce14('0x6c')](_0x2e6f51[_0xce14('0x6d')]);_[_0xce14('0x6e')](_0x2893c7,function(_0x570235){return _0x1803e2['includes'](_0x570235['name']);});return{'count':_0x2893c7[_0xce14('0x37')],'rows':_[_0xce14('0x2a')](_0x2893c7,function(_0x363a55){return{'id':_0x363a55[_0xce14('0x28')],'name':_0x363a55[_0xce14('0x6f')],'custom':_['endsWith'](_0x363a55['name'],'_c')?!![]:![],'options':_0x363a55[_0xce14('0x41')]?_['map'](_[_0xce14('0x6c')](_0x363a55[_0xce14('0x41')]),function(_0x190c53){return{'name':_0x190c53[_0xce14('0x70')],'value':_0x190c53[_0xce14('0x28')]};}):[]};})};}})[_0xce14('0x24')](respondWithResult(_0x234737,null))['catch'](function(_0x28f4f8){var _0x26c42a=_0x3a97d0['query']['test']?0x1f4:_0x28f4f8[_0xce14('0x71')]||0x1f4;logger[_0xce14('0x26')](_0xce14('0x72'),_0xce14('0x55'),_0x26c42a,JSON[_0xce14('0x65')](_0x28f4f8));delete _0x28f4f8['name'];if(_0x26c42a===0x191){_0x26c42a=0x190;}_0x234737[_0xce14('0x18')](_0x26c42a)[_0xce14('0x29')](_0x3a97d0[_0xce14('0x31')]['test']?{'message':_0xce14('0x73'),'statusCode':_0x28f4f8[_0xce14('0x71')]}:_0x28f4f8);});}else{var _0xa7c815=0x1f4;_0x234737['status'](_0xa7c815)['send']({'message':_0xce14('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4eca=['limit','sort','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','substring','POST','format','/service/v4_1/rest.php','login','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','JSON','values','remove','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4eca,0xab));var _0xa4ec=function(_0x44763f,_0x22f2d7){_0x44763f=_0x44763f-0x0;var _0x560dcb=_0x4eca[_0x44763f];return _0x560dcb;};'use strict';var emlformat=require(_0xa4ec('0x0'));var rimraf=require(_0xa4ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4ec('0x2'));var rp=require(_0xa4ec('0x3'));var moment=require(_0xa4ec('0x4'));var BPromise=require(_0xa4ec('0x5'));var Mustache=require('mustache');var util=require(_0xa4ec('0x6'));var path=require(_0xa4ec('0x7'));var sox=require(_0xa4ec('0x8'));var csv=require(_0xa4ec('0x9'));var ejs=require(_0xa4ec('0xa'));var fs=require('fs');var fs_extra=require(_0xa4ec('0xb'));var _=require('lodash');var squel=require(_0xa4ec('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4ec('0xd'));var deskjs=require(_0xa4ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4ec('0xf'));var Papa=require(_0xa4ec('0x10'));var Redis=require(_0xa4ec('0x11'));var authService=require(_0xa4ec('0x12'));var qs=require(_0xa4ec('0x13'));var as=require(_0xa4ec('0x14'));var hardwareService=require(_0xa4ec('0x15'));var logger=require('../../config/logger')(_0xa4ec('0x16'));var utils=require('../../config/utils');var config=require(_0xa4ec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4ec('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d279b,_0x46a855){_0x46a855=_0x46a855||0xcc;return function(_0x4b6ab3){if(_0x4b6ab3){return _0x1d279b[_0xa4ec('0x19')](_0x46a855);}return _0x1d279b['status'](_0x46a855)['end']();};}function respondWithResult(_0x3b57ff,_0x606a18){_0x606a18=_0x606a18||0xc8;return function(_0x579567){if(_0x579567){return _0x3b57ff[_0xa4ec('0x1a')](_0x606a18)[_0xa4ec('0x1b')](_0x579567);}};}function respondWithFilteredResult(_0x31de8d,_0x297e86){return function(_0xeca077){if(_0xeca077){var _0x4db2d7=typeof _0x297e86[_0xa4ec('0x1c')]===_0xa4ec('0x1d')&&typeof _0x297e86['limit']===_0xa4ec('0x1d');var _0xc406b9=_0xeca077[_0xa4ec('0x1e')];var _0x5502ed=_0x4db2d7?0x0:_0x297e86[_0xa4ec('0x1c')];var _0x33fb83=_0x4db2d7?_0xeca077[_0xa4ec('0x1e')]:_0x297e86[_0xa4ec('0x1c')]+_0x297e86['limit'];var _0x1494b5;if(_0x33fb83>=_0xc406b9){_0x33fb83=_0xc406b9;_0x1494b5=0xc8;}else{_0x1494b5=0xce;}_0x31de8d[_0xa4ec('0x1a')](_0x1494b5);return _0x31de8d['set'](_0xa4ec('0x1f'),_0x5502ed+'-'+_0x33fb83+'/'+_0xc406b9)[_0xa4ec('0x1b')](_0xeca077);}return null;};}function patchUpdates(_0x132274){return function(_0x3a287f){try{jsonpatch[_0xa4ec('0x20')](_0x3a287f,_0x132274,!![]);}catch(_0x59e822){return BPromise[_0xa4ec('0x21')](_0x59e822);}return _0x3a287f[_0xa4ec('0x22')]();};}function saveUpdates(_0x1fad06,_0x490df9){return function(_0x58ff54){if(_0x58ff54){return _0x58ff54[_0xa4ec('0x23')](_0x1fad06)[_0xa4ec('0x24')](function(_0x51784c){return _0x51784c;});}return null;};}function removeEntity(_0x29a211,_0x1faa9f){return function(_0x27aa45){if(_0x27aa45){return _0x27aa45[_0xa4ec('0x25')]()[_0xa4ec('0x24')](function(){_0x29a211[_0xa4ec('0x1a')](0xcc)[_0xa4ec('0x26')]();});}};}function handleEntityNotFound(_0x15d563,_0x1178f2){return function(_0x4f01bf){if(!_0x4f01bf){_0x15d563[_0xa4ec('0x19')](0x194);}return _0x4f01bf;};}function handleError(_0x47888d,_0x587bfa){_0x587bfa=_0x587bfa||0x1f4;return function(_0x31eea0){logger['error'](_0x31eea0['stack']);if(_0x31eea0[_0xa4ec('0x27')]){delete _0x31eea0[_0xa4ec('0x27')];}_0x47888d[_0xa4ec('0x1a')](_0x587bfa)[_0xa4ec('0x28')](_0x31eea0);};}exports[_0xa4ec('0x29')]=function(_0x58e01a,_0x113792){var _0x5ee1b7={},_0x24adc0={},_0x1602e0={'count':0x0,'rows':[]};var _0x1874e8=_[_0xa4ec('0x2a')](db[_0xa4ec('0x2b')][_0xa4ec('0x2c')],function(_0x478ad5){return{'name':_0x478ad5[_0xa4ec('0x2d')],'type':_0x478ad5[_0xa4ec('0x2e')][_0xa4ec('0x2f')]};});_0x24adc0[_0xa4ec('0x30')]=_['map'](_0x1874e8,_0xa4ec('0x27'));_0x24adc0['query']=_[_0xa4ec('0x31')](_0x58e01a['query']);_0x24adc0['filters']=_[_0xa4ec('0x32')](_0x24adc0['model'],_0x24adc0[_0xa4ec('0x33')]);_0x5ee1b7[_0xa4ec('0x34')]=_[_0xa4ec('0x32')](_0x24adc0[_0xa4ec('0x30')],qs[_0xa4ec('0x35')](_0x58e01a[_0xa4ec('0x33')][_0xa4ec('0x35')]));_0x5ee1b7[_0xa4ec('0x34')]=_0x5ee1b7[_0xa4ec('0x34')][_0xa4ec('0x36')]?_0x5ee1b7['attributes']:_0x24adc0['model'];if(!_0x58e01a[_0xa4ec('0x33')][_0xa4ec('0x37')](_0xa4ec('0x38'))){_0x5ee1b7[_0xa4ec('0x39')]=qs[_0xa4ec('0x39')](_0x58e01a[_0xa4ec('0x33')]['limit']);_0x5ee1b7[_0xa4ec('0x1c')]=qs['offset'](_0x58e01a[_0xa4ec('0x33')]['offset']);}_0x5ee1b7['order']=qs['sort'](_0x58e01a[_0xa4ec('0x33')][_0xa4ec('0x3a')]);_0x5ee1b7[_0xa4ec('0x3b')]=qs[_0xa4ec('0x3c')](_[_0xa4ec('0x3d')](_0x58e01a[_0xa4ec('0x33')],_0x24adc0[_0xa4ec('0x3c')]),_0x1874e8);if(_0x58e01a[_0xa4ec('0x33')]['filter']){_0x5ee1b7['where']=_[_0xa4ec('0x3e')](_0x5ee1b7['where'],{'$or':_[_0xa4ec('0x2a')](_0x1874e8,function(_0x548b00){if(_0x548b00[_0xa4ec('0x2e')]!=='VIRTUAL'){var _0xee7898={};_0xee7898[_0x548b00[_0xa4ec('0x27')]]={'$like':'%'+_0x58e01a[_0xa4ec('0x33')]['filter']+'%'};return _0xee7898;}})});}_0x5ee1b7=_[_0xa4ec('0x3e')]({},_0x5ee1b7,_0x58e01a[_0xa4ec('0x3f')]);var _0x38c9c2={'where':_0x5ee1b7['where']};return db[_0xa4ec('0x2b')]['count'](_0x38c9c2)[_0xa4ec('0x24')](function(_0x4f784e){_0x1602e0['count']=_0x4f784e;if(_0x58e01a[_0xa4ec('0x33')][_0xa4ec('0x40')]){_0x5ee1b7['include']=[{'all':!![]}];}return db[_0xa4ec('0x2b')][_0xa4ec('0x41')](_0x5ee1b7);})[_0xa4ec('0x24')](function(_0x57ca7){_0x1602e0[_0xa4ec('0x42')]=_0x57ca7;return _0x1602e0;})['then'](respondWithFilteredResult(_0x113792,_0x5ee1b7))[_0xa4ec('0x43')](handleError(_0x113792,null));};exports[_0xa4ec('0x44')]=function(_0x1d86f9,_0x5bde3d){var _0x3ab48d={'raw':![],'where':{'id':_0x1d86f9[_0xa4ec('0x45')]['id']}},_0x51f567={};_0x51f567[_0xa4ec('0x30')]=_['keys'](db[_0xa4ec('0x2b')][_0xa4ec('0x2c')]);_0x51f567[_0xa4ec('0x33')]=_[_0xa4ec('0x31')](_0x1d86f9['query']);_0x51f567[_0xa4ec('0x3c')]=_[_0xa4ec('0x32')](_0x51f567[_0xa4ec('0x30')],_0x51f567[_0xa4ec('0x33')]);_0x3ab48d[_0xa4ec('0x34')]=_[_0xa4ec('0x32')](_0x51f567[_0xa4ec('0x30')],qs[_0xa4ec('0x35')](_0x1d86f9[_0xa4ec('0x33')][_0xa4ec('0x35')]));_0x3ab48d[_0xa4ec('0x34')]=_0x3ab48d[_0xa4ec('0x34')][_0xa4ec('0x36')]?_0x3ab48d[_0xa4ec('0x34')]:_0x51f567[_0xa4ec('0x30')];if(_0x1d86f9['query'][_0xa4ec('0x40')]){_0x3ab48d['include']=[{'all':!![]}];}_0x3ab48d=_['merge']({},_0x3ab48d,_0x1d86f9[_0xa4ec('0x3f')]);return db[_0xa4ec('0x2b')][_0xa4ec('0x46')](_0x3ab48d)[_0xa4ec('0x24')](handleEntityNotFound(_0x5bde3d,null))[_0xa4ec('0x24')](respondWithResult(_0x5bde3d,null))[_0xa4ec('0x43')](handleError(_0x5bde3d,null));};exports[_0xa4ec('0x47')]=function(_0x538ab8,_0x2061a9){return db[_0xa4ec('0x2b')][_0xa4ec('0x47')](_0x538ab8[_0xa4ec('0x48')],{})[_0xa4ec('0x24')](respondWithResult(_0x2061a9,0xc9))[_0xa4ec('0x43')](handleError(_0x2061a9,null));};exports['update']=function(_0x533b6c,_0x260906){if(_0x533b6c[_0xa4ec('0x48')]['id']){delete _0x533b6c[_0xa4ec('0x48')]['id'];}return db[_0xa4ec('0x2b')][_0xa4ec('0x46')]({'where':{'id':_0x533b6c[_0xa4ec('0x45')]['id']}})[_0xa4ec('0x24')](handleEntityNotFound(_0x260906,null))['then'](saveUpdates(_0x533b6c[_0xa4ec('0x48')],null))[_0xa4ec('0x24')](respondWithResult(_0x260906,null))[_0xa4ec('0x43')](handleError(_0x260906,null));};exports['destroy']=function(_0x3dc24b,_0x72973f){return db[_0xa4ec('0x2b')][_0xa4ec('0x46')]({'where':{'id':_0x3dc24b[_0xa4ec('0x45')]['id']}})[_0xa4ec('0x24')](handleEntityNotFound(_0x72973f,null))[_0xa4ec('0x24')](removeEntity(_0x72973f,null))['catch'](handleError(_0x72973f,null));};exports[_0xa4ec('0x49')]=function(_0x1d2140,_0x4ebc47,_0x17db00){var _0x3dcb5b={};var _0xe67b85={};var _0x717e1a;var _0x522241;return db[_0xa4ec('0x2b')][_0xa4ec('0x4a')]({'where':{'id':_0x1d2140['params']['id']}})[_0xa4ec('0x24')](handleEntityNotFound(_0x4ebc47,null))['then'](function(_0x2af0f5){if(_0x2af0f5){_0x717e1a=_0x2af0f5;_0xe67b85[_0xa4ec('0x30')]=_[_0xa4ec('0x31')](db[_0xa4ec('0x4b')][_0xa4ec('0x2c')]);_0xe67b85[_0xa4ec('0x33')]=_[_0xa4ec('0x31')](_0x1d2140[_0xa4ec('0x33')]);_0xe67b85[_0xa4ec('0x3c')]=_['intersection'](_0xe67b85['model'],_0xe67b85[_0xa4ec('0x33')]);_0x3dcb5b['attributes']=_[_0xa4ec('0x32')](_0xe67b85[_0xa4ec('0x30')],qs['fields'](_0x1d2140[_0xa4ec('0x33')][_0xa4ec('0x35')]));_0x3dcb5b[_0xa4ec('0x34')]=_0x3dcb5b[_0xa4ec('0x34')]['length']?_0x3dcb5b[_0xa4ec('0x34')]:_0xe67b85[_0xa4ec('0x30')];_0x3dcb5b[_0xa4ec('0x4c')]=qs['sort'](_0x1d2140[_0xa4ec('0x33')][_0xa4ec('0x3a')]);_0x3dcb5b[_0xa4ec('0x3b')]=qs[_0xa4ec('0x3c')](_[_0xa4ec('0x3d')](_0x1d2140[_0xa4ec('0x33')],_0xe67b85[_0xa4ec('0x3c')]));if(_0x1d2140[_0xa4ec('0x33')][_0xa4ec('0x4d')]){_0x3dcb5b[_0xa4ec('0x3b')]=_[_0xa4ec('0x3e')](_0x3dcb5b['where'],{'$or':_['map'](_0x3dcb5b[_0xa4ec('0x34')],function(_0x49c460){var _0x64e7af={};_0x64e7af[_0x49c460]={'$like':'%'+_0x1d2140['query'][_0xa4ec('0x4d')]+'%'};return _0x64e7af;})});}_0x3dcb5b=_[_0xa4ec('0x3e')]({},_0x3dcb5b,_0x1d2140[_0xa4ec('0x3f')]);return _0x717e1a['getConfigurations'](_0x3dcb5b);}})[_0xa4ec('0x24')](function(_0x10c412){if(_0x10c412){_0x522241=_0x10c412[_0xa4ec('0x36')];if(!_0x1d2140['query']['hasOwnProperty'](_0xa4ec('0x38'))){_0x3dcb5b[_0xa4ec('0x39')]=qs[_0xa4ec('0x39')](_0x1d2140[_0xa4ec('0x33')][_0xa4ec('0x39')]);_0x3dcb5b[_0xa4ec('0x1c')]=qs[_0xa4ec('0x1c')](_0x1d2140[_0xa4ec('0x33')]['offset']);}return _0x717e1a[_0xa4ec('0x49')](_0x3dcb5b);}})[_0xa4ec('0x24')](function(_0x517d11){if(_0x517d11){return _0x517d11?{'count':_0x522241,'rows':_0x517d11}:null;}})[_0xa4ec('0x24')](respondWithResult(_0x4ebc47,null))[_0xa4ec('0x43')](handleError(_0x4ebc47,null));};exports[_0xa4ec('0x4e')]=function(_0x39bf8e,_0x3e381b,_0x587e73){if(_0x39bf8e[_0xa4ec('0x48')]['id']){delete _0x39bf8e[_0xa4ec('0x48')]['id'];}return db['SugarcrmAccount'][_0xa4ec('0x4a')]({'where':{'id':_0x39bf8e[_0xa4ec('0x45')]['id']}})[_0xa4ec('0x24')](handleEntityNotFound(_0x3e381b,null))[_0xa4ec('0x24')](function(_0x323626){if(_0x323626){_0x39bf8e[_0xa4ec('0x48')][_0xa4ec('0x4f')]=_0x323626['id'];_0x39bf8e[_0xa4ec('0x48')][_0xa4ec('0x50')]=integrations[_0xa4ec('0x51')](_0x39bf8e[_0xa4ec('0x48')][_0xa4ec('0x52')],_0x39bf8e['body'][_0xa4ec('0x2e')]);_0x39bf8e[_0xa4ec('0x48')][_0xa4ec('0x53')]=integrations[_0xa4ec('0x54')](_0x39bf8e['body'][_0xa4ec('0x52')],_0x39bf8e[_0xa4ec('0x48')][_0xa4ec('0x2e')]);return db[_0xa4ec('0x4b')][_0xa4ec('0x47')](_0x39bf8e[_0xa4ec('0x48')],{'include':[{'model':db[_0xa4ec('0x55')],'as':'Subjects'},{'model':db[_0xa4ec('0x55')],'as':'Descriptions'}]});}return null;})[_0xa4ec('0x24')](respondWithResult(_0x3e381b,null))['catch'](handleError(_0x3e381b,null));};exports[_0xa4ec('0x56')]=function(_0x543998,_0x2720cd,_0x11c9c3){var _0x4d8416='';var _0x54aa2b=['id','name','assigned_user_id',_0xa4ec('0x57'),_0xa4ec('0x58'),_0xa4ec('0x59'),'duration_hours',_0xa4ec('0x5a'),_0xa4ec('0x5b'),'parent_type',_0xa4ec('0x5c'),_0xa4ec('0x5d')];return db[_0xa4ec('0x2b')][_0xa4ec('0x4a')]({'where':{'id':_0x543998[_0xa4ec('0x45')]['id']},'attributes':['id',_0xa4ec('0x5e'),_0xa4ec('0x5f'),_0xa4ec('0x60')]})[_0xa4ec('0x24')](handleEntityNotFound(_0x2720cd,null))[_0xa4ec('0x24')](function(_0x441b5a){if(_0x441b5a){_0x4d8416=_0x441b5a['remoteUri'];var _0x136af3=_0x4d8416['slice'](-0x1);if(_0x136af3==='/'){_0x4d8416=_0x4d8416[_0xa4ec('0x61')](0x0,_0x4d8416['lastIndexOf'](_0x136af3));}return rp({'method':_0xa4ec('0x62'),'uri':util[_0xa4ec('0x63')]('%s%s',_0x4d8416,_0xa4ec('0x64')),'json':!![],'form':{'method':_0xa4ec('0x65'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xa4ec('0x66')]({'user_auth':{'user_name':_0x441b5a[_0xa4ec('0x5e')],'password':_0x441b5a[_0xa4ec('0x5f')],'encryption':'PLAIN'},'application':_0xa4ec('0x67')})}});}})[_0xa4ec('0x24')](function(_0x4f4e71){if(_0x4f4e71&&_0x4f4e71[_0xa4ec('0x27')]!==_0xa4ec('0x68')&&_0x4f4e71[_0xa4ec('0x27')]!=='Password\x20Expired'){return rp({'method':_0xa4ec('0x62'),'uri':util[_0xa4ec('0x63')](_0xa4ec('0x69'),_0x4d8416,_0xa4ec('0x64')),'json':!![],'form':{'method':_0xa4ec('0x6a'),'input_type':_0xa4ec('0x6b'),'response_type':'JSON','rest_data':JSON[_0xa4ec('0x66')]({'session':_0x4f4e71['id'],'module_name':'Calls'})}})['then'](function(_0xfe672){if(_0xfe672){var _0x330619=_[_0xa4ec('0x6c')](_0xfe672['module_fields']);_[_0xa4ec('0x6d')](_0x330619,function(_0x55cfd6){return _0x54aa2b['includes'](_0x55cfd6[_0xa4ec('0x27')]);});return{'count':_0x330619[_0xa4ec('0x36')],'rows':_['map'](_0x330619,function(_0x46dc6b){return{'id':_0x46dc6b[_0xa4ec('0x27')],'name':_0x46dc6b['label'],'custom':_['endsWith'](_0x46dc6b[_0xa4ec('0x27')],'_c')?!![]:![],'options':_0x46dc6b[_0xa4ec('0x3f')]?_[_0xa4ec('0x2a')](_[_0xa4ec('0x6c')](_0x46dc6b[_0xa4ec('0x3f')]),function(_0x404643){return{'name':_0x404643['value'],'value':_0x404643['name']};}):[]};})};}})[_0xa4ec('0x24')](respondWithResult(_0x2720cd,null))[_0xa4ec('0x43')](function(_0x1ee8b4){var _0x27e610=_0x543998['query'][_0xa4ec('0x6e')]?0x1f4:_0x1ee8b4[_0xa4ec('0x6f')]||0x1f4;logger['error'](_0xa4ec('0x70'),'getFields',_0x27e610,JSON[_0xa4ec('0x66')](_0x1ee8b4));delete _0x1ee8b4[_0xa4ec('0x27')];if(_0x27e610===0x191){_0x27e610=0x190;}_0x2720cd[_0xa4ec('0x1a')](_0x27e610)['send'](_0x543998[_0xa4ec('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1ee8b4[_0xa4ec('0x6f')]}:_0x1ee8b4);});}else{var _0x15aec0=0x1f4;_0x2720cd[_0xa4ec('0x1a')](_0x15aec0)[_0xa4ec('0x28')]({'message':_0xa4ec('0x71'),'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 c88738e..bbce733 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 _0x8549=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x42f98d,_0x48227d){var _0x5888b4=function(_0x3cce20){while(--_0x3cce20){_0x42f98d['push'](_0x42f98d['shift']());}};_0x5888b4(++_0x48227d);}(_0x8549,0xd3));var _0x9854=function(_0xbec57b,_0x24b961){_0xbec57b=_0xbec57b-0x0;var _0x2bdbde=_0x8549[_0xbec57b];return _0x2bdbde;};'use strict';var _=require(_0x9854('0x0'));var util=require('util');var logger=require(_0x9854('0x1'))(_0x9854('0x2'));var moment=require(_0x9854('0x3'));var BPromise=require(_0x9854('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9854('0x5'));var config=require(_0x9854('0x6'));var attributes=require(_0x9854('0x7'));var integrations=require(_0x9854('0x8'));module['exports']=function(_0xdb6dc,_0x4737ab){return _0xdb6dc[_0x9854('0x9')](_0x9854('0xa'),attributes,{'tableName':_0x9854('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e3=['SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4e6f4b,_0x32a96a){var _0x380ceb=function(_0x42565d){while(--_0x42565d){_0x4e6f4b['push'](_0x4e6f4b['shift']());}};_0x380ceb(++_0x32a96a);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x40bfec,_0x45aa01){_0x40bfec=_0x40bfec-0x0;var _0x28b40d=_0xd9e3[_0x40bfec];return _0x28b40d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d9e('0x0'))(_0x3d9e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d9e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d9e('0x3'));var config=require(_0x3d9e('0x4'));var attributes=require(_0x3d9e('0x5'));var integrations=require(_0x3d9e('0x6'));module[_0x3d9e('0x7')]=function(_0x58c8b3,_0x2d3ac9){return _0x58c8b3[_0x3d9e('0x8')](_0x3d9e('0x9'),attributes,{'tableName':_0x3d9e('0xa'),'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 66aee58..4107546 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 _0x1422=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','SugarcrmAccount','options','where','attributes','limit','include','model','debug','GetSugarcrmAccount','raw','map','ShowSugarcrmAccount','lodash','util'];(function(_0x52d618,_0x3b8074){var _0x5db6b7=function(_0xffd46d){while(--_0xffd46d){_0x52d618['push'](_0x52d618['shift']());}};_0x5db6b7(++_0x3b8074);}(_0x1422,0xc4));var _0x2142=function(_0x518753,_0x55dc6b){_0x518753=_0x518753-0x0;var _0xd90c12=_0x1422[_0x518753];return _0xd90c12;};'use strict';var _=require(_0x2142('0x0'));var util=require(_0x2142('0x1'));var moment=require(_0x2142('0x2'));var BPromise=require(_0x2142('0x3'));var rs=require(_0x2142('0x4'));var fs=require('fs');var Redis=require(_0x2142('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2142('0x6'));var logger=require(_0x2142('0x7'))('rpc');var config=require(_0x2142('0x8'));var jayson=require(_0x2142('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc003,_0x2c9a97,_0x154d22){return new BPromise(function(_0x1fbf58,_0x982199){return client[_0x2142('0xa')](_0x3fc003,_0x154d22)[_0x2142('0xb')](function(_0x39d2a9){logger['info'](_0x2142('0xc'),_0x2c9a97,'request\x20sent');logger['debug'](_0x2142('0xd'),_0x2c9a97,_0x2142('0xe'),JSON[_0x2142('0xf')](_0x39d2a9));if(_0x39d2a9[_0x2142('0x10')]){if(_0x39d2a9[_0x2142('0x10')]['code']===0x1f4){logger[_0x2142('0x10')](_0x2142('0xc'),_0x2c9a97,_0x39d2a9['error'][_0x2142('0x11')]);return _0x982199(_0x39d2a9['error'][_0x2142('0x11')]);}logger[_0x2142('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x2c9a97,_0x39d2a9[_0x2142('0x10')][_0x2142('0x11')]);return _0x1fbf58(_0x39d2a9['error'][_0x2142('0x11')]);}else{logger[_0x2142('0x12')](_0x2142('0xc'),_0x2c9a97,'request\x20sent');_0x1fbf58(_0x39d2a9[_0x2142('0x13')][_0x2142('0x11')]);}})[_0x2142('0x14')](function(_0x449176){logger[_0x2142('0x10')](_0x2142('0xc'),_0x2c9a97,_0x449176);_0x982199(_0x449176);});});}exports['GetSugarcrmAccount']=function(_0x1a1c90){var _0x4d1df4=this;return new Promise(function(_0x2db0b9,_0x395e61){return db[_0x2142('0x15')]['findAll']({'raw':_0x1a1c90[_0x2142('0x16')]?_0x1a1c90[_0x2142('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a1c90[_0x2142('0x16')]?_0x1a1c90[_0x2142('0x16')][_0x2142('0x17')]||null:null,'attributes':_0x1a1c90[_0x2142('0x16')]?_0x1a1c90[_0x2142('0x16')][_0x2142('0x18')]||null:null,'limit':_0x1a1c90[_0x2142('0x16')]?_0x1a1c90[_0x2142('0x16')][_0x2142('0x19')]||null:null,'include':_0x1a1c90[_0x2142('0x16')]?_0x1a1c90[_0x2142('0x16')][_0x2142('0x1a')]?_['map'](_0x1a1c90[_0x2142('0x16')]['include'],function(_0x599e39){return{'model':db[_0x599e39[_0x2142('0x1b')]],'as':_0x599e39['as'],'attributes':_0x599e39['attributes'],'include':_0x599e39[_0x2142('0x1a')]?_['map'](_0x599e39[_0x2142('0x1a')],function(_0x26f7d2){return{'model':db[_0x26f7d2['model']],'as':_0x26f7d2['as'],'attributes':_0x26f7d2[_0x2142('0x18')],'include':_0x26f7d2[_0x2142('0x1a')]?_['map'](_0x26f7d2[_0x2142('0x1a')],function(_0x1cf19b){return{'model':db[_0x1cf19b['model']],'as':_0x1cf19b['as'],'attributes':_0x1cf19b[_0x2142('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x410b45){logger[_0x2142('0x12')]('GetSugarcrmAccount',_0x1a1c90);logger[_0x2142('0x1c')](_0x2142('0x1d'),_0x1a1c90,JSON['stringify'](_0x410b45));_0x2db0b9(_0x410b45);})[_0x2142('0x14')](function(_0x28ee0d){logger[_0x2142('0x10')](_0x2142('0x1d'),_0x28ee0d[_0x2142('0x11')],_0x1a1c90);_0x395e61(_0x4d1df4[_0x2142('0x10')](0x1f4,_0x28ee0d[_0x2142('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x5a5ba1){var _0x4c34cb=this;return new Promise(function(_0x40403a,_0x2c23d5){return db[_0x2142('0x15')]['find']({'raw':_0x5a5ba1['options']?_0x5a5ba1[_0x2142('0x16')][_0x2142('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a5ba1[_0x2142('0x16')]?_0x5a5ba1[_0x2142('0x16')][_0x2142('0x17')]||null:null,'attributes':_0x5a5ba1['options']?_0x5a5ba1[_0x2142('0x16')][_0x2142('0x18')]||null:null,'include':_0x5a5ba1['options']?_0x5a5ba1[_0x2142('0x16')]['include']?_[_0x2142('0x1f')](_0x5a5ba1['options']['include'],function(_0x1cbf4a){return{'model':db[_0x1cbf4a[_0x2142('0x1b')]],'as':_0x1cbf4a['as'],'attributes':_0x1cbf4a['attributes'],'include':_0x1cbf4a[_0x2142('0x1a')]?_[_0x2142('0x1f')](_0x1cbf4a['include'],function(_0x5ccbe3){return{'model':db[_0x5ccbe3[_0x2142('0x1b')]],'as':_0x5ccbe3['as'],'attributes':_0x5ccbe3[_0x2142('0x18')],'include':_0x5ccbe3[_0x2142('0x1a')]?_['map'](_0x5ccbe3[_0x2142('0x1a')],function(_0xea3980){return{'model':db[_0xea3980['model']],'as':_0xea3980['as'],'attributes':_0xea3980['attributes']};}):[]};}):[]};}):[]:[]})[_0x2142('0xb')](function(_0x4fdd9a){logger[_0x2142('0x12')](_0x2142('0x20'),_0x5a5ba1);logger['debug']('ShowSugarcrmAccount',_0x5a5ba1,JSON[_0x2142('0xf')](_0x4fdd9a));_0x40403a(_0x4fdd9a);})[_0x2142('0x14')](function(_0x50dcba){logger['error'](_0x2142('0x20'),_0x50dcba[_0x2142('0x11')],_0x5a5ba1);_0x2c23d5(_0x4c34cb[_0x2142('0x10')](0x1f4,_0x50dcba[_0x2142('0x11')]));});});}; \ No newline at end of file +var _0x4eea=['catch','GetSugarcrmAccount','SugarcrmAccount','options','where','limit','include','model','attributes','map','then','ShowSugarcrmAccount','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4eea,0x1c7));var _0xa4ee=function(_0x9106fc,_0x276e60){_0x9106fc=_0x9106fc-0x0;var _0x4cf8b2=_0x4eea[_0x9106fc];return _0x4cf8b2;};'use strict';var _=require(_0xa4ee('0x0'));var util=require('util');var moment=require(_0xa4ee('0x1'));var BPromise=require(_0xa4ee('0x2'));var rs=require(_0xa4ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4ee('0x4'))['db'];var utils=require(_0xa4ee('0x5'));var logger=require(_0xa4ee('0x6'))(_0xa4ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4ee('0x8'));var client=jayson[_0xa4ee('0x9')][_0xa4ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2edb34,_0x36949b,_0x43da98){return new BPromise(function(_0x2e14a7,_0x23bbbf){return client[_0xa4ee('0xb')](_0x2edb34,_0x43da98)['then'](function(_0x409008){logger['info'](_0xa4ee('0xc'),_0x36949b,_0xa4ee('0xd'));logger[_0xa4ee('0xe')](_0xa4ee('0xf'),_0x36949b,_0xa4ee('0xd'),JSON[_0xa4ee('0x10')](_0x409008));if(_0x409008[_0xa4ee('0x11')]){if(_0x409008['error'][_0xa4ee('0x12')]===0x1f4){logger[_0xa4ee('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x36949b,_0x409008[_0xa4ee('0x11')][_0xa4ee('0x13')]);return _0x23bbbf(_0x409008[_0xa4ee('0x11')]['message']);}logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x36949b,_0x409008[_0xa4ee('0x11')][_0xa4ee('0x13')]);return _0x2e14a7(_0x409008[_0xa4ee('0x11')][_0xa4ee('0x13')]);}else{logger['info'](_0xa4ee('0xc'),_0x36949b,'request\x20sent');_0x2e14a7(_0x409008[_0xa4ee('0x14')][_0xa4ee('0x13')]);}})[_0xa4ee('0x15')](function(_0x1834be){logger[_0xa4ee('0x11')](_0xa4ee('0xc'),_0x36949b,_0x1834be);_0x23bbbf(_0x1834be);});});}exports[_0xa4ee('0x16')]=function(_0x149c2b){var _0x2238d2=this;return new Promise(function(_0xd98fde,_0x215807){return db[_0xa4ee('0x17')]['findAll']({'raw':_0x149c2b[_0xa4ee('0x18')]?_0x149c2b[_0xa4ee('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x149c2b['options']?_0x149c2b['options'][_0xa4ee('0x19')]||null:null,'attributes':_0x149c2b[_0xa4ee('0x18')]?_0x149c2b['options']['attributes']||null:null,'limit':_0x149c2b[_0xa4ee('0x18')]?_0x149c2b[_0xa4ee('0x18')][_0xa4ee('0x1a')]||null:null,'include':_0x149c2b[_0xa4ee('0x18')]?_0x149c2b['options']['include']?_['map'](_0x149c2b[_0xa4ee('0x18')][_0xa4ee('0x1b')],function(_0x203520){return{'model':db[_0x203520[_0xa4ee('0x1c')]],'as':_0x203520['as'],'attributes':_0x203520[_0xa4ee('0x1d')],'include':_0x203520[_0xa4ee('0x1b')]?_[_0xa4ee('0x1e')](_0x203520[_0xa4ee('0x1b')],function(_0x46d5b9){return{'model':db[_0x46d5b9[_0xa4ee('0x1c')]],'as':_0x46d5b9['as'],'attributes':_0x46d5b9[_0xa4ee('0x1d')],'include':_0x46d5b9['include']?_[_0xa4ee('0x1e')](_0x46d5b9[_0xa4ee('0x1b')],function(_0x5ca999){return{'model':db[_0x5ca999[_0xa4ee('0x1c')]],'as':_0x5ca999['as'],'attributes':_0x5ca999[_0xa4ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa4ee('0x1f')](function(_0x419af1){logger['info']('GetSugarcrmAccount',_0x149c2b);logger[_0xa4ee('0xe')](_0xa4ee('0x16'),_0x149c2b,JSON[_0xa4ee('0x10')](_0x419af1));_0xd98fde(_0x419af1);})['catch'](function(_0x4484a2){logger['error'](_0xa4ee('0x16'),_0x4484a2[_0xa4ee('0x13')],_0x149c2b);_0x215807(_0x2238d2[_0xa4ee('0x11')](0x1f4,_0x4484a2[_0xa4ee('0x13')]));});});};exports[_0xa4ee('0x20')]=function(_0x2d47c4){var _0x1a318f=this;return new Promise(function(_0x510c89,_0x501e32){return db['SugarcrmAccount']['find']({'raw':_0x2d47c4['options']?_0x2d47c4[_0xa4ee('0x18')][_0xa4ee('0x21')]===undefined?!![]:![]:!![],'where':_0x2d47c4[_0xa4ee('0x18')]?_0x2d47c4[_0xa4ee('0x18')][_0xa4ee('0x19')]||null:null,'attributes':_0x2d47c4['options']?_0x2d47c4[_0xa4ee('0x18')][_0xa4ee('0x1d')]||null:null,'include':_0x2d47c4[_0xa4ee('0x18')]?_0x2d47c4[_0xa4ee('0x18')]['include']?_['map'](_0x2d47c4[_0xa4ee('0x18')]['include'],function(_0x21a2fe){return{'model':db[_0x21a2fe[_0xa4ee('0x1c')]],'as':_0x21a2fe['as'],'attributes':_0x21a2fe[_0xa4ee('0x1d')],'include':_0x21a2fe[_0xa4ee('0x1b')]?_['map'](_0x21a2fe['include'],function(_0x48a4a1){return{'model':db[_0x48a4a1['model']],'as':_0x48a4a1['as'],'attributes':_0x48a4a1[_0xa4ee('0x1d')],'include':_0x48a4a1[_0xa4ee('0x1b')]?_[_0xa4ee('0x1e')](_0x48a4a1[_0xa4ee('0x1b')],function(_0x5a2985){return{'model':db[_0x5a2985['model']],'as':_0x5a2985['as'],'attributes':_0x5a2985['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a64ec){logger['info']('ShowSugarcrmAccount',_0x2d47c4);logger[_0xa4ee('0xe')]('ShowSugarcrmAccount',_0x2d47c4,JSON[_0xa4ee('0x10')](_0x4a64ec));_0x510c89(_0x4a64ec);})['catch'](function(_0x179697){logger['error'](_0xa4ee('0x20'),_0x179697[_0xa4ee('0x13')],_0x2d47c4);_0x501e32(_0x1a318f['error'](0x1f4,_0x179697[_0xa4ee('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 04caad5..6add913 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 _0x9265=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9265,0x179));var _0x5926=function(_0x205cbf,_0x48e261){_0x205cbf=_0x205cbf-0x0;var _0x3e4702=_0x9265[_0x205cbf];return _0x3e4702;};'use strict';var multer=require('multer');var util=require(_0x5926('0x0'));var path=require(_0x5926('0x1'));var timeout=require(_0x5926('0x2'));var express=require(_0x5926('0x3'));var router=express[_0x5926('0x4')]();var fs_extra=require(_0x5926('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5926('0x6'));var config=require(_0x5926('0x7'));var controller=require(_0x5926('0x8'));router[_0x5926('0x9')]('/',auth[_0x5926('0xa')](),controller[_0x5926('0xb')]);router[_0x5926('0x9')]('/:id',auth[_0x5926('0xa')](),controller['show']);router[_0x5926('0x9')](_0x5926('0xc'),auth[_0x5926('0xa')](),controller[_0x5926('0xd')]);router[_0x5926('0x9')](_0x5926('0xe'),auth[_0x5926('0xa')](),controller['getSubjects']);router[_0x5926('0x9')](_0x5926('0xf'),auth['isAuthenticated'](),controller[_0x5926('0x10')]);router[_0x5926('0x11')]('/',auth[_0x5926('0xa')](),controller[_0x5926('0x12')]);router[_0x5926('0x13')](_0x5926('0x14'),auth[_0x5926('0xa')](),controller[_0x5926('0x15')]);router[_0x5926('0x16')](_0x5926('0x14'),auth[_0x5926('0xa')](),controller[_0x5926('0x17')]);module[_0x5926('0x18')]=router; \ No newline at end of file +var _0x3ee1=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3ee1,0x142));var _0x13ee=function(_0x154393,_0x4ffaf9){_0x154393=_0x154393-0x0;var _0x5905e3=_0x3ee1[_0x154393];return _0x5905e3;};'use strict';var multer=require('multer');var util=require(_0x13ee('0x0'));var path=require(_0x13ee('0x1'));var timeout=require(_0x13ee('0x2'));var express=require(_0x13ee('0x3'));var router=express['Router']();var fs_extra=require(_0x13ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13ee('0x5'));var config=require(_0x13ee('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x13ee('0x7')]('/',auth[_0x13ee('0x8')](),controller[_0x13ee('0x9')]);router[_0x13ee('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x13ee('0xa')]);router[_0x13ee('0x7')](_0x13ee('0xb'),auth[_0x13ee('0x8')](),controller[_0x13ee('0xc')]);router[_0x13ee('0x7')](_0x13ee('0xd'),auth[_0x13ee('0x8')](),controller[_0x13ee('0xe')]);router['get'](_0x13ee('0xf'),auth['isAuthenticated'](),controller[_0x13ee('0x10')]);router[_0x13ee('0x11')]('/',auth['isAuthenticated'](),controller[_0x13ee('0x12')]);router[_0x13ee('0x13')](_0x13ee('0x14'),auth['isAuthenticated'](),controller[_0x13ee('0x15')]);router[_0x13ee('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x13ee('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 81d9054..71f6ec4 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 _0x380b=['STRING','sequelize'];(function(_0x1ddd08,_0x7f297d){var _0x38fcf9=function(_0x1415a9){while(--_0x1415a9){_0x1ddd08['push'](_0x1ddd08['shift']());}};_0x38fcf9(++_0x7f297d);}(_0x380b,0x69));var _0xb380=function(_0x953a5e,_0x1f882c){_0x953a5e=_0x953a5e-0x0;var _0x4e58da=_0x380b[_0x953a5e];return _0x4e58da;};'use strict';var Sequelize=require(_0xb380('0x0'));module['exports']={'name':{'type':Sequelize[_0xb380('0x1')]},'description':{'type':Sequelize[_0xb380('0x1')]}}; \ No newline at end of file +var _0x88f3=['STRING','sequelize','exports'];(function(_0x9ff3cc,_0x4d286a){var _0x168f8a=function(_0x3b9466){while(--_0x3b9466){_0x9ff3cc['push'](_0x9ff3cc['shift']());}};_0x168f8a(++_0x4d286a);}(_0x88f3,0xfa));var _0x388f=function(_0x150e77,_0x599980){_0x150e77=_0x150e77-0x0;var _0x2d4863=_0x88f3[_0x150e77];return _0x2d4863;};'use strict';var Sequelize=require(_0x388f('0x0'));module[_0x388f('0x1')]={'name':{'type':Sequelize[_0x388f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 6dd0591..2f75e51 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 _0xdab8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','apply','update','then','sendStatus','stack','name','send','index','SugarcrmConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xdab8,0xda));var _0x8dab=function(_0x39ebaa,_0x1e4ab5){_0x39ebaa=_0x39ebaa-0x0;var _0x505114=_0xdab8[_0x39ebaa];return _0x505114;};'use strict';var emlformat=require(_0x8dab('0x0'));var rimraf=require(_0x8dab('0x1'));var zipdir=require(_0x8dab('0x2'));var jsonpatch=require(_0x8dab('0x3'));var rp=require(_0x8dab('0x4'));var moment=require(_0x8dab('0x5'));var BPromise=require(_0x8dab('0x6'));var Mustache=require(_0x8dab('0x7'));var util=require(_0x8dab('0x8'));var path=require(_0x8dab('0x9'));var sox=require(_0x8dab('0xa'));var csv=require(_0x8dab('0xb'));var ejs=require(_0x8dab('0xc'));var fs=require('fs');var fs_extra=require(_0x8dab('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8dab('0xe'));var jsforce=require(_0x8dab('0xf'));var deskjs=require(_0x8dab('0x10'));var toCsv=require(_0x8dab('0xb'));var querystring=require(_0x8dab('0x11'));var Papa=require(_0x8dab('0x12'));var Redis=require('ioredis');var authService=require(_0x8dab('0x13'));var qs=require(_0x8dab('0x14'));var as=require(_0x8dab('0x15'));var hardwareService=require(_0x8dab('0x16'));var logger=require('../../config/logger')(_0x8dab('0x17'));var utils=require(_0x8dab('0x18'));var config=require(_0x8dab('0x19'));var licenseUtil=require(_0x8dab('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea0ef,_0x2948c5){_0x2948c5=_0x2948c5||0xcc;return function(_0xdcdd99){if(_0xdcdd99){return _0x5ea0ef['sendStatus'](_0x2948c5);}return _0x5ea0ef[_0x8dab('0x1b')](_0x2948c5)[_0x8dab('0x1c')]();};}function respondWithResult(_0x323427,_0x5bb299){_0x5bb299=_0x5bb299||0xc8;return function(_0x167586){if(_0x167586){return _0x323427[_0x8dab('0x1b')](_0x5bb299)[_0x8dab('0x1d')](_0x167586);}};}function respondWithFilteredResult(_0x1829bd,_0x168e44){return function(_0x359bf7){if(_0x359bf7){var _0x140d0e=typeof _0x168e44[_0x8dab('0x1e')]==='undefined'&&typeof _0x168e44[_0x8dab('0x1f')]==='undefined';var _0x156f2a=_0x359bf7['count'];var _0x188877=_0x140d0e?0x0:_0x168e44[_0x8dab('0x1e')];var _0x67b14=_0x140d0e?_0x359bf7[_0x8dab('0x20')]:_0x168e44[_0x8dab('0x1e')]+_0x168e44[_0x8dab('0x1f')];var _0xe505f0;if(_0x67b14>=_0x156f2a){_0x67b14=_0x156f2a;_0xe505f0=0xc8;}else{_0xe505f0=0xce;}_0x1829bd[_0x8dab('0x1b')](_0xe505f0);return _0x1829bd[_0x8dab('0x21')]('Content-Range',_0x188877+'-'+_0x67b14+'/'+_0x156f2a)[_0x8dab('0x1d')](_0x359bf7);}return null;};}function patchUpdates(_0x4cba39){return function(_0x276626){try{jsonpatch[_0x8dab('0x22')](_0x276626,_0x4cba39,!![]);}catch(_0x227227){return BPromise['reject'](_0x227227);}return _0x276626['save']();};}function saveUpdates(_0x544f51,_0x4d15e4){return function(_0x34576b){if(_0x34576b){return _0x34576b[_0x8dab('0x23')](_0x544f51)[_0x8dab('0x24')](function(_0x2d6cb7){return _0x2d6cb7;});}return null;};}function removeEntity(_0x50e6b9,_0x58dd4a){return function(_0x1bc8ce){if(_0x1bc8ce){return _0x1bc8ce['destroy']()[_0x8dab('0x24')](function(){_0x50e6b9[_0x8dab('0x1b')](0xcc)[_0x8dab('0x1c')]();});}};}function handleEntityNotFound(_0x291844,_0x1abb82){return function(_0x6c7f83){if(!_0x6c7f83){_0x291844[_0x8dab('0x25')](0x194);}return _0x6c7f83;};}function handleError(_0x2e7f9f,_0x47ab77){_0x47ab77=_0x47ab77||0x1f4;return function(_0x50db2a){logger['error'](_0x50db2a[_0x8dab('0x26')]);if(_0x50db2a[_0x8dab('0x27')]){delete _0x50db2a[_0x8dab('0x27')];}_0x2e7f9f[_0x8dab('0x1b')](_0x47ab77)[_0x8dab('0x28')](_0x50db2a);};}exports[_0x8dab('0x29')]=function(_0x589726,_0x5f4875){var _0x220c76={},_0x1978a6={},_0x4ba687={'count':0x0,'rows':[]};var _0x1cfab9=_['map'](db[_0x8dab('0x2a')]['rawAttributes'],function(_0x1ad898){return{'name':_0x1ad898[_0x8dab('0x2b')],'type':_0x1ad898[_0x8dab('0x2c')][_0x8dab('0x2d')]};});_0x1978a6[_0x8dab('0x2e')]=_[_0x8dab('0x2f')](_0x1cfab9,_0x8dab('0x27'));_0x1978a6[_0x8dab('0x30')]=_[_0x8dab('0x31')](_0x589726[_0x8dab('0x30')]);_0x1978a6[_0x8dab('0x32')]=_[_0x8dab('0x33')](_0x1978a6['model'],_0x1978a6[_0x8dab('0x30')]);_0x220c76['attributes']=_[_0x8dab('0x33')](_0x1978a6['model'],qs['fields'](_0x589726[_0x8dab('0x30')][_0x8dab('0x34')]));_0x220c76[_0x8dab('0x35')]=_0x220c76[_0x8dab('0x35')][_0x8dab('0x36')]?_0x220c76[_0x8dab('0x35')]:_0x1978a6[_0x8dab('0x2e')];if(!_0x589726[_0x8dab('0x30')][_0x8dab('0x37')]('nolimit')){_0x220c76[_0x8dab('0x1f')]=qs['limit'](_0x589726[_0x8dab('0x30')][_0x8dab('0x1f')]);_0x220c76[_0x8dab('0x1e')]=qs['offset'](_0x589726[_0x8dab('0x30')][_0x8dab('0x1e')]);}_0x220c76[_0x8dab('0x38')]=qs[_0x8dab('0x39')](_0x589726[_0x8dab('0x30')][_0x8dab('0x39')]);_0x220c76['where']=qs['filters'](_[_0x8dab('0x3a')](_0x589726[_0x8dab('0x30')],_0x1978a6[_0x8dab('0x32')]),_0x1cfab9);if(_0x589726['query'][_0x8dab('0x3b')]){_0x220c76['where']=_[_0x8dab('0x3c')](_0x220c76[_0x8dab('0x3d')],{'$or':_[_0x8dab('0x2f')](_0x1cfab9,function(_0x4c6282){if(_0x4c6282[_0x8dab('0x2c')]!=='VIRTUAL'){var _0x70ac0a={};_0x70ac0a[_0x4c6282[_0x8dab('0x27')]]={'$like':'%'+_0x589726[_0x8dab('0x30')][_0x8dab('0x3b')]+'%'};return _0x70ac0a;}})});}_0x220c76=_['merge']({},_0x220c76,_0x589726[_0x8dab('0x3e')]);var _0x29afc0={'where':_0x220c76['where']};return db['SugarcrmConfiguration'][_0x8dab('0x20')](_0x29afc0)['then'](function(_0x1500ee){_0x4ba687[_0x8dab('0x20')]=_0x1500ee;if(_0x589726['query'][_0x8dab('0x3f')]){_0x220c76[_0x8dab('0x40')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x8dab('0x41')](_0x220c76);})[_0x8dab('0x24')](function(_0x495fbe){_0x4ba687[_0x8dab('0x42')]=_0x495fbe;return _0x4ba687;})[_0x8dab('0x24')](respondWithFilteredResult(_0x5f4875,_0x220c76))[_0x8dab('0x43')](handleError(_0x5f4875,null));};exports[_0x8dab('0x44')]=function(_0x2ef555,_0x2636b1){var _0x169a60={'raw':![],'where':{'id':_0x2ef555[_0x8dab('0x45')]['id']}},_0x5c8105={};_0x5c8105[_0x8dab('0x2e')]=_[_0x8dab('0x31')](db['SugarcrmConfiguration'][_0x8dab('0x46')]);_0x5c8105['query']=_['keys'](_0x2ef555['query']);_0x5c8105['filters']=_['intersection'](_0x5c8105[_0x8dab('0x2e')],_0x5c8105[_0x8dab('0x30')]);_0x169a60[_0x8dab('0x35')]=_[_0x8dab('0x33')](_0x5c8105[_0x8dab('0x2e')],qs[_0x8dab('0x34')](_0x2ef555['query'][_0x8dab('0x34')]));_0x169a60['attributes']=_0x169a60[_0x8dab('0x35')]['length']?_0x169a60['attributes']:_0x5c8105['model'];if(_0x2ef555[_0x8dab('0x30')][_0x8dab('0x3f')]){_0x169a60[_0x8dab('0x40')]=[{'all':!![]}];}_0x169a60=_[_0x8dab('0x3c')]({},_0x169a60,_0x2ef555[_0x8dab('0x3e')]);return db['SugarcrmConfiguration'][_0x8dab('0x47')](_0x169a60)[_0x8dab('0x24')](handleEntityNotFound(_0x2636b1,null))[_0x8dab('0x24')](respondWithResult(_0x2636b1,null))['catch'](handleError(_0x2636b1,null));};exports['create']=function(_0x1b13f8,_0x1c965b){return db[_0x8dab('0x2a')]['create'](_0x1b13f8[_0x8dab('0x48')],{})[_0x8dab('0x24')](respondWithResult(_0x1c965b,0xc9))[_0x8dab('0x43')](handleError(_0x1c965b,null));};exports[_0x8dab('0x23')]=function(_0xdbfc1c,_0x1dc010){if(_0xdbfc1c[_0x8dab('0x48')]['id']){delete _0xdbfc1c[_0x8dab('0x48')]['id'];}return db[_0x8dab('0x2a')][_0x8dab('0x47')]({'where':{'id':_0xdbfc1c[_0x8dab('0x45')]['id']}})['then'](handleEntityNotFound(_0x1dc010,null))[_0x8dab('0x24')](saveUpdates(_0xdbfc1c[_0x8dab('0x48')],null))[_0x8dab('0x24')](respondWithResult(_0x1dc010,null))[_0x8dab('0x43')](handleError(_0x1dc010,null));};exports['destroy']=function(_0x221ebe,_0x406d1d){return db[_0x8dab('0x2a')][_0x8dab('0x47')]({'where':{'id':_0x221ebe[_0x8dab('0x45')]['id']}})[_0x8dab('0x24')](handleEntityNotFound(_0x406d1d,null))[_0x8dab('0x24')](removeEntity(_0x406d1d,null))[_0x8dab('0x43')](handleError(_0x406d1d,null));};exports[_0x8dab('0x49')]=function(_0x7d3118,_0x450725,_0x41d890){var _0x49358d={};var _0x5ab6dd={};var _0x1ce1cd;var _0x3d8093;return db[_0x8dab('0x2a')][_0x8dab('0x4a')]({'where':{'id':_0x7d3118[_0x8dab('0x45')]['id']}})[_0x8dab('0x24')](handleEntityNotFound(_0x450725,null))['then'](function(_0x545fc4){if(_0x545fc4){_0x1ce1cd=_0x545fc4;_0x5ab6dd[_0x8dab('0x2e')]=_[_0x8dab('0x31')](db['SugarcrmField'][_0x8dab('0x46')]);_0x5ab6dd['query']=_[_0x8dab('0x31')](_0x7d3118[_0x8dab('0x30')]);_0x5ab6dd['filters']=_[_0x8dab('0x33')](_0x5ab6dd[_0x8dab('0x2e')],_0x5ab6dd[_0x8dab('0x30')]);_0x49358d[_0x8dab('0x35')]=_[_0x8dab('0x33')](_0x5ab6dd[_0x8dab('0x2e')],qs[_0x8dab('0x34')](_0x7d3118[_0x8dab('0x30')][_0x8dab('0x34')]));_0x49358d[_0x8dab('0x35')]=_0x49358d[_0x8dab('0x35')]['length']?_0x49358d[_0x8dab('0x35')]:_0x5ab6dd[_0x8dab('0x2e')];_0x49358d[_0x8dab('0x38')]=qs['sort'](_0x7d3118[_0x8dab('0x30')][_0x8dab('0x39')]);_0x49358d[_0x8dab('0x3d')]=qs[_0x8dab('0x32')](_[_0x8dab('0x3a')](_0x7d3118['query'],_0x5ab6dd[_0x8dab('0x32')]));if(_0x7d3118[_0x8dab('0x30')][_0x8dab('0x3b')]){_0x49358d[_0x8dab('0x3d')]=_[_0x8dab('0x3c')](_0x49358d['where'],{'$or':_[_0x8dab('0x2f')](_0x49358d[_0x8dab('0x35')],function(_0x1dfd1d){var _0x180a69={};_0x180a69[_0x1dfd1d]={'$like':'%'+_0x7d3118['query'][_0x8dab('0x3b')]+'%'};return _0x180a69;})});}_0x49358d=_['merge']({},_0x49358d,_0x7d3118[_0x8dab('0x3e')]);return _0x1ce1cd[_0x8dab('0x49')](_0x49358d);}})[_0x8dab('0x24')](function(_0x51dd5a){if(_0x51dd5a){_0x3d8093=_0x51dd5a[_0x8dab('0x36')];if(!_0x7d3118[_0x8dab('0x30')][_0x8dab('0x37')]('nolimit')){_0x49358d[_0x8dab('0x1f')]=qs[_0x8dab('0x1f')](_0x7d3118[_0x8dab('0x30')]['limit']);_0x49358d[_0x8dab('0x1e')]=qs['offset'](_0x7d3118['query'][_0x8dab('0x1e')]);}return _0x1ce1cd[_0x8dab('0x49')](_0x49358d);}})['then'](function(_0x391f95){if(_0x391f95){return _0x391f95?{'count':_0x3d8093,'rows':_0x391f95}:null;}})[_0x8dab('0x24')](respondWithResult(_0x450725,null))[_0x8dab('0x43')](handleError(_0x450725,null));};exports[_0x8dab('0x4b')]=function(_0x3c8748,_0x2acff6,_0xa8bcc3){var _0x50e07c={};var _0x14b2e2={};var _0x392811;var _0x577535;return db[_0x8dab('0x2a')][_0x8dab('0x4a')]({'where':{'id':_0x3c8748[_0x8dab('0x45')]['id']}})[_0x8dab('0x24')](handleEntityNotFound(_0x2acff6,null))[_0x8dab('0x24')](function(_0x3a0371){if(_0x3a0371){_0x392811=_0x3a0371;_0x14b2e2[_0x8dab('0x2e')]=_['keys'](db[_0x8dab('0x4c')]['rawAttributes']);_0x14b2e2[_0x8dab('0x30')]=_[_0x8dab('0x31')](_0x3c8748[_0x8dab('0x30')]);_0x14b2e2[_0x8dab('0x32')]=_[_0x8dab('0x33')](_0x14b2e2['model'],_0x14b2e2['query']);_0x50e07c[_0x8dab('0x35')]=_[_0x8dab('0x33')](_0x14b2e2[_0x8dab('0x2e')],qs[_0x8dab('0x34')](_0x3c8748[_0x8dab('0x30')][_0x8dab('0x34')]));_0x50e07c['attributes']=_0x50e07c[_0x8dab('0x35')][_0x8dab('0x36')]?_0x50e07c[_0x8dab('0x35')]:_0x14b2e2[_0x8dab('0x2e')];_0x50e07c[_0x8dab('0x38')]=qs['sort'](_0x3c8748[_0x8dab('0x30')][_0x8dab('0x39')]);_0x50e07c[_0x8dab('0x3d')]=qs[_0x8dab('0x32')](_[_0x8dab('0x3a')](_0x3c8748[_0x8dab('0x30')],_0x14b2e2[_0x8dab('0x32')]));if(_0x3c8748[_0x8dab('0x30')][_0x8dab('0x3b')]){_0x50e07c[_0x8dab('0x3d')]=_[_0x8dab('0x3c')](_0x50e07c['where'],{'$or':_[_0x8dab('0x2f')](_0x50e07c[_0x8dab('0x35')],function(_0x4b00d7){var _0xbed46d={};_0xbed46d[_0x4b00d7]={'$like':'%'+_0x3c8748[_0x8dab('0x30')][_0x8dab('0x3b')]+'%'};return _0xbed46d;})});}_0x50e07c=_[_0x8dab('0x3c')]({},_0x50e07c,_0x3c8748['options']);return _0x392811[_0x8dab('0x4b')](_0x50e07c);}})[_0x8dab('0x24')](function(_0x4b8a74){if(_0x4b8a74){_0x577535=_0x4b8a74['length'];if(!_0x3c8748['query'][_0x8dab('0x37')]('nolimit')){_0x50e07c[_0x8dab('0x1f')]=qs[_0x8dab('0x1f')](_0x3c8748[_0x8dab('0x30')][_0x8dab('0x1f')]);_0x50e07c[_0x8dab('0x1e')]=qs[_0x8dab('0x1e')](_0x3c8748[_0x8dab('0x30')][_0x8dab('0x1e')]);}return _0x392811[_0x8dab('0x4b')](_0x50e07c);}})[_0x8dab('0x24')](function(_0x515a9a){if(_0x515a9a){return _0x515a9a?{'count':_0x577535,'rows':_0x515a9a}:null;}})[_0x8dab('0x24')](respondWithResult(_0x2acff6,null))[_0x8dab('0x43')](handleError(_0x2acff6,null));};exports[_0x8dab('0x4d')]=function(_0x437724,_0xa04e15,_0x10fa51){var _0x45b6ab={};var _0x317bce={};var _0x1352ba;var _0x4b7cfc;return db[_0x8dab('0x2a')][_0x8dab('0x4a')]({'where':{'id':_0x437724[_0x8dab('0x45')]['id']}})[_0x8dab('0x24')](handleEntityNotFound(_0xa04e15,null))[_0x8dab('0x24')](function(_0x304717){if(_0x304717){_0x1352ba=_0x304717;_0x317bce['model']=_['keys'](db['SugarcrmField'][_0x8dab('0x46')]);_0x317bce[_0x8dab('0x30')]=_[_0x8dab('0x31')](_0x437724[_0x8dab('0x30')]);_0x317bce['filters']=_[_0x8dab('0x33')](_0x317bce['model'],_0x317bce[_0x8dab('0x30')]);_0x45b6ab['attributes']=_['intersection'](_0x317bce[_0x8dab('0x2e')],qs['fields'](_0x437724[_0x8dab('0x30')][_0x8dab('0x34')]));_0x45b6ab[_0x8dab('0x35')]=_0x45b6ab[_0x8dab('0x35')][_0x8dab('0x36')]?_0x45b6ab[_0x8dab('0x35')]:_0x317bce[_0x8dab('0x2e')];_0x45b6ab[_0x8dab('0x38')]=qs[_0x8dab('0x39')](_0x437724['query'][_0x8dab('0x39')]);_0x45b6ab[_0x8dab('0x3d')]=qs['filters'](_[_0x8dab('0x3a')](_0x437724['query'],_0x317bce[_0x8dab('0x32')]));if(_0x437724[_0x8dab('0x30')][_0x8dab('0x3b')]){_0x45b6ab[_0x8dab('0x3d')]=_[_0x8dab('0x3c')](_0x45b6ab[_0x8dab('0x3d')],{'$or':_['map'](_0x45b6ab[_0x8dab('0x35')],function(_0x46cab6){var _0x55cfdb={};_0x55cfdb[_0x46cab6]={'$like':'%'+_0x437724[_0x8dab('0x30')][_0x8dab('0x3b')]+'%'};return _0x55cfdb;})});}_0x45b6ab=_['merge']({},_0x45b6ab,_0x437724[_0x8dab('0x3e')]);return _0x1352ba['getDescriptions'](_0x45b6ab);}})[_0x8dab('0x24')](function(_0xe067b){if(_0xe067b){_0x4b7cfc=_0xe067b[_0x8dab('0x36')];if(!_0x437724[_0x8dab('0x30')][_0x8dab('0x37')](_0x8dab('0x4e'))){_0x45b6ab[_0x8dab('0x1f')]=qs[_0x8dab('0x1f')](_0x437724[_0x8dab('0x30')][_0x8dab('0x1f')]);_0x45b6ab[_0x8dab('0x1e')]=qs[_0x8dab('0x1e')](_0x437724[_0x8dab('0x30')][_0x8dab('0x1e')]);}return _0x1352ba['getDescriptions'](_0x45b6ab);}})['then'](function(_0x269f47){if(_0x269f47){return _0x269f47?{'count':_0x4b7cfc,'rows':_0x269f47}:null;}})[_0x8dab('0x24')](respondWithResult(_0xa04e15,null))['catch'](handleError(_0xa04e15,null));}; \ No newline at end of file +var _0xb3e1=['set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','destroy','getFields','findOne','SugarcrmField','order','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset'];(function(_0xcca6a3,_0x216939){var _0xc33351=function(_0x6901a8){while(--_0x6901a8){_0xcca6a3['push'](_0xcca6a3['shift']());}};_0xc33351(++_0x216939);}(_0xb3e1,0x7f));var _0x1b3e=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xb3e1[_0x4953da];return _0x2d3780;};'use strict';var emlformat=require(_0x1b3e('0x0'));var rimraf=require(_0x1b3e('0x1'));var zipdir=require(_0x1b3e('0x2'));var jsonpatch=require(_0x1b3e('0x3'));var rp=require(_0x1b3e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b3e('0x5'));var util=require(_0x1b3e('0x6'));var path=require('path');var sox=require(_0x1b3e('0x7'));var csv=require(_0x1b3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b3e('0x9'));var _=require(_0x1b3e('0xa'));var squel=require(_0x1b3e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b3e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1b3e('0xd'));var Papa=require(_0x1b3e('0xe'));var Redis=require('ioredis');var authService=require(_0x1b3e('0xf'));var qs=require(_0x1b3e('0x10'));var as=require(_0x1b3e('0x11'));var hardwareService=require(_0x1b3e('0x12'));var logger=require(_0x1b3e('0x13'))(_0x1b3e('0x14'));var utils=require('../../config/utils');var config=require(_0x1b3e('0x15'));var licenseUtil=require(_0x1b3e('0x16'));var db=require(_0x1b3e('0x17'))['db'];function respondWithStatusCode(_0x683741,_0x203f20){_0x203f20=_0x203f20||0xcc;return function(_0x1ebebe){if(_0x1ebebe){return _0x683741[_0x1b3e('0x18')](_0x203f20);}return _0x683741[_0x1b3e('0x19')](_0x203f20)[_0x1b3e('0x1a')]();};}function respondWithResult(_0x1c57b,_0x344469){_0x344469=_0x344469||0xc8;return function(_0x31b61a){if(_0x31b61a){return _0x1c57b[_0x1b3e('0x19')](_0x344469)[_0x1b3e('0x1b')](_0x31b61a);}};}function respondWithFilteredResult(_0x3c0b5b,_0x4d090a){return function(_0x5249d1){if(_0x5249d1){var _0x100bd6=typeof _0x4d090a['offset']==='undefined'&&typeof _0x4d090a[_0x1b3e('0x1c')]==='undefined';var _0x147727=_0x5249d1[_0x1b3e('0x1d')];var _0x1a771b=_0x100bd6?0x0:_0x4d090a[_0x1b3e('0x1e')];var _0x6fa780=_0x100bd6?_0x5249d1[_0x1b3e('0x1d')]:_0x4d090a[_0x1b3e('0x1e')]+_0x4d090a['limit'];var _0x27a90e;if(_0x6fa780>=_0x147727){_0x6fa780=_0x147727;_0x27a90e=0xc8;}else{_0x27a90e=0xce;}_0x3c0b5b['status'](_0x27a90e);return _0x3c0b5b[_0x1b3e('0x1f')](_0x1b3e('0x20'),_0x1a771b+'-'+_0x6fa780+'/'+_0x147727)['json'](_0x5249d1);}return null;};}function patchUpdates(_0x3ed426){return function(_0x4677cc){try{jsonpatch[_0x1b3e('0x21')](_0x4677cc,_0x3ed426,!![]);}catch(_0x194d04){return BPromise[_0x1b3e('0x22')](_0x194d04);}return _0x4677cc[_0x1b3e('0x23')]();};}function saveUpdates(_0x1d466b,_0x2bee32){return function(_0x20bf56){if(_0x20bf56){return _0x20bf56[_0x1b3e('0x24')](_0x1d466b)[_0x1b3e('0x25')](function(_0x45d88f){return _0x45d88f;});}return null;};}function removeEntity(_0x4f3f11,_0x3678c7){return function(_0x45a3f7){if(_0x45a3f7){return _0x45a3f7['destroy']()[_0x1b3e('0x25')](function(){_0x4f3f11[_0x1b3e('0x19')](0xcc)[_0x1b3e('0x1a')]();});}};}function handleEntityNotFound(_0x4df130,_0x440702){return function(_0x1e7795){if(!_0x1e7795){_0x4df130[_0x1b3e('0x18')](0x194);}return _0x1e7795;};}function handleError(_0x3961cf,_0x1590e5){_0x1590e5=_0x1590e5||0x1f4;return function(_0x1d0cb5){logger[_0x1b3e('0x26')](_0x1d0cb5[_0x1b3e('0x27')]);if(_0x1d0cb5['name']){delete _0x1d0cb5[_0x1b3e('0x28')];}_0x3961cf[_0x1b3e('0x19')](_0x1590e5)[_0x1b3e('0x29')](_0x1d0cb5);};}exports['index']=function(_0x3b972b,_0x2df2b0){var _0x48349c={},_0x19ed8a={},_0x337e76={'count':0x0,'rows':[]};var _0x55dcc8=_[_0x1b3e('0x2a')](db[_0x1b3e('0x2b')][_0x1b3e('0x2c')],function(_0x4df3e6){return{'name':_0x4df3e6[_0x1b3e('0x2d')],'type':_0x4df3e6['type']['key']};});_0x19ed8a[_0x1b3e('0x2e')]=_[_0x1b3e('0x2a')](_0x55dcc8,_0x1b3e('0x28'));_0x19ed8a[_0x1b3e('0x2f')]=_['keys'](_0x3b972b['query']);_0x19ed8a[_0x1b3e('0x30')]=_[_0x1b3e('0x31')](_0x19ed8a[_0x1b3e('0x2e')],_0x19ed8a[_0x1b3e('0x2f')]);_0x48349c[_0x1b3e('0x32')]=_[_0x1b3e('0x31')](_0x19ed8a[_0x1b3e('0x2e')],qs['fields'](_0x3b972b['query'][_0x1b3e('0x33')]));_0x48349c[_0x1b3e('0x32')]=_0x48349c[_0x1b3e('0x32')][_0x1b3e('0x34')]?_0x48349c[_0x1b3e('0x32')]:_0x19ed8a['model'];if(!_0x3b972b['query'][_0x1b3e('0x35')]('nolimit')){_0x48349c[_0x1b3e('0x1c')]=qs[_0x1b3e('0x1c')](_0x3b972b['query']['limit']);_0x48349c[_0x1b3e('0x1e')]=qs[_0x1b3e('0x1e')](_0x3b972b[_0x1b3e('0x2f')][_0x1b3e('0x1e')]);}_0x48349c['order']=qs[_0x1b3e('0x36')](_0x3b972b[_0x1b3e('0x2f')]['sort']);_0x48349c[_0x1b3e('0x37')]=qs[_0x1b3e('0x30')](_['pick'](_0x3b972b['query'],_0x19ed8a[_0x1b3e('0x30')]),_0x55dcc8);if(_0x3b972b['query']['filter']){_0x48349c[_0x1b3e('0x37')]=_['merge'](_0x48349c[_0x1b3e('0x37')],{'$or':_['map'](_0x55dcc8,function(_0x54bfa2){if(_0x54bfa2['type']!==_0x1b3e('0x38')){var _0x347a8b={};_0x347a8b[_0x54bfa2[_0x1b3e('0x28')]]={'$like':'%'+_0x3b972b['query'][_0x1b3e('0x39')]+'%'};return _0x347a8b;}})});}_0x48349c=_['merge']({},_0x48349c,_0x3b972b[_0x1b3e('0x3a')]);var _0x331832={'where':_0x48349c[_0x1b3e('0x37')]};return db[_0x1b3e('0x2b')]['count'](_0x331832)[_0x1b3e('0x25')](function(_0x590670){_0x337e76[_0x1b3e('0x1d')]=_0x590670;if(_0x3b972b[_0x1b3e('0x2f')][_0x1b3e('0x3b')]){_0x48349c[_0x1b3e('0x3c')]=[{'all':!![]}];}return db[_0x1b3e('0x2b')][_0x1b3e('0x3d')](_0x48349c);})[_0x1b3e('0x25')](function(_0x1624d8){_0x337e76[_0x1b3e('0x3e')]=_0x1624d8;return _0x337e76;})[_0x1b3e('0x25')](respondWithFilteredResult(_0x2df2b0,_0x48349c))[_0x1b3e('0x3f')](handleError(_0x2df2b0,null));};exports['show']=function(_0x27ba0e,_0xf21b61){var _0x4aff19={'raw':![],'where':{'id':_0x27ba0e[_0x1b3e('0x40')]['id']}},_0x4e6ea1={};_0x4e6ea1['model']=_[_0x1b3e('0x41')](db['SugarcrmConfiguration'][_0x1b3e('0x2c')]);_0x4e6ea1[_0x1b3e('0x2f')]=_['keys'](_0x27ba0e[_0x1b3e('0x2f')]);_0x4e6ea1[_0x1b3e('0x30')]=_[_0x1b3e('0x31')](_0x4e6ea1['model'],_0x4e6ea1[_0x1b3e('0x2f')]);_0x4aff19['attributes']=_[_0x1b3e('0x31')](_0x4e6ea1['model'],qs[_0x1b3e('0x33')](_0x27ba0e[_0x1b3e('0x2f')][_0x1b3e('0x33')]));_0x4aff19[_0x1b3e('0x32')]=_0x4aff19[_0x1b3e('0x32')][_0x1b3e('0x34')]?_0x4aff19[_0x1b3e('0x32')]:_0x4e6ea1[_0x1b3e('0x2e')];if(_0x27ba0e[_0x1b3e('0x2f')][_0x1b3e('0x3b')]){_0x4aff19[_0x1b3e('0x3c')]=[{'all':!![]}];}_0x4aff19=_[_0x1b3e('0x42')]({},_0x4aff19,_0x27ba0e[_0x1b3e('0x3a')]);return db[_0x1b3e('0x2b')][_0x1b3e('0x43')](_0x4aff19)['then'](handleEntityNotFound(_0xf21b61,null))['then'](respondWithResult(_0xf21b61,null))[_0x1b3e('0x3f')](handleError(_0xf21b61,null));};exports['create']=function(_0x2b2502,_0x2c331e){return db[_0x1b3e('0x2b')][_0x1b3e('0x44')](_0x2b2502[_0x1b3e('0x45')],{})[_0x1b3e('0x25')](respondWithResult(_0x2c331e,0xc9))[_0x1b3e('0x3f')](handleError(_0x2c331e,null));};exports[_0x1b3e('0x24')]=function(_0x5906ca,_0x19ac70){if(_0x5906ca['body']['id']){delete _0x5906ca[_0x1b3e('0x45')]['id'];}return db[_0x1b3e('0x2b')]['find']({'where':{'id':_0x5906ca[_0x1b3e('0x40')]['id']}})[_0x1b3e('0x25')](handleEntityNotFound(_0x19ac70,null))[_0x1b3e('0x25')](saveUpdates(_0x5906ca[_0x1b3e('0x45')],null))[_0x1b3e('0x25')](respondWithResult(_0x19ac70,null))['catch'](handleError(_0x19ac70,null));};exports[_0x1b3e('0x46')]=function(_0x5681c4,_0x1a257d){return db[_0x1b3e('0x2b')][_0x1b3e('0x43')]({'where':{'id':_0x5681c4[_0x1b3e('0x40')]['id']}})['then'](handleEntityNotFound(_0x1a257d,null))[_0x1b3e('0x25')](removeEntity(_0x1a257d,null))[_0x1b3e('0x3f')](handleError(_0x1a257d,null));};exports[_0x1b3e('0x47')]=function(_0x2b7f1b,_0x1065c0,_0x290433){var _0x241977={};var _0x2ed65b={};var _0x365929;var _0x27460b;return db[_0x1b3e('0x2b')][_0x1b3e('0x48')]({'where':{'id':_0x2b7f1b[_0x1b3e('0x40')]['id']}})[_0x1b3e('0x25')](handleEntityNotFound(_0x1065c0,null))['then'](function(_0x562be1){if(_0x562be1){_0x365929=_0x562be1;_0x2ed65b['model']=_[_0x1b3e('0x41')](db[_0x1b3e('0x49')][_0x1b3e('0x2c')]);_0x2ed65b[_0x1b3e('0x2f')]=_['keys'](_0x2b7f1b[_0x1b3e('0x2f')]);_0x2ed65b[_0x1b3e('0x30')]=_[_0x1b3e('0x31')](_0x2ed65b[_0x1b3e('0x2e')],_0x2ed65b[_0x1b3e('0x2f')]);_0x241977['attributes']=_[_0x1b3e('0x31')](_0x2ed65b[_0x1b3e('0x2e')],qs[_0x1b3e('0x33')](_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x33')]));_0x241977[_0x1b3e('0x32')]=_0x241977[_0x1b3e('0x32')][_0x1b3e('0x34')]?_0x241977['attributes']:_0x2ed65b[_0x1b3e('0x2e')];_0x241977[_0x1b3e('0x4a')]=qs[_0x1b3e('0x36')](_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x36')]);_0x241977[_0x1b3e('0x37')]=qs[_0x1b3e('0x30')](_[_0x1b3e('0x4b')](_0x2b7f1b[_0x1b3e('0x2f')],_0x2ed65b[_0x1b3e('0x30')]));if(_0x2b7f1b['query'][_0x1b3e('0x39')]){_0x241977[_0x1b3e('0x37')]=_[_0x1b3e('0x42')](_0x241977[_0x1b3e('0x37')],{'$or':_[_0x1b3e('0x2a')](_0x241977[_0x1b3e('0x32')],function(_0x30f28d){var _0x5c8341={};_0x5c8341[_0x30f28d]={'$like':'%'+_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x39')]+'%'};return _0x5c8341;})});}_0x241977=_['merge']({},_0x241977,_0x2b7f1b[_0x1b3e('0x3a')]);return _0x365929[_0x1b3e('0x47')](_0x241977);}})[_0x1b3e('0x25')](function(_0x239766){if(_0x239766){_0x27460b=_0x239766['length'];if(!_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x35')]('nolimit')){_0x241977['limit']=qs[_0x1b3e('0x1c')](_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x1c')]);_0x241977['offset']=qs[_0x1b3e('0x1e')](_0x2b7f1b[_0x1b3e('0x2f')][_0x1b3e('0x1e')]);}return _0x365929[_0x1b3e('0x47')](_0x241977);}})['then'](function(_0x3e2d57){if(_0x3e2d57){return _0x3e2d57?{'count':_0x27460b,'rows':_0x3e2d57}:null;}})['then'](respondWithResult(_0x1065c0,null))[_0x1b3e('0x3f')](handleError(_0x1065c0,null));};exports[_0x1b3e('0x4c')]=function(_0x4a93b1,_0xcd8f74,_0x22bca8){var _0x1dfc33={};var _0x31045c={};var _0x2b5cc2;var _0x4dcaa9;return db[_0x1b3e('0x2b')][_0x1b3e('0x48')]({'where':{'id':_0x4a93b1[_0x1b3e('0x40')]['id']}})[_0x1b3e('0x25')](handleEntityNotFound(_0xcd8f74,null))[_0x1b3e('0x25')](function(_0x40dddc){if(_0x40dddc){_0x2b5cc2=_0x40dddc;_0x31045c[_0x1b3e('0x2e')]=_[_0x1b3e('0x41')](db[_0x1b3e('0x49')]['rawAttributes']);_0x31045c[_0x1b3e('0x2f')]=_['keys'](_0x4a93b1[_0x1b3e('0x2f')]);_0x31045c[_0x1b3e('0x30')]=_[_0x1b3e('0x31')](_0x31045c[_0x1b3e('0x2e')],_0x31045c[_0x1b3e('0x2f')]);_0x1dfc33['attributes']=_[_0x1b3e('0x31')](_0x31045c[_0x1b3e('0x2e')],qs['fields'](_0x4a93b1[_0x1b3e('0x2f')][_0x1b3e('0x33')]));_0x1dfc33['attributes']=_0x1dfc33[_0x1b3e('0x32')][_0x1b3e('0x34')]?_0x1dfc33[_0x1b3e('0x32')]:_0x31045c[_0x1b3e('0x2e')];_0x1dfc33[_0x1b3e('0x4a')]=qs[_0x1b3e('0x36')](_0x4a93b1[_0x1b3e('0x2f')][_0x1b3e('0x36')]);_0x1dfc33[_0x1b3e('0x37')]=qs[_0x1b3e('0x30')](_[_0x1b3e('0x4b')](_0x4a93b1[_0x1b3e('0x2f')],_0x31045c[_0x1b3e('0x30')]));if(_0x4a93b1[_0x1b3e('0x2f')]['filter']){_0x1dfc33[_0x1b3e('0x37')]=_[_0x1b3e('0x42')](_0x1dfc33[_0x1b3e('0x37')],{'$or':_[_0x1b3e('0x2a')](_0x1dfc33[_0x1b3e('0x32')],function(_0x9284a5){var _0x491699={};_0x491699[_0x9284a5]={'$like':'%'+_0x4a93b1[_0x1b3e('0x2f')][_0x1b3e('0x39')]+'%'};return _0x491699;})});}_0x1dfc33=_[_0x1b3e('0x42')]({},_0x1dfc33,_0x4a93b1[_0x1b3e('0x3a')]);return _0x2b5cc2[_0x1b3e('0x4c')](_0x1dfc33);}})[_0x1b3e('0x25')](function(_0x578993){if(_0x578993){_0x4dcaa9=_0x578993[_0x1b3e('0x34')];if(!_0x4a93b1[_0x1b3e('0x2f')][_0x1b3e('0x35')](_0x1b3e('0x4d'))){_0x1dfc33[_0x1b3e('0x1c')]=qs[_0x1b3e('0x1c')](_0x4a93b1['query'][_0x1b3e('0x1c')]);_0x1dfc33[_0x1b3e('0x1e')]=qs[_0x1b3e('0x1e')](_0x4a93b1['query']['offset']);}return _0x2b5cc2[_0x1b3e('0x4c')](_0x1dfc33);}})[_0x1b3e('0x25')](function(_0x54caad){if(_0x54caad){return _0x54caad?{'count':_0x4dcaa9,'rows':_0x54caad}:null;}})[_0x1b3e('0x25')](respondWithResult(_0xcd8f74,null))['catch'](handleError(_0xcd8f74,null));};exports[_0x1b3e('0x4e')]=function(_0x889a56,_0x490c3f,_0x468c68){var _0x3bdc28={};var _0x257d06={};var _0x2b3c43;var _0x16f8d2;return db[_0x1b3e('0x2b')][_0x1b3e('0x48')]({'where':{'id':_0x889a56[_0x1b3e('0x40')]['id']}})[_0x1b3e('0x25')](handleEntityNotFound(_0x490c3f,null))[_0x1b3e('0x25')](function(_0x1ee80f){if(_0x1ee80f){_0x2b3c43=_0x1ee80f;_0x257d06[_0x1b3e('0x2e')]=_[_0x1b3e('0x41')](db[_0x1b3e('0x49')][_0x1b3e('0x2c')]);_0x257d06[_0x1b3e('0x2f')]=_[_0x1b3e('0x41')](_0x889a56[_0x1b3e('0x2f')]);_0x257d06[_0x1b3e('0x30')]=_['intersection'](_0x257d06[_0x1b3e('0x2e')],_0x257d06[_0x1b3e('0x2f')]);_0x3bdc28[_0x1b3e('0x32')]=_[_0x1b3e('0x31')](_0x257d06[_0x1b3e('0x2e')],qs[_0x1b3e('0x33')](_0x889a56['query']['fields']));_0x3bdc28[_0x1b3e('0x32')]=_0x3bdc28[_0x1b3e('0x32')][_0x1b3e('0x34')]?_0x3bdc28[_0x1b3e('0x32')]:_0x257d06[_0x1b3e('0x2e')];_0x3bdc28['order']=qs[_0x1b3e('0x36')](_0x889a56[_0x1b3e('0x2f')][_0x1b3e('0x36')]);_0x3bdc28['where']=qs[_0x1b3e('0x30')](_[_0x1b3e('0x4b')](_0x889a56['query'],_0x257d06[_0x1b3e('0x30')]));if(_0x889a56[_0x1b3e('0x2f')][_0x1b3e('0x39')]){_0x3bdc28[_0x1b3e('0x37')]=_['merge'](_0x3bdc28[_0x1b3e('0x37')],{'$or':_[_0x1b3e('0x2a')](_0x3bdc28[_0x1b3e('0x32')],function(_0x4b915a){var _0x419ba8={};_0x419ba8[_0x4b915a]={'$like':'%'+_0x889a56['query'][_0x1b3e('0x39')]+'%'};return _0x419ba8;})});}_0x3bdc28=_[_0x1b3e('0x42')]({},_0x3bdc28,_0x889a56[_0x1b3e('0x3a')]);return _0x2b3c43[_0x1b3e('0x4e')](_0x3bdc28);}})[_0x1b3e('0x25')](function(_0x4d7c9e){if(_0x4d7c9e){_0x16f8d2=_0x4d7c9e[_0x1b3e('0x34')];if(!_0x889a56['query'][_0x1b3e('0x35')](_0x1b3e('0x4d'))){_0x3bdc28[_0x1b3e('0x1c')]=qs[_0x1b3e('0x1c')](_0x889a56[_0x1b3e('0x2f')]['limit']);_0x3bdc28[_0x1b3e('0x1e')]=qs[_0x1b3e('0x1e')](_0x889a56['query']['offset']);}return _0x2b3c43[_0x1b3e('0x4e')](_0x3bdc28);}})[_0x1b3e('0x25')](function(_0x5de1b0){if(_0x5de1b0){return _0x5de1b0?{'count':_0x16f8d2,'rows':_0x5de1b0}:null;}})[_0x1b3e('0x25')](respondWithResult(_0x490c3f,null))['catch'](handleError(_0x490c3f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 1650138..5a355b4 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 _0xb99b=['exports','define','SugarcrmConfiguration','lodash','api','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb99b,0x66));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbb99('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbb99('0x1'));var moment=require('moment');var BPromise=require(_0xbb99('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb99('0x3'));var rimraf=require('rimraf');var config=require(_0xbb99('0x4'));var attributes=require(_0xbb99('0x5'));module[_0xbb99('0x6')]=function(_0x7f3b2d,_0x2ec7ff){return _0x7f3b2d[_0xbb99('0x7')](_0xbb99('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49d8=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x1ba559,_0xfcbc0f){var _0x550717=function(_0x561ad3){while(--_0x561ad3){_0x1ba559['push'](_0x1ba559['shift']());}};_0x550717(++_0xfcbc0f);}(_0x49d8,0x8e));var _0x849d=function(_0x5a3fb6,_0x13c509){_0x5a3fb6=_0x5a3fb6-0x0;var _0x11923a=_0x49d8[_0x5a3fb6];return _0x11923a;};'use strict';var _=require(_0x849d('0x0'));var util=require(_0x849d('0x1'));var logger=require(_0x849d('0x2'))(_0x849d('0x3'));var moment=require('moment');var BPromise=require(_0x849d('0x4'));var rp=require(_0x849d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x849d('0x6'));var config=require(_0x849d('0x7'));var attributes=require(_0x849d('0x8'));module[_0x849d('0x9')]=function(_0x414f7b,_0x2ed25f){return _0x414f7b[_0x849d('0xa')](_0x849d('0xb'),attributes,{'tableName':_0x849d('0xc'),'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 0f0aa15..14c79c5 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 _0x0a2c=['message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4153ad,_0x4bca07){var _0x5b3eb4=function(_0x16571f){while(--_0x16571f){_0x4153ad['push'](_0x4153ad['shift']());}};_0x5b3eb4(++_0x4bca07);}(_0x0a2c,0x1dd));var _0xc0a2=function(_0xcf06eb,_0x49b3fb){_0xcf06eb=_0xcf06eb-0x0;var _0x904559=_0x0a2c[_0xcf06eb];return _0x904559;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0a2('0x0'));var BPromise=require(_0xc0a2('0x1'));var rs=require(_0xc0a2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0a2('0x3'))['db'];var utils=require(_0xc0a2('0x4'));var logger=require(_0xc0a2('0x5'))(_0xc0a2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc0a2('0x7')][_0xc0a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x93d3c2,_0x22b728,_0xb90e61){return new BPromise(function(_0x49606e,_0x592ec9){return client['request'](_0x93d3c2,_0xb90e61)[_0xc0a2('0x9')](function(_0xde1672){logger[_0xc0a2('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22b728,_0xc0a2('0xb'));logger[_0xc0a2('0xc')](_0xc0a2('0xd'),_0x22b728,_0xc0a2('0xb'),JSON[_0xc0a2('0xe')](_0xde1672));if(_0xde1672[_0xc0a2('0xf')]){if(_0xde1672[_0xc0a2('0xf')]['code']===0x1f4){logger[_0xc0a2('0xf')](_0xc0a2('0x10'),_0x22b728,_0xde1672['error'][_0xc0a2('0x11')]);return _0x592ec9(_0xde1672[_0xc0a2('0xf')][_0xc0a2('0x11')]);}logger[_0xc0a2('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x22b728,_0xde1672[_0xc0a2('0xf')][_0xc0a2('0x11')]);return _0x49606e(_0xde1672[_0xc0a2('0xf')][_0xc0a2('0x11')]);}else{logger[_0xc0a2('0xa')](_0xc0a2('0x10'),_0x22b728,_0xc0a2('0xb'));_0x49606e(_0xde1672['result'][_0xc0a2('0x11')]);}})[_0xc0a2('0x12')](function(_0x1d09e7){logger[_0xc0a2('0xf')](_0xc0a2('0x10'),_0x22b728,_0x1d09e7);_0x592ec9(_0x1d09e7);});});} \ No newline at end of file +var _0x2c52=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x2c52,0x112));var _0x22c5=function(_0x54c419,_0x3f6d96){_0x54c419=_0x54c419-0x0;var _0x63a4c9=_0x2c52[_0x54c419];return _0x63a4c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x22c5('0x0'));var BPromise=require(_0x22c5('0x1'));var rs=require(_0x22c5('0x2'));var fs=require('fs');var Redis=require(_0x22c5('0x3'));var db=require(_0x22c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22c5('0x5'))(_0x22c5('0x6'));var config=require(_0x22c5('0x7'));var jayson=require(_0x22c5('0x8'));var client=jayson[_0x22c5('0x9')][_0x22c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11af09,_0x2c0050,_0x45dc71){return new BPromise(function(_0x583952,_0x304b1d){return client[_0x22c5('0xb')](_0x11af09,_0x45dc71)['then'](function(_0x36e840){logger[_0x22c5('0xc')](_0x22c5('0xd'),_0x2c0050,_0x22c5('0xe'));logger['debug'](_0x22c5('0xf'),_0x2c0050,_0x22c5('0xe'),JSON['stringify'](_0x36e840));if(_0x36e840[_0x22c5('0x10')]){if(_0x36e840['error'][_0x22c5('0x11')]===0x1f4){logger['error'](_0x22c5('0xd'),_0x2c0050,_0x36e840[_0x22c5('0x10')][_0x22c5('0x12')]);return _0x304b1d(_0x36e840[_0x22c5('0x10')][_0x22c5('0x12')]);}logger['error'](_0x22c5('0xd'),_0x2c0050,_0x36e840['error']['message']);return _0x583952(_0x36e840['error']['message']);}else{logger[_0x22c5('0xc')](_0x22c5('0xd'),_0x2c0050,_0x22c5('0xe'));_0x583952(_0x36e840[_0x22c5('0x13')]['message']);}})[_0x22c5('0x14')](function(_0x2eff47){logger[_0x22c5('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c0050,_0x2eff47);_0x304b1d(_0x2eff47);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index fd17b4f..12ba1fd 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 _0xd1ca=['../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x561038,_0x498d51){var _0x45722c=function(_0x5495bb){while(--_0x5495bb){_0x561038['push'](_0x561038['shift']());}};_0x45722c(++_0x498d51);}(_0xd1ca,0x15e));var _0xad1c=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xd1ca[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var path=require('path');var timeout=require(_0xad1c('0x2'));var express=require(_0xad1c('0x3'));var router=express[_0xad1c('0x4')]();var fs_extra=require(_0xad1c('0x5'));var auth=require(_0xad1c('0x6'));var interaction=require(_0xad1c('0x7'));var config=require('../../config/environment');var controller=require(_0xad1c('0x8'));router[_0xad1c('0x9')]('/',auth[_0xad1c('0xa')](),controller['index']);router[_0xad1c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xad1c('0xb')]);router['post']('/',auth[_0xad1c('0xa')](),controller[_0xad1c('0xc')]);router[_0xad1c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xad1c('0xe')]);router[_0xad1c('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xad1c('0x10')]=router; \ No newline at end of file +var _0x6c20=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0x6c20,0x70));var _0x06c2=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0x6c20[_0x9a138c];return _0x3771a3;};'use strict';var multer=require(_0x06c2('0x0'));var util=require(_0x06c2('0x1'));var path=require('path');var timeout=require(_0x06c2('0x2'));var express=require(_0x06c2('0x3'));var router=express[_0x06c2('0x4')]();var fs_extra=require(_0x06c2('0x5'));var auth=require(_0x06c2('0x6'));var interaction=require(_0x06c2('0x7'));var config=require(_0x06c2('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x06c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x06c2('0xa')]);router['get'](_0x06c2('0xb'),auth[_0x06c2('0xc')](),controller[_0x06c2('0xd')]);router[_0x06c2('0xe')]('/',auth[_0x06c2('0xc')](),controller[_0x06c2('0xf')]);router['put']('/:id',auth[_0x06c2('0xc')](),controller[_0x06c2('0x10')]);router[_0x06c2('0x11')](_0x06c2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x06c2('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 fd2e451..4af1fdf 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 _0xb25f=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x25ec64,_0x5b9c66){var _0x23cfcb=function(_0x5e0c27){while(--_0x5e0c27){_0x25ec64['push'](_0x25ec64['shift']());}};_0x23cfcb(++_0x5b9c66);}(_0xb25f,0xa2));var _0xfb25=function(_0x2ca84c,_0x2e040b){_0x2ca84c=_0x2ca84c-0x0;var _0x2f4fb9=_0xb25f[_0x2ca84c];return _0x2f4fb9;};'use strict';var Sequelize=require(_0xfb25('0x0'));module[_0xfb25('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfb25('0x2'),_0xfb25('0x3'),_0xfb25('0x4'),_0xfb25('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xfb25('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfb25('0x6')]},'idField':{'type':Sequelize[_0xfb25('0x6')]},'nameField':{'type':Sequelize[_0xfb25('0x6')]},'customField':{'type':Sequelize[_0xfb25('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb25('0x6')]}}; \ No newline at end of file +var _0x899e=['BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable'];(function(_0x25dcb2,_0x4afce2){var _0xb34223=function(_0x532da7){while(--_0x532da7){_0x25dcb2['push'](_0x25dcb2['shift']());}};_0xb34223(++_0x4afce2);}(_0x899e,0x1eb));var _0xe899=function(_0x8267aa,_0x496ef0){_0x8267aa=_0x8267aa-0x0;var _0x2a437f=_0x899e[_0x8267aa];return _0x2a437f;};'use strict';var Sequelize=require(_0xe899('0x0'));module[_0xe899('0x1')]={'type':{'type':Sequelize[_0xe899('0x2')](_0xe899('0x3'),'variable','customVariable',_0xe899('0x4'),_0xe899('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe899('0x6')]},'key':{'type':Sequelize[_0xe899('0x6')]},'keyType':{'type':Sequelize[_0xe899('0x2')](_0xe899('0x3'),_0xe899('0x7'),_0xe899('0x8'))},'keyContent':{'type':Sequelize[_0xe899('0x6')]},'idField':{'type':Sequelize[_0xe899('0x6')]},'nameField':{'type':Sequelize[_0xe899('0x6')]},'customField':{'type':Sequelize[_0xe899('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe899('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index acde352..8f8a80a 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 _0x970e=['merge','where','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x4aa116,_0x46c909){var _0x234a58=function(_0x59a6e3){while(--_0x59a6e3){_0x4aa116['push'](_0x4aa116['shift']());}};_0x234a58(++_0x46c909);}(_0x970e,0x125));var _0xe970=function(_0x4130ca,_0x276232){_0x4130ca=_0x4130ca-0x0;var _0x56d28d=_0x970e[_0x4130ca];return _0x56d28d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe970('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe970('0x1'));var moment=require(_0xe970('0x2'));var BPromise=require(_0xe970('0x3'));var Mustache=require(_0xe970('0x4'));var util=require(_0xe970('0x5'));var path=require(_0xe970('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe970('0x7'));var _=require('lodash');var squel=require(_0xe970('0x8'));var crypto=require(_0xe970('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe970('0xa'));var toCsv=require(_0xe970('0xb'));var querystring=require(_0xe970('0xc'));var Papa=require(_0xe970('0xd'));var Redis=require(_0xe970('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe970('0xf'));var as=require(_0xe970('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe970('0x11'))('api');var utils=require(_0xe970('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe970('0x13'))['db'];function respondWithStatusCode(_0x3c2468,_0x2c3908){_0x2c3908=_0x2c3908||0xcc;return function(_0x2ea766){if(_0x2ea766){return _0x3c2468['sendStatus'](_0x2c3908);}return _0x3c2468[_0xe970('0x14')](_0x2c3908)[_0xe970('0x15')]();};}function respondWithResult(_0x1552af,_0x60e886){_0x60e886=_0x60e886||0xc8;return function(_0x5741ba){if(_0x5741ba){return _0x1552af[_0xe970('0x14')](_0x60e886)[_0xe970('0x16')](_0x5741ba);}};}function respondWithFilteredResult(_0x22bb18,_0x2ef823){return function(_0x2de5c3){if(_0x2de5c3){var _0x5714c3=typeof _0x2ef823[_0xe970('0x17')]===_0xe970('0x18')&&typeof _0x2ef823[_0xe970('0x19')]===_0xe970('0x18');var _0x13d76a=_0x2de5c3['count'];var _0x3721a8=_0x5714c3?0x0:_0x2ef823[_0xe970('0x17')];var _0x57351c=_0x5714c3?_0x2de5c3[_0xe970('0x1a')]:_0x2ef823[_0xe970('0x17')]+_0x2ef823[_0xe970('0x19')];var _0x1b83cb;if(_0x57351c>=_0x13d76a){_0x57351c=_0x13d76a;_0x1b83cb=0xc8;}else{_0x1b83cb=0xce;}_0x22bb18['status'](_0x1b83cb);return _0x22bb18[_0xe970('0x1b')](_0xe970('0x1c'),_0x3721a8+'-'+_0x57351c+'/'+_0x13d76a)[_0xe970('0x16')](_0x2de5c3);}return null;};}function patchUpdates(_0x23b387){return function(_0x21ce56){try{jsonpatch['apply'](_0x21ce56,_0x23b387,!![]);}catch(_0x3de2e0){return BPromise[_0xe970('0x1d')](_0x3de2e0);}return _0x21ce56[_0xe970('0x1e')]();};}function saveUpdates(_0x566662,_0xda113e){return function(_0x28baf0){if(_0x28baf0){return _0x28baf0[_0xe970('0x1f')](_0x566662)[_0xe970('0x20')](function(_0x48c1c9){return _0x48c1c9;});}return null;};}function removeEntity(_0x270309,_0x54994d){return function(_0x9466fd){if(_0x9466fd){return _0x9466fd[_0xe970('0x21')]()[_0xe970('0x20')](function(){_0x270309[_0xe970('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4515aa,_0x11f3ea){return function(_0x17023f){if(!_0x17023f){_0x4515aa['sendStatus'](0x194);}return _0x17023f;};}function handleError(_0x244c65,_0x5f3d49){_0x5f3d49=_0x5f3d49||0x1f4;return function(_0xf09dfb){logger[_0xe970('0x22')](_0xf09dfb[_0xe970('0x23')]);if(_0xf09dfb[_0xe970('0x24')]){delete _0xf09dfb['name'];}_0x244c65['status'](_0x5f3d49)[_0xe970('0x25')](_0xf09dfb);};}exports[_0xe970('0x26')]=function(_0x5ecb6a,_0x4cd287){var _0x5e4377={},_0xe94b7a={},_0x4d2aec={'count':0x0,'rows':[]};var _0x344d12=_[_0xe970('0x27')](db[_0xe970('0x28')][_0xe970('0x29')],function(_0x41bb34){return{'name':_0x41bb34['fieldName'],'type':_0x41bb34[_0xe970('0x2a')][_0xe970('0x2b')]};});_0xe94b7a[_0xe970('0x2c')]=_[_0xe970('0x27')](_0x344d12,_0xe970('0x24'));_0xe94b7a['query']=_[_0xe970('0x2d')](_0x5ecb6a[_0xe970('0x2e')]);_0xe94b7a[_0xe970('0x2f')]=_[_0xe970('0x30')](_0xe94b7a[_0xe970('0x2c')],_0xe94b7a[_0xe970('0x2e')]);_0x5e4377[_0xe970('0x31')]=_[_0xe970('0x30')](_0xe94b7a['model'],qs['fields'](_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x32')]));_0x5e4377[_0xe970('0x31')]=_0x5e4377[_0xe970('0x31')][_0xe970('0x33')]?_0x5e4377[_0xe970('0x31')]:_0xe94b7a[_0xe970('0x2c')];if(!_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x34')]('nolimit')){_0x5e4377[_0xe970('0x19')]=qs[_0xe970('0x19')](_0x5ecb6a['query']['limit']);_0x5e4377['offset']=qs[_0xe970('0x17')](_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x17')]);}_0x5e4377[_0xe970('0x35')]=qs['sort'](_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x36')]);_0x5e4377['where']=qs['filters'](_[_0xe970('0x37')](_0x5ecb6a['query'],_0xe94b7a[_0xe970('0x2f')]),_0x344d12);if(_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x38')]){_0x5e4377['where']=_[_0xe970('0x39')](_0x5e4377[_0xe970('0x3a')],{'$or':_[_0xe970('0x27')](_0x344d12,function(_0xb2ef2e){if(_0xb2ef2e['type']!==_0xe970('0x3b')){var _0x3d7cc8={};_0x3d7cc8[_0xb2ef2e[_0xe970('0x24')]]={'$like':'%'+_0x5ecb6a[_0xe970('0x2e')][_0xe970('0x38')]+'%'};return _0x3d7cc8;}})});}_0x5e4377=_[_0xe970('0x39')]({},_0x5e4377,_0x5ecb6a[_0xe970('0x3c')]);var _0x1d71d9={'where':_0x5e4377[_0xe970('0x3a')]};return db[_0xe970('0x28')][_0xe970('0x1a')](_0x1d71d9)[_0xe970('0x20')](function(_0x5a9e44){_0x4d2aec[_0xe970('0x1a')]=_0x5a9e44;if(_0x5ecb6a[_0xe970('0x2e')]['includeAll']){_0x5e4377[_0xe970('0x3d')]=[{'all':!![]}];}return db[_0xe970('0x28')][_0xe970('0x3e')](_0x5e4377);})['then'](function(_0x2b7bfb){_0x4d2aec[_0xe970('0x3f')]=_0x2b7bfb;return _0x4d2aec;})[_0xe970('0x20')](respondWithFilteredResult(_0x4cd287,_0x5e4377))['catch'](handleError(_0x4cd287,null));};exports['show']=function(_0x293c3a,_0x46fe7f){var _0x126732={'raw':!![],'where':{'id':_0x293c3a[_0xe970('0x40')]['id']}},_0x20f3db={};_0x20f3db[_0xe970('0x2c')]=_[_0xe970('0x2d')](db[_0xe970('0x28')][_0xe970('0x29')]);_0x20f3db[_0xe970('0x2e')]=_['keys'](_0x293c3a[_0xe970('0x2e')]);_0x20f3db[_0xe970('0x2f')]=_[_0xe970('0x30')](_0x20f3db[_0xe970('0x2c')],_0x20f3db[_0xe970('0x2e')]);_0x126732[_0xe970('0x31')]=_[_0xe970('0x30')](_0x20f3db['model'],qs['fields'](_0x293c3a[_0xe970('0x2e')]['fields']));_0x126732[_0xe970('0x31')]=_0x126732[_0xe970('0x31')][_0xe970('0x33')]?_0x126732[_0xe970('0x31')]:_0x20f3db['model'];if(_0x293c3a[_0xe970('0x2e')][_0xe970('0x41')]){_0x126732[_0xe970('0x3d')]=[{'all':!![]}];}_0x126732=_[_0xe970('0x39')]({},_0x126732,_0x293c3a[_0xe970('0x3c')]);return db[_0xe970('0x28')][_0xe970('0x42')](_0x126732)['then'](handleEntityNotFound(_0x46fe7f,null))['then'](respondWithResult(_0x46fe7f,null))[_0xe970('0x43')](handleError(_0x46fe7f,null));};exports[_0xe970('0x44')]=function(_0xe10f3c,_0x197725){return db['SugarcrmField'][_0xe970('0x44')](_0xe10f3c[_0xe970('0x45')],{})['then'](respondWithResult(_0x197725,0xc9))[_0xe970('0x43')](handleError(_0x197725,null));};exports['update']=function(_0x24acf6,_0x3b8b35){if(_0x24acf6[_0xe970('0x45')]['id']){delete _0x24acf6[_0xe970('0x45')]['id'];}return db[_0xe970('0x28')][_0xe970('0x42')]({'where':{'id':_0x24acf6[_0xe970('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b8b35,null))[_0xe970('0x20')](saveUpdates(_0x24acf6[_0xe970('0x45')],null))[_0xe970('0x20')](respondWithResult(_0x3b8b35,null))[_0xe970('0x43')](handleError(_0x3b8b35,null));};exports[_0xe970('0x21')]=function(_0x1ff3ef,_0x3c79b9){return db[_0xe970('0x28')][_0xe970('0x42')]({'where':{'id':_0x1ff3ef[_0xe970('0x40')]['id']}})[_0xe970('0x20')](handleEntityNotFound(_0x3c79b9,null))[_0xe970('0x20')](removeEntity(_0x3c79b9,null))[_0xe970('0x43')](handleError(_0x3c79b9,null));}; \ No newline at end of file +var _0xc349=['update','destroy','then','sendStatus','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','map','query','model','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xc349,0x1e5));var _0x9c34=function(_0x11799a,_0x495cb5){_0x11799a=_0x11799a-0x0;var _0x1335bd=_0xc349[_0x11799a];return _0x1335bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c34('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c34('0x1'));var rp=require(_0x9c34('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c34('0x3'));var util=require(_0x9c34('0x4'));var path=require(_0x9c34('0x5'));var sox=require(_0x9c34('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c34('0x7'));var _=require(_0x9c34('0x8'));var squel=require(_0x9c34('0x9'));var crypto=require(_0x9c34('0xa'));var jsforce=require(_0x9c34('0xb'));var deskjs=require(_0x9c34('0xc'));var toCsv=require(_0x9c34('0xd'));var querystring=require(_0x9c34('0xe'));var Papa=require('papaparse');var Redis=require(_0x9c34('0xf'));var authService=require(_0x9c34('0x10'));var qs=require(_0x9c34('0x11'));var as=require(_0x9c34('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c34('0x13'))(_0x9c34('0x14'));var utils=require(_0x9c34('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9c34('0x16'));var db=require(_0x9c34('0x17'))['db'];function respondWithStatusCode(_0x3ba73d,_0x225f10){_0x225f10=_0x225f10||0xcc;return function(_0x25b928){if(_0x25b928){return _0x3ba73d['sendStatus'](_0x225f10);}return _0x3ba73d[_0x9c34('0x18')](_0x225f10)[_0x9c34('0x19')]();};}function respondWithResult(_0x20207c,_0x37a64d){_0x37a64d=_0x37a64d||0xc8;return function(_0x3ac3ef){if(_0x3ac3ef){return _0x20207c[_0x9c34('0x18')](_0x37a64d)[_0x9c34('0x1a')](_0x3ac3ef);}};}function respondWithFilteredResult(_0x16371f,_0x34617b){return function(_0x117b74){if(_0x117b74){var _0x57bd10=typeof _0x34617b[_0x9c34('0x1b')]==='undefined'&&typeof _0x34617b['limit']===_0x9c34('0x1c');var _0x365f58=_0x117b74[_0x9c34('0x1d')];var _0x1ba4bd=_0x57bd10?0x0:_0x34617b['offset'];var _0x276939=_0x57bd10?_0x117b74[_0x9c34('0x1d')]:_0x34617b['offset']+_0x34617b['limit'];var _0x3888f1;if(_0x276939>=_0x365f58){_0x276939=_0x365f58;_0x3888f1=0xc8;}else{_0x3888f1=0xce;}_0x16371f[_0x9c34('0x18')](_0x3888f1);return _0x16371f['set'](_0x9c34('0x1e'),_0x1ba4bd+'-'+_0x276939+'/'+_0x365f58)[_0x9c34('0x1a')](_0x117b74);}return null;};}function patchUpdates(_0x312ba6){return function(_0x10cc68){try{jsonpatch[_0x9c34('0x1f')](_0x10cc68,_0x312ba6,!![]);}catch(_0x2f751c){return BPromise[_0x9c34('0x20')](_0x2f751c);}return _0x10cc68['save']();};}function saveUpdates(_0x41c4d9,_0x229304){return function(_0x1bbb05){if(_0x1bbb05){return _0x1bbb05[_0x9c34('0x21')](_0x41c4d9)['then'](function(_0x16b346){return _0x16b346;});}return null;};}function removeEntity(_0x34dba2,_0x50ab7d){return function(_0x201449){if(_0x201449){return _0x201449[_0x9c34('0x22')]()[_0x9c34('0x23')](function(){_0x34dba2[_0x9c34('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bccda,_0x952fc6){return function(_0x237e83){if(!_0x237e83){_0x3bccda[_0x9c34('0x24')](0x194);}return _0x237e83;};}function handleError(_0x15679b,_0x5c23a9){_0x5c23a9=_0x5c23a9||0x1f4;return function(_0x14019c){logger[_0x9c34('0x25')](_0x14019c[_0x9c34('0x26')]);if(_0x14019c[_0x9c34('0x27')]){delete _0x14019c[_0x9c34('0x27')];}_0x15679b[_0x9c34('0x18')](_0x5c23a9)[_0x9c34('0x28')](_0x14019c);};}exports[_0x9c34('0x29')]=function(_0x519ebb,_0x4c3a28){var _0x6e879d={},_0x4f5ce4={},_0x42147f={'count':0x0,'rows':[]};var _0x5a09a6=_['map'](db[_0x9c34('0x2a')][_0x9c34('0x2b')],function(_0x5aeb30){return{'name':_0x5aeb30[_0x9c34('0x2c')],'type':_0x5aeb30[_0x9c34('0x2d')]['key']};});_0x4f5ce4['model']=_[_0x9c34('0x2e')](_0x5a09a6,_0x9c34('0x27'));_0x4f5ce4[_0x9c34('0x2f')]=_['keys'](_0x519ebb['query']);_0x4f5ce4['filters']=_['intersection'](_0x4f5ce4[_0x9c34('0x30')],_0x4f5ce4[_0x9c34('0x2f')]);_0x6e879d[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x4f5ce4[_0x9c34('0x30')],qs[_0x9c34('0x33')](_0x519ebb[_0x9c34('0x2f')][_0x9c34('0x33')]));_0x6e879d[_0x9c34('0x31')]=_0x6e879d[_0x9c34('0x31')][_0x9c34('0x34')]?_0x6e879d[_0x9c34('0x31')]:_0x4f5ce4[_0x9c34('0x30')];if(!_0x519ebb[_0x9c34('0x2f')]['hasOwnProperty'](_0x9c34('0x35'))){_0x6e879d['limit']=qs['limit'](_0x519ebb['query'][_0x9c34('0x36')]);_0x6e879d[_0x9c34('0x1b')]=qs[_0x9c34('0x1b')](_0x519ebb[_0x9c34('0x2f')]['offset']);}_0x6e879d[_0x9c34('0x37')]=qs[_0x9c34('0x38')](_0x519ebb[_0x9c34('0x2f')][_0x9c34('0x38')]);_0x6e879d[_0x9c34('0x39')]=qs['filters'](_[_0x9c34('0x3a')](_0x519ebb[_0x9c34('0x2f')],_0x4f5ce4[_0x9c34('0x3b')]),_0x5a09a6);if(_0x519ebb[_0x9c34('0x2f')][_0x9c34('0x3c')]){_0x6e879d[_0x9c34('0x39')]=_['merge'](_0x6e879d[_0x9c34('0x39')],{'$or':_[_0x9c34('0x2e')](_0x5a09a6,function(_0x52fdeb){if(_0x52fdeb[_0x9c34('0x2d')]!==_0x9c34('0x3d')){var _0x20aea0={};_0x20aea0[_0x52fdeb[_0x9c34('0x27')]]={'$like':'%'+_0x519ebb[_0x9c34('0x2f')]['filter']+'%'};return _0x20aea0;}})});}_0x6e879d=_[_0x9c34('0x3e')]({},_0x6e879d,_0x519ebb['options']);var _0x506cef={'where':_0x6e879d[_0x9c34('0x39')]};return db[_0x9c34('0x2a')][_0x9c34('0x1d')](_0x506cef)[_0x9c34('0x23')](function(_0x460e07){_0x42147f[_0x9c34('0x1d')]=_0x460e07;if(_0x519ebb[_0x9c34('0x2f')][_0x9c34('0x3f')]){_0x6e879d['include']=[{'all':!![]}];}return db[_0x9c34('0x2a')][_0x9c34('0x40')](_0x6e879d);})[_0x9c34('0x23')](function(_0x649c0e){_0x42147f['rows']=_0x649c0e;return _0x42147f;})[_0x9c34('0x23')](respondWithFilteredResult(_0x4c3a28,_0x6e879d))[_0x9c34('0x41')](handleError(_0x4c3a28,null));};exports[_0x9c34('0x42')]=function(_0x327d3a,_0xce595c){var _0x56162e={'raw':!![],'where':{'id':_0x327d3a[_0x9c34('0x43')]['id']}},_0x37eb5a={};_0x37eb5a[_0x9c34('0x30')]=_[_0x9c34('0x44')](db[_0x9c34('0x2a')][_0x9c34('0x2b')]);_0x37eb5a[_0x9c34('0x2f')]=_['keys'](_0x327d3a[_0x9c34('0x2f')]);_0x37eb5a[_0x9c34('0x3b')]=_[_0x9c34('0x32')](_0x37eb5a[_0x9c34('0x30')],_0x37eb5a[_0x9c34('0x2f')]);_0x56162e[_0x9c34('0x31')]=_[_0x9c34('0x32')](_0x37eb5a[_0x9c34('0x30')],qs[_0x9c34('0x33')](_0x327d3a['query'][_0x9c34('0x33')]));_0x56162e[_0x9c34('0x31')]=_0x56162e[_0x9c34('0x31')][_0x9c34('0x34')]?_0x56162e['attributes']:_0x37eb5a['model'];if(_0x327d3a[_0x9c34('0x2f')][_0x9c34('0x3f')]){_0x56162e[_0x9c34('0x45')]=[{'all':!![]}];}_0x56162e=_[_0x9c34('0x3e')]({},_0x56162e,_0x327d3a[_0x9c34('0x46')]);return db[_0x9c34('0x2a')][_0x9c34('0x47')](_0x56162e)[_0x9c34('0x23')](handleEntityNotFound(_0xce595c,null))[_0x9c34('0x23')](respondWithResult(_0xce595c,null))[_0x9c34('0x41')](handleError(_0xce595c,null));};exports[_0x9c34('0x48')]=function(_0xc39333,_0x51bd2e){return db['SugarcrmField'][_0x9c34('0x48')](_0xc39333[_0x9c34('0x49')],{})[_0x9c34('0x23')](respondWithResult(_0x51bd2e,0xc9))[_0x9c34('0x41')](handleError(_0x51bd2e,null));};exports[_0x9c34('0x21')]=function(_0x3806a3,_0x39f156){if(_0x3806a3[_0x9c34('0x49')]['id']){delete _0x3806a3[_0x9c34('0x49')]['id'];}return db[_0x9c34('0x2a')][_0x9c34('0x47')]({'where':{'id':_0x3806a3[_0x9c34('0x43')]['id']}})[_0x9c34('0x23')](handleEntityNotFound(_0x39f156,null))[_0x9c34('0x23')](saveUpdates(_0x3806a3['body'],null))[_0x9c34('0x23')](respondWithResult(_0x39f156,null))[_0x9c34('0x41')](handleError(_0x39f156,null));};exports['destroy']=function(_0x268e65,_0xd9b146){return db['SugarcrmField'][_0x9c34('0x47')]({'where':{'id':_0x268e65[_0x9c34('0x43')]['id']}})[_0x9c34('0x23')](handleEntityNotFound(_0xd9b146,null))[_0x9c34('0x23')](removeEntity(_0xd9b146,null))[_0x9c34('0x41')](handleError(_0xd9b146,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 70a0098..f15eee5 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 _0xffde=['moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','idField','FieldId','lodash','util','../../config/logger'];(function(_0x13e4be,_0x4732d0){var _0x422d6d=function(_0x4f6596){while(--_0x4f6596){_0x13e4be['push'](_0x13e4be['shift']());}};_0x422d6d(++_0x4732d0);}(_0xffde,0x1b5));var _0xeffd=function(_0x24037c,_0x50607d){_0x24037c=_0x24037c-0x0;var _0x42e1b6=_0xffde[_0x24037c];return _0x42e1b6;};'use strict';var _=require(_0xeffd('0x0'));var util=require(_0xeffd('0x1'));var logger=require(_0xeffd('0x2'))('api');var moment=require(_0xeffd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeffd('0x4'));var rimraf=require(_0xeffd('0x5'));var config=require(_0xeffd('0x6'));var attributes=require(_0xeffd('0x7'));module[_0xeffd('0x8')]=function(_0x29cbad,_0x463fd5){return _0x29cbad['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xeffd('0x9'),_0xeffd('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabf9=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x4726ba,_0x504817){var _0x395cc4=function(_0x4e06ee){while(--_0x4e06ee){_0x4726ba['push'](_0x4726ba['shift']());}};_0x395cc4(++_0x504817);}(_0xabf9,0x17b));var _0x9abf=function(_0x1fd6e8,_0x2c8f73){_0x1fd6e8=_0x1fd6e8-0x0;var _0x2b1954=_0xabf9[_0x1fd6e8];return _0x2b1954;};'use strict';var _=require(_0x9abf('0x0'));var util=require(_0x9abf('0x1'));var logger=require(_0x9abf('0x2'))(_0x9abf('0x3'));var moment=require(_0x9abf('0x4'));var BPromise=require(_0x9abf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9abf('0x6'));var rimraf=require('rimraf');var config=require(_0x9abf('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x58e728,_0x6eea5b){return _0x58e728[_0x9abf('0x8')]('SugarcrmField',attributes,{'tableName':_0x9abf('0x9'),'paranoid':![],'indexes':[{'name':_0x9abf('0xa'),'fields':[_0x9abf('0xb'),_0x9abf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c947d7f..4cd8699 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 _0x3a95=['request','request\x20sent','stringify','code','error','message','SugarcrmField,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','http'];(function(_0x2c0d7d,_0x42a4de){var _0x1be624=function(_0x54a9f9){while(--_0x54a9f9){_0x2c0d7d['push'](_0x2c0d7d['shift']());}};_0x1be624(++_0x42a4de);}(_0x3a95,0x1a7));var _0x53a9=function(_0x40d5cd,_0x1f2eca){_0x40d5cd=_0x40d5cd-0x0;var _0x1509ee=_0x3a95[_0x40d5cd];return _0x1509ee;};'use strict';var _=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var moment=require(_0x53a9('0x2'));var BPromise=require(_0x53a9('0x3'));var rs=require(_0x53a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x53a9('0x7'));var client=jayson['client'][_0x53a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ae39,_0x100048,_0x2e1244){return new BPromise(function(_0x2b3956,_0x254d04){return client[_0x53a9('0x9')](_0x25ae39,_0x2e1244)['then'](function(_0x26a7cb){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x100048,_0x53a9('0xa'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x100048,'request\x20sent',JSON[_0x53a9('0xb')](_0x26a7cb));if(_0x26a7cb['error']){if(_0x26a7cb['error'][_0x53a9('0xc')]===0x1f4){logger[_0x53a9('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x100048,_0x26a7cb['error'][_0x53a9('0xe')]);return _0x254d04(_0x26a7cb[_0x53a9('0xd')][_0x53a9('0xe')]);}logger[_0x53a9('0xd')](_0x53a9('0xf'),_0x100048,_0x26a7cb[_0x53a9('0xd')][_0x53a9('0xe')]);return _0x2b3956(_0x26a7cb[_0x53a9('0xd')][_0x53a9('0xe')]);}else{logger[_0x53a9('0x10')](_0x53a9('0xf'),_0x100048,_0x53a9('0xa'));_0x2b3956(_0x26a7cb[_0x53a9('0x11')][_0x53a9('0xe')]);}})['catch'](function(_0x432996){logger[_0x53a9('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x100048,_0x432996);_0x254d04(_0x432996);});});} \ No newline at end of file +var _0x77db=['code','SugarcrmField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cae30,_0x5d8b99){var _0x263f77=function(_0x308222){while(--_0x308222){_0x3cae30['push'](_0x3cae30['shift']());}};_0x263f77(++_0x5d8b99);}(_0x77db,0x15d));var _0xb77d=function(_0xa656ef,_0x3d31df){_0xa656ef=_0xa656ef-0x0;var _0x20e81=_0x77db[_0xa656ef];return _0x20e81;};'use strict';var _=require('lodash');var util=require(_0xb77d('0x0'));var moment=require(_0xb77d('0x1'));var BPromise=require(_0xb77d('0x2'));var rs=require(_0xb77d('0x3'));var fs=require('fs');var Redis=require(_0xb77d('0x4'));var db=require(_0xb77d('0x5'))['db'];var utils=require(_0xb77d('0x6'));var logger=require(_0xb77d('0x7'))(_0xb77d('0x8'));var config=require(_0xb77d('0x9'));var jayson=require(_0xb77d('0xa'));var client=jayson['client'][_0xb77d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199f6d,_0x4aa1f1,_0x602773){return new BPromise(function(_0x1cdd9c,_0x326707){return client[_0xb77d('0xc')](_0x199f6d,_0x602773)[_0xb77d('0xd')](function(_0x27b8c4){logger[_0xb77d('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x4aa1f1,_0xb77d('0xf'));logger['debug'](_0xb77d('0x10'),_0x4aa1f1,_0xb77d('0xf'),JSON[_0xb77d('0x11')](_0x27b8c4));if(_0x27b8c4[_0xb77d('0x12')]){if(_0x27b8c4[_0xb77d('0x12')][_0xb77d('0x13')]===0x1f4){logger[_0xb77d('0x12')](_0xb77d('0x14'),_0x4aa1f1,_0x27b8c4[_0xb77d('0x12')][_0xb77d('0x15')]);return _0x326707(_0x27b8c4[_0xb77d('0x12')][_0xb77d('0x15')]);}logger['error'](_0xb77d('0x14'),_0x4aa1f1,_0x27b8c4[_0xb77d('0x12')][_0xb77d('0x15')]);return _0x1cdd9c(_0x27b8c4['error'][_0xb77d('0x15')]);}else{logger[_0xb77d('0xe')](_0xb77d('0x14'),_0x4aa1f1,_0xb77d('0xf'));_0x1cdd9c(_0x27b8c4['result'][_0xb77d('0x15')]);}})[_0xb77d('0x16')](function(_0x13a330){logger[_0xb77d('0x12')](_0xb77d('0x14'),_0x4aa1f1,_0x13a330);_0x326707(_0x13a330);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6585cec..5b33dc6 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 _0xf3d0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0xf3d0,0x1bf));var _0x0f3d=function(_0x59ce90,_0x5f1c20){_0x59ce90=_0x59ce90-0x0;var _0x1ecfae=_0xf3d0[_0x59ce90];return _0x1ecfae;};'use strict';var multer=require(_0x0f3d('0x0'));var util=require('util');var path=require(_0x0f3d('0x1'));var timeout=require(_0x0f3d('0x2'));var express=require(_0x0f3d('0x3'));var router=express[_0x0f3d('0x4')]();var fs_extra=require(_0x0f3d('0x5'));var auth=require(_0x0f3d('0x6'));var interaction=require(_0x0f3d('0x7'));var config=require(_0x0f3d('0x8'));var controller=require(_0x0f3d('0x9'));router[_0x0f3d('0xa')]('/',auth[_0x0f3d('0xb')](),controller[_0x0f3d('0xc')]);router['get'](_0x0f3d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0f3d('0xa')](_0x0f3d('0xe'),auth['isAuthenticated'](),controller[_0x0f3d('0xf')]);router[_0x0f3d('0xa')](_0x0f3d('0x10'),auth[_0x0f3d('0xb')](),controller[_0x0f3d('0x11')]);router[_0x0f3d('0x12')]('/',auth['isAuthenticated'](),controller[_0x0f3d('0x13')]);router[_0x0f3d('0x12')](_0x0f3d('0xe'),auth['isAuthenticated'](),controller[_0x0f3d('0x14')]);router[_0x0f3d('0x15')](_0x0f3d('0xd'),auth[_0x0f3d('0xb')](),controller[_0x0f3d('0x16')]);router['delete'](_0x0f3d('0xd'),auth[_0x0f3d('0xb')](),controller[_0x0f3d('0x17')]);module[_0x0f3d('0x18')]=router; \ No newline at end of file +var _0x6873=['/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6873,0xac));var _0x3687=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x6873[_0x3815c2];return _0x271f88;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3687('0x0'));var timeout=require(_0x3687('0x1'));var express=require(_0x3687('0x2'));var router=express[_0x3687('0x3')]();var fs_extra=require(_0x3687('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3687('0x5'));var config=require('../../config/environment');var controller=require(_0x3687('0x6'));router[_0x3687('0x7')]('/',auth['isAuthenticated'](),controller[_0x3687('0x8')]);router[_0x3687('0x7')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0xb')]);router[_0x3687('0x7')](_0x3687('0xc'),auth[_0x3687('0xa')](),controller[_0x3687('0xd')]);router['get'](_0x3687('0xe'),auth[_0x3687('0xa')](),controller['getFields']);router[_0x3687('0xf')]('/',auth[_0x3687('0xa')](),controller[_0x3687('0x10')]);router[_0x3687('0xf')](_0x3687('0xc'),auth['isAuthenticated'](),controller[_0x3687('0x11')]);router[_0x3687('0x12')]('/:id',auth[_0x3687('0xa')](),controller[_0x3687('0x13')]);router[_0x3687('0x14')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0x15')]);module[_0x3687('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 320b3ca..026a70b 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 _0x75a1=['STRING','sequelize','exports'];(function(_0x285bbf,_0x8cd8c2){var _0x25df31=function(_0x2c072f){while(--_0x2c072f){_0x285bbf['push'](_0x285bbf['shift']());}};_0x25df31(++_0x8cd8c2);}(_0x75a1,0x94));var _0x175a=function(_0x4e840a,_0x43e5fc){_0x4e840a=_0x4e840a-0x0;var _0x17cbe2=_0x75a1[_0x4e840a];return _0x17cbe2;};'use strict';var Sequelize=require(_0x175a('0x0'));module[_0x175a('0x1')]={'name':{'type':Sequelize[_0x175a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x175a('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x175a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x175a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x908a=['HelpDesk','sequelize','STRING'];(function(_0x111311,_0x1e2f69){var _0x4cef39=function(_0x382ab2){while(--_0x382ab2){_0x111311['push'](_0x111311['shift']());}};_0x4cef39(++_0x1e2f69);}(_0x908a,0xd6));var _0xa908=function(_0x215b9f,_0x484ce3){_0x215b9f=_0x215b9f-0x0;var _0x4ad616=_0x908a[_0x215b9f];return _0x4ad616;};'use strict';var Sequelize=require(_0xa908('0x0'));module['exports']={'name':{'type':Sequelize[_0xa908('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa908('0x1')]},'username':{'type':Sequelize[_0xa908('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa908('0x1')],'allowNull':![],'defaultValue':_0xa908('0x2')},'remoteUri':{'type':Sequelize[_0xa908('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa908('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa908('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index fc6e6b0..e0fd933 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 _0x799d=['pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','fields','options','find','create','body','destroy','params','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','remoteUri','serverUrl','moduleName','slice','format','%s/webservice.php','GET','success','POST','login','result','token','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','index','map','VtigerAccount','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x799d,0x13d));var _0xd799=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x799d[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xd799('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd799('0x1'));var jsonpatch=require(_0xd799('0x2'));var rp=require('request-promise');var moment=require(_0xd799('0x3'));var BPromise=require(_0xd799('0x4'));var Mustache=require(_0xd799('0x5'));var util=require(_0xd799('0x6'));var path=require(_0xd799('0x7'));var sox=require(_0xd799('0x8'));var csv=require(_0xd799('0x9'));var ejs=require(_0xd799('0xa'));var fs=require('fs');var fs_extra=require(_0xd799('0xb'));var _=require('lodash');var squel=require(_0xd799('0xc'));var crypto=require(_0xd799('0xd'));var jsforce=require(_0xd799('0xe'));var deskjs=require(_0xd799('0xf'));var toCsv=require(_0xd799('0x9'));var querystring=require(_0xd799('0x10'));var Papa=require('papaparse');var Redis=require(_0xd799('0x11'));var authService=require(_0xd799('0x12'));var qs=require(_0xd799('0x13'));var as=require(_0xd799('0x14'));var hardwareService=require(_0xd799('0x15'));var logger=require(_0xd799('0x16'))(_0xd799('0x17'));var utils=require(_0xd799('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd799('0x19'));var db=require(_0xd799('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43dc2f,_0x270b8f){_0x270b8f=_0x270b8f||0xcc;return function(_0x1c3c47){if(_0x1c3c47){return _0x43dc2f[_0xd799('0x1b')](_0x270b8f);}return _0x43dc2f[_0xd799('0x1c')](_0x270b8f)['end']();};}function respondWithResult(_0x20461f,_0x16e244){_0x16e244=_0x16e244||0xc8;return function(_0x52199b){if(_0x52199b){return _0x20461f[_0xd799('0x1c')](_0x16e244)[_0xd799('0x1d')](_0x52199b);}};}function respondWithFilteredResult(_0x5e170e,_0x3adc69){return function(_0x499141){if(_0x499141){var _0x2eaf33=typeof _0x3adc69['offset']===_0xd799('0x1e')&&typeof _0x3adc69[_0xd799('0x1f')]===_0xd799('0x1e');var _0x257750=_0x499141[_0xd799('0x20')];var _0x4fcf75=_0x2eaf33?0x0:_0x3adc69[_0xd799('0x21')];var _0x3ab9be=_0x2eaf33?_0x499141[_0xd799('0x20')]:_0x3adc69['offset']+_0x3adc69['limit'];var _0x50e25c;if(_0x3ab9be>=_0x257750){_0x3ab9be=_0x257750;_0x50e25c=0xc8;}else{_0x50e25c=0xce;}_0x5e170e['status'](_0x50e25c);return _0x5e170e[_0xd799('0x22')](_0xd799('0x23'),_0x4fcf75+'-'+_0x3ab9be+'/'+_0x257750)[_0xd799('0x1d')](_0x499141);}return null;};}function patchUpdates(_0x450e8f){return function(_0x2803ed){try{jsonpatch[_0xd799('0x24')](_0x2803ed,_0x450e8f,!![]);}catch(_0x20323d){return BPromise[_0xd799('0x25')](_0x20323d);}return _0x2803ed['save']();};}function saveUpdates(_0x3a9bae,_0x2688f0){return function(_0x23d399){if(_0x23d399){return _0x23d399[_0xd799('0x26')](_0x3a9bae)[_0xd799('0x27')](function(_0x301b49){return _0x301b49;});}return null;};}function removeEntity(_0x2e1e76,_0x4b5c91){return function(_0x2545a3){if(_0x2545a3){return _0x2545a3['destroy']()[_0xd799('0x27')](function(){_0x2e1e76[_0xd799('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c6d6,_0x5e9241){return function(_0x100a00){if(!_0x100a00){_0x53c6d6[_0xd799('0x1b')](0x194);}return _0x100a00;};}function handleError(_0x2ea590,_0x3bfa3c){_0x3bfa3c=_0x3bfa3c||0x1f4;return function(_0x33b4cb){logger[_0xd799('0x28')](_0x33b4cb['stack']);if(_0x33b4cb['name']){delete _0x33b4cb[_0xd799('0x29')];}_0x2ea590['status'](_0x3bfa3c)['send'](_0x33b4cb);};}exports[_0xd799('0x2a')]=function(_0x300214,_0x1f6399){var _0x1f63aa={},_0x2ef803={},_0x19f714={'count':0x0,'rows':[]};var _0x512a1c=_[_0xd799('0x2b')](db[_0xd799('0x2c')][_0xd799('0x2d')],function(_0x382f40){return{'name':_0x382f40['fieldName'],'type':_0x382f40[_0xd799('0x2e')][_0xd799('0x2f')]};});_0x2ef803[_0xd799('0x30')]=_[_0xd799('0x2b')](_0x512a1c,'name');_0x2ef803[_0xd799('0x31')]=_['keys'](_0x300214[_0xd799('0x31')]);_0x2ef803['filters']=_[_0xd799('0x32')](_0x2ef803[_0xd799('0x30')],_0x2ef803[_0xd799('0x31')]);_0x1f63aa['attributes']=_[_0xd799('0x32')](_0x2ef803[_0xd799('0x30')],qs['fields'](_0x300214[_0xd799('0x31')]['fields']));_0x1f63aa[_0xd799('0x33')]=_0x1f63aa[_0xd799('0x33')][_0xd799('0x34')]?_0x1f63aa[_0xd799('0x33')]:_0x2ef803[_0xd799('0x30')];if(!_0x300214['query'][_0xd799('0x35')]('nolimit')){_0x1f63aa[_0xd799('0x1f')]=qs[_0xd799('0x1f')](_0x300214[_0xd799('0x31')][_0xd799('0x1f')]);_0x1f63aa[_0xd799('0x21')]=qs[_0xd799('0x21')](_0x300214[_0xd799('0x31')][_0xd799('0x21')]);}_0x1f63aa[_0xd799('0x36')]=qs['sort'](_0x300214[_0xd799('0x31')][_0xd799('0x37')]);_0x1f63aa[_0xd799('0x38')]=qs[_0xd799('0x39')](_[_0xd799('0x3a')](_0x300214['query'],_0x2ef803[_0xd799('0x39')]),_0x512a1c);if(_0x300214[_0xd799('0x31')][_0xd799('0x3b')]){_0x1f63aa['where']=_[_0xd799('0x3c')](_0x1f63aa[_0xd799('0x38')],{'$or':_[_0xd799('0x2b')](_0x512a1c,function(_0x11d9d7){if(_0x11d9d7[_0xd799('0x2e')]!==_0xd799('0x3d')){var _0x169537={};_0x169537[_0x11d9d7['name']]={'$like':'%'+_0x300214[_0xd799('0x31')][_0xd799('0x3b')]+'%'};return _0x169537;}})});}_0x1f63aa=_[_0xd799('0x3c')]({},_0x1f63aa,_0x300214['options']);var _0x52e1f7={'where':_0x1f63aa[_0xd799('0x38')]};return db[_0xd799('0x2c')][_0xd799('0x20')](_0x52e1f7)[_0xd799('0x27')](function(_0x13e81e){_0x19f714[_0xd799('0x20')]=_0x13e81e;if(_0x300214['query'][_0xd799('0x3e')]){_0x1f63aa[_0xd799('0x3f')]=[{'all':!![]}];}return db[_0xd799('0x2c')][_0xd799('0x40')](_0x1f63aa);})[_0xd799('0x27')](function(_0xa44741){_0x19f714[_0xd799('0x41')]=_0xa44741;return _0x19f714;})[_0xd799('0x27')](respondWithFilteredResult(_0x1f6399,_0x1f63aa))[_0xd799('0x42')](handleError(_0x1f6399,null));};exports[_0xd799('0x43')]=function(_0x334fa0,_0x1a13ed){var _0x3d204d={'raw':![],'where':{'id':_0x334fa0['params']['id']}},_0x2f18ca={};_0x2f18ca[_0xd799('0x30')]=_[_0xd799('0x44')](db[_0xd799('0x2c')][_0xd799('0x2d')]);_0x2f18ca[_0xd799('0x31')]=_[_0xd799('0x44')](_0x334fa0[_0xd799('0x31')]);_0x2f18ca[_0xd799('0x39')]=_[_0xd799('0x32')](_0x2f18ca[_0xd799('0x30')],_0x2f18ca['query']);_0x3d204d[_0xd799('0x33')]=_[_0xd799('0x32')](_0x2f18ca[_0xd799('0x30')],qs[_0xd799('0x45')](_0x334fa0[_0xd799('0x31')][_0xd799('0x45')]));_0x3d204d[_0xd799('0x33')]=_0x3d204d[_0xd799('0x33')][_0xd799('0x34')]?_0x3d204d[_0xd799('0x33')]:_0x2f18ca[_0xd799('0x30')];if(_0x334fa0['query'][_0xd799('0x3e')]){_0x3d204d['include']=[{'all':!![]}];}_0x3d204d=_[_0xd799('0x3c')]({},_0x3d204d,_0x334fa0[_0xd799('0x46')]);return db[_0xd799('0x2c')][_0xd799('0x47')](_0x3d204d)[_0xd799('0x27')](handleEntityNotFound(_0x1a13ed,null))[_0xd799('0x27')](respondWithResult(_0x1a13ed,null))[_0xd799('0x42')](handleError(_0x1a13ed,null));};exports[_0xd799('0x48')]=function(_0x25befb,_0x39fcac){return db[_0xd799('0x2c')][_0xd799('0x48')](_0x25befb[_0xd799('0x49')],{})[_0xd799('0x27')](respondWithResult(_0x39fcac,0xc9))[_0xd799('0x42')](handleError(_0x39fcac,null));};exports['update']=function(_0x5ad710,_0x413dcc){if(_0x5ad710[_0xd799('0x49')]['id']){delete _0x5ad710['body']['id'];}return db[_0xd799('0x2c')][_0xd799('0x47')]({'where':{'id':_0x5ad710['params']['id']}})['then'](handleEntityNotFound(_0x413dcc,null))[_0xd799('0x27')](saveUpdates(_0x5ad710['body'],null))[_0xd799('0x27')](respondWithResult(_0x413dcc,null))[_0xd799('0x42')](handleError(_0x413dcc,null));};exports[_0xd799('0x4a')]=function(_0x523e16,_0xf199a){return db[_0xd799('0x2c')]['find']({'where':{'id':_0x523e16[_0xd799('0x4b')]['id']}})[_0xd799('0x27')](handleEntityNotFound(_0xf199a,null))[_0xd799('0x27')](removeEntity(_0xf199a,null))[_0xd799('0x42')](handleError(_0xf199a,null));};exports[_0xd799('0x4c')]=function(_0x4c36fd,_0x3d1e8f,_0x1ee350){var _0x471499={};var _0x7bddce={};var _0x2fb824;var _0x180f56;return db[_0xd799('0x2c')]['findOne']({'where':{'id':_0x4c36fd[_0xd799('0x4b')]['id']}})[_0xd799('0x27')](handleEntityNotFound(_0x3d1e8f,null))[_0xd799('0x27')](function(_0x204c7c){if(_0x204c7c){_0x2fb824=_0x204c7c;_0x7bddce[_0xd799('0x30')]=_[_0xd799('0x44')](db['VtigerConfiguration'][_0xd799('0x2d')]);_0x7bddce[_0xd799('0x31')]=_[_0xd799('0x44')](_0x4c36fd[_0xd799('0x31')]);_0x7bddce[_0xd799('0x39')]=_['intersection'](_0x7bddce[_0xd799('0x30')],_0x7bddce[_0xd799('0x31')]);_0x471499[_0xd799('0x33')]=_[_0xd799('0x32')](_0x7bddce['model'],qs[_0xd799('0x45')](_0x4c36fd[_0xd799('0x31')][_0xd799('0x45')]));_0x471499[_0xd799('0x33')]=_0x471499['attributes'][_0xd799('0x34')]?_0x471499[_0xd799('0x33')]:_0x7bddce[_0xd799('0x30')];_0x471499['order']=qs[_0xd799('0x37')](_0x4c36fd[_0xd799('0x31')]['sort']);_0x471499[_0xd799('0x38')]=qs[_0xd799('0x39')](_[_0xd799('0x3a')](_0x4c36fd[_0xd799('0x31')],_0x7bddce[_0xd799('0x39')]));if(_0x4c36fd[_0xd799('0x31')][_0xd799('0x3b')]){_0x471499['where']=_[_0xd799('0x3c')](_0x471499[_0xd799('0x38')],{'$or':_[_0xd799('0x2b')](_0x471499[_0xd799('0x33')],function(_0x1037bf){var _0x41e625={};_0x41e625[_0x1037bf]={'$like':'%'+_0x4c36fd[_0xd799('0x31')][_0xd799('0x3b')]+'%'};return _0x41e625;})});}_0x471499=_[_0xd799('0x3c')]({},_0x471499,_0x4c36fd['options']);return _0x2fb824[_0xd799('0x4c')](_0x471499);}})[_0xd799('0x27')](function(_0x3aba6a){if(_0x3aba6a){_0x180f56=_0x3aba6a[_0xd799('0x34')];if(!_0x4c36fd['query'][_0xd799('0x35')](_0xd799('0x4d'))){_0x471499[_0xd799('0x1f')]=qs[_0xd799('0x1f')](_0x4c36fd[_0xd799('0x31')][_0xd799('0x1f')]);_0x471499[_0xd799('0x21')]=qs[_0xd799('0x21')](_0x4c36fd[_0xd799('0x31')][_0xd799('0x21')]);}return _0x2fb824['getConfigurations'](_0x471499);}})['then'](function(_0x2707e3){if(_0x2707e3){return _0x2707e3?{'count':_0x180f56,'rows':_0x2707e3}:null;}})['then'](respondWithResult(_0x3d1e8f,null))['catch'](handleError(_0x3d1e8f,null));};exports[_0xd799('0x4e')]=function(_0x22dfec,_0x45e891,_0x348c96){if(_0x22dfec['body']['id']){delete _0x22dfec[_0xd799('0x49')]['id'];}return db[_0xd799('0x2c')][_0xd799('0x4f')]({'where':{'id':_0x22dfec[_0xd799('0x4b')]['id']}})[_0xd799('0x27')](handleEntityNotFound(_0x45e891,null))[_0xd799('0x27')](function(_0x1e1a99){if(_0x1e1a99){_0x22dfec[_0xd799('0x49')][_0xd799('0x50')]=_0x1e1a99['id'];_0x22dfec[_0xd799('0x49')][_0xd799('0x51')]=integrations[_0xd799('0x52')](_0x22dfec['body'][_0xd799('0x53')],_0x22dfec['body'][_0xd799('0x2e')]);_0x22dfec['body'][_0xd799('0x54')]=integrations[_0xd799('0x55')](_0x22dfec[_0xd799('0x49')]['channel'],_0x22dfec[_0xd799('0x49')][_0xd799('0x2e')]);return db[_0xd799('0x56')][_0xd799('0x48')](_0x22dfec[_0xd799('0x49')],{'include':[{'model':db[_0xd799('0x57')],'as':'Subjects'},{'model':db[_0xd799('0x57')],'as':_0xd799('0x54')}]});}return null;})[_0xd799('0x27')](respondWithResult(_0x45e891,null))[_0xd799('0x42')](handleError(_0x45e891,null));};var md5=require(_0xd799('0x58'));exports['getFields']=function(_0x2453cb,_0x23cbb,_0x38db75){var _0x2effde=null;var _0x129b65=null;var _0x79ed5d=null;var _0x1f4f00=null;var _0x145e29='';return db[_0xd799('0x2c')][_0xd799('0x4f')]({'where':{'id':_0x2453cb[_0xd799('0x4b')]['id']},'attributes':['id',_0xd799('0x29'),_0xd799('0x59'),_0xd799('0x5a'),'moduleName',_0xd799('0x5b'),_0xd799('0x5c'),'accessKey']})[_0xd799('0x27')](handleEntityNotFound(_0x23cbb,null))[_0xd799('0x27')](function(_0x5b719b){if(_0x5b719b){_0x2effde=_0x5b719b[_0xd799('0x59')];_0x129b65=_0x5b719b['accessKey'];_0x79ed5d=_0x5b719b[_0xd799('0x5d')];_0x145e29=_0x5b719b[_0xd799('0x5b')];var _0x4fcffb=_0x145e29[_0xd799('0x5e')](-0x1);if(_0x4fcffb==='/'){_0x145e29=_0x145e29['substring'](0x0,_0x145e29['lastIndexOf'](_0x4fcffb));}_0x1f4f00=util[_0xd799('0x5f')](_0xd799('0x60'),_0x145e29);var _0x3b7972={'method':_0xd799('0x61'),'uri':_0x1f4f00,'qs':{'operation':'getchallenge','username':_0x5b719b['username']},'json':!![]};return rp(_0x3b7972);}})[_0xd799('0x27')](function(_0x5a3c00){if(_0x5a3c00[_0xd799('0x62')]){var _0xb85eb0={'method':_0xd799('0x63'),'uri':_0x1f4f00,'form':{'operation':_0xd799('0x64'),'username':_0x2effde,'accessKey':md5(_0x5a3c00[_0xd799('0x65')][_0xd799('0x66')]+_0x129b65)},'json':!![]};return rp(_0xb85eb0);}})['then'](function(_0xc3643f){if(_0xc3643f[_0xd799('0x62')]){var _0x46dee0={'method':_0xd799('0x61'),'uri':_0x1f4f00,'qs':{'operation':_0xd799('0x67'),'username':_0x2effde,'sessionName':_0xc3643f['result']['sessionName'],'elementType':_0x79ed5d},'json':!![]};return rp(_0x46dee0);}})[_0xd799('0x27')](function(_0x5aa466){if(_0x5aa466['success']){var _0x4fa948=[_0xd799('0x68'),_0xd799('0x69'),_0xd799('0x6a')];_[_0xd799('0x6b')](_0x5aa466[_0xd799('0x65')]['fields'],function(_0x538cb9){return _0x4fa948[_0xd799('0x6c')](_0x538cb9[_0xd799('0x2e')][_0xd799('0x29')]);});_[_0xd799('0x6b')](_0x5aa466['result'][_0xd799('0x45')],function(_0x371019){return _0x371019[_0xd799('0x6d')]===_0xd799('0x6e');});return{'count':_0x5aa466['result'][_0xd799('0x45')][_0xd799('0x34')],'rows':_[_0xd799('0x2b')](_0x5aa466[_0xd799('0x65')][_0xd799('0x45')],function(_0x4b2ff5){return{'id':_0x4b2ff5[_0xd799('0x29')],'name':_0x4b2ff5[_0xd799('0x6f')],'custom':_[_0xd799('0x70')](_0x4b2ff5[_0xd799('0x29')],_0xd799('0x71'))?!![]:![],'options':_0x4b2ff5[_0xd799('0x2e')][_0xd799('0x29')]===_0xd799('0x72')&&_0x4b2ff5[_0xd799('0x2e')][_0xd799('0x73')]['length']>0x0?_['map'](_0x4b2ff5['type']['picklistValues'],function(_0x3079bd){return{'name':_0x3079bd[_0xd799('0x6f')],'value':_0x3079bd[_0xd799('0x74')]};}):[]};})};}})['then'](respondWithResult(_0x23cbb,null))['catch'](function(_0x4555de){console[_0xd799('0x75')](_0xd799('0x76')+_0x4555de);var _0x409e6d=_0x2453cb[_0xd799('0x31')][_0xd799('0x77')]?0x1f4:_0x4555de['statusCode']||0x1f4;logger[_0xd799('0x28')](_0xd799('0x78'),_0xd799('0x79'),_0x409e6d,JSON[_0xd799('0x7a')](_0x4555de));delete _0x4555de['name'];if(_0x409e6d===0x191){_0x409e6d=0x190;}_0x23cbb[_0xd799('0x1c')](_0x409e6d)[_0xd799('0x7b')](_0x2453cb[_0xd799('0x31')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4555de[_0xd799('0x7c')]}:_0x4555de);});}; \ No newline at end of file +var _0x65d9=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','VtigerAccount','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','remoteUri','substring','format','success','login','result','token','GET','autogenerated','reference','owner','remove','includes','editable','false','label','picklist','picklistValues','value','log','vTiger\x20error:\x20','test'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x65d9,0x1dd));var _0x965d=function(_0x58990d,_0x4bc55d){_0x58990d=_0x58990d-0x0;var _0x24b799=_0x65d9[_0x58990d];return _0x24b799;};'use strict';var emlformat=require(_0x965d('0x0'));var rimraf=require(_0x965d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x965d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x965d('0x3'));var util=require(_0x965d('0x4'));var path=require('path');var sox=require(_0x965d('0x5'));var csv=require(_0x965d('0x6'));var ejs=require(_0x965d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x965d('0x8'));var crypto=require(_0x965d('0x9'));var jsforce=require(_0x965d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x965d('0x6'));var querystring=require(_0x965d('0xb'));var Papa=require(_0x965d('0xc'));var Redis=require('ioredis');var authService=require(_0x965d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x965d('0xe'));var hardwareService=require(_0x965d('0xf'));var logger=require(_0x965d('0x10'))(_0x965d('0x11'));var utils=require(_0x965d('0x12'));var config=require(_0x965d('0x13'));var licenseUtil=require(_0x965d('0x14'));var db=require(_0x965d('0x15'))['db'];var integrations=require(_0x965d('0x16'));function respondWithStatusCode(_0x5b3cf8,_0x4cfc6f){_0x4cfc6f=_0x4cfc6f||0xcc;return function(_0x57d57e){if(_0x57d57e){return _0x5b3cf8['sendStatus'](_0x4cfc6f);}return _0x5b3cf8[_0x965d('0x17')](_0x4cfc6f)[_0x965d('0x18')]();};}function respondWithResult(_0x4d9fb5,_0x20daf5){_0x20daf5=_0x20daf5||0xc8;return function(_0x1ebb26){if(_0x1ebb26){return _0x4d9fb5[_0x965d('0x17')](_0x20daf5)[_0x965d('0x19')](_0x1ebb26);}};}function respondWithFilteredResult(_0x5e9b89,_0x265aa0){return function(_0x446b1f){if(_0x446b1f){var _0x1a4cfe=typeof _0x265aa0[_0x965d('0x1a')]===_0x965d('0x1b')&&typeof _0x265aa0[_0x965d('0x1c')]==='undefined';var _0x544ea3=_0x446b1f['count'];var _0x1412d5=_0x1a4cfe?0x0:_0x265aa0[_0x965d('0x1a')];var _0x8db0d3=_0x1a4cfe?_0x446b1f['count']:_0x265aa0[_0x965d('0x1a')]+_0x265aa0[_0x965d('0x1c')];var _0x4c308e;if(_0x8db0d3>=_0x544ea3){_0x8db0d3=_0x544ea3;_0x4c308e=0xc8;}else{_0x4c308e=0xce;}_0x5e9b89[_0x965d('0x17')](_0x4c308e);return _0x5e9b89['set']('Content-Range',_0x1412d5+'-'+_0x8db0d3+'/'+_0x544ea3)[_0x965d('0x19')](_0x446b1f);}return null;};}function patchUpdates(_0x4418e2){return function(_0x3d3681){try{jsonpatch[_0x965d('0x1d')](_0x3d3681,_0x4418e2,!![]);}catch(_0x266c94){return BPromise[_0x965d('0x1e')](_0x266c94);}return _0x3d3681[_0x965d('0x1f')]();};}function saveUpdates(_0x4a7f85,_0x1e9ae9){return function(_0x16cc82){if(_0x16cc82){return _0x16cc82[_0x965d('0x20')](_0x4a7f85)['then'](function(_0x54f00b){return _0x54f00b;});}return null;};}function removeEntity(_0x5e5ac8,_0x5ae1ac){return function(_0x3e40af){if(_0x3e40af){return _0x3e40af[_0x965d('0x21')]()[_0x965d('0x22')](function(){_0x5e5ac8['status'](0xcc)[_0x965d('0x18')]();});}};}function handleEntityNotFound(_0x4112e2,_0x43bac7){return function(_0x326d17){if(!_0x326d17){_0x4112e2[_0x965d('0x23')](0x194);}return _0x326d17;};}function handleError(_0x571706,_0x2e0198){_0x2e0198=_0x2e0198||0x1f4;return function(_0x456920){logger[_0x965d('0x24')](_0x456920[_0x965d('0x25')]);if(_0x456920[_0x965d('0x26')]){delete _0x456920[_0x965d('0x26')];}_0x571706[_0x965d('0x17')](_0x2e0198)[_0x965d('0x27')](_0x456920);};}exports['index']=function(_0x3f97e2,_0x4f2206){var _0xfbdd8e={},_0x508937={},_0x4a0461={'count':0x0,'rows':[]};var _0x6dbbba=_[_0x965d('0x28')](db['VtigerAccount'][_0x965d('0x29')],function(_0x4d2db9){return{'name':_0x4d2db9[_0x965d('0x2a')],'type':_0x4d2db9['type'][_0x965d('0x2b')]};});_0x508937[_0x965d('0x2c')]=_[_0x965d('0x28')](_0x6dbbba,_0x965d('0x26'));_0x508937[_0x965d('0x2d')]=_[_0x965d('0x2e')](_0x3f97e2[_0x965d('0x2d')]);_0x508937['filters']=_[_0x965d('0x2f')](_0x508937[_0x965d('0x2c')],_0x508937[_0x965d('0x2d')]);_0xfbdd8e[_0x965d('0x30')]=_[_0x965d('0x2f')](_0x508937[_0x965d('0x2c')],qs[_0x965d('0x31')](_0x3f97e2[_0x965d('0x2d')]['fields']));_0xfbdd8e[_0x965d('0x30')]=_0xfbdd8e['attributes'][_0x965d('0x32')]?_0xfbdd8e['attributes']:_0x508937['model'];if(!_0x3f97e2[_0x965d('0x2d')][_0x965d('0x33')](_0x965d('0x34'))){_0xfbdd8e[_0x965d('0x1c')]=qs['limit'](_0x3f97e2[_0x965d('0x2d')][_0x965d('0x1c')]);_0xfbdd8e['offset']=qs[_0x965d('0x1a')](_0x3f97e2[_0x965d('0x2d')][_0x965d('0x1a')]);}_0xfbdd8e[_0x965d('0x35')]=qs[_0x965d('0x36')](_0x3f97e2['query'][_0x965d('0x36')]);_0xfbdd8e['where']=qs[_0x965d('0x37')](_[_0x965d('0x38')](_0x3f97e2[_0x965d('0x2d')],_0x508937[_0x965d('0x37')]),_0x6dbbba);if(_0x3f97e2[_0x965d('0x2d')][_0x965d('0x39')]){_0xfbdd8e[_0x965d('0x3a')]=_['merge'](_0xfbdd8e[_0x965d('0x3a')],{'$or':_[_0x965d('0x28')](_0x6dbbba,function(_0x51bc4e){if(_0x51bc4e[_0x965d('0x3b')]!==_0x965d('0x3c')){var _0x517395={};_0x517395[_0x51bc4e[_0x965d('0x26')]]={'$like':'%'+_0x3f97e2['query'][_0x965d('0x39')]+'%'};return _0x517395;}})});}_0xfbdd8e=_[_0x965d('0x3d')]({},_0xfbdd8e,_0x3f97e2[_0x965d('0x3e')]);var _0x3fbb59={'where':_0xfbdd8e['where']};return db[_0x965d('0x3f')][_0x965d('0x40')](_0x3fbb59)['then'](function(_0x315e6d){_0x4a0461[_0x965d('0x40')]=_0x315e6d;if(_0x3f97e2[_0x965d('0x2d')][_0x965d('0x41')]){_0xfbdd8e[_0x965d('0x42')]=[{'all':!![]}];}return db[_0x965d('0x3f')][_0x965d('0x43')](_0xfbdd8e);})[_0x965d('0x22')](function(_0x150b30){_0x4a0461[_0x965d('0x44')]=_0x150b30;return _0x4a0461;})['then'](respondWithFilteredResult(_0x4f2206,_0xfbdd8e))[_0x965d('0x45')](handleError(_0x4f2206,null));};exports[_0x965d('0x46')]=function(_0x1809d1,_0x41e0c7){var _0x426965={'raw':![],'where':{'id':_0x1809d1[_0x965d('0x47')]['id']}},_0x52b33f={};_0x52b33f[_0x965d('0x2c')]=_[_0x965d('0x2e')](db[_0x965d('0x3f')][_0x965d('0x29')]);_0x52b33f[_0x965d('0x2d')]=_[_0x965d('0x2e')](_0x1809d1['query']);_0x52b33f[_0x965d('0x37')]=_[_0x965d('0x2f')](_0x52b33f[_0x965d('0x2c')],_0x52b33f[_0x965d('0x2d')]);_0x426965[_0x965d('0x30')]=_[_0x965d('0x2f')](_0x52b33f[_0x965d('0x2c')],qs[_0x965d('0x31')](_0x1809d1[_0x965d('0x2d')][_0x965d('0x31')]));_0x426965[_0x965d('0x30')]=_0x426965[_0x965d('0x30')][_0x965d('0x32')]?_0x426965[_0x965d('0x30')]:_0x52b33f[_0x965d('0x2c')];if(_0x1809d1[_0x965d('0x2d')]['includeAll']){_0x426965[_0x965d('0x42')]=[{'all':!![]}];}_0x426965=_[_0x965d('0x3d')]({},_0x426965,_0x1809d1[_0x965d('0x3e')]);return db['VtigerAccount']['find'](_0x426965)[_0x965d('0x22')](handleEntityNotFound(_0x41e0c7,null))['then'](respondWithResult(_0x41e0c7,null))['catch'](handleError(_0x41e0c7,null));};exports[_0x965d('0x48')]=function(_0x3ac085,_0x2230c0){return db[_0x965d('0x3f')][_0x965d('0x48')](_0x3ac085[_0x965d('0x49')],{})[_0x965d('0x22')](respondWithResult(_0x2230c0,0xc9))['catch'](handleError(_0x2230c0,null));};exports[_0x965d('0x20')]=function(_0x177a10,_0x342b3a){if(_0x177a10[_0x965d('0x49')]['id']){delete _0x177a10['body']['id'];}return db[_0x965d('0x3f')]['find']({'where':{'id':_0x177a10[_0x965d('0x47')]['id']}})['then'](handleEntityNotFound(_0x342b3a,null))[_0x965d('0x22')](saveUpdates(_0x177a10[_0x965d('0x49')],null))[_0x965d('0x22')](respondWithResult(_0x342b3a,null))[_0x965d('0x45')](handleError(_0x342b3a,null));};exports[_0x965d('0x21')]=function(_0xb40184,_0x410cb2){return db[_0x965d('0x3f')][_0x965d('0x4a')]({'where':{'id':_0xb40184['params']['id']}})[_0x965d('0x22')](handleEntityNotFound(_0x410cb2,null))[_0x965d('0x22')](removeEntity(_0x410cb2,null))[_0x965d('0x45')](handleError(_0x410cb2,null));};exports[_0x965d('0x4b')]=function(_0x40679d,_0x69768c,_0x584fe9){var _0x4b6f15={};var _0x5ee367={};var _0xa5e2c2;var _0xa18327;return db[_0x965d('0x3f')][_0x965d('0x4c')]({'where':{'id':_0x40679d['params']['id']}})[_0x965d('0x22')](handleEntityNotFound(_0x69768c,null))[_0x965d('0x22')](function(_0x2845bd){if(_0x2845bd){_0xa5e2c2=_0x2845bd;_0x5ee367[_0x965d('0x2c')]=_[_0x965d('0x2e')](db['VtigerConfiguration'][_0x965d('0x29')]);_0x5ee367[_0x965d('0x2d')]=_['keys'](_0x40679d[_0x965d('0x2d')]);_0x5ee367['filters']=_['intersection'](_0x5ee367['model'],_0x5ee367[_0x965d('0x2d')]);_0x4b6f15['attributes']=_['intersection'](_0x5ee367[_0x965d('0x2c')],qs['fields'](_0x40679d[_0x965d('0x2d')]['fields']));_0x4b6f15[_0x965d('0x30')]=_0x4b6f15[_0x965d('0x30')]['length']?_0x4b6f15[_0x965d('0x30')]:_0x5ee367['model'];_0x4b6f15[_0x965d('0x35')]=qs[_0x965d('0x36')](_0x40679d['query'][_0x965d('0x36')]);_0x4b6f15[_0x965d('0x3a')]=qs['filters'](_['pick'](_0x40679d[_0x965d('0x2d')],_0x5ee367[_0x965d('0x37')]));if(_0x40679d[_0x965d('0x2d')][_0x965d('0x39')]){_0x4b6f15[_0x965d('0x3a')]=_[_0x965d('0x3d')](_0x4b6f15[_0x965d('0x3a')],{'$or':_[_0x965d('0x28')](_0x4b6f15[_0x965d('0x30')],function(_0x2afbd4){var _0x855282={};_0x855282[_0x2afbd4]={'$like':'%'+_0x40679d[_0x965d('0x2d')][_0x965d('0x39')]+'%'};return _0x855282;})});}_0x4b6f15=_['merge']({},_0x4b6f15,_0x40679d['options']);return _0xa5e2c2['getConfigurations'](_0x4b6f15);}})[_0x965d('0x22')](function(_0xdfca87){if(_0xdfca87){_0xa18327=_0xdfca87[_0x965d('0x32')];if(!_0x40679d[_0x965d('0x2d')][_0x965d('0x33')](_0x965d('0x34'))){_0x4b6f15[_0x965d('0x1c')]=qs[_0x965d('0x1c')](_0x40679d[_0x965d('0x2d')][_0x965d('0x1c')]);_0x4b6f15[_0x965d('0x1a')]=qs[_0x965d('0x1a')](_0x40679d[_0x965d('0x2d')][_0x965d('0x1a')]);}return _0xa5e2c2[_0x965d('0x4b')](_0x4b6f15);}})['then'](function(_0x28b10c){if(_0x28b10c){return _0x28b10c?{'count':_0xa18327,'rows':_0x28b10c}:null;}})['then'](respondWithResult(_0x69768c,null))[_0x965d('0x45')](handleError(_0x69768c,null));};exports[_0x965d('0x4d')]=function(_0x1a47ba,_0x3d3bec,_0x1974b4){if(_0x1a47ba[_0x965d('0x49')]['id']){delete _0x1a47ba['body']['id'];}return db[_0x965d('0x3f')][_0x965d('0x4c')]({'where':{'id':_0x1a47ba[_0x965d('0x47')]['id']}})[_0x965d('0x22')](handleEntityNotFound(_0x3d3bec,null))['then'](function(_0x3d3ab7){if(_0x3d3ab7){_0x1a47ba[_0x965d('0x49')]['AccountId']=_0x3d3ab7['id'];_0x1a47ba[_0x965d('0x49')][_0x965d('0x4e')]=integrations[_0x965d('0x4f')](_0x1a47ba[_0x965d('0x49')][_0x965d('0x50')],_0x1a47ba[_0x965d('0x49')][_0x965d('0x3b')]);_0x1a47ba[_0x965d('0x49')][_0x965d('0x51')]=integrations[_0x965d('0x52')](_0x1a47ba['body']['channel'],_0x1a47ba['body'][_0x965d('0x3b')]);return db[_0x965d('0x53')][_0x965d('0x48')](_0x1a47ba[_0x965d('0x49')],{'include':[{'model':db[_0x965d('0x54')],'as':_0x965d('0x4e')},{'model':db[_0x965d('0x54')],'as':_0x965d('0x51')}]});}return null;})[_0x965d('0x22')](respondWithResult(_0x3d3bec,null))[_0x965d('0x45')](handleError(_0x3d3bec,null));};var md5=require(_0x965d('0x55'));exports['getFields']=function(_0x58b3c8,_0x5a6bff,_0x222eef){var _0x5e83fe=null;var _0x3bfa63=null;var _0xa20f9=null;var _0x34d8eb=null;var _0x9e3e20='';return db[_0x965d('0x3f')]['findOne']({'where':{'id':_0x58b3c8[_0x965d('0x47')]['id']},'attributes':['id','name',_0x965d('0x56'),_0x965d('0x57'),_0x965d('0x58'),'remoteUri',_0x965d('0x59'),_0x965d('0x5a')]})[_0x965d('0x22')](handleEntityNotFound(_0x5a6bff,null))[_0x965d('0x22')](function(_0x4931ce){if(_0x4931ce){_0x5e83fe=_0x4931ce[_0x965d('0x56')];_0x3bfa63=_0x4931ce[_0x965d('0x5a')];_0xa20f9=_0x4931ce['moduleName'];_0x9e3e20=_0x4931ce[_0x965d('0x5b')];var _0xd5ab43=_0x9e3e20['slice'](-0x1);if(_0xd5ab43==='/'){_0x9e3e20=_0x9e3e20[_0x965d('0x5c')](0x0,_0x9e3e20['lastIndexOf'](_0xd5ab43));}_0x34d8eb=util[_0x965d('0x5d')]('%s/webservice.php',_0x9e3e20);var _0x4137bf={'method':'GET','uri':_0x34d8eb,'qs':{'operation':'getchallenge','username':_0x4931ce[_0x965d('0x56')]},'json':!![]};return rp(_0x4137bf);}})[_0x965d('0x22')](function(_0x189a21){if(_0x189a21[_0x965d('0x5e')]){var _0x35fceb={'method':'POST','uri':_0x34d8eb,'form':{'operation':_0x965d('0x5f'),'username':_0x5e83fe,'accessKey':md5(_0x189a21[_0x965d('0x60')][_0x965d('0x61')]+_0x3bfa63)},'json':!![]};return rp(_0x35fceb);}})[_0x965d('0x22')](function(_0x29194a){if(_0x29194a['success']){var _0x4a7c10={'method':_0x965d('0x62'),'uri':_0x34d8eb,'qs':{'operation':'describe','username':_0x5e83fe,'sessionName':_0x29194a[_0x965d('0x60')]['sessionName'],'elementType':_0xa20f9},'json':!![]};return rp(_0x4a7c10);}})['then'](function(_0x1a396e){if(_0x1a396e[_0x965d('0x5e')]){var _0x34e9bd=[_0x965d('0x63'),_0x965d('0x64'),_0x965d('0x65')];_[_0x965d('0x66')](_0x1a396e[_0x965d('0x60')]['fields'],function(_0x1e870e){return _0x34e9bd[_0x965d('0x67')](_0x1e870e['type'][_0x965d('0x26')]);});_[_0x965d('0x66')](_0x1a396e[_0x965d('0x60')][_0x965d('0x31')],function(_0x27e8c0){return _0x27e8c0[_0x965d('0x68')]===_0x965d('0x69');});return{'count':_0x1a396e[_0x965d('0x60')][_0x965d('0x31')][_0x965d('0x32')],'rows':_[_0x965d('0x28')](_0x1a396e[_0x965d('0x60')][_0x965d('0x31')],function(_0x52076e){return{'id':_0x52076e[_0x965d('0x26')],'name':_0x52076e[_0x965d('0x6a')],'custom':_['startsWith'](_0x52076e[_0x965d('0x26')],'cf_')?!![]:![],'options':_0x52076e[_0x965d('0x3b')][_0x965d('0x26')]===_0x965d('0x6b')&&_0x52076e['type'][_0x965d('0x6c')][_0x965d('0x32')]>0x0?_[_0x965d('0x28')](_0x52076e[_0x965d('0x3b')][_0x965d('0x6c')],function(_0x1a2648){return{'name':_0x1a2648[_0x965d('0x6a')],'value':_0x1a2648[_0x965d('0x6d')]};}):[]};})};}})[_0x965d('0x22')](respondWithResult(_0x5a6bff,null))[_0x965d('0x45')](function(_0x166aec){console[_0x965d('0x6e')](_0x965d('0x6f')+_0x166aec);var _0x557bdf=_0x58b3c8[_0x965d('0x2d')][_0x965d('0x70')]?0x1f4:_0x166aec[_0x965d('0x71')]||0x1f4;logger['error'](_0x965d('0x72'),_0x965d('0x73'),_0x557bdf,JSON[_0x965d('0x74')](_0x166aec));delete _0x166aec[_0x965d('0x26')];if(_0x557bdf===0x191){_0x557bdf=0x190;}_0x5a6bff[_0x965d('0x17')](_0x557bdf)[_0x965d('0x27')](_0x58b3c8['query'][_0x965d('0x70')]?{'message':_0x965d('0x75'),'statusCode':_0x166aec[_0x965d('0x71')]}:_0x166aec);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d6c7708..34eccf6 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 _0xd707=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x3b6673,_0x291c3d){var _0x10c4d2=function(_0x515f3d){while(--_0x515f3d){_0x3b6673['push'](_0x3b6673['shift']());}};_0x10c4d2(++_0x291c3d);}(_0xd707,0xb2));var _0x7d70=function(_0xd5038b,_0x10559e){_0xd5038b=_0xd5038b-0x0;var _0x28c6dc=_0xd707[_0xd5038b];return _0x28c6dc;};'use strict';var _=require(_0x7d70('0x0'));var util=require(_0x7d70('0x1'));var logger=require(_0x7d70('0x2'))(_0x7d70('0x3'));var moment=require(_0x7d70('0x4'));var BPromise=require(_0x7d70('0x5'));var rp=require(_0x7d70('0x6'));var fs=require('fs');var path=require(_0x7d70('0x7'));var rimraf=require('rimraf');var config=require(_0x7d70('0x8'));var attributes=require(_0x7d70('0x9'));var integrations=require(_0x7d70('0xa'));module[_0x7d70('0xb')]=function(_0x555f11,_0x2786ef){return _0x555f11[_0x7d70('0xc')](_0x7d70('0xd'),attributes,{'tableName':_0x7d70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6b4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash'];(function(_0x50de84,_0x49d086){var _0x3d9d1d=function(_0x10f09d){while(--_0x10f09d){_0x50de84['push'](_0x50de84['shift']());}};_0x3d9d1d(++_0x49d086);}(_0xc6b4,0x14f));var _0x4c6b=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0xc6b4[_0x13fd59];return _0x2e6ce7;};'use strict';var _=require(_0x4c6b('0x0'));var util=require(_0x4c6b('0x1'));var logger=require('../../config/logger')(_0x4c6b('0x2'));var moment=require(_0x4c6b('0x3'));var BPromise=require(_0x4c6b('0x4'));var rp=require(_0x4c6b('0x5'));var fs=require('fs');var path=require(_0x4c6b('0x6'));var rimraf=require(_0x4c6b('0x7'));var config=require(_0x4c6b('0x8'));var attributes=require(_0x4c6b('0x9'));var integrations=require(_0x4c6b('0xa'));module[_0x4c6b('0xb')]=function(_0x23bb52,_0x328b8e){return _0x23bb52[_0x4c6b('0xc')]('VtigerAccount',attributes,{'tableName':_0x4c6b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 4f39179..7632754 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 _0xdb94=['findAll','options','raw','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetVtigerAccount','VtigerAccount'];(function(_0x4c7e14,_0x5d1c6b){var _0x379d1d=function(_0x3e58ea){while(--_0x3e58ea){_0x4c7e14['push'](_0x4c7e14['shift']());}};_0x379d1d(++_0x5d1c6b);}(_0xdb94,0xab));var _0x4db9=function(_0x35aa4c,_0x599686){_0x35aa4c=_0x35aa4c-0x0;var _0x296731=_0xdb94[_0x35aa4c];return _0x296731;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});}exports[_0x4db9('0x13')]=function(_0x462af3){var _0xa693c4=this;return new Promise(function(_0x1d3c33,_0x55494a){return db[_0x4db9('0x14')][_0x4db9('0x15')]({'raw':_0x462af3[_0x4db9('0x16')]?_0x462af3['options'][_0x4db9('0x17')]===undefined?!![]:![]:!![],'where':_0x462af3[_0x4db9('0x16')]?_0x462af3[_0x4db9('0x16')]['where']||null:null,'attributes':_0x462af3[_0x4db9('0x16')]?_0x462af3[_0x4db9('0x16')][_0x4db9('0x18')]||null:null,'limit':_0x462af3[_0x4db9('0x16')]?_0x462af3[_0x4db9('0x16')][_0x4db9('0x19')]||null:null,'include':_0x462af3[_0x4db9('0x16')]?_0x462af3['options'][_0x4db9('0x1a')]?_[_0x4db9('0x1b')](_0x462af3[_0x4db9('0x16')][_0x4db9('0x1a')],function(_0x4aaa84){return{'model':db[_0x4aaa84[_0x4db9('0x1c')]],'as':_0x4aaa84['as'],'attributes':_0x4aaa84[_0x4db9('0x18')],'include':_0x4aaa84['include']?_[_0x4db9('0x1b')](_0x4aaa84[_0x4db9('0x1a')],function(_0x2987c6){return{'model':db[_0x2987c6['model']],'as':_0x2987c6['as'],'attributes':_0x2987c6[_0x4db9('0x18')],'include':_0x2987c6[_0x4db9('0x1a')]?_[_0x4db9('0x1b')](_0x2987c6[_0x4db9('0x1a')],function(_0x3f9f7e){return{'model':db[_0x3f9f7e[_0x4db9('0x1c')]],'as':_0x3f9f7e['as'],'attributes':_0x3f9f7e[_0x4db9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4db9('0xa')](function(_0x3d0f12){logger[_0x4db9('0xb')](_0x4db9('0x13'),_0x462af3);logger[_0x4db9('0xe')](_0x4db9('0x13'),_0x462af3,JSON[_0x4db9('0x1d')](_0x3d0f12));_0x1d3c33(_0x3d0f12);})['catch'](function(_0x5031fe){logger[_0x4db9('0x10')](_0x4db9('0x13'),_0x5031fe[_0x4db9('0x11')],_0x462af3);_0x55494a(_0xa693c4[_0x4db9('0x10')](0x1f4,_0x5031fe[_0x4db9('0x11')]));});});};exports[_0x4db9('0x1e')]=function(_0x4dc946){var _0x375834=this;return new Promise(function(_0x554eef,_0x3b6a64){return db[_0x4db9('0x14')][_0x4db9('0x1f')]({'raw':_0x4dc946[_0x4db9('0x16')]?_0x4dc946[_0x4db9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4dc946['options']?_0x4dc946[_0x4db9('0x16')]['where']||null:null,'attributes':_0x4dc946[_0x4db9('0x16')]?_0x4dc946[_0x4db9('0x16')]['attributes']||null:null,'include':_0x4dc946[_0x4db9('0x16')]?_0x4dc946[_0x4db9('0x16')][_0x4db9('0x1a')]?_['map'](_0x4dc946[_0x4db9('0x16')]['include'],function(_0x40226c){return{'model':db[_0x40226c[_0x4db9('0x1c')]],'as':_0x40226c['as'],'attributes':_0x40226c[_0x4db9('0x18')],'include':_0x40226c['include']?_['map'](_0x40226c[_0x4db9('0x1a')],function(_0x1494bc){return{'model':db[_0x1494bc[_0x4db9('0x1c')]],'as':_0x1494bc['as'],'attributes':_0x1494bc[_0x4db9('0x18')],'include':_0x1494bc[_0x4db9('0x1a')]?_[_0x4db9('0x1b')](_0x1494bc[_0x4db9('0x1a')],function(_0x2bbf0e){return{'model':db[_0x2bbf0e[_0x4db9('0x1c')]],'as':_0x2bbf0e['as'],'attributes':_0x2bbf0e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4db9('0xa')](function(_0x94536b){logger[_0x4db9('0xb')](_0x4db9('0x1e'),_0x4dc946);logger['debug'](_0x4db9('0x1e'),_0x4dc946,JSON[_0x4db9('0x1d')](_0x94536b));_0x554eef(_0x94536b);})[_0x4db9('0x12')](function(_0x5495ed){logger[_0x4db9('0x10')](_0x4db9('0x1e'),_0x5495ed[_0x4db9('0x11')],_0x4dc946);_0x3b6a64(_0x375834[_0x4db9('0x10')](0x1f4,_0x5495ed['message']));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount'];(function(_0x14bc37,_0x34f18c){var _0x5b2e9c=function(_0xcf0c3a){while(--_0xcf0c3a){_0x14bc37['push'](_0x14bc37['shift']());}};_0x5b2e9c(++_0x34f18c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetVtigerAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowVtigerAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5278361..f59aaad 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 _0xc474=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields'];(function(_0x4c90be,_0x41799a){var _0xa82bfe=function(_0x4e4fd0){while(--_0x4e4fd0){_0x4c90be['push'](_0x4c90be['shift']());}};_0xa82bfe(++_0x41799a);}(_0xc474,0x6e));var _0x4c47=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xc474[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4c47('0x2'));var router=express[_0x4c47('0x3')]();var fs_extra=require(_0x4c47('0x4'));var auth=require(_0x4c47('0x5'));var interaction=require(_0x4c47('0x6'));var config=require(_0x4c47('0x7'));var controller=require(_0x4c47('0x8'));router['get']('/',auth[_0x4c47('0x9')](),controller[_0x4c47('0xa')]);router[_0x4c47('0xb')]('/:id',auth[_0x4c47('0x9')](),controller[_0x4c47('0xc')]);router[_0x4c47('0xb')](_0x4c47('0xd'),auth[_0x4c47('0x9')](),controller[_0x4c47('0xe')]);router[_0x4c47('0xb')](_0x4c47('0xf'),auth[_0x4c47('0x9')](),controller[_0x4c47('0x10')]);router['get'](_0x4c47('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x4c47('0x12')]('/',auth[_0x4c47('0x9')](),controller[_0x4c47('0x13')]);router[_0x4c47('0x14')]('/:id',auth[_0x4c47('0x9')](),controller[_0x4c47('0x15')]);router[_0x4c47('0x16')](_0x4c47('0x17'),auth[_0x4c47('0x9')](),controller['destroy']);module[_0x4c47('0x18')]=router; \ No newline at end of file +var _0x3bfb=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','util'];(function(_0x5130c1,_0x28c7ec){var _0x559148=function(_0x22bf1d){while(--_0x22bf1d){_0x5130c1['push'](_0x5130c1['shift']());}};_0x559148(++_0x28c7ec);}(_0x3bfb,0x186));var _0xb3bf=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x3bfb[_0x57014b];return _0x2b258a;};'use strict';var multer=require('multer');var util=require(_0xb3bf('0x0'));var path=require(_0xb3bf('0x1'));var timeout=require(_0xb3bf('0x2'));var express=require(_0xb3bf('0x3'));var router=express['Router']();var fs_extra=require(_0xb3bf('0x4'));var auth=require(_0xb3bf('0x5'));var interaction=require(_0xb3bf('0x6'));var config=require(_0xb3bf('0x7'));var controller=require(_0xb3bf('0x8'));router[_0xb3bf('0x9')]('/',auth[_0xb3bf('0xa')](),controller[_0xb3bf('0xb')]);router[_0xb3bf('0x9')](_0xb3bf('0xc'),auth['isAuthenticated'](),controller[_0xb3bf('0xd')]);router[_0xb3bf('0x9')](_0xb3bf('0xe'),auth[_0xb3bf('0xa')](),controller[_0xb3bf('0xf')]);router[_0xb3bf('0x9')](_0xb3bf('0x10'),auth[_0xb3bf('0xa')](),controller['getSubjects']);router[_0xb3bf('0x9')](_0xb3bf('0x11'),auth[_0xb3bf('0xa')](),controller[_0xb3bf('0x12')]);router[_0xb3bf('0x13')]('/',auth[_0xb3bf('0xa')](),controller[_0xb3bf('0x14')]);router[_0xb3bf('0x15')]('/:id',auth[_0xb3bf('0xa')](),controller[_0xb3bf('0x16')]);router['delete'](_0xb3bf('0xc'),auth[_0xb3bf('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ea4cb4c..739a2fb 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 _0x9888=['sequelize','exports','STRING'];(function(_0x122d4d,_0x590e87){var _0x3668cf=function(_0x5551f2){while(--_0x5551f2){_0x122d4d['push'](_0x122d4d['shift']());}};_0x3668cf(++_0x590e87);}(_0x9888,0x12c));var _0x8988=function(_0x49d6cf,_0xbff92e){_0x49d6cf=_0x49d6cf-0x0;var _0x4a355c=_0x9888[_0x49d6cf];return _0x4a355c;};'use strict';var Sequelize=require(_0x8988('0x0'));module[_0x8988('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8988('0x2')]}}; \ No newline at end of file +var _0x1ce5=['exports','sequelize'];(function(_0x176b99,_0x3cfc43){var _0x32585a=function(_0x4bea69){while(--_0x4bea69){_0x176b99['push'](_0x176b99['shift']());}};_0x32585a(++_0x3cfc43);}(_0x1ce5,0x1e9));var _0x51ce=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1ce5[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0x51ce('0x0'));module[_0x51ce('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5c32e6b..b945af7 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 _0x7860=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','merge','filter','options','include','findAll','catch','params','rawAttributes','find','create','body','destroy','getFields','findOne','VtigerField','sort','hasOwnProperty','nolimit','getSubjects','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x370b43,_0x5de31f){var _0x15d40d=function(_0x2d7b2f){while(--_0x2d7b2f){_0x370b43['push'](_0x370b43['shift']());}};_0x15d40d(++_0x5de31f);}(_0x7860,0xe4));var _0x0786=function(_0xe5d0ad,_0x4b0d49){_0xe5d0ad=_0xe5d0ad-0x0;var _0x4845dc=_0x7860[_0xe5d0ad];return _0x4845dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0786('0x0'));var jsonpatch=require(_0x0786('0x1'));var rp=require('request-promise');var moment=require(_0x0786('0x2'));var BPromise=require(_0x0786('0x3'));var Mustache=require(_0x0786('0x4'));var util=require(_0x0786('0x5'));var path=require(_0x0786('0x6'));var sox=require(_0x0786('0x7'));var csv=require('to-csv');var ejs=require(_0x0786('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0786('0x9'));var squel=require('squel');var crypto=require(_0x0786('0xa'));var jsforce=require(_0x0786('0xb'));var deskjs=require(_0x0786('0xc'));var toCsv=require(_0x0786('0xd'));var querystring=require(_0x0786('0xe'));var Papa=require(_0x0786('0xf'));var Redis=require(_0x0786('0x10'));var authService=require(_0x0786('0x11'));var qs=require(_0x0786('0x12'));var as=require(_0x0786('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0786('0x14'))(_0x0786('0x15'));var utils=require('../../config/utils');var config=require(_0x0786('0x16'));var licenseUtil=require(_0x0786('0x17'));var db=require(_0x0786('0x18'))['db'];function respondWithStatusCode(_0x37fc93,_0xeb4312){_0xeb4312=_0xeb4312||0xcc;return function(_0x216475){if(_0x216475){return _0x37fc93[_0x0786('0x19')](_0xeb4312);}return _0x37fc93[_0x0786('0x1a')](_0xeb4312)[_0x0786('0x1b')]();};}function respondWithResult(_0x292b91,_0x24e638){_0x24e638=_0x24e638||0xc8;return function(_0x258648){if(_0x258648){return _0x292b91[_0x0786('0x1a')](_0x24e638)[_0x0786('0x1c')](_0x258648);}};}function respondWithFilteredResult(_0x4da9ae,_0xcb4139){return function(_0x1e3912){if(_0x1e3912){var _0x127ad4=typeof _0xcb4139[_0x0786('0x1d')]===_0x0786('0x1e')&&typeof _0xcb4139[_0x0786('0x1f')]===_0x0786('0x1e');var _0x276323=_0x1e3912[_0x0786('0x20')];var _0x1ca5e7=_0x127ad4?0x0:_0xcb4139[_0x0786('0x1d')];var _0x26b36f=_0x127ad4?_0x1e3912['count']:_0xcb4139['offset']+_0xcb4139[_0x0786('0x1f')];var _0x41d78c;if(_0x26b36f>=_0x276323){_0x26b36f=_0x276323;_0x41d78c=0xc8;}else{_0x41d78c=0xce;}_0x4da9ae[_0x0786('0x1a')](_0x41d78c);return _0x4da9ae[_0x0786('0x21')]('Content-Range',_0x1ca5e7+'-'+_0x26b36f+'/'+_0x276323)['json'](_0x1e3912);}return null;};}function patchUpdates(_0x59d455){return function(_0x507039){try{jsonpatch['apply'](_0x507039,_0x59d455,!![]);}catch(_0x1d7de6){return BPromise[_0x0786('0x22')](_0x1d7de6);}return _0x507039[_0x0786('0x23')]();};}function saveUpdates(_0x4d4649,_0x523f95){return function(_0x916001){if(_0x916001){return _0x916001[_0x0786('0x24')](_0x4d4649)['then'](function(_0x5e468f){return _0x5e468f;});}return null;};}function removeEntity(_0xeacb05,_0x1694c9){return function(_0x1263d6){if(_0x1263d6){return _0x1263d6['destroy']()[_0x0786('0x25')](function(){_0xeacb05[_0x0786('0x1a')](0xcc)[_0x0786('0x1b')]();});}};}function handleEntityNotFound(_0x42bb74,_0x5465b3){return function(_0x195714){if(!_0x195714){_0x42bb74[_0x0786('0x19')](0x194);}return _0x195714;};}function handleError(_0xd8f975,_0x3787e6){_0x3787e6=_0x3787e6||0x1f4;return function(_0x2d309f){logger[_0x0786('0x26')](_0x2d309f[_0x0786('0x27')]);if(_0x2d309f['name']){delete _0x2d309f[_0x0786('0x28')];}_0xd8f975['status'](_0x3787e6)[_0x0786('0x29')](_0x2d309f);};}exports[_0x0786('0x2a')]=function(_0x512769,_0xda8821){var _0x2265d7={},_0x57ad9b={},_0x2a27f8={'count':0x0,'rows':[]};var _0xa8d972=_[_0x0786('0x2b')](db[_0x0786('0x2c')]['rawAttributes'],function(_0x22f311){return{'name':_0x22f311[_0x0786('0x2d')],'type':_0x22f311[_0x0786('0x2e')][_0x0786('0x2f')]};});_0x57ad9b[_0x0786('0x30')]=_[_0x0786('0x2b')](_0xa8d972,'name');_0x57ad9b[_0x0786('0x31')]=_[_0x0786('0x32')](_0x512769[_0x0786('0x31')]);_0x57ad9b[_0x0786('0x33')]=_[_0x0786('0x34')](_0x57ad9b['model'],_0x57ad9b[_0x0786('0x31')]);_0x2265d7[_0x0786('0x35')]=_[_0x0786('0x34')](_0x57ad9b[_0x0786('0x30')],qs[_0x0786('0x36')](_0x512769[_0x0786('0x31')][_0x0786('0x36')]));_0x2265d7['attributes']=_0x2265d7[_0x0786('0x35')][_0x0786('0x37')]?_0x2265d7[_0x0786('0x35')]:_0x57ad9b[_0x0786('0x30')];if(!_0x512769[_0x0786('0x31')]['hasOwnProperty']('nolimit')){_0x2265d7[_0x0786('0x1f')]=qs[_0x0786('0x1f')](_0x512769[_0x0786('0x31')][_0x0786('0x1f')]);_0x2265d7['offset']=qs['offset'](_0x512769[_0x0786('0x31')][_0x0786('0x1d')]);}_0x2265d7[_0x0786('0x38')]=qs['sort'](_0x512769['query']['sort']);_0x2265d7[_0x0786('0x39')]=qs[_0x0786('0x33')](_[_0x0786('0x3a')](_0x512769[_0x0786('0x31')],_0x57ad9b['filters']),_0xa8d972);if(_0x512769[_0x0786('0x31')]['filter']){_0x2265d7[_0x0786('0x39')]=_[_0x0786('0x3b')](_0x2265d7[_0x0786('0x39')],{'$or':_[_0x0786('0x2b')](_0xa8d972,function(_0x337624){if(_0x337624[_0x0786('0x2e')]!=='VIRTUAL'){var _0xf7b965={};_0xf7b965[_0x337624[_0x0786('0x28')]]={'$like':'%'+_0x512769[_0x0786('0x31')][_0x0786('0x3c')]+'%'};return _0xf7b965;}})});}_0x2265d7=_['merge']({},_0x2265d7,_0x512769[_0x0786('0x3d')]);var _0x156341={'where':_0x2265d7[_0x0786('0x39')]};return db[_0x0786('0x2c')][_0x0786('0x20')](_0x156341)['then'](function(_0x5a2688){_0x2a27f8[_0x0786('0x20')]=_0x5a2688;if(_0x512769['query']['includeAll']){_0x2265d7[_0x0786('0x3e')]=[{'all':!![]}];}return db[_0x0786('0x2c')][_0x0786('0x3f')](_0x2265d7);})['then'](function(_0x596a55){_0x2a27f8['rows']=_0x596a55;return _0x2a27f8;})[_0x0786('0x25')](respondWithFilteredResult(_0xda8821,_0x2265d7))[_0x0786('0x40')](handleError(_0xda8821,null));};exports['show']=function(_0x55f4fc,_0x52f353){var _0x1e4521={'raw':![],'where':{'id':_0x55f4fc[_0x0786('0x41')]['id']}},_0x53f67f={};_0x53f67f[_0x0786('0x30')]=_[_0x0786('0x32')](db['VtigerConfiguration'][_0x0786('0x42')]);_0x53f67f[_0x0786('0x31')]=_['keys'](_0x55f4fc['query']);_0x53f67f['filters']=_[_0x0786('0x34')](_0x53f67f[_0x0786('0x30')],_0x53f67f[_0x0786('0x31')]);_0x1e4521[_0x0786('0x35')]=_['intersection'](_0x53f67f[_0x0786('0x30')],qs[_0x0786('0x36')](_0x55f4fc[_0x0786('0x31')][_0x0786('0x36')]));_0x1e4521[_0x0786('0x35')]=_0x1e4521['attributes'][_0x0786('0x37')]?_0x1e4521[_0x0786('0x35')]:_0x53f67f[_0x0786('0x30')];if(_0x55f4fc[_0x0786('0x31')]['includeAll']){_0x1e4521['include']=[{'all':!![]}];}_0x1e4521=_['merge']({},_0x1e4521,_0x55f4fc[_0x0786('0x3d')]);return db[_0x0786('0x2c')][_0x0786('0x43')](_0x1e4521)[_0x0786('0x25')](handleEntityNotFound(_0x52f353,null))['then'](respondWithResult(_0x52f353,null))[_0x0786('0x40')](handleError(_0x52f353,null));};exports[_0x0786('0x44')]=function(_0xcee974,_0xf00d97){return db[_0x0786('0x2c')][_0x0786('0x44')](_0xcee974[_0x0786('0x45')],{})[_0x0786('0x25')](respondWithResult(_0xf00d97,0xc9))[_0x0786('0x40')](handleError(_0xf00d97,null));};exports[_0x0786('0x24')]=function(_0x14da90,_0x8e0335){if(_0x14da90[_0x0786('0x45')]['id']){delete _0x14da90[_0x0786('0x45')]['id'];}return db['VtigerConfiguration'][_0x0786('0x43')]({'where':{'id':_0x14da90['params']['id']}})[_0x0786('0x25')](handleEntityNotFound(_0x8e0335,null))['then'](saveUpdates(_0x14da90[_0x0786('0x45')],null))[_0x0786('0x25')](respondWithResult(_0x8e0335,null))['catch'](handleError(_0x8e0335,null));};exports[_0x0786('0x46')]=function(_0x12fc17,_0x13ed42){return db[_0x0786('0x2c')][_0x0786('0x43')]({'where':{'id':_0x12fc17['params']['id']}})[_0x0786('0x25')](handleEntityNotFound(_0x13ed42,null))[_0x0786('0x25')](removeEntity(_0x13ed42,null))[_0x0786('0x40')](handleError(_0x13ed42,null));};exports[_0x0786('0x47')]=function(_0x3f9fa4,_0x4c575a,_0x48633d){var _0x299f91={};var _0x524c05={};var _0x15644f;var _0x3305f2;return db[_0x0786('0x2c')][_0x0786('0x48')]({'where':{'id':_0x3f9fa4['params']['id']}})[_0x0786('0x25')](handleEntityNotFound(_0x4c575a,null))[_0x0786('0x25')](function(_0xc233e0){if(_0xc233e0){_0x15644f=_0xc233e0;_0x524c05[_0x0786('0x30')]=_['keys'](db[_0x0786('0x49')][_0x0786('0x42')]);_0x524c05[_0x0786('0x31')]=_[_0x0786('0x32')](_0x3f9fa4['query']);_0x524c05[_0x0786('0x33')]=_[_0x0786('0x34')](_0x524c05[_0x0786('0x30')],_0x524c05[_0x0786('0x31')]);_0x299f91[_0x0786('0x35')]=_['intersection'](_0x524c05[_0x0786('0x30')],qs['fields'](_0x3f9fa4[_0x0786('0x31')][_0x0786('0x36')]));_0x299f91['attributes']=_0x299f91['attributes'][_0x0786('0x37')]?_0x299f91['attributes']:_0x524c05[_0x0786('0x30')];_0x299f91['order']=qs['sort'](_0x3f9fa4['query'][_0x0786('0x4a')]);_0x299f91[_0x0786('0x39')]=qs[_0x0786('0x33')](_[_0x0786('0x3a')](_0x3f9fa4[_0x0786('0x31')],_0x524c05[_0x0786('0x33')]));if(_0x3f9fa4[_0x0786('0x31')]['filter']){_0x299f91[_0x0786('0x39')]=_['merge'](_0x299f91['where'],{'$or':_[_0x0786('0x2b')](_0x299f91[_0x0786('0x35')],function(_0x1af1ae){var _0x3285f0={};_0x3285f0[_0x1af1ae]={'$like':'%'+_0x3f9fa4['query'][_0x0786('0x3c')]+'%'};return _0x3285f0;})});}_0x299f91=_[_0x0786('0x3b')]({},_0x299f91,_0x3f9fa4[_0x0786('0x3d')]);return _0x15644f[_0x0786('0x47')](_0x299f91);}})[_0x0786('0x25')](function(_0x1923b2){if(_0x1923b2){_0x3305f2=_0x1923b2['length'];if(!_0x3f9fa4[_0x0786('0x31')][_0x0786('0x4b')](_0x0786('0x4c'))){_0x299f91[_0x0786('0x1f')]=qs[_0x0786('0x1f')](_0x3f9fa4[_0x0786('0x31')]['limit']);_0x299f91['offset']=qs[_0x0786('0x1d')](_0x3f9fa4['query'][_0x0786('0x1d')]);}return _0x15644f[_0x0786('0x47')](_0x299f91);}})[_0x0786('0x25')](function(_0x2ff550){if(_0x2ff550){return _0x2ff550?{'count':_0x3305f2,'rows':_0x2ff550}:null;}})[_0x0786('0x25')](respondWithResult(_0x4c575a,null))[_0x0786('0x40')](handleError(_0x4c575a,null));};exports[_0x0786('0x4d')]=function(_0x102498,_0x2a4eb4,_0x26556){var _0x9636d={};var _0x32d6bf={};var _0x18a3c3;var _0x9bcc93;return db[_0x0786('0x2c')][_0x0786('0x48')]({'where':{'id':_0x102498['params']['id']}})['then'](handleEntityNotFound(_0x2a4eb4,null))[_0x0786('0x25')](function(_0x224f11){if(_0x224f11){_0x18a3c3=_0x224f11;_0x32d6bf['model']=_[_0x0786('0x32')](db[_0x0786('0x49')]['rawAttributes']);_0x32d6bf[_0x0786('0x31')]=_[_0x0786('0x32')](_0x102498[_0x0786('0x31')]);_0x32d6bf[_0x0786('0x33')]=_[_0x0786('0x34')](_0x32d6bf[_0x0786('0x30')],_0x32d6bf[_0x0786('0x31')]);_0x9636d[_0x0786('0x35')]=_['intersection'](_0x32d6bf[_0x0786('0x30')],qs[_0x0786('0x36')](_0x102498[_0x0786('0x31')][_0x0786('0x36')]));_0x9636d[_0x0786('0x35')]=_0x9636d['attributes'][_0x0786('0x37')]?_0x9636d['attributes']:_0x32d6bf[_0x0786('0x30')];_0x9636d[_0x0786('0x38')]=qs[_0x0786('0x4a')](_0x102498['query'][_0x0786('0x4a')]);_0x9636d[_0x0786('0x39')]=qs[_0x0786('0x33')](_[_0x0786('0x3a')](_0x102498[_0x0786('0x31')],_0x32d6bf[_0x0786('0x33')]));if(_0x102498[_0x0786('0x31')][_0x0786('0x3c')]){_0x9636d[_0x0786('0x39')]=_[_0x0786('0x3b')](_0x9636d[_0x0786('0x39')],{'$or':_[_0x0786('0x2b')](_0x9636d[_0x0786('0x35')],function(_0x25b331){var _0x18df33={};_0x18df33[_0x25b331]={'$like':'%'+_0x102498[_0x0786('0x31')][_0x0786('0x3c')]+'%'};return _0x18df33;})});}_0x9636d=_[_0x0786('0x3b')]({},_0x9636d,_0x102498[_0x0786('0x3d')]);return _0x18a3c3[_0x0786('0x4d')](_0x9636d);}})['then'](function(_0x533750){if(_0x533750){_0x9bcc93=_0x533750[_0x0786('0x37')];if(!_0x102498[_0x0786('0x31')][_0x0786('0x4b')](_0x0786('0x4c'))){_0x9636d[_0x0786('0x1f')]=qs[_0x0786('0x1f')](_0x102498['query'][_0x0786('0x1f')]);_0x9636d[_0x0786('0x1d')]=qs[_0x0786('0x1d')](_0x102498[_0x0786('0x31')][_0x0786('0x1d')]);}return _0x18a3c3[_0x0786('0x4d')](_0x9636d);}})['then'](function(_0x1a1f98){if(_0x1a1f98){return _0x1a1f98?{'count':_0x9bcc93,'rows':_0x1a1f98}:null;}})[_0x0786('0x25')](respondWithResult(_0x2a4eb4,null))[_0x0786('0x40')](handleError(_0x2a4eb4,null));};exports[_0x0786('0x4e')]=function(_0x3dc20e,_0x352618,_0xaf4a9c){var _0x35e27a={};var _0x3e8aaf={};var _0x13b36c;var _0x4ec343;return db[_0x0786('0x2c')]['findOne']({'where':{'id':_0x3dc20e['params']['id']}})[_0x0786('0x25')](handleEntityNotFound(_0x352618,null))['then'](function(_0x57b31d){if(_0x57b31d){_0x13b36c=_0x57b31d;_0x3e8aaf['model']=_[_0x0786('0x32')](db['VtigerField']['rawAttributes']);_0x3e8aaf[_0x0786('0x31')]=_[_0x0786('0x32')](_0x3dc20e['query']);_0x3e8aaf[_0x0786('0x33')]=_[_0x0786('0x34')](_0x3e8aaf[_0x0786('0x30')],_0x3e8aaf[_0x0786('0x31')]);_0x35e27a['attributes']=_[_0x0786('0x34')](_0x3e8aaf[_0x0786('0x30')],qs[_0x0786('0x36')](_0x3dc20e['query'][_0x0786('0x36')]));_0x35e27a[_0x0786('0x35')]=_0x35e27a[_0x0786('0x35')][_0x0786('0x37')]?_0x35e27a[_0x0786('0x35')]:_0x3e8aaf[_0x0786('0x30')];_0x35e27a[_0x0786('0x38')]=qs[_0x0786('0x4a')](_0x3dc20e['query']['sort']);_0x35e27a[_0x0786('0x39')]=qs[_0x0786('0x33')](_[_0x0786('0x3a')](_0x3dc20e[_0x0786('0x31')],_0x3e8aaf[_0x0786('0x33')]));if(_0x3dc20e['query'][_0x0786('0x3c')]){_0x35e27a['where']=_[_0x0786('0x3b')](_0x35e27a['where'],{'$or':_[_0x0786('0x2b')](_0x35e27a['attributes'],function(_0x4e03d3){var _0x359700={};_0x359700[_0x4e03d3]={'$like':'%'+_0x3dc20e[_0x0786('0x31')][_0x0786('0x3c')]+'%'};return _0x359700;})});}_0x35e27a=_[_0x0786('0x3b')]({},_0x35e27a,_0x3dc20e[_0x0786('0x3d')]);return _0x13b36c['getDescriptions'](_0x35e27a);}})[_0x0786('0x25')](function(_0xa0b0ed){if(_0xa0b0ed){_0x4ec343=_0xa0b0ed['length'];if(!_0x3dc20e['query'][_0x0786('0x4b')]('nolimit')){_0x35e27a[_0x0786('0x1f')]=qs['limit'](_0x3dc20e['query'][_0x0786('0x1f')]);_0x35e27a[_0x0786('0x1d')]=qs[_0x0786('0x1d')](_0x3dc20e[_0x0786('0x31')][_0x0786('0x1d')]);}return _0x13b36c[_0x0786('0x4e')](_0x35e27a);}})[_0x0786('0x25')](function(_0xbf556b){if(_0xbf556b){return _0xbf556b?{'count':_0x4ec343,'rows':_0xbf556b}:null;}})['then'](respondWithResult(_0x352618,null))[_0x0786('0x40')](handleError(_0x352618,null));}; \ No newline at end of file +var _0x980c=['includeAll','include','findAll','catch','show','params','find','create','body','findOne','order','pick','getFields','hasOwnProperty','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','then','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options'];(function(_0x4a9f7d,_0x57bd01){var _0x498060=function(_0x33f50e){while(--_0x33f50e){_0x4a9f7d['push'](_0x4a9f7d['shift']());}};_0x498060(++_0x57bd01);}(_0x980c,0x159));var _0xc980=function(_0x4bf871,_0x37d14c){_0x4bf871=_0x4bf871-0x0;var _0x5c71b0=_0x980c[_0x4bf871];return _0x5c71b0;};'use strict';var emlformat=require(_0xc980('0x0'));var rimraf=require(_0xc980('0x1'));var zipdir=require(_0xc980('0x2'));var jsonpatch=require(_0xc980('0x3'));var rp=require('request-promise');var moment=require(_0xc980('0x4'));var BPromise=require(_0xc980('0x5'));var Mustache=require(_0xc980('0x6'));var util=require(_0xc980('0x7'));var path=require(_0xc980('0x8'));var sox=require(_0xc980('0x9'));var csv=require(_0xc980('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc980('0xb'));var _=require(_0xc980('0xc'));var squel=require('squel');var crypto=require(_0xc980('0xd'));var jsforce=require(_0xc980('0xe'));var deskjs=require(_0xc980('0xf'));var toCsv=require(_0xc980('0xa'));var querystring=require(_0xc980('0x10'));var Papa=require(_0xc980('0x11'));var Redis=require(_0xc980('0x12'));var authService=require(_0xc980('0x13'));var qs=require(_0xc980('0x14'));var as=require(_0xc980('0x15'));var hardwareService=require(_0xc980('0x16'));var logger=require(_0xc980('0x17'))(_0xc980('0x18'));var utils=require(_0xc980('0x19'));var config=require(_0xc980('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc980('0x1b'))['db'];function respondWithStatusCode(_0x42dfb2,_0x76873b){_0x76873b=_0x76873b||0xcc;return function(_0x445ad2){if(_0x445ad2){return _0x42dfb2[_0xc980('0x1c')](_0x76873b);}return _0x42dfb2[_0xc980('0x1d')](_0x76873b)[_0xc980('0x1e')]();};}function respondWithResult(_0x751d21,_0x396d27){_0x396d27=_0x396d27||0xc8;return function(_0x506111){if(_0x506111){return _0x751d21[_0xc980('0x1d')](_0x396d27)[_0xc980('0x1f')](_0x506111);}};}function respondWithFilteredResult(_0x2057ee,_0x5f4884){return function(_0x44ca56){if(_0x44ca56){var _0x445fee=typeof _0x5f4884[_0xc980('0x20')]===_0xc980('0x21')&&typeof _0x5f4884[_0xc980('0x22')]==='undefined';var _0x2cbe47=_0x44ca56['count'];var _0x21ce29=_0x445fee?0x0:_0x5f4884[_0xc980('0x20')];var _0x1bdd10=_0x445fee?_0x44ca56[_0xc980('0x23')]:_0x5f4884[_0xc980('0x20')]+_0x5f4884[_0xc980('0x22')];var _0x2e5789;if(_0x1bdd10>=_0x2cbe47){_0x1bdd10=_0x2cbe47;_0x2e5789=0xc8;}else{_0x2e5789=0xce;}_0x2057ee['status'](_0x2e5789);return _0x2057ee['set']('Content-Range',_0x21ce29+'-'+_0x1bdd10+'/'+_0x2cbe47)['json'](_0x44ca56);}return null;};}function patchUpdates(_0x3d5fe1){return function(_0x2875dc){try{jsonpatch[_0xc980('0x24')](_0x2875dc,_0x3d5fe1,!![]);}catch(_0x46ab8d){return BPromise['reject'](_0x46ab8d);}return _0x2875dc[_0xc980('0x25')]();};}function saveUpdates(_0xf10065,_0x411d90){return function(_0x38b6d6){if(_0x38b6d6){return _0x38b6d6[_0xc980('0x26')](_0xf10065)['then'](function(_0x918dd1){return _0x918dd1;});}return null;};}function removeEntity(_0x3ae217,_0xc322a3){return function(_0x23b2c4){if(_0x23b2c4){return _0x23b2c4[_0xc980('0x27')]()[_0xc980('0x28')](function(){_0x3ae217['status'](0xcc)[_0xc980('0x1e')]();});}};}function handleEntityNotFound(_0x51db41,_0x41f4bf){return function(_0x4113ec){if(!_0x4113ec){_0x51db41['sendStatus'](0x194);}return _0x4113ec;};}function handleError(_0x578249,_0x358470){_0x358470=_0x358470||0x1f4;return function(_0x1b48d1){logger['error'](_0x1b48d1[_0xc980('0x29')]);if(_0x1b48d1[_0xc980('0x2a')]){delete _0x1b48d1[_0xc980('0x2a')];}_0x578249[_0xc980('0x1d')](_0x358470)[_0xc980('0x2b')](_0x1b48d1);};}exports['index']=function(_0x27c5e7,_0x55ec01){var _0x20a3af={},_0x46c7e8={},_0x464627={'count':0x0,'rows':[]};var _0x36fcd1=_[_0xc980('0x2c')](db[_0xc980('0x2d')][_0xc980('0x2e')],function(_0x1c59c9){return{'name':_0x1c59c9[_0xc980('0x2f')],'type':_0x1c59c9[_0xc980('0x30')][_0xc980('0x31')]};});_0x46c7e8['model']=_[_0xc980('0x2c')](_0x36fcd1,_0xc980('0x2a'));_0x46c7e8[_0xc980('0x32')]=_[_0xc980('0x33')](_0x27c5e7[_0xc980('0x32')]);_0x46c7e8[_0xc980('0x34')]=_[_0xc980('0x35')](_0x46c7e8[_0xc980('0x36')],_0x46c7e8[_0xc980('0x32')]);_0x20a3af[_0xc980('0x37')]=_[_0xc980('0x35')](_0x46c7e8['model'],qs[_0xc980('0x38')](_0x27c5e7[_0xc980('0x32')][_0xc980('0x38')]));_0x20a3af[_0xc980('0x37')]=_0x20a3af[_0xc980('0x37')][_0xc980('0x39')]?_0x20a3af[_0xc980('0x37')]:_0x46c7e8['model'];if(!_0x27c5e7[_0xc980('0x32')]['hasOwnProperty'](_0xc980('0x3a'))){_0x20a3af[_0xc980('0x22')]=qs[_0xc980('0x22')](_0x27c5e7['query'][_0xc980('0x22')]);_0x20a3af['offset']=qs[_0xc980('0x20')](_0x27c5e7[_0xc980('0x32')][_0xc980('0x20')]);}_0x20a3af['order']=qs[_0xc980('0x3b')](_0x27c5e7[_0xc980('0x32')][_0xc980('0x3b')]);_0x20a3af[_0xc980('0x3c')]=qs[_0xc980('0x34')](_['pick'](_0x27c5e7[_0xc980('0x32')],_0x46c7e8[_0xc980('0x34')]),_0x36fcd1);if(_0x27c5e7[_0xc980('0x32')][_0xc980('0x3d')]){_0x20a3af[_0xc980('0x3c')]=_[_0xc980('0x3e')](_0x20a3af['where'],{'$or':_['map'](_0x36fcd1,function(_0x1e782f){if(_0x1e782f[_0xc980('0x30')]!==_0xc980('0x3f')){var _0x283e5b={};_0x283e5b[_0x1e782f[_0xc980('0x2a')]]={'$like':'%'+_0x27c5e7[_0xc980('0x32')][_0xc980('0x3d')]+'%'};return _0x283e5b;}})});}_0x20a3af=_[_0xc980('0x3e')]({},_0x20a3af,_0x27c5e7[_0xc980('0x40')]);var _0x565be7={'where':_0x20a3af[_0xc980('0x3c')]};return db['VtigerConfiguration'][_0xc980('0x23')](_0x565be7)[_0xc980('0x28')](function(_0x52c5ff){_0x464627[_0xc980('0x23')]=_0x52c5ff;if(_0x27c5e7[_0xc980('0x32')][_0xc980('0x41')]){_0x20a3af[_0xc980('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xc980('0x43')](_0x20a3af);})['then'](function(_0x36d9c2){_0x464627['rows']=_0x36d9c2;return _0x464627;})['then'](respondWithFilteredResult(_0x55ec01,_0x20a3af))[_0xc980('0x44')](handleError(_0x55ec01,null));};exports[_0xc980('0x45')]=function(_0x2c4088,_0x1e315b){var _0x1a03ae={'raw':![],'where':{'id':_0x2c4088[_0xc980('0x46')]['id']}},_0x693915={};_0x693915['model']=_['keys'](db[_0xc980('0x2d')][_0xc980('0x2e')]);_0x693915[_0xc980('0x32')]=_[_0xc980('0x33')](_0x2c4088['query']);_0x693915[_0xc980('0x34')]=_[_0xc980('0x35')](_0x693915[_0xc980('0x36')],_0x693915[_0xc980('0x32')]);_0x1a03ae[_0xc980('0x37')]=_['intersection'](_0x693915[_0xc980('0x36')],qs['fields'](_0x2c4088[_0xc980('0x32')]['fields']));_0x1a03ae['attributes']=_0x1a03ae[_0xc980('0x37')]['length']?_0x1a03ae['attributes']:_0x693915[_0xc980('0x36')];if(_0x2c4088[_0xc980('0x32')]['includeAll']){_0x1a03ae['include']=[{'all':!![]}];}_0x1a03ae=_[_0xc980('0x3e')]({},_0x1a03ae,_0x2c4088[_0xc980('0x40')]);return db['VtigerConfiguration'][_0xc980('0x47')](_0x1a03ae)[_0xc980('0x28')](handleEntityNotFound(_0x1e315b,null))['then'](respondWithResult(_0x1e315b,null))[_0xc980('0x44')](handleError(_0x1e315b,null));};exports[_0xc980('0x48')]=function(_0x4aca55,_0x501042){return db[_0xc980('0x2d')]['create'](_0x4aca55[_0xc980('0x49')],{})[_0xc980('0x28')](respondWithResult(_0x501042,0xc9))[_0xc980('0x44')](handleError(_0x501042,null));};exports[_0xc980('0x26')]=function(_0x4a4851,_0x3640e4){if(_0x4a4851[_0xc980('0x49')]['id']){delete _0x4a4851[_0xc980('0x49')]['id'];}return db[_0xc980('0x2d')][_0xc980('0x47')]({'where':{'id':_0x4a4851['params']['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x3640e4,null))[_0xc980('0x28')](saveUpdates(_0x4a4851['body'],null))['then'](respondWithResult(_0x3640e4,null))[_0xc980('0x44')](handleError(_0x3640e4,null));};exports[_0xc980('0x27')]=function(_0x3e6ec1,_0x3eed23){return db[_0xc980('0x2d')][_0xc980('0x47')]({'where':{'id':_0x3e6ec1[_0xc980('0x46')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x3eed23,null))['then'](removeEntity(_0x3eed23,null))['catch'](handleError(_0x3eed23,null));};exports['getFields']=function(_0x336902,_0x11841d,_0x57444c){var _0x586a27={};var _0x3d9f19={};var _0x128521;var _0x1e5274;return db[_0xc980('0x2d')][_0xc980('0x4a')]({'where':{'id':_0x336902['params']['id']}})['then'](handleEntityNotFound(_0x11841d,null))[_0xc980('0x28')](function(_0xee71b5){if(_0xee71b5){_0x128521=_0xee71b5;_0x3d9f19[_0xc980('0x36')]=_[_0xc980('0x33')](db['VtigerField']['rawAttributes']);_0x3d9f19[_0xc980('0x32')]=_['keys'](_0x336902['query']);_0x3d9f19['filters']=_[_0xc980('0x35')](_0x3d9f19[_0xc980('0x36')],_0x3d9f19[_0xc980('0x32')]);_0x586a27['attributes']=_['intersection'](_0x3d9f19[_0xc980('0x36')],qs['fields'](_0x336902['query'][_0xc980('0x38')]));_0x586a27[_0xc980('0x37')]=_0x586a27[_0xc980('0x37')]['length']?_0x586a27[_0xc980('0x37')]:_0x3d9f19[_0xc980('0x36')];_0x586a27[_0xc980('0x4b')]=qs[_0xc980('0x3b')](_0x336902['query'][_0xc980('0x3b')]);_0x586a27[_0xc980('0x3c')]=qs[_0xc980('0x34')](_[_0xc980('0x4c')](_0x336902['query'],_0x3d9f19[_0xc980('0x34')]));if(_0x336902[_0xc980('0x32')][_0xc980('0x3d')]){_0x586a27['where']=_[_0xc980('0x3e')](_0x586a27['where'],{'$or':_[_0xc980('0x2c')](_0x586a27['attributes'],function(_0x340446){var _0x296a40={};_0x296a40[_0x340446]={'$like':'%'+_0x336902[_0xc980('0x32')][_0xc980('0x3d')]+'%'};return _0x296a40;})});}_0x586a27=_[_0xc980('0x3e')]({},_0x586a27,_0x336902[_0xc980('0x40')]);return _0x128521[_0xc980('0x4d')](_0x586a27);}})[_0xc980('0x28')](function(_0x112ef9){if(_0x112ef9){_0x1e5274=_0x112ef9[_0xc980('0x39')];if(!_0x336902['query'][_0xc980('0x4e')]('nolimit')){_0x586a27[_0xc980('0x22')]=qs[_0xc980('0x22')](_0x336902['query']['limit']);_0x586a27[_0xc980('0x20')]=qs[_0xc980('0x20')](_0x336902[_0xc980('0x32')][_0xc980('0x20')]);}return _0x128521['getFields'](_0x586a27);}})[_0xc980('0x28')](function(_0x2fa08b){if(_0x2fa08b){return _0x2fa08b?{'count':_0x1e5274,'rows':_0x2fa08b}:null;}})[_0xc980('0x28')](respondWithResult(_0x11841d,null))[_0xc980('0x44')](handleError(_0x11841d,null));};exports[_0xc980('0x4f')]=function(_0x252f5f,_0x12e3b4,_0x1b3089){var _0x140be9={};var _0x4a21a8={};var _0x58adb6;var _0x4cd350;return db[_0xc980('0x2d')][_0xc980('0x4a')]({'where':{'id':_0x252f5f[_0xc980('0x46')]['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x12e3b4,null))['then'](function(_0x197d26){if(_0x197d26){_0x58adb6=_0x197d26;_0x4a21a8[_0xc980('0x36')]=_[_0xc980('0x33')](db[_0xc980('0x50')][_0xc980('0x2e')]);_0x4a21a8['query']=_['keys'](_0x252f5f[_0xc980('0x32')]);_0x4a21a8[_0xc980('0x34')]=_['intersection'](_0x4a21a8[_0xc980('0x36')],_0x4a21a8['query']);_0x140be9[_0xc980('0x37')]=_['intersection'](_0x4a21a8[_0xc980('0x36')],qs[_0xc980('0x38')](_0x252f5f[_0xc980('0x32')][_0xc980('0x38')]));_0x140be9[_0xc980('0x37')]=_0x140be9[_0xc980('0x37')][_0xc980('0x39')]?_0x140be9[_0xc980('0x37')]:_0x4a21a8['model'];_0x140be9['order']=qs[_0xc980('0x3b')](_0x252f5f['query'][_0xc980('0x3b')]);_0x140be9['where']=qs[_0xc980('0x34')](_[_0xc980('0x4c')](_0x252f5f[_0xc980('0x32')],_0x4a21a8[_0xc980('0x34')]));if(_0x252f5f[_0xc980('0x32')][_0xc980('0x3d')]){_0x140be9['where']=_['merge'](_0x140be9[_0xc980('0x3c')],{'$or':_[_0xc980('0x2c')](_0x140be9[_0xc980('0x37')],function(_0x2172e5){var _0x28d82a={};_0x28d82a[_0x2172e5]={'$like':'%'+_0x252f5f[_0xc980('0x32')][_0xc980('0x3d')]+'%'};return _0x28d82a;})});}_0x140be9=_[_0xc980('0x3e')]({},_0x140be9,_0x252f5f[_0xc980('0x40')]);return _0x58adb6[_0xc980('0x4f')](_0x140be9);}})[_0xc980('0x28')](function(_0x2c63a1){if(_0x2c63a1){_0x4cd350=_0x2c63a1[_0xc980('0x39')];if(!_0x252f5f['query']['hasOwnProperty'](_0xc980('0x3a'))){_0x140be9[_0xc980('0x22')]=qs['limit'](_0x252f5f[_0xc980('0x32')][_0xc980('0x22')]);_0x140be9[_0xc980('0x20')]=qs[_0xc980('0x20')](_0x252f5f['query'][_0xc980('0x20')]);}return _0x58adb6[_0xc980('0x4f')](_0x140be9);}})[_0xc980('0x28')](function(_0x1f1a74){if(_0x1f1a74){return _0x1f1a74?{'count':_0x4cd350,'rows':_0x1f1a74}:null;}})['then'](respondWithResult(_0x12e3b4,null))[_0xc980('0x44')](handleError(_0x12e3b4,null));};exports[_0xc980('0x51')]=function(_0x200521,_0x47fa11,_0x324d3f){var _0x5b9fb0={};var _0x3c957c={};var _0x4ffe43;var _0x572b50;return db[_0xc980('0x2d')][_0xc980('0x4a')]({'where':{'id':_0x200521['params']['id']}})[_0xc980('0x28')](handleEntityNotFound(_0x47fa11,null))[_0xc980('0x28')](function(_0x4d2e4b){if(_0x4d2e4b){_0x4ffe43=_0x4d2e4b;_0x3c957c[_0xc980('0x36')]=_[_0xc980('0x33')](db['VtigerField'][_0xc980('0x2e')]);_0x3c957c['query']=_[_0xc980('0x33')](_0x200521['query']);_0x3c957c[_0xc980('0x34')]=_[_0xc980('0x35')](_0x3c957c[_0xc980('0x36')],_0x3c957c[_0xc980('0x32')]);_0x5b9fb0['attributes']=_[_0xc980('0x35')](_0x3c957c[_0xc980('0x36')],qs[_0xc980('0x38')](_0x200521['query'][_0xc980('0x38')]));_0x5b9fb0[_0xc980('0x37')]=_0x5b9fb0['attributes'][_0xc980('0x39')]?_0x5b9fb0['attributes']:_0x3c957c[_0xc980('0x36')];_0x5b9fb0[_0xc980('0x4b')]=qs[_0xc980('0x3b')](_0x200521[_0xc980('0x32')][_0xc980('0x3b')]);_0x5b9fb0[_0xc980('0x3c')]=qs[_0xc980('0x34')](_['pick'](_0x200521[_0xc980('0x32')],_0x3c957c[_0xc980('0x34')]));if(_0x200521[_0xc980('0x32')][_0xc980('0x3d')]){_0x5b9fb0[_0xc980('0x3c')]=_[_0xc980('0x3e')](_0x5b9fb0['where'],{'$or':_[_0xc980('0x2c')](_0x5b9fb0[_0xc980('0x37')],function(_0x2556dd){var _0x338989={};_0x338989[_0x2556dd]={'$like':'%'+_0x200521['query'][_0xc980('0x3d')]+'%'};return _0x338989;})});}_0x5b9fb0=_[_0xc980('0x3e')]({},_0x5b9fb0,_0x200521[_0xc980('0x40')]);return _0x4ffe43[_0xc980('0x51')](_0x5b9fb0);}})[_0xc980('0x28')](function(_0xbd5154){if(_0xbd5154){_0x572b50=_0xbd5154[_0xc980('0x39')];if(!_0x200521[_0xc980('0x32')]['hasOwnProperty']('nolimit')){_0x5b9fb0[_0xc980('0x22')]=qs[_0xc980('0x22')](_0x200521[_0xc980('0x32')]['limit']);_0x5b9fb0[_0xc980('0x20')]=qs['offset'](_0x200521[_0xc980('0x32')]['offset']);}return _0x4ffe43[_0xc980('0x51')](_0x5b9fb0);}})[_0xc980('0x28')](function(_0xffd0b4){if(_0xffd0b4){return _0xffd0b4?{'count':_0x572b50,'rows':_0xffd0b4}:null;}})[_0xc980('0x28')](respondWithResult(_0x47fa11,null))[_0xc980('0x44')](handleError(_0x47fa11,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e1de010..65eb95f 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 _0x689f=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','exports','define'];(function(_0x37dfad,_0x31a838){var _0x539cf7=function(_0x145df4){while(--_0x145df4){_0x37dfad['push'](_0x37dfad['shift']());}};_0x539cf7(++_0x31a838);}(_0x689f,0xaa));var _0xf689=function(_0x912882,_0x4b5956){_0x912882=_0x912882-0x0;var _0xadb160=_0x689f[_0x912882];return _0xadb160;};'use strict';var _=require(_0xf689('0x0'));var util=require(_0xf689('0x1'));var logger=require('../../config/logger')(_0xf689('0x2'));var moment=require(_0xf689('0x3'));var BPromise=require(_0xf689('0x4'));var rp=require(_0xf689('0x5'));var fs=require('fs');var path=require(_0xf689('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf689('0x7'));module[_0xf689('0x8')]=function(_0x4fbd9d,_0x29cfe0){return _0x4fbd9d[_0xf689('0x9')](_0xf689('0xa'),attributes,{'tableName':_0xf689('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa70b=['moment','bluebird','request-promise','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','lodash','util'];(function(_0x1fcfee,_0x250076){var _0x3f6089=function(_0x511840){while(--_0x511840){_0x1fcfee['push'](_0x1fcfee['shift']());}};_0x3f6089(++_0x250076);}(_0xa70b,0x1e6));var _0xba70=function(_0x15fce8,_0x7612b7){_0x15fce8=_0x15fce8-0x0;var _0x3f54aa=_0xa70b[_0x15fce8];return _0x3f54aa;};'use strict';var _=require(_0xba70('0x0'));var util=require(_0xba70('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xba70('0x2'));var BPromise=require(_0xba70('0x3'));var rp=require(_0xba70('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba70('0x5'));var attributes=require(_0xba70('0x6'));module['exports']=function(_0x16b35c,_0x72a399){return _0x16b35c['define'](_0xba70('0x7'),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 505829d..59ba394 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 _0x2596=['../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x2596,0x77));var _0x6259=function(_0x24aa04,_0x316510){_0x24aa04=_0x24aa04-0x0;var _0xc85adf=_0x2596[_0x24aa04];return _0xc85adf;};'use strict';var _=require(_0x6259('0x0'));var util=require(_0x6259('0x1'));var moment=require(_0x6259('0x2'));var BPromise=require('bluebird');var rs=require(_0x6259('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6259('0x4'))['db'];var utils=require(_0x6259('0x5'));var logger=require(_0x6259('0x6'))('rpc');var config=require(_0x6259('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6259('0x8')][_0x6259('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cc8c,_0x51b416,_0x4596ac){return new BPromise(function(_0x1ba249,_0x23e97f){return client[_0x6259('0xa')](_0x55cc8c,_0x4596ac)[_0x6259('0xb')](function(_0x24b8fa){logger[_0x6259('0xc')](_0x6259('0xd'),_0x51b416,_0x6259('0xe'));logger['debug'](_0x6259('0xf'),_0x51b416,_0x6259('0xe'),JSON[_0x6259('0x10')](_0x24b8fa));if(_0x24b8fa[_0x6259('0x11')]){if(_0x24b8fa[_0x6259('0x11')][_0x6259('0x12')]===0x1f4){logger['error'](_0x6259('0xd'),_0x51b416,_0x24b8fa['error'][_0x6259('0x13')]);return _0x23e97f(_0x24b8fa[_0x6259('0x11')]['message']);}logger['error'](_0x6259('0xd'),_0x51b416,_0x24b8fa[_0x6259('0x11')][_0x6259('0x13')]);return _0x1ba249(_0x24b8fa[_0x6259('0x11')][_0x6259('0x13')]);}else{logger[_0x6259('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x51b416,'request\x20sent');_0x1ba249(_0x24b8fa[_0x6259('0x14')][_0x6259('0x13')]);}})['catch'](function(_0x574c15){logger[_0x6259('0x11')](_0x6259('0xd'),_0x51b416,_0x574c15);_0x23e97f(_0x574c15);});});} \ No newline at end of file +var _0x85de=['client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x107f40,_0x3d9673){var _0x4cff12=function(_0x4a00c5){while(--_0x4a00c5){_0x107f40['push'](_0x107f40['shift']());}};_0x4cff12(++_0x3d9673);}(_0x85de,0x14d));var _0xe85d=function(_0x3682ce,_0x30d314){_0x3682ce=_0x3682ce-0x0;var _0x510872=_0x85de[_0x3682ce];return _0x510872;};'use strict';var _=require('lodash');var util=require(_0xe85d('0x0'));var moment=require(_0xe85d('0x1'));var BPromise=require(_0xe85d('0x2'));var rs=require(_0xe85d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe85d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe85d('0x5'))(_0xe85d('0x6'));var config=require(_0xe85d('0x7'));var jayson=require(_0xe85d('0x8'));var client=jayson[_0xe85d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2253fd,_0x3e644e,_0x32cf0d){return new BPromise(function(_0x20a6a0,_0x2797fd){return client[_0xe85d('0xa')](_0x2253fd,_0x32cf0d)['then'](function(_0x186997){logger[_0xe85d('0xb')](_0xe85d('0xc'),_0x3e644e,_0xe85d('0xd'));logger['debug'](_0xe85d('0xe'),_0x3e644e,_0xe85d('0xd'),JSON[_0xe85d('0xf')](_0x186997));if(_0x186997[_0xe85d('0x10')]){if(_0x186997['error']['code']===0x1f4){logger[_0xe85d('0x10')](_0xe85d('0xc'),_0x3e644e,_0x186997['error'][_0xe85d('0x11')]);return _0x2797fd(_0x186997[_0xe85d('0x10')][_0xe85d('0x11')]);}logger[_0xe85d('0x10')](_0xe85d('0xc'),_0x3e644e,_0x186997[_0xe85d('0x10')][_0xe85d('0x11')]);return _0x20a6a0(_0x186997[_0xe85d('0x10')][_0xe85d('0x11')]);}else{logger[_0xe85d('0xb')](_0xe85d('0xc'),_0x3e644e,_0xe85d('0xd'));_0x20a6a0(_0x186997[_0xe85d('0x12')][_0xe85d('0x11')]);}})['catch'](function(_0x14f26d){logger[_0xe85d('0x10')](_0xe85d('0xc'),_0x3e644e,_0x14f26d);_0x2797fd(_0x14f26d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0c4fa80..0886ccd 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 _0x8a53=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x538b35,_0x1d6908){var _0xd7349f=function(_0xe3b758){while(--_0xe3b758){_0x538b35['push'](_0x538b35['shift']());}};_0xd7349f(++_0x1d6908);}(_0x8a53,0x16b));var _0x38a5=function(_0x568a33,_0x360ec1){_0x568a33=_0x568a33-0x0;var _0x22ac95=_0x8a53[_0x568a33];return _0x22ac95;};'use strict';var multer=require('multer');var util=require(_0x38a5('0x0'));var path=require(_0x38a5('0x1'));var timeout=require(_0x38a5('0x2'));var express=require('express');var router=express[_0x38a5('0x3')]();var fs_extra=require(_0x38a5('0x4'));var auth=require(_0x38a5('0x5'));var interaction=require(_0x38a5('0x6'));var config=require('../../config/environment');var controller=require(_0x38a5('0x7'));router[_0x38a5('0x8')]('/',auth[_0x38a5('0x9')](),controller[_0x38a5('0xa')]);router[_0x38a5('0x8')](_0x38a5('0xb'),auth['isAuthenticated'](),controller[_0x38a5('0xc')]);router['post']('/',auth[_0x38a5('0x9')](),controller[_0x38a5('0xd')]);router[_0x38a5('0xe')]('/:id',auth[_0x38a5('0x9')](),controller[_0x38a5('0xf')]);router[_0x38a5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x38a5('0x11')]);module[_0x38a5('0x12')]=router; \ No newline at end of file +var _0x91f2=['create','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91f2,0x190));var _0x291f=function(_0x2311e9,_0x43ec5e){_0x2311e9=_0x2311e9-0x0;var _0x3c8bf9=_0x91f2[_0x2311e9];return _0x3c8bf9;};'use strict';var multer=require('multer');var util=require(_0x291f('0x0'));var path=require(_0x291f('0x1'));var timeout=require(_0x291f('0x2'));var express=require('express');var router=express[_0x291f('0x3')]();var fs_extra=require(_0x291f('0x4'));var auth=require(_0x291f('0x5'));var interaction=require(_0x291f('0x6'));var config=require(_0x291f('0x7'));var controller=require(_0x291f('0x8'));router[_0x291f('0x9')]('/',auth[_0x291f('0xa')](),controller[_0x291f('0xb')]);router[_0x291f('0x9')](_0x291f('0xc'),auth[_0x291f('0xa')](),controller[_0x291f('0xd')]);router['post']('/',auth[_0x291f('0xa')](),controller[_0x291f('0xe')]);router[_0x291f('0xf')](_0x291f('0xc'),auth[_0x291f('0xa')](),controller[_0x291f('0x10')]);router['delete']('/:id',auth[_0x291f('0xa')](),controller[_0x291f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a0088f5..2d7ba69 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 _0x54f3=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5cebc3,_0x3f0d41){var _0x595fa5=function(_0x455faa){while(--_0x455faa){_0x5cebc3['push'](_0x5cebc3['shift']());}};_0x595fa5(++_0x3f0d41);}(_0x54f3,0xfe));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x354f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x354f('0x1'),_0x354f('0x2'),_0x354f('0x3'),_0x354f('0x4'),_0x354f('0x5')),'defaultValue':_0x354f('0x1')},'content':{'type':Sequelize[_0x354f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x354f('0x7')](_0x354f('0x1'),_0x354f('0x2'),_0x354f('0x3'))},'keyContent':{'type':Sequelize[_0x354f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x354f('0x6')]},'customField':{'type':Sequelize[_0x354f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0598=['sequelize','ENUM','variable','keyValue','picklist','string','customVariable','STRING','BOOLEAN'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x0598,0xe1));var _0x8059=function(_0x2c2751,_0x28057e){_0x2c2751=_0x2c2751-0x0;var _0x454c64=_0x0598[_0x2c2751];return _0x454c64;};'use strict';var Sequelize=require(_0x8059('0x0'));module['exports']={'type':{'type':Sequelize[_0x8059('0x1')]('string',_0x8059('0x2'),'customVariable',_0x8059('0x3'),_0x8059('0x4')),'defaultValue':_0x8059('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8059('0x1')]('string',_0x8059('0x2'),_0x8059('0x6'))},'keyContent':{'type':Sequelize[_0x8059('0x7')]},'idField':{'type':Sequelize[_0x8059('0x7')]},'nameField':{'type':Sequelize[_0x8059('0x7')]},'customField':{'type':Sequelize[_0x8059('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8059('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 71bc533..24d9174 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 _0x0b0f=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters'];(function(_0x297ee2,_0x335aa3){var _0x472b3c=function(_0x2517d1){while(--_0x2517d1){_0x297ee2['push'](_0x297ee2['shift']());}};_0x472b3c(++_0x335aa3);}(_0x0b0f,0xad));var _0xf0b0=function(_0x143231,_0x1881a4){_0x143231=_0x143231-0x0;var _0x49d803=_0x0b0f[_0x143231];return _0x49d803;};'use strict';var emlformat=require(_0xf0b0('0x0'));var rimraf=require(_0xf0b0('0x1'));var zipdir=require(_0xf0b0('0x2'));var jsonpatch=require(_0xf0b0('0x3'));var rp=require(_0xf0b0('0x4'));var moment=require(_0xf0b0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf0b0('0x6'));var util=require(_0xf0b0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf0b0('0x8'));var ejs=require(_0xf0b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0b0('0xa'));var squel=require(_0xf0b0('0xb'));var crypto=require(_0xf0b0('0xc'));var jsforce=require(_0xf0b0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf0b0('0x8'));var querystring=require(_0xf0b0('0xe'));var Papa=require(_0xf0b0('0xf'));var Redis=require(_0xf0b0('0x10'));var authService=require(_0xf0b0('0x11'));var qs=require(_0xf0b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0b0('0x13'));var logger=require(_0xf0b0('0x14'))('api');var utils=require(_0xf0b0('0x15'));var config=require(_0xf0b0('0x16'));var licenseUtil=require(_0xf0b0('0x17'));var db=require(_0xf0b0('0x18'))['db'];function respondWithStatusCode(_0xb49ed1,_0x13dde2){_0x13dde2=_0x13dde2||0xcc;return function(_0x18f6fb){if(_0x18f6fb){return _0xb49ed1['sendStatus'](_0x13dde2);}return _0xb49ed1['status'](_0x13dde2)[_0xf0b0('0x19')]();};}function respondWithResult(_0x42a71b,_0x14e6a3){_0x14e6a3=_0x14e6a3||0xc8;return function(_0x380148){if(_0x380148){return _0x42a71b[_0xf0b0('0x1a')](_0x14e6a3)[_0xf0b0('0x1b')](_0x380148);}};}function respondWithFilteredResult(_0x37d04d,_0x3750e3){return function(_0xa9b814){if(_0xa9b814){var _0x4eb78a=typeof _0x3750e3[_0xf0b0('0x1c')]===_0xf0b0('0x1d')&&typeof _0x3750e3[_0xf0b0('0x1e')]===_0xf0b0('0x1d');var _0x51eeb7=_0xa9b814[_0xf0b0('0x1f')];var _0x511c38=_0x4eb78a?0x0:_0x3750e3['offset'];var _0x295d21=_0x4eb78a?_0xa9b814[_0xf0b0('0x1f')]:_0x3750e3[_0xf0b0('0x1c')]+_0x3750e3[_0xf0b0('0x1e')];var _0x506862;if(_0x295d21>=_0x51eeb7){_0x295d21=_0x51eeb7;_0x506862=0xc8;}else{_0x506862=0xce;}_0x37d04d[_0xf0b0('0x1a')](_0x506862);return _0x37d04d[_0xf0b0('0x20')](_0xf0b0('0x21'),_0x511c38+'-'+_0x295d21+'/'+_0x51eeb7)['json'](_0xa9b814);}return null;};}function patchUpdates(_0xb03daf){return function(_0x5d27f2){try{jsonpatch[_0xf0b0('0x22')](_0x5d27f2,_0xb03daf,!![]);}catch(_0x519bea){return BPromise['reject'](_0x519bea);}return _0x5d27f2[_0xf0b0('0x23')]();};}function saveUpdates(_0x43eaaf,_0x29003c){return function(_0x308194){if(_0x308194){return _0x308194[_0xf0b0('0x24')](_0x43eaaf)[_0xf0b0('0x25')](function(_0x62963f){return _0x62963f;});}return null;};}function removeEntity(_0x14c6f3,_0x461ef6){return function(_0x352eaf){if(_0x352eaf){return _0x352eaf[_0xf0b0('0x26')]()['then'](function(){_0x14c6f3[_0xf0b0('0x1a')](0xcc)[_0xf0b0('0x19')]();});}};}function handleEntityNotFound(_0x26b8cd,_0x43ee55){return function(_0x2da294){if(!_0x2da294){_0x26b8cd[_0xf0b0('0x27')](0x194);}return _0x2da294;};}function handleError(_0x1f474e,_0x35dcda){_0x35dcda=_0x35dcda||0x1f4;return function(_0x564038){logger['error'](_0x564038[_0xf0b0('0x28')]);if(_0x564038[_0xf0b0('0x29')]){delete _0x564038[_0xf0b0('0x29')];}_0x1f474e['status'](_0x35dcda)[_0xf0b0('0x2a')](_0x564038);};}exports[_0xf0b0('0x2b')]=function(_0x5b1579,_0x37dbb1){var _0x2acd66={},_0x1d1d15={},_0x525463={'count':0x0,'rows':[]};var _0x57a28f=_[_0xf0b0('0x2c')](db[_0xf0b0('0x2d')][_0xf0b0('0x2e')],function(_0x1a5c0e){return{'name':_0x1a5c0e[_0xf0b0('0x2f')],'type':_0x1a5c0e['type'][_0xf0b0('0x30')]};});_0x1d1d15[_0xf0b0('0x31')]=_[_0xf0b0('0x2c')](_0x57a28f,'name');_0x1d1d15[_0xf0b0('0x32')]=_['keys'](_0x5b1579[_0xf0b0('0x32')]);_0x1d1d15[_0xf0b0('0x33')]=_[_0xf0b0('0x34')](_0x1d1d15[_0xf0b0('0x31')],_0x1d1d15[_0xf0b0('0x32')]);_0x2acd66[_0xf0b0('0x35')]=_[_0xf0b0('0x34')](_0x1d1d15[_0xf0b0('0x31')],qs[_0xf0b0('0x36')](_0x5b1579[_0xf0b0('0x32')][_0xf0b0('0x36')]));_0x2acd66[_0xf0b0('0x35')]=_0x2acd66[_0xf0b0('0x35')][_0xf0b0('0x37')]?_0x2acd66[_0xf0b0('0x35')]:_0x1d1d15['model'];if(!_0x5b1579['query'][_0xf0b0('0x38')](_0xf0b0('0x39'))){_0x2acd66[_0xf0b0('0x1e')]=qs['limit'](_0x5b1579['query']['limit']);_0x2acd66[_0xf0b0('0x1c')]=qs[_0xf0b0('0x1c')](_0x5b1579[_0xf0b0('0x32')][_0xf0b0('0x1c')]);}_0x2acd66[_0xf0b0('0x3a')]=qs[_0xf0b0('0x3b')](_0x5b1579[_0xf0b0('0x32')][_0xf0b0('0x3b')]);_0x2acd66[_0xf0b0('0x3c')]=qs[_0xf0b0('0x33')](_['pick'](_0x5b1579['query'],_0x1d1d15[_0xf0b0('0x33')]),_0x57a28f);if(_0x5b1579[_0xf0b0('0x32')]['filter']){_0x2acd66[_0xf0b0('0x3c')]=_[_0xf0b0('0x3d')](_0x2acd66[_0xf0b0('0x3c')],{'$or':_[_0xf0b0('0x2c')](_0x57a28f,function(_0x3c1800){if(_0x3c1800[_0xf0b0('0x3e')]!==_0xf0b0('0x3f')){var _0x33426b={};_0x33426b[_0x3c1800[_0xf0b0('0x29')]]={'$like':'%'+_0x5b1579['query']['filter']+'%'};return _0x33426b;}})});}_0x2acd66=_[_0xf0b0('0x3d')]({},_0x2acd66,_0x5b1579['options']);var _0x743571={'where':_0x2acd66[_0xf0b0('0x3c')]};return db[_0xf0b0('0x2d')][_0xf0b0('0x1f')](_0x743571)[_0xf0b0('0x25')](function(_0x11212a){_0x525463['count']=_0x11212a;if(_0x5b1579['query'][_0xf0b0('0x40')]){_0x2acd66['include']=[{'all':!![]}];}return db[_0xf0b0('0x2d')][_0xf0b0('0x41')](_0x2acd66);})[_0xf0b0('0x25')](function(_0x56015e){_0x525463[_0xf0b0('0x42')]=_0x56015e;return _0x525463;})[_0xf0b0('0x25')](respondWithFilteredResult(_0x37dbb1,_0x2acd66))['catch'](handleError(_0x37dbb1,null));};exports[_0xf0b0('0x43')]=function(_0x5f44ad,_0x103ab7){var _0xa3095e={'raw':!![],'where':{'id':_0x5f44ad[_0xf0b0('0x44')]['id']}},_0x270d51={};_0x270d51[_0xf0b0('0x31')]=_[_0xf0b0('0x45')](db[_0xf0b0('0x2d')][_0xf0b0('0x2e')]);_0x270d51[_0xf0b0('0x32')]=_[_0xf0b0('0x45')](_0x5f44ad[_0xf0b0('0x32')]);_0x270d51[_0xf0b0('0x33')]=_[_0xf0b0('0x34')](_0x270d51['model'],_0x270d51[_0xf0b0('0x32')]);_0xa3095e[_0xf0b0('0x35')]=_[_0xf0b0('0x34')](_0x270d51['model'],qs[_0xf0b0('0x36')](_0x5f44ad[_0xf0b0('0x32')][_0xf0b0('0x36')]));_0xa3095e[_0xf0b0('0x35')]=_0xa3095e[_0xf0b0('0x35')]['length']?_0xa3095e[_0xf0b0('0x35')]:_0x270d51[_0xf0b0('0x31')];if(_0x5f44ad[_0xf0b0('0x32')]['includeAll']){_0xa3095e['include']=[{'all':!![]}];}_0xa3095e=_[_0xf0b0('0x3d')]({},_0xa3095e,_0x5f44ad[_0xf0b0('0x46')]);return db[_0xf0b0('0x2d')][_0xf0b0('0x47')](_0xa3095e)[_0xf0b0('0x25')](handleEntityNotFound(_0x103ab7,null))[_0xf0b0('0x25')](respondWithResult(_0x103ab7,null))[_0xf0b0('0x48')](handleError(_0x103ab7,null));};exports[_0xf0b0('0x49')]=function(_0x108964,_0x478b50){return db[_0xf0b0('0x2d')][_0xf0b0('0x49')](_0x108964[_0xf0b0('0x4a')],{})[_0xf0b0('0x25')](respondWithResult(_0x478b50,0xc9))[_0xf0b0('0x48')](handleError(_0x478b50,null));};exports[_0xf0b0('0x24')]=function(_0x394a9d,_0x54f544){if(_0x394a9d[_0xf0b0('0x4a')]['id']){delete _0x394a9d[_0xf0b0('0x4a')]['id'];}return db[_0xf0b0('0x2d')][_0xf0b0('0x47')]({'where':{'id':_0x394a9d['params']['id']}})[_0xf0b0('0x25')](handleEntityNotFound(_0x54f544,null))['then'](saveUpdates(_0x394a9d[_0xf0b0('0x4a')],null))[_0xf0b0('0x25')](respondWithResult(_0x54f544,null))[_0xf0b0('0x48')](handleError(_0x54f544,null));};exports['destroy']=function(_0x123131,_0x505981){return db[_0xf0b0('0x2d')][_0xf0b0('0x47')]({'where':{'id':_0x123131['params']['id']}})[_0xf0b0('0x25')](handleEntityNotFound(_0x505981,null))[_0xf0b0('0x25')](removeEntity(_0x505981,null))[_0xf0b0('0x48')](handleError(_0x505981,null));}; \ No newline at end of file +var _0x8cc3=['../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x443607,_0x2df8aa){var _0x3e9527=function(_0x4364f8){while(--_0x4364f8){_0x443607['push'](_0x443607['shift']());}};_0x3e9527(++_0x2df8aa);}(_0x8cc3,0x15a));var _0x38cc=function(_0x35df93,_0x3b73a1){_0x35df93=_0x35df93-0x0;var _0x53dbf3=_0x8cc3[_0x35df93];return _0x53dbf3;};'use strict';var emlformat=require(_0x38cc('0x0'));var rimraf=require(_0x38cc('0x1'));var zipdir=require(_0x38cc('0x2'));var jsonpatch=require(_0x38cc('0x3'));var rp=require(_0x38cc('0x4'));var moment=require(_0x38cc('0x5'));var BPromise=require(_0x38cc('0x6'));var Mustache=require('mustache');var util=require(_0x38cc('0x7'));var path=require(_0x38cc('0x8'));var sox=require(_0x38cc('0x9'));var csv=require(_0x38cc('0xa'));var ejs=require(_0x38cc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38cc('0xc'));var squel=require(_0x38cc('0xd'));var crypto=require(_0x38cc('0xe'));var jsforce=require(_0x38cc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x38cc('0xa'));var querystring=require(_0x38cc('0x10'));var Papa=require(_0x38cc('0x11'));var Redis=require(_0x38cc('0x12'));var authService=require(_0x38cc('0x13'));var qs=require(_0x38cc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38cc('0x15'));var logger=require('../../config/logger')(_0x38cc('0x16'));var utils=require(_0x38cc('0x17'));var config=require(_0x38cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f5fde,_0x256a87){_0x256a87=_0x256a87||0xcc;return function(_0x4f1ea4){if(_0x4f1ea4){return _0x9f5fde[_0x38cc('0x19')](_0x256a87);}return _0x9f5fde[_0x38cc('0x1a')](_0x256a87)[_0x38cc('0x1b')]();};}function respondWithResult(_0x5c67b5,_0x4c0673){_0x4c0673=_0x4c0673||0xc8;return function(_0x205377){if(_0x205377){return _0x5c67b5[_0x38cc('0x1a')](_0x4c0673)[_0x38cc('0x1c')](_0x205377);}};}function respondWithFilteredResult(_0x4e567b,_0x33b4cb){return function(_0x39bbe8){if(_0x39bbe8){var _0x4ebb58=typeof _0x33b4cb[_0x38cc('0x1d')]==='undefined'&&typeof _0x33b4cb[_0x38cc('0x1e')]===_0x38cc('0x1f');var _0x41f4db=_0x39bbe8[_0x38cc('0x20')];var _0x2a1417=_0x4ebb58?0x0:_0x33b4cb[_0x38cc('0x1d')];var _0x973a3=_0x4ebb58?_0x39bbe8[_0x38cc('0x20')]:_0x33b4cb['offset']+_0x33b4cb[_0x38cc('0x1e')];var _0x12c7f3;if(_0x973a3>=_0x41f4db){_0x973a3=_0x41f4db;_0x12c7f3=0xc8;}else{_0x12c7f3=0xce;}_0x4e567b[_0x38cc('0x1a')](_0x12c7f3);return _0x4e567b[_0x38cc('0x21')](_0x38cc('0x22'),_0x2a1417+'-'+_0x973a3+'/'+_0x41f4db)[_0x38cc('0x1c')](_0x39bbe8);}return null;};}function patchUpdates(_0x12754d){return function(_0x3cd0dc){try{jsonpatch[_0x38cc('0x23')](_0x3cd0dc,_0x12754d,!![]);}catch(_0x482d40){return BPromise[_0x38cc('0x24')](_0x482d40);}return _0x3cd0dc[_0x38cc('0x25')]();};}function saveUpdates(_0x4d1e86,_0x4270e5){return function(_0x3a1cd1){if(_0x3a1cd1){return _0x3a1cd1[_0x38cc('0x26')](_0x4d1e86)[_0x38cc('0x27')](function(_0x496585){return _0x496585;});}return null;};}function removeEntity(_0x438008,_0x2b6e0e){return function(_0x55c592){if(_0x55c592){return _0x55c592[_0x38cc('0x28')]()[_0x38cc('0x27')](function(){_0x438008[_0x38cc('0x1a')](0xcc)[_0x38cc('0x1b')]();});}};}function handleEntityNotFound(_0x15a037,_0x57f36d){return function(_0x3f8738){if(!_0x3f8738){_0x15a037[_0x38cc('0x19')](0x194);}return _0x3f8738;};}function handleError(_0x107e2f,_0xece803){_0xece803=_0xece803||0x1f4;return function(_0x5e1601){logger['error'](_0x5e1601[_0x38cc('0x29')]);if(_0x5e1601[_0x38cc('0x2a')]){delete _0x5e1601['name'];}_0x107e2f[_0x38cc('0x1a')](_0xece803)[_0x38cc('0x2b')](_0x5e1601);};}exports['index']=function(_0x4af6a9,_0x4d8851){var _0x3a5ce2={},_0x32b0af={},_0x52d976={'count':0x0,'rows':[]};var _0x27a2e6=_[_0x38cc('0x2c')](db[_0x38cc('0x2d')][_0x38cc('0x2e')],function(_0x3927fc){return{'name':_0x3927fc['fieldName'],'type':_0x3927fc[_0x38cc('0x2f')][_0x38cc('0x30')]};});_0x32b0af[_0x38cc('0x31')]=_[_0x38cc('0x2c')](_0x27a2e6,_0x38cc('0x2a'));_0x32b0af[_0x38cc('0x32')]=_[_0x38cc('0x33')](_0x4af6a9[_0x38cc('0x32')]);_0x32b0af[_0x38cc('0x34')]=_['intersection'](_0x32b0af[_0x38cc('0x31')],_0x32b0af['query']);_0x3a5ce2['attributes']=_[_0x38cc('0x35')](_0x32b0af['model'],qs[_0x38cc('0x36')](_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x36')]));_0x3a5ce2[_0x38cc('0x37')]=_0x3a5ce2[_0x38cc('0x37')]['length']?_0x3a5ce2[_0x38cc('0x37')]:_0x32b0af[_0x38cc('0x31')];if(!_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x38')]('nolimit')){_0x3a5ce2[_0x38cc('0x1e')]=qs[_0x38cc('0x1e')](_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x1e')]);_0x3a5ce2[_0x38cc('0x1d')]=qs[_0x38cc('0x1d')](_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x1d')]);}_0x3a5ce2[_0x38cc('0x39')]=qs[_0x38cc('0x3a')](_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x3a')]);_0x3a5ce2[_0x38cc('0x3b')]=qs[_0x38cc('0x34')](_[_0x38cc('0x3c')](_0x4af6a9[_0x38cc('0x32')],_0x32b0af[_0x38cc('0x34')]),_0x27a2e6);if(_0x4af6a9['query'][_0x38cc('0x3d')]){_0x3a5ce2[_0x38cc('0x3b')]=_[_0x38cc('0x3e')](_0x3a5ce2['where'],{'$or':_['map'](_0x27a2e6,function(_0x5b9e22){if(_0x5b9e22[_0x38cc('0x2f')]!==_0x38cc('0x3f')){var _0xa4202f={};_0xa4202f[_0x5b9e22['name']]={'$like':'%'+_0x4af6a9[_0x38cc('0x32')][_0x38cc('0x3d')]+'%'};return _0xa4202f;}})});}_0x3a5ce2=_[_0x38cc('0x3e')]({},_0x3a5ce2,_0x4af6a9[_0x38cc('0x40')]);var _0x3e22fe={'where':_0x3a5ce2['where']};return db[_0x38cc('0x2d')][_0x38cc('0x20')](_0x3e22fe)[_0x38cc('0x27')](function(_0x19ddc2){_0x52d976[_0x38cc('0x20')]=_0x19ddc2;if(_0x4af6a9['query'][_0x38cc('0x41')]){_0x3a5ce2[_0x38cc('0x42')]=[{'all':!![]}];}return db[_0x38cc('0x2d')][_0x38cc('0x43')](_0x3a5ce2);})[_0x38cc('0x27')](function(_0xf1cd92){_0x52d976['rows']=_0xf1cd92;return _0x52d976;})['then'](respondWithFilteredResult(_0x4d8851,_0x3a5ce2))[_0x38cc('0x44')](handleError(_0x4d8851,null));};exports['show']=function(_0x1bebf2,_0x2fe3a7){var _0x977df={'raw':!![],'where':{'id':_0x1bebf2[_0x38cc('0x45')]['id']}},_0x2e742f={};_0x2e742f[_0x38cc('0x31')]=_[_0x38cc('0x33')](db['VtigerField'][_0x38cc('0x2e')]);_0x2e742f[_0x38cc('0x32')]=_[_0x38cc('0x33')](_0x1bebf2[_0x38cc('0x32')]);_0x2e742f[_0x38cc('0x34')]=_['intersection'](_0x2e742f[_0x38cc('0x31')],_0x2e742f[_0x38cc('0x32')]);_0x977df['attributes']=_['intersection'](_0x2e742f[_0x38cc('0x31')],qs[_0x38cc('0x36')](_0x1bebf2[_0x38cc('0x32')][_0x38cc('0x36')]));_0x977df['attributes']=_0x977df['attributes'][_0x38cc('0x46')]?_0x977df[_0x38cc('0x37')]:_0x2e742f[_0x38cc('0x31')];if(_0x1bebf2[_0x38cc('0x32')]['includeAll']){_0x977df['include']=[{'all':!![]}];}_0x977df=_[_0x38cc('0x3e')]({},_0x977df,_0x1bebf2['options']);return db[_0x38cc('0x2d')]['find'](_0x977df)[_0x38cc('0x27')](handleEntityNotFound(_0x2fe3a7,null))['then'](respondWithResult(_0x2fe3a7,null))[_0x38cc('0x44')](handleError(_0x2fe3a7,null));};exports[_0x38cc('0x47')]=function(_0x5bd9fb,_0xc26548){return db[_0x38cc('0x2d')]['create'](_0x5bd9fb['body'],{})['then'](respondWithResult(_0xc26548,0xc9))[_0x38cc('0x44')](handleError(_0xc26548,null));};exports[_0x38cc('0x26')]=function(_0x550902,_0xaeb819){if(_0x550902['body']['id']){delete _0x550902[_0x38cc('0x48')]['id'];}return db[_0x38cc('0x2d')]['find']({'where':{'id':_0x550902[_0x38cc('0x45')]['id']}})[_0x38cc('0x27')](handleEntityNotFound(_0xaeb819,null))['then'](saveUpdates(_0x550902[_0x38cc('0x48')],null))[_0x38cc('0x27')](respondWithResult(_0xaeb819,null))[_0x38cc('0x44')](handleError(_0xaeb819,null));};exports['destroy']=function(_0x37031d,_0x395964){return db[_0x38cc('0x2d')][_0x38cc('0x49')]({'where':{'id':_0x37031d['params']['id']}})['then'](handleEntityNotFound(_0x395964,null))['then'](removeEntity(_0x395964,null))[_0x38cc('0x44')](handleError(_0x395964,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 291ea8f..04954d3 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 _0x3368=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4eb878,_0x5047c0){var _0x4518f2=function(_0x67e50b){while(--_0x67e50b){_0x4eb878['push'](_0x4eb878['shift']());}};_0x4518f2(++_0x5047c0);}(_0x3368,0xe7));var _0x8336=function(_0x4727b7,_0x585a61){_0x4727b7=_0x4727b7-0x0;var _0xce9394=_0x3368[_0x4727b7];return _0xce9394;};'use strict';var _=require('lodash');var util=require(_0x8336('0x0'));var logger=require(_0x8336('0x1'))(_0x8336('0x2'));var moment=require(_0x8336('0x3'));var BPromise=require('bluebird');var rp=require(_0x8336('0x4'));var fs=require('fs');var path=require(_0x8336('0x5'));var rimraf=require(_0x8336('0x6'));var config=require(_0x8336('0x7'));var attributes=require(_0x8336('0x8'));module[_0x8336('0x9')]=function(_0x4f2232,_0x31b01e){return _0x4f2232['define'](_0x8336('0xa'),attributes,{'tableName':_0x8336('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x8336('0xc'),_0x8336('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2baf=['vtiger_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x2baf,0x1a7));var _0xf2ba=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x2baf[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xf2ba('0x0'));var util=require(_0xf2ba('0x1'));var logger=require('../../config/logger')(_0xf2ba('0x2'));var moment=require(_0xf2ba('0x3'));var BPromise=require(_0xf2ba('0x4'));var rp=require(_0xf2ba('0x5'));var fs=require('fs');var path=require(_0xf2ba('0x6'));var rimraf=require(_0xf2ba('0x7'));var config=require(_0xf2ba('0x8'));var attributes=require(_0xf2ba('0x9'));module['exports']=function(_0x55f99e,_0x17d720){return _0x55f99e[_0xf2ba('0xa')](_0xf2ba('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf2ba('0xc'),'fields':[_0xf2ba('0xd'),_0xf2ba('0xe')],'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 c71de0c..6d8c84c 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 _0x27e9=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x184515,_0x273f72){var _0x296c81=function(_0x463431){while(--_0x463431){_0x184515['push'](_0x184515['shift']());}};_0x296c81(++_0x273f72);}(_0x27e9,0x7a));var _0x927e=function(_0x30b184,_0x342c04){_0x30b184=_0x30b184-0x0;var _0x51ff2e=_0x27e9[_0x30b184];return _0x51ff2e;};'use strict';var _=require(_0x927e('0x0'));var util=require('util');var moment=require(_0x927e('0x1'));var BPromise=require(_0x927e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x927e('0x3'));var db=require(_0x927e('0x4'))['db'];var utils=require(_0x927e('0x5'));var logger=require(_0x927e('0x6'))(_0x927e('0x7'));var config=require('../../config/environment');var jayson=require(_0x927e('0x8'));var client=jayson[_0x927e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x146739,_0x3d81e1,_0x971931){return new BPromise(function(_0x31e126,_0x3698af){return client[_0x927e('0xa')](_0x146739,_0x971931)[_0x927e('0xb')](function(_0x116058){logger[_0x927e('0xc')](_0x927e('0xd'),_0x3d81e1,_0x927e('0xe'));logger[_0x927e('0xf')](_0x927e('0x10'),_0x3d81e1,_0x927e('0xe'),JSON[_0x927e('0x11')](_0x116058));if(_0x116058[_0x927e('0x12')]){if(_0x116058[_0x927e('0x12')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x3d81e1,_0x116058[_0x927e('0x12')]['message']);return _0x3698af(_0x116058['error'][_0x927e('0x13')]);}logger[_0x927e('0x12')](_0x927e('0xd'),_0x3d81e1,_0x116058[_0x927e('0x12')][_0x927e('0x13')]);return _0x31e126(_0x116058[_0x927e('0x12')][_0x927e('0x13')]);}else{logger[_0x927e('0xc')](_0x927e('0xd'),_0x3d81e1,'request\x20sent');_0x31e126(_0x116058[_0x927e('0x14')]['message']);}})[_0x927e('0x15')](function(_0x31dcdf){logger[_0x927e('0x12')]('VtigerField,\x20%s,\x20%s',_0x3d81e1,_0x31dcdf);_0x3698af(_0x31dcdf);});});} \ No newline at end of file +var _0x7e27=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x25e55a,_0x2fa636){var _0x447cde=function(_0x3bdfc5){while(--_0x3bdfc5){_0x25e55a['push'](_0x25e55a['shift']());}};_0x447cde(++_0x2fa636);}(_0x7e27,0x15b));var _0x77e2=function(_0x45e122,_0x24d559){_0x45e122=_0x45e122-0x0;var _0x404418=_0x7e27[_0x45e122];return _0x404418;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x77e2('0x2'));var fs=require('fs');var Redis=require(_0x77e2('0x3'));var db=require(_0x77e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77e2('0x5'))(_0x77e2('0x6'));var config=require(_0x77e2('0x7'));var jayson=require(_0x77e2('0x8'));var client=jayson[_0x77e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b28a,_0x44ebfc,_0x167fd1){return new BPromise(function(_0xc78c9a,_0x2e9176){return client[_0x77e2('0xa')](_0x32b28a,_0x167fd1)[_0x77e2('0xb')](function(_0x76e540){logger['info'](_0x77e2('0xc'),_0x44ebfc,_0x77e2('0xd'));logger[_0x77e2('0xe')](_0x77e2('0xf'),_0x44ebfc,'request\x20sent',JSON[_0x77e2('0x10')](_0x76e540));if(_0x76e540[_0x77e2('0x11')]){if(_0x76e540[_0x77e2('0x11')][_0x77e2('0x12')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x44ebfc,_0x76e540[_0x77e2('0x11')][_0x77e2('0x13')]);return _0x2e9176(_0x76e540['error'][_0x77e2('0x13')]);}logger[_0x77e2('0x11')](_0x77e2('0xc'),_0x44ebfc,_0x76e540[_0x77e2('0x11')][_0x77e2('0x13')]);return _0xc78c9a(_0x76e540[_0x77e2('0x11')][_0x77e2('0x13')]);}else{logger[_0x77e2('0x14')](_0x77e2('0xc'),_0x44ebfc,_0x77e2('0xd'));_0xc78c9a(_0x76e540[_0x77e2('0x15')]['message']);}})['catch'](function(_0x5acde7){logger['error'](_0x77e2('0xc'),_0x44ebfc,_0x5acde7);_0x2e9176(_0x5acde7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ca05ab5..4a52d46 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 _0xa4c2=['get','isAuthenticated','/:id','/:id/configurations','/:id/fields','post','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa4c2,0x186));var _0x2a4c=function(_0x31fff7,_0x1b6129){_0x31fff7=_0x31fff7-0x0;var _0x3791a5=_0xa4c2[_0x31fff7];return _0x3791a5;};'use strict';var multer=require('multer');var util=require(_0x2a4c('0x0'));var path=require(_0x2a4c('0x1'));var timeout=require(_0x2a4c('0x2'));var express=require(_0x2a4c('0x3'));var router=express['Router']();var fs_extra=require(_0x2a4c('0x4'));var auth=require(_0x2a4c('0x5'));var interaction=require(_0x2a4c('0x6'));var config=require(_0x2a4c('0x7'));var controller=require(_0x2a4c('0x8'));router[_0x2a4c('0x9')]('/',auth[_0x2a4c('0xa')](),controller['index']);router[_0x2a4c('0x9')](_0x2a4c('0xb'),auth[_0x2a4c('0xa')](),controller['show']);router[_0x2a4c('0x9')](_0x2a4c('0xc'),auth[_0x2a4c('0xa')](),controller['getConfigurations']);router[_0x2a4c('0x9')](_0x2a4c('0xd'),auth[_0x2a4c('0xa')](),controller['getFields']);router[_0x2a4c('0xe')]('/',auth[_0x2a4c('0xa')](),controller['create']);router[_0x2a4c('0xe')](_0x2a4c('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2a4c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2a4c('0x10')]);router['delete'](_0x2a4c('0xb'),auth[_0x2a4c('0xa')](),controller[_0x2a4c('0x11')]);module[_0x2a4c('0x12')]=router; \ No newline at end of file +var _0x3cbd=['getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','/:id/fields'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x3cbd,0x191));var _0xd3cb=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x3cbd[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0xd3cb('0x0'));var util=require(_0xd3cb('0x1'));var path=require('path');var timeout=require(_0xd3cb('0x2'));var express=require(_0xd3cb('0x3'));var router=express[_0xd3cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd3cb('0x5'));var interaction=require(_0xd3cb('0x6'));var config=require(_0xd3cb('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xd3cb('0x8')]('/',auth[_0xd3cb('0x9')](),controller[_0xd3cb('0xa')]);router['get']('/:id',auth[_0xd3cb('0x9')](),controller['show']);router['get'](_0xd3cb('0xb'),auth[_0xd3cb('0x9')](),controller['getConfigurations']);router[_0xd3cb('0x8')](_0xd3cb('0xc'),auth['isAuthenticated'](),controller[_0xd3cb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3cb('0xe')]);router[_0xd3cb('0xf')](_0xd3cb('0xb'),auth['isAuthenticated'](),controller[_0xd3cb('0x10')]);router[_0xd3cb('0x11')](_0xd3cb('0x12'),auth[_0xd3cb('0x9')](),controller[_0xd3cb('0x13')]);router[_0xd3cb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xd3cb('0x15')]);module[_0xd3cb('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 702fc5c..52ecd95 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 _0xa899=['exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','sequelize'];(function(_0x467e09,_0x59319b){var _0x2d7a64=function(_0x3cfb8d){while(--_0x3cfb8d){_0x467e09['push'](_0x467e09['shift']());}};_0x2d7a64(++_0x59319b);}(_0xa899,0x155));var _0x9a89=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xa899[_0x533528];return _0x3189f1;};'use strict';var Sequelize=require(_0x9a89('0x0'));module[_0x9a89('0x1')]={'name':{'type':Sequelize[_0x9a89('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x3')},'password':{'type':Sequelize[_0x9a89('0x2')]},'token':{'type':Sequelize[_0x9a89('0x2')]},'remoteUri':{'type':Sequelize[_0x9a89('0x2')],'unique':_0x9a89('0x4')},'authType':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x6'),_0x9a89('0x7')),'defaultValue':_0x9a89('0x6')},'serverUrl':{'type':Sequelize[_0x9a89('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a89('0x5')](_0x9a89('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xbc36=['newTab','sequelize','STRING','username','remoteUri','ENUM','token','password','integrationTab'];(function(_0x34f32c,_0x39fe66){var _0x54de91=function(_0xeee1e7){while(--_0xeee1e7){_0x34f32c['push'](_0x34f32c['shift']());}};_0x54de91(++_0x39fe66);}(_0xbc36,0x169));var _0x6bc3=function(_0x2e6e6e,_0x4b64e8){_0x2e6e6e=_0x2e6e6e-0x0;var _0x3c7907=_0xbc36[_0x2e6e6e];return _0x3c7907;};'use strict';var Sequelize=require(_0x6bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc3('0x1')]},'description':{'type':Sequelize[_0x6bc3('0x1')]},'username':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x2')},'password':{'type':Sequelize[_0x6bc3('0x1')]},'token':{'type':Sequelize[_0x6bc3('0x1')]},'remoteUri':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x3')},'authType':{'type':Sequelize[_0x6bc3('0x4')]('password',_0x6bc3('0x5')),'defaultValue':_0x6bc3('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bc3('0x4')](_0x6bc3('0x7'),_0x6bc3('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d5e0d90..2232b2d 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 _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x2a7825,_0x16e793){var _0x3ad243=function(_0x2e50c7){while(--_0x2e50c7){_0x2a7825['push'](_0x2a7825['shift']());}};_0x3ad243(++_0x16e793);}(_0x7916,0x128));var _0x6791=function(_0x5a030f,_0xd4b553){_0x5a030f=_0x5a030f-0x0;var _0x343018=_0x7916[_0x5a030f];return _0x343018;};'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'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file +var _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x211a69,_0x3063af){var _0x271cf4=function(_0x42a614){while(--_0x42a614){_0x211a69['push'](_0x211a69['shift']());}};_0x271cf4(++_0x3063af);}(_0xae60,0x1c7));var _0x0ae6=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xae60[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 33fbe93..c0b72f5 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 _0xf435=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts'];(function(_0x5eb5b9,_0x1a38d2){var _0x50376c=function(_0x8b2bca){while(--_0x8b2bca){_0x5eb5b9['push'](_0x5eb5b9['shift']());}};_0x50376c(++_0x1a38d2);}(_0xf435,0xfd));var _0x5f43=function(_0x261f57,_0x78f45a){_0x261f57=_0x261f57-0x0;var _0x4e8150=_0xf435[_0x261f57];return _0x4e8150;};'use strict';var _=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var logger=require(_0x5f43('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5f43('0x3'));var rp=require(_0x5f43('0x4'));var fs=require('fs');var path=require(_0x5f43('0x5'));var rimraf=require(_0x5f43('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f43('0x7'));var integrations=require(_0x5f43('0x8'));module['exports']=function(_0x19bc81,_0x53571d){return _0x19bc81['define'](_0x5f43('0x9'),attributes,{'tableName':_0x5f43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf03=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0xbf4ded,_0x1d26a5){var _0x224f0a=function(_0x320c5e){while(--_0x320c5e){_0xbf4ded['push'](_0xbf4ded['shift']());}};_0x224f0a(++_0x1d26a5);}(_0xaf03,0x109));var _0x3af0=function(_0x25c478,_0x2497e9){_0x25c478=_0x25c478-0x0;var _0x20a4c7=_0xaf03[_0x25c478];return _0x20a4c7;};'use strict';var _=require(_0x3af0('0x0'));var util=require(_0x3af0('0x1'));var logger=require(_0x3af0('0x2'))(_0x3af0('0x3'));var moment=require(_0x3af0('0x4'));var BPromise=require(_0x3af0('0x5'));var rp=require(_0x3af0('0x6'));var fs=require('fs');var path=require(_0x3af0('0x7'));var rimraf=require(_0x3af0('0x8'));var config=require(_0x3af0('0x9'));var attributes=require(_0x3af0('0xa'));var integrations=require(_0x3af0('0xb'));module[_0x3af0('0xc')]=function(_0x3ce338,_0x5a440b){return _0x3ce338[_0x3af0('0xd')](_0x3af0('0xe'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 0352865..8ce2cc4 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 _0x0f23=['then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','ZendeskAccount','raw','where','options','attributes','limit','include','model','stringify','catch','ShowZendeskAccount','map','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x0f23,0xdd));var _0x30f2=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x0f23[_0x13992d];return _0x3d15bf;};'use strict';var _=require(_0x30f2('0x0'));var util=require(_0x30f2('0x1'));var moment=require('moment');var BPromise=require(_0x30f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30f2('0x3'))['db'];var utils=require(_0x30f2('0x4'));var logger=require(_0x30f2('0x5'))(_0x30f2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30f2('0x7')][_0x30f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6d5db3,_0x2a472d,_0x4074b1){return new BPromise(function(_0x5c4be9,_0x526b16){return client[_0x30f2('0x9')](_0x6d5db3,_0x4074b1)[_0x30f2('0xa')](function(_0x5a2374){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2a472d,_0x30f2('0xb'));logger[_0x30f2('0xc')](_0x30f2('0xd'),_0x2a472d,_0x30f2('0xb'),JSON['stringify'](_0x5a2374));if(_0x5a2374[_0x30f2('0xe')]){if(_0x5a2374['error'][_0x30f2('0xf')]===0x1f4){logger[_0x30f2('0xe')](_0x30f2('0x10'),_0x2a472d,_0x5a2374['error'][_0x30f2('0x11')]);return _0x526b16(_0x5a2374[_0x30f2('0xe')][_0x30f2('0x11')]);}logger[_0x30f2('0xe')](_0x30f2('0x10'),_0x2a472d,_0x5a2374[_0x30f2('0xe')][_0x30f2('0x11')]);return _0x5c4be9(_0x5a2374[_0x30f2('0xe')][_0x30f2('0x11')]);}else{logger[_0x30f2('0x12')](_0x30f2('0x10'),_0x2a472d,_0x30f2('0xb'));_0x5c4be9(_0x5a2374[_0x30f2('0x13')][_0x30f2('0x11')]);}})['catch'](function(_0x53058f){logger[_0x30f2('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x2a472d,_0x53058f);_0x526b16(_0x53058f);});});}exports[_0x30f2('0x14')]=function(_0x5e8f4a){var _0x2afba3=this;return new Promise(function(_0x3423fb,_0x246514){return db[_0x30f2('0x15')]['findAll']({'raw':_0x5e8f4a['options']?_0x5e8f4a['options'][_0x30f2('0x16')]===undefined?!![]:![]:!![],'where':_0x5e8f4a['options']?_0x5e8f4a['options'][_0x30f2('0x17')]||null:null,'attributes':_0x5e8f4a[_0x30f2('0x18')]?_0x5e8f4a[_0x30f2('0x18')][_0x30f2('0x19')]||null:null,'limit':_0x5e8f4a['options']?_0x5e8f4a[_0x30f2('0x18')][_0x30f2('0x1a')]||null:null,'include':_0x5e8f4a[_0x30f2('0x18')]?_0x5e8f4a['options']['include']?_['map'](_0x5e8f4a[_0x30f2('0x18')][_0x30f2('0x1b')],function(_0x5e85e9){return{'model':db[_0x5e85e9['model']],'as':_0x5e85e9['as'],'attributes':_0x5e85e9[_0x30f2('0x19')],'include':_0x5e85e9[_0x30f2('0x1b')]?_['map'](_0x5e85e9[_0x30f2('0x1b')],function(_0x48d17a){return{'model':db[_0x48d17a[_0x30f2('0x1c')]],'as':_0x48d17a['as'],'attributes':_0x48d17a[_0x30f2('0x19')],'include':_0x48d17a[_0x30f2('0x1b')]?_['map'](_0x48d17a[_0x30f2('0x1b')],function(_0x1c1265){return{'model':db[_0x1c1265[_0x30f2('0x1c')]],'as':_0x1c1265['as'],'attributes':_0x1c1265[_0x30f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30f2('0xa')](function(_0x3f0507){logger[_0x30f2('0x12')](_0x30f2('0x14'),_0x5e8f4a);logger[_0x30f2('0xc')]('GetZendeskAccount',_0x5e8f4a,JSON[_0x30f2('0x1d')](_0x3f0507));_0x3423fb(_0x3f0507);})[_0x30f2('0x1e')](function(_0x35ec5){logger[_0x30f2('0xe')]('GetZendeskAccount',_0x35ec5['message'],_0x5e8f4a);_0x246514(_0x2afba3['error'](0x1f4,_0x35ec5[_0x30f2('0x11')]));});});};exports[_0x30f2('0x1f')]=function(_0x1d8c0e){var _0x4d66fd=this;return new Promise(function(_0xeefeb8,_0x48fe1b){return db['ZendeskAccount']['find']({'raw':_0x1d8c0e[_0x30f2('0x18')]?_0x1d8c0e[_0x30f2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d8c0e['options']?_0x1d8c0e['options'][_0x30f2('0x17')]||null:null,'attributes':_0x1d8c0e[_0x30f2('0x18')]?_0x1d8c0e[_0x30f2('0x18')][_0x30f2('0x19')]||null:null,'include':_0x1d8c0e['options']?_0x1d8c0e[_0x30f2('0x18')][_0x30f2('0x1b')]?_['map'](_0x1d8c0e[_0x30f2('0x18')][_0x30f2('0x1b')],function(_0x51f2f4){return{'model':db[_0x51f2f4['model']],'as':_0x51f2f4['as'],'attributes':_0x51f2f4[_0x30f2('0x19')],'include':_0x51f2f4[_0x30f2('0x1b')]?_['map'](_0x51f2f4[_0x30f2('0x1b')],function(_0x571eac){return{'model':db[_0x571eac[_0x30f2('0x1c')]],'as':_0x571eac['as'],'attributes':_0x571eac[_0x30f2('0x19')],'include':_0x571eac[_0x30f2('0x1b')]?_[_0x30f2('0x20')](_0x571eac[_0x30f2('0x1b')],function(_0x33de3b){return{'model':db[_0x33de3b[_0x30f2('0x1c')]],'as':_0x33de3b['as'],'attributes':_0x33de3b[_0x30f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30f2('0xa')](function(_0x5e4f30){logger[_0x30f2('0x12')]('ShowZendeskAccount',_0x1d8c0e);logger[_0x30f2('0xc')]('ShowZendeskAccount',_0x1d8c0e,JSON[_0x30f2('0x1d')](_0x5e4f30));_0xeefeb8(_0x5e4f30);})[_0x30f2('0x1e')](function(_0x12920a){logger[_0x30f2('0xe')](_0x30f2('0x1f'),_0x12920a[_0x30f2('0x11')],_0x1d8c0e);_0x48fe1b(_0x4d66fd[_0x30f2('0xe')](0x1f4,_0x12920a[_0x30f2('0x11')]));});});}; \ No newline at end of file +var _0x454a=['client','then','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','findAll','options','attributes','limit','include','map','model','info','ShowZendeskAccount','where','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xa47dd8,_0x1a77e2){var _0x592d8f=function(_0x300ed8){while(--_0x300ed8){_0xa47dd8['push'](_0xa47dd8['shift']());}};_0x592d8f(++_0x1a77e2);}(_0x454a,0x171));var _0xa454=function(_0x375f19,_0x55a325){_0x375f19=_0x375f19-0x0;var _0xa6f95b=_0x454a[_0x375f19];return _0xa6f95b;};'use strict';var _=require(_0xa454('0x0'));var util=require(_0xa454('0x1'));var moment=require(_0xa454('0x2'));var BPromise=require(_0xa454('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa454('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa454('0x5'))(_0xa454('0x6'));var config=require('../../config/environment');var jayson=require(_0xa454('0x7'));var client=jayson[_0xa454('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447c85,_0x19b2e3,_0x12bd5b){return new BPromise(function(_0x2bbf56,_0x108531){return client['request'](_0x447c85,_0x12bd5b)[_0xa454('0x9')](function(_0x399651){logger['info'](_0xa454('0xa'),_0x19b2e3,'request\x20sent');logger['debug'](_0xa454('0xb'),_0x19b2e3,_0xa454('0xc'),JSON[_0xa454('0xd')](_0x399651));if(_0x399651[_0xa454('0xe')]){if(_0x399651['error'][_0xa454('0xf')]===0x1f4){logger[_0xa454('0xe')](_0xa454('0xa'),_0x19b2e3,_0x399651['error'][_0xa454('0x10')]);return _0x108531(_0x399651['error'][_0xa454('0x10')]);}logger['error'](_0xa454('0xa'),_0x19b2e3,_0x399651['error'][_0xa454('0x10')]);return _0x2bbf56(_0x399651['error'][_0xa454('0x10')]);}else{logger['info'](_0xa454('0xa'),_0x19b2e3,_0xa454('0xc'));_0x2bbf56(_0x399651['result'][_0xa454('0x10')]);}})[_0xa454('0x11')](function(_0x2687cb){logger[_0xa454('0xe')](_0xa454('0xa'),_0x19b2e3,_0x2687cb);_0x108531(_0x2687cb);});});}exports[_0xa454('0x12')]=function(_0x57b541){var _0x4455c3=this;return new Promise(function(_0x218a96,_0x455abe){return db['ZendeskAccount'][_0xa454('0x13')]({'raw':_0x57b541[_0xa454('0x14')]?_0x57b541[_0xa454('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x57b541[_0xa454('0x14')]?_0x57b541[_0xa454('0x14')]['where']||null:null,'attributes':_0x57b541[_0xa454('0x14')]?_0x57b541[_0xa454('0x14')][_0xa454('0x15')]||null:null,'limit':_0x57b541[_0xa454('0x14')]?_0x57b541['options'][_0xa454('0x16')]||null:null,'include':_0x57b541[_0xa454('0x14')]?_0x57b541[_0xa454('0x14')][_0xa454('0x17')]?_[_0xa454('0x18')](_0x57b541[_0xa454('0x14')][_0xa454('0x17')],function(_0x69d7dc){return{'model':db[_0x69d7dc[_0xa454('0x19')]],'as':_0x69d7dc['as'],'attributes':_0x69d7dc[_0xa454('0x15')],'include':_0x69d7dc[_0xa454('0x17')]?_[_0xa454('0x18')](_0x69d7dc[_0xa454('0x17')],function(_0x3658aa){return{'model':db[_0x3658aa[_0xa454('0x19')]],'as':_0x3658aa['as'],'attributes':_0x3658aa[_0xa454('0x15')],'include':_0x3658aa['include']?_[_0xa454('0x18')](_0x3658aa['include'],function(_0x4fe631){return{'model':db[_0x4fe631[_0xa454('0x19')]],'as':_0x4fe631['as'],'attributes':_0x4fe631['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257c7b){logger[_0xa454('0x1a')](_0xa454('0x12'),_0x57b541);logger['debug'](_0xa454('0x12'),_0x57b541,JSON[_0xa454('0xd')](_0x257c7b));_0x218a96(_0x257c7b);})[_0xa454('0x11')](function(_0x31df33){logger[_0xa454('0xe')](_0xa454('0x12'),_0x31df33[_0xa454('0x10')],_0x57b541);_0x455abe(_0x4455c3[_0xa454('0xe')](0x1f4,_0x31df33[_0xa454('0x10')]));});});};exports[_0xa454('0x1b')]=function(_0x1d7a5f){var _0xc01a9=this;return new Promise(function(_0x56c796,_0x1b9696){return db['ZendeskAccount']['find']({'raw':_0x1d7a5f[_0xa454('0x14')]?_0x1d7a5f[_0xa454('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d7a5f['options']?_0x1d7a5f[_0xa454('0x14')][_0xa454('0x1c')]||null:null,'attributes':_0x1d7a5f[_0xa454('0x14')]?_0x1d7a5f['options']['attributes']||null:null,'include':_0x1d7a5f[_0xa454('0x14')]?_0x1d7a5f[_0xa454('0x14')][_0xa454('0x17')]?_[_0xa454('0x18')](_0x1d7a5f[_0xa454('0x14')][_0xa454('0x17')],function(_0x2a451e){return{'model':db[_0x2a451e[_0xa454('0x19')]],'as':_0x2a451e['as'],'attributes':_0x2a451e[_0xa454('0x15')],'include':_0x2a451e['include']?_[_0xa454('0x18')](_0x2a451e[_0xa454('0x17')],function(_0x3dae73){return{'model':db[_0x3dae73[_0xa454('0x19')]],'as':_0x3dae73['as'],'attributes':_0x3dae73['attributes'],'include':_0x3dae73[_0xa454('0x17')]?_[_0xa454('0x18')](_0x3dae73[_0xa454('0x17')],function(_0x156482){return{'model':db[_0x156482[_0xa454('0x19')]],'as':_0x156482['as'],'attributes':_0x156482[_0xa454('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa454('0x9')](function(_0x396cf3){logger['info'](_0xa454('0x1b'),_0x1d7a5f);logger['debug']('ShowZendeskAccount',_0x1d7a5f,JSON['stringify'](_0x396cf3));_0x56c796(_0x396cf3);})[_0xa454('0x11')](function(_0x4cb71d){logger[_0xa454('0xe')](_0xa454('0x1b'),_0x4cb71d[_0xa454('0x10')],_0x1d7a5f);_0x1b9696(_0xc01a9[_0xa454('0xe')](0x1f4,_0x4cb71d[_0xa454('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fed57b0..6e0e74e 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x4a9c9b,_0x373cc7){var _0x3c53b5=function(_0x439448){while(--_0x439448){_0x4a9c9b['push'](_0x4a9c9b['shift']());}};_0x3c53b5(++_0x373cc7);}(_0xa571,0x107));var _0x1a57=function(_0xf088cb,_0x224833){_0xf088cb=_0xf088cb-0x0;var _0x1ab411=_0xa571[_0xf088cb];return _0x1ab411;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x878f,0x173));var _0xf878=function(_0x53fdff,_0x5011a5){_0x53fdff=_0x53fdff-0x0;var _0x3edd6a=_0x878f[_0x53fdff];return _0x3edd6a;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 9d5f739..6a08509 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 _0xbefe=['exports','STRING'];(function(_0x57172c,_0x1df512){var _0x38e8a4=function(_0x1bc9a5){while(--_0x1bc9a5){_0x57172c['push'](_0x57172c['shift']());}};_0x38e8a4(++_0x1df512);}(_0xbefe,0x14e));var _0xebef=function(_0x544d66,_0xabcbd9){_0x544d66=_0x544d66-0x0;var _0x46a80d=_0xbefe[_0x544d66];return _0x46a80d;};'use strict';var Sequelize=require('sequelize');module[_0xebef('0x0')]={'name':{'type':Sequelize[_0xebef('0x1')]},'description':{'type':Sequelize[_0xebef('0x1')]}}; \ No newline at end of file +var _0x6422=['STRING','sequelize','exports'];(function(_0x470794,_0x556bb6){var _0x4b3c52=function(_0x2cf264){while(--_0x2cf264){_0x470794['push'](_0x470794['shift']());}};_0x4b3c52(++_0x556bb6);}(_0x6422,0x1db));var _0x2642=function(_0x1be3a1,_0x42fea0){_0x1be3a1=_0x1be3a1-0x0;var _0x47e1dd=_0x6422[_0x1be3a1];return _0x47e1dd;};'use strict';var Sequelize=require(_0x2642('0x0'));module[_0x2642('0x1')]={'name':{'type':Sequelize[_0x2642('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 f29ae91..db528bb 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 _0x726e=['length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','rows','catch','show','includeAll','find','create','body','params','destroy','getFields','ZendeskField','hasOwnProperty','findOne','getSubjects','getDescriptions','Tag','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../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','save','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x178340,_0x3043e7){var _0x56a964=function(_0x1680da){while(--_0x1680da){_0x178340['push'](_0x178340['shift']());}};_0x56a964(++_0x3043e7);}(_0x726e,0x16b));var _0xe726=function(_0xd9644e,_0x1686c6){_0xd9644e=_0xd9644e-0x0;var _0x5da124=_0x726e[_0xd9644e];return _0x5da124;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe726('0x0'));var jsonpatch=require(_0xe726('0x1'));var rp=require(_0xe726('0x2'));var moment=require(_0xe726('0x3'));var BPromise=require(_0xe726('0x4'));var Mustache=require(_0xe726('0x5'));var util=require(_0xe726('0x6'));var path=require(_0xe726('0x7'));var sox=require(_0xe726('0x8'));var csv=require('to-csv');var ejs=require(_0xe726('0x9'));var fs=require('fs');var fs_extra=require(_0xe726('0xa'));var _=require(_0xe726('0xb'));var squel=require(_0xe726('0xc'));var crypto=require(_0xe726('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe726('0xe'));var querystring=require(_0xe726('0xf'));var Papa=require(_0xe726('0x10'));var Redis=require('ioredis');var authService=require(_0xe726('0x11'));var qs=require(_0xe726('0x12'));var as=require(_0xe726('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe726('0x14'))('api');var utils=require(_0xe726('0x15'));var config=require(_0xe726('0x16'));var licenseUtil=require(_0xe726('0x17'));var db=require(_0xe726('0x18'))['db'];function respondWithStatusCode(_0x483daa,_0x2d3e83){_0x2d3e83=_0x2d3e83||0xcc;return function(_0x698324){if(_0x698324){return _0x483daa[_0xe726('0x19')](_0x2d3e83);}return _0x483daa[_0xe726('0x1a')](_0x2d3e83)[_0xe726('0x1b')]();};}function respondWithResult(_0x319326,_0x29fafa){_0x29fafa=_0x29fafa||0xc8;return function(_0x3f7232){if(_0x3f7232){return _0x319326[_0xe726('0x1a')](_0x29fafa)[_0xe726('0x1c')](_0x3f7232);}};}function respondWithFilteredResult(_0x148948,_0x1a25e6){return function(_0x3d047e){if(_0x3d047e){var _0x1f43ef=typeof _0x1a25e6[_0xe726('0x1d')]===_0xe726('0x1e')&&typeof _0x1a25e6[_0xe726('0x1f')]===_0xe726('0x1e');var _0xe6952=_0x3d047e[_0xe726('0x20')];var _0x34cb57=_0x1f43ef?0x0:_0x1a25e6[_0xe726('0x1d')];var _0x5688c3=_0x1f43ef?_0x3d047e[_0xe726('0x20')]:_0x1a25e6[_0xe726('0x1d')]+_0x1a25e6[_0xe726('0x1f')];var _0x366c5c;if(_0x5688c3>=_0xe6952){_0x5688c3=_0xe6952;_0x366c5c=0xc8;}else{_0x366c5c=0xce;}_0x148948[_0xe726('0x1a')](_0x366c5c);return _0x148948[_0xe726('0x21')](_0xe726('0x22'),_0x34cb57+'-'+_0x5688c3+'/'+_0xe6952)['json'](_0x3d047e);}return null;};}function patchUpdates(_0x1e8f24){return function(_0x321bbe){try{jsonpatch[_0xe726('0x23')](_0x321bbe,_0x1e8f24,!![]);}catch(_0x3592a4){return BPromise['reject'](_0x3592a4);}return _0x321bbe[_0xe726('0x24')]();};}function saveUpdates(_0x47bda5,_0x2f5b35){return function(_0x169149){if(_0x169149){return _0x169149['update'](_0x47bda5)['then'](function(_0x5c72a2){return _0x5c72a2;});}return null;};}function removeEntity(_0x18e3b6,_0x558016){return function(_0x2b67fb){if(_0x2b67fb){return _0x2b67fb['destroy']()['then'](function(){_0x18e3b6['status'](0xcc)[_0xe726('0x1b')]();});}};}function handleEntityNotFound(_0x28c4d5,_0x227eb0){return function(_0x36e97d){if(!_0x36e97d){_0x28c4d5['sendStatus'](0x194);}return _0x36e97d;};}function handleError(_0x4f6d49,_0x22b260){_0x22b260=_0x22b260||0x1f4;return function(_0x1c12e8){logger['error'](_0x1c12e8[_0xe726('0x25')]);if(_0x1c12e8[_0xe726('0x26')]){delete _0x1c12e8[_0xe726('0x26')];}_0x4f6d49[_0xe726('0x1a')](_0x22b260)['send'](_0x1c12e8);};}exports['index']=function(_0x9562eb,_0x5e582d){var _0x2bd91d={},_0x20bab3={},_0x2bdc89={'count':0x0,'rows':[]};var _0x5a5ce5=_[_0xe726('0x27')](db[_0xe726('0x28')][_0xe726('0x29')],function(_0xd704d8){return{'name':_0xd704d8[_0xe726('0x2a')],'type':_0xd704d8[_0xe726('0x2b')][_0xe726('0x2c')]};});_0x20bab3[_0xe726('0x2d')]=_[_0xe726('0x27')](_0x5a5ce5,_0xe726('0x26'));_0x20bab3[_0xe726('0x2e')]=_[_0xe726('0x2f')](_0x9562eb['query']);_0x20bab3[_0xe726('0x30')]=_[_0xe726('0x31')](_0x20bab3[_0xe726('0x2d')],_0x20bab3[_0xe726('0x2e')]);_0x2bd91d[_0xe726('0x32')]=_[_0xe726('0x31')](_0x20bab3[_0xe726('0x2d')],qs[_0xe726('0x33')](_0x9562eb[_0xe726('0x2e')][_0xe726('0x33')]));_0x2bd91d[_0xe726('0x32')]=_0x2bd91d['attributes'][_0xe726('0x34')]?_0x2bd91d[_0xe726('0x32')]:_0x20bab3[_0xe726('0x2d')];if(!_0x9562eb[_0xe726('0x2e')]['hasOwnProperty'](_0xe726('0x35'))){_0x2bd91d[_0xe726('0x1f')]=qs[_0xe726('0x1f')](_0x9562eb['query'][_0xe726('0x1f')]);_0x2bd91d['offset']=qs[_0xe726('0x1d')](_0x9562eb['query'][_0xe726('0x1d')]);}_0x2bd91d[_0xe726('0x36')]=qs[_0xe726('0x37')](_0x9562eb[_0xe726('0x2e')]['sort']);_0x2bd91d['where']=qs[_0xe726('0x30')](_[_0xe726('0x38')](_0x9562eb['query'],_0x20bab3[_0xe726('0x30')]),_0x5a5ce5);if(_0x9562eb[_0xe726('0x2e')][_0xe726('0x39')]){_0x2bd91d[_0xe726('0x3a')]=_[_0xe726('0x3b')](_0x2bd91d[_0xe726('0x3a')],{'$or':_[_0xe726('0x27')](_0x5a5ce5,function(_0x292bc3){if(_0x292bc3[_0xe726('0x2b')]!==_0xe726('0x3c')){var _0x57c180={};_0x57c180[_0x292bc3[_0xe726('0x26')]]={'$like':'%'+_0x9562eb[_0xe726('0x2e')][_0xe726('0x39')]+'%'};return _0x57c180;}})});}_0x2bd91d=_[_0xe726('0x3b')]({},_0x2bd91d,_0x9562eb[_0xe726('0x3d')]);var _0x54f2cb={'where':_0x2bd91d[_0xe726('0x3a')]};return db['ZendeskConfiguration'][_0xe726('0x20')](_0x54f2cb)[_0xe726('0x3e')](function(_0x349097){_0x2bdc89['count']=_0x349097;if(_0x9562eb[_0xe726('0x2e')]['includeAll']){_0x2bd91d[_0xe726('0x3f')]=[{'all':!![]}];}return db[_0xe726('0x28')]['findAll'](_0x2bd91d);})[_0xe726('0x3e')](function(_0x2c67c3){_0x2bdc89[_0xe726('0x40')]=_0x2c67c3;return _0x2bdc89;})[_0xe726('0x3e')](respondWithFilteredResult(_0x5e582d,_0x2bd91d))[_0xe726('0x41')](handleError(_0x5e582d,null));};exports[_0xe726('0x42')]=function(_0x572845,_0x4570){var _0x2cfdfb={'raw':![],'where':{'id':_0x572845['params']['id']}},_0x3b0e7c={};_0x3b0e7c[_0xe726('0x2d')]=_['keys'](db[_0xe726('0x28')][_0xe726('0x29')]);_0x3b0e7c[_0xe726('0x2e')]=_[_0xe726('0x2f')](_0x572845[_0xe726('0x2e')]);_0x3b0e7c[_0xe726('0x30')]=_[_0xe726('0x31')](_0x3b0e7c[_0xe726('0x2d')],_0x3b0e7c['query']);_0x2cfdfb[_0xe726('0x32')]=_['intersection'](_0x3b0e7c[_0xe726('0x2d')],qs['fields'](_0x572845[_0xe726('0x2e')][_0xe726('0x33')]));_0x2cfdfb[_0xe726('0x32')]=_0x2cfdfb['attributes'][_0xe726('0x34')]?_0x2cfdfb[_0xe726('0x32')]:_0x3b0e7c[_0xe726('0x2d')];if(_0x572845[_0xe726('0x2e')][_0xe726('0x43')]){_0x2cfdfb['include']=[{'all':!![]}];}_0x2cfdfb=_['merge']({},_0x2cfdfb,_0x572845['options']);return db[_0xe726('0x28')][_0xe726('0x44')](_0x2cfdfb)[_0xe726('0x3e')](handleEntityNotFound(_0x4570,null))[_0xe726('0x3e')](respondWithResult(_0x4570,null))['catch'](handleError(_0x4570,null));};exports[_0xe726('0x45')]=function(_0x486027,_0x4f77be){return db['ZendeskConfiguration'][_0xe726('0x45')](_0x486027[_0xe726('0x46')],{})[_0xe726('0x3e')](respondWithResult(_0x4f77be,0xc9))[_0xe726('0x41')](handleError(_0x4f77be,null));};exports['update']=function(_0xc5647e,_0x5153d3){if(_0xc5647e[_0xe726('0x46')]['id']){delete _0xc5647e['body']['id'];}return db['ZendeskConfiguration'][_0xe726('0x44')]({'where':{'id':_0xc5647e[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x5153d3,null))[_0xe726('0x3e')](saveUpdates(_0xc5647e[_0xe726('0x46')],null))[_0xe726('0x3e')](respondWithResult(_0x5153d3,null))['catch'](handleError(_0x5153d3,null));};exports[_0xe726('0x48')]=function(_0x2f8b2b,_0x4b849d){return db[_0xe726('0x28')]['find']({'where':{'id':_0x2f8b2b[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x4b849d,null))['then'](removeEntity(_0x4b849d,null))[_0xe726('0x41')](handleError(_0x4b849d,null));};exports[_0xe726('0x49')]=function(_0x2b05b9,_0x9d8ff4,_0x1f0018){var _0xacf6cf={};var _0x5daad4={};var _0x44aab6;var _0x1e1723;return db[_0xe726('0x28')]['findOne']({'where':{'id':_0x2b05b9[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x9d8ff4,null))[_0xe726('0x3e')](function(_0x7c54c7){if(_0x7c54c7){_0x44aab6=_0x7c54c7;_0x5daad4[_0xe726('0x2d')]=_[_0xe726('0x2f')](db[_0xe726('0x4a')]['rawAttributes']);_0x5daad4['query']=_['keys'](_0x2b05b9[_0xe726('0x2e')]);_0x5daad4[_0xe726('0x30')]=_[_0xe726('0x31')](_0x5daad4['model'],_0x5daad4[_0xe726('0x2e')]);_0xacf6cf[_0xe726('0x32')]=_[_0xe726('0x31')](_0x5daad4['model'],qs[_0xe726('0x33')](_0x2b05b9[_0xe726('0x2e')][_0xe726('0x33')]));_0xacf6cf[_0xe726('0x32')]=_0xacf6cf[_0xe726('0x32')][_0xe726('0x34')]?_0xacf6cf[_0xe726('0x32')]:_0x5daad4[_0xe726('0x2d')];_0xacf6cf['order']=qs[_0xe726('0x37')](_0x2b05b9[_0xe726('0x2e')][_0xe726('0x37')]);_0xacf6cf[_0xe726('0x3a')]=qs['filters'](_[_0xe726('0x38')](_0x2b05b9[_0xe726('0x2e')],_0x5daad4[_0xe726('0x30')]));if(_0x2b05b9[_0xe726('0x2e')][_0xe726('0x39')]){_0xacf6cf['where']=_['merge'](_0xacf6cf[_0xe726('0x3a')],{'$or':_[_0xe726('0x27')](_0xacf6cf['attributes'],function(_0x1d45db){var _0xe48cf2={};_0xe48cf2[_0x1d45db]={'$like':'%'+_0x2b05b9[_0xe726('0x2e')]['filter']+'%'};return _0xe48cf2;})});}_0xacf6cf=_[_0xe726('0x3b')]({},_0xacf6cf,_0x2b05b9[_0xe726('0x3d')]);return _0x44aab6[_0xe726('0x49')](_0xacf6cf);}})[_0xe726('0x3e')](function(_0x102afc){if(_0x102afc){_0x1e1723=_0x102afc['length'];if(!_0x2b05b9[_0xe726('0x2e')][_0xe726('0x4b')](_0xe726('0x35'))){_0xacf6cf['limit']=qs['limit'](_0x2b05b9[_0xe726('0x2e')][_0xe726('0x1f')]);_0xacf6cf['offset']=qs[_0xe726('0x1d')](_0x2b05b9['query'][_0xe726('0x1d')]);}return _0x44aab6[_0xe726('0x49')](_0xacf6cf);}})[_0xe726('0x3e')](function(_0x15d66c){if(_0x15d66c){return _0x15d66c?{'count':_0x1e1723,'rows':_0x15d66c}:null;}})['then'](respondWithResult(_0x9d8ff4,null))['catch'](handleError(_0x9d8ff4,null));};exports['getSubjects']=function(_0x3afdee,_0x2d9df2,_0x31e26a){var _0x4c9f29={};var _0xecef6d={};var _0x3bfad6;var _0x559089;return db[_0xe726('0x28')][_0xe726('0x4c')]({'where':{'id':_0x3afdee[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x2d9df2,null))[_0xe726('0x3e')](function(_0x5be3ab){if(_0x5be3ab){_0x3bfad6=_0x5be3ab;_0xecef6d[_0xe726('0x2d')]=_[_0xe726('0x2f')](db['ZendeskField'][_0xe726('0x29')]);_0xecef6d[_0xe726('0x2e')]=_['keys'](_0x3afdee['query']);_0xecef6d[_0xe726('0x30')]=_[_0xe726('0x31')](_0xecef6d[_0xe726('0x2d')],_0xecef6d[_0xe726('0x2e')]);_0x4c9f29['attributes']=_[_0xe726('0x31')](_0xecef6d[_0xe726('0x2d')],qs[_0xe726('0x33')](_0x3afdee[_0xe726('0x2e')][_0xe726('0x33')]));_0x4c9f29['attributes']=_0x4c9f29[_0xe726('0x32')][_0xe726('0x34')]?_0x4c9f29[_0xe726('0x32')]:_0xecef6d[_0xe726('0x2d')];_0x4c9f29[_0xe726('0x36')]=qs[_0xe726('0x37')](_0x3afdee[_0xe726('0x2e')][_0xe726('0x37')]);_0x4c9f29[_0xe726('0x3a')]=qs[_0xe726('0x30')](_[_0xe726('0x38')](_0x3afdee[_0xe726('0x2e')],_0xecef6d[_0xe726('0x30')]));if(_0x3afdee['query'][_0xe726('0x39')]){_0x4c9f29[_0xe726('0x3a')]=_['merge'](_0x4c9f29[_0xe726('0x3a')],{'$or':_[_0xe726('0x27')](_0x4c9f29[_0xe726('0x32')],function(_0x471baf){var _0x38dcb2={};_0x38dcb2[_0x471baf]={'$like':'%'+_0x3afdee['query'][_0xe726('0x39')]+'%'};return _0x38dcb2;})});}_0x4c9f29=_['merge']({},_0x4c9f29,_0x3afdee[_0xe726('0x3d')]);return _0x3bfad6[_0xe726('0x4d')](_0x4c9f29);}})['then'](function(_0x285571){if(_0x285571){_0x559089=_0x285571[_0xe726('0x34')];if(!_0x3afdee[_0xe726('0x2e')]['hasOwnProperty'](_0xe726('0x35'))){_0x4c9f29['limit']=qs[_0xe726('0x1f')](_0x3afdee[_0xe726('0x2e')][_0xe726('0x1f')]);_0x4c9f29[_0xe726('0x1d')]=qs[_0xe726('0x1d')](_0x3afdee[_0xe726('0x2e')][_0xe726('0x1d')]);}return _0x3bfad6['getSubjects'](_0x4c9f29);}})[_0xe726('0x3e')](function(_0x632490){if(_0x632490){return _0x632490?{'count':_0x559089,'rows':_0x632490}:null;}})['then'](respondWithResult(_0x2d9df2,null))['catch'](handleError(_0x2d9df2,null));};exports['getDescriptions']=function(_0x21509a,_0x1f1111,_0x5a42b4){var _0x186430={};var _0x5bef85={};var _0x41db4e;var _0x2d6f3a;return db[_0xe726('0x28')]['findOne']({'where':{'id':_0x21509a[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x1f1111,null))[_0xe726('0x3e')](function(_0x352fa5){if(_0x352fa5){_0x41db4e=_0x352fa5;_0x5bef85[_0xe726('0x2d')]=_[_0xe726('0x2f')](db[_0xe726('0x4a')]['rawAttributes']);_0x5bef85[_0xe726('0x2e')]=_['keys'](_0x21509a[_0xe726('0x2e')]);_0x5bef85[_0xe726('0x30')]=_[_0xe726('0x31')](_0x5bef85[_0xe726('0x2d')],_0x5bef85[_0xe726('0x2e')]);_0x186430[_0xe726('0x32')]=_['intersection'](_0x5bef85[_0xe726('0x2d')],qs['fields'](_0x21509a[_0xe726('0x2e')]['fields']));_0x186430[_0xe726('0x32')]=_0x186430[_0xe726('0x32')][_0xe726('0x34')]?_0x186430['attributes']:_0x5bef85[_0xe726('0x2d')];_0x186430[_0xe726('0x36')]=qs[_0xe726('0x37')](_0x21509a[_0xe726('0x2e')][_0xe726('0x37')]);_0x186430[_0xe726('0x3a')]=qs[_0xe726('0x30')](_[_0xe726('0x38')](_0x21509a[_0xe726('0x2e')],_0x5bef85[_0xe726('0x30')]));if(_0x21509a[_0xe726('0x2e')][_0xe726('0x39')]){_0x186430[_0xe726('0x3a')]=_['merge'](_0x186430[_0xe726('0x3a')],{'$or':_[_0xe726('0x27')](_0x186430['attributes'],function(_0x55655f){var _0x3c81c9={};_0x3c81c9[_0x55655f]={'$like':'%'+_0x21509a[_0xe726('0x2e')]['filter']+'%'};return _0x3c81c9;})});}_0x186430=_['merge']({},_0x186430,_0x21509a['options']);return _0x41db4e['getDescriptions'](_0x186430);}})[_0xe726('0x3e')](function(_0x5496ba){if(_0x5496ba){_0x2d6f3a=_0x5496ba['length'];if(!_0x21509a[_0xe726('0x2e')][_0xe726('0x4b')](_0xe726('0x35'))){_0x186430[_0xe726('0x1f')]=qs[_0xe726('0x1f')](_0x21509a[_0xe726('0x2e')]['limit']);_0x186430[_0xe726('0x1d')]=qs[_0xe726('0x1d')](_0x21509a[_0xe726('0x2e')]['offset']);}return _0x41db4e[_0xe726('0x4e')](_0x186430);}})[_0xe726('0x3e')](function(_0x17cc22){if(_0x17cc22){return _0x17cc22?{'count':_0x2d6f3a,'rows':_0x17cc22}:null;}})['then'](respondWithResult(_0x1f1111,null))['catch'](handleError(_0x1f1111,null));};exports['getTags']=function(_0x401fa5,_0x104046,_0x486873){var _0x1c06ef={};var _0xe1f6ae={};var _0x2c8276;var _0x51dbe0;return db['ZendeskConfiguration'][_0xe726('0x4c')]({'where':{'id':_0x401fa5[_0xe726('0x47')]['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x104046,null))['then'](function(_0x4dcf74){if(_0x4dcf74){_0x2c8276=_0x4dcf74;_0xe1f6ae[_0xe726('0x2d')]=_[_0xe726('0x2f')](db[_0xe726('0x4f')][_0xe726('0x29')]);_0xe1f6ae[_0xe726('0x2e')]=_[_0xe726('0x2f')](_0x401fa5[_0xe726('0x2e')]);_0xe1f6ae[_0xe726('0x30')]=_[_0xe726('0x31')](_0xe1f6ae[_0xe726('0x2d')],_0xe1f6ae[_0xe726('0x2e')]);_0x1c06ef[_0xe726('0x32')]=_['intersection'](_0xe1f6ae['model'],qs[_0xe726('0x33')](_0x401fa5[_0xe726('0x2e')][_0xe726('0x33')]));_0x1c06ef['attributes']=_0x1c06ef[_0xe726('0x32')][_0xe726('0x34')]?_0x1c06ef[_0xe726('0x32')]:_0xe1f6ae[_0xe726('0x2d')];_0x1c06ef['order']=qs['sort'](_0x401fa5[_0xe726('0x2e')][_0xe726('0x37')]);_0x1c06ef[_0xe726('0x3a')]=qs[_0xe726('0x30')](_[_0xe726('0x38')](_0x401fa5[_0xe726('0x2e')],_0xe1f6ae[_0xe726('0x30')]));if(_0x401fa5[_0xe726('0x2e')][_0xe726('0x39')]){_0x1c06ef[_0xe726('0x3a')]=_[_0xe726('0x3b')](_0x1c06ef[_0xe726('0x3a')],{'$or':_[_0xe726('0x27')](_0x1c06ef[_0xe726('0x32')],function(_0x378afa){var _0x58ee61={};_0x58ee61[_0x378afa]={'$like':'%'+_0x401fa5[_0xe726('0x2e')][_0xe726('0x39')]+'%'};return _0x58ee61;})});}_0x1c06ef=_[_0xe726('0x3b')]({},_0x1c06ef,_0x401fa5[_0xe726('0x3d')]);return _0x2c8276[_0xe726('0x50')](_0x1c06ef);}})['then'](function(_0x3cc5a2){if(_0x3cc5a2){_0x51dbe0=_0x3cc5a2[_0xe726('0x34')];if(!_0x401fa5[_0xe726('0x2e')][_0xe726('0x4b')](_0xe726('0x35'))){_0x1c06ef[_0xe726('0x1f')]=qs[_0xe726('0x1f')](_0x401fa5[_0xe726('0x2e')]['limit']);_0x1c06ef[_0xe726('0x1d')]=qs[_0xe726('0x1d')](_0x401fa5[_0xe726('0x2e')][_0xe726('0x1d')]);}return _0x2c8276[_0xe726('0x50')](_0x1c06ef);}})[_0xe726('0x3e')](function(_0x4d22a0){if(_0x4d22a0){return _0x4d22a0?{'count':_0x51dbe0,'rows':_0x4d22a0}:null;}})[_0xe726('0x3e')](respondWithResult(_0x104046,null))[_0xe726('0x41')](handleError(_0x104046,null));};exports['setTags']=function(_0x376857,_0x3395ad,_0x130506){if(_0x376857[_0xe726('0x46')]['id']){delete _0x376857[_0xe726('0x46')]['id'];}return db[_0xe726('0x28')]['findOne']({'where':{'id':_0x376857['params']['id']}})[_0xe726('0x3e')](handleEntityNotFound(_0x3395ad,null))[_0xe726('0x3e')](function(_0x46e3e5){if(_0x46e3e5){return _0x46e3e5[_0xe726('0x51')](_0x376857[_0xe726('0x46')][_0xe726('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3395ad,null))['catch'](handleError(_0x3395ad,null));}; \ No newline at end of file +var _0x2389=['../../mysqldb','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','fields','options','create','body','find','findOne','ZendeskField','order','pick','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x5c3a67,_0x48069f){var _0x3a32b6=function(_0x1b8fed){while(--_0x1b8fed){_0x5c3a67['push'](_0x5c3a67['shift']());}};_0x3a32b6(++_0x48069f);}(_0x2389,0x16f));var _0x9238=function(_0x2a1318,_0x233ee4){_0x2a1318=_0x2a1318-0x0;var _0x427bc4=_0x2389[_0x2a1318];return _0x427bc4;};'use strict';var emlformat=require(_0x9238('0x0'));var rimraf=require(_0x9238('0x1'));var zipdir=require(_0x9238('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9238('0x3'));var BPromise=require(_0x9238('0x4'));var Mustache=require('mustache');var util=require(_0x9238('0x5'));var path=require(_0x9238('0x6'));var sox=require('sox');var csv=require(_0x9238('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9238('0x8'));var squel=require(_0x9238('0x9'));var crypto=require(_0x9238('0xa'));var jsforce=require(_0x9238('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9238('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9238('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9238('0xd'));var as=require(_0x9238('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9238('0xf'));var utils=require('../../config/utils');var config=require(_0x9238('0x10'));var licenseUtil=require(_0x9238('0x11'));var db=require(_0x9238('0x12'))['db'];function respondWithStatusCode(_0x58c879,_0x3e62dc){_0x3e62dc=_0x3e62dc||0xcc;return function(_0x2e8e2f){if(_0x2e8e2f){return _0x58c879['sendStatus'](_0x3e62dc);}return _0x58c879[_0x9238('0x13')](_0x3e62dc)['end']();};}function respondWithResult(_0x4323f8,_0x4b9c0a){_0x4b9c0a=_0x4b9c0a||0xc8;return function(_0xc34c81){if(_0xc34c81){return _0x4323f8[_0x9238('0x13')](_0x4b9c0a)[_0x9238('0x14')](_0xc34c81);}};}function respondWithFilteredResult(_0x56a3bb,_0x1a0cad){return function(_0x56fa9){if(_0x56fa9){var _0x3366dd=typeof _0x1a0cad[_0x9238('0x15')]===_0x9238('0x16')&&typeof _0x1a0cad['limit']===_0x9238('0x16');var _0x1fbd3a=_0x56fa9['count'];var _0xf23c41=_0x3366dd?0x0:_0x1a0cad[_0x9238('0x15')];var _0x57331b=_0x3366dd?_0x56fa9[_0x9238('0x17')]:_0x1a0cad[_0x9238('0x15')]+_0x1a0cad['limit'];var _0x783e51;if(_0x57331b>=_0x1fbd3a){_0x57331b=_0x1fbd3a;_0x783e51=0xc8;}else{_0x783e51=0xce;}_0x56a3bb[_0x9238('0x13')](_0x783e51);return _0x56a3bb['set'](_0x9238('0x18'),_0xf23c41+'-'+_0x57331b+'/'+_0x1fbd3a)[_0x9238('0x14')](_0x56fa9);}return null;};}function patchUpdates(_0x251bff){return function(_0xeb6cf2){try{jsonpatch[_0x9238('0x19')](_0xeb6cf2,_0x251bff,!![]);}catch(_0x13c527){return BPromise[_0x9238('0x1a')](_0x13c527);}return _0xeb6cf2['save']();};}function saveUpdates(_0x4c170d,_0x33b98e){return function(_0x3e5f5b){if(_0x3e5f5b){return _0x3e5f5b[_0x9238('0x1b')](_0x4c170d)[_0x9238('0x1c')](function(_0x5b95c7){return _0x5b95c7;});}return null;};}function removeEntity(_0xb5ec61,_0x5bedf2){return function(_0x94e348){if(_0x94e348){return _0x94e348[_0x9238('0x1d')]()[_0x9238('0x1c')](function(){_0xb5ec61['status'](0xcc)[_0x9238('0x1e')]();});}};}function handleEntityNotFound(_0x5dcbed,_0x3bbcda){return function(_0x44284c){if(!_0x44284c){_0x5dcbed[_0x9238('0x1f')](0x194);}return _0x44284c;};}function handleError(_0x3c9d4c,_0x351348){_0x351348=_0x351348||0x1f4;return function(_0x59702f){logger[_0x9238('0x20')](_0x59702f['stack']);if(_0x59702f['name']){delete _0x59702f[_0x9238('0x21')];}_0x3c9d4c[_0x9238('0x13')](_0x351348)[_0x9238('0x22')](_0x59702f);};}exports[_0x9238('0x23')]=function(_0x13f7ed,_0x5c1d22){var _0x3bec92={},_0x47ad47={},_0x1f3f80={'count':0x0,'rows':[]};var _0x13db3e=_[_0x9238('0x24')](db[_0x9238('0x25')][_0x9238('0x26')],function(_0x3074b4){return{'name':_0x3074b4[_0x9238('0x27')],'type':_0x3074b4['type']['key']};});_0x47ad47[_0x9238('0x28')]=_['map'](_0x13db3e,'name');_0x47ad47[_0x9238('0x29')]=_['keys'](_0x13f7ed[_0x9238('0x29')]);_0x47ad47[_0x9238('0x2a')]=_[_0x9238('0x2b')](_0x47ad47[_0x9238('0x28')],_0x47ad47[_0x9238('0x29')]);_0x3bec92[_0x9238('0x2c')]=_[_0x9238('0x2b')](_0x47ad47[_0x9238('0x28')],qs['fields'](_0x13f7ed[_0x9238('0x29')]['fields']));_0x3bec92['attributes']=_0x3bec92[_0x9238('0x2c')][_0x9238('0x2d')]?_0x3bec92['attributes']:_0x47ad47['model'];if(!_0x13f7ed[_0x9238('0x29')][_0x9238('0x2e')]('nolimit')){_0x3bec92[_0x9238('0x2f')]=qs[_0x9238('0x2f')](_0x13f7ed['query']['limit']);_0x3bec92[_0x9238('0x15')]=qs[_0x9238('0x15')](_0x13f7ed[_0x9238('0x29')][_0x9238('0x15')]);}_0x3bec92['order']=qs[_0x9238('0x30')](_0x13f7ed[_0x9238('0x29')][_0x9238('0x30')]);_0x3bec92[_0x9238('0x31')]=qs[_0x9238('0x2a')](_['pick'](_0x13f7ed[_0x9238('0x29')],_0x47ad47[_0x9238('0x2a')]),_0x13db3e);if(_0x13f7ed[_0x9238('0x29')]['filter']){_0x3bec92[_0x9238('0x31')]=_[_0x9238('0x32')](_0x3bec92[_0x9238('0x31')],{'$or':_[_0x9238('0x24')](_0x13db3e,function(_0x48bc1d){if(_0x48bc1d[_0x9238('0x33')]!==_0x9238('0x34')){var _0x1a5273={};_0x1a5273[_0x48bc1d[_0x9238('0x21')]]={'$like':'%'+_0x13f7ed['query'][_0x9238('0x35')]+'%'};return _0x1a5273;}})});}_0x3bec92=_[_0x9238('0x32')]({},_0x3bec92,_0x13f7ed['options']);var _0xc54f2={'where':_0x3bec92[_0x9238('0x31')]};return db[_0x9238('0x25')][_0x9238('0x17')](_0xc54f2)[_0x9238('0x1c')](function(_0x30db61){_0x1f3f80[_0x9238('0x17')]=_0x30db61;if(_0x13f7ed[_0x9238('0x29')][_0x9238('0x36')]){_0x3bec92[_0x9238('0x37')]=[{'all':!![]}];}return db[_0x9238('0x25')][_0x9238('0x38')](_0x3bec92);})[_0x9238('0x1c')](function(_0x448235){_0x1f3f80['rows']=_0x448235;return _0x1f3f80;})['then'](respondWithFilteredResult(_0x5c1d22,_0x3bec92))[_0x9238('0x39')](handleError(_0x5c1d22,null));};exports[_0x9238('0x3a')]=function(_0x464fa8,_0x8e9017){var _0x3e82c4={'raw':![],'where':{'id':_0x464fa8[_0x9238('0x3b')]['id']}},_0x4bb2e3={};_0x4bb2e3['model']=_[_0x9238('0x3c')](db['ZendeskConfiguration'][_0x9238('0x26')]);_0x4bb2e3['query']=_[_0x9238('0x3c')](_0x464fa8[_0x9238('0x29')]);_0x4bb2e3['filters']=_[_0x9238('0x2b')](_0x4bb2e3[_0x9238('0x28')],_0x4bb2e3[_0x9238('0x29')]);_0x3e82c4['attributes']=_['intersection'](_0x4bb2e3[_0x9238('0x28')],qs[_0x9238('0x3d')](_0x464fa8[_0x9238('0x29')][_0x9238('0x3d')]));_0x3e82c4[_0x9238('0x2c')]=_0x3e82c4[_0x9238('0x2c')][_0x9238('0x2d')]?_0x3e82c4['attributes']:_0x4bb2e3[_0x9238('0x28')];if(_0x464fa8[_0x9238('0x29')][_0x9238('0x36')]){_0x3e82c4[_0x9238('0x37')]=[{'all':!![]}];}_0x3e82c4=_[_0x9238('0x32')]({},_0x3e82c4,_0x464fa8[_0x9238('0x3e')]);return db[_0x9238('0x25')]['find'](_0x3e82c4)['then'](handleEntityNotFound(_0x8e9017,null))[_0x9238('0x1c')](respondWithResult(_0x8e9017,null))['catch'](handleError(_0x8e9017,null));};exports[_0x9238('0x3f')]=function(_0x366d6d,_0x3ff17a){return db[_0x9238('0x25')][_0x9238('0x3f')](_0x366d6d['body'],{})['then'](respondWithResult(_0x3ff17a,0xc9))[_0x9238('0x39')](handleError(_0x3ff17a,null));};exports[_0x9238('0x1b')]=function(_0x2e8b1d,_0x3ea650){if(_0x2e8b1d['body']['id']){delete _0x2e8b1d[_0x9238('0x40')]['id'];}return db[_0x9238('0x25')][_0x9238('0x41')]({'where':{'id':_0x2e8b1d[_0x9238('0x3b')]['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x3ea650,null))[_0x9238('0x1c')](saveUpdates(_0x2e8b1d[_0x9238('0x40')],null))[_0x9238('0x1c')](respondWithResult(_0x3ea650,null))[_0x9238('0x39')](handleError(_0x3ea650,null));};exports[_0x9238('0x1d')]=function(_0x4ffe82,_0x15b568){return db[_0x9238('0x25')][_0x9238('0x41')]({'where':{'id':_0x4ffe82[_0x9238('0x3b')]['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x15b568,null))[_0x9238('0x1c')](removeEntity(_0x15b568,null))[_0x9238('0x39')](handleError(_0x15b568,null));};exports['getFields']=function(_0x27b384,_0x134d89,_0x10ab30){var _0xd602fd={};var _0x55f27d={};var _0x163b4a;var _0x154554;return db[_0x9238('0x25')][_0x9238('0x42')]({'where':{'id':_0x27b384[_0x9238('0x3b')]['id']}})['then'](handleEntityNotFound(_0x134d89,null))[_0x9238('0x1c')](function(_0x2275cf){if(_0x2275cf){_0x163b4a=_0x2275cf;_0x55f27d['model']=_[_0x9238('0x3c')](db[_0x9238('0x43')][_0x9238('0x26')]);_0x55f27d[_0x9238('0x29')]=_[_0x9238('0x3c')](_0x27b384[_0x9238('0x29')]);_0x55f27d['filters']=_[_0x9238('0x2b')](_0x55f27d[_0x9238('0x28')],_0x55f27d[_0x9238('0x29')]);_0xd602fd[_0x9238('0x2c')]=_[_0x9238('0x2b')](_0x55f27d['model'],qs[_0x9238('0x3d')](_0x27b384[_0x9238('0x29')][_0x9238('0x3d')]));_0xd602fd[_0x9238('0x2c')]=_0xd602fd['attributes']['length']?_0xd602fd[_0x9238('0x2c')]:_0x55f27d[_0x9238('0x28')];_0xd602fd[_0x9238('0x44')]=qs['sort'](_0x27b384['query']['sort']);_0xd602fd[_0x9238('0x31')]=qs[_0x9238('0x2a')](_[_0x9238('0x45')](_0x27b384['query'],_0x55f27d['filters']));if(_0x27b384[_0x9238('0x29')][_0x9238('0x35')]){_0xd602fd[_0x9238('0x31')]=_[_0x9238('0x32')](_0xd602fd[_0x9238('0x31')],{'$or':_['map'](_0xd602fd[_0x9238('0x2c')],function(_0x20e819){var _0x213f4a={};_0x213f4a[_0x20e819]={'$like':'%'+_0x27b384['query'][_0x9238('0x35')]+'%'};return _0x213f4a;})});}_0xd602fd=_[_0x9238('0x32')]({},_0xd602fd,_0x27b384[_0x9238('0x3e')]);return _0x163b4a[_0x9238('0x46')](_0xd602fd);}})['then'](function(_0x4d1018){if(_0x4d1018){_0x154554=_0x4d1018['length'];if(!_0x27b384['query'][_0x9238('0x2e')](_0x9238('0x47'))){_0xd602fd['limit']=qs[_0x9238('0x2f')](_0x27b384['query'][_0x9238('0x2f')]);_0xd602fd[_0x9238('0x15')]=qs[_0x9238('0x15')](_0x27b384['query'][_0x9238('0x15')]);}return _0x163b4a[_0x9238('0x46')](_0xd602fd);}})[_0x9238('0x1c')](function(_0x2aa52f){if(_0x2aa52f){return _0x2aa52f?{'count':_0x154554,'rows':_0x2aa52f}:null;}})[_0x9238('0x1c')](respondWithResult(_0x134d89,null))[_0x9238('0x39')](handleError(_0x134d89,null));};exports[_0x9238('0x48')]=function(_0x427ef1,_0x56fd0d,_0x5294ec){var _0x5b9f12={};var _0x96aeef={};var _0xa035fc;var _0x3f67ee;return db[_0x9238('0x25')]['findOne']({'where':{'id':_0x427ef1['params']['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x56fd0d,null))['then'](function(_0x46e6d3){if(_0x46e6d3){_0xa035fc=_0x46e6d3;_0x96aeef[_0x9238('0x28')]=_[_0x9238('0x3c')](db[_0x9238('0x43')][_0x9238('0x26')]);_0x96aeef[_0x9238('0x29')]=_[_0x9238('0x3c')](_0x427ef1['query']);_0x96aeef['filters']=_['intersection'](_0x96aeef[_0x9238('0x28')],_0x96aeef[_0x9238('0x29')]);_0x5b9f12[_0x9238('0x2c')]=_[_0x9238('0x2b')](_0x96aeef['model'],qs[_0x9238('0x3d')](_0x427ef1['query'][_0x9238('0x3d')]));_0x5b9f12[_0x9238('0x2c')]=_0x5b9f12[_0x9238('0x2c')][_0x9238('0x2d')]?_0x5b9f12[_0x9238('0x2c')]:_0x96aeef[_0x9238('0x28')];_0x5b9f12['order']=qs[_0x9238('0x30')](_0x427ef1[_0x9238('0x29')][_0x9238('0x30')]);_0x5b9f12[_0x9238('0x31')]=qs[_0x9238('0x2a')](_[_0x9238('0x45')](_0x427ef1[_0x9238('0x29')],_0x96aeef['filters']));if(_0x427ef1[_0x9238('0x29')][_0x9238('0x35')]){_0x5b9f12[_0x9238('0x31')]=_[_0x9238('0x32')](_0x5b9f12[_0x9238('0x31')],{'$or':_[_0x9238('0x24')](_0x5b9f12[_0x9238('0x2c')],function(_0x5e3423){var _0x42ce6f={};_0x42ce6f[_0x5e3423]={'$like':'%'+_0x427ef1[_0x9238('0x29')][_0x9238('0x35')]+'%'};return _0x42ce6f;})});}_0x5b9f12=_['merge']({},_0x5b9f12,_0x427ef1['options']);return _0xa035fc[_0x9238('0x48')](_0x5b9f12);}})['then'](function(_0x234f75){if(_0x234f75){_0x3f67ee=_0x234f75[_0x9238('0x2d')];if(!_0x427ef1[_0x9238('0x29')][_0x9238('0x2e')](_0x9238('0x47'))){_0x5b9f12[_0x9238('0x2f')]=qs['limit'](_0x427ef1['query']['limit']);_0x5b9f12[_0x9238('0x15')]=qs[_0x9238('0x15')](_0x427ef1[_0x9238('0x29')]['offset']);}return _0xa035fc[_0x9238('0x48')](_0x5b9f12);}})[_0x9238('0x1c')](function(_0x2b5904){if(_0x2b5904){return _0x2b5904?{'count':_0x3f67ee,'rows':_0x2b5904}:null;}})[_0x9238('0x1c')](respondWithResult(_0x56fd0d,null))[_0x9238('0x39')](handleError(_0x56fd0d,null));};exports[_0x9238('0x49')]=function(_0x55df40,_0x40b760,_0x4be48a){var _0x32317e={};var _0x54a142={};var _0x17fe97;var _0x43b212;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x55df40['params']['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x40b760,null))[_0x9238('0x1c')](function(_0x5d4fb5){if(_0x5d4fb5){_0x17fe97=_0x5d4fb5;_0x54a142[_0x9238('0x28')]=_[_0x9238('0x3c')](db[_0x9238('0x43')]['rawAttributes']);_0x54a142[_0x9238('0x29')]=_[_0x9238('0x3c')](_0x55df40['query']);_0x54a142[_0x9238('0x2a')]=_[_0x9238('0x2b')](_0x54a142[_0x9238('0x28')],_0x54a142[_0x9238('0x29')]);_0x32317e[_0x9238('0x2c')]=_[_0x9238('0x2b')](_0x54a142[_0x9238('0x28')],qs['fields'](_0x55df40['query'][_0x9238('0x3d')]));_0x32317e['attributes']=_0x32317e[_0x9238('0x2c')][_0x9238('0x2d')]?_0x32317e['attributes']:_0x54a142[_0x9238('0x28')];_0x32317e[_0x9238('0x44')]=qs[_0x9238('0x30')](_0x55df40[_0x9238('0x29')][_0x9238('0x30')]);_0x32317e[_0x9238('0x31')]=qs[_0x9238('0x2a')](_['pick'](_0x55df40[_0x9238('0x29')],_0x54a142['filters']));if(_0x55df40[_0x9238('0x29')][_0x9238('0x35')]){_0x32317e[_0x9238('0x31')]=_[_0x9238('0x32')](_0x32317e['where'],{'$or':_[_0x9238('0x24')](_0x32317e['attributes'],function(_0x29f2d2){var _0x2029ff={};_0x2029ff[_0x29f2d2]={'$like':'%'+_0x55df40['query']['filter']+'%'};return _0x2029ff;})});}_0x32317e=_[_0x9238('0x32')]({},_0x32317e,_0x55df40['options']);return _0x17fe97[_0x9238('0x49')](_0x32317e);}})[_0x9238('0x1c')](function(_0x1b6609){if(_0x1b6609){_0x43b212=_0x1b6609[_0x9238('0x2d')];if(!_0x55df40[_0x9238('0x29')][_0x9238('0x2e')](_0x9238('0x47'))){_0x32317e[_0x9238('0x2f')]=qs[_0x9238('0x2f')](_0x55df40[_0x9238('0x29')][_0x9238('0x2f')]);_0x32317e[_0x9238('0x15')]=qs[_0x9238('0x15')](_0x55df40[_0x9238('0x29')]['offset']);}return _0x17fe97['getDescriptions'](_0x32317e);}})['then'](function(_0x31ce7b){if(_0x31ce7b){return _0x31ce7b?{'count':_0x43b212,'rows':_0x31ce7b}:null;}})[_0x9238('0x1c')](respondWithResult(_0x40b760,null))[_0x9238('0x39')](handleError(_0x40b760,null));};exports[_0x9238('0x4a')]=function(_0x47e3b4,_0x480899,_0x6ce6e6){var _0x4d9974={};var _0x444a02={};var _0x3c4bde;var _0x322b46;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x47e3b4['params']['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x480899,null))[_0x9238('0x1c')](function(_0x1463d3){if(_0x1463d3){_0x3c4bde=_0x1463d3;_0x444a02[_0x9238('0x28')]=_[_0x9238('0x3c')](db[_0x9238('0x4b')][_0x9238('0x26')]);_0x444a02[_0x9238('0x29')]=_['keys'](_0x47e3b4['query']);_0x444a02['filters']=_[_0x9238('0x2b')](_0x444a02[_0x9238('0x28')],_0x444a02['query']);_0x4d9974[_0x9238('0x2c')]=_[_0x9238('0x2b')](_0x444a02[_0x9238('0x28')],qs[_0x9238('0x3d')](_0x47e3b4['query']['fields']));_0x4d9974['attributes']=_0x4d9974[_0x9238('0x2c')][_0x9238('0x2d')]?_0x4d9974[_0x9238('0x2c')]:_0x444a02['model'];_0x4d9974['order']=qs[_0x9238('0x30')](_0x47e3b4[_0x9238('0x29')]['sort']);_0x4d9974[_0x9238('0x31')]=qs[_0x9238('0x2a')](_[_0x9238('0x45')](_0x47e3b4[_0x9238('0x29')],_0x444a02[_0x9238('0x2a')]));if(_0x47e3b4[_0x9238('0x29')]['filter']){_0x4d9974[_0x9238('0x31')]=_[_0x9238('0x32')](_0x4d9974['where'],{'$or':_['map'](_0x4d9974[_0x9238('0x2c')],function(_0x4da5ec){var _0xd3f9f3={};_0xd3f9f3[_0x4da5ec]={'$like':'%'+_0x47e3b4['query'][_0x9238('0x35')]+'%'};return _0xd3f9f3;})});}_0x4d9974=_[_0x9238('0x32')]({},_0x4d9974,_0x47e3b4[_0x9238('0x3e')]);return _0x3c4bde[_0x9238('0x4a')](_0x4d9974);}})[_0x9238('0x1c')](function(_0x4dd0df){if(_0x4dd0df){_0x322b46=_0x4dd0df[_0x9238('0x2d')];if(!_0x47e3b4[_0x9238('0x29')][_0x9238('0x2e')]('nolimit')){_0x4d9974[_0x9238('0x2f')]=qs[_0x9238('0x2f')](_0x47e3b4['query']['limit']);_0x4d9974[_0x9238('0x15')]=qs[_0x9238('0x15')](_0x47e3b4[_0x9238('0x29')][_0x9238('0x15')]);}return _0x3c4bde[_0x9238('0x4a')](_0x4d9974);}})[_0x9238('0x1c')](function(_0x411778){if(_0x411778){return _0x411778?{'count':_0x322b46,'rows':_0x411778}:null;}})['then'](respondWithResult(_0x480899,null))['catch'](handleError(_0x480899,null));};exports['setTags']=function(_0xdfcb89,_0x575c0f,_0xc7b10f){if(_0xdfcb89[_0x9238('0x40')]['id']){delete _0xdfcb89[_0x9238('0x40')]['id'];}return db['ZendeskConfiguration'][_0x9238('0x42')]({'where':{'id':_0xdfcb89[_0x9238('0x3b')]['id']}})[_0x9238('0x1c')](handleEntityNotFound(_0x575c0f,null))['then'](function(_0x5af828){if(_0x5af828){return _0x5af828[_0x9238('0x4c')](_0xdfcb89[_0x9238('0x40')]['ids']||[]);}return null;})['then'](respondWithResult(_0x575c0f,null))['catch'](handleError(_0x575c0f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6c8b2cb..ebb5cdb 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 _0xae60=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3f6572,_0x236cfb){var _0x4770ff=function(_0x354656){while(--_0x354656){_0x3f6572['push'](_0x3f6572['shift']());}};_0x4770ff(++_0x236cfb);}(_0xae60,0x1c7));var _0x0ae6=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xae60[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['../../config/logger','moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x3e7e16,_0x1cfd6e){var _0x2f5052=function(_0x1f1e53){while(--_0x1f1e53){_0x3e7e16['push'](_0x3e7e16['shift']());}};_0x2f5052(++_0x1cfd6e);}(_0xb44a,0x1c2));var _0xab44=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0xb44a[_0x3a4203];return _0x1a5661;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'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 2849b2c..c7d107c 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 _0x7fea=['ZendeskConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','error'];(function(_0x5b2412,_0x146503){var _0x30ca6d=function(_0x4f8037){while(--_0x4f8037){_0x5b2412['push'](_0x5b2412['shift']());}};_0x30ca6d(++_0x146503);}(_0x7fea,0x18a));var _0xa7fe=function(_0x3080a4,_0x8438fa){_0x3080a4=_0x3080a4-0x0;var _0x375c93=_0x7fea[_0x3080a4];return _0x375c93;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rs=require(_0xa7fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require(_0xa7fe('0x7'));var jayson=require(_0xa7fe('0x8'));var client=jayson['client'][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d7b66,_0x429a1f,_0x59d2e2){return new BPromise(function(_0x1bdcad,_0x2269a7){return client[_0xa7fe('0xa')](_0x1d7b66,_0x59d2e2)['then'](function(_0x581634){logger[_0xa7fe('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x429a1f,_0xa7fe('0xc'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x429a1f,_0xa7fe('0xc'),JSON['stringify'](_0x581634));if(_0x581634[_0xa7fe('0xd')]){if(_0x581634['error']['code']===0x1f4){logger[_0xa7fe('0xd')](_0xa7fe('0xe'),_0x429a1f,_0x581634[_0xa7fe('0xd')][_0xa7fe('0xf')]);return _0x2269a7(_0x581634[_0xa7fe('0xd')][_0xa7fe('0xf')]);}logger[_0xa7fe('0xd')](_0xa7fe('0xe'),_0x429a1f,_0x581634['error'][_0xa7fe('0xf')]);return _0x1bdcad(_0x581634[_0xa7fe('0xd')]['message']);}else{logger[_0xa7fe('0xb')](_0xa7fe('0xe'),_0x429a1f,_0xa7fe('0xc'));_0x1bdcad(_0x581634[_0xa7fe('0x10')][_0xa7fe('0xf')]);}})['catch'](function(_0x22382e){logger[_0xa7fe('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x429a1f,_0x22382e);_0x2269a7(_0x22382e);});});} \ No newline at end of file +var _0x37b7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x37b7,0x17d));var _0x737b=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x37b7[_0x47242d];return _0x30273a;};'use strict';var _=require(_0x737b('0x0'));var util=require(_0x737b('0x1'));var moment=require(_0x737b('0x2'));var BPromise=require(_0x737b('0x3'));var rs=require(_0x737b('0x4'));var fs=require('fs');var Redis=require(_0x737b('0x5'));var db=require(_0x737b('0x6'))['db'];var utils=require(_0x737b('0x7'));var logger=require(_0x737b('0x8'))(_0x737b('0x9'));var config=require(_0x737b('0xa'));var jayson=require(_0x737b('0xb'));var client=jayson['client'][_0x737b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b843e,_0x283daa,_0x114cfd){return new BPromise(function(_0x27f7cc,_0x59187e){return client[_0x737b('0xd')](_0x1b843e,_0x114cfd)[_0x737b('0xe')](function(_0x4556a0){logger[_0x737b('0xf')](_0x737b('0x10'),_0x283daa,_0x737b('0x11'));logger[_0x737b('0x12')](_0x737b('0x13'),_0x283daa,_0x737b('0x11'),JSON['stringify'](_0x4556a0));if(_0x4556a0['error']){if(_0x4556a0[_0x737b('0x14')]['code']===0x1f4){logger[_0x737b('0x14')](_0x737b('0x10'),_0x283daa,_0x4556a0['error'][_0x737b('0x15')]);return _0x59187e(_0x4556a0[_0x737b('0x14')][_0x737b('0x15')]);}logger['error'](_0x737b('0x10'),_0x283daa,_0x4556a0['error'][_0x737b('0x15')]);return _0x27f7cc(_0x4556a0[_0x737b('0x14')][_0x737b('0x15')]);}else{logger[_0x737b('0xf')](_0x737b('0x10'),_0x283daa,_0x737b('0x11'));_0x27f7cc(_0x4556a0[_0x737b('0x16')][_0x737b('0x15')]);}})[_0x737b('0x17')](function(_0x27a0f8){logger[_0x737b('0x14')](_0x737b('0x10'),_0x283daa,_0x27a0f8);_0x59187e(_0x27a0f8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ce229a2..3c03f83 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 _0xe2df=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','post','put','update','/:id','destroy','exports','path','connect-timeout','fs-extra'];(function(_0x1b6856,_0x3f157e){var _0x3a94e6=function(_0x2c304a){while(--_0x2c304a){_0x1b6856['push'](_0x1b6856['shift']());}};_0x3a94e6(++_0x3f157e);}(_0xe2df,0xfc));var _0xfe2d=function(_0x44ee57,_0x104da9){_0x44ee57=_0x44ee57-0x0;var _0xed9066=_0xe2df[_0x44ee57];return _0xed9066;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe2d('0x0'));var timeout=require(_0xfe2d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe2d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfe2d('0x3'));var config=require(_0xfe2d('0x4'));var controller=require(_0xfe2d('0x5'));router['get']('/',auth[_0xfe2d('0x6')](),controller[_0xfe2d('0x7')]);router[_0xfe2d('0x8')]('/:id',auth[_0xfe2d('0x6')](),controller['show']);router[_0xfe2d('0x9')]('/',auth[_0xfe2d('0x6')](),controller['create']);router[_0xfe2d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfe2d('0xb')]);router['delete'](_0xfe2d('0xc'),auth[_0xfe2d('0x6')](),controller[_0xfe2d('0xd')]);module[_0xfe2d('0xe')]=router; \ No newline at end of file +var _0x2b34=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','isAuthenticated','show','create','put','/:id','update','delete','destroy'];(function(_0x318bb0,_0x1d7871){var _0x363cd9=function(_0xbb3e8e){while(--_0xbb3e8e){_0x318bb0['push'](_0x318bb0['shift']());}};_0x363cd9(++_0x1d7871);}(_0x2b34,0xea));var _0x42b3=function(_0x2c5009,_0x63505f){_0x2c5009=_0x2c5009-0x0;var _0x40b7f9=_0x2b34[_0x2c5009];return _0x40b7f9;};'use strict';var multer=require(_0x42b3('0x0'));var util=require(_0x42b3('0x1'));var path=require(_0x42b3('0x2'));var timeout=require(_0x42b3('0x3'));var express=require('express');var router=express[_0x42b3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x42b3('0x5'));var config=require(_0x42b3('0x6'));var controller=require(_0x42b3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x42b3('0x8')]);router[_0x42b3('0x9')]('/:id',auth[_0x42b3('0xa')](),controller[_0x42b3('0xb')]);router['post']('/',auth[_0x42b3('0xa')](),controller[_0x42b3('0xc')]);router[_0x42b3('0xd')](_0x42b3('0xe'),auth[_0x42b3('0xa')](),controller[_0x42b3('0xf')]);router[_0x42b3('0x10')]('/:id',auth[_0x42b3('0xa')](),controller[_0x42b3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 45d3dca..f8c6f9b 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 _0x0d7b=['string','STRING','sequelize','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3380e2,_0x3fb22e){var _0xcf8cbb=function(_0xd81aa5){while(--_0xd81aa5){_0x3380e2['push'](_0x3380e2['shift']());}};_0xcf8cbb(++_0x3fb22e);}(_0x0d7b,0x1e2));var _0xb0d7=function(_0x4fc43b,_0x1f5b6b){_0x4fc43b=_0x4fc43b-0x0;var _0x484bd9=_0x0d7b[_0x4fc43b];return _0x484bd9;};'use strict';var Sequelize=require(_0xb0d7('0x0'));module['exports']={'type':{'type':Sequelize[_0xb0d7('0x1')]('string',_0xb0d7('0x2'),_0xb0d7('0x3'),_0xb0d7('0x4'),_0xb0d7('0x5')),'defaultValue':_0xb0d7('0x6')},'content':{'type':Sequelize[_0xb0d7('0x7')]},'key':{'type':Sequelize[_0xb0d7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb0d7('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb0d7('0x7')]},'idField':{'type':Sequelize[_0xb0d7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0d7('0x7')]}}; \ No newline at end of file +var _0xccff=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xccff,0x188));var _0xfccf=function(_0x3fa435,_0x152d94){_0x3fa435=_0x3fa435-0x0;var _0x5dc72e=_0xccff[_0x3fa435];return _0x5dc72e;};'use strict';var Sequelize=require(_0xfccf('0x0'));module[_0xfccf('0x1')]={'type':{'type':Sequelize[_0xfccf('0x2')](_0xfccf('0x3'),_0xfccf('0x4'),_0xfccf('0x5'),_0xfccf('0x6'),_0xfccf('0x7')),'defaultValue':_0xfccf('0x3')},'content':{'type':Sequelize[_0xfccf('0x8')]},'key':{'type':Sequelize[_0xfccf('0x8')]},'keyType':{'type':Sequelize[_0xfccf('0x2')](_0xfccf('0x3'),_0xfccf('0x4'),_0xfccf('0x5'))},'keyContent':{'type':Sequelize[_0xfccf('0x8')]},'idField':{'type':Sequelize[_0xfccf('0x8')]},'nameField':{'type':Sequelize[_0xfccf('0x8')]},'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 9bae3f3..e14f3b2 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 _0xd594=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x17340a,_0x365ee5){var _0x389883=function(_0x47fe8c){while(--_0x47fe8c){_0x17340a['push'](_0x17340a['shift']());}};_0x389883(++_0x365ee5);}(_0xd594,0xab));var _0x4d59=function(_0x4365c3,_0x1a0bec){_0x4365c3=_0x4365c3-0x0;var _0x529a59=_0xd594[_0x4365c3];return _0x529a59;};'use strict';var emlformat=require(_0x4d59('0x0'));var rimraf=require(_0x4d59('0x1'));var zipdir=require(_0x4d59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d59('0x3'));var moment=require(_0x4d59('0x4'));var BPromise=require(_0x4d59('0x5'));var Mustache=require('mustache');var util=require(_0x4d59('0x6'));var path=require(_0x4d59('0x7'));var sox=require(_0x4d59('0x8'));var csv=require('to-csv');var ejs=require(_0x4d59('0x9'));var fs=require('fs');var fs_extra=require(_0x4d59('0xa'));var _=require(_0x4d59('0xb'));var squel=require(_0x4d59('0xc'));var crypto=require('crypto');var jsforce=require(_0x4d59('0xd'));var deskjs=require(_0x4d59('0xe'));var toCsv=require(_0x4d59('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d59('0x10'));var authService=require(_0x4d59('0x11'));var qs=require(_0x4d59('0x12'));var as=require(_0x4d59('0x13'));var hardwareService=require(_0x4d59('0x14'));var logger=require(_0x4d59('0x15'))(_0x4d59('0x16'));var utils=require(_0x4d59('0x17'));var config=require(_0x4d59('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae0f4,_0x4c284c){_0x4c284c=_0x4c284c||0xcc;return function(_0x4eed5b){if(_0x4eed5b){return _0x4ae0f4[_0x4d59('0x19')](_0x4c284c);}return _0x4ae0f4[_0x4d59('0x1a')](_0x4c284c)[_0x4d59('0x1b')]();};}function respondWithResult(_0x24ae09,_0x3580be){_0x3580be=_0x3580be||0xc8;return function(_0x5e2197){if(_0x5e2197){return _0x24ae09[_0x4d59('0x1a')](_0x3580be)[_0x4d59('0x1c')](_0x5e2197);}};}function respondWithFilteredResult(_0x30d64f,_0x2a140b){return function(_0x57c6ce){if(_0x57c6ce){var _0x3b9a45=typeof _0x2a140b['offset']===_0x4d59('0x1d')&&typeof _0x2a140b[_0x4d59('0x1e')]==='undefined';var _0x4d0966=_0x57c6ce[_0x4d59('0x1f')];var _0x5bd6f9=_0x3b9a45?0x0:_0x2a140b[_0x4d59('0x20')];var _0x1ad221=_0x3b9a45?_0x57c6ce[_0x4d59('0x1f')]:_0x2a140b[_0x4d59('0x20')]+_0x2a140b[_0x4d59('0x1e')];var _0x361949;if(_0x1ad221>=_0x4d0966){_0x1ad221=_0x4d0966;_0x361949=0xc8;}else{_0x361949=0xce;}_0x30d64f[_0x4d59('0x1a')](_0x361949);return _0x30d64f[_0x4d59('0x21')]('Content-Range',_0x5bd6f9+'-'+_0x1ad221+'/'+_0x4d0966)[_0x4d59('0x1c')](_0x57c6ce);}return null;};}function patchUpdates(_0x5d9294){return function(_0x4b953){try{jsonpatch[_0x4d59('0x22')](_0x4b953,_0x5d9294,!![]);}catch(_0x3ed1db){return BPromise[_0x4d59('0x23')](_0x3ed1db);}return _0x4b953['save']();};}function saveUpdates(_0x3aa6df,_0x11173b){return function(_0x37bc6f){if(_0x37bc6f){return _0x37bc6f[_0x4d59('0x24')](_0x3aa6df)[_0x4d59('0x25')](function(_0x2b73fa){return _0x2b73fa;});}return null;};}function removeEntity(_0x54b1a7,_0x30ed59){return function(_0x59fb05){if(_0x59fb05){return _0x59fb05[_0x4d59('0x26')]()[_0x4d59('0x25')](function(){_0x54b1a7[_0x4d59('0x1a')](0xcc)[_0x4d59('0x1b')]();});}};}function handleEntityNotFound(_0x42f649,_0x5096b9){return function(_0x40228b){if(!_0x40228b){_0x42f649['sendStatus'](0x194);}return _0x40228b;};}function handleError(_0xbb4030,_0x596096){_0x596096=_0x596096||0x1f4;return function(_0x1021c0){logger[_0x4d59('0x27')](_0x1021c0['stack']);if(_0x1021c0[_0x4d59('0x28')]){delete _0x1021c0[_0x4d59('0x28')];}_0xbb4030['status'](_0x596096)[_0x4d59('0x29')](_0x1021c0);};}exports[_0x4d59('0x2a')]=function(_0x4b0142,_0x3a6f76){var _0x320a17={},_0x11013c={},_0x14a919={'count':0x0,'rows':[]};var _0x1b40ea=_[_0x4d59('0x2b')](db[_0x4d59('0x2c')][_0x4d59('0x2d')],function(_0x1cce3f){return{'name':_0x1cce3f[_0x4d59('0x2e')],'type':_0x1cce3f[_0x4d59('0x2f')][_0x4d59('0x30')]};});_0x11013c[_0x4d59('0x31')]=_[_0x4d59('0x2b')](_0x1b40ea,'name');_0x11013c['query']=_[_0x4d59('0x32')](_0x4b0142[_0x4d59('0x33')]);_0x11013c[_0x4d59('0x34')]=_[_0x4d59('0x35')](_0x11013c['model'],_0x11013c[_0x4d59('0x33')]);_0x320a17[_0x4d59('0x36')]=_['intersection'](_0x11013c['model'],qs[_0x4d59('0x37')](_0x4b0142[_0x4d59('0x33')][_0x4d59('0x37')]));_0x320a17[_0x4d59('0x36')]=_0x320a17[_0x4d59('0x36')][_0x4d59('0x38')]?_0x320a17[_0x4d59('0x36')]:_0x11013c[_0x4d59('0x31')];if(!_0x4b0142[_0x4d59('0x33')][_0x4d59('0x39')]('nolimit')){_0x320a17[_0x4d59('0x1e')]=qs[_0x4d59('0x1e')](_0x4b0142[_0x4d59('0x33')][_0x4d59('0x1e')]);_0x320a17['offset']=qs[_0x4d59('0x20')](_0x4b0142['query'][_0x4d59('0x20')]);}_0x320a17[_0x4d59('0x3a')]=qs['sort'](_0x4b0142[_0x4d59('0x33')][_0x4d59('0x3b')]);_0x320a17[_0x4d59('0x3c')]=qs['filters'](_[_0x4d59('0x3d')](_0x4b0142[_0x4d59('0x33')],_0x11013c[_0x4d59('0x34')]),_0x1b40ea);if(_0x4b0142[_0x4d59('0x33')][_0x4d59('0x3e')]){_0x320a17[_0x4d59('0x3c')]=_['merge'](_0x320a17['where'],{'$or':_[_0x4d59('0x2b')](_0x1b40ea,function(_0x1e8bbf){if(_0x1e8bbf[_0x4d59('0x2f')]!==_0x4d59('0x3f')){var _0x339b8e={};_0x339b8e[_0x1e8bbf[_0x4d59('0x28')]]={'$like':'%'+_0x4b0142[_0x4d59('0x33')][_0x4d59('0x3e')]+'%'};return _0x339b8e;}})});}_0x320a17=_[_0x4d59('0x40')]({},_0x320a17,_0x4b0142['options']);var _0x711252={'where':_0x320a17['where']};return db[_0x4d59('0x2c')][_0x4d59('0x1f')](_0x711252)[_0x4d59('0x25')](function(_0x3d8dba){_0x14a919['count']=_0x3d8dba;if(_0x4b0142['query'][_0x4d59('0x41')]){_0x320a17[_0x4d59('0x42')]=[{'all':!![]}];}return db[_0x4d59('0x2c')][_0x4d59('0x43')](_0x320a17);})[_0x4d59('0x25')](function(_0x36ce0f){_0x14a919[_0x4d59('0x44')]=_0x36ce0f;return _0x14a919;})[_0x4d59('0x25')](respondWithFilteredResult(_0x3a6f76,_0x320a17))[_0x4d59('0x45')](handleError(_0x3a6f76,null));};exports[_0x4d59('0x46')]=function(_0x4c8154,_0x7a66eb){var _0x496f2c={'raw':!![],'where':{'id':_0x4c8154[_0x4d59('0x47')]['id']}},_0xa0a0dd={};_0xa0a0dd[_0x4d59('0x31')]=_[_0x4d59('0x32')](db['ZendeskField'][_0x4d59('0x2d')]);_0xa0a0dd['query']=_['keys'](_0x4c8154[_0x4d59('0x33')]);_0xa0a0dd[_0x4d59('0x34')]=_[_0x4d59('0x35')](_0xa0a0dd[_0x4d59('0x31')],_0xa0a0dd[_0x4d59('0x33')]);_0x496f2c['attributes']=_[_0x4d59('0x35')](_0xa0a0dd['model'],qs[_0x4d59('0x37')](_0x4c8154['query'][_0x4d59('0x37')]));_0x496f2c[_0x4d59('0x36')]=_0x496f2c[_0x4d59('0x36')][_0x4d59('0x38')]?_0x496f2c[_0x4d59('0x36')]:_0xa0a0dd['model'];if(_0x4c8154[_0x4d59('0x33')][_0x4d59('0x41')]){_0x496f2c[_0x4d59('0x42')]=[{'all':!![]}];}_0x496f2c=_[_0x4d59('0x40')]({},_0x496f2c,_0x4c8154['options']);return db['ZendeskField'][_0x4d59('0x48')](_0x496f2c)[_0x4d59('0x25')](handleEntityNotFound(_0x7a66eb,null))[_0x4d59('0x25')](respondWithResult(_0x7a66eb,null))[_0x4d59('0x45')](handleError(_0x7a66eb,null));};exports['create']=function(_0x3342f4,_0x523d0c){return db[_0x4d59('0x2c')][_0x4d59('0x49')](_0x3342f4['body'],{})[_0x4d59('0x25')](respondWithResult(_0x523d0c,0xc9))[_0x4d59('0x45')](handleError(_0x523d0c,null));};exports['update']=function(_0x5a0ce4,_0xd0c551){if(_0x5a0ce4[_0x4d59('0x4a')]['id']){delete _0x5a0ce4[_0x4d59('0x4a')]['id'];}return db['ZendeskField'][_0x4d59('0x48')]({'where':{'id':_0x5a0ce4['params']['id']}})['then'](handleEntityNotFound(_0xd0c551,null))[_0x4d59('0x25')](saveUpdates(_0x5a0ce4[_0x4d59('0x4a')],null))[_0x4d59('0x25')](respondWithResult(_0xd0c551,null))[_0x4d59('0x45')](handleError(_0xd0c551,null));};exports['destroy']=function(_0x14ece8,_0x3c9b98){return db[_0x4d59('0x2c')][_0x4d59('0x48')]({'where':{'id':_0x14ece8[_0x4d59('0x47')]['id']}})[_0x4d59('0x25')](handleEntityNotFound(_0x3c9b98,null))[_0x4d59('0x25')](removeEntity(_0x3c9b98,null))[_0x4d59('0x45')](handleError(_0x3c9b98,null));}; \ No newline at end of file +var _0x8696=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','update','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8696,0x143));var _0x6869=function(_0x3959d4,_0x1b020e){_0x3959d4=_0x3959d4-0x0;var _0x4c4b38=_0x8696[_0x3959d4];return _0x4c4b38;};'use strict';var emlformat=require(_0x6869('0x0'));var rimraf=require(_0x6869('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6869('0x2'));var rp=require('request-promise');var moment=require(_0x6869('0x3'));var BPromise=require(_0x6869('0x4'));var Mustache=require(_0x6869('0x5'));var util=require('util');var path=require(_0x6869('0x6'));var sox=require('sox');var csv=require(_0x6869('0x7'));var ejs=require(_0x6869('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6869('0x9'));var crypto=require(_0x6869('0xa'));var jsforce=require(_0x6869('0xb'));var deskjs=require(_0x6869('0xc'));var toCsv=require(_0x6869('0x7'));var querystring=require(_0x6869('0xd'));var Papa=require(_0x6869('0xe'));var Redis=require('ioredis');var authService=require(_0x6869('0xf'));var qs=require(_0x6869('0x10'));var as=require(_0x6869('0x11'));var hardwareService=require(_0x6869('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6869('0x13'));var licenseUtil=require(_0x6869('0x14'));var db=require(_0x6869('0x15'))['db'];function respondWithStatusCode(_0x470a8d,_0x42958f){_0x42958f=_0x42958f||0xcc;return function(_0x5936ef){if(_0x5936ef){return _0x470a8d[_0x6869('0x16')](_0x42958f);}return _0x470a8d[_0x6869('0x17')](_0x42958f)['end']();};}function respondWithResult(_0xc603fc,_0x3d5c59){_0x3d5c59=_0x3d5c59||0xc8;return function(_0x1fda61){if(_0x1fda61){return _0xc603fc['status'](_0x3d5c59)[_0x6869('0x18')](_0x1fda61);}};}function respondWithFilteredResult(_0x4f943b,_0x16f86f){return function(_0x4e5705){if(_0x4e5705){var _0x143f04=typeof _0x16f86f[_0x6869('0x19')]===_0x6869('0x1a')&&typeof _0x16f86f[_0x6869('0x1b')]==='undefined';var _0x7d83d0=_0x4e5705[_0x6869('0x1c')];var _0x36da1f=_0x143f04?0x0:_0x16f86f['offset'];var _0x327094=_0x143f04?_0x4e5705[_0x6869('0x1c')]:_0x16f86f['offset']+_0x16f86f['limit'];var _0x333809;if(_0x327094>=_0x7d83d0){_0x327094=_0x7d83d0;_0x333809=0xc8;}else{_0x333809=0xce;}_0x4f943b['status'](_0x333809);return _0x4f943b[_0x6869('0x1d')](_0x6869('0x1e'),_0x36da1f+'-'+_0x327094+'/'+_0x7d83d0)['json'](_0x4e5705);}return null;};}function patchUpdates(_0x19259a){return function(_0x18b29e){try{jsonpatch['apply'](_0x18b29e,_0x19259a,!![]);}catch(_0x23d1a8){return BPromise[_0x6869('0x1f')](_0x23d1a8);}return _0x18b29e[_0x6869('0x20')]();};}function saveUpdates(_0x45c0ce,_0xb775a7){return function(_0x22c5cf){if(_0x22c5cf){return _0x22c5cf['update'](_0x45c0ce)['then'](function(_0x64583e){return _0x64583e;});}return null;};}function removeEntity(_0x1dc71e,_0x35f962){return function(_0x4e37ff){if(_0x4e37ff){return _0x4e37ff['destroy']()[_0x6869('0x21')](function(){_0x1dc71e[_0x6869('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e798,_0x2daf47){return function(_0x1c82c6){if(!_0x1c82c6){_0x44e798['sendStatus'](0x194);}return _0x1c82c6;};}function handleError(_0x52c46d,_0x2da99d){_0x2da99d=_0x2da99d||0x1f4;return function(_0xceb447){logger['error'](_0xceb447[_0x6869('0x22')]);if(_0xceb447[_0x6869('0x23')]){delete _0xceb447[_0x6869('0x23')];}_0x52c46d[_0x6869('0x17')](_0x2da99d)[_0x6869('0x24')](_0xceb447);};}exports[_0x6869('0x25')]=function(_0x551650,_0x4825ca){var _0x39bb7e={},_0x1bfba2={},_0x138da8={'count':0x0,'rows':[]};var _0x21240f=_[_0x6869('0x26')](db[_0x6869('0x27')][_0x6869('0x28')],function(_0x4c735f){return{'name':_0x4c735f[_0x6869('0x29')],'type':_0x4c735f[_0x6869('0x2a')][_0x6869('0x2b')]};});_0x1bfba2[_0x6869('0x2c')]=_[_0x6869('0x26')](_0x21240f,_0x6869('0x23'));_0x1bfba2[_0x6869('0x2d')]=_['keys'](_0x551650['query']);_0x1bfba2[_0x6869('0x2e')]=_[_0x6869('0x2f')](_0x1bfba2[_0x6869('0x2c')],_0x1bfba2[_0x6869('0x2d')]);_0x39bb7e['attributes']=_[_0x6869('0x2f')](_0x1bfba2[_0x6869('0x2c')],qs[_0x6869('0x30')](_0x551650[_0x6869('0x2d')][_0x6869('0x30')]));_0x39bb7e[_0x6869('0x31')]=_0x39bb7e[_0x6869('0x31')][_0x6869('0x32')]?_0x39bb7e['attributes']:_0x1bfba2[_0x6869('0x2c')];if(!_0x551650[_0x6869('0x2d')][_0x6869('0x33')](_0x6869('0x34'))){_0x39bb7e[_0x6869('0x1b')]=qs['limit'](_0x551650['query'][_0x6869('0x1b')]);_0x39bb7e[_0x6869('0x19')]=qs['offset'](_0x551650[_0x6869('0x2d')]['offset']);}_0x39bb7e[_0x6869('0x35')]=qs[_0x6869('0x36')](_0x551650[_0x6869('0x2d')]['sort']);_0x39bb7e['where']=qs[_0x6869('0x2e')](_[_0x6869('0x37')](_0x551650[_0x6869('0x2d')],_0x1bfba2['filters']),_0x21240f);if(_0x551650['query'][_0x6869('0x38')]){_0x39bb7e[_0x6869('0x39')]=_[_0x6869('0x3a')](_0x39bb7e[_0x6869('0x39')],{'$or':_[_0x6869('0x26')](_0x21240f,function(_0x7cdbc6){if(_0x7cdbc6[_0x6869('0x2a')]!==_0x6869('0x3b')){var _0x3e9d04={};_0x3e9d04[_0x7cdbc6[_0x6869('0x23')]]={'$like':'%'+_0x551650[_0x6869('0x2d')][_0x6869('0x38')]+'%'};return _0x3e9d04;}})});}_0x39bb7e=_[_0x6869('0x3a')]({},_0x39bb7e,_0x551650[_0x6869('0x3c')]);var _0x28383d={'where':_0x39bb7e[_0x6869('0x39')]};return db[_0x6869('0x27')][_0x6869('0x1c')](_0x28383d)['then'](function(_0x442e75){_0x138da8[_0x6869('0x1c')]=_0x442e75;if(_0x551650[_0x6869('0x2d')][_0x6869('0x3d')]){_0x39bb7e[_0x6869('0x3e')]=[{'all':!![]}];}return db[_0x6869('0x27')]['findAll'](_0x39bb7e);})[_0x6869('0x21')](function(_0x1d223c){_0x138da8[_0x6869('0x3f')]=_0x1d223c;return _0x138da8;})['then'](respondWithFilteredResult(_0x4825ca,_0x39bb7e))['catch'](handleError(_0x4825ca,null));};exports[_0x6869('0x40')]=function(_0x56bb6d,_0x419ef2){var _0x18faae={'raw':!![],'where':{'id':_0x56bb6d[_0x6869('0x41')]['id']}},_0x462a4f={};_0x462a4f['model']=_[_0x6869('0x42')](db['ZendeskField'][_0x6869('0x28')]);_0x462a4f[_0x6869('0x2d')]=_[_0x6869('0x42')](_0x56bb6d[_0x6869('0x2d')]);_0x462a4f[_0x6869('0x2e')]=_[_0x6869('0x2f')](_0x462a4f[_0x6869('0x2c')],_0x462a4f[_0x6869('0x2d')]);_0x18faae[_0x6869('0x31')]=_[_0x6869('0x2f')](_0x462a4f['model'],qs[_0x6869('0x30')](_0x56bb6d[_0x6869('0x2d')]['fields']));_0x18faae['attributes']=_0x18faae[_0x6869('0x31')][_0x6869('0x32')]?_0x18faae[_0x6869('0x31')]:_0x462a4f[_0x6869('0x2c')];if(_0x56bb6d[_0x6869('0x2d')]['includeAll']){_0x18faae[_0x6869('0x3e')]=[{'all':!![]}];}_0x18faae=_[_0x6869('0x3a')]({},_0x18faae,_0x56bb6d[_0x6869('0x3c')]);return db['ZendeskField'][_0x6869('0x43')](_0x18faae)[_0x6869('0x21')](handleEntityNotFound(_0x419ef2,null))[_0x6869('0x21')](respondWithResult(_0x419ef2,null))[_0x6869('0x44')](handleError(_0x419ef2,null));};exports[_0x6869('0x45')]=function(_0x822aac,_0x153633){return db[_0x6869('0x27')][_0x6869('0x45')](_0x822aac[_0x6869('0x46')],{})[_0x6869('0x21')](respondWithResult(_0x153633,0xc9))[_0x6869('0x44')](handleError(_0x153633,null));};exports[_0x6869('0x47')]=function(_0x50719c,_0x1b8109){if(_0x50719c[_0x6869('0x46')]['id']){delete _0x50719c[_0x6869('0x46')]['id'];}return db['ZendeskField'][_0x6869('0x43')]({'where':{'id':_0x50719c[_0x6869('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b8109,null))['then'](saveUpdates(_0x50719c[_0x6869('0x46')],null))[_0x6869('0x21')](respondWithResult(_0x1b8109,null))['catch'](handleError(_0x1b8109,null));};exports[_0x6869('0x48')]=function(_0x1f7fc0,_0x5d3ba4){return db[_0x6869('0x27')][_0x6869('0x43')]({'where':{'id':_0x1f7fc0[_0x6869('0x41')]['id']}})[_0x6869('0x21')](handleEntityNotFound(_0x5d3ba4,null))[_0x6869('0x21')](removeEntity(_0x5d3ba4,null))[_0x6869('0x44')](handleError(_0x5d3ba4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 0402f88..7e65f7c 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 _0xe713=['lodash','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskField','FieldId'];(function(_0x45271c,_0x1bf2d8){var _0x44bfda=function(_0x46b3f6){while(--_0x46b3f6){_0x45271c['push'](_0x45271c['shift']());}};_0x44bfda(++_0x1bf2d8);}(_0xe713,0x12c));var _0x3e71=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0xe713[_0x288478];return _0x234c05;};'use strict';var _=require(_0x3e71('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3e71('0x1'));var BPromise=require(_0x3e71('0x2'));var rp=require(_0x3e71('0x3'));var fs=require('fs');var path=require(_0x3e71('0x4'));var rimraf=require('rimraf');var config=require(_0x3e71('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x3e71('0x6')]=function(_0x267c2f,_0x2f31af){return _0x267c2f[_0x3e71('0x7')](_0x3e71('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x3e71('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b4d=['moment','bluebird','request-promise','path','../../config/environment','define','ZendeskField','zendesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4b4d,0x11b));var _0xd4b4=function(_0x21dcc9,_0x4b774c){_0x21dcc9=_0x21dcc9-0x0;var _0x5f4f93=_0x4b4d[_0x21dcc9];return _0x5f4f93;};'use strict';var _=require('lodash');var util=require(_0xd4b4('0x0'));var logger=require(_0xd4b4('0x1'))(_0xd4b4('0x2'));var moment=require(_0xd4b4('0x3'));var BPromise=require(_0xd4b4('0x4'));var rp=require(_0xd4b4('0x5'));var fs=require('fs');var path=require(_0xd4b4('0x6'));var rimraf=require('rimraf');var config=require(_0xd4b4('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xb4d48b,_0x5e4603){return _0xb4d48b[_0xd4b4('0x8')](_0xd4b4('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xd4b4('0xa'),'fields':[_0xd4b4('0xb'),_0xd4b4('0xc')],'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 810c330..d5444a3 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 _0xedd0=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3e9402,_0x130b9e){var _0x1f5996=function(_0x5ad15c){while(--_0x5ad15c){_0x3e9402['push'](_0x3e9402['shift']());}};_0x1f5996(++_0x130b9e);}(_0xedd0,0x1ac));var _0x0edd=function(_0x4936a5,_0x5269d1){_0x4936a5=_0x4936a5-0x0;var _0x1a6989=_0xedd0[_0x4936a5];return _0x1a6989;};'use strict';var _=require(_0x0edd('0x0'));var util=require('util');var moment=require(_0x0edd('0x1'));var BPromise=require(_0x0edd('0x2'));var rs=require(_0x0edd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0edd('0x4'))['db'];var utils=require(_0x0edd('0x5'));var logger=require(_0x0edd('0x6'))(_0x0edd('0x7'));var config=require(_0x0edd('0x8'));var jayson=require(_0x0edd('0x9'));var client=jayson[_0x0edd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce6e5,_0x1c61b2,_0x1b340b){return new BPromise(function(_0x124619,_0x217361){return client[_0x0edd('0xb')](_0x2ce6e5,_0x1b340b)[_0x0edd('0xc')](function(_0x1de5c8){logger[_0x0edd('0xd')](_0x0edd('0xe'),_0x1c61b2,_0x0edd('0xf'));logger[_0x0edd('0x10')](_0x0edd('0x11'),_0x1c61b2,_0x0edd('0xf'),JSON['stringify'](_0x1de5c8));if(_0x1de5c8[_0x0edd('0x12')]){if(_0x1de5c8[_0x0edd('0x12')]['code']===0x1f4){logger['error'](_0x0edd('0xe'),_0x1c61b2,_0x1de5c8[_0x0edd('0x12')]['message']);return _0x217361(_0x1de5c8[_0x0edd('0x12')]['message']);}logger[_0x0edd('0x12')](_0x0edd('0xe'),_0x1c61b2,_0x1de5c8[_0x0edd('0x12')]['message']);return _0x124619(_0x1de5c8[_0x0edd('0x12')][_0x0edd('0x13')]);}else{logger[_0x0edd('0xd')](_0x0edd('0xe'),_0x1c61b2,_0x0edd('0xf'));_0x124619(_0x1de5c8['result'][_0x0edd('0x13')]);}})[_0x0edd('0x14')](function(_0xbf0988){logger[_0x0edd('0x12')](_0x0edd('0xe'),_0x1c61b2,_0xbf0988);_0x217361(_0xbf0988);});});} \ No newline at end of file +var _0xdd1f=['then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','http','request'];(function(_0xa5d9f9,_0x17c6bf){var _0x40e9f6=function(_0x1c2585){while(--_0x1c2585){_0xa5d9f9['push'](_0xa5d9f9['shift']());}};_0x40e9f6(++_0x17c6bf);}(_0xdd1f,0x1d3));var _0xfdd1=function(_0x427040,_0x2746d6){_0x427040=_0x427040-0x0;var _0x4d8370=_0xdd1f[_0x427040];return _0x4d8370;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfdd1('0x0'));var BPromise=require(_0xfdd1('0x1'));var rs=require(_0xfdd1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfdd1('0x3'))('rpc');var config=require(_0xfdd1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xfdd1('0x5')][_0xfdd1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49a982,_0x30fa39,_0x2577fb){return new BPromise(function(_0x46d02c,_0x2d31ee){return client[_0xfdd1('0x7')](_0x49a982,_0x2577fb)[_0xfdd1('0x8')](function(_0x224c21){logger['info'](_0xfdd1('0x9'),_0x30fa39,_0xfdd1('0xa'));logger[_0xfdd1('0xb')](_0xfdd1('0xc'),_0x30fa39,_0xfdd1('0xa'),JSON['stringify'](_0x224c21));if(_0x224c21[_0xfdd1('0xd')]){if(_0x224c21[_0xfdd1('0xd')][_0xfdd1('0xe')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x30fa39,_0x224c21['error'][_0xfdd1('0xf')]);return _0x2d31ee(_0x224c21['error'][_0xfdd1('0xf')]);}logger['error'](_0xfdd1('0x9'),_0x30fa39,_0x224c21[_0xfdd1('0xd')][_0xfdd1('0xf')]);return _0x46d02c(_0x224c21[_0xfdd1('0xd')][_0xfdd1('0xf')]);}else{logger[_0xfdd1('0x10')](_0xfdd1('0x9'),_0x30fa39,_0xfdd1('0xa'));_0x46d02c(_0x224c21[_0xfdd1('0x11')]['message']);}})[_0xfdd1('0x12')](function(_0x4f534d){logger[_0xfdd1('0xd')](_0xfdd1('0x9'),_0x30fa39,_0x4f534d);_0x2d31ee(_0x4f534d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 79ab3e6..bc4e7bc 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 _0x0ca9=['fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post','create','addConfiguration','/:id','update','delete','destroy','exports','util','path','Router'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0ca9,0x101));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x90ca('0x0'));var path=require(_0x90ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x90ca('0x2')]();var fs_extra=require(_0x90ca('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x90ca('0x4'));var config=require('../../config/environment');var controller=require(_0x90ca('0x5'));router[_0x90ca('0x6')]('/',auth[_0x90ca('0x7')](),controller[_0x90ca('0x8')]);router[_0x90ca('0x6')]('/:id',auth[_0x90ca('0x7')](),controller[_0x90ca('0x9')]);router['get'](_0x90ca('0xa'),auth['isAuthenticated'](),controller[_0x90ca('0xb')]);router['get']('/:id/fields',auth[_0x90ca('0x7')](),controller['getFields']);router[_0x90ca('0xc')]('/',auth[_0x90ca('0x7')](),controller[_0x90ca('0xd')]);router['post'](_0x90ca('0xa'),auth[_0x90ca('0x7')](),controller[_0x90ca('0xe')]);router['put'](_0x90ca('0xf'),auth['isAuthenticated'](),controller[_0x90ca('0x10')]);router[_0x90ca('0x11')]('/:id',auth[_0x90ca('0x7')](),controller[_0x90ca('0x12')]);module[_0x90ca('0x13')]=router; \ No newline at end of file +var _0xd83c=['put','update','delete','exports','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration'];(function(_0x1e6fdf,_0x1e9d90){var _0x171224=function(_0x5744e3){while(--_0x5744e3){_0x1e6fdf['push'](_0x1e6fdf['shift']());}};_0x171224(++_0x1e9d90);}(_0xd83c,0x8c));var _0xcd83=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xd83c[_0x212fcc];return _0x4d8190;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcd83('0x0'));var express=require('express');var router=express[_0xcd83('0x1')]();var fs_extra=require(_0xcd83('0x2'));var auth=require(_0xcd83('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xcd83('0x4')]('/',auth[_0xcd83('0x5')](),controller['index']);router[_0xcd83('0x4')](_0xcd83('0x6'),auth[_0xcd83('0x5')](),controller[_0xcd83('0x7')]);router['get'](_0xcd83('0x8'),auth[_0xcd83('0x5')](),controller[_0xcd83('0x9')]);router[_0xcd83('0x4')](_0xcd83('0xa'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xcd83('0x5')](),controller['create']);router[_0xcd83('0xb')](_0xcd83('0x8'),auth[_0xcd83('0x5')](),controller[_0xcd83('0xc')]);router[_0xcd83('0xd')](_0xcd83('0x6'),auth[_0xcd83('0x5')](),controller[_0xcd83('0xe')]);router[_0xcd83('0xf')]('/:id',auth[_0xcd83('0x5')](),controller['destroy']);module[_0xcd83('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 62f831b..ae1068a 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 _0x153f=['exports','STRING','sequelize'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x153f,0x15b));var _0xf153=function(_0x429cf0,_0x448e52){_0x429cf0=_0x429cf0-0x0;var _0x2656aa=_0x153f[_0x429cf0];return _0x2656aa;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0xe14d=['exports','STRING','sequelize'];(function(_0x8cb91,_0x51a80b){var _0x470f51=function(_0x506774){while(--_0x506774){_0x8cb91['push'](_0x8cb91['shift']());}};_0x470f51(++_0x51a80b);}(_0xe14d,0x1ee));var _0xde14=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe14d[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7047fb0..3c4dd2b 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 _0xe6b4=['to-csv','ejs','fs-extra','crypto','jsforce','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','catch','params','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','sort','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','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','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Subject','Description','WhoId','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x27b2b1,_0x23466d){var _0x44640e=function(_0x4e9adc){while(--_0x4e9adc){_0x27b2b1['push'](_0x27b2b1['shift']());}};_0x44640e(++_0x23466d);}(_0xe6b4,0x181));var _0x4e6b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe6b4[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e6b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e6b('0x1'));var rp=require(_0x4e6b('0x2'));var moment=require(_0x4e6b('0x3'));var BPromise=require(_0x4e6b('0x4'));var Mustache=require(_0x4e6b('0x5'));var util=require('util');var path=require(_0x4e6b('0x6'));var sox=require(_0x4e6b('0x7'));var csv=require(_0x4e6b('0x8'));var ejs=require(_0x4e6b('0x9'));var fs=require('fs');var fs_extra=require(_0x4e6b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e6b('0xb'));var jsforce=require(_0x4e6b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e6b('0xd'));var Papa=require(_0x4e6b('0xe'));var Redis=require('ioredis');var authService=require(_0x4e6b('0xf'));var qs=require(_0x4e6b('0x10'));var as=require(_0x4e6b('0x11'));var hardwareService=require(_0x4e6b('0x12'));var logger=require(_0x4e6b('0x13'))(_0x4e6b('0x14'));var utils=require(_0x4e6b('0x15'));var config=require(_0x4e6b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e6b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16b7dd,_0x455144){_0x455144=_0x455144||0xcc;return function(_0x40d5c6){if(_0x40d5c6){return _0x16b7dd[_0x4e6b('0x18')](_0x455144);}return _0x16b7dd[_0x4e6b('0x19')](_0x455144)[_0x4e6b('0x1a')]();};}function respondWithResult(_0x4156c8,_0x1f3cfd){_0x1f3cfd=_0x1f3cfd||0xc8;return function(_0x2dd28e){if(_0x2dd28e){return _0x4156c8['status'](_0x1f3cfd)['json'](_0x2dd28e);}};}function respondWithFilteredResult(_0x535705,_0x552e5c){return function(_0x592bb3){if(_0x592bb3){var _0x4daf39=typeof _0x552e5c[_0x4e6b('0x1b')]===_0x4e6b('0x1c')&&typeof _0x552e5c[_0x4e6b('0x1d')]===_0x4e6b('0x1c');var _0x5793fd=_0x592bb3[_0x4e6b('0x1e')];var _0x100169=_0x4daf39?0x0:_0x552e5c[_0x4e6b('0x1b')];var _0x540a61=_0x4daf39?_0x592bb3['count']:_0x552e5c[_0x4e6b('0x1b')]+_0x552e5c[_0x4e6b('0x1d')];var _0x32632e;if(_0x540a61>=_0x5793fd){_0x540a61=_0x5793fd;_0x32632e=0xc8;}else{_0x32632e=0xce;}_0x535705[_0x4e6b('0x19')](_0x32632e);return _0x535705[_0x4e6b('0x1f')](_0x4e6b('0x20'),_0x100169+'-'+_0x540a61+'/'+_0x5793fd)[_0x4e6b('0x21')](_0x592bb3);}return null;};}function patchUpdates(_0x4bba58){return function(_0x220c7a){try{jsonpatch[_0x4e6b('0x22')](_0x220c7a,_0x4bba58,!![]);}catch(_0x584cf3){return BPromise[_0x4e6b('0x23')](_0x584cf3);}return _0x220c7a[_0x4e6b('0x24')]();};}function saveUpdates(_0x440f2a,_0x872c15){return function(_0x454f44){if(_0x454f44){return _0x454f44[_0x4e6b('0x25')](_0x440f2a)[_0x4e6b('0x26')](function(_0x43fbd6){return _0x43fbd6;});}return null;};}function removeEntity(_0x3ab3f9,_0x2186dd){return function(_0x3fd8a0){if(_0x3fd8a0){return _0x3fd8a0['destroy']()['then'](function(){_0x3ab3f9['status'](0xcc)[_0x4e6b('0x1a')]();});}};}function handleEntityNotFound(_0x3d0b13,_0x1627ee){return function(_0x23d14c){if(!_0x23d14c){_0x3d0b13['sendStatus'](0x194);}return _0x23d14c;};}function handleError(_0x48a6c6,_0x1f9c4){_0x1f9c4=_0x1f9c4||0x1f4;return function(_0x156711){logger[_0x4e6b('0x27')](_0x156711[_0x4e6b('0x28')]);if(_0x156711[_0x4e6b('0x29')]){delete _0x156711['name'];}_0x48a6c6[_0x4e6b('0x19')](_0x1f9c4)[_0x4e6b('0x2a')](_0x156711);};}exports['index']=function(_0x1bd0cc,_0x39b95e){var _0x1de89f={},_0x461d72={},_0x2ad26={'count':0x0,'rows':[]};var _0x234fc8=_[_0x4e6b('0x2b')](db[_0x4e6b('0x2c')][_0x4e6b('0x2d')],function(_0x926542){return{'name':_0x926542[_0x4e6b('0x2e')],'type':_0x926542[_0x4e6b('0x2f')][_0x4e6b('0x30')]};});_0x461d72['model']=_['map'](_0x234fc8,_0x4e6b('0x29'));_0x461d72['query']=_[_0x4e6b('0x31')](_0x1bd0cc[_0x4e6b('0x32')]);_0x461d72[_0x4e6b('0x33')]=_[_0x4e6b('0x34')](_0x461d72[_0x4e6b('0x35')],_0x461d72['query']);_0x1de89f[_0x4e6b('0x36')]=_[_0x4e6b('0x34')](_0x461d72[_0x4e6b('0x35')],qs[_0x4e6b('0x37')](_0x1bd0cc['query']['fields']));_0x1de89f[_0x4e6b('0x36')]=_0x1de89f['attributes'][_0x4e6b('0x38')]?_0x1de89f['attributes']:_0x461d72[_0x4e6b('0x35')];if(!_0x1bd0cc[_0x4e6b('0x32')]['hasOwnProperty'](_0x4e6b('0x39'))){_0x1de89f[_0x4e6b('0x1d')]=qs['limit'](_0x1bd0cc[_0x4e6b('0x32')][_0x4e6b('0x1d')]);_0x1de89f[_0x4e6b('0x1b')]=qs[_0x4e6b('0x1b')](_0x1bd0cc['query'][_0x4e6b('0x1b')]);}_0x1de89f[_0x4e6b('0x3a')]=qs['sort'](_0x1bd0cc[_0x4e6b('0x32')]['sort']);_0x1de89f[_0x4e6b('0x3b')]=qs[_0x4e6b('0x33')](_['pick'](_0x1bd0cc[_0x4e6b('0x32')],_0x461d72[_0x4e6b('0x33')]),_0x234fc8);if(_0x1bd0cc[_0x4e6b('0x32')][_0x4e6b('0x3c')]){_0x1de89f[_0x4e6b('0x3b')]=_['merge'](_0x1de89f[_0x4e6b('0x3b')],{'$or':_[_0x4e6b('0x2b')](_0x234fc8,function(_0x9a3abd){if(_0x9a3abd['type']!==_0x4e6b('0x3d')){var _0x3e9c0e={};_0x3e9c0e[_0x9a3abd[_0x4e6b('0x29')]]={'$like':'%'+_0x1bd0cc[_0x4e6b('0x32')][_0x4e6b('0x3c')]+'%'};return _0x3e9c0e;}})});}_0x1de89f=_[_0x4e6b('0x3e')]({},_0x1de89f,_0x1bd0cc['options']);var _0x2ac825={'where':_0x1de89f['where']};return db[_0x4e6b('0x2c')]['count'](_0x2ac825)[_0x4e6b('0x26')](function(_0x560178){_0x2ad26[_0x4e6b('0x1e')]=_0x560178;if(_0x1bd0cc['query'][_0x4e6b('0x3f')]){_0x1de89f[_0x4e6b('0x40')]=[{'all':!![]}];}return db[_0x4e6b('0x2c')]['findAll'](_0x1de89f);})[_0x4e6b('0x26')](function(_0x515db5){_0x2ad26['rows']=_0x515db5;return _0x2ad26;})[_0x4e6b('0x26')](respondWithFilteredResult(_0x39b95e,_0x1de89f))[_0x4e6b('0x41')](handleError(_0x39b95e,null));};exports['show']=function(_0x5dbfcf,_0x69a6f2){var _0x22d51b={'raw':![],'where':{'id':_0x5dbfcf[_0x4e6b('0x42')]['id']}},_0x482950={};_0x482950[_0x4e6b('0x35')]=_['keys'](db['ZohoAccount'][_0x4e6b('0x2d')]);_0x482950[_0x4e6b('0x32')]=_[_0x4e6b('0x31')](_0x5dbfcf[_0x4e6b('0x32')]);_0x482950['filters']=_[_0x4e6b('0x34')](_0x482950[_0x4e6b('0x35')],_0x482950[_0x4e6b('0x32')]);_0x22d51b['attributes']=_[_0x4e6b('0x34')](_0x482950[_0x4e6b('0x35')],qs[_0x4e6b('0x37')](_0x5dbfcf['query'][_0x4e6b('0x37')]));_0x22d51b[_0x4e6b('0x36')]=_0x22d51b[_0x4e6b('0x36')][_0x4e6b('0x38')]?_0x22d51b[_0x4e6b('0x36')]:_0x482950[_0x4e6b('0x35')];if(_0x5dbfcf['query'][_0x4e6b('0x3f')]){_0x22d51b[_0x4e6b('0x40')]=[{'all':!![]}];}_0x22d51b=_['merge']({},_0x22d51b,_0x5dbfcf[_0x4e6b('0x43')]);return db[_0x4e6b('0x2c')][_0x4e6b('0x44')](_0x22d51b)[_0x4e6b('0x26')](handleEntityNotFound(_0x69a6f2,null))[_0x4e6b('0x26')](respondWithResult(_0x69a6f2,null))[_0x4e6b('0x41')](handleError(_0x69a6f2,null));};exports[_0x4e6b('0x45')]=function(_0x5bafb2,_0x583027){return db[_0x4e6b('0x2c')][_0x4e6b('0x45')](_0x5bafb2[_0x4e6b('0x46')],{})[_0x4e6b('0x26')](respondWithResult(_0x583027,0xc9))['catch'](handleError(_0x583027,null));};exports[_0x4e6b('0x25')]=function(_0x384422,_0x549372){if(_0x384422[_0x4e6b('0x46')]['id']){delete _0x384422[_0x4e6b('0x46')]['id'];}return db[_0x4e6b('0x2c')][_0x4e6b('0x44')]({'where':{'id':_0x384422[_0x4e6b('0x42')]['id']}})[_0x4e6b('0x26')](handleEntityNotFound(_0x549372,null))['then'](saveUpdates(_0x384422[_0x4e6b('0x46')],null))['then'](respondWithResult(_0x549372,null))[_0x4e6b('0x41')](handleError(_0x549372,null));};exports[_0x4e6b('0x47')]=function(_0x324a41,_0x5d6958){return db['ZohoAccount'][_0x4e6b('0x44')]({'where':{'id':_0x324a41[_0x4e6b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d6958,null))['then'](removeEntity(_0x5d6958,null))['catch'](handleError(_0x5d6958,null));};exports[_0x4e6b('0x48')]=function(_0x3008bf,_0x5b5771,_0x2db348){var _0x317b9c={};var _0x283cfb={};var _0x4558e2;var _0x301035;return db['ZohoAccount'][_0x4e6b('0x49')]({'where':{'id':_0x3008bf[_0x4e6b('0x42')]['id']}})[_0x4e6b('0x26')](handleEntityNotFound(_0x5b5771,null))[_0x4e6b('0x26')](function(_0x408eec){if(_0x408eec){_0x4558e2=_0x408eec;_0x283cfb['model']=_['keys'](db[_0x4e6b('0x4a')][_0x4e6b('0x2d')]);_0x283cfb['query']=_['keys'](_0x3008bf[_0x4e6b('0x32')]);_0x283cfb[_0x4e6b('0x33')]=_[_0x4e6b('0x34')](_0x283cfb[_0x4e6b('0x35')],_0x283cfb['query']);_0x317b9c['attributes']=_[_0x4e6b('0x34')](_0x283cfb[_0x4e6b('0x35')],qs['fields'](_0x3008bf[_0x4e6b('0x32')]['fields']));_0x317b9c['attributes']=_0x317b9c['attributes'][_0x4e6b('0x38')]?_0x317b9c[_0x4e6b('0x36')]:_0x283cfb[_0x4e6b('0x35')];_0x317b9c[_0x4e6b('0x3a')]=qs[_0x4e6b('0x4b')](_0x3008bf[_0x4e6b('0x32')][_0x4e6b('0x4b')]);_0x317b9c['where']=qs['filters'](_[_0x4e6b('0x4c')](_0x3008bf['query'],_0x283cfb['filters']));if(_0x3008bf[_0x4e6b('0x32')][_0x4e6b('0x3c')]){_0x317b9c[_0x4e6b('0x3b')]=_[_0x4e6b('0x3e')](_0x317b9c['where'],{'$or':_[_0x4e6b('0x2b')](_0x317b9c[_0x4e6b('0x36')],function(_0x2c21c1){var _0x237666={};_0x237666[_0x2c21c1]={'$like':'%'+_0x3008bf[_0x4e6b('0x32')][_0x4e6b('0x3c')]+'%'};return _0x237666;})});}_0x317b9c=_['merge']({},_0x317b9c,_0x3008bf[_0x4e6b('0x43')]);return _0x4558e2[_0x4e6b('0x48')](_0x317b9c);}})[_0x4e6b('0x26')](function(_0x3da41e){if(_0x3da41e){_0x301035=_0x3da41e[_0x4e6b('0x38')];if(!_0x3008bf[_0x4e6b('0x32')][_0x4e6b('0x4d')](_0x4e6b('0x39'))){_0x317b9c[_0x4e6b('0x1d')]=qs[_0x4e6b('0x1d')](_0x3008bf['query'][_0x4e6b('0x1d')]);_0x317b9c[_0x4e6b('0x1b')]=qs[_0x4e6b('0x1b')](_0x3008bf['query'][_0x4e6b('0x1b')]);}return _0x4558e2[_0x4e6b('0x48')](_0x317b9c);}})[_0x4e6b('0x26')](function(_0x14074f){if(_0x14074f){return _0x14074f?{'count':_0x301035,'rows':_0x14074f}:null;}})[_0x4e6b('0x26')](respondWithResult(_0x5b5771,null))['catch'](handleError(_0x5b5771,null));};exports['addConfiguration']=function(_0x448a88,_0x15e4c0,_0x5d9d4d){if(_0x448a88[_0x4e6b('0x46')]['id']){delete _0x448a88['body']['id'];}return db[_0x4e6b('0x2c')][_0x4e6b('0x49')]({'where':{'id':_0x448a88[_0x4e6b('0x42')]['id']}})[_0x4e6b('0x26')](handleEntityNotFound(_0x15e4c0,null))['then'](function(_0x37bdb8){if(_0x37bdb8){_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x4e')]=_0x37bdb8['id'];_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x4f')]=integrations[_0x4e6b('0x50')](_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x51')],_0x448a88['body'][_0x4e6b('0x2f')]);_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x52')]=integrations[_0x4e6b('0x53')](_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x51')],_0x448a88[_0x4e6b('0x46')][_0x4e6b('0x2f')]);return db['ZohoConfiguration'][_0x4e6b('0x45')](_0x448a88[_0x4e6b('0x46')],{'include':[{'model':db[_0x4e6b('0x54')],'as':_0x4e6b('0x4f')},{'model':db['ZohoField'],'as':_0x4e6b('0x52')}]});}return null;})[_0x4e6b('0x26')](respondWithResult(_0x15e4c0,null))['catch'](handleError(_0x15e4c0,null));};function getAccessToken(_0xa4c056){return new Promise(function(_0x34f62d,_0x1ec400){var _0x2c9f50;switch(_0xa4c056[_0x4e6b('0x55')]){case'US':_0x2c9f50=_0x4e6b('0x56');break;case'AU':_0x2c9f50=_0x4e6b('0x57');break;case'EU':_0x2c9f50='https://accounts.zoho.eu';break;case'IN':_0x2c9f50=_0x4e6b('0x58');break;case'CN':_0x2c9f50=_0x4e6b('0x59');break;default:_0x2c9f50=_0x4e6b('0x5a');break;}var _0x86e1a8={'method':_0x4e6b('0x5b'),'uri':_0x2c9f50+_0x4e6b('0x5c'),'qs':{'refresh_token':_0xa4c056[_0x4e6b('0x5d')],'client_id':_0xa4c056[_0x4e6b('0x5e')],'client_secret':_0xa4c056[_0x4e6b('0x5f')],'grant_type':_0x4e6b('0x60')},'json':!![]};return rp(_0x86e1a8)[_0x4e6b('0x26')](function(_0x2a1882){if(_0x2a1882[_0x4e6b('0x61')]){_0x34f62d(_0x2a1882['access_token']);}else{_0x1ec400(_0x4e6b('0x62'));}})['catch'](function(_0x5548d1){_0x1ec400(_0x5548d1);});});}exports[_0x4e6b('0x63')]=function(_0x34ae0c,_0x568bf9,_0x4bed91){var _0x3d6865,_0x5e3754,_0x788df6,_0x197099,_0x4ce13c;return db[_0x4e6b('0x2c')][_0x4e6b('0x49')]({'where':{'id':_0x34ae0c['params']['id']},'attributes':['id',_0x4e6b('0x64'),_0x4e6b('0x55'),_0x4e6b('0x5e'),_0x4e6b('0x5f'),_0x4e6b('0x65'),_0x4e6b('0x66'),_0x4e6b('0x5d')]})[_0x4e6b('0x26')](handleEntityNotFound(_0x568bf9,null))[_0x4e6b('0x26')](function(_0xef15bc){_0x4ce13c=_0xef15bc;_0x3d6865=_0x4ce13c[_0x4e6b('0x64')];_0x5e3754=_0x3d6865===_0x4e6b('0x67')?'eu':_0x4e6b('0x68');_0x788df6=_0x4ce13c['serverUrl'];var _0x233ccb=_0x788df6['slice'](-0x1);if(_0x233ccb==='/'||_0x233ccb==='\x5c'||_0x233ccb===':'){_0x788df6=_0x788df6[_0x4e6b('0x69')](0x0,_0x788df6['lastIndexOf'](_0x233ccb));}if(!_0x4ce13c[_0x4e6b('0x5d')]){throw new Error(_0x4e6b('0x6a'));}return getAccessToken(_0x4ce13c);})[_0x4e6b('0x26')](function(_0x128aab){if(_0x128aab){return rp({'method':_0x4e6b('0x6b'),'uri':util[_0x4e6b('0x6c')](_0x4e6b('0x6d'),_0x5e3754),'qs':{'module':_0x4e6b('0x6e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x128aab},'json':!![]});}})['then'](function(_0x5e8827){if(_0x5e8827){if(_0x5e8827[_0x4e6b('0x6f')]&&_0x5e8827[_0x4e6b('0x6f')][_0x4e6b('0x27')]){throw new Error(_0x5e8827[_0x4e6b('0x6f')][_0x4e6b('0x27')][_0x4e6b('0x70')]);}var _0x1775d6=[];var _0x5eab26=[];var _0x1a09d2=['Owner',_0x4e6b('0x71'),_0x4e6b('0x72'),_0x4e6b('0x73'),'Call_Duration','Call_Result','Call_Start_Time',_0x4e6b('0x74')];_0x5eab26=_[_0x4e6b('0x75')](_0x5e8827[_0x4e6b('0x37')],function(_0x2879cf){return _0x1a09d2[_0x4e6b('0x76')](_0x2879cf[_0x4e6b('0x77')]);});for(var _0x1281cd=0x0;_0x1281cd<_0x5eab26[_0x4e6b('0x38')];_0x1281cd++){if(_0x5eab26[_0x1281cd]['system_mandatory']===![]){_0x1775d6[_0x4e6b('0x78')]({'id':_0x5eab26[_0x1281cd]['id'],'name':_0x5eab26[_0x1281cd][_0x4e6b('0x79')],'custom':_0x5eab26[_0x1281cd][_0x4e6b('0x7a')],'options':_0x5eab26[_0x1281cd][_0x4e6b('0x7b')]===_0x4e6b('0x7c')&&_0x5eab26[_0x1281cd][_0x4e6b('0x7d')][_0x4e6b('0x38')]>-0x1?_[_0x4e6b('0x2b')](_0x5eab26[_0x1281cd][_0x4e6b('0x7d')],function(_0x4c4f68){return{'name':_0x4c4f68,'value':_0x4c4f68};}):[]});}}return{'count':_0x1775d6[_0x4e6b('0x38')],'rows':_0x1775d6};}else{return{'count':0x0,'rows':[]};}})[_0x4e6b('0x26')](respondWithResult(_0x568bf9,null))['catch'](function(_0x4437e6){var _0x78d36=_0x34ae0c['query'][_0x4e6b('0x7e')]?0x1f4:_0x4437e6[_0x4e6b('0x7f')]||0x1f4;logger[_0x4e6b('0x27')](_0x4e6b('0x80'),'getFields',_0x78d36,JSON[_0x4e6b('0x81')](_0x4437e6));delete _0x4437e6['name'];if(_0x78d36===0x191){_0x78d36=0x190;}_0x568bf9[_0x4e6b('0x19')](_0x78d36)[_0x4e6b('0x2a')](_0x34ae0c['query'][_0x4e6b('0x7e')]?{'message':_0x4e6b('0x82'),'statusCode':_0x4437e6[_0x4e6b('0x7f')]}:_0x4437e6);});}; \ No newline at end of file +var _0x1ae4=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','findOne','ZohoConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce'];(function(_0x542e17,_0x234aee){var _0x401a48=function(_0x5bf192){while(--_0x5bf192){_0x542e17['push'](_0x542e17['shift']());}};_0x401a48(++_0x234aee);}(_0x1ae4,0x100));var _0x41ae=function(_0x219419,_0x58ff70){_0x219419=_0x219419-0x0;var _0x6acfb2=_0x1ae4[_0x219419];return _0x6acfb2;};'use strict';var emlformat=require(_0x41ae('0x0'));var rimraf=require(_0x41ae('0x1'));var zipdir=require(_0x41ae('0x2'));var jsonpatch=require(_0x41ae('0x3'));var rp=require(_0x41ae('0x4'));var moment=require(_0x41ae('0x5'));var BPromise=require(_0x41ae('0x6'));var Mustache=require(_0x41ae('0x7'));var util=require(_0x41ae('0x8'));var path=require(_0x41ae('0x9'));var sox=require('sox');var csv=require(_0x41ae('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41ae('0xb'));var _=require('lodash');var squel=require(_0x41ae('0xc'));var crypto=require('crypto');var jsforce=require(_0x41ae('0xd'));var deskjs=require(_0x41ae('0xe'));var toCsv=require(_0x41ae('0xa'));var querystring=require('querystring');var Papa=require(_0x41ae('0xf'));var Redis=require(_0x41ae('0x10'));var authService=require(_0x41ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41ae('0x12'));var hardwareService=require(_0x41ae('0x13'));var logger=require(_0x41ae('0x14'))(_0x41ae('0x15'));var utils=require(_0x41ae('0x16'));var config=require(_0x41ae('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x41ae('0x18'))['db'];var integrations=require(_0x41ae('0x19'));function respondWithStatusCode(_0x4f569c,_0x4c1e04){_0x4c1e04=_0x4c1e04||0xcc;return function(_0x2e9ea8){if(_0x2e9ea8){return _0x4f569c[_0x41ae('0x1a')](_0x4c1e04);}return _0x4f569c[_0x41ae('0x1b')](_0x4c1e04)[_0x41ae('0x1c')]();};}function respondWithResult(_0x27ec2b,_0x5d5496){_0x5d5496=_0x5d5496||0xc8;return function(_0x1105c4){if(_0x1105c4){return _0x27ec2b['status'](_0x5d5496)['json'](_0x1105c4);}};}function respondWithFilteredResult(_0xe81edc,_0x58d438){return function(_0x297e0d){if(_0x297e0d){var _0x3e18b7=typeof _0x58d438[_0x41ae('0x1d')]===_0x41ae('0x1e')&&typeof _0x58d438[_0x41ae('0x1f')]===_0x41ae('0x1e');var _0x384211=_0x297e0d[_0x41ae('0x20')];var _0xe17087=_0x3e18b7?0x0:_0x58d438[_0x41ae('0x1d')];var _0x507cc0=_0x3e18b7?_0x297e0d[_0x41ae('0x20')]:_0x58d438[_0x41ae('0x1d')]+_0x58d438[_0x41ae('0x1f')];var _0x4ab36d;if(_0x507cc0>=_0x384211){_0x507cc0=_0x384211;_0x4ab36d=0xc8;}else{_0x4ab36d=0xce;}_0xe81edc[_0x41ae('0x1b')](_0x4ab36d);return _0xe81edc[_0x41ae('0x21')](_0x41ae('0x22'),_0xe17087+'-'+_0x507cc0+'/'+_0x384211)['json'](_0x297e0d);}return null;};}function patchUpdates(_0x447bd6){return function(_0x7d4e4d){try{jsonpatch[_0x41ae('0x23')](_0x7d4e4d,_0x447bd6,!![]);}catch(_0x1c26e4){return BPromise[_0x41ae('0x24')](_0x1c26e4);}return _0x7d4e4d['save']();};}function saveUpdates(_0x1ccfcf,_0x3587e2){return function(_0x40db20){if(_0x40db20){return _0x40db20[_0x41ae('0x25')](_0x1ccfcf)['then'](function(_0x21a180){return _0x21a180;});}return null;};}function removeEntity(_0x3513b3,_0x3fed64){return function(_0x2801d2){if(_0x2801d2){return _0x2801d2[_0x41ae('0x26')]()[_0x41ae('0x27')](function(){_0x3513b3[_0x41ae('0x1b')](0xcc)[_0x41ae('0x1c')]();});}};}function handleEntityNotFound(_0x78b6a1,_0x318a4c){return function(_0x5938c6){if(!_0x5938c6){_0x78b6a1[_0x41ae('0x1a')](0x194);}return _0x5938c6;};}function handleError(_0x34b024,_0x15f8e1){_0x15f8e1=_0x15f8e1||0x1f4;return function(_0x54dadf){logger[_0x41ae('0x28')](_0x54dadf[_0x41ae('0x29')]);if(_0x54dadf[_0x41ae('0x2a')]){delete _0x54dadf['name'];}_0x34b024['status'](_0x15f8e1)[_0x41ae('0x2b')](_0x54dadf);};}exports[_0x41ae('0x2c')]=function(_0x16cf54,_0xb38b79){var _0x1d65ef={},_0x17d74e={},_0x220128={'count':0x0,'rows':[]};var _0x319a7f=_[_0x41ae('0x2d')](db[_0x41ae('0x2e')][_0x41ae('0x2f')],function(_0x3dd718){return{'name':_0x3dd718[_0x41ae('0x30')],'type':_0x3dd718[_0x41ae('0x31')]['key']};});_0x17d74e['model']=_['map'](_0x319a7f,_0x41ae('0x2a'));_0x17d74e[_0x41ae('0x32')]=_[_0x41ae('0x33')](_0x16cf54['query']);_0x17d74e[_0x41ae('0x34')]=_[_0x41ae('0x35')](_0x17d74e['model'],_0x17d74e['query']);_0x1d65ef['attributes']=_[_0x41ae('0x35')](_0x17d74e[_0x41ae('0x36')],qs['fields'](_0x16cf54[_0x41ae('0x32')]['fields']));_0x1d65ef[_0x41ae('0x37')]=_0x1d65ef[_0x41ae('0x37')][_0x41ae('0x38')]?_0x1d65ef['attributes']:_0x17d74e[_0x41ae('0x36')];if(!_0x16cf54[_0x41ae('0x32')][_0x41ae('0x39')]('nolimit')){_0x1d65ef['limit']=qs['limit'](_0x16cf54[_0x41ae('0x32')][_0x41ae('0x1f')]);_0x1d65ef[_0x41ae('0x1d')]=qs['offset'](_0x16cf54[_0x41ae('0x32')][_0x41ae('0x1d')]);}_0x1d65ef[_0x41ae('0x3a')]=qs['sort'](_0x16cf54[_0x41ae('0x32')][_0x41ae('0x3b')]);_0x1d65ef[_0x41ae('0x3c')]=qs['filters'](_['pick'](_0x16cf54[_0x41ae('0x32')],_0x17d74e['filters']),_0x319a7f);if(_0x16cf54[_0x41ae('0x32')][_0x41ae('0x3d')]){_0x1d65ef[_0x41ae('0x3c')]=_[_0x41ae('0x3e')](_0x1d65ef[_0x41ae('0x3c')],{'$or':_[_0x41ae('0x2d')](_0x319a7f,function(_0x375bba){if(_0x375bba[_0x41ae('0x31')]!=='VIRTUAL'){var _0x2db181={};_0x2db181[_0x375bba[_0x41ae('0x2a')]]={'$like':'%'+_0x16cf54[_0x41ae('0x32')][_0x41ae('0x3d')]+'%'};return _0x2db181;}})});}_0x1d65ef=_[_0x41ae('0x3e')]({},_0x1d65ef,_0x16cf54[_0x41ae('0x3f')]);var _0x34b701={'where':_0x1d65ef[_0x41ae('0x3c')]};return db['ZohoAccount']['count'](_0x34b701)['then'](function(_0x150b3f){_0x220128[_0x41ae('0x20')]=_0x150b3f;if(_0x16cf54['query'][_0x41ae('0x40')]){_0x1d65ef[_0x41ae('0x41')]=[{'all':!![]}];}return db[_0x41ae('0x2e')][_0x41ae('0x42')](_0x1d65ef);})[_0x41ae('0x27')](function(_0x2ebd12){_0x220128[_0x41ae('0x43')]=_0x2ebd12;return _0x220128;})[_0x41ae('0x27')](respondWithFilteredResult(_0xb38b79,_0x1d65ef))[_0x41ae('0x44')](handleError(_0xb38b79,null));};exports[_0x41ae('0x45')]=function(_0x50f8d4,_0x474c81){var _0x18375d={'raw':![],'where':{'id':_0x50f8d4[_0x41ae('0x46')]['id']}},_0x1164c9={};_0x1164c9[_0x41ae('0x36')]=_['keys'](db[_0x41ae('0x2e')][_0x41ae('0x2f')]);_0x1164c9[_0x41ae('0x32')]=_['keys'](_0x50f8d4[_0x41ae('0x32')]);_0x1164c9[_0x41ae('0x34')]=_['intersection'](_0x1164c9[_0x41ae('0x36')],_0x1164c9['query']);_0x18375d[_0x41ae('0x37')]=_[_0x41ae('0x35')](_0x1164c9['model'],qs[_0x41ae('0x47')](_0x50f8d4[_0x41ae('0x32')][_0x41ae('0x47')]));_0x18375d[_0x41ae('0x37')]=_0x18375d['attributes'][_0x41ae('0x38')]?_0x18375d[_0x41ae('0x37')]:_0x1164c9[_0x41ae('0x36')];if(_0x50f8d4['query'][_0x41ae('0x40')]){_0x18375d['include']=[{'all':!![]}];}_0x18375d=_[_0x41ae('0x3e')]({},_0x18375d,_0x50f8d4[_0x41ae('0x3f')]);return db['ZohoAccount'][_0x41ae('0x48')](_0x18375d)[_0x41ae('0x27')](handleEntityNotFound(_0x474c81,null))['then'](respondWithResult(_0x474c81,null))[_0x41ae('0x44')](handleError(_0x474c81,null));};exports[_0x41ae('0x49')]=function(_0x4ce9fe,_0x33d9ec){return db[_0x41ae('0x2e')][_0x41ae('0x49')](_0x4ce9fe[_0x41ae('0x4a')],{})[_0x41ae('0x27')](respondWithResult(_0x33d9ec,0xc9))[_0x41ae('0x44')](handleError(_0x33d9ec,null));};exports[_0x41ae('0x25')]=function(_0x4b4556,_0x4a5a2a){if(_0x4b4556['body']['id']){delete _0x4b4556['body']['id'];}return db[_0x41ae('0x2e')][_0x41ae('0x48')]({'where':{'id':_0x4b4556[_0x41ae('0x46')]['id']}})[_0x41ae('0x27')](handleEntityNotFound(_0x4a5a2a,null))[_0x41ae('0x27')](saveUpdates(_0x4b4556[_0x41ae('0x4a')],null))[_0x41ae('0x27')](respondWithResult(_0x4a5a2a,null))[_0x41ae('0x44')](handleError(_0x4a5a2a,null));};exports[_0x41ae('0x26')]=function(_0x2ec86d,_0x1ff4b6){return db[_0x41ae('0x2e')]['find']({'where':{'id':_0x2ec86d[_0x41ae('0x46')]['id']}})[_0x41ae('0x27')](handleEntityNotFound(_0x1ff4b6,null))['then'](removeEntity(_0x1ff4b6,null))[_0x41ae('0x44')](handleError(_0x1ff4b6,null));};exports['getConfigurations']=function(_0x8257a5,_0x5ce7fd,_0x35d08a){var _0x5bcb00={};var _0x8aa067={};var _0x4368b1;var _0x528f94;return db[_0x41ae('0x2e')][_0x41ae('0x4b')]({'where':{'id':_0x8257a5[_0x41ae('0x46')]['id']}})[_0x41ae('0x27')](handleEntityNotFound(_0x5ce7fd,null))[_0x41ae('0x27')](function(_0x2b7ebf){if(_0x2b7ebf){_0x4368b1=_0x2b7ebf;_0x8aa067[_0x41ae('0x36')]=_[_0x41ae('0x33')](db[_0x41ae('0x4c')][_0x41ae('0x2f')]);_0x8aa067[_0x41ae('0x32')]=_['keys'](_0x8257a5[_0x41ae('0x32')]);_0x8aa067[_0x41ae('0x34')]=_[_0x41ae('0x35')](_0x8aa067[_0x41ae('0x36')],_0x8aa067[_0x41ae('0x32')]);_0x5bcb00[_0x41ae('0x37')]=_[_0x41ae('0x35')](_0x8aa067[_0x41ae('0x36')],qs['fields'](_0x8257a5[_0x41ae('0x32')][_0x41ae('0x47')]));_0x5bcb00['attributes']=_0x5bcb00[_0x41ae('0x37')][_0x41ae('0x38')]?_0x5bcb00[_0x41ae('0x37')]:_0x8aa067[_0x41ae('0x36')];_0x5bcb00[_0x41ae('0x3a')]=qs[_0x41ae('0x3b')](_0x8257a5[_0x41ae('0x32')]['sort']);_0x5bcb00[_0x41ae('0x3c')]=qs[_0x41ae('0x34')](_[_0x41ae('0x4d')](_0x8257a5['query'],_0x8aa067[_0x41ae('0x34')]));if(_0x8257a5['query'][_0x41ae('0x3d')]){_0x5bcb00[_0x41ae('0x3c')]=_['merge'](_0x5bcb00[_0x41ae('0x3c')],{'$or':_[_0x41ae('0x2d')](_0x5bcb00[_0x41ae('0x37')],function(_0x5eee08){var _0x169ecb={};_0x169ecb[_0x5eee08]={'$like':'%'+_0x8257a5['query']['filter']+'%'};return _0x169ecb;})});}_0x5bcb00=_[_0x41ae('0x3e')]({},_0x5bcb00,_0x8257a5[_0x41ae('0x3f')]);return _0x4368b1[_0x41ae('0x4e')](_0x5bcb00);}})[_0x41ae('0x27')](function(_0x3a9520){if(_0x3a9520){_0x528f94=_0x3a9520[_0x41ae('0x38')];if(!_0x8257a5[_0x41ae('0x32')][_0x41ae('0x39')](_0x41ae('0x4f'))){_0x5bcb00['limit']=qs['limit'](_0x8257a5[_0x41ae('0x32')][_0x41ae('0x1f')]);_0x5bcb00[_0x41ae('0x1d')]=qs[_0x41ae('0x1d')](_0x8257a5[_0x41ae('0x32')][_0x41ae('0x1d')]);}return _0x4368b1[_0x41ae('0x4e')](_0x5bcb00);}})[_0x41ae('0x27')](function(_0x334026){if(_0x334026){return _0x334026?{'count':_0x528f94,'rows':_0x334026}:null;}})[_0x41ae('0x27')](respondWithResult(_0x5ce7fd,null))[_0x41ae('0x44')](handleError(_0x5ce7fd,null));};exports[_0x41ae('0x50')]=function(_0x4907c6,_0x44615a,_0x2717fe){if(_0x4907c6[_0x41ae('0x4a')]['id']){delete _0x4907c6[_0x41ae('0x4a')]['id'];}return db[_0x41ae('0x2e')][_0x41ae('0x4b')]({'where':{'id':_0x4907c6[_0x41ae('0x46')]['id']}})[_0x41ae('0x27')](handleEntityNotFound(_0x44615a,null))[_0x41ae('0x27')](function(_0x54cd87){if(_0x54cd87){_0x4907c6['body'][_0x41ae('0x51')]=_0x54cd87['id'];_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x52')]=integrations[_0x41ae('0x53')](_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x54')],_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x31')]);_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x55')]=integrations[_0x41ae('0x56')](_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x54')],_0x4907c6[_0x41ae('0x4a')][_0x41ae('0x31')]);return db['ZohoConfiguration'][_0x41ae('0x49')](_0x4907c6[_0x41ae('0x4a')],{'include':[{'model':db[_0x41ae('0x57')],'as':'Subjects'},{'model':db[_0x41ae('0x57')],'as':_0x41ae('0x55')}]});}return null;})[_0x41ae('0x27')](respondWithResult(_0x44615a,null))[_0x41ae('0x44')](handleError(_0x44615a,null));};function getAccessToken(_0x372d24){return new Promise(function(_0x56a369,_0x5a3607){var _0x2e20bd;switch(_0x372d24[_0x41ae('0x58')]){case'US':_0x2e20bd=_0x41ae('0x59');break;case'AU':_0x2e20bd=_0x41ae('0x5a');break;case'EU':_0x2e20bd=_0x41ae('0x5b');break;case'IN':_0x2e20bd=_0x41ae('0x5c');break;case'CN':_0x2e20bd=_0x41ae('0x5d');break;default:_0x2e20bd='https://accounts.zoho.eu';break;}var _0x549ad9={'method':'POST','uri':_0x2e20bd+_0x41ae('0x5e'),'qs':{'refresh_token':_0x372d24[_0x41ae('0x5f')],'client_id':_0x372d24[_0x41ae('0x60')],'client_secret':_0x372d24[_0x41ae('0x61')],'grant_type':_0x41ae('0x62')},'json':!![]};return rp(_0x549ad9)[_0x41ae('0x27')](function(_0x348e2){if(_0x348e2[_0x41ae('0x63')]){_0x56a369(_0x348e2[_0x41ae('0x63')]);}else{_0x5a3607(_0x41ae('0x64'));}})[_0x41ae('0x44')](function(_0x19cfa1){_0x5a3607(_0x19cfa1);});});}exports[_0x41ae('0x65')]=function(_0x4bf0aa,_0x4d6b51,_0x38afc6){var _0x2c84b1,_0x5aba3e,_0x3dd2c0,_0x656f20,_0x2cbdeb;return db[_0x41ae('0x2e')][_0x41ae('0x4b')]({'where':{'id':_0x4bf0aa[_0x41ae('0x46')]['id']},'attributes':['id',_0x41ae('0x66'),_0x41ae('0x58'),_0x41ae('0x60'),_0x41ae('0x61'),_0x41ae('0x67'),_0x41ae('0x68'),_0x41ae('0x5f')]})[_0x41ae('0x27')](handleEntityNotFound(_0x4d6b51,null))[_0x41ae('0x27')](function(_0x2b8188){_0x2cbdeb=_0x2b8188;_0x2c84b1=_0x2cbdeb[_0x41ae('0x66')];_0x5aba3e=_0x2c84b1===_0x41ae('0x69')?'eu':_0x41ae('0x6a');_0x3dd2c0=_0x2cbdeb[_0x41ae('0x67')];var _0x26a43d=_0x3dd2c0[_0x41ae('0x6b')](-0x1);if(_0x26a43d==='/'||_0x26a43d==='\x5c'||_0x26a43d===':'){_0x3dd2c0=_0x3dd2c0[_0x41ae('0x6c')](0x0,_0x3dd2c0[_0x41ae('0x6d')](_0x26a43d));}if(!_0x2cbdeb[_0x41ae('0x5f')]){throw new Error(_0x41ae('0x6e'));}return getAccessToken(_0x2cbdeb);})['then'](function(_0x33c752){if(_0x33c752){return rp({'method':'GET','uri':util['format'](_0x41ae('0x6f'),_0x5aba3e),'qs':{'module':_0x41ae('0x70')},'headers':{'Authorization':_0x41ae('0x71')+_0x33c752},'json':!![]});}})[_0x41ae('0x27')](function(_0x4ddbb3){if(_0x4ddbb3){if(_0x4ddbb3['response']&&_0x4ddbb3[_0x41ae('0x72')]['error']){throw new Error(_0x4ddbb3[_0x41ae('0x72')]['error']['message']);}var _0x5176bd=[];var _0x4731a0=[];var _0x918528=[_0x41ae('0x73'),_0x41ae('0x74'),_0x41ae('0x75'),_0x41ae('0x76'),_0x41ae('0x77'),_0x41ae('0x78'),_0x41ae('0x79'),_0x41ae('0x7a')];_0x4731a0=_[_0x41ae('0x7b')](_0x4ddbb3[_0x41ae('0x47')],function(_0x44ed62){return _0x918528[_0x41ae('0x7c')](_0x44ed62['api_name']);});for(var _0x10bfbc=0x0;_0x10bfbc<_0x4731a0['length'];_0x10bfbc++){if(_0x4731a0[_0x10bfbc][_0x41ae('0x7d')]===![]){_0x5176bd[_0x41ae('0x7e')]({'id':_0x4731a0[_0x10bfbc]['id'],'name':_0x4731a0[_0x10bfbc][_0x41ae('0x7f')],'custom':_0x4731a0[_0x10bfbc][_0x41ae('0x80')],'options':_0x4731a0[_0x10bfbc][_0x41ae('0x81')]==='picklist'&&_0x4731a0[_0x10bfbc]['pick_list_values']['length']>-0x1?_[_0x41ae('0x2d')](_0x4731a0[_0x10bfbc][_0x41ae('0x82')],function(_0x1714ac){return{'name':_0x1714ac,'value':_0x1714ac};}):[]});}}return{'count':_0x5176bd['length'],'rows':_0x5176bd};}else{return{'count':0x0,'rows':[]};}})[_0x41ae('0x27')](respondWithResult(_0x4d6b51,null))[_0x41ae('0x44')](function(_0x59f9bf){var _0x1394ca=_0x4bf0aa[_0x41ae('0x32')][_0x41ae('0x83')]?0x1f4:_0x59f9bf[_0x41ae('0x84')]||0x1f4;logger[_0x41ae('0x28')](_0x41ae('0x85'),_0x41ae('0x65'),_0x1394ca,JSON[_0x41ae('0x86')](_0x59f9bf));delete _0x59f9bf[_0x41ae('0x2a')];if(_0x1394ca===0x191){_0x1394ca=0x190;}_0x4d6b51[_0x41ae('0x1b')](_0x1394ca)['send'](_0x4bf0aa[_0x41ae('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x59f9bf[_0x41ae('0x84')]}:_0x59f9bf);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a998491..1b864fd 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 _0xbbcd=['api','moment','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','host','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','format','name','catch','error','inspect','code','slice','lastIndexOf','https://accounts.zoho.com','refreshToken','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x2e9c38,_0x5adaec){_0x2e9c38=_0x2e9c38-0x0;var _0x582782=_0xbbcd[_0x2e9c38];return _0x582782;};'use strict';var _=require(_0xdbbc('0x0'));var util=require(_0xdbbc('0x1'));var logger=require(_0xdbbc('0x2'))(_0xdbbc('0x3'));var moment=require(_0xdbbc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbbc('0x5'));var rimraf=require(_0xdbbc('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbbc('0x7'));var integrations=require(_0xdbbc('0x8'));module[_0xdbbc('0x9')]=function(_0x45cc88,_0x20edf9){return _0x45cc88[_0xdbbc('0xa')](_0xdbbc('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5589c8,_0x28d593,_0x2b759f){if(_0x5589c8[_0xdbbc('0xc')](_0xdbbc('0xd'))||_0x5589c8['changed'](_0xdbbc('0xe'))||_0x5589c8[_0xdbbc('0xc')](_0xdbbc('0xf'))||_0x5589c8[_0xdbbc('0xc')](_0xdbbc('0x10'))||_0x5589c8['changed']('code')||_0x5589c8[_0xdbbc('0xc')](_0xdbbc('0x11'))){var _0x149a4c,_0x12fa32;_0x149a4c=_0x5589c8[_0xdbbc('0xe')];var _0x5d4848=_0x149a4c['slice'](-0x1);if(_0x5d4848==='/'||_0x5d4848==='\x5c'||_0x5d4848===':'){_0x149a4c=_0x149a4c[_0xdbbc('0x12')](0x0,_0x149a4c['lastIndexOf'](_0x5d4848));}switch(_0x5589c8['zone']){case'US':_0x12fa32='https://accounts.zoho.com';break;case'AU':_0x12fa32=_0xdbbc('0x13');break;case'IN':_0x12fa32=_0xdbbc('0x14');break;case'CN':_0x12fa32=_0xdbbc('0x15');break;default:_0x12fa32=_0xdbbc('0x16');break;}var _0x3cbcce={'method':_0xdbbc('0x17'),'uri':_0x12fa32+'/oauth/v2/token','form':{'grant_type':_0xdbbc('0x18'),'client_id':_0x5589c8[_0xdbbc('0xf')],'client_secret':_0x5589c8[_0xdbbc('0x10')],'redirect_uri':_0x5589c8[_0xdbbc('0xe')],'code':_0x5589c8['code']},'headers':{'Content-Type':_0xdbbc('0x19')}};return rp(_0x3cbcce)[_0xdbbc('0x1a')](function(_0x247c9b){var _0x53fa3a=JSON[_0xdbbc('0x1b')](_0x247c9b);if(_0x53fa3a[_0xdbbc('0x1c')]){_0x5589c8['refreshToken']=_0x53fa3a[_0xdbbc('0x1c')];logger[_0xdbbc('0x1d')](util[_0xdbbc('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5589c8[_0xdbbc('0x1f')],_0x5589c8['id']));}else{logger['error'](util[_0xdbbc('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5589c8['name'],_0x5589c8['id']),util['inspect'](_0x53fa3a,{'showHidden':![],'depth':null}));}return _0x2b759f(null,_0x28d593);})[_0xdbbc('0x20')](function(_0x80eee4){logger[_0xdbbc('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5589c8[_0xdbbc('0x1f')],_0x5589c8['id']),util[_0xdbbc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b759f(_0x80eee4);});}else{return _0x2b759f(null,_0x28d593);}},'beforeUpdate':function(_0x45a839,_0x294feb,_0x32068a){if(_0x45a839[_0xdbbc('0xc')]('zone')||_0x45a839[_0xdbbc('0xc')](_0xdbbc('0xe'))||_0x45a839[_0xdbbc('0xc')]('clientId')||_0x45a839[_0xdbbc('0xc')](_0xdbbc('0x10'))||_0x45a839[_0xdbbc('0xc')](_0xdbbc('0x23'))||_0x45a839[_0xdbbc('0xc')]('host')){var _0x2f9818,_0x593573;_0x2f9818=_0x45a839[_0xdbbc('0xe')];var _0x5c1854=_0x2f9818[_0xdbbc('0x24')](-0x1);if(_0x5c1854==='/'||_0x5c1854==='\x5c'||_0x5c1854===':'){_0x2f9818=_0x2f9818[_0xdbbc('0x12')](0x0,_0x2f9818[_0xdbbc('0x25')](_0x5c1854));}switch(_0x45a839[_0xdbbc('0xd')]){case'US':_0x593573=_0xdbbc('0x26');break;case'AU':_0x593573=_0xdbbc('0x13');break;case'IN':_0x593573=_0xdbbc('0x14');break;case'CN':_0x593573='https://accounts.zoho.com.cn';break;default:_0x593573='https://accounts.zoho.eu';break;}var _0x349fa9={'method':_0xdbbc('0x17'),'uri':_0x593573+'/oauth/v2/token','form':{'grant_type':_0xdbbc('0x18'),'client_id':_0x45a839[_0xdbbc('0xf')],'client_secret':_0x45a839['clientSecret'],'redirect_uri':_0x45a839[_0xdbbc('0xe')],'code':_0x45a839[_0xdbbc('0x23')]},'headers':{'Content-Type':_0xdbbc('0x19')}};return rp(_0x349fa9)[_0xdbbc('0x1a')](function(_0x30349a){var _0x5a1cc8=JSON[_0xdbbc('0x1b')](_0x30349a);if(_0x5a1cc8[_0xdbbc('0x1c')]){_0x45a839[_0xdbbc('0x27')]=_0x5a1cc8[_0xdbbc('0x1c')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45a839[_0xdbbc('0x1f')],_0x45a839['id']));}else{logger['error'](util[_0xdbbc('0x1e')](_0xdbbc('0x28'),_0x45a839['name'],_0x45a839['id']),util[_0xdbbc('0x22')](_0x5a1cc8,{'showHidden':![],'depth':null}));}return _0x32068a(null,_0x294feb);})[_0xdbbc('0x20')](function(_0x12b036){logger[_0xdbbc('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x45a839[_0xdbbc('0x1f')],_0x45a839['id']),util[_0xdbbc('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x32068a(_0x12b036);});}else{return _0x32068a(null,_0x294feb);}}}});}; \ No newline at end of file +var _0xf72f=['host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','inspect','zone','lastIndexOf','authorization_code','then','parse','util','../../config/logger','api','moment','bluebird','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code'];(function(_0x374791,_0x24976d){var _0x1611c2=function(_0x182cd0){while(--_0x182cd0){_0x374791['push'](_0x374791['shift']());}};_0x1611c2(++_0x24976d);}(_0xf72f,0x1b3));var _0xff72=function(_0xf003de,_0x58ca5b){_0xf003de=_0xf003de-0x0;var _0x2f581c=_0xf72f[_0xf003de];return _0x2f581c;};'use strict';var _=require('lodash');var util=require(_0xff72('0x0'));var logger=require(_0xff72('0x1'))(_0xff72('0x2'));var moment=require(_0xff72('0x3'));var BPromise=require(_0xff72('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff72('0x5'));var config=require('../../config/environment');var attributes=require(_0xff72('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xff72('0x7')]=function(_0x107fce,_0x597570){return _0x107fce[_0xff72('0x8')](_0xff72('0x9'),attributes,{'tableName':_0xff72('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21c1f8,_0x3ef52d,_0x38aea3){if(_0x21c1f8[_0xff72('0xb')]('zone')||_0x21c1f8['changed'](_0xff72('0xc'))||_0x21c1f8[_0xff72('0xb')](_0xff72('0xd'))||_0x21c1f8[_0xff72('0xb')](_0xff72('0xe'))||_0x21c1f8[_0xff72('0xb')](_0xff72('0xf'))||_0x21c1f8[_0xff72('0xb')](_0xff72('0x10'))){var _0x202963,_0x38bff5;_0x202963=_0x21c1f8['serverUrl'];var _0x6f5d7=_0x202963[_0xff72('0x11')](-0x1);if(_0x6f5d7==='/'||_0x6f5d7==='\x5c'||_0x6f5d7===':'){_0x202963=_0x202963[_0xff72('0x12')](0x0,_0x202963['lastIndexOf'](_0x6f5d7));}switch(_0x21c1f8['zone']){case'US':_0x38bff5=_0xff72('0x13');break;case'AU':_0x38bff5=_0xff72('0x14');break;case'IN':_0x38bff5=_0xff72('0x15');break;case'CN':_0x38bff5=_0xff72('0x16');break;default:_0x38bff5=_0xff72('0x17');break;}var _0x414998={'method':'POST','uri':_0x38bff5+_0xff72('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x21c1f8['clientId'],'client_secret':_0x21c1f8[_0xff72('0xe')],'redirect_uri':_0x21c1f8[_0xff72('0xc')],'code':_0x21c1f8[_0xff72('0xf')]},'headers':{'Content-Type':_0xff72('0x19')}};return rp(_0x414998)['then'](function(_0x1400e1){var _0x359526=JSON['parse'](_0x1400e1);if(_0x359526[_0xff72('0x1a')]){_0x21c1f8[_0xff72('0x1b')]=_0x359526['refresh_token'];logger[_0xff72('0x1c')](util[_0xff72('0x1d')](_0xff72('0x1e'),_0x21c1f8['name'],_0x21c1f8['id']));}else{logger[_0xff72('0x1f')](util[_0xff72('0x1d')](_0xff72('0x20'),_0x21c1f8[_0xff72('0x21')],_0x21c1f8['id']),util['inspect'](_0x359526,{'showHidden':![],'depth':null}));}return _0x38aea3(null,_0x3ef52d);})[_0xff72('0x22')](function(_0xe2d13e){logger[_0xff72('0x1f')](util[_0xff72('0x1d')](_0xff72('0x20'),_0x21c1f8['name'],_0x21c1f8['id']),util[_0xff72('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x38aea3(_0xe2d13e);});}else{return _0x38aea3(null,_0x3ef52d);}},'beforeUpdate':function(_0x287425,_0x36e26e,_0x337e06){if(_0x287425['changed'](_0xff72('0x24'))||_0x287425[_0xff72('0xb')]('serverUrl')||_0x287425['changed'](_0xff72('0xd'))||_0x287425['changed'](_0xff72('0xe'))||_0x287425['changed'](_0xff72('0xf'))||_0x287425[_0xff72('0xb')](_0xff72('0x10'))){var _0x153b2f,_0x1ab736;_0x153b2f=_0x287425['serverUrl'];var _0x3a4623=_0x153b2f['slice'](-0x1);if(_0x3a4623==='/'||_0x3a4623==='\x5c'||_0x3a4623===':'){_0x153b2f=_0x153b2f[_0xff72('0x12')](0x0,_0x153b2f[_0xff72('0x25')](_0x3a4623));}switch(_0x287425[_0xff72('0x24')]){case'US':_0x1ab736='https://accounts.zoho.com';break;case'AU':_0x1ab736=_0xff72('0x14');break;case'IN':_0x1ab736=_0xff72('0x15');break;case'CN':_0x1ab736=_0xff72('0x16');break;default:_0x1ab736=_0xff72('0x17');break;}var _0x45c310={'method':'POST','uri':_0x1ab736+_0xff72('0x18'),'form':{'grant_type':_0xff72('0x26'),'client_id':_0x287425[_0xff72('0xd')],'client_secret':_0x287425['clientSecret'],'redirect_uri':_0x287425[_0xff72('0xc')],'code':_0x287425[_0xff72('0xf')]},'headers':{'Content-Type':_0xff72('0x19')}};return rp(_0x45c310)[_0xff72('0x27')](function(_0x12e04d){var _0x732d88=JSON[_0xff72('0x28')](_0x12e04d);if(_0x732d88['refresh_token']){_0x287425['refreshToken']=_0x732d88['refresh_token'];logger['info'](util['format'](_0xff72('0x1e'),_0x287425[_0xff72('0x21')],_0x287425['id']));}else{logger[_0xff72('0x1f')](util[_0xff72('0x1d')](_0xff72('0x20'),_0x287425[_0xff72('0x21')],_0x287425['id']),util[_0xff72('0x23')](_0x732d88,{'showHidden':![],'depth':null}));}return _0x337e06(null,_0x36e26e);})[_0xff72('0x22')](function(_0x325eb6){logger['error'](util[_0xff72('0x1d')](_0xff72('0x20'),_0x287425[_0xff72('0x21')],_0x287425['id']),util[_0xff72('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x337e06(_0x325eb6);});}else{return _0x337e06(null,_0x36e26e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b1b744a..a9186f0 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 _0x17a7=['limit','include','map','model','debug','catch','ShowZohoAccount','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','findAll','options','where','attributes'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x17a7,0xc2));var _0x717a=function(_0xd9aae3,_0x40c582){_0xd9aae3=_0xd9aae3-0x0;var _0x317440=_0x17a7[_0xd9aae3];return _0x317440;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('ZohoAccount,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});}exports[_0x717a('0x11')]=function(_0x152e10){var _0x8b295=this;return new Promise(function(_0x45dc38,_0x2fe7a7){return db[_0x717a('0x12')][_0x717a('0x13')]({'raw':_0x152e10[_0x717a('0x14')]?_0x152e10[_0x717a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x152e10['options']?_0x152e10[_0x717a('0x14')][_0x717a('0x15')]||null:null,'attributes':_0x152e10[_0x717a('0x14')]?_0x152e10[_0x717a('0x14')][_0x717a('0x16')]||null:null,'limit':_0x152e10[_0x717a('0x14')]?_0x152e10[_0x717a('0x14')][_0x717a('0x17')]||null:null,'include':_0x152e10['options']?_0x152e10[_0x717a('0x14')][_0x717a('0x18')]?_[_0x717a('0x19')](_0x152e10[_0x717a('0x14')][_0x717a('0x18')],function(_0x594e9c){return{'model':db[_0x594e9c[_0x717a('0x1a')]],'as':_0x594e9c['as'],'attributes':_0x594e9c[_0x717a('0x16')],'include':_0x594e9c[_0x717a('0x18')]?_['map'](_0x594e9c[_0x717a('0x18')],function(_0x36a145){return{'model':db[_0x36a145['model']],'as':_0x36a145['as'],'attributes':_0x36a145[_0x717a('0x16')],'include':_0x36a145[_0x717a('0x18')]?_[_0x717a('0x19')](_0x36a145[_0x717a('0x18')],function(_0x2c0cb3){return{'model':db[_0x2c0cb3['model']],'as':_0x2c0cb3['as'],'attributes':_0x2c0cb3[_0x717a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x717a('0x8')](function(_0x2d628c){logger[_0x717a('0x9')](_0x717a('0x11'),_0x152e10);logger[_0x717a('0x1b')](_0x717a('0x11'),_0x152e10,JSON['stringify'](_0x2d628c));_0x45dc38(_0x2d628c);})[_0x717a('0x1c')](function(_0x292cfe){logger[_0x717a('0xd')]('GetZohoAccount',_0x292cfe['message'],_0x152e10);_0x2fe7a7(_0x8b295[_0x717a('0xd')](0x1f4,_0x292cfe[_0x717a('0xf')]));});});};exports[_0x717a('0x1d')]=function(_0x5007e3){var _0x2719ab=this;return new Promise(function(_0x24f51d,_0x4c63d8){return db[_0x717a('0x12')]['find']({'raw':_0x5007e3[_0x717a('0x14')]?_0x5007e3[_0x717a('0x14')][_0x717a('0x1e')]===undefined?!![]:![]:!![],'where':_0x5007e3[_0x717a('0x14')]?_0x5007e3['options']['where']||null:null,'attributes':_0x5007e3['options']?_0x5007e3[_0x717a('0x14')]['attributes']||null:null,'include':_0x5007e3[_0x717a('0x14')]?_0x5007e3[_0x717a('0x14')][_0x717a('0x18')]?_[_0x717a('0x19')](_0x5007e3['options']['include'],function(_0x3a3886){return{'model':db[_0x3a3886[_0x717a('0x1a')]],'as':_0x3a3886['as'],'attributes':_0x3a3886['attributes'],'include':_0x3a3886[_0x717a('0x18')]?_[_0x717a('0x19')](_0x3a3886[_0x717a('0x18')],function(_0x2171df){return{'model':db[_0x2171df['model']],'as':_0x2171df['as'],'attributes':_0x2171df[_0x717a('0x16')],'include':_0x2171df[_0x717a('0x18')]?_[_0x717a('0x19')](_0x2171df[_0x717a('0x18')],function(_0x51892a){return{'model':db[_0x51892a[_0x717a('0x1a')]],'as':_0x51892a['as'],'attributes':_0x51892a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x486e39){logger['info'](_0x717a('0x1d'),_0x5007e3);logger[_0x717a('0x1b')]('ShowZohoAccount',_0x5007e3,JSON['stringify'](_0x486e39));_0x24f51d(_0x486e39);})['catch'](function(_0x35cb32){logger[_0x717a('0xd')](_0x717a('0x1d'),_0x35cb32['message'],_0x5007e3);_0x4c63d8(_0x2719ab[_0x717a('0xd')](0x1f4,_0x35cb32['message']));});});}; \ No newline at end of file +var _0x6a0b=['info','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','findAll','options','attributes','include','model','map','raw','ShowZohoAccount','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message'];(function(_0x5c0d82,_0x19f536){var _0x2d3f53=function(_0x9775ae){while(--_0x9775ae){_0x5c0d82['push'](_0x5c0d82['shift']());}};_0x2d3f53(++_0x19f536);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x29e5d3,_0x4ad37a){_0x29e5d3=_0x29e5d3-0x0;var _0x30e764=_0x6a0b[_0x29e5d3];return _0x30e764;};'use strict';var _=require(_0xb6a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb6a0('0x1'));var rs=require(_0xb6a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a0('0x3'))['db'];var utils=require(_0xb6a0('0x4'));var logger=require(_0xb6a0('0x5'))(_0xb6a0('0x6'));var config=require(_0xb6a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb6a0('0x8')][_0xb6a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41bec1,_0xef4451,_0xb107bd){return new BPromise(function(_0x434911,_0x4357a5){return client[_0xb6a0('0xa')](_0x41bec1,_0xb107bd)[_0xb6a0('0xb')](function(_0x4e3aaf){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xef4451,'request\x20sent');logger['debug'](_0xb6a0('0xc'),_0xef4451,'request\x20sent',JSON[_0xb6a0('0xd')](_0x4e3aaf));if(_0x4e3aaf[_0xb6a0('0xe')]){if(_0x4e3aaf['error'][_0xb6a0('0xf')]===0x1f4){logger[_0xb6a0('0xe')](_0xb6a0('0x10'),_0xef4451,_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);return _0x4357a5(_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);}logger[_0xb6a0('0xe')](_0xb6a0('0x10'),_0xef4451,_0x4e3aaf[_0xb6a0('0xe')]['message']);return _0x434911(_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);}else{logger[_0xb6a0('0x12')](_0xb6a0('0x10'),_0xef4451,_0xb6a0('0x13'));_0x434911(_0x4e3aaf[_0xb6a0('0x14')][_0xb6a0('0x11')]);}})[_0xb6a0('0x15')](function(_0x1cb284){logger['error'](_0xb6a0('0x10'),_0xef4451,_0x1cb284);_0x4357a5(_0x1cb284);});});}exports[_0xb6a0('0x16')]=function(_0x1c6987){var _0x5db250=this;return new Promise(function(_0x3e5455,_0xc1a971){return db[_0xb6a0('0x17')][_0xb6a0('0x18')]({'raw':_0x1c6987[_0xb6a0('0x19')]?_0x1c6987['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c6987[_0xb6a0('0x19')]?_0x1c6987[_0xb6a0('0x19')]['where']||null:null,'attributes':_0x1c6987[_0xb6a0('0x19')]?_0x1c6987['options'][_0xb6a0('0x1a')]||null:null,'limit':_0x1c6987[_0xb6a0('0x19')]?_0x1c6987[_0xb6a0('0x19')]['limit']||null:null,'include':_0x1c6987[_0xb6a0('0x19')]?_0x1c6987[_0xb6a0('0x19')][_0xb6a0('0x1b')]?_['map'](_0x1c6987[_0xb6a0('0x19')][_0xb6a0('0x1b')],function(_0x5eb55f){return{'model':db[_0x5eb55f[_0xb6a0('0x1c')]],'as':_0x5eb55f['as'],'attributes':_0x5eb55f['attributes'],'include':_0x5eb55f['include']?_[_0xb6a0('0x1d')](_0x5eb55f['include'],function(_0x814060){return{'model':db[_0x814060[_0xb6a0('0x1c')]],'as':_0x814060['as'],'attributes':_0x814060[_0xb6a0('0x1a')],'include':_0x814060[_0xb6a0('0x1b')]?_[_0xb6a0('0x1d')](_0x814060[_0xb6a0('0x1b')],function(_0x31d9b0){return{'model':db[_0x31d9b0['model']],'as':_0x31d9b0['as'],'attributes':_0x31d9b0[_0xb6a0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb6a0('0xb')](function(_0xd6e536){logger[_0xb6a0('0x12')](_0xb6a0('0x16'),_0x1c6987);logger['debug'](_0xb6a0('0x16'),_0x1c6987,JSON['stringify'](_0xd6e536));_0x3e5455(_0xd6e536);})[_0xb6a0('0x15')](function(_0x261ed7){logger[_0xb6a0('0xe')](_0xb6a0('0x16'),_0x261ed7[_0xb6a0('0x11')],_0x1c6987);_0xc1a971(_0x5db250[_0xb6a0('0xe')](0x1f4,_0x261ed7['message']));});});};exports['ShowZohoAccount']=function(_0x31ce9a){var _0x8cdd90=this;return new Promise(function(_0x1fc80b,_0x1b7da3){return db[_0xb6a0('0x17')]['find']({'raw':_0x31ce9a['options']?_0x31ce9a[_0xb6a0('0x19')][_0xb6a0('0x1e')]===undefined?!![]:![]:!![],'where':_0x31ce9a[_0xb6a0('0x19')]?_0x31ce9a[_0xb6a0('0x19')]['where']||null:null,'attributes':_0x31ce9a['options']?_0x31ce9a[_0xb6a0('0x19')][_0xb6a0('0x1a')]||null:null,'include':_0x31ce9a[_0xb6a0('0x19')]?_0x31ce9a[_0xb6a0('0x19')][_0xb6a0('0x1b')]?_['map'](_0x31ce9a['options'][_0xb6a0('0x1b')],function(_0x2dce97){return{'model':db[_0x2dce97[_0xb6a0('0x1c')]],'as':_0x2dce97['as'],'attributes':_0x2dce97[_0xb6a0('0x1a')],'include':_0x2dce97[_0xb6a0('0x1b')]?_[_0xb6a0('0x1d')](_0x2dce97[_0xb6a0('0x1b')],function(_0x4faeb1){return{'model':db[_0x4faeb1[_0xb6a0('0x1c')]],'as':_0x4faeb1['as'],'attributes':_0x4faeb1[_0xb6a0('0x1a')],'include':_0x4faeb1[_0xb6a0('0x1b')]?_['map'](_0x4faeb1[_0xb6a0('0x1b')],function(_0x3b2250){return{'model':db[_0x3b2250['model']],'as':_0x3b2250['as'],'attributes':_0x3b2250[_0xb6a0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb6a0('0xb')](function(_0x389e0d){logger[_0xb6a0('0x12')](_0xb6a0('0x1f'),_0x31ce9a);logger[_0xb6a0('0x20')]('ShowZohoAccount',_0x31ce9a,JSON[_0xb6a0('0xd')](_0x389e0d));_0x1fc80b(_0x389e0d);})[_0xb6a0('0x15')](function(_0x2a5516){logger['error']('ShowZohoAccount',_0x2a5516[_0xb6a0('0x11')],_0x31ce9a);_0x1b7da3(_0x8cdd90[_0xb6a0('0xe')](0x1f4,_0x2a5516[_0xb6a0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d578eb3..35ed98a 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 _0x36e9=['/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x200276,_0x3a39b5){var _0x496325=function(_0x36551d){while(--_0x36551d){_0x200276['push'](_0x200276['shift']());}};_0x496325(++_0x3a39b5);}(_0x36e9,0x1cd));var _0x936e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x36e9[_0x5d80de];return _0x1c7556;};'use strict';var multer=require(_0x936e('0x0'));var util=require(_0x936e('0x1'));var path=require(_0x936e('0x2'));var timeout=require(_0x936e('0x3'));var express=require('express');var router=express[_0x936e('0x4')]();var fs_extra=require(_0x936e('0x5'));var auth=require(_0x936e('0x6'));var interaction=require(_0x936e('0x7'));var config=require(_0x936e('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0x936e('0x9')]('/',auth[_0x936e('0xa')](),controller[_0x936e('0xb')]);router['get'](_0x936e('0xc'),auth[_0x936e('0xa')](),controller[_0x936e('0xd')]);router['get'](_0x936e('0xe'),auth[_0x936e('0xa')](),controller[_0x936e('0xf')]);router[_0x936e('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x936e('0x10')]);router[_0x936e('0x9')](_0x936e('0x11'),auth[_0x936e('0xa')](),controller['getDescriptions']);router[_0x936e('0x12')]('/',auth[_0x936e('0xa')](),controller[_0x936e('0x13')]);router[_0x936e('0x14')]('/:id',auth[_0x936e('0xa')](),controller[_0x936e('0x15')]);router[_0x936e('0x16')](_0x936e('0xc'),auth[_0x936e('0xa')](),controller[_0x936e('0x17')]);module[_0x936e('0x18')]=router; \ No newline at end of file +var _0xacc0=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get'];(function(_0x1d9e40,_0x1c44db){var _0x2ee94f=function(_0x37a330){while(--_0x37a330){_0x1d9e40['push'](_0x1d9e40['shift']());}};_0x2ee94f(++_0x1c44db);}(_0xacc0,0xe5));var _0x0acc=function(_0xcf618a,_0x1fce85){_0xcf618a=_0xcf618a-0x0;var _0x422b20=_0xacc0[_0xcf618a];return _0x422b20;};'use strict';var multer=require(_0x0acc('0x0'));var util=require('util');var path=require(_0x0acc('0x1'));var timeout=require('connect-timeout');var express=require(_0x0acc('0x2'));var router=express['Router']();var fs_extra=require(_0x0acc('0x3'));var auth=require(_0x0acc('0x4'));var interaction=require(_0x0acc('0x5'));var config=require(_0x0acc('0x6'));var controller=require(_0x0acc('0x7'));router['get']('/',auth[_0x0acc('0x8')](),controller[_0x0acc('0x9')]);router[_0x0acc('0xa')](_0x0acc('0xb'),auth[_0x0acc('0x8')](),controller[_0x0acc('0xc')]);router['get'](_0x0acc('0xd'),auth[_0x0acc('0x8')](),controller[_0x0acc('0xe')]);router[_0x0acc('0xa')](_0x0acc('0xf'),auth[_0x0acc('0x8')](),controller[_0x0acc('0x10')]);router[_0x0acc('0xa')](_0x0acc('0x11'),auth[_0x0acc('0x8')](),controller[_0x0acc('0x12')]);router[_0x0acc('0x13')]('/',auth['isAuthenticated'](),controller[_0x0acc('0x14')]);router[_0x0acc('0x15')](_0x0acc('0xb'),auth[_0x0acc('0x8')](),controller[_0x0acc('0x16')]);router[_0x0acc('0x17')](_0x0acc('0xb'),auth[_0x0acc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 669a492..f3e62db 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 _0x0453=['ENUM','contact','nothing','lead','contact_lead','exports','STRING'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0453,0x155));var _0x3045=function(_0x1607a7,_0x295336){_0x1607a7=_0x1607a7-0x0;var _0x2cfd4d=_0x0453[_0x1607a7];return _0x2cfd4d;};'use strict';var Sequelize=require('sequelize');module[_0x3045('0x0')]={'name':{'type':Sequelize[_0x3045('0x1')]},'moduleCreate':{'type':Sequelize[_0x3045('0x2')]('lead',_0x3045('0x3'),_0x3045('0x4')),'defaultValue':_0x3045('0x5')},'moduleSearch':{'type':Sequelize[_0x3045('0x2')](_0x3045('0x6'),_0x3045('0x3'),_0x3045('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x3045('0x1')]}}; \ No newline at end of file +var _0xdb23=['nothing','lead','contact_lead','contact','STRING','sequelize','exports','ENUM'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xdb23,0xd5));var _0x3db2=function(_0x27ebd3,_0x21f8a0){_0x27ebd3=_0x27ebd3-0x0;var _0x5de0c4=_0xdb23[_0x27ebd3];return _0x5de0c4;};'use strict';var Sequelize=require(_0x3db2('0x0'));module[_0x3db2('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3db2('0x2')]('lead','contact',_0x3db2('0x3')),'defaultValue':_0x3db2('0x4')},'moduleSearch':{'type':Sequelize[_0x3db2('0x2')](_0x3db2('0x5'),_0x3db2('0x6'),_0x3db2('0x4')),'defaultValue':_0x3db2('0x5')},'description':{'type':Sequelize[_0x3db2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5e99710..1ee286c 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 _0xd8ae=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','fields','include','find','create','body','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8ae,0x1b0));var _0xed8a=function(_0x3fba7d,_0xbe4a77){_0x3fba7d=_0x3fba7d-0x0;var _0x45724f=_0xd8ae[_0x3fba7d];return _0x45724f;};'use strict';var emlformat=require(_0xed8a('0x0'));var rimraf=require(_0xed8a('0x1'));var zipdir=require(_0xed8a('0x2'));var jsonpatch=require(_0xed8a('0x3'));var rp=require('request-promise');var moment=require(_0xed8a('0x4'));var BPromise=require(_0xed8a('0x5'));var Mustache=require(_0xed8a('0x6'));var util=require(_0xed8a('0x7'));var path=require(_0xed8a('0x8'));var sox=require(_0xed8a('0x9'));var csv=require(_0xed8a('0xa'));var ejs=require(_0xed8a('0xb'));var fs=require('fs');var fs_extra=require(_0xed8a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xed8a('0xd'));var jsforce=require(_0xed8a('0xe'));var deskjs=require(_0xed8a('0xf'));var toCsv=require(_0xed8a('0xa'));var querystring=require(_0xed8a('0x10'));var Papa=require(_0xed8a('0x11'));var Redis=require(_0xed8a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed8a('0x13'));var hardwareService=require(_0xed8a('0x14'));var logger=require(_0xed8a('0x15'))(_0xed8a('0x16'));var utils=require('../../config/utils');var config=require(_0xed8a('0x17'));var licenseUtil=require(_0xed8a('0x18'));var db=require(_0xed8a('0x19'))['db'];function respondWithStatusCode(_0x10bbe2,_0x337338){_0x337338=_0x337338||0xcc;return function(_0x586b59){if(_0x586b59){return _0x10bbe2[_0xed8a('0x1a')](_0x337338);}return _0x10bbe2[_0xed8a('0x1b')](_0x337338)[_0xed8a('0x1c')]();};}function respondWithResult(_0x23594c,_0x1b0878){_0x1b0878=_0x1b0878||0xc8;return function(_0x50c911){if(_0x50c911){return _0x23594c['status'](_0x1b0878)[_0xed8a('0x1d')](_0x50c911);}};}function respondWithFilteredResult(_0x547704,_0x5530af){return function(_0x237885){if(_0x237885){var _0x33f3c8=typeof _0x5530af[_0xed8a('0x1e')]==='undefined'&&typeof _0x5530af[_0xed8a('0x1f')]===_0xed8a('0x20');var _0x1fc9f4=_0x237885[_0xed8a('0x21')];var _0x42522a=_0x33f3c8?0x0:_0x5530af[_0xed8a('0x1e')];var _0x4e46f7=_0x33f3c8?_0x237885['count']:_0x5530af[_0xed8a('0x1e')]+_0x5530af[_0xed8a('0x1f')];var _0x3d09b;if(_0x4e46f7>=_0x1fc9f4){_0x4e46f7=_0x1fc9f4;_0x3d09b=0xc8;}else{_0x3d09b=0xce;}_0x547704[_0xed8a('0x1b')](_0x3d09b);return _0x547704['set']('Content-Range',_0x42522a+'-'+_0x4e46f7+'/'+_0x1fc9f4)[_0xed8a('0x1d')](_0x237885);}return null;};}function patchUpdates(_0x161fa6){return function(_0x2148ea){try{jsonpatch[_0xed8a('0x22')](_0x2148ea,_0x161fa6,!![]);}catch(_0x4eee90){return BPromise[_0xed8a('0x23')](_0x4eee90);}return _0x2148ea[_0xed8a('0x24')]();};}function saveUpdates(_0x445be2,_0x5cd121){return function(_0x86c108){if(_0x86c108){return _0x86c108[_0xed8a('0x25')](_0x445be2)[_0xed8a('0x26')](function(_0xdb6d6a){return _0xdb6d6a;});}return null;};}function removeEntity(_0x22f0e6,_0x289227){return function(_0x35505b){if(_0x35505b){return _0x35505b[_0xed8a('0x27')]()[_0xed8a('0x26')](function(){_0x22f0e6[_0xed8a('0x1b')](0xcc)[_0xed8a('0x1c')]();});}};}function handleEntityNotFound(_0x1c825f,_0x478f0c){return function(_0x4f2886){if(!_0x4f2886){_0x1c825f['sendStatus'](0x194);}return _0x4f2886;};}function handleError(_0x2f5ea8,_0x9d4b26){_0x9d4b26=_0x9d4b26||0x1f4;return function(_0x3408f5){logger[_0xed8a('0x28')](_0x3408f5['stack']);if(_0x3408f5['name']){delete _0x3408f5[_0xed8a('0x29')];}_0x2f5ea8[_0xed8a('0x1b')](_0x9d4b26)['send'](_0x3408f5);};}exports[_0xed8a('0x2a')]=function(_0x257e23,_0x71b6a8){var _0x327268={},_0xa68a1d={},_0xea3753={'count':0x0,'rows':[]};var _0x3c5017=_[_0xed8a('0x2b')](db[_0xed8a('0x2c')][_0xed8a('0x2d')],function(_0x4dab6f){return{'name':_0x4dab6f[_0xed8a('0x2e')],'type':_0x4dab6f[_0xed8a('0x2f')][_0xed8a('0x30')]};});_0xa68a1d[_0xed8a('0x31')]=_['map'](_0x3c5017,_0xed8a('0x29'));_0xa68a1d[_0xed8a('0x32')]=_[_0xed8a('0x33')](_0x257e23['query']);_0xa68a1d['filters']=_[_0xed8a('0x34')](_0xa68a1d[_0xed8a('0x31')],_0xa68a1d[_0xed8a('0x32')]);_0x327268[_0xed8a('0x35')]=_[_0xed8a('0x34')](_0xa68a1d['model'],qs['fields'](_0x257e23[_0xed8a('0x32')]['fields']));_0x327268[_0xed8a('0x35')]=_0x327268['attributes'][_0xed8a('0x36')]?_0x327268['attributes']:_0xa68a1d[_0xed8a('0x31')];if(!_0x257e23['query'][_0xed8a('0x37')](_0xed8a('0x38'))){_0x327268[_0xed8a('0x1f')]=qs[_0xed8a('0x1f')](_0x257e23[_0xed8a('0x32')][_0xed8a('0x1f')]);_0x327268[_0xed8a('0x1e')]=qs[_0xed8a('0x1e')](_0x257e23[_0xed8a('0x32')][_0xed8a('0x1e')]);}_0x327268[_0xed8a('0x39')]=qs[_0xed8a('0x3a')](_0x257e23[_0xed8a('0x32')][_0xed8a('0x3a')]);_0x327268[_0xed8a('0x3b')]=qs[_0xed8a('0x3c')](_[_0xed8a('0x3d')](_0x257e23['query'],_0xa68a1d[_0xed8a('0x3c')]),_0x3c5017);if(_0x257e23['query'][_0xed8a('0x3e')]){_0x327268[_0xed8a('0x3b')]=_[_0xed8a('0x3f')](_0x327268[_0xed8a('0x3b')],{'$or':_[_0xed8a('0x2b')](_0x3c5017,function(_0x282791){if(_0x282791[_0xed8a('0x2f')]!==_0xed8a('0x40')){var _0x5a96b2={};_0x5a96b2[_0x282791['name']]={'$like':'%'+_0x257e23[_0xed8a('0x32')][_0xed8a('0x3e')]+'%'};return _0x5a96b2;}})});}_0x327268=_[_0xed8a('0x3f')]({},_0x327268,_0x257e23[_0xed8a('0x41')]);var _0x3d0bfb={'where':_0x327268[_0xed8a('0x3b')]};return db[_0xed8a('0x2c')]['count'](_0x3d0bfb)['then'](function(_0x46464c){_0xea3753[_0xed8a('0x21')]=_0x46464c;if(_0x257e23[_0xed8a('0x32')][_0xed8a('0x42')]){_0x327268['include']=[{'all':!![]}];}return db[_0xed8a('0x2c')]['findAll'](_0x327268);})[_0xed8a('0x26')](function(_0x21847e){_0xea3753[_0xed8a('0x43')]=_0x21847e;return _0xea3753;})[_0xed8a('0x26')](respondWithFilteredResult(_0x71b6a8,_0x327268))[_0xed8a('0x44')](handleError(_0x71b6a8,null));};exports[_0xed8a('0x45')]=function(_0x2b83d5,_0x507062){var _0x599774={'raw':![],'where':{'id':_0x2b83d5['params']['id']}},_0x5a7d7d={};_0x5a7d7d[_0xed8a('0x31')]=_[_0xed8a('0x33')](db['ZohoConfiguration'][_0xed8a('0x2d')]);_0x5a7d7d[_0xed8a('0x32')]=_['keys'](_0x2b83d5['query']);_0x5a7d7d[_0xed8a('0x3c')]=_['intersection'](_0x5a7d7d[_0xed8a('0x31')],_0x5a7d7d[_0xed8a('0x32')]);_0x599774[_0xed8a('0x35')]=_[_0xed8a('0x34')](_0x5a7d7d[_0xed8a('0x31')],qs['fields'](_0x2b83d5[_0xed8a('0x32')][_0xed8a('0x46')]));_0x599774[_0xed8a('0x35')]=_0x599774['attributes'][_0xed8a('0x36')]?_0x599774[_0xed8a('0x35')]:_0x5a7d7d[_0xed8a('0x31')];if(_0x2b83d5[_0xed8a('0x32')][_0xed8a('0x42')]){_0x599774[_0xed8a('0x47')]=[{'all':!![]}];}_0x599774=_['merge']({},_0x599774,_0x2b83d5['options']);return db[_0xed8a('0x2c')][_0xed8a('0x48')](_0x599774)[_0xed8a('0x26')](handleEntityNotFound(_0x507062,null))[_0xed8a('0x26')](respondWithResult(_0x507062,null))['catch'](handleError(_0x507062,null));};exports[_0xed8a('0x49')]=function(_0x10b4cf,_0x26516b){return db['ZohoConfiguration'][_0xed8a('0x49')](_0x10b4cf[_0xed8a('0x4a')],{})[_0xed8a('0x26')](respondWithResult(_0x26516b,0xc9))[_0xed8a('0x44')](handleError(_0x26516b,null));};exports[_0xed8a('0x25')]=function(_0x294d25,_0x349160){if(_0x294d25[_0xed8a('0x4a')]['id']){delete _0x294d25[_0xed8a('0x4a')]['id'];}return db[_0xed8a('0x2c')][_0xed8a('0x48')]({'where':{'id':_0x294d25['params']['id']}})[_0xed8a('0x26')](handleEntityNotFound(_0x349160,null))['then'](saveUpdates(_0x294d25[_0xed8a('0x4a')],null))[_0xed8a('0x26')](respondWithResult(_0x349160,null))[_0xed8a('0x44')](handleError(_0x349160,null));};exports[_0xed8a('0x27')]=function(_0x2adfb1,_0x1f79da){return db[_0xed8a('0x2c')]['find']({'where':{'id':_0x2adfb1[_0xed8a('0x4b')]['id']}})[_0xed8a('0x26')](handleEntityNotFound(_0x1f79da,null))[_0xed8a('0x26')](removeEntity(_0x1f79da,null))['catch'](handleError(_0x1f79da,null));};exports[_0xed8a('0x4c')]=function(_0x2d9b92,_0x55ef79,_0x1c8f79){var _0x15cec0={};var _0x56a62e={};var _0x588123;var _0x4f54f9;return db[_0xed8a('0x2c')][_0xed8a('0x4d')]({'where':{'id':_0x2d9b92[_0xed8a('0x4b')]['id']}})[_0xed8a('0x26')](handleEntityNotFound(_0x55ef79,null))[_0xed8a('0x26')](function(_0x7039e3){if(_0x7039e3){_0x588123=_0x7039e3;_0x56a62e[_0xed8a('0x31')]=_[_0xed8a('0x33')](db[_0xed8a('0x4e')][_0xed8a('0x2d')]);_0x56a62e[_0xed8a('0x32')]=_[_0xed8a('0x33')](_0x2d9b92['query']);_0x56a62e[_0xed8a('0x3c')]=_[_0xed8a('0x34')](_0x56a62e[_0xed8a('0x31')],_0x56a62e[_0xed8a('0x32')]);_0x15cec0[_0xed8a('0x35')]=_[_0xed8a('0x34')](_0x56a62e['model'],qs[_0xed8a('0x46')](_0x2d9b92[_0xed8a('0x32')]['fields']));_0x15cec0[_0xed8a('0x35')]=_0x15cec0[_0xed8a('0x35')][_0xed8a('0x36')]?_0x15cec0[_0xed8a('0x35')]:_0x56a62e['model'];_0x15cec0['order']=qs[_0xed8a('0x3a')](_0x2d9b92[_0xed8a('0x32')]['sort']);_0x15cec0[_0xed8a('0x3b')]=qs[_0xed8a('0x3c')](_[_0xed8a('0x3d')](_0x2d9b92[_0xed8a('0x32')],_0x56a62e[_0xed8a('0x3c')]));if(_0x2d9b92[_0xed8a('0x32')]['filter']){_0x15cec0['where']=_[_0xed8a('0x3f')](_0x15cec0[_0xed8a('0x3b')],{'$or':_[_0xed8a('0x2b')](_0x15cec0[_0xed8a('0x35')],function(_0x4ea6d7){var _0x1e4e59={};_0x1e4e59[_0x4ea6d7]={'$like':'%'+_0x2d9b92[_0xed8a('0x32')][_0xed8a('0x3e')]+'%'};return _0x1e4e59;})});}_0x15cec0=_[_0xed8a('0x3f')]({},_0x15cec0,_0x2d9b92[_0xed8a('0x41')]);return _0x588123[_0xed8a('0x4c')](_0x15cec0);}})[_0xed8a('0x26')](function(_0x3529fb){if(_0x3529fb){_0x4f54f9=_0x3529fb[_0xed8a('0x36')];if(!_0x2d9b92['query'][_0xed8a('0x37')](_0xed8a('0x38'))){_0x15cec0[_0xed8a('0x1f')]=qs[_0xed8a('0x1f')](_0x2d9b92[_0xed8a('0x32')][_0xed8a('0x1f')]);_0x15cec0[_0xed8a('0x1e')]=qs[_0xed8a('0x1e')](_0x2d9b92[_0xed8a('0x32')][_0xed8a('0x1e')]);}return _0x588123[_0xed8a('0x4c')](_0x15cec0);}})[_0xed8a('0x26')](function(_0x5783ea){if(_0x5783ea){return _0x5783ea?{'count':_0x4f54f9,'rows':_0x5783ea}:null;}})[_0xed8a('0x26')](respondWithResult(_0x55ef79,null))[_0xed8a('0x44')](handleError(_0x55ef79,null));};exports[_0xed8a('0x4f')]=function(_0xe3bd98,_0x2ab0cf,_0x43d54f){var _0x3d42bd={};var _0x1daf3={};var _0x2ba833;var _0x358f2e;return db[_0xed8a('0x2c')]['findOne']({'where':{'id':_0xe3bd98[_0xed8a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ab0cf,null))[_0xed8a('0x26')](function(_0xf61e3b){if(_0xf61e3b){_0x2ba833=_0xf61e3b;_0x1daf3[_0xed8a('0x31')]=_[_0xed8a('0x33')](db[_0xed8a('0x4e')]['rawAttributes']);_0x1daf3[_0xed8a('0x32')]=_['keys'](_0xe3bd98[_0xed8a('0x32')]);_0x1daf3[_0xed8a('0x3c')]=_[_0xed8a('0x34')](_0x1daf3[_0xed8a('0x31')],_0x1daf3[_0xed8a('0x32')]);_0x3d42bd[_0xed8a('0x35')]=_[_0xed8a('0x34')](_0x1daf3['model'],qs[_0xed8a('0x46')](_0xe3bd98[_0xed8a('0x32')][_0xed8a('0x46')]));_0x3d42bd[_0xed8a('0x35')]=_0x3d42bd['attributes'][_0xed8a('0x36')]?_0x3d42bd['attributes']:_0x1daf3[_0xed8a('0x31')];_0x3d42bd['order']=qs[_0xed8a('0x3a')](_0xe3bd98[_0xed8a('0x32')]['sort']);_0x3d42bd[_0xed8a('0x3b')]=qs[_0xed8a('0x3c')](_[_0xed8a('0x3d')](_0xe3bd98[_0xed8a('0x32')],_0x1daf3['filters']));if(_0xe3bd98[_0xed8a('0x32')]['filter']){_0x3d42bd[_0xed8a('0x3b')]=_[_0xed8a('0x3f')](_0x3d42bd[_0xed8a('0x3b')],{'$or':_[_0xed8a('0x2b')](_0x3d42bd[_0xed8a('0x35')],function(_0x7e5d9f){var _0x20bbde={};_0x20bbde[_0x7e5d9f]={'$like':'%'+_0xe3bd98[_0xed8a('0x32')][_0xed8a('0x3e')]+'%'};return _0x20bbde;})});}_0x3d42bd=_[_0xed8a('0x3f')]({},_0x3d42bd,_0xe3bd98[_0xed8a('0x41')]);return _0x2ba833[_0xed8a('0x4f')](_0x3d42bd);}})[_0xed8a('0x26')](function(_0x1e6fd1){if(_0x1e6fd1){_0x358f2e=_0x1e6fd1['length'];if(!_0xe3bd98['query'][_0xed8a('0x37')](_0xed8a('0x38'))){_0x3d42bd['limit']=qs[_0xed8a('0x1f')](_0xe3bd98['query']['limit']);_0x3d42bd[_0xed8a('0x1e')]=qs[_0xed8a('0x1e')](_0xe3bd98['query'][_0xed8a('0x1e')]);}return _0x2ba833[_0xed8a('0x4f')](_0x3d42bd);}})['then'](function(_0x5c343b){if(_0x5c343b){return _0x5c343b?{'count':_0x358f2e,'rows':_0x5c343b}:null;}})[_0xed8a('0x26')](respondWithResult(_0x2ab0cf,null))[_0xed8a('0x44')](handleError(_0x2ab0cf,null));};exports[_0xed8a('0x50')]=function(_0x5442ba,_0x7b65af,_0x1665eb){var _0x250fb2={};var _0x21fbd9={};var _0x43c0ab;var _0x4a234b;return db[_0xed8a('0x2c')][_0xed8a('0x4d')]({'where':{'id':_0x5442ba[_0xed8a('0x4b')]['id']}})[_0xed8a('0x26')](handleEntityNotFound(_0x7b65af,null))[_0xed8a('0x26')](function(_0x2a443b){if(_0x2a443b){_0x43c0ab=_0x2a443b;_0x21fbd9['model']=_[_0xed8a('0x33')](db['ZohoField'][_0xed8a('0x2d')]);_0x21fbd9[_0xed8a('0x32')]=_['keys'](_0x5442ba[_0xed8a('0x32')]);_0x21fbd9[_0xed8a('0x3c')]=_[_0xed8a('0x34')](_0x21fbd9[_0xed8a('0x31')],_0x21fbd9[_0xed8a('0x32')]);_0x250fb2['attributes']=_[_0xed8a('0x34')](_0x21fbd9[_0xed8a('0x31')],qs['fields'](_0x5442ba['query'][_0xed8a('0x46')]));_0x250fb2[_0xed8a('0x35')]=_0x250fb2['attributes'][_0xed8a('0x36')]?_0x250fb2[_0xed8a('0x35')]:_0x21fbd9[_0xed8a('0x31')];_0x250fb2['order']=qs[_0xed8a('0x3a')](_0x5442ba[_0xed8a('0x32')][_0xed8a('0x3a')]);_0x250fb2[_0xed8a('0x3b')]=qs[_0xed8a('0x3c')](_[_0xed8a('0x3d')](_0x5442ba[_0xed8a('0x32')],_0x21fbd9['filters']));if(_0x5442ba[_0xed8a('0x32')]['filter']){_0x250fb2[_0xed8a('0x3b')]=_[_0xed8a('0x3f')](_0x250fb2[_0xed8a('0x3b')],{'$or':_[_0xed8a('0x2b')](_0x250fb2[_0xed8a('0x35')],function(_0x211b4b){var _0x2d6e71={};_0x2d6e71[_0x211b4b]={'$like':'%'+_0x5442ba[_0xed8a('0x32')][_0xed8a('0x3e')]+'%'};return _0x2d6e71;})});}_0x250fb2=_['merge']({},_0x250fb2,_0x5442ba[_0xed8a('0x41')]);return _0x43c0ab[_0xed8a('0x50')](_0x250fb2);}})[_0xed8a('0x26')](function(_0x44bacb){if(_0x44bacb){_0x4a234b=_0x44bacb[_0xed8a('0x36')];if(!_0x5442ba[_0xed8a('0x32')][_0xed8a('0x37')](_0xed8a('0x38'))){_0x250fb2[_0xed8a('0x1f')]=qs[_0xed8a('0x1f')](_0x5442ba['query'][_0xed8a('0x1f')]);_0x250fb2[_0xed8a('0x1e')]=qs[_0xed8a('0x1e')](_0x5442ba[_0xed8a('0x32')][_0xed8a('0x1e')]);}return _0x43c0ab[_0xed8a('0x50')](_0x250fb2);}})[_0xed8a('0x26')](function(_0x4175bf){if(_0x4175bf){return _0x4175bf?{'count':_0x4a234b,'rows':_0x4175bf}:null;}})[_0xed8a('0x26')](respondWithResult(_0x7b65af,null))[_0xed8a('0x44')](handleError(_0x7b65af,null));}; \ No newline at end of file +var _0xfa9f=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZohoConfiguration','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x497a3e,_0x1f21bc){var _0x4e9a68=function(_0x459f54){while(--_0x459f54){_0x497a3e['push'](_0x497a3e['shift']());}};_0x4e9a68(++_0x1f21bc);}(_0xfa9f,0x12b));var _0xffa9=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0xfa9f[_0x5c0dcb];return _0x183a0e;};'use strict';var emlformat=require(_0xffa9('0x0'));var rimraf=require(_0xffa9('0x1'));var zipdir=require(_0xffa9('0x2'));var jsonpatch=require(_0xffa9('0x3'));var rp=require('request-promise');var moment=require(_0xffa9('0x4'));var BPromise=require(_0xffa9('0x5'));var Mustache=require('mustache');var util=require(_0xffa9('0x6'));var path=require(_0xffa9('0x7'));var sox=require(_0xffa9('0x8'));var csv=require(_0xffa9('0x9'));var ejs=require(_0xffa9('0xa'));var fs=require('fs');var fs_extra=require(_0xffa9('0xb'));var _=require('lodash');var squel=require(_0xffa9('0xc'));var crypto=require(_0xffa9('0xd'));var jsforce=require(_0xffa9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffa9('0x9'));var querystring=require('querystring');var Papa=require(_0xffa9('0xf'));var Redis=require(_0xffa9('0x10'));var authService=require(_0xffa9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xffa9('0x12'));var hardwareService=require(_0xffa9('0x13'));var logger=require('../../config/logger')(_0xffa9('0x14'));var utils=require(_0xffa9('0x15'));var config=require(_0xffa9('0x16'));var licenseUtil=require(_0xffa9('0x17'));var db=require(_0xffa9('0x18'))['db'];function respondWithStatusCode(_0xa24b6c,_0x55501c){_0x55501c=_0x55501c||0xcc;return function(_0x51bf19){if(_0x51bf19){return _0xa24b6c[_0xffa9('0x19')](_0x55501c);}return _0xa24b6c[_0xffa9('0x1a')](_0x55501c)[_0xffa9('0x1b')]();};}function respondWithResult(_0x507cae,_0x117d9c){_0x117d9c=_0x117d9c||0xc8;return function(_0x59918e){if(_0x59918e){return _0x507cae[_0xffa9('0x1a')](_0x117d9c)[_0xffa9('0x1c')](_0x59918e);}};}function respondWithFilteredResult(_0x46fbca,_0x1622ac){return function(_0x9686b1){if(_0x9686b1){var _0x28e224=typeof _0x1622ac[_0xffa9('0x1d')]==='undefined'&&typeof _0x1622ac['limit']===_0xffa9('0x1e');var _0x5c1cd7=_0x9686b1[_0xffa9('0x1f')];var _0x313e3f=_0x28e224?0x0:_0x1622ac[_0xffa9('0x1d')];var _0x346a42=_0x28e224?_0x9686b1[_0xffa9('0x1f')]:_0x1622ac[_0xffa9('0x1d')]+_0x1622ac[_0xffa9('0x20')];var _0x221505;if(_0x346a42>=_0x5c1cd7){_0x346a42=_0x5c1cd7;_0x221505=0xc8;}else{_0x221505=0xce;}_0x46fbca[_0xffa9('0x1a')](_0x221505);return _0x46fbca[_0xffa9('0x21')](_0xffa9('0x22'),_0x313e3f+'-'+_0x346a42+'/'+_0x5c1cd7)[_0xffa9('0x1c')](_0x9686b1);}return null;};}function patchUpdates(_0x1cfa28){return function(_0x611d03){try{jsonpatch[_0xffa9('0x23')](_0x611d03,_0x1cfa28,!![]);}catch(_0x23a70d){return BPromise[_0xffa9('0x24')](_0x23a70d);}return _0x611d03['save']();};}function saveUpdates(_0x44336e,_0x1b39e6){return function(_0x3191a6){if(_0x3191a6){return _0x3191a6[_0xffa9('0x25')](_0x44336e)['then'](function(_0x1a4f9a){return _0x1a4f9a;});}return null;};}function removeEntity(_0x26cdc8,_0x205dde){return function(_0x50af62){if(_0x50af62){return _0x50af62[_0xffa9('0x26')]()[_0xffa9('0x27')](function(){_0x26cdc8[_0xffa9('0x1a')](0xcc)[_0xffa9('0x1b')]();});}};}function handleEntityNotFound(_0xac8a0b,_0x3909bb){return function(_0x1f4e41){if(!_0x1f4e41){_0xac8a0b['sendStatus'](0x194);}return _0x1f4e41;};}function handleError(_0x32da28,_0x415600){_0x415600=_0x415600||0x1f4;return function(_0xb549ee){logger[_0xffa9('0x28')](_0xb549ee[_0xffa9('0x29')]);if(_0xb549ee['name']){delete _0xb549ee[_0xffa9('0x2a')];}_0x32da28[_0xffa9('0x1a')](_0x415600)['send'](_0xb549ee);};}exports['index']=function(_0x3e6020,_0x290457){var _0x1fe768={},_0x4a55cb={},_0x46f4f3={'count':0x0,'rows':[]};var _0x114d21=_[_0xffa9('0x2b')](db['ZohoConfiguration'][_0xffa9('0x2c')],function(_0x3aa97c){return{'name':_0x3aa97c[_0xffa9('0x2d')],'type':_0x3aa97c['type']['key']};});_0x4a55cb[_0xffa9('0x2e')]=_[_0xffa9('0x2b')](_0x114d21,_0xffa9('0x2a'));_0x4a55cb['query']=_[_0xffa9('0x2f')](_0x3e6020[_0xffa9('0x30')]);_0x4a55cb[_0xffa9('0x31')]=_[_0xffa9('0x32')](_0x4a55cb[_0xffa9('0x2e')],_0x4a55cb[_0xffa9('0x30')]);_0x1fe768[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0x4a55cb[_0xffa9('0x2e')],qs[_0xffa9('0x34')](_0x3e6020[_0xffa9('0x30')][_0xffa9('0x34')]));_0x1fe768['attributes']=_0x1fe768[_0xffa9('0x33')][_0xffa9('0x35')]?_0x1fe768[_0xffa9('0x33')]:_0x4a55cb[_0xffa9('0x2e')];if(!_0x3e6020[_0xffa9('0x30')][_0xffa9('0x36')](_0xffa9('0x37'))){_0x1fe768[_0xffa9('0x20')]=qs[_0xffa9('0x20')](_0x3e6020['query']['limit']);_0x1fe768[_0xffa9('0x1d')]=qs[_0xffa9('0x1d')](_0x3e6020[_0xffa9('0x30')][_0xffa9('0x1d')]);}_0x1fe768[_0xffa9('0x38')]=qs['sort'](_0x3e6020['query'][_0xffa9('0x39')]);_0x1fe768[_0xffa9('0x3a')]=qs[_0xffa9('0x31')](_[_0xffa9('0x3b')](_0x3e6020[_0xffa9('0x30')],_0x4a55cb[_0xffa9('0x31')]),_0x114d21);if(_0x3e6020[_0xffa9('0x30')][_0xffa9('0x3c')]){_0x1fe768['where']=_[_0xffa9('0x3d')](_0x1fe768[_0xffa9('0x3a')],{'$or':_['map'](_0x114d21,function(_0x36c85e){if(_0x36c85e['type']!==_0xffa9('0x3e')){var _0x50cdea={};_0x50cdea[_0x36c85e[_0xffa9('0x2a')]]={'$like':'%'+_0x3e6020[_0xffa9('0x30')]['filter']+'%'};return _0x50cdea;}})});}_0x1fe768=_['merge']({},_0x1fe768,_0x3e6020[_0xffa9('0x3f')]);var _0x571640={'where':_0x1fe768['where']};return db['ZohoConfiguration'][_0xffa9('0x1f')](_0x571640)[_0xffa9('0x27')](function(_0x273595){_0x46f4f3[_0xffa9('0x1f')]=_0x273595;if(_0x3e6020[_0xffa9('0x30')][_0xffa9('0x40')]){_0x1fe768[_0xffa9('0x41')]=[{'all':!![]}];}return db[_0xffa9('0x42')][_0xffa9('0x43')](_0x1fe768);})[_0xffa9('0x27')](function(_0x4051ea){_0x46f4f3[_0xffa9('0x44')]=_0x4051ea;return _0x46f4f3;})[_0xffa9('0x27')](respondWithFilteredResult(_0x290457,_0x1fe768))['catch'](handleError(_0x290457,null));};exports[_0xffa9('0x45')]=function(_0x21f11d,_0x138b44){var _0x16cc63={'raw':![],'where':{'id':_0x21f11d[_0xffa9('0x46')]['id']}},_0x4a9b83={};_0x4a9b83[_0xffa9('0x2e')]=_[_0xffa9('0x2f')](db[_0xffa9('0x42')][_0xffa9('0x2c')]);_0x4a9b83[_0xffa9('0x30')]=_[_0xffa9('0x2f')](_0x21f11d[_0xffa9('0x30')]);_0x4a9b83['filters']=_[_0xffa9('0x32')](_0x4a9b83[_0xffa9('0x2e')],_0x4a9b83[_0xffa9('0x30')]);_0x16cc63[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0x4a9b83[_0xffa9('0x2e')],qs[_0xffa9('0x34')](_0x21f11d[_0xffa9('0x30')][_0xffa9('0x34')]));_0x16cc63[_0xffa9('0x33')]=_0x16cc63['attributes'][_0xffa9('0x35')]?_0x16cc63[_0xffa9('0x33')]:_0x4a9b83[_0xffa9('0x2e')];if(_0x21f11d[_0xffa9('0x30')][_0xffa9('0x40')]){_0x16cc63[_0xffa9('0x41')]=[{'all':!![]}];}_0x16cc63=_[_0xffa9('0x3d')]({},_0x16cc63,_0x21f11d[_0xffa9('0x3f')]);return db[_0xffa9('0x42')][_0xffa9('0x47')](_0x16cc63)[_0xffa9('0x27')](handleEntityNotFound(_0x138b44,null))[_0xffa9('0x27')](respondWithResult(_0x138b44,null))[_0xffa9('0x48')](handleError(_0x138b44,null));};exports[_0xffa9('0x49')]=function(_0x5dec49,_0x1cd03c){return db['ZohoConfiguration']['create'](_0x5dec49[_0xffa9('0x4a')],{})['then'](respondWithResult(_0x1cd03c,0xc9))[_0xffa9('0x48')](handleError(_0x1cd03c,null));};exports[_0xffa9('0x25')]=function(_0x2c8f74,_0x1b7a51){if(_0x2c8f74['body']['id']){delete _0x2c8f74[_0xffa9('0x4a')]['id'];}return db[_0xffa9('0x42')][_0xffa9('0x47')]({'where':{'id':_0x2c8f74[_0xffa9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b7a51,null))[_0xffa9('0x27')](saveUpdates(_0x2c8f74[_0xffa9('0x4a')],null))[_0xffa9('0x27')](respondWithResult(_0x1b7a51,null))[_0xffa9('0x48')](handleError(_0x1b7a51,null));};exports[_0xffa9('0x26')]=function(_0x3de466,_0x5ca151){return db[_0xffa9('0x42')][_0xffa9('0x47')]({'where':{'id':_0x3de466[_0xffa9('0x46')]['id']}})[_0xffa9('0x27')](handleEntityNotFound(_0x5ca151,null))['then'](removeEntity(_0x5ca151,null))['catch'](handleError(_0x5ca151,null));};exports[_0xffa9('0x4b')]=function(_0x2aaa73,_0x11487d,_0x2f82cf){var _0x283ab7={};var _0x54729d={};var _0x528745;var _0x12cff5;return db[_0xffa9('0x42')][_0xffa9('0x4c')]({'where':{'id':_0x2aaa73['params']['id']}})[_0xffa9('0x27')](handleEntityNotFound(_0x11487d,null))[_0xffa9('0x27')](function(_0x4d6947){if(_0x4d6947){_0x528745=_0x4d6947;_0x54729d['model']=_[_0xffa9('0x2f')](db[_0xffa9('0x4d')]['rawAttributes']);_0x54729d[_0xffa9('0x30')]=_[_0xffa9('0x2f')](_0x2aaa73['query']);_0x54729d[_0xffa9('0x31')]=_[_0xffa9('0x32')](_0x54729d[_0xffa9('0x2e')],_0x54729d[_0xffa9('0x30')]);_0x283ab7[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0x54729d[_0xffa9('0x2e')],qs['fields'](_0x2aaa73[_0xffa9('0x30')]['fields']));_0x283ab7['attributes']=_0x283ab7[_0xffa9('0x33')]['length']?_0x283ab7[_0xffa9('0x33')]:_0x54729d[_0xffa9('0x2e')];_0x283ab7[_0xffa9('0x38')]=qs['sort'](_0x2aaa73[_0xffa9('0x30')]['sort']);_0x283ab7[_0xffa9('0x3a')]=qs['filters'](_[_0xffa9('0x3b')](_0x2aaa73[_0xffa9('0x30')],_0x54729d[_0xffa9('0x31')]));if(_0x2aaa73[_0xffa9('0x30')][_0xffa9('0x3c')]){_0x283ab7[_0xffa9('0x3a')]=_[_0xffa9('0x3d')](_0x283ab7[_0xffa9('0x3a')],{'$or':_[_0xffa9('0x2b')](_0x283ab7[_0xffa9('0x33')],function(_0x2d0a15){var _0x5d3f4f={};_0x5d3f4f[_0x2d0a15]={'$like':'%'+_0x2aaa73[_0xffa9('0x30')][_0xffa9('0x3c')]+'%'};return _0x5d3f4f;})});}_0x283ab7=_[_0xffa9('0x3d')]({},_0x283ab7,_0x2aaa73[_0xffa9('0x3f')]);return _0x528745[_0xffa9('0x4b')](_0x283ab7);}})['then'](function(_0x1d87f7){if(_0x1d87f7){_0x12cff5=_0x1d87f7['length'];if(!_0x2aaa73[_0xffa9('0x30')][_0xffa9('0x36')](_0xffa9('0x37'))){_0x283ab7[_0xffa9('0x20')]=qs[_0xffa9('0x20')](_0x2aaa73['query'][_0xffa9('0x20')]);_0x283ab7[_0xffa9('0x1d')]=qs['offset'](_0x2aaa73[_0xffa9('0x30')][_0xffa9('0x1d')]);}return _0x528745[_0xffa9('0x4b')](_0x283ab7);}})[_0xffa9('0x27')](function(_0x546a43){if(_0x546a43){return _0x546a43?{'count':_0x12cff5,'rows':_0x546a43}:null;}})['then'](respondWithResult(_0x11487d,null))[_0xffa9('0x48')](handleError(_0x11487d,null));};exports[_0xffa9('0x4e')]=function(_0x247745,_0x3b8fd0,_0x61208b){var _0x486509={};var _0x3d77ce={};var _0x4db346;var _0x24549a;return db[_0xffa9('0x42')][_0xffa9('0x4c')]({'where':{'id':_0x247745['params']['id']}})[_0xffa9('0x27')](handleEntityNotFound(_0x3b8fd0,null))[_0xffa9('0x27')](function(_0x2e4f79){if(_0x2e4f79){_0x4db346=_0x2e4f79;_0x3d77ce[_0xffa9('0x2e')]=_['keys'](db[_0xffa9('0x4d')][_0xffa9('0x2c')]);_0x3d77ce['query']=_[_0xffa9('0x2f')](_0x247745[_0xffa9('0x30')]);_0x3d77ce[_0xffa9('0x31')]=_['intersection'](_0x3d77ce[_0xffa9('0x2e')],_0x3d77ce[_0xffa9('0x30')]);_0x486509[_0xffa9('0x33')]=_[_0xffa9('0x32')](_0x3d77ce[_0xffa9('0x2e')],qs[_0xffa9('0x34')](_0x247745['query'][_0xffa9('0x34')]));_0x486509['attributes']=_0x486509['attributes'][_0xffa9('0x35')]?_0x486509['attributes']:_0x3d77ce[_0xffa9('0x2e')];_0x486509[_0xffa9('0x38')]=qs[_0xffa9('0x39')](_0x247745[_0xffa9('0x30')][_0xffa9('0x39')]);_0x486509['where']=qs[_0xffa9('0x31')](_[_0xffa9('0x3b')](_0x247745['query'],_0x3d77ce[_0xffa9('0x31')]));if(_0x247745[_0xffa9('0x30')][_0xffa9('0x3c')]){_0x486509[_0xffa9('0x3a')]=_['merge'](_0x486509[_0xffa9('0x3a')],{'$or':_[_0xffa9('0x2b')](_0x486509[_0xffa9('0x33')],function(_0x247700){var _0x215033={};_0x215033[_0x247700]={'$like':'%'+_0x247745[_0xffa9('0x30')][_0xffa9('0x3c')]+'%'};return _0x215033;})});}_0x486509=_[_0xffa9('0x3d')]({},_0x486509,_0x247745[_0xffa9('0x3f')]);return _0x4db346['getSubjects'](_0x486509);}})[_0xffa9('0x27')](function(_0x455653){if(_0x455653){_0x24549a=_0x455653[_0xffa9('0x35')];if(!_0x247745[_0xffa9('0x30')][_0xffa9('0x36')]('nolimit')){_0x486509[_0xffa9('0x20')]=qs[_0xffa9('0x20')](_0x247745[_0xffa9('0x30')]['limit']);_0x486509[_0xffa9('0x1d')]=qs['offset'](_0x247745[_0xffa9('0x30')][_0xffa9('0x1d')]);}return _0x4db346[_0xffa9('0x4e')](_0x486509);}})[_0xffa9('0x27')](function(_0xb6ba83){if(_0xb6ba83){return _0xb6ba83?{'count':_0x24549a,'rows':_0xb6ba83}:null;}})['then'](respondWithResult(_0x3b8fd0,null))[_0xffa9('0x48')](handleError(_0x3b8fd0,null));};exports[_0xffa9('0x4f')]=function(_0x4e1610,_0xbb6d37,_0x5efd7e){var _0x4f5c2f={};var _0x5d751c={};var _0x27d37d;var _0x2e213c;return db[_0xffa9('0x42')][_0xffa9('0x4c')]({'where':{'id':_0x4e1610[_0xffa9('0x46')]['id']}})['then'](handleEntityNotFound(_0xbb6d37,null))['then'](function(_0x2dfe29){if(_0x2dfe29){_0x27d37d=_0x2dfe29;_0x5d751c[_0xffa9('0x2e')]=_[_0xffa9('0x2f')](db[_0xffa9('0x4d')][_0xffa9('0x2c')]);_0x5d751c['query']=_[_0xffa9('0x2f')](_0x4e1610[_0xffa9('0x30')]);_0x5d751c[_0xffa9('0x31')]=_[_0xffa9('0x32')](_0x5d751c[_0xffa9('0x2e')],_0x5d751c['query']);_0x4f5c2f['attributes']=_[_0xffa9('0x32')](_0x5d751c[_0xffa9('0x2e')],qs['fields'](_0x4e1610[_0xffa9('0x30')][_0xffa9('0x34')]));_0x4f5c2f[_0xffa9('0x33')]=_0x4f5c2f[_0xffa9('0x33')][_0xffa9('0x35')]?_0x4f5c2f[_0xffa9('0x33')]:_0x5d751c[_0xffa9('0x2e')];_0x4f5c2f[_0xffa9('0x38')]=qs[_0xffa9('0x39')](_0x4e1610[_0xffa9('0x30')][_0xffa9('0x39')]);_0x4f5c2f[_0xffa9('0x3a')]=qs[_0xffa9('0x31')](_[_0xffa9('0x3b')](_0x4e1610[_0xffa9('0x30')],_0x5d751c[_0xffa9('0x31')]));if(_0x4e1610[_0xffa9('0x30')][_0xffa9('0x3c')]){_0x4f5c2f[_0xffa9('0x3a')]=_['merge'](_0x4f5c2f[_0xffa9('0x3a')],{'$or':_[_0xffa9('0x2b')](_0x4f5c2f[_0xffa9('0x33')],function(_0x383e63){var _0x377652={};_0x377652[_0x383e63]={'$like':'%'+_0x4e1610[_0xffa9('0x30')][_0xffa9('0x3c')]+'%'};return _0x377652;})});}_0x4f5c2f=_[_0xffa9('0x3d')]({},_0x4f5c2f,_0x4e1610[_0xffa9('0x3f')]);return _0x27d37d[_0xffa9('0x4f')](_0x4f5c2f);}})[_0xffa9('0x27')](function(_0x17f338){if(_0x17f338){_0x2e213c=_0x17f338[_0xffa9('0x35')];if(!_0x4e1610['query']['hasOwnProperty'](_0xffa9('0x37'))){_0x4f5c2f[_0xffa9('0x20')]=qs[_0xffa9('0x20')](_0x4e1610[_0xffa9('0x30')]['limit']);_0x4f5c2f[_0xffa9('0x1d')]=qs[_0xffa9('0x1d')](_0x4e1610[_0xffa9('0x30')][_0xffa9('0x1d')]);}return _0x27d37d[_0xffa9('0x4f')](_0x4f5c2f);}})[_0xffa9('0x27')](function(_0x39fda1){if(_0x39fda1){return _0x39fda1?{'count':_0x2e213c,'rows':_0x39fda1}:null;}})[_0xffa9('0x27')](respondWithResult(_0xbb6d37,null))[_0xffa9('0x48')](handleError(_0xbb6d37,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 56f878d..55b2ce6 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 _0xadaa=['exports','define','ZohoConfiguration','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x4bffb0,_0x27bd29){var _0x1c73a5=function(_0x5baa54){while(--_0x5baa54){_0x4bffb0['push'](_0x4bffb0['shift']());}};_0x1c73a5(++_0x27bd29);}(_0xadaa,0x66));var _0xaada=function(_0x4d770e,_0x527446){_0x4d770e=_0x4d770e-0x0;var _0x3ebdf7=_0xadaa[_0x4d770e];return _0x3ebdf7;};'use strict';var _=require('lodash');var util=require(_0xaada('0x0'));var logger=require(_0xaada('0x1'))(_0xaada('0x2'));var moment=require(_0xaada('0x3'));var BPromise=require(_0xaada('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaada('0x5'));var config=require(_0xaada('0x6'));var attributes=require(_0xaada('0x7'));module[_0xaada('0x8')]=function(_0x1caf3e,_0x46ee47){return _0x1caf3e[_0xaada('0x9')](_0xaada('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c07=['bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c07,0x198));var _0x72c0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2c07[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x72c0('0x0'));var logger=require('../../config/logger')(_0x72c0('0x1'));var moment=require('moment');var BPromise=require(_0x72c0('0x2'));var rp=require(_0x72c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72c0('0x4'));var config=require(_0x72c0('0x5'));var attributes=require(_0x72c0('0x6'));module[_0x72c0('0x7')]=function(_0x2c8efa,_0x3f47b8){return _0x2c8efa[_0x72c0('0x8')](_0x72c0('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 734be96..17c6c39 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 _0xbf9f=['message','ZohoConfiguration,\x20%s,\x20%s','info','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x51ff32,_0x57572b){var _0x466e27=function(_0x484b79){while(--_0x484b79){_0x51ff32['push'](_0x51ff32['shift']());}};_0x466e27(++_0x57572b);}(_0xbf9f,0x1e6));var _0xfbf9=function(_0x39620b,_0x37e2d2){_0x39620b=_0x39620b-0x0;var _0x38f1ff=_0xbf9f[_0x39620b];return _0x38f1ff;};'use strict';var _=require('lodash');var util=require(_0xfbf9('0x0'));var moment=require(_0xfbf9('0x1'));var BPromise=require(_0xfbf9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbf9('0x3'));var db=require(_0xfbf9('0x4'))['db'];var utils=require(_0xfbf9('0x5'));var logger=require('../../config/logger')(_0xfbf9('0x6'));var config=require(_0xfbf9('0x7'));var jayson=require(_0xfbf9('0x8'));var client=jayson[_0xfbf9('0x9')][_0xfbf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4f79,_0x57215f,_0x1c199a){return new BPromise(function(_0x593319,_0x28319f){return client[_0xfbf9('0xb')](_0x5b4f79,_0x1c199a)[_0xfbf9('0xc')](function(_0x446064){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x57215f,_0xfbf9('0xd'));logger[_0xfbf9('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x57215f,_0xfbf9('0xd'),JSON[_0xfbf9('0xf')](_0x446064));if(_0x446064[_0xfbf9('0x10')]){if(_0x446064[_0xfbf9('0x10')][_0xfbf9('0x11')]===0x1f4){logger[_0xfbf9('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x57215f,_0x446064[_0xfbf9('0x10')][_0xfbf9('0x12')]);return _0x28319f(_0x446064[_0xfbf9('0x10')][_0xfbf9('0x12')]);}logger['error'](_0xfbf9('0x13'),_0x57215f,_0x446064['error'][_0xfbf9('0x12')]);return _0x593319(_0x446064[_0xfbf9('0x10')][_0xfbf9('0x12')]);}else{logger[_0xfbf9('0x14')](_0xfbf9('0x13'),_0x57215f,_0xfbf9('0xd'));_0x593319(_0x446064['result']['message']);}})['catch'](function(_0x29f821){logger[_0xfbf9('0x10')](_0xfbf9('0x13'),_0x57215f,_0x29f821);_0x28319f(_0x29f821);});});} \ No newline at end of file +var _0xd763=['http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xd763,0x1ae));var _0x3d76=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xd763[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x3d76('0x0'));var moment=require(_0x3d76('0x1'));var BPromise=require(_0x3d76('0x2'));var rs=require(_0x3d76('0x3'));var fs=require('fs');var Redis=require(_0x3d76('0x4'));var db=require(_0x3d76('0x5'))['db'];var utils=require(_0x3d76('0x6'));var logger=require(_0x3d76('0x7'))(_0x3d76('0x8'));var config=require('../../config/environment');var jayson=require(_0x3d76('0x9'));var client=jayson[_0x3d76('0xa')][_0x3d76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5786f3,_0x1671d0,_0x329adc){return new BPromise(function(_0x21d76c,_0x2d9d34){return client['request'](_0x5786f3,_0x329adc)['then'](function(_0x4d41e6){logger[_0x3d76('0xc')](_0x3d76('0xd'),_0x1671d0,_0x3d76('0xe'));logger[_0x3d76('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1671d0,_0x3d76('0xe'),JSON[_0x3d76('0x10')](_0x4d41e6));if(_0x4d41e6[_0x3d76('0x11')]){if(_0x4d41e6[_0x3d76('0x11')][_0x3d76('0x12')]===0x1f4){logger[_0x3d76('0x11')](_0x3d76('0xd'),_0x1671d0,_0x4d41e6[_0x3d76('0x11')][_0x3d76('0x13')]);return _0x2d9d34(_0x4d41e6['error'][_0x3d76('0x13')]);}logger[_0x3d76('0x11')](_0x3d76('0xd'),_0x1671d0,_0x4d41e6[_0x3d76('0x11')]['message']);return _0x21d76c(_0x4d41e6['error'][_0x3d76('0x13')]);}else{logger[_0x3d76('0xc')](_0x3d76('0xd'),_0x1671d0,'request\x20sent');_0x21d76c(_0x4d41e6[_0x3d76('0x14')][_0x3d76('0x13')]);}})['catch'](function(_0x2fddcd){logger[_0x3d76('0x11')](_0x3d76('0xd'),_0x1671d0,_0x2fddcd);_0x2d9d34(_0x2fddcd);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 45370d0..aab5d60 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 _0x32f8=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x47e344,_0x47c74e){var _0x28bd4b=function(_0x1d4b22){while(--_0x1d4b22){_0x47e344['push'](_0x47e344['shift']());}};_0x28bd4b(++_0x47c74e);}(_0x32f8,0x8f));var _0x832f=function(_0xd870b,_0xcbc7d1){_0xd870b=_0xd870b-0x0;var _0x3ef665=_0x32f8[_0xd870b];return _0x3ef665;};'use strict';var multer=require(_0x832f('0x0'));var util=require(_0x832f('0x1'));var path=require(_0x832f('0x2'));var timeout=require(_0x832f('0x3'));var express=require(_0x832f('0x4'));var router=express[_0x832f('0x5')]();var fs_extra=require(_0x832f('0x6'));var auth=require(_0x832f('0x7'));var interaction=require(_0x832f('0x8'));var config=require('../../config/environment');var controller=require(_0x832f('0x9'));router[_0x832f('0xa')]('/',auth['isAuthenticated'](),controller[_0x832f('0xb')]);router[_0x832f('0xa')](_0x832f('0xc'),auth[_0x832f('0xd')](),controller[_0x832f('0xe')]);router['post']('/',auth[_0x832f('0xd')](),controller[_0x832f('0xf')]);router[_0x832f('0x10')](_0x832f('0xc'),auth[_0x832f('0xd')](),controller[_0x832f('0x11')]);router[_0x832f('0x12')](_0x832f('0xc'),auth[_0x832f('0xd')](),controller['destroy']);module[_0x832f('0x13')]=router; \ No newline at end of file +var _0xa699=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer','util','path'];(function(_0x5edbac,_0xa54f78){var _0x2a5b78=function(_0x1c598d){while(--_0x1c598d){_0x5edbac['push'](_0x5edbac['shift']());}};_0x2a5b78(++_0xa54f78);}(_0xa699,0x153));var _0x9a69=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xa699[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var path=require(_0x9a69('0x2'));var timeout=require(_0x9a69('0x3'));var express=require('express');var router=express[_0x9a69('0x4')]();var fs_extra=require(_0x9a69('0x5'));var auth=require(_0x9a69('0x6'));var interaction=require(_0x9a69('0x7'));var config=require(_0x9a69('0x8'));var controller=require(_0x9a69('0x9'));router['get']('/',auth[_0x9a69('0xa')](),controller['index']);router['get'](_0x9a69('0xb'),auth[_0x9a69('0xa')](),controller[_0x9a69('0xc')]);router[_0x9a69('0xd')]('/',auth['isAuthenticated'](),controller[_0x9a69('0xe')]);router[_0x9a69('0xf')](_0x9a69('0xb'),auth[_0x9a69('0xa')](),controller['update']);router[_0x9a69('0x10')]('/:id',auth[_0x9a69('0xa')](),controller[_0x9a69('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 993205b..f56479d 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 _0x5f76=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x5e38ca,_0x263e1b){var _0x165866=function(_0x404667){while(--_0x404667){_0x5e38ca['push'](_0x5e38ca['shift']());}};_0x165866(++_0x263e1b);}(_0x5f76,0x1b8));var _0x65f7=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x5f76[_0xcda377];return _0x1c024f;};'use strict';var Sequelize=require(_0x65f7('0x0'));module[_0x65f7('0x1')]={'type':{'type':Sequelize[_0x65f7('0x2')](_0x65f7('0x3'),'variable',_0x65f7('0x4'),_0x65f7('0x5'),_0x65f7('0x6')),'defaultValue':_0x65f7('0x3')},'content':{'type':Sequelize[_0x65f7('0x7')]},'key':{'type':Sequelize[_0x65f7('0x7')]},'keyType':{'type':Sequelize[_0x65f7('0x2')](_0x65f7('0x3'),_0x65f7('0x8'),_0x65f7('0x4'))},'keyContent':{'type':Sequelize[_0x65f7('0x7')]},'idField':{'type':Sequelize[_0x65f7('0x7')]},'nameField':{'type':Sequelize[_0x65f7('0x7')]},'customField':{'type':Sequelize[_0x65f7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcbd0=['keyValue','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x2fe351,_0x39063e){var _0x3e557a=function(_0x492467){while(--_0x492467){_0x2fe351['push'](_0x2fe351['shift']());}};_0x3e557a(++_0x39063e);}(_0xcbd0,0x136));var _0x0cbd=function(_0x1de64a,_0x4af93a){_0x1de64a=_0x1de64a-0x0;var _0xc6db62=_0xcbd0[_0x1de64a];return _0xc6db62;};'use strict';var Sequelize=require(_0x0cbd('0x0'));module[_0x0cbd('0x1')]={'type':{'type':Sequelize[_0x0cbd('0x2')]('string',_0x0cbd('0x3'),_0x0cbd('0x4'),_0x0cbd('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0cbd('0x6')]},'keyType':{'type':Sequelize[_0x0cbd('0x2')](_0x0cbd('0x7'),'variable',_0x0cbd('0x4'))},'keyContent':{'type':Sequelize[_0x0cbd('0x6')]},'idField':{'type':Sequelize[_0x0cbd('0x6')]},'nameField':{'type':Sequelize[_0x0cbd('0x6')]},'customField':{'type':Sequelize[_0x0cbd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0cbd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 900587a..8399f5d 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 _0xfa34=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfa34,0x74));var _0x4fa3=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xfa34[_0x25fc41];return _0x1371d1;};'use strict';var emlformat=require(_0x4fa3('0x0'));var rimraf=require(_0x4fa3('0x1'));var zipdir=require(_0x4fa3('0x2'));var jsonpatch=require(_0x4fa3('0x3'));var rp=require(_0x4fa3('0x4'));var moment=require(_0x4fa3('0x5'));var BPromise=require(_0x4fa3('0x6'));var Mustache=require('mustache');var util=require(_0x4fa3('0x7'));var path=require(_0x4fa3('0x8'));var sox=require(_0x4fa3('0x9'));var csv=require(_0x4fa3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fa3('0xb'));var _=require(_0x4fa3('0xc'));var squel=require(_0x4fa3('0xd'));var crypto=require(_0x4fa3('0xe'));var jsforce=require(_0x4fa3('0xf'));var deskjs=require(_0x4fa3('0x10'));var toCsv=require(_0x4fa3('0xa'));var querystring=require(_0x4fa3('0x11'));var Papa=require(_0x4fa3('0x12'));var Redis=require('ioredis');var authService=require(_0x4fa3('0x13'));var qs=require(_0x4fa3('0x14'));var as=require(_0x4fa3('0x15'));var hardwareService=require(_0x4fa3('0x16'));var logger=require('../../config/logger')(_0x4fa3('0x17'));var utils=require(_0x4fa3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4fa3('0x19'))['db'];function respondWithStatusCode(_0x42a3c7,_0x406e2c){_0x406e2c=_0x406e2c||0xcc;return function(_0xd0f81f){if(_0xd0f81f){return _0x42a3c7['sendStatus'](_0x406e2c);}return _0x42a3c7[_0x4fa3('0x1a')](_0x406e2c)[_0x4fa3('0x1b')]();};}function respondWithResult(_0x245d8c,_0x3d34e5){_0x3d34e5=_0x3d34e5||0xc8;return function(_0x2be4fe){if(_0x2be4fe){return _0x245d8c[_0x4fa3('0x1a')](_0x3d34e5)[_0x4fa3('0x1c')](_0x2be4fe);}};}function respondWithFilteredResult(_0x58727c,_0x103ce0){return function(_0x506f05){if(_0x506f05){var _0x5725ef=typeof _0x103ce0[_0x4fa3('0x1d')]===_0x4fa3('0x1e')&&typeof _0x103ce0[_0x4fa3('0x1f')]===_0x4fa3('0x1e');var _0x3385f4=_0x506f05[_0x4fa3('0x20')];var _0x47cceb=_0x5725ef?0x0:_0x103ce0[_0x4fa3('0x1d')];var _0x1967ce=_0x5725ef?_0x506f05[_0x4fa3('0x20')]:_0x103ce0[_0x4fa3('0x1d')]+_0x103ce0[_0x4fa3('0x1f')];var _0x2a011c;if(_0x1967ce>=_0x3385f4){_0x1967ce=_0x3385f4;_0x2a011c=0xc8;}else{_0x2a011c=0xce;}_0x58727c[_0x4fa3('0x1a')](_0x2a011c);return _0x58727c['set'](_0x4fa3('0x21'),_0x47cceb+'-'+_0x1967ce+'/'+_0x3385f4)['json'](_0x506f05);}return null;};}function patchUpdates(_0x45fb80){return function(_0x2c557d){try{jsonpatch[_0x4fa3('0x22')](_0x2c557d,_0x45fb80,!![]);}catch(_0x507115){return BPromise[_0x4fa3('0x23')](_0x507115);}return _0x2c557d[_0x4fa3('0x24')]();};}function saveUpdates(_0x1bb445,_0x2f5a87){return function(_0x2b9b2f){if(_0x2b9b2f){return _0x2b9b2f[_0x4fa3('0x25')](_0x1bb445)[_0x4fa3('0x26')](function(_0x459a92){return _0x459a92;});}return null;};}function removeEntity(_0x5b802c,_0x284259){return function(_0x5ecf37){if(_0x5ecf37){return _0x5ecf37[_0x4fa3('0x27')]()[_0x4fa3('0x26')](function(){_0x5b802c['status'](0xcc)[_0x4fa3('0x1b')]();});}};}function handleEntityNotFound(_0x1de19a,_0x372934){return function(_0x4f37a2){if(!_0x4f37a2){_0x1de19a['sendStatus'](0x194);}return _0x4f37a2;};}function handleError(_0x3c469d,_0xaecd52){_0xaecd52=_0xaecd52||0x1f4;return function(_0x3f26cd){logger[_0x4fa3('0x28')](_0x3f26cd[_0x4fa3('0x29')]);if(_0x3f26cd[_0x4fa3('0x2a')]){delete _0x3f26cd[_0x4fa3('0x2a')];}_0x3c469d[_0x4fa3('0x1a')](_0xaecd52)['send'](_0x3f26cd);};}exports[_0x4fa3('0x2b')]=function(_0x183f0c,_0x2faf0d){var _0x495a9f={},_0x4bb156={},_0x4c9617={'count':0x0,'rows':[]};var _0xe21c77=_[_0x4fa3('0x2c')](db[_0x4fa3('0x2d')][_0x4fa3('0x2e')],function(_0x56eeea){return{'name':_0x56eeea[_0x4fa3('0x2f')],'type':_0x56eeea[_0x4fa3('0x30')][_0x4fa3('0x31')]};});_0x4bb156[_0x4fa3('0x32')]=_['map'](_0xe21c77,_0x4fa3('0x2a'));_0x4bb156[_0x4fa3('0x33')]=_[_0x4fa3('0x34')](_0x183f0c[_0x4fa3('0x33')]);_0x4bb156[_0x4fa3('0x35')]=_['intersection'](_0x4bb156[_0x4fa3('0x32')],_0x4bb156['query']);_0x495a9f[_0x4fa3('0x36')]=_[_0x4fa3('0x37')](_0x4bb156[_0x4fa3('0x32')],qs[_0x4fa3('0x38')](_0x183f0c['query'][_0x4fa3('0x38')]));_0x495a9f[_0x4fa3('0x36')]=_0x495a9f[_0x4fa3('0x36')][_0x4fa3('0x39')]?_0x495a9f['attributes']:_0x4bb156['model'];if(!_0x183f0c[_0x4fa3('0x33')]['hasOwnProperty'](_0x4fa3('0x3a'))){_0x495a9f[_0x4fa3('0x1f')]=qs[_0x4fa3('0x1f')](_0x183f0c[_0x4fa3('0x33')]['limit']);_0x495a9f['offset']=qs[_0x4fa3('0x1d')](_0x183f0c[_0x4fa3('0x33')]['offset']);}_0x495a9f[_0x4fa3('0x3b')]=qs['sort'](_0x183f0c['query']['sort']);_0x495a9f[_0x4fa3('0x3c')]=qs[_0x4fa3('0x35')](_['pick'](_0x183f0c['query'],_0x4bb156['filters']),_0xe21c77);if(_0x183f0c['query'][_0x4fa3('0x3d')]){_0x495a9f[_0x4fa3('0x3c')]=_[_0x4fa3('0x3e')](_0x495a9f[_0x4fa3('0x3c')],{'$or':_[_0x4fa3('0x2c')](_0xe21c77,function(_0x4488a0){if(_0x4488a0[_0x4fa3('0x30')]!=='VIRTUAL'){var _0x28ec2c={};_0x28ec2c[_0x4488a0['name']]={'$like':'%'+_0x183f0c['query'][_0x4fa3('0x3d')]+'%'};return _0x28ec2c;}})});}_0x495a9f=_['merge']({},_0x495a9f,_0x183f0c[_0x4fa3('0x3f')]);var _0x1b2489={'where':_0x495a9f[_0x4fa3('0x3c')]};return db[_0x4fa3('0x2d')][_0x4fa3('0x20')](_0x1b2489)[_0x4fa3('0x26')](function(_0x3099f3){_0x4c9617[_0x4fa3('0x20')]=_0x3099f3;if(_0x183f0c[_0x4fa3('0x33')][_0x4fa3('0x40')]){_0x495a9f[_0x4fa3('0x41')]=[{'all':!![]}];}return db[_0x4fa3('0x2d')][_0x4fa3('0x42')](_0x495a9f);})[_0x4fa3('0x26')](function(_0x3d17b0){_0x4c9617[_0x4fa3('0x43')]=_0x3d17b0;return _0x4c9617;})['then'](respondWithFilteredResult(_0x2faf0d,_0x495a9f))[_0x4fa3('0x44')](handleError(_0x2faf0d,null));};exports['show']=function(_0xa6401e,_0x2c8dc1){var _0x30b926={'raw':!![],'where':{'id':_0xa6401e[_0x4fa3('0x45')]['id']}},_0x35e287={};_0x35e287[_0x4fa3('0x32')]=_['keys'](db[_0x4fa3('0x2d')][_0x4fa3('0x2e')]);_0x35e287[_0x4fa3('0x33')]=_[_0x4fa3('0x34')](_0xa6401e['query']);_0x35e287['filters']=_[_0x4fa3('0x37')](_0x35e287['model'],_0x35e287['query']);_0x30b926[_0x4fa3('0x36')]=_[_0x4fa3('0x37')](_0x35e287['model'],qs[_0x4fa3('0x38')](_0xa6401e['query'][_0x4fa3('0x38')]));_0x30b926['attributes']=_0x30b926[_0x4fa3('0x36')][_0x4fa3('0x39')]?_0x30b926[_0x4fa3('0x36')]:_0x35e287[_0x4fa3('0x32')];if(_0xa6401e[_0x4fa3('0x33')][_0x4fa3('0x40')]){_0x30b926[_0x4fa3('0x41')]=[{'all':!![]}];}_0x30b926=_[_0x4fa3('0x3e')]({},_0x30b926,_0xa6401e['options']);return db[_0x4fa3('0x2d')]['find'](_0x30b926)[_0x4fa3('0x26')](handleEntityNotFound(_0x2c8dc1,null))[_0x4fa3('0x26')](respondWithResult(_0x2c8dc1,null))['catch'](handleError(_0x2c8dc1,null));};exports[_0x4fa3('0x46')]=function(_0x172071,_0x11ce33){return db[_0x4fa3('0x2d')]['create'](_0x172071['body'],{})[_0x4fa3('0x26')](respondWithResult(_0x11ce33,0xc9))[_0x4fa3('0x44')](handleError(_0x11ce33,null));};exports[_0x4fa3('0x25')]=function(_0x4aa090,_0x4ce7de){if(_0x4aa090[_0x4fa3('0x47')]['id']){delete _0x4aa090['body']['id'];}return db[_0x4fa3('0x2d')][_0x4fa3('0x48')]({'where':{'id':_0x4aa090[_0x4fa3('0x45')]['id']}})[_0x4fa3('0x26')](handleEntityNotFound(_0x4ce7de,null))[_0x4fa3('0x26')](saveUpdates(_0x4aa090[_0x4fa3('0x47')],null))[_0x4fa3('0x26')](respondWithResult(_0x4ce7de,null))[_0x4fa3('0x44')](handleError(_0x4ce7de,null));};exports[_0x4fa3('0x27')]=function(_0x86889b,_0x13c5f6){return db[_0x4fa3('0x2d')][_0x4fa3('0x48')]({'where':{'id':_0x86889b['params']['id']}})[_0x4fa3('0x26')](handleEntityNotFound(_0x13c5f6,null))['then'](removeEntity(_0x13c5f6,null))['catch'](handleError(_0x13c5f6,null));}; \ No newline at end of file +var _0x800c=['model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ZohoField','rawAttributes','fieldName','key'];(function(_0x380850,_0x419d76){var _0x2a7056=function(_0x33c83a){while(--_0x33c83a){_0x380850['push'](_0x380850['shift']());}};_0x2a7056(++_0x419d76);}(_0x800c,0xa7));var _0xc800=function(_0xf80abf,_0x415c0e){_0xf80abf=_0xf80abf-0x0;var _0x425d32=_0x800c[_0xf80abf];return _0x425d32;};'use strict';var emlformat=require(_0xc800('0x0'));var rimraf=require(_0xc800('0x1'));var zipdir=require(_0xc800('0x2'));var jsonpatch=require(_0xc800('0x3'));var rp=require(_0xc800('0x4'));var moment=require('moment');var BPromise=require(_0xc800('0x5'));var Mustache=require(_0xc800('0x6'));var util=require(_0xc800('0x7'));var path=require('path');var sox=require(_0xc800('0x8'));var csv=require(_0xc800('0x9'));var ejs=require(_0xc800('0xa'));var fs=require('fs');var fs_extra=require(_0xc800('0xb'));var _=require(_0xc800('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc800('0xd'));var toCsv=require(_0xc800('0x9'));var querystring=require(_0xc800('0xe'));var Papa=require(_0xc800('0xf'));var Redis=require(_0xc800('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc800('0x11'));var as=require(_0xc800('0x12'));var hardwareService=require(_0xc800('0x13'));var logger=require(_0xc800('0x14'))(_0xc800('0x15'));var utils=require('../../config/utils');var config=require(_0xc800('0x16'));var licenseUtil=require(_0xc800('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9638fc,_0x119096){_0x119096=_0x119096||0xcc;return function(_0x1994b1){if(_0x1994b1){return _0x9638fc[_0xc800('0x18')](_0x119096);}return _0x9638fc['status'](_0x119096)['end']();};}function respondWithResult(_0x473924,_0x12cc32){_0x12cc32=_0x12cc32||0xc8;return function(_0x58c64d){if(_0x58c64d){return _0x473924[_0xc800('0x19')](_0x12cc32)[_0xc800('0x1a')](_0x58c64d);}};}function respondWithFilteredResult(_0x527cc5,_0x523f13){return function(_0x482811){if(_0x482811){var _0x4ce393=typeof _0x523f13[_0xc800('0x1b')]===_0xc800('0x1c')&&typeof _0x523f13[_0xc800('0x1d')]===_0xc800('0x1c');var _0x51fcd1=_0x482811['count'];var _0x4cc843=_0x4ce393?0x0:_0x523f13[_0xc800('0x1b')];var _0x41d2f2=_0x4ce393?_0x482811[_0xc800('0x1e')]:_0x523f13['offset']+_0x523f13[_0xc800('0x1d')];var _0x2f94d9;if(_0x41d2f2>=_0x51fcd1){_0x41d2f2=_0x51fcd1;_0x2f94d9=0xc8;}else{_0x2f94d9=0xce;}_0x527cc5['status'](_0x2f94d9);return _0x527cc5[_0xc800('0x1f')](_0xc800('0x20'),_0x4cc843+'-'+_0x41d2f2+'/'+_0x51fcd1)['json'](_0x482811);}return null;};}function patchUpdates(_0x2a2998){return function(_0x33ce82){try{jsonpatch['apply'](_0x33ce82,_0x2a2998,!![]);}catch(_0x369df1){return BPromise[_0xc800('0x21')](_0x369df1);}return _0x33ce82[_0xc800('0x22')]();};}function saveUpdates(_0x71fa93,_0x2e9727){return function(_0x3a10b5){if(_0x3a10b5){return _0x3a10b5[_0xc800('0x23')](_0x71fa93)[_0xc800('0x24')](function(_0x271a01){return _0x271a01;});}return null;};}function removeEntity(_0x3e944d,_0x194c44){return function(_0x4a7bd0){if(_0x4a7bd0){return _0x4a7bd0[_0xc800('0x25')]()[_0xc800('0x24')](function(){_0x3e944d[_0xc800('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53f1bf,_0x4fa9de){return function(_0x147ee1){if(!_0x147ee1){_0x53f1bf[_0xc800('0x18')](0x194);}return _0x147ee1;};}function handleError(_0x326e08,_0x10a7ab){_0x10a7ab=_0x10a7ab||0x1f4;return function(_0x3c0aff){logger[_0xc800('0x26')](_0x3c0aff[_0xc800('0x27')]);if(_0x3c0aff[_0xc800('0x28')]){delete _0x3c0aff[_0xc800('0x28')];}_0x326e08[_0xc800('0x19')](_0x10a7ab)['send'](_0x3c0aff);};}exports[_0xc800('0x29')]=function(_0x166cbf,_0xe8e66f){var _0x1f97db={},_0x287e46={},_0x5363b1={'count':0x0,'rows':[]};var _0x4f0529=_['map'](db[_0xc800('0x2a')][_0xc800('0x2b')],function(_0x4af657){return{'name':_0x4af657[_0xc800('0x2c')],'type':_0x4af657['type'][_0xc800('0x2d')]};});_0x287e46[_0xc800('0x2e')]=_[_0xc800('0x2f')](_0x4f0529,'name');_0x287e46['query']=_[_0xc800('0x30')](_0x166cbf[_0xc800('0x31')]);_0x287e46[_0xc800('0x32')]=_[_0xc800('0x33')](_0x287e46[_0xc800('0x2e')],_0x287e46[_0xc800('0x31')]);_0x1f97db[_0xc800('0x34')]=_[_0xc800('0x33')](_0x287e46[_0xc800('0x2e')],qs[_0xc800('0x35')](_0x166cbf[_0xc800('0x31')][_0xc800('0x35')]));_0x1f97db[_0xc800('0x34')]=_0x1f97db[_0xc800('0x34')][_0xc800('0x36')]?_0x1f97db[_0xc800('0x34')]:_0x287e46[_0xc800('0x2e')];if(!_0x166cbf['query'][_0xc800('0x37')](_0xc800('0x38'))){_0x1f97db[_0xc800('0x1d')]=qs[_0xc800('0x1d')](_0x166cbf['query']['limit']);_0x1f97db[_0xc800('0x1b')]=qs[_0xc800('0x1b')](_0x166cbf[_0xc800('0x31')]['offset']);}_0x1f97db['order']=qs['sort'](_0x166cbf[_0xc800('0x31')][_0xc800('0x39')]);_0x1f97db[_0xc800('0x3a')]=qs['filters'](_[_0xc800('0x3b')](_0x166cbf[_0xc800('0x31')],_0x287e46['filters']),_0x4f0529);if(_0x166cbf[_0xc800('0x31')][_0xc800('0x3c')]){_0x1f97db[_0xc800('0x3a')]=_[_0xc800('0x3d')](_0x1f97db[_0xc800('0x3a')],{'$or':_['map'](_0x4f0529,function(_0x1092f9){if(_0x1092f9['type']!==_0xc800('0x3e')){var _0x4134a1={};_0x4134a1[_0x1092f9[_0xc800('0x28')]]={'$like':'%'+_0x166cbf['query'][_0xc800('0x3c')]+'%'};return _0x4134a1;}})});}_0x1f97db=_['merge']({},_0x1f97db,_0x166cbf['options']);var _0x408ef1={'where':_0x1f97db[_0xc800('0x3a')]};return db[_0xc800('0x2a')]['count'](_0x408ef1)[_0xc800('0x24')](function(_0x31558f){_0x5363b1[_0xc800('0x1e')]=_0x31558f;if(_0x166cbf[_0xc800('0x31')][_0xc800('0x3f')]){_0x1f97db[_0xc800('0x40')]=[{'all':!![]}];}return db[_0xc800('0x2a')]['findAll'](_0x1f97db);})['then'](function(_0x55b1b0){_0x5363b1[_0xc800('0x41')]=_0x55b1b0;return _0x5363b1;})[_0xc800('0x24')](respondWithFilteredResult(_0xe8e66f,_0x1f97db))[_0xc800('0x42')](handleError(_0xe8e66f,null));};exports[_0xc800('0x43')]=function(_0x256460,_0x2c4124){var _0x51c6b7={'raw':!![],'where':{'id':_0x256460[_0xc800('0x44')]['id']}},_0x14182f={};_0x14182f['model']=_[_0xc800('0x30')](db[_0xc800('0x2a')][_0xc800('0x2b')]);_0x14182f['query']=_[_0xc800('0x30')](_0x256460[_0xc800('0x31')]);_0x14182f[_0xc800('0x32')]=_[_0xc800('0x33')](_0x14182f[_0xc800('0x2e')],_0x14182f[_0xc800('0x31')]);_0x51c6b7['attributes']=_[_0xc800('0x33')](_0x14182f['model'],qs[_0xc800('0x35')](_0x256460['query'][_0xc800('0x35')]));_0x51c6b7[_0xc800('0x34')]=_0x51c6b7[_0xc800('0x34')]['length']?_0x51c6b7[_0xc800('0x34')]:_0x14182f['model'];if(_0x256460['query'][_0xc800('0x3f')]){_0x51c6b7[_0xc800('0x40')]=[{'all':!![]}];}_0x51c6b7=_[_0xc800('0x3d')]({},_0x51c6b7,_0x256460['options']);return db['ZohoField']['find'](_0x51c6b7)['then'](handleEntityNotFound(_0x2c4124,null))[_0xc800('0x24')](respondWithResult(_0x2c4124,null))[_0xc800('0x42')](handleError(_0x2c4124,null));};exports[_0xc800('0x45')]=function(_0xe8d47c,_0x1f1aec){return db['ZohoField'][_0xc800('0x45')](_0xe8d47c[_0xc800('0x46')],{})[_0xc800('0x24')](respondWithResult(_0x1f1aec,0xc9))['catch'](handleError(_0x1f1aec,null));};exports[_0xc800('0x23')]=function(_0x4a8856,_0x239d06){if(_0x4a8856[_0xc800('0x46')]['id']){delete _0x4a8856[_0xc800('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x4a8856['params']['id']}})[_0xc800('0x24')](handleEntityNotFound(_0x239d06,null))['then'](saveUpdates(_0x4a8856[_0xc800('0x46')],null))[_0xc800('0x24')](respondWithResult(_0x239d06,null))[_0xc800('0x42')](handleError(_0x239d06,null));};exports['destroy']=function(_0x2b376a,_0x128043){return db[_0xc800('0x2a')]['find']({'where':{'id':_0x2b376a[_0xc800('0x44')]['id']}})['then'](handleEntityNotFound(_0x128043,null))['then'](removeEntity(_0x128043,null))[_0xc800('0x42')](handleError(_0x128043,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b8e3f8b..dd4b403 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 _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','ZohoField','idField','FieldId'];(function(_0x182374,_0x28d649){var _0x1fc3f3=function(_0x5c6a93){while(--_0x5c6a93){_0x182374['push'](_0x182374['shift']());}};_0x1fc3f3(++_0x28d649);}(_0x6343,0x168));var _0x3634=function(_0x54b8f7,_0x1880ba){_0x54b8f7=_0x54b8f7-0x0;var _0x52c474=_0x6343[_0x54b8f7];return _0x52c474;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./intZohoField.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x3634('0x7'),_0x3634('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0xa0080f,_0x46ada7){var _0x145021=function(_0x2168f2){while(--_0x2168f2){_0xa0080f['push'](_0xa0080f['shift']());}};_0x145021(++_0x46ada7);}(_0x90b1,0x1bb));var _0x190b=function(_0xe551ca,_0x196d3c){_0xe551ca=_0xe551ca-0x0;var _0x11268d=_0x90b1[_0xe551ca];return _0x11268d;};'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 diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 80d73e1..9ae997d 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 _0xc442=['ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2bd750,_0x39be0a){var _0xf32aab=function(_0x2c7869){while(--_0x2c7869){_0x2bd750['push'](_0x2bd750['shift']());}};_0xf32aab(++_0x39be0a);}(_0xc442,0x70));var _0x2c44=function(_0x4b966e,_0x490465){_0x4b966e=_0x4b966e-0x0;var _0x456670=_0xc442[_0x4b966e];return _0x456670;};'use strict';var _=require(_0x2c44('0x0'));var util=require(_0x2c44('0x1'));var moment=require(_0x2c44('0x2'));var BPromise=require(_0x2c44('0x3'));var rs=require(_0x2c44('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c44('0x5'));var logger=require(_0x2c44('0x6'))(_0x2c44('0x7'));var config=require(_0x2c44('0x8'));var jayson=require(_0x2c44('0x9'));var client=jayson[_0x2c44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaa1fe9,_0x16576a,_0x577ff8){return new BPromise(function(_0x356b53,_0x40ef74){return client[_0x2c44('0xb')](_0xaa1fe9,_0x577ff8)[_0x2c44('0xc')](function(_0x5034f5){logger[_0x2c44('0xd')](_0x2c44('0xe'),_0x16576a,_0x2c44('0xf'));logger[_0x2c44('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x16576a,_0x2c44('0xf'),JSON['stringify'](_0x5034f5));if(_0x5034f5[_0x2c44('0x11')]){if(_0x5034f5[_0x2c44('0x11')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x16576a,_0x5034f5[_0x2c44('0x11')][_0x2c44('0x12')]);return _0x40ef74(_0x5034f5[_0x2c44('0x11')]['message']);}logger[_0x2c44('0x11')]('ZohoField,\x20%s,\x20%s',_0x16576a,_0x5034f5[_0x2c44('0x11')][_0x2c44('0x12')]);return _0x356b53(_0x5034f5[_0x2c44('0x11')][_0x2c44('0x12')]);}else{logger[_0x2c44('0xd')](_0x2c44('0xe'),_0x16576a,_0x2c44('0xf'));_0x356b53(_0x5034f5[_0x2c44('0x13')]['message']);}})[_0x2c44('0x14')](function(_0x5ce68b){logger[_0x2c44('0x11')](_0x2c44('0xe'),_0x16576a,_0x5ce68b);_0x40ef74(_0x5ce68b);});});} \ No newline at end of file +var _0xdd32=['error','ZohoField,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify'];(function(_0x3a0f56,_0x12643a){var _0x313fe2=function(_0x4ee1b3){while(--_0x4ee1b3){_0x3a0f56['push'](_0x3a0f56['shift']());}};_0x313fe2(++_0x12643a);}(_0xdd32,0x98));var _0x2dd3=function(_0x1dde61,_0x4d3e0f){_0x1dde61=_0x1dde61-0x0;var _0x385e38=_0xdd32[_0x1dde61];return _0x385e38;};'use strict';var _=require(_0x2dd3('0x0'));var util=require('util');var moment=require(_0x2dd3('0x1'));var BPromise=require(_0x2dd3('0x2'));var rs=require(_0x2dd3('0x3'));var fs=require('fs');var Redis=require(_0x2dd3('0x4'));var db=require(_0x2dd3('0x5'))['db'];var utils=require(_0x2dd3('0x6'));var logger=require(_0x2dd3('0x7'))('rpc');var config=require(_0x2dd3('0x8'));var jayson=require(_0x2dd3('0x9'));var client=jayson[_0x2dd3('0xa')][_0x2dd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a4bf6,_0x219ccc,_0x453cef){return new BPromise(function(_0x4593a6,_0x5c4c51){return client['request'](_0x2a4bf6,_0x453cef)[_0x2dd3('0xc')](function(_0x37cfe7){logger['info']('ZohoField,\x20%s,\x20%s',_0x219ccc,_0x2dd3('0xd'));logger[_0x2dd3('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x219ccc,_0x2dd3('0xd'),JSON[_0x2dd3('0xf')](_0x37cfe7));if(_0x37cfe7[_0x2dd3('0x10')]){if(_0x37cfe7[_0x2dd3('0x10')]['code']===0x1f4){logger[_0x2dd3('0x10')](_0x2dd3('0x11'),_0x219ccc,_0x37cfe7[_0x2dd3('0x10')]['message']);return _0x5c4c51(_0x37cfe7[_0x2dd3('0x10')][_0x2dd3('0x12')]);}logger[_0x2dd3('0x10')](_0x2dd3('0x11'),_0x219ccc,_0x37cfe7[_0x2dd3('0x10')][_0x2dd3('0x12')]);return _0x4593a6(_0x37cfe7['error'][_0x2dd3('0x12')]);}else{logger[_0x2dd3('0x13')](_0x2dd3('0x11'),_0x219ccc,_0x2dd3('0xd'));_0x4593a6(_0x37cfe7[_0x2dd3('0x14')][_0x2dd3('0x12')]);}})['catch'](function(_0x1c5fd7){logger[_0x2dd3('0x10')]('ZohoField,\x20%s,\x20%s',_0x219ccc,_0x1c5fd7);_0x5c4c51(_0x1c5fd7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b31a164..0042955 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x35337b,_0x1eceb8){var _0x3ee320=function(_0x241fd9){while(--_0x241fd9){_0x35337b['push'](_0x35337b['shift']());}};_0x3ee320(++_0x1eceb8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xcb91[_0x443494];return _0x4a6794;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x584da8,_0x4944c4){var _0x4da924=function(_0x348f16){while(--_0x348f16){_0x584da8['push'](_0x584da8['shift']());}};_0x4da924(++_0x4944c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 594588a..c453075 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 _0x7426=['STRING','unique_name_and_version','app.js','INTEGER','exports'];(function(_0x27ccb6,_0x103913){var _0x412043=function(_0x3c1624){while(--_0x3c1624){_0x27ccb6['push'](_0x27ccb6['shift']());}};_0x412043(++_0x103913);}(_0x7426,0x1df));var _0x6742=function(_0x2fb944,_0x29608b){_0x2fb944=_0x2fb944-0x0;var _0x363982=_0x7426[_0x2fb944];return _0x363982;};'use strict';var Sequelize=require('sequelize');module[_0x6742('0x0')]={'name':{'type':Sequelize[_0x6742('0x1')],'allowNull':![],'unique':_0x6742('0x2')},'version':{'type':Sequelize[_0x6742('0x1')],'allowNull':![],'unique':_0x6742('0x2')},'main':{'type':Sequelize[_0x6742('0x1')],'defaultValue':_0x6742('0x3')},'filename':{'type':Sequelize[_0x6742('0x1')]},'path':{'type':Sequelize[_0x6742('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x6742('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x6742('0x1')]},'logo':{'type':Sequelize[_0x6742('0x1')]},'state':{'type':Sequelize[_0x6742('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x6742('0x1')]},'remoteUri':{'type':Sequelize[_0x6742('0x1')]},'link':{'type':Sequelize[_0x6742('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2961=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports'];(function(_0x4a76e8,_0x135452){var _0x5b9238=function(_0x3d4b7e){while(--_0x3d4b7e){_0x4a76e8['push'](_0x4a76e8['shift']());}};_0x5b9238(++_0x135452);}(_0x2961,0x102));var _0x1296=function(_0x17ec56,_0xe22cc9){_0x17ec56=_0x17ec56-0x0;var _0x51f6ee=_0x2961[_0x17ec56];return _0x51f6ee;};'use strict';var Sequelize=require('sequelize');module[_0x1296('0x0')]={'name':{'type':Sequelize[_0x1296('0x1')],'allowNull':![],'unique':_0x1296('0x2')},'version':{'type':Sequelize[_0x1296('0x1')],'allowNull':![],'unique':_0x1296('0x2')},'main':{'type':Sequelize[_0x1296('0x1')],'defaultValue':_0x1296('0x3')},'filename':{'type':Sequelize[_0x1296('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x1296('0x4')]},'active':{'type':Sequelize[_0x1296('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x1296('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x1296('0x6')},'description':{'type':Sequelize[_0x1296('0x1')]},'title':{'type':Sequelize[_0x1296('0x1')]},'remoteUri':{'type':Sequelize[_0x1296('0x1')]},'link':{'type':Sequelize[_0x1296('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0f1fb9d..2b4088f 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x1261,0x144));var _0x1126=function(_0x42b949,_0x5ef2cd){_0x42b949=_0x42b949-0x0;var _0x1bd737=_0x1261[_0x42b949];return _0x1bd737;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0xd943=['mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Integration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x237fd6,_0x59d931){var _0x253f77=function(_0x77a4e3){while(--_0x77a4e3){_0x237fd6['push'](_0x237fd6['shift']());}};_0x253f77(++_0x59d931);}(_0xd943,0x15d));var _0x3d94=function(_0x123ccb,_0x5be5f3){_0x123ccb=_0x123ccb-0x0;var _0x22a278=_0xd943[_0x123ccb];return _0x22a278;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9b8a47e..589c2b6 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 _0xfd0c=['path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','util','api','request-promise'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xfd0c,0xf7));var _0xcfd0=function(_0x3168e1,_0xa046e0){_0x3168e1=_0x3168e1-0x0;var _0x13ad69=_0xfd0c[_0x3168e1];return _0x13ad69;};'use strict';var _=require('lodash');var util=require(_0xcfd0('0x0'));var logger=require('../../config/logger')(_0xcfd0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcfd0('0x2'));var fs=require('fs');var path=require(_0xcfd0('0x3'));var rimraf=require(_0xcfd0('0x4'));var config=require(_0xcfd0('0x5'));var attributes=require(_0xcfd0('0x6'));module[_0xcfd0('0x7')]=function(_0x443892,_0xe97209){return _0x443892['define'](_0xcfd0('0x8'),attributes,{'tableName':_0xcfd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeddf=['request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','util','../../config/logger','api','moment','bluebird'];(function(_0xbd729a,_0x3d64d1){var _0x436c0a=function(_0x14f293){while(--_0x14f293){_0xbd729a['push'](_0xbd729a['shift']());}};_0x436c0a(++_0x3d64d1);}(_0xeddf,0x1e7));var _0xfedd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeddf[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xfedd('0x0'));var logger=require(_0xfedd('0x1'))(_0xfedd('0x2'));var moment=require(_0xfedd('0x3'));var BPromise=require(_0xfedd('0x4'));var rp=require(_0xfedd('0x5'));var fs=require('fs');var path=require(_0xfedd('0x6'));var rimraf=require(_0xfedd('0x7'));var config=require(_0xfedd('0x8'));var attributes=require(_0xfedd('0x9'));module['exports']=function(_0x303809,_0x59b459){return _0x303809[_0xfedd('0xa')](_0xfedd('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 1fb854c..54a3780 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 _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x210b0e,_0x311cc9){var _0x6bf2bb=function(_0x534345){while(--_0x534345){_0x210b0e['push'](_0x210b0e['shift']());}};_0x6bf2bb(++_0x311cc9);}(_0x57ca,0x108));var _0xa57c=function(_0x424aa0,_0x222daf){_0x424aa0=_0x424aa0-0x0;var _0x400e88=_0x57ca[_0x424aa0];return _0x400e88;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2ccdb9,_0x3ded46){var _0x4e8120=function(_0x350d80){while(--_0x350d80){_0x2ccdb9['push'](_0x2ccdb9['shift']());}};_0x4e8120(++_0x3ded46);}(_0xadb5,0xad));var _0x5adb=function(_0x23b1a4,_0xa5d898){_0x23b1a4=_0x23b1a4-0x0;var _0x4eb659=_0xadb5[_0x23b1a4];return _0x4eb659;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5a94bb5..1a0ba6e 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 _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x56efbd,_0xb7ace8){var _0x333d91=function(_0x1f47d2){while(--_0x1f47d2){_0x56efbd['push'](_0x56efbd['shift']());}};_0x333d91(++_0xb7ace8);}(_0x1a85,0x178));var _0x51a8=function(_0x2b12b7,_0x2621a1){_0x2b12b7=_0x2b12b7-0x0;var _0x2c7af3=_0x1a85[_0x2b12b7];return _0x2c7af3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3f36ca9..6861581 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 _0xbbf6=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x38e50d,_0x4e53e0){var _0x3d055a=function(_0x583fb6){while(--_0x583fb6){_0x38e50d['push'](_0x38e50d['shift']());}};_0x3d055a(++_0x4e53e0);}(_0xbbf6,0x150));var _0x6bbf=function(_0x589dce,_0x277be2){_0x589dce=_0x589dce-0x0;var _0x41e2e8=_0xbbf6[_0x589dce];return _0x41e2e8;};'use strict';var Sequelize=require('sequelize');module[_0x6bbf('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x6bbf('0x1')]},'exitStatus':{'type':Sequelize[_0x6bbf('0x1')]},'ticketId':{'type':Sequelize[_0x6bbf('0x1')]},'integrationId':{'type':Sequelize[_0x6bbf('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6bbf('0x1')]},'queue':{'type':Sequelize[_0x6bbf('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6bbf('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6bbf('0x3')]},'holdtime':{'type':Sequelize[_0x6bbf('0x2')]},'agentcomplete':{'type':Sequelize[_0x6bbf('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6bbf('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x6bbf('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6bbf('0x3')]},'agentdump':{'type':Sequelize[_0x6bbf('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6bbf('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6bbf('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6bbf('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6bbf('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6bbf('0x1')]},'accountcode':{'type':Sequelize[_0x6bbf('0x1')]},'context':{'type':Sequelize[_0x6bbf('0x1')]},'exten':{'type':Sequelize[_0x6bbf('0x1')]},'priority':{'type':Sequelize[_0x6bbf('0x1')]},'destchannel':{'type':Sequelize[_0x6bbf('0x1')]},'destchannelstate':{'type':Sequelize[_0x6bbf('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6bbf('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6bbf('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6bbf('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6bbf('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6bbf('0x1')]},'destpriority':{'type':Sequelize[_0x6bbf('0x1')]},'destuniqueid':{'type':Sequelize[_0x6bbf('0x1')]},'messageId':{'type':Sequelize[_0x6bbf('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x6bbf('0x1')]},'from':{'type':Sequelize[_0x6bbf('0x1')]},'to':{'type':Sequelize[_0x6bbf('0x1')]},'cc':{'type':Sequelize[_0x6bbf('0x1')]},'attachment':{'type':Sequelize[_0x6bbf('0x5')]},'html':{'type':Sequelize[_0x6bbf('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6bbf('0x6')](_0x6bbf('0x7'),_0x6bbf('0x8'),_0x6bbf('0x9'),_0x6bbf('0xa'))},'url':{'type':Sequelize[_0x6bbf('0x1')]},'app':{'type':Sequelize[_0x6bbf('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6bbf('0x2')]}}; \ No newline at end of file +var _0xd6cd=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x35e910,_0x3a8661){var _0xacdd5b=function(_0x570adc){while(--_0x570adc){_0x35e910['push'](_0x35e910['shift']());}};_0xacdd5b(++_0x3a8661);}(_0xd6cd,0x1ab));var _0xdd6c=function(_0x32c1d6,_0x2011d7){_0x32c1d6=_0x32c1d6-0x0;var _0x22e2ce=_0xd6cd[_0x32c1d6];return _0x22e2ce;};'use strict';var Sequelize=require(_0xdd6c('0x0'));module[_0xdd6c('0x1')]={'integration':{'type':Sequelize[_0xdd6c('0x2')]},'eventChannel':{'type':Sequelize[_0xdd6c('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xdd6c('0x2')]},'integrationId':{'type':Sequelize[_0xdd6c('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdd6c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdd6c('0x2')]},'interface':{'type':Sequelize[_0xdd6c('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xdd6c('0x4')]},'agentconnectAt':{'type':Sequelize[_0xdd6c('0x4')]},'holdtime':{'type':Sequelize[_0xdd6c('0x3')]},'agentcomplete':{'type':Sequelize[_0xdd6c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xdd6c('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xdd6c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdd6c('0x3')]},'reason':{'type':Sequelize[_0xdd6c('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xdd6c('0x4')]},'agentdump':{'type':Sequelize[_0xdd6c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xdd6c('0x4')]},'lastevent':{'type':Sequelize[_0xdd6c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xdd6c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdd6c('0x2')]},'language':{'type':Sequelize[_0xdd6c('0x2')]},'accountcode':{'type':Sequelize[_0xdd6c('0x2')]},'context':{'type':Sequelize[_0xdd6c('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdd6c('0x2')]},'destchannel':{'type':Sequelize[_0xdd6c('0x2')]},'destchannelstate':{'type':Sequelize[_0xdd6c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xdd6c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdd6c('0x2')]},'destcalleridname':{'type':Sequelize[_0xdd6c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdd6c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xdd6c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xdd6c('0x2')]},'destexten':{'type':Sequelize[_0xdd6c('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xdd6c('0x2')]},'messageId':{'type':Sequelize[_0xdd6c('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xdd6c('0x2')]},'to':{'type':Sequelize[_0xdd6c('0x2')]},'cc':{'type':Sequelize[_0xdd6c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xdd6c('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xdd6c('0x7')](_0xdd6c('0x8'),_0xdd6c('0x9'),_0xdd6c('0xa'),_0xdd6c('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xdd6c('0x2')]},'appdata':{'type':Sequelize[_0xdd6c('0x2')]},'projectId':{'type':Sequelize[_0xdd6c('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 69f1a98..23754c6 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 _0xca94=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','IntegrationReport','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','fs-extra'];(function(_0x1138c4,_0x841d33){var _0x200cc1=function(_0x2f6d85){while(--_0x2f6d85){_0x1138c4['push'](_0x1138c4['shift']());}};_0x200cc1(++_0x841d33);}(_0xca94,0x8f));var _0x4ca9=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xca94[_0x236c89];return _0x3b2a15;};'use strict';var emlformat=require(_0x4ca9('0x0'));var rimraf=require(_0x4ca9('0x1'));var zipdir=require(_0x4ca9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ca9('0x3'));var moment=require(_0x4ca9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ca9('0x5'));var util=require(_0x4ca9('0x6'));var path=require(_0x4ca9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ca9('0x8'));var _=require(_0x4ca9('0x9'));var squel=require('squel');var crypto=require(_0x4ca9('0xa'));var jsforce=require(_0x4ca9('0xb'));var deskjs=require(_0x4ca9('0xc'));var toCsv=require(_0x4ca9('0xd'));var querystring=require(_0x4ca9('0xe'));var Papa=require(_0x4ca9('0xf'));var Redis=require(_0x4ca9('0x10'));var authService=require(_0x4ca9('0x11'));var qs=require(_0x4ca9('0x12'));var as=require(_0x4ca9('0x13'));var hardwareService=require(_0x4ca9('0x14'));var logger=require('../../config/logger')(_0x4ca9('0x15'));var utils=require(_0x4ca9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ca9('0x17'))['db'];function respondWithStatusCode(_0x9c7e1,_0x20f52a){_0x20f52a=_0x20f52a||0xcc;return function(_0x155c99){if(_0x155c99){return _0x9c7e1[_0x4ca9('0x18')](_0x20f52a);}return _0x9c7e1[_0x4ca9('0x19')](_0x20f52a)[_0x4ca9('0x1a')]();};}function respondWithResult(_0x42096f,_0x143d19){_0x143d19=_0x143d19||0xc8;return function(_0xca6959){if(_0xca6959){return _0x42096f[_0x4ca9('0x19')](_0x143d19)['json'](_0xca6959);}};}function respondWithFilteredResult(_0x389b5e,_0x25e5f0){return function(_0x1dd45a){if(_0x1dd45a){var _0x42026d=typeof _0x25e5f0[_0x4ca9('0x1b')]===_0x4ca9('0x1c')&&typeof _0x25e5f0[_0x4ca9('0x1d')]===_0x4ca9('0x1c');var _0x44ddc3=_0x1dd45a[_0x4ca9('0x1e')];var _0x3925ed=_0x42026d?0x0:_0x25e5f0[_0x4ca9('0x1b')];var _0x2e9212=_0x42026d?_0x1dd45a['count']:_0x25e5f0[_0x4ca9('0x1b')]+_0x25e5f0['limit'];var _0x4e13a7;if(_0x2e9212>=_0x44ddc3){_0x2e9212=_0x44ddc3;_0x4e13a7=0xc8;}else{_0x4e13a7=0xce;}_0x389b5e[_0x4ca9('0x19')](_0x4e13a7);return _0x389b5e[_0x4ca9('0x1f')](_0x4ca9('0x20'),_0x3925ed+'-'+_0x2e9212+'/'+_0x44ddc3)[_0x4ca9('0x21')](_0x1dd45a);}return null;};}function patchUpdates(_0x37dd7c){return function(_0x581d4a){try{jsonpatch[_0x4ca9('0x22')](_0x581d4a,_0x37dd7c,!![]);}catch(_0x2abd47){return BPromise[_0x4ca9('0x23')](_0x2abd47);}return _0x581d4a[_0x4ca9('0x24')]();};}function saveUpdates(_0xbdd78,_0x493228){return function(_0x20ddf8){if(_0x20ddf8){return _0x20ddf8[_0x4ca9('0x25')](_0xbdd78)['then'](function(_0x46fae4){return _0x46fae4;});}return null;};}function removeEntity(_0x66e94e,_0x3fbb60){return function(_0x4e0ba7){if(_0x4e0ba7){return _0x4e0ba7[_0x4ca9('0x26')]()[_0x4ca9('0x27')](function(){_0x66e94e[_0x4ca9('0x19')](0xcc)[_0x4ca9('0x1a')]();});}};}function handleEntityNotFound(_0x3915e4,_0x2c8322){return function(_0x11ff62){if(!_0x11ff62){_0x3915e4[_0x4ca9('0x18')](0x194);}return _0x11ff62;};}function handleError(_0x1bd1bd,_0x4bfa7b){_0x4bfa7b=_0x4bfa7b||0x1f4;return function(_0xdda90e){logger[_0x4ca9('0x28')](_0xdda90e[_0x4ca9('0x29')]);if(_0xdda90e[_0x4ca9('0x2a')]){delete _0xdda90e[_0x4ca9('0x2a')];}_0x1bd1bd['status'](_0x4bfa7b)[_0x4ca9('0x2b')](_0xdda90e);};}exports[_0x4ca9('0x2c')]=function(_0x4944b5,_0x147966){var _0x20f2ec={},_0x1b27ef={},_0x56867e={'count':0x0,'rows':[]};var _0x5d263b=_[_0x4ca9('0x2d')](db['IntegrationReport'][_0x4ca9('0x2e')],function(_0x5145da){return{'name':_0x5145da[_0x4ca9('0x2f')],'type':_0x5145da[_0x4ca9('0x30')][_0x4ca9('0x31')]};});_0x1b27ef[_0x4ca9('0x32')]=_[_0x4ca9('0x2d')](_0x5d263b,_0x4ca9('0x2a'));_0x1b27ef['query']=_[_0x4ca9('0x33')](_0x4944b5['query']);_0x1b27ef[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x1b27ef[_0x4ca9('0x32')],_0x1b27ef['query']);_0x20f2ec[_0x4ca9('0x36')]=_['intersection'](_0x1b27ef[_0x4ca9('0x32')],qs['fields'](_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x38')]));_0x20f2ec['attributes']=_0x20f2ec[_0x4ca9('0x36')][_0x4ca9('0x39')]?_0x20f2ec[_0x4ca9('0x36')]:_0x1b27ef[_0x4ca9('0x32')];if(!_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x3a')](_0x4ca9('0x3b'))){_0x20f2ec['limit']=qs['limit'](_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x1d')]);_0x20f2ec['offset']=qs[_0x4ca9('0x1b')](_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x1b')]);}_0x20f2ec['order']=qs[_0x4ca9('0x3c')](_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x3c')]);_0x20f2ec[_0x4ca9('0x3d')]=qs[_0x4ca9('0x34')](_['pick'](_0x4944b5[_0x4ca9('0x37')],_0x1b27ef[_0x4ca9('0x34')]),_0x5d263b);if(_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x3e')]){_0x20f2ec[_0x4ca9('0x3d')]=_[_0x4ca9('0x3f')](_0x20f2ec[_0x4ca9('0x3d')],{'$or':_[_0x4ca9('0x2d')](_0x5d263b,function(_0x122466){if(_0x122466['type']!=='VIRTUAL'){var _0x85b409={};_0x85b409[_0x122466[_0x4ca9('0x2a')]]={'$like':'%'+_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x3e')]+'%'};return _0x85b409;}})});}_0x20f2ec=_[_0x4ca9('0x3f')]({},_0x20f2ec,_0x4944b5[_0x4ca9('0x40')]);var _0x1427cc={'where':_0x20f2ec[_0x4ca9('0x3d')]};return db['IntegrationReport']['count'](_0x1427cc)['then'](function(_0x46f0c6){_0x56867e[_0x4ca9('0x1e')]=_0x46f0c6;if(_0x4944b5[_0x4ca9('0x37')][_0x4ca9('0x41')]){_0x20f2ec[_0x4ca9('0x42')]=[{'all':!![]}];}return db[_0x4ca9('0x43')]['findAll'](_0x20f2ec);})['then'](function(_0x4e9048){_0x56867e[_0x4ca9('0x44')]=_0x4e9048;return _0x56867e;})['then'](respondWithFilteredResult(_0x147966,_0x20f2ec))[_0x4ca9('0x45')](handleError(_0x147966,null));};exports[_0x4ca9('0x46')]=function(_0x5520dd,_0x42a3a3){var _0x29e805={'raw':![],'where':{'id':_0x5520dd[_0x4ca9('0x47')]['id']}},_0x3be04f={};_0x3be04f[_0x4ca9('0x32')]=_[_0x4ca9('0x33')](db['IntegrationReport'][_0x4ca9('0x2e')]);_0x3be04f[_0x4ca9('0x37')]=_['keys'](_0x5520dd[_0x4ca9('0x37')]);_0x3be04f[_0x4ca9('0x34')]=_[_0x4ca9('0x35')](_0x3be04f['model'],_0x3be04f['query']);_0x29e805[_0x4ca9('0x36')]=_['intersection'](_0x3be04f[_0x4ca9('0x32')],qs[_0x4ca9('0x38')](_0x5520dd[_0x4ca9('0x37')][_0x4ca9('0x38')]));_0x29e805[_0x4ca9('0x36')]=_0x29e805['attributes']['length']?_0x29e805[_0x4ca9('0x36')]:_0x3be04f[_0x4ca9('0x32')];if(_0x5520dd['query'][_0x4ca9('0x41')]){_0x29e805[_0x4ca9('0x42')]=[{'all':!![]}];}_0x29e805=_[_0x4ca9('0x3f')]({},_0x29e805,_0x5520dd[_0x4ca9('0x40')]);return db[_0x4ca9('0x43')][_0x4ca9('0x48')](_0x29e805)[_0x4ca9('0x27')](handleEntityNotFound(_0x42a3a3,null))['then'](respondWithResult(_0x42a3a3,null))[_0x4ca9('0x45')](handleError(_0x42a3a3,null));};exports['create']=function(_0x4aec7f,_0x2281a6){return db[_0x4ca9('0x43')][_0x4ca9('0x49')](_0x4aec7f[_0x4ca9('0x4a')],{})[_0x4ca9('0x27')](respondWithResult(_0x2281a6,0xc9))[_0x4ca9('0x45')](handleError(_0x2281a6,null));};exports['update']=function(_0x224bf4,_0x510107){if(_0x224bf4[_0x4ca9('0x4a')]['id']){delete _0x224bf4[_0x4ca9('0x4a')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x224bf4['params']['id']}})[_0x4ca9('0x27')](handleEntityNotFound(_0x510107,null))[_0x4ca9('0x27')](saveUpdates(_0x224bf4[_0x4ca9('0x4a')],null))[_0x4ca9('0x27')](respondWithResult(_0x510107,null))['catch'](handleError(_0x510107,null));};exports[_0x4ca9('0x26')]=function(_0xf67543,_0xcb1672){return db[_0x4ca9('0x43')][_0x4ca9('0x48')]({'where':{'id':_0xf67543[_0x4ca9('0x47')]['id']}})[_0x4ca9('0x27')](handleEntityNotFound(_0xcb1672,null))['then'](removeEntity(_0xcb1672,null))['catch'](handleError(_0xcb1672,null));};exports[_0x4ca9('0x4b')]=function(_0x4f1aa0,_0xf5d736){return db[_0x4ca9('0x43')]['describe']()[_0x4ca9('0x27')](respondWithResult(_0xf5d736,null))['catch'](handleError(_0xf5d736,null));}; \ No newline at end of file +var _0x3d5b=['name','send','index','rawAttributes','fieldName','model','map','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','params','IntegrationReport','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d5b,0x15b));var _0xb3d5=function(_0x3ad764,_0xd6022){_0x3ad764=_0x3ad764-0x0;var _0x243a6c=_0x3d5b[_0x3ad764];return _0x243a6c;};'use strict';var emlformat=require(_0xb3d5('0x0'));var rimraf=require(_0xb3d5('0x1'));var zipdir=require(_0xb3d5('0x2'));var jsonpatch=require(_0xb3d5('0x3'));var rp=require(_0xb3d5('0x4'));var moment=require(_0xb3d5('0x5'));var BPromise=require(_0xb3d5('0x6'));var Mustache=require(_0xb3d5('0x7'));var util=require(_0xb3d5('0x8'));var path=require(_0xb3d5('0x9'));var sox=require(_0xb3d5('0xa'));var csv=require('to-csv');var ejs=require(_0xb3d5('0xb'));var fs=require('fs');var fs_extra=require(_0xb3d5('0xc'));var _=require(_0xb3d5('0xd'));var squel=require(_0xb3d5('0xe'));var crypto=require('crypto');var jsforce=require(_0xb3d5('0xf'));var deskjs=require(_0xb3d5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb3d5('0x11'));var Papa=require(_0xb3d5('0x12'));var Redis=require('ioredis');var authService=require(_0xb3d5('0x13'));var qs=require(_0xb3d5('0x14'));var as=require(_0xb3d5('0x15'));var hardwareService=require(_0xb3d5('0x16'));var logger=require(_0xb3d5('0x17'))('api');var utils=require(_0xb3d5('0x18'));var config=require(_0xb3d5('0x19'));var licenseUtil=require(_0xb3d5('0x1a'));var db=require(_0xb3d5('0x1b'))['db'];function respondWithStatusCode(_0x5deb41,_0x325dd8){_0x325dd8=_0x325dd8||0xcc;return function(_0x14f7a1){if(_0x14f7a1){return _0x5deb41[_0xb3d5('0x1c')](_0x325dd8);}return _0x5deb41[_0xb3d5('0x1d')](_0x325dd8)[_0xb3d5('0x1e')]();};}function respondWithResult(_0x1e9a25,_0x4c8096){_0x4c8096=_0x4c8096||0xc8;return function(_0x1c4092){if(_0x1c4092){return _0x1e9a25[_0xb3d5('0x1d')](_0x4c8096)[_0xb3d5('0x1f')](_0x1c4092);}};}function respondWithFilteredResult(_0xf5baf8,_0x5c2fd7){return function(_0x573037){if(_0x573037){var _0x31cae6=typeof _0x5c2fd7[_0xb3d5('0x20')]==='undefined'&&typeof _0x5c2fd7[_0xb3d5('0x21')]==='undefined';var _0x4f1c0e=_0x573037[_0xb3d5('0x22')];var _0x4b7493=_0x31cae6?0x0:_0x5c2fd7[_0xb3d5('0x20')];var _0x1c91f5=_0x31cae6?_0x573037[_0xb3d5('0x22')]:_0x5c2fd7[_0xb3d5('0x20')]+_0x5c2fd7['limit'];var _0x549c2c;if(_0x1c91f5>=_0x4f1c0e){_0x1c91f5=_0x4f1c0e;_0x549c2c=0xc8;}else{_0x549c2c=0xce;}_0xf5baf8[_0xb3d5('0x1d')](_0x549c2c);return _0xf5baf8['set'](_0xb3d5('0x23'),_0x4b7493+'-'+_0x1c91f5+'/'+_0x4f1c0e)[_0xb3d5('0x1f')](_0x573037);}return null;};}function patchUpdates(_0x26280e){return function(_0xe88aee){try{jsonpatch[_0xb3d5('0x24')](_0xe88aee,_0x26280e,!![]);}catch(_0x38a259){return BPromise[_0xb3d5('0x25')](_0x38a259);}return _0xe88aee[_0xb3d5('0x26')]();};}function saveUpdates(_0xf88539,_0x1b6ce6){return function(_0x307888){if(_0x307888){return _0x307888[_0xb3d5('0x27')](_0xf88539)[_0xb3d5('0x28')](function(_0x372206){return _0x372206;});}return null;};}function removeEntity(_0x502623,_0x386319){return function(_0x2efad5){if(_0x2efad5){return _0x2efad5['destroy']()[_0xb3d5('0x28')](function(){_0x502623['status'](0xcc)[_0xb3d5('0x1e')]();});}};}function handleEntityNotFound(_0x2bf42a,_0x16ea16){return function(_0x54d67a){if(!_0x54d67a){_0x2bf42a[_0xb3d5('0x1c')](0x194);}return _0x54d67a;};}function handleError(_0x3d1899,_0x49226b){_0x49226b=_0x49226b||0x1f4;return function(_0x2a421f){logger[_0xb3d5('0x29')](_0x2a421f[_0xb3d5('0x2a')]);if(_0x2a421f[_0xb3d5('0x2b')]){delete _0x2a421f[_0xb3d5('0x2b')];}_0x3d1899[_0xb3d5('0x1d')](_0x49226b)[_0xb3d5('0x2c')](_0x2a421f);};}exports[_0xb3d5('0x2d')]=function(_0x2587c0,_0x35b7bb){var _0x3ba28f={},_0x29d434={},_0x18847a={'count':0x0,'rows':[]};var _0x4aff10=_['map'](db['IntegrationReport'][_0xb3d5('0x2e')],function(_0x3fcc4b){return{'name':_0x3fcc4b[_0xb3d5('0x2f')],'type':_0x3fcc4b['type']['key']};});_0x29d434[_0xb3d5('0x30')]=_[_0xb3d5('0x31')](_0x4aff10,'name');_0x29d434['query']=_[_0xb3d5('0x32')](_0x2587c0[_0xb3d5('0x33')]);_0x29d434['filters']=_[_0xb3d5('0x34')](_0x29d434[_0xb3d5('0x30')],_0x29d434[_0xb3d5('0x33')]);_0x3ba28f[_0xb3d5('0x35')]=_['intersection'](_0x29d434[_0xb3d5('0x30')],qs[_0xb3d5('0x36')](_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x36')]));_0x3ba28f['attributes']=_0x3ba28f[_0xb3d5('0x35')]['length']?_0x3ba28f['attributes']:_0x29d434[_0xb3d5('0x30')];if(!_0x2587c0['query']['hasOwnProperty'](_0xb3d5('0x37'))){_0x3ba28f[_0xb3d5('0x21')]=qs[_0xb3d5('0x21')](_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x21')]);_0x3ba28f['offset']=qs['offset'](_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x20')]);}_0x3ba28f[_0xb3d5('0x38')]=qs[_0xb3d5('0x39')](_0x2587c0['query'][_0xb3d5('0x39')]);_0x3ba28f['where']=qs[_0xb3d5('0x3a')](_[_0xb3d5('0x3b')](_0x2587c0['query'],_0x29d434[_0xb3d5('0x3a')]),_0x4aff10);if(_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x3c')]){_0x3ba28f['where']=_[_0xb3d5('0x3d')](_0x3ba28f[_0xb3d5('0x3e')],{'$or':_[_0xb3d5('0x31')](_0x4aff10,function(_0x53846e){if(_0x53846e[_0xb3d5('0x3f')]!==_0xb3d5('0x40')){var _0x4b3be8={};_0x4b3be8[_0x53846e[_0xb3d5('0x2b')]]={'$like':'%'+_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x3c')]+'%'};return _0x4b3be8;}})});}_0x3ba28f=_['merge']({},_0x3ba28f,_0x2587c0[_0xb3d5('0x41')]);var _0x131d0e={'where':_0x3ba28f[_0xb3d5('0x3e')]};return db['IntegrationReport'][_0xb3d5('0x22')](_0x131d0e)[_0xb3d5('0x28')](function(_0x39fab9){_0x18847a['count']=_0x39fab9;if(_0x2587c0[_0xb3d5('0x33')][_0xb3d5('0x42')]){_0x3ba28f[_0xb3d5('0x43')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb3d5('0x44')](_0x3ba28f);})['then'](function(_0xcd3d08){_0x18847a['rows']=_0xcd3d08;return _0x18847a;})[_0xb3d5('0x28')](respondWithFilteredResult(_0x35b7bb,_0x3ba28f))[_0xb3d5('0x45')](handleError(_0x35b7bb,null));};exports['show']=function(_0x58d90a,_0x31fe41){var _0xb2a43a={'raw':![],'where':{'id':_0x58d90a[_0xb3d5('0x46')]['id']}},_0x1e7154={};_0x1e7154[_0xb3d5('0x30')]=_[_0xb3d5('0x32')](db[_0xb3d5('0x47')][_0xb3d5('0x2e')]);_0x1e7154[_0xb3d5('0x33')]=_[_0xb3d5('0x32')](_0x58d90a['query']);_0x1e7154[_0xb3d5('0x3a')]=_[_0xb3d5('0x34')](_0x1e7154[_0xb3d5('0x30')],_0x1e7154[_0xb3d5('0x33')]);_0xb2a43a[_0xb3d5('0x35')]=_[_0xb3d5('0x34')](_0x1e7154[_0xb3d5('0x30')],qs[_0xb3d5('0x36')](_0x58d90a[_0xb3d5('0x33')][_0xb3d5('0x36')]));_0xb2a43a['attributes']=_0xb2a43a[_0xb3d5('0x35')][_0xb3d5('0x48')]?_0xb2a43a[_0xb3d5('0x35')]:_0x1e7154['model'];if(_0x58d90a[_0xb3d5('0x33')][_0xb3d5('0x42')]){_0xb2a43a[_0xb3d5('0x43')]=[{'all':!![]}];}_0xb2a43a=_['merge']({},_0xb2a43a,_0x58d90a[_0xb3d5('0x41')]);return db[_0xb3d5('0x47')][_0xb3d5('0x49')](_0xb2a43a)['then'](handleEntityNotFound(_0x31fe41,null))[_0xb3d5('0x28')](respondWithResult(_0x31fe41,null))[_0xb3d5('0x45')](handleError(_0x31fe41,null));};exports[_0xb3d5('0x4a')]=function(_0x2050c5,_0x49a5bd){return db[_0xb3d5('0x47')]['create'](_0x2050c5[_0xb3d5('0x4b')],{})[_0xb3d5('0x28')](respondWithResult(_0x49a5bd,0xc9))[_0xb3d5('0x45')](handleError(_0x49a5bd,null));};exports[_0xb3d5('0x27')]=function(_0x156e55,_0x3e8046){if(_0x156e55[_0xb3d5('0x4b')]['id']){delete _0x156e55[_0xb3d5('0x4b')]['id'];}return db[_0xb3d5('0x47')][_0xb3d5('0x49')]({'where':{'id':_0x156e55[_0xb3d5('0x46')]['id']}})[_0xb3d5('0x28')](handleEntityNotFound(_0x3e8046,null))[_0xb3d5('0x28')](saveUpdates(_0x156e55[_0xb3d5('0x4b')],null))['then'](respondWithResult(_0x3e8046,null))[_0xb3d5('0x45')](handleError(_0x3e8046,null));};exports[_0xb3d5('0x4c')]=function(_0x164648,_0x39e63d){return db[_0xb3d5('0x47')][_0xb3d5('0x49')]({'where':{'id':_0x164648['params']['id']}})[_0xb3d5('0x28')](handleEntityNotFound(_0x39e63d,null))[_0xb3d5('0x28')](removeEntity(_0x39e63d,null))['catch'](handleError(_0x39e63d,null));};exports[_0xb3d5('0x4d')]=function(_0x530e07,_0x2afaff){return db[_0xb3d5('0x47')][_0xb3d5('0x4d')]()['then'](respondWithResult(_0x2afaff,null))['catch'](handleError(_0x2afaff,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index dcd8953..9b35f38 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 _0x6ad5=['report_integration','lodash','util','../../config/logger','moment','bluebird','define','IntegrationReport'];(function(_0x44cc0b,_0x18ab12){var _0x16af51=function(_0x4376dc){while(--_0x4376dc){_0x44cc0b['push'](_0x44cc0b['shift']());}};_0x16af51(++_0x18ab12);}(_0x6ad5,0x1c1));var _0x56ad=function(_0x386b69,_0x5d9360){_0x386b69=_0x386b69-0x0;var _0x476415=_0x6ad5[_0x386b69];return _0x476415;};'use strict';var _=require(_0x56ad('0x0'));var util=require(_0x56ad('0x1'));var logger=require(_0x56ad('0x2'))('api');var moment=require(_0x56ad('0x3'));var BPromise=require(_0x56ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x2ddd20,_0x19d6b6){return _0x2ddd20[_0x56ad('0x5')](_0x56ad('0x6'),attributes,{'tableName':_0x56ad('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff45=['bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','define','report_integration','util'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xff45,0xf7));var _0x5ff4=function(_0x56e82f,_0x1c20d2){_0x56e82f=_0x56e82f-0x0;var _0x5034a4=_0xff45[_0x56e82f];return _0x5034a4;};'use strict';var _=require('lodash');var util=require(_0x5ff4('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5ff4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ff4('0x2'));var rimraf=require(_0x5ff4('0x3'));var config=require(_0x5ff4('0x4'));var attributes=require(_0x5ff4('0x5'));module['exports']=function(_0x6d54ec,_0xe85575){return _0x6d54ec[_0x5ff4('0x6')]('IntegrationReport',attributes,{'tableName':_0x5ff4('0x7'),'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 25f88e9..d16fe15 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\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(_0x43b04d,_0x2f1dc2){var _0x460aa3=function(_0x36aaf0){while(--_0x36aaf0){_0x43b04d['push'](_0x43b04d['shift']());}};_0x460aa3(++_0x2f1dc2);}(_0x1261,0x144));var _0x1126=function(_0x4c6a7f,_0x452cf6){_0x4c6a7f=_0x4c6a7f-0x0;var _0x1a5474=_0x1261[_0x4c6a7f];return _0x1a5474;};'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')]('IntegrationReport,\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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x524e,0x15e));var _0xe524=function(_0x20da93,_0x32b881){_0x20da93=_0x20da93-0x0;var _0x1a4f35=_0x524e[_0x20da93];return _0x1a4f35;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f67d34f..07b719d 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 _0xbeba=['isAuthenticated','index','/:id','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get'];(function(_0x5c800f,_0x569147){var _0x3adc53=function(_0x375cb9){while(--_0x375cb9){_0x5c800f['push'](_0x5c800f['shift']());}};_0x3adc53(++_0x569147);}(_0xbeba,0x64));var _0xabeb=function(_0x2509a5,_0x3e91f0){_0x2509a5=_0x2509a5-0x0;var _0x3a92df=_0xbeba[_0x2509a5];return _0x3a92df;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['show']);router['get'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['getIntervals']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['post'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['addInterval']);router[_0xabeb('0xe')](_0xabeb('0x10'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x11')]);router[_0xabeb('0x12')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x13')]);router[_0xabeb('0x14')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb1a3=['put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xb1a3[_0x234ae1];return _0x227ba0;};'use strict';var multer=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var path=require(_0x3b1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b1a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b1a('0x4'));var interaction=require(_0x3b1a('0x5'));var config=require(_0x3b1a('0x6'));var controller=require(_0x3b1a('0x7'));router[_0x3b1a('0x8')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xa')]);router['get'](_0x3b1a('0xb'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xc')]);router[_0x3b1a('0x8')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x3b1a('0xd')]);router[_0x3b1a('0xe')]('/',auth['isAuthenticated'](),controller[_0x3b1a('0xf')]);router['post'](_0x3b1a('0x10'),auth['isAuthenticated'](),controller[_0x3b1a('0x11')]);router[_0x3b1a('0xe')](_0x3b1a('0x12'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x13')]);router[_0x3b1a('0x14')](_0x3b1a('0xb'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x15')]);router['delete']('/:id',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x16')]);module[_0x3b1a('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 4223cd6..f452afc 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 _0xb643=['STRING','sequelize'];(function(_0x21752f,_0x48b633){var _0x3b4033=function(_0x5066d7){while(--_0x5066d7){_0x21752f['push'](_0x21752f['shift']());}};_0x3b4033(++_0x48b633);}(_0xb643,0xe9));var _0x3b64=function(_0x4f0e2c,_0x392004){_0x4f0e2c=_0x4f0e2c-0x0;var _0x492737=_0xb643[_0x4f0e2c];return _0x492737;};'use strict';var Sequelize=require(_0x3b64('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b64('0x1')]},'description':{'type':Sequelize[_0x3b64('0x1')]},'interval':{'type':Sequelize[_0x3b64('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf6e1=['STRING'];(function(_0x1de164,_0x1ccf5f){var _0x5613b4=function(_0x22dca9){while(--_0x22dca9){_0x1de164['push'](_0x1de164['shift']());}};_0x5613b4(++_0x1ccf5f);}(_0xf6e1,0x128));var _0x1f6e=function(_0x406d61,_0x4b991d){_0x406d61=_0x406d61-0x0;var _0x142810=_0xf6e1[_0x406d61];return _0x142810;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f6e('0x0')]},'interval':{'type':Sequelize[_0x1f6e('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c254979..f2f3e02 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 _0xf9ef=['show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getIntervals','pick','hasOwnProperty','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x5e42d6,_0x26f578){var _0x5798af=function(_0x4c4792){while(--_0x4c4792){_0x5e42d6['push'](_0x5e42d6['shift']());}};_0x5798af(++_0x26f578);}(_0xf9ef,0x1da));var _0xff9e=function(_0x2a9c24,_0x396cb4){_0x2a9c24=_0x2a9c24-0x0;var _0x23d625=_0xf9ef[_0x2a9c24];return _0x23d625;};'use strict';var emlformat=require(_0xff9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff9e('0x1'));var jsonpatch=require(_0xff9e('0x2'));var rp=require(_0xff9e('0x3'));var moment=require(_0xff9e('0x4'));var BPromise=require(_0xff9e('0x5'));var Mustache=require(_0xff9e('0x6'));var util=require(_0xff9e('0x7'));var path=require(_0xff9e('0x8'));var sox=require('sox');var csv=require(_0xff9e('0x9'));var ejs=require(_0xff9e('0xa'));var fs=require('fs');var fs_extra=require(_0xff9e('0xb'));var _=require(_0xff9e('0xc'));var squel=require('squel');var crypto=require(_0xff9e('0xd'));var jsforce=require(_0xff9e('0xe'));var deskjs=require(_0xff9e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff9e('0x10'));var Redis=require('ioredis');var authService=require(_0xff9e('0x11'));var qs=require(_0xff9e('0x12'));var as=require(_0xff9e('0x13'));var hardwareService=require(_0xff9e('0x14'));var logger=require(_0xff9e('0x15'))(_0xff9e('0x16'));var utils=require(_0xff9e('0x17'));var config=require(_0xff9e('0x18'));var licenseUtil=require(_0xff9e('0x19'));var db=require(_0xff9e('0x1a'))['db'];var extensions=require(_0xff9e('0x1b'));function respondWithStatusCode(_0x331336,_0x49817b){_0x49817b=_0x49817b||0xcc;return function(_0x44741d){if(_0x44741d){return _0x331336['sendStatus'](_0x49817b);}return _0x331336[_0xff9e('0x1c')](_0x49817b)['end']();};}function respondWithResult(_0x2e72a1,_0x11376c){_0x11376c=_0x11376c||0xc8;return function(_0x4c5c80){if(_0x4c5c80){return _0x2e72a1[_0xff9e('0x1c')](_0x11376c)[_0xff9e('0x1d')](_0x4c5c80);}};}function respondWithFilteredResult(_0xdab39d,_0x44d685){return function(_0x293f9a){if(_0x293f9a){var _0x99701=typeof _0x44d685[_0xff9e('0x1e')]===_0xff9e('0x1f')&&typeof _0x44d685['limit']===_0xff9e('0x1f');var _0x1e90de=_0x293f9a['count'];var _0x2dd2fc=_0x99701?0x0:_0x44d685['offset'];var _0x5ab2bd=_0x99701?_0x293f9a[_0xff9e('0x20')]:_0x44d685['offset']+_0x44d685[_0xff9e('0x21')];var _0x1c4a53;if(_0x5ab2bd>=_0x1e90de){_0x5ab2bd=_0x1e90de;_0x1c4a53=0xc8;}else{_0x1c4a53=0xce;}_0xdab39d[_0xff9e('0x1c')](_0x1c4a53);return _0xdab39d[_0xff9e('0x22')](_0xff9e('0x23'),_0x2dd2fc+'-'+_0x5ab2bd+'/'+_0x1e90de)[_0xff9e('0x1d')](_0x293f9a);}return null;};}function patchUpdates(_0x8260e7){return function(_0x5a5d2d){try{jsonpatch['apply'](_0x5a5d2d,_0x8260e7,!![]);}catch(_0x41a428){return BPromise[_0xff9e('0x24')](_0x41a428);}return _0x5a5d2d[_0xff9e('0x25')]();};}function saveUpdates(_0x3085b8,_0x2d44e8){return function(_0x3c4bc1){if(_0x3c4bc1){return _0x3c4bc1[_0xff9e('0x26')](_0x3085b8)[_0xff9e('0x27')](function(_0x5c9c35){return _0x5c9c35;});}return null;};}function removeEntity(_0x2a6fb8,_0x5f1af2){return function(_0x5b1a6a){if(_0x5b1a6a){return _0x5b1a6a[_0xff9e('0x28')]()[_0xff9e('0x27')](function(){var _0x22567b=_0x5b1a6a[_0xff9e('0x29')]({'plain':!![]});var _0x4c4dce=_0xff9e('0x2a');return db[_0xff9e('0x2b')][_0xff9e('0x28')]({'where':{'type':_0x4c4dce,'resourceId':_0x22567b['id']}})[_0xff9e('0x27')](function(){return _0x5b1a6a;});})[_0xff9e('0x27')](function(){_0x2a6fb8[_0xff9e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7774,_0x587abe){return function(_0x55261c){if(!_0x55261c){_0x4e7774['sendStatus'](0x194);}return _0x55261c;};}function handleError(_0x47f1cc,_0x52682d){_0x52682d=_0x52682d||0x1f4;return function(_0x5482b0){logger[_0xff9e('0x2c')](_0x5482b0[_0xff9e('0x2d')]);if(_0x5482b0[_0xff9e('0x2e')]){delete _0x5482b0[_0xff9e('0x2e')];}_0x47f1cc[_0xff9e('0x1c')](_0x52682d)[_0xff9e('0x2f')](_0x5482b0);};}exports[_0xff9e('0x30')]=function(_0x582691,_0x2b15e6){var _0x3873f9={},_0x8d0bfd={},_0x1bfa2f={'count':0x0,'rows':[]};var _0xcefa9=_[_0xff9e('0x31')](db[_0xff9e('0x32')]['rawAttributes'],function(_0x2d50d6){return{'name':_0x2d50d6['fieldName'],'type':_0x2d50d6['type']['key']};});_0x8d0bfd[_0xff9e('0x33')]=_[_0xff9e('0x31')](_0xcefa9,_0xff9e('0x2e'));_0x8d0bfd['query']=_[_0xff9e('0x34')](_0x582691[_0xff9e('0x35')]);_0x8d0bfd['filters']=_[_0xff9e('0x36')](_0x8d0bfd[_0xff9e('0x33')],_0x8d0bfd[_0xff9e('0x35')]);_0x3873f9[_0xff9e('0x37')]=_[_0xff9e('0x36')](_0x8d0bfd[_0xff9e('0x33')],qs[_0xff9e('0x38')](_0x582691[_0xff9e('0x35')][_0xff9e('0x38')]));_0x3873f9[_0xff9e('0x37')]=_0x3873f9['attributes'][_0xff9e('0x39')]?_0x3873f9['attributes']:_0x8d0bfd[_0xff9e('0x33')];if(!_0x582691[_0xff9e('0x35')]['hasOwnProperty'](_0xff9e('0x3a'))){_0x3873f9['limit']=qs[_0xff9e('0x21')](_0x582691[_0xff9e('0x35')]['limit']);_0x3873f9[_0xff9e('0x1e')]=qs[_0xff9e('0x1e')](_0x582691[_0xff9e('0x35')]['offset']);}_0x3873f9[_0xff9e('0x3b')]=qs[_0xff9e('0x3c')](_0x582691[_0xff9e('0x35')][_0xff9e('0x3c')]);_0x3873f9[_0xff9e('0x3d')]=qs[_0xff9e('0x3e')](_['pick'](_0x582691[_0xff9e('0x35')],_0x8d0bfd[_0xff9e('0x3e')]),_0xcefa9);if(_0x582691[_0xff9e('0x35')][_0xff9e('0x3f')]){_0x3873f9[_0xff9e('0x3d')]=_[_0xff9e('0x40')](_0x3873f9[_0xff9e('0x3d')],{'$or':_[_0xff9e('0x31')](_0xcefa9,function(_0x1b021c){if(_0x1b021c['type']!==_0xff9e('0x41')){var _0x1b3a5e={};_0x1b3a5e[_0x1b021c[_0xff9e('0x2e')]]={'$like':'%'+_0x582691[_0xff9e('0x35')][_0xff9e('0x3f')]+'%'};return _0x1b3a5e;}})});}_0x3873f9=_[_0xff9e('0x40')]({},_0x3873f9,_0x582691[_0xff9e('0x42')]);var _0x2bafdb={'where':_0x3873f9['where']};return db[_0xff9e('0x32')][_0xff9e('0x20')](_0x2bafdb)[_0xff9e('0x27')](function(_0x4aa17f){_0x1bfa2f[_0xff9e('0x20')]=_0x4aa17f;if(_0x582691['query'][_0xff9e('0x43')]){_0x3873f9[_0xff9e('0x44')]=[{'all':!![]}];}return db[_0xff9e('0x32')][_0xff9e('0x45')](_0x3873f9);})[_0xff9e('0x27')](function(_0x48c76d){_0x1bfa2f[_0xff9e('0x46')]=_0x48c76d;return _0x1bfa2f;})['then'](respondWithFilteredResult(_0x2b15e6,_0x3873f9))[_0xff9e('0x47')](handleError(_0x2b15e6,null));};exports[_0xff9e('0x48')]=function(_0x11530d,_0x41b138){var _0xf493af={'raw':!![],'where':{'id':_0x11530d[_0xff9e('0x49')]['id']}},_0x5622cc={};_0x5622cc[_0xff9e('0x33')]=_[_0xff9e('0x34')](db[_0xff9e('0x32')][_0xff9e('0x4a')]);_0x5622cc['query']=_[_0xff9e('0x34')](_0x11530d[_0xff9e('0x35')]);_0x5622cc[_0xff9e('0x3e')]=_[_0xff9e('0x36')](_0x5622cc[_0xff9e('0x33')],_0x5622cc[_0xff9e('0x35')]);_0xf493af[_0xff9e('0x37')]=_['intersection'](_0x5622cc['model'],qs[_0xff9e('0x38')](_0x11530d['query']['fields']));_0xf493af[_0xff9e('0x37')]=_0xf493af['attributes']['length']?_0xf493af[_0xff9e('0x37')]:_0x5622cc[_0xff9e('0x33')];if(_0x11530d[_0xff9e('0x35')]['includeAll']){_0xf493af['include']=[{'all':!![]}];}_0xf493af=_[_0xff9e('0x40')]({},_0xf493af,_0x11530d[_0xff9e('0x42')]);return db['Interval'][_0xff9e('0x4b')](_0xf493af)['then'](handleEntityNotFound(_0x41b138,null))[_0xff9e('0x27')](respondWithResult(_0x41b138,null))[_0xff9e('0x47')](handleError(_0x41b138,null));};exports[_0xff9e('0x4c')]=function(_0x502d65,_0x5e1f41){return db['Interval'][_0xff9e('0x4c')](_0x502d65['body'],{})[_0xff9e('0x27')](function(_0x3ca87a){var _0x67464e=_0x502d65[_0xff9e('0x4d')][_0xff9e('0x29')]({'plain':!![]});if(!_0x67464e)throw new Error(_0xff9e('0x4e'));if(_0x67464e['role']===_0xff9e('0x4d')){var _0x3cb4c7=_0x3ca87a[_0xff9e('0x29')]({'plain':!![]});var _0x41d9f1='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x41d9f1,'userProfileId':_0x67464e['userProfileId']},'raw':!![]})[_0xff9e('0x27')](function(_0x28c0fb){if(_0x28c0fb&&_0x28c0fb[_0xff9e('0x4f')]===0x0){return db['UserProfileResource'][_0xff9e('0x4c')]({'name':_0x3cb4c7[_0xff9e('0x2e')],'resourceId':_0x3cb4c7['id'],'type':_0x28c0fb['name'],'sectionId':_0x28c0fb['id']},{})[_0xff9e('0x27')](function(){return _0x3ca87a;});}else{return _0x3ca87a;}})['catch'](function(_0x26ab9b){logger['error'](_0xff9e('0x50'),_0x26ab9b);throw _0x26ab9b;});}return _0x3ca87a;})[_0xff9e('0x27')](respondWithResult(_0x5e1f41,0xc9))[_0xff9e('0x47')](handleError(_0x5e1f41,null));};exports[_0xff9e('0x26')]=function(_0x23006e,_0x216f93){if(_0x23006e[_0xff9e('0x51')]['id']){delete _0x23006e[_0xff9e('0x51')]['id'];}return db[_0xff9e('0x32')][_0xff9e('0x4b')]({'where':{'id':_0x23006e[_0xff9e('0x49')]['id']}})[_0xff9e('0x27')](handleEntityNotFound(_0x216f93,null))[_0xff9e('0x27')](saveUpdates(_0x23006e[_0xff9e('0x51')],null))[_0xff9e('0x27')](respondWithResult(_0x216f93,null))[_0xff9e('0x47')](handleError(_0x216f93,null));};exports['destroy']=function(_0x31af4a,_0x206f4f){return db[_0xff9e('0x32')][_0xff9e('0x4b')]({'where':{'id':_0x31af4a[_0xff9e('0x49')]['id']}})['then'](handleEntityNotFound(_0x206f4f,null))[_0xff9e('0x27')](removeEntity(_0x206f4f,null))[_0xff9e('0x47')](handleError(_0x206f4f,null));};exports['addInterval']=function(_0xc7e914,_0x51dcb0,_0xe0ec8){if(_0xc7e914[_0xff9e('0x51')]['id']){delete _0xc7e914[_0xff9e('0x51')]['id'];}return db[_0xff9e('0x32')][_0xff9e('0x4b')]({'where':{'id':_0xc7e914[_0xff9e('0x49')]['id']}})[_0xff9e('0x27')](handleEntityNotFound(_0x51dcb0,null))[_0xff9e('0x27')](function(_0xfa06d7){if(_0xfa06d7){_0xc7e914[_0xff9e('0x51')]['IntervalId']=_0xfa06d7['id'];return db[_0xff9e('0x32')][_0xff9e('0x4c')](_0xc7e914[_0xff9e('0x51')]);}})[_0xff9e('0x27')](respondWithResult(_0x51dcb0,null))[_0xff9e('0x47')](handleError(_0x51dcb0,null));};exports[_0xff9e('0x52')]=function(_0x4bb344,_0xc58a81,_0x4f9ee8){var _0x4527d2={};var _0x4d8ceb={};var _0x5c3bf9;var _0x1f6114;return db[_0xff9e('0x32')]['findOne']({'where':{'id':_0x4bb344[_0xff9e('0x49')]['id']}})[_0xff9e('0x27')](handleEntityNotFound(_0xc58a81,null))[_0xff9e('0x27')](function(_0xecaee1){if(_0xecaee1){_0x5c3bf9=_0xecaee1;_0x4d8ceb['model']=_[_0xff9e('0x34')](db['Interval']['rawAttributes']);_0x4d8ceb[_0xff9e('0x35')]=_[_0xff9e('0x34')](_0x4bb344[_0xff9e('0x35')]);_0x4d8ceb['filters']=_[_0xff9e('0x36')](_0x4d8ceb[_0xff9e('0x33')],_0x4d8ceb[_0xff9e('0x35')]);_0x4527d2[_0xff9e('0x37')]=_[_0xff9e('0x36')](_0x4d8ceb[_0xff9e('0x33')],qs[_0xff9e('0x38')](_0x4bb344[_0xff9e('0x35')]['fields']));_0x4527d2[_0xff9e('0x37')]=_0x4527d2[_0xff9e('0x37')][_0xff9e('0x39')]?_0x4527d2[_0xff9e('0x37')]:_0x4d8ceb['model'];_0x4527d2['order']=qs[_0xff9e('0x3c')](_0x4bb344['query'][_0xff9e('0x3c')]);_0x4527d2[_0xff9e('0x3d')]=qs[_0xff9e('0x3e')](_[_0xff9e('0x53')](_0x4bb344['query'],_0x4d8ceb[_0xff9e('0x3e')]));if(_0x4bb344['query']['filter']){_0x4527d2[_0xff9e('0x3d')]=_[_0xff9e('0x40')](_0x4527d2[_0xff9e('0x3d')],{'$or':_[_0xff9e('0x31')](_0x4527d2[_0xff9e('0x37')],function(_0x5523ee){var _0x4b730c={};_0x4b730c[_0x5523ee]={'$like':'%'+_0x4bb344['query']['filter']+'%'};return _0x4b730c;})});}_0x4527d2=_[_0xff9e('0x40')]({},_0x4527d2,_0x4bb344[_0xff9e('0x42')]);return _0x5c3bf9[_0xff9e('0x52')](_0x4527d2);}})['then'](function(_0x2253b3){if(_0x2253b3){_0x1f6114=_0x2253b3[_0xff9e('0x39')];if(!_0x4bb344[_0xff9e('0x35')][_0xff9e('0x54')](_0xff9e('0x3a'))){_0x4527d2['limit']=qs[_0xff9e('0x21')](_0x4bb344[_0xff9e('0x35')]['limit']);_0x4527d2[_0xff9e('0x1e')]=qs['offset'](_0x4bb344[_0xff9e('0x35')]['offset']);}return _0x5c3bf9[_0xff9e('0x52')](_0x4527d2);}})[_0xff9e('0x27')](function(_0x1db246){if(_0x1db246){return _0x1db246?{'count':_0x1f6114,'rows':_0x1db246}:null;}})[_0xff9e('0x27')](respondWithResult(_0xc58a81,null))['catch'](handleError(_0xc58a81,null));};exports[_0xff9e('0x55')]=function(_0x293570,_0x56dcc8,_0x5034b1){return db[_0xff9e('0x32')][_0xff9e('0x56')]({'where':{'id':_0x293570[_0xff9e('0x49')]['id']}})[_0xff9e('0x27')](handleEntityNotFound(_0x56dcc8,null))[_0xff9e('0x27')](function(_0xdc6bc3){if(_0xdc6bc3){return db[_0xff9e('0x57')][_0xff9e('0x58')](function(_0x5d9fe7){return db['Interval'][_0xff9e('0x28')]({'where':{'IntervalId':_0x293570[_0xff9e('0x49')]['id']},'transaction':_0x5d9fe7})[_0xff9e('0x27')](function(_0x5bbb56){var _0x103445=_['map'](_0x293570[_0xff9e('0x51')],function(_0x5f3ce5){delete _0x5f3ce5['id'];_0x5f3ce5[_0xff9e('0x59')]=_0x293570['params']['id'];return _0x5f3ce5;});return db[_0xff9e('0x32')][_0xff9e('0x5a')](_0x103445,{'transaction':_0x5d9fe7});});})[_0xff9e('0x27')](function(){return db[_0xff9e('0x32')]['findAll']({'where':{'IntervalId':_0x293570[_0xff9e('0x49')]['id']}});});}})[_0xff9e('0x27')](respondWithResult(_0x56dcc8,null))[_0xff9e('0x47')](handleError(_0x56dcc8,null));}; \ No newline at end of file +var _0xd472=['status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','Interval','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','options','includeAll','include','findAll','rows','show','params','rawAttributes','merge','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','findOne','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus'];(function(_0x1de17f,_0x108908){var _0x423090=function(_0x30f754){while(--_0x30f754){_0x1de17f['push'](_0x1de17f['shift']());}};_0x423090(++_0x108908);}(_0xd472,0x1a6));var _0x2d47=function(_0x4e14b9,_0x52a598){_0x4e14b9=_0x4e14b9-0x0;var _0x4d883f=_0xd472[_0x4e14b9];return _0x4d883f;};'use strict';var emlformat=require(_0x2d47('0x0'));var rimraf=require(_0x2d47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d47('0x2'));var moment=require(_0x2d47('0x3'));var BPromise=require(_0x2d47('0x4'));var Mustache=require(_0x2d47('0x5'));var util=require(_0x2d47('0x6'));var path=require(_0x2d47('0x7'));var sox=require(_0x2d47('0x8'));var csv=require(_0x2d47('0x9'));var ejs=require(_0x2d47('0xa'));var fs=require('fs');var fs_extra=require(_0x2d47('0xb'));var _=require('lodash');var squel=require(_0x2d47('0xc'));var crypto=require(_0x2d47('0xd'));var jsforce=require(_0x2d47('0xe'));var deskjs=require(_0x2d47('0xf'));var toCsv=require(_0x2d47('0x9'));var querystring=require(_0x2d47('0x10'));var Papa=require(_0x2d47('0x11'));var Redis=require(_0x2d47('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d47('0x13'));var logger=require(_0x2d47('0x14'))(_0x2d47('0x15'));var utils=require(_0x2d47('0x16'));var config=require(_0x2d47('0x17'));var licenseUtil=require(_0x2d47('0x18'));var db=require(_0x2d47('0x19'))['db'];var extensions=require(_0x2d47('0x1a'));function respondWithStatusCode(_0x1c734f,_0x43eacc){_0x43eacc=_0x43eacc||0xcc;return function(_0x9956e){if(_0x9956e){return _0x1c734f[_0x2d47('0x1b')](_0x43eacc);}return _0x1c734f[_0x2d47('0x1c')](_0x43eacc)[_0x2d47('0x1d')]();};}function respondWithResult(_0x4c6139,_0x34f032){_0x34f032=_0x34f032||0xc8;return function(_0x595ccd){if(_0x595ccd){return _0x4c6139[_0x2d47('0x1c')](_0x34f032)[_0x2d47('0x1e')](_0x595ccd);}};}function respondWithFilteredResult(_0x3e5f7f,_0x6b429){return function(_0x41ac98){if(_0x41ac98){var _0x5404a5=typeof _0x6b429[_0x2d47('0x1f')]===_0x2d47('0x20')&&typeof _0x6b429[_0x2d47('0x21')]===_0x2d47('0x20');var _0x49a1b0=_0x41ac98[_0x2d47('0x22')];var _0x491161=_0x5404a5?0x0:_0x6b429[_0x2d47('0x1f')];var _0x189802=_0x5404a5?_0x41ac98[_0x2d47('0x22')]:_0x6b429[_0x2d47('0x1f')]+_0x6b429[_0x2d47('0x21')];var _0x6fbb5c;if(_0x189802>=_0x49a1b0){_0x189802=_0x49a1b0;_0x6fbb5c=0xc8;}else{_0x6fbb5c=0xce;}_0x3e5f7f['status'](_0x6fbb5c);return _0x3e5f7f[_0x2d47('0x23')](_0x2d47('0x24'),_0x491161+'-'+_0x189802+'/'+_0x49a1b0)[_0x2d47('0x1e')](_0x41ac98);}return null;};}function patchUpdates(_0x17ca82){return function(_0x34b76b){try{jsonpatch['apply'](_0x34b76b,_0x17ca82,!![]);}catch(_0x14a037){return BPromise['reject'](_0x14a037);}return _0x34b76b['save']();};}function saveUpdates(_0x5666d8,_0x3bc9a8){return function(_0xd6a167){if(_0xd6a167){return _0xd6a167[_0x2d47('0x25')](_0x5666d8)[_0x2d47('0x26')](function(_0x26e960){return _0x26e960;});}return null;};}function removeEntity(_0x4d45e9,_0x421578){return function(_0x3f3986){if(_0x3f3986){return _0x3f3986[_0x2d47('0x27')]()[_0x2d47('0x26')](function(){var _0x22970b=_0x3f3986[_0x2d47('0x28')]({'plain':!![]});var _0x26c2fa='Intervals';return db['UserProfileResource'][_0x2d47('0x27')]({'where':{'type':_0x26c2fa,'resourceId':_0x22970b['id']}})[_0x2d47('0x26')](function(){return _0x3f3986;});})[_0x2d47('0x26')](function(){_0x4d45e9[_0x2d47('0x1c')](0xcc)[_0x2d47('0x1d')]();});}};}function handleEntityNotFound(_0x11613b,_0x3c119f){return function(_0x458bac){if(!_0x458bac){_0x11613b['sendStatus'](0x194);}return _0x458bac;};}function handleError(_0x175c3d,_0xa8b7b9){_0xa8b7b9=_0xa8b7b9||0x1f4;return function(_0x33559f){logger[_0x2d47('0x29')](_0x33559f[_0x2d47('0x2a')]);if(_0x33559f[_0x2d47('0x2b')]){delete _0x33559f[_0x2d47('0x2b')];}_0x175c3d['status'](_0xa8b7b9)[_0x2d47('0x2c')](_0x33559f);};}exports['index']=function(_0x1046d5,_0x13e412){var _0x41b30d={},_0x5ab6eb={},_0x279c26={'count':0x0,'rows':[]};var _0x59674e=_['map'](db[_0x2d47('0x2d')]['rawAttributes'],function(_0x16ae3e){return{'name':_0x16ae3e[_0x2d47('0x2e')],'type':_0x16ae3e[_0x2d47('0x2f')]['key']};});_0x5ab6eb['model']=_[_0x2d47('0x30')](_0x59674e,_0x2d47('0x2b'));_0x5ab6eb[_0x2d47('0x31')]=_[_0x2d47('0x32')](_0x1046d5['query']);_0x5ab6eb['filters']=_[_0x2d47('0x33')](_0x5ab6eb[_0x2d47('0x34')],_0x5ab6eb[_0x2d47('0x31')]);_0x41b30d['attributes']=_[_0x2d47('0x33')](_0x5ab6eb[_0x2d47('0x34')],qs[_0x2d47('0x35')](_0x1046d5['query'][_0x2d47('0x35')]));_0x41b30d[_0x2d47('0x36')]=_0x41b30d[_0x2d47('0x36')][_0x2d47('0x37')]?_0x41b30d[_0x2d47('0x36')]:_0x5ab6eb[_0x2d47('0x34')];if(!_0x1046d5[_0x2d47('0x31')][_0x2d47('0x38')](_0x2d47('0x39'))){_0x41b30d[_0x2d47('0x21')]=qs[_0x2d47('0x21')](_0x1046d5[_0x2d47('0x31')][_0x2d47('0x21')]);_0x41b30d['offset']=qs[_0x2d47('0x1f')](_0x1046d5['query']['offset']);}_0x41b30d[_0x2d47('0x3a')]=qs[_0x2d47('0x3b')](_0x1046d5[_0x2d47('0x31')][_0x2d47('0x3b')]);_0x41b30d['where']=qs[_0x2d47('0x3c')](_['pick'](_0x1046d5[_0x2d47('0x31')],_0x5ab6eb[_0x2d47('0x3c')]),_0x59674e);if(_0x1046d5[_0x2d47('0x31')][_0x2d47('0x3d')]){_0x41b30d[_0x2d47('0x3e')]=_['merge'](_0x41b30d['where'],{'$or':_[_0x2d47('0x30')](_0x59674e,function(_0x23f1de){if(_0x23f1de[_0x2d47('0x2f')]!=='VIRTUAL'){var _0x5a495f={};_0x5a495f[_0x23f1de['name']]={'$like':'%'+_0x1046d5['query'][_0x2d47('0x3d')]+'%'};return _0x5a495f;}})});}_0x41b30d=_['merge']({},_0x41b30d,_0x1046d5[_0x2d47('0x3f')]);var _0x4a05b0={'where':_0x41b30d[_0x2d47('0x3e')]};return db['Interval'][_0x2d47('0x22')](_0x4a05b0)[_0x2d47('0x26')](function(_0x3ae71d){_0x279c26['count']=_0x3ae71d;if(_0x1046d5[_0x2d47('0x31')][_0x2d47('0x40')]){_0x41b30d[_0x2d47('0x41')]=[{'all':!![]}];}return db[_0x2d47('0x2d')][_0x2d47('0x42')](_0x41b30d);})[_0x2d47('0x26')](function(_0x35e0e8){_0x279c26[_0x2d47('0x43')]=_0x35e0e8;return _0x279c26;})[_0x2d47('0x26')](respondWithFilteredResult(_0x13e412,_0x41b30d))['catch'](handleError(_0x13e412,null));};exports[_0x2d47('0x44')]=function(_0x262d0c,_0x51f178){var _0x3c1c3a={'raw':!![],'where':{'id':_0x262d0c[_0x2d47('0x45')]['id']}},_0x410de8={};_0x410de8[_0x2d47('0x34')]=_[_0x2d47('0x32')](db[_0x2d47('0x2d')][_0x2d47('0x46')]);_0x410de8['query']=_['keys'](_0x262d0c[_0x2d47('0x31')]);_0x410de8[_0x2d47('0x3c')]=_[_0x2d47('0x33')](_0x410de8['model'],_0x410de8[_0x2d47('0x31')]);_0x3c1c3a['attributes']=_[_0x2d47('0x33')](_0x410de8[_0x2d47('0x34')],qs['fields'](_0x262d0c[_0x2d47('0x31')][_0x2d47('0x35')]));_0x3c1c3a[_0x2d47('0x36')]=_0x3c1c3a[_0x2d47('0x36')][_0x2d47('0x37')]?_0x3c1c3a['attributes']:_0x410de8[_0x2d47('0x34')];if(_0x262d0c['query'][_0x2d47('0x40')]){_0x3c1c3a[_0x2d47('0x41')]=[{'all':!![]}];}_0x3c1c3a=_[_0x2d47('0x47')]({},_0x3c1c3a,_0x262d0c[_0x2d47('0x3f')]);return db[_0x2d47('0x2d')]['find'](_0x3c1c3a)[_0x2d47('0x26')](handleEntityNotFound(_0x51f178,null))[_0x2d47('0x26')](respondWithResult(_0x51f178,null))[_0x2d47('0x48')](handleError(_0x51f178,null));};exports['create']=function(_0x1785d1,_0x5f40b7){return db['Interval']['create'](_0x1785d1[_0x2d47('0x49')],{})[_0x2d47('0x26')](function(_0x24a7c5){var _0x5917ea=_0x1785d1[_0x2d47('0x4a')][_0x2d47('0x28')]({'plain':!![]});if(!_0x5917ea)throw new Error(_0x2d47('0x4b'));if(_0x5917ea[_0x2d47('0x4c')]==='user'){var _0x3063d7=_0x24a7c5['get']({'plain':!![]});var _0x2a8395='Intervals';return db[_0x2d47('0x4d')][_0x2d47('0x4e')]({'where':{'name':_0x2a8395,'userProfileId':_0x5917ea['userProfileId']},'raw':!![]})['then'](function(_0x3d3c5e){if(_0x3d3c5e&&_0x3d3c5e[_0x2d47('0x4f')]===0x0){return db[_0x2d47('0x50')][_0x2d47('0x51')]({'name':_0x3063d7[_0x2d47('0x2b')],'resourceId':_0x3063d7['id'],'type':_0x3d3c5e[_0x2d47('0x2b')],'sectionId':_0x3d3c5e['id']},{})['then'](function(){return _0x24a7c5;});}else{return _0x24a7c5;}})[_0x2d47('0x48')](function(_0x12967e){logger[_0x2d47('0x29')](_0x2d47('0x52'),_0x12967e);throw _0x12967e;});}return _0x24a7c5;})['then'](respondWithResult(_0x5f40b7,0xc9))[_0x2d47('0x48')](handleError(_0x5f40b7,null));};exports[_0x2d47('0x25')]=function(_0x2f0a41,_0x21e060){if(_0x2f0a41['body']['id']){delete _0x2f0a41[_0x2d47('0x49')]['id'];}return db['Interval'][_0x2d47('0x4e')]({'where':{'id':_0x2f0a41[_0x2d47('0x45')]['id']}})['then'](handleEntityNotFound(_0x21e060,null))['then'](saveUpdates(_0x2f0a41[_0x2d47('0x49')],null))[_0x2d47('0x26')](respondWithResult(_0x21e060,null))[_0x2d47('0x48')](handleError(_0x21e060,null));};exports[_0x2d47('0x27')]=function(_0x52b0bd,_0x42da89){return db[_0x2d47('0x2d')]['find']({'where':{'id':_0x52b0bd[_0x2d47('0x45')]['id']}})[_0x2d47('0x26')](handleEntityNotFound(_0x42da89,null))[_0x2d47('0x26')](removeEntity(_0x42da89,null))[_0x2d47('0x48')](handleError(_0x42da89,null));};exports['addInterval']=function(_0x4f9bf2,_0x11b973,_0x56644a){if(_0x4f9bf2[_0x2d47('0x49')]['id']){delete _0x4f9bf2[_0x2d47('0x49')]['id'];}return db[_0x2d47('0x2d')][_0x2d47('0x4e')]({'where':{'id':_0x4f9bf2[_0x2d47('0x45')]['id']}})[_0x2d47('0x26')](handleEntityNotFound(_0x11b973,null))[_0x2d47('0x26')](function(_0x24dc74){if(_0x24dc74){_0x4f9bf2[_0x2d47('0x49')][_0x2d47('0x53')]=_0x24dc74['id'];return db[_0x2d47('0x2d')][_0x2d47('0x51')](_0x4f9bf2['body']);}})[_0x2d47('0x26')](respondWithResult(_0x11b973,null))[_0x2d47('0x48')](handleError(_0x11b973,null));};exports['getIntervals']=function(_0x384a83,_0x2d9198,_0x3ec6ce){var _0x5e53af={};var _0x3c5b8c={};var _0x3095ae;var _0x3b0952;return db[_0x2d47('0x2d')][_0x2d47('0x54')]({'where':{'id':_0x384a83[_0x2d47('0x45')]['id']}})[_0x2d47('0x26')](handleEntityNotFound(_0x2d9198,null))[_0x2d47('0x26')](function(_0x51c91b){if(_0x51c91b){_0x3095ae=_0x51c91b;_0x3c5b8c[_0x2d47('0x34')]=_[_0x2d47('0x32')](db['Interval']['rawAttributes']);_0x3c5b8c[_0x2d47('0x31')]=_[_0x2d47('0x32')](_0x384a83['query']);_0x3c5b8c[_0x2d47('0x3c')]=_['intersection'](_0x3c5b8c['model'],_0x3c5b8c['query']);_0x5e53af[_0x2d47('0x36')]=_[_0x2d47('0x33')](_0x3c5b8c[_0x2d47('0x34')],qs[_0x2d47('0x35')](_0x384a83[_0x2d47('0x31')][_0x2d47('0x35')]));_0x5e53af['attributes']=_0x5e53af[_0x2d47('0x36')]['length']?_0x5e53af[_0x2d47('0x36')]:_0x3c5b8c[_0x2d47('0x34')];_0x5e53af[_0x2d47('0x3a')]=qs[_0x2d47('0x3b')](_0x384a83[_0x2d47('0x31')][_0x2d47('0x3b')]);_0x5e53af['where']=qs[_0x2d47('0x3c')](_['pick'](_0x384a83[_0x2d47('0x31')],_0x3c5b8c[_0x2d47('0x3c')]));if(_0x384a83[_0x2d47('0x31')][_0x2d47('0x3d')]){_0x5e53af[_0x2d47('0x3e')]=_['merge'](_0x5e53af['where'],{'$or':_['map'](_0x5e53af[_0x2d47('0x36')],function(_0x41de5d){var _0x38b9c9={};_0x38b9c9[_0x41de5d]={'$like':'%'+_0x384a83['query'][_0x2d47('0x3d')]+'%'};return _0x38b9c9;})});}_0x5e53af=_['merge']({},_0x5e53af,_0x384a83[_0x2d47('0x3f')]);return _0x3095ae[_0x2d47('0x55')](_0x5e53af);}})[_0x2d47('0x26')](function(_0x3ad8be){if(_0x3ad8be){_0x3b0952=_0x3ad8be['length'];if(!_0x384a83['query']['hasOwnProperty'](_0x2d47('0x39'))){_0x5e53af[_0x2d47('0x21')]=qs[_0x2d47('0x21')](_0x384a83[_0x2d47('0x31')]['limit']);_0x5e53af[_0x2d47('0x1f')]=qs[_0x2d47('0x1f')](_0x384a83[_0x2d47('0x31')][_0x2d47('0x1f')]);}return _0x3095ae['getIntervals'](_0x5e53af);}})[_0x2d47('0x26')](function(_0x31bddb){if(_0x31bddb){return _0x31bddb?{'count':_0x3b0952,'rows':_0x31bddb}:null;}})['then'](respondWithResult(_0x2d9198,null))[_0x2d47('0x48')](handleError(_0x2d9198,null));};exports[_0x2d47('0x56')]=function(_0xa1bd68,_0x3776e8,_0xa3ef0){return db[_0x2d47('0x2d')][_0x2d47('0x54')]({'where':{'id':_0xa1bd68[_0x2d47('0x45')]['id']}})[_0x2d47('0x26')](handleEntityNotFound(_0x3776e8,null))[_0x2d47('0x26')](function(_0x2757c7){if(_0x2757c7){return db[_0x2d47('0x57')][_0x2d47('0x58')](function(_0x3f8bad){return db[_0x2d47('0x2d')]['destroy']({'where':{'IntervalId':_0xa1bd68['params']['id']},'transaction':_0x3f8bad})[_0x2d47('0x26')](function(_0x11baef){var _0x351bed=_['map'](_0xa1bd68['body'],function(_0xdd8943){delete _0xdd8943['id'];_0xdd8943[_0x2d47('0x53')]=_0xa1bd68[_0x2d47('0x45')]['id'];return _0xdd8943;});return db[_0x2d47('0x2d')][_0x2d47('0x59')](_0x351bed,{'transaction':_0x3f8bad});});})[_0x2d47('0x26')](function(){return db[_0x2d47('0x2d')][_0x2d47('0x42')]({'where':{'IntervalId':_0xa1bd68[_0x2d47('0x45')]['id']}});});}})[_0x2d47('0x26')](respondWithResult(_0x3776e8,null))[_0x2d47('0x48')](handleError(_0x3776e8,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b6f438a..9a46203 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 _0xc9fa=['rewrite','interval','then','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals'];(function(_0xafeaaa,_0x54141a){var _0x2ce3d7=function(_0x4a374d){while(--_0x4a374d){_0xafeaaa['push'](_0xafeaaa['shift']());}};_0x2ce3d7(++_0x54141a);}(_0xc9fa,0x1e7));var _0xac9f=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0xc9fa[_0x9d39e9];return _0x4ac75b;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xac9f('0x0'));var iftime=require(_0xac9f('0x1'))[_0xac9f('0x2')];module[_0xac9f('0x3')]=function(_0x4c227d){return _0x4c227d[_0xac9f('0x4')](_0xac9f('0x5'),attributes,{'tableName':_0xac9f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x599729){extensions[_0xac9f('0x7')](_0x4c227d,_0x599729);},'afterBulkCreate':function(_0x2ce93c,_0x333f14,_0x5283f7){_0x5283f7();extensions[_0xac9f('0x7')](_0x4c227d,_0x2ce93c[0x0]);},'afterUpdate':function(_0x54b7b6){extensions[_0xac9f('0x7')](_0x4c227d,_0x54b7b6);},'afterDestroy':function(_0x469441){extensions[_0xac9f('0x7')](_0x4c227d,_0x469441);}},'instanceMethods':{'ifTime':function(_0x3e231d=undefined,_0x302d7b=new Date()){if(typeof this[_0xac9f('0x8')]==='string'){return iftime(this[_0xac9f('0x8')],_0x3e231d,_0x302d7b);}else{return this['getIntervals']()[_0xac9f('0x9')](function(_0x1eb231){return Promise['all'](_0x1eb231[_0xac9f('0xa')](function(_0x5e8c7d){return _0x5e8c7d[_0xac9f('0xb')](_0x3e231d,_0x302d7b);}));})['then'](function(_0x45cc89){return _0x45cc89[_0xac9f('0xc')](function(_0x23083d,_0x41352f){return _0x23083d||_0x41352f;},![]);});}}}});}; \ No newline at end of file +var _0x5bc3=['interval','string','getIntervals','all','map','then','reduce','../../components/extensions/rewrite','iftime','exports','define','tools_intervals','rewrite'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x5bc3,0x166));var _0x35bc=function(_0x4ab289,_0x1a510a){_0x4ab289=_0x4ab289-0x0;var _0x5d57c9=_0x5bc3[_0x4ab289];return _0x5d57c9;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x35bc('0x0'));var iftime=require('../../utils/iftime')[_0x35bc('0x1')];module[_0x35bc('0x2')]=function(_0x946f51){return _0x946f51[_0x35bc('0x3')]('Interval',attributes,{'tableName':_0x35bc('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c3a0e){extensions['rewrite'](_0x946f51,_0x5c3a0e);},'afterBulkCreate':function(_0x21120a,_0x1fbcf4,_0x1ef6af){_0x1ef6af();extensions[_0x35bc('0x5')](_0x946f51,_0x21120a[0x0]);},'afterUpdate':function(_0x56e656){extensions['rewrite'](_0x946f51,_0x56e656);},'afterDestroy':function(_0x462089){extensions[_0x35bc('0x5')](_0x946f51,_0x462089);}},'instanceMethods':{'ifTime':function(_0xe4542=undefined,_0x59466f=new Date()){if(typeof this[_0x35bc('0x6')]===_0x35bc('0x7')){return iftime(this[_0x35bc('0x6')],_0xe4542,_0x59466f);}else{return this[_0x35bc('0x8')]()['then'](function(_0x49e2f0){return Promise[_0x35bc('0x9')](_0x49e2f0[_0x35bc('0xa')](function(_0x1b1299){return _0x1b1299['ifTime'](_0xe4542,_0x59466f);}));})[_0x35bc('0xb')](function(_0x577deb){return _0x577deb[_0x35bc('0xc')](function(_0x55ad5e,_0x20ed30){return _0x55ad5e||_0x20ed30;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0cbbac4..1a4d6f3 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 _0x69f2=['timezone','length','silly','resolve','isArray','reduce','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','map','include','model','then','info','debug','catch','error','message','ShowInterval','find','stringify','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervals','string'];(function(_0x13ba18,_0x39041f){var _0x5e292a=function(_0x4f35da){while(--_0x4f35da){_0x13ba18['push'](_0x13ba18['shift']());}};_0x5e292a(++_0x39041f);}(_0x69f2,0x156));var _0x269f=function(_0x82209e,_0x1569bb){_0x82209e=_0x82209e-0x0;var _0x36068e=_0x69f2[_0x82209e];return _0x36068e;};'use strict';var _=require(_0x269f('0x0'));var util=require(_0x269f('0x1'));var db=require(_0x269f('0x2'))['db'];var iftime=require(_0x269f('0x3'))[_0x269f('0x4')];var logger=require(_0x269f('0x5'))(_0x269f('0x6'));exports[_0x269f('0x7')]=function(_0xfd1c6b){var _0x2301d5=this;return new Promise(function(_0x2e6f6c,_0x288521){return db[_0x269f('0x8')][_0x269f('0x9')]({'raw':_0xfd1c6b[_0x269f('0xa')]?_0xfd1c6b[_0x269f('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0xfd1c6b['options']?_0xfd1c6b[_0x269f('0xa')][_0x269f('0xb')]||null:null,'attributes':_0xfd1c6b[_0x269f('0xa')]?_0xfd1c6b[_0x269f('0xa')][_0x269f('0xc')]||null:null,'limit':_0xfd1c6b[_0x269f('0xa')]?_0xfd1c6b['options'][_0x269f('0xd')]||null:null,'include':_0xfd1c6b[_0x269f('0xa')]?_0xfd1c6b['options']['include']?_[_0x269f('0xe')](_0xfd1c6b[_0x269f('0xa')][_0x269f('0xf')],function(_0x579898){return{'model':db[_0x579898[_0x269f('0x10')]],'as':_0x579898['as'],'attributes':_0x579898[_0x269f('0xc')],'include':_0x579898[_0x269f('0xf')]?_[_0x269f('0xe')](_0x579898[_0x269f('0xf')],function(_0x45d866){return{'model':db[_0x45d866[_0x269f('0x10')]],'as':_0x45d866['as'],'attributes':_0x45d866['attributes'],'include':_0x45d866[_0x269f('0xf')]?_[_0x269f('0xe')](_0x45d866[_0x269f('0xf')],function(_0x5df498){return{'model':db[_0x5df498['model']],'as':_0x5df498['as'],'attributes':_0x5df498[_0x269f('0xc')]};}):[]};}):[]};}):[]:[]})[_0x269f('0x11')](function(_0x36b0ed){logger[_0x269f('0x12')](_0x269f('0x7'),_0xfd1c6b);logger[_0x269f('0x13')](_0x269f('0x7'),_0xfd1c6b,JSON['stringify'](_0x36b0ed));_0x2e6f6c(_0x36b0ed);})[_0x269f('0x14')](function(_0x1fc85b){logger['error'](_0x269f('0x7'),_0x1fc85b['message'],_0xfd1c6b);_0x288521(_0x2301d5[_0x269f('0x15')](0x1f4,_0x1fc85b[_0x269f('0x16')]));});});};exports[_0x269f('0x17')]=function(_0x4049e1){var _0x27379a=this;return new Promise(function(_0x1fe7b6,_0x547344){return db[_0x269f('0x8')][_0x269f('0x18')]({'raw':_0x4049e1['options']?_0x4049e1[_0x269f('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x4049e1['options']?_0x4049e1[_0x269f('0xa')][_0x269f('0xb')]||null:null,'attributes':_0x4049e1[_0x269f('0xa')]?_0x4049e1[_0x269f('0xa')][_0x269f('0xc')]||null:null,'include':_0x4049e1[_0x269f('0xa')]?_0x4049e1['options'][_0x269f('0xf')]?_[_0x269f('0xe')](_0x4049e1[_0x269f('0xa')][_0x269f('0xf')],function(_0xf7573d){return{'model':db[_0xf7573d[_0x269f('0x10')]],'as':_0xf7573d['as'],'attributes':_0xf7573d[_0x269f('0xc')],'include':_0xf7573d[_0x269f('0xf')]?_[_0x269f('0xe')](_0xf7573d[_0x269f('0xf')],function(_0x3aeb6b){return{'model':db[_0x3aeb6b[_0x269f('0x10')]],'as':_0x3aeb6b['as'],'attributes':_0x3aeb6b[_0x269f('0xc')],'include':_0x3aeb6b[_0x269f('0xf')]?_[_0x269f('0xe')](_0x3aeb6b['include'],function(_0x28160f){return{'model':db[_0x28160f[_0x269f('0x10')]],'as':_0x28160f['as'],'attributes':_0x28160f['attributes']};}):[]};}):[]};}):[]:[]})[_0x269f('0x11')](function(_0x227307){logger[_0x269f('0x12')]('ShowInterval',_0x4049e1);logger['debug']('ShowInterval',_0x4049e1,JSON[_0x269f('0x19')](_0x227307));_0x1fe7b6(_0x227307);})[_0x269f('0x14')](function(_0x1c348a){logger[_0x269f('0x15')](_0x269f('0x17'),_0x1c348a[_0x269f('0x16')],_0x4049e1);_0x547344(_0x27379a[_0x269f('0x15')](0x1f4,_0x1c348a[_0x269f('0x16')]));});});};function checkArrayOfIntervals(_0x123063,_0x19ae3f){var _0x165dac=[];return db[_0x269f('0x8')][_0x269f('0x9')]({'where':{'id':_0x123063}})[_0x269f('0x11')](function(_0x10b598){_0x165dac=_0x10b598;return Promise['all'](_0x165dac[_0x269f('0xe')](function(_0x234e99){return _0x234e99[_0x269f('0x1a')](_0x19ae3f);}));})[_0x269f('0x11')](function(_0x51a167){var _0x2e2d84=_0x51a167['reduce'](function(_0x1f688e,_0x1a118a){return _0x1f688e||_0x1a118a;},![]);logger[_0x269f('0x12')](util['format'](_0x269f('0x1b'),_0x165dac[_0x269f('0xe')](function(_0x3af6e9){return _0x3af6e9[_0x269f('0x1c')];})[_0x269f('0x1d')](',\x20'),_0x165dac[_0x269f('0xe')](function(_0x10692e){return _0x10692e['id'];})[_0x269f('0x1d')](',\x20')));return _0x2e2d84;});}function checkSingleInterval(_0x28baf7,_0x3d3e7e){return db[_0x269f('0x8')][_0x269f('0x1e')](_0x28baf7)['then'](function(_0x293bf8){if(_0x293bf8){logger[_0x269f('0x12')](util[_0x269f('0x1f')](_0x269f('0x20'),_0x293bf8[_0x269f('0x1c')],_0x293bf8['id']));return _0x293bf8[_0x269f('0x1a')](_0x3d3e7e);}});}exports[_0x269f('0x21')]=function(_0x399222){var _0x47e77e=_0x399222['intervalIds'];var _0x1a7a13=Array['isArray'](_0x399222[_0x269f('0x22')])?_0x399222[_0x269f('0x22')]:typeof _0x399222[_0x269f('0x22')]===_0x269f('0x23')?[_0x399222[_0x269f('0x22')]]:[];var _0x4086c9=_0x399222[_0x269f('0x24')]||undefined;var _0x53baf4=![];if(_0x1a7a13[_0x269f('0x25')]){logger[_0x269f('0x12')](util[_0x269f('0x1f')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x1a7a13[_0x269f('0x1d')](';\x20')));}if(_0x4086c9){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x4086c9));}logger[_0x269f('0x13')]('Iftime',_0x53baf4);logger[_0x269f('0x26')]('IntervalIftime',_0x399222);return Promise[_0x269f('0x27')]()['then'](function(){if(Array[_0x269f('0x28')](_0x47e77e)){return checkArrayOfIntervals(_0x47e77e,_0x4086c9);}else if(_0x47e77e){return checkSingleInterval(_0x47e77e,_0x4086c9);}})[_0x269f('0x11')](function(_0x2695e3){var _0x17f4be=_0x1a7a13[_0x269f('0x29')](function(_0x108a9c,_0x408b9a){return _0x108a9c||iftime(_0x408b9a,_0x4086c9);},![]);_0x53baf4=_0x2695e3||_0x17f4be;return _0x53baf4;})[_0x269f('0x14')](function(_0x59d77f){logger[_0x269f('0x15')](_0x269f('0x21'),_0x399222,_0x59d77f);throw this[_0x269f('0x15')](0x1f4,_0x59d77f[_0x269f('0x16')]);});}; \ No newline at end of file +var _0x8ab7=['format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','isArray','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','options','raw','where','map','attributes','include','model','then','info','stringify','catch','error','message','Interval','find','ShowInterval','debug','findAll','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervals','timezone','length'];(function(_0x641e45,_0x46d5ab){var _0x1c7b30=function(_0x145549){while(--_0x145549){_0x641e45['push'](_0x641e45['shift']());}};_0x1c7b30(++_0x46d5ab);}(_0x8ab7,0x102));var _0x78ab=function(_0x1a4c15,_0x484a13){_0x1a4c15=_0x1a4c15-0x0;var _0x5b2a91=_0x8ab7[_0x1a4c15];return _0x5b2a91;};'use strict';var _=require(_0x78ab('0x0'));var util=require(_0x78ab('0x1'));var db=require(_0x78ab('0x2'))['db'];var iftime=require(_0x78ab('0x3'))['iftime'];var logger=require(_0x78ab('0x4'))(_0x78ab('0x5'));exports[_0x78ab('0x6')]=function(_0x390aa2){var _0xfd0bd8=this;return new Promise(function(_0x38e894,_0x31ec19){return db['Interval']['findAll']({'raw':_0x390aa2[_0x78ab('0x7')]?_0x390aa2[_0x78ab('0x7')][_0x78ab('0x8')]===undefined?!![]:![]:!![],'where':_0x390aa2[_0x78ab('0x7')]?_0x390aa2['options'][_0x78ab('0x9')]||null:null,'attributes':_0x390aa2['options']?_0x390aa2[_0x78ab('0x7')]['attributes']||null:null,'limit':_0x390aa2['options']?_0x390aa2[_0x78ab('0x7')]['limit']||null:null,'include':_0x390aa2['options']?_0x390aa2[_0x78ab('0x7')]['include']?_[_0x78ab('0xa')](_0x390aa2['options']['include'],function(_0x4c61fb){return{'model':db[_0x4c61fb['model']],'as':_0x4c61fb['as'],'attributes':_0x4c61fb[_0x78ab('0xb')],'include':_0x4c61fb['include']?_[_0x78ab('0xa')](_0x4c61fb[_0x78ab('0xc')],function(_0x35cc93){return{'model':db[_0x35cc93[_0x78ab('0xd')]],'as':_0x35cc93['as'],'attributes':_0x35cc93[_0x78ab('0xb')],'include':_0x35cc93[_0x78ab('0xc')]?_[_0x78ab('0xa')](_0x35cc93[_0x78ab('0xc')],function(_0x356c26){return{'model':db[_0x356c26[_0x78ab('0xd')]],'as':_0x356c26['as'],'attributes':_0x356c26[_0x78ab('0xb')]};}):[]};}):[]};}):[]:[]})[_0x78ab('0xe')](function(_0x1433c6){logger[_0x78ab('0xf')](_0x78ab('0x6'),_0x390aa2);logger['debug']('GetInterval',_0x390aa2,JSON[_0x78ab('0x10')](_0x1433c6));_0x38e894(_0x1433c6);})[_0x78ab('0x11')](function(_0x51e139){logger[_0x78ab('0x12')](_0x78ab('0x6'),_0x51e139['message'],_0x390aa2);_0x31ec19(_0xfd0bd8['error'](0x1f4,_0x51e139[_0x78ab('0x13')]));});});};exports['ShowInterval']=function(_0xd04c18){var _0x4996f8=this;return new Promise(function(_0x2a4314,_0x47a0b0){return db[_0x78ab('0x14')][_0x78ab('0x15')]({'raw':_0xd04c18[_0x78ab('0x7')]?_0xd04c18[_0x78ab('0x7')][_0x78ab('0x8')]===undefined?!![]:![]:!![],'where':_0xd04c18['options']?_0xd04c18[_0x78ab('0x7')][_0x78ab('0x9')]||null:null,'attributes':_0xd04c18[_0x78ab('0x7')]?_0xd04c18[_0x78ab('0x7')][_0x78ab('0xb')]||null:null,'include':_0xd04c18[_0x78ab('0x7')]?_0xd04c18['options'][_0x78ab('0xc')]?_[_0x78ab('0xa')](_0xd04c18['options'][_0x78ab('0xc')],function(_0x5e60a2){return{'model':db[_0x5e60a2['model']],'as':_0x5e60a2['as'],'attributes':_0x5e60a2['attributes'],'include':_0x5e60a2[_0x78ab('0xc')]?_[_0x78ab('0xa')](_0x5e60a2[_0x78ab('0xc')],function(_0x9c9a38){return{'model':db[_0x9c9a38['model']],'as':_0x9c9a38['as'],'attributes':_0x9c9a38[_0x78ab('0xb')],'include':_0x9c9a38[_0x78ab('0xc')]?_['map'](_0x9c9a38[_0x78ab('0xc')],function(_0x51f443){return{'model':db[_0x51f443[_0x78ab('0xd')]],'as':_0x51f443['as'],'attributes':_0x51f443[_0x78ab('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d4c6a){logger[_0x78ab('0xf')](_0x78ab('0x16'),_0xd04c18);logger[_0x78ab('0x17')](_0x78ab('0x16'),_0xd04c18,JSON[_0x78ab('0x10')](_0x5d4c6a));_0x2a4314(_0x5d4c6a);})[_0x78ab('0x11')](function(_0x1ad774){logger[_0x78ab('0x12')](_0x78ab('0x16'),_0x1ad774[_0x78ab('0x13')],_0xd04c18);_0x47a0b0(_0x4996f8[_0x78ab('0x12')](0x1f4,_0x1ad774[_0x78ab('0x13')]));});});};function checkArrayOfIntervals(_0x36a0e7,_0x154c13){var _0x17abf8=[];return db[_0x78ab('0x14')][_0x78ab('0x18')]({'where':{'id':_0x36a0e7}})[_0x78ab('0xe')](function(_0x4fd19f){_0x17abf8=_0x4fd19f;return Promise[_0x78ab('0x19')](_0x17abf8['map'](function(_0x4bf94a){return _0x4bf94a[_0x78ab('0x1a')](_0x154c13);}));})['then'](function(_0x36ab6a){var _0x36f5d7=_0x36ab6a[_0x78ab('0x1b')](function(_0x4ab7df,_0x599276){return _0x4ab7df||_0x599276;},![]);logger[_0x78ab('0xf')](util['format'](_0x78ab('0x1c'),_0x17abf8[_0x78ab('0xa')](function(_0x3af046){return _0x3af046['name'];})[_0x78ab('0x1d')](',\x20'),_0x17abf8[_0x78ab('0xa')](function(_0x2ab9ae){return _0x2ab9ae['id'];})['join'](',\x20')));return _0x36f5d7;});}function checkSingleInterval(_0x347b01,_0x16f00c){return db[_0x78ab('0x14')]['findById'](_0x347b01)[_0x78ab('0xe')](function(_0x3f7dc1){if(_0x3f7dc1){logger[_0x78ab('0xf')](util['format'](_0x78ab('0x1e'),_0x3f7dc1[_0x78ab('0x1f')],_0x3f7dc1['id']));return _0x3f7dc1[_0x78ab('0x1a')](_0x16f00c);}});}exports[_0x78ab('0x20')]=function(_0x4953aa){var _0x3a1b50=_0x4953aa['intervalIds'];var _0x5157f2=Array['isArray'](_0x4953aa[_0x78ab('0x21')])?_0x4953aa['intervals']:typeof _0x4953aa[_0x78ab('0x21')]==='string'?[_0x4953aa[_0x78ab('0x21')]]:[];var _0x57f6cb=_0x4953aa[_0x78ab('0x22')]||undefined;var _0x1fd165=![];if(_0x5157f2[_0x78ab('0x23')]){logger[_0x78ab('0xf')](util[_0x78ab('0x24')](_0x78ab('0x25'),_0x5157f2[_0x78ab('0x1d')](';\x20')));}if(_0x57f6cb){logger[_0x78ab('0xf')](util[_0x78ab('0x24')](_0x78ab('0x26'),_0x57f6cb));}logger['debug'](_0x78ab('0x27'),_0x1fd165);logger['silly'](_0x78ab('0x20'),_0x4953aa);return Promise[_0x78ab('0x28')]()[_0x78ab('0xe')](function(){if(Array[_0x78ab('0x29')](_0x3a1b50)){return checkArrayOfIntervals(_0x3a1b50,_0x57f6cb);}else if(_0x3a1b50){return checkSingleInterval(_0x3a1b50,_0x57f6cb);}})[_0x78ab('0xe')](function(_0x47f7c1){var _0xa9956f=_0x5157f2[_0x78ab('0x1b')](function(_0x4d7910,_0x287f09){return _0x4d7910||iftime(_0x287f09,_0x57f6cb);},![]);_0x1fd165=_0x47f7c1||_0xa9956f;return _0x1fd165;})[_0x78ab('0x11')](function(_0x29a50c){logger['error'](_0x78ab('0x20'),_0x4953aa,_0x29a50c);throw this['error'](0x1f4,_0x29a50c[_0x78ab('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ff500e8..d7eef5e 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ee21e,_0x5cf64c){_0x3ee21e=_0x3ee21e-0x0;var _0x10755a=_0xb10b[_0x3ee21e];return _0x10755a;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 2f86113..724e0ee 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 _0xf9a6=['email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','setEncoding','utf8','data','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x4bd439,_0x3755f8){_0x4bd439=_0x4bd439-0x0;var _0x4adefa=_0xf9a6[_0x4bd439];return _0x4adefa;};'use strict';var BPromise=require('bluebird');var https=require(_0x6f9a('0x0'));var logger=require(_0x6f9a('0x1'))(_0x6f9a('0x2'));var USERNAME=_0x6f9a('0x3');var PASSWORD=_0x6f9a('0x4');function openIssue(_0x5bb197,_0x2ea1e9){var _0x1cd2d0={'fields':{'project':{'key':_0x5bb197[_0x6f9a('0x5')]||_0x6f9a('0x6')},'summary':(_0x5bb197[_0x6f9a('0x7')]||_0x6f9a('0x8'))+_0x6f9a('0x9')+_0x5bb197['ip'],'description':_0x5bb197['description']||JSON['stringify'](_0x5bb197),'issuetype':{'name':_0x5bb197[_0x6f9a('0xa')]||_0x6f9a('0xb')}}};_0x1cd2d0[_0x6f9a('0xc')][_0x6f9a('0xd')]=_0x5bb197[_0x6f9a('0xe')];_0x1cd2d0[_0x6f9a('0xc')][_0x6f9a('0xf')]=_0x5bb197[_0x6f9a('0x10')];_0x1cd2d0[_0x6f9a('0xc')][_0x6f9a('0x11')]=_0x5bb197[_0x6f9a('0x12')];_0x1cd2d0['fields']['customfield_11503']=_0x5bb197[_0x6f9a('0x13')];_0x1cd2d0[_0x6f9a('0xc')][_0x6f9a('0x14')]=_0x5bb197[_0x6f9a('0x15')];_0x1cd2d0[_0x6f9a('0xc')][_0x6f9a('0x16')]=_0x5bb197['ip'];var _0x1a3574={'host':_0x6f9a('0x17'),'port':0x1bb,'path':_0x6f9a('0x18'),'method':_0x6f9a('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x6f9a('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x6f9a('0x1b'))}};var _0x23d4e7=JSON['stringify'](_0x1cd2d0);var _0x4f3297=https[_0x6f9a('0x1c')](_0x1a3574,function(_0x5da2a2){_0x5da2a2[_0x6f9a('0x1d')](_0x6f9a('0x1e'));var _0x1221b7='';_0x5da2a2['on'](_0x6f9a('0x1f'),function(_0x1f47b0){_0x1221b7+=_0x1f47b0;});_0x5da2a2['on']('end',function(){if(_0x2ea1e9){return _0x2ea1e9[_0x6f9a('0x20')](_0x5da2a2['statusCode'])[_0x6f9a('0x21')](JSON[_0x6f9a('0x22')](_0x1221b7));}});});_0x4f3297['on']('error',function(_0x59976c){if(_0x2ea1e9){return _0x2ea1e9[_0x6f9a('0x20')](0x1f4)[_0x6f9a('0x21')]({'errors':[{'message':_0x6f9a('0x23'),'type':_0x6f9a('0x24')}]});}});_0x4f3297[_0x6f9a('0x25')](_0x23d4e7);_0x4f3297[_0x6f9a('0x26')]();}exports[_0x6f9a('0x27')]=openIssue;exports[_0x6f9a('0x28')]=function(_0x323818,_0x3045c9){_0x323818[_0x6f9a('0x29')]['ip']=_0x323818[_0x6f9a('0x2a')][_0x6f9a('0x2b')]||_0x323818['connection'][_0x6f9a('0x2c')]||_0x323818[_0x6f9a('0x2d')][_0x6f9a('0x2c')]||_0x323818['connection']['socket'][_0x6f9a('0x2c')];return openIssue(_0x323818[_0x6f9a('0x29')],_0x3045c9);}; \ No newline at end of file +var _0x34a9=['x-forwarded-for','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','body','headers'];(function(_0x2929ba,_0x506aa6){var _0x365e6e=function(_0x206fd3){while(--_0x206fd3){_0x2929ba['push'](_0x2929ba['shift']());}};_0x365e6e(++_0x506aa6);}(_0x34a9,0x186));var _0x934a=function(_0x3c845c,_0x2780ba){_0x3c845c=_0x3c845c-0x0;var _0x44a235=_0x34a9[_0x3c845c];return _0x44a235;};'use strict';var BPromise=require(_0x934a('0x0'));var https=require(_0x934a('0x1'));var logger=require(_0x934a('0x2'))('api');var USERNAME=_0x934a('0x3');var PASSWORD=_0x934a('0x4');function openIssue(_0x3b3554,_0x53c412){var _0x129537={'fields':{'project':{'key':_0x3b3554[_0x934a('0x5')]||'MOTGUI'},'summary':(_0x3b3554[_0x934a('0x6')]||_0x934a('0x7'))+_0x934a('0x8')+_0x3b3554['ip'],'description':_0x3b3554[_0x934a('0x9')]||JSON[_0x934a('0xa')](_0x3b3554),'issuetype':{'name':_0x3b3554['issuetype']||_0x934a('0xb')}}};_0x129537[_0x934a('0xc')][_0x934a('0xd')]=_0x3b3554['email'];_0x129537[_0x934a('0xc')]['customfield_11501']=_0x3b3554[_0x934a('0xe')];_0x129537[_0x934a('0xc')][_0x934a('0xf')]=_0x3b3554[_0x934a('0x10')];_0x129537[_0x934a('0xc')][_0x934a('0x11')]=_0x3b3554[_0x934a('0x12')];_0x129537[_0x934a('0xc')][_0x934a('0x13')]=_0x3b3554[_0x934a('0x14')];_0x129537['fields']['customfield_10102']=_0x3b3554['ip'];var _0x368abb={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x934a('0x15'),'method':_0x934a('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x934a('0x17'),'Authorization':_0x934a('0x18')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x934a('0x19'))}};var _0x1fc624=JSON[_0x934a('0xa')](_0x129537);var _0x4a2deb=https['request'](_0x368abb,function(_0x5a712b){_0x5a712b[_0x934a('0x1a')](_0x934a('0x1b'));var _0x238061='';_0x5a712b['on'](_0x934a('0x1c'),function(_0x4aa11b){_0x238061+=_0x4aa11b;});_0x5a712b['on'](_0x934a('0x1d'),function(){if(_0x53c412){return _0x53c412[_0x934a('0x1e')](_0x5a712b[_0x934a('0x1f')])[_0x934a('0x20')](JSON[_0x934a('0x21')](_0x238061));}});});_0x4a2deb['on'](_0x934a('0x22'),function(_0x59123f){if(_0x53c412){return _0x53c412[_0x934a('0x1e')](0x1f4)[_0x934a('0x20')]({'errors':[{'message':_0x934a('0x23'),'type':_0x934a('0x24')}]});}});_0x4a2deb['write'](_0x1fc624);_0x4a2deb['end']();}exports[_0x934a('0x25')]=openIssue;exports['send']=function(_0x112755,_0x560353){_0x112755[_0x934a('0x26')]['ip']=_0x112755[_0x934a('0x27')][_0x934a('0x28')]||_0x112755['connection']['remoteAddress']||_0x112755[_0x934a('0x29')]['remoteAddress']||_0x112755['connection'][_0x934a('0x29')][_0x934a('0x2a')];return openIssue(_0x112755[_0x934a('0x26')],_0x560353);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e6f5047..6e7c0e2 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 _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1d7812,_0x186251){var _0x4514d7=function(_0x29838b){while(--_0x29838b){_0x1d7812['push'](_0x1d7812['shift']());}};_0x4514d7(++_0x186251);}(_0xee5b,0x1f4));var _0xbee5=function(_0x141957,_0x550caf){_0x141957=_0x141957-0x0;var _0x31d6a0=_0xee5b[_0x141957];return _0x31d6a0;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x1ec9dc,_0x23f8ab){var _0x162174=function(_0x4f2691){while(--_0x4f2691){_0x1ec9dc['push'](_0x1ec9dc['shift']());}};_0x162174(++_0x23f8ab);}(_0xa74f,0x9a));var _0xfa74=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xa74f[_0x503950];return _0x1657a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 53a7467..037785f 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0xac40fc,_0x49b27a){_0xac40fc=_0xac40fc-0x0;var _0x74c60d=_0x7a54[_0xac40fc];return _0x74c60d;};'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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x399f11,_0x4240a9){_0x399f11=_0x399f11-0x0;var _0x1324d2=_0x7a54[_0x399f11];return _0x1324d2;};'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 04e709b..9d4f1d3 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 _0x972c=['attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../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','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','intersection','fields'];(function(_0x3dad64,_0x2ad727){var _0x317260=function(_0x291815){while(--_0x291815){_0x3dad64['push'](_0x3dad64['shift']());}};_0x317260(++_0x2ad727);}(_0x972c,0xf2));var _0xc972=function(_0x213b08,_0x351c7c){_0x213b08=_0x213b08-0x0;var _0x5ad44=_0x972c[_0x213b08];return _0x5ad44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc972('0x0'));var jsonpatch=require(_0xc972('0x1'));var rp=require('request-promise');var moment=require(_0xc972('0x2'));var BPromise=require(_0xc972('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc972('0x4'));var sox=require(_0xc972('0x5'));var csv=require(_0xc972('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc972('0x7'));var _=require('lodash');var squel=require(_0xc972('0x8'));var crypto=require(_0xc972('0x9'));var jsforce=require(_0xc972('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc972('0xb'));var Redis=require('ioredis');var authService=require(_0xc972('0xc'));var qs=require(_0xc972('0xd'));var as=require(_0xc972('0xe'));var hardwareService=require(_0xc972('0xf'));var logger=require(_0xc972('0x10'))(_0xc972('0x11'));var utils=require(_0xc972('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc972('0x13'));var db=require(_0xc972('0x14'))['db'];function respondWithStatusCode(_0x27851c,_0x5829ab){_0x5829ab=_0x5829ab||0xcc;return function(_0x3623ca){if(_0x3623ca){return _0x27851c[_0xc972('0x15')](_0x5829ab);}return _0x27851c[_0xc972('0x16')](_0x5829ab)['end']();};}function respondWithResult(_0x37786e,_0x298f92){_0x298f92=_0x298f92||0xc8;return function(_0x3aa39d){if(_0x3aa39d){return _0x37786e[_0xc972('0x16')](_0x298f92)['json'](_0x3aa39d);}};}function respondWithFilteredResult(_0x665f8f,_0x3d519e){return function(_0x2b20d2){if(_0x2b20d2){var _0x341564=typeof _0x3d519e[_0xc972('0x17')]===_0xc972('0x18')&&typeof _0x3d519e[_0xc972('0x19')]===_0xc972('0x18');var _0x3a7521=_0x2b20d2[_0xc972('0x1a')];var _0x2bfe0e=_0x341564?0x0:_0x3d519e[_0xc972('0x17')];var _0x214417=_0x341564?_0x2b20d2[_0xc972('0x1a')]:_0x3d519e[_0xc972('0x17')]+_0x3d519e[_0xc972('0x19')];var _0x4a2b5f;if(_0x214417>=_0x3a7521){_0x214417=_0x3a7521;_0x4a2b5f=0xc8;}else{_0x4a2b5f=0xce;}_0x665f8f[_0xc972('0x16')](_0x4a2b5f);return _0x665f8f[_0xc972('0x1b')](_0xc972('0x1c'),_0x2bfe0e+'-'+_0x214417+'/'+_0x3a7521)[_0xc972('0x1d')](_0x2b20d2);}return null;};}function patchUpdates(_0x486340){return function(_0x5e1b06){try{jsonpatch[_0xc972('0x1e')](_0x5e1b06,_0x486340,!![]);}catch(_0x3c4b7c){return BPromise['reject'](_0x3c4b7c);}return _0x5e1b06[_0xc972('0x1f')]();};}function saveUpdates(_0x3fdacf,_0x10c6ce){return function(_0x331338){if(_0x331338){return _0x331338[_0xc972('0x20')](_0x3fdacf)[_0xc972('0x21')](function(_0x59cae4){return _0x59cae4;});}return null;};}function removeEntity(_0x11a9f1,_0x5d11e4){return function(_0x5f0c94){if(_0x5f0c94){return _0x5f0c94[_0xc972('0x22')]()[_0xc972('0x21')](function(){_0x11a9f1[_0xc972('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9bed,_0x47332e){return function(_0xf115da){if(!_0xf115da){_0x1f9bed[_0xc972('0x15')](0x194);}return _0xf115da;};}function handleError(_0x228f99,_0x2497d9){_0x2497d9=_0x2497d9||0x1f4;return function(_0x33ced1){logger[_0xc972('0x23')](_0x33ced1[_0xc972('0x24')]);if(_0x33ced1[_0xc972('0x25')]){delete _0x33ced1[_0xc972('0x25')];}_0x228f99[_0xc972('0x16')](_0x2497d9)[_0xc972('0x26')](_0x33ced1);};}exports[_0xc972('0x27')]=function(_0x5ad71d,_0x1203a8){var _0x481026={},_0x164d52={},_0x4efef1={'count':0x0,'rows':[]};var _0x26aa4c=_[_0xc972('0x28')](db[_0xc972('0x29')][_0xc972('0x2a')],function(_0x166779){return{'name':_0x166779['fieldName'],'type':_0x166779[_0xc972('0x2b')][_0xc972('0x2c')]};});_0x164d52[_0xc972('0x2d')]=_[_0xc972('0x28')](_0x26aa4c,'name');_0x164d52[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x5ad71d['query']);_0x164d52['filters']=_['intersection'](_0x164d52['model'],_0x164d52[_0xc972('0x2e')]);_0x481026['attributes']=_[_0xc972('0x30')](_0x164d52['model'],qs['fields'](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x31')]));_0x481026[_0xc972('0x32')]=_0x481026['attributes'][_0xc972('0x33')]?_0x481026['attributes']:_0x164d52[_0xc972('0x2d')];if(!_0x5ad71d[_0xc972('0x2e')]['hasOwnProperty'](_0xc972('0x34'))){_0x481026[_0xc972('0x19')]=qs[_0xc972('0x19')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x19')]);_0x481026[_0xc972('0x17')]=qs[_0xc972('0x17')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x17')]);}_0x481026[_0xc972('0x35')]=qs[_0xc972('0x36')](_0x5ad71d[_0xc972('0x2e')][_0xc972('0x36')]);_0x481026[_0xc972('0x37')]=qs[_0xc972('0x38')](_[_0xc972('0x39')](_0x5ad71d[_0xc972('0x2e')],_0x164d52[_0xc972('0x38')]),_0x26aa4c);if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]){_0x481026[_0xc972('0x37')]=_['merge'](_0x481026[_0xc972('0x37')],{'$or':_[_0xc972('0x28')](_0x26aa4c,function(_0x4880f7){if(_0x4880f7[_0xc972('0x2b')]!==_0xc972('0x3b')){var _0x255fcf={};_0x255fcf[_0x4880f7[_0xc972('0x25')]]={'$like':'%'+_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3a')]+'%'};return _0x255fcf;}})});}_0x481026=_[_0xc972('0x3c')]({},_0x481026,_0x5ad71d[_0xc972('0x3d')]);var _0x4bb412={'where':_0x481026[_0xc972('0x37')]};return db[_0xc972('0x29')]['count'](_0x4bb412)[_0xc972('0x21')](function(_0x1bc249){_0x4efef1[_0xc972('0x1a')]=_0x1bc249;if(_0x5ad71d[_0xc972('0x2e')][_0xc972('0x3e')]){_0x481026['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc972('0x3f')](_0x481026);})[_0xc972('0x21')](function(_0x483f11){_0x4efef1[_0xc972('0x40')]=_0x483f11;return _0x4efef1;})[_0xc972('0x21')](respondWithFilteredResult(_0x1203a8,_0x481026))[_0xc972('0x41')](handleError(_0x1203a8,null));};exports[_0xc972('0x42')]=function(_0x3edc1e,_0x498a43){var _0x1f0d3f={'raw':!![],'where':{'id':_0x3edc1e[_0xc972('0x43')]['id']}},_0x21830b={};_0x21830b[_0xc972('0x2d')]=_[_0xc972('0x2f')](db[_0xc972('0x29')][_0xc972('0x2a')]);_0x21830b[_0xc972('0x2e')]=_[_0xc972('0x2f')](_0x3edc1e['query']);_0x21830b[_0xc972('0x38')]=_[_0xc972('0x30')](_0x21830b['model'],_0x21830b['query']);_0x1f0d3f['attributes']=_['intersection'](_0x21830b[_0xc972('0x2d')],qs[_0xc972('0x31')](_0x3edc1e[_0xc972('0x2e')][_0xc972('0x31')]));_0x1f0d3f[_0xc972('0x32')]=_0x1f0d3f[_0xc972('0x32')][_0xc972('0x33')]?_0x1f0d3f[_0xc972('0x32')]:_0x21830b['model'];if(_0x3edc1e[_0xc972('0x2e')][_0xc972('0x3e')]){_0x1f0d3f[_0xc972('0x44')]=[{'all':!![]}];}_0x1f0d3f=_[_0xc972('0x3c')]({},_0x1f0d3f,_0x3edc1e[_0xc972('0x3d')]);return db[_0xc972('0x29')][_0xc972('0x45')](_0x1f0d3f)['then'](handleEntityNotFound(_0x498a43,null))[_0xc972('0x21')](respondWithResult(_0x498a43,null))[_0xc972('0x41')](handleError(_0x498a43,null));};exports['create']=function(_0x48bcbf,_0x215e81){return db['JscriptyAnswerReport'][_0xc972('0x46')](_0x48bcbf[_0xc972('0x47')],{})[_0xc972('0x21')](respondWithResult(_0x215e81,0xc9))[_0xc972('0x41')](handleError(_0x215e81,null));};exports[_0xc972('0x20')]=function(_0x2e921d,_0x2e2afe){if(_0x2e921d['body']['id']){delete _0x2e921d[_0xc972('0x47')]['id'];}return db[_0xc972('0x29')]['find']({'where':{'id':_0x2e921d[_0xc972('0x43')]['id']}})[_0xc972('0x21')](handleEntityNotFound(_0x2e2afe,null))[_0xc972('0x21')](saveUpdates(_0x2e921d[_0xc972('0x47')],null))['then'](respondWithResult(_0x2e2afe,null))['catch'](handleError(_0x2e2afe,null));};exports[_0xc972('0x22')]=function(_0x384ff4,_0x398be7){return db[_0xc972('0x29')][_0xc972('0x45')]({'where':{'id':_0x384ff4[_0xc972('0x43')]['id']}})['then'](handleEntityNotFound(_0x398be7,null))[_0xc972('0x21')](removeEntity(_0x398be7,null))[_0xc972('0x41')](handleError(_0x398be7,null));};exports[_0xc972('0x48')]=function(_0x52f9fd,_0x35fadd){return db[_0xc972('0x29')]['describe']()['then'](respondWithResult(_0x35fadd,null))[_0xc972('0x41')](handleError(_0x35fadd,null));}; \ No newline at end of file +var _0x6ec2=['Content-Range','apply','save','update','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x5024cf,_0x27a833){var _0x4b6827=function(_0x28c5ba){while(--_0x28c5ba){_0x5024cf['push'](_0x5024cf['shift']());}};_0x4b6827(++_0x27a833);}(_0x6ec2,0x78));var _0x26ec=function(_0x212460,_0x12db10){_0x212460=_0x212460-0x0;var _0x351df3=_0x6ec2[_0x212460];return _0x351df3;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ec('0x6'));var util=require(_0x26ec('0x7'));var path=require(_0x26ec('0x8'));var sox=require(_0x26ec('0x9'));var csv=require(_0x26ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5212e4,_0x2d869a){_0x2d869a=_0x2d869a||0xcc;return function(_0x1bec27){if(_0x1bec27){return _0x5212e4[_0x26ec('0x1a')](_0x2d869a);}return _0x5212e4[_0x26ec('0x1b')](_0x2d869a)[_0x26ec('0x1c')]();};}function respondWithResult(_0xff29e5,_0x30cbd3){_0x30cbd3=_0x30cbd3||0xc8;return function(_0x49467a){if(_0x49467a){return _0xff29e5[_0x26ec('0x1b')](_0x30cbd3)[_0x26ec('0x1d')](_0x49467a);}};}function respondWithFilteredResult(_0x302bde,_0x7f9bb2){return function(_0x4f9950){if(_0x4f9950){var _0x4d366c=typeof _0x7f9bb2[_0x26ec('0x1e')]===_0x26ec('0x1f')&&typeof _0x7f9bb2[_0x26ec('0x20')]===_0x26ec('0x1f');var _0x49dc68=_0x4f9950[_0x26ec('0x21')];var _0x176613=_0x4d366c?0x0:_0x7f9bb2['offset'];var _0x5ef1e5=_0x4d366c?_0x4f9950['count']:_0x7f9bb2[_0x26ec('0x1e')]+_0x7f9bb2[_0x26ec('0x20')];var _0x60511e;if(_0x5ef1e5>=_0x49dc68){_0x5ef1e5=_0x49dc68;_0x60511e=0xc8;}else{_0x60511e=0xce;}_0x302bde['status'](_0x60511e);return _0x302bde['set'](_0x26ec('0x22'),_0x176613+'-'+_0x5ef1e5+'/'+_0x49dc68)[_0x26ec('0x1d')](_0x4f9950);}return null;};}function patchUpdates(_0x33a28b){return function(_0x2f4d14){try{jsonpatch[_0x26ec('0x23')](_0x2f4d14,_0x33a28b,!![]);}catch(_0xe199f2){return BPromise['reject'](_0xe199f2);}return _0x2f4d14[_0x26ec('0x24')]();};}function saveUpdates(_0x29c34a,_0x2a9e82){return function(_0x46f766){if(_0x46f766){return _0x46f766[_0x26ec('0x25')](_0x29c34a)['then'](function(_0x5202e6){return _0x5202e6;});}return null;};}function removeEntity(_0x2204ba,_0x16154d){return function(_0x65aea3){if(_0x65aea3){return _0x65aea3['destroy']()['then'](function(){_0x2204ba[_0x26ec('0x1b')](0xcc)[_0x26ec('0x1c')]();});}};}function handleEntityNotFound(_0x16aba4,_0x365fac){return function(_0x4030ea){if(!_0x4030ea){_0x16aba4[_0x26ec('0x1a')](0x194);}return _0x4030ea;};}function handleError(_0x439f78,_0x4e9cf8){_0x4e9cf8=_0x4e9cf8||0x1f4;return function(_0x50fedc){logger['error'](_0x50fedc[_0x26ec('0x26')]);if(_0x50fedc[_0x26ec('0x27')]){delete _0x50fedc[_0x26ec('0x27')];}_0x439f78[_0x26ec('0x1b')](_0x4e9cf8)[_0x26ec('0x28')](_0x50fedc);};}exports[_0x26ec('0x29')]=function(_0x3268e9,_0x4a1371){var _0x30231e={},_0x5d10ba={},_0x38e942={'count':0x0,'rows':[]};var _0x355c4e=_['map'](db[_0x26ec('0x2a')][_0x26ec('0x2b')],function(_0x139d24){return{'name':_0x139d24[_0x26ec('0x2c')],'type':_0x139d24[_0x26ec('0x2d')][_0x26ec('0x2e')]};});_0x5d10ba['model']=_[_0x26ec('0x2f')](_0x355c4e,'name');_0x5d10ba[_0x26ec('0x30')]=_['keys'](_0x3268e9[_0x26ec('0x30')]);_0x5d10ba[_0x26ec('0x31')]=_['intersection'](_0x5d10ba[_0x26ec('0x32')],_0x5d10ba[_0x26ec('0x30')]);_0x30231e[_0x26ec('0x33')]=_[_0x26ec('0x34')](_0x5d10ba[_0x26ec('0x32')],qs[_0x26ec('0x35')](_0x3268e9['query']['fields']));_0x30231e['attributes']=_0x30231e['attributes']['length']?_0x30231e[_0x26ec('0x33')]:_0x5d10ba[_0x26ec('0x32')];if(!_0x3268e9[_0x26ec('0x30')][_0x26ec('0x36')](_0x26ec('0x37'))){_0x30231e['limit']=qs[_0x26ec('0x20')](_0x3268e9[_0x26ec('0x30')][_0x26ec('0x20')]);_0x30231e[_0x26ec('0x1e')]=qs[_0x26ec('0x1e')](_0x3268e9['query'][_0x26ec('0x1e')]);}_0x30231e[_0x26ec('0x38')]=qs[_0x26ec('0x39')](_0x3268e9[_0x26ec('0x30')][_0x26ec('0x39')]);_0x30231e[_0x26ec('0x3a')]=qs[_0x26ec('0x31')](_[_0x26ec('0x3b')](_0x3268e9[_0x26ec('0x30')],_0x5d10ba[_0x26ec('0x31')]),_0x355c4e);if(_0x3268e9['query']['filter']){_0x30231e[_0x26ec('0x3a')]=_[_0x26ec('0x3c')](_0x30231e['where'],{'$or':_[_0x26ec('0x2f')](_0x355c4e,function(_0x4cbe80){if(_0x4cbe80[_0x26ec('0x2d')]!==_0x26ec('0x3d')){var _0x11fc8c={};_0x11fc8c[_0x4cbe80[_0x26ec('0x27')]]={'$like':'%'+_0x3268e9[_0x26ec('0x30')][_0x26ec('0x3e')]+'%'};return _0x11fc8c;}})});}_0x30231e=_['merge']({},_0x30231e,_0x3268e9[_0x26ec('0x3f')]);var _0x3441f4={'where':_0x30231e[_0x26ec('0x3a')]};return db[_0x26ec('0x2a')][_0x26ec('0x21')](_0x3441f4)[_0x26ec('0x40')](function(_0x440ed3){_0x38e942[_0x26ec('0x21')]=_0x440ed3;if(_0x3268e9[_0x26ec('0x30')][_0x26ec('0x41')]){_0x30231e[_0x26ec('0x42')]=[{'all':!![]}];}return db[_0x26ec('0x2a')][_0x26ec('0x43')](_0x30231e);})[_0x26ec('0x40')](function(_0x20a6dd){_0x38e942['rows']=_0x20a6dd;return _0x38e942;})[_0x26ec('0x40')](respondWithFilteredResult(_0x4a1371,_0x30231e))[_0x26ec('0x44')](handleError(_0x4a1371,null));};exports[_0x26ec('0x45')]=function(_0x611b8f,_0x452bbb){var _0x1be9f7={'raw':!![],'where':{'id':_0x611b8f['params']['id']}},_0x58faf4={};_0x58faf4[_0x26ec('0x32')]=_['keys'](db[_0x26ec('0x2a')][_0x26ec('0x2b')]);_0x58faf4[_0x26ec('0x30')]=_[_0x26ec('0x46')](_0x611b8f[_0x26ec('0x30')]);_0x58faf4[_0x26ec('0x31')]=_[_0x26ec('0x34')](_0x58faf4[_0x26ec('0x32')],_0x58faf4['query']);_0x1be9f7[_0x26ec('0x33')]=_[_0x26ec('0x34')](_0x58faf4[_0x26ec('0x32')],qs['fields'](_0x611b8f[_0x26ec('0x30')][_0x26ec('0x35')]));_0x1be9f7[_0x26ec('0x33')]=_0x1be9f7[_0x26ec('0x33')][_0x26ec('0x47')]?_0x1be9f7[_0x26ec('0x33')]:_0x58faf4[_0x26ec('0x32')];if(_0x611b8f[_0x26ec('0x30')][_0x26ec('0x41')]){_0x1be9f7[_0x26ec('0x42')]=[{'all':!![]}];}_0x1be9f7=_[_0x26ec('0x3c')]({},_0x1be9f7,_0x611b8f[_0x26ec('0x3f')]);return db[_0x26ec('0x2a')][_0x26ec('0x48')](_0x1be9f7)['then'](handleEntityNotFound(_0x452bbb,null))['then'](respondWithResult(_0x452bbb,null))[_0x26ec('0x44')](handleError(_0x452bbb,null));};exports['create']=function(_0x4f873e,_0x1350d0){return db[_0x26ec('0x2a')][_0x26ec('0x49')](_0x4f873e['body'],{})['then'](respondWithResult(_0x1350d0,0xc9))['catch'](handleError(_0x1350d0,null));};exports['update']=function(_0x3faf2b,_0x583a22){if(_0x3faf2b[_0x26ec('0x4a')]['id']){delete _0x3faf2b[_0x26ec('0x4a')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3faf2b[_0x26ec('0x4b')]['id']}})[_0x26ec('0x40')](handleEntityNotFound(_0x583a22,null))['then'](saveUpdates(_0x3faf2b[_0x26ec('0x4a')],null))[_0x26ec('0x40')](respondWithResult(_0x583a22,null))['catch'](handleError(_0x583a22,null));};exports['destroy']=function(_0x34ee55,_0x125459){return db[_0x26ec('0x2a')]['find']({'where':{'id':_0x34ee55[_0x26ec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x125459,null))[_0x26ec('0x40')](removeEntity(_0x125459,null))[_0x26ec('0x44')](handleError(_0x125459,null));};exports[_0x26ec('0x4c')]=function(_0x4750a2,_0x43f2fe){return db[_0x26ec('0x2a')]['describe']()[_0x26ec('0x40')](respondWithResult(_0x43f2fe,null))[_0x26ec('0x44')](handleError(_0x43f2fe,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3cd9c19..5778a3f 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 _0x93d8=['api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger'];(function(_0x19e0ed,_0x3c55b3){var _0x18bf8d=function(_0x40f2c4){while(--_0x40f2c4){_0x19e0ed['push'](_0x19e0ed['shift']());}};_0x18bf8d(++_0x3c55b3);}(_0x93d8,0x8f));var _0x893d=function(_0x2e84f9,_0x1709d1){_0x2e84f9=_0x2e84f9-0x0;var _0x1d6128=_0x93d8[_0x2e84f9];return _0x1d6128;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x893d('0x0'))(_0x893d('0x1'));var moment=require(_0x893d('0x2'));var BPromise=require(_0x893d('0x3'));var rp=require(_0x893d('0x4'));var fs=require('fs');var path=require(_0x893d('0x5'));var rimraf=require(_0x893d('0x6'));var config=require('../../config/environment');var attributes=require(_0x893d('0x7'));module[_0x893d('0x8')]=function(_0x188766,_0x4e2223){return _0x188766[_0x893d('0x9')](_0x893d('0xa'),attributes,{'tableName':_0x893d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cda=['api','moment','bluebird','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger'];(function(_0x41b9b8,_0x364a29){var _0x3d9eb1=function(_0x3f72b7){while(--_0x3f72b7){_0x41b9b8['push'](_0x41b9b8['shift']());}};_0x3d9eb1(++_0x364a29);}(_0x5cda,0xbc));var _0xa5cd=function(_0x4a500b,_0x65d0e7){_0x4a500b=_0x4a500b-0x0;var _0x13c3ea=_0x5cda[_0x4a500b];return _0x13c3ea;};'use strict';var _=require(_0xa5cd('0x0'));var util=require('util');var logger=require(_0xa5cd('0x1'))(_0xa5cd('0x2'));var moment=require(_0xa5cd('0x3'));var BPromise=require(_0xa5cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5cd('0x5'));module[_0xa5cd('0x6')]=function(_0x35f5c4,_0x43fc9c){return _0x35f5c4[_0xa5cd('0x7')](_0xa5cd('0x8'),attributes,{'tableName':_0xa5cd('0x9'),'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 8263ed4..5c174e1 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 _0x9540=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x9540,0xdb));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0954('0x0'));var util=require(_0x0954('0x1'));var moment=require(_0x0954('0x2'));var BPromise=require(_0x0954('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0954('0x4'));var db=require(_0x0954('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0954('0x6'))(_0x0954('0x7'));var config=require('../../config/environment');var jayson=require(_0x0954('0x8'));var client=jayson[_0x0954('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1970a5,_0x34f76c,_0x3ace26){return new BPromise(function(_0x31af8e,_0x5bd3f1){return client[_0x0954('0xa')](_0x1970a5,_0x3ace26)[_0x0954('0xb')](function(_0x548b27){logger[_0x0954('0xc')](_0x0954('0xd'),_0x34f76c,'request\x20sent');logger[_0x0954('0xe')](_0x0954('0xf'),_0x34f76c,_0x0954('0x10'),JSON['stringify'](_0x548b27));if(_0x548b27[_0x0954('0x11')]){if(_0x548b27['error']['code']===0x1f4){logger['error'](_0x0954('0xd'),_0x34f76c,_0x548b27['error']['message']);return _0x5bd3f1(_0x548b27[_0x0954('0x11')][_0x0954('0x12')]);}logger[_0x0954('0x11')](_0x0954('0xd'),_0x34f76c,_0x548b27['error'][_0x0954('0x12')]);return _0x31af8e(_0x548b27['error'][_0x0954('0x12')]);}else{logger[_0x0954('0xc')](_0x0954('0xd'),_0x34f76c,'request\x20sent');_0x31af8e(_0x548b27[_0x0954('0x13')][_0x0954('0x12')]);}})['catch'](function(_0x2942ce){logger[_0x0954('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x34f76c,_0x2942ce);_0x5bd3f1(_0x2942ce);});});} \ No newline at end of file +var _0x843b=['jayson/promise','client','http','request','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x843b,0xf4));var _0xb843=function(_0x1b2c16,_0x3ab8cb){_0x1b2c16=_0x1b2c16-0x0;var _0x1b8569=_0x843b[_0x1b2c16];return _0x1b8569;};'use strict';var _=require(_0xb843('0x0'));var util=require('util');var moment=require(_0xb843('0x1'));var BPromise=require(_0xb843('0x2'));var rs=require(_0xb843('0x3'));var fs=require('fs');var Redis=require(_0xb843('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb843('0x5'));var logger=require(_0xb843('0x6'))(_0xb843('0x7'));var config=require(_0xb843('0x8'));var jayson=require(_0xb843('0x9'));var client=jayson[_0xb843('0xa')][_0xb843('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15dd06,_0x43a3c5,_0x1b7370){return new BPromise(function(_0x55973d,_0x575378){return client[_0xb843('0xc')](_0x15dd06,_0x1b7370)[_0xb843('0xd')](function(_0x279266){logger[_0xb843('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x43a3c5,_0xb843('0xf'));logger['debug'](_0xb843('0x10'),_0x43a3c5,_0xb843('0xf'),JSON[_0xb843('0x11')](_0x279266));if(_0x279266[_0xb843('0x12')]){if(_0x279266[_0xb843('0x12')][_0xb843('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x43a3c5,_0x279266[_0xb843('0x12')][_0xb843('0x14')]);return _0x575378(_0x279266[_0xb843('0x12')][_0xb843('0x14')]);}logger[_0xb843('0x12')](_0xb843('0x15'),_0x43a3c5,_0x279266[_0xb843('0x12')][_0xb843('0x14')]);return _0x55973d(_0x279266[_0xb843('0x12')][_0xb843('0x14')]);}else{logger[_0xb843('0xe')](_0xb843('0x15'),_0x43a3c5,'request\x20sent');_0x55973d(_0x279266['result']['message']);}})[_0xb843('0x16')](function(_0x4ee520){logger['error'](_0xb843('0x15'),_0x43a3c5,_0x4ee520);_0x575378(_0x4ee520);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 35f6ade..c498ce7 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 _0xad3f=['/:id/answers','/:id/summary','30s','getSummary','create','post','clone','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions'];(function(_0x10a76f,_0x52c089){var _0x31f092=function(_0x5a423a){while(--_0x5a423a){_0x10a76f['push'](_0x10a76f['shift']());}};_0x31f092(++_0x52c089);}(_0xad3f,0x150));var _0xfad3=function(_0x157ce5,_0xfa6b87){_0x157ce5=_0x157ce5-0x0;var _0x359c0c=_0xad3f[_0x157ce5];return _0x359c0c;};'use strict';var multer=require('multer');var util=require(_0xfad3('0x0'));var path=require(_0xfad3('0x1'));var timeout=require(_0xfad3('0x2'));var express=require(_0xfad3('0x3'));var router=express['Router']();var fs_extra=require(_0xfad3('0x4'));var auth=require(_0xfad3('0x5'));var interaction=require(_0xfad3('0x6'));var config=require(_0xfad3('0x7'));var controller=require(_0xfad3('0x8'));router[_0xfad3('0x9')]('/',auth[_0xfad3('0xa')](),controller['index']);router[_0xfad3('0x9')](_0xfad3('0xb'),auth[_0xfad3('0xa')](),controller[_0xfad3('0xc')]);router['get'](_0xfad3('0xd'),auth[_0xfad3('0xa')](),controller['getSessions']);router['get'](_0xfad3('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xfad3('0x9')](_0xfad3('0xf'),auth[_0xfad3('0xa')](),timeout(_0xfad3('0x10')),controller[_0xfad3('0x11')]);router['post']('/',auth[_0xfad3('0xa')](),controller[_0xfad3('0x12')]);router[_0xfad3('0x13')]('/:id/clone',auth[_0xfad3('0xa')](),controller[_0xfad3('0x14')]);router[_0xfad3('0x15')](_0xfad3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xfad3('0x16')](_0xfad3('0xb'),auth[_0xfad3('0xa')](),controller[_0xfad3('0x17')]);module[_0xfad3('0x18')]=router; \ No newline at end of file +var _0x3d8e=['/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','getAnswers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3d8e,0x8c));var _0xe3d8=function(_0x430469,_0x20e783){_0x430469=_0x430469-0x0;var _0x1ca55e=_0x3d8e[_0x430469];return _0x1ca55e;};'use strict';var multer=require(_0xe3d8('0x0'));var util=require(_0xe3d8('0x1'));var path=require(_0xe3d8('0x2'));var timeout=require(_0xe3d8('0x3'));var express=require(_0xe3d8('0x4'));var router=express[_0xe3d8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe3d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe3d8('0x7'));var controller=require(_0xe3d8('0x8'));router[_0xe3d8('0x9')]('/',auth[_0xe3d8('0xa')](),controller[_0xe3d8('0xb')]);router[_0xe3d8('0x9')](_0xe3d8('0xc'),auth[_0xe3d8('0xa')](),controller[_0xe3d8('0xd')]);router[_0xe3d8('0x9')]('/:id/sessions',auth[_0xe3d8('0xa')](),controller[_0xe3d8('0xe')]);router[_0xe3d8('0x9')]('/:id/answers',auth[_0xe3d8('0xa')](),controller[_0xe3d8('0xf')]);router[_0xe3d8('0x9')](_0xe3d8('0x10'),auth[_0xe3d8('0xa')](),timeout(_0xe3d8('0x11')),controller[_0xe3d8('0x12')]);router[_0xe3d8('0x13')]('/',auth[_0xe3d8('0xa')](),controller[_0xe3d8('0x14')]);router[_0xe3d8('0x13')](_0xe3d8('0x15'),auth[_0xe3d8('0xa')](),controller[_0xe3d8('0x16')]);router['put'](_0xe3d8('0xc'),auth[_0xe3d8('0xa')](),controller[_0xe3d8('0x17')]);router[_0xe3d8('0x18')]('/:id',auth[_0xe3d8('0xa')](),controller['destroy']);module[_0xe3d8('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 66085cb..1e9c14e 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 _0x7fde=['lodash','util','exports','name','TEXT','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize'];(function(_0x414392,_0x254abe){var _0x48be38=function(_0x5d5267){while(--_0x5d5267){_0x414392['push'](_0x414392['shift']());}};_0x48be38(++_0x254abe);}(_0x7fde,0x6f));var _0xe7fd=function(_0x58cf67,_0x3ddafb){_0x58cf67=_0x58cf67-0x0;var _0x16082b=_0x7fde[_0x58cf67];return _0x16082b;};'use strict';var Sequelize=require(_0xe7fd('0x0'));var _=require(_0xe7fd('0x1'));var util=require(_0xe7fd('0x2'));module[_0xe7fd('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0xe7fd('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe7fd('0x5')]('long'),'set':function(_0x5f2125){if(_['isObjectLike'](_0x5f2125)){this[_0xe7fd('0x6')](_0xe7fd('0x7'),JSON[_0xe7fd('0x8')](_0x5f2125));}else if(_[_0xe7fd('0x9')](_0x5f2125)){this['setDataValue'](_0xe7fd('0x7'),_0x5f2125);}else{this[_0xe7fd('0x6')](_0xe7fd('0x7'),util[_0xe7fd('0xa')](_0xe7fd('0xb'),this[_0xe7fd('0xc')](_0xe7fd('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe7fd('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4e33=['name','BOOLEAN','sequelize','util','exports','TEXT','long','isObjectLike','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x4e33,0xd2));var _0x34e3=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x4e33[_0x466e57];return _0x34df42;};'use strict';var Sequelize=require(_0x34e3('0x0'));var _=require('lodash');var util=require(_0x34e3('0x1'));module[_0x34e3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x34e3('0x3')](_0x34e3('0x4')),'set':function(_0x17c524){if(_[_0x34e3('0x5')](_0x17c524)){this['setDataValue'](_0x34e3('0x6'),JSON[_0x34e3('0x7')](_0x17c524));}else if(_[_0x34e3('0x8')](_0x17c524)){this['setDataValue'](_0x34e3('0x6'),_0x17c524);}else{this['setDataValue'](_0x34e3('0x6'),util['format'](_0x34e3('0x9'),this[_0x34e3('0xa')](_0x34e3('0xb'))||'',this[_0x34e3('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x34e3('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c09f064..2076dbd 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 _0xb36b=['findAll','rows','catch','show','params','filters','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','role','autoAssociation','findOne','JscriptySessionReport','nolimit','where','getAnswers','JscriptyAnswerReport','ProjectId','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Projects','destroy','name','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','JscriptyProject','include'];(function(_0x5d054e,_0x19c2e0){var _0x28db29=function(_0x55886e){while(--_0x55886e){_0x5d054e['push'](_0x5d054e['shift']());}};_0x28db29(++_0x19c2e0);}(_0xb36b,0xac));var _0xbb36=function(_0x533bf6,_0x3b6c0a){_0x533bf6=_0x533bf6-0x0;var _0x4c4c09=_0xb36b[_0x533bf6];return _0x4c4c09;};'use strict';var emlformat=require(_0xbb36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb36('0x1'));var jsonpatch=require(_0xbb36('0x2'));var rp=require(_0xbb36('0x3'));var moment=require(_0xbb36('0x4'));var BPromise=require(_0xbb36('0x5'));var Mustache=require('mustache');var util=require(_0xbb36('0x6'));var path=require(_0xbb36('0x7'));var sox=require(_0xbb36('0x8'));var csv=require(_0xbb36('0x9'));var ejs=require(_0xbb36('0xa'));var fs=require('fs');var fs_extra=require(_0xbb36('0xb'));var _=require(_0xbb36('0xc'));var squel=require(_0xbb36('0xd'));var crypto=require(_0xbb36('0xe'));var jsforce=require(_0xbb36('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb36('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbb36('0x11'));var qs=require(_0xbb36('0x12'));var as=require(_0xbb36('0x13'));var hardwareService=require(_0xbb36('0x14'));var logger=require(_0xbb36('0x15'))('api');var utils=require(_0xbb36('0x16'));var config=require(_0xbb36('0x17'));var licenseUtil=require(_0xbb36('0x18'));var db=require(_0xbb36('0x19'))['db'];function respondWithStatusCode(_0x55d7ba,_0x248529){_0x248529=_0x248529||0xcc;return function(_0x119403){if(_0x119403){return _0x55d7ba[_0xbb36('0x1a')](_0x248529);}return _0x55d7ba[_0xbb36('0x1b')](_0x248529)[_0xbb36('0x1c')]();};}function respondWithResult(_0x326c44,_0x3e8ceb){_0x3e8ceb=_0x3e8ceb||0xc8;return function(_0x8811d8){if(_0x8811d8){return _0x326c44[_0xbb36('0x1b')](_0x3e8ceb)[_0xbb36('0x1d')](_0x8811d8);}};}function respondWithFilteredResult(_0x8325a8,_0x4d022e){return function(_0x595c49){if(_0x595c49){var _0x3c5820=typeof _0x4d022e[_0xbb36('0x1e')]===_0xbb36('0x1f')&&typeof _0x4d022e[_0xbb36('0x20')]===_0xbb36('0x1f');var _0x18af40=_0x595c49[_0xbb36('0x21')];var _0x15c49a=_0x3c5820?0x0:_0x4d022e[_0xbb36('0x1e')];var _0x519a97=_0x3c5820?_0x595c49['count']:_0x4d022e[_0xbb36('0x1e')]+_0x4d022e[_0xbb36('0x20')];var _0x156918;if(_0x519a97>=_0x18af40){_0x519a97=_0x18af40;_0x156918=0xc8;}else{_0x156918=0xce;}_0x8325a8[_0xbb36('0x1b')](_0x156918);return _0x8325a8[_0xbb36('0x22')](_0xbb36('0x23'),_0x15c49a+'-'+_0x519a97+'/'+_0x18af40)[_0xbb36('0x1d')](_0x595c49);}return null;};}function patchUpdates(_0x22d35e){return function(_0x19a820){try{jsonpatch['apply'](_0x19a820,_0x22d35e,!![]);}catch(_0x617822){return BPromise[_0xbb36('0x24')](_0x617822);}return _0x19a820['save']();};}function saveUpdates(_0x2c92d2,_0x3b7358){return function(_0x1571f1){if(_0x1571f1){return _0x1571f1[_0xbb36('0x25')](_0x2c92d2)[_0xbb36('0x26')](function(_0x1e688b){return _0x1e688b;});}return null;};}function removeEntity(_0x5033e5,_0x523db7){return function(_0x42fd9c){if(_0x42fd9c){return _0x42fd9c['destroy']()[_0xbb36('0x26')](function(){var _0x20faa7=_0x42fd9c[_0xbb36('0x27')]({'plain':!![]});var _0xc1239=_0xbb36('0x28');return db['UserProfileResource'][_0xbb36('0x29')]({'where':{'type':_0xc1239,'resourceId':_0x20faa7['id']}})[_0xbb36('0x26')](function(){return _0x42fd9c;});})['then'](function(){_0x5033e5[_0xbb36('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c9ade,_0x1b7778){return function(_0x484d97){if(!_0x484d97){_0x3c9ade[_0xbb36('0x1a')](0x194);}return _0x484d97;};}function handleError(_0x590577,_0x1a2e8f){_0x1a2e8f=_0x1a2e8f||0x1f4;return function(_0x7c9948){logger['error'](_0x7c9948['stack']);if(_0x7c9948[_0xbb36('0x2a')]){delete _0x7c9948['name'];}_0x590577[_0xbb36('0x1b')](_0x1a2e8f)['send'](_0x7c9948);};}exports['index']=function(_0xaa9f47,_0x3df68e){var _0x401bbb={},_0x282f1c={},_0x3497b6={'count':0x0,'rows':[]};var _0x4f9aeb=_[_0xbb36('0x2b')](db['JscriptyProject'][_0xbb36('0x2c')],function(_0x52adf1){return{'name':_0x52adf1[_0xbb36('0x2d')],'type':_0x52adf1['type'][_0xbb36('0x2e')]};});_0x282f1c[_0xbb36('0x2f')]=_[_0xbb36('0x2b')](_0x4f9aeb,_0xbb36('0x2a'));_0x282f1c[_0xbb36('0x30')]=_[_0xbb36('0x31')](_0xaa9f47[_0xbb36('0x30')]);_0x282f1c['filters']=_[_0xbb36('0x32')](_0x282f1c['model'],_0x282f1c[_0xbb36('0x30')]);_0x401bbb[_0xbb36('0x33')]=_['intersection'](_0x282f1c['model'],qs[_0xbb36('0x34')](_0xaa9f47[_0xbb36('0x30')][_0xbb36('0x34')]));_0x401bbb[_0xbb36('0x33')]=_0x401bbb[_0xbb36('0x33')]['length']?_0x401bbb[_0xbb36('0x33')]:_0x282f1c[_0xbb36('0x2f')];if(!_0xaa9f47[_0xbb36('0x30')][_0xbb36('0x35')]('nolimit')){_0x401bbb[_0xbb36('0x20')]=qs[_0xbb36('0x20')](_0xaa9f47[_0xbb36('0x30')]['limit']);_0x401bbb[_0xbb36('0x1e')]=qs[_0xbb36('0x1e')](_0xaa9f47['query']['offset']);}_0x401bbb[_0xbb36('0x36')]=qs[_0xbb36('0x37')](_0xaa9f47['query']['sort']);_0x401bbb['where']=qs['filters'](_[_0xbb36('0x38')](_0xaa9f47[_0xbb36('0x30')],_0x282f1c['filters']),_0x4f9aeb);if(_0xaa9f47['query'][_0xbb36('0x39')]){_0x401bbb['where']=_[_0xbb36('0x3a')](_0x401bbb['where'],{'$or':_[_0xbb36('0x2b')](_0x4f9aeb,function(_0x35a743){if(_0x35a743['type']!==_0xbb36('0x3b')){var _0x334c8f={};_0x334c8f[_0x35a743['name']]={'$like':'%'+_0xaa9f47[_0xbb36('0x30')][_0xbb36('0x39')]+'%'};return _0x334c8f;}})});}_0x401bbb=_[_0xbb36('0x3a')]({},_0x401bbb,_0xaa9f47['options']);var _0x226c2c={'where':_0x401bbb['where']};return db[_0xbb36('0x3c')][_0xbb36('0x21')](_0x226c2c)[_0xbb36('0x26')](function(_0x4b4ea8){_0x3497b6[_0xbb36('0x21')]=_0x4b4ea8;if(_0xaa9f47['query']['includeAll']){_0x401bbb[_0xbb36('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0xbb36('0x3e')](_0x401bbb);})[_0xbb36('0x26')](function(_0x446b7d){_0x3497b6[_0xbb36('0x3f')]=_0x446b7d;return _0x3497b6;})['then'](respondWithFilteredResult(_0x3df68e,_0x401bbb))[_0xbb36('0x40')](handleError(_0x3df68e,null));};exports[_0xbb36('0x41')]=function(_0x4ef06f,_0x327b93){var _0x52b244={'raw':![],'where':{'id':_0x4ef06f[_0xbb36('0x42')]['id']}},_0x264ef6={};_0x264ef6[_0xbb36('0x2f')]=_[_0xbb36('0x31')](db[_0xbb36('0x3c')][_0xbb36('0x2c')]);_0x264ef6[_0xbb36('0x30')]=_['keys'](_0x4ef06f[_0xbb36('0x30')]);_0x264ef6[_0xbb36('0x43')]=_['intersection'](_0x264ef6[_0xbb36('0x2f')],_0x264ef6[_0xbb36('0x30')]);_0x52b244[_0xbb36('0x33')]=_[_0xbb36('0x32')](_0x264ef6[_0xbb36('0x2f')],qs[_0xbb36('0x34')](_0x4ef06f[_0xbb36('0x30')][_0xbb36('0x34')]));_0x52b244['attributes']=_0x52b244[_0xbb36('0x33')][_0xbb36('0x44')]?_0x52b244[_0xbb36('0x33')]:_0x264ef6[_0xbb36('0x2f')];if(_0x4ef06f[_0xbb36('0x30')][_0xbb36('0x45')]){_0x52b244['include']=[{'all':!![]}];}_0x52b244=_['merge']({},_0x52b244,_0x4ef06f[_0xbb36('0x46')]);return db[_0xbb36('0x3c')][_0xbb36('0x47')](_0x52b244)['then'](handleEntityNotFound(_0x327b93,null))[_0xbb36('0x26')](respondWithResult(_0x327b93,null))[_0xbb36('0x40')](handleError(_0x327b93,null));};exports[_0xbb36('0x48')]=function(_0x422c4e,_0x4e62b3){return db['JscriptyProject'][_0xbb36('0x48')](_0x422c4e['body'],{})['then'](function(_0x5a914a){var _0x4589a5=_0x422c4e[_0xbb36('0x49')][_0xbb36('0x27')]({'plain':!![]});if(!_0x4589a5)throw new Error(_0xbb36('0x4a'));if(_0x4589a5['role']===_0xbb36('0x49')){var _0x56c6cf=_0x5a914a['get']({'plain':!![]});var _0x576021=_0xbb36('0x28');return db[_0xbb36('0x4b')][_0xbb36('0x47')]({'where':{'name':_0x576021,'userProfileId':_0x4589a5[_0xbb36('0x4c')]},'raw':!![]})[_0xbb36('0x26')](function(_0x442da1){if(_0x442da1&&_0x442da1['autoAssociation']===0x0){return db[_0xbb36('0x4d')][_0xbb36('0x48')]({'name':_0x56c6cf[_0xbb36('0x2a')],'resourceId':_0x56c6cf['id'],'type':_0x442da1[_0xbb36('0x2a')],'sectionId':_0x442da1['id']},{})[_0xbb36('0x26')](function(){return _0x5a914a;});}else{return _0x5a914a;}})['catch'](function(_0x4a157f){logger['error'](_0xbb36('0x4e'),_0x4a157f);throw _0x4a157f;});}return _0x5a914a;})['then'](respondWithResult(_0x4e62b3,0xc9))['catch'](handleError(_0x4e62b3,null));};exports['clone']=function(_0x4e008e,_0x1a0a3e){var _0x114d13={'where':{'id':_0x4e008e[_0xbb36('0x42')]['id']}},_0x5c7f83={};_0x5c7f83[_0xbb36('0x2f')]=_[_0xbb36('0x31')](db['JscriptyProject'][_0xbb36('0x2c')]);_0x114d13['attributes']=_[_0xbb36('0x32')](_0x5c7f83[_0xbb36('0x2f')],qs[_0xbb36('0x34')](_0x4e008e[_0xbb36('0x30')][_0xbb36('0x34')]));_0x114d13[_0xbb36('0x33')]=_0x114d13['attributes']['length']?_0x114d13[_0xbb36('0x33')]:_0x5c7f83[_0xbb36('0x2f')];if(_0x4e008e['query'][_0xbb36('0x45')]){_0x114d13[_0xbb36('0x3d')]=[{'all':!![]}];}_0x114d13=_[_0xbb36('0x3a')]({},_0x114d13,_0x4e008e['options']);return db['JscriptyProject'][_0xbb36('0x47')](_0x114d13)[_0xbb36('0x26')](handleEntityNotFound(_0x1a0a3e,null))[_0xbb36('0x26')](function(_0x3b909f){if(_0x3b909f){var _0x6e9a30=_0x3b909f[_0xbb36('0x27')]({'plain':!![]});_0x6e9a30=qs[_0xbb36('0x4f')](_0x6e9a30,['id','createdAt',_0xbb36('0x50')]);_0x4e008e['body']=_['omit'](_0x4e008e['body'],['id','createdAt',_0xbb36('0x50')]);return db[_0xbb36('0x3c')]['create'](_['merge'](_0x6e9a30,_0x4e008e[_0xbb36('0x51')]),{'include':_0x4e008e[_0xbb36('0x30')][_0xbb36('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x1cd9d4){var _0x469955=_0x4e008e[_0xbb36('0x49')][_0xbb36('0x27')]({'plain':!![]});if(!_0x469955)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x469955[_0xbb36('0x52')]===_0xbb36('0x49')){var _0x57719d=_0x1cd9d4[_0xbb36('0x27')]({'plain':!![]});var _0x4a8eca=_0xbb36('0x28');return db[_0xbb36('0x4b')][_0xbb36('0x47')]({'where':{'name':_0x4a8eca,'userProfileId':_0x469955['userProfileId']},'raw':!![]})['then'](function(_0x3ab032){if(_0x3ab032&&_0x3ab032[_0xbb36('0x53')]===0x0){return db[_0xbb36('0x4d')][_0xbb36('0x48')]({'name':_0x57719d[_0xbb36('0x2a')],'resourceId':_0x57719d['id'],'type':_0x3ab032[_0xbb36('0x2a')],'sectionId':_0x3ab032['id']},{})[_0xbb36('0x26')](function(){return _0x1cd9d4;});}else{return _0x1cd9d4;}})[_0xbb36('0x40')](function(_0x5437cb){logger['error'](_0xbb36('0x4e'),_0x5437cb);throw _0x5437cb;});}return _0x1cd9d4;});}})[_0xbb36('0x26')](respondWithResult(_0x1a0a3e,0xc9))[_0xbb36('0x40')](handleError(_0x1a0a3e,null));};exports[_0xbb36('0x25')]=function(_0xd098d9,_0x2d4241){if(_0xd098d9[_0xbb36('0x51')]['id']){delete _0xd098d9[_0xbb36('0x51')]['id'];}return db[_0xbb36('0x3c')][_0xbb36('0x47')]({'where':{'id':_0xd098d9[_0xbb36('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d4241,null))[_0xbb36('0x26')](saveUpdates(_0xd098d9[_0xbb36('0x51')],null))[_0xbb36('0x26')](respondWithResult(_0x2d4241,null))[_0xbb36('0x40')](handleError(_0x2d4241,null));};exports['destroy']=function(_0x163b1b,_0x1eecb7){return db[_0xbb36('0x3c')][_0xbb36('0x47')]({'where':{'id':_0x163b1b[_0xbb36('0x42')]['id']}})[_0xbb36('0x26')](handleEntityNotFound(_0x1eecb7,null))['then'](removeEntity(_0x1eecb7,null))['catch'](handleError(_0x1eecb7,null));};exports['getSessions']=function(_0x240197,_0x6dff28,_0x58e0bf){var _0x1b08fc={'raw':!![],'where':{}};var _0x7fa277={};var _0x5e7d8d={'count':0x0,'rows':[]};return db[_0xbb36('0x3c')][_0xbb36('0x54')]({'where':{'id':_0x240197[_0xbb36('0x42')]['id']}})[_0xbb36('0x26')](handleEntityNotFound(_0x6dff28,null))['then'](function(_0x5aa4c4){if(_0x5aa4c4){_0x7fa277[_0xbb36('0x2f')]=_[_0xbb36('0x31')](db[_0xbb36('0x55')][_0xbb36('0x2c')]);_0x7fa277[_0xbb36('0x30')]=_[_0xbb36('0x31')](_0x240197[_0xbb36('0x30')]);_0x7fa277[_0xbb36('0x43')]=_[_0xbb36('0x32')](_0x7fa277[_0xbb36('0x2f')],_0x7fa277['query']);_0x1b08fc[_0xbb36('0x33')]=_[_0xbb36('0x32')](_0x7fa277[_0xbb36('0x2f')],qs['fields'](_0x240197[_0xbb36('0x30')]['fields']));_0x1b08fc[_0xbb36('0x33')]=_0x1b08fc['attributes'][_0xbb36('0x44')]?_0x1b08fc['attributes']:_0x7fa277[_0xbb36('0x2f')];if(!_0x240197[_0xbb36('0x30')][_0xbb36('0x35')](_0xbb36('0x56'))){_0x1b08fc[_0xbb36('0x20')]=qs[_0xbb36('0x20')](_0x240197['query'][_0xbb36('0x20')]);_0x1b08fc[_0xbb36('0x1e')]=qs[_0xbb36('0x1e')](_0x240197[_0xbb36('0x30')][_0xbb36('0x1e')]);}_0x1b08fc[_0xbb36('0x36')]=qs['sort'](_0x240197['query'][_0xbb36('0x37')]);_0x1b08fc[_0xbb36('0x57')]=qs['filters'](_[_0xbb36('0x38')](_0x240197[_0xbb36('0x30')],_0x7fa277[_0xbb36('0x43')]));_0x1b08fc[_0xbb36('0x57')]['ProjectId']=_0x5aa4c4['id'];if(_0x240197[_0xbb36('0x30')]['filter']){_0x1b08fc[_0xbb36('0x57')]=_[_0xbb36('0x3a')](_0x1b08fc[_0xbb36('0x57')],{'$or':_['map'](_0x1b08fc['attributes'],function(_0x5ac58a){var _0x2ddb44={};_0x2ddb44[_0x5ac58a]={'$like':'%'+_0x240197[_0xbb36('0x30')]['filter']+'%'};return _0x2ddb44;})});}_0x1b08fc=_[_0xbb36('0x3a')]({},_0x1b08fc,_0x240197['options']);return db[_0xbb36('0x55')][_0xbb36('0x21')]({'where':_0x1b08fc[_0xbb36('0x57')]})[_0xbb36('0x26')](function(_0x5b730c){_0x5e7d8d[_0xbb36('0x21')]=_0x5b730c;if(_0x240197['query'][_0xbb36('0x45')]){_0x1b08fc['include']=[{'all':!![]}];}return db[_0xbb36('0x55')][_0xbb36('0x3e')](_0x1b08fc);})[_0xbb36('0x26')](function(_0x1a1fdb){_0x5e7d8d['rows']=_0x1a1fdb;return _0x5e7d8d;});}})[_0xbb36('0x26')](respondWithFilteredResult(_0x6dff28,_0x1b08fc))['catch'](handleError(_0x6dff28,null));};exports[_0xbb36('0x58')]=function(_0x2abfeb,_0x5a393e,_0x1333c4){var _0x18dffd={'raw':!![],'where':{}};var _0x5e5119={};var _0x324d10={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xbb36('0x54')]({'where':{'id':_0x2abfeb[_0xbb36('0x42')]['id']}})[_0xbb36('0x26')](handleEntityNotFound(_0x5a393e,null))[_0xbb36('0x26')](function(_0x1f4af2){if(_0x1f4af2){_0x5e5119[_0xbb36('0x2f')]=_[_0xbb36('0x31')](db[_0xbb36('0x59')][_0xbb36('0x2c')]);_0x5e5119['query']=_['keys'](_0x2abfeb[_0xbb36('0x30')]);_0x5e5119['filters']=_['intersection'](_0x5e5119[_0xbb36('0x2f')],_0x5e5119[_0xbb36('0x30')]);_0x18dffd[_0xbb36('0x33')]=_['intersection'](_0x5e5119['model'],qs[_0xbb36('0x34')](_0x2abfeb[_0xbb36('0x30')][_0xbb36('0x34')]));_0x18dffd[_0xbb36('0x33')]=_0x18dffd[_0xbb36('0x33')][_0xbb36('0x44')]?_0x18dffd['attributes']:_0x5e5119[_0xbb36('0x2f')];if(!_0x2abfeb[_0xbb36('0x30')][_0xbb36('0x35')]('nolimit')){_0x18dffd[_0xbb36('0x20')]=qs[_0xbb36('0x20')](_0x2abfeb['query'][_0xbb36('0x20')]);_0x18dffd[_0xbb36('0x1e')]=qs['offset'](_0x2abfeb[_0xbb36('0x30')]['offset']);}_0x18dffd[_0xbb36('0x36')]=qs[_0xbb36('0x37')](_0x2abfeb[_0xbb36('0x30')][_0xbb36('0x37')]);_0x18dffd[_0xbb36('0x57')]=qs[_0xbb36('0x43')](_[_0xbb36('0x38')](_0x2abfeb['query'],_0x5e5119['filters']));_0x18dffd[_0xbb36('0x57')][_0xbb36('0x5a')]=_0x1f4af2['id'];if(_0x2abfeb[_0xbb36('0x30')]['filter']){_0x18dffd['where']=_['merge'](_0x18dffd['where'],{'$or':_[_0xbb36('0x2b')](_0x18dffd[_0xbb36('0x33')],function(_0x3eb289){var _0x193ffe={};_0x193ffe[_0x3eb289]={'$like':'%'+_0x2abfeb[_0xbb36('0x30')]['filter']+'%'};return _0x193ffe;})});}_0x18dffd=_[_0xbb36('0x3a')]({},_0x18dffd,_0x2abfeb[_0xbb36('0x46')]);return db[_0xbb36('0x59')][_0xbb36('0x21')]({'where':_0x18dffd[_0xbb36('0x57')]})[_0xbb36('0x26')](function(_0x312104){_0x324d10[_0xbb36('0x21')]=_0x312104;if(_0x2abfeb[_0xbb36('0x30')]['includeAll']){_0x18dffd['include']=[{'all':!![]}];}return db[_0xbb36('0x59')][_0xbb36('0x3e')](_0x18dffd);})['then'](function(_0x7a2ccd){_0x324d10['rows']=_0x7a2ccd;return _0x324d10;});}})['then'](respondWithFilteredResult(_0x5a393e,_0x18dffd))[_0xbb36('0x40')](handleError(_0x5a393e,null));};function char(_0x57408d){return _0xbb36('0x5b')===typeof _0x57408d?String['fromCharCode'][_0xbb36('0x5c')](null,arguments):_0x57408d;}function needsEncapsulation(_0x5b5c12){return!!_0x5b5c12&&(_0x5b5c12[_0xbb36('0x5d')]()[_0xbb36('0x5e')](char(0xd))>=0x0||_0x5b5c12[_0xbb36('0x5d')]()[_0xbb36('0x5e')](char(0xa))>=0x0||_0x5b5c12[_0xbb36('0x5d')]()[_0xbb36('0x5e')](char(0x2c))>=0x0||_0x5b5c12[_0xbb36('0x5d')]()[_0xbb36('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x1e571a){var _0x5dd3bf=char(0x22),_0x4cc208='\x5c'+char(0x22),_0x8a6568=_0x1e571a['toString']()[_0xbb36('0x5f')](new RegExp(_0x5dd3bf,'g'),_0x4cc208);return _0x5dd3bf+_0x8a6568+_0x5dd3bf;}exports[_0xbb36('0x60')]=function(_0x350419,_0x3c4bb4,_0x50a870){var _0x2564f2,_0x5a90ef;var _0x1d61fd={'where':{'ProjectId':_0x350419['params']['id']}};if(_0x350419[_0xbb36('0x30')][_0xbb36('0x61')]){_0x1d61fd[_0xbb36('0x57')][_0xbb36('0x62')]=JSON[_0xbb36('0x63')](_0x350419[_0xbb36('0x30')]['startTime']);}return db[_0xbb36('0x55')]['findAll'](_0x1d61fd)['then'](handleEntityNotFound(_0x3c4bb4,null))['then'](function(_0x3cff0c){if(_0x3cff0c){_0x2564f2=_0x3cff0c;return db[_0xbb36('0x64')][_0xbb36('0x3e')]({'where':{'SessionId':{'$in':_[_0xbb36('0x2b')](_0x2564f2,'id')},'ProjectId':_0x350419[_0xbb36('0x42')]['id']},'order':_0xbb36('0x65')});}})[_0xbb36('0x26')](handleEntityNotFound(_0x3c4bb4,null))[_0xbb36('0x26')](function(_0x16bdbb){if(_0x16bdbb){_0x5a90ef=_0x16bdbb;var _0x26709f={};for(var _0x2c432b=0x0,_0x3cf74e=_0x5a90ef[_0xbb36('0x44')];_0x2c432b<_0x3cf74e;_0x2c432b++){if(!_0x26709f[_0xbb36('0x35')](_0x5a90ef[_0x2c432b][_0xbb36('0x66')])){_0x26709f[_0x5a90ef[_0x2c432b]['questionId']]=needsEncapsulation(_0x5a90ef[_0x2c432b]['question'])?encapsulate(_0x5a90ef[_0x2c432b][_0xbb36('0x67')]):_0x5a90ef[_0x2c432b]['question'];}}var _0x12469c=[],_0x35de92={};for(var _0x25239b=0x0,_0x4e79b8=_0x2564f2[_0xbb36('0x44')];_0x25239b<_0x4e79b8;_0x25239b++){_0x35de92={'ProjectId':_0x350419[_0xbb36('0x42')]['id'],'SessionId':_0x2564f2[_0x25239b]['id'],'StartTime':moment(_0x2564f2[_0x25239b][_0xbb36('0x62')])[_0xbb36('0x68')](_0xbb36('0x69'))};for(var _0xc3d559=0x0,_0x482b20=_0x5a90ef[_0xbb36('0x44')];_0xc3d559<_0x482b20;_0xc3d559++){if(_0x5a90ef[_0xc3d559][_0xbb36('0x6a')]==_0x2564f2[_0x25239b]['id']&&_0x26709f[_0xbb36('0x35')](_0x5a90ef[_0xc3d559][_0xbb36('0x66')])){_0x35de92[_0x26709f[_0x5a90ef[_0xc3d559][_0xbb36('0x66')]]]=_0x5a90ef[_0xc3d559][_0xbb36('0x6b')];}}for(var _0x2d834b in _0x26709f){if(!_0x35de92[_0xbb36('0x35')](_0x26709f[_0x2d834b])){_0x35de92[_0x26709f[_0x2d834b]]=null;}}_0x12469c[_0xbb36('0x6c')](_0x35de92);}return _0x12469c;}})[_0xbb36('0x26')](function(_0x2ddc27){if(!_[_0xbb36('0x6d')](_0x2ddc27)){var _0x535a9e=toCsv(_0x2ddc27);var _0x2cac60=Date[_0xbb36('0x6e')]();fs[_0xbb36('0x6f')](util[_0xbb36('0x68')](_0xbb36('0x70'),_0x350419[_0xbb36('0x42')]['id'],_0x2cac60),_0x535a9e);_0x3c4bb4[_0xbb36('0x71')]('Content-disposition',_0xbb36('0x72')+util[_0xbb36('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x350419[_0xbb36('0x42')]['id'],_0x2cac60));_0x3c4bb4[_0xbb36('0x71')](_0xbb36('0x73'),_0xbb36('0x74'));return _0x3c4bb4['download'](util['format'](_0xbb36('0x70'),_0x350419[_0xbb36('0x42')]['id'],_0x2cac60));}else{return _0x3c4bb4[_0xbb36('0x1a')](0xcc);}})[_0xbb36('0x40')](handleError(_0x3c4bb4,null));}; \ No newline at end of file +var _0x3149=['autoAssociation','findOne','JscriptySessionReport','nolimit','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','findAll','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body'];(function(_0x27173a,_0x5edf66){var _0x31b780=function(_0x4677b3){while(--_0x4677b3){_0x27173a['push'](_0x27173a['shift']());}};_0x31b780(++_0x5edf66);}(_0x3149,0x181));var _0x9314=function(_0x293702,_0x20fb5d){_0x293702=_0x293702-0x0;var _0x1e9c08=_0x3149[_0x293702];return _0x1e9c08;};'use strict';var emlformat=require(_0x9314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9314('0x1'));var jsonpatch=require(_0x9314('0x2'));var rp=require(_0x9314('0x3'));var moment=require(_0x9314('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9314('0x5'));var util=require(_0x9314('0x6'));var path=require(_0x9314('0x7'));var sox=require(_0x9314('0x8'));var csv=require(_0x9314('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9314('0xa'));var _=require(_0x9314('0xb'));var squel=require(_0x9314('0xc'));var crypto=require(_0x9314('0xd'));var jsforce=require(_0x9314('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9314('0x9'));var querystring=require('querystring');var Papa=require(_0x9314('0xf'));var Redis=require('ioredis');var authService=require(_0x9314('0x10'));var qs=require(_0x9314('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9314('0x12'));var logger=require('../../config/logger')(_0x9314('0x13'));var utils=require(_0x9314('0x14'));var config=require(_0x9314('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9314('0x16'))['db'];function respondWithStatusCode(_0x23fa9b,_0x4363a0){_0x4363a0=_0x4363a0||0xcc;return function(_0x172b9a){if(_0x172b9a){return _0x23fa9b[_0x9314('0x17')](_0x4363a0);}return _0x23fa9b[_0x9314('0x18')](_0x4363a0)[_0x9314('0x19')]();};}function respondWithResult(_0x577d5e,_0x227027){_0x227027=_0x227027||0xc8;return function(_0x397f13){if(_0x397f13){return _0x577d5e[_0x9314('0x18')](_0x227027)['json'](_0x397f13);}};}function respondWithFilteredResult(_0x3bdd1b,_0x2728db){return function(_0x3cc9bf){if(_0x3cc9bf){var _0x5c3ad0=typeof _0x2728db[_0x9314('0x1a')]===_0x9314('0x1b')&&typeof _0x2728db['limit']===_0x9314('0x1b');var _0x1f5571=_0x3cc9bf[_0x9314('0x1c')];var _0x563a71=_0x5c3ad0?0x0:_0x2728db['offset'];var _0x9dcb3c=_0x5c3ad0?_0x3cc9bf['count']:_0x2728db[_0x9314('0x1a')]+_0x2728db[_0x9314('0x1d')];var _0x16b36f;if(_0x9dcb3c>=_0x1f5571){_0x9dcb3c=_0x1f5571;_0x16b36f=0xc8;}else{_0x16b36f=0xce;}_0x3bdd1b[_0x9314('0x18')](_0x16b36f);return _0x3bdd1b[_0x9314('0x1e')](_0x9314('0x1f'),_0x563a71+'-'+_0x9dcb3c+'/'+_0x1f5571)['json'](_0x3cc9bf);}return null;};}function patchUpdates(_0x1046ae){return function(_0x3250ae){try{jsonpatch[_0x9314('0x20')](_0x3250ae,_0x1046ae,!![]);}catch(_0x5c5976){return BPromise[_0x9314('0x21')](_0x5c5976);}return _0x3250ae[_0x9314('0x22')]();};}function saveUpdates(_0x345dda,_0x1dfba0){return function(_0x5881e6){if(_0x5881e6){return _0x5881e6[_0x9314('0x23')](_0x345dda)[_0x9314('0x24')](function(_0x14b58d){return _0x14b58d;});}return null;};}function removeEntity(_0x2a4212,_0x535e05){return function(_0x2b5047){if(_0x2b5047){return _0x2b5047[_0x9314('0x25')]()[_0x9314('0x24')](function(){var _0x4cb57d=_0x2b5047['get']({'plain':!![]});var _0x430144=_0x9314('0x26');return db[_0x9314('0x27')][_0x9314('0x25')]({'where':{'type':_0x430144,'resourceId':_0x4cb57d['id']}})[_0x9314('0x24')](function(){return _0x2b5047;});})['then'](function(){_0x2a4212['status'](0xcc)[_0x9314('0x19')]();});}};}function handleEntityNotFound(_0x460a46,_0x4d3521){return function(_0xe0b898){if(!_0xe0b898){_0x460a46[_0x9314('0x17')](0x194);}return _0xe0b898;};}function handleError(_0x1848db,_0x2a511f){_0x2a511f=_0x2a511f||0x1f4;return function(_0x239822){logger['error'](_0x239822[_0x9314('0x28')]);if(_0x239822[_0x9314('0x29')]){delete _0x239822[_0x9314('0x29')];}_0x1848db['status'](_0x2a511f)[_0x9314('0x2a')](_0x239822);};}exports[_0x9314('0x2b')]=function(_0x3aa78f,_0x60a0b0){var _0x53125={},_0x1fc96b={},_0x5c015a={'count':0x0,'rows':[]};var _0x575ae3=_[_0x9314('0x2c')](db[_0x9314('0x2d')]['rawAttributes'],function(_0xdac8a7){return{'name':_0xdac8a7['fieldName'],'type':_0xdac8a7[_0x9314('0x2e')][_0x9314('0x2f')]};});_0x1fc96b[_0x9314('0x30')]=_[_0x9314('0x2c')](_0x575ae3,_0x9314('0x29'));_0x1fc96b[_0x9314('0x31')]=_[_0x9314('0x32')](_0x3aa78f[_0x9314('0x31')]);_0x1fc96b[_0x9314('0x33')]=_[_0x9314('0x34')](_0x1fc96b['model'],_0x1fc96b[_0x9314('0x31')]);_0x53125[_0x9314('0x35')]=_[_0x9314('0x34')](_0x1fc96b[_0x9314('0x30')],qs[_0x9314('0x36')](_0x3aa78f[_0x9314('0x31')][_0x9314('0x36')]));_0x53125[_0x9314('0x35')]=_0x53125['attributes'][_0x9314('0x37')]?_0x53125[_0x9314('0x35')]:_0x1fc96b[_0x9314('0x30')];if(!_0x3aa78f[_0x9314('0x31')][_0x9314('0x38')]('nolimit')){_0x53125[_0x9314('0x1d')]=qs[_0x9314('0x1d')](_0x3aa78f['query'][_0x9314('0x1d')]);_0x53125[_0x9314('0x1a')]=qs[_0x9314('0x1a')](_0x3aa78f['query'][_0x9314('0x1a')]);}_0x53125[_0x9314('0x39')]=qs[_0x9314('0x3a')](_0x3aa78f[_0x9314('0x31')][_0x9314('0x3a')]);_0x53125[_0x9314('0x3b')]=qs[_0x9314('0x33')](_[_0x9314('0x3c')](_0x3aa78f['query'],_0x1fc96b[_0x9314('0x33')]),_0x575ae3);if(_0x3aa78f[_0x9314('0x31')][_0x9314('0x3d')]){_0x53125[_0x9314('0x3b')]=_[_0x9314('0x3e')](_0x53125[_0x9314('0x3b')],{'$or':_[_0x9314('0x2c')](_0x575ae3,function(_0xe4f6b9){if(_0xe4f6b9[_0x9314('0x2e')]!==_0x9314('0x3f')){var _0x466859={};_0x466859[_0xe4f6b9[_0x9314('0x29')]]={'$like':'%'+_0x3aa78f[_0x9314('0x31')][_0x9314('0x3d')]+'%'};return _0x466859;}})});}_0x53125=_[_0x9314('0x3e')]({},_0x53125,_0x3aa78f[_0x9314('0x40')]);var _0x22e1d6={'where':_0x53125[_0x9314('0x3b')]};return db['JscriptyProject'][_0x9314('0x1c')](_0x22e1d6)['then'](function(_0x598807){_0x5c015a[_0x9314('0x1c')]=_0x598807;if(_0x3aa78f[_0x9314('0x31')][_0x9314('0x41')]){_0x53125[_0x9314('0x42')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x53125);})[_0x9314('0x24')](function(_0x541bb5){_0x5c015a[_0x9314('0x43')]=_0x541bb5;return _0x5c015a;})[_0x9314('0x24')](respondWithFilteredResult(_0x60a0b0,_0x53125))[_0x9314('0x44')](handleError(_0x60a0b0,null));};exports[_0x9314('0x45')]=function(_0x31e94d,_0x184f83){var _0x2408de={'raw':![],'where':{'id':_0x31e94d[_0x9314('0x46')]['id']}},_0x2cafe4={};_0x2cafe4[_0x9314('0x30')]=_[_0x9314('0x32')](db[_0x9314('0x2d')][_0x9314('0x47')]);_0x2cafe4[_0x9314('0x31')]=_[_0x9314('0x32')](_0x31e94d[_0x9314('0x31')]);_0x2cafe4[_0x9314('0x33')]=_['intersection'](_0x2cafe4[_0x9314('0x30')],_0x2cafe4[_0x9314('0x31')]);_0x2408de['attributes']=_['intersection'](_0x2cafe4['model'],qs[_0x9314('0x36')](_0x31e94d['query'][_0x9314('0x36')]));_0x2408de['attributes']=_0x2408de[_0x9314('0x35')][_0x9314('0x37')]?_0x2408de[_0x9314('0x35')]:_0x2cafe4[_0x9314('0x30')];if(_0x31e94d['query']['includeAll']){_0x2408de[_0x9314('0x42')]=[{'all':!![]}];}_0x2408de=_[_0x9314('0x3e')]({},_0x2408de,_0x31e94d[_0x9314('0x40')]);return db[_0x9314('0x2d')][_0x9314('0x48')](_0x2408de)['then'](handleEntityNotFound(_0x184f83,null))[_0x9314('0x24')](respondWithResult(_0x184f83,null))[_0x9314('0x44')](handleError(_0x184f83,null));};exports[_0x9314('0x49')]=function(_0x5ead5b,_0x1b947b){return db[_0x9314('0x2d')]['create'](_0x5ead5b['body'],{})[_0x9314('0x24')](function(_0x263b8b){var _0x1779e6=_0x5ead5b[_0x9314('0x4a')]['get']({'plain':!![]});if(!_0x1779e6)throw new Error(_0x9314('0x4b'));if(_0x1779e6[_0x9314('0x4c')]===_0x9314('0x4a')){var _0x1e3c92=_0x263b8b[_0x9314('0x4d')]({'plain':!![]});var _0x222849=_0x9314('0x26');return db[_0x9314('0x4e')][_0x9314('0x48')]({'where':{'name':_0x222849,'userProfileId':_0x1779e6[_0x9314('0x4f')]},'raw':!![]})[_0x9314('0x24')](function(_0x55e0f2){if(_0x55e0f2&&_0x55e0f2['autoAssociation']===0x0){return db[_0x9314('0x27')][_0x9314('0x49')]({'name':_0x1e3c92[_0x9314('0x29')],'resourceId':_0x1e3c92['id'],'type':_0x55e0f2['name'],'sectionId':_0x55e0f2['id']},{})['then'](function(){return _0x263b8b;});}else{return _0x263b8b;}})[_0x9314('0x44')](function(_0x23eb03){logger[_0x9314('0x50')](_0x9314('0x51'),_0x23eb03);throw _0x23eb03;});}return _0x263b8b;})['then'](respondWithResult(_0x1b947b,0xc9))[_0x9314('0x44')](handleError(_0x1b947b,null));};exports[_0x9314('0x52')]=function(_0x342d54,_0x27c6ea){var _0x4ded1f={'where':{'id':_0x342d54[_0x9314('0x46')]['id']}},_0x157e23={};_0x157e23[_0x9314('0x30')]=_[_0x9314('0x32')](db[_0x9314('0x2d')][_0x9314('0x47')]);_0x4ded1f[_0x9314('0x35')]=_['intersection'](_0x157e23['model'],qs['fields'](_0x342d54[_0x9314('0x31')][_0x9314('0x36')]));_0x4ded1f[_0x9314('0x35')]=_0x4ded1f[_0x9314('0x35')]['length']?_0x4ded1f[_0x9314('0x35')]:_0x157e23['model'];if(_0x342d54['query'][_0x9314('0x41')]){_0x4ded1f[_0x9314('0x42')]=[{'all':!![]}];}_0x4ded1f=_[_0x9314('0x3e')]({},_0x4ded1f,_0x342d54['options']);return db['JscriptyProject'][_0x9314('0x48')](_0x4ded1f)[_0x9314('0x24')](handleEntityNotFound(_0x27c6ea,null))['then'](function(_0x127ec5){if(_0x127ec5){var _0x8de5fe=_0x127ec5[_0x9314('0x4d')]({'plain':!![]});_0x8de5fe=qs[_0x9314('0x53')](_0x8de5fe,['id',_0x9314('0x54'),_0x9314('0x55')]);_0x342d54[_0x9314('0x56')]=_[_0x9314('0x53')](_0x342d54[_0x9314('0x56')],['id','createdAt','updatedAt']);return db['JscriptyProject'][_0x9314('0x49')](_[_0x9314('0x3e')](_0x8de5fe,_0x342d54[_0x9314('0x56')]),{'include':_0x342d54[_0x9314('0x31')][_0x9314('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x4738ce){var _0x4f821d=_0x342d54[_0x9314('0x4a')][_0x9314('0x4d')]({'plain':!![]});if(!_0x4f821d)throw new Error(_0x9314('0x4b'));if(_0x4f821d['role']===_0x9314('0x4a')){var _0xb53996=_0x4738ce[_0x9314('0x4d')]({'plain':!![]});var _0xe26bb2=_0x9314('0x26');return db[_0x9314('0x4e')][_0x9314('0x48')]({'where':{'name':_0xe26bb2,'userProfileId':_0x4f821d['userProfileId']},'raw':!![]})[_0x9314('0x24')](function(_0x14e3a9){if(_0x14e3a9&&_0x14e3a9[_0x9314('0x57')]===0x0){return db[_0x9314('0x27')][_0x9314('0x49')]({'name':_0xb53996['name'],'resourceId':_0xb53996['id'],'type':_0x14e3a9['name'],'sectionId':_0x14e3a9['id']},{})[_0x9314('0x24')](function(){return _0x4738ce;});}else{return _0x4738ce;}})[_0x9314('0x44')](function(_0x113868){logger['error'](_0x9314('0x51'),_0x113868);throw _0x113868;});}return _0x4738ce;});}})[_0x9314('0x24')](respondWithResult(_0x27c6ea,0xc9))[_0x9314('0x44')](handleError(_0x27c6ea,null));};exports['update']=function(_0x3b3cea,_0xd36ac9){if(_0x3b3cea[_0x9314('0x56')]['id']){delete _0x3b3cea[_0x9314('0x56')]['id'];}return db[_0x9314('0x2d')][_0x9314('0x48')]({'where':{'id':_0x3b3cea['params']['id']}})[_0x9314('0x24')](handleEntityNotFound(_0xd36ac9,null))[_0x9314('0x24')](saveUpdates(_0x3b3cea[_0x9314('0x56')],null))['then'](respondWithResult(_0xd36ac9,null))[_0x9314('0x44')](handleError(_0xd36ac9,null));};exports[_0x9314('0x25')]=function(_0x57da65,_0x11841a){return db['JscriptyProject'][_0x9314('0x48')]({'where':{'id':_0x57da65[_0x9314('0x46')]['id']}})['then'](handleEntityNotFound(_0x11841a,null))[_0x9314('0x24')](removeEntity(_0x11841a,null))['catch'](handleError(_0x11841a,null));};exports['getSessions']=function(_0x12c097,_0x53324f,_0x5d9c96){var _0x4fe25f={'raw':!![],'where':{}};var _0x28da09={};var _0x39cb83={'count':0x0,'rows':[]};return db[_0x9314('0x2d')][_0x9314('0x58')]({'where':{'id':_0x12c097[_0x9314('0x46')]['id']}})[_0x9314('0x24')](handleEntityNotFound(_0x53324f,null))[_0x9314('0x24')](function(_0x4ab3f9){if(_0x4ab3f9){_0x28da09[_0x9314('0x30')]=_[_0x9314('0x32')](db[_0x9314('0x59')]['rawAttributes']);_0x28da09['query']=_[_0x9314('0x32')](_0x12c097[_0x9314('0x31')]);_0x28da09[_0x9314('0x33')]=_[_0x9314('0x34')](_0x28da09[_0x9314('0x30')],_0x28da09[_0x9314('0x31')]);_0x4fe25f[_0x9314('0x35')]=_[_0x9314('0x34')](_0x28da09['model'],qs[_0x9314('0x36')](_0x12c097[_0x9314('0x31')][_0x9314('0x36')]));_0x4fe25f[_0x9314('0x35')]=_0x4fe25f[_0x9314('0x35')]['length']?_0x4fe25f[_0x9314('0x35')]:_0x28da09[_0x9314('0x30')];if(!_0x12c097['query'][_0x9314('0x38')](_0x9314('0x5a'))){_0x4fe25f[_0x9314('0x1d')]=qs['limit'](_0x12c097['query'][_0x9314('0x1d')]);_0x4fe25f[_0x9314('0x1a')]=qs[_0x9314('0x1a')](_0x12c097['query'][_0x9314('0x1a')]);}_0x4fe25f[_0x9314('0x39')]=qs['sort'](_0x12c097[_0x9314('0x31')][_0x9314('0x3a')]);_0x4fe25f['where']=qs['filters'](_['pick'](_0x12c097['query'],_0x28da09['filters']));_0x4fe25f[_0x9314('0x3b')]['ProjectId']=_0x4ab3f9['id'];if(_0x12c097[_0x9314('0x31')][_0x9314('0x3d')]){_0x4fe25f[_0x9314('0x3b')]=_[_0x9314('0x3e')](_0x4fe25f[_0x9314('0x3b')],{'$or':_[_0x9314('0x2c')](_0x4fe25f[_0x9314('0x35')],function(_0x32631a){var _0x4c3f48={};_0x4c3f48[_0x32631a]={'$like':'%'+_0x12c097[_0x9314('0x31')][_0x9314('0x3d')]+'%'};return _0x4c3f48;})});}_0x4fe25f=_['merge']({},_0x4fe25f,_0x12c097['options']);return db['JscriptySessionReport'][_0x9314('0x1c')]({'where':_0x4fe25f['where']})[_0x9314('0x24')](function(_0x22770f){_0x39cb83[_0x9314('0x1c')]=_0x22770f;if(_0x12c097[_0x9314('0x31')][_0x9314('0x41')]){_0x4fe25f[_0x9314('0x42')]=[{'all':!![]}];}return db[_0x9314('0x59')]['findAll'](_0x4fe25f);})[_0x9314('0x24')](function(_0x124d5b){_0x39cb83[_0x9314('0x43')]=_0x124d5b;return _0x39cb83;});}})['then'](respondWithFilteredResult(_0x53324f,_0x4fe25f))['catch'](handleError(_0x53324f,null));};exports['getAnswers']=function(_0x240c9b,_0xeaafe9,_0x23e1c9){var _0x1ebf27={'raw':!![],'where':{}};var _0xc606ac={};var _0x420f34={'count':0x0,'rows':[]};return db[_0x9314('0x2d')]['findOne']({'where':{'id':_0x240c9b['params']['id']}})[_0x9314('0x24')](handleEntityNotFound(_0xeaafe9,null))[_0x9314('0x24')](function(_0x19aed4){if(_0x19aed4){_0xc606ac[_0x9314('0x30')]=_[_0x9314('0x32')](db[_0x9314('0x5b')][_0x9314('0x47')]);_0xc606ac[_0x9314('0x31')]=_[_0x9314('0x32')](_0x240c9b[_0x9314('0x31')]);_0xc606ac[_0x9314('0x33')]=_[_0x9314('0x34')](_0xc606ac[_0x9314('0x30')],_0xc606ac['query']);_0x1ebf27[_0x9314('0x35')]=_[_0x9314('0x34')](_0xc606ac[_0x9314('0x30')],qs[_0x9314('0x36')](_0x240c9b[_0x9314('0x31')][_0x9314('0x36')]));_0x1ebf27[_0x9314('0x35')]=_0x1ebf27['attributes'][_0x9314('0x37')]?_0x1ebf27['attributes']:_0xc606ac[_0x9314('0x30')];if(!_0x240c9b[_0x9314('0x31')][_0x9314('0x38')]('nolimit')){_0x1ebf27[_0x9314('0x1d')]=qs['limit'](_0x240c9b[_0x9314('0x31')]['limit']);_0x1ebf27[_0x9314('0x1a')]=qs[_0x9314('0x1a')](_0x240c9b[_0x9314('0x31')][_0x9314('0x1a')]);}_0x1ebf27[_0x9314('0x39')]=qs['sort'](_0x240c9b[_0x9314('0x31')][_0x9314('0x3a')]);_0x1ebf27[_0x9314('0x3b')]=qs[_0x9314('0x33')](_[_0x9314('0x3c')](_0x240c9b[_0x9314('0x31')],_0xc606ac[_0x9314('0x33')]));_0x1ebf27[_0x9314('0x3b')]['ProjectId']=_0x19aed4['id'];if(_0x240c9b[_0x9314('0x31')][_0x9314('0x3d')]){_0x1ebf27[_0x9314('0x3b')]=_[_0x9314('0x3e')](_0x1ebf27[_0x9314('0x3b')],{'$or':_[_0x9314('0x2c')](_0x1ebf27[_0x9314('0x35')],function(_0x51248f){var _0xf58243={};_0xf58243[_0x51248f]={'$like':'%'+_0x240c9b[_0x9314('0x31')][_0x9314('0x3d')]+'%'};return _0xf58243;})});}_0x1ebf27=_['merge']({},_0x1ebf27,_0x240c9b['options']);return db['JscriptyAnswerReport']['count']({'where':_0x1ebf27[_0x9314('0x3b')]})[_0x9314('0x24')](function(_0x57ca14){_0x420f34[_0x9314('0x1c')]=_0x57ca14;if(_0x240c9b[_0x9314('0x31')][_0x9314('0x41')]){_0x1ebf27['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x1ebf27);})[_0x9314('0x24')](function(_0x10b645){_0x420f34['rows']=_0x10b645;return _0x420f34;});}})[_0x9314('0x24')](respondWithFilteredResult(_0xeaafe9,_0x1ebf27))[_0x9314('0x44')](handleError(_0xeaafe9,null));};function char(_0x5542ef){return _0x9314('0x5c')===typeof _0x5542ef?String[_0x9314('0x5d')][_0x9314('0x20')](null,arguments):_0x5542ef;}function needsEncapsulation(_0x1f1589){return!!_0x1f1589&&(_0x1f1589[_0x9314('0x5e')]()[_0x9314('0x5f')](char(0xd))>=0x0||_0x1f1589[_0x9314('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x1f1589[_0x9314('0x5e')]()[_0x9314('0x5f')](char(0x2c))>=0x0||_0x1f1589[_0x9314('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x17bc7c){var _0x31fab1=char(0x22),_0x274f82='\x5c'+char(0x22),_0x1ec971=_0x17bc7c['toString']()[_0x9314('0x60')](new RegExp(_0x31fab1,'g'),_0x274f82);return _0x31fab1+_0x1ec971+_0x31fab1;}exports[_0x9314('0x61')]=function(_0x3ac705,_0x2c4731,_0x578345){var _0x54e239,_0x2817f0;var _0x2879de={'where':{'ProjectId':_0x3ac705[_0x9314('0x46')]['id']}};if(_0x3ac705[_0x9314('0x31')][_0x9314('0x62')]){_0x2879de['where'][_0x9314('0x63')]=JSON[_0x9314('0x64')](_0x3ac705[_0x9314('0x31')][_0x9314('0x62')]);}return db[_0x9314('0x59')][_0x9314('0x65')](_0x2879de)[_0x9314('0x24')](handleEntityNotFound(_0x2c4731,null))[_0x9314('0x24')](function(_0x26f16b){if(_0x26f16b){_0x54e239=_0x26f16b;return db['JscriptyQuestionReport'][_0x9314('0x65')]({'where':{'SessionId':{'$in':_[_0x9314('0x2c')](_0x54e239,'id')},'ProjectId':_0x3ac705[_0x9314('0x46')]['id']},'order':'-createdAt'});}})[_0x9314('0x24')](handleEntityNotFound(_0x2c4731,null))[_0x9314('0x24')](function(_0x5e01d8){if(_0x5e01d8){_0x2817f0=_0x5e01d8;var _0x4f402f={};for(var _0x5ecdb5=0x0,_0x2eca9f=_0x2817f0[_0x9314('0x37')];_0x5ecdb5<_0x2eca9f;_0x5ecdb5++){if(!_0x4f402f[_0x9314('0x38')](_0x2817f0[_0x5ecdb5][_0x9314('0x66')])){_0x4f402f[_0x2817f0[_0x5ecdb5][_0x9314('0x66')]]=needsEncapsulation(_0x2817f0[_0x5ecdb5]['question'])?encapsulate(_0x2817f0[_0x5ecdb5][_0x9314('0x67')]):_0x2817f0[_0x5ecdb5]['question'];}}var _0x5749cf=[],_0x73bd4b={};for(var _0x197bb3=0x0,_0x2627ac=_0x54e239[_0x9314('0x37')];_0x197bb3<_0x2627ac;_0x197bb3++){_0x73bd4b={'ProjectId':_0x3ac705['params']['id'],'SessionId':_0x54e239[_0x197bb3]['id'],'StartTime':moment(_0x54e239[_0x197bb3][_0x9314('0x63')])[_0x9314('0x68')](_0x9314('0x69'))};for(var _0x40cdb7=0x0,_0x123653=_0x2817f0[_0x9314('0x37')];_0x40cdb7<_0x123653;_0x40cdb7++){if(_0x2817f0[_0x40cdb7][_0x9314('0x6a')]==_0x54e239[_0x197bb3]['id']&&_0x4f402f[_0x9314('0x38')](_0x2817f0[_0x40cdb7]['questionId'])){_0x73bd4b[_0x4f402f[_0x2817f0[_0x40cdb7][_0x9314('0x66')]]]=_0x2817f0[_0x40cdb7][_0x9314('0x6b')];}}for(var _0x39b293 in _0x4f402f){if(!_0x73bd4b['hasOwnProperty'](_0x4f402f[_0x39b293])){_0x73bd4b[_0x4f402f[_0x39b293]]=null;}}_0x5749cf[_0x9314('0x6c')](_0x73bd4b);}return _0x5749cf;}})[_0x9314('0x24')](function(_0x3a791d){if(!_[_0x9314('0x6d')](_0x3a791d)){var _0x4ce990=toCsv(_0x3a791d);var _0x1f0189=Date[_0x9314('0x6e')]();fs['writeFileSync'](util[_0x9314('0x68')](_0x9314('0x6f'),_0x3ac705[_0x9314('0x46')]['id'],_0x1f0189),_0x4ce990);_0x2c4731[_0x9314('0x70')](_0x9314('0x71'),'attachment;\x20filename='+util[_0x9314('0x68')](_0x9314('0x72'),_0x3ac705[_0x9314('0x46')]['id'],_0x1f0189));_0x2c4731[_0x9314('0x70')](_0x9314('0x73'),_0x9314('0x74'));return _0x2c4731[_0x9314('0x75')](util[_0x9314('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3ac705['params']['id'],_0x1f0189));}else{return _0x2c4731[_0x9314('0x17')](0xcc);}})[_0x9314('0x44')](handleError(_0x2c4731,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e8692fc..35108bd 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 _0xdc03=['define','jscripty_projects','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x220c4a,_0x8e56d3){var _0x1d8554=function(_0xab48aa){while(--_0xab48aa){_0x220c4a['push'](_0x220c4a['shift']());}};_0x1d8554(++_0x8e56d3);}(_0xdc03,0x65));var _0x3dc0=function(_0x2871b3,_0x3cdb61){_0x2871b3=_0x2871b3-0x0;var _0x5605de=_0xdc03[_0x2871b3];return _0x5605de;};'use strict';var _=require(_0x3dc0('0x0'));var util=require('util');var logger=require(_0x3dc0('0x1'))(_0x3dc0('0x2'));var moment=require('moment');var BPromise=require(_0x3dc0('0x3'));var rp=require(_0x3dc0('0x4'));var fs=require('fs');var path=require(_0x3dc0('0x5'));var rimraf=require(_0x3dc0('0x6'));var config=require(_0x3dc0('0x7'));var attributes=require(_0x3dc0('0x8'));module['exports']=function(_0x3c5407,_0x20c408){return _0x3c5407[_0x3dc0('0x9')]('JscriptyProject',attributes,{'tableName':_0x3dc0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f5d=['define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports'];(function(_0x4faebf,_0x17ba29){var _0x4ff062=function(_0x3d9789){while(--_0x3d9789){_0x4faebf['push'](_0x4faebf['shift']());}};_0x4ff062(++_0x17ba29);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4f5d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'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 3f1c92a..7b421df 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53952d,_0x4f9f12){var _0x106309=function(_0x37b19f){while(--_0x37b19f){_0x53952d['push'](_0x53952d['shift']());}};_0x106309(++_0x4f9f12);}(_0x70e0,0x17b));var _0x070e=function(_0x4777a1,_0x4f1f6e){_0x4777a1=_0x4777a1-0x0;var _0x4b350c=_0x70e0[_0x4777a1];return _0x4b350c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0xda3f,0xec));var _0xfda3=function(_0x1fe401,_0x3f5428){_0x1fe401=_0x1fe401-0x0;var _0x3c8c80=_0xda3f[_0x1fe401];return _0x3c8c80;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 518fe4a..2f9ff23 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 _0xbede=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbede,0x1be));var _0xebed=function(_0x1212ef,_0x329d04){_0x1212ef=_0x1212ef-0x0;var _0x57c27f=_0xbede[_0x1212ef];return _0x57c27f;};'use strict';var multer=require('multer');var util=require(_0xebed('0x0'));var path=require(_0xebed('0x1'));var timeout=require(_0xebed('0x2'));var express=require(_0xebed('0x3'));var router=express[_0xebed('0x4')]();var fs_extra=require(_0xebed('0x5'));var auth=require(_0xebed('0x6'));var interaction=require(_0xebed('0x7'));var config=require(_0xebed('0x8'));var controller=require(_0xebed('0x9'));router[_0xebed('0xa')]('/',auth['isAuthenticated'](),controller[_0xebed('0xb')]);router['get'](_0xebed('0xc'),auth[_0xebed('0xd')](),controller[_0xebed('0xe')]);router[_0xebed('0xa')](_0xebed('0xf'),auth[_0xebed('0xd')](),controller['show']);router[_0xebed('0x10')]('/',auth[_0xebed('0xd')](),controller['create']);router[_0xebed('0x11')](_0xebed('0xf'),auth[_0xebed('0xd')](),controller[_0xebed('0x12')]);router[_0xebed('0x13')](_0xebed('0xf'),auth['isAuthenticated'](),controller[_0xebed('0x14')]);module[_0xebed('0x15')]=router; \ No newline at end of file +var _0x820d=['create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x538a35,_0x670caa){var _0x2facb5=function(_0x4bc2fe){while(--_0x4bc2fe){_0x538a35['push'](_0x538a35['shift']());}};_0x2facb5(++_0x670caa);}(_0x820d,0x159));var _0xd820=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x820d[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0xd820('0x0'));var util=require(_0xd820('0x1'));var path=require(_0xd820('0x2'));var timeout=require(_0xd820('0x3'));var express=require(_0xd820('0x4'));var router=express[_0xd820('0x5')]();var fs_extra=require(_0xd820('0x6'));var auth=require(_0xd820('0x7'));var interaction=require(_0xd820('0x8'));var config=require('../../config/environment');var controller=require(_0xd820('0x9'));router[_0xd820('0xa')]('/',auth[_0xd820('0xb')](),controller[_0xd820('0xc')]);router[_0xd820('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd820('0xa')](_0xd820('0xd'),auth[_0xd820('0xb')](),controller[_0xd820('0xe')]);router['post']('/',auth[_0xd820('0xb')](),controller[_0xd820('0xf')]);router['put']('/:id',auth[_0xd820('0xb')](),controller[_0xd820('0x10')]);router['delete']('/:id',auth[_0xd820('0xb')](),controller['destroy']);module[_0xd820('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ff6c5fd..a6af062 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x5293ac,_0x321fe2){_0x5293ac=_0x5293ac-0x0;var _0x821ccd=_0x7a54[_0x5293ac];return _0x821ccd;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x589046,_0x139c29){_0x589046=_0x589046-0x0;var _0x198711=_0x7a54[_0x589046];return _0x198711;};'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 19b16fa..a7ee555 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 _0xc375=['hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','then','includeAll','include','rows','catch','params','keys','create','body','destroy','find','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','sendStatus','error','stack','name','send','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xc375,0x18b));var _0x5c37=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xc375[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0x5c37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c37('0x1'));var jsonpatch=require(_0x5c37('0x2'));var rp=require(_0x5c37('0x3'));var moment=require(_0x5c37('0x4'));var BPromise=require(_0x5c37('0x5'));var Mustache=require(_0x5c37('0x6'));var util=require(_0x5c37('0x7'));var path=require(_0x5c37('0x8'));var sox=require(_0x5c37('0x9'));var csv=require(_0x5c37('0xa'));var ejs=require(_0x5c37('0xb'));var fs=require('fs');var fs_extra=require(_0x5c37('0xc'));var _=require('lodash');var squel=require(_0x5c37('0xd'));var crypto=require(_0x5c37('0xe'));var jsforce=require(_0x5c37('0xf'));var deskjs=require(_0x5c37('0x10'));var toCsv=require(_0x5c37('0xa'));var querystring=require(_0x5c37('0x11'));var Papa=require('papaparse');var Redis=require(_0x5c37('0x12'));var authService=require(_0x5c37('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5c37('0x14'));var hardwareService=require(_0x5c37('0x15'));var logger=require(_0x5c37('0x16'))(_0x5c37('0x17'));var utils=require('../../config/utils');var config=require(_0x5c37('0x18'));var licenseUtil=require(_0x5c37('0x19'));var db=require(_0x5c37('0x1a'))['db'];function respondWithStatusCode(_0x5f13fa,_0x157d5d){_0x157d5d=_0x157d5d||0xcc;return function(_0x8e2035){if(_0x8e2035){return _0x5f13fa['sendStatus'](_0x157d5d);}return _0x5f13fa[_0x5c37('0x1b')](_0x157d5d)[_0x5c37('0x1c')]();};}function respondWithResult(_0x36d0bc,_0x352af8){_0x352af8=_0x352af8||0xc8;return function(_0x5d519c){if(_0x5d519c){return _0x36d0bc[_0x5c37('0x1b')](_0x352af8)[_0x5c37('0x1d')](_0x5d519c);}};}function respondWithFilteredResult(_0x5d46ed,_0x15578e){return function(_0x479483){if(_0x479483){var _0x4b158b=typeof _0x15578e[_0x5c37('0x1e')]===_0x5c37('0x1f')&&typeof _0x15578e['limit']===_0x5c37('0x1f');var _0x2352da=_0x479483[_0x5c37('0x20')];var _0x46f355=_0x4b158b?0x0:_0x15578e['offset'];var _0x19e9bd=_0x4b158b?_0x479483['count']:_0x15578e[_0x5c37('0x1e')]+_0x15578e[_0x5c37('0x21')];var _0x8517eb;if(_0x19e9bd>=_0x2352da){_0x19e9bd=_0x2352da;_0x8517eb=0xc8;}else{_0x8517eb=0xce;}_0x5d46ed[_0x5c37('0x1b')](_0x8517eb);return _0x5d46ed['set'](_0x5c37('0x22'),_0x46f355+'-'+_0x19e9bd+'/'+_0x2352da)[_0x5c37('0x1d')](_0x479483);}return null;};}function patchUpdates(_0x45446a){return function(_0x1efc5a){try{jsonpatch[_0x5c37('0x23')](_0x1efc5a,_0x45446a,!![]);}catch(_0x2be584){return BPromise[_0x5c37('0x24')](_0x2be584);}return _0x1efc5a['save']();};}function saveUpdates(_0x429260,_0x27b07d){return function(_0x3484ed){if(_0x3484ed){return _0x3484ed[_0x5c37('0x25')](_0x429260)['then'](function(_0x122580){return _0x122580;});}return null;};}function removeEntity(_0x2016de,_0x1abde1){return function(_0xb3170b){if(_0xb3170b){return _0xb3170b['destroy']()['then'](function(){_0x2016de['status'](0xcc)[_0x5c37('0x1c')]();});}};}function handleEntityNotFound(_0x1d31cd,_0x38966e){return function(_0x1943a3){if(!_0x1943a3){_0x1d31cd[_0x5c37('0x26')](0x194);}return _0x1943a3;};}function handleError(_0x37eb95,_0xd4afff){_0xd4afff=_0xd4afff||0x1f4;return function(_0x143e69){logger[_0x5c37('0x27')](_0x143e69[_0x5c37('0x28')]);if(_0x143e69[_0x5c37('0x29')]){delete _0x143e69['name'];}_0x37eb95[_0x5c37('0x1b')](_0xd4afff)[_0x5c37('0x2a')](_0x143e69);};}exports['index']=function(_0x2c9014,_0x3aa2f6){var _0x5419ba={},_0x541acf={},_0x2d3197={'count':0x0,'rows':[]};var _0x33592c=_['map'](db[_0x5c37('0x2b')][_0x5c37('0x2c')],function(_0x198ec9){return{'name':_0x198ec9[_0x5c37('0x2d')],'type':_0x198ec9[_0x5c37('0x2e')][_0x5c37('0x2f')]};});_0x541acf[_0x5c37('0x30')]=_['map'](_0x33592c,_0x5c37('0x29'));_0x541acf[_0x5c37('0x31')]=_['keys'](_0x2c9014['query']);_0x541acf[_0x5c37('0x32')]=_[_0x5c37('0x33')](_0x541acf[_0x5c37('0x30')],_0x541acf[_0x5c37('0x31')]);_0x5419ba['attributes']=_[_0x5c37('0x33')](_0x541acf[_0x5c37('0x30')],qs[_0x5c37('0x34')](_0x2c9014[_0x5c37('0x31')][_0x5c37('0x34')]));_0x5419ba[_0x5c37('0x35')]=_0x5419ba[_0x5c37('0x35')][_0x5c37('0x36')]?_0x5419ba[_0x5c37('0x35')]:_0x541acf[_0x5c37('0x30')];if(!_0x2c9014[_0x5c37('0x31')][_0x5c37('0x37')](_0x5c37('0x38'))){_0x5419ba[_0x5c37('0x21')]=qs[_0x5c37('0x21')](_0x2c9014['query']['limit']);_0x5419ba['offset']=qs[_0x5c37('0x1e')](_0x2c9014[_0x5c37('0x31')][_0x5c37('0x1e')]);}_0x5419ba[_0x5c37('0x39')]=qs['sort'](_0x2c9014[_0x5c37('0x31')][_0x5c37('0x3a')]);_0x5419ba[_0x5c37('0x3b')]=qs['filters'](_['pick'](_0x2c9014[_0x5c37('0x31')],_0x541acf[_0x5c37('0x32')]),_0x33592c);if(_0x2c9014[_0x5c37('0x31')]['filter']){_0x5419ba[_0x5c37('0x3b')]=_[_0x5c37('0x3c')](_0x5419ba[_0x5c37('0x3b')],{'$or':_[_0x5c37('0x3d')](_0x33592c,function(_0x312306){if(_0x312306[_0x5c37('0x2e')]!=='VIRTUAL'){var _0xf11c05={};_0xf11c05[_0x312306[_0x5c37('0x29')]]={'$like':'%'+_0x2c9014[_0x5c37('0x31')][_0x5c37('0x3e')]+'%'};return _0xf11c05;}})});}_0x5419ba=_[_0x5c37('0x3c')]({},_0x5419ba,_0x2c9014[_0x5c37('0x3f')]);var _0x38b8a9={'where':_0x5419ba[_0x5c37('0x3b')]};return db[_0x5c37('0x2b')][_0x5c37('0x20')](_0x38b8a9)[_0x5c37('0x40')](function(_0x255c2e){_0x2d3197[_0x5c37('0x20')]=_0x255c2e;if(_0x2c9014[_0x5c37('0x31')][_0x5c37('0x41')]){_0x5419ba[_0x5c37('0x42')]=[{'all':!![]}];}return db[_0x5c37('0x2b')]['findAll'](_0x5419ba);})[_0x5c37('0x40')](function(_0x4c8d9c){_0x2d3197[_0x5c37('0x43')]=_0x4c8d9c;return _0x2d3197;})[_0x5c37('0x40')](respondWithFilteredResult(_0x3aa2f6,_0x5419ba))[_0x5c37('0x44')](handleError(_0x3aa2f6,null));};exports['show']=function(_0x4c8be2,_0xb89c2b){var _0x1950f5={'raw':!![],'where':{'id':_0x4c8be2[_0x5c37('0x45')]['id']}},_0x1ebdbd={};_0x1ebdbd[_0x5c37('0x30')]=_[_0x5c37('0x46')](db[_0x5c37('0x2b')][_0x5c37('0x2c')]);_0x1ebdbd[_0x5c37('0x31')]=_[_0x5c37('0x46')](_0x4c8be2[_0x5c37('0x31')]);_0x1ebdbd[_0x5c37('0x32')]=_[_0x5c37('0x33')](_0x1ebdbd['model'],_0x1ebdbd[_0x5c37('0x31')]);_0x1950f5[_0x5c37('0x35')]=_[_0x5c37('0x33')](_0x1ebdbd[_0x5c37('0x30')],qs['fields'](_0x4c8be2[_0x5c37('0x31')][_0x5c37('0x34')]));_0x1950f5[_0x5c37('0x35')]=_0x1950f5['attributes'][_0x5c37('0x36')]?_0x1950f5['attributes']:_0x1ebdbd[_0x5c37('0x30')];if(_0x4c8be2['query']['includeAll']){_0x1950f5[_0x5c37('0x42')]=[{'all':!![]}];}_0x1950f5=_[_0x5c37('0x3c')]({},_0x1950f5,_0x4c8be2[_0x5c37('0x3f')]);return db[_0x5c37('0x2b')]['find'](_0x1950f5)[_0x5c37('0x40')](handleEntityNotFound(_0xb89c2b,null))['then'](respondWithResult(_0xb89c2b,null))[_0x5c37('0x44')](handleError(_0xb89c2b,null));};exports[_0x5c37('0x47')]=function(_0x4a972e,_0x3c9ed1){return db[_0x5c37('0x2b')][_0x5c37('0x47')](_0x4a972e[_0x5c37('0x48')],{})[_0x5c37('0x40')](respondWithResult(_0x3c9ed1,0xc9))[_0x5c37('0x44')](handleError(_0x3c9ed1,null));};exports['update']=function(_0x2e9f28,_0x3f635c){if(_0x2e9f28[_0x5c37('0x48')]['id']){delete _0x2e9f28[_0x5c37('0x48')]['id'];}return db[_0x5c37('0x2b')]['find']({'where':{'id':_0x2e9f28[_0x5c37('0x45')]['id']}})[_0x5c37('0x40')](handleEntityNotFound(_0x3f635c,null))[_0x5c37('0x40')](saveUpdates(_0x2e9f28[_0x5c37('0x48')],null))[_0x5c37('0x40')](respondWithResult(_0x3f635c,null))['catch'](handleError(_0x3f635c,null));};exports[_0x5c37('0x49')]=function(_0x320783,_0xc54416){return db[_0x5c37('0x2b')][_0x5c37('0x4a')]({'where':{'id':_0x320783[_0x5c37('0x45')]['id']}})[_0x5c37('0x40')](handleEntityNotFound(_0xc54416,null))['then'](removeEntity(_0xc54416,null))[_0x5c37('0x44')](handleError(_0xc54416,null));};exports['describe']=function(_0x56b767,_0x54400c){return db[_0x5c37('0x2b')]['describe']()[_0x5c37('0x40')](respondWithResult(_0x54400c,null))['catch'](handleError(_0x54400c,null));}; \ No newline at end of file +var _0x2fdf=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x2fdf,0x67));var _0xf2fd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2fdf[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2fd('0x0'));var zipdir=require(_0xf2fd('0x1'));var jsonpatch=require(_0xf2fd('0x2'));var rp=require(_0xf2fd('0x3'));var moment=require('moment');var BPromise=require(_0xf2fd('0x4'));var Mustache=require('mustache');var util=require(_0xf2fd('0x5'));var path=require(_0xf2fd('0x6'));var sox=require('sox');var csv=require(_0xf2fd('0x7'));var ejs=require(_0xf2fd('0x8'));var fs=require('fs');var fs_extra=require(_0xf2fd('0x9'));var _=require('lodash');var squel=require(_0xf2fd('0xa'));var crypto=require(_0xf2fd('0xb'));var jsforce=require(_0xf2fd('0xc'));var deskjs=require(_0xf2fd('0xd'));var toCsv=require(_0xf2fd('0x7'));var querystring=require(_0xf2fd('0xe'));var Papa=require(_0xf2fd('0xf'));var Redis=require(_0xf2fd('0x10'));var authService=require(_0xf2fd('0x11'));var qs=require(_0xf2fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2fd('0x13'));var utils=require(_0xf2fd('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf2fd('0x15'))['db'];function respondWithStatusCode(_0x49121c,_0x222be6){_0x222be6=_0x222be6||0xcc;return function(_0x4b01ac){if(_0x4b01ac){return _0x49121c[_0xf2fd('0x16')](_0x222be6);}return _0x49121c[_0xf2fd('0x17')](_0x222be6)[_0xf2fd('0x18')]();};}function respondWithResult(_0x173af2,_0x5a24fd){_0x5a24fd=_0x5a24fd||0xc8;return function(_0x1b3452){if(_0x1b3452){return _0x173af2[_0xf2fd('0x17')](_0x5a24fd)[_0xf2fd('0x19')](_0x1b3452);}};}function respondWithFilteredResult(_0x317de1,_0x36aae6){return function(_0x1378b7){if(_0x1378b7){var _0x3f554b=typeof _0x36aae6[_0xf2fd('0x1a')]===_0xf2fd('0x1b')&&typeof _0x36aae6[_0xf2fd('0x1c')]===_0xf2fd('0x1b');var _0x388028=_0x1378b7['count'];var _0x528da5=_0x3f554b?0x0:_0x36aae6[_0xf2fd('0x1a')];var _0x19c3b5=_0x3f554b?_0x1378b7[_0xf2fd('0x1d')]:_0x36aae6[_0xf2fd('0x1a')]+_0x36aae6['limit'];var _0x5269e4;if(_0x19c3b5>=_0x388028){_0x19c3b5=_0x388028;_0x5269e4=0xc8;}else{_0x5269e4=0xce;}_0x317de1[_0xf2fd('0x17')](_0x5269e4);return _0x317de1[_0xf2fd('0x1e')]('Content-Range',_0x528da5+'-'+_0x19c3b5+'/'+_0x388028)[_0xf2fd('0x19')](_0x1378b7);}return null;};}function patchUpdates(_0xcd9c40){return function(_0xcc5167){try{jsonpatch['apply'](_0xcc5167,_0xcd9c40,!![]);}catch(_0x56cd44){return BPromise[_0xf2fd('0x1f')](_0x56cd44);}return _0xcc5167[_0xf2fd('0x20')]();};}function saveUpdates(_0x11a1b3,_0x10b6c2){return function(_0x9e11dc){if(_0x9e11dc){return _0x9e11dc[_0xf2fd('0x21')](_0x11a1b3)[_0xf2fd('0x22')](function(_0x2b82d1){return _0x2b82d1;});}return null;};}function removeEntity(_0x2ade59,_0x3bd521){return function(_0x5f3b41){if(_0x5f3b41){return _0x5f3b41[_0xf2fd('0x23')]()[_0xf2fd('0x22')](function(){_0x2ade59[_0xf2fd('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321643,_0x2b5e50){return function(_0xa84cba){if(!_0xa84cba){_0x321643[_0xf2fd('0x16')](0x194);}return _0xa84cba;};}function handleError(_0x332173,_0x56c2db){_0x56c2db=_0x56c2db||0x1f4;return function(_0x2646bf){logger[_0xf2fd('0x24')](_0x2646bf[_0xf2fd('0x25')]);if(_0x2646bf[_0xf2fd('0x26')]){delete _0x2646bf['name'];}_0x332173[_0xf2fd('0x17')](_0x56c2db)[_0xf2fd('0x27')](_0x2646bf);};}exports[_0xf2fd('0x28')]=function(_0x5d4c5e,_0x2ab6c9){var _0x5cf938={},_0x194381={},_0x40c489={'count':0x0,'rows':[]};var _0x4a5652=_[_0xf2fd('0x29')](db[_0xf2fd('0x2a')][_0xf2fd('0x2b')],function(_0x40985f){return{'name':_0x40985f[_0xf2fd('0x2c')],'type':_0x40985f['type'][_0xf2fd('0x2d')]};});_0x194381[_0xf2fd('0x2e')]=_[_0xf2fd('0x29')](_0x4a5652,'name');_0x194381['query']=_[_0xf2fd('0x2f')](_0x5d4c5e[_0xf2fd('0x30')]);_0x194381[_0xf2fd('0x31')]=_[_0xf2fd('0x32')](_0x194381[_0xf2fd('0x2e')],_0x194381['query']);_0x5cf938[_0xf2fd('0x33')]=_[_0xf2fd('0x32')](_0x194381[_0xf2fd('0x2e')],qs[_0xf2fd('0x34')](_0x5d4c5e[_0xf2fd('0x30')][_0xf2fd('0x34')]));_0x5cf938[_0xf2fd('0x33')]=_0x5cf938[_0xf2fd('0x33')][_0xf2fd('0x35')]?_0x5cf938['attributes']:_0x194381[_0xf2fd('0x2e')];if(!_0x5d4c5e[_0xf2fd('0x30')]['hasOwnProperty'](_0xf2fd('0x36'))){_0x5cf938[_0xf2fd('0x1c')]=qs['limit'](_0x5d4c5e[_0xf2fd('0x30')]['limit']);_0x5cf938['offset']=qs[_0xf2fd('0x1a')](_0x5d4c5e[_0xf2fd('0x30')]['offset']);}_0x5cf938[_0xf2fd('0x37')]=qs['sort'](_0x5d4c5e[_0xf2fd('0x30')][_0xf2fd('0x38')]);_0x5cf938[_0xf2fd('0x39')]=qs[_0xf2fd('0x31')](_[_0xf2fd('0x3a')](_0x5d4c5e['query'],_0x194381['filters']),_0x4a5652);if(_0x5d4c5e['query'][_0xf2fd('0x3b')]){_0x5cf938['where']=_[_0xf2fd('0x3c')](_0x5cf938[_0xf2fd('0x39')],{'$or':_[_0xf2fd('0x29')](_0x4a5652,function(_0x255161){if(_0x255161[_0xf2fd('0x3d')]!==_0xf2fd('0x3e')){var _0x53ddc7={};_0x53ddc7[_0x255161[_0xf2fd('0x26')]]={'$like':'%'+_0x5d4c5e[_0xf2fd('0x30')][_0xf2fd('0x3b')]+'%'};return _0x53ddc7;}})});}_0x5cf938=_[_0xf2fd('0x3c')]({},_0x5cf938,_0x5d4c5e[_0xf2fd('0x3f')]);var _0xcdb7ee={'where':_0x5cf938[_0xf2fd('0x39')]};return db[_0xf2fd('0x2a')]['count'](_0xcdb7ee)['then'](function(_0xe1186f){_0x40c489[_0xf2fd('0x1d')]=_0xe1186f;if(_0x5d4c5e['query'][_0xf2fd('0x40')]){_0x5cf938[_0xf2fd('0x41')]=[{'all':!![]}];}return db[_0xf2fd('0x2a')][_0xf2fd('0x42')](_0x5cf938);})['then'](function(_0x2ab7e3){_0x40c489[_0xf2fd('0x43')]=_0x2ab7e3;return _0x40c489;})[_0xf2fd('0x22')](respondWithFilteredResult(_0x2ab6c9,_0x5cf938))[_0xf2fd('0x44')](handleError(_0x2ab6c9,null));};exports[_0xf2fd('0x45')]=function(_0x4ff372,_0x5756a8){var _0x52b4b8={'raw':!![],'where':{'id':_0x4ff372[_0xf2fd('0x46')]['id']}},_0x3f356a={};_0x3f356a[_0xf2fd('0x2e')]=_[_0xf2fd('0x2f')](db[_0xf2fd('0x2a')][_0xf2fd('0x2b')]);_0x3f356a[_0xf2fd('0x30')]=_[_0xf2fd('0x2f')](_0x4ff372[_0xf2fd('0x30')]);_0x3f356a[_0xf2fd('0x31')]=_[_0xf2fd('0x32')](_0x3f356a[_0xf2fd('0x2e')],_0x3f356a[_0xf2fd('0x30')]);_0x52b4b8['attributes']=_[_0xf2fd('0x32')](_0x3f356a[_0xf2fd('0x2e')],qs['fields'](_0x4ff372['query'][_0xf2fd('0x34')]));_0x52b4b8[_0xf2fd('0x33')]=_0x52b4b8[_0xf2fd('0x33')][_0xf2fd('0x35')]?_0x52b4b8[_0xf2fd('0x33')]:_0x3f356a[_0xf2fd('0x2e')];if(_0x4ff372[_0xf2fd('0x30')][_0xf2fd('0x40')]){_0x52b4b8[_0xf2fd('0x41')]=[{'all':!![]}];}_0x52b4b8=_[_0xf2fd('0x3c')]({},_0x52b4b8,_0x4ff372[_0xf2fd('0x3f')]);return db[_0xf2fd('0x2a')][_0xf2fd('0x47')](_0x52b4b8)[_0xf2fd('0x22')](handleEntityNotFound(_0x5756a8,null))['then'](respondWithResult(_0x5756a8,null))[_0xf2fd('0x44')](handleError(_0x5756a8,null));};exports[_0xf2fd('0x48')]=function(_0x29d7a1,_0x5bdb8f){return db[_0xf2fd('0x2a')][_0xf2fd('0x48')](_0x29d7a1[_0xf2fd('0x49')],{})[_0xf2fd('0x22')](respondWithResult(_0x5bdb8f,0xc9))['catch'](handleError(_0x5bdb8f,null));};exports[_0xf2fd('0x21')]=function(_0x5e9b82,_0xa2208b){if(_0x5e9b82[_0xf2fd('0x49')]['id']){delete _0x5e9b82[_0xf2fd('0x49')]['id'];}return db[_0xf2fd('0x2a')][_0xf2fd('0x47')]({'where':{'id':_0x5e9b82[_0xf2fd('0x46')]['id']}})['then'](handleEntityNotFound(_0xa2208b,null))[_0xf2fd('0x22')](saveUpdates(_0x5e9b82['body'],null))[_0xf2fd('0x22')](respondWithResult(_0xa2208b,null))[_0xf2fd('0x44')](handleError(_0xa2208b,null));};exports[_0xf2fd('0x23')]=function(_0x361c54,_0x757c68){return db[_0xf2fd('0x2a')][_0xf2fd('0x47')]({'where':{'id':_0x361c54[_0xf2fd('0x46')]['id']}})[_0xf2fd('0x22')](handleEntityNotFound(_0x757c68,null))[_0xf2fd('0x22')](removeEntity(_0x757c68,null))['catch'](handleError(_0x757c68,null));};exports[_0xf2fd('0x4a')]=function(_0x152154,_0x307700){return db[_0xf2fd('0x2a')]['describe']()[_0xf2fd('0x22')](respondWithResult(_0x307700,null))[_0xf2fd('0x44')](handleError(_0x307700,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index eb9f050..c151f93 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 _0x66c7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5487b0,_0x4808d7){var _0x556cff=function(_0x21a735){while(--_0x21a735){_0x5487b0['push'](_0x5487b0['shift']());}};_0x556cff(++_0x4808d7);}(_0x66c7,0xb0));var _0x766c=function(_0x124376,_0x443bc4){_0x124376=_0x124376-0x0;var _0x4f44ca=_0x66c7[_0x124376];return _0x4f44ca;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var logger=require(_0x766c('0x2'))('api');var moment=require(_0x766c('0x3'));var BPromise=require(_0x766c('0x4'));var rp=require(_0x766c('0x5'));var fs=require('fs');var path=require(_0x766c('0x6'));var rimraf=require(_0x766c('0x7'));var config=require(_0x766c('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x766c('0x9')]=function(_0x463a81,_0x43a270){return _0x463a81[_0x766c('0xa')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d3c=['../../config/logger','moment','request-promise','path','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x8d3c,0x139));var _0xc8d3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8d3c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc8d3('0x0'));var util=require(_0xc8d3('0x1'));var logger=require(_0xc8d3('0x2'))('api');var moment=require(_0xc8d3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8d3('0x4'));var fs=require('fs');var path=require(_0xc8d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc8d3('0x6'));module['exports']=function(_0x198eaf,_0x310563){return _0x198eaf['define'](_0xc8d3('0x7'),attributes,{'tableName':_0xc8d3('0x8'),'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 bfc825a..ea2d132 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 _0xf213=['debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xf213,0x66));var _0x3f21=function(_0x4fc313,_0x486d76){_0x4fc313=_0x4fc313-0x0;var _0x4190f4=_0xf213[_0x4fc313];return _0x4190f4;};'use strict';var _=require(_0x3f21('0x0'));var util=require(_0x3f21('0x1'));var moment=require(_0x3f21('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f21('0x3'));var fs=require('fs');var Redis=require(_0x3f21('0x4'));var db=require(_0x3f21('0x5'))['db'];var utils=require(_0x3f21('0x6'));var logger=require(_0x3f21('0x7'))(_0x3f21('0x8'));var config=require(_0x3f21('0x9'));var jayson=require(_0x3f21('0xa'));var client=jayson[_0x3f21('0xb')][_0x3f21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22a7ce,_0x203c08,_0x8b8741){return new BPromise(function(_0x292fcd,_0x37c91c){return client[_0x3f21('0xd')](_0x22a7ce,_0x8b8741)[_0x3f21('0xe')](function(_0x583143){logger[_0x3f21('0xf')](_0x3f21('0x10'),_0x203c08,_0x3f21('0x11'));logger[_0x3f21('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x203c08,_0x3f21('0x11'),JSON[_0x3f21('0x13')](_0x583143));if(_0x583143['error']){if(_0x583143[_0x3f21('0x14')]['code']===0x1f4){logger['error'](_0x3f21('0x10'),_0x203c08,_0x583143[_0x3f21('0x14')][_0x3f21('0x15')]);return _0x37c91c(_0x583143[_0x3f21('0x14')][_0x3f21('0x15')]);}logger[_0x3f21('0x14')](_0x3f21('0x10'),_0x203c08,_0x583143['error'][_0x3f21('0x15')]);return _0x292fcd(_0x583143[_0x3f21('0x14')][_0x3f21('0x15')]);}else{logger[_0x3f21('0xf')](_0x3f21('0x10'),_0x203c08,'request\x20sent');_0x292fcd(_0x583143[_0x3f21('0x16')][_0x3f21('0x15')]);}})[_0x3f21('0x17')](function(_0x2d05c3){logger[_0x3f21('0x14')](_0x3f21('0x10'),_0x203c08,_0x2d05c3);_0x37c91c(_0x2d05c3);});});} \ No newline at end of file +var _0xbe83=['rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x258424,_0x111992){var _0x4e67e6=function(_0x5aad15){while(--_0x5aad15){_0x258424['push'](_0x258424['shift']());}};_0x4e67e6(++_0x111992);}(_0xbe83,0x100));var _0x3be8=function(_0x312feb,_0x5c337f){_0x312feb=_0x312feb-0x0;var _0x206a6b=_0xbe83[_0x312feb];return _0x206a6b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3be8('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3be8('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x3be8('0x2'));var logger=require(_0x3be8('0x3'))(_0x3be8('0x4'));var config=require(_0x3be8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3be8('0x6')][_0x3be8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6e9038,_0x1531e7,_0x24585f){return new BPromise(function(_0x2fbc7b,_0x481e31){return client[_0x3be8('0x8')](_0x6e9038,_0x24585f)[_0x3be8('0x9')](function(_0x8e50e3){logger[_0x3be8('0xa')](_0x3be8('0xb'),_0x1531e7,'request\x20sent');logger[_0x3be8('0xc')](_0x3be8('0xd'),_0x1531e7,'request\x20sent',JSON['stringify'](_0x8e50e3));if(_0x8e50e3[_0x3be8('0xe')]){if(_0x8e50e3['error'][_0x3be8('0xf')]===0x1f4){logger[_0x3be8('0xe')](_0x3be8('0xb'),_0x1531e7,_0x8e50e3[_0x3be8('0xe')][_0x3be8('0x10')]);return _0x481e31(_0x8e50e3[_0x3be8('0xe')]['message']);}logger[_0x3be8('0xe')](_0x3be8('0xb'),_0x1531e7,_0x8e50e3[_0x3be8('0xe')][_0x3be8('0x10')]);return _0x2fbc7b(_0x8e50e3[_0x3be8('0xe')][_0x3be8('0x10')]);}else{logger[_0x3be8('0xa')](_0x3be8('0xb'),_0x1531e7,_0x3be8('0x11'));_0x2fbc7b(_0x8e50e3[_0x3be8('0x12')][_0x3be8('0x10')]);}})[_0x3be8('0x13')](function(_0x1e3ddf){logger[_0x3be8('0xe')](_0x3be8('0xb'),_0x1531e7,_0x1e3ddf);_0x481e31(_0x1e3ddf);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 56f30b9..7f898d0 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 _0x4928=['get','isAuthenticated','index','describe','/:id','show','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x185063,_0x3f0bb7){var _0x16d9d3=function(_0x1b3fe3){while(--_0x1b3fe3){_0x185063['push'](_0x185063['shift']());}};_0x16d9d3(++_0x3f0bb7);}(_0x4928,0x9e));var _0x8492=function(_0x441c12,_0x491e5a){_0x441c12=_0x441c12-0x0;var _0x312edf=_0x4928[_0x441c12];return _0x312edf;};'use strict';var multer=require(_0x8492('0x0'));var util=require(_0x8492('0x1'));var path=require(_0x8492('0x2'));var timeout=require(_0x8492('0x3'));var express=require(_0x8492('0x4'));var router=express[_0x8492('0x5')]();var fs_extra=require(_0x8492('0x6'));var auth=require(_0x8492('0x7'));var interaction=require(_0x8492('0x8'));var config=require(_0x8492('0x9'));var controller=require('./jscriptySessionReport.controller');router[_0x8492('0xa')]('/',auth[_0x8492('0xb')](),controller[_0x8492('0xc')]);router[_0x8492('0xa')]('/describe',auth[_0x8492('0xb')](),controller[_0x8492('0xd')]);router[_0x8492('0xa')](_0x8492('0xe'),auth[_0x8492('0xb')](),controller[_0x8492('0xf')]);router['get']('/:id/questions',auth[_0x8492('0xb')](),controller[_0x8492('0x10')]);router[_0x8492('0x11')]('/',auth['isAuthenticated'](),controller[_0x8492('0x12')]);router[_0x8492('0x13')](_0x8492('0xe'),auth[_0x8492('0xb')](),controller[_0x8492('0x14')]);router[_0x8492('0x15')]('/:id',auth[_0x8492('0xb')](),controller[_0x8492('0x16')]);module[_0x8492('0x17')]=router; \ No newline at end of file +var _0x9602=['post','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','/:id','show','get','getQuestions'];(function(_0x1466b3,_0x4e341c){var _0x51baf8=function(_0x24172a){while(--_0x24172a){_0x1466b3['push'](_0x1466b3['shift']());}};_0x51baf8(++_0x4e341c);}(_0x9602,0xfb));var _0x2960=function(_0x47e99b,_0x393640){_0x47e99b=_0x47e99b-0x0;var _0x4c6945=_0x9602[_0x47e99b];return _0x4c6945;};'use strict';var multer=require(_0x2960('0x0'));var util=require('util');var path=require(_0x2960('0x1'));var timeout=require(_0x2960('0x2'));var express=require(_0x2960('0x3'));var router=express[_0x2960('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2960('0x5'));var interaction=require(_0x2960('0x6'));var config=require(_0x2960('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x2960('0x8')](),controller[_0x2960('0x9')]);router['get']('/describe',auth[_0x2960('0x8')](),controller[_0x2960('0xa')]);router['get'](_0x2960('0xb'),auth['isAuthenticated'](),controller[_0x2960('0xc')]);router[_0x2960('0xd')]('/:id/questions',auth[_0x2960('0x8')](),controller[_0x2960('0xe')]);router[_0x2960('0xf')]('/',auth[_0x2960('0x8')](),controller['create']);router[_0x2960('0x10')]('/:id',auth[_0x2960('0x8')](),controller[_0x2960('0x11')]);router['delete']('/:id',auth[_0x2960('0x8')](),controller[_0x2960('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b3fe2b5..e34f030 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 _0x6ccf=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format'];(function(_0x2a27de,_0x4aaa18){var _0x4335d=function(_0xc8eb38){while(--_0xc8eb38){_0x2a27de['push'](_0x2a27de['shift']());}};_0x4335d(++_0x4aaa18);}(_0x6ccf,0xdb));var _0xf6cc=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x6ccf[_0x2aecb2];return _0x3ebb80;};'use strict';var moment=require(_0xf6cc('0x0'));var Sequelize=require(_0xf6cc('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x52383c){this[_0xf6cc('0x2')](_0xf6cc('0x3'),_0x52383c);this['setDataValue'](_0xf6cc('0x4'),moment()[_0xf6cc('0x5')](_0xf6cc('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf6cc('0x7')]},'projectname':{'type':Sequelize[_0xf6cc('0x7')]},'queue':{'type':Sequelize[_0xf6cc('0x7')]},'uniqueid':{'type':Sequelize[_0xf6cc('0x7')]},'calleridname':{'type':Sequelize[_0xf6cc('0x7')]},'calleridnum':{'type':Sequelize[_0xf6cc('0x7')]},'completed':{'type':Sequelize[_0xf6cc('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e9e=['moment','sequelize','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x2c5225,_0x4b23f9){var _0x388f6a=function(_0x3afb8f){while(--_0x3afb8f){_0x2c5225['push'](_0x2c5225['shift']());}};_0x388f6a(++_0x4b23f9);}(_0x6e9e,0x10e));var _0xe6e9=function(_0x56f43b,_0x12f74b){_0x56f43b=_0x56f43b-0x0;var _0x2a81de=_0x6e9e[_0x56f43b];return _0x2a81de;};'use strict';var moment=require(_0xe6e9('0x0'));var Sequelize=require(_0xe6e9('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x263d20){this[_0xe6e9('0x2')](_0xe6e9('0x3'),_0x263d20);this['setDataValue'](_0xe6e9('0x4'),moment()[_0xe6e9('0x5')](_0xe6e9('0x6')));}},'endtime':{'type':Sequelize[_0xe6e9('0x7')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe6e9('0x8')]},'queue':{'type':Sequelize[_0xe6e9('0x8')]},'uniqueid':{'type':Sequelize[_0xe6e9('0x8')]},'calleridname':{'type':Sequelize[_0xe6e9('0x8')]},'calleridnum':{'type':Sequelize[_0xe6e9('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9f6d400..d61b218 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 _0x8be8=['order','sort','where','pick','VIRTUAL','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x2f1ac4,_0x236a72){var _0x18e1a5=function(_0x18f34b){while(--_0x18f34b){_0x2f1ac4['push'](_0x2f1ac4['shift']());}};_0x18e1a5(++_0x236a72);}(_0x8be8,0x19e));var _0x88be=function(_0x5e373e,_0x4ca21a){_0x5e373e=_0x5e373e-0x0;var _0x36bd2e=_0x8be8[_0x5e373e];return _0x36bd2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88be('0x0'));var zipdir=require(_0x88be('0x1'));var jsonpatch=require(_0x88be('0x2'));var rp=require(_0x88be('0x3'));var moment=require(_0x88be('0x4'));var BPromise=require(_0x88be('0x5'));var Mustache=require('mustache');var util=require(_0x88be('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x88be('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88be('0x8'));var _=require(_0x88be('0x9'));var squel=require('squel');var crypto=require(_0x88be('0xa'));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(_0x88be('0xb'));var authService=require(_0x88be('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x88be('0xd'));var hardwareService=require(_0x88be('0xe'));var logger=require(_0x88be('0xf'))('api');var utils=require(_0x88be('0x10'));var config=require(_0x88be('0x11'));var licenseUtil=require(_0x88be('0x12'));var db=require(_0x88be('0x13'))['db'];function respondWithStatusCode(_0x58b5ac,_0x31e865){_0x31e865=_0x31e865||0xcc;return function(_0x35a3b8){if(_0x35a3b8){return _0x58b5ac[_0x88be('0x14')](_0x31e865);}return _0x58b5ac[_0x88be('0x15')](_0x31e865)[_0x88be('0x16')]();};}function respondWithResult(_0x4bddd4,_0x542a11){_0x542a11=_0x542a11||0xc8;return function(_0x5741df){if(_0x5741df){return _0x4bddd4[_0x88be('0x15')](_0x542a11)[_0x88be('0x17')](_0x5741df);}};}function respondWithFilteredResult(_0x18605c,_0xff5146){return function(_0x245415){if(_0x245415){var _0x1eaf93=typeof _0xff5146[_0x88be('0x18')]==='undefined'&&typeof _0xff5146[_0x88be('0x19')]===_0x88be('0x1a');var _0x1bee91=_0x245415[_0x88be('0x1b')];var _0x480b46=_0x1eaf93?0x0:_0xff5146[_0x88be('0x18')];var _0x3337fa=_0x1eaf93?_0x245415['count']:_0xff5146['offset']+_0xff5146[_0x88be('0x19')];var _0x39677f;if(_0x3337fa>=_0x1bee91){_0x3337fa=_0x1bee91;_0x39677f=0xc8;}else{_0x39677f=0xce;}_0x18605c[_0x88be('0x15')](_0x39677f);return _0x18605c[_0x88be('0x1c')](_0x88be('0x1d'),_0x480b46+'-'+_0x3337fa+'/'+_0x1bee91)['json'](_0x245415);}return null;};}function patchUpdates(_0x1aea34){return function(_0x2b162c){try{jsonpatch[_0x88be('0x1e')](_0x2b162c,_0x1aea34,!![]);}catch(_0x5c7161){return BPromise[_0x88be('0x1f')](_0x5c7161);}return _0x2b162c['save']();};}function saveUpdates(_0x15056e,_0x5d24c2){return function(_0x2b8946){if(_0x2b8946){return _0x2b8946[_0x88be('0x20')](_0x15056e)[_0x88be('0x21')](function(_0x1152bb){return _0x1152bb;});}return null;};}function removeEntity(_0x3c4cc6,_0x3eb9b0){return function(_0x571022){if(_0x571022){return _0x571022[_0x88be('0x22')]()[_0x88be('0x21')](function(){_0x3c4cc6[_0x88be('0x15')](0xcc)[_0x88be('0x16')]();});}};}function handleEntityNotFound(_0x4b0186,_0x3594b3){return function(_0x4ccd0f){if(!_0x4ccd0f){_0x4b0186['sendStatus'](0x194);}return _0x4ccd0f;};}function handleError(_0x32934c,_0x3cdc02){_0x3cdc02=_0x3cdc02||0x1f4;return function(_0xb24a3b){logger[_0x88be('0x23')](_0xb24a3b[_0x88be('0x24')]);if(_0xb24a3b[_0x88be('0x25')]){delete _0xb24a3b[_0x88be('0x25')];}_0x32934c[_0x88be('0x15')](_0x3cdc02)[_0x88be('0x26')](_0xb24a3b);};}exports[_0x88be('0x27')]=function(_0x45898d,_0x162095){var _0x24b6fb={},_0x469199={},_0x3e64ea={'count':0x0,'rows':[]};var _0x86ca26=_[_0x88be('0x28')](db['JscriptySessionReport'][_0x88be('0x29')],function(_0x98c437){return{'name':_0x98c437[_0x88be('0x2a')],'type':_0x98c437[_0x88be('0x2b')]['key']};});_0x469199['model']=_[_0x88be('0x28')](_0x86ca26,'name');_0x469199[_0x88be('0x2c')]=_[_0x88be('0x2d')](_0x45898d[_0x88be('0x2c')]);_0x469199[_0x88be('0x2e')]=_['intersection'](_0x469199[_0x88be('0x2f')],_0x469199[_0x88be('0x2c')]);_0x24b6fb[_0x88be('0x30')]=_[_0x88be('0x31')](_0x469199[_0x88be('0x2f')],qs['fields'](_0x45898d[_0x88be('0x2c')][_0x88be('0x32')]));_0x24b6fb[_0x88be('0x30')]=_0x24b6fb[_0x88be('0x30')][_0x88be('0x33')]?_0x24b6fb[_0x88be('0x30')]:_0x469199[_0x88be('0x2f')];if(!_0x45898d[_0x88be('0x2c')][_0x88be('0x34')](_0x88be('0x35'))){_0x24b6fb[_0x88be('0x19')]=qs[_0x88be('0x19')](_0x45898d['query'][_0x88be('0x19')]);_0x24b6fb[_0x88be('0x18')]=qs[_0x88be('0x18')](_0x45898d[_0x88be('0x2c')][_0x88be('0x18')]);}_0x24b6fb[_0x88be('0x36')]=qs[_0x88be('0x37')](_0x45898d[_0x88be('0x2c')][_0x88be('0x37')]);_0x24b6fb[_0x88be('0x38')]=qs[_0x88be('0x2e')](_[_0x88be('0x39')](_0x45898d[_0x88be('0x2c')],_0x469199[_0x88be('0x2e')]),_0x86ca26);if(_0x45898d['query']['filter']){_0x24b6fb[_0x88be('0x38')]=_['merge'](_0x24b6fb[_0x88be('0x38')],{'$or':_[_0x88be('0x28')](_0x86ca26,function(_0x3901b9){if(_0x3901b9[_0x88be('0x2b')]!==_0x88be('0x3a')){var _0x38ebb1={};_0x38ebb1[_0x3901b9[_0x88be('0x25')]]={'$like':'%'+_0x45898d[_0x88be('0x2c')][_0x88be('0x3b')]+'%'};return _0x38ebb1;}})});}_0x24b6fb=_[_0x88be('0x3c')]({},_0x24b6fb,_0x45898d[_0x88be('0x3d')]);var _0x33d595={'where':_0x24b6fb[_0x88be('0x38')]};return db[_0x88be('0x3e')]['count'](_0x33d595)[_0x88be('0x21')](function(_0x56dca3){_0x3e64ea['count']=_0x56dca3;if(_0x45898d['query'][_0x88be('0x3f')]){_0x24b6fb[_0x88be('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x88be('0x41')](_0x24b6fb);})['then'](function(_0x52dfda){_0x3e64ea[_0x88be('0x42')]=_0x52dfda;return _0x3e64ea;})[_0x88be('0x21')](respondWithFilteredResult(_0x162095,_0x24b6fb))[_0x88be('0x43')](handleError(_0x162095,null));};exports[_0x88be('0x44')]=function(_0x5c511e,_0x21fca7){var _0x4bb367={'raw':!![],'where':{'id':_0x5c511e['params']['id']}},_0x34cb70={};_0x34cb70['model']=_[_0x88be('0x2d')](db[_0x88be('0x3e')]['rawAttributes']);_0x34cb70[_0x88be('0x2c')]=_[_0x88be('0x2d')](_0x5c511e[_0x88be('0x2c')]);_0x34cb70['filters']=_[_0x88be('0x31')](_0x34cb70[_0x88be('0x2f')],_0x34cb70[_0x88be('0x2c')]);_0x4bb367['attributes']=_[_0x88be('0x31')](_0x34cb70[_0x88be('0x2f')],qs[_0x88be('0x32')](_0x5c511e['query'][_0x88be('0x32')]));_0x4bb367[_0x88be('0x30')]=_0x4bb367[_0x88be('0x30')][_0x88be('0x33')]?_0x4bb367['attributes']:_0x34cb70[_0x88be('0x2f')];if(_0x5c511e[_0x88be('0x2c')][_0x88be('0x3f')]){_0x4bb367[_0x88be('0x40')]=[{'all':!![]}];}_0x4bb367=_['merge']({},_0x4bb367,_0x5c511e['options']);return db[_0x88be('0x3e')][_0x88be('0x45')](_0x4bb367)[_0x88be('0x21')](handleEntityNotFound(_0x21fca7,null))[_0x88be('0x21')](respondWithResult(_0x21fca7,null))[_0x88be('0x43')](handleError(_0x21fca7,null));};exports[_0x88be('0x46')]=function(_0x44091e,_0x1b17bd){return db[_0x88be('0x3e')][_0x88be('0x46')](_0x44091e['body'],{})[_0x88be('0x21')](respondWithResult(_0x1b17bd,0xc9))[_0x88be('0x43')](handleError(_0x1b17bd,null));};exports['update']=function(_0x57a282,_0x385bed){if(_0x57a282['body']['id']){delete _0x57a282[_0x88be('0x47')]['id'];}return db[_0x88be('0x3e')][_0x88be('0x45')]({'where':{'id':_0x57a282[_0x88be('0x48')]['id']}})['then'](handleEntityNotFound(_0x385bed,null))[_0x88be('0x21')](saveUpdates(_0x57a282[_0x88be('0x47')],null))[_0x88be('0x21')](respondWithResult(_0x385bed,null))[_0x88be('0x43')](handleError(_0x385bed,null));};exports[_0x88be('0x22')]=function(_0x22fb40,_0x3e0347){return db['JscriptySessionReport'][_0x88be('0x45')]({'where':{'id':_0x22fb40[_0x88be('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e0347,null))[_0x88be('0x21')](removeEntity(_0x3e0347,null))['catch'](handleError(_0x3e0347,null));};exports[_0x88be('0x49')]=function(_0xf0725f,_0x4e2b5f){return db[_0x88be('0x3e')][_0x88be('0x49')]()[_0x88be('0x21')](respondWithResult(_0x4e2b5f,null))[_0x88be('0x43')](handleError(_0x4e2b5f,null));};exports[_0x88be('0x4a')]=function(_0x36724b,_0x2124b4,_0x9d15b2){var _0x38df00={'raw':!![],'where':{}};var _0x2477b6={};var _0x4e5d9a={'count':0x0,'rows':[]};return db[_0x88be('0x3e')][_0x88be('0x4b')]({'where':{'id':_0x36724b[_0x88be('0x48')]['id']}})['then'](handleEntityNotFound(_0x2124b4,null))[_0x88be('0x21')](function(_0x377341){if(_0x377341){_0x2477b6[_0x88be('0x2f')]=_['keys'](db[_0x88be('0x4c')]['rawAttributes']);_0x2477b6['query']=_[_0x88be('0x2d')](_0x36724b[_0x88be('0x2c')]);_0x2477b6[_0x88be('0x2e')]=_[_0x88be('0x31')](_0x2477b6[_0x88be('0x2f')],_0x2477b6['query']);_0x38df00[_0x88be('0x30')]=_['intersection'](_0x2477b6[_0x88be('0x2f')],qs[_0x88be('0x32')](_0x36724b[_0x88be('0x2c')][_0x88be('0x32')]));_0x38df00['attributes']=_0x38df00[_0x88be('0x30')][_0x88be('0x33')]?_0x38df00[_0x88be('0x30')]:_0x2477b6[_0x88be('0x2f')];if(!_0x36724b[_0x88be('0x2c')][_0x88be('0x34')](_0x88be('0x35'))){_0x38df00[_0x88be('0x19')]=qs['limit'](_0x36724b[_0x88be('0x2c')][_0x88be('0x19')]);_0x38df00['offset']=qs[_0x88be('0x18')](_0x36724b[_0x88be('0x2c')]['offset']);}_0x38df00[_0x88be('0x36')]=qs[_0x88be('0x37')](_0x36724b[_0x88be('0x2c')][_0x88be('0x37')]);_0x38df00[_0x88be('0x38')]=qs[_0x88be('0x2e')](_['pick'](_0x36724b[_0x88be('0x2c')],_0x2477b6[_0x88be('0x2e')]));_0x38df00[_0x88be('0x38')][_0x88be('0x4d')]=_0x377341['id'];if(_0x36724b[_0x88be('0x2c')][_0x88be('0x3b')]){_0x38df00[_0x88be('0x38')]=_[_0x88be('0x3c')](_0x38df00[_0x88be('0x38')],{'$or':_[_0x88be('0x28')](_0x38df00[_0x88be('0x30')],function(_0xe91c31){var _0x3ad1c3={};_0x3ad1c3[_0xe91c31]={'$like':'%'+_0x36724b['query'][_0x88be('0x3b')]+'%'};return _0x3ad1c3;})});}_0x38df00=_['merge']({},_0x38df00,_0x36724b[_0x88be('0x3d')]);return db['JscriptyQuestionReport'][_0x88be('0x1b')]({'where':_0x38df00[_0x88be('0x38')]})[_0x88be('0x21')](function(_0x26e85d){_0x4e5d9a[_0x88be('0x1b')]=_0x26e85d;if(_0x36724b[_0x88be('0x2c')]['includeAll']){_0x38df00[_0x88be('0x40')]=[{'all':!![]}];}return db[_0x88be('0x4c')][_0x88be('0x41')](_0x38df00);})[_0x88be('0x21')](function(_0x4099ad){_0x4e5d9a['rows']=_0x4099ad;return _0x4e5d9a;});}})[_0x88be('0x21')](respondWithFilteredResult(_0x2124b4,_0x38df00))['catch'](handleError(_0x2124b4,null));}; \ No newline at end of file +var _0x4727=['options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','filter','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x16dc38,_0xfbd25){var _0x4439ca=function(_0x512112){while(--_0x512112){_0x16dc38['push'](_0x16dc38['shift']());}};_0x4439ca(++_0xfbd25);}(_0x4727,0x14d));var _0x7472=function(_0x1b331e,_0x41361f){_0x1b331e=_0x1b331e-0x0;var _0x34933f=_0x4727[_0x1b331e];return _0x34933f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7472('0x0'));var jsonpatch=require(_0x7472('0x1'));var rp=require('request-promise');var moment=require(_0x7472('0x2'));var BPromise=require(_0x7472('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7472('0x4'));var sox=require('sox');var csv=require(_0x7472('0x5'));var ejs=require(_0x7472('0x6'));var fs=require('fs');var fs_extra=require(_0x7472('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7472('0x8'));var jsforce=require(_0x7472('0x9'));var deskjs=require(_0x7472('0xa'));var toCsv=require(_0x7472('0x5'));var querystring=require(_0x7472('0xb'));var Papa=require(_0x7472('0xc'));var Redis=require(_0x7472('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7472('0xe'));var hardwareService=require(_0x7472('0xf'));var logger=require(_0x7472('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x7472('0x11'));var licenseUtil=require(_0x7472('0x12'));var db=require(_0x7472('0x13'))['db'];function respondWithStatusCode(_0x42120f,_0x403932){_0x403932=_0x403932||0xcc;return function(_0xfb6ef7){if(_0xfb6ef7){return _0x42120f[_0x7472('0x14')](_0x403932);}return _0x42120f[_0x7472('0x15')](_0x403932)[_0x7472('0x16')]();};}function respondWithResult(_0x200566,_0x2d3906){_0x2d3906=_0x2d3906||0xc8;return function(_0xa0453a){if(_0xa0453a){return _0x200566[_0x7472('0x15')](_0x2d3906)['json'](_0xa0453a);}};}function respondWithFilteredResult(_0x363905,_0x34095b){return function(_0x17050e){if(_0x17050e){var _0x25fd24=typeof _0x34095b['offset']===_0x7472('0x17')&&typeof _0x34095b[_0x7472('0x18')]===_0x7472('0x17');var _0x2f6df0=_0x17050e['count'];var _0x12755d=_0x25fd24?0x0:_0x34095b[_0x7472('0x19')];var _0x4c59cb=_0x25fd24?_0x17050e[_0x7472('0x1a')]:_0x34095b[_0x7472('0x19')]+_0x34095b['limit'];var _0xaa0477;if(_0x4c59cb>=_0x2f6df0){_0x4c59cb=_0x2f6df0;_0xaa0477=0xc8;}else{_0xaa0477=0xce;}_0x363905[_0x7472('0x15')](_0xaa0477);return _0x363905[_0x7472('0x1b')](_0x7472('0x1c'),_0x12755d+'-'+_0x4c59cb+'/'+_0x2f6df0)[_0x7472('0x1d')](_0x17050e);}return null;};}function patchUpdates(_0x18b872){return function(_0xafb2fc){try{jsonpatch[_0x7472('0x1e')](_0xafb2fc,_0x18b872,!![]);}catch(_0x5d7556){return BPromise[_0x7472('0x1f')](_0x5d7556);}return _0xafb2fc[_0x7472('0x20')]();};}function saveUpdates(_0x447f40,_0x44f6ae){return function(_0x3f7720){if(_0x3f7720){return _0x3f7720[_0x7472('0x21')](_0x447f40)[_0x7472('0x22')](function(_0x1d2b67){return _0x1d2b67;});}return null;};}function removeEntity(_0x2144e9,_0x1b02b5){return function(_0x3a8b25){if(_0x3a8b25){return _0x3a8b25[_0x7472('0x23')]()[_0x7472('0x22')](function(){_0x2144e9[_0x7472('0x15')](0xcc)[_0x7472('0x16')]();});}};}function handleEntityNotFound(_0x32bab6,_0x1735df){return function(_0x145952){if(!_0x145952){_0x32bab6[_0x7472('0x14')](0x194);}return _0x145952;};}function handleError(_0x2d852c,_0x1a2fdc){_0x1a2fdc=_0x1a2fdc||0x1f4;return function(_0x3332c1){logger[_0x7472('0x24')](_0x3332c1[_0x7472('0x25')]);if(_0x3332c1[_0x7472('0x26')]){delete _0x3332c1[_0x7472('0x26')];}_0x2d852c[_0x7472('0x15')](_0x1a2fdc)[_0x7472('0x27')](_0x3332c1);};}exports[_0x7472('0x28')]=function(_0x51a9f8,_0x1f3f7b){var _0x1f2055={},_0x2624ab={},_0x4e53a3={'count':0x0,'rows':[]};var _0x27f1e7=_[_0x7472('0x29')](db[_0x7472('0x2a')][_0x7472('0x2b')],function(_0x255b9){return{'name':_0x255b9[_0x7472('0x2c')],'type':_0x255b9[_0x7472('0x2d')][_0x7472('0x2e')]};});_0x2624ab['model']=_[_0x7472('0x29')](_0x27f1e7,_0x7472('0x26'));_0x2624ab[_0x7472('0x2f')]=_[_0x7472('0x30')](_0x51a9f8[_0x7472('0x2f')]);_0x2624ab[_0x7472('0x31')]=_[_0x7472('0x32')](_0x2624ab[_0x7472('0x33')],_0x2624ab[_0x7472('0x2f')]);_0x1f2055['attributes']=_[_0x7472('0x32')](_0x2624ab[_0x7472('0x33')],qs['fields'](_0x51a9f8[_0x7472('0x2f')][_0x7472('0x34')]));_0x1f2055['attributes']=_0x1f2055['attributes'][_0x7472('0x35')]?_0x1f2055[_0x7472('0x36')]:_0x2624ab[_0x7472('0x33')];if(!_0x51a9f8[_0x7472('0x2f')][_0x7472('0x37')](_0x7472('0x38'))){_0x1f2055['limit']=qs[_0x7472('0x18')](_0x51a9f8[_0x7472('0x2f')][_0x7472('0x18')]);_0x1f2055[_0x7472('0x19')]=qs[_0x7472('0x19')](_0x51a9f8['query'][_0x7472('0x19')]);}_0x1f2055[_0x7472('0x39')]=qs[_0x7472('0x3a')](_0x51a9f8['query'][_0x7472('0x3a')]);_0x1f2055[_0x7472('0x3b')]=qs[_0x7472('0x31')](_[_0x7472('0x3c')](_0x51a9f8[_0x7472('0x2f')],_0x2624ab[_0x7472('0x31')]),_0x27f1e7);if(_0x51a9f8[_0x7472('0x2f')]['filter']){_0x1f2055[_0x7472('0x3b')]=_['merge'](_0x1f2055[_0x7472('0x3b')],{'$or':_[_0x7472('0x29')](_0x27f1e7,function(_0x48afe9){if(_0x48afe9['type']!==_0x7472('0x3d')){var _0x3ca63d={};_0x3ca63d[_0x48afe9[_0x7472('0x26')]]={'$like':'%'+_0x51a9f8['query']['filter']+'%'};return _0x3ca63d;}})});}_0x1f2055=_['merge']({},_0x1f2055,_0x51a9f8[_0x7472('0x3e')]);var _0x2d65a5={'where':_0x1f2055[_0x7472('0x3b')]};return db['JscriptySessionReport'][_0x7472('0x1a')](_0x2d65a5)[_0x7472('0x22')](function(_0x1516eb){_0x4e53a3[_0x7472('0x1a')]=_0x1516eb;if(_0x51a9f8[_0x7472('0x2f')][_0x7472('0x3f')]){_0x1f2055[_0x7472('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7472('0x41')](_0x1f2055);})[_0x7472('0x22')](function(_0x512aba){_0x4e53a3[_0x7472('0x42')]=_0x512aba;return _0x4e53a3;})[_0x7472('0x22')](respondWithFilteredResult(_0x1f3f7b,_0x1f2055))[_0x7472('0x43')](handleError(_0x1f3f7b,null));};exports['show']=function(_0x51330c,_0x610d0b){var _0x410563={'raw':!![],'where':{'id':_0x51330c[_0x7472('0x44')]['id']}},_0x518084={};_0x518084[_0x7472('0x33')]=_['keys'](db[_0x7472('0x2a')]['rawAttributes']);_0x518084['query']=_['keys'](_0x51330c['query']);_0x518084['filters']=_[_0x7472('0x32')](_0x518084[_0x7472('0x33')],_0x518084[_0x7472('0x2f')]);_0x410563['attributes']=_[_0x7472('0x32')](_0x518084[_0x7472('0x33')],qs[_0x7472('0x34')](_0x51330c[_0x7472('0x2f')]['fields']));_0x410563['attributes']=_0x410563[_0x7472('0x36')][_0x7472('0x35')]?_0x410563[_0x7472('0x36')]:_0x518084[_0x7472('0x33')];if(_0x51330c[_0x7472('0x2f')][_0x7472('0x3f')]){_0x410563[_0x7472('0x40')]=[{'all':!![]}];}_0x410563=_[_0x7472('0x45')]({},_0x410563,_0x51330c[_0x7472('0x3e')]);return db[_0x7472('0x2a')][_0x7472('0x46')](_0x410563)[_0x7472('0x22')](handleEntityNotFound(_0x610d0b,null))[_0x7472('0x22')](respondWithResult(_0x610d0b,null))['catch'](handleError(_0x610d0b,null));};exports[_0x7472('0x47')]=function(_0x273848,_0x4a84ec){return db[_0x7472('0x2a')][_0x7472('0x47')](_0x273848[_0x7472('0x48')],{})[_0x7472('0x22')](respondWithResult(_0x4a84ec,0xc9))[_0x7472('0x43')](handleError(_0x4a84ec,null));};exports[_0x7472('0x21')]=function(_0x3c0715,_0x39808c){if(_0x3c0715['body']['id']){delete _0x3c0715[_0x7472('0x48')]['id'];}return db[_0x7472('0x2a')][_0x7472('0x46')]({'where':{'id':_0x3c0715[_0x7472('0x44')]['id']}})[_0x7472('0x22')](handleEntityNotFound(_0x39808c,null))[_0x7472('0x22')](saveUpdates(_0x3c0715[_0x7472('0x48')],null))[_0x7472('0x22')](respondWithResult(_0x39808c,null))[_0x7472('0x43')](handleError(_0x39808c,null));};exports[_0x7472('0x23')]=function(_0x15741b,_0x5d5c9d){return db['JscriptySessionReport'][_0x7472('0x46')]({'where':{'id':_0x15741b['params']['id']}})['then'](handleEntityNotFound(_0x5d5c9d,null))[_0x7472('0x22')](removeEntity(_0x5d5c9d,null))['catch'](handleError(_0x5d5c9d,null));};exports[_0x7472('0x49')]=function(_0x116230,_0x5c0c6e){return db[_0x7472('0x2a')][_0x7472('0x49')]()[_0x7472('0x22')](respondWithResult(_0x5c0c6e,null))[_0x7472('0x43')](handleError(_0x5c0c6e,null));};exports[_0x7472('0x4a')]=function(_0x9d1230,_0x5c9682,_0x5391e3){var _0x4d5a15={'raw':!![],'where':{}};var _0x4708ca={};var _0x52f04c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x7472('0x4b')]({'where':{'id':_0x9d1230[_0x7472('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c9682,null))['then'](function(_0x49efc6){if(_0x49efc6){_0x4708ca[_0x7472('0x33')]=_['keys'](db[_0x7472('0x4c')][_0x7472('0x2b')]);_0x4708ca[_0x7472('0x2f')]=_[_0x7472('0x30')](_0x9d1230[_0x7472('0x2f')]);_0x4708ca[_0x7472('0x31')]=_[_0x7472('0x32')](_0x4708ca[_0x7472('0x33')],_0x4708ca[_0x7472('0x2f')]);_0x4d5a15['attributes']=_['intersection'](_0x4708ca[_0x7472('0x33')],qs[_0x7472('0x34')](_0x9d1230[_0x7472('0x2f')][_0x7472('0x34')]));_0x4d5a15[_0x7472('0x36')]=_0x4d5a15['attributes'][_0x7472('0x35')]?_0x4d5a15['attributes']:_0x4708ca[_0x7472('0x33')];if(!_0x9d1230[_0x7472('0x2f')][_0x7472('0x37')]('nolimit')){_0x4d5a15[_0x7472('0x18')]=qs[_0x7472('0x18')](_0x9d1230[_0x7472('0x2f')][_0x7472('0x18')]);_0x4d5a15[_0x7472('0x19')]=qs['offset'](_0x9d1230[_0x7472('0x2f')][_0x7472('0x19')]);}_0x4d5a15['order']=qs[_0x7472('0x3a')](_0x9d1230[_0x7472('0x2f')][_0x7472('0x3a')]);_0x4d5a15[_0x7472('0x3b')]=qs[_0x7472('0x31')](_[_0x7472('0x3c')](_0x9d1230[_0x7472('0x2f')],_0x4708ca[_0x7472('0x31')]));_0x4d5a15[_0x7472('0x3b')][_0x7472('0x4d')]=_0x49efc6['id'];if(_0x9d1230[_0x7472('0x2f')][_0x7472('0x4e')]){_0x4d5a15['where']=_[_0x7472('0x45')](_0x4d5a15[_0x7472('0x3b')],{'$or':_['map'](_0x4d5a15['attributes'],function(_0x42c038){var _0xdec58d={};_0xdec58d[_0x42c038]={'$like':'%'+_0x9d1230[_0x7472('0x2f')][_0x7472('0x4e')]+'%'};return _0xdec58d;})});}_0x4d5a15=_[_0x7472('0x45')]({},_0x4d5a15,_0x9d1230[_0x7472('0x3e')]);return db[_0x7472('0x4c')][_0x7472('0x1a')]({'where':_0x4d5a15[_0x7472('0x3b')]})['then'](function(_0x931202){_0x52f04c[_0x7472('0x1a')]=_0x931202;if(_0x9d1230[_0x7472('0x2f')]['includeAll']){_0x4d5a15['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7472('0x41')](_0x4d5a15);})[_0x7472('0x22')](function(_0x43e9f0){_0x52f04c['rows']=_0x43e9f0;return _0x52f04c;});}})['then'](respondWithFilteredResult(_0x5c9682,_0x4d5a15))[_0x7472('0x43')](handleError(_0x5c9682,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 92a0029..213f854 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 _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x2df1b7,_0x217081){var _0x55ccec=function(_0x3112af){while(--_0x3112af){_0x2df1b7['push'](_0x2df1b7['shift']());}};_0x55ccec(++_0x217081);}(_0xb138,0x1dd));var _0x8b13=function(_0x417485,_0xdfeb87){_0x417485=_0x417485-0x0;var _0x528683=_0xb138[_0x417485];return _0x528683;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e24=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash'];(function(_0x26b047,_0x3988e0){var _0x2826b8=function(_0x4637a9){while(--_0x4637a9){_0x26b047['push'](_0x26b047['shift']());}};_0x2826b8(++_0x3988e0);}(_0x3e24,0x167));var _0x43e2=function(_0x22490e,_0x4935bd){_0x22490e=_0x22490e-0x0;var _0x5b6459=_0x3e24[_0x22490e];return _0x5b6459;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var logger=require(_0x43e2('0x2'))(_0x43e2('0x3'));var moment=require(_0x43e2('0x4'));var BPromise=require('bluebird');var rp=require(_0x43e2('0x5'));var fs=require('fs');var path=require(_0x43e2('0x6'));var rimraf=require('rimraf');var config=require(_0x43e2('0x7'));var attributes=require(_0x43e2('0x8'));module[_0x43e2('0x9')]=function(_0x28b144,_0x43b5a7){return _0x28b144[_0x43e2('0xa')](_0x43e2('0xb'),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 0640452..ec19911 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4ddfd0,_0x869bb){var _0x48f688=function(_0x2cfc83){while(--_0x2cfc83){_0x4ddfd0['push'](_0x4ddfd0['shift']());}};_0x48f688(++_0x869bb);}(_0x5496,0x175));var _0x6549=function(_0x3d05a3,_0x35eb99){_0x3d05a3=_0x3d05a3-0x0;var _0x3da330=_0x5496[_0x3d05a3];return _0x3da330;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0x7bd0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','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','info','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x7bd0[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8d6379b..e9b1a31 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 _0x308d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x308d,0x142));var _0xd308=function(_0x1a9d7e,_0x4a0199){_0x1a9d7e=_0x1a9d7e-0x0;var _0x1137fd=_0x308d[_0x1a9d7e];return _0x1137fd;};'use strict';var multer=require(_0xd308('0x0'));var util=require(_0xd308('0x1'));var path=require(_0xd308('0x2'));var timeout=require(_0xd308('0x3'));var express=require(_0xd308('0x4'));var router=express[_0xd308('0x5')]();var fs_extra=require(_0xd308('0x6'));var auth=require(_0xd308('0x7'));var interaction=require(_0xd308('0x8'));var config=require('../../config/environment');var controller=require(_0xd308('0x9'));router[_0xd308('0xa')]('/',controller[_0xd308('0xb')]);router[_0xd308('0xc')](_0xd308('0xd'),auth[_0xd308('0xe')](),controller[_0xd308('0xf')]);router['get'](_0xd308('0x10'),auth['isAuthenticated'](),controller[_0xd308('0x11')]);module[_0xd308('0x12')]=router; \ No newline at end of file +var _0x7791=['isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x196e87,_0x4ada5c){var _0x4f55e4=function(_0x218a2f){while(--_0x218a2f){_0x196e87['push'](_0x196e87['shift']());}};_0x4f55e4(++_0x4ada5c);}(_0x7791,0x7c));var _0x1779=function(_0x4c4b99,_0x3a290f){_0x4c4b99=_0x4c4b99-0x0;var _0x150415=_0x7791[_0x4c4b99];return _0x150415;};'use strict';var multer=require('multer');var util=require(_0x1779('0x0'));var path=require(_0x1779('0x1'));var timeout=require(_0x1779('0x2'));var express=require(_0x1779('0x3'));var router=express['Router']();var fs_extra=require(_0x1779('0x4'));var auth=require(_0x1779('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1779('0x6'));var controller=require(_0x1779('0x7'));router[_0x1779('0x8')]('/',controller[_0x1779('0x9')]);router[_0x1779('0xa')](_0x1779('0xb'),auth[_0x1779('0xc')](),controller[_0x1779('0xd')]);router[_0x1779('0x8')](_0x1779('0xe'),auth[_0x1779('0xc')](),controller[_0x1779('0xf')]);module[_0x1779('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 efd6de7..6afe894 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 _0x275a=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x275a,0x1a1));var _0xa275=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x275a[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0xa275('0x0'));module[_0xa275('0x1')]={'license':{'type':Sequelize[_0xa275('0x2')]},'data1':{'type':Sequelize[_0xa275('0x3')]},'data2':{'type':Sequelize[_0xa275('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa275('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd062=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x3af021,_0x5462b5){var _0xc43328=function(_0xc1eaa7){while(--_0xc1eaa7){_0x3af021['push'](_0x3af021['shift']());}};_0xc43328(++_0x5462b5);}(_0xd062,0x157));var _0x2d06=function(_0x3c8ab7,_0x403af6){_0x3c8ab7=_0x3c8ab7-0x0;var _0x16f8cb=_0xd062[_0x3c8ab7];return _0x16f8cb;};'use strict';var Sequelize=require(_0x2d06('0x0'));module[_0x2d06('0x1')]={'license':{'type':Sequelize[_0x2d06('0x2')]},'data1':{'type':Sequelize[_0x2d06('0x3')]},'data2':{'type':Sequelize[_0x2d06('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x2d06('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 061eeed..faf8d5c 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 _0xe2d6=['fields','attributes','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','model','keys','rawAttributes','query','filters','intersection'];(function(_0x471b25,_0x301222){var _0x3cf32c=function(_0x2baec6){while(--_0x2baec6){_0x471b25['push'](_0x471b25['shift']());}};_0x3cf32c(++_0x301222);}(_0xe2d6,0xaa));var _0x6e2d=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xe2d6[_0x5a7112];return _0x3147f7;};'use strict';var emlformat=require(_0x6e2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e2d('0x1'));var jsonpatch=require(_0x6e2d('0x2'));var rp=require(_0x6e2d('0x3'));var moment=require(_0x6e2d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e2d('0x5'));var util=require('util');var path=require(_0x6e2d('0x6'));var sox=require(_0x6e2d('0x7'));var csv=require(_0x6e2d('0x8'));var ejs=require(_0x6e2d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e2d('0xa'));var squel=require(_0x6e2d('0xb'));var crypto=require(_0x6e2d('0xc'));var jsforce=require(_0x6e2d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e2d('0x8'));var querystring=require(_0x6e2d('0xe'));var Papa=require('papaparse');var Redis=require(_0x6e2d('0xf'));var authService=require(_0x6e2d('0x10'));var qs=require(_0x6e2d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e2d('0x12'));var logger=require(_0x6e2d('0x13'))('api');var utils=require(_0x6e2d('0x14'));var config=require(_0x6e2d('0x15'));var licenseUtil=require(_0x6e2d('0x16'));var db=require(_0x6e2d('0x17'))['db'];function respondWithStatusCode(_0x575378,_0x1921e4){_0x1921e4=_0x1921e4||0xcc;return function(_0x51b247){if(_0x51b247){return _0x575378['sendStatus'](_0x1921e4);}return _0x575378[_0x6e2d('0x18')](_0x1921e4)[_0x6e2d('0x19')]();};}function respondWithResult(_0x278dc1,_0x5724e5){_0x5724e5=_0x5724e5||0xc8;return function(_0x28c3e1){if(_0x28c3e1){return _0x278dc1[_0x6e2d('0x18')](_0x5724e5)[_0x6e2d('0x1a')](_0x28c3e1);}};}function respondWithFilteredResult(_0x552c6c,_0x2486b1){return function(_0x7468bc){if(_0x7468bc){var _0x43973a=typeof _0x2486b1[_0x6e2d('0x1b')]===_0x6e2d('0x1c')&&typeof _0x2486b1[_0x6e2d('0x1d')]===_0x6e2d('0x1c');var _0x135ea2=_0x7468bc[_0x6e2d('0x1e')];var _0x3ee2e3=_0x43973a?0x0:_0x2486b1[_0x6e2d('0x1b')];var _0x452cb0=_0x43973a?_0x7468bc['count']:_0x2486b1[_0x6e2d('0x1b')]+_0x2486b1['limit'];var _0x24986b;if(_0x452cb0>=_0x135ea2){_0x452cb0=_0x135ea2;_0x24986b=0xc8;}else{_0x24986b=0xce;}_0x552c6c[_0x6e2d('0x18')](_0x24986b);return _0x552c6c[_0x6e2d('0x1f')](_0x6e2d('0x20'),_0x3ee2e3+'-'+_0x452cb0+'/'+_0x135ea2)[_0x6e2d('0x1a')](_0x7468bc);}return null;};}function patchUpdates(_0x4238d3){return function(_0x522f2d){try{jsonpatch[_0x6e2d('0x21')](_0x522f2d,_0x4238d3,!![]);}catch(_0x400a19){return BPromise[_0x6e2d('0x22')](_0x400a19);}return _0x522f2d[_0x6e2d('0x23')]();};}function saveUpdates(_0x1109c9,_0x4dba73){return function(_0x37eaaf){if(_0x37eaaf){return _0x37eaaf[_0x6e2d('0x24')](_0x1109c9)[_0x6e2d('0x25')](function(_0x350bbc){return _0x350bbc;});}return null;};}function removeEntity(_0xa70875,_0x163d0c){return function(_0x4277aa){if(_0x4277aa){return _0x4277aa[_0x6e2d('0x26')]()[_0x6e2d('0x25')](function(){_0xa70875[_0x6e2d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x935452,_0x2f22eb){return function(_0x2caddd){if(!_0x2caddd){_0x935452[_0x6e2d('0x27')](0x194);}return _0x2caddd;};}function handleError(_0x358a72,_0xf722a2){_0xf722a2=_0xf722a2||0x1f4;return function(_0x52c738){logger['error'](_0x52c738['stack']);if(_0x52c738[_0x6e2d('0x28')]){delete _0x52c738[_0x6e2d('0x28')];}_0x358a72['status'](_0xf722a2)[_0x6e2d('0x29')](_0x52c738);};}var utilLicense=require(_0x6e2d('0x16'));exports[_0x6e2d('0x2a')]=function(_0x57a0d5,_0x19f161){var _0x940b7f={'raw':!![],'where':{'id':0x1}},_0x2c4c16={};_0x2c4c16[_0x6e2d('0x2b')]=_[_0x6e2d('0x2c')](db['License'][_0x6e2d('0x2d')]);_0x2c4c16[_0x6e2d('0x2e')]=_[_0x6e2d('0x2c')](_0x57a0d5[_0x6e2d('0x2e')]);_0x2c4c16[_0x6e2d('0x2f')]=_[_0x6e2d('0x30')](_0x2c4c16[_0x6e2d('0x2b')],_0x2c4c16[_0x6e2d('0x2e')]);_0x940b7f['attributes']=_['intersection'](_0x2c4c16[_0x6e2d('0x2b')],qs[_0x6e2d('0x31')](_0x57a0d5[_0x6e2d('0x2e')][_0x6e2d('0x31')]));_0x940b7f[_0x6e2d('0x32')]=_0x940b7f[_0x6e2d('0x32')]['length']?_0x940b7f[_0x6e2d('0x32')]:_0x2c4c16['model'];_0x940b7f=_[_0x6e2d('0x33')]({},_0x940b7f,_0x57a0d5[_0x6e2d('0x34')]);return utilLicense[_0x6e2d('0x35')](_0x940b7f)['then'](respondWithResult(_0x19f161,null))[_0x6e2d('0x36')](handleError(_0x19f161,null));};exports[_0x6e2d('0x24')]=function(_0x123535,_0x5ca815){if(_0x123535[_0x6e2d('0x37')]['id']){delete _0x123535[_0x6e2d('0x37')]['id'];}return db[_0x6e2d('0x38')][_0x6e2d('0x39')]({'where':{'id':_0x123535[_0x6e2d('0x3a')]['id']}})[_0x6e2d('0x25')](handleEntityNotFound(_0x5ca815,null))[_0x6e2d('0x25')](function(_0x3dc1a9){var _0xa17bec=_0x3dc1a9[_0x6e2d('0x3b')]({'plain':!![]});return utilLicense[_0x6e2d('0x3c')](_0xa17bec,_0x123535[_0x6e2d('0x37')][_0x6e2d('0x3d')]);})[_0x6e2d('0x25')](function(_0x2b7350){if(!_0x2b7350[_0x6e2d('0x3e')]){return saveUpdates(_0x123535[_0x6e2d('0x37')],null);}return _0x2b7350;})[_0x6e2d('0x25')](respondWithResult(_0x5ca815,null))[_0x6e2d('0x36')](handleError(_0x5ca815,null));};exports['downloadLogFile']=function(_0x149901,_0xe6e9e5){var _0x1b25d4=_0x6e2d('0x3f');var _0x27d5a6=path['join'](_0x6e2d('0x40'),_0x6e2d('0x41'),_0x6e2d('0x42'),_0x1b25d4);_0xe6e9e5[_0x6e2d('0x43')](_0x6e2d('0x44'),_0x6e2d('0x45')+_0x1b25d4);_0xe6e9e5[_0x6e2d('0x1f')](_0x6e2d('0x46'),_0x6e2d('0x47'));_0xe6e9e5[_0x6e2d('0x48')](_0x27d5a6);}; \ No newline at end of file +var _0x05d7=['length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','index','model','License','rawAttributes','query','filters','intersection','fields','attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x05d7,0x1ac));var _0x705d=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x05d7[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x705d('0x0'));var rimraf=require(_0x705d('0x1'));var zipdir=require(_0x705d('0x2'));var jsonpatch=require(_0x705d('0x3'));var rp=require('request-promise');var moment=require(_0x705d('0x4'));var BPromise=require(_0x705d('0x5'));var Mustache=require(_0x705d('0x6'));var util=require(_0x705d('0x7'));var path=require('path');var sox=require(_0x705d('0x8'));var csv=require(_0x705d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x705d('0xa'));var _=require(_0x705d('0xb'));var squel=require('squel');var crypto=require(_0x705d('0xc'));var jsforce=require(_0x705d('0xd'));var deskjs=require(_0x705d('0xe'));var toCsv=require(_0x705d('0x9'));var querystring=require(_0x705d('0xf'));var Papa=require('papaparse');var Redis=require(_0x705d('0x10'));var authService=require(_0x705d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x705d('0x12'));var logger=require(_0x705d('0x13'))(_0x705d('0x14'));var utils=require('../../config/utils');var config=require(_0x705d('0x15'));var licenseUtil=require(_0x705d('0x16'));var db=require(_0x705d('0x17'))['db'];function respondWithStatusCode(_0x2ac260,_0x2cde09){_0x2cde09=_0x2cde09||0xcc;return function(_0x4897df){if(_0x4897df){return _0x2ac260[_0x705d('0x18')](_0x2cde09);}return _0x2ac260[_0x705d('0x19')](_0x2cde09)[_0x705d('0x1a')]();};}function respondWithResult(_0x25c9b5,_0x5b9146){_0x5b9146=_0x5b9146||0xc8;return function(_0x3ff753){if(_0x3ff753){return _0x25c9b5[_0x705d('0x19')](_0x5b9146)['json'](_0x3ff753);}};}function respondWithFilteredResult(_0x3b331e,_0x55e273){return function(_0x468a0f){if(_0x468a0f){var _0x59c578=typeof _0x55e273[_0x705d('0x1b')]==='undefined'&&typeof _0x55e273[_0x705d('0x1c')]===_0x705d('0x1d');var _0x25ae1a=_0x468a0f[_0x705d('0x1e')];var _0x3394fb=_0x59c578?0x0:_0x55e273['offset'];var _0x52e394=_0x59c578?_0x468a0f[_0x705d('0x1e')]:_0x55e273[_0x705d('0x1b')]+_0x55e273[_0x705d('0x1c')];var _0x547b1d;if(_0x52e394>=_0x25ae1a){_0x52e394=_0x25ae1a;_0x547b1d=0xc8;}else{_0x547b1d=0xce;}_0x3b331e[_0x705d('0x19')](_0x547b1d);return _0x3b331e[_0x705d('0x1f')](_0x705d('0x20'),_0x3394fb+'-'+_0x52e394+'/'+_0x25ae1a)[_0x705d('0x21')](_0x468a0f);}return null;};}function patchUpdates(_0x46adae){return function(_0x277f68){try{jsonpatch['apply'](_0x277f68,_0x46adae,!![]);}catch(_0x540cf9){return BPromise['reject'](_0x540cf9);}return _0x277f68['save']();};}function saveUpdates(_0x4a4be0,_0x20e7d2){return function(_0x1c4ac5){if(_0x1c4ac5){return _0x1c4ac5[_0x705d('0x22')](_0x4a4be0)[_0x705d('0x23')](function(_0x489d7f){return _0x489d7f;});}return null;};}function removeEntity(_0x5b29d8,_0x1a9525){return function(_0x106b97){if(_0x106b97){return _0x106b97[_0x705d('0x24')]()['then'](function(){_0x5b29d8[_0x705d('0x19')](0xcc)[_0x705d('0x1a')]();});}};}function handleEntityNotFound(_0x277376,_0x219a28){return function(_0x45a3b4){if(!_0x45a3b4){_0x277376[_0x705d('0x18')](0x194);}return _0x45a3b4;};}function handleError(_0x2f448f,_0xd15764){_0xd15764=_0xd15764||0x1f4;return function(_0x39e3b7){logger['error'](_0x39e3b7[_0x705d('0x25')]);if(_0x39e3b7['name']){delete _0x39e3b7[_0x705d('0x26')];}_0x2f448f['status'](_0xd15764)['send'](_0x39e3b7);};}var utilLicense=require(_0x705d('0x16'));exports[_0x705d('0x27')]=function(_0x215f4a,_0x2fd5d9){var _0x320af3={'raw':!![],'where':{'id':0x1}},_0x145541={};_0x145541[_0x705d('0x28')]=_['keys'](db[_0x705d('0x29')][_0x705d('0x2a')]);_0x145541[_0x705d('0x2b')]=_['keys'](_0x215f4a[_0x705d('0x2b')]);_0x145541[_0x705d('0x2c')]=_[_0x705d('0x2d')](_0x145541['model'],_0x145541[_0x705d('0x2b')]);_0x320af3['attributes']=_[_0x705d('0x2d')](_0x145541[_0x705d('0x28')],qs[_0x705d('0x2e')](_0x215f4a[_0x705d('0x2b')][_0x705d('0x2e')]));_0x320af3['attributes']=_0x320af3[_0x705d('0x2f')][_0x705d('0x30')]?_0x320af3[_0x705d('0x2f')]:_0x145541[_0x705d('0x28')];_0x320af3=_[_0x705d('0x31')]({},_0x320af3,_0x215f4a[_0x705d('0x32')]);return utilLicense[_0x705d('0x33')](_0x320af3)['then'](respondWithResult(_0x2fd5d9,null))[_0x705d('0x34')](handleError(_0x2fd5d9,null));};exports[_0x705d('0x22')]=function(_0x1641d1,_0x5c6287){if(_0x1641d1['body']['id']){delete _0x1641d1[_0x705d('0x35')]['id'];}return db[_0x705d('0x29')][_0x705d('0x36')]({'where':{'id':_0x1641d1[_0x705d('0x37')]['id']}})[_0x705d('0x23')](handleEntityNotFound(_0x5c6287,null))[_0x705d('0x23')](function(_0x3419da){var _0x3774c4=_0x3419da['get']({'plain':!![]});return utilLicense[_0x705d('0x38')](_0x3774c4,_0x1641d1[_0x705d('0x35')][_0x705d('0x39')]);})['then'](function(_0x519f36){if(!_0x519f36[_0x705d('0x3a')]){return saveUpdates(_0x1641d1[_0x705d('0x35')],null);}return _0x519f36;})[_0x705d('0x23')](respondWithResult(_0x5c6287,null))[_0x705d('0x34')](handleError(_0x5c6287,null));};exports[_0x705d('0x3b')]=function(_0x17895e,_0x3a4ecd){var _0x5e2339=_0x705d('0x3c');var _0x224bea=path[_0x705d('0x3d')]('/var',_0x705d('0x3e'),_0x705d('0x3f'),_0x5e2339);_0x3a4ecd['setHeader'](_0x705d('0x40'),_0x705d('0x41')+_0x5e2339);_0x3a4ecd[_0x705d('0x1f')]('Content-Type',_0x705d('0x42'));_0x3a4ecd[_0x705d('0x43')](_0x224bea);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2348e0b..d64aae5 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 _0x9ef4=['./license.attributes','define','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x24ae31,_0x3d5458){var _0x33ed2b=function(_0x171260){while(--_0x171260){_0x24ae31['push'](_0x24ae31['shift']());}};_0x33ed2b(++_0x3d5458);}(_0x9ef4,0xad));var _0x49ef=function(_0x5c956c,_0x5b512b){_0x5c956c=_0x5c956c-0x0;var _0x5cfa0d=_0x9ef4[_0x5c956c];return _0x5cfa0d;};'use strict';var _=require(_0x49ef('0x0'));var util=require('util');var logger=require(_0x49ef('0x1'))(_0x49ef('0x2'));var moment=require(_0x49ef('0x3'));var BPromise=require(_0x49ef('0x4'));var rp=require(_0x49ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ef('0x6'));var config=require('../../config/environment');var attributes=require(_0x49ef('0x7'));module['exports']=function(_0x15ab0e,_0x37b129){return _0x15ab0e[_0x49ef('0x8')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b26=['request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','lodash','util','api','moment','bluebird'];(function(_0x23ec85,_0x55248e){var _0x170ab9=function(_0x2a5425){while(--_0x2a5425){_0x23ec85['push'](_0x23ec85['shift']());}};_0x170ab9(++_0x55248e);}(_0x5b26,0x7d));var _0x65b2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5b26[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x65b2('0x0'));var util=require(_0x65b2('0x1'));var logger=require('../../config/logger')(_0x65b2('0x2'));var moment=require(_0x65b2('0x3'));var BPromise=require(_0x65b2('0x4'));var rp=require(_0x65b2('0x5'));var fs=require('fs');var path=require(_0x65b2('0x6'));var rimraf=require(_0x65b2('0x7'));var config=require(_0x65b2('0x8'));var attributes=require(_0x65b2('0x9'));module[_0x65b2('0xa')]=function(_0x463bb1,_0x272277){return _0x463bb1[_0x65b2('0xb')](_0x65b2('0xc'),attributes,{'tableName':'license','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 068d534..9f8832c 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 _0x6e41=['rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','randomstring','ioredis'];(function(_0x106725,_0x46824d){var _0x27a001=function(_0x37a28b){while(--_0x37a28b){_0x106725['push'](_0x106725['shift']());}};_0x27a001(++_0x46824d);}(_0x6e41,0x1d0));var _0x16e4=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x6e41[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x16e4('0x0'));var util=require(_0x16e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16e4('0x2'));var fs=require('fs');var Redis=require(_0x16e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16e4('0x4'));var config=require(_0x16e4('0x5'));var jayson=require(_0x16e4('0x6'));var client=jayson[_0x16e4('0x7')][_0x16e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x452f62,_0x46b524,_0xa1cc7b){return new BPromise(function(_0x2738c1,_0x23fc1b){return client[_0x16e4('0x9')](_0x452f62,_0xa1cc7b)[_0x16e4('0xa')](function(_0x29e7ac){logger['info'](_0x16e4('0xb'),_0x46b524,_0x16e4('0xc'));logger['debug'](_0x16e4('0xd'),_0x46b524,'request\x20sent',JSON['stringify'](_0x29e7ac));if(_0x29e7ac['error']){if(_0x29e7ac['error'][_0x16e4('0xe')]===0x1f4){logger[_0x16e4('0xf')]('License,\x20%s,\x20%s',_0x46b524,_0x29e7ac[_0x16e4('0xf')][_0x16e4('0x10')]);return _0x23fc1b(_0x29e7ac[_0x16e4('0xf')][_0x16e4('0x10')]);}logger[_0x16e4('0xf')](_0x16e4('0xb'),_0x46b524,_0x29e7ac[_0x16e4('0xf')][_0x16e4('0x10')]);return _0x2738c1(_0x29e7ac[_0x16e4('0xf')][_0x16e4('0x10')]);}else{logger['info'](_0x16e4('0xb'),_0x46b524,_0x16e4('0xc'));_0x2738c1(_0x29e7ac[_0x16e4('0x11')]['message']);}})['catch'](function(_0x29748e){logger[_0x16e4('0xf')](_0x16e4('0xb'),_0x46b524,_0x29748e);_0x23fc1b(_0x29748e);});});} \ No newline at end of file +var _0xf56b=['lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','error','License,\x20%s,\x20%s','message','result','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf56b,0xb0));var _0xbf56=function(_0x50426a,_0x3df8ff){_0x50426a=_0x50426a-0x0;var _0x52d085=_0xf56b[_0x50426a];return _0x52d085;};'use strict';var _=require(_0xbf56('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf56('0x1'));var rs=require(_0xbf56('0x2'));var fs=require('fs');var Redis=require(_0xbf56('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf56('0x4'))(_0xbf56('0x5'));var config=require('../../config/environment');var jayson=require(_0xbf56('0x6'));var client=jayson[_0xbf56('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x391334,_0x4c8c87,_0x1078f6){return new BPromise(function(_0x4293f1,_0x1b74b2){return client['request'](_0x391334,_0x1078f6)['then'](function(_0x2070fc){logger[_0xbf56('0x8')]('License,\x20%s,\x20%s',_0x4c8c87,_0xbf56('0x9'));logger[_0xbf56('0xa')]('License,\x20%s,\x20%s,\x20%s',_0x4c8c87,_0xbf56('0x9'),JSON['stringify'](_0x2070fc));if(_0x2070fc[_0xbf56('0xb')]){if(_0x2070fc[_0xbf56('0xb')]['code']===0x1f4){logger[_0xbf56('0xb')](_0xbf56('0xc'),_0x4c8c87,_0x2070fc['error'][_0xbf56('0xd')]);return _0x1b74b2(_0x2070fc[_0xbf56('0xb')]['message']);}logger[_0xbf56('0xb')]('License,\x20%s,\x20%s',_0x4c8c87,_0x2070fc[_0xbf56('0xb')][_0xbf56('0xd')]);return _0x4293f1(_0x2070fc['error'][_0xbf56('0xd')]);}else{logger[_0xbf56('0x8')](_0xbf56('0xc'),_0x4c8c87,_0xbf56('0x9'));_0x4293f1(_0x2070fc[_0xbf56('0xe')]['message']);}})[_0xbf56('0xf')](function(_0x54e0d3){logger[_0xbf56('0xb')](_0xbf56('0xc'),_0x4c8c87,_0x54e0d3);_0x1b74b2(_0x54e0d3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ee23f71..bef4273 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 _0x7f82=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','addDisposition','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports'];(function(_0x113ad5,_0x5145d8){var _0xe90c6d=function(_0x4ab104){while(--_0x4ab104){_0x113ad5['push'](_0x113ad5['shift']());}};_0xe90c6d(++_0x5145d8);}(_0x7f82,0x68));var _0x27f8=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x7f82[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require('multer');var util=require(_0x27f8('0x0'));var path=require(_0x27f8('0x1'));var timeout=require(_0x27f8('0x2'));var express=require('express');var router=express[_0x27f8('0x3')]();var fs_extra=require(_0x27f8('0x4'));var auth=require(_0x27f8('0x5'));var interaction=require(_0x27f8('0x6'));var config=require(_0x27f8('0x7'));var controller=require(_0x27f8('0x8'));router[_0x27f8('0x9')]('/',auth[_0x27f8('0xa')](),controller[_0x27f8('0xb')]);router[_0x27f8('0x9')](_0x27f8('0xc'),auth[_0x27f8('0xa')](),controller['describe']);router[_0x27f8('0x9')](_0x27f8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x27f8('0x9')](_0x27f8('0xe'),auth[_0x27f8('0xa')](),controller[_0x27f8('0xf')]);router[_0x27f8('0x9')]('/:id/canned_answers',auth[_0x27f8('0xa')](),controller[_0x27f8('0x10')]);router[_0x27f8('0x9')](_0x27f8('0x11'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x12')]);router['get'](_0x27f8('0x13'),auth['isAuthenticated'](),controller[_0x27f8('0x14')]);router['get'](_0x27f8('0x15'),auth['isAuthenticated'](),controller[_0x27f8('0x16')]);router[_0x27f8('0x9')](_0x27f8('0x17'),auth[_0x27f8('0xa')](),controller['getApplications']);router[_0x27f8('0x9')](_0x27f8('0x18'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x19')]);router[_0x27f8('0x9')](_0x27f8('0x1a'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x1b')]);router[_0x27f8('0x9')]('/:id/users',auth[_0x27f8('0xa')](),controller[_0x27f8('0x1c')]);router['post'](_0x27f8('0xe'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x1d')]);router[_0x27f8('0x1e')](_0x27f8('0x1f'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x20')]);router[_0x27f8('0x1e')]('/',auth[_0x27f8('0xa')](),controller[_0x27f8('0x21')]);router['post'](_0x27f8('0x11'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x22')]);router[_0x27f8('0x1e')]('/:id/out_servers',auth[_0x27f8('0xa')](),controller[_0x27f8('0x23')]);router[_0x27f8('0x1e')](_0x27f8('0x15'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x24')]);router[_0x27f8('0x1e')](_0x27f8('0x17'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x25')]);router[_0x27f8('0x1e')](_0x27f8('0x26'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x27')]);router[_0x27f8('0x1e')](_0x27f8('0x28'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x29')]);router[_0x27f8('0x2a')](_0x27f8('0xd'),auth['isAuthenticated'](),controller[_0x27f8('0x2b')]);router[_0x27f8('0x2c')](_0x27f8('0xe'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x2d')]);router[_0x27f8('0x2c')]('/:id/canned_answers',auth[_0x27f8('0xa')](),controller[_0x27f8('0x2e')]);router[_0x27f8('0x2c')](_0x27f8('0x11'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x2f')]);router[_0x27f8('0x2c')](_0x27f8('0x13'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x30')]);router[_0x27f8('0x2c')](_0x27f8('0xd'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x31')]);router[_0x27f8('0x2c')](_0x27f8('0x28'),auth[_0x27f8('0xa')](),controller[_0x27f8('0x32')]);module[_0x27f8('0x33')]=router; \ No newline at end of file +var _0x0f5b=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','addApplications','/:id/send','send','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports'];(function(_0x193c34,_0x1564cf){var _0x427f60=function(_0x82d29e){while(--_0x82d29e){_0x193c34['push'](_0x193c34['shift']());}};_0x427f60(++_0x1564cf);}(_0x0f5b,0x1b9));var _0xb0f5=function(_0x1bf76e,_0x23aa8b){_0x1bf76e=_0x1bf76e-0x0;var _0x58f276=_0x0f5b[_0x1bf76e];return _0x58f276;};'use strict';var multer=require('multer');var util=require(_0xb0f5('0x0'));var path=require(_0xb0f5('0x1'));var timeout=require(_0xb0f5('0x2'));var express=require('express');var router=express[_0xb0f5('0x3')]();var fs_extra=require(_0xb0f5('0x4'));var auth=require(_0xb0f5('0x5'));var interaction=require(_0xb0f5('0x6'));var config=require(_0xb0f5('0x7'));var controller=require(_0xb0f5('0x8'));router[_0xb0f5('0x9')]('/',auth[_0xb0f5('0xa')](),controller[_0xb0f5('0xb')]);router[_0xb0f5('0x9')](_0xb0f5('0xc'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0xd')]);router['get'](_0xb0f5('0xe'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0xf')]);router[_0xb0f5('0x9')]('/:id/dispositions',auth[_0xb0f5('0xa')](),controller['getDispositions']);router[_0xb0f5('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb0f5('0x10')]);router[_0xb0f5('0x9')](_0xb0f5('0x11'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x12')]);router[_0xb0f5('0x9')](_0xb0f5('0x13'),auth['isAuthenticated'](),controller[_0xb0f5('0x14')]);router[_0xb0f5('0x9')](_0xb0f5('0x15'),auth['isAuthenticated'](),controller[_0xb0f5('0x16')]);router[_0xb0f5('0x9')](_0xb0f5('0x17'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x18')]);router[_0xb0f5('0x9')](_0xb0f5('0x19'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x1a')]);router[_0xb0f5('0x9')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router[_0xb0f5('0x9')](_0xb0f5('0x1b'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x1c')]);router[_0xb0f5('0x1d')]('/:id/dispositions',auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x1e')]);router['post'](_0xb0f5('0x1f'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x20')]);router[_0xb0f5('0x1d')]('/',auth['isAuthenticated'](),controller[_0xb0f5('0x21')]);router[_0xb0f5('0x1d')](_0xb0f5('0x11'),auth['isAuthenticated'](),controller['addImap']);router[_0xb0f5('0x1d')](_0xb0f5('0x13'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x22')]);router[_0xb0f5('0x1d')](_0xb0f5('0x15'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x23')]);router[_0xb0f5('0x1d')](_0xb0f5('0x17'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x24')]);router['post'](_0xb0f5('0x25'),auth['isAuthenticated'](),controller[_0xb0f5('0x26')]);router['post'](_0xb0f5('0x1b'),auth[_0xb0f5('0xa')](),controller['addAgents']);router['put'](_0xb0f5('0xe'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x27')]);router[_0xb0f5('0x28')](_0xb0f5('0x29'),auth['isAuthenticated'](),controller[_0xb0f5('0x2a')]);router[_0xb0f5('0x28')](_0xb0f5('0x1f'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x2b')]);router[_0xb0f5('0x28')](_0xb0f5('0x11'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x2c')]);router[_0xb0f5('0x28')](_0xb0f5('0x13'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x2d')]);router[_0xb0f5('0x28')](_0xb0f5('0xe'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x2e')]);router[_0xb0f5('0x28')](_0xb0f5('0x1b'),auth[_0xb0f5('0xa')](),controller[_0xb0f5('0x2f')]);module[_0xb0f5('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4b443e9..94b59dd 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 _0xf170=['custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','provider'];(function(_0x259a49,_0x1798e2){var _0x14f871=function(_0x5609e9){while(--_0x5609e9){_0x259a49['push'](_0x259a49['shift']());}};_0x14f871(++_0x1798e2);}(_0xf170,0x1b9));var _0x0f17=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0xf170[_0x5e9876];return _0x576c48;};'use strict';var Sequelize=require(_0x0f17('0x0'));module[_0x0f17('0x1')]={'description':{'type':Sequelize[_0x0f17('0x2')]},'name':{'type':Sequelize[_0x0f17('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0f17('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0f17('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x0f17('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0f17('0x4')},'fontSize':{'type':Sequelize[_0x0f17('0x5')](0x2)[_0x0f17('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0f17('0x7')],'defaultValue':function(){return _0x0f17('0x8');}},'notificationSound':{'type':Sequelize[_0x0f17('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0f17('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0f17('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f17('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f17('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f17('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f17('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x0f17('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0f17('0x3')],'defaultValue':![],'comment':_0x0f17('0xa'),'set':function(_0x3cbb83){if(!_0x3cbb83)this[_0x0f17('0xb')](_0x0f17('0xc'),null);this[_0x0f17('0xb')](_0x0f17('0xd'),_0x3cbb83);}},'provider':{'type':Sequelize['ENUM'](_0x0f17('0xe'),_0x0f17('0xf'),'yahoo',_0x0f17('0x10')),'defaultValue':null,'get':function(){if(!this[_0x0f17('0x11')](_0x0f17('0x12')))return _0x0f17('0x13');return this[_0x0f17('0x11')](_0x0f17('0x12'));},'set':function(_0x4765a7){if(_0x4765a7==='custom')_0x4765a7=null;return this[_0x0f17('0xb')](_0x0f17('0x12'),_0x4765a7);}}}; \ No newline at end of file +var _0x855a=['provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue'];(function(_0x35fa97,_0x337a4c){var _0x4ebc0f=function(_0x16c3b5){while(--_0x16c3b5){_0x35fa97['push'](_0x35fa97['shift']());}};_0x4ebc0f(++_0x337a4c);}(_0x855a,0x12e));var _0xa855=function(_0x4d2938,_0x332d65){_0x4d2938=_0x4d2938-0x0;var _0x5e7d9b=_0x855a[_0x4d2938];return _0x5e7d9b;};'use strict';var Sequelize=require(_0xa855('0x0'));module[_0xa855('0x1')]={'description':{'type':Sequelize[_0xa855('0x2')]},'name':{'type':Sequelize[_0xa855('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xa855('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa855('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa855('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa855('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xa855('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa855('0x4')},'fontSize':{'type':Sequelize[_0xa855('0x5')](0x2)[_0xa855('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa855('0x7')],'defaultValue':function(){return _0xa855('0x8');}},'notificationSound':{'type':Sequelize[_0xa855('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa855('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa855('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa855('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa855('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa855('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa855('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa855('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xa855('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa855('0x3')],'defaultValue':![],'comment':_0xa855('0xa'),'set':function(_0x203715){if(!_0x203715)this[_0xa855('0xb')](_0xa855('0xc'),null);this[_0xa855('0xb')](_0xa855('0xd'),_0x203715);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xa855('0xe'),_0xa855('0xf'),_0xa855('0x10')),'defaultValue':null,'get':function(){if(!this[_0xa855('0x11')](_0xa855('0x12')))return _0xa855('0x13');return this[_0xa855('0x11')](_0xa855('0x12'));},'set':function(_0x17114e){if(_0x17114e===_0xa855('0x13'))_0x17114e=null;return this[_0xa855('0xb')](_0xa855('0x12'),_0x17114e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 32e79a7..c782198 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 _0xd6a3=['mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','MailServerIn','MailServerOut','Pause','find','body','custom','provider','params','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','active','description','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','omit','getInteractions','Contact','Owner','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','attach','out','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','username','password','modernAuthentication','CloudProviderId','host','port','secure','service','user','pass','authentication','Imap','Smtp','index'];(function(_0x561d80,_0x482d5b){var _0x3f9154=function(_0x2e1fe6){while(--_0x2e1fe6){_0x561d80['push'](_0x561d80['shift']());}};_0x3f9154(++_0x482d5b);}(_0xd6a3,0x1ea));var _0x3d6a=function(_0x36657e,_0xf5704f){_0x36657e=_0x36657e-0x0;var _0x846a52=_0xd6a3[_0x36657e];return _0x846a52;};'use strict';var moment=require(_0x3d6a('0x0'));var BPromise=require(_0x3d6a('0x1'));var util=require(_0x3d6a('0x2'));var path=require(_0x3d6a('0x3'));var _=require(_0x3d6a('0x4'));var juice=require(_0x3d6a('0x5'));var Redis=require('ioredis');var qs=require(_0x3d6a('0x6'));var logger=require(_0x3d6a('0x7'))('api');var config=require('../../config/environment');var db=require(_0x3d6a('0x8'))['db'];config[_0x3d6a('0x9')]=_[_0x3d6a('0xa')](config[_0x3d6a('0x9')],{'host':_0x3d6a('0xb'),'port':0x18eb});var socket=require(_0x3d6a('0xc'))(new Redis(config[_0x3d6a('0x9')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x3d6a('0xd'));var client=jayson[_0x3d6a('0xe')][_0x3d6a('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x5bc6bf,_0x884edb,_0xcdf49a,_0x2fff92){return new BPromise(function(_0x5acbea,_0x1c194a){var _0x53824a=_0x2fff92||client;return _0x53824a[_0x3d6a('0x10')](_0x5bc6bf,_0xcdf49a)[_0x3d6a('0x11')](function(_0x40caa7){logger[_0x3d6a('0x12')]('MailAccount,\x20%s,\x20%s',_0x884edb,_0x3d6a('0x13'));logger[_0x3d6a('0x14')](_0x3d6a('0x15'),_0x884edb,_0x3d6a('0x13'),JSON['stringify'](_0x40caa7));if(_0x40caa7['error']){if(_0x40caa7[_0x3d6a('0x16')]['code']===0x1f4){logger[_0x3d6a('0x16')](_0x3d6a('0x17'),_0x884edb,_0x40caa7[_0x3d6a('0x16')][_0x3d6a('0x18')]);return _0x1c194a(_0x40caa7[_0x3d6a('0x16')][_0x3d6a('0x18')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x884edb,_0x40caa7[_0x3d6a('0x16')][_0x3d6a('0x18')]);return _0x5acbea(_0x40caa7[_0x3d6a('0x16')]['message']);}else{logger[_0x3d6a('0x12')](_0x3d6a('0x17'),_0x884edb,_0x3d6a('0x13'));_0x5acbea(_0x40caa7[_0x3d6a('0x19')][_0x3d6a('0x18')]);}})[_0x3d6a('0x1a')](function(_0x4b1047){logger['error'](_0x3d6a('0x17'),_0x884edb,_0x4b1047);_0x1c194a(_0x4b1047);});});}function respondWithStatusCode(_0x238718,_0x712279){_0x712279=_0x712279||0xcc;return function(_0x54af17){if(_0x54af17){return _0x238718[_0x3d6a('0x1b')](_0x712279);}return _0x238718[_0x3d6a('0x1c')](_0x712279)[_0x3d6a('0x1d')]();};}function respondWithResult(_0x2eacbd,_0x573738){_0x573738=_0x573738||0xc8;return function(_0x4c5f4b){if(_0x4c5f4b){return _0x2eacbd[_0x3d6a('0x1c')](_0x573738)[_0x3d6a('0x1e')](_0x4c5f4b);}};}function respondWithFilteredResult(_0xb435fa,_0x2f510c){return function(_0xc24a85){if(_0xc24a85){var _0x2750d5=typeof _0x2f510c['offset']===_0x3d6a('0x1f')&&typeof _0x2f510c[_0x3d6a('0x20')]===_0x3d6a('0x1f');var _0x4a56e6=_0xc24a85[_0x3d6a('0x21')];var _0x2c9e53=_0x2750d5?0x0:_0x2f510c[_0x3d6a('0x22')];var _0x587d29=_0x2750d5?_0xc24a85[_0x3d6a('0x21')]:_0x2f510c[_0x3d6a('0x22')]+_0x2f510c[_0x3d6a('0x20')];var _0x474e39;if(_0x587d29>=_0x4a56e6){_0x587d29=_0x4a56e6;_0x474e39=0xc8;}else{_0x474e39=0xce;}_0xb435fa['status'](_0x474e39);return _0xb435fa['set'](_0x3d6a('0x23'),_0x2c9e53+'-'+_0x587d29+'/'+_0x4a56e6)[_0x3d6a('0x1e')](_0xc24a85);}return null;};}function saveUpdates(_0x57cf51){return function(_0x1f3b1c){if(_0x1f3b1c){return _0x1f3b1c[_0x3d6a('0x24')](_0x57cf51)[_0x3d6a('0x11')](function(_0x1ab067){return _0x1ab067;});}return null;};}function removeEntity(_0x17dd92){return function(_0x3d2868){if(_0x3d2868){return _0x3d2868[_0x3d6a('0x25')]()[_0x3d6a('0x11')](function(){var _0x200283=_0x3d2868[_0x3d6a('0x26')]({'plain':!![]});var _0x51aa43=_0x3d6a('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x51aa43,'resourceId':_0x200283['id']}})[_0x3d6a('0x11')](function(){return _0x3d2868;});})['then'](function(){_0x17dd92['status'](0xcc)[_0x3d6a('0x1d')]();});}};}function handleEntityNotFound(_0x3caa86){return function(_0x4f5dc2){if(!_0x4f5dc2){_0x3caa86['sendStatus'](0x194);}return _0x4f5dc2;};}function handleError(_0x53d68b,_0x5bc38b){_0x5bc38b=_0x5bc38b||0x1f4;return function(_0x40cef5){logger[_0x3d6a('0x16')](_0x40cef5[_0x3d6a('0x28')]);if(_0x40cef5[_0x3d6a('0x29')]){delete _0x40cef5[_0x3d6a('0x29')];}_0x53d68b[_0x3d6a('0x1c')](_0x5bc38b)[_0x3d6a('0x2a')](_0x40cef5);};}function getImapHost(_0x46705f){switch(_0x46705f){case _0x3d6a('0x2b'):return _0x3d6a('0x2c');case _0x3d6a('0x2d'):return'imap.mail.yahoo.com';case _0x3d6a('0x2e'):return _0x3d6a('0x2f');case _0x3d6a('0x30'):return'outlook.office365.com';}throw new Error(_0x3d6a('0x31'),_0x46705f);}function getSmtpHost(_0x19a118){switch(_0x19a118){case _0x3d6a('0x2b'):return _0x3d6a('0x32');case _0x3d6a('0x2d'):return _0x3d6a('0x33');case _0x3d6a('0x2e'):return _0x3d6a('0x34');case _0x3d6a('0x30'):return _0x3d6a('0x35');}throw new Error(_0x3d6a('0x31'),_0x19a118);}function getAuthenticationOptions(_0x3f24d0,_0x2a1c21){var _0x3ee32f={};var _0x1aa1d5={};if(_0x3f24d0){_0x3ee32f['user']=_0x1aa1d5['user']=_0x2a1c21[_0x3d6a('0x36')];_0x3ee32f[_0x3d6a('0x37')]=_0x1aa1d5['pass']=_0x2a1c21[_0x3d6a('0x37')];if(_0x2a1c21[_0x3d6a('0x38')]){_0x3ee32f[_0x3d6a('0x38')]=_0x1aa1d5[_0x3d6a('0x38')]=!![];_0x3ee32f['CloudProviderId']=_0x1aa1d5[_0x3d6a('0x39')]=_0x2a1c21[_0x3d6a('0x39')];_0x3ee32f[_0x3d6a('0x37')]=_0x1aa1d5['pass']=null;}else{_0x3ee32f[_0x3d6a('0x39')]=_0x1aa1d5['CloudProviderId']=null;}_0x3ee32f[_0x3d6a('0x3a')]=getImapHost(_0x3f24d0);_0x3ee32f[_0x3d6a('0x3b')]=0x3e1;_0x1aa1d5[_0x3d6a('0x3a')]=getSmtpHost(_0x3f24d0);_0x1aa1d5['port']=0x24b;_0x1aa1d5[_0x3d6a('0x3c')]=![];_0x3ee32f[_0x3d6a('0x3d')]=_0x1aa1d5[_0x3d6a('0x3d')]=null;}else{if(_0x2a1c21['authentication']){_0x3ee32f[_0x3d6a('0x3e')]=_0x1aa1d5[_0x3d6a('0x3e')]=_0x2a1c21[_0x3d6a('0x36')];_0x3ee32f[_0x3d6a('0x37')]=_0x1aa1d5[_0x3d6a('0x3f')]=_0x2a1c21[_0x3d6a('0x37')];}else{_0x3ee32f[_0x3d6a('0x40')]=_0x1aa1d5['authentication']=![];_0x3ee32f[_0x3d6a('0x3e')]=_0x1aa1d5[_0x3d6a('0x3e')]=null;_0x3ee32f[_0x3d6a('0x37')]=_0x1aa1d5[_0x3d6a('0x3f')]=null;}_0x3ee32f['host']=_0x2a1c21[_0x3d6a('0x41')][_0x3d6a('0x3a')];_0x3ee32f['port']=_0x2a1c21['Imap'][_0x3d6a('0x3b')];_0x1aa1d5['host']=_0x2a1c21[_0x3d6a('0x42')][_0x3d6a('0x3a')];_0x1aa1d5['port']=_0x2a1c21[_0x3d6a('0x42')]['port'];}return{'Imap':_0x3ee32f,'Smtp':_0x1aa1d5};}exports[_0x3d6a('0x43')]=function(_0x413aa0,_0x238a45){var _0x3584ba={'include':[{'model':db['MailServerIn'],'as':_0x3d6a('0x41')},{'model':db['MailServerOut'],'as':_0x3d6a('0x42')},{'model':db['Pause'],'as':_0x3d6a('0x44')}]},_0x1d5d7d={},_0x40dfe3={'count':0x0,'rows':[]};var _0x2f278c=_[_0x3d6a('0x45')](db[_0x3d6a('0x46')][_0x3d6a('0x47')],function(_0x5c599b){return{'name':_0x5c599b[_0x3d6a('0x48')],'type':_0x5c599b[_0x3d6a('0x49')]['key']};});_0x1d5d7d[_0x3d6a('0x4a')]=_['map'](_0x2f278c,'name');_0x1d5d7d[_0x3d6a('0x4b')]=_[_0x3d6a('0x4c')](_0x413aa0[_0x3d6a('0x4b')]);_0x1d5d7d['filters']=_[_0x3d6a('0x4d')](_0x1d5d7d['model'],_0x1d5d7d['query']);_0x3584ba[_0x3d6a('0x4e')]=_['intersection'](_0x1d5d7d[_0x3d6a('0x4a')],qs['fields'](_0x413aa0[_0x3d6a('0x4b')][_0x3d6a('0x4f')]));_0x3584ba[_0x3d6a('0x4e')]=_0x3584ba[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x3584ba[_0x3d6a('0x4e')]:_0x1d5d7d[_0x3d6a('0x4a')];if(!_0x413aa0[_0x3d6a('0x4b')][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x3584ba[_0x3d6a('0x20')]=qs[_0x3d6a('0x20')](_0x413aa0[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x3584ba[_0x3d6a('0x22')]=qs[_0x3d6a('0x22')](_0x413aa0[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}_0x3584ba[_0x3d6a('0x53')]=qs[_0x3d6a('0x54')](_0x413aa0['query'][_0x3d6a('0x54')]);_0x3584ba[_0x3d6a('0x55')]=qs[_0x3d6a('0x56')](_[_0x3d6a('0x57')](_0x413aa0[_0x3d6a('0x4b')],_0x1d5d7d[_0x3d6a('0x56')]),_0x2f278c);if(_0x413aa0[_0x3d6a('0x4b')][_0x3d6a('0x58')]){_0x3584ba[_0x3d6a('0x55')]=_[_0x3d6a('0x59')](_0x3584ba[_0x3d6a('0x55')],{'$or':_[_0x3d6a('0x45')](_0x2f278c,function(_0x173cf9){if(_0x173cf9[_0x3d6a('0x49')]!==_0x3d6a('0x5a')){var _0x217825={};_0x217825[_0x173cf9[_0x3d6a('0x29')]]={'$like':'%'+_0x413aa0[_0x3d6a('0x4b')]['filter']+'%'};return _0x217825;}})});}_0x3584ba=_[_0x3d6a('0x59')]({},_0x3584ba,_0x413aa0[_0x3d6a('0x5b')]);var _0x45c4bf={'where':_0x3584ba[_0x3d6a('0x55')]};return db[_0x3d6a('0x46')][_0x3d6a('0x21')](_0x45c4bf)[_0x3d6a('0x11')](function(_0x2c4472){_0x40dfe3[_0x3d6a('0x21')]=_0x2c4472;if(_0x413aa0['query'][_0x3d6a('0x5c')]){_0x3584ba[_0x3d6a('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x3d6a('0x5e')](_0x3584ba);})[_0x3d6a('0x11')](function(_0x1b13d3){_0x40dfe3[_0x3d6a('0x5f')]=_0x1b13d3;return _0x40dfe3;})['then'](respondWithFilteredResult(_0x238a45,_0x3584ba))[_0x3d6a('0x1a')](handleError(_0x238a45,null));};exports[_0x3d6a('0x60')]=function(_0x487820,_0x55ace2){var _0x44ee0c={'raw':![],'where':{'id':_0x487820['params']['id']},'include':[{'model':db[_0x3d6a('0x61')],'as':_0x3d6a('0x41')},{'model':db[_0x3d6a('0x62')],'as':_0x3d6a('0x42')},{'model':db[_0x3d6a('0x63')],'as':_0x3d6a('0x44')}]},_0x40184c={};_0x40184c[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db[_0x3d6a('0x46')][_0x3d6a('0x47')]);_0x40184c[_0x3d6a('0x4b')]=_[_0x3d6a('0x4c')](_0x487820['query']);_0x40184c[_0x3d6a('0x56')]=_[_0x3d6a('0x4d')](_0x40184c[_0x3d6a('0x4a')],_0x40184c[_0x3d6a('0x4b')]);_0x44ee0c['attributes']=_[_0x3d6a('0x4d')](_0x40184c[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x487820['query'][_0x3d6a('0x4f')]));_0x44ee0c['attributes']=_0x44ee0c['attributes'][_0x3d6a('0x50')]?_0x44ee0c['attributes']:_0x40184c['model'];if(_0x487820[_0x3d6a('0x4b')][_0x3d6a('0x5c')]){_0x44ee0c['include']=[{'all':!![]}];}_0x44ee0c=_[_0x3d6a('0x59')]({},_0x44ee0c,_0x487820[_0x3d6a('0x5b')]);return db[_0x3d6a('0x46')][_0x3d6a('0x64')](_0x44ee0c)[_0x3d6a('0x11')](handleEntityNotFound(_0x55ace2,null))['then'](respondWithResult(_0x55ace2,null))[_0x3d6a('0x1a')](handleError(_0x55ace2,null));};exports[_0x3d6a('0x24')]=function(_0x1a86b8,_0x51f30c){if(_0x1a86b8[_0x3d6a('0x65')]['id']){delete _0x1a86b8[_0x3d6a('0x65')]['id'];}var _0x2a47af=_0x1a86b8[_0x3d6a('0x65')]['provider']===_0x3d6a('0x66')?null:_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x67')];var _0x1c2250=_0x1a86b8['body']['Imap']||{};var _0x2a090f=_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x42')]||{};if(_0x2a47af){_0x1c2250[_0x3d6a('0x3a')]=getImapHost(_0x2a47af);_0x1c2250[_0x3d6a('0x3b')]=0x3e1;_0x2a090f[_0x3d6a('0x3a')]=getSmtpHost(_0x2a47af);_0x2a090f[_0x3d6a('0x3b')]=0x24b;_0x2a090f[_0x3d6a('0x3c')]=![];}if(_0x2a090f[_0x3d6a('0x38')]){_0x2a090f[_0x3d6a('0x3c')]=![];}else{_0x2a090f['CloudProviderId']=null;}if(!_0x1c2250['modernAuthentication'])_0x1c2250[_0x3d6a('0x39')]=null;_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x41')]=_0x1c2250;_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x42')]=_0x2a090f;return db[_0x3d6a('0x46')]['find']({'where':{'id':_0x1a86b8[_0x3d6a('0x68')]['id']},'include':[{'model':db[_0x3d6a('0x61')],'as':_0x3d6a('0x41')},{'model':db[_0x3d6a('0x62')],'as':_0x3d6a('0x42')},{'model':db[_0x3d6a('0x63')],'as':'mandatoryDispositionPause'}]})[_0x3d6a('0x11')](handleEntityNotFound(_0x51f30c,null))[_0x3d6a('0x11')](function(_0x414f87){if(!_0x414f87)throw new Error('Mail\x20Account\x20not\x20found');if(_0x414f87[_0x3d6a('0x3d')])delete _0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x41')];return _0x414f87;})['then'](saveUpdates(_0x1a86b8[_0x3d6a('0x65')],null))[_0x3d6a('0x11')](function(_0x4fff6a){if(!_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x41')])return _0x4fff6a;return db[_0x3d6a('0x61')]['update'](_0x1a86b8['body']['Imap'],{'where':{'MailAccountId':_0x4fff6a['id']}})[_0x3d6a('0x11')](function(){return _0x4fff6a;});})[_0x3d6a('0x11')](function(_0x22298d){if(!_0x1a86b8['body'][_0x3d6a('0x42')])return _0x22298d;return db[_0x3d6a('0x62')]['update'](_0x1a86b8[_0x3d6a('0x65')][_0x3d6a('0x42')],{'where':{'MailAccountId':_0x22298d['id']}})['then'](function(){return _0x22298d;});})[_0x3d6a('0x11')](respondWithResult(_0x51f30c,null))[_0x3d6a('0x1a')](handleError(_0x51f30c,null));};exports['describe']=function(_0x5ec474,_0x3a7a34){return db[_0x3d6a('0x46')]['describe']()[_0x3d6a('0x11')](respondWithResult(_0x3a7a34,null))[_0x3d6a('0x1a')](handleError(_0x3a7a34,null));};exports['addDisposition']=function(_0x392b72,_0x316f24){if(_0x392b72[_0x3d6a('0x65')]['id']){delete _0x392b72[_0x3d6a('0x65')]['id'];}return db[_0x3d6a('0x46')]['find']({'where':{'id':_0x392b72[_0x3d6a('0x68')]['id']}})['then'](handleEntityNotFound(_0x316f24,null))['then'](function(_0x532c5d){if(_0x532c5d){_0x392b72['body']['MailAccountId']=_0x532c5d['id'];return db[_0x3d6a('0x69')][_0x3d6a('0x6a')](_0x392b72['body']);}})['then'](respondWithResult(_0x316f24,null))['catch'](handleError(_0x316f24,null));};exports[_0x3d6a('0x6b')]=function(_0x23f743,_0x2402c6){var _0x4f88fd={'raw':![],'where':{}};var _0x451794={};var _0xab849={'count':0x0,'rows':[]};return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x23f743[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x2402c6,null))[_0x3d6a('0x11')](function(_0x534b69){if(_0x534b69){_0x451794[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db[_0x3d6a('0x69')][_0x3d6a('0x47')]);_0x451794['query']=_[_0x3d6a('0x4c')](_0x23f743['query']);_0x451794['filters']=_[_0x3d6a('0x4d')](_0x451794[_0x3d6a('0x4a')],_0x451794[_0x3d6a('0x4b')]);_0x4f88fd['attributes']=_[_0x3d6a('0x4d')](_0x451794[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x23f743[_0x3d6a('0x4b')][_0x3d6a('0x4f')]));_0x4f88fd[_0x3d6a('0x4e')]=_0x4f88fd[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x4f88fd[_0x3d6a('0x4e')]:_0x451794[_0x3d6a('0x4a')];if(!_0x23f743['query'][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x4f88fd['limit']=qs[_0x3d6a('0x20')](_0x23f743[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x4f88fd[_0x3d6a('0x22')]=qs[_0x3d6a('0x22')](_0x23f743[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}_0x4f88fd[_0x3d6a('0x53')]=qs['sort'](_0x23f743['query'][_0x3d6a('0x54')]);_0x4f88fd['where']=qs[_0x3d6a('0x56')](_[_0x3d6a('0x57')](_0x23f743[_0x3d6a('0x4b')],_0x451794[_0x3d6a('0x56')]));_0x4f88fd['where'][_0x3d6a('0x6d')]=_0x534b69['id'];if(_0x23f743['query']['filter']){_0x4f88fd[_0x3d6a('0x55')]=_[_0x3d6a('0x59')](_0x4f88fd['where'],{'$or':_[_0x3d6a('0x45')](_0x4f88fd[_0x3d6a('0x4e')],function(_0x50d1f3){var _0x318316={};_0x318316[_0x50d1f3]={'$like':'%'+_0x23f743['query'][_0x3d6a('0x58')]+'%'};return _0x318316;})});}_0x4f88fd=_['merge']({},_0x4f88fd,_0x23f743[_0x3d6a('0x5b')]);return db['Disposition'][_0x3d6a('0x21')]({'where':_0x4f88fd[_0x3d6a('0x55')]})[_0x3d6a('0x11')](function(_0x49eed0){_0xab849[_0x3d6a('0x21')]=_0x49eed0;if(_0x23f743[_0x3d6a('0x4b')][_0x3d6a('0x5c')]){_0x4f88fd[_0x3d6a('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x3d6a('0x5e')](_0x4f88fd);})['then'](function(_0x465729){_0xab849[_0x3d6a('0x5f')]=_0x465729;return _0xab849;});}})[_0x3d6a('0x11')](respondWithFilteredResult(_0x2402c6,_0x4f88fd))[_0x3d6a('0x1a')](handleError(_0x2402c6,null));};exports['removeDispositions']=function(_0x300dcc,_0x3bb9f3){return db[_0x3d6a('0x46')][_0x3d6a('0x64')]({'where':{'id':_0x300dcc[_0x3d6a('0x68')]['id']}})['then'](handleEntityNotFound(_0x3bb9f3,null))['then'](function(_0x34b601){if(_0x34b601){return _0x34b601[_0x3d6a('0x6e')](_0x300dcc[_0x3d6a('0x4b')][_0x3d6a('0x6f')]);}})['then'](respondWithStatusCode(_0x3bb9f3,null))[_0x3d6a('0x1a')](handleError(_0x3bb9f3,null));};exports[_0x3d6a('0x70')]=function(_0x19460c,_0x2da4c4){if(_0x19460c[_0x3d6a('0x65')]['id']){delete _0x19460c['body']['id'];}return db[_0x3d6a('0x46')][_0x3d6a('0x64')]({'where':{'id':_0x19460c[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x2da4c4,null))[_0x3d6a('0x11')](function(_0x3b62bd){if(_0x3b62bd){_0x19460c['body']['MailAccountId']=_0x3b62bd['id'];return db[_0x3d6a('0x71')]['create'](_0x19460c['body']);}})[_0x3d6a('0x11')](respondWithResult(_0x2da4c4,null))['catch'](handleError(_0x2da4c4,null));};exports[_0x3d6a('0x72')]=function(_0x4a9552,_0x2568e4){var _0x268c9e={'raw':![],'where':{}};var _0x36f157={};var _0x1bc249={'count':0x0,'rows':[]};return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x4a9552[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x2568e4,null))[_0x3d6a('0x11')](function(_0x12c199){if(_0x12c199){_0x36f157[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db[_0x3d6a('0x71')][_0x3d6a('0x47')]);_0x36f157[_0x3d6a('0x4b')]=_['keys'](_0x4a9552['query']);_0x36f157[_0x3d6a('0x56')]=_['intersection'](_0x36f157[_0x3d6a('0x4a')],_0x36f157[_0x3d6a('0x4b')]);_0x268c9e[_0x3d6a('0x4e')]=_[_0x3d6a('0x4d')](_0x36f157[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x4f')]));_0x268c9e['attributes']=_0x268c9e[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x268c9e[_0x3d6a('0x4e')]:_0x36f157[_0x3d6a('0x4a')];if(!_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x268c9e[_0x3d6a('0x20')]=qs[_0x3d6a('0x20')](_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x268c9e[_0x3d6a('0x22')]=qs['offset'](_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}_0x268c9e['order']=qs[_0x3d6a('0x54')](_0x4a9552[_0x3d6a('0x4b')]['sort']);_0x268c9e[_0x3d6a('0x55')]=qs[_0x3d6a('0x56')](_['pick'](_0x4a9552[_0x3d6a('0x4b')],_0x36f157['filters']));_0x268c9e['where'][_0x3d6a('0x6d')]=_0x12c199['id'];if(_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x58')]){_0x268c9e[_0x3d6a('0x55')]=_[_0x3d6a('0x59')](_0x268c9e[_0x3d6a('0x55')],{'$or':_[_0x3d6a('0x45')](_0x268c9e[_0x3d6a('0x4e')],function(_0x1af084){var _0x1d5e00={};_0x1d5e00[_0x1af084]={'$like':'%'+_0x4a9552['query'][_0x3d6a('0x58')]+'%'};return _0x1d5e00;})});}_0x268c9e=_['merge']({},_0x268c9e,_0x4a9552[_0x3d6a('0x5b')]);return db[_0x3d6a('0x71')][_0x3d6a('0x21')]({'where':_0x268c9e[_0x3d6a('0x55')]})[_0x3d6a('0x11')](function(_0x14c9b4){_0x1bc249[_0x3d6a('0x21')]=_0x14c9b4;if(_0x4a9552[_0x3d6a('0x4b')][_0x3d6a('0x5c')]){_0x268c9e['include']=[{'all':!![]}];}return db[_0x3d6a('0x71')]['findAll'](_0x268c9e);})[_0x3d6a('0x11')](function(_0x355ae3){_0x1bc249[_0x3d6a('0x5f')]=_0x355ae3;return _0x1bc249;});}})['then'](respondWithFilteredResult(_0x2568e4,_0x268c9e))[_0x3d6a('0x1a')](handleError(_0x2568e4,null));};exports[_0x3d6a('0x73')]=function(_0x26a428,_0x4a1b35){return db[_0x3d6a('0x46')][_0x3d6a('0x64')]({'where':{'id':_0x26a428[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x4a1b35,null))[_0x3d6a('0x11')](function(_0x46d1e1){if(_0x46d1e1){return _0x46d1e1[_0x3d6a('0x73')](_0x26a428[_0x3d6a('0x4b')][_0x3d6a('0x6f')]);}})[_0x3d6a('0x11')](respondWithStatusCode(_0x4a1b35,null))[_0x3d6a('0x1a')](handleError(_0x4a1b35,null));};exports['create']=function(_0x45bfab,_0x96433f){var _0x28ab77={'name':_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x29')],'key':_0x45bfab[_0x3d6a('0x65')]['key'],'provider':_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x67')]===_0x3d6a('0x66')?null:_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x67')],'email':_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x74')],'ListId':_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x75')],'active':!_['isNil'](_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x76')])?_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x76')]:!![],'description':_0x45bfab[_0x3d6a('0x65')][_0x3d6a('0x77')]||null};var _0x2f6cc0=getAuthenticationOptions(_0x28ab77[_0x3d6a('0x67')],_0x45bfab['body']);_0x28ab77[_0x3d6a('0x41')]=_0x2f6cc0[_0x3d6a('0x41')];_0x28ab77[_0x3d6a('0x42')]=_0x2f6cc0[_0x3d6a('0x42')];return db[_0x3d6a('0x46')][_0x3d6a('0x6a')](_0x28ab77,{'include':[{'model':db[_0x3d6a('0x62')],'as':_0x3d6a('0x42')},{'model':db[_0x3d6a('0x61')],'as':'Imap'}]})[_0x3d6a('0x11')](function(_0x3e4576){var _0x2b17e0=_0x45bfab[_0x3d6a('0x3e')][_0x3d6a('0x26')]({'plain':!![]});if(!_0x2b17e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b17e0['role']===_0x3d6a('0x3e')){var _0x2d0c7b=_0x3e4576[_0x3d6a('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x3d6a('0x64')]({'where':{'name':_0x3d6a('0x27'),'userProfileId':_0x2b17e0[_0x3d6a('0x78')]},'raw':!![]})[_0x3d6a('0x11')](function(_0x3c87f8){if(_0x3c87f8&&_0x3c87f8[_0x3d6a('0x79')]===0x0){return db[_0x3d6a('0x7a')][_0x3d6a('0x6a')]({'name':_0x2d0c7b[_0x3d6a('0x29')],'resourceId':_0x2d0c7b['id'],'type':_0x3c87f8[_0x3d6a('0x29')],'sectionId':_0x3c87f8['id']},{})[_0x3d6a('0x11')](function(){return _0x3e4576;});}else{return _0x3e4576;}})[_0x3d6a('0x1a')](function(_0x7fea5){logger[_0x3d6a('0x16')](_0x3d6a('0x7b'),_0x7fea5);throw _0x7fea5;});}return _0x3e4576;})[_0x3d6a('0x11')](respondWithResult(_0x96433f,0xc9))[_0x3d6a('0x1a')](handleError(_0x96433f,null));};exports[_0x3d6a('0x7c')]=function(_0x59bf00,_0x16bb6e){return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x59bf00[_0x3d6a('0x68')]['id']}})['then'](handleEntityNotFound(_0x16bb6e,null))[_0x3d6a('0x11')](function(_0x4b2125){if(_0x4b2125){return _0x4b2125[_0x3d6a('0x7c')]();}return null;})['then'](respondWithResult(_0x16bb6e,null))[_0x3d6a('0x1a')](handleError(_0x16bb6e,null));};exports[_0x3d6a('0x7d')]=function(_0x4c2c1f,_0x9c8ade){if(_0x4c2c1f['body']['id']){delete _0x4c2c1f[_0x3d6a('0x65')]['id'];}return db['MailAccount'][_0x3d6a('0x64')]({'where':{'id':_0x4c2c1f[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x9c8ade,null))[_0x3d6a('0x11')](function(_0xcbfaf8){if(_0xcbfaf8){_0x4c2c1f[_0x3d6a('0x65')]['MailAccountId']=_0xcbfaf8['id'];return db[_0x3d6a('0x61')][_0x3d6a('0x6a')](_0x4c2c1f[_0x3d6a('0x65')]);}})[_0x3d6a('0x11')](respondWithResult(_0x9c8ade,null))[_0x3d6a('0x1a')](handleError(_0x9c8ade,null));};exports[_0x3d6a('0x7e')]=function(_0x3a3a1a,_0x59f498){return db['MailAccount'][_0x3d6a('0x6c')]({'where':{'id':_0x3a3a1a[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x59f498,null))[_0x3d6a('0x11')](function(_0x4cc278){if(_0x4cc278){return _0x4cc278[_0x3d6a('0x7f')](null);}return null;})[_0x3d6a('0x11')](respondWithStatusCode(_0x59f498,null))['catch'](handleError(_0x59f498,null));};exports[_0x3d6a('0x80')]=function(_0x52cde7,_0x57c202){return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x52cde7[_0x3d6a('0x68')]['id']}})['then'](handleEntityNotFound(_0x57c202,null))[_0x3d6a('0x11')](function(_0x122c89){if(_0x122c89){return _0x122c89['getSmtp']();}return null;})[_0x3d6a('0x11')](respondWithResult(_0x57c202,null))[_0x3d6a('0x1a')](handleError(_0x57c202,null));};exports[_0x3d6a('0x81')]=function(_0x631b83,_0x86b6e9){if(_0x631b83[_0x3d6a('0x65')]['id']){delete _0x631b83[_0x3d6a('0x65')]['id'];}return db['MailAccount'][_0x3d6a('0x64')]({'where':{'id':_0x631b83[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x86b6e9,null))['then'](function(_0x192bdd){if(_0x192bdd){_0x631b83[_0x3d6a('0x65')][_0x3d6a('0x6d')]=_0x192bdd['id'];return db['MailServerOut'][_0x3d6a('0x6a')](_0x631b83[_0x3d6a('0x65')]);}})['then'](respondWithResult(_0x86b6e9,null))[_0x3d6a('0x1a')](handleError(_0x86b6e9,null));};exports['removeSmtp']=function(_0x295341,_0xbd76bd){return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x295341[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0xbd76bd,null))[_0x3d6a('0x11')](function(_0x58b70f){if(_0x58b70f){return _0x58b70f[_0x3d6a('0x82')](null);}return null;})[_0x3d6a('0x11')](respondWithStatusCode(_0xbd76bd,null))[_0x3d6a('0x1a')](handleError(_0xbd76bd,null));};exports['addInteraction']=function(_0x457657,_0x70ba66){return db[_0x3d6a('0x83')][_0x3d6a('0x64')]({'where':{'id':_0x457657[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x70ba66,null))['then'](function(_0x3dd6d9){if(_0x3dd6d9){return _0x3dd6d9['addInteraction'](_0x457657['body'][_0x3d6a('0x6f')],_[_0x3d6a('0x84')](_0x457657[_0x3d6a('0x65')],[_0x3d6a('0x6f'),'id'])||{});}})[_0x3d6a('0x11')](respondWithResult(_0x70ba66,null))[_0x3d6a('0x1a')](handleError(_0x70ba66,null));};exports[_0x3d6a('0x85')]=function(_0x394397,_0x29156d){var _0x547207={'raw':![],'where':{}};var _0x3b0455={};var _0x5a7534={'count':0x0,'rows':[]};return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x394397[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x29156d,null))[_0x3d6a('0x11')](function(_0x1d434c){if(_0x1d434c){_0x3b0455[_0x3d6a('0x4a')]=_['keys'](db[_0x3d6a('0x83')][_0x3d6a('0x47')]);_0x3b0455['query']=_[_0x3d6a('0x4c')](_0x394397[_0x3d6a('0x4b')]);_0x3b0455['filters']=_[_0x3d6a('0x4d')](_0x3b0455['model'],_0x3b0455[_0x3d6a('0x4b')]);_0x547207[_0x3d6a('0x4e')]=_[_0x3d6a('0x4d')](_0x3b0455[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x394397['query'][_0x3d6a('0x4f')]));_0x547207['attributes']=_0x547207[_0x3d6a('0x4e')]['length']?_0x547207[_0x3d6a('0x4e')]:_0x3b0455[_0x3d6a('0x4a')];if(!_0x394397[_0x3d6a('0x4b')][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x547207[_0x3d6a('0x20')]=qs[_0x3d6a('0x20')](_0x394397[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x547207['offset']=qs['offset'](_0x394397[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}_0x547207['order']=qs[_0x3d6a('0x54')](_0x394397[_0x3d6a('0x4b')]['sort']);_0x547207[_0x3d6a('0x55')]=qs[_0x3d6a('0x56')](_['pick'](_0x394397[_0x3d6a('0x4b')],_0x3b0455[_0x3d6a('0x56')]));_0x547207['where']['MailAccountId']=_0x1d434c['id'];if(_0x394397['query'][_0x3d6a('0x58')]){_0x547207[_0x3d6a('0x55')]=_[_0x3d6a('0x59')](_0x547207[_0x3d6a('0x55')],{'$or':_[_0x3d6a('0x45')](_0x547207[_0x3d6a('0x4e')],function(_0x65cfbf){var _0x4069da={};_0x4069da[_0x65cfbf]={'$like':'%'+_0x394397[_0x3d6a('0x4b')][_0x3d6a('0x58')]+'%'};return _0x4069da;})});}_0x547207=_[_0x3d6a('0x59')]({},_0x547207,_0x394397[_0x3d6a('0x5b')]);return db[_0x3d6a('0x83')][_0x3d6a('0x21')]({'where':_0x547207[_0x3d6a('0x55')]})['then'](function(_0x5e6257){_0x5a7534['count']=_0x5e6257;if(_0x394397[_0x3d6a('0x4b')][_0x3d6a('0x5c')]){_0x547207[_0x3d6a('0x5d')]=[{'model':db['CmContact'],'as':_0x3d6a('0x86'),'required':![]},{'model':db['User'],'as':_0x3d6a('0x87'),'attributes':[_0x3d6a('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x3d6a('0x88')],'as':_0x3d6a('0x89'),'attributes':['id',_0x3d6a('0x29'),'color'],'where':_0x394397[_0x3d6a('0x4b')]['tag']?{'id':_0x394397['query'][_0x3d6a('0x8a')]}:undefined,'required':_0x394397[_0x3d6a('0x4b')]['tag']?!![]:![]}];}return db[_0x3d6a('0x83')][_0x3d6a('0x5e')](_0x547207);})[_0x3d6a('0x11')](function(_0x4eea91){_0x5a7534['rows']=_0x4eea91;return _0x5a7534;});}})[_0x3d6a('0x11')](respondWithFilteredResult(_0x29156d,_0x547207))[_0x3d6a('0x1a')](handleError(_0x29156d,null));};exports['addApplications']=function addApplications(_0x4e608d,_0x53c95f){var _0x15a885=_0x4e608d[_0x3d6a('0x68')]['id'];var _0x40857e=_0x4e608d[_0x3d6a('0x65')];var _0x444e73=0xc8;var _0x3359d1=null;return db[_0x3d6a('0x8b')][_0x3d6a('0x8c')]({'isolationLevel':db[_0x3d6a('0x8b')][_0x3d6a('0x8d')][_0x3d6a('0x8e')]['READ_COMMITTED']},function(_0x4d0907){return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x15a885},'transaction':_0x4d0907})[_0x3d6a('0x11')](function(_0x34df2d){if(_0x34df2d){return db['MailApplication'][_0x3d6a('0x25')]({'where':{'MailAccountId':_0x15a885},'transaction':_0x4d0907})[_0x3d6a('0x11')](function(){var _0x23b316=_[_0x3d6a('0x45')](_0x40857e,function(_0x1fee16){_0x1fee16[_0x3d6a('0x6d')]=_0x15a885;return _0x1fee16;});return db[_0x3d6a('0x8f')][_0x3d6a('0x90')](_0x23b316,{'transaction':_0x4d0907});});}else{_0x444e73=0x194;_0x3359d1=[];}});})[_0x3d6a('0x11')](function(){if(_0x444e73!==0x194){return db[_0x3d6a('0x8f')][_0x3d6a('0x91')]({'where':{'MailAccountId':_0x15a885},'order':_0x3d6a('0x92')})['then'](function(_0x444d9f){_0x3359d1=_0x444d9f;});}})[_0x3d6a('0x1a')](function(_0x3e22ee){_0x444e73=0x1f4;logger['error'](_0x3e22ee['stack']);if(_0x3e22ee[_0x3d6a('0x29')]){delete _0x3e22ee[_0x3d6a('0x29')];}_0x3359d1=_0x3e22ee;})[_0x3d6a('0x93')](function(){if(_0x3359d1===null){_0x53c95f[_0x3d6a('0x1b')](_0x444e73);}else{if(_0x444e73===0x1f4){_0x53c95f[_0x3d6a('0x1c')](_0x444e73)[_0x3d6a('0x2a')](_0x3359d1);}else{_0x53c95f[_0x3d6a('0x1c')](_0x444e73)[_0x3d6a('0x1e')](_0x3359d1);}}});};exports[_0x3d6a('0x94')]=function(_0xbafc30,_0x1364f5){var _0x5c7c1c={};var _0x326930={};var _0x4f1497;var _0x5a2b12;return db[_0x3d6a('0x46')]['findOne']({'where':{'id':_0xbafc30['params']['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x1364f5,null))[_0x3d6a('0x11')](function(_0x57c4af){if(_0x57c4af){_0x4f1497=_0x57c4af;_0x326930[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db['MailApplication'][_0x3d6a('0x47')]);_0x326930[_0x3d6a('0x4b')]=_['keys'](_0xbafc30[_0x3d6a('0x4b')]);_0x326930['filters']=_[_0x3d6a('0x4d')](_0x326930['model'],_0x326930[_0x3d6a('0x4b')]);_0x5c7c1c[_0x3d6a('0x4e')]=_[_0x3d6a('0x4d')](_0x326930['model'],qs[_0x3d6a('0x4f')](_0xbafc30['query'][_0x3d6a('0x4f')]));_0x5c7c1c[_0x3d6a('0x4e')]=_0x5c7c1c[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x5c7c1c[_0x3d6a('0x4e')]:_0x326930[_0x3d6a('0x4a')];_0x5c7c1c[_0x3d6a('0x53')]=qs[_0x3d6a('0x54')](_0xbafc30[_0x3d6a('0x4b')][_0x3d6a('0x54')]);_0x5c7c1c[_0x3d6a('0x55')]=qs[_0x3d6a('0x56')](_['pick'](_0xbafc30['query'],_0x326930['filters']));if(_0xbafc30[_0x3d6a('0x4b')]['filter']){_0x5c7c1c[_0x3d6a('0x55')]=_['merge'](_0x5c7c1c[_0x3d6a('0x55')],{'$or':_[_0x3d6a('0x45')](_0x5c7c1c[_0x3d6a('0x4e')],function(_0xff9839){var _0x3f5b2d={};_0x3f5b2d[_0xff9839]={'$like':'%'+_0xbafc30[_0x3d6a('0x4b')][_0x3d6a('0x58')]+'%'};return _0x3f5b2d;})});}_0x5c7c1c=_[_0x3d6a('0x59')]({},_0x5c7c1c,_0xbafc30['options']);return _0x4f1497[_0x3d6a('0x94')](_0x5c7c1c);}})[_0x3d6a('0x11')](function(_0x81a5d8){if(_0x81a5d8){_0x5a2b12=_0x81a5d8[_0x3d6a('0x50')];if(!_0xbafc30[_0x3d6a('0x4b')][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x5c7c1c[_0x3d6a('0x20')]=qs[_0x3d6a('0x20')](_0xbafc30[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x5c7c1c['offset']=qs['offset'](_0xbafc30[_0x3d6a('0x4b')]['offset']);}return _0x4f1497[_0x3d6a('0x94')](_0x5c7c1c);}})['then'](function(_0x1c263c){if(_0x1c263c){return _0x1c263c?{'count':_0x5a2b12,'rows':_0x1c263c}:null;}})['then'](respondWithResult(_0x1364f5,null))[_0x3d6a('0x1a')](handleError(_0x1364f5,null));};exports['getMessages']=function(_0x5e14be,_0x5e738c){var _0x15bddd={'raw':!![],'where':{}};var _0x51de0f={};var _0x2caec8={'count':0x0,'rows':[]};return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x5e14be[_0x3d6a('0x68')]['id']}})['then'](handleEntityNotFound(_0x5e738c,null))[_0x3d6a('0x11')](function(_0x1b9547){if(_0x1b9547){_0x51de0f[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db[_0x3d6a('0x95')][_0x3d6a('0x47')]);_0x51de0f[_0x3d6a('0x4b')]=_[_0x3d6a('0x4c')](_0x5e14be[_0x3d6a('0x4b')]);_0x51de0f['filters']=_[_0x3d6a('0x4d')](_0x51de0f[_0x3d6a('0x4a')],_0x51de0f[_0x3d6a('0x4b')]);_0x15bddd[_0x3d6a('0x4e')]=_[_0x3d6a('0x4d')](_0x51de0f[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x5e14be[_0x3d6a('0x4b')]['fields']));_0x15bddd[_0x3d6a('0x4e')]=_0x15bddd[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x15bddd[_0x3d6a('0x4e')]:_0x51de0f['model'];if(!_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x51')](_0x3d6a('0x52'))){_0x15bddd['limit']=qs[_0x3d6a('0x20')](_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x15bddd[_0x3d6a('0x22')]=qs['offset'](_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}_0x15bddd[_0x3d6a('0x53')]=qs[_0x3d6a('0x54')](_0x5e14be['query'][_0x3d6a('0x54')]);_0x15bddd['where']=qs['filters'](_['pick'](_0x5e14be['query'],_0x51de0f['filters']));_0x15bddd[_0x3d6a('0x55')][_0x3d6a('0x6d')]=_0x1b9547['id'];if(_0x5e14be[_0x3d6a('0x4b')]['filter']){_0x15bddd[_0x3d6a('0x55')]=_[_0x3d6a('0x59')](_0x15bddd['where'],{'$or':_[_0x3d6a('0x45')](_0x15bddd['attributes'],function(_0x599765){var _0xf5ed81={};_0xf5ed81[_0x599765]={'$like':'%'+_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x58')]+'%'};return _0xf5ed81;})});}if(_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x96')]){var _0x5c21ec=_0x5e14be[_0x3d6a('0x4b')]['$gte'][_0x3d6a('0x97')](',');var _0x2851d7={};_0x2851d7[_0x5c21ec[0x0]]={'$gte':moment(_0x5c21ec[0x1])[_0x3d6a('0x98')](_0x3d6a('0x99'))};_0x15bddd['where']=_['merge'](_0x15bddd[_0x3d6a('0x55')],_0x2851d7);}_0x15bddd=_[_0x3d6a('0x59')]({},_0x15bddd,_0x5e14be[_0x3d6a('0x5b')]);return db[_0x3d6a('0x95')][_0x3d6a('0x21')]({'where':_0x15bddd[_0x3d6a('0x55')]})[_0x3d6a('0x11')](function(_0x262933){_0x2caec8[_0x3d6a('0x21')]=_0x262933;if(_0x5e14be[_0x3d6a('0x4b')][_0x3d6a('0x5c')]){_0x15bddd['include']=[{'all':!![]}];}return db[_0x3d6a('0x95')][_0x3d6a('0x5e')](_0x15bddd);})['then'](function(_0x1b8a45){if(_0x5e14be[_0x3d6a('0x4b')]['inlineCss']===_0x3d6a('0x9a')){for(var _0x2d2829=0x0;_0x2d2829<_0x1b8a45['length'];_0x2d2829++){_0x1b8a45[_0x2d2829][_0x3d6a('0x65')]=juice(_0x1b8a45[_0x2d2829][_0x3d6a('0x65')]);}}_0x2caec8[_0x3d6a('0x5f')]=_0x1b8a45;return _0x2caec8;});}})['then'](respondWithFilteredResult(_0x5e738c,_0x15bddd))['catch'](handleError(_0x5e738c,null));};exports[_0x3d6a('0x2a')]=function(_0x5f31fc,_0x38bef4){var _0x5124c4,_0x587e56={},_0xded577;if(_0x5f31fc[_0x3d6a('0x65')]['to']){_0xded577=_0x5f31fc[_0x3d6a('0x65')]['to'][_0x3d6a('0x97')](',')[0x0];}return db[_0x3d6a('0x46')][_0x3d6a('0x64')]({'where':{'id':_0x5f31fc[_0x3d6a('0x68')]['id']},'include':[{'model':db[_0x3d6a('0x9b')],'as':_0x3d6a('0x9c'),'include':[{'model':db[_0x3d6a('0x9d')],'as':_0x3d6a('0x9e'),'where':{'email':_0xded577},'limit':0x1,'order':[[_0x3d6a('0x9f'),_0x3d6a('0xa0')]]}]},{'model':db[_0x3d6a('0x62')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3d6a('0xa1')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x38bef4,null))['then'](function(_0x2cfa90){if(!_0x2cfa90)return;_0x5124c4=_0x2cfa90;if(!_0x2cfa90[_0x3d6a('0x42')])throw new Error(_0x3d6a('0xa2'));if(_[_0x3d6a('0xa3')](_0x5f31fc[_0x3d6a('0x65')][_0x3d6a('0xa4')])){_0x5f31fc[_0x3d6a('0x65')]['from']=util[_0x3d6a('0x98')](_0x3d6a('0xa5'),_0x2cfa90['name'],_0x2cfa90[_0x3d6a('0x74')]||_0x2cfa90[_0x3d6a('0x42')][_0x3d6a('0x3e')]);}if(_0x5f31fc[_0x3d6a('0x65')][_0x3d6a('0xa6')]&&_0x5f31fc['body']['attachments']['length']){for(var _0x35d360=0x0;_0x35d360<_0x5f31fc['body'][_0x3d6a('0xa6')]['length'];_0x35d360+=0x1){_0x5f31fc['body']['attachments'][_0x35d360]={'filename':_0x5f31fc[_0x3d6a('0x65')][_0x3d6a('0xa6')][_0x35d360][_0x3d6a('0x29')],'path':path['join'](config[_0x3d6a('0xa7')],_0x3d6a('0xa8'),_0x5f31fc[_0x3d6a('0x65')][_0x3d6a('0xa6')][_0x35d360][_0x3d6a('0xa9')])};}}var _0x10c72=_0x2cfa90[_0x3d6a('0xaa')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x10c72,'message':_0x5f31fc['body']});})['then'](function(_0x32b0b1){if(!_0x32b0b1)return;_0x587e56=_0x32b0b1;if(!_0x5124c4[_0x3d6a('0x9c')])throw new Error(_0x3d6a('0xab'));if(_0x5124c4[_0x3d6a('0x9c')][_0x3d6a('0x9e')][_0x3d6a('0x50')])return _0x5124c4['List'][_0x3d6a('0x9e')][0x0];return db[_0x3d6a('0x9d')][_0x3d6a('0x6a')](_[_0x3d6a('0xa')](_0x5f31fc[_0x3d6a('0x65')],{'firstName':_0x5f31fc[_0x3d6a('0x65')]['to'],'email':_0x5f31fc[_0x3d6a('0x65')]['to'],'phone':_0x5f31fc[_0x3d6a('0x65')]['to'],'ListId':_0x5124c4[_0x3d6a('0x75')]}));})[_0x3d6a('0x11')](function(_0x3bc5d1){if(!_0x3bc5d1)return;var _0x347c59={'UserId':_0x5f31fc[_0x3d6a('0x3e')]['id'],'ContactId':_0x3bc5d1['id'],'MailAccountId':_0x5124c4['id'],'inReplyTo':_0x587e56['messageId'],'to':_0x5f31fc[_0x3d6a('0x65')]['from'],'cc':_0x5f31fc[_0x3d6a('0x65')]['cc'],'subject':_0x5f31fc[_0x3d6a('0x65')]['subject'],'attach':_0x5f31fc['body'][_0x3d6a('0xac')],'firstMsgDirection':_0x3d6a('0xad'),'lastMsgAt':moment()[_0x3d6a('0x98')](_0x3d6a('0x99')),'lastMsgDirection':_0x3d6a('0xad'),'Messages':[_[_0x3d6a('0x59')](_0x5f31fc['body'],{'messageId':_0x587e56['messageId'],'sentAt':moment()[_0x3d6a('0x98')](_0x3d6a('0x99')),'read':!![],'MailAccountId':_0x5124c4['id'],'UserId':_0x5f31fc[_0x3d6a('0x3e')]['id'],'ContactId':_0x3bc5d1['id']})]};if(_0x5f31fc[_0x3d6a('0x65')]['Interaction']){_0x347c59=_[_0x3d6a('0x59')](_0x347c59,_0x5f31fc[_0x3d6a('0x65')]['Interaction']);}return db[_0x3d6a('0x83')][_0x3d6a('0x6a')](_0x347c59,{'include':[{'model':db['MailMessage'],'as':_0x3d6a('0xae')}]});})[_0x3d6a('0x11')](respondWithResult(_0x38bef4,null))[_0x3d6a('0x1a')](handleError(_0x38bef4,null));};exports['verifySmtp']=function(_0xb1d186,_0x86120d){return db[_0x3d6a('0x46')][_0x3d6a('0x64')]({'where':{'id':_0xb1d186[_0x3d6a('0x68')]['id']},'include':[{'model':db[_0x3d6a('0x62')],'as':_0x3d6a('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x3d6a('0x11')](handleEntityNotFound(_0x86120d,null))[_0x3d6a('0x11')](function(_0x7cdedb){if(!_0x7cdedb[_0x3d6a('0x42')])return;var _0x1a27ed=_0x7cdedb[_0x3d6a('0xaa')]();return respondWithRpcPromise('VerifySmtp',_0x3d6a('0xaf'),{'account':_0x1a27ed});})[_0x3d6a('0x11')](respondWithResult(_0x86120d,null))[_0x3d6a('0x1a')](handleError(_0x86120d,null));};exports[_0x3d6a('0x25')]=function(_0x50eec8,_0x39fbcf){return db['MailAccount']['find']({'where':{'id':_0x50eec8[_0x3d6a('0x68')]['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x39fbcf,null))['then'](function(_0x146693){if(_0x146693&&_0x146693['service']){throw new db[(_0x3d6a('0xb0'))]['ValidationError'](_0x3d6a('0xb1'));}return _0x146693;})[_0x3d6a('0x11')](removeEntity(_0x39fbcf,null))[_0x3d6a('0x1a')](handleError(_0x39fbcf,null));};exports[_0x3d6a('0xb2')]=function(_0x5008fc,_0x4ca7ea){return db['MailAccount']['find']({'where':{'id':_0x5008fc['params']['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x4ca7ea,null))['then'](function(_0xb7042c){if(_0xb7042c){return _0xb7042c[_0x3d6a('0xb2')](_0x5008fc[_0x3d6a('0x65')][_0x3d6a('0x6f')],_[_0x3d6a('0x84')](_0x5008fc[_0x3d6a('0x65')],[_0x3d6a('0x6f'),'id'])||{})[_0x3d6a('0xb3')](function(_0x526656){for(var _0x5e36ed=0x0;_0x5e36ed<_0x5008fc[_0x3d6a('0x65')]['ids']['length'];_0x5e36ed+=0x1){socket[_0x3d6a('0xb4')](_0x3d6a('0xb5'),{'UserId':Number(_0x5008fc[_0x3d6a('0x65')]['ids'][_0x5e36ed]),'MailAccountId':Number(_0x5008fc[_0x3d6a('0x68')]['id'])});}return _0x526656;});}})[_0x3d6a('0x11')](respondWithResult(_0x4ca7ea,null))[_0x3d6a('0x1a')](handleError(_0x4ca7ea,null));};exports[_0x3d6a('0xb6')]=function(_0x5e2740,_0x47008d){return db['MailAccount']['find']({'where':{'id':_0x5e2740['params']['id']}})[_0x3d6a('0x11')](handleEntityNotFound(_0x47008d,null))['then'](function(_0x5da10f){if(_0x5da10f){return _0x5da10f['removeAgents'](_0x5e2740['query']['ids'])['then'](function(){if(_[_0x3d6a('0xb7')](_0x5e2740[_0x3d6a('0x4b')]['ids'])){for(var _0x2889df=0x0;_0x2889df<_0x5e2740[_0x3d6a('0x4b')][_0x3d6a('0x6f')][_0x3d6a('0x50')];_0x2889df+=0x1){socket[_0x3d6a('0xb4')](_0x3d6a('0xb8'),{'UserId':Number(_0x5e2740[_0x3d6a('0x4b')][_0x3d6a('0x6f')][_0x2889df]),'MailAccountId':Number(_0x5e2740['params']['id'])});}}else{socket[_0x3d6a('0xb4')]('userMailAccount:remove',{'UserId':Number(_0x5e2740[_0x3d6a('0x4b')][_0x3d6a('0x6f')]),'MailAccountId':Number(_0x5e2740[_0x3d6a('0x68')]['id'])});}});}})['then'](respondWithStatusCode(_0x47008d,null))[_0x3d6a('0x1a')](handleError(_0x47008d,null));};exports[_0x3d6a('0xb9')]=function(_0x26757f,_0x559b3a){var _0x139951={};var _0x227d4d={};var _0x629723;var _0x444b09;return db[_0x3d6a('0x46')][_0x3d6a('0x6c')]({'where':{'id':_0x26757f['params']['id']}})['then'](handleEntityNotFound(_0x559b3a,null))[_0x3d6a('0x11')](function(_0x3670af){if(_0x3670af){_0x629723=_0x3670af;_0x227d4d[_0x3d6a('0x4a')]=_[_0x3d6a('0x4c')](db['User'][_0x3d6a('0x47')]);_0x227d4d[_0x3d6a('0x4b')]=_['keys'](_0x26757f[_0x3d6a('0x4b')]);_0x227d4d['filters']=_['intersection'](_0x227d4d[_0x3d6a('0x4a')],_0x227d4d['query']);_0x139951[_0x3d6a('0x4e')]=_[_0x3d6a('0x4d')](_0x227d4d[_0x3d6a('0x4a')],qs[_0x3d6a('0x4f')](_0x26757f[_0x3d6a('0x4b')][_0x3d6a('0x4f')]));_0x139951[_0x3d6a('0x4e')]=_0x139951[_0x3d6a('0x4e')][_0x3d6a('0x50')]?_0x139951[_0x3d6a('0x4e')]:_0x227d4d['model'];_0x139951['order']=qs[_0x3d6a('0x54')](_0x26757f[_0x3d6a('0x4b')]['sort']);_0x139951[_0x3d6a('0x55')]=qs[_0x3d6a('0x56')](_[_0x3d6a('0x57')](_0x26757f['query'],_0x227d4d[_0x3d6a('0x56')]));if(_0x26757f[_0x3d6a('0x4b')]['filter']){_0x139951['where']=_[_0x3d6a('0x59')](_0x139951['where'],{'$or':_['map'](_0x139951[_0x3d6a('0x4e')],function(_0x597145){var _0x3a1d25={};_0x3a1d25[_0x597145]={'$like':'%'+_0x26757f['query'][_0x3d6a('0x58')]+'%'};return _0x3a1d25;})});}_0x139951=_[_0x3d6a('0x59')]({},_0x139951,_0x26757f[_0x3d6a('0x5b')]);return _0x629723[_0x3d6a('0xb9')](_0x139951);}})[_0x3d6a('0x11')](function(_0x2b6e77){if(_0x2b6e77){_0x444b09=_0x2b6e77[_0x3d6a('0x50')];if(!_0x26757f['query']['hasOwnProperty'](_0x3d6a('0x52'))){_0x139951['limit']=qs[_0x3d6a('0x20')](_0x26757f[_0x3d6a('0x4b')][_0x3d6a('0x20')]);_0x139951[_0x3d6a('0x22')]=qs[_0x3d6a('0x22')](_0x26757f[_0x3d6a('0x4b')][_0x3d6a('0x22')]);}return _0x629723[_0x3d6a('0xb9')](_0x139951);}})[_0x3d6a('0x11')](function(_0x253426){if(_0x253426){return _0x253426?{'count':_0x444b09,'rows':_0x253426}:null;}})[_0x3d6a('0x11')](respondWithResult(_0x559b3a,null))['catch'](handleError(_0x559b3a,null));}; \ No newline at end of file +var _0x1952=['imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','MailAccount','rows','catch','show','params','find','body','provider','custom','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','pick','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','isNil','active','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','lodash','ioredis','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','status','end','json','undefined','limit','count','offset','Content-Range','destroy','MailAccounts','sendStatus','name','send','gmail','imap.gmail.com','yahoo'];(function(_0x530cdd,_0x3e3a5c){var _0x4d1460=function(_0x48caca){while(--_0x48caca){_0x530cdd['push'](_0x530cdd['shift']());}};_0x4d1460(++_0x3e3a5c);}(_0x1952,0x92));var _0x2195=function(_0x50a24f,_0x7501dc){_0x50a24f=_0x50a24f-0x0;var _0x42e7d6=_0x1952[_0x50a24f];return _0x42e7d6;};'use strict';var moment=require('moment');var BPromise=require(_0x2195('0x0'));var util=require(_0x2195('0x1'));var path=require('path');var _=require(_0x2195('0x2'));var juice=require('juice');var Redis=require(_0x2195('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2195('0x4'));var config=require(_0x2195('0x5'));var db=require('../../mysqldb')['db'];config[_0x2195('0x6')]=_[_0x2195('0x7')](config[_0x2195('0x6')],{'host':_0x2195('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2195('0x9'))[_0x2195('0xa')](socket);var jayson=require(_0x2195('0xb'));var client=jayson[_0x2195('0xc')][_0x2195('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x2fe1d3,_0x2ff10b,_0x2808c3,_0x160111){return new BPromise(function(_0x401e63,_0x137f71){var _0x3d6bf2=_0x160111||client;return _0x3d6bf2[_0x2195('0xe')](_0x2fe1d3,_0x2808c3)[_0x2195('0xf')](function(_0x338044){logger[_0x2195('0x10')](_0x2195('0x11'),_0x2ff10b,_0x2195('0x12'));logger['debug'](_0x2195('0x13'),_0x2ff10b,_0x2195('0x12'),JSON['stringify'](_0x338044));if(_0x338044['error']){if(_0x338044['error'][_0x2195('0x14')]===0x1f4){logger[_0x2195('0x15')](_0x2195('0x11'),_0x2ff10b,_0x338044[_0x2195('0x15')][_0x2195('0x16')]);return _0x137f71(_0x338044['error'][_0x2195('0x16')]);}logger[_0x2195('0x15')](_0x2195('0x11'),_0x2ff10b,_0x338044[_0x2195('0x15')][_0x2195('0x16')]);return _0x401e63(_0x338044[_0x2195('0x15')][_0x2195('0x16')]);}else{logger[_0x2195('0x10')](_0x2195('0x11'),_0x2ff10b,_0x2195('0x12'));_0x401e63(_0x338044['result']['message']);}})['catch'](function(_0x1f11c6){logger[_0x2195('0x15')](_0x2195('0x11'),_0x2ff10b,_0x1f11c6);_0x137f71(_0x1f11c6);});});}function respondWithStatusCode(_0x200be6,_0x1e0c8d){_0x1e0c8d=_0x1e0c8d||0xcc;return function(_0xbf84cf){if(_0xbf84cf){return _0x200be6['sendStatus'](_0x1e0c8d);}return _0x200be6[_0x2195('0x17')](_0x1e0c8d)[_0x2195('0x18')]();};}function respondWithResult(_0x3731db,_0x52e678){_0x52e678=_0x52e678||0xc8;return function(_0x3e24a6){if(_0x3e24a6){return _0x3731db[_0x2195('0x17')](_0x52e678)[_0x2195('0x19')](_0x3e24a6);}};}function respondWithFilteredResult(_0x116b80,_0x31e1ff){return function(_0x5babb3){if(_0x5babb3){var _0x21966b=typeof _0x31e1ff['offset']===_0x2195('0x1a')&&typeof _0x31e1ff[_0x2195('0x1b')]===_0x2195('0x1a');var _0x3b16a4=_0x5babb3[_0x2195('0x1c')];var _0x375cf0=_0x21966b?0x0:_0x31e1ff[_0x2195('0x1d')];var _0x207e8d=_0x21966b?_0x5babb3[_0x2195('0x1c')]:_0x31e1ff[_0x2195('0x1d')]+_0x31e1ff['limit'];var _0x1853d1;if(_0x207e8d>=_0x3b16a4){_0x207e8d=_0x3b16a4;_0x1853d1=0xc8;}else{_0x1853d1=0xce;}_0x116b80[_0x2195('0x17')](_0x1853d1);return _0x116b80['set'](_0x2195('0x1e'),_0x375cf0+'-'+_0x207e8d+'/'+_0x3b16a4)[_0x2195('0x19')](_0x5babb3);}return null;};}function saveUpdates(_0x24bc76){return function(_0x417bc8){if(_0x417bc8){return _0x417bc8['update'](_0x24bc76)['then'](function(_0x1cabeb){return _0x1cabeb;});}return null;};}function removeEntity(_0x4a6c94){return function(_0xd1698){if(_0xd1698){return _0xd1698[_0x2195('0x1f')]()['then'](function(){var _0x1d9597=_0xd1698['get']({'plain':!![]});var _0x263016=_0x2195('0x20');return db['UserProfileResource'][_0x2195('0x1f')]({'where':{'type':_0x263016,'resourceId':_0x1d9597['id']}})[_0x2195('0xf')](function(){return _0xd1698;});})[_0x2195('0xf')](function(){_0x4a6c94['status'](0xcc)[_0x2195('0x18')]();});}};}function handleEntityNotFound(_0x4520a5){return function(_0x330ce2){if(!_0x330ce2){_0x4520a5[_0x2195('0x21')](0x194);}return _0x330ce2;};}function handleError(_0x25ee5a,_0x12ad0f){_0x12ad0f=_0x12ad0f||0x1f4;return function(_0xbb6d02){logger[_0x2195('0x15')](_0xbb6d02['stack']);if(_0xbb6d02[_0x2195('0x22')]){delete _0xbb6d02['name'];}_0x25ee5a['status'](_0x12ad0f)[_0x2195('0x23')](_0xbb6d02);};}function getImapHost(_0x3e5b21){switch(_0x3e5b21){case _0x2195('0x24'):return _0x2195('0x25');case _0x2195('0x26'):return _0x2195('0x27');case _0x2195('0x28'):return _0x2195('0x29');case _0x2195('0x2a'):return _0x2195('0x2b');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3e5b21);}function getSmtpHost(_0x599bde){switch(_0x599bde){case'gmail':return'smtp.gmail.com';case'yahoo':return _0x2195('0x2c');case _0x2195('0x28'):return _0x2195('0x2d');case'outlook365':return _0x2195('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x599bde);}function getAuthenticationOptions(_0x4036ee,_0x42672d){var _0x4a74f2={};var _0x39d1f0={};if(_0x4036ee){_0x4a74f2[_0x2195('0x2f')]=_0x39d1f0['user']=_0x42672d[_0x2195('0x30')];_0x4a74f2[_0x2195('0x31')]=_0x39d1f0[_0x2195('0x32')]=_0x42672d[_0x2195('0x31')];if(_0x42672d['modernAuthentication']){_0x4a74f2[_0x2195('0x33')]=_0x39d1f0[_0x2195('0x33')]=!![];_0x4a74f2[_0x2195('0x34')]=_0x39d1f0[_0x2195('0x34')]=_0x42672d[_0x2195('0x34')];_0x4a74f2[_0x2195('0x31')]=_0x39d1f0['pass']=null;}else{_0x4a74f2[_0x2195('0x34')]=_0x39d1f0['CloudProviderId']=null;}_0x4a74f2['host']=getImapHost(_0x4036ee);_0x4a74f2['port']=0x3e1;_0x39d1f0['host']=getSmtpHost(_0x4036ee);_0x39d1f0[_0x2195('0x35')]=0x24b;_0x39d1f0[_0x2195('0x36')]=![];_0x4a74f2['service']=_0x39d1f0[_0x2195('0x37')]=null;}else{if(_0x42672d['authentication']){_0x4a74f2[_0x2195('0x2f')]=_0x39d1f0[_0x2195('0x2f')]=_0x42672d[_0x2195('0x30')];_0x4a74f2[_0x2195('0x31')]=_0x39d1f0[_0x2195('0x32')]=_0x42672d[_0x2195('0x31')];}else{_0x4a74f2[_0x2195('0x38')]=_0x39d1f0[_0x2195('0x38')]=![];_0x4a74f2[_0x2195('0x2f')]=_0x39d1f0['user']=null;_0x4a74f2[_0x2195('0x31')]=_0x39d1f0[_0x2195('0x32')]=null;}_0x4a74f2[_0x2195('0x39')]=_0x42672d[_0x2195('0x3a')][_0x2195('0x39')];_0x4a74f2[_0x2195('0x35')]=_0x42672d[_0x2195('0x3a')][_0x2195('0x35')];_0x39d1f0['host']=_0x42672d[_0x2195('0x3b')][_0x2195('0x39')];_0x39d1f0['port']=_0x42672d[_0x2195('0x3b')][_0x2195('0x35')];}return{'Imap':_0x4a74f2,'Smtp':_0x39d1f0};}exports[_0x2195('0x3c')]=function(_0x13a4db,_0x585000){var _0x26469a={'include':[{'model':db[_0x2195('0x3d')],'as':_0x2195('0x3a')},{'model':db[_0x2195('0x3e')],'as':_0x2195('0x3b')},{'model':db[_0x2195('0x3f')],'as':_0x2195('0x40')}]},_0xdc9488={},_0x2deb88={'count':0x0,'rows':[]};var _0x398a92=_[_0x2195('0x41')](db['MailAccount']['rawAttributes'],function(_0x4ef4a2){return{'name':_0x4ef4a2[_0x2195('0x42')],'type':_0x4ef4a2[_0x2195('0x43')]['key']};});_0xdc9488[_0x2195('0x44')]=_['map'](_0x398a92,_0x2195('0x22'));_0xdc9488[_0x2195('0x45')]=_[_0x2195('0x46')](_0x13a4db[_0x2195('0x45')]);_0xdc9488['filters']=_[_0x2195('0x47')](_0xdc9488[_0x2195('0x44')],_0xdc9488['query']);_0x26469a['attributes']=_[_0x2195('0x47')](_0xdc9488[_0x2195('0x44')],qs[_0x2195('0x48')](_0x13a4db['query'][_0x2195('0x48')]));_0x26469a[_0x2195('0x49')]=_0x26469a[_0x2195('0x49')][_0x2195('0x4a')]?_0x26469a[_0x2195('0x49')]:_0xdc9488[_0x2195('0x44')];if(!_0x13a4db['query']['hasOwnProperty'](_0x2195('0x4b'))){_0x26469a[_0x2195('0x1b')]=qs[_0x2195('0x1b')](_0x13a4db[_0x2195('0x45')]['limit']);_0x26469a['offset']=qs[_0x2195('0x1d')](_0x13a4db['query'][_0x2195('0x1d')]);}_0x26469a[_0x2195('0x4c')]=qs[_0x2195('0x4d')](_0x13a4db[_0x2195('0x45')][_0x2195('0x4d')]);_0x26469a[_0x2195('0x4e')]=qs['filters'](_['pick'](_0x13a4db['query'],_0xdc9488[_0x2195('0x4f')]),_0x398a92);if(_0x13a4db[_0x2195('0x45')][_0x2195('0x50')]){_0x26469a[_0x2195('0x4e')]=_[_0x2195('0x51')](_0x26469a[_0x2195('0x4e')],{'$or':_[_0x2195('0x41')](_0x398a92,function(_0x473c90){if(_0x473c90[_0x2195('0x43')]!=='VIRTUAL'){var _0x12ad2b={};_0x12ad2b[_0x473c90['name']]={'$like':'%'+_0x13a4db[_0x2195('0x45')]['filter']+'%'};return _0x12ad2b;}})});}_0x26469a=_[_0x2195('0x51')]({},_0x26469a,_0x13a4db[_0x2195('0x52')]);var _0x45d634={'where':_0x26469a[_0x2195('0x4e')]};return db['MailAccount']['count'](_0x45d634)[_0x2195('0xf')](function(_0x5eeedc){_0x2deb88[_0x2195('0x1c')]=_0x5eeedc;if(_0x13a4db[_0x2195('0x45')][_0x2195('0x53')]){_0x26469a['include']=[{'all':!![]}];}return db[_0x2195('0x54')]['findAll'](_0x26469a);})[_0x2195('0xf')](function(_0x59f667){_0x2deb88[_0x2195('0x55')]=_0x59f667;return _0x2deb88;})['then'](respondWithFilteredResult(_0x585000,_0x26469a))[_0x2195('0x56')](handleError(_0x585000,null));};exports[_0x2195('0x57')]=function(_0x26be47,_0x474ff8){var _0x11cdff={'raw':![],'where':{'id':_0x26be47[_0x2195('0x58')]['id']},'include':[{'model':db[_0x2195('0x3d')],'as':_0x2195('0x3a')},{'model':db[_0x2195('0x3e')],'as':_0x2195('0x3b')},{'model':db[_0x2195('0x3f')],'as':_0x2195('0x40')}]},_0x2672c0={};_0x2672c0[_0x2195('0x44')]=_[_0x2195('0x46')](db['MailAccount']['rawAttributes']);_0x2672c0[_0x2195('0x45')]=_[_0x2195('0x46')](_0x26be47[_0x2195('0x45')]);_0x2672c0[_0x2195('0x4f')]=_[_0x2195('0x47')](_0x2672c0['model'],_0x2672c0[_0x2195('0x45')]);_0x11cdff[_0x2195('0x49')]=_[_0x2195('0x47')](_0x2672c0[_0x2195('0x44')],qs[_0x2195('0x48')](_0x26be47[_0x2195('0x45')][_0x2195('0x48')]));_0x11cdff['attributes']=_0x11cdff[_0x2195('0x49')][_0x2195('0x4a')]?_0x11cdff[_0x2195('0x49')]:_0x2672c0[_0x2195('0x44')];if(_0x26be47[_0x2195('0x45')][_0x2195('0x53')]){_0x11cdff['include']=[{'all':!![]}];}_0x11cdff=_[_0x2195('0x51')]({},_0x11cdff,_0x26be47[_0x2195('0x52')]);return db[_0x2195('0x54')][_0x2195('0x59')](_0x11cdff)[_0x2195('0xf')](handleEntityNotFound(_0x474ff8,null))[_0x2195('0xf')](respondWithResult(_0x474ff8,null))[_0x2195('0x56')](handleError(_0x474ff8,null));};exports['update']=function(_0xe1d2c6,_0x56ee5b){if(_0xe1d2c6[_0x2195('0x5a')]['id']){delete _0xe1d2c6[_0x2195('0x5a')]['id'];}var _0x53f68f=_0xe1d2c6['body'][_0x2195('0x5b')]===_0x2195('0x5c')?null:_0xe1d2c6[_0x2195('0x5a')][_0x2195('0x5b')];var _0x255556=_0xe1d2c6[_0x2195('0x5a')][_0x2195('0x3a')]||{};var _0x25cc7d=_0xe1d2c6[_0x2195('0x5a')][_0x2195('0x3b')]||{};if(_0x53f68f){_0x255556['host']=getImapHost(_0x53f68f);_0x255556[_0x2195('0x35')]=0x3e1;_0x25cc7d['host']=getSmtpHost(_0x53f68f);_0x25cc7d[_0x2195('0x35')]=0x24b;_0x25cc7d['secure']=![];}if(_0x25cc7d['modernAuthentication']){_0x25cc7d[_0x2195('0x36')]=![];}else{_0x25cc7d['CloudProviderId']=null;}if(!_0x255556[_0x2195('0x33')])_0x255556[_0x2195('0x34')]=null;_0xe1d2c6[_0x2195('0x5a')]['Imap']=_0x255556;_0xe1d2c6[_0x2195('0x5a')]['Smtp']=_0x25cc7d;return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0xe1d2c6[_0x2195('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x2195('0x40')}]})[_0x2195('0xf')](handleEntityNotFound(_0x56ee5b,null))[_0x2195('0xf')](function(_0x52a49b){if(!_0x52a49b)throw new Error(_0x2195('0x5d'));if(_0x52a49b[_0x2195('0x37')])delete _0xe1d2c6[_0x2195('0x5a')][_0x2195('0x3a')];return _0x52a49b;})[_0x2195('0xf')](saveUpdates(_0xe1d2c6['body'],null))[_0x2195('0xf')](function(_0x155de9){if(!_0xe1d2c6['body'][_0x2195('0x3a')])return _0x155de9;return db[_0x2195('0x3d')][_0x2195('0x5e')](_0xe1d2c6['body'][_0x2195('0x3a')],{'where':{'MailAccountId':_0x155de9['id']}})[_0x2195('0xf')](function(){return _0x155de9;});})[_0x2195('0xf')](function(_0x5b9d19){if(!_0xe1d2c6[_0x2195('0x5a')]['Smtp'])return _0x5b9d19;return db['MailServerOut'][_0x2195('0x5e')](_0xe1d2c6[_0x2195('0x5a')][_0x2195('0x3b')],{'where':{'MailAccountId':_0x5b9d19['id']}})[_0x2195('0xf')](function(){return _0x5b9d19;});})[_0x2195('0xf')](respondWithResult(_0x56ee5b,null))['catch'](handleError(_0x56ee5b,null));};exports[_0x2195('0x5f')]=function(_0x30af3c,_0x4b010c){return db[_0x2195('0x54')][_0x2195('0x5f')]()[_0x2195('0xf')](respondWithResult(_0x4b010c,null))[_0x2195('0x56')](handleError(_0x4b010c,null));};exports[_0x2195('0x60')]=function(_0x446538,_0x22ebf4){if(_0x446538['body']['id']){delete _0x446538[_0x2195('0x5a')]['id'];}return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x446538['params']['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x22ebf4,null))[_0x2195('0xf')](function(_0x3ec1bd){if(_0x3ec1bd){_0x446538[_0x2195('0x5a')][_0x2195('0x61')]=_0x3ec1bd['id'];return db[_0x2195('0x62')][_0x2195('0x63')](_0x446538[_0x2195('0x5a')]);}})[_0x2195('0xf')](respondWithResult(_0x22ebf4,null))['catch'](handleError(_0x22ebf4,null));};exports[_0x2195('0x64')]=function(_0x13a555,_0x5e9b2b){var _0xb13963={'raw':![],'where':{}};var _0x2c5474={};var _0xd6e6dc={'count':0x0,'rows':[]};return db['MailAccount'][_0x2195('0x65')]({'where':{'id':_0x13a555[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x5e9b2b,null))[_0x2195('0xf')](function(_0x52e519){if(_0x52e519){_0x2c5474[_0x2195('0x44')]=_[_0x2195('0x46')](db[_0x2195('0x62')][_0x2195('0x66')]);_0x2c5474['query']=_[_0x2195('0x46')](_0x13a555[_0x2195('0x45')]);_0x2c5474[_0x2195('0x4f')]=_['intersection'](_0x2c5474[_0x2195('0x44')],_0x2c5474[_0x2195('0x45')]);_0xb13963['attributes']=_[_0x2195('0x47')](_0x2c5474[_0x2195('0x44')],qs[_0x2195('0x48')](_0x13a555[_0x2195('0x45')]['fields']));_0xb13963['attributes']=_0xb13963[_0x2195('0x49')][_0x2195('0x4a')]?_0xb13963['attributes']:_0x2c5474['model'];if(!_0x13a555[_0x2195('0x45')][_0x2195('0x67')](_0x2195('0x4b'))){_0xb13963[_0x2195('0x1b')]=qs[_0x2195('0x1b')](_0x13a555['query'][_0x2195('0x1b')]);_0xb13963[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x13a555[_0x2195('0x45')][_0x2195('0x1d')]);}_0xb13963['order']=qs[_0x2195('0x4d')](_0x13a555[_0x2195('0x45')]['sort']);_0xb13963[_0x2195('0x4e')]=qs['filters'](_[_0x2195('0x68')](_0x13a555[_0x2195('0x45')],_0x2c5474[_0x2195('0x4f')]));_0xb13963[_0x2195('0x4e')][_0x2195('0x61')]=_0x52e519['id'];if(_0x13a555['query'][_0x2195('0x50')]){_0xb13963[_0x2195('0x4e')]=_['merge'](_0xb13963['where'],{'$or':_[_0x2195('0x41')](_0xb13963[_0x2195('0x49')],function(_0x220541){var _0x46fb16={};_0x46fb16[_0x220541]={'$like':'%'+_0x13a555[_0x2195('0x45')][_0x2195('0x50')]+'%'};return _0x46fb16;})});}_0xb13963=_[_0x2195('0x51')]({},_0xb13963,_0x13a555[_0x2195('0x52')]);return db[_0x2195('0x62')][_0x2195('0x1c')]({'where':_0xb13963[_0x2195('0x4e')]})[_0x2195('0xf')](function(_0x172e0e){_0xd6e6dc['count']=_0x172e0e;if(_0x13a555[_0x2195('0x45')]['includeAll']){_0xb13963[_0x2195('0x69')]=[{'all':!![]}];}return db[_0x2195('0x62')][_0x2195('0x6a')](_0xb13963);})[_0x2195('0xf')](function(_0x59f385){_0xd6e6dc[_0x2195('0x55')]=_0x59f385;return _0xd6e6dc;});}})[_0x2195('0xf')](respondWithFilteredResult(_0x5e9b2b,_0xb13963))[_0x2195('0x56')](handleError(_0x5e9b2b,null));};exports[_0x2195('0x6b')]=function(_0x145e6d,_0x2c903d){return db['MailAccount'][_0x2195('0x59')]({'where':{'id':_0x145e6d['params']['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x2c903d,null))[_0x2195('0xf')](function(_0x3d1c84){if(_0x3d1c84){return _0x3d1c84[_0x2195('0x6b')](_0x145e6d['query'][_0x2195('0x6c')]);}})[_0x2195('0xf')](respondWithStatusCode(_0x2c903d,null))['catch'](handleError(_0x2c903d,null));};exports[_0x2195('0x6d')]=function(_0xd54664,_0x17b891){if(_0xd54664[_0x2195('0x5a')]['id']){delete _0xd54664['body']['id'];}return db['MailAccount'][_0x2195('0x59')]({'where':{'id':_0xd54664[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0x17b891,null))[_0x2195('0xf')](function(_0x5a91){if(_0x5a91){_0xd54664[_0x2195('0x5a')][_0x2195('0x61')]=_0x5a91['id'];return db['CannedAnswer'][_0x2195('0x63')](_0xd54664[_0x2195('0x5a')]);}})[_0x2195('0xf')](respondWithResult(_0x17b891,null))[_0x2195('0x56')](handleError(_0x17b891,null));};exports['getAnswers']=function(_0x4c39f6,_0x18a66a){var _0xb27da0={'raw':![],'where':{}};var _0x30463e={};var _0x5a58ce={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4c39f6[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x18a66a,null))[_0x2195('0xf')](function(_0x4cb21){if(_0x4cb21){_0x30463e[_0x2195('0x44')]=_['keys'](db['CannedAnswer'][_0x2195('0x66')]);_0x30463e[_0x2195('0x45')]=_[_0x2195('0x46')](_0x4c39f6[_0x2195('0x45')]);_0x30463e['filters']=_[_0x2195('0x47')](_0x30463e[_0x2195('0x44')],_0x30463e[_0x2195('0x45')]);_0xb27da0[_0x2195('0x49')]=_[_0x2195('0x47')](_0x30463e['model'],qs[_0x2195('0x48')](_0x4c39f6['query']['fields']));_0xb27da0[_0x2195('0x49')]=_0xb27da0['attributes'][_0x2195('0x4a')]?_0xb27da0[_0x2195('0x49')]:_0x30463e[_0x2195('0x44')];if(!_0x4c39f6[_0x2195('0x45')]['hasOwnProperty'](_0x2195('0x4b'))){_0xb27da0[_0x2195('0x1b')]=qs[_0x2195('0x1b')](_0x4c39f6[_0x2195('0x45')][_0x2195('0x1b')]);_0xb27da0[_0x2195('0x1d')]=qs['offset'](_0x4c39f6[_0x2195('0x45')][_0x2195('0x1d')]);}_0xb27da0['order']=qs[_0x2195('0x4d')](_0x4c39f6[_0x2195('0x45')]['sort']);_0xb27da0['where']=qs[_0x2195('0x4f')](_['pick'](_0x4c39f6[_0x2195('0x45')],_0x30463e[_0x2195('0x4f')]));_0xb27da0[_0x2195('0x4e')][_0x2195('0x61')]=_0x4cb21['id'];if(_0x4c39f6[_0x2195('0x45')][_0x2195('0x50')]){_0xb27da0[_0x2195('0x4e')]=_[_0x2195('0x51')](_0xb27da0[_0x2195('0x4e')],{'$or':_[_0x2195('0x41')](_0xb27da0[_0x2195('0x49')],function(_0x11a426){var _0x10b9fd={};_0x10b9fd[_0x11a426]={'$like':'%'+_0x4c39f6['query'][_0x2195('0x50')]+'%'};return _0x10b9fd;})});}_0xb27da0=_['merge']({},_0xb27da0,_0x4c39f6['options']);return db['CannedAnswer'][_0x2195('0x1c')]({'where':_0xb27da0[_0x2195('0x4e')]})[_0x2195('0xf')](function(_0x3dc259){_0x5a58ce[_0x2195('0x1c')]=_0x3dc259;if(_0x4c39f6[_0x2195('0x45')][_0x2195('0x53')]){_0xb27da0[_0x2195('0x69')]=[{'all':!![]}];}return db[_0x2195('0x6e')][_0x2195('0x6a')](_0xb27da0);})[_0x2195('0xf')](function(_0x4cc6a5){_0x5a58ce[_0x2195('0x55')]=_0x4cc6a5;return _0x5a58ce;});}})[_0x2195('0xf')](respondWithFilteredResult(_0x18a66a,_0xb27da0))[_0x2195('0x56')](handleError(_0x18a66a,null));};exports[_0x2195('0x6f')]=function(_0x36f37f,_0x68766d){return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x36f37f[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x68766d,null))[_0x2195('0xf')](function(_0x452b57){if(_0x452b57){return _0x452b57[_0x2195('0x6f')](_0x36f37f[_0x2195('0x45')][_0x2195('0x6c')]);}})[_0x2195('0xf')](respondWithStatusCode(_0x68766d,null))[_0x2195('0x56')](handleError(_0x68766d,null));};exports['create']=function(_0x444ad2,_0x3f4e6b){var _0x536d43={'name':_0x444ad2[_0x2195('0x5a')][_0x2195('0x22')],'key':_0x444ad2[_0x2195('0x5a')]['key'],'provider':_0x444ad2[_0x2195('0x5a')][_0x2195('0x5b')]==='custom'?null:_0x444ad2['body']['provider'],'email':_0x444ad2[_0x2195('0x5a')]['email'],'ListId':_0x444ad2[_0x2195('0x5a')][_0x2195('0x70')],'active':!_[_0x2195('0x71')](_0x444ad2[_0x2195('0x5a')][_0x2195('0x72')])?_0x444ad2['body'][_0x2195('0x72')]:!![],'description':_0x444ad2[_0x2195('0x5a')]['description']||null};var _0x10e82b=getAuthenticationOptions(_0x536d43['provider'],_0x444ad2[_0x2195('0x5a')]);_0x536d43[_0x2195('0x3a')]=_0x10e82b[_0x2195('0x3a')];_0x536d43[_0x2195('0x3b')]=_0x10e82b['Smtp'];return db[_0x2195('0x54')][_0x2195('0x63')](_0x536d43,{'include':[{'model':db[_0x2195('0x3e')],'as':'Smtp'},{'model':db[_0x2195('0x3d')],'as':_0x2195('0x3a')}]})[_0x2195('0xf')](function(_0x1cf560){var _0x25a20b=_0x444ad2[_0x2195('0x2f')][_0x2195('0x73')]({'plain':!![]});if(!_0x25a20b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25a20b[_0x2195('0x74')]==='user'){var _0x3c3362=_0x1cf560[_0x2195('0x73')]({'plain':!![]});return db[_0x2195('0x75')][_0x2195('0x59')]({'where':{'name':'MailAccounts','userProfileId':_0x25a20b[_0x2195('0x76')]},'raw':!![]})[_0x2195('0xf')](function(_0x2d1be0){if(_0x2d1be0&&_0x2d1be0[_0x2195('0x77')]===0x0){return db[_0x2195('0x78')][_0x2195('0x63')]({'name':_0x3c3362[_0x2195('0x22')],'resourceId':_0x3c3362['id'],'type':_0x2d1be0[_0x2195('0x22')],'sectionId':_0x2d1be0['id']},{})[_0x2195('0xf')](function(){return _0x1cf560;});}else{return _0x1cf560;}})[_0x2195('0x56')](function(_0x4bb91d){logger[_0x2195('0x15')](_0x2195('0x79'),_0x4bb91d);throw _0x4bb91d;});}return _0x1cf560;})['then'](respondWithResult(_0x3f4e6b,0xc9))[_0x2195('0x56')](handleError(_0x3f4e6b,null));};exports[_0x2195('0x7a')]=function(_0x2bae44,_0x252010){return db['MailAccount'][_0x2195('0x65')]({'where':{'id':_0x2bae44[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x252010,null))['then'](function(_0x2cfe2a){if(_0x2cfe2a){return _0x2cfe2a[_0x2195('0x7a')]();}return null;})[_0x2195('0xf')](respondWithResult(_0x252010,null))['catch'](handleError(_0x252010,null));};exports[_0x2195('0x7b')]=function(_0x28577b,_0x5a0552){if(_0x28577b[_0x2195('0x5a')]['id']){delete _0x28577b[_0x2195('0x5a')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x28577b[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x5a0552,null))['then'](function(_0x2632d9){if(_0x2632d9){_0x28577b[_0x2195('0x5a')][_0x2195('0x61')]=_0x2632d9['id'];return db[_0x2195('0x3d')]['create'](_0x28577b[_0x2195('0x5a')]);}})[_0x2195('0xf')](respondWithResult(_0x5a0552,null))['catch'](handleError(_0x5a0552,null));};exports[_0x2195('0x7c')]=function(_0x3aeee0,_0xdb569){return db['MailAccount'][_0x2195('0x65')]({'where':{'id':_0x3aeee0[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0xdb569,null))[_0x2195('0xf')](function(_0x2bf3af){if(_0x2bf3af){return _0x2bf3af[_0x2195('0x7d')](null);}return null;})['then'](respondWithStatusCode(_0xdb569,null))[_0x2195('0x56')](handleError(_0xdb569,null));};exports[_0x2195('0x7e')]=function(_0x1ccdf9,_0x5f3d90){return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x1ccdf9[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0x5f3d90,null))[_0x2195('0xf')](function(_0x47a6f1){if(_0x47a6f1){return _0x47a6f1[_0x2195('0x7e')]();}return null;})[_0x2195('0xf')](respondWithResult(_0x5f3d90,null))[_0x2195('0x56')](handleError(_0x5f3d90,null));};exports['addSmtp']=function(_0x3aa473,_0x245efc){if(_0x3aa473[_0x2195('0x5a')]['id']){delete _0x3aa473[_0x2195('0x5a')]['id'];}return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x3aa473[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x245efc,null))[_0x2195('0xf')](function(_0x449751){if(_0x449751){_0x3aa473[_0x2195('0x5a')][_0x2195('0x61')]=_0x449751['id'];return db[_0x2195('0x3e')]['create'](_0x3aa473[_0x2195('0x5a')]);}})['then'](respondWithResult(_0x245efc,null))[_0x2195('0x56')](handleError(_0x245efc,null));};exports[_0x2195('0x7f')]=function(_0x4577cc,_0x3b4d77){return db['MailAccount'][_0x2195('0x65')]({'where':{'id':_0x4577cc[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x3b4d77,null))['then'](function(_0x10bfde){if(_0x10bfde){return _0x10bfde[_0x2195('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x3b4d77,null))[_0x2195('0x56')](handleError(_0x3b4d77,null));};exports[_0x2195('0x81')]=function(_0x3ae612,_0x42a8e6){return db[_0x2195('0x82')][_0x2195('0x59')]({'where':{'id':_0x3ae612[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0x42a8e6,null))[_0x2195('0xf')](function(_0x118352){if(_0x118352){return _0x118352[_0x2195('0x81')](_0x3ae612[_0x2195('0x5a')][_0x2195('0x6c')],_['omit'](_0x3ae612['body'],[_0x2195('0x6c'),'id'])||{});}})[_0x2195('0xf')](respondWithResult(_0x42a8e6,null))[_0x2195('0x56')](handleError(_0x42a8e6,null));};exports[_0x2195('0x83')]=function(_0x469a1b,_0x3e4e51){var _0x47ed09={'raw':![],'where':{}};var _0x3565e2={};var _0x4ab6d3={'count':0x0,'rows':[]};return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x469a1b['params']['id']}})['then'](handleEntityNotFound(_0x3e4e51,null))[_0x2195('0xf')](function(_0x46ded7){if(_0x46ded7){_0x3565e2[_0x2195('0x44')]=_[_0x2195('0x46')](db['MailInteraction']['rawAttributes']);_0x3565e2[_0x2195('0x45')]=_[_0x2195('0x46')](_0x469a1b[_0x2195('0x45')]);_0x3565e2[_0x2195('0x4f')]=_[_0x2195('0x47')](_0x3565e2[_0x2195('0x44')],_0x3565e2[_0x2195('0x45')]);_0x47ed09[_0x2195('0x49')]=_['intersection'](_0x3565e2[_0x2195('0x44')],qs[_0x2195('0x48')](_0x469a1b['query']['fields']));_0x47ed09['attributes']=_0x47ed09[_0x2195('0x49')][_0x2195('0x4a')]?_0x47ed09['attributes']:_0x3565e2['model'];if(!_0x469a1b[_0x2195('0x45')]['hasOwnProperty'](_0x2195('0x4b'))){_0x47ed09[_0x2195('0x1b')]=qs['limit'](_0x469a1b[_0x2195('0x45')][_0x2195('0x1b')]);_0x47ed09[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x469a1b['query'][_0x2195('0x1d')]);}_0x47ed09[_0x2195('0x4c')]=qs[_0x2195('0x4d')](_0x469a1b['query'][_0x2195('0x4d')]);_0x47ed09[_0x2195('0x4e')]=qs[_0x2195('0x4f')](_[_0x2195('0x68')](_0x469a1b[_0x2195('0x45')],_0x3565e2[_0x2195('0x4f')]));_0x47ed09[_0x2195('0x4e')]['MailAccountId']=_0x46ded7['id'];if(_0x469a1b[_0x2195('0x45')][_0x2195('0x50')]){_0x47ed09[_0x2195('0x4e')]=_['merge'](_0x47ed09[_0x2195('0x4e')],{'$or':_[_0x2195('0x41')](_0x47ed09['attributes'],function(_0x220bb3){var _0x4897a7={};_0x4897a7[_0x220bb3]={'$like':'%'+_0x469a1b['query']['filter']+'%'};return _0x4897a7;})});}_0x47ed09=_[_0x2195('0x51')]({},_0x47ed09,_0x469a1b[_0x2195('0x52')]);return db[_0x2195('0x82')]['count']({'where':_0x47ed09[_0x2195('0x4e')]})[_0x2195('0xf')](function(_0x2c9aab){_0x4ab6d3['count']=_0x2c9aab;if(_0x469a1b['query']['includeAll']){_0x47ed09[_0x2195('0x69')]=[{'model':db[_0x2195('0x84')],'as':_0x2195('0x85'),'required':![]},{'model':db[_0x2195('0x86')],'as':'Owner','attributes':[_0x2195('0x22'),_0x2195('0x87'),_0x2195('0x88')],'required':![]},{'model':db[_0x2195('0x89')],'as':_0x2195('0x8a'),'attributes':['id',_0x2195('0x22'),'color'],'where':_0x469a1b[_0x2195('0x45')][_0x2195('0x8b')]?{'id':_0x469a1b[_0x2195('0x45')][_0x2195('0x8b')]}:undefined,'required':_0x469a1b['query'][_0x2195('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0x2195('0x6a')](_0x47ed09);})[_0x2195('0xf')](function(_0x3c3063){_0x4ab6d3[_0x2195('0x55')]=_0x3c3063;return _0x4ab6d3;});}})[_0x2195('0xf')](respondWithFilteredResult(_0x3e4e51,_0x47ed09))[_0x2195('0x56')](handleError(_0x3e4e51,null));};exports[_0x2195('0x8c')]=function addApplications(_0x1db693,_0x554d4e){var _0x223950=_0x1db693['params']['id'];var _0x53250c=_0x1db693[_0x2195('0x5a')];var _0x508332=0xc8;var _0x50b183=null;return db[_0x2195('0x8d')]['transaction']({'isolationLevel':db[_0x2195('0x8d')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xff1ba2){return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x223950},'transaction':_0xff1ba2})[_0x2195('0xf')](function(_0x422357){if(_0x422357){return db[_0x2195('0x8e')][_0x2195('0x1f')]({'where':{'MailAccountId':_0x223950},'transaction':_0xff1ba2})[_0x2195('0xf')](function(){var _0x309534=_[_0x2195('0x41')](_0x53250c,function(_0x1be94c){_0x1be94c[_0x2195('0x61')]=_0x223950;return _0x1be94c;});return db[_0x2195('0x8e')]['bulkCreate'](_0x309534,{'transaction':_0xff1ba2});});}else{_0x508332=0x194;_0x50b183=[];}});})[_0x2195('0xf')](function(){if(_0x508332!==0x194){return db[_0x2195('0x8e')][_0x2195('0x8f')]({'where':{'MailAccountId':_0x223950},'order':_0x2195('0x90')})[_0x2195('0xf')](function(_0x46cded){_0x50b183=_0x46cded;});}})['catch'](function(_0x45f959){_0x508332=0x1f4;logger['error'](_0x45f959[_0x2195('0x91')]);if(_0x45f959[_0x2195('0x22')]){delete _0x45f959['name'];}_0x50b183=_0x45f959;})[_0x2195('0x92')](function(){if(_0x50b183===null){_0x554d4e[_0x2195('0x21')](_0x508332);}else{if(_0x508332===0x1f4){_0x554d4e[_0x2195('0x17')](_0x508332)[_0x2195('0x23')](_0x50b183);}else{_0x554d4e[_0x2195('0x17')](_0x508332)[_0x2195('0x19')](_0x50b183);}}});};exports[_0x2195('0x93')]=function(_0x35dd2b,_0x4efadd){var _0x27208f={};var _0x1e6c4d={};var _0x2101a8;var _0x2df602;return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x35dd2b['params']['id']}})['then'](handleEntityNotFound(_0x4efadd,null))[_0x2195('0xf')](function(_0xd2ae8e){if(_0xd2ae8e){_0x2101a8=_0xd2ae8e;_0x1e6c4d[_0x2195('0x44')]=_[_0x2195('0x46')](db[_0x2195('0x8e')]['rawAttributes']);_0x1e6c4d[_0x2195('0x45')]=_['keys'](_0x35dd2b[_0x2195('0x45')]);_0x1e6c4d[_0x2195('0x4f')]=_['intersection'](_0x1e6c4d['model'],_0x1e6c4d[_0x2195('0x45')]);_0x27208f[_0x2195('0x49')]=_[_0x2195('0x47')](_0x1e6c4d['model'],qs['fields'](_0x35dd2b[_0x2195('0x45')]['fields']));_0x27208f[_0x2195('0x49')]=_0x27208f[_0x2195('0x49')]['length']?_0x27208f['attributes']:_0x1e6c4d['model'];_0x27208f[_0x2195('0x4c')]=qs['sort'](_0x35dd2b[_0x2195('0x45')][_0x2195('0x4d')]);_0x27208f[_0x2195('0x4e')]=qs[_0x2195('0x4f')](_['pick'](_0x35dd2b[_0x2195('0x45')],_0x1e6c4d['filters']));if(_0x35dd2b[_0x2195('0x45')][_0x2195('0x50')]){_0x27208f[_0x2195('0x4e')]=_[_0x2195('0x51')](_0x27208f[_0x2195('0x4e')],{'$or':_['map'](_0x27208f['attributes'],function(_0x3183d7){var _0x260e25={};_0x260e25[_0x3183d7]={'$like':'%'+_0x35dd2b[_0x2195('0x45')]['filter']+'%'};return _0x260e25;})});}_0x27208f=_[_0x2195('0x51')]({},_0x27208f,_0x35dd2b['options']);return _0x2101a8['getApplications'](_0x27208f);}})[_0x2195('0xf')](function(_0x170ed9){if(_0x170ed9){_0x2df602=_0x170ed9[_0x2195('0x4a')];if(!_0x35dd2b['query'][_0x2195('0x67')]('nolimit')){_0x27208f[_0x2195('0x1b')]=qs[_0x2195('0x1b')](_0x35dd2b[_0x2195('0x45')][_0x2195('0x1b')]);_0x27208f[_0x2195('0x1d')]=qs['offset'](_0x35dd2b[_0x2195('0x45')][_0x2195('0x1d')]);}return _0x2101a8['getApplications'](_0x27208f);}})[_0x2195('0xf')](function(_0x48c45b){if(_0x48c45b){return _0x48c45b?{'count':_0x2df602,'rows':_0x48c45b}:null;}})['then'](respondWithResult(_0x4efadd,null))[_0x2195('0x56')](handleError(_0x4efadd,null));};exports[_0x2195('0x94')]=function(_0x41c843,_0x59ab3d){var _0x50e493={'raw':!![],'where':{}};var _0x4deca5={};var _0x13f514={'count':0x0,'rows':[]};return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x41c843[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0x59ab3d,null))[_0x2195('0xf')](function(_0x430183){if(_0x430183){_0x4deca5[_0x2195('0x44')]=_['keys'](db[_0x2195('0x95')][_0x2195('0x66')]);_0x4deca5['query']=_[_0x2195('0x46')](_0x41c843[_0x2195('0x45')]);_0x4deca5[_0x2195('0x4f')]=_['intersection'](_0x4deca5['model'],_0x4deca5[_0x2195('0x45')]);_0x50e493[_0x2195('0x49')]=_[_0x2195('0x47')](_0x4deca5[_0x2195('0x44')],qs[_0x2195('0x48')](_0x41c843['query']['fields']));_0x50e493['attributes']=_0x50e493[_0x2195('0x49')][_0x2195('0x4a')]?_0x50e493[_0x2195('0x49')]:_0x4deca5['model'];if(!_0x41c843[_0x2195('0x45')][_0x2195('0x67')](_0x2195('0x4b'))){_0x50e493['limit']=qs[_0x2195('0x1b')](_0x41c843['query']['limit']);_0x50e493[_0x2195('0x1d')]=qs['offset'](_0x41c843[_0x2195('0x45')][_0x2195('0x1d')]);}_0x50e493[_0x2195('0x4c')]=qs[_0x2195('0x4d')](_0x41c843[_0x2195('0x45')][_0x2195('0x4d')]);_0x50e493['where']=qs[_0x2195('0x4f')](_[_0x2195('0x68')](_0x41c843[_0x2195('0x45')],_0x4deca5[_0x2195('0x4f')]));_0x50e493[_0x2195('0x4e')][_0x2195('0x61')]=_0x430183['id'];if(_0x41c843[_0x2195('0x45')][_0x2195('0x50')]){_0x50e493['where']=_[_0x2195('0x51')](_0x50e493[_0x2195('0x4e')],{'$or':_['map'](_0x50e493[_0x2195('0x49')],function(_0x4b52f8){var _0x35c407={};_0x35c407[_0x4b52f8]={'$like':'%'+_0x41c843[_0x2195('0x45')][_0x2195('0x50')]+'%'};return _0x35c407;})});}if(_0x41c843[_0x2195('0x45')]['$gte']){var _0x4e3fa5=_0x41c843[_0x2195('0x45')][_0x2195('0x96')][_0x2195('0x97')](',');var _0x34df44={};_0x34df44[_0x4e3fa5[0x0]]={'$gte':moment(_0x4e3fa5[0x1])['format'](_0x2195('0x98'))};_0x50e493['where']=_[_0x2195('0x51')](_0x50e493['where'],_0x34df44);}_0x50e493=_[_0x2195('0x51')]({},_0x50e493,_0x41c843[_0x2195('0x52')]);return db[_0x2195('0x95')][_0x2195('0x1c')]({'where':_0x50e493[_0x2195('0x4e')]})[_0x2195('0xf')](function(_0x282db4){_0x13f514[_0x2195('0x1c')]=_0x282db4;if(_0x41c843[_0x2195('0x45')][_0x2195('0x53')]){_0x50e493[_0x2195('0x69')]=[{'all':!![]}];}return db[_0x2195('0x95')][_0x2195('0x6a')](_0x50e493);})[_0x2195('0xf')](function(_0x306f35){if(_0x41c843[_0x2195('0x45')][_0x2195('0x99')]===_0x2195('0x9a')){for(var _0x2b23b4=0x0;_0x2b23b4<_0x306f35[_0x2195('0x4a')];_0x2b23b4++){_0x306f35[_0x2b23b4][_0x2195('0x5a')]=juice(_0x306f35[_0x2b23b4][_0x2195('0x5a')]);}}_0x13f514[_0x2195('0x55')]=_0x306f35;return _0x13f514;});}})[_0x2195('0xf')](respondWithFilteredResult(_0x59ab3d,_0x50e493))[_0x2195('0x56')](handleError(_0x59ab3d,null));};exports[_0x2195('0x23')]=function(_0x55e192,_0x2f0158){var _0x26de19,_0x5b6303={},_0x5b76d3;if(_0x55e192[_0x2195('0x5a')]['to']){_0x5b76d3=_0x55e192[_0x2195('0x5a')]['to'][_0x2195('0x97')](',')[0x0];}return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x55e192[_0x2195('0x58')]['id']},'include':[{'model':db[_0x2195('0x9b')],'as':_0x2195('0x9c'),'include':[{'model':db[_0x2195('0x84')],'as':_0x2195('0x9d'),'where':{'email':_0x5b76d3},'limit':0x1,'order':[[_0x2195('0x9e'),_0x2195('0x9f')]]}]},{'model':db[_0x2195('0x3e')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2195('0xa0')],'as':_0x2195('0xa0'),'raw':!![]}]}]})[_0x2195('0xf')](handleEntityNotFound(_0x2f0158,null))[_0x2195('0xf')](function(_0xf56cac){if(!_0xf56cac)return;_0x26de19=_0xf56cac;if(!_0xf56cac[_0x2195('0x3b')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x2195('0x71')](_0x55e192[_0x2195('0x5a')][_0x2195('0xa1')])){_0x55e192[_0x2195('0x5a')][_0x2195('0xa1')]=util[_0x2195('0xa2')](_0x2195('0xa3'),_0xf56cac[_0x2195('0x22')],_0xf56cac['email']||_0xf56cac['Smtp']['user']);}if(_0x55e192[_0x2195('0x5a')]['attachments']&&_0x55e192[_0x2195('0x5a')][_0x2195('0xa4')]['length']){for(var _0x48318d=0x0;_0x48318d<_0x55e192[_0x2195('0x5a')]['attachments'][_0x2195('0x4a')];_0x48318d+=0x1){_0x55e192['body'][_0x2195('0xa4')][_0x48318d]={'filename':_0x55e192[_0x2195('0x5a')]['attachments'][_0x48318d][_0x2195('0x22')],'path':path['join'](config[_0x2195('0xa5')],_0x2195('0xa6'),_0x55e192[_0x2195('0x5a')][_0x2195('0xa4')][_0x48318d][_0x2195('0xa7')])};}}var _0xdc5f69=_0xf56cac[_0x2195('0xa8')]();return respondWithRpcPromise(_0x2195('0xa9'),'sendMail',{'account':_0xdc5f69,'message':_0x55e192[_0x2195('0x5a')]});})[_0x2195('0xf')](function(_0x127a9f){if(!_0x127a9f)return;_0x5b6303=_0x127a9f;if(!_0x26de19[_0x2195('0x9c')])throw new Error('List\x20not\x20found');if(_0x26de19[_0x2195('0x9c')][_0x2195('0x9d')]['length'])return _0x26de19[_0x2195('0x9c')][_0x2195('0x9d')][0x0];return db['CmContact'][_0x2195('0x63')](_[_0x2195('0x7')](_0x55e192['body'],{'firstName':_0x55e192['body']['to'],'email':_0x55e192[_0x2195('0x5a')]['to'],'phone':_0x55e192[_0x2195('0x5a')]['to'],'ListId':_0x26de19[_0x2195('0x70')]}));})[_0x2195('0xf')](function(_0x153d68){if(!_0x153d68)return;var _0x48fa48={'UserId':_0x55e192[_0x2195('0x2f')]['id'],'ContactId':_0x153d68['id'],'MailAccountId':_0x26de19['id'],'inReplyTo':_0x5b6303[_0x2195('0xaa')],'to':_0x55e192[_0x2195('0x5a')]['from'],'cc':_0x55e192[_0x2195('0x5a')]['cc'],'subject':_0x55e192[_0x2195('0x5a')]['subject'],'attach':_0x55e192['body'][_0x2195('0xab')],'firstMsgDirection':_0x2195('0xac'),'lastMsgAt':moment()[_0x2195('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2195('0xac'),'Messages':[_[_0x2195('0x51')](_0x55e192[_0x2195('0x5a')],{'messageId':_0x5b6303[_0x2195('0xaa')],'sentAt':moment()[_0x2195('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x26de19['id'],'UserId':_0x55e192['user']['id'],'ContactId':_0x153d68['id']})]};if(_0x55e192[_0x2195('0x5a')]['Interaction']){_0x48fa48=_[_0x2195('0x51')](_0x48fa48,_0x55e192[_0x2195('0x5a')][_0x2195('0xad')]);}return db['MailInteraction'][_0x2195('0x63')](_0x48fa48,{'include':[{'model':db[_0x2195('0x95')],'as':_0x2195('0xae')}]});})[_0x2195('0xf')](respondWithResult(_0x2f0158,null))[_0x2195('0x56')](handleError(_0x2f0158,null));};exports[_0x2195('0xaf')]=function(_0x5882e2,_0x4a0ca7){return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x5882e2[_0x2195('0x58')]['id']},'include':[{'model':db[_0x2195('0x3e')],'as':_0x2195('0x3b'),'raw':!![],'include':[{'model':db[_0x2195('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0x2195('0xf')](handleEntityNotFound(_0x4a0ca7,null))[_0x2195('0xf')](function(_0x44541a){if(!_0x44541a[_0x2195('0x3b')])return;var _0x20f041=_0x44541a[_0x2195('0xa8')]();return respondWithRpcPromise(_0x2195('0xb0'),_0x2195('0xaf'),{'account':_0x20f041});})[_0x2195('0xf')](respondWithResult(_0x4a0ca7,null))['catch'](handleError(_0x4a0ca7,null));};exports['destroy']=function(_0x45d5e2,_0x4af714){return db['MailAccount']['find']({'where':{'id':_0x45d5e2['params']['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x4af714,null))['then'](function(_0x50ff2a){if(_0x50ff2a&&_0x50ff2a[_0x2195('0x37')]){throw new db['Sequelize'][(_0x2195('0xb1'))](_0x2195('0xb2'));}return _0x50ff2a;})[_0x2195('0xf')](removeEntity(_0x4af714,null))[_0x2195('0x56')](handleError(_0x4af714,null));};exports[_0x2195('0xb3')]=function(_0x5c3a3e,_0x36e444){return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x5c3a3e[_0x2195('0x58')]['id']}})['then'](handleEntityNotFound(_0x36e444,null))['then'](function(_0x1215f2){if(_0x1215f2){return _0x1215f2[_0x2195('0xb3')](_0x5c3a3e[_0x2195('0x5a')][_0x2195('0x6c')],_['omit'](_0x5c3a3e[_0x2195('0x5a')],[_0x2195('0x6c'),'id'])||{})['spread'](function(_0x712a69){for(var _0x1f44c9=0x0;_0x1f44c9<_0x5c3a3e[_0x2195('0x5a')][_0x2195('0x6c')][_0x2195('0x4a')];_0x1f44c9+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x5c3a3e[_0x2195('0x5a')][_0x2195('0x6c')][_0x1f44c9]),'MailAccountId':Number(_0x5c3a3e['params']['id'])});}return _0x712a69;});}})[_0x2195('0xf')](respondWithResult(_0x36e444,null))[_0x2195('0x56')](handleError(_0x36e444,null));};exports['removeAgents']=function(_0x2d4f82,_0x3d1094){return db[_0x2195('0x54')][_0x2195('0x59')]({'where':{'id':_0x2d4f82[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x3d1094,null))['then'](function(_0x10f8f9){if(_0x10f8f9){return _0x10f8f9[_0x2195('0xb4')](_0x2d4f82[_0x2195('0x45')][_0x2195('0x6c')])[_0x2195('0xf')](function(){if(_[_0x2195('0xb5')](_0x2d4f82[_0x2195('0x45')][_0x2195('0x6c')])){for(var _0x4a6bd2=0x0;_0x4a6bd2<_0x2d4f82[_0x2195('0x45')][_0x2195('0x6c')]['length'];_0x4a6bd2+=0x1){socket[_0x2195('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x2d4f82[_0x2195('0x45')][_0x2195('0x6c')][_0x4a6bd2]),'MailAccountId':Number(_0x2d4f82['params']['id'])});}}else{socket[_0x2195('0xb6')](_0x2195('0xb7'),{'UserId':Number(_0x2d4f82[_0x2195('0x45')][_0x2195('0x6c')]),'MailAccountId':Number(_0x2d4f82[_0x2195('0x58')]['id'])});}});}})[_0x2195('0xf')](respondWithStatusCode(_0x3d1094,null))['catch'](handleError(_0x3d1094,null));};exports[_0x2195('0xb8')]=function(_0x5d5126,_0x2005dc){var _0x81b726={};var _0x3f966d={};var _0x52ed00;var _0x350929;return db[_0x2195('0x54')][_0x2195('0x65')]({'where':{'id':_0x5d5126[_0x2195('0x58')]['id']}})[_0x2195('0xf')](handleEntityNotFound(_0x2005dc,null))[_0x2195('0xf')](function(_0x38979b){if(_0x38979b){_0x52ed00=_0x38979b;_0x3f966d[_0x2195('0x44')]=_[_0x2195('0x46')](db['User'][_0x2195('0x66')]);_0x3f966d['query']=_[_0x2195('0x46')](_0x5d5126[_0x2195('0x45')]);_0x3f966d['filters']=_['intersection'](_0x3f966d[_0x2195('0x44')],_0x3f966d[_0x2195('0x45')]);_0x81b726[_0x2195('0x49')]=_['intersection'](_0x3f966d[_0x2195('0x44')],qs['fields'](_0x5d5126[_0x2195('0x45')][_0x2195('0x48')]));_0x81b726[_0x2195('0x49')]=_0x81b726[_0x2195('0x49')]['length']?_0x81b726[_0x2195('0x49')]:_0x3f966d[_0x2195('0x44')];_0x81b726[_0x2195('0x4c')]=qs['sort'](_0x5d5126[_0x2195('0x45')][_0x2195('0x4d')]);_0x81b726[_0x2195('0x4e')]=qs[_0x2195('0x4f')](_[_0x2195('0x68')](_0x5d5126['query'],_0x3f966d['filters']));if(_0x5d5126[_0x2195('0x45')]['filter']){_0x81b726[_0x2195('0x4e')]=_[_0x2195('0x51')](_0x81b726[_0x2195('0x4e')],{'$or':_[_0x2195('0x41')](_0x81b726[_0x2195('0x49')],function(_0x413e08){var _0x28b993={};_0x28b993[_0x413e08]={'$like':'%'+_0x5d5126[_0x2195('0x45')][_0x2195('0x50')]+'%'};return _0x28b993;})});}_0x81b726=_[_0x2195('0x51')]({},_0x81b726,_0x5d5126[_0x2195('0x52')]);return _0x52ed00['getAgents'](_0x81b726);}})[_0x2195('0xf')](function(_0x5ca308){if(_0x5ca308){_0x350929=_0x5ca308[_0x2195('0x4a')];if(!_0x5d5126[_0x2195('0x45')]['hasOwnProperty']('nolimit')){_0x81b726['limit']=qs[_0x2195('0x1b')](_0x5d5126[_0x2195('0x45')]['limit']);_0x81b726['offset']=qs[_0x2195('0x1d')](_0x5d5126[_0x2195('0x45')][_0x2195('0x1d')]);}return _0x52ed00[_0x2195('0xb8')](_0x81b726);}})[_0x2195('0xf')](function(_0x43ac81){if(_0x43ac81){return _0x43ac81?{'count':_0x350929,'rows':_0x43ac81}:null;}})['then'](respondWithResult(_0x2005dc,null))[_0x2195('0x56')](handleError(_0x2005dc,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8fc87d4..66c7125 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 _0x8294=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x2d5826,_0x33592d){var _0x49a215=function(_0x280780){while(--_0x280780){_0x2d5826['push'](_0x2d5826['shift']());}};_0x49a215(++_0x33592d);}(_0x8294,0x1c6));var _0x4829=function(_0x5da5b4,_0x532553){_0x5da5b4=_0x5da5b4-0x0;var _0x537b29=_0x8294[_0x5da5b4];return _0x537b29;};'use strict';var EventEmitter=require(_0x4829('0x0'));var MailAccount=require(_0x4829('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4829('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4829('0x3')};function emitEvent(_0x31c3ac){return function(_0x27a714,_0x494a7d,_0x1cbde3){MailAccountEvents['emit'](_0x31c3ac+':'+_0x27a714['id'],_0x27a714);MailAccountEvents[_0x4829('0x4')](_0x31c3ac,_0x27a714);_0x1cbde3(null);};}for(var e in events){if(events[_0x4829('0x5')](e)){var event=events[e];MailAccount[_0x4829('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xce62=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x173900,_0x511cbd){var _0x3fa5a3=function(_0x59b425){while(--_0x59b425){_0x173900['push'](_0x173900['shift']());}};_0x3fa5a3(++_0x511cbd);}(_0xce62,0x83));var _0x2ce6=function(_0x51ebb5,_0x1da106){_0x51ebb5=_0x51ebb5-0x0;var _0x35ee88=_0xce62[_0x51ebb5];return _0x35ee88;};'use strict';var EventEmitter=require(_0x2ce6('0x0'));var MailAccount=require(_0x2ce6('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2ce6('0x2')](0x0);var events={'afterCreate':_0x2ce6('0x3'),'afterUpdate':_0x2ce6('0x4'),'afterDestroy':_0x2ce6('0x5')};function emitEvent(_0x27787c){return function(_0x14ebab,_0x5d65ef,_0x2e8f91){MailAccountEvents[_0x2ce6('0x6')](_0x27787c+':'+_0x14ebab['id'],_0x14ebab);MailAccountEvents[_0x2ce6('0x6')](_0x27787c,_0x14ebab);_0x2e8f91(null);};}for(var e in events){if(events[_0x2ce6('0x7')](e)){var event=events[e];MailAccount[_0x2ce6('0x8')](e,emitEvent(event));}}module[_0x2ce6('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6f3fb1b..022b66c 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 _0x8948=['modernAuthentication','auth','OAuth2','CloudProvider','data5','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','port','Smtp','secure','authentication'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8948,0x1c7));var _0x8894=function(_0x426538,_0x2dee60){_0x426538=_0x426538-0x0;var _0x3c301f=_0x8948[_0x426538];return _0x3c301f;};'use strict';var attributes=require(_0x8894('0x0'));module['exports']=function(_0xcf2323){return _0xcf2323[_0x8894('0x1')](_0x8894('0x2'),attributes,{'tableName':_0x8894('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x43f9eb=this;var _0x199973={'id':_0x43f9eb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x43f9eb[_0x8894('0x4')]!=='custom'){_0x199973[_0x8894('0x5')]=_0x43f9eb[_0x8894('0x4')];}else{_0x199973['host']=_0x43f9eb['Smtp']['host'];_0x199973[_0x8894('0x6')]=_0x43f9eb[_0x8894('0x7')][_0x8894('0x6')];_0x199973[_0x8894('0x8')]=_0x43f9eb['Smtp']['secure'];}if(_0x43f9eb[_0x8894('0x7')][_0x8894('0x9')]){if(_0x43f9eb[_0x8894('0x7')][_0x8894('0xa')]){if(!_0x43f9eb[_0x8894('0x7')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x199973[_0x8894('0xb')]={'type':_0x8894('0xc'),'user':_0x43f9eb[_0x8894('0x7')]['user'],'accessToken':_0x43f9eb[_0x8894('0x7')][_0x8894('0xd')][_0x8894('0xe')]};}else{_0x199973[_0x8894('0xb')]={'user':_0x43f9eb[_0x8894('0x7')]['user'],'pass':_0x43f9eb[_0x8894('0x7')]['pass']};}}return _0x199973;}}});}; \ No newline at end of file +var _0x67c0=['service','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom'];(function(_0x331bef,_0x1b5058){var _0x3b8ca0=function(_0xc6c85a){while(--_0xc6c85a){_0x331bef['push'](_0x331bef['shift']());}};_0x3b8ca0(++_0x1b5058);}(_0x67c0,0xad));var _0x067c=function(_0x21f6ec,_0x5d3647){_0x21f6ec=_0x21f6ec-0x0;var _0x5b6048=_0x67c0[_0x21f6ec];return _0x5b6048;};'use strict';var attributes=require(_0x067c('0x0'));module[_0x067c('0x1')]=function(_0x32ef00){return _0x32ef00[_0x067c('0x2')](_0x067c('0x3'),attributes,{'tableName':_0x067c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4bfc10=this;var _0x2033f7={'id':_0x4bfc10['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4bfc10[_0x067c('0x5')]!==_0x067c('0x6')){_0x2033f7[_0x067c('0x7')]=_0x4bfc10[_0x067c('0x5')];}else{_0x2033f7[_0x067c('0x8')]=_0x4bfc10[_0x067c('0x9')]['host'];_0x2033f7[_0x067c('0xa')]=_0x4bfc10[_0x067c('0x9')][_0x067c('0xa')];_0x2033f7['secure']=_0x4bfc10[_0x067c('0x9')][_0x067c('0xb')];}if(_0x4bfc10['Smtp'][_0x067c('0xc')]){if(_0x4bfc10[_0x067c('0x9')][_0x067c('0xd')]){if(!_0x4bfc10[_0x067c('0x9')]['CloudProvider'])throw new Error(_0x067c('0xe'));_0x2033f7[_0x067c('0xf')]={'type':'OAuth2','user':_0x4bfc10['Smtp'][_0x067c('0x10')],'accessToken':_0x4bfc10[_0x067c('0x9')][_0x067c('0x11')][_0x067c('0x12')]};}else{_0x2033f7[_0x067c('0xf')]={'user':_0x4bfc10['Smtp'][_0x067c('0x10')],'pass':_0x4bfc10['Smtp'][_0x067c('0x13')]};}}return _0x2033f7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f7c1b55..d1a4279 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 _0xbacd=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','ShowMailAccount','find','raw','smtp','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','smtpOptions','applications','list','priority','push','autoclose','*,*,*,*','length','create','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','Contact\x20not\x20found','spread','update','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','agent','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x5c376b,_0x5cee74){var _0x4382ac=function(_0xd3dfc1){while(--_0xd3dfc1){_0x5c376b['push'](_0x5c376b['shift']());}};_0x4382ac(++_0x5cee74);}(_0xbacd,0x1c5));var _0xdbac=function(_0x28e2aa,_0x129d38){_0x28e2aa=_0x28e2aa-0x0;var _0x15f695=_0xbacd[_0x28e2aa];return _0x15f695;};'use strict';var _=require(_0xdbac('0x0'));var moment=require(_0xdbac('0x1'));var BPromise=require('bluebird');var rs=require(_0xdbac('0x2'));var Redis=require(_0xdbac('0x3'));var db=require(_0xdbac('0x4'))['db'];var logger=require('../../config/logger')(_0xdbac('0x5'));var config=require(_0xdbac('0x6'));var jayson=require(_0xdbac('0x7'));var client=jayson[_0xdbac('0x8')][_0xdbac('0x9')]({'port':0x232c});config[_0xdbac('0xa')]=_[_0xdbac('0xb')](config[_0xdbac('0xa')],{'host':_0xdbac('0xc'),'port':0x18eb});var socket=require(_0xdbac('0xd'))(new Redis(config[_0xdbac('0xa')]));require(_0xdbac('0xe'))[_0xdbac('0xf')](socket);function respondWithRpcPromise(_0x2824c8,_0x2f90c4,_0x4d025f){return new BPromise(function(_0x18f3ad,_0x258f7e){return client['request'](_0x2824c8,_0x4d025f)[_0xdbac('0x10')](function(_0x5bcf69){logger[_0xdbac('0x11')](_0xdbac('0x12'),_0x2f90c4,_0xdbac('0x13'));logger[_0xdbac('0x14')](_0xdbac('0x15'),_0x2f90c4,_0xdbac('0x13'),JSON[_0xdbac('0x16')](_0x5bcf69));if(_0x5bcf69[_0xdbac('0x17')]){if(_0x5bcf69[_0xdbac('0x17')]['code']===0x1f4){logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);return _0x258f7e(_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);}logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x5bcf69['error'][_0xdbac('0x18')]);return _0x18f3ad(_0x5bcf69[_0xdbac('0x17')][_0xdbac('0x18')]);}else{logger['info'](_0xdbac('0x12'),_0x2f90c4,_0xdbac('0x13'));_0x18f3ad(_0x5bcf69[_0xdbac('0x19')][_0xdbac('0x18')]);}})[_0xdbac('0x1a')](function(_0x1a9690){logger[_0xdbac('0x17')](_0xdbac('0x12'),_0x2f90c4,_0x1a9690);_0x258f7e(_0x1a9690);});});}exports[_0xdbac('0x1b')]=function(_0x1301d2){var _0x4598d9=this;return new Promise(function(_0x9c74a5,_0x5ec67c){return db[_0xdbac('0x1c')][_0xdbac('0x1d')]({'raw':_0x1301d2['options']?_0x1301d2[_0xdbac('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2['options'][_0xdbac('0x1f')]||null:null,'attributes':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x20')]||null:null,'limit':_0x1301d2[_0xdbac('0x1e')]?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x21')]||null:null,'include':_0x1301d2['options']?_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1301d2[_0xdbac('0x1e')][_0xdbac('0x22')],function(_0x2b4cda){return{'model':db[_0x2b4cda[_0xdbac('0x24')]],'as':_0x2b4cda['as'],'attributes':_0x2b4cda[_0xdbac('0x20')],'include':_0x2b4cda[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x2b4cda[_0xdbac('0x22')],function(_0x1ea3c3){return{'model':db[_0x1ea3c3[_0xdbac('0x24')]],'as':_0x1ea3c3['as'],'attributes':_0x1ea3c3[_0xdbac('0x20')],'include':_0x1ea3c3[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1ea3c3[_0xdbac('0x22')],function(_0x2bdb01){return{'model':db[_0x2bdb01[_0xdbac('0x24')]],'as':_0x2bdb01['as'],'attributes':_0x2bdb01[_0xdbac('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbac('0x10')](function(_0x4e7ef9){logger[_0xdbac('0x11')](_0xdbac('0x1b'),_0x1301d2);logger[_0xdbac('0x14')](_0xdbac('0x1b'),_0x1301d2,JSON['stringify'](_0x4e7ef9));_0x9c74a5(_0x4e7ef9);})['catch'](function(_0x10c3c8){logger[_0xdbac('0x17')](_0xdbac('0x1b'),_0x10c3c8[_0xdbac('0x18')],_0x1301d2);_0x5ec67c(_0x4598d9['error'](0x1f4,_0x10c3c8[_0xdbac('0x18')]));});});};exports[_0xdbac('0x25')]=function(_0x1659e4){var _0x2f53ef=this;return new Promise(function(_0x30a711,_0x1e3702){return db[_0xdbac('0x1c')][_0xdbac('0x26')]({'raw':_0x1659e4['options']?_0x1659e4['options'][_0xdbac('0x27')]===undefined?!![]:![]:!![],'where':_0x1659e4[_0xdbac('0x1e')]?_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x1f')]||null:null,'attributes':_0x1659e4['options']?_0x1659e4['options'][_0xdbac('0x20')]||null:null,'include':_0x1659e4[_0xdbac('0x1e')]?_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x1659e4[_0xdbac('0x1e')][_0xdbac('0x22')],function(_0x4640f7){return{'model':db[_0x4640f7[_0xdbac('0x24')]],'as':_0x4640f7['as'],'attributes':_0x4640f7[_0xdbac('0x20')],'include':_0x4640f7[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x4640f7[_0xdbac('0x22')],function(_0x48a49f){return{'model':db[_0x48a49f[_0xdbac('0x24')]],'as':_0x48a49f['as'],'attributes':_0x48a49f['attributes'],'include':_0x48a49f[_0xdbac('0x22')]?_[_0xdbac('0x23')](_0x48a49f[_0xdbac('0x22')],function(_0x3a4829){return{'model':db[_0x3a4829['model']],'as':_0x3a4829['as'],'attributes':_0x3a4829[_0xdbac('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdbac('0x10')](function(_0x58a661){if(_0x1659e4['options'][_0xdbac('0x28')]===!![])_0x58a661['setDataValue']('smtpOptions',_0x58a661[_0xdbac('0x29')]());logger[_0xdbac('0x11')](_0xdbac('0x25'),_0x1659e4);logger['debug'](_0xdbac('0x25'),_0x1659e4,JSON[_0xdbac('0x16')](_0x58a661));_0x30a711(_0x58a661);})[_0xdbac('0x1a')](function(_0x3d1dc1){logger['error']('ShowMailAccount',_0x3d1dc1[_0xdbac('0x18')],_0x1659e4);_0x1e3702(_0x2f53ef[_0xdbac('0x17')](0x1f4,_0x3d1dc1[_0xdbac('0x18')]));});});};exports[_0xdbac('0x2a')]=function(_0x2346e9){var _0x53c779=this;return new Promise(function(_0x1a27a4,_0x3bf656){var _0x5a4851={'body':_0x2346e9[_0xdbac('0x2b')],'channel':_0xdbac('0x2c')};var _0x1710a5=_[_0xdbac('0x2d')](_[_0xdbac('0x2e')](db['CmContact'][_0xdbac('0x2f')]),[_0xdbac('0x30'),_0xdbac('0x31'),_0xdbac('0x32'),_0xdbac('0x33')]);var _0x25344a=![];if(_0x2346e9[_0xdbac('0x2b')]['id']){delete _0x2346e9[_0xdbac('0x2b')]['id'];}if(_[_0xdbac('0x34')](_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x2346e9['body']['body'])||_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x2b')]===''){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x36')));}if(_[_0xdbac('0x34')](_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x37')])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x38')+_0x1710a5));}if(!_['includes'](_0x1710a5,_0x2346e9['body']['mapKey'])){return _0x3bf656(_0x53c779[_0xdbac('0x17')](0x1f4,_0xdbac('0x39')+_0x1710a5));}var _0x573fb3={};_0x573fb3[_0x2346e9['body']['mapKey']]=_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')];return db[_0xdbac('0x1c')]['find']({'where':{'id':_0x2346e9[_0xdbac('0x3a')]['id']},'include':[{'model':db[_0xdbac('0x3b')],'as':_0xdbac('0x3c'),'include':[{'model':db[_0xdbac('0x3d')],'as':_0xdbac('0x3e'),'where':_0x573fb3,'limit':0x1,'order':[['updatedAt',_0xdbac('0x3f')]]}]},{'model':db[_0xdbac('0x40')],'as':_0xdbac('0x41')},{'model':db[_0xdbac('0x42')],'as':'Smtp','include':[{'model':db[_0xdbac('0x43')],'as':_0xdbac('0x43')}]}]})[_0xdbac('0x10')](function(_0x5d6e86){if(_0x5d6e86&&_0x5d6e86[_0xdbac('0x3c')]){var _0x5ce39=_0x5d6e86[_0xdbac('0x44')]({'plain':!![]});_0x5a4851[_0xdbac('0x3a')]=_[_0xdbac('0x45')](_0x5ce39,[_0xdbac('0x41'),'List']);_0x5a4851[_0xdbac('0x3a')][_0xdbac('0x46')]=_0x5d6e86['getSmtpOptions']();_0x5a4851[_0xdbac('0x47')]=_0x5ce39[_0xdbac('0x41')];_0x5a4851[_0xdbac('0x48')]=_0x5ce39[_0xdbac('0x3c')];_0x5a4851['applications']=_['orderBy'](_0x5a4851[_0xdbac('0x47')],[_0xdbac('0x49')],['asc']);if(_0x5a4851['account']&&_0x5a4851[_0xdbac('0x3a')]['autoclose']){_0x5a4851[_0xdbac('0x47')][_0xdbac('0x4a')]({'id':0x0,'priority':_0x5a4851[_0xdbac('0x47')]['length']+0x1,'app':'close','appdata':_0xdbac('0x4b'),'interval':_0xdbac('0x4c')});}if(_0x5a4851[_0xdbac('0x3a')][_0xdbac('0x41')]){delete _0x5a4851[_0xdbac('0x3a')][_0xdbac('0x41')];}if(_0x5a4851[_0xdbac('0x3a')]['List']){delete _0x5a4851['account'][_0xdbac('0x3c')];}if(_0x5ce39[_0xdbac('0x3c')][_0xdbac('0x3e')][_0xdbac('0x4d')]){return _0x5ce39[_0xdbac('0x3c')][_0xdbac('0x3e')][0x0];}var _0x5ec4f8=_[_0xdbac('0xb')](_0x2346e9[_0xdbac('0x2b')],{'firstName':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x35')],'ListId':_0x5ce39[_0xdbac('0x33')]});_0x5ec4f8[_0x2346e9['body']['mapKey']]=_0x2346e9[_0xdbac('0x2b')]['from'];return db[_0xdbac('0x3d')][_0xdbac('0x4e')](_0x5ec4f8);}else{throw new Error('List\x20not\x20found');}})[_0xdbac('0x10')](function(_0x50af7a){_0x5a4851['contact']=_0x50af7a;if(_0x50af7a){if(!_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId']){_0x2346e9['body'][_0xdbac('0x18')]['messageId']=rs[_0xdbac('0x4f')]()+'\x20'+_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['from'];}var _0x4be6fc={'ContactId':_0x50af7a['id'],'MailAccountId':_0x2346e9[_0xdbac('0x3a')]['id'],'inReplyTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'to':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['from'],'cc':_0x2346e9[_0xdbac('0x2b')]['message']['cc'],'subject':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x50')],'attach':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'lastMsgAt':moment()[_0xdbac('0x52')](_0xdbac('0x53')),'lastMsgDirection':'in'};return db[_0xdbac('0x54')][_0xdbac('0x26')]({'where':{'closed':![],'MailAccountId':_0x2346e9['account']['id']},'include':[{'model':db[_0xdbac('0x55')],'as':_0xdbac('0x56'),'attributes':[_0xdbac('0x57')],'where':{'messageId':_0x2346e9[_0xdbac('0x2b')]['message']['inReplyTo']}}]})['then'](function(_0x54de5e){if(_0x54de5e){return[_0x54de5e,![]];}return db[_0xdbac('0x54')]['create'](_0x4be6fc)[_0xdbac('0x10')](function(_0x3d471f){return[_0x3d471f,!![]];});});}else{throw new Error(_0xdbac('0x58'));}})[_0xdbac('0x59')](function(_0x41645c,_0xc2d800){if(_0x41645c){_0x25344a=_0xc2d800;if(!_0xc2d800){return _0x41645c[_0xdbac('0x5a')]({'inReplyTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'to':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x35')],'cc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['cc'],'subject':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x50')],'attach':_0x41645c[_0xdbac('0x51')]?_0x41645c[_0xdbac('0x51')]:_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'substatus':null,'substatusAt':moment()[_0xdbac('0x52')](_0xdbac('0x53')),'lastMsgAt':moment()['format'](_0xdbac('0x53')),'lastMsgDirection':'in'});}else{return _0x41645c;}}})[_0xdbac('0x10')](function(_0x5410bc){_0x5a4851['interaction']=_0x5410bc['get']({'plain':!![]});_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x5c')]=_0x25344a;return db[_0xdbac('0x55')][_0xdbac('0x4e')]({'body':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x2b')],'MailAccountId':_0x2346e9[_0xdbac('0x3a')]['id'],'MailInteractionId':_0x5410bc['id'],'direction':'in','ContactId':_0x5a4851[_0xdbac('0x5d')]['id'],'messageId':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['messageId'],'from':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x35')],'to':_0x2346e9['body'][_0xdbac('0x18')]['to'],'cc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')]['cc'],'subject':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x50')],'attach':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x51')],'Attachments':_0x2346e9[_0xdbac('0x2b')]['message'][_0xdbac('0x5e')],'originTo':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x5f')],'originCc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x60')],'bcc':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x61')],'ChatWebsiteId':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x62')]||null,'originChannel':_0x2346e9[_0xdbac('0x2b')][_0xdbac('0x18')][_0xdbac('0x63')]||_0xdbac('0x64'),'ChatOfflineMessageId':_0x2346e9['body'][_0xdbac('0x18')][_0xdbac('0x65')]||null},{'include':[{'model':db[_0xdbac('0x66')],'as':'Attachments'}]});})[_0xdbac('0x10')](function(_0x2bb725){_0x5a4851['message']=_0x2bb725;if(!_0x5a4851['interaction'][_0xdbac('0x67')]){return;}return db[_0xdbac('0x68')]['find']({'attributes':['id',_0xdbac('0x69')],'where':{'id':_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x67')]}});})[_0xdbac('0x10')](function(_0xdaa182){if(_0xdaa182){_0x5a4851['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xdbac('0x6a'),'appdata':_0xdaa182[_0xdbac('0x69')]+','+(_0x5a4851['account'][_0xdbac('0x6b')]||0xa),'interval':_0xdbac('0x4c')});}if(!_0x5a4851[_0xdbac('0x5b')][_0xdbac('0x6c')]){return;}return db[_0xdbac('0x6d')][_0xdbac('0x26')]({'attributes':['id',_0xdbac('0x69')],'where':{'id':_0x5a4851['interaction'][_0xdbac('0x6c')]}});})['then'](function(_0x47cc7f){if(_0x47cc7f){_0x5a4851['applications'][_0xdbac('0x6e')]({'id':0x0,'priority':0x1,'app':_0xdbac('0x6f'),'appdata':_0x47cc7f[_0xdbac('0x69')]+','+(_0x5a4851['account'][_0xdbac('0x70')]||0x12c),'interval':_0xdbac('0x4c')});}return respondWithRpcPromise(_0xdbac('0x71'),_0xdbac('0x72'),_0x5a4851);})[_0xdbac('0x10')](function(_0x3c578a){_0x1a27a4(_0x3c578a);})[_0xdbac('0x1a')](function(_0x141830){_0x3bf656(_0x53c779['error'](0x1f4,_0x141830[_0xdbac('0x18')]));});});}; \ No newline at end of file +var _0x90b5=['socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','MailAccount','findAll','options','where','include','map','model','attributes','stringify','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','smtpOptions','list','applications','priority','autoclose','push','length','create','List\x20not\x20found','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','*,*,*,*','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x5524ac,_0x4c968a){var _0x1d8162=function(_0x1809f3){while(--_0x1809f3){_0x5524ac['push'](_0x5524ac['shift']());}};_0x1d8162(++_0x4c968a);}(_0x90b5,0x139));var _0x590b=function(_0xb09132,_0x392b11){_0xb09132=_0xb09132-0x0;var _0xf5c47e=_0x90b5[_0xb09132];return _0xf5c47e;};'use strict';var _=require(_0x590b('0x0'));var moment=require('moment');var BPromise=require(_0x590b('0x1'));var rs=require(_0x590b('0x2'));var Redis=require(_0x590b('0x3'));var db=require(_0x590b('0x4'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x590b('0x5'));var jayson=require(_0x590b('0x6'));var client=jayson['client'][_0x590b('0x7')]({'port':0x232c});config[_0x590b('0x8')]=_[_0x590b('0x9')](config['redis'],{'host':_0x590b('0xa'),'port':0x18eb});var socket=require(_0x590b('0xb'))(new Redis(config[_0x590b('0x8')]));require(_0x590b('0xc'))[_0x590b('0xd')](socket);function respondWithRpcPromise(_0x268b0a,_0x2103c0,_0xe0b13d){return new BPromise(function(_0x137f11,_0x50a7b8){return client[_0x590b('0xe')](_0x268b0a,_0xe0b13d)[_0x590b('0xf')](function(_0x565f63){logger[_0x590b('0x10')]('MailAccount,\x20%s,\x20%s',_0x2103c0,_0x590b('0x11'));logger[_0x590b('0x12')](_0x590b('0x13'),_0x2103c0,_0x590b('0x11'),JSON['stringify'](_0x565f63));if(_0x565f63[_0x590b('0x14')]){if(_0x565f63[_0x590b('0x14')][_0x590b('0x15')]===0x1f4){logger[_0x590b('0x14')](_0x590b('0x16'),_0x2103c0,_0x565f63[_0x590b('0x14')][_0x590b('0x17')]);return _0x50a7b8(_0x565f63[_0x590b('0x14')][_0x590b('0x17')]);}logger[_0x590b('0x14')](_0x590b('0x16'),_0x2103c0,_0x565f63[_0x590b('0x14')][_0x590b('0x17')]);return _0x137f11(_0x565f63[_0x590b('0x14')][_0x590b('0x17')]);}else{logger['info'](_0x590b('0x16'),_0x2103c0,'request\x20sent');_0x137f11(_0x565f63[_0x590b('0x18')][_0x590b('0x17')]);}})[_0x590b('0x19')](function(_0x53337c){logger['error'](_0x590b('0x16'),_0x2103c0,_0x53337c);_0x50a7b8(_0x53337c);});});}exports['GetMailAccount']=function(_0x21e771){var _0x4e4cc6=this;return new Promise(function(_0x3fbeb2,_0x4ff96d){return db[_0x590b('0x1a')][_0x590b('0x1b')]({'raw':_0x21e771[_0x590b('0x1c')]?_0x21e771[_0x590b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21e771[_0x590b('0x1c')]?_0x21e771['options'][_0x590b('0x1d')]||null:null,'attributes':_0x21e771[_0x590b('0x1c')]?_0x21e771['options']['attributes']||null:null,'limit':_0x21e771[_0x590b('0x1c')]?_0x21e771[_0x590b('0x1c')]['limit']||null:null,'include':_0x21e771[_0x590b('0x1c')]?_0x21e771[_0x590b('0x1c')]['include']?_['map'](_0x21e771[_0x590b('0x1c')]['include'],function(_0x39fead){return{'model':db[_0x39fead['model']],'as':_0x39fead['as'],'attributes':_0x39fead['attributes'],'include':_0x39fead[_0x590b('0x1e')]?_[_0x590b('0x1f')](_0x39fead['include'],function(_0x1febcd){return{'model':db[_0x1febcd[_0x590b('0x20')]],'as':_0x1febcd['as'],'attributes':_0x1febcd[_0x590b('0x21')],'include':_0x1febcd[_0x590b('0x1e')]?_[_0x590b('0x1f')](_0x1febcd['include'],function(_0x32d355){return{'model':db[_0x32d355[_0x590b('0x20')]],'as':_0x32d355['as'],'attributes':_0x32d355[_0x590b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x590b('0xf')](function(_0x1ee769){logger[_0x590b('0x10')]('GetMailAccount',_0x21e771);logger[_0x590b('0x12')]('GetMailAccount',_0x21e771,JSON[_0x590b('0x22')](_0x1ee769));_0x3fbeb2(_0x1ee769);})[_0x590b('0x19')](function(_0x448ab3){logger[_0x590b('0x14')]('GetMailAccount',_0x448ab3[_0x590b('0x17')],_0x21e771);_0x4ff96d(_0x4e4cc6['error'](0x1f4,_0x448ab3[_0x590b('0x17')]));});});};exports[_0x590b('0x23')]=function(_0x2ea853){var _0x1da455=this;return new Promise(function(_0x46aebb,_0x58fcd7){return db[_0x590b('0x1a')][_0x590b('0x24')]({'raw':_0x2ea853[_0x590b('0x1c')]?_0x2ea853[_0x590b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ea853['options']?_0x2ea853[_0x590b('0x1c')][_0x590b('0x1d')]||null:null,'attributes':_0x2ea853[_0x590b('0x1c')]?_0x2ea853[_0x590b('0x1c')]['attributes']||null:null,'include':_0x2ea853['options']?_0x2ea853[_0x590b('0x1c')]['include']?_[_0x590b('0x1f')](_0x2ea853[_0x590b('0x1c')][_0x590b('0x1e')],function(_0x3c2d0f){return{'model':db[_0x3c2d0f[_0x590b('0x20')]],'as':_0x3c2d0f['as'],'attributes':_0x3c2d0f[_0x590b('0x21')],'include':_0x3c2d0f[_0x590b('0x1e')]?_[_0x590b('0x1f')](_0x3c2d0f[_0x590b('0x1e')],function(_0x3e5c5e){return{'model':db[_0x3e5c5e['model']],'as':_0x3e5c5e['as'],'attributes':_0x3e5c5e['attributes'],'include':_0x3e5c5e[_0x590b('0x1e')]?_[_0x590b('0x1f')](_0x3e5c5e[_0x590b('0x1e')],function(_0x3a03ff){return{'model':db[_0x3a03ff[_0x590b('0x20')]],'as':_0x3a03ff['as'],'attributes':_0x3a03ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x590b('0xf')](function(_0x69be0a){if(_0x2ea853[_0x590b('0x1c')][_0x590b('0x25')]===!![])_0x69be0a[_0x590b('0x26')]('smtpOptions',_0x69be0a[_0x590b('0x27')]());logger[_0x590b('0x10')]('ShowMailAccount',_0x2ea853);logger['debug'](_0x590b('0x23'),_0x2ea853,JSON['stringify'](_0x69be0a));_0x46aebb(_0x69be0a);})[_0x590b('0x19')](function(_0x273c71){logger[_0x590b('0x14')](_0x590b('0x23'),_0x273c71[_0x590b('0x17')],_0x2ea853);_0x58fcd7(_0x1da455[_0x590b('0x14')](0x1f4,_0x273c71[_0x590b('0x17')]));});});};exports[_0x590b('0x28')]=function(_0x16fdec){var _0x1a95ef=this;return new Promise(function(_0x593b35,_0x470d57){var _0x1ac4de={'body':_0x16fdec[_0x590b('0x29')],'channel':'mail'};var _0x11eb71=_[_0x590b('0x2a')](_[_0x590b('0x2b')](db[_0x590b('0x2c')][_0x590b('0x2d')]),[_0x590b('0x2e'),_0x590b('0x2f'),_0x590b('0x30'),'ListId']);var _0x7da2e3=![];if(_0x16fdec['body']['id']){delete _0x16fdec[_0x590b('0x29')]['id'];}if(_[_0x590b('0x31')](_0x16fdec[_0x590b('0x29')]['from'])){return _0x470d57(_0x1a95ef[_0x590b('0x14')](0x1f4,_0x590b('0x32')));}if(_[_0x590b('0x31')](_0x16fdec[_0x590b('0x29')]['body'])||_0x16fdec[_0x590b('0x29')][_0x590b('0x29')]===''){return _0x470d57(_0x1a95ef['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x16fdec[_0x590b('0x29')][_0x590b('0x33')])){return _0x470d57(_0x1a95ef[_0x590b('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11eb71));}if(!_['includes'](_0x11eb71,_0x16fdec[_0x590b('0x29')][_0x590b('0x33')])){return _0x470d57(_0x1a95ef['error'](0x1f4,_0x590b('0x34')+_0x11eb71));}var _0x1a9678={};_0x1a9678[_0x16fdec[_0x590b('0x29')][_0x590b('0x33')]]=_0x16fdec[_0x590b('0x29')][_0x590b('0x35')];return db[_0x590b('0x1a')][_0x590b('0x24')]({'where':{'id':_0x16fdec[_0x590b('0x36')]['id']},'include':[{'model':db[_0x590b('0x37')],'as':_0x590b('0x38'),'include':[{'model':db[_0x590b('0x2c')],'as':_0x590b('0x39'),'where':_0x1a9678,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x590b('0x3a')],'as':_0x590b('0x3b')},{'model':db[_0x590b('0x3c')],'as':_0x590b('0x3d'),'include':[{'model':db['CloudProvider'],'as':_0x590b('0x3e')}]}]})[_0x590b('0xf')](function(_0x2f492a){if(_0x2f492a&&_0x2f492a['List']){var _0x1964c5=_0x2f492a[_0x590b('0x3f')]({'plain':!![]});_0x1ac4de['account']=_['omit'](_0x1964c5,[_0x590b('0x3b'),_0x590b('0x38')]);_0x1ac4de['account'][_0x590b('0x40')]=_0x2f492a[_0x590b('0x27')]();_0x1ac4de['applications']=_0x1964c5[_0x590b('0x3b')];_0x1ac4de[_0x590b('0x41')]=_0x1964c5[_0x590b('0x38')];_0x1ac4de['applications']=_['orderBy'](_0x1ac4de[_0x590b('0x42')],[_0x590b('0x43')],['asc']);if(_0x1ac4de[_0x590b('0x36')]&&_0x1ac4de[_0x590b('0x36')][_0x590b('0x44')]){_0x1ac4de[_0x590b('0x42')][_0x590b('0x45')]({'id':0x0,'priority':_0x1ac4de[_0x590b('0x42')][_0x590b('0x46')]+0x1,'app':'close','appdata':_0x590b('0x44'),'interval':'*,*,*,*'});}if(_0x1ac4de[_0x590b('0x36')][_0x590b('0x3b')]){delete _0x1ac4de[_0x590b('0x36')]['Applications'];}if(_0x1ac4de['account'][_0x590b('0x38')]){delete _0x1ac4de[_0x590b('0x36')][_0x590b('0x38')];}if(_0x1964c5[_0x590b('0x38')]['Contacts'][_0x590b('0x46')]){return _0x1964c5['List']['Contacts'][0x0];}var _0xa69039=_['defaults'](_0x16fdec[_0x590b('0x29')],{'firstName':_0x16fdec['body'][_0x590b('0x35')],'ListId':_0x1964c5['ListId']});_0xa69039[_0x16fdec[_0x590b('0x29')][_0x590b('0x33')]]=_0x16fdec[_0x590b('0x29')][_0x590b('0x35')];return db[_0x590b('0x2c')][_0x590b('0x47')](_0xa69039);}else{throw new Error(_0x590b('0x48'));}})[_0x590b('0xf')](function(_0x44c63c){_0x1ac4de['contact']=_0x44c63c;if(_0x44c63c){if(!_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['messageId']){_0x16fdec[_0x590b('0x29')][_0x590b('0x17')][_0x590b('0x49')]=rs[_0x590b('0x4a')]()+'\x20'+_0x16fdec['body'][_0x590b('0x17')][_0x590b('0x35')];}var _0x7a8153={'ContactId':_0x44c63c['id'],'MailAccountId':_0x16fdec[_0x590b('0x36')]['id'],'inReplyTo':_0x16fdec['body'][_0x590b('0x17')]['messageId'],'to':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')][_0x590b('0x35')],'cc':_0x16fdec[_0x590b('0x29')]['message']['cc'],'subject':_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x4b')],'attach':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['attach'],'lastMsgAt':moment()[_0x590b('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x590b('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x16fdec[_0x590b('0x36')]['id']},'include':[{'model':db[_0x590b('0x4e')],'as':_0x590b('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x16fdec['body'][_0x590b('0x17')][_0x590b('0x50')]}}]})[_0x590b('0xf')](function(_0x93f33f){if(_0x93f33f){return[_0x93f33f,![]];}return db['MailInteraction'][_0x590b('0x47')](_0x7a8153)['then'](function(_0x236aa8){return[_0x236aa8,!![]];});});}else{throw new Error(_0x590b('0x51'));}})[_0x590b('0x52')](function(_0x916603,_0x374997){if(_0x916603){_0x7da2e3=_0x374997;if(!_0x374997){return _0x916603['update']({'inReplyTo':_0x16fdec['body'][_0x590b('0x17')]['messageId'],'to':_0x16fdec['body'][_0x590b('0x17')][_0x590b('0x35')],'cc':_0x16fdec['body'][_0x590b('0x17')]['cc'],'subject':_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x4b')],'attach':_0x916603[_0x590b('0x53')]?_0x916603['attach']:_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x53')],'substatus':null,'substatusAt':moment()[_0x590b('0x4c')](_0x590b('0x54')),'lastMsgAt':moment()['format'](_0x590b('0x54')),'lastMsgDirection':'in'});}else{return _0x916603;}}})[_0x590b('0xf')](function(_0x337d55){_0x1ac4de[_0x590b('0x55')]=_0x337d55['get']({'plain':!![]});_0x1ac4de[_0x590b('0x55')][_0x590b('0x56')]=_0x7da2e3;return db['MailMessage'][_0x590b('0x47')]({'body':_0x16fdec['body'][_0x590b('0x29')],'MailAccountId':_0x16fdec[_0x590b('0x36')]['id'],'MailInteractionId':_0x337d55['id'],'direction':'in','ContactId':_0x1ac4de[_0x590b('0x57')]['id'],'messageId':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')][_0x590b('0x49')],'from':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['from'],'to':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['to'],'cc':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['cc'],'subject':_0x16fdec['body']['message'][_0x590b('0x4b')],'attach':_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x53')],'Attachments':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')]['attachments'],'originTo':_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x58')],'originCc':_0x16fdec['body']['message'][_0x590b('0x59')],'bcc':_0x16fdec[_0x590b('0x29')]['message'][_0x590b('0x5a')],'ChatWebsiteId':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')][_0x590b('0x5b')]||null,'originChannel':_0x16fdec['body'][_0x590b('0x17')][_0x590b('0x5c')]||_0x590b('0x5d'),'ChatOfflineMessageId':_0x16fdec[_0x590b('0x29')][_0x590b('0x17')][_0x590b('0x5e')]||null},{'include':[{'model':db[_0x590b('0x5f')],'as':_0x590b('0x60')}]});})[_0x590b('0xf')](function(_0x5c6520){_0x1ac4de[_0x590b('0x17')]=_0x5c6520;if(!_0x1ac4de['interaction'][_0x590b('0x61')]){return;}return db[_0x590b('0x62')][_0x590b('0x24')]({'attributes':['id',_0x590b('0x63')],'where':{'id':_0x1ac4de['interaction'][_0x590b('0x61')]}});})[_0x590b('0xf')](function(_0x1e0778){if(_0x1e0778){_0x1ac4de['applications'][_0x590b('0x64')]({'id':0x0,'priority':0x0,'app':_0x590b('0x65'),'appdata':_0x1e0778[_0x590b('0x63')]+','+(_0x1ac4de[_0x590b('0x36')][_0x590b('0x66')]||0xa),'interval':'*,*,*,*'});}if(!_0x1ac4de[_0x590b('0x55')][_0x590b('0x67')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x1ac4de[_0x590b('0x55')][_0x590b('0x67')]}});})['then'](function(_0x49bc12){if(_0x49bc12){_0x1ac4de[_0x590b('0x42')]['unshift']({'id':0x0,'priority':0x1,'app':_0x590b('0x68'),'appdata':_0x49bc12[_0x590b('0x63')]+','+(_0x1ac4de[_0x590b('0x36')]['waitForTheAssignedQueue']||0x12c),'interval':_0x590b('0x69')});}return respondWithRpcPromise(_0x590b('0x6a'),_0x590b('0x6b'),_0x1ac4de);})['then'](function(_0x18b10f){_0x593b35(_0x18b10f);})[_0x590b('0x19')](function(_0x437755){_0x470d57(_0x1a95ef['error'](0x1f4,_0x437755[_0x590b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 86fdc83..0304354 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 _0xe5fc=['length','./mailAccount.events','remove','update','removeListener','register'];(function(_0x5a0681,_0x5cbc10){var _0x2d3a74=function(_0x1ba48d){while(--_0x1ba48d){_0x5a0681['push'](_0x5a0681['shift']());}};_0x2d3a74(++_0x5cbc10);}(_0xe5fc,0x109));var _0xce5f=function(_0x289fca,_0x131bba){_0x289fca=_0x289fca-0x0;var _0x335a88=_0xe5fc[_0x289fca];return _0x335a88;};'use strict';var MailAccountEvents=require(_0xce5f('0x0'));var events=['save',_0xce5f('0x1'),_0xce5f('0x2')];function createListener(_0x1fd408,_0x4b395a){return function(_0x57d46d){_0x4b395a['emit'](_0x1fd408,_0x57d46d);};}function removeListener(_0x13da8d,_0x4d692b){return function(){MailAccountEvents[_0xce5f('0x3')](_0x13da8d,_0x4d692b);};}exports[_0xce5f('0x4')]=function(_0x2c23b0){for(var _0x12d30e=0x0,_0x3b77ef=events[_0xce5f('0x5')];_0x12d30e<_0x3b77ef;_0x12d30e++){var _0x2b64dc=events[_0x12d30e];var _0x3451af=createListener('mailAccount:'+_0x2b64dc,_0x2c23b0);MailAccountEvents['on'](_0x2b64dc,_0x3451af);}}; \ No newline at end of file +var _0xcd4d=['removeListener','register','length','mailAccount:','./mailAccount.events','save','update','emit'];(function(_0x4a0130,_0x4fda99){var _0x54064c=function(_0x4ab850){while(--_0x4ab850){_0x4a0130['push'](_0x4a0130['shift']());}};_0x54064c(++_0x4fda99);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x482c78,_0x32eb31){_0x482c78=_0x482c78-0x0;var _0xeb8b6d=_0xcd4d[_0x482c78];return _0xeb8b6d;};'use strict';var MailAccountEvents=require(_0xdcd4('0x0'));var events=[_0xdcd4('0x1'),'remove',_0xdcd4('0x2')];function createListener(_0x2112aa,_0x229696){return function(_0x194146){_0x229696[_0xdcd4('0x3')](_0x2112aa,_0x194146);};}function removeListener(_0x13b4e2,_0x413630){return function(){MailAccountEvents[_0xdcd4('0x4')](_0x13b4e2,_0x413630);};}exports[_0xdcd4('0x5')]=function(_0x24d664){for(var _0x1fb75e=0x0,_0x302b60=events[_0xdcd4('0x6')];_0x1fb75e<_0x302b60;_0x1fb75e++){var _0x17f848=events[_0x1fb75e];var _0x198d6c=createListener(_0xdcd4('0x7')+_0x17f848,_0x24d664);MailAccountEvents['on'](_0x17f848,_0x198d6c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 37fd7df..afd1f25 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 _0x9240=['get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x15b2e4,_0x33d94f){var _0x4870b7=function(_0x3bc035){while(--_0x3bc035){_0x15b2e4['push'](_0x15b2e4['shift']());}};_0x4870b7(++_0x33d94f);}(_0x9240,0x118));var _0x0924=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x9240[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0x0924('0x0'));var util=require('util');var path=require(_0x0924('0x1'));var timeout=require('connect-timeout');var express=require(_0x0924('0x2'));var router=express[_0x0924('0x3')]();var fs_extra=require(_0x0924('0x4'));var auth=require(_0x0924('0x5'));var interaction=require(_0x0924('0x6'));var config=require(_0x0924('0x7'));var controller=require(_0x0924('0x8'));router[_0x0924('0x9')](_0x0924('0xa'),auth[_0x0924('0xb')](),controller[_0x0924('0xc')]);router['put'](_0x0924('0xa'),auth['isAuthenticated'](),controller[_0x0924('0xd')]);router[_0x0924('0xe')](_0x0924('0xa'),auth['isAuthenticated'](),controller[_0x0924('0xf')]);module[_0x0924('0x10')]=router; \ No newline at end of file +var _0x2d38=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','multer','path'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x2d38,0x8e));var _0x82d3=function(_0xeb67cb,_0x3facda){_0xeb67cb=_0xeb67cb-0x0;var _0xc8fe96=_0x2d38[_0xeb67cb];return _0xc8fe96;};'use strict';var multer=require(_0x82d3('0x0'));var util=require('util');var path=require(_0x82d3('0x1'));var timeout=require(_0x82d3('0x2'));var express=require(_0x82d3('0x3'));var router=express[_0x82d3('0x4')]();var fs_extra=require(_0x82d3('0x5'));var auth=require(_0x82d3('0x6'));var interaction=require(_0x82d3('0x7'));var config=require('../../config/environment');var controller=require(_0x82d3('0x8'));router[_0x82d3('0x9')](_0x82d3('0xa'),auth['isAuthenticated'](),controller[_0x82d3('0xb')]);router['put'](_0x82d3('0xa'),auth[_0x82d3('0xc')](),controller[_0x82d3('0xd')]);router[_0x82d3('0xe')](_0x82d3('0xa'),auth[_0x82d3('0xc')](),controller[_0x82d3('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index b566f82..d56d2af 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 _0x677e=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x3cd541,_0x463ad5){var _0x3699e1=function(_0x5a4b60){while(--_0x5a4b60){_0x3cd541['push'](_0x3cd541['shift']());}};_0x3699e1(++_0x463ad5);}(_0x677e,0x8b));var _0xe677=function(_0x4fc5df,_0x3acaab){_0x4fc5df=_0x4fc5df-0x0;var _0x4a18f5=_0x677e[_0x4fc5df];return _0x4a18f5;};'use strict';var Sequelize=require(_0xe677('0x0'));module[_0xe677('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe677('0x2')],'allowNull':![],'defaultValue':_0xe677('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe677('0x2')]},'interval':{'type':Sequelize[_0xe677('0x2')],'defaultValue':_0xe677('0x4')}}; \ No newline at end of file +var _0x4ba7=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4ba7,0x1ee));var _0x74ba=function(_0x3d3d24,_0x16cb8e){_0x3d3d24=_0x3d3d24-0x0;var _0xd20cc4=_0x4ba7[_0x3d3d24];return _0xd20cc4;};'use strict';var Sequelize=require(_0x74ba('0x0'));module[_0x74ba('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x74ba('0x2')],'allowNull':![],'defaultValue':_0x74ba('0x3')},'appdata':{'type':Sequelize[_0x74ba('0x4')]()},'description':{'type':Sequelize[_0x74ba('0x2')]},'interval':{'type':Sequelize[_0x74ba('0x2')],'defaultValue':_0x74ba('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6723cf3..098ddb5 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x374dd2,_0x543f5e){var _0x4f4cfd=function(_0x4fb69d){while(--_0x4fb69d){_0x374dd2['push'](_0x374dd2['shift']());}};_0x4f4cfd(++_0x543f5e);}(_0x54ef,0x112));var _0xf54e=function(_0xbe91e4,_0x378f0a){_0xbe91e4=_0xbe91e4-0x0;var _0x4c301b=_0x54ef[_0xbe91e4];return _0x4c301b;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0xbdb7[_0x186d17];return _0x5d4b89;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 61ac70d..389e4a4 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 _0x21c2=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4'];(function(_0x1fc3a4,_0x5076cb){var _0x71782f=function(_0x29c05c){while(--_0x29c05c){_0x1fc3a4['push'](_0x1fc3a4['shift']());}};_0x71782f(++_0x5076cb);}(_0x21c2,0x150));var _0x221c=function(_0x31dacd,_0x36d6cf){_0x31dacd=_0x31dacd-0x0;var _0xe78bf6=_0x21c2[_0x31dacd];return _0xe78bf6;};'use strict';var _=require(_0x221c('0x0'));var util=require('util');var logger=require(_0x221c('0x1'))('api');var moment=require(_0x221c('0x2'));var BPromise=require(_0x221c('0x3'));var rp=require(_0x221c('0x4'));var fs=require('fs');var path=require(_0x221c('0x5'));var rimraf=require('rimraf');var config=require(_0x221c('0x6'));var attributes=require(_0x221c('0x7'));module['exports']=function(_0x2a408a,_0x2f2c7b){return _0x2a408a[_0x221c('0x8')](_0x221c('0x9'),attributes,{'tableName':_0x221c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x221c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd22d=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4_unicode_ci'];(function(_0x573b39,_0x4b7cff){var _0x284693=function(_0x35ace5){while(--_0x35ace5){_0x573b39['push'](_0x573b39['shift']());}};_0x284693(++_0x4b7cff);}(_0xd22d,0xe4));var _0xdd22=function(_0x27dfe7,_0x3acd6f){_0x27dfe7=_0x27dfe7-0x0;var _0x9d647c=_0xd22d[_0x27dfe7];return _0x9d647c;};'use strict';var _=require(_0xdd22('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdd22('0x1'));var BPromise=require(_0xdd22('0x2'));var rp=require(_0xdd22('0x3'));var fs=require('fs');var path=require(_0xdd22('0x4'));var rimraf=require(_0xdd22('0x5'));var config=require(_0xdd22('0x6'));var attributes=require(_0xdd22('0x7'));module[_0xdd22('0x8')]=function(_0x421ece,_0x799320){return _0x421ece['define'](_0xdd22('0x9'),attributes,{'tableName':_0xdd22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdd22('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 104c738..57713c3 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 _0x91f0=['http','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','update','body','options','raw','attributes','limit','UpdateMailApplication','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x56182a,_0x161e71){var _0x2a90b9=function(_0x322e00){while(--_0x322e00){_0x56182a['push'](_0x56182a['shift']());}};_0x2a90b9(++_0x161e71);}(_0x91f0,0x104));var _0x091f=function(_0x52901d,_0x3e8cc9){_0x52901d=_0x52901d-0x0;var _0x187041=_0x91f0[_0x52901d];return _0x187041;};'use strict';var _=require(_0x091f('0x0'));var util=require(_0x091f('0x1'));var moment=require('moment');var BPromise=require(_0x091f('0x2'));var rs=require(_0x091f('0x3'));var fs=require('fs');var Redis=require(_0x091f('0x4'));var db=require(_0x091f('0x5'))['db'];var utils=require(_0x091f('0x6'));var logger=require(_0x091f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x091f('0x8'));var client=jayson[_0x091f('0x9')][_0x091f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x152622,_0x2a0ec5,_0x3acbef){return new BPromise(function(_0x33bbfe,_0x1c4b8f){return client['request'](_0x152622,_0x3acbef)[_0x091f('0xb')](function(_0x36f4ac){logger['info'](_0x091f('0xc'),_0x2a0ec5,'request\x20sent');logger[_0x091f('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2a0ec5,_0x091f('0xe'),JSON['stringify'](_0x36f4ac));if(_0x36f4ac[_0x091f('0xf')]){if(_0x36f4ac[_0x091f('0xf')][_0x091f('0x10')]===0x1f4){logger[_0x091f('0xf')](_0x091f('0xc'),_0x2a0ec5,_0x36f4ac[_0x091f('0xf')][_0x091f('0x11')]);return _0x1c4b8f(_0x36f4ac[_0x091f('0xf')]['message']);}logger['error'](_0x091f('0xc'),_0x2a0ec5,_0x36f4ac[_0x091f('0xf')][_0x091f('0x11')]);return _0x33bbfe(_0x36f4ac[_0x091f('0xf')][_0x091f('0x11')]);}else{logger[_0x091f('0x12')](_0x091f('0xc'),_0x2a0ec5,_0x091f('0xe'));_0x33bbfe(_0x36f4ac['result'][_0x091f('0x11')]);}})['catch'](function(_0x4b189f){logger[_0x091f('0xf')](_0x091f('0xc'),_0x2a0ec5,_0x4b189f);_0x1c4b8f(_0x4b189f);});});}exports['UpdateMailApplication']=function(_0x13959e){var _0x4afc99=this;return new Promise(function(_0x3b6294,_0x160fcb){return db['MailApplication'][_0x091f('0x13')](_0x13959e[_0x091f('0x14')],{'raw':_0x13959e['options']?_0x13959e[_0x091f('0x15')][_0x091f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13959e['options']?_0x13959e[_0x091f('0x15')]['where']||null:null,'attributes':_0x13959e['options']?_0x13959e[_0x091f('0x15')][_0x091f('0x17')]||null:null,'limit':_0x13959e[_0x091f('0x15')]?_0x13959e[_0x091f('0x15')][_0x091f('0x18')]||null:null})[_0x091f('0xb')](function(_0x4a84b5){logger[_0x091f('0x12')](_0x091f('0x19'),_0x13959e);logger['debug'](_0x091f('0x19'),_0x13959e,JSON[_0x091f('0x1a')](_0x4a84b5));_0x3b6294(_0x4a84b5);})['catch'](function(_0x3655ef){logger[_0x091f('0xf')]('UpdateMailApplication',_0x3655ef[_0x091f('0x11')],_0x13959e);_0x160fcb(_0x4afc99['error'](0x1f4,_0x3655ef[_0x091f('0x11')]));});});}; \ No newline at end of file +var _0x069c=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateMailApplication','MailApplication','options','raw','where','attributes','limit','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x069c,0x83));var _0xc069=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x069c[_0x44a64f];return _0x52024b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc069('0x0'));var BPromise=require(_0xc069('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc069('0x2'));var db=require(_0xc069('0x3'))['db'];var utils=require(_0xc069('0x4'));var logger=require(_0xc069('0x5'))('rpc');var config=require(_0xc069('0x6'));var jayson=require(_0xc069('0x7'));var client=jayson[_0xc069('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x294bc7,_0x11b410,_0x39cef0){return new BPromise(function(_0x352f92,_0x10b375){return client[_0xc069('0x9')](_0x294bc7,_0x39cef0)[_0xc069('0xa')](function(_0x400112){logger[_0xc069('0xb')](_0xc069('0xc'),_0x11b410,_0xc069('0xd'));logger[_0xc069('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x11b410,_0xc069('0xd'),JSON['stringify'](_0x400112));if(_0x400112[_0xc069('0xf')]){if(_0x400112[_0xc069('0xf')][_0xc069('0x10')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x11b410,_0x400112[_0xc069('0xf')][_0xc069('0x11')]);return _0x10b375(_0x400112[_0xc069('0xf')]['message']);}logger['error'](_0xc069('0xc'),_0x11b410,_0x400112[_0xc069('0xf')][_0xc069('0x11')]);return _0x352f92(_0x400112[_0xc069('0xf')][_0xc069('0x11')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x11b410,_0xc069('0xd'));_0x352f92(_0x400112[_0xc069('0x12')][_0xc069('0x11')]);}})[_0xc069('0x13')](function(_0x127ca6){logger[_0xc069('0xf')](_0xc069('0xc'),_0x11b410,_0x127ca6);_0x10b375(_0x127ca6);});});}exports[_0xc069('0x14')]=function(_0x3e088a){var _0x4ea499=this;return new Promise(function(_0x1d7abf,_0xb23890){return db[_0xc069('0x15')]['update'](_0x3e088a['body'],{'raw':_0x3e088a[_0xc069('0x16')]?_0x3e088a['options'][_0xc069('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e088a['options']?_0x3e088a[_0xc069('0x16')][_0xc069('0x18')]||null:null,'attributes':_0x3e088a[_0xc069('0x16')]?_0x3e088a['options'][_0xc069('0x19')]||null:null,'limit':_0x3e088a[_0xc069('0x16')]?_0x3e088a[_0xc069('0x16')][_0xc069('0x1a')]||null:null})['then'](function(_0x40169f){logger[_0xc069('0xb')](_0xc069('0x14'),_0x3e088a);logger[_0xc069('0xe')]('UpdateMailApplication',_0x3e088a,JSON[_0xc069('0x1b')](_0x40169f));_0x1d7abf(_0x40169f);})['catch'](function(_0x361e43){logger['error'](_0xc069('0x14'),_0x361e43[_0xc069('0x11')],_0x3e088a);_0xb23890(_0x4ea499[_0xc069('0xf')](0x1f4,_0x361e43['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 68e0879..bba498d 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 _0x7cfb=['removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x119a22,_0x5701c6){var _0x17633e=function(_0x3e22b1){while(--_0x3e22b1){_0x119a22['push'](_0x119a22['shift']());}};_0x17633e(++_0x5701c6);}(_0x7cfb,0x12b));var _0xb7cf=function(_0x4bf341,_0x109f8b){_0x4bf341=_0x4bf341-0x0;var _0x2b2da4=_0x7cfb[_0x4bf341];return _0x2b2da4;};'use strict';var express=require('express');var router=express[_0xb7cf('0x0')]();var auth=require(_0xb7cf('0x1'));var interaction=require(_0xb7cf('0x2'));var controller=require(_0xb7cf('0x3'));router['get']('/',auth[_0xb7cf('0x4')](),controller[_0xb7cf('0x5')]);router[_0xb7cf('0x6')]('/describe',auth[_0xb7cf('0x4')](),controller['describe']);router[_0xb7cf('0x6')](_0xb7cf('0x7'),auth['isAuthenticated'](),controller[_0xb7cf('0x8')]);router[_0xb7cf('0x6')](_0xb7cf('0x9'),auth[_0xb7cf('0x4')](),controller[_0xb7cf('0xa')]);router[_0xb7cf('0x6')](_0xb7cf('0xb'),auth[_0xb7cf('0x4')](),controller[_0xb7cf('0xc')]);router[_0xb7cf('0xd')]('/',auth[_0xb7cf('0x4')](),controller[_0xb7cf('0xe')]);router[_0xb7cf('0xd')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb7cf('0xf')]);router[_0xb7cf('0xd')](_0xb7cf('0x10'),auth[_0xb7cf('0x4')](),interaction[_0xb7cf('0x11')](_0xb7cf('0x12'),_0xb7cf('0x13')),controller[_0xb7cf('0x14')]);router['put'](_0xb7cf('0x7'),auth['isAuthenticated'](),interaction[_0xb7cf('0x11')](_0xb7cf('0x12'),_0xb7cf('0x15')),controller[_0xb7cf('0x16')]);router[_0xb7cf('0x17')]('/:id',auth[_0xb7cf('0x4')](),interaction[_0xb7cf('0x11')](_0xb7cf('0x12'),_0xb7cf('0x18')),controller['destroy']);router[_0xb7cf('0x17')](_0xb7cf('0x10'),auth['isAuthenticated'](),controller[_0xb7cf('0x19')]);module[_0xb7cf('0x1a')]=router; \ No newline at end of file +var _0x4425=['mail','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mailinteraction:addtags','put','tracked'];(function(_0x4cca27,_0x18e06f){var _0x3d8219=function(_0x2ba31b){while(--_0x2ba31b){_0x4cca27['push'](_0x4cca27['shift']());}};_0x3d8219(++_0x18e06f);}(_0x4425,0x1e3));var _0x5442=function(_0x265168,_0xbbcec5){_0x265168=_0x265168-0x0;var _0x481e34=_0x4425[_0x265168];return _0x481e34;};'use strict';var express=require(_0x5442('0x0'));var router=express[_0x5442('0x1')]();var auth=require(_0x5442('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0x5442('0x3')]('/',auth['isAuthenticated'](),controller[_0x5442('0x4')]);router[_0x5442('0x3')](_0x5442('0x5'),auth[_0x5442('0x6')](),controller[_0x5442('0x7')]);router[_0x5442('0x3')](_0x5442('0x8'),auth[_0x5442('0x6')](),controller[_0x5442('0x9')]);router[_0x5442('0x3')](_0x5442('0xa'),auth[_0x5442('0x6')](),controller[_0x5442('0xb')]);router[_0x5442('0x3')](_0x5442('0xc'),auth['isAuthenticated'](),controller[_0x5442('0xd')]);router[_0x5442('0xe')]('/',auth[_0x5442('0x6')](),controller[_0x5442('0xf')]);router[_0x5442('0xe')](_0x5442('0xa'),auth[_0x5442('0x6')](),controller[_0x5442('0x10')]);router['post'](_0x5442('0x11'),auth[_0x5442('0x6')](),interaction['tracked']('mail',_0x5442('0x12')),controller['addTags']);router[_0x5442('0x13')](_0x5442('0x8'),auth[_0x5442('0x6')](),interaction[_0x5442('0x14')](_0x5442('0x15'),_0x5442('0x16')),controller[_0x5442('0x17')]);router[_0x5442('0x18')](_0x5442('0x8'),auth[_0x5442('0x6')](),interaction[_0x5442('0x14')](_0x5442('0x15'),_0x5442('0x19')),controller['destroy']);router['delete'](_0x5442('0x11'),auth['isAuthenticated'](),controller[_0x5442('0x1a')]);module[_0x5442('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 61de628..bdeaf88 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 _0xa5f8=['BOOLEAN','out','ENUM','iconv','exports','DATE','STRING','TEXT','long'];(function(_0x42a783,_0x284e89){var _0xa15dd=function(_0x10ea65){while(--_0x10ea65){_0x42a783['push'](_0x42a783['shift']());}};_0xa15dd(++_0x284e89);}(_0xa5f8,0x1e9));var _0x8a5f=function(_0xca3469,_0x277882){_0xca3469=_0xca3469-0x0;var _0x37ca41=_0xa5f8[_0xca3469];return _0x37ca41;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8a5f('0x0'));module[_0x8a5f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a5f('0x2')]},'disposition':{'type':Sequelize[_0x8a5f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8a5f('0x3')]},'note':{'type':Sequelize[_0x8a5f('0x3')]},'inReplyTo':{'type':Sequelize[_0x8a5f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8a5f('0x3')]},'cc':{'type':Sequelize[_0x8a5f('0x4')](_0x8a5f('0x5'))},'subject':{'type':Sequelize[_0x8a5f('0x4')]()},'attach':{'type':Sequelize[_0x8a5f('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8a5f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a5f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8a5f('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb46a=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize'];(function(_0x24d4b1,_0x2bfd26){var _0x1b6865=function(_0x25c4ac){while(--_0x25c4ac){_0x24d4b1['push'](_0x24d4b1['shift']());}};_0x1b6865(++_0x2bfd26);}(_0xb46a,0x77));var _0xab46=function(_0x3f556f,_0x3fdbb4){_0x3f556f=_0x3f556f-0x0;var _0x26ea56=_0xb46a[_0x3f556f];return _0x26ea56;};'use strict';var Sequelize=require(_0xab46('0x0'));var iconv=require('iconv');module[_0xab46('0x1')]={'closed':{'type':Sequelize[_0xab46('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xab46('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xab46('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xab46('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xab46('0x5')](_0xab46('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xab46('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xab46('0x3')]},'substatus':{'type':Sequelize[_0xab46('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xab46('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xab46('0x7')]('in',_0xab46('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab46('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xab46('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xab46('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab46('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b788a45..ae13567 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 _0x9631=['key','getOptions','findAll','query','user','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','update','params','body','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName'];(function(_0x3efd41,_0x21aac6){var _0x4ca5ba=function(_0x3c66a1){while(--_0x3c66a1){_0x3efd41['push'](_0x3efd41['shift']());}};_0x4ca5ba(++_0x21aac6);}(_0x9631,0x1af));var _0x1963=function(_0x1e9300,_0x1cd496){_0x1e9300=_0x1e9300-0x0;var _0x39573d=_0x9631[_0x1e9300];return _0x39573d;};'use strict';var emlformat=require(_0x1963('0x0'));var rimraf=require(_0x1963('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x1963('0x2'));var util=require('util');var path=require(_0x1963('0x3'));var fs=require('fs');var _=require(_0x1963('0x4'));var juice=require(_0x1963('0x5'));var Redis=require(_0x1963('0x6'));var interaction=require(_0x1963('0x7'));var qs=require(_0x1963('0x8'));var logger=require(_0x1963('0x9'))(_0x1963('0xa'));var config=require(_0x1963('0xb'));var db=require(_0x1963('0xc'))['db'];var htmlEntities=require(_0x1963('0xd'));config[_0x1963('0xe')]=_['defaults'](config[_0x1963('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x1963('0xf'))(new Redis(config[_0x1963('0xe')]));require('./mailInteraction.socket')[_0x1963('0x10')](socket);function respondWithStatusCode(_0x360a7a,_0xd9d933){_0xd9d933=_0xd9d933||0xcc;return function(_0x411bc7){if(_0x411bc7){return _0x360a7a[_0x1963('0x11')](_0xd9d933);}return _0x360a7a[_0x1963('0x12')](_0xd9d933)['end']();};}function respondWithResult(_0x223da8,_0x10c09b){_0x10c09b=_0x10c09b||0xc8;return function(_0x4f726f){if(_0x4f726f){return _0x223da8[_0x1963('0x12')](_0x10c09b)[_0x1963('0x13')](_0x4f726f);}};}function respondWithFilteredResult(_0x4575c6,_0x144b1f){return function(_0x7624fe){if(_0x7624fe){var _0x19bc65=typeof _0x144b1f[_0x1963('0x14')]===_0x1963('0x15')&&typeof _0x144b1f[_0x1963('0x16')]==='undefined';var _0x24589a=_0x7624fe[_0x1963('0x17')];var _0x2c43d3=_0x19bc65?0x0:_0x144b1f[_0x1963('0x14')];var _0x3196a3=_0x19bc65?_0x7624fe[_0x1963('0x17')]:_0x144b1f[_0x1963('0x14')]+_0x144b1f[_0x1963('0x16')];var _0x40d4b5;if(_0x3196a3>=_0x24589a){_0x3196a3=_0x24589a;_0x40d4b5=0xc8;}else{_0x40d4b5=0xce;}_0x4575c6[_0x1963('0x12')](_0x40d4b5);return _0x4575c6[_0x1963('0x18')](_0x1963('0x19'),_0x2c43d3+'-'+_0x3196a3+'/'+_0x24589a)[_0x1963('0x13')](_0x7624fe);}return null;};}function saveUpdates(_0x1d7cb7){return function(_0x52d930){if(_0x52d930){return _0x52d930['update'](_0x1d7cb7)[_0x1963('0x1a')](function(_0x525035){return _0x525035;});}return null;};}function removeEntity(_0x6e365d){return function(_0x1a41ea){if(_0x1a41ea){return _0x1a41ea[_0x1963('0x1b')]()[_0x1963('0x1a')](function(){_0x6e365d['status'](0xcc)[_0x1963('0x1c')]();});}};}function handleEntityNotFound(_0x234c94){return function(_0x487f5a){if(!_0x487f5a){_0x234c94['sendStatus'](0x194);}return _0x487f5a;};}function handleError(_0x3a5509,_0xe2e6b2){_0xe2e6b2=_0xe2e6b2||0x1f4;return function(_0x18e4ab){logger['error'](_0x18e4ab[_0x1963('0x1d')]);if(_0x18e4ab['name']){delete _0x18e4ab[_0x1963('0x1e')];}_0x3a5509['status'](_0xe2e6b2)[_0x1963('0x1f')](_0x18e4ab);};}exports[_0x1963('0x20')]=function(_0x312079,_0xd00a9d){var _0x569d31={};var _0x799107=_[_0x1963('0x21')](db[_0x1963('0x22')][_0x1963('0x23')],function(_0x26f81e){return{'name':_0x26f81e[_0x1963('0x24')],'type':_0x26f81e['type'][_0x1963('0x25')]};});_0x569d31=qs[_0x1963('0x26')](_0x799107,_0x312079);return interaction[_0x1963('0x27')]('mail',_0x312079[_0x1963('0x28')],_0x312079[_0x1963('0x29')],_0x569d31,_0x799107)[_0x1963('0x1a')](respondWithFilteredResult(_0xd00a9d,_0x569d31))[_0x1963('0x2a')](handleError(_0xd00a9d,null));};exports[_0x1963('0x2b')]=function(_0x1cf5a6,_0x48a566){var _0x379fa2={'raw':![],'where':{'id':_0x1cf5a6['params']['id']}},_0x2da0a1={};_0x2da0a1['model']=_['keys'](db[_0x1963('0x22')][_0x1963('0x23')]);_0x2da0a1['query']=_[_0x1963('0x2c')](_0x1cf5a6[_0x1963('0x28')]);_0x2da0a1[_0x1963('0x2d')]=_[_0x1963('0x2e')](_0x2da0a1[_0x1963('0x2f')],_0x2da0a1[_0x1963('0x28')]);_0x379fa2[_0x1963('0x30')]=_['intersection'](_0x2da0a1[_0x1963('0x2f')],qs[_0x1963('0x31')](_0x1cf5a6[_0x1963('0x28')][_0x1963('0x31')]));_0x379fa2[_0x1963('0x30')]=_0x379fa2['attributes'][_0x1963('0x32')]?_0x379fa2['attributes']:_0x2da0a1[_0x1963('0x2f')];if(_0x1cf5a6[_0x1963('0x28')][_0x1963('0x33')]){_0x379fa2['include']=[{'all':!![]}];}_0x379fa2=_[_0x1963('0x34')]({},_0x379fa2,_0x1cf5a6['options']);return db[_0x1963('0x22')][_0x1963('0x35')](_0x379fa2)[_0x1963('0x1a')](handleEntityNotFound(_0x48a566,null))[_0x1963('0x1a')](respondWithResult(_0x48a566,null))[_0x1963('0x2a')](handleError(_0x48a566,null));};exports[_0x1963('0x36')]=function(_0x21d358,_0x407066){return db['MailInteraction'][_0x1963('0x36')](_0x21d358['body'],{})['then'](respondWithResult(_0x407066,0xc9))['catch'](handleError(_0x407066,null));};exports[_0x1963('0x37')]=function(_0x4914ad,_0x2b2ee7){if(_0x4914ad['body']['id']){delete _0x4914ad['body']['id'];}return db['MailInteraction'][_0x1963('0x35')]({'where':{'id':_0x4914ad[_0x1963('0x38')]['id']}})[_0x1963('0x1a')](handleEntityNotFound(_0x2b2ee7,null))[_0x1963('0x1a')](saveUpdates(_0x4914ad[_0x1963('0x39')],null))[_0x1963('0x1a')](respondWithResult(_0x2b2ee7,null))[_0x1963('0x2a')](handleError(_0x2b2ee7,null));};exports[_0x1963('0x1b')]=function(_0x3425bf,_0x1ae5cc){return db['MailInteraction'][_0x1963('0x35')]({'where':{'id':_0x3425bf[_0x1963('0x38')]['id']}})[_0x1963('0x1a')](handleEntityNotFound(_0x1ae5cc,null))[_0x1963('0x1a')](removeEntity(_0x1ae5cc,null))['catch'](handleError(_0x1ae5cc,null));};exports['describe']=function(_0x125a76,_0x496f3a){return db[_0x1963('0x22')][_0x1963('0x3a')]()[_0x1963('0x1a')](respondWithResult(_0x496f3a,null))[_0x1963('0x2a')](handleError(_0x496f3a,null));};exports[_0x1963('0x3b')]=function(_0x420970,_0x2e28a9){return db[_0x1963('0x3c')]['find']({'where':{'id':_0x420970['params']['id']}})['then'](handleEntityNotFound(_0x2e28a9,null))[_0x1963('0x1a')](function(_0x30d62b){if(_0x30d62b){return _0x30d62b[_0x1963('0x3b')](_0x420970[_0x1963('0x39')][_0x1963('0x3d')],_[_0x1963('0x3e')](_0x420970[_0x1963('0x39')],['ids','id'])||{});}})[_0x1963('0x1a')](respondWithResult(_0x2e28a9,null))[_0x1963('0x2a')](handleError(_0x2e28a9,null));};exports[_0x1963('0x3f')]=function(_0xd9b061,_0x2586cb){var _0x74b2c2={'raw':![],'where':{}};var _0x3f6536={};var _0x3953f8={'count':0x0,'rows':[]};return db[_0x1963('0x22')]['findOne']({'where':{'id':_0xd9b061[_0x1963('0x38')]['id']}})[_0x1963('0x1a')](handleEntityNotFound(_0x2586cb,null))[_0x1963('0x1a')](function(_0x665d74){if(_0x665d74){_0x3f6536[_0x1963('0x2f')]=_[_0x1963('0x2c')](db[_0x1963('0x3c')][_0x1963('0x23')]);_0x3f6536['query']=_[_0x1963('0x2c')](_0xd9b061[_0x1963('0x28')]);_0x3f6536[_0x1963('0x2d')]=_[_0x1963('0x2e')](_0x3f6536['model'],_0x3f6536['query']);_0x74b2c2['attributes']=_[_0x1963('0x2e')](_0x3f6536[_0x1963('0x2f')],qs['fields'](_0xd9b061[_0x1963('0x28')][_0x1963('0x31')]));_0x74b2c2[_0x1963('0x30')]=_0x74b2c2[_0x1963('0x30')][_0x1963('0x32')]?_0x74b2c2[_0x1963('0x30')]:_0x3f6536[_0x1963('0x2f')];if(!_0xd9b061['query'][_0x1963('0x40')](_0x1963('0x41'))){_0x74b2c2[_0x1963('0x16')]=qs[_0x1963('0x16')](_0xd9b061[_0x1963('0x28')]['limit']);_0x74b2c2[_0x1963('0x14')]=qs[_0x1963('0x14')](_0xd9b061[_0x1963('0x28')]['offset']);}_0x74b2c2[_0x1963('0x42')]=qs[_0x1963('0x43')](_0xd9b061[_0x1963('0x28')][_0x1963('0x43')]);_0x74b2c2[_0x1963('0x44')]=qs[_0x1963('0x2d')](_[_0x1963('0x45')](_0xd9b061['query'],_0x3f6536[_0x1963('0x2d')]));_0x74b2c2[_0x1963('0x44')][_0x1963('0x46')]=_0x665d74['id'];if(_0xd9b061[_0x1963('0x28')][_0x1963('0x47')]){_0x74b2c2[_0x1963('0x44')]=_['merge'](_0x74b2c2[_0x1963('0x44')],{'$or':_[_0x1963('0x21')](_0x74b2c2['attributes'],function(_0x4729b6){var _0x24e828={};_0x24e828[_0x4729b6]={'$like':'%'+_0xd9b061[_0x1963('0x28')]['filter']+'%'};return _0x24e828;})});}if(_0xd9b061[_0x1963('0x28')][_0x1963('0x48')]){var _0x38fc80=_0xd9b061['query'][_0x1963('0x48')][_0x1963('0x49')](',');var _0x5c5648={};_0x5c5648[_0x38fc80[0x0]]={'$gte':moment(_0x38fc80[0x1])[_0x1963('0x4a')](_0x1963('0x4b'))};_0x74b2c2[_0x1963('0x44')]=_[_0x1963('0x34')](_0x74b2c2['where'],_0x5c5648);}_0x74b2c2=_['merge']({},_0x74b2c2,_0xd9b061['options']);return db[_0x1963('0x3c')]['count']({'where':_0x74b2c2[_0x1963('0x44')]})[_0x1963('0x1a')](function(_0x56c61c){_0x3953f8[_0x1963('0x17')]=_0x56c61c;if(_0xd9b061[_0x1963('0x28')][_0x1963('0x33')]){_0x74b2c2[_0x1963('0x4c')]=[{'all':!![]}];}return db[_0x1963('0x3c')][_0x1963('0x27')](_0x74b2c2);})[_0x1963('0x1a')](function(_0x1b56e6){if(_0xd9b061[_0x1963('0x28')]['inlineCss']===_0x1963('0x4d')){for(var _0x409e8c=0x0;_0x409e8c<_0x1b56e6[_0x1963('0x32')];_0x409e8c++){_0x1b56e6[_0x409e8c][_0x1963('0x39')]=juice(_0x1b56e6[_0x409e8c][_0x1963('0x39')]);}}_0x3953f8[_0x1963('0x4e')]=_0x1b56e6;return _0x3953f8;});}})[_0x1963('0x1a')](respondWithFilteredResult(_0x2586cb,_0x74b2c2))['catch'](handleError(_0x2586cb,null));};exports[_0x1963('0x4f')]=function(_0x336cf0,_0x39fa92){return db[_0x1963('0x22')][_0x1963('0x35')]({'where':{'id':_0x336cf0['params']['id']}})['then'](handleEntityNotFound(_0x39fa92,null))[_0x1963('0x1a')](function(_0x4914ab){if(_0x4914ab){return _0x4914ab[_0x1963('0x50')](_0x336cf0[_0x1963('0x39')][_0x1963('0x3d')],_[_0x1963('0x3e')](_0x336cf0[_0x1963('0x39')],[_0x1963('0x3d'),'id'])||{})[_0x1963('0x51')](function(){return db[_0x1963('0x52')]['findAll']({'attributes':['id','name',_0x1963('0x53')],'where':{'id':_0x336cf0[_0x1963('0x39')]['ids']}});})[_0x1963('0x1a')](function(_0x522e37){socket['emit'](_0x1963('0x54'),{'id':Number(_0x336cf0['params']['id']),'tags':_0x522e37||[]});return{'id':Number(_0x336cf0['params']['id']),'tags':_0x522e37||[]};});}})[_0x1963('0x1a')](respondWithResult(_0x39fa92,null))[_0x1963('0x2a')](handleError(_0x39fa92,null));};exports['removeTags']=function(_0x12f870,_0x13ddbe){return db[_0x1963('0x22')][_0x1963('0x35')]({'where':{'id':_0x12f870[_0x1963('0x38')]['id']}})[_0x1963('0x1a')](handleEntityNotFound(_0x13ddbe,null))[_0x1963('0x1a')](function(_0xadf41f){if(_0xadf41f){return _0xadf41f[_0x1963('0x55')](_0x12f870[_0x1963('0x28')][_0x1963('0x3d')]);}})[_0x1963('0x1a')](respondWithStatusCode(_0x13ddbe,null))[_0x1963('0x2a')](handleError(_0x13ddbe,null));};exports[_0x1963('0x56')]=function(_0x2f9e7e,_0x9db14){var _0x4cdb4f=moment()[_0x1963('0x57')]()[_0x1963('0x58')]();var _0x208b4e=path[_0x1963('0x59')](config[_0x1963('0x5a')],'server','files','tmp');var _0x4c551d=path['join'](config[_0x1963('0x5a')],_0x1963('0x5b'),_0x1963('0x5c'),_0x1963('0x5d'));var _0x29c28d=path[_0x1963('0x59')](_0x208b4e,_0x4cdb4f);var _0x128e3c=util[_0x1963('0x4a')](_0x1963('0x5e'),_0x2f9e7e[_0x1963('0x38')]['id'],_0x4cdb4f);var _0x560e6f=path['join'](_0x208b4e,_0x128e3c);var _0x32c146=[];if(_0x2f9e7e['query'][_0x1963('0x5d')]){_0x32c146['push']({'model':db[_0x1963('0x5f')],'as':_0x1963('0x60'),'raw':!![]});}var _0xbbaeec=[{'model':db[_0x1963('0x3c')],'as':_0x1963('0x61'),'attributes':['id',_0x1963('0x39'),_0x1963('0x62'),'to','cc',_0x1963('0x63'),_0x1963('0x64'),_0x1963('0x65')],'where':{'secret':![]},'order':qs[_0x1963('0x43')]('id'),'include':_0x32c146}];return db[_0x1963('0x22')][_0x1963('0x35')]({'where':{'id':_0x2f9e7e['params']['id']},'include':_0xbbaeec})['then'](handleEntityNotFound(_0x9db14,null))['then'](function(_0x576021){if(_0x576021&&_0x576021[_0x1963('0x61')]){var _0xe34275=_0x576021[_0x1963('0x66')]({'plain':!![]});fs[_0x1963('0x67')](_0x29c28d);return BPromise[_0x1963('0x68')](_0xe34275[_0x1963('0x61')],function(_0x516164,_0x35e2ae){var _0x1e62bf={'from':_0x516164['from'],'to':_0x516164['to']||_0x1963('0x69'),'subject':_0x516164[_0x1963('0x64')],'html':htmlEntities[_0x1963('0x6a')](_0x516164['body']),'headers':{'Date':moment(_0x516164[_0x1963('0x65')])[_0x1963('0x4a')](_0x1963('0x6b'))},'attachments':[]};if(_0x516164['cc']){_0x1e62bf[_0x1963('0x6c')]['Cc']=_0x516164['cc'];}if(_0x516164[_0x1963('0x63')]){_0x1e62bf[_0x1963('0x6c')][_0x1963('0x6d')]=_0x516164[_0x1963('0x63')];}return new BPromise(function(_0x2f59af,_0x4cd6dd){if(_0x516164['Attachments']){for(var _0x5444c0=0x0;_0x5444c0<_0x516164['Attachments'][_0x1963('0x32')];_0x5444c0++){var _0x40806f=_0x516164[_0x1963('0x60')][_0x5444c0];var _0x380754=path[_0x1963('0x59')](_0x4c551d,_0x40806f['basename']);if(fs[_0x1963('0x6e')](_0x380754)){_0x1e62bf[_0x1963('0x5d')][_0x1963('0x6f')]({'name':_0x40806f[_0x1963('0x1e')],'contentType':_0x40806f['type'],'data':fs[_0x1963('0x70')](_0x380754)});}}}emlformat[_0x1963('0x71')](_0x1e62bf,function(_0x1e9bf1,_0x2789b5){if(_0x1e9bf1)return _0x4cd6dd(_0x1e9bf1);fs[_0x1963('0x72')](path[_0x1963('0x59')](_0x29c28d,util[_0x1963('0x4a')](_0x1963('0x73'),_0x35e2ae)),_0x2789b5);return _0x2f59af(_0x2789b5);});});})['then'](function(){return new BPromise(function(_0x3d5ece,_0x42aa36){zipdir(_0x29c28d,{'saveTo':_0x560e6f},function(_0x5ece1c,_0x14dd1a){if(_0x5ece1c)return _0x42aa36(_0x5ece1c);return _0x3d5ece(_0x14dd1a);});})[_0x1963('0x1a')](function(){return new BPromise(function(_0xfe3eb3,_0x3128cd){rimraf(_0x29c28d,function(_0x2726b8){if(_0x2726b8)_0x3128cd(_0x2726b8);return _0xfe3eb3();});});})[_0x1963('0x1a')](function(){return _0x9db14['download'](_0x560e6f,_0x128e3c,function(_0x62528f){if(!_0x62528f)fs[_0x1963('0x74')](_0x560e6f);});});});}else{return _0x9db14['sendStatus'](0xc8);}})['catch'](handleError(_0x9db14,null));}; \ No newline at end of file +var _0xc2d9=['Bcc','Attachments','basename','build','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','offset','undefined','count','status','set','Content-Range','json','update','then','destroy','name','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','limit','order','sort','where','pick','MailInteractionId','filter','split','format','MailMessage','inlineCss','length','rows','addTags','setTags','spread','Tag','unix','toString','join','root','server','tmp','files','attachments','push','Attachment','Messages','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','headers'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc2d9,0x144));var _0x9c2d=function(_0x2e4774,_0x44bec2){_0x2e4774=_0x2e4774-0x0;var _0x327525=_0xc2d9[_0x2e4774];return _0x327525;};'use strict';var emlformat=require(_0x9c2d('0x0'));var rimraf=require(_0x9c2d('0x1'));var zipdir=require('zip-dir');var moment=require(_0x9c2d('0x2'));var BPromise=require(_0x9c2d('0x3'));var util=require(_0x9c2d('0x4'));var path=require(_0x9c2d('0x5'));var fs=require('fs');var _=require(_0x9c2d('0x6'));var juice=require(_0x9c2d('0x7'));var Redis=require('ioredis');var interaction=require(_0x9c2d('0x8'));var qs=require(_0x9c2d('0x9'));var logger=require('../../config/logger')(_0x9c2d('0xa'));var config=require('../../config/environment');var db=require(_0x9c2d('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x9c2d('0xc')]=_[_0x9c2d('0xd')](config[_0x9c2d('0xc')],{'host':_0x9c2d('0xe'),'port':0x18eb});var socket=require(_0x9c2d('0xf'))(new Redis(config['redis']));require(_0x9c2d('0x10'))[_0x9c2d('0x11')](socket);function respondWithStatusCode(_0x5c44e5,_0x210b72){_0x210b72=_0x210b72||0xcc;return function(_0xee0b8){if(_0xee0b8){return _0x5c44e5[_0x9c2d('0x12')](_0x210b72);}return _0x5c44e5['status'](_0x210b72)[_0x9c2d('0x13')]();};}function respondWithResult(_0x2ab2b8,_0x52e798){_0x52e798=_0x52e798||0xc8;return function(_0x27f6cd){if(_0x27f6cd){return _0x2ab2b8['status'](_0x52e798)['json'](_0x27f6cd);}};}function respondWithFilteredResult(_0x15d0cc,_0x109165){return function(_0x1aacaa){if(_0x1aacaa){var _0x1514c4=typeof _0x109165[_0x9c2d('0x14')]===_0x9c2d('0x15')&&typeof _0x109165['limit']===_0x9c2d('0x15');var _0x555866=_0x1aacaa[_0x9c2d('0x16')];var _0x3fe657=_0x1514c4?0x0:_0x109165[_0x9c2d('0x14')];var _0x5e4720=_0x1514c4?_0x1aacaa['count']:_0x109165['offset']+_0x109165['limit'];var _0x5ae5b4;if(_0x5e4720>=_0x555866){_0x5e4720=_0x555866;_0x5ae5b4=0xc8;}else{_0x5ae5b4=0xce;}_0x15d0cc[_0x9c2d('0x17')](_0x5ae5b4);return _0x15d0cc[_0x9c2d('0x18')](_0x9c2d('0x19'),_0x3fe657+'-'+_0x5e4720+'/'+_0x555866)[_0x9c2d('0x1a')](_0x1aacaa);}return null;};}function saveUpdates(_0xb75a65){return function(_0x2fc7f9){if(_0x2fc7f9){return _0x2fc7f9[_0x9c2d('0x1b')](_0xb75a65)[_0x9c2d('0x1c')](function(_0x5ac8d4){return _0x5ac8d4;});}return null;};}function removeEntity(_0x4d6f48){return function(_0x9e1750){if(_0x9e1750){return _0x9e1750[_0x9c2d('0x1d')]()[_0x9c2d('0x1c')](function(){_0x4d6f48[_0x9c2d('0x17')](0xcc)[_0x9c2d('0x13')]();});}};}function handleEntityNotFound(_0x582a9a){return function(_0x57cc9f){if(!_0x57cc9f){_0x582a9a[_0x9c2d('0x12')](0x194);}return _0x57cc9f;};}function handleError(_0x4ecdbd,_0x13c72f){_0x13c72f=_0x13c72f||0x1f4;return function(_0x2250b5){logger['error'](_0x2250b5['stack']);if(_0x2250b5[_0x9c2d('0x1e')]){delete _0x2250b5[_0x9c2d('0x1e')];}_0x4ecdbd[_0x9c2d('0x17')](_0x13c72f)['send'](_0x2250b5);};}exports['index']=function(_0xd302b8,_0x27819e){var _0x966b07={};var _0x5cfdc0=_[_0x9c2d('0x1f')](db[_0x9c2d('0x20')][_0x9c2d('0x21')],function(_0x53581c){return{'name':_0x53581c[_0x9c2d('0x22')],'type':_0x53581c[_0x9c2d('0x23')][_0x9c2d('0x24')]};});_0x966b07=qs[_0x9c2d('0x25')](_0x5cfdc0,_0xd302b8);return interaction[_0x9c2d('0x26')]('mail',_0xd302b8[_0x9c2d('0x27')],_0xd302b8[_0x9c2d('0x28')],_0x966b07,_0x5cfdc0)['then'](respondWithFilteredResult(_0x27819e,_0x966b07))[_0x9c2d('0x29')](handleError(_0x27819e,null));};exports['show']=function(_0x4be854,_0x5327e0){var _0x3f344b={'raw':![],'where':{'id':_0x4be854[_0x9c2d('0x2a')]['id']}},_0x12df32={};_0x12df32['model']=_[_0x9c2d('0x2b')](db[_0x9c2d('0x20')][_0x9c2d('0x21')]);_0x12df32[_0x9c2d('0x27')]=_[_0x9c2d('0x2b')](_0x4be854[_0x9c2d('0x27')]);_0x12df32[_0x9c2d('0x2c')]=_[_0x9c2d('0x2d')](_0x12df32[_0x9c2d('0x2e')],_0x12df32[_0x9c2d('0x27')]);_0x3f344b[_0x9c2d('0x2f')]=_['intersection'](_0x12df32[_0x9c2d('0x2e')],qs[_0x9c2d('0x30')](_0x4be854[_0x9c2d('0x27')]['fields']));_0x3f344b[_0x9c2d('0x2f')]=_0x3f344b[_0x9c2d('0x2f')]['length']?_0x3f344b[_0x9c2d('0x2f')]:_0x12df32[_0x9c2d('0x2e')];if(_0x4be854[_0x9c2d('0x27')][_0x9c2d('0x31')]){_0x3f344b['include']=[{'all':!![]}];}_0x3f344b=_[_0x9c2d('0x32')]({},_0x3f344b,_0x4be854[_0x9c2d('0x33')]);return db[_0x9c2d('0x20')]['find'](_0x3f344b)[_0x9c2d('0x1c')](handleEntityNotFound(_0x5327e0,null))[_0x9c2d('0x1c')](respondWithResult(_0x5327e0,null))[_0x9c2d('0x29')](handleError(_0x5327e0,null));};exports[_0x9c2d('0x34')]=function(_0x54ed04,_0x18d0a6){return db[_0x9c2d('0x20')][_0x9c2d('0x34')](_0x54ed04[_0x9c2d('0x35')],{})[_0x9c2d('0x1c')](respondWithResult(_0x18d0a6,0xc9))[_0x9c2d('0x29')](handleError(_0x18d0a6,null));};exports[_0x9c2d('0x1b')]=function(_0x5149c1,_0x2ff1a3){if(_0x5149c1[_0x9c2d('0x35')]['id']){delete _0x5149c1['body']['id'];}return db[_0x9c2d('0x20')][_0x9c2d('0x36')]({'where':{'id':_0x5149c1[_0x9c2d('0x2a')]['id']}})[_0x9c2d('0x1c')](handleEntityNotFound(_0x2ff1a3,null))[_0x9c2d('0x1c')](saveUpdates(_0x5149c1[_0x9c2d('0x35')],null))['then'](respondWithResult(_0x2ff1a3,null))[_0x9c2d('0x29')](handleError(_0x2ff1a3,null));};exports[_0x9c2d('0x1d')]=function(_0x208ac8,_0x10a3ac){return db[_0x9c2d('0x20')][_0x9c2d('0x36')]({'where':{'id':_0x208ac8[_0x9c2d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x10a3ac,null))[_0x9c2d('0x1c')](removeEntity(_0x10a3ac,null))[_0x9c2d('0x29')](handleError(_0x10a3ac,null));};exports[_0x9c2d('0x37')]=function(_0x58a5ac,_0x5143ad){return db[_0x9c2d('0x20')][_0x9c2d('0x37')]()['then'](respondWithResult(_0x5143ad,null))[_0x9c2d('0x29')](handleError(_0x5143ad,null));};exports[_0x9c2d('0x38')]=function(_0x51b08c,_0x37d636){return db['MailMessage']['find']({'where':{'id':_0x51b08c[_0x9c2d('0x2a')]['id']}})[_0x9c2d('0x1c')](handleEntityNotFound(_0x37d636,null))['then'](function(_0x26f5b8){if(_0x26f5b8){return _0x26f5b8[_0x9c2d('0x38')](_0x51b08c['body'][_0x9c2d('0x39')],_[_0x9c2d('0x3a')](_0x51b08c[_0x9c2d('0x35')],['ids','id'])||{});}})[_0x9c2d('0x1c')](respondWithResult(_0x37d636,null))[_0x9c2d('0x29')](handleError(_0x37d636,null));};exports[_0x9c2d('0x3b')]=function(_0x43e8cd,_0x50d0e2){var _0x43a98a={'raw':![],'where':{}};var _0x15ca9b={};var _0x252846={'count':0x0,'rows':[]};return db[_0x9c2d('0x20')][_0x9c2d('0x3c')]({'where':{'id':_0x43e8cd[_0x9c2d('0x2a')]['id']}})[_0x9c2d('0x1c')](handleEntityNotFound(_0x50d0e2,null))[_0x9c2d('0x1c')](function(_0x6caa93){if(_0x6caa93){_0x15ca9b[_0x9c2d('0x2e')]=_[_0x9c2d('0x2b')](db['MailMessage'][_0x9c2d('0x21')]);_0x15ca9b[_0x9c2d('0x27')]=_[_0x9c2d('0x2b')](_0x43e8cd[_0x9c2d('0x27')]);_0x15ca9b[_0x9c2d('0x2c')]=_[_0x9c2d('0x2d')](_0x15ca9b[_0x9c2d('0x2e')],_0x15ca9b['query']);_0x43a98a[_0x9c2d('0x2f')]=_[_0x9c2d('0x2d')](_0x15ca9b[_0x9c2d('0x2e')],qs[_0x9c2d('0x30')](_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x30')]));_0x43a98a[_0x9c2d('0x2f')]=_0x43a98a[_0x9c2d('0x2f')]['length']?_0x43a98a['attributes']:_0x15ca9b[_0x9c2d('0x2e')];if(!_0x43e8cd['query'][_0x9c2d('0x3d')](_0x9c2d('0x3e'))){_0x43a98a[_0x9c2d('0x3f')]=qs[_0x9c2d('0x3f')](_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x3f')]);_0x43a98a[_0x9c2d('0x14')]=qs[_0x9c2d('0x14')](_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x14')]);}_0x43a98a[_0x9c2d('0x40')]=qs[_0x9c2d('0x41')](_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x41')]);_0x43a98a[_0x9c2d('0x42')]=qs[_0x9c2d('0x2c')](_[_0x9c2d('0x43')](_0x43e8cd[_0x9c2d('0x27')],_0x15ca9b[_0x9c2d('0x2c')]));_0x43a98a[_0x9c2d('0x42')][_0x9c2d('0x44')]=_0x6caa93['id'];if(_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x45')]){_0x43a98a['where']=_[_0x9c2d('0x32')](_0x43a98a[_0x9c2d('0x42')],{'$or':_[_0x9c2d('0x1f')](_0x43a98a['attributes'],function(_0x2b73c5){var _0x3f9137={};_0x3f9137[_0x2b73c5]={'$like':'%'+_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x45')]+'%'};return _0x3f9137;})});}if(_0x43e8cd[_0x9c2d('0x27')]['$gte']){var _0x1bcb78=_0x43e8cd[_0x9c2d('0x27')]['$gte'][_0x9c2d('0x46')](',');var _0x5b2a5f={};_0x5b2a5f[_0x1bcb78[0x0]]={'$gte':moment(_0x1bcb78[0x1])[_0x9c2d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x43a98a[_0x9c2d('0x42')]=_[_0x9c2d('0x32')](_0x43a98a[_0x9c2d('0x42')],_0x5b2a5f);}_0x43a98a=_[_0x9c2d('0x32')]({},_0x43a98a,_0x43e8cd[_0x9c2d('0x33')]);return db[_0x9c2d('0x48')][_0x9c2d('0x16')]({'where':_0x43a98a['where']})['then'](function(_0x48e7fd){_0x252846[_0x9c2d('0x16')]=_0x48e7fd;if(_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x31')]){_0x43a98a['include']=[{'all':!![]}];}return db[_0x9c2d('0x48')][_0x9c2d('0x26')](_0x43a98a);})[_0x9c2d('0x1c')](function(_0x2fdb36){if(_0x43e8cd[_0x9c2d('0x27')][_0x9c2d('0x49')]==='true'){for(var _0x286dc5=0x0;_0x286dc5<_0x2fdb36[_0x9c2d('0x4a')];_0x286dc5++){_0x2fdb36[_0x286dc5][_0x9c2d('0x35')]=juice(_0x2fdb36[_0x286dc5][_0x9c2d('0x35')]);}}_0x252846[_0x9c2d('0x4b')]=_0x2fdb36;return _0x252846;});}})[_0x9c2d('0x1c')](respondWithFilteredResult(_0x50d0e2,_0x43a98a))[_0x9c2d('0x29')](handleError(_0x50d0e2,null));};exports[_0x9c2d('0x4c')]=function(_0x31fd3e,_0x56ab30){return db['MailInteraction'][_0x9c2d('0x36')]({'where':{'id':_0x31fd3e[_0x9c2d('0x2a')]['id']}})[_0x9c2d('0x1c')](handleEntityNotFound(_0x56ab30,null))[_0x9c2d('0x1c')](function(_0x38b0f4){if(_0x38b0f4){return _0x38b0f4[_0x9c2d('0x4d')](_0x31fd3e[_0x9c2d('0x35')]['ids'],_[_0x9c2d('0x3a')](_0x31fd3e['body'],[_0x9c2d('0x39'),'id'])||{})[_0x9c2d('0x4e')](function(){return db[_0x9c2d('0x4f')][_0x9c2d('0x26')]({'attributes':['id',_0x9c2d('0x1e'),'color'],'where':{'id':_0x31fd3e['body'][_0x9c2d('0x39')]}});})['then'](function(_0x217d6b){socket['emit']('mailInteractionTags:save',{'id':Number(_0x31fd3e[_0x9c2d('0x2a')]['id']),'tags':_0x217d6b||[]});return{'id':Number(_0x31fd3e[_0x9c2d('0x2a')]['id']),'tags':_0x217d6b||[]};});}})['then'](respondWithResult(_0x56ab30,null))[_0x9c2d('0x29')](handleError(_0x56ab30,null));};exports['removeTags']=function(_0x1bb9d0,_0x28d0f5){return db['MailInteraction'][_0x9c2d('0x36')]({'where':{'id':_0x1bb9d0[_0x9c2d('0x2a')]['id']}})[_0x9c2d('0x1c')](handleEntityNotFound(_0x28d0f5,null))[_0x9c2d('0x1c')](function(_0x16e2bf){if(_0x16e2bf){return _0x16e2bf['removeTags'](_0x1bb9d0[_0x9c2d('0x27')]['ids']);}})[_0x9c2d('0x1c')](respondWithStatusCode(_0x28d0f5,null))[_0x9c2d('0x29')](handleError(_0x28d0f5,null));};exports['download']=function(_0x29ce78,_0x32f2b3){var _0x35a4e8=moment()[_0x9c2d('0x50')]()[_0x9c2d('0x51')]();var _0x46508c=path[_0x9c2d('0x52')](config[_0x9c2d('0x53')],_0x9c2d('0x54'),'files',_0x9c2d('0x55'));var _0x4b4413=path[_0x9c2d('0x52')](config[_0x9c2d('0x53')],_0x9c2d('0x54'),_0x9c2d('0x56'),_0x9c2d('0x57'));var _0x2d78ae=path[_0x9c2d('0x52')](_0x46508c,_0x35a4e8);var _0x2deba7=util['format']('transcript-%d-%s.zip',_0x29ce78[_0x9c2d('0x2a')]['id'],_0x35a4e8);var _0x5bdf7b=path[_0x9c2d('0x52')](_0x46508c,_0x2deba7);var _0x96546d=[];if(_0x29ce78['query']['attachments']){_0x96546d[_0x9c2d('0x58')]({'model':db[_0x9c2d('0x59')],'as':'Attachments','raw':!![]});}var _0x2c345c=[{'model':db['MailMessage'],'as':_0x9c2d('0x5a'),'attributes':['id','body','from','to','cc',_0x9c2d('0x5b'),_0x9c2d('0x5c'),_0x9c2d('0x5d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x96546d}];return db[_0x9c2d('0x20')][_0x9c2d('0x36')]({'where':{'id':_0x29ce78[_0x9c2d('0x2a')]['id']},'include':_0x2c345c})[_0x9c2d('0x1c')](handleEntityNotFound(_0x32f2b3,null))[_0x9c2d('0x1c')](function(_0x3c5556){if(_0x3c5556&&_0x3c5556[_0x9c2d('0x5a')]){var _0x3d4ceb=_0x3c5556[_0x9c2d('0x5e')]({'plain':!![]});fs[_0x9c2d('0x5f')](_0x2d78ae);return BPromise[_0x9c2d('0x60')](_0x3d4ceb[_0x9c2d('0x5a')],function(_0x3efea3,_0x19cb70){var _0x3a5dcf={'from':_0x3efea3['from'],'to':_0x3efea3['to']||_0x9c2d('0x61'),'subject':_0x3efea3[_0x9c2d('0x5c')],'html':htmlEntities[_0x9c2d('0x62')](_0x3efea3[_0x9c2d('0x35')]),'headers':{'Date':moment(_0x3efea3[_0x9c2d('0x5d')])[_0x9c2d('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3efea3['cc']){_0x3a5dcf[_0x9c2d('0x63')]['Cc']=_0x3efea3['cc'];}if(_0x3efea3[_0x9c2d('0x5b')]){_0x3a5dcf['headers'][_0x9c2d('0x64')]=_0x3efea3['bcc'];}return new BPromise(function(_0x3a6e8a,_0x5b8b11){if(_0x3efea3[_0x9c2d('0x65')]){for(var _0x3e479c=0x0;_0x3e479c<_0x3efea3[_0x9c2d('0x65')][_0x9c2d('0x4a')];_0x3e479c++){var _0xf2a276=_0x3efea3[_0x9c2d('0x65')][_0x3e479c];var _0x402337=path[_0x9c2d('0x52')](_0x4b4413,_0xf2a276[_0x9c2d('0x66')]);if(fs['existsSync'](_0x402337)){_0x3a5dcf[_0x9c2d('0x57')][_0x9c2d('0x58')]({'name':_0xf2a276['name'],'contentType':_0xf2a276['type'],'data':fs['readFileSync'](_0x402337)});}}}emlformat[_0x9c2d('0x67')](_0x3a5dcf,function(_0x76d1b2,_0x1514db){if(_0x76d1b2)return _0x5b8b11(_0x76d1b2);fs['writeFileSync'](path[_0x9c2d('0x52')](_0x2d78ae,util[_0x9c2d('0x47')](_0x9c2d('0x68'),_0x19cb70)),_0x1514db);return _0x3a6e8a(_0x1514db);});});})[_0x9c2d('0x1c')](function(){return new BPromise(function(_0x51708d,_0x5ce892){zipdir(_0x2d78ae,{'saveTo':_0x5bdf7b},function(_0x4b8eda,_0x415fc7){if(_0x4b8eda)return _0x5ce892(_0x4b8eda);return _0x51708d(_0x415fc7);});})['then'](function(){return new BPromise(function(_0x23eedc,_0xbf42b9){rimraf(_0x2d78ae,function(_0xb15a3b){if(_0xb15a3b)_0xbf42b9(_0xb15a3b);return _0x23eedc();});});})[_0x9c2d('0x1c')](function(){return _0x32f2b3['download'](_0x5bdf7b,_0x2deba7,function(_0x22bb0c){if(!_0x22bb0c)fs[_0x9c2d('0x69')](_0x5bdf7b);});});});}else{return _0x32f2b3[_0x9c2d('0x12')](0xc8);}})[_0x9c2d('0x29')](handleError(_0x32f2b3,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1ed5045..b4570e7 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 _0x83c0=['then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x59df4d,_0xf5bb0f){var _0xe93c8b=function(_0x47b4af){while(--_0x47b4af){_0x59df4d['push'](_0x59df4d['shift']());}};_0xe93c8b(++_0xf5bb0f);}(_0x83c0,0x69));var _0x083c=function(_0x46f206,_0x1e05be){_0x46f206=_0x46f206-0x0;var _0x3380a9=_0x83c0[_0x46f206];return _0x3380a9;};'use strict';var EventEmitter=require(_0x083c('0x0'));var MailInteraction=require(_0x083c('0x1'))['db'][_0x083c('0x2')];var MailMessage=require(_0x083c('0x1'))['db'][_0x083c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x083c('0x4')](0x0);var events={'afterCreate':_0x083c('0x5'),'afterUpdate':_0x083c('0x6'),'afterDestroy':_0x083c('0x7')};function emitEvent(_0x300138){return function(_0x18fac9,_0x3f9640,_0xaa94a9){_0x18fac9[_0x083c('0x8')]({'attributes':['id'],'raw':!![]})[_0x083c('0x9')](function(_0x2a5226){_0x18fac9['setDataValue'](_0x083c('0xa'),_0x2a5226[_0x083c('0xb')](function(_0x583b7e){return{'id':_0x583b7e['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x18fac9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x083c('0x9')](function(_0x3a4499){_0x18fac9[_0x083c('0xc')](_0x083c('0xd'),_0x3a4499[_0x083c('0xe')]);MailInteractionEvents['emit'](_0x300138+':'+_0x18fac9['id'],_0x18fac9);MailInteractionEvents[_0x083c('0xf')](_0x300138,_0x18fac9);_0xaa94a9(null);})[_0x083c('0x10')](_0xaa94a9(null));};}for(var e in events){if(events[_0x083c('0x11')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x083c('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xf900=['catch','hook','exports','events','../../mysqldb','MailInteraction','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf900,0x146));var _0x0f90=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf900[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x0f90('0x0'));var MailInteraction=require(_0x0f90('0x1'))['db'][_0x0f90('0x2')];var MailMessage=require(_0x0f90('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f90('0x3'),'afterUpdate':_0x0f90('0x4'),'afterDestroy':_0x0f90('0x5')};function emitEvent(_0xf508dc){return function(_0x44c541,_0x3658e8,_0x48383d){_0x44c541[_0x0f90('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x265af4){_0x44c541[_0x0f90('0x7')](_0x0f90('0x8'),_0x265af4[_0x0f90('0x9')](function(_0x27e17f){return{'id':_0x27e17f['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x44c541['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f90('0xa')](function(_0x4e83e0){_0x44c541[_0x0f90('0x7')](_0x0f90('0xb'),_0x4e83e0[_0x0f90('0xc')]);MailInteractionEvents[_0x0f90('0xd')](_0xf508dc+':'+_0x44c541['id'],_0x44c541);MailInteractionEvents[_0x0f90('0xd')](_0xf508dc,_0x44c541);_0x48383d(null);})[_0x0f90('0xe')](_0x48383d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x0f90('0xf')](e,emitEvent(event));}}module[_0x0f90('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 51f7a82..94c7fd7 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 _0x0761=['fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions'];(function(_0x3f4098,_0x3365b2){var _0x3d5d0c=function(_0x3a7cdb){while(--_0x3a7cdb){_0x3f4098['push'](_0x3f4098['shift']());}};_0x3d5d0c(++_0x3365b2);}(_0x0761,0x1ac));var _0x1076=function(_0x25ff48,_0x273085){_0x25ff48=_0x25ff48-0x0;var _0x453d27=_0x0761[_0x25ff48];return _0x453d27;};'use strict';var _=require(_0x1076('0x0'));var util=require(_0x1076('0x1'));var logger=require(_0x1076('0x2'))(_0x1076('0x3'));var moment=require(_0x1076('0x4'));var BPromise=require(_0x1076('0x5'));var rp=require(_0x1076('0x6'));var fs=require('fs');var path=require(_0x1076('0x7'));var rimraf=require(_0x1076('0x8'));var config=require(_0x1076('0x9'));var attributes=require('./mailInteraction.attributes');module[_0x1076('0xa')]=function(_0x3d8d0d,_0x528625){return _0x3d8d0d[_0x1076('0xb')](_0x1076('0xc'),attributes,{'tableName':_0x1076('0xd'),'paranoid':![],'indexes':[{'name':_0x1076('0xe'),'fields':[_0x1076('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b0f48,_0x17a585,_0x262483){if(_0x1b0f48[_0x1076('0x10')]){_0x1b0f48[_0x1076('0x11')]=moment()[_0x1076('0x12')](_0x1076('0x13'));}if(_0x1b0f48[_0x1076('0x14')]){_0x1b0f48['closedAt']=moment()[_0x1076('0x12')](_0x1076('0x13'));}_0x262483(null,_0x17a585);},'beforeUpdate':function(_0x2cc5dc,_0x4a1767,_0x84b03){if(_0x2cc5dc['changed']('substatus')){_0x2cc5dc[_0x1076('0x11')]=_0x2cc5dc[_0x1076('0x10')]?moment()[_0x1076('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2cc5dc['changed'](_0x1076('0x14'))){_0x2cc5dc[_0x1076('0x15')]=moment()[_0x1076('0x12')](_0x1076('0x13'));_0x2cc5dc['substatus']=null;_0x2cc5dc['substatusAt']=null;}_0x84b03(null,_0x2cc5dc);},'afterUpdate':function(_0x459ac9,_0x20ff24,_0x2506de){var _0x138ee3=_0x3d8d0d['models'];var _0x4e7d12=_0x459ac9['get']({'plain':!![]});if(_0x4e7d12['closed']){return _0x138ee3['MailMessage'][_0x1076('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4e7d12['id']}})['then'](function(){_0x2506de();})[_0x1076('0x17')](function(_0x331cc6){_0x2506de(_0x331cc6);});}else{_0x2506de();}}},'charset':_0x1076('0x18'),'collate':_0x1076('0x19')});}; \ No newline at end of file +var _0x2a3b=['YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','get','MailMessage','catch','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed'];(function(_0x1903db,_0x5c48e6){var _0xf953fd=function(_0x20597c){while(--_0x20597c){_0x1903db['push'](_0x1903db['shift']());}};_0xf953fd(++_0x5c48e6);}(_0x2a3b,0x1db));var _0xb2a3=function(_0x1411c0,_0x426cba){_0x1411c0=_0x1411c0-0x0;var _0x56c2ec=_0x2a3b[_0x1411c0];return _0x56c2ec;};'use strict';var _=require(_0xb2a3('0x0'));var util=require(_0xb2a3('0x1'));var logger=require('../../config/logger')(_0xb2a3('0x2'));var moment=require('moment');var BPromise=require(_0xb2a3('0x3'));var rp=require(_0xb2a3('0x4'));var fs=require('fs');var path=require(_0xb2a3('0x5'));var rimraf=require(_0xb2a3('0x6'));var config=require(_0xb2a3('0x7'));var attributes=require(_0xb2a3('0x8'));module[_0xb2a3('0x9')]=function(_0x3449a5,_0x255e53){return _0x3449a5[_0xb2a3('0xa')](_0xb2a3('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xb2a3('0xc'),'fields':[_0xb2a3('0xd'),'to'],'type':_0xb2a3('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x224790,_0x2ec12b,_0x89182c){if(_0x224790[_0xb2a3('0xf')]){_0x224790[_0xb2a3('0x10')]=moment()[_0xb2a3('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x224790[_0xb2a3('0x12')]){_0x224790['closedAt']=moment()[_0xb2a3('0x11')](_0xb2a3('0x13'));}_0x89182c(null,_0x2ec12b);},'beforeUpdate':function(_0x5db2d2,_0x2de66b,_0x560073){if(_0x5db2d2[_0xb2a3('0x14')](_0xb2a3('0xf'))){_0x5db2d2[_0xb2a3('0x10')]=_0x5db2d2[_0xb2a3('0xf')]?moment()[_0xb2a3('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5db2d2[_0xb2a3('0x14')](_0xb2a3('0x12'))){_0x5db2d2[_0xb2a3('0x15')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5db2d2[_0xb2a3('0xf')]=null;_0x5db2d2[_0xb2a3('0x10')]=null;}_0x560073(null,_0x5db2d2);},'afterUpdate':function(_0x258410,_0x469367,_0x191c33){var _0xc09061=_0x3449a5['models'];var _0x3e3327=_0x258410[_0xb2a3('0x16')]({'plain':!![]});if(_0x3e3327['closed']){return _0xc09061[_0xb2a3('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3e3327['id']}})['then'](function(){_0x191c33();})[_0xb2a3('0x18')](function(_0x2f560c){_0x191c33(_0x2f560c);});}else{_0x191c33();}}},'charset':_0xb2a3('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f5c3be0..4a2c0fc 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 _0x107e=['client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','debug','catch','AddTagsToMailInteraction','omit','ids','AddTags','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x22ebae,_0x3e6eae){var _0x397803=function(_0x1f3306){while(--_0x1f3306){_0x22ebae['push'](_0x22ebae['shift']());}};_0x397803(++_0x3e6eae);}(_0x107e,0xe8));var _0xe107=function(_0x55fe56,_0x2573d1){_0x55fe56=_0x55fe56-0x0;var _0x36d1dd=_0x107e[_0x55fe56];return _0x36d1dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe107('0x0'));var BPromise=require(_0xe107('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe107('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe107('0x3'))('rpc');var config=require(_0xe107('0x4'));var jayson=require(_0xe107('0x5'));var client=jayson[_0xe107('0x6')]['http']({'port':0x232a});config[_0xe107('0x7')]=_[_0xe107('0x8')](config[_0xe107('0x7')],{'host':_0xe107('0x9'),'port':0x18eb});var socket=require(_0xe107('0xa'))(new Redis(config[_0xe107('0x7')]));require(_0xe107('0xb'))['register'](socket);function respondWithRpcPromise(_0x499c67,_0x51b77b,_0x31ff70){return new BPromise(function(_0x1ab175,_0x2818cb){return client[_0xe107('0xc')](_0x499c67,_0x31ff70)[_0xe107('0xd')](function(_0x1ac5a0){logger[_0xe107('0xe')](_0xe107('0xf'),_0x51b77b,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x51b77b,_0xe107('0x10'),JSON['stringify'](_0x1ac5a0));if(_0x1ac5a0[_0xe107('0x11')]){if(_0x1ac5a0[_0xe107('0x11')]['code']===0x1f4){logger['error'](_0xe107('0xf'),_0x51b77b,_0x1ac5a0[_0xe107('0x11')][_0xe107('0x12')]);return _0x2818cb(_0x1ac5a0[_0xe107('0x11')][_0xe107('0x12')]);}logger[_0xe107('0x11')](_0xe107('0xf'),_0x51b77b,_0x1ac5a0[_0xe107('0x11')][_0xe107('0x12')]);return _0x1ab175(_0x1ac5a0[_0xe107('0x11')][_0xe107('0x12')]);}else{logger[_0xe107('0xe')](_0xe107('0xf'),_0x51b77b,'request\x20sent');_0x1ab175(_0x1ac5a0[_0xe107('0x13')][_0xe107('0x12')]);}})['catch'](function(_0x5b872d){logger[_0xe107('0x11')]('MailInteraction,\x20%s,\x20%s',_0x51b77b,_0x5b872d);_0x2818cb(_0x5b872d);});});}exports[_0xe107('0x14')]=function(_0xb76fcb){var _0x2e6a61=this;return new Promise(function(_0x1698a9,_0x12ac84){return db[_0xe107('0x15')][_0xe107('0x16')](_0xb76fcb[_0xe107('0x17')],{'raw':_0xb76fcb[_0xe107('0x18')]?_0xb76fcb[_0xe107('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb76fcb[_0xe107('0x18')]?_0xb76fcb[_0xe107('0x18')][_0xe107('0x19')]||null:null,'attributes':_0xb76fcb['options']?_0xb76fcb[_0xe107('0x18')][_0xe107('0x1a')]||null:null,'limit':_0xb76fcb['options']?_0xb76fcb[_0xe107('0x18')][_0xe107('0x1b')]||null:null})[_0xe107('0xd')](function(_0x42ab35){logger['info'](_0xe107('0x14'),_0xb76fcb);logger[_0xe107('0x1c')](_0xe107('0x14'),_0xb76fcb,JSON['stringify'](_0x42ab35));_0x1698a9(_0x42ab35);})[_0xe107('0x1d')](function(_0x2e46f9){logger[_0xe107('0x11')]('UpdateMailInteraction',_0x2e46f9[_0xe107('0x12')],_0xb76fcb);_0x12ac84(_0x2e6a61[_0xe107('0x11')](0x1f4,_0x2e46f9[_0xe107('0x12')]));});});};exports[_0xe107('0x1e')]=function(_0x3c8dd4){return new Promise(function(_0x5a8b28,_0x13db7f){return db[_0xe107('0x15')]['find']({'where':_0x3c8dd4[_0xe107('0x18')]?_0x3c8dd4[_0xe107('0x18')]['where']||null:null})[_0xe107('0xd')](function(_0x1adf7a){if(_0x1adf7a){return _0x1adf7a['addTags'](_0x3c8dd4[_0xe107('0x17')]['ids'],_[_0xe107('0x1f')](_0x3c8dd4[_0xe107('0x17')],[_0xe107('0x20'),'id'])||{});}})['spread'](function(_0x6f85af){logger['info'](_0xe107('0x21'),_0x3c8dd4);logger['debug'](_0xe107('0x21'),_0x3c8dd4,JSON['stringify'](_0x6f85af));_0x5a8b28(_0x6f85af);})['catch'](function(_0x42a31){logger[_0xe107('0x11')](_0xe107('0x21'),_0x42a31[_0xe107('0x12')],_0x3c8dd4);_0x13db7f(_this['error'](0x1f4,_0x42a31[_0xe107('0x12')]));});});}; \ No newline at end of file +var _0x2ef3=['debug','request\x20sent','stringify','code','error','message','result','catch','UpdateMailInteraction','update','options','where','attributes','AddTagsToMailInteraction','MailInteraction','addTags','body','ids','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s'];(function(_0xf9292e,_0x38fa52){var _0x41a8f3=function(_0x564fed){while(--_0x564fed){_0xf9292e['push'](_0xf9292e['shift']());}};_0x41a8f3(++_0x38fa52);}(_0x2ef3,0xba));var _0x32ef=function(_0x17e723,_0x54e9cf){_0x17e723=_0x17e723-0x0;var _0x1908f7=_0x2ef3[_0x17e723];return _0x1908f7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['MailInteraction'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')][_0x32ef('0x1e')]||null:null,'attributes':_0x26aff3['options']?_0x26aff3['options'][_0x32ef('0x1f')]||null:null,'limit':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['limit']||null:null})['then'](function(_0x19ea6){logger['info']('UpdateMailInteraction',_0x26aff3);logger[_0x32ef('0x13')](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x19ea6));_0x445cda(_0x19ea6);})[_0x32ef('0x1a')](function(_0x15ce54){logger[_0x32ef('0x17')](_0x32ef('0x1b'),_0x15ce54[_0x32ef('0x18')],_0x26aff3);_0x3aec05(_0x251084[_0x32ef('0x17')](0x1f4,_0x15ce54[_0x32ef('0x18')]));});});};exports[_0x32ef('0x20')]=function(_0xba4b3f){return new Promise(function(_0x5a88a5,_0xd65fde){return db[_0x32ef('0x21')]['find']({'where':_0xba4b3f[_0x32ef('0x1d')]?_0xba4b3f[_0x32ef('0x1d')][_0x32ef('0x1e')]||null:null})[_0x32ef('0x11')](function(_0x50a95b){if(_0x50a95b){return _0x50a95b[_0x32ef('0x22')](_0xba4b3f[_0x32ef('0x23')][_0x32ef('0x24')],_[_0x32ef('0x25')](_0xba4b3f[_0x32ef('0x23')],[_0x32ef('0x24'),'id'])||{});}})[_0x32ef('0x26')](function(_0x575f3e){logger[_0x32ef('0x27')]('AddTags',_0xba4b3f);logger[_0x32ef('0x13')](_0x32ef('0x28'),_0xba4b3f,JSON['stringify'](_0x575f3e));_0x5a88a5(_0x575f3e);})[_0x32ef('0x1a')](function(_0x17e4d1){logger[_0x32ef('0x17')](_0x32ef('0x28'),_0x17e4d1[_0x32ef('0x18')],_0xba4b3f);_0xd65fde(_this['error'](0x1f4,_0x17e4d1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a70b2aa..24e661b 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 _0x2ee3=['update','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x2ee3,0x178));var _0x32ee=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x2ee3[_0x18afca];return _0x11603f;};'use strict';var MailInteractionEvents=require(_0x32ee('0x0'));var events=[_0x32ee('0x1'),'remove',_0x32ee('0x2')];function createListener(_0x219738,_0x361fa8){return function(_0x35848f){_0x361fa8['emit'](_0x219738,_0x35848f);};}function removeListener(_0x2b81a2,_0x219d13){return function(){MailInteractionEvents['removeListener'](_0x2b81a2,_0x219d13);};}exports[_0x32ee('0x3')]=function(_0x88eced){for(var _0x1b2ef5=0x0,_0x5f5542=events[_0x32ee('0x4')];_0x1b2ef5<_0x5f5542;_0x1b2ef5++){var _0x4c9494=events[_0x1b2ef5];var _0x4720e7=createListener(_0x32ee('0x5')+_0x4c9494,_0x88eced);MailInteractionEvents['on'](_0x4c9494,_0x4720e7);}}; \ No newline at end of file +var _0x3b0a=['mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0xe65dac,_0x4f1ccd){var _0x4353a8=function(_0x5da35a){while(--_0x5da35a){_0xe65dac['push'](_0xe65dac['shift']());}};_0x4353a8(++_0x4f1ccd);}(_0x3b0a,0x149));var _0xa3b0=function(_0x3f8b22,_0x38908f){_0x3f8b22=_0x3f8b22-0x0;var _0x5c589e=_0x3b0a[_0x3f8b22];return _0x5c589e;};'use strict';var MailInteractionEvents=require(_0xa3b0('0x0'));var events=['save',_0xa3b0('0x1'),_0xa3b0('0x2')];function createListener(_0x4d49f6,_0x49c315){return function(_0x2a8c23){_0x49c315[_0xa3b0('0x3')](_0x4d49f6,_0x2a8c23);};}function removeListener(_0x1b8539,_0x3d7e86){return function(){MailInteractionEvents[_0xa3b0('0x4')](_0x1b8539,_0x3d7e86);};}exports[_0xa3b0('0x5')]=function(_0x4291c1){for(var _0xb8bf32=0x0,_0x3fd5c6=events[_0xa3b0('0x6')];_0xb8bf32<_0x3fd5c6;_0xb8bf32++){var _0x543cde=events[_0xb8bf32];var _0x330dd1=createListener(_0xa3b0('0x7')+_0x543cde,_0x4291c1);MailInteractionEvents['on'](_0x543cde,_0x330dd1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c280b81..c5293e5 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 _0x04b8=['/:id','update','put','/:id/accept','/:id/reject','reject','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','isAuthenticated','show','/:id/download','post','tracked','mail','mailmessage:create','create'];(function(_0x441d32,_0x552eda){var _0x3b8340=function(_0x31f6d3){while(--_0x31f6d3){_0x441d32['push'](_0x441d32['shift']());}};_0x3b8340(++_0x552eda);}(_0x04b8,0x159));var _0x804b=function(_0x5b5317,_0x2a49c4){_0x5b5317=_0x5b5317-0x0;var _0x3a212a=_0x04b8[_0x5b5317];return _0x3a212a;};'use strict';var multer=require('multer');var util=require(_0x804b('0x0'));var path=require('path');var timeout=require(_0x804b('0x1'));var express=require(_0x804b('0x2'));var router=express['Router']();var fs_extra=require(_0x804b('0x3'));var auth=require(_0x804b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x804b('0x5'));var controller=require(_0x804b('0x6'));router[_0x804b('0x7')]('/',auth['isAuthenticated'](),controller[_0x804b('0x8')]);router[_0x804b('0x7')](_0x804b('0x9'),auth['isAuthenticated'](),controller[_0x804b('0xa')]);router[_0x804b('0x7')]('/:id',auth[_0x804b('0xb')](),controller[_0x804b('0xc')]);router[_0x804b('0x7')](_0x804b('0xd'),auth[_0x804b('0xb')](),controller['download']);router[_0x804b('0xe')]('/',auth[_0x804b('0xb')](),interaction[_0x804b('0xf')](_0x804b('0x10'),_0x804b('0x11')),controller[_0x804b('0x12')]);router['put'](_0x804b('0x13'),auth['isAuthenticated'](),controller[_0x804b('0x14')]);router[_0x804b('0x15')](_0x804b('0x16'),auth[_0x804b('0xb')](),controller['accept']);router[_0x804b('0x15')](_0x804b('0x17'),auth[_0x804b('0xb')](),controller[_0x804b('0x18')]);router['delete'](_0x804b('0x13'),auth[_0x804b('0xb')](),controller['destroy']);module[_0x804b('0x19')]=router; \ No newline at end of file +var _0x0cfa=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','show','download','tracked','mail','mailmessage:create','put','/:id','update','/:id/accept','/:id/reject'];(function(_0x516026,_0x4ae9e0){var _0x2065be=function(_0x32d8d8){while(--_0x32d8d8){_0x516026['push'](_0x516026['shift']());}};_0x2065be(++_0x4ae9e0);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x16d66b,_0x9085b){_0x16d66b=_0x16d66b-0x0;var _0x1e9944=_0x0cfa[_0x16d66b];return _0x1e9944;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x5'));var controller=require(_0xa0cf('0x6'));router[_0xa0cf('0x7')]('/',auth[_0xa0cf('0x8')](),controller['index']);router[_0xa0cf('0x7')]('/describe',auth[_0xa0cf('0x8')](),controller['describe']);router[_0xa0cf('0x7')]('/:id',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x9')]);router[_0xa0cf('0x7')]('/:id/download',auth[_0xa0cf('0x8')](),controller[_0xa0cf('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa0cf('0xb')](_0xa0cf('0xc'),_0xa0cf('0xd')),controller['create']);router[_0xa0cf('0xe')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x10')]);router[_0xa0cf('0xe')](_0xa0cf('0x11'),auth[_0xa0cf('0x8')](),controller['accept']);router[_0xa0cf('0xe')](_0xa0cf('0x12'),auth[_0xa0cf('0x8')](),controller['reject']);router[_0xa0cf('0x13')](_0xa0cf('0xf'),auth[_0xa0cf('0x8')](),controller[_0xa0cf('0x14')]);module[_0xa0cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7a12534..be2a8fe 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 _0x9f56=['TEXT','DATE','Email','Chat','sequelize','exports','long','BOOLEAN','ENUM','out','STRING'];(function(_0x4505ed,_0x10f00d){var _0x341ab4=function(_0x41e539){while(--_0x41e539){_0x4505ed['push'](_0x4505ed['shift']());}};_0x341ab4(++_0x10f00d);}(_0x9f56,0x1dd));var _0x69f5=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x9f56[_0x3ec1da];return _0x472358;};'use strict';var Sequelize=require(_0x69f5('0x0'));var _=require('lodash');module[_0x69f5('0x1')]={'body':{'type':Sequelize['TEXT'](_0x69f5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x69f5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x69f5('0x4')]('in','out'),'defaultValue':_0x69f5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x69f5('0x6')](0x1fe)},'from':{'type':Sequelize[_0x69f5('0x6')]},'to':{'type':Sequelize[_0x69f5('0x7')](_0x69f5('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x69f5('0x2'))},'bcc':{'type':Sequelize[_0x69f5('0x7')](_0x69f5('0x2'))},'subject':{'type':Sequelize[_0x69f5('0x7')]},'sentAt':{'type':Sequelize[_0x69f5('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x69f5('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x69f5('0x2'))},'originCc':{'type':Sequelize[_0x69f5('0x7')](_0x69f5('0x2'))},'originChannel':{'type':Sequelize[_0x69f5('0x4')](_0x69f5('0x9'),_0x69f5('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x795a=['TEXT','medium','ENUM','out','STRING','long','DATE','BOOLEAN','Email','Chat','lodash','exports'];(function(_0x14f368,_0x4d3498){var _0x4b5621=function(_0xacfd4c){while(--_0xacfd4c){_0x14f368['push'](_0x14f368['shift']());}};_0x4b5621(++_0x4d3498);}(_0x795a,0x6a));var _0xa795=function(_0xd147fe,_0x5381b8){_0xd147fe=_0xd147fe-0x0;var _0x1e0f63=_0x795a[_0xd147fe];return _0x1e0f63;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa795('0x0'));module[_0xa795('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa795('0x2')](_0xa795('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa795('0x4')]('in',_0xa795('0x5')),'defaultValue':_0xa795('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa795('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa795('0x2')](_0xa795('0x7'))},'cc':{'type':Sequelize[_0xa795('0x2')](_0xa795('0x7'))},'bcc':{'type':Sequelize[_0xa795('0x2')](_0xa795('0x7'))},'subject':{'type':Sequelize[_0xa795('0x2')]},'sentAt':{'type':Sequelize[_0xa795('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa795('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa795('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT'](_0xa795('0x7'))},'originChannel':{'type':Sequelize[_0xa795('0x4')](_0xa795('0xa'),_0xa795('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 84469f9..89597e7 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 _0x71f3=['intersection','attributes','length','sort','where','filters','filter','merge','VIRTUAL','MailMessage','includeAll','include','findAll','params','model','fields','options','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','Contacts','MailServerOut','CloudProvider','Smtp','attachments','join','server/files/attachments','basename','CmContact','ListId','SendMail','sendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','User','internal','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','email','motionChannel','event','rejectmessage','download','unix','toString','root','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','update','then','destroy','end','sendStatus','stack','send','map','rawAttributes','fieldName','type','name','keys','query'];(function(_0x35be00,_0x5f0718){var _0x1008b3=function(_0x42bdab){while(--_0x42bdab){_0x35be00['push'](_0x35be00['shift']());}};_0x1008b3(++_0x5f0718);}(_0x71f3,0x19e));var _0x371f=function(_0x47ee3f,_0x34f64){_0x47ee3f=_0x47ee3f-0x0;var _0x4d6557=_0x71f3[_0x47ee3f];return _0x4d6557;};'use strict';var emlformat=require(_0x371f('0x0'));var moment=require(_0x371f('0x1'));var BPromise=require('bluebird');var util=require(_0x371f('0x2'));var path=require(_0x371f('0x3'));var fs=require('fs');var _=require(_0x371f('0x4'));var Redis=require(_0x371f('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x371f('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x371f('0x7'))(_0x371f('0x8'));var config=require(_0x371f('0x9'));var db=require(_0x371f('0xa'))['db'];config[_0x371f('0xb')]=_[_0x371f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x371f('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0x371f('0xe'))[_0x371f('0xf')](socket);var jayson=require(_0x371f('0x10'));var client=jayson[_0x371f('0x11')][_0x371f('0x12')]({'port':0x232c});var client9003=jayson[_0x371f('0x11')][_0x371f('0x12')]({'port':0x232b});var client9002=jayson[_0x371f('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba347,_0x13cd72,_0x4d3f65,_0x184e9b){return new BPromise(function(_0x5c36ae,_0xb510f7){var _0x8fdb36=_0x184e9b||client;return _0x8fdb36[_0x371f('0x13')](_0x4ba347,_0x4d3f65)['then'](function(_0x1c95f9){logger[_0x371f('0x14')](_0x371f('0x15'),_0x13cd72,'request\x20sent');logger[_0x371f('0x16')](_0x371f('0x17'),_0x13cd72,'request\x20sent',JSON[_0x371f('0x18')](_0x1c95f9));if(_0x1c95f9[_0x371f('0x19')]){if(_0x1c95f9[_0x371f('0x19')][_0x371f('0x1a')]===0x1f4){logger[_0x371f('0x19')](_0x371f('0x15'),_0x13cd72,_0x1c95f9[_0x371f('0x19')][_0x371f('0x1b')]);return _0xb510f7(_0x1c95f9['error'][_0x371f('0x1b')]);}logger[_0x371f('0x19')](_0x371f('0x15'),_0x13cd72,_0x1c95f9[_0x371f('0x19')][_0x371f('0x1b')]);return _0x5c36ae(_0x1c95f9[_0x371f('0x19')][_0x371f('0x1b')]);}else{logger[_0x371f('0x14')](_0x371f('0x15'),_0x13cd72,_0x371f('0x1c'));_0x5c36ae(_0x1c95f9[_0x371f('0x1d')][_0x371f('0x1b')]);}})[_0x371f('0x1e')](function(_0x48e730){logger[_0x371f('0x19')](_0x371f('0x15'),_0x13cd72,_0x48e730);_0xb510f7(_0x48e730);});});}function respondWithResult(_0x3ef69b,_0x40f03a){_0x40f03a=_0x40f03a||0xc8;return function(_0x2c3bee){if(_0x2c3bee){return _0x3ef69b[_0x371f('0x1f')](_0x40f03a)[_0x371f('0x20')](_0x2c3bee);}};}function respondWithFilteredResult(_0x1d3b48,_0xa23f04){return function(_0x2bc0be){if(_0x2bc0be){var _0x283251=typeof _0xa23f04[_0x371f('0x21')]===_0x371f('0x22')&&typeof _0xa23f04[_0x371f('0x23')]==='undefined';var _0x1d196a=_0x2bc0be[_0x371f('0x24')];var _0x1d656e=_0x283251?0x0:_0xa23f04['offset'];var _0x2095c3=_0x283251?_0x2bc0be[_0x371f('0x24')]:_0xa23f04['offset']+_0xa23f04[_0x371f('0x23')];var _0x1df501;if(_0x2095c3>=_0x1d196a){_0x2095c3=_0x1d196a;_0x1df501=0xc8;}else{_0x1df501=0xce;}_0x1d3b48[_0x371f('0x1f')](_0x1df501);return _0x1d3b48['set']('Content-Range',_0x1d656e+'-'+_0x2095c3+'/'+_0x1d196a)['json'](_0x2bc0be);}return null;};}function saveUpdates(_0x1ffd61){return function(_0x5ceb52){if(_0x5ceb52){return _0x5ceb52[_0x371f('0x25')](_0x1ffd61)[_0x371f('0x26')](function(_0x33371b){return _0x33371b;});}return null;};}function removeEntity(_0x2d3d08){return function(_0x4d973d){if(_0x4d973d){return _0x4d973d[_0x371f('0x27')]()[_0x371f('0x26')](function(){_0x2d3d08[_0x371f('0x1f')](0xcc)[_0x371f('0x28')]();});}};}function handleEntityNotFound(_0x404e25){return function(_0x10fb55){if(!_0x10fb55){_0x404e25[_0x371f('0x29')](0x194);}return _0x10fb55;};}function handleError(_0x187dce,_0x2d69e4){_0x2d69e4=_0x2d69e4||0x1f4;return function(_0x4f8b92){logger[_0x371f('0x19')](_0x4f8b92[_0x371f('0x2a')]);if(_0x4f8b92['name']){delete _0x4f8b92['name'];}_0x187dce[_0x371f('0x1f')](_0x2d69e4)[_0x371f('0x2b')](_0x4f8b92);};}exports['index']=function(_0x2b7216,_0x65ec7){var _0x24e8e0={},_0x197ada={},_0x2b0b04={'count':0x0,'rows':[]};var _0xa3aae7=_[_0x371f('0x2c')](db['MailMessage'][_0x371f('0x2d')],function(_0x53a3db){return{'name':_0x53a3db[_0x371f('0x2e')],'type':_0x53a3db[_0x371f('0x2f')]['key']};});_0x197ada['model']=_[_0x371f('0x2c')](_0xa3aae7,_0x371f('0x30'));_0x197ada['query']=_[_0x371f('0x31')](_0x2b7216[_0x371f('0x32')]);_0x197ada['filters']=_[_0x371f('0x33')](_0x197ada['model'],_0x197ada['query']);_0x24e8e0[_0x371f('0x34')]=_[_0x371f('0x33')](_0x197ada['model'],qs['fields'](_0x2b7216[_0x371f('0x32')]['fields']));_0x24e8e0[_0x371f('0x34')]=_0x24e8e0[_0x371f('0x34')][_0x371f('0x35')]?_0x24e8e0[_0x371f('0x34')]:_0x197ada['model'];if(!_0x2b7216[_0x371f('0x32')]['hasOwnProperty']('nolimit')){_0x24e8e0['limit']=qs[_0x371f('0x23')](_0x2b7216[_0x371f('0x32')][_0x371f('0x23')]);_0x24e8e0['offset']=qs[_0x371f('0x21')](_0x2b7216[_0x371f('0x32')][_0x371f('0x21')]);}_0x24e8e0['order']=qs['sort'](_0x2b7216[_0x371f('0x32')][_0x371f('0x36')]);_0x24e8e0[_0x371f('0x37')]=qs[_0x371f('0x38')](_['pick'](_0x2b7216[_0x371f('0x32')],_0x197ada['filters']),_0xa3aae7);if(_0x2b7216[_0x371f('0x32')][_0x371f('0x39')]){_0x24e8e0['where']=_[_0x371f('0x3a')](_0x24e8e0[_0x371f('0x37')],{'$or':_[_0x371f('0x2c')](_0xa3aae7,function(_0x395e6a){if(_0x395e6a[_0x371f('0x2f')]!==_0x371f('0x3b')){var _0x3f7642={};_0x3f7642[_0x395e6a[_0x371f('0x30')]]={'$like':'%'+_0x2b7216['query']['filter']+'%'};return _0x3f7642;}})});}_0x24e8e0=_['merge']({},_0x24e8e0,_0x2b7216['options']);var _0x4dd055={'where':_0x24e8e0[_0x371f('0x37')]};return db[_0x371f('0x3c')]['count'](_0x4dd055)[_0x371f('0x26')](function(_0x139d39){_0x2b0b04[_0x371f('0x24')]=_0x139d39;if(_0x2b7216['query'][_0x371f('0x3d')]){_0x24e8e0[_0x371f('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0x371f('0x3f')](_0x24e8e0);})['then'](function(_0x425f99){_0x2b0b04['rows']=_0x425f99;return _0x2b0b04;})[_0x371f('0x26')](respondWithFilteredResult(_0x65ec7,_0x24e8e0))['catch'](handleError(_0x65ec7,null));};exports['show']=function(_0x76467,_0x3731bd){var _0x37ead4={'raw':!![],'where':{'id':_0x76467[_0x371f('0x40')]['id']}},_0x235fca={};_0x235fca[_0x371f('0x41')]=_['keys'](db['MailMessage'][_0x371f('0x2d')]);_0x235fca[_0x371f('0x32')]=_[_0x371f('0x31')](_0x76467[_0x371f('0x32')]);_0x235fca[_0x371f('0x38')]=_[_0x371f('0x33')](_0x235fca[_0x371f('0x41')],_0x235fca['query']);_0x37ead4[_0x371f('0x34')]=_[_0x371f('0x33')](_0x235fca[_0x371f('0x41')],qs[_0x371f('0x42')](_0x76467[_0x371f('0x32')]['fields']));_0x37ead4[_0x371f('0x34')]=_0x37ead4[_0x371f('0x34')][_0x371f('0x35')]?_0x37ead4[_0x371f('0x34')]:_0x235fca[_0x371f('0x41')];if(_0x76467[_0x371f('0x32')]['includeAll']){_0x37ead4['include']=[{'all':!![]}];}_0x37ead4=_['merge']({},_0x37ead4,_0x76467[_0x371f('0x43')]);return db[_0x371f('0x3c')][_0x371f('0x44')](_0x37ead4)[_0x371f('0x26')](handleEntityNotFound(_0x3731bd,null))[_0x371f('0x26')](respondWithResult(_0x3731bd,null))[_0x371f('0x1e')](handleError(_0x3731bd,null));};exports[_0x371f('0x25')]=function(_0x270e35,_0x134674){if(_0x270e35[_0x371f('0x45')]['id']){delete _0x270e35[_0x371f('0x45')]['id'];}return db[_0x371f('0x3c')]['find']({'where':{'id':_0x270e35[_0x371f('0x40')]['id']}})[_0x371f('0x26')](handleEntityNotFound(_0x134674,null))[_0x371f('0x26')](saveUpdates(_0x270e35[_0x371f('0x45')],null))[_0x371f('0x26')](respondWithResult(_0x134674,null))[_0x371f('0x1e')](handleError(_0x134674,null));};exports[_0x371f('0x27')]=function(_0x34f2c6,_0x15b450){return db[_0x371f('0x3c')]['find']({'where':{'id':_0x34f2c6[_0x371f('0x40')]['id']}})[_0x371f('0x26')](handleEntityNotFound(_0x15b450,null))['then'](removeEntity(_0x15b450,null))[_0x371f('0x1e')](handleError(_0x15b450,null));};exports['describe']=function(_0x447fa3,_0x2d08c8){return db[_0x371f('0x3c')][_0x371f('0x46')]()[_0x371f('0x26')](respondWithResult(_0x2d08c8,null))[_0x371f('0x1e')](handleError(_0x2d08c8,null));};exports[_0x371f('0x47')]=function(_0x4f2304,_0x3f3b6b){return db[_0x371f('0x3c')][_0x371f('0x47')](_0x4f2304[_0x371f('0x45')])[_0x371f('0x26')](function(_0x4d9461){if(_0x4d9461){if(_0x4d9461[_0x371f('0x48')]===_0x371f('0x49')&&!_0x4d9461[_0x371f('0x4a')]){var _0x4ba4b4,_0x5093b2,_0x1b3213;if(_0x4f2304['body']['to']){_0x5093b2=_0x4f2304[_0x371f('0x45')]['to'][_0x371f('0x4b')](',')[0x0];}return db[_0x371f('0x4c')][_0x371f('0x4d')]({'where':{'id':_0x4d9461['MailAccountId']},'include':[{'model':db[_0x371f('0x4e')],'as':_0x371f('0x4f'),'include':[{'model':db['CmContact'],'as':_0x371f('0x50'),'where':{'email':_0x5093b2},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x371f('0x51')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x371f('0x52')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x4e5125){_0x4ba4b4=_0x4e5125;if(!_0x4ba4b4||!_0x4ba4b4[_0x371f('0x53')])return;var _0x275db7=_0x4ba4b4['getSmtpOptions']();if(_0x4f2304[_0x371f('0x45')][_0x371f('0x54')]&&_0x4f2304[_0x371f('0x45')][_0x371f('0x54')][_0x371f('0x35')]){for(var _0x3c3ab3=0x0;_0x3c3ab3<_0x4f2304[_0x371f('0x45')][_0x371f('0x54')][_0x371f('0x35')];_0x3c3ab3+=0x1){_0x4f2304[_0x371f('0x45')][_0x371f('0x54')][_0x3c3ab3]={'filename':_0x4f2304[_0x371f('0x45')][_0x371f('0x54')][_0x3c3ab3]['name'],'path':path[_0x371f('0x55')](config['root'],_0x371f('0x56'),_0x4f2304['body'][_0x371f('0x54')][_0x3c3ab3][_0x371f('0x57')])};}}_0x1b3213={'account':_0x275db7,'message':_0x4f2304[_0x371f('0x45')]};return;})['then'](function(){if(_0x4ba4b4[_0x371f('0x4f')]){if(_0x4ba4b4[_0x371f('0x4f')][_0x371f('0x50')][_0x371f('0x35')]){return _0x4ba4b4[_0x371f('0x4f')][_0x371f('0x50')][0x0];}else{return db[_0x371f('0x58')][_0x371f('0x47')](_['defaults'](_0x4f2304['body'],{'firstName':_0x4f2304[_0x371f('0x45')]['to'],'email':_0x4f2304[_0x371f('0x45')]['to'],'phone':_0x4f2304[_0x371f('0x45')]['to'],'ListId':_0x4ba4b4[_0x371f('0x59')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x371f('0x26')](function(){if(_0x1b3213){return respondWithRpcPromise(_0x371f('0x5a'),_0x371f('0x5b'),_0x1b3213,client9003)['then'](function(_0x14cfe1){return _0x4d9461[_0x371f('0x25')]({'read':!![],'messageId':_0x14cfe1['messageId'],'sentAt':moment()[_0x371f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x371f('0x1e')](function(_0x226c83){logger[_0x371f('0x19')]('%s',JSON[_0x371f('0x18')](_0x226c83));return _0x4d9461;});}return _0x4d9461;});}return _0x4d9461;}})['then'](respondWithResult(_0x3f3b6b,0xc9))['catch'](handleError(_0x3f3b6b,null));};exports[_0x371f('0x5d')]=function(_0x472c23,_0x3014ff){var _0x3790db={'agent':{},'channel':'mail'};if(_0x472c23[_0x371f('0x45')]['id']){delete _0x472c23[_0x371f('0x45')]['id'];}_0x472c23[_0x371f('0x45')][_0x371f('0x5e')]=!![];_0x472c23[_0x371f('0x45')][_0x371f('0x5f')]=moment()[_0x371f('0x5c')](_0x371f('0x60'));_0x472c23[_0x371f('0x45')][_0x371f('0x61')]=_0x472c23['body'][_0x371f('0x61')]||_0x472c23[_0x371f('0x62')]['id'];_0x3790db[_0x371f('0x63')]['id']=_0x472c23[_0x371f('0x45')][_0x371f('0x61')];return db[_0x371f('0x3c')][_0x371f('0x44')]({'where':{'id':_0x472c23[_0x371f('0x40')]['id'],'UserId':null}})[_0x371f('0x26')](handleEntityNotFound(_0x3014ff,null))['then'](saveUpdates(_0x472c23['body'],null))['then'](function(_0x431f88){if(_0x431f88){_0x3790db[_0x371f('0x1b')]=_0x431f88[_0x371f('0x64')]({'plain':!![]});return db[_0x371f('0x65')][_0x371f('0x44')]({'where':{'id':_0x431f88[_0x371f('0x66')]}});}return null;})[_0x371f('0x26')](handleEntityNotFound(_0x3014ff,null))[_0x371f('0x26')](function(_0x2bfd46){if(_0x2bfd46){return _0x2bfd46['update']({'UserId':_0x472c23[_0x371f('0x45')][_0x371f('0x61')],'read1stAt':_['isNil'](_0x2bfd46[_0x371f('0x67')])?moment()[_0x371f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x371f('0x26')](function(_0x5e7526){if(_0x5e7526){_0x3790db[_0x371f('0x68')]=_0x5e7526[_0x371f('0x64')]({'plain':!![]});interaction_log[_0x371f('0x14')](_0x371f('0x69'),_0x472c23[_0x371f('0x62')]['id'],_0x472c23['user']['name'],_0x472c23[_0x371f('0x62')][_0x371f('0x6a')],_0x3790db['interaction']['id'],_0x472c23['body']?JSON['stringify'](_0x472c23[_0x371f('0x45')]):_0x371f('0x6b'));return respondWithRpcPromise(_0x371f('0x6c'),_0x371f('0x6d'),_0x3790db);}return null;})[_0x371f('0x26')](function(_0x4e3261){var _0x3b8f42='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e3261[_0x371f('0x1b')][_0x371f('0x6e')];return db[_0x371f('0x6f')][_0x371f('0x32')](_0x3b8f42,{'type':db['Sequelize'][_0x371f('0x70')]['SELECT'],'raw':!![]})[_0x371f('0x26')](function(_0x80b6d3){return _0x80b6d3;});})[_0x371f('0x26')](function(_0x208f05){if(_0x208f05){_0x3790db[_0x371f('0x1b')]['contact']=_0x208f05[0x0];if(!_0x472c23['body'][_0x371f('0x61')])return;return db[_0x371f('0x71')][_0x371f('0x44')]({'where':{'id':_0x472c23[_0x371f('0x45')][_0x371f('0x61')],'role':_0x371f('0x63')},'attributes':['id','name','fullname','email',_0x371f('0x72')],'raw':!![]});}return null;})['then'](function(_0x37dbf5){if(!_0x37dbf5)return null;_0x3790db[_0x371f('0x1b')]['agent']=_0x37dbf5;return _0x3790db;})['then'](function(_0x26bd4f){if(_0x26bd4f){if(_0x472c23[_0x371f('0x45')][_0x371f('0x73')]){_0x3790db[_0x371f('0x1b')][_0x371f('0x74')]=util[_0x371f('0x5c')](_0x371f('0x75'),_0x472c23[_0x371f('0x62')][_0x371f('0x30')]);_0x3790db['message']['channel']=_0x3790db[_0x371f('0x76')];_0x3790db[_0x371f('0x1b')]['motionChannel']=_0x3790db['channel'];_0x3790db[_0x371f('0x1b')]['event']=_0x371f('0x5d');_0x3790db[_0x371f('0x1b')][_0x371f('0x45')]=htmlToText[_0x371f('0x77')](_0x3790db[_0x371f('0x1b')][_0x371f('0x45')]);return respondWithRpcPromise(_0x371f('0x78'),'EventManager',{'event':_0x371f('0x79'),'message':_0x3790db[_0x371f('0x1b')]},client9002)[_0x371f('0x26')](function(){return _0x3790db;});}return _0x3790db;}return null;})[_0x371f('0x26')](respondWithResult(_0x3014ff,null))['catch'](handleError(_0x3014ff,null));};exports[_0x371f('0x7a')]=function(_0x2a5630,_0x23325a){var _0x3a33fc={'agent':{},'channel':_0x371f('0x7b')};if(_0x2a5630[_0x371f('0x45')]['id']){delete _0x2a5630[_0x371f('0x45')]['id'];}_0x2a5630['body'][_0x371f('0x61')]=_0x2a5630[_0x371f('0x45')][_0x371f('0x61')]||_0x2a5630[_0x371f('0x62')]['id'];_0x3a33fc['agent']['id']=_0x2a5630['body'][_0x371f('0x61')];return db['MailMessage'][_0x371f('0x44')]({'where':{'id':_0x2a5630[_0x371f('0x40')]['id'],'UserId':null}})[_0x371f('0x26')](handleEntityNotFound(_0x23325a,null))[_0x371f('0x26')](function(_0x5b47e3){if(_0x5b47e3){_0x3a33fc[_0x371f('0x1b')]=_0x5b47e3[_0x371f('0x64')]({'plain':!![]});return db['MailInteraction'][_0x371f('0x44')]({'where':{'id':_0x5b47e3['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x23325a,null))[_0x371f('0x26')](function(_0xb66588){if(_0xb66588){_0x3a33fc[_0x371f('0x68')]=_0xb66588[_0x371f('0x64')]({'plain':!![]});interaction_log[_0x371f('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a5630[_0x371f('0x62')]['id'],_0x2a5630[_0x371f('0x62')][_0x371f('0x30')],_0x2a5630['user']['role'],_0x3a33fc[_0x371f('0x68')]['id'],_0x2a5630['body']?JSON[_0x371f('0x18')](_0x2a5630['body']):'null');return respondWithRpcPromise(_0x371f('0x7c'),_0x371f('0x7d'),_0x3a33fc);}return null;})[_0x371f('0x26')](function(_0x5df9b0){var _0x54ec2d=_0x371f('0x7e')+_0x5df9b0[_0x371f('0x1b')]['ContactId'];return db[_0x371f('0x6f')][_0x371f('0x32')](_0x54ec2d,{'type':db[_0x371f('0x7f')][_0x371f('0x70')]['SELECT'],'raw':!![]})[_0x371f('0x26')](function(_0x4d3174){return _0x4d3174;});})[_0x371f('0x26')](function(_0xb90488){if(_0xb90488){_0x3a33fc[_0x371f('0x1b')]['contact']=_0xb90488[0x0];if(!_0x2a5630['body'][_0x371f('0x61')])return;return db['User']['find']({'where':{'id':_0x2a5630[_0x371f('0x45')][_0x371f('0x61')],'role':'agent'},'attributes':['id',_0x371f('0x30'),_0x371f('0x80'),_0x371f('0x81'),'internal'],'raw':!![]});}return null;})[_0x371f('0x26')](function(_0x172c7a){if(!_0x172c7a)return null;_0x3a33fc[_0x371f('0x1b')][_0x371f('0x63')]=_0x172c7a;return _0x3a33fc;})[_0x371f('0x26')](function(_0x36aa62){if(_0x36aa62){_0x36aa62[_0x371f('0x1b')]['interface']=util[_0x371f('0x5c')](_0x371f('0x75'),_0x2a5630['user'][_0x371f('0x30')]);_0x36aa62['message'][_0x371f('0x76')]=_0x3a33fc[_0x371f('0x76')];_0x36aa62[_0x371f('0x1b')][_0x371f('0x82')]=_0x3a33fc['channel'];_0x36aa62[_0x371f('0x1b')][_0x371f('0x83')]=_0x371f('0x7a');_0x36aa62[_0x371f('0x1b')][_0x371f('0x45')]=htmlToText[_0x371f('0x77')](_0x3a33fc[_0x371f('0x1b')][_0x371f('0x45')]);respondWithRpcPromise(_0x371f('0x78'),_0x371f('0x78'),{'event':_0x371f('0x84'),'message':_0x36aa62[_0x371f('0x1b')]},client9002);return _0x3a33fc;}return null;})['then'](respondWithResult(_0x23325a,null))[_0x371f('0x1e')](handleError(_0x23325a,null));};exports[_0x371f('0x85')]=function(_0x31e286,_0xfa37b5){var _0xdd2059=moment()[_0x371f('0x86')]()[_0x371f('0x87')]();var _0x3d3d46=path[_0x371f('0x55')](config[_0x371f('0x88')],'server',_0x371f('0x89'),_0x371f('0x8a'));var _0xfff95c=path[_0x371f('0x55')](config['root'],_0x371f('0x8b'),_0x371f('0x89'),_0x371f('0x54'));var _0x1dea03=util[_0x371f('0x5c')](_0x371f('0x8c'),_0xdd2059);return db[_0x371f('0x3c')][_0x371f('0x44')]({'where':{'id':_0x31e286[_0x371f('0x40')]['id']},'attributes':['id',_0x371f('0x45'),_0x371f('0x8d'),'to','cc',_0x371f('0x8e'),_0x371f('0x8f'),_0x371f('0x90')],'include':_0x31e286[_0x371f('0x32')][_0x371f('0x54')]?[{'model':db[_0x371f('0x91')],'as':_0x371f('0x92')}]:undefined})[_0x371f('0x26')](handleEntityNotFound(_0xfa37b5,null))[_0x371f('0x26')](function(_0x3836f9){if(_0x3836f9){var _0x1c4ad0=_0x3836f9;var _0x3530e3={'from':_0x1c4ad0[_0x371f('0x8d')],'to':_0x1c4ad0['to'],'subject':_0x1c4ad0[_0x371f('0x8f')],'html':htmlEntities[_0x371f('0x93')](_0x1c4ad0[_0x371f('0x45')]),'headers':{'Date':moment(_0x1c4ad0[_0x371f('0x90')])[_0x371f('0x5c')](_0x371f('0x94'))},'attachments':[]};if(_0x3836f9['cc']){_0x3530e3[_0x371f('0x95')]['Cc']=_0x3836f9['cc'];}if(_0x3836f9['bcc']){_0x3530e3[_0x371f('0x95')][_0x371f('0x96')]=_0x3836f9[_0x371f('0x8e')];}return new BPromise(function(_0x2a7e03,_0x52337b){if(_0x3836f9[_0x371f('0x92')]){for(var _0x10b4d0=0x0;_0x10b4d0<_0x3836f9['Attachments'][_0x371f('0x35')];_0x10b4d0++){var _0xee8f9f=_0x3836f9['Attachments'][_0x10b4d0];var _0x55230b=path['join'](_0xfff95c,_0xee8f9f[_0x371f('0x57')]);if(fs[_0x371f('0x97')](_0x55230b)){_0x3530e3['attachments'][_0x371f('0x98')]({'name':_0xee8f9f[_0x371f('0x30')],'contentType':_0xee8f9f[_0x371f('0x2f')],'data':fs['readFileSync'](_0x55230b)});}}}emlformat[_0x371f('0x99')](_0x3530e3,function(_0x30f8d8,_0x5ae149){if(_0x30f8d8)return _0x52337b(_0x30f8d8);fs[_0x371f('0x9a')](path[_0x371f('0x55')](_0x3d3d46,_0x1dea03),_0x5ae149);return _0x2a7e03(_0x5ae149);});});}})[_0x371f('0x26')](function(_0x36d7d8){if(_0x36d7d8){return _0xfa37b5['download'](path['join'](_0x3d3d46,_0x1dea03),_0x1dea03,function(_0x40122f){if(!_0x40122f)fs['unlinkSync'](path[_0x371f('0x55')](_0x3d3d46,_0x1dea03));});}})[_0x371f('0x1e')](handleError(_0xfa37b5,null));}; \ No newline at end of file +var _0x2f97=['subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','json','offset','undefined','limit','count','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','ListId','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','format','UserId','user','agent','MailInteraction','MailInteractionId','isNil','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','role','RejectMessage','rejectMessage','sequelize','Sequelize','internal','fromString','rejectmessage','download','toString','root','files','tmp','server','message-%s.eml','from','bcc'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x2f97,0x1e7));var _0x72f9=function(_0x38fbf6,_0x5f5144){_0x38fbf6=_0x38fbf6-0x0;var _0x391946=_0x2f97[_0x38fbf6];return _0x391946;};'use strict';var emlformat=require(_0x72f9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x72f9('0x1'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x72f9('0x2'));var htmlToText=require(_0x72f9('0x3'));var qs=require(_0x72f9('0x4'));var logger=require(_0x72f9('0x5'))('api');var interaction_log=require(_0x72f9('0x5'))(_0x72f9('0x6'));var config=require(_0x72f9('0x7'));var db=require('../../mysqldb')['db'];config[_0x72f9('0x8')]=_[_0x72f9('0x9')](config[_0x72f9('0x8')],{'host':_0x72f9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72f9('0x8')]));var htmlEntities=require('html-entities');require(_0x72f9('0xb'))[_0x72f9('0xc')](socket);var jayson=require(_0x72f9('0xd'));var client=jayson[_0x72f9('0xe')][_0x72f9('0xf')]({'port':0x232c});var client9003=jayson[_0x72f9('0xe')][_0x72f9('0xf')]({'port':0x232b});var client9002=jayson[_0x72f9('0xe')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1349a9,_0x29b607,_0x24c958,_0x456aad){return new BPromise(function(_0x29444a,_0x311fbb){var _0x49e8aa=_0x456aad||client;return _0x49e8aa[_0x72f9('0x10')](_0x1349a9,_0x24c958)[_0x72f9('0x11')](function(_0x170066){logger['info'](_0x72f9('0x12'),_0x29b607,'request\x20sent');logger[_0x72f9('0x13')](_0x72f9('0x14'),_0x29b607,_0x72f9('0x15'),JSON[_0x72f9('0x16')](_0x170066));if(_0x170066[_0x72f9('0x17')]){if(_0x170066[_0x72f9('0x17')][_0x72f9('0x18')]===0x1f4){logger[_0x72f9('0x17')](_0x72f9('0x12'),_0x29b607,_0x170066[_0x72f9('0x17')]['message']);return _0x311fbb(_0x170066['error'][_0x72f9('0x19')]);}logger['error'](_0x72f9('0x12'),_0x29b607,_0x170066[_0x72f9('0x17')][_0x72f9('0x19')]);return _0x29444a(_0x170066[_0x72f9('0x17')]['message']);}else{logger[_0x72f9('0x1a')]('MailMessage,\x20%s,\x20%s',_0x29b607,_0x72f9('0x15'));_0x29444a(_0x170066['result'][_0x72f9('0x19')]);}})[_0x72f9('0x1b')](function(_0x42187d){logger[_0x72f9('0x17')](_0x72f9('0x12'),_0x29b607,_0x42187d);_0x311fbb(_0x42187d);});});}function respondWithResult(_0x285a07,_0xb2b6be){_0xb2b6be=_0xb2b6be||0xc8;return function(_0x3ccaba){if(_0x3ccaba){return _0x285a07[_0x72f9('0x1c')](_0xb2b6be)[_0x72f9('0x1d')](_0x3ccaba);}};}function respondWithFilteredResult(_0x456ed7,_0x48a815){return function(_0x411409){if(_0x411409){var _0x3f6d2f=typeof _0x48a815[_0x72f9('0x1e')]===_0x72f9('0x1f')&&typeof _0x48a815[_0x72f9('0x20')]===_0x72f9('0x1f');var _0x4c1077=_0x411409[_0x72f9('0x21')];var _0x566434=_0x3f6d2f?0x0:_0x48a815[_0x72f9('0x1e')];var _0x5b883c=_0x3f6d2f?_0x411409[_0x72f9('0x21')]:_0x48a815[_0x72f9('0x1e')]+_0x48a815[_0x72f9('0x20')];var _0x57dd0b;if(_0x5b883c>=_0x4c1077){_0x5b883c=_0x4c1077;_0x57dd0b=0xc8;}else{_0x57dd0b=0xce;}_0x456ed7[_0x72f9('0x1c')](_0x57dd0b);return _0x456ed7['set']('Content-Range',_0x566434+'-'+_0x5b883c+'/'+_0x4c1077)[_0x72f9('0x1d')](_0x411409);}return null;};}function saveUpdates(_0x8398b8){return function(_0x4377cd){if(_0x4377cd){return _0x4377cd[_0x72f9('0x22')](_0x8398b8)[_0x72f9('0x11')](function(_0x32252e){return _0x32252e;});}return null;};}function removeEntity(_0x46a2b9){return function(_0x17ef94){if(_0x17ef94){return _0x17ef94[_0x72f9('0x23')]()[_0x72f9('0x11')](function(){_0x46a2b9[_0x72f9('0x1c')](0xcc)[_0x72f9('0x24')]();});}};}function handleEntityNotFound(_0xfc07bc){return function(_0x340f75){if(!_0x340f75){_0xfc07bc[_0x72f9('0x25')](0x194);}return _0x340f75;};}function handleError(_0x57f901,_0x2c3436){_0x2c3436=_0x2c3436||0x1f4;return function(_0x1b622d){logger[_0x72f9('0x17')](_0x1b622d[_0x72f9('0x26')]);if(_0x1b622d[_0x72f9('0x27')]){delete _0x1b622d[_0x72f9('0x27')];}_0x57f901['status'](_0x2c3436)[_0x72f9('0x28')](_0x1b622d);};}exports[_0x72f9('0x29')]=function(_0x124724,_0x16a9d9){var _0x1ffe4a={},_0x4b0fd4={},_0x1566de={'count':0x0,'rows':[]};var _0x593b1c=_[_0x72f9('0x2a')](db[_0x72f9('0x2b')]['rawAttributes'],function(_0x4cbd97){return{'name':_0x4cbd97[_0x72f9('0x2c')],'type':_0x4cbd97[_0x72f9('0x2d')][_0x72f9('0x2e')]};});_0x4b0fd4[_0x72f9('0x2f')]=_[_0x72f9('0x2a')](_0x593b1c,_0x72f9('0x27'));_0x4b0fd4[_0x72f9('0x30')]=_[_0x72f9('0x31')](_0x124724['query']);_0x4b0fd4[_0x72f9('0x32')]=_[_0x72f9('0x33')](_0x4b0fd4[_0x72f9('0x2f')],_0x4b0fd4['query']);_0x1ffe4a[_0x72f9('0x34')]=_[_0x72f9('0x33')](_0x4b0fd4[_0x72f9('0x2f')],qs[_0x72f9('0x35')](_0x124724['query'][_0x72f9('0x35')]));_0x1ffe4a[_0x72f9('0x34')]=_0x1ffe4a[_0x72f9('0x34')][_0x72f9('0x36')]?_0x1ffe4a[_0x72f9('0x34')]:_0x4b0fd4[_0x72f9('0x2f')];if(!_0x124724[_0x72f9('0x30')][_0x72f9('0x37')](_0x72f9('0x38'))){_0x1ffe4a['limit']=qs['limit'](_0x124724['query'][_0x72f9('0x20')]);_0x1ffe4a[_0x72f9('0x1e')]=qs[_0x72f9('0x1e')](_0x124724['query'][_0x72f9('0x1e')]);}_0x1ffe4a[_0x72f9('0x39')]=qs[_0x72f9('0x3a')](_0x124724[_0x72f9('0x30')][_0x72f9('0x3a')]);_0x1ffe4a[_0x72f9('0x3b')]=qs['filters'](_[_0x72f9('0x3c')](_0x124724[_0x72f9('0x30')],_0x4b0fd4[_0x72f9('0x32')]),_0x593b1c);if(_0x124724[_0x72f9('0x30')][_0x72f9('0x3d')]){_0x1ffe4a[_0x72f9('0x3b')]=_[_0x72f9('0x3e')](_0x1ffe4a['where'],{'$or':_[_0x72f9('0x2a')](_0x593b1c,function(_0x54f25e){if(_0x54f25e[_0x72f9('0x2d')]!==_0x72f9('0x3f')){var _0x52be29={};_0x52be29[_0x54f25e[_0x72f9('0x27')]]={'$like':'%'+_0x124724[_0x72f9('0x30')][_0x72f9('0x3d')]+'%'};return _0x52be29;}})});}_0x1ffe4a=_[_0x72f9('0x3e')]({},_0x1ffe4a,_0x124724[_0x72f9('0x40')]);var _0x24f13f={'where':_0x1ffe4a[_0x72f9('0x3b')]};return db['MailMessage'][_0x72f9('0x21')](_0x24f13f)['then'](function(_0x2372b9){_0x1566de[_0x72f9('0x21')]=_0x2372b9;if(_0x124724[_0x72f9('0x30')][_0x72f9('0x41')]){_0x1ffe4a[_0x72f9('0x42')]=[{'all':!![]}];}return db[_0x72f9('0x2b')]['findAll'](_0x1ffe4a);})[_0x72f9('0x11')](function(_0x383818){_0x1566de['rows']=_0x383818;return _0x1566de;})[_0x72f9('0x11')](respondWithFilteredResult(_0x16a9d9,_0x1ffe4a))[_0x72f9('0x1b')](handleError(_0x16a9d9,null));};exports[_0x72f9('0x43')]=function(_0xcafde1,_0x4da667){var _0x2b2895={'raw':!![],'where':{'id':_0xcafde1[_0x72f9('0x44')]['id']}},_0x33b92e={};_0x33b92e[_0x72f9('0x2f')]=_[_0x72f9('0x31')](db[_0x72f9('0x2b')]['rawAttributes']);_0x33b92e[_0x72f9('0x30')]=_[_0x72f9('0x31')](_0xcafde1['query']);_0x33b92e['filters']=_['intersection'](_0x33b92e[_0x72f9('0x2f')],_0x33b92e[_0x72f9('0x30')]);_0x2b2895[_0x72f9('0x34')]=_[_0x72f9('0x33')](_0x33b92e[_0x72f9('0x2f')],qs[_0x72f9('0x35')](_0xcafde1[_0x72f9('0x30')][_0x72f9('0x35')]));_0x2b2895[_0x72f9('0x34')]=_0x2b2895[_0x72f9('0x34')][_0x72f9('0x36')]?_0x2b2895['attributes']:_0x33b92e[_0x72f9('0x2f')];if(_0xcafde1['query'][_0x72f9('0x41')]){_0x2b2895[_0x72f9('0x42')]=[{'all':!![]}];}_0x2b2895=_['merge']({},_0x2b2895,_0xcafde1[_0x72f9('0x40')]);return db[_0x72f9('0x2b')]['find'](_0x2b2895)[_0x72f9('0x11')](handleEntityNotFound(_0x4da667,null))['then'](respondWithResult(_0x4da667,null))[_0x72f9('0x1b')](handleError(_0x4da667,null));};exports[_0x72f9('0x22')]=function(_0x353b6b,_0x5bee1e){if(_0x353b6b[_0x72f9('0x45')]['id']){delete _0x353b6b[_0x72f9('0x45')]['id'];}return db['MailMessage'][_0x72f9('0x46')]({'where':{'id':_0x353b6b['params']['id']}})[_0x72f9('0x11')](handleEntityNotFound(_0x5bee1e,null))[_0x72f9('0x11')](saveUpdates(_0x353b6b[_0x72f9('0x45')],null))[_0x72f9('0x11')](respondWithResult(_0x5bee1e,null))[_0x72f9('0x1b')](handleError(_0x5bee1e,null));};exports['destroy']=function(_0x24d7ec,_0x3875ac){return db[_0x72f9('0x2b')][_0x72f9('0x46')]({'where':{'id':_0x24d7ec[_0x72f9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3875ac,null))[_0x72f9('0x11')](removeEntity(_0x3875ac,null))[_0x72f9('0x1b')](handleError(_0x3875ac,null));};exports['describe']=function(_0x1fbdd1,_0x6e40aa){return db[_0x72f9('0x2b')][_0x72f9('0x47')]()[_0x72f9('0x11')](respondWithResult(_0x6e40aa,null))[_0x72f9('0x1b')](handleError(_0x6e40aa,null));};exports[_0x72f9('0x48')]=function(_0x574c4d,_0x5b35cc){return db[_0x72f9('0x2b')]['create'](_0x574c4d['body'])[_0x72f9('0x11')](function(_0x3dc633){if(_0x3dc633){if(_0x3dc633[_0x72f9('0x49')]===_0x72f9('0x4a')&&!_0x3dc633[_0x72f9('0x4b')]){var _0x7fed15,_0xfea1f5,_0x3497b2;if(_0x574c4d[_0x72f9('0x45')]['to']){_0xfea1f5=_0x574c4d[_0x72f9('0x45')]['to'][_0x72f9('0x4c')](',')[0x0];}return db[_0x72f9('0x4d')][_0x72f9('0x4e')]({'where':{'id':_0x3dc633[_0x72f9('0x4f')]},'include':[{'model':db[_0x72f9('0x50')],'as':_0x72f9('0x51'),'include':[{'model':db[_0x72f9('0x52')],'as':'Contacts','where':{'email':_0xfea1f5},'limit':0x1,'order':[[_0x72f9('0x53'),_0x72f9('0x54')]]}]},{'model':db[_0x72f9('0x55')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x72f9('0x56'),'raw':!![]}]}]})['then'](function(_0x1feac2){_0x7fed15=_0x1feac2;if(!_0x7fed15||!_0x7fed15['Smtp'])return;var _0x4fdd35=_0x7fed15[_0x72f9('0x57')]();if(_0x574c4d['body'][_0x72f9('0x58')]&&_0x574c4d[_0x72f9('0x45')][_0x72f9('0x58')][_0x72f9('0x36')]){for(var _0x364286=0x0;_0x364286<_0x574c4d['body'][_0x72f9('0x58')][_0x72f9('0x36')];_0x364286+=0x1){_0x574c4d[_0x72f9('0x45')][_0x72f9('0x58')][_0x364286]={'filename':_0x574c4d[_0x72f9('0x45')][_0x72f9('0x58')][_0x364286][_0x72f9('0x27')],'path':path[_0x72f9('0x59')](config['root'],_0x72f9('0x5a'),_0x574c4d[_0x72f9('0x45')][_0x72f9('0x58')][_0x364286][_0x72f9('0x5b')])};}}_0x3497b2={'account':_0x4fdd35,'message':_0x574c4d['body']};return;})['then'](function(){if(_0x7fed15[_0x72f9('0x51')]){if(_0x7fed15[_0x72f9('0x51')][_0x72f9('0x5c')][_0x72f9('0x36')]){return _0x7fed15['List'][_0x72f9('0x5c')][0x0];}else{return db[_0x72f9('0x52')]['create'](_['defaults'](_0x574c4d[_0x72f9('0x45')],{'firstName':_0x574c4d[_0x72f9('0x45')]['to'],'email':_0x574c4d[_0x72f9('0x45')]['to'],'phone':_0x574c4d['body']['to'],'ListId':_0x7fed15[_0x72f9('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x3497b2){return respondWithRpcPromise(_0x72f9('0x5e'),'sendMail',_0x3497b2,client9003)[_0x72f9('0x11')](function(_0x3fdbea){return _0x3dc633['update']({'read':!![],'messageId':_0x3fdbea[_0x72f9('0x5f')],'sentAt':moment()['format'](_0x72f9('0x60'))});})[_0x72f9('0x1b')](function(_0x572aed){logger['error']('%s',JSON[_0x72f9('0x16')](_0x572aed));return _0x3dc633;});}return _0x3dc633;});}return _0x3dc633;}})['then'](respondWithResult(_0x5b35cc,0xc9))[_0x72f9('0x1b')](handleError(_0x5b35cc,null));};exports[_0x72f9('0x61')]=function(_0xb9c8db,_0x17f37d){var _0x43245f={'agent':{},'channel':_0x72f9('0x62')};if(_0xb9c8db[_0x72f9('0x45')]['id']){delete _0xb9c8db['body']['id'];}_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x63')]=!![];_0xb9c8db['body']['readAt']=moment()[_0x72f9('0x64')](_0x72f9('0x60'));_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x65')]=_0xb9c8db[_0x72f9('0x45')]['UserId']||_0xb9c8db[_0x72f9('0x66')]['id'];_0x43245f[_0x72f9('0x67')]['id']=_0xb9c8db[_0x72f9('0x45')]['UserId'];return db[_0x72f9('0x2b')]['find']({'where':{'id':_0xb9c8db[_0x72f9('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x17f37d,null))[_0x72f9('0x11')](saveUpdates(_0xb9c8db['body'],null))[_0x72f9('0x11')](function(_0x596d83){if(_0x596d83){_0x43245f[_0x72f9('0x19')]=_0x596d83['get']({'plain':!![]});return db[_0x72f9('0x68')][_0x72f9('0x46')]({'where':{'id':_0x596d83[_0x72f9('0x69')]}});}return null;})[_0x72f9('0x11')](handleEntityNotFound(_0x17f37d,null))[_0x72f9('0x11')](function(_0xca2147){if(_0xca2147){return _0xca2147[_0x72f9('0x22')]({'UserId':_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x65')],'read1stAt':_[_0x72f9('0x6a')](_0xca2147['read1stAt'])?moment()[_0x72f9('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x72f9('0x11')](function(_0x5564e4){if(_0x5564e4){_0x43245f[_0x72f9('0x6b')]=_0x5564e4[_0x72f9('0x6c')]({'plain':!![]});interaction_log[_0x72f9('0x1a')](_0x72f9('0x6d'),_0xb9c8db['user']['id'],_0xb9c8db['user']['name'],_0xb9c8db[_0x72f9('0x66')]['role'],_0x43245f[_0x72f9('0x6b')]['id'],_0xb9c8db[_0x72f9('0x45')]?JSON['stringify'](_0xb9c8db['body']):_0x72f9('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x72f9('0x6f'),_0x43245f);}return null;})[_0x72f9('0x11')](function(_0x156d43){var _0x520815=_0x72f9('0x70')+_0x156d43[_0x72f9('0x19')]['ContactId'];return db['sequelize']['query'](_0x520815,{'type':db['Sequelize'][_0x72f9('0x71')][_0x72f9('0x72')],'raw':!![]})[_0x72f9('0x11')](function(_0x4cbf13){return _0x4cbf13;});})[_0x72f9('0x11')](function(_0x1f8f04){if(_0x1f8f04){_0x43245f['message'][_0x72f9('0x73')]=_0x1f8f04[0x0];if(!_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x65')])return;return db[_0x72f9('0x74')][_0x72f9('0x46')]({'where':{'id':_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x65')],'role':_0x72f9('0x67')},'attributes':['id',_0x72f9('0x27'),_0x72f9('0x75'),_0x72f9('0x76'),'internal'],'raw':!![]});}return null;})[_0x72f9('0x11')](function(_0x1cccfa){if(!_0x1cccfa)return null;_0x43245f[_0x72f9('0x19')]['agent']=_0x1cccfa;return _0x43245f;})[_0x72f9('0x11')](function(_0x4b8b2b){if(_0x4b8b2b){if(_0xb9c8db[_0x72f9('0x45')][_0x72f9('0x77')]){_0x43245f['message'][_0x72f9('0x78')]=util[_0x72f9('0x64')](_0x72f9('0x79'),_0xb9c8db[_0x72f9('0x66')][_0x72f9('0x27')]);_0x43245f[_0x72f9('0x19')][_0x72f9('0x7a')]=_0x43245f[_0x72f9('0x7a')];_0x43245f['message'][_0x72f9('0x7b')]=_0x43245f[_0x72f9('0x7a')];_0x43245f['message'][_0x72f9('0x7c')]=_0x72f9('0x61');_0x43245f[_0x72f9('0x19')][_0x72f9('0x45')]=htmlToText['fromString'](_0x43245f[_0x72f9('0x19')]['body']);return respondWithRpcPromise('EventManager',_0x72f9('0x7d'),{'event':_0x72f9('0x7e'),'message':_0x43245f[_0x72f9('0x19')]},client9002)[_0x72f9('0x11')](function(){return _0x43245f;});}return _0x43245f;}return null;})[_0x72f9('0x11')](respondWithResult(_0x17f37d,null))[_0x72f9('0x1b')](handleError(_0x17f37d,null));};exports[_0x72f9('0x7f')]=function(_0xe9b356,_0x14458d){var _0x5798d1={'agent':{},'channel':_0x72f9('0x62')};if(_0xe9b356[_0x72f9('0x45')]['id']){delete _0xe9b356[_0x72f9('0x45')]['id'];}_0xe9b356['body']['UserId']=_0xe9b356[_0x72f9('0x45')][_0x72f9('0x65')]||_0xe9b356[_0x72f9('0x66')]['id'];_0x5798d1[_0x72f9('0x67')]['id']=_0xe9b356[_0x72f9('0x45')][_0x72f9('0x65')];return db[_0x72f9('0x2b')][_0x72f9('0x46')]({'where':{'id':_0xe9b356['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14458d,null))['then'](function(_0xeabd96){if(_0xeabd96){_0x5798d1[_0x72f9('0x19')]=_0xeabd96[_0x72f9('0x6c')]({'plain':!![]});return db[_0x72f9('0x68')][_0x72f9('0x46')]({'where':{'id':_0xeabd96['MailInteractionId']}});}return null;})[_0x72f9('0x11')](handleEntityNotFound(_0x14458d,null))[_0x72f9('0x11')](function(_0x1c2fe6){if(_0x1c2fe6){_0x5798d1[_0x72f9('0x6b')]=_0x1c2fe6[_0x72f9('0x6c')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe9b356[_0x72f9('0x66')]['id'],_0xe9b356[_0x72f9('0x66')][_0x72f9('0x27')],_0xe9b356[_0x72f9('0x66')][_0x72f9('0x80')],_0x5798d1[_0x72f9('0x6b')]['id'],_0xe9b356['body']?JSON[_0x72f9('0x16')](_0xe9b356[_0x72f9('0x45')]):'null');return respondWithRpcPromise(_0x72f9('0x81'),_0x72f9('0x82'),_0x5798d1);}return null;})[_0x72f9('0x11')](function(_0x24f1ce){var _0x149b25=_0x72f9('0x70')+_0x24f1ce[_0x72f9('0x19')]['ContactId'];return db[_0x72f9('0x83')][_0x72f9('0x30')](_0x149b25,{'type':db[_0x72f9('0x84')][_0x72f9('0x71')][_0x72f9('0x72')],'raw':!![]})['then'](function(_0x564d17){return _0x564d17;});})[_0x72f9('0x11')](function(_0x207853){if(_0x207853){_0x5798d1[_0x72f9('0x19')][_0x72f9('0x73')]=_0x207853[0x0];if(!_0xe9b356[_0x72f9('0x45')][_0x72f9('0x65')])return;return db['User'][_0x72f9('0x46')]({'where':{'id':_0xe9b356[_0x72f9('0x45')][_0x72f9('0x65')],'role':_0x72f9('0x67')},'attributes':['id',_0x72f9('0x27'),_0x72f9('0x75'),_0x72f9('0x76'),_0x72f9('0x85')],'raw':!![]});}return null;})[_0x72f9('0x11')](function(_0x5d35ee){if(!_0x5d35ee)return null;_0x5798d1[_0x72f9('0x19')][_0x72f9('0x67')]=_0x5d35ee;return _0x5798d1;})[_0x72f9('0x11')](function(_0x2af965){if(_0x2af965){_0x2af965[_0x72f9('0x19')]['interface']=util['format']('SIP/%s',_0xe9b356[_0x72f9('0x66')][_0x72f9('0x27')]);_0x2af965[_0x72f9('0x19')][_0x72f9('0x7a')]=_0x5798d1[_0x72f9('0x7a')];_0x2af965['message'][_0x72f9('0x7b')]=_0x5798d1[_0x72f9('0x7a')];_0x2af965[_0x72f9('0x19')][_0x72f9('0x7c')]=_0x72f9('0x7f');_0x2af965['message'][_0x72f9('0x45')]=htmlToText[_0x72f9('0x86')](_0x5798d1[_0x72f9('0x19')][_0x72f9('0x45')]);respondWithRpcPromise(_0x72f9('0x7d'),_0x72f9('0x7d'),{'event':_0x72f9('0x87'),'message':_0x2af965[_0x72f9('0x19')]},client9002);return _0x5798d1;}return null;})[_0x72f9('0x11')](respondWithResult(_0x14458d,null))['catch'](handleError(_0x14458d,null));};exports[_0x72f9('0x88')]=function(_0x2ac102,_0x4838e3){var _0x4bde2d=moment()['unix']()[_0x72f9('0x89')]();var _0x193199=path['join'](config[_0x72f9('0x8a')],'server',_0x72f9('0x8b'),_0x72f9('0x8c'));var _0x487c62=path[_0x72f9('0x59')](config[_0x72f9('0x8a')],_0x72f9('0x8d'),'files','attachments');var _0x43b998=util[_0x72f9('0x64')](_0x72f9('0x8e'),_0x4bde2d);return db[_0x72f9('0x2b')][_0x72f9('0x46')]({'where':{'id':_0x2ac102[_0x72f9('0x44')]['id']},'attributes':['id',_0x72f9('0x45'),_0x72f9('0x8f'),'to','cc',_0x72f9('0x90'),_0x72f9('0x91'),_0x72f9('0x92')],'include':_0x2ac102[_0x72f9('0x30')][_0x72f9('0x58')]?[{'model':db[_0x72f9('0x93')],'as':_0x72f9('0x94')}]:undefined})['then'](handleEntityNotFound(_0x4838e3,null))['then'](function(_0x563b43){if(_0x563b43){var _0x15e6e1=_0x563b43;var _0x477329={'from':_0x15e6e1[_0x72f9('0x8f')],'to':_0x15e6e1['to'],'subject':_0x15e6e1['subject'],'html':htmlEntities[_0x72f9('0x95')](_0x15e6e1['body']),'headers':{'Date':moment(_0x15e6e1[_0x72f9('0x92')])[_0x72f9('0x64')](_0x72f9('0x96'))},'attachments':[]};if(_0x563b43['cc']){_0x477329[_0x72f9('0x97')]['Cc']=_0x563b43['cc'];}if(_0x563b43[_0x72f9('0x90')]){_0x477329[_0x72f9('0x97')][_0x72f9('0x98')]=_0x563b43[_0x72f9('0x90')];}return new BPromise(function(_0x231e33,_0x246162){if(_0x563b43[_0x72f9('0x94')]){for(var _0x45fa30=0x0;_0x45fa30<_0x563b43[_0x72f9('0x94')]['length'];_0x45fa30++){var _0x297b43=_0x563b43[_0x72f9('0x94')][_0x45fa30];var _0x4697f3=path[_0x72f9('0x59')](_0x487c62,_0x297b43[_0x72f9('0x5b')]);if(fs['existsSync'](_0x4697f3)){_0x477329['attachments'][_0x72f9('0x99')]({'name':_0x297b43[_0x72f9('0x27')],'contentType':_0x297b43[_0x72f9('0x2d')],'data':fs[_0x72f9('0x9a')](_0x4697f3)});}}}emlformat[_0x72f9('0x9b')](_0x477329,function(_0x2be9f1,_0x241761){if(_0x2be9f1)return _0x246162(_0x2be9f1);fs[_0x72f9('0x9c')](path[_0x72f9('0x59')](_0x193199,_0x43b998),_0x241761);return _0x231e33(_0x241761);});});}})[_0x72f9('0x11')](function(_0x42a183){if(_0x42a183){return _0x4838e3['download'](path[_0x72f9('0x59')](_0x193199,_0x43b998),_0x43b998,function(_0x24b446){if(!_0x24b446)fs[_0x72f9('0x9d')](path[_0x72f9('0x59')](_0x193199,_0x43b998));});}})['catch'](handleError(_0x4838e3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6113179..fb6f784 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 _0x48a6=['hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x1b5a05,_0x2c80de){var _0x347931=function(_0xd39454){while(--_0xd39454){_0x1b5a05['push'](_0x1b5a05['shift']());}};_0x347931(++_0x2c80de);}(_0x48a6,0x7a));var _0x648a=function(_0x44de50,_0x31e308){_0x44de50=_0x44de50-0x0;var _0x43cbb5=_0x48a6[_0x44de50];return _0x43cbb5;};'use strict';var EventEmitter=require(_0x648a('0x0'));var MailMessage=require(_0x648a('0x1'))['db'][_0x648a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x648a('0x3')](0x0);var events={'afterCreate':_0x648a('0x4'),'afterUpdate':_0x648a('0x5'),'afterDestroy':_0x648a('0x6')};function emitEvent(_0x2e7817){return function(_0x1175b9,_0x3eebcd,_0x4cb4cf){MailMessageEvents[_0x648a('0x7')](_0x2e7817+':'+_0x1175b9['id'],_0x1175b9);MailMessageEvents['emit'](_0x2e7817,_0x1175b9);_0x4cb4cf(null);};}for(var e in events){if(events[_0x648a('0x8')](e)){var event=events[e];MailMessage[_0x648a('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x668b=['hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x668b,0x85));var _0xb668=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x668b[_0x267c52];return _0x46c47b;};'use strict';var EventEmitter=require(_0xb668('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xb668('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':_0xb668('0x4'),'afterDestroy':_0xb668('0x5')};function emitEvent(_0x5cd3d7){return function(_0x3ee2ef,_0x41a36a,_0x43719a){MailMessageEvents[_0xb668('0x6')](_0x5cd3d7+':'+_0x3ee2ef['id'],_0x3ee2ef);MailMessageEvents[_0xb668('0x6')](_0x5cd3d7,_0x3ee2ef);_0x43719a(null);};}for(var e in events){if(events[_0xb668('0x7')](e)){var event=events[e];MailMessage[_0xb668('0x8')](e,emitEvent(event));}}module[_0xb668('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1eab298..ad9d831 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 _0x61be=['MailInteraction','findOne','MailInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','html-to-text','path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','direction','toLowerCase','secret'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x61be,0x1e3));var _0xe61b=function(_0x1f6994,_0x2b4985){_0x1f6994=_0x1f6994-0x0;var _0x592e20=_0x61be[_0x1f6994];return _0x592e20;};'use strict';var _=require(_0xe61b('0x0'));var util=require(_0xe61b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe61b('0x2'));var BPromise=require(_0xe61b('0x3'));var rp=require(_0xe61b('0x4'));var htmlToText=require(_0xe61b('0x5'));var fs=require('fs');var path=require(_0xe61b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe61b('0x7'));module[_0xe61b('0x8')]=function(_0x4d6fc5,_0x2e8d82){return _0x4d6fc5[_0xe61b('0x9')](_0xe61b('0xa'),attributes,{'tableName':_0xe61b('0xb'),'paranoid':![],'indexes':[{'name':_0xe61b('0xc'),'fields':['messageId']},{'name':_0xe61b('0xd'),'fields':[_0xe61b('0xe'),_0xe61b('0xf')],'type':_0xe61b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x76c419,_0x487b7b,_0x3fb5ca){if(_0x76c419[_0xe61b('0x11')]){_0x76c419[_0xe61b('0xe')]=htmlToText['fromString'](_0x76c419[_0xe61b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3fb5ca(null,_0x487b7b);},'afterCreate':function(_0x45e395,_0x23c0b6,_0x2cf19d){var _0x1f20ec=_0x4d6fc5['models'];var _0x3ce33f=_0x45e395['get']({'plain':!![]});if(_0x3ce33f[_0xe61b('0x12')][_0xe61b('0x13')]()==='in'||_0x3ce33f[_0xe61b('0x12')]['toLowerCase']()==='out'&&!_0x3ce33f[_0xe61b('0x14')]&&!_['isNil'](_0x3ce33f['UserId'])){_0x1f20ec[_0xe61b('0x15')][_0xe61b('0x16')]({'where':{'id':_0x3ce33f[_0xe61b('0x17')]}})['then'](function(_0x542637){if(_0x542637){_0x542637[_0xe61b('0x18')]({'lastMsgAt':_0x3ce33f[_0xe61b('0x19')],'lastMsgDirection':_0x3ce33f[_0xe61b('0x12')][_0xe61b('0x13')]()});}})[_0xe61b('0x1a')](function(_0x185ebf){console['error'](_0x185ebf);});}_0x2cf19d();}},'charset':'utf8mb4','collate':_0xe61b('0x1b')});}; \ No newline at end of file +var _0x0171=['exports','define','MailMessage','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','toLowerCase','out','secret','isNil','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','api','moment','bluebird','html-to-text','path','rimraf','./mailMessage.attributes'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x0171,0x97));var _0x1017=function(_0x52f1a5,_0x40f02b){_0x52f1a5=_0x52f1a5-0x0;var _0x2b9ac5=_0x0171[_0x52f1a5];return _0x2b9ac5;};'use strict';var _=require(_0x1017('0x0'));var util=require(_0x1017('0x1'));var logger=require('../../config/logger')(_0x1017('0x2'));var moment=require(_0x1017('0x3'));var BPromise=require(_0x1017('0x4'));var rp=require('request-promise');var htmlToText=require(_0x1017('0x5'));var fs=require('fs');var path=require(_0x1017('0x6'));var rimraf=require(_0x1017('0x7'));var config=require('../../config/environment');var attributes=require(_0x1017('0x8'));module[_0x1017('0x9')]=function(_0x3ac0a,_0x16ba32){return _0x3ac0a[_0x1017('0xa')](_0x1017('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1017('0xc'),'fields':['messageId']},{'name':_0x1017('0xd'),'fields':['plainBody',_0x1017('0xe')],'type':_0x1017('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4728f1,_0x5a9432,_0x1c250e){if(_0x4728f1[_0x1017('0x10')]){_0x4728f1[_0x1017('0x11')]=htmlToText[_0x1017('0x12')](_0x4728f1[_0x1017('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1c250e(null,_0x5a9432);},'afterCreate':function(_0x48f629,_0x48ccbe,_0x1115cc){var _0x94d72b=_0x3ac0a[_0x1017('0x13')];var _0x47b848=_0x48f629['get']({'plain':!![]});if(_0x47b848['direction'][_0x1017('0x14')]()==='in'||_0x47b848['direction'][_0x1017('0x14')]()===_0x1017('0x15')&&!_0x47b848[_0x1017('0x16')]&&!_[_0x1017('0x17')](_0x47b848['UserId'])){_0x94d72b['MailInteraction'][_0x1017('0x18')]({'where':{'id':_0x47b848[_0x1017('0x19')]}})[_0x1017('0x1a')](function(_0x973f01){if(_0x973f01){_0x973f01[_0x1017('0x1b')]({'lastMsgAt':_0x47b848[_0x1017('0x1c')],'lastMsgDirection':_0x47b848['direction'][_0x1017('0x14')]()});}})[_0x1017('0x1d')](function(_0x5b599e){console[_0x1017('0x1e')](_0x5b599e);});}_0x1115cc();}},'charset':_0x1017('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f71da1b..5379596 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 _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cb4,0xff));var _0x46cb=function(_0x250303,_0x593722){_0x250303=_0x250303-0x0;var _0xa2ef3c=_0x6cb4[_0x250303];return _0xa2ef3c;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file +var _0xe1e3=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','stringify','code','error','MailMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateMailMessage','create','body','options','raw','debug','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x500780,_0x48402c){_0x500780=_0x500780-0x0;var _0x37ed03=_0xe1e3[_0x500780];return _0x37ed03;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});config['redis']=_[_0x3e1e('0xa')](config[_0x3e1e('0xb')],{'host':_0x3e1e('0xc'),'port':0x18eb});var socket=require(_0x3e1e('0xd'))(new Redis(config[_0x3e1e('0xb')]));require(_0x3e1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c4c25,_0x5060e8,_0x31d205){return new BPromise(function(_0x5b0df8,_0x349460){return client[_0x3e1e('0xf')](_0x5c4c25,_0x31d205)[_0x3e1e('0x10')](function(_0x594c59){logger[_0x3e1e('0x11')]('MailMessage,\x20%s,\x20%s',_0x5060e8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x5060e8,'request\x20sent',JSON[_0x3e1e('0x12')](_0x594c59));if(_0x594c59['error']){if(_0x594c59['error'][_0x3e1e('0x13')]===0x1f4){logger[_0x3e1e('0x14')](_0x3e1e('0x15'),_0x5060e8,_0x594c59['error']['message']);return _0x349460(_0x594c59[_0x3e1e('0x14')][_0x3e1e('0x16')]);}logger['error'](_0x3e1e('0x15'),_0x5060e8,_0x594c59[_0x3e1e('0x14')]['message']);return _0x5b0df8(_0x594c59[_0x3e1e('0x14')]['message']);}else{logger[_0x3e1e('0x11')](_0x3e1e('0x15'),_0x5060e8,_0x3e1e('0x17'));_0x5b0df8(_0x594c59[_0x3e1e('0x18')][_0x3e1e('0x16')]);}})[_0x3e1e('0x19')](function(_0x569f49){logger['error']('MailMessage,\x20%s,\x20%s',_0x5060e8,_0x569f49);_0x349460(_0x569f49);});});}exports[_0x3e1e('0x1a')]=function(_0x30acbf){var _0xa3e99c=this;return new Promise(function(_0x57c660,_0x1c5acd){return db['MailMessage'][_0x3e1e('0x1b')](_0x30acbf[_0x3e1e('0x1c')],{'raw':_0x30acbf[_0x3e1e('0x1d')]?_0x30acbf['options'][_0x3e1e('0x1e')]===undefined?!![]:![]:!![]})[_0x3e1e('0x10')](function(_0xefa098){logger['info']('CreateMailMessage',_0x30acbf);logger[_0x3e1e('0x1f')](_0x3e1e('0x1a'),_0x30acbf,JSON['stringify'](_0xefa098));_0x57c660(_0xefa098);})[_0x3e1e('0x19')](function(_0x56ae51){logger[_0x3e1e('0x14')](_0x3e1e('0x1a'),_0x56ae51[_0x3e1e('0x16')],_0x30acbf);_0x1c5acd(_0xa3e99c[_0x3e1e('0x14')](0x1f4,_0x56ae51[_0x3e1e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c1a732c..1b3b06c 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 _0x3c8c=['mailMessage:','./mailMessage.events','save','remove','update','emit','length'];(function(_0x3c362a,_0x505fea){var _0x57c7a1=function(_0x1cd902){while(--_0x1cd902){_0x3c362a['push'](_0x3c362a['shift']());}};_0x57c7a1(++_0x505fea);}(_0x3c8c,0xb0));var _0xc3c8=function(_0x1ead9f,_0x33f0dc){_0x1ead9f=_0x1ead9f-0x0;var _0x5dfcc8=_0x3c8c[_0x1ead9f];return _0x5dfcc8;};'use strict';var MailMessageEvents=require(_0xc3c8('0x0'));var events=[_0xc3c8('0x1'),_0xc3c8('0x2'),_0xc3c8('0x3')];function createListener(_0x5a1dab,_0x476df5){return function(_0x8d26c8){_0x476df5[_0xc3c8('0x4')](_0x5a1dab,_0x8d26c8);};}function removeListener(_0xa2dbac,_0x23e056){return function(){MailMessageEvents['removeListener'](_0xa2dbac,_0x23e056);};}exports['register']=function(_0x5a0ca3){for(var _0x72d7f8=0x0,_0x1c0d7b=events[_0xc3c8('0x5')];_0x72d7f8<_0x1c0d7b;_0x72d7f8++){var _0x4e1cf9=events[_0x72d7f8];var _0x21e167=createListener(_0xc3c8('0x6')+_0x4e1cf9,_0x5a0ca3);MailMessageEvents['on'](_0x4e1cf9,_0x21e167);}}; \ No newline at end of file +var _0xcdd0=['update','removeListener','register','length','./mailMessage.events','save','remove'];(function(_0x3007fd,_0x318748){var _0x6bb4ef=function(_0x320772){while(--_0x320772){_0x3007fd['push'](_0x3007fd['shift']());}};_0x6bb4ef(++_0x318748);}(_0xcdd0,0x169));var _0x0cdd=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xcdd0[_0x18cd5b];return _0x5eaa52;};'use strict';var MailMessageEvents=require(_0x0cdd('0x0'));var events=[_0x0cdd('0x1'),_0x0cdd('0x2'),_0x0cdd('0x3')];function createListener(_0xe61fdb,_0x339c83){return function(_0x2256ef){_0x339c83['emit'](_0xe61fdb,_0x2256ef);};}function removeListener(_0x3080d3,_0x52d6ab){return function(){MailMessageEvents[_0x0cdd('0x4')](_0x3080d3,_0x52d6ab);};}exports[_0x0cdd('0x5')]=function(_0x154e80){for(var _0x43f99d=0x0,_0xd4b6d5=events[_0x0cdd('0x6')];_0x43f99d<_0xd4b6d5;_0x43f99d++){var _0x24a149=events[_0x43f99d];var _0x4a9d58=createListener('mailMessage:'+_0x24a149,_0x154e80);MailMessageEvents['on'](_0x24a149,_0x4a9d58);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0babe58..20f0afb 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 _0x74b4=['post','create','addTeams','put','update','delete','destroy','/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/:id','show','getMembers','getTeams','/:id/users','getAgents'];(function(_0x3eec74,_0x57e769){var _0x4bcfbe=function(_0x427baa){while(--_0x427baa){_0x3eec74['push'](_0x3eec74['shift']());}};_0x4bcfbe(++_0x57e769);}(_0x74b4,0xea));var _0x474b=function(_0x389742,_0x368231){_0x389742=_0x389742-0x0;var _0x349758=_0x74b4[_0x389742];return _0x349758;};'use strict';var multer=require(_0x474b('0x0'));var util=require(_0x474b('0x1'));var path=require(_0x474b('0x2'));var timeout=require(_0x474b('0x3'));var express=require(_0x474b('0x4'));var router=express['Router']();var fs_extra=require(_0x474b('0x5'));var auth=require(_0x474b('0x6'));var interaction=require(_0x474b('0x7'));var config=require('../../config/environment');var controller=require(_0x474b('0x8'));router['get']('/',auth[_0x474b('0x9')](),controller[_0x474b('0xa')]);router[_0x474b('0xb')]('/describe',auth[_0x474b('0x9')](),controller['describe']);router[_0x474b('0xb')](_0x474b('0xc'),auth[_0x474b('0x9')](),controller[_0x474b('0xd')]);router[_0x474b('0xb')]('/:id/members',auth[_0x474b('0x9')](),controller[_0x474b('0xe')]);router[_0x474b('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0x474b('0xf')]);router[_0x474b('0xb')](_0x474b('0x10'),auth[_0x474b('0x9')](),controller[_0x474b('0x11')]);router[_0x474b('0x12')]('/',auth[_0x474b('0x9')](),controller[_0x474b('0x13')]);router[_0x474b('0x12')]('/:id/teams',auth[_0x474b('0x9')](),controller[_0x474b('0x14')]);router[_0x474b('0x12')](_0x474b('0x10'),auth[_0x474b('0x9')](),controller['addAgents']);router[_0x474b('0x15')](_0x474b('0xc'),auth[_0x474b('0x9')](),controller[_0x474b('0x16')]);router[_0x474b('0x17')](_0x474b('0xc'),auth[_0x474b('0x9')](),controller[_0x474b('0x18')]);router[_0x474b('0x17')](_0x474b('0x19'),auth[_0x474b('0x9')](),controller[_0x474b('0x1a')]);router['delete']('/:id/users',auth[_0x474b('0x9')](),controller['removeAgents']);module[_0x474b('0x1b')]=router; \ No newline at end of file +var _0x518e=['express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','create','update','delete','removeTeams','removeAgents','exports','path','connect-timeout'];(function(_0x5d20c8,_0x172baa){var _0x4f90e9=function(_0x39fce6){while(--_0x39fce6){_0x5d20c8['push'](_0x5d20c8['shift']());}};_0x4f90e9(++_0x172baa);}(_0x518e,0x1cc));var _0xe518=function(_0x302ef5,_0x4dec7b){_0x302ef5=_0x302ef5-0x0;var _0x4fd271=_0x518e[_0x302ef5];return _0x4fd271;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe518('0x0'));var timeout=require(_0xe518('0x1'));var express=require(_0xe518('0x2'));var router=express[_0xe518('0x3')]();var fs_extra=require(_0xe518('0x4'));var auth=require(_0xe518('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe518('0x6'));router[_0xe518('0x7')]('/',auth[_0xe518('0x8')](),controller['index']);router[_0xe518('0x7')](_0xe518('0x9'),auth[_0xe518('0x8')](),controller['describe']);router['get'](_0xe518('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe518('0x7')](_0xe518('0xb'),auth[_0xe518('0x8')](),controller['getMembers']);router[_0xe518('0x7')](_0xe518('0xc'),auth[_0xe518('0x8')](),controller['getTeams']);router['get'](_0xe518('0xd'),auth['isAuthenticated'](),controller[_0xe518('0xe')]);router[_0xe518('0xf')]('/',auth['isAuthenticated'](),controller[_0xe518('0x10')]);router[_0xe518('0xf')](_0xe518('0xc'),auth[_0xe518('0x8')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xe518('0xa'),auth['isAuthenticated'](),controller[_0xe518('0x11')]);router[_0xe518('0x12')](_0xe518('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xe518('0x12')](_0xe518('0xc'),auth[_0xe518('0x8')](),controller[_0xe518('0x13')]);router[_0xe518('0x12')](_0xe518('0xd'),auth['isAuthenticated'](),controller[_0xe518('0x14')]);module[_0xe518('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8175947..6c9be68 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 _0x1dda=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x4570bc,_0x526d27){var _0x2f714c=function(_0xfe3605){while(--_0xfe3605){_0x4570bc['push'](_0x4570bc['shift']());}};_0x2f714c(++_0x526d27);}(_0x1dda,0xe7));var _0xa1dd=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x1dda[_0x5093e9];return _0x4c9a22;};'use strict';var Sequelize=require(_0xa1dd('0x0'));module[_0xa1dd('0x1')]={'name':{'type':Sequelize[_0xa1dd('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa1dd('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa1dd('0x3')](_0xa1dd('0x4'),'beepall',_0xa1dd('0x5'))}}; \ No newline at end of file +var _0x4cfb=['ENUM','rrmemory','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x262654,_0xd3b17f){var _0x1eb12d=function(_0x18c1c1){while(--_0x18c1c1){_0x262654['push'](_0x262654['shift']());}};_0x1eb12d(++_0xd3b17f);}(_0x4cfb,0x9d));var _0xb4cf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4cfb[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xb4cf('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4cf('0x1')],'unique':_0xb4cf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb4cf('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb4cf('0x4')](_0xb4cf('0x5'),'beepall',_0xb4cf('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 293c833..ed26fa3 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 _0x1475=['stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','where','include','findAll','rows','catch','show','params','keys','query','filters','intersection','attributes','model','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','fields','hasOwnProperty','nolimit','sort','pick','filter','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','ids','Team','User','Agents','online','voicePause','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','removeTeams','isEmpty','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','order','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','count','limit','set','update','then','get','destroy','end','error'];(function(_0x50a3d9,_0x373bc1){var _0x102aaf=function(_0xf74164){while(--_0xf74164){_0x50a3d9['push'](_0x50a3d9['shift']());}};_0x102aaf(++_0x373bc1);}(_0x1475,0x157));var _0x5147=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0x1475[_0x2ade6c];return _0x2cb372;};'use strict';var BPromise=require(_0x5147('0x0'));var util=require(_0x5147('0x1'));var _=require('lodash');var squel=require(_0x5147('0x2'));var Redis=require(_0x5147('0x3'));var qs=require(_0x5147('0x4'));var logger=require(_0x5147('0x5'))('api');var config=require(_0x5147('0x6'));var db=require(_0x5147('0x7'))['db'];config[_0x5147('0x8')]=_[_0x5147('0x9')](config[_0x5147('0x8')],{'host':_0x5147('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5147('0x8')]));require('./mailQueue.socket')[_0x5147('0xb')](socket);function respondWithStatusCode(_0x2a532a,_0x2e871b){_0x2e871b=_0x2e871b||0xcc;return function(_0x10d00b){if(_0x10d00b){return _0x2a532a[_0x5147('0xc')](_0x2e871b);}return _0x2a532a[_0x5147('0xd')](_0x2e871b)['end']();};}function respondWithResult(_0x37684d,_0x41ec3d){_0x41ec3d=_0x41ec3d||0xc8;return function(_0x4a5b1b){if(_0x4a5b1b){return _0x37684d[_0x5147('0xd')](_0x41ec3d)[_0x5147('0xe')](_0x4a5b1b);}};}function respondWithFilteredResult(_0x488c85,_0x199e6f){return function(_0x3cbbf3){if(_0x3cbbf3){var _0x3948d2=typeof _0x199e6f[_0x5147('0xf')]==='undefined'&&typeof _0x199e6f['limit']===_0x5147('0x10');var _0x4bdcc8=_0x3cbbf3['count'];var _0x535588=_0x3948d2?0x0:_0x199e6f[_0x5147('0xf')];var _0x3bc8dc=_0x3948d2?_0x3cbbf3[_0x5147('0x11')]:_0x199e6f[_0x5147('0xf')]+_0x199e6f[_0x5147('0x12')];var _0x3a553c;if(_0x3bc8dc>=_0x4bdcc8){_0x3bc8dc=_0x4bdcc8;_0x3a553c=0xc8;}else{_0x3a553c=0xce;}_0x488c85['status'](_0x3a553c);return _0x488c85[_0x5147('0x13')]('Content-Range',_0x535588+'-'+_0x3bc8dc+'/'+_0x4bdcc8)[_0x5147('0xe')](_0x3cbbf3);}return null;};}function saveUpdates(_0x590690){return function(_0x3b420){if(_0x3b420){return _0x3b420[_0x5147('0x14')](_0x590690)[_0x5147('0x15')](function(_0x422d48){return _0x422d48;});}return null;};}function removeEntity(_0x3dcafb){return function(_0x5cbc96){if(_0x5cbc96){return _0x5cbc96['destroy']()[_0x5147('0x15')](function(){var _0x36f0ec=_0x5cbc96[_0x5147('0x16')]({'plain':!![]});var _0x2a783b='MailQueues';return db['UserProfileResource'][_0x5147('0x17')]({'where':{'type':_0x2a783b,'resourceId':_0x36f0ec['id']}})[_0x5147('0x15')](function(){return _0x5cbc96;});})['then'](function(){_0x3dcafb[_0x5147('0xd')](0xcc)[_0x5147('0x18')]();});}};}function handleEntityNotFound(_0xfabf51){return function(_0x44bc0d){if(!_0x44bc0d){_0xfabf51['sendStatus'](0x194);}return _0x44bc0d;};}function handleError(_0x1fe71,_0x36d4e5){_0x36d4e5=_0x36d4e5||0x1f4;return function(_0x593ad8){logger[_0x5147('0x19')](_0x593ad8[_0x5147('0x1a')]);if(_0x593ad8[_0x5147('0x1b')]){delete _0x593ad8[_0x5147('0x1b')];}_0x1fe71[_0x5147('0xd')](_0x36d4e5)[_0x5147('0x1c')](_0x593ad8);};}exports[_0x5147('0x1d')]=function(_0x3f6fff,_0x3223c2){var _0x450006={};var _0x2b0977={'count':0x0,'rows':[]};var _0x3955f8=_[_0x5147('0x1e')](db[_0x5147('0x1f')][_0x5147('0x20')],function(_0xab1c71){return{'name':_0xab1c71[_0x5147('0x21')],'type':_0xab1c71[_0x5147('0x22')][_0x5147('0x23')]};});_0x450006=qs['getOptions'](_0x3955f8,_0x3f6fff);var _0x5298d8={'where':_0x450006[_0x5147('0x24')]};return db[_0x5147('0x1f')]['count'](_0x5298d8)[_0x5147('0x15')](function(_0x2729c6){_0x2b0977[_0x5147('0x11')]=_0x2729c6;_0x450006['include']=qs[_0x5147('0x25')](_0x3f6fff['query']);return db[_0x5147('0x1f')][_0x5147('0x26')](_0x450006);})[_0x5147('0x15')](function(_0x2b98e8){_0x2b0977[_0x5147('0x27')]=_0x2b98e8;return _0x2b0977;})[_0x5147('0x15')](respondWithFilteredResult(_0x3223c2,_0x450006))[_0x5147('0x28')](handleError(_0x3223c2,null));};exports[_0x5147('0x29')]=function(_0xfb9dae,_0x1c0930){var _0x3cb122={'raw':!![],'where':{'id':_0xfb9dae[_0x5147('0x2a')]['id']}},_0x2415e7={};_0x2415e7['model']=_[_0x5147('0x2b')](db['MailQueue']['rawAttributes']);_0x2415e7[_0x5147('0x2c')]=_[_0x5147('0x2b')](_0xfb9dae[_0x5147('0x2c')]);_0x2415e7[_0x5147('0x2d')]=_[_0x5147('0x2e')](_0x2415e7['model'],_0x2415e7[_0x5147('0x2c')]);_0x3cb122[_0x5147('0x2f')]=_[_0x5147('0x2e')](_0x2415e7[_0x5147('0x30')],qs['fields'](_0xfb9dae['query']['fields']));_0x3cb122['attributes']=_0x3cb122[_0x5147('0x2f')][_0x5147('0x31')]?_0x3cb122[_0x5147('0x2f')]:_0x2415e7[_0x5147('0x30')];if(_0xfb9dae[_0x5147('0x2c')][_0x5147('0x32')]){_0x3cb122[_0x5147('0x25')]=[{'all':!![]}];}_0x3cb122=_[_0x5147('0x33')]({},_0x3cb122,_0xfb9dae[_0x5147('0x34')]);return db[_0x5147('0x1f')][_0x5147('0x35')](_0x3cb122)['then'](handleEntityNotFound(_0x1c0930,null))[_0x5147('0x15')](respondWithResult(_0x1c0930,null))[_0x5147('0x28')](handleError(_0x1c0930,null));};exports[_0x5147('0x36')]=function(_0x204c02,_0x2be64e){return db[_0x5147('0x1f')][_0x5147('0x36')](_0x204c02[_0x5147('0x37')],{})[_0x5147('0x15')](function(_0xd5bfb4){var _0x4ee8b6=_0x204c02[_0x5147('0x38')][_0x5147('0x16')]({'plain':!![]});if(!_0x4ee8b6)throw new Error(_0x5147('0x39'));if(_0x4ee8b6[_0x5147('0x3a')]==='user'){var _0x100ab6=_0xd5bfb4[_0x5147('0x16')]({'plain':!![]});var _0x2323cd='MailQueues';return db[_0x5147('0x3b')][_0x5147('0x35')]({'where':{'name':_0x2323cd,'userProfileId':_0x4ee8b6[_0x5147('0x3c')]},'raw':!![]})[_0x5147('0x15')](function(_0x165c95){if(_0x165c95&&_0x165c95[_0x5147('0x3d')]===0x0){return db[_0x5147('0x3e')][_0x5147('0x36')]({'name':_0x100ab6['name'],'resourceId':_0x100ab6['id'],'type':_0x165c95['name'],'sectionId':_0x165c95['id']},{})[_0x5147('0x15')](function(){return _0xd5bfb4;});}else{return _0xd5bfb4;}})[_0x5147('0x28')](function(_0x55824d){logger[_0x5147('0x19')](_0x5147('0x3f'),_0x55824d);throw _0x55824d;});}return _0xd5bfb4;})[_0x5147('0x15')](respondWithResult(_0x2be64e,0xc9))[_0x5147('0x28')](handleError(_0x2be64e,null));};exports[_0x5147('0x14')]=function(_0x5e993c,_0x144c3e){if(_0x5e993c[_0x5147('0x37')]['id']){delete _0x5e993c[_0x5147('0x37')]['id'];}return db[_0x5147('0x1f')]['find']({'where':{'id':_0x5e993c['params']['id']}})[_0x5147('0x15')](handleEntityNotFound(_0x144c3e,null))[_0x5147('0x15')](saveUpdates(_0x5e993c[_0x5147('0x37')],null))[_0x5147('0x15')](respondWithResult(_0x144c3e,null))[_0x5147('0x28')](handleError(_0x144c3e,null));};exports[_0x5147('0x17')]=function(_0xe87530,_0x485a22){return db[_0x5147('0x1f')]['find']({'where':{'id':_0xe87530[_0x5147('0x2a')]['id']}})[_0x5147('0x15')](handleEntityNotFound(_0x485a22,null))['then'](removeEntity(_0x485a22,null))['catch'](handleError(_0x485a22,null));};exports[_0x5147('0x40')]=function(_0x5443c9,_0x2a2fbf){return db[_0x5147('0x1f')][_0x5147('0x40')]()[_0x5147('0x15')](respondWithResult(_0x2a2fbf,null))['catch'](handleError(_0x2a2fbf,null));};exports[_0x5147('0x41')]=function(_0x4071ff,_0x58db78){var _0x15c776={'raw':!![],'where':{}},_0x41d33b={},_0x24259c;return db[_0x5147('0x1f')][_0x5147('0x42')]({'where':{'id':_0x4071ff[_0x5147('0x2a')]['id']}})[_0x5147('0x15')](handleEntityNotFound(_0x58db78,null))[_0x5147('0x15')](function(_0x341063){if(_0x341063){_0x24259c=_0x341063[_0x5147('0x16')]({'plain':!![]});_0x41d33b[_0x5147('0x30')]=_['keys'](db[_0x5147('0x43')][_0x5147('0x20')]);_0x41d33b[_0x5147('0x2c')]=_[_0x5147('0x2b')](_0x4071ff['query']);_0x41d33b['filters']=_[_0x5147('0x2e')](_0x41d33b['model'],_0x41d33b[_0x5147('0x2c')]);_0x15c776['attributes']=_['intersection'](_0x41d33b[_0x5147('0x30')],qs['fields'](_0x4071ff[_0x5147('0x2c')][_0x5147('0x44')]));_0x15c776[_0x5147('0x2f')]=_0x15c776[_0x5147('0x2f')]['length']?_0x15c776['attributes']:_0x41d33b[_0x5147('0x30')];if(!_0x4071ff[_0x5147('0x2c')][_0x5147('0x45')](_0x5147('0x46'))){_0x15c776[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x4071ff[_0x5147('0x2c')][_0x5147('0x12')]);_0x15c776['offset']=qs[_0x5147('0xf')](_0x4071ff['query'][_0x5147('0xf')]);}_0x15c776['order']=qs[_0x5147('0x47')](_0x4071ff[_0x5147('0x2c')][_0x5147('0x47')]);_0x15c776['where']=qs['filters'](_[_0x5147('0x48')](_0x4071ff[_0x5147('0x2c')],_0x41d33b[_0x5147('0x2d')]));_0x15c776[_0x5147('0x24')]['MailQueueId']=_0x341063['id'];if(_0x4071ff[_0x5147('0x2c')][_0x5147('0x49')]){_0x15c776[_0x5147('0x24')]=_[_0x5147('0x33')](_0x15c776['where'],{'$or':_[_0x5147('0x1e')](_0x15c776['attributes'],function(_0x30e1d6){var _0x9bb857={};_0x9bb857[_0x30e1d6]={'$like':'%'+_0x4071ff[_0x5147('0x2c')][_0x5147('0x49')]+'%'};return _0x9bb857;})});}_0x15c776=_[_0x5147('0x33')]({},_0x15c776,_0x4071ff[_0x5147('0x34')]);return db[_0x5147('0x43')][_0x5147('0x26')](_0x15c776);}})[_0x5147('0x15')](function(_0x588024){if(_0x588024){return db['User'][_0x5147('0x4a')]({'where':{'id':_[_0x5147('0x1e')](_0x588024,_0x5147('0x4b')),'role':_0x5147('0x4c')},'attributes':['id',_0x5147('0x1b'),_0x5147('0x4d'),'updatedAt',_0x5147('0x4e')]});}})['then'](function(_0x252567){if(_0x252567){return{'count':_0x252567['count'],'rows':_['map'](_0x252567['rows'],function(_0x53cb7e){return{'membername':_0x53cb7e[_0x5147('0x1b')],'UserId':_0x53cb7e['id'],'queue_name':_0x24259c[_0x5147('0x1b')],'MailQueueId':_0x24259c['id'],'interface':util[_0x5147('0x4f')](_0x5147('0x50'),_0x5147('0x51'),_0x53cb7e[_0x5147('0x1b')]),'penalty':0x0,'paused':_0x53cb7e['mailPause'],'createdAt':_0x53cb7e[_0x5147('0x4e')],'updatedAt':_0x53cb7e[_0x5147('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5147('0x15')](respondWithFilteredResult(_0x58db78,_0x15c776))[_0x5147('0x28')](handleError(_0x58db78,null));};exports[_0x5147('0x53')]=function(_0x39ce94,_0x541688){var _0x57ce36={};var _0x55e5fe={};var _0x481269;var _0x2b0ca0;return db['MailQueue'][_0x5147('0x42')]({'where':{'id':_0x39ce94[_0x5147('0x2a')]['id']}})[_0x5147('0x15')](handleEntityNotFound(_0x541688,null))[_0x5147('0x15')](function(_0x44e91b){if(_0x44e91b){_0x481269=_0x44e91b;_0x55e5fe[_0x5147('0x30')]=_[_0x5147('0x2b')](db['Team'][_0x5147('0x20')]);_0x55e5fe[_0x5147('0x2c')]=_[_0x5147('0x2b')](_0x39ce94[_0x5147('0x2c')]);_0x55e5fe['filters']=_[_0x5147('0x2e')](_0x55e5fe[_0x5147('0x30')],_0x55e5fe[_0x5147('0x2c')]);_0x57ce36[_0x5147('0x2f')]=_[_0x5147('0x2e')](_0x55e5fe[_0x5147('0x30')],qs[_0x5147('0x44')](_0x39ce94[_0x5147('0x2c')]['fields']));_0x57ce36['attributes']=_0x57ce36[_0x5147('0x2f')]['length']?_0x57ce36[_0x5147('0x2f')]:_0x55e5fe['model'];_0x57ce36['order']=qs[_0x5147('0x47')](_0x39ce94['query']['sort']);_0x57ce36[_0x5147('0x24')]=qs['filters'](_['pick'](_0x39ce94[_0x5147('0x2c')],_0x55e5fe[_0x5147('0x2d')]));if(_0x39ce94[_0x5147('0x2c')][_0x5147('0x49')]){_0x57ce36[_0x5147('0x24')]=_[_0x5147('0x33')](_0x57ce36[_0x5147('0x24')],{'$or':_[_0x5147('0x1e')](_0x57ce36['attributes'],function(_0xccd96a){var _0x1ceffe={};_0x1ceffe[_0xccd96a]={'$like':'%'+_0x39ce94['query'][_0x5147('0x49')]+'%'};return _0x1ceffe;})});}_0x57ce36=_[_0x5147('0x33')]({},_0x57ce36,_0x39ce94[_0x5147('0x34')]);return _0x481269[_0x5147('0x53')](_0x57ce36);}})[_0x5147('0x15')](function(_0x2e72fa){if(_0x2e72fa){_0x2b0ca0=_0x2e72fa['length'];if(!_0x39ce94[_0x5147('0x2c')][_0x5147('0x45')](_0x5147('0x46'))){_0x57ce36[_0x5147('0x12')]=qs[_0x5147('0x12')](_0x39ce94[_0x5147('0x2c')][_0x5147('0x12')]);_0x57ce36[_0x5147('0xf')]=qs[_0x5147('0xf')](_0x39ce94[_0x5147('0x2c')][_0x5147('0xf')]);}return _0x481269['getTeams'](_0x57ce36);}})[_0x5147('0x15')](function(_0x242b11){if(_0x242b11){return _0x242b11?{'count':_0x2b0ca0,'rows':_0x242b11}:null;}})[_0x5147('0x15')](respondWithResult(_0x541688,null))[_0x5147('0x28')](handleError(_0x541688,null));};exports['addTeams']=function(_0x30fdb3,_0x2b8565){var _0x29a670=_0x30fdb3[_0x5147('0x37')][_0x5147('0x54')];return db[_0x5147('0x55')][_0x5147('0x26')]({'where':{'id':_0x29a670},'attributes':['id'],'include':[{'model':db[_0x5147('0x56')],'as':_0x5147('0x57'),'attributes':['id','name',_0x5147('0x58'),_0x5147('0x59'),'interface'],'raw':!![]}]})[_0x5147('0x15')](function(_0x5841fc){if(_0x5841fc){var _0x58589b=_['flatMap'](_0x5841fc,function(_0x494b75){var _0x58438e=_0x494b75['get']({'plain':!![]});return _0x58438e[_0x5147('0x57')];});return db[_0x5147('0x1f')]['find']({'where':{'id':_0x30fdb3[_0x5147('0x2a')]['id']}})[_0x5147('0x15')](function(_0x4f6ab9){return db[_0x5147('0x5a')][_0x5147('0x5b')](function(_0x25c05a){return _0x4f6ab9[_0x5147('0x5c')](_0x29a670,{'transaction':_0x25c05a})[_0x5147('0x15')](function(){return BPromise[_0x5147('0x5d')](_0x58589b,function(_0x33163f){return db[_0x5147('0x43')][_0x5147('0x5e')]({'where':{'UserId':_0x33163f['id'],'MailQueueId':_0x30fdb3[_0x5147('0x2a')]['id']},'transaction':_0x25c05a});});})[_0x5147('0x15')](function(){_0x58589b[_0x5147('0x5f')](function(_0x125666){socket[_0x5147('0x60')]('userMailQueue:save',{'UserId':_0x125666['id'],'MailQueueId':_0x4f6ab9['id']});});});});});}})[_0x5147('0x15')](respondWithStatusCode(_0x2b8565,null))[_0x5147('0x28')](handleError(_0x2b8565,null));};exports['removeTeams']=function(_0x16c124,_0x374a78){return db['Team']['findAll']({'where':{'id':_0x16c124['query'][_0x5147('0x54')]},'attributes':['id'],'include':[{'model':db[_0x5147('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5147('0x15')](handleEntityNotFound(_0x374a78,null))[_0x5147('0x15')](function(_0x6512){var _0x5570ac=_['map'](_0x6512,'id');var _0x39b70d=[];var _0x4d4897=[];var _0x3ddd59=squel[_0x5147('0x61')]();_0x3ddd59[_0x5147('0x62')]('tq.TeamId')[_0x5147('0x63')]('team_has_mail_queues','tq')[_0x5147('0x64')](_0x5147('0x65'),'ut',_0x5147('0x66'))['where'](_0x5147('0x67'),_0x16c124['params']['id']);for(var _0x14dea1=0x0;_0x14dea1<_0x6512['length'];_0x14dea1+=0x1){let _0xb24d60=_0x6512[_0x14dea1];for(var _0x919a97=0x0;_0x919a97<_0xb24d60['Agents'][_0x5147('0x31')];_0x919a97+=0x1){let _0x3c2265=_0xb24d60[_0x5147('0x57')][_0x919a97];var _0x15995e=_0x3ddd59['clone']();_0x15995e[_0x5147('0x24')](_0x5147('0x68'),_0x3c2265['id']);_0x4d4897[_0x5147('0x69')](db['sequelize'][_0x5147('0x2c')](_0x15995e[_0x5147('0x6a')](),{'type':db['sequelize'][_0x5147('0x6b')][_0x5147('0x6c')]})['then'](function(_0x433ff9){if(_0x433ff9[_0x5147('0x31')]===0x1){return _0x3c2265['id'];}else{var _0x3fbf7d=_[_0x5147('0x6d')](_[_0x5147('0x1e')](_0x433ff9,_0x5147('0x6e')),function(_0x508f2f){return _['includes'](_0x5570ac,_0x508f2f);});if(_0x3fbf7d){return _0x3c2265['id'];}}}));}}return BPromise['all'](_0x4d4897)[_0x5147('0x15')](function(_0x4e53aa){_0x39b70d=_(_0x39b70d)[_0x5147('0x6f')](_0x4e53aa)[_0x5147('0x70')]()['value']();return db[_0x5147('0x1f')][_0x5147('0x35')]({'where':{'id':_0x16c124['params']['id']}})[_0x5147('0x15')](function(_0x145da9){return db[_0x5147('0x5a')][_0x5147('0x5b')](function(_0x550ac8){return _0x145da9[_0x5147('0x71')](_0x16c124[_0x5147('0x2c')][_0x5147('0x54')],{'transaction':_0x550ac8})[_0x5147('0x15')](function(){if(!_[_0x5147('0x72')](_0x39b70d)){return _0x145da9[_0x5147('0x73')](_0x39b70d,{'transaction':_0x550ac8});}})[_0x5147('0x15')](function(){_0x39b70d['forEach'](function(_0x5a148f){socket[_0x5147('0x60')]('userMailQueue:remove',{'UserId':_0x5a148f,'MailQueueId':_0x145da9['id']});});});});});});})[_0x5147('0x15')](respondWithStatusCode(_0x374a78,null))[_0x5147('0x28')](handleError(_0x374a78,null));};exports[_0x5147('0x74')]=function(_0x10b534,_0x36627c){return db[_0x5147('0x1f')]['find']({'where':{'id':_0x10b534[_0x5147('0x2a')]['id']}})[_0x5147('0x15')](handleEntityNotFound(_0x36627c,null))[_0x5147('0x15')](function(_0x54b41c){if(_0x54b41c){return _0x54b41c[_0x5147('0x74')](_0x10b534[_0x5147('0x37')]['ids'],_[_0x5147('0x75')](_0x10b534[_0x5147('0x37')],[_0x5147('0x54'),'id'])||{})['spread'](function(_0x18fe9d){for(var _0x342578=0x0;_0x342578<_0x10b534['body'][_0x5147('0x54')]['length'];_0x342578+=0x1){socket[_0x5147('0x60')](_0x5147('0x76'),{'UserId':Number(_0x10b534['body'][_0x5147('0x54')][_0x342578]),'MailQueueId':Number(_0x10b534['params']['id'])});}return _0x18fe9d;});}})[_0x5147('0x15')](respondWithResult(_0x36627c,null))[_0x5147('0x28')](handleError(_0x36627c,null));};exports[_0x5147('0x73')]=function(_0x4fc722,_0x26affc){return db[_0x5147('0x1f')][_0x5147('0x35')]({'where':{'id':_0x4fc722[_0x5147('0x2a')]['id']}})['then'](handleEntityNotFound(_0x26affc,null))[_0x5147('0x15')](function(_0x3878f8){if(_0x3878f8){return _0x3878f8[_0x5147('0x73')](_0x4fc722[_0x5147('0x2c')]['ids'])[_0x5147('0x15')](function(){if(_[_0x5147('0x77')](_0x4fc722['query'][_0x5147('0x54')])){for(var _0x16aab3=0x0;_0x16aab3<_0x4fc722[_0x5147('0x2c')][_0x5147('0x54')][_0x5147('0x31')];_0x16aab3+=0x1){socket[_0x5147('0x60')](_0x5147('0x78'),{'UserId':Number(_0x4fc722[_0x5147('0x2c')][_0x5147('0x54')][_0x16aab3]),'MailQueueId':Number(_0x4fc722['params']['id'])});}}else{socket[_0x5147('0x60')](_0x5147('0x78'),{'UserId':Number(_0x4fc722[_0x5147('0x2c')][_0x5147('0x54')]),'MailQueueId':Number(_0x4fc722[_0x5147('0x2a')]['id'])});}});}})[_0x5147('0x15')](respondWithStatusCode(_0x26affc,null))[_0x5147('0x28')](handleError(_0x26affc,null));};exports[_0x5147('0x79')]=function(_0x2defac,_0x32b527){var _0x34a6f6={};var _0x550576={};var _0x474b79;var _0x53bb20;return db[_0x5147('0x1f')][_0x5147('0x42')]({'where':{'id':_0x2defac[_0x5147('0x2a')]['id']}})['then'](handleEntityNotFound(_0x32b527,null))[_0x5147('0x15')](function(_0x196680){if(_0x196680){_0x474b79=_0x196680;_0x550576[_0x5147('0x30')]=_[_0x5147('0x2b')](db['User'][_0x5147('0x20')]);_0x550576['query']=_[_0x5147('0x2b')](_0x2defac[_0x5147('0x2c')]);_0x550576[_0x5147('0x2d')]=_[_0x5147('0x2e')](_0x550576[_0x5147('0x30')],_0x550576[_0x5147('0x2c')]);_0x34a6f6[_0x5147('0x2f')]=_['intersection'](_0x550576[_0x5147('0x30')],qs[_0x5147('0x44')](_0x2defac[_0x5147('0x2c')][_0x5147('0x44')]));_0x34a6f6[_0x5147('0x2f')]=_0x34a6f6[_0x5147('0x2f')][_0x5147('0x31')]?_0x34a6f6[_0x5147('0x2f')]:_0x550576[_0x5147('0x30')];_0x34a6f6[_0x5147('0x7a')]=qs[_0x5147('0x47')](_0x2defac[_0x5147('0x2c')][_0x5147('0x47')]);_0x34a6f6[_0x5147('0x24')]=qs[_0x5147('0x2d')](_[_0x5147('0x48')](_0x2defac[_0x5147('0x2c')],_0x550576['filters']));if(_0x2defac['query'][_0x5147('0x49')]){_0x34a6f6[_0x5147('0x24')]=_['merge'](_0x34a6f6['where'],{'$or':_[_0x5147('0x1e')](_0x34a6f6[_0x5147('0x2f')],function(_0x4b20b7){var _0x252781={};_0x252781[_0x4b20b7]={'$like':'%'+_0x2defac[_0x5147('0x2c')][_0x5147('0x49')]+'%'};return _0x252781;})});}_0x34a6f6=_[_0x5147('0x33')]({},_0x34a6f6,_0x2defac[_0x5147('0x34')]);return _0x474b79['getAgents'](_0x34a6f6);}})[_0x5147('0x15')](function(_0x1dcf60){if(_0x1dcf60){_0x53bb20=_0x1dcf60[_0x5147('0x31')];if(!_0x2defac[_0x5147('0x2c')][_0x5147('0x45')](_0x5147('0x46'))){_0x34a6f6[_0x5147('0x12')]=qs['limit'](_0x2defac[_0x5147('0x2c')]['limit']);_0x34a6f6[_0x5147('0xf')]=qs[_0x5147('0xf')](_0x2defac[_0x5147('0x2c')][_0x5147('0xf')]);}return _0x474b79['getAgents'](_0x34a6f6);}})[_0x5147('0x15')](function(_0x34b0f6){if(_0x34b0f6){return _0x34b0f6?{'count':_0x53bb20,'rows':_0x34b0f6}:null;}})[_0x5147('0x15')](respondWithResult(_0x32b527,null))[_0x5147('0x28')](handleError(_0x32b527,null));}; \ No newline at end of file +var _0x7a36=['user_has_teams','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','union','value','removeAgents','addAgents','omit','ids','userMailQueue:save','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','MailQueue','fieldName','type','key','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','map','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','removeTeams','select','field','team_has_mail_queues','join'];(function(_0x1ef047,_0x524d7a){var _0x3f5b1c=function(_0x503025){while(--_0x503025){_0x1ef047['push'](_0x1ef047['shift']());}};_0x3f5b1c(++_0x524d7a);}(_0x7a36,0x17c));var _0x67a3=function(_0x540fc3,_0x4d39ad){_0x540fc3=_0x540fc3-0x0;var _0xbb72c9=_0x7a36[_0x540fc3];return _0xbb72c9;};'use strict';var BPromise=require(_0x67a3('0x0'));var util=require(_0x67a3('0x1'));var _=require(_0x67a3('0x2'));var squel=require(_0x67a3('0x3'));var Redis=require(_0x67a3('0x4'));var qs=require(_0x67a3('0x5'));var logger=require(_0x67a3('0x6'))(_0x67a3('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x67a3('0x8')]=_[_0x67a3('0x9')](config[_0x67a3('0x8')],{'host':_0x67a3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x67a3('0xb'))[_0x67a3('0xc')](socket);function respondWithStatusCode(_0x2dadd3,_0x412b09){_0x412b09=_0x412b09||0xcc;return function(_0x31a6fd){if(_0x31a6fd){return _0x2dadd3[_0x67a3('0xd')](_0x412b09);}return _0x2dadd3[_0x67a3('0xe')](_0x412b09)[_0x67a3('0xf')]();};}function respondWithResult(_0x3e6b5c,_0x59d932){_0x59d932=_0x59d932||0xc8;return function(_0x39b7ea){if(_0x39b7ea){return _0x3e6b5c[_0x67a3('0xe')](_0x59d932)[_0x67a3('0x10')](_0x39b7ea);}};}function respondWithFilteredResult(_0xfec208,_0x3d0c9f){return function(_0x2cd1f2){if(_0x2cd1f2){var _0x181f5a=typeof _0x3d0c9f[_0x67a3('0x11')]==='undefined'&&typeof _0x3d0c9f[_0x67a3('0x12')]===_0x67a3('0x13');var _0x5637e7=_0x2cd1f2['count'];var _0x38ca70=_0x181f5a?0x0:_0x3d0c9f[_0x67a3('0x11')];var _0x5d0670=_0x181f5a?_0x2cd1f2[_0x67a3('0x14')]:_0x3d0c9f['offset']+_0x3d0c9f[_0x67a3('0x12')];var _0x1f770e;if(_0x5d0670>=_0x5637e7){_0x5d0670=_0x5637e7;_0x1f770e=0xc8;}else{_0x1f770e=0xce;}_0xfec208[_0x67a3('0xe')](_0x1f770e);return _0xfec208[_0x67a3('0x15')](_0x67a3('0x16'),_0x38ca70+'-'+_0x5d0670+'/'+_0x5637e7)[_0x67a3('0x10')](_0x2cd1f2);}return null;};}function saveUpdates(_0x2c8df3){return function(_0x247809){if(_0x247809){return _0x247809['update'](_0x2c8df3)[_0x67a3('0x17')](function(_0x5858d0){return _0x5858d0;});}return null;};}function removeEntity(_0x499982){return function(_0x1e39fe){if(_0x1e39fe){return _0x1e39fe['destroy']()[_0x67a3('0x17')](function(){var _0x3a1abb=_0x1e39fe['get']({'plain':!![]});var _0x183b35=_0x67a3('0x18');return db[_0x67a3('0x19')][_0x67a3('0x1a')]({'where':{'type':_0x183b35,'resourceId':_0x3a1abb['id']}})[_0x67a3('0x17')](function(){return _0x1e39fe;});})[_0x67a3('0x17')](function(){_0x499982[_0x67a3('0xe')](0xcc)[_0x67a3('0xf')]();});}};}function handleEntityNotFound(_0x21204c){return function(_0x2c9540){if(!_0x2c9540){_0x21204c[_0x67a3('0xd')](0x194);}return _0x2c9540;};}function handleError(_0x581059,_0x527683){_0x527683=_0x527683||0x1f4;return function(_0xdca744){logger[_0x67a3('0x1b')](_0xdca744[_0x67a3('0x1c')]);if(_0xdca744[_0x67a3('0x1d')]){delete _0xdca744[_0x67a3('0x1d')];}_0x581059[_0x67a3('0xe')](_0x527683)[_0x67a3('0x1e')](_0xdca744);};}exports[_0x67a3('0x1f')]=function(_0x1a2c67,_0x4392d6){var _0x57d3ac={};var _0x5ecf2a={'count':0x0,'rows':[]};var _0x117b34=_['map'](db[_0x67a3('0x20')]['rawAttributes'],function(_0x1af963){return{'name':_0x1af963[_0x67a3('0x21')],'type':_0x1af963[_0x67a3('0x22')][_0x67a3('0x23')]};});_0x57d3ac=qs['getOptions'](_0x117b34,_0x1a2c67);var _0x2a4196={'where':_0x57d3ac[_0x67a3('0x24')]};return db[_0x67a3('0x20')]['count'](_0x2a4196)[_0x67a3('0x17')](function(_0x11a122){_0x5ecf2a[_0x67a3('0x14')]=_0x11a122;_0x57d3ac[_0x67a3('0x25')]=qs['include'](_0x1a2c67[_0x67a3('0x26')]);return db[_0x67a3('0x20')][_0x67a3('0x27')](_0x57d3ac);})[_0x67a3('0x17')](function(_0xe65290){_0x5ecf2a[_0x67a3('0x28')]=_0xe65290;return _0x5ecf2a;})[_0x67a3('0x17')](respondWithFilteredResult(_0x4392d6,_0x57d3ac))[_0x67a3('0x29')](handleError(_0x4392d6,null));};exports['show']=function(_0x1e6ea0,_0x42d3ab){var _0x26d629={'raw':!![],'where':{'id':_0x1e6ea0[_0x67a3('0x2a')]['id']}},_0x41bd50={};_0x41bd50[_0x67a3('0x2b')]=_[_0x67a3('0x2c')](db['MailQueue'][_0x67a3('0x2d')]);_0x41bd50[_0x67a3('0x26')]=_[_0x67a3('0x2c')](_0x1e6ea0[_0x67a3('0x26')]);_0x41bd50[_0x67a3('0x2e')]=_[_0x67a3('0x2f')](_0x41bd50[_0x67a3('0x2b')],_0x41bd50[_0x67a3('0x26')]);_0x26d629[_0x67a3('0x30')]=_[_0x67a3('0x2f')](_0x41bd50[_0x67a3('0x2b')],qs[_0x67a3('0x31')](_0x1e6ea0[_0x67a3('0x26')][_0x67a3('0x31')]));_0x26d629[_0x67a3('0x30')]=_0x26d629[_0x67a3('0x30')]['length']?_0x26d629['attributes']:_0x41bd50[_0x67a3('0x2b')];if(_0x1e6ea0[_0x67a3('0x26')][_0x67a3('0x32')]){_0x26d629['include']=[{'all':!![]}];}_0x26d629=_[_0x67a3('0x33')]({},_0x26d629,_0x1e6ea0[_0x67a3('0x34')]);return db[_0x67a3('0x20')]['find'](_0x26d629)['then'](handleEntityNotFound(_0x42d3ab,null))[_0x67a3('0x17')](respondWithResult(_0x42d3ab,null))[_0x67a3('0x29')](handleError(_0x42d3ab,null));};exports[_0x67a3('0x35')]=function(_0x8ef641,_0x20ba67){return db['MailQueue'][_0x67a3('0x35')](_0x8ef641[_0x67a3('0x36')],{})[_0x67a3('0x17')](function(_0x3dc8c3){var _0x2f976d=_0x8ef641[_0x67a3('0x37')][_0x67a3('0x38')]({'plain':!![]});if(!_0x2f976d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f976d[_0x67a3('0x39')]===_0x67a3('0x37')){var _0x8b4db6=_0x3dc8c3[_0x67a3('0x38')]({'plain':!![]});var _0x432301=_0x67a3('0x18');return db[_0x67a3('0x3a')][_0x67a3('0x3b')]({'where':{'name':_0x432301,'userProfileId':_0x2f976d[_0x67a3('0x3c')]},'raw':!![]})[_0x67a3('0x17')](function(_0x37c020){if(_0x37c020&&_0x37c020[_0x67a3('0x3d')]===0x0){return db[_0x67a3('0x19')][_0x67a3('0x35')]({'name':_0x8b4db6[_0x67a3('0x1d')],'resourceId':_0x8b4db6['id'],'type':_0x37c020[_0x67a3('0x1d')],'sectionId':_0x37c020['id']},{})[_0x67a3('0x17')](function(){return _0x3dc8c3;});}else{return _0x3dc8c3;}})['catch'](function(_0x1208ac){logger['error'](_0x67a3('0x3e'),_0x1208ac);throw _0x1208ac;});}return _0x3dc8c3;})[_0x67a3('0x17')](respondWithResult(_0x20ba67,0xc9))[_0x67a3('0x29')](handleError(_0x20ba67,null));};exports[_0x67a3('0x3f')]=function(_0xa6d0d5,_0x3bc929){if(_0xa6d0d5['body']['id']){delete _0xa6d0d5[_0x67a3('0x36')]['id'];}return db['MailQueue'][_0x67a3('0x3b')]({'where':{'id':_0xa6d0d5['params']['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0x3bc929,null))[_0x67a3('0x17')](saveUpdates(_0xa6d0d5[_0x67a3('0x36')],null))[_0x67a3('0x17')](respondWithResult(_0x3bc929,null))[_0x67a3('0x29')](handleError(_0x3bc929,null));};exports[_0x67a3('0x1a')]=function(_0xcb3490,_0x599acd){return db[_0x67a3('0x20')][_0x67a3('0x3b')]({'where':{'id':_0xcb3490[_0x67a3('0x2a')]['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0x599acd,null))[_0x67a3('0x17')](removeEntity(_0x599acd,null))['catch'](handleError(_0x599acd,null));};exports[_0x67a3('0x40')]=function(_0x518bfb,_0x23e796){return db[_0x67a3('0x20')][_0x67a3('0x40')]()['then'](respondWithResult(_0x23e796,null))['catch'](handleError(_0x23e796,null));};exports[_0x67a3('0x41')]=function(_0x1524d9,_0xb1277d){var _0x3a87b9={'raw':!![],'where':{}},_0x87ffb7={},_0x4c6798;return db[_0x67a3('0x20')][_0x67a3('0x42')]({'where':{'id':_0x1524d9['params']['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0xb1277d,null))[_0x67a3('0x17')](function(_0x561812){if(_0x561812){_0x4c6798=_0x561812[_0x67a3('0x38')]({'plain':!![]});_0x87ffb7[_0x67a3('0x2b')]=_[_0x67a3('0x2c')](db[_0x67a3('0x43')][_0x67a3('0x2d')]);_0x87ffb7[_0x67a3('0x26')]=_[_0x67a3('0x2c')](_0x1524d9[_0x67a3('0x26')]);_0x87ffb7[_0x67a3('0x2e')]=_[_0x67a3('0x2f')](_0x87ffb7['model'],_0x87ffb7[_0x67a3('0x26')]);_0x3a87b9['attributes']=_['intersection'](_0x87ffb7[_0x67a3('0x2b')],qs['fields'](_0x1524d9['query'][_0x67a3('0x31')]));_0x3a87b9[_0x67a3('0x30')]=_0x3a87b9[_0x67a3('0x30')][_0x67a3('0x44')]?_0x3a87b9[_0x67a3('0x30')]:_0x87ffb7[_0x67a3('0x2b')];if(!_0x1524d9[_0x67a3('0x26')][_0x67a3('0x45')](_0x67a3('0x46'))){_0x3a87b9['limit']=qs['limit'](_0x1524d9[_0x67a3('0x26')][_0x67a3('0x12')]);_0x3a87b9[_0x67a3('0x11')]=qs['offset'](_0x1524d9[_0x67a3('0x26')][_0x67a3('0x11')]);}_0x3a87b9[_0x67a3('0x47')]=qs[_0x67a3('0x48')](_0x1524d9[_0x67a3('0x26')][_0x67a3('0x48')]);_0x3a87b9[_0x67a3('0x24')]=qs[_0x67a3('0x2e')](_[_0x67a3('0x49')](_0x1524d9['query'],_0x87ffb7[_0x67a3('0x2e')]));_0x3a87b9[_0x67a3('0x24')][_0x67a3('0x4a')]=_0x561812['id'];if(_0x1524d9[_0x67a3('0x26')][_0x67a3('0x4b')]){_0x3a87b9[_0x67a3('0x24')]=_[_0x67a3('0x33')](_0x3a87b9[_0x67a3('0x24')],{'$or':_[_0x67a3('0x4c')](_0x3a87b9[_0x67a3('0x30')],function(_0x5d2fe7){var _0x1a5b4e={};_0x1a5b4e[_0x5d2fe7]={'$like':'%'+_0x1524d9[_0x67a3('0x26')]['filter']+'%'};return _0x1a5b4e;})});}_0x3a87b9=_['merge']({},_0x3a87b9,_0x1524d9['options']);return db[_0x67a3('0x43')][_0x67a3('0x27')](_0x3a87b9);}})[_0x67a3('0x17')](function(_0x3e0139){if(_0x3e0139){return db[_0x67a3('0x4d')][_0x67a3('0x4e')]({'where':{'id':_[_0x67a3('0x4c')](_0x3e0139,_0x67a3('0x4f')),'role':_0x67a3('0x50')},'attributes':['id','name',_0x67a3('0x51'),_0x67a3('0x52'),_0x67a3('0x53')]});}})['then'](function(_0x47ab6c){if(_0x47ab6c){return{'count':_0x47ab6c['count'],'rows':_[_0x67a3('0x4c')](_0x47ab6c[_0x67a3('0x28')],function(_0x20aeeb){return{'membername':_0x20aeeb[_0x67a3('0x1d')],'UserId':_0x20aeeb['id'],'queue_name':_0x4c6798['name'],'MailQueueId':_0x4c6798['id'],'interface':util[_0x67a3('0x54')](_0x67a3('0x55'),_0x67a3('0x56'),_0x20aeeb[_0x67a3('0x1d')]),'penalty':0x0,'paused':_0x20aeeb[_0x67a3('0x51')],'createdAt':_0x20aeeb[_0x67a3('0x53')],'updatedAt':_0x20aeeb[_0x67a3('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x67a3('0x17')](respondWithFilteredResult(_0xb1277d,_0x3a87b9))[_0x67a3('0x29')](handleError(_0xb1277d,null));};exports[_0x67a3('0x57')]=function(_0x1c1fd9,_0x288879){var _0x4269e0={};var _0x169244={};var _0x4af59d;var _0x1d1579;return db[_0x67a3('0x20')]['findOne']({'where':{'id':_0x1c1fd9[_0x67a3('0x2a')]['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0x288879,null))[_0x67a3('0x17')](function(_0x12f9cd){if(_0x12f9cd){_0x4af59d=_0x12f9cd;_0x169244[_0x67a3('0x2b')]=_[_0x67a3('0x2c')](db[_0x67a3('0x58')][_0x67a3('0x2d')]);_0x169244[_0x67a3('0x26')]=_[_0x67a3('0x2c')](_0x1c1fd9[_0x67a3('0x26')]);_0x169244['filters']=_[_0x67a3('0x2f')](_0x169244['model'],_0x169244[_0x67a3('0x26')]);_0x4269e0[_0x67a3('0x30')]=_[_0x67a3('0x2f')](_0x169244[_0x67a3('0x2b')],qs[_0x67a3('0x31')](_0x1c1fd9[_0x67a3('0x26')]['fields']));_0x4269e0[_0x67a3('0x30')]=_0x4269e0[_0x67a3('0x30')][_0x67a3('0x44')]?_0x4269e0[_0x67a3('0x30')]:_0x169244['model'];_0x4269e0[_0x67a3('0x47')]=qs[_0x67a3('0x48')](_0x1c1fd9[_0x67a3('0x26')][_0x67a3('0x48')]);_0x4269e0[_0x67a3('0x24')]=qs[_0x67a3('0x2e')](_[_0x67a3('0x49')](_0x1c1fd9[_0x67a3('0x26')],_0x169244[_0x67a3('0x2e')]));if(_0x1c1fd9[_0x67a3('0x26')][_0x67a3('0x4b')]){_0x4269e0[_0x67a3('0x24')]=_['merge'](_0x4269e0[_0x67a3('0x24')],{'$or':_[_0x67a3('0x4c')](_0x4269e0['attributes'],function(_0x5b7eb9){var _0x5beca0={};_0x5beca0[_0x5b7eb9]={'$like':'%'+_0x1c1fd9[_0x67a3('0x26')]['filter']+'%'};return _0x5beca0;})});}_0x4269e0=_[_0x67a3('0x33')]({},_0x4269e0,_0x1c1fd9[_0x67a3('0x34')]);return _0x4af59d[_0x67a3('0x57')](_0x4269e0);}})[_0x67a3('0x17')](function(_0xa5f297){if(_0xa5f297){_0x1d1579=_0xa5f297[_0x67a3('0x44')];if(!_0x1c1fd9['query']['hasOwnProperty'](_0x67a3('0x46'))){_0x4269e0[_0x67a3('0x12')]=qs[_0x67a3('0x12')](_0x1c1fd9['query'][_0x67a3('0x12')]);_0x4269e0[_0x67a3('0x11')]=qs[_0x67a3('0x11')](_0x1c1fd9[_0x67a3('0x26')][_0x67a3('0x11')]);}return _0x4af59d[_0x67a3('0x57')](_0x4269e0);}})[_0x67a3('0x17')](function(_0x19de40){if(_0x19de40){return _0x19de40?{'count':_0x1d1579,'rows':_0x19de40}:null;}})[_0x67a3('0x17')](respondWithResult(_0x288879,null))['catch'](handleError(_0x288879,null));};exports[_0x67a3('0x59')]=function(_0x146717,_0x34ca2f){var _0x52f21f=_0x146717[_0x67a3('0x36')]['ids'];return db[_0x67a3('0x58')]['findAll']({'where':{'id':_0x52f21f},'attributes':['id'],'include':[{'model':db[_0x67a3('0x4d')],'as':_0x67a3('0x5a'),'attributes':['id','name',_0x67a3('0x5b'),_0x67a3('0x5c'),_0x67a3('0x5d')],'raw':!![]}]})[_0x67a3('0x17')](function(_0x2c5fb7){if(_0x2c5fb7){var _0x3cbff7=_['flatMap'](_0x2c5fb7,function(_0x45c691){var _0x5b6481=_0x45c691[_0x67a3('0x38')]({'plain':!![]});return _0x5b6481['Agents'];});return db[_0x67a3('0x20')][_0x67a3('0x3b')]({'where':{'id':_0x146717['params']['id']}})['then'](function(_0x4c432e){return db[_0x67a3('0x5e')][_0x67a3('0x5f')](function(_0x4bcf36){return _0x4c432e['addTeams'](_0x52f21f,{'transaction':_0x4bcf36})[_0x67a3('0x17')](function(){return BPromise[_0x67a3('0x60')](_0x3cbff7,function(_0x2120e1){return db[_0x67a3('0x43')]['findOrCreate']({'where':{'UserId':_0x2120e1['id'],'MailQueueId':_0x146717['params']['id']},'transaction':_0x4bcf36});});})[_0x67a3('0x17')](function(){_0x3cbff7[_0x67a3('0x61')](function(_0x19e2d1){socket[_0x67a3('0x62')]('userMailQueue:save',{'UserId':_0x19e2d1['id'],'MailQueueId':_0x4c432e['id']});});});});});}})[_0x67a3('0x17')](respondWithStatusCode(_0x34ca2f,null))[_0x67a3('0x29')](handleError(_0x34ca2f,null));};exports[_0x67a3('0x63')]=function(_0x137913,_0x4bb1b9){return db[_0x67a3('0x58')][_0x67a3('0x27')]({'where':{'id':_0x137913[_0x67a3('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x67a3('0x4d')],'as':_0x67a3('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4bb1b9,null))['then'](function(_0xdbae9e){var _0x3e85bf=_['map'](_0xdbae9e,'id');var _0x588de5=[];var _0xb9b9d=[];var _0x1cde7b=squel[_0x67a3('0x64')]();_0x1cde7b[_0x67a3('0x65')]('tq.TeamId')['from'](_0x67a3('0x66'),'tq')[_0x67a3('0x67')](_0x67a3('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x67a3('0x24')](_0x67a3('0x69'),_0x137913[_0x67a3('0x2a')]['id']);for(var _0x4f58f0=0x0;_0x4f58f0<_0xdbae9e['length'];_0x4f58f0+=0x1){let _0xfde6f=_0xdbae9e[_0x4f58f0];for(var _0x528bf8=0x0;_0x528bf8<_0xfde6f[_0x67a3('0x5a')][_0x67a3('0x44')];_0x528bf8+=0x1){let _0x5be635=_0xfde6f['Agents'][_0x528bf8];var _0x5538ef=_0x1cde7b['clone']();_0x5538ef['where'](_0x67a3('0x6a'),_0x5be635['id']);_0xb9b9d[_0x67a3('0x6b')](db[_0x67a3('0x5e')][_0x67a3('0x26')](_0x5538ef[_0x67a3('0x6c')](),{'type':db[_0x67a3('0x5e')][_0x67a3('0x6d')]['SELECT']})[_0x67a3('0x17')](function(_0x221fd3){if(_0x221fd3[_0x67a3('0x44')]===0x1){return _0x5be635['id'];}else{var _0x446ebf=_['every'](_['map'](_0x221fd3,'TeamId'),function(_0x13bfd5){return _[_0x67a3('0x6e')](_0x3e85bf,_0x13bfd5);});if(_0x446ebf){return _0x5be635['id'];}}}));}}return BPromise['all'](_0xb9b9d)['then'](function(_0x4ce181){_0x588de5=_(_0x588de5)[_0x67a3('0x6f')](_0x4ce181)['compact']()[_0x67a3('0x70')]();return db[_0x67a3('0x20')]['find']({'where':{'id':_0x137913['params']['id']}})[_0x67a3('0x17')](function(_0x13e873){return db[_0x67a3('0x5e')][_0x67a3('0x5f')](function(_0x25f3a5){return _0x13e873['removeTeams'](_0x137913[_0x67a3('0x26')]['ids'],{'transaction':_0x25f3a5})[_0x67a3('0x17')](function(){if(!_['isEmpty'](_0x588de5)){return _0x13e873[_0x67a3('0x71')](_0x588de5,{'transaction':_0x25f3a5});}})[_0x67a3('0x17')](function(){_0x588de5[_0x67a3('0x61')](function(_0x48c8b6){socket[_0x67a3('0x62')]('userMailQueue:remove',{'UserId':_0x48c8b6,'MailQueueId':_0x13e873['id']});});});});});});})[_0x67a3('0x17')](respondWithStatusCode(_0x4bb1b9,null))[_0x67a3('0x29')](handleError(_0x4bb1b9,null));};exports[_0x67a3('0x72')]=function(_0x3f46ef,_0x4349f6){return db[_0x67a3('0x20')][_0x67a3('0x3b')]({'where':{'id':_0x3f46ef[_0x67a3('0x2a')]['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0x4349f6,null))['then'](function(_0x582925){if(_0x582925){return _0x582925[_0x67a3('0x72')](_0x3f46ef['body']['ids'],_[_0x67a3('0x73')](_0x3f46ef[_0x67a3('0x36')],[_0x67a3('0x74'),'id'])||{})['spread'](function(_0x339e4f){for(var _0x19de4a=0x0;_0x19de4a<_0x3f46ef['body']['ids'][_0x67a3('0x44')];_0x19de4a+=0x1){socket['emit'](_0x67a3('0x75'),{'UserId':Number(_0x3f46ef['body']['ids'][_0x19de4a]),'MailQueueId':Number(_0x3f46ef[_0x67a3('0x2a')]['id'])});}return _0x339e4f;});}})[_0x67a3('0x17')](respondWithResult(_0x4349f6,null))[_0x67a3('0x29')](handleError(_0x4349f6,null));};exports[_0x67a3('0x71')]=function(_0x263398,_0x12f50b){return db['MailQueue'][_0x67a3('0x3b')]({'where':{'id':_0x263398[_0x67a3('0x2a')]['id']}})[_0x67a3('0x17')](handleEntityNotFound(_0x12f50b,null))[_0x67a3('0x17')](function(_0x8e9cb2){if(_0x8e9cb2){return _0x8e9cb2['removeAgents'](_0x263398['query'][_0x67a3('0x74')])[_0x67a3('0x17')](function(){if(_[_0x67a3('0x76')](_0x263398[_0x67a3('0x26')]['ids'])){for(var _0xf6e772=0x0;_0xf6e772<_0x263398[_0x67a3('0x26')]['ids'][_0x67a3('0x44')];_0xf6e772+=0x1){socket[_0x67a3('0x62')](_0x67a3('0x77'),{'UserId':Number(_0x263398[_0x67a3('0x26')]['ids'][_0xf6e772]),'MailQueueId':Number(_0x263398['params']['id'])});}}else{socket[_0x67a3('0x62')](_0x67a3('0x77'),{'UserId':Number(_0x263398[_0x67a3('0x26')][_0x67a3('0x74')]),'MailQueueId':Number(_0x263398[_0x67a3('0x2a')]['id'])});}});}})[_0x67a3('0x17')](respondWithStatusCode(_0x12f50b,null))[_0x67a3('0x29')](handleError(_0x12f50b,null));};exports['getAgents']=function(_0x3fcb29,_0x45e798){var _0x48b833={};var _0x49f292={};var _0x45d20e;var _0x2ed50a;return db[_0x67a3('0x20')][_0x67a3('0x42')]({'where':{'id':_0x3fcb29[_0x67a3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x45e798,null))[_0x67a3('0x17')](function(_0x1460ad){if(_0x1460ad){_0x45d20e=_0x1460ad;_0x49f292[_0x67a3('0x2b')]=_[_0x67a3('0x2c')](db[_0x67a3('0x4d')][_0x67a3('0x2d')]);_0x49f292[_0x67a3('0x26')]=_['keys'](_0x3fcb29[_0x67a3('0x26')]);_0x49f292[_0x67a3('0x2e')]=_[_0x67a3('0x2f')](_0x49f292[_0x67a3('0x2b')],_0x49f292[_0x67a3('0x26')]);_0x48b833['attributes']=_[_0x67a3('0x2f')](_0x49f292[_0x67a3('0x2b')],qs['fields'](_0x3fcb29[_0x67a3('0x26')][_0x67a3('0x31')]));_0x48b833[_0x67a3('0x30')]=_0x48b833[_0x67a3('0x30')]['length']?_0x48b833['attributes']:_0x49f292['model'];_0x48b833[_0x67a3('0x47')]=qs[_0x67a3('0x48')](_0x3fcb29[_0x67a3('0x26')][_0x67a3('0x48')]);_0x48b833[_0x67a3('0x24')]=qs['filters'](_[_0x67a3('0x49')](_0x3fcb29[_0x67a3('0x26')],_0x49f292[_0x67a3('0x2e')]));if(_0x3fcb29[_0x67a3('0x26')][_0x67a3('0x4b')]){_0x48b833[_0x67a3('0x24')]=_[_0x67a3('0x33')](_0x48b833['where'],{'$or':_[_0x67a3('0x4c')](_0x48b833[_0x67a3('0x30')],function(_0x2866ca){var _0x1b4b77={};_0x1b4b77[_0x2866ca]={'$like':'%'+_0x3fcb29[_0x67a3('0x26')]['filter']+'%'};return _0x1b4b77;})});}_0x48b833=_[_0x67a3('0x33')]({},_0x48b833,_0x3fcb29[_0x67a3('0x34')]);return _0x45d20e[_0x67a3('0x78')](_0x48b833);}})[_0x67a3('0x17')](function(_0x4fed89){if(_0x4fed89){_0x2ed50a=_0x4fed89[_0x67a3('0x44')];if(!_0x3fcb29[_0x67a3('0x26')][_0x67a3('0x45')](_0x67a3('0x46'))){_0x48b833[_0x67a3('0x12')]=qs[_0x67a3('0x12')](_0x3fcb29['query'][_0x67a3('0x12')]);_0x48b833[_0x67a3('0x11')]=qs['offset'](_0x3fcb29['query'][_0x67a3('0x11')]);}return _0x45d20e[_0x67a3('0x78')](_0x48b833);}})[_0x67a3('0x17')](function(_0x2a7bc6){if(_0x2a7bc6){return _0x2a7bc6?{'count':_0x2ed50a,'rows':_0x2a7bc6}:null;}})['then'](respondWithResult(_0x45e798,null))[_0x67a3('0x29')](handleError(_0x45e798,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index aa213c6..a4efe62 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 _0x734f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x2907b1,_0x22dce5){var _0xfbbc79=function(_0x5f0623){while(--_0x5f0623){_0x2907b1['push'](_0x2907b1['shift']());}};_0xfbbc79(++_0x22dce5);}(_0x734f,0x11c));var _0xf734=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x734f[_0x510c60];return _0x49c4aa;};'use strict';var EventEmitter=require(_0xf734('0x0'));var MailQueue=require(_0xf734('0x1'))['db'][_0xf734('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf734('0x3')](0x0);var events={'afterCreate':_0xf734('0x4'),'afterUpdate':_0xf734('0x5'),'afterDestroy':_0xf734('0x6')};function emitEvent(_0xf4c5cc){return function(_0x491ea2,_0x677661,_0x2c156f){MailQueueEvents[_0xf734('0x7')](_0xf4c5cc+':'+_0x491ea2['id'],_0x491ea2);MailQueueEvents[_0xf734('0x7')](_0xf4c5cc,_0x491ea2);_0x2c156f(null);};}for(var e in events){if(events[_0xf734('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf734('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xb7c5=['../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4f217f,_0x313163){var _0x3b583a=function(_0x334971){while(--_0x334971){_0x4f217f['push'](_0x4f217f['shift']());}};_0x3b583a(++_0x313163);}(_0xb7c5,0xa9));var _0x5b7c=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0xb7c5[_0x3a723e];return _0x3e9c03;};'use strict';var EventEmitter=require(_0x5b7c('0x0'));var MailQueue=require(_0x5b7c('0x1'))['db'][_0x5b7c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5b7c('0x3')](0x0);var events={'afterCreate':_0x5b7c('0x4'),'afterUpdate':'update','afterDestroy':_0x5b7c('0x5')};function emitEvent(_0x5ba938){return function(_0x325d15,_0x5e9cc1,_0x121419){MailQueueEvents[_0x5b7c('0x6')](_0x5ba938+':'+_0x325d15['id'],_0x325d15);MailQueueEvents[_0x5b7c('0x6')](_0x5ba938,_0x325d15);_0x121419(null);};}for(var e in events){if(events[_0x5b7c('0x7')](e)){var event=events[e];MailQueue[_0x5b7c('0x8')](e,emitEvent(event));}}module[_0x5b7c('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4e4f5cb..6c37559 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 _0x975a=['moment','bluebird','request-promise','path','rimraf','exports','define','MailQueue','mail_queues','lodash','util'];(function(_0x2b49aa,_0x4cfd04){var _0x23b6a3=function(_0x4a11d0){while(--_0x4a11d0){_0x2b49aa['push'](_0x2b49aa['shift']());}};_0x23b6a3(++_0x4cfd04);}(_0x975a,0x82));var _0xa975=function(_0x38e43b,_0x7f2e95){_0x38e43b=_0x38e43b-0x0;var _0x474887=_0x975a[_0x38e43b];return _0x474887;};'use strict';var _=require(_0xa975('0x0'));var util=require(_0xa975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa975('0x2'));var BPromise=require(_0xa975('0x3'));var rp=require(_0xa975('0x4'));var fs=require('fs');var path=require(_0xa975('0x5'));var rimraf=require(_0xa975('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xa975('0x7')]=function(_0x29dc98,_0x43a36d){return _0x29dc98[_0xa975('0x8')](_0xa975('0x9'),attributes,{'tableName':_0xa975('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88ed=['lodash','request-promise','rimraf','exports','define','MailQueue','mail_queues'];(function(_0x45aadc,_0x4230d1){var _0x2d2b01=function(_0x1b4f00){while(--_0x1b4f00){_0x45aadc['push'](_0x45aadc['shift']());}};_0x2d2b01(++_0x4230d1);}(_0x88ed,0x10a));var _0xd88e=function(_0x457cbb,_0x33e330){_0x457cbb=_0x457cbb-0x0;var _0x4bb6bf=_0x88ed[_0x457cbb];return _0x4bb6bf;};'use strict';var _=require(_0xd88e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd88e('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd88e('0x2'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xd88e('0x3')]=function(_0x31a864,_0x45b6d0){return _0x31a864[_0xd88e('0x4')](_0xd88e('0x5'),attributes,{'tableName':_0xd88e('0x6'),'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 f7bf311..70dd5a9 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 _0x4dfc=['client','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0xdc8e9e,_0x41c47e){var _0x3cc7ad=function(_0x4d1321){while(--_0x4d1321){_0xdc8e9e['push'](_0xdc8e9e['shift']());}};_0x3cc7ad(++_0x41c47e);}(_0x4dfc,0xc1));var _0xc4df=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0x4dfc[_0x47a491];return _0x3b176b;};'use strict';var _=require(_0xc4df('0x0'));var util=require(_0xc4df('0x1'));var moment=require(_0xc4df('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4df('0x3'))['db'];var utils=require(_0xc4df('0x4'));var logger=require(_0xc4df('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc4df('0x6'));var client=jayson[_0xc4df('0x7')][_0xc4df('0x8')]({'port':0x232a});config['redis']=_[_0xc4df('0x9')](config[_0xc4df('0xa')],{'host':_0xc4df('0xb'),'port':0x18eb});var socket=require(_0xc4df('0xc'))(new Redis(config[_0xc4df('0xa')]));require(_0xc4df('0xd'))[_0xc4df('0xe')](socket);function respondWithRpcPromise(_0x4a057f,_0x5d7f5d,_0x441e4d){return new BPromise(function(_0x354862,_0x30f396){return client[_0xc4df('0xf')](_0x4a057f,_0x441e4d)['then'](function(_0x529957){logger[_0xc4df('0x10')](_0xc4df('0x11'),_0x5d7f5d,_0xc4df('0x12'));logger[_0xc4df('0x13')](_0xc4df('0x14'),_0x5d7f5d,_0xc4df('0x12'),JSON[_0xc4df('0x15')](_0x529957));if(_0x529957[_0xc4df('0x16')]){if(_0x529957['error'][_0xc4df('0x17')]===0x1f4){logger[_0xc4df('0x16')]('MailQueue,\x20%s,\x20%s',_0x5d7f5d,_0x529957[_0xc4df('0x16')][_0xc4df('0x18')]);return _0x30f396(_0x529957['error']['message']);}logger[_0xc4df('0x16')](_0xc4df('0x11'),_0x5d7f5d,_0x529957['error'][_0xc4df('0x18')]);return _0x354862(_0x529957['error'][_0xc4df('0x18')]);}else{logger[_0xc4df('0x10')](_0xc4df('0x11'),_0x5d7f5d,'request\x20sent');_0x354862(_0x529957['result'][_0xc4df('0x18')]);}})[_0xc4df('0x19')](function(_0x4277fe){logger[_0xc4df('0x16')](_0xc4df('0x11'),_0x5d7f5d,_0x4277fe);_0x30f396(_0x4277fe);});});}exports[_0xc4df('0x1a')]=function(_0xa62cb2){var _0x193e4d=this;return new Promise(function(_0x12a525,_0x5cfd95){return db[_0xc4df('0x1b')][_0xc4df('0x1c')]({'raw':_0xa62cb2[_0xc4df('0x1d')]?_0xa62cb2[_0xc4df('0x1d')][_0xc4df('0x1e')]===undefined?!![]:![]:!![],'where':_0xa62cb2[_0xc4df('0x1d')]?_0xa62cb2['options'][_0xc4df('0x1f')]||null:null,'attributes':_0xa62cb2['options']?_0xa62cb2[_0xc4df('0x1d')][_0xc4df('0x20')]||null:null,'limit':_0xa62cb2[_0xc4df('0x1d')]?_0xa62cb2[_0xc4df('0x1d')][_0xc4df('0x21')]||null:null,'include':_0xa62cb2[_0xc4df('0x1d')]?_0xa62cb2[_0xc4df('0x1d')][_0xc4df('0x22')]?_[_0xc4df('0x23')](_0xa62cb2['options'][_0xc4df('0x22')],function(_0x486100){return{'model':db[_0x486100[_0xc4df('0x24')]],'as':_0x486100['as'],'attributes':_0x486100[_0xc4df('0x20')],'include':_0x486100['include']?_['map'](_0x486100['include'],function(_0x359bb1){return{'model':db[_0x359bb1[_0xc4df('0x24')]],'as':_0x359bb1['as'],'attributes':_0x359bb1[_0xc4df('0x20')],'include':_0x359bb1['include']?_['map'](_0x359bb1[_0xc4df('0x22')],function(_0x315d57){return{'model':db[_0x315d57[_0xc4df('0x24')]],'as':_0x315d57['as'],'attributes':_0x315d57[_0xc4df('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4df('0x25')](function(_0x8efb3a){logger[_0xc4df('0x10')](_0xc4df('0x1a'),_0xa62cb2);logger[_0xc4df('0x13')]('GetMailQueue',_0xa62cb2,JSON[_0xc4df('0x15')](_0x8efb3a));_0x12a525(_0x8efb3a);})['catch'](function(_0x5c5f18){logger[_0xc4df('0x16')](_0xc4df('0x1a'),_0x5c5f18[_0xc4df('0x18')],_0xa62cb2);_0x5cfd95(_0x193e4d['error'](0x1f4,_0x5c5f18[_0xc4df('0x18')]));});});};exports[_0xc4df('0x26')]=function(_0x1fa1a4){var _0x456cd5=this;return new Promise(function(_0x188fbc,_0x2e601b){return db[_0xc4df('0x1b')][_0xc4df('0x27')]({'raw':_0x1fa1a4[_0xc4df('0x1d')]?_0x1fa1a4[_0xc4df('0x1d')][_0xc4df('0x1e')]===undefined?!![]:![]:!![],'where':_0x1fa1a4[_0xc4df('0x1d')]?_0x1fa1a4[_0xc4df('0x1d')][_0xc4df('0x1f')]||null:null,'attributes':_0x1fa1a4[_0xc4df('0x1d')]?_0x1fa1a4[_0xc4df('0x1d')][_0xc4df('0x20')]||null:null,'include':_0x1fa1a4[_0xc4df('0x1d')]?_0x1fa1a4[_0xc4df('0x1d')]['include']?_[_0xc4df('0x23')](_0x1fa1a4[_0xc4df('0x1d')][_0xc4df('0x22')],function(_0x529950){return{'model':db[_0x529950[_0xc4df('0x24')]],'as':_0x529950['as'],'attributes':_0x529950[_0xc4df('0x20')],'include':_0x529950[_0xc4df('0x22')]?_[_0xc4df('0x23')](_0x529950[_0xc4df('0x22')],function(_0x4371b2){return{'model':db[_0x4371b2['model']],'as':_0x4371b2['as'],'attributes':_0x4371b2['attributes'],'include':_0x4371b2['include']?_[_0xc4df('0x23')](_0x4371b2[_0xc4df('0x22')],function(_0x2816c9){return{'model':db[_0x2816c9[_0xc4df('0x24')]],'as':_0x2816c9['as'],'attributes':_0x2816c9[_0xc4df('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4df('0x25')](function(_0x4f7f79){logger['info'](_0xc4df('0x26'),_0x1fa1a4);logger['debug'](_0xc4df('0x26'),_0x1fa1a4,JSON[_0xc4df('0x15')](_0x4f7f79));_0x188fbc(_0x4f7f79);})[_0xc4df('0x19')](function(_0xfbbab3){logger['error'](_0xc4df('0x26'),_0xfbbab3['message'],_0x1fa1a4);_0x2e601b(_0x456cd5[_0xc4df('0x16')](0x1f4,_0xfbbab3['message']));});});}; \ No newline at end of file +var _0x2295=['client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailQueue','MailQueue','options','raw','limit','include','map','model','attributes','ShowMailQueue','find','where','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3eebab,_0x5e12a7){var _0xbae508=function(_0x212eba){while(--_0x212eba){_0x3eebab['push'](_0x3eebab['shift']());}};_0xbae508(++_0x5e12a7);}(_0x2295,0xb6));var _0x5229=function(_0x597065,_0x185c55){_0x597065=_0x597065-0x0;var _0x2c9dcf=_0x2295[_0x597065];return _0x2c9dcf;};'use strict';var _=require('lodash');var util=require(_0x5229('0x0'));var moment=require(_0x5229('0x1'));var BPromise=require(_0x5229('0x2'));var rs=require(_0x5229('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5229('0x4'));var logger=require(_0x5229('0x5'))(_0x5229('0x6'));var config=require('../../config/environment');var jayson=require(_0x5229('0x7'));var client=jayson[_0x5229('0x8')][_0x5229('0x9')]({'port':0x232a});config[_0x5229('0xa')]=_[_0x5229('0xb')](config[_0x5229('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5229('0xc'))(new Redis(config[_0x5229('0xa')]));require(_0x5229('0xd'))[_0x5229('0xe')](socket);function respondWithRpcPromise(_0x22ceea,_0x29f811,_0x1c3820){return new BPromise(function(_0x5ad470,_0x1783a5){return client[_0x5229('0xf')](_0x22ceea,_0x1c3820)[_0x5229('0x10')](function(_0x1c6377){logger[_0x5229('0x11')](_0x5229('0x12'),_0x29f811,_0x5229('0x13'));logger[_0x5229('0x14')](_0x5229('0x15'),_0x29f811,_0x5229('0x13'),JSON['stringify'](_0x1c6377));if(_0x1c6377['error']){if(_0x1c6377['error']['code']===0x1f4){logger[_0x5229('0x16')](_0x5229('0x12'),_0x29f811,_0x1c6377[_0x5229('0x16')][_0x5229('0x17')]);return _0x1783a5(_0x1c6377[_0x5229('0x16')]['message']);}logger['error'](_0x5229('0x12'),_0x29f811,_0x1c6377['error']['message']);return _0x5ad470(_0x1c6377[_0x5229('0x16')][_0x5229('0x17')]);}else{logger[_0x5229('0x11')]('MailQueue,\x20%s,\x20%s',_0x29f811,_0x5229('0x13'));_0x5ad470(_0x1c6377[_0x5229('0x18')][_0x5229('0x17')]);}})[_0x5229('0x19')](function(_0x1f0f48){logger[_0x5229('0x16')](_0x5229('0x12'),_0x29f811,_0x1f0f48);_0x1783a5(_0x1f0f48);});});}exports[_0x5229('0x1a')]=function(_0xd82a7a){var _0x450980=this;return new Promise(function(_0x1f4c83,_0x2fba12){return db[_0x5229('0x1b')]['findAll']({'raw':_0xd82a7a[_0x5229('0x1c')]?_0xd82a7a[_0x5229('0x1c')][_0x5229('0x1d')]===undefined?!![]:![]:!![],'where':_0xd82a7a[_0x5229('0x1c')]?_0xd82a7a[_0x5229('0x1c')]['where']||null:null,'attributes':_0xd82a7a[_0x5229('0x1c')]?_0xd82a7a[_0x5229('0x1c')]['attributes']||null:null,'limit':_0xd82a7a[_0x5229('0x1c')]?_0xd82a7a[_0x5229('0x1c')][_0x5229('0x1e')]||null:null,'include':_0xd82a7a['options']?_0xd82a7a[_0x5229('0x1c')][_0x5229('0x1f')]?_[_0x5229('0x20')](_0xd82a7a[_0x5229('0x1c')][_0x5229('0x1f')],function(_0x177533){return{'model':db[_0x177533[_0x5229('0x21')]],'as':_0x177533['as'],'attributes':_0x177533[_0x5229('0x22')],'include':_0x177533[_0x5229('0x1f')]?_[_0x5229('0x20')](_0x177533[_0x5229('0x1f')],function(_0x37d8d5){return{'model':db[_0x37d8d5[_0x5229('0x21')]],'as':_0x37d8d5['as'],'attributes':_0x37d8d5[_0x5229('0x22')],'include':_0x37d8d5[_0x5229('0x1f')]?_[_0x5229('0x20')](_0x37d8d5[_0x5229('0x1f')],function(_0x285912){return{'model':db[_0x285912[_0x5229('0x21')]],'as':_0x285912['as'],'attributes':_0x285912[_0x5229('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5229('0x10')](function(_0x58bc77){logger[_0x5229('0x11')](_0x5229('0x1a'),_0xd82a7a);logger[_0x5229('0x14')](_0x5229('0x1a'),_0xd82a7a,JSON['stringify'](_0x58bc77));_0x1f4c83(_0x58bc77);})[_0x5229('0x19')](function(_0x1e0b44){logger[_0x5229('0x16')](_0x5229('0x1a'),_0x1e0b44['message'],_0xd82a7a);_0x2fba12(_0x450980[_0x5229('0x16')](0x1f4,_0x1e0b44[_0x5229('0x17')]));});});};exports[_0x5229('0x23')]=function(_0x8b0139){var _0x13aeba=this;return new Promise(function(_0x45a162,_0x11be63){return db[_0x5229('0x1b')][_0x5229('0x24')]({'raw':_0x8b0139['options']?_0x8b0139['options'][_0x5229('0x1d')]===undefined?!![]:![]:!![],'where':_0x8b0139[_0x5229('0x1c')]?_0x8b0139[_0x5229('0x1c')][_0x5229('0x25')]||null:null,'attributes':_0x8b0139[_0x5229('0x1c')]?_0x8b0139['options'][_0x5229('0x22')]||null:null,'include':_0x8b0139[_0x5229('0x1c')]?_0x8b0139[_0x5229('0x1c')][_0x5229('0x1f')]?_[_0x5229('0x20')](_0x8b0139[_0x5229('0x1c')][_0x5229('0x1f')],function(_0xc907e1){return{'model':db[_0xc907e1[_0x5229('0x21')]],'as':_0xc907e1['as'],'attributes':_0xc907e1[_0x5229('0x22')],'include':_0xc907e1[_0x5229('0x1f')]?_['map'](_0xc907e1[_0x5229('0x1f')],function(_0x5c4e30){return{'model':db[_0x5c4e30[_0x5229('0x21')]],'as':_0x5c4e30['as'],'attributes':_0x5c4e30[_0x5229('0x22')],'include':_0x5c4e30[_0x5229('0x1f')]?_[_0x5229('0x20')](_0x5c4e30['include'],function(_0x4f9628){return{'model':db[_0x4f9628['model']],'as':_0x4f9628['as'],'attributes':_0x4f9628['attributes']};}):[]};}):[]};}):[]:[]})[_0x5229('0x10')](function(_0x3d26ee){logger[_0x5229('0x11')](_0x5229('0x23'),_0x8b0139);logger[_0x5229('0x14')]('ShowMailQueue',_0x8b0139,JSON['stringify'](_0x3d26ee));_0x45a162(_0x3d26ee);})[_0x5229('0x19')](function(_0xe968a4){logger[_0x5229('0x16')](_0x5229('0x23'),_0xe968a4['message'],_0x8b0139);_0x11be63(_0x13aeba[_0x5229('0x16')](0x1f4,_0xe968a4[_0x5229('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8e4d453..24b78a6 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 _0xa0d1=['emit','removeListener','register','length','remove'];(function(_0x20b086,_0x205528){var _0x460abc=function(_0x171a0a){while(--_0x171a0a){_0x20b086['push'](_0x20b086['shift']());}};_0x460abc(++_0x205528);}(_0xa0d1,0x144));var _0x1a0d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa0d1[_0x42cae2];return _0x5f256f;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x1a0d('0x0'),'update'];function createListener(_0x1578f1,_0x3829be){return function(_0x395e71){_0x3829be[_0x1a0d('0x1')](_0x1578f1,_0x395e71);};}function removeListener(_0x2d90a0,_0x48c22f){return function(){MailQueueEvents[_0x1a0d('0x2')](_0x2d90a0,_0x48c22f);};}exports[_0x1a0d('0x3')]=function(_0x1eb6c6){for(var _0xcb35a0=0x0,_0x439ca0=events[_0x1a0d('0x4')];_0xcb35a0<_0x439ca0;_0xcb35a0++){var _0x345757=events[_0xcb35a0];var _0x4aa163=createListener('mailQueue:'+_0x345757,_0x1eb6c6);MailQueueEvents['on'](_0x345757,_0x4aa163);}}; \ No newline at end of file +var _0x3939=['save','remove','update','register','length','mailQueue:'];(function(_0x9e71f6,_0x12e2dd){var _0xb2d27a=function(_0x1b14cc){while(--_0x1b14cc){_0x9e71f6['push'](_0x9e71f6['shift']());}};_0xb2d27a(++_0x12e2dd);}(_0x3939,0x1aa));var _0x9393=function(_0x1346b0,_0x3f9f00){_0x1346b0=_0x1346b0-0x0;var _0x4459bc=_0x3939[_0x1346b0];return _0x4459bc;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9393('0x0'),_0x9393('0x1'),_0x9393('0x2')];function createListener(_0x13cb38,_0x1c067c){return function(_0x5696cf){_0x1c067c['emit'](_0x13cb38,_0x5696cf);};}function removeListener(_0x34f562,_0x1dfdc7){return function(){MailQueueEvents['removeListener'](_0x34f562,_0x1dfdc7);};}exports[_0x9393('0x3')]=function(_0xeda6a6){for(var _0x5ab9cc=0x0,_0x52f20c=events[_0x9393('0x4')];_0x5ab9cc<_0x52f20c;_0x5ab9cc++){var _0x33e710=events[_0x5ab9cc];var _0xb13801=createListener(_0x9393('0x5')+_0x33e710,_0xeda6a6);MailQueueEvents['on'](_0x33e710,_0xb13801);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c9a3b65..29e6cf6 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 _0x637f=['get','/describe','/:id','post','create','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index'];(function(_0x4d4a84,_0x2052ea){var _0x28746e=function(_0x1632eb){while(--_0x1632eb){_0x4d4a84['push'](_0x4d4a84['shift']());}};_0x28746e(++_0x2052ea);}(_0x637f,0xd2));var _0xf637=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0x637f[_0x3a8ce2];return _0x2e5a45;};'use strict';var multer=require(_0xf637('0x0'));var util=require('util');var path=require(_0xf637('0x1'));var timeout=require(_0xf637('0x2'));var express=require('express');var router=express[_0xf637('0x3')]();var fs_extra=require(_0xf637('0x4'));var auth=require(_0xf637('0x5'));var interaction=require(_0xf637('0x6'));var config=require(_0xf637('0x7'));var controller=require(_0xf637('0x8'));router['get']('/',auth[_0xf637('0x9')](),controller[_0xf637('0xa')]);router[_0xf637('0xb')](_0xf637('0xc'),auth[_0xf637('0x9')](),controller['describe']);router[_0xf637('0xb')](_0xf637('0xd'),auth[_0xf637('0x9')](),controller['show']);router[_0xf637('0xe')]('/',auth[_0xf637('0x9')](),controller[_0xf637('0xf')]);router['put'](_0xf637('0xd'),auth[_0xf637('0x9')](),controller[_0xf637('0x10')]);router['delete'](_0xf637('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x44b3=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52e8f9,_0xaa1411){var _0x149713=function(_0x55f640){while(--_0x55f640){_0x52e8f9['push'](_0x52e8f9['shift']());}};_0x149713(++_0xaa1411);}(_0x44b3,0xae));var _0x344b=function(_0x154ba7,_0x5d2294){_0x154ba7=_0x154ba7-0x0;var _0x2a2332=_0x44b3[_0x154ba7];return _0x2a2332;};'use strict';var multer=require(_0x344b('0x0'));var util=require('util');var path=require(_0x344b('0x1'));var timeout=require(_0x344b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x344b('0x3'));var auth=require(_0x344b('0x4'));var interaction=require(_0x344b('0x5'));var config=require(_0x344b('0x6'));var controller=require(_0x344b('0x7'));router[_0x344b('0x8')]('/',auth[_0x344b('0x9')](),controller[_0x344b('0xa')]);router[_0x344b('0x8')](_0x344b('0xb'),auth[_0x344b('0x9')](),controller[_0x344b('0xc')]);router[_0x344b('0x8')](_0x344b('0xd'),auth['isAuthenticated'](),controller[_0x344b('0xe')]);router[_0x344b('0xf')]('/',auth[_0x344b('0x9')](),controller['create']);router[_0x344b('0x10')](_0x344b('0xd'),auth[_0x344b('0x9')](),controller[_0x344b('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x344b('0x12')]);module[_0x344b('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1cff57c..73a41eb 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 _0xca9a=['moment','sequelize','exports','STRING','DATE'];(function(_0xefebd8,_0x1d95b9){var _0x1b08e3=function(_0x17fcff){while(--_0x17fcff){_0xefebd8['push'](_0xefebd8['shift']());}};_0x1b08e3(++_0x1d95b9);}(_0xca9a,0x181));var _0xaca9=function(_0xf5e913,_0x1d5b4e){_0xf5e913=_0xf5e913-0x0;var _0x56d6d1=_0xca9a[_0xf5e913];return _0x56d6d1;};'use strict';var moment=require(_0xaca9('0x0'));var Sequelize=require(_0xaca9('0x1'));module[_0xaca9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaca9('0x3')]},'joinAt':{'type':Sequelize[_0xaca9('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xaca9('0x4')]},'exitAt':{'type':Sequelize[_0xaca9('0x4')]},'reason':{'type':Sequelize[_0xaca9('0x3')]}}; \ No newline at end of file +var _0x696f=['DATE','STRING'];(function(_0x29207d,_0xd46f54){var _0x50a843=function(_0x2cd7b4){while(--_0x2cd7b4){_0x29207d['push'](_0x29207d['shift']());}};_0x50a843(++_0xd46f54);}(_0x696f,0x1b9));var _0xf696=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x696f[_0x1ac595];return _0x455fff;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf696('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xf696('0x0')]},'joinAt':{'type':Sequelize[_0xf696('0x1')]},'leaveAt':{'type':Sequelize[_0xf696('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf696('0x1')]},'reason':{'type':Sequelize[_0xf696('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 37222b4..c4590f2 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x271502,_0x2b41a2){var _0x2e4c0b=function(_0x238731){while(--_0x238731){_0x271502['push'](_0x271502['shift']());}};_0x2e4c0b(++_0x2b41a2);}(_0x2ef3,0xba));var _0x32ef=function(_0x5d7a93,_0xb22cab){_0x5d7a93=_0x5d7a93-0x0;var _0x28a684=_0x2ef3[_0x5d7a93];return _0x28a684;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','MailQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x449ec9,_0x2eb2ac){var _0x3a3233=function(_0xe25f9e){while(--_0xe25f9e){_0x449ec9['push'](_0x449ec9['shift']());}};_0x3a3233(++_0x2eb2ac);}(_0x5b12,0xa3));var _0x25b1=function(_0x4558b0,_0x525d58){_0x4558b0=_0x4558b0-0x0;var _0x225334=_0x5b12[_0x4558b0];return _0x225334;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['MailQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a25d5c3..e763176 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 _0x4451=['../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x4451,0xf4));var _0x1445=function(_0x8b6a49,_0x39f608){_0x8b6a49=_0x8b6a49-0x0;var _0x1f4abf=_0x4451[_0x8b6a49];return _0x1f4abf;};'use strict';var _=require(_0x1445('0x0'));var util=require(_0x1445('0x1'));var logger=require(_0x1445('0x2'))(_0x1445('0x3'));var moment=require('moment');var BPromise=require(_0x1445('0x4'));var rp=require(_0x1445('0x5'));var fs=require('fs');var path=require(_0x1445('0x6'));var rimraf=require(_0x1445('0x7'));var config=require(_0x1445('0x8'));var attributes=require(_0x1445('0x9'));module[_0x1445('0xa')]=function(_0x12be5d,_0x144a32){return _0x12be5d[_0x1445('0xb')]('MailQueueReport',attributes,{'tableName':_0x1445('0xc'),'paranoid':![],'indexes':[{'name':_0x1445('0xd'),'fields':[_0x1445('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c7a=['report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define'];(function(_0x4bb93d,_0x1cda9a){var _0x106b4f=function(_0x4aa8d1){while(--_0x4aa8d1){_0x4bb93d['push'](_0x4bb93d['shift']());}};_0x106b4f(++_0x1cda9a);}(_0x0c7a,0xb8));var _0xa0c7=function(_0x580933,_0x1b3545){_0x580933=_0x580933-0x0;var _0x3214f6=_0x0c7a[_0x580933];return _0x3214f6;};'use strict';var _=require(_0xa0c7('0x0'));var util=require('util');var logger=require(_0xa0c7('0x1'))(_0xa0c7('0x2'));var moment=require(_0xa0c7('0x3'));var BPromise=require(_0xa0c7('0x4'));var rp=require(_0xa0c7('0x5'));var fs=require('fs');var path=require(_0xa0c7('0x6'));var rimraf=require(_0xa0c7('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0c7('0x8'));module[_0xa0c7('0x9')]=function(_0x5605a3,_0x5f35be){return _0x5605a3[_0xa0c7('0xa')]('MailQueueReport',attributes,{'tableName':_0xa0c7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa0c7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 2d9197e..f6d3ec8 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x29f1b5,_0x19ac42){var _0x5bcfbd=function(_0x126629){while(--_0x126629){_0x29f1b5['push'](_0x29f1b5['shift']());}};_0x5bcfbd(++_0x19ac42);}(_0x2ef3,0xba));var _0x32ef=function(_0x2151ef,_0x4c1321){_0x2151ef=_0x2151ef-0x0;var _0x428942=_0x2ef3[_0x2151ef];return _0x428942;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x549c16,_0x60d814){var _0x2d2117=function(_0x2cd307){while(--_0x2cd307){_0x549c16['push'](_0x549c16['shift']());}};_0x2d2117(++_0x60d814);}(_0x1261,0x144));var _0x1126=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x1261[_0x479650];return _0x26b288;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 898fc20..ad86aeb 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1da80f,_0x59f7c8){var _0x382ff6=function(_0x469595){while(--_0x469595){_0x1da80f['push'](_0x1da80f['shift']());}};_0x382ff6(++_0x59f7c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x13fc2a,_0x505a7d){var _0x3fb4d6=function(_0x5b4fe7){while(--_0x5b4fe7){_0x13fc2a['push'](_0x13fc2a['shift']());}};_0x3fb4d6(++_0x505a7d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index aba9a3e..b1d86fe 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 _0x6544=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x1e22d9,_0x25ae8f){var _0x5d15bf=function(_0x32b615){while(--_0x32b615){_0x1e22d9['push'](_0x1e22d9['shift']());}};_0x5d15bf(++_0x25ae8f);}(_0x6544,0x1ce));var _0x4654=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x6544[_0x687ce7];return _0x8bb835;};'use strict';var Sequelize=require(_0x4654('0x0'));module[_0x4654('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4654('0x2')]},'authentication':{'type':Sequelize[_0x4654('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4654('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4654('0x4')]},'tls':{'type':Sequelize[_0x4654('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4654('0x2')],'defaultValue':_0x4654('0x5')},'connTimeout':{'type':Sequelize[_0x4654('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x4654('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4654('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7441=['STRING','INTEGER','BOOLEAN','INBOX','sequelize'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7441,0xef));var _0x1744=function(_0x34e037,_0x383689){_0x34e037=_0x34e037-0x0;var _0x4a7337=_0x7441[_0x34e037];return _0x4a7337;};'use strict';var Sequelize=require(_0x1744('0x0'));module['exports']={'description':{'type':Sequelize[_0x1744('0x1')]},'host':{'type':Sequelize[_0x1744('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1744('0x2')]},'tls':{'type':Sequelize[_0x1744('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x1744('0x4')},'connTimeout':{'type':Sequelize[_0x1744('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1744('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1744('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1744('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9f57fda..110cdfa 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 _0x1f50=['api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in','lodash','util'];(function(_0x441fac,_0x3b7fd5){var _0x14b12e=function(_0x2985a7){while(--_0x2985a7){_0x441fac['push'](_0x441fac['shift']());}};_0x14b12e(++_0x3b7fd5);}(_0x1f50,0x1d4));var _0x01f5=function(_0x1ce7b1,_0x3c5b65){_0x1ce7b1=_0x1ce7b1-0x0;var _0x154d68=_0x1f50[_0x1ce7b1];return _0x154d68;};'use strict';var _=require(_0x01f5('0x0'));var util=require(_0x01f5('0x1'));var logger=require('../../config/logger')(_0x01f5('0x2'));var moment=require(_0x01f5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01f5('0x4'));var rimraf=require(_0x01f5('0x5'));var config=require(_0x01f5('0x6'));var attributes=require(_0x01f5('0x7'));module['exports']=function(_0x35afc5,_0x3d97b2){return _0x35afc5[_0x01f5('0x8')]('MailServerIn',attributes,{'tableName':_0x01f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9179=['util','../../config/logger','api','moment','path','rimraf','./mailServerIn.attributes','exports','mail_servers_in','lodash'];(function(_0x58afc7,_0x370dd1){var _0x477c4f=function(_0x4846e7){while(--_0x4846e7){_0x58afc7['push'](_0x58afc7['shift']());}};_0x477c4f(++_0x370dd1);}(_0x9179,0x185));var _0x9917=function(_0x778aa1,_0x40b24){_0x778aa1=_0x778aa1-0x0;var _0x2c50a5=_0x9179[_0x778aa1];return _0x2c50a5;};'use strict';var _=require(_0x9917('0x0'));var util=require(_0x9917('0x1'));var logger=require(_0x9917('0x2'))(_0x9917('0x3'));var moment=require(_0x9917('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9917('0x5'));var rimraf=require(_0x9917('0x6'));var config=require('../../config/environment');var attributes=require(_0x9917('0x7'));module[_0x9917('0x8')]=function(_0x5127a6,_0x5852f0){return _0x5127a6['define']('MailServerIn',attributes,{'tableName':_0x9917('0x9'),'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 aefe02f..2620f45 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 _0xb49e=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5ed940,_0x5b2095){var _0xf5d65c=function(_0x2f8045){while(--_0x2f8045){_0x5ed940['push'](_0x5ed940['shift']());}};_0xf5d65c(++_0x5b2095);}(_0xb49e,0x84));var _0xeb49=function(_0x241264,_0x24d6aa){_0x241264=_0x241264-0x0;var _0x52a83a=_0xb49e[_0x241264];return _0x52a83a;};'use strict';var _=require(_0xeb49('0x0'));var util=require(_0xeb49('0x1'));var moment=require(_0xeb49('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb49('0x3'));var fs=require('fs');var Redis=require(_0xeb49('0x4'));var db=require(_0xeb49('0x5'))['db'];var utils=require(_0xeb49('0x6'));var logger=require(_0xeb49('0x7'))(_0xeb49('0x8'));var config=require(_0xeb49('0x9'));var jayson=require(_0xeb49('0xa'));var client=jayson[_0xeb49('0xb')][_0xeb49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a6e30,_0x366b45,_0x12973c){return new BPromise(function(_0x331ea9,_0x4c66a0){return client[_0xeb49('0xd')](_0x1a6e30,_0x12973c)[_0xeb49('0xe')](function(_0x120b5f){logger[_0xeb49('0xf')](_0xeb49('0x10'),_0x366b45,_0xeb49('0x11'));logger[_0xeb49('0x12')](_0xeb49('0x13'),_0x366b45,_0xeb49('0x11'),JSON[_0xeb49('0x14')](_0x120b5f));if(_0x120b5f[_0xeb49('0x15')]){if(_0x120b5f[_0xeb49('0x15')][_0xeb49('0x16')]===0x1f4){logger[_0xeb49('0x15')](_0xeb49('0x10'),_0x366b45,_0x120b5f[_0xeb49('0x15')][_0xeb49('0x17')]);return _0x4c66a0(_0x120b5f['error'][_0xeb49('0x17')]);}logger[_0xeb49('0x15')]('MailServerIn,\x20%s,\x20%s',_0x366b45,_0x120b5f['error'][_0xeb49('0x17')]);return _0x331ea9(_0x120b5f[_0xeb49('0x15')][_0xeb49('0x17')]);}else{logger[_0xeb49('0xf')](_0xeb49('0x10'),_0x366b45,_0xeb49('0x11'));_0x331ea9(_0x120b5f[_0xeb49('0x18')]['message']);}})[_0xeb49('0x19')](function(_0x1ea69f){logger[_0xeb49('0x15')]('MailServerIn,\x20%s,\x20%s',_0x366b45,_0x1ea69f);_0x4c66a0(_0x1ea69f);});});}exports[_0xeb49('0x1a')]=function(_0x222ffb){var _0x2480b8=this;return new Promise(function(_0x1f6d09,_0x15372c){return db[_0xeb49('0x1b')][_0xeb49('0x1c')]({'raw':_0x222ffb[_0xeb49('0x1d')]?_0x222ffb['options'][_0xeb49('0x1e')]===undefined?!![]:![]:!![],'where':_0x222ffb[_0xeb49('0x1d')]?_0x222ffb['options'][_0xeb49('0x1f')]||null:null,'attributes':_0x222ffb['options']?_0x222ffb['options'][_0xeb49('0x20')]||null:null,'limit':_0x222ffb['options']?_0x222ffb[_0xeb49('0x1d')][_0xeb49('0x21')]||null:null,'include':_0x222ffb[_0xeb49('0x1d')]?_0x222ffb['options'][_0xeb49('0x22')]?_[_0xeb49('0x23')](_0x222ffb['options'][_0xeb49('0x22')],function(_0x3d1b36){return{'model':db[_0x3d1b36['model']],'as':_0x3d1b36['as'],'attributes':_0x3d1b36[_0xeb49('0x20')],'include':_0x3d1b36[_0xeb49('0x22')]?_[_0xeb49('0x23')](_0x3d1b36['include'],function(_0x2106d2){return{'model':db[_0x2106d2[_0xeb49('0x24')]],'as':_0x2106d2['as'],'attributes':_0x2106d2[_0xeb49('0x20')],'include':_0x2106d2[_0xeb49('0x22')]?_[_0xeb49('0x23')](_0x2106d2[_0xeb49('0x22')],function(_0x5c8dca){return{'model':db[_0x5c8dca['model']],'as':_0x5c8dca['as'],'attributes':_0x5c8dca[_0xeb49('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb49('0xe')](function(_0x1dbe6e){logger[_0xeb49('0xf')](_0xeb49('0x1a'),_0x222ffb);logger[_0xeb49('0x12')](_0xeb49('0x1a'),_0x222ffb,JSON[_0xeb49('0x14')](_0x1dbe6e));_0x1f6d09(_0x1dbe6e);})[_0xeb49('0x19')](function(_0xd1ada8){logger[_0xeb49('0x15')](_0xeb49('0x1a'),_0xd1ada8[_0xeb49('0x17')],_0x222ffb);_0x15372c(_0x2480b8['error'](0x1f4,_0xd1ada8[_0xeb49('0x17')]));});});}; \ No newline at end of file +var _0xd136=['catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','info','result'];(function(_0x1dcde4,_0x38b5c8){var _0x5ed662=function(_0x8d468d){while(--_0x8d468d){_0x1dcde4['push'](_0x1dcde4['shift']());}};_0x5ed662(++_0x38b5c8);}(_0xd136,0x94));var _0x6d13=function(_0x13f273,_0x579aa7){_0x13f273=_0x13f273-0x0;var _0x33812f=_0xd136[_0x13f273];return _0x33812f;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335482,_0xdf6760,_0x4c563a){return new BPromise(function(_0x598021,_0x1af16f){return client[_0x6d13('0xb')](_0x335482,_0x4c563a)[_0x6d13('0xc')](function(_0x2216d7){logger['info']('MailServerIn,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));logger[_0x6d13('0xe')](_0x6d13('0xf'),_0xdf6760,'request\x20sent',JSON['stringify'](_0x2216d7));if(_0x2216d7[_0x6d13('0x10')]){if(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x11')]===0x1f4){logger['error'](_0x6d13('0x12'),_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x1af16f(_0x2216d7[_0x6d13('0x10')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0xdf6760,_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);return _0x598021(_0x2216d7[_0x6d13('0x10')][_0x6d13('0x13')]);}else{logger[_0x6d13('0x14')]('MailServerIn,\x20%s,\x20%s',_0xdf6760,_0x6d13('0xd'));_0x598021(_0x2216d7[_0x6d13('0x15')][_0x6d13('0x13')]);}})[_0x6d13('0x16')](function(_0x348cab){logger[_0x6d13('0x10')](_0x6d13('0x12'),_0xdf6760,_0x348cab);_0x1af16f(_0x348cab);});});}exports[_0x6d13('0x17')]=function(_0xc6c2b){var _0x5bcac4=this;return new Promise(function(_0x276fdd,_0x269f27){return db[_0x6d13('0x18')][_0x6d13('0x19')]({'raw':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1b')]===undefined?!![]:![]:!![],'where':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1c')]||null:null,'attributes':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1d')]||null:null,'limit':_0xc6c2b[_0x6d13('0x1a')]?_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x1e')]||null:null,'include':_0xc6c2b['options']?_0xc6c2b[_0x6d13('0x1a')]['include']?_[_0x6d13('0x1f')](_0xc6c2b[_0x6d13('0x1a')][_0x6d13('0x20')],function(_0x5bbc9d){return{'model':db[_0x5bbc9d[_0x6d13('0x21')]],'as':_0x5bbc9d['as'],'attributes':_0x5bbc9d[_0x6d13('0x1d')],'include':_0x5bbc9d[_0x6d13('0x20')]?_[_0x6d13('0x1f')](_0x5bbc9d[_0x6d13('0x20')],function(_0x361432){return{'model':db[_0x361432[_0x6d13('0x21')]],'as':_0x361432['as'],'attributes':_0x361432[_0x6d13('0x1d')],'include':_0x361432['include']?_[_0x6d13('0x1f')](_0x361432['include'],function(_0x4c8526){return{'model':db[_0x4c8526[_0x6d13('0x21')]],'as':_0x4c8526['as'],'attributes':_0x4c8526['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d13('0xc')](function(_0x2618e5){logger[_0x6d13('0x14')]('GetMailServerIn',_0xc6c2b);logger[_0x6d13('0xe')](_0x6d13('0x17'),_0xc6c2b,JSON['stringify'](_0x2618e5));_0x276fdd(_0x2618e5);})[_0x6d13('0x16')](function(_0x1eda96){logger[_0x6d13('0x10')](_0x6d13('0x17'),_0x1eda96[_0x6d13('0x13')],_0xc6c2b);_0x269f27(_0x5bcac4[_0x6d13('0x10')](0x1f4,_0x1eda96[_0x6d13('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ef04537..4c4dc48 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(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x45cc68,_0xf53b26){_0x45cc68=_0x45cc68-0x0;var _0x4854ef=_0x7a54[_0x45cc68];return _0x4854ef;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 29cbabc..b01b0e0 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 _0x3de3=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x1bf335,_0x40d76b){var _0x5e4da0=function(_0x1eca04){while(--_0x1eca04){_0x1bf335['push'](_0x1bf335['shift']());}};_0x5e4da0(++_0x40d76b);}(_0x3de3,0x1ce));var _0x33de=function(_0x16fe68,_0xefce82){_0x16fe68=_0x16fe68-0x0;var _0x541445=_0x3de3[_0x16fe68];return _0x541445;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'description':{'type':Sequelize[_0x33de('0x1')]},'host':{'type':Sequelize[_0x33de('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x33de('0x1')]},'port':{'type':Sequelize[_0x33de('0x2')]},'secure':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x33de('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x33de('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x69d3=['exports','STRING','sequelize'];(function(_0xf6780d,_0x1902c1){var _0x9d98e=function(_0x11f96f){while(--_0x11f96f){_0xf6780d['push'](_0xf6780d['shift']());}};_0x9d98e(++_0x1902c1);}(_0x69d3,0xda));var _0x369d=function(_0x3865b6,_0x52b3ab){_0x3865b6=_0x3865b6-0x0;var _0x49fc54=_0x69d3[_0x3865b6];return _0x49fc54;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'description':{'type':Sequelize[_0x369d('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x369d('0x2')]},'pass':{'type':Sequelize[_0x369d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x369d('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 274f37f..6bfb227 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 _0x6706=['merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','map','MailServerOut','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where'];(function(_0x5ecbfb,_0x4f40ce){var _0x54bb49=function(_0x404095){while(--_0x404095){_0x5ecbfb['push'](_0x5ecbfb['shift']());}};_0x54bb49(++_0x4f40ce);}(_0x6706,0x193));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6670('0x0'));var zipdir=require(_0x6670('0x1'));var jsonpatch=require(_0x6670('0x2'));var rp=require(_0x6670('0x3'));var moment=require(_0x6670('0x4'));var BPromise=require(_0x6670('0x5'));var Mustache=require('mustache');var util=require(_0x6670('0x6'));var path=require(_0x6670('0x7'));var sox=require(_0x6670('0x8'));var csv=require(_0x6670('0x9'));var ejs=require(_0x6670('0xa'));var fs=require('fs');var fs_extra=require(_0x6670('0xb'));var _=require(_0x6670('0xc'));var squel=require(_0x6670('0xd'));var crypto=require(_0x6670('0xe'));var jsforce=require(_0x6670('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6670('0x9'));var querystring=require(_0x6670('0x10'));var Papa=require(_0x6670('0x11'));var Redis=require(_0x6670('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6670('0x13'));var as=require(_0x6670('0x14'));var hardwareService=require(_0x6670('0x15'));var logger=require(_0x6670('0x16'))(_0x6670('0x17'));var utils=require(_0x6670('0x18'));var config=require(_0x6670('0x19'));var licenseUtil=require(_0x6670('0x1a'));var db=require(_0x6670('0x1b'))['db'];function respondWithStatusCode(_0x2a2e04,_0x20f382){_0x20f382=_0x20f382||0xcc;return function(_0x1b40b2){if(_0x1b40b2){return _0x2a2e04[_0x6670('0x1c')](_0x20f382);}return _0x2a2e04['status'](_0x20f382)[_0x6670('0x1d')]();};}function respondWithResult(_0x5df5dd,_0x3cbe7a){_0x3cbe7a=_0x3cbe7a||0xc8;return function(_0x8c058c){if(_0x8c058c){return _0x5df5dd[_0x6670('0x1e')](_0x3cbe7a)[_0x6670('0x1f')](_0x8c058c);}};}function respondWithFilteredResult(_0xbba33d,_0x2b45e6){return function(_0x15d436){if(_0x15d436){var _0x597aa1=typeof _0x2b45e6[_0x6670('0x20')]==='undefined'&&typeof _0x2b45e6['limit']===_0x6670('0x21');var _0x94f812=_0x15d436[_0x6670('0x22')];var _0x4304d0=_0x597aa1?0x0:_0x2b45e6[_0x6670('0x20')];var _0x227b42=_0x597aa1?_0x15d436[_0x6670('0x22')]:_0x2b45e6[_0x6670('0x20')]+_0x2b45e6[_0x6670('0x23')];var _0x5a34aa;if(_0x227b42>=_0x94f812){_0x227b42=_0x94f812;_0x5a34aa=0xc8;}else{_0x5a34aa=0xce;}_0xbba33d['status'](_0x5a34aa);return _0xbba33d[_0x6670('0x24')](_0x6670('0x25'),_0x4304d0+'-'+_0x227b42+'/'+_0x94f812)[_0x6670('0x1f')](_0x15d436);}return null;};}function patchUpdates(_0x3c769e){return function(_0x50db6d){try{jsonpatch[_0x6670('0x26')](_0x50db6d,_0x3c769e,!![]);}catch(_0xd32e63){return BPromise[_0x6670('0x27')](_0xd32e63);}return _0x50db6d[_0x6670('0x28')]();};}function saveUpdates(_0x15ed92,_0xabe140){return function(_0x561ced){if(_0x561ced){return _0x561ced[_0x6670('0x29')](_0x15ed92)[_0x6670('0x2a')](function(_0x38339e){return _0x38339e;});}return null;};}function removeEntity(_0x28ca10,_0x13674b){return function(_0x398d03){if(_0x398d03){return _0x398d03[_0x6670('0x2b')]()[_0x6670('0x2a')](function(){_0x28ca10[_0x6670('0x1e')](0xcc)[_0x6670('0x1d')]();});}};}function handleEntityNotFound(_0x3c4059,_0x1a3622){return function(_0x420854){if(!_0x420854){_0x3c4059[_0x6670('0x1c')](0x194);}return _0x420854;};}function handleError(_0x19bee3,_0x12d131){_0x12d131=_0x12d131||0x1f4;return function(_0x4d42d1){logger[_0x6670('0x2c')](_0x4d42d1['stack']);if(_0x4d42d1['name']){delete _0x4d42d1['name'];}_0x19bee3[_0x6670('0x1e')](_0x12d131)['send'](_0x4d42d1);};}exports['index']=function(_0x1f227e,_0x4d819c){var _0xca4d0={},_0x302d01={},_0x2da940={'count':0x0,'rows':[]};var _0x51c763=_[_0x6670('0x2d')](db[_0x6670('0x2e')][_0x6670('0x2f')],function(_0x402475){return{'name':_0x402475['fieldName'],'type':_0x402475[_0x6670('0x30')][_0x6670('0x31')]};});_0x302d01[_0x6670('0x32')]=_[_0x6670('0x2d')](_0x51c763,_0x6670('0x33'));_0x302d01[_0x6670('0x34')]=_[_0x6670('0x35')](_0x1f227e[_0x6670('0x34')]);_0x302d01[_0x6670('0x36')]=_[_0x6670('0x37')](_0x302d01[_0x6670('0x32')],_0x302d01[_0x6670('0x34')]);_0xca4d0[_0x6670('0x38')]=_[_0x6670('0x37')](_0x302d01[_0x6670('0x32')],qs[_0x6670('0x39')](_0x1f227e[_0x6670('0x34')][_0x6670('0x39')]));_0xca4d0[_0x6670('0x38')]=_0xca4d0['attributes'][_0x6670('0x3a')]?_0xca4d0[_0x6670('0x38')]:_0x302d01[_0x6670('0x32')];if(!_0x1f227e[_0x6670('0x34')][_0x6670('0x3b')](_0x6670('0x3c'))){_0xca4d0[_0x6670('0x23')]=qs['limit'](_0x1f227e['query']['limit']);_0xca4d0[_0x6670('0x20')]=qs[_0x6670('0x20')](_0x1f227e['query'][_0x6670('0x20')]);}_0xca4d0[_0x6670('0x3d')]=qs['sort'](_0x1f227e['query'][_0x6670('0x3e')]);_0xca4d0['where']=qs[_0x6670('0x36')](_[_0x6670('0x3f')](_0x1f227e[_0x6670('0x34')],_0x302d01[_0x6670('0x36')]),_0x51c763);if(_0x1f227e[_0x6670('0x34')]['filter']){_0xca4d0[_0x6670('0x40')]=_[_0x6670('0x41')](_0xca4d0['where'],{'$or':_[_0x6670('0x2d')](_0x51c763,function(_0x506b90){if(_0x506b90[_0x6670('0x30')]!==_0x6670('0x42')){var _0x575996={};_0x575996[_0x506b90[_0x6670('0x33')]]={'$like':'%'+_0x1f227e[_0x6670('0x34')][_0x6670('0x43')]+'%'};return _0x575996;}})});}_0xca4d0=_['merge']({},_0xca4d0,_0x1f227e[_0x6670('0x44')]);var _0x44fe5a={'where':_0xca4d0[_0x6670('0x40')]};return db[_0x6670('0x2e')][_0x6670('0x22')](_0x44fe5a)[_0x6670('0x2a')](function(_0xcfd227){_0x2da940[_0x6670('0x22')]=_0xcfd227;if(_0x1f227e[_0x6670('0x34')][_0x6670('0x45')]){_0xca4d0[_0x6670('0x46')]=[{'all':!![]}];}return db[_0x6670('0x2e')]['findAll'](_0xca4d0);})['then'](function(_0x2652b2){_0x2da940[_0x6670('0x47')]=_0x2652b2;return _0x2da940;})[_0x6670('0x2a')](respondWithFilteredResult(_0x4d819c,_0xca4d0))[_0x6670('0x48')](handleError(_0x4d819c,null));};exports[_0x6670('0x49')]=function(_0x15034c,_0x10882d){var _0x5d9f67={'raw':!![],'where':{'id':_0x15034c[_0x6670('0x4a')]['id']}},_0xa2fa94={};_0xa2fa94[_0x6670('0x32')]=_[_0x6670('0x35')](db['MailServerOut'][_0x6670('0x2f')]);_0xa2fa94['query']=_[_0x6670('0x35')](_0x15034c[_0x6670('0x34')]);_0xa2fa94[_0x6670('0x36')]=_[_0x6670('0x37')](_0xa2fa94['model'],_0xa2fa94[_0x6670('0x34')]);_0x5d9f67['attributes']=_[_0x6670('0x37')](_0xa2fa94['model'],qs[_0x6670('0x39')](_0x15034c[_0x6670('0x34')][_0x6670('0x39')]));_0x5d9f67['attributes']=_0x5d9f67[_0x6670('0x38')][_0x6670('0x3a')]?_0x5d9f67[_0x6670('0x38')]:_0xa2fa94[_0x6670('0x32')];if(_0x15034c[_0x6670('0x34')][_0x6670('0x45')]){_0x5d9f67[_0x6670('0x46')]=[{'all':!![]}];}_0x5d9f67=_[_0x6670('0x41')]({},_0x5d9f67,_0x15034c[_0x6670('0x44')]);return db[_0x6670('0x2e')]['find'](_0x5d9f67)[_0x6670('0x2a')](handleEntityNotFound(_0x10882d,null))[_0x6670('0x2a')](respondWithResult(_0x10882d,null))[_0x6670('0x48')](handleError(_0x10882d,null));};exports[_0x6670('0x4b')]=function(_0x3f004d,_0x33288b){return db[_0x6670('0x2e')][_0x6670('0x4b')](_0x3f004d['body'],{})[_0x6670('0x2a')](respondWithResult(_0x33288b,0xc9))[_0x6670('0x48')](handleError(_0x33288b,null));};exports['update']=function(_0x23ddf6,_0x513000){if(_0x23ddf6[_0x6670('0x4c')]['id']){delete _0x23ddf6[_0x6670('0x4c')]['id'];}return db[_0x6670('0x2e')][_0x6670('0x4d')]({'where':{'id':_0x23ddf6[_0x6670('0x4a')]['id']}})[_0x6670('0x2a')](handleEntityNotFound(_0x513000,null))[_0x6670('0x2a')](saveUpdates(_0x23ddf6[_0x6670('0x4c')],null))['then'](respondWithResult(_0x513000,null))[_0x6670('0x48')](handleError(_0x513000,null));};exports[_0x6670('0x2b')]=function(_0x3ef5c5,_0x2b131f){return db['MailServerOut']['find']({'where':{'id':_0x3ef5c5[_0x6670('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b131f,null))['then'](removeEntity(_0x2b131f,null))[_0x6670('0x48')](handleError(_0x2b131f,null));}; \ No newline at end of file +var _0x9eda=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','map','MailServerOut','rawAttributes'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9eda,0xfe));var _0xa9ed=function(_0x56c8e8,_0x2b0d5b){_0x56c8e8=_0x56c8e8-0x0;var _0x375148=_0x9eda[_0x56c8e8];return _0x375148;};'use strict';var emlformat=require(_0xa9ed('0x0'));var rimraf=require(_0xa9ed('0x1'));var zipdir=require(_0xa9ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9ed('0x3'));var BPromise=require(_0xa9ed('0x4'));var Mustache=require(_0xa9ed('0x5'));var util=require(_0xa9ed('0x6'));var path=require(_0xa9ed('0x7'));var sox=require(_0xa9ed('0x8'));var csv=require(_0xa9ed('0x9'));var ejs=require(_0xa9ed('0xa'));var fs=require('fs');var fs_extra=require(_0xa9ed('0xb'));var _=require('lodash');var squel=require(_0xa9ed('0xc'));var crypto=require(_0xa9ed('0xd'));var jsforce=require(_0xa9ed('0xe'));var deskjs=require(_0xa9ed('0xf'));var toCsv=require(_0xa9ed('0x9'));var querystring=require(_0xa9ed('0x10'));var Papa=require(_0xa9ed('0x11'));var Redis=require(_0xa9ed('0x12'));var authService=require(_0xa9ed('0x13'));var qs=require(_0xa9ed('0x14'));var as=require(_0xa9ed('0x15'));var hardwareService=require(_0xa9ed('0x16'));var logger=require('../../config/logger')(_0xa9ed('0x17'));var utils=require(_0xa9ed('0x18'));var config=require(_0xa9ed('0x19'));var licenseUtil=require(_0xa9ed('0x1a'));var db=require(_0xa9ed('0x1b'))['db'];function respondWithStatusCode(_0xcb9ca7,_0x167cc4){_0x167cc4=_0x167cc4||0xcc;return function(_0x4cf30c){if(_0x4cf30c){return _0xcb9ca7[_0xa9ed('0x1c')](_0x167cc4);}return _0xcb9ca7[_0xa9ed('0x1d')](_0x167cc4)[_0xa9ed('0x1e')]();};}function respondWithResult(_0x60dc11,_0x339069){_0x339069=_0x339069||0xc8;return function(_0x4899da){if(_0x4899da){return _0x60dc11[_0xa9ed('0x1d')](_0x339069)['json'](_0x4899da);}};}function respondWithFilteredResult(_0xb8f475,_0x1a7d82){return function(_0x2e39c5){if(_0x2e39c5){var _0x3f3a03=typeof _0x1a7d82[_0xa9ed('0x1f')]===_0xa9ed('0x20')&&typeof _0x1a7d82[_0xa9ed('0x21')]===_0xa9ed('0x20');var _0xc06123=_0x2e39c5['count'];var _0x58278b=_0x3f3a03?0x0:_0x1a7d82[_0xa9ed('0x1f')];var _0x486805=_0x3f3a03?_0x2e39c5[_0xa9ed('0x22')]:_0x1a7d82[_0xa9ed('0x1f')]+_0x1a7d82[_0xa9ed('0x21')];var _0xeb3540;if(_0x486805>=_0xc06123){_0x486805=_0xc06123;_0xeb3540=0xc8;}else{_0xeb3540=0xce;}_0xb8f475[_0xa9ed('0x1d')](_0xeb3540);return _0xb8f475['set'](_0xa9ed('0x23'),_0x58278b+'-'+_0x486805+'/'+_0xc06123)['json'](_0x2e39c5);}return null;};}function patchUpdates(_0x3d3b3b){return function(_0x45ca8b){try{jsonpatch[_0xa9ed('0x24')](_0x45ca8b,_0x3d3b3b,!![]);}catch(_0x222612){return BPromise['reject'](_0x222612);}return _0x45ca8b[_0xa9ed('0x25')]();};}function saveUpdates(_0x30f0bb,_0x40faca){return function(_0x35376e){if(_0x35376e){return _0x35376e[_0xa9ed('0x26')](_0x30f0bb)[_0xa9ed('0x27')](function(_0x701f4){return _0x701f4;});}return null;};}function removeEntity(_0x1d81be,_0x55a3ca){return function(_0x2b2a34){if(_0x2b2a34){return _0x2b2a34[_0xa9ed('0x28')]()[_0xa9ed('0x27')](function(){_0x1d81be[_0xa9ed('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2093,_0x51a5a0){return function(_0x2cda1a){if(!_0x2cda1a){_0x5b2093[_0xa9ed('0x1c')](0x194);}return _0x2cda1a;};}function handleError(_0x28bb58,_0xdae46){_0xdae46=_0xdae46||0x1f4;return function(_0x5c78d6){logger['error'](_0x5c78d6['stack']);if(_0x5c78d6['name']){delete _0x5c78d6[_0xa9ed('0x29')];}_0x28bb58[_0xa9ed('0x1d')](_0xdae46)[_0xa9ed('0x2a')](_0x5c78d6);};}exports['index']=function(_0x366e6a,_0x73692a){var _0x57bb80={},_0x19cf48={},_0x47e7f7={'count':0x0,'rows':[]};var _0x2895ae=_[_0xa9ed('0x2b')](db[_0xa9ed('0x2c')][_0xa9ed('0x2d')],function(_0xd90d43){return{'name':_0xd90d43[_0xa9ed('0x2e')],'type':_0xd90d43[_0xa9ed('0x2f')][_0xa9ed('0x30')]};});_0x19cf48[_0xa9ed('0x31')]=_[_0xa9ed('0x2b')](_0x2895ae,_0xa9ed('0x29'));_0x19cf48['query']=_[_0xa9ed('0x32')](_0x366e6a['query']);_0x19cf48[_0xa9ed('0x33')]=_[_0xa9ed('0x34')](_0x19cf48[_0xa9ed('0x31')],_0x19cf48[_0xa9ed('0x35')]);_0x57bb80[_0xa9ed('0x36')]=_[_0xa9ed('0x34')](_0x19cf48['model'],qs[_0xa9ed('0x37')](_0x366e6a['query'][_0xa9ed('0x37')]));_0x57bb80['attributes']=_0x57bb80[_0xa9ed('0x36')][_0xa9ed('0x38')]?_0x57bb80[_0xa9ed('0x36')]:_0x19cf48[_0xa9ed('0x31')];if(!_0x366e6a[_0xa9ed('0x35')][_0xa9ed('0x39')](_0xa9ed('0x3a'))){_0x57bb80[_0xa9ed('0x21')]=qs[_0xa9ed('0x21')](_0x366e6a[_0xa9ed('0x35')][_0xa9ed('0x21')]);_0x57bb80[_0xa9ed('0x1f')]=qs['offset'](_0x366e6a[_0xa9ed('0x35')][_0xa9ed('0x1f')]);}_0x57bb80['order']=qs[_0xa9ed('0x3b')](_0x366e6a['query'][_0xa9ed('0x3b')]);_0x57bb80[_0xa9ed('0x3c')]=qs[_0xa9ed('0x33')](_[_0xa9ed('0x3d')](_0x366e6a[_0xa9ed('0x35')],_0x19cf48[_0xa9ed('0x33')]),_0x2895ae);if(_0x366e6a[_0xa9ed('0x35')]['filter']){_0x57bb80['where']=_[_0xa9ed('0x3e')](_0x57bb80['where'],{'$or':_[_0xa9ed('0x2b')](_0x2895ae,function(_0x3d80d2){if(_0x3d80d2[_0xa9ed('0x2f')]!==_0xa9ed('0x3f')){var _0x12b80f={};_0x12b80f[_0x3d80d2['name']]={'$like':'%'+_0x366e6a[_0xa9ed('0x35')]['filter']+'%'};return _0x12b80f;}})});}_0x57bb80=_[_0xa9ed('0x3e')]({},_0x57bb80,_0x366e6a['options']);var _0x44832b={'where':_0x57bb80[_0xa9ed('0x3c')]};return db[_0xa9ed('0x2c')][_0xa9ed('0x22')](_0x44832b)[_0xa9ed('0x27')](function(_0x47b2aa){_0x47e7f7[_0xa9ed('0x22')]=_0x47b2aa;if(_0x366e6a[_0xa9ed('0x35')][_0xa9ed('0x40')]){_0x57bb80['include']=[{'all':!![]}];}return db[_0xa9ed('0x2c')][_0xa9ed('0x41')](_0x57bb80);})['then'](function(_0x4c258b){_0x47e7f7[_0xa9ed('0x42')]=_0x4c258b;return _0x47e7f7;})[_0xa9ed('0x27')](respondWithFilteredResult(_0x73692a,_0x57bb80))['catch'](handleError(_0x73692a,null));};exports[_0xa9ed('0x43')]=function(_0x188bde,_0x4f9620){var _0x4c4d0b={'raw':!![],'where':{'id':_0x188bde[_0xa9ed('0x44')]['id']}},_0x1802d1={};_0x1802d1[_0xa9ed('0x31')]=_[_0xa9ed('0x32')](db[_0xa9ed('0x2c')][_0xa9ed('0x2d')]);_0x1802d1[_0xa9ed('0x35')]=_[_0xa9ed('0x32')](_0x188bde[_0xa9ed('0x35')]);_0x1802d1[_0xa9ed('0x33')]=_[_0xa9ed('0x34')](_0x1802d1[_0xa9ed('0x31')],_0x1802d1[_0xa9ed('0x35')]);_0x4c4d0b['attributes']=_[_0xa9ed('0x34')](_0x1802d1[_0xa9ed('0x31')],qs[_0xa9ed('0x37')](_0x188bde['query']['fields']));_0x4c4d0b[_0xa9ed('0x36')]=_0x4c4d0b[_0xa9ed('0x36')][_0xa9ed('0x38')]?_0x4c4d0b[_0xa9ed('0x36')]:_0x1802d1[_0xa9ed('0x31')];if(_0x188bde['query'][_0xa9ed('0x40')]){_0x4c4d0b[_0xa9ed('0x45')]=[{'all':!![]}];}_0x4c4d0b=_[_0xa9ed('0x3e')]({},_0x4c4d0b,_0x188bde[_0xa9ed('0x46')]);return db[_0xa9ed('0x2c')]['find'](_0x4c4d0b)[_0xa9ed('0x27')](handleEntityNotFound(_0x4f9620,null))[_0xa9ed('0x27')](respondWithResult(_0x4f9620,null))['catch'](handleError(_0x4f9620,null));};exports[_0xa9ed('0x47')]=function(_0x495811,_0x451217){return db[_0xa9ed('0x2c')][_0xa9ed('0x47')](_0x495811[_0xa9ed('0x48')],{})['then'](respondWithResult(_0x451217,0xc9))[_0xa9ed('0x49')](handleError(_0x451217,null));};exports[_0xa9ed('0x26')]=function(_0xb38f30,_0x4f246a){if(_0xb38f30[_0xa9ed('0x48')]['id']){delete _0xb38f30[_0xa9ed('0x48')]['id'];}return db[_0xa9ed('0x2c')][_0xa9ed('0x4a')]({'where':{'id':_0xb38f30[_0xa9ed('0x44')]['id']}})[_0xa9ed('0x27')](handleEntityNotFound(_0x4f246a,null))[_0xa9ed('0x27')](saveUpdates(_0xb38f30[_0xa9ed('0x48')],null))[_0xa9ed('0x27')](respondWithResult(_0x4f246a,null))[_0xa9ed('0x49')](handleError(_0x4f246a,null));};exports[_0xa9ed('0x28')]=function(_0x5f01f6,_0x265edf){return db['MailServerOut'][_0xa9ed('0x4a')]({'where':{'id':_0x5f01f6[_0xa9ed('0x44')]['id']}})[_0xa9ed('0x27')](handleEntityNotFound(_0x265edf,null))[_0xa9ed('0x27')](removeEntity(_0x265edf,null))[_0xa9ed('0x49')](handleError(_0x265edf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e2e12b9..e321cfa 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 _0x9ec9=['define','MailServerOut','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailServerOut.attributes','exports'];(function(_0x3d7a0f,_0x40d3c2){var _0x1a7417=function(_0x2d5ac4){while(--_0x2d5ac4){_0x3d7a0f['push'](_0x3d7a0f['shift']());}};_0x1a7417(++_0x40d3c2);}(_0x9ec9,0x86));var _0x99ec=function(_0x277a8a,_0x16cf01){_0x277a8a=_0x277a8a-0x0;var _0x531463=_0x9ec9[_0x277a8a];return _0x531463;};'use strict';var _=require('lodash');var util=require(_0x99ec('0x0'));var logger=require(_0x99ec('0x1'))(_0x99ec('0x2'));var moment=require(_0x99ec('0x3'));var BPromise=require(_0x99ec('0x4'));var rp=require(_0x99ec('0x5'));var fs=require('fs');var path=require(_0x99ec('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x99ec('0x7'));module[_0x99ec('0x8')]=function(_0x4c0f1b,_0x19f2f6){return _0x4c0f1b[_0x99ec('0x9')](_0x99ec('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5698=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x58a51d,_0x5bcda5){var _0x5d97bc=function(_0x40e01c){while(--_0x40e01c){_0x58a51d['push'](_0x58a51d['shift']());}};_0x5d97bc(++_0x5bcda5);}(_0x5698,0x1a5));var _0x8569=function(_0xa261f5,_0x37ed4e){_0xa261f5=_0xa261f5-0x0;var _0x4a889b=_0x5698[_0xa261f5];return _0x4a889b;};'use strict';var _=require(_0x8569('0x0'));var util=require(_0x8569('0x1'));var logger=require(_0x8569('0x2'))(_0x8569('0x3'));var moment=require(_0x8569('0x4'));var BPromise=require(_0x8569('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8569('0x6'));var attributes=require(_0x8569('0x7'));module[_0x8569('0x8')]=function(_0x1229fd,_0x50e01a){return _0x1229fd[_0x8569('0x9')](_0x8569('0xa'),attributes,{'tableName':_0x8569('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9d8e8e3..d6b216f 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x3a4101,_0x295e11){_0x3a4101=_0x3a4101-0x0;var _0x42b9e6=_0x7a54[_0x3a4101];return _0x42b9e6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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(_0x356965,_0x45d2b1){var _0x57b61b=function(_0x18221a){while(--_0x18221a){_0x356965['push'](_0x356965['shift']());}};_0x57b61b(++_0x45d2b1);}(_0xdb28,0x106));var _0x8db2=function(_0x5e7abc,_0x4f2595){_0x5e7abc=_0x5e7abc-0x0;var _0x4342e6=_0xdb28[_0x5e7abc];return _0x4342e6;};'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 684a061..5d1833d 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 _0x5d16=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1b7df7,_0x57df26){var _0x25a758=function(_0x156750){while(--_0x156750){_0x1b7df7['push'](_0x1b7df7['shift']());}};_0x25a758(++_0x57df26);}(_0x5d16,0x179));var _0x65d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d16[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x65d1('0x0'));var path=require(_0x65d1('0x1'));var timeout=require(_0x65d1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x65d1('0x3'));var interaction=require(_0x65d1('0x4'));var config=require(_0x65d1('0x5'));var controller=require(_0x65d1('0x6'));router[_0x65d1('0x7')]('/',auth[_0x65d1('0x8')](),controller['index']);router[_0x65d1('0x7')](_0x65d1('0x9'),auth[_0x65d1('0x8')](),controller[_0x65d1('0xa')]);router['get'](_0x65d1('0xb'),auth[_0x65d1('0x8')](),controller[_0x65d1('0xc')]);router[_0x65d1('0xd')]('/',auth[_0x65d1('0x8')](),controller[_0x65d1('0xe')]);router[_0x65d1('0xf')](_0x65d1('0xb'),auth['isAuthenticated'](),controller[_0x65d1('0x10')]);router[_0x65d1('0x11')](_0x65d1('0xb'),auth[_0x65d1('0x8')](),controller[_0x65d1('0x12')]);module[_0x65d1('0x13')]=router; \ No newline at end of file +var _0xcc3d=['post','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','/:id'];(function(_0x1c4dec,_0x486d59){var _0x5f01ed=function(_0x2739d4){while(--_0x2739d4){_0x1c4dec['push'](_0x1c4dec['shift']());}};_0x5f01ed(++_0x486d59);}(_0xcc3d,0x143));var _0xdcc3=function(_0xf5f6c1,_0x3e3348){_0xf5f6c1=_0xf5f6c1-0x0;var _0x2a7968=_0xcc3d[_0xf5f6c1];return _0x2a7968;};'use strict';var multer=require(_0xdcc3('0x0'));var util=require(_0xdcc3('0x1'));var path=require(_0xdcc3('0x2'));var timeout=require(_0xdcc3('0x3'));var express=require(_0xdcc3('0x4'));var router=express[_0xdcc3('0x5')]();var fs_extra=require(_0xdcc3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcc3('0x7'));var controller=require(_0xdcc3('0x8'));router[_0xdcc3('0x9')]('/',auth['isAuthenticated'](),controller[_0xdcc3('0xa')]);router['get']('/describe',auth[_0xdcc3('0xb')](),controller['describe']);router[_0xdcc3('0x9')](_0xdcc3('0xc'),auth[_0xdcc3('0xb')](),controller['show']);router[_0xdcc3('0xd')]('/',auth[_0xdcc3('0xb')](),controller['create']);router[_0xdcc3('0xe')](_0xdcc3('0xc'),auth[_0xdcc3('0xb')](),controller['update']);router['delete'](_0xdcc3('0xc'),auth[_0xdcc3('0xb')](),controller['destroy']);module[_0xdcc3('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1149207..c6389d1 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 _0xffd6=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xffd6,0x97));var _0x6ffd=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xffd6[_0x215e65];return _0xa85842;};'use strict';var Sequelize=require(_0x6ffd('0x0'));module[_0x6ffd('0x1')]={'name':{'type':Sequelize[_0x6ffd('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x01d9=['sequelize','exports','STRING','name'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d8c5cb0..936bb62 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 _0x2aca=['attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','error','stack','name','index','map','MailSubstatus','rawAttributes','type','model','keys','query','filters','intersection'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2aca,0x179));var _0xa2ac=function(_0x14bc4d,_0x53f14f){_0x14bc4d=_0x14bc4d-0x0;var _0x4a48fb=_0x2aca[_0x14bc4d];return _0x4a48fb;};'use strict';var emlformat=require(_0xa2ac('0x0'));var rimraf=require(_0xa2ac('0x1'));var zipdir=require(_0xa2ac('0x2'));var jsonpatch=require(_0xa2ac('0x3'));var rp=require('request-promise');var moment=require(_0xa2ac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa2ac('0x5'));var ejs=require(_0xa2ac('0x6'));var fs=require('fs');var fs_extra=require(_0xa2ac('0x7'));var _=require(_0xa2ac('0x8'));var squel=require('squel');var crypto=require(_0xa2ac('0x9'));var jsforce=require(_0xa2ac('0xa'));var deskjs=require(_0xa2ac('0xb'));var toCsv=require(_0xa2ac('0x5'));var querystring=require(_0xa2ac('0xc'));var Papa=require(_0xa2ac('0xd'));var Redis=require(_0xa2ac('0xe'));var authService=require(_0xa2ac('0xf'));var qs=require(_0xa2ac('0x10'));var as=require(_0xa2ac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2ac('0x12'))(_0xa2ac('0x13'));var utils=require(_0xa2ac('0x14'));var config=require(_0xa2ac('0x15'));var licenseUtil=require(_0xa2ac('0x16'));var db=require(_0xa2ac('0x17'))['db'];function respondWithStatusCode(_0x124fe7,_0x829749){_0x829749=_0x829749||0xcc;return function(_0x19755c){if(_0x19755c){return _0x124fe7[_0xa2ac('0x18')](_0x829749);}return _0x124fe7[_0xa2ac('0x19')](_0x829749)[_0xa2ac('0x1a')]();};}function respondWithResult(_0x434b93,_0x191884){_0x191884=_0x191884||0xc8;return function(_0x3f2bc4){if(_0x3f2bc4){return _0x434b93[_0xa2ac('0x19')](_0x191884)[_0xa2ac('0x1b')](_0x3f2bc4);}};}function respondWithFilteredResult(_0x4a4725,_0x4547f9){return function(_0xa50423){if(_0xa50423){var _0x561a7e=typeof _0x4547f9['offset']===_0xa2ac('0x1c')&&typeof _0x4547f9[_0xa2ac('0x1d')]===_0xa2ac('0x1c');var _0xa5551=_0xa50423[_0xa2ac('0x1e')];var _0xa9a570=_0x561a7e?0x0:_0x4547f9[_0xa2ac('0x1f')];var _0x58ebd2=_0x561a7e?_0xa50423[_0xa2ac('0x1e')]:_0x4547f9[_0xa2ac('0x1f')]+_0x4547f9[_0xa2ac('0x1d')];var _0x28de2e;if(_0x58ebd2>=_0xa5551){_0x58ebd2=_0xa5551;_0x28de2e=0xc8;}else{_0x28de2e=0xce;}_0x4a4725[_0xa2ac('0x19')](_0x28de2e);return _0x4a4725['set'](_0xa2ac('0x20'),_0xa9a570+'-'+_0x58ebd2+'/'+_0xa5551)[_0xa2ac('0x1b')](_0xa50423);}return null;};}function patchUpdates(_0x48fd52){return function(_0x182641){try{jsonpatch[_0xa2ac('0x21')](_0x182641,_0x48fd52,!![]);}catch(_0x3b3beb){return BPromise['reject'](_0x3b3beb);}return _0x182641[_0xa2ac('0x22')]();};}function saveUpdates(_0x442c73,_0x2ab874){return function(_0x2ea71f){if(_0x2ea71f){return _0x2ea71f['update'](_0x442c73)[_0xa2ac('0x23')](function(_0x4131a5){return _0x4131a5;});}return null;};}function removeEntity(_0x58ecdb,_0x282685){return function(_0x1d7ff8){if(_0x1d7ff8){return _0x1d7ff8['destroy']()[_0xa2ac('0x23')](function(){_0x58ecdb[_0xa2ac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df3f4,_0xb6ebcd){return function(_0x3dcf3d){if(!_0x3dcf3d){_0x1df3f4[_0xa2ac('0x18')](0x194);}return _0x3dcf3d;};}function handleError(_0x19ca88,_0x298be8){_0x298be8=_0x298be8||0x1f4;return function(_0x3595ca){logger[_0xa2ac('0x24')](_0x3595ca[_0xa2ac('0x25')]);if(_0x3595ca[_0xa2ac('0x26')]){delete _0x3595ca[_0xa2ac('0x26')];}_0x19ca88['status'](_0x298be8)['send'](_0x3595ca);};}exports[_0xa2ac('0x27')]=function(_0x455408,_0x237938){var _0x4fb916={},_0x5ced76={},_0x5f3b03={'count':0x0,'rows':[]};var _0x4bcf5a=_[_0xa2ac('0x28')](db[_0xa2ac('0x29')][_0xa2ac('0x2a')],function(_0x2b8d8b){return{'name':_0x2b8d8b['fieldName'],'type':_0x2b8d8b[_0xa2ac('0x2b')]['key']};});_0x5ced76[_0xa2ac('0x2c')]=_[_0xa2ac('0x28')](_0x4bcf5a,_0xa2ac('0x26'));_0x5ced76['query']=_[_0xa2ac('0x2d')](_0x455408[_0xa2ac('0x2e')]);_0x5ced76[_0xa2ac('0x2f')]=_[_0xa2ac('0x30')](_0x5ced76[_0xa2ac('0x2c')],_0x5ced76['query']);_0x4fb916[_0xa2ac('0x31')]=_[_0xa2ac('0x30')](_0x5ced76['model'],qs[_0xa2ac('0x32')](_0x455408['query'][_0xa2ac('0x32')]));_0x4fb916[_0xa2ac('0x31')]=_0x4fb916['attributes'][_0xa2ac('0x33')]?_0x4fb916[_0xa2ac('0x31')]:_0x5ced76['model'];if(!_0x455408[_0xa2ac('0x2e')]['hasOwnProperty'](_0xa2ac('0x34'))){_0x4fb916[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x455408[_0xa2ac('0x2e')]['limit']);_0x4fb916[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x455408[_0xa2ac('0x2e')][_0xa2ac('0x1f')]);}_0x4fb916[_0xa2ac('0x35')]=qs[_0xa2ac('0x36')](_0x455408[_0xa2ac('0x2e')][_0xa2ac('0x36')]);_0x4fb916['where']=qs[_0xa2ac('0x2f')](_['pick'](_0x455408['query'],_0x5ced76[_0xa2ac('0x2f')]),_0x4bcf5a);if(_0x455408[_0xa2ac('0x2e')][_0xa2ac('0x37')]){_0x4fb916[_0xa2ac('0x38')]=_['merge'](_0x4fb916[_0xa2ac('0x38')],{'$or':_[_0xa2ac('0x28')](_0x4bcf5a,function(_0x286499){if(_0x286499[_0xa2ac('0x2b')]!==_0xa2ac('0x39')){var _0x40c065={};_0x40c065[_0x286499['name']]={'$like':'%'+_0x455408[_0xa2ac('0x2e')][_0xa2ac('0x37')]+'%'};return _0x40c065;}})});}_0x4fb916=_['merge']({},_0x4fb916,_0x455408[_0xa2ac('0x3a')]);var _0x1a955c={'where':_0x4fb916[_0xa2ac('0x38')]};return db[_0xa2ac('0x29')][_0xa2ac('0x1e')](_0x1a955c)[_0xa2ac('0x23')](function(_0x30faf2){_0x5f3b03['count']=_0x30faf2;if(_0x455408[_0xa2ac('0x2e')][_0xa2ac('0x3b')]){_0x4fb916[_0xa2ac('0x3c')]=[{'all':!![]}];}return db[_0xa2ac('0x29')][_0xa2ac('0x3d')](_0x4fb916);})[_0xa2ac('0x23')](function(_0x225f0f){_0x5f3b03['rows']=_0x225f0f;return _0x5f3b03;})[_0xa2ac('0x23')](respondWithFilteredResult(_0x237938,_0x4fb916))['catch'](handleError(_0x237938,null));};exports[_0xa2ac('0x3e')]=function(_0x5b2e8f,_0x47050d){var _0x459538={'raw':!![],'where':{'id':_0x5b2e8f[_0xa2ac('0x3f')]['id']}},_0x48c998={};_0x48c998[_0xa2ac('0x2c')]=_[_0xa2ac('0x2d')](db[_0xa2ac('0x29')][_0xa2ac('0x2a')]);_0x48c998[_0xa2ac('0x2e')]=_[_0xa2ac('0x2d')](_0x5b2e8f[_0xa2ac('0x2e')]);_0x48c998[_0xa2ac('0x2f')]=_['intersection'](_0x48c998[_0xa2ac('0x2c')],_0x48c998[_0xa2ac('0x2e')]);_0x459538['attributes']=_[_0xa2ac('0x30')](_0x48c998[_0xa2ac('0x2c')],qs['fields'](_0x5b2e8f[_0xa2ac('0x2e')][_0xa2ac('0x32')]));_0x459538[_0xa2ac('0x31')]=_0x459538[_0xa2ac('0x31')]['length']?_0x459538[_0xa2ac('0x31')]:_0x48c998[_0xa2ac('0x2c')];if(_0x5b2e8f[_0xa2ac('0x2e')][_0xa2ac('0x3b')]){_0x459538[_0xa2ac('0x3c')]=[{'all':!![]}];}_0x459538=_['merge']({},_0x459538,_0x5b2e8f['options']);return db[_0xa2ac('0x29')][_0xa2ac('0x40')](_0x459538)[_0xa2ac('0x23')](handleEntityNotFound(_0x47050d,null))['then'](respondWithResult(_0x47050d,null))[_0xa2ac('0x41')](handleError(_0x47050d,null));};exports[_0xa2ac('0x42')]=function(_0x3b6663,_0x50a569){return db['MailSubstatus'][_0xa2ac('0x42')](_0x3b6663[_0xa2ac('0x43')],{})[_0xa2ac('0x23')](respondWithResult(_0x50a569,0xc9))[_0xa2ac('0x41')](handleError(_0x50a569,null));};exports[_0xa2ac('0x44')]=function(_0x3f109a,_0x5880bb){if(_0x3f109a[_0xa2ac('0x43')]['id']){delete _0x3f109a[_0xa2ac('0x43')]['id'];}return db['MailSubstatus'][_0xa2ac('0x40')]({'where':{'id':_0x3f109a['params']['id']}})[_0xa2ac('0x23')](handleEntityNotFound(_0x5880bb,null))['then'](saveUpdates(_0x3f109a[_0xa2ac('0x43')],null))[_0xa2ac('0x23')](respondWithResult(_0x5880bb,null))['catch'](handleError(_0x5880bb,null));};exports[_0xa2ac('0x45')]=function(_0x1d53b8,_0x51530e){return db['MailSubstatus']['find']({'where':{'id':_0x1d53b8[_0xa2ac('0x3f')]['id']}})['then'](handleEntityNotFound(_0x51530e,null))[_0xa2ac('0x23')](removeEntity(_0x51530e,null))['catch'](handleError(_0x51530e,null));};exports[_0xa2ac('0x46')]=function(_0x5b4e30,_0x5e94c5){return db[_0xa2ac('0x29')][_0xa2ac('0x46')]()[_0xa2ac('0x23')](respondWithResult(_0x5e94c5,null))[_0xa2ac('0x41')](handleError(_0x5e94c5,null));}; \ No newline at end of file +var _0xc434=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xc434,0xf6));var _0x4c43=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc434[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4c43('0x0'));var rimraf=require(_0x4c43('0x1'));var zipdir=require(_0x4c43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c43('0x3'));var Mustache=require(_0x4c43('0x4'));var util=require(_0x4c43('0x5'));var path=require(_0x4c43('0x6'));var sox=require(_0x4c43('0x7'));var csv=require('to-csv');var ejs=require(_0x4c43('0x8'));var fs=require('fs');var fs_extra=require(_0x4c43('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c43('0xa'));var deskjs=require(_0x4c43('0xb'));var toCsv=require(_0x4c43('0xc'));var querystring=require(_0x4c43('0xd'));var Papa=require(_0x4c43('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c43('0xf'));var as=require(_0x4c43('0x10'));var hardwareService=require(_0x4c43('0x11'));var logger=require('../../config/logger')(_0x4c43('0x12'));var utils=require(_0x4c43('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4c43('0x14'));var db=require(_0x4c43('0x15'))['db'];function respondWithStatusCode(_0xd8bdda,_0x4944bb){_0x4944bb=_0x4944bb||0xcc;return function(_0x3775ea){if(_0x3775ea){return _0xd8bdda[_0x4c43('0x16')](_0x4944bb);}return _0xd8bdda[_0x4c43('0x17')](_0x4944bb)['end']();};}function respondWithResult(_0x11c4e2,_0x31b513){_0x31b513=_0x31b513||0xc8;return function(_0x2bf640){if(_0x2bf640){return _0x11c4e2[_0x4c43('0x17')](_0x31b513)[_0x4c43('0x18')](_0x2bf640);}};}function respondWithFilteredResult(_0xb7047a,_0x4b97f9){return function(_0xd0489){if(_0xd0489){var _0x31fe42=typeof _0x4b97f9['offset']===_0x4c43('0x19')&&typeof _0x4b97f9[_0x4c43('0x1a')]==='undefined';var _0x31afa9=_0xd0489[_0x4c43('0x1b')];var _0x5204ee=_0x31fe42?0x0:_0x4b97f9[_0x4c43('0x1c')];var _0x491529=_0x31fe42?_0xd0489['count']:_0x4b97f9['offset']+_0x4b97f9[_0x4c43('0x1a')];var _0x27e259;if(_0x491529>=_0x31afa9){_0x491529=_0x31afa9;_0x27e259=0xc8;}else{_0x27e259=0xce;}_0xb7047a[_0x4c43('0x17')](_0x27e259);return _0xb7047a['set'](_0x4c43('0x1d'),_0x5204ee+'-'+_0x491529+'/'+_0x31afa9)[_0x4c43('0x18')](_0xd0489);}return null;};}function patchUpdates(_0x1ffffc){return function(_0x487495){try{jsonpatch[_0x4c43('0x1e')](_0x487495,_0x1ffffc,!![]);}catch(_0x188aaf){return BPromise[_0x4c43('0x1f')](_0x188aaf);}return _0x487495[_0x4c43('0x20')]();};}function saveUpdates(_0x389165,_0x15d498){return function(_0x3f3453){if(_0x3f3453){return _0x3f3453[_0x4c43('0x21')](_0x389165)[_0x4c43('0x22')](function(_0x26fd83){return _0x26fd83;});}return null;};}function removeEntity(_0x391152,_0x188bd5){return function(_0x2c3ede){if(_0x2c3ede){return _0x2c3ede[_0x4c43('0x23')]()[_0x4c43('0x22')](function(){_0x391152['status'](0xcc)[_0x4c43('0x24')]();});}};}function handleEntityNotFound(_0x483c4a,_0x546de7){return function(_0x3250ad){if(!_0x3250ad){_0x483c4a[_0x4c43('0x16')](0x194);}return _0x3250ad;};}function handleError(_0x775482,_0x2d5fac){_0x2d5fac=_0x2d5fac||0x1f4;return function(_0x41c0f9){logger[_0x4c43('0x25')](_0x41c0f9['stack']);if(_0x41c0f9[_0x4c43('0x26')]){delete _0x41c0f9[_0x4c43('0x26')];}_0x775482[_0x4c43('0x17')](_0x2d5fac)[_0x4c43('0x27')](_0x41c0f9);};}exports[_0x4c43('0x28')]=function(_0x5d1b67,_0x5c361d){var _0x494fb9={},_0x490832={},_0x5de556={'count':0x0,'rows':[]};var _0x3d27dd=_[_0x4c43('0x29')](db[_0x4c43('0x2a')]['rawAttributes'],function(_0x4d12d6){return{'name':_0x4d12d6[_0x4c43('0x2b')],'type':_0x4d12d6[_0x4c43('0x2c')][_0x4c43('0x2d')]};});_0x490832[_0x4c43('0x2e')]=_[_0x4c43('0x29')](_0x3d27dd,_0x4c43('0x26'));_0x490832[_0x4c43('0x2f')]=_[_0x4c43('0x30')](_0x5d1b67[_0x4c43('0x2f')]);_0x490832[_0x4c43('0x31')]=_[_0x4c43('0x32')](_0x490832[_0x4c43('0x2e')],_0x490832[_0x4c43('0x2f')]);_0x494fb9[_0x4c43('0x33')]=_[_0x4c43('0x32')](_0x490832[_0x4c43('0x2e')],qs[_0x4c43('0x34')](_0x5d1b67[_0x4c43('0x2f')]['fields']));_0x494fb9[_0x4c43('0x33')]=_0x494fb9[_0x4c43('0x33')][_0x4c43('0x35')]?_0x494fb9[_0x4c43('0x33')]:_0x490832[_0x4c43('0x2e')];if(!_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x36')](_0x4c43('0x37'))){_0x494fb9['limit']=qs[_0x4c43('0x1a')](_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x1a')]);_0x494fb9[_0x4c43('0x1c')]=qs[_0x4c43('0x1c')](_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x1c')]);}_0x494fb9[_0x4c43('0x38')]=qs[_0x4c43('0x39')](_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x39')]);_0x494fb9['where']=qs['filters'](_[_0x4c43('0x3a')](_0x5d1b67['query'],_0x490832['filters']),_0x3d27dd);if(_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x3b')]){_0x494fb9[_0x4c43('0x3c')]=_[_0x4c43('0x3d')](_0x494fb9['where'],{'$or':_['map'](_0x3d27dd,function(_0x1e30b5){if(_0x1e30b5[_0x4c43('0x2c')]!=='VIRTUAL'){var _0x186684={};_0x186684[_0x1e30b5[_0x4c43('0x26')]]={'$like':'%'+_0x5d1b67[_0x4c43('0x2f')][_0x4c43('0x3b')]+'%'};return _0x186684;}})});}_0x494fb9=_[_0x4c43('0x3d')]({},_0x494fb9,_0x5d1b67['options']);var _0x3c91af={'where':_0x494fb9[_0x4c43('0x3c')]};return db[_0x4c43('0x2a')][_0x4c43('0x1b')](_0x3c91af)[_0x4c43('0x22')](function(_0x5d46c8){_0x5de556[_0x4c43('0x1b')]=_0x5d46c8;if(_0x5d1b67['query'][_0x4c43('0x3e')]){_0x494fb9[_0x4c43('0x3f')]=[{'all':!![]}];}return db[_0x4c43('0x2a')][_0x4c43('0x40')](_0x494fb9);})[_0x4c43('0x22')](function(_0x56fd1f){_0x5de556[_0x4c43('0x41')]=_0x56fd1f;return _0x5de556;})[_0x4c43('0x22')](respondWithFilteredResult(_0x5c361d,_0x494fb9))['catch'](handleError(_0x5c361d,null));};exports[_0x4c43('0x42')]=function(_0x234106,_0x5b7130){var _0x415231={'raw':!![],'where':{'id':_0x234106[_0x4c43('0x43')]['id']}},_0x25ed41={};_0x25ed41[_0x4c43('0x2e')]=_['keys'](db[_0x4c43('0x2a')][_0x4c43('0x44')]);_0x25ed41[_0x4c43('0x2f')]=_['keys'](_0x234106['query']);_0x25ed41[_0x4c43('0x31')]=_[_0x4c43('0x32')](_0x25ed41[_0x4c43('0x2e')],_0x25ed41[_0x4c43('0x2f')]);_0x415231[_0x4c43('0x33')]=_[_0x4c43('0x32')](_0x25ed41[_0x4c43('0x2e')],qs['fields'](_0x234106[_0x4c43('0x2f')][_0x4c43('0x34')]));_0x415231[_0x4c43('0x33')]=_0x415231[_0x4c43('0x33')][_0x4c43('0x35')]?_0x415231['attributes']:_0x25ed41[_0x4c43('0x2e')];if(_0x234106[_0x4c43('0x2f')]['includeAll']){_0x415231[_0x4c43('0x3f')]=[{'all':!![]}];}_0x415231=_[_0x4c43('0x3d')]({},_0x415231,_0x234106['options']);return db[_0x4c43('0x2a')][_0x4c43('0x45')](_0x415231)[_0x4c43('0x22')](handleEntityNotFound(_0x5b7130,null))[_0x4c43('0x22')](respondWithResult(_0x5b7130,null))[_0x4c43('0x46')](handleError(_0x5b7130,null));};exports[_0x4c43('0x47')]=function(_0x1611ce,_0x20de6c){return db[_0x4c43('0x2a')][_0x4c43('0x47')](_0x1611ce['body'],{})['then'](respondWithResult(_0x20de6c,0xc9))['catch'](handleError(_0x20de6c,null));};exports[_0x4c43('0x21')]=function(_0x57c440,_0x48b4db){if(_0x57c440[_0x4c43('0x48')]['id']){delete _0x57c440[_0x4c43('0x48')]['id'];}return db[_0x4c43('0x2a')][_0x4c43('0x45')]({'where':{'id':_0x57c440[_0x4c43('0x43')]['id']}})[_0x4c43('0x22')](handleEntityNotFound(_0x48b4db,null))[_0x4c43('0x22')](saveUpdates(_0x57c440[_0x4c43('0x48')],null))[_0x4c43('0x22')](respondWithResult(_0x48b4db,null))['catch'](handleError(_0x48b4db,null));};exports[_0x4c43('0x23')]=function(_0x46ce3a,_0x2879d3){return db[_0x4c43('0x2a')][_0x4c43('0x45')]({'where':{'id':_0x46ce3a[_0x4c43('0x43')]['id']}})['then'](handleEntityNotFound(_0x2879d3,null))[_0x4c43('0x22')](removeEntity(_0x2879d3,null))[_0x4c43('0x46')](handleError(_0x2879d3,null));};exports[_0x4c43('0x49')]=function(_0x5c9057,_0x58cd55){return db['MailSubstatus'][_0x4c43('0x49')]()[_0x4c43('0x22')](respondWithResult(_0x58cd55,null))[_0x4c43('0x46')](handleError(_0x58cd55,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5219e58..b26ae80 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 _0xeba5=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x5315d3,_0xfbfeda){var _0x112572=function(_0x1c5c34){while(--_0x1c5c34){_0x5315d3['push'](_0x5315d3['shift']());}};_0x112572(++_0xfbfeda);}(_0xeba5,0xfd));var _0x5eba=function(_0x14bfab,_0x3768ae){_0x14bfab=_0x14bfab-0x0;var _0x530ee7=_0xeba5[_0x14bfab];return _0x530ee7;};'use strict';var EventEmitter=require(_0x5eba('0x0'));var MailSubstatus=require(_0x5eba('0x1'))['db'][_0x5eba('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5eba('0x3')](0x0);var events={'afterUpdate':_0x5eba('0x4')};function emitEvent(_0x47633c){return function(_0x2de264,_0x509ebc,_0x2334fe){MailSubstatusEvents[_0x5eba('0x5')](_0x47633c+':'+_0x2de264['id'],_0x2de264);MailSubstatusEvents[_0x5eba('0x5')](_0x47633c,_0x2de264);_0x2334fe(null);};}for(var e in events){if(events[_0x5eba('0x6')](e)){var event=events[e];MailSubstatus[_0x5eba('0x7')](e,emitEvent(event));}}module[_0x5eba('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xf8ab=['MailSubstatus','emit','hook','events'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xf8ab,0x147));var _0xbf8a=function(_0x1eae02,_0x29e21b){_0x1eae02=_0x1eae02-0x0;var _0x478249=_0xf8ab[_0x1eae02];return _0x478249;};'use strict';var EventEmitter=require(_0xbf8a('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xbf8a('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x959b4e){return function(_0x36bd89,_0x5e8d75,_0x4e7fb6){MailSubstatusEvents[_0xbf8a('0x2')](_0x959b4e+':'+_0x36bd89['id'],_0x36bd89);MailSubstatusEvents['emit'](_0x959b4e,_0x36bd89);_0x4e7fb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xbf8a('0x3')](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 5e88ed2..8b12cf3 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 _0x4953=['MailSubstatus','name','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x469918,_0x37fe81){var _0x386e31=function(_0x13f0e7){while(--_0x13f0e7){_0x469918['push'](_0x469918['shift']());}};_0x386e31(++_0x37fe81);}(_0x4953,0x115));var _0x3495=function(_0x25dd78,_0xaa48ef){_0x25dd78=_0x25dd78-0x0;var _0x4889b6=_0x4953[_0x25dd78];return _0x4889b6;};'use strict';var attributes=require(_0x3495('0x0'));module['exports']=function(_0x3be05a){var _0x386988=_0x3be05a[_0x3495('0x1')];return _0x3be05a[_0x3495('0x2')](_0x3495('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2c66e7,_0x4565cc,_0x9ebaf3){return _0x386988['Condition']['update']({'value':_0x2c66e7[_0x3495('0x4')]},{'where':{'field':'mailSubstatus','value':_0x2c66e7[_0x3495('0x5')]['name']}})[_0x3495('0x6')](function(){_0x9ebaf3();})[_0x3495('0x7')](function(_0x499a80){_0x9ebaf3(_0x499a80);});}}});}; \ No newline at end of file +var _0xc54b=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','then'];(function(_0x233f34,_0x3f2c60){var _0x1dbef6=function(_0x5aae19){while(--_0x5aae19){_0x233f34['push'](_0x233f34['shift']());}};_0x1dbef6(++_0x3f2c60);}(_0xc54b,0x168));var _0xbc54=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0xc54b[_0x24721a];return _0x6a9880;};'use strict';var attributes=require(_0xbc54('0x0'));module[_0xbc54('0x1')]=function(_0x15e2c2){var _0x514124=_0x15e2c2['models'];return _0x15e2c2[_0xbc54('0x2')](_0xbc54('0x3'),attributes,{'tableName':_0xbc54('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x182b9c,_0x19876b,_0x381d29){return _0x514124[_0xbc54('0x5')][_0xbc54('0x6')]({'value':_0x182b9c['name']},{'where':{'field':_0xbc54('0x7'),'value':_0x182b9c[_0xbc54('0x8')]['name']}})[_0xbc54('0x9')](function(){_0x381d29();})['catch'](function(_0x3046a6){_0x381d29(_0x3046a6);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2ef1d79..14a2bce 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 _0x3249=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x3249,0xdb));var _0x9324=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3249[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x9324('0x0'));var util=require('util');var moment=require(_0x9324('0x1'));var BPromise=require(_0x9324('0x2'));var rs=require(_0x9324('0x3'));var fs=require('fs');var Redis=require(_0x9324('0x4'));var db=require(_0x9324('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9324('0x6'));var config=require(_0x9324('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9324('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8b2a,_0x5c897c,_0x17370d){return new BPromise(function(_0x19a49c,_0x2d2c87){return client[_0x9324('0x9')](_0x1e8b2a,_0x17370d)[_0x9324('0xa')](function(_0x13abf8){logger[_0x9324('0xb')](_0x9324('0xc'),_0x5c897c,'request\x20sent');logger[_0x9324('0xd')](_0x9324('0xe'),_0x5c897c,_0x9324('0xf'),JSON[_0x9324('0x10')](_0x13abf8));if(_0x13abf8['error']){if(_0x13abf8[_0x9324('0x11')][_0x9324('0x12')]===0x1f4){logger[_0x9324('0x11')](_0x9324('0xc'),_0x5c897c,_0x13abf8[_0x9324('0x11')][_0x9324('0x13')]);return _0x2d2c87(_0x13abf8['error']['message']);}logger[_0x9324('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5c897c,_0x13abf8[_0x9324('0x11')][_0x9324('0x13')]);return _0x19a49c(_0x13abf8[_0x9324('0x11')][_0x9324('0x13')]);}else{logger[_0x9324('0xb')](_0x9324('0xc'),_0x5c897c,_0x9324('0xf'));_0x19a49c(_0x13abf8[_0x9324('0x14')][_0x9324('0x13')]);}})[_0x9324('0x15')](function(_0x1cf337){logger['error'](_0x9324('0xc'),_0x5c897c,_0x1cf337);_0x2d2c87(_0x1cf337);});});} \ No newline at end of file +var _0xfe77=['MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x175f44,_0x350863){var _0x5779c8=function(_0x47c4cc){while(--_0x47c4cc){_0x175f44['push'](_0x175f44['shift']());}};_0x5779c8(++_0x350863);}(_0xfe77,0x129));var _0x7fe7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfe77[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7fe7('0x0'));var util=require(_0x7fe7('0x1'));var moment=require(_0x7fe7('0x2'));var BPromise=require(_0x7fe7('0x3'));var rs=require(_0x7fe7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fe7('0x5'))['db'];var utils=require(_0x7fe7('0x6'));var logger=require(_0x7fe7('0x7'))(_0x7fe7('0x8'));var config=require(_0x7fe7('0x9'));var jayson=require(_0x7fe7('0xa'));var client=jayson['client'][_0x7fe7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40d24c,_0x26ebaf,_0x4211ea){return new BPromise(function(_0x30657d,_0x2c91df){return client[_0x7fe7('0xc')](_0x40d24c,_0x4211ea)[_0x7fe7('0xd')](function(_0x43af25){logger[_0x7fe7('0xe')](_0x7fe7('0xf'),_0x26ebaf,_0x7fe7('0x10'));logger[_0x7fe7('0x11')](_0x7fe7('0x12'),_0x26ebaf,_0x7fe7('0x10'),JSON[_0x7fe7('0x13')](_0x43af25));if(_0x43af25[_0x7fe7('0x14')]){if(_0x43af25['error']['code']===0x1f4){logger[_0x7fe7('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x26ebaf,_0x43af25[_0x7fe7('0x14')]['message']);return _0x2c91df(_0x43af25['error'][_0x7fe7('0x15')]);}logger[_0x7fe7('0x14')](_0x7fe7('0xf'),_0x26ebaf,_0x43af25[_0x7fe7('0x14')]['message']);return _0x30657d(_0x43af25[_0x7fe7('0x14')]['message']);}else{logger[_0x7fe7('0xe')](_0x7fe7('0xf'),_0x26ebaf,'request\x20sent');_0x30657d(_0x43af25[_0x7fe7('0x16')][_0x7fe7('0x15')]);}})[_0x7fe7('0x17')](function(_0x216515){logger[_0x7fe7('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x26ebaf,_0x216515);_0x2c91df(_0x216515);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 233b679..7a21c86 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 _0x9542=['create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','index','get','isAuthenticated','describe','/:id','show','post'];(function(_0x29d148,_0x454b9a){var _0x1f029e=function(_0x510ae3){while(--_0x510ae3){_0x29d148['push'](_0x29d148['shift']());}};_0x1f029e(++_0x454b9a);}(_0x9542,0x1d8));var _0x2954=function(_0x51de5c,_0x54cc3c){_0x51de5c=_0x51de5c-0x0;var _0x198185=_0x9542[_0x51de5c];return _0x198185;};'use strict';var multer=require(_0x2954('0x0'));var util=require('util');var path=require(_0x2954('0x1'));var timeout=require(_0x2954('0x2'));var express=require(_0x2954('0x3'));var router=express[_0x2954('0x4')]();var fs_extra=require(_0x2954('0x5'));var auth=require(_0x2954('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2954('0x7')]);router[_0x2954('0x8')]('/describe',auth[_0x2954('0x9')](),controller[_0x2954('0xa')]);router[_0x2954('0x8')](_0x2954('0xb'),auth['isAuthenticated'](),controller[_0x2954('0xc')]);router[_0x2954('0xd')]('/',auth[_0x2954('0x9')](),controller[_0x2954('0xe')]);router['put'](_0x2954('0xb'),auth[_0x2954('0x9')](),controller[_0x2954('0xf')]);router[_0x2954('0x10')](_0x2954('0xb'),auth[_0x2954('0x9')](),controller[_0x2954('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd8a2=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd8a2,0x1af));var _0x2d8a=function(_0x472734,_0x284fa2){_0x472734=_0x472734-0x0;var _0x25afb9=_0xd8a2[_0x472734];return _0x25afb9;};'use strict';var multer=require(_0x2d8a('0x0'));var util=require(_0x2d8a('0x1'));var path=require(_0x2d8a('0x2'));var timeout=require(_0x2d8a('0x3'));var express=require(_0x2d8a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2d8a('0x5'));var interaction=require(_0x2d8a('0x6'));var config=require(_0x2d8a('0x7'));var controller=require(_0x2d8a('0x8'));router[_0x2d8a('0x9')]('/',auth[_0x2d8a('0xa')](),controller[_0x2d8a('0xb')]);router[_0x2d8a('0x9')](_0x2d8a('0xc'),auth[_0x2d8a('0xa')](),controller['describe']);router[_0x2d8a('0x9')]('/:id',auth[_0x2d8a('0xa')](),controller[_0x2d8a('0xd')]);router[_0x2d8a('0xe')]('/',auth['isAuthenticated'](),controller[_0x2d8a('0xf')]);router[_0x2d8a('0x10')](_0x2d8a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x2d8a('0x12')](_0x2d8a('0x11'),auth[_0x2d8a('0xa')](),controller[_0x2d8a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 597ec00..ea22fc1 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5118d3,_0x401533){var _0x27309c=function(_0x543db1){while(--_0x543db1){_0x5118d3['push'](_0x5118d3['shift']());}};_0x27309c(++_0x401533);}(_0x70e0,0x17b));var _0x070e=function(_0x9da54b,_0x16eb3a){_0x9da54b=_0x9da54b-0x0;var _0x1126de=_0x70e0[_0x9da54b];return _0x1126de;};'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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4b5733,_0x345f7a){var _0x511d04=function(_0x756712){while(--_0x756712){_0x4b5733['push'](_0x4b5733['shift']());}};_0x511d04(++_0x345f7a);}(_0x008c,0x188));var _0xc008=function(_0x373059,_0x17b09c){_0x373059=_0x373059-0x0;var _0x368f67=_0x008c[_0x373059];return _0x368f67;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9193760..f81f648 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 _0x9333=['filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where'];(function(_0x3ad576,_0x15a4b0){var _0x2db6da=function(_0x1f5fe3){while(--_0x1f5fe3){_0x3ad576['push'](_0x3ad576['shift']());}};_0x2db6da(++_0x15a4b0);}(_0x9333,0x1da));var _0x3933=function(_0x1598c8,_0x177309){_0x1598c8=_0x1598c8-0x0;var _0x3e5191=_0x9333[_0x1598c8];return _0x3e5191;};'use strict';var emlformat=require(_0x3933('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3933('0x1'));var jsonpatch=require(_0x3933('0x2'));var rp=require(_0x3933('0x3'));var moment=require(_0x3933('0x4'));var BPromise=require(_0x3933('0x5'));var Mustache=require(_0x3933('0x6'));var util=require('util');var path=require(_0x3933('0x7'));var sox=require(_0x3933('0x8'));var csv=require(_0x3933('0x9'));var ejs=require(_0x3933('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3933('0xb'));var crypto=require(_0x3933('0xc'));var jsforce=require(_0x3933('0xd'));var deskjs=require(_0x3933('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3933('0xf'));var Papa=require(_0x3933('0x10'));var Redis=require('ioredis');var authService=require(_0x3933('0x11'));var qs=require(_0x3933('0x12'));var as=require(_0x3933('0x13'));var hardwareService=require(_0x3933('0x14'));var logger=require(_0x3933('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3933('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3933('0x17'))['db'];function respondWithStatusCode(_0xf9428b,_0x172806){_0x172806=_0x172806||0xcc;return function(_0x2ac3af){if(_0x2ac3af){return _0xf9428b[_0x3933('0x18')](_0x172806);}return _0xf9428b[_0x3933('0x19')](_0x172806)[_0x3933('0x1a')]();};}function respondWithResult(_0x4ef05c,_0x3fa9a6){_0x3fa9a6=_0x3fa9a6||0xc8;return function(_0x46359f){if(_0x46359f){return _0x4ef05c['status'](_0x3fa9a6)[_0x3933('0x1b')](_0x46359f);}};}function respondWithFilteredResult(_0x1b6b6e,_0x2ba316){return function(_0x20331c){if(_0x20331c){var _0x252d40=typeof _0x2ba316[_0x3933('0x1c')]==='undefined'&&typeof _0x2ba316[_0x3933('0x1d')]===_0x3933('0x1e');var _0x855f7b=_0x20331c[_0x3933('0x1f')];var _0x5aaa4a=_0x252d40?0x0:_0x2ba316['offset'];var _0xa8484c=_0x252d40?_0x20331c[_0x3933('0x1f')]:_0x2ba316[_0x3933('0x1c')]+_0x2ba316[_0x3933('0x1d')];var _0x20b83a;if(_0xa8484c>=_0x855f7b){_0xa8484c=_0x855f7b;_0x20b83a=0xc8;}else{_0x20b83a=0xce;}_0x1b6b6e[_0x3933('0x19')](_0x20b83a);return _0x1b6b6e[_0x3933('0x20')](_0x3933('0x21'),_0x5aaa4a+'-'+_0xa8484c+'/'+_0x855f7b)['json'](_0x20331c);}return null;};}function patchUpdates(_0x513c1d){return function(_0x2bea55){try{jsonpatch[_0x3933('0x22')](_0x2bea55,_0x513c1d,!![]);}catch(_0x144778){return BPromise[_0x3933('0x23')](_0x144778);}return _0x2bea55[_0x3933('0x24')]();};}function saveUpdates(_0x56af1a,_0x42b36d){return function(_0x51774b){if(_0x51774b){return _0x51774b['update'](_0x56af1a)[_0x3933('0x25')](function(_0x1e6a9f){return _0x1e6a9f;});}return null;};}function removeEntity(_0xc64d23,_0xbaf201){return function(_0xe11cd4){if(_0xe11cd4){return _0xe11cd4[_0x3933('0x26')]()[_0x3933('0x25')](function(){_0xc64d23['status'](0xcc)[_0x3933('0x1a')]();});}};}function handleEntityNotFound(_0x28c81f,_0x5a510d){return function(_0x3e21b5){if(!_0x3e21b5){_0x28c81f['sendStatus'](0x194);}return _0x3e21b5;};}function handleError(_0x2b7bb4,_0xc8155e){_0xc8155e=_0xc8155e||0x1f4;return function(_0x4a0e9d){logger['error'](_0x4a0e9d[_0x3933('0x27')]);if(_0x4a0e9d[_0x3933('0x28')]){delete _0x4a0e9d[_0x3933('0x28')];}_0x2b7bb4[_0x3933('0x19')](_0xc8155e)[_0x3933('0x29')](_0x4a0e9d);};}exports[_0x3933('0x2a')]=function(_0x11885c,_0x2c4ce1){var _0x120707={},_0x5084ab={},_0x2e4c91={'count':0x0,'rows':[]};var _0x3c77fe=_[_0x3933('0x2b')](db[_0x3933('0x2c')][_0x3933('0x2d')],function(_0x270cb4){return{'name':_0x270cb4[_0x3933('0x2e')],'type':_0x270cb4['type'][_0x3933('0x2f')]};});_0x5084ab[_0x3933('0x30')]=_[_0x3933('0x2b')](_0x3c77fe,'name');_0x5084ab[_0x3933('0x31')]=_[_0x3933('0x32')](_0x11885c['query']);_0x5084ab['filters']=_[_0x3933('0x33')](_0x5084ab[_0x3933('0x30')],_0x5084ab['query']);_0x120707['attributes']=_[_0x3933('0x33')](_0x5084ab[_0x3933('0x30')],qs[_0x3933('0x34')](_0x11885c['query'][_0x3933('0x34')]));_0x120707[_0x3933('0x35')]=_0x120707[_0x3933('0x35')]['length']?_0x120707[_0x3933('0x35')]:_0x5084ab[_0x3933('0x30')];if(!_0x11885c[_0x3933('0x31')][_0x3933('0x36')](_0x3933('0x37'))){_0x120707[_0x3933('0x1d')]=qs['limit'](_0x11885c[_0x3933('0x31')][_0x3933('0x1d')]);_0x120707[_0x3933('0x1c')]=qs['offset'](_0x11885c[_0x3933('0x31')][_0x3933('0x1c')]);}_0x120707['order']=qs[_0x3933('0x38')](_0x11885c['query'][_0x3933('0x38')]);_0x120707[_0x3933('0x39')]=qs[_0x3933('0x3a')](_[_0x3933('0x3b')](_0x11885c[_0x3933('0x31')],_0x5084ab[_0x3933('0x3a')]),_0x3c77fe);if(_0x11885c[_0x3933('0x31')][_0x3933('0x3c')]){_0x120707[_0x3933('0x39')]=_[_0x3933('0x3d')](_0x120707[_0x3933('0x39')],{'$or':_[_0x3933('0x2b')](_0x3c77fe,function(_0x37373a){if(_0x37373a[_0x3933('0x3e')]!==_0x3933('0x3f')){var _0x337426={};_0x337426[_0x37373a[_0x3933('0x28')]]={'$like':'%'+_0x11885c['query'][_0x3933('0x3c')]+'%'};return _0x337426;}})});}_0x120707=_[_0x3933('0x3d')]({},_0x120707,_0x11885c[_0x3933('0x40')]);var _0x6dc867={'where':_0x120707[_0x3933('0x39')]};return db['MailTransferReport'][_0x3933('0x1f')](_0x6dc867)['then'](function(_0x37bddd){_0x2e4c91['count']=_0x37bddd;if(_0x11885c[_0x3933('0x31')][_0x3933('0x41')]){_0x120707[_0x3933('0x42')]=[{'all':!![]}];}return db[_0x3933('0x2c')][_0x3933('0x43')](_0x120707);})[_0x3933('0x25')](function(_0x420b02){_0x2e4c91[_0x3933('0x44')]=_0x420b02;return _0x2e4c91;})[_0x3933('0x25')](respondWithFilteredResult(_0x2c4ce1,_0x120707))[_0x3933('0x45')](handleError(_0x2c4ce1,null));};exports['show']=function(_0x27fa25,_0x168005){var _0x2b1861={'raw':!![],'where':{'id':_0x27fa25[_0x3933('0x46')]['id']}},_0x2acf4e={};_0x2acf4e[_0x3933('0x30')]=_['keys'](db[_0x3933('0x2c')][_0x3933('0x2d')]);_0x2acf4e['query']=_[_0x3933('0x32')](_0x27fa25[_0x3933('0x31')]);_0x2acf4e[_0x3933('0x3a')]=_['intersection'](_0x2acf4e[_0x3933('0x30')],_0x2acf4e['query']);_0x2b1861[_0x3933('0x35')]=_[_0x3933('0x33')](_0x2acf4e[_0x3933('0x30')],qs['fields'](_0x27fa25[_0x3933('0x31')]['fields']));_0x2b1861['attributes']=_0x2b1861[_0x3933('0x35')]['length']?_0x2b1861[_0x3933('0x35')]:_0x2acf4e['model'];if(_0x27fa25[_0x3933('0x31')][_0x3933('0x41')]){_0x2b1861[_0x3933('0x42')]=[{'all':!![]}];}_0x2b1861=_[_0x3933('0x3d')]({},_0x2b1861,_0x27fa25['options']);return db[_0x3933('0x2c')][_0x3933('0x47')](_0x2b1861)[_0x3933('0x25')](handleEntityNotFound(_0x168005,null))[_0x3933('0x25')](respondWithResult(_0x168005,null))[_0x3933('0x45')](handleError(_0x168005,null));};exports[_0x3933('0x48')]=function(_0x1d55fa,_0x360181){return db[_0x3933('0x2c')][_0x3933('0x48')](_0x1d55fa[_0x3933('0x49')],{})[_0x3933('0x25')](respondWithResult(_0x360181,0xc9))[_0x3933('0x45')](handleError(_0x360181,null));};exports[_0x3933('0x4a')]=function(_0x1b7f25,_0x5b38bd){if(_0x1b7f25[_0x3933('0x49')]['id']){delete _0x1b7f25[_0x3933('0x49')]['id'];}return db[_0x3933('0x2c')][_0x3933('0x47')]({'where':{'id':_0x1b7f25[_0x3933('0x46')]['id']}})[_0x3933('0x25')](handleEntityNotFound(_0x5b38bd,null))['then'](saveUpdates(_0x1b7f25['body'],null))[_0x3933('0x25')](respondWithResult(_0x5b38bd,null))[_0x3933('0x45')](handleError(_0x5b38bd,null));};exports[_0x3933('0x26')]=function(_0x480ae8,_0x53cf6c){return db['MailTransferReport'][_0x3933('0x47')]({'where':{'id':_0x480ae8[_0x3933('0x46')]['id']}})[_0x3933('0x25')](handleEntityNotFound(_0x53cf6c,null))[_0x3933('0x25')](removeEntity(_0x53cf6c,null))[_0x3933('0x45')](handleError(_0x53cf6c,null));};exports[_0x3933('0x4b')]=function(_0x2f7f67,_0x5f0daf){return db['MailTransferReport'][_0x3933('0x4b')]()[_0x3933('0x25')](respondWithResult(_0x5f0daf,null))['catch'](handleError(_0x5f0daf,null));}; \ No newline at end of file +var _0x2fda=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','name','filter','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','MailTransferReport','rawAttributes'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x2fda,0x191));var _0xa2fd=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x2fda[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0xa2fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2fd('0x1'));var jsonpatch=require(_0xa2fd('0x2'));var rp=require(_0xa2fd('0x3'));var moment=require(_0xa2fd('0x4'));var BPromise=require(_0xa2fd('0x5'));var Mustache=require(_0xa2fd('0x6'));var util=require(_0xa2fd('0x7'));var path=require('path');var sox=require(_0xa2fd('0x8'));var csv=require(_0xa2fd('0x9'));var ejs=require(_0xa2fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2fd('0xb'));var squel=require('squel');var crypto=require(_0xa2fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa2fd('0xd'));var toCsv=require(_0xa2fd('0x9'));var querystring=require(_0xa2fd('0xe'));var Papa=require(_0xa2fd('0xf'));var Redis=require(_0xa2fd('0x10'));var authService=require(_0xa2fd('0x11'));var qs=require(_0xa2fd('0x12'));var as=require(_0xa2fd('0x13'));var hardwareService=require(_0xa2fd('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa2fd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2fd('0x16'))['db'];function respondWithStatusCode(_0x18f8af,_0x325213){_0x325213=_0x325213||0xcc;return function(_0x34e7db){if(_0x34e7db){return _0x18f8af[_0xa2fd('0x17')](_0x325213);}return _0x18f8af['status'](_0x325213)[_0xa2fd('0x18')]();};}function respondWithResult(_0x1dc6f0,_0x5123f6){_0x5123f6=_0x5123f6||0xc8;return function(_0x2f7776){if(_0x2f7776){return _0x1dc6f0['status'](_0x5123f6)[_0xa2fd('0x19')](_0x2f7776);}};}function respondWithFilteredResult(_0x4886d8,_0x43e6ac){return function(_0x10cad1){if(_0x10cad1){var _0x313830=typeof _0x43e6ac[_0xa2fd('0x1a')]==='undefined'&&typeof _0x43e6ac[_0xa2fd('0x1b')]==='undefined';var _0x2d6f75=_0x10cad1[_0xa2fd('0x1c')];var _0x374b88=_0x313830?0x0:_0x43e6ac['offset'];var _0x415834=_0x313830?_0x10cad1['count']:_0x43e6ac[_0xa2fd('0x1a')]+_0x43e6ac[_0xa2fd('0x1b')];var _0x13bf3f;if(_0x415834>=_0x2d6f75){_0x415834=_0x2d6f75;_0x13bf3f=0xc8;}else{_0x13bf3f=0xce;}_0x4886d8[_0xa2fd('0x1d')](_0x13bf3f);return _0x4886d8[_0xa2fd('0x1e')](_0xa2fd('0x1f'),_0x374b88+'-'+_0x415834+'/'+_0x2d6f75)['json'](_0x10cad1);}return null;};}function patchUpdates(_0x3399b4){return function(_0x440127){try{jsonpatch[_0xa2fd('0x20')](_0x440127,_0x3399b4,!![]);}catch(_0x514684){return BPromise[_0xa2fd('0x21')](_0x514684);}return _0x440127[_0xa2fd('0x22')]();};}function saveUpdates(_0x109408,_0x5ca752){return function(_0x5b80fe){if(_0x5b80fe){return _0x5b80fe[_0xa2fd('0x23')](_0x109408)[_0xa2fd('0x24')](function(_0x5d18ae){return _0x5d18ae;});}return null;};}function removeEntity(_0x2fa0aa,_0x56396b){return function(_0x1141c7){if(_0x1141c7){return _0x1141c7[_0xa2fd('0x25')]()[_0xa2fd('0x24')](function(){_0x2fa0aa['status'](0xcc)[_0xa2fd('0x18')]();});}};}function handleEntityNotFound(_0x1010bf,_0x1268df){return function(_0x4353ce){if(!_0x4353ce){_0x1010bf[_0xa2fd('0x17')](0x194);}return _0x4353ce;};}function handleError(_0x471b3b,_0x58d083){_0x58d083=_0x58d083||0x1f4;return function(_0x4cfacf){logger[_0xa2fd('0x26')](_0x4cfacf[_0xa2fd('0x27')]);if(_0x4cfacf['name']){delete _0x4cfacf['name'];}_0x471b3b[_0xa2fd('0x1d')](_0x58d083)['send'](_0x4cfacf);};}exports[_0xa2fd('0x28')]=function(_0x10ea80,_0x38e29c){var _0x37a131={},_0x582e8f={},_0x378bd6={'count':0x0,'rows':[]};var _0x18d5ef=_['map'](db[_0xa2fd('0x29')][_0xa2fd('0x2a')],function(_0x4855dd){return{'name':_0x4855dd[_0xa2fd('0x2b')],'type':_0x4855dd[_0xa2fd('0x2c')]['key']};});_0x582e8f[_0xa2fd('0x2d')]=_[_0xa2fd('0x2e')](_0x18d5ef,'name');_0x582e8f[_0xa2fd('0x2f')]=_[_0xa2fd('0x30')](_0x10ea80[_0xa2fd('0x2f')]);_0x582e8f[_0xa2fd('0x31')]=_[_0xa2fd('0x32')](_0x582e8f[_0xa2fd('0x2d')],_0x582e8f[_0xa2fd('0x2f')]);_0x37a131[_0xa2fd('0x33')]=_[_0xa2fd('0x32')](_0x582e8f['model'],qs['fields'](_0x10ea80['query'][_0xa2fd('0x34')]));_0x37a131[_0xa2fd('0x33')]=_0x37a131[_0xa2fd('0x33')][_0xa2fd('0x35')]?_0x37a131[_0xa2fd('0x33')]:_0x582e8f[_0xa2fd('0x2d')];if(!_0x10ea80[_0xa2fd('0x2f')]['hasOwnProperty'](_0xa2fd('0x36'))){_0x37a131[_0xa2fd('0x1b')]=qs[_0xa2fd('0x1b')](_0x10ea80['query'][_0xa2fd('0x1b')]);_0x37a131[_0xa2fd('0x1a')]=qs[_0xa2fd('0x1a')](_0x10ea80['query'][_0xa2fd('0x1a')]);}_0x37a131[_0xa2fd('0x37')]=qs[_0xa2fd('0x38')](_0x10ea80[_0xa2fd('0x2f')][_0xa2fd('0x38')]);_0x37a131[_0xa2fd('0x39')]=qs['filters'](_[_0xa2fd('0x3a')](_0x10ea80[_0xa2fd('0x2f')],_0x582e8f['filters']),_0x18d5ef);if(_0x10ea80[_0xa2fd('0x2f')]['filter']){_0x37a131[_0xa2fd('0x39')]=_['merge'](_0x37a131[_0xa2fd('0x39')],{'$or':_[_0xa2fd('0x2e')](_0x18d5ef,function(_0x339a0d){if(_0x339a0d[_0xa2fd('0x2c')]!==_0xa2fd('0x3b')){var _0x2c2c7c={};_0x2c2c7c[_0x339a0d[_0xa2fd('0x3c')]]={'$like':'%'+_0x10ea80['query'][_0xa2fd('0x3d')]+'%'};return _0x2c2c7c;}})});}_0x37a131=_['merge']({},_0x37a131,_0x10ea80['options']);var _0x550ab7={'where':_0x37a131[_0xa2fd('0x39')]};return db[_0xa2fd('0x29')][_0xa2fd('0x1c')](_0x550ab7)[_0xa2fd('0x24')](function(_0x567ae7){_0x378bd6[_0xa2fd('0x1c')]=_0x567ae7;if(_0x10ea80[_0xa2fd('0x2f')][_0xa2fd('0x3e')]){_0x37a131[_0xa2fd('0x3f')]=[{'all':!![]}];}return db[_0xa2fd('0x29')][_0xa2fd('0x40')](_0x37a131);})['then'](function(_0x1e654c){_0x378bd6[_0xa2fd('0x41')]=_0x1e654c;return _0x378bd6;})[_0xa2fd('0x24')](respondWithFilteredResult(_0x38e29c,_0x37a131))[_0xa2fd('0x42')](handleError(_0x38e29c,null));};exports[_0xa2fd('0x43')]=function(_0x46204f,_0x4eb121){var _0xf1d6ba={'raw':!![],'where':{'id':_0x46204f[_0xa2fd('0x44')]['id']}},_0x313609={};_0x313609['model']=_['keys'](db[_0xa2fd('0x29')][_0xa2fd('0x2a')]);_0x313609[_0xa2fd('0x2f')]=_[_0xa2fd('0x30')](_0x46204f[_0xa2fd('0x2f')]);_0x313609[_0xa2fd('0x31')]=_[_0xa2fd('0x32')](_0x313609[_0xa2fd('0x2d')],_0x313609['query']);_0xf1d6ba[_0xa2fd('0x33')]=_[_0xa2fd('0x32')](_0x313609[_0xa2fd('0x2d')],qs[_0xa2fd('0x34')](_0x46204f['query'][_0xa2fd('0x34')]));_0xf1d6ba[_0xa2fd('0x33')]=_0xf1d6ba[_0xa2fd('0x33')][_0xa2fd('0x35')]?_0xf1d6ba[_0xa2fd('0x33')]:_0x313609[_0xa2fd('0x2d')];if(_0x46204f[_0xa2fd('0x2f')][_0xa2fd('0x3e')]){_0xf1d6ba[_0xa2fd('0x3f')]=[{'all':!![]}];}_0xf1d6ba=_[_0xa2fd('0x45')]({},_0xf1d6ba,_0x46204f['options']);return db[_0xa2fd('0x29')]['find'](_0xf1d6ba)[_0xa2fd('0x24')](handleEntityNotFound(_0x4eb121,null))[_0xa2fd('0x24')](respondWithResult(_0x4eb121,null))['catch'](handleError(_0x4eb121,null));};exports[_0xa2fd('0x46')]=function(_0x54c528,_0x5cdf01){return db[_0xa2fd('0x29')]['create'](_0x54c528[_0xa2fd('0x47')],{})[_0xa2fd('0x24')](respondWithResult(_0x5cdf01,0xc9))[_0xa2fd('0x42')](handleError(_0x5cdf01,null));};exports[_0xa2fd('0x23')]=function(_0x1d0f2b,_0x1ce7d2){if(_0x1d0f2b['body']['id']){delete _0x1d0f2b['body']['id'];}return db[_0xa2fd('0x29')][_0xa2fd('0x48')]({'where':{'id':_0x1d0f2b['params']['id']}})[_0xa2fd('0x24')](handleEntityNotFound(_0x1ce7d2,null))[_0xa2fd('0x24')](saveUpdates(_0x1d0f2b['body'],null))['then'](respondWithResult(_0x1ce7d2,null))[_0xa2fd('0x42')](handleError(_0x1ce7d2,null));};exports[_0xa2fd('0x25')]=function(_0x92f9f5,_0x31775d){return db[_0xa2fd('0x29')][_0xa2fd('0x48')]({'where':{'id':_0x92f9f5[_0xa2fd('0x44')]['id']}})[_0xa2fd('0x24')](handleEntityNotFound(_0x31775d,null))['then'](removeEntity(_0x31775d,null))[_0xa2fd('0x42')](handleError(_0x31775d,null));};exports[_0xa2fd('0x49')]=function(_0x74dade,_0x2e01bd){return db[_0xa2fd('0x29')][_0xa2fd('0x49')]()[_0xa2fd('0x24')](respondWithResult(_0x2e01bd,null))['catch'](handleError(_0x2e01bd,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4bb52ff..05d2e06 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 _0xf350=['uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x353050,_0x263c30){var _0x3dc980=function(_0x37fbca){while(--_0x37fbca){_0x353050['push'](_0x353050['shift']());}};_0x3dc980(++_0x263c30);}(_0xf350,0x105));var _0x0f35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf350[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0f35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0f35('0x1'));var moment=require(_0x0f35('0x2'));var BPromise=require(_0x0f35('0x3'));var rp=require(_0x0f35('0x4'));var fs=require('fs');var path=require(_0x0f35('0x5'));var rimraf=require(_0x0f35('0x6'));var config=require(_0x0f35('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x557c1d,_0x348399){return _0x557c1d[_0x0f35('0x8')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x0f35('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cd=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xe2cd,0x64));var _0xde2c=function(_0x39b8a5,_0x4f5832){_0x39b8a5=_0x39b8a5-0x0;var _0x5e72ac=_0xe2cd[_0x39b8a5];return _0x5e72ac;};'use strict';var _=require(_0xde2c('0x0'));var util=require(_0xde2c('0x1'));var logger=require(_0xde2c('0x2'))(_0xde2c('0x3'));var moment=require(_0xde2c('0x4'));var BPromise=require(_0xde2c('0x5'));var rp=require(_0xde2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde2c('0x7'));var config=require(_0xde2c('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0xde2c('0x9')]=function(_0x2195fc,_0x191eb1){return _0x2195fc[_0xde2c('0xa')]('MailTransferReport',attributes,{'tableName':_0xde2c('0xb'),'paranoid':![],'indexes':[{'name':_0xde2c('0xc'),'fields':[_0xde2c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a223015..111205a 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 _0x1ce3=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring'];(function(_0xe24117,_0x527bc1){var _0x2deeaa=function(_0x51986b){while(--_0x51986b){_0xe24117['push'](_0xe24117['shift']());}};_0x2deeaa(++_0x527bc1);}(_0x1ce3,0x1b5));var _0x31ce=function(_0x563d93,_0x2eeb96){_0x563d93=_0x563d93-0x0;var _0xfb93a1=_0x1ce3[_0x563d93];return _0xfb93a1;};'use strict';var _=require(_0x31ce('0x0'));var util=require(_0x31ce('0x1'));var moment=require(_0x31ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x31ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31ce('0x5'))(_0x31ce('0x6'));var config=require(_0x31ce('0x7'));var jayson=require(_0x31ce('0x8'));var client=jayson[_0x31ce('0x9')][_0x31ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a5586,_0x33e5a2,_0x44c574){return new BPromise(function(_0x49fa51,_0x16f049){return client[_0x31ce('0xb')](_0x3a5586,_0x44c574)['then'](function(_0x534c85){logger[_0x31ce('0xc')](_0x31ce('0xd'),_0x33e5a2,'request\x20sent');logger['debug'](_0x31ce('0xe'),_0x33e5a2,_0x31ce('0xf'),JSON[_0x31ce('0x10')](_0x534c85));if(_0x534c85[_0x31ce('0x11')]){if(_0x534c85[_0x31ce('0x11')][_0x31ce('0x12')]===0x1f4){logger[_0x31ce('0x11')](_0x31ce('0xd'),_0x33e5a2,_0x534c85[_0x31ce('0x11')]['message']);return _0x16f049(_0x534c85[_0x31ce('0x11')][_0x31ce('0x13')]);}logger['error'](_0x31ce('0xd'),_0x33e5a2,_0x534c85[_0x31ce('0x11')][_0x31ce('0x13')]);return _0x49fa51(_0x534c85[_0x31ce('0x11')][_0x31ce('0x13')]);}else{logger[_0x31ce('0xc')](_0x31ce('0xd'),_0x33e5a2,'request\x20sent');_0x49fa51(_0x534c85[_0x31ce('0x14')][_0x31ce('0x13')]);}})['catch'](function(_0x297ac6){logger[_0x31ce('0x11')](_0x31ce('0xd'),_0x33e5a2,_0x297ac6);_0x16f049(_0x297ac6);});});} \ No newline at end of file +var _0x8c19=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8c19,0xbe));var _0x98c1=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8c19[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x98c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x98c1('0x1'));var fs=require('fs');var Redis=require(_0x98c1('0x2'));var db=require(_0x98c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x98c1('0x4'))('rpc');var config=require(_0x98c1('0x5'));var jayson=require(_0x98c1('0x6'));var client=jayson[_0x98c1('0x7')][_0x98c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33c717,_0x35775a,_0x3398c0){return new BPromise(function(_0x861119,_0x102696){return client[_0x98c1('0x9')](_0x33c717,_0x3398c0)[_0x98c1('0xa')](function(_0x2f6168){logger[_0x98c1('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x35775a,'request\x20sent');logger[_0x98c1('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x35775a,_0x98c1('0xd'),JSON[_0x98c1('0xe')](_0x2f6168));if(_0x2f6168[_0x98c1('0xf')]){if(_0x2f6168['error'][_0x98c1('0x10')]===0x1f4){logger['error'](_0x98c1('0x11'),_0x35775a,_0x2f6168[_0x98c1('0xf')][_0x98c1('0x12')]);return _0x102696(_0x2f6168[_0x98c1('0xf')][_0x98c1('0x12')]);}logger[_0x98c1('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x35775a,_0x2f6168[_0x98c1('0xf')][_0x98c1('0x12')]);return _0x861119(_0x2f6168[_0x98c1('0xf')][_0x98c1('0x12')]);}else{logger['info'](_0x98c1('0x11'),_0x35775a,_0x98c1('0xd'));_0x861119(_0x2f6168[_0x98c1('0x13')][_0x98c1('0x12')]);}})[_0x98c1('0x14')](function(_0x13191a){logger[_0x98c1('0xf')](_0x98c1('0x11'),_0x35775a,_0x13191a);_0x102696(_0x13191a);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ece9f23..1e6ce11 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 _0xf9e3=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x10d18,_0x38331c){var _0x409f3c=function(_0x3976ec){while(--_0x3976ec){_0x10d18['push'](_0x10d18['shift']());}};_0x409f3c(++_0x38331c);}(_0xf9e3,0xd5));var _0x3f9e=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xf9e3[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0x3f9e('0x0'));var util=require(_0x3f9e('0x1'));var path=require('path');var timeout=require(_0x3f9e('0x2'));var express=require(_0x3f9e('0x3'));var router=express[_0x3f9e('0x4')]();var fs_extra=require(_0x3f9e('0x5'));var auth=require(_0x3f9e('0x6'));var interaction=require(_0x3f9e('0x7'));var config=require(_0x3f9e('0x8'));var controller=require(_0x3f9e('0x9'));router[_0x3f9e('0xa')]('/',auth[_0x3f9e('0xb')](),controller['index']);router[_0x3f9e('0xa')](_0x3f9e('0xc'),auth[_0x3f9e('0xb')](),controller[_0x3f9e('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3f9e('0xe')]);router[_0x3f9e('0xf')]('/',auth[_0x3f9e('0xb')](),controller[_0x3f9e('0x10')]);router[_0x3f9e('0x11')](_0x3f9e('0x12'),auth[_0x3f9e('0xb')](),controller[_0x3f9e('0x13')]);router[_0x3f9e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3f9e('0x15')]=router; \ No newline at end of file +var _0xcad3=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcad3,0x163));var _0x3cad=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xcad3[_0x1aa3fe];return _0x163cee;};'use strict';var multer=require('multer');var util=require(_0x3cad('0x0'));var path=require(_0x3cad('0x1'));var timeout=require('connect-timeout');var express=require(_0x3cad('0x2'));var router=express[_0x3cad('0x3')]();var fs_extra=require(_0x3cad('0x4'));var auth=require(_0x3cad('0x5'));var interaction=require(_0x3cad('0x6'));var config=require(_0x3cad('0x7'));var controller=require(_0x3cad('0x8'));router[_0x3cad('0x9')]('/',auth[_0x3cad('0xa')](),controller['index']);router['get']('/describe',auth[_0x3cad('0xa')](),controller[_0x3cad('0xb')]);router[_0x3cad('0x9')](_0x3cad('0xc'),auth[_0x3cad('0xa')](),controller['show']);router[_0x3cad('0xd')]('/',auth[_0x3cad('0xa')](),controller[_0x3cad('0xe')]);router[_0x3cad('0xf')](_0x3cad('0xc'),auth[_0x3cad('0xa')](),controller[_0x3cad('0x10')]);router['delete'](_0x3cad('0xc'),auth['isAuthenticated'](),controller[_0x3cad('0x11')]);module[_0x3cad('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3d61703..3054c61 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 _0x9b97=['enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x8107f5,_0x1a549f){var _0xb0b835=function(_0x42f3d5){while(--_0x42f3d5){_0x8107f5['push'](_0x8107f5['shift']());}};_0xb0b835(++_0x1a549f);}(_0x9b97,0x129));var _0x79b9=function(_0x274620,_0x14d59b){_0x274620=_0x274620-0x0;var _0x498e78=_0x9b97[_0x274620];return _0x498e78;};'use strict';var Sequelize=require(_0x79b9('0x0'));var moment=require(_0x79b9('0x1'));module[_0x79b9('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x79b9('0x3')]},'interface':{'type':Sequelize[_0x79b9('0x3')]},'type':{'type':Sequelize[_0x79b9('0x3')],'defaultValue':_0x79b9('0x4'),'comment':_0x79b9('0x5')},'duration':{'type':Sequelize[_0x79b9('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x79b9('0x7')],'set':function(_0x4e154f){var _0x2bd699=moment(_0x4e154f);var _0xba787a=moment(this[_0x79b9('0x8')](_0x79b9('0x9')));var _0xfd5486=_0x2bd699[_0x79b9('0xa')](_0xba787a,'seconds');this[_0x79b9('0xb')](_0x79b9('0xc'),_0x4e154f);this['setDataValue'](_0x79b9('0xd'),_0xfd5486>=0x0?_0xfd5486:null);}},'data1':{'type':Sequelize[_0x79b9('0x3')],'comment':_0x79b9('0xe')},'data2':{'type':Sequelize[_0x79b9('0x3')],'comment':_0x79b9('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x79b9('0x10')},'data4':{'type':Sequelize[_0x79b9('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x79b9('0x6')]},'uniqueid':{'type':Sequelize[_0x79b9('0x3')]}}; \ No newline at end of file +var _0x058f=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x058f,0x136));var _0xf058=function(_0x1a8560,_0x2ba64d){_0x1a8560=_0x1a8560-0x0;var _0x3503bc=_0x058f[_0x1a8560];return _0x3503bc;};'use strict';var Sequelize=require(_0xf058('0x0'));var moment=require('moment');module[_0xf058('0x1')]={'channel':{'type':Sequelize[_0xf058('0x2')]},'membername':{'type':Sequelize[_0xf058('0x2')]},'interface':{'type':Sequelize[_0xf058('0x2')]},'type':{'type':Sequelize[_0xf058('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xf058('0x3')},'duration':{'type':Sequelize[_0xf058('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf058('0x5')],'set':function(_0x3d3630){var _0x5ba317=moment(_0x3d3630);var _0x31f648=moment(this[_0xf058('0x6')](_0xf058('0x7')));var _0x2631cb=_0x5ba317[_0xf058('0x8')](_0x31f648,_0xf058('0x9'));this['setDataValue'](_0xf058('0xa'),_0x3d3630);this['setDataValue'](_0xf058('0xb'),_0x2631cb>=0x0?_0x2631cb:null);}},'data1':{'type':Sequelize[_0xf058('0x2')],'comment':_0xf058('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xf058('0xd')},'data3':{'type':Sequelize[_0xf058('0x2')],'comment':_0xf058('0xe')},'data4':{'type':Sequelize[_0xf058('0x2')],'comment':_0xf058('0xf')},'data5':{'type':Sequelize[_0xf058('0x2')],'comment':_0xf058('0x10')},'role':{'type':Sequelize[_0xf058('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xf058('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3568f07..770e738 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x233250,_0x4aca6f){var _0x2e0879=function(_0x55d63a){while(--_0x55d63a){_0x233250['push'](_0x233250['shift']());}};_0x2e0879(++_0x4aca6f);}(_0x3e74,0x175));var _0x43e7=function(_0xe4aab8,_0x5948){_0xe4aab8=_0xe4aab8-0x0;var _0x2c91fe=_0x3e74[_0xe4aab8];return _0x2c91fe;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x34e8,0x12c));var _0x834e=function(_0x344369,_0x4f1977){_0x344369=_0x344369-0x0;var _0x159585=_0x34e8[_0x344369];return _0x159585;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 62aa5a3..2eebeb6 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 _0x8d5c=['MemberReport','membername','interface','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x2a02a1,_0x49df59){var _0x208ccc=function(_0x13eaf9){while(--_0x13eaf9){_0x2a02a1['push'](_0x2a02a1['shift']());}};_0x208ccc(++_0x49df59);}(_0x8d5c,0x71));var _0xc8d5=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0x8d5c[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0xc8d5('0x0'));var util=require('util');var logger=require(_0xc8d5('0x1'))(_0xc8d5('0x2'));var moment=require('moment');var BPromise=require(_0xc8d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8d5('0x4'));var rimraf=require('rimraf');var config=require(_0xc8d5('0x5'));var attributes=require('./memberReport.attributes');module[_0xc8d5('0x6')]=function(_0x1ab1c3,_0x1fcd09){return _0x1ab1c3[_0xc8d5('0x7')](_0xc8d5('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc8d5('0x9'),_0xc8d5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ac8=['bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x3f18fa,_0x5b43bb){var _0x5892c5=function(_0x1ba861){while(--_0x1ba861){_0x3f18fa['push'](_0x3f18fa['shift']());}};_0x5892c5(++_0x5b43bb);}(_0x3ac8,0x6b));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83ac('0x0'));var util=require(_0x83ac('0x1'));var logger=require(_0x83ac('0x2'))(_0x83ac('0x3'));var moment=require(_0x83ac('0x4'));var BPromise=require(_0x83ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83ac('0x6'));var rimraf=require(_0x83ac('0x7'));var config=require(_0x83ac('0x8'));var attributes=require(_0x83ac('0x9'));module[_0x83ac('0xa')]=function(_0x257ddc,_0x25b382){return _0x257ddc[_0x83ac('0xb')](_0x83ac('0xc'),attributes,{'tableName':_0x83ac('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x83ac('0xe'),_0x83ac('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a673f09..86b3282 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 _0x14b2=['map','model','attributes','then','debug','create','body','CreateMemberReport','catch','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include'];(function(_0x39dbb1,_0x57954f){var _0x6af434=function(_0x2bf6f1){while(--_0x2bf6f1){_0x39dbb1['push'](_0x39dbb1['shift']());}};_0x6af434(++_0x57954f);}(_0x14b2,0x1a1));var _0x214b=function(_0x3fe8db,_0x1bac7f){_0x3fe8db=_0x3fe8db-0x0;var _0x11aa8e=_0x14b2[_0x3fe8db];return _0x11aa8e;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var moment=require('moment');var BPromise=require(_0x214b('0x2'));var rs=require(_0x214b('0x3'));var fs=require('fs');var Redis=require(_0x214b('0x4'));var db=require(_0x214b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x214b('0x6'))(_0x214b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x214b('0x8')][_0x214b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30867e,_0x3003ab,_0x188bab){return new BPromise(function(_0x117ddd,_0x4cd18e){return client[_0x214b('0xa')](_0x30867e,_0x188bab)['then'](function(_0x232e01){logger['info'](_0x214b('0xb'),_0x3003ab,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x3003ab,_0x214b('0xc'),JSON[_0x214b('0xd')](_0x232e01));if(_0x232e01['error']){if(_0x232e01[_0x214b('0xe')][_0x214b('0xf')]===0x1f4){logger[_0x214b('0xe')]('MemberReport,\x20%s,\x20%s',_0x3003ab,_0x232e01[_0x214b('0xe')]['message']);return _0x4cd18e(_0x232e01['error'][_0x214b('0x10')]);}logger[_0x214b('0xe')](_0x214b('0xb'),_0x3003ab,_0x232e01[_0x214b('0xe')][_0x214b('0x10')]);return _0x117ddd(_0x232e01[_0x214b('0xe')]['message']);}else{logger[_0x214b('0x11')]('MemberReport,\x20%s,\x20%s',_0x3003ab,_0x214b('0xc'));_0x117ddd(_0x232e01[_0x214b('0x12')][_0x214b('0x10')]);}})['catch'](function(_0x4d2557){logger[_0x214b('0xe')]('MemberReport,\x20%s,\x20%s',_0x3003ab,_0x4d2557);_0x4cd18e(_0x4d2557);});});}exports[_0x214b('0x13')]=function(_0xbe4932){var _0x4d42e6=this;return new Promise(function(_0x25e18a,_0x4cc219){return db[_0x214b('0x14')][_0x214b('0x15')]({'raw':_0xbe4932[_0x214b('0x16')]?_0xbe4932['options'][_0x214b('0x17')]===undefined?!![]:![]:!![],'where':_0xbe4932[_0x214b('0x16')]?_0xbe4932[_0x214b('0x16')][_0x214b('0x18')]||null:null,'attributes':_0xbe4932[_0x214b('0x16')]?_0xbe4932['options']['attributes']||null:null,'limit':_0xbe4932[_0x214b('0x16')]?_0xbe4932[_0x214b('0x16')][_0x214b('0x19')]||null:null,'include':_0xbe4932[_0x214b('0x16')]?_0xbe4932['options'][_0x214b('0x1a')]?_[_0x214b('0x1b')](_0xbe4932[_0x214b('0x16')][_0x214b('0x1a')],function(_0x55daef){return{'model':db[_0x55daef[_0x214b('0x1c')]],'as':_0x55daef['as'],'attributes':_0x55daef[_0x214b('0x1d')],'include':_0x55daef[_0x214b('0x1a')]?_[_0x214b('0x1b')](_0x55daef[_0x214b('0x1a')],function(_0x249f66){return{'model':db[_0x249f66[_0x214b('0x1c')]],'as':_0x249f66['as'],'attributes':_0x249f66[_0x214b('0x1d')],'include':_0x249f66[_0x214b('0x1a')]?_[_0x214b('0x1b')](_0x249f66[_0x214b('0x1a')],function(_0x5a0aea){return{'model':db[_0x5a0aea['model']],'as':_0x5a0aea['as'],'attributes':_0x5a0aea[_0x214b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x214b('0x1e')](function(_0x292f9c){logger[_0x214b('0x11')]('GetMemberReport',_0xbe4932);logger[_0x214b('0x1f')](_0x214b('0x13'),_0xbe4932,JSON['stringify'](_0x292f9c));_0x25e18a(_0x292f9c);})['catch'](function(_0x411813){logger[_0x214b('0xe')](_0x214b('0x13'),_0x411813['message'],_0xbe4932);_0x4cc219(_0x4d42e6[_0x214b('0xe')](0x1f4,_0x411813['message']));});});};exports['CreateMemberReport']=function(_0x2b35cf){var _0x361ed2=this;return new Promise(function(_0xe6f444,_0x384acb){return db[_0x214b('0x14')][_0x214b('0x20')](_0x2b35cf[_0x214b('0x21')],{'raw':_0x2b35cf[_0x214b('0x16')]?_0x2b35cf['options']['raw']===undefined?!![]:![]:!![]})[_0x214b('0x1e')](function(_0x1d18e7){logger[_0x214b('0x11')](_0x214b('0x22'),_0x2b35cf);logger['debug']('CreateMemberReport',_0x2b35cf,JSON[_0x214b('0xd')](_0x1d18e7));_0xe6f444(_0x1d18e7);})[_0x214b('0x23')](function(_0x4ab9e1){logger[_0x214b('0xe')](_0x214b('0x22'),_0x4ab9e1[_0x214b('0x10')],_0x2b35cf);_0x384acb(_0x361ed2[_0x214b('0xe')](0x1f4,_0x4ab9e1[_0x214b('0x10')]));});});};exports['UpdateMemberReport']=function(_0x441b12){var _0x27326a=this;return new Promise(function(_0x4e86bb,_0x411352){return db['MemberReport']['update'](_0x441b12[_0x214b('0x21')],{'raw':_0x441b12['options']?_0x441b12[_0x214b('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441b12[_0x214b('0x16')]?_0x441b12[_0x214b('0x16')][_0x214b('0x18')]||null:null,'attributes':_0x441b12['options']?_0x441b12[_0x214b('0x16')][_0x214b('0x1d')]||null:null,'limit':_0x441b12[_0x214b('0x16')]?_0x441b12[_0x214b('0x16')][_0x214b('0x19')]||null:null})['then'](function(_0x4613e5){logger[_0x214b('0x11')](_0x214b('0x24'),_0x441b12);logger[_0x214b('0x1f')](_0x214b('0x24'),_0x441b12,JSON[_0x214b('0xd')](_0x4613e5));_0x4e86bb(_0x4613e5);})[_0x214b('0x23')](function(_0x599270){logger[_0x214b('0xe')](_0x214b('0x24'),_0x599270[_0x214b('0x10')],_0x441b12);_0x411352(_0x27326a[_0x214b('0xe')](0x1f4,_0x599270[_0x214b('0x10')]));});});}; \ No newline at end of file +var _0xc4f5=['debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','then','CreateMemberReport','create','body','stringify','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x29c8c4,_0x2cdf25){_0x29c8c4=_0x29c8c4-0x0;var _0xf11b18=_0xc4f5[_0x29c8c4];return _0xf11b18;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});}exports[_0x5c4f('0x14')]=function(_0x39f21c){var _0x3b6fcc=this;return new Promise(function(_0x35f5fa,_0x661bab){return db[_0x5c4f('0x15')][_0x5c4f('0x16')]({'raw':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'where':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')]['where']||null:null,'attributes':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x19')]||null:null,'limit':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null,'include':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1b')]?_['map'](_0x39f21c['options'][_0x5c4f('0x1b')],function(_0x45ae8c){return{'model':db[_0x45ae8c[_0x5c4f('0x1c')]],'as':_0x45ae8c['as'],'attributes':_0x45ae8c[_0x5c4f('0x19')],'include':_0x45ae8c['include']?_[_0x5c4f('0x1d')](_0x45ae8c[_0x5c4f('0x1b')],function(_0x3d4283){return{'model':db[_0x3d4283[_0x5c4f('0x1c')]],'as':_0x3d4283['as'],'attributes':_0x3d4283[_0x5c4f('0x19')],'include':_0x3d4283['include']?_[_0x5c4f('0x1d')](_0x3d4283[_0x5c4f('0x1b')],function(_0x36ca2a){return{'model':db[_0x36ca2a[_0x5c4f('0x1c')]],'as':_0x36ca2a['as'],'attributes':_0x36ca2a[_0x5c4f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5c4f('0x1e')](function(_0x5da4a0){logger[_0x5c4f('0xc')](_0x5c4f('0x14'),_0x39f21c);logger[_0x5c4f('0xf')](_0x5c4f('0x14'),_0x39f21c,JSON['stringify'](_0x5da4a0));_0x35f5fa(_0x5da4a0);})['catch'](function(_0x545b1c){logger[_0x5c4f('0x11')](_0x5c4f('0x14'),_0x545b1c[_0x5c4f('0x12')],_0x39f21c);_0x661bab(_0x3b6fcc[_0x5c4f('0x11')](0x1f4,_0x545b1c[_0x5c4f('0x12')]));});});};exports[_0x5c4f('0x1f')]=function(_0x24732e){var _0x44b2ff=this;return new Promise(function(_0x1cc74d,_0x358dca){return db[_0x5c4f('0x15')][_0x5c4f('0x20')](_0x24732e[_0x5c4f('0x21')],{'raw':_0x24732e['options']?_0x24732e['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2297f9){logger[_0x5c4f('0xc')](_0x5c4f('0x1f'),_0x24732e);logger[_0x5c4f('0xf')](_0x5c4f('0x1f'),_0x24732e,JSON[_0x5c4f('0x22')](_0x2297f9));_0x1cc74d(_0x2297f9);})[_0x5c4f('0x13')](function(_0x5da614){logger[_0x5c4f('0x11')](_0x5c4f('0x1f'),_0x5da614[_0x5c4f('0x12')],_0x24732e);_0x358dca(_0x44b2ff['error'](0x1f4,_0x5da614['message']));});});};exports['UpdateMemberReport']=function(_0xc34c59){var _0x1ffc6e=this;return new Promise(function(_0x46b020,_0x1025e2){return db[_0x5c4f('0x15')]['update'](_0xc34c59[_0x5c4f('0x21')],{'raw':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options']['where']||null:null,'attributes':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')]['attributes']||null:null,'limit':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null})[_0x5c4f('0x1e')](function(_0xcbe2b3){logger['info'](_0x5c4f('0x23'),_0xc34c59);logger['debug'](_0x5c4f('0x23'),_0xc34c59,JSON[_0x5c4f('0x22')](_0xcbe2b3));_0x46b020(_0xcbe2b3);})[_0x5c4f('0x13')](function(_0x419c1e){logger[_0x5c4f('0x11')](_0x5c4f('0x23'),_0x419c1e[_0x5c4f('0x12')],_0xc34c59);_0x1025e2(_0x1ffc6e[_0x5c4f('0x11')](0x1f4,_0x419c1e[_0x5c4f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5148ac2..bf9112d 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 _0xa2c8=['get','index','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x213e2b,_0x43ce7a){var _0x150b0b=function(_0x2db79e){while(--_0x2db79e){_0x213e2b['push'](_0x213e2b['shift']());}};_0x150b0b(++_0x43ce7a);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require(_0x8a2c('0x4'));var router=express[_0x8a2c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x8a2c('0x7')]('/',controller[_0x8a2c('0x8')]);module[_0x8a2c('0x9')]=router; \ No newline at end of file +var _0x9033=['../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x52804f,_0x5c16be){var _0x1f946b=function(_0x3856b2){while(--_0x3856b2){_0x52804f['push'](_0x52804f['shift']());}};_0x1f946b(++_0x5c16be);}(_0x9033,0xf7));var _0x3903=function(_0x1fd529,_0xc42165){_0x1fd529=_0x1fd529-0x0;var _0x34a977=_0x9033[_0x1fd529];return _0x34a977;};'use strict';var multer=require(_0x3903('0x0'));var util=require('util');var path=require(_0x3903('0x1'));var timeout=require(_0x3903('0x2'));var express=require(_0x3903('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3903('0x4'));var interaction=require(_0x3903('0x5'));var config=require(_0x3903('0x6'));var controller=require(_0x3903('0x7'));router['get']('/',controller['index']);module[_0x3903('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0febd20..a1f2f34 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 _0x6083=['sequelize','exports','version'];(function(_0x38ca04,_0xadfd87){var _0x3ee089=function(_0x2f6aa4){while(--_0x2f6aa4){_0x38ca04['push'](_0x38ca04['shift']());}};_0x3ee089(++_0xadfd87);}(_0x6083,0x9f));var _0x3608=function(_0x5ae20d,_0x515ba3){_0x5ae20d=_0x5ae20d-0x0;var _0x569cc6=_0x6083[_0x5ae20d];return _0x569cc6;};'use strict';var Sequelize=require(_0x3608('0x0'));module[_0x3608('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x3608('0x2')}}; \ No newline at end of file +var _0x65f7=['exports','STRING','sequelize'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x65f7,0xe9));var _0x765f=function(_0x160ba2,_0x5d5a8e){_0x160ba2=_0x160ba2-0x0;var _0x4a849e=_0x65f7[_0x160ba2];return _0x4a849e;};'use strict';var Sequelize=require(_0x765f('0x0'));module[_0x765f('0x1')]={'version':{'type':Sequelize[_0x765f('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b58aaf8..a570123 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 _0x9466=['name','send','index','map','Migration','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0xc721f5,_0x42404b){var _0x1bc1bd=function(_0x2870fa){while(--_0x2870fa){_0xc721f5['push'](_0xc721f5['shift']());}};_0x1bc1bd(++_0x42404b);}(_0x9466,0xa2));var _0x6946=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9466[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x6946('0x0'));var rimraf=require(_0x6946('0x1'));var zipdir=require(_0x6946('0x2'));var jsonpatch=require(_0x6946('0x3'));var rp=require(_0x6946('0x4'));var moment=require(_0x6946('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6946('0x6'));var util=require(_0x6946('0x7'));var path=require(_0x6946('0x8'));var sox=require(_0x6946('0x9'));var csv=require(_0x6946('0xa'));var ejs=require(_0x6946('0xb'));var fs=require('fs');var fs_extra=require(_0x6946('0xc'));var _=require(_0x6946('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6946('0xe'));var deskjs=require(_0x6946('0xf'));var toCsv=require(_0x6946('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6946('0x10'));var qs=require(_0x6946('0x11'));var as=require(_0x6946('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6946('0x13'))(_0x6946('0x14'));var utils=require(_0x6946('0x15'));var config=require(_0x6946('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11731b,_0x2026a6){_0x2026a6=_0x2026a6||0xcc;return function(_0x1eabe6){if(_0x1eabe6){return _0x11731b[_0x6946('0x17')](_0x2026a6);}return _0x11731b[_0x6946('0x18')](_0x2026a6)[_0x6946('0x19')]();};}function respondWithResult(_0xfb2291,_0x1d0bb2){_0x1d0bb2=_0x1d0bb2||0xc8;return function(_0x16734a){if(_0x16734a){return _0xfb2291[_0x6946('0x18')](_0x1d0bb2)[_0x6946('0x1a')](_0x16734a);}};}function respondWithFilteredResult(_0x1cc005,_0x22b53c){return function(_0x1850d5){if(_0x1850d5){var _0x870893=typeof _0x22b53c[_0x6946('0x1b')]===_0x6946('0x1c')&&typeof _0x22b53c['limit']===_0x6946('0x1c');var _0x1cd980=_0x1850d5[_0x6946('0x1d')];var _0x1fc709=_0x870893?0x0:_0x22b53c['offset'];var _0x10437a=_0x870893?_0x1850d5[_0x6946('0x1d')]:_0x22b53c['offset']+_0x22b53c[_0x6946('0x1e')];var _0x1ad4f1;if(_0x10437a>=_0x1cd980){_0x10437a=_0x1cd980;_0x1ad4f1=0xc8;}else{_0x1ad4f1=0xce;}_0x1cc005[_0x6946('0x18')](_0x1ad4f1);return _0x1cc005[_0x6946('0x1f')](_0x6946('0x20'),_0x1fc709+'-'+_0x10437a+'/'+_0x1cd980)['json'](_0x1850d5);}return null;};}function patchUpdates(_0x419ae9){return function(_0x58ba17){try{jsonpatch[_0x6946('0x21')](_0x58ba17,_0x419ae9,!![]);}catch(_0x37e536){return BPromise[_0x6946('0x22')](_0x37e536);}return _0x58ba17[_0x6946('0x23')]();};}function saveUpdates(_0x145368,_0x262238){return function(_0x3fdd4d){if(_0x3fdd4d){return _0x3fdd4d['update'](_0x145368)[_0x6946('0x24')](function(_0x3b83c4){return _0x3b83c4;});}return null;};}function removeEntity(_0x193d2e,_0x256001){return function(_0x233f1b){if(_0x233f1b){return _0x233f1b['destroy']()[_0x6946('0x24')](function(){_0x193d2e['status'](0xcc)[_0x6946('0x19')]();});}};}function handleEntityNotFound(_0x3cb065,_0x507f68){return function(_0x4e7468){if(!_0x4e7468){_0x3cb065[_0x6946('0x17')](0x194);}return _0x4e7468;};}function handleError(_0x2fb324,_0x372777){_0x372777=_0x372777||0x1f4;return function(_0x1320e9){logger[_0x6946('0x25')](_0x1320e9[_0x6946('0x26')]);if(_0x1320e9[_0x6946('0x27')]){delete _0x1320e9[_0x6946('0x27')];}_0x2fb324[_0x6946('0x18')](_0x372777)[_0x6946('0x28')](_0x1320e9);};}exports[_0x6946('0x29')]=function(_0x539e3b,_0x335912){var _0x508834={},_0x1b0e21={},_0x17fd30={'count':0x0,'rows':[]};var _0x45feda=_[_0x6946('0x2a')](db[_0x6946('0x2b')][_0x6946('0x2c')],function(_0x463793){return{'name':_0x463793[_0x6946('0x2d')],'type':_0x463793['type'][_0x6946('0x2e')]};});_0x1b0e21['model']=_[_0x6946('0x2a')](_0x45feda,_0x6946('0x27'));_0x1b0e21[_0x6946('0x2f')]=_['keys'](_0x539e3b[_0x6946('0x2f')]);_0x1b0e21[_0x6946('0x30')]=_[_0x6946('0x31')](_0x1b0e21['model'],_0x1b0e21[_0x6946('0x2f')]);_0x508834[_0x6946('0x32')]=_['intersection'](_0x1b0e21[_0x6946('0x33')],qs['fields'](_0x539e3b[_0x6946('0x2f')][_0x6946('0x34')]));_0x508834[_0x6946('0x32')]=_0x508834['attributes'][_0x6946('0x35')]?_0x508834['attributes']:_0x1b0e21[_0x6946('0x33')];if(!_0x539e3b[_0x6946('0x2f')]['hasOwnProperty'](_0x6946('0x36'))){_0x508834['limit']=qs[_0x6946('0x1e')](_0x539e3b[_0x6946('0x2f')][_0x6946('0x1e')]);_0x508834[_0x6946('0x1b')]=qs[_0x6946('0x1b')](_0x539e3b[_0x6946('0x2f')][_0x6946('0x1b')]);}_0x508834[_0x6946('0x37')]=qs['sort'](_0x539e3b[_0x6946('0x2f')][_0x6946('0x38')]);_0x508834[_0x6946('0x39')]=qs[_0x6946('0x30')](_[_0x6946('0x3a')](_0x539e3b['query'],_0x1b0e21[_0x6946('0x30')]),_0x45feda);if(_0x539e3b[_0x6946('0x2f')][_0x6946('0x3b')]){_0x508834[_0x6946('0x39')]=_[_0x6946('0x3c')](_0x508834[_0x6946('0x39')],{'$or':_['map'](_0x45feda,function(_0x325a78){if(_0x325a78[_0x6946('0x3d')]!=='VIRTUAL'){var _0x4ef17d={};_0x4ef17d[_0x325a78[_0x6946('0x27')]]={'$like':'%'+_0x539e3b[_0x6946('0x2f')][_0x6946('0x3b')]+'%'};return _0x4ef17d;}})});}_0x508834=_['merge']({},_0x508834,_0x539e3b[_0x6946('0x3e')]);var _0x399d02={'where':_0x508834[_0x6946('0x39')]};return db['Migration'][_0x6946('0x1d')](_0x399d02)[_0x6946('0x24')](function(_0x1a66ad){_0x17fd30[_0x6946('0x1d')]=_0x1a66ad;if(_0x539e3b[_0x6946('0x2f')][_0x6946('0x3f')]){_0x508834[_0x6946('0x40')]=[{'all':!![]}];}return db[_0x6946('0x2b')][_0x6946('0x41')](_0x508834);})['then'](function(_0x1198e0){_0x17fd30['rows']=_0x1198e0;return _0x17fd30;})['then'](respondWithFilteredResult(_0x335912,_0x508834))[_0x6946('0x42')](handleError(_0x335912,null));}; \ No newline at end of file +var _0x50a9=['includeAll','include','findAll','rows','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x50a9,0x1d9));var _0x950a=function(_0x21ee61,_0xc748a7){_0x21ee61=_0x21ee61-0x0;var _0x224123=_0x50a9[_0x21ee61];return _0x224123;};'use strict';var emlformat=require(_0x950a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x950a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x950a('0x2'));var BPromise=require(_0x950a('0x3'));var Mustache=require(_0x950a('0x4'));var util=require(_0x950a('0x5'));var path=require(_0x950a('0x6'));var sox=require(_0x950a('0x7'));var csv=require(_0x950a('0x8'));var ejs=require(_0x950a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x950a('0xa'));var jsforce=require(_0x950a('0xb'));var deskjs=require(_0x950a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x950a('0xd'));var Redis=require(_0x950a('0xe'));var authService=require(_0x950a('0xf'));var qs=require(_0x950a('0x10'));var as=require(_0x950a('0x11'));var hardwareService=require(_0x950a('0x12'));var logger=require(_0x950a('0x13'))(_0x950a('0x14'));var utils=require(_0x950a('0x15'));var config=require(_0x950a('0x16'));var licenseUtil=require(_0x950a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b327c,_0x5dce42){_0x5dce42=_0x5dce42||0xcc;return function(_0xee6c91){if(_0xee6c91){return _0x4b327c[_0x950a('0x18')](_0x5dce42);}return _0x4b327c[_0x950a('0x19')](_0x5dce42)['end']();};}function respondWithResult(_0x32bd90,_0x2a5856){_0x2a5856=_0x2a5856||0xc8;return function(_0xf03e04){if(_0xf03e04){return _0x32bd90[_0x950a('0x19')](_0x2a5856)[_0x950a('0x1a')](_0xf03e04);}};}function respondWithFilteredResult(_0x433e08,_0x22d7e8){return function(_0x1ef5d7){if(_0x1ef5d7){var _0x19b88=typeof _0x22d7e8[_0x950a('0x1b')]===_0x950a('0x1c')&&typeof _0x22d7e8[_0x950a('0x1d')]==='undefined';var _0x2a542c=_0x1ef5d7[_0x950a('0x1e')];var _0x398845=_0x19b88?0x0:_0x22d7e8[_0x950a('0x1b')];var _0x49b64e=_0x19b88?_0x1ef5d7['count']:_0x22d7e8['offset']+_0x22d7e8[_0x950a('0x1d')];var _0x2bdc73;if(_0x49b64e>=_0x2a542c){_0x49b64e=_0x2a542c;_0x2bdc73=0xc8;}else{_0x2bdc73=0xce;}_0x433e08[_0x950a('0x19')](_0x2bdc73);return _0x433e08[_0x950a('0x1f')](_0x950a('0x20'),_0x398845+'-'+_0x49b64e+'/'+_0x2a542c)[_0x950a('0x1a')](_0x1ef5d7);}return null;};}function patchUpdates(_0x51bc01){return function(_0xc36dfb){try{jsonpatch[_0x950a('0x21')](_0xc36dfb,_0x51bc01,!![]);}catch(_0x5377b7){return BPromise[_0x950a('0x22')](_0x5377b7);}return _0xc36dfb['save']();};}function saveUpdates(_0x46bbd9,_0x4128e3){return function(_0x3f5a72){if(_0x3f5a72){return _0x3f5a72[_0x950a('0x23')](_0x46bbd9)[_0x950a('0x24')](function(_0x2420db){return _0x2420db;});}return null;};}function removeEntity(_0x4ea7b3,_0x514023){return function(_0x429e28){if(_0x429e28){return _0x429e28['destroy']()['then'](function(){_0x4ea7b3[_0x950a('0x19')](0xcc)[_0x950a('0x25')]();});}};}function handleEntityNotFound(_0x577d7d,_0x516e99){return function(_0x5ec0c9){if(!_0x5ec0c9){_0x577d7d[_0x950a('0x18')](0x194);}return _0x5ec0c9;};}function handleError(_0x3e68f8,_0x223b87){_0x223b87=_0x223b87||0x1f4;return function(_0x14993c){logger[_0x950a('0x26')](_0x14993c[_0x950a('0x27')]);if(_0x14993c[_0x950a('0x28')]){delete _0x14993c[_0x950a('0x28')];}_0x3e68f8[_0x950a('0x19')](_0x223b87)['send'](_0x14993c);};}exports[_0x950a('0x29')]=function(_0x2b5460,_0x2f8577){var _0x3af998={},_0x1c3248={},_0x54961c={'count':0x0,'rows':[]};var _0x4e5fb7=_[_0x950a('0x2a')](db[_0x950a('0x2b')][_0x950a('0x2c')],function(_0x587225){return{'name':_0x587225[_0x950a('0x2d')],'type':_0x587225[_0x950a('0x2e')][_0x950a('0x2f')]};});_0x1c3248[_0x950a('0x30')]=_[_0x950a('0x2a')](_0x4e5fb7,_0x950a('0x28'));_0x1c3248[_0x950a('0x31')]=_['keys'](_0x2b5460[_0x950a('0x31')]);_0x1c3248[_0x950a('0x32')]=_['intersection'](_0x1c3248[_0x950a('0x30')],_0x1c3248[_0x950a('0x31')]);_0x3af998[_0x950a('0x33')]=_[_0x950a('0x34')](_0x1c3248[_0x950a('0x30')],qs[_0x950a('0x35')](_0x2b5460[_0x950a('0x31')][_0x950a('0x35')]));_0x3af998['attributes']=_0x3af998[_0x950a('0x33')][_0x950a('0x36')]?_0x3af998[_0x950a('0x33')]:_0x1c3248[_0x950a('0x30')];if(!_0x2b5460[_0x950a('0x31')]['hasOwnProperty']('nolimit')){_0x3af998[_0x950a('0x1d')]=qs[_0x950a('0x1d')](_0x2b5460[_0x950a('0x31')][_0x950a('0x1d')]);_0x3af998['offset']=qs[_0x950a('0x1b')](_0x2b5460[_0x950a('0x31')][_0x950a('0x1b')]);}_0x3af998[_0x950a('0x37')]=qs[_0x950a('0x38')](_0x2b5460['query'][_0x950a('0x38')]);_0x3af998[_0x950a('0x39')]=qs[_0x950a('0x32')](_[_0x950a('0x3a')](_0x2b5460[_0x950a('0x31')],_0x1c3248[_0x950a('0x32')]),_0x4e5fb7);if(_0x2b5460[_0x950a('0x31')][_0x950a('0x3b')]){_0x3af998[_0x950a('0x39')]=_[_0x950a('0x3c')](_0x3af998[_0x950a('0x39')],{'$or':_['map'](_0x4e5fb7,function(_0x7f208b){if(_0x7f208b[_0x950a('0x2e')]!==_0x950a('0x3d')){var _0x2c0814={};_0x2c0814[_0x7f208b['name']]={'$like':'%'+_0x2b5460[_0x950a('0x31')][_0x950a('0x3b')]+'%'};return _0x2c0814;}})});}_0x3af998=_[_0x950a('0x3c')]({},_0x3af998,_0x2b5460[_0x950a('0x3e')]);var _0x25b925={'where':_0x3af998['where']};return db[_0x950a('0x2b')]['count'](_0x25b925)['then'](function(_0xb6481a){_0x54961c['count']=_0xb6481a;if(_0x2b5460[_0x950a('0x31')][_0x950a('0x3f')]){_0x3af998[_0x950a('0x40')]=[{'all':!![]}];}return db['Migration'][_0x950a('0x41')](_0x3af998);})['then'](function(_0x829c85){_0x54961c[_0x950a('0x42')]=_0x829c85;return _0x54961c;})[_0x950a('0x24')](respondWithFilteredResult(_0x2f8577,_0x3af998))['catch'](handleError(_0x2f8577,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b31f525..ca60029 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 _0xb6aa=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','rimraf','./migration.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb6aa,0x1e8));var _0xab6a=function(_0x439c80,_0x1dba33){_0x439c80=_0x439c80-0x0;var _0x1b9824=_0xb6aa[_0x439c80];return _0x1b9824;};'use strict';var _=require(_0xab6a('0x0'));var util=require(_0xab6a('0x1'));var logger=require(_0xab6a('0x2'))(_0xab6a('0x3'));var moment=require(_0xab6a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab6a('0x5'));var config=require('../../config/environment');var attributes=require(_0xab6a('0x6'));module[_0xab6a('0x7')]=function(_0x13aa04,_0x3ab160){return _0x13aa04[_0xab6a('0x8')](_0xab6a('0x9'),attributes,{'tableName':_0xab6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe17d=['util','../../config/logger','api','moment','bluebird','rimraf','./migration.attributes','define','Migration','migrations','lodash'];(function(_0x8cd67c,_0x544f73){var _0x523e81=function(_0x3eeb7f){while(--_0x3eeb7f){_0x8cd67c['push'](_0x8cd67c['shift']());}};_0x523e81(++_0x544f73);}(_0xe17d,0x16a));var _0xde17=function(_0x1b0512,_0x49662f){_0x1b0512=_0x1b0512-0x0;var _0x5c9b85=_0xe17d[_0x1b0512];return _0x5c9b85;};'use strict';var _=require(_0xde17('0x0'));var util=require(_0xde17('0x1'));var logger=require(_0xde17('0x2'))(_0xde17('0x3'));var moment=require(_0xde17('0x4'));var BPromise=require(_0xde17('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xde17('0x6'));var config=require('../../config/environment');var attributes=require(_0xde17('0x7'));module['exports']=function(_0x4db3b3,_0x58a9b0){return _0x4db3b3[_0xde17('0x8')](_0xde17('0x9'),attributes,{'tableName':_0xde17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index c715dc5..712d5b3 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 _0xf403=['error','code','Migration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf403,0x1d3));var _0x3f40=function(_0x22eeba,_0x54f6b9){_0x22eeba=_0x22eeba-0x0;var _0x17e3ce=_0xf403[_0x22eeba];return _0x17e3ce;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var moment=require(_0x3f40('0x1'));var BPromise=require(_0x3f40('0x2'));var rs=require(_0x3f40('0x3'));var fs=require('fs');var Redis=require(_0x3f40('0x4'));var db=require(_0x3f40('0x5'))['db'];var utils=require(_0x3f40('0x6'));var logger=require(_0x3f40('0x7'))(_0x3f40('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f40('0x9')][_0x3f40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24fb9e,_0x1f21fa,_0x5878f9){return new BPromise(function(_0x1dffe8,_0x4c1694){return client['request'](_0x24fb9e,_0x5878f9)[_0x3f40('0xb')](function(_0xb4a314){logger[_0x3f40('0xc')]('Migration,\x20%s,\x20%s',_0x1f21fa,'request\x20sent');logger[_0x3f40('0xd')](_0x3f40('0xe'),_0x1f21fa,_0x3f40('0xf'),JSON['stringify'](_0xb4a314));if(_0xb4a314[_0x3f40('0x10')]){if(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x11')]===0x1f4){logger['error'](_0x3f40('0x12'),_0x1f21fa,_0xb4a314['error'][_0x3f40('0x13')]);return _0x4c1694(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}logger[_0x3f40('0x10')]('Migration,\x20%s,\x20%s',_0x1f21fa,_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);return _0x1dffe8(_0xb4a314[_0x3f40('0x10')][_0x3f40('0x13')]);}else{logger[_0x3f40('0xc')]('Migration,\x20%s,\x20%s',_0x1f21fa,_0x3f40('0xf'));_0x1dffe8(_0xb4a314[_0x3f40('0x14')]['message']);}})['catch'](function(_0x54f596){logger[_0x3f40('0x10')](_0x3f40('0x12'),_0x1f21fa,_0x54f596);_0x4c1694(_0x54f596);});});} \ No newline at end of file +var _0x534d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4e823f,_0x1eb3f9){var _0x294b36=function(_0x66ecc3){while(--_0x66ecc3){_0x4e823f['push'](_0x4e823f['shift']());}};_0x294b36(++_0x1eb3f9);}(_0x534d,0x79));var _0xd534=function(_0x5ea2fc,_0x42f0f7){_0x5ea2fc=_0x5ea2fc-0x0;var _0x587f6a=_0x534d[_0x5ea2fc];return _0x587f6a;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require(_0xd534('0x3'));var rs=require(_0xd534('0x4'));var fs=require('fs');var Redis=require(_0xd534('0x5'));var db=require(_0xd534('0x6'))['db'];var utils=require(_0xd534('0x7'));var logger=require(_0xd534('0x8'))(_0xd534('0x9'));var config=require(_0xd534('0xa'));var jayson=require(_0xd534('0xb'));var client=jayson[_0xd534('0xc')][_0xd534('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db778,_0x3c8772,_0x4419ee){return new BPromise(function(_0x1a00af,_0x2be8e1){return client['request'](_0x1db778,_0x4419ee)[_0xd534('0xe')](function(_0x37a2c8){logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,_0xd534('0x11'));logger['debug'](_0xd534('0x12'),_0x3c8772,_0xd534('0x11'),JSON[_0xd534('0x13')](_0x37a2c8));if(_0x37a2c8[_0xd534('0x14')]){if(_0x37a2c8[_0xd534('0x14')][_0xd534('0x15')]===0x1f4){logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8['error']['message']);return _0x2be8e1(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);return _0x1a00af(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}else{logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,'request\x20sent');_0x1a00af(_0x37a2c8['result'][_0xd534('0x16')]);}})[_0xd534('0x17')](function(_0x398435){logger['error']('Migration,\x20%s,\x20%s',_0x3c8772,_0x398435);_0x2be8e1(_0x398435);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 13f9928..d35f23b 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 _0x2b38=['connect-timeout','express','Router','fs-extra','./network.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2b38,0x19f));var _0x82b3=function(_0x5eb4f8,_0x11f5a6){_0x5eb4f8=_0x5eb4f8-0x0;var _0x490100=_0x2b38[_0x5eb4f8];return _0x490100;};'use strict';var multer=require(_0x82b3('0x0'));var util=require(_0x82b3('0x1'));var path=require(_0x82b3('0x2'));var timeout=require(_0x82b3('0x3'));var express=require(_0x82b3('0x4'));var router=express[_0x82b3('0x5')]();var fs_extra=require(_0x82b3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x82b3('0x7'));router['get']('/',auth[_0x82b3('0x8')](),controller['index']);router[_0x82b3('0x9')]('/:id',auth[_0x82b3('0x8')](),controller[_0x82b3('0xa')]);router[_0x82b3('0xb')]('/',auth[_0x82b3('0x8')](),controller[_0x82b3('0xc')]);router[_0x82b3('0xd')](_0x82b3('0xe'),auth['isAuthenticated'](),controller[_0x82b3('0xf')]);router[_0x82b3('0x10')](_0x82b3('0xe'),auth[_0x82b3('0x8')](),controller[_0x82b3('0x11')]);module[_0x82b3('0x12')]=router; \ No newline at end of file +var _0x8814=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','connect-timeout'];(function(_0x243cb1,_0x513406){var _0x3a3581=function(_0x3b067b){while(--_0x3b067b){_0x243cb1['push'](_0x243cb1['shift']());}};_0x3a3581(++_0x513406);}(_0x8814,0x1b8));var _0x4881=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8814[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x4881('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4881('0x1'));var express=require('express');var router=express[_0x4881('0x2')]();var fs_extra=require(_0x4881('0x3'));var auth=require(_0x4881('0x4'));var interaction=require(_0x4881('0x5'));var config=require('../../config/environment');var controller=require(_0x4881('0x6'));router[_0x4881('0x7')]('/',auth[_0x4881('0x8')](),controller[_0x4881('0x9')]);router['get'](_0x4881('0xa'),auth['isAuthenticated'](),controller[_0x4881('0xb')]);router[_0x4881('0xc')]('/',auth[_0x4881('0x8')](),controller[_0x4881('0xd')]);router['put'](_0x4881('0xa'),auth[_0x4881('0x8')](),controller['update']);router[_0x4881('0xe')](_0x4881('0xa'),auth[_0x4881('0x8')](),controller[_0x4881('0xf')]);module[_0x4881('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 29403ea..1c37927 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 _0xea96=['turn','STRING','sequelize','ENUM','externip'];(function(_0x457994,_0x219bea){var _0x5aa3b4=function(_0x584784){while(--_0x584784){_0x457994['push'](_0x457994['shift']());}};_0x5aa3b4(++_0x219bea);}(_0xea96,0x16a));var _0x6ea9=function(_0x5b1e9d,_0x676514){_0x5b1e9d=_0x5b1e9d-0x0;var _0x4ce7e8=_0xea96[_0x5b1e9d];return _0x4ce7e8;};'use strict';var Sequelize=require(_0x6ea9('0x0'));module['exports']={'type':{'type':Sequelize[_0x6ea9('0x1')]('localnet',_0x6ea9('0x2'),'stun',_0x6ea9('0x3'))},'value':{'type':Sequelize[_0x6ea9('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6ea9('0x4')]}}; \ No newline at end of file +var _0x55ce=['localnet','externip','stun','STRING','sequelize','ENUM'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0x55ce,0x6a));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xe55c('0x0'));module['exports']={'type':{'type':Sequelize[_0xe55c('0x1')](_0xe55c('0x2'),_0xe55c('0x3'),_0xe55c('0x4'),'turn')},'value':{'type':Sequelize[_0xe55c('0x5')]},'username':{'type':Sequelize[_0xe55c('0x5')]},'password':{'type':Sequelize[_0xe55c('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8e4d9c2..37d4480 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 _0x88f3=['filters','pick','filter','type','VIRTUAL','options','includeAll','show','params','include','merge','find','create','body','toUpperCase','STUN','readFileSync','join','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','findAll','server/files/templates/network.ejs','server/files/templates/stun_multiple.ejs','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','destroy','end','stack','name','map','Network','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x33ebba,_0x30bcf9){var _0x29937c=function(_0x455697){while(--_0x455697){_0x33ebba['push'](_0x33ebba['shift']());}};_0x29937c(++_0x30bcf9);}(_0x88f3,0x7c));var _0x388f=function(_0x2a8c29,_0xf8e3c9){_0x2a8c29=_0x2a8c29-0x0;var _0xe703f8=_0x88f3[_0x2a8c29];return _0xe703f8;};'use strict';var util=require('util');var path=require(_0x388f('0x0'));var ejs=require(_0x388f('0x1'));var fs=require('fs');var _=require(_0x388f('0x2'));var qs=require(_0x388f('0x3'));var logger=require(_0x388f('0x4'))(_0x388f('0x5'));var config=require(_0x388f('0x6'));var db=require(_0x388f('0x7'))['db'];var jayson=require(_0x388f('0x8'));var client=jayson[_0x388f('0x9')][_0x388f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8eaa96,_0x3edf54,_0x18fa0b,_0x1c9d00){return new Promise(function(_0x3f0401,_0x1980b8){var _0x5794b4=_0x1c9d00||client;return _0x5794b4[_0x388f('0xb')](_0x8eaa96,_0x18fa0b)[_0x388f('0xc')](function(_0x2516cb){logger[_0x388f('0xd')]('Network,\x20%s,\x20%s',_0x3edf54,_0x388f('0xe'));logger[_0x388f('0xf')](_0x388f('0x10'),_0x3edf54,_0x388f('0xe'),JSON[_0x388f('0x11')](_0x2516cb));if(_0x2516cb['error']){if(_0x2516cb[_0x388f('0x12')][_0x388f('0x13')]===0x1f4){logger[_0x388f('0x12')](_0x388f('0x14'),_0x3edf54,_0x2516cb[_0x388f('0x12')][_0x388f('0x15')]);return _0x1980b8(_0x2516cb['error'][_0x388f('0x15')]);}logger[_0x388f('0x12')]('Network,\x20%s,\x20%s',_0x3edf54,_0x2516cb[_0x388f('0x12')][_0x388f('0x15')]);return _0x3f0401(_0x2516cb[_0x388f('0x12')][_0x388f('0x15')]);}else{logger[_0x388f('0xd')]('Network,\x20%s,\x20%s',_0x3edf54,'request\x20sent');_0x3f0401(_0x2516cb[_0x388f('0x16')]['message']);}})[_0x388f('0x17')](function(_0x2d85e8){logger['error'](_0x388f('0x14'),_0x3edf54,_0x2d85e8);_0x1980b8(_0x2d85e8);});});}function respondWithResult(_0x3965a5,_0x48a4a6){_0x48a4a6=_0x48a4a6||0xc8;return function(_0x134771){if(_0x134771){return _0x3965a5['status'](_0x48a4a6)[_0x388f('0x18')](_0x134771);}};}function respondWithFilteredResult(_0x533af6,_0x42de26){return function(_0x1985af){if(_0x1985af){var _0x3bb2da=typeof _0x42de26[_0x388f('0x19')]===_0x388f('0x1a')&&typeof _0x42de26[_0x388f('0x1b')]===_0x388f('0x1a');var _0x125227=_0x1985af[_0x388f('0x1c')];var _0x2d938a=_0x3bb2da?0x0:_0x42de26[_0x388f('0x19')];var _0x206419=_0x3bb2da?_0x1985af['count']:_0x42de26[_0x388f('0x19')]+_0x42de26['limit'];var _0x245a74;if(_0x206419>=_0x125227){_0x206419=_0x125227;_0x245a74=0xc8;}else{_0x245a74=0xce;}_0x533af6[_0x388f('0x1d')](_0x245a74);return _0x533af6[_0x388f('0x1e')](_0x388f('0x1f'),_0x2d938a+'-'+_0x206419+'/'+_0x125227)[_0x388f('0x18')](_0x1985af);}return null;};}function saveUpdates(_0x415588){return function(_0x36adfd){if(_0x36adfd){return _0x36adfd['update'](_0x415588)[_0x388f('0xc')](function(_0x1124f9){return _0x1124f9;});}return null;};}function removeEntity(_0x9bb404){return function(_0x2c8f92){if(_0x2c8f92){return _0x2c8f92[_0x388f('0x20')]()[_0x388f('0xc')](function(){_0x9bb404[_0x388f('0x1d')](0xcc)[_0x388f('0x21')]();});}};}function handleEntityNotFound(_0x282237){return function(_0x55e751){if(!_0x55e751){_0x282237['sendStatus'](0x194);}return _0x55e751;};}function handleError(_0x2fe242,_0x18e3dc){_0x18e3dc=_0x18e3dc||0x1f4;return function(_0x47d108){logger[_0x388f('0x12')](_0x47d108[_0x388f('0x22')]);if(_0x47d108[_0x388f('0x23')]){delete _0x47d108['name'];}_0x2fe242[_0x388f('0x1d')](_0x18e3dc)['send'](_0x47d108);};}exports['index']=function(_0x19eb53,_0x100cfb){var _0xa4ef78={},_0x379f44={},_0x33baaa={'count':0x0,'rows':[]};var _0x48ca1a=_[_0x388f('0x24')](db[_0x388f('0x25')][_0x388f('0x26')],function(_0x5346d7){return{'name':_0x5346d7['fieldName'],'type':_0x5346d7['type'][_0x388f('0x27')]};});_0x379f44[_0x388f('0x28')]=_[_0x388f('0x24')](_0x48ca1a,'name');_0x379f44[_0x388f('0x29')]=_[_0x388f('0x2a')](_0x19eb53[_0x388f('0x29')]);_0x379f44['filters']=_[_0x388f('0x2b')](_0x379f44[_0x388f('0x28')],_0x379f44[_0x388f('0x29')]);_0xa4ef78[_0x388f('0x2c')]=_[_0x388f('0x2b')](_0x379f44['model'],qs[_0x388f('0x2d')](_0x19eb53['query'][_0x388f('0x2d')]));_0xa4ef78[_0x388f('0x2c')]=_0xa4ef78[_0x388f('0x2c')][_0x388f('0x2e')]?_0xa4ef78[_0x388f('0x2c')]:_0x379f44['model'];if(!_0x19eb53[_0x388f('0x29')][_0x388f('0x2f')](_0x388f('0x30'))){_0xa4ef78[_0x388f('0x1b')]=qs[_0x388f('0x1b')](_0x19eb53[_0x388f('0x29')]['limit']);_0xa4ef78[_0x388f('0x19')]=qs['offset'](_0x19eb53[_0x388f('0x29')][_0x388f('0x19')]);}_0xa4ef78[_0x388f('0x31')]=qs[_0x388f('0x32')](_0x19eb53[_0x388f('0x29')]['sort']);_0xa4ef78[_0x388f('0x33')]=qs[_0x388f('0x34')](_[_0x388f('0x35')](_0x19eb53[_0x388f('0x29')],_0x379f44['filters']),_0x48ca1a);if(_0x19eb53[_0x388f('0x29')][_0x388f('0x36')]){_0xa4ef78[_0x388f('0x33')]=_['merge'](_0xa4ef78[_0x388f('0x33')],{'$or':_['map'](_0x48ca1a,function(_0x425ab3){if(_0x425ab3[_0x388f('0x37')]!==_0x388f('0x38')){var _0xda2268={};_0xda2268[_0x425ab3[_0x388f('0x23')]]={'$like':'%'+_0x19eb53[_0x388f('0x29')][_0x388f('0x36')]+'%'};return _0xda2268;}})});}_0xa4ef78=_['merge']({},_0xa4ef78,_0x19eb53[_0x388f('0x39')]);var _0x2f95b7={'where':_0xa4ef78[_0x388f('0x33')]};return db[_0x388f('0x25')][_0x388f('0x1c')](_0x2f95b7)[_0x388f('0xc')](function(_0xad9ca8){_0x33baaa['count']=_0xad9ca8;if(_0x19eb53[_0x388f('0x29')][_0x388f('0x3a')]){_0xa4ef78['include']=[{'all':!![]}];}return db['Network']['findAll'](_0xa4ef78);})[_0x388f('0xc')](function(_0x1dd9b4){_0x33baaa['rows']=_0x1dd9b4;return _0x33baaa;})[_0x388f('0xc')](respondWithFilteredResult(_0x100cfb,_0xa4ef78))[_0x388f('0x17')](handleError(_0x100cfb,null));};exports[_0x388f('0x3b')]=function(_0x3e678b,_0xcc1f28){var _0x599e98={'raw':!![],'where':{'id':_0x3e678b[_0x388f('0x3c')]['id']}},_0x4bffe1={};_0x4bffe1[_0x388f('0x28')]=_[_0x388f('0x2a')](db[_0x388f('0x25')][_0x388f('0x26')]);_0x4bffe1[_0x388f('0x29')]=_['keys'](_0x3e678b[_0x388f('0x29')]);_0x4bffe1[_0x388f('0x34')]=_[_0x388f('0x2b')](_0x4bffe1[_0x388f('0x28')],_0x4bffe1[_0x388f('0x29')]);_0x599e98[_0x388f('0x2c')]=_[_0x388f('0x2b')](_0x4bffe1[_0x388f('0x28')],qs['fields'](_0x3e678b[_0x388f('0x29')][_0x388f('0x2d')]));_0x599e98[_0x388f('0x2c')]=_0x599e98[_0x388f('0x2c')][_0x388f('0x2e')]?_0x599e98[_0x388f('0x2c')]:_0x4bffe1[_0x388f('0x28')];if(_0x3e678b[_0x388f('0x29')][_0x388f('0x3a')]){_0x599e98[_0x388f('0x3d')]=[{'all':!![]}];}_0x599e98=_[_0x388f('0x3e')]({},_0x599e98,_0x3e678b[_0x388f('0x39')]);return db[_0x388f('0x25')][_0x388f('0x3f')](_0x599e98)[_0x388f('0xc')](handleEntityNotFound(_0xcc1f28,null))['then'](respondWithResult(_0xcc1f28,null))[_0x388f('0x17')](handleError(_0xcc1f28,null));};exports[_0x388f('0x40')]=function(_0x168e1c,_0x279ee9){var _0x449acb;return db[_0x388f('0x25')]['create'](_0x168e1c[_0x388f('0x41')],{'raw':!![]})[_0x388f('0xc')](function(_0x446d6c){_0x449acb=_0x446d6c;return db['Network']['findAll']({'where':{'type':_0x168e1c[_0x388f('0x41')][_0x388f('0x37')]},'raw':!![]});})['then'](function(_0x1c0cc1){if(_0x449acb['type'][_0x388f('0x42')]()==_0x388f('0x43')){var _0x587628=fs[_0x388f('0x44')](path[_0x388f('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x388f('0x46'));var _0x5110a2=ejs[_0x388f('0x47')](_0x587628,{'networks':_0x1c0cc1||[]});fs['writeFileSync'](_0x388f('0x48'),_0x5110a2);return respondWithRpcPromise(_0x388f('0x49'),_0x388f('0x40'),{'module':_0x388f('0x4a')});}else if(_0x449acb[_0x388f('0x37')][_0x388f('0x42')]()==_0x388f('0x4b')){var _0x36c621=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],_0x388f('0x4d')),_0x388f('0x46'));var _0x2f4802=ejs[_0x388f('0x47')](_0x36c621,{'networks':_0x1c0cc1||[]});fs[_0x388f('0x4e')](_0x388f('0x4f'),_0x2f4802);return respondWithRpcPromise(_0x388f('0x49'),'create',{'module':_0x388f('0x4a')});}else{var _0x51f609=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x21d8c2=ejs[_0x388f('0x47')](_0x51f609,{'networks':_0x1c0cc1||[]});fs[_0x388f('0x4e')](util[_0x388f('0x50')](_0x388f('0x51'),_0x168e1c['body'][_0x388f('0x37')][_0x388f('0x52')]()),_0x21d8c2);return respondWithRpcPromise(_0x388f('0x49'),_0x388f('0x40'),{'module':_0x388f('0x53')});}})[_0x388f('0xc')](function(){return _0x449acb;})[_0x388f('0xc')](respondWithResult(_0x279ee9,0xc9))[_0x388f('0x17')](handleError(_0x279ee9,null));};exports[_0x388f('0x54')]=function(_0x3b499a,_0x2b4d0f){var _0x44c558;return db[_0x388f('0x25')][_0x388f('0x3f')]({'where':{'id':_0x3b499a[_0x388f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2b4d0f,null))[_0x388f('0xc')](saveUpdates(_0x3b499a[_0x388f('0x41')],null))[_0x388f('0xc')](function(_0x1f324d){if(_0x1f324d){_0x44c558=_0x1f324d;return db[_0x388f('0x25')][_0x388f('0x55')]({'where':{'type':_0x44c558['type']},'raw':!![]});}return null;})['then'](function(_0x497fb6){if(_0x44c558[_0x388f('0x37')][_0x388f('0x42')]()=='STUN'){var _0x5a7479=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],'server/files/templates/stun_multiple.ejs'),_0x388f('0x46'));var _0x20ad32=ejs[_0x388f('0x47')](_0x5a7479,{'networks':_0x497fb6||[]});fs[_0x388f('0x4e')]('/etc/asterisk/stun_xcally.conf',_0x20ad32);return respondWithRpcPromise(_0x388f('0x49'),'update',{'module':_0x388f('0x4a')});}else if(_0x44c558[_0x388f('0x37')][_0x388f('0x42')]()==_0x388f('0x4b')){var _0x396ad1=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],_0x388f('0x4d')),_0x388f('0x46'));var _0x2e71a9=ejs[_0x388f('0x47')](_0x396ad1,{'networks':_0x497fb6||[]});fs[_0x388f('0x4e')](_0x388f('0x4f'),_0x2e71a9);return respondWithRpcPromise(_0x388f('0x49'),_0x388f('0x54'),{'module':_0x388f('0x4a')});}else{var _0x2fa307=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],_0x388f('0x56')),_0x388f('0x46'));var _0x46a4cf=ejs['render'](_0x2fa307,{'networks':_0x497fb6||[]});fs['writeFileSync'](util[_0x388f('0x50')](_0x388f('0x51'),_0x3b499a[_0x388f('0x41')][_0x388f('0x37')][_0x388f('0x52')]()),_0x46a4cf);return respondWithRpcPromise('Reload',_0x388f('0x54'),{'module':_0x388f('0x53')});}})[_0x388f('0xc')](function(_0x38233d){if(_0x38233d){return _0x44c558;}return null;})[_0x388f('0xc')](respondWithResult(_0x2b4d0f,null))[_0x388f('0x17')](handleError(_0x2b4d0f,null));};exports[_0x388f('0x20')]=function(_0x205ca6,_0x543c56){var _0x3d5c1c;return db[_0x388f('0x25')][_0x388f('0x3f')]({'where':{'id':_0x205ca6['params']['id']}})[_0x388f('0xc')](function(_0x2d38b2){_0x3d5c1c=_0x2d38b2;return _0x2d38b2;})[_0x388f('0xc')](handleEntityNotFound(_0x543c56,null))[_0x388f('0xc')](removeEntity(_0x543c56,null))[_0x388f('0xc')](function(){if(_0x3d5c1c){return db[_0x388f('0x25')][_0x388f('0x55')]({'where':{'type':_0x3d5c1c[_0x388f('0x37')]},'raw':!![]});}})[_0x388f('0xc')](function(_0x4e592f){if(_0x3d5c1c[_0x388f('0x37')][_0x388f('0x42')]()=='STUN'){var _0x5d41db=fs[_0x388f('0x44')](path[_0x388f('0x45')](config[_0x388f('0x4c')],_0x388f('0x57')),_0x388f('0x46'));var _0x265bf4=ejs[_0x388f('0x47')](_0x5d41db,{'networks':_0x4e592f||[]});fs['writeFileSync'](_0x388f('0x48'),_0x265bf4);return respondWithRpcPromise('Reload',_0x388f('0x20'),{'module':_0x388f('0x4a')});}else if(_0x3d5c1c[_0x388f('0x37')][_0x388f('0x42')]()=='TURN'){var _0x1d557c=fs[_0x388f('0x44')](path['join'](config['root'],_0x388f('0x4d')),_0x388f('0x46'));var _0x5d1a50=ejs[_0x388f('0x47')](_0x1d557c,{'networks':_0x4e592f||[]});fs['writeFileSync'](_0x388f('0x4f'),_0x5d1a50);return respondWithRpcPromise(_0x388f('0x49'),_0x388f('0x20'),{'module':_0x388f('0x4a')});}else{var _0x316d2f=fs[_0x388f('0x44')](path[_0x388f('0x45')](config['root'],_0x388f('0x56')),_0x388f('0x46'));var _0x55fa58=ejs[_0x388f('0x47')](_0x316d2f,{'networks':_0x4e592f||[]});fs['writeFileSync'](util['format'](_0x388f('0x51'),_0x3d5c1c[_0x388f('0x37')][_0x388f('0x52')]()),_0x55fa58);return respondWithRpcPromise(_0x388f('0x49'),_0x388f('0x20'),{'module':_0x388f('0x53')});}})[_0x388f('0x17')](handleError(_0x543c56,null));}; \ No newline at end of file +var _0x08a7=['/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','util','path','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','options','Network','includeAll','include','findAll','rows','show','params','length','merge','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','utf8'];(function(_0x143401,_0x35457b){var _0x23ab50=function(_0x29f04a){while(--_0x29f04a){_0x143401['push'](_0x143401['shift']());}};_0x23ab50(++_0x35457b);}(_0x08a7,0x10b));var _0x708a=function(_0x5776b7,_0x1f70c1){_0x5776b7=_0x5776b7-0x0;var _0x432c2d=_0x08a7[_0x5776b7];return _0x432c2d;};'use strict';var util=require(_0x708a('0x0'));var path=require(_0x708a('0x1'));var ejs=require(_0x708a('0x2'));var fs=require('fs');var _=require(_0x708a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x708a('0x4'))(_0x708a('0x5'));var config=require(_0x708a('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x708a('0x7'));var client=jayson[_0x708a('0x8')][_0x708a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x909390,_0x182e0d,_0x20c428,_0x65b700){return new Promise(function(_0x1e1925,_0x1eb585){var _0x5ea797=_0x65b700||client;return _0x5ea797[_0x708a('0xa')](_0x909390,_0x20c428)[_0x708a('0xb')](function(_0x50ed6f){logger[_0x708a('0xc')](_0x708a('0xd'),_0x182e0d,'request\x20sent');logger[_0x708a('0xe')](_0x708a('0xf'),_0x182e0d,'request\x20sent',JSON[_0x708a('0x10')](_0x50ed6f));if(_0x50ed6f[_0x708a('0x11')]){if(_0x50ed6f['error']['code']===0x1f4){logger[_0x708a('0x11')](_0x708a('0xd'),_0x182e0d,_0x50ed6f[_0x708a('0x11')]['message']);return _0x1eb585(_0x50ed6f[_0x708a('0x11')]['message']);}logger[_0x708a('0x11')](_0x708a('0xd'),_0x182e0d,_0x50ed6f['error'][_0x708a('0x12')]);return _0x1e1925(_0x50ed6f['error']['message']);}else{logger[_0x708a('0xc')](_0x708a('0xd'),_0x182e0d,_0x708a('0x13'));_0x1e1925(_0x50ed6f[_0x708a('0x14')]['message']);}})[_0x708a('0x15')](function(_0x2bffaf){logger[_0x708a('0x11')](_0x708a('0xd'),_0x182e0d,_0x2bffaf);_0x1eb585(_0x2bffaf);});});}function respondWithResult(_0x158dae,_0x14d47c){_0x14d47c=_0x14d47c||0xc8;return function(_0x10523a){if(_0x10523a){return _0x158dae[_0x708a('0x16')](_0x14d47c)[_0x708a('0x17')](_0x10523a);}};}function respondWithFilteredResult(_0xf11ac1,_0x30e1a6){return function(_0x4fd178){if(_0x4fd178){var _0xd292b=typeof _0x30e1a6[_0x708a('0x18')]===_0x708a('0x19')&&typeof _0x30e1a6['limit']==='undefined';var _0x478ae5=_0x4fd178['count'];var _0x3a7c41=_0xd292b?0x0:_0x30e1a6[_0x708a('0x18')];var _0x5a91f8=_0xd292b?_0x4fd178[_0x708a('0x1a')]:_0x30e1a6['offset']+_0x30e1a6[_0x708a('0x1b')];var _0x1f776d;if(_0x5a91f8>=_0x478ae5){_0x5a91f8=_0x478ae5;_0x1f776d=0xc8;}else{_0x1f776d=0xce;}_0xf11ac1[_0x708a('0x16')](_0x1f776d);return _0xf11ac1[_0x708a('0x1c')](_0x708a('0x1d'),_0x3a7c41+'-'+_0x5a91f8+'/'+_0x478ae5)[_0x708a('0x17')](_0x4fd178);}return null;};}function saveUpdates(_0x355545){return function(_0xa62ff8){if(_0xa62ff8){return _0xa62ff8[_0x708a('0x1e')](_0x355545)[_0x708a('0xb')](function(_0x281f5d){return _0x281f5d;});}return null;};}function removeEntity(_0x40e78d){return function(_0x1b08be){if(_0x1b08be){return _0x1b08be[_0x708a('0x1f')]()[_0x708a('0xb')](function(){_0x40e78d[_0x708a('0x16')](0xcc)[_0x708a('0x20')]();});}};}function handleEntityNotFound(_0x34f057){return function(_0x1f6ef3){if(!_0x1f6ef3){_0x34f057['sendStatus'](0x194);}return _0x1f6ef3;};}function handleError(_0x1b0c26,_0x461cd7){_0x461cd7=_0x461cd7||0x1f4;return function(_0x31ce4d){logger[_0x708a('0x11')](_0x31ce4d[_0x708a('0x21')]);if(_0x31ce4d['name']){delete _0x31ce4d[_0x708a('0x22')];}_0x1b0c26[_0x708a('0x16')](_0x461cd7)['send'](_0x31ce4d);};}exports[_0x708a('0x23')]=function(_0x2713b3,_0xf60c29){var _0x307e60={},_0x3b35cd={},_0x5e6a88={'count':0x0,'rows':[]};var _0x2d0772=_['map'](db['Network'][_0x708a('0x24')],function(_0x26fdb5){return{'name':_0x26fdb5['fieldName'],'type':_0x26fdb5[_0x708a('0x25')][_0x708a('0x26')]};});_0x3b35cd[_0x708a('0x27')]=_['map'](_0x2d0772,_0x708a('0x22'));_0x3b35cd[_0x708a('0x28')]=_[_0x708a('0x29')](_0x2713b3[_0x708a('0x28')]);_0x3b35cd[_0x708a('0x2a')]=_[_0x708a('0x2b')](_0x3b35cd[_0x708a('0x27')],_0x3b35cd[_0x708a('0x28')]);_0x307e60[_0x708a('0x2c')]=_['intersection'](_0x3b35cd[_0x708a('0x27')],qs[_0x708a('0x2d')](_0x2713b3[_0x708a('0x28')][_0x708a('0x2d')]));_0x307e60[_0x708a('0x2c')]=_0x307e60['attributes']['length']?_0x307e60[_0x708a('0x2c')]:_0x3b35cd['model'];if(!_0x2713b3['query'][_0x708a('0x2e')](_0x708a('0x2f'))){_0x307e60[_0x708a('0x1b')]=qs['limit'](_0x2713b3[_0x708a('0x28')]['limit']);_0x307e60[_0x708a('0x18')]=qs[_0x708a('0x18')](_0x2713b3[_0x708a('0x28')][_0x708a('0x18')]);}_0x307e60[_0x708a('0x30')]=qs[_0x708a('0x31')](_0x2713b3[_0x708a('0x28')][_0x708a('0x31')]);_0x307e60['where']=qs[_0x708a('0x2a')](_[_0x708a('0x32')](_0x2713b3[_0x708a('0x28')],_0x3b35cd[_0x708a('0x2a')]),_0x2d0772);if(_0x2713b3[_0x708a('0x28')][_0x708a('0x33')]){_0x307e60['where']=_['merge'](_0x307e60[_0x708a('0x34')],{'$or':_[_0x708a('0x35')](_0x2d0772,function(_0x59d0ee){if(_0x59d0ee[_0x708a('0x25')]!=='VIRTUAL'){var _0x1f6a68={};_0x1f6a68[_0x59d0ee[_0x708a('0x22')]]={'$like':'%'+_0x2713b3[_0x708a('0x28')][_0x708a('0x33')]+'%'};return _0x1f6a68;}})});}_0x307e60=_['merge']({},_0x307e60,_0x2713b3[_0x708a('0x36')]);var _0x1dfe17={'where':_0x307e60[_0x708a('0x34')]};return db[_0x708a('0x37')][_0x708a('0x1a')](_0x1dfe17)['then'](function(_0x342a81){_0x5e6a88[_0x708a('0x1a')]=_0x342a81;if(_0x2713b3[_0x708a('0x28')][_0x708a('0x38')]){_0x307e60[_0x708a('0x39')]=[{'all':!![]}];}return db['Network'][_0x708a('0x3a')](_0x307e60);})[_0x708a('0xb')](function(_0x12b840){_0x5e6a88[_0x708a('0x3b')]=_0x12b840;return _0x5e6a88;})[_0x708a('0xb')](respondWithFilteredResult(_0xf60c29,_0x307e60))['catch'](handleError(_0xf60c29,null));};exports[_0x708a('0x3c')]=function(_0x193d6a,_0x2782eb){var _0x241688={'raw':!![],'where':{'id':_0x193d6a[_0x708a('0x3d')]['id']}},_0x300678={};_0x300678[_0x708a('0x27')]=_[_0x708a('0x29')](db['Network'][_0x708a('0x24')]);_0x300678['query']=_[_0x708a('0x29')](_0x193d6a['query']);_0x300678['filters']=_['intersection'](_0x300678[_0x708a('0x27')],_0x300678[_0x708a('0x28')]);_0x241688[_0x708a('0x2c')]=_[_0x708a('0x2b')](_0x300678['model'],qs[_0x708a('0x2d')](_0x193d6a[_0x708a('0x28')][_0x708a('0x2d')]));_0x241688[_0x708a('0x2c')]=_0x241688['attributes'][_0x708a('0x3e')]?_0x241688[_0x708a('0x2c')]:_0x300678[_0x708a('0x27')];if(_0x193d6a['query'][_0x708a('0x38')]){_0x241688[_0x708a('0x39')]=[{'all':!![]}];}_0x241688=_[_0x708a('0x3f')]({},_0x241688,_0x193d6a[_0x708a('0x36')]);return db['Network'][_0x708a('0x40')](_0x241688)[_0x708a('0xb')](handleEntityNotFound(_0x2782eb,null))[_0x708a('0xb')](respondWithResult(_0x2782eb,null))[_0x708a('0x15')](handleError(_0x2782eb,null));};exports['create']=function(_0x306ff1,_0x5b19ff){var _0xce2646;return db[_0x708a('0x37')][_0x708a('0x41')](_0x306ff1[_0x708a('0x42')],{'raw':!![]})[_0x708a('0xb')](function(_0xafb38c){_0xce2646=_0xafb38c;return db['Network']['findAll']({'where':{'type':_0x306ff1[_0x708a('0x42')][_0x708a('0x25')]},'raw':!![]});})[_0x708a('0xb')](function(_0x3ee553){if(_0xce2646[_0x708a('0x25')]['toUpperCase']()==_0x708a('0x43')){var _0x67c926=fs[_0x708a('0x44')](path[_0x708a('0x45')](config[_0x708a('0x46')],_0x708a('0x47')),'utf8');var _0x408030=ejs[_0x708a('0x48')](_0x67c926,{'networks':_0x3ee553||[]});fs[_0x708a('0x49')](_0x708a('0x4a'),_0x408030);return respondWithRpcPromise(_0x708a('0x4b'),_0x708a('0x41'),{'module':_0x708a('0x4c')});}else if(_0xce2646['type'][_0x708a('0x4d')]()==_0x708a('0x4e')){var _0x4a91c6=fs[_0x708a('0x44')](path['join'](config['root'],_0x708a('0x4f')),_0x708a('0x50'));var _0x537dfb=ejs[_0x708a('0x48')](_0x4a91c6,{'networks':_0x3ee553||[]});fs['writeFileSync'](_0x708a('0x51'),_0x537dfb);return respondWithRpcPromise('Reload',_0x708a('0x41'),{'module':_0x708a('0x4c')});}else{var _0x3c537a=fs[_0x708a('0x44')](path[_0x708a('0x45')](config[_0x708a('0x46')],_0x708a('0x52')),'utf8');var _0x517600=ejs[_0x708a('0x48')](_0x3c537a,{'networks':_0x3ee553||[]});fs[_0x708a('0x49')](util[_0x708a('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x306ff1['body'][_0x708a('0x25')][_0x708a('0x54')]()),_0x517600);return respondWithRpcPromise(_0x708a('0x4b'),_0x708a('0x41'),{'module':_0x708a('0x55')});}})[_0x708a('0xb')](function(){return _0xce2646;})[_0x708a('0xb')](respondWithResult(_0x5b19ff,0xc9))[_0x708a('0x15')](handleError(_0x5b19ff,null));};exports[_0x708a('0x1e')]=function(_0x324866,_0x34c002){var _0x27517b;return db[_0x708a('0x37')][_0x708a('0x40')]({'where':{'id':_0x324866['params']['id']}})[_0x708a('0xb')](handleEntityNotFound(_0x34c002,null))[_0x708a('0xb')](saveUpdates(_0x324866[_0x708a('0x42')],null))['then'](function(_0x55a788){if(_0x55a788){_0x27517b=_0x55a788;return db['Network'][_0x708a('0x3a')]({'where':{'type':_0x27517b['type']},'raw':!![]});}return null;})[_0x708a('0xb')](function(_0x8c6bf7){if(_0x27517b[_0x708a('0x25')]['toUpperCase']()==_0x708a('0x43')){var _0x28e6ab=fs['readFileSync'](path[_0x708a('0x45')](config[_0x708a('0x46')],_0x708a('0x47')),_0x708a('0x50'));var _0xc54fde=ejs[_0x708a('0x48')](_0x28e6ab,{'networks':_0x8c6bf7||[]});fs[_0x708a('0x49')]('/etc/asterisk/stun_xcally.conf',_0xc54fde);return respondWithRpcPromise(_0x708a('0x4b'),_0x708a('0x1e'),{'module':_0x708a('0x4c')});}else if(_0x27517b[_0x708a('0x25')][_0x708a('0x4d')]()==_0x708a('0x4e')){var _0xa86426=fs[_0x708a('0x44')](path['join'](config[_0x708a('0x46')],_0x708a('0x4f')),_0x708a('0x50'));var _0x14d9c5=ejs[_0x708a('0x48')](_0xa86426,{'networks':_0x8c6bf7||[]});fs[_0x708a('0x49')](_0x708a('0x51'),_0x14d9c5);return respondWithRpcPromise('Reload',_0x708a('0x1e'),{'module':_0x708a('0x4c')});}else{var _0x35857f=fs[_0x708a('0x44')](path[_0x708a('0x45')](config['root'],_0x708a('0x52')),_0x708a('0x50'));var _0x44872b=ejs['render'](_0x35857f,{'networks':_0x8c6bf7||[]});fs[_0x708a('0x49')](util[_0x708a('0x53')](_0x708a('0x56'),_0x324866[_0x708a('0x42')]['type'][_0x708a('0x54')]()),_0x44872b);return respondWithRpcPromise('Reload',_0x708a('0x1e'),{'module':_0x708a('0x55')});}})[_0x708a('0xb')](function(_0x696d9e){if(_0x696d9e){return _0x27517b;}return null;})[_0x708a('0xb')](respondWithResult(_0x34c002,null))[_0x708a('0x15')](handleError(_0x34c002,null));};exports['destroy']=function(_0x173011,_0x4def77){var _0x56ace8;return db[_0x708a('0x37')][_0x708a('0x40')]({'where':{'id':_0x173011[_0x708a('0x3d')]['id']}})[_0x708a('0xb')](function(_0x4aad5e){_0x56ace8=_0x4aad5e;return _0x4aad5e;})[_0x708a('0xb')](handleEntityNotFound(_0x4def77,null))['then'](removeEntity(_0x4def77,null))[_0x708a('0xb')](function(){if(_0x56ace8){return db[_0x708a('0x37')][_0x708a('0x3a')]({'where':{'type':_0x56ace8[_0x708a('0x25')]},'raw':!![]});}})[_0x708a('0xb')](function(_0x1f066f){if(_0x56ace8[_0x708a('0x25')][_0x708a('0x4d')]()=='STUN'){var _0x4dcf1e=fs['readFileSync'](path[_0x708a('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x708a('0x50'));var _0x467f8d=ejs[_0x708a('0x48')](_0x4dcf1e,{'networks':_0x1f066f||[]});fs[_0x708a('0x49')](_0x708a('0x4a'),_0x467f8d);return respondWithRpcPromise('Reload',_0x708a('0x1f'),{'module':_0x708a('0x4c')});}else if(_0x56ace8[_0x708a('0x25')][_0x708a('0x4d')]()==_0x708a('0x4e')){var _0x3ef44b=fs[_0x708a('0x44')](path[_0x708a('0x45')](config[_0x708a('0x46')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2a5c0c=ejs[_0x708a('0x48')](_0x3ef44b,{'networks':_0x1f066f||[]});fs[_0x708a('0x49')]('/etc/asterisk/turn_xcally.conf',_0x2a5c0c);return respondWithRpcPromise(_0x708a('0x4b'),_0x708a('0x1f'),{'module':_0x708a('0x4c')});}else{var _0x571e8e=fs[_0x708a('0x44')](path[_0x708a('0x45')](config[_0x708a('0x46')],'server/files/templates/network.ejs'),'utf8');var _0x324e35=ejs['render'](_0x571e8e,{'networks':_0x1f066f||[]});fs['writeFileSync'](util[_0x708a('0x53')](_0x708a('0x56'),_0x56ace8[_0x708a('0x25')][_0x708a('0x54')]()),_0x324e35);return respondWithRpcPromise('Reload','destroy',{'module':_0x708a('0x55')});}})['catch'](handleError(_0x4def77,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 0ea0326..e8bfff6 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 _0xd382=['request-promise','path','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x4ed4ae,_0x3d7582){_0x4ed4ae=_0x4ed4ae-0x0;var _0x251f12=_0xd382[_0x4ed4ae];return _0x251f12;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('Network',attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x180f=['../../config/environment','./network.attributes','network','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2e6c1f,_0x241d49){var _0xa23058=function(_0x18ca74){while(--_0x18ca74){_0x2e6c1f['push'](_0x2e6c1f['shift']());}};_0xa23058(++_0x241d49);}(_0x180f,0xf3));var _0xf180=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x180f[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var logger=require('../../config/logger')(_0xf180('0x2'));var moment=require(_0xf180('0x3'));var BPromise=require('bluebird');var rp=require(_0xf180('0x4'));var fs=require('fs');var path=require(_0xf180('0x5'));var rimraf=require(_0xf180('0x6'));var config=require(_0xf180('0x7'));var attributes=require(_0xf180('0x8'));module['exports']=function(_0x2ef675,_0x3c6552){return _0x2ef675['define']('Network',attributes,{'tableName':_0xf180('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 dfa4389..d64ff1e 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x3f6a3c,_0x225730){_0x3f6a3c=_0x3f6a3c-0x0;var _0x1a4c6b=_0x7a54[_0x3f6a3c];return _0x1a4c6b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x162a0e,_0x43a004){_0x162a0e=_0x162a0e-0x0;var _0x571573=_0x7a54[_0x162a0e];return _0x571573;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 428950d..88d6122 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 _0x848d=['../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','get','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','util','path','express','fs-extra'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x848d,0x80));var _0xd848=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x848d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd848('0x0'));var path=require(_0xd848('0x1'));var timeout=require('connect-timeout');var express=require(_0xd848('0x2'));var router=express['Router']();var fs_extra=require(_0xd848('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd848('0x4'));var config=require(_0xd848('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xd848('0x6')](),controller[_0xd848('0x7')]);router['get'](_0xd848('0x8'),auth[_0xd848('0x6')](),controller['describe']);router['get'](_0xd848('0x9'),auth[_0xd848('0x6')](),controller[_0xd848('0xa')]);router['get'](_0xd848('0xb'),auth[_0xd848('0x6')](),controller[_0xd848('0xc')]);router[_0xd848('0xd')]('/:id/canned_answers',auth[_0xd848('0x6')](),controller[_0xd848('0xe')]);router[_0xd848('0xd')](_0xd848('0xf'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xd848('0x10'),auth[_0xd848('0x6')](),controller[_0xd848('0x11')]);router['get'](_0xd848('0x12'),auth[_0xd848('0x6')](),controller[_0xd848('0x13')]);router[_0xd848('0x14')]('/',auth[_0xd848('0x6')](),controller['create']);router['post'](_0xd848('0xb'),auth[_0xd848('0x6')](),controller[_0xd848('0x15')]);router[_0xd848('0x14')](_0xd848('0x16'),auth['isAuthenticated'](),controller[_0xd848('0x17')]);router[_0xd848('0x14')](_0xd848('0x18'),controller[_0xd848('0x19')]);router[_0xd848('0x14')](_0xd848('0xf'),auth['isAuthenticated'](),controller[_0xd848('0x1a')]);router[_0xd848('0x14')](_0xd848('0x12'),auth[_0xd848('0x6')](),controller['addAgents']);router[_0xd848('0x14')](_0xd848('0x1b'),auth[_0xd848('0x6')](),controller[_0xd848('0x1c')]);router['put'](_0xd848('0x9'),auth[_0xd848('0x6')](),controller['update']);router[_0xd848('0x1d')]('/:id',auth[_0xd848('0x6')](),controller[_0xd848('0x1e')]);router['delete'](_0xd848('0xb'),auth[_0xd848('0x6')](),controller[_0xd848('0x1f')]);router[_0xd848('0x1d')](_0xd848('0x16'),auth['isAuthenticated'](),controller[_0xd848('0x20')]);router[_0xd848('0x1d')](_0xd848('0x12'),auth[_0xd848('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x71ca=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getApplications','/:id/interactions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','update','delete','destroy','/:id/dispositions','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0xeff842,_0x4c1a7b){var _0x54be16=function(_0x29378d){while(--_0x29378d){_0xeff842['push'](_0xeff842['shift']());}};_0x54be16(++_0x4c1a7b);}(_0x71ca,0x83));var _0xa71c=function(_0x43613c,_0x5550f1){_0x43613c=_0x43613c-0x0;var _0x4e2fd1=_0x71ca[_0x43613c];return _0x4e2fd1;};'use strict';var multer=require(_0xa71c('0x0'));var util=require(_0xa71c('0x1'));var path=require('path');var timeout=require(_0xa71c('0x2'));var express=require(_0xa71c('0x3'));var router=express['Router']();var fs_extra=require(_0xa71c('0x4'));var auth=require(_0xa71c('0x5'));var interaction=require(_0xa71c('0x6'));var config=require(_0xa71c('0x7'));var controller=require('./openchannelAccount.controller');router[_0xa71c('0x8')]('/',auth[_0xa71c('0x9')](),controller[_0xa71c('0xa')]);router[_0xa71c('0x8')]('/describe',auth[_0xa71c('0x9')](),controller[_0xa71c('0xb')]);router[_0xa71c('0x8')](_0xa71c('0xc'),auth['isAuthenticated'](),controller[_0xa71c('0xd')]);router['get']('/:id/dispositions',auth[_0xa71c('0x9')](),controller['getDispositions']);router['get'](_0xa71c('0xe'),auth[_0xa71c('0x9')](),controller['getAnswers']);router[_0xa71c('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0xa71c('0xf')]);router['get'](_0xa71c('0x10'),auth[_0xa71c('0x9')](),controller['getInteractions']);router['get'](_0xa71c('0x11'),auth[_0xa71c('0x9')](),controller[_0xa71c('0x12')]);router[_0xa71c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa71c('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa71c('0x14')]);router[_0xa71c('0x13')](_0xa71c('0xe'),auth[_0xa71c('0x9')](),controller[_0xa71c('0x15')]);router[_0xa71c('0x13')](_0xa71c('0x16'),controller[_0xa71c('0x17')]);router[_0xa71c('0x13')](_0xa71c('0x18'),auth[_0xa71c('0x9')](),controller[_0xa71c('0x19')]);router[_0xa71c('0x13')]('/:id/users',auth[_0xa71c('0x9')](),controller[_0xa71c('0x1a')]);router['post'](_0xa71c('0x1b'),auth[_0xa71c('0x9')](),controller['send']);router[_0xa71c('0x1c')](_0xa71c('0xc'),auth[_0xa71c('0x9')](),controller[_0xa71c('0x1d')]);router[_0xa71c('0x1e')](_0xa71c('0xc'),auth[_0xa71c('0x9')](),controller[_0xa71c('0x1f')]);router[_0xa71c('0x1e')](_0xa71c('0x20'),auth[_0xa71c('0x9')](),controller['removeDispositions']);router[_0xa71c('0x1e')](_0xa71c('0xe'),auth[_0xa71c('0x9')](),controller['removeAnswers']);router[_0xa71c('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xa71c('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 23012b9..6f7c4ee 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 _0x38c8=['name','STRING','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports'];(function(_0x39bf0d,_0x20fc77){var _0x3a02b1=function(_0x1d7fa8){while(--_0x1d7fa8){_0x39bf0d['push'](_0x39bf0d['shift']());}};_0x3a02b1(++_0x20fc77);}(_0x38c8,0x1e8));var _0x838c=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x38c8[_0x230951];return _0xeb26b1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x838c('0x0'));module[_0x838c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x838c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x838c('0x3')]},'token':{'type':Sequelize[_0x838c('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x838c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x838c('0x4');}},'notificationSound':{'type':Sequelize[_0x838c('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x838c('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x838c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x838c('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x838c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x838c('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x838c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x838c('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x838c('0x5')],'defaultValue':![],'comment':_0x838c('0x7'),'set':function(_0x352671){if(!_0x352671)this[_0x838c('0x8')](_0x838c('0x9'),null);this[_0x838c('0x8')]('mandatoryDisposition',_0x352671);}}}; \ No newline at end of file +var _0x71ae=['BOOLEAN','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4390c7,_0x3a97b0){var _0x301fc6=function(_0x46efe0){while(--_0x46efe0){_0x4390c7['push'](_0x4390c7['shift']());}};_0x301fc6(++_0x3a97b0);}(_0x71ae,0x9f));var _0xe71a=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x71ae[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0xe71a('0x0'));var rs=require(_0xe71a('0x1'));module[_0xe71a('0x2')]={'name':{'type':Sequelize[_0xe71a('0x3')],'unique':_0xe71a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xe71a('0x3')]},'token':{'type':Sequelize[_0xe71a('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe71a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe71a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe71a('0x5');}},'notificationSound':{'type':Sequelize[_0xe71a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe71a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe71a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe71a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe71a('0x3')]},'queueTransfer':{'type':Sequelize[_0xe71a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe71a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe71a('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d5a66){if(!_0x1d5a66)this['setDataValue'](_0xe71a('0x8'),null);this[_0xe71a('0x9')](_0xe71a('0xa'),_0x1d5a66);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8b0df00..ef0b1b9 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 _0xe98c=['emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','ListId','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit'];(function(_0x2129da,_0x1e4cc0){var _0x408733=function(_0x5ad650){while(--_0x5ad650){_0x2129da['push'](_0x2129da['shift']());}};_0x408733(++_0x1e4cc0);}(_0xe98c,0xd3));var _0xce98=function(_0x29d9d5,_0x5a1bd8){_0x29d9d5=_0x29d9d5-0x0;var _0x1be395=_0xe98c[_0x29d9d5];return _0x1be395;};'use strict';var emlformat=require(_0xce98('0x0'));var rimraf=require(_0xce98('0x1'));var zipdir=require(_0xce98('0x2'));var jsonpatch=require(_0xce98('0x3'));var rp=require(_0xce98('0x4'));var moment=require('moment');var BPromise=require(_0xce98('0x5'));var Mustache=require(_0xce98('0x6'));var util=require(_0xce98('0x7'));var path=require(_0xce98('0x8'));var sox=require(_0xce98('0x9'));var csv=require(_0xce98('0xa'));var ejs=require(_0xce98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce98('0xc'));var squel=require(_0xce98('0xd'));var crypto=require(_0xce98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce98('0x10'));var Papa=require('papaparse');var Redis=require(_0xce98('0x11'));var authService=require(_0xce98('0x12'));var qs=require(_0xce98('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce98('0x14'));var logger=require(_0xce98('0x15'))(_0xce98('0x16'));var utils=require('../../config/utils');var config=require(_0xce98('0x17'));var licenseUtil=require(_0xce98('0x18'));var db=require(_0xce98('0x19'))['db'];config[_0xce98('0x1a')]=_[_0xce98('0x1b')](config[_0xce98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce98('0x1a')]));require(_0xce98('0x1c'))['register'](socket);var jayson=require(_0xce98('0x1d'));var client=jayson['client'][_0xce98('0x1e')]({'port':0x232c});var client9002=jayson[_0xce98('0x1f')][_0xce98('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd68d7d,_0x176b15,_0x3460f5,_0x2613b0){return new BPromise(function(_0x1944e2,_0x147392){var _0x4d69a1=_0x2613b0||client;return _0x4d69a1[_0xce98('0x20')](_0xd68d7d,_0x3460f5)['then'](function(_0xd0ef6e){logger[_0xce98('0x21')](_0xce98('0x22'),_0x176b15,'request\x20sent');logger[_0xce98('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'),JSON[_0xce98('0x25')](_0xd0ef6e));if(_0xd0ef6e['error']){if(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x27')]===0x1f4){logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x147392(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x1944e2(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'));_0x1944e2(_0xd0ef6e[_0xce98('0x29')][_0xce98('0x28')]);}})[_0xce98('0x2a')](function(_0x21b681){logger['error'](_0xce98('0x22'),_0x176b15,_0x21b681);_0x147392(_0x21b681);});});}function respondWithStatusCode(_0x4368f4,_0x5ccc1f){_0x5ccc1f=_0x5ccc1f||0xcc;return function(_0x163eb6){if(_0x163eb6){return _0x4368f4['sendStatus'](_0x5ccc1f);}return _0x4368f4[_0xce98('0x2b')](_0x5ccc1f)[_0xce98('0x2c')]();};}function respondWithResult(_0x3987aa,_0x53d3ef){_0x53d3ef=_0x53d3ef||0xc8;return function(_0x422677){if(_0x422677){return _0x3987aa[_0xce98('0x2b')](_0x53d3ef)['json'](_0x422677);}};}function respondWithFilteredResult(_0x3849e8,_0x54132b){return function(_0x50a3c5){if(_0x50a3c5){var _0x12f180=typeof _0x54132b['offset']===_0xce98('0x2d')&&typeof _0x54132b[_0xce98('0x2e')]===_0xce98('0x2d');var _0xb80887=_0x50a3c5[_0xce98('0x2f')];var _0x3df91d=_0x12f180?0x0:_0x54132b[_0xce98('0x30')];var _0x2e6b4a=_0x12f180?_0x50a3c5[_0xce98('0x2f')]:_0x54132b[_0xce98('0x30')]+_0x54132b[_0xce98('0x2e')];var _0x1af843;if(_0x2e6b4a>=_0xb80887){_0x2e6b4a=_0xb80887;_0x1af843=0xc8;}else{_0x1af843=0xce;}_0x3849e8[_0xce98('0x2b')](_0x1af843);return _0x3849e8[_0xce98('0x31')](_0xce98('0x32'),_0x3df91d+'-'+_0x2e6b4a+'/'+_0xb80887)[_0xce98('0x33')](_0x50a3c5);}return null;};}function patchUpdates(_0x2559e9){return function(_0x200647){try{jsonpatch['apply'](_0x200647,_0x2559e9,!![]);}catch(_0x15685e){return BPromise[_0xce98('0x34')](_0x15685e);}return _0x200647['save']();};}function saveUpdates(_0x389a2a,_0x27cebc){return function(_0x4f7d44){if(_0x4f7d44){return _0x4f7d44['update'](_0x389a2a)['then'](function(_0x517efa){return _0x517efa;});}return null;};}function removeEntity(_0x297384,_0x414c8b){return function(_0xdc7f88){if(_0xdc7f88){return _0xdc7f88['destroy']()[_0xce98('0x35')](function(){var _0x2507b0=_0xdc7f88[_0xce98('0x36')]({'plain':!![]});var _0x102e79=_0xce98('0x37');return db[_0xce98('0x38')]['destroy']({'where':{'type':_0x102e79,'resourceId':_0x2507b0['id']}})[_0xce98('0x35')](function(){return _0xdc7f88;});})[_0xce98('0x35')](function(){_0x297384[_0xce98('0x2b')](0xcc)[_0xce98('0x2c')]();});}};}function handleEntityNotFound(_0x208436,_0x4d3185){return function(_0x208731){if(!_0x208731){_0x208436[_0xce98('0x39')](0x194);}return _0x208731;};}function handleError(_0x53b0b4,_0x335908){_0x335908=_0x335908||0x1f4;return function(_0xc25a4d){logger[_0xce98('0x26')](_0xc25a4d[_0xce98('0x3a')]);if(_0xc25a4d[_0xce98('0x3b')]){delete _0xc25a4d['name'];}_0x53b0b4[_0xce98('0x2b')](_0x335908)['send'](_0xc25a4d);};}exports[_0xce98('0x3c')]=function(_0x57a818,_0x530d0d){var _0x41ae6e={'include':[{'model':db[_0xce98('0x3d')],'as':_0xce98('0x3e')}]},_0x401b75={},_0x4359cf={'count':0x0,'rows':[]};var _0x2f9143=_['map'](db[_0xce98('0x3f')][_0xce98('0x40')],function(_0x1f1de3){return{'name':_0x1f1de3[_0xce98('0x41')],'type':_0x1f1de3[_0xce98('0x42')][_0xce98('0x43')]};});_0x401b75[_0xce98('0x44')]=_[_0xce98('0x45')](_0x2f9143,_0xce98('0x3b'));_0x401b75['query']=_[_0xce98('0x46')](_0x57a818['query']);_0x401b75[_0xce98('0x47')]=_[_0xce98('0x48')](_0x401b75[_0xce98('0x44')],_0x401b75['query']);_0x41ae6e['attributes']=_['intersection'](_0x401b75[_0xce98('0x44')],qs[_0xce98('0x49')](_0x57a818[_0xce98('0x4a')]['fields']));_0x41ae6e[_0xce98('0x4b')]=_0x41ae6e[_0xce98('0x4b')]['length']?_0x41ae6e['attributes']:_0x401b75[_0xce98('0x44')];if(!_0x57a818[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x41ae6e[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x57a818['query'][_0xce98('0x2e')]);_0x41ae6e['offset']=qs[_0xce98('0x30')](_0x57a818[_0xce98('0x4a')]['offset']);}_0x41ae6e[_0xce98('0x4e')]=qs['sort'](_0x57a818[_0xce98('0x4a')][_0xce98('0x4f')]);_0x41ae6e[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x57a818[_0xce98('0x4a')],_0x401b75[_0xce98('0x47')]),_0x2f9143);if(_0x57a818['query'][_0xce98('0x52')]){_0x41ae6e['where']=_[_0xce98('0x53')](_0x41ae6e[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x2f9143,function(_0x49f4b0){if(_0x49f4b0[_0xce98('0x42')]!==_0xce98('0x54')){var _0x45bb93={};_0x45bb93[_0x49f4b0['name']]={'$like':'%'+_0x57a818[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x45bb93;}})});}_0x41ae6e=_[_0xce98('0x53')]({},_0x41ae6e,_0x57a818[_0xce98('0x55')]);var _0x2a279d={'where':_0x41ae6e[_0xce98('0x50')]};return db[_0xce98('0x3f')][_0xce98('0x2f')](_0x2a279d)['then'](function(_0x41eacc){_0x4359cf['count']=_0x41eacc;if(_0x57a818[_0xce98('0x4a')][_0xce98('0x56')]){_0x41ae6e[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x3f')][_0xce98('0x58')](_0x41ae6e);})[_0xce98('0x35')](function(_0x294115){_0x4359cf[_0xce98('0x59')]=_0x294115;return _0x4359cf;})['then'](respondWithFilteredResult(_0x530d0d,_0x41ae6e))[_0xce98('0x2a')](handleError(_0x530d0d,null));};exports[_0xce98('0x5a')]=function(_0x2c1790,_0x372d66){var _0x11e7cc={'raw':![],'where':{'id':_0x2c1790[_0xce98('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xce98('0x3e')}]},_0x1c5bf0={};_0x1c5bf0[_0xce98('0x44')]=_['keys'](db['OpenchannelAccount'][_0xce98('0x40')]);_0x1c5bf0[_0xce98('0x4a')]=_['keys'](_0x2c1790[_0xce98('0x4a')]);_0x1c5bf0[_0xce98('0x47')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],_0x1c5bf0['query']);_0x11e7cc[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],qs['fields'](_0x2c1790[_0xce98('0x4a')][_0xce98('0x49')]));_0x11e7cc[_0xce98('0x4b')]=_0x11e7cc[_0xce98('0x4b')][_0xce98('0x5c')]?_0x11e7cc[_0xce98('0x4b')]:_0x1c5bf0[_0xce98('0x44')];if(_0x2c1790[_0xce98('0x4a')]['includeAll']){_0x11e7cc[_0xce98('0x57')]=[{'all':!![]}];}_0x11e7cc=_[_0xce98('0x53')]({},_0x11e7cc,_0x2c1790[_0xce98('0x55')]);return db[_0xce98('0x3f')][_0xce98('0x5d')](_0x11e7cc)[_0xce98('0x35')](handleEntityNotFound(_0x372d66,null))['then'](respondWithResult(_0x372d66,null))[_0xce98('0x2a')](handleError(_0x372d66,null));};exports[_0xce98('0x5e')]=function(_0x4da32f,_0x456f58){return db[_0xce98('0x3f')]['create'](_0x4da32f[_0xce98('0x5f')],{})[_0xce98('0x35')](function(_0x5792b9){var _0x280911=_0x4da32f[_0xce98('0x60')][_0xce98('0x36')]({'plain':!![]});if(!_0x280911)throw new Error(_0xce98('0x61'));if(_0x280911[_0xce98('0x62')]===_0xce98('0x60')){var _0x3305ed=_0x5792b9[_0xce98('0x36')]({'plain':!![]});var _0x912e38=_0xce98('0x37');return db[_0xce98('0x63')]['find']({'where':{'name':_0x912e38,'userProfileId':_0x280911[_0xce98('0x64')]},'raw':!![]})['then'](function(_0x569641){if(_0x569641&&_0x569641[_0xce98('0x65')]===0x0){return db[_0xce98('0x38')]['create']({'name':_0x3305ed[_0xce98('0x3b')],'resourceId':_0x3305ed['id'],'type':_0x569641[_0xce98('0x3b')],'sectionId':_0x569641['id']},{})[_0xce98('0x35')](function(){return _0x5792b9;});}else{return _0x5792b9;}})[_0xce98('0x2a')](function(_0x3c3a0f){logger[_0xce98('0x26')](_0xce98('0x66'),_0x3c3a0f);throw _0x3c3a0f;});}return _0x5792b9;})[_0xce98('0x35')](respondWithResult(_0x456f58,0xc9))['catch'](handleError(_0x456f58,null));};exports[_0xce98('0x67')]=function(_0x3614b6,_0xc39d70){if(_0x3614b6['body']['id']){delete _0x3614b6[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x3614b6['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xc39d70,null))['then'](saveUpdates(_0x3614b6[_0xce98('0x5f')],null))['then'](respondWithResult(_0xc39d70,null))[_0xce98('0x2a')](handleError(_0xc39d70,null));};exports[_0xce98('0x68')]=function(_0x61ceb6,_0x24e661){return db['OpenchannelAccount']['find']({'where':{'id':_0x61ceb6['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x24e661,null))[_0xce98('0x35')](removeEntity(_0x24e661,null))[_0xce98('0x2a')](handleError(_0x24e661,null));};exports[_0xce98('0x69')]=function(_0x4d93de,_0x3123ba){return db[_0xce98('0x3f')][_0xce98('0x69')]()[_0xce98('0x35')](respondWithResult(_0x3123ba,null))[_0xce98('0x2a')](handleError(_0x3123ba,null));};exports[_0xce98('0x6a')]=function(_0x31b85f,_0x1b38af,_0x27ba23){if(_0x31b85f['body']['id']){delete _0x31b85f[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x31b85f[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b38af,null))['then'](function(_0x2a866d){if(_0x2a866d){_0x31b85f['body']['OpenchannelAccountId']=_0x2a866d['id'];return db[_0xce98('0x6b')][_0xce98('0x5e')](_0x31b85f['body']);}})['then'](respondWithResult(_0x1b38af,null))[_0xce98('0x2a')](handleError(_0x1b38af,null));};exports[_0xce98('0x6c')]=function(_0x5e4470,_0x669d9f,_0x5b6d94){var _0xde593f={'raw':![],'where':{}};var _0x4ee8e8={};var _0x1590e5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xce98('0x6d')]({'where':{'id':_0x5e4470[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x669d9f,null))[_0xce98('0x35')](function(_0x368aa5){if(_0x368aa5){_0x4ee8e8['model']=_[_0xce98('0x46')](db[_0xce98('0x6b')]['rawAttributes']);_0x4ee8e8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5e4470['query']);_0x4ee8e8['filters']=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],_0x4ee8e8[_0xce98('0x4a')]);_0xde593f[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x49')]));_0xde593f[_0xce98('0x4b')]=_0xde593f['attributes'][_0xce98('0x5c')]?_0xde593f['attributes']:_0x4ee8e8[_0xce98('0x44')];if(!_0x5e4470[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0xde593f[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x2e')]);_0xde593f[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x30')]);}_0xde593f[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x5e4470['query'][_0xce98('0x4f')]);_0xde593f['where']=qs['filters'](_[_0xce98('0x51')](_0x5e4470['query'],_0x4ee8e8[_0xce98('0x47')]));_0xde593f[_0xce98('0x50')][_0xce98('0x6e')]=_0x368aa5['id'];if(_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]){_0xde593f['where']=_[_0xce98('0x53')](_0xde593f['where'],{'$or':_[_0xce98('0x45')](_0xde593f['attributes'],function(_0xad52f5){var _0x3490b3={};_0x3490b3[_0xad52f5]={'$like':'%'+_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x3490b3;})});}_0xde593f=_[_0xce98('0x53')]({},_0xde593f,_0x5e4470[_0xce98('0x55')]);return db[_0xce98('0x6b')]['count']({'where':_0xde593f[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x40b0b1){_0x1590e5[_0xce98('0x2f')]=_0x40b0b1;if(_0x5e4470['query'][_0xce98('0x56')]){_0xde593f[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x6b')][_0xce98('0x58')](_0xde593f);})[_0xce98('0x35')](function(_0x4f94b0){_0x1590e5[_0xce98('0x59')]=_0x4f94b0;return _0x1590e5;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x669d9f,_0xde593f))[_0xce98('0x2a')](handleError(_0x669d9f,null));};exports[_0xce98('0x6f')]=function(_0x58575d,_0x25b4da,_0x5b7584){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x58575d[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x25b4da,null))[_0xce98('0x35')](function(_0x44ab41){if(_0x44ab41){return _0x44ab41[_0xce98('0x6f')](_0x58575d[_0xce98('0x4a')]['ids']);}})[_0xce98('0x35')](respondWithStatusCode(_0x25b4da,null))[_0xce98('0x2a')](handleError(_0x25b4da,null));};exports['addAnswer']=function(_0x42cc85,_0x5de60c,_0x1b4983){if(_0x42cc85[_0xce98('0x5f')]['id']){delete _0x42cc85[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x42cc85[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x5de60c,null))[_0xce98('0x35')](function(_0x1c5104){if(_0x1c5104){_0x42cc85[_0xce98('0x5f')][_0xce98('0x6e')]=_0x1c5104['id'];return db[_0xce98('0x70')][_0xce98('0x5e')](_0x42cc85[_0xce98('0x5f')]);}})[_0xce98('0x35')](respondWithResult(_0x5de60c,null))[_0xce98('0x2a')](handleError(_0x5de60c,null));};exports[_0xce98('0x71')]=function(_0x184562,_0x4a5a2b,_0x17aef0){var _0x1db888={'raw':![],'where':{}};var _0x389e44={};var _0x3dd867={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x184562[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x4a5a2b,null))[_0xce98('0x35')](function(_0x20968f){if(_0x20968f){_0x389e44[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0x70')][_0xce98('0x40')]);_0x389e44['query']=_['keys'](_0x184562[_0xce98('0x4a')]);_0x389e44[_0xce98('0x47')]=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],_0x389e44[_0xce98('0x4a')]);_0x1db888['attributes']=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],qs[_0xce98('0x49')](_0x184562[_0xce98('0x4a')][_0xce98('0x49')]));_0x1db888[_0xce98('0x4b')]=_0x1db888[_0xce98('0x4b')]['length']?_0x1db888['attributes']:_0x389e44['model'];if(!_0x184562[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1db888[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x184562[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1db888[_0xce98('0x30')]=qs['offset'](_0x184562['query'][_0xce98('0x30')]);}_0x1db888['order']=qs[_0xce98('0x4f')](_0x184562['query'][_0xce98('0x4f')]);_0x1db888[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x184562['query'],_0x389e44[_0xce98('0x47')]));_0x1db888[_0xce98('0x50')]['OpenchannelAccountId']=_0x20968f['id'];if(_0x184562[_0xce98('0x4a')]['filter']){_0x1db888[_0xce98('0x50')]=_['merge'](_0x1db888[_0xce98('0x50')],{'$or':_['map'](_0x1db888[_0xce98('0x4b')],function(_0x11a533){var _0x24d8ea={};_0x24d8ea[_0x11a533]={'$like':'%'+_0x184562[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x24d8ea;})});}_0x1db888=_[_0xce98('0x53')]({},_0x1db888,_0x184562['options']);return db['CannedAnswer'][_0xce98('0x2f')]({'where':_0x1db888['where']})[_0xce98('0x35')](function(_0x363b8e){_0x3dd867[_0xce98('0x2f')]=_0x363b8e;if(_0x184562[_0xce98('0x4a')][_0xce98('0x56')]){_0x1db888[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x70')]['findAll'](_0x1db888);})[_0xce98('0x35')](function(_0x279553){_0x3dd867[_0xce98('0x59')]=_0x279553;return _0x3dd867;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x4a5a2b,_0x1db888))[_0xce98('0x2a')](handleError(_0x4a5a2b,null));};exports[_0xce98('0x72')]=function(_0x43b565,_0x252895,_0x486995){return db['OpenchannelAccount'][_0xce98('0x5d')]({'where':{'id':_0x43b565[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x252895,null))[_0xce98('0x35')](function(_0x2ebc3c){if(_0x2ebc3c){return _0x2ebc3c[_0xce98('0x72')](_0x43b565[_0xce98('0x4a')][_0xce98('0x73')]);}})[_0xce98('0x35')](respondWithStatusCode(_0x252895,null))[_0xce98('0x2a')](handleError(_0x252895,null));};exports[_0xce98('0x74')]=function(_0x4f190b,_0x3b2015,_0x409dd9){var _0x1a3ac7={'body':_0x4f190b[_0xce98('0x5f')],'channel':_0xce98('0x75')};var _0x556feb=[];var _0xa4516f=[];var _0x169057={};var _0x10d69c=![];return db[_0xce98('0x76')]['describe']()['then'](function(_0x3cf63b){if(!_0x3cf63b){throw new db[(_0xce98('0x77'))]['ValidationError'](_0xce98('0x78'));}_0x556feb=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),[_0xce98('0x7a'),_0xce98('0x7b')]);_0xa4516f=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),['createdAt',_0xce98('0x7b'),_0xce98('0x7c'),'ListId']);if(_0x4f190b[_0xce98('0x5f')]['id']){delete _0x4f190b[_0xce98('0x5f')]['id'];}if(_['isNil'](_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x7f'));}if(_[_0xce98('0x80')](_0x4f190b[_0xce98('0x5f')]['body'])||_0x4f190b[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f190b[_0xce98('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xce98('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa4516f);}if(!_['includes'](_0xa4516f,_0x4f190b['body'][_0xce98('0x81')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x82')+_0xa4516f);}_0x169057[_0x4f190b[_0xce98('0x5f')][_0xce98('0x81')]]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];})[_0xce98('0x35')](function(){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x4f190b[_0xce98('0x5b')]['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db['CmContact'],'as':_0xce98('0x85'),'where':_0x169057,'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]},{'model':db[_0xce98('0x87')],'as':_0xce98('0x88')}]});})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x164912){if(_0x164912&&_0x164912[_0xce98('0x84')]){_0x1a3ac7[_0xce98('0x89')]=_0x164912;_0x1a3ac7['applications']=_0x164912[_0xce98('0x88')];_0x1a3ac7['list']=_0x164912[_0xce98('0x84')];_0x1a3ac7['applications']=_['orderBy'](_0x1a3ac7[_0xce98('0x8a')],[_0xce98('0x8b')],[_0xce98('0x8c')]);if(_0x1a3ac7[_0xce98('0x89')]['Applications']){delete _0x1a3ac7[_0xce98('0x89')][_0xce98('0x88')];}if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')]&&_0x1a3ac7[_0xce98('0x89')]['List'][_0xce98('0x85')][_0xce98('0x5c')]){return _0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')][_0xce98('0x85')][0x0];}var _0x134ea1=_[_0xce98('0x1b')](_0x4f190b[_0xce98('0x5f')],{'firstName':_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')],'ListId':_0x164912[_0xce98('0x8d')]});_0x134ea1[_0x4f190b['body']['mapKey']]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];return db['CmContact'][_0xce98('0x5e')](_0x134ea1,{'fields':_0x556feb,'raw':!![]});}})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x6de7a0){_0x1a3ac7[_0xce98('0x8e')]=_0x6de7a0;if(_0x6de7a0){var _0x5b7b02={'ContactId':_0x6de7a0['id'],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'from':(_0x6de7a0[_0xce98('0x8f')]||'')+'\x20'+(_0x6de7a0[_0xce98('0x90')]||'')};var _0x4f5a3b={'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'closed':![]};if(_0x4f190b['body']['threadId']){_0x4f5a3b[_0xce98('0x91')]=_0x4f190b['body'][_0xce98('0x91')];return db['OpenchannelInteraction'][_0xce98('0x5d')]({'where':_0x4f5a3b})[_0xce98('0x35')](function(_0x567e03){if(_0x567e03){return[_0x567e03,![]];}_0x5b7b02[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')]['threadId'];_0x5b7b02[_0xce98('0x92')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x92')];return db['OpenchannelInteraction'][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x51242a){return[_0x51242a,!![]];});});}else{_0x4f5a3b[_0xce98('0x91')]=null;}_0x4f5a3b[_0xce98('0x93')]=_0x6de7a0['id'];return db['OpenchannelInteraction']['find']({'where':_0x4f5a3b})['then'](function(_0x4abca9){if(_0x4abca9){return[_0x4abca9,![]];}return db[_0xce98('0x94')][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x3dc9d3){return[_0x3dc9d3,!![]];});});}})[_0xce98('0x95')](function(_0x53afae,_0x15dc41){if(_0x53afae){_0x10d69c=_0x15dc41;if(!_0x15dc41){var _0x1fd29d={'from':(_0x1a3ac7[_0xce98('0x8e')]['firstName']||'')+'\x20'+(_0x1a3ac7[_0xce98('0x8e')]['lastName']||'')};if(_0x4f190b[_0xce98('0x5f')][_0xce98('0x91')]&&_0x4f190b['body'][_0xce98('0x96')]&&_0x4f190b['body'][_0xce98('0x91')]!=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')]){_0x1fd29d[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')];}return _0x53afae['update'](_0x1fd29d);}else{return _0x53afae;}}})[_0xce98('0x35')](function(_0xf76ca3){_0x1a3ac7[_0xce98('0x97')]=_0xf76ca3[_0xce98('0x36')]({'plain':!![]});_0x1a3ac7[_0xce98('0x97')][_0xce98('0x98')]=_0x10d69c;if(_0x1a3ac7[_0xce98('0x97')]['created']){if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x99')]){_0x1a3ac7[_0xce98('0x8a')][_0xce98('0x9a')]({'id':0x0,'priority':_0x1a3ac7['applications']['length']+0x1,'app':_0xce98('0x9b'),'appdata':_0xce98('0x9c'),'interval':_0xce98('0x9d')});}}return db['OpenchannelMessage'][_0xce98('0x5e')]({'body':_0x4f190b[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'OpenchannelInteractionId':_0xf76ca3['id'],'direction':'in','ContactId':_0x1a3ac7[_0xce98('0x8e')]['id'],'AttachmentId':_0x4f190b['body'][_0xce98('0x9e')]});})[_0xce98('0x35')](function(_0x212f3a){_0x1a3ac7[_0xce98('0x28')]=_0x212f3a;if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')])return;return db[_0xce98('0xa0')][_0xce98('0x5d')]({'attributes':['id',_0xce98('0x3b')],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')]}});})[_0xce98('0x35')](function(_0x24b268){if(_0x24b268){_0x1a3ac7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xce98('0xa1'),'appdata':_0x24b268[_0xce98('0x3b')]+','+(_0x1a3ac7[_0xce98('0x89')][_0xce98('0xa2')]||0xa),'interval':_0xce98('0x9d')});}if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')])return;return db[_0xce98('0xa4')][_0xce98('0x5d')]({'attributes':['id','name'],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')]}});})[_0xce98('0x35')](function(_0x5ab34d){if(_0x5ab34d){_0x1a3ac7[_0xce98('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xce98('0xa5'),'appdata':_0x5ab34d['name']+','+(_0x1a3ac7['account'][_0xce98('0xa6')]||0x12c),'interval':_0xce98('0x9d')});}return respondWithRpcPromise(_0xce98('0xa7'),_0xce98('0xa8'),_0x1a3ac7);})['then'](function(_0x354c90){respondWithRpcPromise(_0xce98('0xa9'),_0xce98('0xa9'),{'event':'notify','message':_0x354c90},client9002);return _0x354c90;})[_0xce98('0x35')](respondWithResult(_0x3b2015,null))[_0xce98('0x2a')](handleError(_0x3b2015,null));};exports[_0xce98('0xaa')]=function(_0x3dde8f,_0x10bb3e){var _0x6c5bf7=_0x3dde8f[_0xce98('0x5b')]['id'];var _0x4c8182=_0x3dde8f[_0xce98('0x5f')];var _0x3daf5b=0xc8;var _0x4c7317=null;return db[_0xce98('0xab')][_0xce98('0xac')]({'isolationLevel':db[_0xce98('0xab')]['Transaction'][_0xce98('0xad')][_0xce98('0xae')]},function(_0x7a86c0){return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(_0x18e852){if(_0x18e852){return db[_0xce98('0x87')][_0xce98('0x68')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(){var _0x4afb7e=_[_0xce98('0x45')](_0x4c8182,function(_0x3cedd7){_0x3cedd7[_0xce98('0x6e')]=_0x6c5bf7;return _0x3cedd7;});return db[_0xce98('0x87')][_0xce98('0xaf')](_0x4afb7e,{'transaction':_0x7a86c0});});}else{_0x3daf5b=0x194;_0x4c7317=[];}});})[_0xce98('0x35')](function(){if(_0x3daf5b!==0x194){return db[_0xce98('0x87')][_0xce98('0xb0')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'order':_0xce98('0x8b')})[_0xce98('0x35')](function(_0x4ee73f){_0x4c7317=_0x4ee73f;});}})['catch'](function(_0x23c9df){_0x3daf5b=0x1f4;logger[_0xce98('0x26')](_0x23c9df[_0xce98('0x3a')]);if(_0x23c9df[_0xce98('0x3b')]){delete _0x23c9df[_0xce98('0x3b')];}_0x4c7317=_0x23c9df;})[_0xce98('0xb1')](function(){if(_0x4c7317===null){_0x10bb3e[_0xce98('0x39')](_0x3daf5b);}else{if(_0x3daf5b===0x1f4){_0x10bb3e['status'](_0x3daf5b)[_0xce98('0xb2')](_0x4c7317);}else{_0x10bb3e[_0xce98('0x2b')](_0x3daf5b)[_0xce98('0x33')](_0x4c7317);}}});};exports[_0xce98('0xb3')]=function(_0x354744,_0x86011d,_0x269042){var _0x38c893={};var _0x4b22ca={};var _0x14a6c0;var _0x5388d9;return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x354744['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x86011d,null))[_0xce98('0x35')](function(_0x1d0327){if(_0x1d0327){_0x14a6c0=_0x1d0327;_0x4b22ca[_0xce98('0x44')]=_[_0xce98('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x4b22ca['query']=_[_0xce98('0x46')](_0x354744[_0xce98('0x4a')]);_0x4b22ca[_0xce98('0x47')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],_0x4b22ca[_0xce98('0x4a')]);_0x38c893[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],qs[_0xce98('0x49')](_0x354744[_0xce98('0x4a')][_0xce98('0x49')]));_0x38c893[_0xce98('0x4b')]=_0x38c893[_0xce98('0x4b')][_0xce98('0x5c')]?_0x38c893[_0xce98('0x4b')]:_0x4b22ca[_0xce98('0x44')];_0x38c893[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x354744[_0xce98('0x4a')][_0xce98('0x4f')]);_0x38c893[_0xce98('0x50')]=qs[_0xce98('0x47')](_['pick'](_0x354744[_0xce98('0x4a')],_0x4b22ca[_0xce98('0x47')]));if(_0x354744['query'][_0xce98('0x52')]){_0x38c893[_0xce98('0x50')]=_[_0xce98('0x53')](_0x38c893[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x38c893[_0xce98('0x4b')],function(_0x515a2b){var _0x171e8c={};_0x171e8c[_0x515a2b]={'$like':'%'+_0x354744[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x171e8c;})});}_0x38c893=_[_0xce98('0x53')]({},_0x38c893,_0x354744[_0xce98('0x55')]);return _0x14a6c0['getApplications'](_0x38c893);}})[_0xce98('0x35')](function(_0x1a1d46){if(_0x1a1d46){_0x5388d9=_0x1a1d46[_0xce98('0x5c')];if(!_0x354744[_0xce98('0x4a')][_0xce98('0x4c')]('nolimit')){_0x38c893['limit']=qs['limit'](_0x354744[_0xce98('0x4a')][_0xce98('0x2e')]);_0x38c893[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x354744[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x14a6c0[_0xce98('0xb3')](_0x38c893);}})[_0xce98('0x35')](function(_0xa1287){if(_0xa1287){return _0xa1287?{'count':_0x5388d9,'rows':_0xa1287}:null;}})[_0xce98('0x35')](respondWithResult(_0x86011d,null))[_0xce98('0x2a')](handleError(_0x86011d,null));};exports[_0xce98('0xb4')]=function(_0x5d16ae,_0x322ff5,_0x20968e){var _0x1317c9={'raw':![],'where':{}};var _0x422f8={};var _0x526ed8={'count':0x0,'rows':[]};return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x5d16ae[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x322ff5,null))[_0xce98('0x35')](function(_0x2ed6df){if(_0x2ed6df){_0x422f8['model']=_['keys'](db[_0xce98('0x94')][_0xce98('0x40')]);_0x422f8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5d16ae[_0xce98('0x4a')]);_0x422f8[_0xce98('0x47')]=_[_0xce98('0x48')](_0x422f8['model'],_0x422f8['query']);_0x1317c9['attributes']=_[_0xce98('0x48')](_0x422f8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x49')]));_0x1317c9[_0xce98('0x4b')]=_0x1317c9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1317c9[_0xce98('0x4b')]:_0x422f8[_0xce98('0x44')];if(!_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1317c9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1317c9[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5d16ae['query'][_0xce98('0x30')]);}_0x1317c9['order']=qs[_0xce98('0x4f')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1317c9[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x5d16ae[_0xce98('0x4a')],_0x422f8[_0xce98('0x47')]));_0x1317c9[_0xce98('0x50')]['OpenchannelAccountId']=_0x2ed6df['id'];if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]){_0x1317c9['where']=_[_0xce98('0x53')](_0x1317c9[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x1317c9[_0xce98('0x4b')],function(_0x4c6f2b){var _0x2874be={};_0x2874be[_0x4c6f2b]={'$like':'%'+_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x2874be;})});}_0x1317c9=_[_0xce98('0x53')]({},_0x1317c9,_0x5d16ae[_0xce98('0x55')]);return db[_0xce98('0x94')][_0xce98('0x2f')]({'where':_0x1317c9[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x28348d){_0x526ed8[_0xce98('0x2f')]=_0x28348d;if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x56')]){_0x1317c9[_0xce98('0x57')]=[{'model':db['CmContact'],'as':_0xce98('0xb5'),'required':![]},{'model':db[_0xce98('0xa0')],'as':'Owner','attributes':[_0xce98('0x3b'),_0xce98('0xb6'),_0xce98('0xb7')],'required':![]},{'model':db[_0xce98('0xb8')],'as':_0xce98('0xb9'),'attributes':['id',_0xce98('0x3b'),'color'],'where':_0x5d16ae[_0xce98('0x4a')][_0xce98('0xba')]?{'id':_0x5d16ae['query'][_0xce98('0xba')]}:undefined,'required':_0x5d16ae['query'][_0xce98('0xba')]?!![]:![]}];}return db[_0xce98('0x94')][_0xce98('0x58')](_0x1317c9);})['then'](function(_0x48f7c9){_0x526ed8[_0xce98('0x59')]=_0x48f7c9;return _0x526ed8;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x322ff5,_0x1317c9))['catch'](handleError(_0x322ff5,null));};exports[_0xce98('0xbb')]=function(_0x57d489,_0x432123,_0x598346){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x57d489['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x432123,null))[_0xce98('0x35')](function(_0x120c24){if(_0x120c24){return _0x120c24['addAgents'](_0x57d489[_0xce98('0x5f')]['ids'],_[_0xce98('0xbc')](_0x57d489['body'],['ids','id'])||{})['spread'](function(_0x41c752){for(var _0x49d2a6=0x0;_0x49d2a6<_0x57d489[_0xce98('0x5f')][_0xce98('0x73')][_0xce98('0x5c')];_0x49d2a6+=0x1){socket[_0xce98('0xbd')](_0xce98('0xbe'),{'UserId':Number(_0x57d489[_0xce98('0x5f')]['ids'][_0x49d2a6]),'OpenchannelAccountId':Number(_0x57d489[_0xce98('0x5b')]['id'])});}return _0x41c752;});}})[_0xce98('0x35')](respondWithResult(_0x432123,null))['catch'](handleError(_0x432123,null));};exports[_0xce98('0xbf')]=function(_0xe4445,_0x372799,_0x2fac50){return db['OpenchannelAccount']['find']({'where':{'id':_0xe4445[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x372799,null))[_0xce98('0x35')](function(_0x437f41){if(_0x437f41){return _0x437f41[_0xce98('0xbf')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])[_0xce98('0x35')](function(){if(_[_0xce98('0xc0')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])){for(var _0x232ddf=0x0;_0x232ddf<_0xe4445[_0xce98('0x4a')][_0xce98('0x73')][_0xce98('0x5c')];_0x232ddf+=0x1){socket[_0xce98('0xbd')](_0xce98('0xc1'),{'UserId':Number(_0xe4445['query']['ids'][_0x232ddf]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}}else{socket['emit'](_0xce98('0xc1'),{'UserId':Number(_0xe4445[_0xce98('0x4a')][_0xce98('0x73')]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}});}})[_0xce98('0x35')](respondWithStatusCode(_0x372799,null))[_0xce98('0x2a')](handleError(_0x372799,null));};exports[_0xce98('0xc2')]=function(_0x4dccdf,_0x141d6e,_0x4c7232){var _0x1ba7b9={};var _0xca4942={};var _0x4a35fd;var _0x5c4590;return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x4dccdf[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x141d6e,null))[_0xce98('0x35')](function(_0x5b97d4){if(_0x5b97d4){_0x4a35fd=_0x5b97d4;_0xca4942[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0xa0')][_0xce98('0x40')]);_0xca4942['query']=_[_0xce98('0x46')](_0x4dccdf[_0xce98('0x4a')]);_0xca4942['filters']=_['intersection'](_0xca4942[_0xce98('0x44')],_0xca4942[_0xce98('0x4a')]);_0x1ba7b9[_0xce98('0x4b')]=_[_0xce98('0x48')](_0xca4942[_0xce98('0x44')],qs[_0xce98('0x49')](_0x4dccdf['query']['fields']));_0x1ba7b9[_0xce98('0x4b')]=_0x1ba7b9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1ba7b9[_0xce98('0x4b')]:_0xca4942[_0xce98('0x44')];_0x1ba7b9[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1ba7b9['where']=qs[_0xce98('0x47')](_['pick'](_0x4dccdf[_0xce98('0x4a')],_0xca4942[_0xce98('0x47')]));if(_0x4dccdf[_0xce98('0x4a')][_0xce98('0x52')]){_0x1ba7b9['where']=_[_0xce98('0x53')](_0x1ba7b9['where'],{'$or':_[_0xce98('0x45')](_0x1ba7b9[_0xce98('0x4b')],function(_0x48afd8){var _0x17c0df={};_0x17c0df[_0x48afd8]={'$like':'%'+_0x4dccdf[_0xce98('0x4a')]['filter']+'%'};return _0x17c0df;})});}_0x1ba7b9=_[_0xce98('0x53')]({},_0x1ba7b9,_0x4dccdf[_0xce98('0x55')]);return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x1da763){if(_0x1da763){_0x5c4590=_0x1da763['length'];if(!_0x4dccdf[_0xce98('0x4a')]['hasOwnProperty']('nolimit')){_0x1ba7b9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1ba7b9['offset']=qs[_0xce98('0x30')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x10c6b1){if(_0x10c6b1){return _0x10c6b1?{'count':_0x5c4590,'rows':_0x10c6b1}:null;}})['then'](respondWithResult(_0x141d6e,null))[_0xce98('0x2a')](handleError(_0x141d6e,null));};exports[_0xce98('0xb2')]=function(_0x1595e9,_0x2058ee,_0x39b1f5){var _0x2d0320,_0x309a24,_0x145a85;if(_['isNil'](_0x1595e9[_0xce98('0x5f')]['body'])||_0x1595e9[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0xc3'));}if(_[_0xce98('0x80')](_0x1595e9[_0xce98('0x5f')]['to'])){}_0x2d0320=_0x1595e9[_0xce98('0x5f')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1595e9[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x5d8515){if(_0x5d8515){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x5d8515['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db[_0xce98('0x76')],'as':_0xce98('0x85'),'where':{[_0x5d8515[_0xce98('0x81')]]:_0x2d0320},'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]}]})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x571483){if(_0x571483&&_0x571483[_0xce98('0x84')]){_0x309a24=_0x571483[_0xce98('0x36')]({'plain':!![]});if(_0x309a24[_0xce98('0x84')]&&_0x309a24['List']['Contacts'][_0xce98('0x5c')]){return _0x309a24[_0xce98('0x84')]['Contacts'][0x0];}return db[_0xce98('0x76')][_0xce98('0x5e')](_[_0xce98('0x1b')](_0x1595e9['body'],{'firstName':_0x2d0320,[_0x571483[_0xce98('0x81')]]:_0x2d0320,'phone':_0x2d0320,'ListId':_0x309a24[_0xce98('0x8d')]}));}})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x7f98c){if(_0x7f98c){_0x145a85=_0x7f98c;return db[_0xce98('0x94')][_0xce98('0x5d')]({'where':{'ContactId':_0x145a85['id'],'closed':![],'OpenchannelAccountId':_0x309a24['id']}})[_0xce98('0x35')](function(_0x486d58){if(_0x486d58){return[_0x486d58,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id'],'OpenchannelAccountId':_0x309a24['id'],'lastMsgDirection':_0xce98('0xc4'),'firstMsgDirection':_0xce98('0xc4'),'Messages':[_[_0xce98('0x53')](_0x1595e9[_0xce98('0x5f')],{'read':![],'body':_0x1595e9[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x309a24['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xce98('0xc5')}]})['then'](function(_0x49db6b){return[_0x49db6b,!![]];});});}})[_0xce98('0x95')](function(_0x5aad5b,_0x4fc9c7){if(_0x4fc9c7){return _0x5aad5b;}return db[_0xce98('0xc6')][_0xce98('0x5e')](_[_0xce98('0x53')](_0x1595e9['body'],{'read':![],'body':_0x1595e9[_0xce98('0x5f')]['body'],'OpenchannelAccountId':_0x309a24['id'],'OpenchannelInteractionId':_0x5aad5b['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']}))[_0xce98('0x35')](function(_0xa14a8d){_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')]=[];_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')][_0xce98('0x9a')](_0xa14a8d[_0xce98('0xc7')]);return _0x5aad5b;});});}})['then'](respondWithResult(_0x2058ee,null))[_0xce98('0x2a')](handleError(_0x2058ee,null));}; \ No newline at end of file +var _0xb7ae=['push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','http','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','fields','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','nolimit','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','priority','asc','List','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x15e432,_0x50772f){_0x15e432=_0x15e432-0x0;var _0x28f3a7=_0xb7ae[_0x15e432];return _0x28f3a7;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var hardwareService=require(_0xeb7a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7a('0x17'));var config=require(_0xeb7a('0x18'));var licenseUtil=require(_0xeb7a('0x19'));var db=require(_0xeb7a('0x1a'))['db'];config[_0xeb7a('0x1b')]=_[_0xeb7a('0x1c')](config[_0xeb7a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb7a('0x1d'))(new Redis(config[_0xeb7a('0x1b')]));require('./openchannelAccount.socket')[_0xeb7a('0x1e')](socket);var jayson=require(_0xeb7a('0x1f'));var client=jayson['client'][_0xeb7a('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388666,_0x5e6256,_0x5782e6,_0x394208){return new BPromise(function(_0x38f5cc,_0x9982bd){var _0x2d92c7=_0x394208||client;return _0x2d92c7['request'](_0x388666,_0x5782e6)['then'](function(_0x34ade5){logger[_0xeb7a('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e6256,'request\x20sent');logger[_0xeb7a('0x22')](_0xeb7a('0x23'),_0x5e6256,_0xeb7a('0x24'),JSON[_0xeb7a('0x25')](_0x34ade5));if(_0x34ade5[_0xeb7a('0x26')]){if(_0x34ade5[_0xeb7a('0x26')][_0xeb7a('0x27')]===0x1f4){logger[_0xeb7a('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e6256,_0x34ade5[_0xeb7a('0x26')][_0xeb7a('0x28')]);return _0x9982bd(_0x34ade5['error']['message']);}logger[_0xeb7a('0x26')](_0xeb7a('0x29'),_0x5e6256,_0x34ade5[_0xeb7a('0x26')][_0xeb7a('0x28')]);return _0x38f5cc(_0x34ade5[_0xeb7a('0x26')][_0xeb7a('0x28')]);}else{logger[_0xeb7a('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e6256,_0xeb7a('0x24'));_0x38f5cc(_0x34ade5[_0xeb7a('0x2a')][_0xeb7a('0x28')]);}})['catch'](function(_0x10b7d3){logger[_0xeb7a('0x26')](_0xeb7a('0x29'),_0x5e6256,_0x10b7d3);_0x9982bd(_0x10b7d3);});});}function respondWithStatusCode(_0x9b80f5,_0x53ade4){_0x53ade4=_0x53ade4||0xcc;return function(_0x15199a){if(_0x15199a){return _0x9b80f5['sendStatus'](_0x53ade4);}return _0x9b80f5[_0xeb7a('0x2b')](_0x53ade4)[_0xeb7a('0x2c')]();};}function respondWithResult(_0x4d24bc,_0x189e2a){_0x189e2a=_0x189e2a||0xc8;return function(_0x820418){if(_0x820418){return _0x4d24bc[_0xeb7a('0x2b')](_0x189e2a)[_0xeb7a('0x2d')](_0x820418);}};}function respondWithFilteredResult(_0x3917eb,_0x2a492f){return function(_0x20a197){if(_0x20a197){var _0x2d2f9f=typeof _0x2a492f['offset']===_0xeb7a('0x2e')&&typeof _0x2a492f[_0xeb7a('0x2f')]===_0xeb7a('0x2e');var _0x203993=_0x20a197[_0xeb7a('0x30')];var _0x202d22=_0x2d2f9f?0x0:_0x2a492f[_0xeb7a('0x31')];var _0x3e7dac=_0x2d2f9f?_0x20a197[_0xeb7a('0x30')]:_0x2a492f[_0xeb7a('0x31')]+_0x2a492f[_0xeb7a('0x2f')];var _0x4a72bc;if(_0x3e7dac>=_0x203993){_0x3e7dac=_0x203993;_0x4a72bc=0xc8;}else{_0x4a72bc=0xce;}_0x3917eb[_0xeb7a('0x2b')](_0x4a72bc);return _0x3917eb[_0xeb7a('0x32')](_0xeb7a('0x33'),_0x202d22+'-'+_0x3e7dac+'/'+_0x203993)[_0xeb7a('0x2d')](_0x20a197);}return null;};}function patchUpdates(_0x5df76f){return function(_0xcb3c2b){try{jsonpatch[_0xeb7a('0x34')](_0xcb3c2b,_0x5df76f,!![]);}catch(_0x216670){return BPromise[_0xeb7a('0x35')](_0x216670);}return _0xcb3c2b[_0xeb7a('0x36')]();};}function saveUpdates(_0x1fd950,_0x4b60be){return function(_0x222a1d){if(_0x222a1d){return _0x222a1d[_0xeb7a('0x37')](_0x1fd950)[_0xeb7a('0x38')](function(_0x3d879c){return _0x3d879c;});}return null;};}function removeEntity(_0x285943,_0x37c26e){return function(_0x47ba59){if(_0x47ba59){return _0x47ba59[_0xeb7a('0x39')]()['then'](function(){var _0x175405=_0x47ba59[_0xeb7a('0x3a')]({'plain':!![]});var _0x500254=_0xeb7a('0x3b');return db[_0xeb7a('0x3c')][_0xeb7a('0x39')]({'where':{'type':_0x500254,'resourceId':_0x175405['id']}})[_0xeb7a('0x38')](function(){return _0x47ba59;});})[_0xeb7a('0x38')](function(){_0x285943[_0xeb7a('0x2b')](0xcc)[_0xeb7a('0x2c')]();});}};}function handleEntityNotFound(_0x3324e4,_0x4e8158){return function(_0x38f456){if(!_0x38f456){_0x3324e4[_0xeb7a('0x3d')](0x194);}return _0x38f456;};}function handleError(_0x573370,_0x1b93e2){_0x1b93e2=_0x1b93e2||0x1f4;return function(_0x64dec){logger[_0xeb7a('0x26')](_0x64dec[_0xeb7a('0x3e')]);if(_0x64dec[_0xeb7a('0x3f')]){delete _0x64dec[_0xeb7a('0x3f')];}_0x573370[_0xeb7a('0x2b')](_0x1b93e2)['send'](_0x64dec);};}exports[_0xeb7a('0x40')]=function(_0x271fa8,_0x308a2e){var _0x3c1085={'include':[{'model':db[_0xeb7a('0x41')],'as':_0xeb7a('0x42')}]},_0x38affa={},_0x2458fb={'count':0x0,'rows':[]};var _0x414580=_[_0xeb7a('0x43')](db[_0xeb7a('0x44')][_0xeb7a('0x45')],function(_0x508d83){return{'name':_0x508d83[_0xeb7a('0x46')],'type':_0x508d83[_0xeb7a('0x47')][_0xeb7a('0x48')]};});_0x38affa[_0xeb7a('0x49')]=_['map'](_0x414580,_0xeb7a('0x3f'));_0x38affa[_0xeb7a('0x4a')]=_[_0xeb7a('0x4b')](_0x271fa8[_0xeb7a('0x4a')]);_0x38affa[_0xeb7a('0x4c')]=_[_0xeb7a('0x4d')](_0x38affa['model'],_0x38affa[_0xeb7a('0x4a')]);_0x3c1085[_0xeb7a('0x4e')]=_['intersection'](_0x38affa[_0xeb7a('0x49')],qs['fields'](_0x271fa8['query']['fields']));_0x3c1085[_0xeb7a('0x4e')]=_0x3c1085[_0xeb7a('0x4e')][_0xeb7a('0x4f')]?_0x3c1085[_0xeb7a('0x4e')]:_0x38affa[_0xeb7a('0x49')];if(!_0x271fa8[_0xeb7a('0x4a')]['hasOwnProperty']('nolimit')){_0x3c1085[_0xeb7a('0x2f')]=qs['limit'](_0x271fa8[_0xeb7a('0x4a')][_0xeb7a('0x2f')]);_0x3c1085[_0xeb7a('0x31')]=qs[_0xeb7a('0x31')](_0x271fa8['query'][_0xeb7a('0x31')]);}_0x3c1085[_0xeb7a('0x50')]=qs[_0xeb7a('0x51')](_0x271fa8[_0xeb7a('0x4a')]['sort']);_0x3c1085[_0xeb7a('0x52')]=qs['filters'](_[_0xeb7a('0x53')](_0x271fa8[_0xeb7a('0x4a')],_0x38affa[_0xeb7a('0x4c')]),_0x414580);if(_0x271fa8[_0xeb7a('0x4a')][_0xeb7a('0x54')]){_0x3c1085[_0xeb7a('0x52')]=_[_0xeb7a('0x55')](_0x3c1085['where'],{'$or':_['map'](_0x414580,function(_0x232350){if(_0x232350[_0xeb7a('0x47')]!==_0xeb7a('0x56')){var _0x2a566a={};_0x2a566a[_0x232350[_0xeb7a('0x3f')]]={'$like':'%'+_0x271fa8['query']['filter']+'%'};return _0x2a566a;}})});}_0x3c1085=_[_0xeb7a('0x55')]({},_0x3c1085,_0x271fa8['options']);var _0x202753={'where':_0x3c1085[_0xeb7a('0x52')]};return db[_0xeb7a('0x44')][_0xeb7a('0x30')](_0x202753)[_0xeb7a('0x38')](function(_0x287a18){_0x2458fb[_0xeb7a('0x30')]=_0x287a18;if(_0x271fa8[_0xeb7a('0x4a')][_0xeb7a('0x57')]){_0x3c1085[_0xeb7a('0x58')]=[{'all':!![]}];}return db[_0xeb7a('0x44')][_0xeb7a('0x59')](_0x3c1085);})[_0xeb7a('0x38')](function(_0x466a2f){_0x2458fb['rows']=_0x466a2f;return _0x2458fb;})[_0xeb7a('0x38')](respondWithFilteredResult(_0x308a2e,_0x3c1085))[_0xeb7a('0x5a')](handleError(_0x308a2e,null));};exports[_0xeb7a('0x5b')]=function(_0x198b7c,_0x26dbf9){var _0x160f6c={'raw':![],'where':{'id':_0x198b7c[_0xeb7a('0x5c')]['id']},'include':[{'model':db[_0xeb7a('0x41')],'as':_0xeb7a('0x42')}]},_0x410921={};_0x410921[_0xeb7a('0x49')]=_[_0xeb7a('0x4b')](db[_0xeb7a('0x44')][_0xeb7a('0x45')]);_0x410921[_0xeb7a('0x4a')]=_[_0xeb7a('0x4b')](_0x198b7c[_0xeb7a('0x4a')]);_0x410921[_0xeb7a('0x4c')]=_[_0xeb7a('0x4d')](_0x410921[_0xeb7a('0x49')],_0x410921[_0xeb7a('0x4a')]);_0x160f6c[_0xeb7a('0x4e')]=_[_0xeb7a('0x4d')](_0x410921['model'],qs[_0xeb7a('0x5d')](_0x198b7c['query'][_0xeb7a('0x5d')]));_0x160f6c['attributes']=_0x160f6c[_0xeb7a('0x4e')][_0xeb7a('0x4f')]?_0x160f6c[_0xeb7a('0x4e')]:_0x410921[_0xeb7a('0x49')];if(_0x198b7c[_0xeb7a('0x4a')][_0xeb7a('0x57')]){_0x160f6c['include']=[{'all':!![]}];}_0x160f6c=_[_0xeb7a('0x55')]({},_0x160f6c,_0x198b7c[_0xeb7a('0x5e')]);return db[_0xeb7a('0x44')][_0xeb7a('0x5f')](_0x160f6c)['then'](handleEntityNotFound(_0x26dbf9,null))[_0xeb7a('0x38')](respondWithResult(_0x26dbf9,null))[_0xeb7a('0x5a')](handleError(_0x26dbf9,null));};exports[_0xeb7a('0x60')]=function(_0x1666c8,_0x19b006){return db[_0xeb7a('0x44')][_0xeb7a('0x60')](_0x1666c8[_0xeb7a('0x61')],{})[_0xeb7a('0x38')](function(_0x115d45){var _0x40f52f=_0x1666c8[_0xeb7a('0x62')][_0xeb7a('0x3a')]({'plain':!![]});if(!_0x40f52f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40f52f[_0xeb7a('0x63')]===_0xeb7a('0x62')){var _0x314b74=_0x115d45[_0xeb7a('0x3a')]({'plain':!![]});var _0x4f459d=_0xeb7a('0x3b');return db[_0xeb7a('0x64')][_0xeb7a('0x5f')]({'where':{'name':_0x4f459d,'userProfileId':_0x40f52f[_0xeb7a('0x65')]},'raw':!![]})[_0xeb7a('0x38')](function(_0x4108b5){if(_0x4108b5&&_0x4108b5[_0xeb7a('0x66')]===0x0){return db[_0xeb7a('0x3c')]['create']({'name':_0x314b74[_0xeb7a('0x3f')],'resourceId':_0x314b74['id'],'type':_0x4108b5[_0xeb7a('0x3f')],'sectionId':_0x4108b5['id']},{})[_0xeb7a('0x38')](function(){return _0x115d45;});}else{return _0x115d45;}})[_0xeb7a('0x5a')](function(_0x57db97){logger[_0xeb7a('0x26')](_0xeb7a('0x67'),_0x57db97);throw _0x57db97;});}return _0x115d45;})[_0xeb7a('0x38')](respondWithResult(_0x19b006,0xc9))[_0xeb7a('0x5a')](handleError(_0x19b006,null));};exports['update']=function(_0x387460,_0x50a654){if(_0x387460['body']['id']){delete _0x387460[_0xeb7a('0x61')]['id'];}return db[_0xeb7a('0x44')][_0xeb7a('0x5f')]({'where':{'id':_0x387460[_0xeb7a('0x5c')]['id']},'include':[{'model':db[_0xeb7a('0x41')],'as':_0xeb7a('0x42')}]})[_0xeb7a('0x38')](handleEntityNotFound(_0x50a654,null))[_0xeb7a('0x38')](saveUpdates(_0x387460[_0xeb7a('0x61')],null))[_0xeb7a('0x38')](respondWithResult(_0x50a654,null))[_0xeb7a('0x5a')](handleError(_0x50a654,null));};exports[_0xeb7a('0x39')]=function(_0x4b5a93,_0x232250){return db[_0xeb7a('0x44')]['find']({'where':{'id':_0x4b5a93[_0xeb7a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x232250,null))['then'](removeEntity(_0x232250,null))[_0xeb7a('0x5a')](handleError(_0x232250,null));};exports[_0xeb7a('0x68')]=function(_0x1969a0,_0x10a624){return db[_0xeb7a('0x44')]['describe']()['then'](respondWithResult(_0x10a624,null))[_0xeb7a('0x5a')](handleError(_0x10a624,null));};exports[_0xeb7a('0x69')]=function(_0xcec1b4,_0x3e7618,_0x44905f){if(_0xcec1b4[_0xeb7a('0x61')]['id']){delete _0xcec1b4['body']['id'];}return db['OpenchannelAccount'][_0xeb7a('0x5f')]({'where':{'id':_0xcec1b4[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x3e7618,null))[_0xeb7a('0x38')](function(_0x4be900){if(_0x4be900){_0xcec1b4[_0xeb7a('0x61')][_0xeb7a('0x6a')]=_0x4be900['id'];return db['Disposition']['create'](_0xcec1b4['body']);}})['then'](respondWithResult(_0x3e7618,null))[_0xeb7a('0x5a')](handleError(_0x3e7618,null));};exports[_0xeb7a('0x6b')]=function(_0x4874d7,_0x3eb431,_0x275681){var _0x3ee82e={'raw':![],'where':{}};var _0x1ea628={};var _0x26c6ed={'count':0x0,'rows':[]};return db[_0xeb7a('0x44')][_0xeb7a('0x6c')]({'where':{'id':_0x4874d7[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x3eb431,null))['then'](function(_0xbae3a7){if(_0xbae3a7){_0x1ea628[_0xeb7a('0x49')]=_['keys'](db[_0xeb7a('0x6d')][_0xeb7a('0x45')]);_0x1ea628[_0xeb7a('0x4a')]=_[_0xeb7a('0x4b')](_0x4874d7[_0xeb7a('0x4a')]);_0x1ea628['filters']=_[_0xeb7a('0x4d')](_0x1ea628[_0xeb7a('0x49')],_0x1ea628['query']);_0x3ee82e[_0xeb7a('0x4e')]=_[_0xeb7a('0x4d')](_0x1ea628['model'],qs[_0xeb7a('0x5d')](_0x4874d7['query'][_0xeb7a('0x5d')]));_0x3ee82e[_0xeb7a('0x4e')]=_0x3ee82e[_0xeb7a('0x4e')]['length']?_0x3ee82e[_0xeb7a('0x4e')]:_0x1ea628[_0xeb7a('0x49')];if(!_0x4874d7[_0xeb7a('0x4a')]['hasOwnProperty']('nolimit')){_0x3ee82e[_0xeb7a('0x2f')]=qs['limit'](_0x4874d7[_0xeb7a('0x4a')]['limit']);_0x3ee82e[_0xeb7a('0x31')]=qs[_0xeb7a('0x31')](_0x4874d7[_0xeb7a('0x4a')][_0xeb7a('0x31')]);}_0x3ee82e[_0xeb7a('0x50')]=qs[_0xeb7a('0x51')](_0x4874d7['query']['sort']);_0x3ee82e[_0xeb7a('0x52')]=qs[_0xeb7a('0x4c')](_['pick'](_0x4874d7[_0xeb7a('0x4a')],_0x1ea628['filters']));_0x3ee82e[_0xeb7a('0x52')][_0xeb7a('0x6a')]=_0xbae3a7['id'];if(_0x4874d7[_0xeb7a('0x4a')][_0xeb7a('0x54')]){_0x3ee82e[_0xeb7a('0x52')]=_[_0xeb7a('0x55')](_0x3ee82e[_0xeb7a('0x52')],{'$or':_['map'](_0x3ee82e[_0xeb7a('0x4e')],function(_0x1b4416){var _0x57bbb3={};_0x57bbb3[_0x1b4416]={'$like':'%'+_0x4874d7[_0xeb7a('0x4a')][_0xeb7a('0x54')]+'%'};return _0x57bbb3;})});}_0x3ee82e=_[_0xeb7a('0x55')]({},_0x3ee82e,_0x4874d7[_0xeb7a('0x5e')]);return db[_0xeb7a('0x6d')][_0xeb7a('0x30')]({'where':_0x3ee82e[_0xeb7a('0x52')]})[_0xeb7a('0x38')](function(_0x594e92){_0x26c6ed[_0xeb7a('0x30')]=_0x594e92;if(_0x4874d7[_0xeb7a('0x4a')][_0xeb7a('0x57')]){_0x3ee82e[_0xeb7a('0x58')]=[{'all':!![]}];}return db[_0xeb7a('0x6d')][_0xeb7a('0x59')](_0x3ee82e);})['then'](function(_0x51cf55){_0x26c6ed[_0xeb7a('0x6e')]=_0x51cf55;return _0x26c6ed;});}})[_0xeb7a('0x38')](respondWithFilteredResult(_0x3eb431,_0x3ee82e))['catch'](handleError(_0x3eb431,null));};exports[_0xeb7a('0x6f')]=function(_0x10c0cf,_0x5292fd,_0x425516){return db[_0xeb7a('0x44')][_0xeb7a('0x5f')]({'where':{'id':_0x10c0cf[_0xeb7a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5292fd,null))[_0xeb7a('0x38')](function(_0x404d8f){if(_0x404d8f){return _0x404d8f['removeDispositions'](_0x10c0cf[_0xeb7a('0x4a')][_0xeb7a('0x70')]);}})[_0xeb7a('0x38')](respondWithStatusCode(_0x5292fd,null))[_0xeb7a('0x5a')](handleError(_0x5292fd,null));};exports[_0xeb7a('0x71')]=function(_0x21dbc0,_0x34a7d6,_0x388095){if(_0x21dbc0[_0xeb7a('0x61')]['id']){delete _0x21dbc0[_0xeb7a('0x61')]['id'];}return db[_0xeb7a('0x44')]['find']({'where':{'id':_0x21dbc0[_0xeb7a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34a7d6,null))[_0xeb7a('0x38')](function(_0x28737e){if(_0x28737e){_0x21dbc0['body']['OpenchannelAccountId']=_0x28737e['id'];return db[_0xeb7a('0x72')]['create'](_0x21dbc0[_0xeb7a('0x61')]);}})[_0xeb7a('0x38')](respondWithResult(_0x34a7d6,null))[_0xeb7a('0x5a')](handleError(_0x34a7d6,null));};exports['getAnswers']=function(_0x570cac,_0x1f95d2,_0x242ab9){var _0x4086c0={'raw':![],'where':{}};var _0x3e12c5={};var _0x472519={'count':0x0,'rows':[]};return db[_0xeb7a('0x44')]['findOne']({'where':{'id':_0x570cac[_0xeb7a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f95d2,null))[_0xeb7a('0x38')](function(_0x8769de){if(_0x8769de){_0x3e12c5[_0xeb7a('0x49')]=_[_0xeb7a('0x4b')](db['CannedAnswer']['rawAttributes']);_0x3e12c5[_0xeb7a('0x4a')]=_['keys'](_0x570cac['query']);_0x3e12c5['filters']=_[_0xeb7a('0x4d')](_0x3e12c5['model'],_0x3e12c5['query']);_0x4086c0['attributes']=_['intersection'](_0x3e12c5['model'],qs[_0xeb7a('0x5d')](_0x570cac[_0xeb7a('0x4a')][_0xeb7a('0x5d')]));_0x4086c0[_0xeb7a('0x4e')]=_0x4086c0['attributes'][_0xeb7a('0x4f')]?_0x4086c0[_0xeb7a('0x4e')]:_0x3e12c5[_0xeb7a('0x49')];if(!_0x570cac[_0xeb7a('0x4a')][_0xeb7a('0x73')](_0xeb7a('0x74'))){_0x4086c0[_0xeb7a('0x2f')]=qs[_0xeb7a('0x2f')](_0x570cac[_0xeb7a('0x4a')][_0xeb7a('0x2f')]);_0x4086c0[_0xeb7a('0x31')]=qs[_0xeb7a('0x31')](_0x570cac[_0xeb7a('0x4a')][_0xeb7a('0x31')]);}_0x4086c0['order']=qs[_0xeb7a('0x51')](_0x570cac['query'][_0xeb7a('0x51')]);_0x4086c0['where']=qs[_0xeb7a('0x4c')](_[_0xeb7a('0x53')](_0x570cac[_0xeb7a('0x4a')],_0x3e12c5[_0xeb7a('0x4c')]));_0x4086c0[_0xeb7a('0x52')][_0xeb7a('0x6a')]=_0x8769de['id'];if(_0x570cac['query'][_0xeb7a('0x54')]){_0x4086c0[_0xeb7a('0x52')]=_[_0xeb7a('0x55')](_0x4086c0[_0xeb7a('0x52')],{'$or':_[_0xeb7a('0x43')](_0x4086c0[_0xeb7a('0x4e')],function(_0x5c750c){var _0x2fe697={};_0x2fe697[_0x5c750c]={'$like':'%'+_0x570cac[_0xeb7a('0x4a')]['filter']+'%'};return _0x2fe697;})});}_0x4086c0=_[_0xeb7a('0x55')]({},_0x4086c0,_0x570cac[_0xeb7a('0x5e')]);return db[_0xeb7a('0x72')]['count']({'where':_0x4086c0[_0xeb7a('0x52')]})['then'](function(_0x1177b5){_0x472519['count']=_0x1177b5;if(_0x570cac[_0xeb7a('0x4a')][_0xeb7a('0x57')]){_0x4086c0['include']=[{'all':!![]}];}return db[_0xeb7a('0x72')][_0xeb7a('0x59')](_0x4086c0);})[_0xeb7a('0x38')](function(_0x2888cd){_0x472519[_0xeb7a('0x6e')]=_0x2888cd;return _0x472519;});}})[_0xeb7a('0x38')](respondWithFilteredResult(_0x1f95d2,_0x4086c0))['catch'](handleError(_0x1f95d2,null));};exports[_0xeb7a('0x75')]=function(_0x50f8eb,_0x3f257c,_0x477469){return db['OpenchannelAccount'][_0xeb7a('0x5f')]({'where':{'id':_0x50f8eb[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x3f257c,null))['then'](function(_0x2f552e){if(_0x2f552e){return _0x2f552e[_0xeb7a('0x75')](_0x50f8eb['query'][_0xeb7a('0x70')]);}})[_0xeb7a('0x38')](respondWithStatusCode(_0x3f257c,null))[_0xeb7a('0x5a')](handleError(_0x3f257c,null));};exports[_0xeb7a('0x76')]=function(_0x3fec13,_0x13bf5b,_0x3fd00a){var _0x396b72={'body':_0x3fec13[_0xeb7a('0x61')],'channel':_0xeb7a('0x77')};var _0x5547b3=[];var _0xdd4464=[];var _0x4b8956={};var _0x1ac380=![];return db[_0xeb7a('0x78')]['describe']()[_0xeb7a('0x38')](function(_0x2d819e){if(!_0x2d819e){throw new db['Sequelize']['ValidationError'](_0xeb7a('0x79'));}_0x5547b3=_['difference'](_[_0xeb7a('0x4b')](_0x2d819e),[_0xeb7a('0x7a'),_0xeb7a('0x7b')]);_0xdd4464=_[_0xeb7a('0x7c')](_[_0xeb7a('0x4b')](_0x2d819e),[_0xeb7a('0x7a'),'updatedAt',_0xeb7a('0x7d'),_0xeb7a('0x7e')]);if(_0x3fec13[_0xeb7a('0x61')]['id']){delete _0x3fec13[_0xeb7a('0x61')]['id'];}if(_[_0xeb7a('0x7f')](_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x80')])){throw new db['Sequelize'][(_0xeb7a('0x81'))](_0xeb7a('0x82'));}if(_[_0xeb7a('0x7f')](_0x3fec13['body']['body'])||_0x3fec13['body'][_0xeb7a('0x61')]===''){throw new db['Sequelize'][(_0xeb7a('0x81'))](_0xeb7a('0x83'));}if(_[_0xeb7a('0x7f')](_0x3fec13[_0xeb7a('0x61')]['mapKey'])){throw new db[(_0xeb7a('0x84'))][(_0xeb7a('0x81'))](_0xeb7a('0x85')+_0xdd4464);}if(!_['includes'](_0xdd4464,_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x86')])){throw new db[(_0xeb7a('0x84'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xdd4464);}_0x4b8956[_0x3fec13[_0xeb7a('0x61')]['mapKey']]=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x80')];})[_0xeb7a('0x38')](function(){return db[_0xeb7a('0x44')]['find']({'where':{'id':_0x3fec13[_0xeb7a('0x5c')]['id']},'include':[{'model':db[_0xeb7a('0x87')],'as':'List','include':[{'model':db[_0xeb7a('0x78')],'as':_0xeb7a('0x88'),'where':_0x4b8956,'limit':0x1,'order':[['updatedAt',_0xeb7a('0x89')]]}]},{'model':db[_0xeb7a('0x8a')],'as':'Applications'}]});})[_0xeb7a('0x38')](handleEntityNotFound(_0x13bf5b,null))['then'](function(_0x12dcd3){if(_0x12dcd3&&_0x12dcd3['List']){_0x396b72[_0xeb7a('0x8b')]=_0x12dcd3;_0x396b72['applications']=_0x12dcd3[_0xeb7a('0x8c')];_0x396b72[_0xeb7a('0x8d')]=_0x12dcd3['List'];_0x396b72['applications']=_['orderBy'](_0x396b72[_0xeb7a('0x8e')],[_0xeb7a('0x8f')],[_0xeb7a('0x90')]);if(_0x396b72['account']['Applications']){delete _0x396b72['account'][_0xeb7a('0x8c')];}if(_0x396b72['account']['List']&&_0x396b72['account']['List'][_0xeb7a('0x88')]['length']){return _0x396b72[_0xeb7a('0x8b')][_0xeb7a('0x91')][_0xeb7a('0x88')][0x0];}var _0x7b4c0d=_[_0xeb7a('0x1c')](_0x3fec13['body'],{'firstName':_0x3fec13[_0xeb7a('0x61')]['from'],'ListId':_0x12dcd3[_0xeb7a('0x7e')]});_0x7b4c0d[_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x86')]]=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x80')];return db['CmContact'][_0xeb7a('0x60')](_0x7b4c0d,{'fields':_0x5547b3,'raw':!![]});}})[_0xeb7a('0x38')](handleEntityNotFound(_0x13bf5b,null))[_0xeb7a('0x38')](function(_0x56cc8e){_0x396b72[_0xeb7a('0x92')]=_0x56cc8e;if(_0x56cc8e){var _0x3aaeed={'ContactId':_0x56cc8e['id'],'OpenchannelAccountId':_0x3fec13['params']['id'],'from':(_0x56cc8e[_0xeb7a('0x93')]||'')+'\x20'+(_0x56cc8e[_0xeb7a('0x94')]||'')};var _0x107955={'OpenchannelAccountId':_0x3fec13[_0xeb7a('0x5c')]['id'],'closed':![]};if(_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x95')]){_0x107955[_0xeb7a('0x95')]=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x95')];return db[_0xeb7a('0x96')][_0xeb7a('0x5f')]({'where':_0x107955})['then'](function(_0x2390c5){if(_0x2390c5){return[_0x2390c5,![]];}_0x3aaeed['threadId']=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x95')];_0x3aaeed[_0xeb7a('0x97')]=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x97')];return db[_0xeb7a('0x96')][_0xeb7a('0x60')](_0x3aaeed)['then'](function(_0x1fa0c1){return[_0x1fa0c1,!![]];});});}else{_0x107955[_0xeb7a('0x95')]=null;}_0x107955[_0xeb7a('0x98')]=_0x56cc8e['id'];return db['OpenchannelInteraction']['find']({'where':_0x107955})[_0xeb7a('0x38')](function(_0x3a82bc){if(_0x3a82bc){return[_0x3a82bc,![]];}return db[_0xeb7a('0x96')][_0xeb7a('0x60')](_0x3aaeed)[_0xeb7a('0x38')](function(_0x41eb2d){return[_0x41eb2d,!![]];});});}})[_0xeb7a('0x99')](function(_0x297070,_0x4206e4){if(_0x297070){_0x1ac380=_0x4206e4;if(!_0x4206e4){var _0x5b7c24={'from':(_0x396b72[_0xeb7a('0x92')]['firstName']||'')+'\x20'+(_0x396b72[_0xeb7a('0x92')][_0xeb7a('0x94')]||'')};if(_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x95')]&&_0x3fec13['body'][_0xeb7a('0x9a')]&&_0x3fec13[_0xeb7a('0x61')]['threadId']!=_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x9a')]){_0x5b7c24['threadId']=_0x3fec13['body'][_0xeb7a('0x9a')];}return _0x297070[_0xeb7a('0x37')](_0x5b7c24);}else{return _0x297070;}}})[_0xeb7a('0x38')](function(_0x36cb31){_0x396b72['interaction']=_0x36cb31[_0xeb7a('0x3a')]({'plain':!![]});_0x396b72[_0xeb7a('0x9b')][_0xeb7a('0x9c')]=_0x1ac380;if(_0x396b72[_0xeb7a('0x9b')][_0xeb7a('0x9c')]){if(_0x396b72[_0xeb7a('0x8b')]['autoclose']){_0x396b72[_0xeb7a('0x8e')][_0xeb7a('0x9d')]({'id':0x0,'priority':_0x396b72[_0xeb7a('0x8e')][_0xeb7a('0x4f')]+0x1,'app':_0xeb7a('0x9e'),'appdata':_0xeb7a('0x9f'),'interval':_0xeb7a('0xa0')});}}return db[_0xeb7a('0xa1')]['create']({'body':_0x3fec13[_0xeb7a('0x61')][_0xeb7a('0x61')],'OpenchannelAccountId':_0x3fec13[_0xeb7a('0x5c')]['id'],'OpenchannelInteractionId':_0x36cb31['id'],'direction':'in','ContactId':_0x396b72[_0xeb7a('0x92')]['id'],'AttachmentId':_0x3fec13[_0xeb7a('0x61')]['AttachmentId']});})[_0xeb7a('0x38')](function(_0x4b83c5){_0x396b72[_0xeb7a('0x28')]=_0x4b83c5;if(!_0x396b72[_0xeb7a('0x9b')][_0xeb7a('0xa2')])return;return db[_0xeb7a('0xa3')][_0xeb7a('0x5f')]({'attributes':['id',_0xeb7a('0x3f')],'where':{'id':_0x396b72['interaction'][_0xeb7a('0xa2')]}});})[_0xeb7a('0x38')](function(_0x27a258){if(_0x27a258){_0x396b72[_0xeb7a('0x8e')][_0xeb7a('0xa4')]({'id':0x0,'priority':0x0,'app':_0xeb7a('0xa5'),'appdata':_0x27a258[_0xeb7a('0x3f')]+','+(_0x396b72[_0xeb7a('0x8b')][_0xeb7a('0xa6')]||0xa),'interval':_0xeb7a('0xa0')});}if(!_0x396b72['interaction'][_0xeb7a('0xa7')])return;return db[_0xeb7a('0xa8')][_0xeb7a('0x5f')]({'attributes':['id',_0xeb7a('0x3f')],'where':{'id':_0x396b72[_0xeb7a('0x9b')][_0xeb7a('0xa7')]}});})[_0xeb7a('0x38')](function(_0x3ea8e5){if(_0x3ea8e5){_0x396b72[_0xeb7a('0x8e')][_0xeb7a('0xa4')]({'id':0x0,'priority':0x1,'app':_0xeb7a('0xa9'),'appdata':_0x3ea8e5[_0xeb7a('0x3f')]+','+(_0x396b72[_0xeb7a('0x8b')]['waitForTheAssignedQueue']||0x12c),'interval':_0xeb7a('0xa0')});}return respondWithRpcPromise(_0xeb7a('0xaa'),'startRouting',_0x396b72);})[_0xeb7a('0x38')](function(_0x583dde){respondWithRpcPromise('EventManager',_0xeb7a('0xab'),{'event':'notify','message':_0x583dde},client9002);return _0x583dde;})[_0xeb7a('0x38')](respondWithResult(_0x13bf5b,null))[_0xeb7a('0x5a')](handleError(_0x13bf5b,null));};exports[_0xeb7a('0xac')]=function(_0x551e35,_0x37bc30){var _0x426114=_0x551e35[_0xeb7a('0x5c')]['id'];var _0x3620aa=_0x551e35[_0xeb7a('0x61')];var _0xfb467d=0xc8;var _0x3ccb04=null;return db['sequelize'][_0xeb7a('0xad')]({'isolationLevel':db[_0xeb7a('0xae')][_0xeb7a('0xaf')][_0xeb7a('0xb0')][_0xeb7a('0xb1')]},function(_0x4bf518){return db[_0xeb7a('0x44')][_0xeb7a('0x6c')]({'where':{'id':_0x426114},'transaction':_0x4bf518})['then'](function(_0xc7786f){if(_0xc7786f){return db[_0xeb7a('0x8a')][_0xeb7a('0x39')]({'where':{'OpenchannelAccountId':_0x426114},'transaction':_0x4bf518})[_0xeb7a('0x38')](function(){var _0x56cb98=_['map'](_0x3620aa,function(_0x560293){_0x560293['OpenchannelAccountId']=_0x426114;return _0x560293;});return db[_0xeb7a('0x8a')][_0xeb7a('0xb2')](_0x56cb98,{'transaction':_0x4bf518});});}else{_0xfb467d=0x194;_0x3ccb04=[];}});})[_0xeb7a('0x38')](function(){if(_0xfb467d!==0x194){return db[_0xeb7a('0x8a')][_0xeb7a('0xb3')]({'where':{'OpenchannelAccountId':_0x426114},'order':_0xeb7a('0x8f')})[_0xeb7a('0x38')](function(_0x1bb69c){_0x3ccb04=_0x1bb69c;});}})[_0xeb7a('0x5a')](function(_0x3db7a3){_0xfb467d=0x1f4;logger['error'](_0x3db7a3[_0xeb7a('0x3e')]);if(_0x3db7a3[_0xeb7a('0x3f')]){delete _0x3db7a3[_0xeb7a('0x3f')];}_0x3ccb04=_0x3db7a3;})[_0xeb7a('0xb4')](function(){if(_0x3ccb04===null){_0x37bc30['sendStatus'](_0xfb467d);}else{if(_0xfb467d===0x1f4){_0x37bc30[_0xeb7a('0x2b')](_0xfb467d)[_0xeb7a('0xb5')](_0x3ccb04);}else{_0x37bc30[_0xeb7a('0x2b')](_0xfb467d)[_0xeb7a('0x2d')](_0x3ccb04);}}});};exports[_0xeb7a('0xb6')]=function(_0xf9c22d,_0x256f58,_0x1a4669){var _0x252a81={};var _0x365e54={};var _0x30a68a;var _0x255d47;return db['OpenchannelAccount'][_0xeb7a('0x6c')]({'where':{'id':_0xf9c22d['params']['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x256f58,null))[_0xeb7a('0x38')](function(_0x22bc14){if(_0x22bc14){_0x30a68a=_0x22bc14;_0x365e54['model']=_['keys'](db[_0xeb7a('0x8a')][_0xeb7a('0x45')]);_0x365e54[_0xeb7a('0x4a')]=_[_0xeb7a('0x4b')](_0xf9c22d[_0xeb7a('0x4a')]);_0x365e54[_0xeb7a('0x4c')]=_[_0xeb7a('0x4d')](_0x365e54[_0xeb7a('0x49')],_0x365e54[_0xeb7a('0x4a')]);_0x252a81['attributes']=_[_0xeb7a('0x4d')](_0x365e54[_0xeb7a('0x49')],qs[_0xeb7a('0x5d')](_0xf9c22d['query']['fields']));_0x252a81[_0xeb7a('0x4e')]=_0x252a81[_0xeb7a('0x4e')][_0xeb7a('0x4f')]?_0x252a81[_0xeb7a('0x4e')]:_0x365e54[_0xeb7a('0x49')];_0x252a81[_0xeb7a('0x50')]=qs[_0xeb7a('0x51')](_0xf9c22d[_0xeb7a('0x4a')][_0xeb7a('0x51')]);_0x252a81['where']=qs[_0xeb7a('0x4c')](_['pick'](_0xf9c22d[_0xeb7a('0x4a')],_0x365e54[_0xeb7a('0x4c')]));if(_0xf9c22d['query'][_0xeb7a('0x54')]){_0x252a81['where']=_[_0xeb7a('0x55')](_0x252a81[_0xeb7a('0x52')],{'$or':_['map'](_0x252a81[_0xeb7a('0x4e')],function(_0x1185bc){var _0x19a8a4={};_0x19a8a4[_0x1185bc]={'$like':'%'+_0xf9c22d[_0xeb7a('0x4a')][_0xeb7a('0x54')]+'%'};return _0x19a8a4;})});}_0x252a81=_['merge']({},_0x252a81,_0xf9c22d[_0xeb7a('0x5e')]);return _0x30a68a[_0xeb7a('0xb6')](_0x252a81);}})[_0xeb7a('0x38')](function(_0x462528){if(_0x462528){_0x255d47=_0x462528[_0xeb7a('0x4f')];if(!_0xf9c22d[_0xeb7a('0x4a')][_0xeb7a('0x73')](_0xeb7a('0x74'))){_0x252a81[_0xeb7a('0x2f')]=qs[_0xeb7a('0x2f')](_0xf9c22d[_0xeb7a('0x4a')][_0xeb7a('0x2f')]);_0x252a81['offset']=qs[_0xeb7a('0x31')](_0xf9c22d[_0xeb7a('0x4a')][_0xeb7a('0x31')]);}return _0x30a68a[_0xeb7a('0xb6')](_0x252a81);}})[_0xeb7a('0x38')](function(_0x59d4f9){if(_0x59d4f9){return _0x59d4f9?{'count':_0x255d47,'rows':_0x59d4f9}:null;}})[_0xeb7a('0x38')](respondWithResult(_0x256f58,null))[_0xeb7a('0x5a')](handleError(_0x256f58,null));};exports[_0xeb7a('0xb7')]=function(_0x1b472d,_0x1a963d,_0x42dafb){var _0x3d1f65={'raw':![],'where':{}};var _0x8cb6f6={};var _0x485bfb={'count':0x0,'rows':[]};return db[_0xeb7a('0x44')][_0xeb7a('0x6c')]({'where':{'id':_0x1b472d[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x1a963d,null))[_0xeb7a('0x38')](function(_0x1d6e2b){if(_0x1d6e2b){_0x8cb6f6[_0xeb7a('0x49')]=_[_0xeb7a('0x4b')](db[_0xeb7a('0x96')]['rawAttributes']);_0x8cb6f6[_0xeb7a('0x4a')]=_[_0xeb7a('0x4b')](_0x1b472d['query']);_0x8cb6f6['filters']=_[_0xeb7a('0x4d')](_0x8cb6f6['model'],_0x8cb6f6[_0xeb7a('0x4a')]);_0x3d1f65[_0xeb7a('0x4e')]=_[_0xeb7a('0x4d')](_0x8cb6f6['model'],qs[_0xeb7a('0x5d')](_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0x5d')]));_0x3d1f65[_0xeb7a('0x4e')]=_0x3d1f65['attributes'][_0xeb7a('0x4f')]?_0x3d1f65[_0xeb7a('0x4e')]:_0x8cb6f6[_0xeb7a('0x49')];if(!_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0x73')]('nolimit')){_0x3d1f65[_0xeb7a('0x2f')]=qs[_0xeb7a('0x2f')](_0x1b472d['query'][_0xeb7a('0x2f')]);_0x3d1f65[_0xeb7a('0x31')]=qs[_0xeb7a('0x31')](_0x1b472d[_0xeb7a('0x4a')]['offset']);}_0x3d1f65[_0xeb7a('0x50')]=qs[_0xeb7a('0x51')](_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0x51')]);_0x3d1f65['where']=qs[_0xeb7a('0x4c')](_['pick'](_0x1b472d[_0xeb7a('0x4a')],_0x8cb6f6[_0xeb7a('0x4c')]));_0x3d1f65['where'][_0xeb7a('0x6a')]=_0x1d6e2b['id'];if(_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0x54')]){_0x3d1f65['where']=_[_0xeb7a('0x55')](_0x3d1f65['where'],{'$or':_[_0xeb7a('0x43')](_0x3d1f65['attributes'],function(_0x5b32b9){var _0x1c7770={};_0x1c7770[_0x5b32b9]={'$like':'%'+_0x1b472d['query'][_0xeb7a('0x54')]+'%'};return _0x1c7770;})});}_0x3d1f65=_[_0xeb7a('0x55')]({},_0x3d1f65,_0x1b472d[_0xeb7a('0x5e')]);return db[_0xeb7a('0x96')]['count']({'where':_0x3d1f65[_0xeb7a('0x52')]})[_0xeb7a('0x38')](function(_0xba0723){_0x485bfb['count']=_0xba0723;if(_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0x57')]){_0x3d1f65[_0xeb7a('0x58')]=[{'model':db[_0xeb7a('0x78')],'as':_0xeb7a('0xb8'),'required':![]},{'model':db[_0xeb7a('0xa3')],'as':_0xeb7a('0xb9'),'attributes':[_0xeb7a('0x3f'),_0xeb7a('0xba'),_0xeb7a('0xbb')],'required':![]},{'model':db[_0xeb7a('0xbc')],'as':'Tags','attributes':['id',_0xeb7a('0x3f'),_0xeb7a('0xbd')],'where':_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0xbe')]?{'id':_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0xbe')]}:undefined,'required':_0x1b472d[_0xeb7a('0x4a')][_0xeb7a('0xbe')]?!![]:![]}];}return db[_0xeb7a('0x96')][_0xeb7a('0x59')](_0x3d1f65);})[_0xeb7a('0x38')](function(_0x394571){_0x485bfb['rows']=_0x394571;return _0x485bfb;});}})['then'](respondWithFilteredResult(_0x1a963d,_0x3d1f65))['catch'](handleError(_0x1a963d,null));};exports[_0xeb7a('0xbf')]=function(_0x117fbf,_0x3abde1,_0x122919){return db[_0xeb7a('0x44')][_0xeb7a('0x5f')]({'where':{'id':_0x117fbf[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x3abde1,null))[_0xeb7a('0x38')](function(_0x42adba){if(_0x42adba){return _0x42adba[_0xeb7a('0xbf')](_0x117fbf[_0xeb7a('0x61')][_0xeb7a('0x70')],_['omit'](_0x117fbf['body'],[_0xeb7a('0x70'),'id'])||{})[_0xeb7a('0x99')](function(_0x216642){for(var _0x19f9e8=0x0;_0x19f9e8<_0x117fbf[_0xeb7a('0x61')]['ids']['length'];_0x19f9e8+=0x1){socket[_0xeb7a('0xc0')](_0xeb7a('0xc1'),{'UserId':Number(_0x117fbf[_0xeb7a('0x61')]['ids'][_0x19f9e8]),'OpenchannelAccountId':Number(_0x117fbf[_0xeb7a('0x5c')]['id'])});}return _0x216642;});}})[_0xeb7a('0x38')](respondWithResult(_0x3abde1,null))[_0xeb7a('0x5a')](handleError(_0x3abde1,null));};exports[_0xeb7a('0xc2')]=function(_0x520356,_0x4714a4,_0x4e1c5a){return db[_0xeb7a('0x44')][_0xeb7a('0x5f')]({'where':{'id':_0x520356['params']['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x4714a4,null))[_0xeb7a('0x38')](function(_0x94f793){if(_0x94f793){return _0x94f793[_0xeb7a('0xc2')](_0x520356[_0xeb7a('0x4a')]['ids'])['then'](function(){if(_[_0xeb7a('0xc3')](_0x520356[_0xeb7a('0x4a')][_0xeb7a('0x70')])){for(var _0x537036=0x0;_0x537036<_0x520356[_0xeb7a('0x4a')][_0xeb7a('0x70')][_0xeb7a('0x4f')];_0x537036+=0x1){socket[_0xeb7a('0xc0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x520356['query'][_0xeb7a('0x70')][_0x537036]),'OpenchannelAccountId':Number(_0x520356[_0xeb7a('0x5c')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x520356[_0xeb7a('0x4a')][_0xeb7a('0x70')]),'OpenchannelAccountId':Number(_0x520356[_0xeb7a('0x5c')]['id'])});}});}})[_0xeb7a('0x38')](respondWithStatusCode(_0x4714a4,null))[_0xeb7a('0x5a')](handleError(_0x4714a4,null));};exports[_0xeb7a('0xc4')]=function(_0x3841f7,_0x4585ac,_0x25008a){var _0x4fbf31={};var _0x4abde4={};var _0x46d490;var _0x239053;return db['OpenchannelAccount'][_0xeb7a('0x6c')]({'where':{'id':_0x3841f7['params']['id']}})['then'](handleEntityNotFound(_0x4585ac,null))['then'](function(_0x2d8344){if(_0x2d8344){_0x46d490=_0x2d8344;_0x4abde4['model']=_[_0xeb7a('0x4b')](db[_0xeb7a('0xa3')][_0xeb7a('0x45')]);_0x4abde4['query']=_[_0xeb7a('0x4b')](_0x3841f7[_0xeb7a('0x4a')]);_0x4abde4[_0xeb7a('0x4c')]=_['intersection'](_0x4abde4[_0xeb7a('0x49')],_0x4abde4['query']);_0x4fbf31[_0xeb7a('0x4e')]=_[_0xeb7a('0x4d')](_0x4abde4[_0xeb7a('0x49')],qs[_0xeb7a('0x5d')](_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x5d')]));_0x4fbf31[_0xeb7a('0x4e')]=_0x4fbf31[_0xeb7a('0x4e')][_0xeb7a('0x4f')]?_0x4fbf31[_0xeb7a('0x4e')]:_0x4abde4[_0xeb7a('0x49')];_0x4fbf31[_0xeb7a('0x50')]=qs['sort'](_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x51')]);_0x4fbf31[_0xeb7a('0x52')]=qs['filters'](_[_0xeb7a('0x53')](_0x3841f7['query'],_0x4abde4['filters']));if(_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x54')]){_0x4fbf31['where']=_[_0xeb7a('0x55')](_0x4fbf31[_0xeb7a('0x52')],{'$or':_[_0xeb7a('0x43')](_0x4fbf31['attributes'],function(_0x11f5c1){var _0x423182={};_0x423182[_0x11f5c1]={'$like':'%'+_0x3841f7['query'][_0xeb7a('0x54')]+'%'};return _0x423182;})});}_0x4fbf31=_[_0xeb7a('0x55')]({},_0x4fbf31,_0x3841f7['options']);return _0x46d490['getAgents'](_0x4fbf31);}})[_0xeb7a('0x38')](function(_0x403ae0){if(_0x403ae0){_0x239053=_0x403ae0[_0xeb7a('0x4f')];if(!_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x73')](_0xeb7a('0x74'))){_0x4fbf31[_0xeb7a('0x2f')]=qs[_0xeb7a('0x2f')](_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x2f')]);_0x4fbf31['offset']=qs['offset'](_0x3841f7[_0xeb7a('0x4a')][_0xeb7a('0x31')]);}return _0x46d490[_0xeb7a('0xc4')](_0x4fbf31);}})[_0xeb7a('0x38')](function(_0x13b590){if(_0x13b590){return _0x13b590?{'count':_0x239053,'rows':_0x13b590}:null;}})[_0xeb7a('0x38')](respondWithResult(_0x4585ac,null))[_0xeb7a('0x5a')](handleError(_0x4585ac,null));};exports[_0xeb7a('0xb5')]=function(_0x23f977,_0x2ed9a8,_0x5bc3e2){var _0x5600f5,_0x189e69,_0x6107b0;if(_[_0xeb7a('0x7f')](_0x23f977[_0xeb7a('0x61')][_0xeb7a('0x61')])||_0x23f977[_0xeb7a('0x61')][_0xeb7a('0x61')]===''){throw new db[(_0xeb7a('0x84'))][(_0xeb7a('0x81'))](_0xeb7a('0x83'));}if(_[_0xeb7a('0x7f')](_0x23f977['body']['to'])){}_0x5600f5=_0x23f977[_0xeb7a('0x61')]['to'];return db[_0xeb7a('0x44')][_0xeb7a('0x6c')]({'where':{'id':_0x23f977[_0xeb7a('0x5c')]['id']}})[_0xeb7a('0x38')](handleEntityNotFound(_0x2ed9a8,null))[_0xeb7a('0x38')](function(_0x5550a0){if(_0x5550a0){return db['OpenchannelAccount'][_0xeb7a('0x5f')]({'where':{'id':_0x5550a0['id']},'include':[{'model':db[_0xeb7a('0x87')],'as':_0xeb7a('0x91'),'include':[{'model':db[_0xeb7a('0x78')],'as':'Contacts','where':{[_0x5550a0['mapKey']]:_0x5600f5},'limit':0x1,'order':[[_0xeb7a('0x7b'),_0xeb7a('0x89')]]}]}]})[_0xeb7a('0x38')](handleEntityNotFound(_0x2ed9a8,null))[_0xeb7a('0x38')](function(_0x50e8af){if(_0x50e8af&&_0x50e8af['List']){_0x189e69=_0x50e8af[_0xeb7a('0x3a')]({'plain':!![]});if(_0x189e69[_0xeb7a('0x91')]&&_0x189e69[_0xeb7a('0x91')]['Contacts']['length']){return _0x189e69['List'][_0xeb7a('0x88')][0x0];}return db['CmContact']['create'](_['defaults'](_0x23f977[_0xeb7a('0x61')],{'firstName':_0x5600f5,[_0x50e8af[_0xeb7a('0x86')]]:_0x5600f5,'phone':_0x5600f5,'ListId':_0x189e69[_0xeb7a('0x7e')]}));}})['then'](handleEntityNotFound(_0x2ed9a8,null))[_0xeb7a('0x38')](function(_0x1d1394){if(_0x1d1394){_0x6107b0=_0x1d1394;return db[_0xeb7a('0x96')][_0xeb7a('0x5f')]({'where':{'ContactId':_0x6107b0['id'],'closed':![],'OpenchannelAccountId':_0x189e69['id']}})[_0xeb7a('0x38')](function(_0x364cd7){if(_0x364cd7){return[_0x364cd7,![]];}return db[_0xeb7a('0x96')]['create']({'UserId':_0x23f977[_0xeb7a('0x62')]['id'],'ContactId':_0x6107b0['id'],'OpenchannelAccountId':_0x189e69['id'],'lastMsgDirection':'out','firstMsgDirection':_0xeb7a('0xc5'),'Messages':[_[_0xeb7a('0x55')](_0x23f977[_0xeb7a('0x61')],{'read':![],'body':_0x23f977[_0xeb7a('0x61')][_0xeb7a('0x61')],'OpenchannelAccountId':_0x189e69['id'],'UserId':_0x23f977[_0xeb7a('0x62')]['id'],'ContactId':_0x6107b0['id']})]},{'include':[{'model':db[_0xeb7a('0xa1')],'as':_0xeb7a('0xc6')}]})[_0xeb7a('0x38')](function(_0x395266){return[_0x395266,!![]];});});}})[_0xeb7a('0x99')](function(_0x26415a,_0x33a96e){if(_0x33a96e){return _0x26415a;}return db[_0xeb7a('0xa1')][_0xeb7a('0x60')](_[_0xeb7a('0x55')](_0x23f977[_0xeb7a('0x61')],{'read':![],'body':_0x23f977[_0xeb7a('0x61')][_0xeb7a('0x61')],'OpenchannelAccountId':_0x189e69['id'],'OpenchannelInteractionId':_0x26415a['id'],'UserId':_0x23f977['user']['id'],'ContactId':_0x6107b0['id']}))[_0xeb7a('0x38')](function(_0x4d0fb5){_0x26415a[_0xeb7a('0xc7')][_0xeb7a('0xc6')]=[];_0x26415a[_0xeb7a('0xc7')][_0xeb7a('0xc6')]['push'](_0x4d0fb5[_0xeb7a('0xc7')]);return _0x26415a;});});}})[_0xeb7a('0x38')](respondWithResult(_0x2ed9a8,null))['catch'](handleError(_0x2ed9a8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d38848a..59ad51a 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners'];(function(_0x586269,_0x17ac94){var _0x599f73=function(_0xc6c428){while(--_0xc6c428){_0x586269['push'](_0x586269['shift']());}};_0x599f73(++_0x17ac94);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xcb91[_0x31abee];return _0x3c1761;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x1cb9('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){OpenchannelAccountEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);OpenchannelAccountEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];OpenchannelAccount[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x36988b,_0x4fd583){var _0xd6bd=function(_0x15588e){while(--_0x15588e){_0x36988b['push'](_0x36988b['shift']());}};_0xd6bd(++_0x4fd583);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xb4e6[_0x21af3a];return _0x268a49;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index be2e421..cc5f5ad 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(_0x36db3e,_0x3b72c9){var _0x5f1e1e=function(_0xe83ae2){while(--_0xe83ae2){_0x36db3e['push'](_0x36db3e['shift']());}};_0x5f1e1e(++_0x3b72c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x4168dc,_0x291351){var _0x40c241=function(_0x496909){while(--_0x496909){_0x4168dc['push'](_0x4168dc['shift']());}};_0x40c241(++_0x291351);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 ee57d46..9a90d29 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 _0x153f=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x25421,_0x3b11f0){var _0x2ea54d=function(_0x287901){while(--_0x287901){_0x25421['push'](_0x25421['shift']());}};_0x2ea54d(++_0x3b11f0);}(_0x153f,0x15b));var _0xf153=function(_0x276237,_0x3cd2d1){_0x276237=_0x276237-0x0;var _0x12575f=_0x153f[_0x276237];return _0x12575f;};'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});config[_0xf153('0xc')]=_['defaults'](config[_0xf153('0xc')],{'host':_0xf153('0xd'),'port':0x18eb});var socket=require(_0xf153('0xe'))(new Redis(config[_0xf153('0xc')]));require(_0xf153('0xf'))[_0xf153('0x10')](socket);function respondWithRpcPromise(_0x44845c,_0x15a18b,_0x4f84b){return new BPromise(function(_0xeaccb0,_0x5c8ae9){return client[_0xf153('0x11')](_0x44845c,_0x4f84b)[_0xf153('0x12')](function(_0x2bea70){logger['info'](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));logger[_0xf153('0x15')](_0xf153('0x16'),_0x15a18b,_0xf153('0x14'),JSON[_0xf153('0x17')](_0x2bea70));if(_0x2bea70[_0xf153('0x18')]){if(_0x2bea70[_0xf153('0x18')][_0xf153('0x19')]===0x1f4){logger['error'](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);return _0x5c8ae9(_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);}logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')]['message']);return _0xeaccb0(_0x2bea70[_0xf153('0x18')]['message']);}else{logger[_0xf153('0x1b')](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));_0xeaccb0(_0x2bea70[_0xf153('0x1c')]['message']);}})[_0xf153('0x1d')](function(_0x19122e){logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x19122e);_0x5c8ae9(_0x19122e);});});} \ No newline at end of file +var _0x9348=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9348,0x10d));var _0x8934=function(_0x2419c9,_0x262667){_0x2419c9=_0x2419c9-0x0;var _0x7605e=_0x9348[_0x2419c9];return _0x7605e;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});config[_0x8934('0xc')]=_['defaults'](config[_0x8934('0xc')],{'host':_0x8934('0xd'),'port':0x18eb});var socket=require(_0x8934('0xe'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5336f0,_0x2c722b,_0x554432){return new BPromise(function(_0xe1adf4,_0x8a88c0){return client[_0x8934('0xf')](_0x5336f0,_0x554432)[_0x8934('0x10')](function(_0x28b451){logger[_0x8934('0x11')](_0x8934('0x12'),_0x2c722b,_0x8934('0x13'));logger['debug'](_0x8934('0x14'),_0x2c722b,_0x8934('0x13'),JSON[_0x8934('0x15')](_0x28b451));if(_0x28b451[_0x8934('0x16')]){if(_0x28b451[_0x8934('0x16')][_0x8934('0x17')]===0x1f4){logger['error'](_0x8934('0x12'),_0x2c722b,_0x28b451[_0x8934('0x16')][_0x8934('0x18')]);return _0x8a88c0(_0x28b451[_0x8934('0x16')][_0x8934('0x18')]);}logger[_0x8934('0x16')](_0x8934('0x12'),_0x2c722b,_0x28b451[_0x8934('0x16')]['message']);return _0xe1adf4(_0x28b451[_0x8934('0x16')][_0x8934('0x18')]);}else{logger[_0x8934('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2c722b,'request\x20sent');_0xe1adf4(_0x28b451['result'][_0x8934('0x18')]);}})['catch'](function(_0xe64ebd){logger[_0x8934('0x16')](_0x8934('0x12'),_0x2c722b,_0xe64ebd);_0x8a88c0(_0xe64ebd);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9854fb3..86e439d 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 _0xf2c7=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xf2c7[_0x50f392];return _0x5926f2;};'use strict';var OpenchannelAccountEvents=require(_0x7f2c('0x0'));var events=[_0x7f2c('0x1'),_0x7f2c('0x2'),_0x7f2c('0x3')];function createListener(_0x59224c,_0x243433){return function(_0x2a1e68){_0x243433['emit'](_0x59224c,_0x2a1e68);};}function removeListener(_0x4f340c,_0xebab07){return function(){OpenchannelAccountEvents['removeListener'](_0x4f340c,_0xebab07);};}exports[_0x7f2c('0x4')]=function(_0x835eeb){for(var _0x4e348c=0x0,_0x2216ca=events[_0x7f2c('0x5')];_0x4e348c<_0x2216ca;_0x4e348c++){var _0x3624db=events[_0x4e348c];var _0x5d266e=createListener(_0x7f2c('0x6')+_0x3624db,_0x835eeb);OpenchannelAccountEvents['on'](_0x3624db,_0x5d266e);}}; \ No newline at end of file +var _0x38c3=['save','update','emit','removeListener','length','./openchannelAccount.events'];(function(_0x3360fd,_0x5ed4a4){var _0x55795a=function(_0x508774){while(--_0x508774){_0x3360fd['push'](_0x3360fd['shift']());}};_0x55795a(++_0x5ed4a4);}(_0x38c3,0x13d));var _0x338c=function(_0x433778,_0xf42c22){_0x433778=_0x433778-0x0;var _0x2f530f=_0x38c3[_0x433778];return _0x2f530f;};'use strict';var OpenchannelAccountEvents=require(_0x338c('0x0'));var events=[_0x338c('0x1'),'remove',_0x338c('0x2')];function createListener(_0x2337a1,_0x36a187){return function(_0x971816){_0x36a187[_0x338c('0x3')](_0x2337a1,_0x971816);};}function removeListener(_0xbe0aef,_0x4acb1a){return function(){OpenchannelAccountEvents[_0x338c('0x4')](_0xbe0aef,_0x4acb1a);};}exports['register']=function(_0x41c16d){for(var _0x28eeb3=0x0,_0x4c021d=events[_0x338c('0x5')];_0x28eeb3<_0x4c021d;_0x28eeb3++){var _0x2864c3=events[_0x28eeb3];var _0x46286d=createListener('openchannelAccount:'+_0x2864c3,_0x41c16d);OpenchannelAccountEvents['on'](_0x2864c3,_0x46286d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 04029fa..31289bf 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 _0x283b=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x283b,0x167));var _0xb283=function(_0x27d771,_0x1a50b2){_0x27d771=_0x27d771-0x0;var _0x2ba087=_0x283b[_0x27d771];return _0x2ba087;};'use strict';var multer=require(_0xb283('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb283('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb283('0x2'));var auth=require(_0xb283('0x3'));var interaction=require(_0xb283('0x4'));var config=require('../../config/environment');var controller=require(_0xb283('0x5'));router[_0xb283('0x6')]('/',auth[_0xb283('0x7')](),controller[_0xb283('0x8')]);router['get'](_0xb283('0x9'),auth[_0xb283('0x7')](),controller[_0xb283('0xa')]);router[_0xb283('0xb')]('/',auth[_0xb283('0x7')](),controller[_0xb283('0xc')]);router[_0xb283('0xd')]('/:id',auth[_0xb283('0x7')](),controller[_0xb283('0xe')]);router[_0xb283('0xf')](_0xb283('0x9'),auth[_0xb283('0x7')](),controller[_0xb283('0x10')]);module[_0xb283('0x11')]=router; \ No newline at end of file +var _0x3d88=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','put','/:id','update','destroy','exports','util','express'];(function(_0x1c550e,_0x516943){var _0x3ddc8a=function(_0x5271c6){while(--_0x5271c6){_0x1c550e['push'](_0x1c550e['shift']());}};_0x3ddc8a(++_0x516943);}(_0x3d88,0xb2));var _0x83d8=function(_0x95e007,_0x237a2e){_0x95e007=_0x95e007-0x0;var _0x5ad5a4=_0x3d88[_0x95e007];return _0x5ad5a4;};'use strict';var multer=require('multer');var util=require(_0x83d8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x83d8('0x1'));var router=express[_0x83d8('0x2')]();var fs_extra=require(_0x83d8('0x3'));var auth=require(_0x83d8('0x4'));var interaction=require(_0x83d8('0x5'));var config=require(_0x83d8('0x6'));var controller=require('./openchannelApplication.controller');router[_0x83d8('0x7')]('/',auth[_0x83d8('0x8')](),controller['index']);router['get']('/:id',auth[_0x83d8('0x8')](),controller['show']);router[_0x83d8('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x83d8('0xa')](_0x83d8('0xb'),auth['isAuthenticated'](),controller[_0x83d8('0xc')]);router['delete'](_0x83d8('0xb'),auth[_0x83d8('0x8')](),controller[_0x83d8('0xd')]);module[_0x83d8('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 27f73e8..8c89128 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 _0x697d=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x39d5ef,_0x842a3e){var _0x1f1a76=function(_0x15827e){while(--_0x15827e){_0x39d5ef['push'](_0x39d5ef['shift']());}};_0x1f1a76(++_0x842a3e);}(_0x697d,0x1b6));var _0xd697=function(_0x5af4c7,_0x4e2c95){_0x5af4c7=_0x5af4c7-0x0;var _0xb7ee2a=_0x697d[_0x5af4c7];return _0xb7ee2a;};'use strict';var Sequelize=require(_0xd697('0x0'));module[_0xd697('0x1')]={'priority':{'type':Sequelize[_0xd697('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd697('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd697('0x4')]},'interval':{'type':Sequelize[_0xd697('0x4')],'defaultValue':_0xd697('0x5')}}; \ No newline at end of file +var _0x3825=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3825,0x7f));var _0x5382=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x3825[_0x15e6fe];return _0x34894d;};'use strict';var Sequelize=require(_0x5382('0x0'));module[_0x5382('0x1')]={'priority':{'type':Sequelize[_0x5382('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5382('0x3')],'allowNull':![],'defaultValue':_0x5382('0x4')},'appdata':{'type':Sequelize[_0x5382('0x5')]()},'description':{'type':Sequelize[_0x5382('0x3')]},'interval':{'type':Sequelize[_0x5382('0x3')],'defaultValue':_0x5382('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 644786c..79db666 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 _0x913d=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','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','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','OpenchannelApplication','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','find','create','body'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x913d,0x129));var _0xd913=function(_0x111216,_0x10f85d){_0x111216=_0x111216-0x0;var _0x4ce4d0=_0x913d[_0x111216];return _0x4ce4d0;};'use strict';var emlformat=require(_0xd913('0x0'));var rimraf=require(_0xd913('0x1'));var zipdir=require(_0xd913('0x2'));var jsonpatch=require(_0xd913('0x3'));var rp=require(_0xd913('0x4'));var moment=require(_0xd913('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd913('0x6'));var util=require(_0xd913('0x7'));var path=require(_0xd913('0x8'));var sox=require('sox');var csv=require(_0xd913('0x9'));var ejs=require(_0xd913('0xa'));var fs=require('fs');var fs_extra=require(_0xd913('0xb'));var _=require('lodash');var squel=require(_0xd913('0xc'));var crypto=require(_0xd913('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd913('0xe'));var toCsv=require(_0xd913('0x9'));var querystring=require(_0xd913('0xf'));var Papa=require(_0xd913('0x10'));var Redis=require('ioredis');var authService=require(_0xd913('0x11'));var qs=require(_0xd913('0x12'));var as=require(_0xd913('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd913('0x14'))(_0xd913('0x15'));var utils=require(_0xd913('0x16'));var config=require(_0xd913('0x17'));var licenseUtil=require(_0xd913('0x18'));var db=require(_0xd913('0x19'))['db'];function respondWithStatusCode(_0x2c2db0,_0x4e12df){_0x4e12df=_0x4e12df||0xcc;return function(_0x28b990){if(_0x28b990){return _0x2c2db0[_0xd913('0x1a')](_0x4e12df);}return _0x2c2db0[_0xd913('0x1b')](_0x4e12df)[_0xd913('0x1c')]();};}function respondWithResult(_0x54e538,_0x5c3615){_0x5c3615=_0x5c3615||0xc8;return function(_0x3260da){if(_0x3260da){return _0x54e538[_0xd913('0x1b')](_0x5c3615)[_0xd913('0x1d')](_0x3260da);}};}function respondWithFilteredResult(_0x3c9949,_0x2339c2){return function(_0x408ea1){if(_0x408ea1){var _0x2f7989=typeof _0x2339c2[_0xd913('0x1e')]===_0xd913('0x1f')&&typeof _0x2339c2[_0xd913('0x20')]==='undefined';var _0x285659=_0x408ea1[_0xd913('0x21')];var _0x57e8ed=_0x2f7989?0x0:_0x2339c2['offset'];var _0x272c0c=_0x2f7989?_0x408ea1[_0xd913('0x21')]:_0x2339c2[_0xd913('0x1e')]+_0x2339c2[_0xd913('0x20')];var _0x26f1ad;if(_0x272c0c>=_0x285659){_0x272c0c=_0x285659;_0x26f1ad=0xc8;}else{_0x26f1ad=0xce;}_0x3c9949[_0xd913('0x1b')](_0x26f1ad);return _0x3c9949[_0xd913('0x22')](_0xd913('0x23'),_0x57e8ed+'-'+_0x272c0c+'/'+_0x285659)[_0xd913('0x1d')](_0x408ea1);}return null;};}function patchUpdates(_0x349c78){return function(_0x391e6f){try{jsonpatch[_0xd913('0x24')](_0x391e6f,_0x349c78,!![]);}catch(_0x4eb909){return BPromise[_0xd913('0x25')](_0x4eb909);}return _0x391e6f[_0xd913('0x26')]();};}function saveUpdates(_0x1f0b3c,_0x392614){return function(_0x282410){if(_0x282410){return _0x282410[_0xd913('0x27')](_0x1f0b3c)['then'](function(_0x130528){return _0x130528;});}return null;};}function removeEntity(_0x48cad1,_0x67cf40){return function(_0xabd580){if(_0xabd580){return _0xabd580['destroy']()[_0xd913('0x28')](function(){_0x48cad1[_0xd913('0x1b')](0xcc)[_0xd913('0x1c')]();});}};}function handleEntityNotFound(_0x937e8b,_0x5ba87c){return function(_0x544f99){if(!_0x544f99){_0x937e8b[_0xd913('0x1a')](0x194);}return _0x544f99;};}function handleError(_0x377e20,_0xee5c59){_0xee5c59=_0xee5c59||0x1f4;return function(_0x1b0e88){logger[_0xd913('0x29')](_0x1b0e88['stack']);if(_0x1b0e88['name']){delete _0x1b0e88[_0xd913('0x2a')];}_0x377e20[_0xd913('0x1b')](_0xee5c59)[_0xd913('0x2b')](_0x1b0e88);};}exports[_0xd913('0x2c')]=function(_0x1af4a6,_0x2cd5e1){var _0x410935={},_0xbdc0f3={},_0x24a05c={'count':0x0,'rows':[]};var _0x5a105a=_['map'](db[_0xd913('0x2d')]['rawAttributes'],function(_0x3d4f6a){return{'name':_0x3d4f6a[_0xd913('0x2e')],'type':_0x3d4f6a[_0xd913('0x2f')]['key']};});_0xbdc0f3['model']=_[_0xd913('0x30')](_0x5a105a,_0xd913('0x2a'));_0xbdc0f3[_0xd913('0x31')]=_[_0xd913('0x32')](_0x1af4a6[_0xd913('0x31')]);_0xbdc0f3[_0xd913('0x33')]=_['intersection'](_0xbdc0f3[_0xd913('0x34')],_0xbdc0f3[_0xd913('0x31')]);_0x410935[_0xd913('0x35')]=_[_0xd913('0x36')](_0xbdc0f3[_0xd913('0x34')],qs[_0xd913('0x37')](_0x1af4a6[_0xd913('0x31')][_0xd913('0x37')]));_0x410935[_0xd913('0x35')]=_0x410935[_0xd913('0x35')][_0xd913('0x38')]?_0x410935[_0xd913('0x35')]:_0xbdc0f3[_0xd913('0x34')];if(!_0x1af4a6[_0xd913('0x31')][_0xd913('0x39')]('nolimit')){_0x410935[_0xd913('0x20')]=qs[_0xd913('0x20')](_0x1af4a6[_0xd913('0x31')][_0xd913('0x20')]);_0x410935[_0xd913('0x1e')]=qs[_0xd913('0x1e')](_0x1af4a6[_0xd913('0x31')][_0xd913('0x1e')]);}_0x410935['order']=qs['sort'](_0x1af4a6[_0xd913('0x31')][_0xd913('0x3a')]);_0x410935['where']=qs[_0xd913('0x33')](_[_0xd913('0x3b')](_0x1af4a6[_0xd913('0x31')],_0xbdc0f3['filters']),_0x5a105a);if(_0x1af4a6[_0xd913('0x31')][_0xd913('0x3c')]){_0x410935[_0xd913('0x3d')]=_['merge'](_0x410935[_0xd913('0x3d')],{'$or':_[_0xd913('0x30')](_0x5a105a,function(_0x17afea){if(_0x17afea[_0xd913('0x2f')]!==_0xd913('0x3e')){var _0x4a7724={};_0x4a7724[_0x17afea[_0xd913('0x2a')]]={'$like':'%'+_0x1af4a6[_0xd913('0x31')]['filter']+'%'};return _0x4a7724;}})});}_0x410935=_[_0xd913('0x3f')]({},_0x410935,_0x1af4a6['options']);var _0x9a2e36={'where':_0x410935[_0xd913('0x3d')]};return db['OpenchannelApplication'][_0xd913('0x21')](_0x9a2e36)['then'](function(_0x3ca703){_0x24a05c[_0xd913('0x21')]=_0x3ca703;if(_0x1af4a6['query']['includeAll']){_0x410935[_0xd913('0x40')]=[{'all':!![]}];}return db[_0xd913('0x2d')][_0xd913('0x41')](_0x410935);})[_0xd913('0x28')](function(_0x1f3a5a){_0x24a05c['rows']=_0x1f3a5a;return _0x24a05c;})[_0xd913('0x28')](respondWithFilteredResult(_0x2cd5e1,_0x410935))[_0xd913('0x42')](handleError(_0x2cd5e1,null));};exports[_0xd913('0x43')]=function(_0x403952,_0x1f89ff){var _0x3a43ad={'raw':!![],'where':{'id':_0x403952[_0xd913('0x44')]['id']}},_0xb7d9e9={};_0xb7d9e9['model']=_[_0xd913('0x32')](db[_0xd913('0x2d')]['rawAttributes']);_0xb7d9e9[_0xd913('0x31')]=_['keys'](_0x403952[_0xd913('0x31')]);_0xb7d9e9[_0xd913('0x33')]=_[_0xd913('0x36')](_0xb7d9e9[_0xd913('0x34')],_0xb7d9e9[_0xd913('0x31')]);_0x3a43ad[_0xd913('0x35')]=_[_0xd913('0x36')](_0xb7d9e9[_0xd913('0x34')],qs['fields'](_0x403952[_0xd913('0x31')]['fields']));_0x3a43ad[_0xd913('0x35')]=_0x3a43ad[_0xd913('0x35')]['length']?_0x3a43ad['attributes']:_0xb7d9e9[_0xd913('0x34')];if(_0x403952[_0xd913('0x31')][_0xd913('0x45')]){_0x3a43ad[_0xd913('0x40')]=[{'all':!![]}];}_0x3a43ad=_['merge']({},_0x3a43ad,_0x403952['options']);return db[_0xd913('0x2d')][_0xd913('0x46')](_0x3a43ad)['then'](handleEntityNotFound(_0x1f89ff,null))[_0xd913('0x28')](respondWithResult(_0x1f89ff,null))['catch'](handleError(_0x1f89ff,null));};exports[_0xd913('0x47')]=function(_0x821564,_0x53e74d){return db[_0xd913('0x2d')][_0xd913('0x47')](_0x821564[_0xd913('0x48')],{})[_0xd913('0x28')](respondWithResult(_0x53e74d,0xc9))[_0xd913('0x42')](handleError(_0x53e74d,null));};exports[_0xd913('0x27')]=function(_0x1a77b3,_0x271772){if(_0x1a77b3[_0xd913('0x48')]['id']){delete _0x1a77b3[_0xd913('0x48')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x1a77b3[_0xd913('0x44')]['id']}})[_0xd913('0x28')](handleEntityNotFound(_0x271772,null))[_0xd913('0x28')](saveUpdates(_0x1a77b3['body'],null))[_0xd913('0x28')](respondWithResult(_0x271772,null))[_0xd913('0x42')](handleError(_0x271772,null));};exports[_0xd913('0x49')]=function(_0x3d6127,_0x2002a4){return db['OpenchannelApplication'][_0xd913('0x46')]({'where':{'id':_0x3d6127[_0xd913('0x44')]['id']}})[_0xd913('0x28')](handleEntityNotFound(_0x2002a4,null))[_0xd913('0x28')](removeEntity(_0x2002a4,null))[_0xd913('0x42')](handleError(_0x2002a4,null));}; \ No newline at end of file +var _0x983b=['map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','OpenchannelApplication','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','offset','order','sort','where','filters','pick','filter'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x983b,0xab));var _0xb983=function(_0x7ec030,_0x396546){_0x7ec030=_0x7ec030-0x0;var _0xaa0a82=_0x983b[_0x7ec030];return _0xaa0a82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb983('0x0'));var zipdir=require(_0xb983('0x1'));var jsonpatch=require(_0xb983('0x2'));var rp=require('request-promise');var moment=require(_0xb983('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb983('0x4'));var path=require(_0xb983('0x5'));var sox=require(_0xb983('0x6'));var csv=require(_0xb983('0x7'));var ejs=require(_0xb983('0x8'));var fs=require('fs');var fs_extra=require(_0xb983('0x9'));var _=require(_0xb983('0xa'));var squel=require(_0xb983('0xb'));var crypto=require('crypto');var jsforce=require(_0xb983('0xc'));var deskjs=require(_0xb983('0xd'));var toCsv=require(_0xb983('0x7'));var querystring=require(_0xb983('0xe'));var Papa=require(_0xb983('0xf'));var Redis=require(_0xb983('0x10'));var authService=require(_0xb983('0x11'));var qs=require(_0xb983('0x12'));var as=require(_0xb983('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb983('0x14'))(_0xb983('0x15'));var utils=require(_0xb983('0x16'));var config=require(_0xb983('0x17'));var licenseUtil=require(_0xb983('0x18'));var db=require(_0xb983('0x19'))['db'];function respondWithStatusCode(_0x497105,_0x404af2){_0x404af2=_0x404af2||0xcc;return function(_0x19b2b5){if(_0x19b2b5){return _0x497105[_0xb983('0x1a')](_0x404af2);}return _0x497105[_0xb983('0x1b')](_0x404af2)['end']();};}function respondWithResult(_0x1d2885,_0x4167c3){_0x4167c3=_0x4167c3||0xc8;return function(_0x59c9ca){if(_0x59c9ca){return _0x1d2885[_0xb983('0x1b')](_0x4167c3)[_0xb983('0x1c')](_0x59c9ca);}};}function respondWithFilteredResult(_0x11de01,_0x1e5e8f){return function(_0x483546){if(_0x483546){var _0x21afbf=typeof _0x1e5e8f['offset']===_0xb983('0x1d')&&typeof _0x1e5e8f[_0xb983('0x1e')]===_0xb983('0x1d');var _0x2a7ace=_0x483546[_0xb983('0x1f')];var _0x31c7f1=_0x21afbf?0x0:_0x1e5e8f['offset'];var _0x1fd4ac=_0x21afbf?_0x483546[_0xb983('0x1f')]:_0x1e5e8f['offset']+_0x1e5e8f['limit'];var _0xf28666;if(_0x1fd4ac>=_0x2a7ace){_0x1fd4ac=_0x2a7ace;_0xf28666=0xc8;}else{_0xf28666=0xce;}_0x11de01[_0xb983('0x1b')](_0xf28666);return _0x11de01[_0xb983('0x20')](_0xb983('0x21'),_0x31c7f1+'-'+_0x1fd4ac+'/'+_0x2a7ace)[_0xb983('0x1c')](_0x483546);}return null;};}function patchUpdates(_0x363b69){return function(_0x497dd0){try{jsonpatch[_0xb983('0x22')](_0x497dd0,_0x363b69,!![]);}catch(_0x3e41a1){return BPromise[_0xb983('0x23')](_0x3e41a1);}return _0x497dd0[_0xb983('0x24')]();};}function saveUpdates(_0x4e8792,_0xa1124f){return function(_0x428c9f){if(_0x428c9f){return _0x428c9f[_0xb983('0x25')](_0x4e8792)[_0xb983('0x26')](function(_0x36aebb){return _0x36aebb;});}return null;};}function removeEntity(_0x4293ce,_0x560933){return function(_0x417f6b){if(_0x417f6b){return _0x417f6b[_0xb983('0x27')]()[_0xb983('0x26')](function(){_0x4293ce[_0xb983('0x1b')](0xcc)[_0xb983('0x28')]();});}};}function handleEntityNotFound(_0x506231,_0x5b05e5){return function(_0x1e7b70){if(!_0x1e7b70){_0x506231[_0xb983('0x1a')](0x194);}return _0x1e7b70;};}function handleError(_0x3f9225,_0x4562ed){_0x4562ed=_0x4562ed||0x1f4;return function(_0x5c0c17){logger['error'](_0x5c0c17[_0xb983('0x29')]);if(_0x5c0c17[_0xb983('0x2a')]){delete _0x5c0c17['name'];}_0x3f9225[_0xb983('0x1b')](_0x4562ed)[_0xb983('0x2b')](_0x5c0c17);};}exports[_0xb983('0x2c')]=function(_0x2fccdf,_0x1737b6){var _0x478a47={},_0x479dcb={},_0x34f45b={'count':0x0,'rows':[]};var _0x21d603=_['map'](db[_0xb983('0x2d')]['rawAttributes'],function(_0xfb7c97){return{'name':_0xfb7c97[_0xb983('0x2e')],'type':_0xfb7c97[_0xb983('0x2f')][_0xb983('0x30')]};});_0x479dcb['model']=_['map'](_0x21d603,'name');_0x479dcb[_0xb983('0x31')]=_[_0xb983('0x32')](_0x2fccdf[_0xb983('0x31')]);_0x479dcb['filters']=_[_0xb983('0x33')](_0x479dcb['model'],_0x479dcb[_0xb983('0x31')]);_0x478a47[_0xb983('0x34')]=_[_0xb983('0x33')](_0x479dcb[_0xb983('0x35')],qs[_0xb983('0x36')](_0x2fccdf[_0xb983('0x31')][_0xb983('0x36')]));_0x478a47[_0xb983('0x34')]=_0x478a47[_0xb983('0x34')]['length']?_0x478a47[_0xb983('0x34')]:_0x479dcb[_0xb983('0x35')];if(!_0x2fccdf[_0xb983('0x31')][_0xb983('0x37')]('nolimit')){_0x478a47[_0xb983('0x1e')]=qs[_0xb983('0x1e')](_0x2fccdf[_0xb983('0x31')]['limit']);_0x478a47[_0xb983('0x38')]=qs[_0xb983('0x38')](_0x2fccdf[_0xb983('0x31')][_0xb983('0x38')]);}_0x478a47[_0xb983('0x39')]=qs[_0xb983('0x3a')](_0x2fccdf[_0xb983('0x31')]['sort']);_0x478a47[_0xb983('0x3b')]=qs[_0xb983('0x3c')](_[_0xb983('0x3d')](_0x2fccdf['query'],_0x479dcb[_0xb983('0x3c')]),_0x21d603);if(_0x2fccdf[_0xb983('0x31')][_0xb983('0x3e')]){_0x478a47[_0xb983('0x3b')]=_['merge'](_0x478a47['where'],{'$or':_[_0xb983('0x3f')](_0x21d603,function(_0x18e80d){if(_0x18e80d['type']!==_0xb983('0x40')){var _0x12bd18={};_0x12bd18[_0x18e80d[_0xb983('0x2a')]]={'$like':'%'+_0x2fccdf[_0xb983('0x31')][_0xb983('0x3e')]+'%'};return _0x12bd18;}})});}_0x478a47=_[_0xb983('0x41')]({},_0x478a47,_0x2fccdf[_0xb983('0x42')]);var _0x5513bd={'where':_0x478a47[_0xb983('0x3b')]};return db[_0xb983('0x2d')]['count'](_0x5513bd)[_0xb983('0x26')](function(_0x4e29a8){_0x34f45b[_0xb983('0x1f')]=_0x4e29a8;if(_0x2fccdf['query'][_0xb983('0x43')]){_0x478a47[_0xb983('0x44')]=[{'all':!![]}];}return db[_0xb983('0x2d')][_0xb983('0x45')](_0x478a47);})['then'](function(_0x26d3a3){_0x34f45b[_0xb983('0x46')]=_0x26d3a3;return _0x34f45b;})[_0xb983('0x26')](respondWithFilteredResult(_0x1737b6,_0x478a47))[_0xb983('0x47')](handleError(_0x1737b6,null));};exports[_0xb983('0x48')]=function(_0x35d464,_0x2a8cdd){var _0x30be73={'raw':!![],'where':{'id':_0x35d464[_0xb983('0x49')]['id']}},_0x4cd1d4={};_0x4cd1d4[_0xb983('0x35')]=_[_0xb983('0x32')](db['OpenchannelApplication']['rawAttributes']);_0x4cd1d4[_0xb983('0x31')]=_['keys'](_0x35d464['query']);_0x4cd1d4['filters']=_[_0xb983('0x33')](_0x4cd1d4[_0xb983('0x35')],_0x4cd1d4[_0xb983('0x31')]);_0x30be73[_0xb983('0x34')]=_[_0xb983('0x33')](_0x4cd1d4[_0xb983('0x35')],qs[_0xb983('0x36')](_0x35d464[_0xb983('0x31')][_0xb983('0x36')]));_0x30be73['attributes']=_0x30be73[_0xb983('0x34')][_0xb983('0x4a')]?_0x30be73[_0xb983('0x34')]:_0x4cd1d4[_0xb983('0x35')];if(_0x35d464[_0xb983('0x31')]['includeAll']){_0x30be73['include']=[{'all':!![]}];}_0x30be73=_['merge']({},_0x30be73,_0x35d464[_0xb983('0x42')]);return db[_0xb983('0x2d')][_0xb983('0x4b')](_0x30be73)[_0xb983('0x26')](handleEntityNotFound(_0x2a8cdd,null))[_0xb983('0x26')](respondWithResult(_0x2a8cdd,null))[_0xb983('0x47')](handleError(_0x2a8cdd,null));};exports[_0xb983('0x4c')]=function(_0x146681,_0x8dfab8){return db['OpenchannelApplication'][_0xb983('0x4c')](_0x146681[_0xb983('0x4d')],{})['then'](respondWithResult(_0x8dfab8,0xc9))[_0xb983('0x47')](handleError(_0x8dfab8,null));};exports[_0xb983('0x25')]=function(_0x51e872,_0x3939c9){if(_0x51e872[_0xb983('0x4d')]['id']){delete _0x51e872['body']['id'];}return db[_0xb983('0x2d')][_0xb983('0x4b')]({'where':{'id':_0x51e872['params']['id']}})[_0xb983('0x26')](handleEntityNotFound(_0x3939c9,null))[_0xb983('0x26')](saveUpdates(_0x51e872[_0xb983('0x4d')],null))[_0xb983('0x26')](respondWithResult(_0x3939c9,null))[_0xb983('0x47')](handleError(_0x3939c9,null));};exports[_0xb983('0x27')]=function(_0x25459d,_0x142884){return db[_0xb983('0x2d')]['find']({'where':{'id':_0x25459d[_0xb983('0x49')]['id']}})[_0xb983('0x26')](handleEntityNotFound(_0x142884,null))[_0xb983('0x26')](removeEntity(_0x142884,null))['catch'](handleError(_0x142884,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 0730f84..8417079 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 _0x0201=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','./openchannelApplication.attributes','exports','define'];(function(_0xc48746,_0x54a515){var _0x4d0ce1=function(_0x926946){while(--_0x926946){_0xc48746['push'](_0xc48746['shift']());}};_0x4d0ce1(++_0x54a515);}(_0x0201,0xc3));var _0x1020=function(_0x55cbb1,_0x59d272){_0x55cbb1=_0x55cbb1-0x0;var _0x45f4f9=_0x0201[_0x55cbb1];return _0x45f4f9;};'use strict';var _=require(_0x1020('0x0'));var util=require(_0x1020('0x1'));var logger=require('../../config/logger')(_0x1020('0x2'));var moment=require(_0x1020('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1020('0x4'));var rimraf=require(_0x1020('0x5'));var config=require('../../config/environment');var attributes=require(_0x1020('0x6'));module[_0x1020('0x7')]=function(_0xa45a64,_0x587e6d){return _0xa45a64[_0x1020('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x1020('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1020('0xa'),'collate':_0x1020('0xb')});}; \ No newline at end of file +var _0xa46a=['utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0xa46a,0x198));var _0xaa46=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0xa46a[_0xf0f7ba];return _0x44382c;};'use strict';var _=require(_0xaa46('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa46('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaa46('0x2'));var fs=require('fs');var path=require(_0xaa46('0x3'));var rimraf=require(_0xaa46('0x4'));var config=require('../../config/environment');var attributes=require(_0xaa46('0x5'));module[_0xaa46('0x6')]=function(_0x56a7b3,_0x3b9d91){return _0x56a7b3['define'](_0xaa46('0x7'),attributes,{'tableName':_0xaa46('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa46('0x9'),'collate':_0xaa46('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8b0ee8f..6d2a9b1 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 _0xc9cd=['request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x537c92,_0xef91ac){var _0x22e56a=function(_0xa33fae){while(--_0xa33fae){_0x537c92['push'](_0x537c92['shift']());}};_0x22e56a(++_0xef91ac);}(_0xc9cd,0x13e));var _0xdc9c=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xc9cd[_0x3cec8c];return _0x38032e;};'use strict';var _=require('lodash');var util=require(_0xdc9c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc9c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc9c('0x2'))['db'];var utils=require(_0xdc9c('0x3'));var logger=require('../../config/logger')(_0xdc9c('0x4'));var config=require(_0xdc9c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdc9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x28c02c,_0x411deb,_0x5ee2ff){return new BPromise(function(_0xf92bf8,_0x24b3ac){return client[_0xdc9c('0x7')](_0x28c02c,_0x5ee2ff)[_0xdc9c('0x8')](function(_0x207053){logger[_0xdc9c('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x411deb,_0xdc9c('0xa'));logger[_0xdc9c('0xb')](_0xdc9c('0xc'),_0x411deb,_0xdc9c('0xa'),JSON[_0xdc9c('0xd')](_0x207053));if(_0x207053[_0xdc9c('0xe')]){if(_0x207053[_0xdc9c('0xe')]['code']===0x1f4){logger[_0xdc9c('0xe')](_0xdc9c('0xf'),_0x411deb,_0x207053['error'][_0xdc9c('0x10')]);return _0x24b3ac(_0x207053[_0xdc9c('0xe')][_0xdc9c('0x10')]);}logger[_0xdc9c('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x411deb,_0x207053['error']['message']);return _0xf92bf8(_0x207053[_0xdc9c('0xe')][_0xdc9c('0x10')]);}else{logger[_0xdc9c('0x9')](_0xdc9c('0xf'),_0x411deb,'request\x20sent');_0xf92bf8(_0x207053['result'][_0xdc9c('0x10')]);}})[_0xdc9c('0x11')](function(_0x2bf93f){logger[_0xdc9c('0xe')](_0xdc9c('0xf'),_0x411deb,_0x2bf93f);_0x24b3ac(_0x2bf93f);});});}exports[_0xdc9c('0x12')]=function(_0x3e57fc){var _0x497801=this;return new Promise(function(_0x4370ac,_0xbce9f6){return db[_0xdc9c('0x13')][_0xdc9c('0x14')](_0x3e57fc[_0xdc9c('0x15')],{'raw':_0x3e57fc[_0xdc9c('0x16')]?_0x3e57fc[_0xdc9c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e57fc[_0xdc9c('0x16')]?_0x3e57fc[_0xdc9c('0x16')][_0xdc9c('0x17')]||null:null,'attributes':_0x3e57fc[_0xdc9c('0x16')]?_0x3e57fc[_0xdc9c('0x16')][_0xdc9c('0x18')]||null:null,'limit':_0x3e57fc['options']?_0x3e57fc[_0xdc9c('0x16')]['limit']||null:null})[_0xdc9c('0x8')](function(_0x3c3b8f){logger[_0xdc9c('0x9')](_0xdc9c('0x12'),_0x3e57fc);logger[_0xdc9c('0xb')]('UpdateOpenchannelApplication',_0x3e57fc,JSON[_0xdc9c('0xd')](_0x3c3b8f));_0x4370ac(_0x3c3b8f);})['catch'](function(_0x14323d){logger[_0xdc9c('0xe')](_0xdc9c('0x12'),_0x14323d['message'],_0x3e57fc);_0xbce9f6(_0x497801[_0xdc9c('0xe')](0x1f4,_0x14323d['message']));});});}; \ No newline at end of file +var _0x703f=['catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit','lodash','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x511c1d,_0x5431a9){var _0x4b043b=function(_0x178c5a){while(--_0x178c5a){_0x511c1d['push'](_0x511c1d['shift']());}};_0x4b043b(++_0x5431a9);}(_0x703f,0xe1));var _0xf703=function(_0x2fd2b6,_0x2b2f22){_0x2fd2b6=_0x2fd2b6-0x0;var _0xc2390b=_0x703f[_0x2fd2b6];return _0xc2390b;};'use strict';var _=require(_0xf703('0x0'));var util=require('util');var moment=require(_0xf703('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf703('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf703('0x3'))(_0xf703('0x4'));var config=require('../../config/environment');var jayson=require(_0xf703('0x5'));var client=jayson[_0xf703('0x6')][_0xf703('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x235e30,_0x217a98,_0x3b85ba){return new BPromise(function(_0x340eff,_0xa4050a){return client[_0xf703('0x8')](_0x235e30,_0x3b85ba)[_0xf703('0x9')](function(_0x22fc03){logger[_0xf703('0xa')](_0xf703('0xb'),_0x217a98,_0xf703('0xc'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x217a98,'request\x20sent',JSON[_0xf703('0xd')](_0x22fc03));if(_0x22fc03[_0xf703('0xe')]){if(_0x22fc03[_0xf703('0xe')][_0xf703('0xf')]===0x1f4){logger[_0xf703('0xe')](_0xf703('0xb'),_0x217a98,_0x22fc03['error'][_0xf703('0x10')]);return _0xa4050a(_0x22fc03[_0xf703('0xe')][_0xf703('0x10')]);}logger['error'](_0xf703('0xb'),_0x217a98,_0x22fc03['error']['message']);return _0x340eff(_0x22fc03[_0xf703('0xe')]['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x217a98,_0xf703('0xc'));_0x340eff(_0x22fc03[_0xf703('0x11')][_0xf703('0x10')]);}})[_0xf703('0x12')](function(_0x2c112f){logger[_0xf703('0xe')](_0xf703('0xb'),_0x217a98,_0x2c112f);_0xa4050a(_0x2c112f);});});}exports[_0xf703('0x13')]=function(_0x2b6a50){var _0x2adf34=this;return new Promise(function(_0x4948cf,_0x3148ad){return db[_0xf703('0x14')]['update'](_0x2b6a50[_0xf703('0x15')],{'raw':_0x2b6a50[_0xf703('0x16')]?_0x2b6a50['options'][_0xf703('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6a50[_0xf703('0x16')]?_0x2b6a50[_0xf703('0x16')][_0xf703('0x18')]||null:null,'attributes':_0x2b6a50['options']?_0x2b6a50['options'][_0xf703('0x19')]||null:null,'limit':_0x2b6a50[_0xf703('0x16')]?_0x2b6a50['options'][_0xf703('0x1a')]||null:null})[_0xf703('0x9')](function(_0x5bd0d8){logger['info']('UpdateOpenchannelApplication',_0x2b6a50);logger['debug'](_0xf703('0x13'),_0x2b6a50,JSON[_0xf703('0xd')](_0x5bd0d8));_0x4948cf(_0x5bd0d8);})[_0xf703('0x12')](function(_0x142b62){logger[_0xf703('0xe')]('UpdateOpenchannelApplication',_0x142b62[_0xf703('0x10')],_0x2b6a50);_0x3148ad(_0x2adf34[_0xf703('0xe')](0x1f4,_0x142b62[_0xf703('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 69aa672..0d5a3fd 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 _0xf1aa=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','update'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xf1aa,0xd5));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xaf1a('0x0'));var util=require(_0xaf1a('0x1'));var path=require('path');var timeout=require(_0xaf1a('0x2'));var express=require(_0xaf1a('0x3'));var router=express[_0xaf1a('0x4')]();var fs_extra=require(_0xaf1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf1a('0x6'));var config=require(_0xaf1a('0x7'));var controller=require(_0xaf1a('0x8'));router[_0xaf1a('0x9')]('/',auth[_0xaf1a('0xa')](),controller['index']);router[_0xaf1a('0x9')](_0xaf1a('0xb'),auth[_0xaf1a('0xa')](),controller[_0xaf1a('0xc')]);router[_0xaf1a('0x9')]('/:id',auth[_0xaf1a('0xa')](),controller[_0xaf1a('0xd')]);router['get']('/:id/messages',auth[_0xaf1a('0xa')](),controller['getMessages']);router[_0xaf1a('0x9')](_0xaf1a('0xe'),auth[_0xaf1a('0xa')](),controller[_0xaf1a('0xf')]);router[_0xaf1a('0x10')]('/',auth[_0xaf1a('0xa')](),controller[_0xaf1a('0x11')]);router[_0xaf1a('0x10')](_0xaf1a('0x12'),auth[_0xaf1a('0xa')](),controller['addMessage']);router['post'](_0xaf1a('0x13'),auth[_0xaf1a('0xa')](),interaction[_0xaf1a('0x14')](_0xaf1a('0x15'),'openchannelinteraction:addtags'),controller[_0xaf1a('0x16')]);router[_0xaf1a('0x17')](_0xaf1a('0x18'),auth[_0xaf1a('0xa')](),interaction[_0xaf1a('0x14')](_0xaf1a('0x15'),_0xaf1a('0x19')),controller[_0xaf1a('0x1a')]);router[_0xaf1a('0x1b')](_0xaf1a('0x18'),auth[_0xaf1a('0xa')](),interaction[_0xaf1a('0x14')](_0xaf1a('0x15'),'openchannelinteraction:destroy'),controller[_0xaf1a('0x1c')]);router[_0xaf1a('0x1b')](_0xaf1a('0x13'),auth[_0xaf1a('0xa')](),controller['removeTags']);module[_0xaf1a('0x1d')]=router; \ No newline at end of file +var _0xa1d8=['isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','delete','openchannelinteraction:destroy','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0xbc6a84,_0x4577e2){var _0x40c12a=function(_0x118a27){while(--_0x118a27){_0xbc6a84['push'](_0xbc6a84['shift']());}};_0x40c12a(++_0x4577e2);}(_0xa1d8,0x189));var _0x8a1d=function(_0x3a9aa8,_0x23d24c){_0x3a9aa8=_0x3a9aa8-0x0;var _0x4d1970=_0xa1d8[_0x3a9aa8];return _0x4d1970;};'use strict';var multer=require(_0x8a1d('0x0'));var util=require('util');var path=require(_0x8a1d('0x1'));var timeout=require(_0x8a1d('0x2'));var express=require('express');var router=express[_0x8a1d('0x3')]();var fs_extra=require(_0x8a1d('0x4'));var auth=require(_0x8a1d('0x5'));var interaction=require(_0x8a1d('0x6'));var config=require(_0x8a1d('0x7'));var controller=require(_0x8a1d('0x8'));router[_0x8a1d('0x9')]('/',auth[_0x8a1d('0xa')](),controller[_0x8a1d('0xb')]);router[_0x8a1d('0x9')](_0x8a1d('0xc'),auth[_0x8a1d('0xa')](),controller[_0x8a1d('0xd')]);router[_0x8a1d('0x9')]('/:id',auth[_0x8a1d('0xa')](),controller[_0x8a1d('0xe')]);router['get'](_0x8a1d('0xf'),auth[_0x8a1d('0xa')](),controller['getMessages']);router['get'](_0x8a1d('0x10'),auth[_0x8a1d('0xa')](),controller[_0x8a1d('0x11')]);router[_0x8a1d('0x12')]('/',auth[_0x8a1d('0xa')](),controller['create']);router['post'](_0x8a1d('0xf'),auth[_0x8a1d('0xa')](),controller[_0x8a1d('0x13')]);router[_0x8a1d('0x12')](_0x8a1d('0x14'),auth['isAuthenticated'](),interaction[_0x8a1d('0x15')](_0x8a1d('0x16'),_0x8a1d('0x17')),controller[_0x8a1d('0x18')]);router[_0x8a1d('0x19')](_0x8a1d('0x1a'),auth[_0x8a1d('0xa')](),interaction[_0x8a1d('0x15')](_0x8a1d('0x16'),'openchannelinteraction:update'),controller['update']);router[_0x8a1d('0x1b')](_0x8a1d('0x1a'),auth[_0x8a1d('0xa')](),interaction[_0x8a1d('0x15')](_0x8a1d('0x16'),_0x8a1d('0x1c')),controller[_0x8a1d('0x1d')]);router[_0x8a1d('0x1b')]('/:id/tags',auth[_0x8a1d('0xa')](),controller['removeTags']);module[_0x8a1d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index dadd4c8..1de3956 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 _0xe8cd=['STRING','out','INTEGER','BOOLEAN','DATE'];(function(_0x39a360,_0x187745){var _0x12c6ea=function(_0x5b9861){while(--_0x5b9861){_0x39a360['push'](_0x39a360['shift']());}};_0x12c6ea(++_0x187745);}(_0xe8cd,0x152));var _0xde8c=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0xe8cd[_0x13843f];return _0x1063ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xde8c('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xde8c('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xde8c('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xde8c('0x2')]},'read1stAt':{'type':Sequelize[_0xde8c('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xde8c('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xde8c('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xde8c('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xde8c('0x4')]}}; \ No newline at end of file +var _0xd6ab=['BOOLEAN','DATE','STRING','ENUM','INTEGER','sequelize','exports'];(function(_0x18175b,_0x4d7376){var _0x210d45=function(_0x24f924){while(--_0x24f924){_0x18175b['push'](_0x18175b['shift']());}};_0x210d45(++_0x4d7376);}(_0xd6ab,0x124));var _0xbd6a=function(_0x1b7a70,_0x4bce66){_0x1b7a70=_0x1b7a70-0x0;var _0x11fc5c=_0xd6ab[_0x1b7a70];return _0x11fc5c;};'use strict';var Sequelize=require(_0xbd6a('0x0'));module[_0xbd6a('0x1')]={'closed':{'type':Sequelize[_0xbd6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbd6a('0x3')]},'disposition':{'type':Sequelize[_0xbd6a('0x4')]},'secondDisposition':{'type':Sequelize[_0xbd6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbd6a('0x4')]},'note':{'type':Sequelize[_0xbd6a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xbd6a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbd6a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbd6a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbd6a('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xbd6a('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index dba14bf..a1685ce 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 _0x76b9=['disposition','threadId','Private','map','basename','existsSync','createReadStream','createWriteStream','out','System','value','renderFile','root','views','downloadInteraction.ejs','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','ejs','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','findAll','openchannel','query','show','type','from','params','model','keys','filters','attributes','fields','length','includeAll','include','options','find','catch','create','body','update','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','$gte','split','format','rows','setTags','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','toString','join','server','files','attachments','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','fullname','mkdirSync','Openchannel','createdAt','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3145e4,_0x3f2c77){var _0x3952e7=function(_0x1b608c){while(--_0x1b608c){_0x3145e4['push'](_0x3145e4['shift']());}};_0x3952e7(++_0x3f2c77);}(_0x76b9,0x18e));var _0x976b=function(_0x10572c,_0x33255c){_0x10572c=_0x10572c-0x0;var _0x2af024=_0x76b9[_0x10572c];return _0x2af024;};'use strict';var rimraf=require(_0x976b('0x0'));var zipdir=require(_0x976b('0x1'));var moment=require(_0x976b('0x2'));var util=require(_0x976b('0x3'));var path=require('path');var ejs=require(_0x976b('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x976b('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x976b('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x976b('0x7'));var config=require(_0x976b('0x8'));var db=require(_0x976b('0x9'))['db'];config['redis']=_[_0x976b('0xa')](config['redis'],{'host':_0x976b('0xb'),'port':0x18eb});var socket=require(_0x976b('0xc'))(new Redis(config[_0x976b('0xd')]));require(_0x976b('0xe'))[_0x976b('0xf')](socket);function respondWithStatusCode(_0x4e800d,_0x3cb86f){_0x3cb86f=_0x3cb86f||0xcc;return function(_0xffea28){if(_0xffea28){return _0x4e800d[_0x976b('0x10')](_0x3cb86f);}return _0x4e800d['status'](_0x3cb86f)['end']();};}function respondWithResult(_0xd110b2,_0x406cce){_0x406cce=_0x406cce||0xc8;return function(_0x4b5e75){if(_0x4b5e75){return _0xd110b2[_0x976b('0x11')](_0x406cce)[_0x976b('0x12')](_0x4b5e75);}};}function respondWithFilteredResult(_0x1ebe59,_0x29b502){return function(_0x4623fc){if(_0x4623fc){var _0x388e02=typeof _0x29b502[_0x976b('0x13')]===_0x976b('0x14')&&typeof _0x29b502[_0x976b('0x15')]===_0x976b('0x14');var _0x2bb351=_0x4623fc['count'];var _0x426fb0=_0x388e02?0x0:_0x29b502[_0x976b('0x13')];var _0x1bf338=_0x388e02?_0x4623fc[_0x976b('0x16')]:_0x29b502[_0x976b('0x13')]+_0x29b502[_0x976b('0x15')];var _0x130499;if(_0x1bf338>=_0x2bb351){_0x1bf338=_0x2bb351;_0x130499=0xc8;}else{_0x130499=0xce;}_0x1ebe59['status'](_0x130499);return _0x1ebe59[_0x976b('0x17')](_0x976b('0x18'),_0x426fb0+'-'+_0x1bf338+'/'+_0x2bb351)['json'](_0x4623fc);}return null;};}function saveUpdates(_0x311a52){return function(_0x115bd3){if(_0x115bd3){return _0x115bd3['update'](_0x311a52)[_0x976b('0x19')](function(_0x13b38e){return _0x13b38e;});}return null;};}function removeEntity(_0x112806){return function(_0x40050c){if(_0x40050c){return _0x40050c[_0x976b('0x1a')]()[_0x976b('0x19')](function(){_0x112806[_0x976b('0x11')](0xcc)[_0x976b('0x1b')]();});}};}function handleEntityNotFound(_0x12a321){return function(_0x245d70){if(!_0x245d70){_0x12a321[_0x976b('0x10')](0x194);}return _0x245d70;};}function handleError(_0x217c6a,_0x2ba9b3){_0x2ba9b3=_0x2ba9b3||0x1f4;return function(_0x439070){logger['error'](_0x439070[_0x976b('0x1c')]);if(_0x439070[_0x976b('0x1d')]){delete _0x439070[_0x976b('0x1d')];}_0x217c6a['status'](_0x2ba9b3)[_0x976b('0x1e')](_0x439070);};}exports[_0x976b('0x1f')]=function(_0x3a5a46,_0x19ea17){var _0x49d3e8={};var _0x5f2588=_['map'](db[_0x976b('0x20')][_0x976b('0x21')],function(_0x9fdcc6){return{'name':_0x9fdcc6[_0x976b('0x22')],'type':_0x9fdcc6['type'][_0x976b('0x23')]};});_0x49d3e8=qs[_0x976b('0x24')](_0x5f2588,_0x3a5a46);return interaction[_0x976b('0x25')](_0x976b('0x26'),_0x3a5a46[_0x976b('0x27')],_0x3a5a46['user'],_0x49d3e8,_0x5f2588)[_0x976b('0x19')](respondWithFilteredResult(_0x19ea17,_0x49d3e8))['catch'](handleError(_0x19ea17,null));};exports[_0x976b('0x28')]=function(_0x326537,_0x1e6166){var _0x4ddc47={};if(_0x326537['query'][_0x976b('0x29')]&&_0x326537['query']['type']===_0x976b('0x2a')){_0x4ddc47[_0x976b('0x2a')]=_0x326537['params']['id'];}else{_0x4ddc47['id']=_0x326537[_0x976b('0x2b')]['id'];}var _0xeafd32={'raw':![],'where':_0x4ddc47},_0xa1161b={};_0xa1161b[_0x976b('0x2c')]=_[_0x976b('0x2d')](db[_0x976b('0x20')][_0x976b('0x21')]);_0xa1161b[_0x976b('0x27')]=_['keys'](_0x326537[_0x976b('0x27')]);_0xa1161b[_0x976b('0x2e')]=_['intersection'](_0xa1161b[_0x976b('0x2c')],_0xa1161b[_0x976b('0x27')]);_0xeafd32[_0x976b('0x2f')]=_['intersection'](_0xa1161b[_0x976b('0x2c')],qs[_0x976b('0x30')](_0x326537['query'][_0x976b('0x30')]));_0xeafd32[_0x976b('0x2f')]=_0xeafd32['attributes'][_0x976b('0x31')]?_0xeafd32[_0x976b('0x2f')]:_0xa1161b['model'];if(_0x326537[_0x976b('0x27')][_0x976b('0x32')]){_0xeafd32[_0x976b('0x33')]=[{'all':!![]}];}_0xeafd32=_['merge']({},_0xeafd32,_0x326537[_0x976b('0x34')]);return db[_0x976b('0x20')][_0x976b('0x35')](_0xeafd32)[_0x976b('0x19')](handleEntityNotFound(_0x1e6166,null))[_0x976b('0x19')](respondWithResult(_0x1e6166,null))[_0x976b('0x36')](handleError(_0x1e6166,null));};exports[_0x976b('0x37')]=function(_0x11a353,_0x541564){return db['OpenchannelInteraction'][_0x976b('0x37')](_0x11a353[_0x976b('0x38')],{})['then'](respondWithResult(_0x541564,0xc9))['catch'](handleError(_0x541564,null));};exports[_0x976b('0x39')]=function(_0x313259,_0x47f7a6){if(_0x313259['body']['id']){delete _0x313259[_0x976b('0x38')]['id'];}return db[_0x976b('0x20')][_0x976b('0x35')]({'where':{'id':_0x313259[_0x976b('0x2b')]['id']}})[_0x976b('0x19')](handleEntityNotFound(_0x47f7a6,null))[_0x976b('0x19')](saveUpdates(_0x313259['body'],null))['then'](respondWithResult(_0x47f7a6,null))[_0x976b('0x36')](handleError(_0x47f7a6,null));};exports[_0x976b('0x1a')]=function(_0x117956,_0x101818){return db['OpenchannelInteraction'][_0x976b('0x35')]({'where':{'id':_0x117956[_0x976b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x101818,null))[_0x976b('0x19')](removeEntity(_0x101818,null))['catch'](handleError(_0x101818,null));};exports[_0x976b('0x3a')]=function(_0x1a0df0,_0x2a22cb){return db[_0x976b('0x20')][_0x976b('0x3a')]()[_0x976b('0x19')](respondWithResult(_0x2a22cb,null))[_0x976b('0x36')](handleError(_0x2a22cb,null));};exports[_0x976b('0x3b')]=function(_0x10c872,_0x1f0ab3){return db[_0x976b('0x3c')][_0x976b('0x35')]({'where':{'id':_0x10c872['params']['id']}})[_0x976b('0x19')](handleEntityNotFound(_0x1f0ab3,null))['then'](function(_0xbd33e4){if(_0xbd33e4){return _0xbd33e4[_0x976b('0x3b')](_0x10c872['body']['ids'],_[_0x976b('0x3d')](_0x10c872[_0x976b('0x38')],[_0x976b('0x3e'),'id'])||{});}})[_0x976b('0x19')](respondWithResult(_0x1f0ab3,null))[_0x976b('0x36')](handleError(_0x1f0ab3,null));};exports[_0x976b('0x3f')]=function(_0x573fe9,_0x54b30c){var _0x4f2c68={'raw':![],'where':{}};var _0x3d03a8={};var _0x32bc54={'count':0x0,'rows':[]};return db[_0x976b('0x20')][_0x976b('0x40')]({'where':{'id':_0x573fe9[_0x976b('0x2b')]['id']}})[_0x976b('0x19')](handleEntityNotFound(_0x54b30c,null))[_0x976b('0x19')](function(_0x449179){if(_0x449179){_0x3d03a8['model']=_[_0x976b('0x2d')](db[_0x976b('0x3c')][_0x976b('0x21')]);_0x3d03a8['query']=_['keys'](_0x573fe9[_0x976b('0x27')]);_0x3d03a8[_0x976b('0x2e')]=_[_0x976b('0x41')](_0x3d03a8['model'],_0x3d03a8[_0x976b('0x27')]);_0x4f2c68[_0x976b('0x2f')]=_[_0x976b('0x41')](_0x3d03a8[_0x976b('0x2c')],qs[_0x976b('0x30')](_0x573fe9[_0x976b('0x27')]['fields']));_0x4f2c68['attributes']=_0x4f2c68[_0x976b('0x2f')][_0x976b('0x31')]?_0x4f2c68[_0x976b('0x2f')]:_0x3d03a8[_0x976b('0x2c')];if(!_0x573fe9[_0x976b('0x27')][_0x976b('0x42')](_0x976b('0x43'))){_0x4f2c68[_0x976b('0x15')]=qs['limit'](_0x573fe9[_0x976b('0x27')][_0x976b('0x15')]);_0x4f2c68[_0x976b('0x13')]=qs[_0x976b('0x13')](_0x573fe9['query']['offset']);}_0x4f2c68[_0x976b('0x44')]=qs['sort'](_0x573fe9[_0x976b('0x27')][_0x976b('0x45')]);_0x4f2c68['where']=qs[_0x976b('0x2e')](_[_0x976b('0x46')](_0x573fe9[_0x976b('0x27')],_0x3d03a8[_0x976b('0x2e')]));_0x4f2c68[_0x976b('0x47')]['OpenchannelInteractionId']=_0x449179['id'];if(_0x573fe9[_0x976b('0x27')]['filter']){_0x4f2c68[_0x976b('0x47')]=_[_0x976b('0x48')](_0x4f2c68[_0x976b('0x47')],{'$or':_['map'](_0x4f2c68[_0x976b('0x2f')],function(_0x33b9b4){var _0x339c3b={};_0x339c3b[_0x33b9b4]={'$like':'%'+_0x573fe9['query'][_0x976b('0x49')]+'%'};return _0x339c3b;})});}if(_0x573fe9['query'][_0x976b('0x4a')]){var _0x32da5c=_0x573fe9['query']['$gte'][_0x976b('0x4b')](',');var _0x55fa52={};_0x55fa52[_0x32da5c[0x0]]={'$gte':moment(_0x32da5c[0x1])[_0x976b('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f2c68[_0x976b('0x47')]=_[_0x976b('0x48')](_0x4f2c68['where'],_0x55fa52);}_0x4f2c68=_[_0x976b('0x48')]({},_0x4f2c68,_0x573fe9[_0x976b('0x34')]);return db[_0x976b('0x3c')][_0x976b('0x16')]({'where':_0x4f2c68[_0x976b('0x47')]})[_0x976b('0x19')](function(_0x3103ff){_0x32bc54[_0x976b('0x16')]=_0x3103ff;if(_0x573fe9[_0x976b('0x27')][_0x976b('0x32')]){_0x4f2c68[_0x976b('0x33')]=[{'all':!![]}];}return db[_0x976b('0x3c')][_0x976b('0x25')](_0x4f2c68);})[_0x976b('0x19')](function(_0x5eb15a){_0x32bc54[_0x976b('0x4d')]=_0x5eb15a;return _0x32bc54;});}})[_0x976b('0x19')](respondWithFilteredResult(_0x54b30c,_0x4f2c68))[_0x976b('0x36')](handleError(_0x54b30c,null));};exports['addTags']=function(_0x160853,_0x415ee4){return db[_0x976b('0x20')][_0x976b('0x35')]({'where':{'id':_0x160853[_0x976b('0x2b')]['id']}})[_0x976b('0x19')](handleEntityNotFound(_0x415ee4,null))[_0x976b('0x19')](function(_0x117cee){if(_0x117cee){return _0x117cee[_0x976b('0x4e')](_0x160853[_0x976b('0x38')][_0x976b('0x3e')],_['omit'](_0x160853[_0x976b('0x38')],['ids','id'])||{})[_0x976b('0x4f')](function(){return db[_0x976b('0x50')]['findAll']({'attributes':['id',_0x976b('0x1d'),_0x976b('0x51')],'where':{'id':_0x160853['body'][_0x976b('0x3e')]}});})['then'](function(_0x328b44){socket['emit'](_0x976b('0x52'),{'id':Number(_0x160853[_0x976b('0x2b')]['id']),'tags':_0x328b44||[]});return{'id':Number(_0x160853[_0x976b('0x2b')]['id']),'tags':_0x328b44||[]};});}})[_0x976b('0x19')](respondWithResult(_0x415ee4,null))[_0x976b('0x36')](handleError(_0x415ee4,null));};exports[_0x976b('0x53')]=function(_0x36b26b,_0x5554f7){return db[_0x976b('0x20')][_0x976b('0x35')]({'where':{'id':_0x36b26b[_0x976b('0x2b')]['id']}})[_0x976b('0x19')](handleEntityNotFound(_0x5554f7,null))[_0x976b('0x19')](function(_0x1e75b6){if(_0x1e75b6){return _0x1e75b6['removeTags'](_0x36b26b[_0x976b('0x27')][_0x976b('0x3e')]);}})[_0x976b('0x19')](respondWithStatusCode(_0x5554f7,null))[_0x976b('0x36')](handleError(_0x5554f7,null));};exports[_0x976b('0x54')]=function(_0x42d1b0,_0xd52632){var _0xa57431=moment()['unix']()[_0x976b('0x55')]();var _0x317240=path[_0x976b('0x56')](config['root'],_0x976b('0x57'),_0x976b('0x58'),'tmp');var _0x28927d=path[_0x976b('0x56')](config['root'],_0x976b('0x57'),'files',_0x976b('0x59'));var _0x328f34=path[_0x976b('0x56')](_0x317240,_0xa57431);var _0x4f0cf7=util[_0x976b('0x4c')]('transcript-%d-%s.zip',_0x42d1b0['params']['id'],_0xa57431);var _0x35ae35=path[_0x976b('0x56')](_0x317240,_0x4f0cf7);var _0x484510=[];_0x484510[_0x976b('0x5a')]({'model':db['User'],'as':_0x976b('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x484510[_0x976b('0x5a')]({'model':db[_0x976b('0x5c')],'as':_0x976b('0x5d'),'attributes':['id',_0x976b('0x5e'),_0x976b('0x5f')],'raw':!![]});if(_0x42d1b0[_0x976b('0x27')][_0x976b('0x59')]){_0x484510[_0x976b('0x5a')]({'model':db[_0x976b('0x60')],'as':_0x976b('0x60'),'raw':!![]});}var _0xd2d1e6=[{'model':db[_0x976b('0x3c')],'as':_0x976b('0x61'),'attributes':['id',_0x976b('0x38'),'createdAt',_0x976b('0x62'),_0x976b('0x63'),_0x976b('0x64')],'include':_0x484510}];_0xd2d1e6['push']({'model':db[_0x976b('0x65')],'as':_0x976b('0x66'),'attributes':['id',_0x976b('0x1d')]});_0xd2d1e6[_0x976b('0x5a')]({'model':db[_0x976b('0x5b')],'as':_0x976b('0x67'),'attributes':['id',_0x976b('0x68')]});return db[_0x976b('0x20')]['find']({'where':{'id':_0x42d1b0[_0x976b('0x2b')]['id']},'include':_0xd2d1e6})[_0x976b('0x19')](handleEntityNotFound(_0xd52632,null))[_0x976b('0x19')](function(_0x469766){if(_0x469766){var _0x23591b=_0x469766['get']({'plain':!![]});fs[_0x976b('0x69')](_0x328f34);var _0x12737b={'channel':_0x976b('0x6a'),'account':_0x23591b['Account']['name'],'agent':_0x23591b[_0x976b('0x67')]?_0x23591b['Owner']['fullname']:'N.A.','createdAt':moment(_0x23591b[_0x976b('0x6b')])[_0x976b('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x23591b['closed']?moment(_0x23591b[_0x976b('0x6c')])['format'](_0x976b('0x6d'))[_0x976b('0x55')]():'','disposition':_0x23591b[_0x976b('0x6e')],'visibility':_0x23591b[_0x976b('0x6f')]?'Public':_0x976b('0x70'),'messages':_(_0x23591b[_0x976b('0x61')])['filter']({'secret':![]})[_0x976b('0x71')](function(_0x336ffc){if(_0x336ffc[_0x976b('0x60')]){var _0x30b136=path['join'](_0x28927d,_0x336ffc[_0x976b('0x60')][_0x976b('0x72')]);if(fs[_0x976b('0x73')](_0x30b136)){fs[_0x976b('0x74')](_0x30b136)['pipe'](fs[_0x976b('0x75')](path[_0x976b('0x56')](_0x328f34,_0x336ffc[_0x976b('0x60')][_0x976b('0x72')])));}}return{'date':moment(_0x336ffc[_0x976b('0x6b')])[_0x976b('0x4c')](_0x976b('0x6d'))['toString'](),'sender':_0x336ffc[_0x976b('0x62')]===_0x976b('0x76')?_0x336ffc[_0x976b('0x5b')]?_0x336ffc['User'][_0x976b('0x68')]:_0x976b('0x77'):_0x336ffc[_0x976b('0x5d')][_0x976b('0x5e')]+(_0x336ffc[_0x976b('0x5d')][_0x976b('0x5f')]?'\x20'+_0x336ffc[_0x976b('0x5d')][_0x976b('0x5f')]:''),'body':_0x336ffc[_0x976b('0x60')]?_0x336ffc[_0x976b('0x60')][_0x976b('0x72')]:_0x336ffc[_0x976b('0x38')],'direction':_0x336ffc[_0x976b('0x62')]===_0x976b('0x76')?'A':'C','secret':_0x336ffc[_0x976b('0x63')],'read':_0x336ffc[_0x976b('0x64')],'attachment':_0x336ffc[_0x976b('0x60')]};})[_0x976b('0x78')]()};return ejs[_0x976b('0x79')](path[_0x976b('0x56')](config[_0x976b('0x7a')],_0x976b('0x57'),_0x976b('0x7b'),_0x976b('0x7c')),{'interaction':_0x12737b})[_0x976b('0x19')](function(_0x2677f6){var _0x48bea1=path['join'](_0x328f34,'transcript-'+_0x23591b['id']+'-'+_0xa57431+'.pdf');var _0x4644a3={'path':_0x48bea1,'channel':_0x976b('0x6a'),'interactionId':_0x23591b['id']};return pdf['createPdfFromHTML'](_0x2677f6,_0x4644a3);})[_0x976b('0x19')](function(){return new Promise(function(_0x303d3b,_0x4557d7){zipdir(_0x328f34,{'saveTo':_0x35ae35},function(_0x594327,_0x22725d){if(_0x594327)return _0x4557d7(_0x594327);return _0x303d3b(_0x22725d);});})[_0x976b('0x19')](function(){return new Promise(function(_0x343202,_0x1a7e4f){rimraf(_0x328f34,function(_0x315e86){if(_0x315e86)_0x1a7e4f(_0x315e86);return _0x343202();});});})[_0x976b('0x19')](function(){return _0xd52632[_0x976b('0x54')](_0x35ae35,_0x4f0cf7,function(_0x4fdd96){if(_0x4fdd96){logger[_0x976b('0x7d')](_0x976b('0x7e'),_0x4fdd96);}else{fs['unlinkSync'](_0x35ae35);}});});});}else{return _0xd52632[_0x976b('0x10')](0xc8);}})[_0x976b('0x36')](handleError(_0xd52632,null));}; \ No newline at end of file +var _0x2984=['Messages','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Owner','N.A.','toString','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','threadId','Public','basename','createReadStream','createWriteStream','createdAt','out','value','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../mysqldb','redis','./openchannelInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','stack','name','index','map','OpenchannelInteraction','rawAttributes','key','getOptions','findAll','openchannel','user','catch','show','type','from','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','OpenchannelMessage','addMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','split','format','rows','addTags','setTags','Tag','color','openchannelInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment'];(function(_0x274959,_0x43b93e){var _0x10fa40=function(_0x2e8049){while(--_0x2e8049){_0x274959['push'](_0x274959['shift']());}};_0x10fa40(++_0x43b93e);}(_0x2984,0x11a));var _0x4298=function(_0x5e6487,_0x2718b8){_0x5e6487=_0x5e6487-0x0;var _0x70c092=_0x2984[_0x5e6487];return _0x70c092;};'use strict';var rimraf=require(_0x4298('0x0'));var zipdir=require(_0x4298('0x1'));var moment=require(_0x4298('0x2'));var util=require(_0x4298('0x3'));var path=require('path');var ejs=require(_0x4298('0x4'));var fs=require('fs');var _=require(_0x4298('0x5'));var Redis=require(_0x4298('0x6'));var interaction=require(_0x4298('0x7'));var qs=require(_0x4298('0x8'));var pdf=require(_0x4298('0x9'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x4298('0xa'))['db'];config[_0x4298('0xb')]=_['defaults'](config[_0x4298('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4298('0xb')]));require(_0x4298('0xc'))[_0x4298('0xd')](socket);function respondWithStatusCode(_0x12cec7,_0x3381a4){_0x3381a4=_0x3381a4||0xcc;return function(_0x4706b7){if(_0x4706b7){return _0x12cec7[_0x4298('0xe')](_0x3381a4);}return _0x12cec7['status'](_0x3381a4)[_0x4298('0xf')]();};}function respondWithResult(_0x563202,_0x137c5d){_0x137c5d=_0x137c5d||0xc8;return function(_0x5c506f){if(_0x5c506f){return _0x563202[_0x4298('0x10')](_0x137c5d)['json'](_0x5c506f);}};}function respondWithFilteredResult(_0x4e7e48,_0x1044e9){return function(_0x4f186b){if(_0x4f186b){var _0x1bbfd5=typeof _0x1044e9['offset']===_0x4298('0x11')&&typeof _0x1044e9[_0x4298('0x12')]===_0x4298('0x11');var _0x2658a5=_0x4f186b[_0x4298('0x13')];var _0x4047fe=_0x1bbfd5?0x0:_0x1044e9[_0x4298('0x14')];var _0x2e2b55=_0x1bbfd5?_0x4f186b['count']:_0x1044e9[_0x4298('0x14')]+_0x1044e9['limit'];var _0x18b499;if(_0x2e2b55>=_0x2658a5){_0x2e2b55=_0x2658a5;_0x18b499=0xc8;}else{_0x18b499=0xce;}_0x4e7e48['status'](_0x18b499);return _0x4e7e48[_0x4298('0x15')](_0x4298('0x16'),_0x4047fe+'-'+_0x2e2b55+'/'+_0x2658a5)[_0x4298('0x17')](_0x4f186b);}return null;};}function saveUpdates(_0x3d57fa){return function(_0x1f3a7e){if(_0x1f3a7e){return _0x1f3a7e[_0x4298('0x18')](_0x3d57fa)[_0x4298('0x19')](function(_0x3051fe){return _0x3051fe;});}return null;};}function removeEntity(_0x55b06d){return function(_0x3a9157){if(_0x3a9157){return _0x3a9157[_0x4298('0x1a')]()[_0x4298('0x19')](function(){_0x55b06d[_0x4298('0x10')](0xcc)[_0x4298('0xf')]();});}};}function handleEntityNotFound(_0x2030dd){return function(_0x18c992){if(!_0x18c992){_0x2030dd[_0x4298('0xe')](0x194);}return _0x18c992;};}function handleError(_0x33a53c,_0x494b23){_0x494b23=_0x494b23||0x1f4;return function(_0x29aa56){logger['error'](_0x29aa56[_0x4298('0x1b')]);if(_0x29aa56[_0x4298('0x1c')]){delete _0x29aa56[_0x4298('0x1c')];}_0x33a53c[_0x4298('0x10')](_0x494b23)['send'](_0x29aa56);};}exports[_0x4298('0x1d')]=function(_0x302e17,_0x58fddd){var _0x50d3b2={};var _0x4b5bab=_[_0x4298('0x1e')](db[_0x4298('0x1f')][_0x4298('0x20')],function(_0x3f575a){return{'name':_0x3f575a['fieldName'],'type':_0x3f575a['type'][_0x4298('0x21')]};});_0x50d3b2=qs[_0x4298('0x22')](_0x4b5bab,_0x302e17);return interaction[_0x4298('0x23')](_0x4298('0x24'),_0x302e17['query'],_0x302e17[_0x4298('0x25')],_0x50d3b2,_0x4b5bab)[_0x4298('0x19')](respondWithFilteredResult(_0x58fddd,_0x50d3b2))[_0x4298('0x26')](handleError(_0x58fddd,null));};exports[_0x4298('0x27')]=function(_0xaebb42,_0x113c65){var _0x2c6e0d={};if(_0xaebb42['query'][_0x4298('0x28')]&&_0xaebb42['query'][_0x4298('0x28')]==='from'){_0x2c6e0d[_0x4298('0x29')]=_0xaebb42[_0x4298('0x2a')]['id'];}else{_0x2c6e0d['id']=_0xaebb42[_0x4298('0x2a')]['id'];}var _0x30d814={'raw':![],'where':_0x2c6e0d},_0x3e361c={};_0x3e361c[_0x4298('0x2b')]=_[_0x4298('0x2c')](db['OpenchannelInteraction'][_0x4298('0x20')]);_0x3e361c[_0x4298('0x2d')]=_[_0x4298('0x2c')](_0xaebb42[_0x4298('0x2d')]);_0x3e361c['filters']=_[_0x4298('0x2e')](_0x3e361c['model'],_0x3e361c[_0x4298('0x2d')]);_0x30d814[_0x4298('0x2f')]=_[_0x4298('0x2e')](_0x3e361c['model'],qs[_0x4298('0x30')](_0xaebb42[_0x4298('0x2d')][_0x4298('0x30')]));_0x30d814['attributes']=_0x30d814[_0x4298('0x2f')][_0x4298('0x31')]?_0x30d814[_0x4298('0x2f')]:_0x3e361c['model'];if(_0xaebb42['query'][_0x4298('0x32')]){_0x30d814[_0x4298('0x33')]=[{'all':!![]}];}_0x30d814=_['merge']({},_0x30d814,_0xaebb42[_0x4298('0x34')]);return db[_0x4298('0x1f')][_0x4298('0x35')](_0x30d814)[_0x4298('0x19')](handleEntityNotFound(_0x113c65,null))[_0x4298('0x19')](respondWithResult(_0x113c65,null))[_0x4298('0x26')](handleError(_0x113c65,null));};exports[_0x4298('0x36')]=function(_0xec4b54,_0x19cbd7){return db['OpenchannelInteraction'][_0x4298('0x36')](_0xec4b54['body'],{})[_0x4298('0x19')](respondWithResult(_0x19cbd7,0xc9))['catch'](handleError(_0x19cbd7,null));};exports[_0x4298('0x18')]=function(_0x2b0769,_0x538ee3){if(_0x2b0769['body']['id']){delete _0x2b0769['body']['id'];}return db[_0x4298('0x1f')]['find']({'where':{'id':_0x2b0769[_0x4298('0x2a')]['id']}})[_0x4298('0x19')](handleEntityNotFound(_0x538ee3,null))[_0x4298('0x19')](saveUpdates(_0x2b0769[_0x4298('0x37')],null))[_0x4298('0x19')](respondWithResult(_0x538ee3,null))[_0x4298('0x26')](handleError(_0x538ee3,null));};exports[_0x4298('0x1a')]=function(_0x1b4285,_0x2db047){return db[_0x4298('0x1f')]['find']({'where':{'id':_0x1b4285[_0x4298('0x2a')]['id']}})[_0x4298('0x19')](handleEntityNotFound(_0x2db047,null))[_0x4298('0x19')](removeEntity(_0x2db047,null))[_0x4298('0x26')](handleError(_0x2db047,null));};exports[_0x4298('0x38')]=function(_0x241663,_0x566c4e){return db['OpenchannelInteraction'][_0x4298('0x38')]()[_0x4298('0x19')](respondWithResult(_0x566c4e,null))[_0x4298('0x26')](handleError(_0x566c4e,null));};exports['addMessage']=function(_0x4b2223,_0x34dea3){return db[_0x4298('0x39')]['find']({'where':{'id':_0x4b2223['params']['id']}})['then'](handleEntityNotFound(_0x34dea3,null))[_0x4298('0x19')](function(_0x599197){if(_0x599197){return _0x599197[_0x4298('0x3a')](_0x4b2223[_0x4298('0x37')]['ids'],_[_0x4298('0x3b')](_0x4b2223[_0x4298('0x37')],[_0x4298('0x3c'),'id'])||{});}})[_0x4298('0x19')](respondWithResult(_0x34dea3,null))[_0x4298('0x26')](handleError(_0x34dea3,null));};exports[_0x4298('0x3d')]=function(_0x34cc89,_0x333679){var _0x4d1a53={'raw':![],'where':{}};var _0x1088a8={};var _0x14a577={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4298('0x3e')]({'where':{'id':_0x34cc89[_0x4298('0x2a')]['id']}})[_0x4298('0x19')](handleEntityNotFound(_0x333679,null))['then'](function(_0x31744c){if(_0x31744c){_0x1088a8[_0x4298('0x2b')]=_[_0x4298('0x2c')](db[_0x4298('0x39')][_0x4298('0x20')]);_0x1088a8[_0x4298('0x2d')]=_[_0x4298('0x2c')](_0x34cc89[_0x4298('0x2d')]);_0x1088a8[_0x4298('0x3f')]=_[_0x4298('0x2e')](_0x1088a8[_0x4298('0x2b')],_0x1088a8[_0x4298('0x2d')]);_0x4d1a53['attributes']=_['intersection'](_0x1088a8['model'],qs[_0x4298('0x30')](_0x34cc89[_0x4298('0x2d')][_0x4298('0x30')]));_0x4d1a53[_0x4298('0x2f')]=_0x4d1a53[_0x4298('0x2f')][_0x4298('0x31')]?_0x4d1a53[_0x4298('0x2f')]:_0x1088a8[_0x4298('0x2b')];if(!_0x34cc89[_0x4298('0x2d')][_0x4298('0x40')](_0x4298('0x41'))){_0x4d1a53[_0x4298('0x12')]=qs['limit'](_0x34cc89[_0x4298('0x2d')]['limit']);_0x4d1a53[_0x4298('0x14')]=qs[_0x4298('0x14')](_0x34cc89[_0x4298('0x2d')][_0x4298('0x14')]);}_0x4d1a53[_0x4298('0x42')]=qs[_0x4298('0x43')](_0x34cc89[_0x4298('0x2d')][_0x4298('0x43')]);_0x4d1a53[_0x4298('0x44')]=qs['filters'](_[_0x4298('0x45')](_0x34cc89[_0x4298('0x2d')],_0x1088a8['filters']));_0x4d1a53['where']['OpenchannelInteractionId']=_0x31744c['id'];if(_0x34cc89['query']['filter']){_0x4d1a53[_0x4298('0x44')]=_[_0x4298('0x46')](_0x4d1a53[_0x4298('0x44')],{'$or':_[_0x4298('0x1e')](_0x4d1a53[_0x4298('0x2f')],function(_0x4382a3){var _0x49a948={};_0x49a948[_0x4382a3]={'$like':'%'+_0x34cc89[_0x4298('0x2d')][_0x4298('0x47')]+'%'};return _0x49a948;})});}if(_0x34cc89['query']['$gte']){var _0x73ba50=_0x34cc89[_0x4298('0x2d')]['$gte'][_0x4298('0x48')](',');var _0x11c05f={};_0x11c05f[_0x73ba50[0x0]]={'$gte':moment(_0x73ba50[0x1])[_0x4298('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4d1a53[_0x4298('0x44')]=_[_0x4298('0x46')](_0x4d1a53['where'],_0x11c05f);}_0x4d1a53=_[_0x4298('0x46')]({},_0x4d1a53,_0x34cc89[_0x4298('0x34')]);return db[_0x4298('0x39')][_0x4298('0x13')]({'where':_0x4d1a53['where']})['then'](function(_0x342ecd){_0x14a577['count']=_0x342ecd;if(_0x34cc89['query'][_0x4298('0x32')]){_0x4d1a53[_0x4298('0x33')]=[{'all':!![]}];}return db[_0x4298('0x39')][_0x4298('0x23')](_0x4d1a53);})['then'](function(_0x42774b){_0x14a577[_0x4298('0x4a')]=_0x42774b;return _0x14a577;});}})[_0x4298('0x19')](respondWithFilteredResult(_0x333679,_0x4d1a53))['catch'](handleError(_0x333679,null));};exports[_0x4298('0x4b')]=function(_0x4657d1,_0x397924){return db[_0x4298('0x1f')][_0x4298('0x35')]({'where':{'id':_0x4657d1['params']['id']}})[_0x4298('0x19')](handleEntityNotFound(_0x397924,null))[_0x4298('0x19')](function(_0x58ac90){if(_0x58ac90){return _0x58ac90[_0x4298('0x4c')](_0x4657d1[_0x4298('0x37')]['ids'],_[_0x4298('0x3b')](_0x4657d1[_0x4298('0x37')],['ids','id'])||{})['spread'](function(){return db[_0x4298('0x4d')]['findAll']({'attributes':['id',_0x4298('0x1c'),_0x4298('0x4e')],'where':{'id':_0x4657d1[_0x4298('0x37')][_0x4298('0x3c')]}});})[_0x4298('0x19')](function(_0x5d1e3c){socket['emit'](_0x4298('0x4f'),{'id':Number(_0x4657d1[_0x4298('0x2a')]['id']),'tags':_0x5d1e3c||[]});return{'id':Number(_0x4657d1[_0x4298('0x2a')]['id']),'tags':_0x5d1e3c||[]};});}})[_0x4298('0x19')](respondWithResult(_0x397924,null))[_0x4298('0x26')](handleError(_0x397924,null));};exports[_0x4298('0x50')]=function(_0x3e7252,_0x59ca60){return db[_0x4298('0x1f')][_0x4298('0x35')]({'where':{'id':_0x3e7252[_0x4298('0x2a')]['id']}})[_0x4298('0x19')](handleEntityNotFound(_0x59ca60,null))[_0x4298('0x19')](function(_0x5c5118){if(_0x5c5118){return _0x5c5118[_0x4298('0x50')](_0x3e7252[_0x4298('0x2d')][_0x4298('0x3c')]);}})[_0x4298('0x19')](respondWithStatusCode(_0x59ca60,null))[_0x4298('0x26')](handleError(_0x59ca60,null));};exports[_0x4298('0x51')]=function(_0x2596a7,_0x4d28df){var _0x2ba290=moment()['unix']()['toString']();var _0x33cf6d=path[_0x4298('0x52')](config[_0x4298('0x53')],_0x4298('0x54'),_0x4298('0x55'),'tmp');var _0x4afdc1=path[_0x4298('0x52')](config['root'],_0x4298('0x54'),_0x4298('0x55'),_0x4298('0x56'));var _0xc800b7=path['join'](_0x33cf6d,_0x2ba290);var _0x3bffdc=util[_0x4298('0x49')](_0x4298('0x57'),_0x2596a7[_0x4298('0x2a')]['id'],_0x2ba290);var _0x2ffbda=path['join'](_0x33cf6d,_0x3bffdc);var _0x57b980=[];_0x57b980['push']({'model':db[_0x4298('0x58')],'as':_0x4298('0x58'),'attributes':['id',_0x4298('0x59')],'raw':!![]});_0x57b980[_0x4298('0x5a')]({'model':db[_0x4298('0x5b')],'as':_0x4298('0x5c'),'attributes':['id',_0x4298('0x5d'),_0x4298('0x5e')],'raw':!![]});if(_0x2596a7['query'][_0x4298('0x56')]){_0x57b980[_0x4298('0x5a')]({'model':db['Attachment'],'as':_0x4298('0x5f'),'raw':!![]});}var _0x14c27d=[{'model':db[_0x4298('0x39')],'as':_0x4298('0x60'),'attributes':['id','body','createdAt',_0x4298('0x61'),_0x4298('0x62'),_0x4298('0x63')],'include':_0x57b980}];_0x14c27d[_0x4298('0x5a')]({'model':db[_0x4298('0x64')],'as':_0x4298('0x65'),'attributes':['id',_0x4298('0x1c')]});_0x14c27d['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x4298('0x59')]});return db[_0x4298('0x1f')][_0x4298('0x35')]({'where':{'id':_0x2596a7[_0x4298('0x2a')]['id']},'include':_0x14c27d})[_0x4298('0x19')](handleEntityNotFound(_0x4d28df,null))['then'](function(_0x5becb8){if(_0x5becb8){var _0x425317=_0x5becb8[_0x4298('0x66')]({'plain':!![]});fs[_0x4298('0x67')](_0xc800b7);var _0x2bc124={'channel':'Openchannel','account':_0x425317[_0x4298('0x65')]['name'],'agent':_0x425317[_0x4298('0x68')]?_0x425317[_0x4298('0x68')][_0x4298('0x59')]:_0x4298('0x69'),'createdAt':moment(_0x425317['createdAt'])[_0x4298('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4298('0x6a')](),'closedAt':_0x425317[_0x4298('0x6b')]?moment(_0x425317[_0x4298('0x6c')])[_0x4298('0x49')](_0x4298('0x6d'))[_0x4298('0x6a')]():'','disposition':_0x425317['disposition'],'visibility':_0x425317[_0x4298('0x6e')]?_0x4298('0x6f'):'Private','messages':_(_0x425317[_0x4298('0x60')])[_0x4298('0x47')]({'secret':![]})[_0x4298('0x1e')](function(_0x27017c){if(_0x27017c['Attachment']){var _0x43fa52=path[_0x4298('0x52')](_0x4afdc1,_0x27017c['Attachment'][_0x4298('0x70')]);if(fs['existsSync'](_0x43fa52)){fs[_0x4298('0x71')](_0x43fa52)['pipe'](fs[_0x4298('0x72')](path[_0x4298('0x52')](_0xc800b7,_0x27017c[_0x4298('0x5f')][_0x4298('0x70')])));}}return{'date':moment(_0x27017c[_0x4298('0x73')])[_0x4298('0x49')](_0x4298('0x6d'))[_0x4298('0x6a')](),'sender':_0x27017c['direction']===_0x4298('0x74')?_0x27017c[_0x4298('0x58')]?_0x27017c[_0x4298('0x58')][_0x4298('0x59')]:'System':_0x27017c[_0x4298('0x5c')][_0x4298('0x5d')]+(_0x27017c['Contact'][_0x4298('0x5e')]?'\x20'+_0x27017c[_0x4298('0x5c')][_0x4298('0x5e')]:''),'body':_0x27017c['Attachment']?_0x27017c[_0x4298('0x5f')]['basename']:_0x27017c['body'],'direction':_0x27017c[_0x4298('0x61')]===_0x4298('0x74')?'A':'C','secret':_0x27017c[_0x4298('0x62')],'read':_0x27017c[_0x4298('0x63')],'attachment':_0x27017c[_0x4298('0x5f')]};})[_0x4298('0x75')]()};return ejs['renderFile'](path[_0x4298('0x52')](config[_0x4298('0x53')],'server',_0x4298('0x76'),_0x4298('0x77')),{'interaction':_0x2bc124})[_0x4298('0x19')](function(_0x1bcd18){var _0x2c073d=path[_0x4298('0x52')](_0xc800b7,_0x4298('0x78')+_0x425317['id']+'-'+_0x2ba290+'.pdf');var _0x345a6b={'path':_0x2c073d,'channel':_0x4298('0x79'),'interactionId':_0x425317['id']};return pdf[_0x4298('0x7a')](_0x1bcd18,_0x345a6b);})[_0x4298('0x19')](function(){return new Promise(function(_0x30c22a,_0x56ac96){zipdir(_0xc800b7,{'saveTo':_0x2ffbda},function(_0x368ed0,_0x838cb9){if(_0x368ed0)return _0x56ac96(_0x368ed0);return _0x30c22a(_0x838cb9);});})['then'](function(){return new Promise(function(_0x2dec30,_0xbcec5c){rimraf(_0xc800b7,function(_0x1b04af){if(_0x1b04af)_0xbcec5c(_0x1b04af);return _0x2dec30();});});})[_0x4298('0x19')](function(){return _0x4d28df[_0x4298('0x51')](_0x2ffbda,_0x3bffdc,function(_0x37aa76){if(_0x37aa76){logger[_0x4298('0x7b')](_0x4298('0x7c'),_0x37aa76);}else{fs[_0x4298('0x7d')](_0x2ffbda);}});});});}else{return _0x4d28df['sendStatus'](0xc8);}})[_0x4298('0x26')](handleError(_0x4d28df,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 920e60b..4800445 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 _0xa843=['remove','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x49343d,_0x4b1294){var _0x433060=function(_0x5b4c3e){while(--_0x5b4c3e){_0x49343d['push'](_0x49343d['shift']());}};_0x433060(++_0x4b1294);}(_0xa843,0x1c6));var _0x3a84=function(_0x412561,_0x357419){_0x412561=_0x412561-0x0;var _0x63471a=_0xa843[_0x412561];return _0x63471a;};'use strict';var EventEmitter=require(_0x3a84('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x3a84('0x1'))['db'][_0x3a84('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3a84('0x3')](0x0);var events={'afterCreate':_0x3a84('0x4'),'afterUpdate':'update','afterDestroy':_0x3a84('0x5')};function emitEvent(_0x26d52c){return function(_0x323bd9,_0x41bc42,_0x16ba96){_0x323bd9['getUsers']({'attributes':['id'],'raw':!![]})[_0x3a84('0x6')](function(_0x45d407){_0x323bd9['setDataValue']('Users',_0x45d407[_0x3a84('0x7')](function(_0x207bd0){return{'id':_0x207bd0['id']};}));return OpenchannelMessage[_0x3a84('0x8')]({'where':{'OpenchannelInteractionId':_0x323bd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a84('0x6')](function(_0x182059){_0x323bd9[_0x3a84('0x9')](_0x3a84('0xa'),_0x182059[_0x3a84('0xb')]);OpenchannelInteractionEvents[_0x3a84('0xc')](_0x26d52c+':'+_0x323bd9['id'],_0x323bd9);OpenchannelInteractionEvents[_0x3a84('0xc')](_0x26d52c,_0x323bd9);_0x16ba96(null);})[_0x3a84('0xd')](_0x16ba96(null));};}for(var e in events){if(events[_0x3a84('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x3a84('0xf')](e,emitEvent(event));}}module[_0x3a84('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x76db=['exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x203c7c,_0x3eb51b){var _0x41eec8=function(_0x1314f1){while(--_0x1314f1){_0x203c7c['push'](_0x203c7c['shift']());}};_0x41eec8(++_0x3eb51b);}(_0x76db,0x1ef));var _0xb76d=function(_0x5c8e8c,_0x13ae94){_0x5c8e8c=_0x5c8e8c-0x0;var _0x146bb5=_0x76db[_0x5c8e8c];return _0x146bb5;};'use strict';var EventEmitter=require(_0xb76d('0x0'));var OpenchannelInteraction=require(_0xb76d('0x1'))['db'][_0xb76d('0x2')];var OpenchannelMessage=require(_0xb76d('0x1'))['db'][_0xb76d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb76d('0x4'),'afterUpdate':_0xb76d('0x5'),'afterDestroy':_0xb76d('0x6')};function emitEvent(_0x270fe9){return function(_0x440dc4,_0x282e9d,_0x1a8c2d){_0x440dc4[_0xb76d('0x7')]({'attributes':['id'],'raw':!![]})[_0xb76d('0x8')](function(_0x33d864){_0x440dc4['setDataValue'](_0xb76d('0x9'),_0x33d864[_0xb76d('0xa')](function(_0x3c2031){return{'id':_0x3c2031['id']};}));return OpenchannelMessage[_0xb76d('0xb')]({'where':{'OpenchannelInteractionId':_0x440dc4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb76d('0x8')](function(_0x18340c){_0x440dc4[_0xb76d('0xc')](_0xb76d('0xd'),_0x18340c[_0xb76d('0xe')]);OpenchannelInteractionEvents['emit'](_0x270fe9+':'+_0x440dc4['id'],_0x440dc4);OpenchannelInteractionEvents[_0xb76d('0xf')](_0x270fe9,_0x440dc4);_0x1a8c2d(null);})['catch'](_0x1a8c2d(null));};}for(var e in events){if(events[_0xb76d('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xb76d('0x11')](e,emitEvent(event));}}module[_0xb76d('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 775c6b6..9075bef 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 _0x0cc5=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt'];(function(_0x475820,_0x1b8670){var _0x47d5f1=function(_0x1565dd){while(--_0x1565dd){_0x475820['push'](_0x475820['shift']());}};_0x47d5f1(++_0x1b8670);}(_0x0cc5,0x1e2));var _0x50cc=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x0cc5[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x50cc('0x0'));var util=require(_0x50cc('0x1'));var logger=require(_0x50cc('0x2'))(_0x50cc('0x3'));var moment=require(_0x50cc('0x4'));var BPromise=require(_0x50cc('0x5'));var rp=require(_0x50cc('0x6'));var fs=require('fs');var path=require(_0x50cc('0x7'));var rimraf=require('rimraf');var config=require(_0x50cc('0x8'));var attributes=require(_0x50cc('0x9'));module[_0x50cc('0xa')]=function(_0x19c631,_0x4647dc){return _0x19c631[_0x50cc('0xb')](_0x50cc('0xc'),attributes,{'tableName':_0x50cc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50cc('0xe'),'collate':_0x50cc('0xf'),'hooks':{'beforeUpdate':function(_0x27b4c7,_0x22603a,_0x396634){if(_0x27b4c7['changed'](_0x50cc('0x10'))){_0x27b4c7[_0x50cc('0x11')]=moment()[_0x50cc('0x12')](_0x50cc('0x13'));}_0x396634(null,_0x27b4c7);}}});}; \ No newline at end of file +var _0xb4b1=['utf8mb4_unicode_ci','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xb4b1,0x18a));var _0x1b4b=function(_0x1179f4,_0x2c1307){_0x1179f4=_0x1179f4-0x0;var _0x419ee0=_0xb4b1[_0x1179f4];return _0x419ee0;};'use strict';var _=require(_0x1b4b('0x0'));var util=require(_0x1b4b('0x1'));var logger=require('../../config/logger')(_0x1b4b('0x2'));var moment=require(_0x1b4b('0x3'));var BPromise=require(_0x1b4b('0x4'));var rp=require(_0x1b4b('0x5'));var fs=require('fs');var path=require(_0x1b4b('0x6'));var rimraf=require(_0x1b4b('0x7'));var config=require(_0x1b4b('0x8'));var attributes=require(_0x1b4b('0x9'));module[_0x1b4b('0xa')]=function(_0x2168ec,_0x20a742){return _0x2168ec[_0x1b4b('0xb')](_0x1b4b('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b4b('0xd'),'collate':_0x1b4b('0xe'),'hooks':{'beforeUpdate':function(_0x4ba037,_0x513065,_0x1b70a9){if(_0x4ba037['changed']('closed')){_0x4ba037['closedAt']=moment()[_0x1b4b('0xf')](_0x1b4b('0x10'));}_0x1b70a9(null,_0x4ba037);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b822b2c..e67413e 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 _0xa0ce=['request','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','OpenchannelInteraction','update','options','raw','where','attributes','limit','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0xca533,_0x391515){var _0x168ecc=function(_0x4f8747){while(--_0x4f8747){_0xca533['push'](_0xca533['shift']());}};_0x168ecc(++_0x391515);}(_0xa0ce,0x1cd));var _0xea0c=function(_0x41b56f,_0x15b410){_0x41b56f=_0x41b56f-0x0;var _0x285ff9=_0xa0ce[_0x41b56f];return _0x285ff9;};'use strict';var _=require(_0xea0c('0x0'));var util=require(_0xea0c('0x1'));var moment=require(_0xea0c('0x2'));var BPromise=require(_0xea0c('0x3'));var rs=require(_0xea0c('0x4'));var fs=require('fs');var Redis=require(_0xea0c('0x5'));var db=require(_0xea0c('0x6'))['db'];var utils=require(_0xea0c('0x7'));var logger=require(_0xea0c('0x8'))(_0xea0c('0x9'));var config=require(_0xea0c('0xa'));var jayson=require(_0xea0c('0xb'));var client=jayson[_0xea0c('0xc')][_0xea0c('0xd')]({'port':0x232a});config[_0xea0c('0xe')]=_[_0xea0c('0xf')](config[_0xea0c('0xe')],{'host':_0xea0c('0x10'),'port':0x18eb});var socket=require(_0xea0c('0x11'))(new Redis(config[_0xea0c('0xe')]));require(_0xea0c('0x12'))['register'](socket);function respondWithRpcPromise(_0x1131e3,_0x1fb283,_0x227f41){return new BPromise(function(_0x4a81c4,_0x934fd7){return client[_0xea0c('0x13')](_0x1131e3,_0x227f41)['then'](function(_0x275443){logger['info'](_0xea0c('0x14'),_0x1fb283,'request\x20sent');logger[_0xea0c('0x15')](_0xea0c('0x16'),_0x1fb283,_0xea0c('0x17'),JSON[_0xea0c('0x18')](_0x275443));if(_0x275443[_0xea0c('0x19')]){if(_0x275443[_0xea0c('0x19')][_0xea0c('0x1a')]===0x1f4){logger[_0xea0c('0x19')](_0xea0c('0x14'),_0x1fb283,_0x275443[_0xea0c('0x19')][_0xea0c('0x1b')]);return _0x934fd7(_0x275443['error'][_0xea0c('0x1b')]);}logger[_0xea0c('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1fb283,_0x275443[_0xea0c('0x19')][_0xea0c('0x1b')]);return _0x4a81c4(_0x275443[_0xea0c('0x19')][_0xea0c('0x1b')]);}else{logger[_0xea0c('0x1c')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1fb283,'request\x20sent');_0x4a81c4(_0x275443[_0xea0c('0x1d')][_0xea0c('0x1b')]);}})['catch'](function(_0x583c07){logger[_0xea0c('0x19')](_0xea0c('0x14'),_0x1fb283,_0x583c07);_0x934fd7(_0x583c07);});});}exports['UpdateOpenchannelInteraction']=function(_0x3be8e6){var _0x84d574=this;return new Promise(function(_0x40e762,_0x50ea6b){return db[_0xea0c('0x1e')][_0xea0c('0x1f')](_0x3be8e6['body'],{'raw':_0x3be8e6[_0xea0c('0x20')]?_0x3be8e6[_0xea0c('0x20')][_0xea0c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3be8e6[_0xea0c('0x20')]?_0x3be8e6['options'][_0xea0c('0x22')]||null:null,'attributes':_0x3be8e6[_0xea0c('0x20')]?_0x3be8e6[_0xea0c('0x20')][_0xea0c('0x23')]||null:null,'limit':_0x3be8e6[_0xea0c('0x20')]?_0x3be8e6[_0xea0c('0x20')][_0xea0c('0x24')]||null:null})[_0xea0c('0x25')](function(_0x2dd23f){logger[_0xea0c('0x1c')](_0xea0c('0x26'),_0x3be8e6);logger[_0xea0c('0x15')](_0xea0c('0x26'),_0x3be8e6,JSON[_0xea0c('0x18')](_0x2dd23f));_0x40e762(_0x2dd23f);})[_0xea0c('0x27')](function(_0xf065fb){logger['error'](_0xea0c('0x26'),_0xf065fb[_0xea0c('0x1b')],_0x3be8e6);_0x50ea6b(_0x84d574[_0xea0c('0x19')](0x1f4,_0xf065fb['message']));});});};exports[_0xea0c('0x28')]=function(_0x2e9e89){return new Promise(function(_0x14b08b,_0x44b704){return db[_0xea0c('0x1e')][_0xea0c('0x29')]({'where':_0x2e9e89['options']?_0x2e9e89[_0xea0c('0x20')][_0xea0c('0x22')]||null:null})[_0xea0c('0x25')](function(_0x556c3d){if(_0x556c3d){return _0x556c3d[_0xea0c('0x2a')](_0x2e9e89[_0xea0c('0x2b')]['ids'],_[_0xea0c('0x2c')](_0x2e9e89[_0xea0c('0x2b')],[_0xea0c('0x2d'),'id'])||{});}})[_0xea0c('0x2e')](function(_0x126bc7){logger[_0xea0c('0x1c')](_0xea0c('0x2f'),_0x2e9e89);logger[_0xea0c('0x15')](_0xea0c('0x2f'),_0x2e9e89,JSON[_0xea0c('0x18')](_0x126bc7));_0x14b08b(_0x126bc7);})[_0xea0c('0x27')](function(_0x3251bc){logger['error'](_0xea0c('0x2f'),_0x3251bc[_0xea0c('0x1b')],_0x2e9e89);_0x44b704(_this[_0xea0c('0x19')](0x1f4,_0x3251bc['message']));});});}; \ No newline at end of file +var _0x70ba=['spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','info','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit'];(function(_0x2161e7,_0x8c4a1c){var _0x2780bd=function(_0x5525f5){while(--_0x5525f5){_0x2161e7['push'](_0x2161e7['shift']());}};_0x2780bd(++_0x8c4a1c);}(_0x70ba,0x16a));var _0xa70b=function(_0xc65cac,_0x526af1){_0xc65cac=_0xc65cac-0x0;var _0x522012=_0x70ba[_0xc65cac];return _0x522012;};'use strict';var _=require(_0xa70b('0x0'));var util=require(_0xa70b('0x1'));var moment=require(_0xa70b('0x2'));var BPromise=require(_0xa70b('0x3'));var rs=require(_0xa70b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa70b('0x5'));var logger=require(_0xa70b('0x6'))(_0xa70b('0x7'));var config=require(_0xa70b('0x8'));var jayson=require(_0xa70b('0x9'));var client=jayson[_0xa70b('0xa')][_0xa70b('0xb')]({'port':0x232a});config[_0xa70b('0xc')]=_[_0xa70b('0xd')](config[_0xa70b('0xc')],{'host':_0xa70b('0xe'),'port':0x18eb});var socket=require(_0xa70b('0xf'))(new Redis(config['redis']));require(_0xa70b('0x10'))[_0xa70b('0x11')](socket);function respondWithRpcPromise(_0x4a8b7c,_0x42ed11,_0xe516d0){return new BPromise(function(_0x502ea1,_0x1863e1){return client[_0xa70b('0x12')](_0x4a8b7c,_0xe516d0)[_0xa70b('0x13')](function(_0x20edf9){logger['info'](_0xa70b('0x14'),_0x42ed11,_0xa70b('0x15'));logger[_0xa70b('0x16')](_0xa70b('0x17'),_0x42ed11,_0xa70b('0x15'),JSON[_0xa70b('0x18')](_0x20edf9));if(_0x20edf9['error']){if(_0x20edf9[_0xa70b('0x19')][_0xa70b('0x1a')]===0x1f4){logger[_0xa70b('0x19')](_0xa70b('0x14'),_0x42ed11,_0x20edf9[_0xa70b('0x19')][_0xa70b('0x1b')]);return _0x1863e1(_0x20edf9['error'][_0xa70b('0x1b')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x42ed11,_0x20edf9['error'][_0xa70b('0x1b')]);return _0x502ea1(_0x20edf9[_0xa70b('0x19')][_0xa70b('0x1b')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x42ed11,'request\x20sent');_0x502ea1(_0x20edf9[_0xa70b('0x1c')][_0xa70b('0x1b')]);}})[_0xa70b('0x1d')](function(_0x34caaa){logger[_0xa70b('0x19')](_0xa70b('0x14'),_0x42ed11,_0x34caaa);_0x1863e1(_0x34caaa);});});}exports[_0xa70b('0x1e')]=function(_0x15ae7b){var _0x2f9169=this;return new Promise(function(_0x49cc1f,_0x24663a){return db[_0xa70b('0x1f')]['update'](_0x15ae7b[_0xa70b('0x20')],{'raw':_0x15ae7b[_0xa70b('0x21')]?_0x15ae7b[_0xa70b('0x21')][_0xa70b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15ae7b[_0xa70b('0x21')]?_0x15ae7b[_0xa70b('0x21')]['where']||null:null,'attributes':_0x15ae7b[_0xa70b('0x21')]?_0x15ae7b[_0xa70b('0x21')][_0xa70b('0x23')]||null:null,'limit':_0x15ae7b['options']?_0x15ae7b['options']['limit']||null:null})[_0xa70b('0x13')](function(_0x40c6d6){logger[_0xa70b('0x24')](_0xa70b('0x1e'),_0x15ae7b);logger[_0xa70b('0x16')](_0xa70b('0x1e'),_0x15ae7b,JSON[_0xa70b('0x18')](_0x40c6d6));_0x49cc1f(_0x40c6d6);})['catch'](function(_0x51df2b){logger[_0xa70b('0x19')](_0xa70b('0x1e'),_0x51df2b[_0xa70b('0x1b')],_0x15ae7b);_0x24663a(_0x2f9169[_0xa70b('0x19')](0x1f4,_0x51df2b[_0xa70b('0x1b')]));});});};exports[_0xa70b('0x25')]=function(_0xf33b44){return new Promise(function(_0x559588,_0x39b3a9){return db[_0xa70b('0x1f')][_0xa70b('0x26')]({'where':_0xf33b44[_0xa70b('0x21')]?_0xf33b44[_0xa70b('0x21')][_0xa70b('0x27')]||null:null})['then'](function(_0x59671c){if(_0x59671c){return _0x59671c[_0xa70b('0x28')](_0xf33b44[_0xa70b('0x20')][_0xa70b('0x29')],_[_0xa70b('0x2a')](_0xf33b44[_0xa70b('0x20')],[_0xa70b('0x29'),'id'])||{});}})[_0xa70b('0x2b')](function(_0x72a0d){logger[_0xa70b('0x24')](_0xa70b('0x2c'),_0xf33b44);logger[_0xa70b('0x16')](_0xa70b('0x2c'),_0xf33b44,JSON[_0xa70b('0x18')](_0x72a0d));_0x559588(_0x72a0d);})['catch'](function(_0x59f32b){logger[_0xa70b('0x19')]('AddTags',_0x59f32b[_0xa70b('0x1b')],_0xf33b44);_0x39b3a9(_this[_0xa70b('0x19')](0x1f4,_0x59f32b[_0xa70b('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a731682..6acc797 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 _0xc2ce=['removeListener','register','length','openchannelInteraction:','save','emit'];(function(_0x31d203,_0x638237){var _0x4b8efc=function(_0x44cfc4){while(--_0x44cfc4){_0x31d203['push'](_0x31d203['shift']());}};_0x4b8efc(++_0x638237);}(_0xc2ce,0x160));var _0xec2c=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xc2ce[_0x223c0d];return _0x207827;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xec2c('0x0'),'remove','update'];function createListener(_0x2fe7ce,_0x5972d9){return function(_0x4de9c2){_0x5972d9[_0xec2c('0x1')](_0x2fe7ce,_0x4de9c2);};}function removeListener(_0x4cacf6,_0x3dd9b3){return function(){OpenchannelInteractionEvents[_0xec2c('0x2')](_0x4cacf6,_0x3dd9b3);};}exports[_0xec2c('0x3')]=function(_0x503b0c){for(var _0x528881=0x0,_0x21fbf9=events[_0xec2c('0x4')];_0x528881<_0x21fbf9;_0x528881++){var _0x2da75b=events[_0x528881];var _0x3c04c2=createListener(_0xec2c('0x5')+_0x2da75b,_0x503b0c);OpenchannelInteractionEvents['on'](_0x2da75b,_0x3c04c2);}}; \ No newline at end of file +var _0xa9b4=['register','length','./openchannelInteraction.events','remove','update','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9b4,0x92));var _0x4a9b=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xa9b4[_0xdc37a1];return _0x99b4fe;};'use strict';var OpenchannelInteractionEvents=require(_0x4a9b('0x0'));var events=['save',_0x4a9b('0x1'),_0x4a9b('0x2')];function createListener(_0x340c63,_0x508cad){return function(_0x260ee0){_0x508cad['emit'](_0x340c63,_0x260ee0);};}function removeListener(_0x193d0e,_0x280e72){return function(){OpenchannelInteractionEvents[_0x4a9b('0x3')](_0x193d0e,_0x280e72);};}exports[_0x4a9b('0x4')]=function(_0x3c47c8){for(var _0x4ffe54=0x0,_0x2b9c0c=events[_0x4a9b('0x5')];_0x4ffe54<_0x2b9c0c;_0x4ffe54++){var _0xca1f90=events[_0x4ffe54];var _0x1db84f=createListener('openchannelInteraction:'+_0xca1f90,_0x3c47c8);OpenchannelInteractionEvents['on'](_0xca1f90,_0x1db84f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4405eb9..a1d682f 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x1b9077,_0x27de66){var _0x5cb0ef=function(_0x3c27fa){while(--_0x3c27fa){_0x1b9077['push'](_0x1b9077['shift']());}};_0x5cb0ef(++_0x27de66);}(_0xe706,0xa3));var _0x6e70=function(_0x455284,_0x383648){_0x455284=_0x455284-0x0;var _0x3e70dc=_0xe706[_0x455284];return _0x3e70dc;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x161c8a,_0x36b246){var _0x17d67f=function(_0xb825d7){while(--_0xb825d7){_0x161c8a['push'](_0x161c8a['shift']());}};_0x17d67f(++_0x36b246);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5dc64a7..eeeabee 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 _0x94e6=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x3aa7eb,_0x2ca2c7){var _0xc217d9=function(_0x83f1ac){while(--_0x83f1ac){_0x3aa7eb['push'](_0x3aa7eb['shift']());}};_0xc217d9(++_0x2ca2c7);}(_0x94e6,0x194));var _0x694e=function(_0x58c00f,_0x4736fe){_0x58c00f=_0x58c00f-0x0;var _0x3c1cc8=_0x94e6[_0x58c00f];return _0x3c1cc8;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'body':{'type':Sequelize[_0x694e('0x1')](_0x694e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x694e('0x4')]('in',_0x694e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x694e('0x6')]},'providerName':{'type':Sequelize[_0x694e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd0e4=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x1c106c,_0x5c900c){var _0x3d14b7=function(_0x5470d4){while(--_0x5470d4){_0x1c106c['push'](_0x1c106c['shift']());}};_0x3d14b7(++_0x5c900c);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x1ab724,_0x2e2566){_0x1ab724=_0x1ab724-0x0;var _0x2167ac=_0xd0e4[_0x1ab724];return _0x2167ac;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'body':{'type':Sequelize[_0x4d0e('0x2')](_0x4d0e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d0e('0x4')]('in',_0x4d0e('0x5')),'defaultValue':_0x4d0e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d0e('0x6')]},'providerName':{'type':Sequelize[_0x4d0e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7f90c6d..9804e17 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 _0xed10=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','email','internal','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','undefined','limit','count','offset','set','apply','reject','update','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','show','params','options','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','readAt'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xed10,0xa0));var _0x0ed1=function(_0x53a382,_0x21cfcf){_0x53a382=_0x53a382-0x0;var _0x150aca=_0xed10[_0x53a382];return _0x150aca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0ed1('0x0'));var jsonpatch=require(_0x0ed1('0x1'));var rp=require(_0x0ed1('0x2'));var moment=require(_0x0ed1('0x3'));var BPromise=require(_0x0ed1('0x4'));var Mustache=require(_0x0ed1('0x5'));var util=require(_0x0ed1('0x6'));var path=require(_0x0ed1('0x7'));var sox=require('sox');var csv=require(_0x0ed1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed1('0x9'));var squel=require(_0x0ed1('0xa'));var crypto=require(_0x0ed1('0xb'));var jsforce=require(_0x0ed1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0ed1('0x8'));var querystring=require('querystring');var Papa=require(_0x0ed1('0xd'));var Redis=require(_0x0ed1('0xe'));var authService=require(_0x0ed1('0xf'));var qs=require(_0x0ed1('0x10'));var as=require(_0x0ed1('0x11'));var hardwareService=require(_0x0ed1('0x12'));var logger=require(_0x0ed1('0x13'))(_0x0ed1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ed1('0x15'));var db=require(_0x0ed1('0x16'))['db'];config[_0x0ed1('0x17')]=_['defaults'](config[_0x0ed1('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ed1('0x17')]));require(_0x0ed1('0x18'))[_0x0ed1('0x19')](socket);var jayson=require(_0x0ed1('0x1a'));var client=jayson[_0x0ed1('0x1b')][_0x0ed1('0x1c')]({'port':0x232c});var client9002=jayson[_0x0ed1('0x1b')][_0x0ed1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4ef9a7,_0x502fba,_0x3caa61,_0x209138){return new BPromise(function(_0x5ca028,_0xaa5666){var _0x694507=_0x209138||client;return _0x694507[_0x0ed1('0x1d')](_0x4ef9a7,_0x3caa61)[_0x0ed1('0x1e')](function(_0x27dcb0){logger[_0x0ed1('0x1f')](_0x0ed1('0x20'),_0x502fba,'request\x20sent');logger[_0x0ed1('0x21')](_0x0ed1('0x22'),_0x502fba,_0x0ed1('0x23'),JSON[_0x0ed1('0x24')](_0x27dcb0));if(_0x27dcb0[_0x0ed1('0x25')]){if(_0x27dcb0['error'][_0x0ed1('0x26')]===0x1f4){logger[_0x0ed1('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x502fba,_0x27dcb0[_0x0ed1('0x25')][_0x0ed1('0x27')]);return _0xaa5666(_0x27dcb0[_0x0ed1('0x25')]['message']);}logger[_0x0ed1('0x25')](_0x0ed1('0x20'),_0x502fba,_0x27dcb0['error'][_0x0ed1('0x27')]);return _0x5ca028(_0x27dcb0[_0x0ed1('0x25')][_0x0ed1('0x27')]);}else{logger[_0x0ed1('0x1f')](_0x0ed1('0x20'),_0x502fba,_0x0ed1('0x23'));_0x5ca028(_0x27dcb0['result'][_0x0ed1('0x27')]);}})[_0x0ed1('0x28')](function(_0x3eab2a){logger[_0x0ed1('0x25')](_0x0ed1('0x20'),_0x502fba,_0x3eab2a);_0xaa5666(_0x3eab2a);});});}function respondWithStatusCode(_0x2ecda3,_0x432da2){_0x432da2=_0x432da2||0xcc;return function(_0x25d4f4){if(_0x25d4f4){return _0x2ecda3['sendStatus'](_0x432da2);}return _0x2ecda3[_0x0ed1('0x29')](_0x432da2)[_0x0ed1('0x2a')]();};}function respondWithResult(_0x625313,_0x543f3c){_0x543f3c=_0x543f3c||0xc8;return function(_0x126ebe){if(_0x126ebe){return _0x625313[_0x0ed1('0x29')](_0x543f3c)[_0x0ed1('0x2b')](_0x126ebe);}};}function respondWithFilteredResult(_0x53c829,_0xc49956){return function(_0x46a9c6){if(_0x46a9c6){var _0x1c89cd=typeof _0xc49956['offset']===_0x0ed1('0x2c')&&typeof _0xc49956[_0x0ed1('0x2d')]==='undefined';var _0x3e6678=_0x46a9c6[_0x0ed1('0x2e')];var _0x17e5d4=_0x1c89cd?0x0:_0xc49956['offset'];var _0x19dfa6=_0x1c89cd?_0x46a9c6[_0x0ed1('0x2e')]:_0xc49956[_0x0ed1('0x2f')]+_0xc49956[_0x0ed1('0x2d')];var _0x110be7;if(_0x19dfa6>=_0x3e6678){_0x19dfa6=_0x3e6678;_0x110be7=0xc8;}else{_0x110be7=0xce;}_0x53c829[_0x0ed1('0x29')](_0x110be7);return _0x53c829[_0x0ed1('0x30')]('Content-Range',_0x17e5d4+'-'+_0x19dfa6+'/'+_0x3e6678)['json'](_0x46a9c6);}return null;};}function patchUpdates(_0x3f1bfd){return function(_0x394c7a){try{jsonpatch[_0x0ed1('0x31')](_0x394c7a,_0x3f1bfd,!![]);}catch(_0x349bab){return BPromise[_0x0ed1('0x32')](_0x349bab);}return _0x394c7a['save']();};}function saveUpdates(_0x4ab64e,_0x462f7a){return function(_0x281dad){if(_0x281dad){return _0x281dad[_0x0ed1('0x33')](_0x4ab64e)[_0x0ed1('0x1e')](function(_0x352ea8){return _0x352ea8;});}return null;};}function removeEntity(_0x29887a,_0x45b8ba){return function(_0x4598bd){if(_0x4598bd){return _0x4598bd['destroy']()[_0x0ed1('0x1e')](function(){_0x29887a[_0x0ed1('0x29')](0xcc)[_0x0ed1('0x2a')]();});}};}function handleEntityNotFound(_0xec02e2,_0x25a25f){return function(_0x4a67ec){if(!_0x4a67ec){_0xec02e2['sendStatus'](0x194);}return _0x4a67ec;};}function handleError(_0x1e1db6,_0x515782){_0x515782=_0x515782||0x1f4;return function(_0x189fda){logger['error'](_0x189fda[_0x0ed1('0x34')]);if(_0x189fda[_0x0ed1('0x35')]){delete _0x189fda[_0x0ed1('0x35')];}_0x1e1db6[_0x0ed1('0x29')](_0x515782)[_0x0ed1('0x36')](_0x189fda);};}exports[_0x0ed1('0x37')]=function(_0x5d3c5e,_0x1fb14d){var _0x36a125={},_0x15c82a={},_0xe3616d={'count':0x0,'rows':[]};var _0x1dcf50=_[_0x0ed1('0x38')](db[_0x0ed1('0x39')][_0x0ed1('0x3a')],function(_0x3f5f80){return{'name':_0x3f5f80['fieldName'],'type':_0x3f5f80[_0x0ed1('0x3b')][_0x0ed1('0x3c')]};});_0x15c82a[_0x0ed1('0x3d')]=_[_0x0ed1('0x38')](_0x1dcf50,_0x0ed1('0x35'));_0x15c82a[_0x0ed1('0x3e')]=_[_0x0ed1('0x3f')](_0x5d3c5e[_0x0ed1('0x3e')]);_0x15c82a[_0x0ed1('0x40')]=_['intersection'](_0x15c82a[_0x0ed1('0x3d')],_0x15c82a[_0x0ed1('0x3e')]);_0x36a125['attributes']=_[_0x0ed1('0x41')](_0x15c82a['model'],qs[_0x0ed1('0x42')](_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x42')]));_0x36a125[_0x0ed1('0x43')]=_0x36a125[_0x0ed1('0x43')][_0x0ed1('0x44')]?_0x36a125['attributes']:_0x15c82a[_0x0ed1('0x3d')];if(!_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x45')](_0x0ed1('0x46'))){_0x36a125[_0x0ed1('0x2d')]=qs[_0x0ed1('0x2d')](_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x2d')]);_0x36a125['offset']=qs[_0x0ed1('0x2f')](_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x2f')]);}_0x36a125['order']=qs[_0x0ed1('0x47')](_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x47')]);_0x36a125['where']=qs[_0x0ed1('0x40')](_['pick'](_0x5d3c5e[_0x0ed1('0x3e')],_0x15c82a['filters']),_0x1dcf50);if(_0x5d3c5e[_0x0ed1('0x3e')]['filter']){_0x36a125[_0x0ed1('0x48')]=_[_0x0ed1('0x49')](_0x36a125[_0x0ed1('0x48')],{'$or':_[_0x0ed1('0x38')](_0x1dcf50,function(_0x252fd0){if(_0x252fd0[_0x0ed1('0x3b')]!==_0x0ed1('0x4a')){var _0x5049e0={};_0x5049e0[_0x252fd0[_0x0ed1('0x35')]]={'$like':'%'+_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x4b')]+'%'};return _0x5049e0;}})});}_0x36a125=_['merge']({},_0x36a125,_0x5d3c5e['options']);var _0x28ec42={'where':_0x36a125[_0x0ed1('0x48')]};return db[_0x0ed1('0x39')]['count'](_0x28ec42)[_0x0ed1('0x1e')](function(_0x1ac71a){_0xe3616d[_0x0ed1('0x2e')]=_0x1ac71a;if(_0x5d3c5e[_0x0ed1('0x3e')][_0x0ed1('0x4c')]){_0x36a125[_0x0ed1('0x4d')]=[{'all':!![]}];}return db[_0x0ed1('0x39')]['findAll'](_0x36a125);})[_0x0ed1('0x1e')](function(_0x56ef6e){_0xe3616d['rows']=_0x56ef6e;return _0xe3616d;})['then'](respondWithFilteredResult(_0x1fb14d,_0x36a125))['catch'](handleError(_0x1fb14d,null));};exports[_0x0ed1('0x4e')]=function(_0x2732a9,_0xc8277e){var _0x2cc651={'raw':!![],'where':{'id':_0x2732a9[_0x0ed1('0x4f')]['id']}},_0x2a5439={};_0x2a5439[_0x0ed1('0x3d')]=_['keys'](db[_0x0ed1('0x39')][_0x0ed1('0x3a')]);_0x2a5439[_0x0ed1('0x3e')]=_['keys'](_0x2732a9['query']);_0x2a5439[_0x0ed1('0x40')]=_[_0x0ed1('0x41')](_0x2a5439['model'],_0x2a5439[_0x0ed1('0x3e')]);_0x2cc651[_0x0ed1('0x43')]=_['intersection'](_0x2a5439[_0x0ed1('0x3d')],qs[_0x0ed1('0x42')](_0x2732a9[_0x0ed1('0x3e')][_0x0ed1('0x42')]));_0x2cc651[_0x0ed1('0x43')]=_0x2cc651[_0x0ed1('0x43')][_0x0ed1('0x44')]?_0x2cc651[_0x0ed1('0x43')]:_0x2a5439[_0x0ed1('0x3d')];if(_0x2732a9['query'][_0x0ed1('0x4c')]){_0x2cc651[_0x0ed1('0x4d')]=[{'all':!![]}];}_0x2cc651=_['merge']({},_0x2cc651,_0x2732a9[_0x0ed1('0x50')]);return db[_0x0ed1('0x39')][_0x0ed1('0x51')](_0x2cc651)['then'](handleEntityNotFound(_0xc8277e,null))[_0x0ed1('0x1e')](respondWithResult(_0xc8277e,null))[_0x0ed1('0x28')](handleError(_0xc8277e,null));};exports[_0x0ed1('0x52')]=function(_0x57998,_0x3a26e4){return db['OpenchannelMessage'][_0x0ed1('0x52')](_0x57998[_0x0ed1('0x53')],{})['then'](respondWithResult(_0x3a26e4,0xc9))[_0x0ed1('0x28')](handleError(_0x3a26e4,null));};exports[_0x0ed1('0x33')]=function(_0x45b6f7,_0xd5070f){if(_0x45b6f7[_0x0ed1('0x53')]['id']){delete _0x45b6f7[_0x0ed1('0x53')]['id'];}return db[_0x0ed1('0x39')]['find']({'where':{'id':_0x45b6f7[_0x0ed1('0x4f')]['id']}})[_0x0ed1('0x1e')](handleEntityNotFound(_0xd5070f,null))['then'](saveUpdates(_0x45b6f7[_0x0ed1('0x53')],null))[_0x0ed1('0x1e')](respondWithResult(_0xd5070f,null))['catch'](handleError(_0xd5070f,null));};exports[_0x0ed1('0x54')]=function(_0x55caff,_0x56a7d8){return db[_0x0ed1('0x39')][_0x0ed1('0x51')]({'where':{'id':_0x55caff[_0x0ed1('0x4f')]['id']}})[_0x0ed1('0x1e')](handleEntityNotFound(_0x56a7d8,null))[_0x0ed1('0x1e')](removeEntity(_0x56a7d8,null))[_0x0ed1('0x28')](handleError(_0x56a7d8,null));};exports[_0x0ed1('0x55')]=function(_0x43c1b6,_0x77751f){return db[_0x0ed1('0x39')][_0x0ed1('0x55')]()['then'](respondWithResult(_0x77751f,null))[_0x0ed1('0x28')](handleError(_0x77751f,null));};var interaction_log=require('../../config/logger')(_0x0ed1('0x56'));exports[_0x0ed1('0x57')]=function(_0x511219,_0x53c135,_0x413142){var _0x449f73={'agent':{},'channel':_0x0ed1('0x58')};if(_0x511219['body']['id']){delete _0x511219[_0x0ed1('0x53')]['id'];}_0x511219[_0x0ed1('0x53')]['read']=!![];_0x511219['body'][_0x0ed1('0x59')]=moment()[_0x0ed1('0x5a')](_0x0ed1('0x5b'));_0x511219[_0x0ed1('0x53')]['UserId']=_0x511219[_0x0ed1('0x53')][_0x0ed1('0x5c')]||_0x511219[_0x0ed1('0x5d')]['id'];_0x449f73[_0x0ed1('0x5e')]['id']=_0x511219['body']['UserId'];return db[_0x0ed1('0x39')]['find']({'where':{'id':_0x511219[_0x0ed1('0x4f')]['id'],'UserId':null}})[_0x0ed1('0x1e')](handleEntityNotFound(_0x53c135,null))[_0x0ed1('0x1e')](saveUpdates(_0x511219[_0x0ed1('0x53')],null))['then'](function(_0x3d754c){if(_0x3d754c){_0x449f73[_0x0ed1('0x27')]=_0x3d754c[_0x0ed1('0x5f')]({'plain':!![]});return db[_0x0ed1('0x60')][_0x0ed1('0x51')]({'where':{'id':_0x3d754c[_0x0ed1('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x53c135,null))[_0x0ed1('0x1e')](function(_0x3b52d7){if(_0x3b52d7){return _0x3b52d7[_0x0ed1('0x33')]({'UserId':_0x511219[_0x0ed1('0x53')]['UserId'],'read1stAt':_[_0x0ed1('0x62')](_0x3b52d7[_0x0ed1('0x63')])?moment()[_0x0ed1('0x5a')](_0x0ed1('0x5b')):undefined});}return null;})[_0x0ed1('0x1e')](function(_0xbb3d64){if(_0xbb3d64){_0x449f73[_0x0ed1('0x64')]=_0xbb3d64[_0x0ed1('0x5f')]({'plain':!![]});interaction_log[_0x0ed1('0x1f')](_0x0ed1('0x65'),_0x511219[_0x0ed1('0x5d')]['id'],_0x511219[_0x0ed1('0x5d')]['name'],_0x511219[_0x0ed1('0x5d')][_0x0ed1('0x66')],_0x449f73[_0x0ed1('0x64')]['id'],_0x511219[_0x0ed1('0x53')]?JSON[_0x0ed1('0x24')](_0x511219[_0x0ed1('0x53')]):_0x0ed1('0x67'));return respondWithRpcPromise(_0x0ed1('0x68'),_0x0ed1('0x69'),_0x449f73);}return null;})['then'](function(_0x23c9e8){var _0x1f0791=_0x0ed1('0x6a')+_0x23c9e8[_0x0ed1('0x27')][_0x0ed1('0x6b')];return db['sequelize'][_0x0ed1('0x3e')](_0x1f0791,{'type':db[_0x0ed1('0x6c')][_0x0ed1('0x6d')][_0x0ed1('0x6e')],'raw':!![]})[_0x0ed1('0x1e')](function(_0x3345c2){return _0x3345c2;});})['then'](function(_0x272263){if(_0x272263){_0x449f73[_0x0ed1('0x27')][_0x0ed1('0x6f')]=_0x272263[0x0];if(!_0x511219[_0x0ed1('0x53')][_0x0ed1('0x5c')])return;return db[_0x0ed1('0x70')]['find']({'where':{'id':_0x511219[_0x0ed1('0x53')][_0x0ed1('0x5c')],'role':_0x0ed1('0x5e')},'attributes':['id',_0x0ed1('0x35'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x0ed1('0x1e')](function(_0x10a51a){if(!_0x10a51a)return null;_0x449f73['message'][_0x0ed1('0x5e')]=_0x10a51a;return _0x449f73;})[_0x0ed1('0x1e')](function(_0x2d6fc7){if(_0x2d6fc7){if(_0x511219[_0x0ed1('0x53')]['manual']){_0x449f73[_0x0ed1('0x27')]['interface']=util['format'](_0x0ed1('0x71'),_0x511219[_0x0ed1('0x5d')][_0x0ed1('0x35')]);_0x449f73['message']['channel']=_0x449f73[_0x0ed1('0x72')];_0x449f73[_0x0ed1('0x27')][_0x0ed1('0x73')]=_0x449f73[_0x0ed1('0x72')];_0x449f73[_0x0ed1('0x27')][_0x0ed1('0x74')]=_0x0ed1('0x57');return respondWithRpcPromise(_0x0ed1('0x75'),_0x0ed1('0x75'),{'event':_0x0ed1('0x76'),'message':_0x449f73[_0x0ed1('0x27')]},client9002)['then'](function(){return _0x449f73;});}return _0x449f73;}return null;})[_0x0ed1('0x1e')](respondWithResult(_0x53c135,null))[_0x0ed1('0x28')](handleError(_0x53c135,null));};var interaction_log=require(_0x0ed1('0x13'))(_0x0ed1('0x56'));exports['reject']=function(_0x4fb51e,_0x3acf6e,_0x5a4445){var _0x194449={'agent':{},'channel':_0x0ed1('0x58')};if(_0x4fb51e[_0x0ed1('0x53')]['id']){delete _0x4fb51e[_0x0ed1('0x53')]['id'];}_0x4fb51e[_0x0ed1('0x53')]['UserId']=_0x4fb51e['body'][_0x0ed1('0x5c')]||_0x4fb51e[_0x0ed1('0x5d')]['id'];_0x194449[_0x0ed1('0x5e')]['id']=_0x4fb51e[_0x0ed1('0x53')][_0x0ed1('0x5c')];return db[_0x0ed1('0x39')][_0x0ed1('0x51')]({'where':{'id':_0x4fb51e['params']['id'],'UserId':null}})[_0x0ed1('0x1e')](handleEntityNotFound(_0x3acf6e,null))['then'](function(_0x9e2974){if(_0x9e2974){_0x194449['message']=_0x9e2974['get']({'plain':!![]});return db[_0x0ed1('0x60')][_0x0ed1('0x51')]({'where':{'id':_0x9e2974[_0x0ed1('0x61')]}});}return null;})[_0x0ed1('0x1e')](handleEntityNotFound(_0x3acf6e,null))[_0x0ed1('0x1e')](function(_0x3aa67e){if(_0x3aa67e){_0x194449['interaction']=_0x3aa67e['get']({'plain':!![]});interaction_log['info'](_0x0ed1('0x77'),_0x4fb51e['user']['id'],_0x4fb51e['user'][_0x0ed1('0x35')],_0x4fb51e[_0x0ed1('0x5d')][_0x0ed1('0x66')],_0x194449[_0x0ed1('0x64')]['id'],_0x4fb51e[_0x0ed1('0x53')]?JSON['stringify'](_0x4fb51e['body']):_0x0ed1('0x67'));return respondWithRpcPromise(_0x0ed1('0x78'),'rejectMessage',_0x194449);}return null;})[_0x0ed1('0x1e')](function(_0x4ba5cd){var _0x3b27ef=_0x0ed1('0x6a')+_0x4ba5cd[_0x0ed1('0x27')][_0x0ed1('0x6b')];return db['sequelize']['query'](_0x3b27ef,{'type':db[_0x0ed1('0x6c')][_0x0ed1('0x6d')]['SELECT'],'raw':!![]})[_0x0ed1('0x1e')](function(_0x897a96){return _0x897a96;});})[_0x0ed1('0x1e')](function(_0x3794a8){if(_0x3794a8){_0x194449[_0x0ed1('0x27')]['contact']=_0x3794a8[0x0];if(!_0x4fb51e[_0x0ed1('0x53')][_0x0ed1('0x5c')])return;return db[_0x0ed1('0x70')]['find']({'where':{'id':_0x4fb51e['body'][_0x0ed1('0x5c')],'role':'agent'},'attributes':['id',_0x0ed1('0x35'),_0x0ed1('0x79'),_0x0ed1('0x7a'),_0x0ed1('0x7b')],'raw':!![]});}return null;})[_0x0ed1('0x1e')](function(_0x3cf4a7){if(!_0x3cf4a7)return null;_0x194449[_0x0ed1('0x27')]['agent']=_0x3cf4a7;return _0x194449;})['then'](function(_0x3d3fd8){if(_0x3d3fd8){_0x3d3fd8[_0x0ed1('0x27')]['interface']=util[_0x0ed1('0x5a')](_0x0ed1('0x71'),_0x4fb51e[_0x0ed1('0x5d')]['name']);_0x3d3fd8['message'][_0x0ed1('0x72')]=_0x194449[_0x0ed1('0x72')];_0x3d3fd8[_0x0ed1('0x27')][_0x0ed1('0x73')]=_0x194449[_0x0ed1('0x72')];_0x3d3fd8[_0x0ed1('0x27')][_0x0ed1('0x74')]='reject';respondWithRpcPromise(_0x0ed1('0x75'),_0x0ed1('0x75'),{'event':_0x0ed1('0x7c'),'message':_0x3d3fd8['message']},client9002);return _0x194449;}return null;})[_0x0ed1('0x1e')](respondWithResult(_0x3acf6e,null))[_0x0ed1('0x28')](handleError(_0x3acf6e,null));}; \ No newline at end of file +var _0xc1ea=['pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteractionId','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','Sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2da696,_0x249f8a){var _0x429255=function(_0x31ffc7){while(--_0x31ffc7){_0x2da696['push'](_0x2da696['shift']());}};_0x429255(++_0x249f8a);}(_0xc1ea,0x13d));var _0xac1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc1ea[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xac1e('0x0'));var rimraf=require(_0xac1e('0x1'));var zipdir=require(_0xac1e('0x2'));var jsonpatch=require(_0xac1e('0x3'));var rp=require(_0xac1e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac1e('0x5'));var path=require(_0xac1e('0x6'));var sox=require(_0xac1e('0x7'));var csv=require(_0xac1e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac1e('0x9'));var _=require(_0xac1e('0xa'));var squel=require('squel');var crypto=require(_0xac1e('0xb'));var jsforce=require(_0xac1e('0xc'));var deskjs=require(_0xac1e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac1e('0xe'));var authService=require(_0xac1e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xac1e('0x10'));var hardwareService=require(_0xac1e('0x11'));var logger=require(_0xac1e('0x12'))(_0xac1e('0x13'));var utils=require(_0xac1e('0x14'));var config=require(_0xac1e('0x15'));var licenseUtil=require(_0xac1e('0x16'));var db=require(_0xac1e('0x17'))['db'];config[_0xac1e('0x18')]=_['defaults'](config[_0xac1e('0x18')],{'host':_0xac1e('0x19'),'port':0x18eb});var socket=require(_0xac1e('0x1a'))(new Redis(config[_0xac1e('0x18')]));require(_0xac1e('0x1b'))[_0xac1e('0x1c')](socket);var jayson=require(_0xac1e('0x1d'));var client=jayson[_0xac1e('0x1e')][_0xac1e('0x1f')]({'port':0x232c});var client9002=jayson[_0xac1e('0x1e')][_0xac1e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xe46cd1,_0x59bcc8,_0x2340b4,_0x3a0606){return new BPromise(function(_0x227ca7,_0x4f581f){var _0x2dc274=_0x3a0606||client;return _0x2dc274['request'](_0xe46cd1,_0x2340b4)[_0xac1e('0x20')](function(_0x5f17dc){logger[_0xac1e('0x21')](_0xac1e('0x22'),_0x59bcc8,'request\x20sent');logger[_0xac1e('0x23')](_0xac1e('0x24'),_0x59bcc8,_0xac1e('0x25'),JSON[_0xac1e('0x26')](_0x5f17dc));if(_0x5f17dc[_0xac1e('0x27')]){if(_0x5f17dc[_0xac1e('0x27')][_0xac1e('0x28')]===0x1f4){logger[_0xac1e('0x27')](_0xac1e('0x22'),_0x59bcc8,_0x5f17dc[_0xac1e('0x27')][_0xac1e('0x29')]);return _0x4f581f(_0x5f17dc['error'][_0xac1e('0x29')]);}logger[_0xac1e('0x27')](_0xac1e('0x22'),_0x59bcc8,_0x5f17dc[_0xac1e('0x27')][_0xac1e('0x29')]);return _0x227ca7(_0x5f17dc[_0xac1e('0x27')][_0xac1e('0x29')]);}else{logger['info'](_0xac1e('0x22'),_0x59bcc8,'request\x20sent');_0x227ca7(_0x5f17dc[_0xac1e('0x2a')][_0xac1e('0x29')]);}})[_0xac1e('0x2b')](function(_0x336317){logger[_0xac1e('0x27')](_0xac1e('0x22'),_0x59bcc8,_0x336317);_0x4f581f(_0x336317);});});}function respondWithStatusCode(_0x58b44e,_0x489e49){_0x489e49=_0x489e49||0xcc;return function(_0x4a7f35){if(_0x4a7f35){return _0x58b44e[_0xac1e('0x2c')](_0x489e49);}return _0x58b44e[_0xac1e('0x2d')](_0x489e49)[_0xac1e('0x2e')]();};}function respondWithResult(_0xba747d,_0x2c4cec){_0x2c4cec=_0x2c4cec||0xc8;return function(_0x412e2e){if(_0x412e2e){return _0xba747d[_0xac1e('0x2d')](_0x2c4cec)['json'](_0x412e2e);}};}function respondWithFilteredResult(_0x5247b0,_0x442c10){return function(_0x4d48b3){if(_0x4d48b3){var _0x61c90e=typeof _0x442c10[_0xac1e('0x2f')]===_0xac1e('0x30')&&typeof _0x442c10[_0xac1e('0x31')]===_0xac1e('0x30');var _0x4d7f82=_0x4d48b3[_0xac1e('0x32')];var _0x54026f=_0x61c90e?0x0:_0x442c10[_0xac1e('0x2f')];var _0x470e28=_0x61c90e?_0x4d48b3[_0xac1e('0x32')]:_0x442c10[_0xac1e('0x2f')]+_0x442c10[_0xac1e('0x31')];var _0x395755;if(_0x470e28>=_0x4d7f82){_0x470e28=_0x4d7f82;_0x395755=0xc8;}else{_0x395755=0xce;}_0x5247b0['status'](_0x395755);return _0x5247b0[_0xac1e('0x33')](_0xac1e('0x34'),_0x54026f+'-'+_0x470e28+'/'+_0x4d7f82)[_0xac1e('0x35')](_0x4d48b3);}return null;};}function patchUpdates(_0x47d287){return function(_0x471522){try{jsonpatch[_0xac1e('0x36')](_0x471522,_0x47d287,!![]);}catch(_0x1584a7){return BPromise[_0xac1e('0x37')](_0x1584a7);}return _0x471522[_0xac1e('0x38')]();};}function saveUpdates(_0x41b51b,_0x454784){return function(_0x535903){if(_0x535903){return _0x535903[_0xac1e('0x39')](_0x41b51b)[_0xac1e('0x20')](function(_0x155d15){return _0x155d15;});}return null;};}function removeEntity(_0x204ec2,_0x5cf97e){return function(_0x479868){if(_0x479868){return _0x479868[_0xac1e('0x3a')]()[_0xac1e('0x20')](function(){_0x204ec2[_0xac1e('0x2d')](0xcc)[_0xac1e('0x2e')]();});}};}function handleEntityNotFound(_0x13a845,_0x3a2a6c){return function(_0x1c83cb){if(!_0x1c83cb){_0x13a845[_0xac1e('0x2c')](0x194);}return _0x1c83cb;};}function handleError(_0x37d6ee,_0x587830){_0x587830=_0x587830||0x1f4;return function(_0x42be65){logger[_0xac1e('0x27')](_0x42be65[_0xac1e('0x3b')]);if(_0x42be65['name']){delete _0x42be65[_0xac1e('0x3c')];}_0x37d6ee['status'](_0x587830)[_0xac1e('0x3d')](_0x42be65);};}exports[_0xac1e('0x3e')]=function(_0x352b7d,_0x1d7055){var _0x26e74f={},_0x497c3c={},_0x4bc9af={'count':0x0,'rows':[]};var _0x71b372=_[_0xac1e('0x3f')](db[_0xac1e('0x40')][_0xac1e('0x41')],function(_0x56a662){return{'name':_0x56a662[_0xac1e('0x42')],'type':_0x56a662[_0xac1e('0x43')][_0xac1e('0x44')]};});_0x497c3c['model']=_[_0xac1e('0x3f')](_0x71b372,'name');_0x497c3c[_0xac1e('0x45')]=_[_0xac1e('0x46')](_0x352b7d[_0xac1e('0x45')]);_0x497c3c[_0xac1e('0x47')]=_[_0xac1e('0x48')](_0x497c3c['model'],_0x497c3c[_0xac1e('0x45')]);_0x26e74f['attributes']=_[_0xac1e('0x48')](_0x497c3c[_0xac1e('0x49')],qs['fields'](_0x352b7d[_0xac1e('0x45')][_0xac1e('0x4a')]));_0x26e74f['attributes']=_0x26e74f[_0xac1e('0x4b')][_0xac1e('0x4c')]?_0x26e74f['attributes']:_0x497c3c[_0xac1e('0x49')];if(!_0x352b7d[_0xac1e('0x45')][_0xac1e('0x4d')](_0xac1e('0x4e'))){_0x26e74f[_0xac1e('0x31')]=qs[_0xac1e('0x31')](_0x352b7d[_0xac1e('0x45')][_0xac1e('0x31')]);_0x26e74f[_0xac1e('0x2f')]=qs[_0xac1e('0x2f')](_0x352b7d['query']['offset']);}_0x26e74f[_0xac1e('0x4f')]=qs['sort'](_0x352b7d[_0xac1e('0x45')][_0xac1e('0x50')]);_0x26e74f[_0xac1e('0x51')]=qs[_0xac1e('0x47')](_[_0xac1e('0x52')](_0x352b7d[_0xac1e('0x45')],_0x497c3c[_0xac1e('0x47')]),_0x71b372);if(_0x352b7d[_0xac1e('0x45')]['filter']){_0x26e74f[_0xac1e('0x51')]=_[_0xac1e('0x53')](_0x26e74f[_0xac1e('0x51')],{'$or':_[_0xac1e('0x3f')](_0x71b372,function(_0x290ccb){if(_0x290ccb[_0xac1e('0x43')]!==_0xac1e('0x54')){var _0x3e323b={};_0x3e323b[_0x290ccb[_0xac1e('0x3c')]]={'$like':'%'+_0x352b7d['query']['filter']+'%'};return _0x3e323b;}})});}_0x26e74f=_['merge']({},_0x26e74f,_0x352b7d[_0xac1e('0x55')]);var _0x4b8f50={'where':_0x26e74f['where']};return db[_0xac1e('0x40')][_0xac1e('0x32')](_0x4b8f50)[_0xac1e('0x20')](function(_0x1c2a58){_0x4bc9af[_0xac1e('0x32')]=_0x1c2a58;if(_0x352b7d[_0xac1e('0x45')][_0xac1e('0x56')]){_0x26e74f[_0xac1e('0x57')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xac1e('0x58')](_0x26e74f);})[_0xac1e('0x20')](function(_0x278eff){_0x4bc9af[_0xac1e('0x59')]=_0x278eff;return _0x4bc9af;})[_0xac1e('0x20')](respondWithFilteredResult(_0x1d7055,_0x26e74f))[_0xac1e('0x2b')](handleError(_0x1d7055,null));};exports[_0xac1e('0x5a')]=function(_0x3891b1,_0x284bcd){var _0x2d3503={'raw':!![],'where':{'id':_0x3891b1['params']['id']}},_0x13ef91={};_0x13ef91[_0xac1e('0x49')]=_[_0xac1e('0x46')](db[_0xac1e('0x40')][_0xac1e('0x41')]);_0x13ef91['query']=_[_0xac1e('0x46')](_0x3891b1['query']);_0x13ef91[_0xac1e('0x47')]=_[_0xac1e('0x48')](_0x13ef91[_0xac1e('0x49')],_0x13ef91[_0xac1e('0x45')]);_0x2d3503[_0xac1e('0x4b')]=_['intersection'](_0x13ef91['model'],qs[_0xac1e('0x4a')](_0x3891b1['query'][_0xac1e('0x4a')]));_0x2d3503[_0xac1e('0x4b')]=_0x2d3503[_0xac1e('0x4b')][_0xac1e('0x4c')]?_0x2d3503['attributes']:_0x13ef91[_0xac1e('0x49')];if(_0x3891b1[_0xac1e('0x45')]['includeAll']){_0x2d3503['include']=[{'all':!![]}];}_0x2d3503=_['merge']({},_0x2d3503,_0x3891b1['options']);return db[_0xac1e('0x40')][_0xac1e('0x5b')](_0x2d3503)[_0xac1e('0x20')](handleEntityNotFound(_0x284bcd,null))[_0xac1e('0x20')](respondWithResult(_0x284bcd,null))[_0xac1e('0x2b')](handleError(_0x284bcd,null));};exports['create']=function(_0xec3e9,_0x1aefe2){return db['OpenchannelMessage'][_0xac1e('0x5c')](_0xec3e9['body'],{})['then'](respondWithResult(_0x1aefe2,0xc9))[_0xac1e('0x2b')](handleError(_0x1aefe2,null));};exports[_0xac1e('0x39')]=function(_0x18a6d6,_0x6c2675){if(_0x18a6d6[_0xac1e('0x5d')]['id']){delete _0x18a6d6[_0xac1e('0x5d')]['id'];}return db['OpenchannelMessage'][_0xac1e('0x5b')]({'where':{'id':_0x18a6d6[_0xac1e('0x5e')]['id']}})[_0xac1e('0x20')](handleEntityNotFound(_0x6c2675,null))[_0xac1e('0x20')](saveUpdates(_0x18a6d6[_0xac1e('0x5d')],null))['then'](respondWithResult(_0x6c2675,null))[_0xac1e('0x2b')](handleError(_0x6c2675,null));};exports[_0xac1e('0x3a')]=function(_0x1e3a51,_0x1c8d43){return db['OpenchannelMessage']['find']({'where':{'id':_0x1e3a51[_0xac1e('0x5e')]['id']}})[_0xac1e('0x20')](handleEntityNotFound(_0x1c8d43,null))[_0xac1e('0x20')](removeEntity(_0x1c8d43,null))['catch'](handleError(_0x1c8d43,null));};exports['describe']=function(_0x13b6ef,_0x738648){return db[_0xac1e('0x40')][_0xac1e('0x5f')]()[_0xac1e('0x20')](respondWithResult(_0x738648,null))[_0xac1e('0x2b')](handleError(_0x738648,null));};var interaction_log=require(_0xac1e('0x12'))(_0xac1e('0x60'));exports[_0xac1e('0x61')]=function(_0x51173c,_0x382150,_0x199478){var _0x5c508f={'agent':{},'channel':_0xac1e('0x62')};if(_0x51173c[_0xac1e('0x5d')]['id']){delete _0x51173c[_0xac1e('0x5d')]['id'];}_0x51173c[_0xac1e('0x5d')][_0xac1e('0x63')]=!![];_0x51173c['body'][_0xac1e('0x64')]=moment()[_0xac1e('0x65')](_0xac1e('0x66'));_0x51173c['body'][_0xac1e('0x67')]=_0x51173c[_0xac1e('0x5d')][_0xac1e('0x67')]||_0x51173c['user']['id'];_0x5c508f[_0xac1e('0x68')]['id']=_0x51173c['body'][_0xac1e('0x67')];return db['OpenchannelMessage'][_0xac1e('0x5b')]({'where':{'id':_0x51173c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x382150,null))[_0xac1e('0x20')](saveUpdates(_0x51173c['body'],null))[_0xac1e('0x20')](function(_0x2fb7d5){if(_0x2fb7d5){_0x5c508f['message']=_0x2fb7d5[_0xac1e('0x69')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2fb7d5[_0xac1e('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x382150,null))[_0xac1e('0x20')](function(_0x5bb16c){if(_0x5bb16c){return _0x5bb16c[_0xac1e('0x39')]({'UserId':_0x51173c[_0xac1e('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x5bb16c[_0xac1e('0x6b')])?moment()['format'](_0xac1e('0x66')):undefined});}return null;})[_0xac1e('0x20')](function(_0x1001df){if(_0x1001df){_0x5c508f['interaction']=_0x1001df['get']({'plain':!![]});interaction_log['info'](_0xac1e('0x6c'),_0x51173c[_0xac1e('0x6d')]['id'],_0x51173c[_0xac1e('0x6d')][_0xac1e('0x3c')],_0x51173c[_0xac1e('0x6d')][_0xac1e('0x6e')],_0x5c508f[_0xac1e('0x6f')]['id'],_0x51173c[_0xac1e('0x5d')]?JSON[_0xac1e('0x26')](_0x51173c[_0xac1e('0x5d')]):_0xac1e('0x70'));return respondWithRpcPromise(_0xac1e('0x71'),'acceptMessage',_0x5c508f);}return null;})[_0xac1e('0x20')](function(_0x589d4d){var _0x246d6f=_0xac1e('0x72')+_0x589d4d[_0xac1e('0x29')][_0xac1e('0x73')];return db[_0xac1e('0x74')][_0xac1e('0x45')](_0x246d6f,{'type':db['Sequelize'][_0xac1e('0x75')][_0xac1e('0x76')],'raw':!![]})[_0xac1e('0x20')](function(_0x5b53ec){return _0x5b53ec;});})[_0xac1e('0x20')](function(_0x2c28d9){if(_0x2c28d9){_0x5c508f['message'][_0xac1e('0x77')]=_0x2c28d9[0x0];if(!_0x51173c[_0xac1e('0x5d')][_0xac1e('0x67')])return;return db[_0xac1e('0x78')][_0xac1e('0x5b')]({'where':{'id':_0x51173c['body'][_0xac1e('0x67')],'role':_0xac1e('0x68')},'attributes':['id','name',_0xac1e('0x79'),_0xac1e('0x7a'),_0xac1e('0x7b')],'raw':!![]});}return null;})[_0xac1e('0x20')](function(_0x2464ac){if(!_0x2464ac)return null;_0x5c508f[_0xac1e('0x29')]['agent']=_0x2464ac;return _0x5c508f;})[_0xac1e('0x20')](function(_0xe97dd9){if(_0xe97dd9){if(_0x51173c[_0xac1e('0x5d')]['manual']){_0x5c508f[_0xac1e('0x29')][_0xac1e('0x7c')]=util[_0xac1e('0x65')](_0xac1e('0x7d'),_0x51173c[_0xac1e('0x6d')][_0xac1e('0x3c')]);_0x5c508f[_0xac1e('0x29')][_0xac1e('0x7e')]=_0x5c508f[_0xac1e('0x7e')];_0x5c508f[_0xac1e('0x29')][_0xac1e('0x7f')]=_0x5c508f['channel'];_0x5c508f['message'][_0xac1e('0x80')]=_0xac1e('0x61');return respondWithRpcPromise(_0xac1e('0x81'),_0xac1e('0x81'),{'event':_0xac1e('0x82'),'message':_0x5c508f[_0xac1e('0x29')]},client9002)['then'](function(){return _0x5c508f;});}return _0x5c508f;}return null;})[_0xac1e('0x20')](respondWithResult(_0x382150,null))[_0xac1e('0x2b')](handleError(_0x382150,null));};var interaction_log=require('../../config/logger')(_0xac1e('0x60'));exports['reject']=function(_0x319f4e,_0x31441f,_0x3fc07d){var _0x248f98={'agent':{},'channel':_0xac1e('0x62')};if(_0x319f4e[_0xac1e('0x5d')]['id']){delete _0x319f4e['body']['id'];}_0x319f4e['body'][_0xac1e('0x67')]=_0x319f4e['body'][_0xac1e('0x67')]||_0x319f4e[_0xac1e('0x6d')]['id'];_0x248f98['agent']['id']=_0x319f4e['body'][_0xac1e('0x67')];return db['OpenchannelMessage']['find']({'where':{'id':_0x319f4e['params']['id'],'UserId':null}})[_0xac1e('0x20')](handleEntityNotFound(_0x31441f,null))[_0xac1e('0x20')](function(_0x474869){if(_0x474869){_0x248f98[_0xac1e('0x29')]=_0x474869[_0xac1e('0x69')]({'plain':!![]});return db[_0xac1e('0x83')]['find']({'where':{'id':_0x474869[_0xac1e('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x31441f,null))[_0xac1e('0x20')](function(_0x3a6a35){if(_0x3a6a35){_0x248f98[_0xac1e('0x6f')]=_0x3a6a35[_0xac1e('0x69')]({'plain':!![]});interaction_log[_0xac1e('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x319f4e[_0xac1e('0x6d')]['id'],_0x319f4e['user']['name'],_0x319f4e['user'][_0xac1e('0x6e')],_0x248f98[_0xac1e('0x6f')]['id'],_0x319f4e[_0xac1e('0x5d')]?JSON[_0xac1e('0x26')](_0x319f4e['body']):_0xac1e('0x70'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x248f98);}return null;})[_0xac1e('0x20')](function(_0x4909c4){var _0x31133f=_0xac1e('0x72')+_0x4909c4[_0xac1e('0x29')][_0xac1e('0x73')];return db['sequelize'][_0xac1e('0x45')](_0x31133f,{'type':db[_0xac1e('0x84')][_0xac1e('0x75')][_0xac1e('0x76')],'raw':!![]})[_0xac1e('0x20')](function(_0x12ab6){return _0x12ab6;});})[_0xac1e('0x20')](function(_0x51dc39){if(_0x51dc39){_0x248f98[_0xac1e('0x29')]['contact']=_0x51dc39[0x0];if(!_0x319f4e[_0xac1e('0x5d')][_0xac1e('0x67')])return;return db[_0xac1e('0x78')][_0xac1e('0x5b')]({'where':{'id':_0x319f4e[_0xac1e('0x5d')]['UserId'],'role':'agent'},'attributes':['id',_0xac1e('0x3c'),_0xac1e('0x79'),_0xac1e('0x7a'),_0xac1e('0x7b')],'raw':!![]});}return null;})[_0xac1e('0x20')](function(_0x43584d){if(!_0x43584d)return null;_0x248f98['message'][_0xac1e('0x68')]=_0x43584d;return _0x248f98;})[_0xac1e('0x20')](function(_0x33576e){if(_0x33576e){_0x33576e[_0xac1e('0x29')]['interface']=util[_0xac1e('0x65')](_0xac1e('0x7d'),_0x319f4e[_0xac1e('0x6d')][_0xac1e('0x3c')]);_0x33576e['message']['channel']=_0x248f98[_0xac1e('0x7e')];_0x33576e[_0xac1e('0x29')][_0xac1e('0x7f')]=_0x248f98[_0xac1e('0x7e')];_0x33576e[_0xac1e('0x29')][_0xac1e('0x80')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x33576e[_0xac1e('0x29')]},client9002);return _0x248f98;}return null;})[_0xac1e('0x20')](respondWithResult(_0x31441f,null))['catch'](handleError(_0x31441f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 91850c7..fc660da 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 _0xba86=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x593b63,_0x5cf45e){var _0x4811fe=function(_0x54de26){while(--_0x54de26){_0x593b63['push'](_0x593b63['shift']());}};_0x4811fe(++_0x5cf45e);}(_0xba86,0x1b8));var _0x6ba8=function(_0x46da41,_0x3ae289){_0x46da41=_0x46da41-0x0;var _0x121015=_0xba86[_0x46da41];return _0x121015;};'use strict';var EventEmitter=require(_0x6ba8('0x0'));var OpenchannelMessage=require(_0x6ba8('0x1'))['db'][_0x6ba8('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6ba8('0x3')](0x0);var events={'afterCreate':_0x6ba8('0x4'),'afterUpdate':_0x6ba8('0x5'),'afterDestroy':_0x6ba8('0x6')};function emitEvent(_0x3fc222){return function(_0x129d99,_0xb29b9d,_0x5bf621){OpenchannelMessageEvents[_0x6ba8('0x7')](_0x3fc222+':'+_0x129d99['id'],_0x129d99);OpenchannelMessageEvents[_0x6ba8('0x7')](_0x3fc222,_0x129d99);_0x5bf621(null);};}for(var e in events){if(events[_0x6ba8('0x8')](e)){var event=events[e];OpenchannelMessage[_0x6ba8('0x9')](e,emitEvent(event));}}module[_0x6ba8('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xb497=['update','remove','emit','exports','events','setMaxListeners','save'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xb497,0x13f));var _0x7b49=function(_0x148539,_0xc81bd9){_0x148539=_0x148539-0x0;var _0x59fbd9=_0xb497[_0x148539];return _0x59fbd9;};'use strict';var EventEmitter=require(_0x7b49('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7b49('0x1')](0x0);var events={'afterCreate':_0x7b49('0x2'),'afterUpdate':_0x7b49('0x3'),'afterDestroy':_0x7b49('0x4')};function emitEvent(_0xb5d658){return function(_0x4525b6,_0x13d61c,_0x3c66dd){OpenchannelMessageEvents[_0x7b49('0x5')](_0xb5d658+':'+_0x4525b6['id'],_0x4525b6);OpenchannelMessageEvents[_0x7b49('0x5')](_0xb5d658,_0x4525b6);_0x3c66dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x7b49('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c66cff6..8fd0d13 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 _0x50f6=['find','Interactions','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','method','GET','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','finally','util','../../config/logger','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount'];(function(_0x48079c,_0x143fe7){var _0x429b8f=function(_0x1aef29){while(--_0x1aef29){_0x48079c['push'](_0x48079c['shift']());}};_0x429b8f(++_0x143fe7);}(_0x50f6,0x1ac));var _0x650f=function(_0x39a621,_0xc278b4){_0x39a621=_0x39a621-0x0;var _0x470c4a=_0x50f6[_0x39a621];return _0x470c4a;};'use strict';var _=require('lodash');var util=require(_0x650f('0x0'));var logger=require(_0x650f('0x1'))('api');var moment=require(_0x650f('0x2'));var BPromise=require('bluebird');var rp=require(_0x650f('0x3'));var fs=require('fs');var path=require(_0x650f('0x4'));var rimraf=require('rimraf');var config=require(_0x650f('0x5'));var attributes=require(_0x650f('0x6'));module[_0x650f('0x7')]=function(_0x18e62c,_0x7512ae){return _0x18e62c[_0x650f('0x8')](_0x650f('0x9'),attributes,{'tableName':_0x650f('0xa'),'paranoid':![],'indexes':[{'name':_0x650f('0xb'),'fields':[_0x650f('0xc')],'type':_0x650f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x25c981,_0x5d42ac,_0x227a20){var _0x5d3e26=_0x18e62c[_0x650f('0xe')];var _0x140358=_0x25c981[_0x650f('0xf')]({'plain':!![]});if(_0x140358[_0x650f('0x10')]['toLowerCase']()==='in'||_0x140358['direction'][_0x650f('0x11')]()===_0x650f('0x12')&&!_0x140358[_0x650f('0x13')]&&!_[_0x650f('0x14')](_0x140358['UserId'])){_0x5d3e26[_0x650f('0x15')][_0x650f('0x16')]({'where':{'id':_0x140358[_0x650f('0x17')]}})[_0x650f('0x18')](function(_0x471057){if(_0x471057){_0x471057['update']({'lastMsgAt':_0x140358[_0x650f('0x19')],'lastMsgDirection':_0x140358[_0x650f('0x10')][_0x650f('0x11')]()});}})[_0x650f('0x1a')](function(_0x12323a){console[_0x650f('0x1b')](_0x12323a);});}if(_0x140358[_0x650f('0x10')]===_0x650f('0x12')&&!_0x140358[_0x650f('0x13')]){var _0x51f9e9;_0x5d3e26[_0x650f('0x1c')][_0x650f('0x1d')]()[_0x650f('0x18')](function(_0x1110cd){return _0x5d3e26[_0x650f('0x1e')][_0x650f('0x1f')]({'where':{'id':_0x140358['OpenchannelAccountId']},'include':[{'model':_0x5d3e26[_0x650f('0x15')],'as':_0x650f('0x20'),'where':{'id':_0x140358[_0x650f('0x17')]},'limit':0x1,'include':[{'model':_0x5d3e26[_0x650f('0x1c')],'as':_0x650f('0x21'),'attributes':_[_0x650f('0x22')](_0x1110cd)}]}]});})[_0x650f('0x18')](function(_0x411982){_0x51f9e9=_0x411982['get']({'plain':!![]});if(_0x51f9e9&&_0x51f9e9['replyUri']){logger['info'](_0x650f('0x23'),_0x650f('0x24'),util['format'](_0x650f('0x25'),_0x140358['id'],_0x51f9e9[_0x650f('0x26')]));if(_0x51f9e9['Interactions']&&_0x51f9e9[_0x650f('0x20')][_0x650f('0x27')]){_0x140358['Interaction']=_[_0x650f('0x28')](_0x51f9e9[_0x650f('0x20')][0x0],_0x650f('0x21'));_0x140358['Contact']=_0x51f9e9[_0x650f('0x20')][0x0][_0x650f('0x21')];}var _0x5d42ac={'method':_0x650f('0x29'),'uri':encodeURI(_0x51f9e9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d42ac[_0x650f('0x2a')]){case _0x650f('0x2b'):_0x5d42ac['qs']=_0x140358;break;case _0x650f('0x29'):_0x5d42ac[_0x650f('0xc')]=_0x140358;break;}return rp(_0x5d42ac)['then'](function(_0x4a7cf4){logger[_0x650f('0x2c')](_0x650f('0x23'),_0x650f('0x24'),util[_0x650f('0x2d')](_0x650f('0x2e'),_0x140358['id'],_0x51f9e9[_0x650f('0x26')]));if(_0x4a7cf4[_0x650f('0xc')][_0x650f('0x2f')]&&_0x4a7cf4[_0x650f('0xc')]['threadId']!=_0x140358[_0x650f('0x30')]['threadId']){return _0x5d3e26[_0x650f('0x15')][_0x650f('0x31')]({'threadId':_0x4a7cf4['body']['threadId']},{'where':{'id':_0x140358[_0x650f('0x30')]['id']}});}else{return;}})[_0x650f('0x18')](function(){return _0x25c981['update']({'read':!![]});})[_0x650f('0x1a')](function(_0x278aa8){logger[_0x650f('0x1b')](_0x650f('0x23'),_0x650f('0x24'),util['inspect'](_0x278aa8,{'showHidden':![],'depth':null}));_0x227a20();});}else{_0x227a20();}})[_0x650f('0x32')](function(){_0x227a20();});}else{_0x227a20();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x97a9=['OpenchannelAccountId','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Contact','POST','method','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount'];(function(_0x6620ce,_0xbf690){var _0x31c9c7=function(_0x2bfa3e){while(--_0x2bfa3e){_0x6620ce['push'](_0x6620ce['shift']());}};_0x31c9c7(++_0xbf690);}(_0x97a9,0x18b));var _0x997a=function(_0x3c26bf,_0x2d90dd){_0x3c26bf=_0x3c26bf-0x0;var _0xe5a883=_0x97a9[_0x3c26bf];return _0xe5a883;};'use strict';var _=require('lodash');var util=require(_0x997a('0x0'));var logger=require('../../config/logger')(_0x997a('0x1'));var moment=require(_0x997a('0x2'));var BPromise=require('bluebird');var rp=require(_0x997a('0x3'));var fs=require('fs');var path=require(_0x997a('0x4'));var rimraf=require(_0x997a('0x5'));var config=require('../../config/environment');var attributes=require(_0x997a('0x6'));module[_0x997a('0x7')]=function(_0x421324,_0x29a1dd){return _0x421324[_0x997a('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x997a('0x9'),'paranoid':![],'indexes':[{'name':_0x997a('0xa'),'fields':[_0x997a('0xb')],'type':_0x997a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x522a1d,_0x4572ef,_0x2f411a){var _0x37a3a6=_0x421324[_0x997a('0xd')];var _0x590b0e=_0x522a1d['get']({'plain':!![]});if(_0x590b0e[_0x997a('0xe')][_0x997a('0xf')]()==='in'||_0x590b0e[_0x997a('0xe')][_0x997a('0xf')]()===_0x997a('0x10')&&!_0x590b0e[_0x997a('0x11')]&&!_['isNil'](_0x590b0e[_0x997a('0x12')])){_0x37a3a6[_0x997a('0x13')]['findOne']({'where':{'id':_0x590b0e[_0x997a('0x14')]}})[_0x997a('0x15')](function(_0x2f9352){if(_0x2f9352){_0x2f9352[_0x997a('0x16')]({'lastMsgAt':_0x590b0e[_0x997a('0x17')],'lastMsgDirection':_0x590b0e[_0x997a('0xe')]['toLowerCase']()});}})[_0x997a('0x18')](function(_0xfeb9dc){console[_0x997a('0x19')](_0xfeb9dc);});}if(_0x590b0e[_0x997a('0xe')]===_0x997a('0x10')&&!_0x590b0e['secret']){var _0x3c3a19;_0x37a3a6[_0x997a('0x1a')]['describe']()[_0x997a('0x15')](function(_0x27e7c0){return _0x37a3a6[_0x997a('0x1b')]['find']({'where':{'id':_0x590b0e[_0x997a('0x1c')]},'include':[{'model':_0x37a3a6[_0x997a('0x13')],'as':_0x997a('0x1d'),'where':{'id':_0x590b0e[_0x997a('0x14')]},'limit':0x1,'include':[{'model':_0x37a3a6[_0x997a('0x1a')],'as':'Contact','attributes':_[_0x997a('0x1e')](_0x27e7c0)}]}]});})[_0x997a('0x15')](function(_0x5571e8){_0x3c3a19=_0x5571e8['get']({'plain':!![]});if(_0x3c3a19&&_0x3c3a19[_0x997a('0x1f')]){logger['info'](_0x997a('0x20'),_0x997a('0x21'),util[_0x997a('0x22')](_0x997a('0x23'),_0x590b0e['id'],_0x3c3a19['replyUri']));if(_0x3c3a19[_0x997a('0x1d')]&&_0x3c3a19[_0x997a('0x1d')]['length']){_0x590b0e['Interaction']=_['omit'](_0x3c3a19[_0x997a('0x1d')][0x0],_0x997a('0x24'));_0x590b0e['Contact']=_0x3c3a19[_0x997a('0x1d')][0x0][_0x997a('0x24')];}var _0x4572ef={'method':_0x997a('0x25'),'uri':encodeURI(_0x3c3a19[_0x997a('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4572ef[_0x997a('0x26')]){case'GET':_0x4572ef['qs']=_0x590b0e;break;case'POST':_0x4572ef[_0x997a('0xb')]=_0x590b0e;break;}return rp(_0x4572ef)['then'](function(_0x5bafdb){logger[_0x997a('0x27')](_0x997a('0x20'),_0x997a('0x21'),util[_0x997a('0x22')](_0x997a('0x28'),_0x590b0e['id'],_0x3c3a19[_0x997a('0x1f')]));if(_0x5bafdb[_0x997a('0xb')]['threadId']&&_0x5bafdb[_0x997a('0xb')][_0x997a('0x29')]!=_0x590b0e[_0x997a('0x2a')][_0x997a('0x29')]){return _0x37a3a6['OpenchannelInteraction'][_0x997a('0x16')]({'threadId':_0x5bafdb['body'][_0x997a('0x29')]},{'where':{'id':_0x590b0e[_0x997a('0x2a')]['id']}});}else{return;}})[_0x997a('0x15')](function(){return _0x522a1d[_0x997a('0x16')]({'read':!![]});})[_0x997a('0x18')](function(_0x4ba12c){logger[_0x997a('0x19')](_0x997a('0x20'),_0x997a('0x21'),util[_0x997a('0x2b')](_0x4ba12c,{'showHidden':![],'depth':null}));_0x2f411a();});}else{_0x2f411a();}})[_0x997a('0x2c')](function(){_0x2f411a();});}else{_0x2f411a();}}},'charset':_0x997a('0x2d'),'collate':_0x997a('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0aa38a0..510ca0d 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x13e243,_0x1487f2){var _0x1859a6=function(_0x1ad710){while(--_0x1ad710){_0x13e243['push'](_0x13e243['shift']());}};_0x1859a6(++_0x1487f2);}(_0x1261,0x144));var _0x1126=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x1261[_0x360739];return _0x3e23a1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x36e4da,_0x2fe25e){var _0xe4dd80=function(_0x2f4342){while(--_0x2f4342){_0x36e4da['push'](_0x36e4da['shift']());}};_0xe4dd80(++_0x2fe25e);}(_0x0b0e,0x187));var _0xe0b0=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x0b0e[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 161a45b..a9f6952 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 _0xd3e7=['remove','emit','removeListener','register','length','./openchannelMessage.events'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3e7[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x7d3e('0x0'));var events=['save',_0x7d3e('0x1'),'update'];function createListener(_0x4edbb1,_0x2f7098){return function(_0x211fc8){_0x2f7098[_0x7d3e('0x2')](_0x4edbb1,_0x211fc8);};}function removeListener(_0x1a67cd,_0x1e2d44){return function(){OpenchannelMessageEvents[_0x7d3e('0x3')](_0x1a67cd,_0x1e2d44);};}exports[_0x7d3e('0x4')]=function(_0x155c51){for(var _0x506bf=0x0,_0xe3fb9c=events[_0x7d3e('0x5')];_0x506bf<_0xe3fb9c;_0x506bf++){var _0x35bed3=events[_0x506bf];var _0x54e293=createListener('openchannelMessage:'+_0x35bed3,_0x155c51);OpenchannelMessageEvents['on'](_0x35bed3,_0x54e293);}}; \ No newline at end of file +var _0x3649=['update','emit','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x3af704,_0x58486b){var _0x4ac16c=function(_0x1a49b8){while(--_0x1a49b8){_0x3af704['push'](_0x3af704['shift']());}};_0x4ac16c(++_0x58486b);}(_0x3649,0x1d1));var _0x9364=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3649[_0x484e36];return _0xafc85d;};'use strict';var OpenchannelMessageEvents=require(_0x9364('0x0'));var events=[_0x9364('0x1'),_0x9364('0x2'),_0x9364('0x3')];function createListener(_0x2924d5,_0x2cb4fa){return function(_0x38f9b3){_0x2cb4fa[_0x9364('0x4')](_0x2924d5,_0x38f9b3);};}function removeListener(_0x316595,_0x5a8d48){return function(){OpenchannelMessageEvents['removeListener'](_0x316595,_0x5a8d48);};}exports['register']=function(_0x230f52){for(var _0x2d247d=0x0,_0x10ee42=events['length'];_0x2d247d<_0x10ee42;_0x2d247d++){var _0x341569=events[_0x2d247d];var _0x25b1e8=createListener(_0x9364('0x5')+_0x341569,_0x230f52);OpenchannelMessageEvents['on'](_0x341569,_0x25b1e8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d483bbd..43c753e 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 _0xa11d=['delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','create','addTeams','/:id/users','addAgents','put','update','destroy'];(function(_0x410edb,_0x55d52a){var _0xe78b16=function(_0x417999){while(--_0x417999){_0x410edb['push'](_0x410edb['shift']());}};_0xe78b16(++_0x55d52a);}(_0xa11d,0xce));var _0xda11=function(_0x3e823b,_0x2da7c5){_0x3e823b=_0x3e823b-0x0;var _0x51fae3=_0xa11d[_0x3e823b];return _0x51fae3;};'use strict';var multer=require(_0xda11('0x0'));var util=require(_0xda11('0x1'));var path=require(_0xda11('0x2'));var timeout=require(_0xda11('0x3'));var express=require(_0xda11('0x4'));var router=express[_0xda11('0x5')]();var fs_extra=require(_0xda11('0x6'));var auth=require(_0xda11('0x7'));var interaction=require(_0xda11('0x8'));var config=require('../../config/environment');var controller=require(_0xda11('0x9'));router[_0xda11('0xa')]('/',auth['isAuthenticated'](),controller[_0xda11('0xb')]);router['get'](_0xda11('0xc'),auth['isAuthenticated'](),controller[_0xda11('0xd')]);router['get'](_0xda11('0xe'),auth[_0xda11('0xf')](),controller['show']);router['get'](_0xda11('0x10'),auth[_0xda11('0xf')](),controller[_0xda11('0x11')]);router[_0xda11('0xa')](_0xda11('0x12'),auth[_0xda11('0xf')](),controller['getTeams']);router[_0xda11('0xa')]('/:id/users',auth[_0xda11('0xf')](),controller['getAgents']);router['post']('/',auth[_0xda11('0xf')](),controller[_0xda11('0x13')]);router['post'](_0xda11('0x12'),auth[_0xda11('0xf')](),controller[_0xda11('0x14')]);router['post'](_0xda11('0x15'),auth[_0xda11('0xf')](),controller[_0xda11('0x16')]);router[_0xda11('0x17')]('/:id',auth[_0xda11('0xf')](),controller[_0xda11('0x18')]);router['delete']('/:id',auth[_0xda11('0xf')](),controller[_0xda11('0x19')]);router[_0xda11('0x1a')]('/:id/teams',auth[_0xda11('0xf')](),controller['removeTeams']);router[_0xda11('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xda11('0x1b')]);module[_0xda11('0x1c')]=router; \ No newline at end of file +var _0x87d5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addAgents','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5d4c74,_0x800028){var _0x3620c4=function(_0x189eaf){while(--_0x189eaf){_0x5d4c74['push'](_0x5d4c74['shift']());}};_0x3620c4(++_0x800028);}(_0x87d5,0x174));var _0x587d=function(_0x1f5314,_0x50b89e){_0x1f5314=_0x1f5314-0x0;var _0x51d4f0=_0x87d5[_0x1f5314];return _0x51d4f0;};'use strict';var multer=require('multer');var util=require(_0x587d('0x0'));var path=require(_0x587d('0x1'));var timeout=require(_0x587d('0x2'));var express=require(_0x587d('0x3'));var router=express[_0x587d('0x4')]();var fs_extra=require(_0x587d('0x5'));var auth=require(_0x587d('0x6'));var interaction=require(_0x587d('0x7'));var config=require(_0x587d('0x8'));var controller=require(_0x587d('0x9'));router[_0x587d('0xa')]('/',auth[_0x587d('0xb')](),controller[_0x587d('0xc')]);router['get'](_0x587d('0xd'),auth[_0x587d('0xb')](),controller['describe']);router[_0x587d('0xa')](_0x587d('0xe'),auth[_0x587d('0xb')](),controller['show']);router['get'](_0x587d('0xf'),auth[_0x587d('0xb')](),controller['getMembers']);router[_0x587d('0xa')](_0x587d('0x10'),auth[_0x587d('0xb')](),controller[_0x587d('0x11')]);router[_0x587d('0xa')](_0x587d('0x12'),auth[_0x587d('0xb')](),controller['getAgents']);router[_0x587d('0x13')]('/',auth[_0x587d('0xb')](),controller[_0x587d('0x14')]);router[_0x587d('0x13')](_0x587d('0x10'),auth[_0x587d('0xb')](),controller['addTeams']);router[_0x587d('0x13')](_0x587d('0x12'),auth[_0x587d('0xb')](),controller[_0x587d('0x15')]);router['put']('/:id',auth[_0x587d('0xb')](),controller[_0x587d('0x16')]);router[_0x587d('0x17')](_0x587d('0xe'),auth['isAuthenticated'](),controller[_0x587d('0x18')]);router[_0x587d('0x17')](_0x587d('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x587d('0x17')](_0x587d('0x12'),auth['isAuthenticated'](),controller[_0x587d('0x19')]);module[_0x587d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 850527f..45be471 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 _0xf794=['STRING','ENUM','beepall','roundrobin','sequelize','name'];(function(_0x383d00,_0x4b4a54){var _0x290afc=function(_0x3bda18){while(--_0x3bda18){_0x383d00['push'](_0x383d00['shift']());}};_0x290afc(++_0x4b4a54);}(_0xf794,0x130));var _0x4f79=function(_0x1138bd,_0x17d8f1){_0x1138bd=_0x1138bd-0x0;var _0x4e0a05=_0xf794[_0x1138bd];return _0x4e0a05;};'use strict';var Sequelize=require(_0x4f79('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4f79('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f79('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f79('0x3')]('rrmemory',_0x4f79('0x4'),_0x4f79('0x5'))}}; \ No newline at end of file +var _0x2c3d=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c3d,0xc2));var _0xd2c3=function(_0x144c9c,_0x59f5ff){_0x144c9c=_0x144c9c-0x0;var _0x136b26=_0x2c3d[_0x144c9c];return _0x136b26;};'use strict';var Sequelize=require(_0xd2c3('0x0'));module[_0xd2c3('0x1')]={'name':{'type':Sequelize[_0xd2c3('0x2')],'unique':_0xd2c3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd2c3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd2c3('0x4')](_0xd2c3('0x5'),_0xd2c3('0x6'),_0xd2c3('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 309674b..dda8a79 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 _0x4383=['lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','send','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','keys','intersection','model','fields','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','filters','length','nolimit','limit','order','sort','filter','User','agent','openchannelPause','updatedAt','%s/%s','createdAt','Team','pick','getTeams','hasOwnProperty','addTeams','ids','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','bluebird','util'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0x4383,0x1f2));var _0x3438=function(_0x4f5c5d,_0x5d2130){_0x4f5c5d=_0x4f5c5d-0x0;var _0x5d94ba=_0x4383[_0x4f5c5d];return _0x5d94ba;};'use strict';var BPromise=require(_0x3438('0x0'));var util=require(_0x3438('0x1'));var _=require(_0x3438('0x2'));var squel=require(_0x3438('0x3'));var Redis=require(_0x3438('0x4'));var qs=require(_0x3438('0x5'));var logger=require(_0x3438('0x6'))(_0x3438('0x7'));var config=require(_0x3438('0x8'));var db=require(_0x3438('0x9'))['db'];config[_0x3438('0xa')]=_[_0x3438('0xb')](config['redis'],{'host':_0x3438('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3438('0xa')]));require(_0x3438('0xd'))[_0x3438('0xe')](socket);function respondWithStatusCode(_0x1349a3,_0x33e9ce){_0x33e9ce=_0x33e9ce||0xcc;return function(_0x55a29a){if(_0x55a29a){return _0x1349a3[_0x3438('0xf')](_0x33e9ce);}return _0x1349a3['status'](_0x33e9ce)[_0x3438('0x10')]();};}function respondWithResult(_0x2224fa,_0x18419c){_0x18419c=_0x18419c||0xc8;return function(_0x5e5773){if(_0x5e5773){return _0x2224fa[_0x3438('0x11')](_0x18419c)[_0x3438('0x12')](_0x5e5773);}};}function respondWithFilteredResult(_0x17930c,_0x10787c){return function(_0x3d0dd2){if(_0x3d0dd2){var _0x4e135e=typeof _0x10787c['offset']===_0x3438('0x13')&&typeof _0x10787c['limit']===_0x3438('0x13');var _0x5aa19d=_0x3d0dd2[_0x3438('0x14')];var _0x44b13f=_0x4e135e?0x0:_0x10787c['offset'];var _0x4e5605=_0x4e135e?_0x3d0dd2['count']:_0x10787c[_0x3438('0x15')]+_0x10787c['limit'];var _0x341711;if(_0x4e5605>=_0x5aa19d){_0x4e5605=_0x5aa19d;_0x341711=0xc8;}else{_0x341711=0xce;}_0x17930c['status'](_0x341711);return _0x17930c[_0x3438('0x16')](_0x3438('0x17'),_0x44b13f+'-'+_0x4e5605+'/'+_0x5aa19d)['json'](_0x3d0dd2);}return null;};}function saveUpdates(_0x1cc4a2){return function(_0x4fd5b5){if(_0x4fd5b5){return _0x4fd5b5[_0x3438('0x18')](_0x1cc4a2)[_0x3438('0x19')](function(_0x257ed6){return _0x257ed6;});}return null;};}function removeEntity(_0x36dd85){return function(_0x36bc1d){if(_0x36bc1d){return _0x36bc1d[_0x3438('0x1a')]()[_0x3438('0x19')](function(){var _0x42e11a=_0x36bc1d[_0x3438('0x1b')]({'plain':!![]});var _0x28fe06=_0x3438('0x1c');return db[_0x3438('0x1d')][_0x3438('0x1a')]({'where':{'type':_0x28fe06,'resourceId':_0x42e11a['id']}})[_0x3438('0x19')](function(){return _0x36bc1d;});})['then'](function(){_0x36dd85['status'](0xcc)[_0x3438('0x10')]();});}};}function handleEntityNotFound(_0x1b6948){return function(_0x4346b0){if(!_0x4346b0){_0x1b6948['sendStatus'](0x194);}return _0x4346b0;};}function handleError(_0x25adf9,_0x5b6529){_0x5b6529=_0x5b6529||0x1f4;return function(_0x1e4d73){logger[_0x3438('0x1e')](_0x1e4d73[_0x3438('0x1f')]);if(_0x1e4d73['name']){delete _0x1e4d73['name'];}_0x25adf9[_0x3438('0x11')](_0x5b6529)[_0x3438('0x20')](_0x1e4d73);};}exports[_0x3438('0x21')]=function(_0x171106,_0x25424e){var _0xdfc4cd={};var _0x190618={'count':0x0,'rows':[]};var _0x4d245a=_[_0x3438('0x22')](db[_0x3438('0x23')][_0x3438('0x24')],function(_0x174935){return{'name':_0x174935['fieldName'],'type':_0x174935[_0x3438('0x25')][_0x3438('0x26')]};});_0xdfc4cd=qs[_0x3438('0x27')](_0x4d245a,_0x171106);var _0x332290={'where':_0xdfc4cd[_0x3438('0x28')]};return db[_0x3438('0x23')][_0x3438('0x14')](_0x332290)[_0x3438('0x19')](function(_0x520584){_0x190618[_0x3438('0x14')]=_0x520584;_0xdfc4cd[_0x3438('0x29')]=qs['include'](_0x171106[_0x3438('0x2a')]);return db[_0x3438('0x23')][_0x3438('0x2b')](_0xdfc4cd);})[_0x3438('0x19')](function(_0x15fdd7){_0x190618[_0x3438('0x2c')]=_0x15fdd7;return _0x190618;})[_0x3438('0x19')](respondWithFilteredResult(_0x25424e,_0xdfc4cd))[_0x3438('0x2d')](handleError(_0x25424e,null));};exports['show']=function(_0x5ee605,_0x8b9be7){var _0x2aa696={'raw':!![],'where':{'id':_0x5ee605['params']['id']}},_0x1dc564={};_0x1dc564['model']=_[_0x3438('0x2e')](db[_0x3438('0x23')][_0x3438('0x24')]);_0x1dc564[_0x3438('0x2a')]=_[_0x3438('0x2e')](_0x5ee605[_0x3438('0x2a')]);_0x1dc564['filters']=_[_0x3438('0x2f')](_0x1dc564[_0x3438('0x30')],_0x1dc564[_0x3438('0x2a')]);_0x2aa696['attributes']=_[_0x3438('0x2f')](_0x1dc564[_0x3438('0x30')],qs[_0x3438('0x31')](_0x5ee605[_0x3438('0x2a')][_0x3438('0x31')]));_0x2aa696['attributes']=_0x2aa696[_0x3438('0x32')]['length']?_0x2aa696[_0x3438('0x32')]:_0x1dc564[_0x3438('0x30')];if(_0x5ee605[_0x3438('0x2a')][_0x3438('0x33')]){_0x2aa696['include']=[{'all':!![]}];}_0x2aa696=_[_0x3438('0x34')]({},_0x2aa696,_0x5ee605[_0x3438('0x35')]);return db[_0x3438('0x23')][_0x3438('0x36')](_0x2aa696)['then'](handleEntityNotFound(_0x8b9be7,null))[_0x3438('0x19')](respondWithResult(_0x8b9be7,null))[_0x3438('0x2d')](handleError(_0x8b9be7,null));};exports[_0x3438('0x37')]=function(_0x5e0d1e,_0x1df36c){return db[_0x3438('0x23')][_0x3438('0x37')](_0x5e0d1e[_0x3438('0x38')],{})[_0x3438('0x19')](function(_0x727f86){var _0x590125=_0x5e0d1e[_0x3438('0x39')]['get']({'plain':!![]});if(!_0x590125)throw new Error(_0x3438('0x3a'));if(_0x590125[_0x3438('0x3b')]==='user'){var _0x2c5f7d=_0x727f86['get']({'plain':!![]});var _0x1923e3=_0x3438('0x1c');return db[_0x3438('0x3c')][_0x3438('0x36')]({'where':{'name':_0x1923e3,'userProfileId':_0x590125[_0x3438('0x3d')]},'raw':!![]})[_0x3438('0x19')](function(_0x14b06f){if(_0x14b06f&&_0x14b06f[_0x3438('0x3e')]===0x0){return db[_0x3438('0x1d')][_0x3438('0x37')]({'name':_0x2c5f7d['name'],'resourceId':_0x2c5f7d['id'],'type':_0x14b06f[_0x3438('0x3f')],'sectionId':_0x14b06f['id']},{})[_0x3438('0x19')](function(){return _0x727f86;});}else{return _0x727f86;}})[_0x3438('0x2d')](function(_0x2174d3){logger[_0x3438('0x1e')](_0x3438('0x40'),_0x2174d3);throw _0x2174d3;});}return _0x727f86;})[_0x3438('0x19')](respondWithResult(_0x1df36c,0xc9))[_0x3438('0x2d')](handleError(_0x1df36c,null));};exports['update']=function(_0x5e3c9f,_0x3bb3c6){if(_0x5e3c9f[_0x3438('0x38')]['id']){delete _0x5e3c9f[_0x3438('0x38')]['id'];}return db[_0x3438('0x23')][_0x3438('0x36')]({'where':{'id':_0x5e3c9f['params']['id']}})[_0x3438('0x19')](handleEntityNotFound(_0x3bb3c6,null))['then'](saveUpdates(_0x5e3c9f['body'],null))[_0x3438('0x19')](respondWithResult(_0x3bb3c6,null))[_0x3438('0x2d')](handleError(_0x3bb3c6,null));};exports[_0x3438('0x1a')]=function(_0x593d4b,_0x4f6580){return db[_0x3438('0x23')][_0x3438('0x36')]({'where':{'id':_0x593d4b[_0x3438('0x41')]['id']}})[_0x3438('0x19')](handleEntityNotFound(_0x4f6580,null))['then'](removeEntity(_0x4f6580,null))[_0x3438('0x2d')](handleError(_0x4f6580,null));};exports[_0x3438('0x42')]=function(_0x548b02,_0x21c2a5){return db[_0x3438('0x23')][_0x3438('0x42')]()['then'](respondWithResult(_0x21c2a5,null))['catch'](handleError(_0x21c2a5,null));};exports[_0x3438('0x43')]=function(_0x5c5533,_0x35e314){var _0x3a573f={'raw':!![],'where':{}},_0xd6cf5f={},_0x3878e8;return db['OpenchannelQueue'][_0x3438('0x44')]({'where':{'id':_0x5c5533[_0x3438('0x41')]['id']}})[_0x3438('0x19')](handleEntityNotFound(_0x35e314,null))[_0x3438('0x19')](function(_0x3791a4){if(_0x3791a4){_0x3878e8=_0x3791a4['get']({'plain':!![]});_0xd6cf5f[_0x3438('0x30')]=_[_0x3438('0x2e')](db[_0x3438('0x45')][_0x3438('0x24')]);_0xd6cf5f[_0x3438('0x2a')]=_['keys'](_0x5c5533['query']);_0xd6cf5f[_0x3438('0x46')]=_[_0x3438('0x2f')](_0xd6cf5f['model'],_0xd6cf5f[_0x3438('0x2a')]);_0x3a573f[_0x3438('0x32')]=_['intersection'](_0xd6cf5f[_0x3438('0x30')],qs[_0x3438('0x31')](_0x5c5533[_0x3438('0x2a')][_0x3438('0x31')]));_0x3a573f[_0x3438('0x32')]=_0x3a573f[_0x3438('0x32')][_0x3438('0x47')]?_0x3a573f[_0x3438('0x32')]:_0xd6cf5f['model'];if(!_0x5c5533[_0x3438('0x2a')]['hasOwnProperty'](_0x3438('0x48'))){_0x3a573f[_0x3438('0x49')]=qs[_0x3438('0x49')](_0x5c5533['query']['limit']);_0x3a573f['offset']=qs[_0x3438('0x15')](_0x5c5533[_0x3438('0x2a')][_0x3438('0x15')]);}_0x3a573f[_0x3438('0x4a')]=qs[_0x3438('0x4b')](_0x5c5533[_0x3438('0x2a')][_0x3438('0x4b')]);_0x3a573f[_0x3438('0x28')]=qs[_0x3438('0x46')](_['pick'](_0x5c5533[_0x3438('0x2a')],_0xd6cf5f[_0x3438('0x46')]));_0x3a573f[_0x3438('0x28')]['OpenchannelQueueId']=_0x3791a4['id'];if(_0x5c5533[_0x3438('0x2a')][_0x3438('0x4c')]){_0x3a573f[_0x3438('0x28')]=_[_0x3438('0x34')](_0x3a573f[_0x3438('0x28')],{'$or':_['map'](_0x3a573f[_0x3438('0x32')],function(_0x46b1b2){var _0x14726d={};_0x14726d[_0x46b1b2]={'$like':'%'+_0x5c5533[_0x3438('0x2a')][_0x3438('0x4c')]+'%'};return _0x14726d;})});}_0x3a573f=_['merge']({},_0x3a573f,_0x5c5533[_0x3438('0x35')]);return db[_0x3438('0x45')]['findAll'](_0x3a573f);}})[_0x3438('0x19')](function(_0x4d1998){if(_0x4d1998){return db[_0x3438('0x4d')]['findAndCountAll']({'where':{'id':_[_0x3438('0x22')](_0x4d1998,'UserId'),'role':_0x3438('0x4e')},'attributes':['id',_0x3438('0x3f'),_0x3438('0x4f'),_0x3438('0x50'),'createdAt']});}})[_0x3438('0x19')](function(_0x2071a5){if(_0x2071a5){return{'count':_0x2071a5[_0x3438('0x14')],'rows':_[_0x3438('0x22')](_0x2071a5[_0x3438('0x2c')],function(_0x3fa592){return{'membername':_0x3fa592[_0x3438('0x3f')],'UserId':_0x3fa592['id'],'queue_name':_0x3878e8[_0x3438('0x3f')],'OpenchannelQueueId':_0x3878e8['id'],'interface':util['format'](_0x3438('0x51'),'SIP',_0x3fa592[_0x3438('0x3f')]),'penalty':0x0,'paused':_0x3fa592['openchannelPause'],'createdAt':_0x3fa592[_0x3438('0x52')],'updatedAt':_0x3fa592[_0x3438('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3438('0x19')](respondWithFilteredResult(_0x35e314,_0x3a573f))[_0x3438('0x2d')](handleError(_0x35e314,null));};exports['getTeams']=function(_0x42b8ec,_0x50b242){var _0x789669={};var _0x4d15a3={};var _0x2aee7a;var _0x234123;return db[_0x3438('0x23')]['findOne']({'where':{'id':_0x42b8ec[_0x3438('0x41')]['id']}})['then'](handleEntityNotFound(_0x50b242,null))[_0x3438('0x19')](function(_0x7f1836){if(_0x7f1836){_0x2aee7a=_0x7f1836;_0x4d15a3[_0x3438('0x30')]=_[_0x3438('0x2e')](db[_0x3438('0x53')][_0x3438('0x24')]);_0x4d15a3[_0x3438('0x2a')]=_['keys'](_0x42b8ec[_0x3438('0x2a')]);_0x4d15a3[_0x3438('0x46')]=_[_0x3438('0x2f')](_0x4d15a3[_0x3438('0x30')],_0x4d15a3['query']);_0x789669[_0x3438('0x32')]=_['intersection'](_0x4d15a3['model'],qs[_0x3438('0x31')](_0x42b8ec[_0x3438('0x2a')][_0x3438('0x31')]));_0x789669[_0x3438('0x32')]=_0x789669[_0x3438('0x32')]['length']?_0x789669[_0x3438('0x32')]:_0x4d15a3[_0x3438('0x30')];_0x789669[_0x3438('0x4a')]=qs[_0x3438('0x4b')](_0x42b8ec[_0x3438('0x2a')][_0x3438('0x4b')]);_0x789669[_0x3438('0x28')]=qs[_0x3438('0x46')](_[_0x3438('0x54')](_0x42b8ec['query'],_0x4d15a3[_0x3438('0x46')]));if(_0x42b8ec[_0x3438('0x2a')][_0x3438('0x4c')]){_0x789669['where']=_['merge'](_0x789669[_0x3438('0x28')],{'$or':_[_0x3438('0x22')](_0x789669['attributes'],function(_0x70c842){var _0x424985={};_0x424985[_0x70c842]={'$like':'%'+_0x42b8ec[_0x3438('0x2a')][_0x3438('0x4c')]+'%'};return _0x424985;})});}_0x789669=_[_0x3438('0x34')]({},_0x789669,_0x42b8ec[_0x3438('0x35')]);return _0x2aee7a[_0x3438('0x55')](_0x789669);}})['then'](function(_0x3887cd){if(_0x3887cd){_0x234123=_0x3887cd['length'];if(!_0x42b8ec[_0x3438('0x2a')][_0x3438('0x56')]('nolimit')){_0x789669[_0x3438('0x49')]=qs[_0x3438('0x49')](_0x42b8ec[_0x3438('0x2a')][_0x3438('0x49')]);_0x789669['offset']=qs['offset'](_0x42b8ec[_0x3438('0x2a')]['offset']);}return _0x2aee7a[_0x3438('0x55')](_0x789669);}})[_0x3438('0x19')](function(_0x36f878){if(_0x36f878){return _0x36f878?{'count':_0x234123,'rows':_0x36f878}:null;}})[_0x3438('0x19')](respondWithResult(_0x50b242,null))['catch'](handleError(_0x50b242,null));};exports[_0x3438('0x57')]=function(_0x8c08c0,_0x2d731f){var _0xc1d33=_0x8c08c0['body'][_0x3438('0x58')];return db[_0x3438('0x53')][_0x3438('0x2b')]({'where':{'id':_0xc1d33},'attributes':['id'],'include':[{'model':db[_0x3438('0x4d')],'as':'Agents','attributes':['id','name','online',_0x3438('0x59'),_0x3438('0x5a')],'raw':!![]}]})[_0x3438('0x19')](function(_0x5d75e0){if(_0x5d75e0){var _0x280774=_['flatMap'](_0x5d75e0,function(_0x43ef59){var _0x5bb132=_0x43ef59[_0x3438('0x1b')]({'plain':!![]});return _0x5bb132[_0x3438('0x5b')];});return db[_0x3438('0x23')][_0x3438('0x36')]({'where':{'id':_0x8c08c0[_0x3438('0x41')]['id']}})['then'](function(_0x134cbc){return db[_0x3438('0x5c')][_0x3438('0x5d')](function(_0x386980){return _0x134cbc['addTeams'](_0xc1d33,{'transaction':_0x386980})[_0x3438('0x19')](function(){return BPromise[_0x3438('0x5e')](_0x280774,function(_0x217692){return db[_0x3438('0x45')][_0x3438('0x5f')]({'where':{'UserId':_0x217692['id'],'OpenchannelQueueId':_0x8c08c0[_0x3438('0x41')]['id']},'transaction':_0x386980});});})[_0x3438('0x19')](function(){_0x280774[_0x3438('0x60')](function(_0x41226e){socket[_0x3438('0x61')](_0x3438('0x62'),{'UserId':_0x41226e['id'],'OpenchannelQueueId':_0x134cbc['id']});});});});});}})['then'](respondWithStatusCode(_0x2d731f,null))[_0x3438('0x2d')](handleError(_0x2d731f,null));};exports[_0x3438('0x63')]=function(_0x4d0996,_0x542f27){return db['Team']['findAll']({'where':{'id':_0x4d0996['query'][_0x3438('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x542f27,null))[_0x3438('0x19')](function(_0x4ad06a){var _0x3a3068=_[_0x3438('0x22')](_0x4ad06a,'id');var _0x214cde=[];var _0x2c4713=[];var _0x352ddd=squel[_0x3438('0x64')]();_0x352ddd[_0x3438('0x65')](_0x3438('0x66'))[_0x3438('0x67')](_0x3438('0x68'),'tq')[_0x3438('0x69')]('user_has_teams','ut',_0x3438('0x6a'))[_0x3438('0x28')](_0x3438('0x6b'),_0x4d0996[_0x3438('0x41')]['id']);for(var _0x9269db=0x0;_0x9269db<_0x4ad06a[_0x3438('0x47')];_0x9269db+=0x1){let _0x1768a3=_0x4ad06a[_0x9269db];for(var _0x5dc7e0=0x0;_0x5dc7e0<_0x1768a3[_0x3438('0x5b')][_0x3438('0x47')];_0x5dc7e0+=0x1){let _0x2f4b58=_0x1768a3[_0x3438('0x5b')][_0x5dc7e0];var _0x197ee1=_0x352ddd[_0x3438('0x6c')]();_0x197ee1[_0x3438('0x28')]('ut.UserId\x20=\x20?',_0x2f4b58['id']);_0x2c4713[_0x3438('0x6d')](db[_0x3438('0x5c')][_0x3438('0x2a')](_0x197ee1['toString'](),{'type':db[_0x3438('0x5c')][_0x3438('0x6e')][_0x3438('0x6f')]})[_0x3438('0x19')](function(_0x4bb863){if(_0x4bb863['length']===0x1){return _0x2f4b58['id'];}else{var _0x31b78e=_[_0x3438('0x70')](_[_0x3438('0x22')](_0x4bb863,_0x3438('0x71')),function(_0x1ba7ac){return _[_0x3438('0x72')](_0x3a3068,_0x1ba7ac);});if(_0x31b78e){return _0x2f4b58['id'];}}}));}}return BPromise[_0x3438('0x73')](_0x2c4713)['then'](function(_0x452d2d){_0x214cde=_(_0x214cde)[_0x3438('0x74')](_0x452d2d)['compact']()[_0x3438('0x75')]();return db[_0x3438('0x23')][_0x3438('0x36')]({'where':{'id':_0x4d0996[_0x3438('0x41')]['id']}})['then'](function(_0x1ed792){return db[_0x3438('0x5c')]['transaction'](function(_0x33b9cc){return _0x1ed792[_0x3438('0x63')](_0x4d0996['query'][_0x3438('0x58')],{'transaction':_0x33b9cc})[_0x3438('0x19')](function(){if(!_[_0x3438('0x76')](_0x214cde)){return _0x1ed792[_0x3438('0x77')](_0x214cde,{'transaction':_0x33b9cc});}})['then'](function(){_0x214cde[_0x3438('0x60')](function(_0x23279d){socket['emit'](_0x3438('0x78'),{'UserId':_0x23279d,'OpenchannelQueueId':_0x1ed792['id']});});});});});});})['then'](respondWithStatusCode(_0x542f27,null))['catch'](handleError(_0x542f27,null));};exports[_0x3438('0x79')]=function(_0x45d3c4,_0x25b27f){return db['OpenchannelQueue'][_0x3438('0x36')]({'where':{'id':_0x45d3c4[_0x3438('0x41')]['id']}})['then'](handleEntityNotFound(_0x25b27f,null))[_0x3438('0x19')](function(_0x264449){if(_0x264449){return _0x264449[_0x3438('0x79')](_0x45d3c4[_0x3438('0x38')][_0x3438('0x58')],_[_0x3438('0x7a')](_0x45d3c4[_0x3438('0x38')],[_0x3438('0x58'),'id'])||{})[_0x3438('0x7b')](function(_0x49947b){for(var _0x1d2224=0x0;_0x1d2224<_0x45d3c4['body'][_0x3438('0x58')]['length'];_0x1d2224+=0x1){socket['emit'](_0x3438('0x62'),{'UserId':Number(_0x45d3c4[_0x3438('0x38')][_0x3438('0x58')][_0x1d2224]),'OpenchannelQueueId':Number(_0x45d3c4[_0x3438('0x41')]['id'])});}return _0x49947b;});}})[_0x3438('0x19')](respondWithResult(_0x25b27f,null))['catch'](handleError(_0x25b27f,null));};exports[_0x3438('0x77')]=function(_0x3dc20d,_0x57d4b3){return db['OpenchannelQueue'][_0x3438('0x36')]({'where':{'id':_0x3dc20d[_0x3438('0x41')]['id']}})[_0x3438('0x19')](handleEntityNotFound(_0x57d4b3,null))[_0x3438('0x19')](function(_0x420fc0){if(_0x420fc0){return _0x420fc0['removeAgents'](_0x3dc20d[_0x3438('0x2a')][_0x3438('0x58')])['then'](function(){if(_['isArray'](_0x3dc20d[_0x3438('0x2a')][_0x3438('0x58')])){for(var _0x47ac70=0x0;_0x47ac70<_0x3dc20d['query'][_0x3438('0x58')][_0x3438('0x47')];_0x47ac70+=0x1){socket[_0x3438('0x61')](_0x3438('0x78'),{'UserId':Number(_0x3dc20d[_0x3438('0x2a')]['ids'][_0x47ac70]),'OpenchannelQueueId':Number(_0x3dc20d[_0x3438('0x41')]['id'])});}}else{socket[_0x3438('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3dc20d[_0x3438('0x2a')][_0x3438('0x58')]),'OpenchannelQueueId':Number(_0x3dc20d[_0x3438('0x41')]['id'])});}});}})['then'](respondWithStatusCode(_0x57d4b3,null))[_0x3438('0x2d')](handleError(_0x57d4b3,null));};exports[_0x3438('0x7c')]=function(_0x27712b,_0x5c13dd){var _0x1ed407={};var _0x562933={};var _0x187b7a;var _0x3a3b43;return db['OpenchannelQueue'][_0x3438('0x44')]({'where':{'id':_0x27712b[_0x3438('0x41')]['id']}})[_0x3438('0x19')](handleEntityNotFound(_0x5c13dd,null))[_0x3438('0x19')](function(_0xd027f5){if(_0xd027f5){_0x187b7a=_0xd027f5;_0x562933[_0x3438('0x30')]=_[_0x3438('0x2e')](db[_0x3438('0x4d')]['rawAttributes']);_0x562933['query']=_[_0x3438('0x2e')](_0x27712b[_0x3438('0x2a')]);_0x562933[_0x3438('0x46')]=_[_0x3438('0x2f')](_0x562933[_0x3438('0x30')],_0x562933[_0x3438('0x2a')]);_0x1ed407[_0x3438('0x32')]=_['intersection'](_0x562933[_0x3438('0x30')],qs[_0x3438('0x31')](_0x27712b['query'][_0x3438('0x31')]));_0x1ed407[_0x3438('0x32')]=_0x1ed407['attributes'][_0x3438('0x47')]?_0x1ed407['attributes']:_0x562933[_0x3438('0x30')];_0x1ed407[_0x3438('0x4a')]=qs[_0x3438('0x4b')](_0x27712b[_0x3438('0x2a')][_0x3438('0x4b')]);_0x1ed407[_0x3438('0x28')]=qs['filters'](_[_0x3438('0x54')](_0x27712b[_0x3438('0x2a')],_0x562933['filters']));if(_0x27712b[_0x3438('0x2a')][_0x3438('0x4c')]){_0x1ed407[_0x3438('0x28')]=_['merge'](_0x1ed407[_0x3438('0x28')],{'$or':_[_0x3438('0x22')](_0x1ed407[_0x3438('0x32')],function(_0xe5db7d){var _0x3e18de={};_0x3e18de[_0xe5db7d]={'$like':'%'+_0x27712b[_0x3438('0x2a')][_0x3438('0x4c')]+'%'};return _0x3e18de;})});}_0x1ed407=_[_0x3438('0x34')]({},_0x1ed407,_0x27712b[_0x3438('0x35')]);return _0x187b7a['getAgents'](_0x1ed407);}})[_0x3438('0x19')](function(_0xbc630f){if(_0xbc630f){_0x3a3b43=_0xbc630f[_0x3438('0x47')];if(!_0x27712b[_0x3438('0x2a')][_0x3438('0x56')](_0x3438('0x48'))){_0x1ed407[_0x3438('0x49')]=qs['limit'](_0x27712b[_0x3438('0x2a')][_0x3438('0x49')]);_0x1ed407['offset']=qs[_0x3438('0x15')](_0x27712b[_0x3438('0x2a')][_0x3438('0x15')]);}return _0x187b7a[_0x3438('0x7c')](_0x1ed407);}})[_0x3438('0x19')](function(_0x481dbe){if(_0x481dbe){return _0x481dbe?{'count':_0x3a3b43,'rows':_0x481dbe}:null;}})[_0x3438('0x19')](respondWithResult(_0x5c13dd,null))[_0x3438('0x2d')](handleError(_0x5c13dd,null));}; \ No newline at end of file +var _0x4f3e=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','value','addAgents','omit','removeAgents','userOpenchannelQueue:remove','getAgents','pick','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./openchannelQueue.socket','register','end','json','undefined','offset','limit','status','set','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','send','index','map','OpenchannelQueue','rawAttributes','key','getOptions','where','count','include','params','model','keys','query','filters','intersection','fields','attributes','length','merge','options','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','create','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','openchannelPause','getTeams','Team','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues'];(function(_0x5b0a46,_0x945b7e){var _0x540fed=function(_0x1b339a){while(--_0x1b339a){_0x5b0a46['push'](_0x5b0a46['shift']());}};_0x540fed(++_0x945b7e);}(_0x4f3e,0x8b));var _0xe4f3=function(_0x214a92,_0x44fba1){_0x214a92=_0x214a92-0x0;var _0x4192cf=_0x4f3e[_0x214a92];return _0x4192cf;};'use strict';var BPromise=require(_0xe4f3('0x0'));var util=require('util');var _=require(_0xe4f3('0x1'));var squel=require(_0xe4f3('0x2'));var Redis=require(_0xe4f3('0x3'));var qs=require(_0xe4f3('0x4'));var logger=require(_0xe4f3('0x5'))('api');var config=require(_0xe4f3('0x6'));var db=require(_0xe4f3('0x7'))['db'];config['redis']=_[_0xe4f3('0x8')](config[_0xe4f3('0x9')],{'host':_0xe4f3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4f3('0x9')]));require(_0xe4f3('0xb'))[_0xe4f3('0xc')](socket);function respondWithStatusCode(_0x4ff6f5,_0x4ae44a){_0x4ae44a=_0x4ae44a||0xcc;return function(_0x4918fd){if(_0x4918fd){return _0x4ff6f5['sendStatus'](_0x4ae44a);}return _0x4ff6f5['status'](_0x4ae44a)[_0xe4f3('0xd')]();};}function respondWithResult(_0x318284,_0x538ee2){_0x538ee2=_0x538ee2||0xc8;return function(_0x4b279a){if(_0x4b279a){return _0x318284['status'](_0x538ee2)[_0xe4f3('0xe')](_0x4b279a);}};}function respondWithFilteredResult(_0x370012,_0x16e4f6){return function(_0x1f8b41){if(_0x1f8b41){var _0x556f7a=typeof _0x16e4f6['offset']==='undefined'&&typeof _0x16e4f6['limit']===_0xe4f3('0xf');var _0x579b96=_0x1f8b41['count'];var _0x463dd3=_0x556f7a?0x0:_0x16e4f6[_0xe4f3('0x10')];var _0xaadce8=_0x556f7a?_0x1f8b41['count']:_0x16e4f6[_0xe4f3('0x10')]+_0x16e4f6[_0xe4f3('0x11')];var _0x19fd22;if(_0xaadce8>=_0x579b96){_0xaadce8=_0x579b96;_0x19fd22=0xc8;}else{_0x19fd22=0xce;}_0x370012[_0xe4f3('0x12')](_0x19fd22);return _0x370012[_0xe4f3('0x13')]('Content-Range',_0x463dd3+'-'+_0xaadce8+'/'+_0x579b96)['json'](_0x1f8b41);}return null;};}function saveUpdates(_0x4b8932){return function(_0x23adab){if(_0x23adab){return _0x23adab[_0xe4f3('0x14')](_0x4b8932)[_0xe4f3('0x15')](function(_0x320238){return _0x320238;});}return null;};}function removeEntity(_0x51dd1c){return function(_0x3c4904){if(_0x3c4904){return _0x3c4904[_0xe4f3('0x16')]()[_0xe4f3('0x15')](function(){var _0x3f603c=_0x3c4904[_0xe4f3('0x17')]({'plain':!![]});var _0x55f964=_0xe4f3('0x18');return db[_0xe4f3('0x19')]['destroy']({'where':{'type':_0x55f964,'resourceId':_0x3f603c['id']}})['then'](function(){return _0x3c4904;});})[_0xe4f3('0x15')](function(){_0x51dd1c['status'](0xcc)[_0xe4f3('0xd')]();});}};}function handleEntityNotFound(_0x1e322f){return function(_0x44687b){if(!_0x44687b){_0x1e322f[_0xe4f3('0x1a')](0x194);}return _0x44687b;};}function handleError(_0x24d82f,_0x2b4802){_0x2b4802=_0x2b4802||0x1f4;return function(_0x206cbc){logger[_0xe4f3('0x1b')](_0x206cbc[_0xe4f3('0x1c')]);if(_0x206cbc['name']){delete _0x206cbc['name'];}_0x24d82f[_0xe4f3('0x12')](_0x2b4802)[_0xe4f3('0x1d')](_0x206cbc);};}exports[_0xe4f3('0x1e')]=function(_0x5bbe42,_0x1a90be){var _0x49afce={};var _0x639dff={'count':0x0,'rows':[]};var _0x269c6f=_[_0xe4f3('0x1f')](db[_0xe4f3('0x20')][_0xe4f3('0x21')],function(_0x1a31a2){return{'name':_0x1a31a2['fieldName'],'type':_0x1a31a2['type'][_0xe4f3('0x22')]};});_0x49afce=qs[_0xe4f3('0x23')](_0x269c6f,_0x5bbe42);var _0x4b8269={'where':_0x49afce[_0xe4f3('0x24')]};return db[_0xe4f3('0x20')][_0xe4f3('0x25')](_0x4b8269)[_0xe4f3('0x15')](function(_0x394c34){_0x639dff['count']=_0x394c34;_0x49afce[_0xe4f3('0x26')]=qs[_0xe4f3('0x26')](_0x5bbe42['query']);return db[_0xe4f3('0x20')]['findAll'](_0x49afce);})['then'](function(_0x2d23fe){_0x639dff['rows']=_0x2d23fe;return _0x639dff;})[_0xe4f3('0x15')](respondWithFilteredResult(_0x1a90be,_0x49afce))['catch'](handleError(_0x1a90be,null));};exports['show']=function(_0x3af2bb,_0xfc6cb2){var _0x56e44f={'raw':!![],'where':{'id':_0x3af2bb[_0xe4f3('0x27')]['id']}},_0x177e77={};_0x177e77[_0xe4f3('0x28')]=_[_0xe4f3('0x29')](db['OpenchannelQueue'][_0xe4f3('0x21')]);_0x177e77[_0xe4f3('0x2a')]=_['keys'](_0x3af2bb[_0xe4f3('0x2a')]);_0x177e77[_0xe4f3('0x2b')]=_[_0xe4f3('0x2c')](_0x177e77[_0xe4f3('0x28')],_0x177e77[_0xe4f3('0x2a')]);_0x56e44f['attributes']=_[_0xe4f3('0x2c')](_0x177e77[_0xe4f3('0x28')],qs['fields'](_0x3af2bb[_0xe4f3('0x2a')][_0xe4f3('0x2d')]));_0x56e44f['attributes']=_0x56e44f[_0xe4f3('0x2e')][_0xe4f3('0x2f')]?_0x56e44f[_0xe4f3('0x2e')]:_0x177e77[_0xe4f3('0x28')];if(_0x3af2bb[_0xe4f3('0x2a')]['includeAll']){_0x56e44f[_0xe4f3('0x26')]=[{'all':!![]}];}_0x56e44f=_[_0xe4f3('0x30')]({},_0x56e44f,_0x3af2bb[_0xe4f3('0x31')]);return db[_0xe4f3('0x20')]['find'](_0x56e44f)[_0xe4f3('0x15')](handleEntityNotFound(_0xfc6cb2,null))['then'](respondWithResult(_0xfc6cb2,null))[_0xe4f3('0x32')](handleError(_0xfc6cb2,null));};exports['create']=function(_0x59b79e,_0x465414){return db['OpenchannelQueue']['create'](_0x59b79e[_0xe4f3('0x33')],{})[_0xe4f3('0x15')](function(_0x5d0728){var _0x437b38=_0x59b79e['user']['get']({'plain':!![]});if(!_0x437b38)throw new Error(_0xe4f3('0x34'));if(_0x437b38[_0xe4f3('0x35')]===_0xe4f3('0x36')){var _0x5648d3=_0x5d0728['get']({'plain':!![]});var _0x1f37e0=_0xe4f3('0x18');return db[_0xe4f3('0x37')][_0xe4f3('0x38')]({'where':{'name':_0x1f37e0,'userProfileId':_0x437b38['userProfileId']},'raw':!![]})[_0xe4f3('0x15')](function(_0x25c66c){if(_0x25c66c&&_0x25c66c['autoAssociation']===0x0){return db[_0xe4f3('0x19')][_0xe4f3('0x39')]({'name':_0x5648d3['name'],'resourceId':_0x5648d3['id'],'type':_0x25c66c[_0xe4f3('0x3a')],'sectionId':_0x25c66c['id']},{})[_0xe4f3('0x15')](function(){return _0x5d0728;});}else{return _0x5d0728;}})[_0xe4f3('0x32')](function(_0x24b9ed){logger['error'](_0xe4f3('0x3b'),_0x24b9ed);throw _0x24b9ed;});}return _0x5d0728;})[_0xe4f3('0x15')](respondWithResult(_0x465414,0xc9))[_0xe4f3('0x32')](handleError(_0x465414,null));};exports['update']=function(_0x438e99,_0x5bfde7){if(_0x438e99[_0xe4f3('0x33')]['id']){delete _0x438e99['body']['id'];}return db['OpenchannelQueue'][_0xe4f3('0x38')]({'where':{'id':_0x438e99[_0xe4f3('0x27')]['id']}})[_0xe4f3('0x15')](handleEntityNotFound(_0x5bfde7,null))[_0xe4f3('0x15')](saveUpdates(_0x438e99[_0xe4f3('0x33')],null))['then'](respondWithResult(_0x5bfde7,null))['catch'](handleError(_0x5bfde7,null));};exports[_0xe4f3('0x16')]=function(_0x2a7f9a,_0x195f82){return db[_0xe4f3('0x20')][_0xe4f3('0x38')]({'where':{'id':_0x2a7f9a['params']['id']}})[_0xe4f3('0x15')](handleEntityNotFound(_0x195f82,null))[_0xe4f3('0x15')](removeEntity(_0x195f82,null))[_0xe4f3('0x32')](handleError(_0x195f82,null));};exports[_0xe4f3('0x3c')]=function(_0x495303,_0x4990b8){return db['OpenchannelQueue'][_0xe4f3('0x3c')]()['then'](respondWithResult(_0x4990b8,null))['catch'](handleError(_0x4990b8,null));};exports['getMembers']=function(_0x174861,_0x398242){var _0x3691b5={'raw':!![],'where':{}},_0x1c8a85={},_0x218426;return db[_0xe4f3('0x20')][_0xe4f3('0x3d')]({'where':{'id':_0x174861[_0xe4f3('0x27')]['id']}})['then'](handleEntityNotFound(_0x398242,null))['then'](function(_0x41fe4b){if(_0x41fe4b){_0x218426=_0x41fe4b[_0xe4f3('0x17')]({'plain':!![]});_0x1c8a85[_0xe4f3('0x28')]=_[_0xe4f3('0x29')](db[_0xe4f3('0x3e')][_0xe4f3('0x21')]);_0x1c8a85[_0xe4f3('0x2a')]=_[_0xe4f3('0x29')](_0x174861[_0xe4f3('0x2a')]);_0x1c8a85[_0xe4f3('0x2b')]=_[_0xe4f3('0x2c')](_0x1c8a85[_0xe4f3('0x28')],_0x1c8a85[_0xe4f3('0x2a')]);_0x3691b5[_0xe4f3('0x2e')]=_[_0xe4f3('0x2c')](_0x1c8a85[_0xe4f3('0x28')],qs[_0xe4f3('0x2d')](_0x174861[_0xe4f3('0x2a')][_0xe4f3('0x2d')]));_0x3691b5[_0xe4f3('0x2e')]=_0x3691b5[_0xe4f3('0x2e')][_0xe4f3('0x2f')]?_0x3691b5[_0xe4f3('0x2e')]:_0x1c8a85['model'];if(!_0x174861['query'][_0xe4f3('0x3f')](_0xe4f3('0x40'))){_0x3691b5[_0xe4f3('0x11')]=qs[_0xe4f3('0x11')](_0x174861['query'][_0xe4f3('0x11')]);_0x3691b5[_0xe4f3('0x10')]=qs[_0xe4f3('0x10')](_0x174861['query'][_0xe4f3('0x10')]);}_0x3691b5[_0xe4f3('0x41')]=qs['sort'](_0x174861[_0xe4f3('0x2a')][_0xe4f3('0x42')]);_0x3691b5[_0xe4f3('0x24')]=qs[_0xe4f3('0x2b')](_['pick'](_0x174861[_0xe4f3('0x2a')],_0x1c8a85[_0xe4f3('0x2b')]));_0x3691b5[_0xe4f3('0x24')][_0xe4f3('0x43')]=_0x41fe4b['id'];if(_0x174861[_0xe4f3('0x2a')]['filter']){_0x3691b5[_0xe4f3('0x24')]=_[_0xe4f3('0x30')](_0x3691b5[_0xe4f3('0x24')],{'$or':_['map'](_0x3691b5[_0xe4f3('0x2e')],function(_0x403a53){var _0x5d8332={};_0x5d8332[_0x403a53]={'$like':'%'+_0x174861[_0xe4f3('0x2a')][_0xe4f3('0x44')]+'%'};return _0x5d8332;})});}_0x3691b5=_['merge']({},_0x3691b5,_0x174861['options']);return db[_0xe4f3('0x3e')]['findAll'](_0x3691b5);}})['then'](function(_0x527cda){if(_0x527cda){return db[_0xe4f3('0x45')][_0xe4f3('0x46')]({'where':{'id':_[_0xe4f3('0x1f')](_0x527cda,_0xe4f3('0x47')),'role':'agent'},'attributes':['id',_0xe4f3('0x3a'),'openchannelPause',_0xe4f3('0x48'),_0xe4f3('0x49')]});}})[_0xe4f3('0x15')](function(_0x68f5f9){if(_0x68f5f9){return{'count':_0x68f5f9['count'],'rows':_[_0xe4f3('0x1f')](_0x68f5f9[_0xe4f3('0x4a')],function(_0x597ebf){return{'membername':_0x597ebf[_0xe4f3('0x3a')],'UserId':_0x597ebf['id'],'queue_name':_0x218426['name'],'OpenchannelQueueId':_0x218426['id'],'interface':util[_0xe4f3('0x4b')](_0xe4f3('0x4c'),'SIP',_0x597ebf[_0xe4f3('0x3a')]),'penalty':0x0,'paused':_0x597ebf[_0xe4f3('0x4d')],'createdAt':_0x597ebf[_0xe4f3('0x49')],'updatedAt':_0x597ebf[_0xe4f3('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4f3('0x15')](respondWithFilteredResult(_0x398242,_0x3691b5))['catch'](handleError(_0x398242,null));};exports[_0xe4f3('0x4e')]=function(_0x3f5a61,_0x2a594a){var _0x53a788={};var _0x23dc81={};var _0x59c93e;var _0x124dae;return db[_0xe4f3('0x20')][_0xe4f3('0x3d')]({'where':{'id':_0x3f5a61['params']['id']}})['then'](handleEntityNotFound(_0x2a594a,null))[_0xe4f3('0x15')](function(_0x570616){if(_0x570616){_0x59c93e=_0x570616;_0x23dc81[_0xe4f3('0x28')]=_[_0xe4f3('0x29')](db[_0xe4f3('0x4f')]['rawAttributes']);_0x23dc81[_0xe4f3('0x2a')]=_[_0xe4f3('0x29')](_0x3f5a61['query']);_0x23dc81['filters']=_[_0xe4f3('0x2c')](_0x23dc81[_0xe4f3('0x28')],_0x23dc81['query']);_0x53a788[_0xe4f3('0x2e')]=_[_0xe4f3('0x2c')](_0x23dc81[_0xe4f3('0x28')],qs[_0xe4f3('0x2d')](_0x3f5a61['query'][_0xe4f3('0x2d')]));_0x53a788[_0xe4f3('0x2e')]=_0x53a788['attributes']['length']?_0x53a788['attributes']:_0x23dc81['model'];_0x53a788[_0xe4f3('0x41')]=qs[_0xe4f3('0x42')](_0x3f5a61[_0xe4f3('0x2a')]['sort']);_0x53a788[_0xe4f3('0x24')]=qs['filters'](_['pick'](_0x3f5a61['query'],_0x23dc81[_0xe4f3('0x2b')]));if(_0x3f5a61[_0xe4f3('0x2a')][_0xe4f3('0x44')]){_0x53a788['where']=_[_0xe4f3('0x30')](_0x53a788[_0xe4f3('0x24')],{'$or':_[_0xe4f3('0x1f')](_0x53a788[_0xe4f3('0x2e')],function(_0x5e80d0){var _0x20e604={};_0x20e604[_0x5e80d0]={'$like':'%'+_0x3f5a61['query'][_0xe4f3('0x44')]+'%'};return _0x20e604;})});}_0x53a788=_[_0xe4f3('0x30')]({},_0x53a788,_0x3f5a61[_0xe4f3('0x31')]);return _0x59c93e['getTeams'](_0x53a788);}})[_0xe4f3('0x15')](function(_0x565017){if(_0x565017){_0x124dae=_0x565017['length'];if(!_0x3f5a61[_0xe4f3('0x2a')][_0xe4f3('0x3f')](_0xe4f3('0x40'))){_0x53a788[_0xe4f3('0x11')]=qs[_0xe4f3('0x11')](_0x3f5a61[_0xe4f3('0x2a')][_0xe4f3('0x11')]);_0x53a788['offset']=qs[_0xe4f3('0x10')](_0x3f5a61[_0xe4f3('0x2a')]['offset']);}return _0x59c93e[_0xe4f3('0x4e')](_0x53a788);}})['then'](function(_0x583cd4){if(_0x583cd4){return _0x583cd4?{'count':_0x124dae,'rows':_0x583cd4}:null;}})[_0xe4f3('0x15')](respondWithResult(_0x2a594a,null))['catch'](handleError(_0x2a594a,null));};exports[_0xe4f3('0x50')]=function(_0xae5582,_0x10058f){var _0x415ca3=_0xae5582[_0xe4f3('0x33')][_0xe4f3('0x51')];return db[_0xe4f3('0x4f')][_0xe4f3('0x52')]({'where':{'id':_0x415ca3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe4f3('0x3a'),_0xe4f3('0x53'),_0xe4f3('0x54'),_0xe4f3('0x55')],'raw':!![]}]})[_0xe4f3('0x15')](function(_0x3b61a3){if(_0x3b61a3){var _0x3e3158=_[_0xe4f3('0x56')](_0x3b61a3,function(_0x2d409b){var _0x2e11a9=_0x2d409b[_0xe4f3('0x17')]({'plain':!![]});return _0x2e11a9[_0xe4f3('0x57')];});return db[_0xe4f3('0x20')]['find']({'where':{'id':_0xae5582['params']['id']}})[_0xe4f3('0x15')](function(_0x5ec7c0){return db['sequelize'][_0xe4f3('0x58')](function(_0x1ed44e){return _0x5ec7c0[_0xe4f3('0x50')](_0x415ca3,{'transaction':_0x1ed44e})[_0xe4f3('0x15')](function(){return BPromise[_0xe4f3('0x59')](_0x3e3158,function(_0x438353){return db[_0xe4f3('0x3e')][_0xe4f3('0x5a')]({'where':{'UserId':_0x438353['id'],'OpenchannelQueueId':_0xae5582[_0xe4f3('0x27')]['id']},'transaction':_0x1ed44e});});})['then'](function(){_0x3e3158[_0xe4f3('0x5b')](function(_0x1fc7a6){socket[_0xe4f3('0x5c')]('userOpenchannelQueue:save',{'UserId':_0x1fc7a6['id'],'OpenchannelQueueId':_0x5ec7c0['id']});});});});});}})[_0xe4f3('0x15')](respondWithStatusCode(_0x10058f,null))[_0xe4f3('0x32')](handleError(_0x10058f,null));};exports[_0xe4f3('0x5d')]=function(_0x1937a2,_0x22bd6b){return db[_0xe4f3('0x4f')]['findAll']({'where':{'id':_0x1937a2[_0xe4f3('0x2a')][_0xe4f3('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe4f3('0x57'),'attributes':['id'],'raw':!![]}]})[_0xe4f3('0x15')](handleEntityNotFound(_0x22bd6b,null))[_0xe4f3('0x15')](function(_0xc42ca0){var _0x3d28c9=_[_0xe4f3('0x1f')](_0xc42ca0,'id');var _0x3367d9=[];var _0x1606d4=[];var _0x1da310=squel[_0xe4f3('0x5e')]();_0x1da310[_0xe4f3('0x5f')](_0xe4f3('0x60'))[_0xe4f3('0x61')](_0xe4f3('0x62'),'tq')[_0xe4f3('0x63')](_0xe4f3('0x64'),'ut',_0xe4f3('0x65'))[_0xe4f3('0x24')](_0xe4f3('0x66'),_0x1937a2[_0xe4f3('0x27')]['id']);for(var _0x53e6d5=0x0;_0x53e6d5<_0xc42ca0[_0xe4f3('0x2f')];_0x53e6d5+=0x1){let _0x312701=_0xc42ca0[_0x53e6d5];for(var _0x400aad=0x0;_0x400aad<_0x312701[_0xe4f3('0x57')]['length'];_0x400aad+=0x1){let _0x32f499=_0x312701[_0xe4f3('0x57')][_0x400aad];var _0x5320ea=_0x1da310[_0xe4f3('0x67')]();_0x5320ea[_0xe4f3('0x24')]('ut.UserId\x20=\x20?',_0x32f499['id']);_0x1606d4[_0xe4f3('0x68')](db[_0xe4f3('0x69')]['query'](_0x5320ea['toString'](),{'type':db[_0xe4f3('0x69')][_0xe4f3('0x6a')][_0xe4f3('0x6b')]})[_0xe4f3('0x15')](function(_0x3d4d78){if(_0x3d4d78[_0xe4f3('0x2f')]===0x1){return _0x32f499['id'];}else{var _0x254544=_[_0xe4f3('0x6c')](_[_0xe4f3('0x1f')](_0x3d4d78,_0xe4f3('0x6d')),function(_0xa30b7f){return _['includes'](_0x3d28c9,_0xa30b7f);});if(_0x254544){return _0x32f499['id'];}}}));}}return BPromise[_0xe4f3('0x6e')](_0x1606d4)[_0xe4f3('0x15')](function(_0x3530fe){_0x3367d9=_(_0x3367d9)[_0xe4f3('0x6f')](_0x3530fe)['compact']()[_0xe4f3('0x70')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x1937a2[_0xe4f3('0x27')]['id']}})[_0xe4f3('0x15')](function(_0x5ae10a){return db[_0xe4f3('0x69')][_0xe4f3('0x58')](function(_0x29d345){return _0x5ae10a['removeTeams'](_0x1937a2['query'][_0xe4f3('0x51')],{'transaction':_0x29d345})['then'](function(){if(!_['isEmpty'](_0x3367d9)){return _0x5ae10a['removeAgents'](_0x3367d9,{'transaction':_0x29d345});}})[_0xe4f3('0x15')](function(){_0x3367d9[_0xe4f3('0x5b')](function(_0x15a42e){socket[_0xe4f3('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x15a42e,'OpenchannelQueueId':_0x5ae10a['id']});});});});});});})[_0xe4f3('0x15')](respondWithStatusCode(_0x22bd6b,null))['catch'](handleError(_0x22bd6b,null));};exports[_0xe4f3('0x71')]=function(_0x1071cc,_0x4ac538){return db['OpenchannelQueue'][_0xe4f3('0x38')]({'where':{'id':_0x1071cc['params']['id']}})[_0xe4f3('0x15')](handleEntityNotFound(_0x4ac538,null))['then'](function(_0x5d2af2){if(_0x5d2af2){return _0x5d2af2[_0xe4f3('0x71')](_0x1071cc[_0xe4f3('0x33')][_0xe4f3('0x51')],_[_0xe4f3('0x72')](_0x1071cc[_0xe4f3('0x33')],[_0xe4f3('0x51'),'id'])||{})['spread'](function(_0x5a72a2){for(var _0x52ae4c=0x0;_0x52ae4c<_0x1071cc[_0xe4f3('0x33')][_0xe4f3('0x51')][_0xe4f3('0x2f')];_0x52ae4c+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x1071cc[_0xe4f3('0x33')]['ids'][_0x52ae4c]),'OpenchannelQueueId':Number(_0x1071cc['params']['id'])});}return _0x5a72a2;});}})[_0xe4f3('0x15')](respondWithResult(_0x4ac538,null))[_0xe4f3('0x32')](handleError(_0x4ac538,null));};exports[_0xe4f3('0x73')]=function(_0x19ff3a,_0x27f8c3){return db[_0xe4f3('0x20')]['find']({'where':{'id':_0x19ff3a[_0xe4f3('0x27')]['id']}})[_0xe4f3('0x15')](handleEntityNotFound(_0x27f8c3,null))['then'](function(_0x47f251){if(_0x47f251){return _0x47f251[_0xe4f3('0x73')](_0x19ff3a[_0xe4f3('0x2a')][_0xe4f3('0x51')])[_0xe4f3('0x15')](function(){if(_['isArray'](_0x19ff3a[_0xe4f3('0x2a')]['ids'])){for(var _0x3648df=0x0;_0x3648df<_0x19ff3a[_0xe4f3('0x2a')][_0xe4f3('0x51')][_0xe4f3('0x2f')];_0x3648df+=0x1){socket[_0xe4f3('0x5c')](_0xe4f3('0x74'),{'UserId':Number(_0x19ff3a[_0xe4f3('0x2a')][_0xe4f3('0x51')][_0x3648df]),'OpenchannelQueueId':Number(_0x19ff3a['params']['id'])});}}else{socket[_0xe4f3('0x5c')](_0xe4f3('0x74'),{'UserId':Number(_0x19ff3a[_0xe4f3('0x2a')][_0xe4f3('0x51')]),'OpenchannelQueueId':Number(_0x19ff3a[_0xe4f3('0x27')]['id'])});}});}})[_0xe4f3('0x15')](respondWithStatusCode(_0x27f8c3,null))['catch'](handleError(_0x27f8c3,null));};exports[_0xe4f3('0x75')]=function(_0x29da7a,_0x1743fe){var _0xb915a4={};var _0x5be277={};var _0x144142;var _0x587ec2;return db[_0xe4f3('0x20')][_0xe4f3('0x3d')]({'where':{'id':_0x29da7a[_0xe4f3('0x27')]['id']}})[_0xe4f3('0x15')](handleEntityNotFound(_0x1743fe,null))[_0xe4f3('0x15')](function(_0x4eb5f3){if(_0x4eb5f3){_0x144142=_0x4eb5f3;_0x5be277[_0xe4f3('0x28')]=_['keys'](db['User'][_0xe4f3('0x21')]);_0x5be277[_0xe4f3('0x2a')]=_['keys'](_0x29da7a[_0xe4f3('0x2a')]);_0x5be277['filters']=_['intersection'](_0x5be277[_0xe4f3('0x28')],_0x5be277[_0xe4f3('0x2a')]);_0xb915a4[_0xe4f3('0x2e')]=_[_0xe4f3('0x2c')](_0x5be277[_0xe4f3('0x28')],qs[_0xe4f3('0x2d')](_0x29da7a[_0xe4f3('0x2a')][_0xe4f3('0x2d')]));_0xb915a4[_0xe4f3('0x2e')]=_0xb915a4[_0xe4f3('0x2e')]['length']?_0xb915a4[_0xe4f3('0x2e')]:_0x5be277[_0xe4f3('0x28')];_0xb915a4[_0xe4f3('0x41')]=qs[_0xe4f3('0x42')](_0x29da7a['query'][_0xe4f3('0x42')]);_0xb915a4[_0xe4f3('0x24')]=qs[_0xe4f3('0x2b')](_[_0xe4f3('0x76')](_0x29da7a['query'],_0x5be277[_0xe4f3('0x2b')]));if(_0x29da7a['query']['filter']){_0xb915a4[_0xe4f3('0x24')]=_['merge'](_0xb915a4['where'],{'$or':_[_0xe4f3('0x1f')](_0xb915a4[_0xe4f3('0x2e')],function(_0x581151){var _0x2d7aee={};_0x2d7aee[_0x581151]={'$like':'%'+_0x29da7a['query']['filter']+'%'};return _0x2d7aee;})});}_0xb915a4=_[_0xe4f3('0x30')]({},_0xb915a4,_0x29da7a['options']);return _0x144142[_0xe4f3('0x75')](_0xb915a4);}})[_0xe4f3('0x15')](function(_0x57978a){if(_0x57978a){_0x587ec2=_0x57978a[_0xe4f3('0x2f')];if(!_0x29da7a[_0xe4f3('0x2a')]['hasOwnProperty'](_0xe4f3('0x40'))){_0xb915a4['limit']=qs[_0xe4f3('0x11')](_0x29da7a[_0xe4f3('0x2a')]['limit']);_0xb915a4[_0xe4f3('0x10')]=qs[_0xe4f3('0x10')](_0x29da7a['query'][_0xe4f3('0x10')]);}return _0x144142[_0xe4f3('0x75')](_0xb915a4);}})['then'](function(_0x3c3972){if(_0x3c3972){return _0x3c3972?{'count':_0x587ec2,'rows':_0x3c3972}:null;}})[_0xe4f3('0x15')](respondWithResult(_0x1743fe,null))[_0xe4f3('0x32')](handleError(_0x1743fe,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7caa692..0ec2d98 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 _0xe5e3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','exports'];(function(_0x2e4cf0,_0x16f2b0){var _0x356ddb=function(_0x59c70f){while(--_0x59c70f){_0x2e4cf0['push'](_0x2e4cf0['shift']());}};_0x356ddb(++_0x16f2b0);}(_0xe5e3,0x1d0));var _0x3e5e=function(_0x213042,_0x1bbc02){_0x213042=_0x213042-0x0;var _0x351902=_0xe5e3[_0x213042];return _0x351902;};'use strict';var EventEmitter=require(_0x3e5e('0x0'));var OpenchannelQueue=require(_0x3e5e('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3e5e('0x2')](0x0);var events={'afterCreate':_0x3e5e('0x3'),'afterUpdate':_0x3e5e('0x4'),'afterDestroy':_0x3e5e('0x5')};function emitEvent(_0x2d9079){return function(_0x3bd080,_0x51ae27,_0x27bb40){OpenchannelQueueEvents[_0x3e5e('0x6')](_0x2d9079+':'+_0x3bd080['id'],_0x3bd080);OpenchannelQueueEvents[_0x3e5e('0x6')](_0x2d9079,_0x3bd080);_0x27bb40(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x3e5e('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xba4c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','OpenchannelQueue'];(function(_0x37699f,_0xf923c1){var _0x529822=function(_0x1fcf26){while(--_0x1fcf26){_0x37699f['push'](_0x37699f['shift']());}};_0x529822(++_0xf923c1);}(_0xba4c,0x8e));var _0xcba4=function(_0x2af87b,_0x5eafd4){_0x2af87b=_0x2af87b-0x0;var _0x8774fa=_0xba4c[_0x2af87b];return _0x8774fa;};'use strict';var EventEmitter=require(_0xcba4('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xcba4('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcba4('0x2')](0x0);var events={'afterCreate':_0xcba4('0x3'),'afterUpdate':_0xcba4('0x4'),'afterDestroy':_0xcba4('0x5')};function emitEvent(_0x12d8e3){return function(_0x50f2b5,_0x331951,_0x557e29){OpenchannelQueueEvents[_0xcba4('0x6')](_0x12d8e3+':'+_0x50f2b5['id'],_0x50f2b5);OpenchannelQueueEvents[_0xcba4('0x6')](_0x12d8e3,_0x50f2b5);_0x557e29(null);};}for(var e in events){if(events[_0xcba4('0x7')](e)){var event=events[e];OpenchannelQueue[_0xcba4('0x8')](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 2a08563..9134c36 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 _0x663a=['rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x25806f,_0x16dbdd){var _0x163f12=function(_0x3d1990){while(--_0x3d1990){_0x25806f['push'](_0x25806f['shift']());}};_0x163f12(++_0x16dbdd);}(_0x663a,0xb6));var _0xa663=function(_0x2a18be,_0x5b8641){_0x2a18be=_0x2a18be-0x0;var _0x9a5388=_0x663a[_0x2a18be];return _0x9a5388;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var logger=require(_0xa663('0x2'))(_0xa663('0x3'));var moment=require('moment');var BPromise=require(_0xa663('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa663('0x5'));var config=require('../../config/environment');var attributes=require(_0xa663('0x6'));module[_0xa663('0x7')]=function(_0xdcd916,_0x1f69cb){return _0xdcd916[_0xa663('0x8')](_0xa663('0x9'),attributes,{'tableName':_0xa663('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x683f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','openchannel_queues'];(function(_0x47863f,_0x1b37a9){var _0x1331c1=function(_0x888d38){while(--_0x888d38){_0x47863f['push'](_0x47863f['shift']());}};_0x1331c1(++_0x1b37a9);}(_0x683f,0x9c));var _0xf683=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x683f[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0xf683('0x0'));var util=require(_0xf683('0x1'));var logger=require(_0xf683('0x2'))('api');var moment=require(_0xf683('0x3'));var BPromise=require(_0xf683('0x4'));var rp=require(_0xf683('0x5'));var fs=require('fs');var path=require(_0xf683('0x6'));var rimraf=require(_0xf683('0x7'));var config=require(_0xf683('0x8'));var attributes=require(_0xf683('0x9'));module[_0xf683('0xa')]=function(_0x862f7a,_0x351954){return _0x862f7a['define']('OpenchannelQueue',attributes,{'tableName':_0xf683('0xb'),'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 637609f..da443b1 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 _0x4e82=['find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x452139,_0x4bdd9e){var _0x13abcb=function(_0x31a75c){while(--_0x31a75c){_0x452139['push'](_0x452139['shift']());}};_0x13abcb(++_0x4bdd9e);}(_0x4e82,0xe6));var _0x24e8=function(_0x1afca6,_0x1fce71){_0x1afca6=_0x1afca6-0x0;var _0xa92524=_0x4e82[_0x1afca6];return _0xa92524;};'use strict';var _=require('lodash');var util=require(_0x24e8('0x0'));var moment=require(_0x24e8('0x1'));var BPromise=require(_0x24e8('0x2'));var rs=require(_0x24e8('0x3'));var fs=require('fs');var Redis=require(_0x24e8('0x4'));var db=require(_0x24e8('0x5'))['db'];var utils=require(_0x24e8('0x6'));var logger=require(_0x24e8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x24e8('0x8'));var client=jayson[_0x24e8('0x9')]['http']({'port':0x232a});config[_0x24e8('0xa')]=_[_0x24e8('0xb')](config[_0x24e8('0xa')],{'host':_0x24e8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24e8('0xa')]));require(_0x24e8('0xd'))[_0x24e8('0xe')](socket);function respondWithRpcPromise(_0x3d94d0,_0x4c8f4f,_0x470607){return new BPromise(function(_0x127542,_0x26a2b0){return client[_0x24e8('0xf')](_0x3d94d0,_0x470607)[_0x24e8('0x10')](function(_0x4f667e){logger['info'](_0x24e8('0x11'),_0x4c8f4f,_0x24e8('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4c8f4f,'request\x20sent',JSON[_0x24e8('0x13')](_0x4f667e));if(_0x4f667e[_0x24e8('0x14')]){if(_0x4f667e[_0x24e8('0x14')][_0x24e8('0x15')]===0x1f4){logger['error'](_0x24e8('0x11'),_0x4c8f4f,_0x4f667e[_0x24e8('0x14')][_0x24e8('0x16')]);return _0x26a2b0(_0x4f667e[_0x24e8('0x14')][_0x24e8('0x16')]);}logger['error'](_0x24e8('0x11'),_0x4c8f4f,_0x4f667e[_0x24e8('0x14')][_0x24e8('0x16')]);return _0x127542(_0x4f667e[_0x24e8('0x14')][_0x24e8('0x16')]);}else{logger[_0x24e8('0x17')](_0x24e8('0x11'),_0x4c8f4f,'request\x20sent');_0x127542(_0x4f667e['result']['message']);}})[_0x24e8('0x18')](function(_0x43e78d){logger[_0x24e8('0x14')](_0x24e8('0x11'),_0x4c8f4f,_0x43e78d);_0x26a2b0(_0x43e78d);});});}exports[_0x24e8('0x19')]=function(_0x18ae30){var _0x4d9528=this;return new Promise(function(_0x2a7e36,_0x27fca0){return db[_0x24e8('0x1a')][_0x24e8('0x1b')]({'raw':_0x18ae30[_0x24e8('0x1c')]?_0x18ae30[_0x24e8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x18ae30['options']?_0x18ae30[_0x24e8('0x1c')][_0x24e8('0x1d')]||null:null,'attributes':_0x18ae30[_0x24e8('0x1c')]?_0x18ae30[_0x24e8('0x1c')][_0x24e8('0x1e')]||null:null,'limit':_0x18ae30[_0x24e8('0x1c')]?_0x18ae30['options'][_0x24e8('0x1f')]||null:null,'include':_0x18ae30[_0x24e8('0x1c')]?_0x18ae30[_0x24e8('0x1c')][_0x24e8('0x20')]?_[_0x24e8('0x21')](_0x18ae30[_0x24e8('0x1c')][_0x24e8('0x20')],function(_0x411aa){return{'model':db[_0x411aa['model']],'as':_0x411aa['as'],'attributes':_0x411aa[_0x24e8('0x1e')],'include':_0x411aa[_0x24e8('0x20')]?_[_0x24e8('0x21')](_0x411aa[_0x24e8('0x20')],function(_0x5cf007){return{'model':db[_0x5cf007[_0x24e8('0x22')]],'as':_0x5cf007['as'],'attributes':_0x5cf007[_0x24e8('0x1e')],'include':_0x5cf007[_0x24e8('0x20')]?_['map'](_0x5cf007['include'],function(_0xd0d1ff){return{'model':db[_0xd0d1ff[_0x24e8('0x22')]],'as':_0xd0d1ff['as'],'attributes':_0xd0d1ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x24e8('0x10')](function(_0x223efb){logger['info'](_0x24e8('0x19'),_0x18ae30);logger['debug'](_0x24e8('0x19'),_0x18ae30,JSON[_0x24e8('0x13')](_0x223efb));_0x2a7e36(_0x223efb);})[_0x24e8('0x18')](function(_0x1cf9ed){logger[_0x24e8('0x14')](_0x24e8('0x19'),_0x1cf9ed[_0x24e8('0x16')],_0x18ae30);_0x27fca0(_0x4d9528[_0x24e8('0x14')](0x1f4,_0x1cf9ed[_0x24e8('0x16')]));});});};exports[_0x24e8('0x23')]=function(_0x2420d1){var _0x18a8b5=this;return new Promise(function(_0x1abf85,_0x9646f9){return db[_0x24e8('0x1a')][_0x24e8('0x24')]({'raw':_0x2420d1[_0x24e8('0x1c')]?_0x2420d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2420d1[_0x24e8('0x1c')]?_0x2420d1[_0x24e8('0x1c')][_0x24e8('0x1d')]||null:null,'attributes':_0x2420d1[_0x24e8('0x1c')]?_0x2420d1['options'][_0x24e8('0x1e')]||null:null,'include':_0x2420d1[_0x24e8('0x1c')]?_0x2420d1[_0x24e8('0x1c')][_0x24e8('0x20')]?_['map'](_0x2420d1[_0x24e8('0x1c')][_0x24e8('0x20')],function(_0x54856d){return{'model':db[_0x54856d[_0x24e8('0x22')]],'as':_0x54856d['as'],'attributes':_0x54856d[_0x24e8('0x1e')],'include':_0x54856d[_0x24e8('0x20')]?_[_0x24e8('0x21')](_0x54856d[_0x24e8('0x20')],function(_0x46a8f2){return{'model':db[_0x46a8f2[_0x24e8('0x22')]],'as':_0x46a8f2['as'],'attributes':_0x46a8f2[_0x24e8('0x1e')],'include':_0x46a8f2[_0x24e8('0x20')]?_[_0x24e8('0x21')](_0x46a8f2[_0x24e8('0x20')],function(_0x5a59f2){return{'model':db[_0x5a59f2[_0x24e8('0x22')]],'as':_0x5a59f2['as'],'attributes':_0x5a59f2[_0x24e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x24e8('0x10')](function(_0x31e56f){logger[_0x24e8('0x17')](_0x24e8('0x23'),_0x2420d1);logger[_0x24e8('0x25')](_0x24e8('0x23'),_0x2420d1,JSON['stringify'](_0x31e56f));_0x1abf85(_0x31e56f);})['catch'](function(_0x261f3d){logger['error'](_0x24e8('0x23'),_0x261f3d['message'],_0x2420d1);_0x9646f9(_0x18a8b5[_0x24e8('0x14')](0x1f4,_0x261f3d[_0x24e8('0x16')]));});});}; \ No newline at end of file +var _0xc079=['debug','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','OpenchannelQueue','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc079,0x152));var _0x9c07=function(_0x85e870,_0x183c6a){_0x85e870=_0x85e870-0x0;var _0x542616=_0xc079[_0x85e870];return _0x542616;};'use strict';var _=require('lodash');var util=require(_0x9c07('0x0'));var moment=require(_0x9c07('0x1'));var BPromise=require(_0x9c07('0x2'));var rs=require(_0x9c07('0x3'));var fs=require('fs');var Redis=require(_0x9c07('0x4'));var db=require(_0x9c07('0x5'))['db'];var utils=require(_0x9c07('0x6'));var logger=require(_0x9c07('0x7'))(_0x9c07('0x8'));var config=require(_0x9c07('0x9'));var jayson=require(_0x9c07('0xa'));var client=jayson[_0x9c07('0xb')][_0x9c07('0xc')]({'port':0x232a});config[_0x9c07('0xd')]=_['defaults'](config['redis'],{'host':_0x9c07('0xe'),'port':0x18eb});var socket=require(_0x9c07('0xf'))(new Redis(config[_0x9c07('0xd')]));require('./openchannelQueue.socket')[_0x9c07('0x10')](socket);function respondWithRpcPromise(_0x346cbd,_0x5bb167,_0x47c541){return new BPromise(function(_0x315013,_0x1b03b2){return client[_0x9c07('0x11')](_0x346cbd,_0x47c541)[_0x9c07('0x12')](function(_0x42af40){logger[_0x9c07('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5bb167,_0x9c07('0x14'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5bb167,_0x9c07('0x14'),JSON['stringify'](_0x42af40));if(_0x42af40[_0x9c07('0x15')]){if(_0x42af40[_0x9c07('0x15')][_0x9c07('0x16')]===0x1f4){logger[_0x9c07('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5bb167,_0x42af40['error'][_0x9c07('0x17')]);return _0x1b03b2(_0x42af40[_0x9c07('0x15')][_0x9c07('0x17')]);}logger[_0x9c07('0x15')](_0x9c07('0x18'),_0x5bb167,_0x42af40['error']['message']);return _0x315013(_0x42af40['error'][_0x9c07('0x17')]);}else{logger[_0x9c07('0x13')](_0x9c07('0x18'),_0x5bb167,_0x9c07('0x14'));_0x315013(_0x42af40[_0x9c07('0x19')][_0x9c07('0x17')]);}})[_0x9c07('0x1a')](function(_0x2f31a9){logger[_0x9c07('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5bb167,_0x2f31a9);_0x1b03b2(_0x2f31a9);});});}exports[_0x9c07('0x1b')]=function(_0x10b64b){var _0x3e95e9=this;return new Promise(function(_0x26e047,_0x2751a5){return db['OpenchannelQueue'][_0x9c07('0x1c')]({'raw':_0x10b64b[_0x9c07('0x1d')]?_0x10b64b[_0x9c07('0x1d')][_0x9c07('0x1e')]===undefined?!![]:![]:!![],'where':_0x10b64b[_0x9c07('0x1d')]?_0x10b64b[_0x9c07('0x1d')][_0x9c07('0x1f')]||null:null,'attributes':_0x10b64b[_0x9c07('0x1d')]?_0x10b64b[_0x9c07('0x1d')][_0x9c07('0x20')]||null:null,'limit':_0x10b64b['options']?_0x10b64b[_0x9c07('0x1d')][_0x9c07('0x21')]||null:null,'include':_0x10b64b['options']?_0x10b64b['options'][_0x9c07('0x22')]?_['map'](_0x10b64b['options'][_0x9c07('0x22')],function(_0x8f2b65){return{'model':db[_0x8f2b65['model']],'as':_0x8f2b65['as'],'attributes':_0x8f2b65[_0x9c07('0x20')],'include':_0x8f2b65[_0x9c07('0x22')]?_['map'](_0x8f2b65[_0x9c07('0x22')],function(_0x179462){return{'model':db[_0x179462['model']],'as':_0x179462['as'],'attributes':_0x179462[_0x9c07('0x20')],'include':_0x179462[_0x9c07('0x22')]?_[_0x9c07('0x23')](_0x179462['include'],function(_0x33bdf1){return{'model':db[_0x33bdf1[_0x9c07('0x24')]],'as':_0x33bdf1['as'],'attributes':_0x33bdf1[_0x9c07('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9c07('0x12')](function(_0x15db3c){logger['info'](_0x9c07('0x1b'),_0x10b64b);logger['debug']('GetOpenchannelQueue',_0x10b64b,JSON[_0x9c07('0x25')](_0x15db3c));_0x26e047(_0x15db3c);})['catch'](function(_0x46666f){logger[_0x9c07('0x15')](_0x9c07('0x1b'),_0x46666f[_0x9c07('0x17')],_0x10b64b);_0x2751a5(_0x3e95e9['error'](0x1f4,_0x46666f[_0x9c07('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x28c72f){var _0x39e7f9=this;return new Promise(function(_0x580e24,_0x34161d){return db[_0x9c07('0x26')][_0x9c07('0x27')]({'raw':_0x28c72f['options']?_0x28c72f[_0x9c07('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28c72f[_0x9c07('0x1d')]?_0x28c72f['options'][_0x9c07('0x1f')]||null:null,'attributes':_0x28c72f[_0x9c07('0x1d')]?_0x28c72f['options'][_0x9c07('0x20')]||null:null,'include':_0x28c72f[_0x9c07('0x1d')]?_0x28c72f[_0x9c07('0x1d')][_0x9c07('0x22')]?_[_0x9c07('0x23')](_0x28c72f[_0x9c07('0x1d')][_0x9c07('0x22')],function(_0x1c45ea){return{'model':db[_0x1c45ea[_0x9c07('0x24')]],'as':_0x1c45ea['as'],'attributes':_0x1c45ea[_0x9c07('0x20')],'include':_0x1c45ea[_0x9c07('0x22')]?_['map'](_0x1c45ea[_0x9c07('0x22')],function(_0x57724d){return{'model':db[_0x57724d[_0x9c07('0x24')]],'as':_0x57724d['as'],'attributes':_0x57724d[_0x9c07('0x20')],'include':_0x57724d[_0x9c07('0x22')]?_[_0x9c07('0x23')](_0x57724d[_0x9c07('0x22')],function(_0x3c206d){return{'model':db[_0x3c206d['model']],'as':_0x3c206d['as'],'attributes':_0x3c206d[_0x9c07('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3326e5){logger['info']('ShowOpenchannelQueue',_0x28c72f);logger[_0x9c07('0x28')](_0x9c07('0x29'),_0x28c72f,JSON[_0x9c07('0x25')](_0x3326e5));_0x580e24(_0x3326e5);})[_0x9c07('0x1a')](function(_0x21f0cd){logger[_0x9c07('0x15')]('ShowOpenchannelQueue',_0x21f0cd[_0x9c07('0x17')],_0x28c72f);_0x34161d(_0x39e7f9['error'](0x1f4,_0x21f0cd[_0x9c07('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a50067d..16a5030 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 _0x6116=['./openchannelQueue.events','save','update','removeListener','register','length','openchannelQueue:'];(function(_0x45977b,_0x2d3f70){var _0x31f399=function(_0x48279f){while(--_0x48279f){_0x45977b['push'](_0x45977b['shift']());}};_0x31f399(++_0x2d3f70);}(_0x6116,0xf5));var _0x6611=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6116[_0x49b207];return _0x2dc8fa;};'use strict';var OpenchannelQueueEvents=require(_0x6611('0x0'));var events=[_0x6611('0x1'),'remove',_0x6611('0x2')];function createListener(_0x4a5d60,_0x20b3bf){return function(_0x523d9b){_0x20b3bf['emit'](_0x4a5d60,_0x523d9b);};}function removeListener(_0x4de6cb,_0x538784){return function(){OpenchannelQueueEvents[_0x6611('0x3')](_0x4de6cb,_0x538784);};}exports[_0x6611('0x4')]=function(_0x593930){for(var _0x15b0c8=0x0,_0xabc1a9=events[_0x6611('0x5')];_0x15b0c8<_0xabc1a9;_0x15b0c8++){var _0x3078c2=events[_0x15b0c8];var _0x36ade5=createListener(_0x6611('0x6')+_0x3078c2,_0x593930);OpenchannelQueueEvents['on'](_0x3078c2,_0x36ade5);}}; \ No newline at end of file +var _0x5f83=['removeListener','register','length','openchannelQueue:','save','emit'];(function(_0xc9af76,_0x385384){var _0x35b5d6=function(_0x2bd02a){while(--_0x2bd02a){_0xc9af76['push'](_0xc9af76['shift']());}};_0x35b5d6(++_0x385384);}(_0x5f83,0xe2));var _0x35f8=function(_0x2a208a,_0x3a40ca){_0x2a208a=_0x2a208a-0x0;var _0x5cf335=_0x5f83[_0x2a208a];return _0x5cf335;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x35f8('0x0'),'remove','update'];function createListener(_0xeec7b,_0x186d53){return function(_0x4d66eb){_0x186d53[_0x35f8('0x1')](_0xeec7b,_0x4d66eb);};}function removeListener(_0x4ffb08,_0x3f3095){return function(){OpenchannelQueueEvents[_0x35f8('0x2')](_0x4ffb08,_0x3f3095);};}exports[_0x35f8('0x3')]=function(_0x236fac){for(var _0x57cd68=0x0,_0x31397c=events[_0x35f8('0x4')];_0x57cd68<_0x31397c;_0x57cd68++){var _0x2bfb83=events[_0x57cd68];var _0x1b44e6=createListener(_0x35f8('0x5')+_0x2bfb83,_0x236fac);OpenchannelQueueEvents['on'](_0x2bfb83,_0x1b44e6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ddcb8ba..db50b46 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 _0x1600=['fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x3394f2,_0x159333){var _0x365f25=function(_0x4b3954){while(--_0x4b3954){_0x3394f2['push'](_0x3394f2['shift']());}};_0x365f25(++_0x159333);}(_0x1600,0xeb));var _0x0160=function(_0x366267,_0x2643f4){_0x366267=_0x366267-0x0;var _0x51e8ac=_0x1600[_0x366267];return _0x51e8ac;};'use strict';var multer=require(_0x0160('0x0'));var util=require('util');var path=require(_0x0160('0x1'));var timeout=require(_0x0160('0x2'));var express=require(_0x0160('0x3'));var router=express[_0x0160('0x4')]();var fs_extra=require(_0x0160('0x5'));var auth=require(_0x0160('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0160('0x7'));var controller=require(_0x0160('0x8'));router[_0x0160('0x9')]('/',auth[_0x0160('0xa')](),controller[_0x0160('0xb')]);router[_0x0160('0x9')](_0x0160('0xc'),auth['isAuthenticated'](),controller[_0x0160('0xd')]);router['get'](_0x0160('0xe'),auth['isAuthenticated'](),controller[_0x0160('0xf')]);router['post']('/',auth[_0x0160('0xa')](),controller[_0x0160('0x10')]);router['put']('/:id',auth[_0x0160('0xa')](),controller[_0x0160('0x11')]);router['delete'](_0x0160('0xe'),auth[_0x0160('0xa')](),controller[_0x0160('0x12')]);module[_0x0160('0x13')]=router; \ No newline at end of file +var _0x1d65=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1d65,0xc2));var _0x51d6=function(_0x470266,_0x1087ad){_0x470266=_0x470266-0x0;var _0xd3ed73=_0x1d65[_0x470266];return _0xd3ed73;};'use strict';var multer=require(_0x51d6('0x0'));var util=require(_0x51d6('0x1'));var path=require(_0x51d6('0x2'));var timeout=require(_0x51d6('0x3'));var express=require(_0x51d6('0x4'));var router=express[_0x51d6('0x5')]();var fs_extra=require(_0x51d6('0x6'));var auth=require(_0x51d6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51d6('0x8'));router[_0x51d6('0x9')]('/',auth[_0x51d6('0xa')](),controller[_0x51d6('0xb')]);router[_0x51d6('0x9')](_0x51d6('0xc'),auth[_0x51d6('0xa')](),controller[_0x51d6('0xd')]);router[_0x51d6('0x9')](_0x51d6('0xe'),auth[_0x51d6('0xa')](),controller['show']);router[_0x51d6('0xf')]('/',auth[_0x51d6('0xa')](),controller[_0x51d6('0x10')]);router[_0x51d6('0x11')]('/:id',auth[_0x51d6('0xa')](),controller['update']);router[_0x51d6('0x12')](_0x51d6('0xe'),auth[_0x51d6('0xa')](),controller[_0x51d6('0x13')]);module[_0x51d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 99dfb45..d3eae7a 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 _0x7076=['DATE','moment','exports','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7076,0x1b9));var _0x6707=function(_0x1a2aa0,_0x3bf731){_0x1a2aa0=_0x1a2aa0-0x0;var _0x3a9f87=_0x7076[_0x1a2aa0];return _0x3a9f87;};'use strict';var moment=require(_0x6707('0x0'));var Sequelize=require('sequelize');module[_0x6707('0x1')]={'uniqueid':{'type':Sequelize[_0x6707('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6707('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6707('0x3')]},'acceptAt':{'type':Sequelize[_0x6707('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xca17=['DATE','moment','sequelize','exports','STRING'];(function(_0x50b026,_0x4c653b){var _0xaad876=function(_0x579802){while(--_0x579802){_0x50b026['push'](_0x50b026['shift']());}};_0xaad876(++_0x4c653b);}(_0xca17,0xf1));var _0x7ca1=function(_0x24b3fd,_0x3d7922){_0x24b3fd=_0x24b3fd-0x0;var _0x5bebf4=_0xca17[_0x24b3fd];return _0x5bebf4;};'use strict';var moment=require(_0x7ca1('0x0'));var Sequelize=require(_0x7ca1('0x1'));module[_0x7ca1('0x2')]={'uniqueid':{'type':Sequelize[_0x7ca1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7ca1('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7ca1('0x4')]},'acceptAt':{'type':Sequelize[_0x7ca1('0x4')]},'exitAt':{'type':Sequelize[_0x7ca1('0x4')]},'reason':{'type':Sequelize[_0x7ca1('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 56fb371..62114bf 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 _0x9b46=['OpenchannelQueueReport','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x91d2c1,_0x2940cf){var _0x38d236=function(_0x113622){while(--_0x113622){_0x91d2c1['push'](_0x91d2c1['shift']());}};_0x38d236(++_0x2940cf);}(_0x9b46,0x193));var _0x69b4=function(_0x2bc75f,_0x5ab72e){_0x2bc75f=_0x2bc75f-0x0;var _0x57ce4a=_0x9b46[_0x2bc75f];return _0x57ce4a;};'use strict';var emlformat=require(_0x69b4('0x0'));var rimraf=require(_0x69b4('0x1'));var zipdir=require(_0x69b4('0x2'));var jsonpatch=require(_0x69b4('0x3'));var rp=require(_0x69b4('0x4'));var moment=require(_0x69b4('0x5'));var BPromise=require(_0x69b4('0x6'));var Mustache=require(_0x69b4('0x7'));var util=require(_0x69b4('0x8'));var path=require(_0x69b4('0x9'));var sox=require(_0x69b4('0xa'));var csv=require(_0x69b4('0xb'));var ejs=require(_0x69b4('0xc'));var fs=require('fs');var fs_extra=require(_0x69b4('0xd'));var _=require('lodash');var squel=require(_0x69b4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x69b4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x69b4('0x10'));var Papa=require(_0x69b4('0x11'));var Redis=require('ioredis');var authService=require(_0x69b4('0x12'));var qs=require(_0x69b4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69b4('0x14'));var logger=require(_0x69b4('0x15'))(_0x69b4('0x16'));var utils=require(_0x69b4('0x17'));var config=require(_0x69b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x69b4('0x19'))['db'];function respondWithStatusCode(_0x4fe584,_0xdf26b7){_0xdf26b7=_0xdf26b7||0xcc;return function(_0x23442f){if(_0x23442f){return _0x4fe584[_0x69b4('0x1a')](_0xdf26b7);}return _0x4fe584[_0x69b4('0x1b')](_0xdf26b7)[_0x69b4('0x1c')]();};}function respondWithResult(_0x3d4f52,_0x440120){_0x440120=_0x440120||0xc8;return function(_0xc3a0e8){if(_0xc3a0e8){return _0x3d4f52[_0x69b4('0x1b')](_0x440120)[_0x69b4('0x1d')](_0xc3a0e8);}};}function respondWithFilteredResult(_0x475aad,_0x2a154a){return function(_0x257db8){if(_0x257db8){var _0x10e6d3=typeof _0x2a154a[_0x69b4('0x1e')]===_0x69b4('0x1f')&&typeof _0x2a154a[_0x69b4('0x20')]===_0x69b4('0x1f');var _0x2fe5a7=_0x257db8[_0x69b4('0x21')];var _0x9ac5bd=_0x10e6d3?0x0:_0x2a154a['offset'];var _0x469b42=_0x10e6d3?_0x257db8[_0x69b4('0x21')]:_0x2a154a[_0x69b4('0x1e')]+_0x2a154a[_0x69b4('0x20')];var _0x1ed04b;if(_0x469b42>=_0x2fe5a7){_0x469b42=_0x2fe5a7;_0x1ed04b=0xc8;}else{_0x1ed04b=0xce;}_0x475aad['status'](_0x1ed04b);return _0x475aad[_0x69b4('0x22')]('Content-Range',_0x9ac5bd+'-'+_0x469b42+'/'+_0x2fe5a7)['json'](_0x257db8);}return null;};}function patchUpdates(_0x348300){return function(_0x4458d6){try{jsonpatch['apply'](_0x4458d6,_0x348300,!![]);}catch(_0x48f4ca){return BPromise[_0x69b4('0x23')](_0x48f4ca);}return _0x4458d6[_0x69b4('0x24')]();};}function saveUpdates(_0x2a99b3,_0x4aca30){return function(_0x5d1236){if(_0x5d1236){return _0x5d1236[_0x69b4('0x25')](_0x2a99b3)[_0x69b4('0x26')](function(_0x10e93f){return _0x10e93f;});}return null;};}function removeEntity(_0x53bd10,_0x1fc092){return function(_0x57095b){if(_0x57095b){return _0x57095b[_0x69b4('0x27')]()[_0x69b4('0x26')](function(){_0x53bd10[_0x69b4('0x1b')](0xcc)[_0x69b4('0x1c')]();});}};}function handleEntityNotFound(_0x456e0b,_0x10fdc7){return function(_0x557ca6){if(!_0x557ca6){_0x456e0b[_0x69b4('0x1a')](0x194);}return _0x557ca6;};}function handleError(_0x59df13,_0x3f1cc6){_0x3f1cc6=_0x3f1cc6||0x1f4;return function(_0x25953e){logger['error'](_0x25953e['stack']);if(_0x25953e[_0x69b4('0x28')]){delete _0x25953e['name'];}_0x59df13[_0x69b4('0x1b')](_0x3f1cc6)[_0x69b4('0x29')](_0x25953e);};}exports[_0x69b4('0x2a')]=function(_0x3882b2,_0x2b683a){var _0x3736a5={},_0x127ba1={},_0x25f005={'count':0x0,'rows':[]};var _0x5a7371=_[_0x69b4('0x2b')](db['OpenchannelQueueReport'][_0x69b4('0x2c')],function(_0x1cc685){return{'name':_0x1cc685[_0x69b4('0x2d')],'type':_0x1cc685[_0x69b4('0x2e')][_0x69b4('0x2f')]};});_0x127ba1['model']=_['map'](_0x5a7371,_0x69b4('0x28'));_0x127ba1['query']=_[_0x69b4('0x30')](_0x3882b2[_0x69b4('0x31')]);_0x127ba1[_0x69b4('0x32')]=_['intersection'](_0x127ba1[_0x69b4('0x33')],_0x127ba1[_0x69b4('0x31')]);_0x3736a5['attributes']=_[_0x69b4('0x34')](_0x127ba1[_0x69b4('0x33')],qs[_0x69b4('0x35')](_0x3882b2[_0x69b4('0x31')][_0x69b4('0x35')]));_0x3736a5['attributes']=_0x3736a5[_0x69b4('0x36')]['length']?_0x3736a5['attributes']:_0x127ba1['model'];if(!_0x3882b2[_0x69b4('0x31')][_0x69b4('0x37')](_0x69b4('0x38'))){_0x3736a5[_0x69b4('0x20')]=qs[_0x69b4('0x20')](_0x3882b2['query']['limit']);_0x3736a5[_0x69b4('0x1e')]=qs[_0x69b4('0x1e')](_0x3882b2[_0x69b4('0x31')][_0x69b4('0x1e')]);}_0x3736a5[_0x69b4('0x39')]=qs[_0x69b4('0x3a')](_0x3882b2[_0x69b4('0x31')][_0x69b4('0x3a')]);_0x3736a5[_0x69b4('0x3b')]=qs[_0x69b4('0x32')](_[_0x69b4('0x3c')](_0x3882b2[_0x69b4('0x31')],_0x127ba1[_0x69b4('0x32')]),_0x5a7371);if(_0x3882b2[_0x69b4('0x31')][_0x69b4('0x3d')]){_0x3736a5[_0x69b4('0x3b')]=_[_0x69b4('0x3e')](_0x3736a5[_0x69b4('0x3b')],{'$or':_['map'](_0x5a7371,function(_0x359199){if(_0x359199[_0x69b4('0x2e')]!==_0x69b4('0x3f')){var _0x5aff6f={};_0x5aff6f[_0x359199[_0x69b4('0x28')]]={'$like':'%'+_0x3882b2['query'][_0x69b4('0x3d')]+'%'};return _0x5aff6f;}})});}_0x3736a5=_[_0x69b4('0x3e')]({},_0x3736a5,_0x3882b2[_0x69b4('0x40')]);var _0x202748={'where':_0x3736a5[_0x69b4('0x3b')]};return db[_0x69b4('0x41')]['count'](_0x202748)[_0x69b4('0x26')](function(_0x2d1c9b){_0x25f005['count']=_0x2d1c9b;if(_0x3882b2[_0x69b4('0x31')]['includeAll']){_0x3736a5[_0x69b4('0x42')]=[{'all':!![]}];}return db[_0x69b4('0x41')][_0x69b4('0x43')](_0x3736a5);})['then'](function(_0x339928){_0x25f005[_0x69b4('0x44')]=_0x339928;return _0x25f005;})['then'](respondWithFilteredResult(_0x2b683a,_0x3736a5))['catch'](handleError(_0x2b683a,null));};exports[_0x69b4('0x45')]=function(_0x24a8a1,_0x2b9fa7){var _0x5ce12d={'raw':!![],'where':{'id':_0x24a8a1[_0x69b4('0x46')]['id']}},_0x1ea0bd={};_0x1ea0bd['model']=_[_0x69b4('0x30')](db['OpenchannelQueueReport']['rawAttributes']);_0x1ea0bd[_0x69b4('0x31')]=_[_0x69b4('0x30')](_0x24a8a1['query']);_0x1ea0bd[_0x69b4('0x32')]=_[_0x69b4('0x34')](_0x1ea0bd[_0x69b4('0x33')],_0x1ea0bd[_0x69b4('0x31')]);_0x5ce12d[_0x69b4('0x36')]=_[_0x69b4('0x34')](_0x1ea0bd['model'],qs[_0x69b4('0x35')](_0x24a8a1['query'][_0x69b4('0x35')]));_0x5ce12d[_0x69b4('0x36')]=_0x5ce12d[_0x69b4('0x36')][_0x69b4('0x47')]?_0x5ce12d[_0x69b4('0x36')]:_0x1ea0bd[_0x69b4('0x33')];if(_0x24a8a1[_0x69b4('0x31')][_0x69b4('0x48')]){_0x5ce12d[_0x69b4('0x42')]=[{'all':!![]}];}_0x5ce12d=_[_0x69b4('0x3e')]({},_0x5ce12d,_0x24a8a1[_0x69b4('0x40')]);return db[_0x69b4('0x41')][_0x69b4('0x49')](_0x5ce12d)['then'](handleEntityNotFound(_0x2b9fa7,null))['then'](respondWithResult(_0x2b9fa7,null))[_0x69b4('0x4a')](handleError(_0x2b9fa7,null));};exports[_0x69b4('0x4b')]=function(_0x436b60,_0x49c14d){return db[_0x69b4('0x41')][_0x69b4('0x4b')](_0x436b60[_0x69b4('0x4c')],{})['then'](respondWithResult(_0x49c14d,0xc9))[_0x69b4('0x4a')](handleError(_0x49c14d,null));};exports['update']=function(_0x47fcbb,_0x409d79){if(_0x47fcbb['body']['id']){delete _0x47fcbb['body']['id'];}return db[_0x69b4('0x41')]['find']({'where':{'id':_0x47fcbb[_0x69b4('0x46')]['id']}})['then'](handleEntityNotFound(_0x409d79,null))['then'](saveUpdates(_0x47fcbb[_0x69b4('0x4c')],null))['then'](respondWithResult(_0x409d79,null))[_0x69b4('0x4a')](handleError(_0x409d79,null));};exports[_0x69b4('0x27')]=function(_0x9302f,_0x59af89){return db[_0x69b4('0x41')]['find']({'where':{'id':_0x9302f['params']['id']}})['then'](handleEntityNotFound(_0x59af89,null))[_0x69b4('0x26')](removeEntity(_0x59af89,null))[_0x69b4('0x4a')](handleError(_0x59af89,null));};exports[_0x69b4('0x4d')]=function(_0x13334e,_0xf44370){return db[_0x69b4('0x41')]['describe']()['then'](respondWithResult(_0xf44370,null))[_0x69b4('0x4a')](handleError(_0xf44370,null));}; \ No newline at end of file +var _0x8146=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','key','map','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','update','body','describe','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0x16aee0,_0x483696){var _0x3a32cf=function(_0x45c6dd){while(--_0x45c6dd){_0x16aee0['push'](_0x16aee0['shift']());}};_0x3a32cf(++_0x483696);}(_0x8146,0x120));var _0x6814=function(_0xe49211,_0x25d19c){_0xe49211=_0xe49211-0x0;var _0x5d1e5c=_0x8146[_0xe49211];return _0x5d1e5c;};'use strict';var emlformat=require(_0x6814('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6814('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6814('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6814('0x3'));var util=require(_0x6814('0x4'));var path=require(_0x6814('0x5'));var sox=require(_0x6814('0x6'));var csv=require(_0x6814('0x7'));var ejs=require(_0x6814('0x8'));var fs=require('fs');var fs_extra=require(_0x6814('0x9'));var _=require(_0x6814('0xa'));var squel=require(_0x6814('0xb'));var crypto=require(_0x6814('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6814('0x7'));var querystring=require(_0x6814('0xd'));var Papa=require(_0x6814('0xe'));var Redis=require(_0x6814('0xf'));var authService=require(_0x6814('0x10'));var qs=require(_0x6814('0x11'));var as=require(_0x6814('0x12'));var hardwareService=require(_0x6814('0x13'));var logger=require(_0x6814('0x14'))(_0x6814('0x15'));var utils=require(_0x6814('0x16'));var config=require(_0x6814('0x17'));var licenseUtil=require(_0x6814('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26c10d,_0x5b0431){_0x5b0431=_0x5b0431||0xcc;return function(_0x140b61){if(_0x140b61){return _0x26c10d[_0x6814('0x19')](_0x5b0431);}return _0x26c10d['status'](_0x5b0431)['end']();};}function respondWithResult(_0x5df602,_0x322499){_0x322499=_0x322499||0xc8;return function(_0x568d52){if(_0x568d52){return _0x5df602[_0x6814('0x1a')](_0x322499)['json'](_0x568d52);}};}function respondWithFilteredResult(_0x476e54,_0xee219d){return function(_0x5d9441){if(_0x5d9441){var _0x1787b3=typeof _0xee219d[_0x6814('0x1b')]===_0x6814('0x1c')&&typeof _0xee219d[_0x6814('0x1d')]==='undefined';var _0x3d6130=_0x5d9441[_0x6814('0x1e')];var _0x17513a=_0x1787b3?0x0:_0xee219d['offset'];var _0x32327b=_0x1787b3?_0x5d9441[_0x6814('0x1e')]:_0xee219d['offset']+_0xee219d[_0x6814('0x1d')];var _0xb784e8;if(_0x32327b>=_0x3d6130){_0x32327b=_0x3d6130;_0xb784e8=0xc8;}else{_0xb784e8=0xce;}_0x476e54[_0x6814('0x1a')](_0xb784e8);return _0x476e54[_0x6814('0x1f')](_0x6814('0x20'),_0x17513a+'-'+_0x32327b+'/'+_0x3d6130)[_0x6814('0x21')](_0x5d9441);}return null;};}function patchUpdates(_0x32a028){return function(_0x4d5308){try{jsonpatch['apply'](_0x4d5308,_0x32a028,!![]);}catch(_0x55e79e){return BPromise[_0x6814('0x22')](_0x55e79e);}return _0x4d5308[_0x6814('0x23')]();};}function saveUpdates(_0x2442aa,_0xed81c0){return function(_0x57073c){if(_0x57073c){return _0x57073c['update'](_0x2442aa)[_0x6814('0x24')](function(_0x2bd4cd){return _0x2bd4cd;});}return null;};}function removeEntity(_0x9284c1,_0x1774e1){return function(_0x2baab7){if(_0x2baab7){return _0x2baab7[_0x6814('0x25')]()['then'](function(){_0x9284c1[_0x6814('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235438,_0x3f62e4){return function(_0x173592){if(!_0x173592){_0x235438['sendStatus'](0x194);}return _0x173592;};}function handleError(_0x35a610,_0x47a99a){_0x47a99a=_0x47a99a||0x1f4;return function(_0x366610){logger[_0x6814('0x26')](_0x366610[_0x6814('0x27')]);if(_0x366610[_0x6814('0x28')]){delete _0x366610[_0x6814('0x28')];}_0x35a610['status'](_0x47a99a)[_0x6814('0x29')](_0x366610);};}exports[_0x6814('0x2a')]=function(_0x22c2ed,_0x43e988){var _0x434d3e={},_0x4d42a8={},_0x5292c5={'count':0x0,'rows':[]};var _0x13eeec=_['map'](db[_0x6814('0x2b')][_0x6814('0x2c')],function(_0x1c04a3){return{'name':_0x1c04a3['fieldName'],'type':_0x1c04a3['type'][_0x6814('0x2d')]};});_0x4d42a8['model']=_[_0x6814('0x2e')](_0x13eeec,'name');_0x4d42a8['query']=_[_0x6814('0x2f')](_0x22c2ed[_0x6814('0x30')]);_0x4d42a8['filters']=_[_0x6814('0x31')](_0x4d42a8['model'],_0x4d42a8[_0x6814('0x30')]);_0x434d3e[_0x6814('0x32')]=_[_0x6814('0x31')](_0x4d42a8[_0x6814('0x33')],qs[_0x6814('0x34')](_0x22c2ed[_0x6814('0x30')][_0x6814('0x34')]));_0x434d3e[_0x6814('0x32')]=_0x434d3e[_0x6814('0x32')]['length']?_0x434d3e[_0x6814('0x32')]:_0x4d42a8['model'];if(!_0x22c2ed[_0x6814('0x30')][_0x6814('0x35')](_0x6814('0x36'))){_0x434d3e[_0x6814('0x1d')]=qs[_0x6814('0x1d')](_0x22c2ed[_0x6814('0x30')][_0x6814('0x1d')]);_0x434d3e[_0x6814('0x1b')]=qs['offset'](_0x22c2ed[_0x6814('0x30')][_0x6814('0x1b')]);}_0x434d3e[_0x6814('0x37')]=qs[_0x6814('0x38')](_0x22c2ed[_0x6814('0x30')][_0x6814('0x38')]);_0x434d3e['where']=qs[_0x6814('0x39')](_[_0x6814('0x3a')](_0x22c2ed[_0x6814('0x30')],_0x4d42a8[_0x6814('0x39')]),_0x13eeec);if(_0x22c2ed[_0x6814('0x30')]['filter']){_0x434d3e[_0x6814('0x3b')]=_[_0x6814('0x3c')](_0x434d3e['where'],{'$or':_['map'](_0x13eeec,function(_0x5d5587){if(_0x5d5587[_0x6814('0x3d')]!==_0x6814('0x3e')){var _0x53059e={};_0x53059e[_0x5d5587['name']]={'$like':'%'+_0x22c2ed[_0x6814('0x30')]['filter']+'%'};return _0x53059e;}})});}_0x434d3e=_[_0x6814('0x3c')]({},_0x434d3e,_0x22c2ed[_0x6814('0x3f')]);var _0x93b2b6={'where':_0x434d3e[_0x6814('0x3b')]};return db[_0x6814('0x2b')][_0x6814('0x1e')](_0x93b2b6)[_0x6814('0x24')](function(_0x1e07c6){_0x5292c5['count']=_0x1e07c6;if(_0x22c2ed['query'][_0x6814('0x40')]){_0x434d3e['include']=[{'all':!![]}];}return db[_0x6814('0x2b')]['findAll'](_0x434d3e);})[_0x6814('0x24')](function(_0xd49866){_0x5292c5[_0x6814('0x41')]=_0xd49866;return _0x5292c5;})[_0x6814('0x24')](respondWithFilteredResult(_0x43e988,_0x434d3e))[_0x6814('0x42')](handleError(_0x43e988,null));};exports[_0x6814('0x43')]=function(_0x49247b,_0x571a78){var _0x4b848d={'raw':!![],'where':{'id':_0x49247b[_0x6814('0x44')]['id']}},_0x27cd3d={};_0x27cd3d[_0x6814('0x33')]=_[_0x6814('0x2f')](db[_0x6814('0x2b')][_0x6814('0x2c')]);_0x27cd3d['query']=_[_0x6814('0x2f')](_0x49247b[_0x6814('0x30')]);_0x27cd3d[_0x6814('0x39')]=_['intersection'](_0x27cd3d['model'],_0x27cd3d['query']);_0x4b848d[_0x6814('0x32')]=_[_0x6814('0x31')](_0x27cd3d['model'],qs[_0x6814('0x34')](_0x49247b[_0x6814('0x30')][_0x6814('0x34')]));_0x4b848d['attributes']=_0x4b848d['attributes'][_0x6814('0x45')]?_0x4b848d[_0x6814('0x32')]:_0x27cd3d[_0x6814('0x33')];if(_0x49247b[_0x6814('0x30')][_0x6814('0x40')]){_0x4b848d[_0x6814('0x46')]=[{'all':!![]}];}_0x4b848d=_[_0x6814('0x3c')]({},_0x4b848d,_0x49247b[_0x6814('0x3f')]);return db[_0x6814('0x2b')][_0x6814('0x47')](_0x4b848d)[_0x6814('0x24')](handleEntityNotFound(_0x571a78,null))[_0x6814('0x24')](respondWithResult(_0x571a78,null))['catch'](handleError(_0x571a78,null));};exports['create']=function(_0x51447c,_0x166efe){return db[_0x6814('0x2b')][_0x6814('0x48')](_0x51447c['body'],{})[_0x6814('0x24')](respondWithResult(_0x166efe,0xc9))[_0x6814('0x42')](handleError(_0x166efe,null));};exports[_0x6814('0x49')]=function(_0x128edb,_0xb5f07){if(_0x128edb[_0x6814('0x4a')]['id']){delete _0x128edb[_0x6814('0x4a')]['id'];}return db[_0x6814('0x2b')][_0x6814('0x47')]({'where':{'id':_0x128edb[_0x6814('0x44')]['id']}})[_0x6814('0x24')](handleEntityNotFound(_0xb5f07,null))['then'](saveUpdates(_0x128edb[_0x6814('0x4a')],null))[_0x6814('0x24')](respondWithResult(_0xb5f07,null))[_0x6814('0x42')](handleError(_0xb5f07,null));};exports[_0x6814('0x25')]=function(_0x4a48df,_0x56658e){return db[_0x6814('0x2b')][_0x6814('0x47')]({'where':{'id':_0x4a48df[_0x6814('0x44')]['id']}})['then'](handleEntityNotFound(_0x56658e,null))['then'](removeEntity(_0x56658e,null))[_0x6814('0x42')](handleError(_0x56658e,null));};exports[_0x6814('0x4b')]=function(_0x3a7a22,_0x37c35b){return db['OpenchannelQueueReport']['describe']()[_0x6814('0x24')](respondWithResult(_0x37c35b,null))[_0x6814('0x42')](handleError(_0x37c35b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a5050c7..c8eb46c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x18eb5d,_0x48d6fc){var _0x1147d8=function(_0x49c658){while(--_0x49c658){_0x18eb5d['push'](_0x18eb5d['shift']());}};_0x1147d8(++_0x48d6fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0xe50afe,_0x1d6961){var _0x2e9a79=function(_0x28e008){while(--_0x28e008){_0xe50afe['push'](_0xe50afe['shift']());}};_0x2e9a79(++_0x1d6961);}(_0x326f,0xd1));var _0xf326=function(_0x59eb18,_0x2ad17e){_0x59eb18=_0x59eb18-0x0;var _0x45e443=_0x326f[_0x59eb18];return _0x45e443;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 25668ac..334a3b6 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 _0x4fad=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x4fad,0xcb));var _0xd4fa=function(_0xa6d522,_0x23c878){_0xa6d522=_0xa6d522-0x0;var _0x275af4=_0x4fad[_0xa6d522];return _0x275af4;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b426,_0x2b9f6a,_0x19a910){return new BPromise(function(_0x155c09,_0x3fff99){return client[_0xd4fa('0xc')](_0x52b426,_0x19a910)['then'](function(_0x26a894){logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,'request\x20sent');logger[_0xd4fa('0xf')](_0xd4fa('0x10'),_0x2b9f6a,_0xd4fa('0x11'),JSON[_0xd4fa('0x12')](_0x26a894));if(_0x26a894['error']){if(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x14')]===0x1f4){logger[_0xd4fa('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9f6a,_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);return _0x3fff99(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}logger[_0xd4fa('0x13')](_0xd4fa('0xe'),_0x2b9f6a,_0x26a894['error'][_0xd4fa('0x15')]);return _0x155c09(_0x26a894[_0xd4fa('0x13')][_0xd4fa('0x15')]);}else{logger[_0xd4fa('0xd')](_0xd4fa('0xe'),_0x2b9f6a,_0xd4fa('0x11'));_0x155c09(_0x26a894[_0xd4fa('0x16')]['message']);}})[_0xd4fa('0x17')](function(_0x3a3b8c){logger[_0xd4fa('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2b9f6a,_0x3a3b8c);_0x3fff99(_0x3a3b8c);});});}exports['CreateOpenchannelQueueReport']=function(_0x1faa0b){var _0x5601d6=this;return new Promise(function(_0x5df190,_0x1f9be1){return db[_0xd4fa('0x18')][_0xd4fa('0x19')](_0x1faa0b[_0xd4fa('0x1a')],{'raw':_0x1faa0b['options']?_0x1faa0b[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xbf7dcf){logger['info']('CreateOpenchannelQueueReport',_0x1faa0b);logger[_0xd4fa('0xf')](_0xd4fa('0x1d'),_0x1faa0b,JSON[_0xd4fa('0x12')](_0xbf7dcf));_0x5df190(_0xbf7dcf);})[_0xd4fa('0x17')](function(_0x586af0){logger[_0xd4fa('0x13')](_0xd4fa('0x1d'),_0x586af0[_0xd4fa('0x15')],_0x1faa0b);_0x1f9be1(_0x5601d6[_0xd4fa('0x13')](0x1f4,_0x586af0[_0xd4fa('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2a9d07){var _0x14ea6e=this;return new Promise(function(_0x4c5836,_0x162459){return db[_0xd4fa('0x18')][_0xd4fa('0x1e')](_0x2a9d07[_0xd4fa('0x1a')],{'raw':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07[_0xd4fa('0x1b')][_0xd4fa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07[_0xd4fa('0x1b')]['where']||null:null,'attributes':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07['options'][_0xd4fa('0x1f')]||null:null,'limit':_0x2a9d07[_0xd4fa('0x1b')]?_0x2a9d07['options'][_0xd4fa('0x20')]||null:null})[_0xd4fa('0x21')](function(_0x1b16ba){logger['info'](_0xd4fa('0x22'),_0x2a9d07);logger[_0xd4fa('0xf')]('UpdateOpenchannelQueueReport',_0x2a9d07,JSON[_0xd4fa('0x12')](_0x1b16ba));_0x4c5836(_0x1b16ba);})[_0xd4fa('0x17')](function(_0x5455a2){logger[_0xd4fa('0x13')](_0xd4fa('0x22'),_0x5455a2[_0xd4fa('0x15')],_0x2a9d07);_0x162459(_0x14ea6e[_0xd4fa('0x13')](0x1f4,_0x5455a2[_0xd4fa('0x15')]));});});}; \ No newline at end of file +var _0x5f66=['error','info','catch','CreateOpenchannelQueueReport','create','raw','update','body','options','where','attributes','limit','UpdateOpenchannelQueueReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','message'];(function(_0xd79494,_0x1fcda7){var _0x1c1698=function(_0x15e012){while(--_0x15e012){_0xd79494['push'](_0xd79494['shift']());}};_0x1c1698(++_0x1fcda7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'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')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['OpenchannelQueueReport'][_0x65f6('0x16')](_0x1f974c['body'],{'raw':_0x1f974c['options']?_0x1f974c['options'][_0x65f6('0x17')]===undefined?!![]:![]:!![]})[_0x65f6('0xa')](function(_0x5114a4){logger[_0x65f6('0x13')](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON[_0x65f6('0xf')](_0x5114a4));_0x18380e(_0x5114a4);})[_0x65f6('0x14')](function(_0x581374){logger[_0x65f6('0x12')]('CreateOpenchannelQueueReport',_0x581374['message'],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x581374[_0x65f6('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1eeaaa){var _0x471a33=this;return new Promise(function(_0x2317ce,_0x2774a1){return db['OpenchannelQueueReport'][_0x65f6('0x18')](_0x1eeaaa[_0x65f6('0x19')],{'raw':_0x1eeaaa[_0x65f6('0x1a')]?_0x1eeaaa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eeaaa['options']?_0x1eeaaa[_0x65f6('0x1a')][_0x65f6('0x1b')]||null:null,'attributes':_0x1eeaaa['options']?_0x1eeaaa[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'limit':_0x1eeaaa['options']?_0x1eeaaa[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null})[_0x65f6('0xa')](function(_0x559330){logger['info']('UpdateOpenchannelQueueReport',_0x1eeaaa);logger[_0x65f6('0xd')](_0x65f6('0x1e'),_0x1eeaaa,JSON[_0x65f6('0xf')](_0x559330));_0x2317ce(_0x559330);})[_0x65f6('0x14')](function(_0x518cac){logger[_0x65f6('0x12')](_0x65f6('0x1e'),_0x518cac['message'],_0x1eeaaa);_0x2774a1(_0x471a33['error'](0x1f4,_0x518cac[_0x65f6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 02266a9..99facb9 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 _0xbeab=['describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x191ea1,_0x5cce51){var _0x227b0e=function(_0x488b8c){while(--_0x488b8c){_0x191ea1['push'](_0x191ea1['shift']());}};_0x227b0e(++_0x5cce51);}(_0xbeab,0x168));var _0xbbea=function(_0x2bca19,_0x5f00f5){_0x2bca19=_0x2bca19-0x0;var _0x50e341=_0xbeab[_0x2bca19];return _0x50e341;};'use strict';var multer=require(_0xbbea('0x0'));var util=require(_0xbbea('0x1'));var path=require(_0xbbea('0x2'));var timeout=require(_0xbbea('0x3'));var express=require(_0xbbea('0x4'));var router=express[_0xbbea('0x5')]();var fs_extra=require(_0xbbea('0x6'));var auth=require(_0xbbea('0x7'));var interaction=require(_0xbbea('0x8'));var config=require(_0xbbea('0x9'));var controller=require(_0xbbea('0xa'));router[_0xbbea('0xb')]('/',auth[_0xbbea('0xc')](),controller['index']);router[_0xbbea('0xb')](_0xbbea('0xd'),auth[_0xbbea('0xc')](),controller[_0xbbea('0xe')]);router[_0xbbea('0xb')](_0xbbea('0xf'),auth['isAuthenticated'](),controller[_0xbbea('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbbea('0x11')]);router[_0xbbea('0x12')](_0xbbea('0xf'),auth['isAuthenticated'](),controller[_0xbbea('0x13')]);router[_0xbbea('0x14')](_0xbbea('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xbbea('0x15')]=router; \ No newline at end of file +var _0xc7b5=['index','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x5bfd89,_0x169c51){var _0x39a583=function(_0x4f26e4){while(--_0x4f26e4){_0x5bfd89['push'](_0x5bfd89['shift']());}};_0x39a583(++_0x169c51);}(_0xc7b5,0x14e));var _0x5c7b=function(_0x5bc2d4,_0x603504){_0x5bc2d4=_0x5bc2d4-0x0;var _0x2a8d9c=_0xc7b5[_0x5bc2d4];return _0x2a8d9c;};'use strict';var multer=require(_0x5c7b('0x0'));var util=require(_0x5c7b('0x1'));var path=require(_0x5c7b('0x2'));var timeout=require(_0x5c7b('0x3'));var express=require(_0x5c7b('0x4'));var router=express[_0x5c7b('0x5')]();var fs_extra=require(_0x5c7b('0x6'));var auth=require(_0x5c7b('0x7'));var interaction=require(_0x5c7b('0x8'));var config=require(_0x5c7b('0x9'));var controller=require(_0x5c7b('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5c7b('0xb')]);router[_0x5c7b('0xc')]('/describe',auth[_0x5c7b('0xd')](),controller['describe']);router[_0x5c7b('0xc')]('/:id',auth[_0x5c7b('0xd')](),controller[_0x5c7b('0xe')]);router[_0x5c7b('0xf')]('/',auth[_0x5c7b('0xd')](),controller[_0x5c7b('0x10')]);router[_0x5c7b('0x11')](_0x5c7b('0x12'),auth[_0x5c7b('0xd')](),controller[_0x5c7b('0x13')]);router[_0x5c7b('0x14')](_0x5c7b('0x12'),auth[_0x5c7b('0xd')](),controller[_0x5c7b('0x15')]);module[_0x5c7b('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5585995..567b749 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x416e97,_0x427261){var _0x47f0ea=function(_0x42d664){while(--_0x42d664){_0x416e97['push'](_0x416e97['shift']());}};_0x47f0ea(++_0x427261);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0xf3cd[_0x25d4ee];return _0x214a35;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0xc288fb,_0x37b7b6){var _0x24b53a=function(_0x4d4883){while(--_0x4d4883){_0xc288fb['push'](_0xc288fb['shift']());}};_0x24b53a(++_0x37b7b6);}(_0xe706,0xa3));var _0x6e70=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0xe706[_0x1a72b8];return _0x39f72d;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e509858..e71bb3a 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 _0x200b=['sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','create','body','catch','find','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x215e93,_0x49eea9){var _0x17abbb=function(_0x4e9ef0){while(--_0x4e9ef0){_0x215e93['push'](_0x215e93['shift']());}};_0x17abbb(++_0x49eea9);}(_0x200b,0x159));var _0xb200=function(_0x2deae8,_0x10666c){_0x2deae8=_0x2deae8-0x0;var _0x744cd6=_0x200b[_0x2deae8];return _0x744cd6;};'use strict';var emlformat=require(_0xb200('0x0'));var rimraf=require(_0xb200('0x1'));var zipdir=require(_0xb200('0x2'));var jsonpatch=require(_0xb200('0x3'));var rp=require(_0xb200('0x4'));var moment=require(_0xb200('0x5'));var BPromise=require(_0xb200('0x6'));var Mustache=require(_0xb200('0x7'));var util=require('util');var path=require(_0xb200('0x8'));var sox=require(_0xb200('0x9'));var csv=require(_0xb200('0xa'));var ejs=require(_0xb200('0xb'));var fs=require('fs');var fs_extra=require(_0xb200('0xc'));var _=require(_0xb200('0xd'));var squel=require(_0xb200('0xe'));var crypto=require('crypto');var jsforce=require(_0xb200('0xf'));var deskjs=require(_0xb200('0x10'));var toCsv=require(_0xb200('0xa'));var querystring=require('querystring');var Papa=require(_0xb200('0x11'));var Redis=require(_0xb200('0x12'));var authService=require(_0xb200('0x13'));var qs=require(_0xb200('0x14'));var as=require(_0xb200('0x15'));var hardwareService=require(_0xb200('0x16'));var logger=require('../../config/logger')(_0xb200('0x17'));var utils=require(_0xb200('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22687d,_0x14b226){_0x14b226=_0x14b226||0xcc;return function(_0x479de9){if(_0x479de9){return _0x22687d[_0xb200('0x19')](_0x14b226);}return _0x22687d[_0xb200('0x1a')](_0x14b226)[_0xb200('0x1b')]();};}function respondWithResult(_0xb67af9,_0x340af8){_0x340af8=_0x340af8||0xc8;return function(_0x1ac43d){if(_0x1ac43d){return _0xb67af9['status'](_0x340af8)[_0xb200('0x1c')](_0x1ac43d);}};}function respondWithFilteredResult(_0x2bee08,_0x5c3a76){return function(_0x2c5c56){if(_0x2c5c56){var _0x16842b=typeof _0x5c3a76[_0xb200('0x1d')]===_0xb200('0x1e')&&typeof _0x5c3a76[_0xb200('0x1f')]===_0xb200('0x1e');var _0x152cda=_0x2c5c56[_0xb200('0x20')];var _0x296b71=_0x16842b?0x0:_0x5c3a76['offset'];var _0x40bac0=_0x16842b?_0x2c5c56['count']:_0x5c3a76[_0xb200('0x1d')]+_0x5c3a76[_0xb200('0x1f')];var _0x42e8f8;if(_0x40bac0>=_0x152cda){_0x40bac0=_0x152cda;_0x42e8f8=0xc8;}else{_0x42e8f8=0xce;}_0x2bee08[_0xb200('0x1a')](_0x42e8f8);return _0x2bee08['set']('Content-Range',_0x296b71+'-'+_0x40bac0+'/'+_0x152cda)[_0xb200('0x1c')](_0x2c5c56);}return null;};}function patchUpdates(_0x5175d2){return function(_0x543e3f){try{jsonpatch[_0xb200('0x21')](_0x543e3f,_0x5175d2,!![]);}catch(_0x373c5f){return BPromise['reject'](_0x373c5f);}return _0x543e3f[_0xb200('0x22')]();};}function saveUpdates(_0x21c2e3,_0x3f10be){return function(_0xc2b70b){if(_0xc2b70b){return _0xc2b70b[_0xb200('0x23')](_0x21c2e3)[_0xb200('0x24')](function(_0x4e2cbe){return _0x4e2cbe;});}return null;};}function removeEntity(_0xb0c31,_0x2cbdd7){return function(_0x460ba8){if(_0x460ba8){return _0x460ba8[_0xb200('0x25')]()['then'](function(){_0xb0c31[_0xb200('0x1a')](0xcc)[_0xb200('0x1b')]();});}};}function handleEntityNotFound(_0x5c659b,_0xa2ccc4){return function(_0x40fc3d){if(!_0x40fc3d){_0x5c659b[_0xb200('0x19')](0x194);}return _0x40fc3d;};}function handleError(_0x377bbc,_0x11532e){_0x11532e=_0x11532e||0x1f4;return function(_0x1205b8){logger[_0xb200('0x26')](_0x1205b8[_0xb200('0x27')]);if(_0x1205b8[_0xb200('0x28')]){delete _0x1205b8[_0xb200('0x28')];}_0x377bbc[_0xb200('0x1a')](_0x11532e)[_0xb200('0x29')](_0x1205b8);};}exports['index']=function(_0x3abb79,_0x16776b){var _0x1acc9a={},_0x58b99e={},_0x543f24={'count':0x0,'rows':[]};var _0x4e12c8=_[_0xb200('0x2a')](db[_0xb200('0x2b')][_0xb200('0x2c')],function(_0x371c9c){return{'name':_0x371c9c['fieldName'],'type':_0x371c9c['type'][_0xb200('0x2d')]};});_0x58b99e['model']=_[_0xb200('0x2a')](_0x4e12c8,'name');_0x58b99e[_0xb200('0x2e')]=_['keys'](_0x3abb79[_0xb200('0x2e')]);_0x58b99e[_0xb200('0x2f')]=_[_0xb200('0x30')](_0x58b99e[_0xb200('0x31')],_0x58b99e[_0xb200('0x2e')]);_0x1acc9a[_0xb200('0x32')]=_[_0xb200('0x30')](_0x58b99e[_0xb200('0x31')],qs[_0xb200('0x33')](_0x3abb79[_0xb200('0x2e')][_0xb200('0x33')]));_0x1acc9a[_0xb200('0x32')]=_0x1acc9a[_0xb200('0x32')][_0xb200('0x34')]?_0x1acc9a['attributes']:_0x58b99e[_0xb200('0x31')];if(!_0x3abb79[_0xb200('0x2e')][_0xb200('0x35')]('nolimit')){_0x1acc9a[_0xb200('0x1f')]=qs[_0xb200('0x1f')](_0x3abb79[_0xb200('0x2e')]['limit']);_0x1acc9a['offset']=qs[_0xb200('0x1d')](_0x3abb79[_0xb200('0x2e')][_0xb200('0x1d')]);}_0x1acc9a[_0xb200('0x36')]=qs[_0xb200('0x37')](_0x3abb79[_0xb200('0x2e')]['sort']);_0x1acc9a[_0xb200('0x38')]=qs[_0xb200('0x2f')](_[_0xb200('0x39')](_0x3abb79[_0xb200('0x2e')],_0x58b99e[_0xb200('0x2f')]),_0x4e12c8);if(_0x3abb79[_0xb200('0x2e')][_0xb200('0x3a')]){_0x1acc9a[_0xb200('0x38')]=_[_0xb200('0x3b')](_0x1acc9a[_0xb200('0x38')],{'$or':_[_0xb200('0x2a')](_0x4e12c8,function(_0x47d880){if(_0x47d880[_0xb200('0x3c')]!==_0xb200('0x3d')){var _0x46476e={};_0x46476e[_0x47d880['name']]={'$like':'%'+_0x3abb79['query'][_0xb200('0x3a')]+'%'};return _0x46476e;}})});}_0x1acc9a=_[_0xb200('0x3b')]({},_0x1acc9a,_0x3abb79[_0xb200('0x3e')]);var _0x2eb058={'where':_0x1acc9a[_0xb200('0x38')]};return db[_0xb200('0x2b')][_0xb200('0x20')](_0x2eb058)[_0xb200('0x24')](function(_0x2a5d29){_0x543f24['count']=_0x2a5d29;if(_0x3abb79[_0xb200('0x2e')][_0xb200('0x3f')]){_0x1acc9a[_0xb200('0x40')]=[{'all':!![]}];}return db[_0xb200('0x2b')][_0xb200('0x41')](_0x1acc9a);})['then'](function(_0x31f6a0){_0x543f24[_0xb200('0x42')]=_0x31f6a0;return _0x543f24;})[_0xb200('0x24')](respondWithFilteredResult(_0x16776b,_0x1acc9a))['catch'](handleError(_0x16776b,null));};exports['show']=function(_0x29fd43,_0x1246ee){var _0x97495c={'raw':!![],'where':{'id':_0x29fd43[_0xb200('0x43')]['id']}},_0x4a8677={};_0x4a8677['model']=_[_0xb200('0x44')](db[_0xb200('0x2b')][_0xb200('0x2c')]);_0x4a8677[_0xb200('0x2e')]=_[_0xb200('0x44')](_0x29fd43[_0xb200('0x2e')]);_0x4a8677[_0xb200('0x2f')]=_['intersection'](_0x4a8677[_0xb200('0x31')],_0x4a8677[_0xb200('0x2e')]);_0x97495c[_0xb200('0x32')]=_[_0xb200('0x30')](_0x4a8677['model'],qs[_0xb200('0x33')](_0x29fd43['query']['fields']));_0x97495c[_0xb200('0x32')]=_0x97495c['attributes']['length']?_0x97495c[_0xb200('0x32')]:_0x4a8677[_0xb200('0x31')];if(_0x29fd43['query'][_0xb200('0x3f')]){_0x97495c['include']=[{'all':!![]}];}_0x97495c=_[_0xb200('0x3b')]({},_0x97495c,_0x29fd43[_0xb200('0x3e')]);return db['OpenchannelTransferReport']['find'](_0x97495c)[_0xb200('0x24')](handleEntityNotFound(_0x1246ee,null))['then'](respondWithResult(_0x1246ee,null))['catch'](handleError(_0x1246ee,null));};exports['create']=function(_0x155bb3,_0x6cd079){return db[_0xb200('0x2b')][_0xb200('0x45')](_0x155bb3[_0xb200('0x46')],{})[_0xb200('0x24')](respondWithResult(_0x6cd079,0xc9))[_0xb200('0x47')](handleError(_0x6cd079,null));};exports[_0xb200('0x23')]=function(_0x491238,_0x2ab034){if(_0x491238[_0xb200('0x46')]['id']){delete _0x491238['body']['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x491238[_0xb200('0x43')]['id']}})[_0xb200('0x24')](handleEntityNotFound(_0x2ab034,null))[_0xb200('0x24')](saveUpdates(_0x491238[_0xb200('0x46')],null))[_0xb200('0x24')](respondWithResult(_0x2ab034,null))['catch'](handleError(_0x2ab034,null));};exports[_0xb200('0x25')]=function(_0x3ec810,_0x383ab1){return db[_0xb200('0x2b')][_0xb200('0x48')]({'where':{'id':_0x3ec810[_0xb200('0x43')]['id']}})['then'](handleEntityNotFound(_0x383ab1,null))['then'](removeEntity(_0x383ab1,null))['catch'](handleError(_0x383ab1,null));};exports[_0xb200('0x49')]=function(_0x1b0d8f,_0x439fd2){return db['OpenchannelTransferReport'][_0xb200('0x49')]()[_0xb200('0x24')](respondWithResult(_0x439fd2,null))[_0xb200('0x47')](handleError(_0x439fd2,null));}; \ No newline at end of file +var _0xb6fb=['nolimit','order','sort','where','merge','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x5bbaac,_0x34a7f1){var _0x454b28=function(_0x1bd500){while(--_0x1bd500){_0x5bbaac['push'](_0x5bbaac['shift']());}};_0x454b28(++_0x34a7f1);}(_0xb6fb,0x1c3));var _0xbb6f=function(_0x4a339c,_0x1230f9){_0x4a339c=_0x4a339c-0x0;var _0x3f4953=_0xb6fb[_0x4a339c];return _0x3f4953;};'use strict';var emlformat=require(_0xbb6f('0x0'));var rimraf=require(_0xbb6f('0x1'));var zipdir=require(_0xbb6f('0x2'));var jsonpatch=require(_0xbb6f('0x3'));var rp=require(_0xbb6f('0x4'));var moment=require(_0xbb6f('0x5'));var BPromise=require(_0xbb6f('0x6'));var Mustache=require(_0xbb6f('0x7'));var util=require(_0xbb6f('0x8'));var path=require(_0xbb6f('0x9'));var sox=require('sox');var csv=require(_0xbb6f('0xa'));var ejs=require(_0xbb6f('0xb'));var fs=require('fs');var fs_extra=require(_0xbb6f('0xc'));var _=require(_0xbb6f('0xd'));var squel=require('squel');var crypto=require(_0xbb6f('0xe'));var jsforce=require(_0xbb6f('0xf'));var deskjs=require(_0xbb6f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbb6f('0x11'));var Papa=require(_0xbb6f('0x12'));var Redis=require(_0xbb6f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb6f('0x14'));var hardwareService=require(_0xbb6f('0x15'));var logger=require(_0xbb6f('0x16'))('api');var utils=require(_0xbb6f('0x17'));var config=require(_0xbb6f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53a859,_0x36ca14){_0x36ca14=_0x36ca14||0xcc;return function(_0x227f09){if(_0x227f09){return _0x53a859[_0xbb6f('0x19')](_0x36ca14);}return _0x53a859['status'](_0x36ca14)[_0xbb6f('0x1a')]();};}function respondWithResult(_0x2a2844,_0x4e1493){_0x4e1493=_0x4e1493||0xc8;return function(_0x28e218){if(_0x28e218){return _0x2a2844[_0xbb6f('0x1b')](_0x4e1493)['json'](_0x28e218);}};}function respondWithFilteredResult(_0x5f5a2e,_0x4712e8){return function(_0x5b68f2){if(_0x5b68f2){var _0x5f57c4=typeof _0x4712e8[_0xbb6f('0x1c')]==='undefined'&&typeof _0x4712e8[_0xbb6f('0x1d')]==='undefined';var _0x36ec30=_0x5b68f2[_0xbb6f('0x1e')];var _0x5eece1=_0x5f57c4?0x0:_0x4712e8[_0xbb6f('0x1c')];var _0x1727cb=_0x5f57c4?_0x5b68f2['count']:_0x4712e8[_0xbb6f('0x1c')]+_0x4712e8[_0xbb6f('0x1d')];var _0x192455;if(_0x1727cb>=_0x36ec30){_0x1727cb=_0x36ec30;_0x192455=0xc8;}else{_0x192455=0xce;}_0x5f5a2e[_0xbb6f('0x1b')](_0x192455);return _0x5f5a2e['set'](_0xbb6f('0x1f'),_0x5eece1+'-'+_0x1727cb+'/'+_0x36ec30)[_0xbb6f('0x20')](_0x5b68f2);}return null;};}function patchUpdates(_0x4f5188){return function(_0x483dd1){try{jsonpatch[_0xbb6f('0x21')](_0x483dd1,_0x4f5188,!![]);}catch(_0x5beace){return BPromise[_0xbb6f('0x22')](_0x5beace);}return _0x483dd1[_0xbb6f('0x23')]();};}function saveUpdates(_0x878184,_0x40eb4d){return function(_0x161c9a){if(_0x161c9a){return _0x161c9a[_0xbb6f('0x24')](_0x878184)[_0xbb6f('0x25')](function(_0x87c06b){return _0x87c06b;});}return null;};}function removeEntity(_0x1f164a,_0x212aba){return function(_0x1ea76c){if(_0x1ea76c){return _0x1ea76c['destroy']()[_0xbb6f('0x25')](function(){_0x1f164a['status'](0xcc)[_0xbb6f('0x1a')]();});}};}function handleEntityNotFound(_0x40feac,_0x4cfad5){return function(_0x1cd672){if(!_0x1cd672){_0x40feac[_0xbb6f('0x19')](0x194);}return _0x1cd672;};}function handleError(_0x3b9244,_0x5840e9){_0x5840e9=_0x5840e9||0x1f4;return function(_0x5040c0){logger[_0xbb6f('0x26')](_0x5040c0[_0xbb6f('0x27')]);if(_0x5040c0[_0xbb6f('0x28')]){delete _0x5040c0[_0xbb6f('0x28')];}_0x3b9244[_0xbb6f('0x1b')](_0x5840e9)['send'](_0x5040c0);};}exports['index']=function(_0xf968c5,_0x466dda){var _0x750983={},_0x31285c={},_0x346b42={'count':0x0,'rows':[]};var _0x5e6531=_[_0xbb6f('0x29')](db['OpenchannelTransferReport'][_0xbb6f('0x2a')],function(_0x35011f){return{'name':_0x35011f['fieldName'],'type':_0x35011f[_0xbb6f('0x2b')]['key']};});_0x31285c[_0xbb6f('0x2c')]=_[_0xbb6f('0x29')](_0x5e6531,_0xbb6f('0x28'));_0x31285c[_0xbb6f('0x2d')]=_[_0xbb6f('0x2e')](_0xf968c5[_0xbb6f('0x2d')]);_0x31285c[_0xbb6f('0x2f')]=_['intersection'](_0x31285c[_0xbb6f('0x2c')],_0x31285c['query']);_0x750983['attributes']=_[_0xbb6f('0x30')](_0x31285c[_0xbb6f('0x2c')],qs[_0xbb6f('0x31')](_0xf968c5['query'][_0xbb6f('0x31')]));_0x750983[_0xbb6f('0x32')]=_0x750983[_0xbb6f('0x32')][_0xbb6f('0x33')]?_0x750983[_0xbb6f('0x32')]:_0x31285c[_0xbb6f('0x2c')];if(!_0xf968c5[_0xbb6f('0x2d')][_0xbb6f('0x34')](_0xbb6f('0x35'))){_0x750983[_0xbb6f('0x1d')]=qs[_0xbb6f('0x1d')](_0xf968c5['query'][_0xbb6f('0x1d')]);_0x750983['offset']=qs[_0xbb6f('0x1c')](_0xf968c5['query'][_0xbb6f('0x1c')]);}_0x750983[_0xbb6f('0x36')]=qs[_0xbb6f('0x37')](_0xf968c5[_0xbb6f('0x2d')][_0xbb6f('0x37')]);_0x750983['where']=qs[_0xbb6f('0x2f')](_['pick'](_0xf968c5[_0xbb6f('0x2d')],_0x31285c[_0xbb6f('0x2f')]),_0x5e6531);if(_0xf968c5[_0xbb6f('0x2d')]['filter']){_0x750983[_0xbb6f('0x38')]=_[_0xbb6f('0x39')](_0x750983[_0xbb6f('0x38')],{'$or':_[_0xbb6f('0x29')](_0x5e6531,function(_0x2c29df){if(_0x2c29df['type']!==_0xbb6f('0x3a')){var _0x5d7342={};_0x5d7342[_0x2c29df['name']]={'$like':'%'+_0xf968c5[_0xbb6f('0x2d')][_0xbb6f('0x3b')]+'%'};return _0x5d7342;}})});}_0x750983=_[_0xbb6f('0x39')]({},_0x750983,_0xf968c5[_0xbb6f('0x3c')]);var _0x3b3044={'where':_0x750983[_0xbb6f('0x38')]};return db[_0xbb6f('0x3d')][_0xbb6f('0x1e')](_0x3b3044)['then'](function(_0x2ef772){_0x346b42[_0xbb6f('0x1e')]=_0x2ef772;if(_0xf968c5[_0xbb6f('0x2d')][_0xbb6f('0x3e')]){_0x750983[_0xbb6f('0x3f')]=[{'all':!![]}];}return db[_0xbb6f('0x3d')]['findAll'](_0x750983);})['then'](function(_0x586e34){_0x346b42[_0xbb6f('0x40')]=_0x586e34;return _0x346b42;})[_0xbb6f('0x25')](respondWithFilteredResult(_0x466dda,_0x750983))[_0xbb6f('0x41')](handleError(_0x466dda,null));};exports['show']=function(_0x2f46dc,_0x479281){var _0x187fb0={'raw':!![],'where':{'id':_0x2f46dc[_0xbb6f('0x42')]['id']}},_0x4e11d8={};_0x4e11d8['model']=_[_0xbb6f('0x2e')](db[_0xbb6f('0x3d')][_0xbb6f('0x2a')]);_0x4e11d8[_0xbb6f('0x2d')]=_[_0xbb6f('0x2e')](_0x2f46dc['query']);_0x4e11d8[_0xbb6f('0x2f')]=_['intersection'](_0x4e11d8[_0xbb6f('0x2c')],_0x4e11d8[_0xbb6f('0x2d')]);_0x187fb0[_0xbb6f('0x32')]=_['intersection'](_0x4e11d8['model'],qs['fields'](_0x2f46dc[_0xbb6f('0x2d')][_0xbb6f('0x31')]));_0x187fb0[_0xbb6f('0x32')]=_0x187fb0[_0xbb6f('0x32')]['length']?_0x187fb0[_0xbb6f('0x32')]:_0x4e11d8[_0xbb6f('0x2c')];if(_0x2f46dc['query'][_0xbb6f('0x3e')]){_0x187fb0[_0xbb6f('0x3f')]=[{'all':!![]}];}_0x187fb0=_[_0xbb6f('0x39')]({},_0x187fb0,_0x2f46dc['options']);return db['OpenchannelTransferReport'][_0xbb6f('0x43')](_0x187fb0)[_0xbb6f('0x25')](handleEntityNotFound(_0x479281,null))[_0xbb6f('0x25')](respondWithResult(_0x479281,null))['catch'](handleError(_0x479281,null));};exports[_0xbb6f('0x44')]=function(_0x15c407,_0x26bc7c){return db[_0xbb6f('0x3d')][_0xbb6f('0x44')](_0x15c407['body'],{})[_0xbb6f('0x25')](respondWithResult(_0x26bc7c,0xc9))[_0xbb6f('0x41')](handleError(_0x26bc7c,null));};exports[_0xbb6f('0x24')]=function(_0x29c358,_0x587e3d){if(_0x29c358[_0xbb6f('0x45')]['id']){delete _0x29c358[_0xbb6f('0x45')]['id'];}return db[_0xbb6f('0x3d')]['find']({'where':{'id':_0x29c358[_0xbb6f('0x42')]['id']}})[_0xbb6f('0x25')](handleEntityNotFound(_0x587e3d,null))[_0xbb6f('0x25')](saveUpdates(_0x29c358[_0xbb6f('0x45')],null))['then'](respondWithResult(_0x587e3d,null))[_0xbb6f('0x41')](handleError(_0x587e3d,null));};exports[_0xbb6f('0x46')]=function(_0x388bd4,_0x2162be){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x388bd4[_0xbb6f('0x42')]['id']}})[_0xbb6f('0x25')](handleEntityNotFound(_0x2162be,null))[_0xbb6f('0x25')](removeEntity(_0x2162be,null))[_0xbb6f('0x41')](handleError(_0x2162be,null));};exports[_0xbb6f('0x47')]=function(_0x921d24,_0x2adda9){return db[_0xbb6f('0x3d')]['describe']()['then'](respondWithResult(_0x2adda9,null))[_0xbb6f('0x41')](handleError(_0x2adda9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 2c8ea64..9a31afd 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 _0x5e0c=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x177f6a,_0x27dd23){var _0x1844be=function(_0x39a6a4){while(--_0x39a6a4){_0x177f6a['push'](_0x177f6a['shift']());}};_0x1844be(++_0x27dd23);}(_0x5e0c,0x141));var _0xc5e0=function(_0x22b2df,_0x59214b){_0x22b2df=_0x22b2df-0x0;var _0x3ddde7=_0x5e0c[_0x22b2df];return _0x3ddde7;};'use strict';var _=require(_0xc5e0('0x0'));var util=require(_0xc5e0('0x1'));var logger=require(_0xc5e0('0x2'))(_0xc5e0('0x3'));var moment=require(_0xc5e0('0x4'));var BPromise=require(_0xc5e0('0x5'));var rp=require(_0xc5e0('0x6'));var fs=require('fs');var path=require(_0xc5e0('0x7'));var rimraf=require(_0xc5e0('0x8'));var config=require(_0xc5e0('0x9'));var attributes=require(_0xc5e0('0xa'));module[_0xc5e0('0xb')]=function(_0x344365,_0x1b4fb0){return _0x344365[_0xc5e0('0xc')](_0xc5e0('0xd'),attributes,{'tableName':_0xc5e0('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x48e2=['../../config/logger','api','moment','path','exports','define','report_openchannel_transfer','uniqueid','util'];(function(_0x6c6280,_0x2f6cc0){var _0x269d50=function(_0x53593c){while(--_0x53593c){_0x6c6280['push'](_0x6c6280['shift']());}};_0x269d50(++_0x2f6cc0);}(_0x48e2,0x143));var _0x248e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x48e2[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x248e('0x0'));var logger=require(_0x248e('0x1'))(_0x248e('0x2'));var moment=require(_0x248e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x248e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x248e('0x5')]=function(_0x115927,_0x4398a1){return _0x115927[_0x248e('0x6')]('OpenchannelTransferReport',attributes,{'tableName':_0x248e('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x248e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9f9cee2..0703e10 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 _0x5334=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3f6479,_0x24dc1c){var _0x55d3c2=function(_0x4d8158){while(--_0x4d8158){_0x3f6479['push'](_0x3f6479['shift']());}};_0x55d3c2(++_0x24dc1c);}(_0x5334,0x84));var _0x4533=function(_0x31cee2,_0xb921bd){_0x31cee2=_0x31cee2-0x0;var _0x162b19=_0x5334[_0x31cee2];return _0x162b19;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var BPromise=require(_0x4533('0x3'));var rs=require(_0x4533('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4533('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4533('0x6'))(_0x4533('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4533('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dea06,_0x4d89e7,_0x487906){return new BPromise(function(_0x3fbdc3,_0x42f94b){return client[_0x4533('0x9')](_0x4dea06,_0x487906)[_0x4533('0xa')](function(_0x31018b){logger[_0x4533('0xb')](_0x4533('0xc'),_0x4d89e7,'request\x20sent');logger[_0x4533('0xd')](_0x4533('0xe'),_0x4d89e7,_0x4533('0xf'),JSON[_0x4533('0x10')](_0x31018b));if(_0x31018b['error']){if(_0x31018b[_0x4533('0x11')]['code']===0x1f4){logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')][_0x4533('0x12')]);return _0x42f94b(_0x31018b['error'][_0x4533('0x12')]);}logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')]['message']);return _0x3fbdc3(_0x31018b[_0x4533('0x11')]['message']);}else{logger['info'](_0x4533('0xc'),_0x4d89e7,_0x4533('0xf'));_0x3fbdc3(_0x31018b['result'][_0x4533('0x12')]);}})[_0x4533('0x13')](function(_0x2a9877){logger['error'](_0x4533('0xc'),_0x4d89e7,_0x2a9877);_0x42f94b(_0x2a9877);});});} \ No newline at end of file +var _0x0689=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1db612,_0x572609){var _0x47c65a=function(_0x41be92){while(--_0x41be92){_0x1db612['push'](_0x1db612['shift']());}};_0x47c65a(++_0x572609);}(_0x0689,0x161));var _0x9068=function(_0x16eb30,_0x20177d){_0x16eb30=_0x16eb30-0x0;var _0x40de38=_0x0689[_0x16eb30];return _0x40de38;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require('moment');var BPromise=require(_0x9068('0x1'));var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var jayson=require(_0x9068('0x9'));var client=jayson[_0x9068('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb67,_0x5c833f,_0x4bdd1b){return new BPromise(function(_0x17bc63,_0x184746){return client[_0x9068('0xb')](_0x34cb67,_0x4bdd1b)[_0x9068('0xc')](function(_0x1c63d2){logger[_0x9068('0xd')](_0x9068('0xe'),_0x5c833f,_0x9068('0xf'));logger[_0x9068('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'),JSON[_0x9068('0x11')](_0x1c63d2));if(_0x1c63d2[_0x9068('0x12')]){if(_0x1c63d2[_0x9068('0x12')]['code']===0x1f4){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x1c63d2[_0x9068('0x12')]['message']);return _0x184746(_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);}logger[_0x9068('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c833f,_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);return _0x17bc63(_0x1c63d2['error'][_0x9068('0x13')]);}else{logger[_0x9068('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'));_0x17bc63(_0x1c63d2[_0x9068('0x14')][_0x9068('0x13')]);}})[_0x9068('0x15')](function(_0x576b34){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x576b34);_0x184746(_0x576b34);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9418c0f..7dfe9cd 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 _0xb1e0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5456c7,_0x3126b4){var _0x55447b=function(_0x5b5862){while(--_0x5b5862){_0x5456c7['push'](_0x5456c7['shift']());}};_0x55447b(++_0x3126b4);}(_0xb1e0,0x126));var _0x0b1e=function(_0x3d917d,_0x326a74){_0x3d917d=_0x3d917d-0x0;var _0x1c2d2f=_0xb1e0[_0x3d917d];return _0x1c2d2f;};'use strict';var multer=require(_0x0b1e('0x0'));var util=require(_0x0b1e('0x1'));var path=require('path');var timeout=require(_0x0b1e('0x2'));var express=require(_0x0b1e('0x3'));var router=express[_0x0b1e('0x4')]();var fs_extra=require(_0x0b1e('0x5'));var auth=require(_0x0b1e('0x6'));var interaction=require(_0x0b1e('0x7'));var config=require(_0x0b1e('0x8'));var controller=require(_0x0b1e('0x9'));router[_0x0b1e('0xa')]('/',auth[_0x0b1e('0xb')](),controller[_0x0b1e('0xc')]);router[_0x0b1e('0xa')]('/:id',auth[_0x0b1e('0xb')](),controller['show']);router['post']('/',auth[_0x0b1e('0xb')](),controller[_0x0b1e('0xd')]);router[_0x0b1e('0xe')](_0x0b1e('0xf'),auth[_0x0b1e('0xb')](),controller[_0x0b1e('0x10')]);router[_0x0b1e('0x11')](_0x0b1e('0xf'),auth[_0x0b1e('0xb')](),controller[_0x0b1e('0x12')]);module[_0x0b1e('0x13')]=router; \ No newline at end of file +var _0xcda6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','path'];(function(_0x10c23c,_0x4e200d){var _0x5ee0e1=function(_0x427638){while(--_0x427638){_0x10c23c['push'](_0x10c23c['shift']());}};_0x5ee0e1(++_0x4e200d);}(_0xcda6,0x1f3));var _0x6cda=function(_0x27385d,_0x48af30){_0x27385d=_0x27385d-0x0;var _0x2cff44=_0xcda6[_0x27385d];return _0x2cff44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6cda('0x0'));var timeout=require(_0x6cda('0x1'));var express=require(_0x6cda('0x2'));var router=express[_0x6cda('0x3')]();var fs_extra=require(_0x6cda('0x4'));var auth=require(_0x6cda('0x5'));var interaction=require(_0x6cda('0x6'));var config=require(_0x6cda('0x7'));var controller=require(_0x6cda('0x8'));router[_0x6cda('0x9')]('/',auth['isAuthenticated'](),controller[_0x6cda('0xa')]);router[_0x6cda('0x9')](_0x6cda('0xb'),auth[_0x6cda('0xc')](),controller[_0x6cda('0xd')]);router['post']('/',auth[_0x6cda('0xc')](),controller[_0x6cda('0xe')]);router[_0x6cda('0xf')](_0x6cda('0xb'),auth[_0x6cda('0xc')](),controller[_0x6cda('0x10')]);router[_0x6cda('0x11')](_0x6cda('0xb'),auth[_0x6cda('0xc')](),controller[_0x6cda('0x12')]);module[_0x6cda('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index eaffe0f..1c6c189 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 _0xadbf=['name','sequelize','exports','STRING'];(function(_0x25f63d,_0x2fc8c6){var _0x1145f8=function(_0x50736d){while(--_0x50736d){_0x25f63d['push'](_0x25f63d['shift']());}};_0x1145f8(++_0x2fc8c6);}(_0xadbf,0x75));var _0xfadb=function(_0x68433a,_0x468d91){_0x68433a=_0x68433a-0x0;var _0x6756f4=_0xadbf[_0x68433a];return _0x6756f4;};'use strict';var Sequelize=require(_0xfadb('0x0'));module[_0xfadb('0x1')]={'name':{'type':Sequelize[_0xfadb('0x2')],'unique':_0xfadb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfadb('0x2')]}}; \ No newline at end of file +var _0x058a=['exports','name','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x058a,0x11f));var _0xa058=function(_0xd7ede,_0x587451){_0xd7ede=_0xd7ede-0x0;var _0x3e047f=_0x058a[_0xd7ede];return _0x3e047f;};'use strict';var Sequelize=require(_0xa058('0x0'));module[_0xa058('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa058('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa058('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 4487d49..f8a4376 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 _0x67b5=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','destroy','then','Pauses','UserProfileResource','name','send','index','map','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x67b5,0x17f));var _0x567b=function(_0x1c1fda,_0x1b076d){_0x1c1fda=_0x1c1fda-0x0;var _0xd76da7=_0x67b5[_0x1c1fda];return _0xd76da7;};'use strict';var emlformat=require(_0x567b('0x0'));var rimraf=require(_0x567b('0x1'));var zipdir=require(_0x567b('0x2'));var jsonpatch=require(_0x567b('0x3'));var rp=require(_0x567b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x567b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x567b('0x6'));var csv=require('to-csv');var ejs=require(_0x567b('0x7'));var fs=require('fs');var fs_extra=require(_0x567b('0x8'));var _=require(_0x567b('0x9'));var squel=require('squel');var crypto=require(_0x567b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x567b('0xb'));var toCsv=require('to-csv');var querystring=require(_0x567b('0xc'));var Papa=require(_0x567b('0xd'));var Redis=require(_0x567b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x567b('0xf'));var as=require(_0x567b('0x10'));var hardwareService=require(_0x567b('0x11'));var logger=require(_0x567b('0x12'))('api');var utils=require(_0x567b('0x13'));var config=require(_0x567b('0x14'));var licenseUtil=require(_0x567b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc5b2,_0x5ae30d){_0x5ae30d=_0x5ae30d||0xcc;return function(_0x4f3a39){if(_0x4f3a39){return _0x5dc5b2[_0x567b('0x16')](_0x5ae30d);}return _0x5dc5b2[_0x567b('0x17')](_0x5ae30d)[_0x567b('0x18')]();};}function respondWithResult(_0x5f2b2e,_0x4a1228){_0x4a1228=_0x4a1228||0xc8;return function(_0x48b6dc){if(_0x48b6dc){return _0x5f2b2e['status'](_0x4a1228)['json'](_0x48b6dc);}};}function respondWithFilteredResult(_0x5933f3,_0x256074){return function(_0x21d220){if(_0x21d220){var _0x24c129=typeof _0x256074[_0x567b('0x19')]===_0x567b('0x1a')&&typeof _0x256074['limit']===_0x567b('0x1a');var _0x552ccf=_0x21d220[_0x567b('0x1b')];var _0x3f0535=_0x24c129?0x0:_0x256074[_0x567b('0x19')];var _0x4f83de=_0x24c129?_0x21d220[_0x567b('0x1b')]:_0x256074['offset']+_0x256074[_0x567b('0x1c')];var _0x21f808;if(_0x4f83de>=_0x552ccf){_0x4f83de=_0x552ccf;_0x21f808=0xc8;}else{_0x21f808=0xce;}_0x5933f3[_0x567b('0x17')](_0x21f808);return _0x5933f3[_0x567b('0x1d')](_0x567b('0x1e'),_0x3f0535+'-'+_0x4f83de+'/'+_0x552ccf)[_0x567b('0x1f')](_0x21d220);}return null;};}function patchUpdates(_0x2391b2){return function(_0x353c50){try{jsonpatch['apply'](_0x353c50,_0x2391b2,!![]);}catch(_0x47e717){return BPromise[_0x567b('0x20')](_0x47e717);}return _0x353c50[_0x567b('0x21')]();};}function saveUpdates(_0x22e942,_0x3645e0){return function(_0x1ae8d9){if(_0x1ae8d9){return _0x1ae8d9['update'](_0x22e942)['then'](function(_0x3a9ef4){return _0x3a9ef4;});}return null;};}function removeEntity(_0x2a9471,_0xc845e0){return function(_0x2decf2){if(_0x2decf2){return _0x2decf2[_0x567b('0x22')]()[_0x567b('0x23')](function(){var _0x59716a=_0x2decf2['get']({'plain':!![]});var _0x2c7481=_0x567b('0x24');return db[_0x567b('0x25')][_0x567b('0x22')]({'where':{'type':_0x2c7481,'resourceId':_0x59716a['id']}})[_0x567b('0x23')](function(){return _0x2decf2;});})[_0x567b('0x23')](function(){_0x2a9471[_0x567b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb56051,_0x2938d1){return function(_0x47fc95){if(!_0x47fc95){_0xb56051[_0x567b('0x16')](0x194);}return _0x47fc95;};}function handleError(_0x14bace,_0x55ba72){_0x55ba72=_0x55ba72||0x1f4;return function(_0x4e9c89){logger['error'](_0x4e9c89['stack']);if(_0x4e9c89['name']){delete _0x4e9c89[_0x567b('0x26')];}_0x14bace[_0x567b('0x17')](_0x55ba72)[_0x567b('0x27')](_0x4e9c89);};}exports[_0x567b('0x28')]=function(_0x21b5c2,_0x2b77de){var _0x1e8943={},_0x1ffc95={},_0x1e0120={'count':0x0,'rows':[]};var _0x39c040=_[_0x567b('0x29')](db[_0x567b('0x2a')][_0x567b('0x2b')],function(_0xc48253){return{'name':_0xc48253[_0x567b('0x2c')],'type':_0xc48253['type'][_0x567b('0x2d')]};});_0x1ffc95[_0x567b('0x2e')]=_[_0x567b('0x29')](_0x39c040,'name');_0x1ffc95['query']=_['keys'](_0x21b5c2[_0x567b('0x2f')]);_0x1ffc95[_0x567b('0x30')]=_[_0x567b('0x31')](_0x1ffc95[_0x567b('0x2e')],_0x1ffc95['query']);_0x1e8943[_0x567b('0x32')]=_[_0x567b('0x31')](_0x1ffc95[_0x567b('0x2e')],qs['fields'](_0x21b5c2[_0x567b('0x2f')]['fields']));_0x1e8943[_0x567b('0x32')]=_0x1e8943['attributes'][_0x567b('0x33')]?_0x1e8943[_0x567b('0x32')]:_0x1ffc95[_0x567b('0x2e')];if(!_0x21b5c2['query'][_0x567b('0x34')]('nolimit')){_0x1e8943[_0x567b('0x1c')]=qs['limit'](_0x21b5c2['query'][_0x567b('0x1c')]);_0x1e8943[_0x567b('0x19')]=qs[_0x567b('0x19')](_0x21b5c2['query']['offset']);}_0x1e8943['order']=qs[_0x567b('0x35')](_0x21b5c2[_0x567b('0x2f')][_0x567b('0x35')]);_0x1e8943[_0x567b('0x36')]=qs[_0x567b('0x30')](_[_0x567b('0x37')](_0x21b5c2['query'],_0x1ffc95['filters']),_0x39c040);if(_0x21b5c2[_0x567b('0x2f')][_0x567b('0x38')]){_0x1e8943[_0x567b('0x36')]=_[_0x567b('0x39')](_0x1e8943[_0x567b('0x36')],{'$or':_[_0x567b('0x29')](_0x39c040,function(_0x5b1219){if(_0x5b1219['type']!=='VIRTUAL'){var _0x27c36c={};_0x27c36c[_0x5b1219[_0x567b('0x26')]]={'$like':'%'+_0x21b5c2[_0x567b('0x2f')][_0x567b('0x38')]+'%'};return _0x27c36c;}})});}_0x1e8943=_[_0x567b('0x39')]({},_0x1e8943,_0x21b5c2[_0x567b('0x3a')]);var _0x180e04={'where':_0x1e8943[_0x567b('0x36')]};return db[_0x567b('0x2a')][_0x567b('0x1b')](_0x180e04)['then'](function(_0x11a4f3){_0x1e0120[_0x567b('0x1b')]=_0x11a4f3;if(_0x21b5c2[_0x567b('0x2f')][_0x567b('0x3b')]){_0x1e8943[_0x567b('0x3c')]=[{'all':!![]}];}return db[_0x567b('0x2a')][_0x567b('0x3d')](_0x1e8943);})[_0x567b('0x23')](function(_0x11ddd1){_0x1e0120[_0x567b('0x3e')]=_0x11ddd1;return _0x1e0120;})[_0x567b('0x23')](respondWithFilteredResult(_0x2b77de,_0x1e8943))[_0x567b('0x3f')](handleError(_0x2b77de,null));};exports[_0x567b('0x40')]=function(_0x1a1aaa,_0x43714c){var _0x454438={'raw':!![],'where':{'id':_0x1a1aaa[_0x567b('0x41')]['id']}},_0x1efcaf={};_0x1efcaf[_0x567b('0x2e')]=_['keys'](db['Pause'][_0x567b('0x2b')]);_0x1efcaf[_0x567b('0x2f')]=_[_0x567b('0x42')](_0x1a1aaa[_0x567b('0x2f')]);_0x1efcaf[_0x567b('0x30')]=_[_0x567b('0x31')](_0x1efcaf['model'],_0x1efcaf[_0x567b('0x2f')]);_0x454438[_0x567b('0x32')]=_[_0x567b('0x31')](_0x1efcaf[_0x567b('0x2e')],qs[_0x567b('0x43')](_0x1a1aaa[_0x567b('0x2f')]['fields']));_0x454438[_0x567b('0x32')]=_0x454438['attributes'][_0x567b('0x33')]?_0x454438[_0x567b('0x32')]:_0x1efcaf[_0x567b('0x2e')];if(_0x1a1aaa[_0x567b('0x2f')][_0x567b('0x3b')]){_0x454438[_0x567b('0x3c')]=[{'all':!![]}];}_0x454438=_[_0x567b('0x39')]({},_0x454438,_0x1a1aaa['options']);return db['Pause'][_0x567b('0x44')](_0x454438)[_0x567b('0x23')](handleEntityNotFound(_0x43714c,null))[_0x567b('0x23')](respondWithResult(_0x43714c,null))[_0x567b('0x3f')](handleError(_0x43714c,null));};exports['create']=function(_0x1181c5,_0x4e7b62){return db[_0x567b('0x2a')][_0x567b('0x45')](_0x1181c5[_0x567b('0x46')],{})['then'](function(_0x45fa45){var _0x59aad2=_0x1181c5[_0x567b('0x47')][_0x567b('0x48')]({'plain':!![]});if(!_0x59aad2)throw new Error(_0x567b('0x49'));if(_0x59aad2[_0x567b('0x4a')]===_0x567b('0x47')){var _0x3535d3=_0x45fa45[_0x567b('0x48')]({'plain':!![]});var _0x15a421='Pauses';return db[_0x567b('0x4b')][_0x567b('0x44')]({'where':{'name':_0x15a421,'userProfileId':_0x59aad2['userProfileId']},'raw':!![]})[_0x567b('0x23')](function(_0x158684){if(_0x158684&&_0x158684['autoAssociation']===0x0){return db[_0x567b('0x25')][_0x567b('0x45')]({'name':_0x3535d3[_0x567b('0x26')],'resourceId':_0x3535d3['id'],'type':_0x158684['name'],'sectionId':_0x158684['id']},{})['then'](function(){return _0x45fa45;});}else{return _0x45fa45;}})['catch'](function(_0x5094bb){logger[_0x567b('0x4c')](_0x567b('0x4d'),_0x5094bb);throw _0x5094bb;});}return _0x45fa45;})['then'](respondWithResult(_0x4e7b62,0xc9))['catch'](handleError(_0x4e7b62,null));};exports[_0x567b('0x4e')]=function(_0x14297e,_0x1fe505){if(_0x14297e[_0x567b('0x46')]['id']){delete _0x14297e[_0x567b('0x46')]['id'];}return db[_0x567b('0x2a')][_0x567b('0x44')]({'where':{'id':_0x14297e[_0x567b('0x41')]['id']}})['then'](handleEntityNotFound(_0x1fe505,null))[_0x567b('0x23')](saveUpdates(_0x14297e['body'],null))['then'](respondWithResult(_0x1fe505,null))['catch'](handleError(_0x1fe505,null));};exports[_0x567b('0x22')]=function(_0x1e16aa,_0x475774){return db[_0x567b('0x2a')][_0x567b('0x44')]({'where':{'id':_0x1e16aa[_0x567b('0x41')]['id']}})[_0x567b('0x23')](handleEntityNotFound(_0x475774,null))[_0x567b('0x23')](removeEntity(_0x475774,null))[_0x567b('0x3f')](handleError(_0x475774,null));}; \ No newline at end of file +var _0x4228=['show','params','rawAttributes','intersection','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Pauses','UserProfileResource','then','sendStatus','error','name','send','map','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','Pause','includeAll','include','rows'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4228,0x64));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8422('0x0'));var rimraf=require(_0x8422('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8422('0x2'));var rp=require(_0x8422('0x3'));var moment=require(_0x8422('0x4'));var BPromise=require(_0x8422('0x5'));var Mustache=require(_0x8422('0x6'));var util=require(_0x8422('0x7'));var path=require('path');var sox=require(_0x8422('0x8'));var csv=require(_0x8422('0x9'));var ejs=require(_0x8422('0xa'));var fs=require('fs');var fs_extra=require(_0x8422('0xb'));var _=require(_0x8422('0xc'));var squel=require(_0x8422('0xd'));var crypto=require(_0x8422('0xe'));var jsforce=require(_0x8422('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8422('0x9'));var querystring=require(_0x8422('0x10'));var Papa=require(_0x8422('0x11'));var Redis=require('ioredis');var authService=require(_0x8422('0x12'));var qs=require(_0x8422('0x13'));var as=require(_0x8422('0x14'));var hardwareService=require(_0x8422('0x15'));var logger=require(_0x8422('0x16'))(_0x8422('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8422('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428b0b,_0x587f4a){_0x587f4a=_0x587f4a||0xcc;return function(_0x1faa84){if(_0x1faa84){return _0x428b0b['sendStatus'](_0x587f4a);}return _0x428b0b[_0x8422('0x19')](_0x587f4a)[_0x8422('0x1a')]();};}function respondWithResult(_0x50a2c3,_0x220ece){_0x220ece=_0x220ece||0xc8;return function(_0x176132){if(_0x176132){return _0x50a2c3['status'](_0x220ece)[_0x8422('0x1b')](_0x176132);}};}function respondWithFilteredResult(_0x2cc5a2,_0x34bb9e){return function(_0x59d945){if(_0x59d945){var _0x52dcba=typeof _0x34bb9e[_0x8422('0x1c')]===_0x8422('0x1d')&&typeof _0x34bb9e[_0x8422('0x1e')]===_0x8422('0x1d');var _0x43c5c6=_0x59d945['count'];var _0x330e37=_0x52dcba?0x0:_0x34bb9e['offset'];var _0x462e68=_0x52dcba?_0x59d945[_0x8422('0x1f')]:_0x34bb9e['offset']+_0x34bb9e[_0x8422('0x1e')];var _0x5b54e5;if(_0x462e68>=_0x43c5c6){_0x462e68=_0x43c5c6;_0x5b54e5=0xc8;}else{_0x5b54e5=0xce;}_0x2cc5a2['status'](_0x5b54e5);return _0x2cc5a2['set'](_0x8422('0x20'),_0x330e37+'-'+_0x462e68+'/'+_0x43c5c6)[_0x8422('0x1b')](_0x59d945);}return null;};}function patchUpdates(_0x48f33c){return function(_0x93e3e4){try{jsonpatch[_0x8422('0x21')](_0x93e3e4,_0x48f33c,!![]);}catch(_0x5df03a){return BPromise[_0x8422('0x22')](_0x5df03a);}return _0x93e3e4[_0x8422('0x23')]();};}function saveUpdates(_0x488159,_0x1c163a){return function(_0x28d3e2){if(_0x28d3e2){return _0x28d3e2['update'](_0x488159)['then'](function(_0x80e1f3){return _0x80e1f3;});}return null;};}function removeEntity(_0x47eb2a,_0x838912){return function(_0x112b9f){if(_0x112b9f){return _0x112b9f[_0x8422('0x24')]()['then'](function(){var _0x4ad6eb=_0x112b9f[_0x8422('0x25')]({'plain':!![]});var _0x36c94b=_0x8422('0x26');return db[_0x8422('0x27')][_0x8422('0x24')]({'where':{'type':_0x36c94b,'resourceId':_0x4ad6eb['id']}})[_0x8422('0x28')](function(){return _0x112b9f;});})[_0x8422('0x28')](function(){_0x47eb2a[_0x8422('0x19')](0xcc)[_0x8422('0x1a')]();});}};}function handleEntityNotFound(_0x3ca29a,_0x1c1f0f){return function(_0x48a0b6){if(!_0x48a0b6){_0x3ca29a[_0x8422('0x29')](0x194);}return _0x48a0b6;};}function handleError(_0x29b4c6,_0x51761f){_0x51761f=_0x51761f||0x1f4;return function(_0x5768ba){logger[_0x8422('0x2a')](_0x5768ba['stack']);if(_0x5768ba['name']){delete _0x5768ba[_0x8422('0x2b')];}_0x29b4c6[_0x8422('0x19')](_0x51761f)[_0x8422('0x2c')](_0x5768ba);};}exports['index']=function(_0x809657,_0x1e125c){var _0x9a9a9a={},_0x446120={},_0x402e2d={'count':0x0,'rows':[]};var _0xab1b1b=_[_0x8422('0x2d')](db['Pause']['rawAttributes'],function(_0x35f9fd){return{'name':_0x35f9fd[_0x8422('0x2e')],'type':_0x35f9fd['type']['key']};});_0x446120[_0x8422('0x2f')]=_[_0x8422('0x2d')](_0xab1b1b,'name');_0x446120[_0x8422('0x30')]=_[_0x8422('0x31')](_0x809657[_0x8422('0x30')]);_0x446120[_0x8422('0x32')]=_['intersection'](_0x446120[_0x8422('0x2f')],_0x446120[_0x8422('0x30')]);_0x9a9a9a[_0x8422('0x33')]=_['intersection'](_0x446120[_0x8422('0x2f')],qs['fields'](_0x809657[_0x8422('0x30')][_0x8422('0x34')]));_0x9a9a9a[_0x8422('0x33')]=_0x9a9a9a[_0x8422('0x33')][_0x8422('0x35')]?_0x9a9a9a[_0x8422('0x33')]:_0x446120[_0x8422('0x2f')];if(!_0x809657[_0x8422('0x30')][_0x8422('0x36')]('nolimit')){_0x9a9a9a['limit']=qs['limit'](_0x809657[_0x8422('0x30')][_0x8422('0x1e')]);_0x9a9a9a[_0x8422('0x1c')]=qs[_0x8422('0x1c')](_0x809657[_0x8422('0x30')]['offset']);}_0x9a9a9a[_0x8422('0x37')]=qs[_0x8422('0x38')](_0x809657[_0x8422('0x30')]['sort']);_0x9a9a9a['where']=qs['filters'](_[_0x8422('0x39')](_0x809657[_0x8422('0x30')],_0x446120[_0x8422('0x32')]),_0xab1b1b);if(_0x809657[_0x8422('0x30')][_0x8422('0x3a')]){_0x9a9a9a[_0x8422('0x3b')]=_[_0x8422('0x3c')](_0x9a9a9a[_0x8422('0x3b')],{'$or':_[_0x8422('0x2d')](_0xab1b1b,function(_0x529a15){if(_0x529a15[_0x8422('0x3d')]!==_0x8422('0x3e')){var _0x1bbcad={};_0x1bbcad[_0x529a15['name']]={'$like':'%'+_0x809657['query']['filter']+'%'};return _0x1bbcad;}})});}_0x9a9a9a=_[_0x8422('0x3c')]({},_0x9a9a9a,_0x809657[_0x8422('0x3f')]);var _0xb57e57={'where':_0x9a9a9a[_0x8422('0x3b')]};return db[_0x8422('0x40')][_0x8422('0x1f')](_0xb57e57)[_0x8422('0x28')](function(_0x474818){_0x402e2d[_0x8422('0x1f')]=_0x474818;if(_0x809657[_0x8422('0x30')][_0x8422('0x41')]){_0x9a9a9a[_0x8422('0x42')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x9a9a9a);})['then'](function(_0x19b230){_0x402e2d[_0x8422('0x43')]=_0x19b230;return _0x402e2d;})[_0x8422('0x28')](respondWithFilteredResult(_0x1e125c,_0x9a9a9a))['catch'](handleError(_0x1e125c,null));};exports[_0x8422('0x44')]=function(_0x231674,_0x20bcf0){var _0x69d613={'raw':!![],'where':{'id':_0x231674[_0x8422('0x45')]['id']}},_0x582efd={};_0x582efd[_0x8422('0x2f')]=_[_0x8422('0x31')](db[_0x8422('0x40')][_0x8422('0x46')]);_0x582efd[_0x8422('0x30')]=_[_0x8422('0x31')](_0x231674['query']);_0x582efd[_0x8422('0x32')]=_[_0x8422('0x47')](_0x582efd['model'],_0x582efd[_0x8422('0x30')]);_0x69d613[_0x8422('0x33')]=_[_0x8422('0x47')](_0x582efd[_0x8422('0x2f')],qs['fields'](_0x231674[_0x8422('0x30')]['fields']));_0x69d613[_0x8422('0x33')]=_0x69d613[_0x8422('0x33')][_0x8422('0x35')]?_0x69d613[_0x8422('0x33')]:_0x582efd[_0x8422('0x2f')];if(_0x231674[_0x8422('0x30')][_0x8422('0x41')]){_0x69d613['include']=[{'all':!![]}];}_0x69d613=_['merge']({},_0x69d613,_0x231674[_0x8422('0x3f')]);return db[_0x8422('0x40')]['find'](_0x69d613)[_0x8422('0x28')](handleEntityNotFound(_0x20bcf0,null))[_0x8422('0x28')](respondWithResult(_0x20bcf0,null))[_0x8422('0x48')](handleError(_0x20bcf0,null));};exports[_0x8422('0x49')]=function(_0xf9ae07,_0x578656){return db[_0x8422('0x40')][_0x8422('0x49')](_0xf9ae07[_0x8422('0x4a')],{})[_0x8422('0x28')](function(_0x1c8055){var _0x13135a=_0xf9ae07[_0x8422('0x4b')][_0x8422('0x25')]({'plain':!![]});if(!_0x13135a)throw new Error(_0x8422('0x4c'));if(_0x13135a[_0x8422('0x4d')]===_0x8422('0x4b')){var _0x1b163f=_0x1c8055[_0x8422('0x25')]({'plain':!![]});var _0x2d5d39=_0x8422('0x26');return db[_0x8422('0x4e')][_0x8422('0x4f')]({'where':{'name':_0x2d5d39,'userProfileId':_0x13135a[_0x8422('0x50')]},'raw':!![]})[_0x8422('0x28')](function(_0xa63691){if(_0xa63691&&_0xa63691[_0x8422('0x51')]===0x0){return db[_0x8422('0x27')]['create']({'name':_0x1b163f[_0x8422('0x2b')],'resourceId':_0x1b163f['id'],'type':_0xa63691[_0x8422('0x2b')],'sectionId':_0xa63691['id']},{})[_0x8422('0x28')](function(){return _0x1c8055;});}else{return _0x1c8055;}})[_0x8422('0x48')](function(_0x4d45ab){logger[_0x8422('0x2a')](_0x8422('0x52'),_0x4d45ab);throw _0x4d45ab;});}return _0x1c8055;})[_0x8422('0x28')](respondWithResult(_0x578656,0xc9))[_0x8422('0x48')](handleError(_0x578656,null));};exports[_0x8422('0x53')]=function(_0x3eb8e9,_0x467621){if(_0x3eb8e9[_0x8422('0x4a')]['id']){delete _0x3eb8e9['body']['id'];}return db[_0x8422('0x40')][_0x8422('0x4f')]({'where':{'id':_0x3eb8e9[_0x8422('0x45')]['id']}})[_0x8422('0x28')](handleEntityNotFound(_0x467621,null))[_0x8422('0x28')](saveUpdates(_0x3eb8e9[_0x8422('0x4a')],null))[_0x8422('0x28')](respondWithResult(_0x467621,null))[_0x8422('0x48')](handleError(_0x467621,null));};exports[_0x8422('0x24')]=function(_0x31ef91,_0x13e432){return db[_0x8422('0x40')][_0x8422('0x4f')]({'where':{'id':_0x31ef91[_0x8422('0x45')]['id']}})['then'](handleEntityNotFound(_0x13e432,null))[_0x8422('0x28')](removeEntity(_0x13e432,null))[_0x8422('0x48')](handleError(_0x13e432,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3738429..c1fdd57 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x4fb270,_0x268ea6){var _0x2d4b52=function(_0x14cae1){while(--_0x14cae1){_0x4fb270['push'](_0x4fb270['shift']());}};_0x2d4b52(++_0x268ea6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x596368,_0x5095bd){_0x596368=_0x596368-0x0;var _0x4f65b9=_0x8ef6[_0x596368];return _0x4f65b9;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 6557adc..e6eb94c 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2be552,_0x563c4){var _0x1286eb=function(_0x82e50e){while(--_0x82e50e){_0x2be552['push'](_0x2be552['shift']());}};_0x1286eb(++_0x563c4);}(_0xb10b,0x12a));var _0xbb10=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xb10b[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5116d8,_0x1bf94d){var _0x3e0a2b=function(_0x4e0b9d){while(--_0x4e0b9d){_0x5116d8['push'](_0x5116d8['shift']());}};_0x3e0a2b(++_0x1bf94d);}(_0xb10b,0x12a));var _0xbb10=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0xb10b[_0x10c778];return _0x4e9fb2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index aeb4a53..ed0bc8c 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 _0xac31=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','put','update','delete','exports','multer','util'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0xac31,0xca));var _0x1ac3=function(_0x25ba4f,_0xcc43ca){_0x25ba4f=_0x25ba4f-0x0;var _0x2c80ab=_0xac31[_0x25ba4f];return _0x2c80ab;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xb')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);var upload=multer({'storage':multer[_0x1ac3('0x12')]({'destination':function(_0x3e835b,_0x24f0d2,_0x2a8dc7){_0x2a8dc7(null,path[_0x1ac3('0x13')](config['root'],_0x1ac3('0x14')));},'filename':function(_0x376814,_0x2eeabf,_0x2338b9){_0x2eeabf['originalname']=_0x2eeabf[_0x1ac3('0x15')][_0x1ac3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2338b9(null,util[_0x1ac3('0x17')](_0x1ac3('0x18'),path['basename'](_0x2eeabf[_0x1ac3('0x15')],path[_0x1ac3('0x19')](_0x2eeabf['originalname'])),Date[_0x1ac3('0x1a')](),path[_0x1ac3('0x19')](_0x2eeabf[_0x1ac3('0x15')])));}})});router['post']('/',upload[_0x1ac3('0x1b')](_0x1ac3('0x1c')),controller[_0x1ac3('0x1d')]);router['post'](_0x1ac3('0xc'),controller['webhookPost']);router[_0x1ac3('0x1e')](_0x1ac3('0xe'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x1f')]);router[_0x1ac3('0x20')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x20')]);module[_0x1ac3('0x21')]=router; \ No newline at end of file +var _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x27f308,_0x423ae6){var _0x374d55=function(_0x1b7447){while(--_0x1b7447){_0x27f308['push'](_0x27f308['shift']());}};_0x374d55(++_0x423ae6);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 32bda88..27df6fc 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 _0xd1ba=['STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x2b199c,_0x53e6f3){var _0x3d1d3a=function(_0x29e77f){while(--_0x29e77f){_0x2b199c['push'](_0x2b199c['shift']());}};_0x3d1d3a(++_0x53e6f3);}(_0xd1ba,0x1ed));var _0xad1b=function(_0x3515d0,_0x4dbb33){_0x3515d0=_0x3515d0-0x0;var _0x3b97c6=_0xd1ba[_0x3515d0];return _0x3b97c6;};'use strict';var Sequelize=require(_0xad1b('0x0'));module[_0xad1b('0x1')]={'name':{'type':Sequelize[_0xad1b('0x2')]},'type':{'type':Sequelize['ENUM']('html',_0xad1b('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xad1b('0x4')]},'path':{'type':Sequelize[_0xad1b('0x2')],'comment':_0xad1b('0x5')},'active':{'type':Sequelize[_0xad1b('0x6')],'defaultValue':0x0,'comment':_0xad1b('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xad1b('0x8'),'agentOnly',_0xad1b('0x9'),'never'),'defaultValue':'always','comment':_0xad1b('0xa')},'icon':{'type':Sequelize[_0xad1b('0x2')]},'adminUrl':{'type':Sequelize[_0xad1b('0x2')]},'agentUrl':{'type':Sequelize[_0xad1b('0x2')]},'scriptName':{'type':Sequelize[_0xad1b('0x2')]},'scriptPath':{'type':Sequelize[_0xad1b('0x2')]}}; \ No newline at end of file +var _0xb930=['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','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','TEXT'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb930,0x6a));var _0x0b93=function(_0xf6a271,_0xdf9cab){_0xf6a271=_0xf6a271-0x0;var _0x4e7b10=_0xb930[_0xf6a271];return _0x4e7b10;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b93('0x0')]},'type':{'type':Sequelize[_0x0b93('0x1')](_0x0b93('0x2'),'script')},'description':{'type':Sequelize[_0x0b93('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0b93('0x0')],'comment':_0x0b93('0x4')},'active':{'type':Sequelize[_0x0b93('0x5')],'defaultValue':0x0,'comment':_0x0b93('0x6')},'sidebar':{'type':Sequelize[_0x0b93('0x1')](_0x0b93('0x7'),_0x0b93('0x8'),_0x0b93('0x9'),'never'),'defaultValue':'always','comment':_0x0b93('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x0b93('0x0')]},'agentUrl':{'type':Sequelize[_0x0b93('0x0')]},'scriptName':{'type':Sequelize[_0x0b93('0x0')]},'scriptPath':{'type':Sequelize[_0x0b93('0x0')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c7c2243..625b7b1 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 _0x1d7d=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','querystring','archiver','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','destroy','get','Plugins','UserProfileResource','then','end','error','stack','name','send','index','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','Plugin','include','findAll','rows','catch','params','rawAttributes','includeAll','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir'];(function(_0x298ca9,_0x1afff3){var _0x1fbfea=function(_0x185bf7){while(--_0x185bf7){_0x298ca9['push'](_0x298ca9['shift']());}};_0x1fbfea(++_0x1afff3);}(_0x1d7d,0xa3));var _0xd1d7=function(_0x43a4b5,_0xa3e9bc){_0x43a4b5=_0x43a4b5-0x0;var _0x54ab5e=_0x1d7d[_0x43a4b5];return _0x54ab5e;};'use strict';var emlformat=require(_0xd1d7('0x0'));var rimraf=require(_0xd1d7('0x1'));var zipdir=require(_0xd1d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1d7('0x3'));var BPromise=require(_0xd1d7('0x4'));var Mustache=require(_0xd1d7('0x5'));var util=require(_0xd1d7('0x6'));var path=require(_0xd1d7('0x7'));var sox=require(_0xd1d7('0x8'));var csv=require(_0xd1d7('0x9'));var ejs=require(_0xd1d7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd1d7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd1d7('0x9'));var querystring=require(_0xd1d7('0xc'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xd1d7('0x1'));var archiver=require(_0xd1d7('0xd'));var Redis=require(_0xd1d7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd1d7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1d7('0x10'))(_0xd1d7('0x11'));var utils=require('../../config/utils');var config=require(_0xd1d7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1d7('0x13'))['db'];config[_0xd1d7('0x14')]=_[_0xd1d7('0x15')](config[_0xd1d7('0x14')],{'host':_0xd1d7('0x16'),'port':0x18eb});var socket=require(_0xd1d7('0x17'))(new Redis(config[_0xd1d7('0x14')]));require(_0xd1d7('0x18'))[_0xd1d7('0x19')](socket);function respondWithStatusCode(_0x40a849,_0xd13b5c){_0xd13b5c=_0xd13b5c||0xcc;return function(_0x1d75b8){if(_0x1d75b8){return _0x40a849[_0xd1d7('0x1a')](_0xd13b5c);}return _0x40a849[_0xd1d7('0x1b')](_0xd13b5c)['end']();};}function respondWithResult(_0x2f35f8,_0x315224){_0x315224=_0x315224||0xc8;return function(_0x4484b4){if(_0x4484b4){return _0x2f35f8[_0xd1d7('0x1b')](_0x315224)[_0xd1d7('0x1c')](_0x4484b4);}};}function respondWithFilteredResult(_0x6e68dd,_0x138443){return function(_0x5f472c){if(_0x5f472c){var _0x5f06e8=typeof _0x138443[_0xd1d7('0x1d')]==='undefined'&&typeof _0x138443[_0xd1d7('0x1e')]==='undefined';var _0x42db39=_0x5f472c[_0xd1d7('0x1f')];var _0x29069f=_0x5f06e8?0x0:_0x138443[_0xd1d7('0x1d')];var _0x1595c4=_0x5f06e8?_0x5f472c[_0xd1d7('0x1f')]:_0x138443[_0xd1d7('0x1d')]+_0x138443[_0xd1d7('0x1e')];var _0x4ece12;if(_0x1595c4>=_0x42db39){_0x1595c4=_0x42db39;_0x4ece12=0xc8;}else{_0x4ece12=0xce;}_0x6e68dd['status'](_0x4ece12);return _0x6e68dd[_0xd1d7('0x20')](_0xd1d7('0x21'),_0x29069f+'-'+_0x1595c4+'/'+_0x42db39)['json'](_0x5f472c);}return null;};}function patchUpdates(_0x5b1a39){return function(_0x5529f1){try{jsonpatch['apply'](_0x5529f1,_0x5b1a39,!![]);}catch(_0x57f163){return BPromise[_0xd1d7('0x22')](_0x57f163);}return _0x5529f1['save']();};}function saveUpdates(_0x8decd9,_0x5d3b67){return function(_0x645824){if(_0x645824){return _0x645824[_0xd1d7('0x23')](_0x8decd9)['then'](function(_0x5492){return _0x5492;});}return null;};}function removeEntity(_0x260613,_0x1cfd84){return function(_0x4e900c){if(_0x4e900c){return _0x4e900c[_0xd1d7('0x24')]()['then'](function(){var _0xa8beab=_0x4e900c[_0xd1d7('0x25')]({'plain':!![]});var _0x754bb0=_0xd1d7('0x26');return db[_0xd1d7('0x27')][_0xd1d7('0x24')]({'where':{'type':_0x754bb0,'resourceId':_0xa8beab['id']}})[_0xd1d7('0x28')](function(){return _0x4e900c;});})[_0xd1d7('0x28')](function(){_0x260613['status'](0xcc)[_0xd1d7('0x29')]();});}};}function handleEntityNotFound(_0x4c4844,_0x591bf5){return function(_0x1c9af8){if(!_0x1c9af8){_0x4c4844[_0xd1d7('0x1a')](0x194);}return _0x1c9af8;};}function handleError(_0xbac494,_0x38d2e9){_0x38d2e9=_0x38d2e9||0x1f4;return function(_0x338ef2){logger[_0xd1d7('0x2a')](_0x338ef2[_0xd1d7('0x2b')]);if(_0x338ef2[_0xd1d7('0x2c')]){delete _0x338ef2[_0xd1d7('0x2c')];}_0xbac494[_0xd1d7('0x1b')](_0x38d2e9)[_0xd1d7('0x2d')](_0x338ef2);};}exports[_0xd1d7('0x2e')]=function(_0x8bf4c2,_0x5c0450){var _0x30d279={},_0xf1cf18={},_0x3c7ddb={'count':0x0,'rows':[]};var _0x313448=_['map'](db['Plugin']['rawAttributes'],function(_0x2cf340){return{'name':_0x2cf340[_0xd1d7('0x2f')],'type':_0x2cf340[_0xd1d7('0x30')]['key']};});_0xf1cf18['model']=_[_0xd1d7('0x31')](_0x313448,_0xd1d7('0x2c'));_0xf1cf18[_0xd1d7('0x32')]=_[_0xd1d7('0x33')](_0x8bf4c2[_0xd1d7('0x32')]);_0xf1cf18['filters']=_[_0xd1d7('0x34')](_0xf1cf18[_0xd1d7('0x35')],_0xf1cf18[_0xd1d7('0x32')]);_0x30d279['attributes']=_[_0xd1d7('0x34')](_0xf1cf18[_0xd1d7('0x35')],qs[_0xd1d7('0x36')](_0x8bf4c2[_0xd1d7('0x32')]['fields']));_0x30d279[_0xd1d7('0x37')]=_0x30d279['attributes'][_0xd1d7('0x38')]?_0x30d279[_0xd1d7('0x37')]:_0xf1cf18['model'];if(!_0x8bf4c2[_0xd1d7('0x32')][_0xd1d7('0x39')](_0xd1d7('0x3a'))){_0x30d279['limit']=qs[_0xd1d7('0x1e')](_0x8bf4c2['query'][_0xd1d7('0x1e')]);_0x30d279[_0xd1d7('0x1d')]=qs[_0xd1d7('0x1d')](_0x8bf4c2[_0xd1d7('0x32')][_0xd1d7('0x1d')]);}_0x30d279[_0xd1d7('0x3b')]=qs[_0xd1d7('0x3c')](_0x8bf4c2[_0xd1d7('0x32')][_0xd1d7('0x3c')]);_0x30d279[_0xd1d7('0x3d')]=qs[_0xd1d7('0x3e')](_[_0xd1d7('0x3f')](_0x8bf4c2['query'],_0xf1cf18['filters']),_0x313448);if(_0x8bf4c2[_0xd1d7('0x32')][_0xd1d7('0x40')]){_0x30d279[_0xd1d7('0x3d')]=_[_0xd1d7('0x41')](_0x30d279[_0xd1d7('0x3d')],{'$or':_[_0xd1d7('0x31')](_0x313448,function(_0x4482c1){if(_0x4482c1[_0xd1d7('0x30')]!=='VIRTUAL'){var _0x1b6cd5={};_0x1b6cd5[_0x4482c1[_0xd1d7('0x2c')]]={'$like':'%'+_0x8bf4c2[_0xd1d7('0x32')][_0xd1d7('0x40')]+'%'};return _0x1b6cd5;}})});}_0x30d279=_['merge']({},_0x30d279,_0x8bf4c2[_0xd1d7('0x42')]);var _0x32b3f1={'where':_0x30d279[_0xd1d7('0x3d')]};return db[_0xd1d7('0x43')][_0xd1d7('0x1f')](_0x32b3f1)[_0xd1d7('0x28')](function(_0x466d77){_0x3c7ddb[_0xd1d7('0x1f')]=_0x466d77;if(_0x8bf4c2[_0xd1d7('0x32')]['includeAll']){_0x30d279[_0xd1d7('0x44')]=[{'all':!![]}];}return db[_0xd1d7('0x43')][_0xd1d7('0x45')](_0x30d279);})['then'](function(_0xd3079b){_0x3c7ddb[_0xd1d7('0x46')]=_0xd3079b;return _0x3c7ddb;})[_0xd1d7('0x28')](respondWithFilteredResult(_0x5c0450,_0x30d279))[_0xd1d7('0x47')](handleError(_0x5c0450,null));};exports['show']=function(_0x15ffed,_0x1bb574){var _0xe0661b={'raw':!![],'where':{'id':_0x15ffed[_0xd1d7('0x48')]['id']}},_0x5dee78={};_0x5dee78[_0xd1d7('0x35')]=_[_0xd1d7('0x33')](db[_0xd1d7('0x43')][_0xd1d7('0x49')]);_0x5dee78['query']=_[_0xd1d7('0x33')](_0x15ffed[_0xd1d7('0x32')]);_0x5dee78[_0xd1d7('0x3e')]=_['intersection'](_0x5dee78[_0xd1d7('0x35')],_0x5dee78['query']);_0xe0661b['attributes']=_['intersection'](_0x5dee78[_0xd1d7('0x35')],qs[_0xd1d7('0x36')](_0x15ffed['query'][_0xd1d7('0x36')]));_0xe0661b[_0xd1d7('0x37')]=_0xe0661b[_0xd1d7('0x37')][_0xd1d7('0x38')]?_0xe0661b[_0xd1d7('0x37')]:_0x5dee78[_0xd1d7('0x35')];if(_0x15ffed[_0xd1d7('0x32')][_0xd1d7('0x4a')]){_0xe0661b[_0xd1d7('0x44')]=[{'all':!![]}];}_0xe0661b=_[_0xd1d7('0x41')]({},_0xe0661b,_0x15ffed['options']);return db[_0xd1d7('0x43')][_0xd1d7('0x4b')](_0xe0661b)[_0xd1d7('0x28')](handleEntityNotFound(_0x1bb574,null))[_0xd1d7('0x28')](respondWithResult(_0x1bb574,null))[_0xd1d7('0x47')](handleError(_0x1bb574,null));};exports[_0xd1d7('0x4c')]=function(_0x23a73e,_0x1734b0,_0x13db2e){return db[_0xd1d7('0x43')][_0xd1d7('0x4b')]({'where':{'id':_0x23a73e[_0xd1d7('0x48')]['id']},'attributes':['name',_0xd1d7('0x7')],'raw':!![]})[_0xd1d7('0x28')](handleEntityNotFound(_0x1734b0,null))['then'](function(_0x55248c){if(_0x55248c){var _0x3edcad=path[_0xd1d7('0x4d')](config[_0xd1d7('0x4e')],_0xd1d7('0x4f'),util[_0xd1d7('0x50')]('%s.zip',path[_0xd1d7('0x51')](_0x55248c[_0xd1d7('0x7')])));var _0x545d6e=fs[_0xd1d7('0x52')](_0x3edcad);var _0x2ed16e=archiver(_0xd1d7('0x53'),{'zlib':{'level':0x9}});_0x2ed16e['on'](_0xd1d7('0x54'),function(_0x54cff0){if(_0x54cff0['code']===_0xd1d7('0x55')){logger[_0xd1d7('0x2a')](_0x54cff0);}else{throw new db[(_0xd1d7('0x56'))]['Error'](_0xd1d7('0x57'));}});_0x2ed16e['on']('error',function(_0xa82394){throw new db[(_0xd1d7('0x56'))][(_0xd1d7('0x58'))](_0xd1d7('0x57'));});_0x2ed16e['pipe'](_0x545d6e);_0x2ed16e[_0xd1d7('0x59')](_0xd1d7('0x5a'),{'cwd':path[_0xd1d7('0x4d')](config[_0xd1d7('0x4e')],_0xd1d7('0x4f'),path[_0xd1d7('0x5b')](_0x55248c[_0xd1d7('0x7')])),'ignore':[path[_0xd1d7('0x4d')](path[_0xd1d7('0x51')](_0x55248c[_0xd1d7('0x7')]),_0xd1d7('0x5c')),path[_0xd1d7('0x4d')](path[_0xd1d7('0x51')](_0x55248c['path']),_0xd1d7('0x5d'))],'nodir':!![]})[_0xd1d7('0x5e')]();_0x545d6e['on'](_0xd1d7('0x5f'),function(){if(!fs[_0xd1d7('0x60')](_0x3edcad)){throw new db[(_0xd1d7('0x56'))][(_0xd1d7('0x58'))](_0xd1d7('0x61'));}return _0x1734b0['download'](_0x3edcad,util[_0xd1d7('0x50')](_0xd1d7('0x62'),path[_0xd1d7('0x51')](_0x55248c[_0xd1d7('0x7')])),function(_0x31c462){if(_0x31c462){throw new db[(_0xd1d7('0x56'))][(_0xd1d7('0x58'))](_0xd1d7('0x63'));}fs[_0xd1d7('0x64')](_0x3edcad);logger[_0xd1d7('0x65')](_0xd1d7('0x66'));logger[_0xd1d7('0x65')](_0xd1d7('0x67'));});});}return null;})[_0xd1d7('0x47')](handleError(_0x1734b0,null));};exports[_0xd1d7('0x68')]=function(_0x455b4b,_0x4e0fca,_0xb76678){var _0x205c17=path[_0xd1d7('0x51')](_0x455b4b['file'][_0xd1d7('0x69')],path[_0xd1d7('0x6a')](_0x455b4b[_0xd1d7('0x6b')]['filename']));var _0x52ad96=path[_0xd1d7('0x4d')](config['root'],_0xd1d7('0x4f'),_0x455b4b[_0xd1d7('0x6b')][_0xd1d7('0x69')]);var _0x178c85=path['join'](config[_0xd1d7('0x4e')],'server/files/plugins',_0x205c17);logger[_0xd1d7('0x65')](_0xd1d7('0x6c'),_0x52ad96);logger[_0xd1d7('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x178c85);try{fs['chmodSync'](_0x52ad96,parseInt(_0xd1d7('0x6d'),0x8));extract(_0x52ad96,{'dir':_0x178c85},function(_0x13fa5d){if(_0x13fa5d){logger['error'](_0x13fa5d);handleError(_0x13fa5d,!![]);};var _0x20841a=fs[_0xd1d7('0x6e')](_0x178c85);if(_0x20841a[_0xd1d7('0x38')]>0x1){removeReferences(_0x52ad96,_0x178c85);logger[_0xd1d7('0x2a')]('Invalid\x20plugin\x20structure');return _0xb76678(new Error(_0xd1d7('0x6f')));}var _0x5229fa=fs[_0xd1d7('0x70')](path['join'](_0x178c85,_0x20841a[0x0]));if(_0x5229fa['isFile']()){removeReferences(_0x52ad96,_0x178c85);logger[_0xd1d7('0x2a')](_0xd1d7('0x6f'));return _0xb76678(new Error(_0xd1d7('0x6f')));}if(_0x5229fa[_0xd1d7('0x71')]()){var _0x48121d=fs[_0xd1d7('0x6e')](path[_0xd1d7('0x4d')](_0x178c85,_0x20841a[0x0]));if(_0x48121d[_0xd1d7('0x38')]===0x0){removeReferences(_0x52ad96,_0x178c85);logger[_0xd1d7('0x2a')](_0xd1d7('0x6f'));return _0xb76678(new Error(_0xd1d7('0x6f')));}var _0x2e9d47=_0x48121d[_0xd1d7('0x72')](function(_0x1cb961){return _0x1cb961===_0xd1d7('0x73');});if(!_0x2e9d47){return _0xb76678(new Error('Plugin\x20manifest\x20missing'));}var _0x137332=fs['readFileSync'](path['join'](_0x178c85,_0x20841a[0x0],_0xd1d7('0x73')));var _0xdba668=JSON[_0xd1d7('0x74')](_0x137332);if('undefined'==typeof _0xdba668['name']){return _0xb76678(new Error(_0xd1d7('0x75')));}if(_0xd1d7('0x76')==typeof _0xdba668['type']){return _0xb76678(new Error(_0xd1d7('0x77')));}if('undefined'==typeof _0xdba668['version']){return _0xb76678(new Error(_0xd1d7('0x78')));}if('undefined'==typeof _0xdba668[_0xd1d7('0x79')]){return _0xb76678(new Error(_0xd1d7('0x7a')));}if(_0xdba668[_0xd1d7('0x30')]===_0xd1d7('0x7b')){if(_0xd1d7('0x76')==typeof _0xdba668['parameters'][_0xd1d7('0x7c')]){return _0xb76678(new Error(_0xd1d7('0x7d')));}if(_0xd1d7('0x76')==typeof _0xdba668[_0xd1d7('0x79')]['views'][_0xd1d7('0x7e')]&&_0xd1d7('0x76')==typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x7c')][_0xd1d7('0x7f')]){return _0xb76678(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xdba668['type']===_0xd1d7('0x80')){if(_0xd1d7('0x76')==typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x81')]){return _0xb76678(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x82')]){return _0xb76678(new Error(_0xd1d7('0x83')));}}else{return _0xb76678(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x23a242=_0xdba668[_0xd1d7('0x2c')];var _0x34ad0e=_0xdba668[_0xd1d7('0x84')];var _0x4c80ca=_0xdba668[_0xd1d7('0x30')];var _0x5295ec=_0xdba668[_0xd1d7('0x85')]?_0xdba668[_0xd1d7('0x85')]:_0xd1d7('0x86');var _0x1255c8=_0xdba668[_0xd1d7('0x87')]?_0xdba668[_0xd1d7('0x87')]:_0xd1d7('0x88');var _0x34223c='';var _0x4da81c='';var _0x1e0144='';var _0x248c40='';var _0x30a6bf=_0xdba668[_0xd1d7('0x89')];if(_0x4c80ca===_0xd1d7('0x7b')){if(_0xd1d7('0x76')!=typeof _0xdba668[_0xd1d7('0x79')]['views'][_0xd1d7('0x7e')]){var _0x2278b8=_0xdba668['parameters'][_0xd1d7('0x7c')][_0xd1d7('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd1d7('0x8a')](_0x2278b8)){_0x34223c=path[_0xd1d7('0x4d')]('plugins',_0x205c17,_0x20841a[0x0],_0x2278b8);}else{_0x34223c=_0x2278b8;}}else{logger[_0xd1d7('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xd1d7('0x76')!=typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x7c')][_0xd1d7('0x7f')]){var _0x3888c6=_0xdba668[_0xd1d7('0x79')][_0xd1d7('0x7c')][_0xd1d7('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xd1d7('0x8a')](_0x3888c6)){_0x4da81c=path[_0xd1d7('0x4d')](_0xd1d7('0x8b'),_0x205c17,_0x20841a[0x0],_0x3888c6);}else{_0x4da81c=_0x3888c6;}}else{logger[_0xd1d7('0x65')](_0xd1d7('0x8c'));}}else if(_0x4c80ca===_0xd1d7('0x80')){_0x1e0144=_0xdba668[_0xd1d7('0x79')][_0xd1d7('0x81')];_0x248c40=_0xdba668['parameters'][_0xd1d7('0x82')];if(_0xd1d7('0x76')!=typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x7c')]){if('undefined'!=typeof _0xdba668[_0xd1d7('0x79')]['views'][_0xd1d7('0x7e')]){var _0x2278b8=_0xdba668['parameters'][_0xd1d7('0x7c')][_0xd1d7('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd1d7('0x8a')](_0x2278b8)){_0x34223c=path[_0xd1d7('0x4d')]('plugins',_0x205c17,_0x20841a[0x0],_0x2278b8);}else{_0x34223c=_0x2278b8;}}if(_0xd1d7('0x76')!=typeof _0xdba668[_0xd1d7('0x79')][_0xd1d7('0x7c')]['agent']){var _0x3888c6=_0xdba668['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xd1d7('0x8a')](_0x3888c6)){_0x4da81c=path['join']('plugins',_0x205c17,_0x20841a[0x0],_0x3888c6);}else{_0x4da81c=_0x3888c6;}}}}var _0x2e89e5={'name':_0x23a242,'description':_0x34ad0e,'path':path[_0xd1d7('0x4d')](_0x205c17,_0x20841a[0x0]),'type':_0x4c80ca,'sidebar':_0x5295ec,'icon':_0x1255c8,'adminUrl':_0x34223c,'agentUrl':_0x4da81c,'scriptName':_0x1e0144,'scriptPath':_0x248c40,'version':_0x30a6bf};removeReferences(_0x52ad96,null);return db[_0xd1d7('0x43')][_0xd1d7('0x8d')](_0x2e89e5)['then'](function(_0x19e188){var _0x200537={'role':_0x455b4b[_0xd1d7('0x8e')]['role'],'userProfileId':_0x455b4b['body']['userProfileId']};if(!_0x200537)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200537[_0xd1d7('0x8f')]===_0xd1d7('0x90')){var _0x55e292=_0x19e188['get']({'plain':!![]});return db[_0xd1d7('0x91')][_0xd1d7('0x4b')]({'where':{'name':_0xd1d7('0x26'),'userProfileId':_0x200537[_0xd1d7('0x92')]},'raw':!![]})[_0xd1d7('0x28')](function(_0x3f9259){if(_0x3f9259&&_0x3f9259[_0xd1d7('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x55e292[_0xd1d7('0x2c')],'resourceId':_0x55e292['id'],'type':_0x3f9259['name'],'sectionId':_0x3f9259['id']},{})['then'](function(){return _0x19e188;});}else{return _0x19e188;}})[_0xd1d7('0x47')](function(_0x492196){logger[_0xd1d7('0x2a')](_0xd1d7('0x94'),_0x492196);throw _0x492196;});}return _0x19e188;})[_0xd1d7('0x28')](respondWithResult(_0x4e0fca,null))[_0xd1d7('0x47')](handleError(_0x4e0fca,null));}});}catch(_0x3aa8dd){_0x4e0fca[_0xd1d7('0x1b')](0x1f4)[_0xd1d7('0x2d')](_0x3aa8dd);}};function removeReferences(_0xb74c54,_0x2b0e93){try{if(_0xb74c54){fs['unlinkSync'](_0xb74c54);logger[_0xd1d7('0x65')](_0xd1d7('0x95'));}if(_0x2b0e93){rimraf(_0x2b0e93,function(){});logger[_0xd1d7('0x65')](_0xd1d7('0x96'));}}catch(_0xba4c69){logger[_0xd1d7('0x2a')](_0xba4c69);}}exports['update']=function(_0x3538d6,_0x52cd4c,_0x16611d){return db[_0xd1d7('0x43')]['find']({'where':{'id':_0x3538d6[_0xd1d7('0x48')]['id']}})[_0xd1d7('0x28')](handleEntityNotFound(_0x52cd4c,null))[_0xd1d7('0x28')](saveUpdates(_0x3538d6['body'],null))[_0xd1d7('0x28')](respondWithResult(_0x52cd4c,null))['catch'](handleError(_0x52cd4c,null));};exports[_0xd1d7('0x97')]=function(_0x1bf1fa,_0x2bb391,_0x2f590d){return db['Plugin']['find']({'where':{'id':_0x1bf1fa[_0xd1d7('0x48')]['id']}})[_0xd1d7('0x28')](function(_0xcc1440){if(_0xcc1440){return _0xcc1440[_0xd1d7('0x24')]();}})[_0xd1d7('0x28')](function(_0x1a9023){rimraf(path['join'](config[_0xd1d7('0x4e')],'server/files/plugins',path[_0xd1d7('0x5b')](_0x1a9023[_0xd1d7('0x7')])),function(){});return _0x1a9023;})[_0xd1d7('0x28')](handleEntityNotFound(_0x2bb391,null))[_0xd1d7('0x28')](respondWithStatusCode(_0x2bb391,null))[_0xd1d7('0x47')](handleError(_0x2bb391,null));};exports[_0xd1d7('0x98')]=function(_0x43ed6c,_0xfa2d5b,_0x124b28){return BPromise['resolve']()['then'](function(){if(!_0x43ed6c['query']['path']){throw new Error(_0xd1d7('0x99'));}if(!_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x9a')]){throw new Error(_0xd1d7('0x9b'));}var _0x339c19=_0x43ed6c['query'][_0xd1d7('0x9c')]?_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x9c')]+':'+_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x9a')]:'http://localhost:'+_0x43ed6c[_0xd1d7('0x32')]['port'];var _0x2677a3=_0x43ed6c['query']['json']?_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x1c')]:!![];var _0x547e8e=_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x9d')]?_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x9d')]:null;var _0x4beba3={'method':_0x43ed6c[_0xd1d7('0x9e')],'uri':util[_0xd1d7('0x50')]('%s%s',_0x339c19,_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x7')]),'json':_0x2677a3,'resolveWithFullResponse':!![],'encoding':_0x547e8e,'qs':_0x43ed6c[_0xd1d7('0x32')]};if(_0x43ed6c['headers']){_0x4beba3[_0xd1d7('0x9f')]=_0x43ed6c[_0xd1d7('0x9f')];if(_0x4beba3['headers'][_0xd1d7('0xa0')]){delete _0x4beba3[_0xd1d7('0x9f')][_0xd1d7('0xa0')];}}if(_0x4beba3[_0xd1d7('0x9f')][_0xd1d7('0xa1')]){delete _0x4beba3[_0xd1d7('0x9f')][_0xd1d7('0xa1')];}return rp(_0x4beba3);})[_0xd1d7('0x28')](function(_0x2d3df7){if(_0x2d3df7){_0xfa2d5b[_0xd1d7('0x20')](_0x2d3df7[_0xd1d7('0x9f')]);logger['info'](_0x2d3df7[_0xd1d7('0x8e')]);if(_[_0xd1d7('0xa2')](_0x43ed6c[_0xd1d7('0x32')][_0xd1d7('0x7')],_0xd1d7('0x4c'))&&_0x2d3df7[_0xd1d7('0xa3')]==0x1f4){return _0xfa2d5b['sendStatus'](_0x2d3df7[_0xd1d7('0xa3')]);}else{return _0xfa2d5b[_0xd1d7('0x1b')](_0x2d3df7['statusCode'])[_0xd1d7('0x2d')](_0x2d3df7['body']);}}else{return _0xfa2d5b[_0xd1d7('0x1a')](0xc8);}})['catch'](handleError(_0xfa2d5b,null));};exports[_0xd1d7('0xa4')]=function(_0x27ead9,_0x2cf00b,_0x5898ce){return BPromise[_0xd1d7('0xa5')]()[_0xd1d7('0x28')](function(){if(!_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x27ead9['query'][_0xd1d7('0x9a')]){throw new Error(_0xd1d7('0x9b'));}var _0x2050cb=_0x27ead9[_0xd1d7('0x32')]['hostname']?_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x9c')]+':'+_0x27ead9[_0xd1d7('0x32')]['port']:'http://localhost:'+_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x9a')];var _0x4c5ca2=_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x1c')]?_0x27ead9['query'][_0xd1d7('0x1c')]:!![];var _0x204a88=_0x27ead9['query']['encoding']?_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x9d')]:null;var _0x5106aa={'method':_0x27ead9[_0xd1d7('0x9e')],'uri':util['format']('%s%s',_0x2050cb,_0x27ead9[_0xd1d7('0x32')][_0xd1d7('0x7')]),'json':_0x4c5ca2,'resolveWithFullResponse':!![],'encoding':_0x204a88,'body':_0x27ead9[_0xd1d7('0x8e')]};if(_0x27ead9[_0xd1d7('0x9f')]){_0x5106aa['headers']=_0x27ead9[_0xd1d7('0x9f')];if(_0x5106aa[_0xd1d7('0x9f')][_0xd1d7('0xa0')]){delete _0x5106aa['headers'][_0xd1d7('0xa0')];}}if(_0x5106aa[_0xd1d7('0x9f')][_0xd1d7('0xa1')]){delete _0x5106aa['headers'][_0xd1d7('0xa1')];}return rp(_0x5106aa);})[_0xd1d7('0x28')](function(_0x2cf5fc){if(_0x2cf5fc){_0x2cf00b['set'](_0x2cf5fc[_0xd1d7('0x9f')]);logger[_0xd1d7('0x65')](_0x2cf5fc[_0xd1d7('0x8e')]);return _0x2cf00b[_0xd1d7('0x1b')](_0x2cf5fc[_0xd1d7('0xa3')])[_0xd1d7('0x2d')](_0x2cf5fc[_0xd1d7('0x8e')]);}else{return _0x2cf00b['sendStatus'](0xc8);}})[_0xd1d7('0x47')](handleError(_0x2cf00b,null));}; \ No newline at end of file +var _0x881c=['redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','end','error','stack','send','index','map','Plugin','rawAttributes','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','download','path','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','views','Invalid\x20manifest:\x20views\x20missing','admin','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x580d0e,_0x1e5f43){var _0xb51111=function(_0x4718e7){while(--_0x4718e7){_0x580d0e['push'](_0x580d0e['shift']());}};_0xb51111(++_0x1e5f43);}(_0x881c,0x94));var _0xc881=function(_0x3dbea0,_0x229334){_0x3dbea0=_0x3dbea0-0x0;var _0x4deda7=_0x881c[_0x3dbea0];return _0x4deda7;};'use strict';var emlformat=require(_0xc881('0x0'));var rimraf=require(_0xc881('0x1'));var zipdir=require(_0xc881('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc881('0x3'));var moment=require(_0xc881('0x4'));var BPromise=require(_0xc881('0x5'));var Mustache=require(_0xc881('0x6'));var util=require(_0xc881('0x7'));var path=require('path');var sox=require(_0xc881('0x8'));var csv=require(_0xc881('0x9'));var ejs=require(_0xc881('0xa'));var fs=require('fs');var fs_extra=require(_0xc881('0xb'));var _=require(_0xc881('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc881('0xd'));var deskjs=require(_0xc881('0xe'));var toCsv=require(_0xc881('0x9'));var querystring=require(_0xc881('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xc881('0x1'));var archiver=require('archiver');var Redis=require(_0xc881('0x10'));var authService=require(_0xc881('0x11'));var qs=require(_0xc881('0x12'));var as=require(_0xc881('0x13'));var hardwareService=require(_0xc881('0x14'));var logger=require(_0xc881('0x15'))(_0xc881('0x16'));var utils=require(_0xc881('0x17'));var config=require(_0xc881('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc881('0x19'))['db'];config['redis']=_['defaults'](config[_0xc881('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc881('0x1b'))(new Redis(config[_0xc881('0x1a')]));require(_0xc881('0x1c'))[_0xc881('0x1d')](socket);function respondWithStatusCode(_0xb66315,_0x2a4ca5){_0x2a4ca5=_0x2a4ca5||0xcc;return function(_0x5d9df4){if(_0x5d9df4){return _0xb66315[_0xc881('0x1e')](_0x2a4ca5);}return _0xb66315[_0xc881('0x1f')](_0x2a4ca5)['end']();};}function respondWithResult(_0x22e80e,_0x3326bf){_0x3326bf=_0x3326bf||0xc8;return function(_0x488bdd){if(_0x488bdd){return _0x22e80e[_0xc881('0x1f')](_0x3326bf)['json'](_0x488bdd);}};}function respondWithFilteredResult(_0x33ae30,_0x1b807c){return function(_0x24f0bd){if(_0x24f0bd){var _0x2c2299=typeof _0x1b807c[_0xc881('0x20')]===_0xc881('0x21')&&typeof _0x1b807c[_0xc881('0x22')]==='undefined';var _0x40a48f=_0x24f0bd[_0xc881('0x23')];var _0x407808=_0x2c2299?0x0:_0x1b807c[_0xc881('0x20')];var _0x45f57e=_0x2c2299?_0x24f0bd[_0xc881('0x23')]:_0x1b807c[_0xc881('0x20')]+_0x1b807c[_0xc881('0x22')];var _0x3e4564;if(_0x45f57e>=_0x40a48f){_0x45f57e=_0x40a48f;_0x3e4564=0xc8;}else{_0x3e4564=0xce;}_0x33ae30[_0xc881('0x1f')](_0x3e4564);return _0x33ae30[_0xc881('0x24')](_0xc881('0x25'),_0x407808+'-'+_0x45f57e+'/'+_0x40a48f)[_0xc881('0x26')](_0x24f0bd);}return null;};}function patchUpdates(_0x1b81da){return function(_0x2b5f33){try{jsonpatch[_0xc881('0x27')](_0x2b5f33,_0x1b81da,!![]);}catch(_0x41e453){return BPromise[_0xc881('0x28')](_0x41e453);}return _0x2b5f33[_0xc881('0x29')]();};}function saveUpdates(_0x228cdd,_0x5b08d5){return function(_0x2be1ef){if(_0x2be1ef){return _0x2be1ef[_0xc881('0x2a')](_0x228cdd)['then'](function(_0x24fbf6){return _0x24fbf6;});}return null;};}function removeEntity(_0x5f55fa,_0x2527d2){return function(_0x26dc67){if(_0x26dc67){return _0x26dc67[_0xc881('0x2b')]()[_0xc881('0x2c')](function(){var _0x1224f9=_0x26dc67[_0xc881('0x2d')]({'plain':!![]});var _0x217df3=_0xc881('0x2e');return db[_0xc881('0x2f')][_0xc881('0x2b')]({'where':{'type':_0x217df3,'resourceId':_0x1224f9['id']}})['then'](function(){return _0x26dc67;});})[_0xc881('0x2c')](function(){_0x5f55fa[_0xc881('0x1f')](0xcc)[_0xc881('0x30')]();});}};}function handleEntityNotFound(_0x53ee6e,_0x3bba31){return function(_0x59cea5){if(!_0x59cea5){_0x53ee6e[_0xc881('0x1e')](0x194);}return _0x59cea5;};}function handleError(_0x5cc12d,_0x273b2f){_0x273b2f=_0x273b2f||0x1f4;return function(_0x193bb2){logger[_0xc881('0x31')](_0x193bb2[_0xc881('0x32')]);if(_0x193bb2['name']){delete _0x193bb2['name'];}_0x5cc12d[_0xc881('0x1f')](_0x273b2f)[_0xc881('0x33')](_0x193bb2);};}exports[_0xc881('0x34')]=function(_0x2d646b,_0x1dbe02){var _0x1b2eec={},_0x45c8ff={},_0xf40531={'count':0x0,'rows':[]};var _0x1436e1=_[_0xc881('0x35')](db[_0xc881('0x36')][_0xc881('0x37')],function(_0x1d62ef){return{'name':_0x1d62ef['fieldName'],'type':_0x1d62ef[_0xc881('0x38')][_0xc881('0x39')]};});_0x45c8ff['model']=_[_0xc881('0x35')](_0x1436e1,_0xc881('0x3a'));_0x45c8ff[_0xc881('0x3b')]=_['keys'](_0x2d646b[_0xc881('0x3b')]);_0x45c8ff[_0xc881('0x3c')]=_[_0xc881('0x3d')](_0x45c8ff[_0xc881('0x3e')],_0x45c8ff[_0xc881('0x3b')]);_0x1b2eec['attributes']=_['intersection'](_0x45c8ff['model'],qs[_0xc881('0x3f')](_0x2d646b[_0xc881('0x3b')][_0xc881('0x3f')]));_0x1b2eec['attributes']=_0x1b2eec[_0xc881('0x40')][_0xc881('0x41')]?_0x1b2eec['attributes']:_0x45c8ff[_0xc881('0x3e')];if(!_0x2d646b[_0xc881('0x3b')][_0xc881('0x42')]('nolimit')){_0x1b2eec[_0xc881('0x22')]=qs['limit'](_0x2d646b['query'][_0xc881('0x22')]);_0x1b2eec['offset']=qs[_0xc881('0x20')](_0x2d646b[_0xc881('0x3b')][_0xc881('0x20')]);}_0x1b2eec[_0xc881('0x43')]=qs[_0xc881('0x44')](_0x2d646b[_0xc881('0x3b')][_0xc881('0x44')]);_0x1b2eec['where']=qs[_0xc881('0x3c')](_[_0xc881('0x45')](_0x2d646b[_0xc881('0x3b')],_0x45c8ff['filters']),_0x1436e1);if(_0x2d646b[_0xc881('0x3b')][_0xc881('0x46')]){_0x1b2eec['where']=_['merge'](_0x1b2eec[_0xc881('0x47')],{'$or':_['map'](_0x1436e1,function(_0x586cbf){if(_0x586cbf[_0xc881('0x38')]!=='VIRTUAL'){var _0x18d07c={};_0x18d07c[_0x586cbf[_0xc881('0x3a')]]={'$like':'%'+_0x2d646b['query'][_0xc881('0x46')]+'%'};return _0x18d07c;}})});}_0x1b2eec=_[_0xc881('0x48')]({},_0x1b2eec,_0x2d646b[_0xc881('0x49')]);var _0x369535={'where':_0x1b2eec[_0xc881('0x47')]};return db[_0xc881('0x36')][_0xc881('0x23')](_0x369535)[_0xc881('0x2c')](function(_0x4a976c){_0xf40531[_0xc881('0x23')]=_0x4a976c;if(_0x2d646b['query']['includeAll']){_0x1b2eec[_0xc881('0x4a')]=[{'all':!![]}];}return db[_0xc881('0x36')][_0xc881('0x4b')](_0x1b2eec);})['then'](function(_0x392883){_0xf40531[_0xc881('0x4c')]=_0x392883;return _0xf40531;})[_0xc881('0x2c')](respondWithFilteredResult(_0x1dbe02,_0x1b2eec))[_0xc881('0x4d')](handleError(_0x1dbe02,null));};exports[_0xc881('0x4e')]=function(_0x191d37,_0x3860f5){var _0x474c4d={'raw':!![],'where':{'id':_0x191d37[_0xc881('0x4f')]['id']}},_0x15d998={};_0x15d998[_0xc881('0x3e')]=_[_0xc881('0x50')](db[_0xc881('0x36')][_0xc881('0x37')]);_0x15d998[_0xc881('0x3b')]=_[_0xc881('0x50')](_0x191d37[_0xc881('0x3b')]);_0x15d998['filters']=_['intersection'](_0x15d998[_0xc881('0x3e')],_0x15d998[_0xc881('0x3b')]);_0x474c4d['attributes']=_['intersection'](_0x15d998[_0xc881('0x3e')],qs[_0xc881('0x3f')](_0x191d37[_0xc881('0x3b')][_0xc881('0x3f')]));_0x474c4d[_0xc881('0x40')]=_0x474c4d[_0xc881('0x40')][_0xc881('0x41')]?_0x474c4d[_0xc881('0x40')]:_0x15d998[_0xc881('0x3e')];if(_0x191d37[_0xc881('0x3b')][_0xc881('0x51')]){_0x474c4d[_0xc881('0x4a')]=[{'all':!![]}];}_0x474c4d=_['merge']({},_0x474c4d,_0x191d37[_0xc881('0x49')]);return db[_0xc881('0x36')][_0xc881('0x52')](_0x474c4d)[_0xc881('0x2c')](handleEntityNotFound(_0x3860f5,null))[_0xc881('0x2c')](respondWithResult(_0x3860f5,null))['catch'](handleError(_0x3860f5,null));};exports[_0xc881('0x53')]=function(_0x19e89c,_0x2cf04d,_0x2b719f){return db[_0xc881('0x36')]['find']({'where':{'id':_0x19e89c['params']['id']},'attributes':[_0xc881('0x3a'),_0xc881('0x54')],'raw':!![]})[_0xc881('0x2c')](handleEntityNotFound(_0x2cf04d,null))[_0xc881('0x2c')](function(_0x305cdb){if(_0x305cdb){var _0x2fc125=path[_0xc881('0x55')](config[_0xc881('0x56')],'server/files/plugins',util['format'](_0xc881('0x57'),path[_0xc881('0x58')](_0x305cdb[_0xc881('0x54')])));var _0x385b5c=fs[_0xc881('0x59')](_0x2fc125);var _0x4a0fc3=archiver(_0xc881('0x5a'),{'zlib':{'level':0x9}});_0x4a0fc3['on'](_0xc881('0x5b'),function(_0xa4aaa4){if(_0xa4aaa4[_0xc881('0x5c')]===_0xc881('0x5d')){logger['error'](_0xa4aaa4);}else{throw new db['Sequelize'][(_0xc881('0x5e'))](_0xc881('0x5f'));}});_0x4a0fc3['on'](_0xc881('0x31'),function(_0x14671e){throw new db['Sequelize'][(_0xc881('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4a0fc3[_0xc881('0x60')](_0x385b5c);_0x4a0fc3[_0xc881('0x61')](_0xc881('0x62'),{'cwd':path[_0xc881('0x55')](config['root'],_0xc881('0x63'),path[_0xc881('0x64')](_0x305cdb[_0xc881('0x54')])),'ignore':[path['join'](path[_0xc881('0x58')](_0x305cdb[_0xc881('0x54')]),_0xc881('0x65')),path[_0xc881('0x55')](path['basename'](_0x305cdb['path']),_0xc881('0x66'))],'nodir':!![]})[_0xc881('0x67')]();_0x385b5c['on'](_0xc881('0x68'),function(){if(!fs[_0xc881('0x69')](_0x2fc125)){throw new db[(_0xc881('0x6a'))][(_0xc881('0x5e'))](_0xc881('0x6b'));}return _0x2cf04d[_0xc881('0x53')](_0x2fc125,util[_0xc881('0x6c')](_0xc881('0x57'),path[_0xc881('0x58')](_0x305cdb[_0xc881('0x54')])),function(_0x3d5696){if(_0x3d5696){throw new db[(_0xc881('0x6a'))][(_0xc881('0x5e'))](_0xc881('0x6d'));}fs['unlinkSync'](_0x2fc125);logger[_0xc881('0x6e')](_0xc881('0x6f'));logger[_0xc881('0x6e')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x2cf04d,null));};exports['upload']=function(_0x428220,_0x38a759,_0x303558){var _0x1b2005=path[_0xc881('0x58')](_0x428220[_0xc881('0x70')][_0xc881('0x71')],path[_0xc881('0x72')](_0x428220[_0xc881('0x70')][_0xc881('0x71')]));var _0x313b8d=path[_0xc881('0x55')](config[_0xc881('0x56')],_0xc881('0x63'),_0x428220[_0xc881('0x70')][_0xc881('0x71')]);var _0x1f5a91=path['join'](config[_0xc881('0x56')],_0xc881('0x63'),_0x1b2005);logger[_0xc881('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x313b8d);logger[_0xc881('0x6e')](_0xc881('0x73'),_0x1f5a91);try{fs[_0xc881('0x74')](_0x313b8d,parseInt('0777',0x8));extract(_0x313b8d,{'dir':_0x1f5a91},function(_0x198661){if(_0x198661){logger[_0xc881('0x31')](_0x198661);handleError(_0x198661,!![]);};var _0x3877e9=fs[_0xc881('0x75')](_0x1f5a91);if(_0x3877e9[_0xc881('0x41')]>0x1){removeReferences(_0x313b8d,_0x1f5a91);logger[_0xc881('0x31')]('Invalid\x20plugin\x20structure');return _0x303558(new Error(_0xc881('0x76')));}var _0x5ee29a=fs['lstatSync'](path[_0xc881('0x55')](_0x1f5a91,_0x3877e9[0x0]));if(_0x5ee29a[_0xc881('0x77')]()){removeReferences(_0x313b8d,_0x1f5a91);logger[_0xc881('0x31')](_0xc881('0x76'));return _0x303558(new Error(_0xc881('0x76')));}if(_0x5ee29a[_0xc881('0x78')]()){var _0x325b08=fs[_0xc881('0x75')](path[_0xc881('0x55')](_0x1f5a91,_0x3877e9[0x0]));if(_0x325b08['length']===0x0){removeReferences(_0x313b8d,_0x1f5a91);logger['error'](_0xc881('0x76'));return _0x303558(new Error(_0xc881('0x76')));}var _0x18df41=_0x325b08[_0xc881('0x79')](function(_0x3fd352){return _0x3fd352===_0xc881('0x7a');});if(!_0x18df41){return _0x303558(new Error(_0xc881('0x7b')));}var _0x31bd7f=fs[_0xc881('0x7c')](path['join'](_0x1f5a91,_0x3877e9[0x0],_0xc881('0x7a')));var _0x5d5107=JSON['parse'](_0x31bd7f);if(_0xc881('0x21')==typeof _0x5d5107[_0xc881('0x3a')]){return _0x303558(new Error(_0xc881('0x7d')));}if('undefined'==typeof _0x5d5107[_0xc881('0x38')]){return _0x303558(new Error(_0xc881('0x7e')));}if(_0xc881('0x21')==typeof _0x5d5107[_0xc881('0x7f')]){return _0x303558(new Error(_0xc881('0x80')));}if('undefined'==typeof _0x5d5107['parameters']){return _0x303558(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5d5107[_0xc881('0x38')]==='html'){if(_0xc881('0x21')==typeof _0x5d5107['parameters'][_0xc881('0x81')]){return _0x303558(new Error(_0xc881('0x82')));}if('undefined'==typeof _0x5d5107['parameters'][_0xc881('0x81')][_0xc881('0x83')]&&'undefined'==typeof _0x5d5107[_0xc881('0x84')]['views'][_0xc881('0x85')]){return _0x303558(new Error(_0xc881('0x86')));}}else if(_0x5d5107[_0xc881('0x38')]==='script'){if(_0xc881('0x21')==typeof _0x5d5107['parameters']['scriptName']){return _0x303558(new Error(_0xc881('0x87')));}if('undefined'==typeof _0x5d5107['parameters'][_0xc881('0x88')]){return _0x303558(new Error(_0xc881('0x89')));}}else{return _0x303558(new Error(_0xc881('0x8a')));}var _0x4a33cb=_0x5d5107['name'];var _0x1724ec=_0x5d5107[_0xc881('0x8b')];var _0x265641=_0x5d5107[_0xc881('0x38')];var _0x16cdc8=_0x5d5107['sidebar']?_0x5d5107['sidebar']:_0xc881('0x8c');var _0xfa002c=_0x5d5107[_0xc881('0x8d')]?_0x5d5107[_0xc881('0x8d')]:'icon-apps';var _0x28961c='';var _0x813ba5='';var _0xa40f5c='';var _0x5cf7a4='';var _0x17ba67=_0x5d5107[_0xc881('0x7f')];if(_0x265641===_0xc881('0x8e')){if(_0xc881('0x21')!=typeof _0x5d5107[_0xc881('0x84')][_0xc881('0x81')][_0xc881('0x83')]){var _0x57304e=_0x5d5107['parameters'][_0xc881('0x81')][_0xc881('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xc881('0x8f')](_0x57304e)){_0x28961c=path[_0xc881('0x55')](_0xc881('0x90'),_0x1b2005,_0x3877e9[0x0],_0x57304e);}else{_0x28961c=_0x57304e;}}else{logger[_0xc881('0x6e')](_0xc881('0x91'));}if(_0xc881('0x21')!=typeof _0x5d5107[_0xc881('0x84')][_0xc881('0x81')]['agent']){var _0x285b7b=_0x5d5107[_0xc881('0x84')][_0xc881('0x81')][_0xc881('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xc881('0x8f')](_0x285b7b)){_0x813ba5=path['join'](_0xc881('0x90'),_0x1b2005,_0x3877e9[0x0],_0x285b7b);}else{_0x813ba5=_0x285b7b;}}else{logger[_0xc881('0x6e')](_0xc881('0x92'));}}else if(_0x265641==='script'){_0xa40f5c=_0x5d5107[_0xc881('0x84')][_0xc881('0x93')];_0x5cf7a4=_0x5d5107[_0xc881('0x84')][_0xc881('0x88')];if(_0xc881('0x21')!=typeof _0x5d5107[_0xc881('0x84')][_0xc881('0x81')]){if(_0xc881('0x21')!=typeof _0x5d5107['parameters'][_0xc881('0x81')][_0xc881('0x83')]){var _0x57304e=_0x5d5107[_0xc881('0x84')][_0xc881('0x81')][_0xc881('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xc881('0x8f')](_0x57304e)){_0x28961c=path[_0xc881('0x55')]('plugins',_0x1b2005,_0x3877e9[0x0],_0x57304e);}else{_0x28961c=_0x57304e;}}if(_0xc881('0x21')!=typeof _0x5d5107[_0xc881('0x84')][_0xc881('0x81')][_0xc881('0x85')]){var _0x285b7b=_0x5d5107[_0xc881('0x84')][_0xc881('0x81')][_0xc881('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x285b7b)){_0x813ba5=path[_0xc881('0x55')](_0xc881('0x90'),_0x1b2005,_0x3877e9[0x0],_0x285b7b);}else{_0x813ba5=_0x285b7b;}}}}var _0x3f3586={'name':_0x4a33cb,'description':_0x1724ec,'path':path['join'](_0x1b2005,_0x3877e9[0x0]),'type':_0x265641,'sidebar':_0x16cdc8,'icon':_0xfa002c,'adminUrl':_0x28961c,'agentUrl':_0x813ba5,'scriptName':_0xa40f5c,'scriptPath':_0x5cf7a4,'version':_0x17ba67};removeReferences(_0x313b8d,null);return db[_0xc881('0x36')][_0xc881('0x94')](_0x3f3586)[_0xc881('0x2c')](function(_0x22e634){var _0x147c1a={'role':_0x428220['body'][_0xc881('0x95')],'userProfileId':_0x428220[_0xc881('0x96')][_0xc881('0x97')]};if(!_0x147c1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x147c1a[_0xc881('0x95')]===_0xc881('0x98')){var _0x112abf=_0x22e634[_0xc881('0x2d')]({'plain':!![]});return db[_0xc881('0x99')]['find']({'where':{'name':'Plugins','userProfileId':_0x147c1a[_0xc881('0x97')]},'raw':!![]})[_0xc881('0x2c')](function(_0x17385f){if(_0x17385f&&_0x17385f[_0xc881('0x9a')]===0x0){return db[_0xc881('0x2f')]['create']({'name':_0x112abf['name'],'resourceId':_0x112abf['id'],'type':_0x17385f[_0xc881('0x3a')],'sectionId':_0x17385f['id']},{})['then'](function(){return _0x22e634;});}else{return _0x22e634;}})[_0xc881('0x4d')](function(_0x3bf0ac){logger[_0xc881('0x31')](_0xc881('0x9b'),_0x3bf0ac);throw _0x3bf0ac;});}return _0x22e634;})[_0xc881('0x2c')](respondWithResult(_0x38a759,null))[_0xc881('0x4d')](handleError(_0x38a759,null));}});}catch(_0x504b76){_0x38a759[_0xc881('0x1f')](0x1f4)[_0xc881('0x33')](_0x504b76);}};function removeReferences(_0x44e6f4,_0x57fee5){try{if(_0x44e6f4){fs[_0xc881('0x9c')](_0x44e6f4);logger[_0xc881('0x6e')](_0xc881('0x9d'));}if(_0x57fee5){rimraf(_0x57fee5,function(){});logger[_0xc881('0x6e')](_0xc881('0x9e'));}}catch(_0xa4c636){logger['error'](_0xa4c636);}}exports['update']=function(_0x49f29e,_0x48d9be,_0xb9eb62){return db[_0xc881('0x36')][_0xc881('0x52')]({'where':{'id':_0x49f29e['params']['id']}})['then'](handleEntityNotFound(_0x48d9be,null))[_0xc881('0x2c')](saveUpdates(_0x49f29e[_0xc881('0x96')],null))[_0xc881('0x2c')](respondWithResult(_0x48d9be,null))[_0xc881('0x4d')](handleError(_0x48d9be,null));};exports['delete']=function(_0x10b4e1,_0xf7de5,_0x3e9f76){return db[_0xc881('0x36')][_0xc881('0x52')]({'where':{'id':_0x10b4e1[_0xc881('0x4f')]['id']}})[_0xc881('0x2c')](function(_0x1c7ea2){if(_0x1c7ea2){return _0x1c7ea2[_0xc881('0x2b')]();}})[_0xc881('0x2c')](function(_0x28d5c3){rimraf(path['join'](config[_0xc881('0x56')],_0xc881('0x63'),path[_0xc881('0x64')](_0x28d5c3['path'])),function(){});return _0x28d5c3;})[_0xc881('0x2c')](handleEntityNotFound(_0xf7de5,null))[_0xc881('0x2c')](respondWithStatusCode(_0xf7de5,null))[_0xc881('0x4d')](handleError(_0xf7de5,null));};exports[_0xc881('0x9f')]=function(_0x29b1d6,_0x44c355,_0x26717f){return BPromise[_0xc881('0xa0')]()[_0xc881('0x2c')](function(){if(!_0x29b1d6[_0xc881('0x3b')][_0xc881('0x54')]){throw new Error(_0xc881('0xa1'));}if(!_0x29b1d6[_0xc881('0x3b')]['port']){throw new Error(_0xc881('0xa2'));}var _0x126224=_0x29b1d6[_0xc881('0x3b')]['hostname']?_0x29b1d6['query'][_0xc881('0xa3')]+':'+_0x29b1d6[_0xc881('0x3b')][_0xc881('0xa4')]:_0xc881('0xa5')+_0x29b1d6[_0xc881('0x3b')]['port'];var _0x52530d=_0x29b1d6['query'][_0xc881('0x26')]?_0x29b1d6[_0xc881('0x3b')][_0xc881('0x26')]:!![];var _0x14da88=_0x29b1d6['query'][_0xc881('0xa6')]?_0x29b1d6[_0xc881('0x3b')][_0xc881('0xa6')]:null;var _0x396037={'method':_0x29b1d6[_0xc881('0xa7')],'uri':util[_0xc881('0x6c')]('%s%s',_0x126224,_0x29b1d6[_0xc881('0x3b')][_0xc881('0x54')]),'json':_0x52530d,'resolveWithFullResponse':!![],'encoding':_0x14da88,'qs':_0x29b1d6[_0xc881('0x3b')]};if(_0x29b1d6['headers']){_0x396037[_0xc881('0xa8')]=_0x29b1d6[_0xc881('0xa8')];if(_0x396037[_0xc881('0xa8')][_0xc881('0xa9')]){delete _0x396037[_0xc881('0xa8')][_0xc881('0xa9')];}}if(_0x396037[_0xc881('0xa8')][_0xc881('0xaa')]){delete _0x396037[_0xc881('0xa8')][_0xc881('0xaa')];}return rp(_0x396037);})[_0xc881('0x2c')](function(_0x917fd5){if(_0x917fd5){_0x44c355['set'](_0x917fd5['headers']);logger[_0xc881('0x6e')](_0x917fd5['body']);if(_[_0xc881('0xab')](_0x29b1d6[_0xc881('0x3b')][_0xc881('0x54')],_0xc881('0x53'))&&_0x917fd5[_0xc881('0xac')]==0x1f4){return _0x44c355[_0xc881('0x1e')](_0x917fd5[_0xc881('0xac')]);}else{return _0x44c355[_0xc881('0x1f')](_0x917fd5[_0xc881('0xac')])['send'](_0x917fd5['body']);}}else{return _0x44c355['sendStatus'](0xc8);}})[_0xc881('0x4d')](handleError(_0x44c355,null));};exports['webhookPost']=function(_0x1c734a,_0x5228f7,_0x55c3dd){return BPromise[_0xc881('0xa0')]()[_0xc881('0x2c')](function(){if(!_0x1c734a['query']['path']){throw new Error(_0xc881('0xa1'));}if(!_0x1c734a[_0xc881('0x3b')][_0xc881('0xa4')]){throw new Error(_0xc881('0xa2'));}var _0x5e6f8d=_0x1c734a[_0xc881('0x3b')]['hostname']?_0x1c734a[_0xc881('0x3b')][_0xc881('0xa3')]+':'+_0x1c734a[_0xc881('0x3b')][_0xc881('0xa4')]:_0xc881('0xa5')+_0x1c734a['query']['port'];var _0x222a54=_0x1c734a[_0xc881('0x3b')][_0xc881('0x26')]?_0x1c734a[_0xc881('0x3b')][_0xc881('0x26')]:!![];var _0x4a377a=_0x1c734a[_0xc881('0x3b')]['encoding']?_0x1c734a[_0xc881('0x3b')][_0xc881('0xa6')]:null;var _0x2db6a7={'method':_0x1c734a[_0xc881('0xa7')],'uri':util[_0xc881('0x6c')](_0xc881('0xad'),_0x5e6f8d,_0x1c734a[_0xc881('0x3b')][_0xc881('0x54')]),'json':_0x222a54,'resolveWithFullResponse':!![],'encoding':_0x4a377a,'body':_0x1c734a[_0xc881('0x96')]};if(_0x1c734a[_0xc881('0xa8')]){_0x2db6a7['headers']=_0x1c734a[_0xc881('0xa8')];if(_0x2db6a7[_0xc881('0xa8')][_0xc881('0xa9')]){delete _0x2db6a7[_0xc881('0xa8')][_0xc881('0xa9')];}}if(_0x2db6a7[_0xc881('0xa8')]['content-type']){delete _0x2db6a7[_0xc881('0xa8')][_0xc881('0xaa')];}return rp(_0x2db6a7);})[_0xc881('0x2c')](function(_0x377fc2){if(_0x377fc2){_0x5228f7[_0xc881('0x24')](_0x377fc2[_0xc881('0xa8')]);logger[_0xc881('0x6e')](_0x377fc2[_0xc881('0x96')]);return _0x5228f7[_0xc881('0x1f')](_0x377fc2['statusCode'])['send'](_0x377fc2[_0xc881('0x96')]);}else{return _0x5228f7['sendStatus'](0xc8);}})['catch'](handleError(_0x5228f7,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ffa231f..e5824a4 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 _0x4cff=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x4cff,0x14a));var _0xf4cf=function(_0x409e18,_0x460723){_0x409e18=_0x409e18-0x0;var _0x1b0acb=_0x4cff[_0x409e18];return _0x1b0acb;};'use strict';var EventEmitter=require(_0xf4cf('0x0'));var Plugin=require(_0xf4cf('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xf4cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4cf('0x3'),'afterDestroy':_0xf4cf('0x4')};function emitEvent(_0x548b62){return function(_0x3d5ddc,_0x1c1936,_0x9bcfbe){PluginEvents[_0xf4cf('0x5')](_0x548b62+':'+_0x3d5ddc['id'],_0x3d5ddc);PluginEvents[_0xf4cf('0x5')](_0x548b62,_0x3d5ddc);_0x9bcfbe(null);};}for(var e in events){if(events[_0xf4cf('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf4cf('0x7')]=PluginEvents; \ No newline at end of file +var _0xe4d9=['../../mysqldb','Plugin','save','emit','hasOwnProperty','hook','events'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xe4d9,0x141));var _0x9e4d=function(_0x10c1ba,_0x26ce4c){_0x10c1ba=_0x10c1ba-0x0;var _0x29d97f=_0xe4d9[_0x10c1ba];return _0x29d97f;};'use strict';var EventEmitter=require(_0x9e4d('0x0'));var Plugin=require(_0x9e4d('0x1'))['db'][_0x9e4d('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e4d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46bb64){return function(_0x228328,_0x581985,_0x2bf0c2){PluginEvents[_0x9e4d('0x4')](_0x46bb64+':'+_0x228328['id'],_0x228328);PluginEvents['emit'](_0x46bb64,_0x228328);_0x2bf0c2(null);};}for(var e in events){if(events[_0x9e4d('0x5')](e)){var event=events[e];Plugin[_0x9e4d('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3ff96ae..b010e75 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 _0xfc2d=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','plugins','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfc2d,0x184));var _0xdfc2=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xfc2d[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xdfc2('0x0'));var util=require(_0xdfc2('0x1'));var logger=require(_0xdfc2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdfc2('0x3'));var rp=require(_0xdfc2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfc2('0x5'));var config=require(_0xdfc2('0x6'));var attributes=require('./plugin.attributes');module[_0xdfc2('0x7')]=function(_0x1c4642,_0x21c5b9){return _0x1c4642[_0xdfc2('0x8')]('Plugin',attributes,{'tableName':_0xdfc2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc1a=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x215cb3,_0x2f9ce4){var _0xbacf6a=function(_0xe6a1bf){while(--_0xe6a1bf){_0x215cb3['push'](_0x215cb3['shift']());}};_0xbacf6a(++_0x2f9ce4);}(_0xcc1a,0x87));var _0xacc1=function(_0x5c1329,_0x44d752){_0x5c1329=_0x5c1329-0x0;var _0x282631=_0xcc1a[_0x5c1329];return _0x282631;};'use strict';var _=require(_0xacc1('0x0'));var util=require(_0xacc1('0x1'));var logger=require(_0xacc1('0x2'))(_0xacc1('0x3'));var moment=require(_0xacc1('0x4'));var BPromise=require(_0xacc1('0x5'));var rp=require(_0xacc1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xacc1('0x7'));var attributes=require(_0xacc1('0x8'));module['exports']=function(_0x1a9e4f,_0x261af8){return _0x1a9e4f[_0xacc1('0x9')](_0xacc1('0xa'),attributes,{'tableName':_0xacc1('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 20758ff..35ad6e9 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 _0xe1e3=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','stringify','code','error','Plugin,\x20%s,\x20%s','message','request\x20sent','result','catch','CreatePlugin','create','body','options','raw','debug','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x283730,_0xb3a4a8){_0x283730=_0x283730-0x0;var _0xb4763b=_0xe1e3[_0x283730];return _0xb4763b;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});config['redis']=_[_0x3e1e('0xa')](config[_0x3e1e('0xb')],{'host':_0x3e1e('0xc'),'port':0x18eb});var socket=require(_0x3e1e('0xd'))(new Redis(config[_0x3e1e('0xb')]));require(_0x3e1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c4c25,_0x5060e8,_0x31d205){return new BPromise(function(_0x5b0df8,_0x349460){return client[_0x3e1e('0xf')](_0x5c4c25,_0x31d205)[_0x3e1e('0x10')](function(_0x594c59){logger[_0x3e1e('0x11')]('Plugin,\x20%s,\x20%s',_0x5060e8,'request\x20sent');logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x5060e8,'request\x20sent',JSON[_0x3e1e('0x12')](_0x594c59));if(_0x594c59['error']){if(_0x594c59['error'][_0x3e1e('0x13')]===0x1f4){logger[_0x3e1e('0x14')](_0x3e1e('0x15'),_0x5060e8,_0x594c59['error']['message']);return _0x349460(_0x594c59[_0x3e1e('0x14')][_0x3e1e('0x16')]);}logger['error'](_0x3e1e('0x15'),_0x5060e8,_0x594c59[_0x3e1e('0x14')]['message']);return _0x5b0df8(_0x594c59[_0x3e1e('0x14')]['message']);}else{logger[_0x3e1e('0x11')](_0x3e1e('0x15'),_0x5060e8,_0x3e1e('0x17'));_0x5b0df8(_0x594c59[_0x3e1e('0x18')][_0x3e1e('0x16')]);}})[_0x3e1e('0x19')](function(_0x569f49){logger['error']('Plugin,\x20%s,\x20%s',_0x5060e8,_0x569f49);_0x349460(_0x569f49);});});}exports[_0x3e1e('0x1a')]=function(_0x30acbf){var _0xa3e99c=this;return new Promise(function(_0x57c660,_0x1c5acd){return db['Plugin'][_0x3e1e('0x1b')](_0x30acbf[_0x3e1e('0x1c')],{'raw':_0x30acbf[_0x3e1e('0x1d')]?_0x30acbf['options'][_0x3e1e('0x1e')]===undefined?!![]:![]:!![]})[_0x3e1e('0x10')](function(_0xefa098){logger['info']('CreatePlugin',_0x30acbf);logger[_0x3e1e('0x1f')](_0x3e1e('0x1a'),_0x30acbf,JSON['stringify'](_0xefa098));_0x57c660(_0xefa098);})[_0x3e1e('0x19')](function(_0x56ae51){logger[_0x3e1e('0x14')](_0x3e1e('0x1a'),_0x56ae51[_0x3e1e('0x16')],_0x30acbf);_0x1c5acd(_0xa3e99c[_0x3e1e('0x14')](0x1f4,_0x56ae51[_0x3e1e('0x16')]));});});}; \ No newline at end of file +var _0xd506=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd506,0xcc));var _0x6d50=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd506[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6d50('0x1'));var rs=require(_0x6d50('0x2'));var fs=require('fs');var Redis=require(_0x6d50('0x3'));var db=require(_0x6d50('0x4'))['db'];var utils=require(_0x6d50('0x5'));var logger=require(_0x6d50('0x6'))(_0x6d50('0x7'));var config=require(_0x6d50('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d50('0x9')]['http']({'port':0x232a});config[_0x6d50('0xa')]=_[_0x6d50('0xb')](config[_0x6d50('0xa')],{'host':_0x6d50('0xc'),'port':0x18eb});var socket=require(_0x6d50('0xd'))(new Redis(config[_0x6d50('0xa')]));require(_0x6d50('0xe'))[_0x6d50('0xf')](socket);function respondWithRpcPromise(_0x2bd936,_0x38f3ff,_0x57ac8f){return new BPromise(function(_0x4395a9,_0x49ae2b){return client['request'](_0x2bd936,_0x57ac8f)[_0x6d50('0x10')](function(_0xc971c2){logger[_0x6d50('0x11')](_0x6d50('0x12'),_0x38f3ff,_0x6d50('0x13'));logger[_0x6d50('0x14')](_0x6d50('0x15'),_0x38f3ff,_0x6d50('0x13'),JSON[_0x6d50('0x16')](_0xc971c2));if(_0xc971c2[_0x6d50('0x17')]){if(_0xc971c2[_0x6d50('0x17')][_0x6d50('0x18')]===0x1f4){logger[_0x6d50('0x17')](_0x6d50('0x12'),_0x38f3ff,_0xc971c2[_0x6d50('0x17')][_0x6d50('0x19')]);return _0x49ae2b(_0xc971c2[_0x6d50('0x17')]['message']);}logger[_0x6d50('0x17')](_0x6d50('0x12'),_0x38f3ff,_0xc971c2[_0x6d50('0x17')]['message']);return _0x4395a9(_0xc971c2[_0x6d50('0x17')][_0x6d50('0x19')]);}else{logger[_0x6d50('0x11')]('Plugin,\x20%s,\x20%s',_0x38f3ff,'request\x20sent');_0x4395a9(_0xc971c2[_0x6d50('0x1a')]['message']);}})[_0x6d50('0x1b')](function(_0x550bc2){logger[_0x6d50('0x17')](_0x6d50('0x12'),_0x38f3ff,_0x550bc2);_0x49ae2b(_0x550bc2);});});}exports[_0x6d50('0x1c')]=function(_0x4480f1){var _0x17d3f9=this;return new Promise(function(_0x1476db,_0x2c80e0){return db[_0x6d50('0x1d')][_0x6d50('0x1e')](_0x4480f1[_0x6d50('0x1f')],{'raw':_0x4480f1['options']?_0x4480f1[_0x6d50('0x20')][_0x6d50('0x21')]===undefined?!![]:![]:!![]})[_0x6d50('0x10')](function(_0xe93c54){logger[_0x6d50('0x11')](_0x6d50('0x1c'),_0x4480f1);logger[_0x6d50('0x14')](_0x6d50('0x1c'),_0x4480f1,JSON[_0x6d50('0x16')](_0xe93c54));_0x1476db(_0xe93c54);})[_0x6d50('0x1b')](function(_0x3a3bc1){logger['error'](_0x6d50('0x1c'),_0x3a3bc1[_0x6d50('0x19')],_0x4480f1);_0x2c80e0(_0x17d3f9['error'](0x1f4,_0x3a3bc1[_0x6d50('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ab5b81f..3296b6d 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 _0xcbeb=['register','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0xcbeb,0x10a));var _0xbcbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbeb[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0xbcbe('0x0'));var events=[_0xbcbe('0x1'),_0xbcbe('0x2'),_0xbcbe('0x3')];function createListener(_0x13ba40,_0x4df403){return function(_0x435f25){_0x4df403[_0xbcbe('0x4')](_0x13ba40,_0x435f25);};}function removeListener(_0x1f460d,_0x4c179b){return function(){PluginEvents[_0xbcbe('0x5')](_0x1f460d,_0x4c179b);};}exports[_0xbcbe('0x6')]=function(_0x1e90d7){for(var _0x46ad55=0x0,_0x40e9c7=events['length'];_0x46ad55<_0x40e9c7;_0x46ad55++){var _0x586c94=events[_0x46ad55];var _0x462205=createListener(_0xbcbe('0x7')+_0x586c94,_0x1e90d7);PluginEvents['on'](_0x586c94,_0x462205);}}; \ No newline at end of file +var _0x0044=['register','length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x0044,0x123));var _0x4004=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x0044[_0x5179a5];return _0x15c8ce;};'use strict';var PluginEvents=require(_0x4004('0x0'));var events=[_0x4004('0x1'),_0x4004('0x2'),_0x4004('0x3')];function createListener(_0x5c6d81,_0x37feb4){return function(_0xcd6d3){_0x37feb4[_0x4004('0x4')](_0x5c6d81,_0xcd6d3);};}function removeListener(_0x3b5a89,_0x3eb362){return function(){PluginEvents[_0x4004('0x5')](_0x3b5a89,_0x3eb362);};}exports[_0x4004('0x6')]=function(_0x4f8556){for(var _0x254a53=0x0,_0x16fe6f=events[_0x4004('0x7')];_0x254a53<_0x16fe6f;_0x254a53++){var _0x2e907a=events[_0x254a53];var _0xfa2008=createListener(_0x4004('0x8')+_0x2e907a,_0x4f8556);PluginEvents['on'](_0x2e907a,_0xfa2008);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8b91c7c..17aad0d 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(_0x54703f,_0x1a198e){var _0xe8e2e6=function(_0x49008b){while(--_0x49008b){_0x54703f['push'](_0x54703f['shift']());}};_0xe8e2e6(++_0x1a198e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x53a858,_0x297f4a){var _0x432186=function(_0x3ec96){while(--_0x3ec96){_0x53a858['push'](_0x53a858['shift']());}};_0x432186(++_0x297f4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 37f6c8b..4babdf4 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 _0xa75b=['motion2','length','catch','show','describe','params','create','body','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','delete','lodash','api','path','child_process','exec','bluebird','sendStatus','status','stack','name','send','npm\x20install','info','error','then','reject','express'];(function(_0x1a81cf,_0x587709){var _0x1ab63b=function(_0xa14071){while(--_0xa14071){_0x1a81cf['push'](_0x1a81cf['shift']());}};_0x1ab63b(++_0x587709);}(_0xa75b,0x170));var _0xba75=function(_0x19202d,_0x548558){_0x19202d=_0x19202d-0x0;var _0x4b6313=_0xa75b[_0x19202d];return _0x4b6313;};'use strict';var _=require(_0xba75('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xba75('0x1'));var path=require(_0xba75('0x2'));var exec=require(_0xba75('0x3'))[_0xba75('0x4')];var BPromise=require(_0xba75('0x5'));function handleEntityNotFound(_0x336606,_0x152269){return function(_0x398bd5){if(!_0x398bd5){_0x336606[_0xba75('0x6')](0x194);;}return _0x398bd5;};}function respondWithResult(_0x41afc9,_0x2baa28){_0x2baa28=_0x2baa28||0xc8;return function(_0x238a33){if(_0x238a33){return _0x41afc9[_0xba75('0x7')](_0x2baa28)['json'](_0x238a33);}return null;};}function handleError(_0x4b842d,_0x731cae){_0x731cae=_0x731cae||0x1f4;return function(_0x52669f){logger['error'](_0x52669f[_0xba75('0x8')]);if(_0x52669f['name']){delete _0x52669f[_0xba75('0x9')];}_0x4b842d[_0xba75('0x7')](_0x731cae)[_0xba75('0xa')](_0x52669f);};}function execChildProcess(){return new BPromise(function(_0x141931,_0x13f60f){exec(_0xba75('0xb'),function(_0xb5afb8,_0x2538eb,_0x1824e2){logger[_0xba75('0xc')](_0x2538eb);logger[_0xba75('0xc')](_0x1824e2);if(_0xb5afb8){logger[_0xba75('0xd')](_0xb5afb8);return _0x13f60f(_0xb5afb8);}return _0x141931(_0x2538eb);});});}exports['index']=function(_0x55553a,_0x38a6db){return pm2['list']()[_0xba75('0xe')](function(_0x2df615){if(_0x2df615){var _0xa27f76=_[_0xba75('0xf')](_0x2df615,function(_0x4c4a0b){return _0x4c4a0b[_0xba75('0x9')]===_0xba75('0x10')||_0x4c4a0b[_0xba75('0x9')]===_0xba75('0x11');});return{'rows':_0xa27f76,'count':_0xa27f76[_0xba75('0x12')]};}return null;})['then'](respondWithResult(_0x38a6db,null))[_0xba75('0x13')](handleError(_0x38a6db,null));};exports[_0xba75('0x14')]=function(_0x14bd83,_0x47be93){return pm2[_0xba75('0x15')](_0x14bd83[_0xba75('0x16')]['id'])[_0xba75('0xe')](respondWithResult(_0x47be93,null))[_0xba75('0xe')](handleEntityNotFound(_0x47be93,null))[_0xba75('0x13')](handleError(_0x47be93,null));};exports[_0xba75('0x17')]=function(_0x5811cb,_0x23c2ec){if(_0x5811cb[_0xba75('0x18')]['name']&&_0x5811cb['body'][_0xba75('0x19')]){var _0x31bc33=path['join'](__dirname,'../../files/plugins',_0x5811cb[_0xba75('0x18')]['script']);var _0x1b8a36=process[_0xba75('0x1a')]();process[_0xba75('0x1b')](path['dirname'](_0x31bc33));return execChildProcess()[_0xba75('0xe')](function(_0x221d5e){process[_0xba75('0x1b')](_0x1b8a36);return pm2[_0xba75('0x1c')]({'name':_0x5811cb[_0xba75('0x18')][_0xba75('0x9')],'script':_0x31bc33});})['then'](function(_0x246c48){pm2[_0xba75('0x1d')]();return _0x246c48[0x0];})[_0xba75('0xe')](respondWithResult(_0x23c2ec,0xc9))[_0xba75('0x13')](handleError(_0x23c2ec,null));}else{return _0x23c2ec[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':_0xba75('0x1e')});}};exports[_0xba75('0x1f')]=function(_0x35c571,_0x155c74){if(_0x35c571['body']['id']){delete _0x35c571['body']['id'];}var _0x4e1987={'online':_0xba75('0x20'),'stopped':'stop'};if(_0x4e1987[_0xba75('0x21')](_0x35c571['body'][_0xba75('0x7')])){return pm2[_0x4e1987[_0x35c571[_0xba75('0x18')][_0xba75('0x7')]]](_0x35c571['params']['id'])[_0xba75('0xe')](respondWithResult(_0x155c74,0xc8))[_0xba75('0x13')](handleError(_0x155c74,null));}else{return _0x155c74[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x200715,_0x481a04){if(_0x200715[_0xba75('0x18')]['id']){delete _0x200715[_0xba75('0x18')]['id'];}if(_0x200715[_0xba75('0x16')]['id']){return pm2[_0xba75('0x22')](_0x200715['params']['id'])[_0xba75('0xe')](function(_0x222d98){pm2['dump']();return _0x222d98[0x0];})[_0xba75('0xe')](respondWithResult(_0x481a04,null))[_0xba75('0x13')](handleError(_0x481a04,null));}else{return _0x481a04[_0xba75('0x7')](0x1f4)[_0xba75('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xfe57=['bluebird','sendStatus','status','json','error','stack','send','info','index','list','express','name','motion2','length','then','catch','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','path','child_process','exec'];(function(_0x3fc4a6,_0x39790e){var _0x38ec74=function(_0x37470b){while(--_0x37470b){_0x3fc4a6['push'](_0x3fc4a6['shift']());}};_0x38ec74(++_0x39790e);}(_0xfe57,0x195));var _0x7fe5=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xfe57[_0x40b493];return _0x548365;};'use strict';var _=require(_0x7fe5('0x0'));var pm2=require(_0x7fe5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x7fe5('0x2'));var exec=require(_0x7fe5('0x3'))[_0x7fe5('0x4')];var BPromise=require(_0x7fe5('0x5'));function handleEntityNotFound(_0x89ad5f,_0x1254d2){return function(_0x41f5f4){if(!_0x41f5f4){_0x89ad5f[_0x7fe5('0x6')](0x194);;}return _0x41f5f4;};}function respondWithResult(_0x22e850,_0x188cfb){_0x188cfb=_0x188cfb||0xc8;return function(_0xd6146b){if(_0xd6146b){return _0x22e850[_0x7fe5('0x7')](_0x188cfb)[_0x7fe5('0x8')](_0xd6146b);}return null;};}function handleError(_0x4ab081,_0x13b391){_0x13b391=_0x13b391||0x1f4;return function(_0x5ef757){logger[_0x7fe5('0x9')](_0x5ef757[_0x7fe5('0xa')]);if(_0x5ef757['name']){delete _0x5ef757['name'];}_0x4ab081[_0x7fe5('0x7')](_0x13b391)[_0x7fe5('0xb')](_0x5ef757);};}function execChildProcess(){return new BPromise(function(_0x4b92d3,_0x35913b){exec('npm\x20install',function(_0x48d10b,_0xdb5182,_0x84bb93){logger[_0x7fe5('0xc')](_0xdb5182);logger[_0x7fe5('0xc')](_0x84bb93);if(_0x48d10b){logger['error'](_0x48d10b);return _0x35913b(_0x48d10b);}return _0x4b92d3(_0xdb5182);});});}exports[_0x7fe5('0xd')]=function(_0x16bed9,_0x579fd3){return pm2[_0x7fe5('0xe')]()['then'](function(_0x1f84b5){if(_0x1f84b5){var _0x2d297b=_['reject'](_0x1f84b5,function(_0x1ce051){return _0x1ce051['name']===_0x7fe5('0xf')||_0x1ce051[_0x7fe5('0x10')]===_0x7fe5('0x11');});return{'rows':_0x2d297b,'count':_0x2d297b[_0x7fe5('0x12')]};}return null;})[_0x7fe5('0x13')](respondWithResult(_0x579fd3,null))[_0x7fe5('0x14')](handleError(_0x579fd3,null));};exports['show']=function(_0x166e23,_0x3c7dd3){return pm2[_0x7fe5('0x15')](_0x166e23[_0x7fe5('0x16')]['id'])[_0x7fe5('0x13')](respondWithResult(_0x3c7dd3,null))[_0x7fe5('0x13')](handleEntityNotFound(_0x3c7dd3,null))[_0x7fe5('0x14')](handleError(_0x3c7dd3,null));};exports[_0x7fe5('0x17')]=function(_0x478523,_0x3b98cd){if(_0x478523['body']['name']&&_0x478523[_0x7fe5('0x18')][_0x7fe5('0x19')]){var _0x2f6592=path[_0x7fe5('0x1a')](__dirname,_0x7fe5('0x1b'),_0x478523[_0x7fe5('0x18')][_0x7fe5('0x19')]);var _0xdd9df7=process[_0x7fe5('0x1c')]();process[_0x7fe5('0x1d')](path[_0x7fe5('0x1e')](_0x2f6592));return execChildProcess()[_0x7fe5('0x13')](function(_0x54ee98){process[_0x7fe5('0x1d')](_0xdd9df7);return pm2[_0x7fe5('0x1f')]({'name':_0x478523[_0x7fe5('0x18')]['name'],'script':_0x2f6592});})[_0x7fe5('0x13')](function(_0x48ee56){pm2[_0x7fe5('0x20')]();return _0x48ee56[0x0];})['then'](respondWithResult(_0x3b98cd,0xc9))[_0x7fe5('0x14')](handleError(_0x3b98cd,null));}else{return _0x3b98cd[_0x7fe5('0x7')](0x1f4)[_0x7fe5('0xb')]({'message':_0x7fe5('0x21')});}};exports[_0x7fe5('0x22')]=function(_0x4393c3,_0x5bfe23){if(_0x4393c3['body']['id']){delete _0x4393c3[_0x7fe5('0x18')]['id'];}var _0x450759={'online':_0x7fe5('0x23'),'stopped':_0x7fe5('0x24')};if(_0x450759['hasOwnProperty'](_0x4393c3[_0x7fe5('0x18')]['status'])){return pm2[_0x450759[_0x4393c3[_0x7fe5('0x18')][_0x7fe5('0x7')]]](_0x4393c3[_0x7fe5('0x16')]['id'])[_0x7fe5('0x13')](respondWithResult(_0x5bfe23,0xc8))[_0x7fe5('0x14')](handleError(_0x5bfe23,null));}else{return _0x5bfe23[_0x7fe5('0x7')](0x1f4)['send']({'message':_0x7fe5('0x25')});}};exports[_0x7fe5('0x26')]=function(_0x5ec0b4,_0xfc1189){if(_0x5ec0b4[_0x7fe5('0x18')]['id']){delete _0x5ec0b4[_0x7fe5('0x18')]['id'];}if(_0x5ec0b4[_0x7fe5('0x16')]['id']){return pm2[_0x7fe5('0x27')](_0x5ec0b4['params']['id'])['then'](function(_0x13623e){pm2[_0x7fe5('0x20')]();return _0x13623e[0x0];})[_0x7fe5('0x13')](respondWithResult(_0xfc1189,null))[_0x7fe5('0x14')](handleError(_0xfc1189,null));}else{return _0xfc1189['status'](0x1f4)[_0x7fe5('0xb')]({'message':_0x7fe5('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f3227cd..17a4bb6 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 _0x2f3a=['getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2f3a,0xdd));var _0xa2f3=function(_0x1d7c31,_0x1c7d35){_0x1d7c31=_0x1d7c31-0x0;var _0xfbe999=_0x2f3a[_0x1d7c31];return _0xfbe999;};'use strict';var express=require(_0xa2f3('0x0'));var router=express[_0xa2f3('0x1')]();var auth=require(_0xa2f3('0x2'));var controller=require(_0xa2f3('0x3'));router[_0xa2f3('0x4')](_0xa2f3('0x5'),auth[_0xa2f3('0x6')](),controller[_0xa2f3('0x7')]);router[_0xa2f3('0x4')](_0xa2f3('0x8'),auth[_0xa2f3('0x6')](),controller[_0xa2f3('0x9')]);module['exports']=router; \ No newline at end of file +var _0xaebc=['exports','express','Router','../../components/auth/service','./realtime.controller','/agents','getAgents','get','isAuthenticated'];(function(_0x28bc48,_0x5bbdc0){var _0x4ff295=function(_0x1a8bba){while(--_0x1a8bba){_0x28bc48['push'](_0x28bc48['shift']());}};_0x4ff295(++_0x5bbdc0);}(_0xaebc,0xc7));var _0xcaeb=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xaebc[_0x2ec2bf];return _0x2c279c;};'use strict';var express=require(_0xcaeb('0x0'));var router=express[_0xcaeb('0x1')]();var auth=require(_0xcaeb('0x2'));var controller=require(_0xcaeb('0x3'));router['get'](_0xcaeb('0x4'),auth['isAuthenticated'](),controller[_0xcaeb('0x5')]);router[_0xcaeb('0x6')]('/queues',auth[_0xcaeb('0x7')](),controller['getQueues']);module[_0xcaeb('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index c75acaa..5de1159 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x61f765,_0x47e30b){var _0x271fcd=function(_0x462826){while(--_0x462826){_0x61f765['push'](_0x61f765['shift']());}};_0x271fcd(++_0x47e30b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x222385,_0x18970b){var _0x4e0c56=function(_0x573daf){while(--_0x573daf){_0x222385['push'](_0x222385['shift']());}};_0x4e0c56(++_0x18970b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 922a33a..8df2173 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(_0x536ce0,_0x2c8148){var _0x175020=function(_0x321068){while(--_0x321068){_0x536ce0['push'](_0x536ce0['shift']());}};_0x175020(++_0x2c8148);}(_0xe706,0xa3));var _0x6e70=function(_0x4135e7,_0x14f68b){_0x4135e7=_0x4135e7-0x0;var _0x3032f9=_0xe706[_0x4135e7];return _0x3032f9;};'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(_0x451266,_0x201d42){var _0xc1751e=function(_0x15d6b8){while(--_0x15d6b8){_0x451266['push'](_0x451266['shift']());}};_0xc1751e(++_0x201d42);}(_0x70e0,0x17b));var _0x070e=function(_0x31d531,_0x58e758){_0x31d531=_0x31d531-0x0;var _0x92570d=_0x70e0[_0x31d531];return _0x92570d;};'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 c8ea681..2441da6 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 _0x9fe7=['exports','STRING','DATE','sequelize'];(function(_0x538050,_0x41e382){var _0x5077ad=function(_0x1a0b6d){while(--_0x1a0b6d){_0x538050['push'](_0x538050['shift']());}};_0x5077ad(++_0x41e382);}(_0x9fe7,0x1df));var _0x79fe=function(_0x2b2971,_0x46dbdf){_0x2b2971=_0x2b2971-0x0;var _0x17d9ee=_0x9fe7[_0x2b2971];return _0x17d9ee;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x79fe('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x79fe('0x2')]},'starttime':{'type':Sequelize[_0x79fe('0x3')]},'responsetime':{'type':Sequelize[_0x79fe('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x79fe('0x2')]},'campaigntype':{'type':Sequelize[_0x79fe('0x2')]},'membername':{'type':Sequelize[_0x79fe('0x2')]}}; \ No newline at end of file +var _0xd7c3=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2c0d2e,_0x4ef456){var _0x2f4009=function(_0xe5e80b){while(--_0xe5e80b){_0x2c0d2e['push'](_0x2c0d2e['shift']());}};_0x2f4009(++_0x4ef456);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x4e3a88,_0x54489a){_0x4e3a88=_0x4e3a88-0x0;var _0x3f4f2f=_0xd7c3[_0x4e3a88];return _0x3f4f2f;};'use strict';var Sequelize=require(_0x3d7c('0x0'));module[_0x3d7c('0x1')]={'state':{'type':Sequelize[_0x3d7c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3d7c('0x3')]},'scheduledat':{'type':Sequelize[_0x3d7c('0x4')]},'uniqueid':{'type':Sequelize[_0x3d7c('0x3')]},'starttime':{'type':Sequelize[_0x3d7c('0x4')]},'responsetime':{'type':Sequelize[_0x3d7c('0x4')]},'ringtime':{'type':Sequelize[_0x3d7c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3d7c('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 cf1240c..823066f 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 _0x949d=['request-promise','path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x949d,0x97));var _0xd949=function(_0x1190c7,_0x403576){_0x1190c7=_0x1190c7-0x0;var _0x51e9a7=_0x949d[_0x1190c7];return _0x51e9a7;};'use strict';var _=require('lodash');var util=require(_0xd949('0x0'));var logger=require(_0xd949('0x1'))('api');var moment=require(_0xd949('0x2'));var BPromise=require('bluebird');var rp=require(_0xd949('0x3'));var fs=require('fs');var path=require(_0xd949('0x4'));var rimraf=require(_0xd949('0x5'));var config=require(_0xd949('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0xd949('0x7')]=function(_0x27753d,_0x5a8a84){return _0x27753d[_0xd949('0x8')](_0xd949('0x9'),attributes,{'tableName':_0xd949('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc590=['../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0xc590,0x144));var _0x0c59=function(_0x48e90b,_0x533fd5){_0x48e90b=_0x48e90b-0x0;var _0x3b4ae5=_0xc590[_0x48e90b];return _0x3b4ae5;};'use strict';var _=require(_0x0c59('0x0'));var util=require(_0x0c59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0c59('0x2'));var rp=require(_0x0c59('0x3'));var fs=require('fs');var path=require(_0x0c59('0x4'));var rimraf=require(_0x0c59('0x5'));var config=require(_0x0c59('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x0c59('0x7')]=function(_0x9b8a1,_0x43b1ea){return _0x9b8a1[_0x0c59('0x8')](_0x0c59('0x9'),attributes,{'tableName':_0x0c59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 689c49c..f8b0253 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 _0x42cb=['body','options','raw','lodash','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x42cb,0x1ac));var _0xb42c=function(_0x135c4f,_0x27293a){_0x135c4f=_0x135c4f-0x0;var _0x168d47=_0x42cb[_0x135c4f];return _0x168d47;};'use strict';var _=require(_0xb42c('0x0'));var util=require('util');var moment=require(_0xb42c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb42c('0x2'));var logger=require(_0xb42c('0x3'))('rpc');var config=require(_0xb42c('0x4'));var jayson=require(_0xb42c('0x5'));var client=jayson[_0xb42c('0x6')][_0xb42c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x220e46,_0x428f3c,_0xa33879){return new BPromise(function(_0x5195a3,_0x269480){return client['request'](_0x220e46,_0xa33879)[_0xb42c('0x8')](function(_0x2b6e4f){logger['info'](_0xb42c('0x9'),_0x428f3c,_0xb42c('0xa'));logger[_0xb42c('0xb')](_0xb42c('0xc'),_0x428f3c,_0xb42c('0xa'),JSON[_0xb42c('0xd')](_0x2b6e4f));if(_0x2b6e4f[_0xb42c('0xe')]){if(_0x2b6e4f[_0xb42c('0xe')][_0xb42c('0xf')]===0x1f4){logger[_0xb42c('0xe')](_0xb42c('0x9'),_0x428f3c,_0x2b6e4f['error'][_0xb42c('0x10')]);return _0x269480(_0x2b6e4f[_0xb42c('0xe')][_0xb42c('0x10')]);}logger[_0xb42c('0xe')](_0xb42c('0x9'),_0x428f3c,_0x2b6e4f[_0xb42c('0xe')][_0xb42c('0x10')]);return _0x5195a3(_0x2b6e4f['error']['message']);}else{logger[_0xb42c('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x428f3c,_0xb42c('0xa'));_0x5195a3(_0x2b6e4f[_0xb42c('0x12')]['message']);}})[_0xb42c('0x13')](function(_0x3d5f05){logger['error'](_0xb42c('0x9'),_0x428f3c,_0x3d5f05);_0x269480(_0x3d5f05);});});}exports[_0xb42c('0x14')]=function(_0x2ac812){var _0x431ab5=this;return new Promise(function(_0x48c846,_0x1f6ff6){return db[_0xb42c('0x15')]['create'](_0x2ac812[_0xb42c('0x16')],{'raw':_0x2ac812[_0xb42c('0x17')]?_0x2ac812[_0xb42c('0x17')][_0xb42c('0x18')]===undefined?!![]:![]:!![]})[_0xb42c('0x8')](function(_0x1727ae){logger['info'](_0xb42c('0x14'),_0x2ac812);logger[_0xb42c('0xb')](_0xb42c('0x14'),_0x2ac812,JSON[_0xb42c('0xd')](_0x1727ae));_0x48c846(_0x1727ae);})[_0xb42c('0x13')](function(_0xbbe068){logger[_0xb42c('0xe')](_0xb42c('0x14'),_0xbbe068[_0xb42c('0x10')],_0x2ac812);_0x1f6ff6(_0x431ab5[_0xb42c('0xe')](0x1f4,_0xbbe068[_0xb42c('0x10')]));});});}; \ No newline at end of file +var _0xa3bb=['message','info','result','catch','CreateReportAgentPreview','create','body','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x296870,_0x14f4e8){var _0x5cf2ac=function(_0x453ebd){while(--_0x453ebd){_0x296870['push'](_0x296870['shift']());}};_0x5cf2ac(++_0x14f4e8);}(_0xa3bb,0x1b9));var _0xba3b=function(_0x35de1b,_0x2eb50d){_0x35de1b=_0x35de1b-0x0;var _0x162dd8=_0xa3bb[_0x35de1b];return _0x162dd8;};'use strict';var _=require(_0xba3b('0x0'));var util=require(_0xba3b('0x1'));var moment=require(_0xba3b('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3b('0x3'));var fs=require('fs');var Redis=require(_0xba3b('0x4'));var db=require(_0xba3b('0x5'))['db'];var utils=require(_0xba3b('0x6'));var logger=require('../../config/logger')(_0xba3b('0x7'));var config=require('../../config/environment');var jayson=require(_0xba3b('0x8'));var client=jayson['client'][_0xba3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36ff63,_0x4f6b03,_0x24eaec){return new BPromise(function(_0x3e89bf,_0x3af4cc){return client[_0xba3b('0xa')](_0x36ff63,_0x24eaec)[_0xba3b('0xb')](function(_0x59ff27){logger['info'](_0xba3b('0xc'),_0x4f6b03,_0xba3b('0xd'));logger[_0xba3b('0xe')](_0xba3b('0xf'),_0x4f6b03,_0xba3b('0xd'),JSON['stringify'](_0x59ff27));if(_0x59ff27[_0xba3b('0x10')]){if(_0x59ff27[_0xba3b('0x10')][_0xba3b('0x11')]===0x1f4){logger[_0xba3b('0x10')](_0xba3b('0xc'),_0x4f6b03,_0x59ff27[_0xba3b('0x10')][_0xba3b('0x12')]);return _0x3af4cc(_0x59ff27[_0xba3b('0x10')][_0xba3b('0x12')]);}logger['error'](_0xba3b('0xc'),_0x4f6b03,_0x59ff27[_0xba3b('0x10')][_0xba3b('0x12')]);return _0x3e89bf(_0x59ff27[_0xba3b('0x10')][_0xba3b('0x12')]);}else{logger[_0xba3b('0x13')](_0xba3b('0xc'),_0x4f6b03,'request\x20sent');_0x3e89bf(_0x59ff27[_0xba3b('0x14')][_0xba3b('0x12')]);}})[_0xba3b('0x15')](function(_0x2e88ca){logger[_0xba3b('0x10')](_0xba3b('0xc'),_0x4f6b03,_0x2e88ca);_0x3af4cc(_0x2e88ca);});});}exports[_0xba3b('0x16')]=function(_0x5981ab){var _0x3c1a0a=this;return new Promise(function(_0x430cd3,_0x11d67c){return db['ReportAgentPreview'][_0xba3b('0x17')](_0x5981ab[_0xba3b('0x18')],{'raw':_0x5981ab['options']?_0x5981ab['options'][_0xba3b('0x19')]===undefined?!![]:![]:!![]})[_0xba3b('0xb')](function(_0x416653){logger['info'](_0xba3b('0x16'),_0x5981ab);logger['debug'](_0xba3b('0x16'),_0x5981ab,JSON[_0xba3b('0x1a')](_0x416653));_0x430cd3(_0x416653);})[_0xba3b('0x15')](function(_0x3dface){logger[_0xba3b('0x10')](_0xba3b('0x16'),_0x3dface[_0xba3b('0x12')],_0x5981ab);_0x11d67c(_0x3c1a0a['error'](0x1f4,_0x3dface[_0xba3b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index cd6b717..c27ab85 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 _0x869b=['whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','path','../../components/auth/service','/voice/channels','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','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/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions'];(function(_0x163742,_0x467e36){var _0x1152ac=function(_0x40a83d){while(--_0x40a83d){_0x163742['push'](_0x163742['shift']());}};_0x1152ac(++_0x467e36);}(_0x869b,0x10b));var _0xb869=function(_0x40677f,_0x259cf0){_0x40677f=_0x40677f-0x0;var _0x47b5f6=_0x869b[_0x40677f];return _0x47b5f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb869('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0xb869('0x1'));var controller=require('./rpc.controller');router['get'](_0xb869('0x2'),auth['isAuthenticated'](),controller[_0xb869('0x3')]);router[_0xb869('0x4')](_0xb869('0x5'),auth[_0xb869('0x6')](),controller[_0xb869('0x7')]);router['get'](_0xb869('0x8'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0xb869('0x6')](),controller[_0xb869('0x9')]);router[_0xb869('0x4')](_0xb869('0xa'),auth[_0xb869('0x6')](),controller[_0xb869('0xb')]);router[_0xb869('0x4')](_0xb869('0xc'),auth[_0xb869('0x6')](),controller[_0xb869('0xd')]);router['get'](_0xb869('0xe'),auth[_0xb869('0x6')](),controller[_0xb869('0xf')]);router[_0xb869('0x4')](_0xb869('0x10'),auth[_0xb869('0x6')](),controller[_0xb869('0x11')]);router[_0xb869('0x4')](_0xb869('0x12'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xb869('0x4')](_0xb869('0x13'),auth[_0xb869('0x6')](),controller['whatsappQueues']);router['get'](_0xb869('0x14'),auth[_0xb869('0x6')](),controller[_0xb869('0x15')]);router[_0xb869('0x4')](_0xb869('0x16'),auth[_0xb869('0x6')](),controller['voiceQueuesPreview']);router[_0xb869('0x4')](_0xb869('0x17'),auth[_0xb869('0x6')](),controller[_0xb869('0x18')]);router['get'](_0xb869('0x19'),auth[_0xb869('0x6')](),controller[_0xb869('0x1a')]);router['get'](_0xb869('0x1b'),auth['isAuthenticated'](),controller[_0xb869('0x1c')]);router['get'](_0xb869('0x1d'),auth[_0xb869('0x6')](),controller[_0xb869('0x1e')]);router['get'](_0xb869('0x1f'),auth[_0xb869('0x6')](),controller[_0xb869('0x20')]);router[_0xb869('0x21')]('/voice/queues/:id',auth[_0xb869('0x6')](),controller[_0xb869('0x22')]);router[_0xb869('0x4')]('/outbound',auth[_0xb869('0x6')](),controller['outbound']);router[_0xb869('0x4')](_0xb869('0x23'),auth[_0xb869('0x6')](),controller[_0xb869('0x24')]);router['get'](_0xb869('0x25'),auth[_0xb869('0x6')](),controller[_0xb869('0x26')]);router[_0xb869('0x21')](_0xb869('0x27'),auth[_0xb869('0x6')](),controller['agentCapacity']);router['get'](_0xb869('0x28'),auth[_0xb869('0x6')](),controller[_0xb869('0x29')]);router[_0xb869('0x4')](_0xb869('0x2a'),auth[_0xb869('0x6')](),controller['trunks']);router['get'](_0xb869('0x2b'),auth[_0xb869('0x6')](),controller[_0xb869('0x2c')]);router[_0xb869('0x4')](_0xb869('0x2d'),auth['isAuthenticated'](),controller[_0xb869('0x2e')]);router[_0xb869('0x4')](_0xb869('0x2f'),auth[_0xb869('0x6')](),controller[_0xb869('0x30')]);router[_0xb869('0x4')](_0xb869('0x31'),auth[_0xb869('0x6')](),controller[_0xb869('0x32')]);router[_0xb869('0x4')]('/openchannel/queues/waitinginteractions',auth[_0xb869('0x6')](),controller[_0xb869('0x33')]);router[_0xb869('0x4')](_0xb869('0x34'),auth[_0xb869('0x6')](),controller[_0xb869('0x35')]);router[_0xb869('0x4')](_0xb869('0x36'),auth[_0xb869('0x6')](),controller[_0xb869('0x37')]);router[_0xb869('0x4')](_0xb869('0x38'),auth['isAuthenticated'](),controller[_0xb869('0x39')]);router[_0xb869('0x4')](_0xb869('0x3a'),auth['isAuthenticated'](),controller[_0xb869('0x3b')]);router['post'](_0xb869('0x3c'),auth[_0xb869('0x6')](),controller[_0xb869('0x3d')](_0xb869('0x3e')));router[_0xb869('0x4')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0xb869('0x3f')]);router[_0xb869('0x40')](_0xb869('0x41'),auth[_0xb869('0x6')](),controller['queueNotify']('chat'));router['get'](_0xb869('0x42'),auth[_0xb869('0x6')](),controller[_0xb869('0x43')]);router[_0xb869('0x40')](_0xb869('0x44'),auth[_0xb869('0x6')](),controller[_0xb869('0x3d')](_0xb869('0x45')));router[_0xb869('0x4')]('/fax/queues/:id',auth[_0xb869('0x6')](),controller[_0xb869('0x46')]);router[_0xb869('0x40')](_0xb869('0x47'),auth[_0xb869('0x6')](),controller[_0xb869('0x3d')](_0xb869('0x48')));router[_0xb869('0x4')](_0xb869('0x49'),auth[_0xb869('0x6')](),controller['showOpenchannelQueues']);router[_0xb869('0x40')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xb869('0x3d')](_0xb869('0x4a')));router[_0xb869('0x40')](_0xb869('0x4b'),auth['isAuthenticated'](),controller[_0xb869('0x3d')]('whatsapp'));router['get'](_0xb869('0x4c'),auth[_0xb869('0x6')](),controller[_0xb869('0x4d')]);router[_0xb869('0x4')]('/whatsapp/queues/:id',auth[_0xb869('0x6')](),controller[_0xb869('0x4e')]);router[_0xb869('0x40')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xb869('0x4f')]);module[_0xb869('0x50')]=router; \ No newline at end of file +var _0x246a=['/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x246a,0x1d3));var _0xa246=function(_0x10b7d7,_0x29e8d5){_0x10b7d7=_0x10b7d7-0x0;var _0x145ec7=_0x246a[_0x10b7d7];return _0x145ec7;};'use strict';var multer=require(_0xa246('0x0'));var util=require(_0xa246('0x1'));var path=require(_0xa246('0x2'));var express=require(_0xa246('0x3'));var router=express[_0xa246('0x4')]();var auth=require(_0xa246('0x5'));var controller=require('./rpc.controller');router['get'](_0xa246('0x6'),auth[_0xa246('0x7')](),controller[_0xa246('0x8')]);router[_0xa246('0x9')](_0xa246('0xa'),auth['isAuthenticated'](),controller[_0xa246('0xb')]);router[_0xa246('0x9')](_0xa246('0xc'),auth[_0xa246('0x7')](),controller[_0xa246('0xd')]);router['get'](_0xa246('0xe'),auth[_0xa246('0x7')](),controller[_0xa246('0xf')]);router[_0xa246('0x9')](_0xa246('0x10'),auth['isAuthenticated'](),controller[_0xa246('0x11')]);router['get'](_0xa246('0x12'),auth[_0xa246('0x7')](),controller[_0xa246('0x13')]);router[_0xa246('0x9')](_0xa246('0x14'),auth[_0xa246('0x7')](),controller['mailAccounts']);router[_0xa246('0x9')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0xa246('0x15')]);router[_0xa246('0x9')]('/sms/queues',auth[_0xa246('0x7')](),controller['smsQueues']);router[_0xa246('0x9')](_0xa246('0x16'),auth['isAuthenticated'](),controller[_0xa246('0x17')]);router[_0xa246('0x9')](_0xa246('0x18'),auth[_0xa246('0x7')](),controller['faxQueues']);router[_0xa246('0x9')](_0xa246('0x19'),auth['isAuthenticated'](),controller[_0xa246('0x1a')]);router[_0xa246('0x9')](_0xa246('0x1b'),auth[_0xa246('0x7')](),controller[_0xa246('0x1c')]);router[_0xa246('0x9')](_0xa246('0x1d'),auth[_0xa246('0x7')](),controller['voiceQueuesChannel']);router[_0xa246('0x9')](_0xa246('0x1e'),auth[_0xa246('0x7')](),controller['voiceQueuesChannelHangup']);router[_0xa246('0x9')](_0xa246('0x1f'),auth[_0xa246('0x7')](),controller[_0xa246('0x20')]);router[_0xa246('0x9')](_0xa246('0x21'),auth[_0xa246('0x7')](),controller[_0xa246('0x22')]);router['put'](_0xa246('0x21'),auth[_0xa246('0x7')](),controller[_0xa246('0x23')]);router[_0xa246('0x9')](_0xa246('0x24'),auth[_0xa246('0x7')](),controller['outbound']);router[_0xa246('0x9')](_0xa246('0x25'),auth[_0xa246('0x7')](),controller[_0xa246('0x26')]);router['get'](_0xa246('0x27'),auth['isAuthenticated'](),controller[_0xa246('0x28')]);router[_0xa246('0x29')](_0xa246('0x2a'),auth[_0xa246('0x7')](),controller[_0xa246('0x2b')]);router[_0xa246('0x9')](_0xa246('0x2c'),auth[_0xa246('0x7')](),controller[_0xa246('0x2d')]);router[_0xa246('0x9')](_0xa246('0x2e'),auth['isAuthenticated'](),controller[_0xa246('0x2f')]);router[_0xa246('0x9')]('/campaigns',auth[_0xa246('0x7')](),controller[_0xa246('0x30')]);router['get'](_0xa246('0x31'),auth[_0xa246('0x7')](),controller[_0xa246('0x32')]);router[_0xa246('0x9')](_0xa246('0x33'),auth['isAuthenticated'](),controller[_0xa246('0x34')]);router['get'](_0xa246('0x35'),auth['isAuthenticated'](),controller[_0xa246('0x36')]);router[_0xa246('0x9')](_0xa246('0x37'),auth[_0xa246('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xa246('0x9')](_0xa246('0x38'),auth[_0xa246('0x7')](),controller[_0xa246('0x39')]);router[_0xa246('0x9')](_0xa246('0x3a'),auth[_0xa246('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0xa246('0x9')](_0xa246('0x3b'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0xa246('0x9')](_0xa246('0x3c'),auth[_0xa246('0x7')](),controller[_0xa246('0x3d')]);router[_0xa246('0x3e')](_0xa246('0x3f'),auth[_0xa246('0x7')](),controller[_0xa246('0x40')](_0xa246('0x41')));router[_0xa246('0x9')](_0xa246('0x42'),auth[_0xa246('0x7')](),controller['showMailQueues']);router['post'](_0xa246('0x43'),auth[_0xa246('0x7')](),controller[_0xa246('0x40')]('chat'));router['get'](_0xa246('0x44'),auth[_0xa246('0x7')](),controller[_0xa246('0x45')]);router[_0xa246('0x3e')](_0xa246('0x46'),auth['isAuthenticated'](),controller[_0xa246('0x40')](_0xa246('0x47')));router[_0xa246('0x9')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xa246('0x48')]);router['post'](_0xa246('0x49'),auth[_0xa246('0x7')](),controller[_0xa246('0x40')](_0xa246('0x4a')));router[_0xa246('0x9')]('/openchannel/queues/:id',auth[_0xa246('0x7')](),controller[_0xa246('0x4b')]);router[_0xa246('0x3e')](_0xa246('0x4c'),auth[_0xa246('0x7')](),controller[_0xa246('0x40')]('sms'));router[_0xa246('0x3e')]('/whatsapp/queues/:id/notify',auth[_0xa246('0x7')](),controller[_0xa246('0x40')](_0xa246('0x4d')));router[_0xa246('0x9')](_0xa246('0x4e'),auth[_0xa246('0x7')](),controller['showSmsQueues']);router[_0xa246('0x9')](_0xa246('0x4f'),auth['isAuthenticated'](),controller[_0xa246('0x50')]);router[_0xa246('0x3e')](_0xa246('0x51'),auth[_0xa246('0x7')](),controller['agentNotify']);module[_0xa246('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index cf45be4..bff7ca4 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 _0x2850=['OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','updateAttributes','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','uniq','value','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','request','then','error','code','message','result','catch','status','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x2850,0xd3));var _0x0285=function(_0x5b6049,_0x3f4c44){_0x5b6049=_0x5b6049-0x0;var _0x55a662=_0x2850[_0x5b6049];return _0x55a662;};'use strict';var BPromise=require(_0x0285('0x0'));var moment=require(_0x0285('0x1'));var _=require(_0x0285('0x2'));var util=require(_0x0285('0x3'));var db=require(_0x0285('0x4'))['db'];var logger=require(_0x0285('0x5'))('api');var jayson=require(_0x0285('0x6'));var amiClient=jayson['client'][_0x0285('0x7')]({'port':0x232a});var mailClient=jayson[_0x0285('0x8')][_0x0285('0x7')]({'port':0x232b});var routingClient=jayson[_0x0285('0x8')]['http']({'port':0x232c});function respondWithRpcPromise(_0x525df3,_0x442abf,_0x580a3b){return new BPromise(function(_0x4ccfcb,_0x15a727){var _0x515fc8=_0x580a3b?_0x580a3b:amiClient;return _0x515fc8[_0x0285('0x9')](_0x525df3,_0x442abf)[_0x0285('0xa')](function(_0x1e8b9a){if(_0x1e8b9a[_0x0285('0xb')]){if(_0x1e8b9a[_0x0285('0xb')][_0x0285('0xc')]===0x1f4){return _0x15a727(_0x1e8b9a['error'][_0x0285('0xd')]);}return _0x4ccfcb(_0x1e8b9a[_0x0285('0xb')][_0x0285('0xd')]);}else{_0x4ccfcb(_0x1e8b9a[_0x0285('0xe')]);}})[_0x0285('0xf')](function(_0x429e46){_0x15a727(_0x429e46);});});}function respondWithResult(_0xe39dde,_0x19f047){_0x19f047=_0x19f047||0xc8;return function(_0x1f14d5){if(_0x1f14d5){return _0xe39dde[_0x0285('0x10')](_0x19f047)['json'](_0x1f14d5);}return _0xe39dde[_0x0285('0x11')](0x194);};}function handleError(_0x201106,_0x123810){_0x123810=_0x123810||0x1f4;return function(_0x35fbdd){logger[_0x0285('0xb')](_0x35fbdd['stack']);if(_0x35fbdd[_0x0285('0x12')]){delete _0x35fbdd[_0x0285('0x12')];}_0x201106[_0x0285('0x10')](_0x123810)[_0x0285('0x13')](_0x35fbdd);};}function findById(_0x34c91e){return function(_0x2a6a34){if(!_[_0x0285('0x14')](_0x34c91e)&&!_[_0x0285('0x14')](_0x2a6a34)&&!_[_0x0285('0x14')](_0x2a6a34[_0x0285('0x15')])){return _[_0x0285('0x16')](_0x2a6a34[_0x0285('0x15')],function(_0x34d9e4){return _0x34d9e4['id']==_0x34c91e;});}return null;};}exports[_0x0285('0x17')]=function(_0x4cdc4b,_0x39e699){return respondWithRpcPromise(_0x0285('0x18'),_0x4cdc4b[_0x0285('0x19')])[_0x0285('0xa')](respondWithResult(_0x39e699,null))[_0x0285('0xf')](handleError(_0x39e699,null));};exports[_0x0285('0x1a')]=function(_0x48adc0,_0x2b94ba){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x0285('0x1b')](_0x48adc0[_0x0285('0x19')],_0x48adc0[_0x0285('0x1c')]))[_0x0285('0xa')](respondWithResult(_0x2b94ba,null))[_0x0285('0xf')](handleError(_0x2b94ba,null));};exports['voiceChannelStopMixMonitor']=function(_0x515363,_0xb67f1c){return respondWithRpcPromise(_0x0285('0x1d'),_[_0x0285('0x1b')](_0x515363[_0x0285('0x19')],_0x515363[_0x0285('0x1c')]))['then'](respondWithResult(_0xb67f1c,null))[_0x0285('0xf')](handleError(_0xb67f1c,null));};exports[_0x0285('0x1e')]=function(_0x3405e8,_0x523b02){return respondWithRpcPromise(_0x0285('0x1f'),_0x3405e8[_0x0285('0x19')])['then'](respondWithResult(_0x523b02,null))[_0x0285('0xf')](handleError(_0x523b02,null));};exports[_0x0285('0x20')]=function(_0x5ab797,_0x1127b2){return respondWithRpcPromise(_0x0285('0x1f'),_0x5ab797['query'])['then'](findById(_0x5ab797[_0x0285('0x1c')]['id']))[_0x0285('0xa')](respondWithResult(_0x1127b2,null))[_0x0285('0xf')](handleError(_0x1127b2,null));};exports[_0x0285('0x21')]=function(_0x15c0de,_0x18658d){return respondWithRpcPromise(_0x0285('0x22'),_['merge'](_0x15c0de[_0x0285('0x23')],_0x15c0de[_0x0285('0x1c')]))[_0x0285('0xa')](respondWithResult(_0x18658d,null))['catch'](handleError(_0x18658d,null));};exports[_0x0285('0x24')]=function(_0x59fb7c,_0x205214){return respondWithRpcPromise(_0x0285('0x25'),_['merge'](_0x59fb7c[_0x0285('0x19')],_0x59fb7c[_0x0285('0x1c')]))[_0x0285('0xa')](respondWithResult(_0x205214,null))['catch'](handleError(_0x205214,null));};exports[_0x0285('0x26')]=function(_0x3c2fe0,_0x540861){return respondWithRpcPromise('VoiceQueuesChannels',_0x3c2fe0[_0x0285('0x19')])[_0x0285('0xa')](respondWithResult(_0x540861,null))[_0x0285('0xf')](handleError(_0x540861,null));};exports['voiceQueuesChannel']=function(_0x343152,_0x3ef6fb){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0285('0x1b')](_0x343152['query'],_0x343152['params']))['then'](respondWithResult(_0x3ef6fb,null))[_0x0285('0xf')](handleError(_0x3ef6fb,null));};exports[_0x0285('0x27')]=function(_0xbdb400,_0x12865f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x0285('0x1b')](_0xbdb400[_0x0285('0x19')],_0xbdb400[_0x0285('0x1c')]))[_0x0285('0xa')](respondWithResult(_0x12865f,null))[_0x0285('0xf')](handleError(_0x12865f,null));};exports[_0x0285('0x28')]=function(_0x2d39aa,_0x872244){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x0285('0x1b')](_0x2d39aa[_0x0285('0x19')],_0x2d39aa['params']))[_0x0285('0xa')](respondWithResult(_0x872244,null))[_0x0285('0xf')](handleError(_0x872244,null));};exports[_0x0285('0x29')]=function(_0x192ca9,_0x33bc5a){return respondWithRpcPromise(_0x0285('0x2a'),_0x192ca9['query'])[_0x0285('0xa')](respondWithResult(_0x33bc5a,null))[_0x0285('0xf')](handleError(_0x33bc5a,null));};exports['outboundChannels']=function(_0x1de079,_0x6b4c3){return respondWithRpcPromise(_0x0285('0x2b'),_0x1de079[_0x0285('0x19')])[_0x0285('0xa')](respondWithResult(_0x6b4c3,null))[_0x0285('0xf')](handleError(_0x6b4c3,null));};exports[_0x0285('0x2c')]=function(_0x526cd4,_0x5e0f23){var _0x3cd934;return respondWithRpcPromise('Agents',_0x526cd4[_0x0285('0x19')])[_0x0285('0xa')](function(_0xf80a36){_0x3cd934=_0xf80a36;return respondWithRpcPromise(_0x0285('0x2d'),_0x526cd4[_0x0285('0x19')],routingClient);})[_0x0285('0xa')](function(_0x509585){return _['merge']({},_0x509585,_0x3cd934);})[_0x0285('0xa')](respondWithResult(_0x5e0f23,null))[_0x0285('0xf')](handleError(_0x5e0f23,null));};exports[_0x0285('0x2e')]=function(_0xbae08d,_0x434320){if(_0xbae08d[_0x0285('0x23')]&&_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')]&&_0xbae08d[_0x0285('0x30')]&&_0xbae08d[_0x0285('0x30')][_0x0285('0x12')]){for(var _0x226394 in _0xbae08d[_0x0285('0x23')]['interaction']){if(_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x0285('0x31')](_0x226394)){db[_0x0285('0x32')]['findAll']({'where':{'channel':_0x226394,'membername':_0xbae08d[_0x0285('0x30')][_0x0285('0x12')],'type':_0x0285('0x33'),'exitAt':null,'uniqueid':_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x226394]&&_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x226394][_0x0285('0x34')]?{'$notIn':_0xbae08d[_0x0285('0x23')]['interaction'][_0x226394]}:{'$ne':null}}})['then'](function(_0xe26fc0){var _0x297306=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4972a3=0x0,_0x77d4c2=_0xe26fc0[_0x0285('0x34')];_0x4972a3<_0x77d4c2;_0x4972a3+=0x1){_0xe26fc0[_0x4972a3][_0x0285('0x35')]({'exitAt':_0x297306});}});for(var _0x24aa3b=0x0;_0x24aa3b<_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x226394][_0x0285('0x34')];_0x24aa3b+=0x1){db[_0x0285('0x32')][_0x0285('0x36')]({'where':{'channel':_0x226394,'membername':_0xbae08d[_0x0285('0x30')][_0x0285('0x12')],'type':_0x0285('0x33'),'uniqueid':_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x226394][_0x24aa3b],'exitAt':null},'defaults':{'channel':_0x226394,'membername':_0xbae08d['user'][_0x0285('0x12')],'interface':_[_0x0285('0x14')](_0xbae08d[_0x0285('0x30')][_0x0285('0x37')])?util['format'](_0x0285('0x38'),_0xbae08d[_0x0285('0x30')][_0x0285('0x12')]):_0xbae08d[_0x0285('0x30')]['interface'],'type':_0x0285('0x33'),'enterAt':moment()['format'](_0x0285('0x39')),'role':_0x0285('0x3a'),'internal':_0xbae08d[_0x0285('0x30')]['internal'],'uniqueid':_0xbae08d[_0x0285('0x23')][_0x0285('0x2f')][_0x226394][_0x24aa3b]}});}}}}return respondWithRpcPromise(_0x0285('0x3b'),{'id':_0xbae08d[_0x0285('0x1c')]['id'],'capacity':_0xbae08d[_0x0285('0x23')][_0x0285('0x3c')]},routingClient)[_0x0285('0xa')](respondWithResult(_0x434320,null))[_0x0285('0xf')](handleError(_0x434320,null));};exports['telephones']=function(_0x389a8e,_0x4249d0){return respondWithRpcPromise(_0x0285('0x3d'),_0x389a8e['query'])['then'](respondWithResult(_0x4249d0,null))[_0x0285('0xf')](handleError(_0x4249d0,null));};exports[_0x0285('0x3e')]=function(_0x404cce,_0x7ecb8a){return respondWithRpcPromise(_0x0285('0x3f'),_0x404cce[_0x0285('0x19')])[_0x0285('0xa')](respondWithResult(_0x7ecb8a,null))[_0x0285('0xf')](handleError(_0x7ecb8a,null));};exports[_0x0285('0x40')]=function(_0x417dc5,_0x1b1e19){return respondWithRpcPromise(_0x0285('0x41'),_0x417dc5[_0x0285('0x19')])[_0x0285('0xa')](respondWithResult(_0x1b1e19,null))[_0x0285('0xf')](handleError(_0x1b1e19,null));};exports[_0x0285('0x42')]=function(_0x23af72,_0x1cc086){return respondWithRpcPromise(_0x0285('0x43'),_0x23af72['query'],routingClient)['then'](respondWithResult(_0x1cc086,null))[_0x0285('0xf')](handleError(_0x1cc086,null));};exports[_0x0285('0x44')]=function(_0xa56a70,_0x5daa44){return respondWithRpcPromise(_0x0285('0x43'),_0xa56a70[_0x0285('0x19')],routingClient)[_0x0285('0xa')](findById(_0xa56a70['params']['id']))[_0x0285('0xa')](respondWithResult(_0x5daa44,null))[_0x0285('0xf')](handleError(_0x5daa44,null));};exports[_0x0285('0x45')]=function(_0x2aadea,_0x48b952){return respondWithRpcPromise(_0x0285('0x46'),_0x2aadea[_0x0285('0x19')],routingClient)[_0x0285('0xa')](respondWithResult(_0x48b952,null))[_0x0285('0xf')](handleError(_0x48b952,null));};exports[_0x0285('0x47')]=function(_0x2dec66,_0xa8c41f){return respondWithRpcPromise('MailQueues',_0x2dec66['query'],routingClient)[_0x0285('0xa')](findById(_0x2dec66[_0x0285('0x1c')]['id']))[_0x0285('0xa')](respondWithResult(_0xa8c41f,null))['catch'](handleError(_0xa8c41f,null));};exports[_0x0285('0x48')]=function(_0x32f05e,_0x6684fe){return respondWithRpcPromise(_0x0285('0x49'),_0x32f05e[_0x0285('0x19')],mailClient)[_0x0285('0xa')](respondWithResult(_0x6684fe,null))[_0x0285('0xf')](handleError(_0x6684fe,null));};exports[_0x0285('0x4a')]=function(_0x146728,_0xc14874){return respondWithRpcPromise(_0x0285('0x4b'),_0x146728[_0x0285('0x19')],routingClient)[_0x0285('0xa')](respondWithResult(_0xc14874,null))['catch'](handleError(_0xc14874,null));};exports[_0x0285('0x4c')]=function(_0x17a82d,_0x5918f7){return respondWithRpcPromise(_0x0285('0x4b'),_0x17a82d['query'],routingClient)[_0x0285('0xa')](findById(_0x17a82d[_0x0285('0x1c')]['id']))[_0x0285('0xa')](respondWithResult(_0x5918f7,null))['catch'](handleError(_0x5918f7,null));};exports['smsQueues']=function(_0x296c64,_0x2fcc8f){return respondWithRpcPromise(_0x0285('0x4d'),_0x296c64[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x2fcc8f,null))[_0x0285('0xf')](handleError(_0x2fcc8f,null));};exports[_0x0285('0x4e')]=function(_0x59dc0d,_0x396ad7){return respondWithRpcPromise('SmsQueues',_0x59dc0d[_0x0285('0x19')],routingClient)[_0x0285('0xa')](findById(_0x59dc0d[_0x0285('0x1c')]['id']))['then'](respondWithResult(_0x396ad7,null))[_0x0285('0xf')](handleError(_0x396ad7,null));};exports['whatsappQueues']=function(_0x27f007,_0x3075bd){return respondWithRpcPromise('WhatsappQueues',_0x27f007[_0x0285('0x19')],routingClient)[_0x0285('0xa')](respondWithResult(_0x3075bd,null))[_0x0285('0xf')](handleError(_0x3075bd,null));};exports[_0x0285('0x4f')]=function(_0x2adfaf,_0x498a25){return respondWithRpcPromise(_0x0285('0x50'),_0x2adfaf[_0x0285('0x19')],routingClient)[_0x0285('0xa')](findById(_0x2adfaf[_0x0285('0x1c')]['id']))[_0x0285('0xa')](respondWithResult(_0x498a25,null))['catch'](handleError(_0x498a25,null));};exports[_0x0285('0x51')]=function(_0x309b7e,_0x305b86){return respondWithRpcPromise('FaxQueues',_0x309b7e[_0x0285('0x19')],routingClient)[_0x0285('0xa')](respondWithResult(_0x305b86,null))[_0x0285('0xf')](handleError(_0x305b86,null));};exports[_0x0285('0x52')]=function(_0x1b2608,_0xf5707b){return respondWithRpcPromise(_0x0285('0x53'),_0x1b2608['query'],routingClient)[_0x0285('0xa')](findById(_0x1b2608['params']['id']))[_0x0285('0xa')](respondWithResult(_0xf5707b,null))[_0x0285('0xf')](handleError(_0xf5707b,null));};exports[_0x0285('0x54')]=function(_0x2f32c5,_0x3b86fb){return respondWithRpcPromise('FaxAccounts',_0x2f32c5['query'])[_0x0285('0xa')](respondWithResult(_0x3b86fb,null))[_0x0285('0xf')](handleError(_0x3b86fb,null));};exports[_0x0285('0x55')]=function(_0x1d2207,_0x119016){return respondWithRpcPromise(_0x0285('0x56'),_0x1d2207[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x119016,null))[_0x0285('0xf')](handleError(_0x119016,null));};exports['mailQueuesWaitingInteractions']=function(_0x40c16,_0x53fbaf){return respondWithRpcPromise(_0x0285('0x57'),_0x40c16[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x53fbaf,null))[_0x0285('0xf')](handleError(_0x53fbaf,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4eb6f9,_0x5cc32b){return respondWithRpcPromise(_0x0285('0x58'),_0x4eb6f9[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x5cc32b,null))[_0x0285('0xf')](handleError(_0x5cc32b,null));};exports[_0x0285('0x59')]=function(_0x2b1258,_0x43fd70){return respondWithRpcPromise(_0x0285('0x58'),_0x2b1258[_0x0285('0x19')],routingClient)['then'](function(_0x3daa9f){if(_0x2b1258[_0x0285('0x19')][_0x0285('0x5a')]!==undefined){var _0xa668e1=_(_0x3daa9f[_0x0285('0x15')])[_0x0285('0x5b')]([_0x2b1258[_0x0285('0x19')][_0x0285('0x5a')],_0x2b1258['params']['id']])[_0x0285('0x5c')]('queue_id')[_0x0285('0x5d')]()[_0x0285('0x5e')]();return _0x3daa9f[_0x0285('0x15')]['filter'](function(_0x4034f0){return _0xa668e1[_0x0285('0x5f')](_0x4034f0[_0x0285('0x60')])>-0x1;});}else{return _0x3daa9f[_0x0285('0x15')][_0x0285('0x5b')](function(_0x107ae9){return _0x107ae9[_0x0285('0x60')]===parseInt(_0x2b1258[_0x0285('0x1c')]['id']);});}})[_0x0285('0xa')](respondWithResult(_0x43fd70,null))[_0x0285('0xf')](handleError(_0x43fd70,null));};exports[_0x0285('0x61')]=function(_0x36d0ae,_0x228ab7){return respondWithRpcPromise(_0x0285('0x62'),_0x36d0ae[_0x0285('0x19')],routingClient)[_0x0285('0xa')](respondWithResult(_0x228ab7,null))[_0x0285('0xf')](handleError(_0x228ab7,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x516691,_0x3399c7){return respondWithRpcPromise(_0x0285('0x63'),_0x516691[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x3399c7,null))[_0x0285('0xf')](handleError(_0x3399c7,null));};exports['faxQueuesWaitingInteractions']=function(_0x551b37,_0x592e93){return respondWithRpcPromise(_0x0285('0x64'),_0x551b37[_0x0285('0x19')],routingClient)['then'](respondWithResult(_0x592e93,null))[_0x0285('0xf')](handleError(_0x592e93,null));};exports[_0x0285('0x65')]=function(_0x1da43f){return function(_0x50db1f,_0x470e34){var _0x53ad26,_0x3a40ce;var _0x53206e=_[_0x0285('0x66')](_0x1da43f);var _0x48e031=_0x1da43f===_0x0285('0x67')?_0x0285('0x68'):_0x0285('0x69');return db[_0x53206e+_0x0285('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x50db1f[_0x0285('0x1c')]['id']}})[_0x0285('0xa')](function(_0xaeba91){if(_[_0x0285('0x14')](_0xaeba91)){throw new Error(_0x53206e+_0x0285('0x6b'));}_0x53ad26=_0xaeba91;return db[_0x53206e+'Message'][_0x0285('0x6c')]({'where':{'id':_0x50db1f[_0x0285('0x23')][_0x0285('0x6d')]},'include':[{'model':db[_0x53206e+_0x0285('0x6e')],'as':'Interaction'},{'model':db[_0x53206e+_0x48e031],'as':_0x0285('0x69')}]});})[_0x0285('0xa')](function(_0x59fb41){if(_[_0x0285('0x14')](_0x59fb41)){throw new Error(_0x53206e+'\x20Message\x20not\x20found');}_0x3a40ce=_0x59fb41;return _0x59fb41[_0x0285('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0285('0xa')](function(){var _0x4e0927={'uniqueid':_0x1da43f+'.'+_0x3a40ce['id']+'.'+_0x3a40ce[_0x0285('0x6e')]['id'],'FromUserId':_0x50db1f['user']['id'],'type':_0x0285('0x70')};_0x4e0927[_0x53206e+_0x0285('0x71')]=_0x3a40ce['id'];_0x4e0927[_0x53206e+_0x0285('0x72')]=_0x3a40ce['Interaction']['id'];_0x4e0927[_0x0285('0x73')+_0x53206e+_0x48e031+'Id']=_0x3a40ce[_0x0285('0x69')]['id'];_0x4e0927['To'+_0x53206e+_0x0285('0x74')]=_0x53ad26['id'];return db[_0x53206e+_0x0285('0x75')]['create'](_0x4e0927);})['then'](function(){return respondWithRpcPromise(_0x0285('0x76'),{'channel':_0x1da43f,'interaction':_0x3a40ce[_0x0285('0x6e')],'message':_0x3a40ce,'account':_0x3a40ce[_0x0285('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0285('0x70'),'appdata':_0x53ad26[_0x0285('0x12')]+','+(_0x3a40ce[_0x0285('0x69')][_0x0285('0x77')]||0x12c),'interval':_0x0285('0x78')}]},routingClient);})[_0x0285('0xa')](respondWithResult(_0x470e34,null))[_0x0285('0xf')](handleError(_0x470e34,null));};};exports[_0x0285('0x79')]=function(_0x3a5224,_0x564f36){var _0x4aa9d6,_0x1cb8e8;if(_[_0x0285('0x14')](_0x3a5224[_0x0285('0x23')][_0x0285('0x7a')])){throw new Error(_0x0285('0x7b'));}var _0x55a6e4=_0x3a5224[_0x0285('0x23')][_0x0285('0x7a')];var _0x23b102=_[_0x0285('0x66')](_0x55a6e4);var _0x592162=_0x55a6e4==='chat'?_0x0285('0x68'):_0x0285('0x69');return db['User'][_0x0285('0x6c')]({'raw':!![],'where':{'id':_0x3a5224['params']['id'],'role':'agent'}})[_0x0285('0xa')](function(_0x558c2a){if(_['isNil'](_0x558c2a)){throw new Error('Agent\x20not\x20found');}_0x4aa9d6=_0x558c2a;return db[_0x23b102+_0x0285('0x7c')][_0x0285('0x6c')]({'where':{'id':_0x3a5224['body']['messageId']},'include':[{'model':db[_0x23b102+_0x0285('0x6e')],'as':'Interaction'},{'model':db[_0x23b102+_0x592162],'as':_0x0285('0x69')}]});})[_0x0285('0xa')](function(_0x5a5cd0){if(_[_0x0285('0x14')](_0x5a5cd0)){throw new Error(_0x23b102+_0x0285('0x7d'));}_0x1cb8e8=_0x5a5cd0;return _0x5a5cd0[_0x0285('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0285('0xa')](function(){var _0x8858cd={'uniqueid':_0x55a6e4+'.'+_0x1cb8e8['id']+'.'+_0x1cb8e8[_0x0285('0x6e')]['id'],'FromUserId':_0x3a5224[_0x0285('0x30')]['id'],'type':_0x0285('0x3a'),'ToUserId':_0x4aa9d6['id']};_0x8858cd[_0x23b102+_0x0285('0x71')]=_0x1cb8e8['id'];_0x8858cd[_0x23b102+_0x0285('0x72')]=_0x1cb8e8[_0x0285('0x6e')]['id'];_0x8858cd['From'+_0x23b102+_0x592162+'Id']=_0x1cb8e8[_0x0285('0x69')]['id'];return db[_0x23b102+_0x0285('0x75')]['create'](_0x8858cd);})[_0x0285('0xa')](function(){return respondWithRpcPromise(_0x0285('0x76'),{'channel':_0x55a6e4,'interaction':_0x1cb8e8[_0x0285('0x6e')],'message':_0x1cb8e8,'account':_0x1cb8e8[_0x0285('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0285('0x3a'),'appdata':_0x4aa9d6[_0x0285('0x12')]+','+(_0x1cb8e8[_0x0285('0x69')][_0x0285('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x0285('0xa')](respondWithResult(_0x564f36,null))[_0x0285('0xf')](handleError(_0x564f36,null));}; \ No newline at end of file +var _0x95ca=['From','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','findOne','Agent\x20not\x20found','\x20Message\x20not\x20found','MessageId','create','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','http','request','then','error','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','catch','voiceChannelMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','interface','format','SIP/%s','agent','internal','AgentCapacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','MailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','InteractionId'];(function(_0x174ed4,_0x4cf6ff){var _0x379f1b=function(_0x31ba2a){while(--_0x31ba2a){_0x174ed4['push'](_0x174ed4['shift']());}};_0x379f1b(++_0x4cf6ff);}(_0x95ca,0x181));var _0xa95c=function(_0x5174c3,_0x2b7fa4){_0x5174c3=_0x5174c3-0x0;var _0x479665=_0x95ca[_0x5174c3];return _0x479665;};'use strict';var BPromise=require(_0xa95c('0x0'));var moment=require(_0xa95c('0x1'));var _=require(_0xa95c('0x2'));var util=require('util');var db=require(_0xa95c('0x3'))['db'];var logger=require(_0xa95c('0x4'))('api');var jayson=require(_0xa95c('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson['client'][_0xa95c('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xa95c('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2160d1,_0x585863,_0x183576){return new BPromise(function(_0x575051,_0x301c25){var _0x13a4bb=_0x183576?_0x183576:amiClient;return _0x13a4bb[_0xa95c('0x7')](_0x2160d1,_0x585863)[_0xa95c('0x8')](function(_0x18d5cc){if(_0x18d5cc[_0xa95c('0x9')]){if(_0x18d5cc[_0xa95c('0x9')]['code']===0x1f4){return _0x301c25(_0x18d5cc[_0xa95c('0x9')][_0xa95c('0xa')]);}return _0x575051(_0x18d5cc[_0xa95c('0x9')][_0xa95c('0xa')]);}else{_0x575051(_0x18d5cc[_0xa95c('0xb')]);}})['catch'](function(_0x7a54d2){_0x301c25(_0x7a54d2);});});}function respondWithResult(_0x1b7d05,_0x1e1360){_0x1e1360=_0x1e1360||0xc8;return function(_0x845466){if(_0x845466){return _0x1b7d05[_0xa95c('0xc')](_0x1e1360)[_0xa95c('0xd')](_0x845466);}return _0x1b7d05[_0xa95c('0xe')](0x194);};}function handleError(_0x4a16f7,_0x2956b1){_0x2956b1=_0x2956b1||0x1f4;return function(_0x364d18){logger['error'](_0x364d18[_0xa95c('0xf')]);if(_0x364d18[_0xa95c('0x10')]){delete _0x364d18[_0xa95c('0x10')];}_0x4a16f7[_0xa95c('0xc')](_0x2956b1)[_0xa95c('0x11')](_0x364d18);};}function findById(_0x38aca0){return function(_0x157596){if(!_[_0xa95c('0x12')](_0x38aca0)&&!_[_0xa95c('0x12')](_0x157596)&&!_[_0xa95c('0x12')](_0x157596[_0xa95c('0x13')])){return _[_0xa95c('0x14')](_0x157596['rows'],function(_0x3590f7){return _0x3590f7['id']==_0x38aca0;});}return null;};}exports[_0xa95c('0x15')]=function(_0x1008d7,_0x5410af){return respondWithRpcPromise('VoiceChannels',_0x1008d7[_0xa95c('0x16')])[_0xa95c('0x8')](respondWithResult(_0x5410af,null))[_0xa95c('0x17')](handleError(_0x5410af,null));};exports[_0xa95c('0x18')]=function(_0x4a5746,_0xafe5d){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xa95c('0x19')](_0x4a5746[_0xa95c('0x16')],_0x4a5746[_0xa95c('0x1a')]))[_0xa95c('0x8')](respondWithResult(_0xafe5d,null))[_0xa95c('0x17')](handleError(_0xafe5d,null));};exports['voiceChannelStopMixMonitor']=function(_0x155a74,_0x22dd94){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa95c('0x19')](_0x155a74[_0xa95c('0x16')],_0x155a74['params']))[_0xa95c('0x8')](respondWithResult(_0x22dd94,null))[_0xa95c('0x17')](handleError(_0x22dd94,null));};exports[_0xa95c('0x1b')]=function(_0x32afef,_0x5137ef){return respondWithRpcPromise(_0xa95c('0x1c'),_0x32afef['query'])[_0xa95c('0x8')](respondWithResult(_0x5137ef,null))[_0xa95c('0x17')](handleError(_0x5137ef,null));};exports[_0xa95c('0x1d')]=function(_0x12f154,_0xf8eb36){return respondWithRpcPromise(_0xa95c('0x1c'),_0x12f154[_0xa95c('0x16')])[_0xa95c('0x8')](findById(_0x12f154[_0xa95c('0x1a')]['id']))[_0xa95c('0x8')](respondWithResult(_0xf8eb36,null))[_0xa95c('0x17')](handleError(_0xf8eb36,null));};exports[_0xa95c('0x1e')]=function(_0x295bbb,_0x28fb3a){return respondWithRpcPromise(_0xa95c('0x1f'),_[_0xa95c('0x19')](_0x295bbb['body'],_0x295bbb[_0xa95c('0x1a')]))[_0xa95c('0x8')](respondWithResult(_0x28fb3a,null))[_0xa95c('0x17')](handleError(_0x28fb3a,null));};exports[_0xa95c('0x20')]=function(_0x24f5a0,_0x2d9f4c){return respondWithRpcPromise(_0xa95c('0x21'),_[_0xa95c('0x19')](_0x24f5a0['query'],_0x24f5a0[_0xa95c('0x1a')]))['then'](respondWithResult(_0x2d9f4c,null))[_0xa95c('0x17')](handleError(_0x2d9f4c,null));};exports[_0xa95c('0x22')]=function(_0x577010,_0x313ecc){return respondWithRpcPromise(_0xa95c('0x23'),_0x577010[_0xa95c('0x16')])['then'](respondWithResult(_0x313ecc,null))[_0xa95c('0x17')](handleError(_0x313ecc,null));};exports[_0xa95c('0x24')]=function(_0x9bf2bf,_0x427bd7){return respondWithRpcPromise(_0xa95c('0x25'),_[_0xa95c('0x19')](_0x9bf2bf[_0xa95c('0x16')],_0x9bf2bf['params']))[_0xa95c('0x8')](respondWithResult(_0x427bd7,null))[_0xa95c('0x17')](handleError(_0x427bd7,null));};exports[_0xa95c('0x26')]=function(_0x118296,_0x35d631){return respondWithRpcPromise(_0xa95c('0x27'),_[_0xa95c('0x19')](_0x118296[_0xa95c('0x16')],_0x118296[_0xa95c('0x1a')]))[_0xa95c('0x8')](respondWithResult(_0x35d631,null))[_0xa95c('0x17')](handleError(_0x35d631,null));};exports[_0xa95c('0x28')]=function(_0x521959,_0x109af7){return respondWithRpcPromise(_0xa95c('0x29'),_[_0xa95c('0x19')](_0x521959[_0xa95c('0x16')],_0x521959[_0xa95c('0x1a')]))[_0xa95c('0x8')](respondWithResult(_0x109af7,null))[_0xa95c('0x17')](handleError(_0x109af7,null));};exports[_0xa95c('0x2a')]=function(_0x16a074,_0x48f479){return respondWithRpcPromise(_0xa95c('0x2b'),_0x16a074[_0xa95c('0x16')])[_0xa95c('0x8')](respondWithResult(_0x48f479,null))[_0xa95c('0x17')](handleError(_0x48f479,null));};exports[_0xa95c('0x2c')]=function(_0x2f1020,_0x5b699c){return respondWithRpcPromise('OutboundChannels',_0x2f1020[_0xa95c('0x16')])[_0xa95c('0x8')](respondWithResult(_0x5b699c,null))[_0xa95c('0x17')](handleError(_0x5b699c,null));};exports[_0xa95c('0x2d')]=function(_0x3aa4fd,_0x3f07ee){var _0x5f0249;return respondWithRpcPromise(_0xa95c('0x2e'),_0x3aa4fd['query'])[_0xa95c('0x8')](function(_0x53a921){_0x5f0249=_0x53a921;return respondWithRpcPromise(_0xa95c('0x2e'),_0x3aa4fd['query'],routingClient);})[_0xa95c('0x8')](function(_0x388cbd){return _['merge']({},_0x388cbd,_0x5f0249);})[_0xa95c('0x8')](respondWithResult(_0x3f07ee,null))[_0xa95c('0x17')](handleError(_0x3f07ee,null));};exports['agentCapacity']=function(_0x3831c8,_0x456601){if(_0x3831c8[_0xa95c('0x2f')]&&_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')]&&_0x3831c8['user']&&_0x3831c8[_0xa95c('0x31')][_0xa95c('0x10')]){for(var _0x1af449 in _0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')]){if(_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0xa95c('0x32')](_0x1af449)){db[_0xa95c('0x33')][_0xa95c('0x34')]({'where':{'channel':_0x1af449,'membername':_0x3831c8['user'][_0xa95c('0x10')],'type':_0xa95c('0x35'),'exitAt':null,'uniqueid':_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0x1af449]&&_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0x1af449][_0xa95c('0x36')]?{'$notIn':_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0x1af449]}:{'$ne':null}}})['then'](function(_0x1fa450){var _0x867091=moment()['format'](_0xa95c('0x37'));for(var _0x3c233b=0x0,_0x257c5=_0x1fa450[_0xa95c('0x36')];_0x3c233b<_0x257c5;_0x3c233b+=0x1){_0x1fa450[_0x3c233b]['updateAttributes']({'exitAt':_0x867091});}});for(var _0x1bcfe9=0x0;_0x1bcfe9<_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0x1af449]['length'];_0x1bcfe9+=0x1){db[_0xa95c('0x33')]['findOrCreate']({'where':{'channel':_0x1af449,'membername':_0x3831c8[_0xa95c('0x31')][_0xa95c('0x10')],'type':_0xa95c('0x35'),'uniqueid':_0x3831c8[_0xa95c('0x2f')][_0xa95c('0x30')][_0x1af449][_0x1bcfe9],'exitAt':null},'defaults':{'channel':_0x1af449,'membername':_0x3831c8[_0xa95c('0x31')][_0xa95c('0x10')],'interface':_[_0xa95c('0x12')](_0x3831c8[_0xa95c('0x31')][_0xa95c('0x38')])?util[_0xa95c('0x39')](_0xa95c('0x3a'),_0x3831c8[_0xa95c('0x31')][_0xa95c('0x10')]):_0x3831c8['user']['interface'],'type':_0xa95c('0x35'),'enterAt':moment()[_0xa95c('0x39')](_0xa95c('0x37')),'role':_0xa95c('0x3b'),'internal':_0x3831c8[_0xa95c('0x31')][_0xa95c('0x3c')],'uniqueid':_0x3831c8['body']['interaction'][_0x1af449][_0x1bcfe9]}});}}}}return respondWithRpcPromise(_0xa95c('0x3d'),{'id':_0x3831c8['params']['id'],'capacity':_0x3831c8[_0xa95c('0x2f')]['capacity']},routingClient)['then'](respondWithResult(_0x456601,null))[_0xa95c('0x17')](handleError(_0x456601,null));};exports[_0xa95c('0x3e')]=function(_0x203188,_0xc328ab){return respondWithRpcPromise('Telephones',_0x203188[_0xa95c('0x16')])[_0xa95c('0x8')](respondWithResult(_0xc328ab,null))[_0xa95c('0x17')](handleError(_0xc328ab,null));};exports['trunks']=function(_0x4e1ddc,_0x368198){return respondWithRpcPromise(_0xa95c('0x3f'),_0x4e1ddc['query'])[_0xa95c('0x8')](respondWithResult(_0x368198,null))[_0xa95c('0x17')](handleError(_0x368198,null));};exports[_0xa95c('0x40')]=function(_0x72bdbb,_0x3adf88){return respondWithRpcPromise(_0xa95c('0x41'),_0x72bdbb[_0xa95c('0x16')])[_0xa95c('0x8')](respondWithResult(_0x3adf88,null))[_0xa95c('0x17')](handleError(_0x3adf88,null));};exports[_0xa95c('0x42')]=function(_0x5dc17e,_0x44995c){return respondWithRpcPromise(_0xa95c('0x43'),_0x5dc17e[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x44995c,null))['catch'](handleError(_0x44995c,null));};exports['showChatQueues']=function(_0x4824ef,_0x3d44c8){return respondWithRpcPromise(_0xa95c('0x43'),_0x4824ef[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](findById(_0x4824ef[_0xa95c('0x1a')]['id']))[_0xa95c('0x8')](respondWithResult(_0x3d44c8,null))[_0xa95c('0x17')](handleError(_0x3d44c8,null));};exports['mailQueues']=function(_0x39b1af,_0x168fea){return respondWithRpcPromise(_0xa95c('0x44'),_0x39b1af[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x168fea,null))[_0xa95c('0x17')](handleError(_0x168fea,null));};exports['showMailQueues']=function(_0x335f72,_0x2a582c){return respondWithRpcPromise(_0xa95c('0x44'),_0x335f72[_0xa95c('0x16')],routingClient)['then'](findById(_0x335f72[_0xa95c('0x1a')]['id']))['then'](respondWithResult(_0x2a582c,null))[_0xa95c('0x17')](handleError(_0x2a582c,null));};exports['mailAccounts']=function(_0x49ab17,_0x3121e0){return respondWithRpcPromise(_0xa95c('0x45'),_0x49ab17[_0xa95c('0x16')],mailClient)[_0xa95c('0x8')](respondWithResult(_0x3121e0,null))[_0xa95c('0x17')](handleError(_0x3121e0,null));};exports[_0xa95c('0x46')]=function(_0x55147c,_0x4b10c1){return respondWithRpcPromise('OpenchannelQueues',_0x55147c['query'],routingClient)[_0xa95c('0x8')](respondWithResult(_0x4b10c1,null))['catch'](handleError(_0x4b10c1,null));};exports[_0xa95c('0x47')]=function(_0x2793e9,_0x1431b8){return respondWithRpcPromise('OpenchannelQueues',_0x2793e9[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](findById(_0x2793e9[_0xa95c('0x1a')]['id']))[_0xa95c('0x8')](respondWithResult(_0x1431b8,null))[_0xa95c('0x17')](handleError(_0x1431b8,null));};exports['smsQueues']=function(_0x199f07,_0x4f22c6){return respondWithRpcPromise(_0xa95c('0x48'),_0x199f07[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x4f22c6,null))[_0xa95c('0x17')](handleError(_0x4f22c6,null));};exports['showSmsQueues']=function(_0x6d5b2c,_0x299b64){return respondWithRpcPromise(_0xa95c('0x48'),_0x6d5b2c[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](findById(_0x6d5b2c[_0xa95c('0x1a')]['id']))[_0xa95c('0x8')](respondWithResult(_0x299b64,null))[_0xa95c('0x17')](handleError(_0x299b64,null));};exports['whatsappQueues']=function(_0x2d393f,_0x2c3d4b){return respondWithRpcPromise(_0xa95c('0x49'),_0x2d393f[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x2c3d4b,null))[_0xa95c('0x17')](handleError(_0x2c3d4b,null));};exports[_0xa95c('0x4a')]=function(_0x31b89c,_0x12b097){return respondWithRpcPromise(_0xa95c('0x49'),_0x31b89c['query'],routingClient)[_0xa95c('0x8')](findById(_0x31b89c['params']['id']))[_0xa95c('0x8')](respondWithResult(_0x12b097,null))['catch'](handleError(_0x12b097,null));};exports[_0xa95c('0x4b')]=function(_0x15ad42,_0xcc7561){return respondWithRpcPromise(_0xa95c('0x4c'),_0x15ad42['query'],routingClient)[_0xa95c('0x8')](respondWithResult(_0xcc7561,null))[_0xa95c('0x17')](handleError(_0xcc7561,null));};exports[_0xa95c('0x4d')]=function(_0x128c9b,_0x3237e9){return respondWithRpcPromise(_0xa95c('0x4c'),_0x128c9b[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](findById(_0x128c9b[_0xa95c('0x1a')]['id']))[_0xa95c('0x8')](respondWithResult(_0x3237e9,null))['catch'](handleError(_0x3237e9,null));};exports[_0xa95c('0x4e')]=function(_0x28fc9b,_0x1e08e3){return respondWithRpcPromise(_0xa95c('0x4f'),_0x28fc9b['query'])[_0xa95c('0x8')](respondWithResult(_0x1e08e3,null))[_0xa95c('0x17')](handleError(_0x1e08e3,null));};exports[_0xa95c('0x50')]=function(_0x180f8a,_0x1ce851){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x180f8a[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x1ce851,null))[_0xa95c('0x17')](handleError(_0x1ce851,null));};exports[_0xa95c('0x51')]=function(_0x4bed9d,_0x4d1b14){return respondWithRpcPromise(_0xa95c('0x52'),_0x4bed9d[_0xa95c('0x16')],routingClient)['then'](respondWithResult(_0x4d1b14,null))[_0xa95c('0x17')](handleError(_0x4d1b14,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x41856f,_0xa1f6e8){return respondWithRpcPromise(_0xa95c('0x53'),_0x41856f[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0xa1f6e8,null))[_0xa95c('0x17')](handleError(_0xa1f6e8,null));};exports[_0xa95c('0x54')]=function(_0xbe23d9,_0x27142e){return respondWithRpcPromise(_0xa95c('0x53'),_0xbe23d9[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](function(_0x1588df){if(_0xbe23d9[_0xa95c('0x16')][_0xa95c('0x55')]!==undefined){var _0x47a66c=_(_0x1588df[_0xa95c('0x13')])['filter']([_0xbe23d9[_0xa95c('0x16')][_0xa95c('0x55')],_0xbe23d9[_0xa95c('0x1a')]['id']])[_0xa95c('0x56')](_0xa95c('0x57'))['uniq']()[_0xa95c('0x58')]();return _0x1588df[_0xa95c('0x13')][_0xa95c('0x59')](function(_0x4bd2dc){return _0x47a66c[_0xa95c('0x5a')](_0x4bd2dc[_0xa95c('0x57')])>-0x1;});}else{return _0x1588df['rows'][_0xa95c('0x59')](function(_0x36a2af){return _0x36a2af[_0xa95c('0x57')]===parseInt(_0xbe23d9[_0xa95c('0x1a')]['id']);});}})[_0xa95c('0x8')](respondWithResult(_0x27142e,null))['catch'](handleError(_0x27142e,null));};exports[_0xa95c('0x5b')]=function(_0x1ed5e7,_0x439f66){return respondWithRpcPromise(_0xa95c('0x5c'),_0x1ed5e7[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x439f66,null))['catch'](handleError(_0x439f66,null));};exports[_0xa95c('0x5d')]=function(_0x4cb174,_0x198d08){return respondWithRpcPromise(_0xa95c('0x5e'),_0x4cb174[_0xa95c('0x16')],routingClient)['then'](respondWithResult(_0x198d08,null))[_0xa95c('0x17')](handleError(_0x198d08,null));};exports[_0xa95c('0x5f')]=function(_0x378922,_0x3a2ce6){return respondWithRpcPromise(_0xa95c('0x60'),_0x378922[_0xa95c('0x16')],routingClient)[_0xa95c('0x8')](respondWithResult(_0x3a2ce6,null))[_0xa95c('0x17')](handleError(_0x3a2ce6,null));};exports[_0xa95c('0x61')]=function(_0x5a87fa){return function(_0x5e7658,_0x4c0cba){var _0x11326f,_0x38e524;var _0x7fc490=_['capitalize'](_0x5a87fa);var _0x59be77=_0x5a87fa===_0xa95c('0x62')?'Website':_0xa95c('0x63');return db[_0x7fc490+_0xa95c('0x64')]['findOne']({'raw':!![],'where':{'id':_0x5e7658[_0xa95c('0x1a')]['id']}})[_0xa95c('0x8')](function(_0x36de56){if(_['isNil'](_0x36de56)){throw new Error(_0x7fc490+_0xa95c('0x65'));}_0x11326f=_0x36de56;return db[_0x7fc490+'Message']['findOne']({'where':{'id':_0x5e7658[_0xa95c('0x2f')][_0xa95c('0x66')]},'include':[{'model':db[_0x7fc490+'Interaction'],'as':_0xa95c('0x67')},{'model':db[_0x7fc490+_0x59be77],'as':_0xa95c('0x63')}]});})['then'](function(_0x1c919b){if(_[_0xa95c('0x12')](_0x1c919b)){throw new Error(_0x7fc490+'\x20Message\x20not\x20found');}_0x38e524=_0x1c919b;return _0x1c919b[_0xa95c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa95c('0x8')](function(){var _0x1ef545={'uniqueid':_0x5a87fa+'.'+_0x38e524['id']+'.'+_0x38e524['Interaction']['id'],'FromUserId':_0x5e7658[_0xa95c('0x31')]['id'],'type':_0xa95c('0x69')};_0x1ef545[_0x7fc490+'MessageId']=_0x38e524['id'];_0x1ef545[_0x7fc490+_0xa95c('0x6a')]=_0x38e524[_0xa95c('0x67')]['id'];_0x1ef545[_0xa95c('0x6b')+_0x7fc490+_0x59be77+'Id']=_0x38e524['Account']['id'];_0x1ef545['To'+_0x7fc490+'QueueId']=_0x11326f['id'];return db[_0x7fc490+_0xa95c('0x6c')]['create'](_0x1ef545);})[_0xa95c('0x8')](function(){return respondWithRpcPromise(_0xa95c('0x6d'),{'channel':_0x5a87fa,'interaction':_0x38e524['Interaction'],'message':_0x38e524,'account':_0x38e524[_0xa95c('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa95c('0x69'),'appdata':_0x11326f[_0xa95c('0x10')]+','+(_0x38e524[_0xa95c('0x63')][_0xa95c('0x6e')]||0x12c),'interval':_0xa95c('0x6f')}]},routingClient);})[_0xa95c('0x8')](respondWithResult(_0x4c0cba,null))[_0xa95c('0x17')](handleError(_0x4c0cba,null));};};exports[_0xa95c('0x70')]=function(_0x5823f1,_0x4691f4){var _0x5a6b5d,_0x3424ae;if(_[_0xa95c('0x12')](_0x5823f1[_0xa95c('0x2f')][_0xa95c('0x71')])){throw new Error(_0xa95c('0x72'));}var _0x378717=_0x5823f1[_0xa95c('0x2f')]['channel'];var _0x186a36=_['capitalize'](_0x378717);var _0x25e008=_0x378717===_0xa95c('0x62')?_0xa95c('0x73'):_0xa95c('0x63');return db[_0xa95c('0x74')][_0xa95c('0x75')]({'raw':!![],'where':{'id':_0x5823f1[_0xa95c('0x1a')]['id'],'role':_0xa95c('0x3b')}})[_0xa95c('0x8')](function(_0x3b067d){if(_[_0xa95c('0x12')](_0x3b067d)){throw new Error(_0xa95c('0x76'));}_0x5a6b5d=_0x3b067d;return db[_0x186a36+'Message'][_0xa95c('0x75')]({'where':{'id':_0x5823f1[_0xa95c('0x2f')][_0xa95c('0x66')]},'include':[{'model':db[_0x186a36+_0xa95c('0x67')],'as':'Interaction'},{'model':db[_0x186a36+_0x25e008],'as':_0xa95c('0x63')}]});})[_0xa95c('0x8')](function(_0x382ada){if(_['isNil'](_0x382ada)){throw new Error(_0x186a36+_0xa95c('0x77'));}_0x3424ae=_0x382ada;return _0x382ada[_0xa95c('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa95c('0x8')](function(){var _0x469b6c={'uniqueid':_0x378717+'.'+_0x3424ae['id']+'.'+_0x3424ae[_0xa95c('0x67')]['id'],'FromUserId':_0x5823f1[_0xa95c('0x31')]['id'],'type':'agent','ToUserId':_0x5a6b5d['id']};_0x469b6c[_0x186a36+_0xa95c('0x78')]=_0x3424ae['id'];_0x469b6c[_0x186a36+_0xa95c('0x6a')]=_0x3424ae[_0xa95c('0x67')]['id'];_0x469b6c['From'+_0x186a36+_0x25e008+'Id']=_0x3424ae[_0xa95c('0x63')]['id'];return db[_0x186a36+_0xa95c('0x6c')][_0xa95c('0x79')](_0x469b6c);})[_0xa95c('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x378717,'interaction':_0x3424ae[_0xa95c('0x67')],'message':_0x3424ae,'account':_0x3424ae[_0xa95c('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x5a6b5d['name']+','+(_0x3424ae['Account'][_0xa95c('0x7a')]||0x12c),'interval':_0xa95c('0x6f')}]},routingClient);})[_0xa95c('0x8')](respondWithResult(_0x4691f4,null))[_0xa95c('0x17')](handleError(_0x4691f4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a33bf2a..229eb83 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 _0x48e4=['/:id/run','run','create','put','delete','destroy','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x48e4,0x1a7));var _0x448e=function(_0x2c7549,_0x165c23){_0x2c7549=_0x2c7549-0x0;var _0x557f3c=_0x48e4[_0x2c7549];return _0x557f3c;};'use strict';var multer=require(_0x448e('0x0'));var util=require(_0x448e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x448e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x448e('0x3'));var config=require(_0x448e('0x4'));var controller=require(_0x448e('0x5'));router[_0x448e('0x6')]('/',auth[_0x448e('0x7')](),controller['index']);router[_0x448e('0x6')](_0x448e('0x8'),auth[_0x448e('0x7')](),controller['show']);router['get'](_0x448e('0x9'),auth[_0x448e('0x7')](),controller[_0x448e('0xa')]);router['post']('/',auth[_0x448e('0x7')](),controller[_0x448e('0xb')]);router[_0x448e('0xc')](_0x448e('0x8'),auth[_0x448e('0x7')](),controller['update']);router[_0x448e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x448e('0xe')]);module[_0x448e('0xf')]=router; \ No newline at end of file +var _0xc39d=['/:id/run','post','create','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x5b906a,_0x35712a){var _0x3cd7ec=function(_0x5d06f6){while(--_0x5d06f6){_0x5b906a['push'](_0x5b906a['shift']());}};_0x3cd7ec(++_0x35712a);}(_0xc39d,0xb7));var _0xdc39=function(_0x4971c6,_0x4dd897){_0x4971c6=_0x4971c6-0x0;var _0xfa846f=_0xc39d[_0x4971c6];return _0xfa846f;};'use strict';var multer=require(_0xdc39('0x0'));var util=require('util');var path=require(_0xdc39('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc39('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc39('0x3'));var interaction=require(_0xdc39('0x4'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xdc39('0x5')]('/',auth[_0xdc39('0x6')](),controller[_0xdc39('0x7')]);router['get'](_0xdc39('0x8'),auth[_0xdc39('0x6')](),controller['show']);router['get'](_0xdc39('0x9'),auth[_0xdc39('0x6')](),controller['run']);router[_0xdc39('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc39('0xb')]);router['put'](_0xdc39('0x8'),auth[_0xdc39('0x6')](),controller[_0xdc39('0xc')]);router[_0xdc39('0xd')](_0xdc39('0x8'),auth[_0xdc39('0x6')](),controller[_0xdc39('0xe')]);module[_0xdc39('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8960b12..e1a3744 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 _0x64f9=['0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','hours','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING'];(function(_0x207011,_0x220d0e){var _0x5facde=function(_0x1fc60a){while(--_0x1fc60a){_0x207011['push'](_0x207011['shift']());}};_0x5facde(++_0x220d0e);}(_0x64f9,0x1a6));var _0x964f=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0x64f9[_0x5dc03e];return _0x466a07;};'use strict';var Sequelize=require(_0x964f('0x0'));module[_0x964f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x964f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x964f('0x2')],'allowNull':![],'defaultValue':_0x964f('0x3')},'startAt':{'type':Sequelize[_0x964f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x964f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x964f('0x5')](_0x964f('0x6'),_0x964f('0x7'),_0x964f('0x8'),_0x964f('0x9'),_0x964f('0xa'),_0x964f('0xb'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x964f('0x5')]('csv','pdf',_0x964f('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0x964f('0xd'),_0x964f('0xe')),'allowNull':![],'defaultValue':_0x964f('0xd')},'sendMail':{'type':Sequelize[_0x964f('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0x964f('0x2')]},'cc':{'type':Sequelize[_0x964f('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x964f('0xf')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd9bc=['weeks','days','ENUM','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months'];(function(_0x5e6713,_0x2e1832){var _0xe812ed=function(_0x4be00c){while(--_0x4be00c){_0x5e6713['push'](_0x5e6713['shift']());}};_0xe812ed(++_0x2e1832);}(_0xd9bc,0x1c8));var _0xcd9b=function(_0x4df794,_0x3b8c14){_0x4df794=_0x4df794-0x0;var _0x2a3349=_0xd9bc[_0x4df794];return _0x2a3349;};'use strict';var Sequelize=require('sequelize');module[_0xcd9b('0x0')]={'name':{'type':Sequelize[_0xcd9b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcd9b('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcd9b('0x1')],'allowNull':![],'defaultValue':_0xcd9b('0x3')},'startAt':{'type':Sequelize[_0xcd9b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcd9b('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xcd9b('0x5'),_0xcd9b('0x6'),_0xcd9b('0x7'),_0xcd9b('0x8'),_0xcd9b('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcd9b('0xa')]('csv',_0xcd9b('0xb'),_0xcd9b('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xcd9b('0xd'),_0xcd9b('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xcd9b('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xcd9b('0x1')]},'cc':{'type':Sequelize[_0xcd9b('0xf')]},'bcc':{'type':Sequelize[_0xcd9b('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f352ef3..a1662f7 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 _0xd903=['sox','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','get','UserProfileResource','destroy','then','error','stack','name','send','index','map','Schedule','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x507415,_0x120d18){var _0x14b910=function(_0x512561){while(--_0x512561){_0x507415['push'](_0x507415['shift']());}};_0x14b910(++_0x120d18);}(_0xd903,0x9a));var _0x3d90=function(_0x3e6f6c,_0x22ca73){_0x3e6f6c=_0x3e6f6c-0x0;var _0x51d485=_0xd903[_0x3e6f6c];return _0x51d485;};'use strict';var emlformat=require(_0x3d90('0x0'));var rimraf=require(_0x3d90('0x1'));var zipdir=require(_0x3d90('0x2'));var jsonpatch=require(_0x3d90('0x3'));var rp=require(_0x3d90('0x4'));var moment=require(_0x3d90('0x5'));var BPromise=require(_0x3d90('0x6'));var Mustache=require(_0x3d90('0x7'));var util=require(_0x3d90('0x8'));var path=require(_0x3d90('0x9'));var sox=require(_0x3d90('0xa'));var csv=require(_0x3d90('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d90('0xc'));var _=require(_0x3d90('0xd'));var squel=require('squel');var crypto=require(_0x3d90('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3d90('0xf'));var Redis=require(_0x3d90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d90('0x11'));var as=require(_0x3d90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d90('0x13'));var db=require(_0x3d90('0x14'))['db'];function respondWithStatusCode(_0xb54c4a,_0x2b4192){_0x2b4192=_0x2b4192||0xcc;return function(_0x85217b){if(_0x85217b){return _0xb54c4a[_0x3d90('0x15')](_0x2b4192);}return _0xb54c4a['status'](_0x2b4192)[_0x3d90('0x16')]();};}function respondWithResult(_0x4c65c4,_0x24b574){_0x24b574=_0x24b574||0xc8;return function(_0xbec10f){if(_0xbec10f){return _0x4c65c4[_0x3d90('0x17')](_0x24b574)[_0x3d90('0x18')](_0xbec10f);}};}function respondWithFilteredResult(_0x4896d5,_0x3510b4){return function(_0xb89b90){if(_0xb89b90){var _0x343267=typeof _0x3510b4['offset']===_0x3d90('0x19')&&typeof _0x3510b4[_0x3d90('0x1a')]===_0x3d90('0x19');var _0x2211f6=_0xb89b90[_0x3d90('0x1b')];var _0xe0eba5=_0x343267?0x0:_0x3510b4['offset'];var _0x43b748=_0x343267?_0xb89b90['count']:_0x3510b4[_0x3d90('0x1c')]+_0x3510b4[_0x3d90('0x1a')];var _0x284fb8;if(_0x43b748>=_0x2211f6){_0x43b748=_0x2211f6;_0x284fb8=0xc8;}else{_0x284fb8=0xce;}_0x4896d5['status'](_0x284fb8);return _0x4896d5[_0x3d90('0x1d')]('Content-Range',_0xe0eba5+'-'+_0x43b748+'/'+_0x2211f6)[_0x3d90('0x18')](_0xb89b90);}return null;};}function patchUpdates(_0x59aae7){return function(_0x332547){try{jsonpatch['apply'](_0x332547,_0x59aae7,!![]);}catch(_0xa0aa49){return BPromise[_0x3d90('0x1e')](_0xa0aa49);}return _0x332547[_0x3d90('0x1f')]();};}function saveUpdates(_0x400a75,_0x21e6da){return function(_0x407eda){if(_0x407eda){return _0x407eda[_0x3d90('0x20')](_0x400a75)['then'](function(_0x4802b8){return _0x4802b8;});}return null;};}function removeEntity(_0x58d365,_0x532097){return function(_0x449d30){if(_0x449d30){return _0x449d30['destroy']()['then'](function(){var _0x40d2ab=_0x449d30[_0x3d90('0x21')]({'plain':!![]});var _0x3c0e5e='Scheduler';return db[_0x3d90('0x22')][_0x3d90('0x23')]({'where':{'type':_0x3c0e5e,'resourceId':_0x40d2ab['id']}})[_0x3d90('0x24')](function(){return _0x449d30;});})[_0x3d90('0x24')](function(){_0x58d365[_0x3d90('0x17')](0xcc)[_0x3d90('0x16')]();});}};}function handleEntityNotFound(_0x599705,_0x69862f){return function(_0x329ec9){if(!_0x329ec9){_0x599705[_0x3d90('0x15')](0x194);}return _0x329ec9;};}function handleError(_0x1f2c4b,_0x5e7bb1){_0x5e7bb1=_0x5e7bb1||0x1f4;return function(_0x56c078){logger[_0x3d90('0x25')](_0x56c078[_0x3d90('0x26')]);if(_0x56c078[_0x3d90('0x27')]){delete _0x56c078[_0x3d90('0x27')];}_0x1f2c4b['status'](_0x5e7bb1)[_0x3d90('0x28')](_0x56c078);};}exports[_0x3d90('0x29')]=function(_0x461ea0,_0x1e66f1){var _0x4006a5={},_0x14f362={},_0x1cffd0={'count':0x0,'rows':[]};var _0x3f0cb5=_[_0x3d90('0x2a')](db[_0x3d90('0x2b')][_0x3d90('0x2c')],function(_0x9259c7){return{'name':_0x9259c7['fieldName'],'type':_0x9259c7[_0x3d90('0x2d')]['key']};});_0x14f362[_0x3d90('0x2e')]=_[_0x3d90('0x2a')](_0x3f0cb5,'name');_0x14f362[_0x3d90('0x2f')]=_[_0x3d90('0x30')](_0x461ea0[_0x3d90('0x2f')]);_0x14f362[_0x3d90('0x31')]=_[_0x3d90('0x32')](_0x14f362['model'],_0x14f362[_0x3d90('0x2f')]);_0x4006a5[_0x3d90('0x33')]=_[_0x3d90('0x32')](_0x14f362[_0x3d90('0x2e')],qs[_0x3d90('0x34')](_0x461ea0[_0x3d90('0x2f')][_0x3d90('0x34')]));_0x4006a5[_0x3d90('0x33')]=_0x4006a5[_0x3d90('0x33')][_0x3d90('0x35')]?_0x4006a5['attributes']:_0x14f362[_0x3d90('0x2e')];if(!_0x461ea0['query'][_0x3d90('0x36')](_0x3d90('0x37'))){_0x4006a5['limit']=qs[_0x3d90('0x1a')](_0x461ea0[_0x3d90('0x2f')]['limit']);_0x4006a5[_0x3d90('0x1c')]=qs[_0x3d90('0x1c')](_0x461ea0[_0x3d90('0x2f')][_0x3d90('0x1c')]);}_0x4006a5[_0x3d90('0x38')]=qs[_0x3d90('0x39')](_0x461ea0[_0x3d90('0x2f')][_0x3d90('0x39')]);_0x4006a5[_0x3d90('0x3a')]=qs[_0x3d90('0x31')](_['pick'](_0x461ea0[_0x3d90('0x2f')],_0x14f362[_0x3d90('0x31')]),_0x3f0cb5);if(_0x461ea0[_0x3d90('0x2f')]['filter']){_0x4006a5[_0x3d90('0x3a')]=_['merge'](_0x4006a5['where'],{'$or':_['map'](_0x3f0cb5,function(_0x32c576){if(_0x32c576[_0x3d90('0x2d')]!==_0x3d90('0x3b')){var _0xf87c25={};_0xf87c25[_0x32c576['name']]={'$like':'%'+_0x461ea0[_0x3d90('0x2f')][_0x3d90('0x3c')]+'%'};return _0xf87c25;}})});}_0x4006a5=_[_0x3d90('0x3d')]({},_0x4006a5,_0x461ea0[_0x3d90('0x3e')]);var _0x42a729={'where':_0x4006a5['where']};return db['Schedule'][_0x3d90('0x1b')](_0x42a729)[_0x3d90('0x24')](function(_0x496176){_0x1cffd0['count']=_0x496176;if(_0x461ea0[_0x3d90('0x2f')][_0x3d90('0x3f')]){_0x4006a5[_0x3d90('0x40')]=[{'all':!![]}];}return db[_0x3d90('0x2b')][_0x3d90('0x41')](_0x4006a5);})[_0x3d90('0x24')](function(_0x2c67bb){_0x1cffd0[_0x3d90('0x42')]=_0x2c67bb;return _0x1cffd0;})[_0x3d90('0x24')](respondWithFilteredResult(_0x1e66f1,_0x4006a5))[_0x3d90('0x43')](handleError(_0x1e66f1,null));};exports[_0x3d90('0x44')]=function(_0x21b961,_0x23ef5c){var _0x3b57cb={'raw':![],'where':{'id':_0x21b961[_0x3d90('0x45')]['id']}},_0x1ba4e1={};_0x1ba4e1[_0x3d90('0x2e')]=_[_0x3d90('0x30')](db[_0x3d90('0x2b')]['rawAttributes']);_0x1ba4e1[_0x3d90('0x2f')]=_[_0x3d90('0x30')](_0x21b961[_0x3d90('0x2f')]);_0x1ba4e1[_0x3d90('0x31')]=_['intersection'](_0x1ba4e1[_0x3d90('0x2e')],_0x1ba4e1[_0x3d90('0x2f')]);_0x3b57cb['attributes']=_['intersection'](_0x1ba4e1[_0x3d90('0x2e')],qs['fields'](_0x21b961[_0x3d90('0x2f')]['fields']));_0x3b57cb['attributes']=_0x3b57cb[_0x3d90('0x33')][_0x3d90('0x35')]?_0x3b57cb['attributes']:_0x1ba4e1[_0x3d90('0x2e')];if(_0x21b961['query']['includeAll']){_0x3b57cb[_0x3d90('0x40')]=[{'all':!![]}];}_0x3b57cb=_[_0x3d90('0x3d')]({},_0x3b57cb,_0x21b961['options']);return db[_0x3d90('0x2b')]['find'](_0x3b57cb)[_0x3d90('0x24')](handleEntityNotFound(_0x23ef5c,null))['then'](respondWithResult(_0x23ef5c,null))['catch'](handleError(_0x23ef5c,null));};exports[_0x3d90('0x46')]=function(_0x44a58c,_0x2dbd40){return db[_0x3d90('0x2b')][_0x3d90('0x46')](_0x44a58c[_0x3d90('0x47')],{})['then'](function(_0x510669){var _0x2b7ef2=_0x44a58c['user'][_0x3d90('0x21')]({'plain':!![]});if(!_0x2b7ef2)throw new Error(_0x3d90('0x48'));if(_0x2b7ef2[_0x3d90('0x49')]===_0x3d90('0x4a')){var _0x453491=_0x510669[_0x3d90('0x21')]({'plain':!![]});var _0x38508c=_0x3d90('0x4b');return db[_0x3d90('0x4c')][_0x3d90('0x4d')]({'where':{'name':_0x38508c,'userProfileId':_0x2b7ef2[_0x3d90('0x4e')]},'raw':!![]})['then'](function(_0x3678ee){if(_0x3678ee&&_0x3678ee[_0x3d90('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x453491[_0x3d90('0x27')],'resourceId':_0x453491['id'],'type':_0x3678ee[_0x3d90('0x27')],'sectionId':_0x3678ee['id']},{})[_0x3d90('0x24')](function(){return _0x510669;});}else{return _0x510669;}})['catch'](function(_0xda21e0){logger[_0x3d90('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xda21e0);throw _0xda21e0;});}return _0x510669;})['then'](respondWithResult(_0x2dbd40,0xc9))[_0x3d90('0x43')](handleError(_0x2dbd40,null));};exports[_0x3d90('0x20')]=function(_0x23744f,_0x24d37a){if(_0x23744f[_0x3d90('0x47')]['id']){delete _0x23744f[_0x3d90('0x47')]['id'];}return db[_0x3d90('0x2b')][_0x3d90('0x4d')]({'where':{'id':_0x23744f[_0x3d90('0x45')]['id']}})['then'](handleEntityNotFound(_0x24d37a,null))[_0x3d90('0x24')](saveUpdates(_0x23744f['body'],null))[_0x3d90('0x24')](respondWithResult(_0x24d37a,null))['catch'](handleError(_0x24d37a,null));};exports['destroy']=function(_0x3abfef,_0x5e6696){return db[_0x3d90('0x2b')][_0x3d90('0x4d')]({'where':{'id':_0x3abfef[_0x3d90('0x45')]['id']}})[_0x3d90('0x24')](handleEntityNotFound(_0x5e6696,null))[_0x3d90('0x24')](removeEntity(_0x5e6696,null))['catch'](handleError(_0x5e6696,null));};exports[_0x3d90('0x50')]=function(_0x5daadb,_0x16b29a,_0x3b0eba){var _0x1039ac=require(_0x3d90('0x51'));return db[_0x3d90('0x2b')][_0x3d90('0x4d')]({'where':{'id':_0x5daadb[_0x3d90('0x45')]['id']},'raw':!![]})[_0x3d90('0x24')](handleEntityNotFound(_0x16b29a,null))['then'](function(){_0x1039ac['run'](_0x5daadb[_0x3d90('0x45')]['id']);})[_0x3d90('0x24')](respondWithStatusCode(_0x16b29a,null))[_0x3d90('0x43')](handleError(_0x16b29a,null));}; \ No newline at end of file +var _0xb709=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','Scheduler','end','stack','name','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','run','../../config/schedule','eml-format','rimraf','fast-json-patch','moment','bluebird','path'];(function(_0x53f68c,_0x152b67){var _0x1048f2=function(_0x1d11d5){while(--_0x1d11d5){_0x53f68c['push'](_0x53f68c['shift']());}};_0x1048f2(++_0x152b67);}(_0xb709,0x142));var _0x9b70=function(_0xa7dce0,_0x1525ab){_0xa7dce0=_0xa7dce0-0x0;var _0x3c4886=_0xb709[_0xa7dce0];return _0x3c4886;};'use strict';var emlformat=require(_0x9b70('0x0'));var rimraf=require(_0x9b70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b70('0x2'));var rp=require('request-promise');var moment=require(_0x9b70('0x3'));var BPromise=require(_0x9b70('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9b70('0x5'));var sox=require(_0x9b70('0x6'));var csv=require(_0x9b70('0x7'));var ejs=require(_0x9b70('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b70('0x9'));var squel=require(_0x9b70('0xa'));var crypto=require(_0x9b70('0xb'));var jsforce=require(_0x9b70('0xc'));var deskjs=require(_0x9b70('0xd'));var toCsv=require(_0x9b70('0x7'));var querystring=require(_0x9b70('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b70('0xf'));var authService=require(_0x9b70('0x10'));var qs=require(_0x9b70('0x11'));var as=require(_0x9b70('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b70('0x13'))('api');var utils=require(_0x9b70('0x14'));var config=require(_0x9b70('0x15'));var licenseUtil=require(_0x9b70('0x16'));var db=require(_0x9b70('0x17'))['db'];function respondWithStatusCode(_0x59714d,_0x26fffe){_0x26fffe=_0x26fffe||0xcc;return function(_0x2c1359){if(_0x2c1359){return _0x59714d[_0x9b70('0x18')](_0x26fffe);}return _0x59714d[_0x9b70('0x19')](_0x26fffe)['end']();};}function respondWithResult(_0x17e2e4,_0x3ec94c){_0x3ec94c=_0x3ec94c||0xc8;return function(_0x4a3910){if(_0x4a3910){return _0x17e2e4[_0x9b70('0x19')](_0x3ec94c)[_0x9b70('0x1a')](_0x4a3910);}};}function respondWithFilteredResult(_0x3234f9,_0x1c259b){return function(_0x1f7253){if(_0x1f7253){var _0x40df22=typeof _0x1c259b[_0x9b70('0x1b')]===_0x9b70('0x1c')&&typeof _0x1c259b[_0x9b70('0x1d')]===_0x9b70('0x1c');var _0x319071=_0x1f7253[_0x9b70('0x1e')];var _0x17bd72=_0x40df22?0x0:_0x1c259b[_0x9b70('0x1b')];var _0x480f14=_0x40df22?_0x1f7253['count']:_0x1c259b[_0x9b70('0x1b')]+_0x1c259b[_0x9b70('0x1d')];var _0x2d82fa;if(_0x480f14>=_0x319071){_0x480f14=_0x319071;_0x2d82fa=0xc8;}else{_0x2d82fa=0xce;}_0x3234f9['status'](_0x2d82fa);return _0x3234f9[_0x9b70('0x1f')]('Content-Range',_0x17bd72+'-'+_0x480f14+'/'+_0x319071)['json'](_0x1f7253);}return null;};}function patchUpdates(_0x3144ac){return function(_0x171904){try{jsonpatch['apply'](_0x171904,_0x3144ac,!![]);}catch(_0x210a23){return BPromise[_0x9b70('0x20')](_0x210a23);}return _0x171904[_0x9b70('0x21')]();};}function saveUpdates(_0x5b42b2,_0x1e8445){return function(_0x5587c1){if(_0x5587c1){return _0x5587c1[_0x9b70('0x22')](_0x5b42b2)[_0x9b70('0x23')](function(_0x5163d1){return _0x5163d1;});}return null;};}function removeEntity(_0x1f4f9d,_0x24e02e){return function(_0x470fa0){if(_0x470fa0){return _0x470fa0['destroy']()['then'](function(){var _0x2a638a=_0x470fa0['get']({'plain':!![]});var _0x1311a1=_0x9b70('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1311a1,'resourceId':_0x2a638a['id']}})[_0x9b70('0x23')](function(){return _0x470fa0;});})['then'](function(){_0x1f4f9d[_0x9b70('0x19')](0xcc)[_0x9b70('0x25')]();});}};}function handleEntityNotFound(_0x312f24,_0x1b4e18){return function(_0x4bc1b1){if(!_0x4bc1b1){_0x312f24['sendStatus'](0x194);}return _0x4bc1b1;};}function handleError(_0x320d05,_0x220ad6){_0x220ad6=_0x220ad6||0x1f4;return function(_0x4e9fd7){logger['error'](_0x4e9fd7[_0x9b70('0x26')]);if(_0x4e9fd7[_0x9b70('0x27')]){delete _0x4e9fd7[_0x9b70('0x27')];}_0x320d05[_0x9b70('0x19')](_0x220ad6)['send'](_0x4e9fd7);};}exports['index']=function(_0x30529b,_0x18ebea){var _0x446c54={},_0x40ea88={},_0x270ce3={'count':0x0,'rows':[]};var _0x3f8632=_[_0x9b70('0x28')](db[_0x9b70('0x29')][_0x9b70('0x2a')],function(_0x463d60){return{'name':_0x463d60[_0x9b70('0x2b')],'type':_0x463d60['type'][_0x9b70('0x2c')]};});_0x40ea88[_0x9b70('0x2d')]=_['map'](_0x3f8632,'name');_0x40ea88[_0x9b70('0x2e')]=_[_0x9b70('0x2f')](_0x30529b[_0x9b70('0x2e')]);_0x40ea88[_0x9b70('0x30')]=_[_0x9b70('0x31')](_0x40ea88[_0x9b70('0x2d')],_0x40ea88[_0x9b70('0x2e')]);_0x446c54['attributes']=_['intersection'](_0x40ea88[_0x9b70('0x2d')],qs[_0x9b70('0x32')](_0x30529b[_0x9b70('0x2e')][_0x9b70('0x32')]));_0x446c54[_0x9b70('0x33')]=_0x446c54[_0x9b70('0x33')]['length']?_0x446c54['attributes']:_0x40ea88[_0x9b70('0x2d')];if(!_0x30529b[_0x9b70('0x2e')][_0x9b70('0x34')]('nolimit')){_0x446c54[_0x9b70('0x1d')]=qs[_0x9b70('0x1d')](_0x30529b[_0x9b70('0x2e')][_0x9b70('0x1d')]);_0x446c54[_0x9b70('0x1b')]=qs[_0x9b70('0x1b')](_0x30529b[_0x9b70('0x2e')][_0x9b70('0x1b')]);}_0x446c54[_0x9b70('0x35')]=qs[_0x9b70('0x36')](_0x30529b[_0x9b70('0x2e')][_0x9b70('0x36')]);_0x446c54[_0x9b70('0x37')]=qs['filters'](_[_0x9b70('0x38')](_0x30529b['query'],_0x40ea88[_0x9b70('0x30')]),_0x3f8632);if(_0x30529b[_0x9b70('0x2e')][_0x9b70('0x39')]){_0x446c54[_0x9b70('0x37')]=_['merge'](_0x446c54[_0x9b70('0x37')],{'$or':_[_0x9b70('0x28')](_0x3f8632,function(_0x45da37){if(_0x45da37['type']!=='VIRTUAL'){var _0x5729e5={};_0x5729e5[_0x45da37[_0x9b70('0x27')]]={'$like':'%'+_0x30529b[_0x9b70('0x2e')][_0x9b70('0x39')]+'%'};return _0x5729e5;}})});}_0x446c54=_[_0x9b70('0x3a')]({},_0x446c54,_0x30529b[_0x9b70('0x3b')]);var _0x434516={'where':_0x446c54['where']};return db[_0x9b70('0x29')][_0x9b70('0x1e')](_0x434516)[_0x9b70('0x23')](function(_0x31d3a3){_0x270ce3[_0x9b70('0x1e')]=_0x31d3a3;if(_0x30529b[_0x9b70('0x2e')][_0x9b70('0x3c')]){_0x446c54[_0x9b70('0x3d')]=[{'all':!![]}];}return db[_0x9b70('0x29')][_0x9b70('0x3e')](_0x446c54);})[_0x9b70('0x23')](function(_0x3c9bc4){_0x270ce3[_0x9b70('0x3f')]=_0x3c9bc4;return _0x270ce3;})[_0x9b70('0x23')](respondWithFilteredResult(_0x18ebea,_0x446c54))[_0x9b70('0x40')](handleError(_0x18ebea,null));};exports[_0x9b70('0x41')]=function(_0x11edec,_0x4aa703){var _0x92a6e2={'raw':![],'where':{'id':_0x11edec[_0x9b70('0x42')]['id']}},_0x40279c={};_0x40279c['model']=_[_0x9b70('0x2f')](db['Schedule'][_0x9b70('0x2a')]);_0x40279c[_0x9b70('0x2e')]=_[_0x9b70('0x2f')](_0x11edec['query']);_0x40279c[_0x9b70('0x30')]=_['intersection'](_0x40279c[_0x9b70('0x2d')],_0x40279c[_0x9b70('0x2e')]);_0x92a6e2[_0x9b70('0x33')]=_[_0x9b70('0x31')](_0x40279c[_0x9b70('0x2d')],qs[_0x9b70('0x32')](_0x11edec[_0x9b70('0x2e')][_0x9b70('0x32')]));_0x92a6e2['attributes']=_0x92a6e2[_0x9b70('0x33')][_0x9b70('0x43')]?_0x92a6e2['attributes']:_0x40279c['model'];if(_0x11edec[_0x9b70('0x2e')][_0x9b70('0x3c')]){_0x92a6e2[_0x9b70('0x3d')]=[{'all':!![]}];}_0x92a6e2=_[_0x9b70('0x3a')]({},_0x92a6e2,_0x11edec[_0x9b70('0x3b')]);return db[_0x9b70('0x29')][_0x9b70('0x44')](_0x92a6e2)[_0x9b70('0x23')](handleEntityNotFound(_0x4aa703,null))[_0x9b70('0x23')](respondWithResult(_0x4aa703,null))[_0x9b70('0x40')](handleError(_0x4aa703,null));};exports[_0x9b70('0x45')]=function(_0x2d416b,_0x34edee){return db['Schedule'][_0x9b70('0x45')](_0x2d416b[_0x9b70('0x46')],{})[_0x9b70('0x23')](function(_0xc40d3e){var _0x585fa7=_0x2d416b[_0x9b70('0x47')]['get']({'plain':!![]});if(!_0x585fa7)throw new Error(_0x9b70('0x48'));if(_0x585fa7[_0x9b70('0x49')]===_0x9b70('0x47')){var _0x222dea=_0xc40d3e[_0x9b70('0x4a')]({'plain':!![]});var _0x23b97f=_0x9b70('0x24');return db[_0x9b70('0x4b')][_0x9b70('0x44')]({'where':{'name':_0x23b97f,'userProfileId':_0x585fa7[_0x9b70('0x4c')]},'raw':!![]})[_0x9b70('0x23')](function(_0x4b4e55){if(_0x4b4e55&&_0x4b4e55['autoAssociation']===0x0){return db[_0x9b70('0x4d')][_0x9b70('0x45')]({'name':_0x222dea[_0x9b70('0x27')],'resourceId':_0x222dea['id'],'type':_0x4b4e55[_0x9b70('0x27')],'sectionId':_0x4b4e55['id']},{})['then'](function(){return _0xc40d3e;});}else{return _0xc40d3e;}})[_0x9b70('0x40')](function(_0x3c373c){logger['error'](_0x9b70('0x4e'),_0x3c373c);throw _0x3c373c;});}return _0xc40d3e;})[_0x9b70('0x23')](respondWithResult(_0x34edee,0xc9))['catch'](handleError(_0x34edee,null));};exports[_0x9b70('0x22')]=function(_0x9bd35e,_0x4052e6){if(_0x9bd35e['body']['id']){delete _0x9bd35e[_0x9b70('0x46')]['id'];}return db['Schedule'][_0x9b70('0x44')]({'where':{'id':_0x9bd35e[_0x9b70('0x42')]['id']}})['then'](handleEntityNotFound(_0x4052e6,null))['then'](saveUpdates(_0x9bd35e[_0x9b70('0x46')],null))['then'](respondWithResult(_0x4052e6,null))[_0x9b70('0x40')](handleError(_0x4052e6,null));};exports[_0x9b70('0x4f')]=function(_0x1c7b08,_0x201245){return db[_0x9b70('0x29')]['find']({'where':{'id':_0x1c7b08['params']['id']}})[_0x9b70('0x23')](handleEntityNotFound(_0x201245,null))[_0x9b70('0x23')](removeEntity(_0x201245,null))[_0x9b70('0x40')](handleError(_0x201245,null));};exports[_0x9b70('0x50')]=function(_0x1f073d,_0x4a1871,_0x47692a){var _0x46728d=require(_0x9b70('0x51'));return db[_0x9b70('0x29')][_0x9b70('0x44')]({'where':{'id':_0x1f073d[_0x9b70('0x42')]['id']},'raw':!![]})[_0x9b70('0x23')](handleEntityNotFound(_0x4a1871,null))[_0x9b70('0x23')](function(){_0x46728d['run'](_0x1f073d[_0x9b70('0x42')]['id']);})[_0x9b70('0x23')](respondWithStatusCode(_0x4a1871,null))[_0x9b70('0x40')](handleError(_0x4a1871,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0039f49..0a25c07 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 _0x2d1e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','tools_schedules','lodash'];(function(_0x4998d3,_0x4628fb){var _0x7388ac=function(_0x28df92){while(--_0x28df92){_0x4998d3['push'](_0x4998d3['shift']());}};_0x7388ac(++_0x4628fb);}(_0x2d1e,0x9b));var _0xe2d1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2d1e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe2d1('0x0'));var util=require(_0xe2d1('0x1'));var logger=require(_0xe2d1('0x2'))('api');var moment=require(_0xe2d1('0x3'));var BPromise=require(_0xe2d1('0x4'));var rp=require(_0xe2d1('0x5'));var fs=require('fs');var path=require(_0xe2d1('0x6'));var rimraf=require(_0xe2d1('0x7'));var config=require('../../config/environment');var attributes=require(_0xe2d1('0x8'));module[_0xe2d1('0x9')]=function(_0x4d2985,_0xe493ac){return _0x4d2985[_0xe2d1('0xa')]('Schedule',attributes,{'tableName':_0xe2d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5614=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird'];(function(_0x4533c1,_0xc9c0ca){var _0x45fd62=function(_0x582329){while(--_0x582329){_0x4533c1['push'](_0x4533c1['shift']());}};_0x45fd62(++_0xc9c0ca);}(_0x5614,0x13d));var _0x4561=function(_0x175c6e,_0x6385e8){_0x175c6e=_0x175c6e-0x0;var _0x423b4f=_0x5614[_0x175c6e];return _0x423b4f;};'use strict';var _=require('lodash');var util=require(_0x4561('0x0'));var logger=require(_0x4561('0x1'))(_0x4561('0x2'));var moment=require(_0x4561('0x3'));var BPromise=require(_0x4561('0x4'));var rp=require(_0x4561('0x5'));var fs=require('fs');var path=require(_0x4561('0x6'));var rimraf=require(_0x4561('0x7'));var config=require(_0x4561('0x8'));var attributes=require(_0x4561('0x9'));module[_0x4561('0xa')]=function(_0x122d95,_0x11a756){return _0x122d95[_0x4561('0xb')](_0x4561('0xc'),attributes,{'tableName':_0x4561('0xd'),'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 524ed3c..e207039 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 _0x3904=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x3904,0x18d));var _0x4390=function(_0xfe3bc5,_0x2c8bad){_0xfe3bc5=_0xfe3bc5-0x0;var _0x46686a=_0x3904[_0xfe3bc5];return _0x46686a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4390('0x0'));var BPromise=require(_0x4390('0x1'));var rs=require(_0x4390('0x2'));var fs=require('fs');var Redis=require(_0x4390('0x3'));var db=require(_0x4390('0x4'))['db'];var utils=require(_0x4390('0x5'));var logger=require(_0x4390('0x6'))(_0x4390('0x7'));var config=require(_0x4390('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4390('0x9')][_0x4390('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4063e7,_0x44ff13,_0xe269f2){return new BPromise(function(_0x2fcf41,_0xab5d97){return client[_0x4390('0xb')](_0x4063e7,_0xe269f2)[_0x4390('0xc')](function(_0x4456aa){logger[_0x4390('0xd')](_0x4390('0xe'),_0x44ff13,_0x4390('0xf'));logger[_0x4390('0x10')](_0x4390('0x11'),_0x44ff13,_0x4390('0xf'),JSON['stringify'](_0x4456aa));if(_0x4456aa['error']){if(_0x4456aa[_0x4390('0x12')]['code']===0x1f4){logger[_0x4390('0x12')](_0x4390('0xe'),_0x44ff13,_0x4456aa[_0x4390('0x12')][_0x4390('0x13')]);return _0xab5d97(_0x4456aa['error'][_0x4390('0x13')]);}logger[_0x4390('0x12')](_0x4390('0xe'),_0x44ff13,_0x4456aa['error']['message']);return _0x2fcf41(_0x4456aa[_0x4390('0x12')][_0x4390('0x13')]);}else{logger[_0x4390('0xd')](_0x4390('0xe'),_0x44ff13,_0x4390('0xf'));_0x2fcf41(_0x4456aa[_0x4390('0x14')][_0x4390('0x13')]);}})[_0x4390('0x15')](function(_0x552e97){logger[_0x4390('0x12')](_0x4390('0xe'),_0x44ff13,_0x552e97);_0xab5d97(_0x552e97);});});} \ No newline at end of file +var _0x5f98=['debug','error','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x100354,_0x2db2c8){var _0x2c9cbb=function(_0x18783a){while(--_0x18783a){_0x100354['push'](_0x100354['shift']());}};_0x2c9cbb(++_0x2db2c8);}(_0x5f98,0x1ad));var _0x85f9=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x5f98[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require(_0x85f9('0x0'));var moment=require(_0x85f9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85f9('0x2'));var db=require(_0x85f9('0x3'))['db'];var utils=require(_0x85f9('0x4'));var logger=require('../../config/logger')(_0x85f9('0x5'));var config=require('../../config/environment');var jayson=require(_0x85f9('0x6'));var client=jayson[_0x85f9('0x7')][_0x85f9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5705ed,_0x4ba227,_0x3984bd){return new BPromise(function(_0x437c64,_0x41158d){return client['request'](_0x5705ed,_0x3984bd)[_0x85f9('0x9')](function(_0x199144){logger[_0x85f9('0xa')](_0x85f9('0xb'),_0x4ba227,_0x85f9('0xc'));logger[_0x85f9('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4ba227,_0x85f9('0xc'),JSON['stringify'](_0x199144));if(_0x199144['error']){if(_0x199144['error']['code']===0x1f4){logger[_0x85f9('0xe')](_0x85f9('0xb'),_0x4ba227,_0x199144[_0x85f9('0xe')][_0x85f9('0xf')]);return _0x41158d(_0x199144[_0x85f9('0xe')][_0x85f9('0xf')]);}logger['error'](_0x85f9('0xb'),_0x4ba227,_0x199144[_0x85f9('0xe')][_0x85f9('0xf')]);return _0x437c64(_0x199144[_0x85f9('0xe')]['message']);}else{logger[_0x85f9('0xa')]('Schedule,\x20%s,\x20%s',_0x4ba227,_0x85f9('0xc'));_0x437c64(_0x199144[_0x85f9('0x10')][_0x85f9('0xf')]);}})['catch'](function(_0x4a75d9){logger[_0x85f9('0xe')](_0x85f9('0xb'),_0x4ba227,_0x4a75d9);_0x41158d(_0x4a75d9);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ce7e17d..0eede4f 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 _0xaacd=['show','/:id/download','download','post','put','delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xaacd,0x16b));var _0xdaac=function(_0xb52ec4,_0x594a54){_0xb52ec4=_0xb52ec4-0x0;var _0xea5904=_0xaacd[_0xb52ec4];return _0xea5904;};'use strict';var multer=require(_0xdaac('0x0'));var util=require(_0xdaac('0x1'));var path=require('path');var timeout=require(_0xdaac('0x2'));var express=require(_0xdaac('0x3'));var router=express['Router']();var fs_extra=require(_0xdaac('0x4'));var auth=require(_0xdaac('0x5'));var interaction=require(_0xdaac('0x6'));var config=require(_0xdaac('0x7'));var controller=require('./screenRecording.controller');router[_0xdaac('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdaac('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdaac('0x8')](_0xdaac('0xa'),auth['isAuthenticated'](),controller[_0xdaac('0xb')]);router['get'](_0xdaac('0xc'),auth['isAuthenticated'](),controller[_0xdaac('0xd')]);router[_0xdaac('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdaac('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdaac('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8437=['/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','download','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8437,0x149));var _0x7843=function(_0x54eba4,_0x37b14c){_0x54eba4=_0x54eba4-0x0;var _0x2f8558=_0x8437[_0x54eba4];return _0x2f8558;};'use strict';var multer=require(_0x7843('0x0'));var util=require(_0x7843('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7843('0x2'));var router=express[_0x7843('0x3')]();var fs_extra=require(_0x7843('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7843('0x5'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x7843('0x6')]('/',auth[_0x7843('0x7')](),controller['index']);router['get'](_0x7843('0x8'),auth['isAuthenticated'](),controller[_0x7843('0x9')]);router[_0x7843('0x6')]('/:id',auth[_0x7843('0x7')](),controller['show']);router[_0x7843('0x6')]('/:id/download',auth[_0x7843('0x7')](),controller[_0x7843('0xa')]);router['post']('/',auth[_0x7843('0x7')](),controller[_0x7843('0xb')]);router[_0x7843('0xc')](_0x7843('0xd'),auth['isAuthenticated'](),controller[_0x7843('0xe')]);router[_0x7843('0xf')](_0x7843('0xd'),auth[_0x7843('0x7')](),controller[_0x7843('0x10')]);module[_0x7843('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e8317df..4baf754 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 _0x70e3=['getDataValue','value','STRING','INTEGER','setDataValue','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL'];(function(_0x403409,_0xbc31b){var _0x11d9f7=function(_0x2bac6d){while(--_0x2bac6d){_0x403409['push'](_0x403409['shift']());}};_0x11d9f7(++_0xbc31b);}(_0x70e3,0x9d));var _0x370e=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x70e3[_0x1d5400];return _0x21d9fe;};'use strict';var Sequelize=require(_0x370e('0x0'));var moment=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var config=require(_0x370e('0x3'));module['exports']={'format':{'type':Sequelize[_0x370e('0x4')],'get':function(){return this[_0x370e('0x5')](_0x370e('0x6'))?path['extname'](this[_0x370e('0x5')](_0x370e('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x370e('0x7')]},'channel':{'type':Sequelize[_0x370e('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3a2aaf){var _0x5f57ea=_0x3a2aaf['replace'](/\\/g,'/');this['setDataValue'](_0x370e('0x6'),_0x5f57ea);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x370e('0x8')],'set':function(_0x52d611){this[_0x370e('0x9')](_0x370e('0xa'),moment()['subtract'](_0x52d611,'ms'));this['setDataValue'](_0x370e('0xb'),moment());this[_0x370e('0x9')](_0x370e('0xc'),_0x52d611);}},'startedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')]('startedAt'))[_0x370e('0xe')](_0x370e('0xf'))[_0x370e('0x10')]();}},'closedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')](_0x370e('0xb')))[_0x370e('0xe')](_0x370e('0xf'))[_0x370e('0x10')]();}},'createdAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x370e('0x10')]();}},'updatedAt':{'type':Sequelize[_0x370e('0xd')],'get':function(){return moment(this[_0x370e('0x5')](_0x370e('0x11')))[_0x370e('0xe')](_0x370e('0xf'))['toString']();}}}; \ No newline at end of file +var _0x8a9a=['DATE','closedAt','createdAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x5697f0,_0x17f0bd){var _0x4eb826=function(_0x3448ec){while(--_0x3448ec){_0x5697f0['push'](_0x5697f0['shift']());}};_0x4eb826(++_0x17f0bd);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8a9a[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa8a9('0x0'));var path=require(_0xa8a9('0x1'));var config=require(_0xa8a9('0x2'));module[_0xa8a9('0x3')]={'format':{'type':Sequelize[_0xa8a9('0x4')],'get':function(){return this[_0xa8a9('0x5')](_0xa8a9('0x6'))?path[_0xa8a9('0x7')](this[_0xa8a9('0x5')](_0xa8a9('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa8a9('0x8')]},'channel':{'type':Sequelize[_0xa8a9('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x24a2bc){var _0x4a091d=_0x24a2bc[_0xa8a9('0x9')](/\\/g,'/');this[_0xa8a9('0xa')](_0xa8a9('0x6'),_0x4a091d);}},'rating':{'type':Sequelize[_0xa8a9('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa8a9('0xb')],'set':function(_0x4ebe24){this[_0xa8a9('0xa')](_0xa8a9('0xc'),moment()['subtract'](_0x4ebe24,'ms'));this[_0xa8a9('0xa')]('closedAt',moment());this[_0xa8a9('0xa')](_0xa8a9('0xd'),_0x4ebe24);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa8a9('0x5')](_0xa8a9('0xc')))[_0xa8a9('0xe')](_0xa8a9('0xf'))[_0xa8a9('0x10')]();}},'closedAt':{'type':Sequelize[_0xa8a9('0x11')],'get':function(){return moment(this['getDataValue'](_0xa8a9('0x12')))[_0xa8a9('0xe')](_0xa8a9('0xf'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa8a9('0x5')](_0xa8a9('0x13')))[_0xa8a9('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xa8a9('0x10')]();}},'updatedAt':{'type':Sequelize[_0xa8a9('0x11')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xa8a9('0xe')](_0xa8a9('0xf'))[_0xa8a9('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index d3ce103..63ca809 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(_0x1c1928,_0x509bbd){var _0x5cc52f=function(_0x165024){while(--_0x165024){_0x1c1928['push'](_0x1c1928['shift']());}};_0x5cc52f(++_0x509bbd);}(_0x207c,0x1e8));var _0xc207=function(_0x1a4748,_0x40c46e){_0x1a4748=_0x1a4748-0x0;var _0x28ca99=_0x207c[_0x1a4748];return _0x28ca99;};'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 _0xabce=['sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','include','rows','includeAll','find','catch','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','recording','join','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x2851f2,_0x3d6113){var _0x4984db=function(_0x5c354f){while(--_0x5c354f){_0x2851f2['push'](_0x2851f2['shift']());}};_0x4984db(++_0x3d6113);}(_0xabce,0x103));var _0xeabc=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xabce[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}exports[_0xeabc('0x2a')]=function(_0x48fb52,_0x2163e6){var _0x38572d={},_0x2b568f={},_0x2f8633={'count':0x0,'rows':[]};var _0x149170=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')],function(_0x2915c1){return{'name':_0x2915c1['fieldName'],'type':_0x2915c1[_0xeabc('0x2e')]['key']};});_0x2b568f[_0xeabc('0x2f')]=_[_0xeabc('0x30')](_[_0xeabc('0x2b')](_0x149170,_0xeabc('0x28')),[_0xeabc('0x31')]);_0x2b568f[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x48fb52['query']);_0x2b568f[_0xeabc('0x34')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],_0x2b568f['query']);_0x38572d[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],qs['fields'](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x37')]));_0x38572d[_0xeabc('0x36')]=_0x38572d['attributes'][_0xeabc('0x38')]?_0x38572d[_0xeabc('0x36')]:_0x2b568f['model'];if(!_0x48fb52['query'][_0xeabc('0x39')](_0xeabc('0x3a'))){_0x38572d['limit']=qs[_0xeabc('0x1d')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x1d')]);_0x38572d[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x48fb52['query'][_0xeabc('0x1f')]);}_0x38572d['order']=qs[_0xeabc('0x3b')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x3b')]);_0x38572d['where']=qs['filters'](_[_0xeabc('0x3c')](_0x48fb52['query'],_0x2b568f[_0xeabc('0x34')]),_0x149170);if(_0x48fb52['query']['filter']){_0x38572d['where']=_['merge'](_0x38572d[_0xeabc('0x3d')],{'$or':_['map'](_0x149170,function(_0x257fe8){if(_0x257fe8[_0xeabc('0x2e')]!=='VIRTUAL'){var _0xe8fa6e={};_0xe8fa6e[_0x257fe8['name']]={'$like':'%'+_0x48fb52[_0xeabc('0x32')]['filter']+'%'};return _0xe8fa6e;}})});}_0x38572d=_[_0xeabc('0x3e')]({},_0x38572d,_0x48fb52[_0xeabc('0x3f')]);var _0xeeef02={'where':_0x38572d['where']};return db['ScreenRecording']['count'](_0xeeef02)[_0xeabc('0x25')](function(_0x23fb33){_0x2f8633[_0xeabc('0x1e')]=_0x23fb33;if(_0x48fb52['query']['includeAll']){_0x38572d[_0xeabc('0x40')]=[{'all':!![]}];}return db[_0xeabc('0x2c')]['findAll'](_0x38572d);})[_0xeabc('0x25')](function(_0x5e0b78){_0x2f8633[_0xeabc('0x41')]=_0x5e0b78;return _0x2f8633;})['then'](respondWithFilteredResult(_0x2163e6,_0x38572d))['catch'](handleError(_0x2163e6,null));};exports['show']=function(_0x25958b,_0x37c926){var _0xd03226={'raw':![],'where':{'id':_0x25958b['params']['id']}},_0x3eeeb5={};_0x3eeeb5[_0xeabc('0x2f')]=_['keys'](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x3eeeb5[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x25958b[_0xeabc('0x32')]);_0x3eeeb5['filters']=_['intersection'](_0x3eeeb5[_0xeabc('0x2f')],_0x3eeeb5['query']);_0xd03226[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x3eeeb5['model'],qs[_0xeabc('0x37')](_0x25958b[_0xeabc('0x32')][_0xeabc('0x37')]));_0xd03226[_0xeabc('0x36')]=_0xd03226[_0xeabc('0x36')][_0xeabc('0x38')]?_0xd03226[_0xeabc('0x36')]:_0x3eeeb5['model'];if(_0x25958b[_0xeabc('0x32')][_0xeabc('0x42')]){_0xd03226[_0xeabc('0x40')]=[{'all':!![]}];}_0xd03226=_[_0xeabc('0x3e')]({},_0xd03226,_0x25958b[_0xeabc('0x3f')]);return db[_0xeabc('0x2c')][_0xeabc('0x43')](_0xd03226)[_0xeabc('0x25')](handleEntityNotFound(_0x37c926,null))[_0xeabc('0x25')](respondWithResult(_0x37c926,null))[_0xeabc('0x44')](handleError(_0x37c926,null));};exports['create']=function(_0x38356c,_0x2e6efb){return db[_0xeabc('0x2c')][_0xeabc('0x45')](_0x38356c[_0xeabc('0x46')],{})[_0xeabc('0x25')](respondWithResult(_0x2e6efb,0xc9))[_0xeabc('0x44')](handleError(_0x2e6efb,null));};exports['update']=function(_0x766743,_0x32e09b){if(_0x766743[_0xeabc('0x46')]['id']){delete _0x766743[_0xeabc('0x46')]['id'];}delete _0x766743[_0xeabc('0x46')]['duration'];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x47')];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x48')];delete _0x766743['body'][_0xeabc('0x49')];return db[_0xeabc('0x2c')]['find']({'where':{'id':_0x766743[_0xeabc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32e09b,null))[_0xeabc('0x25')](saveUpdates(_0x766743['body'],null))[_0xeabc('0x25')](respondWithResult(_0x32e09b,null))[_0xeabc('0x44')](handleError(_0x32e09b,null));};exports[_0xeabc('0x4b')]=function(_0x1524c3,_0x1ee837){return db[_0xeabc('0x2c')][_0xeabc('0x4b')]()[_0xeabc('0x25')](respondWithResult(_0x1ee837,null))[_0xeabc('0x44')](handleError(_0x1ee837,null));};exports[_0xeabc('0x4c')]=function(_0x48a13f,_0x180a14,_0x2537ab){var _0x4072cb=require(_0xeabc('0x4d'));var _0x555d6b=![];var _0x1cef45={};if(_0x48a13f[_0xeabc('0x32')][_0xeabc('0x2e')]&&_0x48a13f[_0xeabc('0x32')]['type']===_0xeabc('0x4e')){_0x1cef45[_0xeabc('0x4e')]=_0x48a13f[_0xeabc('0x4a')]['id'];}else{_0x1cef45['id']=_0x48a13f[_0xeabc('0x4a')]['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':_0x1cef45,'attributes':['id',_0xeabc('0x49')],'raw':!![]})[_0xeabc('0x25')](handleEntityNotFound(_0x180a14,null))[_0xeabc('0x25')](function(_0x58ab08){if(_0x58ab08){var _0x4546c4=path['join'](config['root'],'server/files/screen_recordings',_0x58ab08[_0xeabc('0x49')]);var _0x8d4cca=util[_0xeabc('0x31')](_0xeabc('0x4f'),_0x4546c4);if(fs[_0xeabc('0x50')](_0x8d4cca)){_0x555d6b=!![];return _0x4072cb[_0xeabc('0x51')](_0x8d4cca,_0x4546c4,config['secrets'][_0xeabc('0x52')])[_0xeabc('0x25')](function(){return _0x58ab08;});}return _0x58ab08;}})[_0xeabc('0x25')](function(_0x104c1e){if(_0x104c1e){var _0x2ddc53=path[_0xeabc('0x53')](config[_0xeabc('0x54')],_0xeabc('0x55'),_0x104c1e['value']);if(!fs['existsSync'](_0x2ddc53)){throw new db[(_0xeabc('0x56'))][(_0xeabc('0x57'))](_0xeabc('0x58'));}if(_0x104c1e['filename']){return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,_0x104c1e['filename']+path['extname'](_0x2ddc53),function(){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}else{return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,function(_0x13f04f){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}}})[_0xeabc('0x44')](function(_0xc2ef0c){if(_0xc2ef0c['message']===_0xeabc('0x58')){_0x180a14[_0xeabc('0x1a')](0x194)[_0xeabc('0x29')](_0xeabc('0x5a'));}else{return handleError(_0x180a14,null);}});};exports[_0xeabc('0x5b')]=function(_0x514787,_0x5c61b4){return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':{'id':_0x514787[_0xeabc('0x4a')]['id']}})[_0xeabc('0x25')](function(_0x1b61a8){if(_[_0xeabc('0x5c')](_0x1b61a8)){throw new ReferenceError(_0xeabc('0x5d'));}return _0x1b61a8;})[_0xeabc('0x25')](function(_0x3f829b){var _0x54d2b3=path[_0xeabc('0x53')](config['root'],_0xeabc('0x55'),_0x3f829b[_0xeabc('0x49')]);logger[_0xeabc('0x5e')](_0xeabc('0x5f'),_0x54d2b3);if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger[_0xeabc('0x5e')](_0xeabc('0x60')+_0x54d2b3+_0xeabc('0x61'));fs['unlinkSync'](_0x54d2b3);}_0x54d2b3=_0x54d2b3+_0xeabc('0x62');if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger['info'](_0xeabc('0x60')+_0x54d2b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54d2b3);}return _0x3f829b;})[_0xeabc('0x25')](function(_0x11bc62){if(!_0x11bc62)throw new InternalError();return _0x11bc62[_0xeabc('0x5b')]();})[_0xeabc('0x25')](function(){_0x5c61b4['status'](0xcc)['end']();})[_0xeabc('0x44')](handleError(_0x5c61b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b70b5af..df2e849 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 _0x3236=['exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes'];(function(_0x13f963,_0xaf1dd9){var _0xc76084=function(_0x33a66b){while(--_0x33a66b){_0x13f963['push'](_0x13f963['shift']());}};_0xc76084(++_0xaf1dd9);}(_0x3236,0x18c));var _0x6323=function(_0x3dc663,_0x4f4bd3){_0x3dc663=_0x3dc663-0x0;var _0x21d66e=_0x3236[_0x3dc663];return _0x21d66e;};'use strict';var _=require(_0x6323('0x0'));var util=require(_0x6323('0x1'));var logger=require(_0x6323('0x2'))(_0x6323('0x3'));var moment=require(_0x6323('0x4'));var BPromise=require(_0x6323('0x5'));var rp=require(_0x6323('0x6'));var fs=require('fs');var path=require(_0x6323('0x7'));var rimraf=require('rimraf');var config=require(_0x6323('0x8'));var attributes=require(_0x6323('0x9'));module[_0x6323('0xa')]=function(_0x2b5c92,_0xeb70c7){return _0x2b5c92[_0x6323('0xb')](_0x6323('0xc'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x6323('0xd'),'fields':[_0x6323('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f4e=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','./screenRecording.attributes'];(function(_0x56a0ea,_0x513e71){var _0x49dde5=function(_0x485b43){while(--_0x485b43){_0x56a0ea['push'](_0x56a0ea['shift']());}};_0x49dde5(++_0x513e71);}(_0x7f4e,0xbb));var _0xe7f4=function(_0x429252,_0x48f3b3){_0x429252=_0x429252-0x0;var _0x4750d6=_0x7f4e[_0x429252];return _0x4750d6;};'use strict';var _=require(_0xe7f4('0x0'));var util=require(_0xe7f4('0x1'));var logger=require(_0xe7f4('0x2'))(_0xe7f4('0x3'));var moment=require(_0xe7f4('0x4'));var BPromise=require(_0xe7f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7f4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe7f4('0x7'));module[_0xe7f4('0x8')]=function(_0xb9b9e5,_0xa3d8a7){return _0xb9b9e5[_0xe7f4('0x9')](_0xe7f4('0xa'),attributes,{'tableName':_0xe7f4('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xe7f4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index bbc975b..74251a4 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 _0x0df9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','moment','bluebird','randomstring'];(function(_0x5472f3,_0x230667){var _0x11ff74=function(_0xd068b5){while(--_0xd068b5){_0x5472f3['push'](_0x5472f3['shift']());}};_0x11ff74(++_0x230667);}(_0x0df9,0xc2));var _0x90df=function(_0x43c060,_0xc42eb){_0x43c060=_0x43c060-0x0;var _0x2530e5=_0x0df9[_0x43c060];return _0x2530e5;};'use strict';var _=require(_0x90df('0x0'));var util=require('util');var moment=require(_0x90df('0x1'));var BPromise=require(_0x90df('0x2'));var rs=require(_0x90df('0x3'));var fs=require('fs');var Redis=require(_0x90df('0x4'));var db=require(_0x90df('0x5'))['db'];var utils=require(_0x90df('0x6'));var logger=require(_0x90df('0x7'))('rpc');var config=require(_0x90df('0x8'));var jayson=require(_0x90df('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3817e4,_0x42b9bd,_0x463dfb){return new BPromise(function(_0x9d1e1d,_0xcb294f){return client[_0x90df('0xa')](_0x3817e4,_0x463dfb)['then'](function(_0x579b4e){logger[_0x90df('0xb')](_0x90df('0xc'),_0x42b9bd,_0x90df('0xd'));logger[_0x90df('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x42b9bd,_0x90df('0xd'),JSON['stringify'](_0x579b4e));if(_0x579b4e[_0x90df('0xf')]){if(_0x579b4e[_0x90df('0xf')]['code']===0x1f4){logger[_0x90df('0xf')](_0x90df('0xc'),_0x42b9bd,_0x579b4e['error'][_0x90df('0x10')]);return _0xcb294f(_0x579b4e[_0x90df('0xf')][_0x90df('0x10')]);}logger[_0x90df('0xf')](_0x90df('0xc'),_0x42b9bd,_0x579b4e[_0x90df('0xf')]['message']);return _0x9d1e1d(_0x579b4e[_0x90df('0xf')][_0x90df('0x10')]);}else{logger[_0x90df('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x42b9bd,_0x90df('0xd'));_0x9d1e1d(_0x579b4e[_0x90df('0x11')]['message']);}})['catch'](function(_0x4183e6){logger[_0x90df('0xf')](_0x90df('0xc'),_0x42b9bd,_0x4183e6);_0xcb294f(_0x4183e6);});});} \ No newline at end of file +var _0x7ce0=['request','then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x5b0122,_0x2126fa){var _0x34d2d2=function(_0x3f7baf){while(--_0x3f7baf){_0x5b0122['push'](_0x5b0122['shift']());}};_0x34d2d2(++_0x2126fa);}(_0x7ce0,0x140));var _0x07ce=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x7ce0[_0xd09668];return _0x68726;};'use strict';var _=require(_0x07ce('0x0'));var util=require(_0x07ce('0x1'));var moment=require('moment');var BPromise=require(_0x07ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07ce('0x3'));var db=require(_0x07ce('0x4'))['db'];var utils=require(_0x07ce('0x5'));var logger=require('../../config/logger')(_0x07ce('0x6'));var config=require(_0x07ce('0x7'));var jayson=require(_0x07ce('0x8'));var client=jayson['client'][_0x07ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x363f39,_0x52073c,_0x19e18d){return new BPromise(function(_0x7a41ac,_0x54219c){return client[_0x07ce('0xa')](_0x363f39,_0x19e18d)[_0x07ce('0xb')](function(_0x43f78f){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x52073c,_0x07ce('0xc'));logger[_0x07ce('0xd')](_0x07ce('0xe'),_0x52073c,_0x07ce('0xc'),JSON[_0x07ce('0xf')](_0x43f78f));if(_0x43f78f['error']){if(_0x43f78f[_0x07ce('0x10')][_0x07ce('0x11')]===0x1f4){logger[_0x07ce('0x10')](_0x07ce('0x12'),_0x52073c,_0x43f78f['error'][_0x07ce('0x13')]);return _0x54219c(_0x43f78f[_0x07ce('0x10')][_0x07ce('0x13')]);}logger['error'](_0x07ce('0x12'),_0x52073c,_0x43f78f[_0x07ce('0x10')][_0x07ce('0x13')]);return _0x7a41ac(_0x43f78f[_0x07ce('0x10')][_0x07ce('0x13')]);}else{logger[_0x07ce('0x14')](_0x07ce('0x12'),_0x52073c,_0x07ce('0xc'));_0x7a41ac(_0x43f78f[_0x07ce('0x15')][_0x07ce('0x13')]);}})['catch'](function(_0x6ab4ca){logger[_0x07ce('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x52073c,_0x6ab4ca);_0x54219c(_0x6ab4ca);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9b1eb7d..a336b84 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 _0x6f8b=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','logologin','format','addPreferred','favicon','addFavicon','put','isAuthenticated','update','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','index','get','/now','getDate','/:id','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x24c43b,_0x488b3c){var _0x25f04b=function(_0x2b3737){while(--_0x2b3737){_0x24c43b['push'](_0x24c43b['shift']());}};_0x25f04b(++_0x488b3c);}(_0x6f8b,0x6b));var _0xb6f8=function(_0x5d7126,_0x5aaf7b){_0x5d7126=_0x5d7126-0x0;var _0x44f29b=_0x6f8b[_0x5d7126];return _0x44f29b;};'use strict';var multer=require('multer');var util=require(_0xb6f8('0x0'));var path=require(_0xb6f8('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6f8('0x2'));var router=express[_0xb6f8('0x3')]();var fs_extra=require(_0xb6f8('0x4'));var auth=require(_0xb6f8('0x5'));var interaction=require(_0xb6f8('0x6'));var config=require(_0xb6f8('0x7'));var controller=require(_0xb6f8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb6f8('0x9')]);router[_0xb6f8('0xa')](_0xb6f8('0xb'),controller[_0xb6f8('0xc')]);router['get'](_0xb6f8('0xd'),controller['show']);router[_0xb6f8('0xa')]('/:id/logo',controller[_0xb6f8('0xe')]);router[_0xb6f8('0xa')]('/:id/logo_login',controller['getLogoLogin']);router[_0xb6f8('0xa')](_0xb6f8('0xf'),controller[_0xb6f8('0x10')]);router[_0xb6f8('0xa')](_0xb6f8('0x11'),controller[_0xb6f8('0x12')]);router[_0xb6f8('0xa')](_0xb6f8('0x13'),controller[_0xb6f8('0x14')]);var upload=multer({'storage':multer[_0xb6f8('0x15')]({'destination':function(_0x28fb25,_0x463383,_0x1038a6){_0x1038a6(null,path[_0xb6f8('0x16')](config[_0xb6f8('0x17')],_0xb6f8('0x18')));},'filename':function(_0x318aff,_0x4fcd54,_0x67e653){_0x67e653(null,util['format'](_0xb6f8('0x19'),_0xb6f8('0x1a'),path[_0xb6f8('0x1b')](_0x4fcd54[_0xb6f8('0x1c')])));}})});router[_0xb6f8('0x1d')](_0xb6f8('0x1e'),upload[_0xb6f8('0x1f')](_0xb6f8('0x20')),controller[_0xb6f8('0x21')]);var upload=multer({'storage':multer[_0xb6f8('0x15')]({'destination':function(_0x4f5cc3,_0x4287b1,_0x5ac448){_0x5ac448(null,path[_0xb6f8('0x16')](config[_0xb6f8('0x17')],_0xb6f8('0x18')));},'filename':function(_0x27ae75,_0x44653e,_0x4bd05f){_0x4bd05f(null,util['format']('%s%s',_0xb6f8('0x22'),path[_0xb6f8('0x1b')](_0x44653e['originalname'])));}})});router[_0xb6f8('0x1d')]('/:id/logo_login',upload['single'](_0xb6f8('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xb6f8('0x15')]({'destination':function(_0x10b638,_0x14b11e,_0x59c7ef){_0x59c7ef(null,path[_0xb6f8('0x16')](config['root'],_0xb6f8('0x18')));},'filename':function(_0x4d465a,_0x59f88c,_0x342d19){_0x342d19(null,util[_0xb6f8('0x23')](_0xb6f8('0x19'),'preferred',path[_0xb6f8('0x1b')](_0x59f88c['originalname'])));}})});router[_0xb6f8('0x1d')](_0xb6f8('0x11'),upload[_0xb6f8('0x1f')](_0xb6f8('0x20')),controller[_0xb6f8('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17784c,_0x154b79,_0x35d8a7){_0x35d8a7(null,path[_0xb6f8('0x16')](config[_0xb6f8('0x17')],_0xb6f8('0x18')));},'filename':function(_0x4731cf,_0x1f60f7,_0x2f4683){_0x2f4683(null,util[_0xb6f8('0x23')]('%s%s',_0xb6f8('0x25'),path['extname'](_0x1f60f7['originalname'])));}})});router[_0xb6f8('0x1d')](_0xb6f8('0x13'),upload[_0xb6f8('0x1f')](_0xb6f8('0x20')),controller[_0xb6f8('0x26')]);router[_0xb6f8('0x27')](_0xb6f8('0xd'),auth[_0xb6f8('0x28')](),controller[_0xb6f8('0x29')]);module['exports']=router; \ No newline at end of file +var _0xf414=['single','file','addLogo','join','%s%s','logologin','addLogoLogin','extname','favicon','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','originalname','post'];(function(_0x1556b8,_0x2b55c3){var _0x307d45=function(_0x24afc6){while(--_0x24afc6){_0x1556b8['push'](_0x1556b8['shift']());}};_0x307d45(++_0x2b55c3);}(_0xf414,0x1e4));var _0x4f41=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0xf414[_0xb3b452];return _0x238983;};'use strict';var multer=require(_0x4f41('0x0'));var util=require(_0x4f41('0x1'));var path=require(_0x4f41('0x2'));var timeout=require(_0x4f41('0x3'));var express=require(_0x4f41('0x4'));var router=express[_0x4f41('0x5')]();var fs_extra=require(_0x4f41('0x6'));var auth=require(_0x4f41('0x7'));var interaction=require(_0x4f41('0x8'));var config=require('../../config/environment');var controller=require(_0x4f41('0x9'));router['get']('/',auth[_0x4f41('0xa')](),controller[_0x4f41('0xb')]);router[_0x4f41('0xc')](_0x4f41('0xd'),controller[_0x4f41('0xe')]);router[_0x4f41('0xc')](_0x4f41('0xf'),controller[_0x4f41('0x10')]);router[_0x4f41('0xc')](_0x4f41('0x11'),controller['getLogo']);router[_0x4f41('0xc')](_0x4f41('0x12'),controller[_0x4f41('0x13')]);router[_0x4f41('0xc')](_0x4f41('0x14'),controller['gdpr']);router[_0x4f41('0xc')](_0x4f41('0x15'),controller[_0x4f41('0x16')]);router['get'](_0x4f41('0x17'),controller[_0x4f41('0x18')]);var upload=multer({'storage':multer[_0x4f41('0x19')]({'destination':function(_0x4faaa1,_0x421bbe,_0x1cc389){_0x1cc389(null,path['join'](config[_0x4f41('0x1a')],_0x4f41('0x1b')));},'filename':function(_0x4e7ffc,_0x14d8dd,_0x13d65b){_0x13d65b(null,util[_0x4f41('0x1c')]('%s%s',_0x4f41('0x1d'),path['extname'](_0x14d8dd[_0x4f41('0x1e')])));}})});router[_0x4f41('0x1f')](_0x4f41('0x11'),upload[_0x4f41('0x20')](_0x4f41('0x21')),controller[_0x4f41('0x22')]);var upload=multer({'storage':multer[_0x4f41('0x19')]({'destination':function(_0x4c2894,_0x1fcf1c,_0x4813d9){_0x4813d9(null,path[_0x4f41('0x23')](config[_0x4f41('0x1a')],_0x4f41('0x1b')));},'filename':function(_0x4fab17,_0x3dbed9,_0xa862da){_0xa862da(null,util[_0x4f41('0x1c')](_0x4f41('0x24'),_0x4f41('0x25'),path['extname'](_0x3dbed9[_0x4f41('0x1e')])));}})});router[_0x4f41('0x1f')](_0x4f41('0x12'),upload[_0x4f41('0x20')](_0x4f41('0x21')),controller[_0x4f41('0x26')]);var upload=multer({'storage':multer[_0x4f41('0x19')]({'destination':function(_0x47daec,_0x313f91,_0x514f31){_0x514f31(null,path[_0x4f41('0x23')](config[_0x4f41('0x1a')],_0x4f41('0x1b')));},'filename':function(_0x1d29c8,_0x13a72e,_0x57c2ff){_0x57c2ff(null,util[_0x4f41('0x1c')](_0x4f41('0x24'),'preferred',path[_0x4f41('0x27')](_0x13a72e[_0x4f41('0x1e')])));}})});router['post'](_0x4f41('0x15'),upload['single'](_0x4f41('0x21')),controller['addPreferred']);var upload=multer({'storage':multer[_0x4f41('0x19')]({'destination':function(_0x5919b5,_0x426bdb,_0x3fba7a){_0x3fba7a(null,path[_0x4f41('0x23')](config[_0x4f41('0x1a')],_0x4f41('0x1b')));},'filename':function(_0x30aac5,_0x2baebe,_0x20347d){_0x20347d(null,util[_0x4f41('0x1c')]('%s%s',_0x4f41('0x28'),path[_0x4f41('0x27')](_0x2baebe[_0x4f41('0x1e')])));}})});router['post']('/:id/favicon',upload[_0x4f41('0x20')](_0x4f41('0x21')),controller['addFavicon']);router['put'](_0x4f41('0xf'),auth[_0x4f41('0xa')](),controller[_0x4f41('0x29')]);module[_0x4f41('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 3faa577..ec27a33 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x262024,_0xa24931){var _0x401b5e=function(_0x3b6680){while(--_0x3b6680){_0x262024['push'](_0x262024['shift']());}};_0x401b5e(++_0xa24931);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x351c6f,_0x1f4d88){var _0x2bac53=function(_0x2197d1){while(--_0x2197d1){_0x351c6f['push'](_0x351c6f['shift']());}};_0x2bac53(++_0x1f4d88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0653ea7..e8246e8 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 _0x1d5c=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','update','then','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','intersection','include','find','body','file','filename','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','defaultPreferred','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox'];(function(_0x46b3c2,_0x141c53){var _0x3f4d7c=function(_0x2c05a8){while(--_0x2c05a8){_0x46b3c2['push'](_0x46b3c2['shift']());}};_0x3f4d7c(++_0x141c53);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x500211,_0x1a0367){_0x500211=_0x500211-0x0;var _0x48f4e0=_0x1d5c[_0x500211];return _0x48f4e0;};'use strict';var emlformat=require(_0xc1d5('0x0'));var rimraf=require(_0xc1d5('0x1'));var zipdir=require(_0xc1d5('0x2'));var jsonpatch=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1d5('0x5'));var path=require('path');var sox=require(_0xc1d5('0x6'));var csv=require(_0xc1d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d5('0x8'));var _=require(_0xc1d5('0x9'));var squel=require(_0xc1d5('0xa'));var crypto=require(_0xc1d5('0xb'));var jsforce=require(_0xc1d5('0xc'));var deskjs=require(_0xc1d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1d5('0xe'));var Papa=require(_0xc1d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1d5('0x10'));var as=require(_0xc1d5('0x11'));var hardwareService=require(_0xc1d5('0x12'));var logger=require(_0xc1d5('0x13'))(_0xc1d5('0x14'));var utils=require(_0xc1d5('0x15'));var config=require(_0xc1d5('0x16'));var licenseUtil=require(_0xc1d5('0x17'));var db=require(_0xc1d5('0x18'))['db'];var jayson=require(_0xc1d5('0x19'));var client=jayson['client'][_0xc1d5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2d20e7,_0x5b6b63,_0x5d70fc,_0x4a2281){return new BPromise(function(_0x51d0ae,_0x8f9117){var _0x4dcb1d=_0x4a2281||client;return _0x4dcb1d['request'](_0x2d20e7,_0x5d70fc)['then'](function(_0x425eeb){logger[_0xc1d5('0x1b')](_0xc1d5('0x1c'),_0x5b6b63,_0xc1d5('0x1d'));logger[_0xc1d5('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x5b6b63,'request\x20sent',JSON[_0xc1d5('0x1f')](_0x425eeb));if(_0x425eeb[_0xc1d5('0x20')]){if(_0x425eeb[_0xc1d5('0x20')][_0xc1d5('0x21')]===0x1f4){logger['error'](_0xc1d5('0x1c'),_0x5b6b63,_0x425eeb['error'][_0xc1d5('0x22')]);return _0x8f9117(_0x425eeb['error'][_0xc1d5('0x22')]);}logger[_0xc1d5('0x20')](_0xc1d5('0x1c'),_0x5b6b63,_0x425eeb[_0xc1d5('0x20')]['message']);return _0x51d0ae(_0x425eeb['error'][_0xc1d5('0x22')]);}else{logger[_0xc1d5('0x1b')](_0xc1d5('0x1c'),_0x5b6b63,_0xc1d5('0x1d'));_0x51d0ae(_0x425eeb[_0xc1d5('0x23')]['message']);}})[_0xc1d5('0x24')](function(_0x644502){logger[_0xc1d5('0x20')]('Setting,\x20%s,\x20%s',_0x5b6b63,_0x644502);_0x8f9117(_0x644502);});});}function respondWithStatusCode(_0x495121,_0x216b26){_0x216b26=_0x216b26||0xcc;return function(_0x836a41){if(_0x836a41){return _0x495121['sendStatus'](_0x216b26);}return _0x495121['status'](_0x216b26)[_0xc1d5('0x25')]();};}function respondWithResult(_0x566957,_0x58d65a){_0x58d65a=_0x58d65a||0xc8;return function(_0x13cc2e){if(_0x13cc2e){return _0x566957['status'](_0x58d65a)[_0xc1d5('0x26')](_0x13cc2e);}};}function respondWithFilteredResult(_0x3183e4,_0x179e32){return function(_0x98fe96){if(_0x98fe96){var _0x2418b4=typeof _0x179e32['offset']===_0xc1d5('0x27')&&typeof _0x179e32[_0xc1d5('0x28')]===_0xc1d5('0x27');var _0x522d56=_0x98fe96[_0xc1d5('0x29')];var _0x272113=_0x2418b4?0x0:_0x179e32[_0xc1d5('0x2a')];var _0xb31830=_0x2418b4?_0x98fe96['count']:_0x179e32[_0xc1d5('0x2a')]+_0x179e32[_0xc1d5('0x28')];var _0xcdb1b1;if(_0xb31830>=_0x522d56){_0xb31830=_0x522d56;_0xcdb1b1=0xc8;}else{_0xcdb1b1=0xce;}_0x3183e4[_0xc1d5('0x2b')](_0xcdb1b1);return _0x3183e4[_0xc1d5('0x2c')](_0xc1d5('0x2d'),_0x272113+'-'+_0xb31830+'/'+_0x522d56)[_0xc1d5('0x26')](_0x98fe96);}return null;};}function patchUpdates(_0x3aaa45){return function(_0x4ee244){try{jsonpatch[_0xc1d5('0x2e')](_0x4ee244,_0x3aaa45,!![]);}catch(_0x5c159a){return BPromise['reject'](_0x5c159a);}return _0x4ee244['save']();};}function saveUpdates(_0x4ac338,_0xd22a28){return function(_0x546a1c){if(_0x546a1c){return _0x546a1c[_0xc1d5('0x2f')](_0x4ac338)[_0xc1d5('0x30')](function(_0x5f2375){return _0x5f2375;});}return null;};}function removeEntity(_0x26aec6,_0x180970){return function(_0x2db4c5){if(_0x2db4c5){return _0x2db4c5['destroy']()['then'](function(){_0x26aec6[_0xc1d5('0x2b')](0xcc)[_0xc1d5('0x25')]();});}};}function handleEntityNotFound(_0x506e18,_0x375b78){return function(_0x40194e){if(!_0x40194e){_0x506e18[_0xc1d5('0x31')](0x194);}return _0x40194e;};}function handleError(_0x208cce,_0x3b17e0){_0x3b17e0=_0x3b17e0||0x1f4;return function(_0x3eee2e){logger[_0xc1d5('0x20')](_0x3eee2e[_0xc1d5('0x32')]);if(_0x3eee2e[_0xc1d5('0x33')]){delete _0x3eee2e['name'];}_0x208cce[_0xc1d5('0x2b')](_0x3b17e0)['send'](_0x3eee2e);};}exports['index']=function(_0x40d3f3,_0x380e2c){var _0x1da3a1={},_0x517b1d={},_0x112f5c={'count':0x0,'rows':[]};var _0xf9988d=_[_0xc1d5('0x34')](db[_0xc1d5('0x35')][_0xc1d5('0x36')],function(_0x574282){return{'name':_0x574282[_0xc1d5('0x37')],'type':_0x574282[_0xc1d5('0x38')][_0xc1d5('0x39')]};});_0x517b1d[_0xc1d5('0x3a')]=_['map'](_0xf9988d,'name');_0x517b1d[_0xc1d5('0x3b')]=_[_0xc1d5('0x3c')](_0x40d3f3[_0xc1d5('0x3b')]);_0x517b1d['filters']=_['intersection'](_0x517b1d[_0xc1d5('0x3a')],_0x517b1d['query']);_0x1da3a1['attributes']=_['intersection'](_0x517b1d[_0xc1d5('0x3a')],qs[_0xc1d5('0x3d')](_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x3d')]));_0x1da3a1[_0xc1d5('0x3e')]=_0x1da3a1[_0xc1d5('0x3e')][_0xc1d5('0x3f')]?_0x1da3a1[_0xc1d5('0x3e')]:_0x517b1d[_0xc1d5('0x3a')];if(!_0x40d3f3[_0xc1d5('0x3b')]['hasOwnProperty'](_0xc1d5('0x40'))){_0x1da3a1[_0xc1d5('0x28')]=qs['limit'](_0x40d3f3['query'][_0xc1d5('0x28')]);_0x1da3a1[_0xc1d5('0x2a')]=qs[_0xc1d5('0x2a')](_0x40d3f3[_0xc1d5('0x3b')]['offset']);}_0x1da3a1[_0xc1d5('0x41')]=qs['sort'](_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x42')]);_0x1da3a1['where']=qs[_0xc1d5('0x43')](_['pick'](_0x40d3f3[_0xc1d5('0x3b')],_0x517b1d[_0xc1d5('0x43')]),_0xf9988d);if(_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x44')]){_0x1da3a1[_0xc1d5('0x45')]=_['merge'](_0x1da3a1[_0xc1d5('0x45')],{'$or':_[_0xc1d5('0x34')](_0xf9988d,function(_0x5ef2a7){if(_0x5ef2a7[_0xc1d5('0x38')]!==_0xc1d5('0x46')){var _0x14f909={};_0x14f909[_0x5ef2a7[_0xc1d5('0x33')]]={'$like':'%'+_0x40d3f3['query']['filter']+'%'};return _0x14f909;}})});}_0x1da3a1=_[_0xc1d5('0x47')]({},_0x1da3a1,_0x40d3f3[_0xc1d5('0x48')]);var _0x4aaf95={'where':_0x1da3a1[_0xc1d5('0x45')]};return db[_0xc1d5('0x35')][_0xc1d5('0x29')](_0x4aaf95)[_0xc1d5('0x30')](function(_0x4c3d4c){_0x112f5c[_0xc1d5('0x29')]=_0x4c3d4c;if(_0x40d3f3['query'][_0xc1d5('0x49')]){_0x1da3a1['include']=[{'all':!![]}];}return db[_0xc1d5('0x35')][_0xc1d5('0x4a')](_0x1da3a1);})[_0xc1d5('0x30')](function(_0x3e470b){_0x112f5c[_0xc1d5('0x4b')]=_0x3e470b;return _0x112f5c;})[_0xc1d5('0x30')](respondWithFilteredResult(_0x380e2c,_0x1da3a1))[_0xc1d5('0x24')](handleError(_0x380e2c,null));};exports[_0xc1d5('0x4c')]=function(_0x1155d8,_0x145169){var _0x37b0f0={'raw':![],'where':{'id':_0x1155d8['params']['id']}},_0x519bc2={};_0x519bc2[_0xc1d5('0x3a')]=_[_0xc1d5('0x3c')](db['Setting'][_0xc1d5('0x36')]);_0x519bc2[_0xc1d5('0x3b')]=_[_0xc1d5('0x3c')](_0x1155d8[_0xc1d5('0x3b')]);_0x519bc2[_0xc1d5('0x43')]=_[_0xc1d5('0x4d')](_0x519bc2[_0xc1d5('0x3a')],_0x519bc2[_0xc1d5('0x3b')]);_0x37b0f0['attributes']=_[_0xc1d5('0x4d')](_0x519bc2['model'],qs[_0xc1d5('0x3d')](_0x1155d8[_0xc1d5('0x3b')][_0xc1d5('0x3d')]));_0x37b0f0[_0xc1d5('0x3e')]=_0x37b0f0[_0xc1d5('0x3e')]['length']?_0x37b0f0[_0xc1d5('0x3e')]:_0x519bc2[_0xc1d5('0x3a')];if(_0x1155d8[_0xc1d5('0x3b')][_0xc1d5('0x49')]){_0x37b0f0[_0xc1d5('0x4e')]=[{'all':!![]}];}_0x37b0f0=_[_0xc1d5('0x47')]({},_0x37b0f0,_0x1155d8[_0xc1d5('0x48')]);return db[_0xc1d5('0x35')][_0xc1d5('0x4f')](_0x37b0f0)[_0xc1d5('0x30')](handleEntityNotFound(_0x145169,null))[_0xc1d5('0x30')](respondWithResult(_0x145169,null))[_0xc1d5('0x24')](handleError(_0x145169,null));};exports[_0xc1d5('0x2f')]=function(_0xcdaac5,_0x398c78){if(_0xcdaac5[_0xc1d5('0x50')]['id']){delete _0xcdaac5[_0xc1d5('0x50')]['id'];}return db['Setting'][_0xc1d5('0x4f')]({'where':{'id':_0xcdaac5['params']['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x398c78,null))[_0xc1d5('0x30')](saveUpdates(_0xcdaac5[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x398c78,null))[_0xc1d5('0x24')](handleError(_0x398c78,null));};exports['addLogo']=function(_0x31f98b,_0x325b28,_0x552b69){if(_0x31f98b[_0xc1d5('0x51')]&&_0x31f98b[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x31f98b['body']['logo']=_0x31f98b['file'][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x31f98b[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x325b28,null))[_0xc1d5('0x30')](saveUpdates(_0x31f98b[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x325b28,null))['catch'](handleError(_0x325b28,null));};exports[_0xc1d5('0x54')]=function(_0xb33851,_0x456096,_0x1d06a2){if(_0xb33851['file']&&_0xb33851['file'][_0xc1d5('0x52')]){_0xb33851[_0xc1d5('0x50')][_0xc1d5('0x55')]=_0xb33851[_0xc1d5('0x51')][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0xb33851['params']['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x456096,null))[_0xc1d5('0x30')](saveUpdates(_0xb33851[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x456096,null))[_0xc1d5('0x24')](handleError(_0x456096,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x56')]=function(_0x553cc2,_0x381a99,_0x3ddb38){var _0x2d65d3=_0xc1d5('0x57');var _0x233c50={'custom':![]};return utilLicense[_0xc1d5('0x58')]()[_0xc1d5('0x30')](function(_0x3f810a){if(_0x3f810a){_0x233c50=_0x3f810a;}return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x553cc2[_0xc1d5('0x53')]['id']},'attributes':[_0xc1d5('0x59'),'loginLogo',_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),'defaultLoginLogo','defaultPreferred',_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x381a99,null))['then'](function(_0x429224){if(_0x429224){var _0x1c9661=_0x429224[_0xc1d5('0x59')]&&fs[_0xc1d5('0x5e')](path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0x429224[_0xc1d5('0x59')])))?path['join'](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0x429224['logo'])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_['toLower'](_0xc1d5('0x62')));var _0x563bd7=_0xc1d5('0x63')+_[_0xc1d5('0x64')]('logo');if(_0x429224[_0x563bd7]||!_0x233c50[_0xc1d5('0x65')]){_0x1c9661=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0xc1d5('0x62')));}if(!fs['existsSync'](_0x1c9661)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')]('logo')+_0xc1d5('0x68'));}return _0x381a99[_0xc1d5('0x69')](_0x1c9661);}})[_0xc1d5('0x24')](handleError(_0x381a99,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x6a')]=function(_0x3ead8a,_0x6c3af,_0x33a478){var _0x28ca00=_0xc1d5('0x57');var _0x5cf5fc={'custom':![]};return utilLicense['getLicense']()[_0xc1d5('0x30')](function(_0x3f4f45){if(_0x3f4f45){_0x5cf5fc=_0x3f4f45;}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x3ead8a[_0xc1d5('0x53')]['id']},'attributes':[_0xc1d5('0x59'),_0xc1d5('0x55'),_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),_0xc1d5('0x6b'),'defaultPreferred',_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x6c3af,null))[_0xc1d5('0x30')](function(_0x24ed66){if(_0x24ed66){var _0x249230=_0x24ed66[_0xc1d5('0x55')]&&fs[_0xc1d5('0x5e')](path['join'](config[_0xc1d5('0x60')],_0x28ca00,_[_0xc1d5('0x61')](_0x24ed66[_0xc1d5('0x55')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x28ca00,_[_0xc1d5('0x61')](_0x24ed66[_0xc1d5('0x55')])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x28ca00,_['toLower'](_0xc1d5('0x6c')));var _0x179e09='default'+_[_0xc1d5('0x64')](_0xc1d5('0x55'));if(_0x24ed66[_0x179e09]||!_0x5cf5fc[_0xc1d5('0x65')]){_0x249230=path['join'](config['root'],_0x28ca00,_[_0xc1d5('0x61')]('default_loginLogo.svg'));}if(!fs[_0xc1d5('0x5e')](_0x249230)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')]('loginLogo')+_0xc1d5('0x68'));}return _0x6c3af[_0xc1d5('0x69')](_0x249230);}})[_0xc1d5('0x24')](handleError(_0x6c3af,null));};exports[_0xc1d5('0x6d')]=function(_0x3fcf4c,_0x2c619f){return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x3fcf4c['params']['id']},'attributes':[_0xc1d5('0x6e')]})[_0xc1d5('0x30')](respondWithResult(_0x2c619f,null))[_0xc1d5('0x24')](handleError(_0x2c619f,null));};exports['addPreferred']=function(_0x19aaac,_0x4478cf,_0x312334){if(_0x19aaac[_0xc1d5('0x51')]&&_0x19aaac[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x19aaac[_0xc1d5('0x50')][_0xc1d5('0x5a')]=_0x19aaac['file'][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x19aaac[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x4478cf,null))[_0xc1d5('0x30')](saveUpdates(_0x19aaac['body'],null))[_0xc1d5('0x30')](respondWithResult(_0x4478cf,null))[_0xc1d5('0x24')](handleError(_0x4478cf,null));};var utilLicense=require(_0xc1d5('0x17'));exports['getPreferred']=function(_0x58a235,_0x3faf89,_0x28f51f){var _0x6ed88d=_0xc1d5('0x57');var _0x23f650={'custom':![]};return utilLicense[_0xc1d5('0x58')]()[_0xc1d5('0x30')](function(_0x4b118f){if(_0x4b118f){_0x23f650=_0x4b118f;}return db['Setting'][_0xc1d5('0x4f')]({'where':{'id':_0x58a235[_0xc1d5('0x53')]['id']},'attributes':['logo',_0xc1d5('0x55'),_0xc1d5('0x5a'),'favicon',_0xc1d5('0x5c'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x3faf89,null))['then'](function(_0xa5a878){if(_0xa5a878){var _0x4dac79=_0xa5a878[_0xc1d5('0x5a')]&&fs[_0xc1d5('0x5e')](path['join'](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xa5a878[_0xc1d5('0x5a')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xa5a878[_0xc1d5('0x5a')])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xc1d5('0x6f')));var _0x4ac416=_0xc1d5('0x63')+_[_0xc1d5('0x64')](_0xc1d5('0x5a'));if(_0xa5a878[_0x4ac416]||!_0x23f650[_0xc1d5('0x65')]||!_0x23f650[_0xc1d5('0x5a')]){_0x4dac79=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x4dac79)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')](_0xc1d5('0x5a'))+_0xc1d5('0x68'));}return _0x3faf89['download'](_0x4dac79);}})[_0xc1d5('0x24')](handleError(_0x3faf89,null));};exports[_0xc1d5('0x70')]=function(_0x3f0bc8,_0xe7570b,_0x52be17){if(_0x3f0bc8[_0xc1d5('0x51')]&&_0x3f0bc8[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x3f0bc8[_0xc1d5('0x50')][_0xc1d5('0x5b')]=_0x3f0bc8[_0xc1d5('0x51')][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x3f0bc8[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0xe7570b,null))[_0xc1d5('0x30')](saveUpdates(_0x3f0bc8[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0xe7570b,null))['catch'](handleError(_0xe7570b,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x71')]=function(_0x203288,_0xc7d7d0,_0x5936cc){var _0x101fcd=_0xc1d5('0x57');var _0x2dd8c5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3b7e38){if(_0x3b7e38){_0x2dd8c5=_0x3b7e38;}return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x203288[_0xc1d5('0x53')]['id']},'attributes':['logo',_0xc1d5('0x55'),_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),_0xc1d5('0x6b'),_0xc1d5('0x72'),_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0xc7d7d0,null))[_0xc1d5('0x30')](function(_0xc151d6){if(_0xc151d6){var _0xfc5b1=_0xc151d6[_0xc1d5('0x5b')]&&fs['existsSync'](path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_[_0xc1d5('0x61')](_0xc151d6[_0xc1d5('0x5b')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_['toLower'](_0xc151d6[_0xc1d5('0x5b')])):path[_0xc1d5('0x5f')](config['root'],_0x101fcd,_[_0xc1d5('0x61')](_0xc1d5('0x73')));var _0x40b8f3=_0xc1d5('0x63')+_[_0xc1d5('0x64')](_0xc1d5('0x5b'));if(_0xc151d6[_0x40b8f3]||!_0x2dd8c5['custom']){_0xfc5b1=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_[_0xc1d5('0x61')](_0xc1d5('0x73')));}if(!fs['existsSync'](_0xfc5b1)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')](_0xc1d5('0x5b'))+_0xc1d5('0x68'));}return _0xc7d7d0[_0xc1d5('0x69')](_0xfc5b1);}})['catch'](handleError(_0xc7d7d0,null));};exports[_0xc1d5('0x74')]=function(_0x3b5e5f,_0xbd0340){var _0x11018f={'offset':moment()[_0xc1d5('0x75')]()};_0x11018f[_0xc1d5('0x76')]=moment()[_0xc1d5('0x75')](_0x11018f['offset'])[_0xc1d5('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xbd0340[_0xc1d5('0x2b')](0xc8)[_0xc1d5('0x78')](_0x11018f);}; \ No newline at end of file +var _0x3e68=['download','getLogoLogin','default_loginLogo.svg','default','custom','ValidationError','gdpr','securePassword','addPreferred','server/files/images/logos','default_preferred.png','Sequelize','addFavicon','getFavicon','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','show','params','merge','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','existsSync','upperFirst','\x20not\x20found'];(function(_0xc18746,_0x7387a9){var _0x56c6cd=function(_0x307806){while(--_0x307806){_0xc18746['push'](_0xc18746['shift']());}};_0x56c6cd(++_0x7387a9);}(_0x3e68,0x190));var _0x83e6=function(_0x536ec7,_0x20b481){_0x536ec7=_0x536ec7-0x0;var _0x2438e3=_0x3e68[_0x536ec7];return _0x2438e3;};'use strict';var emlformat=require(_0x83e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x83e6('0x1'));var rp=require('request-promise');var moment=require(_0x83e6('0x2'));var BPromise=require(_0x83e6('0x3'));var Mustache=require(_0x83e6('0x4'));var util=require(_0x83e6('0x5'));var path=require(_0x83e6('0x6'));var sox=require(_0x83e6('0x7'));var csv=require('to-csv');var ejs=require(_0x83e6('0x8'));var fs=require('fs');var fs_extra=require(_0x83e6('0x9'));var _=require(_0x83e6('0xa'));var squel=require(_0x83e6('0xb'));var crypto=require(_0x83e6('0xc'));var jsforce=require(_0x83e6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x83e6('0xe'));var querystring=require(_0x83e6('0xf'));var Papa=require(_0x83e6('0x10'));var Redis=require(_0x83e6('0x11'));var authService=require(_0x83e6('0x12'));var qs=require(_0x83e6('0x13'));var as=require(_0x83e6('0x14'));var hardwareService=require(_0x83e6('0x15'));var logger=require(_0x83e6('0x16'))(_0x83e6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83e6('0x18'))['db'];var jayson=require(_0x83e6('0x19'));var client=jayson[_0x83e6('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c01e,_0x33fd52,_0x343cd6,_0x507011){return new BPromise(function(_0x3a2ac9,_0x5bfaed){var _0x35690a=_0x507011||client;return _0x35690a[_0x83e6('0x1b')](_0x14c01e,_0x343cd6)[_0x83e6('0x1c')](function(_0x281eeb){logger['info'](_0x83e6('0x1d'),_0x33fd52,_0x83e6('0x1e'));logger[_0x83e6('0x1f')](_0x83e6('0x20'),_0x33fd52,_0x83e6('0x1e'),JSON[_0x83e6('0x21')](_0x281eeb));if(_0x281eeb['error']){if(_0x281eeb['error'][_0x83e6('0x22')]===0x1f4){logger[_0x83e6('0x23')](_0x83e6('0x1d'),_0x33fd52,_0x281eeb[_0x83e6('0x23')]['message']);return _0x5bfaed(_0x281eeb[_0x83e6('0x23')][_0x83e6('0x24')]);}logger['error'](_0x83e6('0x1d'),_0x33fd52,_0x281eeb[_0x83e6('0x23')][_0x83e6('0x24')]);return _0x3a2ac9(_0x281eeb[_0x83e6('0x23')][_0x83e6('0x24')]);}else{logger[_0x83e6('0x25')](_0x83e6('0x1d'),_0x33fd52,_0x83e6('0x1e'));_0x3a2ac9(_0x281eeb[_0x83e6('0x26')][_0x83e6('0x24')]);}})[_0x83e6('0x27')](function(_0x15b703){logger[_0x83e6('0x23')](_0x83e6('0x1d'),_0x33fd52,_0x15b703);_0x5bfaed(_0x15b703);});});}function respondWithStatusCode(_0x31801f,_0x26f410){_0x26f410=_0x26f410||0xcc;return function(_0x2cfb16){if(_0x2cfb16){return _0x31801f[_0x83e6('0x28')](_0x26f410);}return _0x31801f['status'](_0x26f410)[_0x83e6('0x29')]();};}function respondWithResult(_0x1e0a54,_0x2374a9){_0x2374a9=_0x2374a9||0xc8;return function(_0x37c22b){if(_0x37c22b){return _0x1e0a54[_0x83e6('0x2a')](_0x2374a9)[_0x83e6('0x2b')](_0x37c22b);}};}function respondWithFilteredResult(_0x21a3f0,_0x1e3242){return function(_0x4de3ad){if(_0x4de3ad){var _0x14b3b7=typeof _0x1e3242[_0x83e6('0x2c')]===_0x83e6('0x2d')&&typeof _0x1e3242[_0x83e6('0x2e')]===_0x83e6('0x2d');var _0x4df2a4=_0x4de3ad[_0x83e6('0x2f')];var _0x4e1f8d=_0x14b3b7?0x0:_0x1e3242[_0x83e6('0x2c')];var _0x2cfe16=_0x14b3b7?_0x4de3ad['count']:_0x1e3242[_0x83e6('0x2c')]+_0x1e3242['limit'];var _0x200dd3;if(_0x2cfe16>=_0x4df2a4){_0x2cfe16=_0x4df2a4;_0x200dd3=0xc8;}else{_0x200dd3=0xce;}_0x21a3f0[_0x83e6('0x2a')](_0x200dd3);return _0x21a3f0[_0x83e6('0x30')](_0x83e6('0x31'),_0x4e1f8d+'-'+_0x2cfe16+'/'+_0x4df2a4)[_0x83e6('0x2b')](_0x4de3ad);}return null;};}function patchUpdates(_0x5093ec){return function(_0x376aeb){try{jsonpatch['apply'](_0x376aeb,_0x5093ec,!![]);}catch(_0x44b0e3){return BPromise[_0x83e6('0x32')](_0x44b0e3);}return _0x376aeb[_0x83e6('0x33')]();};}function saveUpdates(_0x24c7d1,_0x574e2c){return function(_0xe61167){if(_0xe61167){return _0xe61167['update'](_0x24c7d1)[_0x83e6('0x1c')](function(_0x1b3f97){return _0x1b3f97;});}return null;};}function removeEntity(_0x217fed,_0x24ce3b){return function(_0x2a53f4){if(_0x2a53f4){return _0x2a53f4[_0x83e6('0x34')]()['then'](function(){_0x217fed[_0x83e6('0x2a')](0xcc)[_0x83e6('0x29')]();});}};}function handleEntityNotFound(_0x483169,_0x584c7b){return function(_0xa9970c){if(!_0xa9970c){_0x483169[_0x83e6('0x28')](0x194);}return _0xa9970c;};}function handleError(_0x5dfe64,_0x4bf3d3){_0x4bf3d3=_0x4bf3d3||0x1f4;return function(_0x7e1c60){logger['error'](_0x7e1c60[_0x83e6('0x35')]);if(_0x7e1c60[_0x83e6('0x36')]){delete _0x7e1c60[_0x83e6('0x36')];}_0x5dfe64[_0x83e6('0x2a')](_0x4bf3d3)['send'](_0x7e1c60);};}exports[_0x83e6('0x37')]=function(_0x1fcde1,_0x2fe028){var _0x209c44={},_0x57b4e7={},_0x1dd8c={'count':0x0,'rows':[]};var _0xe5fbcf=_[_0x83e6('0x38')](db[_0x83e6('0x39')][_0x83e6('0x3a')],function(_0x4203db){return{'name':_0x4203db['fieldName'],'type':_0x4203db[_0x83e6('0x3b')][_0x83e6('0x3c')]};});_0x57b4e7[_0x83e6('0x3d')]=_[_0x83e6('0x38')](_0xe5fbcf,_0x83e6('0x36'));_0x57b4e7[_0x83e6('0x3e')]=_[_0x83e6('0x3f')](_0x1fcde1[_0x83e6('0x3e')]);_0x57b4e7[_0x83e6('0x40')]=_[_0x83e6('0x41')](_0x57b4e7[_0x83e6('0x3d')],_0x57b4e7[_0x83e6('0x3e')]);_0x209c44[_0x83e6('0x42')]=_[_0x83e6('0x41')](_0x57b4e7[_0x83e6('0x3d')],qs[_0x83e6('0x43')](_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x43')]));_0x209c44[_0x83e6('0x42')]=_0x209c44[_0x83e6('0x42')][_0x83e6('0x44')]?_0x209c44[_0x83e6('0x42')]:_0x57b4e7[_0x83e6('0x3d')];if(!_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x45')]('nolimit')){_0x209c44[_0x83e6('0x2e')]=qs[_0x83e6('0x2e')](_0x1fcde1['query'][_0x83e6('0x2e')]);_0x209c44[_0x83e6('0x2c')]=qs['offset'](_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x2c')]);}_0x209c44[_0x83e6('0x46')]=qs[_0x83e6('0x47')](_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x47')]);_0x209c44['where']=qs[_0x83e6('0x40')](_[_0x83e6('0x48')](_0x1fcde1[_0x83e6('0x3e')],_0x57b4e7[_0x83e6('0x40')]),_0xe5fbcf);if(_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x49')]){_0x209c44[_0x83e6('0x4a')]=_['merge'](_0x209c44[_0x83e6('0x4a')],{'$or':_[_0x83e6('0x38')](_0xe5fbcf,function(_0x73f53f){if(_0x73f53f[_0x83e6('0x3b')]!==_0x83e6('0x4b')){var _0x56a18c={};_0x56a18c[_0x73f53f['name']]={'$like':'%'+_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x49')]+'%'};return _0x56a18c;}})});}_0x209c44=_['merge']({},_0x209c44,_0x1fcde1[_0x83e6('0x4c')]);var _0x4346f4={'where':_0x209c44[_0x83e6('0x4a')]};return db[_0x83e6('0x39')]['count'](_0x4346f4)['then'](function(_0x3208e1){_0x1dd8c['count']=_0x3208e1;if(_0x1fcde1[_0x83e6('0x3e')][_0x83e6('0x4d')]){_0x209c44[_0x83e6('0x4e')]=[{'all':!![]}];}return db[_0x83e6('0x39')]['findAll'](_0x209c44);})[_0x83e6('0x1c')](function(_0x4ae9dd){_0x1dd8c[_0x83e6('0x4f')]=_0x4ae9dd;return _0x1dd8c;})[_0x83e6('0x1c')](respondWithFilteredResult(_0x2fe028,_0x209c44))[_0x83e6('0x27')](handleError(_0x2fe028,null));};exports[_0x83e6('0x50')]=function(_0x1cec66,_0x1ec588){var _0xa07e67={'raw':![],'where':{'id':_0x1cec66[_0x83e6('0x51')]['id']}},_0x426e29={};_0x426e29[_0x83e6('0x3d')]=_['keys'](db[_0x83e6('0x39')]['rawAttributes']);_0x426e29[_0x83e6('0x3e')]=_[_0x83e6('0x3f')](_0x1cec66['query']);_0x426e29[_0x83e6('0x40')]=_[_0x83e6('0x41')](_0x426e29['model'],_0x426e29[_0x83e6('0x3e')]);_0xa07e67[_0x83e6('0x42')]=_[_0x83e6('0x41')](_0x426e29[_0x83e6('0x3d')],qs[_0x83e6('0x43')](_0x1cec66['query'][_0x83e6('0x43')]));_0xa07e67[_0x83e6('0x42')]=_0xa07e67[_0x83e6('0x42')][_0x83e6('0x44')]?_0xa07e67['attributes']:_0x426e29['model'];if(_0x1cec66[_0x83e6('0x3e')][_0x83e6('0x4d')]){_0xa07e67[_0x83e6('0x4e')]=[{'all':!![]}];}_0xa07e67=_[_0x83e6('0x52')]({},_0xa07e67,_0x1cec66[_0x83e6('0x4c')]);return db[_0x83e6('0x39')][_0x83e6('0x53')](_0xa07e67)[_0x83e6('0x1c')](handleEntityNotFound(_0x1ec588,null))[_0x83e6('0x1c')](respondWithResult(_0x1ec588,null))[_0x83e6('0x27')](handleError(_0x1ec588,null));};exports[_0x83e6('0x54')]=function(_0x4f85bf,_0x14b4d4){if(_0x4f85bf[_0x83e6('0x55')]['id']){delete _0x4f85bf['body']['id'];}return db['Setting'][_0x83e6('0x53')]({'where':{'id':_0x4f85bf['params']['id']}})['then'](handleEntityNotFound(_0x14b4d4,null))[_0x83e6('0x1c')](saveUpdates(_0x4f85bf['body'],null))[_0x83e6('0x1c')](respondWithResult(_0x14b4d4,null))[_0x83e6('0x27')](handleError(_0x14b4d4,null));};exports[_0x83e6('0x56')]=function(_0x12d3db,_0x18e5ab,_0x1ebdf1){if(_0x12d3db[_0x83e6('0x57')]&&_0x12d3db['file'][_0x83e6('0x58')]){_0x12d3db[_0x83e6('0x55')][_0x83e6('0x59')]=_0x12d3db[_0x83e6('0x57')][_0x83e6('0x58')];}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x12d3db['params']['id']}})['then'](handleEntityNotFound(_0x18e5ab,null))[_0x83e6('0x1c')](saveUpdates(_0x12d3db[_0x83e6('0x55')],null))[_0x83e6('0x1c')](respondWithResult(_0x18e5ab,null))[_0x83e6('0x27')](handleError(_0x18e5ab,null));};exports[_0x83e6('0x5a')]=function(_0x1eb9af,_0x2ccfe6,_0x389eee){if(_0x1eb9af[_0x83e6('0x57')]&&_0x1eb9af[_0x83e6('0x57')][_0x83e6('0x58')]){_0x1eb9af[_0x83e6('0x55')][_0x83e6('0x5b')]=_0x1eb9af['file']['filename'];}return db['Setting'][_0x83e6('0x53')]({'where':{'id':_0x1eb9af[_0x83e6('0x51')]['id']}})[_0x83e6('0x1c')](handleEntityNotFound(_0x2ccfe6,null))[_0x83e6('0x1c')](saveUpdates(_0x1eb9af[_0x83e6('0x55')],null))['then'](respondWithResult(_0x2ccfe6,null))['catch'](handleError(_0x2ccfe6,null));};var utilLicense=require(_0x83e6('0x5c'));exports[_0x83e6('0x5d')]=function(_0x36368c,_0x108370,_0x2d5c73){var _0x4f5945='server/files/images/logos';var _0x3b9078={'custom':![]};return utilLicense[_0x83e6('0x5e')]()[_0x83e6('0x1c')](function(_0x31d6bf){if(_0x31d6bf){_0x3b9078=_0x31d6bf;}return db['Setting'][_0x83e6('0x53')]({'where':{'id':_0x36368c[_0x83e6('0x51')]['id']},'attributes':[_0x83e6('0x59'),_0x83e6('0x5b'),_0x83e6('0x5f'),_0x83e6('0x60'),_0x83e6('0x61'),_0x83e6('0x62'),_0x83e6('0x63'),_0x83e6('0x64')],'raw':!![]});})[_0x83e6('0x1c')](handleEntityNotFound(_0x108370,null))[_0x83e6('0x1c')](function(_0x530cce){if(_0x530cce){var _0x440379=_0x530cce[_0x83e6('0x59')]&&fs['existsSync'](path['join'](config[_0x83e6('0x65')],_0x4f5945,_[_0x83e6('0x66')](_0x530cce['logo'])))?path[_0x83e6('0x67')](config['root'],_0x4f5945,_[_0x83e6('0x66')](_0x530cce[_0x83e6('0x59')])):path[_0x83e6('0x67')](config['root'],_0x4f5945,_[_0x83e6('0x66')](_0x83e6('0x68')));var _0xcb89f='default'+_['upperFirst'](_0x83e6('0x59'));if(_0x530cce[_0xcb89f]||!_0x3b9078['custom']){_0x440379=path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x4f5945,_[_0x83e6('0x66')](_0x83e6('0x68')));}if(!fs[_0x83e6('0x69')](_0x440379)){throw new db['Sequelize']['ValidationError'](_[_0x83e6('0x6a')](_0x83e6('0x59'))+_0x83e6('0x6b'));}return _0x108370[_0x83e6('0x6c')](_0x440379);}})[_0x83e6('0x27')](handleError(_0x108370,null));};var utilLicense=require(_0x83e6('0x5c'));exports[_0x83e6('0x6d')]=function(_0x43e0c3,_0x51a944,_0x4cb0ba){var _0x153f44='server/files/images/logos';var _0x1eae9d={'custom':![]};return utilLicense[_0x83e6('0x5e')]()[_0x83e6('0x1c')](function(_0xd0488e){if(_0xd0488e){_0x1eae9d=_0xd0488e;}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x43e0c3[_0x83e6('0x51')]['id']},'attributes':[_0x83e6('0x59'),_0x83e6('0x5b'),_0x83e6('0x5f'),'favicon',_0x83e6('0x61'),_0x83e6('0x62'),_0x83e6('0x63'),_0x83e6('0x64')],'raw':!![]});})[_0x83e6('0x1c')](handleEntityNotFound(_0x51a944,null))['then'](function(_0x3cdc5f){if(_0x3cdc5f){var _0x498306=_0x3cdc5f['loginLogo']&&fs['existsSync'](path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x153f44,_[_0x83e6('0x66')](_0x3cdc5f[_0x83e6('0x5b')])))?path['join'](config[_0x83e6('0x65')],_0x153f44,_[_0x83e6('0x66')](_0x3cdc5f['loginLogo'])):path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x153f44,_['toLower'](_0x83e6('0x6e')));var _0x43959b=_0x83e6('0x6f')+_['upperFirst'](_0x83e6('0x5b'));if(_0x3cdc5f[_0x43959b]||!_0x1eae9d[_0x83e6('0x70')]){_0x498306=path['join'](config['root'],_0x153f44,_[_0x83e6('0x66')](_0x83e6('0x6e')));}if(!fs[_0x83e6('0x69')](_0x498306)){throw new db['Sequelize'][(_0x83e6('0x71'))](_[_0x83e6('0x6a')](_0x83e6('0x5b'))+_0x83e6('0x6b'));}return _0x51a944[_0x83e6('0x6c')](_0x498306);}})['catch'](handleError(_0x51a944,null));};exports[_0x83e6('0x72')]=function(_0x446a76,_0x160b0f){return db['Setting'][_0x83e6('0x53')]({'where':{'id':_0x446a76[_0x83e6('0x51')]['id']},'attributes':[_0x83e6('0x73')]})[_0x83e6('0x1c')](respondWithResult(_0x160b0f,null))[_0x83e6('0x27')](handleError(_0x160b0f,null));};exports[_0x83e6('0x74')]=function(_0x410db2,_0x4ac71a,_0x43f1f9){if(_0x410db2[_0x83e6('0x57')]&&_0x410db2[_0x83e6('0x57')]['filename']){_0x410db2[_0x83e6('0x55')][_0x83e6('0x5f')]=_0x410db2['file'][_0x83e6('0x58')];}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x410db2[_0x83e6('0x51')]['id']}})[_0x83e6('0x1c')](handleEntityNotFound(_0x4ac71a,null))[_0x83e6('0x1c')](saveUpdates(_0x410db2['body'],null))['then'](respondWithResult(_0x4ac71a,null))[_0x83e6('0x27')](handleError(_0x4ac71a,null));};var utilLicense=require(_0x83e6('0x5c'));exports['getPreferred']=function(_0x2ee8f7,_0x3fdc90,_0x4bb732){var _0x42505b=_0x83e6('0x75');var _0x823e3d={'custom':![]};return utilLicense[_0x83e6('0x5e')]()[_0x83e6('0x1c')](function(_0x4a2d3b){if(_0x4a2d3b){_0x823e3d=_0x4a2d3b;}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x2ee8f7['params']['id']},'attributes':[_0x83e6('0x59'),_0x83e6('0x5b'),_0x83e6('0x5f'),_0x83e6('0x60'),_0x83e6('0x61'),'defaultLoginLogo',_0x83e6('0x63'),_0x83e6('0x64')],'raw':!![]});})[_0x83e6('0x1c')](handleEntityNotFound(_0x3fdc90,null))[_0x83e6('0x1c')](function(_0x190e60){if(_0x190e60){var _0x42b124=_0x190e60[_0x83e6('0x5f')]&&fs[_0x83e6('0x69')](path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x42505b,_[_0x83e6('0x66')](_0x190e60[_0x83e6('0x5f')])))?path['join'](config['root'],_0x42505b,_[_0x83e6('0x66')](_0x190e60[_0x83e6('0x5f')])):path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x42505b,_[_0x83e6('0x66')](_0x83e6('0x76')));var _0x23a4b3=_0x83e6('0x6f')+_[_0x83e6('0x6a')]('preferred');if(_0x190e60[_0x23a4b3]||!_0x823e3d[_0x83e6('0x70')]||!_0x823e3d['preferred']){_0x42b124=path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x42505b,_[_0x83e6('0x66')]('default_preferred.png'));}if(!fs[_0x83e6('0x69')](_0x42b124)){throw new db[(_0x83e6('0x77'))][(_0x83e6('0x71'))](_[_0x83e6('0x6a')](_0x83e6('0x5f'))+'\x20not\x20found');}return _0x3fdc90[_0x83e6('0x6c')](_0x42b124);}})[_0x83e6('0x27')](handleError(_0x3fdc90,null));};exports[_0x83e6('0x78')]=function(_0x44bf99,_0x1ebf84,_0x5f1fba){if(_0x44bf99[_0x83e6('0x57')]&&_0x44bf99['file'][_0x83e6('0x58')]){_0x44bf99[_0x83e6('0x55')][_0x83e6('0x60')]=_0x44bf99[_0x83e6('0x57')][_0x83e6('0x58')];}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x44bf99[_0x83e6('0x51')]['id']}})[_0x83e6('0x1c')](handleEntityNotFound(_0x1ebf84,null))[_0x83e6('0x1c')](saveUpdates(_0x44bf99['body'],null))[_0x83e6('0x1c')](respondWithResult(_0x1ebf84,null))[_0x83e6('0x27')](handleError(_0x1ebf84,null));};var utilLicense=require(_0x83e6('0x5c'));exports[_0x83e6('0x79')]=function(_0x3990e9,_0x3ad426,_0x1e4097){var _0x58f5d1=_0x83e6('0x75');var _0x5dc564={'custom':![]};return utilLicense[_0x83e6('0x5e')]()[_0x83e6('0x1c')](function(_0x2f3304){if(_0x2f3304){_0x5dc564=_0x2f3304;}return db[_0x83e6('0x39')][_0x83e6('0x53')]({'where':{'id':_0x3990e9['params']['id']},'attributes':[_0x83e6('0x59'),_0x83e6('0x5b'),_0x83e6('0x5f'),_0x83e6('0x60'),'defaultLogo',_0x83e6('0x62'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3ad426,null))['then'](function(_0x423dae){if(_0x423dae){var _0x53571f=_0x423dae[_0x83e6('0x60')]&&fs[_0x83e6('0x69')](path['join'](config[_0x83e6('0x65')],_0x58f5d1,_['toLower'](_0x423dae[_0x83e6('0x60')])))?path[_0x83e6('0x67')](config[_0x83e6('0x65')],_0x58f5d1,_[_0x83e6('0x66')](_0x423dae[_0x83e6('0x60')])):path[_0x83e6('0x67')](config['root'],_0x58f5d1,_[_0x83e6('0x66')]('default_favicon.ico'));var _0x4e84a0=_0x83e6('0x6f')+_['upperFirst'](_0x83e6('0x60'));if(_0x423dae[_0x4e84a0]||!_0x5dc564['custom']){_0x53571f=path['join'](config[_0x83e6('0x65')],_0x58f5d1,_[_0x83e6('0x66')]('default_favicon.ico'));}if(!fs[_0x83e6('0x69')](_0x53571f)){throw new db['Sequelize']['ValidationError'](_[_0x83e6('0x6a')](_0x83e6('0x60'))+_0x83e6('0x6b'));}return _0x3ad426[_0x83e6('0x6c')](_0x53571f);}})[_0x83e6('0x27')](handleError(_0x3ad426,null));};exports[_0x83e6('0x7a')]=function(_0x343ef9,_0xa3ecd0){var _0x7b1ebb={'offset':moment()[_0x83e6('0x7b')]()};_0x7b1ebb[_0x83e6('0x7c')]=moment()['utcOffset'](_0x7b1ebb[_0x83e6('0x2c')])['format'](_0x83e6('0x7d'));return _0xa3ecd0[_0x83e6('0x2a')](0xc8)[_0x83e6('0x7e')](_0x7b1ebb);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5fe22be..560db13 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x55ca,0x126));var _0xa55c=function(_0x52ab0a,_0xf641d5){_0x52ab0a=_0x52ab0a-0x0;var _0x1d2cab=_0x55ca[_0x52ab0a];return _0x1d2cab;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x55ca,0x126));var _0xa55c=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0x55ca[_0x871ef5];return _0x1f62ea;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 01b3d5b..4eac0c4 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 _0x3eef=['request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSetting','options','where','include','map','attributes','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x3eef,0x1d5));var _0xf3ee=function(_0x3767f0,_0x4c7391){_0x3767f0=_0x3767f0-0x0;var _0x2552f1=_0x3eef[_0x3767f0];return _0x2552f1;};'use strict';var _=require(_0xf3ee('0x0'));var util=require(_0xf3ee('0x1'));var moment=require(_0xf3ee('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3ee('0x3'));var fs=require('fs');var Redis=require(_0xf3ee('0x4'));var db=require(_0xf3ee('0x5'))['db'];var utils=require(_0xf3ee('0x6'));var logger=require('../../config/logger')(_0xf3ee('0x7'));var config=require(_0xf3ee('0x8'));var jayson=require(_0xf3ee('0x9'));var client=jayson['client'][_0xf3ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc2bb,_0x4e26bb,_0x3e27f0){return new BPromise(function(_0x577f5b,_0x29e12e){return client[_0xf3ee('0xb')](_0x1dc2bb,_0x3e27f0)[_0xf3ee('0xc')](function(_0x22f82b){logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4e26bb,'request\x20sent');logger[_0xf3ee('0xf')](_0xf3ee('0x10'),_0x4e26bb,'request\x20sent',JSON[_0xf3ee('0x11')](_0x22f82b));if(_0x22f82b[_0xf3ee('0x12')]){if(_0x22f82b[_0xf3ee('0x12')][_0xf3ee('0x13')]===0x1f4){logger['error'](_0xf3ee('0xe'),_0x4e26bb,_0x22f82b[_0xf3ee('0x12')][_0xf3ee('0x14')]);return _0x29e12e(_0x22f82b[_0xf3ee('0x12')][_0xf3ee('0x14')]);}logger[_0xf3ee('0x12')](_0xf3ee('0xe'),_0x4e26bb,_0x22f82b[_0xf3ee('0x12')]['message']);return _0x577f5b(_0x22f82b['error'][_0xf3ee('0x14')]);}else{logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4e26bb,_0xf3ee('0x15'));_0x577f5b(_0x22f82b['result'][_0xf3ee('0x14')]);}})[_0xf3ee('0x16')](function(_0x683c09){logger[_0xf3ee('0x12')]('Setting,\x20%s,\x20%s',_0x4e26bb,_0x683c09);_0x29e12e(_0x683c09);});});}exports[_0xf3ee('0x17')]=function(_0x158355){var _0x393840=this;return new Promise(function(_0x8054be,_0x27c884){return db['Setting']['find']({'raw':_0x158355[_0xf3ee('0x18')]?_0x158355[_0xf3ee('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x158355[_0xf3ee('0x18')]?_0x158355[_0xf3ee('0x18')][_0xf3ee('0x19')]||null:null,'attributes':_0x158355[_0xf3ee('0x18')]?_0x158355[_0xf3ee('0x18')]['attributes']||null:null,'include':_0x158355[_0xf3ee('0x18')]?_0x158355['options'][_0xf3ee('0x1a')]?_[_0xf3ee('0x1b')](_0x158355['options'][_0xf3ee('0x1a')],function(_0x2f3e23){return{'model':db[_0x2f3e23['model']],'as':_0x2f3e23['as'],'attributes':_0x2f3e23[_0xf3ee('0x1c')],'include':_0x2f3e23[_0xf3ee('0x1a')]?_[_0xf3ee('0x1b')](_0x2f3e23[_0xf3ee('0x1a')],function(_0x449206){return{'model':db[_0x449206[_0xf3ee('0x1d')]],'as':_0x449206['as'],'attributes':_0x449206[_0xf3ee('0x1c')],'include':_0x449206[_0xf3ee('0x1a')]?_[_0xf3ee('0x1b')](_0x449206[_0xf3ee('0x1a')],function(_0x5a2be3){return{'model':db[_0x5a2be3['model']],'as':_0x5a2be3['as'],'attributes':_0x5a2be3[_0xf3ee('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf3ee('0xc')](function(_0x1fce19){logger['info']('ShowSetting',_0x158355);logger[_0xf3ee('0xf')]('ShowSetting',_0x158355,JSON[_0xf3ee('0x11')](_0x1fce19));_0x8054be(_0x1fce19);})['catch'](function(_0x50c9fa){logger[_0xf3ee('0x12')](_0xf3ee('0x17'),_0x50c9fa['message'],_0x158355);_0x27c884(_0x393840[_0xf3ee('0x12')](0x1f4,_0x50c9fa['message']));});});}; \ No newline at end of file +var _0xeb9e=['find','options','raw','where','attributes','include','map','model','then','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xeb9e,0x1c4));var _0xeeb9=function(_0x46cf21,_0x2c1ac9){_0x46cf21=_0x46cf21-0x0;var _0x1c2cbe=_0xeb9e[_0x46cf21];return _0x1c2cbe;};'use strict';var _=require(_0xeeb9('0x0'));var util=require(_0xeeb9('0x1'));var moment=require(_0xeeb9('0x2'));var BPromise=require(_0xeeb9('0x3'));var rs=require(_0xeeb9('0x4'));var fs=require('fs');var Redis=require(_0xeeb9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeb9('0x6'));var logger=require(_0xeeb9('0x7'))(_0xeeb9('0x8'));var config=require(_0xeeb9('0x9'));var jayson=require(_0xeeb9('0xa'));var client=jayson[_0xeeb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d5e6,_0x583010,_0x38cea7){return new BPromise(function(_0xc555c4,_0x51075a){return client[_0xeeb9('0xc')](_0x36d5e6,_0x38cea7)['then'](function(_0x567d1f){logger[_0xeeb9('0xd')](_0xeeb9('0xe'),_0x583010,_0xeeb9('0xf'));logger[_0xeeb9('0x10')](_0xeeb9('0x11'),_0x583010,_0xeeb9('0xf'),JSON[_0xeeb9('0x12')](_0x567d1f));if(_0x567d1f[_0xeeb9('0x13')]){if(_0x567d1f[_0xeeb9('0x13')][_0xeeb9('0x14')]===0x1f4){logger[_0xeeb9('0x13')]('Setting,\x20%s,\x20%s',_0x583010,_0x567d1f[_0xeeb9('0x13')][_0xeeb9('0x15')]);return _0x51075a(_0x567d1f[_0xeeb9('0x13')]['message']);}logger[_0xeeb9('0x13')](_0xeeb9('0xe'),_0x583010,_0x567d1f[_0xeeb9('0x13')][_0xeeb9('0x15')]);return _0xc555c4(_0x567d1f['error'][_0xeeb9('0x15')]);}else{logger[_0xeeb9('0xd')](_0xeeb9('0xe'),_0x583010,_0xeeb9('0xf'));_0xc555c4(_0x567d1f[_0xeeb9('0x16')]['message']);}})[_0xeeb9('0x17')](function(_0xaa302a){logger[_0xeeb9('0x13')](_0xeeb9('0xe'),_0x583010,_0xaa302a);_0x51075a(_0xaa302a);});});}exports['ShowSetting']=function(_0x1898ba){var _0x3f0f8c=this;return new Promise(function(_0x2d7992,_0x289efd){return db['Setting'][_0xeeb9('0x18')]({'raw':_0x1898ba[_0xeeb9('0x19')]?_0x1898ba[_0xeeb9('0x19')][_0xeeb9('0x1a')]===undefined?!![]:![]:!![],'where':_0x1898ba[_0xeeb9('0x19')]?_0x1898ba['options'][_0xeeb9('0x1b')]||null:null,'attributes':_0x1898ba[_0xeeb9('0x19')]?_0x1898ba['options'][_0xeeb9('0x1c')]||null:null,'include':_0x1898ba['options']?_0x1898ba[_0xeeb9('0x19')][_0xeeb9('0x1d')]?_[_0xeeb9('0x1e')](_0x1898ba[_0xeeb9('0x19')]['include'],function(_0x3883a2){return{'model':db[_0x3883a2['model']],'as':_0x3883a2['as'],'attributes':_0x3883a2['attributes'],'include':_0x3883a2[_0xeeb9('0x1d')]?_['map'](_0x3883a2['include'],function(_0x2eb9d3){return{'model':db[_0x2eb9d3['model']],'as':_0x2eb9d3['as'],'attributes':_0x2eb9d3[_0xeeb9('0x1c')],'include':_0x2eb9d3[_0xeeb9('0x1d')]?_[_0xeeb9('0x1e')](_0x2eb9d3['include'],function(_0x28de42){return{'model':db[_0x28de42[_0xeeb9('0x1f')]],'as':_0x28de42['as'],'attributes':_0x28de42['attributes']};}):[]};}):[]};}):[]:[]})[_0xeeb9('0x20')](function(_0x5221ba){logger[_0xeeb9('0xd')](_0xeeb9('0x21'),_0x1898ba);logger['debug'](_0xeeb9('0x21'),_0x1898ba,JSON['stringify'](_0x5221ba));_0x2d7992(_0x5221ba);})[_0xeeb9('0x17')](function(_0x5a75cc){logger[_0xeeb9('0x13')]('ShowSetting',_0x5a75cc[_0xeeb9('0x15')],_0x1898ba);_0x289efd(_0x3f0f8c[_0xeeb9('0x13')](0x1f4,_0x5a75cc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c13f292..be727e2 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x146a63,_0x4c13da){var _0x2c8c2b=function(_0x244672){while(--_0x244672){_0x146a63['push'](_0x146a63['shift']());}};_0x2c8c2b(++_0x4c13da);}(_0x7a54,0x106));var _0x47a5=function(_0x8242c4,_0x3cb253){_0x8242c4=_0x8242c4-0x0;var _0x1a96f8=_0x7a54[_0x8242c4];return _0x1a96f8;};'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 cab6bbe..23c048b 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 _0x42f0=['exports','STRING','twilio','plivo','clickatell','bandwidth','csc','infobip','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x2e8bd9,_0x26d4d8){var _0x184eeb=function(_0x557527){while(--_0x557527){_0x2e8bd9['push'](_0x2e8bd9['shift']());}};_0x184eeb(++_0x26d4d8);}(_0x42f0,0x1ca));var _0x042f=function(_0x3d6e73,_0x4c9ba0){_0x3d6e73=_0x3d6e73-0x0;var _0x10abbf=_0x42f0[_0x3d6e73];return _0x10abbf;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x042f('0x0'));module[_0x042f('0x1')]={'name':{'type':Sequelize[_0x042f('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x042f('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x042f('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x042f('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x042f('0x3'),'skebby','connectel','clicksend',_0x042f('0x4'),_0x042f('0x5'),_0x042f('0x6'),_0x042f('0x7'),_0x042f('0x8'),'intelepeer')},'accountSid':{'type':Sequelize[_0x042f('0x2')]},'authId':{'type':Sequelize[_0x042f('0x2')]},'authToken':{'type':Sequelize[_0x042f('0x2')]},'smsMethod':{'type':Sequelize[_0x042f('0x9')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x042f('0x2')]},'applicationId':{'type':Sequelize[_0x042f('0x2')]},'accountId':{'type':Sequelize[_0x042f('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x042f('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x042f('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x042f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x042f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x042f('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x042f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x042f('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x042f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x042f('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x042f('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x042f('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2fd2c8){if(!_0x2fd2c8)this[_0x042f('0xe')](_0x042f('0xf'),null);this[_0x042f('0xe')](_0x042f('0x10'),_0x2fd2c8);}}}; \ No newline at end of file +var _0xa4c9=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth'];(function(_0x5de59d,_0x4cc742){var _0x3485d9=function(_0x3be723){while(--_0x3be723){_0x5de59d['push'](_0x5de59d['shift']());}};_0x3485d9(++_0x4cc742);}(_0xa4c9,0x73));var _0x9a4c=function(_0x1c1bd5,_0x2f079c){_0x1c1bd5=_0x1c1bd5-0x0;var _0x3eb95b=_0xa4c9[_0x1c1bd5];return _0x3eb95b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9a4c('0x0')]={'name':{'type':Sequelize[_0x9a4c('0x1')],'unique':_0x9a4c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9a4c('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9a4c('0x3')]();}},'phone':{'type':Sequelize[_0x9a4c('0x1')]},'type':{'type':Sequelize[_0x9a4c('0x4')](_0x9a4c('0x5'),_0x9a4c('0x6'),'connectel',_0x9a4c('0x7'),_0x9a4c('0x8'),_0x9a4c('0x9'),_0x9a4c('0xa'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x9a4c('0x1')]},'authId':{'type':Sequelize[_0x9a4c('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x9a4c('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x9a4c('0x1')]},'applicationId':{'type':Sequelize[_0x9a4c('0x1')]},'accountId':{'type':Sequelize[_0x9a4c('0x1')]},'senderString':{'type':Sequelize[_0x9a4c('0x1')]},'deliveryReport':{'type':Sequelize[_0x9a4c('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x9a4c('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9a4c('0xc');}},'notificationSound':{'type':Sequelize[_0x9a4c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9a4c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9a4c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a4c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9a4c('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9a4c('0xd')],'comment':_0x9a4c('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9a4c('0xf'),'set':function(_0x250ca7){if(!_0x250ca7)this[_0x9a4c('0x10')]('mandatoryDispositionPauseId',null);this[_0x9a4c('0x10')](_0x9a4c('0x11'),_0x250ca7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2b43337..f9c9d5f 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 _0xf52c=['Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','spread','SmsMessage','dataValues','push','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','destroy','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','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','CmContact','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','findAndCountAll','stack','finally','send','getApplications','getInteractions','Contact','fullname','internal'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xf52c,0x1f1));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xcf52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf52('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf52('0x2'));var moment=require(_0xcf52('0x3'));var BPromise=require(_0xcf52('0x4'));var Mustache=require(_0xcf52('0x5'));var util=require('util');var path=require(_0xcf52('0x6'));var sox=require('sox');var csv=require(_0xcf52('0x7'));var ejs=require(_0xcf52('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf52('0x9'));var squel=require(_0xcf52('0xa'));var crypto=require(_0xcf52('0xb'));var jsforce=require(_0xcf52('0xc'));var deskjs=require(_0xcf52('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcf52('0xe'));var Papa=require(_0xcf52('0xf'));var Redis=require(_0xcf52('0x10'));var authService=require(_0xcf52('0x11'));var qs=require(_0xcf52('0x12'));var as=require(_0xcf52('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf52('0x14'))(_0xcf52('0x15'));var utils=require(_0xcf52('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcf52('0x17'));var db=require('../../mysqldb')['db'];config[_0xcf52('0x18')]=_[_0xcf52('0x19')](config['redis'],{'host':_0xcf52('0x1a'),'port':0x18eb});var socket=require(_0xcf52('0x1b'))(new Redis(config[_0xcf52('0x18')]));require(_0xcf52('0x1c'))[_0xcf52('0x1d')](socket);var jayson=require(_0xcf52('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1c9dbb,_0x38b9a4,_0x22a388,_0x562b88){return new BPromise(function(_0x1038f5,_0x420ac2){var _0x585138=_0x562b88||client;return _0x585138[_0xcf52('0x1f')](_0x1c9dbb,_0x22a388)['then'](function(_0x388d6b){logger[_0xcf52('0x20')]('SmsAccount,\x20%s,\x20%s',_0x38b9a4,_0xcf52('0x21'));logger[_0xcf52('0x22')](_0xcf52('0x23'),_0x38b9a4,_0xcf52('0x21'),JSON[_0xcf52('0x24')](_0x388d6b));if(_0x388d6b[_0xcf52('0x25')]){if(_0x388d6b['error']['code']===0x1f4){logger['error'](_0xcf52('0x26'),_0x38b9a4,_0x388d6b[_0xcf52('0x25')][_0xcf52('0x27')]);return _0x420ac2(_0x388d6b['error'][_0xcf52('0x27')]);}logger[_0xcf52('0x25')]('SmsAccount,\x20%s,\x20%s',_0x38b9a4,_0x388d6b[_0xcf52('0x25')][_0xcf52('0x27')]);return _0x1038f5(_0x388d6b[_0xcf52('0x25')]['message']);}else{logger['info'](_0xcf52('0x26'),_0x38b9a4,_0xcf52('0x21'));_0x1038f5(_0x388d6b[_0xcf52('0x28')][_0xcf52('0x27')]);}})['catch'](function(_0x4b8662){logger[_0xcf52('0x25')](_0xcf52('0x26'),_0x38b9a4,_0x4b8662);_0x420ac2(_0x4b8662);});});}function respondWithStatusCode(_0x162eb6,_0x2ff832){_0x2ff832=_0x2ff832||0xcc;return function(_0x412a08){if(_0x412a08){return _0x162eb6[_0xcf52('0x29')](_0x2ff832);}return _0x162eb6[_0xcf52('0x2a')](_0x2ff832)[_0xcf52('0x2b')]();};}function respondWithResult(_0x11db8a,_0xe7ae1a){_0xe7ae1a=_0xe7ae1a||0xc8;return function(_0x556fd2){if(_0x556fd2){return _0x11db8a[_0xcf52('0x2a')](_0xe7ae1a)[_0xcf52('0x2c')](_0x556fd2);}};}function respondWithFilteredResult(_0x296fbd,_0xfca57f){return function(_0x21486d){if(_0x21486d){var _0x3cbdf2=typeof _0xfca57f[_0xcf52('0x2d')]===_0xcf52('0x2e')&&typeof _0xfca57f[_0xcf52('0x2f')]===_0xcf52('0x2e');var _0x3d6ab6=_0x21486d[_0xcf52('0x30')];var _0x141e1e=_0x3cbdf2?0x0:_0xfca57f[_0xcf52('0x2d')];var _0x2f5d15=_0x3cbdf2?_0x21486d[_0xcf52('0x30')]:_0xfca57f['offset']+_0xfca57f[_0xcf52('0x2f')];var _0x220788;if(_0x2f5d15>=_0x3d6ab6){_0x2f5d15=_0x3d6ab6;_0x220788=0xc8;}else{_0x220788=0xce;}_0x296fbd[_0xcf52('0x2a')](_0x220788);return _0x296fbd[_0xcf52('0x31')](_0xcf52('0x32'),_0x141e1e+'-'+_0x2f5d15+'/'+_0x3d6ab6)[_0xcf52('0x2c')](_0x21486d);}return null;};}function patchUpdates(_0x5d1a30){return function(_0x50b4ca){try{jsonpatch['apply'](_0x50b4ca,_0x5d1a30,!![]);}catch(_0x56f38f){return BPromise[_0xcf52('0x33')](_0x56f38f);}return _0x50b4ca[_0xcf52('0x34')]();};}function saveUpdates(_0x28610c,_0x4bfb54){return function(_0x3a46f7){if(_0x3a46f7){return _0x3a46f7[_0xcf52('0x35')](_0x28610c)[_0xcf52('0x36')](function(_0x19802e){return _0x19802e;});}return null;};}function removeEntity(_0x3e5795,_0x170b97){return function(_0x175ab7){if(_0x175ab7){return _0x175ab7['destroy']()[_0xcf52('0x36')](function(){var _0x24edcd=_0x175ab7[_0xcf52('0x37')]({'plain':!![]});var _0x24b7b1='SmsAccounts';return db[_0xcf52('0x38')]['destroy']({'where':{'type':_0x24b7b1,'resourceId':_0x24edcd['id']}})[_0xcf52('0x36')](function(){return _0x175ab7;});})[_0xcf52('0x36')](function(){_0x3e5795[_0xcf52('0x2a')](0xcc)[_0xcf52('0x2b')]();});}};}function handleEntityNotFound(_0x438d31,_0x37a8a3){return function(_0x345211){if(!_0x345211){_0x438d31[_0xcf52('0x29')](0x194);}return _0x345211;};}function handleError(_0x4563f1,_0x2c5752){_0x2c5752=_0x2c5752||0x1f4;return function(_0x232ba5){logger['error'](_0x232ba5['stack']);if(_0x232ba5[_0xcf52('0x39')]){delete _0x232ba5[_0xcf52('0x39')];}_0x4563f1['status'](_0x2c5752)['send'](_0x232ba5);};}exports[_0xcf52('0x3a')]=function(_0x14cb42,_0x4260d5){var _0x34057b={'include':[{'model':db[_0xcf52('0x3b')],'as':_0xcf52('0x3c')}]},_0x54fce3={},_0x4fff8f={'count':0x0,'rows':[]};var _0x43727b=_[_0xcf52('0x3d')](db[_0xcf52('0x3e')][_0xcf52('0x3f')],function(_0x36b9e4){return{'name':_0x36b9e4[_0xcf52('0x40')],'type':_0x36b9e4[_0xcf52('0x41')][_0xcf52('0x42')]};});_0x54fce3[_0xcf52('0x43')]=_['map'](_0x43727b,_0xcf52('0x39'));_0x54fce3['query']=_[_0xcf52('0x44')](_0x14cb42[_0xcf52('0x45')]);_0x54fce3[_0xcf52('0x46')]=_[_0xcf52('0x47')](_0x54fce3['model'],_0x54fce3[_0xcf52('0x45')]);_0x34057b['attributes']=_[_0xcf52('0x47')](_0x54fce3[_0xcf52('0x43')],qs[_0xcf52('0x48')](_0x14cb42[_0xcf52('0x45')]['fields']));_0x34057b['attributes']=_0x34057b[_0xcf52('0x49')][_0xcf52('0x4a')]?_0x34057b[_0xcf52('0x49')]:_0x54fce3['model'];if(!_0x14cb42[_0xcf52('0x45')]['hasOwnProperty'](_0xcf52('0x4b'))){_0x34057b[_0xcf52('0x2f')]=qs[_0xcf52('0x2f')](_0x14cb42[_0xcf52('0x45')][_0xcf52('0x2f')]);_0x34057b[_0xcf52('0x2d')]=qs['offset'](_0x14cb42[_0xcf52('0x45')][_0xcf52('0x2d')]);}_0x34057b['order']=qs[_0xcf52('0x4c')](_0x14cb42[_0xcf52('0x45')][_0xcf52('0x4c')]);_0x34057b['where']=qs[_0xcf52('0x46')](_['pick'](_0x14cb42[_0xcf52('0x45')],_0x54fce3[_0xcf52('0x46')]),_0x43727b);if(_0x14cb42[_0xcf52('0x45')]['filter']){_0x34057b['where']=_[_0xcf52('0x4d')](_0x34057b[_0xcf52('0x4e')],{'$or':_['map'](_0x43727b,function(_0x2c79da){if(_0x2c79da[_0xcf52('0x41')]!==_0xcf52('0x4f')){var _0x69aca6={};_0x69aca6[_0x2c79da[_0xcf52('0x39')]]={'$like':'%'+_0x14cb42[_0xcf52('0x45')][_0xcf52('0x50')]+'%'};return _0x69aca6;}})});}_0x34057b=_['merge']({},_0x34057b,_0x14cb42[_0xcf52('0x51')]);var _0x4d569f={'where':_0x34057b[_0xcf52('0x4e')]};return db[_0xcf52('0x3e')]['count'](_0x4d569f)[_0xcf52('0x36')](function(_0xafbc07){_0x4fff8f[_0xcf52('0x30')]=_0xafbc07;if(_0x14cb42[_0xcf52('0x45')][_0xcf52('0x52')]){_0x34057b[_0xcf52('0x53')]=[{'all':!![]}];}return db[_0xcf52('0x3e')][_0xcf52('0x54')](_0x34057b);})[_0xcf52('0x36')](function(_0x4f07f8){_0x4fff8f['rows']=_0x4f07f8;return _0x4fff8f;})[_0xcf52('0x36')](respondWithFilteredResult(_0x4260d5,_0x34057b))[_0xcf52('0x55')](handleError(_0x4260d5,null));};exports[_0xcf52('0x56')]=function(_0x80da31,_0x396f0a){var _0x19b42f={'raw':![],'where':{'id':_0x80da31[_0xcf52('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xcf52('0x3c')}]},_0x4328d8={};_0x4328d8[_0xcf52('0x43')]=_[_0xcf52('0x44')](db[_0xcf52('0x3e')][_0xcf52('0x3f')]);_0x4328d8['query']=_[_0xcf52('0x44')](_0x80da31[_0xcf52('0x45')]);_0x4328d8[_0xcf52('0x46')]=_['intersection'](_0x4328d8['model'],_0x4328d8[_0xcf52('0x45')]);_0x19b42f['attributes']=_[_0xcf52('0x47')](_0x4328d8[_0xcf52('0x43')],qs[_0xcf52('0x48')](_0x80da31[_0xcf52('0x45')][_0xcf52('0x48')]));_0x19b42f[_0xcf52('0x49')]=_0x19b42f['attributes'][_0xcf52('0x4a')]?_0x19b42f['attributes']:_0x4328d8['model'];if(_0x80da31[_0xcf52('0x45')][_0xcf52('0x52')]){_0x19b42f['include']=[{'all':!![]}];}_0x19b42f=_[_0xcf52('0x4d')]({},_0x19b42f,_0x80da31[_0xcf52('0x51')]);return db[_0xcf52('0x3e')][_0xcf52('0x58')](_0x19b42f)[_0xcf52('0x36')](handleEntityNotFound(_0x396f0a,null))[_0xcf52('0x36')](respondWithResult(_0x396f0a,null))[_0xcf52('0x55')](handleError(_0x396f0a,null));};exports['create']=function(_0x367f10,_0x4ed25e){return db[_0xcf52('0x3e')]['create'](_0x367f10[_0xcf52('0x59')],{})[_0xcf52('0x36')](function(_0x29423e){var _0x46dd9a=_0x367f10['user'][_0xcf52('0x37')]({'plain':!![]});if(!_0x46dd9a)throw new Error(_0xcf52('0x5a'));if(_0x46dd9a['role']===_0xcf52('0x5b')){var _0x2746d3=_0x29423e[_0xcf52('0x37')]({'plain':!![]});var _0x41c5b4='SmsAccounts';return db[_0xcf52('0x5c')]['find']({'where':{'name':_0x41c5b4,'userProfileId':_0x46dd9a[_0xcf52('0x5d')]},'raw':!![]})['then'](function(_0x31f104){if(_0x31f104&&_0x31f104[_0xcf52('0x5e')]===0x0){return db[_0xcf52('0x38')][_0xcf52('0x5f')]({'name':_0x2746d3['name'],'resourceId':_0x2746d3['id'],'type':_0x31f104[_0xcf52('0x39')],'sectionId':_0x31f104['id']},{})[_0xcf52('0x36')](function(){return _0x29423e;});}else{return _0x29423e;}})[_0xcf52('0x55')](function(_0x830bfe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x830bfe);throw _0x830bfe;});}return _0x29423e;})[_0xcf52('0x36')](respondWithResult(_0x4ed25e,0xc9))['catch'](handleError(_0x4ed25e,null));};exports[_0xcf52('0x35')]=function(_0x3be110,_0x2609fe){if(_0x3be110[_0xcf52('0x59')]['id']){delete _0x3be110[_0xcf52('0x59')]['id'];}return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x3be110[_0xcf52('0x57')]['id']},'include':[{'model':db[_0xcf52('0x3b')],'as':_0xcf52('0x3c')}]})[_0xcf52('0x36')](handleEntityNotFound(_0x2609fe,null))['then'](saveUpdates(_0x3be110['body'],null))[_0xcf52('0x36')](respondWithResult(_0x2609fe,null))[_0xcf52('0x55')](handleError(_0x2609fe,null));};exports[_0xcf52('0x60')]=function(_0x46bee1,_0x18f957){return db[_0xcf52('0x3e')]['find']({'where':{'id':_0x46bee1[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x18f957,null))[_0xcf52('0x36')](removeEntity(_0x18f957,null))[_0xcf52('0x55')](handleError(_0x18f957,null));};exports['describe']=function(_0x40fe6c,_0xf9362c){return db[_0xcf52('0x3e')][_0xcf52('0x61')]()['then'](respondWithResult(_0xf9362c,null))[_0xcf52('0x55')](handleError(_0xf9362c,null));};exports[_0xcf52('0x62')]=function(_0x1251c2,_0x462152,_0xeb950a){if(_0x1251c2['body']['id']){delete _0x1251c2['body']['id'];}return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x1251c2[_0xcf52('0x57')]['id']}})['then'](handleEntityNotFound(_0x462152,null))[_0xcf52('0x36')](function(_0x3fc04d){if(_0x3fc04d){_0x1251c2[_0xcf52('0x59')][_0xcf52('0x63')]=_0x3fc04d['id'];return db[_0xcf52('0x64')]['create'](_0x1251c2[_0xcf52('0x59')]);}})['then'](respondWithResult(_0x462152,null))[_0xcf52('0x55')](handleError(_0x462152,null));};exports['getDispositions']=function(_0xaa8640,_0x5b5ea4,_0x2dd13e){var _0x208d48={'raw':![],'where':{}};var _0x1ef076={};var _0x48a128={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xaa8640[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x5b5ea4,null))[_0xcf52('0x36')](function(_0x4563db){if(_0x4563db){_0x1ef076[_0xcf52('0x43')]=_[_0xcf52('0x44')](db[_0xcf52('0x64')][_0xcf52('0x3f')]);_0x1ef076[_0xcf52('0x45')]=_['keys'](_0xaa8640[_0xcf52('0x45')]);_0x1ef076[_0xcf52('0x46')]=_[_0xcf52('0x47')](_0x1ef076[_0xcf52('0x43')],_0x1ef076['query']);_0x208d48[_0xcf52('0x49')]=_[_0xcf52('0x47')](_0x1ef076[_0xcf52('0x43')],qs[_0xcf52('0x48')](_0xaa8640['query'][_0xcf52('0x48')]));_0x208d48[_0xcf52('0x49')]=_0x208d48[_0xcf52('0x49')]['length']?_0x208d48[_0xcf52('0x49')]:_0x1ef076[_0xcf52('0x43')];if(!_0xaa8640[_0xcf52('0x45')][_0xcf52('0x65')](_0xcf52('0x4b'))){_0x208d48[_0xcf52('0x2f')]=qs[_0xcf52('0x2f')](_0xaa8640['query'][_0xcf52('0x2f')]);_0x208d48[_0xcf52('0x2d')]=qs[_0xcf52('0x2d')](_0xaa8640[_0xcf52('0x45')][_0xcf52('0x2d')]);}_0x208d48['order']=qs[_0xcf52('0x4c')](_0xaa8640[_0xcf52('0x45')][_0xcf52('0x4c')]);_0x208d48['where']=qs[_0xcf52('0x46')](_[_0xcf52('0x66')](_0xaa8640['query'],_0x1ef076[_0xcf52('0x46')]));_0x208d48['where'][_0xcf52('0x63')]=_0x4563db['id'];if(_0xaa8640[_0xcf52('0x45')]['filter']){_0x208d48[_0xcf52('0x4e')]=_['merge'](_0x208d48[_0xcf52('0x4e')],{'$or':_[_0xcf52('0x3d')](_0x208d48[_0xcf52('0x49')],function(_0x2a1de9){var _0x5077e7={};_0x5077e7[_0x2a1de9]={'$like':'%'+_0xaa8640['query']['filter']+'%'};return _0x5077e7;})});}_0x208d48=_[_0xcf52('0x4d')]({},_0x208d48,_0xaa8640[_0xcf52('0x51')]);return db[_0xcf52('0x64')][_0xcf52('0x30')]({'where':_0x208d48[_0xcf52('0x4e')]})[_0xcf52('0x36')](function(_0x82cbbe){_0x48a128['count']=_0x82cbbe;if(_0xaa8640[_0xcf52('0x45')][_0xcf52('0x52')]){_0x208d48[_0xcf52('0x53')]=[{'all':!![]}];}return db[_0xcf52('0x64')]['findAll'](_0x208d48);})[_0xcf52('0x36')](function(_0x44eb1b){_0x48a128[_0xcf52('0x67')]=_0x44eb1b;return _0x48a128;});}})['then'](respondWithFilteredResult(_0x5b5ea4,_0x208d48))['catch'](handleError(_0x5b5ea4,null));};exports[_0xcf52('0x68')]=function(_0x27c17c,_0x52d7f4,_0x409611){return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x27c17c[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x52d7f4,null))[_0xcf52('0x36')](function(_0x30fbd4){if(_0x30fbd4){return _0x30fbd4['removeDispositions'](_0x27c17c['query'][_0xcf52('0x69')]);}})['then'](respondWithStatusCode(_0x52d7f4,null))[_0xcf52('0x55')](handleError(_0x52d7f4,null));};exports[_0xcf52('0x6a')]=function(_0x3058ef,_0x399092,_0x4b1e89){if(_0x3058ef['body']['id']){delete _0x3058ef[_0xcf52('0x59')]['id'];}return db['SmsAccount'][_0xcf52('0x58')]({'where':{'id':_0x3058ef[_0xcf52('0x57')]['id']}})['then'](handleEntityNotFound(_0x399092,null))[_0xcf52('0x36')](function(_0x258e98){if(_0x258e98){_0x3058ef[_0xcf52('0x59')][_0xcf52('0x63')]=_0x258e98['id'];return db[_0xcf52('0x6b')][_0xcf52('0x5f')](_0x3058ef[_0xcf52('0x59')]);}})[_0xcf52('0x36')](respondWithResult(_0x399092,null))['catch'](handleError(_0x399092,null));};exports[_0xcf52('0x6c')]=function(_0x2ebc67,_0x3e7c8d,_0x3c91f1){var _0x4be93f={'raw':![],'where':{}};var _0x4faeca={};var _0x13fd27={'count':0x0,'rows':[]};return db[_0xcf52('0x3e')][_0xcf52('0x6d')]({'where':{'id':_0x2ebc67[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x3e7c8d,null))[_0xcf52('0x36')](function(_0x57d5aa){if(_0x57d5aa){_0x4faeca[_0xcf52('0x43')]=_[_0xcf52('0x44')](db['CannedAnswer'][_0xcf52('0x3f')]);_0x4faeca[_0xcf52('0x45')]=_[_0xcf52('0x44')](_0x2ebc67[_0xcf52('0x45')]);_0x4faeca[_0xcf52('0x46')]=_[_0xcf52('0x47')](_0x4faeca[_0xcf52('0x43')],_0x4faeca[_0xcf52('0x45')]);_0x4be93f['attributes']=_[_0xcf52('0x47')](_0x4faeca[_0xcf52('0x43')],qs['fields'](_0x2ebc67['query'][_0xcf52('0x48')]));_0x4be93f[_0xcf52('0x49')]=_0x4be93f['attributes'][_0xcf52('0x4a')]?_0x4be93f[_0xcf52('0x49')]:_0x4faeca[_0xcf52('0x43')];if(!_0x2ebc67[_0xcf52('0x45')]['hasOwnProperty']('nolimit')){_0x4be93f['limit']=qs[_0xcf52('0x2f')](_0x2ebc67[_0xcf52('0x45')]['limit']);_0x4be93f[_0xcf52('0x2d')]=qs[_0xcf52('0x2d')](_0x2ebc67[_0xcf52('0x45')][_0xcf52('0x2d')]);}_0x4be93f[_0xcf52('0x6e')]=qs['sort'](_0x2ebc67[_0xcf52('0x45')][_0xcf52('0x4c')]);_0x4be93f['where']=qs[_0xcf52('0x46')](_[_0xcf52('0x66')](_0x2ebc67[_0xcf52('0x45')],_0x4faeca[_0xcf52('0x46')]));_0x4be93f[_0xcf52('0x4e')][_0xcf52('0x63')]=_0x57d5aa['id'];if(_0x2ebc67['query'][_0xcf52('0x50')]){_0x4be93f[_0xcf52('0x4e')]=_[_0xcf52('0x4d')](_0x4be93f[_0xcf52('0x4e')],{'$or':_['map'](_0x4be93f[_0xcf52('0x49')],function(_0x331328){var _0x86d88e={};_0x86d88e[_0x331328]={'$like':'%'+_0x2ebc67[_0xcf52('0x45')]['filter']+'%'};return _0x86d88e;})});}_0x4be93f=_['merge']({},_0x4be93f,_0x2ebc67[_0xcf52('0x51')]);return db[_0xcf52('0x6b')][_0xcf52('0x30')]({'where':_0x4be93f['where']})[_0xcf52('0x36')](function(_0x1f7e0a){_0x13fd27[_0xcf52('0x30')]=_0x1f7e0a;if(_0x2ebc67[_0xcf52('0x45')][_0xcf52('0x52')]){_0x4be93f['include']=[{'all':!![]}];}return db[_0xcf52('0x6b')]['findAll'](_0x4be93f);})[_0xcf52('0x36')](function(_0x4d3584){_0x13fd27[_0xcf52('0x67')]=_0x4d3584;return _0x13fd27;});}})[_0xcf52('0x36')](respondWithFilteredResult(_0x3e7c8d,_0x4be93f))['catch'](handleError(_0x3e7c8d,null));};exports['removeAnswers']=function(_0x6dc798,_0x2b8fb9,_0x511ff3){return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x6dc798[_0xcf52('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b8fb9,null))[_0xcf52('0x36')](function(_0x22a56a){if(_0x22a56a){return _0x22a56a[_0xcf52('0x6f')](_0x6dc798['query'][_0xcf52('0x69')]);}})[_0xcf52('0x36')](respondWithStatusCode(_0x2b8fb9,null))[_0xcf52('0x55')](handleError(_0x2b8fb9,null));};exports[_0xcf52('0x70')]=function(_0x31f31d,_0x1642cf,_0x570e2e){var _0x2c2ab6={'channel':_0xcf52('0x71')};var _0x5da344=[];var _0x478acd=[];var _0x524933={};return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x31f31d[_0xcf52('0x57')]['id']},'include':[{'model':db[_0xcf52('0x72')],'as':_0xcf52('0x73')}]})[_0xcf52('0x36')](handleEntityNotFound(_0x1642cf,null))[_0xcf52('0x36')](function(_0x13199e){_0x2c2ab6[_0xcf52('0x74')]=_0x13199e;_0x2c2ab6[_0xcf52('0x75')]=_[_0xcf52('0x76')](_0x13199e[_0xcf52('0x73')],[_0xcf52('0x77')],[_0xcf52('0x78')]);if(_0x2c2ab6[_0xcf52('0x74')][_0xcf52('0x73')]){delete _0x2c2ab6[_0xcf52('0x74')]['Applications'];}return db['CmContact'][_0xcf52('0x61')]();})[_0xcf52('0x36')](function(_0x337a83){if(!_0x337a83){throw new db[(_0xcf52('0x79'))][(_0xcf52('0x7a'))](_0xcf52('0x7b'));}_0x5da344=_[_0xcf52('0x7c')](_[_0xcf52('0x44')](_0x337a83),[_0xcf52('0x7d'),_0xcf52('0x7e')]);_0x478acd=_[_0xcf52('0x7c')](_[_0xcf52('0x44')](_0x337a83),[_0xcf52('0x7d'),_0xcf52('0x7e'),_0xcf52('0x7f'),_0xcf52('0x80')]);_0x2c2ab6[_0xcf52('0x59')]={'mapKey':'mobile'};if(_0x2c2ab6[_0xcf52('0x74')]['type']){switch(_0x2c2ab6[_0xcf52('0x74')][_0xcf52('0x41')]){case _0xcf52('0x81'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x83')];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')]=_0x31f31d[_0xcf52('0x59')]['Body'];_0x2c2ab6['body'][_0xcf52('0x84')]=_0x31f31d['body']['MessageSid'];break;case _0xcf52('0x85'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]='+'+_0x31f31d[_0xcf52('0x59')][_0xcf52('0x86')];_0x2c2ab6['body'][_0xcf52('0x59')]=_0x31f31d['body'][_0xcf52('0x87')];break;case _0xcf52('0x88'):_0x2c2ab6['body']['from']=_0x31f31d['body'][_0xcf52('0x82')];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x27')];break;case _0xcf52('0x89'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]=_0x31f31d[_0xcf52('0x59')]['from'];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x59')];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x84')]=_0x31f31d['body'][_0xcf52('0x8a')];break;case _0xcf52('0x8b'):_0x2c2ab6['body'][_0xcf52('0x82')]=_0x31f31d['body'][_0xcf52('0x83')];_0x2c2ab6['body']['body']=_0x31f31d['body'][_0xcf52('0x8c')];_0x2c2ab6[_0xcf52('0x59')]['messageId']=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x8d')];break;case _0xcf52('0x8e'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]='+'+_0x31f31d[_0xcf52('0x59')][_0xcf52('0x8f')][0x0][_0xcf52('0x82')];_0x2c2ab6[_0xcf52('0x59')]['body']=_0x31f31d['body'][_0xcf52('0x8f')][0x0]['text'];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x84')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x8f')][0x0][_0xcf52('0x84')];break;case _0xcf52('0x90'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x91')];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x92')][_0xcf52('0x27')];break;case _0xcf52('0x93'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x94')];_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')]=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x87')];_0x2c2ab6[_0xcf52('0x59')]['messageId']=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x95')];break;case _0xcf52('0x96'):_0x2c2ab6['body'][_0xcf52('0x84')]=_0x31f31d[_0xcf52('0x59')][0x0][_0xcf52('0x27')]['id'];_0x2c2ab6['body']['from']=_0x31f31d[_0xcf52('0x59')][0x0]['message'][_0xcf52('0x82')];_0x2c2ab6['body'][_0xcf52('0x59')]=_0x31f31d['body'][0x0][_0xcf52('0x27')]['text'];break;case _0xcf52('0x97'):_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')]=_0x31f31d[_0xcf52('0x59')]['from'];_0x2c2ab6[_0xcf52('0x59')]['body']=_0x31f31d[_0xcf52('0x59')][_0xcf52('0x27')];_0x2c2ab6[_0xcf52('0x59')]['messageId']=_0x31f31d['body'][_0xcf52('0x98')];break;}}if(_0x2c2ab6[_0xcf52('0x59')]['id']){delete _0x2c2ab6[_0xcf52('0x59')]['id'];}if(_[_0xcf52('0x99')](_0x2c2ab6[_0xcf52('0x59')]['from'])){throw new db['Sequelize'][(_0xcf52('0x7a'))](_0xcf52('0x9a'));}if(_[_0xcf52('0x99')](_0x2c2ab6[_0xcf52('0x59')]['body'])||_0x2c2ab6['body'][_0xcf52('0x59')]===''){throw new db[(_0xcf52('0x79'))][(_0xcf52('0x7a'))](_0xcf52('0x9b'));}if(_[_0xcf52('0x99')](_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x9c')])){throw new db['Sequelize'][(_0xcf52('0x7a'))](_0xcf52('0x9d')+_0x478acd);}if(!_[_0xcf52('0x9e')](_0x478acd,_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x9c')])){throw new db[(_0xcf52('0x79'))][(_0xcf52('0x7a'))](_0xcf52('0x9f')+_0x478acd);}_0x524933[_0x2c2ab6[_0xcf52('0x59')]['mapKey']]=_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')];return db['CmList'][_0xcf52('0x58')]({'where':{'id':_0x2c2ab6['account'][_0xcf52('0x80')]},'include':[{'model':db[_0xcf52('0xa0')],'as':_0xcf52('0xa1'),'where':_0x524933,'limit':0x1,'order':[['updatedAt',_0xcf52('0xa2')]]}]});})[_0xcf52('0x36')](handleEntityNotFound(_0x1642cf,null))['then'](function(_0x36d5be){if(_0x36d5be){_0x2c2ab6[_0xcf52('0xa3')]=_[_0xcf52('0xa4')](_0x36d5be,[_0xcf52('0xa1')]);if(_0x36d5be[_0xcf52('0xa1')][_0xcf52('0x4a')]){return _0x36d5be['Contacts'][0x0];}var _0x3c565f=_[_0xcf52('0x19')](_0x2c2ab6[_0xcf52('0x59')],{'firstName':_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')],'ListId':_0x36d5be['id']});_0x3c565f[_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x9c')]]=_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')];return db['CmContact'][_0xcf52('0x5f')](_0x3c565f,{'fields':_0x5da344,'raw':!![]});}})[_0xcf52('0x36')](handleEntityNotFound(_0x1642cf,null))['then'](function(_0x2f5e30){if(_0x2f5e30){_0x2c2ab6['contact']=_0x2f5e30;var _0x3d1a8={'ContactId':_0x2f5e30['id'],'phone':_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')],'SmsAccountId':_0x31f31d[_0xcf52('0x57')]['id']};var _0x5ccbaa={'ContactId':_0x2f5e30['id'],'SmsAccountId':_0x31f31d[_0xcf52('0x57')]['id'],'closed':![]};return db[_0xcf52('0xa5')]['find']({'where':_0x5ccbaa})[_0xcf52('0x36')](function(_0x202755){if(_0x202755){return[_0x202755,![]];}return db[_0xcf52('0xa5')][_0xcf52('0x5f')](_0x3d1a8)['then'](function(_0x51ec94){return[_0x51ec94,!![]];});});}})['spread'](function(_0x13c624,_0x29bf79){_0x2c2ab6[_0xcf52('0xa6')]=_0x13c624[_0xcf52('0x37')]({'plain':!![]});_0x2c2ab6[_0xcf52('0xa6')][_0xcf52('0xa7')]=![];if(_0x29bf79){if(_0x2c2ab6[_0xcf52('0x74')][_0xcf52('0xa8')]){_0x2c2ab6['applications']['push']({'id':0x0,'priority':_0x2c2ab6[_0xcf52('0x75')]['length']+0x1,'app':_0xcf52('0xa9'),'appdata':'unmanaged','interval':_0xcf52('0xaa')});}_0x2c2ab6[_0xcf52('0xa6')][_0xcf52('0xa7')]=!![];}return db['SmsMessage'][_0xcf52('0x5f')]({'phone':_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x82')],'messageId':_0x2c2ab6['body'][_0xcf52('0x84')],'body':_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0x59')],'SmsAccountId':_0x31f31d[_0xcf52('0x57')]['id'],'SmsInteractionId':_0x13c624['id'],'direction':'in','ContactId':_0x13c624[_0xcf52('0xab')],'AttachmentId':_0x2c2ab6[_0xcf52('0x59')][_0xcf52('0xac')]});})[_0xcf52('0x36')](function(_0x5c3c77){_0x2c2ab6[_0xcf52('0x27')]=_0x5c3c77;if(!_0x2c2ab6[_0xcf52('0xa6')][_0xcf52('0xad')])return;return db[_0xcf52('0xae')][_0xcf52('0x58')]({'attributes':['id',_0xcf52('0x39')],'where':{'id':_0x2c2ab6[_0xcf52('0xa6')][_0xcf52('0xad')]}});})[_0xcf52('0x36')](function(_0xb9d296){if(_0xb9d296){_0x2c2ab6[_0xcf52('0x75')][_0xcf52('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb9d296[_0xcf52('0x39')]+','+(_0x2c2ab6['account'][_0xcf52('0xb0')]||0xa),'interval':_0xcf52('0xaa')});}if(!_0x2c2ab6['interaction'][_0xcf52('0xb1')])return;return db[_0xcf52('0xb2')]['find']({'attributes':['id',_0xcf52('0x39')],'where':{'id':_0x2c2ab6[_0xcf52('0xa6')][_0xcf52('0xb1')]}});})[_0xcf52('0x36')](function(_0x49e7fb){if(_0x49e7fb){_0x2c2ab6[_0xcf52('0x75')][_0xcf52('0xaf')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x49e7fb['name']+','+(_0x2c2ab6[_0xcf52('0x74')][_0xcf52('0xb3')]||0x12c),'interval':_0xcf52('0xaa')});}return respondWithRpcPromise(_0xcf52('0xb4'),_0xcf52('0xb5'),_0x2c2ab6);})[_0xcf52('0x36')](function(_0x2979a9){if(_0x2979a9){var _0x178420=0xc8;var _0x525305=_0xcf52('0xb6');logger[_0xcf52('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x525305,_0x178420,_0xcf52('0xb7'));logger['debug'](_0xcf52('0xb8'),_0x525305,_0x178420,_0xcf52('0xb7'),JSON[_0xcf52('0x24')](_0x2979a9));if(_0x2c2ab6[_0xcf52('0x74')]['type']===_0xcf52('0x81')){return _0x1642cf['status'](_0x178420)[_0xcf52('0x31')]('Content-Type',_0xcf52('0xb9'))['send'](_0xcf52('0xba'));}else{return _0x1642cf['status'](_0x178420)['json'](_0x2979a9);}}})[_0xcf52('0x55')](handleError(_0x1642cf,null));};exports['addApplications']=function(_0x413ccc,_0xb0ae67){var _0x4712c5=_0x413ccc[_0xcf52('0x57')]['id'];var _0x73bbbd=_0x413ccc['body'];var _0x1a8d8f=0xc8;var _0x1c4ee1=null;return db[_0xcf52('0xbb')][_0xcf52('0xbc')]({'isolationLevel':db[_0xcf52('0xbb')]['Transaction'][_0xcf52('0xbd')]['READ_COMMITTED']},function(_0x164155){return db['SmsAccount'][_0xcf52('0x6d')]({'where':{'id':_0x4712c5},'transaction':_0x164155})[_0xcf52('0x36')](function(_0x834581){if(_0x834581){return db[_0xcf52('0x72')]['destroy']({'where':{'SmsAccountId':_0x4712c5},'transaction':_0x164155})['then'](function(){var _0x40cc09=_['map'](_0x73bbbd,function(_0x19a516){_0x19a516['SmsAccountId']=_0x4712c5;return _0x19a516;});return db[_0xcf52('0x72')]['bulkCreate'](_0x40cc09,{'transaction':_0x164155});});}else{_0x1a8d8f=0x194;_0x1c4ee1=[];}});})[_0xcf52('0x36')](function(){if(_0x1a8d8f!==0x194){return db[_0xcf52('0x72')][_0xcf52('0xbe')]({'where':{'SmsAccountId':_0x4712c5},'order':'priority'})[_0xcf52('0x36')](function(_0xf7ee95){_0x1c4ee1=_0xf7ee95;});}})[_0xcf52('0x55')](function(_0x552d02){_0x1a8d8f=0x1f4;logger[_0xcf52('0x25')](_0x552d02[_0xcf52('0xbf')]);if(_0x552d02[_0xcf52('0x39')]){delete _0x552d02[_0xcf52('0x39')];}_0x1c4ee1=_0x552d02;})[_0xcf52('0xc0')](function(){if(_0x1c4ee1===null){_0xb0ae67[_0xcf52('0x29')](_0x1a8d8f);}else{if(_0x1a8d8f===0x1f4){_0xb0ae67['status'](_0x1a8d8f)[_0xcf52('0xc1')](_0x1c4ee1);}else{_0xb0ae67['status'](_0x1a8d8f)[_0xcf52('0x2c')](_0x1c4ee1);}}});};exports[_0xcf52('0xc2')]=function(_0x22747f,_0x5765db,_0x44013c){var _0x345a56={};var _0x4ba55f={};var _0x15685a;var _0x16b680;return db[_0xcf52('0x3e')][_0xcf52('0x6d')]({'where':{'id':_0x22747f[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x5765db,null))[_0xcf52('0x36')](function(_0x4c46d0){if(_0x4c46d0){_0x15685a=_0x4c46d0;_0x4ba55f[_0xcf52('0x43')]=_['keys'](db[_0xcf52('0x72')][_0xcf52('0x3f')]);_0x4ba55f[_0xcf52('0x45')]=_[_0xcf52('0x44')](_0x22747f[_0xcf52('0x45')]);_0x4ba55f[_0xcf52('0x46')]=_['intersection'](_0x4ba55f[_0xcf52('0x43')],_0x4ba55f[_0xcf52('0x45')]);_0x345a56[_0xcf52('0x49')]=_[_0xcf52('0x47')](_0x4ba55f[_0xcf52('0x43')],qs['fields'](_0x22747f['query'][_0xcf52('0x48')]));_0x345a56[_0xcf52('0x49')]=_0x345a56[_0xcf52('0x49')][_0xcf52('0x4a')]?_0x345a56[_0xcf52('0x49')]:_0x4ba55f[_0xcf52('0x43')];_0x345a56[_0xcf52('0x6e')]=qs['sort'](_0x22747f[_0xcf52('0x45')][_0xcf52('0x4c')]);_0x345a56[_0xcf52('0x4e')]=qs[_0xcf52('0x46')](_[_0xcf52('0x66')](_0x22747f[_0xcf52('0x45')],_0x4ba55f[_0xcf52('0x46')]));if(_0x22747f['query'][_0xcf52('0x50')]){_0x345a56[_0xcf52('0x4e')]=_[_0xcf52('0x4d')](_0x345a56['where'],{'$or':_[_0xcf52('0x3d')](_0x345a56[_0xcf52('0x49')],function(_0x30aeb3){var _0x74ee67={};_0x74ee67[_0x30aeb3]={'$like':'%'+_0x22747f[_0xcf52('0x45')]['filter']+'%'};return _0x74ee67;})});}_0x345a56=_[_0xcf52('0x4d')]({},_0x345a56,_0x22747f['options']);return _0x15685a['getApplications'](_0x345a56);}})[_0xcf52('0x36')](function(_0x1fa556){if(_0x1fa556){_0x16b680=_0x1fa556[_0xcf52('0x4a')];if(!_0x22747f[_0xcf52('0x45')][_0xcf52('0x65')](_0xcf52('0x4b'))){_0x345a56[_0xcf52('0x2f')]=qs['limit'](_0x22747f[_0xcf52('0x45')]['limit']);_0x345a56['offset']=qs['offset'](_0x22747f[_0xcf52('0x45')][_0xcf52('0x2d')]);}return _0x15685a[_0xcf52('0xc2')](_0x345a56);}})[_0xcf52('0x36')](function(_0x436fe5){if(_0x436fe5){return _0x436fe5?{'count':_0x16b680,'rows':_0x436fe5}:null;}})['then'](respondWithResult(_0x5765db,null))[_0xcf52('0x55')](handleError(_0x5765db,null));};exports[_0xcf52('0xc3')]=function(_0x522869,_0x4f68ad,_0x52600c){var _0x2f24c3={'raw':![],'where':{}};var _0x4fc70c={};var _0x337384={'count':0x0,'rows':[]};return db[_0xcf52('0x3e')][_0xcf52('0x6d')]({'where':{'id':_0x522869[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x4f68ad,null))[_0xcf52('0x36')](function(_0xb6f9c){if(_0xb6f9c){_0x4fc70c[_0xcf52('0x43')]=_[_0xcf52('0x44')](db[_0xcf52('0xa5')]['rawAttributes']);_0x4fc70c[_0xcf52('0x45')]=_[_0xcf52('0x44')](_0x522869['query']);_0x4fc70c[_0xcf52('0x46')]=_[_0xcf52('0x47')](_0x4fc70c[_0xcf52('0x43')],_0x4fc70c[_0xcf52('0x45')]);_0x2f24c3[_0xcf52('0x49')]=_[_0xcf52('0x47')](_0x4fc70c[_0xcf52('0x43')],qs[_0xcf52('0x48')](_0x522869[_0xcf52('0x45')]['fields']));_0x2f24c3[_0xcf52('0x49')]=_0x2f24c3[_0xcf52('0x49')][_0xcf52('0x4a')]?_0x2f24c3[_0xcf52('0x49')]:_0x4fc70c['model'];if(!_0x522869['query'][_0xcf52('0x65')](_0xcf52('0x4b'))){_0x2f24c3[_0xcf52('0x2f')]=qs['limit'](_0x522869[_0xcf52('0x45')][_0xcf52('0x2f')]);_0x2f24c3[_0xcf52('0x2d')]=qs[_0xcf52('0x2d')](_0x522869[_0xcf52('0x45')]['offset']);}_0x2f24c3['order']=qs['sort'](_0x522869['query'][_0xcf52('0x4c')]);_0x2f24c3['where']=qs[_0xcf52('0x46')](_[_0xcf52('0x66')](_0x522869['query'],_0x4fc70c[_0xcf52('0x46')]));_0x2f24c3['where'][_0xcf52('0x63')]=_0xb6f9c['id'];if(_0x522869['query'][_0xcf52('0x50')]){_0x2f24c3[_0xcf52('0x4e')]=_['merge'](_0x2f24c3[_0xcf52('0x4e')],{'$or':_[_0xcf52('0x3d')](_0x2f24c3['attributes'],function(_0x3ee841){var _0xc374d4={};_0xc374d4[_0x3ee841]={'$like':'%'+_0x522869[_0xcf52('0x45')]['filter']+'%'};return _0xc374d4;})});}_0x2f24c3=_[_0xcf52('0x4d')]({},_0x2f24c3,_0x522869[_0xcf52('0x51')]);return db[_0xcf52('0xa5')][_0xcf52('0x30')]({'where':_0x2f24c3[_0xcf52('0x4e')]})['then'](function(_0xeb0134){_0x337384[_0xcf52('0x30')]=_0xeb0134;if(_0x522869[_0xcf52('0x45')][_0xcf52('0x52')]){_0x2f24c3[_0xcf52('0x53')]=[{'model':db[_0xcf52('0xa0')],'as':_0xcf52('0xc4'),'required':![]},{'model':db[_0xcf52('0xae')],'as':'Owner','attributes':[_0xcf52('0x39'),_0xcf52('0xc5'),_0xcf52('0xc6')],'required':![]},{'model':db[_0xcf52('0xc7')],'as':_0xcf52('0xc8'),'attributes':['id',_0xcf52('0x39'),_0xcf52('0xc9')],'where':_0x522869['query'][_0xcf52('0xca')]?{'id':_0x522869['query'][_0xcf52('0xca')]}:undefined,'required':_0x522869['query'][_0xcf52('0xca')]?!![]:![]}];}return db['SmsInteraction'][_0xcf52('0x54')](_0x2f24c3);})['then'](function(_0x15eaf5){_0x337384[_0xcf52('0x67')]=_0x15eaf5;return _0x337384;});}})[_0xcf52('0x36')](respondWithFilteredResult(_0x4f68ad,_0x2f24c3))[_0xcf52('0x55')](handleError(_0x4f68ad,null));};exports[_0xcf52('0xc1')]=function(_0x135042,_0x4338ba,_0x28035d){var _0x3ed0e8,_0x5b320f,_0x55f1d7;if(_[_0xcf52('0x99')](_0x135042[_0xcf52('0x59')]['body'])||_0x135042[_0xcf52('0x59')]['body']===''){throw new db[(_0xcf52('0x79'))][(_0xcf52('0x7a'))](_0xcf52('0x9b'));}if(_[_0xcf52('0x99')](_0x135042[_0xcf52('0x59')]['to'])){throw new db[(_0xcf52('0x79'))][(_0xcf52('0x7a'))](_0xcf52('0xcb'));}_0x3ed0e8=_0x135042[_0xcf52('0x59')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x135042[_0xcf52('0x57')]['id']},'include':[{'model':db[_0xcf52('0xcc')],'as':_0xcf52('0xcd'),'include':[{'model':db[_0xcf52('0xa0')],'as':_0xcf52('0xa1'),'where':{'mobile':_0x3ed0e8},'limit':0x1,'order':[[_0xcf52('0x7e'),_0xcf52('0xa2')]]}]}]})[_0xcf52('0x36')](handleEntityNotFound(_0x4338ba,null))[_0xcf52('0x36')](function(_0x3718be){if(_0x3718be&&_0x3718be[_0xcf52('0xcd')]){_0x5b320f=_0x3718be['get']({'plain':!![]});if(_0x5b320f[_0xcf52('0xcd')]&&_0x5b320f['List'][_0xcf52('0xa1')][_0xcf52('0x4a')]){return _0x5b320f['List']['Contacts'][0x0];}return db[_0xcf52('0xa0')][_0xcf52('0x5f')](_['defaults'](_0x135042[_0xcf52('0x59')],{'firstName':_0x3ed0e8,'mobile':_0x3ed0e8,'phone':_0x3ed0e8,'ListId':_0x5b320f[_0xcf52('0x80')]}));}})[_0xcf52('0x36')](handleEntityNotFound(_0x4338ba,null))[_0xcf52('0x36')](function(_0x585c4a){if(_0x585c4a){_0x55f1d7=_0x585c4a;return db[_0xcf52('0xa5')]['find']({'where':{'ContactId':_0x55f1d7['id'],'closed':![],'SmsAccountId':_0x5b320f['id']}})[_0xcf52('0x36')](function(_0x3d35ff){if(_0x3d35ff){return[_0x3d35ff,![]];}return db['SmsInteraction'][_0xcf52('0x5f')]({'UserId':_0x135042[_0xcf52('0x5b')]['id'],'ContactId':_0x55f1d7['id'],'SmsAccountId':_0x5b320f['id'],'phone':_0x3ed0e8,'firstMsgDirection':_0xcf52('0xce'),'Messages':[_[_0xcf52('0x4d')](_0x135042[_0xcf52('0x59')],{'read':![],'body':_0x135042[_0xcf52('0x59')][_0xcf52('0x59')],'phone':_0x3ed0e8,'SmsAccountId':_0x5b320f['id'],'UserId':_0x135042[_0xcf52('0x5b')]['id'],'ContactId':_0x55f1d7['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xcf52('0xcf')}]})[_0xcf52('0x36')](function(_0x32a60e){return[_0x32a60e,!![]];});});}})[_0xcf52('0xd0')](function(_0x28c579,_0x4c7b67){if(_0x4c7b67){return _0x28c579;}return db[_0xcf52('0xd1')]['create'](_[_0xcf52('0x4d')](_0x135042[_0xcf52('0x59')],{'read':![],'body':_0x135042[_0xcf52('0x59')][_0xcf52('0x59')],'phone':_0x3ed0e8,'SmsAccountId':_0x5b320f['id'],'SmsInteractionId':_0x28c579['id'],'UserId':_0x135042['user']['id'],'ContactId':_0x55f1d7['id']}))['then'](function(_0x2fdd05){_0x28c579['dataValues'][_0xcf52('0xcf')]=[];_0x28c579[_0xcf52('0xd2')][_0xcf52('0xcf')][_0xcf52('0xd3')](_0x2fdd05['dataValues']);return _0x28c579;});})[_0xcf52('0x36')](respondWithResult(_0x4338ba,null))[_0xcf52('0x55')](handleError(_0x4338ba,null));};exports[_0xcf52('0x2a')]=function(_0x62f829,_0x48752b,_0xfe99ab){if(_0x62f829[_0xcf52('0x59')]['id']){delete _0x62f829['body']['id'];}var _0xd4adfc,_0x3115a8,_0x181118;return db[_0xcf52('0x3e')]['find']({'where':{'id':_0x62f829[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x48752b,null))[_0xcf52('0x36')](function(_0x592ab6){if(_0x592ab6){_0x181118=_0x592ab6;logger['debug'](_0xcf52('0x23'),_0xcf52('0x2a'),'received\x20delivery\x20report\x20from',_0x592ab6[_0xcf52('0x41')],util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));switch(_0x592ab6[_0xcf52('0x41')]){case _0xcf52('0x85'):if(_0x62f829[_0xcf52('0x59')][_0xcf52('0xd5')]&&_0x62f829[_0xcf52('0x59')]['status']){_0x3115a8=_0x62f829[_0xcf52('0x59')][_0xcf52('0x2a')];return db['SmsMessage'][_0xcf52('0x58')]({'where':{'messageId':_0x62f829['body']['skebby_dispatch_id']}});}break;case _0xcf52('0x88'):if(_0x62f829[_0xcf52('0x59')][_0xcf52('0xd6')]&&_0x62f829[_0xcf52('0x59')][_0xcf52('0xd7')]){_0x3115a8=_0x62f829[_0xcf52('0x59')]['statusInt'];return db['SmsMessage'][_0xcf52('0x58')]({'where':{'messageId':_0x62f829['body'][_0xcf52('0xd6')]}});}break;case _0xcf52('0x89'):if(_0x62f829['body'][_0xcf52('0x8a')]&&_0x62f829[_0xcf52('0x59')][_0xcf52('0xd8')]){_0x3115a8=_0x62f829[_0xcf52('0x59')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x62f829[_0xcf52('0x59')]['message_id']}});}break;case _0xcf52('0x8e'):var _0x17c970=_0x62f829[_0xcf52('0x59')][_0xcf52('0x8f')][0x0];if(_0x17c970[_0xcf52('0x84')]&&_0x17c970[_0xcf52('0x2a')][_0xcf52('0xd9')]===_0xcf52('0xda')){_0x3115a8=_0x17c970[_0xcf52('0x2a')]['groupName'];return db[_0xcf52('0xd1')][_0xcf52('0x58')]({'where':{'messageId':_0x17c970[_0xcf52('0x84')]}});}break;case _0xcf52('0x93'):if(_0x62f829[_0xcf52('0x59')][_0xcf52('0x84')]&&_0x62f829[_0xcf52('0x59')][_0xcf52('0x2a')]){_0x3115a8=_0x62f829['body'][_0xcf52('0x2a')];return db[_0xcf52('0xd1')][_0xcf52('0x58')]({'where':{'messageId':_0x62f829[_0xcf52('0x59')][_0xcf52('0x84')]}});}break;case _0xcf52('0x96'):if(_0x62f829['body'][0x0][_0xcf52('0x27')]['id']){_0x3115a8=_0x62f829[_0xcf52('0x59')][0x0]['type'];return db[_0xcf52('0xd1')][_0xcf52('0x58')]({'where':{'messageId':_0x62f829[_0xcf52('0x59')][0x0][_0xcf52('0x27')]['id']}});}break;case _0xcf52('0x97'):if(_0x62f829[_0xcf52('0x59')][_0xcf52('0xdb')]&&_0x62f829['body']['status']){_0x3115a8=_0x62f829['body']['status'];return db[_0xcf52('0xd1')][_0xcf52('0x58')]({'where':{'messageId':_0x62f829[_0xcf52('0x59')][_0xcf52('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x48752b,null))[_0xcf52('0x36')](function(_0x2eed09){if(_0x2eed09){_0xd4adfc=_0x2eed09;switch(_0x181118['type']){case _0xcf52('0x85'):if(_0x3115a8===_0xcf52('0xda')){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger['error'](_0xcf52('0x23'),_0xcf52('0x2a'),'skebby',util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case _0xcf52('0x88'):if(_0x3115a8==='1'){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xcf52('0x85'),util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case _0xcf52('0x89'):if(!_0x62f829['body']['error_code']&&_0x3115a8>=0xc8&&_0x3115a8<=0xce){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf52('0x2a'),'clicksend',util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case _0xcf52('0x8e'):var _0x36e2de=_0x62f829[_0xcf52('0x59')][_0xcf52('0x8f')][0x0];if(_0x36e2de[_0xcf52('0x2a')][_0xcf52('0xd9')]===_0xcf52('0xda')){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')](_0xcf52('0x23'),'status',_0xcf52('0x8e'),util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case _0xcf52('0x93'):if(_0x3115a8==_0xcf52('0xdc')||_0x3115a8=='RECEIVED_BY_RECIPIENT'){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')](_0xcf52('0x23'),'status',_0xcf52('0x93'),util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case _0xcf52('0x96'):if(_0x3115a8==_0xcf52('0xdd')){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf52('0x2a'),_0xcf52('0x96'),util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3115a8===_0xcf52('0xde')||_0x3115a8==='ACCEPTD'){return _0xd4adfc[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')](_0xcf52('0x23'),'status',_0xcf52('0x97'),util[_0xcf52('0xd4')](_0x62f829[_0xcf52('0x59')],{'showHidden':![],'depth':null}));}break;}return _0xd4adfc;}})[_0xcf52('0x36')](respondWithResult(_0x48752b,null))[_0xcf52('0x55')](handleError(_0x48752b,null));};exports[_0xcf52('0xdf')]=function(_0x319da3,_0x272aa5,_0x544676){var _0x3e22a3,_0x2fcf89,_0x4b8d48;return db['SmsAccount'][_0xcf52('0x58')]({'where':{'id':_0x319da3['params']['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x272aa5,null))[_0xcf52('0x36')](function(_0xc48218){if(_0xc48218){_0x4b8d48=_0xc48218;logger[_0xcf52('0x22')](_0xcf52('0x23'),_0xcf52('0x2a'),'received\x20delivery\x20report\x20from',_0xc48218[_0xcf52('0x41')],util[_0xcf52('0xd4')](_0x319da3['query'],{'showHidden':![],'depth':null}));switch(_0xc48218[_0xcf52('0x41')]){case _0xcf52('0x90'):if(_0x319da3['query'][_0xcf52('0xe0')]&&_0x319da3[_0xcf52('0x45')]['state']){_0x2fcf89=_0x319da3['query'][_0xcf52('0xe1')];return db[_0xcf52('0xd1')][_0xcf52('0x58')]({'where':{'messageId':_0x319da3[_0xcf52('0x45')][_0xcf52('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x272aa5,null))[_0xcf52('0x36')](function(_0xb91249){if(_0xb91249){_0x3e22a3=_0xb91249;switch(_0x4b8d48[_0xcf52('0x41')]){case _0xcf52('0x90'):if(_0x2fcf89==='2'||_0x2fcf89==='6'){return _0x3e22a3[_0xcf52('0x35')]({'read':!![]});}else{logger[_0xcf52('0x25')](_0xcf52('0x23'),_0xcf52('0x2a'),_0xcf52('0x90'),util[_0xcf52('0xd4')](_0x319da3['query'],{'showHidden':![],'depth':null}));};break;}return _0x3e22a3;}})[_0xcf52('0x36')](respondWithResult(_0x272aa5,null))[_0xcf52('0x55')](handleError(_0x272aa5,null));};exports[_0xcf52('0xe2')]=function(_0x1fcd1b,_0x37ec65,_0xbc3a05){return db[_0xcf52('0x3e')]['find']({'where':{'id':_0x1fcd1b[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x37ec65,null))['then'](function(_0x4ab30f){if(_0x4ab30f){return _0x4ab30f[_0xcf52('0xe2')](_0x1fcd1b[_0xcf52('0x59')][_0xcf52('0x69')],_[_0xcf52('0xa4')](_0x1fcd1b[_0xcf52('0x59')],[_0xcf52('0x69'),'id'])||{})[_0xcf52('0xd0')](function(_0xe2ba56){for(var _0x297740=0x0;_0x297740<_0x1fcd1b[_0xcf52('0x59')][_0xcf52('0x69')][_0xcf52('0x4a')];_0x297740+=0x1){socket['emit'](_0xcf52('0xe3'),{'UserId':Number(_0x1fcd1b[_0xcf52('0x59')]['ids'][_0x297740]),'SmsAccountId':Number(_0x1fcd1b['params']['id'])});}return _0xe2ba56;});}})[_0xcf52('0x36')](respondWithResult(_0x37ec65,null))[_0xcf52('0x55')](handleError(_0x37ec65,null));};exports[_0xcf52('0xe4')]=function(_0x2739f0,_0x5845fe,_0x123d65){return db[_0xcf52('0x3e')][_0xcf52('0x58')]({'where':{'id':_0x2739f0[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x5845fe,null))[_0xcf52('0x36')](function(_0x115ed3){if(_0x115ed3){return _0x115ed3[_0xcf52('0xe4')](_0x2739f0['query'][_0xcf52('0x69')])['then'](function(){if(_['isArray'](_0x2739f0['query'][_0xcf52('0x69')])){for(var _0x44b7ae=0x0;_0x44b7ae<_0x2739f0['query'][_0xcf52('0x69')][_0xcf52('0x4a')];_0x44b7ae+=0x1){socket[_0xcf52('0xe5')](_0xcf52('0xe6'),{'UserId':Number(_0x2739f0['query']['ids'][_0x44b7ae]),'SmsAccountId':Number(_0x2739f0[_0xcf52('0x57')]['id'])});}}else{socket[_0xcf52('0xe5')](_0xcf52('0xe6'),{'UserId':Number(_0x2739f0[_0xcf52('0x45')][_0xcf52('0x69')]),'SmsAccountId':Number(_0x2739f0[_0xcf52('0x57')]['id'])});}});}})[_0xcf52('0x36')](respondWithStatusCode(_0x5845fe,null))[_0xcf52('0x55')](handleError(_0x5845fe,null));};exports[_0xcf52('0xe7')]=function(_0x543f16,_0x5320ce,_0x331cdd){var _0x4b1898={};var _0x326e8f={};var _0x8f240c;var _0x1cd931;return db[_0xcf52('0x3e')]['findOne']({'where':{'id':_0x543f16[_0xcf52('0x57')]['id']}})[_0xcf52('0x36')](handleEntityNotFound(_0x5320ce,null))[_0xcf52('0x36')](function(_0x4afe4e){if(_0x4afe4e){_0x8f240c=_0x4afe4e;_0x326e8f[_0xcf52('0x43')]=_['keys'](db[_0xcf52('0xae')][_0xcf52('0x3f')]);_0x326e8f['query']=_[_0xcf52('0x44')](_0x543f16['query']);_0x326e8f['filters']=_[_0xcf52('0x47')](_0x326e8f['model'],_0x326e8f[_0xcf52('0x45')]);_0x4b1898[_0xcf52('0x49')]=_[_0xcf52('0x47')](_0x326e8f[_0xcf52('0x43')],qs[_0xcf52('0x48')](_0x543f16[_0xcf52('0x45')][_0xcf52('0x48')]));_0x4b1898[_0xcf52('0x49')]=_0x4b1898[_0xcf52('0x49')][_0xcf52('0x4a')]?_0x4b1898[_0xcf52('0x49')]:_0x326e8f[_0xcf52('0x43')];_0x4b1898[_0xcf52('0x6e')]=qs[_0xcf52('0x4c')](_0x543f16[_0xcf52('0x45')][_0xcf52('0x4c')]);_0x4b1898['where']=qs[_0xcf52('0x46')](_[_0xcf52('0x66')](_0x543f16[_0xcf52('0x45')],_0x326e8f['filters']));if(_0x543f16[_0xcf52('0x45')][_0xcf52('0x50')]){_0x4b1898[_0xcf52('0x4e')]=_['merge'](_0x4b1898[_0xcf52('0x4e')],{'$or':_[_0xcf52('0x3d')](_0x4b1898[_0xcf52('0x49')],function(_0x506fef){var _0x2ddec3={};_0x2ddec3[_0x506fef]={'$like':'%'+_0x543f16['query'][_0xcf52('0x50')]+'%'};return _0x2ddec3;})});}_0x4b1898=_[_0xcf52('0x4d')]({},_0x4b1898,_0x543f16[_0xcf52('0x51')]);return _0x8f240c['getAgents'](_0x4b1898);}})[_0xcf52('0x36')](function(_0x5239d4){if(_0x5239d4){_0x1cd931=_0x5239d4[_0xcf52('0x4a')];if(!_0x543f16[_0xcf52('0x45')][_0xcf52('0x65')](_0xcf52('0x4b'))){_0x4b1898['limit']=qs['limit'](_0x543f16[_0xcf52('0x45')]['limit']);_0x4b1898['offset']=qs['offset'](_0x543f16[_0xcf52('0x45')][_0xcf52('0x2d')]);}return _0x8f240c['getAgents'](_0x4b1898);}})['then'](function(_0x3190eb){if(_0x3190eb){return _0x3190eb?{'count':_0x1cd931,'rows':_0x3190eb}:null;}})['then'](respondWithResult(_0x5320ce,null))[_0xcf52('0x55')](handleError(_0x5320ce,null));}; \ No newline at end of file +var _0xb36e=['skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','intelepeer','DELIVRD','ACCEPTD','statusGet','message-id','state','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','stack','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','fields','length','find','create','body','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','mobile','twilio','From','messageId','MessageSid','skebby','from','sender','text','connectel','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','updatedAt','list','omit','contact','SmsInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','User','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','ListId','out','SmsMessage','Messages','spread','dataValues','inspect'];(function(_0x63e45,_0x29e292){var _0x4b01f9=function(_0x5b3b5d){while(--_0x5b3b5d){_0x63e45['push'](_0x63e45['shift']());}};_0x4b01f9(++_0x29e292);}(_0xb36e,0xfc));var _0xeb36=function(_0x5457f1,_0x510e5f){_0x5457f1=_0x5457f1-0x0;var _0x1147ff=_0xb36e[_0x5457f1];return _0x1147ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeb36('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb36('0x1'));var moment=require(_0xeb36('0x2'));var BPromise=require(_0xeb36('0x3'));var Mustache=require(_0xeb36('0x4'));var util=require(_0xeb36('0x5'));var path=require(_0xeb36('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb36('0x7'));var _=require(_0xeb36('0x8'));var squel=require(_0xeb36('0x9'));var crypto=require(_0xeb36('0xa'));var jsforce=require(_0xeb36('0xb'));var deskjs=require(_0xeb36('0xc'));var toCsv=require(_0xeb36('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb36('0xe'));var authService=require(_0xeb36('0xf'));var qs=require(_0xeb36('0x10'));var as=require(_0xeb36('0x11'));var hardwareService=require(_0xeb36('0x12'));var logger=require(_0xeb36('0x13'))(_0xeb36('0x14'));var utils=require(_0xeb36('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xeb36('0x16')]=_[_0xeb36('0x17')](config[_0xeb36('0x16')],{'host':_0xeb36('0x18'),'port':0x18eb});var socket=require(_0xeb36('0x19'))(new Redis(config[_0xeb36('0x16')]));require(_0xeb36('0x1a'))[_0xeb36('0x1b')](socket);var jayson=require(_0xeb36('0x1c'));var client=jayson[_0xeb36('0x1d')][_0xeb36('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1f63aa,_0x501b6c,_0x4d10fc,_0x232fcb){return new BPromise(function(_0x4b1fa7,_0x534332){var _0xf07f3f=_0x232fcb||client;return _0xf07f3f[_0xeb36('0x1f')](_0x1f63aa,_0x4d10fc)[_0xeb36('0x20')](function(_0x39410d){logger[_0xeb36('0x21')](_0xeb36('0x22'),_0x501b6c,'request\x20sent');logger[_0xeb36('0x23')](_0xeb36('0x24'),_0x501b6c,'request\x20sent',JSON[_0xeb36('0x25')](_0x39410d));if(_0x39410d[_0xeb36('0x26')]){if(_0x39410d[_0xeb36('0x26')]['code']===0x1f4){logger[_0xeb36('0x26')](_0xeb36('0x22'),_0x501b6c,_0x39410d['error'][_0xeb36('0x27')]);return _0x534332(_0x39410d[_0xeb36('0x26')][_0xeb36('0x27')]);}logger[_0xeb36('0x26')](_0xeb36('0x22'),_0x501b6c,_0x39410d['error'][_0xeb36('0x27')]);return _0x4b1fa7(_0x39410d[_0xeb36('0x26')][_0xeb36('0x27')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x501b6c,_0xeb36('0x28'));_0x4b1fa7(_0x39410d[_0xeb36('0x29')][_0xeb36('0x27')]);}})['catch'](function(_0xb3220d){logger[_0xeb36('0x26')](_0xeb36('0x22'),_0x501b6c,_0xb3220d);_0x534332(_0xb3220d);});});}function respondWithStatusCode(_0x41f08b,_0x3f8aae){_0x3f8aae=_0x3f8aae||0xcc;return function(_0x5b9b53){if(_0x5b9b53){return _0x41f08b[_0xeb36('0x2a')](_0x3f8aae);}return _0x41f08b['status'](_0x3f8aae)[_0xeb36('0x2b')]();};}function respondWithResult(_0xfa1857,_0x25b1d0){_0x25b1d0=_0x25b1d0||0xc8;return function(_0x3eed9e){if(_0x3eed9e){return _0xfa1857[_0xeb36('0x2c')](_0x25b1d0)[_0xeb36('0x2d')](_0x3eed9e);}};}function respondWithFilteredResult(_0x1ae4c4,_0x1e95ef){return function(_0x43f99b){if(_0x43f99b){var _0x1326e4=typeof _0x1e95ef[_0xeb36('0x2e')]==='undefined'&&typeof _0x1e95ef[_0xeb36('0x2f')]===_0xeb36('0x30');var _0x40b643=_0x43f99b[_0xeb36('0x31')];var _0x295469=_0x1326e4?0x0:_0x1e95ef['offset'];var _0x3ec59d=_0x1326e4?_0x43f99b[_0xeb36('0x31')]:_0x1e95ef['offset']+_0x1e95ef[_0xeb36('0x2f')];var _0x3b239a;if(_0x3ec59d>=_0x40b643){_0x3ec59d=_0x40b643;_0x3b239a=0xc8;}else{_0x3b239a=0xce;}_0x1ae4c4[_0xeb36('0x2c')](_0x3b239a);return _0x1ae4c4['set'](_0xeb36('0x32'),_0x295469+'-'+_0x3ec59d+'/'+_0x40b643)[_0xeb36('0x2d')](_0x43f99b);}return null;};}function patchUpdates(_0x327206){return function(_0x3e48df){try{jsonpatch[_0xeb36('0x33')](_0x3e48df,_0x327206,!![]);}catch(_0x15d0ac){return BPromise[_0xeb36('0x34')](_0x15d0ac);}return _0x3e48df[_0xeb36('0x35')]();};}function saveUpdates(_0x5b1dcd,_0x5da9e5){return function(_0x1c5a20){if(_0x1c5a20){return _0x1c5a20[_0xeb36('0x36')](_0x5b1dcd)[_0xeb36('0x20')](function(_0x300c29){return _0x300c29;});}return null;};}function removeEntity(_0x1ebf5,_0x3ee9b4){return function(_0x54f06f){if(_0x54f06f){return _0x54f06f[_0xeb36('0x37')]()['then'](function(){var _0x50d2fe=_0x54f06f[_0xeb36('0x38')]({'plain':!![]});var _0x4d9995='SmsAccounts';return db['UserProfileResource'][_0xeb36('0x37')]({'where':{'type':_0x4d9995,'resourceId':_0x50d2fe['id']}})[_0xeb36('0x20')](function(){return _0x54f06f;});})[_0xeb36('0x20')](function(){_0x1ebf5[_0xeb36('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x382771,_0x35e6dc){return function(_0x2cb394){if(!_0x2cb394){_0x382771[_0xeb36('0x2a')](0x194);}return _0x2cb394;};}function handleError(_0x4d29c4,_0x3b8d24){_0x3b8d24=_0x3b8d24||0x1f4;return function(_0x48b7f0){logger['error'](_0x48b7f0[_0xeb36('0x39')]);if(_0x48b7f0['name']){delete _0x48b7f0[_0xeb36('0x3a')];}_0x4d29c4[_0xeb36('0x2c')](_0x3b8d24)['send'](_0x48b7f0);};}exports['index']=function(_0x338400,_0x500e42){var _0x58ae56={'include':[{'model':db[_0xeb36('0x3b')],'as':_0xeb36('0x3c')}]},_0x17299b={},_0x15b254={'count':0x0,'rows':[]};var _0x817159=_[_0xeb36('0x3d')](db[_0xeb36('0x3e')][_0xeb36('0x3f')],function(_0x5087af){return{'name':_0x5087af[_0xeb36('0x40')],'type':_0x5087af[_0xeb36('0x41')][_0xeb36('0x42')]};});_0x17299b[_0xeb36('0x43')]=_[_0xeb36('0x3d')](_0x817159,'name');_0x17299b[_0xeb36('0x44')]=_['keys'](_0x338400[_0xeb36('0x44')]);_0x17299b[_0xeb36('0x45')]=_[_0xeb36('0x46')](_0x17299b['model'],_0x17299b[_0xeb36('0x44')]);_0x58ae56['attributes']=_[_0xeb36('0x46')](_0x17299b['model'],qs['fields'](_0x338400[_0xeb36('0x44')]['fields']));_0x58ae56['attributes']=_0x58ae56[_0xeb36('0x47')]['length']?_0x58ae56[_0xeb36('0x47')]:_0x17299b['model'];if(!_0x338400['query']['hasOwnProperty'](_0xeb36('0x48'))){_0x58ae56[_0xeb36('0x2f')]=qs[_0xeb36('0x2f')](_0x338400['query']['limit']);_0x58ae56['offset']=qs['offset'](_0x338400[_0xeb36('0x44')]['offset']);}_0x58ae56[_0xeb36('0x49')]=qs[_0xeb36('0x4a')](_0x338400['query']['sort']);_0x58ae56[_0xeb36('0x4b')]=qs[_0xeb36('0x45')](_['pick'](_0x338400[_0xeb36('0x44')],_0x17299b[_0xeb36('0x45')]),_0x817159);if(_0x338400[_0xeb36('0x44')][_0xeb36('0x4c')]){_0x58ae56['where']=_['merge'](_0x58ae56[_0xeb36('0x4b')],{'$or':_[_0xeb36('0x3d')](_0x817159,function(_0xacd178){if(_0xacd178[_0xeb36('0x41')]!==_0xeb36('0x4d')){var _0x5aeb15={};_0x5aeb15[_0xacd178['name']]={'$like':'%'+_0x338400[_0xeb36('0x44')][_0xeb36('0x4c')]+'%'};return _0x5aeb15;}})});}_0x58ae56=_[_0xeb36('0x4e')]({},_0x58ae56,_0x338400[_0xeb36('0x4f')]);var _0x3f97fc={'where':_0x58ae56[_0xeb36('0x4b')]};return db['SmsAccount'][_0xeb36('0x31')](_0x3f97fc)['then'](function(_0x345cbf){_0x15b254[_0xeb36('0x31')]=_0x345cbf;if(_0x338400[_0xeb36('0x44')][_0xeb36('0x50')]){_0x58ae56[_0xeb36('0x51')]=[{'all':!![]}];}return db[_0xeb36('0x3e')]['findAll'](_0x58ae56);})[_0xeb36('0x20')](function(_0x3376b8){_0x15b254[_0xeb36('0x52')]=_0x3376b8;return _0x15b254;})[_0xeb36('0x20')](respondWithFilteredResult(_0x500e42,_0x58ae56))[_0xeb36('0x53')](handleError(_0x500e42,null));};exports['show']=function(_0x53414b,_0xdcd35){var _0x290c2e={'raw':![],'where':{'id':_0x53414b[_0xeb36('0x54')]['id']},'include':[{'model':db[_0xeb36('0x3b')],'as':_0xeb36('0x3c')}]},_0x192f15={};_0x192f15[_0xeb36('0x43')]=_[_0xeb36('0x55')](db['SmsAccount'][_0xeb36('0x3f')]);_0x192f15[_0xeb36('0x44')]=_['keys'](_0x53414b[_0xeb36('0x44')]);_0x192f15[_0xeb36('0x45')]=_[_0xeb36('0x46')](_0x192f15[_0xeb36('0x43')],_0x192f15[_0xeb36('0x44')]);_0x290c2e[_0xeb36('0x47')]=_[_0xeb36('0x46')](_0x192f15[_0xeb36('0x43')],qs[_0xeb36('0x56')](_0x53414b[_0xeb36('0x44')][_0xeb36('0x56')]));_0x290c2e['attributes']=_0x290c2e['attributes'][_0xeb36('0x57')]?_0x290c2e[_0xeb36('0x47')]:_0x192f15[_0xeb36('0x43')];if(_0x53414b[_0xeb36('0x44')][_0xeb36('0x50')]){_0x290c2e[_0xeb36('0x51')]=[{'all':!![]}];}_0x290c2e=_[_0xeb36('0x4e')]({},_0x290c2e,_0x53414b['options']);return db[_0xeb36('0x3e')][_0xeb36('0x58')](_0x290c2e)[_0xeb36('0x20')](handleEntityNotFound(_0xdcd35,null))[_0xeb36('0x20')](respondWithResult(_0xdcd35,null))['catch'](handleError(_0xdcd35,null));};exports[_0xeb36('0x59')]=function(_0x89e6ca,_0x5d255d){return db['SmsAccount'][_0xeb36('0x59')](_0x89e6ca[_0xeb36('0x5a')],{})[_0xeb36('0x20')](function(_0x5982c9){var _0x1ca214=_0x89e6ca[_0xeb36('0x5b')]['get']({'plain':!![]});if(!_0x1ca214)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ca214['role']===_0xeb36('0x5b')){var _0x3f2d57=_0x5982c9[_0xeb36('0x38')]({'plain':!![]});var _0x3af5cf=_0xeb36('0x5c');return db[_0xeb36('0x5d')][_0xeb36('0x58')]({'where':{'name':_0x3af5cf,'userProfileId':_0x1ca214[_0xeb36('0x5e')]},'raw':!![]})[_0xeb36('0x20')](function(_0xea7e5c){if(_0xea7e5c&&_0xea7e5c[_0xeb36('0x5f')]===0x0){return db['UserProfileResource'][_0xeb36('0x59')]({'name':_0x3f2d57['name'],'resourceId':_0x3f2d57['id'],'type':_0xea7e5c[_0xeb36('0x3a')],'sectionId':_0xea7e5c['id']},{})['then'](function(){return _0x5982c9;});}else{return _0x5982c9;}})[_0xeb36('0x53')](function(_0x218e31){logger[_0xeb36('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x218e31);throw _0x218e31;});}return _0x5982c9;})[_0xeb36('0x20')](respondWithResult(_0x5d255d,0xc9))[_0xeb36('0x53')](handleError(_0x5d255d,null));};exports[_0xeb36('0x36')]=function(_0x5bf926,_0x4bdcf5){if(_0x5bf926['body']['id']){delete _0x5bf926[_0xeb36('0x5a')]['id'];}return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x5bf926[_0xeb36('0x54')]['id']},'include':[{'model':db[_0xeb36('0x3b')],'as':_0xeb36('0x3c')}]})[_0xeb36('0x20')](handleEntityNotFound(_0x4bdcf5,null))['then'](saveUpdates(_0x5bf926['body'],null))['then'](respondWithResult(_0x4bdcf5,null))['catch'](handleError(_0x4bdcf5,null));};exports['destroy']=function(_0x1de401,_0x25b544){return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x1de401[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x25b544,null))[_0xeb36('0x20')](removeEntity(_0x25b544,null))[_0xeb36('0x53')](handleError(_0x25b544,null));};exports['describe']=function(_0x5cf232,_0x1f7224){return db[_0xeb36('0x3e')][_0xeb36('0x60')]()[_0xeb36('0x20')](respondWithResult(_0x1f7224,null))[_0xeb36('0x53')](handleError(_0x1f7224,null));};exports[_0xeb36('0x61')]=function(_0x2c638f,_0x25453d,_0x478412){if(_0x2c638f['body']['id']){delete _0x2c638f[_0xeb36('0x5a')]['id'];}return db[_0xeb36('0x3e')]['find']({'where':{'id':_0x2c638f['params']['id']}})['then'](handleEntityNotFound(_0x25453d,null))[_0xeb36('0x20')](function(_0x7dfb2a){if(_0x7dfb2a){_0x2c638f[_0xeb36('0x5a')]['SmsAccountId']=_0x7dfb2a['id'];return db[_0xeb36('0x62')][_0xeb36('0x59')](_0x2c638f[_0xeb36('0x5a')]);}})[_0xeb36('0x20')](respondWithResult(_0x25453d,null))[_0xeb36('0x53')](handleError(_0x25453d,null));};exports[_0xeb36('0x63')]=function(_0x7c0366,_0xeb98b2,_0xc8985b){var _0x19f140={'raw':![],'where':{}};var _0x48964c={};var _0x17d1bd={'count':0x0,'rows':[]};return db[_0xeb36('0x3e')]['findOne']({'where':{'id':_0x7c0366['params']['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0xeb98b2,null))[_0xeb36('0x20')](function(_0x54cd2c){if(_0x54cd2c){_0x48964c[_0xeb36('0x43')]=_[_0xeb36('0x55')](db[_0xeb36('0x62')]['rawAttributes']);_0x48964c[_0xeb36('0x44')]=_[_0xeb36('0x55')](_0x7c0366[_0xeb36('0x44')]);_0x48964c['filters']=_[_0xeb36('0x46')](_0x48964c['model'],_0x48964c[_0xeb36('0x44')]);_0x19f140['attributes']=_['intersection'](_0x48964c['model'],qs['fields'](_0x7c0366[_0xeb36('0x44')][_0xeb36('0x56')]));_0x19f140[_0xeb36('0x47')]=_0x19f140['attributes'][_0xeb36('0x57')]?_0x19f140[_0xeb36('0x47')]:_0x48964c[_0xeb36('0x43')];if(!_0x7c0366['query'][_0xeb36('0x64')](_0xeb36('0x48'))){_0x19f140[_0xeb36('0x2f')]=qs[_0xeb36('0x2f')](_0x7c0366[_0xeb36('0x44')]['limit']);_0x19f140[_0xeb36('0x2e')]=qs['offset'](_0x7c0366['query'][_0xeb36('0x2e')]);}_0x19f140[_0xeb36('0x49')]=qs[_0xeb36('0x4a')](_0x7c0366[_0xeb36('0x44')][_0xeb36('0x4a')]);_0x19f140[_0xeb36('0x4b')]=qs[_0xeb36('0x45')](_['pick'](_0x7c0366[_0xeb36('0x44')],_0x48964c[_0xeb36('0x45')]));_0x19f140[_0xeb36('0x4b')][_0xeb36('0x65')]=_0x54cd2c['id'];if(_0x7c0366[_0xeb36('0x44')]['filter']){_0x19f140[_0xeb36('0x4b')]=_['merge'](_0x19f140[_0xeb36('0x4b')],{'$or':_['map'](_0x19f140[_0xeb36('0x47')],function(_0x5e1e10){var _0x2590ca={};_0x2590ca[_0x5e1e10]={'$like':'%'+_0x7c0366[_0xeb36('0x44')][_0xeb36('0x4c')]+'%'};return _0x2590ca;})});}_0x19f140=_[_0xeb36('0x4e')]({},_0x19f140,_0x7c0366['options']);return db[_0xeb36('0x62')][_0xeb36('0x31')]({'where':_0x19f140['where']})[_0xeb36('0x20')](function(_0x4964c1){_0x17d1bd['count']=_0x4964c1;if(_0x7c0366[_0xeb36('0x44')][_0xeb36('0x50')]){_0x19f140[_0xeb36('0x51')]=[{'all':!![]}];}return db[_0xeb36('0x62')][_0xeb36('0x66')](_0x19f140);})[_0xeb36('0x20')](function(_0x113e89){_0x17d1bd[_0xeb36('0x52')]=_0x113e89;return _0x17d1bd;});}})['then'](respondWithFilteredResult(_0xeb98b2,_0x19f140))[_0xeb36('0x53')](handleError(_0xeb98b2,null));};exports[_0xeb36('0x67')]=function(_0x3de024,_0x4cfe02,_0x4a98cf){return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x3de024[_0xeb36('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cfe02,null))[_0xeb36('0x20')](function(_0x4138bb){if(_0x4138bb){return _0x4138bb[_0xeb36('0x67')](_0x3de024['query'][_0xeb36('0x68')]);}})['then'](respondWithStatusCode(_0x4cfe02,null))[_0xeb36('0x53')](handleError(_0x4cfe02,null));};exports[_0xeb36('0x69')]=function(_0x2d9628,_0x64959a,_0x9f356f){if(_0x2d9628[_0xeb36('0x5a')]['id']){delete _0x2d9628[_0xeb36('0x5a')]['id'];}return db['SmsAccount'][_0xeb36('0x58')]({'where':{'id':_0x2d9628[_0xeb36('0x54')]['id']}})['then'](handleEntityNotFound(_0x64959a,null))[_0xeb36('0x20')](function(_0x5cab2c){if(_0x5cab2c){_0x2d9628[_0xeb36('0x5a')]['SmsAccountId']=_0x5cab2c['id'];return db[_0xeb36('0x6a')][_0xeb36('0x59')](_0x2d9628['body']);}})[_0xeb36('0x20')](respondWithResult(_0x64959a,null))['catch'](handleError(_0x64959a,null));};exports[_0xeb36('0x6b')]=function(_0x3542d0,_0x59f9bc,_0x461633){var _0x26707c={'raw':![],'where':{}};var _0x585e4d={};var _0x4aaf23={'count':0x0,'rows':[]};return db[_0xeb36('0x3e')][_0xeb36('0x6c')]({'where':{'id':_0x3542d0[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x59f9bc,null))[_0xeb36('0x20')](function(_0x2cc5ef){if(_0x2cc5ef){_0x585e4d['model']=_['keys'](db[_0xeb36('0x6a')][_0xeb36('0x3f')]);_0x585e4d[_0xeb36('0x44')]=_['keys'](_0x3542d0['query']);_0x585e4d[_0xeb36('0x45')]=_[_0xeb36('0x46')](_0x585e4d['model'],_0x585e4d[_0xeb36('0x44')]);_0x26707c['attributes']=_[_0xeb36('0x46')](_0x585e4d['model'],qs[_0xeb36('0x56')](_0x3542d0[_0xeb36('0x44')][_0xeb36('0x56')]));_0x26707c['attributes']=_0x26707c[_0xeb36('0x47')][_0xeb36('0x57')]?_0x26707c[_0xeb36('0x47')]:_0x585e4d[_0xeb36('0x43')];if(!_0x3542d0[_0xeb36('0x44')]['hasOwnProperty'](_0xeb36('0x48'))){_0x26707c[_0xeb36('0x2f')]=qs[_0xeb36('0x2f')](_0x3542d0[_0xeb36('0x44')]['limit']);_0x26707c[_0xeb36('0x2e')]=qs[_0xeb36('0x2e')](_0x3542d0[_0xeb36('0x44')]['offset']);}_0x26707c['order']=qs[_0xeb36('0x4a')](_0x3542d0[_0xeb36('0x44')][_0xeb36('0x4a')]);_0x26707c[_0xeb36('0x4b')]=qs[_0xeb36('0x45')](_[_0xeb36('0x6d')](_0x3542d0['query'],_0x585e4d[_0xeb36('0x45')]));_0x26707c[_0xeb36('0x4b')][_0xeb36('0x65')]=_0x2cc5ef['id'];if(_0x3542d0['query'][_0xeb36('0x4c')]){_0x26707c[_0xeb36('0x4b')]=_['merge'](_0x26707c[_0xeb36('0x4b')],{'$or':_[_0xeb36('0x3d')](_0x26707c[_0xeb36('0x47')],function(_0x4fd44){var _0x4e64b5={};_0x4e64b5[_0x4fd44]={'$like':'%'+_0x3542d0[_0xeb36('0x44')][_0xeb36('0x4c')]+'%'};return _0x4e64b5;})});}_0x26707c=_[_0xeb36('0x4e')]({},_0x26707c,_0x3542d0[_0xeb36('0x4f')]);return db['CannedAnswer'][_0xeb36('0x31')]({'where':_0x26707c['where']})[_0xeb36('0x20')](function(_0x4e3025){_0x4aaf23[_0xeb36('0x31')]=_0x4e3025;if(_0x3542d0['query'][_0xeb36('0x50')]){_0x26707c[_0xeb36('0x51')]=[{'all':!![]}];}return db[_0xeb36('0x6a')][_0xeb36('0x66')](_0x26707c);})[_0xeb36('0x20')](function(_0x41536e){_0x4aaf23[_0xeb36('0x52')]=_0x41536e;return _0x4aaf23;});}})[_0xeb36('0x20')](respondWithFilteredResult(_0x59f9bc,_0x26707c))[_0xeb36('0x53')](handleError(_0x59f9bc,null));};exports[_0xeb36('0x6e')]=function(_0x606666,_0x3d17cf,_0x45579f){return db['SmsAccount'][_0xeb36('0x58')]({'where':{'id':_0x606666[_0xeb36('0x54')]['id']}})['then'](handleEntityNotFound(_0x3d17cf,null))['then'](function(_0x426edb){if(_0x426edb){return _0x426edb['removeAnswers'](_0x606666['query'][_0xeb36('0x68')]);}})[_0xeb36('0x20')](respondWithStatusCode(_0x3d17cf,null))[_0xeb36('0x53')](handleError(_0x3d17cf,null));};exports[_0xeb36('0x6f')]=function(_0x481b35,_0x473293,_0x302763){var _0x4c947c={'channel':_0xeb36('0x70')};var _0x15c6c1=[];var _0x114e1d=[];var _0x144835={};return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x481b35[_0xeb36('0x54')]['id']},'include':[{'model':db[_0xeb36('0x71')],'as':_0xeb36('0x72')}]})['then'](handleEntityNotFound(_0x473293,null))[_0xeb36('0x20')](function(_0x58ad97){_0x4c947c[_0xeb36('0x73')]=_0x58ad97;_0x4c947c[_0xeb36('0x74')]=_['orderBy'](_0x58ad97[_0xeb36('0x72')],[_0xeb36('0x75')],['asc']);if(_0x4c947c[_0xeb36('0x73')][_0xeb36('0x72')]){delete _0x4c947c[_0xeb36('0x73')][_0xeb36('0x72')];}return db['CmContact'][_0xeb36('0x60')]();})['then'](function(_0x333ac3){if(!_0x333ac3){throw new db[(_0xeb36('0x76'))][(_0xeb36('0x77'))](_0xeb36('0x78'));}_0x15c6c1=_[_0xeb36('0x79')](_[_0xeb36('0x55')](_0x333ac3),[_0xeb36('0x7a'),'updatedAt']);_0x114e1d=_[_0xeb36('0x79')](_[_0xeb36('0x55')](_0x333ac3),[_0xeb36('0x7a'),'updatedAt',_0xeb36('0x7b'),'ListId']);_0x4c947c[_0xeb36('0x5a')]={'mapKey':_0xeb36('0x7c')};if(_0x4c947c['account'][_0xeb36('0x41')]){switch(_0x4c947c[_0xeb36('0x73')][_0xeb36('0x41')]){case _0xeb36('0x7d'):_0x4c947c[_0xeb36('0x5a')]['from']=_0x481b35['body'][_0xeb36('0x7e')];_0x4c947c[_0xeb36('0x5a')]['body']=_0x481b35['body']['Body'];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x7f')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x80')];break;case _0xeb36('0x81'):_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]='+'+_0x481b35[_0xeb36('0x5a')][_0xeb36('0x83')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]=_0x481b35['body'][_0xeb36('0x84')];break;case _0xeb36('0x85'):_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x82')];_0x4c947c[_0xeb36('0x5a')]['body']=_0x481b35[_0xeb36('0x5a')]['message'];break;case'clicksend':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')]['from'];_0x4c947c['body'][_0xeb36('0x5a')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x5a')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x7f')]=_0x481b35[_0xeb36('0x5a')]['message_id'];break;case _0xeb36('0x86'):_0x4c947c[_0xeb36('0x5a')]['from']=_0x481b35['body'][_0xeb36('0x7e')];_0x4c947c[_0xeb36('0x5a')]['body']=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x87')];_0x4c947c[_0xeb36('0x5a')]['messageId']=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x88')];break;case _0xeb36('0x89'):_0x4c947c[_0xeb36('0x5a')]['from']='+'+_0x481b35[_0xeb36('0x5a')]['results'][0x0][_0xeb36('0x82')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]=_0x481b35['body'][_0xeb36('0x8a')][0x0][_0xeb36('0x84')];_0x4c947c['body']['messageId']=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x8a')][0x0]['messageId'];break;case _0xeb36('0x8b'):_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x8c')];_0x4c947c['body'][_0xeb36('0x5a')]=_0x481b35[_0xeb36('0x5a')]['segmentedMessage']['message'];break;case _0xeb36('0x8d'):_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x8e')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x84')];_0x4c947c[_0xeb36('0x5a')]['messageId']=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x8f')];break;case _0xeb36('0x90'):_0x4c947c['body'][_0xeb36('0x7f')]=_0x481b35[_0xeb36('0x5a')][0x0][_0xeb36('0x27')]['id'];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')][0x0][_0xeb36('0x27')][_0xeb36('0x82')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]=_0x481b35[_0xeb36('0x5a')][0x0][_0xeb36('0x27')][_0xeb36('0x84')];break;case'intelepeer':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x82')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]=_0x481b35[_0xeb36('0x5a')][_0xeb36('0x27')];_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x7f')]=_0x481b35[_0xeb36('0x5a')]['refid'];break;}}if(_0x4c947c[_0xeb36('0x5a')]['id']){delete _0x4c947c[_0xeb36('0x5a')]['id'];}if(_[_0xeb36('0x91')](_0x4c947c['body'][_0xeb36('0x82')])){throw new db[(_0xeb36('0x76'))]['ValidationError'](_0xeb36('0x92'));}if(_['isNil'](_0x4c947c[_0xeb36('0x5a')]['body'])||_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')]===''){throw new db[(_0xeb36('0x76'))][(_0xeb36('0x77'))](_0xeb36('0x93'));}if(_[_0xeb36('0x91')](_0x4c947c[_0xeb36('0x5a')]['mapKey'])){throw new db[(_0xeb36('0x76'))][(_0xeb36('0x77'))](_0xeb36('0x94')+_0x114e1d);}if(!_['includes'](_0x114e1d,_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x95')])){throw new db[(_0xeb36('0x76'))][(_0xeb36('0x77'))](_0xeb36('0x96')+_0x114e1d);}_0x144835[_0x4c947c[_0xeb36('0x5a')]['mapKey']]=_0x4c947c['body']['from'];return db[_0xeb36('0x97')][_0xeb36('0x58')]({'where':{'id':_0x4c947c['account']['ListId']},'include':[{'model':db[_0xeb36('0x98')],'as':_0xeb36('0x99'),'where':_0x144835,'limit':0x1,'order':[[_0xeb36('0x9a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x473293,null))[_0xeb36('0x20')](function(_0xb7dab9){if(_0xb7dab9){_0x4c947c[_0xeb36('0x9b')]=_[_0xeb36('0x9c')](_0xb7dab9,[_0xeb36('0x99')]);if(_0xb7dab9[_0xeb36('0x99')]['length']){return _0xb7dab9[_0xeb36('0x99')][0x0];}var _0x5a85fa=_[_0xeb36('0x17')](_0x4c947c[_0xeb36('0x5a')],{'firstName':_0x4c947c['body'][_0xeb36('0x82')],'ListId':_0xb7dab9['id']});_0x5a85fa[_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x95')]]=_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')];return db[_0xeb36('0x98')][_0xeb36('0x59')](_0x5a85fa,{'fields':_0x15c6c1,'raw':!![]});}})[_0xeb36('0x20')](handleEntityNotFound(_0x473293,null))['then'](function(_0x391de0){if(_0x391de0){_0x4c947c[_0xeb36('0x9d')]=_0x391de0;var _0x5865ef={'ContactId':_0x391de0['id'],'phone':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')],'SmsAccountId':_0x481b35[_0xeb36('0x54')]['id']};var _0x5940c7={'ContactId':_0x391de0['id'],'SmsAccountId':_0x481b35[_0xeb36('0x54')]['id'],'closed':![]};return db[_0xeb36('0x9e')][_0xeb36('0x58')]({'where':_0x5940c7})[_0xeb36('0x20')](function(_0x1d4a02){if(_0x1d4a02){return[_0x1d4a02,![]];}return db['SmsInteraction'][_0xeb36('0x59')](_0x5865ef)[_0xeb36('0x20')](function(_0x4ba983){return[_0x4ba983,!![]];});});}})['spread'](function(_0x32c151,_0x4e59fa){_0x4c947c[_0xeb36('0x9f')]=_0x32c151[_0xeb36('0x38')]({'plain':!![]});_0x4c947c['interaction'][_0xeb36('0xa0')]=![];if(_0x4e59fa){if(_0x4c947c[_0xeb36('0x73')][_0xeb36('0xa1')]){_0x4c947c['applications'][_0xeb36('0xa2')]({'id':0x0,'priority':_0x4c947c[_0xeb36('0x74')][_0xeb36('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xeb36('0xa3')});}_0x4c947c[_0xeb36('0x9f')][_0xeb36('0xa0')]=!![];}return db['SmsMessage'][_0xeb36('0x59')]({'phone':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x82')],'messageId':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x7f')],'body':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0x5a')],'SmsAccountId':_0x481b35[_0xeb36('0x54')]['id'],'SmsInteractionId':_0x32c151['id'],'direction':'in','ContactId':_0x32c151[_0xeb36('0xa4')],'AttachmentId':_0x4c947c[_0xeb36('0x5a')][_0xeb36('0xa5')]});})[_0xeb36('0x20')](function(_0x364df4){_0x4c947c[_0xeb36('0x27')]=_0x364df4;if(!_0x4c947c['interaction'][_0xeb36('0xa6')])return;return db['User'][_0xeb36('0x58')]({'attributes':['id',_0xeb36('0x3a')],'where':{'id':_0x4c947c[_0xeb36('0x9f')][_0xeb36('0xa6')]}});})[_0xeb36('0x20')](function(_0x3492ec){if(_0x3492ec){_0x4c947c['applications'][_0xeb36('0xa7')]({'id':0x0,'priority':0x0,'app':_0xeb36('0xa8'),'appdata':_0x3492ec[_0xeb36('0x3a')]+','+(_0x4c947c[_0xeb36('0x73')][_0xeb36('0xa9')]||0xa),'interval':'*,*,*,*'});}if(!_0x4c947c['interaction'][_0xeb36('0xaa')])return;return db[_0xeb36('0xab')]['find']({'attributes':['id','name'],'where':{'id':_0x4c947c[_0xeb36('0x9f')][_0xeb36('0xaa')]}});})[_0xeb36('0x20')](function(_0x95943c){if(_0x95943c){_0x4c947c['applications'][_0xeb36('0xa7')]({'id':0x0,'priority':0x1,'app':_0xeb36('0xac'),'appdata':_0x95943c[_0xeb36('0x3a')]+','+(_0x4c947c['account'][_0xeb36('0xad')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xeb36('0xae'),'startRouting',_0x4c947c);})[_0xeb36('0x20')](function(_0x383a78){if(_0x383a78){var _0x17a23d=0xc8;var _0x587fe0=_0xeb36('0xaf');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x587fe0,_0x17a23d,_0xeb36('0xb0'));logger[_0xeb36('0x23')](_0xeb36('0xb1'),_0x587fe0,_0x17a23d,_0xeb36('0xb0'),JSON['stringify'](_0x383a78));if(_0x4c947c[_0xeb36('0x73')]['type']===_0xeb36('0x7d')){return _0x473293[_0xeb36('0x2c')](_0x17a23d)[_0xeb36('0xb2')]('Content-Type',_0xeb36('0xb3'))[_0xeb36('0xb4')](_0xeb36('0xb5'));}else{return _0x473293[_0xeb36('0x2c')](_0x17a23d)[_0xeb36('0x2d')](_0x383a78);}}})[_0xeb36('0x53')](handleError(_0x473293,null));};exports[_0xeb36('0xb6')]=function(_0x5e9af6,_0x46f048){var _0x505a74=_0x5e9af6[_0xeb36('0x54')]['id'];var _0x11d17f=_0x5e9af6['body'];var _0x1d28cf=0xc8;var _0x48826c=null;return db[_0xeb36('0xb7')][_0xeb36('0xb8')]({'isolationLevel':db[_0xeb36('0xb7')][_0xeb36('0xb9')]['ISOLATION_LEVELS'][_0xeb36('0xba')]},function(_0x387284){return db[_0xeb36('0x3e')][_0xeb36('0x6c')]({'where':{'id':_0x505a74},'transaction':_0x387284})[_0xeb36('0x20')](function(_0x58a129){if(_0x58a129){return db[_0xeb36('0x71')]['destroy']({'where':{'SmsAccountId':_0x505a74},'transaction':_0x387284})['then'](function(){var _0x548a44=_[_0xeb36('0x3d')](_0x11d17f,function(_0x16802a){_0x16802a['SmsAccountId']=_0x505a74;return _0x16802a;});return db[_0xeb36('0x71')][_0xeb36('0xbb')](_0x548a44,{'transaction':_0x387284});});}else{_0x1d28cf=0x194;_0x48826c=[];}});})[_0xeb36('0x20')](function(){if(_0x1d28cf!==0x194){return db['SmsApplication'][_0xeb36('0xbc')]({'where':{'SmsAccountId':_0x505a74},'order':_0xeb36('0x75')})['then'](function(_0x59f978){_0x48826c=_0x59f978;});}})[_0xeb36('0x53')](function(_0x22fcb8){_0x1d28cf=0x1f4;logger[_0xeb36('0x26')](_0x22fcb8['stack']);if(_0x22fcb8[_0xeb36('0x3a')]){delete _0x22fcb8[_0xeb36('0x3a')];}_0x48826c=_0x22fcb8;})[_0xeb36('0xbd')](function(){if(_0x48826c===null){_0x46f048[_0xeb36('0x2a')](_0x1d28cf);}else{if(_0x1d28cf===0x1f4){_0x46f048['status'](_0x1d28cf)[_0xeb36('0xb4')](_0x48826c);}else{_0x46f048[_0xeb36('0x2c')](_0x1d28cf)['json'](_0x48826c);}}});};exports[_0xeb36('0xbe')]=function(_0x1a5b88,_0x16a915,_0x19e88f){var _0x2b3ed5={};var _0xaa131a={};var _0x16013d;var _0x141b99;return db['SmsAccount'][_0xeb36('0x6c')]({'where':{'id':_0x1a5b88[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x16a915,null))[_0xeb36('0x20')](function(_0x3138b9){if(_0x3138b9){_0x16013d=_0x3138b9;_0xaa131a[_0xeb36('0x43')]=_['keys'](db[_0xeb36('0x71')][_0xeb36('0x3f')]);_0xaa131a[_0xeb36('0x44')]=_[_0xeb36('0x55')](_0x1a5b88['query']);_0xaa131a[_0xeb36('0x45')]=_[_0xeb36('0x46')](_0xaa131a['model'],_0xaa131a[_0xeb36('0x44')]);_0x2b3ed5[_0xeb36('0x47')]=_[_0xeb36('0x46')](_0xaa131a[_0xeb36('0x43')],qs[_0xeb36('0x56')](_0x1a5b88['query'][_0xeb36('0x56')]));_0x2b3ed5['attributes']=_0x2b3ed5['attributes'][_0xeb36('0x57')]?_0x2b3ed5[_0xeb36('0x47')]:_0xaa131a[_0xeb36('0x43')];_0x2b3ed5[_0xeb36('0x49')]=qs[_0xeb36('0x4a')](_0x1a5b88[_0xeb36('0x44')]['sort']);_0x2b3ed5[_0xeb36('0x4b')]=qs['filters'](_[_0xeb36('0x6d')](_0x1a5b88['query'],_0xaa131a['filters']));if(_0x1a5b88['query']['filter']){_0x2b3ed5[_0xeb36('0x4b')]=_[_0xeb36('0x4e')](_0x2b3ed5[_0xeb36('0x4b')],{'$or':_[_0xeb36('0x3d')](_0x2b3ed5[_0xeb36('0x47')],function(_0x6b8662){var _0x4f1af9={};_0x4f1af9[_0x6b8662]={'$like':'%'+_0x1a5b88[_0xeb36('0x44')]['filter']+'%'};return _0x4f1af9;})});}_0x2b3ed5=_[_0xeb36('0x4e')]({},_0x2b3ed5,_0x1a5b88[_0xeb36('0x4f')]);return _0x16013d[_0xeb36('0xbe')](_0x2b3ed5);}})['then'](function(_0x10879e){if(_0x10879e){_0x141b99=_0x10879e[_0xeb36('0x57')];if(!_0x1a5b88[_0xeb36('0x44')]['hasOwnProperty']('nolimit')){_0x2b3ed5[_0xeb36('0x2f')]=qs[_0xeb36('0x2f')](_0x1a5b88[_0xeb36('0x44')][_0xeb36('0x2f')]);_0x2b3ed5[_0xeb36('0x2e')]=qs['offset'](_0x1a5b88['query'][_0xeb36('0x2e')]);}return _0x16013d[_0xeb36('0xbe')](_0x2b3ed5);}})[_0xeb36('0x20')](function(_0x7bd2ef){if(_0x7bd2ef){return _0x7bd2ef?{'count':_0x141b99,'rows':_0x7bd2ef}:null;}})['then'](respondWithResult(_0x16a915,null))[_0xeb36('0x53')](handleError(_0x16a915,null));};exports['getInteractions']=function(_0x4d0679,_0x2798f7,_0x543d46){var _0x68d42={'raw':![],'where':{}};var _0x375f51={};var _0x25eb03={'count':0x0,'rows':[]};return db['SmsAccount'][_0xeb36('0x6c')]({'where':{'id':_0x4d0679[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x2798f7,null))[_0xeb36('0x20')](function(_0x49eff7){if(_0x49eff7){_0x375f51[_0xeb36('0x43')]=_[_0xeb36('0x55')](db[_0xeb36('0x9e')][_0xeb36('0x3f')]);_0x375f51[_0xeb36('0x44')]=_[_0xeb36('0x55')](_0x4d0679[_0xeb36('0x44')]);_0x375f51['filters']=_[_0xeb36('0x46')](_0x375f51[_0xeb36('0x43')],_0x375f51[_0xeb36('0x44')]);_0x68d42[_0xeb36('0x47')]=_['intersection'](_0x375f51[_0xeb36('0x43')],qs[_0xeb36('0x56')](_0x4d0679[_0xeb36('0x44')][_0xeb36('0x56')]));_0x68d42[_0xeb36('0x47')]=_0x68d42[_0xeb36('0x47')][_0xeb36('0x57')]?_0x68d42['attributes']:_0x375f51[_0xeb36('0x43')];if(!_0x4d0679[_0xeb36('0x44')][_0xeb36('0x64')](_0xeb36('0x48'))){_0x68d42[_0xeb36('0x2f')]=qs['limit'](_0x4d0679[_0xeb36('0x44')]['limit']);_0x68d42['offset']=qs[_0xeb36('0x2e')](_0x4d0679[_0xeb36('0x44')][_0xeb36('0x2e')]);}_0x68d42['order']=qs[_0xeb36('0x4a')](_0x4d0679[_0xeb36('0x44')][_0xeb36('0x4a')]);_0x68d42[_0xeb36('0x4b')]=qs[_0xeb36('0x45')](_[_0xeb36('0x6d')](_0x4d0679[_0xeb36('0x44')],_0x375f51['filters']));_0x68d42['where'][_0xeb36('0x65')]=_0x49eff7['id'];if(_0x4d0679['query'][_0xeb36('0x4c')]){_0x68d42['where']=_[_0xeb36('0x4e')](_0x68d42['where'],{'$or':_[_0xeb36('0x3d')](_0x68d42[_0xeb36('0x47')],function(_0x1f5951){var _0x4344ab={};_0x4344ab[_0x1f5951]={'$like':'%'+_0x4d0679['query'][_0xeb36('0x4c')]+'%'};return _0x4344ab;})});}_0x68d42=_[_0xeb36('0x4e')]({},_0x68d42,_0x4d0679[_0xeb36('0x4f')]);return db[_0xeb36('0x9e')]['count']({'where':_0x68d42[_0xeb36('0x4b')]})['then'](function(_0x31964e){_0x25eb03[_0xeb36('0x31')]=_0x31964e;if(_0x4d0679[_0xeb36('0x44')][_0xeb36('0x50')]){_0x68d42[_0xeb36('0x51')]=[{'model':db[_0xeb36('0x98')],'as':_0xeb36('0xbf'),'required':![]},{'model':db[_0xeb36('0xc0')],'as':'Owner','attributes':[_0xeb36('0x3a'),_0xeb36('0xc1'),'internal'],'required':![]},{'model':db[_0xeb36('0xc2')],'as':_0xeb36('0xc3'),'attributes':['id',_0xeb36('0x3a'),_0xeb36('0xc4')],'where':_0x4d0679[_0xeb36('0x44')][_0xeb36('0xc5')]?{'id':_0x4d0679[_0xeb36('0x44')][_0xeb36('0xc5')]}:undefined,'required':_0x4d0679[_0xeb36('0x44')][_0xeb36('0xc5')]?!![]:![]}];}return db[_0xeb36('0x9e')][_0xeb36('0x66')](_0x68d42);})['then'](function(_0xeecd8e){_0x25eb03[_0xeb36('0x52')]=_0xeecd8e;return _0x25eb03;});}})[_0xeb36('0x20')](respondWithFilteredResult(_0x2798f7,_0x68d42))[_0xeb36('0x53')](handleError(_0x2798f7,null));};exports['send']=function(_0x50204f,_0x3d821f,_0x8014ba){var _0x3918bc,_0x38a8e3,_0x4fa7c2;if(_[_0xeb36('0x91')](_0x50204f[_0xeb36('0x5a')][_0xeb36('0x5a')])||_0x50204f[_0xeb36('0x5a')]['body']===''){throw new db[(_0xeb36('0x76'))]['ValidationError'](_0xeb36('0x93'));}if(_[_0xeb36('0x91')](_0x50204f[_0xeb36('0x5a')]['to'])){throw new db[(_0xeb36('0x76'))][(_0xeb36('0x77'))](_0xeb36('0xc6'));}_0x3918bc=_0x50204f[_0xeb36('0x5a')]['to'];return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x50204f[_0xeb36('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0xeb36('0xc7'),'include':[{'model':db[_0xeb36('0x98')],'as':_0xeb36('0x99'),'where':{'mobile':_0x3918bc},'limit':0x1,'order':[[_0xeb36('0x9a'),_0xeb36('0xc8')]]}]}]})[_0xeb36('0x20')](handleEntityNotFound(_0x3d821f,null))[_0xeb36('0x20')](function(_0x51833e){if(_0x51833e&&_0x51833e['List']){_0x38a8e3=_0x51833e['get']({'plain':!![]});if(_0x38a8e3['List']&&_0x38a8e3[_0xeb36('0xc7')][_0xeb36('0x99')][_0xeb36('0x57')]){return _0x38a8e3[_0xeb36('0xc7')][_0xeb36('0x99')][0x0];}return db[_0xeb36('0x98')]['create'](_[_0xeb36('0x17')](_0x50204f[_0xeb36('0x5a')],{'firstName':_0x3918bc,'mobile':_0x3918bc,'phone':_0x3918bc,'ListId':_0x38a8e3[_0xeb36('0xc9')]}));}})[_0xeb36('0x20')](handleEntityNotFound(_0x3d821f,null))[_0xeb36('0x20')](function(_0x52610f){if(_0x52610f){_0x4fa7c2=_0x52610f;return db[_0xeb36('0x9e')]['find']({'where':{'ContactId':_0x4fa7c2['id'],'closed':![],'SmsAccountId':_0x38a8e3['id']}})['then'](function(_0x5a3aa2){if(_0x5a3aa2){return[_0x5a3aa2,![]];}return db[_0xeb36('0x9e')][_0xeb36('0x59')]({'UserId':_0x50204f[_0xeb36('0x5b')]['id'],'ContactId':_0x4fa7c2['id'],'SmsAccountId':_0x38a8e3['id'],'phone':_0x3918bc,'firstMsgDirection':_0xeb36('0xca'),'Messages':[_[_0xeb36('0x4e')](_0x50204f[_0xeb36('0x5a')],{'read':![],'body':_0x50204f[_0xeb36('0x5a')]['body'],'phone':_0x3918bc,'SmsAccountId':_0x38a8e3['id'],'UserId':_0x50204f['user']['id'],'ContactId':_0x4fa7c2['id']})]},{'include':[{'model':db[_0xeb36('0xcb')],'as':_0xeb36('0xcc')}]})[_0xeb36('0x20')](function(_0x251184){return[_0x251184,!![]];});});}})[_0xeb36('0xcd')](function(_0xff485e,_0x3a587f){if(_0x3a587f){return _0xff485e;}return db[_0xeb36('0xcb')][_0xeb36('0x59')](_['merge'](_0x50204f[_0xeb36('0x5a')],{'read':![],'body':_0x50204f[_0xeb36('0x5a')]['body'],'phone':_0x3918bc,'SmsAccountId':_0x38a8e3['id'],'SmsInteractionId':_0xff485e['id'],'UserId':_0x50204f[_0xeb36('0x5b')]['id'],'ContactId':_0x4fa7c2['id']}))[_0xeb36('0x20')](function(_0x145f62){_0xff485e['dataValues'][_0xeb36('0xcc')]=[];_0xff485e[_0xeb36('0xce')][_0xeb36('0xcc')][_0xeb36('0xa2')](_0x145f62[_0xeb36('0xce')]);return _0xff485e;});})['then'](respondWithResult(_0x3d821f,null))[_0xeb36('0x53')](handleError(_0x3d821f,null));};exports['status']=function(_0x3ff7d8,_0xea61ae,_0x62b3e0){if(_0x3ff7d8[_0xeb36('0x5a')]['id']){delete _0x3ff7d8[_0xeb36('0x5a')]['id'];}var _0x57c29c,_0x3ebdd9,_0x3c2f67;return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x3ff7d8[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0xea61ae,null))[_0xeb36('0x20')](function(_0x5d3fbe){if(_0x5d3fbe){_0x3c2f67=_0x5d3fbe;logger[_0xeb36('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x5d3fbe[_0xeb36('0x41')],util[_0xeb36('0xcf')](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));switch(_0x5d3fbe[_0xeb36('0x41')]){case _0xeb36('0x81'):if(_0x3ff7d8[_0xeb36('0x5a')]['skebby_dispatch_id']&&_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x2c')]){_0x3ebdd9=_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x2c')];return db['SmsMessage'][_0xeb36('0x58')]({'where':{'messageId':_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd0')]}});}break;case _0xeb36('0x85'):if(_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd1')]&&_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd2')]){_0x3ebdd9=_0x3ff7d8['body']['statusInt'];return db[_0xeb36('0xcb')][_0xeb36('0x58')]({'where':{'messageId':_0x3ff7d8['body']['requestid']}});}break;case _0xeb36('0xd3'):if(_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd4')]&&_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd5')]){_0x3ebdd9=_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd5')];return db[_0xeb36('0xcb')]['find']({'where':{'messageId':_0x3ff7d8['body'][_0xeb36('0xd4')]}});}break;case _0xeb36('0x89'):var _0x43ae1f=_0x3ff7d8[_0xeb36('0x5a')]['results'][0x0];if(_0x43ae1f['messageId']&&_0x43ae1f['status'][_0xeb36('0xd6')]===_0xeb36('0xd7')){_0x3ebdd9=_0x43ae1f['status']['groupName'];return db[_0xeb36('0xcb')][_0xeb36('0x58')]({'where':{'messageId':_0x43ae1f[_0xeb36('0x7f')]}});}break;case'clickatell':if(_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x7f')]&&_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x2c')]){_0x3ebdd9=_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x2c')];return db[_0xeb36('0xcb')]['find']({'where':{'messageId':_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x7f')]}});}break;case _0xeb36('0x90'):if(_0x3ff7d8[_0xeb36('0x5a')][0x0][_0xeb36('0x27')]['id']){_0x3ebdd9=_0x3ff7d8['body'][0x0]['type'];return db[_0xeb36('0xcb')]['find']({'where':{'messageId':_0x3ff7d8[_0xeb36('0x5a')][0x0][_0xeb36('0x27')]['id']}});}break;case'intelepeer':if(_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd8')]&&_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x2c')]){_0x3ebdd9=_0x3ff7d8['body']['status'];return db[_0xeb36('0xcb')]['find']({'where':{'messageId':_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0xea61ae,null))[_0xeb36('0x20')](function(_0x2bad7d){if(_0x2bad7d){_0x57c29c=_0x2bad7d;switch(_0x3c2f67['type']){case _0xeb36('0x81'):if(_0x3ebdd9===_0xeb36('0xd7')){return _0x57c29c[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb36('0x2c'),_0xeb36('0x81'),util[_0xeb36('0xcf')](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xeb36('0x85'):if(_0x3ebdd9==='1'){return _0x57c29c[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeb36('0x2c'),_0xeb36('0x81'),util['inspect'](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xeb36('0xd3'):if(!_0x3ff7d8[_0xeb36('0x5a')]['error_code']&&_0x3ebdd9>=0xc8&&_0x3ebdd9<=0xce){return _0x57c29c['update']({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),_0xeb36('0x2c'),_0xeb36('0xd3'),util[_0xeb36('0xcf')](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1108ca=_0x3ff7d8[_0xeb36('0x5a')][_0xeb36('0x8a')][0x0];if(_0x1108ca[_0xeb36('0x2c')][_0xeb36('0xd6')]===_0xeb36('0xd7')){return _0x57c29c[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),'status','infobip',util[_0xeb36('0xcf')](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xeb36('0x8d'):if(_0x3ebdd9==_0xeb36('0xd9')||_0x3ebdd9==_0xeb36('0xda')){return _0x57c29c[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),'status',_0xeb36('0x8d'),util[_0xeb36('0xcf')](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xeb36('0x90'):if(_0x3ebdd9=='message-delivered'){return _0x57c29c['update']({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),'status',_0xeb36('0x90'),util['inspect'](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xeb36('0xdb'):if(_0x3ebdd9===_0xeb36('0xdc')||_0x3ebdd9===_0xeb36('0xdd')){return _0x57c29c[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),_0xeb36('0x2c'),_0xeb36('0xdb'),util['inspect'](_0x3ff7d8[_0xeb36('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x57c29c;}})[_0xeb36('0x20')](respondWithResult(_0xea61ae,null))[_0xeb36('0x53')](handleError(_0xea61ae,null));};exports[_0xeb36('0xde')]=function(_0x407333,_0x37639f,_0x158e86){var _0x5831cc,_0x40709b,_0x23e034;return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x407333[_0xeb36('0x54')]['id']}})['then'](handleEntityNotFound(_0x37639f,null))[_0xeb36('0x20')](function(_0x8c9cbb){if(_0x8c9cbb){_0x23e034=_0x8c9cbb;logger[_0xeb36('0x23')](_0xeb36('0x24'),_0xeb36('0x2c'),'received\x20delivery\x20report\x20from',_0x8c9cbb[_0xeb36('0x41')],util[_0xeb36('0xcf')](_0x407333['query'],{'showHidden':![],'depth':null}));switch(_0x8c9cbb[_0xeb36('0x41')]){case _0xeb36('0x8b'):if(_0x407333['query'][_0xeb36('0xdf')]&&_0x407333[_0xeb36('0x44')][_0xeb36('0xe0')]){_0x40709b=_0x407333['query'][_0xeb36('0xe0')];return db[_0xeb36('0xcb')][_0xeb36('0x58')]({'where':{'messageId':_0x407333[_0xeb36('0x44')][_0xeb36('0xdf')]}});}break;}}})[_0xeb36('0x20')](handleEntityNotFound(_0x37639f,null))['then'](function(_0x210f1f){if(_0x210f1f){_0x5831cc=_0x210f1f;switch(_0x23e034[_0xeb36('0x41')]){case'csc':if(_0x40709b==='2'||_0x40709b==='6'){return _0x5831cc[_0xeb36('0x36')]({'read':!![]});}else{logger[_0xeb36('0x26')](_0xeb36('0x24'),_0xeb36('0x2c'),_0xeb36('0x8b'),util['inspect'](_0x407333[_0xeb36('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x5831cc;}})[_0xeb36('0x20')](respondWithResult(_0x37639f,null))[_0xeb36('0x53')](handleError(_0x37639f,null));};exports['addAgents']=function(_0x447bf3,_0x11b75f,_0x36badb){return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x447bf3[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x11b75f,null))[_0xeb36('0x20')](function(_0x5c3885){if(_0x5c3885){return _0x5c3885['addAgents'](_0x447bf3[_0xeb36('0x5a')][_0xeb36('0x68')],_[_0xeb36('0x9c')](_0x447bf3[_0xeb36('0x5a')],[_0xeb36('0x68'),'id'])||{})['spread'](function(_0x56d3a1){for(var _0x58ac0d=0x0;_0x58ac0d<_0x447bf3['body'][_0xeb36('0x68')][_0xeb36('0x57')];_0x58ac0d+=0x1){socket['emit'](_0xeb36('0xe1'),{'UserId':Number(_0x447bf3[_0xeb36('0x5a')]['ids'][_0x58ac0d]),'SmsAccountId':Number(_0x447bf3[_0xeb36('0x54')]['id'])});}return _0x56d3a1;});}})[_0xeb36('0x20')](respondWithResult(_0x11b75f,null))[_0xeb36('0x53')](handleError(_0x11b75f,null));};exports[_0xeb36('0xe2')]=function(_0x10f1c3,_0x4dfb7e,_0x379d35){return db[_0xeb36('0x3e')][_0xeb36('0x58')]({'where':{'id':_0x10f1c3[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x4dfb7e,null))[_0xeb36('0x20')](function(_0x1c94ae){if(_0x1c94ae){return _0x1c94ae['removeAgents'](_0x10f1c3[_0xeb36('0x44')][_0xeb36('0x68')])['then'](function(){if(_['isArray'](_0x10f1c3['query'][_0xeb36('0x68')])){for(var _0x4ac1f9=0x0;_0x4ac1f9<_0x10f1c3['query'][_0xeb36('0x68')][_0xeb36('0x57')];_0x4ac1f9+=0x1){socket[_0xeb36('0xe3')](_0xeb36('0xe4'),{'UserId':Number(_0x10f1c3[_0xeb36('0x44')][_0xeb36('0x68')][_0x4ac1f9]),'SmsAccountId':Number(_0x10f1c3[_0xeb36('0x54')]['id'])});}}else{socket[_0xeb36('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x10f1c3[_0xeb36('0x44')][_0xeb36('0x68')]),'SmsAccountId':Number(_0x10f1c3[_0xeb36('0x54')]['id'])});}});}})[_0xeb36('0x20')](respondWithStatusCode(_0x4dfb7e,null))[_0xeb36('0x53')](handleError(_0x4dfb7e,null));};exports[_0xeb36('0xe5')]=function(_0x5e8c36,_0x390ab7,_0x59d21b){var _0x9908d6={};var _0x28ba7f={};var _0x515a85;var _0x4bd8cf;return db[_0xeb36('0x3e')]['findOne']({'where':{'id':_0x5e8c36[_0xeb36('0x54')]['id']}})[_0xeb36('0x20')](handleEntityNotFound(_0x390ab7,null))[_0xeb36('0x20')](function(_0x10488d){if(_0x10488d){_0x515a85=_0x10488d;_0x28ba7f[_0xeb36('0x43')]=_[_0xeb36('0x55')](db['User'][_0xeb36('0x3f')]);_0x28ba7f[_0xeb36('0x44')]=_[_0xeb36('0x55')](_0x5e8c36['query']);_0x28ba7f[_0xeb36('0x45')]=_[_0xeb36('0x46')](_0x28ba7f[_0xeb36('0x43')],_0x28ba7f[_0xeb36('0x44')]);_0x9908d6[_0xeb36('0x47')]=_[_0xeb36('0x46')](_0x28ba7f[_0xeb36('0x43')],qs[_0xeb36('0x56')](_0x5e8c36[_0xeb36('0x44')]['fields']));_0x9908d6['attributes']=_0x9908d6['attributes'][_0xeb36('0x57')]?_0x9908d6['attributes']:_0x28ba7f[_0xeb36('0x43')];_0x9908d6[_0xeb36('0x49')]=qs[_0xeb36('0x4a')](_0x5e8c36[_0xeb36('0x44')][_0xeb36('0x4a')]);_0x9908d6['where']=qs['filters'](_[_0xeb36('0x6d')](_0x5e8c36[_0xeb36('0x44')],_0x28ba7f[_0xeb36('0x45')]));if(_0x5e8c36[_0xeb36('0x44')][_0xeb36('0x4c')]){_0x9908d6['where']=_[_0xeb36('0x4e')](_0x9908d6['where'],{'$or':_['map'](_0x9908d6[_0xeb36('0x47')],function(_0x54324a){var _0x59bd0f={};_0x59bd0f[_0x54324a]={'$like':'%'+_0x5e8c36[_0xeb36('0x44')][_0xeb36('0x4c')]+'%'};return _0x59bd0f;})});}_0x9908d6=_['merge']({},_0x9908d6,_0x5e8c36[_0xeb36('0x4f')]);return _0x515a85[_0xeb36('0xe5')](_0x9908d6);}})[_0xeb36('0x20')](function(_0x5f0d8f){if(_0x5f0d8f){_0x4bd8cf=_0x5f0d8f[_0xeb36('0x57')];if(!_0x5e8c36['query']['hasOwnProperty']('nolimit')){_0x9908d6['limit']=qs[_0xeb36('0x2f')](_0x5e8c36[_0xeb36('0x44')][_0xeb36('0x2f')]);_0x9908d6['offset']=qs['offset'](_0x5e8c36['query'][_0xeb36('0x2e')]);}return _0x515a85['getAgents'](_0x9908d6);}})[_0xeb36('0x20')](function(_0x5bab7b){if(_0x5bab7b){return _0x5bab7b?{'count':_0x4bd8cf,'rows':_0x5bab7b}:null;}})[_0xeb36('0x20')](respondWithResult(_0x390ab7,null))[_0xeb36('0x53')](handleError(_0x390ab7,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 76bc4bc..5910c7d 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 _0xc196=['exports','events','SmsAccount','setMaxListeners','save','emit','hook'];(function(_0xeace6b,_0x35aaa3){var _0x5a3af8=function(_0xe6c46f){while(--_0xe6c46f){_0xeace6b['push'](_0xeace6b['shift']());}};_0x5a3af8(++_0x35aaa3);}(_0xc196,0x135));var _0x6c19=function(_0x25caf7,_0x3c4a8e){_0x25caf7=_0x25caf7-0x0;var _0x4c8cdb=_0xc196[_0x25caf7];return _0x4c8cdb;};'use strict';var EventEmitter=require(_0x6c19('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x6c19('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6c19('0x2')](0x0);var events={'afterCreate':_0x6c19('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x279b39){return function(_0x44e35c,_0x4baf5e,_0x5dfc89){SmsAccountEvents['emit'](_0x279b39+':'+_0x44e35c['id'],_0x44e35c);SmsAccountEvents[_0x6c19('0x4')](_0x279b39,_0x44e35c);_0x5dfc89(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x6c19('0x5')](e,emitEvent(event));}}module[_0x6c19('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xfc9f=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x204415,_0x36842b){var _0x1aa09c=function(_0x21ecab){while(--_0x21ecab){_0x204415['push'](_0x204415['shift']());}};_0x1aa09c(++_0x36842b);}(_0xfc9f,0x144));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xffc9('0x0')](0x0);var events={'afterCreate':_0xffc9('0x1'),'afterUpdate':_0xffc9('0x2'),'afterDestroy':_0xffc9('0x3')};function emitEvent(_0x2ac022){return function(_0x5738e7,_0x13d824,_0x1c0d7f){SmsAccountEvents[_0xffc9('0x4')](_0x2ac022+':'+_0x5738e7['id'],_0x5738e7);SmsAccountEvents['emit'](_0x2ac022,_0x5738e7);_0x1c0d7f(null);};}for(var e in events){if(events[_0xffc9('0x5')](e)){var event=events[e];SmsAccount[_0xffc9('0x6')](e,emitEvent(event));}}module[_0xffc9('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e87d2f6..1b9d13b 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 _0xf19e=['path','rimraf','../../config/environment','define','SmsAccount','lodash','util','../../config/logger','request-promise'];(function(_0x3929d8,_0x4fb0ce){var _0x506e44=function(_0x28fd41){while(--_0x28fd41){_0x3929d8['push'](_0x3929d8['shift']());}};_0x506e44(++_0x4fb0ce);}(_0xf19e,0xd4));var _0xef19=function(_0x1447e0,_0x30a5d7){_0x1447e0=_0x1447e0-0x0;var _0x2a63bf=_0xf19e[_0x1447e0];return _0x2a63bf;};'use strict';var _=require(_0xef19('0x0'));var util=require(_0xef19('0x1'));var logger=require(_0xef19('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef19('0x3'));var fs=require('fs');var path=require(_0xef19('0x4'));var rimraf=require(_0xef19('0x5'));var config=require(_0xef19('0x6'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x9cede0,_0xea3d46){return _0x9cede0[_0xef19('0x7')](_0xef19('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba47=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xba47,0x134));var _0x7ba4=function(_0x82b826,_0xdde14){_0x82b826=_0x82b826-0x0;var _0x27e923=_0xba47[_0x82b826];return _0x27e923;};'use strict';var _=require(_0x7ba4('0x0'));var util=require(_0x7ba4('0x1'));var logger=require(_0x7ba4('0x2'))(_0x7ba4('0x3'));var moment=require(_0x7ba4('0x4'));var BPromise=require(_0x7ba4('0x5'));var rp=require(_0x7ba4('0x6'));var fs=require('fs');var path=require(_0x7ba4('0x7'));var rimraf=require('rimraf');var config=require(_0x7ba4('0x8'));var attributes=require('./smsAccount.attributes');module[_0x7ba4('0x9')]=function(_0x591af6,_0x4ef04c){return _0x591af6[_0x7ba4('0xa')](_0x7ba4('0xb'),attributes,{'tableName':_0x7ba4('0xc'),'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 cb1cd28..ba17368 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 _0xde76=['attributes','include','map','model','ShowSmsAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./smsAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','SmsAccount','find','options'];(function(_0x523d22,_0x41b174){var _0x43e53a=function(_0x4b54b1){while(--_0x4b54b1){_0x523d22['push'](_0x523d22['shift']());}};_0x43e53a(++_0x41b174);}(_0xde76,0x1e1));var _0x6de7=function(_0x35bb31,_0x58f972){_0x35bb31=_0x35bb31-0x0;var _0x293725=_0xde76[_0x35bb31];return _0x293725;};'use strict';var _=require(_0x6de7('0x0'));var util=require(_0x6de7('0x1'));var moment=require(_0x6de7('0x2'));var BPromise=require('bluebird');var rs=require(_0x6de7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de7('0x5'))(_0x6de7('0x6'));var config=require(_0x6de7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6de7('0x8')][_0x6de7('0x9')]({'port':0x232a});config[_0x6de7('0xa')]=_['defaults'](config['redis'],{'host':_0x6de7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6de7('0xa')]));require(_0x6de7('0xc'))[_0x6de7('0xd')](socket);function respondWithRpcPromise(_0x4322a1,_0x2924cf,_0x233573){return new BPromise(function(_0xe131c9,_0x74acd9){return client[_0x6de7('0xe')](_0x4322a1,_0x233573)[_0x6de7('0xf')](function(_0x406ec4){logger[_0x6de7('0x10')]('SmsAccount,\x20%s,\x20%s',_0x2924cf,_0x6de7('0x11'));logger[_0x6de7('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2924cf,_0x6de7('0x11'),JSON[_0x6de7('0x13')](_0x406ec4));if(_0x406ec4[_0x6de7('0x14')]){if(_0x406ec4[_0x6de7('0x14')][_0x6de7('0x15')]===0x1f4){logger[_0x6de7('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2924cf,_0x406ec4['error'][_0x6de7('0x16')]);return _0x74acd9(_0x406ec4[_0x6de7('0x14')][_0x6de7('0x16')]);}logger[_0x6de7('0x14')](_0x6de7('0x17'),_0x2924cf,_0x406ec4[_0x6de7('0x14')][_0x6de7('0x16')]);return _0xe131c9(_0x406ec4[_0x6de7('0x14')]['message']);}else{logger[_0x6de7('0x10')](_0x6de7('0x17'),_0x2924cf,_0x6de7('0x11'));_0xe131c9(_0x406ec4[_0x6de7('0x18')][_0x6de7('0x16')]);}})[_0x6de7('0x19')](function(_0x22ba2b){logger[_0x6de7('0x14')](_0x6de7('0x17'),_0x2924cf,_0x22ba2b);_0x74acd9(_0x22ba2b);});});}exports['ShowSmsAccount']=function(_0x436da4){var _0x27d580=this;return new Promise(function(_0x2a16c0,_0x175874){return db[_0x6de7('0x1a')][_0x6de7('0x1b')]({'raw':_0x436da4['options']?_0x436da4['options']['raw']===undefined?!![]:![]:!![],'where':_0x436da4['options']?_0x436da4[_0x6de7('0x1c')]['where']||null:null,'attributes':_0x436da4[_0x6de7('0x1c')]?_0x436da4[_0x6de7('0x1c')][_0x6de7('0x1d')]||null:null,'include':_0x436da4[_0x6de7('0x1c')]?_0x436da4['options'][_0x6de7('0x1e')]?_[_0x6de7('0x1f')](_0x436da4[_0x6de7('0x1c')]['include'],function(_0x1da85e){return{'model':db[_0x1da85e[_0x6de7('0x20')]],'as':_0x1da85e['as'],'attributes':_0x1da85e[_0x6de7('0x1d')],'include':_0x1da85e[_0x6de7('0x1e')]?_['map'](_0x1da85e['include'],function(_0x3c0019){return{'model':db[_0x3c0019[_0x6de7('0x20')]],'as':_0x3c0019['as'],'attributes':_0x3c0019[_0x6de7('0x1d')],'include':_0x3c0019[_0x6de7('0x1e')]?_[_0x6de7('0x1f')](_0x3c0019[_0x6de7('0x1e')],function(_0x431345){return{'model':db[_0x431345['model']],'as':_0x431345['as'],'attributes':_0x431345[_0x6de7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6de7('0xf')](function(_0x8f6fb6){logger['info'](_0x6de7('0x21'),_0x436da4);logger[_0x6de7('0x12')](_0x6de7('0x21'),_0x436da4,JSON[_0x6de7('0x13')](_0x8f6fb6));_0x2a16c0(_0x8f6fb6);})['catch'](function(_0x3b18a6){logger['error'](_0x6de7('0x21'),_0x3b18a6[_0x6de7('0x16')],_0x436da4);_0x175874(_0x27d580['error'](0x1f4,_0x3b18a6[_0x6de7('0x16')]));});});}; \ No newline at end of file +var _0x1e93=['debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','find','options','raw','attributes','map','include','model'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1e93,0x173));var _0x31e9=function(_0x46d0f1,_0x2134d4){_0x46d0f1=_0x46d0f1-0x0;var _0x54fe3e=_0x1e93[_0x46d0f1];return _0x54fe3e;};'use strict';var _=require(_0x31e9('0x0'));var util=require(_0x31e9('0x1'));var moment=require('moment');var BPromise=require(_0x31e9('0x2'));var rs=require(_0x31e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31e9('0x4'))['db'];var utils=require(_0x31e9('0x5'));var logger=require(_0x31e9('0x6'))(_0x31e9('0x7'));var config=require(_0x31e9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x31e9('0x9')][_0x31e9('0xa')]({'port':0x232a});config['redis']=_[_0x31e9('0xb')](config['redis'],{'host':_0x31e9('0xc'),'port':0x18eb});var socket=require(_0x31e9('0xd'))(new Redis(config[_0x31e9('0xe')]));require(_0x31e9('0xf'))[_0x31e9('0x10')](socket);function respondWithRpcPromise(_0x295937,_0x11a5d1,_0x34cca5){return new BPromise(function(_0x29629d,_0x2924a5){return client[_0x31e9('0x11')](_0x295937,_0x34cca5)[_0x31e9('0x12')](function(_0x53e86b){logger[_0x31e9('0x13')]('SmsAccount,\x20%s,\x20%s',_0x11a5d1,_0x31e9('0x14'));logger['debug'](_0x31e9('0x15'),_0x11a5d1,_0x31e9('0x14'),JSON[_0x31e9('0x16')](_0x53e86b));if(_0x53e86b[_0x31e9('0x17')]){if(_0x53e86b['error'][_0x31e9('0x18')]===0x1f4){logger[_0x31e9('0x17')](_0x31e9('0x19'),_0x11a5d1,_0x53e86b[_0x31e9('0x17')][_0x31e9('0x1a')]);return _0x2924a5(_0x53e86b[_0x31e9('0x17')][_0x31e9('0x1a')]);}logger[_0x31e9('0x17')](_0x31e9('0x19'),_0x11a5d1,_0x53e86b[_0x31e9('0x17')][_0x31e9('0x1a')]);return _0x29629d(_0x53e86b[_0x31e9('0x17')]['message']);}else{logger[_0x31e9('0x13')](_0x31e9('0x19'),_0x11a5d1,'request\x20sent');_0x29629d(_0x53e86b[_0x31e9('0x1b')][_0x31e9('0x1a')]);}})['catch'](function(_0x47e7fe){logger[_0x31e9('0x17')](_0x31e9('0x19'),_0x11a5d1,_0x47e7fe);_0x2924a5(_0x47e7fe);});});}exports[_0x31e9('0x1c')]=function(_0x41a891){var _0x4c845a=this;return new Promise(function(_0x5a5847,_0x5e9e44){return db['SmsAccount'][_0x31e9('0x1d')]({'raw':_0x41a891[_0x31e9('0x1e')]?_0x41a891[_0x31e9('0x1e')][_0x31e9('0x1f')]===undefined?!![]:![]:!![],'where':_0x41a891['options']?_0x41a891[_0x31e9('0x1e')]['where']||null:null,'attributes':_0x41a891[_0x31e9('0x1e')]?_0x41a891[_0x31e9('0x1e')][_0x31e9('0x20')]||null:null,'include':_0x41a891[_0x31e9('0x1e')]?_0x41a891[_0x31e9('0x1e')]['include']?_[_0x31e9('0x21')](_0x41a891[_0x31e9('0x1e')][_0x31e9('0x22')],function(_0x35b1f3){return{'model':db[_0x35b1f3['model']],'as':_0x35b1f3['as'],'attributes':_0x35b1f3[_0x31e9('0x20')],'include':_0x35b1f3[_0x31e9('0x22')]?_[_0x31e9('0x21')](_0x35b1f3[_0x31e9('0x22')],function(_0x2a27){return{'model':db[_0x2a27[_0x31e9('0x23')]],'as':_0x2a27['as'],'attributes':_0x2a27[_0x31e9('0x20')],'include':_0x2a27[_0x31e9('0x22')]?_[_0x31e9('0x21')](_0x2a27[_0x31e9('0x22')],function(_0x20f922){return{'model':db[_0x20f922[_0x31e9('0x23')]],'as':_0x20f922['as'],'attributes':_0x20f922[_0x31e9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x31e9('0x12')](function(_0x348f){logger[_0x31e9('0x13')](_0x31e9('0x1c'),_0x41a891);logger[_0x31e9('0x24')](_0x31e9('0x1c'),_0x41a891,JSON[_0x31e9('0x16')](_0x348f));_0x5a5847(_0x348f);})['catch'](function(_0x2d0e26){logger[_0x31e9('0x17')]('ShowSmsAccount',_0x2d0e26[_0x31e9('0x1a')],_0x41a891);_0x5e9e44(_0x4c845a[_0x31e9('0x17')](0x1f4,_0x2d0e26['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 800497b..10bea4c 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 675b876..e7f7752 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_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('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 _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(_0x13da1c,_0x1a06a8){var _0x33d386=function(_0xaf456a){while(--_0xaf456a){_0x13da1c['push'](_0x13da1c['shift']());}};_0x33d386(++_0x1a06a8);}(_0x34e8,0x12c));var _0x834e=function(_0x273e55,_0x49b031){_0x273e55=_0x273e55-0x0;var _0x9a9590=_0x34e8[_0x273e55];return _0x9a9590;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 80fde67..c79cf70 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 _0xcaf7=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x594f7d,_0x35eea9){var _0xcda5ff=function(_0x482ece){while(--_0x482ece){_0x594f7d['push'](_0x594f7d['shift']());}};_0xcda5ff(++_0x35eea9);}(_0xcaf7,0x1af));var _0x7caf=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xcaf7[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x7caf('0x0'));module[_0x7caf('0x1')]={'priority':{'type':Sequelize[_0x7caf('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7caf('0x3')},'appdata':{'type':Sequelize[_0x7caf('0x4')]()},'description':{'type':Sequelize[_0x7caf('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7caf('0x6')}}; \ No newline at end of file +var _0x1e35=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x391f08,_0x1c9af0){var _0x122696=function(_0x9ef4ee){while(--_0x9ef4ee){_0x391f08['push'](_0x391f08['shift']());}};_0x122696(++_0x1c9af0);}(_0x1e35,0x127));var _0x51e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x51e3('0x0'));module[_0x51e3('0x1')]={'priority':{'type':Sequelize[_0x51e3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x51e3('0x3')},'appdata':{'type':Sequelize[_0x51e3('0x4')]()},'description':{'type':Sequelize[_0x51e3('0x5')]},'interval':{'type':Sequelize[_0x51e3('0x5')],'defaultValue':_0x51e3('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8b4fb2b..1185b3e 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 _0xccdb=['fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','show','include','options','find','catch','create','body','params','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes'];(function(_0x70158d,_0x414b2c){var _0x412a69=function(_0x1ce136){while(--_0x1ce136){_0x70158d['push'](_0x70158d['shift']());}};_0x412a69(++_0x414b2c);}(_0xccdb,0x18e));var _0xbccd=function(_0x46110c,_0x55e158){_0x46110c=_0x46110c-0x0;var _0x165d73=_0xccdb[_0x46110c];return _0x165d73;};'use strict';var emlformat=require(_0xbccd('0x0'));var rimraf=require(_0xbccd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbccd('0x2'));var BPromise=require(_0xbccd('0x3'));var Mustache=require(_0xbccd('0x4'));var util=require('util');var path=require(_0xbccd('0x5'));var sox=require(_0xbccd('0x6'));var csv=require(_0xbccd('0x7'));var ejs=require(_0xbccd('0x8'));var fs=require('fs');var fs_extra=require(_0xbccd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbccd('0xa'));var jsforce=require(_0xbccd('0xb'));var deskjs=require(_0xbccd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbccd('0xd'));var Redis=require(_0xbccd('0xe'));var authService=require(_0xbccd('0xf'));var qs=require(_0xbccd('0x10'));var as=require(_0xbccd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbccd('0x12'))(_0xbccd('0x13'));var utils=require(_0xbccd('0x14'));var config=require(_0xbccd('0x15'));var licenseUtil=require(_0xbccd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x143a38,_0x4ff24d){_0x4ff24d=_0x4ff24d||0xcc;return function(_0x44b51e){if(_0x44b51e){return _0x143a38['sendStatus'](_0x4ff24d);}return _0x143a38[_0xbccd('0x17')](_0x4ff24d)[_0xbccd('0x18')]();};}function respondWithResult(_0x3c4964,_0x159062){_0x159062=_0x159062||0xc8;return function(_0x9bad2c){if(_0x9bad2c){return _0x3c4964['status'](_0x159062)[_0xbccd('0x19')](_0x9bad2c);}};}function respondWithFilteredResult(_0x74fe43,_0x1a6d55){return function(_0x4f534c){if(_0x4f534c){var _0x195349=typeof _0x1a6d55[_0xbccd('0x1a')]===_0xbccd('0x1b')&&typeof _0x1a6d55[_0xbccd('0x1c')]==='undefined';var _0x672bbe=_0x4f534c[_0xbccd('0x1d')];var _0x3c14d7=_0x195349?0x0:_0x1a6d55[_0xbccd('0x1a')];var _0x300204=_0x195349?_0x4f534c[_0xbccd('0x1d')]:_0x1a6d55['offset']+_0x1a6d55[_0xbccd('0x1c')];var _0x560eb6;if(_0x300204>=_0x672bbe){_0x300204=_0x672bbe;_0x560eb6=0xc8;}else{_0x560eb6=0xce;}_0x74fe43[_0xbccd('0x17')](_0x560eb6);return _0x74fe43[_0xbccd('0x1e')](_0xbccd('0x1f'),_0x3c14d7+'-'+_0x300204+'/'+_0x672bbe)[_0xbccd('0x19')](_0x4f534c);}return null;};}function patchUpdates(_0xbd568e){return function(_0x27437b){try{jsonpatch[_0xbccd('0x20')](_0x27437b,_0xbd568e,!![]);}catch(_0x4afc64){return BPromise[_0xbccd('0x21')](_0x4afc64);}return _0x27437b['save']();};}function saveUpdates(_0x4ef769,_0xbe8168){return function(_0x3e9979){if(_0x3e9979){return _0x3e9979[_0xbccd('0x22')](_0x4ef769)[_0xbccd('0x23')](function(_0x1bf66a){return _0x1bf66a;});}return null;};}function removeEntity(_0x5096df,_0x99122){return function(_0x90ce95){if(_0x90ce95){return _0x90ce95[_0xbccd('0x24')]()[_0xbccd('0x23')](function(){_0x5096df[_0xbccd('0x17')](0xcc)[_0xbccd('0x18')]();});}};}function handleEntityNotFound(_0x484d43,_0x145238){return function(_0x5dc6d5){if(!_0x5dc6d5){_0x484d43[_0xbccd('0x25')](0x194);}return _0x5dc6d5;};}function handleError(_0x173449,_0x45c3bc){_0x45c3bc=_0x45c3bc||0x1f4;return function(_0x49716c){logger[_0xbccd('0x26')](_0x49716c[_0xbccd('0x27')]);if(_0x49716c[_0xbccd('0x28')]){delete _0x49716c['name'];}_0x173449[_0xbccd('0x17')](_0x45c3bc)[_0xbccd('0x29')](_0x49716c);};}exports[_0xbccd('0x2a')]=function(_0x209f6a,_0x3357f6){var _0x44226c={},_0x117c72={},_0x48dba5={'count':0x0,'rows':[]};var _0xacf0c6=_[_0xbccd('0x2b')](db[_0xbccd('0x2c')][_0xbccd('0x2d')],function(_0x5beb6b){return{'name':_0x5beb6b[_0xbccd('0x2e')],'type':_0x5beb6b[_0xbccd('0x2f')]['key']};});_0x117c72[_0xbccd('0x30')]=_[_0xbccd('0x2b')](_0xacf0c6,'name');_0x117c72[_0xbccd('0x31')]=_[_0xbccd('0x32')](_0x209f6a[_0xbccd('0x31')]);_0x117c72[_0xbccd('0x33')]=_['intersection'](_0x117c72[_0xbccd('0x30')],_0x117c72[_0xbccd('0x31')]);_0x44226c[_0xbccd('0x34')]=_[_0xbccd('0x35')](_0x117c72[_0xbccd('0x30')],qs[_0xbccd('0x36')](_0x209f6a['query'][_0xbccd('0x36')]));_0x44226c[_0xbccd('0x34')]=_0x44226c[_0xbccd('0x34')][_0xbccd('0x37')]?_0x44226c[_0xbccd('0x34')]:_0x117c72[_0xbccd('0x30')];if(!_0x209f6a[_0xbccd('0x31')][_0xbccd('0x38')](_0xbccd('0x39'))){_0x44226c['limit']=qs[_0xbccd('0x1c')](_0x209f6a[_0xbccd('0x31')][_0xbccd('0x1c')]);_0x44226c['offset']=qs[_0xbccd('0x1a')](_0x209f6a[_0xbccd('0x31')][_0xbccd('0x1a')]);}_0x44226c['order']=qs[_0xbccd('0x3a')](_0x209f6a[_0xbccd('0x31')][_0xbccd('0x3a')]);_0x44226c['where']=qs['filters'](_[_0xbccd('0x3b')](_0x209f6a['query'],_0x117c72[_0xbccd('0x33')]),_0xacf0c6);if(_0x209f6a[_0xbccd('0x31')][_0xbccd('0x3c')]){_0x44226c[_0xbccd('0x3d')]=_['merge'](_0x44226c[_0xbccd('0x3d')],{'$or':_[_0xbccd('0x2b')](_0xacf0c6,function(_0x45937d){if(_0x45937d[_0xbccd('0x2f')]!==_0xbccd('0x3e')){var _0x2a2aac={};_0x2a2aac[_0x45937d[_0xbccd('0x28')]]={'$like':'%'+_0x209f6a[_0xbccd('0x31')][_0xbccd('0x3c')]+'%'};return _0x2a2aac;}})});}_0x44226c=_[_0xbccd('0x3f')]({},_0x44226c,_0x209f6a['options']);var _0x581259={'where':_0x44226c['where']};return db['SmsApplication'][_0xbccd('0x1d')](_0x581259)[_0xbccd('0x23')](function(_0x4091dd){_0x48dba5[_0xbccd('0x1d')]=_0x4091dd;if(_0x209f6a[_0xbccd('0x31')][_0xbccd('0x40')]){_0x44226c['include']=[{'all':!![]}];}return db[_0xbccd('0x2c')][_0xbccd('0x41')](_0x44226c);})['then'](function(_0x48e09c){_0x48dba5['rows']=_0x48e09c;return _0x48dba5;})[_0xbccd('0x23')](respondWithFilteredResult(_0x3357f6,_0x44226c))['catch'](handleError(_0x3357f6,null));};exports[_0xbccd('0x42')]=function(_0x3e4621,_0x35d2b9){var _0x514e34={'raw':!![],'where':{'id':_0x3e4621['params']['id']}},_0x3a4cb9={};_0x3a4cb9['model']=_[_0xbccd('0x32')](db[_0xbccd('0x2c')][_0xbccd('0x2d')]);_0x3a4cb9[_0xbccd('0x31')]=_['keys'](_0x3e4621[_0xbccd('0x31')]);_0x3a4cb9[_0xbccd('0x33')]=_[_0xbccd('0x35')](_0x3a4cb9[_0xbccd('0x30')],_0x3a4cb9['query']);_0x514e34['attributes']=_[_0xbccd('0x35')](_0x3a4cb9[_0xbccd('0x30')],qs[_0xbccd('0x36')](_0x3e4621['query'][_0xbccd('0x36')]));_0x514e34[_0xbccd('0x34')]=_0x514e34[_0xbccd('0x34')][_0xbccd('0x37')]?_0x514e34[_0xbccd('0x34')]:_0x3a4cb9[_0xbccd('0x30')];if(_0x3e4621[_0xbccd('0x31')][_0xbccd('0x40')]){_0x514e34[_0xbccd('0x43')]=[{'all':!![]}];}_0x514e34=_[_0xbccd('0x3f')]({},_0x514e34,_0x3e4621[_0xbccd('0x44')]);return db['SmsApplication'][_0xbccd('0x45')](_0x514e34)['then'](handleEntityNotFound(_0x35d2b9,null))[_0xbccd('0x23')](respondWithResult(_0x35d2b9,null))[_0xbccd('0x46')](handleError(_0x35d2b9,null));};exports[_0xbccd('0x47')]=function(_0x1e7fbe,_0x4b2e73){return db[_0xbccd('0x2c')][_0xbccd('0x47')](_0x1e7fbe[_0xbccd('0x48')],{})[_0xbccd('0x23')](respondWithResult(_0x4b2e73,0xc9))[_0xbccd('0x46')](handleError(_0x4b2e73,null));};exports[_0xbccd('0x22')]=function(_0x3c19ee,_0x258ad0){if(_0x3c19ee['body']['id']){delete _0x3c19ee[_0xbccd('0x48')]['id'];}return db[_0xbccd('0x2c')][_0xbccd('0x45')]({'where':{'id':_0x3c19ee[_0xbccd('0x49')]['id']}})[_0xbccd('0x23')](handleEntityNotFound(_0x258ad0,null))[_0xbccd('0x23')](saveUpdates(_0x3c19ee['body'],null))['then'](respondWithResult(_0x258ad0,null))[_0xbccd('0x46')](handleError(_0x258ad0,null));};exports['destroy']=function(_0x3d32b0,_0x36a135){return db[_0xbccd('0x2c')][_0xbccd('0x45')]({'where':{'id':_0x3d32b0[_0xbccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x36a135,null))[_0xbccd('0x23')](removeEntity(_0x36a135,null))[_0xbccd('0x46')](handleError(_0x36a135,null));}; \ No newline at end of file +var _0x716c=['apply','reject','update','then','destroy','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../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'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x716c,0xfe));var _0xc716=function(_0x3c87b4,_0x34a407){_0x3c87b4=_0x3c87b4-0x0;var _0x481001=_0x716c[_0x3c87b4];return _0x481001;};'use strict';var emlformat=require(_0xc716('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc716('0x1'));var jsonpatch=require(_0xc716('0x2'));var rp=require(_0xc716('0x3'));var moment=require(_0xc716('0x4'));var BPromise=require(_0xc716('0x5'));var Mustache=require('mustache');var util=require(_0xc716('0x6'));var path=require(_0xc716('0x7'));var sox=require(_0xc716('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc716('0x9'));var _=require('lodash');var squel=require(_0xc716('0xa'));var crypto=require(_0xc716('0xb'));var jsforce=require(_0xc716('0xc'));var deskjs=require(_0xc716('0xd'));var toCsv=require(_0xc716('0xe'));var querystring=require(_0xc716('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc716('0x10'));var as=require(_0xc716('0x11'));var hardwareService=require(_0xc716('0x12'));var logger=require(_0xc716('0x13'))(_0xc716('0x14'));var utils=require(_0xc716('0x15'));var config=require(_0xc716('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc716('0x17'))['db'];function respondWithStatusCode(_0x727bcb,_0x310828){_0x310828=_0x310828||0xcc;return function(_0x5d8713){if(_0x5d8713){return _0x727bcb[_0xc716('0x18')](_0x310828);}return _0x727bcb[_0xc716('0x19')](_0x310828)[_0xc716('0x1a')]();};}function respondWithResult(_0xb79480,_0x26e253){_0x26e253=_0x26e253||0xc8;return function(_0x444c30){if(_0x444c30){return _0xb79480['status'](_0x26e253)[_0xc716('0x1b')](_0x444c30);}};}function respondWithFilteredResult(_0x942acd,_0x1c1fa1){return function(_0x40c945){if(_0x40c945){var _0x3f0709=typeof _0x1c1fa1[_0xc716('0x1c')]===_0xc716('0x1d')&&typeof _0x1c1fa1[_0xc716('0x1e')]==='undefined';var _0xc61b5=_0x40c945[_0xc716('0x1f')];var _0x2ac6f4=_0x3f0709?0x0:_0x1c1fa1[_0xc716('0x1c')];var _0x4f9a61=_0x3f0709?_0x40c945[_0xc716('0x1f')]:_0x1c1fa1[_0xc716('0x1c')]+_0x1c1fa1[_0xc716('0x1e')];var _0x215353;if(_0x4f9a61>=_0xc61b5){_0x4f9a61=_0xc61b5;_0x215353=0xc8;}else{_0x215353=0xce;}_0x942acd[_0xc716('0x19')](_0x215353);return _0x942acd[_0xc716('0x20')](_0xc716('0x21'),_0x2ac6f4+'-'+_0x4f9a61+'/'+_0xc61b5)[_0xc716('0x1b')](_0x40c945);}return null;};}function patchUpdates(_0x4ad688){return function(_0x2fc90d){try{jsonpatch[_0xc716('0x22')](_0x2fc90d,_0x4ad688,!![]);}catch(_0x2ef8d1){return BPromise[_0xc716('0x23')](_0x2ef8d1);}return _0x2fc90d['save']();};}function saveUpdates(_0x3a2c49,_0x4a6a3f){return function(_0x523471){if(_0x523471){return _0x523471[_0xc716('0x24')](_0x3a2c49)[_0xc716('0x25')](function(_0x1da2d9){return _0x1da2d9;});}return null;};}function removeEntity(_0x5380b0,_0x5efaf9){return function(_0x494ffa){if(_0x494ffa){return _0x494ffa[_0xc716('0x26')]()['then'](function(){_0x5380b0[_0xc716('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31f720,_0x236327){return function(_0xe4f278){if(!_0xe4f278){_0x31f720[_0xc716('0x18')](0x194);}return _0xe4f278;};}function handleError(_0xb07084,_0x374140){_0x374140=_0x374140||0x1f4;return function(_0x1b321a){logger['error'](_0x1b321a[_0xc716('0x27')]);if(_0x1b321a[_0xc716('0x28')]){delete _0x1b321a[_0xc716('0x28')];}_0xb07084[_0xc716('0x19')](_0x374140)[_0xc716('0x29')](_0x1b321a);};}exports['index']=function(_0x150657,_0x271186){var _0xc40f63={},_0x21a99b={},_0x1ae6b0={'count':0x0,'rows':[]};var _0x33618d=_[_0xc716('0x2a')](db[_0xc716('0x2b')][_0xc716('0x2c')],function(_0x885993){return{'name':_0x885993[_0xc716('0x2d')],'type':_0x885993[_0xc716('0x2e')]['key']};});_0x21a99b['model']=_[_0xc716('0x2a')](_0x33618d,_0xc716('0x28'));_0x21a99b[_0xc716('0x2f')]=_['keys'](_0x150657['query']);_0x21a99b['filters']=_[_0xc716('0x30')](_0x21a99b[_0xc716('0x31')],_0x21a99b[_0xc716('0x2f')]);_0xc40f63[_0xc716('0x32')]=_[_0xc716('0x30')](_0x21a99b[_0xc716('0x31')],qs['fields'](_0x150657[_0xc716('0x2f')][_0xc716('0x33')]));_0xc40f63[_0xc716('0x32')]=_0xc40f63[_0xc716('0x32')][_0xc716('0x34')]?_0xc40f63['attributes']:_0x21a99b[_0xc716('0x31')];if(!_0x150657[_0xc716('0x2f')][_0xc716('0x35')]('nolimit')){_0xc40f63[_0xc716('0x1e')]=qs['limit'](_0x150657['query'][_0xc716('0x1e')]);_0xc40f63[_0xc716('0x1c')]=qs[_0xc716('0x1c')](_0x150657['query'][_0xc716('0x1c')]);}_0xc40f63[_0xc716('0x36')]=qs[_0xc716('0x37')](_0x150657[_0xc716('0x2f')]['sort']);_0xc40f63['where']=qs[_0xc716('0x38')](_[_0xc716('0x39')](_0x150657[_0xc716('0x2f')],_0x21a99b[_0xc716('0x38')]),_0x33618d);if(_0x150657[_0xc716('0x2f')]['filter']){_0xc40f63[_0xc716('0x3a')]=_['merge'](_0xc40f63[_0xc716('0x3a')],{'$or':_[_0xc716('0x2a')](_0x33618d,function(_0x2d3eed){if(_0x2d3eed[_0xc716('0x2e')]!=='VIRTUAL'){var _0x524edd={};_0x524edd[_0x2d3eed[_0xc716('0x28')]]={'$like':'%'+_0x150657[_0xc716('0x2f')][_0xc716('0x3b')]+'%'};return _0x524edd;}})});}_0xc40f63=_[_0xc716('0x3c')]({},_0xc40f63,_0x150657[_0xc716('0x3d')]);var _0x3d6a0e={'where':_0xc40f63[_0xc716('0x3a')]};return db['SmsApplication'][_0xc716('0x1f')](_0x3d6a0e)['then'](function(_0xe12469){_0x1ae6b0[_0xc716('0x1f')]=_0xe12469;if(_0x150657['query'][_0xc716('0x3e')]){_0xc40f63[_0xc716('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xc716('0x40')](_0xc40f63);})['then'](function(_0x52964f){_0x1ae6b0['rows']=_0x52964f;return _0x1ae6b0;})[_0xc716('0x25')](respondWithFilteredResult(_0x271186,_0xc40f63))[_0xc716('0x41')](handleError(_0x271186,null));};exports[_0xc716('0x42')]=function(_0x58268d,_0x3987f2){var _0x14bc86={'raw':!![],'where':{'id':_0x58268d['params']['id']}},_0x1f5e58={};_0x1f5e58['model']=_[_0xc716('0x43')](db[_0xc716('0x2b')][_0xc716('0x2c')]);_0x1f5e58[_0xc716('0x2f')]=_[_0xc716('0x43')](_0x58268d[_0xc716('0x2f')]);_0x1f5e58[_0xc716('0x38')]=_['intersection'](_0x1f5e58['model'],_0x1f5e58[_0xc716('0x2f')]);_0x14bc86[_0xc716('0x32')]=_[_0xc716('0x30')](_0x1f5e58['model'],qs[_0xc716('0x33')](_0x58268d[_0xc716('0x2f')][_0xc716('0x33')]));_0x14bc86[_0xc716('0x32')]=_0x14bc86[_0xc716('0x32')][_0xc716('0x34')]?_0x14bc86[_0xc716('0x32')]:_0x1f5e58[_0xc716('0x31')];if(_0x58268d[_0xc716('0x2f')][_0xc716('0x3e')]){_0x14bc86[_0xc716('0x3f')]=[{'all':!![]}];}_0x14bc86=_['merge']({},_0x14bc86,_0x58268d[_0xc716('0x3d')]);return db['SmsApplication'][_0xc716('0x44')](_0x14bc86)[_0xc716('0x25')](handleEntityNotFound(_0x3987f2,null))['then'](respondWithResult(_0x3987f2,null))[_0xc716('0x41')](handleError(_0x3987f2,null));};exports[_0xc716('0x45')]=function(_0x57b8df,_0x469129){return db['SmsApplication'][_0xc716('0x45')](_0x57b8df[_0xc716('0x46')],{})[_0xc716('0x25')](respondWithResult(_0x469129,0xc9))[_0xc716('0x41')](handleError(_0x469129,null));};exports[_0xc716('0x24')]=function(_0x1dac29,_0x14a4e2){if(_0x1dac29[_0xc716('0x46')]['id']){delete _0x1dac29['body']['id'];}return db[_0xc716('0x2b')][_0xc716('0x44')]({'where':{'id':_0x1dac29['params']['id']}})[_0xc716('0x25')](handleEntityNotFound(_0x14a4e2,null))[_0xc716('0x25')](saveUpdates(_0x1dac29['body'],null))[_0xc716('0x25')](respondWithResult(_0x14a4e2,null))[_0xc716('0x41')](handleError(_0x14a4e2,null));};exports[_0xc716('0x26')]=function(_0x2ef6f8,_0x551fc7){return db[_0xc716('0x2b')][_0xc716('0x44')]({'where':{'id':_0x2ef6f8[_0xc716('0x47')]['id']}})[_0xc716('0x25')](handleEntityNotFound(_0x551fc7,null))[_0xc716('0x25')](removeEntity(_0x551fc7,null))[_0xc716('0x41')](handleError(_0x551fc7,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index aca7b0f..63fac9d 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 _0x8812=['request-promise','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x1f2c5c,_0x445d36){var _0x4c612b=function(_0x56d536){while(--_0x56d536){_0x1f2c5c['push'](_0x1f2c5c['shift']());}};_0x4c612b(++_0x445d36);}(_0x8812,0x1cf));var _0x2881=function(_0x2a4d4d,_0x4c9667){_0x2a4d4d=_0x2a4d4d-0x0;var _0xb6dd32=_0x8812[_0x2a4d4d];return _0xb6dd32;};'use strict';var _=require(_0x2881('0x0'));var util=require(_0x2881('0x1'));var logger=require(_0x2881('0x2'))(_0x2881('0x3'));var moment=require('moment');var BPromise=require(_0x2881('0x4'));var rp=require(_0x2881('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2881('0x6'));var attributes=require(_0x2881('0x7'));module[_0x2881('0x8')]=function(_0xfe21c4,_0x1b2d9f){return _0xfe21c4[_0x2881('0x9')](_0x2881('0xa'),attributes,{'tableName':_0x2881('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2881('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9348=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4b39c5,_0xdc7e40){var _0x547ce6=function(_0x2dd53a){while(--_0x2dd53a){_0x4b39c5['push'](_0x4b39c5['shift']());}};_0x547ce6(++_0xdc7e40);}(_0x9348,0x160));var _0x8934=function(_0x4474d5,_0x49ed83){_0x4474d5=_0x4474d5-0x0;var _0x5a3055=_0x9348[_0x4474d5];return _0x5a3055;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require(_0x8934('0x7'));var config=require(_0x8934('0x8'));var attributes=require(_0x8934('0x9'));module[_0x8934('0xa')]=function(_0x3bb404,_0x5ae829){return _0x3bb404[_0x8934('0xb')](_0x8934('0xc'),attributes,{'tableName':_0x8934('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8934('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c355588..ec00a26 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 _0x6829=['http','then','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e7d34,_0x48ca65){var _0x4510d5=function(_0x3083ac){while(--_0x3083ac){_0x3e7d34['push'](_0x3e7d34['shift']());}};_0x4510d5(++_0x48ca65);}(_0x6829,0x14c));var _0x9682=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6829[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9682('0x2'));var db=require(_0x9682('0x3'))['db'];var utils=require(_0x9682('0x4'));var logger=require(_0x9682('0x5'))(_0x9682('0x6'));var config=require(_0x9682('0x7'));var jayson=require(_0x9682('0x8'));var client=jayson[_0x9682('0x9')][_0x9682('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cec91,_0x37ab0a,_0x1cca2f){return new BPromise(function(_0x576a39,_0x519138){return client['request'](_0x4cec91,_0x1cca2f)[_0x9682('0xb')](function(_0x1b27c2){logger['info'](_0x9682('0xc'),_0x37ab0a,'request\x20sent');logger[_0x9682('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x37ab0a,_0x9682('0xe'),JSON[_0x9682('0xf')](_0x1b27c2));if(_0x1b27c2[_0x9682('0x10')]){if(_0x1b27c2['error']['code']===0x1f4){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2['error'][_0x9682('0x11')]);return _0x519138(_0x1b27c2['error'][_0x9682('0x11')]);}logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);return _0x576a39(_0x1b27c2[_0x9682('0x10')][_0x9682('0x11')]);}else{logger[_0x9682('0x12')](_0x9682('0xc'),_0x37ab0a,_0x9682('0xe'));_0x576a39(_0x1b27c2['result'][_0x9682('0x11')]);}})['catch'](function(_0x23eef6){logger[_0x9682('0x10')](_0x9682('0xc'),_0x37ab0a,_0x23eef6);_0x519138(_0x23eef6);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x1f73c3,_0xa8af11){var _0x20450e=function(_0x2f30fb){while(--_0x2f30fb){_0x1f73c3['push'](_0x1f73c3['shift']());}};_0x20450e(++_0xa8af11);}(_0xda2d,0x102));var _0xdda2=function(_0x3000e8,_0x323728){_0x3000e8=_0x3000e8-0x0;var _0xee0b6c=_0xda2d[_0x3000e8];return _0xee0b6c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 049b6d4..2be0547 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 _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x370bc5,_0x25f47c){var _0x536232=function(_0x4c6b8e){while(--_0x4c6b8e){_0x370bc5['push'](_0x370bc5['shift']());}};_0x536232(++_0x25f47c);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xe5b5[_0x2b0f81];return _0x5ce74c;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);module['exports']=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x306076,_0x5b7328){var _0x47ff5c=function(_0x39b1a0){while(--_0x39b1a0){_0x306076['push'](_0x306076['shift']());}};_0x47ff5c(++_0x5b7328);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index eeff462..bbba4e4 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 _0x7fee=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x3f1d02,_0x25aab2){var _0x29be32=function(_0x1a2232){while(--_0x1a2232){_0x3f1d02['push'](_0x3f1d02['shift']());}};_0x29be32(++_0x25aab2);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x7fee[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0xe7fe('0x0'));var moment=require(_0xe7fe('0x1'));module[_0xe7fe('0x2')]={'closed':{'type':Sequelize[_0xe7fe('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe7fe('0x4')]},'disposition':{'type':Sequelize[_0xe7fe('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe7fe('0x5')]},'note':{'type':Sequelize[_0xe7fe('0x5')]},'phone':{'type':Sequelize[_0xe7fe('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe7fe('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe7fe('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe7fe('0x6')]('in',_0xe7fe('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe7fe('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe7fe('0x8')]}}; \ No newline at end of file +var _0xd05a=['BOOLEAN','moment','exports','STRING','DATE','ENUM','out'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xd05a,0x143));var _0xad05=function(_0x353e91,_0x19c531){_0x353e91=_0x353e91-0x0;var _0x5385d3=_0xd05a[_0x353e91];return _0x5385d3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xad05('0x0'));module[_0xad05('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xad05('0x2')]},'note':{'type':Sequelize[_0xad05('0x2')]},'phone':{'type':Sequelize[_0xad05('0x2')]},'read1stAt':{'type':Sequelize[_0xad05('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xad05('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xad05('0x4')]('in',_0xad05('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xad05('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 c0cf659..69b78c9 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 _0x0ad1=['rows','addTags','spread','Tag','color','emit','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','User','push','CmContact','firstName','Messages','createdAt','direction','secret','SmsAccount','Owner','fullname','get','mkdirSync','closed','closedAt','toString','filter','out','System','Contact','lastName','read','value','renderFile','views','transcript-','.pdf','log','sendStatus','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','./smsInteraction.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','update','error','name','send','map','rawAttributes','fieldName','type','key','findAll','sms','user','then','show','params','model','keys','filters','intersection','query','attributes','fields','length','includeAll','include','merge','options','SmsInteraction','catch','create','body','find','destroy','describe','SmsMessage','addMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a5d06,_0x46962c){var _0x145f10=function(_0x38b135){while(--_0x38b135){_0x1a5d06['push'](_0x1a5d06['shift']());}};_0x145f10(++_0x46962c);}(_0x0ad1,0x114));var _0x10ad=function(_0x1e8ceb,_0x3ebc97){_0x1e8ceb=_0x1e8ceb-0x0;var _0x1d85a4=_0x0ad1[_0x1e8ceb];return _0x1d85a4;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x10ad('0x0'));var BPromise=require(_0x10ad('0x1'));var util=require(_0x10ad('0x2'));var path=require(_0x10ad('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x10ad('0x4'));var interaction=require(_0x10ad('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x10ad('0x6'));var logger=require(_0x10ad('0x7'))(_0x10ad('0x8'));var config=require(_0x10ad('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x10ad('0xa')](config[_0x10ad('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10ad('0xb')]));require(_0x10ad('0xc'))[_0x10ad('0xd')](socket);function respondWithStatusCode(_0x18e862,_0x3bead3){_0x3bead3=_0x3bead3||0xcc;return function(_0x5c21fb){if(_0x5c21fb){return _0x18e862['sendStatus'](_0x3bead3);}return _0x18e862[_0x10ad('0xe')](_0x3bead3)[_0x10ad('0xf')]();};}function respondWithResult(_0x4f3fce,_0x32b4f6){_0x32b4f6=_0x32b4f6||0xc8;return function(_0x4f6222){if(_0x4f6222){return _0x4f3fce[_0x10ad('0xe')](_0x32b4f6)['json'](_0x4f6222);}};}function respondWithFilteredResult(_0x4d16eb,_0x4c89b2){return function(_0x4cfbbf){if(_0x4cfbbf){var _0x5a1017=typeof _0x4c89b2[_0x10ad('0x10')]===_0x10ad('0x11')&&typeof _0x4c89b2[_0x10ad('0x12')]==='undefined';var _0x5437cd=_0x4cfbbf['count'];var _0x352d1a=_0x5a1017?0x0:_0x4c89b2[_0x10ad('0x10')];var _0xe16a23=_0x5a1017?_0x4cfbbf[_0x10ad('0x13')]:_0x4c89b2[_0x10ad('0x10')]+_0x4c89b2[_0x10ad('0x12')];var _0xb67e50;if(_0xe16a23>=_0x5437cd){_0xe16a23=_0x5437cd;_0xb67e50=0xc8;}else{_0xb67e50=0xce;}_0x4d16eb['status'](_0xb67e50);return _0x4d16eb[_0x10ad('0x14')](_0x10ad('0x15'),_0x352d1a+'-'+_0xe16a23+'/'+_0x5437cd)[_0x10ad('0x16')](_0x4cfbbf);}return null;};}function saveUpdates(_0x531570){return function(_0x2401cb){if(_0x2401cb){return _0x2401cb[_0x10ad('0x17')](_0x531570)['then'](function(_0x4dd9c2){return _0x4dd9c2;});}return null;};}function removeEntity(_0xb8964e){return function(_0x4ab56b){if(_0x4ab56b){return _0x4ab56b['destroy']()['then'](function(){_0xb8964e[_0x10ad('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9a6c){return function(_0x453f80){if(!_0x453f80){_0x1a9a6c['sendStatus'](0x194);}return _0x453f80;};}function handleError(_0x349126,_0x5069bd){_0x5069bd=_0x5069bd||0x1f4;return function(_0x47ddea){logger[_0x10ad('0x18')](_0x47ddea['stack']);if(_0x47ddea['name']){delete _0x47ddea[_0x10ad('0x19')];}_0x349126[_0x10ad('0xe')](_0x5069bd)[_0x10ad('0x1a')](_0x47ddea);};}exports['index']=function(_0x53befa,_0x507a7f){var _0x4a7fe5={};var _0x3cace6=_[_0x10ad('0x1b')](db['SmsInteraction'][_0x10ad('0x1c')],function(_0x5dbcfd){return{'name':_0x5dbcfd[_0x10ad('0x1d')],'type':_0x5dbcfd[_0x10ad('0x1e')][_0x10ad('0x1f')]};});_0x4a7fe5=qs['getOptions'](_0x3cace6,_0x53befa);return interaction[_0x10ad('0x20')](_0x10ad('0x21'),_0x53befa['query'],_0x53befa[_0x10ad('0x22')],_0x4a7fe5,_0x3cace6)[_0x10ad('0x23')](respondWithFilteredResult(_0x507a7f,_0x4a7fe5))['catch'](handleError(_0x507a7f,null));};exports[_0x10ad('0x24')]=function(_0x19b6a4,_0x1dd3e3){var _0x346a4c={'raw':![],'where':{'id':_0x19b6a4[_0x10ad('0x25')]['id']}},_0x2cff7f={};_0x2cff7f[_0x10ad('0x26')]=_[_0x10ad('0x27')](db['SmsInteraction']['rawAttributes']);_0x2cff7f['query']=_[_0x10ad('0x27')](_0x19b6a4['query']);_0x2cff7f[_0x10ad('0x28')]=_[_0x10ad('0x29')](_0x2cff7f['model'],_0x2cff7f[_0x10ad('0x2a')]);_0x346a4c[_0x10ad('0x2b')]=_['intersection'](_0x2cff7f['model'],qs[_0x10ad('0x2c')](_0x19b6a4[_0x10ad('0x2a')][_0x10ad('0x2c')]));_0x346a4c[_0x10ad('0x2b')]=_0x346a4c['attributes'][_0x10ad('0x2d')]?_0x346a4c[_0x10ad('0x2b')]:_0x2cff7f[_0x10ad('0x26')];if(_0x19b6a4[_0x10ad('0x2a')][_0x10ad('0x2e')]){_0x346a4c[_0x10ad('0x2f')]=[{'all':!![]}];}_0x346a4c=_[_0x10ad('0x30')]({},_0x346a4c,_0x19b6a4[_0x10ad('0x31')]);return db[_0x10ad('0x32')]['find'](_0x346a4c)[_0x10ad('0x23')](handleEntityNotFound(_0x1dd3e3,null))['then'](respondWithResult(_0x1dd3e3,null))[_0x10ad('0x33')](handleError(_0x1dd3e3,null));};exports[_0x10ad('0x34')]=function(_0x2b9fa5,_0x1d8c49){return db[_0x10ad('0x32')][_0x10ad('0x34')](_0x2b9fa5['body'],{})[_0x10ad('0x23')](respondWithResult(_0x1d8c49,0xc9))[_0x10ad('0x33')](handleError(_0x1d8c49,null));};exports[_0x10ad('0x17')]=function(_0x275709,_0x42596a){if(_0x275709[_0x10ad('0x35')]['id']){delete _0x275709[_0x10ad('0x35')]['id'];}return db['SmsInteraction'][_0x10ad('0x36')]({'where':{'id':_0x275709[_0x10ad('0x25')]['id']}})[_0x10ad('0x23')](handleEntityNotFound(_0x42596a,null))['then'](saveUpdates(_0x275709[_0x10ad('0x35')],null))['then'](respondWithResult(_0x42596a,null))['catch'](handleError(_0x42596a,null));};exports[_0x10ad('0x37')]=function(_0x48f4eb,_0x5b227b){return db['SmsInteraction']['find']({'where':{'id':_0x48f4eb[_0x10ad('0x25')]['id']}})[_0x10ad('0x23')](handleEntityNotFound(_0x5b227b,null))[_0x10ad('0x23')](removeEntity(_0x5b227b,null))[_0x10ad('0x33')](handleError(_0x5b227b,null));};exports[_0x10ad('0x38')]=function(_0x789013,_0x5f06fc){return db[_0x10ad('0x32')][_0x10ad('0x38')]()[_0x10ad('0x23')](respondWithResult(_0x5f06fc,null))[_0x10ad('0x33')](handleError(_0x5f06fc,null));};exports['addMessage']=function(_0x1435ab,_0xf386e9){return db[_0x10ad('0x39')][_0x10ad('0x36')]({'where':{'id':_0x1435ab[_0x10ad('0x25')]['id']}})[_0x10ad('0x23')](handleEntityNotFound(_0xf386e9,null))[_0x10ad('0x23')](function(_0x135822){if(_0x135822){return _0x135822[_0x10ad('0x3a')](_0x1435ab['body'][_0x10ad('0x3b')],_[_0x10ad('0x3c')](_0x1435ab['body'],[_0x10ad('0x3b'),'id'])||{});}})[_0x10ad('0x23')](respondWithResult(_0xf386e9,null))['catch'](handleError(_0xf386e9,null));};exports['getMessages']=function(_0x2d3771,_0x3c289b){var _0x593d33={'raw':![],'where':{}};var _0x1b8e82={};var _0x87800e={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x10ad('0x3d')]({'where':{'id':_0x2d3771[_0x10ad('0x25')]['id']}})['then'](handleEntityNotFound(_0x3c289b,null))['then'](function(_0x1c277a){if(_0x1c277a){_0x1b8e82[_0x10ad('0x26')]=_[_0x10ad('0x27')](db[_0x10ad('0x39')][_0x10ad('0x1c')]);_0x1b8e82[_0x10ad('0x2a')]=_[_0x10ad('0x27')](_0x2d3771[_0x10ad('0x2a')]);_0x1b8e82[_0x10ad('0x28')]=_['intersection'](_0x1b8e82['model'],_0x1b8e82['query']);_0x593d33[_0x10ad('0x2b')]=_['intersection'](_0x1b8e82['model'],qs[_0x10ad('0x2c')](_0x2d3771[_0x10ad('0x2a')][_0x10ad('0x2c')]));_0x593d33[_0x10ad('0x2b')]=_0x593d33['attributes']['length']?_0x593d33[_0x10ad('0x2b')]:_0x1b8e82[_0x10ad('0x26')];if(!_0x2d3771[_0x10ad('0x2a')][_0x10ad('0x3e')](_0x10ad('0x3f'))){_0x593d33[_0x10ad('0x12')]=qs[_0x10ad('0x12')](_0x2d3771['query']['limit']);_0x593d33[_0x10ad('0x10')]=qs[_0x10ad('0x10')](_0x2d3771['query']['offset']);}_0x593d33[_0x10ad('0x40')]=qs[_0x10ad('0x41')](_0x2d3771[_0x10ad('0x2a')][_0x10ad('0x41')]);_0x593d33[_0x10ad('0x42')]=qs['filters'](_['pick'](_0x2d3771[_0x10ad('0x2a')],_0x1b8e82[_0x10ad('0x28')]));_0x593d33[_0x10ad('0x42')][_0x10ad('0x43')]=_0x1c277a['id'];if(_0x2d3771[_0x10ad('0x2a')]['filter']){_0x593d33[_0x10ad('0x42')]=_[_0x10ad('0x30')](_0x593d33[_0x10ad('0x42')],{'$or':_[_0x10ad('0x1b')](_0x593d33[_0x10ad('0x2b')],function(_0xfd1e4f){var _0x198e1a={};_0x198e1a[_0xfd1e4f]={'$like':'%'+_0x2d3771['query']['filter']+'%'};return _0x198e1a;})});}if(_0x2d3771['query'][_0x10ad('0x44')]){var _0xbf4734=_0x2d3771[_0x10ad('0x2a')][_0x10ad('0x44')][_0x10ad('0x45')](',');var _0x5ab654={};_0x5ab654[_0xbf4734[0x0]]={'$gte':moment(_0xbf4734[0x1])[_0x10ad('0x46')](_0x10ad('0x47'))};_0x593d33[_0x10ad('0x42')]=_[_0x10ad('0x30')](_0x593d33[_0x10ad('0x42')],_0x5ab654);}_0x593d33=_['merge']({},_0x593d33,_0x2d3771[_0x10ad('0x31')]);return db[_0x10ad('0x39')][_0x10ad('0x13')]({'where':_0x593d33[_0x10ad('0x42')]})[_0x10ad('0x23')](function(_0x48277b){_0x87800e[_0x10ad('0x13')]=_0x48277b;if(_0x2d3771[_0x10ad('0x2a')][_0x10ad('0x2e')]){_0x593d33[_0x10ad('0x2f')]=[{'all':!![]}];}return db[_0x10ad('0x39')][_0x10ad('0x20')](_0x593d33);})[_0x10ad('0x23')](function(_0x59a170){_0x87800e[_0x10ad('0x48')]=_0x59a170;return _0x87800e;});}})['then'](respondWithFilteredResult(_0x3c289b,_0x593d33))[_0x10ad('0x33')](handleError(_0x3c289b,null));};exports[_0x10ad('0x49')]=function(_0x373c13,_0x199165){return db['SmsInteraction'][_0x10ad('0x36')]({'where':{'id':_0x373c13[_0x10ad('0x25')]['id']}})['then'](handleEntityNotFound(_0x199165,null))[_0x10ad('0x23')](function(_0x401b6f){if(_0x401b6f){return _0x401b6f['setTags'](_0x373c13[_0x10ad('0x35')]['ids'],_['omit'](_0x373c13[_0x10ad('0x35')],[_0x10ad('0x3b'),'id'])||{})[_0x10ad('0x4a')](function(){return db[_0x10ad('0x4b')]['findAll']({'attributes':['id',_0x10ad('0x19'),_0x10ad('0x4c')],'where':{'id':_0x373c13[_0x10ad('0x35')][_0x10ad('0x3b')]}});})[_0x10ad('0x23')](function(_0x34b6e6){socket[_0x10ad('0x4d')]('smsInteractionTags:save',{'id':Number(_0x373c13[_0x10ad('0x25')]['id']),'tags':_0x34b6e6||[]});return{'id':Number(_0x373c13[_0x10ad('0x25')]['id']),'tags':_0x34b6e6||[]};});}})['then'](respondWithResult(_0x199165,null))[_0x10ad('0x33')](handleError(_0x199165,null));};exports[_0x10ad('0x4e')]=function(_0x1b3fba,_0x151a50){return db[_0x10ad('0x32')]['find']({'where':{'id':_0x1b3fba['params']['id']}})[_0x10ad('0x23')](handleEntityNotFound(_0x151a50,null))[_0x10ad('0x23')](function(_0x24a57d){if(_0x24a57d){return _0x24a57d['removeTags'](_0x1b3fba[_0x10ad('0x2a')][_0x10ad('0x3b')]);}})[_0x10ad('0x23')](respondWithStatusCode(_0x151a50,null))[_0x10ad('0x33')](handleError(_0x151a50,null));};exports[_0x10ad('0x4f')]=function(_0x139972,_0x176406){var _0x40bfb0=moment()[_0x10ad('0x50')]()['toString']();var _0x634e73=path['join'](config[_0x10ad('0x51')],_0x10ad('0x52'),_0x10ad('0x53'),_0x10ad('0x54'));var _0x2feb74=path[_0x10ad('0x55')](_0x634e73,_0x40bfb0);var _0x1d4625=util[_0x10ad('0x46')](_0x10ad('0x56'),_0x139972[_0x10ad('0x25')]['id'],_0x40bfb0);var _0x4b7f7e=path['join'](_0x634e73,_0x1d4625);var _0x5380cc=[];_0x5380cc['push']({'model':db['User'],'as':_0x10ad('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x5380cc[_0x10ad('0x58')]({'model':db[_0x10ad('0x59')],'as':'Contact','attributes':['id',_0x10ad('0x5a'),'lastName'],'raw':!![]});var _0xb23c69=[{'model':db[_0x10ad('0x39')],'as':_0x10ad('0x5b'),'attributes':['id',_0x10ad('0x35'),_0x10ad('0x5c'),_0x10ad('0x5d'),_0x10ad('0x5e'),'read'],'include':_0x5380cc}];_0xb23c69[_0x10ad('0x58')]({'model':db[_0x10ad('0x5f')],'as':'Account','attributes':['id',_0x10ad('0x19')]});_0xb23c69['push']({'model':db['User'],'as':_0x10ad('0x60'),'attributes':['id',_0x10ad('0x61')]});return db[_0x10ad('0x32')][_0x10ad('0x36')]({'where':{'id':_0x139972[_0x10ad('0x25')]['id']},'include':_0xb23c69})[_0x10ad('0x23')](handleEntityNotFound(_0x176406,null))[_0x10ad('0x23')](function(_0x584ac7){if(_0x584ac7){var _0xac6df3=_0x584ac7[_0x10ad('0x62')]({'plain':!![]});fs[_0x10ad('0x63')](_0x2feb74);var _0x58f04c={'channel':'Sms','account':_0xac6df3['Account'][_0x10ad('0x19')],'agent':_0xac6df3[_0x10ad('0x60')]?_0xac6df3[_0x10ad('0x60')][_0x10ad('0x61')]:'N.A.','createdAt':moment(_0xac6df3[_0x10ad('0x5c')])[_0x10ad('0x46')](_0x10ad('0x47'))['toString'](),'closedAt':_0xac6df3[_0x10ad('0x64')]?moment(_0xac6df3[_0x10ad('0x65')])[_0x10ad('0x46')](_0x10ad('0x47'))[_0x10ad('0x66')]():'','disposition':_0xac6df3['disposition'],'messages':_(_0xac6df3[_0x10ad('0x5b')])[_0x10ad('0x67')]({'secret':![]})['map'](function(_0x45fefa){return{'date':moment(_0x45fefa[_0x10ad('0x5c')])[_0x10ad('0x46')](_0x10ad('0x47'))[_0x10ad('0x66')](),'sender':_0x45fefa[_0x10ad('0x5d')]===_0x10ad('0x68')?_0x45fefa[_0x10ad('0x57')]?_0x45fefa['User'][_0x10ad('0x61')]:_0x10ad('0x69'):_0x45fefa['Contact'][_0x10ad('0x5a')]+(_0x45fefa[_0x10ad('0x6a')][_0x10ad('0x6b')]?'\x20'+_0x45fefa[_0x10ad('0x6a')][_0x10ad('0x6b')]:''),'body':_0x45fefa['body'],'direction':_0x45fefa[_0x10ad('0x5d')]===_0x10ad('0x68')?'A':'C','secret':_0x45fefa[_0x10ad('0x5e')],'read':_0x45fefa[_0x10ad('0x6c')]};})[_0x10ad('0x6d')]()};return ejs[_0x10ad('0x6e')](path['join'](config['root'],_0x10ad('0x52'),_0x10ad('0x6f'),'downloadInteraction.ejs'),{'interaction':_0x58f04c})[_0x10ad('0x23')](function(_0x4acb08){var _0x38c30d=path[_0x10ad('0x55')](_0x2feb74,_0x10ad('0x70')+_0xac6df3['id']+'-'+_0x40bfb0+_0x10ad('0x71'));var _0xd83810={'path':_0x38c30d,'channel':'Sms','interactionId':_0xac6df3['id']};return pdf['createPdfFromHTML'](_0x4acb08,_0xd83810);})[_0x10ad('0x23')](function(){return new BPromise(function(_0x5e860b,_0xe1fea){zipdir(_0x2feb74,{'saveTo':_0x4b7f7e},function(_0x169b0d,_0x30a90b){if(_0x169b0d)return _0xe1fea(_0x169b0d);return _0x5e860b(_0x30a90b);});})[_0x10ad('0x23')](function(){return new BPromise(function(_0x44beaf,_0x58099d){rimraf(_0x2feb74,function(_0x541e8b){if(_0x541e8b)_0x58099d(_0x541e8b);return _0x44beaf();});});})[_0x10ad('0x23')](function(){return _0x176406[_0x10ad('0x4f')](_0x4b7f7e,_0x1d4625,function(_0x2014ed){if(_0x2014ed){console[_0x10ad('0x72')]('err',_0x2014ed);}else{fs['unlinkSync'](_0x4b7f7e);}});});});}else{return _0x176406[_0x10ad('0x73')](0xc8);}})['catch'](handleError(_0x176406,null));}; \ No newline at end of file +var _0xeafb=['disposition','System','Contact','out','value','renderFile','server','views','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','defaults','redis','localhost','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','then','destroy','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','user','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','merge','find','create','body','update','describe','SmsMessage','addMessage','ids','omit','filters','hasOwnProperty','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','emit','removeTags','unix','toString','join','root','files','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','Sms','N.A.'];(function(_0x4148fc,_0x1a51c7){var _0x1fff84=function(_0x4f7a39){while(--_0x4f7a39){_0x4148fc['push'](_0x4148fc['shift']());}};_0x1fff84(++_0x1a51c7);}(_0xeafb,0x157));var _0xbeaf=function(_0x4f8d4b,_0x1b739d){_0x4f8d4b=_0x4f8d4b-0x0;var _0x19c786=_0xeafb[_0x4f8d4b];return _0x19c786;};'use strict';var rimraf=require(_0xbeaf('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xbeaf('0x1'));var util=require(_0xbeaf('0x2'));var path=require(_0xbeaf('0x3'));var ejs=require(_0xbeaf('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbeaf('0x5'));var interaction=require(_0xbeaf('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xbeaf('0x7'));var logger=require(_0xbeaf('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbeaf('0x9')](config[_0xbeaf('0xa')],{'host':_0xbeaf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0xbeaf('0xc')](socket);function respondWithStatusCode(_0x398e24,_0x102eb9){_0x102eb9=_0x102eb9||0xcc;return function(_0x145daa){if(_0x145daa){return _0x398e24[_0xbeaf('0xd')](_0x102eb9);}return _0x398e24[_0xbeaf('0xe')](_0x102eb9)['end']();};}function respondWithResult(_0x3291b3,_0x30a27d){_0x30a27d=_0x30a27d||0xc8;return function(_0x42b6ee){if(_0x42b6ee){return _0x3291b3[_0xbeaf('0xe')](_0x30a27d)['json'](_0x42b6ee);}};}function respondWithFilteredResult(_0x3642f6,_0x3e4be1){return function(_0x1327a7){if(_0x1327a7){var _0x4bf905=typeof _0x3e4be1[_0xbeaf('0xf')]==='undefined'&&typeof _0x3e4be1[_0xbeaf('0x10')]===_0xbeaf('0x11');var _0x2410d4=_0x1327a7[_0xbeaf('0x12')];var _0x1f3ced=_0x4bf905?0x0:_0x3e4be1['offset'];var _0xae13bf=_0x4bf905?_0x1327a7[_0xbeaf('0x12')]:_0x3e4be1[_0xbeaf('0xf')]+_0x3e4be1[_0xbeaf('0x10')];var _0x2d1268;if(_0xae13bf>=_0x2410d4){_0xae13bf=_0x2410d4;_0x2d1268=0xc8;}else{_0x2d1268=0xce;}_0x3642f6[_0xbeaf('0xe')](_0x2d1268);return _0x3642f6[_0xbeaf('0x13')](_0xbeaf('0x14'),_0x1f3ced+'-'+_0xae13bf+'/'+_0x2410d4)['json'](_0x1327a7);}return null;};}function saveUpdates(_0xee740){return function(_0x1f7e17){if(_0x1f7e17){return _0x1f7e17['update'](_0xee740)[_0xbeaf('0x15')](function(_0x483c1e){return _0x483c1e;});}return null;};}function removeEntity(_0x5bfa66){return function(_0x41b56b){if(_0x41b56b){return _0x41b56b[_0xbeaf('0x16')]()[_0xbeaf('0x15')](function(){_0x5bfa66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed6e59){return function(_0x3bbff1){if(!_0x3bbff1){_0xed6e59[_0xbeaf('0xd')](0x194);}return _0x3bbff1;};}function handleError(_0x14a59c,_0x241f4a){_0x241f4a=_0x241f4a||0x1f4;return function(_0x534034){logger['error'](_0x534034['stack']);if(_0x534034[_0xbeaf('0x17')]){delete _0x534034[_0xbeaf('0x17')];}_0x14a59c[_0xbeaf('0xe')](_0x241f4a)[_0xbeaf('0x18')](_0x534034);};}exports[_0xbeaf('0x19')]=function(_0x6f157c,_0x4ab762){var _0x2899fb={};var _0x501254=_[_0xbeaf('0x1a')](db[_0xbeaf('0x1b')][_0xbeaf('0x1c')],function(_0x5337cc){return{'name':_0x5337cc[_0xbeaf('0x1d')],'type':_0x5337cc[_0xbeaf('0x1e')][_0xbeaf('0x1f')]};});_0x2899fb=qs['getOptions'](_0x501254,_0x6f157c);return interaction[_0xbeaf('0x20')](_0xbeaf('0x21'),_0x6f157c['query'],_0x6f157c[_0xbeaf('0x22')],_0x2899fb,_0x501254)[_0xbeaf('0x15')](respondWithFilteredResult(_0x4ab762,_0x2899fb))[_0xbeaf('0x23')](handleError(_0x4ab762,null));};exports[_0xbeaf('0x24')]=function(_0x173f2e,_0x461e20){var _0x50799d={'raw':![],'where':{'id':_0x173f2e[_0xbeaf('0x25')]['id']}},_0x571ee3={};_0x571ee3[_0xbeaf('0x26')]=_[_0xbeaf('0x27')](db[_0xbeaf('0x1b')]['rawAttributes']);_0x571ee3[_0xbeaf('0x28')]=_['keys'](_0x173f2e['query']);_0x571ee3['filters']=_[_0xbeaf('0x29')](_0x571ee3[_0xbeaf('0x26')],_0x571ee3['query']);_0x50799d['attributes']=_['intersection'](_0x571ee3[_0xbeaf('0x26')],qs[_0xbeaf('0x2a')](_0x173f2e['query'][_0xbeaf('0x2a')]));_0x50799d['attributes']=_0x50799d[_0xbeaf('0x2b')][_0xbeaf('0x2c')]?_0x50799d[_0xbeaf('0x2b')]:_0x571ee3[_0xbeaf('0x26')];if(_0x173f2e[_0xbeaf('0x28')][_0xbeaf('0x2d')]){_0x50799d['include']=[{'all':!![]}];}_0x50799d=_[_0xbeaf('0x2e')]({},_0x50799d,_0x173f2e['options']);return db[_0xbeaf('0x1b')][_0xbeaf('0x2f')](_0x50799d)[_0xbeaf('0x15')](handleEntityNotFound(_0x461e20,null))[_0xbeaf('0x15')](respondWithResult(_0x461e20,null))[_0xbeaf('0x23')](handleError(_0x461e20,null));};exports[_0xbeaf('0x30')]=function(_0x32d4b6,_0x1606cf){return db[_0xbeaf('0x1b')]['create'](_0x32d4b6[_0xbeaf('0x31')],{})[_0xbeaf('0x15')](respondWithResult(_0x1606cf,0xc9))['catch'](handleError(_0x1606cf,null));};exports[_0xbeaf('0x32')]=function(_0x38945d,_0x1efdfd){if(_0x38945d['body']['id']){delete _0x38945d['body']['id'];}return db[_0xbeaf('0x1b')][_0xbeaf('0x2f')]({'where':{'id':_0x38945d['params']['id']}})[_0xbeaf('0x15')](handleEntityNotFound(_0x1efdfd,null))['then'](saveUpdates(_0x38945d['body'],null))[_0xbeaf('0x15')](respondWithResult(_0x1efdfd,null))['catch'](handleError(_0x1efdfd,null));};exports[_0xbeaf('0x16')]=function(_0x1613d3,_0x3c9ae8){return db[_0xbeaf('0x1b')]['find']({'where':{'id':_0x1613d3[_0xbeaf('0x25')]['id']}})[_0xbeaf('0x15')](handleEntityNotFound(_0x3c9ae8,null))[_0xbeaf('0x15')](removeEntity(_0x3c9ae8,null))[_0xbeaf('0x23')](handleError(_0x3c9ae8,null));};exports[_0xbeaf('0x33')]=function(_0x5797c2,_0xfb20d2){return db[_0xbeaf('0x1b')][_0xbeaf('0x33')]()['then'](respondWithResult(_0xfb20d2,null))['catch'](handleError(_0xfb20d2,null));};exports['addMessage']=function(_0x44a423,_0x298bc4){return db[_0xbeaf('0x34')]['find']({'where':{'id':_0x44a423[_0xbeaf('0x25')]['id']}})[_0xbeaf('0x15')](handleEntityNotFound(_0x298bc4,null))[_0xbeaf('0x15')](function(_0x5e4878){if(_0x5e4878){return _0x5e4878[_0xbeaf('0x35')](_0x44a423[_0xbeaf('0x31')][_0xbeaf('0x36')],_[_0xbeaf('0x37')](_0x44a423['body'],[_0xbeaf('0x36'),'id'])||{});}})[_0xbeaf('0x15')](respondWithResult(_0x298bc4,null))[_0xbeaf('0x23')](handleError(_0x298bc4,null));};exports['getMessages']=function(_0x4bcd0e,_0x1a185b){var _0xfd3e04={'raw':![],'where':{}};var _0x58761c={};var _0x1201d1={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4bcd0e[_0xbeaf('0x25')]['id']}})[_0xbeaf('0x15')](handleEntityNotFound(_0x1a185b,null))[_0xbeaf('0x15')](function(_0x4df18f){if(_0x4df18f){_0x58761c[_0xbeaf('0x26')]=_[_0xbeaf('0x27')](db[_0xbeaf('0x34')][_0xbeaf('0x1c')]);_0x58761c[_0xbeaf('0x28')]=_[_0xbeaf('0x27')](_0x4bcd0e[_0xbeaf('0x28')]);_0x58761c[_0xbeaf('0x38')]=_[_0xbeaf('0x29')](_0x58761c['model'],_0x58761c[_0xbeaf('0x28')]);_0xfd3e04[_0xbeaf('0x2b')]=_['intersection'](_0x58761c[_0xbeaf('0x26')],qs[_0xbeaf('0x2a')](_0x4bcd0e[_0xbeaf('0x28')]['fields']));_0xfd3e04[_0xbeaf('0x2b')]=_0xfd3e04[_0xbeaf('0x2b')]['length']?_0xfd3e04[_0xbeaf('0x2b')]:_0x58761c['model'];if(!_0x4bcd0e[_0xbeaf('0x28')][_0xbeaf('0x39')]('nolimit')){_0xfd3e04['limit']=qs[_0xbeaf('0x10')](_0x4bcd0e[_0xbeaf('0x28')]['limit']);_0xfd3e04[_0xbeaf('0xf')]=qs[_0xbeaf('0xf')](_0x4bcd0e[_0xbeaf('0x28')]['offset']);}_0xfd3e04[_0xbeaf('0x3a')]=qs[_0xbeaf('0x3b')](_0x4bcd0e[_0xbeaf('0x28')][_0xbeaf('0x3b')]);_0xfd3e04[_0xbeaf('0x3c')]=qs[_0xbeaf('0x38')](_['pick'](_0x4bcd0e[_0xbeaf('0x28')],_0x58761c[_0xbeaf('0x38')]));_0xfd3e04[_0xbeaf('0x3c')][_0xbeaf('0x3d')]=_0x4df18f['id'];if(_0x4bcd0e[_0xbeaf('0x28')]['filter']){_0xfd3e04[_0xbeaf('0x3c')]=_[_0xbeaf('0x2e')](_0xfd3e04['where'],{'$or':_['map'](_0xfd3e04['attributes'],function(_0x3e3aae){var _0x121bb2={};_0x121bb2[_0x3e3aae]={'$like':'%'+_0x4bcd0e[_0xbeaf('0x28')][_0xbeaf('0x3e')]+'%'};return _0x121bb2;})});}if(_0x4bcd0e[_0xbeaf('0x28')][_0xbeaf('0x3f')]){var _0x49b205=_0x4bcd0e[_0xbeaf('0x28')]['$gte'][_0xbeaf('0x40')](',');var _0x314dd1={};_0x314dd1[_0x49b205[0x0]]={'$gte':moment(_0x49b205[0x1])[_0xbeaf('0x41')](_0xbeaf('0x42'))};_0xfd3e04[_0xbeaf('0x3c')]=_[_0xbeaf('0x2e')](_0xfd3e04['where'],_0x314dd1);}_0xfd3e04=_[_0xbeaf('0x2e')]({},_0xfd3e04,_0x4bcd0e['options']);return db[_0xbeaf('0x34')][_0xbeaf('0x12')]({'where':_0xfd3e04[_0xbeaf('0x3c')]})[_0xbeaf('0x15')](function(_0x22f884){_0x1201d1[_0xbeaf('0x12')]=_0x22f884;if(_0x4bcd0e[_0xbeaf('0x28')][_0xbeaf('0x2d')]){_0xfd3e04[_0xbeaf('0x43')]=[{'all':!![]}];}return db['SmsMessage'][_0xbeaf('0x20')](_0xfd3e04);})[_0xbeaf('0x15')](function(_0x3fd84c){_0x1201d1[_0xbeaf('0x44')]=_0x3fd84c;return _0x1201d1;});}})[_0xbeaf('0x15')](respondWithFilteredResult(_0x1a185b,_0xfd3e04))['catch'](handleError(_0x1a185b,null));};exports[_0xbeaf('0x45')]=function(_0xe7a229,_0x592d2b){return db[_0xbeaf('0x1b')][_0xbeaf('0x2f')]({'where':{'id':_0xe7a229[_0xbeaf('0x25')]['id']}})[_0xbeaf('0x15')](handleEntityNotFound(_0x592d2b,null))['then'](function(_0x583ede){if(_0x583ede){return _0x583ede[_0xbeaf('0x46')](_0xe7a229[_0xbeaf('0x31')]['ids'],_['omit'](_0xe7a229['body'],[_0xbeaf('0x36'),'id'])||{})[_0xbeaf('0x47')](function(){return db[_0xbeaf('0x48')][_0xbeaf('0x20')]({'attributes':['id','name','color'],'where':{'id':_0xe7a229[_0xbeaf('0x31')][_0xbeaf('0x36')]}});})[_0xbeaf('0x15')](function(_0x5c5d1c){socket[_0xbeaf('0x49')]('smsInteractionTags:save',{'id':Number(_0xe7a229[_0xbeaf('0x25')]['id']),'tags':_0x5c5d1c||[]});return{'id':Number(_0xe7a229[_0xbeaf('0x25')]['id']),'tags':_0x5c5d1c||[]};});}})[_0xbeaf('0x15')](respondWithResult(_0x592d2b,null))[_0xbeaf('0x23')](handleError(_0x592d2b,null));};exports[_0xbeaf('0x4a')]=function(_0x34516a,_0xf07a77){return db[_0xbeaf('0x1b')]['find']({'where':{'id':_0x34516a['params']['id']}})['then'](handleEntityNotFound(_0xf07a77,null))[_0xbeaf('0x15')](function(_0x1e7454){if(_0x1e7454){return _0x1e7454['removeTags'](_0x34516a['query'][_0xbeaf('0x36')]);}})[_0xbeaf('0x15')](respondWithStatusCode(_0xf07a77,null))['catch'](handleError(_0xf07a77,null));};exports['download']=function(_0x13ccc,_0x287b55){var _0x42f250=moment()[_0xbeaf('0x4b')]()[_0xbeaf('0x4c')]();var _0x39069a=path[_0xbeaf('0x4d')](config[_0xbeaf('0x4e')],'server',_0xbeaf('0x4f'),'tmp');var _0x411210=path[_0xbeaf('0x4d')](_0x39069a,_0x42f250);var _0x53067b=util[_0xbeaf('0x41')](_0xbeaf('0x50'),_0x13ccc[_0xbeaf('0x25')]['id'],_0x42f250);var _0x51d560=path['join'](_0x39069a,_0x53067b);var _0x417f03=[];_0x417f03[_0xbeaf('0x51')]({'model':db[_0xbeaf('0x52')],'as':'User','attributes':['id',_0xbeaf('0x53')],'raw':!![]});_0x417f03[_0xbeaf('0x51')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xbeaf('0x54'),_0xbeaf('0x55')],'raw':!![]});var _0x7679fe=[{'model':db[_0xbeaf('0x34')],'as':_0xbeaf('0x56'),'attributes':['id',_0xbeaf('0x31'),_0xbeaf('0x57'),_0xbeaf('0x58'),_0xbeaf('0x59'),_0xbeaf('0x5a')],'include':_0x417f03}];_0x7679fe[_0xbeaf('0x51')]({'model':db[_0xbeaf('0x5b')],'as':_0xbeaf('0x5c'),'attributes':['id',_0xbeaf('0x17')]});_0x7679fe[_0xbeaf('0x51')]({'model':db[_0xbeaf('0x52')],'as':_0xbeaf('0x5d'),'attributes':['id',_0xbeaf('0x53')]});return db[_0xbeaf('0x1b')][_0xbeaf('0x2f')]({'where':{'id':_0x13ccc[_0xbeaf('0x25')]['id']},'include':_0x7679fe})[_0xbeaf('0x15')](handleEntityNotFound(_0x287b55,null))[_0xbeaf('0x15')](function(_0x5ea326){if(_0x5ea326){var _0x476ad7=_0x5ea326[_0xbeaf('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x411210);var _0xdadbf2={'channel':_0xbeaf('0x5f'),'account':_0x476ad7[_0xbeaf('0x5c')]['name'],'agent':_0x476ad7[_0xbeaf('0x5d')]?_0x476ad7[_0xbeaf('0x5d')][_0xbeaf('0x53')]:_0xbeaf('0x60'),'createdAt':moment(_0x476ad7[_0xbeaf('0x57')])[_0xbeaf('0x41')](_0xbeaf('0x42'))[_0xbeaf('0x4c')](),'closedAt':_0x476ad7['closed']?moment(_0x476ad7['closedAt'])[_0xbeaf('0x41')](_0xbeaf('0x42'))[_0xbeaf('0x4c')]():'','disposition':_0x476ad7[_0xbeaf('0x61')],'messages':_(_0x476ad7['Messages'])[_0xbeaf('0x3e')]({'secret':![]})[_0xbeaf('0x1a')](function(_0x28f65d){return{'date':moment(_0x28f65d[_0xbeaf('0x57')])['format'](_0xbeaf('0x42'))['toString'](),'sender':_0x28f65d[_0xbeaf('0x58')]==='out'?_0x28f65d[_0xbeaf('0x52')]?_0x28f65d[_0xbeaf('0x52')][_0xbeaf('0x53')]:_0xbeaf('0x62'):_0x28f65d[_0xbeaf('0x63')]['firstName']+(_0x28f65d[_0xbeaf('0x63')]['lastName']?'\x20'+_0x28f65d['Contact'][_0xbeaf('0x55')]:''),'body':_0x28f65d[_0xbeaf('0x31')],'direction':_0x28f65d[_0xbeaf('0x58')]===_0xbeaf('0x64')?'A':'C','secret':_0x28f65d[_0xbeaf('0x59')],'read':_0x28f65d[_0xbeaf('0x5a')]};})[_0xbeaf('0x65')]()};return ejs[_0xbeaf('0x66')](path[_0xbeaf('0x4d')](config['root'],_0xbeaf('0x67'),_0xbeaf('0x68'),'downloadInteraction.ejs'),{'interaction':_0xdadbf2})[_0xbeaf('0x15')](function(_0x579c7a){var _0x1dae3a=path[_0xbeaf('0x4d')](_0x411210,_0xbeaf('0x69')+_0x476ad7['id']+'-'+_0x42f250+_0xbeaf('0x6a'));var _0x2f492f={'path':_0x1dae3a,'channel':_0xbeaf('0x5f'),'interactionId':_0x476ad7['id']};return pdf[_0xbeaf('0x6b')](_0x579c7a,_0x2f492f);})[_0xbeaf('0x15')](function(){return new BPromise(function(_0x39a921,_0x38d6ba){zipdir(_0x411210,{'saveTo':_0x51d560},function(_0xc64b5a,_0xbc30b3){if(_0xc64b5a)return _0x38d6ba(_0xc64b5a);return _0x39a921(_0xbc30b3);});})[_0xbeaf('0x15')](function(){return new BPromise(function(_0x2598c9,_0x337298){rimraf(_0x411210,function(_0x1b5ee8){if(_0x1b5ee8)_0x337298(_0x1b5ee8);return _0x2598c9();});});})[_0xbeaf('0x15')](function(){return _0x287b55['download'](_0x51d560,_0x53067b,function(_0x441a56){if(_0x441a56){console[_0xbeaf('0x6c')](_0xbeaf('0x6d'),_0x441a56);}else{fs['unlinkSync'](_0x51d560);}});});});}else{return _0x287b55['sendStatus'](0xc8);}})[_0xbeaf('0x23')](handleError(_0x287b55,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a883b61..a278c2f 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 _0xb574=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','SmsMessage','save','update','remove','getUsers','map','findAll','then'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0xb574,0x106));var _0x4b57=function(_0x295686,_0x14d566){_0x295686=_0x295686-0x0;var _0x1c8c6d=_0xb574[_0x295686];return _0x1c8c6d;};'use strict';var EventEmitter=require(_0x4b57('0x0'));var SmsInteraction=require(_0x4b57('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4b57('0x1'))['db'][_0x4b57('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b57('0x3'),'afterUpdate':_0x4b57('0x4'),'afterDestroy':_0x4b57('0x5')};function emitEvent(_0x919851){return function(_0xe2ae86,_0x4a3efa,_0x4eb019){_0xe2ae86[_0x4b57('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x585d86){_0xe2ae86['setDataValue']('Users',_0x585d86[_0x4b57('0x7')](function(_0x2bf397){return{'id':_0x2bf397['id']};}));return SmsMessage[_0x4b57('0x8')]({'where':{'SmsInteractionId':_0xe2ae86['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b57('0x9')](function(_0xce47ad){_0xe2ae86[_0x4b57('0xa')](_0x4b57('0xb'),_0xce47ad[_0x4b57('0xc')]);SmsInteractionEvents['emit'](_0x919851+':'+_0xe2ae86['id'],_0xe2ae86);SmsInteractionEvents[_0x4b57('0xd')](_0x919851,_0xe2ae86);_0x4eb019(null);})[_0x4b57('0xe')](_0x4eb019(null));};}for(var e in events){if(events[_0x4b57('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x36ee=['getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4f3f98,_0x3084c7){var _0x4521ce=function(_0x1359f1){while(--_0x1359f1){_0x4f3f98['push'](_0x4f3f98['shift']());}};_0x4521ce(++_0x3084c7);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0xe36e('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0xe36e('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe36e('0x2')](0x0);var events={'afterCreate':_0xe36e('0x3'),'afterUpdate':_0xe36e('0x4'),'afterDestroy':_0xe36e('0x5')};function emitEvent(_0x1118af){return function(_0x29e692,_0x3f29e1,_0x25a07d){_0x29e692[_0xe36e('0x6')]({'attributes':['id'],'raw':!![]})[_0xe36e('0x7')](function(_0x1aa596){_0x29e692['setDataValue'](_0xe36e('0x8'),_0x1aa596['map'](function(_0x2236e9){return{'id':_0x2236e9['id']};}));return SmsMessage[_0xe36e('0x9')]({'where':{'SmsInteractionId':_0x29e692['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe36e('0x7')](function(_0x47ce3a){_0x29e692[_0xe36e('0xa')]('unreadMessages',_0x47ce3a[_0xe36e('0xb')]);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af+':'+_0x29e692['id'],_0x29e692);SmsInteractionEvents[_0xe36e('0xc')](_0x1118af,_0x29e692);_0x25a07d(null);})[_0xe36e('0xd')](_0x25a07d(null));};}for(var e in events){if(events[_0xe36e('0xe')](e)){var event=events[e];SmsInteraction[_0xe36e('0xf')](e,emitEvent(event));}}module[_0xe36e('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a7f2727..5fbdd87 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 _0xc385=['bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xc385,0xdd));var _0x5c38=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc385[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x5c38('0x0'));var logger=require(_0x5c38('0x1'))(_0x5c38('0x2'));var moment=require(_0x5c38('0x3'));var BPromise=require(_0x5c38('0x4'));var rp=require(_0x5c38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c38('0x6'));var config=require(_0x5c38('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x5c38('0x8')]=function(_0x5cc8de,_0x23866b){return _0x5cc8de[_0x5c38('0x9')]('SmsInteraction',attributes,{'tableName':_0x5c38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x507ab6,_0x24334d,_0x551153){if(_0x507ab6[_0x5c38('0xb')](_0x5c38('0xc'))){_0x507ab6[_0x5c38('0xd')]=moment()['format'](_0x5c38('0xe'));}_0x551153(null,_0x507ab6);}}});}; \ No newline at end of file +var _0x2cb1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x10c0d6,_0x2eab00){var _0x5f3b72=function(_0x35a629){while(--_0x35a629){_0x10c0d6['push'](_0x10c0d6['shift']());}};_0x5f3b72(++_0x2eab00);}(_0x2cb1,0x1dc));var _0x12cb=function(_0xd4167a,_0x39d85d){_0xd4167a=_0xd4167a-0x0;var _0x13185c=_0x2cb1[_0xd4167a];return _0x13185c;};'use strict';var _=require(_0x12cb('0x0'));var util=require(_0x12cb('0x1'));var logger=require(_0x12cb('0x2'))(_0x12cb('0x3'));var moment=require(_0x12cb('0x4'));var BPromise=require(_0x12cb('0x5'));var rp=require(_0x12cb('0x6'));var fs=require('fs');var path=require(_0x12cb('0x7'));var rimraf=require(_0x12cb('0x8'));var config=require(_0x12cb('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x10b535,_0x3c46bb){return _0x10b535[_0x12cb('0xa')]('SmsInteraction',attributes,{'tableName':_0x12cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12a924,_0x533a9e,_0x17bacd){if(_0x12a924[_0x12cb('0xc')]('closed')){_0x12a924[_0x12cb('0xd')]=moment()[_0x12cb('0xe')](_0x12cb('0xf'));}_0x17bacd(null,_0x12a924);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 521d8a0..df917e2 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 _0xa443=['./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','stringify','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x39b247,_0x4e8703){var _0x1d2862=function(_0x31f679){while(--_0x31f679){_0x39b247['push'](_0x39b247['shift']());}};_0x1d2862(++_0x4e8703);}(_0xa443,0x98));var _0x3a44=function(_0x4c2347,_0x123c30){_0x4c2347=_0x4c2347-0x0;var _0x49f8b9=_0xa443[_0x4c2347];return _0x49f8b9;};'use strict';var _=require(_0x3a44('0x0'));var util=require(_0x3a44('0x1'));var moment=require(_0x3a44('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a44('0x3'));var fs=require('fs');var Redis=require(_0x3a44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a44('0x5'));var logger=require(_0x3a44('0x6'))(_0x3a44('0x7'));var config=require(_0x3a44('0x8'));var jayson=require(_0x3a44('0x9'));var client=jayson[_0x3a44('0xa')][_0x3a44('0xb')]({'port':0x232a});config['redis']=_[_0x3a44('0xc')](config[_0x3a44('0xd')],{'host':_0x3a44('0xe'),'port':0x18eb});var socket=require(_0x3a44('0xf'))(new Redis(config[_0x3a44('0xd')]));require(_0x3a44('0x10'))['register'](socket);function respondWithRpcPromise(_0x5c626b,_0x3004d3,_0x4e9888){return new BPromise(function(_0x4d54e4,_0x4bcd){return client['request'](_0x5c626b,_0x4e9888)[_0x3a44('0x11')](function(_0x11777d){logger[_0x3a44('0x12')](_0x3a44('0x13'),_0x3004d3,'request\x20sent');logger[_0x3a44('0x14')](_0x3a44('0x15'),_0x3004d3,_0x3a44('0x16'),JSON['stringify'](_0x11777d));if(_0x11777d[_0x3a44('0x17')]){if(_0x11777d[_0x3a44('0x17')][_0x3a44('0x18')]===0x1f4){logger[_0x3a44('0x17')](_0x3a44('0x13'),_0x3004d3,_0x11777d[_0x3a44('0x17')][_0x3a44('0x19')]);return _0x4bcd(_0x11777d[_0x3a44('0x17')]['message']);}logger[_0x3a44('0x17')](_0x3a44('0x13'),_0x3004d3,_0x11777d[_0x3a44('0x17')][_0x3a44('0x19')]);return _0x4d54e4(_0x11777d[_0x3a44('0x17')][_0x3a44('0x19')]);}else{logger[_0x3a44('0x12')](_0x3a44('0x13'),_0x3004d3,_0x3a44('0x16'));_0x4d54e4(_0x11777d[_0x3a44('0x1a')][_0x3a44('0x19')]);}})[_0x3a44('0x1b')](function(_0x18581e){logger[_0x3a44('0x17')](_0x3a44('0x13'),_0x3004d3,_0x18581e);_0x4bcd(_0x18581e);});});}exports[_0x3a44('0x1c')]=function(_0x42d9af){var _0x284fd2=this;return new Promise(function(_0x43485a,_0x1d10bd){return db[_0x3a44('0x1d')][_0x3a44('0x1e')](_0x42d9af[_0x3a44('0x1f')],{'raw':_0x42d9af['options']?_0x42d9af[_0x3a44('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42d9af[_0x3a44('0x20')]?_0x42d9af[_0x3a44('0x20')][_0x3a44('0x21')]||null:null,'attributes':_0x42d9af['options']?_0x42d9af['options'][_0x3a44('0x22')]||null:null,'limit':_0x42d9af[_0x3a44('0x20')]?_0x42d9af['options']['limit']||null:null})['then'](function(_0x33284b){logger[_0x3a44('0x12')]('UpdateSmsInteraction',_0x42d9af);logger[_0x3a44('0x14')](_0x3a44('0x1c'),_0x42d9af,JSON[_0x3a44('0x23')](_0x33284b));_0x43485a(_0x33284b);})[_0x3a44('0x1b')](function(_0x1a1650){logger[_0x3a44('0x17')](_0x3a44('0x1c'),_0x1a1650[_0x3a44('0x19')],_0x42d9af);_0x1d10bd(_0x284fd2[_0x3a44('0x17')](0x1f4,_0x1a1650[_0x3a44('0x19')]));});});};exports[_0x3a44('0x24')]=function(_0x2c8336){return new Promise(function(_0x4f3f71,_0x3e10f4){return db[_0x3a44('0x1d')][_0x3a44('0x25')]({'where':_0x2c8336[_0x3a44('0x20')]?_0x2c8336[_0x3a44('0x20')][_0x3a44('0x21')]||null:null})['then'](function(_0x5316fe){if(_0x5316fe){return _0x5316fe['addTags'](_0x2c8336[_0x3a44('0x1f')][_0x3a44('0x26')],_[_0x3a44('0x27')](_0x2c8336[_0x3a44('0x1f')],[_0x3a44('0x26'),'id'])||{});}})[_0x3a44('0x28')](function(_0x26b13d){logger[_0x3a44('0x12')](_0x3a44('0x29'),_0x2c8336);logger[_0x3a44('0x14')](_0x3a44('0x29'),_0x2c8336,JSON['stringify'](_0x26b13d));_0x4f3f71(_0x26b13d);})['catch'](function(_0x233feb){logger[_0x3a44('0x17')]('AddTags',_0x233feb[_0x3a44('0x19')],_0x2c8336);_0x3e10f4(_this[_0x3a44('0x17')](0x1f4,_0x233feb[_0x3a44('0x19')]));});});}; \ No newline at end of file +var _0x7a1e=['rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SmsInteraction','update','body','options','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x195c32,_0x2ce44b){var _0x124b0c=function(_0xd092d0){while(--_0xd092d0){_0x195c32['push'](_0x195c32['shift']());}};_0x124b0c(++_0x2ce44b);}(_0x7a1e,0xd0));var _0xe7a1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7a1e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe7a1('0x0'));var util=require(_0xe7a1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe7a1('0x2'));var fs=require('fs');var Redis=require(_0xe7a1('0x3'));var db=require(_0xe7a1('0x4'))['db'];var utils=require(_0xe7a1('0x5'));var logger=require(_0xe7a1('0x6'))(_0xe7a1('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7a1('0x8'));var client=jayson[_0xe7a1('0x9')]['http']({'port':0x232a});config[_0xe7a1('0xa')]=_['defaults'](config['redis'],{'host':_0xe7a1('0xb'),'port':0x18eb});var socket=require(_0xe7a1('0xc'))(new Redis(config[_0xe7a1('0xa')]));require(_0xe7a1('0xd'))[_0xe7a1('0xe')](socket);function respondWithRpcPromise(_0xa5f121,_0x40248c,_0x29e122){return new BPromise(function(_0x14cc72,_0xace9a2){return client[_0xe7a1('0xf')](_0xa5f121,_0x29e122)[_0xe7a1('0x10')](function(_0x4370b9){logger['info'](_0xe7a1('0x11'),_0x40248c,'request\x20sent');logger[_0xe7a1('0x12')](_0xe7a1('0x13'),_0x40248c,_0xe7a1('0x14'),JSON[_0xe7a1('0x15')](_0x4370b9));if(_0x4370b9[_0xe7a1('0x16')]){if(_0x4370b9[_0xe7a1('0x16')][_0xe7a1('0x17')]===0x1f4){logger[_0xe7a1('0x16')](_0xe7a1('0x11'),_0x40248c,_0x4370b9[_0xe7a1('0x16')][_0xe7a1('0x18')]);return _0xace9a2(_0x4370b9['error'][_0xe7a1('0x18')]);}logger[_0xe7a1('0x16')](_0xe7a1('0x11'),_0x40248c,_0x4370b9['error'][_0xe7a1('0x18')]);return _0x14cc72(_0x4370b9[_0xe7a1('0x16')]['message']);}else{logger[_0xe7a1('0x19')](_0xe7a1('0x11'),_0x40248c,_0xe7a1('0x14'));_0x14cc72(_0x4370b9[_0xe7a1('0x1a')][_0xe7a1('0x18')]);}})[_0xe7a1('0x1b')](function(_0x989804){logger[_0xe7a1('0x16')](_0xe7a1('0x11'),_0x40248c,_0x989804);_0xace9a2(_0x989804);});});}exports['UpdateSmsInteraction']=function(_0x1eaa34){var _0x73a5e8=this;return new Promise(function(_0x255ef0,_0x51d29b){return db[_0xe7a1('0x1c')][_0xe7a1('0x1d')](_0x1eaa34[_0xe7a1('0x1e')],{'raw':_0x1eaa34[_0xe7a1('0x1f')]?_0x1eaa34[_0xe7a1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eaa34['options']?_0x1eaa34['options']['where']||null:null,'attributes':_0x1eaa34[_0xe7a1('0x1f')]?_0x1eaa34[_0xe7a1('0x1f')][_0xe7a1('0x20')]||null:null,'limit':_0x1eaa34[_0xe7a1('0x1f')]?_0x1eaa34[_0xe7a1('0x1f')][_0xe7a1('0x21')]||null:null})[_0xe7a1('0x10')](function(_0x15409f){logger[_0xe7a1('0x19')](_0xe7a1('0x22'),_0x1eaa34);logger[_0xe7a1('0x12')]('UpdateSmsInteraction',_0x1eaa34,JSON['stringify'](_0x15409f));_0x255ef0(_0x15409f);})[_0xe7a1('0x1b')](function(_0xfebe8f){logger[_0xe7a1('0x16')](_0xe7a1('0x22'),_0xfebe8f[_0xe7a1('0x18')],_0x1eaa34);_0x51d29b(_0x73a5e8['error'](0x1f4,_0xfebe8f[_0xe7a1('0x18')]));});});};exports[_0xe7a1('0x23')]=function(_0x16a85d){return new Promise(function(_0x206bb5,_0x5808de){return db[_0xe7a1('0x1c')][_0xe7a1('0x24')]({'where':_0x16a85d['options']?_0x16a85d[_0xe7a1('0x1f')][_0xe7a1('0x25')]||null:null})['then'](function(_0x52d4e8){if(_0x52d4e8){return _0x52d4e8[_0xe7a1('0x26')](_0x16a85d[_0xe7a1('0x1e')]['ids'],_[_0xe7a1('0x27')](_0x16a85d['body'],[_0xe7a1('0x28'),'id'])||{});}})[_0xe7a1('0x29')](function(_0x27b9e4){logger[_0xe7a1('0x19')](_0xe7a1('0x2a'),_0x16a85d);logger[_0xe7a1('0x12')](_0xe7a1('0x2a'),_0x16a85d,JSON['stringify'](_0x27b9e4));_0x206bb5(_0x27b9e4);})[_0xe7a1('0x1b')](function(_0x2a8edd){logger[_0xe7a1('0x16')](_0xe7a1('0x2a'),_0x2a8edd[_0xe7a1('0x18')],_0x16a85d);_0x5808de(_this['error'](0x1f4,_0x2a8edd[_0xe7a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2d501de..a2417be 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 _0x5e48=['save','remove','removeListener','register','length','smsInteraction:'];(function(_0x4a3de1,_0x3ec2d5){var _0x1df062=function(_0x1aac15){while(--_0x1aac15){_0x4a3de1['push'](_0x4a3de1['shift']());}};_0x1df062(++_0x3ec2d5);}(_0x5e48,0xa8));var _0x85e4=function(_0x3b2a14,_0x5e02eb){_0x3b2a14=_0x3b2a14-0x0;var _0x1aeb20=_0x5e48[_0x3b2a14];return _0x1aeb20;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x85e4('0x0'),_0x85e4('0x1'),'update'];function createListener(_0x4fcbc2,_0x3b0c47){return function(_0x46fcab){_0x3b0c47['emit'](_0x4fcbc2,_0x46fcab);};}function removeListener(_0x3e6e02,_0x56ded2){return function(){SmsInteractionEvents[_0x85e4('0x2')](_0x3e6e02,_0x56ded2);};}exports[_0x85e4('0x3')]=function(_0x1ebb27){for(var _0xf240da=0x0,_0x6ab3a4=events[_0x85e4('0x4')];_0xf240da<_0x6ab3a4;_0xf240da++){var _0x312bfd=events[_0xf240da];var _0x262472=createListener(_0x85e4('0x5')+_0x312bfd,_0x1ebb27);SmsInteractionEvents['on'](_0x312bfd,_0x262472);}}; \ No newline at end of file +var _0x64fc=['remove','update','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x42384a,_0x4508e8){var _0x5ae84d=function(_0xf202f7){while(--_0xf202f7){_0x42384a['push'](_0x42384a['shift']());}};_0x5ae84d(++_0x4508e8);}(_0x64fc,0xa7));var _0xc64f=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x64fc[_0x50aa2e];return _0x5e07f0;};'use strict';var SmsInteractionEvents=require(_0xc64f('0x0'));var events=['save',_0xc64f('0x1'),_0xc64f('0x2')];function createListener(_0x445900,_0x55c719){return function(_0x9a1252){_0x55c719[_0xc64f('0x3')](_0x445900,_0x9a1252);};}function removeListener(_0x4fd151,_0x2adc1a){return function(){SmsInteractionEvents['removeListener'](_0x4fd151,_0x2adc1a);};}exports[_0xc64f('0x4')]=function(_0x55c71b){for(var _0x3c213a=0x0,_0x25197a=events[_0xc64f('0x5')];_0x3c213a<_0x25197a;_0x3c213a++){var _0x13c62d=events[_0x3c213a];var _0x25a1af=createListener(_0xc64f('0x6')+_0x13c62d,_0x55c71b);SmsInteractionEvents['on'](_0x13c62d,_0x25a1af);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c2a0d04..cd5dd04 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 _0xc7a7=['./smsMessage.controller','get','isAuthenticated','index','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0xc7a7,0x171));var _0x7c7a=function(_0x27e2ba,_0x46665e){_0x27e2ba=_0x27e2ba-0x0;var _0x5503c7=_0xc7a7[_0x27e2ba];return _0x5503c7;};'use strict';var multer=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var path=require(_0x7c7a('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c7a('0x3'));var router=express[_0x7c7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c7a('0x5'));var interaction=require(_0x7c7a('0x6'));var config=require(_0x7c7a('0x7'));var controller=require(_0x7c7a('0x8'));router[_0x7c7a('0x9')]('/',auth[_0x7c7a('0xa')](),controller[_0x7c7a('0xb')]);router[_0x7c7a('0x9')]('/describe',auth[_0x7c7a('0xa')](),controller[_0x7c7a('0xc')]);router[_0x7c7a('0x9')]('/:id',auth[_0x7c7a('0xa')](),controller[_0x7c7a('0xd')]);router[_0x7c7a('0xe')]('/',auth[_0x7c7a('0xa')](),interaction[_0x7c7a('0xf')](_0x7c7a('0x10'),_0x7c7a('0x11')),controller[_0x7c7a('0x12')]);router['post'](_0x7c7a('0x13'),controller[_0x7c7a('0x14')]);router[_0x7c7a('0x15')](_0x7c7a('0x16'),auth[_0x7c7a('0xa')](),controller[_0x7c7a('0x17')]);router[_0x7c7a('0x15')]('/:id/accept',auth[_0x7c7a('0xa')](),controller[_0x7c7a('0x18')]);router[_0x7c7a('0x15')](_0x7c7a('0x19'),auth[_0x7c7a('0xa')](),controller['reject']);router[_0x7c7a('0x1a')]('/:id',auth[_0x7c7a('0xa')](),controller[_0x7c7a('0x1b')]);module[_0x7c7a('0x1c')]=router; \ No newline at end of file +var _0xf625=['/describe','describe','/:id','show','post','tracked','sms','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x337d93,_0x7908a5){var _0x52a98b=function(_0x1d03d5){while(--_0x1d03d5){_0x337d93['push'](_0x337d93['shift']());}};_0x52a98b(++_0x7908a5);}(_0xf625,0xac));var _0x5f62=function(_0x1c12bd,_0x348360){_0x1c12bd=_0x1c12bd-0x0;var _0x1de620=_0xf625[_0x1c12bd];return _0x1de620;};'use strict';var multer=require(_0x5f62('0x0'));var util=require(_0x5f62('0x1'));var path=require(_0x5f62('0x2'));var timeout=require(_0x5f62('0x3'));var express=require(_0x5f62('0x4'));var router=express[_0x5f62('0x5')]();var fs_extra=require(_0x5f62('0x6'));var auth=require(_0x5f62('0x7'));var interaction=require(_0x5f62('0x8'));var config=require(_0x5f62('0x9'));var controller=require(_0x5f62('0xa'));router[_0x5f62('0xb')]('/',auth[_0x5f62('0xc')](),controller[_0x5f62('0xd')]);router[_0x5f62('0xb')](_0x5f62('0xe'),auth[_0x5f62('0xc')](),controller[_0x5f62('0xf')]);router[_0x5f62('0xb')](_0x5f62('0x10'),auth['isAuthenticated'](),controller[_0x5f62('0x11')]);router[_0x5f62('0x12')]('/',auth[_0x5f62('0xc')](),interaction[_0x5f62('0x13')](_0x5f62('0x14'),'smsmessage:create'),controller['create']);router[_0x5f62('0x12')](_0x5f62('0x15'),controller[_0x5f62('0x16')]);router[_0x5f62('0x17')](_0x5f62('0x10'),auth[_0x5f62('0xc')](),controller[_0x5f62('0x18')]);router[_0x5f62('0x17')](_0x5f62('0x19'),auth[_0x5f62('0xc')](),controller[_0x5f62('0x1a')]);router[_0x5f62('0x17')](_0x5f62('0x1b'),auth[_0x5f62('0xc')](),controller[_0x5f62('0x1c')]);router[_0x5f62('0x1d')](_0x5f62('0x10'),auth['isAuthenticated'](),controller[_0x5f62('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index c6e9ae6..cc9977f 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 _0x8f40=['STRING','DATE','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x8f40,0xcd));var _0x08f4=function(_0x94c46c,_0x12f669){_0x94c46c=_0x94c46c-0x0;var _0x4ce706=_0x8f40[_0x94c46c];return _0x4ce706;};'use strict';var Sequelize=require('sequelize');module[_0x08f4('0x0')]={'body':{'type':Sequelize[_0x08f4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x08f4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x08f4('0x3')]('in',_0x08f4('0x4')),'defaultValue':_0x08f4('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x08f4('0x5')](0xbe)},'phone':{'type':Sequelize[_0x08f4('0x5')]},'readAt':{'type':Sequelize[_0x08f4('0x6')]},'secret':{'type':Sequelize[_0x08f4('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x08f4('0x5')]},'providerResponse':{'type':Sequelize[_0x08f4('0x1')]}}; \ No newline at end of file +var _0xd9c6=['STRING','sequelize','exports','TEXT','medium','ENUM','out','DATE'];(function(_0x47a80f,_0x352798){var _0x1770f6=function(_0x549590){while(--_0x549590){_0x47a80f['push'](_0x47a80f['shift']());}};_0x1770f6(++_0x352798);}(_0xd9c6,0x99));var _0x6d9c=function(_0x352ee8,_0x3b8f7b){_0x352ee8=_0x352ee8-0x0;var _0x52ea89=_0xd9c6[_0x352ee8];return _0x52ea89;};'use strict';var Sequelize=require(_0x6d9c('0x0'));module[_0x6d9c('0x1')]={'body':{'type':Sequelize[_0x6d9c('0x2')](_0x6d9c('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6d9c('0x4')]('in',_0x6d9c('0x5')),'defaultValue':_0x6d9c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x6d9c('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6d9c('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1ba4b3b..36cc04f 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 _0xebc0=['type','VIRTUAL','merge','includeAll','include','findAll','rows','rawAttributes','keys','intersection','options','find','create','body','params','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','internal','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','map','SmsMessage','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x33d73c,_0x22d480){var _0x308931=function(_0x21f68a){while(--_0x21f68a){_0x33d73c['push'](_0x33d73c['shift']());}};_0x308931(++_0x22d480);}(_0xebc0,0xe5));var _0x0ebc=function(_0x3c75e5,_0x1fb578){_0x3c75e5=_0x3c75e5-0x0;var _0x8ab9b5=_0xebc0[_0x3c75e5];return _0x8ab9b5;};'use strict';var emlformat=require(_0x0ebc('0x0'));var rimraf=require(_0x0ebc('0x1'));var zipdir=require(_0x0ebc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ebc('0x3'));var moment=require(_0x0ebc('0x4'));var BPromise=require(_0x0ebc('0x5'));var Mustache=require(_0x0ebc('0x6'));var util=require(_0x0ebc('0x7'));var path=require(_0x0ebc('0x8'));var sox=require(_0x0ebc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ebc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ebc('0xb'));var jsforce=require(_0x0ebc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ebc('0xd'));var Redis=require(_0x0ebc('0xe'));var authService=require(_0x0ebc('0xf'));var qs=require(_0x0ebc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ebc('0x11'));var logger=require(_0x0ebc('0x12'))(_0x0ebc('0x13'));var utils=require(_0x0ebc('0x14'));var config=require(_0x0ebc('0x15'));var licenseUtil=require(_0x0ebc('0x16'));var db=require(_0x0ebc('0x17'))['db'];config[_0x0ebc('0x18')]=_[_0x0ebc('0x19')](config[_0x0ebc('0x18')],{'host':_0x0ebc('0x1a'),'port':0x18eb});var socket=require(_0x0ebc('0x1b'))(new Redis(config['redis']));require(_0x0ebc('0x1c'))[_0x0ebc('0x1d')](socket);var jayson=require(_0x0ebc('0x1e'));var client=jayson[_0x0ebc('0x1f')][_0x0ebc('0x20')]({'port':0x232c});var client9002=jayson[_0x0ebc('0x1f')][_0x0ebc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x38af7c,_0x2f713a,_0x5c903a,_0x3cc3e3){return new BPromise(function(_0x189a05,_0x5c6511){var _0x9175bf=_0x3cc3e3||client;return _0x9175bf[_0x0ebc('0x21')](_0x38af7c,_0x5c903a)[_0x0ebc('0x22')](function(_0x412b25){logger[_0x0ebc('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2f713a,_0x0ebc('0x24'));logger[_0x0ebc('0x25')](_0x0ebc('0x26'),_0x2f713a,_0x0ebc('0x24'),JSON[_0x0ebc('0x27')](_0x412b25));if(_0x412b25[_0x0ebc('0x28')]){if(_0x412b25['error'][_0x0ebc('0x29')]===0x1f4){logger[_0x0ebc('0x28')](_0x0ebc('0x2a'),_0x2f713a,_0x412b25[_0x0ebc('0x28')]['message']);return _0x5c6511(_0x412b25['error'][_0x0ebc('0x2b')]);}logger[_0x0ebc('0x28')](_0x0ebc('0x2a'),_0x2f713a,_0x412b25[_0x0ebc('0x28')][_0x0ebc('0x2b')]);return _0x189a05(_0x412b25[_0x0ebc('0x28')][_0x0ebc('0x2b')]);}else{logger[_0x0ebc('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2f713a,_0x0ebc('0x24'));_0x189a05(_0x412b25[_0x0ebc('0x2c')][_0x0ebc('0x2b')]);}})[_0x0ebc('0x2d')](function(_0x351f45){logger[_0x0ebc('0x28')](_0x0ebc('0x2a'),_0x2f713a,_0x351f45);_0x5c6511(_0x351f45);});});}function respondWithStatusCode(_0x405a55,_0x2682da){_0x2682da=_0x2682da||0xcc;return function(_0x737241){if(_0x737241){return _0x405a55[_0x0ebc('0x2e')](_0x2682da);}return _0x405a55[_0x0ebc('0x2f')](_0x2682da)['end']();};}function respondWithResult(_0x3a8f62,_0x2f8fdb){_0x2f8fdb=_0x2f8fdb||0xc8;return function(_0x47a7dc){if(_0x47a7dc){return _0x3a8f62[_0x0ebc('0x2f')](_0x2f8fdb)['json'](_0x47a7dc);}};}function respondWithFilteredResult(_0x8a76ec,_0x5c3be8){return function(_0x422bb8){if(_0x422bb8){var _0x4b89fc=typeof _0x5c3be8[_0x0ebc('0x30')]==='undefined'&&typeof _0x5c3be8[_0x0ebc('0x31')]===_0x0ebc('0x32');var _0x1d64d8=_0x422bb8[_0x0ebc('0x33')];var _0x2b71ef=_0x4b89fc?0x0:_0x5c3be8[_0x0ebc('0x30')];var _0x1d70af=_0x4b89fc?_0x422bb8[_0x0ebc('0x33')]:_0x5c3be8[_0x0ebc('0x30')]+_0x5c3be8[_0x0ebc('0x31')];var _0x5a1433;if(_0x1d70af>=_0x1d64d8){_0x1d70af=_0x1d64d8;_0x5a1433=0xc8;}else{_0x5a1433=0xce;}_0x8a76ec['status'](_0x5a1433);return _0x8a76ec[_0x0ebc('0x34')](_0x0ebc('0x35'),_0x2b71ef+'-'+_0x1d70af+'/'+_0x1d64d8)[_0x0ebc('0x36')](_0x422bb8);}return null;};}function patchUpdates(_0x5b99bb){return function(_0xe3e30c){try{jsonpatch['apply'](_0xe3e30c,_0x5b99bb,!![]);}catch(_0x52ac5c){return BPromise['reject'](_0x52ac5c);}return _0xe3e30c['save']();};}function saveUpdates(_0x1db389,_0x3e13d8){return function(_0xb34d83){if(_0xb34d83){return _0xb34d83[_0x0ebc('0x37')](_0x1db389)[_0x0ebc('0x22')](function(_0x13b53f){return _0x13b53f;});}return null;};}function removeEntity(_0x23669f,_0x4b87e5){return function(_0x5c824a){if(_0x5c824a){return _0x5c824a[_0x0ebc('0x38')]()[_0x0ebc('0x22')](function(){_0x23669f[_0x0ebc('0x2f')](0xcc)[_0x0ebc('0x39')]();});}};}function handleEntityNotFound(_0x4bbf13,_0x5de2fa){return function(_0x266038){if(!_0x266038){_0x4bbf13[_0x0ebc('0x2e')](0x194);}return _0x266038;};}function handleError(_0x30d5ce,_0x3fb4c7){_0x3fb4c7=_0x3fb4c7||0x1f4;return function(_0x152f67){logger[_0x0ebc('0x28')](_0x152f67[_0x0ebc('0x3a')]);if(_0x152f67['name']){delete _0x152f67[_0x0ebc('0x3b')];}_0x30d5ce[_0x0ebc('0x2f')](_0x3fb4c7)['send'](_0x152f67);};}exports['index']=function(_0x156928,_0x2d78f5){var _0x1c830d={},_0x4624e4={},_0x1263a7={'count':0x0,'rows':[]};var _0x357cca=_[_0x0ebc('0x3c')](db[_0x0ebc('0x3d')]['rawAttributes'],function(_0x4ed4ee){return{'name':_0x4ed4ee['fieldName'],'type':_0x4ed4ee['type']['key']};});_0x4624e4[_0x0ebc('0x3e')]=_[_0x0ebc('0x3c')](_0x357cca,_0x0ebc('0x3b'));_0x4624e4['query']=_['keys'](_0x156928[_0x0ebc('0x3f')]);_0x4624e4[_0x0ebc('0x40')]=_['intersection'](_0x4624e4[_0x0ebc('0x3e')],_0x4624e4['query']);_0x1c830d[_0x0ebc('0x41')]=_['intersection'](_0x4624e4['model'],qs[_0x0ebc('0x42')](_0x156928['query'][_0x0ebc('0x42')]));_0x1c830d[_0x0ebc('0x41')]=_0x1c830d[_0x0ebc('0x41')][_0x0ebc('0x43')]?_0x1c830d[_0x0ebc('0x41')]:_0x4624e4[_0x0ebc('0x3e')];if(!_0x156928['query'][_0x0ebc('0x44')](_0x0ebc('0x45'))){_0x1c830d[_0x0ebc('0x31')]=qs[_0x0ebc('0x31')](_0x156928[_0x0ebc('0x3f')][_0x0ebc('0x31')]);_0x1c830d[_0x0ebc('0x30')]=qs['offset'](_0x156928['query'][_0x0ebc('0x30')]);}_0x1c830d[_0x0ebc('0x46')]=qs[_0x0ebc('0x47')](_0x156928[_0x0ebc('0x3f')][_0x0ebc('0x47')]);_0x1c830d[_0x0ebc('0x48')]=qs[_0x0ebc('0x40')](_[_0x0ebc('0x49')](_0x156928['query'],_0x4624e4[_0x0ebc('0x40')]),_0x357cca);if(_0x156928[_0x0ebc('0x3f')][_0x0ebc('0x4a')]){_0x1c830d[_0x0ebc('0x48')]=_['merge'](_0x1c830d['where'],{'$or':_['map'](_0x357cca,function(_0x13b6b6){if(_0x13b6b6[_0x0ebc('0x4b')]!==_0x0ebc('0x4c')){var _0x1f4b3a={};_0x1f4b3a[_0x13b6b6[_0x0ebc('0x3b')]]={'$like':'%'+_0x156928[_0x0ebc('0x3f')][_0x0ebc('0x4a')]+'%'};return _0x1f4b3a;}})});}_0x1c830d=_[_0x0ebc('0x4d')]({},_0x1c830d,_0x156928['options']);var _0x27391c={'where':_0x1c830d['where']};return db[_0x0ebc('0x3d')][_0x0ebc('0x33')](_0x27391c)[_0x0ebc('0x22')](function(_0x4df919){_0x1263a7[_0x0ebc('0x33')]=_0x4df919;if(_0x156928[_0x0ebc('0x3f')][_0x0ebc('0x4e')]){_0x1c830d[_0x0ebc('0x4f')]=[{'all':!![]}];}return db[_0x0ebc('0x3d')][_0x0ebc('0x50')](_0x1c830d);})['then'](function(_0x446bdc){_0x1263a7[_0x0ebc('0x51')]=_0x446bdc;return _0x1263a7;})[_0x0ebc('0x22')](respondWithFilteredResult(_0x2d78f5,_0x1c830d))[_0x0ebc('0x2d')](handleError(_0x2d78f5,null));};exports['show']=function(_0x47f3b7,_0x47dba1){var _0x3337a6={'raw':!![],'where':{'id':_0x47f3b7['params']['id']}},_0x3e9d47={};_0x3e9d47[_0x0ebc('0x3e')]=_['keys'](db[_0x0ebc('0x3d')][_0x0ebc('0x52')]);_0x3e9d47[_0x0ebc('0x3f')]=_[_0x0ebc('0x53')](_0x47f3b7['query']);_0x3e9d47[_0x0ebc('0x40')]=_[_0x0ebc('0x54')](_0x3e9d47[_0x0ebc('0x3e')],_0x3e9d47[_0x0ebc('0x3f')]);_0x3337a6[_0x0ebc('0x41')]=_[_0x0ebc('0x54')](_0x3e9d47[_0x0ebc('0x3e')],qs[_0x0ebc('0x42')](_0x47f3b7[_0x0ebc('0x3f')]['fields']));_0x3337a6[_0x0ebc('0x41')]=_0x3337a6[_0x0ebc('0x41')][_0x0ebc('0x43')]?_0x3337a6[_0x0ebc('0x41')]:_0x3e9d47[_0x0ebc('0x3e')];if(_0x47f3b7[_0x0ebc('0x3f')][_0x0ebc('0x4e')]){_0x3337a6['include']=[{'all':!![]}];}_0x3337a6=_[_0x0ebc('0x4d')]({},_0x3337a6,_0x47f3b7[_0x0ebc('0x55')]);return db[_0x0ebc('0x3d')][_0x0ebc('0x56')](_0x3337a6)[_0x0ebc('0x22')](handleEntityNotFound(_0x47dba1,null))[_0x0ebc('0x22')](respondWithResult(_0x47dba1,null))[_0x0ebc('0x2d')](handleError(_0x47dba1,null));};exports['create']=function(_0x53230b,_0x4ec142){return db['SmsMessage'][_0x0ebc('0x57')](_0x53230b[_0x0ebc('0x58')],{})[_0x0ebc('0x22')](respondWithResult(_0x4ec142,0xc9))[_0x0ebc('0x2d')](handleError(_0x4ec142,null));};exports[_0x0ebc('0x37')]=function(_0x27c552,_0x3f6045){if(_0x27c552[_0x0ebc('0x58')]['id']){delete _0x27c552['body']['id'];}return db['SmsMessage'][_0x0ebc('0x56')]({'where':{'id':_0x27c552[_0x0ebc('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f6045,null))[_0x0ebc('0x22')](saveUpdates(_0x27c552[_0x0ebc('0x58')],null))[_0x0ebc('0x22')](respondWithResult(_0x3f6045,null))[_0x0ebc('0x2d')](handleError(_0x3f6045,null));};exports[_0x0ebc('0x38')]=function(_0x474052,_0x4f8624){return db[_0x0ebc('0x3d')]['find']({'where':{'id':_0x474052[_0x0ebc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4f8624,null))[_0x0ebc('0x22')](removeEntity(_0x4f8624,null))[_0x0ebc('0x2d')](handleError(_0x4f8624,null));};exports['describe']=function(_0x505765,_0x57a288){return db[_0x0ebc('0x3d')]['describe']()[_0x0ebc('0x22')](respondWithResult(_0x57a288,null))[_0x0ebc('0x2d')](handleError(_0x57a288,null));};var interaction_log=require('../../config/logger')(_0x0ebc('0x5a'));exports[_0x0ebc('0x5b')]=function(_0x2d2850,_0x5918f4,_0x1df8ed){var _0x3039f1={'agent':{},'channel':_0x0ebc('0x5c')};if(_0x2d2850['body']['id']){delete _0x2d2850[_0x0ebc('0x58')]['id'];}_0x2d2850[_0x0ebc('0x58')][_0x0ebc('0x5d')]=!![];_0x2d2850[_0x0ebc('0x58')][_0x0ebc('0x5e')]=moment()[_0x0ebc('0x5f')](_0x0ebc('0x60'));_0x2d2850['body']['UserId']=_0x2d2850['body'][_0x0ebc('0x61')]||_0x2d2850[_0x0ebc('0x62')]['id'];_0x3039f1[_0x0ebc('0x63')]['id']=_0x2d2850[_0x0ebc('0x58')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x2d2850[_0x0ebc('0x59')]['id'],'UserId':null}})[_0x0ebc('0x22')](handleEntityNotFound(_0x5918f4,null))['then'](saveUpdates(_0x2d2850[_0x0ebc('0x58')],null))[_0x0ebc('0x22')](function(_0x462cb9){if(_0x462cb9){_0x3039f1[_0x0ebc('0x2b')]=_0x462cb9[_0x0ebc('0x64')]({'plain':!![]});return db[_0x0ebc('0x65')]['find']({'where':{'id':_0x462cb9[_0x0ebc('0x66')]}});}return null;})[_0x0ebc('0x22')](handleEntityNotFound(_0x5918f4,null))[_0x0ebc('0x22')](function(_0x234d69){if(_0x234d69){return _0x234d69[_0x0ebc('0x37')]({'UserId':_0x2d2850['body'][_0x0ebc('0x61')],'read1stAt':_[_0x0ebc('0x67')](_0x234d69[_0x0ebc('0x68')])?moment()[_0x0ebc('0x5f')](_0x0ebc('0x60')):undefined});}return null;})['then'](function(_0x2dc3f3){if(_0x2dc3f3){_0x3039f1['interaction']=_0x2dc3f3[_0x0ebc('0x64')]({'plain':!![]});interaction_log['info'](_0x0ebc('0x69'),_0x2d2850['user']['id'],_0x2d2850[_0x0ebc('0x62')][_0x0ebc('0x3b')],_0x2d2850['user'][_0x0ebc('0x6a')],_0x3039f1[_0x0ebc('0x6b')]['id'],_0x2d2850['body']?JSON[_0x0ebc('0x27')](_0x2d2850[_0x0ebc('0x58')]):_0x0ebc('0x6c'));return respondWithRpcPromise(_0x0ebc('0x6d'),_0x0ebc('0x6e'),_0x3039f1);}return null;})[_0x0ebc('0x22')](function(_0x3badaf){var _0x5be1ec=_0x0ebc('0x6f')+_0x3badaf[_0x0ebc('0x2b')][_0x0ebc('0x70')];return db['sequelize'][_0x0ebc('0x3f')](_0x5be1ec,{'type':db[_0x0ebc('0x71')][_0x0ebc('0x72')][_0x0ebc('0x73')],'raw':!![]})[_0x0ebc('0x22')](function(_0x2021c8){return _0x2021c8;});})[_0x0ebc('0x22')](function(_0x40ca82){if(_0x40ca82){_0x3039f1[_0x0ebc('0x2b')]['contact']=_0x40ca82[0x0];if(!_0x2d2850[_0x0ebc('0x58')][_0x0ebc('0x61')])return;return db[_0x0ebc('0x74')][_0x0ebc('0x56')]({'where':{'id':_0x2d2850['body'][_0x0ebc('0x61')],'role':_0x0ebc('0x63')},'attributes':['id',_0x0ebc('0x3b'),_0x0ebc('0x75'),_0x0ebc('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4063e4){if(!_0x4063e4)return null;_0x3039f1[_0x0ebc('0x2b')]['agent']=_0x4063e4;return _0x3039f1;})[_0x0ebc('0x22')](function(_0x4bcf7a){if(_0x4bcf7a){if(_0x2d2850['body'][_0x0ebc('0x77')]){_0x3039f1['message'][_0x0ebc('0x78')]=util[_0x0ebc('0x5f')](_0x0ebc('0x79'),_0x2d2850['user'][_0x0ebc('0x3b')]);_0x3039f1[_0x0ebc('0x2b')][_0x0ebc('0x7a')]=_0x3039f1[_0x0ebc('0x7a')];_0x3039f1[_0x0ebc('0x2b')][_0x0ebc('0x7b')]=_0x3039f1[_0x0ebc('0x7a')];_0x3039f1[_0x0ebc('0x2b')][_0x0ebc('0x7c')]='accept';return respondWithRpcPromise(_0x0ebc('0x7d'),'EventManager',{'event':_0x0ebc('0x7e'),'message':_0x3039f1[_0x0ebc('0x2b')]},client9002)[_0x0ebc('0x22')](function(){return _0x3039f1;});}return _0x3039f1;}return null;})[_0x0ebc('0x22')](respondWithResult(_0x5918f4,null))[_0x0ebc('0x2d')](handleError(_0x5918f4,null));};var interaction_log=require(_0x0ebc('0x12'))(_0x0ebc('0x5a'));exports[_0x0ebc('0x7f')]=function(_0x14717a,_0x43e927,_0x52e68b){var _0x2e3d61={'agent':{},'channel':_0x0ebc('0x5c')};if(_0x14717a[_0x0ebc('0x58')]['id']){delete _0x14717a[_0x0ebc('0x58')]['id'];}_0x14717a[_0x0ebc('0x58')]['UserId']=_0x14717a['body'][_0x0ebc('0x61')]||_0x14717a[_0x0ebc('0x62')]['id'];_0x2e3d61[_0x0ebc('0x63')]['id']=_0x14717a[_0x0ebc('0x58')][_0x0ebc('0x61')];return db[_0x0ebc('0x3d')][_0x0ebc('0x56')]({'where':{'id':_0x14717a[_0x0ebc('0x59')]['id'],'UserId':null}})[_0x0ebc('0x22')](handleEntityNotFound(_0x43e927,null))[_0x0ebc('0x22')](function(_0x456142){if(_0x456142){_0x2e3d61['message']=_0x456142['get']({'plain':!![]});return db[_0x0ebc('0x65')][_0x0ebc('0x56')]({'where':{'id':_0x456142[_0x0ebc('0x66')]}});}return null;})[_0x0ebc('0x22')](handleEntityNotFound(_0x43e927,null))[_0x0ebc('0x22')](function(_0x33b4b5){if(_0x33b4b5){_0x2e3d61[_0x0ebc('0x6b')]=_0x33b4b5[_0x0ebc('0x64')]({'plain':!![]});interaction_log['info'](_0x0ebc('0x80'),_0x14717a['user']['id'],_0x14717a[_0x0ebc('0x62')][_0x0ebc('0x3b')],_0x14717a['user'][_0x0ebc('0x6a')],_0x2e3d61[_0x0ebc('0x6b')]['id'],_0x14717a[_0x0ebc('0x58')]?JSON[_0x0ebc('0x27')](_0x14717a['body']):'null');return respondWithRpcPromise(_0x0ebc('0x81'),_0x0ebc('0x82'),_0x2e3d61);}return null;})[_0x0ebc('0x22')](function(_0x4cd11a){var _0x2ca094=_0x0ebc('0x6f')+_0x4cd11a['message'][_0x0ebc('0x70')];return db[_0x0ebc('0x83')][_0x0ebc('0x3f')](_0x2ca094,{'type':db[_0x0ebc('0x71')][_0x0ebc('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x55ab1b){return _0x55ab1b;});})[_0x0ebc('0x22')](function(_0x33ff97){if(_0x33ff97){_0x2e3d61[_0x0ebc('0x2b')][_0x0ebc('0x84')]=_0x33ff97[0x0];if(!_0x14717a[_0x0ebc('0x58')][_0x0ebc('0x61')])return;return db[_0x0ebc('0x74')][_0x0ebc('0x56')]({'where':{'id':_0x14717a['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x0ebc('0x75'),_0x0ebc('0x76'),_0x0ebc('0x85')],'raw':!![]});}return null;})[_0x0ebc('0x22')](function(_0x2da352){if(!_0x2da352)return null;_0x2e3d61[_0x0ebc('0x2b')][_0x0ebc('0x63')]=_0x2da352;return _0x2e3d61;})[_0x0ebc('0x22')](function(_0x3708ea){if(_0x3708ea){_0x3708ea['message'][_0x0ebc('0x78')]=util[_0x0ebc('0x5f')]('SIP/%s',_0x14717a[_0x0ebc('0x62')][_0x0ebc('0x3b')]);_0x3708ea[_0x0ebc('0x2b')][_0x0ebc('0x7a')]=_0x2e3d61[_0x0ebc('0x7a')];_0x3708ea[_0x0ebc('0x2b')]['motionChannel']=_0x2e3d61['channel'];_0x3708ea['message'][_0x0ebc('0x7c')]=_0x0ebc('0x7f');respondWithRpcPromise(_0x0ebc('0x7d'),_0x0ebc('0x7d'),{'event':_0x0ebc('0x86'),'message':_0x3708ea['message']},client9002);return _0x2e3d61;}return null;})[_0x0ebc('0x22')](respondWithResult(_0x43e927,null))[_0x0ebc('0x2d')](handleError(_0x43e927,null));};exports['status']=function(_0x2cc77d,_0x2c0f09,_0xb3e937){if(_0x2cc77d['body']['id']){delete _0x2cc77d[_0x0ebc('0x58')]['id'];}var _0xc17a36;return db[_0x0ebc('0x3d')][_0x0ebc('0x56')]({'where':{'id':_0x2cc77d['params']['id']}})[_0x0ebc('0x22')](handleEntityNotFound(_0x2c0f09,null))[_0x0ebc('0x22')](function(_0x19f946){if(_0x19f946){_0xc17a36=_0x19f946;return db[_0x0ebc('0x87')][_0x0ebc('0x56')]({'where':{'id':_0x19f946[_0x0ebc('0x88')]}});}})[_0x0ebc('0x22')](handleEntityNotFound(_0x2c0f09,null))[_0x0ebc('0x22')](function(_0x245b18){if(_0x245b18){logger[_0x0ebc('0x25')](_0x0ebc('0x26'),_0x0ebc('0x2f'),_0x0ebc('0x89'),_0x245b18['type'],util[_0x0ebc('0x8a')](_0x2cc77d['body'],{'showHidden':![],'depth':null}));switch(_0x245b18[_0x0ebc('0x4b')]){case'twilio':if(_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x8b')]&&_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x8b')]===_0xc17a36[_0x0ebc('0x8c')]){return _0xc17a36['update']({'read':!![]});}else{logger[_0x0ebc('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0ebc('0x2f'),_0x0ebc('0x8d'),util[_0x0ebc('0x8a')](_0x2cc77d['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x8e')]&&_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x8e')]===_0xc17a36[_0x0ebc('0x8c')]&&_[_0x0ebc('0x8f')]([_0x0ebc('0x90'),_0x0ebc('0x91')],_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x92')])>=0x0){return _0xc17a36[_0x0ebc('0x37')]({'read':!![]});}else{logger[_0x0ebc('0x28')](_0x0ebc('0x93'),_0x0ebc('0x2f'),'plivio',util[_0x0ebc('0x8a')](_0x2cc77d[_0x0ebc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0ebc('0x94'):var _0xc255db=_0x2cc77d[_0x0ebc('0x58')][_0x0ebc('0x95')][0x0];if(_0xc255db[_0x0ebc('0x2f')][_0x0ebc('0x96')]===_0x0ebc('0x97')){return _0xc17a36[_0x0ebc('0x37')]({'read':!![]});}else{logger[_0x0ebc('0x28')](_0x0ebc('0x93'),'status',_0x0ebc('0x94'),util[_0x0ebc('0x8a')](_0x2cc77d[_0x0ebc('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xc17a36;}})[_0x0ebc('0x22')](respondWithResult(_0x2c0f09,null))['catch'](handleError(_0x2c0f09,null));}; \ No newline at end of file +var _0x6302=['./smsMessage.socket','register','jayson/promise','http','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','findAll','rows','show','params','keys','includeAll','include','find','create','body','update','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','EventManager','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','rejectmessage','SmsAccountId','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','delivered','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x37f570,_0x315c11){var _0x16dc6a=function(_0x27ee38){while(--_0x27ee38){_0x37f570['push'](_0x37f570['shift']());}};_0x16dc6a(++_0x315c11);}(_0x6302,0x109));var _0x2630=function(_0x3c45a8,_0x4f02da){_0x3c45a8=_0x3c45a8-0x0;var _0x125c58=_0x6302[_0x3c45a8];return _0x125c58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2630('0x0'));var zipdir=require(_0x2630('0x1'));var jsonpatch=require(_0x2630('0x2'));var rp=require(_0x2630('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2630('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2630('0x5'));var csv=require(_0x2630('0x6'));var ejs=require(_0x2630('0x7'));var fs=require('fs');var fs_extra=require(_0x2630('0x8'));var _=require(_0x2630('0x9'));var squel=require(_0x2630('0xa'));var crypto=require(_0x2630('0xb'));var jsforce=require(_0x2630('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2630('0xd'));var Papa=require(_0x2630('0xe'));var Redis=require('ioredis');var authService=require(_0x2630('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2630('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2630('0x11'))(_0x2630('0x12'));var utils=require(_0x2630('0x13'));var config=require(_0x2630('0x14'));var licenseUtil=require(_0x2630('0x15'));var db=require(_0x2630('0x16'))['db'];config['redis']=_[_0x2630('0x17')](config[_0x2630('0x18')],{'host':_0x2630('0x19'),'port':0x18eb});var socket=require(_0x2630('0x1a'))(new Redis(config['redis']));require(_0x2630('0x1b'))[_0x2630('0x1c')](socket);var jayson=require(_0x2630('0x1d'));var client=jayson['client'][_0x2630('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x2630('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x37c8d7,_0x3b1b78,_0x249507,_0x157d35){return new BPromise(function(_0x18b2b0,_0xfa59c0){var _0x2c7855=_0x157d35||client;return _0x2c7855['request'](_0x37c8d7,_0x249507)[_0x2630('0x1f')](function(_0x4fc0bb){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3b1b78,_0x2630('0x20'));logger[_0x2630('0x21')](_0x2630('0x22'),_0x3b1b78,_0x2630('0x20'),JSON[_0x2630('0x23')](_0x4fc0bb));if(_0x4fc0bb[_0x2630('0x24')]){if(_0x4fc0bb[_0x2630('0x24')][_0x2630('0x25')]===0x1f4){logger[_0x2630('0x24')](_0x2630('0x26'),_0x3b1b78,_0x4fc0bb[_0x2630('0x24')][_0x2630('0x27')]);return _0xfa59c0(_0x4fc0bb['error']['message']);}logger[_0x2630('0x24')](_0x2630('0x26'),_0x3b1b78,_0x4fc0bb['error'][_0x2630('0x27')]);return _0x18b2b0(_0x4fc0bb['error'][_0x2630('0x27')]);}else{logger[_0x2630('0x28')](_0x2630('0x26'),_0x3b1b78,_0x2630('0x20'));_0x18b2b0(_0x4fc0bb['result'][_0x2630('0x27')]);}})[_0x2630('0x29')](function(_0x126ec3){logger[_0x2630('0x24')](_0x2630('0x26'),_0x3b1b78,_0x126ec3);_0xfa59c0(_0x126ec3);});});}function respondWithStatusCode(_0x161248,_0x4ef7fb){_0x4ef7fb=_0x4ef7fb||0xcc;return function(_0xb6442a){if(_0xb6442a){return _0x161248['sendStatus'](_0x4ef7fb);}return _0x161248['status'](_0x4ef7fb)[_0x2630('0x2a')]();};}function respondWithResult(_0x3c654c,_0x41c2c3){_0x41c2c3=_0x41c2c3||0xc8;return function(_0x4afd2f){if(_0x4afd2f){return _0x3c654c[_0x2630('0x2b')](_0x41c2c3)[_0x2630('0x2c')](_0x4afd2f);}};}function respondWithFilteredResult(_0x3e0f49,_0x4c63a5){return function(_0x3ad356){if(_0x3ad356){var _0x4ad461=typeof _0x4c63a5[_0x2630('0x2d')]==='undefined'&&typeof _0x4c63a5[_0x2630('0x2e')]===_0x2630('0x2f');var _0x560dd8=_0x3ad356[_0x2630('0x30')];var _0x552c05=_0x4ad461?0x0:_0x4c63a5['offset'];var _0x329bac=_0x4ad461?_0x3ad356[_0x2630('0x30')]:_0x4c63a5['offset']+_0x4c63a5[_0x2630('0x2e')];var _0x19d2fc;if(_0x329bac>=_0x560dd8){_0x329bac=_0x560dd8;_0x19d2fc=0xc8;}else{_0x19d2fc=0xce;}_0x3e0f49[_0x2630('0x2b')](_0x19d2fc);return _0x3e0f49[_0x2630('0x31')](_0x2630('0x32'),_0x552c05+'-'+_0x329bac+'/'+_0x560dd8)[_0x2630('0x2c')](_0x3ad356);}return null;};}function patchUpdates(_0x357035){return function(_0x51634d){try{jsonpatch[_0x2630('0x33')](_0x51634d,_0x357035,!![]);}catch(_0x3e67be){return BPromise['reject'](_0x3e67be);}return _0x51634d[_0x2630('0x34')]();};}function saveUpdates(_0x4ba47e,_0x407662){return function(_0x58f438){if(_0x58f438){return _0x58f438['update'](_0x4ba47e)[_0x2630('0x1f')](function(_0x39bc25){return _0x39bc25;});}return null;};}function removeEntity(_0x2714e3,_0x566b31){return function(_0x32d40d){if(_0x32d40d){return _0x32d40d[_0x2630('0x35')]()['then'](function(){_0x2714e3[_0x2630('0x2b')](0xcc)[_0x2630('0x2a')]();});}};}function handleEntityNotFound(_0x49198c,_0x29b6bb){return function(_0x4a151b){if(!_0x4a151b){_0x49198c[_0x2630('0x36')](0x194);}return _0x4a151b;};}function handleError(_0x412c78,_0x55bb15){_0x55bb15=_0x55bb15||0x1f4;return function(_0x2f02a7){logger[_0x2630('0x24')](_0x2f02a7['stack']);if(_0x2f02a7[_0x2630('0x37')]){delete _0x2f02a7[_0x2630('0x37')];}_0x412c78[_0x2630('0x2b')](_0x55bb15)[_0x2630('0x38')](_0x2f02a7);};}exports[_0x2630('0x39')]=function(_0x7cd21e,_0x22de2d){var _0x3b856b={},_0x324467={},_0x546d64={'count':0x0,'rows':[]};var _0x1a1d5b=_['map'](db[_0x2630('0x3a')][_0x2630('0x3b')],function(_0xd67ae9){return{'name':_0xd67ae9[_0x2630('0x3c')],'type':_0xd67ae9[_0x2630('0x3d')][_0x2630('0x3e')]};});_0x324467['model']=_[_0x2630('0x3f')](_0x1a1d5b,_0x2630('0x37'));_0x324467['query']=_['keys'](_0x7cd21e[_0x2630('0x40')]);_0x324467['filters']=_[_0x2630('0x41')](_0x324467[_0x2630('0x42')],_0x324467[_0x2630('0x40')]);_0x3b856b['attributes']=_[_0x2630('0x41')](_0x324467[_0x2630('0x42')],qs['fields'](_0x7cd21e['query'][_0x2630('0x43')]));_0x3b856b[_0x2630('0x44')]=_0x3b856b[_0x2630('0x44')][_0x2630('0x45')]?_0x3b856b['attributes']:_0x324467[_0x2630('0x42')];if(!_0x7cd21e[_0x2630('0x40')][_0x2630('0x46')](_0x2630('0x47'))){_0x3b856b[_0x2630('0x2e')]=qs[_0x2630('0x2e')](_0x7cd21e[_0x2630('0x40')]['limit']);_0x3b856b[_0x2630('0x2d')]=qs[_0x2630('0x2d')](_0x7cd21e[_0x2630('0x40')][_0x2630('0x2d')]);}_0x3b856b[_0x2630('0x48')]=qs[_0x2630('0x49')](_0x7cd21e[_0x2630('0x40')][_0x2630('0x49')]);_0x3b856b['where']=qs['filters'](_[_0x2630('0x4a')](_0x7cd21e[_0x2630('0x40')],_0x324467[_0x2630('0x4b')]),_0x1a1d5b);if(_0x7cd21e[_0x2630('0x40')][_0x2630('0x4c')]){_0x3b856b['where']=_[_0x2630('0x4d')](_0x3b856b['where'],{'$or':_[_0x2630('0x3f')](_0x1a1d5b,function(_0x53d8ce){if(_0x53d8ce[_0x2630('0x3d')]!==_0x2630('0x4e')){var _0x41445b={};_0x41445b[_0x53d8ce[_0x2630('0x37')]]={'$like':'%'+_0x7cd21e[_0x2630('0x40')][_0x2630('0x4c')]+'%'};return _0x41445b;}})});}_0x3b856b=_[_0x2630('0x4d')]({},_0x3b856b,_0x7cd21e[_0x2630('0x4f')]);var _0x5b26b9={'where':_0x3b856b[_0x2630('0x50')]};return db[_0x2630('0x3a')][_0x2630('0x30')](_0x5b26b9)[_0x2630('0x1f')](function(_0x4c4152){_0x546d64[_0x2630('0x30')]=_0x4c4152;if(_0x7cd21e[_0x2630('0x40')]['includeAll']){_0x3b856b['include']=[{'all':!![]}];}return db[_0x2630('0x3a')][_0x2630('0x51')](_0x3b856b);})['then'](function(_0x3c39e3){_0x546d64[_0x2630('0x52')]=_0x3c39e3;return _0x546d64;})[_0x2630('0x1f')](respondWithFilteredResult(_0x22de2d,_0x3b856b))['catch'](handleError(_0x22de2d,null));};exports[_0x2630('0x53')]=function(_0x643e1d,_0x4dcbd0){var _0x4cc427={'raw':!![],'where':{'id':_0x643e1d[_0x2630('0x54')]['id']}},_0x4c298b={};_0x4c298b[_0x2630('0x42')]=_['keys'](db[_0x2630('0x3a')][_0x2630('0x3b')]);_0x4c298b['query']=_[_0x2630('0x55')](_0x643e1d[_0x2630('0x40')]);_0x4c298b[_0x2630('0x4b')]=_[_0x2630('0x41')](_0x4c298b[_0x2630('0x42')],_0x4c298b[_0x2630('0x40')]);_0x4cc427[_0x2630('0x44')]=_[_0x2630('0x41')](_0x4c298b[_0x2630('0x42')],qs[_0x2630('0x43')](_0x643e1d[_0x2630('0x40')]['fields']));_0x4cc427['attributes']=_0x4cc427[_0x2630('0x44')][_0x2630('0x45')]?_0x4cc427['attributes']:_0x4c298b[_0x2630('0x42')];if(_0x643e1d[_0x2630('0x40')][_0x2630('0x56')]){_0x4cc427[_0x2630('0x57')]=[{'all':!![]}];}_0x4cc427=_[_0x2630('0x4d')]({},_0x4cc427,_0x643e1d[_0x2630('0x4f')]);return db['SmsMessage'][_0x2630('0x58')](_0x4cc427)['then'](handleEntityNotFound(_0x4dcbd0,null))['then'](respondWithResult(_0x4dcbd0,null))[_0x2630('0x29')](handleError(_0x4dcbd0,null));};exports['create']=function(_0x358f01,_0x22facf){return db['SmsMessage'][_0x2630('0x59')](_0x358f01[_0x2630('0x5a')],{})[_0x2630('0x1f')](respondWithResult(_0x22facf,0xc9))[_0x2630('0x29')](handleError(_0x22facf,null));};exports[_0x2630('0x5b')]=function(_0x394ab7,_0x3f3e7b){if(_0x394ab7[_0x2630('0x5a')]['id']){delete _0x394ab7[_0x2630('0x5a')]['id'];}return db[_0x2630('0x3a')][_0x2630('0x58')]({'where':{'id':_0x394ab7['params']['id']}})[_0x2630('0x1f')](handleEntityNotFound(_0x3f3e7b,null))[_0x2630('0x1f')](saveUpdates(_0x394ab7[_0x2630('0x5a')],null))[_0x2630('0x1f')](respondWithResult(_0x3f3e7b,null))[_0x2630('0x29')](handleError(_0x3f3e7b,null));};exports[_0x2630('0x35')]=function(_0xa7e728,_0x5af633){return db[_0x2630('0x3a')][_0x2630('0x58')]({'where':{'id':_0xa7e728[_0x2630('0x54')]['id']}})['then'](handleEntityNotFound(_0x5af633,null))[_0x2630('0x1f')](removeEntity(_0x5af633,null))[_0x2630('0x29')](handleError(_0x5af633,null));};exports[_0x2630('0x5c')]=function(_0x44b364,_0x275c76){return db[_0x2630('0x3a')][_0x2630('0x5c')]()['then'](respondWithResult(_0x275c76,null))[_0x2630('0x29')](handleError(_0x275c76,null));};var interaction_log=require(_0x2630('0x11'))(_0x2630('0x5d'));exports[_0x2630('0x5e')]=function(_0x7eb271,_0x4dde00,_0x1c7dd8){var _0x466e4b={'agent':{},'channel':_0x2630('0x5f')};if(_0x7eb271[_0x2630('0x5a')]['id']){delete _0x7eb271[_0x2630('0x5a')]['id'];}_0x7eb271[_0x2630('0x5a')]['read']=!![];_0x7eb271[_0x2630('0x5a')][_0x2630('0x60')]=moment()['format'](_0x2630('0x61'));_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')]=_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')]||_0x7eb271[_0x2630('0x63')]['id'];_0x466e4b[_0x2630('0x64')]['id']=_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')];return db['SmsMessage'][_0x2630('0x58')]({'where':{'id':_0x7eb271[_0x2630('0x54')]['id'],'UserId':null}})[_0x2630('0x1f')](handleEntityNotFound(_0x4dde00,null))[_0x2630('0x1f')](saveUpdates(_0x7eb271['body'],null))[_0x2630('0x1f')](function(_0x2636d2){if(_0x2636d2){_0x466e4b[_0x2630('0x27')]=_0x2636d2['get']({'plain':!![]});return db[_0x2630('0x65')][_0x2630('0x58')]({'where':{'id':_0x2636d2[_0x2630('0x66')]}});}return null;})[_0x2630('0x1f')](handleEntityNotFound(_0x4dde00,null))['then'](function(_0x73c851){if(_0x73c851){return _0x73c851[_0x2630('0x5b')]({'UserId':_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')],'read1stAt':_['isNil'](_0x73c851[_0x2630('0x67')])?moment()[_0x2630('0x68')](_0x2630('0x61')):undefined});}return null;})[_0x2630('0x1f')](function(_0x4aaea1){if(_0x4aaea1){_0x466e4b[_0x2630('0x69')]=_0x4aaea1[_0x2630('0x6a')]({'plain':!![]});interaction_log[_0x2630('0x28')](_0x2630('0x6b'),_0x7eb271[_0x2630('0x63')]['id'],_0x7eb271[_0x2630('0x63')][_0x2630('0x37')],_0x7eb271['user'][_0x2630('0x6c')],_0x466e4b[_0x2630('0x69')]['id'],_0x7eb271[_0x2630('0x5a')]?JSON[_0x2630('0x23')](_0x7eb271['body']):_0x2630('0x6d'));return respondWithRpcPromise(_0x2630('0x6e'),_0x2630('0x6f'),_0x466e4b);}return null;})['then'](function(_0x135239){var _0x2b23bd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x135239['message'][_0x2630('0x70')];return db[_0x2630('0x71')][_0x2630('0x40')](_0x2b23bd,{'type':db['Sequelize'][_0x2630('0x72')][_0x2630('0x73')],'raw':!![]})[_0x2630('0x1f')](function(_0x279b07){return _0x279b07;});})['then'](function(_0x1830d1){if(_0x1830d1){_0x466e4b[_0x2630('0x27')][_0x2630('0x74')]=_0x1830d1[0x0];if(!_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')])return;return db[_0x2630('0x75')][_0x2630('0x58')]({'where':{'id':_0x7eb271[_0x2630('0x5a')][_0x2630('0x62')],'role':_0x2630('0x64')},'attributes':['id',_0x2630('0x37'),_0x2630('0x76'),_0x2630('0x77'),_0x2630('0x78')],'raw':!![]});}return null;})[_0x2630('0x1f')](function(_0x2c004d){if(!_0x2c004d)return null;_0x466e4b['message'][_0x2630('0x64')]=_0x2c004d;return _0x466e4b;})[_0x2630('0x1f')](function(_0x53dd5b){if(_0x53dd5b){if(_0x7eb271[_0x2630('0x5a')][_0x2630('0x79')]){_0x466e4b[_0x2630('0x27')][_0x2630('0x7a')]=util['format']('SIP/%s',_0x7eb271[_0x2630('0x63')][_0x2630('0x37')]);_0x466e4b['message']['channel']=_0x466e4b[_0x2630('0x7b')];_0x466e4b['message']['motionChannel']=_0x466e4b[_0x2630('0x7b')];_0x466e4b[_0x2630('0x27')][_0x2630('0x7c')]=_0x2630('0x5e');return respondWithRpcPromise(_0x2630('0x7d'),_0x2630('0x7d'),{'event':'acceptmessage','message':_0x466e4b[_0x2630('0x27')]},client9002)[_0x2630('0x1f')](function(){return _0x466e4b;});}return _0x466e4b;}return null;})['then'](respondWithResult(_0x4dde00,null))[_0x2630('0x29')](handleError(_0x4dde00,null));};var interaction_log=require(_0x2630('0x11'))('sms-interactions');exports[_0x2630('0x7e')]=function(_0x2b5815,_0x4d66f7,_0x59db41){var _0x593d9b={'agent':{},'channel':_0x2630('0x5f')};if(_0x2b5815['body']['id']){delete _0x2b5815[_0x2630('0x5a')]['id'];}_0x2b5815[_0x2630('0x5a')]['UserId']=_0x2b5815[_0x2630('0x5a')][_0x2630('0x62')]||_0x2b5815[_0x2630('0x63')]['id'];_0x593d9b[_0x2630('0x64')]['id']=_0x2b5815[_0x2630('0x5a')][_0x2630('0x62')];return db[_0x2630('0x3a')][_0x2630('0x58')]({'where':{'id':_0x2b5815['params']['id'],'UserId':null}})[_0x2630('0x1f')](handleEntityNotFound(_0x4d66f7,null))[_0x2630('0x1f')](function(_0x10676a){if(_0x10676a){_0x593d9b[_0x2630('0x27')]=_0x10676a[_0x2630('0x6a')]({'plain':!![]});return db['SmsInteraction'][_0x2630('0x58')]({'where':{'id':_0x10676a[_0x2630('0x66')]}});}return null;})[_0x2630('0x1f')](handleEntityNotFound(_0x4d66f7,null))[_0x2630('0x1f')](function(_0x2142b2){if(_0x2142b2){_0x593d9b[_0x2630('0x69')]=_0x2142b2['get']({'plain':!![]});interaction_log[_0x2630('0x28')](_0x2630('0x7f'),_0x2b5815[_0x2630('0x63')]['id'],_0x2b5815[_0x2630('0x63')][_0x2630('0x37')],_0x2b5815[_0x2630('0x63')][_0x2630('0x6c')],_0x593d9b[_0x2630('0x69')]['id'],_0x2b5815[_0x2630('0x5a')]?JSON[_0x2630('0x23')](_0x2b5815[_0x2630('0x5a')]):'null');return respondWithRpcPromise(_0x2630('0x80'),_0x2630('0x81'),_0x593d9b);}return null;})[_0x2630('0x1f')](function(_0x59c418){var _0x3d077e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x59c418['message']['ContactId'];return db[_0x2630('0x71')][_0x2630('0x40')](_0x3d077e,{'type':db['Sequelize']['QueryTypes'][_0x2630('0x73')],'raw':!![]})[_0x2630('0x1f')](function(_0x114da8){return _0x114da8;});})[_0x2630('0x1f')](function(_0x3f4f64){if(_0x3f4f64){_0x593d9b[_0x2630('0x27')][_0x2630('0x74')]=_0x3f4f64[0x0];if(!_0x2b5815[_0x2630('0x5a')][_0x2630('0x62')])return;return db[_0x2630('0x75')][_0x2630('0x58')]({'where':{'id':_0x2b5815['body'][_0x2630('0x62')],'role':_0x2630('0x64')},'attributes':['id','name',_0x2630('0x76'),'email',_0x2630('0x78')],'raw':!![]});}return null;})[_0x2630('0x1f')](function(_0x5a4bbc){if(!_0x5a4bbc)return null;_0x593d9b['message'][_0x2630('0x64')]=_0x5a4bbc;return _0x593d9b;})[_0x2630('0x1f')](function(_0x3e24cd){if(_0x3e24cd){_0x3e24cd[_0x2630('0x27')][_0x2630('0x7a')]=util[_0x2630('0x68')]('SIP/%s',_0x2b5815[_0x2630('0x63')]['name']);_0x3e24cd[_0x2630('0x27')][_0x2630('0x7b')]=_0x593d9b['channel'];_0x3e24cd['message'][_0x2630('0x82')]=_0x593d9b['channel'];_0x3e24cd[_0x2630('0x27')][_0x2630('0x7c')]=_0x2630('0x7e');respondWithRpcPromise(_0x2630('0x7d'),_0x2630('0x7d'),{'event':_0x2630('0x83'),'message':_0x3e24cd['message']},client9002);return _0x593d9b;}return null;})[_0x2630('0x1f')](respondWithResult(_0x4d66f7,null))['catch'](handleError(_0x4d66f7,null));};exports[_0x2630('0x2b')]=function(_0x3eea9d,_0x4a4443,_0x1d3bf4){if(_0x3eea9d[_0x2630('0x5a')]['id']){delete _0x3eea9d[_0x2630('0x5a')]['id'];}var _0x524d30;return db[_0x2630('0x3a')][_0x2630('0x58')]({'where':{'id':_0x3eea9d['params']['id']}})[_0x2630('0x1f')](handleEntityNotFound(_0x4a4443,null))[_0x2630('0x1f')](function(_0x1195a0){if(_0x1195a0){_0x524d30=_0x1195a0;return db['SmsAccount'][_0x2630('0x58')]({'where':{'id':_0x1195a0[_0x2630('0x84')]}});}})[_0x2630('0x1f')](handleEntityNotFound(_0x4a4443,null))[_0x2630('0x1f')](function(_0x28b217){if(_0x28b217){logger[_0x2630('0x21')](_0x2630('0x22'),'status','received\x20delivery\x20report\x20from',_0x28b217[_0x2630('0x3d')],util['inspect'](_0x3eea9d[_0x2630('0x5a')],{'showHidden':![],'depth':null}));switch(_0x28b217['type']){case'twilio':if(_0x3eea9d[_0x2630('0x5a')][_0x2630('0x85')]&&_0x3eea9d['body']['MessageSid']===_0x524d30['messageId']){return _0x524d30[_0x2630('0x5b')]({'read':!![]});}else{logger[_0x2630('0x24')](_0x2630('0x86'),'status','twilio',util[_0x2630('0x87')](_0x3eea9d[_0x2630('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2630('0x88'):if(_0x3eea9d[_0x2630('0x5a')][_0x2630('0x89')]&&_0x3eea9d[_0x2630('0x5a')][_0x2630('0x89')]===_0x524d30[_0x2630('0x8a')]&&_[_0x2630('0x8b')](['sent',_0x2630('0x8c')],_0x3eea9d[_0x2630('0x5a')]['Status'])>=0x0){return _0x524d30['update']({'read':!![]});}else{logger['error'](_0x2630('0x86'),_0x2630('0x2b'),_0x2630('0x8d'),util[_0x2630('0x87')](_0x3eea9d[_0x2630('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x2630('0x8e'):var _0x420c06=_0x3eea9d[_0x2630('0x5a')][_0x2630('0x8f')][0x0];if(_0x420c06[_0x2630('0x2b')][_0x2630('0x90')]===_0x2630('0x91')){return _0x524d30['update']({'read':!![]});}else{logger[_0x2630('0x24')](_0x2630('0x86'),_0x2630('0x2b'),'infobip',util[_0x2630('0x87')](_0x3eea9d[_0x2630('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x524d30;}})[_0x2630('0x1f')](respondWithResult(_0x4a4443,null))[_0x2630('0x29')](handleError(_0x4a4443,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a3ab7a4..fab1a76 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 _0x1d77=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d77,0x1d7));var _0x71d7=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x1d77[_0x3c4737];return _0x2bb926;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x71d7('0x0'))['db'][_0x71d7('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x71d7('0x2')](0x0);var events={'afterCreate':_0x71d7('0x3'),'afterUpdate':_0x71d7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3a3c9e){return function(_0x5c842b,_0x4d6f6e,_0x4b0824){SmsMessageEvents[_0x71d7('0x5')](_0x3a3c9e+':'+_0x5c842b['id'],_0x5c842b);SmsMessageEvents[_0x71d7('0x5')](_0x3a3c9e,_0x5c842b);_0x4b0824(null);};}for(var e in events){if(events[_0x71d7('0x6')](e)){var event=events[e];SmsMessage[_0x71d7('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x6e5e=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x5f5658,_0x1a14bc){var _0x2f65af=function(_0x60d2cd){while(--_0x60d2cd){_0x5f5658['push'](_0x5f5658['shift']());}};_0x2f65af(++_0x1a14bc);}(_0x6e5e,0x15d));var _0xe6e5=function(_0x370e1e,_0x3c4bf2){_0x370e1e=_0x370e1e-0x0;var _0x2473d0=_0x6e5e[_0x370e1e];return _0x2473d0;};'use strict';var EventEmitter=require(_0xe6e5('0x0'));var SmsMessage=require(_0xe6e5('0x1'))['db'][_0xe6e5('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe6e5('0x3')](0x0);var events={'afterCreate':_0xe6e5('0x4'),'afterUpdate':_0xe6e5('0x5'),'afterDestroy':_0xe6e5('0x6')};function emitEvent(_0x25c440){return function(_0x483a89,_0x13add2,_0x13a41e){SmsMessageEvents[_0xe6e5('0x7')](_0x25c440+':'+_0x483a89['id'],_0x483a89);SmsMessageEvents[_0xe6e5('0x7')](_0x25c440,_0x483a89);_0x13a41e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xe6e5('0x8')](e,emitEvent(event));}}module[_0xe6e5('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1594acf..20bd71a 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 _0xe21a=['https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','/status?token=','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','infobip','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteractionId','then','update','createdAt','error','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','catch','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','senderString','format','%s:%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xe21a,0x18a));var _0xae21=function(_0xb8dc44,_0x226016){_0xb8dc44=_0xb8dc44-0x0;var _0x1698ec=_0xe21a[_0xb8dc44];return _0x1698ec;};'use strict';var _=require(_0xae21('0x0'));var util=require(_0xae21('0x1'));var logger=require(_0xae21('0x2'))(_0xae21('0x3'));var moment=require(_0xae21('0x4'));var BPromise=require(_0xae21('0x5'));var rp=require(_0xae21('0x6'));var fs=require('fs');var path=require(_0xae21('0x7'));var rimraf=require(_0xae21('0x8'));var config=require('../../config/environment');var attributes=require(_0xae21('0x9'));module['exports']=function(_0x156c7a,_0x568da8){return _0x156c7a['define']('SmsMessage',attributes,{'tableName':_0xae21('0xa'),'paranoid':![],'indexes':[{'name':_0xae21('0xb'),'fields':[_0xae21('0xb')]},{'name':'fti_sms_messages','fields':[_0xae21('0xc')],'type':_0xae21('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20501d,_0x1d7c8a,_0x31ed05){var _0x259e1d=_0x156c7a[_0xae21('0xe')];var _0x200211=_0x20501d[_0xae21('0xf')]({'plain':!![]});if(_0x200211[_0xae21('0x10')][_0xae21('0x11')]()==='in'||_0x200211[_0xae21('0x10')][_0xae21('0x11')]()===_0xae21('0x12')&&!_0x200211[_0xae21('0x13')]&&!_['isNil'](_0x200211[_0xae21('0x14')])&&!_['isNil'](_0x200211[_0xae21('0x15')])){_0x259e1d['SmsInteraction']['findOne']({'where':{'id':_0x200211[_0xae21('0x15')]}})[_0xae21('0x16')](function(_0x170aef){if(_0x170aef){_0x170aef[_0xae21('0x17')]({'lastMsgAt':_0x200211[_0xae21('0x18')],'lastMsgDirection':_0x200211['direction'][_0xae21('0x11')]()});}})['catch'](function(_0xeb4329){console[_0xae21('0x19')](_0xeb4329);});}if(_0x200211[_0xae21('0x10')]==='out'&&!_0x200211[_0xae21('0x13')]){var _0x593bed;_0x259e1d[_0xae21('0x1a')]['find']({'where':{'id':_0x200211[_0xae21('0x1b')]},'raw':!![]})['then'](function(_0x4b73bb){_0x593bed=_0x4b73bb;if(_0x593bed&&_0x593bed[_0xae21('0x1c')]){switch(_0x593bed[_0xae21('0x1c')]){case _0xae21('0x1d'):var _0x5db574=require(_0xae21('0x1d'));if(_0x593bed[_0xae21('0x1e')]&&_0x593bed['authToken']&&_0x593bed[_0xae21('0x1f')]){var _0x111598=new _0x5db574(_0x593bed[_0xae21('0x1e')],_0x593bed[_0xae21('0x20')]);_0x111598[_0xae21('0x21')][_0xae21('0x22')]({'body':_0x200211['body'],'to':_0x200211[_0xae21('0x1f')],'from':_0x593bed[_0xae21('0x1f')],'statusCallback':_0x593bed[_0xae21('0x23')]+_0xae21('0x24')+_0x200211['id']+'/status?token='+_0x593bed[_0xae21('0x25')]})[_0xae21('0x16')](function(_0x2518de){if(_0x2518de[_0xae21('0x26')]){return _0x20501d[_0xae21('0x17')]({'messageId':_0x2518de[_0xae21('0x26')]});}})['catch'](function(_0x4f4469){logger[_0xae21('0x19')](_0xae21('0x27'),'afterCreate',_0xae21('0x1d'),util['inspect'](_0x4f4469,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xae21('0x29'):var _0x269d50='https://api.skebby.it/API/v1.0/REST/';if(_0x593bed[_0xae21('0x2a')]&&_0x593bed[_0xae21('0x2b')]){var _0x194ad0={'recipient':[_0x200211[_0xae21('0x1f')]],'message':_0x200211[_0xae21('0xc')],'message_type':_0x593bed[_0xae21('0x2c')]};if(_0x593bed[_0xae21('0x2c')]&&_0x593bed[_0xae21('0x2c')]!=='SI'){_0x194ad0[_0xae21('0x2d')]=_0x593bed[_0xae21('0x1f')];}var _0x5e75fe={'url':_0x269d50+_0xae21('0x2e')+_0x593bed['username']+_0xae21('0x2f')+_0x593bed['password'],'method':_0xae21('0x30')};rp(_0x5e75fe)[_0xae21('0x16')](function(_0x7ed944){var _0x5054b1=_0x7ed944['split'](';');var _0x166175={'user_key':_0x5054b1[0x0],'session_key':_0x5054b1[0x1]};_0x5e75fe={'url':_0x269d50+_0xae21('0x31'),'method':_0xae21('0x32'),'headers':{'user_key':_0x166175[_0xae21('0x33')],'Session_key':_0x166175[_0xae21('0x34')]},'json':!![],'body':_0x194ad0};return rp(_0x5e75fe);})['then'](function(_0x38d9a6){if(_0x38d9a6[_0xae21('0x35')]>=0x1){var _0x3a13cf={'messageId':_0x38d9a6[_0xae21('0x36')]};if(_0x593bed['smsMethod']!=='GP'||!_0x593bed[_0xae21('0x37')]){_0x3a13cf[_0xae21('0x38')]=!![];}return _0x20501d[_0xae21('0x17')](_0x3a13cf);}else{return logger['error'](_0xae21('0x27'),'afterCreate',_0xae21('0x29'),util[_0xae21('0x39')](_0x38d9a6,{'showHidden':![],'depth':null}));}})[_0xae21('0x3a')](function(_0x303abb){return logger[_0xae21('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae21('0x28'),_0xae21('0x29'),util[_0xae21('0x39')](_0x303abb,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xae21('0x3b'):if(_0x593bed['authToken']){var _0x2d77d0={'recipient':_0x200211[_0xae21('0x1f')],'message':_0x200211[_0xae21('0xc')],'sender':_0x593bed['senderString']||_0x593bed[_0xae21('0x1f')],'authorization':_0x593bed[_0xae21('0x20')]};var _0x1d7c8a={'method':_0xae21('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2d77d0,'json':!![]};rp(_0x1d7c8a)[_0xae21('0x16')](function(_0x331219){var _0x314383={'messageId':_0x331219[_0xae21('0x3c')]};if(!_0x593bed[_0xae21('0x37')]){_0x314383[_0xae21('0x38')]=!![];}return _0x20501d[_0xae21('0x17')](_0x314383);})[_0xae21('0x3a')](function(_0x451ad9){logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),'connectel',util[_0xae21('0x39')](_0x451ad9,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae21('0x28'),'connectel',_0xae21('0x3d'));}break;case _0xae21('0x3e'):if(_0x593bed[_0xae21('0x2a')]&&_0x593bed[_0xae21('0x2b')]){var _0x2d77d0={'messages':[{'source':'xCALLY\x20Motion','to':_0x200211['phone'],'body':_0x200211[_0xae21('0xc')],'from':_0x593bed[_0xae21('0x3f')]||_0x593bed[_0xae21('0x1f')]}]};var _0x3ed4d8=util[_0xae21('0x40')](_0xae21('0x41'),_0x593bed['username'],_0x593bed[_0xae21('0x2b')]);var _0x1d7c8a={'method':_0xae21('0x32'),'uri':_0xae21('0x42'),'body':_0x2d77d0,'headers':{'Authorization':util[_0xae21('0x40')](_0xae21('0x43'),new Buffer(_0x3ed4d8)[_0xae21('0x44')]('base64'))},'json':!![]};rp(_0x1d7c8a)[_0xae21('0x16')](function(_0x430ce9){if(_0x430ce9['http_code']>=0xc8&&_0x430ce9[_0xae21('0x45')]<=0xce){if(_0x430ce9[_0xae21('0x46')]&&_0x430ce9[_0xae21('0x46')][_0xae21('0x47')]>0x0){var _0x4acff3=_[_0xae21('0x48')](_0x430ce9[_0xae21('0x46')][_0xae21('0x21')]);var _0x479da3={'messageId':_0x4acff3[_0xae21('0x49')]};if(!_0x593bed[_0xae21('0x37')]){_0x479da3[_0xae21('0x38')]=!![];}return _0x20501d[_0xae21('0x17')](_0x479da3);}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x4a'),util[_0xae21('0x39')](_0x430ce9,{'showHidden':![],'depth':null}));}}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x4a'),util['inspect'](_0x430ce9,{'showHidden':![],'depth':null}));}})['catch'](function(_0xe547f){logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x4a'),util[_0xae21('0x39')](_0xe547f,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xae21('0x4b'):if(_0x593bed['authId']&&_0x593bed[_0xae21('0x20')]){var _0x2d77d0={'dst':_0x200211[_0xae21('0x1f')],'text':_0x200211[_0xae21('0xc')],'src':_0x593bed['senderString']||_0x593bed[_0xae21('0x1f')],'url':_0x593bed['remote']+_0xae21('0x24')+_0x200211['id']+_0xae21('0x4c')+_0x593bed[_0xae21('0x25')]};var _0x3ed4d8=util['format']('%s:%s',_0x593bed[_0xae21('0x4d')],_0x593bed[_0xae21('0x20')]);var _0x1d7c8a={'method':_0xae21('0x32'),'uri':util[_0xae21('0x40')]('https://api.plivo.com/v1/Account/%s/Message/',_0x593bed[_0xae21('0x4d')]),'body':_0x2d77d0,'headers':{'Authorization':util[_0xae21('0x40')]('Basic\x20%s',new Buffer(_0x3ed4d8)[_0xae21('0x44')](_0xae21('0x4e')))},'json':!![]};rp(_0x1d7c8a)[_0xae21('0x16')](function(_0xf91245){var _0x164edf={'messageId':_0xf91245[_0xae21('0x4f')][0x0]};return _0x20501d['update'](_0x164edf);})['catch'](function(_0x217121){logger[_0xae21('0x19')](_0xae21('0x27'),'afterCreate',_0xae21('0x4b'),util[_0xae21('0x39')](_0x217121,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x4b'),_0xae21('0x50'));}break;case'infobip':if(_0x593bed[_0xae21('0x2a')]&&_0x593bed[_0xae21('0x2b')]){if(_0x593bed[_0xae21('0x51')]){var _0x4b382b={'method':_0xae21('0x32'),'uri':_0x593bed['baseUrl']+'/auth/1/session','body':{'username':_0x593bed[_0xae21('0x2a')],'password':_0x593bed['password']},'json':!![]};return rp(_0x4b382b)['then'](function(_0x5e748a){var _0x1e3623={'method':_0xae21('0x32'),'uri':_0x593bed[_0xae21('0x51')]+_0xae21('0x52'),'body':{'messages':[{'from':_0x593bed[_0xae21('0x1f')],'destinations':[{'to':_0x200211[_0xae21('0x1f')]}],'text':_0x200211[_0xae21('0xc')],'notifyUrl':_0x593bed[_0xae21('0x23')]+'/api/sms/messages/'+_0x200211['id']+_0xae21('0x4c')+_0x593bed[_0xae21('0x25')],'notifyContentType':_0xae21('0x53'),'callbackData':_0x593bed[_0xae21('0x1f')]+';'+_0x200211['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x5e748a[_0xae21('0x25')]},'json':!![]};return rp(_0x1e3623)[_0xae21('0x16')](function(_0x40b228){if(_0x40b228['messages']){var _0x53dc22={'messageId':_0x40b228['messages'][0x0][_0xae21('0xb')]};if(!_0x593bed[_0xae21('0x37')]){_0x53dc22[_0xae21('0x38')]=!![];}return _0x20501d[_0xae21('0x17')](_0x53dc22);}else{return logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),'infobip',util[_0xae21('0x39')](_0x40b228,{'showHidden':![],'depth':null}));}});})[_0xae21('0x3a')](function(_0x3a0d71){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xae21('0x54'),util[_0xae21('0x39')](_0x3a0d71,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xae21('0x27'),'afterCreate',_0xae21('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xae21('0x55'):var _0x5ea664=require(_0xae21('0x56'));if(_0x593bed[_0xae21('0x57')]){var _0x49b203={};_0x49b203[_0xae21('0x58')]=_0x593bed[_0xae21('0x2a')];_0x49b203[_0xae21('0x1f')]=_0x200211[_0xae21('0x1f')];_0x49b203[_0xae21('0x2d')]=_0x593bed[_0xae21('0x1f')];_0x49b203[_0xae21('0x59')]=_0x200211[_0xae21('0xc')];_0x49b203[_0xae21('0x5a')]=+new Date();var _0x2aa1e3='';var _0x16e19f='';var _0x37065c=Object[_0xae21('0x5b')](_0x49b203);_0x37065c[_0xae21('0x5c')]();for(var _0x3503a4=0x0;_0x3503a4<_0x37065c['length'];_0x3503a4++){if(_0x2aa1e3!=''){_0x2aa1e3+='&';}_0x2aa1e3+=_0x37065c[_0x3503a4]+'='+encodeURIComponent(_0x49b203[_0x37065c[_0x3503a4]]);_0x16e19f+=_0x49b203[_0x37065c[_0x3503a4]];}_0x16e19f+=_0x593bed[_0xae21('0x57')];_0x16e19f=_0x5ea664[_0xae21('0x5d')]('md5')[_0xae21('0x17')](_0x16e19f)[_0xae21('0x5e')]('hex');if(_0x2aa1e3!==''){_0x2aa1e3+='&';}_0x2aa1e3+=_0xae21('0x5f')+_0x16e19f;var _0x5e75fe={'method':_0xae21('0x30'),'uri':_0x593bed['baseUrl']+_0xae21('0x60')+_0x2aa1e3,'json':!![]};return rp(_0x5e75fe)[_0xae21('0x16')](function(_0x3ae7dc){var _0x4dbb98=Object[_0xae21('0x5b')](_0x3ae7dc);if(_0x3ae7dc[_0x4dbb98[0x0]]['error']&&parseInt(_0x3ae7dc[_0x4dbb98[0x0]]['error'])===0x0){var _0x31a9b0={'messageId':_0x3ae7dc[_0x4dbb98[0x0]][_0xae21('0x61')]};if(!_0x593bed[_0xae21('0x37')]){_0x31a9b0[_0xae21('0x38')]=!![];}return _0x20501d[_0xae21('0x17')](_0x31a9b0);}else{return logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x55'),util[_0xae21('0x39')](_0x3ae7dc[_0xae21('0x19')],{'showHidden':![],'depth':null}));}})[_0xae21('0x3a')](function(_0x5aab7c){return logger[_0xae21('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae21('0x28'),_0xae21('0x55'),util[_0xae21('0x39')](_0x5aab7c,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')](_0xae21('0x27'),'afterCreate',_0xae21('0x55'),_0xae21('0x62'));}break;case _0xae21('0x63'):if(_0x593bed[_0xae21('0x57')]){var _0x44bfa9={'method':_0xae21('0x32'),'uri':_0xae21('0x64'),'headers':{'Authorization':_0x593bed[_0xae21('0x57')]},'body':{'content':_0x200211['body'],'to':[_0x200211[_0xae21('0x1f')]],'from':_0x593bed[_0xae21('0x1f')],'binary':![],'clientMessageId':_0xae21('0x65'),'charset':_0xae21('0x66')},'json':!![]};rp(_0x44bfa9)[_0xae21('0x16')](function(_0x245201){if(!_0x245201[_0xae21('0x19')]){var _0x13f3e5={'messageId':_0x245201['messages'][0x0]['apiMessageId']};if(!_0x593bed[_0xae21('0x37')]){_0x13f3e5['read']=!![];}return _0x20501d[_0xae21('0x17')](_0x13f3e5);}else{return logger[_0xae21('0x19')](_0xae21('0x27'),'afterCreate',_0xae21('0x63'),util[_0xae21('0x39')](_0x245201[_0xae21('0x19')],{'showHidden':![],'depth':null}));}})[_0xae21('0x3a')](function(_0x5c6e10){return logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x63'),util[_0xae21('0x39')](_0x5c6e10,{'showHidden':![],'depth':null}));});}else{logger[_0xae21('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x593bed[_0xae21('0x2a')]&&_0x593bed[_0xae21('0x2b')]){var _0x3ed4d8=util['format'](_0xae21('0x41'),_0x593bed[_0xae21('0x2a')],_0x593bed[_0xae21('0x2b')]);var _0x1d7c8a={'method':_0xae21('0x32'),'uri':_0xae21('0x67')+_0x593bed[_0xae21('0x68')]+'/messages','body':{'to':[_0x200211[_0xae21('0x1f')]],'text':_0x200211[_0xae21('0xc')],'from':_0x593bed[_0xae21('0x1f')],'applicationId':_0x593bed[_0xae21('0x69')]},'headers':{'Authorization':util[_0xae21('0x40')](_0xae21('0x43'),new Buffer(_0x3ed4d8)['toString'](_0xae21('0x4e')))},'json':!![]};rp(_0x1d7c8a)[_0xae21('0x16')](function(_0x5e1ff2){if(_0x5e1ff2['id']){var _0x248f93={'messageId':_0x5e1ff2['id']};return _0x20501d[_0xae21('0x17')](_0x248f93);}else{logger['error'](_0xae21('0x27'),_0xae21('0x28'),'bandwidth',util[_0xae21('0x39')](_0x5e1ff2,{'showHidden':![],'depth':null}));}})[_0xae21('0x3a')](function(_0xda4733){logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x6a'),util[_0xae21('0x39')](_0xda4733,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xae21('0x27'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xae21('0x6b'):if(_0x593bed[_0xae21('0x57')]){var _0x469e4d={};var _0x5e75fe={'method':_0xae21('0x32'),'uri':_0xae21('0x6c'),'headers':{'Authorization':_0xae21('0x6d')+_0x593bed['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x593bed[_0xae21('0x1f')],'to':_0x200211[_0xae21('0x1f')],'text':_0x200211[_0xae21('0xc')]},'json':!![]};return rp(_0x5e75fe)[_0xae21('0x16')](function(_0x5a05c2){if(_0x5a05c2['code']==0xca){_0x469e4d[_0xae21('0x6e')]=_0x5a05c2;var _0x345a1c={'method':'POST','uri':_0xae21('0x6f'),'headers':{'Authorization':_0xae21('0x6d')+_0x593bed[_0xae21('0x57')],'Content-Type':_0xae21('0x53')},'body':{'refid':_0x469e4d[_0xae21('0x6e')]['refid']},'json':!![]};return rp(_0x345a1c)[_0xae21('0x16')](function(_0x3b1cf0){_0x469e4d['status']=_0x3b1cf0;var _0x265624={'messageId':_0x469e4d[_0xae21('0x6e')][_0xae21('0x70')],'read':!![]};return _0x20501d[_0xae21('0x17')](_0x265624);});}else{return logger[_0xae21('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xae21('0x28'),_0xae21('0x6b'),util[_0xae21('0x39')](_0x5a05c2,{'showHidden':![],'depth':null}));}})[_0xae21('0x3a')](function(_0x5007e8){return logger['error'](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x6b'),util['inspect'](_0x5007e8,{'showHidden':![],'depth':null}));});}else{return logger[_0xae21('0x19')](_0xae21('0x27'),_0xae21('0x28'),_0xae21('0x6b'),_0xae21('0x71'));}break;}}})['finally'](function(){_0x31ed05();});}else{_0x31ed05();}}},'charset':'utf8mb4','collate':_0xae21('0x72')});}; \ No newline at end of file +var _0x9d92=['keys','length','apiKey','createHash','md5','hex','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','createdAt','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','then','update','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','smsMethod','login?username=','&password=','password','split','sms','POST','session_key','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','read','clickSend','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','IBSSO\x20','crypto','text','timestamp'];(function(_0x270061,_0x4e41e1){var _0x329604=function(_0x719737){while(--_0x719737){_0x270061['push'](_0x270061['shift']());}};_0x329604(++_0x4e41e1);}(_0x9d92,0x9e));var _0x29d9=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0x9d92[_0x216d45];return _0xbaac0b;};'use strict';var _=require('lodash');var util=require(_0x29d9('0x0'));var logger=require('../../config/logger')(_0x29d9('0x1'));var moment=require(_0x29d9('0x2'));var BPromise=require(_0x29d9('0x3'));var rp=require(_0x29d9('0x4'));var fs=require('fs');var path=require(_0x29d9('0x5'));var rimraf=require('rimraf');var config=require(_0x29d9('0x6'));var attributes=require(_0x29d9('0x7'));module[_0x29d9('0x8')]=function(_0x512dab,_0x1639df){return _0x512dab['define'](_0x29d9('0x9'),attributes,{'tableName':_0x29d9('0xa'),'paranoid':![],'indexes':[{'name':_0x29d9('0xb'),'fields':[_0x29d9('0xb')]},{'name':_0x29d9('0xc'),'fields':['body'],'type':_0x29d9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fd12d,_0x4386ee,_0x1859a2){var _0x1e2303=_0x512dab[_0x29d9('0xe')];var _0x29fec4=_0x4fd12d['get']({'plain':!![]});if(_0x29fec4[_0x29d9('0xf')]['toLowerCase']()==='in'||_0x29fec4['direction']['toLowerCase']()===_0x29d9('0x10')&&!_0x29fec4[_0x29d9('0x11')]&&!_[_0x29d9('0x12')](_0x29fec4[_0x29d9('0x13')])&&!_[_0x29d9('0x12')](_0x29fec4[_0x29d9('0x14')])){_0x1e2303[_0x29d9('0x15')][_0x29d9('0x16')]({'where':{'id':_0x29fec4['SmsInteractionId']}})['then'](function(_0x3e1013){if(_0x3e1013){_0x3e1013['update']({'lastMsgAt':_0x29fec4[_0x29d9('0x17')],'lastMsgDirection':_0x29fec4[_0x29d9('0xf')]['toLowerCase']()});}})['catch'](function(_0x213d86){console[_0x29d9('0x18')](_0x213d86);});}if(_0x29fec4[_0x29d9('0xf')]===_0x29d9('0x10')&&!_0x29fec4[_0x29d9('0x11')]){var _0x1f92db;_0x1e2303[_0x29d9('0x19')][_0x29d9('0x1a')]({'where':{'id':_0x29fec4['SmsAccountId']},'raw':!![]})['then'](function(_0x6c9ce5){_0x1f92db=_0x6c9ce5;if(_0x1f92db&&_0x1f92db[_0x29d9('0x1b')]){switch(_0x1f92db[_0x29d9('0x1b')]){case _0x29d9('0x1c'):var _0x46bfbe=require(_0x29d9('0x1c'));if(_0x1f92db[_0x29d9('0x1d')]&&_0x1f92db[_0x29d9('0x1e')]&&_0x1f92db[_0x29d9('0x1f')]){var _0x125f59=new _0x46bfbe(_0x1f92db[_0x29d9('0x1d')],_0x1f92db['authToken']);_0x125f59[_0x29d9('0x20')][_0x29d9('0x21')]({'body':_0x29fec4[_0x29d9('0x22')],'to':_0x29fec4[_0x29d9('0x1f')],'from':_0x1f92db[_0x29d9('0x1f')],'statusCallback':_0x1f92db[_0x29d9('0x23')]+_0x29d9('0x24')+_0x29fec4['id']+_0x29d9('0x25')+_0x1f92db['token']})[_0x29d9('0x26')](function(_0x3be2d7){if(_0x3be2d7['sid']){return _0x4fd12d[_0x29d9('0x27')]({'messageId':_0x3be2d7[_0x29d9('0x28')]});}})[_0x29d9('0x29')](function(_0x208534){logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x1c'),util['inspect'](_0x208534,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x1c'),_0x29d9('0x2c'));}break;case'skebby':var _0x495bfb='https://api.skebby.it/API/v1.0/REST/';if(_0x1f92db[_0x29d9('0x2d')]&&_0x1f92db['password']){var _0x46cb20={'recipient':[_0x29fec4[_0x29d9('0x1f')]],'message':_0x29fec4[_0x29d9('0x22')],'message_type':_0x1f92db['smsMethod']};if(_0x1f92db[_0x29d9('0x2e')]&&_0x1f92db[_0x29d9('0x2e')]!=='SI'){_0x46cb20['sender']=_0x1f92db[_0x29d9('0x1f')];}var _0x6af47c={'url':_0x495bfb+_0x29d9('0x2f')+_0x1f92db[_0x29d9('0x2d')]+_0x29d9('0x30')+_0x1f92db[_0x29d9('0x31')],'method':'GET'};rp(_0x6af47c)['then'](function(_0x1c06d2){var _0x1856d6=_0x1c06d2[_0x29d9('0x32')](';');var _0x4b72fa={'user_key':_0x1856d6[0x0],'session_key':_0x1856d6[0x1]};_0x6af47c={'url':_0x495bfb+_0x29d9('0x33'),'method':_0x29d9('0x34'),'headers':{'user_key':_0x4b72fa['user_key'],'Session_key':_0x4b72fa[_0x29d9('0x35')]},'json':!![],'body':_0x46cb20};return rp(_0x6af47c);})[_0x29d9('0x26')](function(_0x3f40e8){if(_0x3f40e8['total_sent']>=0x1){var _0x255745={'messageId':_0x3f40e8[_0x29d9('0x36')]};if(_0x1f92db['smsMethod']!=='GP'||!_0x1f92db[_0x29d9('0x37')]){_0x255745['read']=!![];}return _0x4fd12d['update'](_0x255745);}else{return logger[_0x29d9('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29d9('0x2b'),_0x29d9('0x38'),util['inspect'](_0x3f40e8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x271b77){return logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x38'),util[_0x29d9('0x39')](_0x271b77,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x38'),_0x29d9('0x3a'));}break;case'connectel':if(_0x1f92db[_0x29d9('0x1e')]){var _0x499b61={'recipient':_0x29fec4[_0x29d9('0x1f')],'message':_0x29fec4['body'],'sender':_0x1f92db[_0x29d9('0x3b')]||_0x1f92db[_0x29d9('0x1f')],'authorization':_0x1f92db['authToken']};var _0x4386ee={'method':_0x29d9('0x34'),'uri':_0x29d9('0x3c'),'body':_0x499b61,'json':!![]};rp(_0x4386ee)[_0x29d9('0x26')](function(_0x287d00){var _0x1aa935={'messageId':_0x287d00[_0x29d9('0x3d')]};if(!_0x1f92db[_0x29d9('0x37')]){_0x1aa935['read']=!![];}return _0x4fd12d[_0x29d9('0x27')](_0x1aa935);})['catch'](function(_0x131cf2){logger['error'](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x3e'),util[_0x29d9('0x39')](_0x131cf2,{'showHidden':![],'depth':null}));});}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x3e'),_0x29d9('0x3f'));}break;case'clicksend':if(_0x1f92db[_0x29d9('0x2d')]&&_0x1f92db['password']){var _0x499b61={'messages':[{'source':_0x29d9('0x40'),'to':_0x29fec4['phone'],'body':_0x29fec4['body'],'from':_0x1f92db[_0x29d9('0x3b')]||_0x1f92db[_0x29d9('0x1f')]}]};var _0x46ded0=util['format'](_0x29d9('0x41'),_0x1f92db[_0x29d9('0x2d')],_0x1f92db[_0x29d9('0x31')]);var _0x4386ee={'method':_0x29d9('0x34'),'uri':_0x29d9('0x42'),'body':_0x499b61,'headers':{'Authorization':util[_0x29d9('0x43')](_0x29d9('0x44'),new Buffer(_0x46ded0)[_0x29d9('0x45')](_0x29d9('0x46')))},'json':!![]};rp(_0x4386ee)[_0x29d9('0x26')](function(_0x2edee4){if(_0x2edee4[_0x29d9('0x47')]>=0xc8&&_0x2edee4[_0x29d9('0x47')]<=0xce){if(_0x2edee4[_0x29d9('0x48')]&&_0x2edee4[_0x29d9('0x48')][_0x29d9('0x49')]>0x0){var _0x5eab2d=_[_0x29d9('0x4a')](_0x2edee4[_0x29d9('0x48')]['messages']);var _0x2856dc={'messageId':_0x5eab2d[_0x29d9('0x4b')]};if(!_0x1f92db[_0x29d9('0x37')]){_0x2856dc[_0x29d9('0x4c')]=!![];}return _0x4fd12d[_0x29d9('0x27')](_0x2856dc);}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x4d'),util['inspect'](_0x2edee4,{'showHidden':![],'depth':null}));}}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x4d'),util[_0x29d9('0x39')](_0x2edee4,{'showHidden':![],'depth':null}));}})[_0x29d9('0x29')](function(_0xed0e0e){logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x4d'),util[_0x29d9('0x39')](_0xed0e0e,{'showHidden':![],'depth':null}));});}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x1f92db[_0x29d9('0x4e')]&&_0x1f92db['authToken']){var _0x499b61={'dst':_0x29fec4[_0x29d9('0x1f')],'text':_0x29fec4[_0x29d9('0x22')],'src':_0x1f92db[_0x29d9('0x3b')]||_0x1f92db[_0x29d9('0x1f')],'url':_0x1f92db[_0x29d9('0x23')]+'/api/sms/messages/'+_0x29fec4['id']+_0x29d9('0x25')+_0x1f92db[_0x29d9('0x4f')]};var _0x46ded0=util[_0x29d9('0x43')](_0x29d9('0x41'),_0x1f92db[_0x29d9('0x4e')],_0x1f92db[_0x29d9('0x1e')]);var _0x4386ee={'method':_0x29d9('0x34'),'uri':util[_0x29d9('0x43')](_0x29d9('0x50'),_0x1f92db[_0x29d9('0x4e')]),'body':_0x499b61,'headers':{'Authorization':util[_0x29d9('0x43')](_0x29d9('0x44'),new Buffer(_0x46ded0)[_0x29d9('0x45')](_0x29d9('0x46')))},'json':!![]};rp(_0x4386ee)[_0x29d9('0x26')](function(_0x3d1101){var _0x423540={'messageId':_0x3d1101[_0x29d9('0x51')][0x0]};return _0x4fd12d['update'](_0x423540);})[_0x29d9('0x29')](function(_0x336fbf){logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x52'),util[_0x29d9('0x39')](_0x336fbf,{'showHidden':![],'depth':null}));});}else{logger[_0x29d9('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29d9('0x2b'),'plivo',_0x29d9('0x53'));}break;case _0x29d9('0x54'):if(_0x1f92db['username']&&_0x1f92db['password']){if(_0x1f92db['baseUrl']){var _0x756e63={'method':_0x29d9('0x34'),'uri':_0x1f92db['baseUrl']+_0x29d9('0x55'),'body':{'username':_0x1f92db[_0x29d9('0x2d')],'password':_0x1f92db['password']},'json':!![]};return rp(_0x756e63)[_0x29d9('0x26')](function(_0x20a7de){var _0xdade1f={'method':_0x29d9('0x34'),'uri':_0x1f92db[_0x29d9('0x56')]+_0x29d9('0x57'),'body':{'messages':[{'from':_0x1f92db[_0x29d9('0x1f')],'destinations':[{'to':_0x29fec4[_0x29d9('0x1f')]}],'text':_0x29fec4[_0x29d9('0x22')],'notifyUrl':_0x1f92db['remote']+_0x29d9('0x24')+_0x29fec4['id']+_0x29d9('0x25')+_0x1f92db['token'],'notifyContentType':'application/json','callbackData':_0x1f92db['phone']+';'+_0x29fec4[_0x29d9('0x22')]}]},'headers':{'Authorization':_0x29d9('0x58')+_0x20a7de[_0x29d9('0x4f')]},'json':!![]};return rp(_0xdade1f)[_0x29d9('0x26')](function(_0x8bb4f0){if(_0x8bb4f0[_0x29d9('0x20')]){var _0xac844a={'messageId':_0x8bb4f0['messages'][0x0][_0x29d9('0xb')]};if(!_0x1f92db[_0x29d9('0x37')]){_0xac844a['read']=!![];}return _0x4fd12d[_0x29d9('0x27')](_0xac844a);}else{return logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),'infobip',util['inspect'](_0x8bb4f0,{'showHidden':![],'depth':null}));}});})[_0x29d9('0x29')](function(_0x4dd222){return logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x54'),util[_0x29d9('0x39')](_0x4dd222,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x54'),_0x29d9('0x3a'));}break;case'csc':var _0x51e2de=require(_0x29d9('0x59'));if(_0x1f92db['apiKey']){var _0x5ba401={};_0x5ba401['login']=_0x1f92db[_0x29d9('0x2d')];_0x5ba401[_0x29d9('0x1f')]=_0x29fec4['phone'];_0x5ba401['sender']=_0x1f92db[_0x29d9('0x1f')];_0x5ba401[_0x29d9('0x5a')]=_0x29fec4[_0x29d9('0x22')];_0x5ba401[_0x29d9('0x5b')]=+new Date();var _0x203477='';var _0x31f87f='';var _0xff2435=Object[_0x29d9('0x5c')](_0x5ba401);_0xff2435['sort']();for(var _0x1ff0a5=0x0;_0x1ff0a5<_0xff2435[_0x29d9('0x5d')];_0x1ff0a5++){if(_0x203477!=''){_0x203477+='&';}_0x203477+=_0xff2435[_0x1ff0a5]+'='+encodeURIComponent(_0x5ba401[_0xff2435[_0x1ff0a5]]);_0x31f87f+=_0x5ba401[_0xff2435[_0x1ff0a5]];}_0x31f87f+=_0x1f92db[_0x29d9('0x5e')];_0x31f87f=_0x51e2de[_0x29d9('0x5f')](_0x29d9('0x60'))['update'](_0x31f87f)['digest'](_0x29d9('0x61'));if(_0x203477!==''){_0x203477+='&';}_0x203477+=_0x29d9('0x62')+_0x31f87f;var _0x6af47c={'method':_0x29d9('0x63'),'uri':_0x1f92db[_0x29d9('0x56')]+_0x29d9('0x64')+_0x203477,'json':!![]};return rp(_0x6af47c)[_0x29d9('0x26')](function(_0x5b3455){var _0x59332c=Object['keys'](_0x5b3455);if(_0x5b3455[_0x59332c[0x0]][_0x29d9('0x18')]&&parseInt(_0x5b3455[_0x59332c[0x0]][_0x29d9('0x18')])===0x0){var _0x4a152a={'messageId':_0x5b3455[_0x59332c[0x0]][_0x29d9('0x65')]};if(!_0x1f92db[_0x29d9('0x37')]){_0x4a152a[_0x29d9('0x4c')]=!![];}return _0x4fd12d[_0x29d9('0x27')](_0x4a152a);}else{return logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x66'),util[_0x29d9('0x39')](_0x5b3455[_0x29d9('0x18')],{'showHidden':![],'depth':null}));}})[_0x29d9('0x29')](function(_0x592cad){return logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x66'),util['inspect'](_0x592cad,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x66'),_0x29d9('0x67'));}break;case _0x29d9('0x68'):if(_0x1f92db[_0x29d9('0x5e')]){var _0x220279={'method':_0x29d9('0x34'),'uri':_0x29d9('0x69'),'headers':{'Authorization':_0x1f92db[_0x29d9('0x5e')]},'body':{'content':_0x29fec4[_0x29d9('0x22')],'to':[_0x29fec4['phone']],'from':_0x1f92db[_0x29d9('0x1f')],'binary':![],'clientMessageId':_0x29d9('0x6a'),'charset':_0x29d9('0x6b')},'json':!![]};rp(_0x220279)[_0x29d9('0x26')](function(_0x2b1585){if(!_0x2b1585[_0x29d9('0x18')]){var _0x23a712={'messageId':_0x2b1585[_0x29d9('0x20')][0x0][_0x29d9('0x6c')]};if(!_0x1f92db[_0x29d9('0x37')]){_0x23a712[_0x29d9('0x4c')]=!![];}return _0x4fd12d['update'](_0x23a712);}else{return logger[_0x29d9('0x18')](_0x29d9('0x2a'),_0x29d9('0x2b'),_0x29d9('0x68'),util['inspect'](_0x2b1585[_0x29d9('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5db864){return logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x68'),util[_0x29d9('0x39')](_0x5db864,{'showHidden':![],'depth':null}));});}else{logger[_0x29d9('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29d9('0x2b'),'clickatell',_0x29d9('0x67'));}break;case _0x29d9('0x6d'):if(_0x1f92db[_0x29d9('0x2d')]&&_0x1f92db[_0x29d9('0x31')]){var _0x46ded0=util[_0x29d9('0x43')](_0x29d9('0x41'),_0x1f92db[_0x29d9('0x2d')],_0x1f92db[_0x29d9('0x31')]);var _0x4386ee={'method':_0x29d9('0x34'),'uri':_0x29d9('0x6e')+_0x1f92db[_0x29d9('0x6f')]+'/messages','body':{'to':[_0x29fec4[_0x29d9('0x1f')]],'text':_0x29fec4[_0x29d9('0x22')],'from':_0x1f92db[_0x29d9('0x1f')],'applicationId':_0x1f92db[_0x29d9('0x70')]},'headers':{'Authorization':util[_0x29d9('0x43')](_0x29d9('0x44'),new Buffer(_0x46ded0)[_0x29d9('0x45')](_0x29d9('0x46')))},'json':!![]};rp(_0x4386ee)[_0x29d9('0x26')](function(_0xefa4d){if(_0xefa4d['id']){var _0x2f9e8a={'messageId':_0xefa4d['id']};return _0x4fd12d['update'](_0x2f9e8a);}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x6d'),util[_0x29d9('0x39')](_0xefa4d,{'showHidden':![],'depth':null}));}})[_0x29d9('0x29')](function(_0x92bd70){logger[_0x29d9('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x29d9('0x6d'),util[_0x29d9('0x39')](_0x92bd70,{'showHidden':![],'depth':null}));});}else{logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate','bandwidth',_0x29d9('0x3a'));}break;case _0x29d9('0x71'):if(_0x1f92db['apiKey']){var _0x4eec29={};var _0x6af47c={'method':_0x29d9('0x34'),'uri':_0x29d9('0x72'),'headers':{'Authorization':_0x29d9('0x73')+_0x1f92db[_0x29d9('0x5e')],'Content-Type':_0x29d9('0x74')},'body':{'from':_0x1f92db[_0x29d9('0x1f')],'to':_0x29fec4[_0x29d9('0x1f')],'text':_0x29fec4['body']},'json':!![]};return rp(_0x6af47c)[_0x29d9('0x26')](function(_0x35a7b7){if(_0x35a7b7[_0x29d9('0x75')]==0xca){_0x4eec29['message']=_0x35a7b7;var _0xed5b79={'method':_0x29d9('0x34'),'uri':_0x29d9('0x76'),'headers':{'Authorization':_0x29d9('0x73')+_0x1f92db['apiKey'],'Content-Type':_0x29d9('0x74')},'body':{'refid':_0x4eec29[_0x29d9('0x77')]['refid']},'json':!![]};return rp(_0xed5b79)[_0x29d9('0x26')](function(_0x54dda9){_0x4eec29['status']=_0x54dda9;var _0x58383a={'messageId':_0x4eec29[_0x29d9('0x77')][_0x29d9('0x78')],'read':!![]};return _0x4fd12d[_0x29d9('0x27')](_0x58383a);});}else{return logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x71'),util[_0x29d9('0x39')](_0x35a7b7,{'showHidden':![],'depth':null}));}})[_0x29d9('0x29')](function(_0x408d1b){return logger[_0x29d9('0x18')](_0x29d9('0x2a'),'afterCreate',_0x29d9('0x71'),util[_0x29d9('0x39')](_0x408d1b,{'showHidden':![],'depth':null}));});}else{return logger[_0x29d9('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x29d9('0x2b'),_0x29d9('0x71'),_0x29d9('0x79'));}break;}}})[_0x29d9('0x7a')](function(){_0x1859a2();});}else{_0x1859a2();}}},'charset':_0x29d9('0x7b'),'collate':_0x29d9('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4f4ab17..faa3e22 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 _0x74e9=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateSmsMessage','SmsMessage','create','body','options','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1d7e32,_0xcdfd91){var _0x2b52cc=function(_0x3f9f8e){while(--_0x3f9f8e){_0x1d7e32['push'](_0x1d7e32['shift']());}};_0x2b52cc(++_0xcdfd91);}(_0x74e9,0x99));var _0x974e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x74e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x974e('0x0'));var BPromise=require(_0x974e('0x1'));var rs=require(_0x974e('0x2'));var fs=require('fs');var Redis=require(_0x974e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x974e('0x4'));var logger=require(_0x974e('0x5'))(_0x974e('0x6'));var config=require(_0x974e('0x7'));var jayson=require(_0x974e('0x8'));var client=jayson[_0x974e('0x9')][_0x974e('0xa')]({'port':0x232a});config[_0x974e('0xb')]=_[_0x974e('0xc')](config[_0x974e('0xb')],{'host':_0x974e('0xd'),'port':0x18eb});var socket=require(_0x974e('0xe'))(new Redis(config['redis']));require(_0x974e('0xf'))[_0x974e('0x10')](socket);function respondWithRpcPromise(_0x2d8d1e,_0x4e8466,_0x205fab){return new BPromise(function(_0x212e29,_0x5a00fa){return client[_0x974e('0x11')](_0x2d8d1e,_0x205fab)[_0x974e('0x12')](function(_0x489ae7){logger['info'](_0x974e('0x13'),_0x4e8466,'request\x20sent');logger['debug'](_0x974e('0x14'),_0x4e8466,_0x974e('0x15'),JSON[_0x974e('0x16')](_0x489ae7));if(_0x489ae7['error']){if(_0x489ae7[_0x974e('0x17')][_0x974e('0x18')]===0x1f4){logger[_0x974e('0x17')](_0x974e('0x13'),_0x4e8466,_0x489ae7[_0x974e('0x17')][_0x974e('0x19')]);return _0x5a00fa(_0x489ae7[_0x974e('0x17')][_0x974e('0x19')]);}logger[_0x974e('0x17')](_0x974e('0x13'),_0x4e8466,_0x489ae7[_0x974e('0x17')][_0x974e('0x19')]);return _0x212e29(_0x489ae7[_0x974e('0x17')][_0x974e('0x19')]);}else{logger[_0x974e('0x1a')](_0x974e('0x13'),_0x4e8466,_0x974e('0x15'));_0x212e29(_0x489ae7['result'][_0x974e('0x19')]);}})['catch'](function(_0x4308c5){logger[_0x974e('0x17')](_0x974e('0x13'),_0x4e8466,_0x4308c5);_0x5a00fa(_0x4308c5);});});}exports[_0x974e('0x1b')]=function(_0x5b44c1){var _0x18b532=this;return new Promise(function(_0x2e0554,_0x15b0f6){return db[_0x974e('0x1c')][_0x974e('0x1d')](_0x5b44c1[_0x974e('0x1e')],{'raw':_0x5b44c1['options']?_0x5b44c1[_0x974e('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x974e('0x12')](function(_0x220cd1){logger['info']('CreateSmsMessage',_0x5b44c1);logger['debug']('CreateSmsMessage',_0x5b44c1,JSON[_0x974e('0x16')](_0x220cd1));_0x2e0554(_0x220cd1);})['catch'](function(_0xfa289f){logger[_0x974e('0x17')]('CreateSmsMessage',_0xfa289f[_0x974e('0x19')],_0x5b44c1);_0x15b0f6(_0x18b532[_0x974e('0x17')](0x1f4,_0xfa289f[_0x974e('0x19')]));});});}; \ No newline at end of file +var _0xac2c=['then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateSmsMessage','SmsMessage','body','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request'];(function(_0x4f7fc6,_0x554d2f){var _0x235170=function(_0x489da4){while(--_0x489da4){_0x4f7fc6['push'](_0x4f7fc6['shift']());}};_0x235170(++_0x554d2f);}(_0xac2c,0x1ce));var _0xcac2=function(_0x56f43b,_0x12f74b){_0x56f43b=_0x56f43b-0x0;var _0x2a81de=_0xac2c[_0x56f43b];return _0x2a81de;};'use strict';var _=require('lodash');var util=require(_0xcac2('0x0'));var moment=require(_0xcac2('0x1'));var BPromise=require(_0xcac2('0x2'));var rs=require(_0xcac2('0x3'));var fs=require('fs');var Redis=require(_0xcac2('0x4'));var db=require(_0xcac2('0x5'))['db'];var utils=require(_0xcac2('0x6'));var logger=require('../../config/logger')(_0xcac2('0x7'));var config=require(_0xcac2('0x8'));var jayson=require(_0xcac2('0x9'));var client=jayson[_0xcac2('0xa')]['http']({'port':0x232a});config[_0xcac2('0xb')]=_[_0xcac2('0xc')](config['redis'],{'host':_0xcac2('0xd'),'port':0x18eb});var socket=require(_0xcac2('0xe'))(new Redis(config[_0xcac2('0xb')]));require(_0xcac2('0xf'))[_0xcac2('0x10')](socket);function respondWithRpcPromise(_0x377456,_0x24c746,_0x15114c){return new BPromise(function(_0xf29ae0,_0x23d28b){return client[_0xcac2('0x11')](_0x377456,_0x15114c)[_0xcac2('0x12')](function(_0x222ee2){logger['info'](_0xcac2('0x13'),_0x24c746,_0xcac2('0x14'));logger[_0xcac2('0x15')](_0xcac2('0x16'),_0x24c746,_0xcac2('0x14'),JSON['stringify'](_0x222ee2));if(_0x222ee2[_0xcac2('0x17')]){if(_0x222ee2['error']['code']===0x1f4){logger[_0xcac2('0x17')](_0xcac2('0x13'),_0x24c746,_0x222ee2['error']['message']);return _0x23d28b(_0x222ee2[_0xcac2('0x17')][_0xcac2('0x18')]);}logger[_0xcac2('0x17')]('SmsMessage,\x20%s,\x20%s',_0x24c746,_0x222ee2[_0xcac2('0x17')][_0xcac2('0x18')]);return _0xf29ae0(_0x222ee2[_0xcac2('0x17')]['message']);}else{logger[_0xcac2('0x19')](_0xcac2('0x13'),_0x24c746,_0xcac2('0x14'));_0xf29ae0(_0x222ee2['result'][_0xcac2('0x18')]);}})[_0xcac2('0x1a')](function(_0x3aab4c){logger['error']('SmsMessage,\x20%s,\x20%s',_0x24c746,_0x3aab4c);_0x23d28b(_0x3aab4c);});});}exports[_0xcac2('0x1b')]=function(_0x49163d){var _0x270d0c=this;return new Promise(function(_0x2fe0c7,_0x220bb3){return db[_0xcac2('0x1c')]['create'](_0x49163d[_0xcac2('0x1d')],{'raw':_0x49163d['options']?_0x49163d['options'][_0xcac2('0x1e')]===undefined?!![]:![]:!![]})[_0xcac2('0x12')](function(_0x5ec4bf){logger[_0xcac2('0x19')]('CreateSmsMessage',_0x49163d);logger[_0xcac2('0x15')](_0xcac2('0x1b'),_0x49163d,JSON[_0xcac2('0x1f')](_0x5ec4bf));_0x2fe0c7(_0x5ec4bf);})[_0xcac2('0x1a')](function(_0xb00a66){logger[_0xcac2('0x17')](_0xcac2('0x1b'),_0xb00a66[_0xcac2('0x18')],_0x49163d);_0x220bb3(_0x270d0c[_0xcac2('0x17')](0x1f4,_0xb00a66[_0xcac2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ec16b44..e88a047 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 _0x843d=['register','length','./smsMessage.events','update','emit','removeListener'];(function(_0x449f87,_0x766527){var _0x2d919c=function(_0x2eb966){while(--_0x2eb966){_0x449f87['push'](_0x449f87['shift']());}};_0x2d919c(++_0x766527);}(_0x843d,0xe0));var _0xd843=function(_0x4927d1,_0x66f7c5){_0x4927d1=_0x4927d1-0x0;var _0xa81325=_0x843d[_0x4927d1];return _0xa81325;};'use strict';var SmsMessageEvents=require(_0xd843('0x0'));var events=['save','remove',_0xd843('0x1')];function createListener(_0x10e433,_0x1266ea){return function(_0x213c40){_0x1266ea[_0xd843('0x2')](_0x10e433,_0x213c40);};}function removeListener(_0x567c55,_0x48d992){return function(){SmsMessageEvents[_0xd843('0x3')](_0x567c55,_0x48d992);};}exports[_0xd843('0x4')]=function(_0x3fcfc8){for(var _0x1590f5=0x0,_0x456fb9=events[_0xd843('0x5')];_0x1590f5<_0x456fb9;_0x1590f5++){var _0x59f61a=events[_0x1590f5];var _0x16b00f=createListener('smsMessage:'+_0x59f61a,_0x3fcfc8);SmsMessageEvents['on'](_0x59f61a,_0x16b00f);}}; \ No newline at end of file +var _0xa06e=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x20d06a,_0x16b092){var _0x1c48ef=function(_0x2da6d5){while(--_0x2da6d5){_0x20d06a['push'](_0x20d06a['shift']());}};_0x1c48ef(++_0x16b092);}(_0xa06e,0x11a));var _0xea06=function(_0x578c1f,_0x5c52fc){_0x578c1f=_0x578c1f-0x0;var _0x39bef2=_0xa06e[_0x578c1f];return _0x39bef2;};'use strict';var SmsMessageEvents=require(_0xea06('0x0'));var events=[_0xea06('0x1'),_0xea06('0x2'),_0xea06('0x3')];function createListener(_0x1a699c,_0x414418){return function(_0x48f622){_0x414418[_0xea06('0x4')](_0x1a699c,_0x48f622);};}function removeListener(_0x4498db,_0x43cbf9){return function(){SmsMessageEvents[_0xea06('0x5')](_0x4498db,_0x43cbf9);};}exports[_0xea06('0x6')]=function(_0x5aa6c0){for(var _0x50d64e=0x0,_0x23165f=events[_0xea06('0x7')];_0x50d64e<_0x23165f;_0x50d64e++){var _0x314515=events[_0x50d64e];var _0x5c6528=createListener(_0xea06('0x8')+_0x314515,_0x5aa6c0);SmsMessageEvents['on'](_0x314515,_0x5c6528);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5bcba56..d313c04 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 _0x6d8c=['addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/describe','/:id','getMembers','getAgents','create','post','/:id/teams'];(function(_0x2de77d,_0x21c2d8){var _0x46b041=function(_0x20615f){while(--_0x20615f){_0x2de77d['push'](_0x2de77d['shift']());}};_0x46b041(++_0x21c2d8);}(_0x6d8c,0x127));var _0xc6d8=function(_0x26f171,_0x4e7bc2){_0x26f171=_0x26f171-0x0;var _0x57d0e7=_0x6d8c[_0x26f171];return _0x57d0e7;};'use strict';var multer=require(_0xc6d8('0x0'));var util=require('util');var path=require(_0xc6d8('0x1'));var timeout=require(_0xc6d8('0x2'));var express=require(_0xc6d8('0x3'));var router=express[_0xc6d8('0x4')]();var fs_extra=require(_0xc6d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6d8('0x6'));var config=require('../../config/environment');var controller=require(_0xc6d8('0x7'));router[_0xc6d8('0x8')]('/',auth[_0xc6d8('0x9')](),controller['index']);router[_0xc6d8('0x8')](_0xc6d8('0xa'),auth[_0xc6d8('0x9')](),controller['describe']);router[_0xc6d8('0x8')](_0xc6d8('0xb'),auth[_0xc6d8('0x9')](),controller['show']);router[_0xc6d8('0x8')]('/:id/members',auth[_0xc6d8('0x9')](),controller[_0xc6d8('0xc')]);router[_0xc6d8('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xc6d8('0x8')]('/:id/users',auth[_0xc6d8('0x9')](),controller[_0xc6d8('0xd')]);router['post']('/',auth[_0xc6d8('0x9')](),controller[_0xc6d8('0xe')]);router[_0xc6d8('0xf')](_0xc6d8('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xc6d8('0x11')]);router[_0xc6d8('0x12')](_0xc6d8('0xb'),auth['isAuthenticated'](),controller[_0xc6d8('0x13')]);router[_0xc6d8('0x14')](_0xc6d8('0xb'),auth[_0xc6d8('0x9')](),controller['destroy']);router[_0xc6d8('0x14')](_0xc6d8('0x10'),auth[_0xc6d8('0x9')](),controller[_0xc6d8('0x15')]);router[_0xc6d8('0x14')]('/:id/users',auth[_0xc6d8('0x9')](),controller[_0xc6d8('0x16')]);module[_0xc6d8('0x17')]=router; \ No newline at end of file +var _0xca5e=['getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams'];(function(_0x3bac2b,_0x137306){var _0xbadf45=function(_0xddb85a){while(--_0xddb85a){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xbadf45(++_0x137306);}(_0xca5e,0x1ec));var _0xeca5=function(_0x49d053,_0xdd02f2){_0x49d053=_0x49d053-0x0;var _0x28f6d8=_0xca5e[_0x49d053];return _0x28f6d8;};'use strict';var multer=require(_0xeca5('0x0'));var util=require(_0xeca5('0x1'));var path=require(_0xeca5('0x2'));var timeout=require(_0xeca5('0x3'));var express=require(_0xeca5('0x4'));var router=express[_0xeca5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeca5('0x6'));var interaction=require(_0xeca5('0x7'));var config=require(_0xeca5('0x8'));var controller=require(_0xeca5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xeca5('0xa')](_0xeca5('0xb'),auth[_0xeca5('0xc')](),controller[_0xeca5('0xd')]);router[_0xeca5('0xa')](_0xeca5('0xe'),auth[_0xeca5('0xc')](),controller[_0xeca5('0xf')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xeca5('0x10')]);router[_0xeca5('0xa')](_0xeca5('0x11'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x12')]);router[_0xeca5('0xa')]('/:id/users',auth[_0xeca5('0xc')](),controller[_0xeca5('0x13')]);router['post']('/',auth[_0xeca5('0xc')](),controller[_0xeca5('0x14')]);router[_0xeca5('0x15')](_0xeca5('0x11'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x16')]);router['post'](_0xeca5('0x17'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x18')]);router['put'](_0xeca5('0xe'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x19')]);router[_0xeca5('0x1a')](_0xeca5('0xe'),auth[_0xeca5('0xc')](),controller['destroy']);router[_0xeca5('0x1a')](_0xeca5('0x11'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x1b')]);router['delete'](_0xeca5('0x17'),auth[_0xeca5('0xc')](),controller[_0xeca5('0x1c')]);module[_0xeca5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5548b9c..bf1d057 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 _0x9351=['name','ENUM','rrmemory','beepall','STRING'];(function(_0x49f74b,_0x489fa6){var _0x185506=function(_0x142eaf){while(--_0x142eaf){_0x49f74b['push'](_0x49f74b['shift']());}};_0x185506(++_0x489fa6);}(_0x9351,0x1cb));var _0x1935=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9351[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1935('0x0')],'unique':_0x1935('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1935('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1935('0x2')](_0x1935('0x3'),_0x1935('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x853c=['STRING','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x853c,0x142));var _0xc853=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0x853c[_0x2d2b63];return _0x5d18f8;};'use strict';var Sequelize=require(_0xc853('0x0'));module[_0xc853('0x1')]={'name':{'type':Sequelize[_0xc853('0x2')],'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[_0xc853('0x3')]('rrmemory',_0xc853('0x4'),_0xc853('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f2d3c2b..62d5bc1 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0xadb5,0xad));var _0x5adb=function(_0x107381,_0x393ab4){_0x107381=_0x107381-0x0;var _0x223696=_0xadb5[_0x107381];return _0x223696;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x3a64b3,_0x52a463){var _0x3f0f31=function(_0x5d4943){while(--_0x5d4943){_0x3a64b3['push'](_0x3a64b3['shift']());}};_0x3f0f31(++_0x52a463);}(_0x2ef3,0xba));var _0x32ef=function(_0x242361,_0x7b3b7){_0x242361=_0x242361-0x0;var _0x2f5f00=_0x2ef3[_0x242361];return _0x2f5f00;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 4addb29..5fc025f 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 _0x9503=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','remove'];(function(_0x4b5566,_0xc9bd9e){var _0x147746=function(_0x48e740){while(--_0x48e740){_0x4b5566['push'](_0x4b5566['shift']());}};_0x147746(++_0xc9bd9e);}(_0x9503,0x158));var _0x3950=function(_0x2e1184,_0x1d7582){_0x2e1184=_0x2e1184-0x0;var _0x2bc2eb=_0x9503[_0x2e1184];return _0x2bc2eb;};'use strict';var EventEmitter=require(_0x3950('0x0'));var SmsQueue=require(_0x3950('0x1'))['db'][_0x3950('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3950('0x3')](0x0);var events={'afterCreate':_0x3950('0x4'),'afterUpdate':'update','afterDestroy':_0x3950('0x5')};function emitEvent(_0x5b4a10){return function(_0x8ada3d,_0x48fcff,_0x375c9c){SmsQueueEvents['emit'](_0x5b4a10+':'+_0x8ada3d['id'],_0x8ada3d);SmsQueueEvents[_0x3950('0x6')](_0x5b4a10,_0x8ada3d);_0x375c9c(null);};}for(var e in events){if(events[_0x3950('0x7')](e)){var event=events[e];SmsQueue[_0x3950('0x8')](e,emitEvent(event));}}module[_0x3950('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x793b=['events','../../mysqldb','SmsQueue','setMaxListeners','save','hasOwnProperty','hook'];(function(_0x889bd2,_0x5eed44){var _0x5ba884=function(_0x4d6d84){while(--_0x4d6d84){_0x889bd2['push'](_0x889bd2['shift']());}};_0x5ba884(++_0x5eed44);}(_0x793b,0x16c));var _0xb793=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x793b[_0x2b6235];return _0x4cee7f;};'use strict';var EventEmitter=require(_0xb793('0x0'));var SmsQueue=require(_0xb793('0x1'))['db'][_0xb793('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb793('0x3')](0x0);var events={'afterCreate':_0xb793('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x118646){return function(_0x26c65d,_0x41996f,_0x15437e){SmsQueueEvents['emit'](_0x118646+':'+_0x26c65d['id'],_0x26c65d);SmsQueueEvents['emit'](_0x118646,_0x26c65d);_0x15437e(null);};}for(var e in events){if(events[_0xb793('0x5')](e)){var event=events[e];SmsQueue[_0xb793('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e3e07f5..84b4061 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 _0x4385=['../../config/environment','./smsQueue.attributes','exports','define','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x45556d,_0x25e55d){var _0x6a3aa3=function(_0x2ead8d){while(--_0x2ead8d){_0x45556d['push'](_0x45556d['shift']());}};_0x6a3aa3(++_0x25e55d);}(_0x4385,0x144));var _0x5438=function(_0x22c52e,_0x507b36){_0x22c52e=_0x22c52e-0x0;var _0x7c4632=_0x4385[_0x22c52e];return _0x7c4632;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5438('0x0'))(_0x5438('0x1'));var moment=require('moment');var BPromise=require(_0x5438('0x2'));var rp=require(_0x5438('0x3'));var fs=require('fs');var path=require(_0x5438('0x4'));var rimraf=require(_0x5438('0x5'));var config=require(_0x5438('0x6'));var attributes=require(_0x5438('0x7'));module[_0x5438('0x8')]=function(_0x5d998e,_0x1f4353){return _0x5d998e[_0x5438('0x9')]('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x949e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x4c5172,_0x5c4f8c){var _0x397837=function(_0x3da869){while(--_0x3da869){_0x4c5172['push'](_0x4c5172['shift']());}};_0x397837(++_0x5c4f8c);}(_0x949e,0x9c));var _0xe949=function(_0x717a7b,_0x2f90dc){_0x717a7b=_0x717a7b-0x0;var _0x58ff8a=_0x949e[_0x717a7b];return _0x58ff8a;};'use strict';var _=require('lodash');var util=require(_0xe949('0x0'));var logger=require(_0xe949('0x1'))(_0xe949('0x2'));var moment=require(_0xe949('0x3'));var BPromise=require(_0xe949('0x4'));var rp=require(_0xe949('0x5'));var fs=require('fs');var path=require(_0xe949('0x6'));var rimraf=require(_0xe949('0x7'));var config=require(_0xe949('0x8'));var attributes=require(_0xe949('0x9'));module[_0xe949('0xa')]=function(_0x7520f6,_0x381b95){return _0x7520f6[_0xe949('0xb')](_0xe949('0xc'),attributes,{'tableName':'sms_queues','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 676579f..29de415 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 _0x2444=['info','request\x20sent','debug','stringify','code','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','findAll','options','attributes','limit','include','model','map','then','ShowSmsQueue','SmsQueue','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x2444,0x1c2));var _0x4244=function(_0x3db78a,_0x699d09){_0x3db78a=_0x3db78a-0x0;var _0x3c0d3c=_0x2444[_0x3db78a];return _0x3c0d3c;};'use strict';var _=require('lodash');var util=require(_0x4244('0x0'));var moment=require(_0x4244('0x1'));var BPromise=require(_0x4244('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4244('0x3'));var db=require(_0x4244('0x4'))['db'];var utils=require(_0x4244('0x5'));var logger=require(_0x4244('0x6'))(_0x4244('0x7'));var config=require(_0x4244('0x8'));var jayson=require(_0x4244('0x9'));var client=jayson[_0x4244('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4244('0xb')](config[_0x4244('0xc')],{'host':_0x4244('0xd'),'port':0x18eb});var socket=require(_0x4244('0xe'))(new Redis(config[_0x4244('0xc')]));require(_0x4244('0xf'))[_0x4244('0x10')](socket);function respondWithRpcPromise(_0x33caaa,_0x53ed49,_0x4fbb4c){return new BPromise(function(_0x2dd243,_0x5dbb43){return client[_0x4244('0x11')](_0x33caaa,_0x4fbb4c)['then'](function(_0x5db6e6){logger[_0x4244('0x12')]('SmsQueue,\x20%s,\x20%s',_0x53ed49,_0x4244('0x13'));logger[_0x4244('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x53ed49,_0x4244('0x13'),JSON[_0x4244('0x15')](_0x5db6e6));if(_0x5db6e6['error']){if(_0x5db6e6['error'][_0x4244('0x16')]===0x1f4){logger[_0x4244('0x17')](_0x4244('0x18'),_0x53ed49,_0x5db6e6[_0x4244('0x17')][_0x4244('0x19')]);return _0x5dbb43(_0x5db6e6['error'][_0x4244('0x19')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x53ed49,_0x5db6e6[_0x4244('0x17')][_0x4244('0x19')]);return _0x2dd243(_0x5db6e6[_0x4244('0x17')][_0x4244('0x19')]);}else{logger[_0x4244('0x12')](_0x4244('0x18'),_0x53ed49,_0x4244('0x13'));_0x2dd243(_0x5db6e6['result']['message']);}})[_0x4244('0x1a')](function(_0x594607){logger['error']('SmsQueue,\x20%s,\x20%s',_0x53ed49,_0x594607);_0x5dbb43(_0x594607);});});}exports[_0x4244('0x1b')]=function(_0x15085c){var _0x3346c8=this;return new Promise(function(_0x452fd7,_0x704c9){return db['SmsQueue'][_0x4244('0x1c')]({'raw':_0x15085c['options']?_0x15085c[_0x4244('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x15085c[_0x4244('0x1d')]?_0x15085c[_0x4244('0x1d')]['where']||null:null,'attributes':_0x15085c[_0x4244('0x1d')]?_0x15085c['options'][_0x4244('0x1e')]||null:null,'limit':_0x15085c[_0x4244('0x1d')]?_0x15085c[_0x4244('0x1d')][_0x4244('0x1f')]||null:null,'include':_0x15085c['options']?_0x15085c['options']['include']?_['map'](_0x15085c[_0x4244('0x1d')][_0x4244('0x20')],function(_0x430c34){return{'model':db[_0x430c34[_0x4244('0x21')]],'as':_0x430c34['as'],'attributes':_0x430c34['attributes'],'include':_0x430c34[_0x4244('0x20')]?_[_0x4244('0x22')](_0x430c34[_0x4244('0x20')],function(_0x2ffd3a){return{'model':db[_0x2ffd3a['model']],'as':_0x2ffd3a['as'],'attributes':_0x2ffd3a[_0x4244('0x1e')],'include':_0x2ffd3a[_0x4244('0x20')]?_[_0x4244('0x22')](_0x2ffd3a[_0x4244('0x20')],function(_0x286670){return{'model':db[_0x286670[_0x4244('0x21')]],'as':_0x286670['as'],'attributes':_0x286670[_0x4244('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4244('0x23')](function(_0x4d3af8){logger['info'](_0x4244('0x1b'),_0x15085c);logger['debug'](_0x4244('0x1b'),_0x15085c,JSON[_0x4244('0x15')](_0x4d3af8));_0x452fd7(_0x4d3af8);})[_0x4244('0x1a')](function(_0x4af50f){logger['error']('GetSmsQueue',_0x4af50f[_0x4244('0x19')],_0x15085c);_0x704c9(_0x3346c8['error'](0x1f4,_0x4af50f[_0x4244('0x19')]));});});};exports[_0x4244('0x24')]=function(_0x54b92d){var _0x5127b0=this;return new Promise(function(_0x145164,_0x38524e){return db[_0x4244('0x25')]['find']({'raw':_0x54b92d[_0x4244('0x1d')]?_0x54b92d[_0x4244('0x1d')][_0x4244('0x26')]===undefined?!![]:![]:!![],'where':_0x54b92d[_0x4244('0x1d')]?_0x54b92d[_0x4244('0x1d')]['where']||null:null,'attributes':_0x54b92d[_0x4244('0x1d')]?_0x54b92d[_0x4244('0x1d')][_0x4244('0x1e')]||null:null,'include':_0x54b92d['options']?_0x54b92d['options'][_0x4244('0x20')]?_[_0x4244('0x22')](_0x54b92d[_0x4244('0x1d')][_0x4244('0x20')],function(_0x46a952){return{'model':db[_0x46a952['model']],'as':_0x46a952['as'],'attributes':_0x46a952[_0x4244('0x1e')],'include':_0x46a952[_0x4244('0x20')]?_['map'](_0x46a952['include'],function(_0x5093ff){return{'model':db[_0x5093ff[_0x4244('0x21')]],'as':_0x5093ff['as'],'attributes':_0x5093ff[_0x4244('0x1e')],'include':_0x5093ff['include']?_[_0x4244('0x22')](_0x5093ff['include'],function(_0x1de203){return{'model':db[_0x1de203['model']],'as':_0x1de203['as'],'attributes':_0x1de203[_0x4244('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3362db){logger[_0x4244('0x12')](_0x4244('0x24'),_0x54b92d);logger[_0x4244('0x14')]('ShowSmsQueue',_0x54b92d,JSON[_0x4244('0x15')](_0x3362db));_0x145164(_0x3362db);})[_0x4244('0x1a')](function(_0x39602b){logger[_0x4244('0x17')]('ShowSmsQueue',_0x39602b[_0x4244('0x19')],_0x54b92d);_0x38524e(_0x5127b0[_0x4244('0x17')](0x1f4,_0x39602b[_0x4244('0x19')]));});});}; \ No newline at end of file +var _0xc506=['stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','SmsQueue','options','raw','limit','include','model','attributes','map','ShowSmsQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','register','then','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x25455e,_0x33ce14){var _0x77e74f=function(_0x448874){while(--_0x448874){_0x25455e['push'](_0x25455e['shift']());}};_0x77e74f(++_0x33ce14);}(_0xc506,0x86));var _0x6c50=function(_0x3357b8,_0xeb406){_0x3357b8=_0x3357b8-0x0;var _0x50737a=_0xc506[_0x3357b8];return _0x50737a;};'use strict';var _=require(_0x6c50('0x0'));var util=require(_0x6c50('0x1'));var moment=require(_0x6c50('0x2'));var BPromise=require(_0x6c50('0x3'));var rs=require(_0x6c50('0x4'));var fs=require('fs');var Redis=require(_0x6c50('0x5'));var db=require(_0x6c50('0x6'))['db'];var utils=require(_0x6c50('0x7'));var logger=require(_0x6c50('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c50('0x9'));var client=jayson['client'][_0x6c50('0xa')]({'port':0x232a});config[_0x6c50('0xb')]=_[_0x6c50('0xc')](config[_0x6c50('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c50('0xb')]));require('./smsQueue.socket')[_0x6c50('0xd')](socket);function respondWithRpcPromise(_0x35f06d,_0x28e4b4,_0x1f9a2f){return new BPromise(function(_0x2cde9b,_0x3cf4a0){return client['request'](_0x35f06d,_0x1f9a2f)[_0x6c50('0xe')](function(_0x20d53f){logger['info']('SmsQueue,\x20%s,\x20%s',_0x28e4b4,'request\x20sent');logger[_0x6c50('0xf')](_0x6c50('0x10'),_0x28e4b4,_0x6c50('0x11'),JSON[_0x6c50('0x12')](_0x20d53f));if(_0x20d53f[_0x6c50('0x13')]){if(_0x20d53f[_0x6c50('0x13')][_0x6c50('0x14')]===0x1f4){logger[_0x6c50('0x13')](_0x6c50('0x15'),_0x28e4b4,_0x20d53f[_0x6c50('0x13')][_0x6c50('0x16')]);return _0x3cf4a0(_0x20d53f[_0x6c50('0x13')][_0x6c50('0x16')]);}logger[_0x6c50('0x13')]('SmsQueue,\x20%s,\x20%s',_0x28e4b4,_0x20d53f[_0x6c50('0x13')][_0x6c50('0x16')]);return _0x2cde9b(_0x20d53f[_0x6c50('0x13')][_0x6c50('0x16')]);}else{logger[_0x6c50('0x17')]('SmsQueue,\x20%s,\x20%s',_0x28e4b4,_0x6c50('0x11'));_0x2cde9b(_0x20d53f[_0x6c50('0x18')]['message']);}})[_0x6c50('0x19')](function(_0x39f725){logger[_0x6c50('0x13')]('SmsQueue,\x20%s,\x20%s',_0x28e4b4,_0x39f725);_0x3cf4a0(_0x39f725);});});}exports[_0x6c50('0x1a')]=function(_0x13a8d2){var _0x1051ae=this;return new Promise(function(_0x40fe8a,_0x21f813){return db[_0x6c50('0x1b')]['findAll']({'raw':_0x13a8d2[_0x6c50('0x1c')]?_0x13a8d2[_0x6c50('0x1c')][_0x6c50('0x1d')]===undefined?!![]:![]:!![],'where':_0x13a8d2[_0x6c50('0x1c')]?_0x13a8d2[_0x6c50('0x1c')]['where']||null:null,'attributes':_0x13a8d2[_0x6c50('0x1c')]?_0x13a8d2['options']['attributes']||null:null,'limit':_0x13a8d2[_0x6c50('0x1c')]?_0x13a8d2[_0x6c50('0x1c')][_0x6c50('0x1e')]||null:null,'include':_0x13a8d2[_0x6c50('0x1c')]?_0x13a8d2[_0x6c50('0x1c')][_0x6c50('0x1f')]?_['map'](_0x13a8d2[_0x6c50('0x1c')][_0x6c50('0x1f')],function(_0x307e22){return{'model':db[_0x307e22[_0x6c50('0x20')]],'as':_0x307e22['as'],'attributes':_0x307e22[_0x6c50('0x21')],'include':_0x307e22[_0x6c50('0x1f')]?_[_0x6c50('0x22')](_0x307e22['include'],function(_0x5ef951){return{'model':db[_0x5ef951[_0x6c50('0x20')]],'as':_0x5ef951['as'],'attributes':_0x5ef951[_0x6c50('0x21')],'include':_0x5ef951[_0x6c50('0x1f')]?_[_0x6c50('0x22')](_0x5ef951[_0x6c50('0x1f')],function(_0x53c03b){return{'model':db[_0x53c03b['model']],'as':_0x53c03b['as'],'attributes':_0x53c03b[_0x6c50('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6c50('0xe')](function(_0x3f1f96){logger[_0x6c50('0x17')]('GetSmsQueue',_0x13a8d2);logger[_0x6c50('0xf')]('GetSmsQueue',_0x13a8d2,JSON[_0x6c50('0x12')](_0x3f1f96));_0x40fe8a(_0x3f1f96);})[_0x6c50('0x19')](function(_0x5e1b69){logger['error'](_0x6c50('0x1a'),_0x5e1b69['message'],_0x13a8d2);_0x21f813(_0x1051ae[_0x6c50('0x13')](0x1f4,_0x5e1b69[_0x6c50('0x16')]));});});};exports[_0x6c50('0x23')]=function(_0x58a323){var _0x545f97=this;return new Promise(function(_0x417581,_0x4a3fbe){return db[_0x6c50('0x1b')][_0x6c50('0x24')]({'raw':_0x58a323[_0x6c50('0x1c')]?_0x58a323[_0x6c50('0x1c')][_0x6c50('0x1d')]===undefined?!![]:![]:!![],'where':_0x58a323[_0x6c50('0x1c')]?_0x58a323[_0x6c50('0x1c')][_0x6c50('0x25')]||null:null,'attributes':_0x58a323['options']?_0x58a323['options'][_0x6c50('0x21')]||null:null,'include':_0x58a323[_0x6c50('0x1c')]?_0x58a323['options'][_0x6c50('0x1f')]?_[_0x6c50('0x22')](_0x58a323[_0x6c50('0x1c')]['include'],function(_0x203d8b){return{'model':db[_0x203d8b['model']],'as':_0x203d8b['as'],'attributes':_0x203d8b['attributes'],'include':_0x203d8b['include']?_[_0x6c50('0x22')](_0x203d8b['include'],function(_0x57d0fd){return{'model':db[_0x57d0fd['model']],'as':_0x57d0fd['as'],'attributes':_0x57d0fd[_0x6c50('0x21')],'include':_0x57d0fd[_0x6c50('0x1f')]?_['map'](_0x57d0fd['include'],function(_0x5cacc3){return{'model':db[_0x5cacc3[_0x6c50('0x20')]],'as':_0x5cacc3['as'],'attributes':_0x5cacc3[_0x6c50('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3aace9){logger[_0x6c50('0x17')]('ShowSmsQueue',_0x58a323);logger[_0x6c50('0xf')]('ShowSmsQueue',_0x58a323,JSON['stringify'](_0x3aace9));_0x417581(_0x3aace9);})['catch'](function(_0x3c7a9a){logger['error'](_0x6c50('0x23'),_0x3c7a9a[_0x6c50('0x16')],_0x58a323);_0x4a3fbe(_0x545f97[_0x6c50('0x13')](0x1f4,_0x3c7a9a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 794dfc3..fdfe50d 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 _0x4f18=['remove','update','emit','removeListener','register','length','save'];(function(_0x13276c,_0x57469c){var _0x572651=function(_0x3abb34){while(--_0x3abb34){_0x13276c['push'](_0x13276c['shift']());}};_0x572651(++_0x57469c);}(_0x4f18,0x195));var _0x84f1=function(_0x2be70b,_0x3f3cbf){_0x2be70b=_0x2be70b-0x0;var _0x35e31d=_0x4f18[_0x2be70b];return _0x35e31d;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x84f1('0x0'),_0x84f1('0x1'),_0x84f1('0x2')];function createListener(_0x19a66c,_0xd13106){return function(_0x19c998){_0xd13106[_0x84f1('0x3')](_0x19a66c,_0x19c998);};}function removeListener(_0x2122a0,_0x48af49){return function(){SmsQueueEvents[_0x84f1('0x4')](_0x2122a0,_0x48af49);};}exports[_0x84f1('0x5')]=function(_0x575add){for(var _0x5d6221=0x0,_0x2b23b9=events[_0x84f1('0x6')];_0x5d6221<_0x2b23b9;_0x5d6221++){var _0x391639=events[_0x5d6221];var _0x1097cf=createListener('smsQueue:'+_0x391639,_0x575add);SmsQueueEvents['on'](_0x391639,_0x1097cf);}}; \ No newline at end of file +var _0xbab1=['emit','removeListener','register','length','update'];(function(_0x40ef7d,_0x1ce444){var _0x3a1fed=function(_0x2659e1){while(--_0x2659e1){_0x40ef7d['push'](_0x40ef7d['shift']());}};_0x3a1fed(++_0x1ce444);}(_0xbab1,0x86));var _0x1bab=function(_0x34230a,_0x50fa92){_0x34230a=_0x34230a-0x0;var _0x3e869b=_0xbab1[_0x34230a];return _0x3e869b;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x1bab('0x0')];function createListener(_0x2065cd,_0x2ce466){return function(_0x140f3c){_0x2ce466[_0x1bab('0x1')](_0x2065cd,_0x140f3c);};}function removeListener(_0x4d3a08,_0x4c8d55){return function(){SmsQueueEvents[_0x1bab('0x2')](_0x4d3a08,_0x4c8d55);};}exports[_0x1bab('0x3')]=function(_0x11ac5c){for(var _0x2d27ca=0x0,_0x20c0e8=events[_0x1bab('0x4')];_0x2d27ca<_0x20c0e8;_0x2d27ca++){var _0x2b4dba=events[_0x2d27ca];var _0x3ed110=createListener('smsQueue:'+_0x2b4dba,_0x11ac5c);SmsQueueEvents['on'](_0x2b4dba,_0x3ed110);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 517e722..f808178 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 _0x6fc4=['/describe','/:id','show','create','put','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x3152c3,_0x562504){var _0x545288=function(_0x594848){while(--_0x594848){_0x3152c3['push'](_0x3152c3['shift']());}};_0x545288(++_0x562504);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x261d18,_0x13490f){_0x261d18=_0x261d18-0x0;var _0x3e7208=_0x6fc4[_0x261d18];return _0x3e7208;};'use strict';var multer=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x46fc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46fc('0x3'));var config=require(_0x46fc('0x4'));var controller=require(_0x46fc('0x5'));router[_0x46fc('0x6')]('/',auth[_0x46fc('0x7')](),controller[_0x46fc('0x8')]);router[_0x46fc('0x6')](_0x46fc('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x46fc('0x6')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x46fc('0xc')]);router[_0x46fc('0xd')]('/:id',auth[_0x46fc('0x7')](),controller['update']);router[_0x46fc('0xe')](_0x46fc('0xa'),auth[_0x46fc('0x7')](),controller[_0x46fc('0xf')]);module[_0x46fc('0x10')]=router; \ No newline at end of file +var _0xccd1=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xccd1,0x66));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1ccd('0x0'));var util=require(_0x1ccd('0x1'));var path=require(_0x1ccd('0x2'));var timeout=require(_0x1ccd('0x3'));var express=require(_0x1ccd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ccd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x1ccd('0x6')]('/',auth[_0x1ccd('0x7')](),controller[_0x1ccd('0x8')]);router['get'](_0x1ccd('0x9'),auth[_0x1ccd('0x7')](),controller[_0x1ccd('0xa')]);router['get'](_0x1ccd('0xb'),auth[_0x1ccd('0x7')](),controller['show']);router[_0x1ccd('0xc')]('/',auth[_0x1ccd('0x7')](),controller[_0x1ccd('0xd')]);router[_0x1ccd('0xe')](_0x1ccd('0xb'),auth[_0x1ccd('0x7')](),controller[_0x1ccd('0xf')]);router[_0x1ccd('0x10')]('/:id',auth[_0x1ccd('0x7')](),controller[_0x1ccd('0x11')]);module[_0x1ccd('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3535814..84ff07d 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 _0xe3ff=['moment','sequelize','exports','STRING','DATE'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0xe3ff,0x6e));var _0xfe3f=function(_0x433188,_0x356c56){_0x433188=_0x433188-0x0;var _0x43f298=_0xe3ff[_0x433188];return _0x43f298;};'use strict';var moment=require(_0xfe3f('0x0'));var Sequelize=require(_0xfe3f('0x1'));module[_0xfe3f('0x2')]={'uniqueid':{'type':Sequelize[_0xfe3f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfe3f('0x4')]},'leaveAt':{'type':Sequelize[_0xfe3f('0x4')]},'acceptAt':{'type':Sequelize[_0xfe3f('0x4')]},'exitAt':{'type':Sequelize[_0xfe3f('0x4')]},'reason':{'type':Sequelize[_0xfe3f('0x3')]}}; \ No newline at end of file +var _0x28e8=['moment','exports','STRING','DATE'];(function(_0x4b738c,_0x3af099){var _0x21494e=function(_0x67ce4a){while(--_0x67ce4a){_0x4b738c['push'](_0x4b738c['shift']());}};_0x21494e(++_0x3af099);}(_0x28e8,0x1e0));var _0x828e=function(_0x13f736,_0x43d73a){_0x13f736=_0x13f736-0x0;var _0x26a9ea=_0x28e8[_0x13f736];return _0x26a9ea;};'use strict';var moment=require(_0x828e('0x0'));var Sequelize=require('sequelize');module[_0x828e('0x1')]={'uniqueid':{'type':Sequelize[_0x828e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x828e('0x2')]},'joinAt':{'type':Sequelize[_0x828e('0x3')]},'leaveAt':{'type':Sequelize[_0x828e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x828e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6d96c65..0454313 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 _0x1a86=['reject','save','update','then','destroy','sendStatus','name','index','map','SmsQueueReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','limit','Content-Range','apply'];(function(_0x40b87d,_0x4d12f1){var _0x452423=function(_0x116b48){while(--_0x116b48){_0x40b87d['push'](_0x40b87d['shift']());}};_0x452423(++_0x4d12f1);}(_0x1a86,0x10c));var _0x61a8=function(_0x1b98c3,_0x1b36a5){_0x1b98c3=_0x1b98c3-0x0;var _0x3ecce6=_0x1a86[_0x1b98c3];return _0x3ecce6;};'use strict';var emlformat=require(_0x61a8('0x0'));var rimraf=require(_0x61a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61a8('0x2'));var rp=require(_0x61a8('0x3'));var moment=require(_0x61a8('0x4'));var BPromise=require(_0x61a8('0x5'));var Mustache=require(_0x61a8('0x6'));var util=require(_0x61a8('0x7'));var path=require(_0x61a8('0x8'));var sox=require(_0x61a8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61a8('0xa'));var _=require(_0x61a8('0xb'));var squel=require(_0x61a8('0xc'));var crypto=require(_0x61a8('0xd'));var jsforce=require(_0x61a8('0xe'));var deskjs=require(_0x61a8('0xf'));var toCsv=require(_0x61a8('0x10'));var querystring=require('querystring');var Papa=require(_0x61a8('0x11'));var Redis=require(_0x61a8('0x12'));var authService=require(_0x61a8('0x13'));var qs=require(_0x61a8('0x14'));var as=require(_0x61a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61a8('0x16'))(_0x61a8('0x17'));var utils=require(_0x61a8('0x18'));var config=require(_0x61a8('0x19'));var licenseUtil=require(_0x61a8('0x1a'));var db=require(_0x61a8('0x1b'))['db'];function respondWithStatusCode(_0x45689f,_0x416110){_0x416110=_0x416110||0xcc;return function(_0x3a4a59){if(_0x3a4a59){return _0x45689f['sendStatus'](_0x416110);}return _0x45689f['status'](_0x416110)[_0x61a8('0x1c')]();};}function respondWithResult(_0x2a9631,_0x4f240f){_0x4f240f=_0x4f240f||0xc8;return function(_0x36367a){if(_0x36367a){return _0x2a9631[_0x61a8('0x1d')](_0x4f240f)[_0x61a8('0x1e')](_0x36367a);}};}function respondWithFilteredResult(_0xdfd88e,_0x22765c){return function(_0x30b90d){if(_0x30b90d){var _0x1a8b2b=typeof _0x22765c['offset']===_0x61a8('0x1f')&&typeof _0x22765c['limit']===_0x61a8('0x1f');var _0x559ea6=_0x30b90d[_0x61a8('0x20')];var _0x28b05b=_0x1a8b2b?0x0:_0x22765c['offset'];var _0x31bd97=_0x1a8b2b?_0x30b90d[_0x61a8('0x20')]:_0x22765c['offset']+_0x22765c[_0x61a8('0x21')];var _0x328f9e;if(_0x31bd97>=_0x559ea6){_0x31bd97=_0x559ea6;_0x328f9e=0xc8;}else{_0x328f9e=0xce;}_0xdfd88e[_0x61a8('0x1d')](_0x328f9e);return _0xdfd88e['set'](_0x61a8('0x22'),_0x28b05b+'-'+_0x31bd97+'/'+_0x559ea6)[_0x61a8('0x1e')](_0x30b90d);}return null;};}function patchUpdates(_0x44edce){return function(_0x2aefd7){try{jsonpatch[_0x61a8('0x23')](_0x2aefd7,_0x44edce,!![]);}catch(_0x281fa7){return BPromise[_0x61a8('0x24')](_0x281fa7);}return _0x2aefd7[_0x61a8('0x25')]();};}function saveUpdates(_0x24f17b,_0xfbfdef){return function(_0x38b4d4){if(_0x38b4d4){return _0x38b4d4[_0x61a8('0x26')](_0x24f17b)[_0x61a8('0x27')](function(_0x4a4be7){return _0x4a4be7;});}return null;};}function removeEntity(_0x5df5f9,_0x2d6495){return function(_0x4e4cad){if(_0x4e4cad){return _0x4e4cad[_0x61a8('0x28')]()[_0x61a8('0x27')](function(){_0x5df5f9[_0x61a8('0x1d')](0xcc)[_0x61a8('0x1c')]();});}};}function handleEntityNotFound(_0x49fe6e,_0x443493){return function(_0x108f51){if(!_0x108f51){_0x49fe6e[_0x61a8('0x29')](0x194);}return _0x108f51;};}function handleError(_0x3f78d0,_0x23f47a){_0x23f47a=_0x23f47a||0x1f4;return function(_0x3ba6b1){logger['error'](_0x3ba6b1['stack']);if(_0x3ba6b1['name']){delete _0x3ba6b1[_0x61a8('0x2a')];}_0x3f78d0['status'](_0x23f47a)['send'](_0x3ba6b1);};}exports[_0x61a8('0x2b')]=function(_0x5eb925,_0x58ac38){var _0xc4be76={},_0x50acdf={},_0x259561={'count':0x0,'rows':[]};var _0x48f90f=_[_0x61a8('0x2c')](db[_0x61a8('0x2d')][_0x61a8('0x2e')],function(_0xa02156){return{'name':_0xa02156['fieldName'],'type':_0xa02156[_0x61a8('0x2f')]['key']};});_0x50acdf[_0x61a8('0x30')]=_[_0x61a8('0x2c')](_0x48f90f,_0x61a8('0x2a'));_0x50acdf[_0x61a8('0x31')]=_[_0x61a8('0x32')](_0x5eb925['query']);_0x50acdf[_0x61a8('0x33')]=_[_0x61a8('0x34')](_0x50acdf['model'],_0x50acdf[_0x61a8('0x31')]);_0xc4be76[_0x61a8('0x35')]=_[_0x61a8('0x34')](_0x50acdf['model'],qs[_0x61a8('0x36')](_0x5eb925[_0x61a8('0x31')][_0x61a8('0x36')]));_0xc4be76[_0x61a8('0x35')]=_0xc4be76[_0x61a8('0x35')][_0x61a8('0x37')]?_0xc4be76[_0x61a8('0x35')]:_0x50acdf[_0x61a8('0x30')];if(!_0x5eb925[_0x61a8('0x31')][_0x61a8('0x38')](_0x61a8('0x39'))){_0xc4be76[_0x61a8('0x21')]=qs['limit'](_0x5eb925[_0x61a8('0x31')]['limit']);_0xc4be76[_0x61a8('0x3a')]=qs[_0x61a8('0x3a')](_0x5eb925[_0x61a8('0x31')]['offset']);}_0xc4be76[_0x61a8('0x3b')]=qs[_0x61a8('0x3c')](_0x5eb925[_0x61a8('0x31')]['sort']);_0xc4be76['where']=qs[_0x61a8('0x33')](_[_0x61a8('0x3d')](_0x5eb925[_0x61a8('0x31')],_0x50acdf[_0x61a8('0x33')]),_0x48f90f);if(_0x5eb925['query']['filter']){_0xc4be76[_0x61a8('0x3e')]=_[_0x61a8('0x3f')](_0xc4be76[_0x61a8('0x3e')],{'$or':_[_0x61a8('0x2c')](_0x48f90f,function(_0x4587f9){if(_0x4587f9[_0x61a8('0x2f')]!=='VIRTUAL'){var _0x380b32={};_0x380b32[_0x4587f9['name']]={'$like':'%'+_0x5eb925[_0x61a8('0x31')][_0x61a8('0x40')]+'%'};return _0x380b32;}})});}_0xc4be76=_[_0x61a8('0x3f')]({},_0xc4be76,_0x5eb925[_0x61a8('0x41')]);var _0x582484={'where':_0xc4be76[_0x61a8('0x3e')]};return db[_0x61a8('0x2d')]['count'](_0x582484)['then'](function(_0x82b7){_0x259561[_0x61a8('0x20')]=_0x82b7;if(_0x5eb925[_0x61a8('0x31')][_0x61a8('0x42')]){_0xc4be76[_0x61a8('0x43')]=[{'all':!![]}];}return db[_0x61a8('0x2d')]['findAll'](_0xc4be76);})['then'](function(_0x4d017d){_0x259561[_0x61a8('0x44')]=_0x4d017d;return _0x259561;})['then'](respondWithFilteredResult(_0x58ac38,_0xc4be76))[_0x61a8('0x45')](handleError(_0x58ac38,null));};exports[_0x61a8('0x46')]=function(_0x2ef705,_0x1f6a49){var _0x54d590={'raw':!![],'where':{'id':_0x2ef705[_0x61a8('0x47')]['id']}},_0xb363ff={};_0xb363ff['model']=_[_0x61a8('0x32')](db[_0x61a8('0x2d')][_0x61a8('0x2e')]);_0xb363ff[_0x61a8('0x31')]=_[_0x61a8('0x32')](_0x2ef705[_0x61a8('0x31')]);_0xb363ff[_0x61a8('0x33')]=_[_0x61a8('0x34')](_0xb363ff[_0x61a8('0x30')],_0xb363ff[_0x61a8('0x31')]);_0x54d590[_0x61a8('0x35')]=_[_0x61a8('0x34')](_0xb363ff['model'],qs[_0x61a8('0x36')](_0x2ef705[_0x61a8('0x31')][_0x61a8('0x36')]));_0x54d590[_0x61a8('0x35')]=_0x54d590[_0x61a8('0x35')][_0x61a8('0x37')]?_0x54d590['attributes']:_0xb363ff[_0x61a8('0x30')];if(_0x2ef705[_0x61a8('0x31')][_0x61a8('0x42')]){_0x54d590[_0x61a8('0x43')]=[{'all':!![]}];}_0x54d590=_['merge']({},_0x54d590,_0x2ef705[_0x61a8('0x41')]);return db[_0x61a8('0x2d')][_0x61a8('0x48')](_0x54d590)[_0x61a8('0x27')](handleEntityNotFound(_0x1f6a49,null))[_0x61a8('0x27')](respondWithResult(_0x1f6a49,null))[_0x61a8('0x45')](handleError(_0x1f6a49,null));};exports[_0x61a8('0x49')]=function(_0x51e93a,_0x164243){return db[_0x61a8('0x2d')][_0x61a8('0x49')](_0x51e93a[_0x61a8('0x4a')],{})[_0x61a8('0x27')](respondWithResult(_0x164243,0xc9))[_0x61a8('0x45')](handleError(_0x164243,null));};exports[_0x61a8('0x26')]=function(_0xe15804,_0xbf3f9a){if(_0xe15804['body']['id']){delete _0xe15804[_0x61a8('0x4a')]['id'];}return db[_0x61a8('0x2d')][_0x61a8('0x48')]({'where':{'id':_0xe15804[_0x61a8('0x47')]['id']}})[_0x61a8('0x27')](handleEntityNotFound(_0xbf3f9a,null))[_0x61a8('0x27')](saveUpdates(_0xe15804[_0x61a8('0x4a')],null))[_0x61a8('0x27')](respondWithResult(_0xbf3f9a,null))[_0x61a8('0x45')](handleError(_0xbf3f9a,null));};exports[_0x61a8('0x28')]=function(_0x3d5f02,_0x19cc25){return db[_0x61a8('0x2d')]['find']({'where':{'id':_0x3d5f02[_0x61a8('0x47')]['id']}})[_0x61a8('0x27')](handleEntityNotFound(_0x19cc25,null))[_0x61a8('0x27')](removeEntity(_0x19cc25,null))['catch'](handleError(_0x19cc25,null));};exports[_0x61a8('0x4b')]=function(_0x29f961,_0x5f0eac){return db[_0x61a8('0x2d')][_0x61a8('0x4b')]()[_0x61a8('0x27')](respondWithResult(_0x5f0eac,null))['catch'](handleError(_0x5f0eac,null));}; \ No newline at end of file +var _0x828d=['rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll'];(function(_0x13b9d0,_0x14c45d){var _0x1e8b94=function(_0x11edd6){while(--_0x11edd6){_0x13b9d0['push'](_0x13b9d0['shift']());}};_0x1e8b94(++_0x14c45d);}(_0x828d,0x12c));var _0xd828=function(_0x1d5e48,_0x51dc5c){_0x1d5e48=_0x1d5e48-0x0;var _0x2c1220=_0x828d[_0x1d5e48];return _0x2c1220;};'use strict';var emlformat=require(_0xd828('0x0'));var rimraf=require(_0xd828('0x1'));var zipdir=require(_0xd828('0x2'));var jsonpatch=require(_0xd828('0x3'));var rp=require(_0xd828('0x4'));var moment=require(_0xd828('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd828('0x6'));var util=require(_0xd828('0x7'));var path=require(_0xd828('0x8'));var sox=require('sox');var csv=require(_0xd828('0x9'));var ejs=require(_0xd828('0xa'));var fs=require('fs');var fs_extra=require(_0xd828('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd828('0xc'));var deskjs=require(_0xd828('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd828('0xe'));var Papa=require(_0xd828('0xf'));var Redis=require(_0xd828('0x10'));var authService=require(_0xd828('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd828('0x12'));var hardwareService=require(_0xd828('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd828('0x14'));var db=require(_0xd828('0x15'))['db'];function respondWithStatusCode(_0x4fe76e,_0x5982c9){_0x5982c9=_0x5982c9||0xcc;return function(_0x568793){if(_0x568793){return _0x4fe76e[_0xd828('0x16')](_0x5982c9);}return _0x4fe76e['status'](_0x5982c9)[_0xd828('0x17')]();};}function respondWithResult(_0x5e9031,_0x13bf21){_0x13bf21=_0x13bf21||0xc8;return function(_0x14a264){if(_0x14a264){return _0x5e9031[_0xd828('0x18')](_0x13bf21)['json'](_0x14a264);}};}function respondWithFilteredResult(_0x522deb,_0x1bca63){return function(_0x40050d){if(_0x40050d){var _0x1a7645=typeof _0x1bca63[_0xd828('0x19')]===_0xd828('0x1a')&&typeof _0x1bca63['limit']===_0xd828('0x1a');var _0x433cd9=_0x40050d[_0xd828('0x1b')];var _0x137a2b=_0x1a7645?0x0:_0x1bca63[_0xd828('0x19')];var _0x59833b=_0x1a7645?_0x40050d[_0xd828('0x1b')]:_0x1bca63[_0xd828('0x19')]+_0x1bca63[_0xd828('0x1c')];var _0x54f468;if(_0x59833b>=_0x433cd9){_0x59833b=_0x433cd9;_0x54f468=0xc8;}else{_0x54f468=0xce;}_0x522deb['status'](_0x54f468);return _0x522deb[_0xd828('0x1d')](_0xd828('0x1e'),_0x137a2b+'-'+_0x59833b+'/'+_0x433cd9)['json'](_0x40050d);}return null;};}function patchUpdates(_0x1a1613){return function(_0x95b61a){try{jsonpatch[_0xd828('0x1f')](_0x95b61a,_0x1a1613,!![]);}catch(_0x1b3098){return BPromise[_0xd828('0x20')](_0x1b3098);}return _0x95b61a['save']();};}function saveUpdates(_0x156e4c,_0x249372){return function(_0x104587){if(_0x104587){return _0x104587[_0xd828('0x21')](_0x156e4c)['then'](function(_0x560b93){return _0x560b93;});}return null;};}function removeEntity(_0xd409b9,_0x41e5fd){return function(_0x154fe8){if(_0x154fe8){return _0x154fe8[_0xd828('0x22')]()[_0xd828('0x23')](function(){_0xd409b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x586102,_0x3a7f2a){return function(_0x20d208){if(!_0x20d208){_0x586102['sendStatus'](0x194);}return _0x20d208;};}function handleError(_0x54d830,_0x2c8f39){_0x2c8f39=_0x2c8f39||0x1f4;return function(_0x2c3882){logger[_0xd828('0x24')](_0x2c3882[_0xd828('0x25')]);if(_0x2c3882[_0xd828('0x26')]){delete _0x2c3882[_0xd828('0x26')];}_0x54d830['status'](_0x2c8f39)['send'](_0x2c3882);};}exports[_0xd828('0x27')]=function(_0x2e160d,_0x4d6958){var _0xf0e7ab={},_0xf456d0={},_0x2aa73a={'count':0x0,'rows':[]};var _0x33720a=_[_0xd828('0x28')](db[_0xd828('0x29')]['rawAttributes'],function(_0x30405a){return{'name':_0x30405a[_0xd828('0x2a')],'type':_0x30405a[_0xd828('0x2b')][_0xd828('0x2c')]};});_0xf456d0[_0xd828('0x2d')]=_[_0xd828('0x28')](_0x33720a,_0xd828('0x26'));_0xf456d0[_0xd828('0x2e')]=_[_0xd828('0x2f')](_0x2e160d[_0xd828('0x2e')]);_0xf456d0['filters']=_[_0xd828('0x30')](_0xf456d0['model'],_0xf456d0[_0xd828('0x2e')]);_0xf0e7ab['attributes']=_['intersection'](_0xf456d0[_0xd828('0x2d')],qs[_0xd828('0x31')](_0x2e160d[_0xd828('0x2e')][_0xd828('0x31')]));_0xf0e7ab[_0xd828('0x32')]=_0xf0e7ab[_0xd828('0x32')][_0xd828('0x33')]?_0xf0e7ab[_0xd828('0x32')]:_0xf456d0['model'];if(!_0x2e160d[_0xd828('0x2e')]['hasOwnProperty'](_0xd828('0x34'))){_0xf0e7ab['limit']=qs[_0xd828('0x1c')](_0x2e160d[_0xd828('0x2e')][_0xd828('0x1c')]);_0xf0e7ab[_0xd828('0x19')]=qs[_0xd828('0x19')](_0x2e160d['query'][_0xd828('0x19')]);}_0xf0e7ab[_0xd828('0x35')]=qs[_0xd828('0x36')](_0x2e160d[_0xd828('0x2e')][_0xd828('0x36')]);_0xf0e7ab[_0xd828('0x37')]=qs[_0xd828('0x38')](_[_0xd828('0x39')](_0x2e160d[_0xd828('0x2e')],_0xf456d0[_0xd828('0x38')]),_0x33720a);if(_0x2e160d[_0xd828('0x2e')]['filter']){_0xf0e7ab['where']=_['merge'](_0xf0e7ab[_0xd828('0x37')],{'$or':_[_0xd828('0x28')](_0x33720a,function(_0x26976d){if(_0x26976d['type']!==_0xd828('0x3a')){var _0x447db9={};_0x447db9[_0x26976d[_0xd828('0x26')]]={'$like':'%'+_0x2e160d[_0xd828('0x2e')][_0xd828('0x3b')]+'%'};return _0x447db9;}})});}_0xf0e7ab=_[_0xd828('0x3c')]({},_0xf0e7ab,_0x2e160d[_0xd828('0x3d')]);var _0x3b0d59={'where':_0xf0e7ab['where']};return db[_0xd828('0x29')][_0xd828('0x1b')](_0x3b0d59)['then'](function(_0x2e5e9d){_0x2aa73a[_0xd828('0x1b')]=_0x2e5e9d;if(_0x2e160d['query'][_0xd828('0x3e')]){_0xf0e7ab[_0xd828('0x3f')]=[{'all':!![]}];}return db[_0xd828('0x29')][_0xd828('0x40')](_0xf0e7ab);})[_0xd828('0x23')](function(_0x17ee21){_0x2aa73a[_0xd828('0x41')]=_0x17ee21;return _0x2aa73a;})[_0xd828('0x23')](respondWithFilteredResult(_0x4d6958,_0xf0e7ab))[_0xd828('0x42')](handleError(_0x4d6958,null));};exports[_0xd828('0x43')]=function(_0x2f23b9,_0x4c23d7){var _0x5b62b5={'raw':!![],'where':{'id':_0x2f23b9[_0xd828('0x44')]['id']}},_0x26651b={};_0x26651b[_0xd828('0x2d')]=_[_0xd828('0x2f')](db[_0xd828('0x29')]['rawAttributes']);_0x26651b[_0xd828('0x2e')]=_[_0xd828('0x2f')](_0x2f23b9[_0xd828('0x2e')]);_0x26651b[_0xd828('0x38')]=_['intersection'](_0x26651b['model'],_0x26651b[_0xd828('0x2e')]);_0x5b62b5[_0xd828('0x32')]=_[_0xd828('0x30')](_0x26651b[_0xd828('0x2d')],qs[_0xd828('0x31')](_0x2f23b9[_0xd828('0x2e')][_0xd828('0x31')]));_0x5b62b5[_0xd828('0x32')]=_0x5b62b5['attributes'][_0xd828('0x33')]?_0x5b62b5[_0xd828('0x32')]:_0x26651b[_0xd828('0x2d')];if(_0x2f23b9[_0xd828('0x2e')]['includeAll']){_0x5b62b5[_0xd828('0x3f')]=[{'all':!![]}];}_0x5b62b5=_[_0xd828('0x3c')]({},_0x5b62b5,_0x2f23b9[_0xd828('0x3d')]);return db[_0xd828('0x29')]['find'](_0x5b62b5)['then'](handleEntityNotFound(_0x4c23d7,null))[_0xd828('0x23')](respondWithResult(_0x4c23d7,null))['catch'](handleError(_0x4c23d7,null));};exports[_0xd828('0x45')]=function(_0x1a1542,_0x50f688){return db['SmsQueueReport'][_0xd828('0x45')](_0x1a1542[_0xd828('0x46')],{})[_0xd828('0x23')](respondWithResult(_0x50f688,0xc9))[_0xd828('0x42')](handleError(_0x50f688,null));};exports[_0xd828('0x21')]=function(_0x24191f,_0x2f7bbd){if(_0x24191f['body']['id']){delete _0x24191f[_0xd828('0x46')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x24191f[_0xd828('0x44')]['id']}})[_0xd828('0x23')](handleEntityNotFound(_0x2f7bbd,null))[_0xd828('0x23')](saveUpdates(_0x24191f[_0xd828('0x46')],null))['then'](respondWithResult(_0x2f7bbd,null))['catch'](handleError(_0x2f7bbd,null));};exports['destroy']=function(_0x2e261c,_0x397985){return db[_0xd828('0x29')][_0xd828('0x47')]({'where':{'id':_0x2e261c[_0xd828('0x44')]['id']}})[_0xd828('0x23')](handleEntityNotFound(_0x397985,null))[_0xd828('0x23')](removeEntity(_0x397985,null))[_0xd828('0x42')](handleError(_0x397985,null));};exports[_0xd828('0x48')]=function(_0x4f3c03,_0x1fe068){return db[_0xd828('0x29')][_0xd828('0x48')]()[_0xd828('0x23')](respondWithResult(_0x1fe068,null))[_0xd828('0x42')](handleError(_0x1fe068,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5d4297c..fef04d0 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15b45b,_0x2541fd){var _0x5ebf27=function(_0x208b04){while(--_0x208b04){_0x15b45b['push'](_0x15b45b['shift']());}};_0x5ebf27(++_0x2541fd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1a3cf8,_0x2c9d0c){var _0x5b0ced=function(_0x846605){while(--_0x846605){_0x1a3cf8['push'](_0x1a3cf8['shift']());}};_0x5b0ced(++_0x2c9d0c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xcb91[_0x1ebce2];return _0x4a330c;};'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 92949f8..a51e39f 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 _0x87da=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SmsQueueReport','body','raw','CreateSmsQueueReport','catch','update','options','where','limit','UpdateSmsQueueReport','lodash','util','bluebird','randomstring'];(function(_0x370270,_0xb580cd){var _0x360f32=function(_0x35f3ce){while(--_0x35f3ce){_0x370270['push'](_0x370270['shift']());}};_0x360f32(++_0xb580cd);}(_0x87da,0x19c));var _0xa87d=function(_0x4742d6,_0x566780){_0x4742d6=_0x4742d6-0x0;var _0x44af91=_0x87da[_0x4742d6];return _0x44af91;};'use strict';var _=require(_0xa87d('0x0'));var util=require(_0xa87d('0x1'));var moment=require('moment');var BPromise=require(_0xa87d('0x2'));var rs=require(_0xa87d('0x3'));var fs=require('fs');var Redis=require(_0xa87d('0x4'));var db=require(_0xa87d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa87d('0x6'))('rpc');var config=require(_0xa87d('0x7'));var jayson=require(_0xa87d('0x8'));var client=jayson[_0xa87d('0x9')][_0xa87d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb5dd,_0x28a98c,_0x4d41b1){return new BPromise(function(_0x9cce17,_0x5ab088){return client[_0xa87d('0xb')](_0x1fb5dd,_0x4d41b1)[_0xa87d('0xc')](function(_0x5d07e2){logger[_0xa87d('0xd')](_0xa87d('0xe'),_0x28a98c,_0xa87d('0xf'));logger[_0xa87d('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x28a98c,_0xa87d('0xf'),JSON[_0xa87d('0x11')](_0x5d07e2));if(_0x5d07e2[_0xa87d('0x12')]){if(_0x5d07e2[_0xa87d('0x12')][_0xa87d('0x13')]===0x1f4){logger[_0xa87d('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x28a98c,_0x5d07e2[_0xa87d('0x12')][_0xa87d('0x14')]);return _0x5ab088(_0x5d07e2[_0xa87d('0x12')]['message']);}logger[_0xa87d('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x28a98c,_0x5d07e2[_0xa87d('0x12')][_0xa87d('0x14')]);return _0x9cce17(_0x5d07e2[_0xa87d('0x12')][_0xa87d('0x14')]);}else{logger['info'](_0xa87d('0xe'),_0x28a98c,_0xa87d('0xf'));_0x9cce17(_0x5d07e2[_0xa87d('0x15')][_0xa87d('0x14')]);}})['catch'](function(_0x375f27){logger['error'](_0xa87d('0xe'),_0x28a98c,_0x375f27);_0x5ab088(_0x375f27);});});}exports['CreateSmsQueueReport']=function(_0x4a3f80){var _0x2c55e7=this;return new Promise(function(_0x4d958e,_0x343368){return db[_0xa87d('0x16')]['create'](_0x4a3f80[_0xa87d('0x17')],{'raw':_0x4a3f80['options']?_0x4a3f80['options'][_0xa87d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x848459){logger[_0xa87d('0xd')](_0xa87d('0x19'),_0x4a3f80);logger[_0xa87d('0x10')](_0xa87d('0x19'),_0x4a3f80,JSON[_0xa87d('0x11')](_0x848459));_0x4d958e(_0x848459);})[_0xa87d('0x1a')](function(_0x12d91f){logger['error'](_0xa87d('0x19'),_0x12d91f[_0xa87d('0x14')],_0x4a3f80);_0x343368(_0x2c55e7[_0xa87d('0x12')](0x1f4,_0x12d91f[_0xa87d('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x391b3f){var _0x2c92a9=this;return new Promise(function(_0x23ee44,_0x21711c){return db[_0xa87d('0x16')][_0xa87d('0x1b')](_0x391b3f[_0xa87d('0x17')],{'raw':_0x391b3f[_0xa87d('0x1c')]?_0x391b3f[_0xa87d('0x1c')][_0xa87d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x391b3f[_0xa87d('0x1c')]?_0x391b3f[_0xa87d('0x1c')][_0xa87d('0x1d')]||null:null,'attributes':_0x391b3f[_0xa87d('0x1c')]?_0x391b3f['options']['attributes']||null:null,'limit':_0x391b3f[_0xa87d('0x1c')]?_0x391b3f[_0xa87d('0x1c')][_0xa87d('0x1e')]||null:null})[_0xa87d('0xc')](function(_0x291f65){logger[_0xa87d('0xd')](_0xa87d('0x1f'),_0x391b3f);logger[_0xa87d('0x10')](_0xa87d('0x1f'),_0x391b3f,JSON[_0xa87d('0x11')](_0x291f65));_0x23ee44(_0x291f65);})[_0xa87d('0x1a')](function(_0x534065){logger[_0xa87d('0x12')](_0xa87d('0x1f'),_0x534065[_0xa87d('0x14')],_0x391b3f);_0x21711c(_0x2c92a9[_0xa87d('0x12')](0x1f4,_0x534065['message']));});});}; \ No newline at end of file +var _0xb060=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','stringify','UpdateSmsQueueReport','update','where','limit','lodash','util'];(function(_0x3e8de2,_0x468431){var _0x56b736=function(_0x32da9b){while(--_0x32da9b){_0x3e8de2['push'](_0x3e8de2['shift']());}};_0x56b736(++_0x468431);}(_0xb060,0x106));var _0x0b06=function(_0x463c2c,_0x8bfa85){_0x463c2c=_0x463c2c-0x0;var _0x233868=_0xb060[_0x463c2c];return _0x233868;};'use strict';var _=require(_0x0b06('0x0'));var util=require(_0x0b06('0x1'));var moment=require(_0x0b06('0x2'));var BPromise=require(_0x0b06('0x3'));var rs=require(_0x0b06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b06('0x5'))['db'];var utils=require(_0x0b06('0x6'));var logger=require(_0x0b06('0x7'))(_0x0b06('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b06('0x9')][_0x0b06('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54b858,_0x35a1b9,_0x222537){return new BPromise(function(_0x4e4df0,_0x3d92fb){return client[_0x0b06('0xb')](_0x54b858,_0x222537)[_0x0b06('0xc')](function(_0x42a501){logger[_0x0b06('0xd')](_0x0b06('0xe'),_0x35a1b9,_0x0b06('0xf'));logger[_0x0b06('0x10')](_0x0b06('0x11'),_0x35a1b9,_0x0b06('0xf'),JSON['stringify'](_0x42a501));if(_0x42a501[_0x0b06('0x12')]){if(_0x42a501[_0x0b06('0x12')]['code']===0x1f4){logger[_0x0b06('0x12')](_0x0b06('0xe'),_0x35a1b9,_0x42a501[_0x0b06('0x12')][_0x0b06('0x13')]);return _0x3d92fb(_0x42a501['error'][_0x0b06('0x13')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x35a1b9,_0x42a501[_0x0b06('0x12')][_0x0b06('0x13')]);return _0x4e4df0(_0x42a501[_0x0b06('0x12')][_0x0b06('0x13')]);}else{logger['info'](_0x0b06('0xe'),_0x35a1b9,_0x0b06('0xf'));_0x4e4df0(_0x42a501[_0x0b06('0x14')][_0x0b06('0x13')]);}})[_0x0b06('0x15')](function(_0x3182cc){logger[_0x0b06('0x12')](_0x0b06('0xe'),_0x35a1b9,_0x3182cc);_0x3d92fb(_0x3182cc);});});}exports[_0x0b06('0x16')]=function(_0x5d7442){var _0x6c8925=this;return new Promise(function(_0x14ac4c,_0x490e22){return db[_0x0b06('0x17')][_0x0b06('0x18')](_0x5d7442[_0x0b06('0x19')],{'raw':_0x5d7442[_0x0b06('0x1a')]?_0x5d7442[_0x0b06('0x1a')][_0x0b06('0x1b')]===undefined?!![]:![]:!![]})[_0x0b06('0xc')](function(_0x3502f4){logger[_0x0b06('0xd')]('CreateSmsQueueReport',_0x5d7442);logger[_0x0b06('0x10')](_0x0b06('0x16'),_0x5d7442,JSON[_0x0b06('0x1c')](_0x3502f4));_0x14ac4c(_0x3502f4);})[_0x0b06('0x15')](function(_0x2bf804){logger[_0x0b06('0x12')](_0x0b06('0x16'),_0x2bf804[_0x0b06('0x13')],_0x5d7442);_0x490e22(_0x6c8925['error'](0x1f4,_0x2bf804[_0x0b06('0x13')]));});});};exports[_0x0b06('0x1d')]=function(_0x3c5d16){var _0x549af7=this;return new Promise(function(_0x3e2686,_0x1b2c26){return db[_0x0b06('0x17')][_0x0b06('0x1e')](_0x3c5d16[_0x0b06('0x19')],{'raw':_0x3c5d16[_0x0b06('0x1a')]?_0x3c5d16[_0x0b06('0x1a')][_0x0b06('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c5d16[_0x0b06('0x1a')]?_0x3c5d16[_0x0b06('0x1a')][_0x0b06('0x1f')]||null:null,'attributes':_0x3c5d16[_0x0b06('0x1a')]?_0x3c5d16[_0x0b06('0x1a')]['attributes']||null:null,'limit':_0x3c5d16[_0x0b06('0x1a')]?_0x3c5d16[_0x0b06('0x1a')][_0x0b06('0x20')]||null:null})[_0x0b06('0xc')](function(_0x38103c){logger['info'](_0x0b06('0x1d'),_0x3c5d16);logger[_0x0b06('0x10')](_0x0b06('0x1d'),_0x3c5d16,JSON[_0x0b06('0x1c')](_0x38103c));_0x3e2686(_0x38103c);})['catch'](function(_0x1ee111){logger['error'](_0x0b06('0x1d'),_0x1ee111[_0x0b06('0x13')],_0x3c5d16);_0x1b2c26(_0x549af7['error'](0x1f4,_0x1ee111[_0x0b06('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6bc4761..635296f 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 _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x521e31,_0x2b6a40){var _0x5c465c=function(_0x5ef927){while(--_0x5ef927){_0x521e31['push'](_0x521e31['shift']());}};_0x5c465c(++_0x2b6a40);}(_0x5636,0x102));var _0x6563=function(_0x5d094a,_0x5ad7f5){_0x5d094a=_0x5d094a-0x0;var _0x5ae9cf=_0x5636[_0x5d094a];return _0x5ae9cf;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file +var _0xbacd=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xbacd,0x1c5));var _0xdbac=function(_0x21bb63,_0x2019b0){_0x21bb63=_0x21bb63-0x0;var _0x2f5b84=_0xbacd[_0x21bb63];return _0x2f5b84;};'use strict';var multer=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var path=require('path');var timeout=require(_0xdbac('0x2'));var express=require(_0xdbac('0x3'));var router=express[_0xdbac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbac('0x5'));var interaction=require(_0xdbac('0x6'));var config=require(_0xdbac('0x7'));var controller=require(_0xdbac('0x8'));router[_0xdbac('0x9')]('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0xb')]);router[_0xdbac('0x9')](_0xdbac('0xc'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xd')]);router[_0xdbac('0x9')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0xf')]);router['post']('/',auth[_0xdbac('0xa')](),controller[_0xdbac('0x10')]);router['put'](_0xdbac('0xe'),auth['isAuthenticated'](),controller[_0xdbac('0x11')]);router[_0xdbac('0x12')](_0xdbac('0xe'),auth[_0xdbac('0xa')](),controller[_0xdbac('0x13')]);module[_0xdbac('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 e944db6..63b6795 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x599648,_0x47dd38){var _0x5cb893=function(_0x5e107d){while(--_0x5e107d){_0x599648['push'](_0x599648['shift']());}};_0x5cb893(++_0x47dd38);}(_0x008c,0x188));var _0xc008=function(_0x4e0d05,_0x1252ef){_0x4e0d05=_0x4e0d05-0x0;var _0x568b50=_0x008c[_0x4e0d05];return _0x568b50;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x222f60,_0x12231b){var _0x503aad=function(_0x56d4a9){while(--_0x56d4a9){_0x222f60['push'](_0x222f60['shift']());}};_0x503aad(++_0x12231b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x4b84[_0x4fd109];return _0x30f0a6;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index da1d86e..dc2f8ba 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 _0xbcb6=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','includeAll','findAll','catch','show','include','options','find','create','body','params','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5402d3,_0x1e0567){var _0x14a7bd=function(_0x2ee8dd){while(--_0x2ee8dd){_0x5402d3['push'](_0x5402d3['shift']());}};_0x14a7bd(++_0x1e0567);}(_0xbcb6,0x15f));var _0x6bcb=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0xbcb6[_0x134448];return _0x2d52a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6bcb('0x0'));var jsonpatch=require(_0x6bcb('0x1'));var rp=require('request-promise');var moment=require(_0x6bcb('0x2'));var BPromise=require(_0x6bcb('0x3'));var Mustache=require(_0x6bcb('0x4'));var util=require(_0x6bcb('0x5'));var path=require(_0x6bcb('0x6'));var sox=require(_0x6bcb('0x7'));var csv=require(_0x6bcb('0x8'));var ejs=require(_0x6bcb('0x9'));var fs=require('fs');var fs_extra=require(_0x6bcb('0xa'));var _=require('lodash');var squel=require(_0x6bcb('0xb'));var crypto=require('crypto');var jsforce=require(_0x6bcb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6bcb('0x8'));var querystring=require(_0x6bcb('0xd'));var Papa=require(_0x6bcb('0xe'));var Redis=require(_0x6bcb('0xf'));var authService=require(_0x6bcb('0x10'));var qs=require(_0x6bcb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bcb('0x12'));var logger=require(_0x6bcb('0x13'))(_0x6bcb('0x14'));var utils=require('../../config/utils');var config=require(_0x6bcb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bcb('0x16'))['db'];function respondWithStatusCode(_0x41ac96,_0x1e6255){_0x1e6255=_0x1e6255||0xcc;return function(_0x1d5682){if(_0x1d5682){return _0x41ac96[_0x6bcb('0x17')](_0x1e6255);}return _0x41ac96[_0x6bcb('0x18')](_0x1e6255)[_0x6bcb('0x19')]();};}function respondWithResult(_0xbf6582,_0x200ba1){_0x200ba1=_0x200ba1||0xc8;return function(_0x3db14f){if(_0x3db14f){return _0xbf6582[_0x6bcb('0x18')](_0x200ba1)[_0x6bcb('0x1a')](_0x3db14f);}};}function respondWithFilteredResult(_0xd2acec,_0x1e0e4c){return function(_0x5993d4){if(_0x5993d4){var _0x52402b=typeof _0x1e0e4c['offset']===_0x6bcb('0x1b')&&typeof _0x1e0e4c[_0x6bcb('0x1c')]==='undefined';var _0x1d678a=_0x5993d4[_0x6bcb('0x1d')];var _0x171aed=_0x52402b?0x0:_0x1e0e4c['offset'];var _0x37f387=_0x52402b?_0x5993d4[_0x6bcb('0x1d')]:_0x1e0e4c[_0x6bcb('0x1e')]+_0x1e0e4c[_0x6bcb('0x1c')];var _0x5f0748;if(_0x37f387>=_0x1d678a){_0x37f387=_0x1d678a;_0x5f0748=0xc8;}else{_0x5f0748=0xce;}_0xd2acec[_0x6bcb('0x18')](_0x5f0748);return _0xd2acec[_0x6bcb('0x1f')](_0x6bcb('0x20'),_0x171aed+'-'+_0x37f387+'/'+_0x1d678a)[_0x6bcb('0x1a')](_0x5993d4);}return null;};}function patchUpdates(_0x10c84c){return function(_0x1c6930){try{jsonpatch[_0x6bcb('0x21')](_0x1c6930,_0x10c84c,!![]);}catch(_0x5bbcff){return BPromise[_0x6bcb('0x22')](_0x5bbcff);}return _0x1c6930[_0x6bcb('0x23')]();};}function saveUpdates(_0x5e7dc9,_0x1f0901){return function(_0xc4c458){if(_0xc4c458){return _0xc4c458[_0x6bcb('0x24')](_0x5e7dc9)[_0x6bcb('0x25')](function(_0x48870c){return _0x48870c;});}return null;};}function removeEntity(_0xbcc39b,_0x287580){return function(_0x15793b){if(_0x15793b){return _0x15793b[_0x6bcb('0x26')]()['then'](function(){_0xbcc39b[_0x6bcb('0x18')](0xcc)[_0x6bcb('0x19')]();});}};}function handleEntityNotFound(_0x19453d,_0x11f343){return function(_0x465c69){if(!_0x465c69){_0x19453d[_0x6bcb('0x17')](0x194);}return _0x465c69;};}function handleError(_0x17bde8,_0x8be859){_0x8be859=_0x8be859||0x1f4;return function(_0xb33fed){logger[_0x6bcb('0x27')](_0xb33fed['stack']);if(_0xb33fed[_0x6bcb('0x28')]){delete _0xb33fed[_0x6bcb('0x28')];}_0x17bde8[_0x6bcb('0x18')](_0x8be859)['send'](_0xb33fed);};}exports[_0x6bcb('0x29')]=function(_0x5598a2,_0x2ebc94){var _0x5de8c3={},_0x226c89={},_0x14b5d0={'count':0x0,'rows':[]};var _0x8cf861=_[_0x6bcb('0x2a')](db[_0x6bcb('0x2b')][_0x6bcb('0x2c')],function(_0x2c3677){return{'name':_0x2c3677[_0x6bcb('0x2d')],'type':_0x2c3677['type'][_0x6bcb('0x2e')]};});_0x226c89[_0x6bcb('0x2f')]=_['map'](_0x8cf861,_0x6bcb('0x28'));_0x226c89[_0x6bcb('0x30')]=_[_0x6bcb('0x31')](_0x5598a2[_0x6bcb('0x30')]);_0x226c89['filters']=_[_0x6bcb('0x32')](_0x226c89[_0x6bcb('0x2f')],_0x226c89[_0x6bcb('0x30')]);_0x5de8c3['attributes']=_['intersection'](_0x226c89[_0x6bcb('0x2f')],qs[_0x6bcb('0x33')](_0x5598a2[_0x6bcb('0x30')][_0x6bcb('0x33')]));_0x5de8c3[_0x6bcb('0x34')]=_0x5de8c3[_0x6bcb('0x34')][_0x6bcb('0x35')]?_0x5de8c3['attributes']:_0x226c89[_0x6bcb('0x2f')];if(!_0x5598a2[_0x6bcb('0x30')][_0x6bcb('0x36')](_0x6bcb('0x37'))){_0x5de8c3[_0x6bcb('0x1c')]=qs[_0x6bcb('0x1c')](_0x5598a2[_0x6bcb('0x30')]['limit']);_0x5de8c3['offset']=qs[_0x6bcb('0x1e')](_0x5598a2[_0x6bcb('0x30')]['offset']);}_0x5de8c3[_0x6bcb('0x38')]=qs['sort'](_0x5598a2[_0x6bcb('0x30')][_0x6bcb('0x39')]);_0x5de8c3[_0x6bcb('0x3a')]=qs[_0x6bcb('0x3b')](_[_0x6bcb('0x3c')](_0x5598a2[_0x6bcb('0x30')],_0x226c89['filters']),_0x8cf861);if(_0x5598a2[_0x6bcb('0x30')]['filter']){_0x5de8c3[_0x6bcb('0x3a')]=_['merge'](_0x5de8c3[_0x6bcb('0x3a')],{'$or':_[_0x6bcb('0x2a')](_0x8cf861,function(_0x3e94e5){if(_0x3e94e5[_0x6bcb('0x3d')]!==_0x6bcb('0x3e')){var _0xdc2782={};_0xdc2782[_0x3e94e5['name']]={'$like':'%'+_0x5598a2[_0x6bcb('0x30')][_0x6bcb('0x3f')]+'%'};return _0xdc2782;}})});}_0x5de8c3=_['merge']({},_0x5de8c3,_0x5598a2['options']);var _0x25b170={'where':_0x5de8c3[_0x6bcb('0x3a')]};return db[_0x6bcb('0x2b')]['count'](_0x25b170)['then'](function(_0x58a4af){_0x14b5d0['count']=_0x58a4af;if(_0x5598a2[_0x6bcb('0x30')][_0x6bcb('0x40')]){_0x5de8c3['include']=[{'all':!![]}];}return db[_0x6bcb('0x2b')][_0x6bcb('0x41')](_0x5de8c3);})['then'](function(_0x18b99d){_0x14b5d0['rows']=_0x18b99d;return _0x14b5d0;})[_0x6bcb('0x25')](respondWithFilteredResult(_0x2ebc94,_0x5de8c3))[_0x6bcb('0x42')](handleError(_0x2ebc94,null));};exports[_0x6bcb('0x43')]=function(_0x259d2d,_0x5ef120){var _0x24e798={'raw':!![],'where':{'id':_0x259d2d['params']['id']}},_0x1f331f={};_0x1f331f['model']=_['keys'](db['SmsTransferReport'][_0x6bcb('0x2c')]);_0x1f331f[_0x6bcb('0x30')]=_[_0x6bcb('0x31')](_0x259d2d['query']);_0x1f331f[_0x6bcb('0x3b')]=_[_0x6bcb('0x32')](_0x1f331f['model'],_0x1f331f[_0x6bcb('0x30')]);_0x24e798[_0x6bcb('0x34')]=_[_0x6bcb('0x32')](_0x1f331f[_0x6bcb('0x2f')],qs['fields'](_0x259d2d[_0x6bcb('0x30')][_0x6bcb('0x33')]));_0x24e798[_0x6bcb('0x34')]=_0x24e798[_0x6bcb('0x34')][_0x6bcb('0x35')]?_0x24e798[_0x6bcb('0x34')]:_0x1f331f[_0x6bcb('0x2f')];if(_0x259d2d[_0x6bcb('0x30')][_0x6bcb('0x40')]){_0x24e798[_0x6bcb('0x44')]=[{'all':!![]}];}_0x24e798=_['merge']({},_0x24e798,_0x259d2d[_0x6bcb('0x45')]);return db['SmsTransferReport'][_0x6bcb('0x46')](_0x24e798)[_0x6bcb('0x25')](handleEntityNotFound(_0x5ef120,null))['then'](respondWithResult(_0x5ef120,null))[_0x6bcb('0x42')](handleError(_0x5ef120,null));};exports[_0x6bcb('0x47')]=function(_0xa8a36d,_0x4975ca){return db[_0x6bcb('0x2b')][_0x6bcb('0x47')](_0xa8a36d[_0x6bcb('0x48')],{})[_0x6bcb('0x25')](respondWithResult(_0x4975ca,0xc9))[_0x6bcb('0x42')](handleError(_0x4975ca,null));};exports[_0x6bcb('0x24')]=function(_0x25b5b7,_0x4cdb27){if(_0x25b5b7[_0x6bcb('0x48')]['id']){delete _0x25b5b7[_0x6bcb('0x48')]['id'];}return db[_0x6bcb('0x2b')][_0x6bcb('0x46')]({'where':{'id':_0x25b5b7['params']['id']}})['then'](handleEntityNotFound(_0x4cdb27,null))['then'](saveUpdates(_0x25b5b7[_0x6bcb('0x48')],null))[_0x6bcb('0x25')](respondWithResult(_0x4cdb27,null))['catch'](handleError(_0x4cdb27,null));};exports[_0x6bcb('0x26')]=function(_0x4e6b39,_0x2cb7da){return db[_0x6bcb('0x2b')][_0x6bcb('0x46')]({'where':{'id':_0x4e6b39[_0x6bcb('0x49')]['id']}})[_0x6bcb('0x25')](handleEntityNotFound(_0x2cb7da,null))[_0x6bcb('0x25')](removeEntity(_0x2cb7da,null))[_0x6bcb('0x42')](handleError(_0x2cb7da,null));};exports[_0x6bcb('0x4a')]=function(_0x472c4e,_0x3aa516){return db[_0x6bcb('0x2b')]['describe']()[_0x6bcb('0x25')](respondWithResult(_0x3aa516,null))[_0x6bcb('0x42')](handleError(_0x3aa516,null));}; \ No newline at end of file +var _0x048d=['key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','merge','where','options','include','SmsTransferReport','findAll','rows','params','rawAttributes','includeAll','find','create','body','catch','update','describe','fast-json-patch','request-promise','moment','bluebird','util','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/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type'];(function(_0x39bf09,_0x49f18e){var _0x3a9f80=function(_0x421e1f){while(--_0x421e1f){_0x39bf09['push'](_0x39bf09['shift']());}};_0x3a9f80(++_0x49f18e);}(_0x048d,0xae));var _0xd048=function(_0x1a420f,_0x1652f9){_0x1a420f=_0x1a420f-0x0;var _0x22805c=_0x048d[_0x1a420f];return _0x22805c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd048('0x0'));var rp=require(_0xd048('0x1'));var moment=require(_0xd048('0x2'));var BPromise=require(_0xd048('0x3'));var Mustache=require('mustache');var util=require(_0xd048('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd048('0x5'));var ejs=require(_0xd048('0x6'));var fs=require('fs');var fs_extra=require(_0xd048('0x7'));var _=require(_0xd048('0x8'));var squel=require(_0xd048('0x9'));var crypto=require('crypto');var jsforce=require(_0xd048('0xa'));var deskjs=require(_0xd048('0xb'));var toCsv=require(_0xd048('0x5'));var querystring=require(_0xd048('0xc'));var Papa=require(_0xd048('0xd'));var Redis=require(_0xd048('0xe'));var authService=require(_0xd048('0xf'));var qs=require(_0xd048('0x10'));var as=require(_0xd048('0x11'));var hardwareService=require(_0xd048('0x12'));var logger=require('../../config/logger')(_0xd048('0x13'));var utils=require(_0xd048('0x14'));var config=require(_0xd048('0x15'));var licenseUtil=require(_0xd048('0x16'));var db=require(_0xd048('0x17'))['db'];function respondWithStatusCode(_0x5eed00,_0x1d5976){_0x1d5976=_0x1d5976||0xcc;return function(_0x98becf){if(_0x98becf){return _0x5eed00['sendStatus'](_0x1d5976);}return _0x5eed00[_0xd048('0x18')](_0x1d5976)['end']();};}function respondWithResult(_0x3d40d0,_0x9b6750){_0x9b6750=_0x9b6750||0xc8;return function(_0x473c31){if(_0x473c31){return _0x3d40d0[_0xd048('0x18')](_0x9b6750)[_0xd048('0x19')](_0x473c31);}};}function respondWithFilteredResult(_0x10a61d,_0x343820){return function(_0x1f8118){if(_0x1f8118){var _0x51a442=typeof _0x343820[_0xd048('0x1a')]===_0xd048('0x1b')&&typeof _0x343820[_0xd048('0x1c')]==='undefined';var _0x492300=_0x1f8118[_0xd048('0x1d')];var _0x18d155=_0x51a442?0x0:_0x343820[_0xd048('0x1a')];var _0x4ad244=_0x51a442?_0x1f8118[_0xd048('0x1d')]:_0x343820[_0xd048('0x1a')]+_0x343820[_0xd048('0x1c')];var _0x38ed50;if(_0x4ad244>=_0x492300){_0x4ad244=_0x492300;_0x38ed50=0xc8;}else{_0x38ed50=0xce;}_0x10a61d[_0xd048('0x18')](_0x38ed50);return _0x10a61d[_0xd048('0x1e')](_0xd048('0x1f'),_0x18d155+'-'+_0x4ad244+'/'+_0x492300)[_0xd048('0x19')](_0x1f8118);}return null;};}function patchUpdates(_0x5a0f30){return function(_0x4760c5){try{jsonpatch['apply'](_0x4760c5,_0x5a0f30,!![]);}catch(_0x374820){return BPromise[_0xd048('0x20')](_0x374820);}return _0x4760c5[_0xd048('0x21')]();};}function saveUpdates(_0x4ab482,_0x55931d){return function(_0x20bdfd){if(_0x20bdfd){return _0x20bdfd['update'](_0x4ab482)[_0xd048('0x22')](function(_0xeab302){return _0xeab302;});}return null;};}function removeEntity(_0x178033,_0x2f3a93){return function(_0x36ada9){if(_0x36ada9){return _0x36ada9[_0xd048('0x23')]()[_0xd048('0x22')](function(){_0x178033[_0xd048('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5824fb,_0x2a690e){return function(_0x15b3fb){if(!_0x15b3fb){_0x5824fb[_0xd048('0x24')](0x194);}return _0x15b3fb;};}function handleError(_0x123586,_0x262f7a){_0x262f7a=_0x262f7a||0x1f4;return function(_0x218415){logger[_0xd048('0x25')](_0x218415[_0xd048('0x26')]);if(_0x218415[_0xd048('0x27')]){delete _0x218415[_0xd048('0x27')];}_0x123586['status'](_0x262f7a)[_0xd048('0x28')](_0x218415);};}exports[_0xd048('0x29')]=function(_0x3041e2,_0x5cc8c1){var _0x4e5bda={},_0x385a={},_0x1dd5c3={'count':0x0,'rows':[]};var _0x1353cb=_[_0xd048('0x2a')](db['SmsTransferReport']['rawAttributes'],function(_0x45cf84){return{'name':_0x45cf84[_0xd048('0x2b')],'type':_0x45cf84[_0xd048('0x2c')][_0xd048('0x2d')]};});_0x385a[_0xd048('0x2e')]=_[_0xd048('0x2a')](_0x1353cb,_0xd048('0x27'));_0x385a['query']=_['keys'](_0x3041e2[_0xd048('0x2f')]);_0x385a[_0xd048('0x30')]=_['intersection'](_0x385a[_0xd048('0x2e')],_0x385a[_0xd048('0x2f')]);_0x4e5bda[_0xd048('0x31')]=_[_0xd048('0x32')](_0x385a['model'],qs[_0xd048('0x33')](_0x3041e2['query'][_0xd048('0x33')]));_0x4e5bda['attributes']=_0x4e5bda['attributes'][_0xd048('0x34')]?_0x4e5bda[_0xd048('0x31')]:_0x385a[_0xd048('0x2e')];if(!_0x3041e2['query']['hasOwnProperty'](_0xd048('0x35'))){_0x4e5bda[_0xd048('0x1c')]=qs['limit'](_0x3041e2['query'][_0xd048('0x1c')]);_0x4e5bda[_0xd048('0x1a')]=qs['offset'](_0x3041e2['query'][_0xd048('0x1a')]);}_0x4e5bda[_0xd048('0x36')]=qs[_0xd048('0x37')](_0x3041e2[_0xd048('0x2f')][_0xd048('0x37')]);_0x4e5bda['where']=qs[_0xd048('0x30')](_['pick'](_0x3041e2[_0xd048('0x2f')],_0x385a[_0xd048('0x30')]),_0x1353cb);if(_0x3041e2[_0xd048('0x2f')][_0xd048('0x38')]){_0x4e5bda['where']=_[_0xd048('0x39')](_0x4e5bda[_0xd048('0x3a')],{'$or':_[_0xd048('0x2a')](_0x1353cb,function(_0x11af32){if(_0x11af32['type']!=='VIRTUAL'){var _0x1de595={};_0x1de595[_0x11af32[_0xd048('0x27')]]={'$like':'%'+_0x3041e2[_0xd048('0x2f')][_0xd048('0x38')]+'%'};return _0x1de595;}})});}_0x4e5bda=_[_0xd048('0x39')]({},_0x4e5bda,_0x3041e2[_0xd048('0x3b')]);var _0x570ea4={'where':_0x4e5bda[_0xd048('0x3a')]};return db['SmsTransferReport'][_0xd048('0x1d')](_0x570ea4)[_0xd048('0x22')](function(_0x2aad97){_0x1dd5c3[_0xd048('0x1d')]=_0x2aad97;if(_0x3041e2[_0xd048('0x2f')]['includeAll']){_0x4e5bda[_0xd048('0x3c')]=[{'all':!![]}];}return db[_0xd048('0x3d')][_0xd048('0x3e')](_0x4e5bda);})[_0xd048('0x22')](function(_0x2ef598){_0x1dd5c3[_0xd048('0x3f')]=_0x2ef598;return _0x1dd5c3;})[_0xd048('0x22')](respondWithFilteredResult(_0x5cc8c1,_0x4e5bda))['catch'](handleError(_0x5cc8c1,null));};exports['show']=function(_0x80ebf4,_0x3d7492){var _0x514118={'raw':!![],'where':{'id':_0x80ebf4[_0xd048('0x40')]['id']}},_0x213b18={};_0x213b18[_0xd048('0x2e')]=_['keys'](db[_0xd048('0x3d')][_0xd048('0x41')]);_0x213b18['query']=_['keys'](_0x80ebf4['query']);_0x213b18[_0xd048('0x30')]=_[_0xd048('0x32')](_0x213b18['model'],_0x213b18['query']);_0x514118[_0xd048('0x31')]=_['intersection'](_0x213b18['model'],qs[_0xd048('0x33')](_0x80ebf4['query'][_0xd048('0x33')]));_0x514118[_0xd048('0x31')]=_0x514118[_0xd048('0x31')][_0xd048('0x34')]?_0x514118[_0xd048('0x31')]:_0x213b18[_0xd048('0x2e')];if(_0x80ebf4[_0xd048('0x2f')][_0xd048('0x42')]){_0x514118['include']=[{'all':!![]}];}_0x514118=_[_0xd048('0x39')]({},_0x514118,_0x80ebf4[_0xd048('0x3b')]);return db[_0xd048('0x3d')][_0xd048('0x43')](_0x514118)[_0xd048('0x22')](handleEntityNotFound(_0x3d7492,null))['then'](respondWithResult(_0x3d7492,null))['catch'](handleError(_0x3d7492,null));};exports['create']=function(_0x479740,_0x68dce2){return db[_0xd048('0x3d')][_0xd048('0x44')](_0x479740[_0xd048('0x45')],{})[_0xd048('0x22')](respondWithResult(_0x68dce2,0xc9))[_0xd048('0x46')](handleError(_0x68dce2,null));};exports[_0xd048('0x47')]=function(_0xe78571,_0x902e1a){if(_0xe78571['body']['id']){delete _0xe78571[_0xd048('0x45')]['id'];}return db['SmsTransferReport'][_0xd048('0x43')]({'where':{'id':_0xe78571[_0xd048('0x40')]['id']}})[_0xd048('0x22')](handleEntityNotFound(_0x902e1a,null))[_0xd048('0x22')](saveUpdates(_0xe78571[_0xd048('0x45')],null))['then'](respondWithResult(_0x902e1a,null))[_0xd048('0x46')](handleError(_0x902e1a,null));};exports[_0xd048('0x23')]=function(_0x42b6b3,_0x471926){return db[_0xd048('0x3d')][_0xd048('0x43')]({'where':{'id':_0x42b6b3['params']['id']}})[_0xd048('0x22')](handleEntityNotFound(_0x471926,null))[_0xd048('0x22')](removeEntity(_0x471926,null))[_0xd048('0x46')](handleError(_0x471926,null));};exports[_0xd048('0x48')]=function(_0x2d5c63,_0x442d9a){return db[_0xd048('0x3d')][_0xd048('0x48')]()[_0xd048('0x22')](respondWithResult(_0x442d9a,null))[_0xd048('0x46')](handleError(_0x442d9a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d2dee41..e2e5bad 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3685=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x517894,_0x54625a){var _0x2e9d40=function(_0x359dce){while(--_0x359dce){_0x517894['push'](_0x517894['shift']());}};_0x2e9d40(++_0x54625a);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5368('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45d1=['define','SmsTransferReport','report_sms_transfer','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x2952ff,_0x511ee0){var _0x422502=function(_0x9c878c){while(--_0x9c878c){_0x2952ff['push'](_0x2952ff['shift']());}};_0x422502(++_0x511ee0);}(_0x45d1,0x1cb));var _0x145d=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x45d1[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var logger=require('../../config/logger')(_0x145d('0x2'));var moment=require(_0x145d('0x3'));var BPromise=require('bluebird');var rp=require(_0x145d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x145d('0x5'));var config=require(_0x145d('0x6'));var attributes=require(_0x145d('0x7'));module[_0x145d('0x8')]=function(_0x14ddd8,_0x2896c3){return _0x14ddd8[_0x145d('0x9')](_0x145d('0xa'),attributes,{'tableName':_0x145d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 78f6531..fb4eaa1 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 _0xecd5=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0xaac1d,_0x1dbac9){var _0xa13da3=function(_0x3c9612){while(--_0x3c9612){_0xaac1d['push'](_0xaac1d['shift']());}};_0xa13da3(++_0x1dbac9);}(_0xecd5,0x110));var _0x5ecd=function(_0x4d0ec0,_0x1739a3){_0x4d0ec0=_0x4d0ec0-0x0;var _0x19503b=_0xecd5[_0x4d0ec0];return _0x19503b;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var moment=require(_0x5ecd('0x1'));var BPromise=require(_0x5ecd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ecd('0x3'));var db=require(_0x5ecd('0x4'))['db'];var utils=require(_0x5ecd('0x5'));var logger=require(_0x5ecd('0x6'))('rpc');var config=require(_0x5ecd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ecd('0x8')][_0x5ecd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a1870,_0x42c752,_0x26d951){return new BPromise(function(_0x2cb71b,_0x946412){return client[_0x5ecd('0xa')](_0x4a1870,_0x26d951)[_0x5ecd('0xb')](function(_0x305f1b){logger[_0x5ecd('0xc')](_0x5ecd('0xd'),_0x42c752,_0x5ecd('0xe'));logger[_0x5ecd('0xf')](_0x5ecd('0x10'),_0x42c752,'request\x20sent',JSON[_0x5ecd('0x11')](_0x305f1b));if(_0x305f1b['error']){if(_0x305f1b['error'][_0x5ecd('0x12')]===0x1f4){logger[_0x5ecd('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x42c752,_0x305f1b['error'][_0x5ecd('0x14')]);return _0x946412(_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);}logger[_0x5ecd('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x42c752,_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);return _0x2cb71b(_0x305f1b['error'][_0x5ecd('0x14')]);}else{logger[_0x5ecd('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x42c752,_0x5ecd('0xe'));_0x2cb71b(_0x305f1b['result'][_0x5ecd('0x14')]);}})[_0x5ecd('0x15')](function(_0x1e8e64){logger[_0x5ecd('0x13')](_0x5ecd('0xd'),_0x42c752,_0x1e8e64);_0x946412(_0x1e8e64);});});} \ No newline at end of file +var _0x0faf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x553e53,_0x2b80a7){var _0x243c9b=function(_0x434c30){while(--_0x434c30){_0x553e53['push'](_0x553e53['shift']());}};_0x243c9b(++_0x2b80a7);}(_0x0faf,0x132));var _0xf0fa=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x0faf[_0x3fc97b];return _0x3a0c82;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var moment=require(_0xf0fa('0x1'));var BPromise=require(_0xf0fa('0x2'));var rs=require(_0xf0fa('0x3'));var fs=require('fs');var Redis=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];var utils=require(_0xf0fa('0x6'));var logger=require(_0xf0fa('0x7'))(_0xf0fa('0x8'));var config=require(_0xf0fa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0xa')][_0xf0fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b5c4,_0x3a703b,_0x2db1d9){return new BPromise(function(_0x587865,_0x42f7fd){return client[_0xf0fa('0xc')](_0x25b5c4,_0x2db1d9)['then'](function(_0x4df4d1){logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));logger[_0xf0fa('0x10')](_0xf0fa('0x11'),_0x3a703b,_0xf0fa('0xf'),JSON[_0xf0fa('0x12')](_0x4df4d1));if(_0x4df4d1[_0xf0fa('0x13')]){if(_0x4df4d1['error'][_0xf0fa('0x14')]===0x1f4){logger['error'](_0xf0fa('0xe'),_0x3a703b,_0x4df4d1['error'][_0xf0fa('0x15')]);return _0x42f7fd(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x3a703b,_0x4df4d1[_0xf0fa('0x13')]['message']);return _0x587865(_0x4df4d1[_0xf0fa('0x13')][_0xf0fa('0x15')]);}else{logger[_0xf0fa('0xd')](_0xf0fa('0xe'),_0x3a703b,_0xf0fa('0xf'));_0x587865(_0x4df4d1[_0xf0fa('0x16')][_0xf0fa('0x15')]);}})[_0xf0fa('0x17')](function(_0x497542){logger[_0xf0fa('0x13')](_0xf0fa('0xe'),_0x3a703b,_0x497542);_0x42f7fd(_0x497542);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e599098..321fdf9 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 _0x5835=['file','create','delete','multer','path','express','fs-extra','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single'];(function(_0x36f467,_0x4baaef){var _0x131adf=function(_0x46e3cf){while(--_0x46e3cf){_0x36f467['push'](_0x36f467['shift']());}};_0x131adf(++_0x4baaef);}(_0x5835,0x8f));var _0x5583=function(_0x1f4fa2,_0x2d1375){_0x1f4fa2=_0x1f4fa2-0x0;var _0xbc90e6=_0x5835[_0x1f4fa2];return _0xbc90e6;};'use strict';var multer=require(_0x5583('0x0'));var util=require('util');var path=require(_0x5583('0x1'));var timeout=require('connect-timeout');var express=require(_0x5583('0x2'));var router=express['Router']();var fs_extra=require(_0x5583('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5583('0x4'));var config=require('../../config/environment');var controller=require(_0x5583('0x5'));router[_0x5583('0x6')]('/',auth[_0x5583('0x7')](),controller[_0x5583('0x8')]);router['get'](_0x5583('0x9'),auth[_0x5583('0x7')](),controller[_0x5583('0xa')]);router['get'](_0x5583('0xb'),auth[_0x5583('0x7')](),controller[_0x5583('0xc')]);var upload=multer({'storage':multer[_0x5583('0xd')]({'destination':function(_0x245935,_0x5da359,_0x1ba6b1){_0x1ba6b1(null,path[_0x5583('0xe')](config[_0x5583('0xf')],_0x5583('0x10')));},'filename':function(_0x51ef8c,_0x445dae,_0x1c73a4){_0x445dae['originalname']=_0x445dae[_0x5583('0x11')][_0x5583('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c73a4(null,util[_0x5583('0x13')](_0x5583('0x14'),path[_0x5583('0x15')](_0x445dae[_0x5583('0x11')],path[_0x5583('0x16')](_0x445dae[_0x5583('0x11')])),Date[_0x5583('0x17')](),path[_0x5583('0x16')](_0x445dae['originalname'])));}})});router['post']('/',upload[_0x5583('0x18')](_0x5583('0x19')),controller[_0x5583('0x1a')]);router['put'](_0x5583('0x9'),auth[_0x5583('0x7')](),controller['update']);router[_0x5583('0x1b')](_0x5583('0x9'),auth[_0x5583('0x7')](),controller[_0x5583('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x20ba=['replace','format','%s-%s%s','basename','extname','now','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20ba,0x84));var _0xa20b=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x20ba[_0x17928f];return _0x500b63;};'use strict';var multer=require('multer');var util=require(_0xa20b('0x0'));var path=require(_0xa20b('0x1'));var timeout=require(_0xa20b('0x2'));var express=require(_0xa20b('0x3'));var router=express[_0xa20b('0x4')]();var fs_extra=require(_0xa20b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa20b('0x6'));var config=require('../../config/environment');var controller=require(_0xa20b('0x7'));router[_0xa20b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa20b('0x8')](_0xa20b('0x9'),auth[_0xa20b('0xa')](),controller[_0xa20b('0xb')]);router[_0xa20b('0x8')](_0xa20b('0xc'),auth['isAuthenticated'](),controller[_0xa20b('0xd')]);var upload=multer({'storage':multer[_0xa20b('0xe')]({'destination':function(_0x41d04c,_0x44811d,_0x2263e1){_0x2263e1(null,path[_0xa20b('0xf')](config['root'],_0xa20b('0x10')));},'filename':function(_0x5f3400,_0x82e511,_0x4cc6bb){_0x82e511[_0xa20b('0x11')]=_0x82e511['originalname'][_0xa20b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4cc6bb(null,util[_0xa20b('0x13')](_0xa20b('0x14'),path[_0xa20b('0x15')](_0x82e511[_0xa20b('0x11')],path[_0xa20b('0x16')](_0x82e511[_0xa20b('0x11')])),Date[_0xa20b('0x17')](),path['extname'](_0x82e511[_0xa20b('0x11')])));}})});router['post']('/',upload['single'](_0xa20b('0x18')),controller[_0xa20b('0x19')]);router[_0xa20b('0x1a')]('/:id',auth[_0xa20b('0xa')](),controller[_0xa20b('0x1b')]);router[_0xa20b('0x1c')]('/:id',auth[_0xa20b('0xa')](),controller['delete']);module[_0xa20b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e9c5e82..140cf34 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 _0x0dbe=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x15c672,_0xf6bcc){var _0xf51618=function(_0x70db22){while(--_0x70db22){_0x15c672['push'](_0x15c672['shift']());}};_0xf51618(++_0xf6bcc);}(_0x0dbe,0x138));var _0xe0db=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x0dbe[_0x2c1dcd];return _0x158ce5;};'use strict';var Sequelize=require(_0xe0db('0x0'));module[_0xe0db('0x1')]={'name':{'type':Sequelize[_0xe0db('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xe0db('0x2')]},'display_name':{'type':Sequelize[_0xe0db('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe0db('0x2')]},'original_format':{'type':Sequelize[_0xe0db('0x2')]},'original_duration':{'type':Sequelize[_0xe0db('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe0db('0x4')]},'original_channelCount':{'type':Sequelize[_0xe0db('0x5')]},'original_bitRate':{'type':Sequelize[_0xe0db('0x4')]},'original_sampleRate':{'type':Sequelize[_0xe0db('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe0db('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe0db('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe0db('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5c02=['FLOAT','INTEGER','BIGINT','sequelize','STRING','name'];(function(_0x3d64f3,_0x1232c9){var _0x516980=function(_0x5cbe7e){while(--_0x5cbe7e){_0x3d64f3['push'](_0x3d64f3['shift']());}};_0x516980(++_0x1232c9);}(_0x5c02,0x1e9));var _0x25c0=function(_0xa6eb75,_0x430e91){_0xa6eb75=_0xa6eb75-0x0;var _0x43b05c=_0x5c02[_0xa6eb75];return _0x43b05c;};'use strict';var Sequelize=require(_0x25c0('0x0'));module['exports']={'name':{'type':Sequelize[_0x25c0('0x1')],'unique':_0x25c0('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x25c0('0x1')]},'display_name':{'type':Sequelize[_0x25c0('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x25c0('0x1')]},'original_format':{'type':Sequelize[_0x25c0('0x1')]},'original_duration':{'type':Sequelize[_0x25c0('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x25c0('0x4')]},'original_bitRate':{'type':Sequelize[_0x25c0('0x5')]},'original_sampleRate':{'type':Sequelize[_0x25c0('0x4')]},'converted_format':{'type':Sequelize[_0x25c0('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x25c0('0x5')]},'converted_channelCount':{'type':Sequelize[_0x25c0('0x4')]},'converted_bitRate':{'type':Sequelize[_0x25c0('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x25c0('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 21056ab..0898413 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 _0x3467=['options','includeAll','include','findAll','rows','catch','params','find','save_name','converted_format','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Sound','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x5f3e81,_0x3f5bb9){var _0x1f62e8=function(_0x16d2d5){while(--_0x16d2d5){_0x5f3e81['push'](_0x5f3e81['shift']());}};_0x1f62e8(++_0x3f5bb9);}(_0x3467,0x1af));var _0x7346=function(_0x57b8b7,_0xb31b13){_0x57b8b7=_0x57b8b7-0x0;var _0x5d56f6=_0x3467[_0x57b8b7];return _0x5d56f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7346('0x0'));var zipdir=require(_0x7346('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7346('0x2'));var moment=require(_0x7346('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7346('0x4'));var util=require(_0x7346('0x5'));var path=require(_0x7346('0x6'));var sox=require(_0x7346('0x7'));var csv=require('to-csv');var ejs=require(_0x7346('0x8'));var fs=require('fs');var fs_extra=require(_0x7346('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7346('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7346('0xb'));var toCsv=require(_0x7346('0xc'));var querystring=require(_0x7346('0xd'));var Papa=require(_0x7346('0xe'));var Redis=require(_0x7346('0xf'));var authService=require(_0x7346('0x10'));var qs=require(_0x7346('0x11'));var as=require(_0x7346('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7346('0x13'))('api');var utils=require(_0x7346('0x14'));var config=require(_0x7346('0x15'));var licenseUtil=require(_0x7346('0x16'));var db=require(_0x7346('0x17'))['db'];function respondWithStatusCode(_0x180e06,_0x4effe8){_0x4effe8=_0x4effe8||0xcc;return function(_0x30da57){if(_0x30da57){return _0x180e06[_0x7346('0x18')](_0x4effe8);}return _0x180e06['status'](_0x4effe8)['end']();};}function respondWithResult(_0x38010e,_0x28b15c){_0x28b15c=_0x28b15c||0xc8;return function(_0x1b69b1){if(_0x1b69b1){return _0x38010e[_0x7346('0x19')](_0x28b15c)[_0x7346('0x1a')](_0x1b69b1);}};}function respondWithFilteredResult(_0x149990,_0x20a0e2){return function(_0x211a07){if(_0x211a07){var _0x21e17d=typeof _0x20a0e2[_0x7346('0x1b')]===_0x7346('0x1c')&&typeof _0x20a0e2['limit']==='undefined';var _0x4d7a1c=_0x211a07[_0x7346('0x1d')];var _0xe4a1dd=_0x21e17d?0x0:_0x20a0e2[_0x7346('0x1b')];var _0x1cbd21=_0x21e17d?_0x211a07['count']:_0x20a0e2[_0x7346('0x1b')]+_0x20a0e2[_0x7346('0x1e')];var _0x2b3168;if(_0x1cbd21>=_0x4d7a1c){_0x1cbd21=_0x4d7a1c;_0x2b3168=0xc8;}else{_0x2b3168=0xce;}_0x149990[_0x7346('0x19')](_0x2b3168);return _0x149990['set'](_0x7346('0x1f'),_0xe4a1dd+'-'+_0x1cbd21+'/'+_0x4d7a1c)[_0x7346('0x1a')](_0x211a07);}return null;};}function patchUpdates(_0x1de7cc){return function(_0x3414cf){try{jsonpatch[_0x7346('0x20')](_0x3414cf,_0x1de7cc,!![]);}catch(_0x5eb901){return BPromise[_0x7346('0x21')](_0x5eb901);}return _0x3414cf[_0x7346('0x22')]();};}function saveUpdates(_0x3ed953,_0x83197b){return function(_0x1fe787){if(_0x1fe787){return _0x1fe787[_0x7346('0x23')](_0x3ed953)[_0x7346('0x24')](function(_0x36185d){return _0x36185d;});}return null;};}function removeEntity(_0x65a2b7,_0x1e309a){return function(_0x54844f){if(_0x54844f){return _0x54844f[_0x7346('0x25')]()[_0x7346('0x24')](function(){var _0x3e214c=_0x54844f['get']({'plain':!![]});var _0x28fdf8='Sounds';return db['UserProfileResource'][_0x7346('0x25')]({'where':{'type':_0x28fdf8,'resourceId':_0x3e214c['id']}})[_0x7346('0x24')](function(){return _0x54844f;});})[_0x7346('0x24')](function(){_0x65a2b7[_0x7346('0x19')](0xcc)[_0x7346('0x26')]();});}};}function handleEntityNotFound(_0x4143c6,_0x15d496){return function(_0x1fefe4){if(!_0x1fefe4){_0x4143c6['sendStatus'](0x194);}return _0x1fefe4;};}function handleError(_0x3e6b35,_0xe7eaab){_0xe7eaab=_0xe7eaab||0x1f4;return function(_0x2c428a){logger['error'](_0x2c428a[_0x7346('0x27')]);if(_0x2c428a[_0x7346('0x28')]){delete _0x2c428a['name'];}_0x3e6b35[_0x7346('0x19')](_0xe7eaab)[_0x7346('0x29')](_0x2c428a);};}exports[_0x7346('0x2a')]=function(_0x336801,_0x3607ec){var _0x3c67fa={},_0x757988={},_0x56307f={'count':0x0,'rows':[]};var _0x50bc0a=_[_0x7346('0x2b')](db[_0x7346('0x2c')][_0x7346('0x2d')],function(_0x25a0e0){return{'name':_0x25a0e0['fieldName'],'type':_0x25a0e0[_0x7346('0x2e')][_0x7346('0x2f')]};});_0x757988['model']=_[_0x7346('0x2b')](_0x50bc0a,_0x7346('0x28'));_0x757988['query']=_[_0x7346('0x30')](_0x336801[_0x7346('0x31')]);_0x757988[_0x7346('0x32')]=_[_0x7346('0x33')](_0x757988[_0x7346('0x34')],_0x757988[_0x7346('0x31')]);_0x3c67fa[_0x7346('0x35')]=_[_0x7346('0x33')](_0x757988['model'],qs['fields'](_0x336801['query'][_0x7346('0x36')]));_0x3c67fa['attributes']=_0x3c67fa[_0x7346('0x35')][_0x7346('0x37')]?_0x3c67fa[_0x7346('0x35')]:_0x757988[_0x7346('0x34')];if(!_0x336801[_0x7346('0x31')][_0x7346('0x38')](_0x7346('0x39'))){_0x3c67fa[_0x7346('0x1e')]=qs[_0x7346('0x1e')](_0x336801[_0x7346('0x31')][_0x7346('0x1e')]);_0x3c67fa[_0x7346('0x1b')]=qs[_0x7346('0x1b')](_0x336801[_0x7346('0x31')][_0x7346('0x1b')]);}_0x3c67fa[_0x7346('0x3a')]=qs[_0x7346('0x3b')](_0x336801[_0x7346('0x31')][_0x7346('0x3b')]);_0x3c67fa[_0x7346('0x3c')]=qs['filters'](_[_0x7346('0x3d')](_0x336801[_0x7346('0x31')],_0x757988[_0x7346('0x32')]),_0x50bc0a);if(_0x336801[_0x7346('0x31')]['filter']){_0x3c67fa[_0x7346('0x3c')]=_[_0x7346('0x3e')](_0x3c67fa[_0x7346('0x3c')],{'$or':_['map'](_0x50bc0a,function(_0x422dba){if(_0x422dba[_0x7346('0x2e')]!==_0x7346('0x3f')){var _0x9eb5ff={};_0x9eb5ff[_0x422dba['name']]={'$like':'%'+_0x336801['query'][_0x7346('0x40')]+'%'};return _0x9eb5ff;}})});}_0x3c67fa=_[_0x7346('0x3e')]({},_0x3c67fa,_0x336801[_0x7346('0x41')]);var _0xcac171={'where':_0x3c67fa[_0x7346('0x3c')]};return db['Sound'][_0x7346('0x1d')](_0xcac171)[_0x7346('0x24')](function(_0x7ca1e){_0x56307f[_0x7346('0x1d')]=_0x7ca1e;if(_0x336801['query'][_0x7346('0x42')]){_0x3c67fa[_0x7346('0x43')]=[{'all':!![]}];}return db[_0x7346('0x2c')][_0x7346('0x44')](_0x3c67fa);})[_0x7346('0x24')](function(_0x2bb128){_0x56307f[_0x7346('0x45')]=_0x2bb128;return _0x56307f;})[_0x7346('0x24')](respondWithFilteredResult(_0x3607ec,_0x3c67fa))[_0x7346('0x46')](handleError(_0x3607ec,null));};exports['show']=function(_0x2a60c7,_0x17c362){var _0x1cd795={'raw':!![],'where':{'id':_0x2a60c7[_0x7346('0x47')]['id']}},_0x5eeec6={};_0x5eeec6[_0x7346('0x34')]=_['keys'](db[_0x7346('0x2c')][_0x7346('0x2d')]);_0x5eeec6['query']=_[_0x7346('0x30')](_0x2a60c7['query']);_0x5eeec6[_0x7346('0x32')]=_[_0x7346('0x33')](_0x5eeec6[_0x7346('0x34')],_0x5eeec6[_0x7346('0x31')]);_0x1cd795[_0x7346('0x35')]=_['intersection'](_0x5eeec6[_0x7346('0x34')],qs['fields'](_0x2a60c7[_0x7346('0x31')]['fields']));_0x1cd795[_0x7346('0x35')]=_0x1cd795[_0x7346('0x35')][_0x7346('0x37')]?_0x1cd795['attributes']:_0x5eeec6[_0x7346('0x34')];if(_0x2a60c7[_0x7346('0x31')][_0x7346('0x42')]){_0x1cd795['include']=[{'all':!![]}];}_0x1cd795=_['merge']({},_0x1cd795,_0x2a60c7[_0x7346('0x41')]);return db[_0x7346('0x2c')][_0x7346('0x48')](_0x1cd795)[_0x7346('0x24')](handleEntityNotFound(_0x17c362,null))[_0x7346('0x24')](respondWithResult(_0x17c362,null))[_0x7346('0x46')](handleError(_0x17c362,null));};exports['download']=function(_0x3a4405,_0x2ef114,_0x12500c){return db[_0x7346('0x2c')][_0x7346('0x48')]({'where':{'id':_0x3a4405['params']['id']},'attributes':[_0x7346('0x28'),_0x7346('0x49'),_0x7346('0x4a')],'raw':!![]})[_0x7346('0x24')](handleEntityNotFound(_0x2ef114,null))[_0x7346('0x24')](function(_0x2116db){if(_0x2116db){if(!fs['existsSync'](path['join'](config[_0x7346('0x4b')],_0x7346('0x4c'),_0x2116db['save_name']+'.'+_0x2116db[_0x7346('0x4a')]))){throw new db[(_0x7346('0x4d'))][(_0x7346('0x4e'))](_0x7346('0x4f'));}return _0x2ef114[_0x7346('0x50')](path['join'](config[_0x7346('0x4b')],_0x7346('0x4c'),util['format'](_0x7346('0x51'),_0x2116db[_0x7346('0x49')],_0x2116db[_0x7346('0x4a')])),util[_0x7346('0x52')](_0x7346('0x51'),_0x2116db[_0x7346('0x28')],_0x2116db[_0x7346('0x4a')]));}return null;})[_0x7346('0x46')](handleError(_0x2ef114,null));};exports[_0x7346('0x53')]=function(_0x77c562,_0x2645e1,_0x4c7929){var _0x59fd43={'name':path[_0x7346('0x54')](_0x77c562[_0x7346('0x55')][_0x7346('0x56')],path[_0x7346('0x57')](_0x77c562['file'][_0x7346('0x56')])),'save_name':path['basename'](_0x77c562['file'][_0x7346('0x58')],path[_0x7346('0x57')](_0x77c562[_0x7346('0x55')][_0x7346('0x58')])),'original_format':path[_0x7346('0x57')](_0x77c562[_0x7346('0x55')][_0x7346('0x56')])[_0x7346('0x59')](0x1),'converted_format':_0x7346('0x5a')};var _0x1468e0=path[_0x7346('0x5b')](config['root'],_0x7346('0x5c'),_0x77c562[_0x7346('0x55')][_0x7346('0x58')]);var _0x5391ac=path[_0x7346('0x5b')](config[_0x7346('0x4b')],_0x7346('0x4c'),util[_0x7346('0x52')](_0x7346('0x51'),path[_0x7346('0x54')](_0x77c562[_0x7346('0x55')]['filename'],path[_0x7346('0x57')](_0x77c562[_0x7346('0x55')][_0x7346('0x58')])),_0x59fd43[_0x7346('0x4a')]));logger[_0x7346('0x5d')](_0x7346('0x5e'),_0x1468e0);logger['info'](_0x7346('0x5f'),_0x5391ac);try{fs[_0x7346('0x60')](_0x1468e0,parseInt(_0x7346('0x61'),0x8));var _0x3b3cdf=sox[_0x7346('0x62')](_0x1468e0,_0x5391ac,{'sampleRate':0x1f40,'format':_0x7346('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b3cdf['on']('error',function(_0x9ee96d){fs[_0x7346('0x63')](_0x1468e0);_0x2645e1[_0x7346('0x19')](0x1f4)[_0x7346('0x29')](_0x9ee96d);});_0x3b3cdf['on']('src',function(_0x40849c){_0x59fd43[_0x7346('0x64')]=isNaN(_0x40849c[_0x7346('0x65')])?null:_0x40849c['duration']*0x3e8;_0x59fd43['original_sampleCount']=isNaN(_0x40849c[_0x7346('0x66')])?null:_0x40849c['sampleCount'];_0x59fd43[_0x7346('0x67')]=isNaN(_0x40849c['channelCount'])?null:_0x40849c[_0x7346('0x68')];_0x59fd43[_0x7346('0x69')]=isNaN(_0x40849c[_0x7346('0x6a')])?null:_0x40849c[_0x7346('0x6a')];_0x59fd43[_0x7346('0x6b')]=isNaN(_0x40849c[_0x7346('0x6c')])?null:_0x40849c[_0x7346('0x6c')];});_0x3b3cdf['on'](_0x7346('0x6d'),function(_0x19e693){_0x59fd43['converted_duration']=isNaN(_0x19e693['duration'])?null:_0x19e693[_0x7346('0x65')]*0x3e8;_0x59fd43[_0x7346('0x6e')]=isNaN(_0x19e693['sampleCount'])?null:_0x19e693['sampleCount'];_0x59fd43[_0x7346('0x6f')]=isNaN(_0x19e693[_0x7346('0x68')])?null:_0x19e693[_0x7346('0x68')];_0x59fd43[_0x7346('0x70')]=isNaN(_0x19e693['bitRate'])?null:_0x19e693[_0x7346('0x6a')];_0x59fd43[_0x7346('0x71')]=isNaN(_0x19e693[_0x7346('0x6c')])?null:_0x19e693['sampleRate'];});_0x3b3cdf['on'](_0x7346('0x26'),function(){fs[_0x7346('0x60')](_0x5391ac,parseInt(_0x7346('0x61'),0x8));return db[_0x7346('0x2c')]['create'](_0x59fd43)[_0x7346('0x24')](function(_0x32482d){var _0x3ae468={'role':_0x77c562[_0x7346('0x72')][_0x7346('0x73')],'userProfileId':_0x77c562[_0x7346('0x72')]['userProfileId']};if(!_0x3ae468)throw new Error(_0x7346('0x74'));if(_0x3ae468['role']===_0x7346('0x75')){var _0xa1c916=_0x32482d['get']({'plain':!![]});return db[_0x7346('0x76')][_0x7346('0x48')]({'where':{'name':'Sounds','userProfileId':_0x3ae468[_0x7346('0x77')]},'raw':!![]})[_0x7346('0x24')](function(_0x5c62c7){if(_0x5c62c7&&_0x5c62c7[_0x7346('0x78')]===0x0){return db['UserProfileResource'][_0x7346('0x53')]({'name':_0xa1c916[_0x7346('0x28')],'resourceId':_0xa1c916['id'],'type':_0x5c62c7[_0x7346('0x28')],'sectionId':_0x5c62c7['id']},{})['then'](function(){return _0x32482d;});}else{return _0x32482d;}})[_0x7346('0x46')](function(_0x3bc9d){logger[_0x7346('0x79')](_0x7346('0x7a'),_0x3bc9d);throw _0x3bc9d;});}return _0x32482d;})[_0x7346('0x24')](respondWithResult(_0x2645e1,null))[_0x7346('0x46')](handleError(_0x2645e1,null));});_0x3b3cdf['start']();}catch(_0x37d644){_0x2645e1[_0x7346('0x19')](0x1f4)[_0x7346('0x29')](_0x37d644);}};exports[_0x7346('0x23')]=function(_0x290d49,_0x39b91a,_0x30a8cd){return db[_0x7346('0x2c')][_0x7346('0x48')]({'where':{'id':_0x290d49[_0x7346('0x47')]['id']}})[_0x7346('0x24')](handleEntityNotFound(_0x39b91a,null))[_0x7346('0x24')](saveUpdates(_[_0x7346('0x3d')](_0x290d49[_0x7346('0x72')],[_0x7346('0x28'),'description']),null))[_0x7346('0x24')](respondWithResult(_0x39b91a,null))[_0x7346('0x46')](handleError(_0x39b91a,null));};exports[_0x7346('0x7b')]=function(_0x53baa7,_0x35b412,_0x8ebfc9){return db[_0x7346('0x2c')][_0x7346('0x48')]({'where':{'id':_0x53baa7['params']['id']}})[_0x7346('0x24')](function(_0x59f7ab){if(_0x59f7ab){return _0x59f7ab[_0x7346('0x25')]();}})[_0x7346('0x24')](function(_0x21c579){var _0x3bb9f5=path[_0x7346('0x5b')](config['root'],_0x7346('0x5c'),util['format'](_0x7346('0x51'),_0x21c579[_0x7346('0x49')],_0x21c579['original_format']));var _0x2f512c=path[_0x7346('0x5b')](config[_0x7346('0x4b')],_0x7346('0x4c'),util['format'](_0x7346('0x51'),_0x21c579['save_name'],_0x21c579['converted_format']));fs[_0x7346('0x63')](_0x3bb9f5);fs[_0x7346('0x63')](_0x2f512c);return _0x21c579;})[_0x7346('0x24')](function(_0xbf1c67){if(_0xbf1c67){return _0x35b412['status'](0xcc)['end']();}})[_0x7346('0x24')](handleEntityNotFound(_0x35b412,null))[_0x7346('0x46')](handleError(_0x35b412,null));}; \ No newline at end of file +var _0x820d=['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','json','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','Sound','includeAll','catch','show','params','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','ValidationError','format','%s.%s','create','basename','file','originalname','extname','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','crypto','jsforce'];(function(_0x1a9c7d,_0x1baf44){var _0x1a588b=function(_0x21f1bf){while(--_0x21f1bf){_0x1a9c7d['push'](_0x1a9c7d['shift']());}};_0x1a588b(++_0x1baf44);}(_0x820d,0x152));var _0xd820=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x820d[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xd820('0x0'));var rimraf=require(_0xd820('0x1'));var zipdir=require(_0xd820('0x2'));var jsonpatch=require(_0xd820('0x3'));var rp=require(_0xd820('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd820('0x5'));var sox=require(_0xd820('0x6'));var csv=require(_0xd820('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(_0xd820('0x8'));var jsforce=require(_0xd820('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd820('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd820('0xa'));var authService=require(_0xd820('0xb'));var qs=require(_0xd820('0xc'));var as=require(_0xd820('0xd'));var hardwareService=require(_0xd820('0xe'));var logger=require(_0xd820('0xf'))(_0xd820('0x10'));var utils=require(_0xd820('0x11'));var config=require(_0xd820('0x12'));var licenseUtil=require(_0xd820('0x13'));var db=require(_0xd820('0x14'))['db'];function respondWithStatusCode(_0x44abf7,_0x5ec480){_0x5ec480=_0x5ec480||0xcc;return function(_0x2f0339){if(_0x2f0339){return _0x44abf7['sendStatus'](_0x5ec480);}return _0x44abf7['status'](_0x5ec480)[_0xd820('0x15')]();};}function respondWithResult(_0x598642,_0x51931f){_0x51931f=_0x51931f||0xc8;return function(_0x1569ec){if(_0x1569ec){return _0x598642[_0xd820('0x16')](_0x51931f)['json'](_0x1569ec);}};}function respondWithFilteredResult(_0x3eb736,_0x9db070){return function(_0x353710){if(_0x353710){var _0x2a4127=typeof _0x9db070[_0xd820('0x17')]===_0xd820('0x18')&&typeof _0x9db070[_0xd820('0x19')]===_0xd820('0x18');var _0x55ce8c=_0x353710[_0xd820('0x1a')];var _0xe94262=_0x2a4127?0x0:_0x9db070['offset'];var _0x16a9a2=_0x2a4127?_0x353710[_0xd820('0x1a')]:_0x9db070[_0xd820('0x17')]+_0x9db070[_0xd820('0x19')];var _0x3ce9b7;if(_0x16a9a2>=_0x55ce8c){_0x16a9a2=_0x55ce8c;_0x3ce9b7=0xc8;}else{_0x3ce9b7=0xce;}_0x3eb736[_0xd820('0x16')](_0x3ce9b7);return _0x3eb736[_0xd820('0x1b')]('Content-Range',_0xe94262+'-'+_0x16a9a2+'/'+_0x55ce8c)[_0xd820('0x1c')](_0x353710);}return null;};}function patchUpdates(_0x16c2b5){return function(_0x499b43){try{jsonpatch[_0xd820('0x1d')](_0x499b43,_0x16c2b5,!![]);}catch(_0x13ef40){return BPromise[_0xd820('0x1e')](_0x13ef40);}return _0x499b43[_0xd820('0x1f')]();};}function saveUpdates(_0xa91792,_0x8194a){return function(_0x3cf5da){if(_0x3cf5da){return _0x3cf5da[_0xd820('0x20')](_0xa91792)['then'](function(_0x1009ca){return _0x1009ca;});}return null;};}function removeEntity(_0x2cb66f,_0x3eba55){return function(_0x128884){if(_0x128884){return _0x128884[_0xd820('0x21')]()[_0xd820('0x22')](function(){var _0x1275eb=_0x128884[_0xd820('0x23')]({'plain':!![]});var _0x2e28d9=_0xd820('0x24');return db[_0xd820('0x25')][_0xd820('0x21')]({'where':{'type':_0x2e28d9,'resourceId':_0x1275eb['id']}})[_0xd820('0x22')](function(){return _0x128884;});})[_0xd820('0x22')](function(){_0x2cb66f['status'](0xcc)[_0xd820('0x15')]();});}};}function handleEntityNotFound(_0x14baec,_0xef06b5){return function(_0x15904d){if(!_0x15904d){_0x14baec['sendStatus'](0x194);}return _0x15904d;};}function handleError(_0x1b392a,_0x421a3d){_0x421a3d=_0x421a3d||0x1f4;return function(_0x497e04){logger[_0xd820('0x26')](_0x497e04[_0xd820('0x27')]);if(_0x497e04[_0xd820('0x28')]){delete _0x497e04[_0xd820('0x28')];}_0x1b392a[_0xd820('0x16')](_0x421a3d)[_0xd820('0x29')](_0x497e04);};}exports['index']=function(_0x3ce87e,_0xe3c502){var _0x372265={},_0x16da4f={},_0x355fb7={'count':0x0,'rows':[]};var _0x4e48bc=_[_0xd820('0x2a')](db['Sound'][_0xd820('0x2b')],function(_0x5d86a7){return{'name':_0x5d86a7['fieldName'],'type':_0x5d86a7['type']['key']};});_0x16da4f[_0xd820('0x2c')]=_[_0xd820('0x2a')](_0x4e48bc,_0xd820('0x28'));_0x16da4f[_0xd820('0x2d')]=_[_0xd820('0x2e')](_0x3ce87e[_0xd820('0x2d')]);_0x16da4f[_0xd820('0x2f')]=_[_0xd820('0x30')](_0x16da4f[_0xd820('0x2c')],_0x16da4f[_0xd820('0x2d')]);_0x372265[_0xd820('0x31')]=_[_0xd820('0x30')](_0x16da4f[_0xd820('0x2c')],qs['fields'](_0x3ce87e[_0xd820('0x2d')][_0xd820('0x32')]));_0x372265['attributes']=_0x372265[_0xd820('0x31')][_0xd820('0x33')]?_0x372265[_0xd820('0x31')]:_0x16da4f['model'];if(!_0x3ce87e[_0xd820('0x2d')][_0xd820('0x34')](_0xd820('0x35'))){_0x372265[_0xd820('0x19')]=qs[_0xd820('0x19')](_0x3ce87e[_0xd820('0x2d')][_0xd820('0x19')]);_0x372265[_0xd820('0x17')]=qs[_0xd820('0x17')](_0x3ce87e[_0xd820('0x2d')][_0xd820('0x17')]);}_0x372265[_0xd820('0x36')]=qs[_0xd820('0x37')](_0x3ce87e[_0xd820('0x2d')][_0xd820('0x37')]);_0x372265[_0xd820('0x38')]=qs[_0xd820('0x2f')](_['pick'](_0x3ce87e[_0xd820('0x2d')],_0x16da4f[_0xd820('0x2f')]),_0x4e48bc);if(_0x3ce87e['query']['filter']){_0x372265[_0xd820('0x38')]=_[_0xd820('0x39')](_0x372265[_0xd820('0x38')],{'$or':_[_0xd820('0x2a')](_0x4e48bc,function(_0x2fbea0){if(_0x2fbea0[_0xd820('0x3a')]!==_0xd820('0x3b')){var _0x23e166={};_0x23e166[_0x2fbea0[_0xd820('0x28')]]={'$like':'%'+_0x3ce87e[_0xd820('0x2d')][_0xd820('0x3c')]+'%'};return _0x23e166;}})});}_0x372265=_[_0xd820('0x39')]({},_0x372265,_0x3ce87e[_0xd820('0x3d')]);var _0x188a56={'where':_0x372265['where']};return db[_0xd820('0x3e')][_0xd820('0x1a')](_0x188a56)[_0xd820('0x22')](function(_0x3b9c4e){_0x355fb7['count']=_0x3b9c4e;if(_0x3ce87e[_0xd820('0x2d')][_0xd820('0x3f')]){_0x372265['include']=[{'all':!![]}];}return db[_0xd820('0x3e')]['findAll'](_0x372265);})[_0xd820('0x22')](function(_0x445236){_0x355fb7['rows']=_0x445236;return _0x355fb7;})[_0xd820('0x22')](respondWithFilteredResult(_0xe3c502,_0x372265))[_0xd820('0x40')](handleError(_0xe3c502,null));};exports[_0xd820('0x41')]=function(_0x5b2c6c,_0x383f64){var _0x1a9383={'raw':!![],'where':{'id':_0x5b2c6c[_0xd820('0x42')]['id']}},_0x542a8a={};_0x542a8a[_0xd820('0x2c')]=_['keys'](db[_0xd820('0x3e')][_0xd820('0x2b')]);_0x542a8a[_0xd820('0x2d')]=_[_0xd820('0x2e')](_0x5b2c6c['query']);_0x542a8a[_0xd820('0x2f')]=_[_0xd820('0x30')](_0x542a8a['model'],_0x542a8a[_0xd820('0x2d')]);_0x1a9383[_0xd820('0x31')]=_[_0xd820('0x30')](_0x542a8a[_0xd820('0x2c')],qs[_0xd820('0x32')](_0x5b2c6c[_0xd820('0x2d')][_0xd820('0x32')]));_0x1a9383[_0xd820('0x31')]=_0x1a9383['attributes']['length']?_0x1a9383[_0xd820('0x31')]:_0x542a8a[_0xd820('0x2c')];if(_0x5b2c6c[_0xd820('0x2d')][_0xd820('0x3f')]){_0x1a9383['include']=[{'all':!![]}];}_0x1a9383=_[_0xd820('0x39')]({},_0x1a9383,_0x5b2c6c[_0xd820('0x3d')]);return db[_0xd820('0x3e')][_0xd820('0x43')](_0x1a9383)[_0xd820('0x22')](handleEntityNotFound(_0x383f64,null))[_0xd820('0x22')](respondWithResult(_0x383f64,null))[_0xd820('0x40')](handleError(_0x383f64,null));};exports[_0xd820('0x44')]=function(_0x12c11e,_0x5c04e2,_0x59487e){return db[_0xd820('0x3e')]['find']({'where':{'id':_0x12c11e[_0xd820('0x42')]['id']},'attributes':['name','save_name',_0xd820('0x45')],'raw':!![]})[_0xd820('0x22')](handleEntityNotFound(_0x5c04e2,null))[_0xd820('0x22')](function(_0x42d3e5){if(_0x42d3e5){if(!fs[_0xd820('0x46')](path[_0xd820('0x47')](config[_0xd820('0x48')],_0xd820('0x49'),_0x42d3e5[_0xd820('0x4a')]+'.'+_0x42d3e5[_0xd820('0x45')]))){throw new db['Sequelize'][(_0xd820('0x4b'))]('Sound\x20not\x20found');}return _0x5c04e2['download'](path['join'](config[_0xd820('0x48')],_0xd820('0x49'),util[_0xd820('0x4c')](_0xd820('0x4d'),_0x42d3e5[_0xd820('0x4a')],_0x42d3e5['converted_format'])),util[_0xd820('0x4c')](_0xd820('0x4d'),_0x42d3e5[_0xd820('0x28')],_0x42d3e5[_0xd820('0x45')]));}return null;})['catch'](handleError(_0x5c04e2,null));};exports[_0xd820('0x4e')]=function(_0x295c50,_0x1b164d,_0x4a0b22){var _0x467e75={'name':path[_0xd820('0x4f')](_0x295c50[_0xd820('0x50')][_0xd820('0x51')],path[_0xd820('0x52')](_0x295c50[_0xd820('0x50')][_0xd820('0x51')])),'save_name':path[_0xd820('0x4f')](_0x295c50['file']['filename'],path[_0xd820('0x52')](_0x295c50[_0xd820('0x50')]['filename'])),'original_format':path[_0xd820('0x52')](_0x295c50[_0xd820('0x50')]['originalname'])[_0xd820('0x53')](0x1),'converted_format':_0xd820('0x54')};var _0x345f70=path[_0xd820('0x47')](config[_0xd820('0x48')],_0xd820('0x55'),_0x295c50['file']['filename']);var _0x38d924=path[_0xd820('0x47')](config[_0xd820('0x48')],_0xd820('0x49'),util[_0xd820('0x4c')](_0xd820('0x4d'),path[_0xd820('0x4f')](_0x295c50[_0xd820('0x50')][_0xd820('0x56')],path[_0xd820('0x52')](_0x295c50[_0xd820('0x50')][_0xd820('0x56')])),_0x467e75[_0xd820('0x45')]));logger[_0xd820('0x57')]('Sound\x20upload\x20filepath:\x20%s',_0x345f70);logger['info'](_0xd820('0x58'),_0x38d924);try{fs[_0xd820('0x59')](_0x345f70,parseInt(_0xd820('0x5a'),0x8));var _0x201941=sox['transcode'](_0x345f70,_0x38d924,{'sampleRate':0x1f40,'format':_0xd820('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x201941['on'](_0xd820('0x26'),function(_0x2a6b9f){fs[_0xd820('0x5b')](_0x345f70);_0x1b164d[_0xd820('0x16')](0x1f4)[_0xd820('0x29')](_0x2a6b9f);});_0x201941['on'](_0xd820('0x5c'),function(_0x19d9fa){_0x467e75[_0xd820('0x5d')]=isNaN(_0x19d9fa[_0xd820('0x5e')])?null:_0x19d9fa[_0xd820('0x5e')]*0x3e8;_0x467e75[_0xd820('0x5f')]=isNaN(_0x19d9fa[_0xd820('0x60')])?null:_0x19d9fa[_0xd820('0x60')];_0x467e75[_0xd820('0x61')]=isNaN(_0x19d9fa[_0xd820('0x62')])?null:_0x19d9fa[_0xd820('0x62')];_0x467e75['original_bitRate']=isNaN(_0x19d9fa['bitRate'])?null:_0x19d9fa[_0xd820('0x63')];_0x467e75['original_sampleRate']=isNaN(_0x19d9fa[_0xd820('0x64')])?null:_0x19d9fa[_0xd820('0x64')];});_0x201941['on'](_0xd820('0x65'),function(_0x2a1789){_0x467e75['converted_duration']=isNaN(_0x2a1789[_0xd820('0x5e')])?null:_0x2a1789[_0xd820('0x5e')]*0x3e8;_0x467e75[_0xd820('0x66')]=isNaN(_0x2a1789[_0xd820('0x60')])?null:_0x2a1789[_0xd820('0x60')];_0x467e75[_0xd820('0x67')]=isNaN(_0x2a1789[_0xd820('0x62')])?null:_0x2a1789[_0xd820('0x62')];_0x467e75[_0xd820('0x68')]=isNaN(_0x2a1789[_0xd820('0x63')])?null:_0x2a1789[_0xd820('0x63')];_0x467e75[_0xd820('0x69')]=isNaN(_0x2a1789[_0xd820('0x64')])?null:_0x2a1789['sampleRate'];});_0x201941['on'](_0xd820('0x15'),function(){fs['chmodSync'](_0x38d924,parseInt('0777',0x8));return db[_0xd820('0x3e')]['create'](_0x467e75)[_0xd820('0x22')](function(_0x9deebc){var _0x1cfe8f={'role':_0x295c50[_0xd820('0x6a')][_0xd820('0x6b')],'userProfileId':_0x295c50[_0xd820('0x6a')][_0xd820('0x6c')]};if(!_0x1cfe8f)throw new Error(_0xd820('0x6d'));if(_0x1cfe8f[_0xd820('0x6b')]===_0xd820('0x6e')){var _0x397296=_0x9deebc[_0xd820('0x23')]({'plain':!![]});return db[_0xd820('0x6f')][_0xd820('0x43')]({'where':{'name':_0xd820('0x24'),'userProfileId':_0x1cfe8f['userProfileId']},'raw':!![]})[_0xd820('0x22')](function(_0x2fc732){if(_0x2fc732&&_0x2fc732[_0xd820('0x70')]===0x0){return db[_0xd820('0x25')][_0xd820('0x4e')]({'name':_0x397296[_0xd820('0x28')],'resourceId':_0x397296['id'],'type':_0x2fc732[_0xd820('0x28')],'sectionId':_0x2fc732['id']},{})[_0xd820('0x22')](function(){return _0x9deebc;});}else{return _0x9deebc;}})[_0xd820('0x40')](function(_0x60bceb){logger[_0xd820('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x60bceb);throw _0x60bceb;});}return _0x9deebc;})[_0xd820('0x22')](respondWithResult(_0x1b164d,null))['catch'](handleError(_0x1b164d,null));});_0x201941[_0xd820('0x71')]();}catch(_0x3fa5e9){_0x1b164d['status'](0x1f4)[_0xd820('0x29')](_0x3fa5e9);}};exports['update']=function(_0x4b989c,_0x352c50,_0x2b5b52){return db[_0xd820('0x3e')][_0xd820('0x43')]({'where':{'id':_0x4b989c[_0xd820('0x42')]['id']}})[_0xd820('0x22')](handleEntityNotFound(_0x352c50,null))[_0xd820('0x22')](saveUpdates(_['pick'](_0x4b989c[_0xd820('0x6a')],['name',_0xd820('0x72')]),null))['then'](respondWithResult(_0x352c50,null))[_0xd820('0x40')](handleError(_0x352c50,null));};exports['delete']=function(_0x48dd77,_0x38322d,_0x147448){return db[_0xd820('0x3e')]['find']({'where':{'id':_0x48dd77[_0xd820('0x42')]['id']}})[_0xd820('0x22')](function(_0x1f3192){if(_0x1f3192){return _0x1f3192[_0xd820('0x21')]();}})[_0xd820('0x22')](function(_0x36acbb){var _0x987607=path[_0xd820('0x47')](config[_0xd820('0x48')],_0xd820('0x55'),util['format'](_0xd820('0x4d'),_0x36acbb['save_name'],_0x36acbb[_0xd820('0x73')]));var _0x39e85c=path[_0xd820('0x47')](config[_0xd820('0x48')],_0xd820('0x49'),util[_0xd820('0x4c')](_0xd820('0x4d'),_0x36acbb[_0xd820('0x4a')],_0x36acbb['converted_format']));fs[_0xd820('0x5b')](_0x987607);fs[_0xd820('0x5b')](_0x39e85c);return _0x36acbb;})[_0xd820('0x22')](function(_0x100846){if(_0x100846){return _0x38322d[_0xd820('0x16')](0xcc)[_0xd820('0x15')]();}})[_0xd820('0x22')](handleEntityNotFound(_0x38322d,null))['catch'](handleError(_0x38322d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index cad9ef5..a521aa9 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 _0x9f81=['moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','../../config/logger','api'];(function(_0x5d27bc,_0x3a7b60){var _0x5734cc=function(_0xcc5c8f){while(--_0xcc5c8f){_0x5d27bc['push'](_0x5d27bc['shift']());}};_0x5734cc(++_0x3a7b60);}(_0x9f81,0x1ee));var _0x19f8=function(_0x4d8311,_0x5dd75d){_0x4d8311=_0x4d8311-0x0;var _0x256440=_0x9f81[_0x4d8311];return _0x256440;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19f8('0x0'))(_0x19f8('0x1'));var moment=require(_0x19f8('0x2'));var BPromise=require(_0x19f8('0x3'));var rp=require(_0x19f8('0x4'));var fs=require('fs');var path=require(_0x19f8('0x5'));var rimraf=require('rimraf');var config=require(_0x19f8('0x6'));var attributes=require(_0x19f8('0x7'));module['exports']=function(_0x4e715d,_0x10ec4e){return _0x4e715d['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf133=['moment','bluebird','path','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','../../config/logger','api'];(function(_0x3c10b7,_0x10fb4a){var _0xbd891b=function(_0x256dc3){while(--_0x256dc3){_0x3c10b7['push'](_0x3c10b7['shift']());}};_0xbd891b(++_0x10fb4a);}(_0xf133,0x17f));var _0x3f13=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf133[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f13('0x0'))(_0x3f13('0x1'));var moment=require(_0x3f13('0x2'));var BPromise=require(_0x3f13('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f13('0x4'));var rimraf=require(_0x3f13('0x5'));var config=require('../../config/environment');var attributes=require(_0x3f13('0x6'));module[_0x3f13('0x7')]=function(_0x27bab7,_0x16746a){return _0x27bab7[_0x3f13('0x8')](_0x3f13('0x9'),attributes,{'tableName':_0x3f13('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index d9246f4..b69dab8 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 _0x60c5=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','options','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x60c5,0x66));var _0x560c=function(_0x14351f,_0x2f62a6){_0x14351f=_0x14351f-0x0;var _0x15beda=_0x60c5[_0x14351f];return _0x15beda;};'use strict';var _=require(_0x560c('0x0'));var util=require(_0x560c('0x1'));var moment=require('moment');var BPromise=require(_0x560c('0x2'));var rs=require(_0x560c('0x3'));var fs=require('fs');var Redis=require(_0x560c('0x4'));var db=require(_0x560c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x560c('0x6'))(_0x560c('0x7'));var config=require('../../config/environment');var jayson=require(_0x560c('0x8'));var client=jayson[_0x560c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3263ef,_0x30b4ee,_0x16412c){return new BPromise(function(_0x20f61e,_0x587b4c){return client[_0x560c('0xa')](_0x3263ef,_0x16412c)[_0x560c('0xb')](function(_0x9ed3a1){logger[_0x560c('0xc')](_0x560c('0xd'),_0x30b4ee,_0x560c('0xe'));logger[_0x560c('0xf')](_0x560c('0x10'),_0x30b4ee,'request\x20sent',JSON[_0x560c('0x11')](_0x9ed3a1));if(_0x9ed3a1[_0x560c('0x12')]){if(_0x9ed3a1['error']['code']===0x1f4){logger[_0x560c('0x12')](_0x560c('0xd'),_0x30b4ee,_0x9ed3a1[_0x560c('0x12')][_0x560c('0x13')]);return _0x587b4c(_0x9ed3a1[_0x560c('0x12')]['message']);}logger[_0x560c('0x12')](_0x560c('0xd'),_0x30b4ee,_0x9ed3a1[_0x560c('0x12')][_0x560c('0x13')]);return _0x20f61e(_0x9ed3a1[_0x560c('0x12')][_0x560c('0x13')]);}else{logger[_0x560c('0xc')](_0x560c('0xd'),_0x30b4ee,_0x560c('0xe'));_0x20f61e(_0x9ed3a1[_0x560c('0x14')][_0x560c('0x13')]);}})[_0x560c('0x15')](function(_0x2d1f80){logger['error']('Sound,\x20%s,\x20%s',_0x30b4ee,_0x2d1f80);_0x587b4c(_0x2d1f80);});});}exports[_0x560c('0x16')]=function(_0x51a1b0){var _0x57cfbc=this;return new Promise(function(_0x5914e6,_0x1a0bf5){return db[_0x560c('0x17')]['find']({'raw':_0x51a1b0[_0x560c('0x18')]?_0x51a1b0[_0x560c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51a1b0[_0x560c('0x18')]?_0x51a1b0['options']['where']||null:null,'attributes':_0x51a1b0[_0x560c('0x18')]?_0x51a1b0['options'][_0x560c('0x19')]||null:null,'include':_0x51a1b0[_0x560c('0x18')]?_0x51a1b0['options'][_0x560c('0x1a')]?_[_0x560c('0x1b')](_0x51a1b0['options'][_0x560c('0x1a')],function(_0x45651c){return{'model':db[_0x45651c[_0x560c('0x1c')]],'as':_0x45651c['as'],'attributes':_0x45651c[_0x560c('0x19')],'include':_0x45651c[_0x560c('0x1a')]?_['map'](_0x45651c[_0x560c('0x1a')],function(_0x15645c){return{'model':db[_0x15645c[_0x560c('0x1c')]],'as':_0x15645c['as'],'attributes':_0x15645c['attributes'],'include':_0x15645c[_0x560c('0x1a')]?_['map'](_0x15645c[_0x560c('0x1a')],function(_0x5bb75a){return{'model':db[_0x5bb75a[_0x560c('0x1c')]],'as':_0x5bb75a['as'],'attributes':_0x5bb75a[_0x560c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x560c('0xb')](function(_0x15212c){logger['info'](_0x560c('0x16'),_0x51a1b0);logger[_0x560c('0xf')](_0x560c('0x16'),_0x51a1b0,JSON[_0x560c('0x11')](_0x15212c));_0x5914e6(_0x15212c);})['catch'](function(_0x34ee88){logger[_0x560c('0x12')](_0x560c('0x16'),_0x34ee88[_0x560c('0x13')],_0x51a1b0);_0x1a0bf5(_0x57cfbc[_0x560c('0x12')](0x1f4,_0x34ee88['message']));});});}; \ No newline at end of file +var _0x8009=['find','options','where','include','map','model','attributes','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','request','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0x8009,0x1ad));var _0x9800=function(_0x599d19,_0x2d71d3){_0x599d19=_0x599d19-0x0;var _0x56087a=_0x8009[_0x599d19];return _0x56087a;};'use strict';var _=require(_0x9800('0x0'));var util=require(_0x9800('0x1'));var moment=require('moment');var BPromise=require(_0x9800('0x2'));var rs=require(_0x9800('0x3'));var fs=require('fs');var Redis=require(_0x9800('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9800('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9800('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cf955,_0x14fd17,_0xf5afa0){return new BPromise(function(_0x728e79,_0x5ebc93){return client[_0x9800('0x7')](_0x1cf955,_0xf5afa0)[_0x9800('0x8')](function(_0x18d961){logger[_0x9800('0x9')](_0x9800('0xa'),_0x14fd17,'request\x20sent');logger['debug'](_0x9800('0xb'),_0x14fd17,_0x9800('0xc'),JSON[_0x9800('0xd')](_0x18d961));if(_0x18d961[_0x9800('0xe')]){if(_0x18d961['error'][_0x9800('0xf')]===0x1f4){logger[_0x9800('0xe')]('Sound,\x20%s,\x20%s',_0x14fd17,_0x18d961['error'][_0x9800('0x10')]);return _0x5ebc93(_0x18d961['error'][_0x9800('0x10')]);}logger[_0x9800('0xe')]('Sound,\x20%s,\x20%s',_0x14fd17,_0x18d961[_0x9800('0xe')]['message']);return _0x728e79(_0x18d961[_0x9800('0xe')][_0x9800('0x10')]);}else{logger[_0x9800('0x9')](_0x9800('0xa'),_0x14fd17,_0x9800('0xc'));_0x728e79(_0x18d961[_0x9800('0x11')][_0x9800('0x10')]);}})['catch'](function(_0x3e9d54){logger[_0x9800('0xe')](_0x9800('0xa'),_0x14fd17,_0x3e9d54);_0x5ebc93(_0x3e9d54);});});}exports[_0x9800('0x12')]=function(_0x4871f3){var _0x2067cc=this;return new Promise(function(_0x35bca2,_0x2a478c){return db['Sound'][_0x9800('0x13')]({'raw':_0x4871f3[_0x9800('0x14')]?_0x4871f3[_0x9800('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4871f3[_0x9800('0x14')]?_0x4871f3[_0x9800('0x14')][_0x9800('0x15')]||null:null,'attributes':_0x4871f3[_0x9800('0x14')]?_0x4871f3[_0x9800('0x14')]['attributes']||null:null,'include':_0x4871f3['options']?_0x4871f3[_0x9800('0x14')][_0x9800('0x16')]?_[_0x9800('0x17')](_0x4871f3[_0x9800('0x14')][_0x9800('0x16')],function(_0x59b25c){return{'model':db[_0x59b25c[_0x9800('0x18')]],'as':_0x59b25c['as'],'attributes':_0x59b25c[_0x9800('0x19')],'include':_0x59b25c[_0x9800('0x16')]?_[_0x9800('0x17')](_0x59b25c[_0x9800('0x16')],function(_0x5e2a0a){return{'model':db[_0x5e2a0a[_0x9800('0x18')]],'as':_0x5e2a0a['as'],'attributes':_0x5e2a0a[_0x9800('0x19')],'include':_0x5e2a0a[_0x9800('0x16')]?_[_0x9800('0x17')](_0x5e2a0a[_0x9800('0x16')],function(_0xe4b3c3){return{'model':db[_0xe4b3c3[_0x9800('0x18')]],'as':_0xe4b3c3['as'],'attributes':_0xe4b3c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x9800('0x8')](function(_0x48d20b){logger[_0x9800('0x9')](_0x9800('0x12'),_0x4871f3);logger[_0x9800('0x1a')](_0x9800('0x12'),_0x4871f3,JSON[_0x9800('0xd')](_0x48d20b));_0x35bca2(_0x48d20b);})[_0x9800('0x1b')](function(_0xfe5188){logger[_0x9800('0xe')](_0x9800('0x12'),_0xfe5188[_0x9800('0x10')],_0x4871f3);_0x2a478c(_0x2067cc['error'](0x1f4,_0xfe5188[_0x9800('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7de3a3a..80c58ad 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x4fc2,0x111));var _0x24fc=function(_0x51fa1c,_0x14a2f8){_0x51fa1c=_0x51fa1c-0x0;var _0x3f3286=_0x4fc2[_0x51fa1c];return _0x3f3286;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x44e843,_0x18e958){var _0x4f0a2d=function(_0xd7cb2){while(--_0xd7cb2){_0x44e843['push'](_0x44e843['shift']());}};_0x4f0a2d(++_0x18e958);}(_0x2032,0xd9));var _0x2203=function(_0x405d8f,_0xf0cbc8){_0x405d8f=_0x405d8f-0x0;var _0xa3ed2c=_0x2032[_0x405d8f];return _0xa3ed2c;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index db1aa59..e7fb96a 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 _0x7110=['sequelize','STRING','TEXT','out'];(function(_0x49d6e4,_0x1af05e){var _0x3a142f=function(_0xe69ceb){while(--_0xe69ceb){_0x49d6e4['push'](_0x49d6e4['shift']());}};_0x3a142f(++_0x1af05e);}(_0x7110,0x12c));var _0x0711=function(_0x435975,_0x2f1fcb){_0x435975=_0x435975-0x0;var _0x43f898=_0x7110[_0x435975];return _0x43f898;};'use strict';var Sequelize=require(_0x0711('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0711('0x1')]},'body':{'type':Sequelize[_0x0711('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x0711('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x0711('0x1')]},'providerResponse':{'type':Sequelize[_0x0711('0x2')]}}; \ No newline at end of file +var _0xd3a6=['out','TEXT','sequelize','exports','STRING','medium','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3a6,0x79));var _0x6d3a=function(_0x5f3110,_0x484b76){_0x5f3110=_0x5f3110-0x0;var _0x570314=_0xd3a6[_0x5f3110];return _0x570314;};'use strict';var Sequelize=require(_0x6d3a('0x0'));module[_0x6d3a('0x1')]={'uniqueid':{'type':Sequelize[_0x6d3a('0x2')]},'body':{'type':Sequelize['TEXT'](_0x6d3a('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6d3a('0x4')]('in','out'),'defaultValue':_0x6d3a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6d3a('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6300e67..ca044c9 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 _0xf831=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','SquareMessage','fieldName'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf831,0x10b));var _0x1f83=function(_0xf9456c,_0x548fae){_0xf9456c=_0xf9456c-0x0;var _0x389d91=_0xf831[_0xf9456c];return _0x389d91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f83('0x0'));var jsonpatch=require(_0x1f83('0x1'));var rp=require(_0x1f83('0x2'));var moment=require(_0x1f83('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f83('0x4'));var util=require(_0x1f83('0x5'));var path=require(_0x1f83('0x6'));var sox=require(_0x1f83('0x7'));var csv=require('to-csv');var ejs=require(_0x1f83('0x8'));var fs=require('fs');var fs_extra=require(_0x1f83('0x9'));var _=require(_0x1f83('0xa'));var squel=require('squel');var crypto=require(_0x1f83('0xb'));var jsforce=require(_0x1f83('0xc'));var deskjs=require(_0x1f83('0xd'));var toCsv=require(_0x1f83('0xe'));var querystring=require(_0x1f83('0xf'));var Papa=require(_0x1f83('0x10'));var Redis=require(_0x1f83('0x11'));var authService=require(_0x1f83('0x12'));var qs=require(_0x1f83('0x13'));var as=require(_0x1f83('0x14'));var hardwareService=require(_0x1f83('0x15'));var logger=require(_0x1f83('0x16'))(_0x1f83('0x17'));var utils=require(_0x1f83('0x18'));var config=require(_0x1f83('0x19'));var licenseUtil=require(_0x1f83('0x1a'));var db=require(_0x1f83('0x1b'))['db'];function respondWithStatusCode(_0x472011,_0x134575){_0x134575=_0x134575||0xcc;return function(_0x2408a7){if(_0x2408a7){return _0x472011[_0x1f83('0x1c')](_0x134575);}return _0x472011[_0x1f83('0x1d')](_0x134575)[_0x1f83('0x1e')]();};}function respondWithResult(_0x3ffe71,_0x241378){_0x241378=_0x241378||0xc8;return function(_0x48496d){if(_0x48496d){return _0x3ffe71[_0x1f83('0x1d')](_0x241378)[_0x1f83('0x1f')](_0x48496d);}};}function respondWithFilteredResult(_0x36f411,_0x22a368){return function(_0x2d8405){if(_0x2d8405){var _0x239e11=typeof _0x22a368[_0x1f83('0x20')]==='undefined'&&typeof _0x22a368[_0x1f83('0x21')]==='undefined';var _0x33ad3a=_0x2d8405[_0x1f83('0x22')];var _0x11033b=_0x239e11?0x0:_0x22a368['offset'];var _0x312b84=_0x239e11?_0x2d8405[_0x1f83('0x22')]:_0x22a368['offset']+_0x22a368[_0x1f83('0x21')];var _0x51a87a;if(_0x312b84>=_0x33ad3a){_0x312b84=_0x33ad3a;_0x51a87a=0xc8;}else{_0x51a87a=0xce;}_0x36f411[_0x1f83('0x1d')](_0x51a87a);return _0x36f411[_0x1f83('0x23')](_0x1f83('0x24'),_0x11033b+'-'+_0x312b84+'/'+_0x33ad3a)[_0x1f83('0x1f')](_0x2d8405);}return null;};}function patchUpdates(_0x53fe3c){return function(_0x249c85){try{jsonpatch[_0x1f83('0x25')](_0x249c85,_0x53fe3c,!![]);}catch(_0x4ef76d){return BPromise[_0x1f83('0x26')](_0x4ef76d);}return _0x249c85[_0x1f83('0x27')]();};}function saveUpdates(_0x3673df,_0x296702){return function(_0x37475b){if(_0x37475b){return _0x37475b['update'](_0x3673df)['then'](function(_0x3b225d){return _0x3b225d;});}return null;};}function removeEntity(_0xe7d451,_0x585fd5){return function(_0x431ffe){if(_0x431ffe){return _0x431ffe[_0x1f83('0x28')]()[_0x1f83('0x29')](function(){_0xe7d451['status'](0xcc)[_0x1f83('0x1e')]();});}};}function handleEntityNotFound(_0x5a1d8d,_0x1484ad){return function(_0x5922a5){if(!_0x5922a5){_0x5a1d8d[_0x1f83('0x1c')](0x194);}return _0x5922a5;};}function handleError(_0x5718c8,_0x348fbd){_0x348fbd=_0x348fbd||0x1f4;return function(_0x4619fb){logger['error'](_0x4619fb[_0x1f83('0x2a')]);if(_0x4619fb['name']){delete _0x4619fb[_0x1f83('0x2b')];}_0x5718c8[_0x1f83('0x1d')](_0x348fbd)[_0x1f83('0x2c')](_0x4619fb);};}exports[_0x1f83('0x2d')]=function(_0x580c27,_0x392162){var _0x46ca68={},_0x3b0db1={},_0x2e2a00={'count':0x0,'rows':[]};var _0x4549ed=_[_0x1f83('0x2e')](db[_0x1f83('0x2f')]['rawAttributes'],function(_0x1f37ab){return{'name':_0x1f37ab[_0x1f83('0x30')],'type':_0x1f37ab[_0x1f83('0x31')][_0x1f83('0x32')]};});_0x3b0db1[_0x1f83('0x33')]=_[_0x1f83('0x2e')](_0x4549ed,'name');_0x3b0db1[_0x1f83('0x34')]=_[_0x1f83('0x35')](_0x580c27['query']);_0x3b0db1[_0x1f83('0x36')]=_[_0x1f83('0x37')](_0x3b0db1['model'],_0x3b0db1[_0x1f83('0x34')]);_0x46ca68['attributes']=_[_0x1f83('0x37')](_0x3b0db1[_0x1f83('0x33')],qs['fields'](_0x580c27[_0x1f83('0x34')][_0x1f83('0x38')]));_0x46ca68['attributes']=_0x46ca68[_0x1f83('0x39')][_0x1f83('0x3a')]?_0x46ca68['attributes']:_0x3b0db1[_0x1f83('0x33')];if(!_0x580c27['query'][_0x1f83('0x3b')]('nolimit')){_0x46ca68['limit']=qs['limit'](_0x580c27['query'][_0x1f83('0x21')]);_0x46ca68['offset']=qs[_0x1f83('0x20')](_0x580c27['query'][_0x1f83('0x20')]);}_0x46ca68[_0x1f83('0x3c')]=qs[_0x1f83('0x3d')](_0x580c27[_0x1f83('0x34')][_0x1f83('0x3d')]);_0x46ca68[_0x1f83('0x3e')]=qs[_0x1f83('0x36')](_['pick'](_0x580c27[_0x1f83('0x34')],_0x3b0db1['filters']),_0x4549ed);if(_0x580c27[_0x1f83('0x34')][_0x1f83('0x3f')]){_0x46ca68[_0x1f83('0x3e')]=_['merge'](_0x46ca68[_0x1f83('0x3e')],{'$or':_[_0x1f83('0x2e')](_0x4549ed,function(_0x35ef0d){if(_0x35ef0d[_0x1f83('0x31')]!==_0x1f83('0x40')){var _0x5f4e4d={};_0x5f4e4d[_0x35ef0d[_0x1f83('0x2b')]]={'$like':'%'+_0x580c27[_0x1f83('0x34')][_0x1f83('0x3f')]+'%'};return _0x5f4e4d;}})});}_0x46ca68=_[_0x1f83('0x41')]({},_0x46ca68,_0x580c27[_0x1f83('0x42')]);var _0x29b879={'where':_0x46ca68['where']};return db[_0x1f83('0x2f')][_0x1f83('0x22')](_0x29b879)[_0x1f83('0x29')](function(_0x4c9d37){_0x2e2a00['count']=_0x4c9d37;if(_0x580c27[_0x1f83('0x34')][_0x1f83('0x43')]){_0x46ca68[_0x1f83('0x44')]=[{'all':!![]}];}return db[_0x1f83('0x2f')][_0x1f83('0x45')](_0x46ca68);})['then'](function(_0x19d59c){_0x2e2a00[_0x1f83('0x46')]=_0x19d59c;return _0x2e2a00;})[_0x1f83('0x29')](respondWithFilteredResult(_0x392162,_0x46ca68))[_0x1f83('0x47')](handleError(_0x392162,null));};exports[_0x1f83('0x48')]=function(_0x375b93,_0x3a590d){var _0x4e9a82={'raw':!![],'where':{'id':_0x375b93['params']['id']}},_0x168333={};_0x168333[_0x1f83('0x33')]=_[_0x1f83('0x35')](db['SquareMessage'][_0x1f83('0x49')]);_0x168333[_0x1f83('0x34')]=_[_0x1f83('0x35')](_0x375b93['query']);_0x168333['filters']=_['intersection'](_0x168333['model'],_0x168333[_0x1f83('0x34')]);_0x4e9a82['attributes']=_[_0x1f83('0x37')](_0x168333[_0x1f83('0x33')],qs[_0x1f83('0x38')](_0x375b93[_0x1f83('0x34')][_0x1f83('0x38')]));_0x4e9a82['attributes']=_0x4e9a82['attributes'][_0x1f83('0x3a')]?_0x4e9a82[_0x1f83('0x39')]:_0x168333[_0x1f83('0x33')];if(_0x375b93[_0x1f83('0x34')][_0x1f83('0x43')]){_0x4e9a82['include']=[{'all':!![]}];}_0x4e9a82=_[_0x1f83('0x41')]({},_0x4e9a82,_0x375b93[_0x1f83('0x42')]);return db[_0x1f83('0x2f')][_0x1f83('0x4a')](_0x4e9a82)[_0x1f83('0x29')](handleEntityNotFound(_0x3a590d,null))[_0x1f83('0x29')](respondWithResult(_0x3a590d,null))[_0x1f83('0x47')](handleError(_0x3a590d,null));};exports[_0x1f83('0x4b')]=function(_0x361955,_0x4dd583){return db[_0x1f83('0x2f')]['create'](_0x361955[_0x1f83('0x4c')],{})['then'](respondWithResult(_0x4dd583,0xc9))[_0x1f83('0x47')](handleError(_0x4dd583,null));};exports[_0x1f83('0x4d')]=function(_0xa44014,_0x5ac194){if(_0xa44014[_0x1f83('0x4c')]['id']){delete _0xa44014[_0x1f83('0x4c')]['id'];}return db[_0x1f83('0x2f')]['find']({'where':{'id':_0xa44014['params']['id']}})['then'](handleEntityNotFound(_0x5ac194,null))['then'](saveUpdates(_0xa44014[_0x1f83('0x4c')],null))[_0x1f83('0x29')](respondWithResult(_0x5ac194,null))[_0x1f83('0x47')](handleError(_0x5ac194,null));};exports['destroy']=function(_0x37f0b7,_0x260e38){return db[_0x1f83('0x2f')][_0x1f83('0x4a')]({'where':{'id':_0x37f0b7[_0x1f83('0x4e')]['id']}})[_0x1f83('0x29')](handleEntityNotFound(_0x260e38,null))[_0x1f83('0x29')](removeEntity(_0x260e38,null))[_0x1f83('0x47')](handleError(_0x260e38,null));}; \ No newline at end of file +var _0x14a0=['moment','bluebird','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','SquareMessage','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','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x14b407,_0x21f49d){var _0x31bf39=function(_0x4740fb){while(--_0x4740fb){_0x14b407['push'](_0x14b407['shift']());}};_0x31bf39(++_0x21f49d);}(_0x14a0,0x8e));var _0x014a=function(_0x3cc8e2,_0x2665a9){_0x3cc8e2=_0x3cc8e2-0x0;var _0x51ea34=_0x14a0[_0x3cc8e2];return _0x51ea34;};'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['SquareMessage'][_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['SquareMessage'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9ec64fd..1000c89 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 _0xf697=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash'];(function(_0x349341,_0x1f36a2){var _0x218b22=function(_0x3a7aa7){while(--_0x3a7aa7){_0x349341['push'](_0x349341['shift']());}};_0x218b22(++_0x1f36a2);}(_0xf697,0x17f));var _0x7f69=function(_0x3d3379,_0x4c9bc1){_0x3d3379=_0x3d3379-0x0;var _0x358633=_0xf697[_0x3d3379];return _0x358633;};'use strict';var _=require(_0x7f69('0x0'));var util=require('util');var logger=require(_0x7f69('0x1'))(_0x7f69('0x2'));var moment=require(_0x7f69('0x3'));var BPromise=require(_0x7f69('0x4'));var rp=require(_0x7f69('0x5'));var fs=require('fs');var path=require(_0x7f69('0x6'));var rimraf=require(_0x7f69('0x7'));var config=require(_0x7f69('0x8'));var attributes=require(_0x7f69('0x9'));module[_0x7f69('0xa')]=function(_0x338962,_0x533c67){return _0x338962[_0x7f69('0xb')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfd7=['define','SquareMessage','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareMessage.attributes','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xcfd7,0x199));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7cfd('0x0'));var util=require('util');var logger=require(_0x7cfd('0x1'))(_0x7cfd('0x2'));var moment=require(_0x7cfd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7cfd('0x4'));var fs=require('fs');var path=require(_0x7cfd('0x5'));var rimraf=require('rimraf');var config=require(_0x7cfd('0x6'));var attributes=require(_0x7cfd('0x7'));module[_0x7cfd('0x8')]=function(_0x3f98c4,_0x483d1d){return _0x3f98c4[_0x7cfd('0x9')](_0x7cfd('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 16ee894..0334af2 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 _0xdb9a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','stringify','util','bluebird','randomstring'];(function(_0x3f4f3b,_0x2d7be2){var _0xfc6f02=function(_0x226ae2){while(--_0x226ae2){_0x3f4f3b['push'](_0x3f4f3b['shift']());}};_0xfc6f02(++_0x2d7be2);}(_0xdb9a,0xab));var _0xadb9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdb9a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xadb9('0x0'));var moment=require('moment');var BPromise=require(_0xadb9('0x1'));var rs=require(_0xadb9('0x2'));var fs=require('fs');var Redis=require(_0xadb9('0x3'));var db=require(_0xadb9('0x4'))['db'];var utils=require(_0xadb9('0x5'));var logger=require(_0xadb9('0x6'))(_0xadb9('0x7'));var config=require('../../config/environment');var jayson=require(_0xadb9('0x8'));var client=jayson['client'][_0xadb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49634c,_0x524d18,_0xd40e9c){return new BPromise(function(_0x42d290,_0x547d03){return client[_0xadb9('0xa')](_0x49634c,_0xd40e9c)[_0xadb9('0xb')](function(_0x59b95b){logger[_0xadb9('0xc')](_0xadb9('0xd'),_0x524d18,_0xadb9('0xe'));logger['debug'](_0xadb9('0xf'),_0x524d18,'request\x20sent',JSON['stringify'](_0x59b95b));if(_0x59b95b[_0xadb9('0x10')]){if(_0x59b95b['error'][_0xadb9('0x11')]===0x1f4){logger[_0xadb9('0x10')](_0xadb9('0xd'),_0x524d18,_0x59b95b['error'][_0xadb9('0x12')]);return _0x547d03(_0x59b95b['error']['message']);}logger['error'](_0xadb9('0xd'),_0x524d18,_0x59b95b[_0xadb9('0x10')][_0xadb9('0x12')]);return _0x42d290(_0x59b95b['error'][_0xadb9('0x12')]);}else{logger[_0xadb9('0xc')](_0xadb9('0xd'),_0x524d18,'request\x20sent');_0x42d290(_0x59b95b[_0xadb9('0x13')]['message']);}})[_0xadb9('0x14')](function(_0x48c66f){logger[_0xadb9('0x10')](_0xadb9('0xd'),_0x524d18,_0x48c66f);_0x547d03(_0x48c66f);});});}exports[_0xadb9('0x15')]=function(_0x578272){var _0x326d8f=this;return new Promise(function(_0x3cc539,_0x1ece51){return db[_0xadb9('0x16')][_0xadb9('0x17')](_0x578272[_0xadb9('0x18')],{'raw':_0x578272[_0xadb9('0x19')]?_0x578272[_0xadb9('0x19')][_0xadb9('0x1a')]===undefined?!![]:![]:!![]})[_0xadb9('0xb')](function(_0xfe8bf){logger[_0xadb9('0xc')]('CreateSquareMessage',_0x578272);logger[_0xadb9('0x1b')](_0xadb9('0x15'),_0x578272,JSON[_0xadb9('0x1c')](_0xfe8bf));_0x3cc539(_0xfe8bf);})[_0xadb9('0x14')](function(_0x5d8b02){logger[_0xadb9('0x10')](_0xadb9('0x15'),_0x5d8b02[_0xadb9('0x12')],_0x578272);_0x1ece51(_0x326d8f[_0xadb9('0x10')](0x1f4,_0x5d8b02[_0xadb9('0x12')]));});});}; \ No newline at end of file +var _0xa20e=['SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','stringify','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info'];(function(_0x3612ba,_0x42bd24){var _0x6b50cb=function(_0x20aafd){while(--_0x20aafd){_0x3612ba['push'](_0x3612ba['shift']());}};_0x6b50cb(++_0x42bd24);}(_0xa20e,0x6e));var _0xea20=function(_0x66ef11,_0x42f78b){_0x66ef11=_0x66ef11-0x0;var _0x318579=_0xa20e[_0x66ef11];return _0x318579;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xea20('0x0'));var rs=require(_0xea20('0x1'));var fs=require('fs');var Redis=require(_0xea20('0x2'));var db=require(_0xea20('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xea20('0x4'))(_0xea20('0x5'));var config=require(_0xea20('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xea20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42c6c1,_0x1cb9c9,_0x3d661e){return new BPromise(function(_0xbe345e,_0x3b2285){return client['request'](_0x42c6c1,_0x3d661e)[_0xea20('0x8')](function(_0x5c6088){logger[_0xea20('0x9')](_0xea20('0xa'),_0x1cb9c9,_0xea20('0xb'));logger['debug'](_0xea20('0xc'),_0x1cb9c9,'request\x20sent',JSON['stringify'](_0x5c6088));if(_0x5c6088['error']){if(_0x5c6088[_0xea20('0xd')]['code']===0x1f4){logger[_0xea20('0xd')](_0xea20('0xa'),_0x1cb9c9,_0x5c6088[_0xea20('0xd')][_0xea20('0xe')]);return _0x3b2285(_0x5c6088[_0xea20('0xd')][_0xea20('0xe')]);}logger[_0xea20('0xd')](_0xea20('0xa'),_0x1cb9c9,_0x5c6088[_0xea20('0xd')][_0xea20('0xe')]);return _0xbe345e(_0x5c6088['error'][_0xea20('0xe')]);}else{logger[_0xea20('0x9')]('SquareMessage,\x20%s,\x20%s',_0x1cb9c9,'request\x20sent');_0xbe345e(_0x5c6088[_0xea20('0xf')][_0xea20('0xe')]);}})[_0xea20('0x10')](function(_0x17f73e){logger[_0xea20('0xd')](_0xea20('0xa'),_0x1cb9c9,_0x17f73e);_0x3b2285(_0x17f73e);});});}exports['CreateSquareMessage']=function(_0x2d7900){var _0x42a3fb=this;return new Promise(function(_0x5b33e3,_0x4375f4){return db[_0xea20('0x11')]['create'](_0x2d7900[_0xea20('0x12')],{'raw':_0x2d7900[_0xea20('0x13')]?_0x2d7900[_0xea20('0x13')][_0xea20('0x14')]===undefined?!![]:![]:!![]})[_0xea20('0x8')](function(_0x159720){logger[_0xea20('0x9')](_0xea20('0x15'),_0x2d7900);logger[_0xea20('0x16')]('CreateSquareMessage',_0x2d7900,JSON[_0xea20('0x17')](_0x159720));_0x5b33e3(_0x159720);})['catch'](function(_0x415e0a){logger[_0xea20('0xd')](_0xea20('0x15'),_0x415e0a[_0xea20('0xe')],_0x2d7900);_0x4375f4(_0x42a3fb[_0xea20('0xd')](0x1f4,_0x415e0a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 84be020..2613d81 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 _0x8912=['../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','test','create','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4553ef,_0x1e2670){var _0x3a5e3f=function(_0x2be6ab){while(--_0x2be6ab){_0x4553ef['push'](_0x4553ef['shift']());}};_0x3a5e3f(++_0x1e2670);}(_0x8912,0x1af));var _0x2891=function(_0x46e543,_0xd8916f){_0x46e543=_0x46e543-0x0;var _0x23ac47=_0x8912[_0x46e543];return _0x23ac47;};'use strict';var multer=require(_0x2891('0x0'));var util=require('util');var path=require(_0x2891('0x1'));var timeout=require(_0x2891('0x2'));var express=require(_0x2891('0x3'));var router=express['Router']();var fs_extra=require(_0x2891('0x4'));var auth=require(_0x2891('0x5'));var interaction=require(_0x2891('0x6'));var config=require('../../config/environment');var controller=require(_0x2891('0x7'));router['get']('/',auth[_0x2891('0x8')](),controller[_0x2891('0x9')]);router[_0x2891('0xa')](_0x2891('0xb'),auth[_0x2891('0x8')](),controller[_0x2891('0xc')]);router[_0x2891('0xa')](_0x2891('0xd'),auth[_0x2891('0x8')](),timeout('15s'),controller[_0x2891('0xe')]);router['post']('/',auth[_0x2891('0x8')](),controller[_0x2891('0xf')]);router[_0x2891('0x10')](_0x2891('0xb'),auth[_0x2891('0x8')](),controller[_0x2891('0x11')]);router['delete'](_0x2891('0xb'),auth[_0x2891('0x8')](),controller[_0x2891('0x12')]);module['exports']=router; \ No newline at end of file +var _0xda7f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','15s','test','post','create','update','delete','destroy','exports','multer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xda7f,0xa0));var _0xfda7=function(_0x1c06fa,_0x15e4b5){_0x1c06fa=_0x1c06fa-0x0;var _0x11f1e8=_0xda7f[_0x1c06fa];return _0x11f1e8;};'use strict';var multer=require(_0xfda7('0x0'));var util=require('util');var path=require(_0xfda7('0x1'));var timeout=require(_0xfda7('0x2'));var express=require(_0xfda7('0x3'));var router=express[_0xfda7('0x4')]();var fs_extra=require(_0xfda7('0x5'));var auth=require(_0xfda7('0x6'));var interaction=require(_0xfda7('0x7'));var config=require(_0xfda7('0x8'));var controller=require(_0xfda7('0x9'));router['get']('/',auth[_0xfda7('0xa')](),controller[_0xfda7('0xb')]);router[_0xfda7('0xc')](_0xfda7('0xd'),auth[_0xfda7('0xa')](),controller[_0xfda7('0xe')]);router[_0xfda7('0xc')]('/:id/test',auth[_0xfda7('0xa')](),timeout(_0xfda7('0xf')),controller[_0xfda7('0x10')]);router[_0xfda7('0x11')]('/',auth['isAuthenticated'](),controller[_0xfda7('0x12')]);router['put']('/:id',auth[_0xfda7('0xa')](),controller[_0xfda7('0x13')]);router[_0xfda7('0x14')](_0xfda7('0xd'),auth[_0xfda7('0xa')](),controller[_0xfda7('0x15')]);module[_0xfda7('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 81f7f56..7744b8b 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 _0xf94d=['STRING'];(function(_0x5997df,_0x546d57){var _0x25df4f=function(_0x1ac603){while(--_0x1ac603){_0x5997df['push'](_0x5997df['shift']());}};_0x25df4f(++_0x546d57);}(_0xf94d,0x1d0));var _0xdf94=function(_0x20b734,_0x1a9bc9){_0x20b734=_0x20b734-0x0;var _0x784ae6=_0xf94d[_0x20b734];return _0x784ae6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdf94('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xdf94('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe385=['name','sequelize','exports','STRING'];(function(_0x18dedd,_0x4cb9e5){var _0x35b7e1=function(_0x429eb0){while(--_0x429eb0){_0x18dedd['push'](_0x18dedd['shift']());}};_0x35b7e1(++_0x4cb9e5);}(_0xe385,0x169));var _0x5e38=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe385[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x5e38('0x0'));module[_0x5e38('0x1')]={'name':{'type':Sequelize[_0x5e38('0x2')],'unique':_0x5e38('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5e38('0x2')]},'description':{'type':Sequelize[_0x5e38('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 31514fe..db3dd8b 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 _0x6430=['openSync','dsn','closeSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','UserProfileResource','stack','name','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','error','test','odbc'];(function(_0x2c06de,_0x5305d0){var _0x4ac16=function(_0x321023){while(--_0x321023){_0x2c06de['push'](_0x2c06de['shift']());}};_0x4ac16(++_0x5305d0);}(_0x6430,0x15f));var _0x0643=function(_0x80216f,_0x257756){_0x80216f=_0x80216f-0x0;var _0x34d176=_0x6430[_0x80216f];return _0x34d176;};'use strict';var emlformat=require(_0x0643('0x0'));var rimraf=require(_0x0643('0x1'));var zipdir=require(_0x0643('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0643('0x3'));var BPromise=require(_0x0643('0x4'));var Mustache=require(_0x0643('0x5'));var util=require(_0x0643('0x6'));var path=require(_0x0643('0x7'));var sox=require(_0x0643('0x8'));var csv=require(_0x0643('0x9'));var ejs=require(_0x0643('0xa'));var fs=require('fs');var fs_extra=require(_0x0643('0xb'));var _=require(_0x0643('0xc'));var squel=require('squel');var crypto=require(_0x0643('0xd'));var jsforce=require(_0x0643('0xe'));var deskjs=require(_0x0643('0xf'));var toCsv=require(_0x0643('0x9'));var querystring=require(_0x0643('0x10'));var Papa=require(_0x0643('0x11'));var Redis=require('ioredis');var authService=require(_0x0643('0x12'));var qs=require(_0x0643('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0643('0x14'));var logger=require(_0x0643('0x15'))('api');var utils=require(_0x0643('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0643('0x17'))['db'];function respondWithStatusCode(_0x59b8d6,_0x49c441){_0x49c441=_0x49c441||0xcc;return function(_0x26482b){if(_0x26482b){return _0x59b8d6[_0x0643('0x18')](_0x49c441);}return _0x59b8d6['status'](_0x49c441)[_0x0643('0x19')]();};}function respondWithResult(_0x20df63,_0x4bf02c){_0x4bf02c=_0x4bf02c||0xc8;return function(_0x43a274){if(_0x43a274){return _0x20df63[_0x0643('0x1a')](_0x4bf02c)[_0x0643('0x1b')](_0x43a274);}};}function respondWithFilteredResult(_0x37a245,_0x24db22){return function(_0x35ad0e){if(_0x35ad0e){var _0x741505=typeof _0x24db22[_0x0643('0x1c')]===_0x0643('0x1d')&&typeof _0x24db22[_0x0643('0x1e')]===_0x0643('0x1d');var _0x49f668=_0x35ad0e['count'];var _0x35ccb8=_0x741505?0x0:_0x24db22['offset'];var _0x523083=_0x741505?_0x35ad0e[_0x0643('0x1f')]:_0x24db22[_0x0643('0x1c')]+_0x24db22[_0x0643('0x1e')];var _0x318f06;if(_0x523083>=_0x49f668){_0x523083=_0x49f668;_0x318f06=0xc8;}else{_0x318f06=0xce;}_0x37a245[_0x0643('0x1a')](_0x318f06);return _0x37a245[_0x0643('0x20')](_0x0643('0x21'),_0x35ccb8+'-'+_0x523083+'/'+_0x49f668)[_0x0643('0x1b')](_0x35ad0e);}return null;};}function patchUpdates(_0x4e0aaf){return function(_0x5cae83){try{jsonpatch[_0x0643('0x22')](_0x5cae83,_0x4e0aaf,!![]);}catch(_0x266daa){return BPromise['reject'](_0x266daa);}return _0x5cae83['save']();};}function saveUpdates(_0x1cc4af,_0x3fcef6){return function(_0x514519){if(_0x514519){return _0x514519[_0x0643('0x23')](_0x1cc4af)[_0x0643('0x24')](function(_0x1ddf13){return _0x1ddf13;});}return null;};}function removeEntity(_0x417ec6,_0x4953ef){return function(_0x48d537){if(_0x48d537){return _0x48d537[_0x0643('0x25')]()['then'](function(){var _0x3f816e=_0x48d537['get']({'plain':!![]});var _0x26eed4='ODBC';return db[_0x0643('0x26')][_0x0643('0x25')]({'where':{'type':_0x26eed4,'resourceId':_0x3f816e['id']}})['then'](function(){return _0x48d537;});})['then'](function(){_0x417ec6[_0x0643('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7c29,_0x46e1c8){return function(_0x1f2013){if(!_0x1f2013){_0x4b7c29[_0x0643('0x18')](0x194);}return _0x1f2013;};}function handleError(_0x2cba81,_0x24fc81){_0x24fc81=_0x24fc81||0x1f4;return function(_0x4ba72b){logger['error'](_0x4ba72b[_0x0643('0x27')]);if(_0x4ba72b[_0x0643('0x28')]){delete _0x4ba72b[_0x0643('0x28')];}_0x2cba81[_0x0643('0x1a')](_0x24fc81)['send'](_0x4ba72b);};}exports[_0x0643('0x29')]=function(_0x320b8e,_0x2dd5c4){var _0x568e07={},_0x6ceffb={},_0xfcc942={'count':0x0,'rows':[]};var _0x9807ca=_[_0x0643('0x2a')](db[_0x0643('0x2b')][_0x0643('0x2c')],function(_0x7e196b){return{'name':_0x7e196b['fieldName'],'type':_0x7e196b[_0x0643('0x2d')][_0x0643('0x2e')]};});_0x6ceffb[_0x0643('0x2f')]=_[_0x0643('0x2a')](_0x9807ca,_0x0643('0x28'));_0x6ceffb[_0x0643('0x30')]=_[_0x0643('0x31')](_0x320b8e[_0x0643('0x30')]);_0x6ceffb['filters']=_['intersection'](_0x6ceffb[_0x0643('0x2f')],_0x6ceffb[_0x0643('0x30')]);_0x568e07[_0x0643('0x32')]=_[_0x0643('0x33')](_0x6ceffb[_0x0643('0x2f')],qs[_0x0643('0x34')](_0x320b8e['query'][_0x0643('0x34')]));_0x568e07['attributes']=_0x568e07[_0x0643('0x32')][_0x0643('0x35')]?_0x568e07[_0x0643('0x32')]:_0x6ceffb[_0x0643('0x2f')];if(!_0x320b8e[_0x0643('0x30')][_0x0643('0x36')](_0x0643('0x37'))){_0x568e07[_0x0643('0x1e')]=qs[_0x0643('0x1e')](_0x320b8e['query'][_0x0643('0x1e')]);_0x568e07[_0x0643('0x1c')]=qs[_0x0643('0x1c')](_0x320b8e['query'][_0x0643('0x1c')]);}_0x568e07[_0x0643('0x38')]=qs[_0x0643('0x39')](_0x320b8e['query'][_0x0643('0x39')]);_0x568e07[_0x0643('0x3a')]=qs[_0x0643('0x3b')](_[_0x0643('0x3c')](_0x320b8e[_0x0643('0x30')],_0x6ceffb['filters']),_0x9807ca);if(_0x320b8e['query'][_0x0643('0x3d')]){_0x568e07['where']=_[_0x0643('0x3e')](_0x568e07[_0x0643('0x3a')],{'$or':_[_0x0643('0x2a')](_0x9807ca,function(_0x17b7b5){if(_0x17b7b5[_0x0643('0x2d')]!=='VIRTUAL'){var _0x33a669={};_0x33a669[_0x17b7b5[_0x0643('0x28')]]={'$like':'%'+_0x320b8e[_0x0643('0x30')]['filter']+'%'};return _0x33a669;}})});}_0x568e07=_[_0x0643('0x3e')]({},_0x568e07,_0x320b8e[_0x0643('0x3f')]);var _0x25a542={'where':_0x568e07[_0x0643('0x3a')]};return db[_0x0643('0x2b')][_0x0643('0x1f')](_0x25a542)['then'](function(_0x3f1fda){_0xfcc942[_0x0643('0x1f')]=_0x3f1fda;if(_0x320b8e['query'][_0x0643('0x40')]){_0x568e07[_0x0643('0x41')]=[{'all':!![]}];}return db[_0x0643('0x2b')][_0x0643('0x42')](_0x568e07);})[_0x0643('0x24')](function(_0x28e265){_0xfcc942[_0x0643('0x43')]=_0x28e265;return _0xfcc942;})[_0x0643('0x24')](respondWithFilteredResult(_0x2dd5c4,_0x568e07))[_0x0643('0x44')](handleError(_0x2dd5c4,null));};exports['show']=function(_0x3f7986,_0x23022b){var _0x5f6906={'raw':!![],'where':{'id':_0x3f7986[_0x0643('0x45')]['id']}},_0x522c0a={};_0x522c0a[_0x0643('0x2f')]=_['keys'](db[_0x0643('0x2b')]['rawAttributes']);_0x522c0a[_0x0643('0x30')]=_['keys'](_0x3f7986[_0x0643('0x30')]);_0x522c0a['filters']=_[_0x0643('0x33')](_0x522c0a[_0x0643('0x2f')],_0x522c0a[_0x0643('0x30')]);_0x5f6906['attributes']=_['intersection'](_0x522c0a['model'],qs[_0x0643('0x34')](_0x3f7986[_0x0643('0x30')][_0x0643('0x34')]));_0x5f6906[_0x0643('0x32')]=_0x5f6906[_0x0643('0x32')][_0x0643('0x35')]?_0x5f6906['attributes']:_0x522c0a['model'];if(_0x3f7986[_0x0643('0x30')][_0x0643('0x40')]){_0x5f6906['include']=[{'all':!![]}];}_0x5f6906=_[_0x0643('0x3e')]({},_0x5f6906,_0x3f7986[_0x0643('0x3f')]);return db['SquareOdbc'][_0x0643('0x46')](_0x5f6906)[_0x0643('0x24')](handleEntityNotFound(_0x23022b,null))[_0x0643('0x24')](respondWithResult(_0x23022b,null))[_0x0643('0x44')](handleError(_0x23022b,null));};exports[_0x0643('0x47')]=function(_0x308e0b,_0xefee50){return db[_0x0643('0x2b')][_0x0643('0x47')](_0x308e0b[_0x0643('0x48')],{})[_0x0643('0x24')](function(_0x435747){var _0x4134dc=_0x308e0b[_0x0643('0x49')][_0x0643('0x4a')]({'plain':!![]});if(!_0x4134dc)throw new Error(_0x0643('0x4b'));if(_0x4134dc[_0x0643('0x4c')]===_0x0643('0x49')){var _0xcc144e=_0x435747['get']({'plain':!![]});var _0x31abe4=_0x0643('0x4d');return db[_0x0643('0x4e')][_0x0643('0x46')]({'where':{'name':_0x31abe4,'userProfileId':_0x4134dc[_0x0643('0x4f')]},'raw':!![]})['then'](function(_0x2ea2e9){if(_0x2ea2e9&&_0x2ea2e9[_0x0643('0x50')]===0x0){return db[_0x0643('0x26')]['create']({'name':_0xcc144e[_0x0643('0x28')],'resourceId':_0xcc144e['id'],'type':_0x2ea2e9[_0x0643('0x28')],'sectionId':_0x2ea2e9['id']},{})[_0x0643('0x24')](function(){return _0x435747;});}else{return _0x435747;}})['catch'](function(_0x454636){logger[_0x0643('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x454636);throw _0x454636;});}return _0x435747;})['then'](respondWithResult(_0xefee50,0xc9))[_0x0643('0x44')](handleError(_0xefee50,null));};exports['update']=function(_0x1e43ab,_0x1647b3){if(_0x1e43ab['body']['id']){delete _0x1e43ab[_0x0643('0x48')]['id'];}return db['SquareOdbc'][_0x0643('0x46')]({'where':{'id':_0x1e43ab[_0x0643('0x45')]['id']}})[_0x0643('0x24')](handleEntityNotFound(_0x1647b3,null))['then'](saveUpdates(_0x1e43ab['body'],null))[_0x0643('0x24')](respondWithResult(_0x1647b3,null))[_0x0643('0x44')](handleError(_0x1647b3,null));};exports['destroy']=function(_0x422cf8,_0xed7bd9){return db[_0x0643('0x2b')][_0x0643('0x46')]({'where':{'id':_0x422cf8['params']['id']}})[_0x0643('0x24')](handleEntityNotFound(_0xed7bd9,null))[_0x0643('0x24')](removeEntity(_0xed7bd9,null))[_0x0643('0x44')](handleError(_0xed7bd9,null));};exports[_0x0643('0x52')]=function(_0x1827d4,_0x121435,_0x33768f){var _0x597ec6;return db[_0x0643('0x2b')][_0x0643('0x46')]({'where':{'id':_0x1827d4['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x121435,null))[_0x0643('0x24')](function(_0x2760c8){if(_0x2760c8){var _0x175311=require(_0x0643('0x53'))();_0x175311[_0x0643('0x54')](_0x2760c8[_0x0643('0x55')]);_0x175311[_0x0643('0x56')]();return _0x2760c8;}})[_0x0643('0x24')](respondWithResult(_0x121435,null))[_0x0643('0x44')](handleError(_0x121435,null));}; \ No newline at end of file +var _0xb4b7=['key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','ODBC','UserProfileResource','then','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type'];(function(_0x25b2c9,_0x164147){var _0x1af1aa=function(_0x407d96){while(--_0x407d96){_0x25b2c9['push'](_0x25b2c9['shift']());}};_0x1af1aa(++_0x164147);}(_0xb4b7,0x136));var _0x7b4b=function(_0x52e1e7,_0x2b36f7){_0x52e1e7=_0x52e1e7-0x0;var _0x552c2e=_0xb4b7[_0x52e1e7];return _0x552c2e;};'use strict';var emlformat=require(_0x7b4b('0x0'));var rimraf=require(_0x7b4b('0x1'));var zipdir=require(_0x7b4b('0x2'));var jsonpatch=require(_0x7b4b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7b4b('0x4'));var Mustache=require(_0x7b4b('0x5'));var util=require('util');var path=require(_0x7b4b('0x6'));var sox=require(_0x7b4b('0x7'));var csv=require(_0x7b4b('0x8'));var ejs=require(_0x7b4b('0x9'));var fs=require('fs');var fs_extra=require(_0x7b4b('0xa'));var _=require(_0x7b4b('0xb'));var squel=require(_0x7b4b('0xc'));var crypto=require(_0x7b4b('0xd'));var jsforce=require(_0x7b4b('0xe'));var deskjs=require(_0x7b4b('0xf'));var toCsv=require(_0x7b4b('0x8'));var querystring=require(_0x7b4b('0x10'));var Papa=require(_0x7b4b('0x11'));var Redis=require(_0x7b4b('0x12'));var authService=require(_0x7b4b('0x13'));var qs=require(_0x7b4b('0x14'));var as=require(_0x7b4b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b4b('0x16'))(_0x7b4b('0x17'));var utils=require('../../config/utils');var config=require(_0x7b4b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7b4b('0x19'))['db'];function respondWithStatusCode(_0x39faaa,_0x4feda2){_0x4feda2=_0x4feda2||0xcc;return function(_0x459da4){if(_0x459da4){return _0x39faaa[_0x7b4b('0x1a')](_0x4feda2);}return _0x39faaa[_0x7b4b('0x1b')](_0x4feda2)[_0x7b4b('0x1c')]();};}function respondWithResult(_0x3bdafd,_0x18969a){_0x18969a=_0x18969a||0xc8;return function(_0x229898){if(_0x229898){return _0x3bdafd[_0x7b4b('0x1b')](_0x18969a)[_0x7b4b('0x1d')](_0x229898);}};}function respondWithFilteredResult(_0x38399c,_0x4c431a){return function(_0x282141){if(_0x282141){var _0x2d3aa1=typeof _0x4c431a['offset']===_0x7b4b('0x1e')&&typeof _0x4c431a[_0x7b4b('0x1f')]===_0x7b4b('0x1e');var _0x470290=_0x282141[_0x7b4b('0x20')];var _0x4b2f88=_0x2d3aa1?0x0:_0x4c431a['offset'];var _0x454341=_0x2d3aa1?_0x282141['count']:_0x4c431a[_0x7b4b('0x21')]+_0x4c431a['limit'];var _0x2d9c46;if(_0x454341>=_0x470290){_0x454341=_0x470290;_0x2d9c46=0xc8;}else{_0x2d9c46=0xce;}_0x38399c[_0x7b4b('0x1b')](_0x2d9c46);return _0x38399c[_0x7b4b('0x22')](_0x7b4b('0x23'),_0x4b2f88+'-'+_0x454341+'/'+_0x470290)[_0x7b4b('0x1d')](_0x282141);}return null;};}function patchUpdates(_0x5de86b){return function(_0xf4064e){try{jsonpatch[_0x7b4b('0x24')](_0xf4064e,_0x5de86b,!![]);}catch(_0x631a70){return BPromise[_0x7b4b('0x25')](_0x631a70);}return _0xf4064e[_0x7b4b('0x26')]();};}function saveUpdates(_0x4d8a45,_0x1eddb1){return function(_0xe0f6c0){if(_0xe0f6c0){return _0xe0f6c0[_0x7b4b('0x27')](_0x4d8a45)['then'](function(_0x2b95a4){return _0x2b95a4;});}return null;};}function removeEntity(_0x37032a,_0x1899c6){return function(_0x43e3ac){if(_0x43e3ac){return _0x43e3ac[_0x7b4b('0x28')]()['then'](function(){var _0x4bb33b=_0x43e3ac['get']({'plain':!![]});var _0x53d7c5=_0x7b4b('0x29');return db[_0x7b4b('0x2a')][_0x7b4b('0x28')]({'where':{'type':_0x53d7c5,'resourceId':_0x4bb33b['id']}})[_0x7b4b('0x2b')](function(){return _0x43e3ac;});})[_0x7b4b('0x2b')](function(){_0x37032a[_0x7b4b('0x1b')](0xcc)[_0x7b4b('0x1c')]();});}};}function handleEntityNotFound(_0x3a4ffd,_0x533c23){return function(_0x4f0609){if(!_0x4f0609){_0x3a4ffd[_0x7b4b('0x1a')](0x194);}return _0x4f0609;};}function handleError(_0x3e4cae,_0x2a8c31){_0x2a8c31=_0x2a8c31||0x1f4;return function(_0x1753b0){logger[_0x7b4b('0x2c')](_0x1753b0[_0x7b4b('0x2d')]);if(_0x1753b0['name']){delete _0x1753b0[_0x7b4b('0x2e')];}_0x3e4cae[_0x7b4b('0x1b')](_0x2a8c31)[_0x7b4b('0x2f')](_0x1753b0);};}exports[_0x7b4b('0x30')]=function(_0x567749,_0x17aa15){var _0x127413={},_0x144c32={},_0x12fa91={'count':0x0,'rows':[]};var _0x477954=_[_0x7b4b('0x31')](db[_0x7b4b('0x32')][_0x7b4b('0x33')],function(_0x524f68){return{'name':_0x524f68[_0x7b4b('0x34')],'type':_0x524f68[_0x7b4b('0x35')][_0x7b4b('0x36')]};});_0x144c32['model']=_[_0x7b4b('0x31')](_0x477954,_0x7b4b('0x2e'));_0x144c32[_0x7b4b('0x37')]=_[_0x7b4b('0x38')](_0x567749[_0x7b4b('0x37')]);_0x144c32['filters']=_[_0x7b4b('0x39')](_0x144c32[_0x7b4b('0x3a')],_0x144c32['query']);_0x127413[_0x7b4b('0x3b')]=_[_0x7b4b('0x39')](_0x144c32['model'],qs[_0x7b4b('0x3c')](_0x567749[_0x7b4b('0x37')][_0x7b4b('0x3c')]));_0x127413['attributes']=_0x127413[_0x7b4b('0x3b')][_0x7b4b('0x3d')]?_0x127413[_0x7b4b('0x3b')]:_0x144c32[_0x7b4b('0x3a')];if(!_0x567749[_0x7b4b('0x37')][_0x7b4b('0x3e')]('nolimit')){_0x127413['limit']=qs[_0x7b4b('0x1f')](_0x567749['query'][_0x7b4b('0x1f')]);_0x127413[_0x7b4b('0x21')]=qs[_0x7b4b('0x21')](_0x567749[_0x7b4b('0x37')][_0x7b4b('0x21')]);}_0x127413[_0x7b4b('0x3f')]=qs[_0x7b4b('0x40')](_0x567749[_0x7b4b('0x37')][_0x7b4b('0x40')]);_0x127413[_0x7b4b('0x41')]=qs[_0x7b4b('0x42')](_['pick'](_0x567749[_0x7b4b('0x37')],_0x144c32['filters']),_0x477954);if(_0x567749[_0x7b4b('0x37')][_0x7b4b('0x43')]){_0x127413[_0x7b4b('0x41')]=_[_0x7b4b('0x44')](_0x127413['where'],{'$or':_[_0x7b4b('0x31')](_0x477954,function(_0x454940){if(_0x454940[_0x7b4b('0x35')]!==_0x7b4b('0x45')){var _0x4a4e50={};_0x4a4e50[_0x454940[_0x7b4b('0x2e')]]={'$like':'%'+_0x567749[_0x7b4b('0x37')][_0x7b4b('0x43')]+'%'};return _0x4a4e50;}})});}_0x127413=_['merge']({},_0x127413,_0x567749[_0x7b4b('0x46')]);var _0x33815b={'where':_0x127413[_0x7b4b('0x41')]};return db[_0x7b4b('0x32')][_0x7b4b('0x20')](_0x33815b)[_0x7b4b('0x2b')](function(_0x441652){_0x12fa91[_0x7b4b('0x20')]=_0x441652;if(_0x567749[_0x7b4b('0x37')][_0x7b4b('0x47')]){_0x127413['include']=[{'all':!![]}];}return db[_0x7b4b('0x32')][_0x7b4b('0x48')](_0x127413);})[_0x7b4b('0x2b')](function(_0x4b7be0){_0x12fa91[_0x7b4b('0x49')]=_0x4b7be0;return _0x12fa91;})[_0x7b4b('0x2b')](respondWithFilteredResult(_0x17aa15,_0x127413))[_0x7b4b('0x4a')](handleError(_0x17aa15,null));};exports['show']=function(_0x367688,_0x238733){var _0x166a20={'raw':!![],'where':{'id':_0x367688[_0x7b4b('0x4b')]['id']}},_0x4a0dc6={};_0x4a0dc6[_0x7b4b('0x3a')]=_[_0x7b4b('0x38')](db[_0x7b4b('0x32')][_0x7b4b('0x33')]);_0x4a0dc6[_0x7b4b('0x37')]=_[_0x7b4b('0x38')](_0x367688[_0x7b4b('0x37')]);_0x4a0dc6[_0x7b4b('0x42')]=_[_0x7b4b('0x39')](_0x4a0dc6['model'],_0x4a0dc6['query']);_0x166a20['attributes']=_[_0x7b4b('0x39')](_0x4a0dc6[_0x7b4b('0x3a')],qs[_0x7b4b('0x3c')](_0x367688[_0x7b4b('0x37')][_0x7b4b('0x3c')]));_0x166a20[_0x7b4b('0x3b')]=_0x166a20[_0x7b4b('0x3b')][_0x7b4b('0x3d')]?_0x166a20['attributes']:_0x4a0dc6['model'];if(_0x367688[_0x7b4b('0x37')][_0x7b4b('0x47')]){_0x166a20[_0x7b4b('0x4c')]=[{'all':!![]}];}_0x166a20=_[_0x7b4b('0x44')]({},_0x166a20,_0x367688['options']);return db[_0x7b4b('0x32')]['find'](_0x166a20)['then'](handleEntityNotFound(_0x238733,null))[_0x7b4b('0x2b')](respondWithResult(_0x238733,null))[_0x7b4b('0x4a')](handleError(_0x238733,null));};exports[_0x7b4b('0x4d')]=function(_0x3adbe3,_0x4c5fe9){return db[_0x7b4b('0x32')][_0x7b4b('0x4d')](_0x3adbe3[_0x7b4b('0x4e')],{})[_0x7b4b('0x2b')](function(_0x48205e){var _0x56fef4=_0x3adbe3[_0x7b4b('0x4f')][_0x7b4b('0x50')]({'plain':!![]});if(!_0x56fef4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56fef4[_0x7b4b('0x51')]===_0x7b4b('0x4f')){var _0x435970=_0x48205e['get']({'plain':!![]});var _0x4203ef=_0x7b4b('0x29');return db[_0x7b4b('0x52')]['find']({'where':{'name':_0x4203ef,'userProfileId':_0x56fef4[_0x7b4b('0x53')]},'raw':!![]})['then'](function(_0x180fdb){if(_0x180fdb&&_0x180fdb[_0x7b4b('0x54')]===0x0){return db[_0x7b4b('0x2a')][_0x7b4b('0x4d')]({'name':_0x435970[_0x7b4b('0x2e')],'resourceId':_0x435970['id'],'type':_0x180fdb[_0x7b4b('0x2e')],'sectionId':_0x180fdb['id']},{})[_0x7b4b('0x2b')](function(){return _0x48205e;});}else{return _0x48205e;}})[_0x7b4b('0x4a')](function(_0x2d4b39){logger[_0x7b4b('0x2c')](_0x7b4b('0x55'),_0x2d4b39);throw _0x2d4b39;});}return _0x48205e;})['then'](respondWithResult(_0x4c5fe9,0xc9))[_0x7b4b('0x4a')](handleError(_0x4c5fe9,null));};exports[_0x7b4b('0x27')]=function(_0x43dbd5,_0x2b02f7){if(_0x43dbd5[_0x7b4b('0x4e')]['id']){delete _0x43dbd5[_0x7b4b('0x4e')]['id'];}return db['SquareOdbc'][_0x7b4b('0x56')]({'where':{'id':_0x43dbd5[_0x7b4b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b02f7,null))[_0x7b4b('0x2b')](saveUpdates(_0x43dbd5[_0x7b4b('0x4e')],null))[_0x7b4b('0x2b')](respondWithResult(_0x2b02f7,null))[_0x7b4b('0x4a')](handleError(_0x2b02f7,null));};exports[_0x7b4b('0x28')]=function(_0x237822,_0xcb635e){return db['SquareOdbc'][_0x7b4b('0x56')]({'where':{'id':_0x237822[_0x7b4b('0x4b')]['id']}})[_0x7b4b('0x2b')](handleEntityNotFound(_0xcb635e,null))[_0x7b4b('0x2b')](removeEntity(_0xcb635e,null))[_0x7b4b('0x4a')](handleError(_0xcb635e,null));};exports['test']=function(_0x247b2b,_0x1d8d26,_0x1293d3){var _0x5c4fac;return db[_0x7b4b('0x32')][_0x7b4b('0x56')]({'where':{'id':_0x247b2b[_0x7b4b('0x4b')]['id']},'attributes':['id',_0x7b4b('0x57')]})['then'](handleEntityNotFound(_0x1d8d26,null))[_0x7b4b('0x2b')](function(_0x40dd24){if(_0x40dd24){var _0x2a2f2a=require(_0x7b4b('0x58'))();_0x2a2f2a[_0x7b4b('0x59')](_0x40dd24[_0x7b4b('0x57')]);_0x2a2f2a[_0x7b4b('0x5a')]();return _0x40dd24;}})[_0x7b4b('0x2b')](respondWithResult(_0x1d8d26,null))['catch'](handleError(_0x1d8d26,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e029e09..dec9624 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 _0x1091=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc'];(function(_0x10e0cb,_0x3a555a){var _0x1b7bb3=function(_0x58cd6f){while(--_0x58cd6f){_0x10e0cb['push'](_0x10e0cb['shift']());}};_0x1b7bb3(++_0x3a555a);}(_0x1091,0x1c7));var _0x1109=function(_0xca908b,_0xddd1a){_0xca908b=_0xca908b-0x0;var _0x4ab355=_0x1091[_0xca908b];return _0x4ab355;};'use strict';var _=require(_0x1109('0x0'));var util=require(_0x1109('0x1'));var logger=require(_0x1109('0x2'))(_0x1109('0x3'));var moment=require(_0x1109('0x4'));var BPromise=require('bluebird');var rp=require(_0x1109('0x5'));var fs=require('fs');var path=require(_0x1109('0x6'));var rimraf=require(_0x1109('0x7'));var config=require(_0x1109('0x8'));var attributes=require(_0x1109('0x9'));module[_0x1109('0xa')]=function(_0x56419f,_0x5835c2){return _0x56419f[_0x1109('0xb')]('SquareOdbc',attributes,{'tableName':_0x1109('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e9a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash'];(function(_0x103d3e,_0x160699){var _0x3555bb=function(_0x10e0bb){while(--_0x10e0bb){_0x103d3e['push'](_0x103d3e['shift']());}};_0x3555bb(++_0x160699);}(_0x7e9a,0xdc));var _0xa7e9=function(_0x1a89ae,_0x34ec9e){_0x1a89ae=_0x1a89ae-0x0;var _0x266c02=_0x7e9a[_0x1a89ae];return _0x266c02;};'use strict';var _=require(_0xa7e9('0x0'));var util=require(_0xa7e9('0x1'));var logger=require(_0xa7e9('0x2'))(_0xa7e9('0x3'));var moment=require(_0xa7e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7e9('0x5'));var fs=require('fs');var path=require(_0xa7e9('0x6'));var rimraf=require(_0xa7e9('0x7'));var config=require(_0xa7e9('0x8'));var attributes=require(_0xa7e9('0x9'));module[_0xa7e9('0xa')]=function(_0x131c88,_0x166a3a){return _0x131c88[_0xa7e9('0xb')](_0xa7e9('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 7f93dcd..6eb1adb 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 _0x48e6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','include','model','attributes','map','catch','lodash','util','moment'];(function(_0x5c714c,_0x3b4eaa){var _0x345e02=function(_0x22f7a8){while(--_0x22f7a8){_0x5c714c['push'](_0x5c714c['shift']());}};_0x345e02(++_0x3b4eaa);}(_0x48e6,0x9d));var _0x648e=function(_0x151ac4,_0x4554e6){_0x151ac4=_0x151ac4-0x0;var _0x46c32f=_0x48e6[_0x151ac4];return _0x46c32f;};'use strict';var _=require(_0x648e('0x0'));var util=require(_0x648e('0x1'));var moment=require(_0x648e('0x2'));var BPromise=require(_0x648e('0x3'));var rs=require(_0x648e('0x4'));var fs=require('fs');var Redis=require(_0x648e('0x5'));var db=require(_0x648e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x648e('0x7'))(_0x648e('0x8'));var config=require(_0x648e('0x9'));var jayson=require(_0x648e('0xa'));var client=jayson[_0x648e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fcc99,_0x16fe1d,_0x124fc7){return new BPromise(function(_0x5ba455,_0x2497ea){return client[_0x648e('0xc')](_0x2fcc99,_0x124fc7)[_0x648e('0xd')](function(_0x4d51a8){logger['info'](_0x648e('0xe'),_0x16fe1d,_0x648e('0xf'));logger[_0x648e('0x10')](_0x648e('0x11'),_0x16fe1d,_0x648e('0xf'),JSON[_0x648e('0x12')](_0x4d51a8));if(_0x4d51a8[_0x648e('0x13')]){if(_0x4d51a8['error']['code']===0x1f4){logger[_0x648e('0x13')](_0x648e('0xe'),_0x16fe1d,_0x4d51a8['error']['message']);return _0x2497ea(_0x4d51a8[_0x648e('0x13')][_0x648e('0x14')]);}logger[_0x648e('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x16fe1d,_0x4d51a8[_0x648e('0x13')][_0x648e('0x14')]);return _0x5ba455(_0x4d51a8[_0x648e('0x13')][_0x648e('0x14')]);}else{logger['info'](_0x648e('0xe'),_0x16fe1d,_0x648e('0xf'));_0x5ba455(_0x4d51a8[_0x648e('0x15')]['message']);}})['catch'](function(_0x504878){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x16fe1d,_0x504878);_0x2497ea(_0x504878);});});}exports[_0x648e('0x16')]=function(_0x43364f){var _0x309125=this;return new Promise(function(_0x152f8e,_0x2429da){return db[_0x648e('0x17')][_0x648e('0x18')]({'raw':_0x43364f['options']?_0x43364f[_0x648e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x43364f['options']?_0x43364f[_0x648e('0x19')][_0x648e('0x1a')]||null:null,'attributes':_0x43364f[_0x648e('0x19')]?_0x43364f['options']['attributes']||null:null,'include':_0x43364f[_0x648e('0x19')]?_0x43364f['options'][_0x648e('0x1b')]?_['map'](_0x43364f[_0x648e('0x19')][_0x648e('0x1b')],function(_0x3446c8){return{'model':db[_0x3446c8[_0x648e('0x1c')]],'as':_0x3446c8['as'],'attributes':_0x3446c8[_0x648e('0x1d')],'include':_0x3446c8['include']?_[_0x648e('0x1e')](_0x3446c8[_0x648e('0x1b')],function(_0x6f0ba8){return{'model':db[_0x6f0ba8['model']],'as':_0x6f0ba8['as'],'attributes':_0x6f0ba8[_0x648e('0x1d')],'include':_0x6f0ba8[_0x648e('0x1b')]?_[_0x648e('0x1e')](_0x6f0ba8[_0x648e('0x1b')],function(_0x22748a){return{'model':db[_0x22748a['model']],'as':_0x22748a['as'],'attributes':_0x22748a[_0x648e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x648e('0xd')](function(_0x5a25df){logger['info'](_0x648e('0x16'),_0x43364f);logger[_0x648e('0x10')](_0x648e('0x16'),_0x43364f,JSON[_0x648e('0x12')](_0x5a25df));_0x152f8e(_0x5a25df);})[_0x648e('0x1f')](function(_0xffddfc){logger['error']('ShowSquareOdbc',_0xffddfc[_0x648e('0x14')],_0x43364f);_0x2429da(_0x309125[_0x648e('0x13')](0x1f4,_0xffddfc['message']));});});}; \ No newline at end of file +var _0xab03=['SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','map','include','model','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f8169,_0x445c52){var _0xd2513d=function(_0x42c564){while(--_0x42c564){_0x2f8169['push'](_0x2f8169['shift']());}};_0xd2513d(++_0x445c52);}(_0xab03,0x95));var _0x3ab0=function(_0x395b8c,_0x545824){_0x395b8c=_0x395b8c-0x0;var _0x1e1c98=_0xab03[_0x395b8c];return _0x1e1c98;};'use strict';var _=require(_0x3ab0('0x0'));var util=require(_0x3ab0('0x1'));var moment=require('moment');var BPromise=require(_0x3ab0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ab0('0x3'))['db'];var utils=require(_0x3ab0('0x4'));var logger=require(_0x3ab0('0x5'))(_0x3ab0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ab0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac2e2,_0x12692c,_0x2de53d){return new BPromise(function(_0x2cc32d,_0x555f85){return client['request'](_0x3ac2e2,_0x2de53d)[_0x3ab0('0x8')](function(_0x198df4){logger[_0x3ab0('0x9')](_0x3ab0('0xa'),_0x12692c,_0x3ab0('0xb'));logger[_0x3ab0('0xc')](_0x3ab0('0xd'),_0x12692c,_0x3ab0('0xb'),JSON[_0x3ab0('0xe')](_0x198df4));if(_0x198df4[_0x3ab0('0xf')]){if(_0x198df4['error'][_0x3ab0('0x10')]===0x1f4){logger[_0x3ab0('0xf')](_0x3ab0('0xa'),_0x12692c,_0x198df4[_0x3ab0('0xf')][_0x3ab0('0x11')]);return _0x555f85(_0x198df4[_0x3ab0('0xf')][_0x3ab0('0x11')]);}logger['error'](_0x3ab0('0xa'),_0x12692c,_0x198df4[_0x3ab0('0xf')][_0x3ab0('0x11')]);return _0x2cc32d(_0x198df4['error'][_0x3ab0('0x11')]);}else{logger[_0x3ab0('0x9')](_0x3ab0('0xa'),_0x12692c,_0x3ab0('0xb'));_0x2cc32d(_0x198df4['result'][_0x3ab0('0x11')]);}})['catch'](function(_0x511bf6){logger['error'](_0x3ab0('0xa'),_0x12692c,_0x511bf6);_0x555f85(_0x511bf6);});});}exports[_0x3ab0('0x12')]=function(_0x49c09b){var _0x4b8f7e=this;return new Promise(function(_0x52f389,_0x5eab68){return db[_0x3ab0('0x13')][_0x3ab0('0x14')]({'raw':_0x49c09b[_0x3ab0('0x15')]?_0x49c09b[_0x3ab0('0x15')][_0x3ab0('0x16')]===undefined?!![]:![]:!![],'where':_0x49c09b[_0x3ab0('0x15')]?_0x49c09b['options']['where']||null:null,'attributes':_0x49c09b[_0x3ab0('0x15')]?_0x49c09b[_0x3ab0('0x15')][_0x3ab0('0x17')]||null:null,'include':_0x49c09b[_0x3ab0('0x15')]?_0x49c09b[_0x3ab0('0x15')]['include']?_[_0x3ab0('0x18')](_0x49c09b[_0x3ab0('0x15')][_0x3ab0('0x19')],function(_0xfef349){return{'model':db[_0xfef349[_0x3ab0('0x1a')]],'as':_0xfef349['as'],'attributes':_0xfef349[_0x3ab0('0x17')],'include':_0xfef349[_0x3ab0('0x19')]?_[_0x3ab0('0x18')](_0xfef349['include'],function(_0x208a27){return{'model':db[_0x208a27[_0x3ab0('0x1a')]],'as':_0x208a27['as'],'attributes':_0x208a27[_0x3ab0('0x17')],'include':_0x208a27[_0x3ab0('0x19')]?_[_0x3ab0('0x18')](_0x208a27[_0x3ab0('0x19')],function(_0x599e67){return{'model':db[_0x599e67[_0x3ab0('0x1a')]],'as':_0x599e67['as'],'attributes':_0x599e67[_0x3ab0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3ab0('0x8')](function(_0x4d3172){logger['info'](_0x3ab0('0x12'),_0x49c09b);logger[_0x3ab0('0xc')](_0x3ab0('0x12'),_0x49c09b,JSON['stringify'](_0x4d3172));_0x52f389(_0x4d3172);})['catch'](function(_0x1c3cc5){logger['error']('ShowSquareOdbc',_0x1c3cc5['message'],_0x49c09b);_0x5eab68(_0x4b8f7e[_0x3ab0('0xf')](0x1f4,_0x1c3cc5[_0x3ab0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d4faf2d..31be33c 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 _0x40a7=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','show'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x40a7,0xc4));var _0x740a=function(_0x5f55d2,_0x4dfb7){_0x5f55d2=_0x5f55d2-0x0;var _0x47527f=_0x40a7[_0x5f55d2];return _0x47527f;};'use strict';var multer=require(_0x740a('0x0'));var util=require(_0x740a('0x1'));var path=require(_0x740a('0x2'));var timeout=require(_0x740a('0x3'));var express=require(_0x740a('0x4'));var router=express['Router']();var fs_extra=require(_0x740a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x740a('0x6'));var config=require(_0x740a('0x7'));var controller=require(_0x740a('0x8'));router['get']('/',auth[_0x740a('0x9')](),controller['index']);router[_0x740a('0xa')](_0x740a('0xb'),auth[_0x740a('0x9')](),controller[_0x740a('0xc')]);router[_0x740a('0xd')]('/',auth[_0x740a('0x9')](),controller[_0x740a('0xe')]);router[_0x740a('0xf')](_0x740a('0xb'),auth[_0x740a('0x9')](),controller[_0x740a('0x10')]);router[_0x740a('0x11')]('/:id',auth[_0x740a('0x9')](),controller['destroy']);module[_0x740a('0x12')]=router; \ No newline at end of file +var _0x53e9=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x53e9,0x1c7));var _0x953e=function(_0x169c10,_0x3c7e31){_0x169c10=_0x169c10-0x0;var _0x3fbee1=_0x53e9[_0x169c10];return _0x3fbee1;};'use strict';var multer=require(_0x953e('0x0'));var util=require(_0x953e('0x1'));var path=require('path');var timeout=require(_0x953e('0x2'));var express=require(_0x953e('0x3'));var router=express['Router']();var fs_extra=require(_0x953e('0x4'));var auth=require(_0x953e('0x5'));var interaction=require(_0x953e('0x6'));var config=require(_0x953e('0x7'));var controller=require(_0x953e('0x8'));router[_0x953e('0x9')]('/',auth[_0x953e('0xa')](),controller[_0x953e('0xb')]);router['get'](_0x953e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x953e('0xd')]('/',auth[_0x953e('0xa')](),controller[_0x953e('0xe')]);router[_0x953e('0xf')]('/:id',auth[_0x953e('0xa')](),controller['update']);router[_0x953e('0x10')](_0x953e('0xc'),auth[_0x953e('0xa')](),controller[_0x953e('0x11')]);module[_0x953e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 42382fb..7c8bb6d 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 _0x464d=['production','DATE','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x74a85a,_0x5a5dde){var _0x46813b=function(_0x47cebb){while(--_0x47cebb){_0x74a85a['push'](_0x74a85a['shift']());}};_0x46813b(++_0x5a5dde);}(_0x464d,0x70));var _0xd464=function(_0x397fc1,_0x335b2f){_0x397fc1=_0x397fc1-0x0;var _0x3b3be8=_0x464d[_0x397fc1];return _0x3b3be8;};'use strict';var Sequelize=require('sequelize');module[_0xd464('0x0')]={'name':{'type':Sequelize[_0xd464('0x1')],'unique':_0xd464('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd464('0x1')]},'notes':{'type':Sequelize[_0xd464('0x3')]},'preproduction':{'type':Sequelize[_0xd464('0x4')](_0xd464('0x5')),'get':function(){if(this[_0xd464('0x6')](_0xd464('0x7'))){return this[_0xd464('0x6')](_0xd464('0x7'))['toString'](_0xd464('0x8'));}}},'production':{'type':Sequelize[_0xd464('0x4')](_0xd464('0x5')),'get':function(){if(this[_0xd464('0x6')](_0xd464('0x9'))){return this[_0xd464('0x6')]('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xd464('0xa')]},'publishedAt':{'type':Sequelize[_0xd464('0xa')]}}; \ No newline at end of file +var _0xf8f5=['long','preproduction','toString','utf8','getDataValue','production','DATE','sequelize','exports','name','STRING','BLOB'];(function(_0x4ea37a,_0x3c2c96){var _0x4865c1=function(_0x4ccaea){while(--_0x4ccaea){_0x4ea37a['push'](_0x4ea37a['shift']());}};_0x4865c1(++_0x3c2c96);}(_0xf8f5,0x127));var _0x5f8f=function(_0x237335,_0x418650){_0x237335=_0x237335-0x0;var _0x4ad17c=_0xf8f5[_0x237335];return _0x4ad17c;};'use strict';var Sequelize=require(_0x5f8f('0x0'));module[_0x5f8f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5f8f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5f8f('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x5f8f('0x4')](_0x5f8f('0x5')),'get':function(){if(this['getDataValue'](_0x5f8f('0x6'))){return this['getDataValue']('preproduction')[_0x5f8f('0x7')](_0x5f8f('0x8'));}}},'production':{'type':Sequelize[_0x5f8f('0x4')](_0x5f8f('0x5')),'get':function(){if(this[_0x5f8f('0x9')](_0x5f8f('0xa'))){return this['getDataValue'](_0x5f8f('0xa'))[_0x5f8f('0x7')](_0x5f8f('0x8'));}}},'savedAt':{'type':Sequelize[_0x5f8f('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index dd44b33..0c8ff2f 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 _0x40f9=['count','set','destroy','SquareProjects','UserProfileResource','then','end','error','stack','name','send','index','SquareProject','rawAttributes','model','map','query','filters','attributes','intersection','fields','length','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','publish','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','status','json','undefined','limit','offset'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x40f9,0xac));var _0x940f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x40f9[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x940f('0x0'));var Redis=require(_0x940f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x940f('0x2'))(_0x940f('0x3'));var config=require(_0x940f('0x4'));var db=require(_0x940f('0x5'))['db'];config['redis']=_['defaults'](config[_0x940f('0x6')],{'host':_0x940f('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x940f('0x6')]));require(_0x940f('0x8'))['register'](socket);function respondWithResult(_0x509af2,_0x338633){_0x338633=_0x338633||0xc8;return function(_0x441d9e){if(_0x441d9e){return _0x509af2[_0x940f('0x9')](_0x338633)[_0x940f('0xa')](_0x441d9e);}};}function respondWithFilteredResult(_0x3e0766,_0x52e15d){return function(_0x1047c6){if(_0x1047c6){var _0x467c24=typeof _0x52e15d['offset']===_0x940f('0xb')&&typeof _0x52e15d[_0x940f('0xc')]==='undefined';var _0x33e01b=_0x1047c6['count'];var _0x41dbed=_0x467c24?0x0:_0x52e15d[_0x940f('0xd')];var _0x4abe8e=_0x467c24?_0x1047c6[_0x940f('0xe')]:_0x52e15d['offset']+_0x52e15d[_0x940f('0xc')];var _0x405a5;if(_0x4abe8e>=_0x33e01b){_0x4abe8e=_0x33e01b;_0x405a5=0xc8;}else{_0x405a5=0xce;}_0x3e0766[_0x940f('0x9')](_0x405a5);return _0x3e0766[_0x940f('0xf')]('Content-Range',_0x41dbed+'-'+_0x4abe8e+'/'+_0x33e01b)[_0x940f('0xa')](_0x1047c6);}return null;};}function saveUpdates(_0x206c1c){return function(_0x206c1b){if(_0x206c1b){return _0x206c1b['update'](_0x206c1c)['then'](function(_0x34fbd5){return _0x34fbd5;});}return null;};}function removeEntity(_0x187c51){return function(_0x4ef34e){if(_0x4ef34e){return _0x4ef34e[_0x940f('0x10')]()['then'](function(){var _0xe3bd79=_0x4ef34e['get']({'plain':!![]});var _0x1bed70=_0x940f('0x11');return db[_0x940f('0x12')][_0x940f('0x10')]({'where':{'type':_0x1bed70,'resourceId':_0xe3bd79['id']}})['then'](function(){return _0x4ef34e;});})[_0x940f('0x13')](function(){var _0x599bf6=new Redis(config[_0x940f('0x6')]);_0x599bf6['publish']('agi',JSON['stringify']({'id':_0x4ef34e['id'],'deleted':!![]}));})['then'](function(){_0x187c51[_0x940f('0x9')](0xcc)[_0x940f('0x14')]();});}};}function handleEntityNotFound(_0x438ebd){return function(_0xce4cf3){if(!_0xce4cf3){_0x438ebd['sendStatus'](0x194);}return _0xce4cf3;};}function handleError(_0x1d5b70,_0x50da0b){_0x50da0b=_0x50da0b||0x1f4;return function(_0x28cab9){logger[_0x940f('0x15')](_0x28cab9[_0x940f('0x16')]);if(_0x28cab9[_0x940f('0x17')]){delete _0x28cab9[_0x940f('0x17')];}_0x1d5b70[_0x940f('0x9')](_0x50da0b)[_0x940f('0x18')](_0x28cab9);};}exports[_0x940f('0x19')]=function(_0x2bc966,_0x2c8dfc){var _0x4c4f7f={},_0xdfb347={},_0x283e97={'count':0x0,'rows':[]};var _0xa78948=_['map'](db[_0x940f('0x1a')][_0x940f('0x1b')],function(_0x4f7d17){return{'name':_0x4f7d17['fieldName'],'type':_0x4f7d17['type']['key']};});_0xdfb347[_0x940f('0x1c')]=_[_0x940f('0x1d')](_0xa78948,_0x940f('0x17'));_0xdfb347[_0x940f('0x1e')]=_['keys'](_0x2bc966[_0x940f('0x1e')]);_0xdfb347[_0x940f('0x1f')]=_['intersection'](_0xdfb347[_0x940f('0x1c')],_0xdfb347[_0x940f('0x1e')]);_0x4c4f7f[_0x940f('0x20')]=_[_0x940f('0x21')](_0xdfb347['model'],qs[_0x940f('0x22')](_0x2bc966['query'][_0x940f('0x22')]));_0x4c4f7f[_0x940f('0x20')]=_0x4c4f7f[_0x940f('0x20')][_0x940f('0x23')]?_0x4c4f7f[_0x940f('0x20')]:_0xdfb347['model'];if(!_0x2bc966[_0x940f('0x1e')]['hasOwnProperty']('nolimit')){_0x4c4f7f[_0x940f('0xc')]=qs['limit'](_0x2bc966[_0x940f('0x1e')][_0x940f('0xc')]);_0x4c4f7f[_0x940f('0xd')]=qs[_0x940f('0xd')](_0x2bc966[_0x940f('0x1e')][_0x940f('0xd')]);}_0x4c4f7f[_0x940f('0x24')]=qs['sort'](_0x2bc966[_0x940f('0x1e')]['sort']);_0x4c4f7f[_0x940f('0x25')]=qs[_0x940f('0x1f')](_[_0x940f('0x26')](_0x2bc966[_0x940f('0x1e')],_0xdfb347[_0x940f('0x1f')]),_0xa78948);if(_0x2bc966[_0x940f('0x1e')][_0x940f('0x27')]){_0x4c4f7f[_0x940f('0x25')]=_[_0x940f('0x28')](_0x4c4f7f[_0x940f('0x25')],{'$or':_[_0x940f('0x1d')](_0xa78948,function(_0x53c209){if(_0x53c209[_0x940f('0x29')]!==_0x940f('0x2a')){var _0x18aa4c={};_0x18aa4c[_0x53c209[_0x940f('0x17')]]={'$like':'%'+_0x2bc966[_0x940f('0x1e')][_0x940f('0x27')]+'%'};return _0x18aa4c;}})});}_0x4c4f7f=_[_0x940f('0x28')]({},_0x4c4f7f,_0x2bc966[_0x940f('0x2b')]);var _0x416962={'where':_0x4c4f7f[_0x940f('0x25')]};return db[_0x940f('0x1a')]['count'](_0x416962)[_0x940f('0x13')](function(_0x1a8900){_0x283e97[_0x940f('0xe')]=_0x1a8900;if(_0x2bc966['query']['includeAll']){_0x4c4f7f[_0x940f('0x2c')]=[{'all':!![]}];}return db[_0x940f('0x1a')][_0x940f('0x2d')](_0x4c4f7f);})[_0x940f('0x13')](function(_0x43aeeb){_0x283e97['rows']=_0x43aeeb;return _0x283e97;})['then'](respondWithFilteredResult(_0x2c8dfc,_0x4c4f7f))[_0x940f('0x2e')](handleError(_0x2c8dfc,null));};exports[_0x940f('0x2f')]=function(_0x46fa36,_0x41e9c8){var _0x293b88={'raw':![],'where':{'id':_0x46fa36['params']['id']}},_0x201bb4={};_0x201bb4[_0x940f('0x1c')]=_['keys'](db[_0x940f('0x1a')]['rawAttributes']);_0x201bb4[_0x940f('0x1e')]=_['keys'](_0x46fa36[_0x940f('0x1e')]);_0x201bb4[_0x940f('0x1f')]=_['intersection'](_0x201bb4[_0x940f('0x1c')],_0x201bb4[_0x940f('0x1e')]);_0x293b88[_0x940f('0x20')]=_['intersection'](_0x201bb4[_0x940f('0x1c')],qs[_0x940f('0x22')](_0x46fa36[_0x940f('0x1e')][_0x940f('0x22')]));_0x293b88[_0x940f('0x20')]=_0x293b88[_0x940f('0x20')]['length']?_0x293b88['attributes']:_0x201bb4[_0x940f('0x1c')];if(_0x46fa36[_0x940f('0x1e')]['includeAll']){_0x293b88[_0x940f('0x2c')]=[{'all':!![]}];}_0x293b88=_[_0x940f('0x28')]({},_0x293b88,_0x46fa36['options']);return db[_0x940f('0x1a')][_0x940f('0x30')](_0x293b88)[_0x940f('0x13')](handleEntityNotFound(_0x41e9c8,null))['then'](respondWithResult(_0x41e9c8,null))[_0x940f('0x2e')](handleError(_0x41e9c8,null));};exports[_0x940f('0x31')]=function(_0x3bf960,_0x211044){return db['SquareProject'][_0x940f('0x31')](_0x3bf960['body'],{})[_0x940f('0x13')](function(_0x4e6938){var _0x42fc9f=_0x3bf960['user'][_0x940f('0x32')]({'plain':!![]});if(!_0x42fc9f)throw new Error(_0x940f('0x33'));if(_0x42fc9f[_0x940f('0x34')]===_0x940f('0x35')){var _0x4c0816=_0x4e6938[_0x940f('0x32')]({'plain':!![]});var _0x4fd848=_0x940f('0x11');return db[_0x940f('0x36')][_0x940f('0x30')]({'where':{'name':_0x4fd848,'userProfileId':_0x42fc9f[_0x940f('0x37')]},'raw':!![]})['then'](function(_0x381b6f){if(_0x381b6f&&_0x381b6f['autoAssociation']===0x0){return db[_0x940f('0x12')][_0x940f('0x31')]({'name':_0x4c0816[_0x940f('0x17')],'resourceId':_0x4c0816['id'],'type':_0x381b6f[_0x940f('0x17')],'sectionId':_0x381b6f['id']},{})[_0x940f('0x13')](function(){return _0x4e6938;});}else{return _0x4e6938;}})[_0x940f('0x2e')](function(_0xaa4c85){logger[_0x940f('0x15')](_0x940f('0x38'),_0xaa4c85);throw _0xaa4c85;});}return _0x4e6938;})[_0x940f('0x13')](respondWithResult(_0x211044,0xc9))[_0x940f('0x2e')](handleError(_0x211044,null));};exports[_0x940f('0x39')]=function(_0x551e96,_0x2b218e){if(_0x551e96['body']['id']){delete _0x551e96[_0x940f('0x3a')]['id'];}return db[_0x940f('0x1a')][_0x940f('0x30')]({'where':{'id':_0x551e96[_0x940f('0x3b')]['id']}})[_0x940f('0x13')](handleEntityNotFound(_0x2b218e,null))[_0x940f('0x13')](saveUpdates(_0x551e96[_0x940f('0x3a')],null))[_0x940f('0x13')](function(_0x47d04){if(!_0x47d04)return;var _0x4efe1c=_0x47d04[_0x940f('0x32')]({'plain':!![]});return _0x4efe1c;})[_0x940f('0x13')](function(_0x3119a6){var _0x57ca21=new Redis(config[_0x940f('0x6')]);_0x57ca21[_0x940f('0x3c')]('agi',JSON['stringify'](_[_0x940f('0x26')](_0x3119a6,['id',_0x940f('0x17'),_0x940f('0x3d')])));return _0x3119a6;})[_0x940f('0x13')](respondWithResult(_0x2b218e,null))['catch'](handleError(_0x2b218e,null));};exports[_0x940f('0x10')]=function(_0x2ccda5,_0x4a4c24){return db[_0x940f('0x1a')][_0x940f('0x30')]({'where':{'id':_0x2ccda5['params']['id']}})['then'](handleEntityNotFound(_0x4a4c24,null))[_0x940f('0x13')](removeEntity(_0x4a4c24,null))[_0x940f('0x2e')](handleError(_0x4a4c24,null));}; \ No newline at end of file +var _0xb890=['order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../config/logger','redis','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x459bae,_0x1d1831){var _0x5f0e71=function(_0x5ba84b){while(--_0x5ba84b){_0x459bae['push'](_0x459bae['shift']());}};_0x5f0e71(++_0x1d1831);}(_0xb890,0x1ed));var _0x0b89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb890[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b89('0x0'));var Redis=require(_0x0b89('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x0b89('0x2'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0b89('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0b89('0x4'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0b89('0x5')](socket);function respondWithResult(_0x4332a2,_0x206865){_0x206865=_0x206865||0xc8;return function(_0x4120af){if(_0x4120af){return _0x4332a2[_0x0b89('0x6')](_0x206865)[_0x0b89('0x7')](_0x4120af);}};}function respondWithFilteredResult(_0x918711,_0x25df71){return function(_0x5638e7){if(_0x5638e7){var _0xfe559b=typeof _0x25df71[_0x0b89('0x8')]===_0x0b89('0x9')&&typeof _0x25df71[_0x0b89('0xa')]===_0x0b89('0x9');var _0x49183f=_0x5638e7[_0x0b89('0xb')];var _0x2a01df=_0xfe559b?0x0:_0x25df71[_0x0b89('0x8')];var _0x998d8=_0xfe559b?_0x5638e7[_0x0b89('0xb')]:_0x25df71[_0x0b89('0x8')]+_0x25df71[_0x0b89('0xa')];var _0x296220;if(_0x998d8>=_0x49183f){_0x998d8=_0x49183f;_0x296220=0xc8;}else{_0x296220=0xce;}_0x918711[_0x0b89('0x6')](_0x296220);return _0x918711[_0x0b89('0xc')](_0x0b89('0xd'),_0x2a01df+'-'+_0x998d8+'/'+_0x49183f)[_0x0b89('0x7')](_0x5638e7);}return null;};}function saveUpdates(_0x197d93){return function(_0x5df28d){if(_0x5df28d){return _0x5df28d[_0x0b89('0xe')](_0x197d93)[_0x0b89('0xf')](function(_0x199aba){return _0x199aba;});}return null;};}function removeEntity(_0xd86d3d){return function(_0x1e58d9){if(_0x1e58d9){return _0x1e58d9[_0x0b89('0x10')]()[_0x0b89('0xf')](function(){var _0x4de94e=_0x1e58d9[_0x0b89('0x11')]({'plain':!![]});var _0x4e16eb='SquareProjects';return db[_0x0b89('0x12')]['destroy']({'where':{'type':_0x4e16eb,'resourceId':_0x4de94e['id']}})['then'](function(){return _0x1e58d9;});})['then'](function(){var _0x522700=new Redis(config[_0x0b89('0x3')]);_0x522700[_0x0b89('0x13')](_0x0b89('0x14'),JSON[_0x0b89('0x15')]({'id':_0x1e58d9['id'],'deleted':!![]}));})[_0x0b89('0xf')](function(){_0xd86d3d['status'](0xcc)[_0x0b89('0x16')]();});}};}function handleEntityNotFound(_0x31fe28){return function(_0x30076a){if(!_0x30076a){_0x31fe28[_0x0b89('0x17')](0x194);}return _0x30076a;};}function handleError(_0x3026d4,_0x147725){_0x147725=_0x147725||0x1f4;return function(_0x2b5dc4){logger[_0x0b89('0x18')](_0x2b5dc4[_0x0b89('0x19')]);if(_0x2b5dc4[_0x0b89('0x1a')]){delete _0x2b5dc4[_0x0b89('0x1a')];}_0x3026d4['status'](_0x147725)[_0x0b89('0x1b')](_0x2b5dc4);};}exports['index']=function(_0x5b6fdf,_0x53e6ba){var _0x527949={},_0x15a67e={},_0x38d64d={'count':0x0,'rows':[]};var _0x2c76c5=_[_0x0b89('0x1c')](db[_0x0b89('0x1d')][_0x0b89('0x1e')],function(_0x3d2fe4){return{'name':_0x3d2fe4[_0x0b89('0x1f')],'type':_0x3d2fe4[_0x0b89('0x20')]['key']};});_0x15a67e[_0x0b89('0x21')]=_[_0x0b89('0x1c')](_0x2c76c5,_0x0b89('0x1a'));_0x15a67e[_0x0b89('0x22')]=_[_0x0b89('0x23')](_0x5b6fdf[_0x0b89('0x22')]);_0x15a67e[_0x0b89('0x24')]=_[_0x0b89('0x25')](_0x15a67e['model'],_0x15a67e[_0x0b89('0x22')]);_0x527949[_0x0b89('0x26')]=_[_0x0b89('0x25')](_0x15a67e['model'],qs[_0x0b89('0x27')](_0x5b6fdf[_0x0b89('0x22')][_0x0b89('0x27')]));_0x527949[_0x0b89('0x26')]=_0x527949[_0x0b89('0x26')][_0x0b89('0x28')]?_0x527949[_0x0b89('0x26')]:_0x15a67e['model'];if(!_0x5b6fdf[_0x0b89('0x22')][_0x0b89('0x29')](_0x0b89('0x2a'))){_0x527949[_0x0b89('0xa')]=qs['limit'](_0x5b6fdf['query']['limit']);_0x527949['offset']=qs[_0x0b89('0x8')](_0x5b6fdf['query'][_0x0b89('0x8')]);}_0x527949[_0x0b89('0x2b')]=qs[_0x0b89('0x2c')](_0x5b6fdf[_0x0b89('0x22')][_0x0b89('0x2c')]);_0x527949['where']=qs['filters'](_['pick'](_0x5b6fdf[_0x0b89('0x22')],_0x15a67e[_0x0b89('0x24')]),_0x2c76c5);if(_0x5b6fdf[_0x0b89('0x22')][_0x0b89('0x2d')]){_0x527949[_0x0b89('0x2e')]=_['merge'](_0x527949[_0x0b89('0x2e')],{'$or':_[_0x0b89('0x1c')](_0x2c76c5,function(_0x139520){if(_0x139520['type']!==_0x0b89('0x2f')){var _0x2a1e16={};_0x2a1e16[_0x139520[_0x0b89('0x1a')]]={'$like':'%'+_0x5b6fdf[_0x0b89('0x22')]['filter']+'%'};return _0x2a1e16;}})});}_0x527949=_[_0x0b89('0x30')]({},_0x527949,_0x5b6fdf[_0x0b89('0x31')]);var _0x4de999={'where':_0x527949[_0x0b89('0x2e')]};return db[_0x0b89('0x1d')][_0x0b89('0xb')](_0x4de999)[_0x0b89('0xf')](function(_0x263a0c){_0x38d64d['count']=_0x263a0c;if(_0x5b6fdf[_0x0b89('0x22')][_0x0b89('0x32')]){_0x527949[_0x0b89('0x33')]=[{'all':!![]}];}return db[_0x0b89('0x1d')][_0x0b89('0x34')](_0x527949);})['then'](function(_0x35b103){_0x38d64d['rows']=_0x35b103;return _0x38d64d;})[_0x0b89('0xf')](respondWithFilteredResult(_0x53e6ba,_0x527949))[_0x0b89('0x35')](handleError(_0x53e6ba,null));};exports[_0x0b89('0x36')]=function(_0x11709a,_0x3fbc22){var _0x55e7ea={'raw':![],'where':{'id':_0x11709a[_0x0b89('0x37')]['id']}},_0xf2160e={};_0xf2160e['model']=_['keys'](db[_0x0b89('0x1d')][_0x0b89('0x1e')]);_0xf2160e[_0x0b89('0x22')]=_[_0x0b89('0x23')](_0x11709a[_0x0b89('0x22')]);_0xf2160e[_0x0b89('0x24')]=_[_0x0b89('0x25')](_0xf2160e[_0x0b89('0x21')],_0xf2160e['query']);_0x55e7ea[_0x0b89('0x26')]=_[_0x0b89('0x25')](_0xf2160e[_0x0b89('0x21')],qs[_0x0b89('0x27')](_0x11709a[_0x0b89('0x22')][_0x0b89('0x27')]));_0x55e7ea[_0x0b89('0x26')]=_0x55e7ea['attributes'][_0x0b89('0x28')]?_0x55e7ea[_0x0b89('0x26')]:_0xf2160e[_0x0b89('0x21')];if(_0x11709a[_0x0b89('0x22')][_0x0b89('0x32')]){_0x55e7ea[_0x0b89('0x33')]=[{'all':!![]}];}_0x55e7ea=_['merge']({},_0x55e7ea,_0x11709a['options']);return db[_0x0b89('0x1d')][_0x0b89('0x38')](_0x55e7ea)[_0x0b89('0xf')](handleEntityNotFound(_0x3fbc22,null))[_0x0b89('0xf')](respondWithResult(_0x3fbc22,null))['catch'](handleError(_0x3fbc22,null));};exports['create']=function(_0x21bb91,_0x4783c2){return db['SquareProject'][_0x0b89('0x39')](_0x21bb91[_0x0b89('0x3a')],{})[_0x0b89('0xf')](function(_0x117a8e){var _0x32b04b=_0x21bb91['user'][_0x0b89('0x11')]({'plain':!![]});if(!_0x32b04b)throw new Error(_0x0b89('0x3b'));if(_0x32b04b['role']===_0x0b89('0x3c')){var _0x56ea5a=_0x117a8e[_0x0b89('0x11')]({'plain':!![]});var _0x145155=_0x0b89('0x3d');return db[_0x0b89('0x3e')]['find']({'where':{'name':_0x145155,'userProfileId':_0x32b04b[_0x0b89('0x3f')]},'raw':!![]})[_0x0b89('0xf')](function(_0x17b7df){if(_0x17b7df&&_0x17b7df[_0x0b89('0x40')]===0x0){return db[_0x0b89('0x12')][_0x0b89('0x39')]({'name':_0x56ea5a[_0x0b89('0x1a')],'resourceId':_0x56ea5a['id'],'type':_0x17b7df[_0x0b89('0x1a')],'sectionId':_0x17b7df['id']},{})['then'](function(){return _0x117a8e;});}else{return _0x117a8e;}})[_0x0b89('0x35')](function(_0x53d028){logger[_0x0b89('0x18')](_0x0b89('0x41'),_0x53d028);throw _0x53d028;});}return _0x117a8e;})[_0x0b89('0xf')](respondWithResult(_0x4783c2,0xc9))[_0x0b89('0x35')](handleError(_0x4783c2,null));};exports[_0x0b89('0xe')]=function(_0x298a30,_0x2f482a){if(_0x298a30[_0x0b89('0x3a')]['id']){delete _0x298a30[_0x0b89('0x3a')]['id'];}return db[_0x0b89('0x1d')][_0x0b89('0x38')]({'where':{'id':_0x298a30[_0x0b89('0x37')]['id']}})[_0x0b89('0xf')](handleEntityNotFound(_0x2f482a,null))[_0x0b89('0xf')](saveUpdates(_0x298a30[_0x0b89('0x3a')],null))[_0x0b89('0xf')](function(_0x3a5aa9){if(!_0x3a5aa9)return;var _0xb9c364=_0x3a5aa9[_0x0b89('0x11')]({'plain':!![]});return _0xb9c364;})[_0x0b89('0xf')](function(_0x55564f){var _0x414ea3=new Redis(config[_0x0b89('0x3')]);_0x414ea3['publish'](_0x0b89('0x14'),JSON[_0x0b89('0x15')](_['pick'](_0x55564f,['id','name',_0x0b89('0x42')])));return _0x55564f;})[_0x0b89('0xf')](respondWithResult(_0x2f482a,null))[_0x0b89('0x35')](handleError(_0x2f482a,null));};exports['destroy']=function(_0x491371,_0x35238b){return db[_0x0b89('0x1d')][_0x0b89('0x38')]({'where':{'id':_0x491371[_0x0b89('0x37')]['id']}})[_0x0b89('0xf')](handleEntityNotFound(_0x35238b,null))[_0x0b89('0xf')](removeEntity(_0x35238b,null))[_0x0b89('0x35')](handleError(_0x35238b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 83f53d4..aab6f63 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 _0x33e6=['emit','hasOwnProperty','exports','../../mysqldb','SquareProject','setMaxListeners','remove'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x33e6,0x1c3));var _0x633e=function(_0x369d5d,_0x3d29ba){_0x369d5d=_0x369d5d-0x0;var _0x1e77ed=_0x33e6[_0x369d5d];return _0x1e77ed;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x633e('0x0'))['db'][_0x633e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x633e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x633e('0x3')};function emitEvent(_0x374036){return function(_0x2fd3d6,_0x5d38f3,_0x25b3b2){SquareProjectEvents[_0x633e('0x4')](_0x374036+':'+_0x2fd3d6['id'],_0x2fd3d6);SquareProjectEvents['emit'](_0x374036,_0x2fd3d6);_0x25b3b2(null);};}for(var e in events){if(events[_0x633e('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x633e('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x4bcc=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a131d,_0x59a2a2){var _0x393809=function(_0x37b648){while(--_0x37b648){_0x1a131d['push'](_0x1a131d['shift']());}};_0x393809(++_0x59a2a2);}(_0x4bcc,0x96));var _0xc4bc=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4bcc[_0x40ac5e];return _0x2839d6;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xc4bc('0x0'))['db'][_0xc4bc('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc4bc('0x2')](0x0);var events={'afterCreate':_0xc4bc('0x3'),'afterUpdate':_0xc4bc('0x4'),'afterDestroy':_0xc4bc('0x5')};function emitEvent(_0x374a47){return function(_0x296918,_0x16a852,_0x25d784){SquareProjectEvents['emit'](_0x374a47+':'+_0x296918['id'],_0x296918);SquareProjectEvents[_0xc4bc('0x6')](_0x374a47,_0x296918);_0x25d784(null);};}for(var e in events){if(events[_0xc4bc('0x7')](e)){var event=events[e];SquareProject[_0xc4bc('0x8')](e,emitEvent(event));}}module[_0xc4bc('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 5170146..ac7f4ba 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 _0x451f=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','preproduction','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','format','util'];(function(_0x20634c,_0x5534fc){var _0x5d8936=function(_0x6b45f2){while(--_0x6b45f2){_0x20634c['push'](_0x20634c['shift']());}};_0x5d8936(++_0x5534fc);}(_0x451f,0xdf));var _0xf451=function(_0x4ed476,_0x170bd4){_0x4ed476=_0x4ed476-0x0;var _0x509ee4=_0x451f[_0x4ed476];return _0x509ee4;};'use strict';var _=require('lodash');var util=require(_0xf451('0x0'));var logger=require(_0xf451('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf451('0x2'));var rp=require(_0xf451('0x3'));var fs=require('fs');var path=require(_0xf451('0x4'));var rimraf=require(_0xf451('0x5'));var config=require(_0xf451('0x6'));var attributes=require(_0xf451('0x7'));module[_0xf451('0x8')]=function(_0x143256,_0x2b346c){return _0x143256[_0xf451('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d60f6,_0x127ca9,_0x214d1b){if(_0x3d60f6['changed'](_0xf451('0xa'))){_0x3d60f6['savedAt']=moment()['format'](_0xf451('0xb'));}if(_0x3d60f6[_0xf451('0xc')](_0xf451('0xd'))){_0x3d60f6[_0xf451('0xe')]=moment()[_0xf451('0xf')](_0xf451('0xb'));}_0x214d1b(null,_0x3d60f6);}}});}; \ No newline at end of file +var _0xf442=['../../config/logger','api','path','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5af9b3,_0x516c90){var _0x129f28=function(_0x1a8fe6){while(--_0x1a8fe6){_0x5af9b3['push'](_0x5af9b3['shift']());}};_0x129f28(++_0x516c90);}(_0xf442,0x19e));var _0x2f44=function(_0x209b4e,_0x5ef906){_0x209b4e=_0x209b4e-0x0;var _0x55461c=_0xf442[_0x209b4e];return _0x55461c;};'use strict';var _=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var logger=require(_0x2f44('0x2'))(_0x2f44('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f44('0x4'));var rimraf=require('rimraf');var config=require(_0x2f44('0x5'));var attributes=require(_0x2f44('0x6'));module[_0x2f44('0x7')]=function(_0xe370d4,_0x5daf30){return _0xe370d4[_0x2f44('0x8')]('SquareProject',attributes,{'tableName':_0x2f44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe4476,_0xe6957c,_0x13dd21){if(_0xe4476[_0x2f44('0xa')]('preproduction')){_0xe4476['savedAt']=moment()[_0x2f44('0xb')](_0x2f44('0xc'));}if(_0xe4476['changed']('production')){_0xe4476['publishedAt']=moment()[_0x2f44('0xb')](_0x2f44('0xc'));}_0x13dd21(null,_0xe4476);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7699e3d..f53cad5 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 _0xb195=['rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowSquareProject','raw','then','lodash','ioredis','../../mysqldb','../../config/logger'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0xb195,0x128));var _0x5b19=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb195[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x5b19('0x0'));var Redis=require(_0x5b19('0x1'));var db=require(_0x5b19('0x2'))['db'];var logger=require(_0x5b19('0x3'))(_0x5b19('0x4'));var config=require(_0x5b19('0x5'));config[_0x5b19('0x6')]=_['defaults'](config[_0x5b19('0x6')],{'host':_0x5b19('0x7'),'port':0x18eb});var socket=require(_0x5b19('0x8'))(new Redis(config[_0x5b19('0x6')]));require(_0x5b19('0x9'))[_0x5b19('0xa')](socket);exports[_0x5b19('0xb')]=function(_0x4c4510){var _0x3350fe=this;return new Promise(function(_0x542e56,_0x5de2b1){return db[_0x5b19('0xc')][_0x5b19('0xd')]({'raw':_0x4c4510[_0x5b19('0xe')]?_0x4c4510['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c4510[_0x5b19('0xe')]?_0x4c4510[_0x5b19('0xe')][_0x5b19('0xf')]||null:null,'attributes':_0x4c4510[_0x5b19('0xe')]?_0x4c4510[_0x5b19('0xe')][_0x5b19('0x10')]||null:null,'limit':_0x4c4510[_0x5b19('0xe')]?_0x4c4510[_0x5b19('0xe')][_0x5b19('0x11')]||null:null,'include':_0x4c4510[_0x5b19('0xe')]?_0x4c4510[_0x5b19('0xe')][_0x5b19('0x12')]?_[_0x5b19('0x13')](_0x4c4510['options'][_0x5b19('0x12')],function(_0x54d896){return{'model':db[_0x54d896[_0x5b19('0x14')]],'as':_0x54d896['as'],'attributes':_0x54d896['attributes'],'include':_0x54d896[_0x5b19('0x12')]?_[_0x5b19('0x13')](_0x54d896[_0x5b19('0x12')],function(_0x37cf57){return{'model':db[_0x37cf57['model']],'as':_0x37cf57['as'],'attributes':_0x37cf57['attributes'],'include':_0x37cf57[_0x5b19('0x12')]?_['map'](_0x37cf57[_0x5b19('0x12')],function(_0x3fbe19){return{'model':db[_0x3fbe19[_0x5b19('0x14')]],'as':_0x3fbe19['as'],'attributes':_0x3fbe19[_0x5b19('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bc73b){logger[_0x5b19('0x15')](_0x5b19('0xb'),_0x4c4510);logger[_0x5b19('0x16')]('GetSquareProjects',_0x4c4510,JSON[_0x5b19('0x17')](_0x1bc73b));_0x542e56(_0x1bc73b);})[_0x5b19('0x18')](function(_0x3dbdc0){logger[_0x5b19('0x19')](_0x5b19('0xb'),_0x3dbdc0['message'],_0x4c4510);_0x5de2b1(_0x3350fe[_0x5b19('0x19')](0x1f4,_0x3dbdc0[_0x5b19('0x1a')]));});});};exports[_0x5b19('0x1b')]=function(_0x3cc235){var _0x425229=this;return new Promise(function(_0x3eb181,_0x410460){return db[_0x5b19('0xc')]['find']({'raw':_0x3cc235['options']?_0x3cc235[_0x5b19('0xe')][_0x5b19('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cc235[_0x5b19('0xe')]?_0x3cc235['options'][_0x5b19('0xf')]||null:null,'attributes':_0x3cc235[_0x5b19('0xe')]?_0x3cc235[_0x5b19('0xe')][_0x5b19('0x10')]||null:null,'include':_0x3cc235[_0x5b19('0xe')]?_0x3cc235[_0x5b19('0xe')][_0x5b19('0x12')]?_[_0x5b19('0x13')](_0x3cc235[_0x5b19('0xe')][_0x5b19('0x12')],function(_0x35d2ef){return{'model':db[_0x35d2ef['model']],'as':_0x35d2ef['as'],'attributes':_0x35d2ef['attributes'],'include':_0x35d2ef['include']?_[_0x5b19('0x13')](_0x35d2ef[_0x5b19('0x12')],function(_0x410308){return{'model':db[_0x410308['model']],'as':_0x410308['as'],'attributes':_0x410308[_0x5b19('0x10')],'include':_0x410308[_0x5b19('0x12')]?_[_0x5b19('0x13')](_0x410308[_0x5b19('0x12')],function(_0x589e08){return{'model':db[_0x589e08[_0x5b19('0x14')]],'as':_0x589e08['as'],'attributes':_0x589e08[_0x5b19('0x10')]};}):[]};}):[]};}):[]:[]})[_0x5b19('0x1d')](function(_0x150afc){logger['info']('ShowSquareProject',_0x3cc235);logger[_0x5b19('0x16')]('ShowSquareProject',_0x3cc235,JSON[_0x5b19('0x17')](_0x150afc));_0x3eb181(_0x150afc);})[_0x5b19('0x18')](function(_0x21f0fa){logger[_0x5b19('0x19')](_0x5b19('0x1b'),_0x21f0fa['message'],_0x3cc235);_0x410460(_0x425229[_0x5b19('0x19')](0x1f4,_0x21f0fa[_0x5b19('0x1a')]));});});}; \ No newline at end of file +var _0x9f54=['SquareProject','findAll','options','raw','where','limit','include','map','model','attributes','then','debug','stringify','catch','message','error','ShowSquareProject','find','info','ioredis','../../config/logger','rpc','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects'];(function(_0x517840,_0x46405e){var _0x5e298c=function(_0x121ef7){while(--_0x121ef7){_0x517840['push'](_0x517840['shift']());}};_0x5e298c(++_0x46405e);}(_0x9f54,0x1b7));var _0x49f5=function(_0x5929d8,_0x265f63){_0x5929d8=_0x5929d8-0x0;var _0x22820f=_0x9f54[_0x5929d8];return _0x22820f;};'use strict';var _=require('lodash');var Redis=require(_0x49f5('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x49f5('0x1'))(_0x49f5('0x2'));var config=require('../../config/environment');config[_0x49f5('0x3')]=_[_0x49f5('0x4')](config[_0x49f5('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x49f5('0x5'))(new Redis(config[_0x49f5('0x3')]));require(_0x49f5('0x6'))[_0x49f5('0x7')](socket);exports[_0x49f5('0x8')]=function(_0x460acc){var _0x5733d2=this;return new Promise(function(_0xf41604,_0x30383){return db[_0x49f5('0x9')][_0x49f5('0xa')]({'raw':_0x460acc[_0x49f5('0xb')]?_0x460acc['options'][_0x49f5('0xc')]===undefined?!![]:![]:!![],'where':_0x460acc[_0x49f5('0xb')]?_0x460acc[_0x49f5('0xb')][_0x49f5('0xd')]||null:null,'attributes':_0x460acc[_0x49f5('0xb')]?_0x460acc[_0x49f5('0xb')]['attributes']||null:null,'limit':_0x460acc[_0x49f5('0xb')]?_0x460acc[_0x49f5('0xb')][_0x49f5('0xe')]||null:null,'include':_0x460acc[_0x49f5('0xb')]?_0x460acc['options'][_0x49f5('0xf')]?_[_0x49f5('0x10')](_0x460acc[_0x49f5('0xb')][_0x49f5('0xf')],function(_0x50366a){return{'model':db[_0x50366a[_0x49f5('0x11')]],'as':_0x50366a['as'],'attributes':_0x50366a[_0x49f5('0x12')],'include':_0x50366a[_0x49f5('0xf')]?_[_0x49f5('0x10')](_0x50366a[_0x49f5('0xf')],function(_0x318857){return{'model':db[_0x318857[_0x49f5('0x11')]],'as':_0x318857['as'],'attributes':_0x318857[_0x49f5('0x12')],'include':_0x318857[_0x49f5('0xf')]?_[_0x49f5('0x10')](_0x318857[_0x49f5('0xf')],function(_0x142d6c){return{'model':db[_0x142d6c[_0x49f5('0x11')]],'as':_0x142d6c['as'],'attributes':_0x142d6c[_0x49f5('0x12')]};}):[]};}):[]};}):[]:[]})[_0x49f5('0x13')](function(_0x5ba848){logger['info'](_0x49f5('0x8'),_0x460acc);logger[_0x49f5('0x14')](_0x49f5('0x8'),_0x460acc,JSON[_0x49f5('0x15')](_0x5ba848));_0xf41604(_0x5ba848);})[_0x49f5('0x16')](function(_0x24c3f2){logger['error']('GetSquareProjects',_0x24c3f2[_0x49f5('0x17')],_0x460acc);_0x30383(_0x5733d2[_0x49f5('0x18')](0x1f4,_0x24c3f2[_0x49f5('0x17')]));});});};exports[_0x49f5('0x19')]=function(_0x47d1ea){var _0x4aaeed=this;return new Promise(function(_0x1f203e,_0x5a394c){return db['SquareProject'][_0x49f5('0x1a')]({'raw':_0x47d1ea['options']?_0x47d1ea['options']['raw']===undefined?!![]:![]:!![],'where':_0x47d1ea[_0x49f5('0xb')]?_0x47d1ea[_0x49f5('0xb')][_0x49f5('0xd')]||null:null,'attributes':_0x47d1ea[_0x49f5('0xb')]?_0x47d1ea[_0x49f5('0xb')][_0x49f5('0x12')]||null:null,'include':_0x47d1ea[_0x49f5('0xb')]?_0x47d1ea[_0x49f5('0xb')][_0x49f5('0xf')]?_['map'](_0x47d1ea[_0x49f5('0xb')]['include'],function(_0x4ac021){return{'model':db[_0x4ac021[_0x49f5('0x11')]],'as':_0x4ac021['as'],'attributes':_0x4ac021[_0x49f5('0x12')],'include':_0x4ac021[_0x49f5('0xf')]?_[_0x49f5('0x10')](_0x4ac021[_0x49f5('0xf')],function(_0x4ee97a){return{'model':db[_0x4ee97a[_0x49f5('0x11')]],'as':_0x4ee97a['as'],'attributes':_0x4ee97a[_0x49f5('0x12')],'include':_0x4ee97a['include']?_[_0x49f5('0x10')](_0x4ee97a[_0x49f5('0xf')],function(_0x26b9f3){return{'model':db[_0x26b9f3[_0x49f5('0x11')]],'as':_0x26b9f3['as'],'attributes':_0x26b9f3[_0x49f5('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413859){logger[_0x49f5('0x1b')]('ShowSquareProject',_0x47d1ea);logger[_0x49f5('0x14')](_0x49f5('0x19'),_0x47d1ea,JSON[_0x49f5('0x15')](_0x413859));_0x1f203e(_0x413859);})[_0x49f5('0x16')](function(_0x337531){logger['error'](_0x49f5('0x19'),_0x337531[_0x49f5('0x17')],_0x47d1ea);_0x5a394c(_0x4aaeed['error'](0x1f4,_0x337531[_0x49f5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index efd0593..53b97ad 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 _0xe3b4=['remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xe3b4,0xa8));var _0x4e3b=function(_0x4f386c,_0x30844a){_0x4f386c=_0x4f386c-0x0;var _0x253c27=_0xe3b4[_0x4f386c];return _0x253c27;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x4e3b('0x0'),_0x4e3b('0x1')];function createListener(_0x298b75,_0x25e2db){return function(_0x5056c0){_0x25e2db[_0x4e3b('0x2')](_0x298b75,_0x5056c0);};}function removeListener(_0x50efd1,_0x360204){return function(){SquareProjectEvents[_0x4e3b('0x3')](_0x50efd1,_0x360204);};}exports[_0x4e3b('0x4')]=function(_0x37a8d2){for(var _0x304cbe=0x0,_0x55096e=events[_0x4e3b('0x5')];_0x304cbe<_0x55096e;_0x304cbe++){var _0x486914=events[_0x304cbe];var _0x4c1e05=createListener(_0x4e3b('0x6')+_0x486914,_0x37a8d2);SquareProjectEvents['on'](_0x486914,_0x4c1e05);}}; \ No newline at end of file +var _0x0f12=['update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0xdfabdc,_0x1bd6fe){var _0x4738b0=function(_0x5005ae){while(--_0x5005ae){_0xdfabdc['push'](_0xdfabdc['shift']());}};_0x4738b0(++_0x1bd6fe);}(_0x0f12,0x143));var _0x20f1=function(_0x599648,_0x252e6d){_0x599648=_0x599648-0x0;var _0x1dca76=_0x0f12[_0x599648];return _0x1dca76;};'use strict';var SquareProjectEvents=require(_0x20f1('0x0'));var events=['save','remove',_0x20f1('0x1')];function createListener(_0x10670c,_0x5f5bab){return function(_0x40588a){_0x5f5bab[_0x20f1('0x2')](_0x10670c,_0x40588a);};}function removeListener(_0x25c17e,_0x45d73e){return function(){SquareProjectEvents[_0x20f1('0x3')](_0x25c17e,_0x45d73e);};}exports[_0x20f1('0x4')]=function(_0x2486b2){for(var _0x2263e4=0x0,_0x93f6ae=events['length'];_0x2263e4<_0x93f6ae;_0x2263e4++){var _0x5a6a14=events[_0x2263e4];var _0x71f9cd=createListener(_0x20f1('0x5')+_0x5a6a14,_0x2486b2);SquareProjectEvents['on'](_0x5a6a14,_0x71f9cd);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ccd20bf..bd6ace5 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(_0x9d8d24,_0x1f47b5){var _0x8d3895=function(_0x428cc3){while(--_0x428cc3){_0x9d8d24['push'](_0x9d8d24['shift']());}};_0x8d3895(++_0x1f47b5);}(_0x5fab,0x177));var _0xb5fa=function(_0xa6aa71,_0x2a5f0c){_0xa6aa71=_0xa6aa71-0x0;var _0x3c02cb=_0x5fab[_0xa6aa71];return _0x3c02cb;};'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 _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(_0x2a2a33,_0x1bf348){var _0xfa75db=function(_0x440189){while(--_0x440189){_0x2a2a33['push'](_0x2a2a33['shift']());}};_0xfa75db(++_0x1bf348);}(_0x5fab,0x177));var _0xb5fa=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x5fab[_0x4d0d85];return _0x290a74;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index fd9cac3..19b0c96 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 _0xda19=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xda19,0xd5));var _0x9da1=function(_0x5143b4,_0x2d55aa){_0x5143b4=_0x5143b4-0x0;var _0x1ec73a=_0xda19[_0x5143b4];return _0x1ec73a;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'uniqueid':{'type':Sequelize[_0x9da1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9da1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9da1('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9da1('0x1')]},'dnid':{'type':Sequelize[_0x9da1('0x1')]},'projectName':{'type':Sequelize[_0x9da1('0x1')]},'saveName':{'type':Sequelize[_0x9da1('0x1')]},'filename':{'type':Sequelize[_0x9da1('0x1')]},'savePath':{'type':Sequelize[_0x9da1('0x1')]},'format':{'type':Sequelize[_0x9da1('0x2')],'get':function(){var _0x2c3cdd='';var _0x1c24e6=this[_0x9da1('0x3')]('savePath');if(_0x1c24e6){_0x2c3cdd=_0x1c24e6['substring'](_0x1c24e6['lastIndexOf']('.'));}return _0x2c3cdd;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x9f6b5a,_0x4b34d2){var _0x3fc17a=function(_0x15da1a){while(--_0x15da1a){_0x9f6b5a['push'](_0x9f6b5a['shift']());}};_0x3fc17a(++_0x4b34d2);}(_0x5fd1,0x155));var _0x15fd=function(_0x3bc01f,_0x2d65d3){_0x3bc01f=_0x3bc01f-0x0;var _0x225a87=_0x5fd1[_0x3bc01f];return _0x225a87;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b2b54ca..e813603 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 _0x90be=['path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','options','catch','create','body','find','../../components/encryptor','uniqueid','params','filename','format','%s.cypher','decryptFile','secrets','recording','savePath','existsSync','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0x90be,0xc2));var _0xe90b=function(_0x108a7f,_0x362052){_0x108a7f=_0x108a7f-0x0;var _0x9f53f3=_0x90be[_0x108a7f];return _0x9f53f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe90b('0x0'));var zipdir=require(_0xe90b('0x1'));var jsonpatch=require(_0xe90b('0x2'));var rp=require(_0xe90b('0x3'));var moment=require(_0xe90b('0x4'));var BPromise=require(_0xe90b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe90b('0x6'));var sox=require('sox');var csv=require(_0xe90b('0x7'));var ejs=require(_0xe90b('0x8'));var fs=require('fs');var fs_extra=require(_0xe90b('0x9'));var _=require('lodash');var squel=require(_0xe90b('0xa'));var crypto=require('crypto');var jsforce=require(_0xe90b('0xb'));var deskjs=require(_0xe90b('0xc'));var toCsv=require(_0xe90b('0x7'));var querystring=require(_0xe90b('0xd'));var Papa=require(_0xe90b('0xe'));var Redis=require(_0xe90b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe90b('0x10'));var as=require(_0xe90b('0x11'));var hardwareService=require(_0xe90b('0x12'));var logger=require(_0xe90b('0x13'))(_0xe90b('0x14'));var utils=require(_0xe90b('0x15'));var config=require(_0xe90b('0x16'));var licenseUtil=require(_0xe90b('0x17'));var db=require(_0xe90b('0x18'))['db'];function respondWithStatusCode(_0x34da84,_0x1ce468){_0x1ce468=_0x1ce468||0xcc;return function(_0x9593fd){if(_0x9593fd){return _0x34da84['sendStatus'](_0x1ce468);}return _0x34da84[_0xe90b('0x19')](_0x1ce468)[_0xe90b('0x1a')]();};}function respondWithResult(_0x47e524,_0x3d3884){_0x3d3884=_0x3d3884||0xc8;return function(_0x21de0e){if(_0x21de0e){return _0x47e524[_0xe90b('0x19')](_0x3d3884)[_0xe90b('0x1b')](_0x21de0e);}};}function respondWithFilteredResult(_0x349799,_0x322933){return function(_0x3fe524){if(_0x3fe524){var _0x53bb91=typeof _0x322933[_0xe90b('0x1c')]===_0xe90b('0x1d')&&typeof _0x322933['limit']===_0xe90b('0x1d');var _0x295b4f=_0x3fe524['count'];var _0x3aaef3=_0x53bb91?0x0:_0x322933[_0xe90b('0x1c')];var _0x50b4b6=_0x53bb91?_0x3fe524[_0xe90b('0x1e')]:_0x322933[_0xe90b('0x1c')]+_0x322933[_0xe90b('0x1f')];var _0x324d7f;if(_0x50b4b6>=_0x295b4f){_0x50b4b6=_0x295b4f;_0x324d7f=0xc8;}else{_0x324d7f=0xce;}_0x349799[_0xe90b('0x19')](_0x324d7f);return _0x349799[_0xe90b('0x20')]('Content-Range',_0x3aaef3+'-'+_0x50b4b6+'/'+_0x295b4f)[_0xe90b('0x1b')](_0x3fe524);}return null;};}function patchUpdates(_0x2fb3ab){return function(_0xef7106){try{jsonpatch['apply'](_0xef7106,_0x2fb3ab,!![]);}catch(_0x6abd16){return BPromise[_0xe90b('0x21')](_0x6abd16);}return _0xef7106[_0xe90b('0x22')]();};}function saveUpdates(_0x256f65,_0x51b114){return function(_0x2877fd){if(_0x2877fd){return _0x2877fd[_0xe90b('0x23')](_0x256f65)[_0xe90b('0x24')](function(_0x436967){return _0x436967;});}return null;};}function removeEntity(_0x249af8,_0x3efc50){return function(_0x454c38){if(_0x454c38){return _0x454c38[_0xe90b('0x25')]()[_0xe90b('0x24')](function(){_0x249af8['status'](0xcc)[_0xe90b('0x1a')]();});}};}function handleEntityNotFound(_0xe7b3a6,_0x242c62){return function(_0x10a8ea){if(!_0x10a8ea){_0xe7b3a6['sendStatus'](0x194);}return _0x10a8ea;};}function handleError(_0x1629b1,_0x146ea1){_0x146ea1=_0x146ea1||0x1f4;return function(_0x167361){logger[_0xe90b('0x26')](_0x167361[_0xe90b('0x27')]);if(_0x167361[_0xe90b('0x28')]){delete _0x167361[_0xe90b('0x28')];}_0x1629b1[_0xe90b('0x19')](_0x146ea1)[_0xe90b('0x29')](_0x167361);};}exports[_0xe90b('0x2a')]=function(_0x4d77dc,_0xa24141){var _0xfc27ca={},_0x4572e3={},_0x2c7721={'count':0x0,'rows':[]};var _0x1100d2=_[_0xe90b('0x2b')](db[_0xe90b('0x2c')][_0xe90b('0x2d')],function(_0x5cc763){return{'name':_0x5cc763[_0xe90b('0x2e')],'type':_0x5cc763[_0xe90b('0x2f')][_0xe90b('0x30')]};});_0x4572e3[_0xe90b('0x31')]=_[_0xe90b('0x2b')](_0x1100d2,'name');_0x4572e3[_0xe90b('0x32')]=_[_0xe90b('0x33')](_0x4d77dc[_0xe90b('0x32')]);_0x4572e3[_0xe90b('0x34')]=_[_0xe90b('0x35')](_0x4572e3[_0xe90b('0x31')],_0x4572e3[_0xe90b('0x32')]);_0xfc27ca[_0xe90b('0x36')]=_[_0xe90b('0x35')](_0x4572e3[_0xe90b('0x31')],qs[_0xe90b('0x37')](_0x4d77dc['query']['fields']));_0xfc27ca['attributes']=_0xfc27ca['attributes'][_0xe90b('0x38')]?_0xfc27ca[_0xe90b('0x36')]:_0x4572e3[_0xe90b('0x31')];if(!_0x4d77dc['query'][_0xe90b('0x39')](_0xe90b('0x3a'))){_0xfc27ca['limit']=qs[_0xe90b('0x1f')](_0x4d77dc['query'][_0xe90b('0x1f')]);_0xfc27ca[_0xe90b('0x1c')]=qs[_0xe90b('0x1c')](_0x4d77dc[_0xe90b('0x32')][_0xe90b('0x1c')]);}_0xfc27ca[_0xe90b('0x3b')]=qs[_0xe90b('0x3c')](_0x4d77dc[_0xe90b('0x32')][_0xe90b('0x3c')]);_0xfc27ca[_0xe90b('0x3d')]=qs[_0xe90b('0x34')](_[_0xe90b('0x3e')](_0x4d77dc['query'],_0x4572e3['filters']),_0x1100d2);if(_0x4d77dc[_0xe90b('0x32')][_0xe90b('0x3f')]){_0xfc27ca[_0xe90b('0x3d')]=_[_0xe90b('0x40')](_0xfc27ca[_0xe90b('0x3d')],{'$or':_['map'](_0x1100d2,function(_0x9a311){if(_0x9a311[_0xe90b('0x2f')]!==_0xe90b('0x41')){var _0x2f48b1={};_0x2f48b1[_0x9a311[_0xe90b('0x28')]]={'$like':'%'+_0x4d77dc[_0xe90b('0x32')][_0xe90b('0x3f')]+'%'};return _0x2f48b1;}})});}_0xfc27ca=_['merge']({},_0xfc27ca,_0x4d77dc['options']);var _0x291a40={'where':_0xfc27ca['where']};return db['SquareRecording'][_0xe90b('0x1e')](_0x291a40)[_0xe90b('0x24')](function(_0x33234f){_0x2c7721[_0xe90b('0x1e')]=_0x33234f;if(_0x4d77dc[_0xe90b('0x32')][_0xe90b('0x42')]){_0xfc27ca['include']=[{'all':!![]}];}return db[_0xe90b('0x2c')][_0xe90b('0x43')](_0xfc27ca);})[_0xe90b('0x24')](function(_0x32c41c){_0x2c7721[_0xe90b('0x44')]=_0x32c41c;return _0x2c7721;})[_0xe90b('0x24')](respondWithFilteredResult(_0xa24141,_0xfc27ca))['catch'](handleError(_0xa24141,null));};exports[_0xe90b('0x45')]=function(_0x2b00e5,_0x2f16fc){var _0xcc874b={'raw':!![],'where':{'id':_0x2b00e5['params']['id']}},_0x4eb37b={};_0x4eb37b[_0xe90b('0x31')]=_['keys'](db['SquareRecording'][_0xe90b('0x2d')]);_0x4eb37b[_0xe90b('0x32')]=_[_0xe90b('0x33')](_0x2b00e5[_0xe90b('0x32')]);_0x4eb37b[_0xe90b('0x34')]=_[_0xe90b('0x35')](_0x4eb37b['model'],_0x4eb37b[_0xe90b('0x32')]);_0xcc874b[_0xe90b('0x36')]=_['intersection'](_0x4eb37b[_0xe90b('0x31')],qs[_0xe90b('0x37')](_0x2b00e5[_0xe90b('0x32')][_0xe90b('0x37')]));_0xcc874b[_0xe90b('0x36')]=_0xcc874b['attributes']['length']?_0xcc874b['attributes']:_0x4eb37b[_0xe90b('0x31')];if(_0x2b00e5[_0xe90b('0x32')]['includeAll']){_0xcc874b['include']=[{'all':!![]}];}_0xcc874b=_[_0xe90b('0x40')]({},_0xcc874b,_0x2b00e5[_0xe90b('0x46')]);return db[_0xe90b('0x2c')]['find'](_0xcc874b)['then'](handleEntityNotFound(_0x2f16fc,null))[_0xe90b('0x24')](respondWithResult(_0x2f16fc,null))[_0xe90b('0x47')](handleError(_0x2f16fc,null));};exports[_0xe90b('0x48')]=function(_0x49b5e9,_0x11a1dd){return db['SquareRecording'][_0xe90b('0x48')](_0x49b5e9[_0xe90b('0x49')],{})[_0xe90b('0x24')](respondWithResult(_0x11a1dd,0xc9))[_0xe90b('0x47')](handleError(_0x11a1dd,null));};exports[_0xe90b('0x23')]=function(_0x2f1389,_0x21b051){if(_0x2f1389[_0xe90b('0x49')]['id']){delete _0x2f1389[_0xe90b('0x49')]['id'];}return db[_0xe90b('0x2c')][_0xe90b('0x4a')]({'where':{'id':_0x2f1389['params']['id']}})[_0xe90b('0x24')](handleEntityNotFound(_0x21b051,null))[_0xe90b('0x24')](saveUpdates(_0x2f1389[_0xe90b('0x49')],null))[_0xe90b('0x24')](respondWithResult(_0x21b051,null))[_0xe90b('0x47')](handleError(_0x21b051,null));};exports['download']=function(_0x50f5f3,_0x4aaaa6,_0x38b1ea){var _0x5dc24c=require(_0xe90b('0x4b'));var _0x288ff5=![];var _0x565a8f={};if(_0x50f5f3[_0xe90b('0x32')][_0xe90b('0x2f')]&&_0x50f5f3[_0xe90b('0x32')][_0xe90b('0x2f')]===_0xe90b('0x4c')){_0x565a8f[_0xe90b('0x4c')]=_0x50f5f3[_0xe90b('0x4d')]['id'];}else{_0x565a8f['id']=_0x50f5f3[_0xe90b('0x4d')]['id'];}return db['SquareRecording'][_0xe90b('0x4a')]({'where':_0x565a8f,'attributes':['id','savePath',_0xe90b('0x4e')],'raw':!![]})[_0xe90b('0x24')](handleEntityNotFound(_0x4aaaa6,null))[_0xe90b('0x24')](function(_0x317266){if(_0x317266){var _0x4b93e9=_0x317266['savePath'];var _0x3ae62a=util[_0xe90b('0x4f')](_0xe90b('0x50'),_0x4b93e9);if(fs['existsSync'](_0x3ae62a)){_0x288ff5=!![];return _0x5dc24c[_0xe90b('0x51')](_0x3ae62a,_0x4b93e9,config[_0xe90b('0x52')][_0xe90b('0x53')])['then'](function(){return _0x317266;});}return _0x317266;}})[_0xe90b('0x24')](function(_0x4b5514){if(_0x4b5514){var _0x4ef8a3=_0x4b5514[_0xe90b('0x54')];if(!fs[_0xe90b('0x55')](_0x4ef8a3)){throw new db['Sequelize'][(_0xe90b('0x56'))](_0xe90b('0x57'));}if(_0x4b5514[_0xe90b('0x4e')]){return _0x4aaaa6[_0xe90b('0x58')](_0x4ef8a3,_0x4b5514[_0xe90b('0x4e')]+path[_0xe90b('0x59')](_0x4ef8a3),function(){if(_0x288ff5){fs['unlink'](_0x4ef8a3);}});}else{return _0x4aaaa6['download'](_0x4ef8a3,function(_0xf2974c){if(_0x288ff5){fs[_0xe90b('0x5a')](_0x4ef8a3);}});}}})[_0xe90b('0x47')](function(_0x3d84e5){if(_0x3d84e5[_0xe90b('0x5b')]===_0xe90b('0x57')){_0x4aaaa6['status'](0x194)['send'](_0xe90b('0x5c'));}else{return handleError(_0x4aaaa6,null);}});};exports[_0xe90b('0x25')]=function(_0x34544b,_0x3214ad){return db[_0xe90b('0x2c')]['find']({'where':{'id':_0x34544b[_0xe90b('0x4d')]['id']}})[_0xe90b('0x24')](function(_0x1764d4){if(_['isNil'](_0x1764d4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1764d4;})[_0xe90b('0x24')](function(_0x3f53af){var _0x340119=_0x3f53af[_0xe90b('0x54')];logger[_0xe90b('0x5d')](_0xe90b('0x5e'),_0x340119);if(!_['isNil'](_0x3f53af[_0xe90b('0x54')])&&fs['existsSync'](_0x340119)){logger['info'](_0xe90b('0x5f')+_0x340119+_0xe90b('0x60'));fs[_0xe90b('0x61')](_0x340119);}_0x340119=_0x340119+_0xe90b('0x62');if(!_[_0xe90b('0x63')](_0x3f53af[_0xe90b('0x54')])&&fs[_0xe90b('0x55')](_0x340119)){logger[_0xe90b('0x5d')](_0xe90b('0x5f')+_0x340119+_0xe90b('0x60'));fs['unlinkSync'](_0x340119);}return _0x3f53af;})[_0xe90b('0x24')](function(_0x2cd2b6){if(!_0x2cd2b6)throw new InternalError();return _0x2cd2b6['destroy']();})[_0xe90b('0x24')](function(){_0x3214ad[_0xe90b('0x19')](0xcc)['end']();})[_0xe90b('0x47')](handleError(_0x3214ad,null));}; \ No newline at end of file +var _0xdae3=['stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','type','SquareRecording','include','rows','show','options','find','create','body','catch','params','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xdae3,0x14b));var _0x3dae=function(_0x3a222f,_0x113b65){_0x3a222f=_0x3a222f-0x0;var _0x3a0918=_0xdae3[_0x3a222f];return _0x3a0918;};'use strict';var emlformat=require(_0x3dae('0x0'));var rimraf=require(_0x3dae('0x1'));var zipdir=require(_0x3dae('0x2'));var jsonpatch=require(_0x3dae('0x3'));var rp=require(_0x3dae('0x4'));var moment=require(_0x3dae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3dae('0x6'));var util=require(_0x3dae('0x7'));var path=require(_0x3dae('0x8'));var sox=require('sox');var csv=require(_0x3dae('0x9'));var ejs=require(_0x3dae('0xa'));var fs=require('fs');var fs_extra=require(_0x3dae('0xb'));var _=require(_0x3dae('0xc'));var squel=require('squel');var crypto=require(_0x3dae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dae('0xe'));var toCsv=require(_0x3dae('0x9'));var querystring=require('querystring');var Papa=require(_0x3dae('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3dae('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dae('0x11'))(_0x3dae('0x12'));var utils=require(_0x3dae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3dae('0x14'));var db=require(_0x3dae('0x15'))['db'];function respondWithStatusCode(_0x368ef2,_0x3ea0b0){_0x3ea0b0=_0x3ea0b0||0xcc;return function(_0x4712d1){if(_0x4712d1){return _0x368ef2[_0x3dae('0x16')](_0x3ea0b0);}return _0x368ef2[_0x3dae('0x17')](_0x3ea0b0)[_0x3dae('0x18')]();};}function respondWithResult(_0x2b78be,_0x9e6302){_0x9e6302=_0x9e6302||0xc8;return function(_0x316542){if(_0x316542){return _0x2b78be[_0x3dae('0x17')](_0x9e6302)[_0x3dae('0x19')](_0x316542);}};}function respondWithFilteredResult(_0x5b3ba8,_0x3be9a3){return function(_0x5b6354){if(_0x5b6354){var _0x4fe1aa=typeof _0x3be9a3[_0x3dae('0x1a')]===_0x3dae('0x1b')&&typeof _0x3be9a3['limit']==='undefined';var _0x12ef3e=_0x5b6354['count'];var _0x524df7=_0x4fe1aa?0x0:_0x3be9a3[_0x3dae('0x1a')];var _0x1e060b=_0x4fe1aa?_0x5b6354[_0x3dae('0x1c')]:_0x3be9a3[_0x3dae('0x1a')]+_0x3be9a3[_0x3dae('0x1d')];var _0x5b2d60;if(_0x1e060b>=_0x12ef3e){_0x1e060b=_0x12ef3e;_0x5b2d60=0xc8;}else{_0x5b2d60=0xce;}_0x5b3ba8[_0x3dae('0x17')](_0x5b2d60);return _0x5b3ba8[_0x3dae('0x1e')](_0x3dae('0x1f'),_0x524df7+'-'+_0x1e060b+'/'+_0x12ef3e)[_0x3dae('0x19')](_0x5b6354);}return null;};}function patchUpdates(_0x5b8697){return function(_0x178ea1){try{jsonpatch['apply'](_0x178ea1,_0x5b8697,!![]);}catch(_0x3a7dcf){return BPromise[_0x3dae('0x20')](_0x3a7dcf);}return _0x178ea1[_0x3dae('0x21')]();};}function saveUpdates(_0x1e07dc,_0x287a3b){return function(_0x18a6db){if(_0x18a6db){return _0x18a6db['update'](_0x1e07dc)[_0x3dae('0x22')](function(_0xf30118){return _0xf30118;});}return null;};}function removeEntity(_0xb6c2b6,_0x102fc0){return function(_0x2c4855){if(_0x2c4855){return _0x2c4855[_0x3dae('0x23')]()[_0x3dae('0x22')](function(){_0xb6c2b6[_0x3dae('0x17')](0xcc)[_0x3dae('0x18')]();});}};}function handleEntityNotFound(_0x5142a1,_0x1f92a6){return function(_0x15cc19){if(!_0x15cc19){_0x5142a1[_0x3dae('0x16')](0x194);}return _0x15cc19;};}function handleError(_0x1ee5f3,_0x1218c4){_0x1218c4=_0x1218c4||0x1f4;return function(_0x3fe298){logger[_0x3dae('0x24')](_0x3fe298[_0x3dae('0x25')]);if(_0x3fe298['name']){delete _0x3fe298[_0x3dae('0x26')];}_0x1ee5f3['status'](_0x1218c4)['send'](_0x3fe298);};}exports[_0x3dae('0x27')]=function(_0x3f1ec6,_0x4c1e26){var _0x4ff0a7={},_0x1ebe82={},_0xc087f6={'count':0x0,'rows':[]};var _0x28dd91=_[_0x3dae('0x28')](db['SquareRecording'][_0x3dae('0x29')],function(_0x192ade){return{'name':_0x192ade[_0x3dae('0x2a')],'type':_0x192ade['type'][_0x3dae('0x2b')]};});_0x1ebe82[_0x3dae('0x2c')]=_[_0x3dae('0x28')](_0x28dd91,'name');_0x1ebe82[_0x3dae('0x2d')]=_[_0x3dae('0x2e')](_0x3f1ec6[_0x3dae('0x2d')]);_0x1ebe82[_0x3dae('0x2f')]=_[_0x3dae('0x30')](_0x1ebe82['model'],_0x1ebe82[_0x3dae('0x2d')]);_0x4ff0a7['attributes']=_[_0x3dae('0x30')](_0x1ebe82['model'],qs['fields'](_0x3f1ec6[_0x3dae('0x2d')][_0x3dae('0x31')]));_0x4ff0a7['attributes']=_0x4ff0a7[_0x3dae('0x32')][_0x3dae('0x33')]?_0x4ff0a7[_0x3dae('0x32')]:_0x1ebe82[_0x3dae('0x2c')];if(!_0x3f1ec6[_0x3dae('0x2d')]['hasOwnProperty']('nolimit')){_0x4ff0a7[_0x3dae('0x1d')]=qs[_0x3dae('0x1d')](_0x3f1ec6[_0x3dae('0x2d')][_0x3dae('0x1d')]);_0x4ff0a7[_0x3dae('0x1a')]=qs[_0x3dae('0x1a')](_0x3f1ec6[_0x3dae('0x2d')]['offset']);}_0x4ff0a7['order']=qs[_0x3dae('0x34')](_0x3f1ec6[_0x3dae('0x2d')][_0x3dae('0x34')]);_0x4ff0a7[_0x3dae('0x35')]=qs[_0x3dae('0x2f')](_[_0x3dae('0x36')](_0x3f1ec6['query'],_0x1ebe82[_0x3dae('0x2f')]),_0x28dd91);if(_0x3f1ec6['query'][_0x3dae('0x37')]){_0x4ff0a7[_0x3dae('0x35')]=_[_0x3dae('0x38')](_0x4ff0a7[_0x3dae('0x35')],{'$or':_['map'](_0x28dd91,function(_0x4ab2f3){if(_0x4ab2f3[_0x3dae('0x39')]!=='VIRTUAL'){var _0x55aea0={};_0x55aea0[_0x4ab2f3[_0x3dae('0x26')]]={'$like':'%'+_0x3f1ec6[_0x3dae('0x2d')][_0x3dae('0x37')]+'%'};return _0x55aea0;}})});}_0x4ff0a7=_[_0x3dae('0x38')]({},_0x4ff0a7,_0x3f1ec6['options']);var _0x3ce140={'where':_0x4ff0a7[_0x3dae('0x35')]};return db[_0x3dae('0x3a')][_0x3dae('0x1c')](_0x3ce140)['then'](function(_0x99f787){_0xc087f6[_0x3dae('0x1c')]=_0x99f787;if(_0x3f1ec6['query']['includeAll']){_0x4ff0a7[_0x3dae('0x3b')]=[{'all':!![]}];}return db[_0x3dae('0x3a')]['findAll'](_0x4ff0a7);})[_0x3dae('0x22')](function(_0x3aac1a){_0xc087f6[_0x3dae('0x3c')]=_0x3aac1a;return _0xc087f6;})[_0x3dae('0x22')](respondWithFilteredResult(_0x4c1e26,_0x4ff0a7))['catch'](handleError(_0x4c1e26,null));};exports[_0x3dae('0x3d')]=function(_0x23e4b3,_0x1ba976){var _0x178dd8={'raw':!![],'where':{'id':_0x23e4b3['params']['id']}},_0x581fe8={};_0x581fe8['model']=_[_0x3dae('0x2e')](db[_0x3dae('0x3a')][_0x3dae('0x29')]);_0x581fe8[_0x3dae('0x2d')]=_[_0x3dae('0x2e')](_0x23e4b3['query']);_0x581fe8['filters']=_[_0x3dae('0x30')](_0x581fe8[_0x3dae('0x2c')],_0x581fe8[_0x3dae('0x2d')]);_0x178dd8['attributes']=_['intersection'](_0x581fe8[_0x3dae('0x2c')],qs[_0x3dae('0x31')](_0x23e4b3[_0x3dae('0x2d')][_0x3dae('0x31')]));_0x178dd8[_0x3dae('0x32')]=_0x178dd8[_0x3dae('0x32')]['length']?_0x178dd8['attributes']:_0x581fe8[_0x3dae('0x2c')];if(_0x23e4b3[_0x3dae('0x2d')]['includeAll']){_0x178dd8['include']=[{'all':!![]}];}_0x178dd8=_[_0x3dae('0x38')]({},_0x178dd8,_0x23e4b3[_0x3dae('0x3e')]);return db[_0x3dae('0x3a')][_0x3dae('0x3f')](_0x178dd8)[_0x3dae('0x22')](handleEntityNotFound(_0x1ba976,null))[_0x3dae('0x22')](respondWithResult(_0x1ba976,null))['catch'](handleError(_0x1ba976,null));};exports[_0x3dae('0x40')]=function(_0x1bc321,_0x5ae3f2){return db[_0x3dae('0x3a')][_0x3dae('0x40')](_0x1bc321[_0x3dae('0x41')],{})[_0x3dae('0x22')](respondWithResult(_0x5ae3f2,0xc9))[_0x3dae('0x42')](handleError(_0x5ae3f2,null));};exports['update']=function(_0x3cf73d,_0x2acc6b){if(_0x3cf73d[_0x3dae('0x41')]['id']){delete _0x3cf73d[_0x3dae('0x41')]['id'];}return db[_0x3dae('0x3a')][_0x3dae('0x3f')]({'where':{'id':_0x3cf73d[_0x3dae('0x43')]['id']}})['then'](handleEntityNotFound(_0x2acc6b,null))[_0x3dae('0x22')](saveUpdates(_0x3cf73d[_0x3dae('0x41')],null))[_0x3dae('0x22')](respondWithResult(_0x2acc6b,null))[_0x3dae('0x42')](handleError(_0x2acc6b,null));};exports[_0x3dae('0x44')]=function(_0x32fb23,_0x5d8896,_0x2640a7){var _0x407181=require(_0x3dae('0x45'));var _0x101e90=![];var _0x3a1f10={};if(_0x32fb23['query'][_0x3dae('0x39')]&&_0x32fb23[_0x3dae('0x2d')]['type']==='uniqueid'){_0x3a1f10[_0x3dae('0x46')]=_0x32fb23[_0x3dae('0x43')]['id'];}else{_0x3a1f10['id']=_0x32fb23[_0x3dae('0x43')]['id'];}return db[_0x3dae('0x3a')][_0x3dae('0x3f')]({'where':_0x3a1f10,'attributes':['id',_0x3dae('0x47'),_0x3dae('0x48')],'raw':!![]})[_0x3dae('0x22')](handleEntityNotFound(_0x5d8896,null))['then'](function(_0x1eb7eb){if(_0x1eb7eb){var _0xeb7e47=_0x1eb7eb[_0x3dae('0x47')];var _0x38cf0d=util['format'](_0x3dae('0x49'),_0xeb7e47);if(fs[_0x3dae('0x4a')](_0x38cf0d)){_0x101e90=!![];return _0x407181[_0x3dae('0x4b')](_0x38cf0d,_0xeb7e47,config[_0x3dae('0x4c')]['recording'])[_0x3dae('0x22')](function(){return _0x1eb7eb;});}return _0x1eb7eb;}})[_0x3dae('0x22')](function(_0x412f56){if(_0x412f56){var _0x33fbf4=_0x412f56[_0x3dae('0x47')];if(!fs[_0x3dae('0x4a')](_0x33fbf4)){throw new db[(_0x3dae('0x4d'))][(_0x3dae('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x412f56[_0x3dae('0x48')]){return _0x5d8896[_0x3dae('0x44')](_0x33fbf4,_0x412f56[_0x3dae('0x48')]+path[_0x3dae('0x4f')](_0x33fbf4),function(){if(_0x101e90){fs['unlink'](_0x33fbf4);}});}else{return _0x5d8896[_0x3dae('0x44')](_0x33fbf4,function(_0x3cf0a9){if(_0x101e90){fs[_0x3dae('0x50')](_0x33fbf4);}});}}})['catch'](function(_0x1b2f58){if(_0x1b2f58[_0x3dae('0x51')]===_0x3dae('0x52')){_0x5d8896['status'](0x194)[_0x3dae('0x53')](_0x3dae('0x54'));}else{return handleError(_0x5d8896,null);}});};exports[_0x3dae('0x23')]=function(_0x525d8e,_0x2efb32){return db[_0x3dae('0x3a')]['find']({'where':{'id':_0x525d8e[_0x3dae('0x43')]['id']}})[_0x3dae('0x22')](function(_0x1d9045){if(_[_0x3dae('0x55')](_0x1d9045)){throw new ReferenceError(_0x3dae('0x56'));}return _0x1d9045;})[_0x3dae('0x22')](function(_0x4c149f){var _0xdabba9=_0x4c149f[_0x3dae('0x47')];logger['info'](_0x3dae('0x57'),_0xdabba9);if(!_['isNil'](_0x4c149f[_0x3dae('0x47')])&&fs[_0x3dae('0x4a')](_0xdabba9)){logger[_0x3dae('0x58')](_0x3dae('0x59')+_0xdabba9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3dae('0x5a')](_0xdabba9);}_0xdabba9=_0xdabba9+'.cypher';if(!_[_0x3dae('0x55')](_0x4c149f[_0x3dae('0x47')])&&fs[_0x3dae('0x4a')](_0xdabba9)){logger[_0x3dae('0x58')](_0x3dae('0x59')+_0xdabba9+_0x3dae('0x5b'));fs[_0x3dae('0x5a')](_0xdabba9);}return _0x4c149f;})[_0x3dae('0x22')](function(_0x4f6822){if(!_0x4f6822)throw new InternalError();return _0x4f6822[_0x3dae('0x23')]();})[_0x3dae('0x22')](function(){_0x2efb32[_0x3dae('0x17')](0xcc)[_0x3dae('0x18')]();})[_0x3dae('0x42')](handleError(_0x2efb32,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2c6f16e..43f8889 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 _0x6cfd=['moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording','../../config/logger','api'];(function(_0x1203f0,_0x318674){var _0x3b0f4a=function(_0x2c980a){while(--_0x2c980a){_0x1203f0['push'](_0x1203f0['shift']());}};_0x3b0f4a(++_0x318674);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x1a9051,_0x36950b){_0x1a9051=_0x1a9051-0x0;var _0x99c202=_0x6cfd[_0x1a9051];return _0x99c202;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6cf('0x0'))(_0xd6cf('0x1'));var moment=require(_0xd6cf('0x2'));var BPromise=require(_0xd6cf('0x3'));var rp=require(_0xd6cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6cf('0x5'));var config=require(_0xd6cf('0x6'));var attributes=require(_0xd6cf('0x7'));module['exports']=function(_0x517713,_0x1681fc){return _0x517713['define'](_0xd6cf('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaee=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaaee,0x132));var _0xeaae=function(_0x44ca05,_0x2187ea){_0x44ca05=_0x44ca05-0x0;var _0x39330f=_0xaaee[_0x44ca05];return _0x39330f;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var logger=require(_0xeaae('0x2'))(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require('bluebird');var rp=require(_0xeaae('0x5'));var fs=require('fs');var path=require(_0xeaae('0x6'));var rimraf=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var attributes=require(_0xeaae('0x9'));module[_0xeaae('0xa')]=function(_0xb5ad89,_0x491e4){return _0xb5ad89[_0xeaae('0xb')](_0xeaae('0xc'),attributes,{'tableName':_0xeaae('0xd'),'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 905f31d..250ae6f 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 _0x7aed=['create','body','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording'];(function(_0x50880d,_0x1e8b3a){var _0x4ee5d6=function(_0x9c74bd){while(--_0x9c74bd){_0x50880d['push'](_0x50880d['shift']());}};_0x4ee5d6(++_0x1e8b3a);}(_0x7aed,0x86));var _0xd7ae=function(_0x9e76d,_0x44e7a0){_0x9e76d=_0x9e76d-0x0;var _0x320985=_0x7aed[_0x9e76d];return _0x320985;};'use strict';var _=require(_0xd7ae('0x0'));var util=require('util');var moment=require(_0xd7ae('0x1'));var BPromise=require('bluebird');var rs=require(_0xd7ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7ae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ae('0x4'))(_0xd7ae('0x5'));var config=require(_0xd7ae('0x6'));var jayson=require(_0xd7ae('0x7'));var client=jayson[_0xd7ae('0x8')][_0xd7ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33a245,_0x330718,_0x36cc42){return new BPromise(function(_0x2aafe0,_0x5bd930){return client[_0xd7ae('0xa')](_0x33a245,_0x36cc42)[_0xd7ae('0xb')](function(_0x3443d1){logger['info'](_0xd7ae('0xc'),_0x330718,_0xd7ae('0xd'));logger[_0xd7ae('0xe')](_0xd7ae('0xf'),_0x330718,_0xd7ae('0xd'),JSON[_0xd7ae('0x10')](_0x3443d1));if(_0x3443d1[_0xd7ae('0x11')]){if(_0x3443d1['error'][_0xd7ae('0x12')]===0x1f4){logger[_0xd7ae('0x11')]('SquareRecording,\x20%s,\x20%s',_0x330718,_0x3443d1['error'][_0xd7ae('0x13')]);return _0x5bd930(_0x3443d1[_0xd7ae('0x11')][_0xd7ae('0x13')]);}logger[_0xd7ae('0x11')](_0xd7ae('0xc'),_0x330718,_0x3443d1[_0xd7ae('0x11')][_0xd7ae('0x13')]);return _0x2aafe0(_0x3443d1[_0xd7ae('0x11')][_0xd7ae('0x13')]);}else{logger['info'](_0xd7ae('0xc'),_0x330718,'request\x20sent');_0x2aafe0(_0x3443d1['result'][_0xd7ae('0x13')]);}})[_0xd7ae('0x14')](function(_0x6c8551){logger[_0xd7ae('0x11')](_0xd7ae('0xc'),_0x330718,_0x6c8551);_0x5bd930(_0x6c8551);});});}exports[_0xd7ae('0x15')]=function(_0x1d23ab){var _0x1fbf75=this;return new Promise(function(_0x70a54f,_0x2d6fab){return db['SquareRecording'][_0xd7ae('0x16')](_0x1d23ab[_0xd7ae('0x17')],{'raw':_0x1d23ab[_0xd7ae('0x18')]?_0x1d23ab['options'][_0xd7ae('0x19')]===undefined?!![]:![]:!![]})[_0xd7ae('0xb')](function(_0xcceda3){logger['info'](_0xd7ae('0x15'),_0x1d23ab);logger[_0xd7ae('0xe')](_0xd7ae('0x15'),_0x1d23ab,JSON[_0xd7ae('0x10')](_0xcceda3));_0x70a54f(_0xcceda3);})[_0xd7ae('0x14')](function(_0x4fd02c){logger[_0xd7ae('0x11')]('CreateSquareRecording',_0x4fd02c[_0xd7ae('0x13')],_0x1d23ab);_0x2d6fab(_0x1fbf75[_0xd7ae('0x11')](0x1f4,_0x4fd02c[_0xd7ae('0x13')]));});});}; \ No newline at end of file +var _0xa333=['code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa333,0x19f));var _0x3a33=function(_0x5b6989,_0x4c6058){_0x5b6989=_0x5b6989-0x0;var _0x3157cf=_0xa333[_0x5b6989];return _0x3157cf;};'use strict';var _=require(_0x3a33('0x0'));var util=require(_0x3a33('0x1'));var moment=require(_0x3a33('0x2'));var BPromise=require(_0x3a33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a33('0x4'));var db=require(_0x3a33('0x5'))['db'];var utils=require(_0x3a33('0x6'));var logger=require(_0x3a33('0x7'))(_0x3a33('0x8'));var config=require(_0x3a33('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a33('0xa')][_0x3a33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f3a40,_0x3cd646,_0x5eb23c){return new BPromise(function(_0x15ba1b,_0x49fb6d){return client[_0x3a33('0xc')](_0x4f3a40,_0x5eb23c)[_0x3a33('0xd')](function(_0x25c48b){logger[_0x3a33('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3cd646,_0x3a33('0xf'));logger[_0x3a33('0x10')](_0x3a33('0x11'),_0x3cd646,'request\x20sent',JSON[_0x3a33('0x12')](_0x25c48b));if(_0x25c48b[_0x3a33('0x13')]){if(_0x25c48b[_0x3a33('0x13')][_0x3a33('0x14')]===0x1f4){logger[_0x3a33('0x13')](_0x3a33('0x15'),_0x3cd646,_0x25c48b[_0x3a33('0x13')][_0x3a33('0x16')]);return _0x49fb6d(_0x25c48b[_0x3a33('0x13')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x3cd646,_0x25c48b[_0x3a33('0x13')][_0x3a33('0x16')]);return _0x15ba1b(_0x25c48b[_0x3a33('0x13')][_0x3a33('0x16')]);}else{logger['info'](_0x3a33('0x15'),_0x3cd646,'request\x20sent');_0x15ba1b(_0x25c48b[_0x3a33('0x17')]['message']);}})[_0x3a33('0x18')](function(_0x450e52){logger[_0x3a33('0x13')](_0x3a33('0x15'),_0x3cd646,_0x450e52);_0x49fb6d(_0x450e52);});});}exports[_0x3a33('0x19')]=function(_0x2b94f9){var _0x638386=this;return new Promise(function(_0x3e712b,_0xbf0416){return db['SquareRecording']['create'](_0x2b94f9[_0x3a33('0x1a')],{'raw':_0x2b94f9[_0x3a33('0x1b')]?_0x2b94f9['options'][_0x3a33('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4918bc){logger[_0x3a33('0xe')](_0x3a33('0x19'),_0x2b94f9);logger[_0x3a33('0x10')](_0x3a33('0x19'),_0x2b94f9,JSON[_0x3a33('0x12')](_0x4918bc));_0x3e712b(_0x4918bc);})[_0x3a33('0x18')](function(_0xb9a2e2){logger[_0x3a33('0x13')]('CreateSquareRecording',_0xb9a2e2[_0x3a33('0x16')],_0x2b94f9);_0xbf0416(_0x638386[_0x3a33('0x13')](0x1f4,_0xb9a2e2[_0x3a33('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 102b619..a37f15c 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x270d42,_0x1e1438){var _0x529552=function(_0x51af36){while(--_0x51af36){_0x270d42['push'](_0x270d42['shift']());}};_0x529552(++_0x1e1438);}(_0xe706,0xa3));var _0x6e70=function(_0x5cceb8,_0xa8e57a){_0x5cceb8=_0x5cceb8-0x0;var _0xeaf4be=_0xe706[_0x5cceb8];return _0xeaf4be;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +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(_0x5e4e54,_0x22683c){var _0x20b557=function(_0x59d565){while(--_0x59d565){_0x5e4e54['push'](_0x5e4e54['shift']());}};_0x20b557(++_0x22683c);}(_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 cc02b58..f69326d 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 _0xc31e=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x79b860,_0x2e8387){var _0x281b5e=function(_0x24ff78){while(--_0x24ff78){_0x79b860['push'](_0x79b860['shift']());}};_0x281b5e(++_0x2e8387);}(_0xc31e,0x17d));var _0xec31=function(_0xbdf961,_0x16d26d){_0xbdf961=_0xbdf961-0x0;var _0x6eced3=_0xc31e[_0xbdf961];return _0x6eced3;};'use strict';var Sequelize=require(_0xec31('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xec31('0x1')]},'request':{'type':Sequelize[_0xec31('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xec31('0x1')]},'type':{'type':Sequelize[_0xec31('0x1')]},'uniqueid':{'type':Sequelize[_0xec31('0x1')]},'version':{'type':Sequelize[_0xec31('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xec31('0x1')]},'callingpres':{'type':Sequelize[_0xec31('0x1')]},'callingani2':{'type':Sequelize[_0xec31('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xec31('0x1')]},'rdnis':{'type':Sequelize[_0xec31('0x1')]},'context':{'type':Sequelize[_0xec31('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xec31('0x1')]},'enhanced':{'type':Sequelize[_0xec31('0x1')]},'accountcode':{'type':Sequelize[_0xec31('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xec31('0x1')]},'joinAt':{'type':Sequelize[_0xec31('0x2')]},'leaveAt':{'type':Sequelize[_0xec31('0x2')]},'bot':{'type':Sequelize[_0xec31('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7e66=['STRING','DATE','BOOLEAN','exports'];(function(_0x2ef041,_0x34e819){var _0x4babf1=function(_0x151719){while(--_0x151719){_0x2ef041['push'](_0x2ef041['shift']());}};_0x4babf1(++_0x34e819);}(_0x7e66,0xcf));var _0x67e6=function(_0x368b56,_0x2e8ae3){_0x368b56=_0x368b56-0x0;var _0x2cca43=_0x7e66[_0x368b56];return _0x2cca43;};'use strict';var Sequelize=require('sequelize');module[_0x67e6('0x0')]={'network':{'type':Sequelize[_0x67e6('0x1')]},'network_script':{'type':Sequelize[_0x67e6('0x1')]},'request':{'type':Sequelize[_0x67e6('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x67e6('0x1')]},'type':{'type':Sequelize[_0x67e6('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x67e6('0x1')]},'callerid':{'type':Sequelize[_0x67e6('0x1')]},'calleridname':{'type':Sequelize[_0x67e6('0x1')]},'callingpres':{'type':Sequelize[_0x67e6('0x1')]},'callingani2':{'type':Sequelize[_0x67e6('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x67e6('0x1')]},'dnid':{'type':Sequelize[_0x67e6('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x67e6('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x67e6('0x1')]},'accountcode':{'type':Sequelize[_0x67e6('0x1')]},'threadid':{'type':Sequelize[_0x67e6('0x1')]},'project_name':{'type':Sequelize[_0x67e6('0x1')]},'joinAt':{'type':Sequelize[_0x67e6('0x2')]},'leaveAt':{'type':Sequelize[_0x67e6('0x2')]},'bot':{'type':Sequelize[_0x67e6('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 c869b8a..5a66db4 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 _0x6ea2=['../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ea2,0xd4));var _0x26ea=function(_0x25f868,_0x3a5dc0){_0x25f868=_0x25f868-0x0;var _0xd101cc=_0x6ea2[_0x25f868];return _0xd101cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ea('0x0'));var zipdir=require(_0x26ea('0x1'));var jsonpatch=require(_0x26ea('0x2'));var rp=require(_0x26ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x26ea('0x4'));var path=require(_0x26ea('0x5'));var sox=require('sox');var csv=require(_0x26ea('0x6'));var ejs=require(_0x26ea('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ea('0x8'));var squel=require(_0x26ea('0x9'));var crypto=require(_0x26ea('0xa'));var jsforce=require(_0x26ea('0xb'));var deskjs=require(_0x26ea('0xc'));var toCsv=require('to-csv');var querystring=require(_0x26ea('0xd'));var Papa=require(_0x26ea('0xe'));var Redis=require(_0x26ea('0xf'));var authService=require(_0x26ea('0x10'));var qs=require(_0x26ea('0x11'));var as=require(_0x26ea('0x12'));var hardwareService=require(_0x26ea('0x13'));var logger=require(_0x26ea('0x14'))(_0x26ea('0x15'));var utils=require(_0x26ea('0x16'));var config=require(_0x26ea('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x427540,_0x2a4f4d){_0x2a4f4d=_0x2a4f4d||0xcc;return function(_0x443a61){if(_0x443a61){return _0x427540[_0x26ea('0x18')](_0x2a4f4d);}return _0x427540[_0x26ea('0x19')](_0x2a4f4d)[_0x26ea('0x1a')]();};}function respondWithResult(_0xc4b58e,_0xc3c523){_0xc3c523=_0xc3c523||0xc8;return function(_0x1a87b3){if(_0x1a87b3){return _0xc4b58e[_0x26ea('0x19')](_0xc3c523)['json'](_0x1a87b3);}};}function respondWithFilteredResult(_0x198733,_0x331d67){return function(_0x5d1c59){if(_0x5d1c59){var _0x13cd5d=typeof _0x331d67[_0x26ea('0x1b')]===_0x26ea('0x1c')&&typeof _0x331d67['limit']===_0x26ea('0x1c');var _0x40437e=_0x5d1c59['count'];var _0x19826b=_0x13cd5d?0x0:_0x331d67['offset'];var _0x1c9805=_0x13cd5d?_0x5d1c59[_0x26ea('0x1d')]:_0x331d67['offset']+_0x331d67[_0x26ea('0x1e')];var _0x216698;if(_0x1c9805>=_0x40437e){_0x1c9805=_0x40437e;_0x216698=0xc8;}else{_0x216698=0xce;}_0x198733[_0x26ea('0x19')](_0x216698);return _0x198733[_0x26ea('0x1f')](_0x26ea('0x20'),_0x19826b+'-'+_0x1c9805+'/'+_0x40437e)[_0x26ea('0x21')](_0x5d1c59);}return null;};}function patchUpdates(_0x213f3c){return function(_0x60ea24){try{jsonpatch[_0x26ea('0x22')](_0x60ea24,_0x213f3c,!![]);}catch(_0x355704){return BPromise[_0x26ea('0x23')](_0x355704);}return _0x60ea24[_0x26ea('0x24')]();};}function saveUpdates(_0x511dcb,_0x37988f){return function(_0x1a3c77){if(_0x1a3c77){return _0x1a3c77[_0x26ea('0x25')](_0x511dcb)[_0x26ea('0x26')](function(_0x2e4dd5){return _0x2e4dd5;});}return null;};}function removeEntity(_0x8c8f10,_0x52ac49){return function(_0x47c4c3){if(_0x47c4c3){return _0x47c4c3[_0x26ea('0x27')]()['then'](function(){_0x8c8f10[_0x26ea('0x19')](0xcc)[_0x26ea('0x1a')]();});}};}function handleEntityNotFound(_0xaf35fa,_0x9923f3){return function(_0x20ed44){if(!_0x20ed44){_0xaf35fa['sendStatus'](0x194);}return _0x20ed44;};}function handleError(_0x20536c,_0x16b488){_0x16b488=_0x16b488||0x1f4;return function(_0x4f1beb){logger[_0x26ea('0x28')](_0x4f1beb[_0x26ea('0x29')]);if(_0x4f1beb[_0x26ea('0x2a')]){delete _0x4f1beb[_0x26ea('0x2a')];}_0x20536c['status'](_0x16b488)[_0x26ea('0x2b')](_0x4f1beb);};}exports[_0x26ea('0x2c')]=function(_0x19da0d,_0x275426){var _0x1b3c9b={},_0x174b1b={},_0x530970={'count':0x0,'rows':[]};var _0x4fde66=_[_0x26ea('0x2d')](db[_0x26ea('0x2e')][_0x26ea('0x2f')],function(_0x41aaf9){return{'name':_0x41aaf9[_0x26ea('0x30')],'type':_0x41aaf9[_0x26ea('0x31')][_0x26ea('0x32')]};});_0x174b1b['model']=_[_0x26ea('0x2d')](_0x4fde66,_0x26ea('0x2a'));_0x174b1b[_0x26ea('0x33')]=_[_0x26ea('0x34')](_0x19da0d[_0x26ea('0x33')]);_0x174b1b[_0x26ea('0x35')]=_[_0x26ea('0x36')](_0x174b1b['model'],_0x174b1b[_0x26ea('0x33')]);_0x1b3c9b[_0x26ea('0x37')]=_[_0x26ea('0x36')](_0x174b1b[_0x26ea('0x38')],qs[_0x26ea('0x39')](_0x19da0d[_0x26ea('0x33')][_0x26ea('0x39')]));_0x1b3c9b[_0x26ea('0x37')]=_0x1b3c9b[_0x26ea('0x37')][_0x26ea('0x3a')]?_0x1b3c9b['attributes']:_0x174b1b[_0x26ea('0x38')];if(!_0x19da0d['query'][_0x26ea('0x3b')]('nolimit')){_0x1b3c9b[_0x26ea('0x1e')]=qs[_0x26ea('0x1e')](_0x19da0d['query'][_0x26ea('0x1e')]);_0x1b3c9b[_0x26ea('0x1b')]=qs[_0x26ea('0x1b')](_0x19da0d['query'][_0x26ea('0x1b')]);}_0x1b3c9b[_0x26ea('0x3c')]=qs[_0x26ea('0x3d')](_0x19da0d['query'][_0x26ea('0x3d')]);_0x1b3c9b[_0x26ea('0x3e')]=qs[_0x26ea('0x35')](_[_0x26ea('0x3f')](_0x19da0d['query'],_0x174b1b['filters']),_0x4fde66);if(_0x19da0d[_0x26ea('0x33')][_0x26ea('0x40')]){_0x1b3c9b[_0x26ea('0x3e')]=_[_0x26ea('0x41')](_0x1b3c9b[_0x26ea('0x3e')],{'$or':_['map'](_0x4fde66,function(_0xd1be8c){if(_0xd1be8c[_0x26ea('0x31')]!=='VIRTUAL'){var _0x5b2022={};_0x5b2022[_0xd1be8c[_0x26ea('0x2a')]]={'$like':'%'+_0x19da0d['query']['filter']+'%'};return _0x5b2022;}})});}_0x1b3c9b=_[_0x26ea('0x41')]({},_0x1b3c9b,_0x19da0d[_0x26ea('0x42')]);var _0x5595ff={'where':_0x1b3c9b[_0x26ea('0x3e')]};return db[_0x26ea('0x2e')][_0x26ea('0x1d')](_0x5595ff)['then'](function(_0x1b3351){_0x530970[_0x26ea('0x1d')]=_0x1b3351;if(_0x19da0d[_0x26ea('0x33')][_0x26ea('0x43')]){_0x1b3c9b[_0x26ea('0x44')]=[{'all':!![]}];}return db[_0x26ea('0x2e')][_0x26ea('0x45')](_0x1b3c9b);})[_0x26ea('0x26')](function(_0x37294a){_0x530970[_0x26ea('0x46')]=_0x37294a;return _0x530970;})[_0x26ea('0x26')](respondWithFilteredResult(_0x275426,_0x1b3c9b))[_0x26ea('0x47')](handleError(_0x275426,null));};exports[_0x26ea('0x48')]=function(_0x5064ad,_0x549e43){var _0x1159d9={'raw':!![],'where':{'id':_0x5064ad[_0x26ea('0x49')]['id']}},_0x24c637={};_0x24c637['model']=_[_0x26ea('0x34')](db[_0x26ea('0x2e')]['rawAttributes']);_0x24c637['query']=_[_0x26ea('0x34')](_0x5064ad['query']);_0x24c637[_0x26ea('0x35')]=_[_0x26ea('0x36')](_0x24c637[_0x26ea('0x38')],_0x24c637[_0x26ea('0x33')]);_0x1159d9[_0x26ea('0x37')]=_[_0x26ea('0x36')](_0x24c637['model'],qs[_0x26ea('0x39')](_0x5064ad[_0x26ea('0x33')][_0x26ea('0x39')]));_0x1159d9[_0x26ea('0x37')]=_0x1159d9[_0x26ea('0x37')][_0x26ea('0x3a')]?_0x1159d9[_0x26ea('0x37')]:_0x24c637['model'];if(_0x5064ad[_0x26ea('0x33')][_0x26ea('0x43')]){_0x1159d9[_0x26ea('0x44')]=[{'all':!![]}];}_0x1159d9=_[_0x26ea('0x41')]({},_0x1159d9,_0x5064ad[_0x26ea('0x42')]);return db['SquareReport']['find'](_0x1159d9)[_0x26ea('0x26')](handleEntityNotFound(_0x549e43,null))[_0x26ea('0x26')](respondWithResult(_0x549e43,null))[_0x26ea('0x47')](handleError(_0x549e43,null));};exports[_0x26ea('0x4a')]=function(_0x12260f,_0x5d8603){return db[_0x26ea('0x2e')][_0x26ea('0x4a')](_0x12260f[_0x26ea('0x4b')],{})[_0x26ea('0x26')](respondWithResult(_0x5d8603,0xc9))[_0x26ea('0x47')](handleError(_0x5d8603,null));};exports[_0x26ea('0x25')]=function(_0x5def3f,_0x312110){if(_0x5def3f[_0x26ea('0x4b')]['id']){delete _0x5def3f[_0x26ea('0x4b')]['id'];}return db[_0x26ea('0x2e')][_0x26ea('0x4c')]({'where':{'id':_0x5def3f[_0x26ea('0x49')]['id']}})[_0x26ea('0x26')](handleEntityNotFound(_0x312110,null))[_0x26ea('0x26')](saveUpdates(_0x5def3f[_0x26ea('0x4b')],null))[_0x26ea('0x26')](respondWithResult(_0x312110,null))['catch'](handleError(_0x312110,null));};exports[_0x26ea('0x27')]=function(_0xf5beba,_0x13e714){return db['SquareReport']['find']({'where':{'id':_0xf5beba[_0x26ea('0x49')]['id']}})[_0x26ea('0x26')](handleEntityNotFound(_0x13e714,null))[_0x26ea('0x26')](removeEntity(_0x13e714,null))['catch'](handleError(_0x13e714,null));};exports[_0x26ea('0x4d')]=function(_0x8fb685,_0x2d0a2f){return db[_0x26ea('0x2e')][_0x26ea('0x4d')]()[_0x26ea('0x26')](respondWithResult(_0x2d0a2f,null))[_0x26ea('0x47')](handleError(_0x2d0a2f,null));}; \ No newline at end of file +var _0xaf11=['status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','SquareReport','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','describe','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x1ba93c,_0x42583d){var _0x253606=function(_0x391d71){while(--_0x391d71){_0x1ba93c['push'](_0x1ba93c['shift']());}};_0x253606(++_0x42583d);}(_0xaf11,0x1b4));var _0x1af1=function(_0x212b31,_0x1c2cb8){_0x212b31=_0x212b31-0x0;var _0x28c9e0=_0xaf11[_0x212b31];return _0x28c9e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1af1('0x0'));var rp=require(_0x1af1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1af1('0x2'));var path=require(_0x1af1('0x3'));var sox=require('sox');var csv=require(_0x1af1('0x4'));var ejs=require(_0x1af1('0x5'));var fs=require('fs');var fs_extra=require(_0x1af1('0x6'));var _=require(_0x1af1('0x7'));var squel=require('squel');var crypto=require(_0x1af1('0x8'));var jsforce=require(_0x1af1('0x9'));var deskjs=require(_0x1af1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1af1('0xb'));var Papa=require(_0x1af1('0xc'));var Redis=require(_0x1af1('0xd'));var authService=require(_0x1af1('0xe'));var qs=require(_0x1af1('0xf'));var as=require(_0x1af1('0x10'));var hardwareService=require(_0x1af1('0x11'));var logger=require(_0x1af1('0x12'))(_0x1af1('0x13'));var utils=require(_0x1af1('0x14'));var config=require(_0x1af1('0x15'));var licenseUtil=require(_0x1af1('0x16'));var db=require(_0x1af1('0x17'))['db'];function respondWithStatusCode(_0x161ad0,_0x4199dc){_0x4199dc=_0x4199dc||0xcc;return function(_0x969fe4){if(_0x969fe4){return _0x161ad0[_0x1af1('0x18')](_0x4199dc);}return _0x161ad0['status'](_0x4199dc)[_0x1af1('0x19')]();};}function respondWithResult(_0xde97fa,_0x338289){_0x338289=_0x338289||0xc8;return function(_0x583224){if(_0x583224){return _0xde97fa[_0x1af1('0x1a')](_0x338289)[_0x1af1('0x1b')](_0x583224);}};}function respondWithFilteredResult(_0x25f5d9,_0x5558aa){return function(_0x55537f){if(_0x55537f){var _0x4ae765=typeof _0x5558aa[_0x1af1('0x1c')]==='undefined'&&typeof _0x5558aa[_0x1af1('0x1d')]===_0x1af1('0x1e');var _0x358761=_0x55537f[_0x1af1('0x1f')];var _0x7ba03=_0x4ae765?0x0:_0x5558aa[_0x1af1('0x1c')];var _0x22df9f=_0x4ae765?_0x55537f[_0x1af1('0x1f')]:_0x5558aa[_0x1af1('0x1c')]+_0x5558aa[_0x1af1('0x1d')];var _0x18ff60;if(_0x22df9f>=_0x358761){_0x22df9f=_0x358761;_0x18ff60=0xc8;}else{_0x18ff60=0xce;}_0x25f5d9[_0x1af1('0x1a')](_0x18ff60);return _0x25f5d9[_0x1af1('0x20')](_0x1af1('0x21'),_0x7ba03+'-'+_0x22df9f+'/'+_0x358761)[_0x1af1('0x1b')](_0x55537f);}return null;};}function patchUpdates(_0xedf757){return function(_0x21da79){try{jsonpatch[_0x1af1('0x22')](_0x21da79,_0xedf757,!![]);}catch(_0x2e0a8d){return BPromise[_0x1af1('0x23')](_0x2e0a8d);}return _0x21da79[_0x1af1('0x24')]();};}function saveUpdates(_0x3f3ec3,_0x1730a0){return function(_0xcc244e){if(_0xcc244e){return _0xcc244e[_0x1af1('0x25')](_0x3f3ec3)['then'](function(_0x1d51c7){return _0x1d51c7;});}return null;};}function removeEntity(_0x265c7e,_0x42590e){return function(_0x2d718c){if(_0x2d718c){return _0x2d718c['destroy']()[_0x1af1('0x26')](function(){_0x265c7e[_0x1af1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6d9b7b,_0x39987b){return function(_0x23b00e){if(!_0x23b00e){_0x6d9b7b[_0x1af1('0x18')](0x194);}return _0x23b00e;};}function handleError(_0x528ea3,_0x282ace){_0x282ace=_0x282ace||0x1f4;return function(_0x35173a){logger[_0x1af1('0x27')](_0x35173a[_0x1af1('0x28')]);if(_0x35173a[_0x1af1('0x29')]){delete _0x35173a[_0x1af1('0x29')];}_0x528ea3[_0x1af1('0x1a')](_0x282ace)[_0x1af1('0x2a')](_0x35173a);};}exports[_0x1af1('0x2b')]=function(_0x4f2b9e,_0x44b393){var _0x39e060={},_0x715d30={},_0x5d549e={'count':0x0,'rows':[]};var _0xcca86=_[_0x1af1('0x2c')](db['SquareReport']['rawAttributes'],function(_0x1e3327){return{'name':_0x1e3327[_0x1af1('0x2d')],'type':_0x1e3327[_0x1af1('0x2e')][_0x1af1('0x2f')]};});_0x715d30[_0x1af1('0x30')]=_[_0x1af1('0x2c')](_0xcca86,_0x1af1('0x29'));_0x715d30['query']=_['keys'](_0x4f2b9e['query']);_0x715d30['filters']=_['intersection'](_0x715d30[_0x1af1('0x30')],_0x715d30[_0x1af1('0x31')]);_0x39e060[_0x1af1('0x32')]=_[_0x1af1('0x33')](_0x715d30[_0x1af1('0x30')],qs[_0x1af1('0x34')](_0x4f2b9e['query'][_0x1af1('0x34')]));_0x39e060[_0x1af1('0x32')]=_0x39e060[_0x1af1('0x32')][_0x1af1('0x35')]?_0x39e060['attributes']:_0x715d30[_0x1af1('0x30')];if(!_0x4f2b9e[_0x1af1('0x31')]['hasOwnProperty'](_0x1af1('0x36'))){_0x39e060[_0x1af1('0x1d')]=qs['limit'](_0x4f2b9e[_0x1af1('0x31')]['limit']);_0x39e060[_0x1af1('0x1c')]=qs[_0x1af1('0x1c')](_0x4f2b9e[_0x1af1('0x31')][_0x1af1('0x1c')]);}_0x39e060[_0x1af1('0x37')]=qs['sort'](_0x4f2b9e['query'][_0x1af1('0x38')]);_0x39e060[_0x1af1('0x39')]=qs[_0x1af1('0x3a')](_[_0x1af1('0x3b')](_0x4f2b9e[_0x1af1('0x31')],_0x715d30[_0x1af1('0x3a')]),_0xcca86);if(_0x4f2b9e[_0x1af1('0x31')]['filter']){_0x39e060['where']=_['merge'](_0x39e060[_0x1af1('0x39')],{'$or':_[_0x1af1('0x2c')](_0xcca86,function(_0x3b227e){if(_0x3b227e[_0x1af1('0x2e')]!==_0x1af1('0x3c')){var _0x27e539={};_0x27e539[_0x3b227e['name']]={'$like':'%'+_0x4f2b9e['query']['filter']+'%'};return _0x27e539;}})});}_0x39e060=_[_0x1af1('0x3d')]({},_0x39e060,_0x4f2b9e['options']);var _0x314ca0={'where':_0x39e060[_0x1af1('0x39')]};return db[_0x1af1('0x3e')][_0x1af1('0x1f')](_0x314ca0)[_0x1af1('0x26')](function(_0x49c7ce){_0x5d549e[_0x1af1('0x1f')]=_0x49c7ce;if(_0x4f2b9e['query']['includeAll']){_0x39e060[_0x1af1('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x1af1('0x40')](_0x39e060);})[_0x1af1('0x26')](function(_0x1d12f7){_0x5d549e[_0x1af1('0x41')]=_0x1d12f7;return _0x5d549e;})[_0x1af1('0x26')](respondWithFilteredResult(_0x44b393,_0x39e060))[_0x1af1('0x42')](handleError(_0x44b393,null));};exports[_0x1af1('0x43')]=function(_0x41548c,_0x34515a){var _0x2a54df={'raw':!![],'where':{'id':_0x41548c[_0x1af1('0x44')]['id']}},_0x387917={};_0x387917[_0x1af1('0x30')]=_['keys'](db['SquareReport'][_0x1af1('0x45')]);_0x387917['query']=_[_0x1af1('0x46')](_0x41548c[_0x1af1('0x31')]);_0x387917[_0x1af1('0x3a')]=_[_0x1af1('0x33')](_0x387917[_0x1af1('0x30')],_0x387917[_0x1af1('0x31')]);_0x2a54df[_0x1af1('0x32')]=_['intersection'](_0x387917['model'],qs['fields'](_0x41548c['query'][_0x1af1('0x34')]));_0x2a54df['attributes']=_0x2a54df[_0x1af1('0x32')][_0x1af1('0x35')]?_0x2a54df[_0x1af1('0x32')]:_0x387917[_0x1af1('0x30')];if(_0x41548c[_0x1af1('0x31')][_0x1af1('0x47')]){_0x2a54df[_0x1af1('0x3f')]=[{'all':!![]}];}_0x2a54df=_[_0x1af1('0x3d')]({},_0x2a54df,_0x41548c[_0x1af1('0x48')]);return db[_0x1af1('0x3e')][_0x1af1('0x49')](_0x2a54df)[_0x1af1('0x26')](handleEntityNotFound(_0x34515a,null))[_0x1af1('0x26')](respondWithResult(_0x34515a,null))[_0x1af1('0x42')](handleError(_0x34515a,null));};exports[_0x1af1('0x4a')]=function(_0x4cbaa0,_0x36b983){return db['SquareReport'][_0x1af1('0x4a')](_0x4cbaa0[_0x1af1('0x4b')],{})[_0x1af1('0x26')](respondWithResult(_0x36b983,0xc9))[_0x1af1('0x42')](handleError(_0x36b983,null));};exports['update']=function(_0x57d1a4,_0x508361){if(_0x57d1a4[_0x1af1('0x4b')]['id']){delete _0x57d1a4[_0x1af1('0x4b')]['id'];}return db[_0x1af1('0x3e')][_0x1af1('0x49')]({'where':{'id':_0x57d1a4[_0x1af1('0x44')]['id']}})[_0x1af1('0x26')](handleEntityNotFound(_0x508361,null))[_0x1af1('0x26')](saveUpdates(_0x57d1a4[_0x1af1('0x4b')],null))['then'](respondWithResult(_0x508361,null))['catch'](handleError(_0x508361,null));};exports['destroy']=function(_0x511cfc,_0x1ba707){return db[_0x1af1('0x3e')][_0x1af1('0x49')]({'where':{'id':_0x511cfc[_0x1af1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ba707,null))[_0x1af1('0x26')](removeEntity(_0x1ba707,null))[_0x1af1('0x42')](handleError(_0x1ba707,null));};exports[_0x1af1('0x4c')]=function(_0x3ad495,_0x407f92){return db['SquareReport'][_0x1af1('0x4c')]()[_0x1af1('0x26')](respondWithResult(_0x407f92,null))[_0x1af1('0x42')](handleError(_0x407f92,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2d07d2e..1187d31 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 _0x087a=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x491198,_0x4246c8){var _0x29a5f2=function(_0x4ef5cd){while(--_0x4ef5cd){_0x491198['push'](_0x491198['shift']());}};_0x29a5f2(++_0x4246c8);}(_0x087a,0x188));var _0xa087=function(_0x3ad642,_0x58bae3){_0x3ad642=_0x3ad642-0x0;var _0x26741b=_0x087a[_0x3ad642];return _0x26741b;};'use strict';var _=require(_0xa087('0x0'));var util=require(_0xa087('0x1'));var logger=require(_0xa087('0x2'))(_0xa087('0x3'));var moment=require(_0xa087('0x4'));var BPromise=require(_0xa087('0x5'));var rp=require(_0xa087('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa087('0x7'));var config=require('../../config/environment');var attributes=require(_0xa087('0x8'));module[_0xa087('0x9')]=function(_0xbfe9d8,_0xd3d308){return _0xbfe9d8[_0xa087('0xa')](_0xa087('0xb'),attributes,{'tableName':_0xa087('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xa087('0xd')]},{'name':_0xa087('0xe'),'fields':[_0xa087('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3b8=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','report_square','uid_pname','project_name','leaveAt'];(function(_0x422559,_0x1e4f5c){var _0x55532c=function(_0x29eaa4){while(--_0x29eaa4){_0x422559['push'](_0x422559['shift']());}};_0x55532c(++_0x1e4f5c);}(_0xf3b8,0x104));var _0x8f3b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf3b8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x8f3b('0x0'));var util=require(_0x8f3b('0x1'));var logger=require('../../config/logger')(_0x8f3b('0x2'));var moment=require(_0x8f3b('0x3'));var BPromise=require(_0x8f3b('0x4'));var rp=require(_0x8f3b('0x5'));var fs=require('fs');var path=require(_0x8f3b('0x6'));var rimraf=require(_0x8f3b('0x7'));var config=require('../../config/environment');var attributes=require(_0x8f3b('0x8'));module['exports']=function(_0x286263,_0x5b89fc){return _0x286263['define']('SquareReport',attributes,{'tableName':_0x8f3b('0x9'),'paranoid':![],'indexes':[{'name':_0x8f3b('0xa'),'fields':['uniqueid',_0x8f3b('0xb')]},{'name':'leaveAt','fields':[_0x8f3b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 74fc20b..1a88dc7 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 _0x724c=['stringify','catch','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','SquareReport,\x20%s,\x20%s','message','CreateSquareReport','SquareReport','create','options','raw'];(function(_0x536afb,_0x1f833e){var _0xfc0f88=function(_0xc0fed7){while(--_0xc0fed7){_0x536afb['push'](_0x536afb['shift']());}};_0xfc0f88(++_0x1f833e);}(_0x724c,0xb6));var _0xc724=function(_0x42791b,_0x23fcb2){_0x42791b=_0x42791b-0x0;var _0x2c225e=_0x724c[_0x42791b];return _0x2c225e;};'use strict';var _=require(_0xc724('0x0'));var util=require(_0xc724('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc724('0x2'));var fs=require('fs');var Redis=require(_0xc724('0x3'));var db=require(_0xc724('0x4'))['db'];var utils=require(_0xc724('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc724('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11e969,_0x55e07c,_0x1473c7){return new BPromise(function(_0x31ffc9,_0x19f4ab){return client[_0xc724('0x7')](_0x11e969,_0x1473c7)[_0xc724('0x8')](function(_0x20a780){logger[_0xc724('0x9')]('SquareReport,\x20%s,\x20%s',_0x55e07c,_0xc724('0xa'));logger[_0xc724('0xb')](_0xc724('0xc'),_0x55e07c,_0xc724('0xa'),JSON['stringify'](_0x20a780));if(_0x20a780[_0xc724('0xd')]){if(_0x20a780[_0xc724('0xd')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x55e07c,_0x20a780[_0xc724('0xd')]['message']);return _0x19f4ab(_0x20a780['error']['message']);}logger[_0xc724('0xd')](_0xc724('0xe'),_0x55e07c,_0x20a780[_0xc724('0xd')][_0xc724('0xf')]);return _0x31ffc9(_0x20a780[_0xc724('0xd')][_0xc724('0xf')]);}else{logger[_0xc724('0x9')](_0xc724('0xe'),_0x55e07c,_0xc724('0xa'));_0x31ffc9(_0x20a780['result']['message']);}})['catch'](function(_0x5922e6){logger['error']('SquareReport,\x20%s,\x20%s',_0x55e07c,_0x5922e6);_0x19f4ab(_0x5922e6);});});}exports[_0xc724('0x10')]=function(_0x11d445){var _0x364e2f=this;return new Promise(function(_0x9152da,_0x247d95){return db[_0xc724('0x11')][_0xc724('0x12')](_0x11d445['body'],{'raw':_0x11d445[_0xc724('0x13')]?_0x11d445[_0xc724('0x13')][_0xc724('0x14')]===undefined?!![]:![]:!![]})[_0xc724('0x8')](function(_0x50501b){logger['info'](_0xc724('0x10'),_0x11d445);logger[_0xc724('0xb')](_0xc724('0x10'),_0x11d445,JSON[_0xc724('0x15')](_0x50501b));_0x9152da(_0x50501b);})[_0xc724('0x16')](function(_0x155634){logger[_0xc724('0xd')](_0xc724('0x10'),_0x155634[_0xc724('0xf')],_0x11d445);_0x247d95(_0x364e2f[_0xc724('0xd')](0x1f4,_0x155634[_0xc724('0xf')]));});});};exports[_0xc724('0x17')]=function(_0x3a0021){var _0xbbf942=this;return new Promise(function(_0x3a61a2,_0x37c9d9){return db[_0xc724('0x11')][_0xc724('0x18')](_0x3a0021[_0xc724('0x19')],{'raw':_0x3a0021[_0xc724('0x13')]?_0x3a0021['options'][_0xc724('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0021['options']?_0x3a0021[_0xc724('0x13')][_0xc724('0x1a')]||null:null,'attributes':_0x3a0021[_0xc724('0x13')]?_0x3a0021[_0xc724('0x13')][_0xc724('0x1b')]||null:null,'limit':_0x3a0021[_0xc724('0x13')]?_0x3a0021[_0xc724('0x13')][_0xc724('0x1c')]||null:null})['then'](function(_0x2681f7){logger[_0xc724('0x9')](_0xc724('0x17'),_0x3a0021);logger['debug'](_0xc724('0x17'),_0x3a0021,JSON[_0xc724('0x15')](_0x2681f7));_0x3a61a2(_0x2681f7);})[_0xc724('0x16')](function(_0x80d326){logger[_0xc724('0xd')]('UpdateSquareReport',_0x80d326[_0xc724('0xf')],_0x3a0021);_0x37c9d9(_0xbbf942['error'](0x1f4,_0x80d326[_0xc724('0xf')]));});});}; \ No newline at end of file +var _0xbaf1=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','update','body','where','attributes','limit','UpdateSquareReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0xe2fb15,_0x4d24b2){var _0x3705ca=function(_0x563830){while(--_0x563830){_0xe2fb15['push'](_0xe2fb15['shift']());}};_0x3705ca(++_0x4d24b2);}(_0xbaf1,0x18d));var _0x1baf=function(_0x3ad964,_0x247c06){_0x3ad964=_0x3ad964-0x0;var _0x50dffc=_0xbaf1[_0x3ad964];return _0x50dffc;};'use strict';var _=require(_0x1baf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1baf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1baf('0x2'));var db=require(_0x1baf('0x3'))['db'];var utils=require(_0x1baf('0x4'));var logger=require(_0x1baf('0x5'))('rpc');var config=require(_0x1baf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1baf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc25e2d,_0x3bd6ee,_0x256ad2){return new BPromise(function(_0x57219c,_0x780076){return client['request'](_0xc25e2d,_0x256ad2)[_0x1baf('0x8')](function(_0x2dd00b){logger[_0x1baf('0x9')](_0x1baf('0xa'),_0x3bd6ee,_0x1baf('0xb'));logger[_0x1baf('0xc')](_0x1baf('0xd'),_0x3bd6ee,_0x1baf('0xb'),JSON['stringify'](_0x2dd00b));if(_0x2dd00b[_0x1baf('0xe')]){if(_0x2dd00b['error']['code']===0x1f4){logger[_0x1baf('0xe')](_0x1baf('0xa'),_0x3bd6ee,_0x2dd00b['error'][_0x1baf('0xf')]);return _0x780076(_0x2dd00b[_0x1baf('0xe')][_0x1baf('0xf')]);}logger[_0x1baf('0xe')](_0x1baf('0xa'),_0x3bd6ee,_0x2dd00b['error'][_0x1baf('0xf')]);return _0x57219c(_0x2dd00b[_0x1baf('0xe')][_0x1baf('0xf')]);}else{logger[_0x1baf('0x9')](_0x1baf('0xa'),_0x3bd6ee,'request\x20sent');_0x57219c(_0x2dd00b[_0x1baf('0x10')][_0x1baf('0xf')]);}})[_0x1baf('0x11')](function(_0x14b3de){logger[_0x1baf('0xe')](_0x1baf('0xa'),_0x3bd6ee,_0x14b3de);_0x780076(_0x14b3de);});});}exports[_0x1baf('0x12')]=function(_0x2d7262){var _0x1c472d=this;return new Promise(function(_0x40319f,_0x200364){return db[_0x1baf('0x13')][_0x1baf('0x14')](_0x2d7262['body'],{'raw':_0x2d7262[_0x1baf('0x15')]?_0x2d7262[_0x1baf('0x15')][_0x1baf('0x16')]===undefined?!![]:![]:!![]})[_0x1baf('0x8')](function(_0xc22e3a){logger[_0x1baf('0x9')](_0x1baf('0x12'),_0x2d7262);logger[_0x1baf('0xc')]('CreateSquareReport',_0x2d7262,JSON['stringify'](_0xc22e3a));_0x40319f(_0xc22e3a);})[_0x1baf('0x11')](function(_0x370439){logger[_0x1baf('0xe')](_0x1baf('0x12'),_0x370439[_0x1baf('0xf')],_0x2d7262);_0x200364(_0x1c472d[_0x1baf('0xe')](0x1f4,_0x370439[_0x1baf('0xf')]));});});};exports['UpdateSquareReport']=function(_0x2c6747){var _0x485f95=this;return new Promise(function(_0x3593e6,_0x12b61e){return db['SquareReport'][_0x1baf('0x17')](_0x2c6747[_0x1baf('0x18')],{'raw':_0x2c6747[_0x1baf('0x15')]?_0x2c6747[_0x1baf('0x15')][_0x1baf('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6747[_0x1baf('0x15')]?_0x2c6747['options'][_0x1baf('0x19')]||null:null,'attributes':_0x2c6747['options']?_0x2c6747[_0x1baf('0x15')][_0x1baf('0x1a')]||null:null,'limit':_0x2c6747[_0x1baf('0x15')]?_0x2c6747[_0x1baf('0x15')][_0x1baf('0x1b')]||null:null})['then'](function(_0x154b58){logger[_0x1baf('0x9')](_0x1baf('0x1c'),_0x2c6747);logger[_0x1baf('0xc')](_0x1baf('0x1c'),_0x2c6747,JSON['stringify'](_0x154b58));_0x3593e6(_0x154b58);})[_0x1baf('0x11')](function(_0x274829){logger[_0x1baf('0xe')](_0x1baf('0x1c'),_0x274829['message'],_0x2c6747);_0x12b61e(_0x485f95[_0x1baf('0xe')](0x1f4,_0x274829[_0x1baf('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 946af46..c3b797b 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 _0x1dd8=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','util','path'];(function(_0x5b3ff0,_0x11cfc5){var _0x1fd79d=function(_0x4da03c){while(--_0x4da03c){_0x5b3ff0['push'](_0x5b3ff0['shift']());}};_0x1fd79d(++_0x11cfc5);}(_0x1dd8,0x17a));var _0x81dd=function(_0x3f46b0,_0x7a813a){_0x3f46b0=_0x3f46b0-0x0;var _0x2873fe=_0x1dd8[_0x3f46b0];return _0x2873fe;};'use strict';var multer=require('multer');var util=require(_0x81dd('0x0'));var path=require(_0x81dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x81dd('0x2'));var router=express[_0x81dd('0x3')]();var fs_extra=require(_0x81dd('0x4'));var auth=require(_0x81dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81dd('0x6'));var controller=require('./squareReportDetail.controller');router[_0x81dd('0x7')]('/',auth[_0x81dd('0x8')](),controller[_0x81dd('0x9')]);router[_0x81dd('0x7')]('/describe',auth[_0x81dd('0x8')](),controller[_0x81dd('0xa')]);router[_0x81dd('0x7')](_0x81dd('0xb'),auth[_0x81dd('0x8')](),controller[_0x81dd('0xc')]);router[_0x81dd('0xd')]('/',auth[_0x81dd('0x8')](),controller[_0x81dd('0xe')]);router[_0x81dd('0xf')](_0x81dd('0xb'),auth[_0x81dd('0x8')](),controller[_0x81dd('0x10')]);router[_0x81dd('0x11')](_0x81dd('0xb'),auth[_0x81dd('0x8')](),controller[_0x81dd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8aee=['put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','describe','get','/:id','post'];(function(_0x5a05f7,_0x16dc67){var _0x14f6c9=function(_0xd24251){while(--_0xd24251){_0x5a05f7['push'](_0x5a05f7['shift']());}};_0x14f6c9(++_0x16dc67);}(_0x8aee,0xa6));var _0xe8ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe8ae('0x0'));var path=require(_0xe8ae('0x1'));var timeout=require(_0xe8ae('0x2'));var express=require(_0xe8ae('0x3'));var router=express[_0xe8ae('0x4')]();var fs_extra=require(_0xe8ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe8ae('0x6'));var config=require(_0xe8ae('0x7'));var controller=require(_0xe8ae('0x8'));router['get']('/',auth[_0xe8ae('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe8ae('0xa')]);router[_0xe8ae('0xb')](_0xe8ae('0xc'),auth[_0xe8ae('0x9')](),controller['show']);router[_0xe8ae('0xd')]('/',auth[_0xe8ae('0x9')](),controller['create']);router[_0xe8ae('0xe')](_0xe8ae('0xc'),auth[_0xe8ae('0x9')](),controller[_0xe8ae('0xf')]);router[_0xe8ae('0x10')](_0xe8ae('0xc'),auth[_0xe8ae('0x9')](),controller['destroy']);module[_0xe8ae('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 011cdcb..b6d69d5 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 _0xea6b=['exports','STRING','TEXT'];(function(_0x1cac44,_0x5d2354){var _0x2a4a9c=function(_0x21484b){while(--_0x21484b){_0x1cac44['push'](_0x1cac44['shift']());}};_0x2a4a9c(++_0x5d2354);}(_0xea6b,0x12f));var _0xbea6=function(_0x5b1d77,_0x4ce587){_0x5b1d77=_0x5b1d77-0x0;var _0x1658ec=_0xea6b[_0x5b1d77];return _0x1658ec;};'use strict';var Sequelize=require('sequelize');module[_0xbea6('0x0')]={'uniqueid':{'type':Sequelize[_0xbea6('0x1')]},'node':{'type':Sequelize[_0xbea6('0x1')]},'application':{'type':Sequelize[_0xbea6('0x1')]},'data':{'type':Sequelize[_0xbea6('0x2')]},'project_name':{'type':Sequelize[_0xbea6('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb068=['STRING','TEXT','exports'];(function(_0x274e90,_0x47d036){var _0x50858a=function(_0x13a8d7){while(--_0x13a8d7){_0x274e90['push'](_0x274e90['shift']());}};_0x50858a(++_0x47d036);}(_0xb068,0x119));var _0x8b06=function(_0x5f26f1,_0x46a106){_0x5f26f1=_0x5f26f1-0x0;var _0x20e412=_0xb068[_0x5f26f1];return _0x20e412;};'use strict';var Sequelize=require('sequelize');module[_0x8b06('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8b06('0x1')]},'application':{'type':Sequelize[_0x8b06('0x1')]},'data':{'type':Sequelize[_0x8b06('0x2')]},'project_name':{'type':Sequelize[_0x8b06('0x1')]},'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 c728e14..4b2f389 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 _0x6bc9=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','params','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x47b4ca,_0x52e4c4){var _0x456ffd=function(_0x25d0dd){while(--_0x25d0dd){_0x47b4ca['push'](_0x47b4ca['shift']());}};_0x456ffd(++_0x52e4c4);}(_0x6bc9,0x1cc));var _0x96bc=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6bc9[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0x96bc('0x0'));var rimraf=require(_0x96bc('0x1'));var zipdir=require(_0x96bc('0x2'));var jsonpatch=require(_0x96bc('0x3'));var rp=require(_0x96bc('0x4'));var moment=require('moment');var BPromise=require(_0x96bc('0x5'));var Mustache=require(_0x96bc('0x6'));var util=require(_0x96bc('0x7'));var path=require(_0x96bc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x96bc('0x9'));var fs=require('fs');var fs_extra=require(_0x96bc('0xa'));var _=require(_0x96bc('0xb'));var squel=require(_0x96bc('0xc'));var crypto=require(_0x96bc('0xd'));var jsforce=require(_0x96bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x96bc('0xf'));var querystring=require(_0x96bc('0x10'));var Papa=require(_0x96bc('0x11'));var Redis=require(_0x96bc('0x12'));var authService=require(_0x96bc('0x13'));var qs=require(_0x96bc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96bc('0x15'));var logger=require(_0x96bc('0x16'))(_0x96bc('0x17'));var utils=require(_0x96bc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x96bc('0x19'));var db=require(_0x96bc('0x1a'))['db'];function respondWithStatusCode(_0x56e8f6,_0x189b47){_0x189b47=_0x189b47||0xcc;return function(_0x20f238){if(_0x20f238){return _0x56e8f6[_0x96bc('0x1b')](_0x189b47);}return _0x56e8f6[_0x96bc('0x1c')](_0x189b47)['end']();};}function respondWithResult(_0x158880,_0x54a17a){_0x54a17a=_0x54a17a||0xc8;return function(_0x29c1a3){if(_0x29c1a3){return _0x158880['status'](_0x54a17a)[_0x96bc('0x1d')](_0x29c1a3);}};}function respondWithFilteredResult(_0x2f1d5d,_0x626a33){return function(_0x2defb9){if(_0x2defb9){var _0x438a32=typeof _0x626a33[_0x96bc('0x1e')]===_0x96bc('0x1f')&&typeof _0x626a33[_0x96bc('0x20')]===_0x96bc('0x1f');var _0x186614=_0x2defb9[_0x96bc('0x21')];var _0x50f72b=_0x438a32?0x0:_0x626a33[_0x96bc('0x1e')];var _0x2558d1=_0x438a32?_0x2defb9[_0x96bc('0x21')]:_0x626a33[_0x96bc('0x1e')]+_0x626a33['limit'];var _0x2cf4d8;if(_0x2558d1>=_0x186614){_0x2558d1=_0x186614;_0x2cf4d8=0xc8;}else{_0x2cf4d8=0xce;}_0x2f1d5d[_0x96bc('0x1c')](_0x2cf4d8);return _0x2f1d5d[_0x96bc('0x22')](_0x96bc('0x23'),_0x50f72b+'-'+_0x2558d1+'/'+_0x186614)[_0x96bc('0x1d')](_0x2defb9);}return null;};}function patchUpdates(_0x394cbf){return function(_0x3c67c5){try{jsonpatch[_0x96bc('0x24')](_0x3c67c5,_0x394cbf,!![]);}catch(_0x580b6c){return BPromise[_0x96bc('0x25')](_0x580b6c);}return _0x3c67c5[_0x96bc('0x26')]();};}function saveUpdates(_0x216e18,_0x357979){return function(_0x3c3d4e){if(_0x3c3d4e){return _0x3c3d4e[_0x96bc('0x27')](_0x216e18)[_0x96bc('0x28')](function(_0x1cd197){return _0x1cd197;});}return null;};}function removeEntity(_0xd15614,_0x4d068c){return function(_0x515745){if(_0x515745){return _0x515745[_0x96bc('0x29')]()[_0x96bc('0x28')](function(){_0xd15614[_0x96bc('0x1c')](0xcc)[_0x96bc('0x2a')]();});}};}function handleEntityNotFound(_0x371120,_0x2dfddb){return function(_0xfb68dc){if(!_0xfb68dc){_0x371120[_0x96bc('0x1b')](0x194);}return _0xfb68dc;};}function handleError(_0x48b51,_0x5c2f3f){_0x5c2f3f=_0x5c2f3f||0x1f4;return function(_0x1b1fc2){logger['error'](_0x1b1fc2[_0x96bc('0x2b')]);if(_0x1b1fc2[_0x96bc('0x2c')]){delete _0x1b1fc2[_0x96bc('0x2c')];}_0x48b51[_0x96bc('0x1c')](_0x5c2f3f)[_0x96bc('0x2d')](_0x1b1fc2);};}exports['index']=function(_0xed9011,_0x4ad8af){var _0x55b76c={},_0x492ece={},_0xd8c965={'count':0x0,'rows':[]};var _0x1190a3=_[_0x96bc('0x2e')](db[_0x96bc('0x2f')][_0x96bc('0x30')],function(_0x578f15){return{'name':_0x578f15[_0x96bc('0x31')],'type':_0x578f15[_0x96bc('0x32')][_0x96bc('0x33')]};});_0x492ece[_0x96bc('0x34')]=_[_0x96bc('0x2e')](_0x1190a3,_0x96bc('0x2c'));_0x492ece[_0x96bc('0x35')]=_[_0x96bc('0x36')](_0xed9011[_0x96bc('0x35')]);_0x492ece['filters']=_[_0x96bc('0x37')](_0x492ece[_0x96bc('0x34')],_0x492ece['query']);_0x55b76c[_0x96bc('0x38')]=_[_0x96bc('0x37')](_0x492ece['model'],qs['fields'](_0xed9011[_0x96bc('0x35')][_0x96bc('0x39')]));_0x55b76c[_0x96bc('0x38')]=_0x55b76c[_0x96bc('0x38')][_0x96bc('0x3a')]?_0x55b76c[_0x96bc('0x38')]:_0x492ece[_0x96bc('0x34')];if(!_0xed9011['query'][_0x96bc('0x3b')](_0x96bc('0x3c'))){_0x55b76c['limit']=qs[_0x96bc('0x20')](_0xed9011['query'][_0x96bc('0x20')]);_0x55b76c[_0x96bc('0x1e')]=qs[_0x96bc('0x1e')](_0xed9011[_0x96bc('0x35')][_0x96bc('0x1e')]);}_0x55b76c[_0x96bc('0x3d')]=qs[_0x96bc('0x3e')](_0xed9011[_0x96bc('0x35')][_0x96bc('0x3e')]);_0x55b76c[_0x96bc('0x3f')]=qs['filters'](_[_0x96bc('0x40')](_0xed9011['query'],_0x492ece[_0x96bc('0x41')]),_0x1190a3);if(_0xed9011[_0x96bc('0x35')][_0x96bc('0x42')]){_0x55b76c[_0x96bc('0x3f')]=_[_0x96bc('0x43')](_0x55b76c[_0x96bc('0x3f')],{'$or':_[_0x96bc('0x2e')](_0x1190a3,function(_0x3010d8){if(_0x3010d8[_0x96bc('0x32')]!=='VIRTUAL'){var _0x1038b1={};_0x1038b1[_0x3010d8['name']]={'$like':'%'+_0xed9011['query'][_0x96bc('0x42')]+'%'};return _0x1038b1;}})});}_0x55b76c=_[_0x96bc('0x43')]({},_0x55b76c,_0xed9011[_0x96bc('0x44')]);var _0x2459a1={'where':_0x55b76c['where']};return db[_0x96bc('0x2f')][_0x96bc('0x21')](_0x2459a1)[_0x96bc('0x28')](function(_0x23d943){_0xd8c965[_0x96bc('0x21')]=_0x23d943;if(_0xed9011[_0x96bc('0x35')][_0x96bc('0x45')]){_0x55b76c[_0x96bc('0x46')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x96bc('0x47')](_0x55b76c);})['then'](function(_0xd092f4){_0xd8c965[_0x96bc('0x48')]=_0xd092f4;return _0xd8c965;})[_0x96bc('0x28')](respondWithFilteredResult(_0x4ad8af,_0x55b76c))['catch'](handleError(_0x4ad8af,null));};exports['show']=function(_0x1f52ab,_0x475d1c){var _0x336f63={'raw':!![],'where':{'id':_0x1f52ab[_0x96bc('0x49')]['id']}},_0x48457e={};_0x48457e[_0x96bc('0x34')]=_['keys'](db[_0x96bc('0x2f')][_0x96bc('0x30')]);_0x48457e[_0x96bc('0x35')]=_[_0x96bc('0x36')](_0x1f52ab[_0x96bc('0x35')]);_0x48457e['filters']=_[_0x96bc('0x37')](_0x48457e[_0x96bc('0x34')],_0x48457e[_0x96bc('0x35')]);_0x336f63[_0x96bc('0x38')]=_[_0x96bc('0x37')](_0x48457e[_0x96bc('0x34')],qs['fields'](_0x1f52ab[_0x96bc('0x35')]['fields']));_0x336f63['attributes']=_0x336f63[_0x96bc('0x38')]['length']?_0x336f63[_0x96bc('0x38')]:_0x48457e[_0x96bc('0x34')];if(_0x1f52ab['query']['includeAll']){_0x336f63[_0x96bc('0x46')]=[{'all':!![]}];}_0x336f63=_[_0x96bc('0x43')]({},_0x336f63,_0x1f52ab[_0x96bc('0x44')]);return db['SquareDetailsReport']['find'](_0x336f63)[_0x96bc('0x28')](handleEntityNotFound(_0x475d1c,null))['then'](respondWithResult(_0x475d1c,null))['catch'](handleError(_0x475d1c,null));};exports['create']=function(_0x136563,_0x114773){return db[_0x96bc('0x2f')][_0x96bc('0x4a')](_0x136563[_0x96bc('0x4b')],{})[_0x96bc('0x28')](respondWithResult(_0x114773,0xc9))[_0x96bc('0x4c')](handleError(_0x114773,null));};exports[_0x96bc('0x27')]=function(_0x361261,_0x3deb84){if(_0x361261[_0x96bc('0x4b')]['id']){delete _0x361261[_0x96bc('0x4b')]['id'];}return db['SquareDetailsReport'][_0x96bc('0x4d')]({'where':{'id':_0x361261[_0x96bc('0x49')]['id']}})[_0x96bc('0x28')](handleEntityNotFound(_0x3deb84,null))[_0x96bc('0x28')](saveUpdates(_0x361261[_0x96bc('0x4b')],null))[_0x96bc('0x28')](respondWithResult(_0x3deb84,null))['catch'](handleError(_0x3deb84,null));};exports[_0x96bc('0x29')]=function(_0x2db42d,_0x92d48a){return db[_0x96bc('0x2f')][_0x96bc('0x4d')]({'where':{'id':_0x2db42d['params']['id']}})[_0x96bc('0x28')](handleEntityNotFound(_0x92d48a,null))['then'](removeEntity(_0x92d48a,null))['catch'](handleError(_0x92d48a,null));};exports[_0x96bc('0x4e')]=function(_0x37b964,_0x5d7b69){return db['SquareDetailsReport'][_0x96bc('0x4e')]()['then'](respondWithResult(_0x5d7b69,null))['catch'](handleError(_0x5d7b69,null));}; \ No newline at end of file +var _0xe3ed=['VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','type'];(function(_0x422f82,_0x4b1bff){var _0x53a9e0=function(_0x1eb253){while(--_0x1eb253){_0x422f82['push'](_0x422f82['shift']());}};_0x53a9e0(++_0x4b1bff);}(_0xe3ed,0x1d5));var _0xde3e=function(_0x2dd1e0,_0x2fabe9){_0x2dd1e0=_0x2dd1e0-0x0;var _0x4b25b0=_0xe3ed[_0x2dd1e0];return _0x4b25b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xde3e('0x0'));var jsonpatch=require(_0xde3e('0x1'));var rp=require(_0xde3e('0x2'));var moment=require('moment');var BPromise=require(_0xde3e('0x3'));var Mustache=require(_0xde3e('0x4'));var util=require(_0xde3e('0x5'));var path=require(_0xde3e('0x6'));var sox=require(_0xde3e('0x7'));var csv=require('to-csv');var ejs=require(_0xde3e('0x8'));var fs=require('fs');var fs_extra=require(_0xde3e('0x9'));var _=require(_0xde3e('0xa'));var squel=require('squel');var crypto=require(_0xde3e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xde3e('0xc'));var toCsv=require(_0xde3e('0xd'));var querystring=require(_0xde3e('0xe'));var Papa=require(_0xde3e('0xf'));var Redis=require(_0xde3e('0x10'));var authService=require(_0xde3e('0x11'));var qs=require(_0xde3e('0x12'));var as=require(_0xde3e('0x13'));var hardwareService=require(_0xde3e('0x14'));var logger=require(_0xde3e('0x15'))(_0xde3e('0x16'));var utils=require('../../config/utils');var config=require(_0xde3e('0x17'));var licenseUtil=require(_0xde3e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487eb5,_0x39ad44){_0x39ad44=_0x39ad44||0xcc;return function(_0x4a805f){if(_0x4a805f){return _0x487eb5[_0xde3e('0x19')](_0x39ad44);}return _0x487eb5[_0xde3e('0x1a')](_0x39ad44)[_0xde3e('0x1b')]();};}function respondWithResult(_0x58dc97,_0x1cf411){_0x1cf411=_0x1cf411||0xc8;return function(_0x4ed546){if(_0x4ed546){return _0x58dc97[_0xde3e('0x1a')](_0x1cf411)[_0xde3e('0x1c')](_0x4ed546);}};}function respondWithFilteredResult(_0x24e965,_0x5ea455){return function(_0x7e4741){if(_0x7e4741){var _0x3a7430=typeof _0x5ea455[_0xde3e('0x1d')]===_0xde3e('0x1e')&&typeof _0x5ea455[_0xde3e('0x1f')]===_0xde3e('0x1e');var _0x4de908=_0x7e4741[_0xde3e('0x20')];var _0x5b2a72=_0x3a7430?0x0:_0x5ea455[_0xde3e('0x1d')];var _0x5a92fa=_0x3a7430?_0x7e4741[_0xde3e('0x20')]:_0x5ea455['offset']+_0x5ea455[_0xde3e('0x1f')];var _0x2c5cf7;if(_0x5a92fa>=_0x4de908){_0x5a92fa=_0x4de908;_0x2c5cf7=0xc8;}else{_0x2c5cf7=0xce;}_0x24e965[_0xde3e('0x1a')](_0x2c5cf7);return _0x24e965[_0xde3e('0x21')]('Content-Range',_0x5b2a72+'-'+_0x5a92fa+'/'+_0x4de908)[_0xde3e('0x1c')](_0x7e4741);}return null;};}function patchUpdates(_0x30286c){return function(_0x4f04e4){try{jsonpatch[_0xde3e('0x22')](_0x4f04e4,_0x30286c,!![]);}catch(_0x32ce7e){return BPromise[_0xde3e('0x23')](_0x32ce7e);}return _0x4f04e4['save']();};}function saveUpdates(_0x48987b,_0x53128b){return function(_0x104d8f){if(_0x104d8f){return _0x104d8f[_0xde3e('0x24')](_0x48987b)[_0xde3e('0x25')](function(_0x1da7d1){return _0x1da7d1;});}return null;};}function removeEntity(_0xeeeceb,_0x4ea0f9){return function(_0xcc6c84){if(_0xcc6c84){return _0xcc6c84[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){_0xeeeceb[_0xde3e('0x1a')](0xcc)[_0xde3e('0x1b')]();});}};}function handleEntityNotFound(_0x510bf6,_0x340ff7){return function(_0x15b113){if(!_0x15b113){_0x510bf6[_0xde3e('0x19')](0x194);}return _0x15b113;};}function handleError(_0x39e4c0,_0x23a609){_0x23a609=_0x23a609||0x1f4;return function(_0x1d6144){logger[_0xde3e('0x27')](_0x1d6144[_0xde3e('0x28')]);if(_0x1d6144[_0xde3e('0x29')]){delete _0x1d6144[_0xde3e('0x29')];}_0x39e4c0[_0xde3e('0x1a')](_0x23a609)[_0xde3e('0x2a')](_0x1d6144);};}exports[_0xde3e('0x2b')]=function(_0x5221ad,_0x3e9f72){var _0x434561={},_0x3abfb3={},_0x29a8e6={'count':0x0,'rows':[]};var _0x347ae1=_[_0xde3e('0x2c')](db[_0xde3e('0x2d')][_0xde3e('0x2e')],function(_0x373ae3){return{'name':_0x373ae3[_0xde3e('0x2f')],'type':_0x373ae3['type'][_0xde3e('0x30')]};});_0x3abfb3[_0xde3e('0x31')]=_[_0xde3e('0x2c')](_0x347ae1,_0xde3e('0x29'));_0x3abfb3[_0xde3e('0x32')]=_[_0xde3e('0x33')](_0x5221ad[_0xde3e('0x32')]);_0x3abfb3['filters']=_[_0xde3e('0x34')](_0x3abfb3[_0xde3e('0x31')],_0x3abfb3[_0xde3e('0x32')]);_0x434561[_0xde3e('0x35')]=_[_0xde3e('0x34')](_0x3abfb3['model'],qs[_0xde3e('0x36')](_0x5221ad[_0xde3e('0x32')][_0xde3e('0x36')]));_0x434561['attributes']=_0x434561[_0xde3e('0x35')]['length']?_0x434561[_0xde3e('0x35')]:_0x3abfb3['model'];if(!_0x5221ad[_0xde3e('0x32')]['hasOwnProperty']('nolimit')){_0x434561[_0xde3e('0x1f')]=qs['limit'](_0x5221ad['query'][_0xde3e('0x1f')]);_0x434561[_0xde3e('0x1d')]=qs['offset'](_0x5221ad[_0xde3e('0x32')]['offset']);}_0x434561[_0xde3e('0x37')]=qs['sort'](_0x5221ad[_0xde3e('0x32')][_0xde3e('0x38')]);_0x434561[_0xde3e('0x39')]=qs[_0xde3e('0x3a')](_[_0xde3e('0x3b')](_0x5221ad['query'],_0x3abfb3['filters']),_0x347ae1);if(_0x5221ad['query'][_0xde3e('0x3c')]){_0x434561[_0xde3e('0x39')]=_[_0xde3e('0x3d')](_0x434561[_0xde3e('0x39')],{'$or':_[_0xde3e('0x2c')](_0x347ae1,function(_0x4d7360){if(_0x4d7360[_0xde3e('0x3e')]!==_0xde3e('0x3f')){var _0x1e3ce4={};_0x1e3ce4[_0x4d7360[_0xde3e('0x29')]]={'$like':'%'+_0x5221ad[_0xde3e('0x32')][_0xde3e('0x3c')]+'%'};return _0x1e3ce4;}})});}_0x434561=_['merge']({},_0x434561,_0x5221ad['options']);var _0x588282={'where':_0x434561[_0xde3e('0x39')]};return db[_0xde3e('0x2d')][_0xde3e('0x20')](_0x588282)[_0xde3e('0x25')](function(_0x1e93e1){_0x29a8e6[_0xde3e('0x20')]=_0x1e93e1;if(_0x5221ad[_0xde3e('0x32')]['includeAll']){_0x434561[_0xde3e('0x40')]=[{'all':!![]}];}return db[_0xde3e('0x2d')][_0xde3e('0x41')](_0x434561);})['then'](function(_0x552ff4){_0x29a8e6[_0xde3e('0x42')]=_0x552ff4;return _0x29a8e6;})['then'](respondWithFilteredResult(_0x3e9f72,_0x434561))[_0xde3e('0x43')](handleError(_0x3e9f72,null));};exports[_0xde3e('0x44')]=function(_0x1a386b,_0x179548){var _0x138970={'raw':!![],'where':{'id':_0x1a386b[_0xde3e('0x45')]['id']}},_0x3f9277={};_0x3f9277[_0xde3e('0x31')]=_['keys'](db[_0xde3e('0x2d')][_0xde3e('0x2e')]);_0x3f9277['query']=_[_0xde3e('0x33')](_0x1a386b[_0xde3e('0x32')]);_0x3f9277[_0xde3e('0x3a')]=_[_0xde3e('0x34')](_0x3f9277[_0xde3e('0x31')],_0x3f9277['query']);_0x138970['attributes']=_[_0xde3e('0x34')](_0x3f9277[_0xde3e('0x31')],qs[_0xde3e('0x36')](_0x1a386b[_0xde3e('0x32')][_0xde3e('0x36')]));_0x138970[_0xde3e('0x35')]=_0x138970['attributes'][_0xde3e('0x46')]?_0x138970['attributes']:_0x3f9277[_0xde3e('0x31')];if(_0x1a386b['query'][_0xde3e('0x47')]){_0x138970[_0xde3e('0x40')]=[{'all':!![]}];}_0x138970=_[_0xde3e('0x3d')]({},_0x138970,_0x1a386b['options']);return db[_0xde3e('0x2d')][_0xde3e('0x48')](_0x138970)['then'](handleEntityNotFound(_0x179548,null))[_0xde3e('0x25')](respondWithResult(_0x179548,null))['catch'](handleError(_0x179548,null));};exports[_0xde3e('0x49')]=function(_0xf0ecc7,_0x5478ad){return db[_0xde3e('0x2d')]['create'](_0xf0ecc7[_0xde3e('0x4a')],{})[_0xde3e('0x25')](respondWithResult(_0x5478ad,0xc9))[_0xde3e('0x43')](handleError(_0x5478ad,null));};exports[_0xde3e('0x24')]=function(_0x627ecf,_0x6fb482){if(_0x627ecf[_0xde3e('0x4a')]['id']){delete _0x627ecf[_0xde3e('0x4a')]['id'];}return db[_0xde3e('0x2d')]['find']({'where':{'id':_0x627ecf['params']['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x6fb482,null))[_0xde3e('0x25')](saveUpdates(_0x627ecf[_0xde3e('0x4a')],null))['then'](respondWithResult(_0x6fb482,null))[_0xde3e('0x43')](handleError(_0x6fb482,null));};exports['destroy']=function(_0x37d5ad,_0x15c6b3){return db['SquareDetailsReport'][_0xde3e('0x48')]({'where':{'id':_0x37d5ad[_0xde3e('0x45')]['id']}})['then'](handleEntityNotFound(_0x15c6b3,null))[_0xde3e('0x25')](removeEntity(_0x15c6b3,null))['catch'](handleError(_0x15c6b3,null));};exports[_0xde3e('0x4b')]=function(_0x2d1f9f,_0x6c1659){return db[_0xde3e('0x2d')][_0xde3e('0x4b')]()[_0xde3e('0x25')](respondWithResult(_0x6c1659,null))[_0xde3e('0x43')](handleError(_0x6c1659,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b5d2404..996d100 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 _0xa670=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_square_details'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xa670,0x17c));var _0x0a67=function(_0x1809b3,_0x3e91af){_0x1809b3=_0x1809b3-0x0;var _0xa7d44d=_0xa670[_0x1809b3];return _0xa7d44d;};'use strict';var _=require(_0x0a67('0x0'));var util=require(_0x0a67('0x1'));var logger=require('../../config/logger')(_0x0a67('0x2'));var moment=require(_0x0a67('0x3'));var BPromise=require(_0x0a67('0x4'));var rp=require(_0x0a67('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a67('0x6'));var config=require(_0x0a67('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0xc559fc,_0x123ded){return _0xc559fc[_0x0a67('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x0a67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ed5=['util','../../config/logger','api','moment','bluebird','request-promise','path','./squareReportDetail.attributes','SquareDetailsReport','report_square_details'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x8ed5,0x122));var _0x58ed=function(_0x41ec79,_0x228c58){_0x41ec79=_0x41ec79-0x0;var _0x218117=_0x8ed5[_0x41ec79];return _0x218117;};'use strict';var _=require('lodash');var util=require(_0x58ed('0x0'));var logger=require(_0x58ed('0x1'))(_0x58ed('0x2'));var moment=require(_0x58ed('0x3'));var BPromise=require(_0x58ed('0x4'));var rp=require(_0x58ed('0x5'));var fs=require('fs');var path=require(_0x58ed('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x58ed('0x7'));module['exports']=function(_0x586a32,_0x2fb626){return _0x586a32['define'](_0x58ed('0x8'),attributes,{'tableName':_0x58ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 0bfe4fc..f263d46 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 _0x8d05=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','catch'];(function(_0x1cef54,_0x46dc18){var _0x231006=function(_0x1ee0d1){while(--_0x1ee0d1){_0x1cef54['push'](_0x1cef54['shift']());}};_0x231006(++_0x46dc18);}(_0x8d05,0xe8));var _0x58d0=function(_0x3bc350,_0x239339){_0x3bc350=_0x3bc350-0x0;var _0x1a2e3d=_0x8d05[_0x3bc350];return _0x1a2e3d;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var moment=require(_0x58d0('0x2'));var BPromise=require(_0x58d0('0x3'));var rs=require(_0x58d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58d0('0x5'));var logger=require(_0x58d0('0x6'))(_0x58d0('0x7'));var config=require(_0x58d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x58d0('0x9')][_0x58d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x528303,_0x66aef1,_0x4e44e2){return new BPromise(function(_0xe744f4,_0x34ab60){return client[_0x58d0('0xb')](_0x528303,_0x4e44e2)[_0x58d0('0xc')](function(_0x1d070a){logger['info'](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));logger['debug'](_0x58d0('0xf'),_0x66aef1,_0x58d0('0xe'),JSON['stringify'](_0x1d070a));if(_0x1d070a['error']){if(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x11')]===0x1f4){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0x34ab60(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);return _0xe744f4(_0x1d070a[_0x58d0('0x10')][_0x58d0('0x12')]);}else{logger[_0x58d0('0x13')](_0x58d0('0xd'),_0x66aef1,_0x58d0('0xe'));_0xe744f4(_0x1d070a[_0x58d0('0x14')][_0x58d0('0x12')]);}})['catch'](function(_0x10874e){logger[_0x58d0('0x10')](_0x58d0('0xd'),_0x66aef1,_0x10874e);_0x34ab60(_0x10874e);});});}exports[_0x58d0('0x15')]=function(_0xb8dd5f){var _0x2c7db6=this;return new Promise(function(_0x23dcfb,_0x41d221){return db[_0x58d0('0x16')][_0x58d0('0x17')](_0xb8dd5f[_0x58d0('0x18')],{'raw':_0xb8dd5f[_0x58d0('0x19')]?_0xb8dd5f[_0x58d0('0x19')][_0x58d0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3072f9){logger[_0x58d0('0x13')](_0x58d0('0x15'),_0xb8dd5f);logger['debug'](_0x58d0('0x15'),_0xb8dd5f,JSON[_0x58d0('0x1b')](_0x3072f9));_0x23dcfb(_0x3072f9);})[_0x58d0('0x1c')](function(_0x575b34){logger[_0x58d0('0x10')]('CreateSquareDetailsReport',_0x575b34['message'],_0xb8dd5f);_0x41d221(_0x2c7db6[_0x58d0('0x10')](0x1f4,_0x575b34[_0x58d0('0x12')]));});});}; \ No newline at end of file +var _0xa32b=['create','body','CreateSquareDetailsReport','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','SquareDetailsReport'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa32b,0x68));var _0xba32=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xa32b[_0x59616b];return _0x5c4523;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var moment=require(_0xba32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba32('0x2'));var db=require(_0xba32('0x3'))['db'];var utils=require(_0xba32('0x4'));var logger=require('../../config/logger')(_0xba32('0x5'));var config=require(_0xba32('0x6'));var jayson=require(_0xba32('0x7'));var client=jayson[_0xba32('0x8')][_0xba32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a59,_0x1b1332,_0x4edbc6){return new BPromise(function(_0xcdcc5b,_0x13395b){return client[_0xba32('0xa')](_0x5c5a59,_0x4edbc6)[_0xba32('0xb')](function(_0x5d8f64){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,'request\x20sent');logger[_0xba32('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'),JSON['stringify'](_0x5d8f64));if(_0x5d8f64[_0xba32('0xe')]){if(_0x5d8f64['error']['code']===0x1f4){logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0x13395b(_0x5d8f64[_0xba32('0xe')]['message']);}logger[_0xba32('0xe')](_0xba32('0xf'),_0x1b1332,_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);return _0xcdcc5b(_0x5d8f64[_0xba32('0xe')][_0xba32('0x10')]);}else{logger[_0xba32('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,_0xba32('0xd'));_0xcdcc5b(_0x5d8f64[_0xba32('0x12')][_0xba32('0x10')]);}})[_0xba32('0x13')](function(_0x310dee){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1b1332,_0x310dee);_0x13395b(_0x310dee);});});}exports['CreateSquareDetailsReport']=function(_0x5c3fe6){var _0x234db9=this;return new Promise(function(_0x1ae3ea,_0x42803d){return db[_0xba32('0x14')][_0xba32('0x15')](_0x5c3fe6[_0xba32('0x16')],{'raw':_0x5c3fe6['options']?_0x5c3fe6['options']['raw']===undefined?!![]:![]:!![]})[_0xba32('0xb')](function(_0x51c43a){logger[_0xba32('0x11')](_0xba32('0x17'),_0x5c3fe6);logger[_0xba32('0xc')](_0xba32('0x17'),_0x5c3fe6,JSON[_0xba32('0x18')](_0x51c43a));_0x1ae3ea(_0x51c43a);})[_0xba32('0x13')](function(_0xdfa807){logger['error'](_0xba32('0x17'),_0xdfa807[_0xba32('0x10')],_0x5c3fe6);_0x42803d(_0x234db9[_0xba32('0xe')](0x1f4,_0xdfa807[_0xba32('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bcc4d1b..d811ef3 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 _0x7b89=['express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x496709,_0x572736){var _0x56ddc3=function(_0x1eba61){while(--_0x1eba61){_0x496709['push'](_0x496709['shift']());}};_0x56ddc3(++_0x572736);}(_0x7b89,0x117));var _0x97b8=function(_0x4ebb28,_0x189f08){_0x4ebb28=_0x4ebb28-0x0;var _0x59ed74=_0x7b89[_0x4ebb28];return _0x59ed74;};'use strict';var express=require(_0x97b8('0x0'));var router=express[_0x97b8('0x1')]();var auth=require(_0x97b8('0x2'));var controller=require(_0x97b8('0x3'));router[_0x97b8('0x4')]('/',auth['isAuthenticated'](),controller[_0x97b8('0x5')]);router['get'](_0x97b8('0x6'),auth[_0x97b8('0x7')](),controller[_0x97b8('0x8')]);module['exports']=router; \ No newline at end of file +var _0xf89b=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports','express','../../components/auth/service'];(function(_0x866fc7,_0x28a8ba){var _0xf127a5=function(_0x449bb1){while(--_0x449bb1){_0x866fc7['push'](_0x866fc7['shift']());}};_0xf127a5(++_0x28a8ba);}(_0xf89b,0x8e));var _0xbf89=function(_0x434608,_0x1bcb2c){_0x434608=_0x434608-0x0;var _0x295a0e=_0xf89b[_0x434608];return _0x295a0e;};'use strict';var express=require(_0xbf89('0x0'));var router=express['Router']();var auth=require(_0xbf89('0x1'));var controller=require(_0xbf89('0x2'));router[_0xbf89('0x3')]('/',auth[_0xbf89('0x4')](),controller[_0xbf89('0x5')]);router[_0xbf89('0x3')](_0xbf89('0x6'),auth[_0xbf89('0x4')](),controller['killProcess']);module[_0xbf89('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 c2c9f90..3dbbcb2 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 _0x4eb4=['exec','../../config/logger','util','bluebird','lodash','name','status','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch'];(function(_0x4e0bc4,_0x30ea10){var _0x3943ec=function(_0x4c4253){while(--_0x4c4253){_0x4e0bc4['push'](_0x4e0bc4['shift']());}};_0x3943ec(++_0x30ea10);}(_0x4eb4,0x1f4));var _0x44eb=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x4eb4[_0x595bd1];return _0xd0344f;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x44eb('0x0')];var logger=require(_0x44eb('0x1'))('api');var util=require(_0x44eb('0x2'));var BPromise=require(_0x44eb('0x3'));var _=require(_0x44eb('0x4'));function handleError(_0x1af09a,_0x1818bb,_0x246827){_0x1818bb=_0x1818bb||0x1f4;return function(_0x5933ff){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x246827,_0x1818bb,util['inspect'](_0x5933ff,{'showHidden':![],'depth':null}));delete _0x5933ff[_0x44eb('0x5')];_0x1af09a[_0x44eb('0x6')](_0x1818bb)['send'](_0x5933ff);};}exports[_0x44eb('0x7')]=function(_0x5c7233,_0x4d473a){return info[_0x44eb('0x8')]()[_0x44eb('0x9')](function(_0x233c6d){return _0x4d473a[_0x44eb('0x6')](0xc8)[_0x44eb('0xa')](_0x233c6d);})['catch'](function(_0x3f2eaf){return _0x4d473a[_0x44eb('0x6')](0x1f4)['json'](_0x3f2eaf);});};exports[_0x44eb('0xb')]=function(_0x29d295,_0x2f327c){var _0x312d78=[_0x44eb('0xc')];return new BPromise(function(_0x2dc3ae,_0x276ea8){return exec(util[_0x44eb('0xd')](_0x44eb('0xe'),_0x29d295[_0x44eb('0xf')]['pid']),function(_0x4c9358,_0x57986a,_0x4b1203){if(_0x4c9358){return _0x276ea8(_0x4c9358);}return _0x2dc3ae(_0x57986a);});})[_0x44eb('0x9')](function(_0x380ad3){var _0x294516=![];var _0x1edf71=_0x380ad3[_0x44eb('0x10')](/\n/);for(var _0x2cdc5e=0x0,_0x40bdb1=_0x312d78[_0x44eb('0x11')];_0x2cdc5e<_0x40bdb1,_0x294516===![];_0x2cdc5e+=0x1){if(_0x380ad3[_0x44eb('0x12')](_0x312d78[_0x2cdc5e])>=0x0){_0x294516=!![];}}if(!_0x294516){throw new Error(util['format'](_0x44eb('0x13'),_0x29d295[_0x44eb('0xf')][_0x44eb('0x14')]));}process[_0x44eb('0x15')](_0x29d295[_0x44eb('0xf')][_0x44eb('0x14')],_0x44eb('0x16'));return _0x2f327c[_0x44eb('0x6')](0xc8)[_0x44eb('0xa')]({'message':util['format'](_0x44eb('0x17'),_0x29d295[_0x44eb('0xf')][_0x44eb('0x14')])});})[_0x44eb('0x18')](handleError(_0x2f327c,null,_0x44eb('0xb')));}; \ No newline at end of file +var _0x535d=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','catch','json','killProcess','components/import/cm','format','pid','split','length','indexOf','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash'];(function(_0x295b61,_0x808c6c){var _0x1f9558=function(_0x48a496){while(--_0x48a496){_0x295b61['push'](_0x295b61['shift']());}};_0x1f9558(++_0x808c6c);}(_0x535d,0xd1));var _0xd535=function(_0x48534e,_0x54ebb0){_0x48534e=_0x48534e-0x0;var _0x26f36c=_0x535d[_0x48534e];return _0x26f36c;};'use strict';var info=require(_0xd535('0x0'));var exec=require(_0xd535('0x1'))['exec'];var logger=require(_0xd535('0x2'))(_0xd535('0x3'));var util=require(_0xd535('0x4'));var BPromise=require(_0xd535('0x5'));var _=require(_0xd535('0x6'));function handleError(_0x1c3c6c,_0x40a4e0,_0x1be627){_0x40a4e0=_0x40a4e0||0x1f4;return function(_0x56c917){logger[_0xd535('0x7')](_0xd535('0x8'),_0x1be627,_0x40a4e0,util[_0xd535('0x9')](_0x56c917,{'showHidden':![],'depth':null}));delete _0x56c917[_0xd535('0xa')];_0x1c3c6c[_0xd535('0xb')](_0x40a4e0)[_0xd535('0xc')](_0x56c917);};}exports[_0xd535('0xd')]=function(_0x46745b,_0x462503){return info[_0xd535('0xe')]()['then'](function(_0x278a71){return _0x462503[_0xd535('0xb')](0xc8)['json'](_0x278a71);})[_0xd535('0xf')](function(_0x376f91){return _0x462503[_0xd535('0xb')](0x1f4)[_0xd535('0x10')](_0x376f91);});};exports[_0xd535('0x11')]=function(_0x5b9fb5,_0x2330f1){var _0x4b1751=[_0xd535('0x12')];return new BPromise(function(_0x500b4d,_0x574bd0){return exec(util[_0xd535('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5b9fb5['params'][_0xd535('0x14')]),function(_0x13b05e,_0xe5451d,_0x506d54){if(_0x13b05e){return _0x574bd0(_0x13b05e);}return _0x500b4d(_0xe5451d);});})['then'](function(_0x5c2b8d){var _0x3e424f=![];var _0x503cd3=_0x5c2b8d[_0xd535('0x15')](/\n/);for(var _0x50bf65=0x0,_0x42f9d5=_0x4b1751[_0xd535('0x16')];_0x50bf65<_0x42f9d5,_0x3e424f===![];_0x50bf65+=0x1){if(_0x5c2b8d[_0xd535('0x17')](_0x4b1751[_0x50bf65])>=0x0){_0x3e424f=!![];}}if(!_0x3e424f){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5b9fb5[_0xd535('0x18')][_0xd535('0x14')]));}process['kill'](_0x5b9fb5[_0xd535('0x18')][_0xd535('0x14')],_0xd535('0x19'));return _0x2330f1[_0xd535('0xb')](0xc8)[_0xd535('0x10')]({'message':util[_0xd535('0x13')](_0xd535('0x1a'),_0x5b9fb5[_0xd535('0x18')]['pid'])});})[_0xd535('0xf')](handleError(_0x2330f1,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a6280ea..a14e16b 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 _0x0118=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0xb555d4,_0x40adae){var _0x120aeb=function(_0x2d1b9a){while(--_0x2d1b9a){_0xb555d4['push'](_0xb555d4['shift']());}};_0x120aeb(++_0x40adae);}(_0x0118,0x131));var _0x8011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0118[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8011('0x0'));var util=require(_0x8011('0x1'));var path=require(_0x8011('0x2'));var timeout=require(_0x8011('0x3'));var express=require(_0x8011('0x4'));var router=express[_0x8011('0x5')]();var fs_extra=require(_0x8011('0x6'));var auth=require(_0x8011('0x7'));var interaction=require(_0x8011('0x8'));var config=require(_0x8011('0x9'));var controller=require(_0x8011('0xa'));router['get']('/',auth[_0x8011('0xb')](),controller[_0x8011('0xc')]);router[_0x8011('0xd')](_0x8011('0xe'),auth['isAuthenticated'](),controller[_0x8011('0xf')]);router[_0x8011('0x10')]('/',auth['isAuthenticated'](),controller[_0x8011('0x11')]);router[_0x8011('0x12')](_0x8011('0xe'),auth[_0x8011('0xb')](),controller[_0x8011('0x13')]);router[_0x8011('0x14')](_0x8011('0xe'),auth[_0x8011('0xb')](),controller[_0x8011('0x15')]);module[_0x8011('0x16')]=router; \ No newline at end of file +var _0xfb9f=['isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0xfb9f,0x187));var _0xffb9=function(_0x31bbb9,_0x7ef4a1){_0x31bbb9=_0x31bbb9-0x0;var _0x5de833=_0xfb9f[_0x31bbb9];return _0x5de833;};'use strict';var multer=require('multer');var util=require(_0xffb9('0x0'));var path=require(_0xffb9('0x1'));var timeout=require(_0xffb9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xffb9('0x3'));var auth=require(_0xffb9('0x4'));var interaction=require(_0xffb9('0x5'));var config=require('../../config/environment');var controller=require(_0xffb9('0x6'));router[_0xffb9('0x7')]('/',auth[_0xffb9('0x8')](),controller[_0xffb9('0x9')]);router['get']('/:id',auth[_0xffb9('0x8')](),controller[_0xffb9('0xa')]);router[_0xffb9('0xb')]('/',auth[_0xffb9('0x8')](),controller[_0xffb9('0xc')]);router[_0xffb9('0xd')](_0xffb9('0xe'),auth['isAuthenticated'](),controller[_0xffb9('0xf')]);router[_0xffb9('0x10')](_0xffb9('0xe'),auth[_0xffb9('0x8')](),controller[_0xffb9('0x11')]);module[_0xffb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 700a765..6157f1c 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 _0xcae2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x50b0ec,_0x34ec2c){var _0x319f28=function(_0x272fbb){while(--_0x272fbb){_0x50b0ec['push'](_0x50b0ec['shift']());}};_0x319f28(++_0x34ec2c);}(_0xcae2,0x143));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2cae('0x0'));module[_0x2cae('0x1')]={'name':{'type':Sequelize[_0x2cae('0x2')],'unique':_0x2cae('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2cae('0x2')],'defaultValue':_0x2cae('0x4')},'description':{'type':Sequelize[_0x2cae('0x2')]}}; \ No newline at end of file +var _0x0a48=['exports','name','STRING','#0091EA','sequelize'];(function(_0x5b05de,_0x441400){var _0x1dbd07=function(_0x2ebed2){while(--_0x2ebed2){_0x5b05de['push'](_0x5b05de['shift']());}};_0x1dbd07(++_0x441400);}(_0x0a48,0x95));var _0x80a4=function(_0xca5c4e,_0x55cce8){_0xca5c4e=_0xca5c4e-0x0;var _0x1520ba=_0x0a48[_0xca5c4e];return _0x1520ba;};'use strict';var Sequelize=require(_0x80a4('0x0'));module[_0x80a4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x80a4('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x80a4('0x3')],'defaultValue':_0x80a4('0x4')},'description':{'type':Sequelize[_0x80a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 523f5b0..06f0f6c 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 _0x684c=['includeAll','rows','params','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','Tags','UserProfileResource','then','error','name','send','index','map','Tag','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options'];(function(_0x4a1a6,_0x35bc33){var _0x4ce12a=function(_0x28605b){while(--_0x28605b){_0x4a1a6['push'](_0x4a1a6['shift']());}};_0x4ce12a(++_0x35bc33);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc684('0x0'));var rimraf=require(_0xc684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc684('0x2'));var rp=require(_0xc684('0x3'));var moment=require(_0xc684('0x4'));var BPromise=require(_0xc684('0x5'));var Mustache=require(_0xc684('0x6'));var util=require('util');var path=require(_0xc684('0x7'));var sox=require(_0xc684('0x8'));var csv=require(_0xc684('0x9'));var ejs=require(_0xc684('0xa'));var fs=require('fs');var fs_extra=require(_0xc684('0xb'));var _=require(_0xc684('0xc'));var squel=require(_0xc684('0xd'));var crypto=require(_0xc684('0xe'));var jsforce=require(_0xc684('0xf'));var deskjs=require(_0xc684('0x10'));var toCsv=require(_0xc684('0x9'));var querystring=require(_0xc684('0x11'));var Papa=require(_0xc684('0x12'));var Redis=require(_0xc684('0x13'));var authService=require(_0xc684('0x14'));var qs=require(_0xc684('0x15'));var as=require(_0xc684('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc684('0x17'))(_0xc684('0x18'));var utils=require(_0xc684('0x19'));var config=require(_0xc684('0x1a'));var licenseUtil=require(_0xc684('0x1b'));var db=require(_0xc684('0x1c'))['db'];function respondWithStatusCode(_0x4f3ff9,_0x3004a6){_0x3004a6=_0x3004a6||0xcc;return function(_0x10cc25){if(_0x10cc25){return _0x4f3ff9['sendStatus'](_0x3004a6);}return _0x4f3ff9['status'](_0x3004a6)[_0xc684('0x1d')]();};}function respondWithResult(_0x34cfd7,_0x32d5da){_0x32d5da=_0x32d5da||0xc8;return function(_0x2ad4f1){if(_0x2ad4f1){return _0x34cfd7[_0xc684('0x1e')](_0x32d5da)[_0xc684('0x1f')](_0x2ad4f1);}};}function respondWithFilteredResult(_0x4f26f7,_0x56d76f){return function(_0x43235d){if(_0x43235d){var _0x599c93=typeof _0x56d76f['offset']==='undefined'&&typeof _0x56d76f['limit']==='undefined';var _0x264cb5=_0x43235d[_0xc684('0x20')];var _0x3b6f5e=_0x599c93?0x0:_0x56d76f[_0xc684('0x21')];var _0x1c3af5=_0x599c93?_0x43235d['count']:_0x56d76f[_0xc684('0x21')]+_0x56d76f[_0xc684('0x22')];var _0x4afdd0;if(_0x1c3af5>=_0x264cb5){_0x1c3af5=_0x264cb5;_0x4afdd0=0xc8;}else{_0x4afdd0=0xce;}_0x4f26f7[_0xc684('0x1e')](_0x4afdd0);return _0x4f26f7[_0xc684('0x23')](_0xc684('0x24'),_0x3b6f5e+'-'+_0x1c3af5+'/'+_0x264cb5)['json'](_0x43235d);}return null;};}function patchUpdates(_0x62c4e5){return function(_0x11a159){try{jsonpatch[_0xc684('0x25')](_0x11a159,_0x62c4e5,!![]);}catch(_0xe7aadb){return BPromise[_0xc684('0x26')](_0xe7aadb);}return _0x11a159['save']();};}function saveUpdates(_0x13d43f,_0x39f39a){return function(_0x1fb8b0){if(_0x1fb8b0){return _0x1fb8b0['update'](_0x13d43f)['then'](function(_0x5a7b2e){return _0x5a7b2e;});}return null;};}function removeEntity(_0x41162b,_0x15ce5d){return function(_0xd2a943){if(_0xd2a943){return _0xd2a943['destroy']()['then'](function(){var _0x4e68e0=_0xd2a943['get']({'plain':!![]});var _0x27c7cc=_0xc684('0x27');return db[_0xc684('0x28')]['destroy']({'where':{'type':_0x27c7cc,'resourceId':_0x4e68e0['id']}})[_0xc684('0x29')](function(){return _0xd2a943;});})['then'](function(){_0x41162b[_0xc684('0x1e')](0xcc)[_0xc684('0x1d')]();});}};}function handleEntityNotFound(_0x13e09d,_0x49dad1){return function(_0x1f8e85){if(!_0x1f8e85){_0x13e09d['sendStatus'](0x194);}return _0x1f8e85;};}function handleError(_0x279998,_0x640ca1){_0x640ca1=_0x640ca1||0x1f4;return function(_0x210dcd){logger[_0xc684('0x2a')](_0x210dcd['stack']);if(_0x210dcd[_0xc684('0x2b')]){delete _0x210dcd[_0xc684('0x2b')];}_0x279998[_0xc684('0x1e')](_0x640ca1)[_0xc684('0x2c')](_0x210dcd);};}exports[_0xc684('0x2d')]=function(_0x1e029c,_0x10db0d){var _0x3abd2d={},_0x4df4d4={},_0x5c47ab={'count':0x0,'rows':[]};var _0x4e1d09=_[_0xc684('0x2e')](db[_0xc684('0x2f')]['rawAttributes'],function(_0x4e46c2){return{'name':_0x4e46c2[_0xc684('0x30')],'type':_0x4e46c2['type'][_0xc684('0x31')]};});_0x4df4d4[_0xc684('0x32')]=_[_0xc684('0x2e')](_0x4e1d09,'name');_0x4df4d4['query']=_[_0xc684('0x33')](_0x1e029c[_0xc684('0x34')]);_0x4df4d4['filters']=_['intersection'](_0x4df4d4[_0xc684('0x32')],_0x4df4d4[_0xc684('0x34')]);_0x3abd2d[_0xc684('0x35')]=_[_0xc684('0x36')](_0x4df4d4[_0xc684('0x32')],qs[_0xc684('0x37')](_0x1e029c['query'][_0xc684('0x37')]));_0x3abd2d['attributes']=_0x3abd2d['attributes'][_0xc684('0x38')]?_0x3abd2d[_0xc684('0x35')]:_0x4df4d4['model'];if(!_0x1e029c['query'][_0xc684('0x39')](_0xc684('0x3a'))){_0x3abd2d[_0xc684('0x22')]=qs[_0xc684('0x22')](_0x1e029c[_0xc684('0x34')]['limit']);_0x3abd2d[_0xc684('0x21')]=qs[_0xc684('0x21')](_0x1e029c['query']['offset']);}_0x3abd2d[_0xc684('0x3b')]=qs[_0xc684('0x3c')](_0x1e029c[_0xc684('0x34')][_0xc684('0x3c')]);_0x3abd2d[_0xc684('0x3d')]=qs[_0xc684('0x3e')](_[_0xc684('0x3f')](_0x1e029c['query'],_0x4df4d4['filters']),_0x4e1d09);if(_0x1e029c[_0xc684('0x34')][_0xc684('0x40')]){_0x3abd2d['where']=_['merge'](_0x3abd2d['where'],{'$or':_[_0xc684('0x2e')](_0x4e1d09,function(_0x4a9320){if(_0x4a9320[_0xc684('0x41')]!==_0xc684('0x42')){var _0x2649ee={};_0x2649ee[_0x4a9320['name']]={'$like':'%'+_0x1e029c[_0xc684('0x34')]['filter']+'%'};return _0x2649ee;}})});}_0x3abd2d=_[_0xc684('0x43')]({},_0x3abd2d,_0x1e029c[_0xc684('0x44')]);var _0x380e7c={'where':_0x3abd2d[_0xc684('0x3d')]};return db['Tag'][_0xc684('0x20')](_0x380e7c)[_0xc684('0x29')](function(_0xd9eae7){_0x5c47ab[_0xc684('0x20')]=_0xd9eae7;if(_0x1e029c[_0xc684('0x34')][_0xc684('0x45')]){_0x3abd2d['include']=[{'all':!![]}];}return db[_0xc684('0x2f')]['findAll'](_0x3abd2d);})['then'](function(_0x46c6ad){_0x5c47ab[_0xc684('0x46')]=_0x46c6ad;return _0x5c47ab;})[_0xc684('0x29')](respondWithFilteredResult(_0x10db0d,_0x3abd2d))['catch'](handleError(_0x10db0d,null));};exports['show']=function(_0x4f288b,_0x4ebd3e){var _0x4d0586={'raw':!![],'where':{'id':_0x4f288b[_0xc684('0x47')]['id']}},_0x189b26={};_0x189b26[_0xc684('0x32')]=_['keys'](db[_0xc684('0x2f')]['rawAttributes']);_0x189b26[_0xc684('0x34')]=_['keys'](_0x4f288b[_0xc684('0x34')]);_0x189b26[_0xc684('0x3e')]=_[_0xc684('0x36')](_0x189b26[_0xc684('0x32')],_0x189b26[_0xc684('0x34')]);_0x4d0586['attributes']=_[_0xc684('0x36')](_0x189b26[_0xc684('0x32')],qs[_0xc684('0x37')](_0x4f288b[_0xc684('0x34')][_0xc684('0x37')]));_0x4d0586[_0xc684('0x35')]=_0x4d0586[_0xc684('0x35')][_0xc684('0x38')]?_0x4d0586[_0xc684('0x35')]:_0x189b26['model'];if(_0x4f288b[_0xc684('0x34')][_0xc684('0x45')]){_0x4d0586['include']=[{'all':!![]}];}_0x4d0586=_[_0xc684('0x43')]({},_0x4d0586,_0x4f288b['options']);return db[_0xc684('0x2f')]['find'](_0x4d0586)[_0xc684('0x29')](handleEntityNotFound(_0x4ebd3e,null))[_0xc684('0x29')](respondWithResult(_0x4ebd3e,null))[_0xc684('0x48')](handleError(_0x4ebd3e,null));};exports[_0xc684('0x49')]=function(_0x1bfd8d,_0x1fde57){return db[_0xc684('0x2f')][_0xc684('0x49')](_0x1bfd8d[_0xc684('0x4a')],{})[_0xc684('0x29')](function(_0x4abd04){var _0x16951f=_0x1bfd8d[_0xc684('0x4b')]['get']({'plain':!![]});if(!_0x16951f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16951f['role']===_0xc684('0x4b')){var _0x1304a2=_0x4abd04[_0xc684('0x4c')]({'plain':!![]});var _0x34b2cd=_0xc684('0x27');return db[_0xc684('0x4d')]['find']({'where':{'name':_0x34b2cd,'userProfileId':_0x16951f[_0xc684('0x4e')]},'raw':!![]})[_0xc684('0x29')](function(_0x16f039){if(_0x16f039&&_0x16f039[_0xc684('0x4f')]===0x0){return db[_0xc684('0x28')]['create']({'name':_0x1304a2[_0xc684('0x2b')],'resourceId':_0x1304a2['id'],'type':_0x16f039[_0xc684('0x2b')],'sectionId':_0x16f039['id']},{})['then'](function(){return _0x4abd04;});}else{return _0x4abd04;}})[_0xc684('0x48')](function(_0x7af88c){logger[_0xc684('0x2a')](_0xc684('0x50'),_0x7af88c);throw _0x7af88c;});}return _0x4abd04;})[_0xc684('0x29')](respondWithResult(_0x1fde57,0xc9))['catch'](handleError(_0x1fde57,null));};exports[_0xc684('0x51')]=function(_0x4d3484,_0x3c6f05){if(_0x4d3484[_0xc684('0x4a')]['id']){delete _0x4d3484[_0xc684('0x4a')]['id'];}return db[_0xc684('0x2f')][_0xc684('0x52')]({'where':{'id':_0x4d3484[_0xc684('0x47')]['id']}})[_0xc684('0x29')](handleEntityNotFound(_0x3c6f05,null))[_0xc684('0x29')](saveUpdates(_0x4d3484[_0xc684('0x4a')],null))['then'](respondWithResult(_0x3c6f05,null))['catch'](handleError(_0x3c6f05,null));};exports[_0xc684('0x53')]=function(_0x49218e,_0x2b2d54){return db['Tag']['find']({'where':{'id':_0x49218e[_0xc684('0x47')]['id']}})[_0xc684('0x29')](handleEntityNotFound(_0x2b2d54,null))[_0xc684('0x29')](removeEntity(_0x2b2d54,null))[_0xc684('0x48')](handleError(_0x2b2d54,null));}; \ No newline at end of file +var _0x8b29=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','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/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','Tags','UserProfileResource','sendStatus','error','stack','name','index','map','Tag','rawAttributes','type','key','model','query','filters','intersection','attributes'];(function(_0xb18875,_0x1b3b8e){var _0x278ae1=function(_0x1e6e11){while(--_0x1e6e11){_0xb18875['push'](_0xb18875['shift']());}};_0x278ae1(++_0x1b3b8e);}(_0x8b29,0xbe));var _0x98b2=function(_0x45446c,_0x114b1d){_0x45446c=_0x45446c-0x0;var _0xfe5337=_0x8b29[_0x45446c];return _0xfe5337;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){var _0x4c34f1=_0x2a5587['get']({'plain':!![]});var _0x7b6ebc=_0x98b2('0x21');return db[_0x98b2('0x22')]['destroy']({'where':{'type':_0x7b6ebc,'resourceId':_0x4c34f1['id']}})['then'](function(){return _0x2a5587;});})['then'](function(){_0xfae112[_0x98b2('0x1c')](0xcc)[_0x98b2('0x17')]();});}};}function handleEntityNotFound(_0x50aafb,_0xecb32b){return function(_0x28db65){if(!_0x28db65){_0x50aafb[_0x98b2('0x23')](0x194);}return _0x28db65;};}function handleError(_0x56efb6,_0x2e1ea4){_0x2e1ea4=_0x2e1ea4||0x1f4;return function(_0x1dee11){logger[_0x98b2('0x24')](_0x1dee11[_0x98b2('0x25')]);if(_0x1dee11[_0x98b2('0x26')]){delete _0x1dee11['name'];}_0x56efb6[_0x98b2('0x1c')](_0x2e1ea4)['send'](_0x1dee11);};}exports[_0x98b2('0x27')]=function(_0x1aa42a,_0x4d197c){var _0x2f5156={},_0x363174={},_0x526637={'count':0x0,'rows':[]};var _0x1a676e=_[_0x98b2('0x28')](db[_0x98b2('0x29')][_0x98b2('0x2a')],function(_0x4aee2a){return{'name':_0x4aee2a['fieldName'],'type':_0x4aee2a[_0x98b2('0x2b')][_0x98b2('0x2c')]};});_0x363174[_0x98b2('0x2d')]=_[_0x98b2('0x28')](_0x1a676e,_0x98b2('0x26'));_0x363174[_0x98b2('0x2e')]=_['keys'](_0x1aa42a[_0x98b2('0x2e')]);_0x363174[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],_0x363174[_0x98b2('0x2e')]);_0x2f5156[_0x98b2('0x31')]=_[_0x98b2('0x30')](_0x363174[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x2f5156[_0x98b2('0x31')]=_0x2f5156[_0x98b2('0x31')]['length']?_0x2f5156['attributes']:_0x363174[_0x98b2('0x2d')];if(!_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x33')](_0x98b2('0x34'))){_0x2f5156[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1aa42a['query'][_0x98b2('0x18')]);_0x2f5156[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1aa42a[_0x98b2('0x2e')]['offset']);}_0x2f5156[_0x98b2('0x35')]=qs[_0x98b2('0x36')](_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x36')]);_0x2f5156[_0x98b2('0x37')]=qs[_0x98b2('0x2f')](_[_0x98b2('0x38')](_0x1aa42a['query'],_0x363174[_0x98b2('0x2f')]),_0x1a676e);if(_0x1aa42a['query'][_0x98b2('0x39')]){_0x2f5156[_0x98b2('0x37')]=_[_0x98b2('0x3a')](_0x2f5156[_0x98b2('0x37')],{'$or':_['map'](_0x1a676e,function(_0x5aa34b){if(_0x5aa34b[_0x98b2('0x2b')]!==_0x98b2('0x3b')){var _0x42c69c={};_0x42c69c[_0x5aa34b['name']]={'$like':'%'+_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x39')]+'%'};return _0x42c69c;}})});}_0x2f5156=_[_0x98b2('0x3a')]({},_0x2f5156,_0x1aa42a[_0x98b2('0x3c')]);var _0x311fa7={'where':_0x2f5156[_0x98b2('0x37')]};return db['Tag'][_0x98b2('0x1a')](_0x311fa7)[_0x98b2('0x20')](function(_0x197749){_0x526637['count']=_0x197749;if(_0x1aa42a[_0x98b2('0x2e')][_0x98b2('0x3d')]){_0x2f5156[_0x98b2('0x3e')]=[{'all':!![]}];}return db[_0x98b2('0x29')][_0x98b2('0x3f')](_0x2f5156);})[_0x98b2('0x20')](function(_0x4a6c03){_0x526637[_0x98b2('0x40')]=_0x4a6c03;return _0x526637;})['then'](respondWithFilteredResult(_0x4d197c,_0x2f5156))[_0x98b2('0x41')](handleError(_0x4d197c,null));};exports[_0x98b2('0x42')]=function(_0x410094,_0x1d262d){var _0x44d858={'raw':!![],'where':{'id':_0x410094[_0x98b2('0x43')]['id']}},_0x32e14b={};_0x32e14b[_0x98b2('0x2d')]=_[_0x98b2('0x44')](db['Tag'][_0x98b2('0x2a')]);_0x32e14b['query']=_[_0x98b2('0x44')](_0x410094[_0x98b2('0x2e')]);_0x32e14b[_0x98b2('0x2f')]=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],_0x32e14b[_0x98b2('0x2e')]);_0x44d858['attributes']=_[_0x98b2('0x30')](_0x32e14b[_0x98b2('0x2d')],qs[_0x98b2('0x32')](_0x410094[_0x98b2('0x2e')][_0x98b2('0x32')]));_0x44d858['attributes']=_0x44d858['attributes'][_0x98b2('0x45')]?_0x44d858[_0x98b2('0x31')]:_0x32e14b[_0x98b2('0x2d')];if(_0x410094[_0x98b2('0x2e')]['includeAll']){_0x44d858['include']=[{'all':!![]}];}_0x44d858=_['merge']({},_0x44d858,_0x410094[_0x98b2('0x3c')]);return db[_0x98b2('0x29')][_0x98b2('0x46')](_0x44d858)[_0x98b2('0x20')](handleEntityNotFound(_0x1d262d,null))[_0x98b2('0x20')](respondWithResult(_0x1d262d,null))[_0x98b2('0x41')](handleError(_0x1d262d,null));};exports[_0x98b2('0x47')]=function(_0x2b08ed,_0x3c2477){return db['Tag'][_0x98b2('0x47')](_0x2b08ed['body'],{})[_0x98b2('0x20')](function(_0x6369ca){var _0x3c3c64=_0x2b08ed[_0x98b2('0x48')]['get']({'plain':!![]});if(!_0x3c3c64)throw new Error(_0x98b2('0x49'));if(_0x3c3c64[_0x98b2('0x4a')]===_0x98b2('0x48')){var _0x1e13b8=_0x6369ca[_0x98b2('0x4b')]({'plain':!![]});var _0x54f7ba=_0x98b2('0x21');return db[_0x98b2('0x4c')][_0x98b2('0x46')]({'where':{'name':_0x54f7ba,'userProfileId':_0x3c3c64[_0x98b2('0x4d')]},'raw':!![]})[_0x98b2('0x20')](function(_0x3d6a4e){if(_0x3d6a4e&&_0x3d6a4e[_0x98b2('0x4e')]===0x0){return db[_0x98b2('0x22')][_0x98b2('0x47')]({'name':_0x1e13b8[_0x98b2('0x26')],'resourceId':_0x1e13b8['id'],'type':_0x3d6a4e[_0x98b2('0x26')],'sectionId':_0x3d6a4e['id']},{})[_0x98b2('0x20')](function(){return _0x6369ca;});}else{return _0x6369ca;}})['catch'](function(_0x3b083a){logger[_0x98b2('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b083a);throw _0x3b083a;});}return _0x6369ca;})['then'](respondWithResult(_0x3c2477,0xc9))[_0x98b2('0x41')](handleError(_0x3c2477,null));};exports['update']=function(_0x20ddfd,_0x1cad33){if(_0x20ddfd[_0x98b2('0x4f')]['id']){delete _0x20ddfd[_0x98b2('0x4f')]['id'];}return db[_0x98b2('0x29')][_0x98b2('0x46')]({'where':{'id':_0x20ddfd['params']['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1cad33,null))['then'](saveUpdates(_0x20ddfd['body'],null))[_0x98b2('0x20')](respondWithResult(_0x1cad33,null))[_0x98b2('0x41')](handleError(_0x1cad33,null));};exports['destroy']=function(_0x12a72e,_0x1253e2){return db['Tag'][_0x98b2('0x46')]({'where':{'id':_0x12a72e[_0x98b2('0x43')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x1253e2,null))[_0x98b2('0x20')](removeEntity(_0x1253e2,null))['catch'](handleError(_0x1253e2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 6a4e6bc..b187037 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 _0x3be5=['./tag.attributes','exports','define','tools_tags','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4951d5,_0x2cba80){var _0x4a9c17=function(_0xddb9be){while(--_0xddb9be){_0x4951d5['push'](_0x4951d5['shift']());}};_0x4a9c17(++_0x2cba80);}(_0x3be5,0xd5));var _0x53be=function(_0x54cf26,_0x3d680e){_0x54cf26=_0x54cf26-0x0;var _0x164287=_0x3be5[_0x54cf26];return _0x164287;};'use strict';var _=require('lodash');var util=require(_0x53be('0x0'));var logger=require('../../config/logger')(_0x53be('0x1'));var moment=require(_0x53be('0x2'));var BPromise=require(_0x53be('0x3'));var rp=require(_0x53be('0x4'));var fs=require('fs');var path=require(_0x53be('0x5'));var rimraf=require('rimraf');var config=require(_0x53be('0x6'));var attributes=require(_0x53be('0x7'));module[_0x53be('0x8')]=function(_0x5a75f3,_0x3e0b21){return _0x5a75f3[_0x53be('0x9')]('Tag',attributes,{'tableName':_0x53be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd261=['Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','./tag.attributes','define'];(function(_0x2f610e,_0x510ce7){var _0x62fa9f=function(_0x30c4d1){while(--_0x30c4d1){_0x2f610e['push'](_0x2f610e['shift']());}};_0x62fa9f(++_0x510ce7);}(_0xd261,0x86));var _0x1d26=function(_0x138d18,_0x7a67b9){_0x138d18=_0x138d18-0x0;var _0x51bf13=_0xd261[_0x138d18];return _0x51bf13;};'use strict';var _=require(_0x1d26('0x0'));var util=require(_0x1d26('0x1'));var logger=require(_0x1d26('0x2'))(_0x1d26('0x3'));var moment=require('moment');var BPromise=require(_0x1d26('0x4'));var rp=require(_0x1d26('0x5'));var fs=require('fs');var path=require(_0x1d26('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d26('0x7'));module['exports']=function(_0x40278c,_0x93031d){return _0x40278c[_0x1d26('0x8')](_0x1d26('0x9'),attributes,{'tableName':_0x1d26('0xa'),'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 c4e9254..d0b8106 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 _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xdc611,_0x29c00f){var _0x386daf=function(_0x57e9a2){while(--_0x57e9a2){_0xdc611['push'](_0xdc611['shift']());}};_0x386daf(++_0x29c00f);}(_0x0624,0x132));var _0x4062=function(_0x7afd6a,_0x572bf4){_0x7afd6a=_0x7afd6a-0x0;var _0x3fe40d=_0x0624[_0x7afd6a];return _0x3fe40d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});} \ No newline at end of file +var _0xed95=['info','Tag,\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','request'];(function(_0x4f5cbc,_0x689e6){var _0x5a7ca6=function(_0x1b204f){while(--_0x1b204f){_0x4f5cbc['push'](_0x4f5cbc['shift']());}};_0x5a7ca6(++_0x689e6);}(_0xed95,0xb9));var _0x5ed9=function(_0x561570,_0xfe60f1){_0x561570=_0x561570-0x0;var _0x5b26e6=_0xed95[_0x561570];return _0x5b26e6;};'use strict';var _=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var moment=require(_0x5ed9('0x2'));var BPromise=require(_0x5ed9('0x3'));var rs=require(_0x5ed9('0x4'));var fs=require('fs');var Redis=require(_0x5ed9('0x5'));var db=require(_0x5ed9('0x6'))['db'];var utils=require(_0x5ed9('0x7'));var logger=require(_0x5ed9('0x8'))(_0x5ed9('0x9'));var config=require(_0x5ed9('0xa'));var jayson=require(_0x5ed9('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2612a8,_0x217c71,_0x2fe2dd){return new BPromise(function(_0x34688d,_0x2d5474){return client[_0x5ed9('0xc')](_0x2612a8,_0x2fe2dd)['then'](function(_0x487047){logger[_0x5ed9('0xd')](_0x5ed9('0xe'),_0x217c71,_0x5ed9('0xf'));logger[_0x5ed9('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x217c71,'request\x20sent',JSON[_0x5ed9('0x11')](_0x487047));if(_0x487047[_0x5ed9('0x12')]){if(_0x487047[_0x5ed9('0x12')][_0x5ed9('0x13')]===0x1f4){logger['error'](_0x5ed9('0xe'),_0x217c71,_0x487047[_0x5ed9('0x12')][_0x5ed9('0x14')]);return _0x2d5474(_0x487047['error']['message']);}logger[_0x5ed9('0x12')](_0x5ed9('0xe'),_0x217c71,_0x487047['error'][_0x5ed9('0x14')]);return _0x34688d(_0x487047[_0x5ed9('0x12')]['message']);}else{logger['info'](_0x5ed9('0xe'),_0x217c71,_0x5ed9('0xf'));_0x34688d(_0x487047['result'][_0x5ed9('0x14')]);}})[_0x5ed9('0x15')](function(_0x50b9e8){logger[_0x5ed9('0x12')](_0x5ed9('0xe'),_0x217c71,_0x50b9e8);_0x2d5474(_0x50b9e8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7671817..89128e9 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 3b9313c..7d6b473 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x4f92c5,_0x56d762){var _0x217123=function(_0x185087){while(--_0x185087){_0x4f92c5['push'](_0x4f92c5['shift']());}};_0x217123(++_0x56d762);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x416bc5,_0x471249){var _0x1546d2=function(_0x1c2bec){while(--_0x1c2bec){_0x416bc5['push'](_0x416bc5['shift']());}};_0x1546d2(++_0x471249);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 367ceb9..62d3019 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 _0xe581=['Whatsapp','penalty','QueueId','defaults','User','findOrCreate','user','findAll','online','voicePause','interface','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','UserVoicePrefix','upsert','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','zip-dir','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','catch','show','params','rawAttributes','keys','find','body','get','Teams','UserProfileSection','autoAssociation','UserProfileResource','create','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel'];(function(_0x22d22d,_0x49ccd2){var _0x537c33=function(_0x4b89a2){while(--_0x4b89a2){_0x22d22d['push'](_0x22d22d['shift']());}};_0x537c33(++_0x49ccd2);}(_0xe581,0xab));var _0x1e58=function(_0x1b5b2e,_0x10458c){_0x1b5b2e=_0x1b5b2e-0x0;var _0x426dba=_0xe581[_0x1b5b2e];return _0x426dba;};'use strict';var emlformat=require(_0x1e58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e58('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e58('0x2'));var BPromise=require(_0x1e58('0x3'));var Mustache=require(_0x1e58('0x4'));var util=require('util');var path=require(_0x1e58('0x5'));var sox=require(_0x1e58('0x6'));var csv=require('to-csv');var ejs=require(_0x1e58('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e58('0x8'));var squel=require(_0x1e58('0x9'));var crypto=require(_0x1e58('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e58('0xb'));var toCsv=require(_0x1e58('0xc'));var querystring=require(_0x1e58('0xd'));var Papa=require(_0x1e58('0xe'));var Redis=require(_0x1e58('0xf'));var authService=require(_0x1e58('0x10'));var qs=require(_0x1e58('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e58('0x12'));var logger=require(_0x1e58('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1e58('0x14'));var licenseUtil=require(_0x1e58('0x15'));var db=require(_0x1e58('0x16'))['db'];config[_0x1e58('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e58('0x17')]));require('./team.socket')[_0x1e58('0x18')](socket);function respondWithStatusCode(_0x149691,_0x387140){_0x387140=_0x387140||0xcc;return function(_0xb28e6f){if(_0xb28e6f){return _0x149691[_0x1e58('0x19')](_0x387140);}return _0x149691[_0x1e58('0x1a')](_0x387140)[_0x1e58('0x1b')]();};}function respondWithResult(_0x43f90e,_0x2a33a8){_0x2a33a8=_0x2a33a8||0xc8;return function(_0x26c1e3){if(_0x26c1e3){return _0x43f90e['status'](_0x2a33a8)[_0x1e58('0x1c')](_0x26c1e3);}};}function respondWithFilteredResult(_0x23bb5e,_0x4e44cf){return function(_0x502dab){if(_0x502dab){var _0x3edf02=typeof _0x4e44cf[_0x1e58('0x1d')]===_0x1e58('0x1e')&&typeof _0x4e44cf[_0x1e58('0x1f')]==='undefined';var _0x428265=_0x502dab['count'];var _0x4698e9=_0x3edf02?0x0:_0x4e44cf[_0x1e58('0x1d')];var _0xe39c9e=_0x3edf02?_0x502dab[_0x1e58('0x20')]:_0x4e44cf[_0x1e58('0x1d')]+_0x4e44cf[_0x1e58('0x1f')];var _0x120d25;if(_0xe39c9e>=_0x428265){_0xe39c9e=_0x428265;_0x120d25=0xc8;}else{_0x120d25=0xce;}_0x23bb5e['status'](_0x120d25);return _0x23bb5e[_0x1e58('0x21')](_0x1e58('0x22'),_0x4698e9+'-'+_0xe39c9e+'/'+_0x428265)[_0x1e58('0x1c')](_0x502dab);}return null;};}function patchUpdates(_0x4c0f30){return function(_0x378fa){try{jsonpatch[_0x1e58('0x23')](_0x378fa,_0x4c0f30,!![]);}catch(_0x19b4c0){return BPromise['reject'](_0x19b4c0);}return _0x378fa[_0x1e58('0x24')]();};}function saveUpdates(_0x372394,_0x2c61d7){return function(_0x168d6a){if(_0x168d6a){return _0x168d6a['update'](_0x372394)[_0x1e58('0x25')](function(_0x572f1b){return _0x572f1b;});}return null;};}function handleEntityNotFound(_0x46d5a7,_0x130d6b){return function(_0x4854d7){if(!_0x4854d7){_0x46d5a7[_0x1e58('0x19')](0x194);}return _0x4854d7;};}function handleError(_0x35d236,_0x19cbbd){_0x19cbbd=_0x19cbbd||0x1f4;return function(_0x3e3e65){logger[_0x1e58('0x26')](_0x3e3e65['stack']);if(_0x3e3e65[_0x1e58('0x27')]){delete _0x3e3e65[_0x1e58('0x27')];}_0x35d236[_0x1e58('0x1a')](_0x19cbbd)[_0x1e58('0x28')](_0x3e3e65);};}exports[_0x1e58('0x29')]=function(_0x12fcb2,_0x222d68){var _0x49bfaf={},_0x3281ac={},_0x13896c={'count':0x0,'rows':[]};var _0x40cb58=_[_0x1e58('0x2a')](db['Team']['rawAttributes'],function(_0x122eb7){return{'name':_0x122eb7[_0x1e58('0x2b')],'type':_0x122eb7[_0x1e58('0x2c')][_0x1e58('0x2d')]};});_0x3281ac[_0x1e58('0x2e')]=_['map'](_0x40cb58,_0x1e58('0x27'));_0x3281ac[_0x1e58('0x2f')]=_['keys'](_0x12fcb2[_0x1e58('0x2f')]);_0x3281ac['filters']=_[_0x1e58('0x30')](_0x3281ac['model'],_0x3281ac[_0x1e58('0x2f')]);_0x49bfaf[_0x1e58('0x31')]=_[_0x1e58('0x30')](_0x3281ac['model'],qs[_0x1e58('0x32')](_0x12fcb2[_0x1e58('0x2f')]['fields']));_0x49bfaf[_0x1e58('0x31')]=_0x49bfaf[_0x1e58('0x31')][_0x1e58('0x33')]?_0x49bfaf[_0x1e58('0x31')]:_0x3281ac[_0x1e58('0x2e')];if(!_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x34')](_0x1e58('0x35'))){_0x49bfaf[_0x1e58('0x1f')]=qs[_0x1e58('0x1f')](_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x1f')]);_0x49bfaf[_0x1e58('0x1d')]=qs[_0x1e58('0x1d')](_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x1d')]);}_0x49bfaf[_0x1e58('0x36')]=qs[_0x1e58('0x37')](_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x37')]);_0x49bfaf[_0x1e58('0x38')]=qs[_0x1e58('0x39')](_[_0x1e58('0x3a')](_0x12fcb2[_0x1e58('0x2f')],_0x3281ac[_0x1e58('0x39')]),_0x40cb58);if(_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x3b')]){_0x49bfaf['where']=_[_0x1e58('0x3c')](_0x49bfaf[_0x1e58('0x38')],{'$or':_[_0x1e58('0x2a')](_0x40cb58,function(_0xed3112){if(_0xed3112[_0x1e58('0x2c')]!==_0x1e58('0x3d')){var _0x24d7d7={};_0x24d7d7[_0xed3112[_0x1e58('0x27')]]={'$like':'%'+_0x12fcb2[_0x1e58('0x2f')]['filter']+'%'};return _0x24d7d7;}})});}_0x49bfaf=_[_0x1e58('0x3c')]({},_0x49bfaf,_0x12fcb2[_0x1e58('0x3e')]);var _0x59c3a0={'where':_0x49bfaf[_0x1e58('0x38')]};return db[_0x1e58('0x3f')][_0x1e58('0x20')](_0x59c3a0)['then'](function(_0xd7712a){_0x13896c[_0x1e58('0x20')]=_0xd7712a;if(_0x12fcb2[_0x1e58('0x2f')][_0x1e58('0x40')]){_0x49bfaf[_0x1e58('0x41')]=[{'all':!![]}];}return db['Team']['findAll'](_0x49bfaf);})['then'](function(_0x2e967c){_0x13896c['rows']=_0x2e967c;return _0x13896c;})[_0x1e58('0x25')](respondWithFilteredResult(_0x222d68,_0x49bfaf))[_0x1e58('0x42')](handleError(_0x222d68,null));};exports[_0x1e58('0x43')]=function(_0x397df2,_0xc8804a){var _0x3f8870={'raw':![],'where':{'id':_0x397df2[_0x1e58('0x44')]['id']}},_0x57a6a9={};_0x57a6a9[_0x1e58('0x2e')]=_['keys'](db['Team'][_0x1e58('0x45')]);_0x57a6a9[_0x1e58('0x2f')]=_[_0x1e58('0x46')](_0x397df2['query']);_0x57a6a9[_0x1e58('0x39')]=_[_0x1e58('0x30')](_0x57a6a9[_0x1e58('0x2e')],_0x57a6a9[_0x1e58('0x2f')]);_0x3f8870[_0x1e58('0x31')]=_[_0x1e58('0x30')](_0x57a6a9[_0x1e58('0x2e')],qs[_0x1e58('0x32')](_0x397df2[_0x1e58('0x2f')][_0x1e58('0x32')]));_0x3f8870['attributes']=_0x3f8870[_0x1e58('0x31')]['length']?_0x3f8870['attributes']:_0x57a6a9[_0x1e58('0x2e')];if(_0x397df2[_0x1e58('0x2f')]['includeAll']){_0x3f8870[_0x1e58('0x41')]=[{'all':!![]}];}_0x3f8870=_[_0x1e58('0x3c')]({},_0x3f8870,_0x397df2[_0x1e58('0x3e')]);return db[_0x1e58('0x3f')][_0x1e58('0x47')](_0x3f8870)[_0x1e58('0x25')](handleEntityNotFound(_0xc8804a,null))[_0x1e58('0x25')](respondWithResult(_0xc8804a,null))['catch'](handleError(_0xc8804a,null));};exports['create']=function(_0x5816a9,_0x28e563){return db[_0x1e58('0x3f')]['create'](_0x5816a9[_0x1e58('0x48')],{})[_0x1e58('0x25')](function(_0x59de5a){var _0x39c4bd=_0x5816a9['user'][_0x1e58('0x49')]({'plain':!![]});if(!_0x39c4bd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39c4bd['role']==='user'){var _0x239878=_0x59de5a['get']({'plain':!![]});var _0x13d822=_0x1e58('0x4a');return db[_0x1e58('0x4b')]['find']({'where':{'name':_0x13d822,'userProfileId':_0x39c4bd['userProfileId']},'raw':!![]})[_0x1e58('0x25')](function(_0x5360ce){if(_0x5360ce&&_0x5360ce[_0x1e58('0x4c')]===0x0){return db[_0x1e58('0x4d')][_0x1e58('0x4e')]({'name':_0x239878[_0x1e58('0x27')],'resourceId':_0x239878['id'],'type':_0x5360ce[_0x1e58('0x27')],'sectionId':_0x5360ce['id']},{})['then'](function(){return _0x59de5a;});}else{return _0x59de5a;}})[_0x1e58('0x42')](function(_0x3d83b9){logger[_0x1e58('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d83b9);throw _0x3d83b9;});}return _0x59de5a;})[_0x1e58('0x25')](respondWithResult(_0x28e563,0xc9))['catch'](handleError(_0x28e563,null));};exports[_0x1e58('0x4f')]=function(_0x3da48a,_0x43ad90){if(_0x3da48a['body']['id']){delete _0x3da48a['body']['id'];}return db['Team'][_0x1e58('0x47')]({'where':{'id':_0x3da48a[_0x1e58('0x44')]['id']}})[_0x1e58('0x25')](handleEntityNotFound(_0x43ad90,null))[_0x1e58('0x25')](saveUpdates(_0x3da48a[_0x1e58('0x48')],null))[_0x1e58('0x25')](respondWithResult(_0x43ad90,null))[_0x1e58('0x42')](handleError(_0x43ad90,null));};exports[_0x1e58('0x50')]=function(_0x4fbbcf,_0x44e7da){var _0x7e56a8=_0x4fbbcf[_0x1e58('0x44')]['id'];var _0x57419e=[];return db['sequelize'][_0x1e58('0x51')](function(_0x2b88c4){var _0x50859e=_0x1e58('0x52')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x50859e,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')][_0x1e58('0x56')],'raw':!![],'transaction':_0x2b88c4})[_0x1e58('0x25')](function(_0x248878){_0x57419e=_[_0x1e58('0x2a')](_0x248878,function(_0x51d132){return Number(_0x51d132['UserId']);});})[_0x1e58('0x25')](function(){var _0xcd2dda=_0x1e58('0x57')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0xcd2dda,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')]['SELECT'],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x3b93c7){var _0x4f27d6=_['map'](_0x3b93c7,function(_0x106a21){return Number(_0x106a21[_0x1e58('0x58')]);});return db[_0x1e58('0x59')][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'VoiceQueueId':{'$in':_0x4f27d6}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){var _0x766f4d=_0x1e58('0x5a')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x766f4d,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')][_0x1e58('0x56')],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x2372ea){var _0x551cb7=_[_0x1e58('0x2a')](_0x2372ea,function(_0x3f9f16){return Number(_0x3f9f16[_0x1e58('0x5b')]);});return db[_0x1e58('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x57419e},'MailQueueId':{'$in':_0x551cb7}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){var _0x498137=_0x1e58('0x5d')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x498137,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')][_0x1e58('0x56')],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x400e01){var _0x378932=_[_0x1e58('0x2a')](_0x400e01,function(_0x43b0fb){return Number(_0x43b0fb[_0x1e58('0x5e')]);});return db[_0x1e58('0x5f')][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'SmsQueueId':{'$in':_0x378932}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){var _0x3be236=_0x1e58('0x60')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x3be236,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')][_0x1e58('0x56')],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x5d7792){var _0x38522b=_[_0x1e58('0x2a')](_0x5d7792,function(_0x17ec6c){return Number(_0x17ec6c['ChatQueueId']);});return db[_0x1e58('0x61')]['destroy']({'where':{'UserId':{'$in':_0x57419e},'ChatQueueId':{'$in':_0x38522b}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){var _0x483b28=_0x1e58('0x62')+_0x7e56a8;return db['sequelize']['query'](_0x483b28,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')]['SELECT'],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0xb724c6){var _0x2b3fd6=_[_0x1e58('0x2a')](_0xb724c6,function(_0x4e3e7d){return Number(_0x4e3e7d['FaxQueueId']);});return db[_0x1e58('0x63')][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'FaxQueueId':{'$in':_0x2b3fd6}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){var _0x3e22f7='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x3e22f7,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')]['SELECT'],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x25b009){var _0xf815dd=_[_0x1e58('0x2a')](_0x25b009,function(_0x1519ba){return Number(_0x1519ba[_0x1e58('0x64')]);});return db[_0x1e58('0x65')][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'OpenchannelQueueId':{'$in':_0xf815dd}},'transaction':_0x2b88c4});})['then'](function(){var _0x5f428e=_0x1e58('0x66')+_0x7e56a8;return db[_0x1e58('0x53')][_0x1e58('0x2f')](_0x5f428e,{'type':db[_0x1e58('0x54')][_0x1e58('0x55')][_0x1e58('0x56')],'raw':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x35f5da){var _0x535824=_[_0x1e58('0x2a')](_0x35f5da,function(_0x5f40f4){return Number(_0x5f40f4[_0x1e58('0x67')]);});return db['UserWhatsappQueue'][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'WhatsappQueueId':{'$in':_0x535824}},'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x7e56a8}});})[_0x1e58('0x25')](function(_0x1604d2){if(_0x1604d2===null){return;}return db['UserVoicePrefix'][_0x1e58('0x50')]({'where':{'UserId':{'$in':_0x57419e},'VoicePrefixId':_0x1604d2[_0x1e58('0x68')]},'transaction':_0x2b88c4});})['then'](function(){return db['Team'][_0x1e58('0x50')]({'where':{'id':_0x7e56a8},'cascade':!![],'transaction':_0x2b88c4});})[_0x1e58('0x25')](function(_0x229138){if(_0x229138===0x0){_0x44e7da[_0x1e58('0x19')](0x194);}else{return db[_0x1e58('0x4d')][_0x1e58('0x50')]({'where':{'type':_0x1e58('0x4a'),'resourceId':_0x7e56a8},'cascade':!![],'transaction':_0x2b88c4})[_0x1e58('0x25')](function(){_0x44e7da[_0x1e58('0x1a')](0xcc)[_0x1e58('0x1b')]();});}})['catch'](function(_0x376528){_0x44e7da['status'](0x1f4)[_0x1e58('0x28')](_0x376528);});});};exports['getQueues']=function(_0x528dfe,_0x2f4d20,_0x107757){return db[_0x1e58('0x3f')][_0x1e58('0x69')]({'where':{'id':_0x528dfe['params']['id']}})[_0x1e58('0x25')](handleEntityNotFound(_0x2f4d20,null))[_0x1e58('0x25')](function(_0x6df148){if(!_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x6a')]||!utils[_0x1e58('0x6b')](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x6a')])){throw new db[(_0x1e58('0x54'))][(_0x1e58('0x6c'))](_0x1e58('0x6d'));}var _0x73f6c0={};var _0x5f1040={};_0x5f1040['model']=_[_0x1e58('0x46')](db[_[_0x1e58('0x6e')](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x6a')][_0x1e58('0x6f')]())+_0x1e58('0x70')][_0x1e58('0x45')]);_0x5f1040[_0x1e58('0x2f')]=_[_0x1e58('0x46')](_0x528dfe[_0x1e58('0x2f')]);_0x5f1040['filters']=_[_0x1e58('0x30')](_0x5f1040[_0x1e58('0x2e')],_0x5f1040[_0x1e58('0x2f')]);_0x73f6c0[_0x1e58('0x31')]=_[_0x1e58('0x30')](_0x5f1040['model'],qs[_0x1e58('0x32')](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x32')]));_0x73f6c0[_0x1e58('0x31')]=_0x73f6c0[_0x1e58('0x31')]['length']?_0x73f6c0['attributes']:_0x5f1040[_0x1e58('0x2e')];_0x73f6c0[_0x1e58('0x1f')]=qs[_0x1e58('0x1f')](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x1f')]);_0x73f6c0[_0x1e58('0x1d')]=qs[_0x1e58('0x1d')](_0x528dfe[_0x1e58('0x2f')]['offset']);_0x73f6c0[_0x1e58('0x36')]=qs[_0x1e58('0x37')](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x37')]);_0x73f6c0[_0x1e58('0x38')]=qs[_0x1e58('0x39')](_['pick'](_0x528dfe[_0x1e58('0x2f')],_0x5f1040[_0x1e58('0x39')]));_0x73f6c0=_[_0x1e58('0x3c')]({},_0x73f6c0,_0x528dfe[_0x1e58('0x3e')]);return _0x6df148[_0x1e58('0x49')+_['capitalize'](_0x528dfe[_0x1e58('0x2f')][_0x1e58('0x6a')][_0x1e58('0x6f')]())+_0x1e58('0x71')](_0x73f6c0);})[_0x1e58('0x25')](respondWithResult(_0x2f4d20,null))['catch'](handleError(_0x2f4d20,null));};exports['addQueues']=function(_0x4e6100,_0x3443e6,_0x4e078d){return db[_0x1e58('0x3f')][_0x1e58('0x69')]({'where':{'id':_0x4e6100[_0x1e58('0x44')]['id']}})[_0x1e58('0x25')](function(_0x72af04){if(_0x72af04){if(!_0x4e6100[_0x1e58('0x48')]['channel']||!utils['isValidChannel'](_0x4e6100[_0x1e58('0x48')][_0x1e58('0x6a')])){throw new db[(_0x1e58('0x54'))][(_0x1e58('0x6c'))]('Unknown\x20channel');}return _0x72af04[_0x1e58('0x72')+_[_0x1e58('0x6e')](_0x4e6100['body'][_0x1e58('0x6a')]['toLowerCase']())+_0x1e58('0x71')](_0x4e6100[_0x1e58('0x48')][_0x1e58('0x73')]);}return null;})['then'](handleEntityNotFound(_0x3443e6,null))[_0x1e58('0x25')](respondWithStatusCode(_0x3443e6,null))[_0x1e58('0x42')](handleError(_0x3443e6,null));};exports[_0x1e58('0x74')]=function(_0x185c38,_0x375741,_0x34fe8a){return db[_0x1e58('0x3f')]['findOne']({'where':{'id':_0x185c38[_0x1e58('0x44')]['id']}})[_0x1e58('0x25')](function(_0x4fc849){if(_0x4fc849){if(!_0x185c38[_0x1e58('0x2f')][_0x1e58('0x6a')]||!utils['isValidChannel'](_0x185c38[_0x1e58('0x2f')][_0x1e58('0x6a')])){throw new db[(_0x1e58('0x54'))][(_0x1e58('0x6c'))](_0x1e58('0x6d'));}return _0x4fc849[_0x1e58('0x75')+_[_0x1e58('0x6e')](_0x185c38['query'][_0x1e58('0x6a')][_0x1e58('0x6f')]())+'Queues'](_0x185c38[_0x1e58('0x2f')]['ids']);}return null;})[_0x1e58('0x25')](handleEntityNotFound(_0x375741,null))[_0x1e58('0x25')](respondWithStatusCode(_0x375741,null))[_0x1e58('0x42')](handleError(_0x375741,null));};exports[_0x1e58('0x76')]=function(_0x52460a,_0x26ce53){var _0x46cb20=_['isArray'](_0x52460a[_0x1e58('0x48')][_0x1e58('0x73')])?_0x52460a[_0x1e58('0x48')][_0x1e58('0x73')]:[_0x52460a[_0x1e58('0x48')][_0x1e58('0x73')]];var _0x4a4640=_0x52460a[_0x1e58('0x44')]['id'];return db[_0x1e58('0x3f')][_0x1e58('0x47')]({'where':{'id':_0x4a4640}})[_0x1e58('0x25')](handleEntityNotFound(_0x26ce53,null))['then'](function(_0x285ef9){if(_0x285ef9){var _0x3de78c=[_0x1e58('0x77'),_0x1e58('0x78'),_0x1e58('0x79'),_0x1e58('0x7a'),_0x1e58('0x7b'),_0x1e58('0x7c'),_0x1e58('0x7d')];return db[_0x1e58('0x53')][_0x1e58('0x51')](function(_0x21eb97){var _0xf296e8=_[_0x1e58('0x2a')](_0x3de78c,function(_0x34c9de){var _0x40f1f0={'attributes':['id',_0x1e58('0x27')]};if(_0x34c9de==='Voice'){_0x40f1f0['through']={'attributes':[_0x1e58('0x7e')]};}return _0x285ef9[_0x1e58('0x49')+_0x34c9de+'Queues'](_0x40f1f0)[_0x1e58('0x25')](function(_0x29acfa){var _0x19e2eb=_[_0x1e58('0x2a')](_0x29acfa,function(_0x350840){var _0x3e7a1f=_[_0x1e58('0x2a')](_0x46cb20,function(_0x2b9a92){var _0x422b5e={'where':{'UserId':_0x2b9a92,[_0x34c9de+_0x1e58('0x7f')]:_0x350840['id']},'transaction':_0x21eb97};if(_0x34c9de===_0x1e58('0x77')){_0x422b5e[_0x1e58('0x80')]={'penalty':_0x350840['TeamVoiceQueue'][_0x1e58('0x7e')]};}return db[_0x1e58('0x81')+_0x34c9de+_0x1e58('0x70')][_0x1e58('0x82')](_0x422b5e)['then'](function(){socket['emit'](_0x1e58('0x83')+_0x34c9de+'Queue:save',{'UserId':_0x2b9a92,[_0x34c9de+'QueueId']:_0x350840['id']});if(_0x34c9de!==_0x1e58('0x77')){return;}return db[_0x1e58('0x81')][_0x1e58('0x84')]({'where':{'id':_0x46cb20,'online':0x1},'attributes':['id',_0x1e58('0x27'),_0x1e58('0x85'),_0x1e58('0x86'),_0x1e58('0x87')],'raw':!![]})['then'](function(_0x24dfc1){var _0x3a223a=_[_0x1e58('0x2a')](_0x24dfc1,function(_0x48cd3c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x48cd3c[_0x1e58('0x27')],'UserId':_0x48cd3c['id'],'queue_name':_0x350840[_0x1e58('0x27')],'VoiceQueueId':_0x350840['id'],'interface':_[_0x1e58('0x88')](_0x48cd3c[_0x1e58('0x87')])?util[_0x1e58('0x89')](_0x1e58('0x8a'),_0x48cd3c[_0x1e58('0x27')]):_0x48cd3c[_0x1e58('0x87')],'paused':_0x48cd3c[_0x1e58('0x86')]||![],'penalty':_0x350840[_0x1e58('0x8b')][_0x1e58('0x7e')]},{'transaction':_0x21eb97});});return Promise[_0x1e58('0x8c')](_0x3a223a);});});});return Promise[_0x1e58('0x8c')](_0x3e7a1f);});return Promise[_0x1e58('0x8c')](_0x19e2eb);})[_0x1e58('0x25')](function(){return db[_0x1e58('0x8d')][_0x1e58('0x69')]({'where':{'teamId':_0x4a4640}})[_0x1e58('0x25')](function(_0x26c42e){if(_0x26c42e){var _0x5c8b58=_['map'](_0x46cb20,function(_0x3d6d91){db[_0x1e58('0x8e')][_0x1e58('0x8f')]({'UserId':_0x3d6d91,'VoicePrefixId':_0x26c42e[_0x1e58('0x68')]});});return Promise[_0x1e58('0x8c')](_0x5c8b58);}});});});return Promise[_0x1e58('0x8c')](_0xf296e8)[_0x1e58('0x25')](function(){return _0x285ef9[_0x1e58('0x76')](_0x46cb20,{'transaction':_0x21eb97})['spread'](function(_0x49f2e4){return _0x49f2e4;});});});}})[_0x1e58('0x25')](respondWithResult(_0x26ce53,null))[_0x1e58('0x42')](handleError(_0x26ce53,null));};exports[_0x1e58('0x90')]=function(_0x1678eb,_0x336c45){var _0x369b7e=_['isArray'](_0x1678eb[_0x1e58('0x2f')][_0x1e58('0x73')])?_0x1678eb['query'][_0x1e58('0x73')]:[_0x1678eb[_0x1e58('0x2f')][_0x1e58('0x73')]];var _0xbc7062=_0x1678eb[_0x1e58('0x44')]['id'];return db[_0x1e58('0x3f')][_0x1e58('0x47')]({'where':{'id':_0xbc7062}})[_0x1e58('0x25')](handleEntityNotFound(_0x336c45,null))[_0x1e58('0x25')](function(_0xd5c451){if(_0xd5c451){var _0x3e3175=['Voice',_0x1e58('0x78'),'Mail','Sms',_0x1e58('0x7b'),_0x1e58('0x7c'),_0x1e58('0x7d')];return db[_0x1e58('0x53')]['transaction'](function(_0x55b160){var _0x4d9b2d=_[_0x1e58('0x2a')](_0x3e3175,function(_0xe40a26){var _0x38439c={'attributes':['id',_0x1e58('0x27')]};return _0xd5c451[_0x1e58('0x49')+_0xe40a26+_0x1e58('0x71')](_0x38439c)[_0x1e58('0x25')](function(_0x31e162){var _0xd2bb60=_[_0x1e58('0x2a')](_0x31e162,function(_0x4bd65f){return _0x4bd65f[_0x1e58('0x90')](_0x369b7e,{'transaction':_0x55b160})['then'](function(){var _0x28382f=_[_0x1e58('0x2a')](_0x369b7e,function(_0x5b09e3){socket['emit'](_0x1e58('0x83')+_0xe40a26+_0x1e58('0x91'),{'UserId':Number(_0x5b09e3),[_0xe40a26+_0x1e58('0x7f')]:_0x4bd65f['id']});if(_0xe40a26!==_0x1e58('0x77')){return;}return db[_0x1e58('0x92')]['destroy']({'where':{'VoiceQueueId':_0x4bd65f['id'],'UserId':_0x5b09e3},'transaction':_0x55b160});});return Promise['all'](_0x28382f);});});return Promise['all'](_0xd2bb60);});});return Promise[_0x1e58('0x8c')](_0x4d9b2d)['then'](function(){return _0xd5c451[_0x1e58('0x90')](_0x369b7e,{'transaction':_0x55b160});})[_0x1e58('0x25')](function(){return db[_0x1e58('0x8d')][_0x1e58('0x69')]({'where':{'teamId':_0xbc7062}})[_0x1e58('0x25')](function(_0x530489){if(_0x530489){var _0x764ce3=_[_0x1e58('0x2a')](_0x369b7e,function(_0x2471bb){db[_0x1e58('0x8e')][_0x1e58('0x50')]({'where':{'UserId':_0x2471bb,'VoicePrefixId':_0x530489[_0x1e58('0x68')]}});});return Promise[_0x1e58('0x8c')](_0x764ce3);}});});});}})[_0x1e58('0x25')](respondWithStatusCode(_0x336c45,null))['catch'](handleError(_0x336c45,null));};exports[_0x1e58('0x93')]=function(_0x4aea68,_0x4d9f4f,_0x503bdc){var _0x149614={};var _0x3fb54d={};var _0x3470e4;var _0x40cb84;return db[_0x1e58('0x3f')][_0x1e58('0x69')]({'where':{'id':_0x4aea68[_0x1e58('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d9f4f,null))[_0x1e58('0x25')](function(_0x9e1545){if(_0x9e1545){_0x3470e4=_0x9e1545;_0x3fb54d[_0x1e58('0x2e')]=_[_0x1e58('0x46')](db[_0x1e58('0x81')][_0x1e58('0x45')]);_0x3fb54d[_0x1e58('0x2f')]=_[_0x1e58('0x46')](_0x4aea68[_0x1e58('0x2f')]);_0x3fb54d[_0x1e58('0x39')]=_['intersection'](_0x3fb54d[_0x1e58('0x2e')],_0x3fb54d[_0x1e58('0x2f')]);_0x149614[_0x1e58('0x31')]=_['intersection'](_0x3fb54d[_0x1e58('0x2e')],qs['fields'](_0x4aea68['query'][_0x1e58('0x32')]));_0x149614[_0x1e58('0x31')]=_0x149614[_0x1e58('0x31')]['length']?_0x149614[_0x1e58('0x31')]:_0x3fb54d[_0x1e58('0x2e')];_0x149614['order']=qs[_0x1e58('0x37')](_0x4aea68[_0x1e58('0x2f')][_0x1e58('0x37')]);_0x149614[_0x1e58('0x38')]=qs[_0x1e58('0x39')](_[_0x1e58('0x3a')](_0x4aea68['query'],_0x3fb54d[_0x1e58('0x39')]));if(_0x4aea68['query'][_0x1e58('0x3b')]){_0x149614['where']=_[_0x1e58('0x3c')](_0x149614[_0x1e58('0x38')],{'$or':_['map'](_0x149614[_0x1e58('0x31')],function(_0x4ec88e){var _0x4099dc={};_0x4099dc[_0x4ec88e]={'$like':'%'+_0x4aea68[_0x1e58('0x2f')][_0x1e58('0x3b')]+'%'};return _0x4099dc;})});}_0x149614=_[_0x1e58('0x3c')]({},_0x149614,_0x4aea68[_0x1e58('0x3e')]);return _0x3470e4[_0x1e58('0x93')](_0x149614);}})[_0x1e58('0x25')](function(_0x24b431){if(_0x24b431){_0x40cb84=_0x24b431['length'];if(!_0x4aea68['query'][_0x1e58('0x34')](_0x1e58('0x35'))){_0x149614[_0x1e58('0x1f')]=qs[_0x1e58('0x1f')](_0x4aea68[_0x1e58('0x2f')]['limit']);_0x149614[_0x1e58('0x1d')]=qs[_0x1e58('0x1d')](_0x4aea68[_0x1e58('0x2f')]['offset']);}return _0x3470e4['getAgents'](_0x149614);}})['then'](function(_0x38f7dd){if(_0x38f7dd){return _0x38f7dd?{'count':_0x40cb84,'rows':_0x38f7dd}:null;}})[_0x1e58('0x25')](respondWithResult(_0x4d9f4f,null))[_0x1e58('0x42')](handleError(_0x4d9f4f,null));}; \ No newline at end of file +var _0x287a=['api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','error','map','Team','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','keys','rawAttributes','find','catch','user','get','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','send','getQueues','channel','isValidChannel','Queue','capitalize','toLowerCase','addQueues','findOne','params','ValidationError','Unknown\x20channel','Queues','ids','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','penalty','all','addAgents','spread','removeAgents','Chat','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x47d39e,_0x653eb2){var _0x5b2260=function(_0x34fcfd){while(--_0x34fcfd){_0x47d39e['push'](_0x47d39e['shift']());}};_0x5b2260(++_0x653eb2);}(_0x287a,0x1b1));var _0xa287=function(_0xd302a3,_0x8b307d){_0xd302a3=_0xd302a3-0x0;var _0x21a575=_0x287a[_0xd302a3];return _0x21a575;};'use strict';var emlformat=require(_0xa287('0x0'));var rimraf=require(_0xa287('0x1'));var zipdir=require(_0xa287('0x2'));var jsonpatch=require(_0xa287('0x3'));var rp=require(_0xa287('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa287('0x5'));var path=require('path');var sox=require(_0xa287('0x6'));var csv=require(_0xa287('0x7'));var ejs=require(_0xa287('0x8'));var fs=require('fs');var fs_extra=require(_0xa287('0x9'));var _=require(_0xa287('0xa'));var squel=require(_0xa287('0xb'));var crypto=require(_0xa287('0xc'));var jsforce=require(_0xa287('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa287('0x7'));var querystring=require('querystring');var Papa=require(_0xa287('0xe'));var Redis=require('ioredis');var authService=require(_0xa287('0xf'));var qs=require(_0xa287('0x10'));var as=require(_0xa287('0x11'));var hardwareService=require(_0xa287('0x12'));var logger=require(_0xa287('0x13'))(_0xa287('0x14'));var utils=require(_0xa287('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa287('0x16'));var db=require(_0xa287('0x17'))['db'];config['redis']=_[_0xa287('0x18')](config[_0xa287('0x19')],{'host':_0xa287('0x1a'),'port':0x18eb});var socket=require(_0xa287('0x1b'))(new Redis(config[_0xa287('0x19')]));require(_0xa287('0x1c'))['register'](socket);function respondWithStatusCode(_0x5ca557,_0x5ebb11){_0x5ebb11=_0x5ebb11||0xcc;return function(_0x1a99d0){if(_0x1a99d0){return _0x5ca557[_0xa287('0x1d')](_0x5ebb11);}return _0x5ca557['status'](_0x5ebb11)['end']();};}function respondWithResult(_0x52ef96,_0x456a0a){_0x456a0a=_0x456a0a||0xc8;return function(_0x388ccc){if(_0x388ccc){return _0x52ef96[_0xa287('0x1e')](_0x456a0a)[_0xa287('0x1f')](_0x388ccc);}};}function respondWithFilteredResult(_0x329d17,_0x5f2f60){return function(_0x33d4ac){if(_0x33d4ac){var _0x3a9ba8=typeof _0x5f2f60[_0xa287('0x20')]===_0xa287('0x21')&&typeof _0x5f2f60[_0xa287('0x22')]==='undefined';var _0x3fa4c1=_0x33d4ac[_0xa287('0x23')];var _0x10fba2=_0x3a9ba8?0x0:_0x5f2f60[_0xa287('0x20')];var _0x265ddf=_0x3a9ba8?_0x33d4ac['count']:_0x5f2f60[_0xa287('0x20')]+_0x5f2f60[_0xa287('0x22')];var _0x409e3b;if(_0x265ddf>=_0x3fa4c1){_0x265ddf=_0x3fa4c1;_0x409e3b=0xc8;}else{_0x409e3b=0xce;}_0x329d17[_0xa287('0x1e')](_0x409e3b);return _0x329d17[_0xa287('0x24')](_0xa287('0x25'),_0x10fba2+'-'+_0x265ddf+'/'+_0x3fa4c1)[_0xa287('0x1f')](_0x33d4ac);}return null;};}function patchUpdates(_0x54ef79){return function(_0x842964){try{jsonpatch[_0xa287('0x26')](_0x842964,_0x54ef79,!![]);}catch(_0x3f69b4){return BPromise[_0xa287('0x27')](_0x3f69b4);}return _0x842964['save']();};}function saveUpdates(_0x3fac42,_0x457663){return function(_0x7568f8){if(_0x7568f8){return _0x7568f8[_0xa287('0x28')](_0x3fac42)['then'](function(_0x3f61cb){return _0x3f61cb;});}return null;};}function handleEntityNotFound(_0x39f05d,_0x2e90bf){return function(_0x2e0213){if(!_0x2e0213){_0x39f05d['sendStatus'](0x194);}return _0x2e0213;};}function handleError(_0xe8f35,_0x511aa8){_0x511aa8=_0x511aa8||0x1f4;return function(_0x18f533){logger[_0xa287('0x29')](_0x18f533['stack']);if(_0x18f533['name']){delete _0x18f533['name'];}_0xe8f35[_0xa287('0x1e')](_0x511aa8)['send'](_0x18f533);};}exports['index']=function(_0x1317a3,_0x4b4875){var _0xe10a38={},_0x27841d={},_0x1b2839={'count':0x0,'rows':[]};var _0x30711a=_[_0xa287('0x2a')](db[_0xa287('0x2b')]['rawAttributes'],function(_0x1835fc){return{'name':_0x1835fc[_0xa287('0x2c')],'type':_0x1835fc[_0xa287('0x2d')]['key']};});_0x27841d[_0xa287('0x2e')]=_['map'](_0x30711a,_0xa287('0x2f'));_0x27841d[_0xa287('0x30')]=_['keys'](_0x1317a3[_0xa287('0x30')]);_0x27841d[_0xa287('0x31')]=_[_0xa287('0x32')](_0x27841d[_0xa287('0x2e')],_0x27841d['query']);_0xe10a38[_0xa287('0x33')]=_[_0xa287('0x32')](_0x27841d[_0xa287('0x2e')],qs[_0xa287('0x34')](_0x1317a3[_0xa287('0x30')][_0xa287('0x34')]));_0xe10a38[_0xa287('0x33')]=_0xe10a38[_0xa287('0x33')][_0xa287('0x35')]?_0xe10a38[_0xa287('0x33')]:_0x27841d[_0xa287('0x2e')];if(!_0x1317a3[_0xa287('0x30')][_0xa287('0x36')]('nolimit')){_0xe10a38['limit']=qs['limit'](_0x1317a3[_0xa287('0x30')][_0xa287('0x22')]);_0xe10a38[_0xa287('0x20')]=qs['offset'](_0x1317a3[_0xa287('0x30')]['offset']);}_0xe10a38[_0xa287('0x37')]=qs[_0xa287('0x38')](_0x1317a3[_0xa287('0x30')][_0xa287('0x38')]);_0xe10a38[_0xa287('0x39')]=qs[_0xa287('0x31')](_[_0xa287('0x3a')](_0x1317a3[_0xa287('0x30')],_0x27841d['filters']),_0x30711a);if(_0x1317a3['query']['filter']){_0xe10a38[_0xa287('0x39')]=_[_0xa287('0x3b')](_0xe10a38['where'],{'$or':_['map'](_0x30711a,function(_0x131dfe){if(_0x131dfe[_0xa287('0x2d')]!=='VIRTUAL'){var _0x1d85e7={};_0x1d85e7[_0x131dfe[_0xa287('0x2f')]]={'$like':'%'+_0x1317a3['query'][_0xa287('0x3c')]+'%'};return _0x1d85e7;}})});}_0xe10a38=_[_0xa287('0x3b')]({},_0xe10a38,_0x1317a3[_0xa287('0x3d')]);var _0x59906c={'where':_0xe10a38[_0xa287('0x39')]};return db[_0xa287('0x2b')][_0xa287('0x23')](_0x59906c)[_0xa287('0x3e')](function(_0x27120d){_0x1b2839[_0xa287('0x23')]=_0x27120d;if(_0x1317a3[_0xa287('0x30')][_0xa287('0x3f')]){_0xe10a38[_0xa287('0x40')]=[{'all':!![]}];}return db['Team'][_0xa287('0x41')](_0xe10a38);})[_0xa287('0x3e')](function(_0x288d09){_0x1b2839[_0xa287('0x42')]=_0x288d09;return _0x1b2839;})[_0xa287('0x3e')](respondWithFilteredResult(_0x4b4875,_0xe10a38))['catch'](handleError(_0x4b4875,null));};exports[_0xa287('0x43')]=function(_0x2d345f,_0x334e2a){var _0x37b2df={'raw':![],'where':{'id':_0x2d345f['params']['id']}},_0x21271a={};_0x21271a[_0xa287('0x2e')]=_[_0xa287('0x44')](db[_0xa287('0x2b')][_0xa287('0x45')]);_0x21271a[_0xa287('0x30')]=_[_0xa287('0x44')](_0x2d345f['query']);_0x21271a['filters']=_[_0xa287('0x32')](_0x21271a[_0xa287('0x2e')],_0x21271a[_0xa287('0x30')]);_0x37b2df[_0xa287('0x33')]=_[_0xa287('0x32')](_0x21271a['model'],qs[_0xa287('0x34')](_0x2d345f[_0xa287('0x30')][_0xa287('0x34')]));_0x37b2df[_0xa287('0x33')]=_0x37b2df[_0xa287('0x33')][_0xa287('0x35')]?_0x37b2df[_0xa287('0x33')]:_0x21271a[_0xa287('0x2e')];if(_0x2d345f[_0xa287('0x30')]['includeAll']){_0x37b2df[_0xa287('0x40')]=[{'all':!![]}];}_0x37b2df=_[_0xa287('0x3b')]({},_0x37b2df,_0x2d345f[_0xa287('0x3d')]);return db[_0xa287('0x2b')][_0xa287('0x46')](_0x37b2df)[_0xa287('0x3e')](handleEntityNotFound(_0x334e2a,null))['then'](respondWithResult(_0x334e2a,null))[_0xa287('0x47')](handleError(_0x334e2a,null));};exports['create']=function(_0x57fdd1,_0x1cede0){return db['Team']['create'](_0x57fdd1['body'],{})[_0xa287('0x3e')](function(_0x3591c2){var _0x25560e=_0x57fdd1[_0xa287('0x48')][_0xa287('0x49')]({'plain':!![]});if(!_0x25560e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25560e[_0xa287('0x4a')]===_0xa287('0x48')){var _0x4dca19=_0x3591c2[_0xa287('0x49')]({'plain':!![]});var _0x469c23='Teams';return db['UserProfileSection'][_0xa287('0x46')]({'where':{'name':_0x469c23,'userProfileId':_0x25560e['userProfileId']},'raw':!![]})[_0xa287('0x3e')](function(_0x4c5587){if(_0x4c5587&&_0x4c5587[_0xa287('0x4b')]===0x0){return db['UserProfileResource'][_0xa287('0x4c')]({'name':_0x4dca19['name'],'resourceId':_0x4dca19['id'],'type':_0x4c5587[_0xa287('0x2f')],'sectionId':_0x4c5587['id']},{})[_0xa287('0x3e')](function(){return _0x3591c2;});}else{return _0x3591c2;}})[_0xa287('0x47')](function(_0x160f4e){logger[_0xa287('0x29')](_0xa287('0x4d'),_0x160f4e);throw _0x160f4e;});}return _0x3591c2;})['then'](respondWithResult(_0x1cede0,0xc9))[_0xa287('0x47')](handleError(_0x1cede0,null));};exports[_0xa287('0x28')]=function(_0x1a3117,_0x14386e){if(_0x1a3117[_0xa287('0x4e')]['id']){delete _0x1a3117[_0xa287('0x4e')]['id'];}return db['Team'][_0xa287('0x46')]({'where':{'id':_0x1a3117['params']['id']}})[_0xa287('0x3e')](handleEntityNotFound(_0x14386e,null))[_0xa287('0x3e')](saveUpdates(_0x1a3117[_0xa287('0x4e')],null))[_0xa287('0x3e')](respondWithResult(_0x14386e,null))[_0xa287('0x47')](handleError(_0x14386e,null));};exports['destroy']=function(_0xabcab,_0x347e86){var _0x39ec16=_0xabcab['params']['id'];var _0x4ca4df=[];return db[_0xa287('0x4f')][_0xa287('0x50')](function(_0x18d998){var _0x246a32=_0xa287('0x51')+_0x39ec16;return db[_0xa287('0x4f')][_0xa287('0x30')](_0x246a32,{'type':db[_0xa287('0x52')][_0xa287('0x53')][_0xa287('0x54')],'raw':!![],'transaction':_0x18d998})[_0xa287('0x3e')](function(_0x411396){_0x4ca4df=_[_0xa287('0x2a')](_0x411396,function(_0x49295e){return Number(_0x49295e[_0xa287('0x55')]);});})[_0xa287('0x3e')](function(){var _0x14ad40=_0xa287('0x56')+_0x39ec16;return db['sequelize'][_0xa287('0x30')](_0x14ad40,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x57078a){var _0x43f53a=_['map'](_0x57078a,function(_0x2de511){return Number(_0x2de511[_0xa287('0x57')]);});return db[_0xa287('0x58')][_0xa287('0x59')]({'where':{'UserId':{'$in':_0x4ca4df},'VoiceQueueId':{'$in':_0x43f53a}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x17a4c4='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x39ec16;return db[_0xa287('0x4f')][_0xa287('0x30')](_0x17a4c4,{'type':db[_0xa287('0x52')]['QueryTypes'][_0xa287('0x54')],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0xef8da9){var _0x220570=_[_0xa287('0x2a')](_0xef8da9,function(_0xad0003){return Number(_0xad0003[_0xa287('0x5a')]);});return db[_0xa287('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x4ca4df},'MailQueueId':{'$in':_0x220570}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x3cc332='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x39ec16;return db[_0xa287('0x4f')][_0xa287('0x30')](_0x3cc332,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x23f295){var _0x39d6ce=_[_0xa287('0x2a')](_0x23f295,function(_0x4aa352){return Number(_0x4aa352[_0xa287('0x5c')]);});return db[_0xa287('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x4ca4df},'SmsQueueId':{'$in':_0x39d6ce}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x335fa5=_0xa287('0x5e')+_0x39ec16;return db[_0xa287('0x4f')]['query'](_0x335fa5,{'type':db[_0xa287('0x52')][_0xa287('0x53')][_0xa287('0x54')],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x3af45b){var _0x168337=_[_0xa287('0x2a')](_0x3af45b,function(_0x2492ea){return Number(_0x2492ea[_0xa287('0x5f')]);});return db[_0xa287('0x60')][_0xa287('0x59')]({'where':{'UserId':{'$in':_0x4ca4df},'ChatQueueId':{'$in':_0x168337}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x3b145a=_0xa287('0x61')+_0x39ec16;return db['sequelize'][_0xa287('0x30')](_0x3b145a,{'type':db[_0xa287('0x52')][_0xa287('0x53')][_0xa287('0x54')],'raw':!![],'transaction':_0x18d998});})['then'](function(_0x51b2a9){var _0x1eaa5c=_[_0xa287('0x2a')](_0x51b2a9,function(_0x513f66){return Number(_0x513f66[_0xa287('0x62')]);});return db[_0xa287('0x63')][_0xa287('0x59')]({'where':{'UserId':{'$in':_0x4ca4df},'FaxQueueId':{'$in':_0x1eaa5c}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x243815=_0xa287('0x64')+_0x39ec16;return db[_0xa287('0x4f')][_0xa287('0x30')](_0x243815,{'type':db[_0xa287('0x52')][_0xa287('0x53')][_0xa287('0x54')],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x41cf30){var _0x476fbf=_[_0xa287('0x2a')](_0x41cf30,function(_0x5ad3a0){return Number(_0x5ad3a0[_0xa287('0x65')]);});return db['UserOpenchannelQueue'][_0xa287('0x59')]({'where':{'UserId':{'$in':_0x4ca4df},'OpenchannelQueueId':{'$in':_0x476fbf}},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){var _0x4ccd0c=_0xa287('0x66')+_0x39ec16;return db[_0xa287('0x4f')][_0xa287('0x30')](_0x4ccd0c,{'type':db[_0xa287('0x52')][_0xa287('0x53')]['SELECT'],'raw':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x2bb353){var _0x4e597f=_[_0xa287('0x2a')](_0x2bb353,function(_0x1a96e2){return Number(_0x1a96e2['WhatsappQueueId']);});return db[_0xa287('0x67')]['destroy']({'where':{'UserId':{'$in':_0x4ca4df},'WhatsappQueueId':{'$in':_0x4e597f}},'transaction':_0x18d998});})['then'](function(){return db[_0xa287('0x68')]['find']({'where':{'TeamId':_0x39ec16}});})['then'](function(_0x32809f){if(_0x32809f===null){return;}return db['UserVoicePrefix'][_0xa287('0x59')]({'where':{'UserId':{'$in':_0x4ca4df},'VoicePrefixId':_0x32809f[_0xa287('0x69')]},'transaction':_0x18d998});})[_0xa287('0x3e')](function(){return db['Team'][_0xa287('0x59')]({'where':{'id':_0x39ec16},'cascade':!![],'transaction':_0x18d998});})[_0xa287('0x3e')](function(_0x509eda){if(_0x509eda===0x0){_0x347e86[_0xa287('0x1d')](0x194);}else{return db[_0xa287('0x6a')]['destroy']({'where':{'type':'Teams','resourceId':_0x39ec16},'cascade':!![],'transaction':_0x18d998})[_0xa287('0x3e')](function(){_0x347e86[_0xa287('0x1e')](0xcc)['end']();});}})['catch'](function(_0x38fa1a){_0x347e86[_0xa287('0x1e')](0x1f4)[_0xa287('0x6b')](_0x38fa1a);});});};exports[_0xa287('0x6c')]=function(_0x33ee40,_0x2b11ca,_0x35fcaf){return db[_0xa287('0x2b')]['findOne']({'where':{'id':_0x33ee40['params']['id']}})[_0xa287('0x3e')](handleEntityNotFound(_0x2b11ca,null))[_0xa287('0x3e')](function(_0x30a666){if(!_0x33ee40['query'][_0xa287('0x6d')]||!utils[_0xa287('0x6e')](_0x33ee40[_0xa287('0x30')][_0xa287('0x6d')])){throw new db[(_0xa287('0x52'))]['ValidationError']('Unknown\x20channel');}var _0x3bd1e7={};var _0x41bbae={};_0x41bbae[_0xa287('0x2e')]=_[_0xa287('0x44')](db[_['capitalize'](_0x33ee40['query']['channel']['toLowerCase']())+_0xa287('0x6f')][_0xa287('0x45')]);_0x41bbae[_0xa287('0x30')]=_[_0xa287('0x44')](_0x33ee40[_0xa287('0x30')]);_0x41bbae[_0xa287('0x31')]=_[_0xa287('0x32')](_0x41bbae[_0xa287('0x2e')],_0x41bbae[_0xa287('0x30')]);_0x3bd1e7[_0xa287('0x33')]=_[_0xa287('0x32')](_0x41bbae['model'],qs[_0xa287('0x34')](_0x33ee40[_0xa287('0x30')]['fields']));_0x3bd1e7[_0xa287('0x33')]=_0x3bd1e7[_0xa287('0x33')]['length']?_0x3bd1e7[_0xa287('0x33')]:_0x41bbae[_0xa287('0x2e')];_0x3bd1e7[_0xa287('0x22')]=qs[_0xa287('0x22')](_0x33ee40['query'][_0xa287('0x22')]);_0x3bd1e7[_0xa287('0x20')]=qs[_0xa287('0x20')](_0x33ee40['query'][_0xa287('0x20')]);_0x3bd1e7[_0xa287('0x37')]=qs[_0xa287('0x38')](_0x33ee40[_0xa287('0x30')]['sort']);_0x3bd1e7[_0xa287('0x39')]=qs[_0xa287('0x31')](_[_0xa287('0x3a')](_0x33ee40['query'],_0x41bbae['filters']));_0x3bd1e7=_[_0xa287('0x3b')]({},_0x3bd1e7,_0x33ee40[_0xa287('0x3d')]);return _0x30a666[_0xa287('0x49')+_[_0xa287('0x70')](_0x33ee40['query'][_0xa287('0x6d')][_0xa287('0x71')]())+'Queues'](_0x3bd1e7);})['then'](respondWithResult(_0x2b11ca,null))['catch'](handleError(_0x2b11ca,null));};exports[_0xa287('0x72')]=function(_0x3b4f5b,_0x3f9961,_0x5aeea7){return db['Team'][_0xa287('0x73')]({'where':{'id':_0x3b4f5b[_0xa287('0x74')]['id']}})[_0xa287('0x3e')](function(_0x36ed32){if(_0x36ed32){if(!_0x3b4f5b['body'][_0xa287('0x6d')]||!utils[_0xa287('0x6e')](_0x3b4f5b[_0xa287('0x4e')][_0xa287('0x6d')])){throw new db[(_0xa287('0x52'))][(_0xa287('0x75'))](_0xa287('0x76'));}return _0x36ed32['add'+_[_0xa287('0x70')](_0x3b4f5b[_0xa287('0x4e')][_0xa287('0x6d')]['toLowerCase']())+_0xa287('0x77')](_0x3b4f5b[_0xa287('0x4e')][_0xa287('0x78')]);}return null;})[_0xa287('0x3e')](handleEntityNotFound(_0x3f9961,null))[_0xa287('0x3e')](respondWithStatusCode(_0x3f9961,null))[_0xa287('0x47')](handleError(_0x3f9961,null));};exports['removeQueues']=function(_0x177b69,_0x45aac4,_0x1d39a3){return db[_0xa287('0x2b')][_0xa287('0x73')]({'where':{'id':_0x177b69[_0xa287('0x74')]['id']}})['then'](function(_0x430703){if(_0x430703){if(!_0x177b69['query'][_0xa287('0x6d')]||!utils[_0xa287('0x6e')](_0x177b69['query'][_0xa287('0x6d')])){throw new db[(_0xa287('0x52'))]['ValidationError'](_0xa287('0x76'));}return _0x430703['remove'+_[_0xa287('0x70')](_0x177b69[_0xa287('0x30')][_0xa287('0x6d')][_0xa287('0x71')]())+_0xa287('0x77')](_0x177b69[_0xa287('0x30')][_0xa287('0x78')]);}return null;})['then'](handleEntityNotFound(_0x45aac4,null))[_0xa287('0x3e')](respondWithStatusCode(_0x45aac4,null))[_0xa287('0x47')](handleError(_0x45aac4,null));};exports['addAgents']=function(_0xf8810a,_0x3d21ad){var _0x22525e=_[_0xa287('0x79')](_0xf8810a[_0xa287('0x4e')][_0xa287('0x78')])?_0xf8810a[_0xa287('0x4e')]['ids']:[_0xf8810a[_0xa287('0x4e')]['ids']];var _0x5387a1=_0xf8810a[_0xa287('0x74')]['id'];return db[_0xa287('0x2b')][_0xa287('0x46')]({'where':{'id':_0x5387a1}})[_0xa287('0x3e')](handleEntityNotFound(_0x3d21ad,null))['then'](function(_0x296951){if(_0x296951){var _0x157bed=[_0xa287('0x7a'),'Chat',_0xa287('0x7b'),_0xa287('0x7c'),_0xa287('0x7d'),_0xa287('0x7e'),_0xa287('0x7f')];return db[_0xa287('0x4f')][_0xa287('0x50')](function(_0x1f7028){var _0x36373c=_[_0xa287('0x2a')](_0x157bed,function(_0x1f31a6){var _0x295ef7={'attributes':['id',_0xa287('0x2f')]};if(_0x1f31a6==='Voice'){_0x295ef7[_0xa287('0x80')]={'attributes':['penalty']};}return _0x296951['get'+_0x1f31a6+'Queues'](_0x295ef7)[_0xa287('0x3e')](function(_0x5ba215){var _0x2d75b7=_[_0xa287('0x2a')](_0x5ba215,function(_0x9a277){var _0x49eb90=_[_0xa287('0x2a')](_0x22525e,function(_0x545c5a){var _0x210dd8={'where':{'UserId':_0x545c5a,[_0x1f31a6+_0xa287('0x81')]:_0x9a277['id']},'transaction':_0x1f7028};if(_0x1f31a6===_0xa287('0x7a')){_0x210dd8['defaults']={'penalty':_0x9a277[_0xa287('0x82')]['penalty']};}return db[_0xa287('0x83')+_0x1f31a6+'Queue']['findOrCreate'](_0x210dd8)[_0xa287('0x3e')](function(){socket[_0xa287('0x84')](_0xa287('0x48')+_0x1f31a6+_0xa287('0x85'),{'UserId':_0x545c5a,[_0x1f31a6+'QueueId']:_0x9a277['id']});if(_0x1f31a6!==_0xa287('0x7a')){return;}return db[_0xa287('0x83')]['findAll']({'where':{'id':_0x22525e,'online':0x1},'attributes':['id',_0xa287('0x2f'),_0xa287('0x86'),_0xa287('0x87'),_0xa287('0x88')],'raw':!![]})[_0xa287('0x3e')](function(_0x327222){var _0x5591f5=_[_0xa287('0x2a')](_0x327222,function(_0x36cbea){return db[_0xa287('0x89')][_0xa287('0x8a')]({'membername':_0x36cbea[_0xa287('0x2f')],'UserId':_0x36cbea['id'],'queue_name':_0x9a277[_0xa287('0x2f')],'VoiceQueueId':_0x9a277['id'],'interface':_[_0xa287('0x8b')](_0x36cbea['interface'])?util[_0xa287('0x8c')](_0xa287('0x8d'),_0x36cbea['name']):_0x36cbea[_0xa287('0x88')],'paused':_0x36cbea[_0xa287('0x87')]||![],'penalty':_0x9a277[_0xa287('0x82')][_0xa287('0x8e')]},{'transaction':_0x1f7028});});return Promise[_0xa287('0x8f')](_0x5591f5);});});});return Promise['all'](_0x49eb90);});return Promise[_0xa287('0x8f')](_0x2d75b7);})[_0xa287('0x3e')](function(){return db[_0xa287('0x68')][_0xa287('0x73')]({'where':{'teamId':_0x5387a1}})[_0xa287('0x3e')](function(_0x4c1b9c){if(_0x4c1b9c){var _0x3c59c6=_[_0xa287('0x2a')](_0x22525e,function(_0x1c03e0){db['UserVoicePrefix'][_0xa287('0x8a')]({'UserId':_0x1c03e0,'VoicePrefixId':_0x4c1b9c[_0xa287('0x69')]});});return Promise['all'](_0x3c59c6);}});});});return Promise['all'](_0x36373c)[_0xa287('0x3e')](function(){return _0x296951[_0xa287('0x90')](_0x22525e,{'transaction':_0x1f7028})[_0xa287('0x91')](function(_0x3d788e){return _0x3d788e;});});});}})[_0xa287('0x3e')](respondWithResult(_0x3d21ad,null))[_0xa287('0x47')](handleError(_0x3d21ad,null));};exports[_0xa287('0x92')]=function(_0x252d83,_0x30a8a8){var _0x39e693=_[_0xa287('0x79')](_0x252d83[_0xa287('0x30')][_0xa287('0x78')])?_0x252d83['query'][_0xa287('0x78')]:[_0x252d83['query']['ids']];var _0x30f24e=_0x252d83['params']['id'];return db[_0xa287('0x2b')][_0xa287('0x46')]({'where':{'id':_0x30f24e}})[_0xa287('0x3e')](handleEntityNotFound(_0x30a8a8,null))['then'](function(_0x5ef507){if(_0x5ef507){var _0x20d460=[_0xa287('0x7a'),_0xa287('0x93'),_0xa287('0x7b'),_0xa287('0x7c'),'Fax',_0xa287('0x7e'),_0xa287('0x7f')];return db[_0xa287('0x4f')][_0xa287('0x50')](function(_0x4dd777){var _0x420e2a=_['map'](_0x20d460,function(_0x4a0f2f){var _0x52fa01={'attributes':['id','name']};return _0x5ef507['get'+_0x4a0f2f+_0xa287('0x77')](_0x52fa01)[_0xa287('0x3e')](function(_0xbdb619){var _0x50597c=_[_0xa287('0x2a')](_0xbdb619,function(_0x55dd8b){return _0x55dd8b['removeAgents'](_0x39e693,{'transaction':_0x4dd777})[_0xa287('0x3e')](function(){var _0x73acc=_[_0xa287('0x2a')](_0x39e693,function(_0x19b55d){socket[_0xa287('0x84')]('user'+_0x4a0f2f+_0xa287('0x94'),{'UserId':Number(_0x19b55d),[_0x4a0f2f+_0xa287('0x81')]:_0x55dd8b['id']});if(_0x4a0f2f!==_0xa287('0x7a')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x55dd8b['id'],'UserId':_0x19b55d},'transaction':_0x4dd777});});return Promise[_0xa287('0x8f')](_0x73acc);});});return Promise[_0xa287('0x8f')](_0x50597c);});});return Promise[_0xa287('0x8f')](_0x420e2a)[_0xa287('0x3e')](function(){return _0x5ef507[_0xa287('0x92')](_0x39e693,{'transaction':_0x4dd777});})[_0xa287('0x3e')](function(){return db[_0xa287('0x68')][_0xa287('0x73')]({'where':{'teamId':_0x30f24e}})[_0xa287('0x3e')](function(_0x755250){if(_0x755250){var _0x222097=_[_0xa287('0x2a')](_0x39e693,function(_0x3c05e6){db['UserVoicePrefix'][_0xa287('0x59')]({'where':{'UserId':_0x3c05e6,'VoicePrefixId':_0x755250[_0xa287('0x69')]}});});return Promise[_0xa287('0x8f')](_0x222097);}});});});}})[_0xa287('0x3e')](respondWithStatusCode(_0x30a8a8,null))[_0xa287('0x47')](handleError(_0x30a8a8,null));};exports[_0xa287('0x95')]=function(_0xb11ab5,_0x367398,_0x276cca){var _0x3376a6={};var _0x185fdf={};var _0x46aed0;var _0xfa7c3d;return db[_0xa287('0x2b')]['findOne']({'where':{'id':_0xb11ab5[_0xa287('0x74')]['id']}})[_0xa287('0x3e')](handleEntityNotFound(_0x367398,null))[_0xa287('0x3e')](function(_0x232828){if(_0x232828){_0x46aed0=_0x232828;_0x185fdf[_0xa287('0x2e')]=_['keys'](db[_0xa287('0x83')]['rawAttributes']);_0x185fdf[_0xa287('0x30')]=_[_0xa287('0x44')](_0xb11ab5['query']);_0x185fdf[_0xa287('0x31')]=_[_0xa287('0x32')](_0x185fdf[_0xa287('0x2e')],_0x185fdf[_0xa287('0x30')]);_0x3376a6[_0xa287('0x33')]=_[_0xa287('0x32')](_0x185fdf['model'],qs[_0xa287('0x34')](_0xb11ab5['query'][_0xa287('0x34')]));_0x3376a6['attributes']=_0x3376a6[_0xa287('0x33')][_0xa287('0x35')]?_0x3376a6[_0xa287('0x33')]:_0x185fdf['model'];_0x3376a6[_0xa287('0x37')]=qs['sort'](_0xb11ab5[_0xa287('0x30')][_0xa287('0x38')]);_0x3376a6[_0xa287('0x39')]=qs['filters'](_[_0xa287('0x3a')](_0xb11ab5[_0xa287('0x30')],_0x185fdf['filters']));if(_0xb11ab5['query'][_0xa287('0x3c')]){_0x3376a6[_0xa287('0x39')]=_[_0xa287('0x3b')](_0x3376a6[_0xa287('0x39')],{'$or':_['map'](_0x3376a6['attributes'],function(_0x3e6656){var _0x1e5422={};_0x1e5422[_0x3e6656]={'$like':'%'+_0xb11ab5['query'][_0xa287('0x3c')]+'%'};return _0x1e5422;})});}_0x3376a6=_[_0xa287('0x3b')]({},_0x3376a6,_0xb11ab5[_0xa287('0x3d')]);return _0x46aed0[_0xa287('0x95')](_0x3376a6);}})[_0xa287('0x3e')](function(_0x2cd6ec){if(_0x2cd6ec){_0xfa7c3d=_0x2cd6ec[_0xa287('0x35')];if(!_0xb11ab5[_0xa287('0x30')][_0xa287('0x36')](_0xa287('0x96'))){_0x3376a6[_0xa287('0x22')]=qs[_0xa287('0x22')](_0xb11ab5[_0xa287('0x30')]['limit']);_0x3376a6['offset']=qs[_0xa287('0x20')](_0xb11ab5[_0xa287('0x30')][_0xa287('0x20')]);}return _0x46aed0[_0xa287('0x95')](_0x3376a6);}})[_0xa287('0x3e')](function(_0x388ad0){if(_0x388ad0){return _0x388ad0?{'count':_0xfa7c3d,'rows':_0x388ad0}:null;}})[_0xa287('0x3e')](respondWithResult(_0x367398,null))[_0xa287('0x47')](handleError(_0x367398,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 303c3d4..502c86d 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 _0x01ad=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01ad,0x6a));var _0xd01a=function(_0x1b8baf,_0x29b919){_0x1b8baf=_0x1b8baf-0x0;var _0x41d2f4=_0x01ad[_0x1b8baf];return _0x41d2f4;};'use strict';var EventEmitter=require(_0xd01a('0x0'));var Team=require(_0xd01a('0x1'))['db'][_0xd01a('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xd01a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd01a('0x4'),'afterDestroy':_0xd01a('0x5')};function emitEvent(_0x275148){return function(_0x29fc89,_0x3229c7,_0x240140){TeamEvents[_0xd01a('0x6')](_0x275148+':'+_0x29fc89['id'],_0x29fc89);TeamEvents[_0xd01a('0x6')](_0x275148,_0x29fc89);_0x240140(null);};}for(var e in events){if(events[_0xd01a('0x7')](e)){var event=events[e];Team[_0xd01a('0x8')](e,emitEvent(event));}}module[_0xd01a('0x9')]=TeamEvents; \ No newline at end of file +var _0x8179=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners'];(function(_0x1b704c,_0x4f1d48){var _0x5ad55c=function(_0x3667c5){while(--_0x3667c5){_0x1b704c['push'](_0x1b704c['shift']());}};_0x5ad55c(++_0x4f1d48);}(_0x8179,0x12f));var _0x9817=function(_0x8e4ee4,_0x4eea31){_0x8e4ee4=_0x8e4ee4-0x0;var _0x55af05=_0x8179[_0x8e4ee4];return _0x55af05;};'use strict';var EventEmitter=require('events');var Team=require(_0x9817('0x0'))['db'][_0x9817('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x9817('0x2')](0x0);var events={'afterCreate':_0x9817('0x3'),'afterUpdate':'update','afterDestroy':_0x9817('0x4')};function emitEvent(_0x5b44eb){return function(_0x37ad08,_0x3590d6,_0x162026){TeamEvents['emit'](_0x5b44eb+':'+_0x37ad08['id'],_0x37ad08);TeamEvents[_0x9817('0x5')](_0x5b44eb,_0x37ad08);_0x162026(null);};}for(var e in events){if(events[_0x9817('0x6')](e)){var event=events[e];Team[_0x9817('0x7')](e,emitEvent(event));}}module[_0x9817('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 83202e5..fbf7132 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 _0x90c3=['./team.attributes','get','Queues','then','map','catch','exports','define','Team','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','lodash'];(function(_0x16b98e,_0x4ad8eb){var _0x52df20=function(_0x1e379e){while(--_0x1e379e){_0x16b98e['push'](_0x16b98e['shift']());}};_0x52df20(++_0x4ad8eb);}(_0x90c3,0x155));var _0x390c=function(_0x12d204,_0x42cab3){_0x12d204=_0x12d204-0x0;var _0x3a3e8d=_0x90c3[_0x12d204];return _0x3a3e8d;};'use strict';var _=require(_0x390c('0x0'));var attributes=require(_0x390c('0x1'));function getQueuesByChannel(_0x3199da,_0x173960){var _0x37552f=_0x390c('0x2')+_0x173960+_0x390c('0x3');return _0x3199da[_0x37552f]()[_0x390c('0x4')](function(_0xb40fbf){return _[_0x390c('0x5')](_0xb40fbf,function(_0x1e2a9b){_0x1e2a9b['setDataValue']('channel',_0x173960);return _0x1e2a9b;});})[_0x390c('0x6')](function(_0x104050){throw _0x104050;});}module[_0x390c('0x7')]=function(_0x3b8f09){return _0x3b8f09[_0x390c('0x8')](_0x390c('0x9'),attributes,{'tableName':_0x390c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5394d1=this;var _0x18a039=[_0x390c('0xb'),_0x390c('0xc'),'Mail',_0x390c('0xd'),_0x390c('0xe'),_0x390c('0xf'),_0x390c('0x10')];return Promise[_0x390c('0x11')]()[_0x390c('0x4')](function(){var _0x3cf9d3=_[_0x390c('0x5')](_0x18a039,function(_0x36cab7){return getQueuesByChannel(_0x5394d1,_0x36cab7);});return Promise['all'](_0x3cf9d3);})[_0x390c('0x6')](function(_0x506ff4){throw _0x506ff4;});}}});}; \ No newline at end of file +var _0x0d75=['Team','teams','Chat','Mail','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','Queues','exports','define'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x0d75,0x118));var _0x50d7=function(_0x46814b,_0x3a41a4){_0x46814b=_0x46814b-0x0;var _0x3a8378=_0x0d75[_0x46814b];return _0x3a8378;};'use strict';var _=require(_0x50d7('0x0'));var attributes=require(_0x50d7('0x1'));function getQueuesByChannel(_0x25c0d0,_0x1e9338){var _0x18f2cb='get'+_0x1e9338+_0x50d7('0x2');return _0x25c0d0[_0x18f2cb]()['then'](function(_0x26cd5a){return _['map'](_0x26cd5a,function(_0x599c1d){_0x599c1d['setDataValue']('channel',_0x1e9338);return _0x599c1d;});})['catch'](function(_0x2bd335){throw _0x2bd335;});}module[_0x50d7('0x3')]=function(_0x1605dc){return _0x1605dc[_0x50d7('0x4')](_0x50d7('0x5'),attributes,{'tableName':_0x50d7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x429690=this;var _0x274b79=[_0x50d7('0x7'),'Fax',_0x50d7('0x8'),'Openchannel',_0x50d7('0x9'),_0x50d7('0xa'),_0x50d7('0xb')];return Promise[_0x50d7('0xc')]()['then'](function(){var _0x55e8fb=_['map'](_0x274b79,function(_0x16f9c6){return getQueuesByChannel(_0x429690,_0x16f9c6);});return Promise[_0x50d7('0xd')](_0x55e8fb);})[_0x50d7('0xe')](function(_0x521749){throw _0x521749;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4e67e45..ab658e1 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 _0x1f07=['debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./team.socket','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x421f91,_0x58e5f4){var _0x2fc1f0=function(_0x133641){while(--_0x133641){_0x421f91['push'](_0x421f91['shift']());}};_0x2fc1f0(++_0x58e5f4);}(_0x1f07,0x74));var _0x71f0=function(_0x46fc58,_0x431bad){_0x46fc58=_0x46fc58-0x0;var _0x785715=_0x1f07[_0x46fc58];return _0x785715;};'use strict';var _=require('lodash');var util=require(_0x71f0('0x0'));var moment=require(_0x71f0('0x1'));var BPromise=require(_0x71f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71f0('0x3'))['db'];var utils=require(_0x71f0('0x4'));var logger=require(_0x71f0('0x5'))(_0x71f0('0x6'));var config=require(_0x71f0('0x7'));var jayson=require(_0x71f0('0x8'));var client=jayson[_0x71f0('0x9')]['http']({'port':0x232a});config[_0x71f0('0xa')]=_[_0x71f0('0xb')](config[_0x71f0('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x71f0('0xc'))(new Redis(config[_0x71f0('0xa')]));require(_0x71f0('0xd'))['register'](socket);function respondWithRpcPromise(_0x176461,_0x29cb3a,_0x10aff5){return new BPromise(function(_0x35ba2b,_0x4fcf6f){return client['request'](_0x176461,_0x10aff5)['then'](function(_0x4ab8da){logger['info'](_0x71f0('0xe'),_0x29cb3a,_0x71f0('0xf'));logger[_0x71f0('0x10')](_0x71f0('0x11'),_0x29cb3a,_0x71f0('0xf'),JSON['stringify'](_0x4ab8da));if(_0x4ab8da[_0x71f0('0x12')]){if(_0x4ab8da['error'][_0x71f0('0x13')]===0x1f4){logger[_0x71f0('0x12')](_0x71f0('0xe'),_0x29cb3a,_0x4ab8da[_0x71f0('0x12')][_0x71f0('0x14')]);return _0x4fcf6f(_0x4ab8da[_0x71f0('0x12')][_0x71f0('0x14')]);}logger[_0x71f0('0x12')]('Team,\x20%s,\x20%s',_0x29cb3a,_0x4ab8da[_0x71f0('0x12')][_0x71f0('0x14')]);return _0x35ba2b(_0x4ab8da[_0x71f0('0x12')][_0x71f0('0x14')]);}else{logger[_0x71f0('0x15')](_0x71f0('0xe'),_0x29cb3a,_0x71f0('0xf'));_0x35ba2b(_0x4ab8da['result'][_0x71f0('0x14')]);}})['catch'](function(_0x18ab83){logger[_0x71f0('0x12')](_0x71f0('0xe'),_0x29cb3a,_0x18ab83);_0x4fcf6f(_0x18ab83);});});} \ No newline at end of file +var _0x62cc=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','Team,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x62cc,0xbd));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc62c('0x0'));var util=require(_0xc62c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc62c('0x2'));var fs=require('fs');var Redis=require(_0xc62c('0x3'));var db=require(_0xc62c('0x4'))['db'];var utils=require(_0xc62c('0x5'));var logger=require(_0xc62c('0x6'))(_0xc62c('0x7'));var config=require(_0xc62c('0x8'));var jayson=require(_0xc62c('0x9'));var client=jayson[_0xc62c('0xa')][_0xc62c('0xb')]({'port':0x232a});config['redis']=_[_0xc62c('0xc')](config['redis'],{'host':_0xc62c('0xd'),'port':0x18eb});var socket=require(_0xc62c('0xe'))(new Redis(config['redis']));require('./team.socket')[_0xc62c('0xf')](socket);function respondWithRpcPromise(_0x3cf9d2,_0x5a615e,_0x34b6de){return new BPromise(function(_0x118050,_0x3e9eb9){return client[_0xc62c('0x10')](_0x3cf9d2,_0x34b6de)[_0xc62c('0x11')](function(_0x2a6bd7){logger[_0xc62c('0x12')]('Team,\x20%s,\x20%s',_0x5a615e,_0xc62c('0x13'));logger[_0xc62c('0x14')](_0xc62c('0x15'),_0x5a615e,'request\x20sent',JSON[_0xc62c('0x16')](_0x2a6bd7));if(_0x2a6bd7[_0xc62c('0x17')]){if(_0x2a6bd7['error']['code']===0x1f4){logger[_0xc62c('0x17')]('Team,\x20%s,\x20%s',_0x5a615e,_0x2a6bd7[_0xc62c('0x17')][_0xc62c('0x18')]);return _0x3e9eb9(_0x2a6bd7[_0xc62c('0x17')][_0xc62c('0x18')]);}logger[_0xc62c('0x17')]('Team,\x20%s,\x20%s',_0x5a615e,_0x2a6bd7[_0xc62c('0x17')]['message']);return _0x118050(_0x2a6bd7['error'][_0xc62c('0x18')]);}else{logger[_0xc62c('0x12')](_0xc62c('0x19'),_0x5a615e,_0xc62c('0x13'));_0x118050(_0x2a6bd7[_0xc62c('0x1a')][_0xc62c('0x18')]);}})[_0xc62c('0x1b')](function(_0x4892a3){logger[_0xc62c('0x17')]('Team,\x20%s,\x20%s',_0x5a615e,_0x4892a3);_0x3e9eb9(_0x4892a3);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a2c6ad5..8c12ab9 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 _0xa883=['./team.events','save','remove','update','removeListener','length'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xa883,0x1f2));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x3a88('0x0'));var events=[_0x3a88('0x1'),_0x3a88('0x2'),_0x3a88('0x3')];function createListener(_0x372d15,_0x1ab838){return function(_0x3ac823){_0x1ab838['emit'](_0x372d15,_0x3ac823);};}function removeListener(_0x56e80e,_0x260c40){return function(){TeamEvents[_0x3a88('0x4')](_0x56e80e,_0x260c40);};}exports['register']=function(_0x21f120){for(var _0x23a4c0=0x0,_0x12d2bc=events[_0x3a88('0x5')];_0x23a4c0<_0x12d2bc;_0x23a4c0++){var _0x37ca80=events[_0x23a4c0];var _0x132a5a=createListener('team:'+_0x37ca80,_0x21f120);TeamEvents['on'](_0x37ca80,_0x132a5a);}}; \ No newline at end of file +var _0x00da=['length','./team.events','save','update','emit','removeListener'];(function(_0x1e45d0,_0x3c2ccc){var _0x557cc6=function(_0x55305a){while(--_0x55305a){_0x1e45d0['push'](_0x1e45d0['shift']());}};_0x557cc6(++_0x3c2ccc);}(_0x00da,0x1cf));var _0xa00d=function(_0x2b1fff,_0xb6a139){_0x2b1fff=_0x2b1fff-0x0;var _0x249a1e=_0x00da[_0x2b1fff];return _0x249a1e;};'use strict';var TeamEvents=require(_0xa00d('0x0'));var events=[_0xa00d('0x1'),'remove',_0xa00d('0x2')];function createListener(_0x457042,_0x5de680){return function(_0x55114d){_0x5de680[_0xa00d('0x3')](_0x457042,_0x55114d);};}function removeListener(_0x4971df,_0x333fdc){return function(){TeamEvents[_0xa00d('0x4')](_0x4971df,_0x333fdc);};}exports['register']=function(_0x4ea212){for(var _0x20f467=0x0,_0x5b9123=events[_0xa00d('0x5')];_0x20f467<_0x5b9123;_0x20f467++){var _0x482ff0=events[_0x20f467];var _0x37525d=createListener('team:'+_0x482ff0,_0x4ea212);TeamEvents['on'](_0x482ff0,_0x37525d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 81c4221..03a5e93 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 _0x85d3=['sequelize','exports'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x85d3,0xc8));var _0x385d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x85d3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x385d('0x0'));module[_0x385d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2bdb=['INTEGER','sequelize'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2bdb,0x105));var _0xb2bd=function(_0x28cdcb,_0x51045f){_0x28cdcb=_0x28cdcb-0x0;var _0x1fa8ef=_0x2bdb[_0x28cdcb];return _0x1fa8ef;};'use strict';var Sequelize=require(_0xb2bd('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xb2bd('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 1ddb310..4d52d33 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 _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x24d7cf,_0x1b7580){var _0x1d2eec=function(_0xb620d){while(--_0xb620d){_0x24d7cf['push'](_0x24d7cf['shift']());}};_0x1d2eec(++_0x1b7580);}(_0xd914,0x17f));var _0x4d91=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0xd914[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa699=['TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0xdad179,_0x230542){var _0x38242e=function(_0x2fe5c0){while(--_0x2fe5c0){_0xdad179['push'](_0xdad179['shift']());}};_0x38242e(++_0x230542);}(_0xa699,0x6b));var _0x9a69=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xa699[_0x582274];return _0x8f14d3;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));var moment=require(_0x9a69('0x4'));var BPromise=require(_0x9a69('0x5'));var rp=require(_0x9a69('0x6'));var fs=require('fs');var path=require(_0x9a69('0x7'));var rimraf=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var attributes=require(_0x9a69('0xa'));module[_0x9a69('0xb')]=function(_0x15f2fc,_0x58eb4d){return _0x15f2fc[_0x9a69('0xc')](_0x9a69('0xd'),attributes,{'tableName':_0x9a69('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index aae58f4..ea02f3f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xa1e3ca,_0x559022){var _0x5005ab=function(_0x12f90e){while(--_0x12f90e){_0xa1e3ca['push'](_0xa1e3ca['shift']());}};_0x5005ab(++_0x559022);}(_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(_0x5a433c,_0x423be6){var _0x310003=function(_0x293dc2){while(--_0x293dc2){_0x5a433c['push'](_0x5a433c['shift']());}};_0x310003(++_0x423be6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 817ee9b..6304590 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 _0x9fcf=['INTEGER','exports'];(function(_0x46a680,_0x10669c){var _0x4b6d4c=function(_0x5eab1e){while(--_0x5eab1e){_0x46a680['push'](_0x46a680['shift']());}};_0x4b6d4c(++_0x10669c);}(_0x9fcf,0x1a9));var _0xf9fc=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x9fcf[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require('sequelize');module[_0xf9fc('0x0')]={'penalty':{'type':Sequelize[_0xf9fc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c59=['exports','INTEGER','sequelize'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x1c59,0x18e));var _0x91c5=function(_0x222f6a,_0x531479){_0x222f6a=_0x222f6a-0x0;var _0x5dfc93=_0x1c59[_0x222f6a];return _0x5dfc93;};'use strict';var Sequelize=require(_0x91c5('0x0'));module[_0x91c5('0x1')]={'penalty':{'type':Sequelize[_0x91c5('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 d7ac569..74b999e 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 _0xd737=['moment','bluebird','request-promise','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger'];(function(_0x3c0e8e,_0x4c743a){var _0x340ae4=function(_0x4b0024){while(--_0x4b0024){_0x3c0e8e['push'](_0x3c0e8e['shift']());}};_0x340ae4(++_0x4c743a);}(_0xd737,0x85));var _0x7d73=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xd737[_0x6173fc];return _0x965fbe;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var logger=require(_0x7d73('0x1'))('api');var moment=require(_0x7d73('0x2'));var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d73('0x5'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0xaa37cc,_0x20b8a9){return _0xaa37cc[_0x7d73('0x6')](_0x7d73('0x7'),attributes,{'tableName':_0x7d73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c3=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index a15a9d7..e378ea2 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 _0x6697=['client','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x6697,0x1c3));var _0x7669=function(_0x493523,_0x266929){_0x493523=_0x493523-0x0;var _0x14fa52=_0x6697[_0x493523];return _0x14fa52;};'use strict';var _=require(_0x7669('0x0'));var util=require(_0x7669('0x1'));var moment=require(_0x7669('0x2'));var BPromise=require(_0x7669('0x3'));var rs=require(_0x7669('0x4'));var fs=require('fs');var Redis=require(_0x7669('0x5'));var db=require(_0x7669('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7669('0x7'))(_0x7669('0x8'));var config=require(_0x7669('0x9'));var jayson=require(_0x7669('0xa'));var client=jayson[_0x7669('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8d64,_0x4765ba,_0x23e080){return new BPromise(function(_0x40a096,_0x2721c1){return client[_0x7669('0xc')](_0x2a8d64,_0x23e080)[_0x7669('0xd')](function(_0x8348ea){logger[_0x7669('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4765ba,_0x7669('0xf'));logger[_0x7669('0x10')](_0x7669('0x11'),_0x4765ba,_0x7669('0xf'),JSON['stringify'](_0x8348ea));if(_0x8348ea[_0x7669('0x12')]){if(_0x8348ea[_0x7669('0x12')]['code']===0x1f4){logger['error'](_0x7669('0x13'),_0x4765ba,_0x8348ea[_0x7669('0x12')]['message']);return _0x2721c1(_0x8348ea['error'][_0x7669('0x14')]);}logger['error'](_0x7669('0x13'),_0x4765ba,_0x8348ea[_0x7669('0x12')]['message']);return _0x40a096(_0x8348ea['error'][_0x7669('0x14')]);}else{logger[_0x7669('0xe')](_0x7669('0x13'),_0x4765ba,_0x7669('0xf'));_0x40a096(_0x8348ea['result']['message']);}})[_0x7669('0x15')](function(_0x548b14){logger[_0x7669('0x12')](_0x7669('0x13'),_0x4765ba,_0x548b14);_0x2721c1(_0x548b14);});});} \ No newline at end of file +var _0xa403=['../../config/environment','jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x38f86b,_0x45b662){var _0x10832f=function(_0x35f66a){while(--_0x35f66a){_0x38f86b['push'](_0x38f86b['shift']());}};_0x10832f(++_0x45b662);}(_0xa403,0x1f2));var _0x3a40=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0xa403[_0x104a84];return _0x4973ff;};'use strict';var _=require('lodash');var util=require(_0x3a40('0x0'));var moment=require(_0x3a40('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a40('0x2'));var fs=require('fs');var Redis=require(_0x3a40('0x3'));var db=require(_0x3a40('0x4'))['db'];var utils=require(_0x3a40('0x5'));var logger=require(_0x3a40('0x6'))(_0x3a40('0x7'));var config=require(_0x3a40('0x8'));var jayson=require(_0x3a40('0x9'));var client=jayson[_0x3a40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a24ff,_0x5c0823,_0x42245f){return new BPromise(function(_0x58b46b,_0x3fcda8){return client['request'](_0x1a24ff,_0x42245f)[_0x3a40('0xb')](function(_0x2045b5){logger['info'](_0x3a40('0xc'),_0x5c0823,_0x3a40('0xd'));logger[_0x3a40('0xe')](_0x3a40('0xf'),_0x5c0823,_0x3a40('0xd'),JSON['stringify'](_0x2045b5));if(_0x2045b5[_0x3a40('0x10')]){if(_0x2045b5[_0x3a40('0x10')][_0x3a40('0x11')]===0x1f4){logger[_0x3a40('0x10')](_0x3a40('0xc'),_0x5c0823,_0x2045b5[_0x3a40('0x10')][_0x3a40('0x12')]);return _0x3fcda8(_0x2045b5['error'][_0x3a40('0x12')]);}logger[_0x3a40('0x10')](_0x3a40('0xc'),_0x5c0823,_0x2045b5['error'][_0x3a40('0x12')]);return _0x58b46b(_0x2045b5[_0x3a40('0x10')][_0x3a40('0x12')]);}else{logger[_0x3a40('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c0823,_0x3a40('0xd'));_0x58b46b(_0x2045b5[_0x3a40('0x14')][_0x3a40('0x12')]);}})[_0x3a40('0x15')](function(_0x20ac05){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5c0823,_0x20ac05);_0x3fcda8(_0x20ac05);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8f5a776..81c5361 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 _0xfd49=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','isAuthenticated','post','create','put'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0xfd49,0x121));var _0x9fd4=function(_0x400325,_0x40c072){_0x400325=_0x400325-0x0;var _0x15c619=_0xfd49[_0x400325];return _0x15c619;};'use strict';var multer=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var path=require(_0x9fd4('0x2'));var timeout=require(_0x9fd4('0x3'));var express=require(_0x9fd4('0x4'));var router=express['Router']();var fs_extra=require(_0x9fd4('0x5'));var auth=require(_0x9fd4('0x6'));var interaction=require(_0x9fd4('0x7'));var config=require(_0x9fd4('0x8'));var controller=require(_0x9fd4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9fd4('0xa')]);router['get']('/:id',auth[_0x9fd4('0xb')](),controller['show']);router[_0x9fd4('0xc')]('/',auth['isAuthenticated'](),controller[_0x9fd4('0xd')]);router[_0x9fd4('0xe')]('/:id',auth[_0x9fd4('0xb')](),controller[_0x9fd4('0xf')]);router[_0x9fd4('0x10')]('/:id',auth[_0x9fd4('0xb')](),controller[_0x9fd4('0x11')]);module[_0x9fd4('0x12')]=router; \ No newline at end of file +var _0x5d0a=['./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0x5d0a,0x175));var _0xa5d0=function(_0x749def,_0x3e99c8){_0x749def=_0x749def-0x0;var _0x8331c2=_0x5d0a[_0x749def];return _0x8331c2;};'use strict';var multer=require(_0xa5d0('0x0'));var util=require('util');var path=require(_0xa5d0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5d0('0x2'));var router=express[_0xa5d0('0x3')]();var fs_extra=require(_0xa5d0('0x4'));var auth=require(_0xa5d0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa5d0('0x6'));var controller=require(_0xa5d0('0x7'));router[_0xa5d0('0x8')]('/',auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xa')]);router[_0xa5d0('0x8')](_0xa5d0('0xb'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xc')]);router[_0xa5d0('0xd')]('/',auth[_0xa5d0('0x9')](),controller['create']);router[_0xa5d0('0xe')](_0xa5d0('0xb'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0xf')]);router[_0xa5d0('0x10')](_0xa5d0('0xb'),auth[_0xa5d0('0x9')](),controller[_0xa5d0('0x11')]);module[_0xa5d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ded6d60..c33bd5b 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 _0xf266=['exports','sequelize'];(function(_0x50e4ed,_0x20596d){var _0x1c2b66=function(_0x5b9203){while(--_0x5b9203){_0x50e4ed['push'](_0x50e4ed['shift']());}};_0x1c2b66(++_0x20596d);}(_0xf266,0x163));var _0x6f26=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xf266[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x6f26('0x0'));module[_0x6f26('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3ae7=['sequelize','exports','STRING','TEXT'];(function(_0x38750a,_0x316de4){var _0x92e34a=function(_0x4f83e1){while(--_0x4f83e1){_0x38750a['push'](_0x38750a['shift']());}};_0x92e34a(++_0x316de4);}(_0x3ae7,0x1a0));var _0x73ae=function(_0x36f156,_0x20df7d){_0x36f156=_0x36f156-0x0;var _0x4727a1=_0x3ae7[_0x36f156];return _0x4727a1;};'use strict';var Sequelize=require(_0x73ae('0x0'));module[_0x73ae('0x1')]={'name':{'type':Sequelize[_0x73ae('0x2')]},'description':{'type':Sequelize[_0x73ae('0x2')]},'html':{'type':Sequelize[_0x73ae('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index b7ec7f9..10fb2a2 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 _0x7ad7=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','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','set','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find'];(function(_0x5b0d67,_0x21916c){var _0x32377a=function(_0x112394){while(--_0x112394){_0x5b0d67['push'](_0x5b0d67['shift']());}};_0x32377a(++_0x21916c);}(_0x7ad7,0x114));var _0x77ad=function(_0x30ae49,_0x1a482a){_0x30ae49=_0x30ae49-0x0;var _0x493b0b=_0x7ad7[_0x30ae49];return _0x493b0b;};'use strict';var emlformat=require(_0x77ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x77ad('0x1'));var jsonpatch=require(_0x77ad('0x2'));var rp=require(_0x77ad('0x3'));var moment=require(_0x77ad('0x4'));var BPromise=require(_0x77ad('0x5'));var Mustache=require(_0x77ad('0x6'));var util=require('util');var path=require(_0x77ad('0x7'));var sox=require(_0x77ad('0x8'));var csv=require(_0x77ad('0x9'));var ejs=require(_0x77ad('0xa'));var fs=require('fs');var fs_extra=require(_0x77ad('0xb'));var _=require(_0x77ad('0xc'));var squel=require(_0x77ad('0xd'));var crypto=require(_0x77ad('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x77ad('0xf'));var toCsv=require(_0x77ad('0x9'));var querystring=require(_0x77ad('0x10'));var Papa=require(_0x77ad('0x11'));var Redis=require(_0x77ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x77ad('0x13'));var as=require(_0x77ad('0x14'));var hardwareService=require(_0x77ad('0x15'));var logger=require(_0x77ad('0x16'))(_0x77ad('0x17'));var utils=require('../../config/utils');var config=require(_0x77ad('0x18'));var licenseUtil=require(_0x77ad('0x19'));var db=require(_0x77ad('0x1a'))['db'];function respondWithStatusCode(_0x48d000,_0x1fbb4a){_0x1fbb4a=_0x1fbb4a||0xcc;return function(_0x327f75){if(_0x327f75){return _0x48d000[_0x77ad('0x1b')](_0x1fbb4a);}return _0x48d000[_0x77ad('0x1c')](_0x1fbb4a)[_0x77ad('0x1d')]();};}function respondWithResult(_0x2fdf16,_0x3a42d9){_0x3a42d9=_0x3a42d9||0xc8;return function(_0x35aac4){if(_0x35aac4){return _0x2fdf16['status'](_0x3a42d9)[_0x77ad('0x1e')](_0x35aac4);}};}function respondWithFilteredResult(_0x3f003e,_0x3cccb8){return function(_0x168e00){if(_0x168e00){var _0xff26e7=typeof _0x3cccb8[_0x77ad('0x1f')]==='undefined'&&typeof _0x3cccb8['limit']===_0x77ad('0x20');var _0x17104c=_0x168e00[_0x77ad('0x21')];var _0x52d09e=_0xff26e7?0x0:_0x3cccb8[_0x77ad('0x1f')];var _0x404570=_0xff26e7?_0x168e00[_0x77ad('0x21')]:_0x3cccb8[_0x77ad('0x1f')]+_0x3cccb8['limit'];var _0x1749eb;if(_0x404570>=_0x17104c){_0x404570=_0x17104c;_0x1749eb=0xc8;}else{_0x1749eb=0xce;}_0x3f003e[_0x77ad('0x1c')](_0x1749eb);return _0x3f003e[_0x77ad('0x22')]('Content-Range',_0x52d09e+'-'+_0x404570+'/'+_0x17104c)[_0x77ad('0x1e')](_0x168e00);}return null;};}function patchUpdates(_0x57c3ff){return function(_0xb8e720){try{jsonpatch['apply'](_0xb8e720,_0x57c3ff,!![]);}catch(_0x9bced){return BPromise[_0x77ad('0x23')](_0x9bced);}return _0xb8e720[_0x77ad('0x24')]();};}function saveUpdates(_0x5e6fbf,_0xa8eecf){return function(_0x1eea26){if(_0x1eea26){return _0x1eea26[_0x77ad('0x25')](_0x5e6fbf)[_0x77ad('0x26')](function(_0x1cb18a){return _0x1cb18a;});}return null;};}function removeEntity(_0x3b4d4a,_0x2f8f93){return function(_0x53c936){if(_0x53c936){return _0x53c936[_0x77ad('0x27')]()[_0x77ad('0x26')](function(){var _0x3a6c74=_0x53c936[_0x77ad('0x28')]({'plain':!![]});var _0x14ad9d=_0x77ad('0x29');return db[_0x77ad('0x2a')]['destroy']({'where':{'type':_0x14ad9d,'resourceId':_0x3a6c74['id']}})[_0x77ad('0x26')](function(){return _0x53c936;});})[_0x77ad('0x26')](function(){_0x3b4d4a[_0x77ad('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dded5,_0xebd5ed){return function(_0x145848){if(!_0x145848){_0x4dded5[_0x77ad('0x1b')](0x194);}return _0x145848;};}function handleError(_0xbde9ef,_0x1a18b8){_0x1a18b8=_0x1a18b8||0x1f4;return function(_0x1f2d6d){logger[_0x77ad('0x2b')](_0x1f2d6d[_0x77ad('0x2c')]);if(_0x1f2d6d[_0x77ad('0x2d')]){delete _0x1f2d6d[_0x77ad('0x2d')];}_0xbde9ef[_0x77ad('0x1c')](_0x1a18b8)[_0x77ad('0x2e')](_0x1f2d6d);};}exports[_0x77ad('0x2f')]=function(_0x1e55e4,_0xb47f39){var _0x32b5c6={},_0x462c68={},_0x409567={'count':0x0,'rows':[]};var _0x445528=_['map'](db[_0x77ad('0x30')][_0x77ad('0x31')],function(_0x406b18){return{'name':_0x406b18[_0x77ad('0x32')],'type':_0x406b18[_0x77ad('0x33')]['key']};});_0x462c68[_0x77ad('0x34')]=_[_0x77ad('0x35')](_0x445528,_0x77ad('0x2d'));_0x462c68['query']=_[_0x77ad('0x36')](_0x1e55e4[_0x77ad('0x37')]);_0x462c68[_0x77ad('0x38')]=_[_0x77ad('0x39')](_0x462c68['model'],_0x462c68[_0x77ad('0x37')]);_0x32b5c6[_0x77ad('0x3a')]=_[_0x77ad('0x39')](_0x462c68[_0x77ad('0x34')],qs[_0x77ad('0x3b')](_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x3b')]));_0x32b5c6[_0x77ad('0x3a')]=_0x32b5c6[_0x77ad('0x3a')][_0x77ad('0x3c')]?_0x32b5c6['attributes']:_0x462c68[_0x77ad('0x34')];if(!_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x3d')](_0x77ad('0x3e'))){_0x32b5c6['limit']=qs[_0x77ad('0x3f')](_0x1e55e4['query'][_0x77ad('0x3f')]);_0x32b5c6['offset']=qs['offset'](_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x1f')]);}_0x32b5c6[_0x77ad('0x40')]=qs[_0x77ad('0x41')](_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x41')]);_0x32b5c6[_0x77ad('0x42')]=qs[_0x77ad('0x38')](_[_0x77ad('0x43')](_0x1e55e4['query'],_0x462c68['filters']),_0x445528);if(_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x44')]){_0x32b5c6[_0x77ad('0x42')]=_[_0x77ad('0x45')](_0x32b5c6[_0x77ad('0x42')],{'$or':_[_0x77ad('0x35')](_0x445528,function(_0x4247c9){if(_0x4247c9[_0x77ad('0x33')]!==_0x77ad('0x46')){var _0x18c26f={};_0x18c26f[_0x4247c9[_0x77ad('0x2d')]]={'$like':'%'+_0x1e55e4[_0x77ad('0x37')][_0x77ad('0x44')]+'%'};return _0x18c26f;}})});}_0x32b5c6=_['merge']({},_0x32b5c6,_0x1e55e4['options']);var _0x29cdcd={'where':_0x32b5c6[_0x77ad('0x42')]};return db['Template']['count'](_0x29cdcd)[_0x77ad('0x26')](function(_0x37710e){_0x409567[_0x77ad('0x21')]=_0x37710e;if(_0x1e55e4['query']['includeAll']){_0x32b5c6[_0x77ad('0x47')]=[{'all':!![]}];}return db[_0x77ad('0x30')][_0x77ad('0x48')](_0x32b5c6);})['then'](function(_0x1f469e){_0x409567[_0x77ad('0x49')]=_0x1f469e;return _0x409567;})[_0x77ad('0x26')](respondWithFilteredResult(_0xb47f39,_0x32b5c6))[_0x77ad('0x4a')](handleError(_0xb47f39,null));};exports[_0x77ad('0x4b')]=function(_0x1eacb6,_0x28791f){var _0x21ce38={'raw':!![],'where':{'id':_0x1eacb6[_0x77ad('0x4c')]['id']}},_0xecd4c7={};_0xecd4c7['model']=_[_0x77ad('0x36')](db[_0x77ad('0x30')][_0x77ad('0x31')]);_0xecd4c7[_0x77ad('0x37')]=_[_0x77ad('0x36')](_0x1eacb6['query']);_0xecd4c7[_0x77ad('0x38')]=_[_0x77ad('0x39')](_0xecd4c7[_0x77ad('0x34')],_0xecd4c7[_0x77ad('0x37')]);_0x21ce38[_0x77ad('0x3a')]=_[_0x77ad('0x39')](_0xecd4c7[_0x77ad('0x34')],qs[_0x77ad('0x3b')](_0x1eacb6[_0x77ad('0x37')][_0x77ad('0x3b')]));_0x21ce38[_0x77ad('0x3a')]=_0x21ce38[_0x77ad('0x3a')]['length']?_0x21ce38[_0x77ad('0x3a')]:_0xecd4c7[_0x77ad('0x34')];if(_0x1eacb6[_0x77ad('0x37')][_0x77ad('0x4d')]){_0x21ce38[_0x77ad('0x47')]=[{'all':!![]}];}_0x21ce38=_[_0x77ad('0x45')]({},_0x21ce38,_0x1eacb6[_0x77ad('0x4e')]);return db['Template'][_0x77ad('0x4f')](_0x21ce38)['then'](handleEntityNotFound(_0x28791f,null))[_0x77ad('0x26')](respondWithResult(_0x28791f,null))[_0x77ad('0x4a')](handleError(_0x28791f,null));};exports[_0x77ad('0x50')]=function(_0x161d6b,_0x545d77){return db[_0x77ad('0x30')][_0x77ad('0x50')](_0x161d6b[_0x77ad('0x51')],{})[_0x77ad('0x26')](function(_0x5a8811){var _0x4f39c0=_0x161d6b[_0x77ad('0x52')][_0x77ad('0x28')]({'plain':!![]});if(!_0x4f39c0)throw new Error(_0x77ad('0x53'));if(_0x4f39c0[_0x77ad('0x54')]==='user'){var _0x3b64dc=_0x5a8811[_0x77ad('0x28')]({'plain':!![]});var _0x4e1d58=_0x77ad('0x29');return db[_0x77ad('0x55')][_0x77ad('0x4f')]({'where':{'name':_0x4e1d58,'userProfileId':_0x4f39c0[_0x77ad('0x56')]},'raw':!![]})[_0x77ad('0x26')](function(_0x1a002f){if(_0x1a002f&&_0x1a002f[_0x77ad('0x57')]===0x0){return db['UserProfileResource'][_0x77ad('0x50')]({'name':_0x3b64dc['name'],'resourceId':_0x3b64dc['id'],'type':_0x1a002f[_0x77ad('0x2d')],'sectionId':_0x1a002f['id']},{})['then'](function(){return _0x5a8811;});}else{return _0x5a8811;}})[_0x77ad('0x4a')](function(_0x552a77){logger[_0x77ad('0x2b')](_0x77ad('0x58'),_0x552a77);throw _0x552a77;});}return _0x5a8811;})['then'](respondWithResult(_0x545d77,0xc9))[_0x77ad('0x4a')](handleError(_0x545d77,null));};exports[_0x77ad('0x25')]=function(_0x5c3055,_0x43baf1){if(_0x5c3055[_0x77ad('0x51')]['id']){delete _0x5c3055[_0x77ad('0x51')]['id'];}return db[_0x77ad('0x30')][_0x77ad('0x4f')]({'where':{'id':_0x5c3055[_0x77ad('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43baf1,null))[_0x77ad('0x26')](saveUpdates(_0x5c3055['body'],null))[_0x77ad('0x26')](respondWithResult(_0x43baf1,null))[_0x77ad('0x4a')](handleError(_0x43baf1,null));};exports[_0x77ad('0x27')]=function(_0x4d6c65,_0x45becc){return db['Template'][_0x77ad('0x4f')]({'where':{'id':_0x4d6c65[_0x77ad('0x4c')]['id']}})[_0x77ad('0x26')](handleEntityNotFound(_0x45becc,null))[_0x77ad('0x26')](removeEntity(_0x45becc,null))['catch'](handleError(_0x45becc,null));}; \ No newline at end of file +var _0x7f54=['model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','name','index','map','Template','rawAttributes','fieldName','type'];(function(_0x230ed,_0x425805){var _0x241186=function(_0x2c472c){while(--_0x2c472c){_0x230ed['push'](_0x230ed['shift']());}};_0x241186(++_0x425805);}(_0x7f54,0x1a3));var _0x47f5=function(_0x5b2132,_0x49215e){_0x5b2132=_0x5b2132-0x0;var _0x486098=_0x7f54[_0x5b2132];return _0x486098;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47f5('0x0'));var zipdir=require(_0x47f5('0x1'));var jsonpatch=require(_0x47f5('0x2'));var rp=require('request-promise');var moment=require(_0x47f5('0x3'));var BPromise=require(_0x47f5('0x4'));var Mustache=require(_0x47f5('0x5'));var util=require(_0x47f5('0x6'));var path=require(_0x47f5('0x7'));var sox=require(_0x47f5('0x8'));var csv=require(_0x47f5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47f5('0xa'));var _=require(_0x47f5('0xb'));var squel=require(_0x47f5('0xc'));var crypto=require(_0x47f5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x47f5('0xe'));var toCsv=require(_0x47f5('0x9'));var querystring=require(_0x47f5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47f5('0x10'));var qs=require(_0x47f5('0x11'));var as=require(_0x47f5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47f5('0x13'))(_0x47f5('0x14'));var utils=require(_0x47f5('0x15'));var config=require(_0x47f5('0x16'));var licenseUtil=require(_0x47f5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d213e,_0x105c90){_0x105c90=_0x105c90||0xcc;return function(_0x4cfd56){if(_0x4cfd56){return _0x4d213e[_0x47f5('0x18')](_0x105c90);}return _0x4d213e[_0x47f5('0x19')](_0x105c90)['end']();};}function respondWithResult(_0x2735fa,_0x54c6b3){_0x54c6b3=_0x54c6b3||0xc8;return function(_0x536740){if(_0x536740){return _0x2735fa[_0x47f5('0x19')](_0x54c6b3)[_0x47f5('0x1a')](_0x536740);}};}function respondWithFilteredResult(_0x4d549c,_0x289a85){return function(_0x5de648){if(_0x5de648){var _0x571cf1=typeof _0x289a85[_0x47f5('0x1b')]===_0x47f5('0x1c')&&typeof _0x289a85[_0x47f5('0x1d')]===_0x47f5('0x1c');var _0x4ae5e8=_0x5de648[_0x47f5('0x1e')];var _0x2d0d8f=_0x571cf1?0x0:_0x289a85[_0x47f5('0x1b')];var _0x128e9b=_0x571cf1?_0x5de648['count']:_0x289a85[_0x47f5('0x1b')]+_0x289a85[_0x47f5('0x1d')];var _0x2aac37;if(_0x128e9b>=_0x4ae5e8){_0x128e9b=_0x4ae5e8;_0x2aac37=0xc8;}else{_0x2aac37=0xce;}_0x4d549c[_0x47f5('0x19')](_0x2aac37);return _0x4d549c['set'](_0x47f5('0x1f'),_0x2d0d8f+'-'+_0x128e9b+'/'+_0x4ae5e8)[_0x47f5('0x1a')](_0x5de648);}return null;};}function patchUpdates(_0x6525d0){return function(_0x53ebbb){try{jsonpatch[_0x47f5('0x20')](_0x53ebbb,_0x6525d0,!![]);}catch(_0x2026b0){return BPromise['reject'](_0x2026b0);}return _0x53ebbb['save']();};}function saveUpdates(_0x1b9c5d,_0x4ac1af){return function(_0x40c164){if(_0x40c164){return _0x40c164[_0x47f5('0x21')](_0x1b9c5d)[_0x47f5('0x22')](function(_0x2c0e30){return _0x2c0e30;});}return null;};}function removeEntity(_0x1e3158,_0x4e5829){return function(_0x163094){if(_0x163094){return _0x163094[_0x47f5('0x23')]()['then'](function(){var _0x1582ce=_0x163094['get']({'plain':!![]});var _0x4785b5='Templates';return db['UserProfileResource'][_0x47f5('0x23')]({'where':{'type':_0x4785b5,'resourceId':_0x1582ce['id']}})[_0x47f5('0x22')](function(){return _0x163094;});})[_0x47f5('0x22')](function(){_0x1e3158[_0x47f5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375cce,_0x4a278d){return function(_0x2c78cd){if(!_0x2c78cd){_0x375cce[_0x47f5('0x18')](0x194);}return _0x2c78cd;};}function handleError(_0xec2c11,_0x27f969){_0x27f969=_0x27f969||0x1f4;return function(_0x275978){logger['error'](_0x275978['stack']);if(_0x275978[_0x47f5('0x24')]){delete _0x275978['name'];}_0xec2c11[_0x47f5('0x19')](_0x27f969)['send'](_0x275978);};}exports[_0x47f5('0x25')]=function(_0x4f2c48,_0x38fa14){var _0x10e6f6={},_0x39467c={},_0x1b99ca={'count':0x0,'rows':[]};var _0x453cd8=_[_0x47f5('0x26')](db[_0x47f5('0x27')][_0x47f5('0x28')],function(_0x40c055){return{'name':_0x40c055[_0x47f5('0x29')],'type':_0x40c055[_0x47f5('0x2a')]['key']};});_0x39467c[_0x47f5('0x2b')]=_[_0x47f5('0x26')](_0x453cd8,_0x47f5('0x24'));_0x39467c['query']=_['keys'](_0x4f2c48[_0x47f5('0x2c')]);_0x39467c[_0x47f5('0x2d')]=_['intersection'](_0x39467c[_0x47f5('0x2b')],_0x39467c[_0x47f5('0x2c')]);_0x10e6f6['attributes']=_[_0x47f5('0x2e')](_0x39467c[_0x47f5('0x2b')],qs[_0x47f5('0x2f')](_0x4f2c48[_0x47f5('0x2c')]['fields']));_0x10e6f6['attributes']=_0x10e6f6[_0x47f5('0x30')][_0x47f5('0x31')]?_0x10e6f6[_0x47f5('0x30')]:_0x39467c[_0x47f5('0x2b')];if(!_0x4f2c48[_0x47f5('0x2c')]['hasOwnProperty'](_0x47f5('0x32'))){_0x10e6f6[_0x47f5('0x1d')]=qs['limit'](_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x1d')]);_0x10e6f6[_0x47f5('0x1b')]=qs[_0x47f5('0x1b')](_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x1b')]);}_0x10e6f6[_0x47f5('0x33')]=qs[_0x47f5('0x34')](_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x34')]);_0x10e6f6['where']=qs['filters'](_['pick'](_0x4f2c48['query'],_0x39467c[_0x47f5('0x2d')]),_0x453cd8);if(_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x35')]){_0x10e6f6[_0x47f5('0x36')]=_[_0x47f5('0x37')](_0x10e6f6['where'],{'$or':_[_0x47f5('0x26')](_0x453cd8,function(_0x5119b8){if(_0x5119b8[_0x47f5('0x2a')]!=='VIRTUAL'){var _0x1c1b92={};_0x1c1b92[_0x5119b8['name']]={'$like':'%'+_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x35')]+'%'};return _0x1c1b92;}})});}_0x10e6f6=_[_0x47f5('0x37')]({},_0x10e6f6,_0x4f2c48[_0x47f5('0x38')]);var _0xbb229d={'where':_0x10e6f6[_0x47f5('0x36')]};return db[_0x47f5('0x27')][_0x47f5('0x1e')](_0xbb229d)[_0x47f5('0x22')](function(_0xbddd3f){_0x1b99ca[_0x47f5('0x1e')]=_0xbddd3f;if(_0x4f2c48[_0x47f5('0x2c')][_0x47f5('0x39')]){_0x10e6f6[_0x47f5('0x3a')]=[{'all':!![]}];}return db[_0x47f5('0x27')][_0x47f5('0x3b')](_0x10e6f6);})['then'](function(_0x387ccc){_0x1b99ca[_0x47f5('0x3c')]=_0x387ccc;return _0x1b99ca;})[_0x47f5('0x22')](respondWithFilteredResult(_0x38fa14,_0x10e6f6))[_0x47f5('0x3d')](handleError(_0x38fa14,null));};exports[_0x47f5('0x3e')]=function(_0x1d8572,_0x5d6952){var _0x29e6b2={'raw':!![],'where':{'id':_0x1d8572['params']['id']}},_0x116eea={};_0x116eea[_0x47f5('0x2b')]=_[_0x47f5('0x3f')](db[_0x47f5('0x27')][_0x47f5('0x28')]);_0x116eea[_0x47f5('0x2c')]=_[_0x47f5('0x3f')](_0x1d8572[_0x47f5('0x2c')]);_0x116eea['filters']=_['intersection'](_0x116eea['model'],_0x116eea['query']);_0x29e6b2[_0x47f5('0x30')]=_['intersection'](_0x116eea[_0x47f5('0x2b')],qs[_0x47f5('0x2f')](_0x1d8572[_0x47f5('0x2c')][_0x47f5('0x2f')]));_0x29e6b2[_0x47f5('0x30')]=_0x29e6b2[_0x47f5('0x30')][_0x47f5('0x31')]?_0x29e6b2[_0x47f5('0x30')]:_0x116eea[_0x47f5('0x2b')];if(_0x1d8572[_0x47f5('0x2c')][_0x47f5('0x39')]){_0x29e6b2[_0x47f5('0x3a')]=[{'all':!![]}];}_0x29e6b2=_['merge']({},_0x29e6b2,_0x1d8572['options']);return db[_0x47f5('0x27')][_0x47f5('0x40')](_0x29e6b2)[_0x47f5('0x22')](handleEntityNotFound(_0x5d6952,null))[_0x47f5('0x22')](respondWithResult(_0x5d6952,null))[_0x47f5('0x3d')](handleError(_0x5d6952,null));};exports['create']=function(_0x5d86f0,_0x2207cd){return db[_0x47f5('0x27')][_0x47f5('0x41')](_0x5d86f0[_0x47f5('0x42')],{})['then'](function(_0x19f942){var _0x4a42ae=_0x5d86f0[_0x47f5('0x43')][_0x47f5('0x44')]({'plain':!![]});if(!_0x4a42ae)throw new Error(_0x47f5('0x45'));if(_0x4a42ae[_0x47f5('0x46')]===_0x47f5('0x43')){var _0xb7ea5d=_0x19f942[_0x47f5('0x44')]({'plain':!![]});var _0x57a827=_0x47f5('0x47');return db[_0x47f5('0x48')][_0x47f5('0x40')]({'where':{'name':_0x57a827,'userProfileId':_0x4a42ae['userProfileId']},'raw':!![]})['then'](function(_0x49f3bf){if(_0x49f3bf&&_0x49f3bf['autoAssociation']===0x0){return db[_0x47f5('0x49')][_0x47f5('0x41')]({'name':_0xb7ea5d[_0x47f5('0x24')],'resourceId':_0xb7ea5d['id'],'type':_0x49f3bf[_0x47f5('0x24')],'sectionId':_0x49f3bf['id']},{})[_0x47f5('0x22')](function(){return _0x19f942;});}else{return _0x19f942;}})[_0x47f5('0x3d')](function(_0x487d9c){logger[_0x47f5('0x4a')](_0x47f5('0x4b'),_0x487d9c);throw _0x487d9c;});}return _0x19f942;})[_0x47f5('0x22')](respondWithResult(_0x2207cd,0xc9))[_0x47f5('0x3d')](handleError(_0x2207cd,null));};exports[_0x47f5('0x21')]=function(_0x1fdb20,_0x20e7d1){if(_0x1fdb20[_0x47f5('0x42')]['id']){delete _0x1fdb20[_0x47f5('0x42')]['id'];}return db[_0x47f5('0x27')]['find']({'where':{'id':_0x1fdb20['params']['id']}})[_0x47f5('0x22')](handleEntityNotFound(_0x20e7d1,null))['then'](saveUpdates(_0x1fdb20[_0x47f5('0x42')],null))[_0x47f5('0x22')](respondWithResult(_0x20e7d1,null))['catch'](handleError(_0x20e7d1,null));};exports['destroy']=function(_0x3294ea,_0xff91b1){return db[_0x47f5('0x27')][_0x47f5('0x40')]({'where':{'id':_0x3294ea[_0x47f5('0x4c')]['id']}})[_0x47f5('0x22')](handleEntityNotFound(_0xff91b1,null))[_0x47f5('0x22')](removeEntity(_0xff91b1,null))['catch'](handleError(_0xff91b1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 35c1dea..8f9a6f7 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 _0x043c=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x4879f9,_0x18d0f7){var _0x26689b=function(_0x387643){while(--_0x387643){_0x4879f9['push'](_0x4879f9['shift']());}};_0x26689b(++_0x18d0f7);}(_0x043c,0x16c));var _0xc043=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x043c[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0xc043('0x0'));var util=require('util');var logger=require(_0xc043('0x1'))('api');var moment=require(_0xc043('0x2'));var BPromise=require(_0xc043('0x3'));var rp=require(_0xc043('0x4'));var fs=require('fs');var path=require(_0xc043('0x5'));var rimraf=require(_0xc043('0x6'));var config=require(_0xc043('0x7'));var attributes=require(_0xc043('0x8'));module[_0xc043('0x9')]=function(_0x3684cb,_0x1b0a46){return _0x3684cb[_0xc043('0xa')](_0xc043('0xb'),attributes,{'tableName':_0xc043('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea70=['api','moment','bluebird','request-promise','path','./template.attributes','exports','define','Template','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea70,0x135));var _0x0ea7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea70[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var logger=require(_0x0ea7('0x2'))(_0x0ea7('0x3'));var moment=require(_0x0ea7('0x4'));var BPromise=require(_0x0ea7('0x5'));var rp=require(_0x0ea7('0x6'));var fs=require('fs');var path=require(_0x0ea7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ea7('0x8'));module[_0x0ea7('0x9')]=function(_0x4ab38d,_0x2963cd){return _0x4ab38d[_0x0ea7('0xa')](_0x0ea7('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 381061c..dd524a8 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 _0x4b46=['Template,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','where','attributes','map','include','model','stringify','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b46,0xa3));var _0x64b4=function(_0x2bec87,_0x47f461){_0x2bec87=_0x2bec87-0x0;var _0x4fb32e=_0x4b46[_0x2bec87];return _0x4fb32e;};'use strict';var _=require(_0x64b4('0x0'));var util=require('util');var moment=require(_0x64b4('0x1'));var BPromise=require(_0x64b4('0x2'));var rs=require(_0x64b4('0x3'));var fs=require('fs');var Redis=require(_0x64b4('0x4'));var db=require(_0x64b4('0x5'))['db'];var utils=require(_0x64b4('0x6'));var logger=require(_0x64b4('0x7'))(_0x64b4('0x8'));var config=require(_0x64b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x64b4('0xa')][_0x64b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c1518,_0x2adaea,_0x3160d9){return new BPromise(function(_0x530500,_0xd18213){return client[_0x64b4('0xc')](_0x2c1518,_0x3160d9)['then'](function(_0x1c6afb){logger[_0x64b4('0xd')](_0x64b4('0xe'),_0x2adaea,_0x64b4('0xf'));logger[_0x64b4('0x10')](_0x64b4('0x11'),_0x2adaea,_0x64b4('0xf'),JSON['stringify'](_0x1c6afb));if(_0x1c6afb[_0x64b4('0x12')]){if(_0x1c6afb[_0x64b4('0x12')]['code']===0x1f4){logger['error'](_0x64b4('0xe'),_0x2adaea,_0x1c6afb[_0x64b4('0x12')]['message']);return _0xd18213(_0x1c6afb[_0x64b4('0x12')][_0x64b4('0x13')]);}logger[_0x64b4('0x12')]('Template,\x20%s,\x20%s',_0x2adaea,_0x1c6afb[_0x64b4('0x12')][_0x64b4('0x13')]);return _0x530500(_0x1c6afb[_0x64b4('0x12')][_0x64b4('0x13')]);}else{logger['info'](_0x64b4('0xe'),_0x2adaea,_0x64b4('0xf'));_0x530500(_0x1c6afb['result'][_0x64b4('0x13')]);}})[_0x64b4('0x14')](function(_0x468e93){logger[_0x64b4('0x12')](_0x64b4('0xe'),_0x2adaea,_0x468e93);_0xd18213(_0x468e93);});});}exports['GetTemplate']=function(_0x45b11f){var _0x56680a=this;return new Promise(function(_0x303394,_0x4121e7){return db['Template']['findAll']({'raw':_0x45b11f[_0x64b4('0x15')]?_0x45b11f[_0x64b4('0x15')][_0x64b4('0x16')]===undefined?!![]:![]:!![],'where':_0x45b11f[_0x64b4('0x15')]?_0x45b11f[_0x64b4('0x15')][_0x64b4('0x17')]||null:null,'attributes':_0x45b11f[_0x64b4('0x15')]?_0x45b11f[_0x64b4('0x15')][_0x64b4('0x18')]||null:null,'limit':_0x45b11f[_0x64b4('0x15')]?_0x45b11f[_0x64b4('0x15')]['limit']||null:null,'include':_0x45b11f['options']?_0x45b11f[_0x64b4('0x15')]['include']?_[_0x64b4('0x19')](_0x45b11f[_0x64b4('0x15')][_0x64b4('0x1a')],function(_0x98a781){return{'model':db[_0x98a781['model']],'as':_0x98a781['as'],'attributes':_0x98a781[_0x64b4('0x18')],'include':_0x98a781[_0x64b4('0x1a')]?_['map'](_0x98a781['include'],function(_0x185c49){return{'model':db[_0x185c49[_0x64b4('0x1b')]],'as':_0x185c49['as'],'attributes':_0x185c49[_0x64b4('0x18')],'include':_0x185c49[_0x64b4('0x1a')]?_[_0x64b4('0x19')](_0x185c49[_0x64b4('0x1a')],function(_0x51758d){return{'model':db[_0x51758d['model']],'as':_0x51758d['as'],'attributes':_0x51758d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34fb5a){logger[_0x64b4('0xd')]('GetTemplate',_0x45b11f);logger[_0x64b4('0x10')]('GetTemplate',_0x45b11f,JSON[_0x64b4('0x1c')](_0x34fb5a));_0x303394(_0x34fb5a);})['catch'](function(_0x243935){logger['error'](_0x64b4('0x1d'),_0x243935['message'],_0x45b11f);_0x4121e7(_0x56680a['error'](0x1f4,_0x243935[_0x64b4('0x13')]));});});}; \ No newline at end of file +var _0x2a62=['GetTemplate','options','raw','attributes','limit','include','map','model','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x2a62,0x111));var _0x22a6=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x2a62[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x22a6('0x0'));var util=require('util');var moment=require(_0x22a6('0x1'));var BPromise=require(_0x22a6('0x2'));var rs=require(_0x22a6('0x3'));var fs=require('fs');var Redis=require(_0x22a6('0x4'));var db=require(_0x22a6('0x5'))['db'];var utils=require(_0x22a6('0x6'));var logger=require(_0x22a6('0x7'))(_0x22a6('0x8'));var config=require(_0x22a6('0x9'));var jayson=require(_0x22a6('0xa'));var client=jayson[_0x22a6('0xb')][_0x22a6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25a8e3,_0x43c2fd,_0xe66883){return new BPromise(function(_0xdff2e,_0x261ecf){return client[_0x22a6('0xd')](_0x25a8e3,_0xe66883)[_0x22a6('0xe')](function(_0x12d4d4){logger[_0x22a6('0xf')](_0x22a6('0x10'),_0x43c2fd,_0x22a6('0x11'));logger['debug'](_0x22a6('0x12'),_0x43c2fd,_0x22a6('0x11'),JSON[_0x22a6('0x13')](_0x12d4d4));if(_0x12d4d4[_0x22a6('0x14')]){if(_0x12d4d4[_0x22a6('0x14')][_0x22a6('0x15')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x43c2fd,_0x12d4d4['error']['message']);return _0x261ecf(_0x12d4d4[_0x22a6('0x14')][_0x22a6('0x16')]);}logger[_0x22a6('0x14')]('Template,\x20%s,\x20%s',_0x43c2fd,_0x12d4d4[_0x22a6('0x14')]['message']);return _0xdff2e(_0x12d4d4[_0x22a6('0x14')][_0x22a6('0x16')]);}else{logger[_0x22a6('0xf')](_0x22a6('0x10'),_0x43c2fd,'request\x20sent');_0xdff2e(_0x12d4d4['result']['message']);}})[_0x22a6('0x17')](function(_0x3c7faa){logger['error'](_0x22a6('0x10'),_0x43c2fd,_0x3c7faa);_0x261ecf(_0x3c7faa);});});}exports[_0x22a6('0x18')]=function(_0x55ddfe){var _0x9fa0e9=this;return new Promise(function(_0x337cad,_0x2fd583){return db['Template']['findAll']({'raw':_0x55ddfe[_0x22a6('0x19')]?_0x55ddfe['options'][_0x22a6('0x1a')]===undefined?!![]:![]:!![],'where':_0x55ddfe['options']?_0x55ddfe[_0x22a6('0x19')]['where']||null:null,'attributes':_0x55ddfe['options']?_0x55ddfe[_0x22a6('0x19')][_0x22a6('0x1b')]||null:null,'limit':_0x55ddfe[_0x22a6('0x19')]?_0x55ddfe[_0x22a6('0x19')][_0x22a6('0x1c')]||null:null,'include':_0x55ddfe[_0x22a6('0x19')]?_0x55ddfe['options'][_0x22a6('0x1d')]?_['map'](_0x55ddfe[_0x22a6('0x19')][_0x22a6('0x1d')],function(_0x5df7cd){return{'model':db[_0x5df7cd['model']],'as':_0x5df7cd['as'],'attributes':_0x5df7cd[_0x22a6('0x1b')],'include':_0x5df7cd['include']?_[_0x22a6('0x1e')](_0x5df7cd[_0x22a6('0x1d')],function(_0x4ee35a){return{'model':db[_0x4ee35a[_0x22a6('0x1f')]],'as':_0x4ee35a['as'],'attributes':_0x4ee35a[_0x22a6('0x1b')],'include':_0x4ee35a[_0x22a6('0x1d')]?_[_0x22a6('0x1e')](_0x4ee35a[_0x22a6('0x1d')],function(_0xe4e6e9){return{'model':db[_0xe4e6e9[_0x22a6('0x1f')]],'as':_0xe4e6e9['as'],'attributes':_0xe4e6e9[_0x22a6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x492f6a){logger[_0x22a6('0xf')]('GetTemplate',_0x55ddfe);logger[_0x22a6('0x20')](_0x22a6('0x18'),_0x55ddfe,JSON[_0x22a6('0x13')](_0x492f6a));_0x337cad(_0x492f6a);})[_0x22a6('0x17')](function(_0x5b5caa){logger[_0x22a6('0x14')](_0x22a6('0x18'),_0x5b5caa[_0x22a6('0x16')],_0x55ddfe);_0x2fd583(_0x9fa0e9[_0x22a6('0x14')](0x1f4,_0x5b5caa[_0x22a6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e119a5c..74857c9 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 _0x90e0=['/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAnyCondition','addAction','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','/:id','isAuthenticated','show','get','/:id/all_conditions','getAllConditions'];(function(_0x30be32,_0x16a391){var _0x660c5d=function(_0x1a4efc){while(--_0x1a4efc){_0x30be32['push'](_0x30be32['shift']());}};_0x660c5d(++_0x16a391);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x090e('0x0'));var path=require(_0x090e('0x1'));var timeout=require(_0x090e('0x2'));var express=require(_0x090e('0x3'));var router=express[_0x090e('0x4')]();var fs_extra=require(_0x090e('0x5'));var auth=require(_0x090e('0x6'));var interaction=require(_0x090e('0x7'));var config=require(_0x090e('0x8'));var controller=require(_0x090e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x090e('0xa'),auth[_0x090e('0xb')](),controller[_0x090e('0xc')]);router[_0x090e('0xd')](_0x090e('0xe'),auth[_0x090e('0xb')](),controller[_0x090e('0xf')]);router['get'](_0x090e('0x10'),auth[_0x090e('0xb')](),controller[_0x090e('0x11')]);router[_0x090e('0xd')](_0x090e('0x12'),auth[_0x090e('0xb')](),controller['getActions']);router[_0x090e('0x13')]('/',auth[_0x090e('0xb')](),controller[_0x090e('0x14')]);router[_0x090e('0x13')](_0x090e('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x090e('0x13')]('/:id/any_conditions',auth[_0x090e('0xb')](),controller[_0x090e('0x15')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x090e('0x16')]);router[_0x090e('0x17')](_0x090e('0xa'),auth[_0x090e('0xb')](),controller[_0x090e('0x18')]);router['delete'](_0x090e('0xa'),auth['isAuthenticated'](),controller[_0x090e('0x19')]);module[_0x090e('0x1a')]=router; \ No newline at end of file +var _0xa4c0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post','create','addAnyCondition','addAction','put','update','delete','destroy','exports','util'];(function(_0x52c61e,_0x19933d){var _0x35e8fd=function(_0x1e5b98){while(--_0x1e5b98){_0x52c61e['push'](_0x52c61e['shift']());}};_0x35e8fd(++_0x19933d);}(_0xa4c0,0x197));var _0x0a4c=function(_0x2b4f24,_0xf8f8bd){_0x2b4f24=_0x2b4f24-0x0;var _0x23f00b=_0xa4c0[_0x2b4f24];return _0x23f00b;};'use strict';var multer=require('multer');var util=require(_0x0a4c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a4c('0x1'));var router=express[_0x0a4c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0a4c('0x3'));var interaction=require(_0x0a4c('0x4'));var config=require(_0x0a4c('0x5'));var controller=require(_0x0a4c('0x6'));router[_0x0a4c('0x7')]('/',auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x9')]);router[_0x0a4c('0x7')](_0x0a4c('0xa'),auth[_0x0a4c('0x8')](),controller['show']);router[_0x0a4c('0x7')](_0x0a4c('0xb'),auth[_0x0a4c('0x8')](),controller[_0x0a4c('0xc')]);router[_0x0a4c('0x7')](_0x0a4c('0xd'),auth[_0x0a4c('0x8')](),controller['getAnyConditions']);router[_0x0a4c('0x7')](_0x0a4c('0xe'),auth[_0x0a4c('0x8')](),controller['getActions']);router[_0x0a4c('0xf')]('/',auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x10')]);router[_0x0a4c('0xf')](_0x0a4c('0xb'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x0a4c('0xf')](_0x0a4c('0xd'),auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x11')]);router[_0x0a4c('0xf')]('/:id/actions',auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x12')]);router[_0x0a4c('0x13')](_0x0a4c('0xa'),auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x14')]);router[_0x0a4c('0x15')](_0x0a4c('0xa'),auth[_0x0a4c('0x8')](),controller[_0x0a4c('0x16')]);module[_0x0a4c('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index af5a73c..369a336 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 _0x500f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x45626d,_0x52ee1e){var _0x4d77e5=function(_0x6c6177){while(--_0x6c6177){_0x45626d['push'](_0x45626d['shift']());}};_0x4d77e5(++_0x52ee1e);}(_0x500f,0x1e8));var _0xf500=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x500f[_0x19babd];return _0x314eaf;};'use strict';var Sequelize=require(_0xf500('0x0'));module[_0xf500('0x1')]={'name':{'type':Sequelize[_0xf500('0x2')]},'channel':{'type':Sequelize[_0xf500('0x2')]},'description':{'type':Sequelize[_0xf500('0x2')]},'status':{'type':Sequelize[_0xf500('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc25=['STRING','exports'];(function(_0x48580f,_0x450095){var _0x26b0d2=function(_0x22d3ac){while(--_0x22d3ac){_0x48580f['push'](_0x48580f['shift']());}};_0x26b0d2(++_0x450095);}(_0xbc25,0x81));var _0x5bc2=function(_0x109bbc,_0x4fad16){_0x109bbc=_0x109bbc-0x0;var _0x223aca=_0xbc25[_0x109bbc];return _0x223aca;};'use strict';var Sequelize=require('sequelize');module[_0x5bc2('0x0')]={'name':{'type':Sequelize[_0x5bc2('0x1')]},'channel':{'type':Sequelize[_0x5bc2('0x1')]},'description':{'type':Sequelize[_0x5bc2('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d66cb36..3cb61be 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 _0x99e1=['TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction'];(function(_0x553dcf,_0x14d32a){var _0x6924ee=function(_0x52c2df){while(--_0x52c2df){_0x553dcf['push'](_0x553dcf['shift']());}};_0x6924ee(++_0x14d32a);}(_0x99e1,0x193));var _0x199e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x99e1[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x199e('0x0'));var rimraf=require(_0x199e('0x1'));var zipdir=require(_0x199e('0x2'));var jsonpatch=require(_0x199e('0x3'));var rp=require(_0x199e('0x4'));var moment=require(_0x199e('0x5'));var BPromise=require(_0x199e('0x6'));var Mustache=require(_0x199e('0x7'));var util=require('util');var path=require(_0x199e('0x8'));var sox=require(_0x199e('0x9'));var csv=require(_0x199e('0xa'));var ejs=require(_0x199e('0xb'));var fs=require('fs');var fs_extra=require(_0x199e('0xc'));var _=require(_0x199e('0xd'));var squel=require(_0x199e('0xe'));var crypto=require(_0x199e('0xf'));var jsforce=require(_0x199e('0x10'));var deskjs=require(_0x199e('0x11'));var toCsv=require('to-csv');var querystring=require(_0x199e('0x12'));var Papa=require(_0x199e('0x13'));var Redis=require('ioredis');var authService=require(_0x199e('0x14'));var qs=require(_0x199e('0x15'));var as=require(_0x199e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x199e('0x17'));var utils=require(_0x199e('0x18'));var config=require(_0x199e('0x19'));var licenseUtil=require(_0x199e('0x1a'));var db=require(_0x199e('0x1b'))['db'];function respondWithStatusCode(_0x13ce8c,_0xc04164){_0xc04164=_0xc04164||0xcc;return function(_0x5f39db){if(_0x5f39db){return _0x13ce8c[_0x199e('0x1c')](_0xc04164);}return _0x13ce8c['status'](_0xc04164)[_0x199e('0x1d')]();};}function respondWithResult(_0x4dca77,_0x527aa8){_0x527aa8=_0x527aa8||0xc8;return function(_0x750c61){if(_0x750c61){return _0x4dca77[_0x199e('0x1e')](_0x527aa8)[_0x199e('0x1f')](_0x750c61);}};}function respondWithFilteredResult(_0x4683b5,_0x29a412){return function(_0x386324){if(_0x386324){var _0x3e1e58=typeof _0x29a412[_0x199e('0x20')]==='undefined'&&typeof _0x29a412[_0x199e('0x21')]===_0x199e('0x22');var _0x1159b9=_0x386324['count'];var _0x2f8129=_0x3e1e58?0x0:_0x29a412[_0x199e('0x20')];var _0x12a8f5=_0x3e1e58?_0x386324[_0x199e('0x23')]:_0x29a412[_0x199e('0x20')]+_0x29a412[_0x199e('0x21')];var _0x379686;if(_0x12a8f5>=_0x1159b9){_0x12a8f5=_0x1159b9;_0x379686=0xc8;}else{_0x379686=0xce;}_0x4683b5[_0x199e('0x1e')](_0x379686);return _0x4683b5['set'](_0x199e('0x24'),_0x2f8129+'-'+_0x12a8f5+'/'+_0x1159b9)[_0x199e('0x1f')](_0x386324);}return null;};}function patchUpdates(_0x116cc3){return function(_0x1be393){try{jsonpatch[_0x199e('0x25')](_0x1be393,_0x116cc3,!![]);}catch(_0x2be0c1){return BPromise[_0x199e('0x26')](_0x2be0c1);}return _0x1be393['save']();};}function saveUpdates(_0xb4cc06,_0x519e6e){return function(_0x5cd246){if(_0x5cd246){return _0x5cd246[_0x199e('0x27')](_0xb4cc06)[_0x199e('0x28')](function(_0x3546b6){return _0x3546b6;});}return null;};}function removeEntity(_0x332444,_0xbb80c8){return function(_0x510a11){if(_0x510a11){return _0x510a11['destroy']()['then'](function(){var _0x3d17d3=_0x510a11['get']({'plain':!![]});var _0x3f7208='Triggers';return db[_0x199e('0x29')][_0x199e('0x2a')]({'where':{'type':_0x3f7208,'resourceId':_0x3d17d3['id']}})[_0x199e('0x28')](function(){return _0x510a11;});})[_0x199e('0x28')](function(){_0x332444[_0x199e('0x1e')](0xcc)[_0x199e('0x1d')]();});}};}function handleEntityNotFound(_0x1b5dd,_0x566a28){return function(_0x44090b){if(!_0x44090b){_0x1b5dd[_0x199e('0x1c')](0x194);}return _0x44090b;};}function handleError(_0x5c4df7,_0x54314a){_0x54314a=_0x54314a||0x1f4;return function(_0x248537){logger[_0x199e('0x2b')](_0x248537[_0x199e('0x2c')]);if(_0x248537[_0x199e('0x2d')]){delete _0x248537[_0x199e('0x2d')];}_0x5c4df7['status'](_0x54314a)[_0x199e('0x2e')](_0x248537);};}exports[_0x199e('0x2f')]=function(_0x179730,_0x2846fa){var _0x5cad80={},_0x16e565={},_0x5a2eb9={'count':0x0,'rows':[]};var _0x514ecd=_[_0x199e('0x30')](db[_0x199e('0x31')][_0x199e('0x32')],function(_0x157aea){return{'name':_0x157aea[_0x199e('0x33')],'type':_0x157aea[_0x199e('0x34')][_0x199e('0x35')]};});_0x16e565[_0x199e('0x36')]=_[_0x199e('0x30')](_0x514ecd,'name');_0x16e565['query']=_[_0x199e('0x37')](_0x179730[_0x199e('0x38')]);_0x16e565[_0x199e('0x39')]=_[_0x199e('0x3a')](_0x16e565[_0x199e('0x36')],_0x16e565['query']);_0x5cad80[_0x199e('0x3b')]=_[_0x199e('0x3a')](_0x16e565[_0x199e('0x36')],qs[_0x199e('0x3c')](_0x179730[_0x199e('0x38')][_0x199e('0x3c')]));_0x5cad80[_0x199e('0x3b')]=_0x5cad80['attributes'][_0x199e('0x3d')]?_0x5cad80[_0x199e('0x3b')]:_0x16e565[_0x199e('0x36')];if(!_0x179730[_0x199e('0x38')][_0x199e('0x3e')](_0x199e('0x3f'))){_0x5cad80[_0x199e('0x21')]=qs['limit'](_0x179730['query'][_0x199e('0x21')]);_0x5cad80[_0x199e('0x20')]=qs[_0x199e('0x20')](_0x179730[_0x199e('0x38')][_0x199e('0x20')]);}_0x5cad80[_0x199e('0x40')]=qs[_0x199e('0x41')](_0x179730[_0x199e('0x38')]['sort']);_0x5cad80[_0x199e('0x42')]=qs[_0x199e('0x39')](_[_0x199e('0x43')](_0x179730[_0x199e('0x38')],_0x16e565[_0x199e('0x39')]),_0x514ecd);if(_0x179730[_0x199e('0x38')][_0x199e('0x44')]){_0x5cad80[_0x199e('0x42')]=_[_0x199e('0x45')](_0x5cad80[_0x199e('0x42')],{'$or':_[_0x199e('0x30')](_0x514ecd,function(_0x3a8be1){if(_0x3a8be1['type']!==_0x199e('0x46')){var _0x2ef43b={};_0x2ef43b[_0x3a8be1['name']]={'$like':'%'+_0x179730[_0x199e('0x38')][_0x199e('0x44')]+'%'};return _0x2ef43b;}})});}_0x5cad80=_[_0x199e('0x45')]({},_0x5cad80,_0x179730[_0x199e('0x47')]);var _0x2dfaf8={'where':_0x5cad80[_0x199e('0x42')]};return db[_0x199e('0x31')]['count'](_0x2dfaf8)[_0x199e('0x28')](function(_0x40fcf1){_0x5a2eb9['count']=_0x40fcf1;if(_0x179730[_0x199e('0x38')][_0x199e('0x48')]){_0x5cad80[_0x199e('0x49')]=[{'all':!![]}];}return db[_0x199e('0x31')][_0x199e('0x4a')](_0x5cad80);})['then'](function(_0x1aa782){_0x5a2eb9[_0x199e('0x4b')]=_0x1aa782;return _0x5a2eb9;})[_0x199e('0x28')](respondWithFilteredResult(_0x2846fa,_0x5cad80))[_0x199e('0x4c')](handleError(_0x2846fa,null));};exports[_0x199e('0x4d')]=function(_0x4e901e,_0x2d2c12){var _0x44907b={'raw':![],'where':{'id':_0x4e901e[_0x199e('0x4e')]['id']}},_0x11cca2={};_0x11cca2[_0x199e('0x36')]=_[_0x199e('0x37')](db[_0x199e('0x31')][_0x199e('0x32')]);_0x11cca2['query']=_[_0x199e('0x37')](_0x4e901e[_0x199e('0x38')]);_0x11cca2[_0x199e('0x39')]=_[_0x199e('0x3a')](_0x11cca2['model'],_0x11cca2[_0x199e('0x38')]);_0x44907b[_0x199e('0x3b')]=_[_0x199e('0x3a')](_0x11cca2[_0x199e('0x36')],qs[_0x199e('0x3c')](_0x4e901e[_0x199e('0x38')][_0x199e('0x3c')]));_0x44907b[_0x199e('0x3b')]=_0x44907b['attributes'][_0x199e('0x3d')]?_0x44907b[_0x199e('0x3b')]:_0x11cca2['model'];if(_0x4e901e[_0x199e('0x38')][_0x199e('0x48')]){_0x44907b[_0x199e('0x49')]=[{'all':!![]}];}_0x44907b=_[_0x199e('0x45')]({},_0x44907b,_0x4e901e[_0x199e('0x47')]);return db['Trigger'][_0x199e('0x4f')](_0x44907b)['then'](handleEntityNotFound(_0x2d2c12,null))[_0x199e('0x28')](respondWithResult(_0x2d2c12,null))[_0x199e('0x4c')](handleError(_0x2d2c12,null));};exports['create']=function(_0x4418b3,_0x1ec75b){return db[_0x199e('0x31')][_0x199e('0x50')](_0x4418b3[_0x199e('0x51')],{})[_0x199e('0x28')](function(_0x44e45b){var _0x397353=_0x4418b3[_0x199e('0x52')]['get']({'plain':!![]});if(!_0x397353)throw new Error(_0x199e('0x53'));if(_0x397353[_0x199e('0x54')]===_0x199e('0x52')){var _0x13af00=_0x44e45b['get']({'plain':!![]});var _0x420a26=_0x199e('0x55');return db[_0x199e('0x56')][_0x199e('0x4f')]({'where':{'name':_0x420a26,'userProfileId':_0x397353[_0x199e('0x57')]},'raw':!![]})[_0x199e('0x28')](function(_0x472b54){if(_0x472b54&&_0x472b54[_0x199e('0x58')]===0x0){return db[_0x199e('0x29')][_0x199e('0x50')]({'name':_0x13af00[_0x199e('0x2d')],'resourceId':_0x13af00['id'],'type':_0x472b54['name'],'sectionId':_0x472b54['id']},{})['then'](function(){return _0x44e45b;});}else{return _0x44e45b;}})[_0x199e('0x4c')](function(_0x368714){logger['error'](_0x199e('0x59'),_0x368714);throw _0x368714;});}return _0x44e45b;})['then'](respondWithResult(_0x1ec75b,0xc9))[_0x199e('0x4c')](handleError(_0x1ec75b,null));};exports['update']=function(_0x162418,_0x54a7ec){if(_0x162418['body']['id']){delete _0x162418[_0x199e('0x51')]['id'];}return db['Trigger'][_0x199e('0x4f')]({'where':{'id':_0x162418['params']['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x54a7ec,null))[_0x199e('0x28')](saveUpdates(_0x162418[_0x199e('0x51')],null))['then'](respondWithResult(_0x54a7ec,null))['catch'](handleError(_0x54a7ec,null));};exports[_0x199e('0x2a')]=function(_0x5c330e,_0x469ff8){return db[_0x199e('0x31')]['find']({'where':{'id':_0x5c330e[_0x199e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x469ff8,null))['then'](removeEntity(_0x469ff8,null))[_0x199e('0x4c')](handleError(_0x469ff8,null));};exports['addAllCondition']=function(_0x4f0554,_0x6c6b18,_0x16493e){if(_0x4f0554[_0x199e('0x51')]['id']){delete _0x4f0554[_0x199e('0x51')]['id'];}return db[_0x199e('0x31')][_0x199e('0x4f')]({'where':{'id':_0x4f0554['params']['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x6c6b18,null))['then'](function(_0x912b17){if(_0x912b17){_0x4f0554['body'][_0x199e('0x5a')]=_0x912b17['id'];return db[_0x199e('0x5b')][_0x199e('0x50')](_0x4f0554['body']);}})[_0x199e('0x28')](respondWithResult(_0x6c6b18,null))[_0x199e('0x4c')](handleError(_0x6c6b18,null));};exports['addAnyCondition']=function(_0x1fb6f1,_0x220955,_0x237b8b){if(_0x1fb6f1[_0x199e('0x51')]['id']){delete _0x1fb6f1[_0x199e('0x51')]['id'];}return db[_0x199e('0x31')]['find']({'where':{'id':_0x1fb6f1['params']['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x220955,null))[_0x199e('0x28')](function(_0x299786){if(_0x299786){_0x1fb6f1[_0x199e('0x51')][_0x199e('0x5c')]=_0x299786['id'];return db['Condition']['create'](_0x1fb6f1[_0x199e('0x51')]);}})[_0x199e('0x28')](respondWithResult(_0x220955,null))['catch'](handleError(_0x220955,null));};exports['getAllConditions']=function(_0x4e3cf6,_0x4512f0,_0x187b96){var _0x32649a={};var _0x4f44f7={};var _0x748fcb;var _0x27c49b;return db[_0x199e('0x31')]['findOne']({'where':{'id':_0x4e3cf6[_0x199e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4512f0,null))[_0x199e('0x28')](function(_0x134ff9){if(_0x134ff9){_0x748fcb=_0x134ff9;_0x4f44f7[_0x199e('0x36')]=_[_0x199e('0x37')](db['Condition'][_0x199e('0x32')]);_0x4f44f7[_0x199e('0x38')]=_[_0x199e('0x37')](_0x4e3cf6[_0x199e('0x38')]);_0x4f44f7[_0x199e('0x39')]=_[_0x199e('0x3a')](_0x4f44f7[_0x199e('0x36')],_0x4f44f7[_0x199e('0x38')]);_0x32649a[_0x199e('0x3b')]=_[_0x199e('0x3a')](_0x4f44f7[_0x199e('0x36')],qs[_0x199e('0x3c')](_0x4e3cf6['query'][_0x199e('0x3c')]));_0x32649a[_0x199e('0x3b')]=_0x32649a['attributes'][_0x199e('0x3d')]?_0x32649a[_0x199e('0x3b')]:_0x4f44f7[_0x199e('0x36')];_0x32649a[_0x199e('0x40')]=qs['sort'](_0x4e3cf6[_0x199e('0x38')][_0x199e('0x41')]);_0x32649a[_0x199e('0x42')]=qs[_0x199e('0x39')](_['pick'](_0x4e3cf6['query'],_0x4f44f7[_0x199e('0x39')]));if(_0x4e3cf6['query'][_0x199e('0x44')]){_0x32649a[_0x199e('0x42')]=_[_0x199e('0x45')](_0x32649a[_0x199e('0x42')],{'$or':_[_0x199e('0x30')](_0x32649a['attributes'],function(_0x1fa548){var _0x132b72={};_0x132b72[_0x1fa548]={'$like':'%'+_0x4e3cf6[_0x199e('0x38')][_0x199e('0x44')]+'%'};return _0x132b72;})});}_0x32649a=_[_0x199e('0x45')]({},_0x32649a,_0x4e3cf6[_0x199e('0x47')]);return _0x748fcb['getAllConditions'](_0x32649a);}})['then'](function(_0x2377b8){if(_0x2377b8){_0x27c49b=_0x2377b8['length'];if(!_0x4e3cf6[_0x199e('0x38')][_0x199e('0x3e')](_0x199e('0x3f'))){_0x32649a[_0x199e('0x21')]=qs[_0x199e('0x21')](_0x4e3cf6['query'][_0x199e('0x21')]);_0x32649a[_0x199e('0x20')]=qs['offset'](_0x4e3cf6[_0x199e('0x38')][_0x199e('0x20')]);}return _0x748fcb[_0x199e('0x5d')](_0x32649a);}})[_0x199e('0x28')](function(_0x21d894){if(_0x21d894){return _0x21d894?{'count':_0x27c49b,'rows':_0x21d894}:null;}})['then'](respondWithResult(_0x4512f0,null))['catch'](handleError(_0x4512f0,null));};exports[_0x199e('0x5e')]=function(_0x30bb4b,_0x2aaa94,_0x912bb){var _0x301060={};var _0x13a762={};var _0x230ccd;var _0x315a09;return db['Trigger'][_0x199e('0x5f')]({'where':{'id':_0x30bb4b[_0x199e('0x4e')]['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x2aaa94,null))[_0x199e('0x28')](function(_0x35e4f7){if(_0x35e4f7){_0x230ccd=_0x35e4f7;_0x13a762['model']=_[_0x199e('0x37')](db[_0x199e('0x5b')]['rawAttributes']);_0x13a762[_0x199e('0x38')]=_[_0x199e('0x37')](_0x30bb4b[_0x199e('0x38')]);_0x13a762['filters']=_[_0x199e('0x3a')](_0x13a762[_0x199e('0x36')],_0x13a762[_0x199e('0x38')]);_0x301060[_0x199e('0x3b')]=_[_0x199e('0x3a')](_0x13a762['model'],qs['fields'](_0x30bb4b[_0x199e('0x38')][_0x199e('0x3c')]));_0x301060[_0x199e('0x3b')]=_0x301060[_0x199e('0x3b')]['length']?_0x301060[_0x199e('0x3b')]:_0x13a762[_0x199e('0x36')];_0x301060[_0x199e('0x40')]=qs[_0x199e('0x41')](_0x30bb4b[_0x199e('0x38')][_0x199e('0x41')]);_0x301060['where']=qs[_0x199e('0x39')](_[_0x199e('0x43')](_0x30bb4b[_0x199e('0x38')],_0x13a762['filters']));if(_0x30bb4b[_0x199e('0x38')][_0x199e('0x44')]){_0x301060[_0x199e('0x42')]=_[_0x199e('0x45')](_0x301060[_0x199e('0x42')],{'$or':_[_0x199e('0x30')](_0x301060[_0x199e('0x3b')],function(_0x40918f){var _0x4d924c={};_0x4d924c[_0x40918f]={'$like':'%'+_0x30bb4b[_0x199e('0x38')][_0x199e('0x44')]+'%'};return _0x4d924c;})});}_0x301060=_[_0x199e('0x45')]({},_0x301060,_0x30bb4b[_0x199e('0x47')]);return _0x230ccd['getAnyConditions'](_0x301060);}})[_0x199e('0x28')](function(_0x31ebca){if(_0x31ebca){_0x315a09=_0x31ebca[_0x199e('0x3d')];if(!_0x30bb4b[_0x199e('0x38')][_0x199e('0x3e')](_0x199e('0x3f'))){_0x301060[_0x199e('0x21')]=qs[_0x199e('0x21')](_0x30bb4b['query'][_0x199e('0x21')]);_0x301060[_0x199e('0x20')]=qs[_0x199e('0x20')](_0x30bb4b[_0x199e('0x38')][_0x199e('0x20')]);}return _0x230ccd[_0x199e('0x5e')](_0x301060);}})[_0x199e('0x28')](function(_0x39c547){if(_0x39c547){return _0x39c547?{'count':_0x315a09,'rows':_0x39c547}:null;}})[_0x199e('0x28')](respondWithResult(_0x2aaa94,null))[_0x199e('0x4c')](handleError(_0x2aaa94,null));};exports[_0x199e('0x60')]=function(_0x5681c0,_0x3dbe93,_0x53ce55){if(_0x5681c0[_0x199e('0x51')]['id']){delete _0x5681c0[_0x199e('0x51')]['id'];}return db[_0x199e('0x31')][_0x199e('0x4f')]({'where':{'id':_0x5681c0[_0x199e('0x4e')]['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x3dbe93,null))[_0x199e('0x28')](function(_0x488136){if(_0x488136){_0x5681c0['body'][_0x199e('0x61')]=_0x488136['id'];return db['Action']['create'](_0x5681c0['body']);}})['then'](respondWithResult(_0x3dbe93,null))['catch'](handleError(_0x3dbe93,null));};exports[_0x199e('0x62')]=function(_0x365498,_0x403513,_0x1eb0e8){var _0x568542={};var _0x5835ed={};var _0x75d2ec;var _0x322206;return db['Trigger'][_0x199e('0x5f')]({'where':{'id':_0x365498['params']['id']}})[_0x199e('0x28')](handleEntityNotFound(_0x403513,null))[_0x199e('0x28')](function(_0xee70ad){if(_0xee70ad){_0x75d2ec=_0xee70ad;_0x5835ed['model']=_[_0x199e('0x37')](db[_0x199e('0x63')]['rawAttributes']);_0x5835ed['query']=_[_0x199e('0x37')](_0x365498[_0x199e('0x38')]);_0x5835ed[_0x199e('0x39')]=_[_0x199e('0x3a')](_0x5835ed[_0x199e('0x36')],_0x5835ed['query']);_0x568542[_0x199e('0x3b')]=_[_0x199e('0x3a')](_0x5835ed[_0x199e('0x36')],qs[_0x199e('0x3c')](_0x365498[_0x199e('0x38')][_0x199e('0x3c')]));_0x568542[_0x199e('0x3b')]=_0x568542['attributes']['length']?_0x568542[_0x199e('0x3b')]:_0x5835ed['model'];_0x568542[_0x199e('0x40')]=qs[_0x199e('0x41')](_0x365498[_0x199e('0x38')][_0x199e('0x41')]);_0x568542[_0x199e('0x42')]=qs[_0x199e('0x39')](_['pick'](_0x365498[_0x199e('0x38')],_0x5835ed[_0x199e('0x39')]));if(_0x365498['query'][_0x199e('0x44')]){_0x568542[_0x199e('0x42')]=_['merge'](_0x568542[_0x199e('0x42')],{'$or':_[_0x199e('0x30')](_0x568542[_0x199e('0x3b')],function(_0x3eee87){var _0x59846e={};_0x59846e[_0x3eee87]={'$like':'%'+_0x365498[_0x199e('0x38')][_0x199e('0x44')]+'%'};return _0x59846e;})});}_0x568542=_['merge']({},_0x568542,_0x365498['options']);return _0x75d2ec[_0x199e('0x62')](_0x568542);}})[_0x199e('0x28')](function(_0x3d1c6f){if(_0x3d1c6f){_0x322206=_0x3d1c6f[_0x199e('0x3d')];if(!_0x365498[_0x199e('0x38')][_0x199e('0x3e')]('nolimit')){_0x568542['limit']=qs[_0x199e('0x21')](_0x365498['query'][_0x199e('0x21')]);_0x568542[_0x199e('0x20')]=qs[_0x199e('0x20')](_0x365498['query'][_0x199e('0x20')]);}return _0x75d2ec[_0x199e('0x62')](_0x568542);}})[_0x199e('0x28')](function(_0x482425){if(_0x482425){return _0x482425?{'count':_0x322206,'rows':_0x482425}:null;}})[_0x199e('0x28')](respondWithResult(_0x403513,null))['catch'](handleError(_0x403513,null));}; \ No newline at end of file +var _0x93e0=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Triggers','UserProfileSection','userProfileId','autoAssociation','error','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','stack','name','send','index','map','Trigger','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge','find','create'];(function(_0x239b75,_0x578533){var _0x5efeb3=function(_0x1add81){while(--_0x1add81){_0x239b75['push'](_0x239b75['shift']());}};_0x5efeb3(++_0x578533);}(_0x93e0,0x77));var _0x093e=function(_0x4dac2c,_0x1b3cf2){_0x4dac2c=_0x4dac2c-0x0;var _0x5ef13c=_0x93e0[_0x4dac2c];return _0x5ef13c;};'use strict';var emlformat=require(_0x093e('0x0'));var rimraf=require(_0x093e('0x1'));var zipdir=require(_0x093e('0x2'));var jsonpatch=require(_0x093e('0x3'));var rp=require(_0x093e('0x4'));var moment=require(_0x093e('0x5'));var BPromise=require(_0x093e('0x6'));var Mustache=require(_0x093e('0x7'));var util=require('util');var path=require(_0x093e('0x8'));var sox=require(_0x093e('0x9'));var csv=require(_0x093e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x093e('0xb'));var _=require(_0x093e('0xc'));var squel=require('squel');var crypto=require(_0x093e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x093e('0xe'));var Redis=require(_0x093e('0xf'));var authService=require(_0x093e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x093e('0x11'));var hardwareService=require(_0x093e('0x12'));var logger=require(_0x093e('0x13'))(_0x093e('0x14'));var utils=require('../../config/utils');var config=require(_0x093e('0x15'));var licenseUtil=require(_0x093e('0x16'));var db=require(_0x093e('0x17'))['db'];function respondWithStatusCode(_0xa6a2e3,_0x1984cc){_0x1984cc=_0x1984cc||0xcc;return function(_0x12fac0){if(_0x12fac0){return _0xa6a2e3[_0x093e('0x18')](_0x1984cc);}return _0xa6a2e3['status'](_0x1984cc)[_0x093e('0x19')]();};}function respondWithResult(_0x279d84,_0x2fb0fa){_0x2fb0fa=_0x2fb0fa||0xc8;return function(_0x3d38f2){if(_0x3d38f2){return _0x279d84['status'](_0x2fb0fa)[_0x093e('0x1a')](_0x3d38f2);}};}function respondWithFilteredResult(_0x5d793b,_0x5d8496){return function(_0x4ea749){if(_0x4ea749){var _0x6c1ecc=typeof _0x5d8496[_0x093e('0x1b')]===_0x093e('0x1c')&&typeof _0x5d8496['limit']==='undefined';var _0x5a7dea=_0x4ea749[_0x093e('0x1d')];var _0x4b0fa4=_0x6c1ecc?0x0:_0x5d8496[_0x093e('0x1b')];var _0x5fac7a=_0x6c1ecc?_0x4ea749['count']:_0x5d8496['offset']+_0x5d8496[_0x093e('0x1e')];var _0x1a19da;if(_0x5fac7a>=_0x5a7dea){_0x5fac7a=_0x5a7dea;_0x1a19da=0xc8;}else{_0x1a19da=0xce;}_0x5d793b[_0x093e('0x1f')](_0x1a19da);return _0x5d793b['set'](_0x093e('0x20'),_0x4b0fa4+'-'+_0x5fac7a+'/'+_0x5a7dea)[_0x093e('0x1a')](_0x4ea749);}return null;};}function patchUpdates(_0x57294e){return function(_0x190be9){try{jsonpatch[_0x093e('0x21')](_0x190be9,_0x57294e,!![]);}catch(_0xb81beb){return BPromise[_0x093e('0x22')](_0xb81beb);}return _0x190be9[_0x093e('0x23')]();};}function saveUpdates(_0x48cdc8,_0x34364a){return function(_0x5146d0){if(_0x5146d0){return _0x5146d0[_0x093e('0x24')](_0x48cdc8)['then'](function(_0x5cebd1){return _0x5cebd1;});}return null;};}function removeEntity(_0x1872e4,_0x4965d8){return function(_0x3b2c6c){if(_0x3b2c6c){return _0x3b2c6c[_0x093e('0x25')]()[_0x093e('0x26')](function(){var _0x2a7b59=_0x3b2c6c['get']({'plain':!![]});var _0x10f7a7='Triggers';return db[_0x093e('0x27')][_0x093e('0x25')]({'where':{'type':_0x10f7a7,'resourceId':_0x2a7b59['id']}})[_0x093e('0x26')](function(){return _0x3b2c6c;});})[_0x093e('0x26')](function(){_0x1872e4[_0x093e('0x1f')](0xcc)[_0x093e('0x19')]();});}};}function handleEntityNotFound(_0x2c4f00,_0x16514e){return function(_0x5ee486){if(!_0x5ee486){_0x2c4f00[_0x093e('0x18')](0x194);}return _0x5ee486;};}function handleError(_0x1693c6,_0x163347){_0x163347=_0x163347||0x1f4;return function(_0x204f1c){logger['error'](_0x204f1c[_0x093e('0x28')]);if(_0x204f1c[_0x093e('0x29')]){delete _0x204f1c['name'];}_0x1693c6['status'](_0x163347)[_0x093e('0x2a')](_0x204f1c);};}exports[_0x093e('0x2b')]=function(_0xdd865a,_0x480f8f){var _0x46c782={},_0x1329fd={},_0x3b2dbf={'count':0x0,'rows':[]};var _0x4a531a=_[_0x093e('0x2c')](db[_0x093e('0x2d')]['rawAttributes'],function(_0x4ecb06){return{'name':_0x4ecb06['fieldName'],'type':_0x4ecb06[_0x093e('0x2e')][_0x093e('0x2f')]};});_0x1329fd[_0x093e('0x30')]=_[_0x093e('0x2c')](_0x4a531a,_0x093e('0x29'));_0x1329fd[_0x093e('0x31')]=_[_0x093e('0x32')](_0xdd865a[_0x093e('0x31')]);_0x1329fd[_0x093e('0x33')]=_[_0x093e('0x34')](_0x1329fd['model'],_0x1329fd[_0x093e('0x31')]);_0x46c782[_0x093e('0x35')]=_[_0x093e('0x34')](_0x1329fd[_0x093e('0x30')],qs['fields'](_0xdd865a[_0x093e('0x31')][_0x093e('0x36')]));_0x46c782['attributes']=_0x46c782['attributes'][_0x093e('0x37')]?_0x46c782[_0x093e('0x35')]:_0x1329fd[_0x093e('0x30')];if(!_0xdd865a[_0x093e('0x31')][_0x093e('0x38')](_0x093e('0x39'))){_0x46c782['limit']=qs[_0x093e('0x1e')](_0xdd865a[_0x093e('0x31')][_0x093e('0x1e')]);_0x46c782[_0x093e('0x1b')]=qs[_0x093e('0x1b')](_0xdd865a[_0x093e('0x31')]['offset']);}_0x46c782[_0x093e('0x3a')]=qs[_0x093e('0x3b')](_0xdd865a['query'][_0x093e('0x3b')]);_0x46c782[_0x093e('0x3c')]=qs['filters'](_[_0x093e('0x3d')](_0xdd865a['query'],_0x1329fd[_0x093e('0x33')]),_0x4a531a);if(_0xdd865a[_0x093e('0x31')][_0x093e('0x3e')]){_0x46c782[_0x093e('0x3c')]=_['merge'](_0x46c782[_0x093e('0x3c')],{'$or':_[_0x093e('0x2c')](_0x4a531a,function(_0x186495){if(_0x186495['type']!=='VIRTUAL'){var _0x5bfa40={};_0x5bfa40[_0x186495[_0x093e('0x29')]]={'$like':'%'+_0xdd865a[_0x093e('0x31')][_0x093e('0x3e')]+'%'};return _0x5bfa40;}})});}_0x46c782=_['merge']({},_0x46c782,_0xdd865a[_0x093e('0x3f')]);var _0x423ff8={'where':_0x46c782[_0x093e('0x3c')]};return db[_0x093e('0x2d')]['count'](_0x423ff8)['then'](function(_0x3f4ede){_0x3b2dbf[_0x093e('0x1d')]=_0x3f4ede;if(_0xdd865a['query']['includeAll']){_0x46c782[_0x093e('0x40')]=[{'all':!![]}];}return db[_0x093e('0x2d')][_0x093e('0x41')](_0x46c782);})[_0x093e('0x26')](function(_0x57ca24){_0x3b2dbf[_0x093e('0x42')]=_0x57ca24;return _0x3b2dbf;})[_0x093e('0x26')](respondWithFilteredResult(_0x480f8f,_0x46c782))[_0x093e('0x43')](handleError(_0x480f8f,null));};exports[_0x093e('0x44')]=function(_0x433ff3,_0x357e1d){var _0x451dde={'raw':![],'where':{'id':_0x433ff3[_0x093e('0x45')]['id']}},_0x7d5099={};_0x7d5099[_0x093e('0x30')]=_[_0x093e('0x32')](db[_0x093e('0x2d')][_0x093e('0x46')]);_0x7d5099[_0x093e('0x31')]=_[_0x093e('0x32')](_0x433ff3[_0x093e('0x31')]);_0x7d5099[_0x093e('0x33')]=_[_0x093e('0x34')](_0x7d5099[_0x093e('0x30')],_0x7d5099['query']);_0x451dde[_0x093e('0x35')]=_[_0x093e('0x34')](_0x7d5099['model'],qs[_0x093e('0x36')](_0x433ff3[_0x093e('0x31')][_0x093e('0x36')]));_0x451dde['attributes']=_0x451dde['attributes'][_0x093e('0x37')]?_0x451dde['attributes']:_0x7d5099[_0x093e('0x30')];if(_0x433ff3[_0x093e('0x31')][_0x093e('0x47')]){_0x451dde['include']=[{'all':!![]}];}_0x451dde=_[_0x093e('0x48')]({},_0x451dde,_0x433ff3[_0x093e('0x3f')]);return db[_0x093e('0x2d')][_0x093e('0x49')](_0x451dde)['then'](handleEntityNotFound(_0x357e1d,null))[_0x093e('0x26')](respondWithResult(_0x357e1d,null))[_0x093e('0x43')](handleError(_0x357e1d,null));};exports[_0x093e('0x4a')]=function(_0xb2e018,_0x18e9d9){return db[_0x093e('0x2d')][_0x093e('0x4a')](_0xb2e018[_0x093e('0x4b')],{})['then'](function(_0x4bcee1){var _0x495eb0=_0xb2e018[_0x093e('0x4c')]['get']({'plain':!![]});if(!_0x495eb0)throw new Error(_0x093e('0x4d'));if(_0x495eb0[_0x093e('0x4e')]===_0x093e('0x4c')){var _0x5089fd=_0x4bcee1[_0x093e('0x4f')]({'plain':!![]});var _0x412b4a=_0x093e('0x50');return db[_0x093e('0x51')][_0x093e('0x49')]({'where':{'name':_0x412b4a,'userProfileId':_0x495eb0[_0x093e('0x52')]},'raw':!![]})[_0x093e('0x26')](function(_0x31128e){if(_0x31128e&&_0x31128e[_0x093e('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x5089fd['name'],'resourceId':_0x5089fd['id'],'type':_0x31128e['name'],'sectionId':_0x31128e['id']},{})['then'](function(){return _0x4bcee1;});}else{return _0x4bcee1;}})['catch'](function(_0x1e1536){logger[_0x093e('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e1536);throw _0x1e1536;});}return _0x4bcee1;})['then'](respondWithResult(_0x18e9d9,0xc9))['catch'](handleError(_0x18e9d9,null));};exports[_0x093e('0x24')]=function(_0x18491c,_0x48a135){if(_0x18491c[_0x093e('0x4b')]['id']){delete _0x18491c[_0x093e('0x4b')]['id'];}return db[_0x093e('0x2d')][_0x093e('0x49')]({'where':{'id':_0x18491c['params']['id']}})['then'](handleEntityNotFound(_0x48a135,null))[_0x093e('0x26')](saveUpdates(_0x18491c[_0x093e('0x4b')],null))[_0x093e('0x26')](respondWithResult(_0x48a135,null))[_0x093e('0x43')](handleError(_0x48a135,null));};exports['destroy']=function(_0x36462f,_0x593692){return db[_0x093e('0x2d')]['find']({'where':{'id':_0x36462f[_0x093e('0x45')]['id']}})['then'](handleEntityNotFound(_0x593692,null))[_0x093e('0x26')](removeEntity(_0x593692,null))[_0x093e('0x43')](handleError(_0x593692,null));};exports[_0x093e('0x55')]=function(_0x1bac50,_0x199e5d,_0x16732e){if(_0x1bac50['body']['id']){delete _0x1bac50[_0x093e('0x4b')]['id'];}return db['Trigger'][_0x093e('0x49')]({'where':{'id':_0x1bac50[_0x093e('0x45')]['id']}})['then'](handleEntityNotFound(_0x199e5d,null))[_0x093e('0x26')](function(_0x179876){if(_0x179876){_0x1bac50[_0x093e('0x4b')][_0x093e('0x56')]=_0x179876['id'];return db['Condition']['create'](_0x1bac50[_0x093e('0x4b')]);}})[_0x093e('0x26')](respondWithResult(_0x199e5d,null))[_0x093e('0x43')](handleError(_0x199e5d,null));};exports[_0x093e('0x57')]=function(_0x3b4fec,_0x4796cd,_0x2eb2ce){if(_0x3b4fec[_0x093e('0x4b')]['id']){delete _0x3b4fec[_0x093e('0x4b')]['id'];}return db[_0x093e('0x2d')][_0x093e('0x49')]({'where':{'id':_0x3b4fec[_0x093e('0x45')]['id']}})[_0x093e('0x26')](handleEntityNotFound(_0x4796cd,null))[_0x093e('0x26')](function(_0x5756be){if(_0x5756be){_0x3b4fec[_0x093e('0x4b')][_0x093e('0x58')]=_0x5756be['id'];return db[_0x093e('0x59')][_0x093e('0x4a')](_0x3b4fec['body']);}})[_0x093e('0x26')](respondWithResult(_0x4796cd,null))[_0x093e('0x43')](handleError(_0x4796cd,null));};exports[_0x093e('0x5a')]=function(_0x3f51b0,_0x3dc720,_0xa676a4){var _0x59d5ce={};var _0x48e422={};var _0x2bbe67;var _0x25f33e;return db['Trigger'][_0x093e('0x5b')]({'where':{'id':_0x3f51b0['params']['id']}})[_0x093e('0x26')](handleEntityNotFound(_0x3dc720,null))[_0x093e('0x26')](function(_0x229dea){if(_0x229dea){_0x2bbe67=_0x229dea;_0x48e422[_0x093e('0x30')]=_[_0x093e('0x32')](db[_0x093e('0x59')][_0x093e('0x46')]);_0x48e422[_0x093e('0x31')]=_['keys'](_0x3f51b0[_0x093e('0x31')]);_0x48e422[_0x093e('0x33')]=_[_0x093e('0x34')](_0x48e422['model'],_0x48e422[_0x093e('0x31')]);_0x59d5ce[_0x093e('0x35')]=_[_0x093e('0x34')](_0x48e422[_0x093e('0x30')],qs['fields'](_0x3f51b0[_0x093e('0x31')][_0x093e('0x36')]));_0x59d5ce['attributes']=_0x59d5ce[_0x093e('0x35')]['length']?_0x59d5ce['attributes']:_0x48e422[_0x093e('0x30')];_0x59d5ce[_0x093e('0x3a')]=qs['sort'](_0x3f51b0[_0x093e('0x31')][_0x093e('0x3b')]);_0x59d5ce[_0x093e('0x3c')]=qs[_0x093e('0x33')](_[_0x093e('0x3d')](_0x3f51b0[_0x093e('0x31')],_0x48e422['filters']));if(_0x3f51b0[_0x093e('0x31')]['filter']){_0x59d5ce[_0x093e('0x3c')]=_['merge'](_0x59d5ce[_0x093e('0x3c')],{'$or':_[_0x093e('0x2c')](_0x59d5ce['attributes'],function(_0x3f4d6f){var _0x55237d={};_0x55237d[_0x3f4d6f]={'$like':'%'+_0x3f51b0['query'][_0x093e('0x3e')]+'%'};return _0x55237d;})});}_0x59d5ce=_[_0x093e('0x48')]({},_0x59d5ce,_0x3f51b0[_0x093e('0x3f')]);return _0x2bbe67[_0x093e('0x5a')](_0x59d5ce);}})[_0x093e('0x26')](function(_0x37671b){if(_0x37671b){_0x25f33e=_0x37671b[_0x093e('0x37')];if(!_0x3f51b0['query'][_0x093e('0x38')](_0x093e('0x39'))){_0x59d5ce[_0x093e('0x1e')]=qs['limit'](_0x3f51b0[_0x093e('0x31')][_0x093e('0x1e')]);_0x59d5ce[_0x093e('0x1b')]=qs[_0x093e('0x1b')](_0x3f51b0[_0x093e('0x31')][_0x093e('0x1b')]);}return _0x2bbe67[_0x093e('0x5a')](_0x59d5ce);}})[_0x093e('0x26')](function(_0x8d88c0){if(_0x8d88c0){return _0x8d88c0?{'count':_0x25f33e,'rows':_0x8d88c0}:null;}})[_0x093e('0x26')](respondWithResult(_0x3dc720,null))[_0x093e('0x43')](handleError(_0x3dc720,null));};exports[_0x093e('0x5c')]=function(_0x25ec0f,_0xd7ce17,_0x453d1c){var _0x2a2c4d={};var _0x4020b4={};var _0xbd713d;var _0x27287d;return db['Trigger'][_0x093e('0x5b')]({'where':{'id':_0x25ec0f[_0x093e('0x45')]['id']}})[_0x093e('0x26')](handleEntityNotFound(_0xd7ce17,null))['then'](function(_0x479767){if(_0x479767){_0xbd713d=_0x479767;_0x4020b4['model']=_[_0x093e('0x32')](db['Condition'][_0x093e('0x46')]);_0x4020b4['query']=_[_0x093e('0x32')](_0x25ec0f['query']);_0x4020b4[_0x093e('0x33')]=_[_0x093e('0x34')](_0x4020b4[_0x093e('0x30')],_0x4020b4['query']);_0x2a2c4d[_0x093e('0x35')]=_[_0x093e('0x34')](_0x4020b4[_0x093e('0x30')],qs[_0x093e('0x36')](_0x25ec0f['query'][_0x093e('0x36')]));_0x2a2c4d[_0x093e('0x35')]=_0x2a2c4d[_0x093e('0x35')][_0x093e('0x37')]?_0x2a2c4d['attributes']:_0x4020b4[_0x093e('0x30')];_0x2a2c4d[_0x093e('0x3a')]=qs[_0x093e('0x3b')](_0x25ec0f[_0x093e('0x31')][_0x093e('0x3b')]);_0x2a2c4d[_0x093e('0x3c')]=qs[_0x093e('0x33')](_[_0x093e('0x3d')](_0x25ec0f[_0x093e('0x31')],_0x4020b4[_0x093e('0x33')]));if(_0x25ec0f[_0x093e('0x31')]['filter']){_0x2a2c4d[_0x093e('0x3c')]=_[_0x093e('0x48')](_0x2a2c4d['where'],{'$or':_['map'](_0x2a2c4d[_0x093e('0x35')],function(_0xe99f3d){var _0x2bc030={};_0x2bc030[_0xe99f3d]={'$like':'%'+_0x25ec0f[_0x093e('0x31')][_0x093e('0x3e')]+'%'};return _0x2bc030;})});}_0x2a2c4d=_[_0x093e('0x48')]({},_0x2a2c4d,_0x25ec0f[_0x093e('0x3f')]);return _0xbd713d[_0x093e('0x5c')](_0x2a2c4d);}})[_0x093e('0x26')](function(_0x4852c9){if(_0x4852c9){_0x27287d=_0x4852c9[_0x093e('0x37')];if(!_0x25ec0f[_0x093e('0x31')][_0x093e('0x38')](_0x093e('0x39'))){_0x2a2c4d[_0x093e('0x1e')]=qs[_0x093e('0x1e')](_0x25ec0f[_0x093e('0x31')][_0x093e('0x1e')]);_0x2a2c4d['offset']=qs[_0x093e('0x1b')](_0x25ec0f[_0x093e('0x31')]['offset']);}return _0xbd713d[_0x093e('0x5c')](_0x2a2c4d);}})[_0x093e('0x26')](function(_0x205c78){if(_0x205c78){return _0x205c78?{'count':_0x27287d,'rows':_0x205c78}:null;}})['then'](respondWithResult(_0xd7ce17,null))[_0x093e('0x43')](handleError(_0xd7ce17,null));};exports[_0x093e('0x5d')]=function(_0x2d599c,_0x2766ef,_0x52afe9){if(_0x2d599c[_0x093e('0x4b')]['id']){delete _0x2d599c[_0x093e('0x4b')]['id'];}return db['Trigger'][_0x093e('0x49')]({'where':{'id':_0x2d599c[_0x093e('0x45')]['id']}})[_0x093e('0x26')](handleEntityNotFound(_0x2766ef,null))[_0x093e('0x26')](function(_0x2f0536){if(_0x2f0536){_0x2d599c[_0x093e('0x4b')][_0x093e('0x5e')]=_0x2f0536['id'];return db[_0x093e('0x5f')][_0x093e('0x4a')](_0x2d599c[_0x093e('0x4b')]);}})[_0x093e('0x26')](respondWithResult(_0x2766ef,null))[_0x093e('0x43')](handleError(_0x2766ef,null));};exports[_0x093e('0x60')]=function(_0x3b5577,_0x2cc2aa,_0x4d418f){var _0x10f7eb={};var _0x104223={};var _0x166de7;var _0x1c9fdb;return db[_0x093e('0x2d')][_0x093e('0x5b')]({'where':{'id':_0x3b5577[_0x093e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cc2aa,null))['then'](function(_0x64a63e){if(_0x64a63e){_0x166de7=_0x64a63e;_0x104223[_0x093e('0x30')]=_[_0x093e('0x32')](db[_0x093e('0x5f')]['rawAttributes']);_0x104223[_0x093e('0x31')]=_['keys'](_0x3b5577[_0x093e('0x31')]);_0x104223[_0x093e('0x33')]=_[_0x093e('0x34')](_0x104223[_0x093e('0x30')],_0x104223[_0x093e('0x31')]);_0x10f7eb[_0x093e('0x35')]=_[_0x093e('0x34')](_0x104223[_0x093e('0x30')],qs[_0x093e('0x36')](_0x3b5577[_0x093e('0x31')][_0x093e('0x36')]));_0x10f7eb[_0x093e('0x35')]=_0x10f7eb[_0x093e('0x35')][_0x093e('0x37')]?_0x10f7eb[_0x093e('0x35')]:_0x104223[_0x093e('0x30')];_0x10f7eb[_0x093e('0x3a')]=qs[_0x093e('0x3b')](_0x3b5577[_0x093e('0x31')]['sort']);_0x10f7eb[_0x093e('0x3c')]=qs['filters'](_['pick'](_0x3b5577[_0x093e('0x31')],_0x104223[_0x093e('0x33')]));if(_0x3b5577[_0x093e('0x31')]['filter']){_0x10f7eb[_0x093e('0x3c')]=_[_0x093e('0x48')](_0x10f7eb['where'],{'$or':_['map'](_0x10f7eb['attributes'],function(_0x39efa6){var _0x33df64={};_0x33df64[_0x39efa6]={'$like':'%'+_0x3b5577[_0x093e('0x31')]['filter']+'%'};return _0x33df64;})});}_0x10f7eb=_[_0x093e('0x48')]({},_0x10f7eb,_0x3b5577['options']);return _0x166de7[_0x093e('0x60')](_0x10f7eb);}})[_0x093e('0x26')](function(_0x39b741){if(_0x39b741){_0x1c9fdb=_0x39b741[_0x093e('0x37')];if(!_0x3b5577[_0x093e('0x31')][_0x093e('0x38')](_0x093e('0x39'))){_0x10f7eb[_0x093e('0x1e')]=qs[_0x093e('0x1e')](_0x3b5577[_0x093e('0x31')][_0x093e('0x1e')]);_0x10f7eb['offset']=qs[_0x093e('0x1b')](_0x3b5577['query']['offset']);}return _0x166de7[_0x093e('0x60')](_0x10f7eb);}})[_0x093e('0x26')](function(_0x5058e5){if(_0x5058e5){return _0x5058e5?{'count':_0x1c9fdb,'rows':_0x5058e5}:null;}})[_0x093e('0x26')](respondWithResult(_0x2cc2aa,null))[_0x093e('0x43')](handleError(_0x2cc2aa,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 2de9899..cf97a13 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 _0x3edc=['tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x3ef888,_0x2a01f3){_0x3ef888=_0x3ef888-0x0;var _0x14d858=_0x3edc[_0x3ef888];return _0x14d858;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf874=['request-promise','path','rimraf','./trigger.attributes','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x31cf4e,_0x3d5a6c){var _0x53ce06=function(_0x27c7ea){while(--_0x27c7ea){_0x31cf4e['push'](_0x31cf4e['shift']());}};_0x53ce06(++_0x3d5a6c);}(_0xf874,0x177));var _0x4f87=function(_0x1bd4fb,_0x127757){_0x1bd4fb=_0x1bd4fb-0x0;var _0x3c4658=_0xf874[_0x1bd4fb];return _0x3c4658;};'use strict';var _=require(_0x4f87('0x0'));var util=require('util');var logger=require(_0x4f87('0x1'))(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var rp=require(_0x4f87('0x5'));var fs=require('fs');var path=require(_0x4f87('0x6'));var rimraf=require(_0x4f87('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f87('0x8'));module[_0x4f87('0x9')]=function(_0x5d9a23,_0x50bcb8){return _0x5d9a23['define']('Trigger',attributes,{'tableName':'tools_triggers','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 9702573..1503f57 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 _0x65e7=['limit','include','map','model','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','options','raw','where','attributes'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x65e7,0x69));var _0x765e=function(_0x460d94,_0x55c078){_0x460d94=_0x460d94-0x0;var _0x41e92e=_0x65e7[_0x460d94];return _0x41e92e;};'use strict';var _=require('lodash');var util=require(_0x765e('0x0'));var moment=require(_0x765e('0x1'));var BPromise=require(_0x765e('0x2'));var rs=require(_0x765e('0x3'));var fs=require('fs');var Redis=require(_0x765e('0x4'));var db=require(_0x765e('0x5'))['db'];var utils=require(_0x765e('0x6'));var logger=require('../../config/logger')(_0x765e('0x7'));var config=require(_0x765e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x765e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efff1,_0x286fb8,_0xc876fc){return new BPromise(function(_0x49f2a5,_0x4a9984){return client[_0x765e('0xa')](_0x5efff1,_0xc876fc)[_0x765e('0xb')](function(_0x5e1625){logger[_0x765e('0xc')]('Trigger,\x20%s,\x20%s',_0x286fb8,_0x765e('0xd'));logger[_0x765e('0xe')](_0x765e('0xf'),_0x286fb8,'request\x20sent',JSON[_0x765e('0x10')](_0x5e1625));if(_0x5e1625[_0x765e('0x11')]){if(_0x5e1625[_0x765e('0x11')]['code']===0x1f4){logger[_0x765e('0x11')](_0x765e('0x12'),_0x286fb8,_0x5e1625[_0x765e('0x11')][_0x765e('0x13')]);return _0x4a9984(_0x5e1625[_0x765e('0x11')]['message']);}logger[_0x765e('0x11')](_0x765e('0x12'),_0x286fb8,_0x5e1625[_0x765e('0x11')][_0x765e('0x13')]);return _0x49f2a5(_0x5e1625[_0x765e('0x11')][_0x765e('0x13')]);}else{logger['info'](_0x765e('0x12'),_0x286fb8,'request\x20sent');_0x49f2a5(_0x5e1625['result'][_0x765e('0x13')]);}})[_0x765e('0x14')](function(_0x402a2f){logger[_0x765e('0x11')](_0x765e('0x12'),_0x286fb8,_0x402a2f);_0x4a9984(_0x402a2f);});});}exports[_0x765e('0x15')]=function(_0x4eb712){var _0x3df2ed=this;return new Promise(function(_0x442972,_0x45d2b6){return db[_0x765e('0x16')]['findAll']({'raw':_0x4eb712[_0x765e('0x17')]?_0x4eb712[_0x765e('0x17')][_0x765e('0x18')]===undefined?!![]:![]:!![],'where':_0x4eb712['options']?_0x4eb712[_0x765e('0x17')][_0x765e('0x19')]||null:null,'attributes':_0x4eb712[_0x765e('0x17')]?_0x4eb712['options'][_0x765e('0x1a')]||null:null,'limit':_0x4eb712[_0x765e('0x17')]?_0x4eb712[_0x765e('0x17')][_0x765e('0x1b')]||null:null,'include':_0x4eb712[_0x765e('0x17')]?_0x4eb712[_0x765e('0x17')][_0x765e('0x1c')]?_[_0x765e('0x1d')](_0x4eb712[_0x765e('0x17')][_0x765e('0x1c')],function(_0x3e2984){return{'model':db[_0x3e2984[_0x765e('0x1e')]],'as':_0x3e2984['as'],'attributes':_0x3e2984['attributes'],'include':_0x3e2984[_0x765e('0x1c')]?_[_0x765e('0x1d')](_0x3e2984[_0x765e('0x1c')],function(_0x29ae96){return{'model':db[_0x29ae96[_0x765e('0x1e')]],'as':_0x29ae96['as'],'attributes':_0x29ae96[_0x765e('0x1a')],'include':_0x29ae96[_0x765e('0x1c')]?_[_0x765e('0x1d')](_0x29ae96[_0x765e('0x1c')],function(_0x3dde6a){return{'model':db[_0x3dde6a[_0x765e('0x1e')]],'as':_0x3dde6a['as'],'attributes':_0x3dde6a[_0x765e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x765e('0xb')](function(_0x48a77e){logger[_0x765e('0xc')]('GetTrigger',_0x4eb712);logger[_0x765e('0xe')]('GetTrigger',_0x4eb712,JSON[_0x765e('0x10')](_0x48a77e));_0x442972(_0x48a77e);})['catch'](function(_0x2943ce){logger[_0x765e('0x11')](_0x765e('0x15'),_0x2943ce[_0x765e('0x13')],_0x4eb712);_0x45d2b6(_0x3df2ed[_0x765e('0x11')](0x1f4,_0x2943ce[_0x765e('0x13')]));});});};exports[_0x765e('0x1f')]=function(_0x52d29b){var _0x444de7=this;return new Promise(function(_0xb349ea,_0x47474c){return db[_0x765e('0x16')][_0x765e('0x20')]({'raw':_0x52d29b[_0x765e('0x17')]?_0x52d29b[_0x765e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x52d29b[_0x765e('0x17')]?_0x52d29b['options']['where']||null:null,'attributes':_0x52d29b[_0x765e('0x17')]?_0x52d29b['options'][_0x765e('0x1a')]||null:null,'include':_0x52d29b[_0x765e('0x17')]?_0x52d29b['options']['include']?_[_0x765e('0x1d')](_0x52d29b['options'][_0x765e('0x1c')],function(_0x15d167){return{'model':db[_0x15d167[_0x765e('0x1e')]],'as':_0x15d167['as'],'attributes':_0x15d167[_0x765e('0x1a')],'include':_0x15d167[_0x765e('0x1c')]?_[_0x765e('0x1d')](_0x15d167[_0x765e('0x1c')],function(_0x4b7f94){return{'model':db[_0x4b7f94[_0x765e('0x1e')]],'as':_0x4b7f94['as'],'attributes':_0x4b7f94[_0x765e('0x1a')],'include':_0x4b7f94['include']?_['map'](_0x4b7f94[_0x765e('0x1c')],function(_0x237581){return{'model':db[_0x237581[_0x765e('0x1e')]],'as':_0x237581['as'],'attributes':_0x237581[_0x765e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x765e('0xb')](function(_0x475ebd){logger[_0x765e('0xc')](_0x765e('0x1f'),_0x52d29b);logger[_0x765e('0xe')](_0x765e('0x1f'),_0x52d29b,JSON[_0x765e('0x10')](_0x475ebd));_0xb349ea(_0x475ebd);})[_0x765e('0x14')](function(_0x143aeb){logger['error'](_0x765e('0x1f'),_0x143aeb['message'],_0x52d29b);_0x47474c(_0x444de7[_0x765e('0x11')](0x1f4,_0x143aeb[_0x765e('0x13')]));});});}; \ No newline at end of file +var _0x1afa=['attributes','limit','include','map','model','GetTrigger','debug','ShowTrigger','find','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trigger','findAll','options','raw','where'];(function(_0x1a1689,_0x141eef){var _0x4e043e=function(_0x2172d4){while(--_0x2172d4){_0x1a1689['push'](_0x1a1689['shift']());}};_0x4e043e(++_0x141eef);}(_0x1afa,0x106));var _0xa1af=function(_0x1469db,_0xa6ebe0){_0x1469db=_0x1469db-0x0;var _0x5f0491=_0x1afa[_0x1469db];return _0x5f0491;};'use strict';var _=require(_0xa1af('0x0'));var util=require(_0xa1af('0x1'));var moment=require(_0xa1af('0x2'));var BPromise=require(_0xa1af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1af('0x4'))['db'];var utils=require(_0xa1af('0x5'));var logger=require(_0xa1af('0x6'))(_0xa1af('0x7'));var config=require(_0xa1af('0x8'));var jayson=require(_0xa1af('0x9'));var client=jayson['client'][_0xa1af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37a6d5,_0x3aaf41,_0x1c35cf){return new BPromise(function(_0x3341ac,_0x1ec830){return client[_0xa1af('0xb')](_0x37a6d5,_0x1c35cf)['then'](function(_0x4cc48a){logger[_0xa1af('0xc')](_0xa1af('0xd'),_0x3aaf41,_0xa1af('0xe'));logger['debug'](_0xa1af('0xf'),_0x3aaf41,_0xa1af('0xe'),JSON[_0xa1af('0x10')](_0x4cc48a));if(_0x4cc48a[_0xa1af('0x11')]){if(_0x4cc48a[_0xa1af('0x11')][_0xa1af('0x12')]===0x1f4){logger[_0xa1af('0x11')](_0xa1af('0xd'),_0x3aaf41,_0x4cc48a[_0xa1af('0x11')][_0xa1af('0x13')]);return _0x1ec830(_0x4cc48a[_0xa1af('0x11')]['message']);}logger['error'](_0xa1af('0xd'),_0x3aaf41,_0x4cc48a[_0xa1af('0x11')][_0xa1af('0x13')]);return _0x3341ac(_0x4cc48a[_0xa1af('0x11')][_0xa1af('0x13')]);}else{logger['info'](_0xa1af('0xd'),_0x3aaf41,_0xa1af('0xe'));_0x3341ac(_0x4cc48a['result'][_0xa1af('0x13')]);}})[_0xa1af('0x14')](function(_0x2d9fa5){logger[_0xa1af('0x11')](_0xa1af('0xd'),_0x3aaf41,_0x2d9fa5);_0x1ec830(_0x2d9fa5);});});}exports['GetTrigger']=function(_0x282578){var _0x3a93fd=this;return new Promise(function(_0x42ccca,_0x10d4b8){return db[_0xa1af('0x15')][_0xa1af('0x16')]({'raw':_0x282578[_0xa1af('0x17')]?_0x282578[_0xa1af('0x17')][_0xa1af('0x18')]===undefined?!![]:![]:!![],'where':_0x282578[_0xa1af('0x17')]?_0x282578[_0xa1af('0x17')][_0xa1af('0x19')]||null:null,'attributes':_0x282578[_0xa1af('0x17')]?_0x282578[_0xa1af('0x17')][_0xa1af('0x1a')]||null:null,'limit':_0x282578[_0xa1af('0x17')]?_0x282578[_0xa1af('0x17')][_0xa1af('0x1b')]||null:null,'include':_0x282578[_0xa1af('0x17')]?_0x282578[_0xa1af('0x17')][_0xa1af('0x1c')]?_[_0xa1af('0x1d')](_0x282578[_0xa1af('0x17')][_0xa1af('0x1c')],function(_0x3e056d){return{'model':db[_0x3e056d[_0xa1af('0x1e')]],'as':_0x3e056d['as'],'attributes':_0x3e056d['attributes'],'include':_0x3e056d['include']?_[_0xa1af('0x1d')](_0x3e056d[_0xa1af('0x1c')],function(_0x59e1e8){return{'model':db[_0x59e1e8['model']],'as':_0x59e1e8['as'],'attributes':_0x59e1e8['attributes'],'include':_0x59e1e8[_0xa1af('0x1c')]?_['map'](_0x59e1e8['include'],function(_0x3a5f9f){return{'model':db[_0x3a5f9f[_0xa1af('0x1e')]],'as':_0x3a5f9f['as'],'attributes':_0x3a5f9f[_0xa1af('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e893c){logger['info'](_0xa1af('0x1f'),_0x282578);logger[_0xa1af('0x20')](_0xa1af('0x1f'),_0x282578,JSON[_0xa1af('0x10')](_0x5e893c));_0x42ccca(_0x5e893c);})[_0xa1af('0x14')](function(_0x80e543){logger[_0xa1af('0x11')](_0xa1af('0x1f'),_0x80e543[_0xa1af('0x13')],_0x282578);_0x10d4b8(_0x3a93fd[_0xa1af('0x11')](0x1f4,_0x80e543[_0xa1af('0x13')]));});});};exports[_0xa1af('0x21')]=function(_0x2fedd8){var _0xeb9f04=this;return new Promise(function(_0x117e8f,_0x356341){return db[_0xa1af('0x15')][_0xa1af('0x22')]({'raw':_0x2fedd8[_0xa1af('0x17')]?_0x2fedd8[_0xa1af('0x17')][_0xa1af('0x18')]===undefined?!![]:![]:!![],'where':_0x2fedd8[_0xa1af('0x17')]?_0x2fedd8[_0xa1af('0x17')][_0xa1af('0x19')]||null:null,'attributes':_0x2fedd8['options']?_0x2fedd8[_0xa1af('0x17')][_0xa1af('0x1a')]||null:null,'include':_0x2fedd8[_0xa1af('0x17')]?_0x2fedd8[_0xa1af('0x17')][_0xa1af('0x1c')]?_[_0xa1af('0x1d')](_0x2fedd8['options']['include'],function(_0x54c8be){return{'model':db[_0x54c8be[_0xa1af('0x1e')]],'as':_0x54c8be['as'],'attributes':_0x54c8be[_0xa1af('0x1a')],'include':_0x54c8be[_0xa1af('0x1c')]?_[_0xa1af('0x1d')](_0x54c8be[_0xa1af('0x1c')],function(_0x522452){return{'model':db[_0x522452['model']],'as':_0x522452['as'],'attributes':_0x522452[_0xa1af('0x1a')],'include':_0x522452['include']?_[_0xa1af('0x1d')](_0x522452['include'],function(_0x42be88){return{'model':db[_0x42be88[_0xa1af('0x1e')]],'as':_0x42be88['as'],'attributes':_0x42be88[_0xa1af('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1af('0x23')](function(_0x571933){logger['info'](_0xa1af('0x21'),_0x2fedd8);logger['debug'](_0xa1af('0x21'),_0x2fedd8,JSON[_0xa1af('0x10')](_0x571933));_0x117e8f(_0x571933);})[_0xa1af('0x14')](function(_0x4cd854){logger[_0xa1af('0x11')](_0xa1af('0x21'),_0x4cd854['message'],_0x2fedd8);_0x356341(_0xeb9f04[_0xa1af('0x11')](0x1f4,_0x4cd854[_0xa1af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dda2983..6fd7716 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 _0x0a27=['./trunk.controller','get','isAuthenticated','show','post','clone','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x416904,_0x2ddee8){var _0x254542=function(_0x47e449){while(--_0x47e449){_0x416904['push'](_0x416904['shift']());}};_0x254542(++_0x2ddee8);}(_0x0a27,0xf3));var _0x70a2=function(_0x1dd66f,_0x41e015){_0x1dd66f=_0x1dd66f-0x0;var _0x433b91=_0x0a27[_0x1dd66f];return _0x433b91;};'use strict';var multer=require(_0x70a2('0x0'));var util=require(_0x70a2('0x1'));var path=require(_0x70a2('0x2'));var timeout=require(_0x70a2('0x3'));var express=require(_0x70a2('0x4'));var router=express[_0x70a2('0x5')]();var fs_extra=require(_0x70a2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x70a2('0x7'));var config=require(_0x70a2('0x8'));var controller=require(_0x70a2('0x9'));router[_0x70a2('0xa')]('/',auth[_0x70a2('0xb')](),controller['index']);router[_0x70a2('0xa')]('/:id',auth[_0x70a2('0xb')](),controller[_0x70a2('0xc')]);router[_0x70a2('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0x70a2('0xe')]);router[_0x70a2('0xd')]('/',auth[_0x70a2('0xb')](),controller['create']);router['put'](_0x70a2('0xf'),auth[_0x70a2('0xb')](),controller['update']);router[_0x70a2('0x10')](_0x70a2('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x70a2('0x11')]=router; \ No newline at end of file +var _0x7962=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','clone','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x7962,0x13c));var _0x2796=function(_0x1024e4,_0x508920){_0x1024e4=_0x1024e4-0x0;var _0x4bb4c5=_0x7962[_0x1024e4];return _0x4bb4c5;};'use strict';var multer=require(_0x2796('0x0'));var util=require(_0x2796('0x1'));var path=require(_0x2796('0x2'));var timeout=require(_0x2796('0x3'));var express=require(_0x2796('0x4'));var router=express['Router']();var fs_extra=require(_0x2796('0x5'));var auth=require(_0x2796('0x6'));var interaction=require(_0x2796('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x2796('0x8')]('/',auth[_0x2796('0x9')](),controller['index']);router[_0x2796('0x8')](_0x2796('0xa'),auth[_0x2796('0x9')](),controller[_0x2796('0xb')]);router[_0x2796('0xc')]('/:id/clone',auth[_0x2796('0x9')](),controller[_0x2796('0xd')]);router[_0x2796('0xc')]('/',auth[_0x2796('0x9')](),controller['create']);router['put'](_0x2796('0xa'),auth[_0x2796('0x9')](),controller['update']);router['delete'](_0x2796('0xa'),auth[_0x2796('0x9')](),controller[_0x2796('0xe')]);module[_0x2796('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 631aa6d..a72db9c 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 _0x64ac=['rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','BOOLEAN','sequelize','name','ENUM','friend','user','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split'];(function(_0x4a04de,_0x2e342c){var _0xbbe018=function(_0x39639c){while(--_0x39639c){_0x4a04de['push'](_0x4a04de['shift']());}};_0xbbe018(++_0x2e342c);}(_0x64ac,0x1ae));var _0xc64a=function(_0x2eb148,_0x36a357){_0x2eb148=_0x2eb148-0x0;var _0x4781f5=_0x64ac[_0x2eb148];return _0x4781f5;};'use strict';var Sequelize=require(_0xc64a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc64a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x3'),_0xc64a('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc64a('0x5')],'allowNull':![],'defaultValue':_0xc64a('0x6')},'callingpres':{'type':Sequelize[_0xc64a('0x2')]('ALLOWED_NOT_SCREENED',_0xc64a('0x7'),_0xc64a('0x8'),_0xc64a('0x9'),_0xc64a('0xa'),_0xc64a('0xb'),_0xc64a('0xc'),_0xc64a('0xd'))},'deny':{'type':Sequelize[_0xc64a('0x5')]},'permit':{'type':Sequelize[_0xc64a('0x5')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xc64a('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xc64a('0xe'),'set':function(_0x1d4d01){this[_0xc64a('0xf')](_0xc64a('0x10'),_0x1d4d01?_0x1d4d01[_0xc64a('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xc64a('0x10'))?this[_0xc64a('0x12')](_0xc64a('0x10'))[_0xc64a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x14'),_0xc64a('0x15'),_0xc64a('0x16'),_0xc64a('0x17'),_0xc64a('0x18')),'defaultValue':_0xc64a('0x14')},'directmedia':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no','nonat',_0xc64a('0x1a'),_0xc64a('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc64a('0x5')]},'directmediadeny':{'type':Sequelize[_0xc64a('0x5')]},'nat':{'type':Sequelize[_0xc64a('0x5')],'defaultValue':_0xc64a('0x1c'),'set':function(_0x49c67f){this[_0xc64a('0xf')](_0xc64a('0x1d'),_0x49c67f?_0x49c67f[_0xc64a('0x11')](','):null);},'get':function(){return this[_0xc64a('0x12')]('nat')?this['getDataValue'](_0xc64a('0x1d'))['split'](','):null;},'comment':_0xc64a('0x1e')},'callgroup':{'type':Sequelize[_0xc64a('0x5')]},'namedcallgroup':{'type':Sequelize[_0xc64a('0x5')]},'pickupgroup':{'type':Sequelize[_0xc64a('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xc64a('0x5')]},'language':{'type':Sequelize[_0xc64a('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc64a('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc64a('0x5')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc64a('0x5')],'allowNull':![],'defaultValue':_0xc64a('0x1f'),'set':function(_0x20e5ed){this[_0xc64a('0xf')]('allow',_0x20e5ed?_0x20e5ed['join'](';'):_0xc64a('0x1f'));},'get':function(){return this['getDataValue']('allow')?this[_0xc64a('0x12')](_0xc64a('0x20'))[_0xc64a('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no')},'insecure':{'type':Sequelize[_0xc64a('0x5')],'defaultValue':_0xc64a('0x21'),'set':function(_0x3e5bd8){this[_0xc64a('0xf')](_0xc64a('0x22'),_0x3e5bd8?_0x3e5bd8[_0xc64a('0x11')](','):null);},'get':function(){return this[_0xc64a('0x12')]('insecure')?this[_0xc64a('0x12')](_0xc64a('0x22'))[_0xc64a('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no',_0xc64a('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no')},'accountcode':{'type':Sequelize[_0xc64a('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc64a('0x5')]},'callcounter':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc64a('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xc64a('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xc64a('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xc64a('0x5')]},'template':{'type':Sequelize[_0xc64a('0x5')]},'videosupport':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no',_0xc64a('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc64a('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no')},'mailbox':{'type':Sequelize[_0xc64a('0x5')]},'session_timers':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x26'),_0xc64a('0x27'),_0xc64a('0x28'))},'session_expires':{'type':Sequelize[_0xc64a('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xc64a('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xc64a('0x2')]('uac',_0xc64a('0x29')),'defaultValue':_0xc64a('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xc64a('0x5')]},'regexten':{'type':Sequelize[_0xc64a('0x5')]},'fromdomain':{'type':Sequelize[_0xc64a('0x5')]},'fromuser':{'type':Sequelize[_0xc64a('0x5')]},'port':{'type':Sequelize[_0xc64a('0x24')](0x5)},'qualify':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':_0xc64a('0x19')},'keepalive':{'type':Sequelize[_0xc64a('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc64a('0x5')]},'rtptimeout':{'type':Sequelize[_0xc64a('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc64a('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc64a('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no',_0xc64a('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc64a('0x5')]},'callbackextension':{'type':Sequelize[_0xc64a('0x5')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc64a('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc64a('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xc64a('0x5')]},'contactacl':{'type':Sequelize[_0xc64a('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0xc64a('0x5')]},'use_q850_reason':{'type':Sequelize[_0xc64a('0x5')]},'maxforwards':{'type':Sequelize[_0xc64a('0x24')](0xb)},'encryption':{'type':Sequelize[_0xc64a('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xc64a('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no',_0xc64a('0x2b'),_0xc64a('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xc64a('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc64a('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xc64a('0x5')]},'dtlscipher':{'type':Sequelize[_0xc64a('0x5')]},'dtlscafile':{'type':Sequelize[_0xc64a('0x5')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x2d'),_0xc64a('0x2e'),_0xc64a('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc64a('0x5')]},'usereqphone':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc64a('0x5')]},'recordofffeature':{'type':Sequelize[_0xc64a('0x5')]},'call_limit':{'type':Sequelize[_0xc64a('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc64a('0x2')](_0xc64a('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xc64a('0x19'),'no')},'vmexten':{'type':Sequelize[_0xc64a('0x5')]},'mohinterpret':{'type':Sequelize[_0xc64a('0x5')]},'mohsuggest':{'type':Sequelize[_0xc64a('0x5')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc64a('0x5')]},'host':{'type':Sequelize[_0xc64a('0x5')],'defaultValue':_0xc64a('0x30')},'canreinvite':{'type':Sequelize[_0xc64a('0x2')]('yes','no','nonat',_0xc64a('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc64a('0x5')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc64a('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfaf4=['update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','refuse','originate','uac','uas','pai','fingerprint','active','passive','dynamic'];(function(_0x2eb47c,_0x43bdf3){var _0x13097b=function(_0x1e6c94){while(--_0x1e6c94){_0x2eb47c['push'](_0x2eb47c['shift']());}};_0x13097b(++_0x43bdf3);}(_0xfaf4,0x12f));var _0x4faf=function(_0x35fc72,_0x13d63d){_0x35fc72=_0x35fc72-0x0;var _0x4dacdd=_0xfaf4[_0x35fc72];return _0x4dacdd;};'use strict';var Sequelize=require(_0x4faf('0x0'));module[_0x4faf('0x1')]={'name':{'type':Sequelize[_0x4faf('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4faf('0x3')]('friend','user',_0x4faf('0x4')),'allowNull':![],'defaultValue':_0x4faf('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x6'),'ALLOWED_PASSED_SCREEN',_0x4faf('0x7'),_0x4faf('0x8'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x4faf('0x9'),'PROHIB')},'deny':{'type':Sequelize[_0x4faf('0x2')]},'permit':{'type':Sequelize[_0x4faf('0x2')]},'secret':{'type':Sequelize[_0x4faf('0x2')]},'md5secret':{'type':Sequelize[_0x4faf('0x2')]},'remotesecret':{'type':Sequelize[_0x4faf('0x2')]},'transport':{'type':Sequelize[_0x4faf('0x2')],'defaultValue':'udp','set':function(_0xcfbc1c){this[_0x4faf('0xa')](_0x4faf('0xb'),_0xcfbc1c?_0xcfbc1c[_0x4faf('0xc')](','):null);},'get':function(){return this[_0x4faf('0xd')]('transport')?this[_0x4faf('0xd')](_0x4faf('0xb'))[_0x4faf('0xe')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0xf'),_0x4faf('0x10'),_0x4faf('0x11'),_0x4faf('0x12'),_0x4faf('0x13')),'defaultValue':_0x4faf('0xf')},'directmedia':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no',_0x4faf('0x15'),_0x4faf('0x16'),_0x4faf('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4faf('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x4faf('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x57accb){this[_0x4faf('0xa')](_0x4faf('0x18'),_0x57accb?_0x57accb['join'](','):null);},'get':function(){return this[_0x4faf('0xd')](_0x4faf('0x18'))?this[_0x4faf('0xd')](_0x4faf('0x18'))[_0x4faf('0xe')](','):null;},'comment':_0x4faf('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x4faf('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4faf('0x2')]},'language':{'type':Sequelize[_0x4faf('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x4faf('0x1a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4e2df6){this['setDataValue']('allow',_0x4e2df6?_0x4e2df6['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4faf('0xd')](_0x4faf('0x1b'))?this['getDataValue'](_0x4faf('0x1b'))['split'](';'):null;},'comment':_0x4faf('0x1c')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x26b8c8){this['setDataValue']('insecure',_0x26b8c8?_0x26b8c8[_0x4faf('0xc')](','):null);},'get':function(){return this[_0x4faf('0xd')](_0x4faf('0x1d'))?this['getDataValue'](_0x4faf('0x1d'))[_0x4faf('0xe')](','):null;},'comment':_0x4faf('0x1e')},'trustrpid':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4faf('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x4faf('0x3')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4faf('0x2')]},'callerid':{'type':Sequelize[_0x4faf('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x4faf('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x4faf('0x2')]},'template':{'type':Sequelize[_0x4faf('0x2')]},'videosupport':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'mailbox':{'type':Sequelize[_0x4faf('0x2')]},'session_timers':{'type':Sequelize[_0x4faf('0x3')]('accept',_0x4faf('0x20'),_0x4faf('0x21'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x22'),_0x4faf('0x23')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4faf('0x2')]},'regexten':{'type':Sequelize[_0x4faf('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4faf('0x1f')](0x5)},'qualify':{'type':Sequelize[_0x4faf('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'defaultip':{'type':Sequelize[_0x4faf('0x2')]},'defaultuser':{'type':Sequelize[_0x4faf('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no',_0x4faf('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4faf('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x4faf('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4faf('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4faf('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4faf('0x2')]},'maxforwards':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'encryption':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no')},'force_avp':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'icesupport':{'type':Sequelize[_0x4faf('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no',_0x4faf('0x25'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x4faf('0x1f')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4faf('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x4faf('0x2')]},'dtlscipher':{'type':Sequelize[_0x4faf('0x2')]},'dtlscafile':{'type':Sequelize[_0x4faf('0x2')]},'dtlscapath':{'type':Sequelize[_0x4faf('0x2')]},'dtlssetup':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x26'),_0x4faf('0x27'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4faf('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x4faf('0x1f')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4faf('0x3')](_0x4faf('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x4faf('0x14'),'no')},'vmexten':{'type':Sequelize[_0x4faf('0x2')]},'mohinterpret':{'type':Sequelize[_0x4faf('0x2')]},'mohsuggest':{'type':Sequelize[_0x4faf('0x2')]},'parkinglot':{'type':Sequelize[_0x4faf('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4faf('0x28')},'canreinvite':{'type':Sequelize[_0x4faf('0x3')]('yes','no',_0x4faf('0x15'),_0x4faf('0x16'),_0x4faf('0x29')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4faf('0x2')]},'otherFields':{'type':Sequelize[_0x4faf('0x2')]},'active':{'type':Sequelize[_0x4faf('0x2a')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4faf('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5551f03..e9f88d3 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 _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x559005,_0x200dc8){var _0x38a0ed=function(_0x1e9dcc){while(--_0x1e9dcc){_0x559005['push'](_0x559005['shift']());}};_0x38a0ed(++_0x200dc8);}(_0x54ef,0x112));var _0xf54e=function(_0xac5bd3,_0x5af130){_0xac5bd3=_0xac5bd3-0x0;var _0x53d3b6=_0x54ef[_0xac5bd3];return _0x53d3b6;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2c08d6,_0x1aa207){var _0x26984b=function(_0x5b1d49){while(--_0x5b1d49){_0x2c08d6['push'](_0x2c08d6['shift']());}};_0x26984b(++_0x1aa207);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x00bb[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4640f90..07078ae 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 _0x60f1=['../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5d08d2,_0xf099d6){var _0x4929b1=function(_0xce9dae){while(--_0xce9dae){_0x5d08d2['push'](_0x5d08d2['shift']());}};_0x4929b1(++_0xf099d6);}(_0x60f1,0x71));var _0x160f=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x60f1[_0x5b1c50];return _0x2d379b;};'use strict';var _=require(_0x160f('0x0'));var util=require('util');var logger=require(_0x160f('0x1'))(_0x160f('0x2'));var moment=require(_0x160f('0x3'));var BPromise=require(_0x160f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x160f('0x5'));var rimraf=require(_0x160f('0x6'));var config=require(_0x160f('0x7'));var attributes=require(_0x160f('0x8'));module[_0x160f('0x9')]=function(_0x202ffc,_0x1b5867){return _0x202ffc['define'](_0x160f('0xa'),attributes,{'tableName':_0x160f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b30=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x397f04,_0x2d9ef5){var _0x249786=function(_0xcb369e){while(--_0xcb369e){_0x397f04['push'](_0x397f04['shift']());}};_0x249786(++_0x2d9ef5);}(_0x3b30,0x1ef));var _0x03b3=function(_0x576bb1,_0x3e96a7){_0x576bb1=_0x576bb1-0x0;var _0x12d992=_0x3b30[_0x576bb1];return _0x12d992;};'use strict';var _=require(_0x03b3('0x0'));var util=require(_0x03b3('0x1'));var logger=require(_0x03b3('0x2'))(_0x03b3('0x3'));var moment=require(_0x03b3('0x4'));var BPromise=require(_0x03b3('0x5'));var rp=require(_0x03b3('0x6'));var fs=require('fs');var path=require(_0x03b3('0x7'));var rimraf=require('rimraf');var config=require(_0x03b3('0x8'));var attributes=require(_0x03b3('0x9'));module[_0x03b3('0xa')]=function(_0x28f8e2,_0xbf4dbf){return _0x28f8e2[_0x03b3('0xb')](_0x03b3('0xc'),attributes,{'tableName':_0x03b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 3bd30e4..3245d48 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 _0x17a8=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetTrunk','findAll','options','raw','where','attributes','include','map','model','ShowTrunk','Trunk','find','lodash','util'];(function(_0x44914c,_0x334d1a){var _0x5505dc=function(_0x886758){while(--_0x886758){_0x44914c['push'](_0x44914c['shift']());}};_0x5505dc(++_0x334d1a);}(_0x17a8,0x64));var _0x817a=function(_0x383fac,_0xeda6b6){_0x383fac=_0x383fac-0x0;var _0x38d3b6=_0x17a8[_0x383fac];return _0x38d3b6;};'use strict';var _=require(_0x817a('0x0'));var util=require(_0x817a('0x1'));var moment=require(_0x817a('0x2'));var BPromise=require(_0x817a('0x3'));var rs=require(_0x817a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x817a('0x5'))['db'];var utils=require(_0x817a('0x6'));var logger=require(_0x817a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x817a('0x8')][_0x817a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x303b45,_0x3d94e3,_0x4e2e8c){return new BPromise(function(_0x5e4c82,_0x3f76b1){return client[_0x817a('0xa')](_0x303b45,_0x4e2e8c)[_0x817a('0xb')](function(_0x3e483d){logger['info'](_0x817a('0xc'),_0x3d94e3,'request\x20sent');logger[_0x817a('0xd')](_0x817a('0xe'),_0x3d94e3,_0x817a('0xf'),JSON[_0x817a('0x10')](_0x3e483d));if(_0x3e483d[_0x817a('0x11')]){if(_0x3e483d[_0x817a('0x11')][_0x817a('0x12')]===0x1f4){logger[_0x817a('0x11')](_0x817a('0xc'),_0x3d94e3,_0x3e483d['error'][_0x817a('0x13')]);return _0x3f76b1(_0x3e483d[_0x817a('0x11')][_0x817a('0x13')]);}logger[_0x817a('0x11')]('Trunk,\x20%s,\x20%s',_0x3d94e3,_0x3e483d[_0x817a('0x11')][_0x817a('0x13')]);return _0x5e4c82(_0x3e483d[_0x817a('0x11')][_0x817a('0x13')]);}else{logger[_0x817a('0x14')](_0x817a('0xc'),_0x3d94e3,'request\x20sent');_0x5e4c82(_0x3e483d['result']['message']);}})[_0x817a('0x15')](function(_0x4a7a14){logger['error'](_0x817a('0xc'),_0x3d94e3,_0x4a7a14);_0x3f76b1(_0x4a7a14);});});}exports[_0x817a('0x16')]=function(_0x4dc594){var _0x219632=this;return new Promise(function(_0x47c3f8,_0x3d5903){return db['Trunk'][_0x817a('0x17')]({'raw':_0x4dc594[_0x817a('0x18')]?_0x4dc594[_0x817a('0x18')][_0x817a('0x19')]===undefined?!![]:![]:!![],'where':_0x4dc594['options']?_0x4dc594[_0x817a('0x18')][_0x817a('0x1a')]||null:null,'attributes':_0x4dc594[_0x817a('0x18')]?_0x4dc594[_0x817a('0x18')][_0x817a('0x1b')]||null:null,'limit':_0x4dc594[_0x817a('0x18')]?_0x4dc594[_0x817a('0x18')]['limit']||null:null,'include':_0x4dc594[_0x817a('0x18')]?_0x4dc594[_0x817a('0x18')][_0x817a('0x1c')]?_[_0x817a('0x1d')](_0x4dc594['options']['include'],function(_0x52b51a){return{'model':db[_0x52b51a[_0x817a('0x1e')]],'as':_0x52b51a['as'],'attributes':_0x52b51a[_0x817a('0x1b')],'include':_0x52b51a[_0x817a('0x1c')]?_['map'](_0x52b51a[_0x817a('0x1c')],function(_0x201dc5){return{'model':db[_0x201dc5['model']],'as':_0x201dc5['as'],'attributes':_0x201dc5[_0x817a('0x1b')],'include':_0x201dc5[_0x817a('0x1c')]?_[_0x817a('0x1d')](_0x201dc5[_0x817a('0x1c')],function(_0x1be24f){return{'model':db[_0x1be24f['model']],'as':_0x1be24f['as'],'attributes':_0x1be24f[_0x817a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x817a('0xb')](function(_0x1d77ee){logger[_0x817a('0x14')](_0x817a('0x16'),_0x4dc594);logger[_0x817a('0xd')](_0x817a('0x16'),_0x4dc594,JSON[_0x817a('0x10')](_0x1d77ee));_0x47c3f8(_0x1d77ee);})['catch'](function(_0x4c8afb){logger['error']('GetTrunk',_0x4c8afb[_0x817a('0x13')],_0x4dc594);_0x3d5903(_0x219632[_0x817a('0x11')](0x1f4,_0x4c8afb['message']));});});};exports[_0x817a('0x1f')]=function(_0x51bb75){var _0x22f80f=this;return new Promise(function(_0x537bef,_0x857f3c){return db[_0x817a('0x20')][_0x817a('0x21')]({'raw':_0x51bb75[_0x817a('0x18')]?_0x51bb75[_0x817a('0x18')][_0x817a('0x19')]===undefined?!![]:![]:!![],'where':_0x51bb75['options']?_0x51bb75['options'][_0x817a('0x1a')]||null:null,'attributes':_0x51bb75[_0x817a('0x18')]?_0x51bb75[_0x817a('0x18')][_0x817a('0x1b')]||null:null,'include':_0x51bb75[_0x817a('0x18')]?_0x51bb75[_0x817a('0x18')]['include']?_[_0x817a('0x1d')](_0x51bb75[_0x817a('0x18')][_0x817a('0x1c')],function(_0x36a7f1){return{'model':db[_0x36a7f1['model']],'as':_0x36a7f1['as'],'attributes':_0x36a7f1['attributes'],'include':_0x36a7f1[_0x817a('0x1c')]?_[_0x817a('0x1d')](_0x36a7f1[_0x817a('0x1c')],function(_0x384a74){return{'model':db[_0x384a74[_0x817a('0x1e')]],'as':_0x384a74['as'],'attributes':_0x384a74[_0x817a('0x1b')],'include':_0x384a74[_0x817a('0x1c')]?_[_0x817a('0x1d')](_0x384a74[_0x817a('0x1c')],function(_0x2cdec9){return{'model':db[_0x2cdec9[_0x817a('0x1e')]],'as':_0x2cdec9['as'],'attributes':_0x2cdec9['attributes']};}):[]};}):[]};}):[]:[]})[_0x817a('0xb')](function(_0x8e3981){logger['info'](_0x817a('0x1f'),_0x51bb75);logger['debug'](_0x817a('0x1f'),_0x51bb75,JSON['stringify'](_0x8e3981));_0x537bef(_0x8e3981);})['catch'](function(_0x1d9418){logger[_0x817a('0x11')]('ShowTrunk',_0x1d9418['message'],_0x51bb75);_0x857f3c(_0x22f80f['error'](0x1f4,_0x1d9418[_0x817a('0x13')]));});});}; \ No newline at end of file +var _0x29fe=['../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','map','include','model','attributes','find','ShowTrunk','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x5dff56,_0x1027b1){var _0xc2b9ec=function(_0x44e728){while(--_0x44e728){_0x5dff56['push'](_0x5dff56['shift']());}};_0xc2b9ec(++_0x1027b1);}(_0x29fe,0x7b));var _0xe29f=function(_0x21876e,_0x21c0da){_0x21876e=_0x21876e-0x0;var _0x507c3c=_0x29fe[_0x21876e];return _0x507c3c;};'use strict';var _=require(_0xe29f('0x0'));var util=require(_0xe29f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe29f('0x2'));var fs=require('fs');var Redis=require(_0xe29f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe29f('0x4'));var logger=require(_0xe29f('0x5'))(_0xe29f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe29f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125d96,_0x52f8d7,_0x52acbc){return new BPromise(function(_0x452d21,_0xe1a932){return client['request'](_0x125d96,_0x52acbc)[_0xe29f('0x8')](function(_0x588821){logger[_0xe29f('0x9')]('Trunk,\x20%s,\x20%s',_0x52f8d7,_0xe29f('0xa'));logger[_0xe29f('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x52f8d7,_0xe29f('0xa'),JSON[_0xe29f('0xc')](_0x588821));if(_0x588821[_0xe29f('0xd')]){if(_0x588821[_0xe29f('0xd')][_0xe29f('0xe')]===0x1f4){logger[_0xe29f('0xd')](_0xe29f('0xf'),_0x52f8d7,_0x588821[_0xe29f('0xd')][_0xe29f('0x10')]);return _0xe1a932(_0x588821[_0xe29f('0xd')][_0xe29f('0x10')]);}logger[_0xe29f('0xd')](_0xe29f('0xf'),_0x52f8d7,_0x588821['error']['message']);return _0x452d21(_0x588821[_0xe29f('0xd')][_0xe29f('0x10')]);}else{logger[_0xe29f('0x9')](_0xe29f('0xf'),_0x52f8d7,'request\x20sent');_0x452d21(_0x588821[_0xe29f('0x11')][_0xe29f('0x10')]);}})[_0xe29f('0x12')](function(_0x57c046){logger[_0xe29f('0xd')](_0xe29f('0xf'),_0x52f8d7,_0x57c046);_0xe1a932(_0x57c046);});});}exports[_0xe29f('0x13')]=function(_0x328996){var _0x4ac41a=this;return new Promise(function(_0x27c9f7,_0x37dfa1){return db[_0xe29f('0x14')][_0xe29f('0x15')]({'raw':_0x328996['options']?_0x328996[_0xe29f('0x16')][_0xe29f('0x17')]===undefined?!![]:![]:!![],'where':_0x328996[_0xe29f('0x16')]?_0x328996[_0xe29f('0x16')][_0xe29f('0x18')]||null:null,'attributes':_0x328996[_0xe29f('0x16')]?_0x328996['options']['attributes']||null:null,'limit':_0x328996[_0xe29f('0x16')]?_0x328996[_0xe29f('0x16')][_0xe29f('0x19')]||null:null,'include':_0x328996['options']?_0x328996['options']['include']?_[_0xe29f('0x1a')](_0x328996[_0xe29f('0x16')][_0xe29f('0x1b')],function(_0x5bc8a9){return{'model':db[_0x5bc8a9[_0xe29f('0x1c')]],'as':_0x5bc8a9['as'],'attributes':_0x5bc8a9[_0xe29f('0x1d')],'include':_0x5bc8a9[_0xe29f('0x1b')]?_[_0xe29f('0x1a')](_0x5bc8a9[_0xe29f('0x1b')],function(_0x968d4c){return{'model':db[_0x968d4c[_0xe29f('0x1c')]],'as':_0x968d4c['as'],'attributes':_0x968d4c[_0xe29f('0x1d')],'include':_0x968d4c[_0xe29f('0x1b')]?_[_0xe29f('0x1a')](_0x968d4c[_0xe29f('0x1b')],function(_0x4a2ec9){return{'model':db[_0x4a2ec9[_0xe29f('0x1c')]],'as':_0x4a2ec9['as'],'attributes':_0x4a2ec9[_0xe29f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17439d){logger[_0xe29f('0x9')](_0xe29f('0x13'),_0x328996);logger[_0xe29f('0xb')](_0xe29f('0x13'),_0x328996,JSON[_0xe29f('0xc')](_0x17439d));_0x27c9f7(_0x17439d);})[_0xe29f('0x12')](function(_0x5e33a3){logger[_0xe29f('0xd')](_0xe29f('0x13'),_0x5e33a3[_0xe29f('0x10')],_0x328996);_0x37dfa1(_0x4ac41a[_0xe29f('0xd')](0x1f4,_0x5e33a3[_0xe29f('0x10')]));});});};exports['ShowTrunk']=function(_0x4c9549){var _0x172025=this;return new Promise(function(_0x5420e1,_0x303549){return db[_0xe29f('0x14')][_0xe29f('0x1e')]({'raw':_0x4c9549[_0xe29f('0x16')]?_0x4c9549[_0xe29f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c9549[_0xe29f('0x16')]?_0x4c9549[_0xe29f('0x16')]['where']||null:null,'attributes':_0x4c9549['options']?_0x4c9549['options']['attributes']||null:null,'include':_0x4c9549[_0xe29f('0x16')]?_0x4c9549['options'][_0xe29f('0x1b')]?_[_0xe29f('0x1a')](_0x4c9549[_0xe29f('0x16')][_0xe29f('0x1b')],function(_0x1d5018){return{'model':db[_0x1d5018['model']],'as':_0x1d5018['as'],'attributes':_0x1d5018[_0xe29f('0x1d')],'include':_0x1d5018[_0xe29f('0x1b')]?_[_0xe29f('0x1a')](_0x1d5018[_0xe29f('0x1b')],function(_0x54fa3a){return{'model':db[_0x54fa3a[_0xe29f('0x1c')]],'as':_0x54fa3a['as'],'attributes':_0x54fa3a[_0xe29f('0x1d')],'include':_0x54fa3a[_0xe29f('0x1b')]?_[_0xe29f('0x1a')](_0x54fa3a[_0xe29f('0x1b')],function(_0x241348){return{'model':db[_0x241348[_0xe29f('0x1c')]],'as':_0x241348['as'],'attributes':_0x241348['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b20aa){logger[_0xe29f('0x9')](_0xe29f('0x1f'),_0x4c9549);logger[_0xe29f('0xb')](_0xe29f('0x1f'),_0x4c9549,JSON['stringify'](_0x9b20aa));_0x5420e1(_0x9b20aa);})[_0xe29f('0x12')](function(_0x1eeb24){logger[_0xe29f('0xd')](_0xe29f('0x1f'),_0x1eeb24['message'],_0x4c9549);_0x303549(_0x172025[_0xe29f('0xd')](0x1f4,_0x1eeb24[_0xe29f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0523d72..247904e 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 _0x1833=['../../components/auth/service','./user-setting.controller','/:id','update','exports'];(function(_0x20b4ad,_0x3148f3){var _0x2fd322=function(_0x5ca05e){while(--_0x5ca05e){_0x20b4ad['push'](_0x20b4ad['shift']());}};_0x2fd322(++_0x3148f3);}(_0x1833,0x1db));var _0x3183=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0x1833[_0x4aa2c9];return _0x212e33;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x3183('0x0'));var controller=require(_0x3183('0x1'));router['put'](_0x3183('0x2'),auth['isAuthenticated'](),controller[_0x3183('0x3')]);module[_0x3183('0x4')]=router; \ No newline at end of file +var _0x1d64=['/:id','isAuthenticated','update','exports','../../components/auth/service','./user-setting.controller','put'];(function(_0x515d84,_0x589e0c){var _0x19c9f3=function(_0x5d9e62){while(--_0x5d9e62){_0x515d84['push'](_0x515d84['shift']());}};_0x19c9f3(++_0x589e0c);}(_0x1d64,0x1cb));var _0x41d6=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x1d64[_0x4ae829];return _0x256b31;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x41d6('0x0'));var controller=require(_0x41d6('0x1'));router[_0x41d6('0x2')](_0x41d6('0x3'),auth[_0x41d6('0x4')](),controller[_0x41d6('0x5')]);module[_0x41d6('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index bab87b1..48726bd 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 _0xd2d0=['INTEGER','UserId','error','warning','info','debug','ENUM','DATE'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd2d0,0x1d2));var _0x0d2d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd2d0[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x0d2d('0x0'),_0x0d2d('0x1'),_0x0d2d('0x2'),_0x0d2d('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x0d2d('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0d2d('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0d2d('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x0d2d('0x6')],'unique':_0x0d2d('0x7')}}; \ No newline at end of file +var _0xa066=['TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN'];(function(_0x5c8723,_0x41966b){var _0x59c70a=function(_0xd35dba){while(--_0xd35dba){_0x5c8723['push'](_0x5c8723['shift']());}};_0x59c70a(++_0x41966b);}(_0xa066,0x10c));var _0x6a06=function(_0xf39273,_0x15899a){_0xf39273=_0xf39273-0x0;var _0x27cc53=_0xa066[_0xf39273];return _0x27cc53;};'use strict';var Sequelize=require(_0x6a06('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6a06('0x1'),_0x6a06('0x2'),_0x6a06('0x3'),_0x6a06('0x4')];module[_0x6a06('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x6a06('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6a06('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6a06('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x6a06('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6a06('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6a06('0xa')],'unique':_0x6a06('0xb')}}; \ 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 49f7441..45bdaab 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 _0x9b83=['api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','then','sendStatus','error','name','send','update','user','role','admin','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','catch','lodash','ioredis','../../config/logger'];(function(_0x14ba76,_0x3292e2){var _0x1fef57=function(_0x21c530){while(--_0x21c530){_0x14ba76['push'](_0x14ba76['shift']());}};_0x1fef57(++_0x3292e2);}(_0x9b83,0x84));var _0x39b8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9b83[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x39b8('0x0'));var Redis=require(_0x39b8('0x1'));var logger=require(_0x39b8('0x2'))(_0x39b8('0x3'));var config=require(_0x39b8('0x4'));var db=require(_0x39b8('0x5'))['db'];var socket=require(_0x39b8('0x6'))(new Redis(config[_0x39b8('0x7')]));require(_0x39b8('0x8'))[_0x39b8('0x9')](socket);config['redis']=_[_0x39b8('0xa')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4006c2,_0x3eee6d){_0x3eee6d=_0x3eee6d||0xc8;return function(_0x4be201){if(_0x4be201){return _0x4006c2[_0x39b8('0xb')](_0x3eee6d)[_0x39b8('0xc')](_0x4be201);}};}function saveUpdates(_0x5aba37){return function(_0x53957f){if(_0x53957f){return _0x53957f['update'](_0x5aba37)[_0x39b8('0xd')](function(_0x3fd80d){return _0x3fd80d;});}return null;};}function handleEntityNotFound(_0x14d391){return function(_0x473f6d){if(!_0x473f6d){_0x14d391[_0x39b8('0xe')](0x194);}return _0x473f6d;};}function handleError(_0x289dd4,_0x287db3){_0x287db3=_0x287db3||0x1f4;return function(_0x222809){logger[_0x39b8('0xf')](_0x222809['stack']);if(_0x222809[_0x39b8('0x10')]){delete _0x222809['name'];}_0x289dd4[_0x39b8('0xb')](_0x287db3)[_0x39b8('0x11')](_0x222809);};}exports[_0x39b8('0x12')]=function(_0x276b4a,_0x49788b){if(_0x276b4a[_0x39b8('0x13')][_0x39b8('0x14')]!==_0x39b8('0x15'))throw new Error(_0x39b8('0x16'));if(isNaN(Number(_0x276b4a['params']['id'])))throw new Error(_0x39b8('0x17'));return db['UserSetting'][_0x39b8('0x18')]({'where':{'id':_0x276b4a[_0x39b8('0x19')]['id']}})[_0x39b8('0xd')](handleEntityNotFound(_0x49788b,null))[_0x39b8('0xd')](saveUpdates(_0x276b4a['body'],null))['then'](respondWithResult(_0x49788b,null))[_0x39b8('0x1a')](handleError(_0x49788b,null));}; \ No newline at end of file +var _0xc5c7=['stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','sendStatus','error'];(function(_0x2d1c03,_0x3d0576){var _0x35e2ad=function(_0x54cd1b){while(--_0x54cd1b){_0x2d1c03['push'](_0x2d1c03['shift']());}};_0x35e2ad(++_0x3d0576);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x51a036,_0x503b3d){_0x51a036=_0x51a036-0x0;var _0x4a1989=_0xc5c7[_0x51a036];return _0x4a1989;};'use strict';var _=require('lodash');var Redis=require(_0x7c5c('0x0'));var logger=require(_0x7c5c('0x1'))(_0x7c5c('0x2'));var config=require(_0x7c5c('0x3'));var db=require(_0x7c5c('0x4'))['db'];var socket=require(_0x7c5c('0x5'))(new Redis(config['redis']));require(_0x7c5c('0x6'))[_0x7c5c('0x7')](socket);config[_0x7c5c('0x8')]=_[_0x7c5c('0x9')](config[_0x7c5c('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x5ec99e,_0xdbfbeb){_0xdbfbeb=_0xdbfbeb||0xc8;return function(_0x5895b5){if(_0x5895b5){return _0x5ec99e[_0x7c5c('0xa')](_0xdbfbeb)['json'](_0x5895b5);}};}function saveUpdates(_0x2b27d0){return function(_0x15f4c1){if(_0x15f4c1){return _0x15f4c1['update'](_0x2b27d0)['then'](function(_0x17597c){return _0x17597c;});}return null;};}function handleEntityNotFound(_0x1cd540){return function(_0x5c7073){if(!_0x5c7073){_0x1cd540[_0x7c5c('0xb')](0x194);}return _0x5c7073;};}function handleError(_0x58ef28,_0x1f5e0b){_0x1f5e0b=_0x1f5e0b||0x1f4;return function(_0x5bb950){logger[_0x7c5c('0xc')](_0x5bb950[_0x7c5c('0xd')]);if(_0x5bb950['name']){delete _0x5bb950[_0x7c5c('0xe')];}_0x58ef28[_0x7c5c('0xa')](_0x1f5e0b)[_0x7c5c('0xf')](_0x5bb950);};}exports[_0x7c5c('0x10')]=function(_0x3d5a9d,_0x113c0b){if(_0x3d5a9d[_0x7c5c('0x11')][_0x7c5c('0x12')]!==_0x7c5c('0x13'))throw new Error(_0x7c5c('0x14'));if(isNaN(Number(_0x3d5a9d[_0x7c5c('0x15')]['id'])))throw new Error(_0x7c5c('0x16'));return db[_0x7c5c('0x17')][_0x7c5c('0x18')]({'where':{'id':_0x3d5a9d['params']['id']}})['then'](handleEntityNotFound(_0x113c0b,null))[_0x7c5c('0x19')](saveUpdates(_0x3d5a9d[_0x7c5c('0x1a')],null))[_0x7c5c('0x19')](respondWithResult(_0x113c0b,null))[_0x7c5c('0x1b')](handleError(_0x113c0b,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 275adbb..a37ac6f 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 _0xb150=['emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove'];(function(_0x4cf6bf,_0x27f03c){var _0x51b572=function(_0x17a8ad){while(--_0x17a8ad){_0x4cf6bf['push'](_0x4cf6bf['shift']());}};_0x51b572(++_0x27f03c);}(_0xb150,0x1d9));var _0x0b15=function(_0x18095a,_0x25a2bd){_0x18095a=_0x18095a-0x0;var _0x239aec=_0xb150[_0x18095a];return _0x239aec;};'use strict';var EventEmitter=require(_0x0b15('0x0'));var UserSetting=require(_0x0b15('0x1'))['db'][_0x0b15('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0b15('0x3')](0x0);var events={'afterCreate':_0x0b15('0x4'),'afterUpdate':_0x0b15('0x5'),'afterDestroy':_0x0b15('0x6')};function emitEvent(_0x556c2f){return function(_0x2f6426,_0x3584e3,_0x3bfa8b){UserSettingEvents['emit'](_0x556c2f+':'+_0x2f6426['id'],_0x2f6426);UserSettingEvents[_0x0b15('0x7')](_0x556c2f,_0x2f6426);_0x3bfa8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0b15('0x8')](e,emitEvent(event));}}module[_0x0b15('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xc157=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserSetting'];(function(_0x2694b9,_0x3f669b){var _0x2d7bc8=function(_0x2d4fae){while(--_0x2d4fae){_0x2694b9['push'](_0x2694b9['shift']());}};_0x2d7bc8(++_0x3f669b);}(_0xc157,0xb2));var _0x7c15=function(_0x2ac6e7,_0x35b323){_0x2ac6e7=_0x2ac6e7-0x0;var _0x149efa=_0xc157[_0x2ac6e7];return _0x149efa;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x7c15('0x0'))['db'][_0x7c15('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7c15('0x2')](0x0);var events={'afterCreate':_0x7c15('0x3'),'afterUpdate':_0x7c15('0x4'),'afterDestroy':_0x7c15('0x5')};function emitEvent(_0x1cc3c3){return function(_0x3f4823,_0x59ef59,_0x551d38){UserSettingEvents[_0x7c15('0x6')](_0x1cc3c3+':'+_0x3f4823['id'],_0x3f4823);UserSettingEvents[_0x7c15('0x6')](_0x1cc3c3,_0x3f4823);_0x551d38(null);};}for(var e in events){if(events[_0x7c15('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x7c15('0x8')]=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 21b798d..b8da7dc 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 _0xe9ad=['define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x26489a,_0x10290d){var _0x2c789c=function(_0xd0d405){while(--_0xd0d405){_0x26489a['push'](_0x26489a['shift']());}};_0x2c789c(++_0x10290d);}(_0xe9ad,0x82));var _0xde9a=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0xe9ad[_0x1f6f84];return _0x177f40;};'use strict';var attributes=require(_0xde9a('0x0'));module[_0xde9a('0x1')]=function(_0x1d3798){return _0x1d3798[_0xde9a('0x2')](_0xde9a('0x3'),attributes,{'tableName':_0xde9a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11047e){if(!_0x11047e['clientSideLoggingEnabled'])_0x11047e[_0xde9a('0x5')]=null;else if(_0x11047e[_0xde9a('0x5')]===null)_0x11047e[_0xde9a('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x1094=['exports','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x6d405f,_0x1bb772){var _0x406a28=function(_0x2dc018){while(--_0x2dc018){_0x6d405f['push'](_0x6d405f['shift']());}};_0x406a28(++_0x1bb772);}(_0x1094,0x143));var _0x4109=function(_0x3c60ae,_0x4fbf8e){_0x3c60ae=_0x3c60ae-0x0;var _0xdaf38d=_0x1094[_0x3c60ae];return _0xdaf38d;};'use strict';var attributes=require(_0x4109('0x0'));module[_0x4109('0x1')]=function(_0x4c20db){return _0x4c20db[_0x4109('0x2')]('UserSetting',attributes,{'tableName':_0x4109('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32d6c3){if(!_0x32d6c3[_0x4109('0x4')])_0x32d6c3[_0x4109('0x5')]=null;else if(_0x32d6c3[_0x4109('0x5')]===null)_0x32d6c3['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7079e67..a758d02 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 _0xe3c3=['./user-setting.events','save','remove','update','emit','user-setting:update:user-','UserId','register','length','user-setting:'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xe3c3,0x82));var _0x3e3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3c3[_0x321bb2];return _0x9c12ed;};'use strict';var UserSettingEvents=require(_0x3e3c('0x0'));var events=[_0x3e3c('0x1'),_0x3e3c('0x2'),_0x3e3c('0x3')];function createListener(_0x1b1d93,_0x3143fe){return function(_0x1d1c52){_0x3143fe[_0x3e3c('0x4')](_0x1b1d93,_0x1d1c52);if(_0x1b1d93==='user-setting:update'){_0x3143fe[_0x3e3c('0x4')](_0x3e3c('0x5')+_0x1d1c52[_0x3e3c('0x6')],_0x1d1c52);}};}exports[_0x3e3c('0x7')]=function(_0x1afa7b){for(var _0x35a9cd=0x0,_0x3968d2=events[_0x3e3c('0x8')];_0x35a9cd<_0x3968d2;_0x35a9cd++){var _0x407087=events[_0x35a9cd];var _0x2d51d8=createListener(_0x3e3c('0x9')+_0x407087,_0x1afa7b);UserSettingEvents['on'](_0x407087,_0x2d51d8);}}; \ No newline at end of file +var _0x2e0b=['emit','user-setting:update:user-','UserId','register','user-setting:','save','remove','update','user-setting:update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2e0b,0x1b5));var _0xb2e0=function(_0x484fae,_0x37c7ed){_0x484fae=_0x484fae-0x0;var _0x2df2a7=_0x2e0b[_0x484fae];return _0x2df2a7;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xb2e0('0x0'),_0xb2e0('0x1'),_0xb2e0('0x2')];function createListener(_0xe4f8be,_0x1a7626){return function(_0x45d18f){_0x1a7626['emit'](_0xe4f8be,_0x45d18f);if(_0xe4f8be===_0xb2e0('0x3')){_0x1a7626[_0xb2e0('0x4')](_0xb2e0('0x5')+_0x45d18f[_0xb2e0('0x6')],_0x45d18f);}};}exports[_0xb2e0('0x7')]=function(_0x50b818){for(var _0x57410d=0x0,_0x3cb8d4=events['length'];_0x57410d<_0x3cb8d4;_0x57410d++){var _0x402ea3=events[_0x57410d];var _0xe0c899=createListener(_0xb2e0('0x8')+_0x402ea3,_0x50b818);UserSettingEvents['on'](_0x402ea3,_0xe0c899);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9582e16..e0ac478 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 _0xd993=['/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','/:id/api_key','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/fax_accounts','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','/:id/chat_websites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','whoami'];(function(_0x1f1ca7,_0x2aeb36){var _0x5314bc=function(_0x4834f4){while(--_0x4834f4){_0x1f1ca7['push'](_0x1f1ca7['shift']());}};_0x5314bc(++_0x2aeb36);}(_0xd993,0x19e));var _0x3d99=function(_0x16f559,_0x55dad5){_0x16f559=_0x16f559-0x0;var _0x1dcdf5=_0xd993[_0x16f559];return _0x1dcdf5;};'use strict';var multer=require('multer');var util=require(_0x3d99('0x0'));var path=require(_0x3d99('0x1'));var timeout=require(_0x3d99('0x2'));var express=require(_0x3d99('0x3'));var router=express[_0x3d99('0x4')]();var fs_extra=require(_0x3d99('0x5'));var auth=require(_0x3d99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d99('0x7'));var controller=require('./user.controller');router[_0x3d99('0x8')]('/',auth[_0x3d99('0x9')](),controller[_0x3d99('0xa')]);router['get'](_0x3d99('0xb'),auth['isAuthenticated'](),controller[_0x3d99('0xc')]);router[_0x3d99('0x8')]('/whoami',auth[_0x3d99('0x9')](),controller[_0x3d99('0xd')]);router['get'](_0x3d99('0xe'),auth[_0x3d99('0x9')](),controller[_0x3d99('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x3d99('0x10'),controller[_0x3d99('0x11')]);router['get'](_0x3d99('0x12'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x13')]);router[_0x3d99('0x8')](_0x3d99('0x14'),auth['isAuthenticated'](),controller[_0x3d99('0x15')]);router['get'](_0x3d99('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x3d99('0x8')]('/:id/queues_rt',auth[_0x3d99('0x9')](),controller[_0x3d99('0x17')]);router[_0x3d99('0x8')]('/:id/groups',auth[_0x3d99('0x9')](),controller[_0x3d99('0x18')]);router[_0x3d99('0x8')](_0x3d99('0x19'),auth[_0x3d99('0x9')](),controller['getRecordings']);router[_0x3d99('0x8')]('/:id/screen_recordings',auth[_0x3d99('0x9')](),controller['getScreenRecordings']);router['get'](_0x3d99('0x1a'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x1b')]);router[_0x3d99('0x8')]('/:id/openchannel/interactions',auth[_0x3d99('0x9')](),controller[_0x3d99('0x1c')]);router['get'](_0x3d99('0x1d'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x1e')]);router[_0x3d99('0x8')]('/:id/sms/interactions',auth[_0x3d99('0x9')](),controller[_0x3d99('0x1f')]);router[_0x3d99('0x8')](_0x3d99('0x20'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x21')]);router['get'](_0x3d99('0x22'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x23')]);router[_0x3d99('0x8')]('/:id/teams',auth[_0x3d99('0x9')](),controller['getTeams']);router[_0x3d99('0x8')](_0x3d99('0x24'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x25')]);router[_0x3d99('0x8')](_0x3d99('0x26'),auth[_0x3d99('0x9')](),controller['getAgents']);router['get'](_0x3d99('0x27'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x28')]);router[_0x3d99('0x8')]('/:id/fax_accounts',auth[_0x3d99('0x9')](),controller[_0x3d99('0x29')]);router['get'](_0x3d99('0x2a'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x3d99('0x8')]('/:id/openchannel_accounts',auth[_0x3d99('0x9')](),controller[_0x3d99('0x2b')]);router[_0x3d99('0x8')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x3d99('0x2c')]);router[_0x3d99('0x8')]('/:id/chat_websites',auth[_0x3d99('0x9')](),controller[_0x3d99('0x2d')]);router[_0x3d99('0x8')](_0x3d99('0x2e'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x2f')]);router[_0x3d99('0x8')]('/:id/scheduled_calls',auth[_0x3d99('0x9')](),controller['getScheduledCalls']);router[_0x3d99('0x8')]('/:id/api_key',auth[_0x3d99('0x9')](),controller[_0x3d99('0x30')]);router[_0x3d99('0x31')](_0x3d99('0x14'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x32')]);router[_0x3d99('0x31')]('/',auth[_0x3d99('0x9')](),controller[_0x3d99('0x33')]);router[_0x3d99('0x31')](_0x3d99('0x34'),auth[_0x3d99('0x9')](),controller['bulkCreate']);router['post'](_0x3d99('0x16'),auth['isAuthenticated'](),controller[_0x3d99('0x35')]);var upload=multer({'storage':multer[_0x3d99('0x36')]({'destination':function(_0x1ec647,_0x9d725f,_0x4e14fe){_0x4e14fe(null,path[_0x3d99('0x37')](config[_0x3d99('0x38')],'server/files/images/'));},'filename':function(_0x1c5302,_0x137c4e,_0x3bbb72){_0x3bbb72(null,util[_0x3d99('0x39')](_0x3d99('0x3a'),Date[_0x3d99('0x3b')](),_0x137c4e[_0x3d99('0x3c')]));}})});router[_0x3d99('0x31')](_0x3d99('0x10'),upload[_0x3d99('0x3d')](_0x3d99('0x3e')),controller['addAvatar']);router[_0x3d99('0x31')](_0x3d99('0x3f'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x40')]);router[_0x3d99('0x31')](_0x3d99('0x41'),auth['isAuthenticated'](),controller[_0x3d99('0x42')]);router[_0x3d99('0x31')](_0x3d99('0x43'),auth[_0x3d99('0x9')](),controller['pause']);router[_0x3d99('0x31')](_0x3d99('0x44'),auth[_0x3d99('0x9')](),controller['unpause']);router['post'](_0x3d99('0x45'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x46')]);router[_0x3d99('0x31')](_0x3d99('0x47'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x48')]);router[_0x3d99('0x31')]('/:id/mail_interactions',auth[_0x3d99('0x9')](),controller[_0x3d99('0x49')]);router['post'](_0x3d99('0x4a'),auth['isAuthenticated'](),controller[_0x3d99('0x4b')]);router[_0x3d99('0x31')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x3d99('0x4c')]);router[_0x3d99('0x31')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x3d99('0x9')](),controller[_0x3d99('0x4d')]);router[_0x3d99('0x31')]('/:id/fax_accounts',auth[_0x3d99('0x9')](),controller['addFaxAccounts']);router[_0x3d99('0x31')](_0x3d99('0x2a'),auth['isAuthenticated'](),controller[_0x3d99('0x4e')]);router[_0x3d99('0x31')]('/:id/openchannel_accounts',auth[_0x3d99('0x9')](),controller[_0x3d99('0x4f')]);router[_0x3d99('0x31')](_0x3d99('0x50'),auth['isAuthenticated'](),controller[_0x3d99('0x51')]);router[_0x3d99('0x31')]('/:id/chat_websites',auth[_0x3d99('0x9')](),controller['addChatWebsites']);router[_0x3d99('0x31')](_0x3d99('0x2e'),auth['isAuthenticated'](),controller[_0x3d99('0x52')]);router['post'](_0x3d99('0x53'),auth[_0x3d99('0x9')](),controller['createApiKey']);router[_0x3d99('0x54')]('/:id',auth[_0x3d99('0x9')](),controller[_0x3d99('0x55')]);router[_0x3d99('0x54')](_0x3d99('0x56'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x57')]);router[_0x3d99('0x58')](_0x3d99('0x16'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x59')]);router[_0x3d99('0x58')](_0x3d99('0x45'),auth['isAuthenticated'](),controller[_0x3d99('0x5a')]);router[_0x3d99('0x58')]('/:id',auth[_0x3d99('0x9')](),controller['destroy']);router[_0x3d99('0x58')](_0x3d99('0x47'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x5b')]);router[_0x3d99('0x58')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x3d99('0x5c')]);router[_0x3d99('0x58')]('/:id/fax_interactions',auth[_0x3d99('0x9')](),controller[_0x3d99('0x5d')]);router[_0x3d99('0x58')](_0x3d99('0x5e'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x5f')]);router[_0x3d99('0x58')](_0x3d99('0x60'),auth[_0x3d99('0x9')](),controller['removeOpenchannelInteractions']);router[_0x3d99('0x58')](_0x3d99('0x61'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x62')]);router[_0x3d99('0x58')](_0x3d99('0x63'),auth[_0x3d99('0x9')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0x3d99('0x9')](),controller[_0x3d99('0x64')]);router[_0x3d99('0x58')](_0x3d99('0x65'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x66')]);router[_0x3d99('0x58')](_0x3d99('0x50'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router['delete'](_0x3d99('0x67'),auth[_0x3d99('0x9')](),controller['removeChatWebsites']);router[_0x3d99('0x58')](_0x3d99('0x2e'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x68')]);router[_0x3d99('0x58')](_0x3d99('0x53'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0x3d99('0x31')](_0x3d99('0x69'),auth[_0x3d99('0x9')](),controller[_0x3d99('0x6a')]);module['exports']=router; \ No newline at end of file +var _0xf562=['/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','get','/describe','describe','/whoami','whoami','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','post','addContacts','/:id/queues','diskStorage','join','root','format','%s-%s','now','originalname','/:id/avatar','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts'];(function(_0x1add05,_0x2b5f52){var _0x45b927=function(_0x1b3fbe){while(--_0x1b3fbe){_0x1add05['push'](_0x1add05['shift']());}};_0x45b927(++_0x2b5f52);}(_0xf562,0x100));var _0x2f56=function(_0x84acf,_0x31d82c){_0x84acf=_0x84acf-0x0;var _0x1dd80e=_0xf562[_0x84acf];return _0x1dd80e;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var fs_extra=require(_0x2f56('0x6'));var auth=require(_0x2f56('0x7'));var interaction=require(_0x2f56('0x8'));var config=require('../../config/environment');var controller=require(_0x2f56('0x9'));router['get']('/',auth[_0x2f56('0xa')](),controller['index']);router[_0x2f56('0xb')](_0x2f56('0xc'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xd')]);router[_0x2f56('0xb')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xf')]);router[_0x2f56('0xb')]('/presence',auth[_0x2f56('0xa')](),controller[_0x2f56('0x10')]);router['get'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller['show']);router[_0x2f56('0xb')]('/:id/avatar',controller[_0x2f56('0x12')]);router['get'](_0x2f56('0x13'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x14')]);router[_0x2f56('0xb')](_0x2f56('0x15'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x16')]);router[_0x2f56('0xb')]('/:id/queues',auth[_0x2f56('0xa')](),controller[_0x2f56('0x17')]);router[_0x2f56('0xb')](_0x2f56('0x18'),auth[_0x2f56('0xa')](),controller['getVoiceQueuesRt']);router[_0x2f56('0xb')](_0x2f56('0x19'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x1a')]);router[_0x2f56('0xb')]('/:id/recordings',auth[_0x2f56('0xa')](),controller[_0x2f56('0x1b')]);router[_0x2f56('0xb')](_0x2f56('0x1c'),auth[_0x2f56('0xa')](),controller['getScreenRecordings']);router[_0x2f56('0xb')](_0x2f56('0x1d'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x1e')]);router[_0x2f56('0xb')](_0x2f56('0x1f'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x20')]);router['get'](_0x2f56('0x21'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x2f56('0xb')](_0x2f56('0x22'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x23')]);router[_0x2f56('0xb')](_0x2f56('0x24'),auth[_0x2f56('0xa')](),controller['getFaxInteractions']);router['get'](_0x2f56('0x25'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x26')]);router[_0x2f56('0xb')](_0x2f56('0x27'),auth['isAuthenticated'](),controller[_0x2f56('0x28')]);router[_0x2f56('0xb')](_0x2f56('0x29'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x2a')]);router[_0x2f56('0xb')](_0x2f56('0x2b'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x2c')]);router['get'](_0x2f56('0x2d'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x2f56('0xb')](_0x2f56('0x2e'),auth[_0x2f56('0xa')](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0x2f56('0xa')](),controller[_0x2f56('0x2f')]);router[_0x2f56('0xb')](_0x2f56('0x30'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x31')]);router[_0x2f56('0xb')]('/:id/sms_accounts',auth[_0x2f56('0xa')](),controller[_0x2f56('0x32')]);router[_0x2f56('0xb')]('/:id/chat_websites',auth[_0x2f56('0xa')](),controller[_0x2f56('0x33')]);router[_0x2f56('0xb')](_0x2f56('0x34'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x35')]);router[_0x2f56('0xb')]('/:id/scheduled_calls',auth[_0x2f56('0xa')](),controller[_0x2f56('0x36')]);router['get'](_0x2f56('0x37'),auth[_0x2f56('0xa')](),controller['getApiKey']);router[_0x2f56('0x38')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x2f56('0x39')]);router[_0x2f56('0x38')]('/',auth[_0x2f56('0xa')](),controller['create']);router[_0x2f56('0x38')]('/create_many',auth[_0x2f56('0xa')](),controller['bulkCreate']);router[_0x2f56('0x38')](_0x2f56('0x3a'),auth[_0x2f56('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x2f56('0x3b')]({'destination':function(_0x32f640,_0x341a8e,_0x39ac26){_0x39ac26(null,path[_0x2f56('0x3c')](config[_0x2f56('0x3d')],'server/files/images/'));},'filename':function(_0x116f4e,_0x39c728,_0x442300){_0x442300(null,util[_0x2f56('0x3e')](_0x2f56('0x3f'),Date[_0x2f56('0x40')](),_0x39c728[_0x2f56('0x41')]));}})});router[_0x2f56('0x38')](_0x2f56('0x42'),upload['single'](_0x2f56('0x43')),controller['addAvatar']);router[_0x2f56('0x38')](_0x2f56('0x44'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x45')]);router[_0x2f56('0x38')](_0x2f56('0x46'),auth[_0x2f56('0xa')](),controller['logout']);router['post'](_0x2f56('0x47'),auth['isAuthenticated'](),controller[_0x2f56('0x48')]);router[_0x2f56('0x38')](_0x2f56('0x49'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x4a')]);router[_0x2f56('0x38')](_0x2f56('0x27'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x4b')]);router['post']('/:id/chat_interactions',auth[_0x2f56('0xa')](),controller['addChatInteractions']);router[_0x2f56('0x38')](_0x2f56('0x4c'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x4d')]);router[_0x2f56('0x38')](_0x2f56('0x4e'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0x2f56('0x4f'),auth['isAuthenticated'](),controller[_0x2f56('0x50')]);router[_0x2f56('0x38')]('/:id/openchannel_interactions',auth[_0x2f56('0xa')](),controller['addOpenchannelInteractions']);router[_0x2f56('0x38')]('/:id/whatsapp_interactions',auth[_0x2f56('0xa')](),controller[_0x2f56('0x51')]);router[_0x2f56('0x38')](_0x2f56('0x2e'),auth['isAuthenticated'](),controller[_0x2f56('0x52')]);router[_0x2f56('0x38')](_0x2f56('0x53'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x54')]);router['post'](_0x2f56('0x30'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x55')]);router['post'](_0x2f56('0x56'),auth['isAuthenticated'](),controller[_0x2f56('0x57')]);router[_0x2f56('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x2f56('0x58')]);router[_0x2f56('0x38')](_0x2f56('0x34'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x59')]);router['post'](_0x2f56('0x37'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x5a')]);router['put'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x5b')]);router[_0x2f56('0x5c')]('/:id/password',auth[_0x2f56('0xa')](),controller[_0x2f56('0x5d')]);router[_0x2f56('0x5e')](_0x2f56('0x3a'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x5f')]);router[_0x2f56('0x5e')]('/:id/teams',auth[_0x2f56('0xa')](),controller[_0x2f56('0x60')]);router['delete']('/:id',auth[_0x2f56('0xa')](),controller[_0x2f56('0x61')]);router['delete'](_0x2f56('0x62'),auth['isAuthenticated'](),controller[_0x2f56('0x63')]);router['delete'](_0x2f56('0x4c'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x2f56('0x5e')](_0x2f56('0x4e'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x64')]);router['delete'](_0x2f56('0x4f'),auth['isAuthenticated'](),controller[_0x2f56('0x65')]);router[_0x2f56('0x5e')](_0x2f56('0x66'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x67')]);router['delete']('/:id/whatsapp_interactions',auth[_0x2f56('0xa')](),controller[_0x2f56('0x68')]);router['delete'](_0x2f56('0x2e'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x69')]);router[_0x2f56('0x5e')](_0x2f56('0x53'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x6a')]);router[_0x2f56('0x5e')](_0x2f56('0x30'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x6b')]);router[_0x2f56('0x5e')](_0x2f56('0x56'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x6c')]);router[_0x2f56('0x5e')](_0x2f56('0x6d'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x6e')]);router[_0x2f56('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x2f56('0x6f')]);router[_0x2f56('0x5e')](_0x2f56('0x37'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x70')]);router[_0x2f56('0x38')]('/:id/messengerSoundNotification',auth[_0x2f56('0xa')](),controller['messengerSoundNotification']);module[_0x2f56('0x71')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a5afdb3..65f9a4a 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 _0xcef1=['wss','encryption','icesupport','dtlsenable','dtlsverify','dtlssetup','rtcp_mux','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','admin','telephone','local','INTEGER','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','user','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','join','transport','split','shortinfo','inband','auto','rfc2833','nonat','update','yes','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]','\x22\x22\x20<>','always','refuse','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','get','isArray','udp'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcef1,0x6b));var _0x1cef=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xcef1[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x1cef('0x0'));var moment=require(_0x1cef('0x1'));var util=require(_0x1cef('0x2'));var _=require('lodash');module[_0x1cef('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1cef('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2c70a9){this[_0x1cef('0x5')](_0x1cef('0x4'),_0x2c70a9);this[_0x1cef('0x5')](_0x1cef('0x6'),_0x2c70a9);},'comment':_0x1cef('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x18bd1b){this[_0x1cef('0x5')]('fullname',_0x18bd1b);this[_0x1cef('0x5')](_0x1cef('0x8'),util[_0x1cef('0x9')](_0x1cef('0xa'),_0x18bd1b,this[_0x1cef('0xb')](_0x1cef('0xc'))));}},'alias':{'type':Sequelize[_0x1cef('0xd')]},'email':{'type':Sequelize[_0x1cef('0xd')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x25d7ed){if(_0x25d7ed){this[_0x1cef('0x5')](_0x1cef('0xe'),_0x25d7ed['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x1cef('0xf'),'user','agent',_0x1cef('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x1cef('0xd')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cef('0xd')],'defaultValue':_0x1cef('0x11')},'internal':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25d0fc){this[_0x1cef('0x5')](_0x1cef('0xc'),_0x25d0fc);this[_0x1cef('0x5')]('accountcode',_0x25d0fc);this[_0x1cef('0x5')](_0x1cef('0x8'),util['format']('\x22%s\x22\x20<%s>',this[_0x1cef('0xb')](_0x1cef('0x13')),_0x25d0fc));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x1cef('0xd')]},'zipcode':{'type':Sequelize[_0x1cef('0xd')]},'userpic':{'type':Sequelize[_0x1cef('0xd')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1cef('0xd')]},'online':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cef('0xd')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x1cef('0x15')]},'chatCapacity':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'host':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'defaultValue':_0x1cef('0x16')},'ipaddr':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'port':{'type':Sequelize[_0x1cef('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x18'),_0x1cef('0x19'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x1cef('0x1a'),_0x1cef('0x1b'),_0x1cef('0x1c'),_0x1cef('0x1d'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x1cef('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4c8b54){this[_0x1cef('0x5')]('transport',_0x4c8b54?_0x4c8b54[_0x1cef('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x1cef('0x20'))?this['getDataValue'](_0x1cef('0x20'))[_0x1cef('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1cef('0x17')]('rfc2833','info',_0x1cef('0x22'),_0x1cef('0x23'),_0x1cef('0x24')),'allowNull':!![],'defaultValue':_0x1cef('0x25')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x1cef('0x26'),_0x1cef('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5204a3){this[_0x1cef('0x5')](_0x1cef('0x29'),_0x5204a3?_0x5204a3[_0x1cef('0x1f')](','):null);},'get':function(){return this[_0x1cef('0xb')]('nat')?this[_0x1cef('0xb')](_0x1cef('0x29'))[_0x1cef('0x21')](','):null;},'comment':_0x1cef('0x2a')},'callgroup':{'type':Sequelize[_0x1cef('0xd')]},'namedcallgroup':{'type':Sequelize[_0x1cef('0xd')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x1cef('0xd')]},'language':{'type':Sequelize[_0x1cef('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x1cef('0xd')],'allowNull':![],'defaultValue':_0x1cef('0x2b')},'allow':{'type':Sequelize[_0x1cef('0xd')],'allowNull':![],'defaultValue':_0x1cef('0x2c'),'set':function(_0x49eafa){this['setDataValue']('allow',_0x49eafa?_0x49eafa[_0x1cef('0x1f')](';'):_0x1cef('0x2c'));},'get':function(){return this[_0x1cef('0xb')](_0x1cef('0x2d'))?this['getDataValue'](_0x1cef('0x2d'))[_0x1cef('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'set':function(_0x35cb44){this[_0x1cef('0x5')](_0x1cef('0x2e'),_0x35cb44?_0x35cb44[_0x1cef('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0x1cef('0x2e'))?this[_0x1cef('0xb')]('insecure')[_0x1cef('0x21')](','):null;},'comment':_0x1cef('0x2f')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1cef('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cef('0x17')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![],'defaultValue':_0x1cef('0x30')},'amaflags':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1cef('0x28')},'busylevel':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cef('0x17')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cef('0x17')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no',_0x1cef('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1cef('0x17')]('accept',_0x1cef('0x32'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x33'),_0x1cef('0x34')),'allowNull':!![],'defaultValue':_0x1cef('0x34')},'t38pt_usertpsource':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1cef('0x28')},'keepalive':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cef('0x17')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no',_0x1cef('0x35'),_0x1cef('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cef('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x37'),_0x1cef('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x1cef('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cef('0x17')]('yes','no',_0x1cef('0x26'),_0x1cef('0x27'),_0x1cef('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x1cef('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1cef('0x3a')]},'showWebBar':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0,'set':function(_0x4c28fe){this['setDataValue'](_0x1cef('0x3b'),_0x4c28fe);var _0x312fb6=this[_0x1cef('0x3c')]({'plain':!![]});switch(_0x4c28fe){case 0x0:case 0x1:var _0x5703bb=_0x312fb6[_0x1cef('0x20')]?_[_0x1cef('0x3d')](_0x312fb6['transport'])?_0x312fb6[_0x1cef('0x20')][_0x1cef('0x1f')]():_0x312fb6[_0x1cef('0x20')]:_0x1cef('0x3e');if(_0x5703bb===_0x1cef('0x3f')){_0x5703bb='udp';}this[_0x1cef('0x5')](_0x1cef('0x20'),_0x5703bb);this[_0x1cef('0x5')](_0x1cef('0x40'),'no');this[_0x1cef('0x5')]('avpf',null);this[_0x1cef('0x5')]('force_avp',null);this['setDataValue'](_0x1cef('0x41'),null);this[_0x1cef('0x5')](_0x1cef('0x42'),null);this[_0x1cef('0x5')](_0x1cef('0x43'),null);this['setDataValue'](_0x1cef('0x44'),null);this[_0x1cef('0x5')]('dtlscertfile',null);this[_0x1cef('0x5')]('dtlsprivatekey',null);this[_0x1cef('0x5')](_0x1cef('0x45'),'no');break;case 0x2:this[_0x1cef('0x5')](_0x1cef('0x20'),_0x1cef('0x3f'));this[_0x1cef('0x5')](_0x1cef('0x40'),_0x1cef('0x28'));this[_0x1cef('0x5')]('avpf',_0x1cef('0x28'));this[_0x1cef('0x5')](_0x1cef('0x46'),_0x1cef('0x28'));this[_0x1cef('0x5')](_0x1cef('0x41'),_0x1cef('0x28'));this[_0x1cef('0x5')](_0x1cef('0x42'),_0x1cef('0x28'));this[_0x1cef('0x5')]('dtlsverify','no');this['setDataValue'](_0x1cef('0x44'),'actpass');this[_0x1cef('0x5')](_0x1cef('0x47'),_0x312fb6[_0x1cef('0x47')]||_0x1cef('0x48'));this[_0x1cef('0x5')](_0x1cef('0x49'),_0x312fb6[_0x1cef('0x49')]||_0x1cef('0x4a'));this['setDataValue']('rtcp_mux',_0x1cef('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x1cef('0x3a')],'set':function(_0x17bb16){this[_0x1cef('0x5')](_0x1cef('0x4b'),_0x17bb16?_0x17bb16[_0x1cef('0x1f')](','):[]);},'get':function(){return this[_0x1cef('0xb')](_0x1cef('0x4b'))?_[_0x1cef('0x4c')](this[_0x1cef('0xb')]('permissions')[_0x1cef('0x21')](','),function(_0x54af8a){return parseInt(_0x54af8a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cef('0xd')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x1cef('0xd')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cef('0xd')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cef('0x17')](_0x1cef('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cef('0x4d')],'get':function(){return this[_0x1cef('0xb')](_0x1cef('0x4e'))?this['getDataValue'](_0x1cef('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1cef('0xd')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cef('0xd')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![],'set':function(_0x51a83c){if(typeof _0x51a83c==='string'){var _0x15c5ee=_0x51a83c==='1'?!![]:_0x51a83c==='0'?![]:_0x51a83c===_0x1cef('0x4f')?!![]:_0x51a83c===_0x1cef('0x50')?![]:![];this[_0x1cef('0x5')](_0x1cef('0x51'),_0x15c5ee);}else{this['setDataValue']('screenrecording',_0x51a83c);}}},'blocked':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![],'set':function(_0x6861aa){this[_0x1cef('0x5')]('blocked',_0x6861aa);if(_0x6861aa===!![]){this[_0x1cef('0x5')](_0x1cef('0x52'),moment());this[_0x1cef('0x5')](_0x1cef('0x53'),0x0);}else{this[_0x1cef('0x5')](_0x1cef('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x1cef('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cef('0x12')](0x5)[_0x1cef('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1cef('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1cef('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0xe992=['rtcp_mux','encryption','avpf','force_avp','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','icesupport','dtlsenable','dtlssetup'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xe992,0x74));var _0x2e99=function(_0x163621,_0xf7b6d9){_0x163621=_0x163621-0x0;var _0x384139=_0xe992[_0x163621];return _0x384139;};'use strict';var Sequelize=require(_0x2e99('0x0'));var moment=require(_0x2e99('0x1'));var util=require(_0x2e99('0x2'));var _=require(_0x2e99('0x3'));module[_0x2e99('0x4')]={'name':{'type':Sequelize[_0x2e99('0x5')],'allowNull':![],'unique':_0x2e99('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x458fd8){this[_0x2e99('0x7')](_0x2e99('0x6'),_0x458fd8);this[_0x2e99('0x7')](_0x2e99('0x8'),_0x458fd8);},'comment':_0x2e99('0x9')},'fullname':{'type':Sequelize[_0x2e99('0x5')],'allowNull':![],'set':function(_0x54905e){this['setDataValue']('fullname',_0x54905e);this['setDataValue'](_0x2e99('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x54905e,this[_0x2e99('0xb')](_0x2e99('0xc'))));}},'alias':{'type':Sequelize[_0x2e99('0x5')]},'email':{'type':Sequelize[_0x2e99('0x5')],'allowNull':![],'unique':_0x2e99('0xd'),'validate':{'isEmail':!![]},'set':function(_0x13c0b5){if(_0x13c0b5){this[_0x2e99('0x7')]('email',_0x13c0b5[_0x2e99('0xe')]());}}},'role':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x10'),_0x2e99('0x11'),_0x2e99('0x12'),_0x2e99('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x2e99('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2e99('0x5')],'defaultValue':_0x2e99('0x14')},'internal':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2e2826){this[_0x2e99('0x7')](_0x2e99('0xc'),_0x2e2826);this['setDataValue'](_0x2e99('0x16'),_0x2e2826);this['setDataValue'](_0x2e99('0xa'),util[_0x2e99('0x17')](_0x2e99('0x18'),this[_0x2e99('0xb')]('fullname'),_0x2e2826));}},'salt':{'type':Sequelize[_0x2e99('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x2e99('0x5')]},'zipcode':{'type':Sequelize[_0x2e99('0x5')]},'userpic':{'type':Sequelize[_0x2e99('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2e99('0x1a')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2e99('0x1a')]},'chatCapacity':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2e99('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'defaultValue':_0x2e99('0x1b')},'ipaddr':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x2e99('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x1c'),_0x2e99('0x11'),_0x2e99('0x1d')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x1e'),_0x2e99('0x1f'),_0x2e99('0x20'),_0x2e99('0x21'),_0x2e99('0x22'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x2e99('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'defaultValue':_0x2e99('0x24'),'set':function(_0x3d68b4){this['setDataValue']('transport',_0x3d68b4?_0x3d68b4[_0x2e99('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x2e99('0x26'))?this[_0x2e99('0xb')](_0x2e99('0x26'))[_0x2e99('0x27')](','):null;},'comment':_0x2e99('0x28')},'dtmfmode':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x29'),_0x2e99('0x2a'),_0x2e99('0x2b'),_0x2e99('0x2c'),_0x2e99('0x2d')),'allowNull':!![],'defaultValue':_0x2e99('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no',_0x2e99('0x2f'),_0x2e99('0x30'),_0x2e99('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'defaultValue':_0x2e99('0x32'),'set':function(_0xd4864d){this[_0x2e99('0x7')](_0x2e99('0x33'),_0xd4864d?_0xd4864d[_0x2e99('0x25')](','):null);},'get':function(){return this[_0x2e99('0xb')]('nat')?this[_0x2e99('0xb')]('nat')[_0x2e99('0x27')](','):null;},'comment':_0x2e99('0x34')},'callgroup':{'type':Sequelize[_0x2e99('0x5')]},'namedcallgroup':{'type':Sequelize[_0x2e99('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2e99('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2e99('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e99('0x35')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e99('0x36'),'set':function(_0x429181){this[_0x2e99('0x7')](_0x2e99('0x37'),_0x429181?_0x429181[_0x2e99('0x25')](';'):_0x2e99('0x36'));},'get':function(){return this['getDataValue'](_0x2e99('0x37'))?this['getDataValue'](_0x2e99('0x37'))[_0x2e99('0x27')](';'):null;},'comment':_0x2e99('0x38')},'autoframing':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'set':function(_0x549836){this['setDataValue'](_0x2e99('0x39'),_0x549836?_0x549836[_0x2e99('0x25')](','):null);},'get':function(){return this[_0x2e99('0xb')](_0x2e99('0x39'))?this[_0x2e99('0xb')]('insecure')[_0x2e99('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no',_0x2e99('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2e99('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![],'defaultValue':_0x2e99('0x3b')},'amaflags':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x2e99('0x2e')},'busylevel':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2e99('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x3c'),_0x2e99('0x3d'),_0x2e99('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x3f'),_0x2e99('0x40')),'allowNull':!![],'defaultValue':_0x2e99('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x2e99('0x2e')},'keepalive':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no',_0x2e99('0x41'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2e99('0xf')]('active','passive',_0x2e99('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x2e99('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2e99('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no',_0x2e99('0x2f'),_0x2e99('0x30'),_0x2e99('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x2e99('0x1a')]},'passwordResetAt':{'type':Sequelize[_0x2e99('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2e99('0x44')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3db555){this[_0x2e99('0x7')](_0x2e99('0x45'),_0x3db555);var _0x5be726=this[_0x2e99('0x46')]({'plain':!![]});switch(_0x3db555){case 0x0:case 0x1:var _0x275d8c=_0x5be726[_0x2e99('0x26')]?_[_0x2e99('0x47')](_0x5be726[_0x2e99('0x26')])?_0x5be726['transport'][_0x2e99('0x25')]():_0x5be726[_0x2e99('0x26')]:_0x2e99('0x24');if(_0x275d8c===_0x2e99('0x48')){_0x275d8c=_0x2e99('0x24');}this[_0x2e99('0x7')](_0x2e99('0x26'),_0x275d8c);this[_0x2e99('0x7')]('encryption','no');this[_0x2e99('0x7')]('avpf',null);this['setDataValue']('force_avp',null);this['setDataValue'](_0x2e99('0x49'),null);this[_0x2e99('0x7')](_0x2e99('0x4a'),null);this['setDataValue']('dtlsverify',null);this[_0x2e99('0x7')](_0x2e99('0x4b'),null);this[_0x2e99('0x7')]('dtlscertfile',null);this[_0x2e99('0x7')]('dtlsprivatekey',null);this[_0x2e99('0x7')](_0x2e99('0x4c'),'no');break;case 0x2:this['setDataValue'](_0x2e99('0x26'),'wss');this[_0x2e99('0x7')](_0x2e99('0x4d'),_0x2e99('0x2e'));this['setDataValue'](_0x2e99('0x4e'),_0x2e99('0x2e'));this['setDataValue'](_0x2e99('0x4f'),_0x2e99('0x2e'));this[_0x2e99('0x7')]('icesupport',_0x2e99('0x2e'));this['setDataValue'](_0x2e99('0x4a'),'yes');this[_0x2e99('0x7')](_0x2e99('0x50'),'no');this[_0x2e99('0x7')](_0x2e99('0x4b'),_0x2e99('0x42'));this[_0x2e99('0x7')](_0x2e99('0x51'),_0x5be726['dtlscertfile']||_0x2e99('0x52'));this[_0x2e99('0x7')](_0x2e99('0x53'),_0x5be726['dtlsprivatekey']||_0x2e99('0x54'));this[_0x2e99('0x7')](_0x2e99('0x4c'),_0x2e99('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x2e99('0x44')],'set':function(_0x585b4f){this['setDataValue'](_0x2e99('0x55'),_0x585b4f?_0x585b4f['join'](','):[]);},'get':function(){return this[_0x2e99('0xb')](_0x2e99('0x55'))?_[_0x2e99('0x56')](this[_0x2e99('0xb')](_0x2e99('0x55'))[_0x2e99('0x27')](','),function(_0x4f4a92){return parseInt(_0x4f4a92,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2e99('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2e99('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2e99('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2e99('0xf')](_0x2e99('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2e99('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2e99('0x57')],'get':function(){return this[_0x2e99('0xb')](_0x2e99('0x58'))?this[_0x2e99('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2e99('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2e99('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![],'set':function(_0x34d2b5){if(typeof _0x34d2b5===_0x2e99('0x59')){var _0x4a1b17=_0x34d2b5==='1'?!![]:_0x34d2b5==='0'?![]:_0x34d2b5==='true'?!![]:_0x34d2b5===_0x2e99('0x5a')?![]:![];this[_0x2e99('0x7')]('screenrecording',_0x4a1b17);}else{this[_0x2e99('0x7')](_0x2e99('0x5b'),_0x34d2b5);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x34d89f){this[_0x2e99('0x7')](_0x2e99('0x5c'),_0x34d89f);if(_0x34d89f===!![]){this['setDataValue'](_0x2e99('0x5d'),moment());this[_0x2e99('0x7')](_0x2e99('0x5e'),0x0);}else{this[_0x2e99('0x7')](_0x2e99('0x5d'),null);}}},'blockedAt':{'type':Sequelize[_0x2e99('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2e99('0x15')](0x5)[_0x2e99('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2e99('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2e99('0x19')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 81c1f71..7ab179a 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 _0xca5e=['Unknown\x20channel','model','keys','Queue','filters','intersection','fields','order','sort','where','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','format','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','Voice','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','firstName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','queues','inbound','flatten','toString','lower','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','select','field','ui.createdAt','messengerSoundNotification','enabled','moment','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','defaults','redis','localhost','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','update','then','role','agent','userNotification:recalc:','destroy','get','admin','Users','user','Telephones','telephone','filter','ignore','map','value','includes','find','name','end','error','stack','send','User','rawAttributes','fieldName','type','previousPasswords','query','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','catch','show','params','getOptions','includeAll','merge','options','all','body','addContacts','ids','internal','Setting','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','mailbox','password','email','permissions','102','103','113','110','104','105','106','107','108','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','VoiceMail','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','checkUserLimits','UserProfileSection','userProfileId','isEmpty','Agents','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','QueueId','emit','Queue:save','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','isArray','Queue:remove','voice','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','describe','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xca5e,0xc2));var _0xeca5=function(_0xf35b1f,_0x446fc7){_0xf35b1f=_0xf35b1f-0x0;var _0x10e7de=_0xca5e[_0xf35b1f];return _0x10e7de;};'use strict';var moment=require(_0xeca5('0x0'));var util=require(_0xeca5('0x1'));var path=require(_0xeca5('0x2'));var fs=require('fs');var _=require(_0xeca5('0x3'));var squel=require('squel');var Redis=require(_0xeca5('0x4'));var authService=require('../../components/auth/service');var contacts=require(_0xeca5('0x5'));var qs=require(_0xeca5('0x6'));var rta=require(_0xeca5('0x7'));var logger=require(_0xeca5('0x8'))(_0xeca5('0x9'));var utils=require(_0xeca5('0xa'));var config=require('../../config/environment');var licenseUtil=require(_0xeca5('0xb'));var APIBadRequestError=require(_0xeca5('0xc'))[_0xeca5('0xd')];var APINotFoundError=require('../../errors/api')[_0xeca5('0xe')];var APIHandleError=require('../../errors/api')[_0xeca5('0xf')];var db=require(_0xeca5('0x10'))['db'];var socket=require(_0xeca5('0x11'))(new Redis(config['redis']));require(_0xeca5('0x12'))[_0xeca5('0x13')](socket);config['redis']=_[_0xeca5('0x14')](config[_0xeca5('0x15')],{'host':_0xeca5('0x16'),'port':0x18eb});var values;function respondWithStatusCode(_0x5b261b,_0x1ad07b){_0x1ad07b=_0x1ad07b||0xcc;return function(_0x4d133e){if(_0x4d133e){return _0x5b261b[_0xeca5('0x17')](_0x1ad07b);}return _0x5b261b[_0xeca5('0x18')](_0x1ad07b)['end']();};}function respondWithResult(_0x3af20b,_0x1d0ae9){_0x1d0ae9=_0x1d0ae9||0xc8;return function(_0x377b68){if(_0x377b68){return _0x3af20b['status'](_0x1d0ae9)[_0xeca5('0x19')](_0x377b68);}};}function respondWithFilteredResult(_0x32889a,_0x4246ce){return function(_0x3ab905){if(_0x3ab905){var _0x28f6cb=typeof _0x4246ce['offset']==='undefined'&&typeof _0x4246ce[_0xeca5('0x1a')]===_0xeca5('0x1b');var _0x167c6e=_0x3ab905['count'];var _0x48ce05=_0x28f6cb?0x0:_0x4246ce[_0xeca5('0x1c')];var _0x3e869e=_0x28f6cb?_0x3ab905[_0xeca5('0x1d')]:_0x4246ce[_0xeca5('0x1c')]+_0x4246ce[_0xeca5('0x1a')];var _0x17f65f;if(_0x3e869e>=_0x167c6e){_0x3e869e=_0x167c6e;_0x17f65f=0xc8;}else{_0x17f65f=0xce;}_0x32889a[_0xeca5('0x18')](_0x17f65f);return _0x32889a[_0xeca5('0x1e')](_0xeca5('0x1f'),_0x48ce05+'-'+_0x3e869e+'/'+_0x167c6e)['json'](_0x3ab905);}return null;};}function saveUpdates(_0x3b60e3){return function(_0x248c57){if(_0x248c57){return _0x248c57[_0xeca5('0x20')](_0x3b60e3)[_0xeca5('0x21')](function(_0x47b615){if(_0x47b615[_0xeca5('0x22')]===_0xeca5('0x23')){socket['emit'](_0xeca5('0x24')+_0x47b615['id'],_0x47b615);}return _0x47b615;});}return null;};}function removeEntity(_0x34e51c){return function(_0x47b38){if(_0x47b38){return _0x47b38[_0xeca5('0x25')]()[_0xeca5('0x21')](function(){var _0x432f72=_0x47b38[_0xeca5('0x26')]({'plain':!![]});if(_0x432f72[_0xeca5('0x22')]===_0xeca5('0x27'))return;var _0x6b8834=[{'name':_0xeca5('0x28'),'value':_0xeca5('0x29'),'ignore':!![]},{'name':'Agents','value':_0xeca5('0x23'),'ignore':![]},{'name':_0xeca5('0x2a'),'value':_0xeca5('0x2b'),'ignore':![]}];var _0x292a00=_(_0x6b8834)[_0xeca5('0x2c')](_0xeca5('0x2d'))[_0xeca5('0x2e')](_0xeca5('0x2f'))['value']();if(_[_0xeca5('0x30')](_0x292a00,_0x432f72[_0xeca5('0x22')])){return;}var _0x16f39f=_[_0xeca5('0x31')](_0x6b8834,[_0xeca5('0x2f'),_0x432f72[_0xeca5('0x22')]])[_0xeca5('0x32')];return db['UserProfileResource'][_0xeca5('0x25')]({'where':{'type':_0x16f39f,'resourceId':_0x432f72['id']}})[_0xeca5('0x21')](function(){return _0x47b38;});})[_0xeca5('0x21')](function(){_0x34e51c[_0xeca5('0x18')](0xcc)[_0xeca5('0x33')]();});}};}function handleEntityNotFound(_0xe738f1){return function(_0x207f1a){if(!_0x207f1a){_0xe738f1[_0xeca5('0x17')](0x194);}return _0x207f1a;};}function handleError(_0x3f4341,_0xe3c044){_0xe3c044=_0xe3c044||0x1f4;return function(_0x5abd6a){logger[_0xeca5('0x34')](_0x5abd6a[_0xeca5('0x35')]);if(_0x5abd6a['name']){delete _0x5abd6a[_0xeca5('0x32')];}_0x3f4341[_0xeca5('0x18')](_0xe3c044)[_0xeca5('0x36')](_0x5abd6a);};}function getUserAttributes(){return _(db[_0xeca5('0x37')][_0xeca5('0x38')])[_0xeca5('0x2e')](function(_0x121032){return{'name':_0x121032[_0xeca5('0x39')],'type':_0x121032[_0xeca5('0x3a')]['key']};})['filter'](function(_0x175f9c){return!['password','salt',_0xeca5('0x3b'),'resetPasswordToken','resetPasswordExpires','md5secret'][_0xeca5('0x30')](_0x175f9c[_0xeca5('0x32')]);})[_0xeca5('0x2f')]();}exports['index']=function(_0x150382,_0x1dcb3e){var _0x4a28a1={},_0xc18ac3={'count':0x0,'rows':[]};var _0x35819e=getUserAttributes();_0x4a28a1=qs['getOptions'](_0x35819e,_0x150382);var _0x3c401c={'where':_0x4a28a1['where']};return db['User']['count'](_0x3c401c)['then'](function(_0x1691bb){_0xc18ac3[_0xeca5('0x1d')]=_0x1691bb;if(_0x150382[_0xeca5('0x3c')]['includeAll']){_0x4a28a1[_0xeca5('0x3d')]=[{'all':!![]}];}if(_0x150382[_0xeca5('0x3c')][_0xeca5('0x3e')]===_0xeca5('0x3f')){_0x4a28a1[_0xeca5('0x3d')]=[{'model':db[_0xeca5('0x40')],'as':_0xeca5('0x3e')}];}if(!_[_0xeca5('0x30')](_0x4a28a1[_0xeca5('0x41')],'id')){_0x4a28a1['attributes'][_0xeca5('0x42')]('id');}return db[_0xeca5('0x37')][_0xeca5('0x43')](_0x4a28a1);})['then'](function(_0x2c60cb){_0xc18ac3[_0xeca5('0x44')]=_0x2c60cb;if(_0x150382[_0xeca5('0x3c')][_0xeca5('0x45')]===_0xeca5('0x3f')){var _0x5a2f60=[];for(var _0x31e435=0x0;_0x31e435<_0xc18ac3[_0xeca5('0x44')][_0xeca5('0x46')];_0x31e435++){_0x5a2f60['push'](get_open_tabs(_0xeca5('0x47'),_0xc18ac3['rows'][_0x31e435][_0xeca5('0x48')]));_0x5a2f60['push'](get_open_tabs(_0xeca5('0x49'),_0xc18ac3[_0xeca5('0x44')][_0x31e435][_0xeca5('0x48')]));_0x5a2f60[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4a'),_0xc18ac3[_0xeca5('0x44')][_0x31e435][_0xeca5('0x48')]));_0x5a2f60[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4b'),_0xc18ac3[_0xeca5('0x44')][_0x31e435][_0xeca5('0x48')]));_0x5a2f60['push'](get_open_tabs(_0xeca5('0x4c'),_0xc18ac3[_0xeca5('0x44')][_0x31e435]['dataValues']));_0x5a2f60[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4d'),_0xc18ac3[_0xeca5('0x44')][_0x31e435][_0xeca5('0x48')]));}return Promise['all'](_0x5a2f60)['then'](function(){return _0xc18ac3;});}else{return _0xc18ac3;}})['then'](respondWithFilteredResult(_0x1dcb3e,_0x4a28a1))[_0xeca5('0x4e')](handleError(_0x1dcb3e,null));};exports[_0xeca5('0x4f')]=function(_0x1010c7,_0x121c83){var _0x4c080d=getUserAttributes();_0x1010c7[_0xeca5('0x3c')]['id']=_0x1010c7[_0xeca5('0x50')]['id'];var _0xba79d4=qs[_0xeca5('0x51')](_0x4c080d,_0x1010c7);if(_0x1010c7[_0xeca5('0x3c')][_0xeca5('0x52')]){_0xba79d4['include']=[{'all':!![]}];}if(_0x1010c7['query'][_0xeca5('0x3e')]===_0xeca5('0x3f')){_0xba79d4[_0xeca5('0x3d')]=[{'model':db[_0xeca5('0x40')],'as':'userSetting'}];}_0xba79d4=_[_0xeca5('0x53')]({},_0xba79d4,_0x1010c7[_0xeca5('0x54')]);if(!_[_0xeca5('0x30')](_0xba79d4[_0xeca5('0x41')],'id')){_0xba79d4['attributes'][_0xeca5('0x42')]('id');}return db[_0xeca5('0x37')][_0xeca5('0x31')](_0xba79d4)[_0xeca5('0x21')](handleEntityNotFound(_0x121c83,null))['then'](function(_0x55acff){var _0x4d724e=[];values=_0x55acff;if(_0x1010c7['query'][_0xeca5('0x45')]===_0xeca5('0x3f')){_0x4d724e[_0xeca5('0x42')](get_open_tabs('chat',_0x55acff[_0xeca5('0x48')]));_0x4d724e[_0xeca5('0x42')](get_open_tabs('sms',_0x55acff[_0xeca5('0x48')]));_0x4d724e[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4c'),_0x55acff[_0xeca5('0x48')]));_0x4d724e[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4d'),_0x55acff['dataValues']));_0x4d724e[_0xeca5('0x42')](get_open_tabs('fax',_0x55acff[_0xeca5('0x48')]));_0x4d724e[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4b'),_0x55acff[_0xeca5('0x48')]));return Promise[_0xeca5('0x55')](_0x4d724e);}else{return values;}})[_0xeca5('0x21')](function(){return values;})[_0xeca5('0x21')](respondWithResult(_0x121c83,null))[_0xeca5('0x4e')](handleError(_0x121c83,null));};exports[_0xeca5('0x20')]=function(_0xa84790,_0x42faaf){if(_0xa84790[_0xeca5('0x56')]['id']){delete _0xa84790['body']['id'];}delete _0xa84790[_0xeca5('0x56')]['role'];return db['User'][_0xeca5('0x31')]({'where':{'id':_0xa84790[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x42faaf,null))['then'](saveUpdates(_0xa84790[_0xeca5('0x56')],null))[_0xeca5('0x21')](respondWithResult(_0x42faaf,null))[_0xeca5('0x4e')](handleError(_0x42faaf,null));};exports['describe']=function(_0x3f492c,_0x4bb912){return db['User']['describe']()[_0xeca5('0x21')](respondWithResult(_0x4bb912,null))[_0xeca5('0x4e')](handleError(_0x4bb912,null));};exports[_0xeca5('0x57')]=function(_0x2e7e03,_0x2a965c){return db[_0xeca5('0x37')]['find']({'where':{'id':_0x2e7e03[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x2a965c,null))[_0xeca5('0x21')](function(_0x3810fd){if(_0x3810fd){return _0x3810fd[_0xeca5('0x57')](_0x2e7e03[_0xeca5('0x56')][_0xeca5('0x58')],_['omit'](_0x2e7e03['body'],['ids','id'])||{});}})[_0xeca5('0x21')](respondWithResult(_0x2a965c,null))[_0xeca5('0x4e')](handleError(_0x2a965c,null));};function validateUser(_0x4ca9df){return new Promise(function(_0x5c8211,_0x29221b){if(_0x4ca9df[_0xeca5('0x59')])return _0x5c8211(_0x4ca9df);return db[_0xeca5('0x5a')]['findById'](0x1)[_0xeca5('0x21')](function(_0x15c456){if(_0x15c456['securePassword'])authService['validatePasswordPattern'](_0x4ca9df['password']);db[_0xeca5('0x37')][_0xeca5('0x5b')](_0xeca5('0x59'))[_0xeca5('0x21')](function(_0x4b796f){if(_[_0xeca5('0x5c')](_0x4b796f)){_0x4ca9df[_0xeca5('0x59')]=_0x15c456['min_internal']||0x1;return;}if(_[_0xeca5('0x5c')](_0x15c456[_0xeca5('0x5d')])||_0x15c456[_0xeca5('0x5d')]===_0x4b796f){_0x4ca9df[_0xeca5('0x59')]=_0x4b796f+0x1;return;}if(_0x15c456[_0xeca5('0x5d')]>_0x4b796f){_0x4ca9df[_0xeca5('0x59')]=_0x15c456[_0xeca5('0x5d')];return;}return db[_0xeca5('0x5e')][_0xeca5('0x3c')](_0xeca5('0x5f'),{'type':db[_0xeca5('0x5e')]['QueryTypes'][_0xeca5('0x60')]})[_0xeca5('0x21')](function(_0x156053){if(_0x156053&&_0x156053[_0xeca5('0x46')]){for(var _0x22d2c8=0x0,_0x51b3b8=_0x156053[_0xeca5('0x46')];_0x22d2c8<_0x51b3b8&&_['isNil'](_0x4ca9df[_0xeca5('0x59')]);_0x22d2c8++){if(_0x15c456[_0xeca5('0x5d')]<=_0x156053[_0x22d2c8]['from']){_0x4ca9df[_0xeca5('0x59')]=_0x156053[_0x22d2c8][_0xeca5('0x61')];}else if(_0x15c456['min_internal']>_0x156053[_0x22d2c8][_0xeca5('0x61')]&&_0x15c456[_0xeca5('0x5d')]<=_0x156053[_0x22d2c8]['to']){_0x4ca9df[_0xeca5('0x59')]=_0x15c456[_0xeca5('0x5d')];}}}if(_[_0xeca5('0x5c')](_0x4ca9df['internal'])){_0x4ca9df[_0xeca5('0x59')]=_0x4b796f+0x1;}return _0x5c8211(_0x4ca9df);});});})['catch'](function(_0x529891){_0x29221b(_0x529891);});});}function updateUser(_0x1f292c){return new Promise(function(_0x1698c7,_0x522c7a){try{if(_0x1f292c['voicemail']){_0x1f292c[_0xeca5('0x62')]=_0x1f292c[_0xeca5('0x59')];_0x1f292c['VoiceMail']={'mailbox':_0x1f292c['internal'],'password':_0x1f292c[_0xeca5('0x63')],'fullname':_0x1f292c['fullname'],'email':_0x1f292c[_0xeca5('0x64')]};}if(_0x1f292c[_0xeca5('0x22')]===_0xeca5('0x23')){if(!_0x1f292c[_0xeca5('0x65')])_0x1f292c[_0xeca5('0x65')]=['101',_0xeca5('0x66'),_0xeca5('0x67'),_0xeca5('0x68'),_0xeca5('0x69'),_0xeca5('0x6a'),_0xeca5('0x6b'),_0xeca5('0x6c'),_0xeca5('0x6d'),_0xeca5('0x6e'),'109',_0xeca5('0x6f'),_0xeca5('0x70'),'114',_0xeca5('0x71')];}_0x1698c7(_0x1f292c);}catch(_0x4fed37){_0x522c7a(_0x4fed37);}});}exports[_0xeca5('0x72')]=function(_0xa7bfce,_0x27067a){if(_0xa7bfce[_0xeca5('0x29')][_0xeca5('0x22')]==='agent')throw new Error(_0xeca5('0x73'));if(_0xa7bfce[_0xeca5('0x56')]['role']===_0xeca5('0x29')&&_0xa7bfce[_0xeca5('0x29')][_0xeca5('0x22')]!==_0xeca5('0x27')){throw new Error(_0xeca5('0x74'));}if(_0xa7bfce[_0xeca5('0x56')][_0xeca5('0x22')]==='admin'&&_0xa7bfce[_0xeca5('0x29')]['role']!==_0xeca5('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0xa7bfce[_0xeca5('0x56')]])[_0xeca5('0x21')](function(){return validateUser(_0xa7bfce[_0xeca5('0x56')]);})['then'](function(_0x821b36){return updateUser(_0x821b36)[_0xeca5('0x21')](function(_0x4e1047){if(_0x4e1047[_0xeca5('0x22')]===_0xeca5('0x27')){_0x4e1047[_0xeca5('0x75')]=_0xa7bfce[_0xeca5('0x29')][_0xeca5('0x75')];delete _0x4e1047['userProfileId'];}return _0x4e1047;});})['then'](function(_0x2611ce){return db[_0xeca5('0x37')]['create'](_0x2611ce,{'include':[{'model':db[_0xeca5('0x76')],'as':_0xeca5('0x76')}]});})[_0xeca5('0x21')](function(_0x26cb92){if(_0xa7bfce['body'][_0xeca5('0x22')]===_0xeca5('0x29'))return _0x26cb92;if(_0xa7bfce[_0xeca5('0x29')]['role']!==_0xeca5('0x29'))return _0x26cb92;return db['UserProfileSection'][_0xeca5('0x31')]({'where':{'name':_0x26cb92['role']===_0xeca5('0x23')?'Agents':_0xeca5('0x2a'),'userProfileId':_0xa7bfce['user']['userProfileId']},'raw':!![]})[_0xeca5('0x21')](function(_0xe27fa1){if(!_0xe27fa1||_0xe27fa1[_0xeca5('0x77')]!=0x0)return _0x26cb92;return db[_0xeca5('0x78')][_0xeca5('0x72')]({'name':_0x26cb92[_0xeca5('0x32')],'resourceId':_0x26cb92['id'],'type':_0xe27fa1[_0xeca5('0x32')],'sectionId':_0xe27fa1['id']},{})[_0xeca5('0x21')](function(){return _0x26cb92;});})['catch'](function(_0x10abb6){logger[_0xeca5('0x34')](_0xeca5('0x79'),_0x10abb6);throw _0x10abb6;});})['then'](respondWithResult(_0x27067a,0xc9))[_0xeca5('0x4e')](handleError(_0x27067a,null));};exports[_0xeca5('0x7a')]=function(_0x32fcef,_0x57045b){var _0x2b30c8=_0x32fcef[_0xeca5('0x56')];var _0x544e80=[];if(_0x32fcef[_0xeca5('0x29')][_0xeca5('0x22')]===_0xeca5('0x23'))throw new Error(_0xeca5('0x73'));if(_[_0xeca5('0x7b')](_0x2b30c8,[_0xeca5('0x22'),'user'])&&_0x32fcef[_0xeca5('0x29')]['role']!==_0xeca5('0x27')){throw new Error(_0xeca5('0x74'));}if(_[_0xeca5('0x7b')](_0x2b30c8,['role',_0xeca5('0x27')])&&_0x32fcef[_0xeca5('0x29')][_0xeca5('0x22')]!==_0xeca5('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xeca5('0x7c')](_0x2b30c8)[_0xeca5('0x21')](function(){return validateUser(_0x2b30c8[0x0]);})[_0xeca5('0x21')](function(){for(var _0x46c9f5=0x1;_0x46c9f5<_0x2b30c8[_0xeca5('0x46')];_0x46c9f5++){var _0x2dd60f=_0x2b30c8[_0x46c9f5-0x1][_0xeca5('0x59')];if(!_0x2b30c8[_0x46c9f5]['internal'])_0x2b30c8[_0x46c9f5]['internal']=_0x2dd60f+0x1;_0x544e80[_0xeca5('0x42')](validateUser(_0x2b30c8[_0x46c9f5]));}return Promise['all'](_0x544e80);})['then'](function(){_0x544e80=[];for(var _0x42f5c0=0x0;_0x42f5c0<_0x2b30c8[_0xeca5('0x46')];_0x42f5c0++){_0x544e80[_0xeca5('0x42')](updateUser(_0x2b30c8[_0x42f5c0]));}return Promise[_0xeca5('0x55')](_0x544e80);})['then'](function(){_0x544e80=_0x2b30c8[_0xeca5('0x2e')](function(_0x12d04c){return db['User'][_0xeca5('0x72')](_0x12d04c,{'include':[{'model':db[_0xeca5('0x76')],'as':_0xeca5('0x76')}]})[_0xeca5('0x21')](function(_0x3f06bf){_0x12d04c['id']=_0x3f06bf['id'];return _0x12d04c;});});return Promise['all'](_0x544e80);})[_0xeca5('0x21')](function(_0x2de15a){if(_0x32fcef[_0xeca5('0x56')][_0xeca5('0x22')]===_0xeca5('0x29'))return _0x2de15a;if(_0x32fcef['user'][_0xeca5('0x22')]!==_0xeca5('0x29'))return _0x2de15a;var _0x13acdc=_['some'](_0x2de15a,function(_0x201ef3){return _0x201ef3[_0xeca5('0x22')]===_0xeca5('0x23')||_0x201ef3[_0xeca5('0x22')]==='telephone';});if(!_0x13acdc)return _0x2de15a;return db[_0xeca5('0x7d')][_0xeca5('0x43')]({'where':{'name':{'$or':['Agents',_0xeca5('0x2a')]},'userProfileId':_0x32fcef[_0xeca5('0x29')][_0xeca5('0x7e')]},'raw':!![]})[_0xeca5('0x21')](function(_0xa6c4cb){if(_[_0xeca5('0x7f')](_0xa6c4cb)||!_[_0xeca5('0x7b')](_0xa6c4cb,[_0xeca5('0x77'),0x0]))return _0x2de15a;_0x544e80=[];var _0x5e4b7f=_(_0xa6c4cb)[_0xeca5('0x2e')](function(_0x3e5916){if(_0x3e5916[_0xeca5('0x77')]===0x1)return;return _0x3e5916['name']===_0xeca5('0x80')?'agent':_0xeca5('0x2b');})[_0xeca5('0x81')]()[_0xeca5('0x2f')]();for(var _0x5ac935=0x0;_0x5ac935<_0x2de15a[_0xeca5('0x46')];_0x5ac935++){if(!_[_0xeca5('0x30')](_0x5e4b7f,_0x2de15a[_0x5ac935]['role']))return;var _0x1c8dde=_0x2de15a[_0x5ac935]['role']==='agent'?_0xeca5('0x80'):_0xeca5('0x2a');_0x544e80[_0xeca5('0x42')](db[_0xeca5('0x78')][_0xeca5('0x72')]({'name':_0x2de15a[_0x5ac935][_0xeca5('0x32')],'resourceId':_0x2de15a[_0x5ac935]['id'],'type':_0x1c8dde,'sectionId':_[_0xeca5('0x31')](_0xa6c4cb,['name',_0x1c8dde])['id']},{}));}return Promise[_0xeca5('0x55')](_0x544e80);});})['then'](respondWithResult(_0x57045b,0xc9))[_0xeca5('0x4e')](handleError(_0x57045b,null));};exports[_0xeca5('0x82')]=function(_0x5dea92,_0x9f470f){if(_0x5dea92[_0xeca5('0x56')]['id']){delete _0x5dea92[_0xeca5('0x56')]['id'];}return db[_0xeca5('0x37')]['find']({'where':{'id':_0x5dea92[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](function(_0x1e5ab8){if(!_0x1e5ab8)return null;if(_0x1e5ab8['id']===_0x5dea92['user']['id']){if(!_0x5dea92['body'][_0xeca5('0x83')]||!_0x5dea92['body'][_0xeca5('0x84')]){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1e5ab8[_0xeca5('0x87')](_0x5dea92[_0xeca5('0x56')][_0xeca5('0x83')])){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))](_0xeca5('0x88'));}if(_0x5dea92[_0xeca5('0x56')][_0xeca5('0x83')]===_0x5dea92['body']['newPassword']){throw new db['Sequelize'][(_0xeca5('0x86'))](_0xeca5('0x89'));}}else if(_0x5dea92[_0xeca5('0x29')][_0xeca5('0x22')]==='admin'){if(!_0x5dea92[_0xeca5('0x56')][_0xeca5('0x84')]){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))](_0xeca5('0x8a'));}}else if(_0x5dea92['user']['role']===_0xeca5('0x29')){if(!_0x5dea92[_0xeca5('0x56')][_0xeca5('0x84')]){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1e5ab8['role']!==_0xeca5('0x23')){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))]('Unauthorized');}}else{throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))](_0xeca5('0x73'));}return _0x1e5ab8;})[_0xeca5('0x21')](handleEntityNotFound(_0x9f470f,null))['then'](function(_0x4d7c40){return db[_0xeca5('0x5a')][_0xeca5('0x8b')]({'attributes':['id','securePassword',_0xeca5('0x8c'),_0xeca5('0x8d')]})['then'](function(_0x58570f){if(_0x58570f['securePassword'])authService['validatePasswordPattern'](_0x5dea92['body'][_0xeca5('0x84')]);if(!_0x58570f[_0xeca5('0x8c')]||!_0x4d7c40['previousPasswords'])return _0x4d7c40;authService[_0xeca5('0x8e')](_0x5dea92[_0xeca5('0x56')][_0xeca5('0x84')],_0x4d7c40[_0xeca5('0x3b')],_0x58570f[_0xeca5('0x8d')]);return _0x4d7c40;})[_0xeca5('0x21')](saveUpdates({'password':_0x5dea92['body'][_0xeca5('0x84')],'passwordResetAt':_0x5dea92[_0xeca5('0x29')]['id']==_0x5dea92['params']['id']?moment():null,'previousPasswords':authService[_0xeca5('0x8f')](_0x5dea92[_0xeca5('0x56')]['newPassword'],_0x4d7c40['previousPasswords'])},null));})['then'](respondWithResult(_0x9f470f,null))[_0xeca5('0x4e')](handleError(_0x9f470f,null));};exports[_0xeca5('0x90')]=function(_0x30379b,_0x31335a){var _0x5a6f3b=_0x30379b[_0xeca5('0x56')][_0xeca5('0x91')];return db[_0xeca5('0x37')][_0xeca5('0x31')]({'where':{'id':_0x30379b[_0xeca5('0x50')]['id']},'attributes':['id',_0xeca5('0x32'),'role',_0xeca5('0x92'),_0xeca5('0x93'),_0xeca5('0x94'),_0xeca5('0x95')]})[_0xeca5('0x21')](handleEntityNotFound(_0x31335a,null))[_0xeca5('0x21')](function(_0x49cef5){if(_0x49cef5){if(!utils[_0xeca5('0x96')](_0x5a6f3b)){throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))]('Unknown\x20channel');}return _0x49cef5[_0xeca5('0x97')+_[_0xeca5('0x98')](_0x5a6f3b[_0xeca5('0x99')]())+'Queues'](_0x30379b['body']['ids'],{'penalty':_0x30379b['body'][_0xeca5('0x9a')]||0x0})['spread'](function(_0xa4a350){for(var _0x5d9b99=0x0;_0x5d9b99<_0x30379b[_0xeca5('0x56')][_0xeca5('0x58')][_0xeca5('0x46')];_0x5d9b99+=0x1){var _0x54b82f={'UserId':Number(_0x30379b[_0xeca5('0x50')]['id'])};_0x54b82f[_['capitalize'](_0x5a6f3b[_0xeca5('0x99')]())+_0xeca5('0x9b')]=Number(_0x30379b[_0xeca5('0x56')][_0xeca5('0x58')][_0x5d9b99]);socket[_0xeca5('0x9c')](_0xeca5('0x29')+_[_0xeca5('0x98')](_0x5a6f3b[_0xeca5('0x99')]())+_0xeca5('0x9d'),_0x54b82f);}return _0xa4a350;})['then'](function(){if(_0x5a6f3b==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x30379b[_0xeca5('0x56')][_0xeca5('0x58')]||[]},'raw':!![],'attributes':['id',_0xeca5('0x32')]});}})['then'](function(_0x3dec43){var _0x2926b1=_0x49cef5['get']({'plain':!![]});var _0x323b0c=[];if(_0x5a6f3b==='voice'&&_0x2926b1[_0xeca5('0x22')]==='agent'&&_0x2926b1[_0xeca5('0x92')]){for(let _0x22045a=0x0;_0x22045a<_0x3dec43[_0xeca5('0x46')];_0x22045a+=0x1){_0x323b0c[_0xeca5('0x42')]({'membername':_0x2926b1[_0xeca5('0x32')],'UserId':_0x2926b1['id'],'queue_name':_0x3dec43[_0x22045a][_0xeca5('0x32')],'VoiceQueueId':_0x3dec43[_0x22045a]['id'],'interface':_[_0xeca5('0x5c')](_0x2926b1['interface'])?util['format'](_0xeca5('0x9e'),_0x2926b1[_0xeca5('0x32')]):_0x2926b1[_0xeca5('0x95')],'paused':_0x2926b1[_0xeca5('0x94')]||![],'penalty':_0x30379b[_0xeca5('0x56')][_0xeca5('0x9a')]||0x0});}return Promise[_0xeca5('0x55')](_0x323b0c['map'](function(_0x3e7680){return db[_0xeca5('0x9f')][_0xeca5('0xa0')](_0x3e7680);}));}return _0x49cef5;});}})[_0xeca5('0x21')](respondWithStatusCode(_0x31335a,null))['catch'](handleError(_0x31335a,null));};exports[_0xeca5('0xa1')]=function(_0x4f6956,_0x55a81d){var _0x54980d,_0x67acd6;return db[_0xeca5('0x37')][_0xeca5('0x31')]({'where':{'id':_0x4f6956['params']['id']},'attributes':['id',_0xeca5('0x32'),_0xeca5('0x22')]})[_0xeca5('0x21')](handleEntityNotFound(_0x55a81d,null))[_0xeca5('0x21')](function(_0x406d9c){if(_0x406d9c){_0x54980d=_0x406d9c;if(!_0x4f6956['query'][_0xeca5('0x91')]||!utils[_0xeca5('0x96')](_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x91')])){throw new db[(_0xeca5('0x85'))]['ValidationError']('Unknown\x20channel');}return _0x406d9c[_0xeca5('0xa2')+_[_0xeca5('0x98')](_0x4f6956[_0xeca5('0x3c')]['channel']['toLowerCase']())+_0xeca5('0xa3')](_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x58')]);}})[_0xeca5('0x21')](function(_0x55d095){if(_[_0xeca5('0xa4')](_0x4f6956['query']['ids'])){for(var _0x4734a9=0x0;_0x4734a9<_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x58')][_0xeca5('0x46')];_0x4734a9+=0x1){_0x67acd6={'UserId':Number(_0x4f6956[_0xeca5('0x50')]['id'])};_0x67acd6[_['capitalize'](_0x4f6956[_0xeca5('0x3c')]['channel']['toLowerCase']())+'QueueId']=Number(_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x58')][_0x4734a9]);socket['emit'](_0xeca5('0x29')+_[_0xeca5('0x98')](_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x91')][_0xeca5('0x99')]())+_0xeca5('0xa5'),_0x67acd6);}}else{_0x67acd6={'UserId':Number(_0x4f6956[_0xeca5('0x50')]['id'])};_0x67acd6[_[_0xeca5('0x98')](_0x4f6956['query']['channel'][_0xeca5('0x99')]())+_0xeca5('0x9b')]=Number(_0x4f6956[_0xeca5('0x3c')]['ids']);socket['emit'](_0xeca5('0x29')+_['capitalize'](_0x4f6956[_0xeca5('0x3c')][_0xeca5('0x91')]['toLowerCase']())+'Queue:remove',_0x67acd6);}return _0x55d095;})[_0xeca5('0x21')](function(){if(_0x4f6956['query'][_0xeca5('0x91')]===_0xeca5('0xa6')){return db['UserVoiceQueueRt'][_0xeca5('0x25')]({'where':{'UserId':_0x4f6956['params']['id'],'VoiceQueueId':_0x4f6956[_0xeca5('0x3c')]['ids']},'individualHooks':!![]})[_0xeca5('0x21')](function(){return _0x54980d;});}return _0x54980d;})[_0xeca5('0x21')](respondWithStatusCode(_0x55a81d,null))[_0xeca5('0x4e')](handleError(_0x55a81d,null));};exports[_0xeca5('0xa7')]=function(_0x11b63c,_0xb5c877){_0x11b63c[_0xeca5('0x56')][_0xeca5('0xa8')]=_0x11b63c[_0xeca5('0xa9')][_0xeca5('0xaa')];return db[_0xeca5('0x37')][_0xeca5('0x31')]({'where':{'id':_0x11b63c[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0xb5c877,null))[_0xeca5('0x21')](saveUpdates(_0x11b63c['body'],null))['then'](respondWithResult(_0xb5c877,null))['catch'](handleError(_0xb5c877,null));};exports[_0xeca5('0xab')]=function(_0x4953c2,_0xea2888){var _0x132df3=path[_0xeca5('0xac')](config['root'],_0xeca5('0xad'));return db[_0xeca5('0x37')][_0xeca5('0x31')]({'where':{'id':_0x4953c2[_0xeca5('0x50')]['id']},'attributes':['id',_0xeca5('0xa8')],'raw':!![]})['then'](handleEntityNotFound(_0xea2888,null))[_0xeca5('0x21')](function(_0x2c4965){if(_0x2c4965){if(_[_0xeca5('0x5c')](_0x2c4965[_0xeca5('0xa8')])){return _0xea2888['download'](_0x132df3);}else{if(!fs[_0xeca5('0xae')](path[_0xeca5('0xac')](config[_0xeca5('0xaf')],_0xeca5('0xb0'),_0x2c4965[_0xeca5('0xa8')]))){return _0xea2888[_0xeca5('0xb1')](_0x132df3);}return _0xea2888[_0xeca5('0xb1')](path[_0xeca5('0xac')](config[_0xeca5('0xaf')],_0xeca5('0xb0'),_0x2c4965[_0xeca5('0xa8')]));}}})[_0xeca5('0x4e')](handleError(_0xea2888,null));};exports['getOpenTabs']=function(_0x3cfec6,_0x155606){return db[_0xeca5('0x37')]['find']({'where':{'id':_0x3cfec6['params']['id']},'attributes':['id']})[_0xeca5('0x21')](handleEntityNotFound(_0x155606,null))[_0xeca5('0x21')](function(_0x48c53a){var _0x4be2be=[];values=_0x48c53a[_0xeca5('0x48')];_0x4be2be[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x47'),_0x48c53a['dataValues']));_0x4be2be[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x49'),_0x48c53a[_0xeca5('0x48')]));_0x4be2be['push'](get_open_tabs(_0xeca5('0x4c'),_0x48c53a[_0xeca5('0x48')]));_0x4be2be[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4d'),_0x48c53a[_0xeca5('0x48')]));_0x4be2be[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4a'),_0x48c53a['dataValues']));_0x4be2be[_0xeca5('0x42')](get_open_tabs(_0xeca5('0x4b'),_0x48c53a[_0xeca5('0x48')]));return Promise[_0xeca5('0x55')](_0x4be2be);})[_0xeca5('0x21')](function(_0x47bb1b){if(_0x47bb1b){var _0x1738fb=_['map'](values['ChatOpenTabs'],function(_0x23c640){return{'channel':_0xeca5('0xb2'),'id':_0x23c640['id'],'createdAt':_0x23c640['createdAt']};});var _0x2652e4=_[_0xeca5('0x2e')](values[_0xeca5('0xb3')],function(_0x14cf15){return{'channel':_0xeca5('0xb4'),'id':_0x14cf15['id'],'createdAt':_0x14cf15[_0xeca5('0xb5')]};});var _0x326904=_['map'](values[_0xeca5('0xb6')],function(_0x21a0ee){return{'channel':_0xeca5('0xb7'),'id':_0x21a0ee['id'],'createdAt':_0x21a0ee[_0xeca5('0xb5')]};});var _0x70d97e=_['map'](values[_0xeca5('0xb8')],function(_0x2a003f){return{'channel':'MAIL','id':_0x2a003f['id'],'createdAt':_0x2a003f[_0xeca5('0xb5')]};});var _0x3c6791=_['map'](values[_0xeca5('0xb9')],function(_0x462711){return{'channel':'SMS','id':_0x462711['id'],'createdAt':_0x462711[_0xeca5('0xb5')]};});var _0x4ae3e2=_[_0xeca5('0x2e')](values[_0xeca5('0xba')],function(_0x14a07d){return{'channel':_0xeca5('0xbb'),'id':_0x14a07d['id'],'createdAt':_0x14a07d[_0xeca5('0xb5')]};});var _0x39b11b=_[_0xeca5('0xbc')](_0x1738fb,_0x2652e4,_0x326904,_0x70d97e,_0x3c6791,_0x4ae3e2);var _0xb7c62a={'count':_0x39b11b[_0xeca5('0x46')],'rows':_0x39b11b};return _0xb7c62a;}else return null;})[_0xeca5('0x21')](respondWithResult(_0x155606,null))['catch'](handleError(_0x155606,null));};exports[_0xeca5('0xbd')]=function(_0x3da175,_0x2906e8){var _0x5a7f64={};return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x3da175[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](function(_0x5e7e67){if(!_0x5e7e67){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3da175['params']['id']));}return contacts[_0xeca5('0xbe')]();})['then'](function(_0x462e06){_0x3da175[_0xeca5('0x3c')]['User']=_0x3da175[_0xeca5('0x50')]['id'];_0x5a7f64=qs[_0xeca5('0x51')](_0x462e06,_0x3da175);if(_0x3da175[_0xeca5('0x3c')][_0xeca5('0xbf')](_0xeca5('0x52'))){_0x5a7f64[_0xeca5('0x3d')]=[{'model':db[_0xeca5('0xc0')],'as':_0xeca5('0xc1'),'required':![]},{'model':db[_0xeca5('0xc2')],'as':_0xeca5('0xc3'),'attributes':['id',_0xeca5('0x32'),'color'],'where':_0x3da175[_0xeca5('0x3c')][_0xeca5('0xc4')]?{'id':_0x3da175[_0xeca5('0x3c')][_0xeca5('0xc4')]}:undefined,'required':_0x3da175[_0xeca5('0x3c')][_0xeca5('0xc4')]?!![]:![]}];}return contacts[_0xeca5('0x43')](_0x3da175[_0xeca5('0x3c')],_0x3da175[_0xeca5('0x29')],_0x5a7f64,_0x462e06);})[_0xeca5('0x21')](respondWithFilteredResult(_0x2906e8,_0x5a7f64))['catch'](APIHandleError(_0x2906e8));};exports[_0xeca5('0xc5')]=function(_0x3b733a,_0x255b1b){var _0x7e286e;var _0x2af961={};var _0x5c045f;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x3b733a[_0xeca5('0x50')]['id']},'attributes':['id',_0xeca5('0x32'),_0xeca5('0x22')]})[_0xeca5('0x21')](handleEntityNotFound(_0x255b1b,null))[_0xeca5('0x21')](function(_0x478899){if(!utils['isValidChannel'](_0x3b733a['query'][_0xeca5('0x91')])){throw new db['Sequelize'][(_0xeca5('0x86'))](_0xeca5('0xc6'));}_0x7e286e=_0x478899;var _0x20638f={};_0x20638f[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_[_0xeca5('0x98')](_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x91')])+_0xeca5('0xc9')][_0xeca5('0x38')]);_0x20638f[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x3b733a[_0xeca5('0x3c')]);_0x20638f[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0x20638f[_0xeca5('0xc7')],_0x20638f[_0xeca5('0x3c')]);_0x2af961[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x20638f[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x3b733a['query'][_0xeca5('0xcc')]));_0x2af961[_0xeca5('0x41')]=_0x2af961[_0xeca5('0x41')][_0xeca5('0x46')]?_0x2af961['attributes']:_0x20638f[_0xeca5('0xc7')];_0x2af961[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x3b733a[_0xeca5('0x3c')]['sort']);_0x2af961[_0xeca5('0xcf')]=qs['filters'](_['pick'](_0x3b733a[_0xeca5('0x3c')],_0x20638f[_0xeca5('0xca')]));if(_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x2c')]){_0x2af961['where']=_[_0xeca5('0x53')](_0x2af961[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x2af961['attributes'],function(_0x407de2){var _0x1d9860={};_0x1d9860[_0x407de2]={'$like':'%'+_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x2c')]+'%'};return _0x1d9860;})});}_0x2af961=_[_0xeca5('0x53')]({},_0x2af961,_0x3b733a[_0xeca5('0x54')]);switch(_0x7e286e[_0xeca5('0x22')]){case'admin':return db[_[_0xeca5('0x98')](_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x91')])+_0xeca5('0xc9')][_0xeca5('0x43')](_0x2af961);case'user':case _0xeca5('0x23'):return _0x7e286e[_0xeca5('0x26')+_['capitalize'](_0x3b733a[_0xeca5('0x3c')]['channel'])+_0xeca5('0xa3')](_0x2af961);default:throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))](_0xeca5('0xd0'));}})[_0xeca5('0x21')](function(_0x353cdd){_0x5c045f=_0x353cdd[_0xeca5('0x46')];if(!_0x3b733a[_0xeca5('0x3c')][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x2af961[_0xeca5('0x1a')]=qs[_0xeca5('0x1a')](_0x3b733a[_0xeca5('0x3c')]['limit']);_0x2af961[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x1c')]);}switch(_0x7e286e[_0xeca5('0x22')]){case _0xeca5('0x27'):return db[_[_0xeca5('0x98')](_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x91')])+_0xeca5('0xc9')][_0xeca5('0x43')](_0x2af961);case _0xeca5('0x29'):case _0xeca5('0x23'):return _0x7e286e['get'+_[_0xeca5('0x98')](_0x3b733a[_0xeca5('0x3c')][_0xeca5('0x91')])+'Queues'](_0x2af961);}})['then'](function(_0x220467){return{'count':_0x5c045f,'rows':_0x220467};})['then'](respondWithResult(_0x255b1b,null))[_0xeca5('0x4e')](handleError(_0x255b1b,null));};exports[_0xeca5('0xd2')]=function(_0x9849a7,_0x56fc40){var _0x36029e={};var _0x12fc58={};var _0xf845d1;var _0x96f043;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x9849a7[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x56fc40,null))[_0xeca5('0x21')](function(_0x1a4748){if(_0x1a4748){_0xf845d1=_0x1a4748;_0x12fc58[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db['UserVoiceQueueRt']['rawAttributes']);_0x12fc58[_0xeca5('0x3c')]=_['keys'](_0x9849a7['query']);_0x12fc58[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0x12fc58[_0xeca5('0xc7')],_0x12fc58['query']);_0x36029e[_0xeca5('0x41')]=_['intersection'](_0x12fc58[_0xeca5('0xc7')],qs['fields'](_0x9849a7['query'][_0xeca5('0xcc')]));_0x36029e[_0xeca5('0x41')]=_0x36029e[_0xeca5('0x41')]['length']?_0x36029e['attributes']:_0x12fc58['model'];_0x36029e[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x9849a7['query'][_0xeca5('0xce')]);_0x36029e[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x9849a7['query'],_0x12fc58['filters']));if(_0x9849a7[_0xeca5('0x3c')][_0xeca5('0x2c')]){_0x36029e['where']=_[_0xeca5('0x53')](_0x36029e[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x36029e[_0xeca5('0x41')],function(_0x10fba1){var _0x4baf15={};_0x4baf15[_0x10fba1]={'$like':'%'+_0x9849a7['query'][_0xeca5('0x2c')]+'%'};return _0x4baf15;})});}_0x36029e=_[_0xeca5('0x53')]({},_0x36029e,_0x9849a7[_0xeca5('0x54')]);return _0xf845d1[_0xeca5('0xd2')](_0x36029e);}})['then'](function(_0x4326ba){if(_0x4326ba){_0x96f043=_0x4326ba['length'];if(!_0x9849a7['query'][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x36029e['limit']=qs['limit'](_0x9849a7[_0xeca5('0x3c')]['limit']);_0x36029e[_0xeca5('0x1c')]=qs['offset'](_0x9849a7[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0xf845d1[_0xeca5('0xd2')](_0x36029e);}})[_0xeca5('0x21')](function(_0xb704fa){if(_0xb704fa){return _0xb704fa?{'count':_0x96f043,'rows':_0xb704fa}:null;}})[_0xeca5('0x21')](respondWithResult(_0x56fc40,null))[_0xeca5('0x4e')](handleError(_0x56fc40,null));};exports[_0xeca5('0xd4')]=function(_0x16591a,_0xe9be40){var _0x436354={};var _0x2bfb47={};var _0x38d59f;var _0x2da41c;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x16591a[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0xe9be40,null))['then'](function(_0x52fba0){if(_0x52fba0){_0x38d59f=_0x52fba0;_0x2bfb47[_0xeca5('0xc7')]=_['keys'](db[_0xeca5('0xd5')][_0xeca5('0x38')]);_0x2bfb47[_0xeca5('0x3c')]=_['keys'](_0x16591a['query']);_0x2bfb47[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0x2bfb47['model'],_0x2bfb47['query']);_0x436354[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x2bfb47[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x16591a[_0xeca5('0x3c')]['fields']));_0x436354['attributes']=_0x436354[_0xeca5('0x41')][_0xeca5('0x46')]?_0x436354[_0xeca5('0x41')]:_0x2bfb47[_0xeca5('0xc7')];_0x436354[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x16591a[_0xeca5('0x3c')][_0xeca5('0xce')]);_0x436354[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x16591a['query'],_0x2bfb47['filters']));if(_0x16591a['query'][_0xeca5('0x2c')]){_0x436354[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0x436354[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x436354['attributes'],function(_0x2463a4){var _0x1619f5={};_0x1619f5[_0x2463a4]={'$like':'%'+_0x16591a[_0xeca5('0x3c')][_0xeca5('0x2c')]+'%'};return _0x1619f5;})});}_0x436354=_['merge']({},_0x436354,_0x16591a[_0xeca5('0x54')]);return _0x38d59f['getGroups'](_0x436354);}})[_0xeca5('0x21')](function(_0x8dddcd){if(_0x8dddcd){_0x2da41c=_0x8dddcd['length'];if(!_0x16591a['query']['hasOwnProperty'](_0xeca5('0xd1'))){_0x436354[_0xeca5('0x1a')]=qs['limit'](_0x16591a[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0x436354[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x16591a[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0x38d59f[_0xeca5('0xd4')](_0x436354);}})[_0xeca5('0x21')](function(_0x4801c7){if(_0x4801c7){return _0x4801c7?{'count':_0x2da41c,'rows':_0x4801c7}:null;}})[_0xeca5('0x21')](respondWithResult(_0xe9be40,null))[_0xeca5('0x4e')](handleError(_0xe9be40,null));};exports[_0xeca5('0xd6')]=function(_0x1728f2,_0x5b0deb){var _0x482b6d={'raw':!![],'where':{}};var _0x15b631={};var _0x1423f5={'count':0x0,'rows':[]};return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x1728f2['params']['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x5b0deb,null))[_0xeca5('0x21')](function(_0x1c8c34){if(_0x1c8c34){_0x15b631[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_0xeca5('0xd7')][_0xeca5('0x38')]);_0x15b631['query']=_[_0xeca5('0xc8')](_0x1728f2[_0xeca5('0x3c')]);_0x15b631['filters']=_[_0xeca5('0xcb')](_0x15b631['model'],_0x15b631['query']);_0x482b6d[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x15b631[_0xeca5('0xc7')],qs['fields'](_0x1728f2['query'][_0xeca5('0xcc')]));_0x482b6d['attributes']=_0x482b6d[_0xeca5('0x41')]['length']?_0x482b6d[_0xeca5('0x41')]:_0x15b631[_0xeca5('0xc7')];if(!_0x1728f2[_0xeca5('0x3c')]['hasOwnProperty']('nolimit')){_0x482b6d[_0xeca5('0x1a')]=qs[_0xeca5('0x1a')](_0x1728f2['query'][_0xeca5('0x1a')]);_0x482b6d[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x1728f2['query']['offset']);}_0x482b6d['order']=qs[_0xeca5('0xce')](_0x1728f2[_0xeca5('0x3c')]['sort']);_0x482b6d[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x1728f2[_0xeca5('0x3c')],_0x15b631['filters']));_0x482b6d[_0xeca5('0xcf')][_0xeca5('0xd8')]=_0x1c8c34['id'];if(_0x1728f2['query'][_0xeca5('0x2c')]){_0x482b6d[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0x482b6d[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x482b6d[_0xeca5('0x41')],function(_0xe6dbde){var _0x530b9f={};_0x530b9f[_0xe6dbde]={'$like':'%'+_0x1728f2['query']['filter']+'%'};return _0x530b9f;})});}_0x482b6d=_[_0xeca5('0x53')]({},_0x482b6d,_0x1728f2[_0xeca5('0x54')]);return db[_0xeca5('0xd7')][_0xeca5('0x1d')]({'where':_0x482b6d[_0xeca5('0xcf')]})['then'](function(_0x563e80){_0x1423f5['count']=_0x563e80;if(_0x1728f2['query'][_0xeca5('0x52')]){_0x482b6d[_0xeca5('0x3d')]=[{'all':!![]}];}return db[_0xeca5('0xd7')][_0xeca5('0x43')](_0x482b6d);})[_0xeca5('0x21')](function(_0x509204){_0x1423f5[_0xeca5('0x44')]=_0x509204;return _0x1423f5;});}})[_0xeca5('0x21')](respondWithFilteredResult(_0x5b0deb,_0x482b6d))[_0xeca5('0x4e')](handleError(_0x5b0deb,null));};exports[_0xeca5('0xd9')]=function(_0x141b4b,_0xe13930){var _0xeccb04={'raw':!![],'where':{}};var _0xbfb01c={};var _0x370482={'count':0x0,'rows':[]};return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x141b4b[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0xe13930,null))[_0xeca5('0x21')](function(_0x99641a){if(_0x99641a){_0xbfb01c[_0xeca5('0xc7')]=_['keys'](db['ScreenRecording'][_0xeca5('0x38')]);_0xbfb01c[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x141b4b['query']);_0xbfb01c[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0xbfb01c['model'],_0xbfb01c[_0xeca5('0x3c')]);_0xeccb04[_0xeca5('0x41')]=_['intersection'](_0xbfb01c[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x141b4b['query']['fields']));_0xeccb04[_0xeca5('0x41')]=_0xeccb04[_0xeca5('0x41')][_0xeca5('0x46')]?_0xeccb04[_0xeca5('0x41')]:_0xbfb01c[_0xeca5('0xc7')];if(!_0x141b4b[_0xeca5('0x3c')]['hasOwnProperty'](_0xeca5('0xd1'))){_0xeccb04['limit']=qs['limit'](_0x141b4b['query']['limit']);_0xeccb04[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x141b4b[_0xeca5('0x3c')][_0xeca5('0x1c')]);}_0xeccb04[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x141b4b[_0xeca5('0x3c')][_0xeca5('0xce')]);_0xeccb04[_0xeca5('0xcf')]=qs['filters'](_[_0xeca5('0xd3')](_0x141b4b[_0xeca5('0x3c')],_0xbfb01c[_0xeca5('0xca')]));_0xeccb04[_0xeca5('0xcf')][_0xeca5('0xd8')]=_0x99641a['id'];if(_0x141b4b['query'][_0xeca5('0x2c')]){_0xeccb04[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0xeccb04[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0xeccb04['attributes'],function(_0x115a96){var _0xddb027={};_0xddb027[_0x115a96]={'$like':'%'+_0x141b4b['query'][_0xeca5('0x2c')]+'%'};return _0xddb027;})});}_0xeccb04=_['merge']({},_0xeccb04,_0x141b4b[_0xeca5('0x54')]);return db['ScreenRecording'][_0xeca5('0x1d')]({'where':_0xeccb04[_0xeca5('0xcf')]})[_0xeca5('0x21')](function(_0x13365d){_0x370482['count']=_0x13365d;if(_0x141b4b[_0xeca5('0x3c')][_0xeca5('0x52')]){_0xeccb04[_0xeca5('0x3d')]=[{'all':!![]}];}return db[_0xeca5('0xda')][_0xeca5('0x43')](_0xeccb04);})[_0xeca5('0x21')](function(_0x4b0e60){_0x370482[_0xeca5('0x44')]=_0x4b0e60;return _0x370482;});}})['then'](respondWithFilteredResult(_0xe13930,_0xeccb04))[_0xeca5('0x4e')](handleError(_0xe13930,null));};exports[_0xeca5('0xdb')]=function(_0x2ea306,_0x2352bb){var _0xdb319f={};var _0xf23b6e={};var _0x292080;var _0x569ce0;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x2ea306[_0xeca5('0x50')]['id']}})['then'](handleEntityNotFound(_0x2352bb,null))[_0xeca5('0x21')](function(_0x1784f7){if(_0x1784f7){_0x292080=_0x1784f7;_0xf23b6e['model']=_[_0xeca5('0xc8')](db[_0xeca5('0xdc')][_0xeca5('0x38')]);_0xf23b6e[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x2ea306[_0xeca5('0x3c')]);_0xf23b6e[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0xf23b6e[_0xeca5('0xc7')],_0xf23b6e['query']);_0xdb319f[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0xf23b6e[_0xeca5('0xc7')],qs['fields'](_0x2ea306[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0xdb319f[_0xeca5('0x41')]=_0xdb319f[_0xeca5('0x41')][_0xeca5('0x46')]?_0xdb319f[_0xeca5('0x41')]:_0xf23b6e['model'];_0xdb319f[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x2ea306['query'][_0xeca5('0xce')]);_0xdb319f['where']=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x2ea306[_0xeca5('0x3c')],_0xf23b6e[_0xeca5('0xca')]));if(_0x2ea306[_0xeca5('0x3c')]['filter']){_0xdb319f['where']=_[_0xeca5('0x53')](_0xdb319f[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0xdb319f[_0xeca5('0x41')],function(_0x341c9f){var _0x26ee66={};_0x26ee66[_0x341c9f]={'$like':'%'+_0x2ea306['query'][_0xeca5('0x2c')]+'%'};return _0x26ee66;})});}_0xdb319f=_[_0xeca5('0x53')]({},_0xdb319f,_0x2ea306[_0xeca5('0x54')]);return _0x292080['getChatInteractions'](_0xdb319f);}})[_0xeca5('0x21')](function(_0x56b5f5){if(_0x56b5f5){_0x569ce0=_0x56b5f5[_0xeca5('0x46')];if(!_0x2ea306['query']['hasOwnProperty'](_0xeca5('0xd1'))){_0xdb319f[_0xeca5('0x1a')]=qs['limit'](_0x2ea306[_0xeca5('0x3c')]['limit']);_0xdb319f[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x2ea306[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0x292080[_0xeca5('0xdb')](_0xdb319f);}})[_0xeca5('0x21')](function(_0x2dec77){if(_0x2dec77){return _0x2dec77?{'count':_0x569ce0,'rows':_0x2dec77}:null;}})[_0xeca5('0x21')](respondWithResult(_0x2352bb,null))[_0xeca5('0x4e')](handleError(_0x2352bb,null));};exports['getOpenchannelInteractions']=function(_0x3816c4,_0x51810c){var _0x578cfe={};var _0x5a2cae={};var _0xd02835;var _0x2e46d2;return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x3816c4[_0xeca5('0x50')]['id']}})['then'](handleEntityNotFound(_0x51810c,null))[_0xeca5('0x21')](function(_0x12d6fb){if(_0x12d6fb){_0xd02835=_0x12d6fb;_0x5a2cae[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db['OpenchannelInteraction'][_0xeca5('0x38')]);_0x5a2cae['query']=_[_0xeca5('0xc8')](_0x3816c4[_0xeca5('0x3c')]);_0x5a2cae[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0x5a2cae[_0xeca5('0xc7')],_0x5a2cae[_0xeca5('0x3c')]);_0x578cfe[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x5a2cae['model'],qs[_0xeca5('0xcc')](_0x3816c4[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x578cfe['attributes']=_0x578cfe[_0xeca5('0x41')]['length']?_0x578cfe['attributes']:_0x5a2cae['model'];_0x578cfe[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x3816c4[_0xeca5('0x3c')][_0xeca5('0xce')]);_0x578cfe[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x3816c4[_0xeca5('0x3c')],_0x5a2cae[_0xeca5('0xca')]));if(_0x3816c4[_0xeca5('0x3c')]['filter']){_0x578cfe[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0x578cfe[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x578cfe[_0xeca5('0x41')],function(_0x205586){var _0x1859f0={};_0x1859f0[_0x205586]={'$like':'%'+_0x3816c4[_0xeca5('0x3c')][_0xeca5('0x2c')]+'%'};return _0x1859f0;})});}_0x578cfe=_[_0xeca5('0x53')]({},_0x578cfe,_0x3816c4[_0xeca5('0x54')]);return _0xd02835[_0xeca5('0xdd')](_0x578cfe);}})[_0xeca5('0x21')](function(_0x52a417){if(_0x52a417){_0x2e46d2=_0x52a417[_0xeca5('0x46')];if(!_0x3816c4['query'][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x578cfe[_0xeca5('0x1a')]=qs['limit'](_0x3816c4[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0x578cfe[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x3816c4[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0xd02835['getOpenchannelInteractions'](_0x578cfe);}})[_0xeca5('0x21')](function(_0x5a057c){if(_0x5a057c){return _0x5a057c?{'count':_0x2e46d2,'rows':_0x5a057c}:null;}})[_0xeca5('0x21')](respondWithResult(_0x51810c,null))['catch'](handleError(_0x51810c,null));};exports[_0xeca5('0xde')]=function(_0x52946c,_0x22faab){var _0x43c28f={'raw':!![],'where':{}};var _0x534ef7={};var _0xbfe73={'count':0x0,'rows':[]};return db['User'][_0xeca5('0x8b')]({'where':{'id':_0x52946c[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x22faab,null))[_0xeca5('0x21')](function(_0x2503f6){if(_0x2503f6){_0x534ef7[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_0xeca5('0xdf')][_0xeca5('0x38')]);_0x534ef7[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x52946c[_0xeca5('0x3c')]);_0x534ef7[_0xeca5('0xca')]=_['intersection'](_0x534ef7[_0xeca5('0xc7')],_0x534ef7[_0xeca5('0x3c')]);_0x43c28f['attributes']=_['intersection'](_0x534ef7[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x52946c[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x43c28f[_0xeca5('0x41')]=_0x43c28f[_0xeca5('0x41')][_0xeca5('0x46')]?_0x43c28f['attributes']:_0x534ef7[_0xeca5('0xc7')];if(!_0x52946c[_0xeca5('0x3c')]['hasOwnProperty'](_0xeca5('0xd1'))){_0x43c28f[_0xeca5('0x1a')]=qs['limit'](_0x52946c[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0x43c28f[_0xeca5('0x1c')]=qs['offset'](_0x52946c['query'][_0xeca5('0x1c')]);}_0x43c28f[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x52946c['query'][_0xeca5('0xce')]);_0x43c28f[_0xeca5('0xcf')]=qs['filters'](_[_0xeca5('0xd3')](_0x52946c['query'],_0x534ef7[_0xeca5('0xca')]));_0x43c28f['where']['UserId']=_0x2503f6['id'];if(_0x52946c['query'][_0xeca5('0x2c')]){_0x43c28f['where']=_['merge'](_0x43c28f['where'],{'$or':_[_0xeca5('0x2e')](_0x43c28f['attributes'],function(_0x321a9c){var _0x35a08a={};_0x35a08a[_0x321a9c]={'$like':'%'+_0x52946c['query'][_0xeca5('0x2c')]+'%'};return _0x35a08a;})});}_0x43c28f=_[_0xeca5('0x53')]({},_0x43c28f,_0x52946c[_0xeca5('0x54')]);return db[_0xeca5('0xdf')]['count']({'where':_0x43c28f[_0xeca5('0xcf')]})[_0xeca5('0x21')](function(_0x14c667){_0xbfe73[_0xeca5('0x1d')]=_0x14c667;if(_0x52946c['query'][_0xeca5('0x52')]){_0x43c28f[_0xeca5('0x3d')]=[{'all':!![]}];}return db[_0xeca5('0xdf')][_0xeca5('0x43')](_0x43c28f);})[_0xeca5('0x21')](function(_0x2d002e){_0xbfe73['rows']=_0x2d002e;return _0xbfe73;});}})[_0xeca5('0x21')](respondWithFilteredResult(_0x22faab,_0x43c28f))[_0xeca5('0x4e')](handleError(_0x22faab,null));};exports['getSmsInteractions']=function(_0x5e4358,_0x1c370c){var _0x22fe9b={};var _0x23a493={};var _0x36045a;var _0xfb10ae;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x5e4358[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x1c370c,null))[_0xeca5('0x21')](function(_0x444478){if(_0x444478){_0x36045a=_0x444478;_0x23a493[_0xeca5('0xc7')]=_['keys'](db['SmsInteraction'][_0xeca5('0x38')]);_0x23a493['query']=_[_0xeca5('0xc8')](_0x5e4358[_0xeca5('0x3c')]);_0x23a493['filters']=_[_0xeca5('0xcb')](_0x23a493['model'],_0x23a493['query']);_0x22fe9b[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x23a493[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x5e4358[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x22fe9b[_0xeca5('0x41')]=_0x22fe9b['attributes'][_0xeca5('0x46')]?_0x22fe9b[_0xeca5('0x41')]:_0x23a493['model'];_0x22fe9b[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x5e4358['query']['sort']);_0x22fe9b[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x5e4358[_0xeca5('0x3c')],_0x23a493[_0xeca5('0xca')]));if(_0x5e4358[_0xeca5('0x3c')]['filter']){_0x22fe9b[_0xeca5('0xcf')]=_['merge'](_0x22fe9b[_0xeca5('0xcf')],{'$or':_['map'](_0x22fe9b[_0xeca5('0x41')],function(_0x3016a5){var _0x266526={};_0x266526[_0x3016a5]={'$like':'%'+_0x5e4358[_0xeca5('0x3c')]['filter']+'%'};return _0x266526;})});}_0x22fe9b=_[_0xeca5('0x53')]({},_0x22fe9b,_0x5e4358[_0xeca5('0x54')]);return _0x36045a['getSmsInteractions'](_0x22fe9b);}})[_0xeca5('0x21')](function(_0x5c9eb6){if(_0x5c9eb6){_0xfb10ae=_0x5c9eb6[_0xeca5('0x46')];if(!_0x5e4358[_0xeca5('0x3c')][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x22fe9b['limit']=qs['limit'](_0x5e4358['query'][_0xeca5('0x1a')]);_0x22fe9b[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x5e4358[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0x36045a[_0xeca5('0xe0')](_0x22fe9b);}})['then'](function(_0x182507){if(_0x182507){return _0x182507?{'count':_0xfb10ae,'rows':_0x182507}:null;}})[_0xeca5('0x21')](respondWithResult(_0x1c370c,null))[_0xeca5('0x4e')](handleError(_0x1c370c,null));};exports[_0xeca5('0xe1')]=function(_0x422fe7,_0x2debbe){var _0x4d5cba={};var _0x1edb95={};var _0x4330b5;var _0xf46477;return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x422fe7[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x2debbe,null))[_0xeca5('0x21')](function(_0x1a8708){if(_0x1a8708){_0x4330b5=_0x1a8708;_0x1edb95['model']=_['keys'](db[_0xeca5('0xe2')][_0xeca5('0x38')]);_0x1edb95[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x422fe7[_0xeca5('0x3c')]);_0x1edb95[_0xeca5('0xca')]=_['intersection'](_0x1edb95[_0xeca5('0xc7')],_0x1edb95[_0xeca5('0x3c')]);_0x4d5cba['attributes']=_['intersection'](_0x1edb95[_0xeca5('0xc7')],qs['fields'](_0x422fe7[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x4d5cba[_0xeca5('0x41')]=_0x4d5cba[_0xeca5('0x41')]['length']?_0x4d5cba[_0xeca5('0x41')]:_0x1edb95[_0xeca5('0xc7')];_0x4d5cba['order']=qs[_0xeca5('0xce')](_0x422fe7[_0xeca5('0x3c')]['sort']);_0x4d5cba['where']=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x422fe7[_0xeca5('0x3c')],_0x1edb95['filters']));if(_0x422fe7['query']['filter']){_0x4d5cba[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0x4d5cba[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x4d5cba[_0xeca5('0x41')],function(_0x3f5ea7){var _0x294583={};_0x294583[_0x3f5ea7]={'$like':'%'+_0x422fe7['query'][_0xeca5('0x2c')]+'%'};return _0x294583;})});}_0x4d5cba=_[_0xeca5('0x53')]({},_0x4d5cba,_0x422fe7['options']);return _0x4330b5[_0xeca5('0xe1')](_0x4d5cba);}})[_0xeca5('0x21')](function(_0x4ab7f7){if(_0x4ab7f7){_0xf46477=_0x4ab7f7['length'];if(!_0x422fe7[_0xeca5('0x3c')][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x4d5cba[_0xeca5('0x1a')]=qs['limit'](_0x422fe7[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0x4d5cba[_0xeca5('0x1c')]=qs['offset'](_0x422fe7['query'][_0xeca5('0x1c')]);}return _0x4330b5['getFaxInteractions'](_0x4d5cba);}})['then'](function(_0x5b4807){if(_0x5b4807){return _0x5b4807?{'count':_0xf46477,'rows':_0x5b4807}:null;}})[_0xeca5('0x21')](respondWithResult(_0x2debbe,null))['catch'](handleError(_0x2debbe,null));};exports['getWhatsappInteractions']=function(_0x543d57,_0x101d3b){var _0x4f8b14={};var _0x4a6532={};var _0x241aac;var _0x16b62f;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x543d57['params']['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x101d3b,null))['then'](function(_0x9e5629){if(_0x9e5629){_0x241aac=_0x9e5629;_0x4a6532[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_0xeca5('0xe3')][_0xeca5('0x38')]);_0x4a6532['query']=_[_0xeca5('0xc8')](_0x543d57[_0xeca5('0x3c')]);_0x4a6532[_0xeca5('0xca')]=_[_0xeca5('0xcb')](_0x4a6532['model'],_0x4a6532[_0xeca5('0x3c')]);_0x4f8b14[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x4a6532[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x543d57[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x4f8b14[_0xeca5('0x41')]=_0x4f8b14['attributes'][_0xeca5('0x46')]?_0x4f8b14[_0xeca5('0x41')]:_0x4a6532['model'];_0x4f8b14['order']=qs['sort'](_0x543d57[_0xeca5('0x3c')]['sort']);_0x4f8b14[_0xeca5('0xcf')]=qs[_0xeca5('0xca')](_[_0xeca5('0xd3')](_0x543d57[_0xeca5('0x3c')],_0x4a6532[_0xeca5('0xca')]));if(_0x543d57[_0xeca5('0x3c')]['filter']){_0x4f8b14[_0xeca5('0xcf')]=_['merge'](_0x4f8b14[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x4f8b14[_0xeca5('0x41')],function(_0x494051){var _0xa534cc={};_0xa534cc[_0x494051]={'$like':'%'+_0x543d57[_0xeca5('0x3c')]['filter']+'%'};return _0xa534cc;})});}_0x4f8b14=_[_0xeca5('0x53')]({},_0x4f8b14,_0x543d57[_0xeca5('0x54')]);return _0x241aac[_0xeca5('0xe4')](_0x4f8b14);}})[_0xeca5('0x21')](function(_0x5b2012){if(_0x5b2012){_0x16b62f=_0x5b2012['length'];if(!_0x543d57['query']['hasOwnProperty']('nolimit')){_0x4f8b14['limit']=qs[_0xeca5('0x1a')](_0x543d57[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0x4f8b14['offset']=qs[_0xeca5('0x1c')](_0x543d57[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0x241aac[_0xeca5('0xe4')](_0x4f8b14);}})[_0xeca5('0x21')](function(_0x527e9d){if(_0x527e9d){return _0x527e9d?{'count':_0x16b62f,'rows':_0x527e9d}:null;}})['then'](respondWithResult(_0x101d3b,null))['catch'](handleError(_0x101d3b,null));};exports['login']=function(_0x45ca5e,_0x52da03,_0x32e721){var _0x3de56a;var _0xf6648d;var _0xa09e7c;var _0x534171=!_['isNil'](_0x45ca5e['params']['id'])?_0x45ca5e['params']['id']:!_[_0xeca5('0x5c')](_0x45ca5e[_0xeca5('0x29')]['id'])?_0x45ca5e['user']['id']:null;return db[_0xeca5('0x37')][_0xeca5('0x31')]({'where':{'id':_0x534171,'role':{'$or':[_0xeca5('0x27'),_0xeca5('0x29'),'agent']}},'attributes':['id',_0xeca5('0x32'),_0xeca5('0xe5'),'mobile',_0xeca5('0x22'),_0xeca5('0x59'),_0xeca5('0x93')]})[_0xeca5('0x21')](function(_0xa875a5){if(_0xa875a5){if(_0xa875a5[_0xeca5('0x22')]===_0xeca5('0x23')){_0x3de56a=_0xa875a5;if(_0x45ca5e[_0xeca5('0x56')][_0xeca5('0x95')]){_0xa09e7c=util[_0xeca5('0xe6')](_0xeca5('0xe7'),_0x3de56a[_0x45ca5e['body']['interface']]);}else if(_0x45ca5e[_0xeca5('0x56')][_0xeca5('0xe8')]){_0xa09e7c=util['format'](_0xeca5('0x9e'),_0x45ca5e[_0xeca5('0x56')][_0xeca5('0xe8')]);}else{_0xa09e7c=util['format'](_0xeca5('0x9e'),_0x3de56a['name']);}socket['to'](util['format'](_0xeca5('0xe9'),_0x3de56a[_0xeca5('0x32')]))[_0xeca5('0x9c')]('user:forcelogout',{'user':{'id':_0x3de56a['id'],'name':_0x3de56a[_0xeca5('0x32')]},'ip':_0x45ca5e[_0xeca5('0xea')][_0xeca5('0xeb')]||_0x45ca5e[_0xeca5('0xec')]['remoteAddress']||_0x45ca5e[_0xeca5('0xed')][_0xeca5('0xee')]||_0x45ca5e[_0xeca5('0xec')][_0xeca5('0xed')][_0xeca5('0xee')]});return db['UserVoiceQueueRt'][_0xeca5('0x25')]({'where':{'membername':_0x3de56a[_0xeca5('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0xeca5('0x85'))][(_0xeca5('0x86'))](_0xeca5('0xef'));}})['then'](function(){if(_0x3de56a){return _0x3de56a[_0xeca5('0xf0')]({'raw':!![]});}})[_0xeca5('0x21')](function(_0x199ecb){if(_0x3de56a){if(_0x199ecb){_0xf6648d=_0x199ecb;if(_0xf6648d[_0xeca5('0x46')]){var _0x1a66ff=_0xf6648d[_0xeca5('0x2e')](function(_0x59a3ae){var _0x4d15ee={'membername':_0x3de56a[_0xeca5('0x32')],'UserId':_0x3de56a['id'],'queue_name':_0x59a3ae[_0xeca5('0x32')],'VoiceQueueId':_0x59a3ae['id'],'interface':_0xa09e7c,'paused':_0x3de56a[_0xeca5('0x93')]||![],'penalty':_0x59a3ae[_0xeca5('0xf1')]||0x0};return db[_0xeca5('0x9f')][_0xeca5('0xa0')](_0x4d15ee);});return Promise[_0xeca5('0x55')](_0x1a66ff);}}}})['then'](function(){if(_0x3de56a){return db[_0xeca5('0xf2')][_0xeca5('0x43')]({'where':{'membername':_0x3de56a[_0xeca5('0x32')],'exitAt':null}});}})[_0xeca5('0x21')](function(_0x3143df){if(_0x3de56a){var _0x12ff84=[];_0x3143df[_0xeca5('0xf3')](function(_0x11419e){_0x12ff84[_0xeca5('0x42')](_0x11419e['update']({'exitAt':moment()[_0xeca5('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xeca5('0x55')](_0x12ff84);}})[_0xeca5('0x21')](function(){if(_0x3de56a){var _0x45d66a=[];var _0x15fe9f=[];var _0xe53c5e=utils[_0xeca5('0xf4')]();var _0x1b594f={'membername':_0x3de56a[_0xeca5('0x32')],'interface':_0xa09e7c,'enterAt':moment()['format'](_0xeca5('0xf5')),'role':_0x3de56a[_0xeca5('0x22')],'internal':_0x3de56a[_0xeca5('0x59')]};_0xe53c5e[_0xeca5('0xf3')](function(_0x820246){_0x45d66a[_0xeca5('0x42')](_[_0xeca5('0x53')]({'channel':_0x820246,'type':'LOGIN','data1':_0x45ca5e[_0xeca5('0x56')][_0xeca5('0xf6')],'data2':_0xa09e7c},_0x1b594f));if(_0x3de56a[_0xeca5('0x93')]){_0x15fe9f[_0xeca5('0x42')](_[_0xeca5('0x53')]({'channel':_0x820246,'type':_0xeca5('0xf7'),'data1':_0xeca5('0xf8')},_0x1b594f));}});return db[_0xeca5('0xf2')][_0xeca5('0x7a')](_0x45d66a['concat'](_0x15fe9f),{'individualHooks':!![]});}})[_0xeca5('0x21')](function(){if(_0x3de56a){return _0x3de56a['update']({'online':!![],'lastLoginAt':moment()[_0xeca5('0xe6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3de56a[_0xeca5('0x93')]||![],'mailPause':_0x3de56a['loginInPause']||![],'chatPause':_0x3de56a[_0xeca5('0x93')]||![],'faxPause':_0x3de56a[_0xeca5('0x93')]||![],'smsPause':_0x3de56a[_0xeca5('0x93')]||![],'openchannelPause':_0x3de56a[_0xeca5('0x93')]||![],'whatsappPause':_0x3de56a[_0xeca5('0x93')]||![],'pauseType':_0x3de56a['loginInPause']?_0xeca5('0xf8'):null,'interface':_0xa09e7c,'lastPauseAt':moment()[_0xeca5('0xe6')](_0xeca5('0xf5'))});}})[_0xeca5('0x21')](function(_0x1269e1){if(_0x45ca5e[_0xeca5('0xf9')]){return _0x32e721();}else{return Promise[_0xeca5('0xfa')](_0x1269e1)[_0xeca5('0x21')](respondWithResult(_0x52da03,null));}})[_0xeca5('0x4e')](handleError(_0x52da03,null));};exports[_0xeca5('0xfb')]=function(_0x349b35,_0x5c85dc){var _0x5eaf70;return db['User'][_0xeca5('0x31')]({'where':{'id':_0x349b35[_0xeca5('0x50')]['id'],'role':_0xeca5('0x23')},'attributes':['id',_0xeca5('0x32'),_0xeca5('0x22')]})[_0xeca5('0x21')](handleEntityNotFound(_0x5c85dc,null))['then'](function(_0x489dbc){if(_0x489dbc){_0x5eaf70=_0x489dbc;return db[_0xeca5('0x9f')][_0xeca5('0x25')]({'where':{'membername':_0x5eaf70[_0xeca5('0x32')]},'individualHooks':!![]});}})[_0xeca5('0x21')](function(){return db[_0xeca5('0xf2')][_0xeca5('0x43')]({'where':{'membername':_0x5eaf70[_0xeca5('0x32')],'exitAt':null}});})[_0xeca5('0x21')](function(_0x409f9b){var _0x3bf6e7=[];_0x409f9b[_0xeca5('0xf3')](function(_0x2fbcca){_0x3bf6e7['push'](_0x2fbcca['update']({'exitAt':moment()[_0xeca5('0xe6')](_0xeca5('0xf5'))}));});return Promise['all'](_0x3bf6e7);})[_0xeca5('0x21')](function(){return _0x5eaf70[_0xeca5('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xeca5('0x21')](respondWithResult(_0x5c85dc,null))[_0xeca5('0x4e')](handleError(_0x5c85dc,null));};exports[_0xeca5('0xfc')]=function(_0x28b2d3,_0x3ec834){var _0x1b0de3;return db[_0xeca5('0x9f')][_0xeca5('0x20')]({'paused':0x1},{'where':{'UserId':_0x28b2d3['params']['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x28b2d3[_0xeca5('0x50')]['id'],'role':_0xeca5('0x23')},'attributes':['id',_0xeca5('0x32'),_0xeca5('0x22'),'internal',_0xeca5('0x95'),_0xeca5('0x92')]});})[_0xeca5('0x21')](handleEntityNotFound(_0x3ec834,null))[_0xeca5('0x21')](function(_0x2b40d3){if(_0x2b40d3){_0x1b0de3=_0x2b40d3;return db[_0xeca5('0xf2')][_0xeca5('0x43')]({'where':{'membername':_0x1b0de3[_0xeca5('0x32')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x405a3e){if(_0x405a3e[_0xeca5('0x46')]){var _0x326ca1=moment()[_0xeca5('0xe6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x11f29d=0x0,_0x4a65ce=_0x405a3e[_0xeca5('0x46')];_0x11f29d<_0x4a65ce;_0x11f29d++){_0x405a3e[_0x11f29d][_0xeca5('0xfd')]({'exitAt':_0x326ca1});}}})['then'](function(){var _0x46b848=[];var _0x41bf52=utils[_0xeca5('0xf4')]();_0x41bf52['forEach'](function(_0x1e3100){_0x46b848[_0xeca5('0x42')]({'channel':_0x1e3100,'membername':_0x1b0de3[_0xeca5('0x32')],'interface':_[_0xeca5('0x5c')](_0x1b0de3[_0xeca5('0x95')])?util['format']('SIP/%s',_0x1b0de3[_0xeca5('0x32')]):_0x1b0de3[_0xeca5('0x95')],'type':_0xeca5('0xf7'),'enterAt':moment()[_0xeca5('0xe6')](_0xeca5('0xf5')),'data1':_0x28b2d3[_0xeca5('0x56')][_0xeca5('0x3a')]||_0xeca5('0xfe'),'role':_0x1b0de3[_0xeca5('0x22')],'internal':_0x1b0de3[_0xeca5('0x59')]});});return db[_0xeca5('0xf2')][_0xeca5('0x7a')](_0x46b848,{'individualHooks':!![]});})[_0xeca5('0x21')](function(){return _0x1b0de3[_0xeca5('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x28b2d3[_0xeca5('0x56')][_0xeca5('0x3a')]||_0xeca5('0xfe'),'lastPauseAt':moment()[_0xeca5('0xe6')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xeca5('0x21')](respondWithResult(_0x3ec834,null))[_0xeca5('0x4e')](handleError(_0x3ec834,null));};exports[_0xeca5('0xff')]=function(_0x212cfa,_0x2b5df1){if(_0x212cfa[_0xeca5('0x56')][_0xeca5('0x91')]&&!utils[_0xeca5('0x96')](_0x212cfa[_0xeca5('0x56')][_0xeca5('0x91')])){throw new APIBadRequestError(util[_0xeca5('0xe6')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x212cfa[_0xeca5('0x56')][_0xeca5('0x91')]));}return db[_0xeca5('0x37')]['find']({'where':{'id':_0x212cfa[_0xeca5('0x50')]['id']},'attributes':['id','name',_0xeca5('0x22'),_0xeca5('0x59'),_0xeca5('0x95'),_0xeca5('0x92'),_0xeca5('0x94'),_0xeca5('0x100'),_0xeca5('0x101'),'faxPause','openchannelPause',_0xeca5('0x102'),_0xeca5('0x103'),_0xeca5('0x104'),'lastPauseAt']})[_0xeca5('0x21')](function(_0x3f66a1){if(!_0x3f66a1){throw new APINotFoundError(util[_0xeca5('0xe6')](_0xeca5('0x105'),_0x212cfa[_0xeca5('0x50')]['id']));}return _0x3f66a1[_0xeca5('0xff')](_0x212cfa['body'][_0xeca5('0x91')]);})[_0xeca5('0x21')](respondWithResult(_0x2b5df1,null))[_0xeca5('0x4e')](APIHandleError(_0x2b5df1));};exports[_0xeca5('0x106')]=function(_0x1664d5,_0x4cb3d4){var _0x436d17={};var _0x5195a5={};var _0x4e8352;var _0x1fd140;return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x1664d5['params']['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x4cb3d4,null))[_0xeca5('0x21')](function(_0x2d8b86){if(_0x2d8b86){_0x4e8352=_0x2d8b86;_0x5195a5[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_0xeca5('0x107')][_0xeca5('0x38')]);_0x5195a5['query']=_['keys'](_0x1664d5[_0xeca5('0x3c')]);_0x5195a5['filters']=_[_0xeca5('0xcb')](_0x5195a5[_0xeca5('0xc7')],_0x5195a5['query']);_0x436d17['attributes']=_[_0xeca5('0xcb')](_0x5195a5['model'],qs[_0xeca5('0xcc')](_0x1664d5[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x436d17[_0xeca5('0x41')]=_0x436d17[_0xeca5('0x41')][_0xeca5('0x46')]?_0x436d17[_0xeca5('0x41')]:_0x5195a5[_0xeca5('0xc7')];_0x436d17[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x1664d5['query'][_0xeca5('0xce')]);_0x436d17[_0xeca5('0xcf')]=qs['filters'](_[_0xeca5('0xd3')](_0x1664d5[_0xeca5('0x3c')],_0x5195a5['filters']));if(_0x1664d5[_0xeca5('0x3c')][_0xeca5('0x2c')]){_0x436d17['where']=_[_0xeca5('0x53')](_0x436d17['where'],{'$or':_[_0xeca5('0x2e')](_0x436d17[_0xeca5('0x41')],function(_0x427b5d){var _0x4f23f7={};_0x4f23f7[_0x427b5d]={'$like':'%'+_0x1664d5[_0xeca5('0x3c')][_0xeca5('0x2c')]+'%'};return _0x4f23f7;})});}_0x436d17=_[_0xeca5('0x53')]({},_0x436d17,_0x1664d5[_0xeca5('0x54')]);return _0x4e8352[_0xeca5('0x106')](_0x436d17);}})[_0xeca5('0x21')](function(_0x5c2497){if(_0x5c2497){_0x1fd140=_0x5c2497[_0xeca5('0x46')];if(!_0x1664d5['query'][_0xeca5('0xbf')](_0xeca5('0xd1'))){_0x436d17['limit']=qs[_0xeca5('0x1a')](_0x1664d5['query'][_0xeca5('0x1a')]);_0x436d17[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x1664d5['query'][_0xeca5('0x1c')]);}return _0x4e8352[_0xeca5('0x106')](_0x436d17);}})[_0xeca5('0x21')](function(_0x3457d3){if(_0x3457d3){return _0x3457d3?{'count':_0x1fd140,'rows':_0x3457d3}:null;}})[_0xeca5('0x21')](respondWithResult(_0x4cb3d4,null))[_0xeca5('0x4e')](handleError(_0x4cb3d4,null));};exports['addTeams']=function(_0x4f71ff,_0x49cc8f){var _0x3ad11b=_0x4f71ff['params']['id'];var _0x3e4ff3=_0x4f71ff[_0xeca5('0x56')]?_0x4f71ff['body'][_0xeca5('0x58')]:null;var _0x5d7c99=[];return Promise[_0xeca5('0xfa')]()[_0xeca5('0x21')](function(){if(!_0x3e4ff3)throw new APIBadRequestError(_0xeca5('0x108'));})[_0xeca5('0x21')](function(){return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x3ad11b}});})['then'](function(_0x3d88d5){if(!_0x3d88d5)throw new APINotFoundError(util[_0xeca5('0xe6')](_0xeca5('0x105'),_0x4f71ff['params']['id']));return db[_0xeca5('0x5e')][_0xeca5('0x109')](function(_0x3f8d30){return _0x3d88d5[_0xeca5('0x10a')](_0x3e4ff3,{'transaction':_0x3f8d30})[_0xeca5('0x21')](function(){return db['Team'][_0xeca5('0x43')]({'where':{'id':{'$in':_0x3e4ff3}}});})[_0xeca5('0x21')](function(_0x1bfe0d){var _0x2ed602=_[_0xeca5('0x2e')](_0x1bfe0d,function(_0x2287c7){return _0x2287c7[_0xeca5('0x10b')]();});return Promise[_0xeca5('0x55')](_0x2ed602);})['then'](function(_0x397f6a){_0x5d7c99=_[_0xeca5('0x10c')](_0x397f6a);var _0x775850=_[_0xeca5('0x2e')](_0x5d7c99,function(_0x42e4f7){return _0x42e4f7[_0xeca5('0x10d')](_0x3d88d5['id'],{'transaction':_0x3f8d30});});return Promise[_0xeca5('0x55')](_0x775850);})[_0xeca5('0x21')](function(){if(!_0x3d88d5[_0xeca5('0x92')])return;var _0x3b83fd=_['filter'](_0x5d7c99,function(_0x2ab976){return _0x2ab976[_0xeca5('0x10e')](_0xeca5('0x91'))==='Voice';});var _0xa5aba1=_[_0xeca5('0x2e')](_0x3b83fd,function(_0x17f116){return db[_0xeca5('0x9f')][_0xeca5('0xa0')]({'membername':_0x3d88d5[_0xeca5('0x32')],'UserId':_0x3d88d5['id'],'queue_name':_0x17f116['name'],'VoiceQueueId':_0x17f116['id'],'interface':_[_0xeca5('0x5c')](_0x3d88d5[_0xeca5('0x95')])?util['format']('SIP/%s',_0x3d88d5['name']):_0x3d88d5['interface'],'paused':_0x3d88d5['voicePause']||![],'penalty':_0x3d88d5[_0xeca5('0x9a')]},{'transaction':_0x3f8d30});});return Promise['all'](_0xa5aba1);})[_0xeca5('0x21')](function(){return db[_0xeca5('0x10f')][_0xeca5('0x43')]({'where':{'teamId':{'$in':_0x3e4ff3}}});})[_0xeca5('0x21')](function(_0x32aa2a){var _0x459969=_['map'](_0x32aa2a,function(_0x351a1f){return db[_0xeca5('0x110')][_0xeca5('0x72')]({'UserId':_0x3d88d5['id'],'VoicePrefixId':_0x351a1f[_0xeca5('0x111')]},{'transaction':_0x3f8d30});});return Promise[_0xeca5('0x55')](_0x459969);});});})['then'](function(){for(var _0xe5a1b2=0x0;_0xe5a1b2<_0x5d7c99['length'];_0xe5a1b2++){var _0x6221fd=_0x5d7c99[_0xe5a1b2][_0xeca5('0x10e')](_0xeca5('0x91'));var _0x36af6c=_0x6221fd+_0xeca5('0x9b');socket['emit'](_0xeca5('0x29')+_0x6221fd+_0xeca5('0x9d'),{'UserId':_0x3ad11b,['queueField']:_0x5d7c99[_0xe5a1b2]['id']});}})[_0xeca5('0x21')](respondWithStatusCode(_0x49cc8f,null))['catch'](APIHandleError(_0x49cc8f));};exports['removeTeams']=function(_0x39a9a0,_0x3f4753){var _0x3a7515=_0x39a9a0[_0xeca5('0x50')]['id'];var _0x6125de=null;if(_0x39a9a0[_0xeca5('0x3c')][_0xeca5('0x58')]){_0x6125de=_[_0xeca5('0xa4')](_0x39a9a0[_0xeca5('0x3c')][_0xeca5('0x58')])?_0x39a9a0[_0xeca5('0x3c')]['ids']:[_0x39a9a0[_0xeca5('0x3c')][_0xeca5('0x58')]];}var _0x7dcef1=[];return Promise[_0xeca5('0xfa')]()['then'](function(){if(!_0x6125de)throw new APIBadRequestError(_0xeca5('0x112'));})[_0xeca5('0x21')](function(){return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x3a7515}});})[_0xeca5('0x21')](function(_0x5c5cd8){if(!_0x5c5cd8)throw new APINotFoundError(util[_0xeca5('0xe6')](_0xeca5('0x105'),_0x39a9a0[_0xeca5('0x50')]['id']));return db[_0xeca5('0x5e')][_0xeca5('0x109')](function(_0x4ff9b9){return _0x5c5cd8[_0xeca5('0x113')](_0x6125de,{'transaction':_0x4ff9b9})['then'](function(){return db[_0xeca5('0x107')]['findAll']({'where':{'id':{'$in':_0x6125de}}});})[_0xeca5('0x21')](function(_0x93c937){var _0x4e604e=_['map'](_0x93c937,function(_0x3f7466){return _0x3f7466[_0xeca5('0x10b')]();});return Promise['all'](_0x4e604e);})[_0xeca5('0x21')](function(_0x4ed3c5){_0x7dcef1=_[_0xeca5('0x10c')](_0x4ed3c5);var _0x308366=_[_0xeca5('0x2e')](_0x7dcef1,function(_0x541194){return _0x541194['removeAgent'](_0x5c5cd8['id'],{'transaction':_0x4ff9b9});});return Promise['all'](_0x308366);})[_0xeca5('0x21')](function(){if(!_0x5c5cd8[_0xeca5('0x92')])return;var _0x4b5548=_[_0xeca5('0x2c')](_0x7dcef1,function(_0x397eda){return _0x397eda[_0xeca5('0x10e')](_0xeca5('0x91'))===_0xeca5('0x114');});var _0x4cf535=_[_0xeca5('0x2e')](_0x4b5548,function(_0x3ed14d){return db['UserVoiceQueueRt'][_0xeca5('0x25')]({'where':{'VoiceQueueId':_0x3ed14d['id'],'UserId':_0x5c5cd8['id']},'transaction':_0x4ff9b9});});return Promise[_0xeca5('0x55')](_0x4cf535);})[_0xeca5('0x21')](function(){return db[_0xeca5('0x10f')]['findAll']({'where':{'teamId':{'$in':_0x6125de}}});})[_0xeca5('0x21')](function(_0x135742){var _0x2496e3=_[_0xeca5('0x2e')](_0x135742,function(_0x5579a3){return db[_0xeca5('0x110')][_0xeca5('0x25')]({'where':{'UserId':_0x5c5cd8['id'],'VoicePrefixId':_0x5579a3['VoicePrefixId']}},{'transaction':_0x4ff9b9});});return Promise[_0xeca5('0x55')](_0x2496e3);});});})[_0xeca5('0x21')](function(){for(var _0x4821e2=0x0;_0x4821e2<_0x7dcef1['length'];_0x4821e2++){var _0x53ede2=_0x7dcef1[_0x4821e2]['getDataValue'](_0xeca5('0x91'));var _0x24daf7=_0x53ede2+_0xeca5('0x9b');socket[_0xeca5('0x9c')](_0xeca5('0x29')+_0x53ede2+'Queue:remove',{'UserId':_0x3a7515,['queueField']:_0x7dcef1[_0x4821e2]['id']});}})[_0xeca5('0x21')](respondWithStatusCode(_0x3f4753,null))[_0xeca5('0x4e')](APIHandleError(_0x3f4753));};exports[_0xeca5('0x115')]=function(_0x1c77a3,_0x4e43dc){var _0xbfb672={};var _0x20d6d5={};var _0x8e7c08;var _0x120d4e;return db[_0xeca5('0x37')]['findOne']({'where':{'id':_0x1c77a3[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x4e43dc,null))[_0xeca5('0x21')](function(_0x5ac98c){if(_0x5ac98c){_0x8e7c08=_0x5ac98c;_0x20d6d5[_0xeca5('0xc7')]=_['keys'](db[_0xeca5('0xc0')]['rawAttributes']);_0x20d6d5[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x1c77a3[_0xeca5('0x3c')]);_0x20d6d5['filters']=_['intersection'](_0x20d6d5[_0xeca5('0xc7')],_0x20d6d5[_0xeca5('0x3c')]);_0xbfb672[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x20d6d5[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x1c77a3[_0xeca5('0x3c')]['fields']));_0xbfb672[_0xeca5('0x41')]=_0xbfb672[_0xeca5('0x41')][_0xeca5('0x46')]?_0xbfb672['attributes']:_0x20d6d5[_0xeca5('0xc7')];_0xbfb672[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x1c77a3[_0xeca5('0x3c')][_0xeca5('0xce')]);_0xbfb672[_0xeca5('0xcf')]=qs['filters'](_[_0xeca5('0xd3')](_0x1c77a3['query'],_0x20d6d5[_0xeca5('0xca')]));if(_0x1c77a3[_0xeca5('0x3c')][_0xeca5('0x2c')]){_0xbfb672[_0xeca5('0xcf')]=_['merge'](_0xbfb672['where'],{'$or':_[_0xeca5('0x2e')](_0xbfb672['attributes'],function(_0x530118){var _0x2e0e7d={};_0x2e0e7d[_0x530118]={'$like':'%'+_0x1c77a3['query'][_0xeca5('0x2c')]+'%'};return _0x2e0e7d;})});}_0xbfb672=_[_0xeca5('0x53')]({},_0xbfb672,_0x1c77a3['options']);return _0x8e7c08[_0xeca5('0x115')](_0xbfb672);}})['then'](function(_0xc74dda){if(_0xc74dda){_0x120d4e=_0xc74dda[_0xeca5('0x46')];if(!_0x1c77a3[_0xeca5('0x3c')][_0xeca5('0xbf')]('nolimit')){_0xbfb672[_0xeca5('0x1a')]=qs[_0xeca5('0x1a')](_0x1c77a3[_0xeca5('0x3c')][_0xeca5('0x1a')]);_0xbfb672[_0xeca5('0x1c')]=qs[_0xeca5('0x1c')](_0x1c77a3[_0xeca5('0x3c')][_0xeca5('0x1c')]);}return _0x8e7c08['getLists'](_0xbfb672);}})['then'](function(_0x3e5d2b){if(_0x3e5d2b){return _0x3e5d2b?{'count':_0x120d4e,'rows':_0x3e5d2b}:null;}})[_0xeca5('0x21')](respondWithResult(_0x4e43dc,null))[_0xeca5('0x4e')](handleError(_0x4e43dc,null));};exports[_0xeca5('0x116')]=function(_0x16db5d,_0x29b090){var _0x3acc0d={};var _0x31aa33={};var _0x19f4b9;return db[_0xeca5('0x37')][_0xeca5('0x8b')]({'where':{'id':_0x16db5d[_0xeca5('0x50')]['id']}})[_0xeca5('0x21')](handleEntityNotFound(_0x29b090,null))[_0xeca5('0x21')](function(_0x1f6a7c){if(_0x1f6a7c){_0x19f4b9=_0x1f6a7c;_0x31aa33[_0xeca5('0xc7')]=_[_0xeca5('0xc8')](db[_0xeca5('0x37')][_0xeca5('0x38')]);_0x31aa33[_0xeca5('0x3c')]=_[_0xeca5('0xc8')](_0x16db5d[_0xeca5('0x3c')]);_0x31aa33['filters']=_['intersection'](_0x31aa33[_0xeca5('0xc7')],_0x31aa33[_0xeca5('0x3c')]);_0x3acc0d[_0xeca5('0x41')]=_[_0xeca5('0xcb')](_0x31aa33[_0xeca5('0xc7')],qs[_0xeca5('0xcc')](_0x16db5d[_0xeca5('0x3c')][_0xeca5('0xcc')]));_0x3acc0d[_0xeca5('0x41')]=_0x3acc0d[_0xeca5('0x41')][_0xeca5('0x46')]?_0x3acc0d[_0xeca5('0x41')]:_0x31aa33[_0xeca5('0xc7')];_0x3acc0d[_0xeca5('0xcd')]=qs[_0xeca5('0xce')](_0x16db5d[_0xeca5('0x3c')][_0xeca5('0xce')]);_0x3acc0d['where']=qs['filters'](_[_0xeca5('0xd3')](_0x16db5d['query'],_0x31aa33[_0xeca5('0xca')]));if(_0x16db5d[_0xeca5('0x3c')][_0xeca5('0x2c')]){_0x3acc0d[_0xeca5('0xcf')]=_[_0xeca5('0x53')](_0x3acc0d[_0xeca5('0xcf')],{'$or':_[_0xeca5('0x2e')](_0x3acc0d[_0xeca5('0x41')],function(_0x439ece){var _0x29d334={};_0x29d334[_0x439ece]={'$like':'%'+_0x16db5d[_0xeca5('0x3c')][_0xeca5('0x2c')]+'%'};return _0x29d334;})});}_0x3acc0d['model']=db[_0xeca5('0x37')];_0x3acc0d['as']=_0xeca5('0x80');_0x3acc0d=_['merge']({},_0x3acc0d,_0x16db5d[_0xeca5('0x54')]);return _0x19f4b9['getVoiceQueues']({'include':[_0x3acc0d]});}})['then'](function(_0x380013){if(_0x380013){var _0x39c6f6={},_0x4a7733=[];for(var _0x3f9b31=0x0;_0x3f9b31<_0x380013[_0xeca5('0x46')];_0x3f9b31+=0x1){for(var _0x5aba0e=0x0,_0x159a72;_0x5aba0e<_0x380013[_0x3f9b31]['Agents'][_0xeca5('0x46')];_0x5aba0e+=0x1){_0x159a72=_0x380013[_0x3f9b31][_0xeca5('0x80')][_0x5aba0e]['get']({'plain':!![]});_0x39c6f6[_0x159a72['id']]=_0x159a72;}}_0x39c6f6=_['values'](_0x39c6f6);for(var _0x53285a=qs['offset'](_0x16db5d[_0xeca5('0x3c')][_0xeca5('0x1c')]);_0x53285a<_0x39c6f6[_0xeca5('0x46')]&&_0x4a7733[_0xeca5('0x46')]=_0x327dfa){_0x18377f=_0x327dfa;_0x146daf=0xc8;}else{_0x146daf=0xce;}_0x5debfb[_0x279c('0x17')](_0x146daf);return _0x5debfb['set'](_0x279c('0x1d'),_0x2c0cce+'-'+_0x18377f+'/'+_0x327dfa)['json'](_0x2aa6dd);}return null;};}function saveUpdates(_0x21c130){return function(_0x128191){if(_0x128191){return _0x128191[_0x279c('0x1e')](_0x21c130)[_0x279c('0x1f')](function(_0x299526){if(_0x299526[_0x279c('0x20')]==='agent'){socket[_0x279c('0x21')]('userNotification:recalc:'+_0x299526['id'],_0x299526);}return _0x299526;});}return null;};}function removeEntity(_0x174033){return function(_0x4f841e){if(_0x4f841e){return _0x4f841e[_0x279c('0x22')]()[_0x279c('0x1f')](function(){var _0x5b6f1a=_0x4f841e[_0x279c('0x23')]({'plain':!![]});if(_0x5b6f1a[_0x279c('0x20')]===_0x279c('0x24'))return;var _0x408ea7=[{'name':_0x279c('0x25'),'value':_0x279c('0x26'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x279c('0x27'),'value':_0x279c('0x28'),'ignore':![]}];var _0x109e31=_(_0x408ea7)[_0x279c('0x29')](_0x279c('0x2a'))['map'](_0x279c('0x2b'))[_0x279c('0x2b')]();if(_[_0x279c('0x2c')](_0x109e31,_0x5b6f1a[_0x279c('0x20')])){return;}var _0x571e83=_[_0x279c('0x2d')](_0x408ea7,[_0x279c('0x2b'),_0x5b6f1a[_0x279c('0x20')]])[_0x279c('0x2e')];return db['UserProfileResource'][_0x279c('0x22')]({'where':{'type':_0x571e83,'resourceId':_0x5b6f1a['id']}})[_0x279c('0x1f')](function(){return _0x4f841e;});})[_0x279c('0x1f')](function(){_0x174033['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d9d99){return function(_0x342250){if(!_0x342250){_0x3d9d99[_0x279c('0x16')](0x194);}return _0x342250;};}function handleError(_0x21af8e,_0x23c68c){_0x23c68c=_0x23c68c||0x1f4;return function(_0x432902){logger[_0x279c('0x2f')](_0x432902['stack']);if(_0x432902[_0x279c('0x2e')]){delete _0x432902[_0x279c('0x2e')];}_0x21af8e[_0x279c('0x17')](_0x23c68c)['send'](_0x432902);};}function getUserAttributes(){return _(db[_0x279c('0x30')][_0x279c('0x31')])[_0x279c('0x32')](function(_0x4a795e){return{'name':_0x4a795e['fieldName'],'type':_0x4a795e['type'][_0x279c('0x33')]};})['filter'](function(_0x2ecc1c){return![_0x279c('0x34'),_0x279c('0x35'),'previousPasswords',_0x279c('0x36'),'resetPasswordExpires',_0x279c('0x37')][_0x279c('0x2c')](_0x2ecc1c[_0x279c('0x2e')]);})[_0x279c('0x2b')]();}exports['index']=function(_0x43bad9,_0x3d67aa){var _0x172120={},_0x23b152={'count':0x0,'rows':[]};var _0xf6fe77=getUserAttributes();_0x172120=qs[_0x279c('0x38')](_0xf6fe77,_0x43bad9);var _0x19fc42={'where':_0x172120[_0x279c('0x39')]};return db[_0x279c('0x30')][_0x279c('0x1c')](_0x19fc42)[_0x279c('0x1f')](function(_0x301054){_0x23b152[_0x279c('0x1c')]=_0x301054;if(_0x43bad9[_0x279c('0x3a')][_0x279c('0x3b')]){_0x172120[_0x279c('0x3c')]=[{'all':!![]}];}if(_0x43bad9['query'][_0x279c('0x3d')]===_0x279c('0x3e')){_0x172120['include']=[{'model':db[_0x279c('0x3f')],'as':'userSetting'}];}if(!_[_0x279c('0x2c')](_0x172120[_0x279c('0x40')],'id')){_0x172120['attributes'][_0x279c('0x41')]('id');}return db[_0x279c('0x30')][_0x279c('0x42')](_0x172120);})[_0x279c('0x1f')](function(_0x5510d8){_0x23b152[_0x279c('0x43')]=_0x5510d8;if(_0x43bad9['query'][_0x279c('0x44')]===_0x279c('0x3e')){var _0x302861=[];for(var _0x451daf=0x0;_0x451daf<_0x23b152[_0x279c('0x43')][_0x279c('0x45')];_0x451daf++){_0x302861[_0x279c('0x41')](get_open_tabs(_0x279c('0x46'),_0x23b152[_0x279c('0x43')][_0x451daf][_0x279c('0x47')]));_0x302861[_0x279c('0x41')](get_open_tabs('sms',_0x23b152['rows'][_0x451daf]['dataValues']));_0x302861[_0x279c('0x41')](get_open_tabs('fax',_0x23b152[_0x279c('0x43')][_0x451daf][_0x279c('0x47')]));_0x302861[_0x279c('0x41')](get_open_tabs('mail',_0x23b152[_0x279c('0x43')][_0x451daf]['dataValues']));_0x302861['push'](get_open_tabs('openchannel',_0x23b152[_0x279c('0x43')][_0x451daf][_0x279c('0x47')]));_0x302861[_0x279c('0x41')](get_open_tabs('whatsapp',_0x23b152[_0x279c('0x43')][_0x451daf]['dataValues']));}return Promise[_0x279c('0x48')](_0x302861)[_0x279c('0x1f')](function(){return _0x23b152;});}else{return _0x23b152;}})[_0x279c('0x1f')](respondWithFilteredResult(_0x3d67aa,_0x172120))['catch'](handleError(_0x3d67aa,null));};exports[_0x279c('0x49')]=function(_0x453486,_0x1f05c4){var _0x1eedf5=getUserAttributes();_0x453486['query']['id']=_0x453486[_0x279c('0x4a')]['id'];var _0x4cf44a=qs[_0x279c('0x38')](_0x1eedf5,_0x453486);if(_0x453486['query'][_0x279c('0x3b')]){_0x4cf44a['include']=[{'all':!![]}];}if(_0x453486[_0x279c('0x3a')][_0x279c('0x3d')]===_0x279c('0x3e')){_0x4cf44a[_0x279c('0x3c')]=[{'model':db[_0x279c('0x3f')],'as':'userSetting'}];}_0x4cf44a=_[_0x279c('0x4b')]({},_0x4cf44a,_0x453486[_0x279c('0x4c')]);if(!_[_0x279c('0x2c')](_0x4cf44a[_0x279c('0x40')],'id')){_0x4cf44a[_0x279c('0x40')][_0x279c('0x41')]('id');}return db[_0x279c('0x30')][_0x279c('0x2d')](_0x4cf44a)['then'](handleEntityNotFound(_0x1f05c4,null))[_0x279c('0x1f')](function(_0x20a366){var _0x2ba8bd=[];values=_0x20a366;if(_0x453486[_0x279c('0x3a')][_0x279c('0x44')]===_0x279c('0x3e')){_0x2ba8bd[_0x279c('0x41')](get_open_tabs('chat',_0x20a366[_0x279c('0x47')]));_0x2ba8bd[_0x279c('0x41')](get_open_tabs(_0x279c('0x4d'),_0x20a366[_0x279c('0x47')]));_0x2ba8bd[_0x279c('0x41')](get_open_tabs(_0x279c('0x4e'),_0x20a366[_0x279c('0x47')]));_0x2ba8bd[_0x279c('0x41')](get_open_tabs(_0x279c('0x4f'),_0x20a366['dataValues']));_0x2ba8bd[_0x279c('0x41')](get_open_tabs(_0x279c('0x50'),_0x20a366[_0x279c('0x47')]));_0x2ba8bd[_0x279c('0x41')](get_open_tabs(_0x279c('0x51'),_0x20a366[_0x279c('0x47')]));return Promise[_0x279c('0x48')](_0x2ba8bd);}else{return values;}})[_0x279c('0x1f')](function(){return values;})[_0x279c('0x1f')](respondWithResult(_0x1f05c4,null))[_0x279c('0x52')](handleError(_0x1f05c4,null));};exports[_0x279c('0x1e')]=function(_0x1815fa,_0x418af1){if(_0x1815fa[_0x279c('0x53')]['id']){delete _0x1815fa[_0x279c('0x53')]['id'];}delete _0x1815fa['body']['role'];return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x1815fa['params']['id']}})['then'](handleEntityNotFound(_0x418af1,null))[_0x279c('0x1f')](saveUpdates(_0x1815fa['body'],null))[_0x279c('0x1f')](respondWithResult(_0x418af1,null))[_0x279c('0x52')](handleError(_0x418af1,null));};exports[_0x279c('0x54')]=function(_0x53dcc1,_0x5d335c){return db['User'][_0x279c('0x54')]()[_0x279c('0x1f')](respondWithResult(_0x5d335c,null))['catch'](handleError(_0x5d335c,null));};exports['addContacts']=function(_0x501200,_0x49260f){return db[_0x279c('0x30')]['find']({'where':{'id':_0x501200[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x49260f,null))[_0x279c('0x1f')](function(_0x44d18b){if(_0x44d18b){return _0x44d18b['addContacts'](_0x501200[_0x279c('0x53')]['ids'],_[_0x279c('0x55')](_0x501200[_0x279c('0x53')],[_0x279c('0x56'),'id'])||{});}})[_0x279c('0x1f')](respondWithResult(_0x49260f,null))['catch'](handleError(_0x49260f,null));};function validateUser(_0x245936){return new Promise(function(_0x2a46a0,_0x328502){if(_0x245936[_0x279c('0x57')])return _0x2a46a0(_0x245936);return db[_0x279c('0x58')][_0x279c('0x59')](0x1)['then'](function(_0x4d8c52){if(_0x4d8c52[_0x279c('0x5a')])authService[_0x279c('0x5b')](_0x245936[_0x279c('0x34')]);db[_0x279c('0x30')][_0x279c('0x5c')](_0x279c('0x57'))[_0x279c('0x1f')](function(_0x258c2c){if(_['isNil'](_0x258c2c)){_0x245936[_0x279c('0x57')]=_0x4d8c52[_0x279c('0x5d')]||0x1;return;}if(_[_0x279c('0x5e')](_0x4d8c52[_0x279c('0x5d')])||_0x4d8c52[_0x279c('0x5d')]===_0x258c2c){_0x245936[_0x279c('0x57')]=_0x258c2c+0x1;return;}if(_0x4d8c52[_0x279c('0x5d')]>_0x258c2c){_0x245936[_0x279c('0x57')]=_0x4d8c52[_0x279c('0x5d')];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x279c('0x5f')][_0x279c('0x60')]})[_0x279c('0x1f')](function(_0x1616c7){if(_0x1616c7&&_0x1616c7[_0x279c('0x45')]){for(var _0x2c70ec=0x0,_0x10c158=_0x1616c7[_0x279c('0x45')];_0x2c70ec<_0x10c158&&_['isNil'](_0x245936[_0x279c('0x57')]);_0x2c70ec++){if(_0x4d8c52['min_internal']<=_0x1616c7[_0x2c70ec][_0x279c('0x61')]){_0x245936['internal']=_0x1616c7[_0x2c70ec][_0x279c('0x61')];}else if(_0x4d8c52['min_internal']>_0x1616c7[_0x2c70ec]['from']&&_0x4d8c52[_0x279c('0x5d')]<=_0x1616c7[_0x2c70ec]['to']){_0x245936[_0x279c('0x57')]=_0x4d8c52[_0x279c('0x5d')];}}}if(_[_0x279c('0x5e')](_0x245936[_0x279c('0x57')])){_0x245936['internal']=_0x258c2c+0x1;}return _0x2a46a0(_0x245936);});});})[_0x279c('0x52')](function(_0x486593){_0x328502(_0x486593);});});}function updateUser(_0x45c36a){return new Promise(function(_0x22f574,_0xc4a8c2){try{if(_0x45c36a[_0x279c('0x62')]){_0x45c36a[_0x279c('0x63')]=_0x45c36a['internal'];_0x45c36a[_0x279c('0x64')]={'mailbox':_0x45c36a[_0x279c('0x57')],'password':_0x45c36a['password'],'fullname':_0x45c36a[_0x279c('0x65')],'email':_0x45c36a['email']};}if(_0x45c36a['role']===_0x279c('0x66')){if(!_0x45c36a['permissions'])_0x45c36a[_0x279c('0x67')]=[_0x279c('0x68'),'102',_0x279c('0x69'),_0x279c('0x6a'),_0x279c('0x6b'),_0x279c('0x6c'),_0x279c('0x6d'),_0x279c('0x6e'),_0x279c('0x6f'),_0x279c('0x70'),_0x279c('0x71'),_0x279c('0x72'),_0x279c('0x73'),_0x279c('0x74'),_0x279c('0x75')];}_0x22f574(_0x45c36a);}catch(_0x11faa2){_0xc4a8c2(_0x11faa2);}});}exports['create']=function(_0x13f8ea,_0x36a4f6){if(_0x13f8ea[_0x279c('0x26')][_0x279c('0x20')]===_0x279c('0x66'))throw new Error('Unauthorized');if(_0x13f8ea[_0x279c('0x53')]['role']==='user'&&_0x13f8ea['user'][_0x279c('0x20')]!==_0x279c('0x24')){throw new Error(_0x279c('0x76'));}if(_0x13f8ea['body']['role']===_0x279c('0x24')&&_0x13f8ea[_0x279c('0x26')][_0x279c('0x20')]!==_0x279c('0x24')){throw new Error(_0x279c('0x77'));}return licenseUtil[_0x279c('0x78')]([_0x13f8ea['body']])[_0x279c('0x1f')](function(){return validateUser(_0x13f8ea[_0x279c('0x53')]);})['then'](function(_0x2f4739){return updateUser(_0x2f4739)[_0x279c('0x1f')](function(_0x204e25){if(_0x204e25[_0x279c('0x20')]===_0x279c('0x24')){_0x204e25[_0x279c('0x79')]=_0x13f8ea['user'][_0x279c('0x79')];delete _0x204e25['userProfileId'];}return _0x204e25;});})[_0x279c('0x1f')](function(_0x19a78c){return db[_0x279c('0x30')][_0x279c('0x7a')](_0x19a78c,{'include':[{'model':db[_0x279c('0x64')],'as':_0x279c('0x64')}]});})[_0x279c('0x1f')](function(_0x76e1ed){if(_0x13f8ea[_0x279c('0x53')]['role']==='user')return _0x76e1ed;if(_0x13f8ea[_0x279c('0x26')][_0x279c('0x20')]!==_0x279c('0x26'))return _0x76e1ed;return db['UserProfileSection'][_0x279c('0x2d')]({'where':{'name':_0x76e1ed[_0x279c('0x20')]===_0x279c('0x66')?'Agents':_0x279c('0x27'),'userProfileId':_0x13f8ea['user'][_0x279c('0x7b')]},'raw':!![]})[_0x279c('0x1f')](function(_0x175b55){if(!_0x175b55||_0x175b55[_0x279c('0x7c')]!=0x0)return _0x76e1ed;return db[_0x279c('0x7d')][_0x279c('0x7a')]({'name':_0x76e1ed['name'],'resourceId':_0x76e1ed['id'],'type':_0x175b55[_0x279c('0x2e')],'sectionId':_0x175b55['id']},{})[_0x279c('0x1f')](function(){return _0x76e1ed;});})[_0x279c('0x52')](function(_0x5340ac){logger[_0x279c('0x2f')](_0x279c('0x7e'),_0x5340ac);throw _0x5340ac;});})[_0x279c('0x1f')](respondWithResult(_0x36a4f6,0xc9))['catch'](handleError(_0x36a4f6,null));};exports[_0x279c('0x7f')]=function(_0x3187bf,_0x55438f){var _0x2258b7=_0x3187bf['body'];var _0x8680b3=[];if(_0x3187bf[_0x279c('0x26')][_0x279c('0x20')]===_0x279c('0x66'))throw new Error(_0x279c('0x80'));if(_[_0x279c('0x81')](_0x2258b7,['role',_0x279c('0x26')])&&_0x3187bf[_0x279c('0x26')][_0x279c('0x20')]!==_0x279c('0x24')){throw new Error(_0x279c('0x76'));}if(_[_0x279c('0x81')](_0x2258b7,[_0x279c('0x20'),_0x279c('0x24')])&&_0x3187bf[_0x279c('0x26')]['role']!==_0x279c('0x24')){throw new Error(_0x279c('0x82'));}return licenseUtil[_0x279c('0x78')](_0x2258b7)['then'](function(){return validateUser(_0x2258b7[0x0]);})[_0x279c('0x1f')](function(){for(var _0x4d6376=0x1;_0x4d6376<_0x2258b7['length'];_0x4d6376++){var _0x4bfe8a=_0x2258b7[_0x4d6376-0x1]['internal'];if(!_0x2258b7[_0x4d6376][_0x279c('0x57')])_0x2258b7[_0x4d6376]['internal']=_0x4bfe8a+0x1;_0x8680b3[_0x279c('0x41')](validateUser(_0x2258b7[_0x4d6376]));}return Promise[_0x279c('0x48')](_0x8680b3);})[_0x279c('0x1f')](function(){_0x8680b3=[];for(var _0x34030e=0x0;_0x34030e<_0x2258b7['length'];_0x34030e++){_0x8680b3[_0x279c('0x41')](updateUser(_0x2258b7[_0x34030e]));}return Promise[_0x279c('0x48')](_0x8680b3);})['then'](function(){_0x8680b3=_0x2258b7[_0x279c('0x32')](function(_0x4a89be){return db[_0x279c('0x30')][_0x279c('0x7a')](_0x4a89be,{'include':[{'model':db[_0x279c('0x64')],'as':_0x279c('0x64')}]})['then'](function(_0x39113d){_0x4a89be['id']=_0x39113d['id'];return _0x4a89be;});});return Promise[_0x279c('0x48')](_0x8680b3);})[_0x279c('0x1f')](function(_0x3eb8b4){if(_0x3187bf['body']['role']===_0x279c('0x26'))return _0x3eb8b4;if(_0x3187bf[_0x279c('0x26')][_0x279c('0x20')]!==_0x279c('0x26'))return _0x3eb8b4;var _0x1e02a6=_[_0x279c('0x81')](_0x3eb8b4,function(_0x2cf2a2){return _0x2cf2a2['role']===_0x279c('0x66')||_0x2cf2a2[_0x279c('0x20')]==='telephone';});if(!_0x1e02a6)return _0x3eb8b4;return db[_0x279c('0x83')][_0x279c('0x42')]({'where':{'name':{'$or':['Agents',_0x279c('0x27')]},'userProfileId':_0x3187bf[_0x279c('0x26')][_0x279c('0x7b')]},'raw':!![]})['then'](function(_0x154300){if(_['isEmpty'](_0x154300)||!_[_0x279c('0x81')](_0x154300,['autoAssociation',0x0]))return _0x3eb8b4;_0x8680b3=[];var _0x44f139=_(_0x154300)['map'](function(_0x282f2c){if(_0x282f2c[_0x279c('0x7c')]===0x1)return;return _0x282f2c['name']==='Agents'?_0x279c('0x66'):'telephone';})[_0x279c('0x84')]()['value']();for(var _0x1ec0c5=0x0;_0x1ec0c5<_0x3eb8b4[_0x279c('0x45')];_0x1ec0c5++){if(!_[_0x279c('0x2c')](_0x44f139,_0x3eb8b4[_0x1ec0c5][_0x279c('0x20')]))return;var _0xc7d03b=_0x3eb8b4[_0x1ec0c5][_0x279c('0x20')]===_0x279c('0x66')?_0x279c('0x85'):_0x279c('0x27');_0x8680b3['push'](db['UserProfileResource'][_0x279c('0x7a')]({'name':_0x3eb8b4[_0x1ec0c5][_0x279c('0x2e')],'resourceId':_0x3eb8b4[_0x1ec0c5]['id'],'type':_0xc7d03b,'sectionId':_[_0x279c('0x2d')](_0x154300,['name',_0xc7d03b])['id']},{}));}return Promise[_0x279c('0x48')](_0x8680b3);});})['then'](respondWithResult(_0x55438f,0xc9))[_0x279c('0x52')](handleError(_0x55438f,null));};exports['changePassword']=function(_0x103c01,_0x2225e7){if(_0x103c01[_0x279c('0x53')]['id']){delete _0x103c01[_0x279c('0x53')]['id'];}return db['User'][_0x279c('0x2d')]({'where':{'id':_0x103c01['params']['id']}})['then'](function(_0x2a9219){if(!_0x2a9219)return null;if(_0x2a9219['id']===_0x103c01['user']['id']){if(!_0x103c01[_0x279c('0x53')][_0x279c('0x86')]||!_0x103c01[_0x279c('0x53')][_0x279c('0x87')]){throw new db['Sequelize'][(_0x279c('0x88'))](_0x279c('0x89'));}if(!_0x2a9219[_0x279c('0x8a')](_0x103c01[_0x279c('0x53')]['oldPassword'])){throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x8c'));}if(_0x103c01['body']['oldPassword']===_0x103c01[_0x279c('0x53')][_0x279c('0x87')]){throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x8d'));}}else if(_0x103c01[_0x279c('0x26')]['role']===_0x279c('0x24')){if(!_0x103c01[_0x279c('0x53')][_0x279c('0x87')]){throw new db[(_0x279c('0x8b'))]['ValidationError'](_0x279c('0x8e'));}}else if(_0x103c01[_0x279c('0x26')]['role']===_0x279c('0x26')){if(!_0x103c01[_0x279c('0x53')][_0x279c('0x87')]){throw new db[(_0x279c('0x8b'))]['ValidationError'](_0x279c('0x8e'));}if(_0x2a9219[_0x279c('0x20')]!==_0x279c('0x66')){throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x80'));}}else{throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x80'));}return _0x2a9219;})[_0x279c('0x1f')](handleEntityNotFound(_0x2225e7,null))[_0x279c('0x1f')](function(_0x2e67a9){return db[_0x279c('0x58')][_0x279c('0x8f')]({'attributes':['id',_0x279c('0x5a'),_0x279c('0x90'),_0x279c('0x91')]})[_0x279c('0x1f')](function(_0x22bf31){if(_0x22bf31[_0x279c('0x5a')])authService[_0x279c('0x5b')](_0x103c01[_0x279c('0x53')]['newPassword']);if(!_0x22bf31[_0x279c('0x90')]||!_0x2e67a9[_0x279c('0x92')])return _0x2e67a9;authService[_0x279c('0x93')](_0x103c01[_0x279c('0x53')]['newPassword'],_0x2e67a9['previousPasswords'],_0x22bf31[_0x279c('0x91')]);return _0x2e67a9;})['then'](saveUpdates({'password':_0x103c01[_0x279c('0x53')]['newPassword'],'passwordResetAt':_0x103c01[_0x279c('0x26')]['id']==_0x103c01[_0x279c('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x279c('0x94')](_0x103c01['body'][_0x279c('0x87')],_0x2e67a9[_0x279c('0x92')])},null));})[_0x279c('0x1f')](respondWithResult(_0x2225e7,null))[_0x279c('0x52')](handleError(_0x2225e7,null));};exports[_0x279c('0x95')]=function(_0x498f50,_0x5b8675){var _0x2d58b=_0x498f50['body'][_0x279c('0x96')];return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x498f50['params']['id']},'attributes':['id','name',_0x279c('0x20'),_0x279c('0x97'),_0x279c('0x98'),'voicePause',_0x279c('0x99')]})[_0x279c('0x1f')](handleEntityNotFound(_0x5b8675,null))[_0x279c('0x1f')](function(_0x688c67){if(_0x688c67){if(!utils[_0x279c('0x9a')](_0x2d58b)){throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x9b'));}return _0x688c67[_0x279c('0x9c')+_[_0x279c('0x9d')](_0x2d58b['toLowerCase']())+'Queues'](_0x498f50[_0x279c('0x53')][_0x279c('0x56')],{'penalty':_0x498f50[_0x279c('0x53')][_0x279c('0x9e')]||0x0})[_0x279c('0x9f')](function(_0x56626f){for(var _0x26e1f5=0x0;_0x26e1f5<_0x498f50['body']['ids']['length'];_0x26e1f5+=0x1){var _0x4f4ddd={'UserId':Number(_0x498f50[_0x279c('0x4a')]['id'])};_0x4f4ddd[_[_0x279c('0x9d')](_0x2d58b[_0x279c('0xa0')]())+_0x279c('0xa1')]=Number(_0x498f50[_0x279c('0x53')]['ids'][_0x26e1f5]);socket['emit'](_0x279c('0x26')+_[_0x279c('0x9d')](_0x2d58b[_0x279c('0xa0')]())+_0x279c('0xa2'),_0x4f4ddd);}return _0x56626f;})[_0x279c('0x1f')](function(){if(_0x2d58b==='voice'){return db[_0x279c('0xa3')]['findAll']({'where':{'id':_0x498f50[_0x279c('0x53')][_0x279c('0x56')]||[]},'raw':!![],'attributes':['id',_0x279c('0x2e')]});}})[_0x279c('0x1f')](function(_0x2a7994){var _0x4e6f09=_0x688c67['get']({'plain':!![]});var _0x39b05a=[];if(_0x2d58b===_0x279c('0xa4')&&_0x4e6f09[_0x279c('0x20')]==='agent'&&_0x4e6f09[_0x279c('0x97')]){for(let _0xb73bb=0x0;_0xb73bb<_0x2a7994[_0x279c('0x45')];_0xb73bb+=0x1){_0x39b05a[_0x279c('0x41')]({'membername':_0x4e6f09[_0x279c('0x2e')],'UserId':_0x4e6f09['id'],'queue_name':_0x2a7994[_0xb73bb]['name'],'VoiceQueueId':_0x2a7994[_0xb73bb]['id'],'interface':_[_0x279c('0x5e')](_0x4e6f09[_0x279c('0x99')])?util[_0x279c('0xa5')](_0x279c('0xa6'),_0x4e6f09[_0x279c('0x2e')]):_0x4e6f09[_0x279c('0x99')],'paused':_0x4e6f09[_0x279c('0xa7')]||![],'penalty':_0x498f50[_0x279c('0x53')][_0x279c('0x9e')]||0x0});}return Promise[_0x279c('0x48')](_0x39b05a[_0x279c('0x32')](function(_0x16b000){return db[_0x279c('0xa8')]['upsert'](_0x16b000);}));}return _0x688c67;});}})[_0x279c('0x1f')](respondWithStatusCode(_0x5b8675,null))[_0x279c('0x52')](handleError(_0x5b8675,null));};exports[_0x279c('0xa9')]=function(_0x2e37a7,_0x1c3de1){var _0x3e7944,_0x2fc872;return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x2e37a7['params']['id']},'attributes':['id','name','role']})[_0x279c('0x1f')](handleEntityNotFound(_0x1c3de1,null))[_0x279c('0x1f')](function(_0x1c6cda){if(_0x1c6cda){_0x3e7944=_0x1c6cda;if(!_0x2e37a7['query'][_0x279c('0x96')]||!utils['isValidChannel'](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x96')])){throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0x9b'));}return _0x1c6cda[_0x279c('0xaa')+_[_0x279c('0x9d')](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x96')][_0x279c('0xa0')]())+_0x279c('0xab')](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x56')]);}})[_0x279c('0x1f')](function(_0x3d7954){if(_[_0x279c('0xac')](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x56')])){for(var _0x5de0f5=0x0;_0x5de0f5<_0x2e37a7[_0x279c('0x3a')][_0x279c('0x56')]['length'];_0x5de0f5+=0x1){_0x2fc872={'UserId':Number(_0x2e37a7['params']['id'])};_0x2fc872[_[_0x279c('0x9d')](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x96')][_0x279c('0xa0')]())+_0x279c('0xa1')]=Number(_0x2e37a7['query'][_0x279c('0x56')][_0x5de0f5]);socket[_0x279c('0x21')](_0x279c('0x26')+_[_0x279c('0x9d')](_0x2e37a7[_0x279c('0x3a')][_0x279c('0x96')][_0x279c('0xa0')]())+_0x279c('0xad'),_0x2fc872);}}else{_0x2fc872={'UserId':Number(_0x2e37a7[_0x279c('0x4a')]['id'])};_0x2fc872[_[_0x279c('0x9d')](_0x2e37a7['query'][_0x279c('0x96')][_0x279c('0xa0')]())+_0x279c('0xa1')]=Number(_0x2e37a7[_0x279c('0x3a')][_0x279c('0x56')]);socket[_0x279c('0x21')](_0x279c('0x26')+_[_0x279c('0x9d')](_0x2e37a7['query'][_0x279c('0x96')][_0x279c('0xa0')]())+_0x279c('0xad'),_0x2fc872);}return _0x3d7954;})[_0x279c('0x1f')](function(){if(_0x2e37a7[_0x279c('0x3a')][_0x279c('0x96')]===_0x279c('0xa4')){return db[_0x279c('0xa8')]['destroy']({'where':{'UserId':_0x2e37a7[_0x279c('0x4a')]['id'],'VoiceQueueId':_0x2e37a7[_0x279c('0x3a')][_0x279c('0x56')]},'individualHooks':!![]})['then'](function(){return _0x3e7944;});}return _0x3e7944;})[_0x279c('0x1f')](respondWithStatusCode(_0x1c3de1,null))['catch'](handleError(_0x1c3de1,null));};exports[_0x279c('0xae')]=function(_0x20edce,_0x5a044a){_0x20edce[_0x279c('0x53')][_0x279c('0xaf')]=_0x20edce[_0x279c('0xb0')][_0x279c('0xb1')];return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x20edce[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x5a044a,null))['then'](saveUpdates(_0x20edce[_0x279c('0x53')],null))[_0x279c('0x1f')](respondWithResult(_0x5a044a,null))[_0x279c('0x52')](handleError(_0x5a044a,null));};exports[_0x279c('0xb2')]=function(_0x3c8575,_0x59bf51){var _0x112a0b=path[_0x279c('0xb3')](config[_0x279c('0xb4')],_0x279c('0xb5'));return db['User']['find']({'where':{'id':_0x3c8575[_0x279c('0x4a')]['id']},'attributes':['id',_0x279c('0xaf')],'raw':!![]})[_0x279c('0x1f')](handleEntityNotFound(_0x59bf51,null))[_0x279c('0x1f')](function(_0x450c26){if(_0x450c26){if(_['isNil'](_0x450c26['userpic'])){return _0x59bf51['download'](_0x112a0b);}else{if(!fs['existsSync'](path[_0x279c('0xb3')](config[_0x279c('0xb4')],_0x279c('0xb6'),_0x450c26[_0x279c('0xaf')]))){return _0x59bf51[_0x279c('0xb7')](_0x112a0b);}return _0x59bf51[_0x279c('0xb7')](path[_0x279c('0xb3')](config[_0x279c('0xb4')],_0x279c('0xb6'),_0x450c26[_0x279c('0xaf')]));}}})[_0x279c('0x52')](handleError(_0x59bf51,null));};exports[_0x279c('0xb8')]=function(_0x3bc4bc,_0xf2fe83){return db[_0x279c('0x30')]['find']({'where':{'id':_0x3bc4bc['params']['id']},'attributes':['id']})[_0x279c('0x1f')](handleEntityNotFound(_0xf2fe83,null))[_0x279c('0x1f')](function(_0x3aef6f){var _0xf470fd=[];values=_0x3aef6f[_0x279c('0x47')];_0xf470fd['push'](get_open_tabs(_0x279c('0x46'),_0x3aef6f[_0x279c('0x47')]));_0xf470fd[_0x279c('0x41')](get_open_tabs('sms',_0x3aef6f['dataValues']));_0xf470fd['push'](get_open_tabs('openchannel',_0x3aef6f[_0x279c('0x47')]));_0xf470fd[_0x279c('0x41')](get_open_tabs('whatsapp',_0x3aef6f['dataValues']));_0xf470fd[_0x279c('0x41')](get_open_tabs(_0x279c('0x50'),_0x3aef6f[_0x279c('0x47')]));_0xf470fd[_0x279c('0x41')](get_open_tabs(_0x279c('0x51'),_0x3aef6f[_0x279c('0x47')]));return Promise[_0x279c('0x48')](_0xf470fd);})[_0x279c('0x1f')](function(_0x5c697e){if(_0x5c697e){var _0x401415=_[_0x279c('0x32')](values[_0x279c('0xb9')],function(_0x281d33){return{'channel':_0x279c('0xba'),'id':_0x281d33['id'],'createdAt':_0x281d33[_0x279c('0xbb')]};});var _0x2aab96=_[_0x279c('0x32')](values[_0x279c('0xbc')],function(_0x47f786){return{'channel':_0x279c('0xbd'),'id':_0x47f786['id'],'createdAt':_0x47f786[_0x279c('0xbb')]};});var _0x557786=_[_0x279c('0x32')](values['OpenchannelOpenTabs'],function(_0x25fc64){return{'channel':_0x279c('0xbe'),'id':_0x25fc64['id'],'createdAt':_0x25fc64[_0x279c('0xbb')]};});var _0x3a4793=_[_0x279c('0x32')](values[_0x279c('0xbf')],function(_0x188aff){return{'channel':_0x279c('0xc0'),'id':_0x188aff['id'],'createdAt':_0x188aff[_0x279c('0xbb')]};});var _0x3c2b2a=_[_0x279c('0x32')](values['SmsOpenTabs'],function(_0xd4dbc4){return{'channel':_0x279c('0xc1'),'id':_0xd4dbc4['id'],'createdAt':_0xd4dbc4['createdAt']};});var _0x5b9d59=_['map'](values[_0x279c('0xc2')],function(_0x35bd75){return{'channel':_0x279c('0xc3'),'id':_0x35bd75['id'],'createdAt':_0x35bd75[_0x279c('0xbb')]};});var _0x342192=_[_0x279c('0xc4')](_0x401415,_0x2aab96,_0x557786,_0x3a4793,_0x3c2b2a,_0x5b9d59);var _0x3e7bbb={'count':_0x342192[_0x279c('0x45')],'rows':_0x342192};return _0x3e7bbb;}else return null;})['then'](respondWithResult(_0xf2fe83,null))[_0x279c('0x52')](handleError(_0xf2fe83,null));};exports[_0x279c('0xc5')]=function(_0x3621ce,_0x489739){var _0x266f01={};return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x3621ce[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](function(_0x2a7e16){if(!_0x2a7e16){throw new APINotFoundError(util[_0x279c('0xa5')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3621ce[_0x279c('0x4a')]['id']));}return contacts[_0x279c('0x54')]();})[_0x279c('0x1f')](function(_0x365cae){_0x3621ce[_0x279c('0x3a')][_0x279c('0x30')]=_0x3621ce['params']['id'];_0x266f01=qs['getOptions'](_0x365cae,_0x3621ce);if(_0x3621ce['query'][_0x279c('0xc6')](_0x279c('0x3b'))){_0x266f01[_0x279c('0x3c')]=[{'model':db[_0x279c('0xc7')],'as':_0x279c('0xc8'),'required':![]},{'model':db['Tag'],'as':_0x279c('0xc9'),'attributes':['id','name',_0x279c('0xca')],'where':_0x3621ce[_0x279c('0x3a')][_0x279c('0xcb')]?{'id':_0x3621ce[_0x279c('0x3a')][_0x279c('0xcb')]}:undefined,'required':_0x3621ce[_0x279c('0x3a')]['tag']?!![]:![]}];}return contacts[_0x279c('0x42')](_0x3621ce[_0x279c('0x3a')],_0x3621ce[_0x279c('0x26')],_0x266f01,_0x365cae);})[_0x279c('0x1f')](respondWithFilteredResult(_0x489739,_0x266f01))[_0x279c('0x52')](APIHandleError(_0x489739));};exports[_0x279c('0xcc')]=function(_0x1df96a,_0x26857e){var _0x13bba2;var _0x48e259={};var _0x5776da;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x1df96a[_0x279c('0x4a')]['id']},'attributes':['id',_0x279c('0x2e'),'role']})[_0x279c('0x1f')](handleEntityNotFound(_0x26857e,null))[_0x279c('0x1f')](function(_0xff33a4){if(!utils[_0x279c('0x9a')](_0x1df96a[_0x279c('0x3a')][_0x279c('0x96')])){throw new db[(_0x279c('0x8b'))]['ValidationError'](_0x279c('0x9b'));}_0x13bba2=_0xff33a4;var _0x1ca13d={};_0x1ca13d['model']=_[_0x279c('0xcd')](db[_[_0x279c('0x9d')](_0x1df96a[_0x279c('0x3a')][_0x279c('0x96')])+'Queue']['rawAttributes']);_0x1ca13d['query']=_[_0x279c('0xcd')](_0x1df96a[_0x279c('0x3a')]);_0x1ca13d[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x1ca13d[_0x279c('0xd0')],_0x1ca13d[_0x279c('0x3a')]);_0x48e259['attributes']=_[_0x279c('0xcf')](_0x1ca13d[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x1df96a[_0x279c('0x3a')]['fields']));_0x48e259[_0x279c('0x40')]=_0x48e259[_0x279c('0x40')][_0x279c('0x45')]?_0x48e259[_0x279c('0x40')]:_0x1ca13d['model'];_0x48e259[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0x1df96a[_0x279c('0x3a')][_0x279c('0xd3')]);_0x48e259[_0x279c('0x39')]=qs[_0x279c('0xce')](_['pick'](_0x1df96a[_0x279c('0x3a')],_0x1ca13d[_0x279c('0xce')]));if(_0x1df96a[_0x279c('0x3a')][_0x279c('0x29')]){_0x48e259['where']=_[_0x279c('0x4b')](_0x48e259[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x48e259[_0x279c('0x40')],function(_0x3d4c3a){var _0x5c0c25={};_0x5c0c25[_0x3d4c3a]={'$like':'%'+_0x1df96a[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x5c0c25;})});}_0x48e259=_[_0x279c('0x4b')]({},_0x48e259,_0x1df96a[_0x279c('0x4c')]);switch(_0x13bba2[_0x279c('0x20')]){case _0x279c('0x24'):return db[_[_0x279c('0x9d')](_0x1df96a[_0x279c('0x3a')][_0x279c('0x96')])+_0x279c('0xd4')][_0x279c('0x42')](_0x48e259);case _0x279c('0x26'):case _0x279c('0x66'):return _0x13bba2['get'+_['capitalize'](_0x1df96a[_0x279c('0x3a')][_0x279c('0x96')])+_0x279c('0xab')](_0x48e259);default:throw new db['Sequelize'][(_0x279c('0x88'))](_0x279c('0xd5'));}})[_0x279c('0x1f')](function(_0x34f0b9){_0x5776da=_0x34f0b9[_0x279c('0x45')];if(!_0x1df96a['query']['hasOwnProperty'](_0x279c('0xd6'))){_0x48e259['limit']=qs[_0x279c('0x1b')](_0x1df96a['query'][_0x279c('0x1b')]);_0x48e259[_0x279c('0x19')]=qs['offset'](_0x1df96a['query']['offset']);}switch(_0x13bba2['role']){case _0x279c('0x24'):return db[_['capitalize'](_0x1df96a[_0x279c('0x3a')][_0x279c('0x96')])+'Queue'][_0x279c('0x42')](_0x48e259);case'user':case _0x279c('0x66'):return _0x13bba2[_0x279c('0x23')+_[_0x279c('0x9d')](_0x1df96a['query'][_0x279c('0x96')])+'Queues'](_0x48e259);}})[_0x279c('0x1f')](function(_0x3d5841){return{'count':_0x5776da,'rows':_0x3d5841};})[_0x279c('0x1f')](respondWithResult(_0x26857e,null))[_0x279c('0x52')](handleError(_0x26857e,null));};exports[_0x279c('0xd7')]=function(_0x1fef79,_0x15a99c){var _0x29e660={};var _0x3324a0={};var _0x4e3ef6;var _0x2f5071;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x1fef79[_0x279c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15a99c,null))[_0x279c('0x1f')](function(_0x49f320){if(_0x49f320){_0x4e3ef6=_0x49f320;_0x3324a0['model']=_[_0x279c('0xcd')](db[_0x279c('0xa8')][_0x279c('0x31')]);_0x3324a0[_0x279c('0x3a')]=_['keys'](_0x1fef79[_0x279c('0x3a')]);_0x3324a0[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x3324a0['model'],_0x3324a0[_0x279c('0x3a')]);_0x29e660['attributes']=_[_0x279c('0xcf')](_0x3324a0[_0x279c('0xd0')],qs['fields'](_0x1fef79[_0x279c('0x3a')][_0x279c('0xd1')]));_0x29e660[_0x279c('0x40')]=_0x29e660[_0x279c('0x40')]['length']?_0x29e660['attributes']:_0x3324a0[_0x279c('0xd0')];_0x29e660[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0x1fef79[_0x279c('0x3a')]['sort']);_0x29e660[_0x279c('0x39')]=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0x1fef79[_0x279c('0x3a')],_0x3324a0[_0x279c('0xce')]));if(_0x1fef79[_0x279c('0x3a')][_0x279c('0x29')]){_0x29e660['where']=_[_0x279c('0x4b')](_0x29e660[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x29e660[_0x279c('0x40')],function(_0x4e08c9){var _0x3590c4={};_0x3590c4[_0x4e08c9]={'$like':'%'+_0x1fef79[_0x279c('0x3a')]['filter']+'%'};return _0x3590c4;})});}_0x29e660=_[_0x279c('0x4b')]({},_0x29e660,_0x1fef79[_0x279c('0x4c')]);return _0x4e3ef6[_0x279c('0xd7')](_0x29e660);}})[_0x279c('0x1f')](function(_0x4e3291){if(_0x4e3291){_0x2f5071=_0x4e3291[_0x279c('0x45')];if(!_0x1fef79['query'][_0x279c('0xc6')](_0x279c('0xd6'))){_0x29e660['limit']=qs['limit'](_0x1fef79[_0x279c('0x3a')][_0x279c('0x1b')]);_0x29e660[_0x279c('0x19')]=qs['offset'](_0x1fef79['query']['offset']);}return _0x4e3ef6[_0x279c('0xd7')](_0x29e660);}})[_0x279c('0x1f')](function(_0x40a05f){if(_0x40a05f){return _0x40a05f?{'count':_0x2f5071,'rows':_0x40a05f}:null;}})[_0x279c('0x1f')](respondWithResult(_0x15a99c,null))[_0x279c('0x52')](handleError(_0x15a99c,null));};exports[_0x279c('0xd9')]=function(_0x87e58,_0x950033){var _0x360d3b={};var _0x37bb94={};var _0x596cae;var _0x59e390;return db[_0x279c('0x30')]['findOne']({'where':{'id':_0x87e58[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x950033,null))[_0x279c('0x1f')](function(_0x3ff69f){if(_0x3ff69f){_0x596cae=_0x3ff69f;_0x37bb94[_0x279c('0xd0')]=_[_0x279c('0xcd')](db[_0x279c('0xda')][_0x279c('0x31')]);_0x37bb94['query']=_[_0x279c('0xcd')](_0x87e58['query']);_0x37bb94[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x37bb94['model'],_0x37bb94[_0x279c('0x3a')]);_0x360d3b[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x37bb94[_0x279c('0xd0')],qs['fields'](_0x87e58['query'][_0x279c('0xd1')]));_0x360d3b['attributes']=_0x360d3b['attributes'][_0x279c('0x45')]?_0x360d3b[_0x279c('0x40')]:_0x37bb94[_0x279c('0xd0')];_0x360d3b['order']=qs['sort'](_0x87e58[_0x279c('0x3a')][_0x279c('0xd3')]);_0x360d3b[_0x279c('0x39')]=qs['filters'](_[_0x279c('0xd8')](_0x87e58[_0x279c('0x3a')],_0x37bb94[_0x279c('0xce')]));if(_0x87e58['query']['filter']){_0x360d3b[_0x279c('0x39')]=_[_0x279c('0x4b')](_0x360d3b['where'],{'$or':_[_0x279c('0x32')](_0x360d3b['attributes'],function(_0x11c9c7){var _0x2e9266={};_0x2e9266[_0x11c9c7]={'$like':'%'+_0x87e58[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x2e9266;})});}_0x360d3b=_[_0x279c('0x4b')]({},_0x360d3b,_0x87e58['options']);return _0x596cae[_0x279c('0xd9')](_0x360d3b);}})[_0x279c('0x1f')](function(_0x8fbf51){if(_0x8fbf51){_0x59e390=_0x8fbf51[_0x279c('0x45')];if(!_0x87e58[_0x279c('0x3a')]['hasOwnProperty'](_0x279c('0xd6'))){_0x360d3b[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0x87e58[_0x279c('0x3a')][_0x279c('0x1b')]);_0x360d3b[_0x279c('0x19')]=qs['offset'](_0x87e58['query'][_0x279c('0x19')]);}return _0x596cae[_0x279c('0xd9')](_0x360d3b);}})[_0x279c('0x1f')](function(_0x1ed514){if(_0x1ed514){return _0x1ed514?{'count':_0x59e390,'rows':_0x1ed514}:null;}})['then'](respondWithResult(_0x950033,null))[_0x279c('0x52')](handleError(_0x950033,null));};exports['getRecordings']=function(_0xd18567,_0x5460a5){var _0x29f900={'raw':!![],'where':{}};var _0x1e4f43={};var _0x46d7f7={'count':0x0,'rows':[]};return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0xd18567['params']['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x5460a5,null))[_0x279c('0x1f')](function(_0x3410aa){if(_0x3410aa){_0x1e4f43['model']=_[_0x279c('0xcd')](db[_0x279c('0xdb')][_0x279c('0x31')]);_0x1e4f43[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0xd18567[_0x279c('0x3a')]);_0x1e4f43['filters']=_[_0x279c('0xcf')](_0x1e4f43[_0x279c('0xd0')],_0x1e4f43[_0x279c('0x3a')]);_0x29f900[_0x279c('0x40')]=_['intersection'](_0x1e4f43[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0xd18567['query']['fields']));_0x29f900['attributes']=_0x29f900[_0x279c('0x40')][_0x279c('0x45')]?_0x29f900[_0x279c('0x40')]:_0x1e4f43[_0x279c('0xd0')];if(!_0xd18567[_0x279c('0x3a')][_0x279c('0xc6')](_0x279c('0xd6'))){_0x29f900[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0xd18567[_0x279c('0x3a')][_0x279c('0x1b')]);_0x29f900[_0x279c('0x19')]=qs[_0x279c('0x19')](_0xd18567[_0x279c('0x3a')][_0x279c('0x19')]);}_0x29f900['order']=qs[_0x279c('0xd3')](_0xd18567[_0x279c('0x3a')][_0x279c('0xd3')]);_0x29f900['where']=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0xd18567[_0x279c('0x3a')],_0x1e4f43[_0x279c('0xce')]));_0x29f900[_0x279c('0x39')][_0x279c('0xdc')]=_0x3410aa['id'];if(_0xd18567[_0x279c('0x3a')]['filter']){_0x29f900[_0x279c('0x39')]=_[_0x279c('0x4b')](_0x29f900['where'],{'$or':_[_0x279c('0x32')](_0x29f900[_0x279c('0x40')],function(_0x2d5698){var _0x4b45dd={};_0x4b45dd[_0x2d5698]={'$like':'%'+_0xd18567[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x4b45dd;})});}_0x29f900=_[_0x279c('0x4b')]({},_0x29f900,_0xd18567[_0x279c('0x4c')]);return db[_0x279c('0xdb')][_0x279c('0x1c')]({'where':_0x29f900[_0x279c('0x39')]})['then'](function(_0x2ff19c){_0x46d7f7['count']=_0x2ff19c;if(_0xd18567[_0x279c('0x3a')][_0x279c('0x3b')]){_0x29f900['include']=[{'all':!![]}];}return db[_0x279c('0xdb')][_0x279c('0x42')](_0x29f900);})['then'](function(_0x50d096){_0x46d7f7[_0x279c('0x43')]=_0x50d096;return _0x46d7f7;});}})['then'](respondWithFilteredResult(_0x5460a5,_0x29f900))['catch'](handleError(_0x5460a5,null));};exports[_0x279c('0xdd')]=function(_0xe84e77,_0x493018){var _0x36370f={'raw':!![],'where':{}};var _0x11dcbc={};var _0x141a6e={'count':0x0,'rows':[]};return db[_0x279c('0x30')]['findOne']({'where':{'id':_0xe84e77[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x493018,null))['then'](function(_0x412c5f){if(_0x412c5f){_0x11dcbc[_0x279c('0xd0')]=_[_0x279c('0xcd')](db[_0x279c('0xde')][_0x279c('0x31')]);_0x11dcbc[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0xe84e77[_0x279c('0x3a')]);_0x11dcbc[_0x279c('0xce')]=_['intersection'](_0x11dcbc['model'],_0x11dcbc['query']);_0x36370f['attributes']=_[_0x279c('0xcf')](_0x11dcbc[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0xe84e77[_0x279c('0x3a')][_0x279c('0xd1')]));_0x36370f[_0x279c('0x40')]=_0x36370f['attributes'][_0x279c('0x45')]?_0x36370f[_0x279c('0x40')]:_0x11dcbc[_0x279c('0xd0')];if(!_0xe84e77['query'][_0x279c('0xc6')](_0x279c('0xd6'))){_0x36370f[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0xe84e77[_0x279c('0x3a')][_0x279c('0x1b')]);_0x36370f['offset']=qs['offset'](_0xe84e77[_0x279c('0x3a')][_0x279c('0x19')]);}_0x36370f[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0xe84e77[_0x279c('0x3a')][_0x279c('0xd3')]);_0x36370f['where']=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0xe84e77[_0x279c('0x3a')],_0x11dcbc[_0x279c('0xce')]));_0x36370f[_0x279c('0x39')][_0x279c('0xdc')]=_0x412c5f['id'];if(_0xe84e77['query'][_0x279c('0x29')]){_0x36370f[_0x279c('0x39')]=_['merge'](_0x36370f[_0x279c('0x39')],{'$or':_['map'](_0x36370f[_0x279c('0x40')],function(_0x137f02){var _0x213a6e={};_0x213a6e[_0x137f02]={'$like':'%'+_0xe84e77['query'][_0x279c('0x29')]+'%'};return _0x213a6e;})});}_0x36370f=_[_0x279c('0x4b')]({},_0x36370f,_0xe84e77[_0x279c('0x4c')]);return db[_0x279c('0xde')]['count']({'where':_0x36370f['where']})[_0x279c('0x1f')](function(_0x45017c){_0x141a6e['count']=_0x45017c;if(_0xe84e77[_0x279c('0x3a')][_0x279c('0x3b')]){_0x36370f[_0x279c('0x3c')]=[{'all':!![]}];}return db[_0x279c('0xde')]['findAll'](_0x36370f);})[_0x279c('0x1f')](function(_0x6b849f){_0x141a6e['rows']=_0x6b849f;return _0x141a6e;});}})[_0x279c('0x1f')](respondWithFilteredResult(_0x493018,_0x36370f))['catch'](handleError(_0x493018,null));};exports[_0x279c('0xdf')]=function(_0x54ba59,_0x495e4d){var _0x1a8c6b={};var _0x5de5d0={};var _0x5d0f07;var _0x11f065;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x54ba59[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x495e4d,null))[_0x279c('0x1f')](function(_0x125984){if(_0x125984){_0x5d0f07=_0x125984;_0x5de5d0['model']=_[_0x279c('0xcd')](db[_0x279c('0xe0')]['rawAttributes']);_0x5de5d0['query']=_[_0x279c('0xcd')](_0x54ba59[_0x279c('0x3a')]);_0x5de5d0[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x5de5d0[_0x279c('0xd0')],_0x5de5d0[_0x279c('0x3a')]);_0x1a8c6b[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x5de5d0['model'],qs['fields'](_0x54ba59['query']['fields']));_0x1a8c6b['attributes']=_0x1a8c6b[_0x279c('0x40')][_0x279c('0x45')]?_0x1a8c6b[_0x279c('0x40')]:_0x5de5d0[_0x279c('0xd0')];_0x1a8c6b['order']=qs[_0x279c('0xd3')](_0x54ba59[_0x279c('0x3a')][_0x279c('0xd3')]);_0x1a8c6b[_0x279c('0x39')]=qs['filters'](_[_0x279c('0xd8')](_0x54ba59['query'],_0x5de5d0[_0x279c('0xce')]));if(_0x54ba59[_0x279c('0x3a')][_0x279c('0x29')]){_0x1a8c6b[_0x279c('0x39')]=_[_0x279c('0x4b')](_0x1a8c6b[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x1a8c6b[_0x279c('0x40')],function(_0xa2bc42){var _0x4079ac={};_0x4079ac[_0xa2bc42]={'$like':'%'+_0x54ba59[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x4079ac;})});}_0x1a8c6b=_[_0x279c('0x4b')]({},_0x1a8c6b,_0x54ba59[_0x279c('0x4c')]);return _0x5d0f07[_0x279c('0xdf')](_0x1a8c6b);}})[_0x279c('0x1f')](function(_0x4df2f4){if(_0x4df2f4){_0x11f065=_0x4df2f4[_0x279c('0x45')];if(!_0x54ba59['query'][_0x279c('0xc6')](_0x279c('0xd6'))){_0x1a8c6b[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0x54ba59['query']['limit']);_0x1a8c6b['offset']=qs['offset'](_0x54ba59[_0x279c('0x3a')][_0x279c('0x19')]);}return _0x5d0f07[_0x279c('0xdf')](_0x1a8c6b);}})[_0x279c('0x1f')](function(_0x33677a){if(_0x33677a){return _0x33677a?{'count':_0x11f065,'rows':_0x33677a}:null;}})[_0x279c('0x1f')](respondWithResult(_0x495e4d,null))[_0x279c('0x52')](handleError(_0x495e4d,null));};exports['getOpenchannelInteractions']=function(_0x4b5327,_0x929d33){var _0x493d26={};var _0x317ee7={};var _0x94e00d;var _0x5c2c64;return db[_0x279c('0x30')]['findOne']({'where':{'id':_0x4b5327[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x929d33,null))[_0x279c('0x1f')](function(_0x57f6cd){if(_0x57f6cd){_0x94e00d=_0x57f6cd;_0x317ee7[_0x279c('0xd0')]=_[_0x279c('0xcd')](db[_0x279c('0xe1')][_0x279c('0x31')]);_0x317ee7['query']=_[_0x279c('0xcd')](_0x4b5327[_0x279c('0x3a')]);_0x317ee7[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x317ee7[_0x279c('0xd0')],_0x317ee7[_0x279c('0x3a')]);_0x493d26[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x317ee7[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x4b5327[_0x279c('0x3a')][_0x279c('0xd1')]));_0x493d26[_0x279c('0x40')]=_0x493d26[_0x279c('0x40')][_0x279c('0x45')]?_0x493d26[_0x279c('0x40')]:_0x317ee7[_0x279c('0xd0')];_0x493d26[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0x4b5327[_0x279c('0x3a')][_0x279c('0xd3')]);_0x493d26[_0x279c('0x39')]=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0x4b5327[_0x279c('0x3a')],_0x317ee7[_0x279c('0xce')]));if(_0x4b5327[_0x279c('0x3a')][_0x279c('0x29')]){_0x493d26[_0x279c('0x39')]=_['merge'](_0x493d26['where'],{'$or':_['map'](_0x493d26[_0x279c('0x40')],function(_0x5c90ef){var _0x5b6a73={};_0x5b6a73[_0x5c90ef]={'$like':'%'+_0x4b5327[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x5b6a73;})});}_0x493d26=_[_0x279c('0x4b')]({},_0x493d26,_0x4b5327[_0x279c('0x4c')]);return _0x94e00d[_0x279c('0xe2')](_0x493d26);}})[_0x279c('0x1f')](function(_0x5992f1){if(_0x5992f1){_0x5c2c64=_0x5992f1[_0x279c('0x45')];if(!_0x4b5327['query']['hasOwnProperty']('nolimit')){_0x493d26[_0x279c('0x1b')]=qs['limit'](_0x4b5327[_0x279c('0x3a')]['limit']);_0x493d26[_0x279c('0x19')]=qs['offset'](_0x4b5327[_0x279c('0x3a')][_0x279c('0x19')]);}return _0x94e00d[_0x279c('0xe2')](_0x493d26);}})[_0x279c('0x1f')](function(_0x3fe744){if(_0x3fe744){return _0x3fe744?{'count':_0x5c2c64,'rows':_0x3fe744}:null;}})[_0x279c('0x1f')](respondWithResult(_0x929d33,null))['catch'](handleError(_0x929d33,null));};exports[_0x279c('0xe3')]=function(_0x1c7e4c,_0x4f5421){var _0x186b79={'raw':!![],'where':{}};var _0x46c081={};var _0x5f32d4={'count':0x0,'rows':[]};return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x1c7e4c[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x4f5421,null))[_0x279c('0x1f')](function(_0x395cb8){if(_0x395cb8){_0x46c081[_0x279c('0xd0')]=_[_0x279c('0xcd')](db[_0x279c('0xe4')][_0x279c('0x31')]);_0x46c081['query']=_[_0x279c('0xcd')](_0x1c7e4c['query']);_0x46c081[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x46c081[_0x279c('0xd0')],_0x46c081[_0x279c('0x3a')]);_0x186b79[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x46c081[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x1c7e4c[_0x279c('0x3a')][_0x279c('0xd1')]));_0x186b79[_0x279c('0x40')]=_0x186b79[_0x279c('0x40')][_0x279c('0x45')]?_0x186b79[_0x279c('0x40')]:_0x46c081[_0x279c('0xd0')];if(!_0x1c7e4c['query']['hasOwnProperty'](_0x279c('0xd6'))){_0x186b79['limit']=qs[_0x279c('0x1b')](_0x1c7e4c[_0x279c('0x3a')][_0x279c('0x1b')]);_0x186b79[_0x279c('0x19')]=qs[_0x279c('0x19')](_0x1c7e4c[_0x279c('0x3a')]['offset']);}_0x186b79['order']=qs['sort'](_0x1c7e4c[_0x279c('0x3a')]['sort']);_0x186b79[_0x279c('0x39')]=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0x1c7e4c[_0x279c('0x3a')],_0x46c081['filters']));_0x186b79[_0x279c('0x39')][_0x279c('0xdc')]=_0x395cb8['id'];if(_0x1c7e4c['query']['filter']){_0x186b79[_0x279c('0x39')]=_['merge'](_0x186b79[_0x279c('0x39')],{'$or':_['map'](_0x186b79['attributes'],function(_0x58efda){var _0x23b11e={};_0x23b11e[_0x58efda]={'$like':'%'+_0x1c7e4c[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x23b11e;})});}_0x186b79=_['merge']({},_0x186b79,_0x1c7e4c[_0x279c('0x4c')]);return db[_0x279c('0xe4')][_0x279c('0x1c')]({'where':_0x186b79[_0x279c('0x39')]})[_0x279c('0x1f')](function(_0x15511c){_0x5f32d4[_0x279c('0x1c')]=_0x15511c;if(_0x1c7e4c[_0x279c('0x3a')]['includeAll']){_0x186b79[_0x279c('0x3c')]=[{'all':!![]}];}return db[_0x279c('0xe4')][_0x279c('0x42')](_0x186b79);})['then'](function(_0x4107e1){_0x5f32d4['rows']=_0x4107e1;return _0x5f32d4;});}})[_0x279c('0x1f')](respondWithFilteredResult(_0x4f5421,_0x186b79))['catch'](handleError(_0x4f5421,null));};exports[_0x279c('0xe5')]=function(_0xaed512,_0x5bdad8){var _0x462fce={};var _0x4e6714={};var _0x38b826;var _0x57f4a0;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0xaed512[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x5bdad8,null))[_0x279c('0x1f')](function(_0x219138){if(_0x219138){_0x38b826=_0x219138;_0x4e6714['model']=_[_0x279c('0xcd')](db['SmsInteraction'][_0x279c('0x31')]);_0x4e6714[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0xaed512[_0x279c('0x3a')]);_0x4e6714[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x4e6714[_0x279c('0xd0')],_0x4e6714[_0x279c('0x3a')]);_0x462fce[_0x279c('0x40')]=_['intersection'](_0x4e6714[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0xaed512[_0x279c('0x3a')][_0x279c('0xd1')]));_0x462fce[_0x279c('0x40')]=_0x462fce[_0x279c('0x40')][_0x279c('0x45')]?_0x462fce[_0x279c('0x40')]:_0x4e6714[_0x279c('0xd0')];_0x462fce[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0xaed512[_0x279c('0x3a')][_0x279c('0xd3')]);_0x462fce[_0x279c('0x39')]=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0xaed512[_0x279c('0x3a')],_0x4e6714[_0x279c('0xce')]));if(_0xaed512[_0x279c('0x3a')][_0x279c('0x29')]){_0x462fce['where']=_['merge'](_0x462fce[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x462fce[_0x279c('0x40')],function(_0x1d55c1){var _0x4d7b22={};_0x4d7b22[_0x1d55c1]={'$like':'%'+_0xaed512['query'][_0x279c('0x29')]+'%'};return _0x4d7b22;})});}_0x462fce=_[_0x279c('0x4b')]({},_0x462fce,_0xaed512[_0x279c('0x4c')]);return _0x38b826[_0x279c('0xe5')](_0x462fce);}})[_0x279c('0x1f')](function(_0x3a2912){if(_0x3a2912){_0x57f4a0=_0x3a2912[_0x279c('0x45')];if(!_0xaed512[_0x279c('0x3a')][_0x279c('0xc6')](_0x279c('0xd6'))){_0x462fce[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0xaed512[_0x279c('0x3a')][_0x279c('0x1b')]);_0x462fce[_0x279c('0x19')]=qs[_0x279c('0x19')](_0xaed512[_0x279c('0x3a')][_0x279c('0x19')]);}return _0x38b826[_0x279c('0xe5')](_0x462fce);}})['then'](function(_0x5b43d7){if(_0x5b43d7){return _0x5b43d7?{'count':_0x57f4a0,'rows':_0x5b43d7}:null;}})[_0x279c('0x1f')](respondWithResult(_0x5bdad8,null))[_0x279c('0x52')](handleError(_0x5bdad8,null));};exports['getFaxInteractions']=function(_0x1ea2ed,_0x4512f8){var _0x2d445c={};var _0x745451={};var _0x4fed9a;var _0x4969f1;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x1ea2ed[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x4512f8,null))['then'](function(_0x37ad59){if(_0x37ad59){_0x4fed9a=_0x37ad59;_0x745451[_0x279c('0xd0')]=_['keys'](db[_0x279c('0xe6')][_0x279c('0x31')]);_0x745451['query']=_[_0x279c('0xcd')](_0x1ea2ed[_0x279c('0x3a')]);_0x745451[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x745451['model'],_0x745451[_0x279c('0x3a')]);_0x2d445c[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x745451[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x1ea2ed[_0x279c('0x3a')][_0x279c('0xd1')]));_0x2d445c[_0x279c('0x40')]=_0x2d445c['attributes'][_0x279c('0x45')]?_0x2d445c[_0x279c('0x40')]:_0x745451[_0x279c('0xd0')];_0x2d445c['order']=qs[_0x279c('0xd3')](_0x1ea2ed[_0x279c('0x3a')][_0x279c('0xd3')]);_0x2d445c[_0x279c('0x39')]=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0x1ea2ed[_0x279c('0x3a')],_0x745451['filters']));if(_0x1ea2ed[_0x279c('0x3a')][_0x279c('0x29')]){_0x2d445c[_0x279c('0x39')]=_[_0x279c('0x4b')](_0x2d445c[_0x279c('0x39')],{'$or':_['map'](_0x2d445c['attributes'],function(_0x57d510){var _0x5e7b4a={};_0x5e7b4a[_0x57d510]={'$like':'%'+_0x1ea2ed['query'][_0x279c('0x29')]+'%'};return _0x5e7b4a;})});}_0x2d445c=_[_0x279c('0x4b')]({},_0x2d445c,_0x1ea2ed[_0x279c('0x4c')]);return _0x4fed9a['getFaxInteractions'](_0x2d445c);}})[_0x279c('0x1f')](function(_0x48a450){if(_0x48a450){_0x4969f1=_0x48a450[_0x279c('0x45')];if(!_0x1ea2ed[_0x279c('0x3a')][_0x279c('0xc6')](_0x279c('0xd6'))){_0x2d445c[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0x1ea2ed[_0x279c('0x3a')][_0x279c('0x1b')]);_0x2d445c[_0x279c('0x19')]=qs[_0x279c('0x19')](_0x1ea2ed[_0x279c('0x3a')][_0x279c('0x19')]);}return _0x4fed9a[_0x279c('0xe7')](_0x2d445c);}})['then'](function(_0x5e25e8){if(_0x5e25e8){return _0x5e25e8?{'count':_0x4969f1,'rows':_0x5e25e8}:null;}})[_0x279c('0x1f')](respondWithResult(_0x4512f8,null))[_0x279c('0x52')](handleError(_0x4512f8,null));};exports[_0x279c('0xe8')]=function(_0x2502fe,_0x4be30e){var _0x370d92={};var _0x4803d3={};var _0xbb3e0d;var _0x2ddd35;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x2502fe['params']['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x4be30e,null))[_0x279c('0x1f')](function(_0x20d9e5){if(_0x20d9e5){_0xbb3e0d=_0x20d9e5;_0x4803d3[_0x279c('0xd0')]=_[_0x279c('0xcd')](db[_0x279c('0xe9')]['rawAttributes']);_0x4803d3[_0x279c('0x3a')]=_['keys'](_0x2502fe[_0x279c('0x3a')]);_0x4803d3[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x4803d3['model'],_0x4803d3[_0x279c('0x3a')]);_0x370d92[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x4803d3[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x2502fe['query']['fields']));_0x370d92[_0x279c('0x40')]=_0x370d92[_0x279c('0x40')][_0x279c('0x45')]?_0x370d92[_0x279c('0x40')]:_0x4803d3[_0x279c('0xd0')];_0x370d92[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0x2502fe[_0x279c('0x3a')][_0x279c('0xd3')]);_0x370d92['where']=qs[_0x279c('0xce')](_[_0x279c('0xd8')](_0x2502fe['query'],_0x4803d3[_0x279c('0xce')]));if(_0x2502fe[_0x279c('0x3a')][_0x279c('0x29')]){_0x370d92['where']=_['merge'](_0x370d92[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x370d92[_0x279c('0x40')],function(_0x3ba5ed){var _0x3405b9={};_0x3405b9[_0x3ba5ed]={'$like':'%'+_0x2502fe[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x3405b9;})});}_0x370d92=_['merge']({},_0x370d92,_0x2502fe['options']);return _0xbb3e0d[_0x279c('0xe8')](_0x370d92);}})[_0x279c('0x1f')](function(_0x1fdd97){if(_0x1fdd97){_0x2ddd35=_0x1fdd97[_0x279c('0x45')];if(!_0x2502fe['query']['hasOwnProperty'](_0x279c('0xd6'))){_0x370d92[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0x2502fe['query']['limit']);_0x370d92[_0x279c('0x19')]=qs[_0x279c('0x19')](_0x2502fe['query'][_0x279c('0x19')]);}return _0xbb3e0d['getWhatsappInteractions'](_0x370d92);}})[_0x279c('0x1f')](function(_0x4834dd){if(_0x4834dd){return _0x4834dd?{'count':_0x2ddd35,'rows':_0x4834dd}:null;}})[_0x279c('0x1f')](respondWithResult(_0x4be30e,null))[_0x279c('0x52')](handleError(_0x4be30e,null));};exports[_0x279c('0xea')]=function(_0x11d824,_0x3666d6,_0x26d4a8){var _0x4f1cdc;var _0x3b0680;var _0x231879;var _0x4fbe5f=!_[_0x279c('0x5e')](_0x11d824[_0x279c('0x4a')]['id'])?_0x11d824[_0x279c('0x4a')]['id']:!_['isNil'](_0x11d824[_0x279c('0x26')]['id'])?_0x11d824[_0x279c('0x26')]['id']:null;return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x4fbe5f,'role':{'$or':[_0x279c('0x24'),_0x279c('0x26'),'agent']}},'attributes':['id','name','phone',_0x279c('0xeb'),_0x279c('0x20'),_0x279c('0x57'),_0x279c('0x98')]})[_0x279c('0x1f')](function(_0x20c62b){if(_0x20c62b){if(_0x20c62b['role']===_0x279c('0x66')){_0x4f1cdc=_0x20c62b;if(_0x11d824['body'][_0x279c('0x99')]){_0x231879=util[_0x279c('0xa5')](_0x279c('0xec'),_0x4f1cdc[_0x11d824[_0x279c('0x53')][_0x279c('0x99')]]);}else if(_0x11d824['body'][_0x279c('0xed')]){_0x231879=util[_0x279c('0xa5')]('SIP/%s',_0x11d824['body'][_0x279c('0xed')]);}else{_0x231879=util[_0x279c('0xa5')]('SIP/%s',_0x4f1cdc[_0x279c('0x2e')]);}socket['to'](util[_0x279c('0xa5')](_0x279c('0xee'),_0x4f1cdc[_0x279c('0x2e')]))[_0x279c('0x21')](_0x279c('0xef'),{'user':{'id':_0x4f1cdc['id'],'name':_0x4f1cdc[_0x279c('0x2e')]},'ip':_0x11d824[_0x279c('0xf0')][_0x279c('0xf1')]||_0x11d824['connection'][_0x279c('0xf2')]||_0x11d824[_0x279c('0xf3')][_0x279c('0xf2')]||_0x11d824[_0x279c('0xf4')]['socket'][_0x279c('0xf2')]});return db['UserVoiceQueueRt'][_0x279c('0x22')]({'where':{'membername':_0x4f1cdc[_0x279c('0x2e')]},'individualHooks':!![]});}}else{throw new db[(_0x279c('0x8b'))][(_0x279c('0x88'))](_0x279c('0xf5'));}})[_0x279c('0x1f')](function(){if(_0x4f1cdc){return _0x4f1cdc[_0x279c('0xf6')]({'raw':!![]});}})[_0x279c('0x1f')](function(_0x2e9697){if(_0x4f1cdc){if(_0x2e9697){_0x3b0680=_0x2e9697;if(_0x3b0680[_0x279c('0x45')]){var _0x395eff=_0x3b0680[_0x279c('0x32')](function(_0x4ff008){var _0x5c1ae6={'membername':_0x4f1cdc[_0x279c('0x2e')],'UserId':_0x4f1cdc['id'],'queue_name':_0x4ff008[_0x279c('0x2e')],'VoiceQueueId':_0x4ff008['id'],'interface':_0x231879,'paused':_0x4f1cdc[_0x279c('0x98')]||![],'penalty':_0x4ff008[_0x279c('0xf7')]||0x0};return db[_0x279c('0xa8')][_0x279c('0xf8')](_0x5c1ae6);});return Promise[_0x279c('0x48')](_0x395eff);}}}})[_0x279c('0x1f')](function(){if(_0x4f1cdc){return db[_0x279c('0xf9')]['findAll']({'where':{'membername':_0x4f1cdc[_0x279c('0x2e')],'exitAt':null}});}})[_0x279c('0x1f')](function(_0x2bbb41){if(_0x4f1cdc){var _0x34cf16=[];_0x2bbb41[_0x279c('0xfa')](function(_0x573000){_0x34cf16[_0x279c('0x41')](_0x573000[_0x279c('0x1e')]({'exitAt':moment()[_0x279c('0xa5')](_0x279c('0xfb'))}));});return Promise[_0x279c('0x48')](_0x34cf16);}})[_0x279c('0x1f')](function(){if(_0x4f1cdc){var _0x3a613c=[];var _0x2ef364=[];var _0x4daa9b=utils[_0x279c('0xfc')]();var _0x59e9bf={'membername':_0x4f1cdc['name'],'interface':_0x231879,'enterAt':moment()[_0x279c('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4f1cdc['role'],'internal':_0x4f1cdc[_0x279c('0x57')]};_0x4daa9b[_0x279c('0xfa')](function(_0x2d29db){_0x3a613c[_0x279c('0x41')](_[_0x279c('0x4b')]({'channel':_0x2d29db,'type':'LOGIN','data1':_0x11d824['body'][_0x279c('0xfd')],'data2':_0x231879},_0x59e9bf));if(_0x4f1cdc[_0x279c('0x98')]){_0x2ef364[_0x279c('0x41')](_[_0x279c('0x4b')]({'channel':_0x2d29db,'type':'PAUSE','data1':_0x279c('0xfe')},_0x59e9bf));}});return db['MemberReport'][_0x279c('0x7f')](_0x3a613c[_0x279c('0xc4')](_0x2ef364),{'individualHooks':!![]});}})[_0x279c('0x1f')](function(){if(_0x4f1cdc){return _0x4f1cdc['update']({'online':!![],'lastLoginAt':moment()['format'](_0x279c('0xfb')),'voicePause':_0x4f1cdc[_0x279c('0x98')]||![],'mailPause':_0x4f1cdc[_0x279c('0x98')]||![],'chatPause':_0x4f1cdc[_0x279c('0x98')]||![],'faxPause':_0x4f1cdc[_0x279c('0x98')]||![],'smsPause':_0x4f1cdc[_0x279c('0x98')]||![],'openchannelPause':_0x4f1cdc[_0x279c('0x98')]||![],'whatsappPause':_0x4f1cdc[_0x279c('0x98')]||![],'pauseType':_0x4f1cdc[_0x279c('0x98')]?_0x279c('0xfe'):null,'interface':_0x231879,'lastPauseAt':moment()['format'](_0x279c('0xfb'))});}})[_0x279c('0x1f')](function(_0x23e8db){if(_0x11d824[_0x279c('0xff')]){return _0x26d4a8();}else{return Promise[_0x279c('0x100')](_0x23e8db)[_0x279c('0x1f')](respondWithResult(_0x3666d6,null));}})[_0x279c('0x52')](handleError(_0x3666d6,null));};exports['logout']=function(_0x45ea9d,_0x56967d){var _0x5d101e;return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x45ea9d[_0x279c('0x4a')]['id'],'role':'agent'},'attributes':['id','name',_0x279c('0x20')]})[_0x279c('0x1f')](handleEntityNotFound(_0x56967d,null))[_0x279c('0x1f')](function(_0x173a0a){if(_0x173a0a){_0x5d101e=_0x173a0a;return db[_0x279c('0xa8')][_0x279c('0x22')]({'where':{'membername':_0x5d101e[_0x279c('0x2e')]},'individualHooks':!![]});}})[_0x279c('0x1f')](function(){return db[_0x279c('0xf9')][_0x279c('0x42')]({'where':{'membername':_0x5d101e[_0x279c('0x2e')],'exitAt':null}});})[_0x279c('0x1f')](function(_0x5826e3){var _0x369dc5=[];_0x5826e3[_0x279c('0xfa')](function(_0x1782dd){_0x369dc5[_0x279c('0x41')](_0x1782dd[_0x279c('0x1e')]({'exitAt':moment()['format'](_0x279c('0xfb'))}));});return Promise['all'](_0x369dc5);})[_0x279c('0x1f')](function(){return _0x5d101e[_0x279c('0x1e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x279c('0x1f')](respondWithResult(_0x56967d,null))[_0x279c('0x52')](handleError(_0x56967d,null));};exports[_0x279c('0x101')]=function(_0x419cbf,_0x1e1534){var _0x40923e;return db['UserVoiceQueueRt'][_0x279c('0x1e')]({'paused':0x1},{'where':{'UserId':_0x419cbf[_0x279c('0x4a')]['id']},'individualHooks':!![]})[_0x279c('0x1f')](function(){return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x419cbf['params']['id'],'role':_0x279c('0x66')},'attributes':['id',_0x279c('0x2e'),'role',_0x279c('0x57'),_0x279c('0x99'),_0x279c('0x97')]});})['then'](handleEntityNotFound(_0x1e1534,null))[_0x279c('0x1f')](function(_0x1471ea){if(_0x1471ea){_0x40923e=_0x1471ea;return db[_0x279c('0xf9')][_0x279c('0x42')]({'where':{'membername':_0x40923e[_0x279c('0x2e')],'type':_0x279c('0x102'),'exitAt':null}});}})[_0x279c('0x1f')](function(_0x17dde1){if(_0x17dde1[_0x279c('0x45')]){var _0x484c7c=moment()[_0x279c('0xa5')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x336e84=0x0,_0x1e4986=_0x17dde1[_0x279c('0x45')];_0x336e84<_0x1e4986;_0x336e84++){_0x17dde1[_0x336e84][_0x279c('0x103')]({'exitAt':_0x484c7c});}}})[_0x279c('0x1f')](function(){var _0x40c939=[];var _0x415e04=utils['getChannels']();_0x415e04[_0x279c('0xfa')](function(_0x253867){_0x40c939[_0x279c('0x41')]({'channel':_0x253867,'membername':_0x40923e[_0x279c('0x2e')],'interface':_[_0x279c('0x5e')](_0x40923e[_0x279c('0x99')])?util[_0x279c('0xa5')](_0x279c('0xa6'),_0x40923e['name']):_0x40923e[_0x279c('0x99')],'type':'PAUSE','enterAt':moment()['format'](_0x279c('0xfb')),'data1':_0x419cbf[_0x279c('0x53')][_0x279c('0x104')]||'DEFAULT\x20PAUSE','role':_0x40923e[_0x279c('0x20')],'internal':_0x40923e[_0x279c('0x57')]});});return db[_0x279c('0xf9')][_0x279c('0x7f')](_0x40c939,{'individualHooks':!![]});})[_0x279c('0x1f')](function(){return _0x40923e[_0x279c('0x1e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x419cbf[_0x279c('0x53')][_0x279c('0x104')]||_0x279c('0x105'),'lastPauseAt':moment()['format'](_0x279c('0xfb'))});})['then'](respondWithResult(_0x1e1534,null))['catch'](handleError(_0x1e1534,null));};exports[_0x279c('0x106')]=function(_0x1a9e82,_0x3714db){if(_0x1a9e82['body'][_0x279c('0x96')]&&!utils[_0x279c('0x9a')](_0x1a9e82[_0x279c('0x53')][_0x279c('0x96')])){throw new APIBadRequestError(util[_0x279c('0xa5')](_0x279c('0x107'),_0x1a9e82['body'][_0x279c('0x96')]));}return db[_0x279c('0x30')][_0x279c('0x2d')]({'where':{'id':_0x1a9e82[_0x279c('0x4a')]['id']},'attributes':['id',_0x279c('0x2e'),_0x279c('0x20'),_0x279c('0x57'),_0x279c('0x99'),'online',_0x279c('0xa7'),_0x279c('0x108'),_0x279c('0x109'),_0x279c('0x10a'),_0x279c('0x10b'),_0x279c('0x10c'),_0x279c('0x10d'),'pauseType',_0x279c('0x10e')]})[_0x279c('0x1f')](function(_0x27f29b){if(!_0x27f29b){throw new APINotFoundError(util[_0x279c('0xa5')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1a9e82[_0x279c('0x4a')]['id']));}return _0x27f29b[_0x279c('0x106')](_0x1a9e82[_0x279c('0x53')][_0x279c('0x96')]);})['then'](respondWithResult(_0x3714db,null))['catch'](APIHandleError(_0x3714db));};exports[_0x279c('0x10f')]=function(_0x494823,_0x3ccf79){var _0x1df35e={};var _0x10b1e5={};var _0x3b4e90;var _0x2d284b;return db[_0x279c('0x30')]['findOne']({'where':{'id':_0x494823[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x3ccf79,null))[_0x279c('0x1f')](function(_0x3d1716){if(_0x3d1716){_0x3b4e90=_0x3d1716;_0x10b1e5[_0x279c('0xd0')]=_['keys'](db['Team'][_0x279c('0x31')]);_0x10b1e5[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0x494823[_0x279c('0x3a')]);_0x10b1e5['filters']=_[_0x279c('0xcf')](_0x10b1e5[_0x279c('0xd0')],_0x10b1e5[_0x279c('0x3a')]);_0x1df35e[_0x279c('0x40')]=_['intersection'](_0x10b1e5[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x494823[_0x279c('0x3a')][_0x279c('0xd1')]));_0x1df35e['attributes']=_0x1df35e[_0x279c('0x40')]['length']?_0x1df35e[_0x279c('0x40')]:_0x10b1e5[_0x279c('0xd0')];_0x1df35e[_0x279c('0xd2')]=qs['sort'](_0x494823[_0x279c('0x3a')][_0x279c('0xd3')]);_0x1df35e[_0x279c('0x39')]=qs['filters'](_[_0x279c('0xd8')](_0x494823['query'],_0x10b1e5[_0x279c('0xce')]));if(_0x494823[_0x279c('0x3a')][_0x279c('0x29')]){_0x1df35e['where']=_[_0x279c('0x4b')](_0x1df35e[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x1df35e[_0x279c('0x40')],function(_0x56e923){var _0x464856={};_0x464856[_0x56e923]={'$like':'%'+_0x494823['query']['filter']+'%'};return _0x464856;})});}_0x1df35e=_['merge']({},_0x1df35e,_0x494823[_0x279c('0x4c')]);return _0x3b4e90[_0x279c('0x10f')](_0x1df35e);}})[_0x279c('0x1f')](function(_0x5999cd){if(_0x5999cd){_0x2d284b=_0x5999cd[_0x279c('0x45')];if(!_0x494823[_0x279c('0x3a')][_0x279c('0xc6')]('nolimit')){_0x1df35e[_0x279c('0x1b')]=qs[_0x279c('0x1b')](_0x494823[_0x279c('0x3a')][_0x279c('0x1b')]);_0x1df35e[_0x279c('0x19')]=qs[_0x279c('0x19')](_0x494823[_0x279c('0x3a')][_0x279c('0x19')]);}return _0x3b4e90[_0x279c('0x10f')](_0x1df35e);}})[_0x279c('0x1f')](function(_0x5804c3){if(_0x5804c3){return _0x5804c3?{'count':_0x2d284b,'rows':_0x5804c3}:null;}})[_0x279c('0x1f')](respondWithResult(_0x3ccf79,null))[_0x279c('0x52')](handleError(_0x3ccf79,null));};exports[_0x279c('0x110')]=function(_0x26e47f,_0x244c6c){var _0x2dba00=_0x26e47f[_0x279c('0x4a')]['id'];var _0x3e72c9=_0x26e47f[_0x279c('0x53')]?_0x26e47f[_0x279c('0x53')]['ids']:null;var _0x25ed48=[];return Promise[_0x279c('0x100')]()[_0x279c('0x1f')](function(){if(!_0x3e72c9)throw new APIBadRequestError(_0x279c('0x111'));})[_0x279c('0x1f')](function(){return db['User'][_0x279c('0x8f')]({'where':{'id':_0x2dba00}});})['then'](function(_0x2d5aa1){if(!_0x2d5aa1)throw new APINotFoundError(util[_0x279c('0xa5')](_0x279c('0x112'),_0x26e47f[_0x279c('0x4a')]['id']));return db['sequelize'][_0x279c('0x113')](function(_0x1821f1){return _0x2d5aa1[_0x279c('0x110')](_0x3e72c9,{'transaction':_0x1821f1})[_0x279c('0x1f')](function(){return db['Team'][_0x279c('0x42')]({'where':{'id':{'$in':_0x3e72c9}}});})['then'](function(_0x49092a){var _0x201ccf=_[_0x279c('0x32')](_0x49092a,function(_0x4a08e2){return _0x4a08e2[_0x279c('0x114')]();});return Promise[_0x279c('0x48')](_0x201ccf);})['then'](function(_0x26dfe2){_0x25ed48=_[_0x279c('0x115')](_0x26dfe2);var _0x32e1da=_['map'](_0x25ed48,function(_0x9cf857){return _0x9cf857[_0x279c('0x116')](_0x2d5aa1['id'],{'transaction':_0x1821f1});});return Promise[_0x279c('0x48')](_0x32e1da);})[_0x279c('0x1f')](function(){if(!_0x2d5aa1[_0x279c('0x97')])return;var _0x48c55e=_[_0x279c('0x29')](_0x25ed48,function(_0x2e4062){return _0x2e4062[_0x279c('0x117')](_0x279c('0x96'))===_0x279c('0x118');});var _0x2279db=_[_0x279c('0x32')](_0x48c55e,function(_0x5e8ff4){return db['UserVoiceQueueRt'][_0x279c('0xf8')]({'membername':_0x2d5aa1[_0x279c('0x2e')],'UserId':_0x2d5aa1['id'],'queue_name':_0x5e8ff4[_0x279c('0x2e')],'VoiceQueueId':_0x5e8ff4['id'],'interface':_[_0x279c('0x5e')](_0x2d5aa1[_0x279c('0x99')])?util[_0x279c('0xa5')]('SIP/%s',_0x2d5aa1[_0x279c('0x2e')]):_0x2d5aa1[_0x279c('0x99')],'paused':_0x2d5aa1['voicePause']||![],'penalty':_0x2d5aa1['penalty']},{'transaction':_0x1821f1});});return Promise[_0x279c('0x48')](_0x2279db);})['then'](function(){return db[_0x279c('0x119')][_0x279c('0x42')]({'where':{'teamId':{'$in':_0x3e72c9}}});})[_0x279c('0x1f')](function(_0x517bb0){var _0x2ae3c4=_[_0x279c('0x32')](_0x517bb0,function(_0x13d410){return db[_0x279c('0x11a')]['create']({'UserId':_0x2d5aa1['id'],'VoicePrefixId':_0x13d410[_0x279c('0x11b')]},{'transaction':_0x1821f1});});return Promise[_0x279c('0x48')](_0x2ae3c4);});});})[_0x279c('0x1f')](function(){for(var _0x23f04a=0x0;_0x23f04a<_0x25ed48[_0x279c('0x45')];_0x23f04a++){var _0x50db51=_0x25ed48[_0x23f04a]['getDataValue'](_0x279c('0x96'));var _0x22b5fb=_0x50db51+_0x279c('0xa1');socket['emit'](_0x279c('0x26')+_0x50db51+_0x279c('0xa2'),{'UserId':_0x2dba00,['queueField']:_0x25ed48[_0x23f04a]['id']});}})['then'](respondWithStatusCode(_0x244c6c,null))[_0x279c('0x52')](APIHandleError(_0x244c6c));};exports[_0x279c('0x11c')]=function(_0x51de02,_0x1d021a){var _0x529cef=_0x51de02[_0x279c('0x4a')]['id'];var _0x249384=null;if(_0x51de02[_0x279c('0x3a')]['ids']){_0x249384=_[_0x279c('0xac')](_0x51de02['query']['ids'])?_0x51de02[_0x279c('0x3a')][_0x279c('0x56')]:[_0x51de02[_0x279c('0x3a')][_0x279c('0x56')]];}var _0x2858bd=[];return Promise[_0x279c('0x100')]()[_0x279c('0x1f')](function(){if(!_0x249384)throw new APIBadRequestError(_0x279c('0x11d'));})['then'](function(){return db[_0x279c('0x30')]['findOne']({'where':{'id':_0x529cef}});})[_0x279c('0x1f')](function(_0x127cf6){if(!_0x127cf6)throw new APINotFoundError(util[_0x279c('0xa5')](_0x279c('0x112'),_0x51de02[_0x279c('0x4a')]['id']));return db['sequelize']['transaction'](function(_0xa1523c){return _0x127cf6[_0x279c('0x11c')](_0x249384,{'transaction':_0xa1523c})[_0x279c('0x1f')](function(){return db[_0x279c('0x11e')][_0x279c('0x42')]({'where':{'id':{'$in':_0x249384}}});})[_0x279c('0x1f')](function(_0x174d69){var _0x10df28=_['map'](_0x174d69,function(_0x26b4b0){return _0x26b4b0[_0x279c('0x114')]();});return Promise[_0x279c('0x48')](_0x10df28);})[_0x279c('0x1f')](function(_0x39206d){_0x2858bd=_[_0x279c('0x115')](_0x39206d);var _0xe20f1d=_[_0x279c('0x32')](_0x2858bd,function(_0x413b20){return _0x413b20[_0x279c('0x11f')](_0x127cf6['id'],{'transaction':_0xa1523c});});return Promise[_0x279c('0x48')](_0xe20f1d);})[_0x279c('0x1f')](function(){if(!_0x127cf6[_0x279c('0x97')])return;var _0x219629=_[_0x279c('0x29')](_0x2858bd,function(_0x1e6566){return _0x1e6566[_0x279c('0x117')](_0x279c('0x96'))===_0x279c('0x118');});var _0xecdacf=_['map'](_0x219629,function(_0xcf984a){return db[_0x279c('0xa8')][_0x279c('0x22')]({'where':{'VoiceQueueId':_0xcf984a['id'],'UserId':_0x127cf6['id']},'transaction':_0xa1523c});});return Promise[_0x279c('0x48')](_0xecdacf);})[_0x279c('0x1f')](function(){return db[_0x279c('0x119')][_0x279c('0x42')]({'where':{'teamId':{'$in':_0x249384}}});})['then'](function(_0x44c112){var _0x55486d=_[_0x279c('0x32')](_0x44c112,function(_0x23bd02){return db[_0x279c('0x11a')][_0x279c('0x22')]({'where':{'UserId':_0x127cf6['id'],'VoicePrefixId':_0x23bd02[_0x279c('0x11b')]}},{'transaction':_0xa1523c});});return Promise['all'](_0x55486d);});});})[_0x279c('0x1f')](function(){for(var _0x233477=0x0;_0x233477<_0x2858bd[_0x279c('0x45')];_0x233477++){var _0x11d19e=_0x2858bd[_0x233477][_0x279c('0x117')](_0x279c('0x96'));var _0x4871fd=_0x11d19e+_0x279c('0xa1');socket[_0x279c('0x21')](_0x279c('0x26')+_0x11d19e+_0x279c('0xad'),{'UserId':_0x529cef,['queueField']:_0x2858bd[_0x233477]['id']});}})['then'](respondWithStatusCode(_0x1d021a,null))['catch'](APIHandleError(_0x1d021a));};exports[_0x279c('0x120')]=function(_0x2cba85,_0x276c45){var _0x3898d2={};var _0x3a3627={};var _0x2c3433;var _0x5c2eee;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x2cba85[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x276c45,null))[_0x279c('0x1f')](function(_0x566835){if(_0x566835){_0x2c3433=_0x566835;_0x3a3627['model']=_[_0x279c('0xcd')](db[_0x279c('0xc7')][_0x279c('0x31')]);_0x3a3627[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0x2cba85[_0x279c('0x3a')]);_0x3a3627['filters']=_[_0x279c('0xcf')](_0x3a3627[_0x279c('0xd0')],_0x3a3627[_0x279c('0x3a')]);_0x3898d2[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x3a3627[_0x279c('0xd0')],qs[_0x279c('0xd1')](_0x2cba85[_0x279c('0x3a')]['fields']));_0x3898d2[_0x279c('0x40')]=_0x3898d2[_0x279c('0x40')][_0x279c('0x45')]?_0x3898d2['attributes']:_0x3a3627[_0x279c('0xd0')];_0x3898d2['order']=qs[_0x279c('0xd3')](_0x2cba85[_0x279c('0x3a')][_0x279c('0xd3')]);_0x3898d2[_0x279c('0x39')]=qs['filters'](_[_0x279c('0xd8')](_0x2cba85['query'],_0x3a3627['filters']));if(_0x2cba85[_0x279c('0x3a')][_0x279c('0x29')]){_0x3898d2['where']=_[_0x279c('0x4b')](_0x3898d2[_0x279c('0x39')],{'$or':_[_0x279c('0x32')](_0x3898d2['attributes'],function(_0x683a91){var _0x2c8088={};_0x2c8088[_0x683a91]={'$like':'%'+_0x2cba85[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x2c8088;})});}_0x3898d2=_[_0x279c('0x4b')]({},_0x3898d2,_0x2cba85[_0x279c('0x4c')]);return _0x2c3433['getLists'](_0x3898d2);}})[_0x279c('0x1f')](function(_0x57d3b4){if(_0x57d3b4){_0x5c2eee=_0x57d3b4[_0x279c('0x45')];if(!_0x2cba85['query'][_0x279c('0xc6')](_0x279c('0xd6'))){_0x3898d2['limit']=qs[_0x279c('0x1b')](_0x2cba85[_0x279c('0x3a')][_0x279c('0x1b')]);_0x3898d2[_0x279c('0x19')]=qs[_0x279c('0x19')](_0x2cba85['query'][_0x279c('0x19')]);}return _0x2c3433[_0x279c('0x120')](_0x3898d2);}})[_0x279c('0x1f')](function(_0x2b9340){if(_0x2b9340){return _0x2b9340?{'count':_0x5c2eee,'rows':_0x2b9340}:null;}})['then'](respondWithResult(_0x276c45,null))['catch'](handleError(_0x276c45,null));};exports[_0x279c('0x121')]=function(_0x129ce1,_0x574b42){var _0xaa11d2={};var _0x24472e={};var _0x86f0bc;return db[_0x279c('0x30')][_0x279c('0x8f')]({'where':{'id':_0x129ce1[_0x279c('0x4a')]['id']}})[_0x279c('0x1f')](handleEntityNotFound(_0x574b42,null))['then'](function(_0x26e77f){if(_0x26e77f){_0x86f0bc=_0x26e77f;_0x24472e[_0x279c('0xd0')]=_[_0x279c('0xcd')](db['User']['rawAttributes']);_0x24472e[_0x279c('0x3a')]=_[_0x279c('0xcd')](_0x129ce1[_0x279c('0x3a')]);_0x24472e[_0x279c('0xce')]=_[_0x279c('0xcf')](_0x24472e[_0x279c('0xd0')],_0x24472e['query']);_0xaa11d2[_0x279c('0x40')]=_[_0x279c('0xcf')](_0x24472e['model'],qs[_0x279c('0xd1')](_0x129ce1['query'][_0x279c('0xd1')]));_0xaa11d2['attributes']=_0xaa11d2[_0x279c('0x40')]['length']?_0xaa11d2[_0x279c('0x40')]:_0x24472e[_0x279c('0xd0')];_0xaa11d2[_0x279c('0xd2')]=qs[_0x279c('0xd3')](_0x129ce1[_0x279c('0x3a')][_0x279c('0xd3')]);_0xaa11d2[_0x279c('0x39')]=qs[_0x279c('0xce')](_['pick'](_0x129ce1[_0x279c('0x3a')],_0x24472e[_0x279c('0xce')]));if(_0x129ce1[_0x279c('0x3a')][_0x279c('0x29')]){_0xaa11d2[_0x279c('0x39')]=_[_0x279c('0x4b')](_0xaa11d2[_0x279c('0x39')],{'$or':_['map'](_0xaa11d2[_0x279c('0x40')],function(_0x571775){var _0x189951={};_0x189951[_0x571775]={'$like':'%'+_0x129ce1[_0x279c('0x3a')][_0x279c('0x29')]+'%'};return _0x189951;})});}_0xaa11d2['model']=db[_0x279c('0x30')];_0xaa11d2['as']=_0x279c('0x85');_0xaa11d2=_[_0x279c('0x4b')]({},_0xaa11d2,_0x129ce1[_0x279c('0x4c')]);return _0x86f0bc[_0x279c('0xf6')]({'include':[_0xaa11d2]});}})['then'](function(_0xaa0c05){if(_0xaa0c05){var _0x3301a2={},_0xb9c936=[];for(var _0x13951a=0x0;_0x13951a<_0xaa0c05[_0x279c('0x45')];_0x13951a+=0x1){for(var _0x43a101=0x0,_0x510690;_0x43a101<_0xaa0c05[_0x13951a][_0x279c('0x85')][_0x279c('0x45')];_0x43a101+=0x1){_0x510690=_0xaa0c05[_0x13951a][_0x279c('0x85')][_0x43a101][_0x279c('0x23')]({'plain':!![]});_0x3301a2[_0x510690['id']]=_0x510690;}}_0x3301a2=_['values'](_0x3301a2);for(var _0x419a89=qs[_0x279c('0x19')](_0x129ce1['query'][_0x279c('0x19')]);_0x419a89<_0x3301a2[_0x279c('0x45')]&&_0xb9c936[_0x279c('0x45')]=_0x338d3f['agents']){throw new Error(_0xe09e('0x51'));}})[_0xe09e('0x15')](function(){if(_0x12067a){return db[_0xe09e('0x23')]['destroy']({'where':{'membername':_0x12067a[_0xe09e('0x20')]},'individualHooks':!![]});}})[_0xe09e('0x15')](function(){if(_0x12067a){return _0x12067a['getVoiceQueues']({'raw':!![]});}})[_0xe09e('0x15')](function(_0x4e0a44){if(_0x12067a){if(_0x4e0a44){var _0x4cfcfb=[];_0x44ba09=_0x4e0a44;if(_0x44ba09[_0xe09e('0x27')]){for(var _0x432058=0x0;_0x432058<_0x44ba09['length'];_0x432058++){_0x4cfcfb['push'](db[_0xe09e('0x23')][_0xe09e('0x52')]({'membername':_0x12067a[_0xe09e('0x20')],'UserId':_0x12067a['id'],'queue_name':_0x44ba09[_0x432058]['name'],'VoiceQueueId':_0x44ba09[_0x432058]['id'],'interface':_0x4ec8e2,'paused':_0x12067a['loginInPause']||![],'penalty':_0x44ba09[_0x432058][_0xe09e('0x53')]||0x0}));}return BPromise[_0xe09e('0x47')](_0x4cfcfb);}}}})[_0xe09e('0x15')](function(){if(_0x12067a){return db[_0xe09e('0x25')]['findAll']({'where':{'membername':_0x12067a[_0xe09e('0x20')],'exitAt':null}});}})['then'](function(_0x1ccf8a){if(_0x12067a){if(_0x1ccf8a&&_0x1ccf8a['length']){var _0x181f4e=[];_0x1ccf8a[_0xe09e('0x46')](function(_0x389aeb){_0x181f4e['push'](_0x389aeb[_0xe09e('0x24')]({'exitAt':moment()[_0xe09e('0x28')](_0xe09e('0x2c'))}));});return BPromise[_0xe09e('0x47')](_0x181f4e);}}})['then'](function(){if(_0x12067a){var _0x1fe8f7=[];var _0x458d94=[];var _0x40ed0c=utils['getChannels']();var _0x296758={'membername':_0x12067a[_0xe09e('0x20')],'interface':_0x4ec8e2,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x12067a[_0xe09e('0x2f')],'internal':_0x12067a[_0xe09e('0x30')]};_0x40ed0c['forEach'](function(_0x4c804b){_0x1fe8f7[_0xe09e('0x54')](_[_0xe09e('0x55')]({'channel':_0x4c804b,'type':_0xe09e('0x56'),'data1':'callysquare','data2':_0x4ec8e2},_0x296758));if(_0x12067a[_0xe09e('0x4b')]){_0x458d94[_0xe09e('0x54')](_[_0xe09e('0x55')]({'channel':_0x4c804b,'type':_0xe09e('0x26'),'data1':_0xe09e('0x57')},_0x296758));}});return db[_0xe09e('0x25')][_0xe09e('0x58')](_0x1fe8f7[_0xe09e('0x59')](_0x458d94),{'individualHooks':!![]});}})[_0xe09e('0x15')](function(){if(_0x12067a){return _0x12067a[_0xe09e('0x24')]({'online':!![],'lastLoginAt':moment()[_0xe09e('0x28')](_0xe09e('0x2c')),'voicePause':_0x12067a[_0xe09e('0x4b')]||![],'mailPause':_0x12067a[_0xe09e('0x4b')]||![],'chatPause':_0x12067a[_0xe09e('0x4b')]||![],'faxPause':_0x12067a['loginInPause']||![],'smsPause':_0x12067a['loginInPause']||![],'openchannelPause':_0x12067a[_0xe09e('0x4b')]||![],'pauseType':_0x12067a[_0xe09e('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe09e('0x28')](_0xe09e('0x2c')),'interface':_0x4ec8e2});}})[_0xe09e('0x15')](function(_0xd43d37){_0x1471fb(_0xd43d37);})[_0xe09e('0x19')](function(_0x2c3183){_0x23abf7(_0xe4c404[_0xe09e('0x1a')](0x1f4,_0x2c3183['message']));});});}; \ No newline at end of file +var _0x663d=['UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','params','unpause','system','LogoutUser','destroy','push','all','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','length','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','attributes','limit','map','model','include','then','info','debug','stringify','catch','error','message','User','find','ShowUser','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE'];(function(_0x13292f,_0x203f6f){var _0x4a2038=function(_0x567787){while(--_0x567787){_0x13292f['push'](_0x13292f['shift']());}};_0x4a2038(++_0x203f6f);}(_0x663d,0x80));var _0xd663=function(_0x5669bb,_0x43b45e){_0x5669bb=_0x5669bb-0x0;var _0x42e9ae=_0x663d[_0x5669bb];return _0x42e9ae;};'use strict';var _=require(_0xd663('0x0'));var util=require(_0xd663('0x1'));var moment=require(_0xd663('0x2'));var BPromise=require(_0xd663('0x3'));var Redis=require(_0xd663('0x4'));var db=require(_0xd663('0x5'))['db'];var utils=require(_0xd663('0x6'));var logger=require(_0xd663('0x7'))('rpc');var config=require(_0xd663('0x8'));config[_0xd663('0x9')]=_[_0xd663('0xa')](config[_0xd663('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd663('0xb'))(new Redis(config[_0xd663('0x9')]));require(_0xd663('0xc'))[_0xd663('0xd')](socket);exports[_0xd663('0xe')]=function(_0x278d01){var _0x3fef8a=this;return new Promise(function(_0x70bb79,_0x193518){return db['User'][_0xd663('0xf')]({'raw':_0x278d01['options']?_0x278d01[_0xd663('0x10')][_0xd663('0x11')]===undefined?!![]:![]:!![],'where':_0x278d01[_0xd663('0x10')]?_0x278d01[_0xd663('0x10')][_0xd663('0x12')]||null:null,'attributes':_0x278d01[_0xd663('0x10')]?_0x278d01[_0xd663('0x10')][_0xd663('0x13')]||null:null,'limit':_0x278d01[_0xd663('0x10')]?_0x278d01[_0xd663('0x10')][_0xd663('0x14')]||null:null,'include':_0x278d01[_0xd663('0x10')]?_0x278d01[_0xd663('0x10')]['include']?_[_0xd663('0x15')](_0x278d01['options']['include'],function(_0x267310){return{'model':db[_0x267310[_0xd663('0x16')]],'as':_0x267310['as'],'attributes':_0x267310[_0xd663('0x13')],'include':_0x267310[_0xd663('0x17')]?_[_0xd663('0x15')](_0x267310[_0xd663('0x17')],function(_0xb0e832){return{'model':db[_0xb0e832['model']],'as':_0xb0e832['as'],'attributes':_0xb0e832[_0xd663('0x13')],'include':_0xb0e832['include']?_[_0xd663('0x15')](_0xb0e832['include'],function(_0x1439a1){return{'model':db[_0x1439a1[_0xd663('0x16')]],'as':_0x1439a1['as'],'attributes':_0x1439a1[_0xd663('0x13')]};}):[]};}):[]};}):[]:[]})[_0xd663('0x18')](function(_0x1998e2){logger[_0xd663('0x19')]('GetUser',_0x278d01);logger[_0xd663('0x1a')](_0xd663('0xe'),_0x278d01,JSON[_0xd663('0x1b')](_0x1998e2));_0x70bb79(_0x1998e2);})[_0xd663('0x1c')](function(_0x58aaf4){logger[_0xd663('0x1d')](_0xd663('0xe'),_0x58aaf4[_0xd663('0x1e')],_0x278d01);_0x193518(_0x3fef8a[_0xd663('0x1d')](0x1f4,_0x58aaf4[_0xd663('0x1e')]));});});};exports['ShowUser']=function(_0x217d56){var _0x1ad73d=this;return new Promise(function(_0x1db6bb,_0x5c700f){return db[_0xd663('0x1f')][_0xd663('0x20')]({'raw':_0x217d56[_0xd663('0x10')]?_0x217d56[_0xd663('0x10')][_0xd663('0x11')]===undefined?!![]:![]:!![],'where':_0x217d56[_0xd663('0x10')]?_0x217d56[_0xd663('0x10')][_0xd663('0x12')]||null:null,'attributes':_0x217d56[_0xd663('0x10')]?_0x217d56[_0xd663('0x10')][_0xd663('0x13')]||null:null,'include':_0x217d56[_0xd663('0x10')]?_0x217d56[_0xd663('0x10')][_0xd663('0x17')]?_[_0xd663('0x15')](_0x217d56['options'][_0xd663('0x17')],function(_0xf051fc){return{'model':db[_0xf051fc[_0xd663('0x16')]],'as':_0xf051fc['as'],'attributes':_0xf051fc['attributes'],'include':_0xf051fc[_0xd663('0x17')]?_[_0xd663('0x15')](_0xf051fc[_0xd663('0x17')],function(_0x2a374c){return{'model':db[_0x2a374c[_0xd663('0x16')]],'as':_0x2a374c['as'],'attributes':_0x2a374c[_0xd663('0x13')],'include':_0x2a374c[_0xd663('0x17')]?_['map'](_0x2a374c['include'],function(_0x1d2826){return{'model':db[_0x1d2826['model']],'as':_0x1d2826['as'],'attributes':_0x1d2826[_0xd663('0x13')]};}):[]};}):[]};}):[]:[]})[_0xd663('0x18')](function(_0x269aab){logger[_0xd663('0x19')](_0xd663('0x21'),_0x217d56);logger['debug'](_0xd663('0x21'),_0x217d56,JSON[_0xd663('0x1b')](_0x269aab));_0x1db6bb(_0x269aab);})[_0xd663('0x1c')](function(_0x2cc245){logger[_0xd663('0x1d')](_0xd663('0x21'),_0x2cc245[_0xd663('0x1e')],_0x217d56);_0x5c700f(_0x1ad73d[_0xd663('0x1d')](0x1f4,_0x2cc245[_0xd663('0x1e')]));});});};exports[_0xd663('0x22')]=function(_0x2f513b){var _0x2d7d64;return db[_0xd663('0x1f')][_0xd663('0x20')]({'where':_0x2f513b[_0xd663('0x10')][_0xd663('0x12')]||{},'attributes':['id',_0xd663('0x23'),_0xd663('0x24'),_0xd663('0x25'),_0xd663('0x26')]})[_0xd663('0x18')](function(_0x534efc){if(!_0x534efc){throw new Error(util[_0xd663('0x27')](_0xd663('0x28'),_0x2f513b['params']['id']));}_0x2d7d64=_0x534efc;return db[_0xd663('0x29')][_0xd663('0x2a')]({'paused':0x1},{'where':{'UserId':_0x2d7d64['id']},'individualHooks':!![]});})['then'](function(){return db[_0xd663('0x2b')][_0xd663('0xf')]({'where':{'membername':_0x2d7d64[_0xd663('0x23')],'type':_0xd663('0x2c'),'exitAt':null}});})[_0xd663('0x18')](function(_0x2e9a95){if(_0x2e9a95&&_0x2e9a95['length']){var _0x7d80d9=moment()[_0xd663('0x27')](_0xd663('0x2d'));for(var _0x1c00fe=0x0,_0x2e871d=_0x2e9a95['length'];_0x1c00fe<_0x2e871d;_0x1c00fe++){_0x2e9a95[_0x1c00fe][_0xd663('0x2e')]({'exitAt':_0x7d80d9});}}})[_0xd663('0x18')](function(){var _0x1f1cee=[];var _0x402d4f=utils[_0xd663('0x2f')]();_0x402d4f[_0xd663('0x30')](function(_0x5e24df){_0x1f1cee['push']({'channel':_0x5e24df,'membername':_0x2d7d64[_0xd663('0x23')],'interface':_[_0xd663('0x31')](_0x2d7d64[_0xd663('0x26')])?util['format'](_0xd663('0x32'),_0x2d7d64[_0xd663('0x23')]):_0x2d7d64['interface'],'type':_0xd663('0x2c'),'enterAt':moment()[_0xd663('0x27')](_0xd663('0x2d')),'data1':_0x2f513b[_0xd663('0x33')][_0xd663('0x34')]||_0xd663('0x35'),'role':_0x2d7d64[_0xd663('0x24')],'internal':_0x2d7d64[_0xd663('0x25')],'uniqueid':_0x2f513b[_0xd663('0x33')]['uniqueid']||null});});return db[_0xd663('0x2b')]['bulkCreate'](_0x1f1cee,{'individualHooks':!![]});})[_0xd663('0x18')](function(){return _0x2d7d64[_0xd663('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2f513b['body'][_0xd663('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd663('0x27')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xd663('0x1c')](function(_0x456b48){throw _0x456b48;});};exports[_0xd663('0x36')]=function(_0x42502a){return Promise[_0xd663('0x37')]()[_0xd663('0x18')](function(){if(_0x42502a[_0xd663('0x33')][_0xd663('0x38')]&&!utils[_0xd663('0x39')](_0x42502a['body'][_0xd663('0x38')])){throw new Error(util[_0xd663('0x27')](_0xd663('0x3a'),_0x42502a[_0xd663('0x33')][_0xd663('0x38')]));}return db[_0xd663('0x1f')][_0xd663('0x3b')]({'where':_0x42502a[_0xd663('0x10')]['where']||{},'attributes':['id',_0xd663('0x23'),_0xd663('0x24'),_0xd663('0x25'),_0xd663('0x26'),_0xd663('0x3c'),_0xd663('0x3d'),_0xd663('0x3e'),'chatPause',_0xd663('0x3f'),_0xd663('0x40'),_0xd663('0x41'),_0xd663('0x42'),_0xd663('0x43'),'lastPauseAt']});})[_0xd663('0x18')](function(_0x1ca449){if(!_0x1ca449){throw new Error(util[_0xd663('0x27')]('User\x20with\x20id\x20%s\x20not\x20found',_0x42502a[_0xd663('0x44')]['id']));}return _0x1ca449[_0xd663('0x45')](_0x42502a['body'][_0xd663('0x38')],_0xd663('0x46'));})[_0xd663('0x1c')](function(_0x245c2f){throw _0x245c2f;});};exports[_0xd663('0x47')]=function(_0x23a2c9){var _0x4e4710=this;return new Promise(function(_0x503613,_0x586d24){var _0x6a4f09;return db[_0xd663('0x1f')][_0xd663('0x3b')]({'where':_0x23a2c9[_0xd663('0x10')]['where']||{},'attributes':['id',_0xd663('0x23')]})['then'](function(_0x1020ea){if(_0x1020ea){_0x6a4f09=_0x1020ea;return db[_0xd663('0x29')][_0xd663('0x48')]({'where':{'membername':_0x6a4f09['name']},'individualHooks':!![]});}})[_0xd663('0x18')](function(){if(_0x6a4f09){return db[_0xd663('0x2b')]['findAll']({'where':{'membername':_0x6a4f09['name'],'exitAt':null}});}})[_0xd663('0x18')](function(_0x10f8db){if(_0x6a4f09){if(_0x10f8db&&_0x10f8db['length']){var _0x697d7=[];_0x10f8db['forEach'](function(_0x57005a){_0x697d7[_0xd663('0x49')](_0x57005a[_0xd663('0x2a')]({'exitAt':moment()['format'](_0xd663('0x2d'))}));});return BPromise[_0xd663('0x4a')](_0x697d7);}}})[_0xd663('0x18')](function(){if(_0x6a4f09){return _0x6a4f09[_0xd663('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd663('0x18')](function(_0x5708f9){_0x503613(_0x5708f9);})[_0xd663('0x1c')](function(_0x1fdb69){_0x586d24(_0x4e4710[_0xd663('0x1d')](0x1f4,_0x1fdb69[_0xd663('0x1e')]));});});};exports['LoginUser']=function(_0x457afd){var _0xf27ff6=this;return new Promise(function(_0x34fdbc,_0x33b29a){var _0x388408;var _0x3b5252;var _0x2aa5e6;var _0x28a91e;return db['User']['findOne']({'where':_0x457afd[_0xd663('0x10')][_0xd663('0x12')]||{},'attributes':['id',_0xd663('0x23'),'role','mobile',_0xd663('0x4b'),'internal',_0xd663('0x4c'),_0xd663('0x26')]})[_0xd663('0x18')](function(_0x816e4c){if(_0x816e4c){_0x388408=_0x816e4c;_0x28a91e=_0x457afd[_0xd663('0x33')][_0xd663('0x26')]?_0x457afd[_0xd663('0x33')][_0xd663('0x26')]:util[_0xd663('0x27')](_0xd663('0x32'),_0x388408['name']);return db[_0xd663('0x1f')][_0xd663('0x4d')]({'where':{'role':_0xd663('0x4e'),'online':!![],'id':{'$ne':_0x388408['id']}}});}})[_0xd663('0x18')](function(_0x2cf2a3){if(_0x2cf2a3){_0x2aa5e6=_0x2cf2a3;return require(_0xd663('0x4f'))[_0xd663('0x50')]();}})[_0xd663('0x18')](function(_0x3a3d4a){if(_0x3a3d4a&&_0x3a3d4a['agents']&&_0x2aa5e6>=_0x3a3d4a[_0xd663('0x51')]){throw new Error(_0xd663('0x52'));}})[_0xd663('0x18')](function(){if(_0x388408){return db[_0xd663('0x29')][_0xd663('0x48')]({'where':{'membername':_0x388408[_0xd663('0x23')]},'individualHooks':!![]});}})[_0xd663('0x18')](function(){if(_0x388408){return _0x388408[_0xd663('0x53')]({'raw':!![]});}})[_0xd663('0x18')](function(_0x4a89b0){if(_0x388408){if(_0x4a89b0){var _0x325e5a=[];_0x3b5252=_0x4a89b0;if(_0x3b5252[_0xd663('0x54')]){for(var _0x497fe5=0x0;_0x497fe5<_0x3b5252[_0xd663('0x54')];_0x497fe5++){_0x325e5a[_0xd663('0x49')](db[_0xd663('0x29')]['upsert']({'membername':_0x388408['name'],'UserId':_0x388408['id'],'queue_name':_0x3b5252[_0x497fe5][_0xd663('0x23')],'VoiceQueueId':_0x3b5252[_0x497fe5]['id'],'interface':_0x28a91e,'paused':_0x388408[_0xd663('0x4c')]||![],'penalty':_0x3b5252[_0x497fe5][_0xd663('0x55')]||0x0}));}return BPromise[_0xd663('0x4a')](_0x325e5a);}}}})[_0xd663('0x18')](function(){if(_0x388408){return db[_0xd663('0x2b')][_0xd663('0xf')]({'where':{'membername':_0x388408[_0xd663('0x23')],'exitAt':null}});}})['then'](function(_0x12bb1a){if(_0x388408){if(_0x12bb1a&&_0x12bb1a['length']){var _0x127ae7=[];_0x12bb1a[_0xd663('0x30')](function(_0x10121b){_0x127ae7[_0xd663('0x49')](_0x10121b[_0xd663('0x2a')]({'exitAt':moment()['format'](_0xd663('0x2d'))}));});return BPromise[_0xd663('0x4a')](_0x127ae7);}}})[_0xd663('0x18')](function(){if(_0x388408){var _0x3d590d=[];var _0x375eba=[];var _0xa7348=utils[_0xd663('0x2f')]();var _0x4b31b6={'membername':_0x388408['name'],'interface':_0x28a91e,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x388408[_0xd663('0x24')],'internal':_0x388408[_0xd663('0x25')]};_0xa7348['forEach'](function(_0x2a4bb5){_0x3d590d[_0xd663('0x49')](_[_0xd663('0x56')]({'channel':_0x2a4bb5,'type':_0xd663('0x57'),'data1':_0xd663('0x58'),'data2':_0x28a91e},_0x4b31b6));if(_0x388408[_0xd663('0x4c')]){_0x375eba['push'](_[_0xd663('0x56')]({'channel':_0x2a4bb5,'type':_0xd663('0x2c'),'data1':_0xd663('0x59')},_0x4b31b6));}});return db[_0xd663('0x2b')]['bulkCreate'](_0x3d590d[_0xd663('0x5a')](_0x375eba),{'individualHooks':!![]});}})['then'](function(){if(_0x388408){return _0x388408['update']({'online':!![],'lastLoginAt':moment()[_0xd663('0x27')](_0xd663('0x2d')),'voicePause':_0x388408[_0xd663('0x4c')]||![],'mailPause':_0x388408['loginInPause']||![],'chatPause':_0x388408[_0xd663('0x4c')]||![],'faxPause':_0x388408[_0xd663('0x4c')]||![],'smsPause':_0x388408[_0xd663('0x4c')]||![],'openchannelPause':_0x388408['loginInPause']||![],'pauseType':_0x388408[_0xd663('0x4c')]?_0xd663('0x59'):null,'lastPauseAt':moment()[_0xd663('0x27')](_0xd663('0x2d')),'interface':_0x28a91e});}})['then'](function(_0x310036){_0x34fdbc(_0x310036);})[_0xd663('0x1c')](function(_0x49ffb2){_0x33b29a(_0xf27ff6['error'](0x1f4,_0x49ffb2[_0xd663('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fc45fe9..4269e70 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 _0x91fd=['register','length','user:','remove','emit','removeListener'];(function(_0x2ecae3,_0x44e30d){var _0x46a86a=function(_0x41a2d6){while(--_0x41a2d6){_0x2ecae3['push'](_0x2ecae3['shift']());}};_0x46a86a(++_0x44e30d);}(_0x91fd,0x87));var _0xd91f=function(_0x2e9c75,_0x439582){_0x2e9c75=_0x2e9c75-0x0;var _0x4a06a8=_0x91fd[_0x2e9c75];return _0x4a06a8;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xd91f('0x0'),'update'];function createListener(_0xcdb46c,_0x15156f){return function(_0x19fa4d){_0x15156f[_0xd91f('0x1')](_0xcdb46c,_0x19fa4d);};}function removeListener(_0x51a9d3,_0x23007c){return function(){UserEvents[_0xd91f('0x2')](_0x51a9d3,_0x23007c);};}exports[_0xd91f('0x3')]=function(_0x4e00c0){for(var _0x882c4a=0x0,_0x53f876=events[_0xd91f('0x4')];_0x882c4a<_0x53f876;_0x882c4a++){var _0x2cc335=events[_0x882c4a];var _0x310717=createListener(_0xd91f('0x5')+_0x2cc335,_0x4e00c0);UserEvents['on'](_0x2cc335,_0x310717);}}; \ No newline at end of file +var _0x298b=['update','emit','removeListener','register','length','save','remove'];(function(_0x13bf4c,_0x1b339b){var _0x3d2f8e=function(_0x4e5da2){while(--_0x4e5da2){_0x13bf4c['push'](_0x13bf4c['shift']());}};_0x3d2f8e(++_0x1b339b);}(_0x298b,0xa6));var _0xb298=function(_0x344e0b,_0x101305){_0x344e0b=_0x344e0b-0x0;var _0x31f84f=_0x298b[_0x344e0b];return _0x31f84f;};'use strict';var UserEvents=require('./user.events');var events=[_0xb298('0x0'),_0xb298('0x1'),_0xb298('0x2')];function createListener(_0x3d52bc,_0xe89e40){return function(_0x3b0446){_0xe89e40[_0xb298('0x3')](_0x3d52bc,_0x3b0446);};}function removeListener(_0x13c5a0,_0x314638){return function(){UserEvents[_0xb298('0x4')](_0x13c5a0,_0x314638);};}exports[_0xb298('0x5')]=function(_0x45fb5b){for(var _0x21c58e=0x0,_0x57f77a=events[_0xb298('0x6')];_0x21c58e<_0x57f77a;_0x21c58e++){var _0xb922ba=events[_0x21c58e];var _0x2e5a02=createListener('user:'+_0xb922ba,_0x45fb5b);UserEvents['on'](_0xb922ba,_0x2e5a02);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index dc1dfa7..a3bc5d8 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(_0x2b5062,_0x12b234){var _0x15b1e1=function(_0x337033){while(--_0x337033){_0x2b5062['push'](_0x2b5062['shift']());}};_0x15b1e1(++_0x12b234);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x33cf3f,_0x445e8a){var _0x4737e4=function(_0x2903ff){while(--_0x2903ff){_0x33cf3f['push'](_0x33cf3f['shift']());}};_0x4737e4(++_0x445e8a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0xcb91[_0x1d128e];return _0x3d5236;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9164ebb..8ddff41 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 _0x91f8=['INTEGER','sequelize','exports'];(function(_0x1a54c9,_0x52e66c){var _0x1020cd=function(_0x3d7f72){while(--_0x3d7f72){_0x1a54c9['push'](_0x1a54c9['shift']());}};_0x1020cd(++_0x52e66c);}(_0x91f8,0x13f));var _0x891f=function(_0x237ead,_0x1869d8){_0x237ead=_0x237ead-0x0;var _0x3f78bf=_0x91f8[_0x237ead];return _0x3f78bf;};'use strict';var Sequelize=require(_0x891f('0x0'));module[_0x891f('0x1')]={'penalty':{'type':Sequelize[_0x891f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46b7=['sequelize','exports','INTEGER'];(function(_0xfc9c70,_0x32d539){var _0x56919f=function(_0x5f6e96){while(--_0x5f6e96){_0xfc9c70['push'](_0xfc9c70['shift']());}};_0x56919f(++_0x32d539);}(_0x46b7,0xf0));var _0x746b=function(_0x4ec934,_0x1cf592){_0x4ec934=_0x4ec934-0x0;var _0x581a0e=_0x46b7[_0x4ec934];return _0x581a0e;};'use strict';var Sequelize=require(_0x746b('0x0'));module[_0x746b('0x1')]={'penalty':{'type':Sequelize[_0x746b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 2c96d3e..e6d9c91 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 _0x2427=['../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x2683d3,_0x2a76eb){var _0x3cd498=function(_0x3d6137){while(--_0x3d6137){_0x2683d3['push'](_0x2683d3['shift']());}};_0x3cd498(++_0x2a76eb);}(_0x2427,0x165));var _0x7242=function(_0x3f1f14,_0x35fd21){_0x3f1f14=_0x3f1f14-0x0;var _0x1e4c1c=_0x2427[_0x3f1f14];return _0x1e4c1c;};'use strict';var _=require(_0x7242('0x0'));var util=require(_0x7242('0x1'));var logger=require('../../config/logger')(_0x7242('0x2'));var moment=require('moment');var BPromise=require(_0x7242('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7242('0x4'));var rimraf=require(_0x7242('0x5'));var config=require(_0x7242('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x7242('0x7')]=function(_0x4b0575,_0x3c629c){return _0x4b0575[_0x7242('0x8')](_0x7242('0x9'),attributes,{'tableName':_0x7242('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1d2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues'];(function(_0x2c75b7,_0x1b0bb9){var _0x3c8f91=function(_0x25d633){while(--_0x25d633){_0x2c75b7['push'](_0x2c75b7['shift']());}};_0x3c8f91(++_0x1b0bb9);}(_0xc1d2,0x152));var _0x2c1d=function(_0x4e64b1,_0x39e833){_0x4e64b1=_0x4e64b1-0x0;var _0x35686e=_0xc1d2[_0x4e64b1];return _0x35686e;};'use strict';var _=require(_0x2c1d('0x0'));var util=require(_0x2c1d('0x1'));var logger=require(_0x2c1d('0x2'))(_0x2c1d('0x3'));var moment=require(_0x2c1d('0x4'));var BPromise=require(_0x2c1d('0x5'));var rp=require(_0x2c1d('0x6'));var fs=require('fs');var path=require(_0x2c1d('0x7'));var rimraf=require(_0x2c1d('0x8'));var config=require('../../config/environment');var attributes=require(_0x2c1d('0x9'));module['exports']=function(_0x24e7a0,_0xff0f1b){return _0x24e7a0[_0x2c1d('0xa')](_0x2c1d('0xb'),attributes,{'tableName':_0x2c1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 37f5776..7e6ae7e 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 _0xe068=['info','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xe068,0x112));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8e06('0x0'));var util=require(_0x8e06('0x1'));var moment=require(_0x8e06('0x2'));var BPromise=require(_0x8e06('0x3'));var rs=require(_0x8e06('0x4'));var fs=require('fs');var Redis=require(_0x8e06('0x5'));var db=require(_0x8e06('0x6'))['db'];var utils=require(_0x8e06('0x7'));var logger=require('../../config/logger')(_0x8e06('0x8'));var config=require(_0x8e06('0x9'));var jayson=require(_0x8e06('0xa'));var client=jayson[_0x8e06('0xb')][_0x8e06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37a473,_0x1e0b5a,_0x33f52f){return new BPromise(function(_0x1afcc3,_0x50b79f){return client['request'](_0x37a473,_0x33f52f)[_0x8e06('0xd')](function(_0x5ac6c8){logger[_0x8e06('0xe')](_0x8e06('0xf'),_0x1e0b5a,'request\x20sent');logger[_0x8e06('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1e0b5a,_0x8e06('0x11'),JSON[_0x8e06('0x12')](_0x5ac6c8));if(_0x5ac6c8[_0x8e06('0x13')]){if(_0x5ac6c8[_0x8e06('0x13')][_0x8e06('0x14')]===0x1f4){logger['error'](_0x8e06('0xf'),_0x1e0b5a,_0x5ac6c8['error'][_0x8e06('0x15')]);return _0x50b79f(_0x5ac6c8[_0x8e06('0x13')][_0x8e06('0x15')]);}logger['error'](_0x8e06('0xf'),_0x1e0b5a,_0x5ac6c8[_0x8e06('0x13')][_0x8e06('0x15')]);return _0x1afcc3(_0x5ac6c8[_0x8e06('0x13')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1e0b5a,_0x8e06('0x11'));_0x1afcc3(_0x5ac6c8[_0x8e06('0x16')][_0x8e06('0x15')]);}})[_0x8e06('0x17')](function(_0xd73b95){logger[_0x8e06('0x13')](_0x8e06('0xf'),_0x1e0b5a,_0xd73b95);_0x50b79f(_0xd73b95);});});} \ No newline at end of file +var _0x4758=['UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5935c6,_0x16cc50){var _0x348d46=function(_0x44154b){while(--_0x44154b){_0x5935c6['push'](_0x5935c6['shift']());}};_0x348d46(++_0x16cc50);}(_0x4758,0x87));var _0x8475=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4758[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var moment=require('moment');var BPromise=require(_0x8475('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8475('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8475('0x4'))(_0x8475('0x5'));var config=require(_0x8475('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8475('0x7')][_0x8475('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54964f,_0x144cf2,_0x41eafc){return new BPromise(function(_0x52eeb5,_0x14ef34){return client[_0x8475('0x9')](_0x54964f,_0x41eafc)[_0x8475('0xa')](function(_0x9a3dca){logger[_0x8475('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x144cf2,'request\x20sent');logger['debug'](_0x8475('0xc'),_0x144cf2,_0x8475('0xd'),JSON[_0x8475('0xe')](_0x9a3dca));if(_0x9a3dca['error']){if(_0x9a3dca[_0x8475('0xf')][_0x8475('0x10')]===0x1f4){logger['error'](_0x8475('0x11'),_0x144cf2,_0x9a3dca['error'][_0x8475('0x12')]);return _0x14ef34(_0x9a3dca[_0x8475('0xf')][_0x8475('0x12')]);}logger['error'](_0x8475('0x11'),_0x144cf2,_0x9a3dca['error'][_0x8475('0x12')]);return _0x52eeb5(_0x9a3dca[_0x8475('0xf')][_0x8475('0x12')]);}else{logger['info'](_0x8475('0x11'),_0x144cf2,'request\x20sent');_0x52eeb5(_0x9a3dca[_0x8475('0x13')][_0x8475('0x12')]);}})[_0x8475('0x14')](function(_0x104d76){logger[_0x8475('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x144cf2,_0x104d76);_0x14ef34(_0x104d76);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 663c93b..1857bed 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28915b,_0x30c604){var _0x3b698c=function(_0x3ca63b){while(--_0x3ca63b){_0x28915b['push'](_0x28915b['shift']());}};_0x3b698c(++_0x30c604);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xcb91[_0x3a78a0];return _0x48e917;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x13551d,_0x46a516){var _0x192544=function(_0x10b848){while(--_0x10b848){_0x13551d['push'](_0x13551d['shift']());}};_0x192544(++_0x46a516);}(_0x70e0,0x17b));var _0x070e=function(_0x4a5b78,_0x201f15){_0x4a5b78=_0x4a5b78-0x0;var _0x3f2e17=_0x70e0[_0x4a5b78];return _0x3f2e17;};'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 dac4633..c6956c9 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 _0x4acb=['sequelize','exports','INTEGER'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x4acb,0x18c));var _0xb4ac=function(_0xbe7e25,_0x536eab){_0xbe7e25=_0xbe7e25-0x0;var _0x524b30=_0x4acb[_0xbe7e25];return _0x524b30;};'use strict';var Sequelize=require(_0xb4ac('0x0'));module[_0xb4ac('0x1')]={'penalty':{'type':Sequelize[_0xb4ac('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb3cf=['exports','INTEGER','STRING','sequelize'];(function(_0xf4aa17,_0x268e06){var _0x285b25=function(_0x2cc4d0){while(--_0x2cc4d0){_0xf4aa17['push'](_0xf4aa17['shift']());}};_0x285b25(++_0x268e06);}(_0xb3cf,0x1af));var _0xfb3c=function(_0x4bf9fb,_0x793396){_0x4bf9fb=_0x4bf9fb-0x0;var _0x2ef7be=_0xb3cf[_0x4bf9fb];return _0x2ef7be;};'use strict';var Sequelize=require(_0xfb3c('0x0'));module[_0xfb3c('0x1')]={'penalty':{'type':Sequelize[_0xfb3c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfb3c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfb3c('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 41010f6..62d59ab 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 _0x5a7d=['../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0x5a7d,0xd0));var _0xd5a7=function(_0x58f83c,_0x563967){_0x58f83c=_0x58f83c-0x0;var _0x5d2f70=_0x5a7d[_0x58f83c];return _0x5d2f70;};'use strict';var _=require(_0xd5a7('0x0'));var util=require(_0xd5a7('0x1'));var logger=require(_0xd5a7('0x2'))(_0xd5a7('0x3'));var moment=require(_0xd5a7('0x4'));var BPromise=require(_0xd5a7('0x5'));var rp=require(_0xd5a7('0x6'));var fs=require('fs');var path=require(_0xd5a7('0x7'));var rimraf=require('rimraf');var config=require(_0xd5a7('0x8'));var attributes=require(_0xd5a7('0x9'));module['exports']=function(_0x1eccd3,_0x2a1057){return _0x1eccd3[_0xd5a7('0xa')](_0xd5a7('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a2=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserFaxQueue'];(function(_0x408f9f,_0x305315){var _0xb0c558=function(_0x4a9c45){while(--_0x4a9c45){_0x408f9f['push'](_0x408f9f['shift']());}};_0xb0c558(++_0x305315);}(_0xf9a2,0x12c));var _0x2f9a=function(_0x45de8c,_0x2fabc2){_0x45de8c=_0x45de8c-0x0;var _0x39b84b=_0xf9a2[_0x45de8c];return _0x39b84b;};'use strict';var _=require(_0x2f9a('0x0'));var util=require(_0x2f9a('0x1'));var logger=require(_0x2f9a('0x2'))(_0x2f9a('0x3'));var moment=require(_0x2f9a('0x4'));var BPromise=require(_0x2f9a('0x5'));var rp=require(_0x2f9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f9a('0x7'));var config=require(_0x2f9a('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x2f9a('0x9')]=function(_0x28c6d6,_0x3c7970){return _0x28c6d6[_0x2f9a('0xa')](_0x2f9a('0xb'),attributes,{'tableName':_0x2f9a('0xc'),'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 0c5b4ff..8f736a7 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 _0x64c1=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x64c1,0x1b6));var _0x164c=function(_0x4a7ef6,_0x43c1b5){_0x4a7ef6=_0x4a7ef6-0x0;var _0x5685f1=_0x64c1[_0x4a7ef6];return _0x5685f1;};'use strict';var _=require(_0x164c('0x0'));var util=require(_0x164c('0x1'));var moment=require(_0x164c('0x2'));var BPromise=require(_0x164c('0x3'));var rs=require(_0x164c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x164c('0x5'))['db'];var utils=require(_0x164c('0x6'));var logger=require(_0x164c('0x7'))(_0x164c('0x8'));var config=require(_0x164c('0x9'));var jayson=require(_0x164c('0xa'));var client=jayson[_0x164c('0xb')][_0x164c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14e4d6,_0x1ade83,_0x5a1a9f){return new BPromise(function(_0x2d59b2,_0x2aa234){return client[_0x164c('0xd')](_0x14e4d6,_0x5a1a9f)[_0x164c('0xe')](function(_0x5591d1){logger[_0x164c('0xf')](_0x164c('0x10'),_0x1ade83,'request\x20sent');logger[_0x164c('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1ade83,_0x164c('0x12'),JSON[_0x164c('0x13')](_0x5591d1));if(_0x5591d1[_0x164c('0x14')]){if(_0x5591d1['error']['code']===0x1f4){logger[_0x164c('0x14')](_0x164c('0x10'),_0x1ade83,_0x5591d1[_0x164c('0x14')]['message']);return _0x2aa234(_0x5591d1['error'][_0x164c('0x15')]);}logger[_0x164c('0x14')](_0x164c('0x10'),_0x1ade83,_0x5591d1[_0x164c('0x14')][_0x164c('0x15')]);return _0x2d59b2(_0x5591d1['error'][_0x164c('0x15')]);}else{logger[_0x164c('0xf')](_0x164c('0x10'),_0x1ade83,_0x164c('0x12'));_0x2d59b2(_0x5591d1[_0x164c('0x16')][_0x164c('0x15')]);}})[_0x164c('0x17')](function(_0x56b79c){logger[_0x164c('0x14')](_0x164c('0x10'),_0x1ade83,_0x56b79c);_0x2aa234(_0x56b79c);});});} \ No newline at end of file +var _0x6acb=['request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x96988a,_0x43e539){var _0x3f6ad9=function(_0x292e73){while(--_0x292e73){_0x96988a['push'](_0x96988a['shift']());}};_0x3f6ad9(++_0x43e539);}(_0x6acb,0x15a));var _0xb6ac=function(_0xda501a,_0x159d6a){_0xda501a=_0xda501a-0x0;var _0x44be3a=_0x6acb[_0xda501a];return _0x44be3a;};'use strict';var _=require(_0xb6ac('0x0'));var util=require(_0xb6ac('0x1'));var moment=require(_0xb6ac('0x2'));var BPromise=require(_0xb6ac('0x3'));var rs=require(_0xb6ac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6ac('0x5'))['db'];var utils=require(_0xb6ac('0x6'));var logger=require(_0xb6ac('0x7'))('rpc');var config=require(_0xb6ac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6ac('0x9')][_0xb6ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40cddc,_0x247c41,_0x1328c0){return new BPromise(function(_0x278733,_0xf31bef){return client[_0xb6ac('0xb')](_0x40cddc,_0x1328c0)[_0xb6ac('0xc')](function(_0x40c726){logger['info'](_0xb6ac('0xd'),_0x247c41,_0xb6ac('0xe'));logger['debug'](_0xb6ac('0xf'),_0x247c41,'request\x20sent',JSON['stringify'](_0x40c726));if(_0x40c726[_0xb6ac('0x10')]){if(_0x40c726['error'][_0xb6ac('0x11')]===0x1f4){logger[_0xb6ac('0x10')](_0xb6ac('0xd'),_0x247c41,_0x40c726[_0xb6ac('0x10')]['message']);return _0xf31bef(_0x40c726[_0xb6ac('0x10')][_0xb6ac('0x12')]);}logger[_0xb6ac('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x247c41,_0x40c726['error'][_0xb6ac('0x12')]);return _0x278733(_0x40c726[_0xb6ac('0x10')]['message']);}else{logger['info'](_0xb6ac('0xd'),_0x247c41,_0xb6ac('0xe'));_0x278733(_0x40c726[_0xb6ac('0x13')][_0xb6ac('0x12')]);}})[_0xb6ac('0x14')](function(_0x3f56b9){logger[_0xb6ac('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x247c41,_0x3f56b9);_0xf31bef(_0x3f56b9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1db56e6..b438a38 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2eb5b9,_0xb67ca3){var _0x5de9b9=function(_0x3f6672){while(--_0x3f6672){_0x2eb5b9['push'](_0x2eb5b9['shift']());}};_0x5de9b9(++_0xb67ca3);}(_0xedd9,0xfc));var _0x9edd=function(_0x6cf774,_0xb0e57e){_0x6cf774=_0x6cf774-0x0;var _0x4cdbed=_0xedd9[_0x6cf774];return _0x4cdbed;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4e8b54,_0x117651){var _0x555dcf=function(_0x4e8e2){while(--_0x4e8e2){_0x4e8b54['push'](_0x4e8b54['shift']());}};_0x555dcf(++_0x117651);}(_0x70e0,0x17b));var _0x070e=function(_0x4529ff,_0xef1392){_0x4529ff=_0x4529ff-0x0;var _0x36ad46=_0x70e0[_0x4529ff];return _0x36ad46;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d60122f..14268de 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 _0x8a3d=['sequelize','exports','INTEGER'];(function(_0x46d694,_0x4e6dc2){var _0x381a46=function(_0x493914){while(--_0x493914){_0x46d694['push'](_0x46d694['shift']());}};_0x381a46(++_0x4e6dc2);}(_0x8a3d,0xd5));var _0xd8a3=function(_0x121059,_0x22d944){_0x121059=_0x121059-0x0;var _0x46e39f=_0x8a3d[_0x121059];return _0x46e39f;};'use strict';var Sequelize=require(_0xd8a3('0x0'));module[_0xd8a3('0x1')]={'penalty':{'type':Sequelize[_0xd8a3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa99e=['INTEGER','sequelize','exports'];(function(_0xf08c68,_0x2061a2){var _0x3d26be=function(_0x7d87c0){while(--_0x7d87c0){_0xf08c68['push'](_0xf08c68['shift']());}};_0x3d26be(++_0x2061a2);}(_0xa99e,0xb8));var _0xea99=function(_0x495b93,_0x4f1c7e){_0x495b93=_0x495b93-0x0;var _0x286bd8=_0xa99e[_0x495b93];return _0x286bd8;};'use strict';var Sequelize=require(_0xea99('0x0'));module[_0xea99('0x1')]={'penalty':{'type':Sequelize[_0xea99('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8602705..b1f8733 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 _0x268e=['moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x2d6bf1,_0x5b3a23){var _0x5b2495=function(_0x3a4ddb){while(--_0x3a4ddb){_0x2d6bf1['push'](_0x2d6bf1['shift']());}};_0x5b2495(++_0x5b3a23);}(_0x268e,0x72));var _0xe268=function(_0xbbefcb,_0x249fe9){_0xbbefcb=_0xbbefcb-0x0;var _0x3da210=_0x268e[_0xbbefcb];return _0x3da210;};'use strict';var _=require(_0xe268('0x0'));var util=require(_0xe268('0x1'));var logger=require(_0xe268('0x2'))('api');var moment=require(_0xe268('0x3'));var BPromise=require(_0xe268('0x4'));var rp=require(_0xe268('0x5'));var fs=require('fs');var path=require(_0xe268('0x6'));var rimraf=require(_0xe268('0x7'));var config=require('../../config/environment');var attributes=require(_0xe268('0x8'));module[_0xe268('0x9')]=function(_0xd244e4,_0x1674d0){return _0xd244e4[_0xe268('0xa')](_0xe268('0xb'),attributes,{'tableName':_0xe268('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57bf=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x5cf46e,_0x1ecf48){var _0x15fcc8=function(_0x548a54){while(--_0x548a54){_0x5cf46e['push'](_0x5cf46e['shift']());}};_0x15fcc8(++_0x1ecf48);}(_0x57bf,0x108));var _0xf57b=function(_0x4091fb,_0x50eb1d){_0x4091fb=_0x4091fb-0x0;var _0x651e3e=_0x57bf[_0x4091fb];return _0x651e3e;};'use strict';var _=require(_0xf57b('0x0'));var util=require('util');var logger=require(_0xf57b('0x1'))('api');var moment=require(_0xf57b('0x2'));var BPromise=require(_0xf57b('0x3'));var rp=require(_0xf57b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf57b('0x5'));var config=require('../../config/environment');var attributes=require(_0xf57b('0x6'));module[_0xf57b('0x7')]=function(_0x25311a,_0x2e00e0){return _0x25311a[_0xf57b('0x8')](_0xf57b('0x9'),attributes,{'tableName':_0xf57b('0xa'),'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 2f6d46c..e096e47 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x278f09,_0x8f07b5){var _0x51eabd=function(_0x5ebb58){while(--_0x5ebb58){_0x278f09['push'](_0x278f09['shift']());}};_0x51eabd(++_0x8f07b5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x274624,_0x26f3ef){_0x274624=_0x274624-0x0;var _0x3d0175=_0x8ef6[_0x274624];return _0x3d0175;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x191657,_0x3efe95){var _0x3c37ee=function(_0x14f1c4){while(--_0x14f1c4){_0x191657['push'](_0x191657['shift']());}};_0x3c37ee(++_0x3efe95);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x554db0,_0x4eda6b){_0x554db0=_0x554db0-0x0;var _0x2ac209=_0x7fbe[_0x554db0];return _0x2ac209;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0c1a790..4deeeab 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 _0x0b0c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0x0b0c,0x7c));var _0xc0b0=function(_0x30c48d,_0x25e828){_0x30c48d=_0x30c48d-0x0;var _0x2c64aa=_0x0b0c[_0x30c48d];return _0x2c64aa;};'use strict';var multer=require(_0xc0b0('0x0'));var util=require(_0xc0b0('0x1'));var path=require(_0xc0b0('0x2'));var timeout=require(_0xc0b0('0x3'));var express=require(_0xc0b0('0x4'));var router=express[_0xc0b0('0x5')]();var fs_extra=require(_0xc0b0('0x6'));var auth=require(_0xc0b0('0x7'));var interaction=require(_0xc0b0('0x8'));var config=require(_0xc0b0('0x9'));var controller=require('./userNotification.controller');router[_0xc0b0('0xa')]('/',auth[_0xc0b0('0xb')](),controller[_0xc0b0('0xc')]);module[_0xc0b0('0xd')]=router; \ No newline at end of file +var _0x28a9=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','exports','multer','util'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x28a9,0x6a));var _0x928a=function(_0x158250,_0x584720){_0x158250=_0x158250-0x0;var _0xf5e297=_0x28a9[_0x158250];return _0xf5e297;};'use strict';var multer=require(_0x928a('0x0'));var util=require(_0x928a('0x1'));var path=require(_0x928a('0x2'));var timeout=require(_0x928a('0x3'));var express=require('express');var router=express[_0x928a('0x4')]();var fs_extra=require(_0x928a('0x5'));var auth=require(_0x928a('0x6'));var interaction=require(_0x928a('0x7'));var config=require(_0x928a('0x8'));var controller=require(_0x928a('0x9'));router[_0x928a('0xa')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x928a('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 23e7806..3030bd3 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 _0xb396=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xb396,0x1c6));var _0x6b39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb396[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6b39('0x0'));module[_0x6b39('0x1')]={'body':{'type':Sequelize[_0x6b39('0x2')]},'senderName':{'type':Sequelize[_0x6b39('0x3')]},'recipientsId':{'type':Sequelize[_0x6b39('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x6b39('0x4')]}}; \ No newline at end of file +var _0x7ace=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x398e3d,_0x242a4b){var _0x192830=function(_0x16c85b){while(--_0x16c85b){_0x398e3d['push'](_0x398e3d['shift']());}};_0x192830(++_0x242a4b);}(_0x7ace,0x14b));var _0xe7ac=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x7ace[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0xe7ac('0x0'));module['exports']={'body':{'type':Sequelize[_0xe7ac('0x1')]},'senderName':{'type':Sequelize[_0xe7ac('0x2')]},'recipientsId':{'type':Sequelize[_0xe7ac('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe7ac('0x2')]},'beep':{'type':Sequelize[_0xe7ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index ffd7aef..338eebf 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 _0xe32b=['openchannelqueue','voicequeue','team','user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','render','html','startCase','model','User','queue','replace','Queue','ids','all','union','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue'];(function(_0x33fab6,_0x532a04){var _0x314e60=function(_0x56e5d6){while(--_0x56e5d6){_0x33fab6['push'](_0x33fab6['shift']());}};_0x314e60(++_0x532a04);}(_0xe32b,0x1b8));var _0xbe32=function(_0x4a518b,_0x151254){_0x4a518b=_0x4a518b-0x0;var _0x1c48d5=_0xe32b[_0x4a518b];return _0x1c48d5;};'use strict';var emlformat=require(_0xbe32('0x0'));var rimraf=require(_0xbe32('0x1'));var zipdir=require(_0xbe32('0x2'));var jsonpatch=require(_0xbe32('0x3'));var rp=require(_0xbe32('0x4'));var moment=require(_0xbe32('0x5'));var BPromise=require(_0xbe32('0x6'));var Mustache=require(_0xbe32('0x7'));var util=require('util');var path=require(_0xbe32('0x8'));var sox=require(_0xbe32('0x9'));var csv=require('to-csv');var ejs=require(_0xbe32('0xa'));var fs=require('fs');var fs_extra=require(_0xbe32('0xb'));var _=require(_0xbe32('0xc'));var squel=require(_0xbe32('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe32('0xe'));var toCsv=require(_0xbe32('0xf'));var querystring=require(_0xbe32('0x10'));var Papa=require(_0xbe32('0x11'));var Redis=require('ioredis');var authService=require(_0xbe32('0x12'));var qs=require(_0xbe32('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe32('0x14'));var logger=require(_0xbe32('0x15'))(_0xbe32('0x16'));var utils=require(_0xbe32('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbe32('0x18'));var db=require(_0xbe32('0x19'))['db'];config[_0xbe32('0x1a')]=_[_0xbe32('0x1b')](config['redis'],{'host':_0xbe32('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe32('0x1a')]));require(_0xbe32('0x1d'))[_0xbe32('0x1e')](socket);function respondWithStatusCode(_0x24255b,_0x291cef){_0x291cef=_0x291cef||0xcc;return function(_0x996476){if(_0x996476){return _0x24255b[_0xbe32('0x1f')](_0x291cef);}return _0x24255b['status'](_0x291cef)[_0xbe32('0x20')]();};}function respondWithResult(_0x41995f,_0x51262f){_0x51262f=_0x51262f||0xc8;return function(_0x7d3626){if(_0x7d3626){return _0x41995f[_0xbe32('0x21')](_0x51262f)['json'](_0x7d3626);}};}function respondWithFilteredResult(_0x44d7bb,_0x161a14){return function(_0x330afd){if(_0x330afd){var _0x5a0a8b=typeof _0x161a14[_0xbe32('0x22')]===_0xbe32('0x23')&&typeof _0x161a14[_0xbe32('0x24')]==='undefined';var _0x14436b=_0x330afd[_0xbe32('0x25')];var _0x3f79aa=_0x5a0a8b?0x0:_0x161a14[_0xbe32('0x22')];var _0x45b048=_0x5a0a8b?_0x330afd[_0xbe32('0x25')]:_0x161a14['offset']+_0x161a14['limit'];var _0x58130e;if(_0x45b048>=_0x14436b){_0x45b048=_0x14436b;_0x58130e=0xc8;}else{_0x58130e=0xce;}_0x44d7bb[_0xbe32('0x21')](_0x58130e);return _0x44d7bb[_0xbe32('0x26')](_0xbe32('0x27'),_0x3f79aa+'-'+_0x45b048+'/'+_0x14436b)[_0xbe32('0x28')](_0x330afd);}return null;};}function patchUpdates(_0x40c061){return function(_0x234903){try{jsonpatch[_0xbe32('0x29')](_0x234903,_0x40c061,!![]);}catch(_0x4b8f44){return BPromise[_0xbe32('0x2a')](_0x4b8f44);}return _0x234903[_0xbe32('0x2b')]();};}function saveUpdates(_0xb71a7c,_0x5417a8){return function(_0x174ec1){if(_0x174ec1){return _0x174ec1[_0xbe32('0x2c')](_0xb71a7c)[_0xbe32('0x2d')](function(_0x173e11){return _0x173e11;});}return null;};}function removeEntity(_0x2c8aac,_0x368873){return function(_0x451bda){if(_0x451bda){return _0x451bda[_0xbe32('0x2e')]()[_0xbe32('0x2d')](function(){_0x2c8aac[_0xbe32('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x69c7fb,_0x201738){return function(_0xaa334e){if(!_0xaa334e){_0x69c7fb[_0xbe32('0x1f')](0x194);}return _0xaa334e;};}function handleError(_0x452978,_0x2bc9b2){_0x2bc9b2=_0x2bc9b2||0x1f4;return function(_0x1872ed){logger[_0xbe32('0x2f')](_0x1872ed[_0xbe32('0x30')]);if(_0x1872ed[_0xbe32('0x31')]){delete _0x1872ed[_0xbe32('0x31')];}_0x452978['status'](_0x2bc9b2)[_0xbe32('0x32')](_0x1872ed);};}exports['sendUserNotification']=function(_0x4e6868,_0x178d9d,_0x5beaa1){if(!_0x4e6868[_0xbe32('0x33')][_0xbe32('0x34')](_0xbe32('0x35'))&&!_0x4e6868[_0xbe32('0x33')][_0xbe32('0x34')](_0xbe32('0x36'))){throw new db['Sequelize'][(_0xbe32('0x37'))](_0xbe32('0x38'));}else{if(_0x4e6868['body'][_0xbe32('0x34')](_0xbe32('0x36'))&&!_0x4e6868[_0xbe32('0x33')][_0xbe32('0x34')](_0xbe32('0x39'))){throw new db[(_0xbe32('0x3a'))][(_0xbe32('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4e6868[_0xbe32('0x33')][_0xbe32('0x34')](_0xbe32('0x3b'))){throw new db[(_0xbe32('0x3a'))]['ValidationError'](_0xbe32('0x3c'));}else{try{var _0x5cffab=JSON['parse'](_0x4e6868[_0xbe32('0x33')][_0xbe32('0x3b')]);}catch(_0x457b96){logger[_0xbe32('0x2f')](_0x457b96);throw new db[(_0xbe32('0x3a'))][(_0xbe32('0x37'))](_0xbe32('0x3d'));}var _0x39b888=[_0xbe32('0x3e'),_0xbe32('0x3f'),_0xbe32('0x40'),_0xbe32('0x41'),'smsqueue',_0xbe32('0x42'),'whatsappqueue',_0xbe32('0x43'),_0xbe32('0x44')];if(_['some'](_0x5cffab,function(_0x18ec5c){return!_[_0xbe32('0x45')](_0x39b888,_0x18ec5c['model'][_0xbe32('0x46')]());})){throw new db['Sequelize']['ValidationError'](_0xbe32('0x47'));}}}var _0x37ec3f={};_0x37ec3f[_0xbe32('0x48')]=_0x4e6868[_0xbe32('0x33')]['hasOwnProperty'](_0xbe32('0x48'))?_0x4e6868['body']['senderName']:_0x4e6868[_0xbe32('0x44')]['fullname'];_0x37ec3f[_0xbe32('0x49')]=_[_0xbe32('0x4a')](_0x4e6868[_0xbe32('0x33')]['recipientsDescription'])?null:_0x4e6868[_0xbe32('0x33')]['recipientsDescription'];_0x37ec3f[_0xbe32('0x4b')]=_0x4e6868[_0xbe32('0x33')][_0xbe32('0x4b')]||![];_0x37ec3f[_0xbe32('0x4c')]=_0x4e6868['user']['id'];return getContent(_0x4e6868[_0xbe32('0x33')])[_0xbe32('0x2d')](function(_0x5e9698){_0x37ec3f[_0xbe32('0x33')]=_0x5e9698;return getRecipients(_0x5cffab);})['then'](function(_0x144b64){_0x37ec3f[_0xbe32('0x4d')]=_[_0xbe32('0x4e')](_0x144b64)[_0xbe32('0x4f')](',');return db['sequelize'][_0xbe32('0x50')](function(_0x1b4792){return db[_0xbe32('0x51')][_0xbe32('0x52')](_0x37ec3f,{'raw':!![],'transaction':_0x1b4792})[_0xbe32('0x2d')](function(_0x5e0feb){var _0xcecf82={'sender':_0x37ec3f[_0xbe32('0x48')],'description':_0x37ec3f['recipientsDescription'],'content':_0x37ec3f[_0xbe32('0x33')],'beep':_0x37ec3f[_0xbe32('0x4b')]};_0x144b64[_0xbe32('0x53')](function(_0x3c9404){_0xcecf82['recipient']=_0x3c9404;socket[_0xbe32('0x54')](_0xbe32('0x55'),_0xcecf82);});return _0x5e0feb;});});})['then'](respondWithResult(_0x178d9d,0xc9))[_0xbe32('0x56')](handleError(_0x178d9d,null));};function getContent(_0x23bfb8){return new BPromise(function(_0x353a18,_0x367baa){if(_0x23bfb8['text']){_0x353a18(_0x23bfb8['text']);return;}return db[_0xbe32('0x57')][_0xbe32('0x58')]({'attributes':['html'],'where':{'id':_0x23bfb8[_0xbe32('0x36')]},'raw':!![]})[_0xbe32('0x2d')](function(_0x5ef860){if(!_0x5ef860)throw new db['Sequelize'][(_0xbe32('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x468f3a=Mustache[_0xbe32('0x59')](_0x5ef860[_0xbe32('0x5a')],_0x23bfb8[_0xbe32('0x39')]);_0x353a18(_0x468f3a);})[_0xbe32('0x56')](function(_0x1f959d){_0x367baa(_0x1f959d);});});}function getRecipients(_0x5a1a54){return new BPromise(function(_0x4ccfea,_0x2f43f1){var _0x46a36b=[];var _0x1972cc=[];_0x5a1a54[_0xbe32('0x53')](function(_0x62c15){var _0x5bf346=_[_0xbe32('0x5b')](_0x62c15[_0xbe32('0x5c')][_0xbe32('0x46')]());if(_0x5bf346===_0xbe32('0x5d')){_0x46a36b=_['union'](_0x46a36b,_0x62c15['ids']);}else{if(_[_0xbe32('0x45')](_0x5bf346,_0xbe32('0x5e')))_0x5bf346=_0x5bf346[_0xbe32('0x5f')]('queue',_0xbe32('0x60'));_0x62c15[_0xbe32('0x61')][_0xbe32('0x53')](function(_0x2ce348){_0x1972cc['push'](getAgents(_0x5bf346,_0x2ce348));});}});return BPromise[_0xbe32('0x62')](_0x1972cc)[_0xbe32('0x2d')](function(_0x37e9f1){_0x46a36b=_[_0xbe32('0x63')](_0x46a36b,_['flatten'](_0x37e9f1));_0x4ccfea(_0x46a36b);})['catch'](function(_0x4cc02d){_0x2f43f1(_0x4cc02d);});});}function getAgents(_0x27b678,_0x5162e0){return new BPromise(function(_0x5921c5,_0x357005){return db[_0x27b678]['findOne']({'where':{'id':_0x5162e0}})['then'](function(_0x9333da){return _0x9333da[_0xbe32('0x64')]({'attributes':['id'],'raw':!![]})['then'](function(_0x21a3a1){var _0x42bb68=_['map'](_0x21a3a1,'id');_0x5921c5(_0x42bb68);});})[_0xbe32('0x56')](function(_0x47a0bb){_0x357005(_0x47a0bb);});});} \ No newline at end of file +var _0x5d1c=['text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','replace','queue','ids','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch'];(function(_0xd185e0,_0x3cbebd){var _0x542252=function(_0x2bc721){while(--_0x2bc721){_0xd185e0['push'](_0xd185e0['shift']());}};_0x542252(++_0x3cbebd);}(_0x5d1c,0x196));var _0xc5d1=function(_0x485ad8,_0x2b40e1){_0x485ad8=_0x485ad8-0x0;var _0xf06b2=_0x5d1c[_0x485ad8];return _0xf06b2;};'use strict';var emlformat=require(_0xc5d1('0x0'));var rimraf=require(_0xc5d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5d1('0x2'));var rp=require(_0xc5d1('0x3'));var moment=require('moment');var BPromise=require(_0xc5d1('0x4'));var Mustache=require(_0xc5d1('0x5'));var util=require(_0xc5d1('0x6'));var path=require('path');var sox=require(_0xc5d1('0x7'));var csv=require('to-csv');var ejs=require(_0xc5d1('0x8'));var fs=require('fs');var fs_extra=require(_0xc5d1('0x9'));var _=require(_0xc5d1('0xa'));var squel=require(_0xc5d1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5d1('0xc'));var toCsv=require(_0xc5d1('0xd'));var querystring=require(_0xc5d1('0xe'));var Papa=require(_0xc5d1('0xf'));var Redis=require('ioredis');var authService=require(_0xc5d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc5d1('0x11'));var hardwareService=require(_0xc5d1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc5d1('0x13'));var licenseUtil=require(_0xc5d1('0x14'));var db=require(_0xc5d1('0x15'))['db'];config[_0xc5d1('0x16')]=_[_0xc5d1('0x17')](config[_0xc5d1('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5d1('0x18'))(new Redis(config[_0xc5d1('0x16')]));require(_0xc5d1('0x19'))[_0xc5d1('0x1a')](socket);function respondWithStatusCode(_0x37893e,_0x28a131){_0x28a131=_0x28a131||0xcc;return function(_0x49e344){if(_0x49e344){return _0x37893e[_0xc5d1('0x1b')](_0x28a131);}return _0x37893e['status'](_0x28a131)['end']();};}function respondWithResult(_0x40ed6f,_0x4fe156){_0x4fe156=_0x4fe156||0xc8;return function(_0x3570e2){if(_0x3570e2){return _0x40ed6f[_0xc5d1('0x1c')](_0x4fe156)[_0xc5d1('0x1d')](_0x3570e2);}};}function respondWithFilteredResult(_0x382677,_0x14898b){return function(_0x1c274c){if(_0x1c274c){var _0x13e176=typeof _0x14898b[_0xc5d1('0x1e')]===_0xc5d1('0x1f')&&typeof _0x14898b[_0xc5d1('0x20')]===_0xc5d1('0x1f');var _0x240a15=_0x1c274c['count'];var _0x35c793=_0x13e176?0x0:_0x14898b[_0xc5d1('0x1e')];var _0x5d8045=_0x13e176?_0x1c274c[_0xc5d1('0x21')]:_0x14898b[_0xc5d1('0x1e')]+_0x14898b['limit'];var _0x4c9bbc;if(_0x5d8045>=_0x240a15){_0x5d8045=_0x240a15;_0x4c9bbc=0xc8;}else{_0x4c9bbc=0xce;}_0x382677[_0xc5d1('0x1c')](_0x4c9bbc);return _0x382677['set'](_0xc5d1('0x22'),_0x35c793+'-'+_0x5d8045+'/'+_0x240a15)[_0xc5d1('0x1d')](_0x1c274c);}return null;};}function patchUpdates(_0x3c4db4){return function(_0x3c6a8c){try{jsonpatch[_0xc5d1('0x23')](_0x3c6a8c,_0x3c4db4,!![]);}catch(_0x24c621){return BPromise[_0xc5d1('0x24')](_0x24c621);}return _0x3c6a8c[_0xc5d1('0x25')]();};}function saveUpdates(_0x4a7bd7,_0x4beeba){return function(_0xc19ae1){if(_0xc19ae1){return _0xc19ae1[_0xc5d1('0x26')](_0x4a7bd7)[_0xc5d1('0x27')](function(_0x3c1f94){return _0x3c1f94;});}return null;};}function removeEntity(_0x2a5e28,_0x29418b){return function(_0x4ee3d5){if(_0x4ee3d5){return _0x4ee3d5['destroy']()['then'](function(){_0x2a5e28[_0xc5d1('0x1c')](0xcc)[_0xc5d1('0x28')]();});}};}function handleEntityNotFound(_0x18b8f8,_0x46d11e){return function(_0xbc803){if(!_0xbc803){_0x18b8f8[_0xc5d1('0x1b')](0x194);}return _0xbc803;};}function handleError(_0x3b9fa6,_0x11a8c7){_0x11a8c7=_0x11a8c7||0x1f4;return function(_0x24f1a2){logger[_0xc5d1('0x29')](_0x24f1a2[_0xc5d1('0x2a')]);if(_0x24f1a2[_0xc5d1('0x2b')]){delete _0x24f1a2[_0xc5d1('0x2b')];}_0x3b9fa6[_0xc5d1('0x1c')](_0x11a8c7)[_0xc5d1('0x2c')](_0x24f1a2);};}exports[_0xc5d1('0x2d')]=function(_0x3b67c7,_0x39c0a4,_0x3d7ea7){if(!_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x2f')]('text')&&!_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x2f')](_0xc5d1('0x30'))){throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))](_0xc5d1('0x33'));}else{if(_0x3b67c7[_0xc5d1('0x2e')]['hasOwnProperty'](_0xc5d1('0x30'))&&!_0x3b67c7[_0xc5d1('0x2e')]['hasOwnProperty'](_0xc5d1('0x34'))){throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x2f')](_0xc5d1('0x35'))){throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x385856=JSON[_0xc5d1('0x36')](_0x3b67c7['body']['recipients']);}catch(_0x4b4675){logger['error'](_0x4b4675);throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))](_0xc5d1('0x37'));}var _0x34e9eb=[_0xc5d1('0x38'),_0xc5d1('0x39'),_0xc5d1('0x3a'),'openchannelqueue','smsqueue','voicequeue',_0xc5d1('0x3b'),_0xc5d1('0x3c'),'user'];if(_[_0xc5d1('0x3d')](_0x385856,function(_0x5e8946){return!_[_0xc5d1('0x3e')](_0x34e9eb,_0x5e8946[_0xc5d1('0x3f')][_0xc5d1('0x40')]());})){throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))](_0xc5d1('0x41'));}}}var _0x1510db={};_0x1510db[_0xc5d1('0x42')]=_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x2f')]('senderName')?_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x42')]:_0x3b67c7[_0xc5d1('0x43')][_0xc5d1('0x44')];_0x1510db[_0xc5d1('0x45')]=_['isEmpty'](_0x3b67c7[_0xc5d1('0x2e')][_0xc5d1('0x45')])?null:_0x3b67c7[_0xc5d1('0x2e')]['recipientsDescription'];_0x1510db[_0xc5d1('0x46')]=_0x3b67c7[_0xc5d1('0x2e')]['beep']||![];_0x1510db[_0xc5d1('0x47')]=_0x3b67c7[_0xc5d1('0x43')]['id'];return getContent(_0x3b67c7[_0xc5d1('0x2e')])[_0xc5d1('0x27')](function(_0x54d952){_0x1510db[_0xc5d1('0x2e')]=_0x54d952;return getRecipients(_0x385856);})[_0xc5d1('0x27')](function(_0x57ffe3){_0x1510db[_0xc5d1('0x48')]=_[_0xc5d1('0x49')](_0x57ffe3)[_0xc5d1('0x4a')](',');return db[_0xc5d1('0x4b')][_0xc5d1('0x4c')](function(_0x2bc3e2){return db[_0xc5d1('0x4d')][_0xc5d1('0x4e')](_0x1510db,{'raw':!![],'transaction':_0x2bc3e2})[_0xc5d1('0x27')](function(_0x12d1f1){var _0x41cda0={'sender':_0x1510db['senderName'],'description':_0x1510db[_0xc5d1('0x45')],'content':_0x1510db['body'],'beep':_0x1510db['beep']};_0x57ffe3[_0xc5d1('0x4f')](function(_0x205ef6){_0x41cda0[_0xc5d1('0x50')]=_0x205ef6;socket[_0xc5d1('0x51')](_0xc5d1('0x52'),_0x41cda0);});return _0x12d1f1;});});})[_0xc5d1('0x27')](respondWithResult(_0x39c0a4,0xc9))[_0xc5d1('0x53')](handleError(_0x39c0a4,null));};function getContent(_0x150c2f){return new BPromise(function(_0x5e5cee,_0x271330){if(_0x150c2f[_0xc5d1('0x54')]){_0x5e5cee(_0x150c2f[_0xc5d1('0x54')]);return;}return db['Template'][_0xc5d1('0x55')]({'attributes':[_0xc5d1('0x56')],'where':{'id':_0x150c2f[_0xc5d1('0x30')]},'raw':!![]})[_0xc5d1('0x27')](function(_0x446c1d){if(!_0x446c1d)throw new db[(_0xc5d1('0x31'))][(_0xc5d1('0x32'))](_0xc5d1('0x57'));var _0x339e28=Mustache[_0xc5d1('0x58')](_0x446c1d[_0xc5d1('0x56')],_0x150c2f['view']);_0x5e5cee(_0x339e28);})[_0xc5d1('0x53')](function(_0x271397){_0x271330(_0x271397);});});}function getRecipients(_0x8d6004){return new BPromise(function(_0x156a61,_0x7051a5){var _0x242d6b=[];var _0x2b4c59=[];_0x8d6004[_0xc5d1('0x4f')](function(_0x10eb31){var _0x36286e=_[_0xc5d1('0x59')](_0x10eb31[_0xc5d1('0x3f')][_0xc5d1('0x40')]());if(_0x36286e===_0xc5d1('0x5a')){_0x242d6b=_['union'](_0x242d6b,_0x10eb31['ids']);}else{if(_[_0xc5d1('0x3e')](_0x36286e,'queue'))_0x36286e=_0x36286e[_0xc5d1('0x5b')](_0xc5d1('0x5c'),'Queue');_0x10eb31[_0xc5d1('0x5d')][_0xc5d1('0x4f')](function(_0x5f3d16){_0x2b4c59['push'](getAgents(_0x36286e,_0x5f3d16));});}});return BPromise[_0xc5d1('0x5e')](_0x2b4c59)['then'](function(_0x4103fd){_0x242d6b=_['union'](_0x242d6b,_[_0xc5d1('0x5f')](_0x4103fd));_0x156a61(_0x242d6b);})[_0xc5d1('0x53')](function(_0x53dc90){_0x7051a5(_0x53dc90);});});}function getAgents(_0x421234,_0x39ac30){return new BPromise(function(_0x46c0f5,_0x5e3190){return db[_0x421234][_0xc5d1('0x55')]({'where':{'id':_0x39ac30}})[_0xc5d1('0x27')](function(_0x2b2a3b){return _0x2b2a3b[_0xc5d1('0x60')]({'attributes':['id'],'raw':!![]})[_0xc5d1('0x27')](function(_0x29d41a){var _0x398656=_[_0xc5d1('0x61')](_0x29d41a,'id');_0x46c0f5(_0x398656);});})[_0xc5d1('0x53')](function(_0x152d1b){_0x5e3190(_0x152d1b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6ab2860..cac350d 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 _0x6f4b=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports'];(function(_0x22a189,_0x1beb71){var _0x516789=function(_0x11d94c){while(--_0x11d94c){_0x22a189['push'](_0x22a189['shift']());}};_0x516789(++_0x1beb71);}(_0x6f4b,0x19d));var _0xb6f4=function(_0x310e5b,_0x486cf4){_0x310e5b=_0x310e5b-0x0;var _0x8273b8=_0x6f4b[_0x310e5b];return _0x8273b8;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xb6f4('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb6f4('0x1')](0x0);var events={'afterCreate':_0xb6f4('0x2'),'afterUpdate':_0xb6f4('0x3'),'afterDestroy':_0xb6f4('0x4')};function emitEvent(_0x4480c5){return function(_0x5d2203,_0x492050,_0x3ee305){UserNotificationEvents['emit'](_0x4480c5+':'+_0x5d2203['id'],_0x5d2203);UserNotificationEvents[_0xb6f4('0x5')](_0x4480c5,_0x5d2203);_0x3ee305(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xb6f4('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x19b1=['UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1d1080,_0x246e89){var _0x154935=function(_0xc914e8){while(--_0xc914e8){_0x1d1080['push'](_0x1d1080['shift']());}};_0x154935(++_0x246e89);}(_0x19b1,0x6c));var _0x119b=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x19b1[_0x3bf925];return _0x2128a1;};'use strict';var EventEmitter=require(_0x119b('0x0'));var UserNotification=require(_0x119b('0x1'))['db'][_0x119b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x119b('0x3')](0x0);var events={'afterCreate':_0x119b('0x4'),'afterUpdate':'update','afterDestroy':_0x119b('0x5')};function emitEvent(_0x4f585a){return function(_0x93264,_0x4e5339,_0x4bc1c2){UserNotificationEvents[_0x119b('0x6')](_0x4f585a+':'+_0x93264['id'],_0x93264);UserNotificationEvents[_0x119b('0x6')](_0x4f585a,_0x93264);_0x4bc1c2(null);};}for(var e in events){if(events[_0x119b('0x7')](e)){var event=events[e];UserNotification[_0x119b('0x8')](e,emitEvent(event));}}module[_0x119b('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 027c096..b3752c7 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 _0x539c=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x539c,0xf2));var _0xc539=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x539c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc539('0x0'));var util=require(_0xc539('0x1'));var logger=require(_0xc539('0x2'))(_0xc539('0x3'));var moment=require(_0xc539('0x4'));var BPromise=require(_0xc539('0x5'));var rp=require(_0xc539('0x6'));var fs=require('fs');var path=require(_0xc539('0x7'));var rimraf=require(_0xc539('0x8'));var config=require(_0xc539('0x9'));var attributes=require(_0xc539('0xa'));module[_0xc539('0xb')]=function(_0x3b1781,_0xbe768){return _0x3b1781['define'](_0xc539('0xc'),attributes,{'tableName':_0xc539('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc539('0xe'),'collate':_0xc539('0xf')});}; \ No newline at end of file +var _0xf381=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x544e72,_0x1bb114){var _0x1e0738=function(_0x3545e1){while(--_0x3545e1){_0x544e72['push'](_0x544e72['shift']());}};_0x1e0738(++_0x1bb114);}(_0xf381,0xf9));var _0x1f38=function(_0x1e3bfe,_0x3f9431){_0x1e3bfe=_0x1e3bfe-0x0;var _0x315c29=_0xf381[_0x1e3bfe];return _0x315c29;};'use strict';var _=require(_0x1f38('0x0'));var util=require(_0x1f38('0x1'));var logger=require(_0x1f38('0x2'))(_0x1f38('0x3'));var moment=require(_0x1f38('0x4'));var BPromise=require(_0x1f38('0x5'));var rp=require(_0x1f38('0x6'));var fs=require('fs');var path=require(_0x1f38('0x7'));var rimraf=require(_0x1f38('0x8'));var config=require(_0x1f38('0x9'));var attributes=require(_0x1f38('0xa'));module[_0x1f38('0xb')]=function(_0x2bb3f4,_0x3c258c){return _0x2bb3f4[_0x1f38('0xc')](_0x1f38('0xd'),attributes,{'tableName':_0x1f38('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1f38('0xf')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d68ef84..95395d0 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 _0x1f83=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/environment','jayson/promise','redis','localhost','./userNotification.socket','register','request'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x1f83,0x15d));var _0x31f8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1f83[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x31f8('0x0'));var util=require('util');var moment=require(_0x31f8('0x1'));var BPromise=require(_0x31f8('0x2'));var rs=require(_0x31f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x31f8('0x4'));var jayson=require(_0x31f8('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x31f8('0x6')],{'host':_0x31f8('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31f8('0x6')]));require(_0x31f8('0x8'))[_0x31f8('0x9')](socket);function respondWithRpcPromise(_0x331871,_0x377e4d,_0x1499ff){return new BPromise(function(_0x7fa773,_0x4c6df4){return client[_0x31f8('0xa')](_0x331871,_0x1499ff)['then'](function(_0x23ad8f){logger['info']('UserNotification,\x20%s,\x20%s',_0x377e4d,_0x31f8('0xb'));logger[_0x31f8('0xc')](_0x31f8('0xd'),_0x377e4d,_0x31f8('0xb'),JSON['stringify'](_0x23ad8f));if(_0x23ad8f[_0x31f8('0xe')]){if(_0x23ad8f[_0x31f8('0xe')][_0x31f8('0xf')]===0x1f4){logger['error'](_0x31f8('0x10'),_0x377e4d,_0x23ad8f['error'][_0x31f8('0x11')]);return _0x4c6df4(_0x23ad8f[_0x31f8('0xe')][_0x31f8('0x11')]);}logger[_0x31f8('0xe')](_0x31f8('0x10'),_0x377e4d,_0x23ad8f[_0x31f8('0xe')]['message']);return _0x7fa773(_0x23ad8f[_0x31f8('0xe')][_0x31f8('0x11')]);}else{logger[_0x31f8('0x12')](_0x31f8('0x10'),_0x377e4d,_0x31f8('0xb'));_0x7fa773(_0x23ad8f['result']['message']);}})[_0x31f8('0x13')](function(_0xf308a3){logger[_0x31f8('0xe')](_0x31f8('0x10'),_0x377e4d,_0xf308a3);_0x4c6df4(_0xf308a3);});});} \ No newline at end of file +var _0xda13=['localhost','socket.io-emitter','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x54988b,_0x4e15d2){var _0x58227c=function(_0x53418f){while(--_0x53418f){_0x54988b['push'](_0x54988b['shift']());}};_0x58227c(++_0x4e15d2);}(_0xda13,0x139));var _0x3da1=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xda13[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x3da1('0x0'));var util=require('util');var moment=require(_0x3da1('0x1'));var BPromise=require(_0x3da1('0x2'));var rs=require(_0x3da1('0x3'));var fs=require('fs');var Redis=require(_0x3da1('0x4'));var db=require(_0x3da1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3da1('0x6'))(_0x3da1('0x7'));var config=require(_0x3da1('0x8'));var jayson=require(_0x3da1('0x9'));var client=jayson[_0x3da1('0xa')]['http']({'port':0x232a});config[_0x3da1('0xb')]=_['defaults'](config[_0x3da1('0xb')],{'host':_0x3da1('0xc'),'port':0x18eb});var socket=require(_0x3da1('0xd'))(new Redis(config['redis']));require(_0x3da1('0xe'))['register'](socket);function respondWithRpcPromise(_0x56c9b9,_0x12e253,_0x135027){return new BPromise(function(_0x2a6f0f,_0x4c45a2){return client[_0x3da1('0xf')](_0x56c9b9,_0x135027)[_0x3da1('0x10')](function(_0x4717ab){logger['info'](_0x3da1('0x11'),_0x12e253,'request\x20sent');logger[_0x3da1('0x12')](_0x3da1('0x13'),_0x12e253,_0x3da1('0x14'),JSON[_0x3da1('0x15')](_0x4717ab));if(_0x4717ab[_0x3da1('0x16')]){if(_0x4717ab[_0x3da1('0x16')]['code']===0x1f4){logger[_0x3da1('0x16')]('UserNotification,\x20%s,\x20%s',_0x12e253,_0x4717ab[_0x3da1('0x16')][_0x3da1('0x17')]);return _0x4c45a2(_0x4717ab[_0x3da1('0x16')][_0x3da1('0x17')]);}logger[_0x3da1('0x16')](_0x3da1('0x11'),_0x12e253,_0x4717ab[_0x3da1('0x16')][_0x3da1('0x17')]);return _0x2a6f0f(_0x4717ab['error'][_0x3da1('0x17')]);}else{logger['info'](_0x3da1('0x11'),_0x12e253,'request\x20sent');_0x2a6f0f(_0x4717ab['result'][_0x3da1('0x17')]);}})[_0x3da1('0x18')](function(_0x16faaf){logger[_0x3da1('0x16')](_0x3da1('0x11'),_0x12e253,_0x16faaf);_0x4c45a2(_0x16faaf);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index bd6ac9c..02c2d59 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 _0x6c2e=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x17554a,_0x23a3f9){var _0x4d0f22=function(_0x2dc62e){while(--_0x2dc62e){_0x17554a['push'](_0x17554a['shift']());}};_0x4d0f22(++_0x23a3f9);}(_0x6c2e,0xf6));var _0xe6c2=function(_0x317ac8,_0x103239){_0x317ac8=_0x317ac8-0x0;var _0x57c690=_0x6c2e[_0x317ac8];return _0x57c690;};'use strict';var UserNotificationEvents=require(_0xe6c2('0x0'));var events=[_0xe6c2('0x1'),'remove',_0xe6c2('0x2')];function createListener(_0x248c88,_0x486a1e){return function(_0x4650f3){_0x486a1e[_0xe6c2('0x3')](_0x248c88,_0x4650f3);};}function removeListener(_0x2479cd,_0x397723){return function(){UserNotificationEvents[_0xe6c2('0x4')](_0x2479cd,_0x397723);};}exports[_0xe6c2('0x5')]=function(_0x12997d){for(var _0x537030=0x0,_0x4501a4=events[_0xe6c2('0x6')];_0x537030<_0x4501a4;_0x537030++){var _0x103a32=events[_0x537030];var _0x5577d1=createListener(_0xe6c2('0x7')+_0x103a32,_0x12997d);UserNotificationEvents['on'](_0x103a32,_0x5577d1);}}; \ No newline at end of file +var _0x3ed5=['register','userNotification:','./userNotification.events','save','remove','update','emit'];(function(_0x5d2b6e,_0x3bdb2e){var _0x4bc8c6=function(_0x41ca85){while(--_0x41ca85){_0x5d2b6e['push'](_0x5d2b6e['shift']());}};_0x4bc8c6(++_0x3bdb2e);}(_0x3ed5,0x6b));var _0x53ed=function(_0x466c65,_0x1840f8){_0x466c65=_0x466c65-0x0;var _0x196935=_0x3ed5[_0x466c65];return _0x196935;};'use strict';var UserNotificationEvents=require(_0x53ed('0x0'));var events=[_0x53ed('0x1'),_0x53ed('0x2'),_0x53ed('0x3')];function createListener(_0x32b8b6,_0x5459af){return function(_0x198c14){_0x5459af[_0x53ed('0x4')](_0x32b8b6,_0x198c14);};}function removeListener(_0x34a8c1,_0x5243b4){return function(){UserNotificationEvents['removeListener'](_0x34a8c1,_0x5243b4);};}exports[_0x53ed('0x5')]=function(_0x59244d){for(var _0x55e9a8=0x0,_0x1a38e7=events['length'];_0x55e9a8<_0x1a38e7;_0x55e9a8++){var _0x5ec14b=events[_0x55e9a8];var _0x5984f9=createListener(_0x53ed('0x6')+_0x5ec14b,_0x59244d);UserNotificationEvents['on'](_0x5ec14b,_0x5984f9);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index caaec12..87c51fa 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d2f21,_0x4b50fc){var _0x1b9641=function(_0x4bab94){while(--_0x4bab94){_0x2d2f21['push'](_0x2d2f21['shift']());}};_0x1b9641(++_0x4b50fc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0xcb91[_0x42bafd];return _0x2ed705;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x260fb9,_0x2bc9da){var _0x5326af=function(_0x3f00ae){while(--_0x3f00ae){_0x260fb9['push'](_0x260fb9['shift']());}};_0x5326af(++_0x2bc9da);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 84493c7..1402402 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 _0x1768=['sequelize','exports'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x1768,0x1d2));var _0x8176=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x1768[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x8176('0x0'));module[_0x8176('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1b6=['INTEGER','sequelize','exports'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xc1b6,0x124));var _0x6c1b=function(_0x1e2f72,_0x4ecd3d){_0x1e2f72=_0x1e2f72-0x0;var _0x2f00a8=_0xc1b6[_0x1e2f72];return _0x2f00a8;};'use strict';var Sequelize=require(_0x6c1b('0x0'));module[_0x6c1b('0x1')]={'penalty':{'type':Sequelize[_0x6c1b('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 76e4a3c..9b78dc2 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 _0x8d83=['lodash','util','api','moment','bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x8d83,0xb0));var _0x38d8=function(_0x591bda,_0x5284df){_0x591bda=_0x591bda-0x0;var _0x2a6696=_0x8d83[_0x591bda];return _0x2a6696;};'use strict';var _=require(_0x38d8('0x0'));var util=require(_0x38d8('0x1'));var logger=require('../../config/logger')(_0x38d8('0x2'));var moment=require(_0x38d8('0x3'));var BPromise=require(_0x38d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38d8('0x5'));var rimraf=require(_0x38d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x38d8('0x7'));module[_0x38d8('0x8')]=function(_0x217b44,_0x317e0c){return _0x217b44['define'](_0x38d8('0x9'),attributes,{'tableName':_0x38d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae95=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xae95,0x170));var _0x5ae9=function(_0x4802f6,_0x57c317){_0x4802f6=_0x4802f6-0x0;var _0x56b041=_0xae95[_0x4802f6];return _0x56b041;};'use strict';var _=require('lodash');var util=require(_0x5ae9('0x0'));var logger=require(_0x5ae9('0x1'))(_0x5ae9('0x2'));var moment=require(_0x5ae9('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ae9('0x4'));var fs=require('fs');var path=require(_0x5ae9('0x5'));var rimraf=require(_0x5ae9('0x6'));var config=require(_0x5ae9('0x7'));var attributes=require(_0x5ae9('0x8'));module['exports']=function(_0x3412b1,_0x465eeb){return _0x3412b1['define'](_0x5ae9('0x9'),attributes,{'tableName':_0x5ae9('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 af007f1..9442e96 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 _0x977d=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','UserOpenchannelQueue,\x20%s,\x20%s','error','message','result'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x977d,0x6f));var _0xd977=function(_0x2c16eb,_0x5d6e50){_0x2c16eb=_0x2c16eb-0x0;var _0x18c39d=_0x977d[_0x2c16eb];return _0x18c39d;};'use strict';var _=require(_0xd977('0x0'));var util=require('util');var moment=require(_0xd977('0x1'));var BPromise=require('bluebird');var rs=require(_0xd977('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd977('0x3'))['db'];var utils=require(_0xd977('0x4'));var logger=require(_0xd977('0x5'))(_0xd977('0x6'));var config=require('../../config/environment');var jayson=require(_0xd977('0x7'));var client=jayson[_0xd977('0x8')][_0xd977('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f9ce3,_0x3b2d28,_0x50af86){return new BPromise(function(_0x2bfdad,_0x285cff){return client[_0xd977('0xa')](_0x6f9ce3,_0x50af86)[_0xd977('0xb')](function(_0xf08b8e){logger[_0xd977('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3b2d28,_0xd977('0xd'));logger[_0xd977('0xe')](_0xd977('0xf'),_0x3b2d28,_0xd977('0xd'),JSON[_0xd977('0x10')](_0xf08b8e));if(_0xf08b8e['error']){if(_0xf08b8e['error']['code']===0x1f4){logger['error'](_0xd977('0x11'),_0x3b2d28,_0xf08b8e[_0xd977('0x12')][_0xd977('0x13')]);return _0x285cff(_0xf08b8e[_0xd977('0x12')][_0xd977('0x13')]);}logger[_0xd977('0x12')](_0xd977('0x11'),_0x3b2d28,_0xf08b8e[_0xd977('0x12')][_0xd977('0x13')]);return _0x2bfdad(_0xf08b8e[_0xd977('0x12')]['message']);}else{logger[_0xd977('0xc')](_0xd977('0x11'),_0x3b2d28,'request\x20sent');_0x2bfdad(_0xf08b8e[_0xd977('0x14')]['message']);}})[_0xd977('0x15')](function(_0x49573b){logger['error'](_0xd977('0x11'),_0x3b2d28,_0x49573b);_0x285cff(_0x49573b);});});} \ No newline at end of file +var _0x3544=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0x3544,0xb0));var _0x4354=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x3544[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require(_0x4354('0x0'));var util=require(_0x4354('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4354('0x2'));var fs=require('fs');var Redis=require(_0x4354('0x3'));var db=require(_0x4354('0x4'))['db'];var utils=require(_0x4354('0x5'));var logger=require('../../config/logger')(_0x4354('0x6'));var config=require(_0x4354('0x7'));var jayson=require(_0x4354('0x8'));var client=jayson['client'][_0x4354('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3938f4,_0x751283,_0x289056){return new BPromise(function(_0x4b9530,_0x44b450){return client[_0x4354('0xa')](_0x3938f4,_0x289056)['then'](function(_0x588a86){logger[_0x4354('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x751283,_0x4354('0xc'));logger[_0x4354('0xd')](_0x4354('0xe'),_0x751283,_0x4354('0xc'),JSON['stringify'](_0x588a86));if(_0x588a86['error']){if(_0x588a86[_0x4354('0xf')][_0x4354('0x10')]===0x1f4){logger[_0x4354('0xf')](_0x4354('0x11'),_0x751283,_0x588a86[_0x4354('0xf')][_0x4354('0x12')]);return _0x44b450(_0x588a86['error']['message']);}logger[_0x4354('0xf')](_0x4354('0x11'),_0x751283,_0x588a86['error'][_0x4354('0x12')]);return _0x4b9530(_0x588a86[_0x4354('0xf')][_0x4354('0x12')]);}else{logger[_0x4354('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x751283,_0x4354('0xc'));_0x4b9530(_0x588a86[_0x4354('0x13')][_0x4354('0x12')]);}})['catch'](function(_0x32ac07){logger[_0x4354('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x751283,_0x32ac07);_0x44b450(_0x32ac07);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a25365d..098d33a 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 _0x1195=['destroy','removeSections','removeResources','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','isAuthenticated','show','/:id/sections','/:id/resources','getResources','post','clone','addResources','update','delete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1195,0xc4));var _0x5119=function(_0x2977e8,_0x257939){_0x2977e8=_0x2977e8-0x0;var _0x9da807=_0x1195[_0x2977e8];return _0x9da807;};'use strict';var multer=require(_0x5119('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5119('0x1'));var express=require(_0x5119('0x2'));var router=express['Router']();var fs_extra=require(_0x5119('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5119('0x4'));var config=require(_0x5119('0x5'));var controller=require('./userProfile.controller');router[_0x5119('0x6')]('/',auth['isAuthenticated'](),controller[_0x5119('0x7')]);router[_0x5119('0x6')](_0x5119('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5119('0x6')](_0x5119('0x9'),auth[_0x5119('0xa')](),controller[_0x5119('0xb')]);router['get'](_0x5119('0xc'),auth[_0x5119('0xa')](),controller['getSections']);router[_0x5119('0x6')](_0x5119('0xd'),auth[_0x5119('0xa')](),controller[_0x5119('0xe')]);router[_0x5119('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5119('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x5119('0x10')]);router[_0x5119('0xf')](_0x5119('0xc'),auth[_0x5119('0xa')](),controller['addSections']);router[_0x5119('0xf')](_0x5119('0xd'),auth['isAuthenticated'](),controller[_0x5119('0x11')]);router['put']('/:id',auth[_0x5119('0xa')](),controller[_0x5119('0x12')]);router[_0x5119('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5119('0x14')]);router[_0x5119('0x13')](_0x5119('0xc'),auth[_0x5119('0xa')](),controller[_0x5119('0x15')]);router[_0x5119('0x13')](_0x5119('0xd'),auth[_0x5119('0xa')](),controller[_0x5119('0x16')]);module[_0x5119('0x17')]=router; \ No newline at end of file +var _0x3a9a=['/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','/:id/sections','getSections','/:id/resources','post','create'];(function(_0x1851cf,_0x3f7a64){var _0x42b0a6=function(_0x11b5f6){while(--_0x11b5f6){_0x1851cf['push'](_0x1851cf['shift']());}};_0x42b0a6(++_0x3f7a64);}(_0x3a9a,0x122));var _0xa3a9=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x3a9a[_0x25d386];return _0x857f4a;};'use strict';var multer=require(_0xa3a9('0x0'));var util=require('util');var path=require(_0xa3a9('0x1'));var timeout=require(_0xa3a9('0x2'));var express=require(_0xa3a9('0x3'));var router=express[_0xa3a9('0x4')]();var fs_extra=require(_0xa3a9('0x5'));var auth=require(_0xa3a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa3a9('0x7'));var controller=require('./userProfile.controller');router[_0xa3a9('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3a9('0x9')]);router[_0xa3a9('0x8')](_0xa3a9('0xa'),auth[_0xa3a9('0xb')](),controller['describe']);router[_0xa3a9('0x8')](_0xa3a9('0xc'),auth[_0xa3a9('0xb')](),controller['show']);router[_0xa3a9('0x8')](_0xa3a9('0xd'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('0xe')]);router[_0xa3a9('0x8')](_0xa3a9('0xf'),auth[_0xa3a9('0xb')](),controller['getResources']);router[_0xa3a9('0x10')]('/',auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x11')]);router[_0xa3a9('0x10')](_0xa3a9('0x12'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x13')]);router['post'](_0xa3a9('0xd'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x14')]);router[_0xa3a9('0x10')](_0xa3a9('0xf'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x15')]);router[_0xa3a9('0x16')](_0xa3a9('0xc'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x17')]);router[_0xa3a9('0x18')](_0xa3a9('0xc'),auth['isAuthenticated'](),controller[_0xa3a9('0x19')]);router[_0xa3a9('0x18')]('/:id/sections',auth[_0xa3a9('0xb')](),controller[_0xa3a9('0x1a')]);router[_0xa3a9('0x18')](_0xa3a9('0xf'),auth[_0xa3a9('0xb')](),controller[_0xa3a9('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 f29c605..18f14aa 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 _0x7369=['STRING','name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x7369,0x1f2));var _0x9736=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7369[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x9736('0x0'));module[_0x9736('0x1')]={'name':{'type':Sequelize[_0x9736('0x2')],'allowNull':![],'unique':_0x9736('0x3')},'crudPermissions':{'type':Sequelize[_0x9736('0x2')],'set':function(_0x1b0836){this[_0x9736('0x4')]('crudPermissions',_0x1b0836?_0x1b0836[_0x9736('0x5')](''):[]);},'get':function(){return this[_0x9736('0x6')](_0x9736('0x7'))?this['getDataValue'](_0x9736('0x7'))[_0x9736('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9736('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x9736('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9736('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4b5f=['name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','exports','STRING'];(function(_0x408c54,_0x4d1cbf){var _0x38ee86=function(_0xe1eb48){while(--_0xe1eb48){_0x408c54['push'](_0x408c54['shift']());}};_0x38ee86(++_0x4d1cbf);}(_0x4b5f,0x139));var _0xf4b5=function(_0x279095,_0x15f37e){_0x279095=_0x279095-0x0;var _0x5a5cdb=_0x4b5f[_0x279095];return _0x5a5cdb;};'use strict';var Sequelize=require('sequelize');module[_0xf4b5('0x0')]={'name':{'type':Sequelize[_0xf4b5('0x1')],'allowNull':![],'unique':_0xf4b5('0x2')},'crudPermissions':{'type':Sequelize[_0xf4b5('0x1')],'set':function(_0x520064){this[_0xf4b5('0x3')]('crudPermissions',_0x520064?_0x520064[_0xf4b5('0x4')](''):[]);},'get':function(){return this[_0xf4b5('0x5')]('crudPermissions')?this['getDataValue'](_0xf4b5('0x6'))[_0xf4b5('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf4b5('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf4b5('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 637971f..4254470 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 _0xfce6=['bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','end','error','stack','name','map','UserProfile','rawAttributes','fieldName','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','create','clone','find','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','autoAssociation','omit','sectionId','Resources','destroy','describe','addSections','each','UserProfileResource','push','get','ids','getSections','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','Plugin','addResources','userProfileId'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xfce6,0x75));var _0x6fce=function(_0x6c8051,_0x3f612b){_0x6c8051=_0x6c8051-0x0;var _0x459102=_0xfce6[_0x6c8051];return _0x459102;};'use strict';var emlformat=require(_0x6fce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fce('0x1'));var jsonpatch=require(_0x6fce('0x2'));var rp=require(_0x6fce('0x3'));var moment=require(_0x6fce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6fce('0x5'));var util=require(_0x6fce('0x6'));var path=require(_0x6fce('0x7'));var sox=require(_0x6fce('0x8'));var csv=require(_0x6fce('0x9'));var ejs=require(_0x6fce('0xa'));var fs=require('fs');var fs_extra=require(_0x6fce('0xb'));var _=require(_0x6fce('0xc'));var squel=require(_0x6fce('0xd'));var crypto=require('crypto');var jsforce=require(_0x6fce('0xe'));var deskjs=require(_0x6fce('0xf'));var toCsv=require(_0x6fce('0x9'));var querystring=require(_0x6fce('0x10'));var Papa=require(_0x6fce('0x11'));var Redis=require(_0x6fce('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6fce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fce('0x14'));var logger=require(_0x6fce('0x15'))(_0x6fce('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6fce('0x17'));var db=require('../../mysqldb')['db'];config[_0x6fce('0x18')]=_[_0x6fce('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6fce('0x1a'))(new Redis(config[_0x6fce('0x18')]));require(_0x6fce('0x1b'))[_0x6fce('0x1c')](socket);function respondWithStatusCode(_0x500ee0,_0x431807){_0x431807=_0x431807||0xcc;return function(_0x846434){if(_0x846434){return _0x500ee0[_0x6fce('0x1d')](_0x431807);}return _0x500ee0['status'](_0x431807)['end']();};}function respondWithResult(_0x4f5dc3,_0x459d89){_0x459d89=_0x459d89||0xc8;return function(_0x3ad61b){if(_0x3ad61b){return _0x4f5dc3[_0x6fce('0x1e')](_0x459d89)[_0x6fce('0x1f')](_0x3ad61b);}};}function respondWithFilteredResult(_0xc138de,_0xf3d1d4){return function(_0x2d4ba5){if(_0x2d4ba5){var _0x3d9b43=typeof _0xf3d1d4['offset']===_0x6fce('0x20')&&typeof _0xf3d1d4['limit']==='undefined';var _0x487640=_0x2d4ba5[_0x6fce('0x21')];var _0xded867=_0x3d9b43?0x0:_0xf3d1d4[_0x6fce('0x22')];var _0x4100b4=_0x3d9b43?_0x2d4ba5['count']:_0xf3d1d4[_0x6fce('0x22')]+_0xf3d1d4[_0x6fce('0x23')];var _0x2810b8;if(_0x4100b4>=_0x487640){_0x4100b4=_0x487640;_0x2810b8=0xc8;}else{_0x2810b8=0xce;}_0xc138de[_0x6fce('0x1e')](_0x2810b8);return _0xc138de[_0x6fce('0x24')](_0x6fce('0x25'),_0xded867+'-'+_0x4100b4+'/'+_0x487640)[_0x6fce('0x1f')](_0x2d4ba5);}return null;};}function patchUpdates(_0x5927c5){return function(_0x5e3b7d){try{jsonpatch['apply'](_0x5e3b7d,_0x5927c5,!![]);}catch(_0x1f8df4){return BPromise['reject'](_0x1f8df4);}return _0x5e3b7d[_0x6fce('0x26')]();};}function saveUpdates(_0x1774f6,_0x243922){return function(_0x2e82fb){if(_0x2e82fb){return _0x2e82fb[_0x6fce('0x27')](_0x1774f6)['then'](function(_0x3202ce){return _0x3202ce;});}return null;};}function removeEntity(_0x4670c6,_0x5e43e2){return function(_0xe5188d){if(_0xe5188d){return _0xe5188d['destroy']()[_0x6fce('0x28')](function(){_0x4670c6['status'](0xcc)[_0x6fce('0x29')]();});}};}function handleEntityNotFound(_0xc5f8c9,_0x430927){return function(_0x39c4af){if(!_0x39c4af){_0xc5f8c9['sendStatus'](0x194);}return _0x39c4af;};}function handleError(_0x2ba228,_0x5d517a){_0x5d517a=_0x5d517a||0x1f4;return function(_0x5e1769){logger[_0x6fce('0x2a')](_0x5e1769[_0x6fce('0x2b')]);if(_0x5e1769[_0x6fce('0x2c')]){delete _0x5e1769[_0x6fce('0x2c')];}_0x2ba228[_0x6fce('0x1e')](_0x5d517a)['send'](_0x5e1769);};}exports['index']=function(_0x38aa6a,_0x428968){var _0x4b323a={},_0x40be5f={},_0x30b769={'count':0x0,'rows':[]};var _0x3b355e=_[_0x6fce('0x2d')](db[_0x6fce('0x2e')][_0x6fce('0x2f')],function(_0x3143ec){return{'name':_0x3143ec[_0x6fce('0x30')],'type':_0x3143ec['type'][_0x6fce('0x31')]};});_0x40be5f['model']=_[_0x6fce('0x2d')](_0x3b355e,_0x6fce('0x2c'));_0x40be5f['query']=_[_0x6fce('0x32')](_0x38aa6a[_0x6fce('0x33')]);_0x40be5f['filters']=_['intersection'](_0x40be5f['model'],_0x40be5f[_0x6fce('0x33')]);_0x4b323a[_0x6fce('0x34')]=_[_0x6fce('0x35')](_0x40be5f[_0x6fce('0x36')],qs[_0x6fce('0x37')](_0x38aa6a[_0x6fce('0x33')]['fields']));_0x4b323a[_0x6fce('0x34')]=_0x4b323a[_0x6fce('0x34')][_0x6fce('0x38')]?_0x4b323a[_0x6fce('0x34')]:_0x40be5f[_0x6fce('0x36')];if(!_0x38aa6a[_0x6fce('0x33')][_0x6fce('0x39')](_0x6fce('0x3a'))){_0x4b323a['limit']=qs['limit'](_0x38aa6a[_0x6fce('0x33')][_0x6fce('0x23')]);_0x4b323a['offset']=qs['offset'](_0x38aa6a[_0x6fce('0x33')]['offset']);}_0x4b323a['order']=qs[_0x6fce('0x3b')](_0x38aa6a[_0x6fce('0x33')][_0x6fce('0x3b')]);_0x4b323a[_0x6fce('0x3c')]=qs[_0x6fce('0x3d')](_[_0x6fce('0x3e')](_0x38aa6a['query'],_0x40be5f[_0x6fce('0x3d')]),_0x3b355e);if(_0x38aa6a['query'][_0x6fce('0x3f')]){_0x4b323a[_0x6fce('0x3c')]=_[_0x6fce('0x40')](_0x4b323a[_0x6fce('0x3c')],{'$or':_[_0x6fce('0x2d')](_0x3b355e,function(_0x2b977c){if(_0x2b977c['type']!=='VIRTUAL'){var _0x4a8043={};_0x4a8043[_0x2b977c['name']]={'$like':'%'+_0x38aa6a[_0x6fce('0x33')]['filter']+'%'};return _0x4a8043;}})});}_0x4b323a=_[_0x6fce('0x40')]({},_0x4b323a,_0x38aa6a[_0x6fce('0x41')]);var _0x2a8707={'where':_0x4b323a[_0x6fce('0x3c')]};return db[_0x6fce('0x2e')][_0x6fce('0x21')](_0x2a8707)[_0x6fce('0x28')](function(_0xf8e888){_0x30b769['count']=_0xf8e888;if(_0x38aa6a[_0x6fce('0x33')][_0x6fce('0x42')]){_0x4b323a['include']=[{'all':!![]}];}return db[_0x6fce('0x2e')][_0x6fce('0x43')](_0x4b323a);})[_0x6fce('0x28')](function(_0x64c65e){_0x30b769['rows']=_0x64c65e;return _0x30b769;})[_0x6fce('0x28')](respondWithFilteredResult(_0x428968,_0x4b323a))[_0x6fce('0x44')](handleError(_0x428968,null));};exports[_0x6fce('0x45')]=function(_0x332653,_0x14afc6){var _0x10d7cc={'raw':![],'where':{'id':_0x332653[_0x6fce('0x46')]['id']}},_0x1bd0ce={};_0x1bd0ce[_0x6fce('0x36')]=_[_0x6fce('0x32')](db[_0x6fce('0x2e')]['rawAttributes']);_0x1bd0ce[_0x6fce('0x33')]=_['keys'](_0x332653[_0x6fce('0x33')]);_0x1bd0ce[_0x6fce('0x3d')]=_[_0x6fce('0x35')](_0x1bd0ce[_0x6fce('0x36')],_0x1bd0ce['query']);_0x10d7cc['attributes']=_[_0x6fce('0x35')](_0x1bd0ce[_0x6fce('0x36')],qs[_0x6fce('0x37')](_0x332653[_0x6fce('0x33')][_0x6fce('0x37')]));_0x10d7cc[_0x6fce('0x34')]=_0x10d7cc[_0x6fce('0x34')][_0x6fce('0x38')]?_0x10d7cc[_0x6fce('0x34')]:_0x1bd0ce[_0x6fce('0x36')];if(_0x332653[_0x6fce('0x33')][_0x6fce('0x42')]){_0x10d7cc[_0x6fce('0x47')]=[{'all':!![]}];}_0x10d7cc=_[_0x6fce('0x40')]({},_0x10d7cc,_0x332653[_0x6fce('0x41')]);return db[_0x6fce('0x2e')]['find'](_0x10d7cc)[_0x6fce('0x28')](handleEntityNotFound(_0x14afc6,null))[_0x6fce('0x28')](respondWithResult(_0x14afc6,null))['catch'](handleError(_0x14afc6,null));};exports[_0x6fce('0x48')]=function(_0x3e777e,_0xc26971){return db[_0x6fce('0x2e')][_0x6fce('0x48')](_0x3e777e['body'],{})[_0x6fce('0x28')](respondWithResult(_0xc26971,0xc9))[_0x6fce('0x44')](handleError(_0xc26971,null));};exports[_0x6fce('0x49')]=function(_0x5d8ae3,_0x51d2eb){var _0x35aa59={'where':{'id':_0x5d8ae3[_0x6fce('0x46')]['id']}},_0xcc28c7={};_0xcc28c7[_0x6fce('0x36')]=_[_0x6fce('0x32')](db['UserProfile'][_0x6fce('0x2f')]);_0x35aa59[_0x6fce('0x34')]=_[_0x6fce('0x35')](_0xcc28c7[_0x6fce('0x36')],qs['fields'](_0x5d8ae3[_0x6fce('0x33')][_0x6fce('0x37')]));_0x35aa59[_0x6fce('0x34')]=_0x35aa59['attributes']['length']?_0x35aa59[_0x6fce('0x34')]:_0xcc28c7[_0x6fce('0x36')];if(_0x5d8ae3[_0x6fce('0x33')]['includeAll']){_0x35aa59['include']=[{'all':!![]}];}_0x35aa59=_[_0x6fce('0x40')]({},_0x35aa59,_0x5d8ae3[_0x6fce('0x41')]);return db[_0x6fce('0x2e')][_0x6fce('0x4a')](_0x35aa59)['then'](handleEntityNotFound(_0x51d2eb,null))[_0x6fce('0x28')](function(_0x5f54e9){if(_0x5f54e9){var _0x68e5cc=_0x5f54e9['get']({'plain':!![]});_0x68e5cc=qs['omit'](_0x68e5cc,['id',_0x6fce('0x4b'),_0x6fce('0x4c'),_0x6fce('0x4d')]);_0x5d8ae3[_0x6fce('0x4e')]=_['omit'](_0x5d8ae3['body'],['id',_0x6fce('0x4b'),_0x6fce('0x4c')]);return db[_0x6fce('0x4f')][_0x6fce('0x50')](function(_0x1520cd){return db['UserProfile'][_0x6fce('0x48')](_[_0x6fce('0x40')](_0x68e5cc,_0x5d8ae3[_0x6fce('0x4e')]),{'include':_0x5d8ae3[_0x6fce('0x33')][_0x6fce('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x1520cd})['then'](function(_0x5109ac){var _0x3ac269=_0x5109ac['get']({'plain':!![]});return db[_0x6fce('0x51')][_0x6fce('0x43')]({'where':{'userProfileId':_0x5d8ae3['params']['id']},'raw':!![]})[_0x6fce('0x28')](function(_0x1aa53f){if(_0x1aa53f){return BPromise['each'](_0x1aa53f,function(_0x283718){return new BPromise(function(_0x525ca2,_0x3dade0){if(_0x283718[_0x6fce('0x52')]===null||_0x283718[_0x6fce('0x52')]===0x1)_0x525ca2(null);return db['UserProfileResource'][_0x6fce('0x43')]({'where':{'sectionId':_0x283718['id']},'raw':!![]})[_0x6fce('0x28')](function(_0x207600){var _0x525df5=_[_0x6fce('0x2d')](_0x207600,function(_0x14162c){return qs[_0x6fce('0x53')](_0x14162c,['id',_0x6fce('0x4b'),_0x6fce('0x4c'),_0x6fce('0x54')]);});_0x525ca2(_0x525df5);})['catch'](function(_0x46d53f){_0x3dade0(_0x46d53f);});})[_0x6fce('0x28')](function(_0x55e6da){var _0x14a6c6=qs['omit'](_0x283718,['id','createdAt',_0x6fce('0x4c')]);_0x14a6c6['userProfileId']=_0x3ac269['id'];if(_0x55e6da)_0x14a6c6['Resources']=_0x55e6da;return _0x14a6c6;})[_0x6fce('0x28')](function(_0x2e4efb){return db[_0x6fce('0x51')]['create'](_0x2e4efb,{'include':[{'model':db['UserProfileResource'],'as':_0x6fce('0x55')}],'raw':!![],'transaction':_0x1520cd});});})[_0x6fce('0x28')](function(){return _0x3ac269;});}});});});}})['then'](respondWithResult(_0x51d2eb,0xc9))[_0x6fce('0x44')](handleError(_0x51d2eb,null));};exports[_0x6fce('0x27')]=function(_0x1a8ee8,_0x439e1b){if(_0x1a8ee8[_0x6fce('0x4e')]['id']){delete _0x1a8ee8[_0x6fce('0x4e')]['id'];}return db[_0x6fce('0x2e')][_0x6fce('0x4a')]({'where':{'id':_0x1a8ee8[_0x6fce('0x46')]['id']}})['then'](handleEntityNotFound(_0x439e1b,null))[_0x6fce('0x28')](saveUpdates(_0x1a8ee8[_0x6fce('0x4e')],null))[_0x6fce('0x28')](respondWithResult(_0x439e1b,null))['catch'](handleError(_0x439e1b,null));};exports[_0x6fce('0x56')]=function(_0x27754c,_0x2d50ff){return db[_0x6fce('0x2e')][_0x6fce('0x4a')]({'where':{'id':_0x27754c[_0x6fce('0x46')]['id']}})[_0x6fce('0x28')](handleEntityNotFound(_0x2d50ff,null))[_0x6fce('0x28')](removeEntity(_0x2d50ff,null))['catch'](handleError(_0x2d50ff,null));};exports['describe']=function(_0x1fe092,_0x3b7612){return db[_0x6fce('0x2e')][_0x6fce('0x57')]()[_0x6fce('0x28')](respondWithResult(_0x3b7612,null))[_0x6fce('0x44')](handleError(_0x3b7612,null));};exports[_0x6fce('0x58')]=function(_0x2dfaf9,_0x366c82){var _0x484b84=_0x2dfaf9[_0x6fce('0x4e')];return db[_0x6fce('0x2e')][_0x6fce('0x4a')]({'where':{'id':_0x2dfaf9[_0x6fce('0x46')]['id']}})[_0x6fce('0x28')](handleEntityNotFound(_0x366c82,null))[_0x6fce('0x28')](function(_0xcc4769){if(_0xcc4769){return db[_0x6fce('0x4f')]['transaction'](function(_0x38f1c8){return db[_0x6fce('0x51')][_0x6fce('0x56')]({'where':{'userProfileId':_0x2dfaf9[_0x6fce('0x46')]['id'],'sectionId':_[_0x6fce('0x2d')](_0x484b84,function(_0x2bdc0b){return _0x2bdc0b[_0x6fce('0x54')];})},'transaction':_0x38f1c8})[_0x6fce('0x28')](function(){var _0x16107b=_[_0x6fce('0x2d')](_0x484b84,function(_0x38c5eb){_0x38c5eb['userProfileId']=_0x2dfaf9[_0x6fce('0x46')]['id'];return _0x38c5eb;});var _0x49a4b4=[];return BPromise[_0x6fce('0x59')](_0x16107b,function(_0x3cb338){return db[_0x6fce('0x51')][_0x6fce('0x48')](_0x3cb338,{'include':[{'model':db[_0x6fce('0x5a')],'as':_0x6fce('0x55')}],'raw':!![],'transaction':_0x38f1c8})[_0x6fce('0x28')](function(_0x1cfaa3){_0x49a4b4[_0x6fce('0x5b')](_0x1cfaa3[_0x6fce('0x5c')]({'plain':!![]}));});})[_0x6fce('0x28')](function(){return _0x49a4b4;});});});}})['then'](function(_0x3ee236){return _0x3ee236;})[_0x6fce('0x28')](respondWithResult(_0x366c82,null))[_0x6fce('0x44')](handleError(_0x366c82,null));};exports['removeSections']=function(_0x8b2fac,_0x5a83a3){var _0xa06c2a;return db[_0x6fce('0x2e')]['find']({'where':{'id':_0x8b2fac[_0x6fce('0x46')]['id']},'attributes':['id','name']})[_0x6fce('0x28')](handleEntityNotFound(_0x5a83a3,null))[_0x6fce('0x28')](function(_0x35d855){if(_0x35d855){_0xa06c2a=_0x35d855;return db['UserProfileSection'][_0x6fce('0x56')]({'where':{'userProfileId':_0x8b2fac[_0x6fce('0x46')]['id'],'sectionId':_0x8b2fac[_0x6fce('0x33')][_0x6fce('0x5d')]}});}})[_0x6fce('0x28')](function(){return _0xa06c2a;})['then'](respondWithStatusCode(_0x5a83a3,null))[_0x6fce('0x44')](handleError(_0x5a83a3,null));};exports[_0x6fce('0x5e')]=function(_0x17153a,_0x2d0609){var _0x21b47a=[];var _0x39ef2b=[];return db[_0x6fce('0x51')][_0x6fce('0x43')]({'where':{'userProfileId':_0x17153a[_0x6fce('0x46')]['id']},'raw':!![]})[_0x6fce('0x28')](function(_0x35295f){_0x21b47a=_[_0x6fce('0x3f')](_0x35295f,function(_0x25e727){return _0x25e727[_0x6fce('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x25e727[_0x6fce('0x54')]);});if(!_[_0x6fce('0x60')](_0x21b47a)){return _[_0x6fce('0x2d')](_0x21b47a,function(_0x17788f){return _0x17788f[_0x6fce('0x54')];});}else{return;}})[_0x6fce('0x28')](function(_0x124731){if(_0x124731)_0x39ef2b=_0x124731;if(_[_0x6fce('0x61')](_0x39ef2b,0x64)){var _0x13b0ce=_[_0x6fce('0x4a')](_0x21b47a,{'sectionId':0x64});return hasDefaultDashboard(_0x13b0ce)[_0x6fce('0x28')](function(_0xe45ff1){return _[_0x6fce('0x2d')](_0x21b47a,function(_0x162f7a){if(_0x162f7a[_0x6fce('0x54')]===0x64){_0x162f7a['subsections']=_0xe45ff1;}return _0x162f7a;});});}else{return;}})[_0x6fce('0x28')](function(_0x31a96e){if(_0x31a96e)_0x21b47a=_0x31a96e;if(_[_0x6fce('0x61')](_0x39ef2b,0x3eb)){var _0x56e94e=_[_0x6fce('0x4a')](_0x21b47a,{'sectionId':0x3eb});return getCustomDashboards(_0x56e94e)['then'](function(_0x2e1058){return _[_0x6fce('0x2d')](_0x21b47a,function(_0x205dc0){if(_0x56e94e['enabled']){if(_0x205dc0[_0x6fce('0x54')]===0x3eb){_0x205dc0[_0x6fce('0x62')]=_0x2e1058;}}else{if(_0x205dc0[_0x6fce('0x54')]===0x64){if(!_0x205dc0[_0x6fce('0x62')]){_0x205dc0[_0x6fce('0x62')]=[];}_0x205dc0[_0x6fce('0x62')]=_0x205dc0['subsections']['concat'](_0x2e1058);}}return _0x205dc0;});});}else{return;}})[_0x6fce('0x28')](function(_0x145aeb){if(_0x145aeb)_0x21b47a=_0x145aeb;if(_[_0x6fce('0x61')](_0x39ef2b,0x709)){var _0x392455=_[_0x6fce('0x4a')](_0x21b47a,{'sectionId':0x709});return getPlugins(_0x392455)['then'](function(_0x3d7846){if(_0x392455[_0x6fce('0x5f')]){return _[_0x6fce('0x2d')](_0x21b47a,function(_0x4be4c9){if(_0x4be4c9[_0x6fce('0x54')]===0x709){_0x4be4c9[_0x6fce('0x62')]=_0x3d7846;}return _0x4be4c9;});}else{var _0x5a0701={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3d7846};var _0x2c52c4=_['map'](_0x21b47a);_0x2c52c4[_0x6fce('0x5b')](_0x5a0701);return _0x2c52c4;}});}else{return;}})[_0x6fce('0x28')](function(_0x17b629){if(_0x17b629)_0x21b47a=_0x17b629;return _[_0x6fce('0x3f')](_0x21b47a,[_0x6fce('0x5f'),0x1]);})[_0x6fce('0x28')](respondWithResult(_0x2d0609,null))['catch'](handleError(_0x2d0609,null));};function hasDefaultDashboard(_0x5c844b){var _0x345edd=[0x65];return new BPromise(function(_0x5daccc,_0x2f6864){try{if(_0x5c844b[_0x6fce('0x52')]){_0x5daccc(_0x345edd);}else{return db[_0x6fce('0x5a')][_0x6fce('0x63')]({'where':{'sectionId':_0x5c844b['id']},'raw':!![]})[_0x6fce('0x28')](function(_0x1d6191){_0x1d6191?_0x5daccc(_0x345edd):_0x5daccc();});}}catch(_0x5074e5){_0x2f6864(_0x5074e5);}});}function getCustomDashboards(_0x27f8f1){var _0x114fe7=[];return new BPromise(function(_0x1439a8,_0x4a5bbb){try{if(_0x27f8f1[_0x6fce('0x52')]){return db['Dashboard'][_0x6fce('0x43')]({'raw':!![]})['then'](function(_0x2a5d2b){_0x2a5d2b[_0x6fce('0x64')](function(_0xe4ec9f){_0x114fe7[_0x6fce('0x5b')](_0xe4ec9f['id']+0x1869f);});_0x1439a8(_0x114fe7);});}else{return db[_0x6fce('0x5a')][_0x6fce('0x43')]({'where':{'sectionId':_0x27f8f1['id']},'raw':!![]})['then'](function(_0x3040c3){_0x3040c3[_0x6fce('0x64')](function(_0x17e4cf){_0x114fe7[_0x6fce('0x5b')](_0x17e4cf[_0x6fce('0x65')]+0x1869f);});_0x1439a8(_0x114fe7);});}}catch(_0x1ca171){_0x4a5bbb(_0x1ca171);}});}function getPlugins(_0x2ada85){var _0x29c218=[];return new BPromise(function(_0x4d2c6f,_0x96bc76){try{if(_0x2ada85['autoAssociation']){return db[_0x6fce('0x66')][_0x6fce('0x43')]({'raw':!![]})[_0x6fce('0x28')](function(_0x54cc98){_0x54cc98['forEach'](function(_0x17ed89){_0x29c218['push'](_0x17ed89['id']+0x15b38);});_0x4d2c6f(_0x29c218);});}else{return db[_0x6fce('0x5a')][_0x6fce('0x43')]({'where':{'sectionId':_0x2ada85['id']},'raw':!![]})[_0x6fce('0x28')](function(_0x181ef6){_0x181ef6[_0x6fce('0x64')](function(_0x3e38af){_0x29c218[_0x6fce('0x5b')](_0x3e38af[_0x6fce('0x65')]+0x15b38);});_0x4d2c6f(_0x29c218);});}}catch(_0x486845){_0x96bc76(_0x486845);}});}exports[_0x6fce('0x67')]=function(_0x215fd0,_0x5e691b){return db[_0x6fce('0x2e')]['find']({'where':{'id':_0x215fd0['params']['id']}})[_0x6fce('0x28')](handleEntityNotFound(_0x5e691b,null))[_0x6fce('0x28')](function(_0x5bfaa7){if(_0x5bfaa7){return db[_0x6fce('0x4f')][_0x6fce('0x50')](function(_0x3a4acd){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x215fd0[_0x6fce('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x6fce('0x28')](function(_0x4bbebc){if(_0x4bbebc){return db['UserProfileSection'][_0x6fce('0x56')]({'where':{'userProfileId':_0x215fd0[_0x6fce('0x46')]['id'],'id':_[_0x6fce('0x2d')](_0x4bbebc,function(_0x387d60){return _0x387d60['id'];})},'transaction':_0x3a4acd});}})['then'](function(_0x5c4ee2){var _0x451867=_[_0x6fce('0x2d')](_0x215fd0[_0x6fce('0x4e')],function(_0x23c1df){_0x23c1df[_0x6fce('0x68')]=_0x215fd0['params']['id'];return _0x23c1df;});return db[_0x6fce('0x51')][_0x6fce('0x69')](_0x451867,{'raw':!![],'transaction':_0x3a4acd});})[_0x6fce('0x28')](function(_0x40eb1f){var _0x36ceeb=_[_0x6fce('0x3f')](_[_0x6fce('0x2d')](_0x40eb1f,function(_0x1f9953){return _0x1f9953[_0x6fce('0x5c')]({'plain':!![]});}),{'includeAll':![]});if(_0x36ceeb){return db['UserProfileSection'][_0x6fce('0x43')]({'where':{'userProfileId':_0x215fd0['params']['id'],'sectionId':_[_0x6fce('0x2d')](_0x36ceeb,function(_0xc8ac01){return _0xc8ac01['sectionId'];})},'attributes':['id',_0x6fce('0x54')],'raw':!![]})[_0x6fce('0x28')](function(_0x75cb1f){var _0x1b9f1d=_[_0x6fce('0x2d')](_0x215fd0[_0x6fce('0x4e')],function(_0xce0c5f){_0xce0c5f[_0x6fce('0x68')]=_0x215fd0[_0x6fce('0x46')]['id'];return _0xce0c5f;});return db[_0x6fce('0x5a')][_0x6fce('0x69')](_0x1b9f1d,{'raw':!![],'transaction':_0x3a4acd});});}})['catch'](handleError(_0x5e691b,null));});}})[_0x6fce('0x28')](function(_0x337771){var _0x181aab=_[_0x6fce('0x2d')](_0x337771,function(_0x1f20bd){return _0x1f20bd[_0x6fce('0x5c')]({'plain':!![]});});})[_0x6fce('0x28')](respondWithResult(_0x5e691b,null))[_0x6fce('0x44')](handleError(_0x5e691b,null));};exports[_0x6fce('0x6a')]=function(_0x42a2ea,_0x566c2e,_0x34f6a3){return db[_0x6fce('0x2e')][_0x6fce('0x4a')]({'where':{'id':_0x42a2ea[_0x6fce('0x46')]['id']}})[_0x6fce('0x28')](handleEntityNotFound(_0x566c2e,null))[_0x6fce('0x28')](function(_0x223444){if(_0x223444){return _0x223444[_0x6fce('0x6a')](_0x42a2ea[_0x6fce('0x33')][_0x6fce('0x5d')]);}})[_0x6fce('0x28')](respondWithStatusCode(_0x566c2e,null))[_0x6fce('0x44')](handleError(_0x566c2e,null));};exports[_0x6fce('0x6b')]=function(_0x2843ae,_0x138892){var _0x4231b1={};if(!_0x2843ae[_0x6fce('0x33')][_0x6fce('0x6c')])throw new Error(_0x6fce('0x6d'));if(!_0x2843ae[_0x6fce('0x33')]['hasOwnProperty'](_0x6fce('0x3a'))){_0x4231b1[_0x6fce('0x23')]=qs[_0x6fce('0x23')](_0x2843ae[_0x6fce('0x33')][_0x6fce('0x23')]);_0x4231b1[_0x6fce('0x22')]=qs[_0x6fce('0x22')](_0x2843ae[_0x6fce('0x33')][_0x6fce('0x22')]);}return db[_0x6fce('0x2e')][_0x6fce('0x4a')]({'where':{'id':_0x2843ae[_0x6fce('0x46')]['id']}})['then'](function(_0x4e778b){if(!_0x4e778b)throw new Error(_0x6fce('0x6e')+_0x2843ae[_0x6fce('0x46')]['id']);return db['UserProfile'][_0x6fce('0x6b')](_0x2843ae);})[_0x6fce('0x28')](respondWithFilteredResult(_0x138892,_0x4231b1))[_0x6fce('0x44')](handleError(_0x138892,null));}; \ No newline at end of file +var _0x53b1=['push','ids','getSections','includes','isEmpty','subsections','enabled','autoAssociation','forEach','resourceId','userProfileId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','UserProfile','includeAll','include','findAll','rows','show','params','merge','find','catch','create','clone','get','createdAt','updatedAt','body','sequelize','transaction','each','UserProfileResource','omit','Resources','UserProfileSection','addSections','sectionId'];(function(_0x32f209,_0x3eecef){var _0x544cfe=function(_0x31a814){while(--_0x31a814){_0x32f209['push'](_0x32f209['shift']());}};_0x544cfe(++_0x3eecef);}(_0x53b1,0xf2));var _0x153b=function(_0x4b9b7f,_0x1d260c){_0x4b9b7f=_0x4b9b7f-0x0;var _0x4d9e51=_0x53b1[_0x4b9b7f];return _0x4d9e51;};'use strict';var emlformat=require(_0x153b('0x0'));var rimraf=require(_0x153b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x153b('0x2'));var BPromise=require(_0x153b('0x3'));var Mustache=require(_0x153b('0x4'));var util=require(_0x153b('0x5'));var path=require(_0x153b('0x6'));var sox=require(_0x153b('0x7'));var csv=require(_0x153b('0x8'));var ejs=require(_0x153b('0x9'));var fs=require('fs');var fs_extra=require(_0x153b('0xa'));var _=require('lodash');var squel=require(_0x153b('0xb'));var crypto=require(_0x153b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x153b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x153b('0xe'));var Papa=require(_0x153b('0xf'));var Redis=require('ioredis');var authService=require(_0x153b('0x10'));var qs=require(_0x153b('0x11'));var as=require(_0x153b('0x12'));var hardwareService=require(_0x153b('0x13'));var logger=require(_0x153b('0x14'))(_0x153b('0x15'));var utils=require(_0x153b('0x16'));var config=require(_0x153b('0x17'));var licenseUtil=require(_0x153b('0x18'));var db=require(_0x153b('0x19'))['db'];config[_0x153b('0x1a')]=_['defaults'](config[_0x153b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x153b('0x1b'))(new Redis(config[_0x153b('0x1a')]));require(_0x153b('0x1c'))[_0x153b('0x1d')](socket);function respondWithStatusCode(_0x1c49cd,_0x16449c){_0x16449c=_0x16449c||0xcc;return function(_0x15440f){if(_0x15440f){return _0x1c49cd[_0x153b('0x1e')](_0x16449c);}return _0x1c49cd[_0x153b('0x1f')](_0x16449c)[_0x153b('0x20')]();};}function respondWithResult(_0x2a1823,_0x1b00ff){_0x1b00ff=_0x1b00ff||0xc8;return function(_0x46d9fb){if(_0x46d9fb){return _0x2a1823[_0x153b('0x1f')](_0x1b00ff)['json'](_0x46d9fb);}};}function respondWithFilteredResult(_0x5dc599,_0x230a08){return function(_0x250048){if(_0x250048){var _0x5a4a29=typeof _0x230a08[_0x153b('0x21')]===_0x153b('0x22')&&typeof _0x230a08[_0x153b('0x23')]===_0x153b('0x22');var _0x4bd335=_0x250048[_0x153b('0x24')];var _0x2f1995=_0x5a4a29?0x0:_0x230a08[_0x153b('0x21')];var _0x4da07f=_0x5a4a29?_0x250048['count']:_0x230a08[_0x153b('0x21')]+_0x230a08[_0x153b('0x23')];var _0x53b521;if(_0x4da07f>=_0x4bd335){_0x4da07f=_0x4bd335;_0x53b521=0xc8;}else{_0x53b521=0xce;}_0x5dc599[_0x153b('0x1f')](_0x53b521);return _0x5dc599[_0x153b('0x25')](_0x153b('0x26'),_0x2f1995+'-'+_0x4da07f+'/'+_0x4bd335)[_0x153b('0x27')](_0x250048);}return null;};}function patchUpdates(_0x3228de){return function(_0x17cdf9){try{jsonpatch[_0x153b('0x28')](_0x17cdf9,_0x3228de,!![]);}catch(_0x4f1c59){return BPromise[_0x153b('0x29')](_0x4f1c59);}return _0x17cdf9[_0x153b('0x2a')]();};}function saveUpdates(_0x352316,_0x1fb89f){return function(_0x4a2630){if(_0x4a2630){return _0x4a2630[_0x153b('0x2b')](_0x352316)[_0x153b('0x2c')](function(_0x4a593c){return _0x4a593c;});}return null;};}function removeEntity(_0x4aef99,_0x3c5fbc){return function(_0x46f0d9){if(_0x46f0d9){return _0x46f0d9[_0x153b('0x2d')]()[_0x153b('0x2c')](function(){_0x4aef99[_0x153b('0x1f')](0xcc)[_0x153b('0x20')]();});}};}function handleEntityNotFound(_0x4c0642,_0x134b75){return function(_0x56ff49){if(!_0x56ff49){_0x4c0642[_0x153b('0x1e')](0x194);}return _0x56ff49;};}function handleError(_0x2796d6,_0x3f3372){_0x3f3372=_0x3f3372||0x1f4;return function(_0x2db718){logger['error'](_0x2db718['stack']);if(_0x2db718[_0x153b('0x2e')]){delete _0x2db718['name'];}_0x2796d6[_0x153b('0x1f')](_0x3f3372)[_0x153b('0x2f')](_0x2db718);};}exports[_0x153b('0x30')]=function(_0x16fb21,_0x2ed63c){var _0x13bf60={},_0x20dd6b={},_0x5ee17d={'count':0x0,'rows':[]};var _0x2f2fd8=_[_0x153b('0x31')](db['UserProfile'][_0x153b('0x32')],function(_0x32ee6d){return{'name':_0x32ee6d[_0x153b('0x33')],'type':_0x32ee6d[_0x153b('0x34')][_0x153b('0x35')]};});_0x20dd6b[_0x153b('0x36')]=_['map'](_0x2f2fd8,_0x153b('0x2e'));_0x20dd6b[_0x153b('0x37')]=_[_0x153b('0x38')](_0x16fb21[_0x153b('0x37')]);_0x20dd6b[_0x153b('0x39')]=_[_0x153b('0x3a')](_0x20dd6b[_0x153b('0x36')],_0x20dd6b[_0x153b('0x37')]);_0x13bf60[_0x153b('0x3b')]=_['intersection'](_0x20dd6b[_0x153b('0x36')],qs[_0x153b('0x3c')](_0x16fb21[_0x153b('0x37')][_0x153b('0x3c')]));_0x13bf60[_0x153b('0x3b')]=_0x13bf60[_0x153b('0x3b')][_0x153b('0x3d')]?_0x13bf60['attributes']:_0x20dd6b['model'];if(!_0x16fb21[_0x153b('0x37')][_0x153b('0x3e')]('nolimit')){_0x13bf60[_0x153b('0x23')]=qs[_0x153b('0x23')](_0x16fb21[_0x153b('0x37')][_0x153b('0x23')]);_0x13bf60[_0x153b('0x21')]=qs[_0x153b('0x21')](_0x16fb21[_0x153b('0x37')][_0x153b('0x21')]);}_0x13bf60[_0x153b('0x3f')]=qs[_0x153b('0x40')](_0x16fb21[_0x153b('0x37')][_0x153b('0x40')]);_0x13bf60['where']=qs['filters'](_['pick'](_0x16fb21['query'],_0x20dd6b[_0x153b('0x39')]),_0x2f2fd8);if(_0x16fb21[_0x153b('0x37')][_0x153b('0x41')]){_0x13bf60[_0x153b('0x42')]=_['merge'](_0x13bf60[_0x153b('0x42')],{'$or':_[_0x153b('0x31')](_0x2f2fd8,function(_0x43f718){if(_0x43f718[_0x153b('0x34')]!==_0x153b('0x43')){var _0x4b8ee7={};_0x4b8ee7[_0x43f718['name']]={'$like':'%'+_0x16fb21[_0x153b('0x37')][_0x153b('0x41')]+'%'};return _0x4b8ee7;}})});}_0x13bf60=_['merge']({},_0x13bf60,_0x16fb21[_0x153b('0x44')]);var _0x11411e={'where':_0x13bf60['where']};return db[_0x153b('0x45')][_0x153b('0x24')](_0x11411e)['then'](function(_0x3e3d2f){_0x5ee17d[_0x153b('0x24')]=_0x3e3d2f;if(_0x16fb21[_0x153b('0x37')][_0x153b('0x46')]){_0x13bf60[_0x153b('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x153b('0x48')](_0x13bf60);})[_0x153b('0x2c')](function(_0x2e8b69){_0x5ee17d[_0x153b('0x49')]=_0x2e8b69;return _0x5ee17d;})[_0x153b('0x2c')](respondWithFilteredResult(_0x2ed63c,_0x13bf60))['catch'](handleError(_0x2ed63c,null));};exports[_0x153b('0x4a')]=function(_0x3a50b3,_0x210947){var _0xbcb0dc={'raw':![],'where':{'id':_0x3a50b3[_0x153b('0x4b')]['id']}},_0x2179bc={};_0x2179bc[_0x153b('0x36')]=_[_0x153b('0x38')](db[_0x153b('0x45')][_0x153b('0x32')]);_0x2179bc[_0x153b('0x37')]=_['keys'](_0x3a50b3[_0x153b('0x37')]);_0x2179bc[_0x153b('0x39')]=_[_0x153b('0x3a')](_0x2179bc[_0x153b('0x36')],_0x2179bc[_0x153b('0x37')]);_0xbcb0dc[_0x153b('0x3b')]=_[_0x153b('0x3a')](_0x2179bc[_0x153b('0x36')],qs[_0x153b('0x3c')](_0x3a50b3[_0x153b('0x37')][_0x153b('0x3c')]));_0xbcb0dc['attributes']=_0xbcb0dc['attributes'][_0x153b('0x3d')]?_0xbcb0dc[_0x153b('0x3b')]:_0x2179bc[_0x153b('0x36')];if(_0x3a50b3[_0x153b('0x37')][_0x153b('0x46')]){_0xbcb0dc[_0x153b('0x47')]=[{'all':!![]}];}_0xbcb0dc=_[_0x153b('0x4c')]({},_0xbcb0dc,_0x3a50b3['options']);return db[_0x153b('0x45')][_0x153b('0x4d')](_0xbcb0dc)[_0x153b('0x2c')](handleEntityNotFound(_0x210947,null))[_0x153b('0x2c')](respondWithResult(_0x210947,null))[_0x153b('0x4e')](handleError(_0x210947,null));};exports[_0x153b('0x4f')]=function(_0xf25471,_0x3fab27){return db[_0x153b('0x45')]['create'](_0xf25471['body'],{})[_0x153b('0x2c')](respondWithResult(_0x3fab27,0xc9))[_0x153b('0x4e')](handleError(_0x3fab27,null));};exports[_0x153b('0x50')]=function(_0x2e6de3,_0x413ccd){var _0x15cdcc={'where':{'id':_0x2e6de3[_0x153b('0x4b')]['id']}},_0x5bfed4={};_0x5bfed4[_0x153b('0x36')]=_['keys'](db[_0x153b('0x45')]['rawAttributes']);_0x15cdcc[_0x153b('0x3b')]=_[_0x153b('0x3a')](_0x5bfed4[_0x153b('0x36')],qs[_0x153b('0x3c')](_0x2e6de3[_0x153b('0x37')][_0x153b('0x3c')]));_0x15cdcc[_0x153b('0x3b')]=_0x15cdcc[_0x153b('0x3b')][_0x153b('0x3d')]?_0x15cdcc[_0x153b('0x3b')]:_0x5bfed4['model'];if(_0x2e6de3[_0x153b('0x37')][_0x153b('0x46')]){_0x15cdcc[_0x153b('0x47')]=[{'all':!![]}];}_0x15cdcc=_[_0x153b('0x4c')]({},_0x15cdcc,_0x2e6de3[_0x153b('0x44')]);return db['UserProfile'][_0x153b('0x4d')](_0x15cdcc)[_0x153b('0x2c')](handleEntityNotFound(_0x413ccd,null))['then'](function(_0x37ef71){if(_0x37ef71){var _0x8e31d5=_0x37ef71[_0x153b('0x51')]({'plain':!![]});_0x8e31d5=qs['omit'](_0x8e31d5,['id',_0x153b('0x52'),_0x153b('0x53'),'crudPermissions']);_0x2e6de3[_0x153b('0x54')]=_['omit'](_0x2e6de3[_0x153b('0x54')],['id',_0x153b('0x52'),'updatedAt']);return db[_0x153b('0x55')][_0x153b('0x56')](function(_0x4b5a30){return db[_0x153b('0x45')]['create'](_[_0x153b('0x4c')](_0x8e31d5,_0x2e6de3[_0x153b('0x54')]),{'include':_0x2e6de3[_0x153b('0x37')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b5a30})[_0x153b('0x2c')](function(_0x96fb18){var _0x23018c=_0x96fb18[_0x153b('0x51')]({'plain':!![]});return db['UserProfileSection'][_0x153b('0x48')]({'where':{'userProfileId':_0x2e6de3[_0x153b('0x4b')]['id']},'raw':!![]})['then'](function(_0xdfe2e2){if(_0xdfe2e2){return BPromise[_0x153b('0x57')](_0xdfe2e2,function(_0x249fa0){return new BPromise(function(_0xcc1773,_0x182688){if(_0x249fa0['autoAssociation']===null||_0x249fa0['autoAssociation']===0x1)_0xcc1773(null);return db[_0x153b('0x58')][_0x153b('0x48')]({'where':{'sectionId':_0x249fa0['id']},'raw':!![]})[_0x153b('0x2c')](function(_0x4b0d2b){var _0x5d6e51=_[_0x153b('0x31')](_0x4b0d2b,function(_0x3d4b9c){return qs[_0x153b('0x59')](_0x3d4b9c,['id',_0x153b('0x52'),_0x153b('0x53'),'sectionId']);});_0xcc1773(_0x5d6e51);})[_0x153b('0x4e')](function(_0x40f92f){_0x182688(_0x40f92f);});})[_0x153b('0x2c')](function(_0xb52ae8){var _0x26d187=qs[_0x153b('0x59')](_0x249fa0,['id',_0x153b('0x52'),'updatedAt']);_0x26d187['userProfileId']=_0x23018c['id'];if(_0xb52ae8)_0x26d187[_0x153b('0x5a')]=_0xb52ae8;return _0x26d187;})[_0x153b('0x2c')](function(_0x46b421){return db[_0x153b('0x5b')]['create'](_0x46b421,{'include':[{'model':db[_0x153b('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x4b5a30});});})[_0x153b('0x2c')](function(){return _0x23018c;});}});});});}})[_0x153b('0x2c')](respondWithResult(_0x413ccd,0xc9))['catch'](handleError(_0x413ccd,null));};exports[_0x153b('0x2b')]=function(_0x4c33c8,_0x4a16c9){if(_0x4c33c8['body']['id']){delete _0x4c33c8[_0x153b('0x54')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x4c33c8[_0x153b('0x4b')]['id']}})[_0x153b('0x2c')](handleEntityNotFound(_0x4a16c9,null))[_0x153b('0x2c')](saveUpdates(_0x4c33c8[_0x153b('0x54')],null))['then'](respondWithResult(_0x4a16c9,null))[_0x153b('0x4e')](handleError(_0x4a16c9,null));};exports[_0x153b('0x2d')]=function(_0x205708,_0x16805e){return db[_0x153b('0x45')]['find']({'where':{'id':_0x205708[_0x153b('0x4b')]['id']}})[_0x153b('0x2c')](handleEntityNotFound(_0x16805e,null))[_0x153b('0x2c')](removeEntity(_0x16805e,null))[_0x153b('0x4e')](handleError(_0x16805e,null));};exports['describe']=function(_0x34a1a0,_0x50295d){return db[_0x153b('0x45')]['describe']()[_0x153b('0x2c')](respondWithResult(_0x50295d,null))['catch'](handleError(_0x50295d,null));};exports[_0x153b('0x5c')]=function(_0x1ced10,_0x2ec61c){var _0x8ffa5b=_0x1ced10[_0x153b('0x54')];return db[_0x153b('0x45')][_0x153b('0x4d')]({'where':{'id':_0x1ced10['params']['id']}})['then'](handleEntityNotFound(_0x2ec61c,null))[_0x153b('0x2c')](function(_0x4c55ee){if(_0x4c55ee){return db[_0x153b('0x55')]['transaction'](function(_0x3e64b5){return db[_0x153b('0x5b')][_0x153b('0x2d')]({'where':{'userProfileId':_0x1ced10['params']['id'],'sectionId':_[_0x153b('0x31')](_0x8ffa5b,function(_0xa7c9d5){return _0xa7c9d5[_0x153b('0x5d')];})},'transaction':_0x3e64b5})[_0x153b('0x2c')](function(){var _0x372f2f=_['map'](_0x8ffa5b,function(_0x22c9a9){_0x22c9a9['userProfileId']=_0x1ced10[_0x153b('0x4b')]['id'];return _0x22c9a9;});var _0x2e3112=[];return BPromise[_0x153b('0x57')](_0x372f2f,function(_0x414a5c){return db[_0x153b('0x5b')][_0x153b('0x4f')](_0x414a5c,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3e64b5})['then'](function(_0x5436a7){_0x2e3112[_0x153b('0x5e')](_0x5436a7['get']({'plain':!![]}));});})[_0x153b('0x2c')](function(){return _0x2e3112;});});});}})[_0x153b('0x2c')](function(_0x31f970){return _0x31f970;})['then'](respondWithResult(_0x2ec61c,null))['catch'](handleError(_0x2ec61c,null));};exports['removeSections']=function(_0x3ae95c,_0x5552c7){var _0x321c5a;return db[_0x153b('0x45')][_0x153b('0x4d')]({'where':{'id':_0x3ae95c['params']['id']},'attributes':['id',_0x153b('0x2e')]})['then'](handleEntityNotFound(_0x5552c7,null))[_0x153b('0x2c')](function(_0x11227f){if(_0x11227f){_0x321c5a=_0x11227f;return db[_0x153b('0x5b')][_0x153b('0x2d')]({'where':{'userProfileId':_0x3ae95c[_0x153b('0x4b')]['id'],'sectionId':_0x3ae95c[_0x153b('0x37')][_0x153b('0x5f')]}});}})[_0x153b('0x2c')](function(){return _0x321c5a;})[_0x153b('0x2c')](respondWithStatusCode(_0x5552c7,null))[_0x153b('0x4e')](handleError(_0x5552c7,null));};exports[_0x153b('0x60')]=function(_0x5c0312,_0xb0aca){var _0x1a71d8=[];var _0x5a867a=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5c0312[_0x153b('0x4b')]['id']},'raw':!![]})['then'](function(_0x35dcee){_0x1a71d8=_[_0x153b('0x41')](_0x35dcee,function(_0x4484d8){return _0x4484d8['enabled']===0x1||_[_0x153b('0x61')]([0x3eb,0x709],_0x4484d8[_0x153b('0x5d')]);});if(!_[_0x153b('0x62')](_0x1a71d8)){return _[_0x153b('0x31')](_0x1a71d8,function(_0x5bd744){return _0x5bd744[_0x153b('0x5d')];});}else{return;}})[_0x153b('0x2c')](function(_0x19a810){if(_0x19a810)_0x5a867a=_0x19a810;if(_[_0x153b('0x61')](_0x5a867a,0x64)){var _0x27272a=_[_0x153b('0x4d')](_0x1a71d8,{'sectionId':0x64});return hasDefaultDashboard(_0x27272a)[_0x153b('0x2c')](function(_0x24c112){return _[_0x153b('0x31')](_0x1a71d8,function(_0x22be9f){if(_0x22be9f['sectionId']===0x64){_0x22be9f[_0x153b('0x63')]=_0x24c112;}return _0x22be9f;});});}else{return;}})['then'](function(_0x3fd424){if(_0x3fd424)_0x1a71d8=_0x3fd424;if(_[_0x153b('0x61')](_0x5a867a,0x3eb)){var _0x332645=_[_0x153b('0x4d')](_0x1a71d8,{'sectionId':0x3eb});return getCustomDashboards(_0x332645)[_0x153b('0x2c')](function(_0x4045f3){return _[_0x153b('0x31')](_0x1a71d8,function(_0x181a4d){if(_0x332645[_0x153b('0x64')]){if(_0x181a4d[_0x153b('0x5d')]===0x3eb){_0x181a4d['subsections']=_0x4045f3;}}else{if(_0x181a4d[_0x153b('0x5d')]===0x64){if(!_0x181a4d[_0x153b('0x63')]){_0x181a4d[_0x153b('0x63')]=[];}_0x181a4d[_0x153b('0x63')]=_0x181a4d[_0x153b('0x63')]['concat'](_0x4045f3);}}return _0x181a4d;});});}else{return;}})[_0x153b('0x2c')](function(_0x570d7e){if(_0x570d7e)_0x1a71d8=_0x570d7e;if(_[_0x153b('0x61')](_0x5a867a,0x709)){var _0x1d00b5=_['find'](_0x1a71d8,{'sectionId':0x709});return getPlugins(_0x1d00b5)[_0x153b('0x2c')](function(_0x3ea61f){if(_0x1d00b5[_0x153b('0x64')]){return _[_0x153b('0x31')](_0x1a71d8,function(_0x3a159c){if(_0x3a159c[_0x153b('0x5d')]===0x709){_0x3a159c[_0x153b('0x63')]=_0x3ea61f;}return _0x3a159c;});}else{var _0xe358f8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3ea61f};var _0x258540=_[_0x153b('0x31')](_0x1a71d8);_0x258540['push'](_0xe358f8);return _0x258540;}});}else{return;}})[_0x153b('0x2c')](function(_0x5d31c7){if(_0x5d31c7)_0x1a71d8=_0x5d31c7;return _[_0x153b('0x41')](_0x1a71d8,[_0x153b('0x64'),0x1]);})[_0x153b('0x2c')](respondWithResult(_0xb0aca,null))[_0x153b('0x4e')](handleError(_0xb0aca,null));};function hasDefaultDashboard(_0x55c76e){var _0x4acc4b=[0x65];return new BPromise(function(_0x3b4ba0,_0x59231e){try{if(_0x55c76e[_0x153b('0x65')]){_0x3b4ba0(_0x4acc4b);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x55c76e['id']},'raw':!![]})[_0x153b('0x2c')](function(_0x3d8950){_0x3d8950?_0x3b4ba0(_0x4acc4b):_0x3b4ba0();});}}catch(_0x2df31b){_0x59231e(_0x2df31b);}});}function getCustomDashboards(_0x1a66be){var _0x4bf108=[];return new BPromise(function(_0x407fdb,_0x3439c5){try{if(_0x1a66be['autoAssociation']){return db['Dashboard'][_0x153b('0x48')]({'raw':!![]})[_0x153b('0x2c')](function(_0x56c8e0){_0x56c8e0[_0x153b('0x66')](function(_0x5c533a){_0x4bf108[_0x153b('0x5e')](_0x5c533a['id']+0x1869f);});_0x407fdb(_0x4bf108);});}else{return db[_0x153b('0x58')][_0x153b('0x48')]({'where':{'sectionId':_0x1a66be['id']},'raw':!![]})['then'](function(_0x45ef17){_0x45ef17['forEach'](function(_0x4bc01f){_0x4bf108[_0x153b('0x5e')](_0x4bc01f[_0x153b('0x67')]+0x1869f);});_0x407fdb(_0x4bf108);});}}catch(_0x5049a3){_0x3439c5(_0x5049a3);}});}function getPlugins(_0x94fcc4){var _0x55f653=[];return new BPromise(function(_0x5ab61f,_0x39fcf5){try{if(_0x94fcc4[_0x153b('0x65')]){return db['Plugin'][_0x153b('0x48')]({'raw':!![]})[_0x153b('0x2c')](function(_0x7e4847){_0x7e4847[_0x153b('0x66')](function(_0x35d2d2){_0x55f653['push'](_0x35d2d2['id']+0x15b38);});_0x5ab61f(_0x55f653);});}else{return db[_0x153b('0x58')][_0x153b('0x48')]({'where':{'sectionId':_0x94fcc4['id']},'raw':!![]})[_0x153b('0x2c')](function(_0x2213a3){_0x2213a3[_0x153b('0x66')](function(_0x154d25){_0x55f653['push'](_0x154d25['resourceId']+0x15b38);});_0x5ab61f(_0x55f653);});}}catch(_0x23db0b){_0x39fcf5(_0x23db0b);}});}exports['addResources']=function(_0x9f2f95,_0x3a1ab7){return db[_0x153b('0x45')]['find']({'where':{'id':_0x9f2f95[_0x153b('0x4b')]['id']}})[_0x153b('0x2c')](handleEntityNotFound(_0x3a1ab7,null))[_0x153b('0x2c')](function(_0x25a669){if(_0x25a669){return db[_0x153b('0x55')][_0x153b('0x56')](function(_0x41fefa){return db['UserProfileSection'][_0x153b('0x48')]({'where':{'userProfileId':_0x9f2f95['params']['id']},'attributes':['id'],'raw':!![]})[_0x153b('0x2c')](function(_0x93b556){if(_0x93b556){return db[_0x153b('0x5b')][_0x153b('0x2d')]({'where':{'userProfileId':_0x9f2f95[_0x153b('0x4b')]['id'],'id':_[_0x153b('0x31')](_0x93b556,function(_0x40bab7){return _0x40bab7['id'];})},'transaction':_0x41fefa});}})['then'](function(_0x4393e7){var _0x39872f=_['map'](_0x9f2f95[_0x153b('0x54')],function(_0x599239){_0x599239[_0x153b('0x68')]=_0x9f2f95[_0x153b('0x4b')]['id'];return _0x599239;});return db[_0x153b('0x5b')][_0x153b('0x69')](_0x39872f,{'raw':!![],'transaction':_0x41fefa});})[_0x153b('0x2c')](function(_0x5c82ed){var _0x28d622=_[_0x153b('0x41')](_[_0x153b('0x31')](_0x5c82ed,function(_0x4e5e31){return _0x4e5e31[_0x153b('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x28d622){return db[_0x153b('0x5b')]['findAll']({'where':{'userProfileId':_0x9f2f95[_0x153b('0x4b')]['id'],'sectionId':_[_0x153b('0x31')](_0x28d622,function(_0x5ab84f){return _0x5ab84f['sectionId'];})},'attributes':['id',_0x153b('0x5d')],'raw':!![]})[_0x153b('0x2c')](function(_0x297a4a){var _0x42c981=_[_0x153b('0x31')](_0x9f2f95['body'],function(_0x2d2846){_0x2d2846[_0x153b('0x68')]=_0x9f2f95[_0x153b('0x4b')]['id'];return _0x2d2846;});return db[_0x153b('0x58')][_0x153b('0x69')](_0x42c981,{'raw':!![],'transaction':_0x41fefa});});}})[_0x153b('0x4e')](handleError(_0x3a1ab7,null));});}})[_0x153b('0x2c')](function(_0x3ebe56){var _0x3cf4b1=_[_0x153b('0x31')](_0x3ebe56,function(_0x2b90a0){return _0x2b90a0['get']({'plain':!![]});});})[_0x153b('0x2c')](respondWithResult(_0x3a1ab7,null))['catch'](handleError(_0x3a1ab7,null));};exports[_0x153b('0x6a')]=function(_0x5024b8,_0x53a547,_0x3b9bb5){return db[_0x153b('0x45')]['find']({'where':{'id':_0x5024b8[_0x153b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53a547,null))['then'](function(_0x111bab){if(_0x111bab){return _0x111bab[_0x153b('0x6a')](_0x5024b8[_0x153b('0x37')][_0x153b('0x5f')]);}})[_0x153b('0x2c')](respondWithStatusCode(_0x53a547,null))[_0x153b('0x4e')](handleError(_0x53a547,null));};exports[_0x153b('0x6b')]=function(_0x157802,_0x5b6269){var _0x2ff638={};if(!_0x157802[_0x153b('0x37')][_0x153b('0x6c')])throw new Error(_0x153b('0x6d'));if(!_0x157802[_0x153b('0x37')][_0x153b('0x3e')](_0x153b('0x6e'))){_0x2ff638[_0x153b('0x23')]=qs[_0x153b('0x23')](_0x157802[_0x153b('0x37')][_0x153b('0x23')]);_0x2ff638['offset']=qs[_0x153b('0x21')](_0x157802[_0x153b('0x37')][_0x153b('0x21')]);}return db[_0x153b('0x45')][_0x153b('0x4d')]({'where':{'id':_0x157802[_0x153b('0x4b')]['id']}})[_0x153b('0x2c')](function(_0x10b08a){if(!_0x10b08a)throw new Error(_0x153b('0x6f')+_0x157802['params']['id']);return db[_0x153b('0x45')][_0x153b('0x6b')](_0x157802);})[_0x153b('0x2c')](respondWithFilteredResult(_0x5b6269,_0x2ff638))['catch'](handleError(_0x5b6269,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 52c2276..f604212 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 _0x3837=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x3837,0x1d1));var _0x7383=function(_0x40b705,_0x21ec9a){_0x40b705=_0x40b705-0x0;var _0x2ee7e0=_0x3837[_0x40b705];return _0x2ee7e0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7383('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7383('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7383('0x2'),'afterDestroy':_0x7383('0x3')};function emitEvent(_0x49878d){return function(_0x227ab2,_0xf57468,_0x53485d){UserProfileEvents['emit'](_0x49878d+':'+_0x227ab2['id'],_0x227ab2);UserProfileEvents[_0x7383('0x4')](_0x49878d,_0x227ab2);_0x53485d(null);};}for(var e in events){if(events[_0x7383('0x5')](e)){var event=events[e];UserProfile[_0x7383('0x6')](e,emitEvent(event));}}module[_0x7383('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xaf5a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','UserProfile'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xaf5a,0x116));var _0xaaf5=function(_0xbca80b,_0x5cd39f){_0xbca80b=_0xbca80b-0x0;var _0x484524=_0xaf5a[_0xbca80b];return _0x484524;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xaaf5('0x0'))['db'][_0xaaf5('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xaaf5('0x2')](0x0);var events={'afterCreate':_0xaaf5('0x3'),'afterUpdate':_0xaaf5('0x4'),'afterDestroy':_0xaaf5('0x5')};function emitEvent(_0x5c55af){return function(_0x1bdf16,_0x4ae9ed,_0x23fbd9){UserProfileEvents[_0xaaf5('0x6')](_0x5c55af+':'+_0x1bdf16['id'],_0x1bdf16);UserProfileEvents[_0xaaf5('0x6')](_0x5c55af,_0x1bdf16);_0x23fbd9(null);};}for(var e in events){if(events[_0xaaf5('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2d9b1fc..e573287 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 _0x5be5=['smsqueues','SmsQueue','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','UserProfile','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','VIRTUAL','foreignKey','forEach','merge','options','autoAssociation','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','includeAll','include','Tags','tag','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','then','map','catch','model','findAll','name','resolve','UserProfileResource','AnalyticExtractedReport','associatedResources','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','lists','CmList','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount'];(function(_0x4759b4,_0x10205d){var _0x46788e=function(_0x54db11){while(--_0x54db11){_0x4759b4['push'](_0x4759b4['shift']());}};_0x46788e(++_0x10205d);}(_0x5be5,0x6f));var _0x55be=function(_0x5678c2,_0xd8cb89){_0x5678c2=_0x5678c2-0x0;var _0x263105=_0x5be5[_0x5678c2];return _0x263105;};'use strict';var _=require(_0x55be('0x0'));var attributes=require(_0x55be('0x1'));var squel=require('squel');module[_0x55be('0x2')]=function(_0x43c4c6){var _0x4deb36=_0x43c4c6[_0x55be('0x3')];function _0x5927a0(_0x525f7f,_0x555933){return new Promise(function(_0x400aeb,_0x381373){if(!_0x555933)return _0x400aeb(null);var _0x1d270f=_0x555933['filter']?{[_0x555933[_0x55be('0x4')][_0x55be('0x5')]]:_0x555933[_0x55be('0x4')]['value']}:undefined;return _0x4deb36[_0x525f7f]['findAll']({'where':_0x1d270f,'raw':!![]})[_0x55be('0x6')](function(_0x11c74f){_0x555933['associatedResources']=_[_0x55be('0x7')](_0x11c74f,'id');_0x400aeb(_0x555933);})[_0x55be('0x8')](function(_0x496319){_0x381373(_0x496319);});});}function _0x32902a(_0x4f62da,_0x5f5037){return new Promise(function(_0x2ba69a,_0xebc8f1){var _0x19f689=_0x4f62da[_0x55be('0x4')]?{[_0x4f62da[_0x55be('0x4')][_0x55be('0x5')]]:_0x4f62da['filter']['value']}:undefined;return _0x4deb36[_0x4f62da[_0x55be('0x9')]][_0x55be('0xa')]({'where':_0x19f689,'raw':!![]})[_0x55be('0x6')](function(_0x5abfc1){_0x5f5037['associatedResources']=_[_0x55be('0x7')](_0x5abfc1,function(_0x382762){return _0x382762[_0x55be('0xb')];});_0x2ba69a(_0x5f5037);})[_0x55be('0x8')](function(_0x48eac0){_0xebc8f1(_0x48eac0);});});}function _0x31bffb(_0x23e0d1,_0x4a7537,_0x4fcc1b){if(!_0x4a7537)return Promise[_0x55be('0xc')](null);return new Promise(function(_0x2cff9d,_0x1b6bf2){return _0x4deb36[_0x55be('0xd')]['findAll']({'where':{'sectionId':_0x4a7537['id']},'raw':!![]})['then'](function(_0x5e1590){if(_0x23e0d1[_0x55be('0x5')]&&_0x23e0d1['field']!=='id'){_0x4a7537['associatedResources']=_[_0x55be('0x7')](_0x5e1590,function(_0x4767ab){return _0x4767ab[_0x23e0d1[_0x55be('0x5')]];});}else{if(_0x4fcc1b===_0x55be('0xe')){_0x4a7537[_0x55be('0xf')]=_[_0x55be('0x7')](_0x5e1590,function(_0x1bb0f2){return{'id':_0x1bb0f2[_0x55be('0x10')],'type':_0x1bb0f2[_0x55be('0x11')]};});}else{_0x4a7537[_0x55be('0xf')]=_[_0x55be('0x7')](_0x5e1590,function(_0xf244af){return _0xf244af[_0x55be('0x10')];});}}_0x2cff9d(_0x4a7537);})[_0x55be('0x8')](function(_0x497b5a){_0x1b6bf2(_0x497b5a);});});}function _0x2a1bb4(_0x239ed0,_0x585b4f){var _0x15ac13={'parentSections':[]};switch(_0x239ed0[_0x55be('0x12')]()){case _0x55be('0x13'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x15');break;case _0x55be('0x16'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x17');break;case _0x55be('0x18'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x19');_0x15ac13[_0x55be('0x1a')]=[{'name':_0x55be('0x1b'),'field':'name','foreignKey':_0x55be('0x1c')}];break;case'projects':_0x15ac13[_0x55be('0x14')]=_0x55be('0x1d');break;case _0x55be('0x1e'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x1f');_0x15ac13[_0x55be('0x1a')]=[{'name':_0x55be('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x55be('0x21'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x22');break;case'companies':_0x15ac13['childModel']='CmCompany';break;case _0x55be('0x23'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x24');break;case _0x55be('0x25'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x26');break;case'chatwebsites':_0x15ac13[_0x55be('0x14')]=_0x55be('0x27');break;case _0x55be('0x28'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x29');break;case'faxaccounts':_0x15ac13[_0x55be('0x14')]=_0x55be('0x2a');break;case'inboundroutes':case _0x55be('0x2b'):case _0x55be('0x2c'):_0x15ac13['childModel']=_0x55be('0x2d');break;case _0x55be('0x2e'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x2f');break;case'voicemails':_0x15ac13[_0x55be('0x14')]=_0x55be('0x30');break;case _0x55be('0x31'):_0x15ac13[_0x55be('0x14')]='VoiceRecording';_0x15ac13[_0x55be('0x1a')]=[{'name':_0x55be('0x32'),'field':_0x55be('0xb'),'foreignKey':_0x55be('0x33'),'model':'User','filter':{'field':_0x55be('0x34'),'value':[_0x55be('0x35')]}},{'name':_0x55be('0x36'),'field':_0x55be('0xb'),'foreignKey':_0x55be('0x33'),'model':_0x55be('0x37'),'filter':{'field':_0x55be('0x34'),'value':['telephone']}},{'name':_0x55be('0x38'),'field':'name','foreignKey':_0x55be('0x39'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x55be('0x3a')]}},{'name':_0x55be('0x3b'),'field':'name','foreignKey':_0x55be('0x39'),'model':_0x55be('0x3c'),'filter':{'field':'type','value':[_0x55be('0x3d')]}}];break;case _0x55be('0x3e'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x3f');break;case _0x55be('0x40'):_0x15ac13[_0x55be('0x14')]='VoiceChanSpy';break;case _0x55be('0x41'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x42');break;case _0x55be('0x43'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x44');break;case'mailqueues':_0x15ac13[_0x55be('0x14')]=_0x55be('0x45');break;case'mailaccounts':_0x15ac13['childModel']=_0x55be('0x46');break;case _0x55be('0x47'):_0x15ac13['childModel']='MailSubstatus';break;case _0x55be('0x48'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x49');break;case _0x55be('0x4a'):_0x15ac13['childModel']=_0x55be('0x4b');break;case _0x55be('0x4c'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x4d');break;case'smsaccounts':_0x15ac13[_0x55be('0x14')]=_0x55be('0x4e');break;case _0x55be('0x4f'):_0x15ac13['childModel']='WhatsappQueue';break;case _0x55be('0x50'):_0x15ac13['childModel']=_0x55be('0x51');break;case'teams':_0x15ac13[_0x55be('0x14')]=_0x55be('0x52');break;case'voicequeues':case _0x55be('0x53'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x3c');if(_0x585b4f){_0x15ac13[_0x55be('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x55be('0x3b')}];}break;case _0x55be('0x54'):case _0x55be('0x55'):case _0x55be('0x56'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x37');if(_0x585b4f){_0x15ac13[_0x55be('0x1a')]=[{'name':_0x55be('0x57'),'filter':{'field':_0x55be('0x34'),'value':[_0x55be('0x58'),'user']},'ignore':!![]},{'name':_0x55be('0x32')},{'name':'Telephones'}];}break;case _0x55be('0x59'):_0x15ac13['childModel']=_0x55be('0x5a');break;case _0x55be('0x5b'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x5c');break;case _0x55be('0x5d'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x5e');break;case'sugarcrmaccounts':_0x15ac13['childModel']='SugarcrmAccount';break;case _0x55be('0x5f'):_0x15ac13[_0x55be('0x14')]='DeskAccount';break;case _0x55be('0x60'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x61');break;case _0x55be('0x62'):_0x15ac13['childModel']='User';break;case'cannedanswers':_0x15ac13[_0x55be('0x14')]='CannedAnswer';break;case _0x55be('0x63'):_0x15ac13['childModel']='Disposition';break;case _0x55be('0x64'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x65');break;case _0x55be('0x66'):_0x15ac13['childModel']=_0x55be('0x67');break;case _0x55be('0x68'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x69');break;case'scheduler':_0x15ac13[_0x55be('0x14')]='Schedule';break;case _0x55be('0x6a'):_0x15ac13['childModel']='Sound';break;case _0x55be('0x6b'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x6c');break;case _0x55be('0x6d'):_0x15ac13['childModel']=_0x55be('0x6e');break;case _0x55be('0x6f'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x70');break;case _0x55be('0x71'):_0x15ac13[_0x55be('0x14')]='Trunk';break;case'variables':_0x15ac13[_0x55be('0x14')]=_0x55be('0x72');break;case _0x55be('0x73'):_0x15ac13[_0x55be('0x14')]=_0x55be('0x74');break;case _0x55be('0x75'):_0x15ac13[_0x55be('0x14')]=_0x55be('0xe');_0x15ac13[_0x55be('0x1a')]=[{'name':_0x55be('0x76'),'field':'id','foreignKey':_0x55be('0x77')}];break;case'metrics':_0x15ac13[_0x55be('0x14')]=_0x55be('0x78');break;}return _0x15ac13;}function _0x57a331(_0x19d419,_0x246716){var _0x5d388d=_0x19d419[_0x55be('0x79')](0x0)[_0x55be('0x7a')]()+_0x19d419[_0x55be('0x7b')](0x1);var _0x593134={'type':_0x4deb36['Sequelize'][_0x55be('0x7c')][_0x55be('0x7d')],'raw':!![]};return new Promise(function(_0x48840e,_0x196ffb){var _0x1efa83=squel['select']()[_0x55be('0x5')](_0x55be('0x7e')+_0x5d388d+_0x55be('0x7f'),'id')['field'](_0x55be('0x80'))[_0x55be('0x81')]('user_has_'+_0x19d419+_0x55be('0x82'),'ui')[_0x55be('0x83')](_0x55be('0x84'),_0x246716['id']);return _0x4deb36[_0x55be('0x85')][_0x55be('0x86')](_0x1efa83[_0x55be('0x87')](),_0x593134)[_0x55be('0x6')](function(_0x4831fc){_0x246716[_0x5d388d+'OpenTabs']=_0x4831fc;_0x48840e(_0x4831fc);})[_0x55be('0x8')](function(_0x2b99b9){_0x196ffb(_0x2b99b9);});});}return _0x43c4c6['define'](_0x55be('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x56f26e){var _0x5a2f29=require(_0x55be('0x89'));var _0x54ff4d={'raw':_0x56f26e[_0x55be('0x86')]['raw'],'where':{}};var _0x2696b7={};var _0x212630={'count':0x0,'rows':[]};var _0xfe6aed=_0x56f26e[_0x55be('0x86')][_0x55be('0x8a')];var _0xbb524d=_0x56f26e[_0x55be('0x86')][_0x55be('0x8b')]||![];var _0x4d210e=_0x2a1bb4(_0xfe6aed,_0xbb524d);if(!_0x4d210e['childModel'])throw new Error(_0x55be('0x8c')+_0xfe6aed+'\x27');var _0x52cdf9=[{'name':_0xfe6aed}];if(!_[_0x55be('0x8d')](_0x4d210e[_0x55be('0x1a')]))_0x52cdf9=_0x4d210e['parentSections'];var _0xd2ffa4=[];for(var _0x2dd778=0x0;_0x2dd778<_0x52cdf9[_0x55be('0x8e')];_0x2dd778++){_0xd2ffa4[_0x55be('0x8f')](_0x4deb36[_0x55be('0x90')][_0x55be('0x91')]({'where':{'userProfileId':_0x56f26e[_0x55be('0x92')]['id'],'name':_0x52cdf9[_0x2dd778][_0x55be('0xb')]},'raw':!![]}));}return Promise[_0x55be('0x93')](_0xd2ffa4)[_0x55be('0x6')](function(_0x17d937){var _0x3ade7f=_['filter'](_0x17d937,function(_0x22422c){return _0x22422c?_0x22422c:undefined;});var _0x49d364=_[_0x55be('0x4')](_0x52cdf9,[_0x55be('0x94'),!![]]);var _0x4f0fc0=_[_0x55be('0x8d')](_0x3ade7f)&&_[_0x55be('0x8d')](_0x49d364)?null:_['union'](_0x49d364,_0x3ade7f);if(!_0x4f0fc0)return null;var _0x2f51cc=[];for(var _0x81f775=0x0;_0x81f775<_0x4f0fc0['length'];_0x81f775++){var _0x2ec388=_[_0x55be('0x91')](_0x52cdf9,function(_0x46ae76){return _0x4f0fc0[_0x81f775]?_0x46ae76[_0x55be('0xb')]===_0x4f0fc0[_0x81f775][_0x55be('0xb')]:null;});if(_0x2ec388){if(_0x4f0fc0[_0x81f775][_0x55be('0x94')]){_0x2f51cc[_0x55be('0x8f')](_0x5927a0(_0x4d210e[_0x55be('0x14')],_0x4f0fc0[_0x81f775]));}else{if(!_0x4f0fc0[_0x81f775]['autoAssociation']){_0x2f51cc[_0x55be('0x8f')](_0x31bffb(_0x2ec388,_0x4f0fc0[_0x81f775],_0x4d210e[_0x55be('0x14')]));}else{if(_0x2ec388[_0x55be('0x9')]){_0x2f51cc['push'](_0x32902a(_0x2ec388,_0x4f0fc0[_0x81f775]));}}}}}return Promise[_0x55be('0x93')](_0x2f51cc);})[_0x55be('0x6')](function(_0xa8c222){var _0x35c08a=_0xa8c222;var _0x30dd77=null;if(_0x35c08a){_0x30dd77=_0x35c08a[_0x55be('0x8e')]===0x1?_0x35c08a[0x0]:null;}if(!_0x30dd77&&!_0x35c08a)return _0x212630;var _0x185b6d=_0x4deb36[_0x4d210e[_0x55be('0x14')]][_0x55be('0x95')];_0x2696b7[_0x55be('0x9')]=_[_0x55be('0x96')](_0x185b6d);_0x2696b7[_0x55be('0x86')]=_['keys'](_0x56f26e[_0x55be('0x86')]);_0x2696b7[_0x55be('0x97')]=_[_0x55be('0x98')](_0x2696b7[_0x55be('0x9')],_0x2696b7[_0x55be('0x86')]);_0x54ff4d[_0x55be('0x99')]=_[_0x55be('0x98')](_0x2696b7[_0x55be('0x9')],_0x5a2f29[_0x55be('0x9a')](_0x56f26e[_0x55be('0x86')]['fields']));_0x54ff4d[_0x55be('0x99')]=_0x54ff4d[_0x55be('0x99')][_0x55be('0x8e')]?_0x54ff4d[_0x55be('0x99')]:_0x2696b7[_0x55be('0x9')];if(!_0x56f26e[_0x55be('0x86')]['hasOwnProperty'](_0x55be('0x9b'))){_0x54ff4d['limit']=_0x5a2f29[_0x55be('0x9c')](_0x56f26e[_0x55be('0x86')]['limit']);_0x54ff4d[_0x55be('0x9d')]=_0x5a2f29[_0x55be('0x9d')](_0x56f26e[_0x55be('0x86')][_0x55be('0x9d')]);}_0x54ff4d['order']=_0x5a2f29[_0x55be('0x9e')](_0x56f26e[_0x55be('0x86')][_0x55be('0x9e')]);_0x54ff4d[_0x55be('0x83')]=_0x5a2f29[_0x55be('0x97')](_[_0x55be('0x9f')](_0x56f26e[_0x55be('0x86')],_0x2696b7[_0x55be('0x97')]));if(_0x56f26e[_0x55be('0x86')][_0x55be('0x4')]){_0x54ff4d[_0x55be('0x83')]=_['merge'](_0x54ff4d['where'],{'$or':_[_0x55be('0x7')](_0x185b6d,function(_0x3d62d0){if(_0x3d62d0['type']['key']!==_0x55be('0xa0')){var _0x22360e={};_0x22360e[_0x3d62d0[_0x55be('0x5')]]={'$like':'%'+_0x56f26e[_0x55be('0x86')][_0x55be('0x4')]+'%'};return _0x22360e;}})});}var _0x388167=[];var _0x2bd487=null;var _0x1e4786={};if(_0x30dd77){_0x2bd487=_['find'](_0x52cdf9,[_0x55be('0xb'),_0x30dd77['name']]);if(_0x2bd487[_0x55be('0x5')]){_0x1e4786={};if(_0x4d210e['childModel']===_0x55be('0xe')){_0x1e4786[_0x2bd487[_0x55be('0xa1')]]=_[_0x55be('0x7')](_0x30dd77[_0x55be('0xf')],'id');}else{_0x1e4786[_0x2bd487['foreignKey']]=_0x30dd77['associatedResources'];}_0x388167[_0x55be('0x8f')](_0x1e4786);}else{_0x54ff4d[_0x55be('0x83')]['id']=_0x30dd77['associatedResources'];}}else{for(var _0x5a766b=0x0;_0x5a766b<_0x35c08a[_0x55be('0x8e')];_0x5a766b++){_0x2bd487=_[_0x55be('0x91')](_0x52cdf9,[_0x55be('0xb'),_0x35c08a[_0x5a766b][_0x55be('0xb')]]);if(_0x2bd487[_0x55be('0x5')]){_0x1e4786={};_0x1e4786[_0x2bd487[_0x55be('0xa1')]]=_0x35c08a[_0x5a766b][_0x55be('0xf')];_0x388167[_0x55be('0x8f')](_0x1e4786);}else{if(!_0x54ff4d[_0x55be('0x83')]['id'])_0x54ff4d['where']['id']=[];_0x35c08a[_0x5a766b][_0x55be('0xf')][_0x55be('0xa2')](function(_0x50291f){_0x54ff4d[_0x55be('0x83')]['id'][_0x55be('0x8f')](_0x50291f);});}}}if(!_[_0x55be('0x8d')](_0x388167)){_0x54ff4d[_0x55be('0x83')]=_[_0x55be('0xa3')](_0x54ff4d['where'],{'$and':{'$or':_0x388167}});}_0x54ff4d=_[_0x55be('0xa3')]({},_0x54ff4d,_0x56f26e[_0x55be('0xa4')]);if(_0x30dd77&&!_0x30dd77[_0x55be('0xa5')]&&_0x4d210e[_0x55be('0x14')]==='AnalyticExtractedReport'){if(_0x56f26e['query']['includeAll']){_0x54ff4d['include']=[{'all':!![]}];}return _0x4deb36[_0x4d210e[_0x55be('0x14')]][_0x55be('0xa')](_0x54ff4d)[_0x55be('0x6')](function(_0x2a3e63){var _0x1a4435=[];_0x2a3e63[_0x55be('0xa2')](function(_0x3c7a7e){var _0x2c9161;switch(_0x3c7a7e[_0x55be('0xa6')]){case _0x55be('0xa7'):_0x2c9161=_[_0x55be('0x91')](_0x30dd77['associatedResources'],function(_0x346fce){return _0x346fce['id']===_0x3c7a7e['reportId']&&_0x346fce[_0x55be('0x11')]===_0x55be('0xa8');});break;case _0x55be('0xa9'):_0x2c9161=_[_0x55be('0x91')](_0x30dd77[_0x55be('0xf')],function(_0x340a3b){return _0x340a3b['id']===_0x3c7a7e[_0x55be('0x77')]&&_0x340a3b['type']==='CustomReports';});break;}if(_0x2c9161)_0x1a4435[_0x55be('0x8f')](_0x3c7a7e);});_0x212630[_0x55be('0xaa')]=_0x1a4435[_0x55be('0x8e')];_0x212630[_0x55be('0xab')]=_0x1a4435;return _0x212630;});}else{if(!_[_0x55be('0x8d')](_0x56f26e[_0x55be('0x86')]['ids'])){_0x54ff4d[_0x55be('0x83')]['id']=_0x54ff4d[_0x55be('0x83')]['id']?_[_0x55be('0x98')](_0x54ff4d[_0x55be('0x83')]['id'],_0x56f26e[_0x55be('0x86')]['ids']):_0x56f26e[_0x55be('0x86')][_0x55be('0xac')];if(_0x56f26e[_0x55be('0x86')][_0x55be('0xad')]){_0x54ff4d['order']=_0x56f26e[_0x55be('0x86')][_0x55be('0xad')];}}if(_0x56f26e[_0x55be('0x86')][_0x55be('0xae')]){_0x54ff4d[_0x55be('0x83')]=_[_0x55be('0xa3')](_0x54ff4d[_0x55be('0x83')],{'$and':_0x56f26e[_0x55be('0x86')][_0x55be('0xae')]});}return _0x4deb36[_0x4d210e['childModel']][_0x55be('0xaa')]({'where':_0x54ff4d['where']})[_0x55be('0x6')](function(_0x5eb0f6){_0x212630[_0x55be('0xaa')]=_0x5eb0f6;if(_0x56f26e[_0x55be('0x86')][_0x55be('0xaf')]){if(_0x4d210e[_0x55be('0x14')]===_0x55be('0x1f')){_0x54ff4d[_0x55be('0xb0')]=[{'model':_0x4deb36['Tag'],'as':_0x55be('0xb1'),'attributes':['id','name','color'],'required':_0x56f26e[_0x55be('0x86')]['tag']?!![]:![]},{'model':_0x4deb36[_0x55be('0x6c')],'as':'ThroughTags','attributes':['id',_0x55be('0xb'),'color'],'through':_0x56f26e[_0x55be('0x86')][_0x55be('0xb2')]?{'attributes':[],'where':{'TagId':_0x56f26e[_0x55be('0x86')][_0x55be('0xb2')]||undefined}}:{},'required':_0x56f26e['query'][_0x55be('0xb2')]?!![]:![]}];}else{_0x54ff4d[_0x55be('0xb0')]=[{'all':!![]}];}}return _0x4deb36[_0x4d210e[_0x55be('0x14')]][_0x55be('0xa')](_0x54ff4d);})[_0x55be('0x6')](function(_0x320efe){_0x212630[_0x55be('0xab')]=_0x320efe;if(_0xfe6aed==='Agents'&&_0x56f26e[_0x55be('0x86')][_0x55be('0xb3')]===_0x55be('0xb4')){var _0x46b6e8=[];for(var _0x369300=0x0;_0x369300<_0x212630[_0x55be('0xab')][_0x55be('0x8e')];_0x369300++){_0x46b6e8[_0x55be('0x8f')](_0x57a331(_0x55be('0xb5'),_0x212630['rows'][_0x369300][_0x55be('0xb6')]));_0x46b6e8[_0x55be('0x8f')](_0x57a331('sms',_0x212630['rows'][_0x369300][_0x55be('0xb6')]));_0x46b6e8[_0x55be('0x8f')](_0x57a331(_0x55be('0xb7'),_0x212630[_0x55be('0xab')][_0x369300]['dataValues']));_0x46b6e8[_0x55be('0x8f')](_0x57a331(_0x55be('0xb8'),_0x212630[_0x55be('0xab')][_0x369300][_0x55be('0xb6')]));_0x46b6e8['push'](_0x57a331(_0x55be('0xb9'),_0x212630['rows'][_0x369300][_0x55be('0xb6')]));_0x46b6e8[_0x55be('0x8f')](_0x57a331(_0x55be('0xba'),_0x212630[_0x55be('0xab')][_0x369300][_0x55be('0xb6')]));}return Promise['all'](_0x46b6e8)['then'](function(){return _0x212630;});}return _0x212630;});}});}}});}; \ No newline at end of file +var _0x29e6=['SELECT','select','ui.','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','length','push','autoAssociation','model','rawAttributes','keys','filters','intersection','fields','attributes','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','customSorting','extraQueryConditions','count','Tags','color','ThroughTags','tag','true','rows','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','catch','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceRecording','Agents','membername','User','agent','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','slice','Sequelize','QueryTypes'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0x29e6,0x1c1));var _0x629e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x629e('0x0'));var attributes=require(_0x629e('0x1'));var squel=require(_0x629e('0x2'));module[_0x629e('0x3')]=function(_0x188b4a){var _0x54ec0e=_0x188b4a['models'];function _0x35cd36(_0x549b5a,_0x4d4bda){return new Promise(function(_0x2d4952,_0x138c80){if(!_0x4d4bda)return _0x2d4952(null);var _0xc34822=_0x4d4bda['filter']?{[_0x4d4bda[_0x629e('0x4')][_0x629e('0x5')]]:_0x4d4bda[_0x629e('0x4')][_0x629e('0x6')]}:undefined;return _0x54ec0e[_0x549b5a][_0x629e('0x7')]({'where':_0xc34822,'raw':!![]})[_0x629e('0x8')](function(_0x23b8c9){_0x4d4bda[_0x629e('0x9')]=_['map'](_0x23b8c9,'id');_0x2d4952(_0x4d4bda);})[_0x629e('0xa')](function(_0x2ace87){_0x138c80(_0x2ace87);});});}function _0x585cd1(_0xcd5005,_0x52a088){return new Promise(function(_0x44e2e0,_0xc76b99){var _0x3f0e61=_0xcd5005[_0x629e('0x4')]?{[_0xcd5005[_0x629e('0x4')][_0x629e('0x5')]]:_0xcd5005[_0x629e('0x4')]['value']}:undefined;return _0x54ec0e[_0xcd5005['model']][_0x629e('0x7')]({'where':_0x3f0e61,'raw':!![]})[_0x629e('0x8')](function(_0x1d9a84){_0x52a088[_0x629e('0x9')]=_[_0x629e('0xb')](_0x1d9a84,function(_0x47bb6a){return _0x47bb6a[_0x629e('0xc')];});_0x44e2e0(_0x52a088);})[_0x629e('0xa')](function(_0x679ec1){_0xc76b99(_0x679ec1);});});}function _0x512088(_0x47d3d0,_0xa01da5,_0x3fa023){if(!_0xa01da5)return Promise['resolve'](null);return new Promise(function(_0x2ad614,_0x372302){return _0x54ec0e[_0x629e('0xd')][_0x629e('0x7')]({'where':{'sectionId':_0xa01da5['id']},'raw':!![]})['then'](function(_0x5b6b9c){if(_0x47d3d0[_0x629e('0x5')]&&_0x47d3d0[_0x629e('0x5')]!=='id'){_0xa01da5['associatedResources']=_[_0x629e('0xb')](_0x5b6b9c,function(_0x15b26c){return _0x15b26c[_0x47d3d0['field']];});}else{if(_0x3fa023===_0x629e('0xe')){_0xa01da5['associatedResources']=_[_0x629e('0xb')](_0x5b6b9c,function(_0xd78dda){return{'id':_0xd78dda[_0x629e('0xf')],'type':_0xd78dda[_0x629e('0x10')]};});}else{_0xa01da5['associatedResources']=_[_0x629e('0xb')](_0x5b6b9c,function(_0x417040){return _0x417040[_0x629e('0xf')];});}}_0x2ad614(_0xa01da5);})[_0x629e('0xa')](function(_0x5cc362){_0x372302(_0x5cc362);});});}function _0x5a81ae(_0x1c6cf7,_0x446f86){var _0x45ab28={'parentSections':[]};switch(_0x1c6cf7[_0x629e('0x11')]()){case _0x629e('0x12'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x14');break;case _0x629e('0x15'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x16');break;case _0x629e('0x17'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x18');_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x1a'),'field':_0x629e('0xc'),'foreignKey':_0x629e('0x1b')}];break;case _0x629e('0x1c'):_0x45ab28[_0x629e('0x13')]='JscriptyProject';break;case _0x629e('0x1d'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x1e');_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x1f'),'field':'id','foreignKey':_0x629e('0x20')}];break;case _0x629e('0x21'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x22');break;case _0x629e('0x23'):_0x45ab28['childModel']=_0x629e('0x24');break;case'globalcustomfields':_0x45ab28[_0x629e('0x13')]=_0x629e('0x25');break;case'chatqueues':_0x45ab28[_0x629e('0x13')]=_0x629e('0x26');break;case'chatwebsites':_0x45ab28[_0x629e('0x13')]=_0x629e('0x27');break;case _0x629e('0x28'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x29');break;case _0x629e('0x2a'):_0x45ab28['childModel']=_0x629e('0x2b');break;case'inboundroutes':case _0x629e('0x2c'):case _0x629e('0x2d'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x2e');break;case'contexts':_0x45ab28[_0x629e('0x13')]=_0x629e('0x2f');break;case'voicemails':_0x45ab28['childModel']='VoiceMail';break;case'voicerecordings':_0x45ab28[_0x629e('0x13')]=_0x629e('0x30');_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x31'),'field':'name','foreignKey':_0x629e('0x32'),'model':_0x629e('0x33'),'filter':{'field':'role','value':[_0x629e('0x34')]}},{'name':'Telephones','field':'name','foreignKey':'membername','model':_0x629e('0x33'),'filter':{'field':_0x629e('0x35'),'value':['telephone']}},{'name':_0x629e('0x36'),'field':_0x629e('0xc'),'foreignKey':_0x629e('0x37'),'model':_0x629e('0x38'),'filter':{'field':_0x629e('0x10'),'value':[_0x629e('0x39')]}},{'name':_0x629e('0x3a'),'field':_0x629e('0xc'),'foreignKey':_0x629e('0x37'),'model':_0x629e('0x38'),'filter':{'field':'type','value':[_0x629e('0x3b')]}}];break;case _0x629e('0x3c'):_0x45ab28['childModel']=_0x629e('0x3d');break;case _0x629e('0x3e'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x3f');break;case _0x629e('0x40'):_0x45ab28[_0x629e('0x13')]='VoicePrefix';break;case'ivrcampaigns':_0x45ab28['childModel']=_0x629e('0x41');break;case _0x629e('0x42'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x43');break;case _0x629e('0x44'):_0x45ab28['childModel']=_0x629e('0x45');break;case _0x629e('0x46'):_0x45ab28['childModel']=_0x629e('0x47');break;case'openchannelqueues':_0x45ab28['childModel']=_0x629e('0x48');break;case _0x629e('0x49'):_0x45ab28['childModel']=_0x629e('0x4a');break;case _0x629e('0x4b'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x4c');break;case'smsaccounts':_0x45ab28['childModel']=_0x629e('0x4d');break;case _0x629e('0x4e'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x4f');break;case _0x629e('0x50'):_0x45ab28[_0x629e('0x13')]='WhatsappAccount';break;case _0x629e('0x51'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x52');break;case _0x629e('0x53'):case _0x629e('0x54'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x38');if(_0x446f86){_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x36')},{'name':'QueueCampaigns'}];}break;case _0x629e('0x55'):case _0x629e('0x56'):case _0x629e('0x57'):_0x45ab28['childModel']=_0x629e('0x33');if(_0x446f86){_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x58'),'filter':{'field':_0x629e('0x35'),'value':[_0x629e('0x59'),_0x629e('0x5a')]},'ignore':!![]},{'name':_0x629e('0x31')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x45ab28[_0x629e('0x13')]='ZendeskAccount';break;case _0x629e('0x5b'):_0x45ab28[_0x629e('0x13')]='SalesforceAccount';break;case _0x629e('0x5c'):_0x45ab28[_0x629e('0x13')]='FreshdeskAccount';break;case _0x629e('0x5d'):_0x45ab28['childModel']=_0x629e('0x5e');break;case'deskaccounts':_0x45ab28[_0x629e('0x13')]=_0x629e('0x5f');break;case _0x629e('0x60'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x61');break;case _0x629e('0x62'):_0x45ab28[_0x629e('0x13')]='User';break;case _0x629e('0x63'):_0x45ab28['childModel']=_0x629e('0x64');break;case _0x629e('0x65'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x66');break;case'customdashboards':_0x45ab28[_0x629e('0x13')]=_0x629e('0x67');break;case _0x629e('0x68'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x69');break;case'pauses':_0x45ab28[_0x629e('0x13')]=_0x629e('0x6a');break;case _0x629e('0x6b'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x6c');break;case _0x629e('0x6d'):_0x45ab28['childModel']=_0x629e('0x6e');break;case _0x629e('0x6f'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x70');break;case'templates':_0x45ab28['childModel']='Template';break;case _0x629e('0x71'):_0x45ab28['childModel']=_0x629e('0x72');break;case'trunks':_0x45ab28['childModel']=_0x629e('0x73');break;case _0x629e('0x74'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x75');break;case _0x629e('0x76'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x77');break;case'extractedreports':_0x45ab28[_0x629e('0x13')]=_0x629e('0xe');_0x45ab28[_0x629e('0x19')]=[{'name':_0x629e('0x78'),'field':'id','foreignKey':_0x629e('0x79')}];break;case _0x629e('0x7a'):_0x45ab28[_0x629e('0x13')]=_0x629e('0x7b');break;}return _0x45ab28;}function _0x3d7b61(_0x173541,_0x3dca5d){var _0x15eaee=_0x173541['charAt'](0x0)['toUpperCase']()+_0x173541[_0x629e('0x7c')](0x1);var _0x4b325d={'type':_0x54ec0e[_0x629e('0x7d')][_0x629e('0x7e')][_0x629e('0x7f')],'raw':!![]};return new Promise(function(_0x53ee73,_0x16dc47){var _0x504c8a=squel[_0x629e('0x80')]()[_0x629e('0x5')](_0x629e('0x81')+_0x15eaee+'InteractionId','id')['field']('ui.createdAt')[_0x629e('0x82')](_0x629e('0x83')+_0x173541+_0x629e('0x84'),'ui')[_0x629e('0x85')](_0x629e('0x86'),_0x3dca5d['id']);return _0x54ec0e['sequelize'][_0x629e('0x87')](_0x504c8a[_0x629e('0x88')](),_0x4b325d)['then'](function(_0x35384a){_0x3dca5d[_0x15eaee+_0x629e('0x89')]=_0x35384a;_0x53ee73(_0x35384a);})[_0x629e('0xa')](function(_0x2ca410){_0x16dc47(_0x2ca410);});});}return _0x188b4a[_0x629e('0x8a')]('UserProfile',attributes,{'tableName':_0x629e('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5ec720){var _0x4f0070=require(_0x629e('0x8c'));var _0xf09760={'raw':_0x5ec720[_0x629e('0x87')][_0x629e('0x8d')],'where':{}};var _0x582049={};var _0x4d72cf={'count':0x0,'rows':[]};var _0x3d69ca=_0x5ec720['query'][_0x629e('0x8e')];var _0x40b25e=_0x5ec720[_0x629e('0x87')][_0x629e('0x8f')]||![];var _0x2fe0b7=_0x5a81ae(_0x3d69ca,_0x40b25e);if(!_0x2fe0b7[_0x629e('0x13')])throw new Error(_0x629e('0x90')+_0x3d69ca+'\x27');var _0x10f198=[{'name':_0x3d69ca}];if(!_[_0x629e('0x91')](_0x2fe0b7['parentSections']))_0x10f198=_0x2fe0b7['parentSections'];var _0x57f0cf=[];for(var _0x1e7168=0x0;_0x1e7168<_0x10f198['length'];_0x1e7168++){_0x57f0cf['push'](_0x54ec0e[_0x629e('0x92')][_0x629e('0x93')]({'where':{'userProfileId':_0x5ec720[_0x629e('0x94')]['id'],'name':_0x10f198[_0x1e7168][_0x629e('0xc')]},'raw':!![]}));}return Promise[_0x629e('0x95')](_0x57f0cf)[_0x629e('0x8')](function(_0x52b3d8){var _0x529e2a=_[_0x629e('0x4')](_0x52b3d8,function(_0x3f7ab8){return _0x3f7ab8?_0x3f7ab8:undefined;});var _0x110821=_[_0x629e('0x4')](_0x10f198,[_0x629e('0x96'),!![]]);var _0x55175c=_[_0x629e('0x91')](_0x529e2a)&&_[_0x629e('0x91')](_0x110821)?null:_[_0x629e('0x97')](_0x110821,_0x529e2a);if(!_0x55175c)return null;var _0xa176b3=[];for(var _0x3f5433=0x0;_0x3f5433<_0x55175c[_0x629e('0x98')];_0x3f5433++){var _0x341bfa=_[_0x629e('0x93')](_0x10f198,function(_0x43d9f3){return _0x55175c[_0x3f5433]?_0x43d9f3[_0x629e('0xc')]===_0x55175c[_0x3f5433][_0x629e('0xc')]:null;});if(_0x341bfa){if(_0x55175c[_0x3f5433][_0x629e('0x96')]){_0xa176b3[_0x629e('0x99')](_0x35cd36(_0x2fe0b7[_0x629e('0x13')],_0x55175c[_0x3f5433]));}else{if(!_0x55175c[_0x3f5433][_0x629e('0x9a')]){_0xa176b3[_0x629e('0x99')](_0x512088(_0x341bfa,_0x55175c[_0x3f5433],_0x2fe0b7['childModel']));}else{if(_0x341bfa[_0x629e('0x9b')]){_0xa176b3[_0x629e('0x99')](_0x585cd1(_0x341bfa,_0x55175c[_0x3f5433]));}}}}}return Promise[_0x629e('0x95')](_0xa176b3);})[_0x629e('0x8')](function(_0x33327c){var _0x1e806d=_0x33327c;var _0x1896fd=null;if(_0x1e806d){_0x1896fd=_0x1e806d[_0x629e('0x98')]===0x1?_0x1e806d[0x0]:null;}if(!_0x1896fd&&!_0x1e806d)return _0x4d72cf;var _0x4c1c33=_0x54ec0e[_0x2fe0b7[_0x629e('0x13')]][_0x629e('0x9c')];_0x582049[_0x629e('0x9b')]=_[_0x629e('0x9d')](_0x4c1c33);_0x582049[_0x629e('0x87')]=_[_0x629e('0x9d')](_0x5ec720[_0x629e('0x87')]);_0x582049[_0x629e('0x9e')]=_[_0x629e('0x9f')](_0x582049['model'],_0x582049[_0x629e('0x87')]);_0xf09760['attributes']=_[_0x629e('0x9f')](_0x582049['model'],_0x4f0070[_0x629e('0xa0')](_0x5ec720[_0x629e('0x87')][_0x629e('0xa0')]));_0xf09760[_0x629e('0xa1')]=_0xf09760[_0x629e('0xa1')][_0x629e('0x98')]?_0xf09760[_0x629e('0xa1')]:_0x582049['model'];if(!_0x5ec720['query']['hasOwnProperty']('nolimit')){_0xf09760[_0x629e('0xa2')]=_0x4f0070[_0x629e('0xa2')](_0x5ec720[_0x629e('0x87')]['limit']);_0xf09760[_0x629e('0xa3')]=_0x4f0070[_0x629e('0xa3')](_0x5ec720[_0x629e('0x87')][_0x629e('0xa3')]);}_0xf09760[_0x629e('0xa4')]=_0x4f0070[_0x629e('0xa5')](_0x5ec720['query'][_0x629e('0xa5')]);_0xf09760['where']=_0x4f0070[_0x629e('0x9e')](_[_0x629e('0xa6')](_0x5ec720[_0x629e('0x87')],_0x582049[_0x629e('0x9e')]));if(_0x5ec720['query'][_0x629e('0x4')]){_0xf09760[_0x629e('0x85')]=_[_0x629e('0xa7')](_0xf09760[_0x629e('0x85')],{'$or':_[_0x629e('0xb')](_0x4c1c33,function(_0xe9987f){if(_0xe9987f[_0x629e('0x10')][_0x629e('0xa8')]!=='VIRTUAL'){var _0x10c88f={};_0x10c88f[_0xe9987f[_0x629e('0x5')]]={'$like':'%'+_0x5ec720[_0x629e('0x87')]['filter']+'%'};return _0x10c88f;}})});}var _0x1fa419=[];var _0x16f575=null;var _0x4ba8e3={};if(_0x1896fd){_0x16f575=_[_0x629e('0x93')](_0x10f198,[_0x629e('0xc'),_0x1896fd[_0x629e('0xc')]]);if(_0x16f575[_0x629e('0x5')]){_0x4ba8e3={};if(_0x2fe0b7['childModel']===_0x629e('0xe')){_0x4ba8e3[_0x16f575[_0x629e('0xa9')]]=_[_0x629e('0xb')](_0x1896fd[_0x629e('0x9')],'id');}else{_0x4ba8e3[_0x16f575[_0x629e('0xa9')]]=_0x1896fd[_0x629e('0x9')];}_0x1fa419[_0x629e('0x99')](_0x4ba8e3);}else{_0xf09760[_0x629e('0x85')]['id']=_0x1896fd[_0x629e('0x9')];}}else{for(var _0x52e404=0x0;_0x52e404<_0x1e806d[_0x629e('0x98')];_0x52e404++){_0x16f575=_[_0x629e('0x93')](_0x10f198,['name',_0x1e806d[_0x52e404][_0x629e('0xc')]]);if(_0x16f575[_0x629e('0x5')]){_0x4ba8e3={};_0x4ba8e3[_0x16f575['foreignKey']]=_0x1e806d[_0x52e404][_0x629e('0x9')];_0x1fa419[_0x629e('0x99')](_0x4ba8e3);}else{if(!_0xf09760['where']['id'])_0xf09760['where']['id']=[];_0x1e806d[_0x52e404][_0x629e('0x9')][_0x629e('0xaa')](function(_0x149af7){_0xf09760[_0x629e('0x85')]['id']['push'](_0x149af7);});}}}if(!_['isEmpty'](_0x1fa419)){_0xf09760[_0x629e('0x85')]=_[_0x629e('0xa7')](_0xf09760[_0x629e('0x85')],{'$and':{'$or':_0x1fa419}});}_0xf09760=_[_0x629e('0xa7')]({},_0xf09760,_0x5ec720[_0x629e('0xab')]);if(_0x1896fd&&!_0x1896fd[_0x629e('0x9a')]&&_0x2fe0b7[_0x629e('0x13')]==='AnalyticExtractedReport'){if(_0x5ec720[_0x629e('0x87')][_0x629e('0xac')]){_0xf09760[_0x629e('0xad')]=[{'all':!![]}];}return _0x54ec0e[_0x2fe0b7[_0x629e('0x13')]][_0x629e('0x7')](_0xf09760)[_0x629e('0x8')](function(_0x50d161){var _0xe8aeb3=[];_0x50d161['forEach'](function(_0xcb7aad){var _0x53a2e2;switch(_0xcb7aad[_0x629e('0xae')]){case _0x629e('0xaf'):_0x53a2e2=_[_0x629e('0x93')](_0x1896fd[_0x629e('0x9')],function(_0x43fdef){return _0x43fdef['id']===_0xcb7aad[_0x629e('0x79')]&&_0x43fdef['type']===_0x629e('0xb0');});break;case _0x629e('0xb1'):_0x53a2e2=_[_0x629e('0x93')](_0x1896fd[_0x629e('0x9')],function(_0x5e11d7){return _0x5e11d7['id']===_0xcb7aad[_0x629e('0x79')]&&_0x5e11d7[_0x629e('0x10')]==='CustomReports';});break;}if(_0x53a2e2)_0xe8aeb3['push'](_0xcb7aad);});_0x4d72cf['count']=_0xe8aeb3['length'];_0x4d72cf['rows']=_0xe8aeb3;return _0x4d72cf;});}else{if(!_[_0x629e('0x91')](_0x5ec720[_0x629e('0x87')]['ids'])){_0xf09760[_0x629e('0x85')]['id']=_0xf09760[_0x629e('0x85')]['id']?_[_0x629e('0x9f')](_0xf09760[_0x629e('0x85')]['id'],_0x5ec720[_0x629e('0x87')]['ids']):_0x5ec720[_0x629e('0x87')]['ids'];if(_0x5ec720['query'][_0x629e('0xb2')]){_0xf09760[_0x629e('0xa4')]=_0x5ec720[_0x629e('0x87')][_0x629e('0xb2')];}}if(_0x5ec720[_0x629e('0x87')][_0x629e('0xb3')]){_0xf09760[_0x629e('0x85')]=_[_0x629e('0xa7')](_0xf09760[_0x629e('0x85')],{'$and':_0x5ec720[_0x629e('0x87')][_0x629e('0xb3')]});}return _0x54ec0e[_0x2fe0b7[_0x629e('0x13')]][_0x629e('0xb4')]({'where':_0xf09760['where']})[_0x629e('0x8')](function(_0x27b6ba){_0x4d72cf[_0x629e('0xb4')]=_0x27b6ba;if(_0x5ec720[_0x629e('0x87')][_0x629e('0xac')]){if(_0x2fe0b7['childModel']==='CmContact'){_0xf09760[_0x629e('0xad')]=[{'model':_0x54ec0e['Tag'],'as':_0x629e('0xb5'),'attributes':['id','name',_0x629e('0xb6')],'required':_0x5ec720[_0x629e('0x87')]['tag']?!![]:![]},{'model':_0x54ec0e[_0x629e('0x70')],'as':_0x629e('0xb7'),'attributes':['id',_0x629e('0xc'),_0x629e('0xb6')],'through':_0x5ec720[_0x629e('0x87')][_0x629e('0xb8')]?{'attributes':[],'where':{'TagId':_0x5ec720[_0x629e('0x87')]['tag']||undefined}}:{},'required':_0x5ec720[_0x629e('0x87')]['tag']?!![]:![]}];}else{_0xf09760[_0x629e('0xad')]=[{'all':!![]}];}}return _0x54ec0e[_0x2fe0b7[_0x629e('0x13')]][_0x629e('0x7')](_0xf09760);})['then'](function(_0x5c102f){_0x4d72cf['rows']=_0x5c102f;if(_0x3d69ca==='Agents'&&_0x5ec720[_0x629e('0x87')]['openTabs']===_0x629e('0xb9')){var _0x56fe57=[];for(var _0x391aa7=0x0;_0x391aa7<_0x4d72cf[_0x629e('0xba')][_0x629e('0x98')];_0x391aa7++){_0x56fe57[_0x629e('0x99')](_0x3d7b61(_0x629e('0xbb'),_0x4d72cf[_0x629e('0xba')][_0x391aa7][_0x629e('0xbc')]));_0x56fe57[_0x629e('0x99')](_0x3d7b61(_0x629e('0xbd'),_0x4d72cf[_0x629e('0xba')][_0x391aa7][_0x629e('0xbc')]));_0x56fe57[_0x629e('0x99')](_0x3d7b61('fax',_0x4d72cf[_0x629e('0xba')][_0x391aa7][_0x629e('0xbc')]));_0x56fe57[_0x629e('0x99')](_0x3d7b61('mail',_0x4d72cf['rows'][_0x391aa7]['dataValues']));_0x56fe57[_0x629e('0x99')](_0x3d7b61(_0x629e('0xbe'),_0x4d72cf[_0x629e('0xba')][_0x391aa7][_0x629e('0xbc')]));_0x56fe57['push'](_0x3d7b61(_0x629e('0xbf'),_0x4d72cf['rows'][_0x391aa7][_0x629e('0xbc')]));}return Promise['all'](_0x56fe57)[_0x629e('0x8')](function(){return _0x4d72cf;});}return _0x4d72cf;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 9ccbe0b..cd6b768 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 _0xa786=['stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51052e,_0x1320b1){var _0x582042=function(_0x538cf9){while(--_0x538cf9){_0x51052e['push'](_0x51052e['shift']());}};_0x582042(++_0x1320b1);}(_0xa786,0x71));var _0x6a78=function(_0x59f6b7,_0x10e8af){_0x59f6b7=_0x59f6b7-0x0;var _0x572c63=_0xa786[_0x59f6b7];return _0x572c63;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});config['redis']=_[_0x6a78('0xb')](config[_0x6a78('0xc')],{'host':_0x6a78('0xd'),'port':0x18eb});var socket=require(_0x6a78('0xe'))(new Redis(config[_0x6a78('0xc')]));require(_0x6a78('0xf'))[_0x6a78('0x10')](socket);function respondWithRpcPromise(_0x2364b5,_0x43e233,_0x5dd2d2){return new BPromise(function(_0x25b436,_0x1fca69){return client[_0x6a78('0x11')](_0x2364b5,_0x5dd2d2)['then'](function(_0x2a433a){logger[_0x6a78('0x12')](_0x6a78('0x13'),_0x43e233,_0x6a78('0x14'));logger[_0x6a78('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x43e233,_0x6a78('0x14'),JSON[_0x6a78('0x16')](_0x2a433a));if(_0x2a433a[_0x6a78('0x17')]){if(_0x2a433a['error'][_0x6a78('0x18')]===0x1f4){logger[_0x6a78('0x17')]('UserProfile,\x20%s,\x20%s',_0x43e233,_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);return _0x1fca69(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x2a433a['error'][_0x6a78('0x19')]);return _0x25b436(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}else{logger[_0x6a78('0x12')]('UserProfile,\x20%s,\x20%s',_0x43e233,'request\x20sent');_0x25b436(_0x2a433a[_0x6a78('0x1a')]['message']);}})['catch'](function(_0x4efb20){logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x4efb20);_0x1fca69(_0x4efb20);});});} \ No newline at end of file +var _0x5bd7=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x5bd7,0x12a));var _0x75bd=function(_0x1a5182,_0x25b2dd){_0x1a5182=_0x1a5182-0x0;var _0x37d275=_0x5bd7[_0x1a5182];return _0x37d275;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var moment=require(_0x75bd('0x1'));var BPromise=require(_0x75bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75bd('0x4'));var logger=require(_0x75bd('0x5'))('rpc');var config=require(_0x75bd('0x6'));var jayson=require(_0x75bd('0x7'));var client=jayson[_0x75bd('0x8')]['http']({'port':0x232a});config[_0x75bd('0x9')]=_[_0x75bd('0xa')](config[_0x75bd('0x9')],{'host':_0x75bd('0xb'),'port':0x18eb});var socket=require(_0x75bd('0xc'))(new Redis(config[_0x75bd('0x9')]));require(_0x75bd('0xd'))['register'](socket);function respondWithRpcPromise(_0x6533d2,_0x5521c6,_0x4803ea){return new BPromise(function(_0x7ffa78,_0x5112f0){return client[_0x75bd('0xe')](_0x6533d2,_0x4803ea)['then'](function(_0xe552eb){logger[_0x75bd('0xf')](_0x75bd('0x10'),_0x5521c6,_0x75bd('0x11'));logger[_0x75bd('0x12')](_0x75bd('0x13'),_0x5521c6,'request\x20sent',JSON['stringify'](_0xe552eb));if(_0xe552eb['error']){if(_0xe552eb[_0x75bd('0x14')][_0x75bd('0x15')]===0x1f4){logger[_0x75bd('0x14')](_0x75bd('0x10'),_0x5521c6,_0xe552eb[_0x75bd('0x14')][_0x75bd('0x16')]);return _0x5112f0(_0xe552eb[_0x75bd('0x14')][_0x75bd('0x16')]);}logger[_0x75bd('0x14')]('UserProfile,\x20%s,\x20%s',_0x5521c6,_0xe552eb['error']['message']);return _0x7ffa78(_0xe552eb['error'][_0x75bd('0x16')]);}else{logger[_0x75bd('0xf')]('UserProfile,\x20%s,\x20%s',_0x5521c6,'request\x20sent');_0x7ffa78(_0xe552eb[_0x75bd('0x17')][_0x75bd('0x16')]);}})[_0x75bd('0x18')](function(_0x4a18fd){logger['error'](_0x75bd('0x10'),_0x5521c6,_0x4a18fd);_0x5112f0(_0x4a18fd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e043df1..f18c2f6 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 _0x6da3=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x6da3,0x6c));var _0x36da=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6da3[_0x4565bf];return _0x5610ba;};'use strict';var UserProfileEvents=require(_0x36da('0x0'));var events=[_0x36da('0x1'),_0x36da('0x2'),_0x36da('0x3')];function createListener(_0x3a1256,_0x3a22c4){return function(_0x1a68c8){_0x3a22c4['emit'](_0x3a1256,_0x1a68c8);};}function removeListener(_0x52ea7b,_0x484730){return function(){UserProfileEvents[_0x36da('0x4')](_0x52ea7b,_0x484730);};}exports[_0x36da('0x5')]=function(_0x21e62f){for(var _0x2a3c97=0x0,_0x7013b2=events[_0x36da('0x6')];_0x2a3c97<_0x7013b2;_0x2a3c97++){var _0x185cc5=events[_0x2a3c97];var _0x4ee6d5=createListener(_0x36da('0x7')+_0x185cc5,_0x21e62f);UserProfileEvents['on'](_0x185cc5,_0x4ee6d5);}}; \ No newline at end of file +var _0x30d2=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x4eeef1,_0x4c7fb6){var _0x5e94ad=function(_0x41e5a6){while(--_0x41e5a6){_0x4eeef1['push'](_0x4eeef1['shift']());}};_0x5e94ad(++_0x4c7fb6);}(_0x30d2,0x1df));var _0x230d=function(_0x4454e7,_0x2e916a){_0x4454e7=_0x4454e7-0x0;var _0x4c2a56=_0x30d2[_0x4454e7];return _0x4c2a56;};'use strict';var UserProfileEvents=require(_0x230d('0x0'));var events=[_0x230d('0x1'),_0x230d('0x2'),_0x230d('0x3')];function createListener(_0x3f6d03,_0x4a6d3a){return function(_0x46fc91){_0x4a6d3a[_0x230d('0x4')](_0x3f6d03,_0x46fc91);};}function removeListener(_0x45f2eb,_0x122049){return function(){UserProfileEvents[_0x230d('0x5')](_0x45f2eb,_0x122049);};}exports[_0x230d('0x6')]=function(_0x242058){for(var _0x298fa4=0x0,_0xeb8130=events[_0x230d('0x7')];_0x298fa4<_0xeb8130;_0x298fa4++){var _0x3b51ae=events[_0x298fa4];var _0xe38b1d=createListener(_0x230d('0x8')+_0x3b51ae,_0x242058);UserProfileEvents['on'](_0x3b51ae,_0xe38b1d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c28b43b..c8d2cba 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 _0x7d66=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports'];(function(_0x35d5a1,_0x3cc0b2){var _0x332793=function(_0x2e006d){while(--_0x2e006d){_0x35d5a1['push'](_0x35d5a1['shift']());}};_0x332793(++_0x3cc0b2);}(_0x7d66,0x1ce));var _0x67d6=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x7d66[_0x22431e];return _0xd978e9;};'use strict';var multer=require(_0x67d6('0x0'));var util=require(_0x67d6('0x1'));var path=require(_0x67d6('0x2'));var timeout=require(_0x67d6('0x3'));var express=require(_0x67d6('0x4'));var router=express[_0x67d6('0x5')]();var fs_extra=require(_0x67d6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x67d6('0x7'));var config=require(_0x67d6('0x8'));var controller=require(_0x67d6('0x9'));router[_0x67d6('0xa')]('/',auth['isAuthenticated'](),controller[_0x67d6('0xb')]);router[_0x67d6('0xa')](_0x67d6('0xc'),auth[_0x67d6('0xd')](),controller[_0x67d6('0xe')]);router[_0x67d6('0xa')](_0x67d6('0xf'),auth['isAuthenticated'](),controller[_0x67d6('0x10')]);router[_0x67d6('0x11')]('/',auth[_0x67d6('0xd')](),controller[_0x67d6('0x12')]);router['put'](_0x67d6('0xf'),auth[_0x67d6('0xd')](),controller[_0x67d6('0x13')]);router[_0x67d6('0x14')](_0x67d6('0xf'),auth[_0x67d6('0xd')](),controller['destroy']);module[_0x67d6('0x15')]=router; \ No newline at end of file +var _0x1c3e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1c3e,0xcd));var _0xe1c3=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x1c3e[_0x290fa6];return _0x47f1f3;};'use strict';var multer=require(_0xe1c3('0x0'));var util=require(_0xe1c3('0x1'));var path=require(_0xe1c3('0x2'));var timeout=require(_0xe1c3('0x3'));var express=require(_0xe1c3('0x4'));var router=express[_0xe1c3('0x5')]();var fs_extra=require(_0xe1c3('0x6'));var auth=require(_0xe1c3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe1c3('0x8'));var controller=require(_0xe1c3('0x9'));router[_0xe1c3('0xa')]('/',auth[_0xe1c3('0xb')](),controller[_0xe1c3('0xc')]);router[_0xe1c3('0xa')]('/describe',auth[_0xe1c3('0xb')](),controller[_0xe1c3('0xd')]);router[_0xe1c3('0xa')](_0xe1c3('0xe'),auth['isAuthenticated'](),controller[_0xe1c3('0xf')]);router[_0xe1c3('0x10')]('/',auth[_0xe1c3('0xb')](),controller[_0xe1c3('0x11')]);router[_0xe1c3('0x12')]('/:id',auth[_0xe1c3('0xb')](),controller[_0xe1c3('0x13')]);router[_0xe1c3('0x14')](_0xe1c3('0xe'),auth[_0xe1c3('0xb')](),controller[_0xe1c3('0x15')]);module[_0xe1c3('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d835540..5c5fe1a 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 _0xab26=['STRING','sequelize','exports'];(function(_0x3b1aec,_0x4a66ff){var _0x574c45=function(_0x4c5495){while(--_0x4c5495){_0x3b1aec['push'](_0x3b1aec['shift']());}};_0x574c45(++_0x4a66ff);}(_0xab26,0x1b7));var _0x6ab2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab26[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x6ab2('0x0'));module[_0x6ab2('0x1')]={'name':{'type':Sequelize[_0x6ab2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc799=['sequelize','STRING','INTEGER'];(function(_0x4a2791,_0x573da4){var _0x47ac8c=function(_0x34c86f){while(--_0x34c86f){_0x4a2791['push'](_0x4a2791['shift']());}};_0x47ac8c(++_0x573da4);}(_0xc799,0x153));var _0x9c79=function(_0x335794,_0x358307){_0x335794=_0x335794-0x0;var _0x2eb843=_0xc799[_0x335794];return _0x2eb843;};'use strict';var Sequelize=require(_0x9c79('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c79('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9c79('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9c79('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 869b7ac..4330aee 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0x318daa,_0x1fb963){var _0x25d334=function(_0x55f9eb){while(--_0x55f9eb){_0x318daa['push'](_0x318daa['shift']());}};_0x25d334(++_0x1fb963);}(_0x47c5,0x165));var _0x547c=function(_0x230daa,_0x2d4dd0){_0x230daa=_0x230daa-0x0;var _0x210dc5=_0x47c5[_0x230daa];return _0x210dc5;};'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'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0xb016=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','UserProfileResource','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','find','body','describe','eml-format','rimraf','request-promise','bluebird','mustache'];(function(_0x7fa9b9,_0x52e74d){var _0x5818ef=function(_0x51525d){while(--_0x51525d){_0x7fa9b9['push'](_0x7fa9b9['shift']());}};_0x5818ef(++_0x52e74d);}(_0xb016,0x159));var _0x6b01=function(_0x4a67e4,_0x26c9c7){_0x4a67e4=_0x4a67e4-0x0;var _0x2b81d0=_0xb016[_0x4a67e4];return _0x2b81d0;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['create']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['create'](_0x408bb0['body'],{})['then'](respondWithResult(_0x27442e,0xc9))[_0x6b01('0x40')](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x518d94,_0x34cef6){if(_0x518d94['body']['id']){delete _0x518d94['body']['id'];}return db['UserProfileResource'][_0x6b01('0x43')]({'where':{'id':_0x518d94[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x34cef6,null))['then'](saveUpdates(_0x518d94[_0x6b01('0x44')],null))['then'](respondWithResult(_0x34cef6,null))[_0x6b01('0x40')](handleError(_0x34cef6,null));};exports[_0x6b01('0x22')]=function(_0x32d446,_0x172a56){return db[_0x6b01('0x29')]['find']({'where':{'id':_0x32d446[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x172a56,null))[_0x6b01('0x21')](removeEntity(_0x172a56,null))['catch'](handleError(_0x172a56,null));};exports[_0x6b01('0x45')]=function(_0x13ab4f,_0x5617d7){return db[_0x6b01('0x29')][_0x6b01('0x45')]()[_0x6b01('0x21')](respondWithResult(_0x5617d7,null))[_0x6b01('0x40')](handleError(_0x5617d7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4d8fb96..355d1b4 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 _0x30f8=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b37bb,_0x51eb92){var _0x5cf003=function(_0x5c9506){while(--_0x5c9506){_0x2b37bb['push'](_0x2b37bb['shift']());}};_0x5cf003(++_0x51eb92);}(_0x30f8,0xae));var _0x830f=function(_0x585e26,_0x3fdacb){_0x585e26=_0x585e26-0x0;var _0x5c90e1=_0x30f8[_0x585e26];return _0x5c90e1;};'use strict';var _=require('lodash');var util=require(_0x830f('0x0'));var logger=require('../../config/logger')(_0x830f('0x1'));var moment=require(_0x830f('0x2'));var BPromise=require(_0x830f('0x3'));var rp=require(_0x830f('0x4'));var fs=require('fs');var path=require(_0x830f('0x5'));var rimraf=require(_0x830f('0x6'));var config=require(_0x830f('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x830f('0x8')]=function(_0x57bafc,_0x10dc7b){return _0x57bafc[_0x830f('0x9')](_0x830f('0xa'),attributes,{'tableName':_0x830f('0xb'),'paranoid':![],'indexes':[{'name':_0x830f('0xc'),'fields':['resourceId',_0x830f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9c5=['path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId','sectionId','lodash','moment','request-promise'];(function(_0x32de1c,_0x1b9e3b){var _0x34efc5=function(_0x16779d){while(--_0x16779d){_0x32de1c['push'](_0x32de1c['shift']());}};_0x34efc5(++_0x1b9e3b);}(_0xa9c5,0x1ad));var _0x5a9c=function(_0x32f494,_0x44ba69){_0x32f494=_0x32f494-0x0;var _0x4d0a54=_0xa9c5[_0x32f494];return _0x4d0a54;};'use strict';var _=require(_0x5a9c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5a9c('0x1'));var BPromise=require('bluebird');var rp=require(_0x5a9c('0x2'));var fs=require('fs');var path=require(_0x5a9c('0x3'));var rimraf=require(_0x5a9c('0x4'));var config=require(_0x5a9c('0x5'));var attributes=require(_0x5a9c('0x6'));module[_0x5a9c('0x7')]=function(_0x39166a,_0x2d3ea7){return _0x39166a[_0x5a9c('0x8')]('UserProfileResource',attributes,{'tableName':_0x5a9c('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x5a9c('0xa'),_0x5a9c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index a981797..0b71319 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 _0x7ba9=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x156fd4,_0x384b1e){var _0x36db69=function(_0x4b5521){while(--_0x4b5521){_0x156fd4['push'](_0x156fd4['shift']());}};_0x36db69(++_0x384b1e);}(_0x7ba9,0xbc));var _0x97ba=function(_0x263f76,_0x2ee49f){_0x263f76=_0x263f76-0x0;var _0x4112de=_0x7ba9[_0x263f76];return _0x4112de;};'use strict';var _=require(_0x97ba('0x0'));var util=require('util');var moment=require(_0x97ba('0x1'));var BPromise=require(_0x97ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x97ba('0x4'))(_0x97ba('0x5'));var config=require(_0x97ba('0x6'));var jayson=require(_0x97ba('0x7'));var client=jayson['client'][_0x97ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eade4,_0x1e10e9,_0x15aa27){return new BPromise(function(_0x4b9933,_0x547369){return client[_0x97ba('0x9')](_0x3eade4,_0x15aa27)[_0x97ba('0xa')](function(_0x4379b6){logger[_0x97ba('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x1e10e9,_0x97ba('0xc'));logger[_0x97ba('0xd')](_0x97ba('0xe'),_0x1e10e9,'request\x20sent',JSON['stringify'](_0x4379b6));if(_0x4379b6['error']){if(_0x4379b6[_0x97ba('0xf')][_0x97ba('0x10')]===0x1f4){logger[_0x97ba('0xf')](_0x97ba('0x11'),_0x1e10e9,_0x4379b6[_0x97ba('0xf')][_0x97ba('0x12')]);return _0x547369(_0x4379b6[_0x97ba('0xf')][_0x97ba('0x12')]);}logger[_0x97ba('0xf')](_0x97ba('0x11'),_0x1e10e9,_0x4379b6[_0x97ba('0xf')][_0x97ba('0x12')]);return _0x4b9933(_0x4379b6[_0x97ba('0xf')]['message']);}else{logger[_0x97ba('0xb')](_0x97ba('0x11'),_0x1e10e9,_0x97ba('0xc'));_0x4b9933(_0x4379b6['result'][_0x97ba('0x12')]);}})[_0x97ba('0x13')](function(_0x3a6e37){logger[_0x97ba('0xf')](_0x97ba('0x11'),_0x1e10e9,_0x3a6e37);_0x547369(_0x3a6e37);});});} \ No newline at end of file +var _0x4d52=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash'];(function(_0x332522,_0x25b699){var _0x91e746=function(_0x3551c9){while(--_0x3551c9){_0x332522['push'](_0x332522['shift']());}};_0x91e746(++_0x25b699);}(_0x4d52,0x1b4));var _0x24d5=function(_0x4894ac,_0x756eda){_0x4894ac=_0x4894ac-0x0;var _0x4c64b1=_0x4d52[_0x4894ac];return _0x4c64b1;};'use strict';var _=require(_0x24d5('0x0'));var util=require(_0x24d5('0x1'));var moment=require(_0x24d5('0x2'));var BPromise=require(_0x24d5('0x3'));var rs=require(_0x24d5('0x4'));var fs=require('fs');var Redis=require(_0x24d5('0x5'));var db=require(_0x24d5('0x6'))['db'];var utils=require(_0x24d5('0x7'));var logger=require(_0x24d5('0x8'))('rpc');var config=require(_0x24d5('0x9'));var jayson=require(_0x24d5('0xa'));var client=jayson[_0x24d5('0xb')][_0x24d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14a5f1,_0x93c842,_0x20e412){return new BPromise(function(_0x158245,_0x597d6f){return client[_0x24d5('0xd')](_0x14a5f1,_0x20e412)['then'](function(_0x17f05f){logger['info'](_0x24d5('0xe'),_0x93c842,_0x24d5('0xf'));logger[_0x24d5('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x93c842,_0x24d5('0xf'),JSON['stringify'](_0x17f05f));if(_0x17f05f['error']){if(_0x17f05f[_0x24d5('0x11')][_0x24d5('0x12')]===0x1f4){logger[_0x24d5('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x93c842,_0x17f05f[_0x24d5('0x11')][_0x24d5('0x13')]);return _0x597d6f(_0x17f05f[_0x24d5('0x11')][_0x24d5('0x13')]);}logger[_0x24d5('0x11')](_0x24d5('0xe'),_0x93c842,_0x17f05f[_0x24d5('0x11')][_0x24d5('0x13')]);return _0x158245(_0x17f05f[_0x24d5('0x11')][_0x24d5('0x13')]);}else{logger[_0x24d5('0x14')](_0x24d5('0xe'),_0x93c842,_0x24d5('0xf'));_0x158245(_0x17f05f[_0x24d5('0x15')][_0x24d5('0x13')]);}})[_0x24d5('0x16')](function(_0x4b4e0b){logger[_0x24d5('0x11')](_0x24d5('0xe'),_0x93c842,_0x4b4e0b);_0x597d6f(_0x4b4e0b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index fd4facf..e072332 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 _0x0d0e=['get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x251fa8,_0x438d42){var _0x3d89e9=function(_0x5f91dc){while(--_0x5f91dc){_0x251fa8['push'](_0x251fa8['shift']());}};_0x3d89e9(++_0x438d42);}(_0x0d0e,0xbf));var _0xe0d0=function(_0x1e3b23,_0x32ec7c){_0x1e3b23=_0x1e3b23-0x0;var _0xc5c2ec=_0x0d0e[_0x1e3b23];return _0xc5c2ec;};'use strict';var multer=require(_0xe0d0('0x0'));var util=require(_0xe0d0('0x1'));var path=require(_0xe0d0('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0d0('0x3'));var router=express[_0xe0d0('0x4')]();var fs_extra=require(_0xe0d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe0d0('0x6'));var config=require(_0xe0d0('0x7'));var controller=require(_0xe0d0('0x8'));router[_0xe0d0('0x9')]('/',auth[_0xe0d0('0xa')](),controller[_0xe0d0('0xb')]);router[_0xe0d0('0x9')]('/describe',auth[_0xe0d0('0xa')](),controller[_0xe0d0('0xc')]);router['get'](_0xe0d0('0xd'),auth['isAuthenticated'](),controller[_0xe0d0('0xe')]);router['post']('/',auth[_0xe0d0('0xa')](),controller['create']);router[_0xe0d0('0xf')](_0xe0d0('0xd'),auth['isAuthenticated'](),controller[_0xe0d0('0x10')]);router[_0xe0d0('0x11')]('/:id',auth[_0xe0d0('0xa')](),controller[_0xe0d0('0x12')]);module[_0xe0d0('0x13')]=router; \ No newline at end of file +var _0x889d=['../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','create','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3cdd83,_0x4c9216){var _0x139a73=function(_0x26b975){while(--_0x26b975){_0x3cdd83['push'](_0x3cdd83['shift']());}};_0x139a73(++_0x4c9216);}(_0x889d,0x192));var _0xd889=function(_0x41e3ae,_0x1fa1fc){_0x41e3ae=_0x41e3ae-0x0;var _0x31c1d2=_0x889d[_0x41e3ae];return _0x31c1d2;};'use strict';var multer=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var path=require(_0xd889('0x2'));var timeout=require('connect-timeout');var express=require(_0xd889('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd889('0x4'));var interaction=require(_0xd889('0x5'));var config=require(_0xd889('0x6'));var controller=require(_0xd889('0x7'));router[_0xd889('0x8')]('/',auth[_0xd889('0x9')](),controller[_0xd889('0xa')]);router[_0xd889('0x8')]('/describe',auth[_0xd889('0x9')](),controller[_0xd889('0xb')]);router['get'](_0xd889('0xc'),auth[_0xd889('0x9')](),controller['show']);router['post']('/',auth[_0xd889('0x9')](),controller[_0xd889('0xd')]);router['put'](_0xd889('0xc'),auth[_0xd889('0x9')](),controller[_0xd889('0xe')]);router['delete']('/:id',auth[_0xd889('0x9')](),controller[_0xd889('0xf')]);module[_0xd889('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index bad3e20..2a3418b 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 _0x065e=['crudPermissions','getDataValue','split','sequelize','INTEGER','BOOLEAN','setDataValue'];(function(_0x45ff60,_0x4387bf){var _0x2518b8=function(_0x3b8364){while(--_0x3b8364){_0x45ff60['push'](_0x45ff60['shift']());}};_0x2518b8(++_0x4387bf);}(_0x065e,0x1a7));var _0xe065=function(_0x114a62,_0x16e596){_0x114a62=_0x114a62-0x0;var _0x394695=_0x065e[_0x114a62];return _0x394695;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4964fa){this[_0xe065('0x3')](_0xe065('0x4'),_0x4964fa?_0x4964fa['join'](''):[]);},'get':function(){return this[_0xe065('0x5')](_0xe065('0x4'))?this[_0xe065('0x5')]('crudPermissions')[_0xe065('0x6')](''):[];}}}; \ No newline at end of file +var _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x47d297,_0x18d953){var _0x235938=function(_0x53c103){while(--_0x53c103){_0x47d297['push'](_0x47d297['shift']());}};_0x235938(++_0x18d953);}(_0xefda,0x96));var _0xaefd=function(_0x388941,_0xefe17){_0x388941=_0x388941-0x0;var _0x5eaea2=_0xefda[_0x388941];return _0x5eaea2;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index df591b9..24fb3dc 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 _0x3c15=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','then','destroy','error','name','send','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','UserProfileSection','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3c15,0x11d));var _0x53c1=function(_0x53d520,_0x35c166){_0x53d520=_0x53d520-0x0;var _0x488a7e=_0x3c15[_0x53d520];return _0x488a7e;};'use strict';var emlformat=require(_0x53c1('0x0'));var rimraf=require(_0x53c1('0x1'));var zipdir=require(_0x53c1('0x2'));var jsonpatch=require(_0x53c1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x53c1('0x4'));var Mustache=require('mustache');var util=require(_0x53c1('0x5'));var path=require(_0x53c1('0x6'));var sox=require(_0x53c1('0x7'));var csv=require(_0x53c1('0x8'));var ejs=require(_0x53c1('0x9'));var fs=require('fs');var fs_extra=require(_0x53c1('0xa'));var _=require(_0x53c1('0xb'));var squel=require(_0x53c1('0xc'));var crypto=require(_0x53c1('0xd'));var jsforce=require(_0x53c1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x53c1('0x8'));var querystring=require('querystring');var Papa=require(_0x53c1('0xf'));var Redis=require(_0x53c1('0x10'));var authService=require(_0x53c1('0x11'));var qs=require(_0x53c1('0x12'));var as=require(_0x53c1('0x13'));var hardwareService=require(_0x53c1('0x14'));var logger=require('../../config/logger')(_0x53c1('0x15'));var utils=require(_0x53c1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x53c1('0x17'));var db=require(_0x53c1('0x18'))['db'];function respondWithStatusCode(_0x55e65b,_0x395ffb){_0x395ffb=_0x395ffb||0xcc;return function(_0x4016ae){if(_0x4016ae){return _0x55e65b[_0x53c1('0x19')](_0x395ffb);}return _0x55e65b[_0x53c1('0x1a')](_0x395ffb)[_0x53c1('0x1b')]();};}function respondWithResult(_0x3c8374,_0x5a5ce7){_0x5a5ce7=_0x5a5ce7||0xc8;return function(_0x3652f7){if(_0x3652f7){return _0x3c8374[_0x53c1('0x1a')](_0x5a5ce7)['json'](_0x3652f7);}};}function respondWithFilteredResult(_0x1dcd63,_0x37699b){return function(_0x49706d){if(_0x49706d){var _0x418e28=typeof _0x37699b[_0x53c1('0x1c')]===_0x53c1('0x1d')&&typeof _0x37699b['limit']==='undefined';var _0x5a866e=_0x49706d['count'];var _0x4337a6=_0x418e28?0x0:_0x37699b[_0x53c1('0x1c')];var _0x26582e=_0x418e28?_0x49706d[_0x53c1('0x1e')]:_0x37699b['offset']+_0x37699b[_0x53c1('0x1f')];var _0x20b7b1;if(_0x26582e>=_0x5a866e){_0x26582e=_0x5a866e;_0x20b7b1=0xc8;}else{_0x20b7b1=0xce;}_0x1dcd63[_0x53c1('0x1a')](_0x20b7b1);return _0x1dcd63[_0x53c1('0x20')]('Content-Range',_0x4337a6+'-'+_0x26582e+'/'+_0x5a866e)[_0x53c1('0x21')](_0x49706d);}return null;};}function patchUpdates(_0x403b6c){return function(_0x149f55){try{jsonpatch['apply'](_0x149f55,_0x403b6c,!![]);}catch(_0x4c9387){return BPromise[_0x53c1('0x22')](_0x4c9387);}return _0x149f55[_0x53c1('0x23')]();};}function saveUpdates(_0x518b26,_0x1a7c96){return function(_0x1e722b){if(_0x1e722b){return _0x1e722b['update'](_0x518b26)[_0x53c1('0x24')](function(_0x1eac83){return _0x1eac83;});}return null;};}function removeEntity(_0x3221dd,_0x26ca80){return function(_0x1e77b2){if(_0x1e77b2){return _0x1e77b2[_0x53c1('0x25')]()[_0x53c1('0x24')](function(){_0x3221dd[_0x53c1('0x1a')](0xcc)[_0x53c1('0x1b')]();});}};}function handleEntityNotFound(_0x19aaa7,_0x55a242){return function(_0x309c82){if(!_0x309c82){_0x19aaa7[_0x53c1('0x19')](0x194);}return _0x309c82;};}function handleError(_0x12b20e,_0xba915d){_0xba915d=_0xba915d||0x1f4;return function(_0x5c0fe3){logger[_0x53c1('0x26')](_0x5c0fe3['stack']);if(_0x5c0fe3[_0x53c1('0x27')]){delete _0x5c0fe3[_0x53c1('0x27')];}_0x12b20e[_0x53c1('0x1a')](_0xba915d)[_0x53c1('0x28')](_0x5c0fe3);};}exports['index']=function(_0x17c043,_0x5b89ce){var _0x2e5499={},_0x43d923={},_0x9ab482={'count':0x0,'rows':[]};var _0x498ed6=_['map'](db['UserProfileSection'][_0x53c1('0x29')],function(_0x2031c3){return{'name':_0x2031c3[_0x53c1('0x2a')],'type':_0x2031c3[_0x53c1('0x2b')]['key']};});_0x43d923[_0x53c1('0x2c')]=_['map'](_0x498ed6,_0x53c1('0x27'));_0x43d923[_0x53c1('0x2d')]=_[_0x53c1('0x2e')](_0x17c043['query']);_0x43d923[_0x53c1('0x2f')]=_[_0x53c1('0x30')](_0x43d923[_0x53c1('0x2c')],_0x43d923[_0x53c1('0x2d')]);_0x2e5499[_0x53c1('0x31')]=_[_0x53c1('0x30')](_0x43d923['model'],qs[_0x53c1('0x32')](_0x17c043[_0x53c1('0x2d')][_0x53c1('0x32')]));_0x2e5499[_0x53c1('0x31')]=_0x2e5499[_0x53c1('0x31')][_0x53c1('0x33')]?_0x2e5499['attributes']:_0x43d923[_0x53c1('0x2c')];if(!_0x17c043[_0x53c1('0x2d')][_0x53c1('0x34')](_0x53c1('0x35'))){_0x2e5499[_0x53c1('0x1f')]=qs[_0x53c1('0x1f')](_0x17c043[_0x53c1('0x2d')][_0x53c1('0x1f')]);_0x2e5499[_0x53c1('0x1c')]=qs[_0x53c1('0x1c')](_0x17c043[_0x53c1('0x2d')][_0x53c1('0x1c')]);}_0x2e5499[_0x53c1('0x36')]=qs[_0x53c1('0x37')](_0x17c043[_0x53c1('0x2d')][_0x53c1('0x37')]);_0x2e5499[_0x53c1('0x38')]=qs[_0x53c1('0x2f')](_[_0x53c1('0x39')](_0x17c043[_0x53c1('0x2d')],_0x43d923[_0x53c1('0x2f')]),_0x498ed6);if(_0x17c043[_0x53c1('0x2d')][_0x53c1('0x3a')]){_0x2e5499[_0x53c1('0x38')]=_[_0x53c1('0x3b')](_0x2e5499[_0x53c1('0x38')],{'$or':_[_0x53c1('0x3c')](_0x498ed6,function(_0x662097){if(_0x662097['type']!==_0x53c1('0x3d')){var _0x23ffd3={};_0x23ffd3[_0x662097[_0x53c1('0x27')]]={'$like':'%'+_0x17c043[_0x53c1('0x2d')][_0x53c1('0x3a')]+'%'};return _0x23ffd3;}})});}_0x2e5499=_[_0x53c1('0x3b')]({},_0x2e5499,_0x17c043[_0x53c1('0x3e')]);var _0x2a8d12={'where':_0x2e5499[_0x53c1('0x38')]};return db[_0x53c1('0x3f')][_0x53c1('0x1e')](_0x2a8d12)['then'](function(_0x384a0f){_0x9ab482['count']=_0x384a0f;if(_0x17c043[_0x53c1('0x2d')][_0x53c1('0x40')]){_0x2e5499[_0x53c1('0x41')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x2e5499);})['then'](function(_0x352266){_0x9ab482[_0x53c1('0x42')]=_0x352266;return _0x9ab482;})[_0x53c1('0x24')](respondWithFilteredResult(_0x5b89ce,_0x2e5499))[_0x53c1('0x43')](handleError(_0x5b89ce,null));};exports[_0x53c1('0x44')]=function(_0x43b7ac,_0x4e2298){var _0x52f184={'raw':![],'where':{'id':_0x43b7ac[_0x53c1('0x45')]['id']}},_0x566230={};_0x566230['model']=_['keys'](db[_0x53c1('0x3f')][_0x53c1('0x29')]);_0x566230['query']=_[_0x53c1('0x2e')](_0x43b7ac[_0x53c1('0x2d')]);_0x566230[_0x53c1('0x2f')]=_[_0x53c1('0x30')](_0x566230[_0x53c1('0x2c')],_0x566230[_0x53c1('0x2d')]);_0x52f184['attributes']=_['intersection'](_0x566230['model'],qs[_0x53c1('0x32')](_0x43b7ac[_0x53c1('0x2d')]['fields']));_0x52f184[_0x53c1('0x31')]=_0x52f184['attributes']['length']?_0x52f184[_0x53c1('0x31')]:_0x566230[_0x53c1('0x2c')];if(_0x43b7ac[_0x53c1('0x2d')]['includeAll']){_0x52f184['include']=[{'all':!![]}];}_0x52f184=_[_0x53c1('0x3b')]({},_0x52f184,_0x43b7ac[_0x53c1('0x3e')]);return db[_0x53c1('0x3f')]['find'](_0x52f184)['then'](handleEntityNotFound(_0x4e2298,null))[_0x53c1('0x24')](respondWithResult(_0x4e2298,null))[_0x53c1('0x43')](handleError(_0x4e2298,null));};exports[_0x53c1('0x46')]=function(_0x2615c4,_0x34a776){return db['UserProfileSection'][_0x53c1('0x46')](_0x2615c4['body'],{})[_0x53c1('0x24')](respondWithResult(_0x34a776,0xc9))[_0x53c1('0x43')](handleError(_0x34a776,null));};exports['update']=function(_0xfaf141,_0x2eb97a){if(_0xfaf141['body']['id']){delete _0xfaf141[_0x53c1('0x47')]['id'];}return db[_0x53c1('0x3f')][_0x53c1('0x48')]({'where':{'id':_0xfaf141[_0x53c1('0x45')]['id']}})[_0x53c1('0x24')](handleEntityNotFound(_0x2eb97a,null))[_0x53c1('0x24')](saveUpdates(_0xfaf141[_0x53c1('0x47')],null))[_0x53c1('0x24')](respondWithResult(_0x2eb97a,null))[_0x53c1('0x43')](handleError(_0x2eb97a,null));};exports['destroy']=function(_0x4997c1,_0x4c6cdd){return db[_0x53c1('0x3f')]['find']({'where':{'id':_0x4997c1['params']['id']}})[_0x53c1('0x24')](handleEntityNotFound(_0x4c6cdd,null))['then'](removeEntity(_0x4c6cdd,null))[_0x53c1('0x43')](handleError(_0x4c6cdd,null));};exports[_0x53c1('0x49')]=function(_0x2e21ec,_0x24fb49){return db[_0x53c1('0x3f')][_0x53c1('0x49')]()[_0x53c1('0x24')](respondWithResult(_0x24fb49,null))[_0x53c1('0x43')](handleError(_0x24fb49,null));}; \ No newline at end of file +var _0xf089=['fast-json-patch','request-promise','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','query','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','find','destroy','describe','eml-format','rimraf'];(function(_0x22e571,_0x443a32){var _0x5b3f1c=function(_0x52a0ce){while(--_0x52a0ce){_0x22e571['push'](_0x22e571['shift']());}};_0x5b3f1c(++_0x443a32);}(_0xf089,0x8a));var _0x9f08=function(_0x35afef,_0x2c91f9){_0x35afef=_0x35afef-0x0;var _0x3f8805=_0xf089[_0x35afef];return _0x3f8805;};'use strict';var emlformat=require(_0x9f08('0x0'));var rimraf=require(_0x9f08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f08('0x2'));var rp=require(_0x9f08('0x3'));var moment=require('moment');var BPromise=require(_0x9f08('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9f08('0x5'));var csv=require(_0x9f08('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f08('0x7'));var _=require(_0x9f08('0x8'));var squel=require(_0x9f08('0x9'));var crypto=require(_0x9f08('0xa'));var jsforce=require(_0x9f08('0xb'));var deskjs=require(_0x9f08('0xc'));var toCsv=require(_0x9f08('0x6'));var querystring=require(_0x9f08('0xd'));var Papa=require('papaparse');var Redis=require(_0x9f08('0xe'));var authService=require(_0x9f08('0xf'));var qs=require(_0x9f08('0x10'));var as=require(_0x9f08('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f08('0x12'))(_0x9f08('0x13'));var utils=require(_0x9f08('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f08('0x15'))['db'];function respondWithStatusCode(_0x3210ce,_0x2edc98){_0x2edc98=_0x2edc98||0xcc;return function(_0x134b61){if(_0x134b61){return _0x3210ce[_0x9f08('0x16')](_0x2edc98);}return _0x3210ce[_0x9f08('0x17')](_0x2edc98)['end']();};}function respondWithResult(_0x3d97ed,_0x477c74){_0x477c74=_0x477c74||0xc8;return function(_0x5ea040){if(_0x5ea040){return _0x3d97ed['status'](_0x477c74)[_0x9f08('0x18')](_0x5ea040);}};}function respondWithFilteredResult(_0x4ecdc5,_0x4ff563){return function(_0x4bfd36){if(_0x4bfd36){var _0x32cf02=typeof _0x4ff563[_0x9f08('0x19')]===_0x9f08('0x1a')&&typeof _0x4ff563['limit']===_0x9f08('0x1a');var _0x1097b5=_0x4bfd36[_0x9f08('0x1b')];var _0x9f2a0c=_0x32cf02?0x0:_0x4ff563[_0x9f08('0x19')];var _0x427de8=_0x32cf02?_0x4bfd36[_0x9f08('0x1b')]:_0x4ff563[_0x9f08('0x19')]+_0x4ff563[_0x9f08('0x1c')];var _0x217e16;if(_0x427de8>=_0x1097b5){_0x427de8=_0x1097b5;_0x217e16=0xc8;}else{_0x217e16=0xce;}_0x4ecdc5['status'](_0x217e16);return _0x4ecdc5[_0x9f08('0x1d')]('Content-Range',_0x9f2a0c+'-'+_0x427de8+'/'+_0x1097b5)[_0x9f08('0x18')](_0x4bfd36);}return null;};}function patchUpdates(_0x1eb668){return function(_0x381046){try{jsonpatch[_0x9f08('0x1e')](_0x381046,_0x1eb668,!![]);}catch(_0x1a2646){return BPromise[_0x9f08('0x1f')](_0x1a2646);}return _0x381046['save']();};}function saveUpdates(_0x352ea0,_0x17ad4b){return function(_0xd14be2){if(_0xd14be2){return _0xd14be2[_0x9f08('0x20')](_0x352ea0)[_0x9f08('0x21')](function(_0x2ae756){return _0x2ae756;});}return null;};}function removeEntity(_0x5362ca,_0x39dd83){return function(_0xd1af98){if(_0xd1af98){return _0xd1af98['destroy']()['then'](function(){_0x5362ca[_0x9f08('0x17')](0xcc)[_0x9f08('0x22')]();});}};}function handleEntityNotFound(_0x3425c2,_0x1c7ad3){return function(_0x17261a){if(!_0x17261a){_0x3425c2[_0x9f08('0x16')](0x194);}return _0x17261a;};}function handleError(_0x4209d2,_0x134bfe){_0x134bfe=_0x134bfe||0x1f4;return function(_0x3d5240){logger[_0x9f08('0x23')](_0x3d5240[_0x9f08('0x24')]);if(_0x3d5240[_0x9f08('0x25')]){delete _0x3d5240['name'];}_0x4209d2[_0x9f08('0x17')](_0x134bfe)['send'](_0x3d5240);};}exports[_0x9f08('0x26')]=function(_0x2f3503,_0x278258){var _0x740fed={},_0x2f6d01={},_0x19c7d6={'count':0x0,'rows':[]};var _0x3c2304=_[_0x9f08('0x27')](db['UserProfileSection'][_0x9f08('0x28')],function(_0x29b693){return{'name':_0x29b693[_0x9f08('0x29')],'type':_0x29b693[_0x9f08('0x2a')]['key']};});_0x2f6d01['model']=_[_0x9f08('0x27')](_0x3c2304,_0x9f08('0x25'));_0x2f6d01[_0x9f08('0x2b')]=_['keys'](_0x2f3503['query']);_0x2f6d01['filters']=_['intersection'](_0x2f6d01[_0x9f08('0x2c')],_0x2f6d01['query']);_0x740fed['attributes']=_[_0x9f08('0x2d')](_0x2f6d01[_0x9f08('0x2c')],qs[_0x9f08('0x2e')](_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x2e')]));_0x740fed[_0x9f08('0x2f')]=_0x740fed[_0x9f08('0x2f')][_0x9f08('0x30')]?_0x740fed[_0x9f08('0x2f')]:_0x2f6d01[_0x9f08('0x2c')];if(!_0x2f3503[_0x9f08('0x2b')]['hasOwnProperty']('nolimit')){_0x740fed['limit']=qs['limit'](_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x1c')]);_0x740fed[_0x9f08('0x19')]=qs[_0x9f08('0x19')](_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x19')]);}_0x740fed['order']=qs[_0x9f08('0x31')](_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x31')]);_0x740fed[_0x9f08('0x32')]=qs['filters'](_[_0x9f08('0x33')](_0x2f3503[_0x9f08('0x2b')],_0x2f6d01['filters']),_0x3c2304);if(_0x2f3503[_0x9f08('0x2b')]['filter']){_0x740fed[_0x9f08('0x32')]=_['merge'](_0x740fed[_0x9f08('0x32')],{'$or':_[_0x9f08('0x27')](_0x3c2304,function(_0x424e35){if(_0x424e35[_0x9f08('0x2a')]!=='VIRTUAL'){var _0x2498bb={};_0x2498bb[_0x424e35[_0x9f08('0x25')]]={'$like':'%'+_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x34')]+'%'};return _0x2498bb;}})});}_0x740fed=_[_0x9f08('0x35')]({},_0x740fed,_0x2f3503[_0x9f08('0x36')]);var _0x6226f0={'where':_0x740fed[_0x9f08('0x32')]};return db[_0x9f08('0x37')]['count'](_0x6226f0)[_0x9f08('0x21')](function(_0xc22f67){_0x19c7d6[_0x9f08('0x1b')]=_0xc22f67;if(_0x2f3503[_0x9f08('0x2b')][_0x9f08('0x38')]){_0x740fed[_0x9f08('0x39')]=[{'all':!![]}];}return db[_0x9f08('0x37')][_0x9f08('0x3a')](_0x740fed);})[_0x9f08('0x21')](function(_0x55fe48){_0x19c7d6[_0x9f08('0x3b')]=_0x55fe48;return _0x19c7d6;})['then'](respondWithFilteredResult(_0x278258,_0x740fed))[_0x9f08('0x3c')](handleError(_0x278258,null));};exports[_0x9f08('0x3d')]=function(_0x5779ee,_0x2a2c74){var _0x38fd57={'raw':![],'where':{'id':_0x5779ee[_0x9f08('0x3e')]['id']}},_0x3b74df={};_0x3b74df[_0x9f08('0x2c')]=_['keys'](db[_0x9f08('0x37')]['rawAttributes']);_0x3b74df[_0x9f08('0x2b')]=_[_0x9f08('0x3f')](_0x5779ee[_0x9f08('0x2b')]);_0x3b74df[_0x9f08('0x40')]=_[_0x9f08('0x2d')](_0x3b74df[_0x9f08('0x2c')],_0x3b74df[_0x9f08('0x2b')]);_0x38fd57[_0x9f08('0x2f')]=_[_0x9f08('0x2d')](_0x3b74df[_0x9f08('0x2c')],qs[_0x9f08('0x2e')](_0x5779ee[_0x9f08('0x2b')][_0x9f08('0x2e')]));_0x38fd57[_0x9f08('0x2f')]=_0x38fd57[_0x9f08('0x2f')]['length']?_0x38fd57[_0x9f08('0x2f')]:_0x3b74df[_0x9f08('0x2c')];if(_0x5779ee[_0x9f08('0x2b')][_0x9f08('0x38')]){_0x38fd57[_0x9f08('0x39')]=[{'all':!![]}];}_0x38fd57=_['merge']({},_0x38fd57,_0x5779ee[_0x9f08('0x36')]);return db[_0x9f08('0x37')]['find'](_0x38fd57)[_0x9f08('0x21')](handleEntityNotFound(_0x2a2c74,null))[_0x9f08('0x21')](respondWithResult(_0x2a2c74,null))[_0x9f08('0x3c')](handleError(_0x2a2c74,null));};exports[_0x9f08('0x41')]=function(_0x145f29,_0x66e015){return db[_0x9f08('0x37')][_0x9f08('0x41')](_0x145f29[_0x9f08('0x42')],{})[_0x9f08('0x21')](respondWithResult(_0x66e015,0xc9))['catch'](handleError(_0x66e015,null));};exports['update']=function(_0x2dffc5,_0x27ffab){if(_0x2dffc5[_0x9f08('0x42')]['id']){delete _0x2dffc5[_0x9f08('0x42')]['id'];}return db[_0x9f08('0x37')][_0x9f08('0x43')]({'where':{'id':_0x2dffc5[_0x9f08('0x3e')]['id']}})['then'](handleEntityNotFound(_0x27ffab,null))[_0x9f08('0x21')](saveUpdates(_0x2dffc5[_0x9f08('0x42')],null))[_0x9f08('0x21')](respondWithResult(_0x27ffab,null))['catch'](handleError(_0x27ffab,null));};exports[_0x9f08('0x44')]=function(_0x15c076,_0x233268){return db[_0x9f08('0x37')]['find']({'where':{'id':_0x15c076[_0x9f08('0x3e')]['id']}})[_0x9f08('0x21')](handleEntityNotFound(_0x233268,null))[_0x9f08('0x21')](removeEntity(_0x233268,null))[_0x9f08('0x3c')](handleError(_0x233268,null));};exports[_0x9f08('0x45')]=function(_0x5ae94a,_0x4cc6e5){return db[_0x9f08('0x37')]['describe']()[_0x9f08('0x21')](respondWithResult(_0x4cc6e5,null))[_0x9f08('0x3c')](handleError(_0x4cc6e5,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 7960893..a57f027 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 _0x2687=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x2687,0x143));var _0x7268=function(_0x12932d,_0x41c7d0){_0x12932d=_0x12932d-0x0;var _0x248ccf=_0x2687[_0x12932d];return _0x248ccf;};'use strict';var _=require(_0x7268('0x0'));var util=require(_0x7268('0x1'));var logger=require(_0x7268('0x2'))(_0x7268('0x3'));var moment=require(_0x7268('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7268('0x5'));var rimraf=require(_0x7268('0x6'));var config=require(_0x7268('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x2546bd,_0x52a875){return _0x2546bd[_0x7268('0x8')]('UserProfileSection',attributes,{'tableName':_0x7268('0x9'),'paranoid':![],'indexes':[{'name':_0x7268('0xa'),'fields':[_0x7268('0xb'),_0x7268('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa2=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xbfa2,0x170));var _0x2bfa=function(_0x1b06d7,_0x1bb31b){_0x1b06d7=_0x1b06d7-0x0;var _0x57deaa=_0xbfa2[_0x1b06d7];return _0x57deaa;};'use strict';var _=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var logger=require('../../config/logger')(_0x2bfa('0x2'));var moment=require(_0x2bfa('0x3'));var BPromise=require(_0x2bfa('0x4'));var rp=require(_0x2bfa('0x5'));var fs=require('fs');var path=require(_0x2bfa('0x6'));var rimraf=require(_0x2bfa('0x7'));var config=require(_0x2bfa('0x8'));var attributes=require(_0x2bfa('0x9'));module['exports']=function(_0x1f0dd4,_0x41c7a2){return _0x1f0dd4[_0x2bfa('0xa')](_0x2bfa('0xb'),attributes,{'tableName':_0x2bfa('0xc'),'paranoid':![],'indexes':[{'name':_0x2bfa('0xd'),'fields':['sectionId',_0x2bfa('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e84ad7a..bbd4061 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 _0x0303=['code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x0303,0x159));var _0x3030=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0303[_0x9fd887];return _0x1a54ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3030('0x0'));var rs=require(_0x3030('0x1'));var fs=require('fs');var Redis=require(_0x3030('0x2'));var db=require(_0x3030('0x3'))['db'];var utils=require(_0x3030('0x4'));var logger=require('../../config/logger')(_0x3030('0x5'));var config=require(_0x3030('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aaa69,_0x4b8e2f,_0x4e3a16){return new BPromise(function(_0x2805f7,_0x178a19){return client[_0x3030('0x7')](_0x5aaa69,_0x4e3a16)[_0x3030('0x8')](function(_0x2cf3e7){logger['info'](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));logger[_0x3030('0xb')](_0x3030('0xc'),_0x4b8e2f,'request\x20sent',JSON[_0x3030('0xd')](_0x2cf3e7));if(_0x2cf3e7[_0x3030('0xe')]){if(_0x2cf3e7['error'][_0x3030('0xf')]===0x1f4){logger[_0x3030('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x178a19(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}logger[_0x3030('0xe')](_0x3030('0x9'),_0x4b8e2f,_0x2cf3e7['error'][_0x3030('0x10')]);return _0x2805f7(_0x2cf3e7[_0x3030('0xe')][_0x3030('0x10')]);}else{logger[_0x3030('0x11')](_0x3030('0x9'),_0x4b8e2f,_0x3030('0xa'));_0x2805f7(_0x2cf3e7[_0x3030('0x12')][_0x3030('0x10')]);}})[_0x3030('0x13')](function(_0x1f0861){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x4b8e2f,_0x1f0861);_0x178a19(_0x1f0861);});});} \ No newline at end of file +var _0x039c=['request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d17fe,_0x3c5fe5){var _0x309076=function(_0x259d23){while(--_0x259d23){_0x1d17fe['push'](_0x1d17fe['shift']());}};_0x309076(++_0x3c5fe5);}(_0x039c,0x15b));var _0xc039=function(_0x2715ba,_0x5b4bbc){_0x2715ba=_0x2715ba-0x0;var _0x4c0bf1=_0x039c[_0x2715ba];return _0x4c0bf1;};'use strict';var _=require('lodash');var util=require(_0xc039('0x0'));var moment=require(_0xc039('0x1'));var BPromise=require(_0xc039('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc039('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc039('0x4'));var logger=require(_0xc039('0x5'))(_0xc039('0x6'));var config=require(_0xc039('0x7'));var jayson=require(_0xc039('0x8'));var client=jayson[_0xc039('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bfd1e,_0x14a889,_0x3f4ee5){return new BPromise(function(_0x3c367f,_0x4e0b33){return client[_0xc039('0xa')](_0x1bfd1e,_0x3f4ee5)[_0xc039('0xb')](function(_0x215412){logger[_0xc039('0xc')](_0xc039('0xd'),_0x14a889,_0xc039('0xe'));logger[_0xc039('0xf')](_0xc039('0x10'),_0x14a889,_0xc039('0xe'),JSON['stringify'](_0x215412));if(_0x215412[_0xc039('0x11')]){if(_0x215412[_0xc039('0x11')][_0xc039('0x12')]===0x1f4){logger[_0xc039('0x11')](_0xc039('0xd'),_0x14a889,_0x215412['error'][_0xc039('0x13')]);return _0x4e0b33(_0x215412[_0xc039('0x11')][_0xc039('0x13')]);}logger['error'](_0xc039('0xd'),_0x14a889,_0x215412[_0xc039('0x11')][_0xc039('0x13')]);return _0x3c367f(_0x215412['error'][_0xc039('0x13')]);}else{logger['info'](_0xc039('0xd'),_0x14a889,_0xc039('0xe'));_0x3c367f(_0x215412['result'][_0xc039('0x13')]);}})[_0xc039('0x14')](function(_0x20e87a){logger[_0xc039('0x11')](_0xc039('0xd'),_0x14a889,_0x20e87a);_0x4e0b33(_0x20e87a);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 47e7c09..ff96046 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5b4908,_0x35e743){var _0xfc05a8=function(_0x3f7694){while(--_0x3f7694){_0x5b4908['push'](_0x5b4908['shift']());}};_0xfc05a8(++_0x35e743);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ced7d,_0x20ce01){_0x5ced7d=_0x5ced7d-0x0;var _0x5ceaa6=_0xedd9[_0x5ced7d];return _0x5ceaa6;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x283d4d,_0xef4a70){var _0x3c1463=function(_0x38a13e){while(--_0x38a13e){_0x283d4d['push'](_0x283d4d['shift']());}};_0x3c1463(++_0xef4a70);}(_0xe706,0xa3));var _0x6e70=function(_0x2318b2,_0x5737ed){_0x2318b2=_0x2318b2-0x0;var _0x56634a=_0xe706[_0x2318b2];return _0x56634a;};'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 9006424..6696595 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc5cc=['exports','INTEGER','sequelize'];(function(_0x4f690d,_0x4d3f94){var _0x25b3ae=function(_0x27620f){while(--_0x27620f){_0x4f690d['push'](_0x4f690d['shift']());}};_0x25b3ae(++_0x4d3f94);}(_0xc5cc,0x86));var _0xcc5c=function(_0x5bda9b,_0x5ea719){_0x5bda9b=_0x5bda9b-0x0;var _0x4c2a55=_0xc5cc[_0x5bda9b];return _0x4c2a55;};'use strict';var Sequelize=require(_0xcc5c('0x0'));module[_0xcc5c('0x1')]={'penalty':{'type':Sequelize[_0xcc5c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index cc8618a..a17b10c 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 _0x49c1=['../../config/logger','api','moment','request-promise','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash'];(function(_0x33a025,_0x221ac1){var _0x404b89=function(_0x5120a6){while(--_0x5120a6){_0x33a025['push'](_0x33a025['shift']());}};_0x404b89(++_0x221ac1);}(_0x49c1,0xef));var _0x149c=function(_0x19dccb,_0x30d7b7){_0x19dccb=_0x19dccb-0x0;var _0x1ed83c=_0x49c1[_0x19dccb];return _0x1ed83c;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require(_0x149c('0x3'));var BPromise=require('bluebird');var rp=require(_0x149c('0x4'));var fs=require('fs');var path=require(_0x149c('0x5'));var rimraf=require('rimraf');var config=require(_0x149c('0x6'));var attributes=require(_0x149c('0x7'));module['exports']=function(_0x46c725,_0x561d00){return _0x46c725[_0x149c('0x8')](_0x149c('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaf2=['rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3773dd,_0x2d0048){_0x3773dd=_0x3773dd-0x0;var _0x212e34=_0xcaf2[_0x3773dd];return _0x212e34;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'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 fe1154f..21014f5 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 _0x14c5=['debug','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x14c5,0x193));var _0x514c=function(_0x1a4f6,_0x18dc34){_0x1a4f6=_0x1a4f6-0x0;var _0x44855e=_0x14c5[_0x1a4f6];return _0x44855e;};'use strict';var _=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var moment=require(_0x514c('0x2'));var BPromise=require(_0x514c('0x3'));var rs=require(_0x514c('0x4'));var fs=require('fs');var Redis=require(_0x514c('0x5'));var db=require(_0x514c('0x6'))['db'];var utils=require(_0x514c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x514c('0x8'));var jayson=require(_0x514c('0x9'));var client=jayson['client'][_0x514c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f9e6,_0x58d7e8,_0x5025b1){return new BPromise(function(_0x12091b,_0x48ef7d){return client[_0x514c('0xb')](_0x39f9e6,_0x5025b1)[_0x514c('0xc')](function(_0x481b09){logger[_0x514c('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x58d7e8,_0x514c('0xe'));logger[_0x514c('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x58d7e8,_0x514c('0xe'),JSON[_0x514c('0x10')](_0x481b09));if(_0x481b09[_0x514c('0x11')]){if(_0x481b09[_0x514c('0x11')]['code']===0x1f4){logger[_0x514c('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x58d7e8,_0x481b09['error'][_0x514c('0x12')]);return _0x48ef7d(_0x481b09[_0x514c('0x11')][_0x514c('0x12')]);}logger[_0x514c('0x11')](_0x514c('0x13'),_0x58d7e8,_0x481b09['error'][_0x514c('0x12')]);return _0x12091b(_0x481b09[_0x514c('0x11')]['message']);}else{logger[_0x514c('0xd')](_0x514c('0x13'),_0x58d7e8,_0x514c('0xe'));_0x12091b(_0x481b09[_0x514c('0x14')][_0x514c('0x12')]);}})[_0x514c('0x15')](function(_0x14871c){logger[_0x514c('0x11')](_0x514c('0x13'),_0x58d7e8,_0x14871c);_0x48ef7d(_0x14871c);});});} \ No newline at end of file +var _0xfe29=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xfe29,0x1de));var _0x9fe2=function(_0x27e329,_0x3e3941){_0x27e329=_0x27e329-0x0;var _0x9312be=_0xfe29[_0x27e329];return _0x9312be;};'use strict';var _=require(_0x9fe2('0x0'));var util=require(_0x9fe2('0x1'));var moment=require(_0x9fe2('0x2'));var BPromise=require(_0x9fe2('0x3'));var rs=require(_0x9fe2('0x4'));var fs=require('fs');var Redis=require(_0x9fe2('0x5'));var db=require(_0x9fe2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9fe2('0x7'));var config=require(_0x9fe2('0x8'));var jayson=require(_0x9fe2('0x9'));var client=jayson[_0x9fe2('0xa')][_0x9fe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a2d86,_0x1ec822,_0x5d0790){return new BPromise(function(_0x39b7fa,_0x11c87f){return client[_0x9fe2('0xc')](_0x1a2d86,_0x5d0790)[_0x9fe2('0xd')](function(_0x3293fc){logger[_0x9fe2('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x1ec822,_0x9fe2('0xf'));logger['debug'](_0x9fe2('0x10'),_0x1ec822,_0x9fe2('0xf'),JSON[_0x9fe2('0x11')](_0x3293fc));if(_0x3293fc['error']){if(_0x3293fc[_0x9fe2('0x12')][_0x9fe2('0x13')]===0x1f4){logger[_0x9fe2('0x12')](_0x9fe2('0x14'),_0x1ec822,_0x3293fc[_0x9fe2('0x12')][_0x9fe2('0x15')]);return _0x11c87f(_0x3293fc['error']['message']);}logger[_0x9fe2('0x12')](_0x9fe2('0x14'),_0x1ec822,_0x3293fc[_0x9fe2('0x12')][_0x9fe2('0x15')]);return _0x39b7fa(_0x3293fc[_0x9fe2('0x12')][_0x9fe2('0x15')]);}else{logger[_0x9fe2('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x1ec822,_0x9fe2('0xf'));_0x39b7fa(_0x3293fc[_0x9fe2('0x16')][_0x9fe2('0x15')]);}})['catch'](function(_0x4a3392){logger[_0x9fe2('0x12')](_0x9fe2('0x14'),_0x1ec822,_0x4a3392);_0x11c87f(_0x4a3392);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 79141cb..3ef44ea 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 _0x9fe0=['exports','INTEGER','sequelize'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9fe0,0x83));var _0x09fe=function(_0x32e91a,_0x362558){_0x32e91a=_0x32e91a-0x0;var _0x59fdf4=_0x9fe0[_0x32e91a];return _0x59fdf4;};'use strict';var Sequelize=require(_0x09fe('0x0'));module[_0x09fe('0x1')]={'UserId':{'type':Sequelize[_0x09fe('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x09fe('0x2')]}}; \ No newline at end of file +var _0x1d8a=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1d8a,0xdb));var _0xa1d8=function(_0x5eca70,_0x44e240){_0x5eca70=_0x5eca70-0x0;var _0x1f1dd9=_0x1d8a[_0x5eca70];return _0x1f1dd9;};'use strict';var Sequelize=require(_0xa1d8('0x0'));module[_0xa1d8('0x1')]={'UserId':{'type':Sequelize[_0xa1d8('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 957b458..f4ce598 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(_0x1dd45d,_0x3c53d3){var _0x428df1=function(_0x331d91){while(--_0x331d91){_0x1dd45d['push'](_0x1dd45d['shift']());}};_0x428df1(++_0x3c53d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x3e53eb,_0x4b8473){var _0x553a74=function(_0x57e6ea){while(--_0x57e6ea){_0x3e53eb['push'](_0x3e53eb['shift']());}};_0x553a74(++_0x4b8473);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 25b3763..9ee0d06 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1469fe,_0x19a4db){var _0x29321e=function(_0x11d22d){while(--_0x11d22d){_0x1469fe['push'](_0x1469fe['shift']());}};_0x29321e(++_0x19a4db);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xcb91[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x29b2c1,_0x4b59e4){var _0x2fabc5=function(_0x5293bd){while(--_0x5293bd){_0x29b2c1['push'](_0x29b2c1['shift']());}};_0x2fabc5(++_0x4b59e4);}(_0x70e0,0x17b));var _0x070e=function(_0x487c18,_0x1b1f36){_0x487c18=_0x487c18-0x0;var _0x50b7da=_0x70e0[_0x487c18];return _0x50b7da;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e0fbe98..a593b06 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 _0x53a7=['sequelize','exports','INTEGER'];(function(_0x2027f5,_0x5a68c1){var _0x346d21=function(_0x28735c){while(--_0x28735c){_0x2027f5['push'](_0x2027f5['shift']());}};_0x346d21(++_0x5a68c1);}(_0x53a7,0x11d));var _0x753a=function(_0x297e22,_0x4a1fcc){_0x297e22=_0x297e22-0x0;var _0x2af277=_0x53a7[_0x297e22];return _0x2af277;};'use strict';var Sequelize=require(_0x753a('0x0'));module[_0x753a('0x1')]={'penalty':{'type':Sequelize[_0x753a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6cef=['INTEGER','exports'];(function(_0x27380a,_0x11b4db){var _0x49557d=function(_0x11984a){while(--_0x11984a){_0x27380a['push'](_0x27380a['shift']());}};_0x49557d(++_0x11b4db);}(_0x6cef,0x1f1));var _0xf6ce=function(_0x30066f,_0x5891c9){_0x30066f=_0x30066f-0x0;var _0x1ad673=_0x6cef[_0x30066f];return _0x1ad673;};'use strict';var Sequelize=require('sequelize');module[_0xf6ce('0x0')]={'penalty':{'type':Sequelize[_0xf6ce('0x1')],'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 6770b66..d09d6d6 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 _0x6a01=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x6a01,0x14f));var _0x16a0=function(_0x34620e,_0x582015){_0x34620e=_0x34620e-0x0;var _0x3d33cd=_0x6a01[_0x34620e];return _0x3d33cd;};'use strict';var _=require(_0x16a0('0x0'));var util=require(_0x16a0('0x1'));var logger=require(_0x16a0('0x2'))(_0x16a0('0x3'));var moment=require(_0x16a0('0x4'));var BPromise=require(_0x16a0('0x5'));var rp=require(_0x16a0('0x6'));var fs=require('fs');var path=require(_0x16a0('0x7'));var rimraf=require(_0x16a0('0x8'));var config=require(_0x16a0('0x9'));var attributes=require(_0x16a0('0xa'));module[_0x16a0('0xb')]=function(_0x7e4d3a,_0x5d6f0f){return _0x7e4d3a[_0x16a0('0xc')](_0x16a0('0xd'),attributes,{'tableName':_0x16a0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf2a=['request-promise','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird'];(function(_0x40d125,_0x516ef1){var _0x451241=function(_0x183302){while(--_0x183302){_0x40d125['push'](_0x40d125['shift']());}};_0x451241(++_0x516ef1);}(_0xdf2a,0xc1));var _0xadf2=function(_0x943565,_0xbc108a){_0x943565=_0x943565-0x0;var _0x4cdf2a=_0xdf2a[_0x943565];return _0x4cdf2a;};'use strict';var _=require(_0xadf2('0x0'));var util=require(_0xadf2('0x1'));var logger=require('../../config/logger')(_0xadf2('0x2'));var moment=require(_0xadf2('0x3'));var BPromise=require(_0xadf2('0x4'));var rp=require(_0xadf2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xadf2('0x6'));var attributes=require(_0xadf2('0x7'));module[_0xadf2('0x8')]=function(_0x25d1e1,_0x22a707){return _0x25d1e1['define'](_0xadf2('0x9'),attributes,{'tableName':_0xadf2('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 6a764a2..20f7581 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 _0xe9fa=['error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x47419f,_0x1b056f){var _0x180a25=function(_0x4e41cd){while(--_0x4e41cd){_0x47419f['push'](_0x47419f['shift']());}};_0x180a25(++_0x1b056f);}(_0xe9fa,0x1bf));var _0xae9f=function(_0x144cdc,_0x253058){_0x144cdc=_0x144cdc-0x0;var _0x1b5465=_0xe9fa[_0x144cdc];return _0x1b5465;};'use strict';var _=require('lodash');var util=require(_0xae9f('0x0'));var moment=require('moment');var BPromise=require(_0xae9f('0x1'));var rs=require(_0xae9f('0x2'));var fs=require('fs');var Redis=require(_0xae9f('0x3'));var db=require(_0xae9f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xae9f('0x5'))(_0xae9f('0x6'));var config=require(_0xae9f('0x7'));var jayson=require(_0xae9f('0x8'));var client=jayson[_0xae9f('0x9')][_0xae9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xff207b,_0x4edb32,_0xedb7e3){return new BPromise(function(_0x5e0f5f,_0x466e3f){return client['request'](_0xff207b,_0xedb7e3)[_0xae9f('0xb')](function(_0x1f9c4c){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4edb32,_0xae9f('0xc'));logger[_0xae9f('0xd')](_0xae9f('0xe'),_0x4edb32,_0xae9f('0xc'),JSON['stringify'](_0x1f9c4c));if(_0x1f9c4c[_0xae9f('0xf')]){if(_0x1f9c4c['error'][_0xae9f('0x10')]===0x1f4){logger[_0xae9f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4edb32,_0x1f9c4c[_0xae9f('0xf')][_0xae9f('0x11')]);return _0x466e3f(_0x1f9c4c[_0xae9f('0xf')][_0xae9f('0x11')]);}logger[_0xae9f('0xf')](_0xae9f('0x12'),_0x4edb32,_0x1f9c4c['error']['message']);return _0x5e0f5f(_0x1f9c4c['error'][_0xae9f('0x11')]);}else{logger['info'](_0xae9f('0x12'),_0x4edb32,'request\x20sent');_0x5e0f5f(_0x1f9c4c[_0xae9f('0x13')][_0xae9f('0x11')]);}})[_0xae9f('0x14')](function(_0x514e44){logger[_0xae9f('0xf')](_0xae9f('0x12'),_0x4edb32,_0x514e44);_0x466e3f(_0x514e44);});});} \ No newline at end of file +var _0xeab8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeab8,0xd1));var _0x8eab=function(_0x4d9076,_0x3bfe9f){_0x4d9076=_0x4d9076-0x0;var _0x38539a=_0xeab8[_0x4d9076];return _0x38539a;};'use strict';var _=require(_0x8eab('0x0'));var util=require(_0x8eab('0x1'));var moment=require(_0x8eab('0x2'));var BPromise=require(_0x8eab('0x3'));var rs=require(_0x8eab('0x4'));var fs=require('fs');var Redis=require(_0x8eab('0x5'));var db=require(_0x8eab('0x6'))['db'];var utils=require(_0x8eab('0x7'));var logger=require(_0x8eab('0x8'))('rpc');var config=require(_0x8eab('0x9'));var jayson=require(_0x8eab('0xa'));var client=jayson['client'][_0x8eab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x140cab,_0x495df5,_0x3486dd){return new BPromise(function(_0x51698e,_0x1a004b){return client['request'](_0x140cab,_0x3486dd)['then'](function(_0x184ced){logger[_0x8eab('0xc')](_0x8eab('0xd'),_0x495df5,_0x8eab('0xe'));logger[_0x8eab('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x495df5,_0x8eab('0xe'),JSON['stringify'](_0x184ced));if(_0x184ced[_0x8eab('0x10')]){if(_0x184ced[_0x8eab('0x10')][_0x8eab('0x11')]===0x1f4){logger[_0x8eab('0x10')](_0x8eab('0xd'),_0x495df5,_0x184ced[_0x8eab('0x10')][_0x8eab('0x12')]);return _0x1a004b(_0x184ced[_0x8eab('0x10')][_0x8eab('0x12')]);}logger[_0x8eab('0x10')](_0x8eab('0xd'),_0x495df5,_0x184ced[_0x8eab('0x10')][_0x8eab('0x12')]);return _0x51698e(_0x184ced[_0x8eab('0x10')][_0x8eab('0x12')]);}else{logger[_0x8eab('0xc')](_0x8eab('0xd'),_0x495df5,_0x8eab('0xe'));_0x51698e(_0x184ced['result']['message']);}})['catch'](function(_0x59b7a1){logger[_0x8eab('0x10')](_0x8eab('0xd'),_0x495df5,_0x59b7a1);_0x1a004b(_0x59b7a1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 62ea024..04eca3a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x418b38,_0x24db88){var _0x4a88ec=function(_0xfca373){while(--_0xfca373){_0x418b38['push'](_0x418b38['shift']());}};_0x4a88ec(++_0x24db88);}(_0x70e0,0x17b));var _0x070e=function(_0x2caa72,_0x3b752d){_0x2caa72=_0x2caa72-0x0;var _0x2c3c66=_0x70e0[_0x2caa72];return _0x2c3c66;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x32959e,_0x95c759){var _0x379025=function(_0x565f21){while(--_0x565f21){_0x32959e['push'](_0x32959e['shift']());}};_0x379025(++_0x95c759);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 0077e38..80c03ae 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 _0xe426=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x4c97ea,_0x25b9a2){var _0x521af1=function(_0x28af94){while(--_0x28af94){_0x4c97ea['push'](_0x4c97ea['shift']());}};_0x521af1(++_0x25b9a2);}(_0xe426,0x1d0));var _0x6e42=function(_0x5ed565,_0x58c57c){_0x5ed565=_0x5ed565-0x0;var _0x206c6d=_0xe426[_0x5ed565];return _0x206c6d;};'use strict';var Sequelize=require(_0x6e42('0x0'));module[_0x6e42('0x1')]={'uniqueid':{'type':Sequelize[_0x6e42('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6e42('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x6e42('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6e42('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x6e42('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x6e42('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6e42('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x6e42('0x3')}}; \ No newline at end of file +var _0x6a83=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x54e8a4,_0x5c5b04){var _0x3246e6=function(_0x2686ef){while(--_0x2686ef){_0x54e8a4['push'](_0x54e8a4['shift']());}};_0x3246e6(++_0x5c5b04);}(_0x6a83,0xd2));var _0x36a8=function(_0x8c12ff,_0x45cb33){_0x8c12ff=_0x8c12ff-0x0;var _0x4a0cd3=_0x6a83[_0x8c12ff];return _0x4a0cd3;};'use strict';var Sequelize=require(_0x36a8('0x0'));module[_0x36a8('0x1')]={'uniqueid':{'type':Sequelize[_0x36a8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x36a8('0x3')},'membername':{'type':Sequelize[_0x36a8('0x4')],'allowNull':![],'comment':_0x36a8('0x3')},'UserId':{'type':Sequelize[_0x36a8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x36a8('0x4')],'allowNull':![],'unique':_0x36a8('0x5'),'comment':_0x36a8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x36a8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x36a8('0x4')],'allowNull':![],'unique':_0x36a8('0x5'),'comment':_0x36a8('0x3')},'penalty':{'type':Sequelize[_0x36a8('0x2')](0xb),'defaultValue':0x0,'comment':_0x36a8('0x3')},'paused':{'type':Sequelize[_0x36a8('0x2')](0xb),'defaultValue':0x0,'comment':_0x36a8('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 803f00b..46f7ae1 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 _0x907a=['emit','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove'];(function(_0x519554,_0x17e6b1){var _0xf68f51=function(_0x361d68){while(--_0x361d68){_0x519554['push'](_0x519554['shift']());}};_0xf68f51(++_0x17e6b1);}(_0x907a,0xc2));var _0xa907=function(_0x2de197,_0x4a5c4f){_0x2de197=_0x2de197-0x0;var _0x4a3ba0=_0x907a[_0x2de197];return _0x4a3ba0;};'use strict';var EventEmitter=require(_0xa907('0x0'));var UserVoiceQueueRt=require(_0xa907('0x1'))['db'][_0xa907('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa907('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa907('0x4'),'afterDestroy':_0xa907('0x5')};function emitEvent(_0x1dc954){return function(_0x4a075b,_0x59086b,_0x55b772){UserVoiceQueueRtEvents[_0xa907('0x6')](_0x1dc954+':'+_0x4a075b['id'],_0x4a075b);UserVoiceQueueRtEvents[_0xa907('0x6')](_0x1dc954,_0x4a075b);_0x55b772(null);};}for(var e in events){if(events[_0xa907('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd9aa=['save','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x3b2f54,_0x304fa0){var _0x5fd47d=function(_0xd93a4c){while(--_0xd93a4c){_0x3b2f54['push'](_0x3b2f54['shift']());}};_0x5fd47d(++_0x304fa0);}(_0xd9aa,0x11d));var _0xad9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd9aa[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0xad9a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xad9a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xad9a('0x2'),'afterUpdate':'update','afterDestroy':_0xad9a('0x3')};function emitEvent(_0x2c12ae){return function(_0x332c49,_0x1938e5,_0x5e2172){UserVoiceQueueRtEvents[_0xad9a('0x4')](_0x2c12ae+':'+_0x332c49['id'],_0x332c49);UserVoiceQueueRtEvents[_0xad9a('0x4')](_0x2c12ae,_0x332c49);_0x5e2172(null);};}for(var e in events){if(events[_0xad9a('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xad9a('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 448cca0..8ccd7a7 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 _0x54cb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x209044,_0x170d11){var _0x66769b=function(_0x27651b){while(--_0x27651b){_0x209044['push'](_0x209044['shift']());}};_0x66769b(++_0x170d11);}(_0x54cb,0x188));var _0xb54c=function(_0x24ed7c,_0x24c7a5){_0x24ed7c=_0x24ed7c-0x0;var _0x510146=_0x54cb[_0x24ed7c];return _0x510146;};'use strict';var _=require(_0xb54c('0x0'));var util=require(_0xb54c('0x1'));var logger=require(_0xb54c('0x2'))(_0xb54c('0x3'));var moment=require(_0xb54c('0x4'));var BPromise=require(_0xb54c('0x5'));var rp=require(_0xb54c('0x6'));var fs=require('fs');var path=require(_0xb54c('0x7'));var rimraf=require(_0xb54c('0x8'));var config=require(_0xb54c('0x9'));var attributes=require(_0xb54c('0xa'));module[_0xb54c('0xb')]=function(_0x5b7f25,_0xebf802){return _0x5b7f25['define'](_0xb54c('0xc'),attributes,{'tableName':_0xb54c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb256=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb256,0x176));var _0x6b25=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xb256[_0x134827];return _0x366671;};'use strict';var _=require(_0x6b25('0x0'));var util=require('util');var logger=require(_0x6b25('0x1'))(_0x6b25('0x2'));var moment=require(_0x6b25('0x3'));var BPromise=require(_0x6b25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b25('0x5'));var rimraf=require(_0x6b25('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b25('0x7'));module[_0x6b25('0x8')]=function(_0x35d0c4,_0x14250c){return _0x35d0c4[_0x6b25('0x9')](_0x6b25('0xa'),attributes,{'tableName':_0x6b25('0xb'),'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 6569764..a5944db 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 _0x4b54=['then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x8e37ea,_0x1f4e1c){var _0x390302=function(_0x20b26e){while(--_0x20b26e){_0x8e37ea['push'](_0x8e37ea['shift']());}};_0x390302(++_0x1f4e1c);}(_0x4b54,0xc9));var _0x44b5=function(_0xbc25e1,_0x426f18){_0xbc25e1=_0xbc25e1-0x0;var _0x88abb8=_0x4b54[_0xbc25e1];return _0x88abb8;};'use strict';var _=require(_0x44b5('0x0'));var util=require(_0x44b5('0x1'));var moment=require('moment');var BPromise=require(_0x44b5('0x2'));var rs=require(_0x44b5('0x3'));var fs=require('fs');var Redis=require(_0x44b5('0x4'));var db=require(_0x44b5('0x5'))['db'];var utils=require(_0x44b5('0x6'));var logger=require(_0x44b5('0x7'))(_0x44b5('0x8'));var config=require(_0x44b5('0x9'));var jayson=require(_0x44b5('0xa'));var client=jayson[_0x44b5('0xb')][_0x44b5('0xc')]({'port':0x232a});config[_0x44b5('0xd')]=_['defaults'](config['redis'],{'host':_0x44b5('0xe'),'port':0x18eb});var socket=require(_0x44b5('0xf'))(new Redis(config[_0x44b5('0xd')]));require(_0x44b5('0x10'))[_0x44b5('0x11')](socket);function respondWithRpcPromise(_0x430466,_0x126193,_0x5bb4b0){return new BPromise(function(_0x3b4c29,_0x30df99){return client[_0x44b5('0x12')](_0x430466,_0x5bb4b0)['then'](function(_0x4e40ac){logger[_0x44b5('0x13')](_0x44b5('0x14'),_0x126193,_0x44b5('0x15'));logger[_0x44b5('0x16')](_0x44b5('0x17'),_0x126193,_0x44b5('0x15'),JSON[_0x44b5('0x18')](_0x4e40ac));if(_0x4e40ac[_0x44b5('0x19')]){if(_0x4e40ac['error'][_0x44b5('0x1a')]===0x1f4){logger[_0x44b5('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x126193,_0x4e40ac[_0x44b5('0x19')]['message']);return _0x30df99(_0x4e40ac['error'][_0x44b5('0x1b')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x126193,_0x4e40ac['error'][_0x44b5('0x1b')]);return _0x3b4c29(_0x4e40ac['error'][_0x44b5('0x1b')]);}else{logger[_0x44b5('0x13')](_0x44b5('0x14'),_0x126193,_0x44b5('0x15'));_0x3b4c29(_0x4e40ac[_0x44b5('0x1c')][_0x44b5('0x1b')]);}})[_0x44b5('0x1d')](function(_0x28034e){logger['error'](_0x44b5('0x14'),_0x126193,_0x28034e);_0x30df99(_0x28034e);});});}exports[_0x44b5('0x1e')]=function(_0x5bf64e){var _0x2fa7ca=this;return new Promise(function(_0x13a807,_0x303d20){return db[_0x44b5('0x1f')][_0x44b5('0x20')]({'raw':_0x5bf64e[_0x44b5('0x21')]?_0x5bf64e[_0x44b5('0x21')][_0x44b5('0x22')]===undefined?!![]:![]:!![],'where':_0x5bf64e['options']?_0x5bf64e['options']['where']||null:null,'attributes':[[db[_0x44b5('0x23')]['fn'](_0x44b5('0x24'),db[_0x44b5('0x23')]['fn']('IF',db[_0x44b5('0x23')]['literal'](_0x44b5('0x25')))),_0x44b5('0x26')]]})[_0x44b5('0x27')](function(_0x50bad8){logger['info'](_0x44b5('0x1e'),_0x5bf64e);logger['debug']('GetVoiceQueueRtPauses',_0x5bf64e,JSON[_0x44b5('0x18')](_0x50bad8));_0x13a807(_0x50bad8);})[_0x44b5('0x1d')](function(_0xc5ea6b){logger[_0x44b5('0x19')]('GetVoiceQueueRtPauses',_0xc5ea6b[_0x44b5('0x1b')],_0x5bf64e);_0x303d20(_0x2fa7ca['error'](0x1f4,_0xc5ea6b[_0x44b5('0x1b')]));});});}; \ No newline at end of file +var _0xcf22=['info','GetVoiceQueueRtPauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xcf22,0x11a));var _0x2cf2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf22[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x2cf2('0x0'));var moment=require(_0x2cf2('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cf2('0x2'));var fs=require('fs');var Redis=require(_0x2cf2('0x3'));var db=require(_0x2cf2('0x4'))['db'];var utils=require(_0x2cf2('0x5'));var logger=require(_0x2cf2('0x6'))(_0x2cf2('0x7'));var config=require(_0x2cf2('0x8'));var jayson=require(_0x2cf2('0x9'));var client=jayson[_0x2cf2('0xa')][_0x2cf2('0xb')]({'port':0x232a});config[_0x2cf2('0xc')]=_[_0x2cf2('0xd')](config[_0x2cf2('0xc')],{'host':_0x2cf2('0xe'),'port':0x18eb});var socket=require(_0x2cf2('0xf'))(new Redis(config[_0x2cf2('0xc')]));require(_0x2cf2('0x10'))[_0x2cf2('0x11')](socket);function respondWithRpcPromise(_0x33bbae,_0x43bd96,_0x3194ab){return new BPromise(function(_0x17eae9,_0xde22c6){return client[_0x2cf2('0x12')](_0x33bbae,_0x3194ab)[_0x2cf2('0x13')](function(_0x4a6bce){logger['info'](_0x2cf2('0x14'),_0x43bd96,_0x2cf2('0x15'));logger[_0x2cf2('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x43bd96,'request\x20sent',JSON[_0x2cf2('0x17')](_0x4a6bce));if(_0x4a6bce['error']){if(_0x4a6bce['error'][_0x2cf2('0x18')]===0x1f4){logger[_0x2cf2('0x19')](_0x2cf2('0x14'),_0x43bd96,_0x4a6bce[_0x2cf2('0x19')][_0x2cf2('0x1a')]);return _0xde22c6(_0x4a6bce['error']['message']);}logger[_0x2cf2('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x43bd96,_0x4a6bce[_0x2cf2('0x19')][_0x2cf2('0x1a')]);return _0x17eae9(_0x4a6bce['error']['message']);}else{logger['info'](_0x2cf2('0x14'),_0x43bd96,_0x2cf2('0x15'));_0x17eae9(_0x4a6bce[_0x2cf2('0x1b')][_0x2cf2('0x1a')]);}})[_0x2cf2('0x1c')](function(_0x4dc270){logger[_0x2cf2('0x19')](_0x2cf2('0x14'),_0x43bd96,_0x4dc270);_0xde22c6(_0x4dc270);});});}exports['GetVoiceQueueRtPauses']=function(_0x106538){var _0x50a0d0=this;return new Promise(function(_0x148a78,_0x46bb22){return db[_0x2cf2('0x1d')][_0x2cf2('0x1e')]({'raw':_0x106538[_0x2cf2('0x1f')]?_0x106538['options'][_0x2cf2('0x20')]===undefined?!![]:![]:!![],'where':_0x106538[_0x2cf2('0x1f')]?_0x106538[_0x2cf2('0x1f')]['where']||null:null,'attributes':[[db[_0x2cf2('0x21')]['fn'](_0x2cf2('0x22'),db[_0x2cf2('0x21')]['fn']('IF',db[_0x2cf2('0x21')][_0x2cf2('0x23')](_0x2cf2('0x24')))),_0x2cf2('0x25')]]})[_0x2cf2('0x13')](function(_0x5014fb){logger[_0x2cf2('0x26')](_0x2cf2('0x27'),_0x106538);logger['debug']('GetVoiceQueueRtPauses',_0x106538,JSON[_0x2cf2('0x17')](_0x5014fb));_0x148a78(_0x5014fb);})[_0x2cf2('0x1c')](function(_0x50e611){logger[_0x2cf2('0x19')](_0x2cf2('0x27'),_0x50e611['message'],_0x106538);_0x46bb22(_0x50a0d0[_0x2cf2('0x19')](0x1f4,_0x50e611[_0x2cf2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 00a2ea7..944ce2d 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 _0x573a=['update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x5836ba,_0x2c1668){var _0x43e189=function(_0x1b0e7a){while(--_0x1b0e7a){_0x5836ba['push'](_0x5836ba['shift']());}};_0x43e189(++_0x2c1668);}(_0x573a,0x124));var _0xa573=function(_0x343e44,_0x519af9){_0x343e44=_0x343e44-0x0;var _0xa5130e=_0x573a[_0x343e44];return _0xa5130e;};'use strict';var UserVoiceQueueRtEvents=require(_0xa573('0x0'));var events=[_0xa573('0x1'),'remove',_0xa573('0x2')];function createListener(_0x259495,_0x3f8531){return function(_0x155268){_0x3f8531[_0xa573('0x3')](_0x259495,_0x155268);};}function removeListener(_0x59a1d5,_0x41fbd3){return function(){UserVoiceQueueRtEvents['removeListener'](_0x59a1d5,_0x41fbd3);};}exports[_0xa573('0x4')]=function(_0x2085f4){for(var _0x4873b8=0x0,_0x5adeee=events[_0xa573('0x5')];_0x4873b8<_0x5adeee;_0x4873b8++){var _0x1c7332=events[_0x4873b8];var _0x2529f1=createListener(_0xa573('0x6')+_0x1c7332,_0x2085f4);UserVoiceQueueRtEvents['on'](_0x1c7332,_0x2529f1);}}; \ No newline at end of file +var _0x0618=['save','update','emit','removeListener','register','length','./userVoiceQueueRt.events'];(function(_0x478689,_0x257f1a){var _0x9e4bf1=function(_0x4d9467){while(--_0x4d9467){_0x478689['push'](_0x478689['shift']());}};_0x9e4bf1(++_0x257f1a);}(_0x0618,0x1c6));var _0x8061=function(_0x450e32,_0x1f4f6a){_0x450e32=_0x450e32-0x0;var _0x3041e0=_0x0618[_0x450e32];return _0x3041e0;};'use strict';var UserVoiceQueueRtEvents=require(_0x8061('0x0'));var events=[_0x8061('0x1'),'remove',_0x8061('0x2')];function createListener(_0x29979d,_0x5b434b){return function(_0x57f7ae){_0x5b434b[_0x8061('0x3')](_0x29979d,_0x57f7ae);};}function removeListener(_0x6aff35,_0x382b13){return function(){UserVoiceQueueRtEvents[_0x8061('0x4')](_0x6aff35,_0x382b13);};}exports[_0x8061('0x5')]=function(_0x2c47b6){for(var _0x1cca7f=0x0,_0x9c161b=events[_0x8061('0x6')];_0x1cca7f<_0x9c161b;_0x1cca7f++){var _0x3bb894=events[_0x1cca7f];var _0x7bfd18=createListener('userVoiceQueueRt:'+_0x3bb894,_0x2c47b6);UserVoiceQueueRtEvents['on'](_0x3bb894,_0x7bfd18);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 85f1342..2c01b04 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31f420,_0x363459){var _0x473528=function(_0x3be46c){while(--_0x3be46c){_0x31f420['push'](_0x31f420['shift']());}};_0x473528(++_0x363459);}(_0xe706,0xa3));var _0x6e70=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xe706[_0x1cc961];return _0x471d86;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x12d5ef,_0x536bde){var _0x9e8a6e=function(_0x17f8ab){while(--_0x17f8ab){_0x12d5ef['push'](_0x12d5ef['shift']());}};_0x9e8a6e(++_0x536bde);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 744c345..1e1b3db 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 _0x9728=['sequelize','exports'];(function(_0x1cac59,_0x392e66){var _0x4c9190=function(_0x132cb5){while(--_0x132cb5){_0x1cac59['push'](_0x1cac59['shift']());}};_0x4c9190(++_0x392e66);}(_0x9728,0x13c));var _0x8972=function(_0x4f8a2e,_0x47d53f){_0x4f8a2e=_0x4f8a2e-0x0;var _0x389b47=_0x9728[_0x4f8a2e];return _0x389b47;};'use strict';var Sequelize=require(_0x8972('0x0'));module[_0x8972('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8bf=['sequelize','exports','INTEGER'];(function(_0x26a4d3,_0x53b223){var _0x53f572=function(_0xa4248a){while(--_0xa4248a){_0x26a4d3['push'](_0x26a4d3['shift']());}};_0x53f572(++_0x53b223);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x4346c4,_0x53ac29){_0x4346c4=_0x4346c4-0x0;var _0x304289=_0xa8bf[_0x4346c4];return _0x304289;};'use strict';var Sequelize=require(_0xfa8b('0x0'));module[_0xfa8b('0x1')]={'penalty':{'type':Sequelize[_0xfa8b('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 314243a..afb833b 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 _0x82d0=['user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x24abf4,_0x3d75e7){var _0x5a467d=function(_0x3844d0){while(--_0x3844d0){_0x24abf4['push'](_0x24abf4['shift']());}};_0x5a467d(++_0x3d75e7);}(_0x82d0,0x1a5));var _0x082d=function(_0x177452,_0x76dd98){_0x177452=_0x177452-0x0;var _0x4e41fa=_0x82d0[_0x177452];return _0x4e41fa;};'use strict';var _=require(_0x082d('0x0'));var util=require(_0x082d('0x1'));var logger=require('../../config/logger')(_0x082d('0x2'));var moment=require(_0x082d('0x3'));var BPromise=require(_0x082d('0x4'));var rp=require(_0x082d('0x5'));var fs=require('fs');var path=require(_0x082d('0x6'));var rimraf=require(_0x082d('0x7'));var config=require(_0x082d('0x8'));var attributes=require(_0x082d('0x9'));module[_0x082d('0xa')]=function(_0x26ca8d,_0x4a815b){return _0x26ca8d[_0x082d('0xb')](_0x082d('0xc'),attributes,{'tableName':_0x082d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f71=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2b5322,_0x5e565d){var _0x1fc8f4=function(_0x2a6c64){while(--_0x2a6c64){_0x2b5322['push'](_0x2b5322['shift']());}};_0x1fc8f4(++_0x5e565d);}(_0x6f71,0xca));var _0x16f7=function(_0x3b13c1,_0x4b3403){_0x3b13c1=_0x3b13c1-0x0;var _0x1a8f9a=_0x6f71[_0x3b13c1];return _0x1a8f9a;};'use strict';var _=require(_0x16f7('0x0'));var util=require(_0x16f7('0x1'));var logger=require(_0x16f7('0x2'))(_0x16f7('0x3'));var moment=require('moment');var BPromise=require(_0x16f7('0x4'));var rp=require(_0x16f7('0x5'));var fs=require('fs');var path=require(_0x16f7('0x6'));var rimraf=require(_0x16f7('0x7'));var config=require(_0x16f7('0x8'));var attributes=require(_0x16f7('0x9'));module[_0x16f7('0xa')]=function(_0x2d7c73,_0x5299c0){return _0x2d7c73['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index ff1f98c..38a4724 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 _0x7cfd=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug'];(function(_0x4649c4,_0x4c8c1a){var _0x4166e2=function(_0x3e571f){while(--_0x3e571f){_0x4649c4['push'](_0x4649c4['shift']());}};_0x4166e2(++_0x4c8c1a);}(_0x7cfd,0x7b));var _0xd7cf=function(_0xc13282,_0x95eb57){_0xc13282=_0xc13282-0x0;var _0x40d660=_0x7cfd[_0xc13282];return _0x40d660;};'use strict';var _=require(_0xd7cf('0x0'));var util=require(_0xd7cf('0x1'));var moment=require(_0xd7cf('0x2'));var BPromise=require(_0xd7cf('0x3'));var rs=require(_0xd7cf('0x4'));var fs=require('fs');var Redis=require(_0xd7cf('0x5'));var db=require(_0xd7cf('0x6'))['db'];var utils=require(_0xd7cf('0x7'));var logger=require('../../config/logger')(_0xd7cf('0x8'));var config=require(_0xd7cf('0x9'));var jayson=require(_0xd7cf('0xa'));var client=jayson['client'][_0xd7cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5da0,_0x212a07,_0x4e1e10){return new BPromise(function(_0x4dae73,_0x53f837){return client[_0xd7cf('0xc')](_0x5b5da0,_0x4e1e10)['then'](function(_0xa1d56e){logger[_0xd7cf('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x212a07,'request\x20sent');logger[_0xd7cf('0xe')](_0xd7cf('0xf'),_0x212a07,_0xd7cf('0x10'),JSON[_0xd7cf('0x11')](_0xa1d56e));if(_0xa1d56e[_0xd7cf('0x12')]){if(_0xa1d56e['error'][_0xd7cf('0x13')]===0x1f4){logger[_0xd7cf('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x212a07,_0xa1d56e['error']['message']);return _0x53f837(_0xa1d56e[_0xd7cf('0x12')][_0xd7cf('0x14')]);}logger[_0xd7cf('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x212a07,_0xa1d56e['error'][_0xd7cf('0x14')]);return _0x4dae73(_0xa1d56e['error']['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x212a07,_0xd7cf('0x10'));_0x4dae73(_0xa1d56e[_0xd7cf('0x15')]['message']);}})[_0xd7cf('0x16')](function(_0x392419){logger[_0xd7cf('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x212a07,_0x392419);_0x53f837(_0x392419);});});} \ No newline at end of file +var _0x1433=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4f7f2d,_0x59f202){var _0x56ce55=function(_0x41e2f0){while(--_0x41e2f0){_0x4f7f2d['push'](_0x4f7f2d['shift']());}};_0x56ce55(++_0x59f202);}(_0x1433,0xf0));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 moment=require(_0x3143('0x2'));var BPromise=require('bluebird');var rs=require(_0x3143('0x3'));var fs=require('fs');var Redis=require(_0x3143('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3143('0x5'));var logger=require(_0x3143('0x6'))('rpc');var config=require(_0x3143('0x7'));var jayson=require(_0x3143('0x8'));var client=jayson[_0x3143('0x9')][_0x3143('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0d981,_0x1616a7,_0x25a026){return new BPromise(function(_0x3b6e1d,_0xd9b61d){return client[_0x3143('0xb')](_0xe0d981,_0x25a026)[_0x3143('0xc')](function(_0x55ac01){logger['info'](_0x3143('0xd'),_0x1616a7,_0x3143('0xe'));logger['debug'](_0x3143('0xf'),_0x1616a7,_0x3143('0xe'),JSON[_0x3143('0x10')](_0x55ac01));if(_0x55ac01[_0x3143('0x11')]){if(_0x55ac01[_0x3143('0x11')][_0x3143('0x12')]===0x1f4){logger[_0x3143('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1616a7,_0x55ac01[_0x3143('0x11')]['message']);return _0xd9b61d(_0x55ac01['error']['message']);}logger[_0x3143('0x11')](_0x3143('0xd'),_0x1616a7,_0x55ac01[_0x3143('0x11')]['message']);return _0x3b6e1d(_0x55ac01[_0x3143('0x11')][_0x3143('0x13')]);}else{logger[_0x3143('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1616a7,_0x3143('0xe'));_0x3b6e1d(_0x55ac01['result'][_0x3143('0x13')]);}})[_0x3143('0x15')](function(_0x1ca956){logger[_0x3143('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1616a7,_0x1ca956);_0xd9b61d(_0x1ca956);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 52683aa..5d5b436 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 _0x3074=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','path','connect-timeout'];(function(_0x4949ce,_0x10f3be){var _0x31f915=function(_0x337262){while(--_0x337262){_0x4949ce['push'](_0x4949ce['shift']());}};_0x31f915(++_0x10f3be);}(_0x3074,0x1dd));var _0x4307=function(_0x107bd3,_0x3d9aa4){_0x107bd3=_0x107bd3-0x0;var _0x1cdc55=_0x3074[_0x107bd3];return _0x1cdc55;};'use strict';var multer=require(_0x4307('0x0'));var util=require('util');var path=require(_0x4307('0x1'));var timeout=require(_0x4307('0x2'));var express=require(_0x4307('0x3'));var router=express['Router']();var fs_extra=require(_0x4307('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4307('0x5'));var config=require(_0x4307('0x6'));var controller=require('./variable.controller');router[_0x4307('0x7')]('/',auth[_0x4307('0x8')](),controller[_0x4307('0x9')]);router['get'](_0x4307('0xa'),auth[_0x4307('0x8')](),controller[_0x4307('0xb')]);router[_0x4307('0xc')]('/',auth[_0x4307('0x8')](),controller[_0x4307('0xd')]);router[_0x4307('0xe')](_0x4307('0xa'),auth[_0x4307('0x8')](),controller['update']);router['delete']('/:id',auth[_0x4307('0x8')](),controller['destroy']);module[_0x4307('0xf')]=router; \ No newline at end of file +var _0x60c2=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x1bd194,_0x469bbf){var _0x42c0a2=function(_0x336c61){while(--_0x336c61){_0x1bd194['push'](_0x1bd194['shift']());}};_0x42c0a2(++_0x469bbf);}(_0x60c2,0x8f));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var fs_extra=require(_0x260c('0x5'));var auth=require(_0x260c('0x6'));var interaction=require(_0x260c('0x7'));var config=require(_0x260c('0x8'));var controller=require(_0x260c('0x9'));router[_0x260c('0xa')]('/',auth[_0x260c('0xb')](),controller['index']);router[_0x260c('0xa')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0xd')]);router['post']('/',auth[_0x260c('0xb')](),controller[_0x260c('0xe')]);router[_0x260c('0xf')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0x10')]);router[_0x260c('0x11')]('/:id',auth[_0x260c('0xb')](),controller[_0x260c('0x12')]);module[_0x260c('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0d95496..34a215c 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 _0x9092=['name','sequelize','exports','STRING'];(function(_0xf540f6,_0x34a9a3){var _0x42e88e=function(_0x13f504){while(--_0x13f504){_0xf540f6['push'](_0xf540f6['shift']());}};_0x42e88e(++_0x34a9a3);}(_0x9092,0xa9));var _0x2909=function(_0x47b0ca,_0x29db56){_0x47b0ca=_0x47b0ca-0x0;var _0x5d7b70=_0x9092[_0x47b0ca];return _0x5d7b70;};'use strict';var Sequelize=require(_0x2909('0x0'));module[_0x2909('0x1')]={'name':{'type':Sequelize[_0x2909('0x2')],'unique':_0x2909('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2909('0x2')]}}; \ No newline at end of file +var _0x1e9c=['name','STRING','sequelize'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x1e9c,0xec));var _0xc1e9=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x1e9c[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xc1e9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc1e9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6be6309..4dc12ac 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 _0x656a=['UserProfileResource','then','error','stack','name','send','index','map','Variable','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','Variables'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x656a,0x17d));var _0xa656=function(_0x61c887,_0x5522c2){_0x61c887=_0x61c887-0x0;var _0x200c44=_0x656a[_0x61c887];return _0x200c44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa656('0x0'));var jsonpatch=require(_0xa656('0x1'));var rp=require(_0xa656('0x2'));var moment=require(_0xa656('0x3'));var BPromise=require(_0xa656('0x4'));var Mustache=require(_0xa656('0x5'));var util=require('util');var path=require(_0xa656('0x6'));var sox=require(_0xa656('0x7'));var csv=require('to-csv');var ejs=require(_0xa656('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa656('0x9'));var squel=require(_0xa656('0xa'));var crypto=require(_0xa656('0xb'));var jsforce=require(_0xa656('0xc'));var deskjs=require(_0xa656('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa656('0xe'));var Papa=require(_0xa656('0xf'));var Redis=require(_0xa656('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa656('0x11'));var hardwareService=require(_0xa656('0x12'));var logger=require(_0xa656('0x13'))(_0xa656('0x14'));var utils=require(_0xa656('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa656('0x16'))['db'];function respondWithStatusCode(_0x2bfed3,_0x4298e0){_0x4298e0=_0x4298e0||0xcc;return function(_0x110c46){if(_0x110c46){return _0x2bfed3[_0xa656('0x17')](_0x4298e0);}return _0x2bfed3[_0xa656('0x18')](_0x4298e0)[_0xa656('0x19')]();};}function respondWithResult(_0x35dc0f,_0x18df0a){_0x18df0a=_0x18df0a||0xc8;return function(_0x506397){if(_0x506397){return _0x35dc0f[_0xa656('0x18')](_0x18df0a)[_0xa656('0x1a')](_0x506397);}};}function respondWithFilteredResult(_0x4707ed,_0x282f8c){return function(_0xbed4b){if(_0xbed4b){var _0x35b902=typeof _0x282f8c[_0xa656('0x1b')]===_0xa656('0x1c')&&typeof _0x282f8c['limit']===_0xa656('0x1c');var _0x3e6432=_0xbed4b[_0xa656('0x1d')];var _0x440331=_0x35b902?0x0:_0x282f8c[_0xa656('0x1b')];var _0xf60f4=_0x35b902?_0xbed4b[_0xa656('0x1d')]:_0x282f8c[_0xa656('0x1b')]+_0x282f8c[_0xa656('0x1e')];var _0x444426;if(_0xf60f4>=_0x3e6432){_0xf60f4=_0x3e6432;_0x444426=0xc8;}else{_0x444426=0xce;}_0x4707ed[_0xa656('0x18')](_0x444426);return _0x4707ed[_0xa656('0x1f')]('Content-Range',_0x440331+'-'+_0xf60f4+'/'+_0x3e6432)['json'](_0xbed4b);}return null;};}function patchUpdates(_0x50623f){return function(_0x55123e){try{jsonpatch[_0xa656('0x20')](_0x55123e,_0x50623f,!![]);}catch(_0x58d46b){return BPromise[_0xa656('0x21')](_0x58d46b);}return _0x55123e[_0xa656('0x22')]();};}function saveUpdates(_0x5e23c7,_0x4c7a76){return function(_0x3c15e7){if(_0x3c15e7){return _0x3c15e7[_0xa656('0x23')](_0x5e23c7)['then'](function(_0x479234){return _0x479234;});}return null;};}function removeEntity(_0xb490a5,_0x5b81c8){return function(_0x548978){if(_0x548978){return _0x548978[_0xa656('0x24')]()['then'](function(){var _0x59a4a6=_0x548978[_0xa656('0x25')]({'plain':!![]});var _0x33b789=_0xa656('0x26');return db[_0xa656('0x27')][_0xa656('0x24')]({'where':{'type':_0x33b789,'resourceId':_0x59a4a6['id']}})['then'](function(){return _0x548978;});})[_0xa656('0x28')](function(){_0xb490a5['status'](0xcc)[_0xa656('0x19')]();});}};}function handleEntityNotFound(_0xd93618,_0x132ce1){return function(_0x13886c){if(!_0x13886c){_0xd93618[_0xa656('0x17')](0x194);}return _0x13886c;};}function handleError(_0x54a9e9,_0x3fedce){_0x3fedce=_0x3fedce||0x1f4;return function(_0x59fbf1){logger[_0xa656('0x29')](_0x59fbf1[_0xa656('0x2a')]);if(_0x59fbf1[_0xa656('0x2b')]){delete _0x59fbf1['name'];}_0x54a9e9[_0xa656('0x18')](_0x3fedce)[_0xa656('0x2c')](_0x59fbf1);};}exports[_0xa656('0x2d')]=function(_0x666fc4,_0x137736){var _0x3d5c02={},_0xe07973={},_0x1aa4e5={'count':0x0,'rows':[]};var _0x5a0158=_[_0xa656('0x2e')](db[_0xa656('0x2f')][_0xa656('0x30')],function(_0x443bfe){return{'name':_0x443bfe['fieldName'],'type':_0x443bfe['type'][_0xa656('0x31')]};});_0xe07973[_0xa656('0x32')]=_['map'](_0x5a0158,_0xa656('0x2b'));_0xe07973[_0xa656('0x33')]=_[_0xa656('0x34')](_0x666fc4[_0xa656('0x33')]);_0xe07973[_0xa656('0x35')]=_[_0xa656('0x36')](_0xe07973['model'],_0xe07973[_0xa656('0x33')]);_0x3d5c02[_0xa656('0x37')]=_[_0xa656('0x36')](_0xe07973[_0xa656('0x32')],qs[_0xa656('0x38')](_0x666fc4[_0xa656('0x33')]['fields']));_0x3d5c02[_0xa656('0x37')]=_0x3d5c02[_0xa656('0x37')]['length']?_0x3d5c02[_0xa656('0x37')]:_0xe07973[_0xa656('0x32')];if(!_0x666fc4[_0xa656('0x33')][_0xa656('0x39')](_0xa656('0x3a'))){_0x3d5c02[_0xa656('0x1e')]=qs['limit'](_0x666fc4[_0xa656('0x33')]['limit']);_0x3d5c02['offset']=qs[_0xa656('0x1b')](_0x666fc4[_0xa656('0x33')]['offset']);}_0x3d5c02[_0xa656('0x3b')]=qs[_0xa656('0x3c')](_0x666fc4[_0xa656('0x33')]['sort']);_0x3d5c02[_0xa656('0x3d')]=qs[_0xa656('0x35')](_[_0xa656('0x3e')](_0x666fc4[_0xa656('0x33')],_0xe07973['filters']),_0x5a0158);if(_0x666fc4[_0xa656('0x33')][_0xa656('0x3f')]){_0x3d5c02[_0xa656('0x3d')]=_['merge'](_0x3d5c02['where'],{'$or':_[_0xa656('0x2e')](_0x5a0158,function(_0x418496){if(_0x418496[_0xa656('0x40')]!==_0xa656('0x41')){var _0x134cca={};_0x134cca[_0x418496[_0xa656('0x2b')]]={'$like':'%'+_0x666fc4['query'][_0xa656('0x3f')]+'%'};return _0x134cca;}})});}_0x3d5c02=_[_0xa656('0x42')]({},_0x3d5c02,_0x666fc4[_0xa656('0x43')]);var _0xf2f0fc={'where':_0x3d5c02['where']};return db[_0xa656('0x2f')][_0xa656('0x1d')](_0xf2f0fc)[_0xa656('0x28')](function(_0x15ce47){_0x1aa4e5[_0xa656('0x1d')]=_0x15ce47;if(_0x666fc4['query'][_0xa656('0x44')]){_0x3d5c02[_0xa656('0x45')]=[{'all':!![]}];}return db[_0xa656('0x2f')][_0xa656('0x46')](_0x3d5c02);})[_0xa656('0x28')](function(_0x560429){_0x1aa4e5[_0xa656('0x47')]=_0x560429;return _0x1aa4e5;})[_0xa656('0x28')](respondWithFilteredResult(_0x137736,_0x3d5c02))[_0xa656('0x48')](handleError(_0x137736,null));};exports[_0xa656('0x49')]=function(_0xaecf6d,_0x426598){var _0x8401c9={'raw':!![],'where':{'id':_0xaecf6d[_0xa656('0x4a')]['id']}},_0x8b2033={};_0x8b2033[_0xa656('0x32')]=_[_0xa656('0x34')](db[_0xa656('0x2f')][_0xa656('0x30')]);_0x8b2033[_0xa656('0x33')]=_[_0xa656('0x34')](_0xaecf6d[_0xa656('0x33')]);_0x8b2033['filters']=_[_0xa656('0x36')](_0x8b2033[_0xa656('0x32')],_0x8b2033[_0xa656('0x33')]);_0x8401c9[_0xa656('0x37')]=_[_0xa656('0x36')](_0x8b2033[_0xa656('0x32')],qs[_0xa656('0x38')](_0xaecf6d[_0xa656('0x33')]['fields']));_0x8401c9[_0xa656('0x37')]=_0x8401c9[_0xa656('0x37')][_0xa656('0x4b')]?_0x8401c9[_0xa656('0x37')]:_0x8b2033[_0xa656('0x32')];if(_0xaecf6d[_0xa656('0x33')][_0xa656('0x44')]){_0x8401c9[_0xa656('0x45')]=[{'all':!![]}];}_0x8401c9=_[_0xa656('0x42')]({},_0x8401c9,_0xaecf6d[_0xa656('0x43')]);return db[_0xa656('0x2f')][_0xa656('0x4c')](_0x8401c9)['then'](handleEntityNotFound(_0x426598,null))[_0xa656('0x28')](respondWithResult(_0x426598,null))['catch'](handleError(_0x426598,null));};exports[_0xa656('0x4d')]=function(_0x23ff2a,_0x5ebdd8){return db[_0xa656('0x2f')][_0xa656('0x4d')](_0x23ff2a[_0xa656('0x4e')],{})['then'](function(_0x3ee67a){var _0x3deeb3=_0x23ff2a['user']['get']({'plain':!![]});if(!_0x3deeb3)throw new Error(_0xa656('0x4f'));if(_0x3deeb3['role']===_0xa656('0x50')){var _0x2ee5dc=_0x3ee67a[_0xa656('0x25')]({'plain':!![]});var _0x17cde1=_0xa656('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x17cde1,'userProfileId':_0x3deeb3[_0xa656('0x51')]},'raw':!![]})[_0xa656('0x28')](function(_0xa5a7ca){if(_0xa5a7ca&&_0xa5a7ca[_0xa656('0x52')]===0x0){return db[_0xa656('0x27')]['create']({'name':_0x2ee5dc[_0xa656('0x2b')],'resourceId':_0x2ee5dc['id'],'type':_0xa5a7ca[_0xa656('0x2b')],'sectionId':_0xa5a7ca['id']},{})[_0xa656('0x28')](function(){return _0x3ee67a;});}else{return _0x3ee67a;}})[_0xa656('0x48')](function(_0x4671b7){logger[_0xa656('0x29')](_0xa656('0x53'),_0x4671b7);throw _0x4671b7;});}return _0x3ee67a;})[_0xa656('0x28')](respondWithResult(_0x5ebdd8,0xc9))[_0xa656('0x48')](handleError(_0x5ebdd8,null));};exports['update']=function(_0x3446a5,_0x1e0841){if(_0x3446a5['body']['id']){delete _0x3446a5[_0xa656('0x4e')]['id'];}return db[_0xa656('0x2f')][_0xa656('0x4c')]({'where':{'id':_0x3446a5[_0xa656('0x4a')]['id']}})[_0xa656('0x28')](handleEntityNotFound(_0x1e0841,null))[_0xa656('0x28')](saveUpdates(_0x3446a5[_0xa656('0x4e')],null))['then'](respondWithResult(_0x1e0841,null))['catch'](handleError(_0x1e0841,null));};exports[_0xa656('0x24')]=function(_0x31cb0c,_0x272835){return db[_0xa656('0x2f')][_0xa656('0x4c')]({'where':{'id':_0x31cb0c[_0xa656('0x4a')]['id']}})[_0xa656('0x28')](handleEntityNotFound(_0x272835,null))[_0xa656('0x28')](removeEntity(_0x272835,null))[_0xa656('0x48')](handleError(_0x272835,null));}; \ No newline at end of file +var _0x3e88=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','autoAssociation','error','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','get','UserProfileResource','sendStatus','name','send','map','Variable','rawAttributes'];(function(_0x398f38,_0x2d5640){var _0x13da16=function(_0x465de4){while(--_0x465de4){_0x398f38['push'](_0x398f38['shift']());}};_0x13da16(++_0x2d5640);}(_0x3e88,0x71));var _0x83e8=function(_0x498400,_0x5e4ad9){_0x498400=_0x498400-0x0;var _0x49136d=_0x3e88[_0x498400];return _0x49136d;};'use strict';var emlformat=require(_0x83e8('0x0'));var rimraf=require(_0x83e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83e8('0x2'));var rp=require(_0x83e8('0x3'));var moment=require(_0x83e8('0x4'));var BPromise=require(_0x83e8('0x5'));var Mustache=require(_0x83e8('0x6'));var util=require(_0x83e8('0x7'));var path=require(_0x83e8('0x8'));var sox=require(_0x83e8('0x9'));var csv=require(_0x83e8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83e8('0xb'));var squel=require(_0x83e8('0xc'));var crypto=require(_0x83e8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x83e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x83e8('0xf'));var Papa=require(_0x83e8('0x10'));var Redis=require(_0x83e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x83e8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83e8('0x13'));var logger=require(_0x83e8('0x14'))(_0x83e8('0x15'));var utils=require(_0x83e8('0x16'));var config=require(_0x83e8('0x17'));var licenseUtil=require(_0x83e8('0x18'));var db=require(_0x83e8('0x19'))['db'];function respondWithStatusCode(_0x5a2785,_0x589eb7){_0x589eb7=_0x589eb7||0xcc;return function(_0xc0cec7){if(_0xc0cec7){return _0x5a2785['sendStatus'](_0x589eb7);}return _0x5a2785[_0x83e8('0x1a')](_0x589eb7)[_0x83e8('0x1b')]();};}function respondWithResult(_0x77b40a,_0x2d17f8){_0x2d17f8=_0x2d17f8||0xc8;return function(_0x211a1c){if(_0x211a1c){return _0x77b40a['status'](_0x2d17f8)[_0x83e8('0x1c')](_0x211a1c);}};}function respondWithFilteredResult(_0x449a23,_0xd2990b){return function(_0x26ae26){if(_0x26ae26){var _0x227a09=typeof _0xd2990b[_0x83e8('0x1d')]===_0x83e8('0x1e')&&typeof _0xd2990b[_0x83e8('0x1f')]===_0x83e8('0x1e');var _0x48927e=_0x26ae26[_0x83e8('0x20')];var _0x607d6=_0x227a09?0x0:_0xd2990b['offset'];var _0x28ff1d=_0x227a09?_0x26ae26['count']:_0xd2990b[_0x83e8('0x1d')]+_0xd2990b['limit'];var _0x25c82f;if(_0x28ff1d>=_0x48927e){_0x28ff1d=_0x48927e;_0x25c82f=0xc8;}else{_0x25c82f=0xce;}_0x449a23[_0x83e8('0x1a')](_0x25c82f);return _0x449a23[_0x83e8('0x21')](_0x83e8('0x22'),_0x607d6+'-'+_0x28ff1d+'/'+_0x48927e)['json'](_0x26ae26);}return null;};}function patchUpdates(_0xa2f58){return function(_0x268e04){try{jsonpatch['apply'](_0x268e04,_0xa2f58,!![]);}catch(_0xd91467){return BPromise[_0x83e8('0x23')](_0xd91467);}return _0x268e04[_0x83e8('0x24')]();};}function saveUpdates(_0x42207c,_0x33beb6){return function(_0x5126ec){if(_0x5126ec){return _0x5126ec['update'](_0x42207c)['then'](function(_0x4a8f85){return _0x4a8f85;});}return null;};}function removeEntity(_0x3204b9,_0x2fbcb5){return function(_0x40c9d4){if(_0x40c9d4){return _0x40c9d4[_0x83e8('0x25')]()[_0x83e8('0x26')](function(){var _0x2743b6=_0x40c9d4[_0x83e8('0x27')]({'plain':!![]});var _0x359ce2='Variables';return db[_0x83e8('0x28')][_0x83e8('0x25')]({'where':{'type':_0x359ce2,'resourceId':_0x2743b6['id']}})[_0x83e8('0x26')](function(){return _0x40c9d4;});})[_0x83e8('0x26')](function(){_0x3204b9[_0x83e8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53b932,_0x1c5ad0){return function(_0x1476f6){if(!_0x1476f6){_0x53b932[_0x83e8('0x29')](0x194);}return _0x1476f6;};}function handleError(_0x4a075b,_0x300680){_0x300680=_0x300680||0x1f4;return function(_0x84e995){logger['error'](_0x84e995['stack']);if(_0x84e995['name']){delete _0x84e995[_0x83e8('0x2a')];}_0x4a075b[_0x83e8('0x1a')](_0x300680)[_0x83e8('0x2b')](_0x84e995);};}exports['index']=function(_0x1d8e2d,_0x1723c8){var _0x583f36={},_0x3f2904={},_0x4d9857={'count':0x0,'rows':[]};var _0x75ccd6=_[_0x83e8('0x2c')](db[_0x83e8('0x2d')][_0x83e8('0x2e')],function(_0x40d262){return{'name':_0x40d262[_0x83e8('0x2f')],'type':_0x40d262[_0x83e8('0x30')]['key']};});_0x3f2904[_0x83e8('0x31')]=_['map'](_0x75ccd6,_0x83e8('0x2a'));_0x3f2904[_0x83e8('0x32')]=_[_0x83e8('0x33')](_0x1d8e2d[_0x83e8('0x32')]);_0x3f2904[_0x83e8('0x34')]=_[_0x83e8('0x35')](_0x3f2904[_0x83e8('0x31')],_0x3f2904[_0x83e8('0x32')]);_0x583f36[_0x83e8('0x36')]=_['intersection'](_0x3f2904[_0x83e8('0x31')],qs[_0x83e8('0x37')](_0x1d8e2d[_0x83e8('0x32')]['fields']));_0x583f36[_0x83e8('0x36')]=_0x583f36[_0x83e8('0x36')][_0x83e8('0x38')]?_0x583f36['attributes']:_0x3f2904[_0x83e8('0x31')];if(!_0x1d8e2d[_0x83e8('0x32')]['hasOwnProperty'](_0x83e8('0x39'))){_0x583f36[_0x83e8('0x1f')]=qs[_0x83e8('0x1f')](_0x1d8e2d['query']['limit']);_0x583f36[_0x83e8('0x1d')]=qs[_0x83e8('0x1d')](_0x1d8e2d[_0x83e8('0x32')]['offset']);}_0x583f36[_0x83e8('0x3a')]=qs['sort'](_0x1d8e2d[_0x83e8('0x32')][_0x83e8('0x3b')]);_0x583f36[_0x83e8('0x3c')]=qs[_0x83e8('0x34')](_[_0x83e8('0x3d')](_0x1d8e2d[_0x83e8('0x32')],_0x3f2904[_0x83e8('0x34')]),_0x75ccd6);if(_0x1d8e2d['query'][_0x83e8('0x3e')]){_0x583f36[_0x83e8('0x3c')]=_['merge'](_0x583f36[_0x83e8('0x3c')],{'$or':_[_0x83e8('0x2c')](_0x75ccd6,function(_0x355204){if(_0x355204['type']!==_0x83e8('0x3f')){var _0x17b345={};_0x17b345[_0x355204['name']]={'$like':'%'+_0x1d8e2d[_0x83e8('0x32')]['filter']+'%'};return _0x17b345;}})});}_0x583f36=_['merge']({},_0x583f36,_0x1d8e2d[_0x83e8('0x40')]);var _0x424331={'where':_0x583f36['where']};return db[_0x83e8('0x2d')][_0x83e8('0x20')](_0x424331)[_0x83e8('0x26')](function(_0x453404){_0x4d9857['count']=_0x453404;if(_0x1d8e2d[_0x83e8('0x32')][_0x83e8('0x41')]){_0x583f36[_0x83e8('0x42')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x583f36);})[_0x83e8('0x26')](function(_0x206875){_0x4d9857[_0x83e8('0x43')]=_0x206875;return _0x4d9857;})[_0x83e8('0x26')](respondWithFilteredResult(_0x1723c8,_0x583f36))[_0x83e8('0x44')](handleError(_0x1723c8,null));};exports['show']=function(_0x510e95,_0x5a6045){var _0x4e48cf={'raw':!![],'where':{'id':_0x510e95[_0x83e8('0x45')]['id']}},_0x506973={};_0x506973['model']=_[_0x83e8('0x33')](db[_0x83e8('0x2d')][_0x83e8('0x2e')]);_0x506973['query']=_[_0x83e8('0x33')](_0x510e95['query']);_0x506973['filters']=_[_0x83e8('0x35')](_0x506973[_0x83e8('0x31')],_0x506973[_0x83e8('0x32')]);_0x4e48cf['attributes']=_['intersection'](_0x506973['model'],qs[_0x83e8('0x37')](_0x510e95[_0x83e8('0x32')]['fields']));_0x4e48cf[_0x83e8('0x36')]=_0x4e48cf['attributes'][_0x83e8('0x38')]?_0x4e48cf[_0x83e8('0x36')]:_0x506973[_0x83e8('0x31')];if(_0x510e95['query'][_0x83e8('0x41')]){_0x4e48cf[_0x83e8('0x42')]=[{'all':!![]}];}_0x4e48cf=_['merge']({},_0x4e48cf,_0x510e95['options']);return db[_0x83e8('0x2d')][_0x83e8('0x46')](_0x4e48cf)[_0x83e8('0x26')](handleEntityNotFound(_0x5a6045,null))['then'](respondWithResult(_0x5a6045,null))[_0x83e8('0x44')](handleError(_0x5a6045,null));};exports[_0x83e8('0x47')]=function(_0xe4c3dc,_0x3c3c5c){return db[_0x83e8('0x2d')][_0x83e8('0x47')](_0xe4c3dc[_0x83e8('0x48')],{})[_0x83e8('0x26')](function(_0xbed479){var _0x5377f9=_0xe4c3dc['user'][_0x83e8('0x27')]({'plain':!![]});if(!_0x5377f9)throw new Error(_0x83e8('0x49'));if(_0x5377f9[_0x83e8('0x4a')]===_0x83e8('0x4b')){var _0x2b17cb=_0xbed479[_0x83e8('0x27')]({'plain':!![]});var _0x2be531=_0x83e8('0x4c');return db[_0x83e8('0x4d')][_0x83e8('0x46')]({'where':{'name':_0x2be531,'userProfileId':_0x5377f9['userProfileId']},'raw':!![]})[_0x83e8('0x26')](function(_0xbe454b){if(_0xbe454b&&_0xbe454b[_0x83e8('0x4e')]===0x0){return db[_0x83e8('0x28')]['create']({'name':_0x2b17cb[_0x83e8('0x2a')],'resourceId':_0x2b17cb['id'],'type':_0xbe454b[_0x83e8('0x2a')],'sectionId':_0xbe454b['id']},{})[_0x83e8('0x26')](function(){return _0xbed479;});}else{return _0xbed479;}})[_0x83e8('0x44')](function(_0x3858d6){logger[_0x83e8('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3858d6);throw _0x3858d6;});}return _0xbed479;})[_0x83e8('0x26')](respondWithResult(_0x3c3c5c,0xc9))[_0x83e8('0x44')](handleError(_0x3c3c5c,null));};exports['update']=function(_0x533596,_0x45bc3d){if(_0x533596[_0x83e8('0x48')]['id']){delete _0x533596[_0x83e8('0x48')]['id'];}return db[_0x83e8('0x2d')][_0x83e8('0x46')]({'where':{'id':_0x533596[_0x83e8('0x45')]['id']}})[_0x83e8('0x26')](handleEntityNotFound(_0x45bc3d,null))[_0x83e8('0x26')](saveUpdates(_0x533596[_0x83e8('0x48')],null))[_0x83e8('0x26')](respondWithResult(_0x45bc3d,null))[_0x83e8('0x44')](handleError(_0x45bc3d,null));};exports[_0x83e8('0x25')]=function(_0x139ffd,_0x24ab9d){return db[_0x83e8('0x2d')][_0x83e8('0x46')]({'where':{'id':_0x139ffd['params']['id']}})[_0x83e8('0x26')](handleEntityNotFound(_0x24ab9d,null))['then'](removeEntity(_0x24ab9d,null))[_0x83e8('0x44')](handleError(_0x24ab9d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 047e3de..ccbcffc 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 _0x4afa=['../../config/environment','./variable.attributes','exports','Variable','tools_variables','../../config/logger','api','bluebird','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4afa,0x11c));var _0xa4af=function(_0x105784,_0x205534){_0x105784=_0x105784-0x0;var _0x3c4aac=_0x4afa[_0x105784];return _0x3c4aac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa4af('0x0'))(_0xa4af('0x1'));var moment=require('moment');var BPromise=require(_0xa4af('0x2'));var rp=require(_0xa4af('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa4af('0x4'));var attributes=require(_0xa4af('0x5'));module[_0xa4af('0x6')]=function(_0x477216,_0x3af6bb){return _0x477216['define'](_0xa4af('0x7'),attributes,{'tableName':_0xa4af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaea1=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','util','moment','bluebird'];(function(_0x54039f,_0x122e28){var _0x38bfd2=function(_0x4f92c5){while(--_0x4f92c5){_0x54039f['push'](_0x54039f['shift']());}};_0x38bfd2(++_0x122e28);}(_0xaea1,0x131));var _0x1aea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaea1[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x1aea('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1aea('0x1'));var BPromise=require(_0x1aea('0x2'));var rp=require(_0x1aea('0x3'));var fs=require('fs');var path=require(_0x1aea('0x4'));var rimraf=require(_0x1aea('0x5'));var config=require(_0x1aea('0x6'));var attributes=require(_0x1aea('0x7'));module[_0x1aea('0x8')]=function(_0x5e6180,_0x14a8ba){return _0x5e6180[_0x1aea('0x9')]('Variable',attributes,{'tableName':_0x1aea('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 ac6166d..4b33c0f 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x24a718,_0x1b882c){var _0x38eb50=function(_0x406dc2){while(--_0x406dc2){_0x24a718['push'](_0x24a718['shift']());}};_0x38eb50(++_0x1b882c);}(_0x6aa7,0x178));var _0x76aa=function(_0x2820e2,_0x4e40ac){_0x2820e2=_0x2820e2-0x0;var _0x1a9d4e=_0x6aa7[_0x2820e2];return _0x1a9d4e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x17db3c,_0x2938ac){var _0x25fa58=function(_0x4fb8b3){while(--_0x4fb8b3){_0x17db3c['push'](_0x17db3c['shift']());}};_0x25fa58(++_0x2938ac);}(_0x7217,0x19e));var _0x7721=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7217[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 95ceebd..e041253 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 _0x37f1=['express','Router','../../components/auth/service','./version.controller','index','/fetch','canUpdate','get','/reset','isAuthenticated','/pull','pull','restart','/migrations','migrations','exports'];(function(_0x2614e2,_0x340140){var _0x22c508=function(_0x7e0239){while(--_0x7e0239){_0x2614e2['push'](_0x2614e2['shift']());}};_0x22c508(++_0x340140);}(_0x37f1,0x1f0));var _0x137f=function(_0x570b92,_0x5c669c){_0x570b92=_0x570b92-0x0;var _0x58d1f3=_0x37f1[_0x570b92];return _0x58d1f3;};'use strict';var express=require(_0x137f('0x0'));var router=express[_0x137f('0x1')]();var auth=require(_0x137f('0x2'));var controller=require(_0x137f('0x3'));router['get']('/',controller[_0x137f('0x4')]);router['get'](_0x137f('0x5'),auth['isAuthenticated'](),auth[_0x137f('0x6')](),controller['fetch']);router[_0x137f('0x7')](_0x137f('0x8'),auth[_0x137f('0x9')](),auth[_0x137f('0x6')](),controller['reset']);router[_0x137f('0x7')](_0x137f('0xa'),auth[_0x137f('0x9')](),auth[_0x137f('0x6')](),controller[_0x137f('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x137f('0xc')]);router[_0x137f('0x7')](_0x137f('0xd'),controller[_0x137f('0xe')]);module[_0x137f('0xf')]=router; \ No newline at end of file +var _0x35cb=['/pull','/restart','restart','/migrations','migrations','Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','/reset'];(function(_0x1e516c,_0x7dda2f){var _0x289abb=function(_0x5a81f7){while(--_0x5a81f7){_0x1e516c['push'](_0x1e516c['shift']());}};_0x289abb(++_0x7dda2f);}(_0x35cb,0x164));var _0xb35c=function(_0x2f2cd4,_0x34d7ef){_0x2f2cd4=_0x2f2cd4-0x0;var _0x58ba3c=_0x35cb[_0x2f2cd4];return _0x58ba3c;};'use strict';var express=require('express');var router=express[_0xb35c('0x0')]();var auth=require(_0xb35c('0x1'));var controller=require(_0xb35c('0x2'));router['get']('/',controller[_0xb35c('0x3')]);router[_0xb35c('0x4')]('/fetch',auth[_0xb35c('0x5')](),auth[_0xb35c('0x6')](),controller['fetch']);router[_0xb35c('0x4')](_0xb35c('0x7'),auth[_0xb35c('0x5')](),auth[_0xb35c('0x6')](),controller['reset']);router[_0xb35c('0x4')](_0xb35c('0x8'),auth[_0xb35c('0x5')](),auth[_0xb35c('0x6')](),controller['pull']);router[_0xb35c('0x4')](_0xb35c('0x9'),auth[_0xb35c('0x5')](),controller[_0xb35c('0xa')]);router[_0xb35c('0x4')](_0xb35c('0xb'),controller[_0xb35c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0f84fbd..8385bd1 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 _0x091a=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','length','.js','push','sort','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','umzug','path','lodash','version','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','status','json','master','error','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart'];(function(_0x524d4f,_0x14f328){var _0xab7f89=function(_0xc95d47){while(--_0xc95d47){_0x524d4f['push'](_0x524d4f['shift']());}};_0xab7f89(++_0x14f328);}(_0x091a,0x73));var _0xa091=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x091a[_0x2dea24];return _0x309d58;};'use strict';var Umzug=require(_0xa091('0x0'));var path=require(_0xa091('0x1'));var fs=require('fs');var _=require(_0xa091('0x2'));var pkginfo=require('pkginfo')(module,_0xa091('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xa091('0x4')];var db=require(_0xa091('0x5'))['db'];var config=require(_0xa091('0x6'));var pm2=require(_0xa091('0x7'));var logger=require(_0xa091('0x8'))(_0xa091('0x9'));var git=require(_0xa091('0xa'))(config['root']);exports[_0xa091('0xb')]=function(_0x4b3127,_0x8a2e17){var _0x3e3352={'current':module[_0xa091('0xc')][_0xa091('0x3')],'phonebar':0x2};if(_0x4b3127[_0xa091('0xd')]&&_0x4b3127[_0xa091('0xd')][_0xa091('0xe')]){return git[_0xa091('0xf')]()[_0xa091('0x10')](function(_0x2802fb,_0xac0dc2){_0x3e3352['latest']=(_0x2802fb?module[_0xa091('0xc')][_0xa091('0x3')]:_0xac0dc2[_0xa091('0xe')])||'2.0.0';return _0x8a2e17[_0xa091('0x11')](0xc8)[_0xa091('0x12')](_0x3e3352);});}else{return _0x8a2e17[_0xa091('0x11')](0xc8)['json'](_0x3e3352);}};exports[_0xa091('0xf')]=function(_0x362b12,_0x2e6a4b){return git[_0xa091('0xf')](['origin',_0xa091('0x13')],function(_0x3a8fde){if(_0x3a8fde){logger[_0xa091('0x14')](_0x3a8fde);return _0x2e6a4b['status'](0x1f4)['json'](_0x3a8fde);}logger['info']('git\x20fetch');return _0x2e6a4b[_0xa091('0x11')](0xc8)[_0xa091('0x12')]({'output':_0xa091('0x15')});});};exports[_0xa091('0x16')]=function(_0x4ec441,_0x25f271){return git[_0xa091('0x16')]([_0xa091('0x17'),'FETCH_HEAD'],function(_0x48b2fd){if(_0x48b2fd){logger['error'](_0x48b2fd);return _0x25f271[_0xa091('0x11')](0x1f4)[_0xa091('0x12')](_0x48b2fd);}logger[_0xa091('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x25f271[_0xa091('0x11')](0xc8)[_0xa091('0x12')]({'output':_0xa091('0x19')});});};exports[_0xa091('0x1a')]=function(_0x411cb2,_0xa7d74a){exec(_0xa091('0x1b'),function(_0x389dfd,_0x2f4735,_0x5cae72){logger[_0xa091('0x18')](_0x2f4735);logger['info'](_0x5cae72);if(_0x389dfd){logger[_0xa091('0x14')](_0x389dfd);return _0xa7d74a[_0xa091('0x11')](0x1f4)[_0xa091('0x12')](_0x389dfd);}return _0xa7d74a[_0xa091('0x11')](0xc8)[_0xa091('0x12')]({'output':_0x2f4735});});};exports[_0xa091('0x1c')]=function(_0x446aed,_0x520e7f){return pm2['restart'](_0xa091('0x1d'))[_0xa091('0x1e')](function(_0x2d1298){logger[_0xa091('0x18')](_0xa091('0x1f'),_0x2d1298);return _0x520e7f['status'](0xc8)[_0xa091('0x12')]({'output':_0xa091('0x20')});})[_0xa091('0x21')](function(_0x300586){logger['error'](_0x300586);return _0x520e7f['status'](0x1f4)['json'](_0x300586);});};exports[_0xa091('0x22')]=function(_0x227bb0,_0x501201){var _0x4c8c04=fs[_0xa091('0x23')](path['join'](config[_0xa091('0x24')],'server',_0xa091('0x22')));var _0x17fbca=[];for(var _0x4166fd=0x0;_0x4166fd<_0x4c8c04[_0xa091('0x25')];_0x4166fd++){var _0x30e3d8=_0x4c8c04[_0x4166fd]['replace'](_0xa091('0x26'),'');if(compareVersions(module[_0xa091('0xc')][_0xa091('0x3')],_0x30e3d8)===-0x1){_0x17fbca[_0xa091('0x27')](_0x30e3d8);}}if(_0x17fbca[_0xa091('0x25')]){var _0x444ff1=_0x17fbca[_0xa091('0x28')](compareVersions);var _0x2850fa=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0xa091('0x3')},'migrations':{'params':[db[_0xa091('0x29')]['getQueryInterface'](),db[_0xa091('0x29')][_0xa091('0x2a')],function(){throw new Error(_0xa091('0x2b'));}],'path':path[_0xa091('0x2c')](config[_0xa091('0x24')],'server',_0xa091('0x22')),'pattern':/\.js$/}});_0x2850fa['up']({'migrations':_['map'](_0x444ff1,function(_0x39106f){return _0x39106f+_0xa091('0x26');})})[_0xa091('0x1e')](function(){return _0x501201[_0xa091('0x11')](0xc8)['json']({'output':_0xa091('0x2d')+module['exports']['version']+_0xa091('0x2e')+_[_0xa091('0x2f')](_0x444ff1),'migrations':_[_0xa091('0x2c')](_0x444ff1)});})['catch'](function(_0x1589d8){if(_0x1589d8 instanceof db['sequelize']['UniqueConstraintError']){return _0x501201[_0xa091('0x11')](0xc8)[_0xa091('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x501201[_0xa091('0x11')](0x1f4)['json'](_0x1589d8);}});}else{return _0x501201[_0xa091('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x80f2=['status','origin','error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','index','exports','version','query','latest','fetch','tags'];(function(_0x5429e2,_0x326032){var _0x26f5f1=function(_0x24737f){while(--_0x24737f){_0x5429e2['push'](_0x5429e2['shift']());}};_0x26f5f1(++_0x326032);}(_0x80f2,0x168));var _0x280f=function(_0x2a9202,_0x5e68cb){_0x2a9202=_0x2a9202-0x0;var _0x316625=_0x80f2[_0x2a9202];return _0x316625;};'use strict';var Umzug=require(_0x280f('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x280f('0x1'));var pkginfo=require(_0x280f('0x2'))(module,'version');var compareVersions=require(_0x280f('0x3'));var exec=require(_0x280f('0x4'))[_0x280f('0x5')];var db=require(_0x280f('0x6'))['db'];var config=require(_0x280f('0x7'));var pm2=require(_0x280f('0x8'));var logger=require('../../config/logger')(_0x280f('0x9'));var git=require(_0x280f('0xa'))(config['root']);exports[_0x280f('0xb')]=function(_0xf90ca3,_0x287d74){var _0x10715d={'current':module[_0x280f('0xc')][_0x280f('0xd')],'phonebar':0x2};if(_0xf90ca3[_0x280f('0xe')]&&_0xf90ca3['query'][_0x280f('0xf')]){return git[_0x280f('0x10')]()[_0x280f('0x11')](function(_0x47c583,_0x58cabe){_0x10715d[_0x280f('0xf')]=(_0x47c583?module[_0x280f('0xc')][_0x280f('0xd')]:_0x58cabe[_0x280f('0xf')])||'2.0.0';return _0x287d74[_0x280f('0x12')](0xc8)['json'](_0x10715d);});}else{return _0x287d74[_0x280f('0x12')](0xc8)['json'](_0x10715d);}};exports[_0x280f('0x10')]=function(_0xfdb62a,_0x114c45){return git[_0x280f('0x10')]([_0x280f('0x13'),'master'],function(_0x300901){if(_0x300901){logger[_0x280f('0x14')](_0x300901);return _0x114c45[_0x280f('0x12')](0x1f4)[_0x280f('0x15')](_0x300901);}logger[_0x280f('0x16')](_0x280f('0x17'));return _0x114c45[_0x280f('0x12')](0xc8)[_0x280f('0x15')]({'output':_0x280f('0x18')});});};exports[_0x280f('0x19')]=function(_0x429c25,_0x5b45ce){return git[_0x280f('0x19')]([_0x280f('0x1a'),_0x280f('0x1b')],function(_0x4ec7aa){if(_0x4ec7aa){logger[_0x280f('0x14')](_0x4ec7aa);return _0x5b45ce[_0x280f('0x12')](0x1f4)[_0x280f('0x15')](_0x4ec7aa);}logger[_0x280f('0x16')](_0x280f('0x1c'));return _0x5b45ce['status'](0xc8)[_0x280f('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0x280f('0x1d')]=function(_0x13b610,_0x4a371f){exec(_0x280f('0x1e'),function(_0x302331,_0x51867b,_0x4e9936){logger['info'](_0x51867b);logger[_0x280f('0x16')](_0x4e9936);if(_0x302331){logger['error'](_0x302331);return _0x4a371f[_0x280f('0x12')](0x1f4)[_0x280f('0x15')](_0x302331);}return _0x4a371f['status'](0xc8)[_0x280f('0x15')]({'output':_0x51867b});});};exports[_0x280f('0x1f')]=function(_0x28c115,_0x3b8110){return pm2[_0x280f('0x1f')](_0x280f('0x20'))[_0x280f('0x21')](function(_0x1de0cc){logger[_0x280f('0x16')](_0x280f('0x22'),_0x1de0cc);return _0x3b8110[_0x280f('0x12')](0xc8)[_0x280f('0x15')]({'output':_0x280f('0x23')});})['catch'](function(_0x29dc75){logger[_0x280f('0x14')](_0x29dc75);return _0x3b8110[_0x280f('0x12')](0x1f4)[_0x280f('0x15')](_0x29dc75);});};exports[_0x280f('0x24')]=function(_0xbd8e9d,_0x2cde63){var _0x482a6d=fs[_0x280f('0x25')](path[_0x280f('0x26')](config[_0x280f('0x27')],_0x280f('0x28'),_0x280f('0x24')));var _0x5a5f1b=[];for(var _0x55b1cd=0x0;_0x55b1cd<_0x482a6d[_0x280f('0x29')];_0x55b1cd++){var _0x92a04=_0x482a6d[_0x55b1cd][_0x280f('0x2a')](_0x280f('0x2b'),'');if(compareVersions(module['exports'][_0x280f('0xd')],_0x92a04)===-0x1){_0x5a5f1b[_0x280f('0x2c')](_0x92a04);}}if(_0x5a5f1b[_0x280f('0x29')]){var _0x150cf8=_0x5a5f1b['sort'](compareVersions);var _0xa71149=new Umzug({'storage':_0x280f('0x2d'),'storageOptions':{'model':db[_0x280f('0x2e')],'modelName':_0x280f('0x2e'),'columnName':_0x280f('0xd')},'migrations':{'params':[db[_0x280f('0x2d')][_0x280f('0x2f')](),db[_0x280f('0x2d')][_0x280f('0x30')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x280f('0x26')](config['root'],_0x280f('0x28'),_0x280f('0x24')),'pattern':/\.js$/}});_0xa71149['up']({'migrations':_['map'](_0x150cf8,function(_0x4d15a1){return _0x4d15a1+_0x280f('0x2b');})})['then'](function(){return _0x2cde63[_0x280f('0x12')](0xc8)[_0x280f('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x280f('0xd')]+_0x280f('0x31')+_[_0x280f('0x32')](_0x150cf8),'migrations':_[_0x280f('0x26')](_0x150cf8)});})[_0x280f('0x33')](function(_0x3563ca){if(_0x3563ca instanceof db[_0x280f('0x2d')][_0x280f('0x34')]){return _0x2cde63[_0x280f('0x12')](0xc8)[_0x280f('0x15')]({'output':_0x280f('0x35')});}else{return _0x2cde63[_0x280f('0x12')](0x1f4)['json'](_0x3563ca);}});}else{return _0x2cde63['status'](0xc8)[_0x280f('0x15')]({'output':_0x280f('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1b30d83..69f17f3 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 _0x64ae=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0xf4878e,_0x44ed56){var _0x523f81=function(_0x2d36b4){while(--_0x2d36b4){_0xf4878e['push'](_0xf4878e['shift']());}};_0x523f81(++_0x44ed56);}(_0x64ae,0xa8));var _0xe64a=function(_0x573196,_0x1639b1){_0x573196=_0x573196-0x0;var _0x142ffe=_0x64ae[_0x573196];return _0x142ffe;};'use strict';var multer=require('multer');var util=require(_0xe64a('0x0'));var path=require(_0xe64a('0x1'));var timeout=require(_0xe64a('0x2'));var express=require('express');var router=express[_0xe64a('0x3')]();var fs_extra=require(_0xe64a('0x4'));var auth=require(_0xe64a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe64a('0x6'));var controller=require(_0xe64a('0x7'));router[_0xe64a('0x8')]('/',auth[_0xe64a('0x9')](),controller['index']);router[_0xe64a('0x8')](_0xe64a('0xa'),auth['isAuthenticated'](),controller[_0xe64a('0xb')]);router[_0xe64a('0x8')](_0xe64a('0xc'),auth['isAuthenticated'](),controller[_0xe64a('0xd')]);router['post']('/',auth[_0xe64a('0x9')](),controller[_0xe64a('0xe')]);router[_0xe64a('0xf')](_0xe64a('0xc'),auth[_0xe64a('0x9')](),controller['update']);router[_0xe64a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe64a('0x11')]);module[_0xe64a('0x12')]=router; \ No newline at end of file +var _0xed61=['Router','fs-extra','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5a0bda,_0x3ca3cd){var _0x33aa65=function(_0x12b91f){while(--_0x12b91f){_0x5a0bda['push'](_0x5a0bda['shift']());}};_0x33aa65(++_0x3ca3cd);}(_0xed61,0x88));var _0x1ed6=function(_0x8c2e4e,_0x3c105b){_0x8c2e4e=_0x8c2e4e-0x0;var _0x2286bb=_0xed61[_0x8c2e4e];return _0x2286bb;};'use strict';var multer=require(_0x1ed6('0x0'));var util=require(_0x1ed6('0x1'));var path=require(_0x1ed6('0x2'));var timeout=require(_0x1ed6('0x3'));var express=require('express');var router=express[_0x1ed6('0x4')]();var fs_extra=require(_0x1ed6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ed6('0x6'));var controller=require(_0x1ed6('0x7'));router['get']('/',auth[_0x1ed6('0x8')](),controller[_0x1ed6('0x9')]);router[_0x1ed6('0xa')](_0x1ed6('0xb'),auth['isAuthenticated'](),controller[_0x1ed6('0xc')]);router[_0x1ed6('0xa')](_0x1ed6('0xd'),auth[_0x1ed6('0x8')](),controller[_0x1ed6('0xe')]);router['post']('/',auth[_0x1ed6('0x8')](),controller[_0x1ed6('0xf')]);router[_0x1ed6('0x10')](_0x1ed6('0xd'),auth['isAuthenticated'](),controller[_0x1ed6('0x11')]);router['delete'](_0x1ed6('0xd'),auth[_0x1ed6('0x8')](),controller[_0x1ed6('0x12')]);module[_0x1ed6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 6b271e6..d51a681 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 _0x8eba=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x324fd8,_0x550c26){var _0x185534=function(_0x3488e7){while(--_0x3488e7){_0x324fd8['push'](_0x324fd8['shift']());}};_0x185534(++_0x550c26);}(_0x8eba,0xc3));var _0xa8eb=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x8eba[_0x2ae2ad];return _0x26dbd7;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa8eb('0x2')]},'queue':{'type':Sequelize[_0xa8eb('0x2')]},'interface':{'type':Sequelize[_0xa8eb('0x2')]},'membername':{'type':Sequelize[_0xa8eb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xa8eb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa8eb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa8eb('0x5')]},'reason':{'type':Sequelize[_0xa8eb('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8eb('0x2')]},'channelstate':{'type':Sequelize[_0xa8eb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa8eb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa8eb('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8eb('0x2')]},'destchannel':{'type':Sequelize[_0xa8eb('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa8eb('0x2')]},'destlanguage':{'type':Sequelize[_0xa8eb('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa8eb('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa8eb('0x2')]},'destuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa8eb('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa8eb('0x2')],'comment':_0xa8eb('0x6')},'transferexten':{'type':Sequelize[_0xa8eb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'agententerreason':{'type':Sequelize[_0xa8eb('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1a85=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x2c6ecf,_0x4396cc){var _0x3bcaed=function(_0xa769cb){while(--_0xa769cb){_0x2c6ecf['push'](_0x2c6ecf['shift']());}};_0x3bcaed(++_0x4396cc);}(_0x1a85,0x178));var _0x51a8=function(_0x4225aa,_0x582bf2){_0x4225aa=_0x4225aa-0x0;var _0x3f8fab=_0x1a85[_0x4225aa];return _0x3f8fab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x51a8('0x0')]},'uniqueid':{'type':Sequelize[_0x51a8('0x0')]},'calleridnum':{'type':Sequelize[_0x51a8('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x51a8('0x0')]},'membername':{'type':Sequelize[_0x51a8('0x0')]},'agentcalledAt':{'type':Sequelize[_0x51a8('0x1')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x51a8('0x1')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x51a8('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x51a8('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x51a8('0x0')]},'lastevent':{'type':Sequelize[_0x51a8('0x0')]},'channel':{'type':Sequelize[_0x51a8('0x0')]},'channelstate':{'type':Sequelize[_0x51a8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x51a8('0x0')]},'connectedlinenum':{'type':Sequelize[_0x51a8('0x0')]},'connectedlinename':{'type':Sequelize[_0x51a8('0x0')]},'language':{'type':Sequelize[_0x51a8('0x0')]},'accountcode':{'type':Sequelize[_0x51a8('0x0')]},'context':{'type':Sequelize[_0x51a8('0x0')]},'exten':{'type':Sequelize[_0x51a8('0x0')]},'priority':{'type':Sequelize[_0x51a8('0x0')]},'destchannel':{'type':Sequelize[_0x51a8('0x0')]},'destchannelstate':{'type':Sequelize[_0x51a8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x51a8('0x0')]},'destcalleridnum':{'type':Sequelize[_0x51a8('0x0')]},'destcalleridname':{'type':Sequelize[_0x51a8('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x51a8('0x0')]},'destlanguage':{'type':Sequelize[_0x51a8('0x0')]},'destaccountcode':{'type':Sequelize[_0x51a8('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x51a8('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x51a8('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x51a8('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x51a8('0x0')]},'transfer':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x51a8('0x0')],'comment':_0x51a8('0x4')},'transferexten':{'type':Sequelize[_0x51a8('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x51a8('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9373535..54bfb90 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 ee1d25a..6db18eb 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 _0x08d9=['uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent'];(function(_0x1223ab,_0x3cf08c){var _0x438fe4=function(_0x6dbe7){while(--_0x6dbe7){_0x1223ab['push'](_0x1223ab['shift']());}};_0x438fe4(++_0x3cf08c);}(_0x08d9,0xc2));var _0x908d=function(_0x1d90a3,_0x5b9978){_0x1d90a3=_0x1d90a3-0x0;var _0x549988=_0x08d9[_0x1d90a3];return _0x549988;};'use strict';var _=require(_0x908d('0x0'));var util=require('util');var logger=require(_0x908d('0x1'))('api');var moment=require(_0x908d('0x2'));var BPromise=require(_0x908d('0x3'));var rp=require(_0x908d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x908d('0x5'));var attributes=require(_0x908d('0x6'));module[_0x908d('0x7')]=function(_0xe780e0,_0xb63409){return _0xe780e0['define'](_0x908d('0x8'),attributes,{'tableName':_0x908d('0x9'),'paranoid':![],'indexes':[{'fields':[_0x908d('0xa'),_0x908d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger'];(function(_0x2a3c73,_0x12dac8){var _0x943b16=function(_0x24708f){while(--_0x24708f){_0x2a3c73['push'](_0x2a3c73['shift']());}};_0x943b16(++_0x12dac8);}(_0xf2cf,0xf5));var _0xff2c=function(_0x1a8f81,_0x34d92f){_0x1a8f81=_0x1a8f81-0x0;var _0x1ac6f0=_0xf2cf[_0x1a8f81];return _0x1ac6f0;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))(_0xff2c('0x2'));var moment=require('moment');var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module['exports']=function(_0x8f0f4,_0x68b356){return _0x8f0f4['define'](_0xff2c('0x9'),attributes,{'tableName':_0xff2c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xff2c('0xb'),_0xff2c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index becad1f..f72d1ef 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 _0x744e=['request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','UpdateVoiceAgentReport','update','options','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xa66c1,_0x20f3e4){var _0x8693e7=function(_0x571790){while(--_0x571790){_0xa66c1['push'](_0xa66c1['shift']());}};_0x8693e7(++_0x20f3e4);}(_0x744e,0x1af));var _0xe744=function(_0x502277,_0x3f99ff){_0x502277=_0x502277-0x0;var _0x2578e6=_0x744e[_0x502277];return _0x2578e6;};'use strict';var _=require(_0xe744('0x0'));var util=require('util');var moment=require(_0xe744('0x1'));var BPromise=require('bluebird');var rs=require(_0xe744('0x2'));var fs=require('fs');var Redis=require(_0xe744('0x3'));var db=require(_0xe744('0x4'))['db'];var utils=require(_0xe744('0x5'));var logger=require(_0xe744('0x6'))(_0xe744('0x7'));var config=require(_0xe744('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe744('0x9')][_0xe744('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa691d8,_0x212283,_0x310852){return new BPromise(function(_0x434907,_0x31ccc5){return client[_0xe744('0xb')](_0xa691d8,_0x310852)[_0xe744('0xc')](function(_0x505614){logger[_0xe744('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x212283,_0xe744('0xe'));logger[_0xe744('0xf')](_0xe744('0x10'),_0x212283,'request\x20sent',JSON[_0xe744('0x11')](_0x505614));if(_0x505614[_0xe744('0x12')]){if(_0x505614[_0xe744('0x12')][_0xe744('0x13')]===0x1f4){logger[_0xe744('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x212283,_0x505614[_0xe744('0x12')][_0xe744('0x14')]);return _0x31ccc5(_0x505614['error'][_0xe744('0x14')]);}logger[_0xe744('0x12')](_0xe744('0x15'),_0x212283,_0x505614[_0xe744('0x12')]['message']);return _0x434907(_0x505614[_0xe744('0x12')][_0xe744('0x14')]);}else{logger[_0xe744('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x212283,_0xe744('0xe'));_0x434907(_0x505614['result'][_0xe744('0x14')]);}})[_0xe744('0x16')](function(_0x585cca){logger[_0xe744('0x12')](_0xe744('0x15'),_0x212283,_0x585cca);_0x31ccc5(_0x585cca);});});}exports[_0xe744('0x17')]=function(_0x5d6f9d){var _0x449f16=this;return new Promise(function(_0x44af97,_0x52194f){return db[_0xe744('0x18')][_0xe744('0x19')](_0x5d6f9d[_0xe744('0x1a')],{'raw':_0x5d6f9d['options']?_0x5d6f9d['options']['raw']===undefined?!![]:![]:!![]})[_0xe744('0xc')](function(_0x4f840a){logger['info'](_0xe744('0x17'),_0x5d6f9d);logger[_0xe744('0xf')]('CreateVoiceAgentReport',_0x5d6f9d,JSON[_0xe744('0x11')](_0x4f840a));_0x44af97(_0x4f840a);})[_0xe744('0x16')](function(_0x2d8a88){logger[_0xe744('0x12')](_0xe744('0x17'),_0x2d8a88[_0xe744('0x14')],_0x5d6f9d);_0x52194f(_0x449f16[_0xe744('0x12')](0x1f4,_0x2d8a88[_0xe744('0x14')]));});});};exports[_0xe744('0x1b')]=function(_0x42af24){var _0x56c3f6=this;return new Promise(function(_0x4a4cbc,_0x29f65d){return db[_0xe744('0x18')][_0xe744('0x1c')](_0x42af24[_0xe744('0x1a')],{'raw':_0x42af24['options']?_0x42af24[_0xe744('0x1d')][_0xe744('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42af24[_0xe744('0x1d')]?_0x42af24[_0xe744('0x1d')][_0xe744('0x1f')]||null:null,'attributes':_0x42af24[_0xe744('0x1d')]?_0x42af24[_0xe744('0x1d')][_0xe744('0x20')]||null:null,'limit':_0x42af24[_0xe744('0x1d')]?_0x42af24[_0xe744('0x1d')][_0xe744('0x21')]||null:null})[_0xe744('0xc')](function(_0x26361f){logger[_0xe744('0xd')](_0xe744('0x1b'),_0x42af24);logger[_0xe744('0xf')](_0xe744('0x1b'),_0x42af24,JSON[_0xe744('0x11')](_0x26361f));_0x4a4cbc(_0x26361f);})[_0xe744('0x16')](function(_0x2488d0){logger[_0xe744('0x12')]('UpdateVoiceAgentReport',_0x2488d0[_0xe744('0x14')],_0x42af24);_0x29f65d(_0x56c3f6[_0xe744('0x12')](0x1f4,_0x2488d0[_0xe744('0x14')]));});});}; \ No newline at end of file +var _0x4eed=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x30ca3c,_0x557d12){var _0x41ccbd=function(_0x4d6c6a){while(--_0x4d6c6a){_0x30ca3c['push'](_0x30ca3c['shift']());}};_0x41ccbd(++_0x557d12);}(_0x4eed,0x111));var _0xd4ee=function(_0x26db9f,_0x4c5b34){_0x26db9f=_0x26db9f-0x0;var _0x542106=_0x4eed[_0x26db9f];return _0x542106;};'use strict';var _=require('lodash');var util=require(_0xd4ee('0x0'));var moment=require(_0xd4ee('0x1'));var BPromise=require(_0xd4ee('0x2'));var rs=require(_0xd4ee('0x3'));var fs=require('fs');var Redis=require(_0xd4ee('0x4'));var db=require(_0xd4ee('0x5'))['db'];var utils=require(_0xd4ee('0x6'));var logger=require(_0xd4ee('0x7'))(_0xd4ee('0x8'));var config=require(_0xd4ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd4ee('0xa')][_0xd4ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45d926,_0x33bcdf,_0x3becc6){return new BPromise(function(_0x37405d,_0x2a045c){return client[_0xd4ee('0xc')](_0x45d926,_0x3becc6)[_0xd4ee('0xd')](function(_0x5b5e85){logger[_0xd4ee('0xe')](_0xd4ee('0xf'),_0x33bcdf,_0xd4ee('0x10'));logger[_0xd4ee('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x33bcdf,_0xd4ee('0x10'),JSON[_0xd4ee('0x12')](_0x5b5e85));if(_0x5b5e85[_0xd4ee('0x13')]){if(_0x5b5e85[_0xd4ee('0x13')][_0xd4ee('0x14')]===0x1f4){logger[_0xd4ee('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x33bcdf,_0x5b5e85[_0xd4ee('0x13')][_0xd4ee('0x15')]);return _0x2a045c(_0x5b5e85['error']['message']);}logger[_0xd4ee('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x33bcdf,_0x5b5e85['error'][_0xd4ee('0x15')]);return _0x37405d(_0x5b5e85[_0xd4ee('0x13')][_0xd4ee('0x15')]);}else{logger[_0xd4ee('0xe')](_0xd4ee('0xf'),_0x33bcdf,_0xd4ee('0x10'));_0x37405d(_0x5b5e85[_0xd4ee('0x16')][_0xd4ee('0x15')]);}})[_0xd4ee('0x17')](function(_0x5b5e7b){logger[_0xd4ee('0x13')](_0xd4ee('0xf'),_0x33bcdf,_0x5b5e7b);_0x2a045c(_0x5b5e7b);});});}exports[_0xd4ee('0x18')]=function(_0x2b1220){var _0x2af59c=this;return new Promise(function(_0x25731c,_0x2af272){return db[_0xd4ee('0x19')]['create'](_0x2b1220[_0xd4ee('0x1a')],{'raw':_0x2b1220[_0xd4ee('0x1b')]?_0x2b1220['options'][_0xd4ee('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x538da9){logger[_0xd4ee('0xe')](_0xd4ee('0x18'),_0x2b1220);logger['debug'](_0xd4ee('0x18'),_0x2b1220,JSON[_0xd4ee('0x12')](_0x538da9));_0x25731c(_0x538da9);})[_0xd4ee('0x17')](function(_0x3a080d){logger[_0xd4ee('0x13')](_0xd4ee('0x18'),_0x3a080d[_0xd4ee('0x15')],_0x2b1220);_0x2af272(_0x2af59c[_0xd4ee('0x13')](0x1f4,_0x3a080d[_0xd4ee('0x15')]));});});};exports[_0xd4ee('0x1d')]=function(_0x5707e5){var _0x641f8e=this;return new Promise(function(_0x188697,_0x2bd56f){return db[_0xd4ee('0x19')]['update'](_0x5707e5[_0xd4ee('0x1a')],{'raw':_0x5707e5[_0xd4ee('0x1b')]?_0x5707e5['options'][_0xd4ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5707e5[_0xd4ee('0x1b')]?_0x5707e5[_0xd4ee('0x1b')][_0xd4ee('0x1e')]||null:null,'attributes':_0x5707e5[_0xd4ee('0x1b')]?_0x5707e5['options']['attributes']||null:null,'limit':_0x5707e5[_0xd4ee('0x1b')]?_0x5707e5['options'][_0xd4ee('0x1f')]||null:null})[_0xd4ee('0xd')](function(_0x13ca30){logger[_0xd4ee('0xe')]('UpdateVoiceAgentReport',_0x5707e5);logger[_0xd4ee('0x11')](_0xd4ee('0x1d'),_0x5707e5,JSON[_0xd4ee('0x12')](_0x13ca30));_0x188697(_0x13ca30);})[_0xd4ee('0x17')](function(_0x2394c9){logger[_0xd4ee('0x13')](_0xd4ee('0x1d'),_0x2394c9[_0xd4ee('0x15')],_0x5707e5);_0x2bd56f(_0x641f8e['error'](0x1f4,_0x2394c9[_0xd4ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d8ade34..098df56 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbd50,0x196));var _0x0bd5=function(_0x1a1529,_0x4122f4){_0x1a1529=_0x1a1529-0x0;var _0x25d5db=_0xbd50[_0x1a1529];return _0x25d5db;};'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('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x6737=['isAuthenticated','index','get','show','create','put','update','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x365dc0,_0x368410){var _0x3ce388=function(_0x5f2969){while(--_0x5f2969){_0x365dc0['push'](_0x365dc0['shift']());}};_0x3ce388(++_0x368410);}(_0x6737,0xe2));var _0x7673=function(_0x3f8610,_0x58523f){_0x3f8610=_0x3f8610-0x0;var _0x55df1b=_0x6737[_0x3f8610];return _0x55df1b;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7673('0xa')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);router['post']('/',auth[_0x7673('0x8')](),controller[_0x7673('0xc')]);router[_0x7673('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0xe')]);router['delete'](_0x7673('0xf'),auth[_0x7673('0x8')](),controller[_0x7673('0x10')]);module[_0x7673('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index bf90ef8..9462f46 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 _0xe5bb=['outbound','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal'];(function(_0x3bf0cf,_0x201880){var _0x33a549=function(_0x2e9aee){while(--_0x2e9aee){_0x3bf0cf['push'](_0x3bf0cf['shift']());}};_0x33a549(++_0x201880);}(_0xe5bb,0x166));var _0xbe5b=function(_0x419c14,_0x4f81bd){_0x419c14=_0x419c14-0x0;var _0x753d76=_0xe5bb[_0x419c14];return _0x753d76;};'use strict';var Sequelize=require(_0xbe5b('0x0'));module[_0xbe5b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbe5b('0x2')](_0xbe5b('0x3'),_0xbe5b('0x4'),_0xbe5b('0x5'),'inbound-fax',_0xbe5b('0x6'),_0xbe5b('0x7'))},'tag':{'type':Sequelize[_0xbe5b('0x8')]},'accountcode':{'type':Sequelize[_0xbe5b('0x8')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xbe5b('0x8')]},'destinationcontext':{'type':Sequelize[_0xbe5b('0x8')]},'callerid':{'type':Sequelize[_0xbe5b('0x8')]},'channel':{'type':Sequelize[_0xbe5b('0x8')]},'destinationchannel':{'type':Sequelize[_0xbe5b('0x8')]},'lastapplication':{'type':Sequelize[_0xbe5b('0x8')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbe5b('0x9')]},'systemanswertime':{'type':Sequelize[_0xbe5b('0x9')]},'answertime':{'type':Sequelize[_0xbe5b('0x9')]},'endtime':{'type':Sequelize[_0xbe5b('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xbe5b('0xa')]},'mohtime':{'type':Sequelize[_0xbe5b('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xbe5b('0x8')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xbe5b('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xbe5b('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xbe5b('0x8')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xbe5b('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b0f=['inbound','outbound','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b0f,0xba));var _0xf4b0=function(_0x3038be,_0x425d69){_0x3038be=_0x3038be-0x0;var _0x581d4e=_0x4b0f[_0x3038be];return _0x581d4e;};'use strict';var Sequelize=require(_0xf4b0('0x0'));module[_0xf4b0('0x1')]={'uniqueid':{'type':Sequelize[_0xf4b0('0x2')]},'type':{'type':Sequelize[_0xf4b0('0x3')](_0xf4b0('0x4'),'internal',_0xf4b0('0x5'),'inbound-fax','outbound-fax',_0xf4b0('0x6'))},'tag':{'type':Sequelize[_0xf4b0('0x2')]},'accountcode':{'type':Sequelize[_0xf4b0('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xf4b0('0x2')]},'callerid':{'type':Sequelize[_0xf4b0('0x2')]},'channel':{'type':Sequelize[_0xf4b0('0x2')]},'destinationchannel':{'type':Sequelize[_0xf4b0('0x2')]},'lastapplication':{'type':Sequelize[_0xf4b0('0x2')]},'lastdata':{'type':Sequelize[_0xf4b0('0x7')]},'starttime':{'type':Sequelize[_0xf4b0('0x8')]},'systemanswertime':{'type':Sequelize[_0xf4b0('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf4b0('0x8')]},'duration':{'type':Sequelize[_0xf4b0('0x9')]},'billableseconds':{'type':Sequelize[_0xf4b0('0x9')]},'mohtime':{'type':Sequelize[_0xf4b0('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf4b0('0x2')]},'amaflags':{'type':Sequelize[_0xf4b0('0x2')]},'userfield':{'type':Sequelize[_0xf4b0('0x2')]},'userDisposition':{'type':Sequelize[_0xf4b0('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf4b0('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xf4b0('0x9')]},'sipcallid':{'type':Sequelize[_0xf4b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fde849d..835322e 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xadb5,0xad));var _0x5adb=function(_0x4cfa00,_0x5c941c){_0x4cfa00=_0x4cfa00-0x0;var _0x486828=_0xadb5[_0x4cfa00];return _0x486828;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x2cc924,_0x146e25){_0x2cc924=_0x2cc924-0x0;var _0x7d8126=_0x2032[_0x2cc924];return _0x7d8126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0304fa2..1dca2d9 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 _0x0f7c=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash'];(function(_0x25f963,_0x499586){var _0xfd98a=function(_0x2cc727){while(--_0x2cc727){_0x25f963['push'](_0x25f963['shift']());}};_0xfd98a(++_0x499586);}(_0x0f7c,0x16b));var _0xc0f7=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0f7c[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var logger=require(_0xc0f7('0x2'))(_0xc0f7('0x3'));var moment=require(_0xc0f7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc0f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var attributes=require(_0xc0f7('0x8'));module[_0xc0f7('0x9')]=function(_0x12870d,_0x2f0103){return _0x12870d[_0xc0f7('0xa')]('VoiceCallReport',attributes,{'tableName':_0xc0f7('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc0f7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd5=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2105f1,_0x1a1a46){var _0x418ca3=function(_0x8209d9){while(--_0x8209d9){_0x2105f1['push'](_0x2105f1['shift']());}};_0x418ca3(++_0x1a1a46);}(_0x3dd5,0x73));var _0x53dd=function(_0xf8d981,_0x5b3745){_0xf8d981=_0xf8d981-0x0;var _0x2e7ae1=_0x3dd5[_0xf8d981];return _0x2e7ae1;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var logger=require(_0x53dd('0x1'))(_0x53dd('0x2'));var moment=require(_0x53dd('0x3'));var BPromise=require(_0x53dd('0x4'));var rp=require(_0x53dd('0x5'));var fs=require('fs');var path=require(_0x53dd('0x6'));var rimraf=require(_0x53dd('0x7'));var config=require(_0x53dd('0x8'));var attributes=require(_0x53dd('0x9'));module['exports']=function(_0x3c8f9e,_0x26c218){return _0x3c8f9e[_0x53dd('0xa')](_0x53dd('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5e5394d..a70cfe3 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 _0xa4a3=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','stringify','catch','CreateVoiceCallReport','create','body','limit','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xa4a3,0xb8));var _0x3a4a=function(_0x5cf5fd,_0x4bca34){_0x5cf5fd=_0x5cf5fd-0x0;var _0x4a53ec=_0xa4a3[_0x5cf5fd];return _0x4a53ec;};'use strict';var _=require(_0x3a4a('0x0'));var util=require('util');var moment=require(_0x3a4a('0x1'));var BPromise=require(_0x3a4a('0x2'));var rs=require(_0x3a4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a4a('0x4'))['db'];var utils=require(_0x3a4a('0x5'));var logger=require(_0x3a4a('0x6'))(_0x3a4a('0x7'));var config=require(_0x3a4a('0x8'));var jayson=require(_0x3a4a('0x9'));var client=jayson[_0x3a4a('0xa')][_0x3a4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d10f8,_0x20c62a,_0x541aa7){return new BPromise(function(_0x36fff5,_0x2a0fdb){return client[_0x3a4a('0xc')](_0x2d10f8,_0x541aa7)[_0x3a4a('0xd')](function(_0x35a532){logger[_0x3a4a('0xe')](_0x3a4a('0xf'),_0x20c62a,_0x3a4a('0x10'));logger[_0x3a4a('0x11')](_0x3a4a('0x12'),_0x20c62a,'request\x20sent',JSON['stringify'](_0x35a532));if(_0x35a532[_0x3a4a('0x13')]){if(_0x35a532[_0x3a4a('0x13')][_0x3a4a('0x14')]===0x1f4){logger['error'](_0x3a4a('0xf'),_0x20c62a,_0x35a532[_0x3a4a('0x13')][_0x3a4a('0x15')]);return _0x2a0fdb(_0x35a532[_0x3a4a('0x13')][_0x3a4a('0x15')]);}logger[_0x3a4a('0x13')](_0x3a4a('0xf'),_0x20c62a,_0x35a532[_0x3a4a('0x13')]['message']);return _0x36fff5(_0x35a532[_0x3a4a('0x13')][_0x3a4a('0x15')]);}else{logger[_0x3a4a('0xe')](_0x3a4a('0xf'),_0x20c62a,_0x3a4a('0x10'));_0x36fff5(_0x35a532['result'][_0x3a4a('0x15')]);}})['catch'](function(_0xb21922){logger[_0x3a4a('0x13')](_0x3a4a('0xf'),_0x20c62a,_0xb21922);_0x2a0fdb(_0xb21922);});});}exports[_0x3a4a('0x16')]=function(_0x29e63c){var _0x26bf82=this;return new Promise(function(_0x5735ef,_0x154c04){return db[_0x3a4a('0x17')][_0x3a4a('0x18')]({'raw':_0x29e63c['options']?_0x29e63c[_0x3a4a('0x19')][_0x3a4a('0x1a')]===undefined?!![]:![]:!![],'where':_0x29e63c['options']?_0x29e63c[_0x3a4a('0x19')][_0x3a4a('0x1b')]||null:null,'attributes':_0x29e63c['options']?_0x29e63c[_0x3a4a('0x19')][_0x3a4a('0x1c')]||null:null,'limit':_0x29e63c[_0x3a4a('0x19')]?_0x29e63c[_0x3a4a('0x19')]['limit']||null:null,'include':_0x29e63c['options']?_0x29e63c[_0x3a4a('0x19')][_0x3a4a('0x1d')]?_[_0x3a4a('0x1e')](_0x29e63c[_0x3a4a('0x19')][_0x3a4a('0x1d')],function(_0x73b333){return{'model':db[_0x73b333[_0x3a4a('0x1f')]],'as':_0x73b333['as'],'attributes':_0x73b333[_0x3a4a('0x1c')],'include':_0x73b333[_0x3a4a('0x1d')]?_['map'](_0x73b333['include'],function(_0x3274e3){return{'model':db[_0x3274e3[_0x3a4a('0x1f')]],'as':_0x3274e3['as'],'attributes':_0x3274e3['attributes'],'include':_0x3274e3['include']?_[_0x3a4a('0x1e')](_0x3274e3[_0x3a4a('0x1d')],function(_0x48268d){return{'model':db[_0x48268d['model']],'as':_0x48268d['as'],'attributes':_0x48268d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a4a('0xd')](function(_0x470d4a){logger[_0x3a4a('0xe')](_0x3a4a('0x16'),_0x29e63c);logger[_0x3a4a('0x11')]('GetVoiceCallReport',_0x29e63c,JSON[_0x3a4a('0x20')](_0x470d4a));_0x5735ef(_0x470d4a);})[_0x3a4a('0x21')](function(_0x22c687){logger[_0x3a4a('0x13')](_0x3a4a('0x16'),_0x22c687[_0x3a4a('0x15')],_0x29e63c);_0x154c04(_0x26bf82[_0x3a4a('0x13')](0x1f4,_0x22c687[_0x3a4a('0x15')]));});});};exports[_0x3a4a('0x22')]=function(_0x51216f){var _0x266e5d=this;return new Promise(function(_0x5e3786,_0xaced5){return db[_0x3a4a('0x17')][_0x3a4a('0x23')](_0x51216f[_0x3a4a('0x24')],{'raw':_0x51216f['options']?_0x51216f[_0x3a4a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3a4a('0xd')](function(_0x4a7805){logger[_0x3a4a('0xe')]('CreateVoiceCallReport',_0x51216f);logger[_0x3a4a('0x11')]('CreateVoiceCallReport',_0x51216f,JSON[_0x3a4a('0x20')](_0x4a7805));_0x5e3786(_0x4a7805);})[_0x3a4a('0x21')](function(_0x391d2a){logger[_0x3a4a('0x13')](_0x3a4a('0x22'),_0x391d2a[_0x3a4a('0x15')],_0x51216f);_0xaced5(_0x266e5d[_0x3a4a('0x13')](0x1f4,_0x391d2a[_0x3a4a('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x11843c){var _0x5d05d8=this;return new Promise(function(_0x29c7f1,_0x44220d){return db[_0x3a4a('0x17')]['update'](_0x11843c['body'],{'raw':_0x11843c['options']?_0x11843c[_0x3a4a('0x19')][_0x3a4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11843c[_0x3a4a('0x19')]?_0x11843c['options'][_0x3a4a('0x1b')]||null:null,'attributes':_0x11843c[_0x3a4a('0x19')]?_0x11843c[_0x3a4a('0x19')][_0x3a4a('0x1c')]||null:null,'limit':_0x11843c[_0x3a4a('0x19')]?_0x11843c['options'][_0x3a4a('0x25')]||null:null})[_0x3a4a('0xd')](function(_0x352337){logger[_0x3a4a('0xe')]('UpdateVoiceCallReport',_0x11843c);logger['debug'](_0x3a4a('0x26'),_0x11843c,JSON['stringify'](_0x352337));_0x29c7f1(_0x352337);})[_0x3a4a('0x21')](function(_0x2fb259){logger[_0x3a4a('0x13')](_0x3a4a('0x26'),_0x2fb259[_0x3a4a('0x15')],_0x11843c);_0x44220d(_0x5d05d8[_0x3a4a('0x13')](0x1f4,_0x2fb259['message']));});});}; \ No newline at end of file +var _0x8269=['jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','map','include','model','attributes','debug','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x12a900,_0x4f120a){var _0x216dbd=function(_0x489e73){while(--_0x489e73){_0x12a900['push'](_0x12a900['shift']());}};_0x216dbd(++_0x4f120a);}(_0x8269,0x6a));var _0x9826=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8269[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x9826('0x0'));var moment=require(_0x9826('0x1'));var BPromise=require(_0x9826('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9826('0x3'));var db=require(_0x9826('0x4'))['db'];var utils=require(_0x9826('0x5'));var logger=require('../../config/logger')(_0x9826('0x6'));var config=require(_0x9826('0x7'));var jayson=require(_0x9826('0x8'));var client=jayson[_0x9826('0x9')][_0x9826('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dd6a,_0xb70ad1,_0x11c4f6){return new BPromise(function(_0x4d37be,_0x20c5af){return client['request'](_0x17dd6a,_0x11c4f6)[_0x9826('0xb')](function(_0x44dae2){logger['info'](_0x9826('0xc'),_0xb70ad1,_0x9826('0xd'));logger['debug'](_0x9826('0xe'),_0xb70ad1,_0x9826('0xd'),JSON[_0x9826('0xf')](_0x44dae2));if(_0x44dae2['error']){if(_0x44dae2['error'][_0x9826('0x10')]===0x1f4){logger['error'](_0x9826('0xc'),_0xb70ad1,_0x44dae2[_0x9826('0x11')]['message']);return _0x20c5af(_0x44dae2['error'][_0x9826('0x12')]);}logger['error'](_0x9826('0xc'),_0xb70ad1,_0x44dae2[_0x9826('0x11')][_0x9826('0x12')]);return _0x4d37be(_0x44dae2[_0x9826('0x11')][_0x9826('0x12')]);}else{logger[_0x9826('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0xb70ad1,_0x9826('0xd'));_0x4d37be(_0x44dae2[_0x9826('0x14')]['message']);}})['catch'](function(_0xd26151){logger['error'](_0x9826('0xc'),_0xb70ad1,_0xd26151);_0x20c5af(_0xd26151);});});}exports[_0x9826('0x15')]=function(_0x2c8517){var _0x4eab49=this;return new Promise(function(_0x3b604f,_0x3e431c){return db[_0x9826('0x16')][_0x9826('0x17')]({'raw':_0x2c8517[_0x9826('0x18')]?_0x2c8517[_0x9826('0x18')][_0x9826('0x19')]===undefined?!![]:![]:!![],'where':_0x2c8517[_0x9826('0x18')]?_0x2c8517[_0x9826('0x18')]['where']||null:null,'attributes':_0x2c8517[_0x9826('0x18')]?_0x2c8517[_0x9826('0x18')]['attributes']||null:null,'limit':_0x2c8517[_0x9826('0x18')]?_0x2c8517[_0x9826('0x18')][_0x9826('0x1a')]||null:null,'include':_0x2c8517[_0x9826('0x18')]?_0x2c8517[_0x9826('0x18')]['include']?_[_0x9826('0x1b')](_0x2c8517['options'][_0x9826('0x1c')],function(_0x258eee){return{'model':db[_0x258eee[_0x9826('0x1d')]],'as':_0x258eee['as'],'attributes':_0x258eee[_0x9826('0x1e')],'include':_0x258eee[_0x9826('0x1c')]?_[_0x9826('0x1b')](_0x258eee[_0x9826('0x1c')],function(_0x472f07){return{'model':db[_0x472f07[_0x9826('0x1d')]],'as':_0x472f07['as'],'attributes':_0x472f07[_0x9826('0x1e')],'include':_0x472f07[_0x9826('0x1c')]?_[_0x9826('0x1b')](_0x472f07['include'],function(_0x500878){return{'model':db[_0x500878[_0x9826('0x1d')]],'as':_0x500878['as'],'attributes':_0x500878[_0x9826('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9826('0xb')](function(_0x2df7f4){logger[_0x9826('0x13')](_0x9826('0x15'),_0x2c8517);logger[_0x9826('0x1f')](_0x9826('0x15'),_0x2c8517,JSON[_0x9826('0xf')](_0x2df7f4));_0x3b604f(_0x2df7f4);})[_0x9826('0x20')](function(_0x4ecaa3){logger[_0x9826('0x11')](_0x9826('0x15'),_0x4ecaa3[_0x9826('0x12')],_0x2c8517);_0x3e431c(_0x4eab49['error'](0x1f4,_0x4ecaa3[_0x9826('0x12')]));});});};exports[_0x9826('0x21')]=function(_0x250d51){var _0x403b5f=this;return new Promise(function(_0x25206e,_0xeec39d){return db[_0x9826('0x16')][_0x9826('0x22')](_0x250d51[_0x9826('0x23')],{'raw':_0x250d51[_0x9826('0x18')]?_0x250d51[_0x9826('0x18')][_0x9826('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x195822){logger[_0x9826('0x13')]('CreateVoiceCallReport',_0x250d51);logger[_0x9826('0x1f')](_0x9826('0x21'),_0x250d51,JSON['stringify'](_0x195822));_0x25206e(_0x195822);})['catch'](function(_0x13b43b){logger['error']('CreateVoiceCallReport',_0x13b43b[_0x9826('0x12')],_0x250d51);_0xeec39d(_0x403b5f[_0x9826('0x11')](0x1f4,_0x13b43b[_0x9826('0x12')]));});});};exports[_0x9826('0x24')]=function(_0x59a496){var _0x16996f=this;return new Promise(function(_0x3d1ba9,_0x258e1f){return db[_0x9826('0x16')][_0x9826('0x25')](_0x59a496[_0x9826('0x23')],{'raw':_0x59a496['options']?_0x59a496[_0x9826('0x18')][_0x9826('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a496['options']?_0x59a496[_0x9826('0x18')]['where']||null:null,'attributes':_0x59a496[_0x9826('0x18')]?_0x59a496[_0x9826('0x18')][_0x9826('0x1e')]||null:null,'limit':_0x59a496[_0x9826('0x18')]?_0x59a496[_0x9826('0x18')][_0x9826('0x1a')]||null:null})[_0x9826('0xb')](function(_0x3a80bd){logger[_0x9826('0x13')]('UpdateVoiceCallReport',_0x59a496);logger[_0x9826('0x1f')](_0x9826('0x24'),_0x59a496,JSON[_0x9826('0xf')](_0x3a80bd));_0x3d1ba9(_0x3a80bd);})[_0x9826('0x20')](function(_0x25d9d8){logger[_0x9826('0x11')](_0x9826('0x24'),_0x25d9d8[_0x9826('0x12')],_0x59a496);_0x258e1f(_0x16996f[_0x9826('0x11')](0x1f4,_0x25d9d8[_0x9826('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e8d9420..667372c 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 _0x047d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2ef6eb,_0x1f09c4){var _0x5135c9=function(_0x3f878b){while(--_0x3f878b){_0x2ef6eb['push'](_0x2ef6eb['shift']());}};_0x5135c9(++_0x1f09c4);}(_0x047d,0x150));var _0xd047=function(_0x5d04e1,_0x2abe9a){_0x5d04e1=_0x5d04e1-0x0;var _0x192bcc=_0x047d[_0x5d04e1];return _0x192bcc;};'use strict';var multer=require(_0xd047('0x0'));var util=require(_0xd047('0x1'));var path=require(_0xd047('0x2'));var timeout=require(_0xd047('0x3'));var express=require(_0xd047('0x4'));var router=express[_0xd047('0x5')]();var fs_extra=require(_0xd047('0x6'));var auth=require(_0xd047('0x7'));var interaction=require(_0xd047('0x8'));var config=require(_0xd047('0x9'));var controller=require('./voiceChanSpy.controller');router[_0xd047('0xa')]('/',auth[_0xd047('0xb')](),controller[_0xd047('0xc')]);router[_0xd047('0xa')](_0xd047('0xd'),auth[_0xd047('0xb')](),controller[_0xd047('0xe')]);router[_0xd047('0xf')]('/',auth[_0xd047('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd047('0x10')](_0xd047('0xd'),auth[_0xd047('0xb')](),controller[_0xd047('0x11')]);module[_0xd047('0x12')]=router; \ No newline at end of file +var _0xaf35=['show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x360b2f,_0x1ef3bc){var _0x88bb68=function(_0xe7629f){while(--_0xe7629f){_0x360b2f['push'](_0x360b2f['shift']());}};_0x88bb68(++_0x1ef3bc);}(_0xaf35,0xf1));var _0x5af3=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xaf35[_0x2e41e2];return _0x2844d6;};'use strict';var multer=require(_0x5af3('0x0'));var util=require(_0x5af3('0x1'));var path=require('path');var timeout=require(_0x5af3('0x2'));var express=require(_0x5af3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5af3('0x4'));var interaction=require(_0x5af3('0x5'));var config=require(_0x5af3('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x5af3('0x7')]('/',auth[_0x5af3('0x8')](),controller[_0x5af3('0x9')]);router[_0x5af3('0x7')](_0x5af3('0xa'),auth['isAuthenticated'](),controller[_0x5af3('0xb')]);router[_0x5af3('0xc')]('/',auth[_0x5af3('0x8')](),controller[_0x5af3('0xd')]);router[_0x5af3('0xe')]('/:id',auth[_0x5af3('0x8')](),controller[_0x5af3('0xf')]);router[_0x5af3('0x10')](_0x5af3('0xa'),auth[_0x5af3('0x8')](),controller['destroy']);module[_0x5af3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ec8a985..aa1835e 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 _0xd736=['getDataValue','split','sequelize','exports','name','STRING','setDataValue','options','join'];(function(_0x20379a,_0x3f271b){var _0x3242c0=function(_0x5c736a){while(--_0x5c736a){_0x20379a['push'](_0x20379a['shift']());}};_0x3242c0(++_0x3f271b);}(_0xd736,0x161));var _0x6d73=function(_0x353d3f,_0x1fe8cc){_0x353d3f=_0x353d3f-0x0;var _0x5344a2=_0xd736[_0x353d3f];return _0x5344a2;};'use strict';var Sequelize=require(_0x6d73('0x0'));module[_0x6d73('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x6d73('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6d73('0x3')],'set':function(_0x328f32){this[_0x6d73('0x4')](_0x6d73('0x5'),_0x328f32?_0x328f32[_0x6d73('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x6d73('0x5'))?this[_0x6d73('0x7')](_0x6d73('0x5'))[_0x6d73('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d73('0x3')]}}; \ No newline at end of file +var _0x9e16=['setDataValue','join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x2b9ae3,_0xd6d709){var _0x4e18a2=function(_0x397406){while(--_0x397406){_0x2b9ae3['push'](_0x2b9ae3['shift']());}};_0x4e18a2(++_0xd6d709);}(_0x9e16,0x15a));var _0x69e1=function(_0x5bb3f1,_0x2c8b09){_0x5bb3f1=_0x5bb3f1-0x0;var _0x28fc67=_0x9e16[_0x5bb3f1];return _0x28fc67;};'use strict';var Sequelize=require(_0x69e1('0x0'));module[_0x69e1('0x1')]={'name':{'type':Sequelize[_0x69e1('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x69e1('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x69e1('0x2')],'set':function(_0x237e29){this[_0x69e1('0x4')]('options',_0x237e29?_0x237e29[_0x69e1('0x5')](''):[]);},'get':function(){return this[_0x69e1('0x6')](_0x69e1('0x7'))?this[_0x69e1('0x6')](_0x69e1('0x7'))[_0x69e1('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x69e1('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x69e1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d95792d..250ea05 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 _0x91a7=['moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','rimraf','zip-dir','fast-json-patch'];(function(_0x5949ff,_0x3d4f40){var _0x3db26f=function(_0x1ca2a6){while(--_0x1ca2a6){_0x5949ff['push'](_0x5949ff['shift']());}};_0x3db26f(++_0x3d4f40);}(_0x91a7,0xe7));var _0x791a=function(_0x358a8d,_0x2a943f){_0x358a8d=_0x358a8d-0x0;var _0x4cde8b=_0x91a7[_0x358a8d];return _0x4cde8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['VoiceChanSpy'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));}; \ No newline at end of file +var _0xaf80=['sort','where','pick','filter','merge','options','include','findAll','catch','show','params','VoiceChanSpy','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x2c1311,_0x5abe6d){var _0x53b2be=function(_0x16ed72){while(--_0x16ed72){_0x2c1311['push'](_0x2c1311['shift']());}};_0x53b2be(++_0x5abe6d);}(_0xaf80,0x1ef));var _0x0af8=function(_0x17df66,_0x3ddebf){_0x17df66=_0x17df66-0x0;var _0x3a2693=_0xaf80[_0x17df66];return _0x3a2693;};'use strict';var emlformat=require(_0x0af8('0x0'));var rimraf=require(_0x0af8('0x1'));var zipdir=require(_0x0af8('0x2'));var jsonpatch=require(_0x0af8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0af8('0x4'));var util=require(_0x0af8('0x5'));var path=require(_0x0af8('0x6'));var sox=require(_0x0af8('0x7'));var csv=require(_0x0af8('0x8'));var ejs=require(_0x0af8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0af8('0xa'));var crypto=require('crypto');var jsforce=require(_0x0af8('0xb'));var deskjs=require(_0x0af8('0xc'));var toCsv=require(_0x0af8('0x8'));var querystring=require('querystring');var Papa=require(_0x0af8('0xd'));var Redis=require(_0x0af8('0xe'));var authService=require(_0x0af8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0af8('0x10'));var logger=require(_0x0af8('0x11'))(_0x0af8('0x12'));var utils=require(_0x0af8('0x13'));var config=require(_0x0af8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0af8('0x15'))['db'];function respondWithStatusCode(_0x2d5892,_0x465135){_0x465135=_0x465135||0xcc;return function(_0x31d390){if(_0x31d390){return _0x2d5892[_0x0af8('0x16')](_0x465135);}return _0x2d5892[_0x0af8('0x17')](_0x465135)[_0x0af8('0x18')]();};}function respondWithResult(_0x58a9a8,_0x58ef18){_0x58ef18=_0x58ef18||0xc8;return function(_0x420432){if(_0x420432){return _0x58a9a8[_0x0af8('0x17')](_0x58ef18)[_0x0af8('0x19')](_0x420432);}};}function respondWithFilteredResult(_0x216f0b,_0x2a42a4){return function(_0x1997b8){if(_0x1997b8){var _0x4755cb=typeof _0x2a42a4[_0x0af8('0x1a')]==='undefined'&&typeof _0x2a42a4['limit']==='undefined';var _0x3294ce=_0x1997b8[_0x0af8('0x1b')];var _0x54e946=_0x4755cb?0x0:_0x2a42a4[_0x0af8('0x1a')];var _0x230a68=_0x4755cb?_0x1997b8[_0x0af8('0x1b')]:_0x2a42a4['offset']+_0x2a42a4['limit'];var _0x50b8fa;if(_0x230a68>=_0x3294ce){_0x230a68=_0x3294ce;_0x50b8fa=0xc8;}else{_0x50b8fa=0xce;}_0x216f0b[_0x0af8('0x17')](_0x50b8fa);return _0x216f0b[_0x0af8('0x1c')]('Content-Range',_0x54e946+'-'+_0x230a68+'/'+_0x3294ce)[_0x0af8('0x19')](_0x1997b8);}return null;};}function patchUpdates(_0x4891e6){return function(_0x5cbf28){try{jsonpatch[_0x0af8('0x1d')](_0x5cbf28,_0x4891e6,!![]);}catch(_0x2e0b36){return BPromise[_0x0af8('0x1e')](_0x2e0b36);}return _0x5cbf28[_0x0af8('0x1f')]();};}function saveUpdates(_0x162e95,_0x52778f){return function(_0x592523){if(_0x592523){return _0x592523[_0x0af8('0x20')](_0x162e95)[_0x0af8('0x21')](function(_0x4b0492){return _0x4b0492;});}return null;};}function removeEntity(_0x300474,_0x320d0c){return function(_0x404b25){if(_0x404b25){return _0x404b25[_0x0af8('0x22')]()[_0x0af8('0x21')](function(){var _0x57e0a9=_0x404b25['get']({'plain':!![]});var _0x1c6306=_0x0af8('0x23');return db[_0x0af8('0x24')][_0x0af8('0x22')]({'where':{'type':_0x1c6306,'resourceId':_0x57e0a9['id']}})['then'](function(){return _0x404b25;});})['then'](function(){_0x300474[_0x0af8('0x17')](0xcc)[_0x0af8('0x18')]();});}};}function handleEntityNotFound(_0x23a102,_0x140104){return function(_0x2e8853){if(!_0x2e8853){_0x23a102[_0x0af8('0x16')](0x194);}return _0x2e8853;};}function handleError(_0x318476,_0x4c1b0b){_0x4c1b0b=_0x4c1b0b||0x1f4;return function(_0x34aa8b){logger[_0x0af8('0x25')](_0x34aa8b[_0x0af8('0x26')]);if(_0x34aa8b[_0x0af8('0x27')]){delete _0x34aa8b[_0x0af8('0x27')];}_0x318476[_0x0af8('0x17')](_0x4c1b0b)[_0x0af8('0x28')](_0x34aa8b);};}exports[_0x0af8('0x29')]=function(_0x80bdcc,_0x270b49){var _0x2a90c4={},_0x47a75d={},_0x405a60={'count':0x0,'rows':[]};var _0x497a8d=_[_0x0af8('0x2a')](db['VoiceChanSpy'][_0x0af8('0x2b')],function(_0x1d2d4f){return{'name':_0x1d2d4f['fieldName'],'type':_0x1d2d4f[_0x0af8('0x2c')][_0x0af8('0x2d')]};});_0x47a75d[_0x0af8('0x2e')]=_['map'](_0x497a8d,_0x0af8('0x27'));_0x47a75d[_0x0af8('0x2f')]=_[_0x0af8('0x30')](_0x80bdcc['query']);_0x47a75d[_0x0af8('0x31')]=_[_0x0af8('0x32')](_0x47a75d[_0x0af8('0x2e')],_0x47a75d[_0x0af8('0x2f')]);_0x2a90c4[_0x0af8('0x33')]=_[_0x0af8('0x32')](_0x47a75d['model'],qs[_0x0af8('0x34')](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x34')]));_0x2a90c4[_0x0af8('0x33')]=_0x2a90c4[_0x0af8('0x33')][_0x0af8('0x35')]?_0x2a90c4[_0x0af8('0x33')]:_0x47a75d[_0x0af8('0x2e')];if(!_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x36')](_0x0af8('0x37'))){_0x2a90c4[_0x0af8('0x38')]=qs['limit'](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x38')]);_0x2a90c4[_0x0af8('0x1a')]=qs[_0x0af8('0x1a')](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x1a')]);}_0x2a90c4[_0x0af8('0x39')]=qs['sort'](_0x80bdcc[_0x0af8('0x2f')][_0x0af8('0x3a')]);_0x2a90c4[_0x0af8('0x3b')]=qs['filters'](_[_0x0af8('0x3c')](_0x80bdcc[_0x0af8('0x2f')],_0x47a75d[_0x0af8('0x31')]),_0x497a8d);if(_0x80bdcc['query'][_0x0af8('0x3d')]){_0x2a90c4[_0x0af8('0x3b')]=_[_0x0af8('0x3e')](_0x2a90c4[_0x0af8('0x3b')],{'$or':_[_0x0af8('0x2a')](_0x497a8d,function(_0x2cc173){if(_0x2cc173[_0x0af8('0x2c')]!=='VIRTUAL'){var _0x586924={};_0x586924[_0x2cc173[_0x0af8('0x27')]]={'$like':'%'+_0x80bdcc[_0x0af8('0x2f')]['filter']+'%'};return _0x586924;}})});}_0x2a90c4=_[_0x0af8('0x3e')]({},_0x2a90c4,_0x80bdcc[_0x0af8('0x3f')]);var _0x52b98b={'where':_0x2a90c4[_0x0af8('0x3b')]};return db['VoiceChanSpy'][_0x0af8('0x1b')](_0x52b98b)[_0x0af8('0x21')](function(_0x510bec){_0x405a60[_0x0af8('0x1b')]=_0x510bec;if(_0x80bdcc[_0x0af8('0x2f')]['includeAll']){_0x2a90c4[_0x0af8('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x0af8('0x41')](_0x2a90c4);})[_0x0af8('0x21')](function(_0x141d2f){_0x405a60['rows']=_0x141d2f;return _0x405a60;})['then'](respondWithFilteredResult(_0x270b49,_0x2a90c4))[_0x0af8('0x42')](handleError(_0x270b49,null));};exports[_0x0af8('0x43')]=function(_0x37e54e,_0x1ce0fd){var _0x59bb96={'raw':![],'where':{'id':_0x37e54e[_0x0af8('0x44')]['id']}},_0x1293d8={};_0x1293d8[_0x0af8('0x2e')]=_['keys'](db[_0x0af8('0x45')][_0x0af8('0x2b')]);_0x1293d8['query']=_[_0x0af8('0x30')](_0x37e54e['query']);_0x1293d8[_0x0af8('0x31')]=_['intersection'](_0x1293d8['model'],_0x1293d8['query']);_0x59bb96[_0x0af8('0x33')]=_['intersection'](_0x1293d8[_0x0af8('0x2e')],qs['fields'](_0x37e54e[_0x0af8('0x2f')][_0x0af8('0x34')]));_0x59bb96[_0x0af8('0x33')]=_0x59bb96[_0x0af8('0x33')][_0x0af8('0x35')]?_0x59bb96['attributes']:_0x1293d8['model'];if(_0x37e54e[_0x0af8('0x2f')][_0x0af8('0x46')]){_0x59bb96[_0x0af8('0x40')]=[{'all':!![]}];}_0x59bb96=_[_0x0af8('0x3e')]({},_0x59bb96,_0x37e54e[_0x0af8('0x3f')]);return db[_0x0af8('0x45')][_0x0af8('0x47')](_0x59bb96)['then'](handleEntityNotFound(_0x1ce0fd,null))['then'](respondWithResult(_0x1ce0fd,null))[_0x0af8('0x42')](handleError(_0x1ce0fd,null));};exports[_0x0af8('0x48')]=function(_0x394525,_0x3c57dd){return db['VoiceChanSpy'][_0x0af8('0x48')](_0x394525[_0x0af8('0x49')],{})[_0x0af8('0x21')](function(_0x789885){var _0x219cac=_0x394525[_0x0af8('0x4a')]['get']({'plain':!![]});if(!_0x219cac)throw new Error(_0x0af8('0x4b'));if(_0x219cac['role']===_0x0af8('0x4a')){var _0x4a43e3=_0x789885[_0x0af8('0x4c')]({'plain':!![]});var _0x36ec9e=_0x0af8('0x23');return db['UserProfileSection'][_0x0af8('0x47')]({'where':{'name':_0x36ec9e,'userProfileId':_0x219cac[_0x0af8('0x4d')]},'raw':!![]})['then'](function(_0x40811e){if(_0x40811e&&_0x40811e[_0x0af8('0x4e')]===0x0){return db[_0x0af8('0x24')][_0x0af8('0x48')]({'name':_0x4a43e3[_0x0af8('0x27')],'resourceId':_0x4a43e3['id'],'type':_0x40811e[_0x0af8('0x27')],'sectionId':_0x40811e['id']},{})[_0x0af8('0x21')](function(){return _0x789885;});}else{return _0x789885;}})['catch'](function(_0x3af515){logger[_0x0af8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3af515);throw _0x3af515;});}return _0x789885;})['then'](respondWithResult(_0x3c57dd,0xc9))[_0x0af8('0x42')](handleError(_0x3c57dd,null));};exports[_0x0af8('0x20')]=function(_0x592f36,_0x2dd0ed){if(_0x592f36[_0x0af8('0x49')]['id']){delete _0x592f36['body']['id'];}return db[_0x0af8('0x45')]['find']({'where':{'id':_0x592f36['params']['id']}})[_0x0af8('0x21')](handleEntityNotFound(_0x2dd0ed,null))[_0x0af8('0x21')](saveUpdates(_0x592f36['body'],null))[_0x0af8('0x21')](respondWithResult(_0x2dd0ed,null))[_0x0af8('0x42')](handleError(_0x2dd0ed,null));};exports['destroy']=function(_0x11b510,_0x47d16c){return db[_0x0af8('0x45')][_0x0af8('0x47')]({'where':{'id':_0x11b510['params']['id']}})['then'](handleEntityNotFound(_0x47d16c,null))[_0x0af8('0x21')](removeEntity(_0x47d16c,null))[_0x0af8('0x42')](handleError(_0x47d16c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c4ca874..aa29b92 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 _0x4af6=['name','options','length','concat','internal','findAll','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','lodash','util','bluebird','context','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s'];(function(_0x8d6bfd,_0x249877){var _0x42b378=function(_0x1337cb){while(--_0x1337cb){_0x8d6bfd['push'](_0x8d6bfd['shift']());}};_0x42b378(++_0x249877);}(_0x4af6,0x19a));var _0x64af=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4af6[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x64af('0x0'));var util=require(_0x64af('0x1'));var BPromise=require(_0x64af('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3a45f7,_0x16d958,_0x5deb9a){var _0x1bec8e=0x1;var _0x18c0a3=[];var _0x143e55={'context':_0x16d958[_0x64af('0x3')]||_0x64af('0x4'),'exten':util['format'](_0x64af('0x5'),_0x3a45f7[_0x64af('0x6')],_0x5deb9a),'type':_0x64af('0x7'),'isApp':![],'ChanSpyId':_0x3a45f7['id'],'UserId':_0x16d958['id']};_0x18c0a3[_0x64af('0x8')](_[_0x64af('0x9')]({'app':_0x64af('0xa'),'appdata':util[_0x64af('0xb')](_0x64af('0xc'),_0x64af('0xd')),'priority':_0x1bec8e++},_0x143e55));if(_0x3a45f7[_0x64af('0xe')]){_0x18c0a3[_0x64af('0x8')](_[_0x64af('0x9')]({'app':_0x64af('0xf'),'appdata':util['format'](_0x64af('0x10'),_0x3a45f7[_0x64af('0x11')]),'priority':_0x1bec8e++},_0x143e55));}if(_0x3a45f7[_0x64af('0x12')]){_0x18c0a3[_0x64af('0x8')](_[_0x64af('0x9')]({'app':_0x64af('0x13'),'appdata':_0x3a45f7[_0x64af('0x14')],'priority':_0x1bec8e++},_0x143e55));}_0x18c0a3[_0x64af('0x8')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x64af('0x15'),_0x16d958[_0x64af('0x16')],_0x3a45f7[_0x64af('0x17')]?_0x3a45f7[_0x64af('0x17')]['join'](''):''),'priority':_0x1bec8e++},_0x143e55));if(_0x3a45f7[_0x64af('0xe')]){_0x18c0a3['push'](_['merge']({'app':'StopMixMonitor','priority':_0x1bec8e++},_0x143e55));}return _0x18c0a3;};var getChanSpyApplications=function(_0x58aec8,_0x13eec4){var _0x58dd71=[];for(var _0xdd1962=0x0,_0x3c9017=0x1;_0xdd1962<_0x13eec4[_0x64af('0x18')];_0xdd1962++,_0x3c9017=0x1){_0x58dd71=_0x58dd71[_0x64af('0x19')](getUserApplications(_0x58aec8,_0x13eec4[_0xdd1962],_0x13eec4[_0xdd1962][_0x64af('0x1a')]));if(_0x13eec4[_0xdd1962][_0x64af('0x1a')]!=_0x13eec4[_0xdd1962][_0x64af('0x16')]){_0x58dd71=_0x58dd71[_0x64af('0x19')](getUserApplications(_0x58aec8,_0x13eec4[_0xdd1962],_0x13eec4[_0xdd1962][_0x64af('0x16')]));}}return _0x58dd71;};var getChanSpyPromise=function(_0x32057e,_0x392626){return new BPromise(function(_0x7f051d,_0x2deda7){return _0x32057e['User'][_0x64af('0x1b')]({'attributes':['id',_0x64af('0x16'),_0x64af('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x64af('0x1c')](function(_0x371d99){if(_0x371d99){return _0x7f051d(getChanSpyApplications(_0x392626,_0x371d99));}return _0x7f051d([]);})['catch'](function(_0x197e4d){_0x2deda7(_0x197e4d);});});};module[_0x64af('0x1d')]=function(_0x5a0c2e,_0x2288ce){var _0x5623b1=_0x5a0c2e[_0x64af('0x1e')];return _0x5a0c2e['define'](_0x64af('0x1f'),attributes,{'tableName':_0x64af('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54af07,_0x1db76d,_0x27aeef){return getChanSpyPromise(_0x5623b1,_0x54af07)['then'](function(_0x1fb75c){if(_0x1fb75c&&_0x1fb75c['length']){return _0x5623b1[_0x64af('0x21')][_0x64af('0x22')](_0x1fb75c);}})[_0x64af('0x1c')](function(){_0x27aeef();})[_0x64af('0x23')](function(_0x6467a6){_0x27aeef(_0x6467a6);});},'afterUpdate':function(_0x37d3ce,_0x2198e1,_0x33abac){return _0x5623b1[_0x64af('0x21')]['destroy']({'where':{'ChanSpyId':_0x37d3ce['id']}})[_0x64af('0x1c')](function(){return getChanSpyPromise(_0x5623b1,_0x37d3ce);})[_0x64af('0x1c')](function(_0x1e44df){if(_0x1e44df&&_0x1e44df[_0x64af('0x18')]){return _0x5623b1[_0x64af('0x21')][_0x64af('0x22')](_0x1e44df);}})[_0x64af('0x1c')](function(){_0x33abac();})[_0x64af('0x23')](function(_0xa0cc3d){_0x33abac(_0xa0cc3d);});},'afterDestroy':function(_0x125d80,_0x3f9cf4,_0x34664f){return _0x5623b1[_0x64af('0x21')]['destroy']({'where':{'ChanSpyId':_0x125d80['id']}})[_0x64af('0x1c')](function(){_0x34664f();})['catch'](function(_0x1fb4de){_0x34664f(_0x1fb4de);});}}});}; \ No newline at end of file +var _0x7969=['context','from-sip','format','%s%s','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll','then','exports','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','lodash','util'];(function(_0x462b14,_0xda0b33){var _0x331eb3=function(_0x15551c){while(--_0x15551c){_0x462b14['push'](_0x462b14['shift']());}};_0x331eb3(++_0xda0b33);}(_0x7969,0xdc));var _0x9796=function(_0x1df642,_0x2307ee){_0x1df642=_0x1df642-0x0;var _0x5f34ac=_0x7969[_0x1df642];return _0x5f34ac;};'use strict';var _=require(_0x9796('0x0'));var util=require(_0x9796('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x352df9,_0xc208dd,_0x1bcc76){var _0x49d49c=0x1;var _0x3a8915=[];var _0x3c2e50={'context':_0xc208dd[_0x9796('0x2')]||_0x9796('0x3'),'exten':util[_0x9796('0x4')](_0x9796('0x5'),_0x352df9['prefix'],_0x1bcc76),'type':'system','isApp':![],'ChanSpyId':_0x352df9['id'],'UserId':_0xc208dd['id']};_0x3a8915[_0x9796('0x6')](_['merge']({'app':_0x9796('0x7'),'appdata':util[_0x9796('0x4')](_0x9796('0x8'),_0x9796('0x9')),'priority':_0x49d49c++},_0x3c2e50));if(_0x352df9[_0x9796('0xa')]){_0x3a8915['push'](_[_0x9796('0xb')]({'app':_0x9796('0xc'),'appdata':util[_0x9796('0x4')](_0x9796('0xd'),_0x352df9[_0x9796('0xe')]),'priority':_0x49d49c++},_0x3c2e50));}if(_0x352df9[_0x9796('0xf')]){_0x3a8915[_0x9796('0x6')](_['merge']({'app':_0x9796('0x10'),'appdata':_0x352df9[_0x9796('0x11')],'priority':_0x49d49c++},_0x3c2e50));}_0x3a8915['push'](_[_0x9796('0xb')]({'app':_0x9796('0x12'),'appdata':util['format'](_0x9796('0x13'),_0xc208dd[_0x9796('0x14')],_0x352df9[_0x9796('0x15')]?_0x352df9['options'][_0x9796('0x16')](''):''),'priority':_0x49d49c++},_0x3c2e50));if(_0x352df9[_0x9796('0xa')]){_0x3a8915[_0x9796('0x6')](_['merge']({'app':_0x9796('0x17'),'priority':_0x49d49c++},_0x3c2e50));}return _0x3a8915;};var getChanSpyApplications=function(_0x300456,_0x321e91){var _0x592c2f=[];for(var _0x212798=0x0,_0x32ea59=0x1;_0x212798<_0x321e91['length'];_0x212798++,_0x32ea59=0x1){_0x592c2f=_0x592c2f[_0x9796('0x18')](getUserApplications(_0x300456,_0x321e91[_0x212798],_0x321e91[_0x212798][_0x9796('0x19')]));if(_0x321e91[_0x212798]['internal']!=_0x321e91[_0x212798][_0x9796('0x14')]){_0x592c2f=_0x592c2f[_0x9796('0x18')](getUserApplications(_0x300456,_0x321e91[_0x212798],_0x321e91[_0x212798][_0x9796('0x14')]));}}return _0x592c2f;};var getChanSpyPromise=function(_0x372d78,_0x3e5a4c){return new BPromise(function(_0x3de1f0,_0x3ffe0b){return _0x372d78[_0x9796('0x1a')][_0x9796('0x1b')]({'attributes':['id','name',_0x9796('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x9796('0x1c')](function(_0x520cd1){if(_0x520cd1){return _0x3de1f0(getChanSpyApplications(_0x3e5a4c,_0x520cd1));}return _0x3de1f0([]);})['catch'](function(_0xb4a1a3){_0x3ffe0b(_0xb4a1a3);});});};module[_0x9796('0x1d')]=function(_0xa4b455,_0x642921){var _0x2aee8b=_0xa4b455[_0x9796('0x1e')];return _0xa4b455[_0x9796('0x1f')](_0x9796('0x20'),attributes,{'tableName':_0x9796('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bc4d5,_0x49a407,_0x478416){return getChanSpyPromise(_0x2aee8b,_0x3bc4d5)['then'](function(_0x3c140f){if(_0x3c140f&&_0x3c140f['length']){return _0x2aee8b['VoiceExtension'][_0x9796('0x22')](_0x3c140f);}})[_0x9796('0x1c')](function(){_0x478416();})[_0x9796('0x23')](function(_0x240240){_0x478416(_0x240240);});},'afterUpdate':function(_0x3d5e2e,_0xef7cd5,_0x180ff6){return _0x2aee8b['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3d5e2e['id']}})[_0x9796('0x1c')](function(){return getChanSpyPromise(_0x2aee8b,_0x3d5e2e);})['then'](function(_0x15da4a){if(_0x15da4a&&_0x15da4a['length']){return _0x2aee8b[_0x9796('0x24')][_0x9796('0x22')](_0x15da4a);}})[_0x9796('0x1c')](function(){_0x180ff6();})[_0x9796('0x23')](function(_0x4fa687){_0x180ff6(_0x4fa687);});},'afterDestroy':function(_0x48c0d3,_0x40a1de,_0x5108c0){return _0x2aee8b[_0x9796('0x24')]['destroy']({'where':{'ChanSpyId':_0x48c0d3['id']}})['then'](function(){_0x5108c0();})[_0x9796('0x23')](function(_0x14cab6){_0x5108c0(_0x14cab6);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f3a4bab..d0b2ccc 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 _0xac55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x14652e,_0x59fb87){var _0x1e3b87=function(_0x3942f2){while(--_0x3942f2){_0x14652e['push'](_0x14652e['shift']());}};_0x1e3b87(++_0x59fb87);}(_0xac55,0x1c8));var _0x5ac5=function(_0x4a30a4,_0x4cd2c2){_0x4a30a4=_0x4a30a4-0x0;var _0x144236=_0xac55[_0x4a30a4];return _0x144236;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});} \ No newline at end of file +var _0xb903=['http','request','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xacd29e,_0x26b88f){var _0x383d2b=function(_0x5ba5a0){while(--_0x5ba5a0){_0xacd29e['push'](_0xacd29e['shift']());}};_0x383d2b(++_0x26b88f);}(_0xb903,0x185));var _0x3b90=function(_0x27a98b,_0x252ee5){_0x27a98b=_0x27a98b-0x0;var _0x555ca8=_0xb903[_0x27a98b];return _0x555ca8;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2c7db76..6f95762 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 _0xbb96=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x39acdc,_0x48ae0f){var _0x44e5d4=function(_0x53f149){while(--_0x53f149){_0x39acdc['push'](_0x39acdc['shift']());}};_0x44e5d4(++_0x48ae0f);}(_0xbb96,0x18b));var _0x6bb9=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xbb96[_0x1a87b3];return _0x37e84d;};'use strict';var multer=require('multer');var util=require(_0x6bb9('0x0'));var path=require(_0x6bb9('0x1'));var timeout=require(_0x6bb9('0x2'));var express=require('express');var router=express[_0x6bb9('0x3')]();var fs_extra=require(_0x6bb9('0x4'));var auth=require(_0x6bb9('0x5'));var interaction=require(_0x6bb9('0x6'));var config=require(_0x6bb9('0x7'));var controller=require(_0x6bb9('0x8'));router[_0x6bb9('0x9')]('/',auth['isAuthenticated'](),controller[_0x6bb9('0xa')]);router[_0x6bb9('0x9')](_0x6bb9('0xb'),auth[_0x6bb9('0xc')](),controller[_0x6bb9('0xd')]);router[_0x6bb9('0xe')]('/',auth[_0x6bb9('0xc')](),controller[_0x6bb9('0xf')]);router['put'](_0x6bb9('0xb'),auth[_0x6bb9('0xc')](),controller[_0x6bb9('0x10')]);router[_0x6bb9('0x11')](_0x6bb9('0xb'),auth[_0x6bb9('0xc')](),controller['destroy']);module[_0x6bb9('0x12')]=router; \ No newline at end of file +var _0xa048=['isAuthenticated','show','post','put','/:id','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xa048,0x80));var _0x8a04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa048[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8a04('0x0'));var timeout=require(_0x8a04('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a04('0x2'));var auth=require(_0x8a04('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8a04('0x4'));var controller=require('./voiceContext.controller');router[_0x8a04('0x5')]('/',auth['isAuthenticated'](),controller[_0x8a04('0x6')]);router[_0x8a04('0x5')]('/:id',auth[_0x8a04('0x7')](),controller[_0x8a04('0x8')]);router[_0x8a04('0x9')]('/',auth[_0x8a04('0x7')](),controller['create']);router[_0x8a04('0xa')](_0x8a04('0xb'),auth['isAuthenticated'](),controller[_0x8a04('0xc')]);router[_0x8a04('0xd')](_0x8a04('0xb'),auth['isAuthenticated'](),controller[_0x8a04('0xe')]);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 fbbad8e..eb7310d 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 _0x4756=['STRING','BOOLEAN','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4756,0x1ee));var _0x6475=function(_0x2c4049,_0x45dd95){_0x2c4049=_0x2c4049-0x0;var _0x24c488=_0x4756[_0x2c4049];return _0x24c488;};'use strict';var Sequelize=require(_0x6475('0x0'));module[_0x6475('0x1')]={'name':{'type':Sequelize[_0x6475('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x6475('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6475('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4133=['STRING','BOOLEAN','sequelize','name'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0x4133,0x17a));var _0x3413=function(_0x4f6ab6,_0x53fa95){_0x4f6ab6=_0x4f6ab6-0x0;var _0x5e2fa4=_0x4133[_0x4f6ab6];return _0x5e2fa4;};'use strict';var Sequelize=require(_0x3413('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3413('0x1')},'description':{'type':Sequelize[_0x3413('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3413('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 1297fca..90453ba 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 _0xd8a5=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','stack','name','VoiceContext','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','join','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','render','writeFileSync','chan_sip.so','readFileSync','root','eml-format'];(function(_0x39c442,_0x3fce7e){var _0x33f536=function(_0x100028){while(--_0x100028){_0x39c442['push'](_0x39c442['shift']());}};_0x33f536(++_0x3fce7e);}(_0xd8a5,0x134));var _0x5d8a=function(_0x316e89,_0x585284){_0x316e89=_0x316e89-0x0;var _0x7e31d6=_0xd8a5[_0x316e89];return _0x7e31d6;};'use strict';var emlformat=require(_0x5d8a('0x0'));var rimraf=require(_0x5d8a('0x1'));var zipdir=require(_0x5d8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d8a('0x3'));var moment=require(_0x5d8a('0x4'));var BPromise=require(_0x5d8a('0x5'));var Mustache=require(_0x5d8a('0x6'));var util=require(_0x5d8a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5d8a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d8a('0x9'));var _=require(_0x5d8a('0xa'));var squel=require(_0x5d8a('0xb'));var crypto=require(_0x5d8a('0xc'));var jsforce=require(_0x5d8a('0xd'));var deskjs=require(_0x5d8a('0xe'));var toCsv=require(_0x5d8a('0x8'));var querystring=require('querystring');var Papa=require(_0x5d8a('0xf'));var Redis=require(_0x5d8a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5d8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d8a('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5d8a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d8a('0x14'))['db'];var jayson=require(_0x5d8a('0x15'));var client=jayson[_0x5d8a('0x16')][_0x5d8a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x111b35,_0x1ab725,_0x13af77,_0x3e17f5){return new BPromise(function(_0x4bd9b0,_0x19f6d9){var _0x7b55e6=_0x3e17f5||client;return _0x7b55e6[_0x5d8a('0x18')](_0x111b35,_0x13af77)['then'](function(_0xa42185){logger[_0x5d8a('0x19')](_0x5d8a('0x1a'),_0x1ab725,_0x5d8a('0x1b'));logger[_0x5d8a('0x1c')](_0x5d8a('0x1d'),_0x1ab725,_0x5d8a('0x1b'),JSON[_0x5d8a('0x1e')](_0xa42185));if(_0xa42185[_0x5d8a('0x1f')]){if(_0xa42185[_0x5d8a('0x1f')][_0x5d8a('0x20')]===0x1f4){logger[_0x5d8a('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x1ab725,_0xa42185[_0x5d8a('0x1f')][_0x5d8a('0x21')]);return _0x19f6d9(_0xa42185[_0x5d8a('0x1f')][_0x5d8a('0x21')]);}logger['error'](_0x5d8a('0x1a'),_0x1ab725,_0xa42185[_0x5d8a('0x1f')]['message']);return _0x4bd9b0(_0xa42185[_0x5d8a('0x1f')][_0x5d8a('0x21')]);}else{logger[_0x5d8a('0x19')](_0x5d8a('0x1a'),_0x1ab725,_0x5d8a('0x1b'));_0x4bd9b0(_0xa42185[_0x5d8a('0x22')][_0x5d8a('0x21')]);}})[_0x5d8a('0x23')](function(_0xdb71b){logger[_0x5d8a('0x1f')](_0x5d8a('0x1a'),_0x1ab725,_0xdb71b);_0x19f6d9(_0xdb71b);});});}function respondWithStatusCode(_0x49dde8,_0x3ae9fc){_0x3ae9fc=_0x3ae9fc||0xcc;return function(_0x3ff630){if(_0x3ff630){return _0x49dde8[_0x5d8a('0x24')](_0x3ae9fc);}return _0x49dde8[_0x5d8a('0x25')](_0x3ae9fc)[_0x5d8a('0x26')]();};}function respondWithResult(_0x3a1599,_0x9ff11f){_0x9ff11f=_0x9ff11f||0xc8;return function(_0x3f0a88){if(_0x3f0a88){return _0x3a1599['status'](_0x9ff11f)['json'](_0x3f0a88);}};}function respondWithFilteredResult(_0x6d731b,_0x52942d){return function(_0x483f5a){if(_0x483f5a){var _0x5c81e=typeof _0x52942d[_0x5d8a('0x27')]===_0x5d8a('0x28')&&typeof _0x52942d[_0x5d8a('0x29')]===_0x5d8a('0x28');var _0x132689=_0x483f5a[_0x5d8a('0x2a')];var _0x40d0c3=_0x5c81e?0x0:_0x52942d[_0x5d8a('0x27')];var _0x5ac5d0=_0x5c81e?_0x483f5a[_0x5d8a('0x2a')]:_0x52942d[_0x5d8a('0x27')]+_0x52942d[_0x5d8a('0x29')];var _0x150c55;if(_0x5ac5d0>=_0x132689){_0x5ac5d0=_0x132689;_0x150c55=0xc8;}else{_0x150c55=0xce;}_0x6d731b['status'](_0x150c55);return _0x6d731b[_0x5d8a('0x2b')](_0x5d8a('0x2c'),_0x40d0c3+'-'+_0x5ac5d0+'/'+_0x132689)[_0x5d8a('0x2d')](_0x483f5a);}return null;};}function patchUpdates(_0x1b2772){return function(_0xa015fb){try{jsonpatch[_0x5d8a('0x2e')](_0xa015fb,_0x1b2772,!![]);}catch(_0x5aa3c0){return BPromise[_0x5d8a('0x2f')](_0x5aa3c0);}return _0xa015fb[_0x5d8a('0x30')]();};}function saveUpdates(_0x115e72,_0x4bfcb3){return function(_0x3a12b2){if(_0x3a12b2){return _0x3a12b2[_0x5d8a('0x31')](_0x115e72)[_0x5d8a('0x32')](function(_0x5412b9){return _0x5412b9;});}return null;};}function removeEntity(_0x3d996d,_0x479b19){return function(_0x1daf7b){if(_0x1daf7b){return _0x1daf7b[_0x5d8a('0x33')]()[_0x5d8a('0x32')](function(){var _0x164e33=_0x1daf7b[_0x5d8a('0x34')]({'plain':!![]});var _0x1fe6ed=_0x5d8a('0x35');return db[_0x5d8a('0x36')][_0x5d8a('0x33')]({'where':{'type':_0x1fe6ed,'resourceId':_0x164e33['id']}})[_0x5d8a('0x32')](function(){return _0x1daf7b;});})[_0x5d8a('0x32')](function(){_0x3d996d[_0x5d8a('0x25')](0xcc)[_0x5d8a('0x26')]();});}};}function handleEntityNotFound(_0x268d9f,_0x4af78e){return function(_0x3a662d){if(!_0x3a662d){_0x268d9f[_0x5d8a('0x24')](0x194);}return _0x3a662d;};}function handleError(_0x10a9c5,_0xb976e7){_0xb976e7=_0xb976e7||0x1f4;return function(_0x3669a3){logger[_0x5d8a('0x1f')](_0x3669a3[_0x5d8a('0x37')]);if(_0x3669a3[_0x5d8a('0x38')]){delete _0x3669a3['name'];}_0x10a9c5[_0x5d8a('0x25')](_0xb976e7)['send'](_0x3669a3);};}exports['index']=function(_0x5c6bee,_0x101eee){var _0x9db8cb={},_0x2d2f5f={},_0x354921={'count':0x0,'rows':[]};var _0x4ecf10=_['map'](db[_0x5d8a('0x39')]['rawAttributes'],function(_0x340ba2){return{'name':_0x340ba2[_0x5d8a('0x3a')],'type':_0x340ba2['type']['key']};});_0x2d2f5f[_0x5d8a('0x3b')]=_[_0x5d8a('0x3c')](_0x4ecf10,_0x5d8a('0x38'));_0x2d2f5f[_0x5d8a('0x3d')]=_[_0x5d8a('0x3e')](_0x5c6bee[_0x5d8a('0x3d')]);_0x2d2f5f[_0x5d8a('0x3f')]=_['intersection'](_0x2d2f5f[_0x5d8a('0x3b')],_0x2d2f5f['query']);_0x9db8cb[_0x5d8a('0x40')]=_[_0x5d8a('0x41')](_0x2d2f5f['model'],qs[_0x5d8a('0x42')](_0x5c6bee['query'][_0x5d8a('0x42')]));_0x9db8cb[_0x5d8a('0x40')]=_0x9db8cb[_0x5d8a('0x40')][_0x5d8a('0x43')]?_0x9db8cb[_0x5d8a('0x40')]:_0x2d2f5f[_0x5d8a('0x3b')];if(!_0x5c6bee[_0x5d8a('0x3d')][_0x5d8a('0x44')](_0x5d8a('0x45'))){_0x9db8cb['limit']=qs['limit'](_0x5c6bee[_0x5d8a('0x3d')][_0x5d8a('0x29')]);_0x9db8cb['offset']=qs[_0x5d8a('0x27')](_0x5c6bee[_0x5d8a('0x3d')]['offset']);}_0x9db8cb[_0x5d8a('0x46')]=qs[_0x5d8a('0x47')](_0x5c6bee[_0x5d8a('0x3d')][_0x5d8a('0x47')]);_0x9db8cb[_0x5d8a('0x48')]=qs[_0x5d8a('0x3f')](_['pick'](_0x5c6bee[_0x5d8a('0x3d')],_0x2d2f5f[_0x5d8a('0x3f')]),_0x4ecf10);if(_0x5c6bee[_0x5d8a('0x3d')][_0x5d8a('0x49')]){_0x9db8cb[_0x5d8a('0x48')]=_['merge'](_0x9db8cb[_0x5d8a('0x48')],{'$or':_['map'](_0x4ecf10,function(_0x3ab616){if(_0x3ab616[_0x5d8a('0x4a')]!=='VIRTUAL'){var _0x1574f2={};_0x1574f2[_0x3ab616[_0x5d8a('0x38')]]={'$like':'%'+_0x5c6bee[_0x5d8a('0x3d')]['filter']+'%'};return _0x1574f2;}})});}_0x9db8cb=_[_0x5d8a('0x4b')]({},_0x9db8cb,_0x5c6bee[_0x5d8a('0x4c')]);var _0x31bb03={'where':_0x9db8cb[_0x5d8a('0x48')]};return db[_0x5d8a('0x39')]['count'](_0x31bb03)[_0x5d8a('0x32')](function(_0x515381){_0x354921[_0x5d8a('0x2a')]=_0x515381;if(_0x5c6bee[_0x5d8a('0x3d')][_0x5d8a('0x4d')]){_0x9db8cb['include']=[{'all':!![]}];}return db[_0x5d8a('0x39')][_0x5d8a('0x4e')](_0x9db8cb);})[_0x5d8a('0x32')](function(_0xc92774){_0x354921[_0x5d8a('0x4f')]=_0xc92774;return _0x354921;})[_0x5d8a('0x32')](respondWithFilteredResult(_0x101eee,_0x9db8cb))['catch'](handleError(_0x101eee,null));};exports[_0x5d8a('0x50')]=function(_0x32cd89,_0xc89673){var _0x2cf81c={'raw':![],'where':{'id':_0x32cd89[_0x5d8a('0x51')]['id']}},_0x4eaa28={};_0x4eaa28[_0x5d8a('0x3b')]=_['keys'](db['VoiceContext'][_0x5d8a('0x52')]);_0x4eaa28[_0x5d8a('0x3d')]=_[_0x5d8a('0x3e')](_0x32cd89[_0x5d8a('0x3d')]);_0x4eaa28['filters']=_[_0x5d8a('0x41')](_0x4eaa28[_0x5d8a('0x3b')],_0x4eaa28[_0x5d8a('0x3d')]);_0x2cf81c[_0x5d8a('0x40')]=_[_0x5d8a('0x41')](_0x4eaa28['model'],qs[_0x5d8a('0x42')](_0x32cd89[_0x5d8a('0x3d')]['fields']));_0x2cf81c['attributes']=_0x2cf81c[_0x5d8a('0x40')][_0x5d8a('0x43')]?_0x2cf81c[_0x5d8a('0x40')]:_0x4eaa28['model'];if(_0x32cd89[_0x5d8a('0x3d')][_0x5d8a('0x4d')]){_0x2cf81c[_0x5d8a('0x53')]=[{'all':!![]}];}_0x2cf81c=_[_0x5d8a('0x4b')]({},_0x2cf81c,_0x32cd89['options']);return db[_0x5d8a('0x39')][_0x5d8a('0x54')](_0x2cf81c)['then'](handleEntityNotFound(_0xc89673,null))['then'](respondWithResult(_0xc89673,null))[_0x5d8a('0x23')](handleError(_0xc89673,null));};exports[_0x5d8a('0x55')]=function(_0x5e1808,_0x41242a,_0x7308f3){var _0x3d55de;return db[_0x5d8a('0x39')][_0x5d8a('0x55')](_0x5e1808[_0x5d8a('0x56')],{'raw':!![]})[_0x5d8a('0x32')](function(_0x2318fd){_0x3d55de=_0x2318fd;return db[_0x5d8a('0x39')]['findAll']({'raw':!![]});})[_0x5d8a('0x32')](function(_0x3cbfa6){var _0x5e3495=fs['readFileSync'](path[_0x5d8a('0x57')](config['root'],'server/files/templates/context.ejs'),_0x5d8a('0x58'));var _0x56aaa6=ejs['render'](_0x5e3495,{'contexts':_0x3cbfa6||[]});fs['writeFileSync'](_0x5d8a('0x59'),_0x56aaa6);})['then'](function(){return respondWithRpcPromise(_0x5d8a('0x5a'),_0x5d8a('0x55'),{'module':'chan_sip.so'});})[_0x5d8a('0x32')](function(){var _0x445d98=_0x5e1808[_0x5d8a('0x5b')][_0x5d8a('0x34')]({'plain':!![]});if(!_0x445d98)throw new Error(_0x5d8a('0x5c'));if(_0x445d98[_0x5d8a('0x5d')]===_0x5d8a('0x5b')){var _0x43e4c5=_0x3d55de['get']({'plain':!![]});return db['UserProfileSection'][_0x5d8a('0x54')]({'where':{'name':_0x5d8a('0x35'),'userProfileId':_0x445d98[_0x5d8a('0x5e')]},'raw':!![]})['then'](function(_0x984028){if(_0x984028&&_0x984028[_0x5d8a('0x5f')]===0x0){return db[_0x5d8a('0x36')][_0x5d8a('0x55')]({'name':_0x43e4c5[_0x5d8a('0x38')],'resourceId':_0x43e4c5['id'],'type':_0x984028[_0x5d8a('0x38')],'sectionId':_0x984028['id']},{})[_0x5d8a('0x32')](function(){return _0x3d55de;});}else{return _0x3d55de;}})[_0x5d8a('0x23')](function(_0x3edc66){logger[_0x5d8a('0x1f')](_0x5d8a('0x60'),_0x3edc66);throw _0x3edc66;});}return _0x3d55de;})[_0x5d8a('0x32')](respondWithResult(_0x41242a,0xc9))['catch'](handleError(_0x41242a,null));};exports[_0x5d8a('0x31')]=function(_0x43ec68,_0x1a67c0,_0x23e16f){var _0x4e056d;return db['VoiceContext'][_0x5d8a('0x54')]({'where':{'id':_0x43ec68['params']['id']}})[_0x5d8a('0x32')](handleEntityNotFound(_0x1a67c0,null))['then'](saveUpdates(_0x43ec68[_0x5d8a('0x56')],null))['then'](function(_0x56ae3d){if(_0x56ae3d){_0x4e056d=_0x56ae3d;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x5d8a('0x32')](function(_0xd7f67){var _0x111a1c=fs['readFileSync'](path['join'](config['root'],_0x5d8a('0x61')),_0x5d8a('0x58'));var _0x3dd166=ejs[_0x5d8a('0x62')](_0x111a1c,{'contexts':_0xd7f67||[]});fs[_0x5d8a('0x63')](_0x5d8a('0x59'),_0x3dd166);})[_0x5d8a('0x32')](function(){return respondWithRpcPromise(_0x5d8a('0x5a'),_0x5d8a('0x31'),{'module':_0x5d8a('0x64')});})[_0x5d8a('0x32')](function(){return _0x4e056d;})[_0x5d8a('0x32')](respondWithResult(_0x1a67c0,null))[_0x5d8a('0x23')](handleError(_0x1a67c0,null));};exports['destroy']=function(_0x1b6672,_0x8ed41d,_0x1f96a5){var _0x54f20c;return db[_0x5d8a('0x39')][_0x5d8a('0x54')]({'where':{'id':_0x1b6672['params']['id']}})[_0x5d8a('0x32')](handleEntityNotFound(_0x8ed41d,null))[_0x5d8a('0x32')](removeEntity(_0x8ed41d,null))['then'](function(){return db[_0x5d8a('0x39')][_0x5d8a('0x4e')]({'raw':!![]});})[_0x5d8a('0x32')](function(_0x5afbff){var _0x437150=fs[_0x5d8a('0x65')](path[_0x5d8a('0x57')](config[_0x5d8a('0x66')],_0x5d8a('0x61')),'utf8');var _0x5781a7=ejs[_0x5d8a('0x62')](_0x437150,{'contexts':_0x5afbff});fs[_0x5d8a('0x63')](_0x5d8a('0x59'),_0x5781a7);return respondWithRpcPromise('Reload',_0x5d8a('0x33'),{'module':_0x5d8a('0x64')});})[_0x5d8a('0x23')](handleError(_0x8ed41d,null));}; \ No newline at end of file +var _0x9da3=['VoiceContext','includeAll','include','rows','params','find','create','findAll','join','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','utf8','chan_sip.so','readFileSync','render','writeFileSync','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9da3,0x1d9));var _0x39da=function(_0x22ba83,_0x44d69c){_0x22ba83=_0x22ba83-0x0;var _0x58d097=_0x9da3[_0x22ba83];return _0x58d097;};'use strict';var emlformat=require(_0x39da('0x0'));var rimraf=require(_0x39da('0x1'));var zipdir=require(_0x39da('0x2'));var jsonpatch=require(_0x39da('0x3'));var rp=require('request-promise');var moment=require(_0x39da('0x4'));var BPromise=require(_0x39da('0x5'));var Mustache=require(_0x39da('0x6'));var util=require(_0x39da('0x7'));var path=require(_0x39da('0x8'));var sox=require(_0x39da('0x9'));var csv=require(_0x39da('0xa'));var ejs=require(_0x39da('0xb'));var fs=require('fs');var fs_extra=require(_0x39da('0xc'));var _=require(_0x39da('0xd'));var squel=require(_0x39da('0xe'));var crypto=require(_0x39da('0xf'));var jsforce=require(_0x39da('0x10'));var deskjs=require(_0x39da('0x11'));var toCsv=require('to-csv');var querystring=require(_0x39da('0x12'));var Papa=require(_0x39da('0x13'));var Redis=require(_0x39da('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x39da('0x15'));var as=require(_0x39da('0x16'));var hardwareService=require(_0x39da('0x17'));var logger=require(_0x39da('0x18'))(_0x39da('0x19'));var utils=require(_0x39da('0x1a'));var config=require(_0x39da('0x1b'));var licenseUtil=require(_0x39da('0x1c'));var db=require(_0x39da('0x1d'))['db'];var jayson=require(_0x39da('0x1e'));var client=jayson[_0x39da('0x1f')][_0x39da('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1b9f66,_0x51efe9,_0x44b089,_0x5ed915){return new BPromise(function(_0x5a5d56,_0x540db9){var _0x19a650=_0x5ed915||client;return _0x19a650[_0x39da('0x21')](_0x1b9f66,_0x44b089)[_0x39da('0x22')](function(_0x2d4d5c){logger[_0x39da('0x23')](_0x39da('0x24'),_0x51efe9,_0x39da('0x25'));logger[_0x39da('0x26')](_0x39da('0x27'),_0x51efe9,_0x39da('0x25'),JSON[_0x39da('0x28')](_0x2d4d5c));if(_0x2d4d5c[_0x39da('0x29')]){if(_0x2d4d5c[_0x39da('0x29')][_0x39da('0x2a')]===0x1f4){logger[_0x39da('0x29')](_0x39da('0x24'),_0x51efe9,_0x2d4d5c[_0x39da('0x29')]['message']);return _0x540db9(_0x2d4d5c[_0x39da('0x29')][_0x39da('0x2b')]);}logger['error'](_0x39da('0x24'),_0x51efe9,_0x2d4d5c['error']['message']);return _0x5a5d56(_0x2d4d5c[_0x39da('0x29')][_0x39da('0x2b')]);}else{logger['info'](_0x39da('0x24'),_0x51efe9,_0x39da('0x25'));_0x5a5d56(_0x2d4d5c['result'][_0x39da('0x2b')]);}})[_0x39da('0x2c')](function(_0x470428){logger[_0x39da('0x29')](_0x39da('0x24'),_0x51efe9,_0x470428);_0x540db9(_0x470428);});});}function respondWithStatusCode(_0x2a5416,_0x52e79e){_0x52e79e=_0x52e79e||0xcc;return function(_0xe992e6){if(_0xe992e6){return _0x2a5416[_0x39da('0x2d')](_0x52e79e);}return _0x2a5416['status'](_0x52e79e)[_0x39da('0x2e')]();};}function respondWithResult(_0x16e7fd,_0x10b27f){_0x10b27f=_0x10b27f||0xc8;return function(_0x4fec24){if(_0x4fec24){return _0x16e7fd[_0x39da('0x2f')](_0x10b27f)[_0x39da('0x30')](_0x4fec24);}};}function respondWithFilteredResult(_0x5eb6de,_0x3d925d){return function(_0x1e33f5){if(_0x1e33f5){var _0x309298=typeof _0x3d925d[_0x39da('0x31')]===_0x39da('0x32')&&typeof _0x3d925d[_0x39da('0x33')]==='undefined';var _0x2c6360=_0x1e33f5[_0x39da('0x34')];var _0x296dd6=_0x309298?0x0:_0x3d925d[_0x39da('0x31')];var _0x563937=_0x309298?_0x1e33f5['count']:_0x3d925d['offset']+_0x3d925d[_0x39da('0x33')];var _0xa9e6aa;if(_0x563937>=_0x2c6360){_0x563937=_0x2c6360;_0xa9e6aa=0xc8;}else{_0xa9e6aa=0xce;}_0x5eb6de[_0x39da('0x2f')](_0xa9e6aa);return _0x5eb6de[_0x39da('0x35')](_0x39da('0x36'),_0x296dd6+'-'+_0x563937+'/'+_0x2c6360)['json'](_0x1e33f5);}return null;};}function patchUpdates(_0x5b25f9){return function(_0x15fe3d){try{jsonpatch[_0x39da('0x37')](_0x15fe3d,_0x5b25f9,!![]);}catch(_0x23e2b2){return BPromise[_0x39da('0x38')](_0x23e2b2);}return _0x15fe3d['save']();};}function saveUpdates(_0x5e2815,_0x402c7b){return function(_0xecfaaa){if(_0xecfaaa){return _0xecfaaa[_0x39da('0x39')](_0x5e2815)['then'](function(_0xa9274f){return _0xa9274f;});}return null;};}function removeEntity(_0xf36f0d,_0xf4ece7){return function(_0x143a3c){if(_0x143a3c){return _0x143a3c[_0x39da('0x3a')]()[_0x39da('0x22')](function(){var _0x1239b2=_0x143a3c[_0x39da('0x3b')]({'plain':!![]});var _0x4e0e1a=_0x39da('0x3c');return db[_0x39da('0x3d')][_0x39da('0x3a')]({'where':{'type':_0x4e0e1a,'resourceId':_0x1239b2['id']}})[_0x39da('0x22')](function(){return _0x143a3c;});})[_0x39da('0x22')](function(){_0xf36f0d[_0x39da('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156f48,_0x3b20bb){return function(_0x37b612){if(!_0x37b612){_0x156f48['sendStatus'](0x194);}return _0x37b612;};}function handleError(_0x160958,_0xed81a3){_0xed81a3=_0xed81a3||0x1f4;return function(_0x134999){logger[_0x39da('0x29')](_0x134999[_0x39da('0x3e')]);if(_0x134999[_0x39da('0x3f')]){delete _0x134999[_0x39da('0x3f')];}_0x160958['status'](_0xed81a3)[_0x39da('0x40')](_0x134999);};}exports[_0x39da('0x41')]=function(_0x2943d6,_0x4ce09b){var _0x1bae1e={},_0x58db47={},_0x39aafc={'count':0x0,'rows':[]};var _0x242461=_[_0x39da('0x42')](db['VoiceContext'][_0x39da('0x43')],function(_0x469d54){return{'name':_0x469d54['fieldName'],'type':_0x469d54[_0x39da('0x44')]['key']};});_0x58db47[_0x39da('0x45')]=_[_0x39da('0x42')](_0x242461,_0x39da('0x3f'));_0x58db47[_0x39da('0x46')]=_[_0x39da('0x47')](_0x2943d6['query']);_0x58db47[_0x39da('0x48')]=_[_0x39da('0x49')](_0x58db47[_0x39da('0x45')],_0x58db47[_0x39da('0x46')]);_0x1bae1e['attributes']=_[_0x39da('0x49')](_0x58db47[_0x39da('0x45')],qs[_0x39da('0x4a')](_0x2943d6[_0x39da('0x46')][_0x39da('0x4a')]));_0x1bae1e['attributes']=_0x1bae1e[_0x39da('0x4b')][_0x39da('0x4c')]?_0x1bae1e[_0x39da('0x4b')]:_0x58db47[_0x39da('0x45')];if(!_0x2943d6[_0x39da('0x46')][_0x39da('0x4d')](_0x39da('0x4e'))){_0x1bae1e[_0x39da('0x33')]=qs['limit'](_0x2943d6[_0x39da('0x46')][_0x39da('0x33')]);_0x1bae1e[_0x39da('0x31')]=qs[_0x39da('0x31')](_0x2943d6[_0x39da('0x46')]['offset']);}_0x1bae1e[_0x39da('0x4f')]=qs['sort'](_0x2943d6['query'][_0x39da('0x50')]);_0x1bae1e[_0x39da('0x51')]=qs[_0x39da('0x48')](_[_0x39da('0x52')](_0x2943d6[_0x39da('0x46')],_0x58db47['filters']),_0x242461);if(_0x2943d6[_0x39da('0x46')][_0x39da('0x53')]){_0x1bae1e[_0x39da('0x51')]=_[_0x39da('0x54')](_0x1bae1e[_0x39da('0x51')],{'$or':_['map'](_0x242461,function(_0x191c77){if(_0x191c77[_0x39da('0x44')]!==_0x39da('0x55')){var _0x10e4b5={};_0x10e4b5[_0x191c77[_0x39da('0x3f')]]={'$like':'%'+_0x2943d6[_0x39da('0x46')][_0x39da('0x53')]+'%'};return _0x10e4b5;}})});}_0x1bae1e=_[_0x39da('0x54')]({},_0x1bae1e,_0x2943d6[_0x39da('0x56')]);var _0x285dac={'where':_0x1bae1e[_0x39da('0x51')]};return db[_0x39da('0x57')][_0x39da('0x34')](_0x285dac)[_0x39da('0x22')](function(_0xabc13e){_0x39aafc['count']=_0xabc13e;if(_0x2943d6[_0x39da('0x46')][_0x39da('0x58')]){_0x1bae1e[_0x39da('0x59')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1bae1e);})[_0x39da('0x22')](function(_0x4f1ade){_0x39aafc[_0x39da('0x5a')]=_0x4f1ade;return _0x39aafc;})[_0x39da('0x22')](respondWithFilteredResult(_0x4ce09b,_0x1bae1e))[_0x39da('0x2c')](handleError(_0x4ce09b,null));};exports['show']=function(_0x55205b,_0x1f8ef7){var _0x2cac2b={'raw':![],'where':{'id':_0x55205b[_0x39da('0x5b')]['id']}},_0x3ee761={};_0x3ee761[_0x39da('0x45')]=_[_0x39da('0x47')](db[_0x39da('0x57')][_0x39da('0x43')]);_0x3ee761[_0x39da('0x46')]=_[_0x39da('0x47')](_0x55205b[_0x39da('0x46')]);_0x3ee761[_0x39da('0x48')]=_[_0x39da('0x49')](_0x3ee761[_0x39da('0x45')],_0x3ee761[_0x39da('0x46')]);_0x2cac2b[_0x39da('0x4b')]=_[_0x39da('0x49')](_0x3ee761[_0x39da('0x45')],qs[_0x39da('0x4a')](_0x55205b[_0x39da('0x46')][_0x39da('0x4a')]));_0x2cac2b['attributes']=_0x2cac2b[_0x39da('0x4b')][_0x39da('0x4c')]?_0x2cac2b['attributes']:_0x3ee761['model'];if(_0x55205b[_0x39da('0x46')]['includeAll']){_0x2cac2b['include']=[{'all':!![]}];}_0x2cac2b=_['merge']({},_0x2cac2b,_0x55205b[_0x39da('0x56')]);return db['VoiceContext'][_0x39da('0x5c')](_0x2cac2b)['then'](handleEntityNotFound(_0x1f8ef7,null))['then'](respondWithResult(_0x1f8ef7,null))['catch'](handleError(_0x1f8ef7,null));};exports[_0x39da('0x5d')]=function(_0x44ee9f,_0x142fe4,_0x173efd){var _0x3dcb8e;return db['VoiceContext']['create'](_0x44ee9f['body'],{'raw':!![]})[_0x39da('0x22')](function(_0x2d49bb){_0x3dcb8e=_0x2d49bb;return db['VoiceContext'][_0x39da('0x5e')]({'raw':!![]});})[_0x39da('0x22')](function(_0x52dc39){var _0x3efb29=fs['readFileSync'](path[_0x39da('0x5f')](config[_0x39da('0x60')],_0x39da('0x61')),'utf8');var _0x1d3469=ejs['render'](_0x3efb29,{'contexts':_0x52dc39||[]});fs['writeFileSync'](_0x39da('0x62'),_0x1d3469);})[_0x39da('0x22')](function(){return respondWithRpcPromise(_0x39da('0x63'),_0x39da('0x5d'),{'module':'chan_sip.so'});})['then'](function(){var _0x4813df=_0x44ee9f['user'][_0x39da('0x3b')]({'plain':!![]});if(!_0x4813df)throw new Error(_0x39da('0x64'));if(_0x4813df[_0x39da('0x65')]==='user'){var _0x132af9=_0x3dcb8e['get']({'plain':!![]});return db[_0x39da('0x66')]['find']({'where':{'name':_0x39da('0x3c'),'userProfileId':_0x4813df[_0x39da('0x67')]},'raw':!![]})[_0x39da('0x22')](function(_0x56c177){if(_0x56c177&&_0x56c177[_0x39da('0x68')]===0x0){return db[_0x39da('0x3d')]['create']({'name':_0x132af9[_0x39da('0x3f')],'resourceId':_0x132af9['id'],'type':_0x56c177['name'],'sectionId':_0x56c177['id']},{})[_0x39da('0x22')](function(){return _0x3dcb8e;});}else{return _0x3dcb8e;}})[_0x39da('0x2c')](function(_0x176b85){logger[_0x39da('0x29')](_0x39da('0x69'),_0x176b85);throw _0x176b85;});}return _0x3dcb8e;})[_0x39da('0x22')](respondWithResult(_0x142fe4,0xc9))[_0x39da('0x2c')](handleError(_0x142fe4,null));};exports[_0x39da('0x39')]=function(_0x483801,_0x1c7daf,_0x497050){var _0x363290;return db['VoiceContext']['find']({'where':{'id':_0x483801[_0x39da('0x5b')]['id']}})[_0x39da('0x22')](handleEntityNotFound(_0x1c7daf,null))[_0x39da('0x22')](saveUpdates(_0x483801[_0x39da('0x6a')],null))[_0x39da('0x22')](function(_0x4a5752){if(_0x4a5752){_0x363290=_0x4a5752;return db[_0x39da('0x57')][_0x39da('0x5e')]({'raw':!![]});}})[_0x39da('0x22')](function(_0x2d39ab){var _0x360af2=fs['readFileSync'](path[_0x39da('0x5f')](config['root'],_0x39da('0x61')),_0x39da('0x6b'));var _0x40c770=ejs['render'](_0x360af2,{'contexts':_0x2d39ab||[]});fs['writeFileSync'](_0x39da('0x62'),_0x40c770);})[_0x39da('0x22')](function(){return respondWithRpcPromise(_0x39da('0x63'),_0x39da('0x39'),{'module':_0x39da('0x6c')});})[_0x39da('0x22')](function(){return _0x363290;})['then'](respondWithResult(_0x1c7daf,null))['catch'](handleError(_0x1c7daf,null));};exports['destroy']=function(_0xbd7119,_0x42764a,_0x32d56d){var _0x34489a;return db[_0x39da('0x57')][_0x39da('0x5c')]({'where':{'id':_0xbd7119['params']['id']}})['then'](handleEntityNotFound(_0x42764a,null))['then'](removeEntity(_0x42764a,null))[_0x39da('0x22')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x39da('0x22')](function(_0x2e8502){var _0x1cfb67=fs[_0x39da('0x6d')](path['join'](config['root'],'server/files/templates/context.ejs'),_0x39da('0x6b'));var _0x3598fd=ejs[_0x39da('0x6e')](_0x1cfb67,{'contexts':_0x2e8502});fs[_0x39da('0x6f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3598fd);return respondWithRpcPromise(_0x39da('0x63'),_0x39da('0x3a'),{'module':'chan_sip.so'});})[_0x39da('0x2c')](handleError(_0x42764a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c835eec..0992636 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 _0xcc99=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts'];(function(_0xd2feda,_0x1365b9){var _0x2b731d=function(_0x91c9e3){while(--_0x91c9e3){_0xd2feda['push'](_0xd2feda['shift']());}};_0x2b731d(++_0x1365b9);}(_0xcc99,0x168));var _0x9cc9=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xcc99[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x9cc9('0x0'));var util=require(_0x9cc9('0x1'));var logger=require('../../config/logger')(_0x9cc9('0x2'));var moment=require(_0x9cc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x9cc9('0x4'));var fs=require('fs');var path=require(_0x9cc9('0x5'));var rimraf=require(_0x9cc9('0x6'));var config=require(_0x9cc9('0x7'));var attributes=require('./voiceContext.attributes');module[_0x9cc9('0x8')]=function(_0xfab5aa,_0x22bbbd){return _0xfab5aa[_0x9cc9('0x9')](_0x9cc9('0xa'),attributes,{'tableName':_0x9cc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc195=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4fa11f,_0x542d37){var _0x4fb93f=function(_0x1e3f31){while(--_0x1e3f31){_0x4fa11f['push'](_0x4fa11f['shift']());}};_0x4fb93f(++_0x542d37);}(_0xc195,0x95));var _0x5c19=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc195[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x5c19('0x0'));var util=require(_0x5c19('0x1'));var logger=require(_0x5c19('0x2'))('api');var moment=require(_0x5c19('0x3'));var BPromise=require(_0x5c19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c19('0x5'));var rimraf=require(_0x5c19('0x6'));var config=require(_0x5c19('0x7'));var attributes=require(_0x5c19('0x8'));module[_0x5c19('0x9')]=function(_0x15860f,_0x5988fa){return _0x15860f[_0x5c19('0xa')](_0x5c19('0xb'),attributes,{'tableName':_0x5c19('0xc'),'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 9d689c9..978e5ea 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 _0x6599=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch'];(function(_0x50fa33,_0x4c8b90){var _0x36f5dc=function(_0x3664ea){while(--_0x3664ea){_0x50fa33['push'](_0x50fa33['shift']());}};_0x36f5dc(++_0x4c8b90);}(_0x6599,0xb0));var _0x9659=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x6599[_0x2468b5];return _0x1056e4;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});} \ No newline at end of file +var _0xa664=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x23bcd4,_0xd3deb0){var _0x4cb792=function(_0x48d4c8){while(--_0x48d4c8){_0x23bcd4['push'](_0x23bcd4['shift']());}};_0x4cb792(++_0xd3deb0);}(_0xa664,0x132));var _0x4a66=function(_0x20dbba,_0x5f43cf){_0x20dbba=_0x20dbba-0x0;var _0x24263a=_0xa664[_0x20dbba];return _0x24263a;};'use strict';var _=require('lodash');var util=require(_0x4a66('0x0'));var moment=require(_0x4a66('0x1'));var BPromise=require(_0x4a66('0x2'));var rs=require(_0x4a66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a66('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a66('0x5'));var config=require(_0x4a66('0x6'));var jayson=require(_0x4a66('0x7'));var client=jayson[_0x4a66('0x8')][_0x4a66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe28c,_0x358eb6,_0x521808){return new BPromise(function(_0x4484c5,_0x3d51bf){return client[_0x4a66('0xa')](_0x3fe28c,_0x521808)[_0x4a66('0xb')](function(_0x4a3c4c){logger[_0x4a66('0xc')](_0x4a66('0xd'),_0x358eb6,'request\x20sent');logger[_0x4a66('0xe')](_0x4a66('0xf'),_0x358eb6,_0x4a66('0x10'),JSON[_0x4a66('0x11')](_0x4a3c4c));if(_0x4a3c4c[_0x4a66('0x12')]){if(_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x13')]===0x1f4){logger[_0x4a66('0x12')](_0x4a66('0xd'),_0x358eb6,_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);return _0x3d51bf(_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);}logger[_0x4a66('0x12')](_0x4a66('0xd'),_0x358eb6,_0x4a3c4c[_0x4a66('0x12')][_0x4a66('0x14')]);return _0x4484c5(_0x4a3c4c['error'][_0x4a66('0x14')]);}else{logger[_0x4a66('0xc')](_0x4a66('0xd'),_0x358eb6,_0x4a66('0x10'));_0x4484c5(_0x4a3c4c[_0x4a66('0x15')][_0x4a66('0x14')]);}})[_0x4a66('0x16')](function(_0x20954d){logger['error'](_0x4a66('0xd'),_0x358eb6,_0x20954d);_0x3d51bf(_0x20954d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8dfc10c..9934cdf 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 _0x4e86=['../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x253889,_0x4d077f){var _0x3dd963=function(_0x252f06){while(--_0x252f06){_0x253889['push'](_0x253889['shift']());}};_0x3dd963(++_0x4d077f);}(_0x4e86,0xf1));var _0x64e8=function(_0x220f66,_0x32eb1){_0x220f66=_0x220f66-0x0;var _0x35b738=_0x4e86[_0x220f66];return _0x35b738;};'use strict';var multer=require(_0x64e8('0x0'));var util=require('util');var path=require(_0x64e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x64e8('0x2'));var router=express[_0x64e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x64e8('0x4'));var interaction=require(_0x64e8('0x5'));var config=require(_0x64e8('0x6'));var controller=require(_0x64e8('0x7'));router['get']('/',auth[_0x64e8('0x8')](),controller[_0x64e8('0x9')]);router[_0x64e8('0xa')](_0x64e8('0xb'),auth[_0x64e8('0x8')](),controller[_0x64e8('0xc')]);router[_0x64e8('0xa')](_0x64e8('0xd'),auth['isAuthenticated'](),controller[_0x64e8('0xe')]);router['post']('/',auth[_0x64e8('0x8')](),controller[_0x64e8('0xf')]);router[_0x64e8('0x10')](_0x64e8('0xd'),auth[_0x64e8('0x8')](),controller['update']);router[_0x64e8('0x11')](_0x64e8('0xd'),auth['isAuthenticated'](),controller[_0x64e8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x587a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x33ebc3,_0x23473f){var _0x207f3c=function(_0x2ab241){while(--_0x2ab241){_0x33ebc3['push'](_0x33ebc3['shift']());}};_0x207f3c(++_0x23473f);}(_0x587a,0x18b));var _0xa587=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x587a[_0x158e3b];return _0x551a1d;};'use strict';var multer=require(_0xa587('0x0'));var util=require(_0xa587('0x1'));var path=require(_0xa587('0x2'));var timeout=require(_0xa587('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa587('0x4'));var auth=require(_0xa587('0x5'));var interaction=require(_0xa587('0x6'));var config=require(_0xa587('0x7'));var controller=require('./voiceDialReport.controller');router[_0xa587('0x8')]('/',auth[_0xa587('0x9')](),controller[_0xa587('0xa')]);router[_0xa587('0x8')](_0xa587('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa587('0x8')](_0xa587('0xc'),auth[_0xa587('0x9')](),controller[_0xa587('0xd')]);router[_0xa587('0xe')]('/',auth[_0xa587('0x9')](),controller[_0xa587('0xf')]);router[_0xa587('0x10')](_0xa587('0xc'),auth[_0xa587('0x9')](),controller['update']);router[_0xa587('0x11')](_0xa587('0xc'),auth[_0xa587('0x9')](),controller[_0xa587('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8205a1a..d613fca 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 _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x1824c9,_0x475d83){var _0x3ad7e9=function(_0x346a23){while(--_0x346a23){_0x1824c9['push'](_0x1824c9['shift']());}};_0x3ad7e9(++_0x475d83);}(_0xb821,0xa7));var _0x1b82=function(_0x3fb60f,_0x25cbd9){_0x3fb60f=_0x3fb60f-0x0;var _0x3ea423=_0xb821[_0x3fb60f];return _0x3ea423;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x5df4a6,_0x5836b7){var _0x1cd85a=function(_0x2b3a86){while(--_0x2b3a86){_0x5df4a6['push'](_0x5df4a6['shift']());}};_0x1cd85a(++_0x5836b7);}(_0xbec5,0xe5));var _0x5bec=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xbec5[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c25240d..6bf7a3b 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 _0x434e=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','then','destroy','error','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','length','includeAll','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','querystring'];(function(_0x417c96,_0x446faa){var _0x24e353=function(_0x22c696){while(--_0x22c696){_0x417c96['push'](_0x417c96['shift']());}};_0x24e353(++_0x446faa);}(_0x434e,0xcf));var _0xe434=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x434e[_0x4629ee];return _0x47fb5b;};'use strict';var emlformat=require(_0xe434('0x0'));var rimraf=require(_0xe434('0x1'));var zipdir=require(_0xe434('0x2'));var jsonpatch=require(_0xe434('0x3'));var rp=require(_0xe434('0x4'));var moment=require(_0xe434('0x5'));var BPromise=require(_0xe434('0x6'));var Mustache=require('mustache');var util=require(_0xe434('0x7'));var path=require(_0xe434('0x8'));var sox=require(_0xe434('0x9'));var csv=require(_0xe434('0xa'));var ejs=require(_0xe434('0xb'));var fs=require('fs');var fs_extra=require(_0xe434('0xc'));var _=require('lodash');var squel=require(_0xe434('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe434('0xa'));var querystring=require(_0xe434('0xe'));var Papa=require(_0xe434('0xf'));var Redis=require('ioredis');var authService=require(_0xe434('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe434('0x11'));var hardwareService=require(_0xe434('0x12'));var logger=require(_0xe434('0x13'))(_0xe434('0x14'));var utils=require(_0xe434('0x15'));var config=require(_0xe434('0x16'));var licenseUtil=require(_0xe434('0x17'));var db=require(_0xe434('0x18'))['db'];function respondWithStatusCode(_0x48ec72,_0x3c12eb){_0x3c12eb=_0x3c12eb||0xcc;return function(_0xd770a7){if(_0xd770a7){return _0x48ec72[_0xe434('0x19')](_0x3c12eb);}return _0x48ec72['status'](_0x3c12eb)[_0xe434('0x1a')]();};}function respondWithResult(_0x2d47fb,_0x41266e){_0x41266e=_0x41266e||0xc8;return function(_0x1b9f18){if(_0x1b9f18){return _0x2d47fb[_0xe434('0x1b')](_0x41266e)['json'](_0x1b9f18);}};}function respondWithFilteredResult(_0x3b1754,_0x2142d7){return function(_0x4c8f91){if(_0x4c8f91){var _0x37e693=typeof _0x2142d7[_0xe434('0x1c')]===_0xe434('0x1d')&&typeof _0x2142d7[_0xe434('0x1e')]==='undefined';var _0x20a87f=_0x4c8f91[_0xe434('0x1f')];var _0x4b9664=_0x37e693?0x0:_0x2142d7[_0xe434('0x1c')];var _0x2876a0=_0x37e693?_0x4c8f91[_0xe434('0x1f')]:_0x2142d7['offset']+_0x2142d7[_0xe434('0x1e')];var _0x234ab1;if(_0x2876a0>=_0x20a87f){_0x2876a0=_0x20a87f;_0x234ab1=0xc8;}else{_0x234ab1=0xce;}_0x3b1754[_0xe434('0x1b')](_0x234ab1);return _0x3b1754['set']('Content-Range',_0x4b9664+'-'+_0x2876a0+'/'+_0x20a87f)[_0xe434('0x20')](_0x4c8f91);}return null;};}function patchUpdates(_0x5dfff7){return function(_0x3a5f6f){try{jsonpatch[_0xe434('0x21')](_0x3a5f6f,_0x5dfff7,!![]);}catch(_0x3b49df){return BPromise[_0xe434('0x22')](_0x3b49df);}return _0x3a5f6f[_0xe434('0x23')]();};}function saveUpdates(_0x37034f,_0x7ae0bb){return function(_0x438289){if(_0x438289){return _0x438289['update'](_0x37034f)[_0xe434('0x24')](function(_0x2e4763){return _0x2e4763;});}return null;};}function removeEntity(_0x5c2c31,_0x448385){return function(_0x48a8ca){if(_0x48a8ca){return _0x48a8ca[_0xe434('0x25')]()[_0xe434('0x24')](function(){_0x5c2c31[_0xe434('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511c5a,_0xe37895){return function(_0x39ad18){if(!_0x39ad18){_0x511c5a[_0xe434('0x19')](0x194);}return _0x39ad18;};}function handleError(_0x320aab,_0x166a6d){_0x166a6d=_0x166a6d||0x1f4;return function(_0x54bd87){logger[_0xe434('0x26')](_0x54bd87['stack']);if(_0x54bd87['name']){delete _0x54bd87['name'];}_0x320aab[_0xe434('0x1b')](_0x166a6d)[_0xe434('0x27')](_0x54bd87);};}exports[_0xe434('0x28')]=function(_0x501793,_0x428f0d){var _0x3efd51={},_0x147ba0={},_0x338e4e={'count':0x0,'rows':[]};var _0x1cb825=_['map'](db[_0xe434('0x29')][_0xe434('0x2a')],function(_0x19e7fe){return{'name':_0x19e7fe[_0xe434('0x2b')],'type':_0x19e7fe[_0xe434('0x2c')][_0xe434('0x2d')]};});_0x147ba0[_0xe434('0x2e')]=_['map'](_0x1cb825,_0xe434('0x2f'));_0x147ba0['query']=_[_0xe434('0x30')](_0x501793[_0xe434('0x31')]);_0x147ba0[_0xe434('0x32')]=_[_0xe434('0x33')](_0x147ba0['model'],_0x147ba0[_0xe434('0x31')]);_0x3efd51[_0xe434('0x34')]=_[_0xe434('0x33')](_0x147ba0['model'],qs[_0xe434('0x35')](_0x501793[_0xe434('0x31')][_0xe434('0x35')]));_0x3efd51[_0xe434('0x34')]=_0x3efd51['attributes']['length']?_0x3efd51[_0xe434('0x34')]:_0x147ba0[_0xe434('0x2e')];if(!_0x501793[_0xe434('0x31')][_0xe434('0x36')]('nolimit')){_0x3efd51[_0xe434('0x1e')]=qs[_0xe434('0x1e')](_0x501793['query']['limit']);_0x3efd51[_0xe434('0x1c')]=qs[_0xe434('0x1c')](_0x501793[_0xe434('0x31')]['offset']);}_0x3efd51[_0xe434('0x37')]=qs[_0xe434('0x38')](_0x501793['query'][_0xe434('0x38')]);_0x3efd51['where']=qs[_0xe434('0x32')](_['pick'](_0x501793[_0xe434('0x31')],_0x147ba0[_0xe434('0x32')]),_0x1cb825);if(_0x501793[_0xe434('0x31')]['filter']){_0x3efd51[_0xe434('0x39')]=_[_0xe434('0x3a')](_0x3efd51[_0xe434('0x39')],{'$or':_['map'](_0x1cb825,function(_0x936a4c){if(_0x936a4c[_0xe434('0x2c')]!==_0xe434('0x3b')){var _0x4295d6={};_0x4295d6[_0x936a4c[_0xe434('0x2f')]]={'$like':'%'+_0x501793[_0xe434('0x31')][_0xe434('0x3c')]+'%'};return _0x4295d6;}})});}_0x3efd51=_[_0xe434('0x3a')]({},_0x3efd51,_0x501793[_0xe434('0x3d')]);var _0x3546f1={'where':_0x3efd51[_0xe434('0x39')]};return db[_0xe434('0x29')]['count'](_0x3546f1)[_0xe434('0x24')](function(_0x496474){_0x338e4e[_0xe434('0x1f')]=_0x496474;if(_0x501793['query']['includeAll']){_0x3efd51[_0xe434('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xe434('0x3f')](_0x3efd51);})[_0xe434('0x24')](function(_0x62cd40){_0x338e4e[_0xe434('0x40')]=_0x62cd40;return _0x338e4e;})[_0xe434('0x24')](respondWithFilteredResult(_0x428f0d,_0x3efd51))[_0xe434('0x41')](handleError(_0x428f0d,null));};exports['show']=function(_0x641f9,_0x25949a){var _0x363a17={'raw':!![],'where':{'id':_0x641f9['params']['id']}},_0x52211e={};_0x52211e[_0xe434('0x2e')]=_[_0xe434('0x30')](db['VoiceDialReport'][_0xe434('0x2a')]);_0x52211e['query']=_['keys'](_0x641f9['query']);_0x52211e[_0xe434('0x32')]=_['intersection'](_0x52211e[_0xe434('0x2e')],_0x52211e[_0xe434('0x31')]);_0x363a17['attributes']=_[_0xe434('0x33')](_0x52211e[_0xe434('0x2e')],qs[_0xe434('0x35')](_0x641f9['query'][_0xe434('0x35')]));_0x363a17[_0xe434('0x34')]=_0x363a17[_0xe434('0x34')][_0xe434('0x42')]?_0x363a17[_0xe434('0x34')]:_0x52211e[_0xe434('0x2e')];if(_0x641f9[_0xe434('0x31')][_0xe434('0x43')]){_0x363a17['include']=[{'all':!![]}];}_0x363a17=_['merge']({},_0x363a17,_0x641f9['options']);return db[_0xe434('0x29')]['find'](_0x363a17)[_0xe434('0x24')](handleEntityNotFound(_0x25949a,null))[_0xe434('0x24')](respondWithResult(_0x25949a,null))[_0xe434('0x41')](handleError(_0x25949a,null));};exports[_0xe434('0x44')]=function(_0x5117a2,_0x1c73ad){return db['VoiceDialReport'][_0xe434('0x44')](_0x5117a2['body'],{})['then'](respondWithResult(_0x1c73ad,0xc9))[_0xe434('0x41')](handleError(_0x1c73ad,null));};exports[_0xe434('0x45')]=function(_0x12ce01,_0x1c3a32){if(_0x12ce01[_0xe434('0x46')]['id']){delete _0x12ce01['body']['id'];}return db[_0xe434('0x29')][_0xe434('0x47')]({'where':{'id':_0x12ce01[_0xe434('0x48')]['id']}})[_0xe434('0x24')](handleEntityNotFound(_0x1c3a32,null))[_0xe434('0x24')](saveUpdates(_0x12ce01[_0xe434('0x46')],null))[_0xe434('0x24')](respondWithResult(_0x1c3a32,null))[_0xe434('0x41')](handleError(_0x1c3a32,null));};exports[_0xe434('0x25')]=function(_0x5eceb8,_0x58c7e5){return db[_0xe434('0x29')]['find']({'where':{'id':_0x5eceb8[_0xe434('0x48')]['id']}})[_0xe434('0x24')](handleEntityNotFound(_0x58c7e5,null))[_0xe434('0x24')](removeEntity(_0x58c7e5,null))[_0xe434('0x41')](handleError(_0x58c7e5,null));};exports[_0xe434('0x49')]=function(_0x466743,_0x2dde1f){return db[_0xe434('0x29')]['describe']()[_0xe434('0x24')](respondWithResult(_0x2dde1f,null))[_0xe434('0x41')](handleError(_0x2dde1f,null));}; \ No newline at end of file +var _0x442d=['status','end','undefined','count','offset','limit','set','json','apply','reject','save','destroy','then','stack','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x442d,0xc3));var _0xd442=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x442d[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0xd442('0x0'));var rimraf=require(_0xd442('0x1'));var zipdir=require(_0xd442('0x2'));var jsonpatch=require(_0xd442('0x3'));var rp=require(_0xd442('0x4'));var moment=require(_0xd442('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd442('0x6'));var util=require('util');var path=require(_0xd442('0x7'));var sox=require(_0xd442('0x8'));var csv=require(_0xd442('0x9'));var ejs=require(_0xd442('0xa'));var fs=require('fs');var fs_extra=require(_0xd442('0xb'));var _=require(_0xd442('0xc'));var squel=require('squel');var crypto=require(_0xd442('0xd'));var jsforce=require(_0xd442('0xe'));var deskjs=require(_0xd442('0xf'));var toCsv=require(_0xd442('0x9'));var querystring=require(_0xd442('0x10'));var Papa=require(_0xd442('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd442('0x12'));var hardwareService=require(_0xd442('0x13'));var logger=require(_0xd442('0x14'))(_0xd442('0x15'));var utils=require('../../config/utils');var config=require(_0xd442('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2c6d,_0x4bea74){_0x4bea74=_0x4bea74||0xcc;return function(_0x46d46c){if(_0x46d46c){return _0x4c2c6d[_0xd442('0x17')](_0x4bea74);}return _0x4c2c6d[_0xd442('0x18')](_0x4bea74)[_0xd442('0x19')]();};}function respondWithResult(_0x42208c,_0x4aad74){_0x4aad74=_0x4aad74||0xc8;return function(_0x5a8d39){if(_0x5a8d39){return _0x42208c[_0xd442('0x18')](_0x4aad74)['json'](_0x5a8d39);}};}function respondWithFilteredResult(_0x58c2ea,_0x2f7c1b){return function(_0x2350ae){if(_0x2350ae){var _0x388585=typeof _0x2f7c1b['offset']===_0xd442('0x1a')&&typeof _0x2f7c1b['limit']===_0xd442('0x1a');var _0x4da177=_0x2350ae[_0xd442('0x1b')];var _0x275b8b=_0x388585?0x0:_0x2f7c1b[_0xd442('0x1c')];var _0xe7b756=_0x388585?_0x2350ae[_0xd442('0x1b')]:_0x2f7c1b[_0xd442('0x1c')]+_0x2f7c1b[_0xd442('0x1d')];var _0x30f162;if(_0xe7b756>=_0x4da177){_0xe7b756=_0x4da177;_0x30f162=0xc8;}else{_0x30f162=0xce;}_0x58c2ea[_0xd442('0x18')](_0x30f162);return _0x58c2ea[_0xd442('0x1e')]('Content-Range',_0x275b8b+'-'+_0xe7b756+'/'+_0x4da177)[_0xd442('0x1f')](_0x2350ae);}return null;};}function patchUpdates(_0x33626f){return function(_0x477bb2){try{jsonpatch[_0xd442('0x20')](_0x477bb2,_0x33626f,!![]);}catch(_0x48b78a){return BPromise[_0xd442('0x21')](_0x48b78a);}return _0x477bb2[_0xd442('0x22')]();};}function saveUpdates(_0x4b9656,_0x5b2ce7){return function(_0x146c06){if(_0x146c06){return _0x146c06['update'](_0x4b9656)['then'](function(_0x3ba3db){return _0x3ba3db;});}return null;};}function removeEntity(_0x24479f,_0x23273e){return function(_0x20f355){if(_0x20f355){return _0x20f355[_0xd442('0x23')]()[_0xd442('0x24')](function(){_0x24479f[_0xd442('0x18')](0xcc)[_0xd442('0x19')]();});}};}function handleEntityNotFound(_0x37576f,_0x4fe041){return function(_0x3b7615){if(!_0x3b7615){_0x37576f[_0xd442('0x17')](0x194);}return _0x3b7615;};}function handleError(_0x40a1d8,_0x3b4435){_0x3b4435=_0x3b4435||0x1f4;return function(_0x4dce9e){logger['error'](_0x4dce9e[_0xd442('0x25')]);if(_0x4dce9e[_0xd442('0x26')]){delete _0x4dce9e[_0xd442('0x26')];}_0x40a1d8[_0xd442('0x18')](_0x3b4435)[_0xd442('0x27')](_0x4dce9e);};}exports['index']=function(_0x57fe80,_0x28eee8){var _0x50fe53={},_0x503b6f={},_0x1bf88f={'count':0x0,'rows':[]};var _0x422f19=_['map'](db[_0xd442('0x28')][_0xd442('0x29')],function(_0x27f66d){return{'name':_0x27f66d[_0xd442('0x2a')],'type':_0x27f66d[_0xd442('0x2b')][_0xd442('0x2c')]};});_0x503b6f['model']=_[_0xd442('0x2d')](_0x422f19,_0xd442('0x26'));_0x503b6f['query']=_[_0xd442('0x2e')](_0x57fe80[_0xd442('0x2f')]);_0x503b6f[_0xd442('0x30')]=_[_0xd442('0x31')](_0x503b6f[_0xd442('0x32')],_0x503b6f[_0xd442('0x2f')]);_0x50fe53['attributes']=_[_0xd442('0x31')](_0x503b6f[_0xd442('0x32')],qs['fields'](_0x57fe80[_0xd442('0x2f')][_0xd442('0x33')]));_0x50fe53[_0xd442('0x34')]=_0x50fe53[_0xd442('0x34')][_0xd442('0x35')]?_0x50fe53[_0xd442('0x34')]:_0x503b6f[_0xd442('0x32')];if(!_0x57fe80['query'][_0xd442('0x36')](_0xd442('0x37'))){_0x50fe53['limit']=qs[_0xd442('0x1d')](_0x57fe80['query']['limit']);_0x50fe53[_0xd442('0x1c')]=qs[_0xd442('0x1c')](_0x57fe80[_0xd442('0x2f')][_0xd442('0x1c')]);}_0x50fe53[_0xd442('0x38')]=qs['sort'](_0x57fe80[_0xd442('0x2f')][_0xd442('0x39')]);_0x50fe53[_0xd442('0x3a')]=qs[_0xd442('0x30')](_[_0xd442('0x3b')](_0x57fe80[_0xd442('0x2f')],_0x503b6f[_0xd442('0x30')]),_0x422f19);if(_0x57fe80[_0xd442('0x2f')][_0xd442('0x3c')]){_0x50fe53['where']=_['merge'](_0x50fe53[_0xd442('0x3a')],{'$or':_[_0xd442('0x2d')](_0x422f19,function(_0x21bdd0){if(_0x21bdd0[_0xd442('0x2b')]!==_0xd442('0x3d')){var _0x9e13dc={};_0x9e13dc[_0x21bdd0['name']]={'$like':'%'+_0x57fe80[_0xd442('0x2f')][_0xd442('0x3c')]+'%'};return _0x9e13dc;}})});}_0x50fe53=_[_0xd442('0x3e')]({},_0x50fe53,_0x57fe80[_0xd442('0x3f')]);var _0x1d3e8a={'where':_0x50fe53[_0xd442('0x3a')]};return db['VoiceDialReport'][_0xd442('0x1b')](_0x1d3e8a)[_0xd442('0x24')](function(_0x4cf428){_0x1bf88f['count']=_0x4cf428;if(_0x57fe80[_0xd442('0x2f')]['includeAll']){_0x50fe53[_0xd442('0x40')]=[{'all':!![]}];}return db[_0xd442('0x28')][_0xd442('0x41')](_0x50fe53);})[_0xd442('0x24')](function(_0x366724){_0x1bf88f['rows']=_0x366724;return _0x1bf88f;})['then'](respondWithFilteredResult(_0x28eee8,_0x50fe53))['catch'](handleError(_0x28eee8,null));};exports[_0xd442('0x42')]=function(_0x4146f0,_0x383b2f){var _0x32c357={'raw':!![],'where':{'id':_0x4146f0[_0xd442('0x43')]['id']}},_0x10588c={};_0x10588c[_0xd442('0x32')]=_['keys'](db[_0xd442('0x28')]['rawAttributes']);_0x10588c[_0xd442('0x2f')]=_[_0xd442('0x2e')](_0x4146f0['query']);_0x10588c[_0xd442('0x30')]=_['intersection'](_0x10588c[_0xd442('0x32')],_0x10588c['query']);_0x32c357[_0xd442('0x34')]=_[_0xd442('0x31')](_0x10588c[_0xd442('0x32')],qs[_0xd442('0x33')](_0x4146f0[_0xd442('0x2f')][_0xd442('0x33')]));_0x32c357[_0xd442('0x34')]=_0x32c357[_0xd442('0x34')][_0xd442('0x35')]?_0x32c357['attributes']:_0x10588c[_0xd442('0x32')];if(_0x4146f0[_0xd442('0x2f')]['includeAll']){_0x32c357[_0xd442('0x40')]=[{'all':!![]}];}_0x32c357=_[_0xd442('0x3e')]({},_0x32c357,_0x4146f0['options']);return db[_0xd442('0x28')][_0xd442('0x44')](_0x32c357)[_0xd442('0x24')](handleEntityNotFound(_0x383b2f,null))[_0xd442('0x24')](respondWithResult(_0x383b2f,null))[_0xd442('0x45')](handleError(_0x383b2f,null));};exports[_0xd442('0x46')]=function(_0x27f8e5,_0x4c511d){return db[_0xd442('0x28')][_0xd442('0x46')](_0x27f8e5[_0xd442('0x47')],{})[_0xd442('0x24')](respondWithResult(_0x4c511d,0xc9))[_0xd442('0x45')](handleError(_0x4c511d,null));};exports['update']=function(_0x2a2da2,_0x31d9ac){if(_0x2a2da2[_0xd442('0x47')]['id']){delete _0x2a2da2['body']['id'];}return db[_0xd442('0x28')]['find']({'where':{'id':_0x2a2da2['params']['id']}})[_0xd442('0x24')](handleEntityNotFound(_0x31d9ac,null))['then'](saveUpdates(_0x2a2da2[_0xd442('0x47')],null))[_0xd442('0x24')](respondWithResult(_0x31d9ac,null))[_0xd442('0x45')](handleError(_0x31d9ac,null));};exports[_0xd442('0x23')]=function(_0x2785eb,_0x765bde){return db['VoiceDialReport'][_0xd442('0x44')]({'where':{'id':_0x2785eb[_0xd442('0x43')]['id']}})[_0xd442('0x24')](handleEntityNotFound(_0x765bde,null))['then'](removeEntity(_0x765bde,null))['catch'](handleError(_0x765bde,null));};exports['describe']=function(_0xd4b049,_0x9b0e19){return db[_0xd442('0x28')][_0xd442('0x48')]()[_0xd442('0x24')](respondWithResult(_0x9b0e19,null))['catch'](handleError(_0x9b0e19,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 33f5a8f..ab79a37 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 _0x9da8=['./voiceDialReport.attributes','define','VoiceDialReport','report_dial','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x9da8,0x10c));var _0x89da=function(_0x49891e,_0x3feb8b){_0x49891e=_0x49891e-0x0;var _0x13a067=_0x9da8[_0x49891e];return _0x13a067;};'use strict';var _=require('lodash');var util=require(_0x89da('0x0'));var logger=require('../../config/logger')(_0x89da('0x1'));var moment=require(_0x89da('0x2'));var BPromise=require(_0x89da('0x3'));var rp=require(_0x89da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89da('0x5'));var config=require(_0x89da('0x6'));var attributes=require(_0x89da('0x7'));module['exports']=function(_0x502c7f,_0xb8e7d2){return _0x502c7f[_0x89da('0x8')](_0x89da('0x9'),attributes,{'tableName':_0x89da('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa85a=['path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x22bc7e,_0x4500ba){var _0x34e255=function(_0x39a9c0){while(--_0x39a9c0){_0x22bc7e['push'](_0x22bc7e['shift']());}};_0x34e255(++_0x4500ba);}(_0xa85a,0x103));var _0xaa85=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xa85a[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xaa85('0x0'));var util=require(_0xaa85('0x1'));var logger=require(_0xaa85('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaa85('0x3'));var rp=require(_0xaa85('0x4'));var fs=require('fs');var path=require(_0xaa85('0x5'));var rimraf=require(_0xaa85('0x6'));var config=require(_0xaa85('0x7'));var attributes=require(_0xaa85('0x8'));module['exports']=function(_0x2d6567,_0x4496a8){return _0x2d6567[_0xaa85('0x9')](_0xaa85('0xa'),attributes,{'tableName':_0xaa85('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d11ce25..093e17c 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 _0xd232=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','debug','UpdateVoiceDialReport','update','limit'];(function(_0x14ee56,_0x57bbaf){var _0x24bd77=function(_0x5732a0){while(--_0x5732a0){_0x14ee56['push'](_0x14ee56['shift']());}};_0x24bd77(++_0x57bbaf);}(_0xd232,0x74));var _0x2d23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var moment=require(_0x2d23('0x1'));var BPromise=require(_0x2d23('0x2'));var rs=require(_0x2d23('0x3'));var fs=require('fs');var Redis=require(_0x2d23('0x4'));var db=require(_0x2d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d23('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d23('0x7')][_0x2d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15c735,_0x53ac18,_0x18cac8){return new BPromise(function(_0x4cf7f4,_0x2c4667){return client[_0x2d23('0x9')](_0x15c735,_0x18cac8)[_0x2d23('0xa')](function(_0x7847cb){logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x53ac18,_0x2d23('0xd'));logger['debug'](_0x2d23('0xe'),_0x53ac18,_0x2d23('0xd'),JSON[_0x2d23('0xf')](_0x7847cb));if(_0x7847cb[_0x2d23('0x10')]){if(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x11')]===0x1f4){logger[_0x2d23('0x10')](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x2c4667(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}logger['error'](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x4cf7f4(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}else{logger['info'](_0x2d23('0xc'),_0x53ac18,'request\x20sent');_0x4cf7f4(_0x7847cb[_0x2d23('0x13')]['message']);}})[_0x2d23('0x14')](function(_0x30b578){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x53ac18,_0x30b578);_0x2c4667(_0x30b578);});});}exports[_0x2d23('0x15')]=function(_0x59c54b){var _0x113954=this;return new Promise(function(_0x1428c8,_0x3790c2){return db[_0x2d23('0x16')]['create'](_0x59c54b['body'],{'raw':_0x59c54b[_0x2d23('0x17')]?_0x59c54b[_0x2d23('0x17')][_0x2d23('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x512e4d){logger[_0x2d23('0xb')](_0x2d23('0x15'),_0x59c54b);logger[_0x2d23('0x19')](_0x2d23('0x15'),_0x59c54b,JSON['stringify'](_0x512e4d));_0x1428c8(_0x512e4d);})[_0x2d23('0x14')](function(_0x42eb0d){logger[_0x2d23('0x10')]('CreateVoiceDialReport',_0x42eb0d[_0x2d23('0x12')],_0x59c54b);_0x3790c2(_0x113954['error'](0x1f4,_0x42eb0d[_0x2d23('0x12')]));});});};exports[_0x2d23('0x1a')]=function(_0x5a1f1e){var _0x32e440=this;return new Promise(function(_0x2034d4,_0x3aef1d){return db['VoiceDialReport'][_0x2d23('0x1b')](_0x5a1f1e['body'],{'raw':_0x5a1f1e[_0x2d23('0x17')]?_0x5a1f1e[_0x2d23('0x17')][_0x2d23('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a1f1e[_0x2d23('0x17')]?_0x5a1f1e['options']['where']||null:null,'attributes':_0x5a1f1e[_0x2d23('0x17')]?_0x5a1f1e[_0x2d23('0x17')]['attributes']||null:null,'limit':_0x5a1f1e[_0x2d23('0x17')]?_0x5a1f1e['options'][_0x2d23('0x1c')]||null:null})['then'](function(_0x4a67cf){logger[_0x2d23('0xb')](_0x2d23('0x1a'),_0x5a1f1e);logger[_0x2d23('0x19')](_0x2d23('0x1a'),_0x5a1f1e,JSON[_0x2d23('0xf')](_0x4a67cf));_0x2034d4(_0x4a67cf);})[_0x2d23('0x14')](function(_0x479958){logger[_0x2d23('0x10')](_0x2d23('0x1a'),_0x479958[_0x2d23('0x12')],_0x5a1f1e);_0x3aef1d(_0x32e440[_0x2d23('0x10')](0x1f4,_0x479958[_0x2d23('0x12')]));});});}; \ No newline at end of file +var _0x84e8=['request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x8d6506,_0x277847){var _0x18e4f2=function(_0x40b31b){while(--_0x40b31b){_0x8d6506['push'](_0x8d6506['shift']());}};_0x18e4f2(++_0x277847);}(_0x84e8,0x9a));var _0x884e=function(_0x55c5d7,_0x4b66f0){_0x55c5d7=_0x55c5d7-0x0;var _0x48bcc8=_0x84e8[_0x55c5d7];return _0x48bcc8;};'use strict';var _=require(_0x884e('0x0'));var util=require(_0x884e('0x1'));var moment=require(_0x884e('0x2'));var BPromise=require(_0x884e('0x3'));var rs=require(_0x884e('0x4'));var fs=require('fs');var Redis=require(_0x884e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x884e('0x6'));var logger=require(_0x884e('0x7'))(_0x884e('0x8'));var config=require(_0x884e('0x9'));var jayson=require(_0x884e('0xa'));var client=jayson[_0x884e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2a26,_0x1e27f6,_0x1d6acd){return new BPromise(function(_0x59a9c1,_0x949b92){return client[_0x884e('0xc')](_0x3f2a26,_0x1d6acd)[_0x884e('0xd')](function(_0x55bc53){logger[_0x884e('0xe')](_0x884e('0xf'),_0x1e27f6,_0x884e('0x10'));logger['debug'](_0x884e('0x11'),_0x1e27f6,_0x884e('0x10'),JSON[_0x884e('0x12')](_0x55bc53));if(_0x55bc53['error']){if(_0x55bc53[_0x884e('0x13')][_0x884e('0x14')]===0x1f4){logger['error'](_0x884e('0xf'),_0x1e27f6,_0x55bc53[_0x884e('0x13')][_0x884e('0x15')]);return _0x949b92(_0x55bc53[_0x884e('0x13')][_0x884e('0x15')]);}logger['error'](_0x884e('0xf'),_0x1e27f6,_0x55bc53[_0x884e('0x13')][_0x884e('0x15')]);return _0x59a9c1(_0x55bc53[_0x884e('0x13')][_0x884e('0x15')]);}else{logger['info'](_0x884e('0xf'),_0x1e27f6,_0x884e('0x10'));_0x59a9c1(_0x55bc53[_0x884e('0x16')][_0x884e('0x15')]);}})[_0x884e('0x17')](function(_0x35f24d){logger[_0x884e('0x13')](_0x884e('0xf'),_0x1e27f6,_0x35f24d);_0x949b92(_0x35f24d);});});}exports['CreateVoiceDialReport']=function(_0x8e0e28){var _0x326e42=this;return new Promise(function(_0x27f9c4,_0x494aa0){return db[_0x884e('0x18')]['create'](_0x8e0e28[_0x884e('0x19')],{'raw':_0x8e0e28[_0x884e('0x1a')]?_0x8e0e28[_0x884e('0x1a')][_0x884e('0x1b')]===undefined?!![]:![]:!![]})[_0x884e('0xd')](function(_0xa6610b){logger[_0x884e('0xe')](_0x884e('0x1c'),_0x8e0e28);logger[_0x884e('0x1d')](_0x884e('0x1c'),_0x8e0e28,JSON[_0x884e('0x12')](_0xa6610b));_0x27f9c4(_0xa6610b);})['catch'](function(_0xcce45f){logger['error'](_0x884e('0x1c'),_0xcce45f[_0x884e('0x15')],_0x8e0e28);_0x494aa0(_0x326e42[_0x884e('0x13')](0x1f4,_0xcce45f[_0x884e('0x15')]));});});};exports[_0x884e('0x1e')]=function(_0x5911ac){var _0x2ff1ed=this;return new Promise(function(_0x1c563e,_0x19c2bc){return db['VoiceDialReport'][_0x884e('0x1f')](_0x5911ac[_0x884e('0x19')],{'raw':_0x5911ac['options']?_0x5911ac['options'][_0x884e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5911ac['options']?_0x5911ac['options']['where']||null:null,'attributes':_0x5911ac[_0x884e('0x1a')]?_0x5911ac[_0x884e('0x1a')][_0x884e('0x20')]||null:null,'limit':_0x5911ac[_0x884e('0x1a')]?_0x5911ac[_0x884e('0x1a')][_0x884e('0x21')]||null:null})[_0x884e('0xd')](function(_0x5cd952){logger[_0x884e('0xe')](_0x884e('0x1e'),_0x5911ac);logger[_0x884e('0x1d')](_0x884e('0x1e'),_0x5911ac,JSON[_0x884e('0x12')](_0x5cd952));_0x1c563e(_0x5cd952);})[_0x884e('0x17')](function(_0x62faa1){logger[_0x884e('0x13')](_0x884e('0x1e'),_0x62faa1[_0x884e('0x15')],_0x5911ac);_0x19c2bc(_0x2ff1ed[_0x884e('0x13')](0x1f4,_0x62faa1[_0x884e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f6df054..1ce3255 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 _0x0676=['put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications'];(function(_0x59ae80,_0x13177d){var _0x30e2ad=function(_0x24f9c9){while(--_0x24f9c9){_0x59ae80['push'](_0x59ae80['shift']());}};_0x30e2ad(++_0x13177d);}(_0x0676,0x1b9));var _0x6067=function(_0x37ba5c,_0x5c917c){_0x37ba5c=_0x37ba5c-0x0;var _0x4c1e2b=_0x0676[_0x37ba5c];return _0x4c1e2b;};'use strict';var multer=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var path=require(_0x6067('0x2'));var timeout=require('connect-timeout');var express=require(_0x6067('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6067('0x4'));var config=require('../../config/environment');var controller=require(_0x6067('0x5'));router[_0x6067('0x6')]('/',auth[_0x6067('0x7')](),controller[_0x6067('0x8')]);router[_0x6067('0x6')](_0x6067('0x9'),auth[_0x6067('0x7')](),controller[_0x6067('0xa')]);router[_0x6067('0xb')]('/',auth[_0x6067('0x7')](),controller[_0x6067('0xc')]);router[_0x6067('0xb')](_0x6067('0xd'),auth['isAuthenticated'](),controller[_0x6067('0xe')]);router[_0x6067('0xf')](_0x6067('0x9'),auth[_0x6067('0x7')](),controller[_0x6067('0x10')]);router[_0x6067('0x11')](_0x6067('0x9'),auth[_0x6067('0x7')](),controller[_0x6067('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc285=['show','post','addApplications','put','/:id','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x1193ae,_0x3c4a54){var _0x4e67a0=function(_0x1b53ae){while(--_0x1b53ae){_0x1193ae['push'](_0x1193ae['shift']());}};_0x4e67a0(++_0x3c4a54);}(_0xc285,0x1d8));var _0x5c28=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xc285[_0x238bce];return _0x127fc9;};'use strict';var multer=require('multer');var util=require(_0x5c28('0x0'));var path=require('path');var timeout=require(_0x5c28('0x1'));var express=require('express');var router=express[_0x5c28('0x2')]();var fs_extra=require(_0x5c28('0x3'));var auth=require(_0x5c28('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c28('0x5'));var controller=require('./voiceExtension.controller');router[_0x5c28('0x6')]('/',auth[_0x5c28('0x7')](),controller['index']);router[_0x5c28('0x6')]('/:id',auth[_0x5c28('0x7')](),controller[_0x5c28('0x8')]);router[_0x5c28('0x9')]('/',auth[_0x5c28('0x7')](),controller['create']);router[_0x5c28('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5c28('0xa')]);router[_0x5c28('0xb')](_0x5c28('0xc'),auth[_0x5c28('0x7')](),controller[_0x5c28('0xd')]);router[_0x5c28('0xe')](_0x5c28('0xc'),auth['isAuthenticated'](),controller[_0x5c28('0xf')]);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 ca2d03f..66d6f54 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 _0xe0ac=['*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0x398e5c,_0x5e52ba){var _0x21b296=function(_0x2011f6){while(--_0x2011f6){_0x398e5c['push'](_0x398e5c['shift']());}};_0x21b296(++_0x5e52ba);}(_0xe0ac,0x14b));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xce0a('0x0')]={'context':{'type':Sequelize[_0xce0a('0x1')],'allowNull':![],'unique':_0xce0a('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xce0a('0x1')],'allowNull':![],'unique':_0xce0a('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xce0a('0x2')},'tag':{'type':Sequelize[_0xce0a('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xce0a('0x1')],'allowNull':![],'defaultValue':_0xce0a('0x3')},'appdata':{'type':Sequelize[_0xce0a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xce0a('0x4')](_0xce0a('0x5'),'outbound',_0xce0a('0x6'),_0xce0a('0x7'),_0xce0a('0x8'),_0xce0a('0x9'),_0xce0a('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xce0a('0x1')],'allowNull':![],'defaultValue':_0xce0a('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xce0a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xce0a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xce0a('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xce0a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xce0a('0xd')]},'recordingFormat':{'type':Sequelize[_0xce0a('0x1')],'defaultValue':_0xce0a('0xe')},'answer':{'type':Sequelize[_0xce0a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xce0a('0xf')],'get':function(_0x31819b){return this[_0xce0a('0x10')](_0xce0a('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x952a=['*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','inbound-fax','outbound-fax','system','any'];(function(_0x4392a8,_0x35d169){var _0x3cd0e5=function(_0x39c67a){while(--_0x39c67a){_0x4392a8['push'](_0x4392a8['shift']());}};_0x3cd0e5(++_0x35d169);}(_0x952a,0x18d));var _0xa952=function(_0x1a2624,_0x5cf832){_0x1a2624=_0x1a2624-0x0;var _0x449318=_0x952a[_0x1a2624];return _0x449318;};'use strict';var Sequelize=require(_0xa952('0x0'));module[_0xa952('0x1')]={'context':{'type':Sequelize[_0xa952('0x2')],'allowNull':![],'unique':_0xa952('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa952('0x2')],'allowNull':![],'unique':_0xa952('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xa952('0x3')},'tag':{'type':Sequelize[_0xa952('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa952('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xa952('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa952('0x4')](_0xa952('0x5'),_0xa952('0x6'),'internal',_0xa952('0x7'),_0xa952('0x8'),_0xa952('0x9'),_0xa952('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xa952('0x2')]},'interval':{'type':Sequelize[_0xa952('0x2')],'allowNull':![],'defaultValue':_0xa952('0xb')},'IntervalId':{'type':Sequelize[_0xa952('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa952('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa952('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xa952('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xa952('0x2')],'defaultValue':_0xa952('0xe')},'answer':{'type':Sequelize[_0xa952('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa952('0xf')],'get':function(_0x5869e6){return this[_0xa952('0x10')]('exten');}},'alias':{'type':Sequelize[_0xa952('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b3145f6..6373f2d 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 _0xa6a0=['options','find','body','startsWith','exten','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','send','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','ignore','value','includes','type','name','UserProfileResource','stack','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params'];(function(_0x2042a9,_0x49e2b3){var _0x3219c5=function(_0x3c0dc6){while(--_0x3c0dc6){_0x2042a9['push'](_0x2042a9['shift']());}};_0x3219c5(++_0x49e2b3);}(_0xa6a0,0x7c));var _0x0a6a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa6a0[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Redis=require(_0x0a6a('0x0'));var qs=require(_0x0a6a('0x1'));var logger=require('../../config/logger')(_0x0a6a('0x2'));var config=require(_0x0a6a('0x3'));var db=require(_0x0a6a('0x4'))['db'];config[_0x0a6a('0x5')]=_[_0x0a6a('0x6')](config[_0x0a6a('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a6a('0x7'))(new Redis(config[_0x0a6a('0x5')]));require('./voiceExtension.socket')[_0x0a6a('0x8')](socket);function respondWithStatusCode(_0x1dc686,_0x23d486){_0x23d486=_0x23d486||0xcc;return function(_0x51dbb2){if(_0x51dbb2){return _0x1dc686[_0x0a6a('0x9')](_0x23d486);}return _0x1dc686[_0x0a6a('0xa')](_0x23d486)[_0x0a6a('0xb')]();};}function respondWithResult(_0xf1ba9b,_0x345c72){_0x345c72=_0x345c72||0xc8;return function(_0x28ad70){if(_0x28ad70){return _0xf1ba9b['status'](_0x345c72)[_0x0a6a('0xc')](_0x28ad70);}};}function respondWithFilteredResult(_0x11a495,_0xe5f2b){return function(_0x31207f){if(_0x31207f){var _0x390d43=typeof _0xe5f2b[_0x0a6a('0xd')]===_0x0a6a('0xe')&&typeof _0xe5f2b[_0x0a6a('0xf')]===_0x0a6a('0xe');var _0x5578ce=_0x31207f[_0x0a6a('0x10')];var _0x8ade50=_0x390d43?0x0:_0xe5f2b[_0x0a6a('0xd')];var _0x1fb8d1=_0x390d43?_0x31207f[_0x0a6a('0x10')]:_0xe5f2b['offset']+_0xe5f2b[_0x0a6a('0xf')];var _0x286bcb;if(_0x1fb8d1>=_0x5578ce){_0x1fb8d1=_0x5578ce;_0x286bcb=0xc8;}else{_0x286bcb=0xce;}_0x11a495[_0x0a6a('0xa')](_0x286bcb);return _0x11a495[_0x0a6a('0x11')](_0x0a6a('0x12'),_0x8ade50+'-'+_0x1fb8d1+'/'+_0x5578ce)[_0x0a6a('0xc')](_0x31207f);}return null;};}function removeEntity(_0x5cf3ce){return function(_0x3d9b67){if(_0x3d9b67){return _0x3d9b67[_0x0a6a('0x13')]()[_0x0a6a('0x14')](function(){var _0x567142=_0x3d9b67[_0x0a6a('0x15')]({'plain':!![]});var _0x42eca5=[{'name':_0x0a6a('0x16'),'value':_0x0a6a('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x0a6a('0x18'),'ignore':![]},{'name':_0x0a6a('0x19'),'value':_0x0a6a('0x1a'),'ignore':![]}];var _0x3a5691=_(_0x42eca5)['filter'](_0x0a6a('0x1b'))['map'](_0x0a6a('0x1c'))['value']();if(_[_0x0a6a('0x1d')](_0x3a5691,_0x567142[_0x0a6a('0x1e')])){return;}var _0x1d7492=_['find'](_0x42eca5,[_0x0a6a('0x1c'),_0x567142[_0x0a6a('0x1e')]])[_0x0a6a('0x1f')];return db[_0x0a6a('0x20')]['destroy']({'where':{'type':_0x1d7492,'resourceId':_0x567142['id']}})['then'](function(){return _0x3d9b67;});})['then'](function(){_0x5cf3ce[_0x0a6a('0xa')](0xcc)[_0x0a6a('0xb')]();});}};}function handleEntityNotFound(_0x1297ba){return function(_0x8947ed){if(!_0x8947ed){_0x1297ba[_0x0a6a('0x9')](0x194);}return _0x8947ed;};}function handleError(_0x4a5714,_0x2a1acf){_0x2a1acf=_0x2a1acf||0x1f4;return function(_0x9f48ae){logger['error'](_0x9f48ae[_0x0a6a('0x21')]);if(_0x9f48ae[_0x0a6a('0x1f')]){delete _0x9f48ae[_0x0a6a('0x1f')];}_0x4a5714['status'](_0x2a1acf)['send'](_0x9f48ae);};}exports['index']=function(_0x231a5e,_0x4b9f34){var _0x30851f={},_0xed60b6={},_0xf08ea3={'count':0x0,'rows':[]};var _0x28ba67=_[_0x0a6a('0x22')](db[_0x0a6a('0x23')][_0x0a6a('0x24')],function(_0x401564){return{'name':_0x401564[_0x0a6a('0x25')],'type':_0x401564[_0x0a6a('0x1e')][_0x0a6a('0x26')]};});_0xed60b6[_0x0a6a('0x27')]=_[_0x0a6a('0x22')](_0x28ba67,'name');_0xed60b6[_0x0a6a('0x28')]=_[_0x0a6a('0x29')](_0x231a5e[_0x0a6a('0x28')]);_0xed60b6[_0x0a6a('0x2a')]=_[_0x0a6a('0x2b')](_0xed60b6[_0x0a6a('0x27')],_0xed60b6[_0x0a6a('0x28')]);_0x30851f[_0x0a6a('0x2c')]=_[_0x0a6a('0x2b')](_0xed60b6[_0x0a6a('0x27')],qs['fields'](_0x231a5e['query'][_0x0a6a('0x2d')]));_0x30851f['attributes']=_0x30851f[_0x0a6a('0x2c')][_0x0a6a('0x2e')]?_0x30851f[_0x0a6a('0x2c')]:_0xed60b6[_0x0a6a('0x27')];if(!_0x231a5e[_0x0a6a('0x28')]['hasOwnProperty'](_0x0a6a('0x2f'))){_0x30851f[_0x0a6a('0xf')]=qs[_0x0a6a('0xf')](_0x231a5e[_0x0a6a('0x28')][_0x0a6a('0xf')]);_0x30851f[_0x0a6a('0xd')]=qs[_0x0a6a('0xd')](_0x231a5e[_0x0a6a('0x28')][_0x0a6a('0xd')]);}_0x30851f['order']=qs[_0x0a6a('0x30')](_0x231a5e[_0x0a6a('0x28')]['sort']);_0x30851f[_0x0a6a('0x31')]=qs[_0x0a6a('0x2a')](_[_0x0a6a('0x32')](_0x231a5e[_0x0a6a('0x28')],_0xed60b6['filters']),_0x28ba67);if(_0x231a5e[_0x0a6a('0x28')][_0x0a6a('0x33')]){_0x30851f[_0x0a6a('0x31')]=_['merge'](_0x30851f['where'],{'$or':_[_0x0a6a('0x22')](_0x28ba67,function(_0x125faf){if(_0x125faf[_0x0a6a('0x1e')]!==_0x0a6a('0x34')){var _0x5f34d9={};_0x5f34d9[_0x125faf['name']]={'$like':'%'+_0x231a5e[_0x0a6a('0x28')][_0x0a6a('0x33')]+'%'};return _0x5f34d9;}})});}_0x30851f=_[_0x0a6a('0x35')]({},_0x30851f,_0x231a5e['options']);var _0x1a912b={'where':_0x30851f[_0x0a6a('0x31')]};return db[_0x0a6a('0x23')][_0x0a6a('0x10')](_0x1a912b)[_0x0a6a('0x14')](function(_0x141eaa){_0xf08ea3[_0x0a6a('0x10')]=_0x141eaa;if(_0x231a5e[_0x0a6a('0x28')][_0x0a6a('0x36')]){_0x30851f[_0x0a6a('0x37')]=[{'all':!![]}];}return db[_0x0a6a('0x23')]['findAll'](_0x30851f);})[_0x0a6a('0x14')](function(_0x4ad69){_0xf08ea3[_0x0a6a('0x38')]=_0x4ad69;return _0xf08ea3;})[_0x0a6a('0x14')](respondWithFilteredResult(_0x4b9f34,_0x30851f))[_0x0a6a('0x39')](handleError(_0x4b9f34,null));};exports[_0x0a6a('0x3a')]=function(_0x4e05bc,_0x5b6a08){var _0x273e3b={'raw':![],'where':{'id':_0x4e05bc[_0x0a6a('0x3b')]['id']}},_0x21eb26={};_0x21eb26['model']=_[_0x0a6a('0x29')](db[_0x0a6a('0x23')][_0x0a6a('0x24')]);_0x21eb26['query']=_[_0x0a6a('0x29')](_0x4e05bc[_0x0a6a('0x28')]);_0x21eb26[_0x0a6a('0x2a')]=_[_0x0a6a('0x2b')](_0x21eb26[_0x0a6a('0x27')],_0x21eb26[_0x0a6a('0x28')]);_0x273e3b[_0x0a6a('0x2c')]=_[_0x0a6a('0x2b')](_0x21eb26[_0x0a6a('0x27')],qs[_0x0a6a('0x2d')](_0x4e05bc[_0x0a6a('0x28')][_0x0a6a('0x2d')]));_0x273e3b[_0x0a6a('0x2c')]=_0x273e3b[_0x0a6a('0x2c')][_0x0a6a('0x2e')]?_0x273e3b[_0x0a6a('0x2c')]:_0x21eb26[_0x0a6a('0x27')];if(_0x4e05bc[_0x0a6a('0x28')][_0x0a6a('0x36')]){_0x273e3b['include']=[{'all':!![]}];}_0x273e3b=_[_0x0a6a('0x35')]({},_0x273e3b,_0x4e05bc[_0x0a6a('0x3c')]);return db[_0x0a6a('0x23')][_0x0a6a('0x3d')](_0x273e3b)[_0x0a6a('0x14')](handleEntityNotFound(_0x5b6a08,null))[_0x0a6a('0x14')](respondWithResult(_0x5b6a08,null))[_0x0a6a('0x39')](handleError(_0x5b6a08,null));};exports[_0x0a6a('0x13')]=function(_0xef1792,_0x47d91e){return db[_0x0a6a('0x23')][_0x0a6a('0x3d')]({'where':{'id':_0xef1792['params']['id']}})[_0x0a6a('0x14')](handleEntityNotFound(_0x47d91e,null))[_0x0a6a('0x14')](removeEntity(_0x47d91e,null))[_0x0a6a('0x39')](handleError(_0x47d91e,null));};exports['create']=function(_0x5f2d88,_0x5e76de){if(_0x5f2d88[_0x0a6a('0x3e')][_0x0a6a('0x1e')]===_0x0a6a('0x18')&&!_[_0x0a6a('0x3f')](_0x5f2d88[_0x0a6a('0x3e')]['exten'],'_')){_0x5f2d88[_0x0a6a('0x3e')][_0x0a6a('0x40')]='_'['concat'](_0x5f2d88[_0x0a6a('0x3e')][_0x0a6a('0x40')]);}return db[_0x0a6a('0x23')][_0x0a6a('0x41')](_0x5f2d88['body'],{'raw':![]})[_0x0a6a('0x14')](function(_0x2ce7a2){var _0x2b5c1b=_0x5f2d88[_0x0a6a('0x42')][_0x0a6a('0x15')]({'plain':!![]});if(!_0x2b5c1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b5c1b[_0x0a6a('0x43')]===_0x0a6a('0x42')){var _0x413cb2=_0x2ce7a2[_0x0a6a('0x15')]({'plain':!![]});var _0x2b35fe=[{'name':_0x0a6a('0x16'),'value':_0x0a6a('0x17')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x0a6a('0x1a')}];var _0x2ce1b8=_[_0x0a6a('0x3d')](_0x2b35fe,['value',_0x413cb2[_0x0a6a('0x1e')]])[_0x0a6a('0x1f')];return db[_0x0a6a('0x44')][_0x0a6a('0x3d')]({'where':{'name':_0x2ce1b8,'userProfileId':_0x2b5c1b[_0x0a6a('0x45')]},'raw':!![]})[_0x0a6a('0x14')](function(_0x79c2b7){if(_0x79c2b7&&_0x79c2b7[_0x0a6a('0x46')]===0x0){return db[_0x0a6a('0x20')][_0x0a6a('0x41')]({'name':_0x413cb2[_0x0a6a('0x1f')],'resourceId':_0x413cb2['id'],'type':_0x79c2b7[_0x0a6a('0x1f')],'sectionId':_0x79c2b7['id']},{})[_0x0a6a('0x14')](function(){return _0x2ce7a2;});}else{return _0x2ce7a2;}})[_0x0a6a('0x39')](function(_0x500358){logger[_0x0a6a('0x47')](_0x0a6a('0x48'),_0x500358);throw _0x500358;});}return _0x2ce7a2;})[_0x0a6a('0x14')](respondWithResult(_0x5e76de,0xc9))[_0x0a6a('0x39')](handleError(_0x5e76de,null));};exports[_0x0a6a('0x49')]=function(_0x59309e,_0x3457d7){if(_0x59309e[_0x0a6a('0x3e')]['id']){delete _0x59309e['body']['id'];}return db['VoiceExtension'][_0x0a6a('0x3d')]({'where':{'id':_0x59309e[_0x0a6a('0x3b')]['id']}})[_0x0a6a('0x14')](handleEntityNotFound(_0x3457d7,null))['then'](function(_0x21b182){if(_0x21b182){return db[_0x0a6a('0x23')][_0x0a6a('0x49')](_[_0x0a6a('0x32')](_0x59309e[_0x0a6a('0x3e')],[_0x0a6a('0x40'),_0x0a6a('0x4a'),'description',_0x0a6a('0x4b'),_0x0a6a('0x4c'),_0x0a6a('0x4d'),_0x0a6a('0x4e')]),{'where':{'context':_0x21b182[_0x0a6a('0x4a')],'exten':_0x21b182[_0x0a6a('0x40')]},'individualHooks':!![]})['then'](function(_0x7bcafc){return _0x7bcafc;});}return null;})[_0x0a6a('0x14')](respondWithStatusCode(_0x3457d7,null))[_0x0a6a('0x39')](handleError(_0x3457d7,null));};exports[_0x0a6a('0x4f')]=function(_0x509ea8,_0x5c743d){var _0x5469df=_0x509ea8['params']['id'];var _0x1e69b4=_0x509ea8[_0x0a6a('0x3e')];var _0x46bdd5=0xc8;var _0x20f827=null;return db[_0x0a6a('0x50')][_0x0a6a('0x51')]({'isolationLevel':db['sequelize'][_0x0a6a('0x52')][_0x0a6a('0x53')][_0x0a6a('0x54')]},function(_0x28f411){return db['VoiceExtension'][_0x0a6a('0x55')]({'where':{'id':_0x5469df},'transaction':_0x28f411})[_0x0a6a('0x14')](function(_0x2ddfec){if(_0x2ddfec){return db[_0x0a6a('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x5469df},'transaction':_0x28f411})['then'](function(){var _0x395c37=_['map'](_0x1e69b4,function(_0x25e807){_0x25e807[_0x0a6a('0x56')]=_0x5469df;_0x25e807[_0x0a6a('0x57')]=!![];return _0x25e807;});return _0x2ddfec[_0x0a6a('0x58')](_0x395c37);})[_0x0a6a('0x14')](function(_0x1304e4){return db['VoiceExtension']['bulkCreate'](_0x1304e4,{'transaction':_0x28f411});});}else{_0x46bdd5=0x194;_0x20f827=[];}});})['then'](function(){if(_0x46bdd5!==0x194){return db[_0x0a6a('0x23')][_0x0a6a('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5469df},'order':_0x0a6a('0x5a')})[_0x0a6a('0x14')](function(_0x2af09f){_0x20f827=_0x2af09f;});}})[_0x0a6a('0x39')](function(_0x5008b5){_0x46bdd5=0x1f4;logger[_0x0a6a('0x47')](_0x5008b5[_0x0a6a('0x21')]);if(_0x5008b5['name']){delete _0x5008b5[_0x0a6a('0x1f')];}_0x20f827=_0x5008b5;})['finally'](function(){if(_0x20f827===null){_0x5c743d[_0x0a6a('0x9')](_0x46bdd5);}else{if(_0x46bdd5===0x1f4){_0x5c743d[_0x0a6a('0xa')](_0x46bdd5)[_0x0a6a('0x5b')](_0x20f827);}else{_0x5c743d[_0x0a6a('0xa')](_0x46bdd5)[_0x0a6a('0xc')](_0x20f827);}}});}; \ No newline at end of file +var _0x72f3=['VIRTUAL','options','includeAll','include','catch','params','find','destroy','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','OutboundRoutes','InternalRoutes','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','limit','undefined','count','set','then','get','inbound','outbound','internal','filter','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','map','VoiceExtension','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x72f3,0x184));var _0x372f=function(_0x20cdd2,_0x24da9b){_0x20cdd2=_0x20cdd2-0x0;var _0x8bd09e=_0x72f3[_0x20cdd2];return _0x8bd09e;};'use strict';var _=require('lodash');var Redis=require(_0x372f('0x0'));var qs=require(_0x372f('0x1'));var logger=require(_0x372f('0x2'))('api');var config=require(_0x372f('0x3'));var db=require('../../mysqldb')['db'];config[_0x372f('0x4')]=_[_0x372f('0x5')](config[_0x372f('0x4')],{'host':_0x372f('0x6'),'port':0x18eb});var socket=require(_0x372f('0x7'))(new Redis(config['redis']));require(_0x372f('0x8'))[_0x372f('0x9')](socket);function respondWithStatusCode(_0x3b815e,_0x480d4e){_0x480d4e=_0x480d4e||0xcc;return function(_0x46893e){if(_0x46893e){return _0x3b815e['sendStatus'](_0x480d4e);}return _0x3b815e[_0x372f('0xa')](_0x480d4e)[_0x372f('0xb')]();};}function respondWithResult(_0x45de67,_0x3ca8f3){_0x3ca8f3=_0x3ca8f3||0xc8;return function(_0x504862){if(_0x504862){return _0x45de67[_0x372f('0xa')](_0x3ca8f3)[_0x372f('0xc')](_0x504862);}};}function respondWithFilteredResult(_0x50059a,_0x3f7fde){return function(_0x4827f3){if(_0x4827f3){var _0x100258=typeof _0x3f7fde[_0x372f('0xd')]==='undefined'&&typeof _0x3f7fde[_0x372f('0xe')]===_0x372f('0xf');var _0x309b43=_0x4827f3[_0x372f('0x10')];var _0x4b01b1=_0x100258?0x0:_0x3f7fde[_0x372f('0xd')];var _0x100df3=_0x100258?_0x4827f3[_0x372f('0x10')]:_0x3f7fde[_0x372f('0xd')]+_0x3f7fde[_0x372f('0xe')];var _0x49a4e9;if(_0x100df3>=_0x309b43){_0x100df3=_0x309b43;_0x49a4e9=0xc8;}else{_0x49a4e9=0xce;}_0x50059a[_0x372f('0xa')](_0x49a4e9);return _0x50059a[_0x372f('0x11')]('Content-Range',_0x4b01b1+'-'+_0x100df3+'/'+_0x309b43)['json'](_0x4827f3);}return null;};}function removeEntity(_0x23319d){return function(_0x6c6026){if(_0x6c6026){return _0x6c6026['destroy']()[_0x372f('0x12')](function(){var _0x133532=_0x6c6026[_0x372f('0x13')]({'plain':!![]});var _0xad94a1=[{'name':'InboundRoutes','value':_0x372f('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':_0x372f('0x15'),'ignore':![]},{'name':'InternalRoutes','value':_0x372f('0x16'),'ignore':![]}];var _0xe0dd88=_(_0xad94a1)[_0x372f('0x17')]('ignore')['map']('value')[_0x372f('0x18')]();if(_[_0x372f('0x19')](_0xe0dd88,_0x133532[_0x372f('0x1a')])){return;}var _0x1cd804=_['find'](_0xad94a1,[_0x372f('0x18'),_0x133532[_0x372f('0x1a')]])[_0x372f('0x1b')];return db[_0x372f('0x1c')]['destroy']({'where':{'type':_0x1cd804,'resourceId':_0x133532['id']}})[_0x372f('0x12')](function(){return _0x6c6026;});})[_0x372f('0x12')](function(){_0x23319d[_0x372f('0xa')](0xcc)[_0x372f('0xb')]();});}};}function handleEntityNotFound(_0x3a2a4b){return function(_0x3d58b9){if(!_0x3d58b9){_0x3a2a4b[_0x372f('0x1d')](0x194);}return _0x3d58b9;};}function handleError(_0x1c7741,_0x17a822){_0x17a822=_0x17a822||0x1f4;return function(_0x3b2e2a){logger[_0x372f('0x1e')](_0x3b2e2a[_0x372f('0x1f')]);if(_0x3b2e2a[_0x372f('0x1b')]){delete _0x3b2e2a[_0x372f('0x1b')];}_0x1c7741[_0x372f('0xa')](_0x17a822)[_0x372f('0x20')](_0x3b2e2a);};}exports[_0x372f('0x21')]=function(_0x29963d,_0x4b66af){var _0x3b1bc1={},_0x246614={},_0x5750a0={'count':0x0,'rows':[]};var _0x1c9af1=_[_0x372f('0x22')](db[_0x372f('0x23')][_0x372f('0x24')],function(_0x5ebb0c){return{'name':_0x5ebb0c[_0x372f('0x25')],'type':_0x5ebb0c['type']['key']};});_0x246614[_0x372f('0x26')]=_[_0x372f('0x22')](_0x1c9af1,'name');_0x246614['query']=_[_0x372f('0x27')](_0x29963d['query']);_0x246614[_0x372f('0x28')]=_[_0x372f('0x29')](_0x246614[_0x372f('0x26')],_0x246614[_0x372f('0x2a')]);_0x3b1bc1[_0x372f('0x2b')]=_['intersection'](_0x246614[_0x372f('0x26')],qs[_0x372f('0x2c')](_0x29963d[_0x372f('0x2a')][_0x372f('0x2c')]));_0x3b1bc1[_0x372f('0x2b')]=_0x3b1bc1[_0x372f('0x2b')][_0x372f('0x2d')]?_0x3b1bc1[_0x372f('0x2b')]:_0x246614[_0x372f('0x26')];if(!_0x29963d[_0x372f('0x2a')][_0x372f('0x2e')](_0x372f('0x2f'))){_0x3b1bc1['limit']=qs[_0x372f('0xe')](_0x29963d[_0x372f('0x2a')][_0x372f('0xe')]);_0x3b1bc1[_0x372f('0xd')]=qs[_0x372f('0xd')](_0x29963d[_0x372f('0x2a')][_0x372f('0xd')]);}_0x3b1bc1[_0x372f('0x30')]=qs[_0x372f('0x31')](_0x29963d[_0x372f('0x2a')][_0x372f('0x31')]);_0x3b1bc1['where']=qs[_0x372f('0x28')](_['pick'](_0x29963d['query'],_0x246614[_0x372f('0x28')]),_0x1c9af1);if(_0x29963d[_0x372f('0x2a')]['filter']){_0x3b1bc1[_0x372f('0x32')]=_[_0x372f('0x33')](_0x3b1bc1[_0x372f('0x32')],{'$or':_[_0x372f('0x22')](_0x1c9af1,function(_0x769f92){if(_0x769f92['type']!==_0x372f('0x34')){var _0x48bee4={};_0x48bee4[_0x769f92[_0x372f('0x1b')]]={'$like':'%'+_0x29963d[_0x372f('0x2a')][_0x372f('0x17')]+'%'};return _0x48bee4;}})});}_0x3b1bc1=_[_0x372f('0x33')]({},_0x3b1bc1,_0x29963d[_0x372f('0x35')]);var _0x567001={'where':_0x3b1bc1[_0x372f('0x32')]};return db[_0x372f('0x23')][_0x372f('0x10')](_0x567001)[_0x372f('0x12')](function(_0x3adce9){_0x5750a0[_0x372f('0x10')]=_0x3adce9;if(_0x29963d[_0x372f('0x2a')][_0x372f('0x36')]){_0x3b1bc1[_0x372f('0x37')]=[{'all':!![]}];}return db[_0x372f('0x23')]['findAll'](_0x3b1bc1);})[_0x372f('0x12')](function(_0x1936b7){_0x5750a0['rows']=_0x1936b7;return _0x5750a0;})[_0x372f('0x12')](respondWithFilteredResult(_0x4b66af,_0x3b1bc1))[_0x372f('0x38')](handleError(_0x4b66af,null));};exports['show']=function(_0x2878b9,_0x5de753){var _0x5d5b40={'raw':![],'where':{'id':_0x2878b9[_0x372f('0x39')]['id']}},_0x3f5826={};_0x3f5826[_0x372f('0x26')]=_['keys'](db[_0x372f('0x23')][_0x372f('0x24')]);_0x3f5826['query']=_[_0x372f('0x27')](_0x2878b9[_0x372f('0x2a')]);_0x3f5826[_0x372f('0x28')]=_[_0x372f('0x29')](_0x3f5826[_0x372f('0x26')],_0x3f5826['query']);_0x5d5b40[_0x372f('0x2b')]=_[_0x372f('0x29')](_0x3f5826[_0x372f('0x26')],qs[_0x372f('0x2c')](_0x2878b9['query']['fields']));_0x5d5b40[_0x372f('0x2b')]=_0x5d5b40[_0x372f('0x2b')][_0x372f('0x2d')]?_0x5d5b40[_0x372f('0x2b')]:_0x3f5826['model'];if(_0x2878b9[_0x372f('0x2a')]['includeAll']){_0x5d5b40['include']=[{'all':!![]}];}_0x5d5b40=_[_0x372f('0x33')]({},_0x5d5b40,_0x2878b9[_0x372f('0x35')]);return db[_0x372f('0x23')][_0x372f('0x3a')](_0x5d5b40)[_0x372f('0x12')](handleEntityNotFound(_0x5de753,null))[_0x372f('0x12')](respondWithResult(_0x5de753,null))[_0x372f('0x38')](handleError(_0x5de753,null));};exports[_0x372f('0x3b')]=function(_0x420bf7,_0x2202f6){return db[_0x372f('0x23')]['find']({'where':{'id':_0x420bf7[_0x372f('0x39')]['id']}})[_0x372f('0x12')](handleEntityNotFound(_0x2202f6,null))['then'](removeEntity(_0x2202f6,null))['catch'](handleError(_0x2202f6,null));};exports[_0x372f('0x3c')]=function(_0x22382e,_0x89595a){if(_0x22382e[_0x372f('0x3d')][_0x372f('0x1a')]===_0x372f('0x15')&&!_[_0x372f('0x3e')](_0x22382e[_0x372f('0x3d')][_0x372f('0x3f')],'_')){_0x22382e[_0x372f('0x3d')][_0x372f('0x3f')]='_'['concat'](_0x22382e[_0x372f('0x3d')][_0x372f('0x3f')]);}return db['VoiceExtension'][_0x372f('0x3c')](_0x22382e[_0x372f('0x3d')],{'raw':![]})[_0x372f('0x12')](function(_0xddfff8){var _0x181778=_0x22382e['user'][_0x372f('0x13')]({'plain':!![]});if(!_0x181778)throw new Error(_0x372f('0x40'));if(_0x181778[_0x372f('0x41')]===_0x372f('0x42')){var _0x11425b=_0xddfff8['get']({'plain':!![]});var _0x566e1d=[{'name':_0x372f('0x43'),'value':_0x372f('0x14')},{'name':_0x372f('0x44'),'value':_0x372f('0x15')},{'name':_0x372f('0x45'),'value':'internal'}];var _0x57dfc0=_[_0x372f('0x3a')](_0x566e1d,[_0x372f('0x18'),_0x11425b[_0x372f('0x1a')]])[_0x372f('0x1b')];return db['UserProfileSection']['find']({'where':{'name':_0x57dfc0,'userProfileId':_0x181778['userProfileId']},'raw':!![]})[_0x372f('0x12')](function(_0x14d72d){if(_0x14d72d&&_0x14d72d['autoAssociation']===0x0){return db[_0x372f('0x1c')][_0x372f('0x3c')]({'name':_0x11425b[_0x372f('0x1b')],'resourceId':_0x11425b['id'],'type':_0x14d72d['name'],'sectionId':_0x14d72d['id']},{})['then'](function(){return _0xddfff8;});}else{return _0xddfff8;}})[_0x372f('0x38')](function(_0x51aca4){logger[_0x372f('0x1e')](_0x372f('0x46'),_0x51aca4);throw _0x51aca4;});}return _0xddfff8;})[_0x372f('0x12')](respondWithResult(_0x89595a,0xc9))[_0x372f('0x38')](handleError(_0x89595a,null));};exports['update']=function(_0x1aa6b0,_0x59f9a4){if(_0x1aa6b0[_0x372f('0x3d')]['id']){delete _0x1aa6b0[_0x372f('0x3d')]['id'];}return db[_0x372f('0x23')][_0x372f('0x3a')]({'where':{'id':_0x1aa6b0[_0x372f('0x39')]['id']}})['then'](handleEntityNotFound(_0x59f9a4,null))[_0x372f('0x12')](function(_0x466945){if(_0x466945){return db['VoiceExtension'][_0x372f('0x47')](_['pick'](_0x1aa6b0[_0x372f('0x3d')],[_0x372f('0x3f'),_0x372f('0x48'),'description',_0x372f('0x49'),_0x372f('0x4a'),_0x372f('0x4b'),_0x372f('0x4c')]),{'where':{'context':_0x466945[_0x372f('0x48')],'exten':_0x466945[_0x372f('0x3f')]},'individualHooks':!![]})[_0x372f('0x12')](function(_0x15fc41){return _0x15fc41;});}return null;})[_0x372f('0x12')](respondWithStatusCode(_0x59f9a4,null))[_0x372f('0x38')](handleError(_0x59f9a4,null));};exports[_0x372f('0x4d')]=function(_0x22fd9d,_0x233a2b){var _0x340141=_0x22fd9d['params']['id'];var _0x280466=_0x22fd9d['body'];var _0x21a66f=0xc8;var _0x404d20=null;return db[_0x372f('0x4e')][_0x372f('0x4f')]({'isolationLevel':db[_0x372f('0x4e')]['Transaction'][_0x372f('0x50')][_0x372f('0x51')]},function(_0x3bf38a){return db[_0x372f('0x23')][_0x372f('0x52')]({'where':{'id':_0x340141},'transaction':_0x3bf38a})[_0x372f('0x12')](function(_0x48e02f){if(_0x48e02f){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x340141},'transaction':_0x3bf38a})[_0x372f('0x12')](function(){var _0x5f5bfc=_[_0x372f('0x22')](_0x280466,function(_0x47167d){_0x47167d[_0x372f('0x53')]=_0x340141;_0x47167d['isApp']=!![];return _0x47167d;});return _0x48e02f[_0x372f('0x54')](_0x5f5bfc);})['then'](function(_0xe6c27b){return db[_0x372f('0x23')][_0x372f('0x55')](_0xe6c27b,{'transaction':_0x3bf38a});});}else{_0x21a66f=0x194;_0x404d20=[];}});})[_0x372f('0x12')](function(){if(_0x21a66f!==0x194){return db[_0x372f('0x23')][_0x372f('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x340141},'order':_0x372f('0x57')})[_0x372f('0x12')](function(_0x17407d){_0x404d20=_0x17407d;});}})['catch'](function(_0xbbcaac){_0x21a66f=0x1f4;logger[_0x372f('0x1e')](_0xbbcaac[_0x372f('0x1f')]);if(_0xbbcaac[_0x372f('0x1b')]){delete _0xbbcaac[_0x372f('0x1b')];}_0x404d20=_0xbbcaac;})['finally'](function(){if(_0x404d20===null){_0x233a2b[_0x372f('0x1d')](_0x21a66f);}else{if(_0x21a66f===0x1f4){_0x233a2b['status'](_0x21a66f)[_0x372f('0x20')](_0x404d20);}else{_0x233a2b[_0x372f('0xa')](_0x21a66f)['json'](_0x404d20);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4bc9c94..00914ec 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 _0x33de=['exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x9737f6,_0x3fee5b){var _0x3f4f67=function(_0x11cfaf){while(--_0x11cfaf){_0x9737f6['push'](_0x9737f6['shift']());}};_0x3f4f67(++_0x3fee5b);}(_0x33de,0x10f));var _0xe33d=function(_0x173465,_0x3e4f73){_0x173465=_0x173465-0x0;var _0x5d3808=_0x33de[_0x173465];return _0x5d3808;};'use strict';var EventEmitter=require(_0xe33d('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xe33d('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe33d('0x2')](0x0);var events={'afterCreate':_0xe33d('0x3'),'afterUpdate':_0xe33d('0x4'),'afterDestroy':_0xe33d('0x5')};function emitEvent(_0x271d18){return function(_0x2e7814,_0x1bc8bc,_0x1217ff){VoiceExtensionEvents[_0xe33d('0x6')](_0x271d18+':'+_0x2e7814['id'],_0x2e7814);VoiceExtensionEvents[_0xe33d('0x6')](_0x271d18,_0x2e7814);_0x1217ff(null);};}for(var e in events){if(events[_0xe33d('0x7')](e)){var event=events[e];VoiceExtension[_0xe33d('0x8')](e,emitEvent(event));}}module[_0xe33d('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd556=['emit','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove'];(function(_0x31688a,_0x588c7d){var _0xc7b088=function(_0x3ed4c8){while(--_0x3ed4c8){_0x31688a['push'](_0x31688a['shift']());}};_0xc7b088(++_0x588c7d);}(_0xd556,0xba));var _0x6d55=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd556[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6d55('0x0'));var VoiceExtension=require(_0x6d55('0x1'))['db'][_0x6d55('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6d55('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d55('0x4'),'afterDestroy':_0x6d55('0x5')};function emitEvent(_0x195d2e){return function(_0x477d6c,_0x4c4c24,_0x20119e){VoiceExtensionEvents[_0x6d55('0x6')](_0x195d2e+':'+_0x477d6c['id'],_0x477d6c);VoiceExtensionEvents[_0x6d55('0x6')](_0x195d2e,_0x477d6c);_0x20119e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6d55('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 7773627..f8b305c 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 _0x5c38=['length','name','param','split','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','priority','last','catch','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','alias','NoOp','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x5c38,0x1f0));var _0x85c3=function(_0x2291f0,_0x4261c7){_0x2291f0=_0x2291f0-0x0;var _0x2dc1e4=_0x5c38[_0x2291f0];return _0x2dc1e4;};'use strict';var _=require(_0x85c3('0x0'));var attributes=require(_0x85c3('0x1'));module[_0x85c3('0x2')]=function(_0x1b67a0){var _0x5548c2=_0x1b67a0[_0x85c3('0x3')];function _0xd5e9f8(_0x48aea2){var _0x3d4149=0x2;var _0x4aec29=[{'type':_0x48aea2[_0x85c3('0x4')],'app':_0x85c3('0x5'),'appdata':_0x85c3('0x6')+_0x48aea2[_0x85c3('0x4')],'context':_0x48aea2[_0x85c3('0x7')],'exten':_0x48aea2['exten'],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']},{'type':_0x48aea2[_0x85c3('0x4')],'app':_0x48aea2[_0x85c3('0x8')]?_0x85c3('0x5'):_0x85c3('0x9'),'appdata':_0x48aea2[_0x85c3('0x8')]?'CDR(routeAlias)='+_0x48aea2[_0x85c3('0x8')]:_0x85c3('0xa'),'context':_0x48aea2[_0x85c3('0x7')],'exten':_0x48aea2[_0x85c3('0xb')],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']}];if(_0x48aea2[_0x85c3('0x4')]===_0x85c3('0xc')){_0x4aec29[_0x85c3('0xd')]({'type':'inbound','app':_0x85c3('0x5'),'appdata':'CDR(routeid)='+_0x48aea2['id'],'context':_0x48aea2['context'],'exten':_0x48aea2[_0x85c3('0xb')],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']});}_0x4aec29[_0x85c3('0xd')]({'type':_0x48aea2[_0x85c3('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48aea2[_0x85c3('0x7')],'exten':_0x48aea2[_0x85c3('0xb')],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']},{'type':_0x48aea2[_0x85c3('0x4')],'app':'Set','appdata':_0x85c3('0xe'),'context':_0x48aea2[_0x85c3('0x7')],'exten':_0x48aea2[_0x85c3('0xb')],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']},{'type':_0x48aea2[_0x85c3('0x4')],'app':'Set','appdata':_0x85c3('0xf'),'context':_0x48aea2[_0x85c3('0x7')],'exten':_0x48aea2[_0x85c3('0xb')],'priority':_0x3d4149++,'VoiceExtensionId':_0x48aea2['id']});return _0x4aec29;}function _0x1571de(_0x3dee86){var _0x58cb89=0x2;var _0x41ba5d=[{'type':'outbound','app':_0x85c3('0x5'),'appdata':_0x85c3('0x10'),'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':_0x3dee86[_0x85c3('0x8')]?_0x85c3('0x5'):_0x85c3('0x9'),'appdata':_0x3dee86[_0x85c3('0x8')]?_0x85c3('0x12')+_0x3dee86[_0x85c3('0x8')]:'No\x20alias\x20set','context':_0x3dee86['context'],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':_0x85c3('0x5'),'appdata':_0x85c3('0x13')+(_0x3dee86[_0x85c3('0x14')]?_0x85c3('0x15')+_0x3dee86['cutdigits']+'}':_0x85c3('0x16')),'context':_0x3dee86['context'],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':'outbound','app':_0x85c3('0x5'),'appdata':'CDR(routeid)='+_0x3dee86['id'],'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':_0x85c3('0x17'),'appdata':_0x85c3('0x18')+(_0x58cb89+0x2)+_0x85c3('0x19')+(_0x58cb89+0x1)+')','context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':'Set','appdata':_0x3dee86[_0x85c3('0x14')]?'CDR(prefix)=${EXTEN:0:'+_0x3dee86[_0x85c3('0x14')]+'}':_0x85c3('0x1a'),'context':_0x3dee86['context'],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':'Set','appdata':_0x85c3('0x1b'),'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':_0x85c3('0x5'),'appdata':_0x85c3('0xe'),'context':_0x3dee86['context'],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':_0x85c3('0x11'),'app':_0x85c3('0x5'),'appdata':_0x85c3('0xf'),'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':'outbound','app':_0x85c3('0x5'),'appdata':_0x85c3('0x1c')+_0x3dee86['id'],'context':_0x3dee86['context'],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']}];if(_0x3dee86['hasOwnProperty'](_0x85c3('0x1d'))&&_0x3dee86['recordingFormat']!==_0x85c3('0x1e')){_0x41ba5d[_0x85c3('0xd')]({'type':_0x85c3('0x11'),'app':_0x85c3('0x5'),'appdata':_0x85c3('0x1f'),'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86[_0x85c3('0xb')],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']},{'type':'outbound','app':'Set','appdata':_0x85c3('0x20')+_0x3dee86[_0x85c3('0x1d')]||_0x85c3('0x21'),'context':_0x3dee86[_0x85c3('0x7')],'exten':_0x3dee86['exten'],'priority':_0x58cb89++,'VoiceExtensionId':_0x3dee86['id']});}return _0x41ba5d;}function _0x138df5(_0x52d19e,_0x26b1e7){var _0x2ffac4=[{'name':_0x85c3('0x22'),'param':0x0},{'name':_0x85c3('0x23'),'param':0x1},{'name':_0x85c3('0x24'),'param':0x2},{'name':_0x85c3('0x25'),'param':0x3}];var _0x1eeb06={};var _0x3079bc=_0x26b1e7['split'](',');var _0x19a6f0=[];for(var _0x3cb3d7=0x0;_0x3cb3d7<_0x2ffac4[_0x85c3('0x26')];_0x3cb3d7++){switch(_0x2ffac4[_0x3cb3d7][_0x85c3('0x27')]){case'trunk':_0x1eeb06['trunk']=_0x3079bc[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]][_0x85c3('0x29')]('/')[0x1];_0x1eeb06['phone']=_0x3079bc[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]][_0x85c3('0x29')]('/')[0x2];_0x1eeb06[_0x85c3('0x2a')]=_0x1eeb06[_0x85c3('0x2b')]?_0x1eeb06[_0x85c3('0x2b')][_0x85c3('0x29')]('$')[0x0]:undefined;_0x1eeb06[_0x85c3('0x2b')]=_0x52d19e[_0x85c3('0x14')]?(_0x1eeb06[_0x85c3('0x2a')]||'')+_0x85c3('0x15')+_0x52d19e['cutdigits']+'}':(_0x1eeb06[_0x85c3('0x2a')]||'')+'${EXTEN}';_0x19a6f0[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]]=[_0x85c3('0x2c'),_0x1eeb06['trunk'],_0x1eeb06['phone']][_0x85c3('0x2d')]('/');break;case _0x85c3('0x24'):_0x1eeb06[_0x85c3('0x24')]=_0x3079bc[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]];if(_0x52d19e[_0x85c3('0x1d')]!=='none'){if(_0x1eeb06[_0x85c3('0x24')][_0x85c3('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x1eeb06[_0x85c3('0x24')]+=_0x85c3('0x2f');}}else{_0x1eeb06[_0x85c3('0x24')]=_0x1eeb06[_0x85c3('0x24')][_0x85c3('0x30')](_0x85c3('0x2f'),'');}_0x19a6f0[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]]=_0x1eeb06[_0x85c3('0x24')];break;default:_0x19a6f0[_0x2ffac4[_0x3cb3d7][_0x85c3('0x28')]]=_0x3079bc[_0x2ffac4[_0x3cb3d7]['param']];}}return _0x19a6f0['join'](',');}function _0xdf5083(_0xe073,_0x341353,_0x4d9000){return new Promise(function(_0x5178a9,_0x44af5b){var _0x303d75=[];if(_[_0x85c3('0x31')](_0x341353))return _0x5178a9(_0x303d75);_0x5548c2[_0x85c3('0x32')][_0x85c3('0x33')]({'attributes':['id',_0x85c3('0x34'),_0x85c3('0x35')],'raw':!![]})[_0x85c3('0x36')](function(_0x4761e5){for(var _0x5f38ec=0x0,_0x25ae80=0x0;_0x5f38ec<_0x341353[_0x85c3('0x26')];_0x5f38ec++,_0x25ae80=0x0){var _0x179e44=_0x341353[_0x5f38ec];var _0x542ca8=[];var _0x237ba2=[];delete _0x179e44['id'];if(_0x179e44[_0x85c3('0x34')]!==_0x85c3('0x37')){_0x179e44['intervals']=[_0x179e44[_0x85c3('0x34')]];}else{_0x179e44[_0x85c3('0x38')]=_0x179e44[_0x85c3('0x35')]?_['map'](_[_0x85c3('0x39')](_0x4761e5,{'IntervalId':_0x179e44[_0x85c3('0x35')]}),_0x85c3('0x34')):[];}_0x179e44[_0x85c3('0x7')]=_0xe073[_0x85c3('0x7')];_0x179e44[_0x85c3('0xb')]=_0xe073[_0x85c3('0xb')];if(_0x179e44[_0x85c3('0x4')])_0x179e44[_0x85c3('0x4')]=_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')]();if(_0xe073[_0x85c3('0x4')]===_0x85c3('0x11')){if(_0x179e44[_0x85c3('0x3b')](_0x85c3('0x3c'))&&_0x179e44[_0x85c3('0x3c')]&&_0x179e44[_0x85c3('0x3c')]!=='--'){_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44['type']['toLowerCase'](),'app':'Set','appdata':_0x85c3('0x3d')+_0x179e44['tag'],'context':_0xe073[_0x85c3('0x7')],'exten':_0xe073['exten'],'priority':_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});}_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')](),'app':_0x85c3('0x17'),'appdata':_0x85c3('0x3e')+(_0x179e44[_0x85c3('0x3f')]?_0x85c3('0x40')+_0x179e44['callerID']+')':_0x85c3('0x41')),'context':_0xe073['context'],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});}else{if(_0x179e44['hasOwnProperty']('answer')){if([_0x85c3('0x42'),_0x85c3('0x43')][_0x85c3('0x44')](_0x179e44[_0x85c3('0x45')][_0x85c3('0x3a')]())&&_0x179e44['appType']!==_0x85c3('0x46')){if(_0x179e44[_0x85c3('0x47')]){_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44['type'][_0x85c3('0x3a')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xe073[_0x85c3('0x7')],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44[_0x85c3('0x38')]['length']+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')](),'app':_0x85c3('0x5'),'appdata':_0x85c3('0x48'),'context':_0xe073[_0x85c3('0x7')],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44['intervals'][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});}else{_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')](),'app':_0x85c3('0x17'),'appdata':_0x85c3('0x49'),'context':_0xe073[_0x85c3('0x7')],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});_0x542ca8['push']({'type':_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')](),'app':_0x85c3('0x5'),'appdata':_0x85c3('0x4a'),'context':_0xe073[_0x85c3('0x7')],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});}}}}for(var _0x57d37f=0x0;_0x57d37f<_0x179e44[_0x85c3('0x38')]['length'];_0x57d37f++){var _0x41c3c9=_0x4d9000+_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')];var _0x1a90f2=_0x57d37f===_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]-0x1?_0x4d9000+_0x542ca8[_0x85c3('0x26')]+_0x237ba2[_0x85c3('0x26')]+0x2:_0x4d9000+_0x57d37f+0x1;_0x542ca8[_0x85c3('0x4b')](_0x57d37f,0x0,{'type':_0xe073['type'],'app':'GotoIfTime','appdata':_0x179e44[_0x85c3('0x38')][_0x57d37f]+'?'+_0xe073['context']+_0x85c3('0x4c')+_0x41c3c9+':'+_0xe073[_0x85c3('0x7')]+',${EXTEN},'+_0x1a90f2,'exten':_0xe073[_0x85c3('0xb')],'context':_0xe073[_0x85c3('0x7')],'priority':_0x4d9000+_0x57d37f,'VoiceExtensionId':_0xe073['id']});}if(_0x179e44[_0x85c3('0x4d')]===_0x85c3('0x4e')){_0x179e44[_0x85c3('0x4f')]=_0x138df5(_0xe073,_0x179e44[_0x85c3('0x4f')]);}if(_0x179e44[_0x85c3('0x4d')]===_0x85c3('0x50')){_0x542ca8[_0x85c3('0xd')]({'type':_0x179e44[_0x85c3('0x4')][_0x85c3('0x3a')](),'app':_0x85c3('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0xe073[_0x85c3('0x7')],'exten':_0xe073[_0x85c3('0xb')],'priority':_0x179e44[_0x85c3('0x38')][_0x85c3('0x26')]+_0x4d9000+_0x25ae80++,'VoiceExtensionId':_0xe073['id']});}_0x179e44[_0x85c3('0x51')]=_0x542ca8[_0x85c3('0x26')]?_[_0x85c3('0x52')](_0x542ca8)[_0x85c3('0x51')]+0x1:_0x4d9000;_0x303d75=_['concat'](_0x303d75,_0x542ca8,[_0x179e44],_0x237ba2);_0x4d9000=_['last'](_0x303d75)[_0x85c3('0x51')]+0x1;}return _0x5178a9(_0x303d75);})[_0x85c3('0x53')](function(_0x1c0c42){_0x44af5b(_0x1c0c42);});});}return _0x1b67a0[_0x85c3('0x54')]('VoiceExtension',attributes,{'tableName':_0x85c3('0x55'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x21374c){var _0x2ae01b=this[_0x85c3('0x56')]({'plain':!![]});var _0x4cc8ca=_0x2ae01b[_0x85c3('0x4')]===_0x85c3('0x11')?_0x1571de(_0x2ae01b):_0xd5e9f8(_0x2ae01b);return _0xdf5083(_0x2ae01b,_0x21374c,_[_0x85c3('0x52')](_0x4cc8ca)[_0x85c3('0x51')]+0x1)[_0x85c3('0x36')](function(_0x583804){var _0x59e6b7=_[_0x85c3('0x57')](_0x4cc8ca,_0x583804);_0x59e6b7['push']({'type':_0x2ae01b[_0x85c3('0x4')],'app':_0x85c3('0x58'),'exten':_0x2ae01b[_0x85c3('0xb')],'context':_0x2ae01b[_0x85c3('0x7')],'priority':_[_0x85c3('0x52')](_0x59e6b7)[_0x85c3('0x51')]+0x1,'VoiceExtensionId':_0x2ae01b['id']});return _0x59e6b7;});}}});}; \ No newline at end of file +var _0xd2d9=['U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','length','*,*,*,*','intervals','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','then','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','NoOp','alias','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','phone','param','prefix','${EXTEN}','join','indexOf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd2d9,0x172));var _0x9d2d=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xd2d9[_0x3c7d53];return _0x2c8387;};'use strict';var _=require(_0x9d2d('0x0'));var attributes=require(_0x9d2d('0x1'));module[_0x9d2d('0x2')]=function(_0x4ac050){var _0x2dd675=_0x4ac050[_0x9d2d('0x3')];function _0x4f925f(_0x4f62){var _0x558536=0x2;var _0x540a08=[{'type':_0x4f62[_0x9d2d('0x4')],'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0x6')+_0x4f62[_0x9d2d('0x4')],'context':_0x4f62['context'],'exten':_0x4f62[_0x9d2d('0x7')],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']},{'type':_0x4f62[_0x9d2d('0x4')],'app':_0x4f62['alias']?'Set':_0x9d2d('0x8'),'appdata':_0x4f62['alias']?'CDR(routeAlias)='+_0x4f62[_0x9d2d('0x9')]:_0x9d2d('0xa'),'context':_0x4f62[_0x9d2d('0xb')],'exten':_0x4f62[_0x9d2d('0x7')],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']}];if(_0x4f62['type']===_0x9d2d('0xc')){_0x540a08[_0x9d2d('0xd')]({'type':_0x9d2d('0xc'),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0xe')+_0x4f62['id'],'context':_0x4f62['context'],'exten':_0x4f62[_0x9d2d('0x7')],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']});}_0x540a08[_0x9d2d('0xd')]({'type':_0x4f62[_0x9d2d('0x4')],'app':_0x9d2d('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4f62[_0x9d2d('0xb')],'exten':_0x4f62['exten'],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']},{'type':_0x4f62[_0x9d2d('0x4')],'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0xf'),'context':_0x4f62['context'],'exten':_0x4f62['exten'],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']},{'type':_0x4f62['type'],'app':_0x9d2d('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4f62['context'],'exten':_0x4f62[_0x9d2d('0x7')],'priority':_0x558536++,'VoiceExtensionId':_0x4f62['id']});return _0x540a08;}function _0x16977a(_0x5d1905){var _0x523d25=0x2;var _0x13185e=[{'type':_0x9d2d('0x10'),'app':'Set','appdata':_0x9d2d('0x11'),'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x5d1905[_0x9d2d('0x9')]?_0x9d2d('0x5'):'NoOp','appdata':_0x5d1905[_0x9d2d('0x9')]?_0x9d2d('0x12')+_0x5d1905[_0x9d2d('0x9')]:'No\x20alias\x20set','context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':'Set','appdata':_0x9d2d('0x13')+(_0x5d1905['cutdigits']?_0x9d2d('0x14')+_0x5d1905[_0x9d2d('0x15')]+'}':'${EXTEN}'),'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905['exten'],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0xe')+_0x5d1905['id'],'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':'outbound','app':_0x9d2d('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x523d25+0x2)+_0x9d2d('0x17')+(_0x523d25+0x1)+')','context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':_0x5d1905[_0x9d2d('0x15')]?_0x9d2d('0x18')+_0x5d1905[_0x9d2d('0x15')]+'}':_0x9d2d('0x19'),'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':'outbound','app':_0x9d2d('0x5'),'appdata':_0x9d2d('0xf'),'context':_0x5d1905['context'],'exten':_0x5d1905['exten'],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905['exten'],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0x1a')+_0x5d1905['id'],'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']}];if(_0x5d1905[_0x9d2d('0x1b')](_0x9d2d('0x1c'))&&_0x5d1905[_0x9d2d('0x1c')]!==_0x9d2d('0x1d')){_0x13185e[_0x9d2d('0xd')]({'type':_0x9d2d('0x10'),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0x1e'),'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']},{'type':_0x9d2d('0x10'),'app':'Set','appdata':_0x9d2d('0x1f')+_0x5d1905[_0x9d2d('0x1c')]||_0x9d2d('0x20'),'context':_0x5d1905[_0x9d2d('0xb')],'exten':_0x5d1905[_0x9d2d('0x7')],'priority':_0x523d25++,'VoiceExtensionId':_0x5d1905['id']});}return _0x13185e;}function _0x5603dd(_0x4a6ccb,_0x32ad69){var _0x7acd89=[{'name':_0x9d2d('0x21'),'param':0x0},{'name':_0x9d2d('0x22'),'param':0x1},{'name':_0x9d2d('0x23'),'param':0x2},{'name':_0x9d2d('0x24'),'param':0x3}];var _0x4dc87a={};var _0x3f064b=_0x32ad69[_0x9d2d('0x25')](',');var _0x6bd180=[];for(var _0x5869ba=0x0;_0x5869ba<_0x7acd89['length'];_0x5869ba++){switch(_0x7acd89[_0x5869ba][_0x9d2d('0x26')]){case _0x9d2d('0x21'):_0x4dc87a[_0x9d2d('0x21')]=_0x3f064b[_0x7acd89[_0x5869ba]['param']][_0x9d2d('0x25')]('/')[0x1];_0x4dc87a[_0x9d2d('0x27')]=_0x3f064b[_0x7acd89[_0x5869ba][_0x9d2d('0x28')]][_0x9d2d('0x25')]('/')[0x2];_0x4dc87a['prefix']=_0x4dc87a['phone']?_0x4dc87a[_0x9d2d('0x27')][_0x9d2d('0x25')]('$')[0x0]:undefined;_0x4dc87a[_0x9d2d('0x27')]=_0x4a6ccb[_0x9d2d('0x15')]?(_0x4dc87a[_0x9d2d('0x29')]||'')+_0x9d2d('0x14')+_0x4a6ccb[_0x9d2d('0x15')]+'}':(_0x4dc87a['prefix']||'')+_0x9d2d('0x2a');_0x6bd180[_0x7acd89[_0x5869ba][_0x9d2d('0x28')]]=['SIP',_0x4dc87a[_0x9d2d('0x21')],_0x4dc87a['phone']][_0x9d2d('0x2b')]('/');break;case _0x9d2d('0x23'):_0x4dc87a[_0x9d2d('0x23')]=_0x3f064b[_0x7acd89[_0x5869ba]['param']];if(_0x4a6ccb[_0x9d2d('0x1c')]!=='none'){if(_0x4dc87a[_0x9d2d('0x23')][_0x9d2d('0x2c')](_0x9d2d('0x2d'))<0x0){_0x4dc87a['options']+=_0x9d2d('0x2d');}}else{_0x4dc87a[_0x9d2d('0x23')]=_0x4dc87a[_0x9d2d('0x23')][_0x9d2d('0x2e')]('U(xcally-mixmonitor-context)','');}_0x6bd180[_0x7acd89[_0x5869ba][_0x9d2d('0x28')]]=_0x4dc87a[_0x9d2d('0x23')];break;default:_0x6bd180[_0x7acd89[_0x5869ba]['param']]=_0x3f064b[_0x7acd89[_0x5869ba][_0x9d2d('0x28')]];}}return _0x6bd180[_0x9d2d('0x2b')](',');}function _0x4f58ef(_0xa60513,_0x29c77f,_0x3955c9){return new Promise(function(_0x5f8660,_0x11db24){var _0x2a2dda=[];if(_[_0x9d2d('0x2f')](_0x29c77f))return _0x5f8660(_0x2a2dda);_0x2dd675[_0x9d2d('0x30')][_0x9d2d('0x31')]({'attributes':['id',_0x9d2d('0x32'),_0x9d2d('0x33')],'raw':!![]})['then'](function(_0x5e85ed){for(var _0x3df4ac=0x0,_0x3ab057=0x0;_0x3df4ac<_0x29c77f[_0x9d2d('0x34')];_0x3df4ac++,_0x3ab057=0x0){var _0xb23a09=_0x29c77f[_0x3df4ac];var _0x5baff5=[];var _0x259fda=[];delete _0xb23a09['id'];if(_0xb23a09[_0x9d2d('0x32')]!==_0x9d2d('0x35')){_0xb23a09[_0x9d2d('0x36')]=[_0xb23a09[_0x9d2d('0x32')]];}else{_0xb23a09[_0x9d2d('0x36')]=_0xb23a09['IntervalId']?_['map'](_['filter'](_0x5e85ed,{'IntervalId':_0xb23a09[_0x9d2d('0x33')]}),'interval'):[];}_0xb23a09[_0x9d2d('0xb')]=_0xa60513[_0x9d2d('0xb')];_0xb23a09[_0x9d2d('0x7')]=_0xa60513[_0x9d2d('0x7')];if(_0xb23a09[_0x9d2d('0x4')])_0xb23a09[_0x9d2d('0x4')]=_0xb23a09[_0x9d2d('0x4')][_0x9d2d('0x37')]();if(_0xa60513['type']===_0x9d2d('0x10')){if(_0xb23a09[_0x9d2d('0x1b')](_0x9d2d('0x38'))&&_0xb23a09[_0x9d2d('0x38')]&&_0xb23a09[_0x9d2d('0x38')]!=='--'){_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09[_0x9d2d('0x4')]['toLowerCase'](),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0x39')+_0xb23a09['tag'],'context':_0xa60513[_0x9d2d('0xb')],'exten':_0xa60513['exten'],'priority':_0xb23a09['intervals'][_0x9d2d('0x34')]+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});}_0x5baff5['push']({'type':_0xb23a09['type'][_0x9d2d('0x37')](),'app':_0x9d2d('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xb23a09[_0x9d2d('0x3a')]?_0x9d2d('0x3b')+_0xb23a09[_0x9d2d('0x3a')]+')':_0x9d2d('0x3c')),'context':_0xa60513['context'],'exten':_0xa60513['exten'],'priority':_0xb23a09['intervals'][_0x9d2d('0x34')]+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});}else{if(_0xb23a09[_0x9d2d('0x1b')](_0x9d2d('0x3d'))){if([_0x9d2d('0x3e'),_0x9d2d('0x3f')][_0x9d2d('0x40')](_0xb23a09['app']['toLowerCase']())&&_0xb23a09[_0x9d2d('0x41')]!==_0x9d2d('0x42')){if(_0xb23a09[_0x9d2d('0x3d')]){_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09[_0x9d2d('0x4')][_0x9d2d('0x37')](),'app':_0x9d2d('0x16'),'appdata':_0x9d2d('0x43'),'context':_0xa60513[_0x9d2d('0xb')],'exten':_0xa60513[_0x9d2d('0x7')],'priority':_0xb23a09[_0x9d2d('0x36')]['length']+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09[_0x9d2d('0x4')][_0x9d2d('0x37')](),'app':_0x9d2d('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xa60513[_0x9d2d('0xb')],'exten':_0xa60513[_0x9d2d('0x7')],'priority':_0xb23a09['intervals'][_0x9d2d('0x34')]+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});}else{_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09['type']['toLowerCase'](),'app':_0x9d2d('0x16'),'appdata':_0x9d2d('0x44'),'context':_0xa60513[_0x9d2d('0xb')],'exten':_0xa60513['exten'],'priority':_0xb23a09[_0x9d2d('0x36')]['length']+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09[_0x9d2d('0x4')][_0x9d2d('0x37')](),'app':_0x9d2d('0x5'),'appdata':_0x9d2d('0x45'),'context':_0xa60513['context'],'exten':_0xa60513['exten'],'priority':_0xb23a09[_0x9d2d('0x36')][_0x9d2d('0x34')]+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});}}}}for(var _0x21e5d2=0x0;_0x21e5d2<_0xb23a09[_0x9d2d('0x36')]['length'];_0x21e5d2++){var _0x105791=_0x3955c9+_0xb23a09[_0x9d2d('0x36')][_0x9d2d('0x34')];var _0x21dfae=_0x21e5d2===_0xb23a09['intervals'][_0x9d2d('0x34')]-0x1?_0x3955c9+_0x5baff5[_0x9d2d('0x34')]+_0x259fda[_0x9d2d('0x34')]+0x2:_0x3955c9+_0x21e5d2+0x1;_0x5baff5[_0x9d2d('0x46')](_0x21e5d2,0x0,{'type':_0xa60513[_0x9d2d('0x4')],'app':'GotoIfTime','appdata':_0xb23a09[_0x9d2d('0x36')][_0x21e5d2]+'?'+_0xa60513[_0x9d2d('0xb')]+',${EXTEN},'+_0x105791+':'+_0xa60513[_0x9d2d('0xb')]+',${EXTEN},'+_0x21dfae,'exten':_0xa60513[_0x9d2d('0x7')],'context':_0xa60513[_0x9d2d('0xb')],'priority':_0x3955c9+_0x21e5d2,'VoiceExtensionId':_0xa60513['id']});}if(_0xb23a09[_0x9d2d('0x41')]===_0x9d2d('0x47')){_0xb23a09['appdata']=_0x5603dd(_0xa60513,_0xb23a09[_0x9d2d('0x48')]);}if(_0xb23a09[_0x9d2d('0x41')]==='agi'){_0x5baff5[_0x9d2d('0xd')]({'type':_0xb23a09[_0x9d2d('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x9d2d('0x49'),'context':_0xa60513[_0x9d2d('0xb')],'exten':_0xa60513[_0x9d2d('0x7')],'priority':_0xb23a09[_0x9d2d('0x36')][_0x9d2d('0x34')]+_0x3955c9+_0x3ab057++,'VoiceExtensionId':_0xa60513['id']});}_0xb23a09[_0x9d2d('0x4a')]=_0x5baff5[_0x9d2d('0x34')]?_[_0x9d2d('0x4b')](_0x5baff5)[_0x9d2d('0x4a')]+0x1:_0x3955c9;_0x2a2dda=_[_0x9d2d('0x4c')](_0x2a2dda,_0x5baff5,[_0xb23a09],_0x259fda);_0x3955c9=_[_0x9d2d('0x4b')](_0x2a2dda)[_0x9d2d('0x4a')]+0x1;}return _0x5f8660(_0x2a2dda);})[_0x9d2d('0x4d')](function(_0xd291af){_0x11db24(_0xd291af);});});}return _0x4ac050[_0x9d2d('0x4e')](_0x9d2d('0x4f'),attributes,{'tableName':_0x9d2d('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x38c0d6){var _0x1e04b1=this[_0x9d2d('0x51')]({'plain':!![]});var _0x853b71=_0x1e04b1[_0x9d2d('0x4')]===_0x9d2d('0x10')?_0x16977a(_0x1e04b1):_0x4f925f(_0x1e04b1);return _0x4f58ef(_0x1e04b1,_0x38c0d6,_[_0x9d2d('0x4b')](_0x853b71)['priority']+0x1)[_0x9d2d('0x52')](function(_0x314721){var _0x452675=_[_0x9d2d('0x4c')](_0x853b71,_0x314721);_0x452675[_0x9d2d('0xd')]({'type':_0x1e04b1[_0x9d2d('0x4')],'app':'Hangup','exten':_0x1e04b1[_0x9d2d('0x7')],'context':_0x1e04b1[_0x9d2d('0xb')],'priority':_[_0x9d2d('0x4b')](_0x452675)[_0x9d2d('0x4a')]+0x1,'VoiceExtensionId':_0x1e04b1['id']});return _0x452675;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6a61674..bf272a2 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 _0x2171=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','model','map','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2171,0x143));var _0x1217=function(_0x6f6f18,_0x406aee){_0x6f6f18=_0x6f6f18-0x0;var _0x57c18c=_0x2171[_0x6f6f18];return _0x57c18c;};'use strict';var _=require('lodash');var util=require(_0x1217('0x0'));var moment=require(_0x1217('0x1'));var BPromise=require(_0x1217('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1217('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1217('0x4'))(_0x1217('0x5'));var config=require(_0x1217('0x6'));var jayson=require(_0x1217('0x7'));var client=jayson['client'][_0x1217('0x8')]({'port':0x232a});config[_0x1217('0x9')]=_[_0x1217('0xa')](config['redis'],{'host':_0x1217('0xb'),'port':0x18eb});var socket=require(_0x1217('0xc'))(new Redis(config[_0x1217('0x9')]));require(_0x1217('0xd'))[_0x1217('0xe')](socket);function respondWithRpcPromise(_0x35f3a8,_0x5a321c,_0x125efc){return new BPromise(function(_0x5114fd,_0x42abbf){return client[_0x1217('0xf')](_0x35f3a8,_0x125efc)[_0x1217('0x10')](function(_0x24336c){logger[_0x1217('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5a321c,_0x1217('0x12'));logger[_0x1217('0x13')](_0x1217('0x14'),_0x5a321c,_0x1217('0x12'),JSON[_0x1217('0x15')](_0x24336c));if(_0x24336c['error']){if(_0x24336c['error'][_0x1217('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5a321c,_0x24336c[_0x1217('0x17')]['message']);return _0x42abbf(_0x24336c['error'][_0x1217('0x18')]);}logger[_0x1217('0x17')](_0x1217('0x19'),_0x5a321c,_0x24336c[_0x1217('0x17')]['message']);return _0x5114fd(_0x24336c[_0x1217('0x17')][_0x1217('0x18')]);}else{logger[_0x1217('0x11')](_0x1217('0x19'),_0x5a321c,'request\x20sent');_0x5114fd(_0x24336c[_0x1217('0x1a')][_0x1217('0x18')]);}})[_0x1217('0x1b')](function(_0x1a0a6c){logger[_0x1217('0x17')](_0x1217('0x19'),_0x5a321c,_0x1a0a6c);_0x42abbf(_0x1a0a6c);});});}exports[_0x1217('0x1c')]=function(_0xa0a5fd){var _0x48fd63=this;return new Promise(function(_0x3546a1,_0x49382b){return db[_0x1217('0x1d')][_0x1217('0x1e')]({'raw':_0xa0a5fd['options']?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x20')]===undefined?!![]:![]:!![],'where':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x21')]||null:null,'attributes':_0xa0a5fd['options']?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x22')]||null:null,'limit':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd['options']['limit']||null:null,'include':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x23')]?_['map'](_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x23')],function(_0x1bde0b){return{'model':db[_0x1bde0b[_0x1217('0x24')]],'as':_0x1bde0b['as'],'attributes':_0x1bde0b[_0x1217('0x22')],'include':_0x1bde0b[_0x1217('0x23')]?_['map'](_0x1bde0b['include'],function(_0x1c61b2){return{'model':db[_0x1c61b2[_0x1217('0x24')]],'as':_0x1c61b2['as'],'attributes':_0x1c61b2['attributes'],'include':_0x1c61b2[_0x1217('0x23')]?_[_0x1217('0x25')](_0x1c61b2[_0x1217('0x23')],function(_0x21392c){return{'model':db[_0x21392c[_0x1217('0x24')]],'as':_0x21392c['as'],'attributes':_0x21392c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1217('0x10')](function(_0x46b735){logger[_0x1217('0x11')]('GetVoiceExtension',_0xa0a5fd);logger['debug'](_0x1217('0x1c'),_0xa0a5fd,JSON[_0x1217('0x15')](_0x46b735));_0x3546a1(_0x46b735);})[_0x1217('0x1b')](function(_0x5c7fe3){logger['error'](_0x1217('0x1c'),_0x5c7fe3[_0x1217('0x18')],_0xa0a5fd);_0x49382b(_0x48fd63[_0x1217('0x17')](0x1f4,_0x5c7fe3['message']));});});}; \ No newline at end of file +var _0x1b20=['client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','include','map','model','attributes','then','info','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39095c,_0x4b930f){var _0x2cf6a3=function(_0x238300){while(--_0x238300){_0x39095c['push'](_0x39095c['shift']());}};_0x2cf6a3(++_0x4b930f);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var moment=require(_0x01b2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b2('0x2'));var db=require(_0x01b2('0x3'))['db'];var utils=require(_0x01b2('0x4'));var logger=require(_0x01b2('0x5'))(_0x01b2('0x6'));var config=require(_0x01b2('0x7'));var jayson=require(_0x01b2('0x8'));var client=jayson[_0x01b2('0x9')][_0x01b2('0xa')]({'port':0x232a});config[_0x01b2('0xb')]=_[_0x01b2('0xc')](config[_0x01b2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x01b2('0xd'))(new Redis(config['redis']));require(_0x01b2('0xe'))[_0x01b2('0xf')](socket);function respondWithRpcPromise(_0x3bad99,_0x3338f6,_0x9c411f){return new BPromise(function(_0x2e79e5,_0x30d35f){return client[_0x01b2('0x10')](_0x3bad99,_0x9c411f)['then'](function(_0x3c0044){logger['info'](_0x01b2('0x11'),_0x3338f6,'request\x20sent');logger[_0x01b2('0x12')](_0x01b2('0x13'),_0x3338f6,_0x01b2('0x14'),JSON[_0x01b2('0x15')](_0x3c0044));if(_0x3c0044['error']){if(_0x3c0044[_0x01b2('0x16')][_0x01b2('0x17')]===0x1f4){logger[_0x01b2('0x16')](_0x01b2('0x11'),_0x3338f6,_0x3c0044[_0x01b2('0x16')]['message']);return _0x30d35f(_0x3c0044[_0x01b2('0x16')][_0x01b2('0x18')]);}logger[_0x01b2('0x16')](_0x01b2('0x11'),_0x3338f6,_0x3c0044['error']['message']);return _0x2e79e5(_0x3c0044[_0x01b2('0x16')][_0x01b2('0x18')]);}else{logger['info'](_0x01b2('0x11'),_0x3338f6,_0x01b2('0x14'));_0x2e79e5(_0x3c0044[_0x01b2('0x19')]['message']);}})[_0x01b2('0x1a')](function(_0x9f182b){logger[_0x01b2('0x16')](_0x01b2('0x11'),_0x3338f6,_0x9f182b);_0x30d35f(_0x9f182b);});});}exports[_0x01b2('0x1b')]=function(_0x56ea3c){var _0xfbd5db=this;return new Promise(function(_0x5ee319,_0x7464e5){return db['VoiceExtension'][_0x01b2('0x1c')]({'raw':_0x56ea3c[_0x01b2('0x1d')]?_0x56ea3c[_0x01b2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x56ea3c[_0x01b2('0x1d')]?_0x56ea3c[_0x01b2('0x1d')][_0x01b2('0x1e')]||null:null,'attributes':_0x56ea3c[_0x01b2('0x1d')]?_0x56ea3c[_0x01b2('0x1d')]['attributes']||null:null,'limit':_0x56ea3c[_0x01b2('0x1d')]?_0x56ea3c['options']['limit']||null:null,'include':_0x56ea3c[_0x01b2('0x1d')]?_0x56ea3c[_0x01b2('0x1d')][_0x01b2('0x1f')]?_[_0x01b2('0x20')](_0x56ea3c[_0x01b2('0x1d')][_0x01b2('0x1f')],function(_0x4920f7){return{'model':db[_0x4920f7[_0x01b2('0x21')]],'as':_0x4920f7['as'],'attributes':_0x4920f7[_0x01b2('0x22')],'include':_0x4920f7[_0x01b2('0x1f')]?_[_0x01b2('0x20')](_0x4920f7['include'],function(_0x45290e){return{'model':db[_0x45290e['model']],'as':_0x45290e['as'],'attributes':_0x45290e[_0x01b2('0x22')],'include':_0x45290e[_0x01b2('0x1f')]?_['map'](_0x45290e[_0x01b2('0x1f')],function(_0x5efdda){return{'model':db[_0x5efdda['model']],'as':_0x5efdda['as'],'attributes':_0x5efdda[_0x01b2('0x22')]};}):[]};}):[]};}):[]:[]})[_0x01b2('0x23')](function(_0x5befbf){logger[_0x01b2('0x24')](_0x01b2('0x1b'),_0x56ea3c);logger[_0x01b2('0x12')](_0x01b2('0x1b'),_0x56ea3c,JSON[_0x01b2('0x15')](_0x5befbf));_0x5ee319(_0x5befbf);})[_0x01b2('0x1a')](function(_0xd60b46){logger[_0x01b2('0x16')](_0x01b2('0x1b'),_0xd60b46[_0x01b2('0x18')],_0x56ea3c);_0x7464e5(_0xfbd5db[_0x01b2('0x16')](0x1f4,_0xd60b46['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a342e7d..3fd566c 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x24e422,_0x19fc2b){var _0x5d6410=function(_0x222a42){while(--_0x222a42){_0x24e422['push'](_0x24e422['shift']());}};_0x5d6410(++_0x19fc2b);}(_0x5fab,0x177));var _0xb5fa=function(_0x353b9d,_0x2c89df){_0x353b9d=_0x353b9d-0x0;var _0x22fde7=_0x5fab[_0x353b9d];return _0x22fde7;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x115b91,_0x14a5ae){var _0x3f38d2=function(_0x9b5fa2){while(--_0x9b5fa2){_0x115b91['push'](_0x115b91['shift']());}};_0x3f38d2(++_0x14a5ae);}(_0xabce,0x103));var _0xeabc=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xabce[_0x1c546c];return _0x2cc384;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f196a8f..1aa3699 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 _0x4325=['get','/:id/messages','getMessages','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show'];(function(_0x4266b0,_0x4b478d){var _0x3621dc=function(_0x4967d9){while(--_0x4967d9){_0x4266b0['push'](_0x4266b0['shift']());}};_0x3621dc(++_0x4b478d);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var controller=require(_0x5432('0x7'));router['get']('/',auth[_0x5432('0x8')](),controller[_0x5432('0x9')]);router['get'](_0x5432('0xa'),auth['isAuthenticated'](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0xd'),auth[_0x5432('0x8')](),controller[_0x5432('0xe')]);router['post']('/',auth[_0x5432('0x8')](),controller['create']);router[_0x5432('0xf')](_0x5432('0xa'),auth[_0x5432('0x8')](),controller[_0x5432('0x10')]);router['delete']('/:id',auth[_0x5432('0x8')](),controller[_0x5432('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x2b7134,_0x6362dd){var _0x164f06=function(_0x18d907){while(--_0x18d907){_0x2b7134['push'](_0x2b7134['shift']());}};_0x164f06(++_0x6362dd);}(_0x1893,0xa2));var _0x3189=function(_0x1332e8,_0x49d9d9){_0x1332e8=_0x1332e8-0x0;var _0x2687d2=_0x1893[_0x1332e8];return _0x2687d2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('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 6003db3..ed32cca 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 _0xa4a7=['TINYINT(4)','TIMESTAMP','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','yes','ENUM'];(function(_0xae5de1,_0x1af2a7){var _0x2cf411=function(_0x7e668b){while(--_0x7e668b){_0xae5de1['push'](_0xae5de1['shift']());}};_0x2cf411(++_0x1af2a7);}(_0xa4a7,0x15a));var _0x7a4a=function(_0x5014f1,_0x55675c){_0x5014f1=_0x5014f1-0x0;var _0x273cc4=_0xa4a7[_0x5014f1];return _0x273cc4;};'use strict';var Sequelize=require(_0x7a4a('0x0'));module[_0x7a4a('0x1')]={'customer_id':{'type':Sequelize[_0x7a4a('0x2')]},'context':{'type':Sequelize[_0x7a4a('0x2')],'defaultValue':_0x7a4a('0x3'),'unique':_0x7a4a('0x4')},'mailbox':{'type':Sequelize[_0x7a4a('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7a4a('0x4')},'password':{'type':Sequelize[_0x7a4a('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7a4a('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2e4fa9){this['setDataValue'](_0x7a4a('0x5'),typeof _0x2e4fa9===_0x7a4a('0x6')&&_0x2e4fa9[_0x7a4a('0x7')]()?_0x2e4fa9[_0x7a4a('0x7')]():null);}},'pager':{'type':Sequelize[_0x7a4a('0x2')]},'tz':{'type':Sequelize[_0x7a4a('0x2')],'defaultValue':_0x7a4a('0x8')},'attach':{'type':Sequelize['ENUM'](_0x7a4a('0x9'),'no'),'defaultValue':_0x7a4a('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':_0x7a4a('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7a4a('0x2')]},'callback':{'type':Sequelize[_0x7a4a('0x2')]},'review':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7a4a('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7a4a('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7a4a('0xa')](_0x7a4a('0x9'),'no'),'defaultValue':_0x7a4a('0x9'),'allowNull':![]},'stamp':{'type':_0x7a4a('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7a4a('0xd')](_0x7a4a('0xe'))+_0x7a4a('0xf')+this[_0x7a4a('0xd')](_0x7a4a('0x10'));}}}; \ No newline at end of file +var _0x19dd=['getDataValue','fullname','mailbox','sequelize','exports','STRING','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x5d8962,_0x1de909){var _0x88cac4=function(_0x3964e7){while(--_0x3964e7){_0x5d8962['push'](_0x5d8962['shift']());}};_0x88cac4(++_0x1de909);}(_0x19dd,0xab));var _0xd19d=function(_0x488e25,_0x4f4731){_0x488e25=_0x488e25-0x0;var _0x3468c0=_0x19dd[_0x488e25];return _0x3468c0;};'use strict';var Sequelize=require(_0xd19d('0x0'));module[_0xd19d('0x1')]={'customer_id':{'type':Sequelize[_0xd19d('0x2')]},'context':{'type':Sequelize[_0xd19d('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xd19d('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xd19d('0x2')]},'email':{'type':Sequelize[_0xd19d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4a9be6){this['setDataValue']('email',typeof _0x4a9be6===_0xd19d('0x3')&&_0x4a9be6['trim']()?_0x4a9be6['trim']():null);}},'pager':{'type':Sequelize[_0xd19d('0x2')]},'tz':{'type':Sequelize[_0xd19d('0x2')],'defaultValue':_0xd19d('0x4')},'attach':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':_0xd19d('0x6'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xd19d('0x6'),'no'),'defaultValue':_0xd19d('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd19d('0x2')]},'callback':{'type':Sequelize[_0xd19d('0x2')]},'review':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd19d('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd19d('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':_0xd19d('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd19d('0x5')](_0xd19d('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xd19d('0x8')},'emailsubject':{'type':Sequelize[_0xd19d('0x2')]},'emailbody':{'type':Sequelize[_0xd19d('0x2')]},'maxsecs':{'type':Sequelize[_0xd19d('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd19d('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xd19d('0xa')],'get':function(){return this[_0xd19d('0xb')](_0xd19d('0xc'))+'\x20-\x20'+this['getDataValue'](_0xd19d('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3153e6e..563fd50 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 _0xb62e=['fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','getMessages','VoiceMailMessage','nolimit','order','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','UserProfileResource','then','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','keys','filters','intersection','query','attributes','model'];(function(_0x5515d1,_0x40adf6){var _0x1c4c55=function(_0x13dec3){while(--_0x13dec3){_0x5515d1['push'](_0x5515d1['shift']());}};_0x1c4c55(++_0x40adf6);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){var _0x3ef988=_0x395b70['get']({'plain':!![]});var _0x448327='Voicemails';return db[_0xeb62('0x27')]['destroy']({'where':{'type':_0x448327,'resourceId':_0x3ef988['id']}})[_0xeb62('0x28')](function(){return _0x395b70;});})[_0xeb62('0x28')](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef784,_0x3ae031){return function(_0x5222f4){if(!_0x5222f4){_0x3ef784[_0xeb62('0x1b')](0x194);}return _0x5222f4;};}function handleError(_0x42f486,_0x360efd){_0x360efd=_0x360efd||0x1f4;return function(_0x511202){logger[_0xeb62('0x29')](_0x511202[_0xeb62('0x2a')]);if(_0x511202['name']){delete _0x511202[_0xeb62('0x2b')];}_0x42f486[_0xeb62('0x1d')](_0x360efd)[_0xeb62('0x2c')](_0x511202);};}exports[_0xeb62('0x2d')]=function(_0x235448,_0x5195bf){var _0x4b58af={},_0x1248bb={},_0x357cf4={'count':0x0,'rows':[]};var _0x1607ef=_[_0xeb62('0x2e')](db[_0xeb62('0x2f')][_0xeb62('0x30')],function(_0x1ae51e){return{'name':_0x1ae51e['fieldName'],'type':_0x1ae51e[_0xeb62('0x31')]['key']};});_0x1248bb['model']=_[_0xeb62('0x2e')](_0x1607ef,_0xeb62('0x2b'));_0x1248bb['query']=_[_0xeb62('0x32')](_0x235448['query']);_0x1248bb[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x1248bb['model'],_0x1248bb[_0xeb62('0x35')]);_0x4b58af[_0xeb62('0x36')]=_['intersection'](_0x1248bb[_0xeb62('0x37')],qs[_0xeb62('0x38')](_0x235448[_0xeb62('0x35')][_0xeb62('0x38')]));_0x4b58af['attributes']=_0x4b58af[_0xeb62('0x36')][_0xeb62('0x39')]?_0x4b58af['attributes']:_0x1248bb['model'];if(!_0x235448[_0xeb62('0x35')][_0xeb62('0x3a')]('nolimit')){_0x4b58af[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x235448[_0xeb62('0x35')][_0xeb62('0x21')]);_0x4b58af[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x235448[_0xeb62('0x35')]['offset']);}_0x4b58af['order']=qs[_0xeb62('0x3b')](_0x235448[_0xeb62('0x35')][_0xeb62('0x3b')]);_0x4b58af[_0xeb62('0x3c')]=qs['filters'](_[_0xeb62('0x3d')](_0x235448['query'],_0x1248bb[_0xeb62('0x33')]),_0x1607ef);if(_0x235448[_0xeb62('0x35')][_0xeb62('0x3e')]){_0x4b58af[_0xeb62('0x3c')]=_[_0xeb62('0x3f')](_0x4b58af[_0xeb62('0x3c')],{'$or':_[_0xeb62('0x2e')](_0x1607ef,function(_0x40e3a0){if(_0x40e3a0['type']!==_0xeb62('0x40')){var _0x3f1cd9={};_0x3f1cd9[_0x40e3a0[_0xeb62('0x2b')]]={'$like':'%'+_0x235448[_0xeb62('0x35')]['filter']+'%'};return _0x3f1cd9;}})});}_0x4b58af=_['merge']({},_0x4b58af,_0x235448[_0xeb62('0x41')]);var _0x41fb7d={'where':_0x4b58af['where']};return db[_0xeb62('0x2f')][_0xeb62('0x22')](_0x41fb7d)['then'](function(_0x25e9f0){_0x357cf4['count']=_0x25e9f0;if(_0x235448[_0xeb62('0x35')]['includeAll']){_0x4b58af[_0xeb62('0x42')]=[{'all':!![]}];}return db['VoiceMail'][_0xeb62('0x43')](_0x4b58af);})[_0xeb62('0x28')](function(_0x317f50){_0x357cf4['rows']=_0x317f50;return _0x357cf4;})['then'](respondWithFilteredResult(_0x5195bf,_0x4b58af))[_0xeb62('0x44')](handleError(_0x5195bf,null));};exports[_0xeb62('0x45')]=function(_0xb1c958,_0x1b408c){var _0x31d4d6={'raw':!![],'where':{'id':_0xb1c958[_0xeb62('0x46')]['id']}},_0x4afd5e={};_0x4afd5e['model']=_[_0xeb62('0x32')](db['VoiceMail'][_0xeb62('0x30')]);_0x4afd5e['query']=_[_0xeb62('0x32')](_0xb1c958['query']);_0x4afd5e[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x4afd5e[_0xeb62('0x37')],_0x4afd5e[_0xeb62('0x35')]);_0x31d4d6[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x4afd5e['model'],qs[_0xeb62('0x38')](_0xb1c958[_0xeb62('0x35')]['fields']));_0x31d4d6['attributes']=_0x31d4d6['attributes']['length']?_0x31d4d6[_0xeb62('0x36')]:_0x4afd5e[_0xeb62('0x37')];if(_0xb1c958['query'][_0xeb62('0x47')]){_0x31d4d6[_0xeb62('0x42')]=[{'all':!![]}];}_0x31d4d6=_[_0xeb62('0x3f')]({},_0x31d4d6,_0xb1c958[_0xeb62('0x41')]);return db[_0xeb62('0x2f')]['find'](_0x31d4d6)[_0xeb62('0x28')](handleEntityNotFound(_0x1b408c,null))['then'](respondWithResult(_0x1b408c,null))[_0xeb62('0x44')](handleError(_0x1b408c,null));};exports[_0xeb62('0x48')]=function(_0x7fb53f,_0x18c40d){return db[_0xeb62('0x2f')][_0xeb62('0x48')](_0x7fb53f[_0xeb62('0x49')],{})[_0xeb62('0x28')](function(_0x19c6fb){var _0x3a29ac=_0x7fb53f[_0xeb62('0x4a')][_0xeb62('0x4b')]({'plain':!![]});if(!_0x3a29ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a29ac[_0xeb62('0x4c')]==='user'){var _0x4edd8c=_0x19c6fb[_0xeb62('0x4b')]({'plain':!![]});var _0x31fd4a='Voicemails';return db[_0xeb62('0x4d')][_0xeb62('0x4e')]({'where':{'name':_0x31fd4a,'userProfileId':_0x3a29ac['userProfileId']},'raw':!![]})[_0xeb62('0x28')](function(_0x137030){if(_0x137030&&_0x137030[_0xeb62('0x4f')]===0x0){return db[_0xeb62('0x27')][_0xeb62('0x48')]({'name':_0x4edd8c[_0xeb62('0x2b')],'resourceId':_0x4edd8c['id'],'type':_0x137030[_0xeb62('0x2b')],'sectionId':_0x137030['id']},{})[_0xeb62('0x28')](function(){return _0x19c6fb;});}else{return _0x19c6fb;}})['catch'](function(_0x3e2be9){logger['error'](_0xeb62('0x50'),_0x3e2be9);throw _0x3e2be9;});}return _0x19c6fb;})[_0xeb62('0x28')](respondWithResult(_0x18c40d,0xc9))[_0xeb62('0x44')](handleError(_0x18c40d,null));};exports[_0xeb62('0x51')]=function(_0x35d92d,_0x13ea55){if(_0x35d92d[_0xeb62('0x49')]['id']){delete _0x35d92d[_0xeb62('0x49')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x35d92d['params']['id']}})['then'](handleEntityNotFound(_0x13ea55,null))[_0xeb62('0x28')](saveUpdates(_0x35d92d['body'],null))[_0xeb62('0x28')](respondWithResult(_0x13ea55,null))['catch'](handleError(_0x13ea55,null));};exports[_0xeb62('0x52')]=function(_0x342768,_0xff18cd){return db['VoiceMail'][_0xeb62('0x4e')]({'where':{'id':_0x342768[_0xeb62('0x46')]['id']}})['then'](handleEntityNotFound(_0xff18cd,null))[_0xeb62('0x28')](removeEntity(_0xff18cd,null))[_0xeb62('0x44')](handleError(_0xff18cd,null));};exports[_0xeb62('0x53')]=function(_0x366312,_0x55370c,_0x3be3e1){return db[_0xeb62('0x2f')]['findOne']({'where':{'id':_0x366312[_0xeb62('0x46')]['id']}})[_0xeb62('0x28')](handleEntityNotFound(_0x55370c,null))[_0xeb62('0x28')](function(_0x466c3c){var _0x3a450b;var _0x46da69={},_0x3e55bf={};_0x3e55bf[_0xeb62('0x37')]=_[_0xeb62('0x32')](db[_0xeb62('0x54')][_0xeb62('0x30')]);_0x3e55bf[_0xeb62('0x35')]=_[_0xeb62('0x32')](_0x366312[_0xeb62('0x35')]);_0x3e55bf[_0xeb62('0x33')]=_[_0xeb62('0x34')](_0x3e55bf['model'],_0x3e55bf['query']);_0x46da69['attributes']=_['intersection'](_0x3e55bf[_0xeb62('0x37')],qs['fields'](_0x366312[_0xeb62('0x35')][_0xeb62('0x38')]));_0x46da69[_0xeb62('0x36')]=_0x46da69[_0xeb62('0x36')][_0xeb62('0x39')]?_0x46da69[_0xeb62('0x36')]:_0x3e55bf[_0xeb62('0x37')];if(!_0x366312[_0xeb62('0x35')][_0xeb62('0x3a')](_0xeb62('0x55'))){_0x46da69['limit']=qs[_0xeb62('0x21')](_0x366312[_0xeb62('0x35')][_0xeb62('0x21')]);_0x46da69[_0xeb62('0x1f')]=qs['offset'](_0x366312[_0xeb62('0x35')][_0xeb62('0x1f')]);}_0x46da69[_0xeb62('0x56')]=qs[_0xeb62('0x3b')](_0x366312[_0xeb62('0x35')][_0xeb62('0x3b')]);_0x46da69[_0xeb62('0x3c')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3d')](_0x366312[_0xeb62('0x35')],_0x3e55bf[_0xeb62('0x33')]));if(_0x366312['query'][_0xeb62('0x3e')]){_0x46da69[_0xeb62('0x3c')]=_[_0xeb62('0x3f')](_0x46da69[_0xeb62('0x3c')],{'$or':_[_0xeb62('0x2e')](_0x46da69[_0xeb62('0x36')],function(_0x388b31){var _0x1dcc91={};_0x1dcc91[_0x388b31]={'$like':'%'+_0x366312[_0xeb62('0x35')][_0xeb62('0x3e')]+'%'};return _0x1dcc91;})});}_0x46da69['where']=_[_0xeb62('0x3f')](_0x46da69[_0xeb62('0x3c')],{'mailboxuser':_0x466c3c[_0xeb62('0x57')]});_0x46da69=_[_0xeb62('0x3f')]({},_0x46da69,_0x366312['options']);return db[_0xeb62('0x54')][_0xeb62('0x58')](_0x46da69)[_0xeb62('0x28')](respondWithFilteredResult(_0x55370c,_0x46da69));})[_0xeb62('0x44')](handleError(_0x55370c,null));}; \ No newline at end of file +var _0x065e=['findOne','VoiceMailMessage','findAndCountAll','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoiceMail','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages'];(function(_0x126ed5,_0xcdeb96){var _0x25a35e=function(_0x389da3){while(--_0x389da3){_0x126ed5['push'](_0x126ed5['shift']());}};_0x25a35e(++_0xcdeb96);}(_0x065e,0x1a7));var _0xe065=function(_0x570752,_0x35c857){_0x570752=_0x570752-0x0;var _0x2bb94a=_0x065e[_0x570752];return _0x2bb94a;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];function respondWithStatusCode(_0x13b697,_0xf5ab44){_0xf5ab44=_0xf5ab44||0xcc;return function(_0x5bd30f){if(_0x5bd30f){return _0x13b697[_0xe065('0x16')](_0xf5ab44);}return _0x13b697[_0xe065('0x17')](_0xf5ab44)[_0xe065('0x18')]();};}function respondWithResult(_0x2e9480,_0x29297b){_0x29297b=_0x29297b||0xc8;return function(_0x541985){if(_0x541985){return _0x2e9480[_0xe065('0x17')](_0x29297b)[_0xe065('0x19')](_0x541985);}};}function respondWithFilteredResult(_0x15d365,_0xc5ef4f){return function(_0x434e07){if(_0x434e07){var _0x352206=typeof _0xc5ef4f[_0xe065('0x1a')]==='undefined'&&typeof _0xc5ef4f[_0xe065('0x1b')]===_0xe065('0x1c');var _0x54d260=_0x434e07[_0xe065('0x1d')];var _0x1d2f7a=_0x352206?0x0:_0xc5ef4f[_0xe065('0x1a')];var _0x14c97c=_0x352206?_0x434e07[_0xe065('0x1d')]:_0xc5ef4f[_0xe065('0x1a')]+_0xc5ef4f[_0xe065('0x1b')];var _0x5000e1;if(_0x14c97c>=_0x54d260){_0x14c97c=_0x54d260;_0x5000e1=0xc8;}else{_0x5000e1=0xce;}_0x15d365[_0xe065('0x17')](_0x5000e1);return _0x15d365['set'](_0xe065('0x1e'),_0x1d2f7a+'-'+_0x14c97c+'/'+_0x54d260)[_0xe065('0x19')](_0x434e07);}return null;};}function patchUpdates(_0x55f55c){return function(_0x1c6567){try{jsonpatch['apply'](_0x1c6567,_0x55f55c,!![]);}catch(_0xe26e9b){return BPromise[_0xe065('0x1f')](_0xe26e9b);}return _0x1c6567[_0xe065('0x20')]();};}function saveUpdates(_0x110556,_0x3ecd13){return function(_0x105cb2){if(_0x105cb2){return _0x105cb2[_0xe065('0x21')](_0x110556)[_0xe065('0x22')](function(_0x1c5dd9){return _0x1c5dd9;});}return null;};}function removeEntity(_0x5081a3,_0x7208af){return function(_0x43b712){if(_0x43b712){return _0x43b712[_0xe065('0x23')]()[_0xe065('0x22')](function(){var _0x5e8b60=_0x43b712['get']({'plain':!![]});var _0x164965='Voicemails';return db[_0xe065('0x24')][_0xe065('0x23')]({'where':{'type':_0x164965,'resourceId':_0x5e8b60['id']}})[_0xe065('0x22')](function(){return _0x43b712;});})[_0xe065('0x22')](function(){_0x5081a3[_0xe065('0x17')](0xcc)[_0xe065('0x18')]();});}};}function handleEntityNotFound(_0x3b1caf,_0x26a159){return function(_0x52cd9c){if(!_0x52cd9c){_0x3b1caf['sendStatus'](0x194);}return _0x52cd9c;};}function handleError(_0x14de01,_0x10e6ba){_0x10e6ba=_0x10e6ba||0x1f4;return function(_0x23aee9){logger[_0xe065('0x25')](_0x23aee9['stack']);if(_0x23aee9[_0xe065('0x26')]){delete _0x23aee9['name'];}_0x14de01['status'](_0x10e6ba)[_0xe065('0x27')](_0x23aee9);};}exports[_0xe065('0x28')]=function(_0x2aa766,_0x5b8523){var _0x883747={},_0x59b915={},_0x12679d={'count':0x0,'rows':[]};var _0x46db7e=_[_0xe065('0x29')](db[_0xe065('0x2a')]['rawAttributes'],function(_0x3f02b2){return{'name':_0x3f02b2['fieldName'],'type':_0x3f02b2[_0xe065('0x2b')][_0xe065('0x2c')]};});_0x59b915['model']=_[_0xe065('0x29')](_0x46db7e,'name');_0x59b915[_0xe065('0x2d')]=_['keys'](_0x2aa766[_0xe065('0x2d')]);_0x59b915[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],_0x59b915['query']);_0x883747[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x59b915[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x32')]));_0x883747['attributes']=_0x883747[_0xe065('0x31')][_0xe065('0x33')]?_0x883747['attributes']:_0x59b915[_0xe065('0x30')];if(!_0x2aa766[_0xe065('0x2d')][_0xe065('0x34')](_0xe065('0x35'))){_0x883747[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x2aa766[_0xe065('0x2d')]['limit']);_0x883747[_0xe065('0x1a')]=qs['offset'](_0x2aa766[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x883747[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x2aa766[_0xe065('0x2d')][_0xe065('0x37')]);_0x883747['where']=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x2aa766[_0xe065('0x2d')],_0x59b915['filters']),_0x46db7e);if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]){_0x883747[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x883747[_0xe065('0x3a')],{'$or':_['map'](_0x46db7e,function(_0x341740){if(_0x341740[_0xe065('0x2b')]!=='VIRTUAL'){var _0x236e75={};_0x236e75[_0x341740['name']]={'$like':'%'+_0x2aa766[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x236e75;}})});}_0x883747=_['merge']({},_0x883747,_0x2aa766[_0xe065('0x3c')]);var _0x20c881={'where':_0x883747['where']};return db[_0xe065('0x2a')][_0xe065('0x1d')](_0x20c881)[_0xe065('0x22')](function(_0x44a3f6){_0x12679d[_0xe065('0x1d')]=_0x44a3f6;if(_0x2aa766[_0xe065('0x2d')][_0xe065('0x3d')]){_0x883747[_0xe065('0x3e')]=[{'all':!![]}];}return db[_0xe065('0x2a')][_0xe065('0x3f')](_0x883747);})[_0xe065('0x22')](function(_0x4364c3){_0x12679d[_0xe065('0x40')]=_0x4364c3;return _0x12679d;})['then'](respondWithFilteredResult(_0x5b8523,_0x883747))['catch'](handleError(_0x5b8523,null));};exports[_0xe065('0x41')]=function(_0x2bf092,_0x5ee4ec){var _0x3ba838={'raw':!![],'where':{'id':_0x2bf092[_0xe065('0x42')]['id']}},_0x448044={};_0x448044[_0xe065('0x30')]=_[_0xe065('0x43')](db[_0xe065('0x2a')][_0xe065('0x44')]);_0x448044[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x2bf092['query']);_0x448044[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],_0x448044['query']);_0x3ba838[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x448044[_0xe065('0x30')],qs[_0xe065('0x32')](_0x2bf092['query'][_0xe065('0x32')]));_0x3ba838[_0xe065('0x31')]=_0x3ba838[_0xe065('0x31')][_0xe065('0x33')]?_0x3ba838[_0xe065('0x31')]:_0x448044[_0xe065('0x30')];if(_0x2bf092[_0xe065('0x2d')]['includeAll']){_0x3ba838[_0xe065('0x3e')]=[{'all':!![]}];}_0x3ba838=_[_0xe065('0x3b')]({},_0x3ba838,_0x2bf092[_0xe065('0x3c')]);return db[_0xe065('0x2a')][_0xe065('0x45')](_0x3ba838)[_0xe065('0x22')](handleEntityNotFound(_0x5ee4ec,null))[_0xe065('0x22')](respondWithResult(_0x5ee4ec,null))['catch'](handleError(_0x5ee4ec,null));};exports[_0xe065('0x46')]=function(_0x5a2360,_0x45fe1f){return db[_0xe065('0x2a')][_0xe065('0x46')](_0x5a2360['body'],{})[_0xe065('0x22')](function(_0x16898c){var _0x3ab70d=_0x5a2360[_0xe065('0x47')][_0xe065('0x48')]({'plain':!![]});if(!_0x3ab70d)throw new Error(_0xe065('0x49'));if(_0x3ab70d[_0xe065('0x4a')]===_0xe065('0x47')){var _0x3095c8=_0x16898c[_0xe065('0x48')]({'plain':!![]});var _0x3f91a2=_0xe065('0x4b');return db[_0xe065('0x4c')]['find']({'where':{'name':_0x3f91a2,'userProfileId':_0x3ab70d['userProfileId']},'raw':!![]})['then'](function(_0x23ba0b){if(_0x23ba0b&&_0x23ba0b['autoAssociation']===0x0){return db[_0xe065('0x24')][_0xe065('0x46')]({'name':_0x3095c8[_0xe065('0x26')],'resourceId':_0x3095c8['id'],'type':_0x23ba0b['name'],'sectionId':_0x23ba0b['id']},{})[_0xe065('0x22')](function(){return _0x16898c;});}else{return _0x16898c;}})[_0xe065('0x4d')](function(_0x5cce78){logger[_0xe065('0x25')](_0xe065('0x4e'),_0x5cce78);throw _0x5cce78;});}return _0x16898c;})[_0xe065('0x22')](respondWithResult(_0x45fe1f,0xc9))[_0xe065('0x4d')](handleError(_0x45fe1f,null));};exports[_0xe065('0x21')]=function(_0x1ea568,_0xe77af6){if(_0x1ea568[_0xe065('0x4f')]['id']){delete _0x1ea568[_0xe065('0x4f')]['id'];}return db[_0xe065('0x2a')]['find']({'where':{'id':_0x1ea568[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xe77af6,null))[_0xe065('0x22')](saveUpdates(_0x1ea568[_0xe065('0x4f')],null))['then'](respondWithResult(_0xe77af6,null))[_0xe065('0x4d')](handleError(_0xe77af6,null));};exports[_0xe065('0x23')]=function(_0x21884d,_0xb1fca1){return db['VoiceMail'][_0xe065('0x45')]({'where':{'id':_0x21884d[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0xb1fca1,null))['then'](removeEntity(_0xb1fca1,null))[_0xe065('0x4d')](handleError(_0xb1fca1,null));};exports[_0xe065('0x50')]=function(_0x18b43e,_0x1f782f,_0x2d13ab){return db[_0xe065('0x2a')][_0xe065('0x51')]({'where':{'id':_0x18b43e[_0xe065('0x42')]['id']}})[_0xe065('0x22')](handleEntityNotFound(_0x1f782f,null))['then'](function(_0x2accad){var _0x550c37;var _0x44edf0={},_0x24fc1c={};_0x24fc1c[_0xe065('0x30')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x24fc1c[_0xe065('0x2d')]=_[_0xe065('0x43')](_0x18b43e[_0xe065('0x2d')]);_0x24fc1c[_0xe065('0x2e')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],_0x24fc1c[_0xe065('0x2d')]);_0x44edf0[_0xe065('0x31')]=_[_0xe065('0x2f')](_0x24fc1c[_0xe065('0x30')],qs[_0xe065('0x32')](_0x18b43e['query']['fields']));_0x44edf0[_0xe065('0x31')]=_0x44edf0[_0xe065('0x31')]['length']?_0x44edf0[_0xe065('0x31')]:_0x24fc1c['model'];if(!_0x18b43e['query'][_0xe065('0x34')](_0xe065('0x35'))){_0x44edf0[_0xe065('0x1b')]=qs[_0xe065('0x1b')](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1b')]);_0x44edf0[_0xe065('0x1a')]=qs['offset'](_0x18b43e[_0xe065('0x2d')][_0xe065('0x1a')]);}_0x44edf0[_0xe065('0x36')]=qs[_0xe065('0x37')](_0x18b43e[_0xe065('0x2d')]['sort']);_0x44edf0[_0xe065('0x3a')]=qs[_0xe065('0x2e')](_[_0xe065('0x38')](_0x18b43e[_0xe065('0x2d')],_0x24fc1c[_0xe065('0x2e')]));if(_0x18b43e[_0xe065('0x2d')]['filter']){_0x44edf0['where']=_['merge'](_0x44edf0['where'],{'$or':_['map'](_0x44edf0[_0xe065('0x31')],function(_0x45b033){var _0x1733b4={};_0x1733b4[_0x45b033]={'$like':'%'+_0x18b43e[_0xe065('0x2d')][_0xe065('0x39')]+'%'};return _0x1733b4;})});}_0x44edf0[_0xe065('0x3a')]=_[_0xe065('0x3b')](_0x44edf0[_0xe065('0x3a')],{'mailboxuser':_0x2accad['mailbox']});_0x44edf0=_['merge']({},_0x44edf0,_0x18b43e[_0xe065('0x3c')]);return db[_0xe065('0x52')][_0xe065('0x53')](_0x44edf0)['then'](respondWithFilteredResult(_0x1f782f,_0x44edf0));})[_0xe065('0x4d')](handleError(_0x1f782f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 4671f95..bf542b1 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 _0xc913=['api','bluebird','request-promise','path','exports','voice_voicemail','mailbox_context','lodash','util','../../config/logger'];(function(_0x4cd22f,_0x57c3ea){var _0x2342d3=function(_0x16684f){while(--_0x16684f){_0x4cd22f['push'](_0x4cd22f['shift']());}};_0x2342d3(++_0x57c3ea);}(_0xc913,0x1d3));var _0x3c91=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0xc913[_0x7a112];return _0x136dc5;};'use strict';var _=require(_0x3c91('0x0'));var util=require(_0x3c91('0x1'));var logger=require(_0x3c91('0x2'))(_0x3c91('0x3'));var moment=require('moment');var BPromise=require(_0x3c91('0x4'));var rp=require(_0x3c91('0x5'));var fs=require('fs');var path=require(_0x3c91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x3c91('0x7')]=function(_0x4f9837,_0x232973){return _0x4f9837['define']('VoiceMail',attributes,{'tableName':_0x3c91('0x8'),'paranoid':![],'indexes':[{'name':_0x3c91('0x9'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0932=['mailbox_context','mailbox','context','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','voice_voicemail'];(function(_0x14f30b,_0x4ac7ca){var _0x248b2e=function(_0x800f64){while(--_0x800f64){_0x14f30b['push'](_0x14f30b['shift']());}};_0x248b2e(++_0x4ac7ca);}(_0x0932,0xf3));var _0x2093=function(_0x9c4cfc,_0x460f72){_0x9c4cfc=_0x9c4cfc-0x0;var _0x54110f=_0x0932[_0x9c4cfc];return _0x54110f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2093('0x0'))(_0x2093('0x1'));var moment=require('moment');var BPromise=require(_0x2093('0x2'));var rp=require(_0x2093('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2093('0x4'));var config=require(_0x2093('0x5'));var attributes=require('./voiceMail.attributes');module[_0x2093('0x6')]=function(_0x4a7488,_0x1785fb){return _0x4a7488[_0x2093('0x7')]('VoiceMail',attributes,{'tableName':_0x2093('0x8'),'paranoid':![],'indexes':[{'name':_0x2093('0x9'),'fields':[_0x2093('0xa'),_0x2093('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d5f487a..25092aa 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 _0xe437=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0xe437,0x162));var _0x7e43=function(_0x3e75fe,_0x3fbf77){_0x3e75fe=_0x3e75fe-0x0;var _0x55bed1=_0xe437[_0x3e75fe];return _0x55bed1;};'use strict';var _=require('lodash');var util=require(_0x7e43('0x0'));var moment=require(_0x7e43('0x1'));var BPromise=require(_0x7e43('0x2'));var rs=require(_0x7e43('0x3'));var fs=require('fs');var Redis=require(_0x7e43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e43('0x5'));var logger=require(_0x7e43('0x6'))(_0x7e43('0x7'));var config=require(_0x7e43('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7e43('0x9')][_0x7e43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c2f2,_0x586858,_0x1ea19d){return new BPromise(function(_0x4f0225,_0x34cde4){return client[_0x7e43('0xb')](_0x32c2f2,_0x1ea19d)[_0x7e43('0xc')](function(_0x1128a0){logger[_0x7e43('0xd')](_0x7e43('0xe'),_0x586858,'request\x20sent');logger[_0x7e43('0xf')](_0x7e43('0x10'),_0x586858,_0x7e43('0x11'),JSON[_0x7e43('0x12')](_0x1128a0));if(_0x1128a0[_0x7e43('0x13')]){if(_0x1128a0[_0x7e43('0x13')][_0x7e43('0x14')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x586858,_0x1128a0[_0x7e43('0x13')][_0x7e43('0x15')]);return _0x34cde4(_0x1128a0[_0x7e43('0x13')][_0x7e43('0x15')]);}logger[_0x7e43('0x13')](_0x7e43('0xe'),_0x586858,_0x1128a0[_0x7e43('0x13')][_0x7e43('0x15')]);return _0x4f0225(_0x1128a0[_0x7e43('0x13')][_0x7e43('0x15')]);}else{logger[_0x7e43('0xd')](_0x7e43('0xe'),_0x586858,_0x7e43('0x11'));_0x4f0225(_0x1128a0[_0x7e43('0x16')][_0x7e43('0x15')]);}})[_0x7e43('0x17')](function(_0x56373b){logger[_0x7e43('0x13')](_0x7e43('0xe'),_0x586858,_0x56373b);_0x34cde4(_0x56373b);});});} \ No newline at end of file +var _0x042e=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x199381,_0x43a38e){var _0x3eaaa9=function(_0xea7ae8){while(--_0xea7ae8){_0x199381['push'](_0x199381['shift']());}};_0x3eaaa9(++_0x43a38e);}(_0x042e,0x78));var _0xe042=function(_0x527a61,_0x4c66b3){_0x527a61=_0x527a61-0x0;var _0x5d848b=_0x042e[_0x527a61];return _0x5d848b;};'use strict';var _=require(_0xe042('0x0'));var util=require('util');var moment=require(_0xe042('0x1'));var BPromise=require(_0xe042('0x2'));var rs=require(_0xe042('0x3'));var fs=require('fs');var Redis=require(_0xe042('0x4'));var db=require(_0xe042('0x5'))['db'];var utils=require(_0xe042('0x6'));var logger=require(_0xe042('0x7'))(_0xe042('0x8'));var config=require('../../config/environment');var jayson=require(_0xe042('0x9'));var client=jayson[_0xe042('0xa')][_0xe042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x221832,_0x53bfbe,_0x2c2774){return new BPromise(function(_0x366fec,_0x9905b8){return client[_0xe042('0xc')](_0x221832,_0x2c2774)[_0xe042('0xd')](function(_0xcd1251){logger[_0xe042('0xe')](_0xe042('0xf'),_0x53bfbe,_0xe042('0x10'));logger[_0xe042('0x11')](_0xe042('0x12'),_0x53bfbe,_0xe042('0x10'),JSON['stringify'](_0xcd1251));if(_0xcd1251['error']){if(_0xcd1251[_0xe042('0x13')][_0xe042('0x14')]===0x1f4){logger[_0xe042('0x13')]('VoiceMail,\x20%s,\x20%s',_0x53bfbe,_0xcd1251[_0xe042('0x13')][_0xe042('0x15')]);return _0x9905b8(_0xcd1251[_0xe042('0x13')][_0xe042('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x53bfbe,_0xcd1251[_0xe042('0x13')][_0xe042('0x15')]);return _0x366fec(_0xcd1251[_0xe042('0x13')][_0xe042('0x15')]);}else{logger[_0xe042('0xe')](_0xe042('0xf'),_0x53bfbe,_0xe042('0x10'));_0x366fec(_0xcd1251[_0xe042('0x16')][_0xe042('0x15')]);}})[_0xe042('0x17')](function(_0x506304){logger[_0xe042('0x13')](_0xe042('0xf'),_0x53bfbe,_0x506304);_0x9905b8(_0x506304);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 45c479a..d7a0216 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 _0x0c4a=['/:id/download','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x147d24,_0x317d71){var _0x279b24=function(_0x331c5f){while(--_0x331c5f){_0x147d24['push'](_0x147d24['shift']());}};_0x279b24(++_0x317d71);}(_0x0c4a,0x181));var _0xa0c4=function(_0x44660f,_0x318e00){_0x44660f=_0x44660f-0x0;var _0x25b0ea=_0x0c4a[_0x44660f];return _0x25b0ea;};'use strict';var multer=require(_0xa0c4('0x0'));var util=require(_0xa0c4('0x1'));var path=require('path');var timeout=require(_0xa0c4('0x2'));var express=require(_0xa0c4('0x3'));var router=express[_0xa0c4('0x4')]();var fs_extra=require(_0xa0c4('0x5'));var auth=require(_0xa0c4('0x6'));var interaction=require(_0xa0c4('0x7'));var config=require(_0xa0c4('0x8'));var controller=require('./voiceMailMessage.controller');router[_0xa0c4('0x9')]('/',auth[_0xa0c4('0xa')](),controller[_0xa0c4('0xb')]);router['get'](_0xa0c4('0xc'),auth[_0xa0c4('0xa')](),controller[_0xa0c4('0xd')]);router['get'](_0xa0c4('0xe'),auth[_0xa0c4('0xa')](),controller['download']);router['post']('/',auth[_0xa0c4('0xa')](),controller[_0xa0c4('0xf')]);router[_0xa0c4('0x10')](_0xa0c4('0xc'),auth[_0xa0c4('0xa')](),controller[_0xa0c4('0x11')]);router[_0xa0c4('0x12')](_0xa0c4('0xc'),auth[_0xa0c4('0xa')](),controller[_0xa0c4('0x13')]);module[_0xa0c4('0x14')]=router; \ No newline at end of file +var _0x34c9=['isAuthenticated','index','/:id','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x34c9,0x1d8));var _0x934c=function(_0x2c69ce,_0x20a1ed){_0x2c69ce=_0x2c69ce-0x0;var _0x42c981=_0x34c9[_0x2c69ce];return _0x42c981;};'use strict';var multer=require(_0x934c('0x0'));var util=require(_0x934c('0x1'));var path=require(_0x934c('0x2'));var timeout=require(_0x934c('0x3'));var express=require(_0x934c('0x4'));var router=express[_0x934c('0x5')]();var fs_extra=require(_0x934c('0x6'));var auth=require(_0x934c('0x7'));var interaction=require(_0x934c('0x8'));var config=require(_0x934c('0x9'));var controller=require('./voiceMailMessage.controller');router[_0x934c('0xa')]('/',auth[_0x934c('0xb')](),controller[_0x934c('0xc')]);router[_0x934c('0xa')](_0x934c('0xd'),auth[_0x934c('0xb')](),controller['show']);router['get']('/:id/download',auth[_0x934c('0xb')](),controller[_0x934c('0xe')]);router[_0x934c('0xf')]('/',auth[_0x934c('0xb')](),controller[_0x934c('0x10')]);router[_0x934c('0x11')](_0x934c('0xd'),auth[_0x934c('0xb')](),controller['update']);router[_0x934c('0x12')](_0x934c('0xd'),auth['isAuthenticated'](),controller[_0x934c('0x13')]);module[_0x934c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5426c9c..087823e 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 _0xcfcc=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x2d5d0d,_0x4b1a92){var _0x33a2b=function(_0x9e9ede){while(--_0x9e9ede){_0x2d5d0d['push'](_0x2d5d0d['shift']());}};_0x33a2b(++_0x4b1a92);}(_0xcfcc,0x1f3));var _0xccfc=function(_0x1d52bb,_0x5c1482){_0x1d52bb=_0x1d52bb-0x0;var _0x4fb8b4=_0xcfcc[_0x1d52bb];return _0x4fb8b4;};'use strict';var Sequelize=require(_0xccfc('0x0'));module[_0xccfc('0x1')]={'name':{'type':Sequelize[_0xccfc('0x2')],'get':function(_0x1b9bed){return this[_0xccfc('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xccfc('0x5')](_0xccfc('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xccfc('0x4')],'defaultValue':''},'stamp':{'type':_0xccfc('0x7'),'defaultValue':Sequelize[_0xccfc('0x8')](_0xccfc('0x9'))}}; \ No newline at end of file +var _0xd82b=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x511a19,_0x417e36){var _0x499aa6=function(_0x270874){while(--_0x270874){_0x511a19['push'](_0x511a19['shift']());}};_0x499aa6(++_0x417e36);}(_0xd82b,0x1e7));var _0xbd82=function(_0x11e4c7,_0x5f15c5){_0x11e4c7=_0x11e4c7-0x0;var _0x42c19a=_0xd82b[_0x11e4c7];return _0x42c19a;};'use strict';var Sequelize=require(_0xbd82('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd82('0x1')],'get':function(_0x452eca){return this[_0xbd82('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xbd82('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xbd82('0x5')](_0xbd82('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xbd82('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xbd82('0x7'),'defaultValue':Sequelize[_0xbd82('0x8')](_0xbd82('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3d06aa4..e9bf1af 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 _0xb860=['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','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','include','rows','show','rawAttributes','find','catch','create','body','update','params','download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x135087,_0x1ebcfc){var _0x4fe7ce=function(_0x10b674){while(--_0x10b674){_0x135087['push'](_0x135087['shift']());}};_0x4fe7ce(++_0x1ebcfc);}(_0xb860,0xaf));var _0x0b86=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0xb860[_0xac3328];return _0x33aec4;};'use strict';var emlformat=require(_0x0b86('0x0'));var rimraf=require(_0x0b86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b86('0x2'));var rp=require(_0x0b86('0x3'));var moment=require(_0x0b86('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b86('0x5'));var util=require('util');var path=require(_0x0b86('0x6'));var sox=require(_0x0b86('0x7'));var csv=require(_0x0b86('0x8'));var ejs=require(_0x0b86('0x9'));var fs=require('fs');var fs_extra=require(_0x0b86('0xa'));var _=require(_0x0b86('0xb'));var squel=require(_0x0b86('0xc'));var crypto=require(_0x0b86('0xd'));var jsforce=require(_0x0b86('0xe'));var deskjs=require(_0x0b86('0xf'));var toCsv=require(_0x0b86('0x8'));var querystring=require(_0x0b86('0x10'));var Papa=require(_0x0b86('0x11'));var Redis=require(_0x0b86('0x12'));var authService=require(_0x0b86('0x13'));var qs=require(_0x0b86('0x14'));var as=require(_0x0b86('0x15'));var hardwareService=require(_0x0b86('0x16'));var logger=require(_0x0b86('0x17'))(_0x0b86('0x18'));var utils=require(_0x0b86('0x19'));var config=require(_0x0b86('0x1a'));var licenseUtil=require(_0x0b86('0x1b'));var db=require(_0x0b86('0x1c'))['db'];function respondWithStatusCode(_0x145865,_0x55a14c){_0x55a14c=_0x55a14c||0xcc;return function(_0x55ec89){if(_0x55ec89){return _0x145865['sendStatus'](_0x55a14c);}return _0x145865[_0x0b86('0x1d')](_0x55a14c)[_0x0b86('0x1e')]();};}function respondWithResult(_0x134949,_0x27a513){_0x27a513=_0x27a513||0xc8;return function(_0x31d839){if(_0x31d839){return _0x134949['status'](_0x27a513)[_0x0b86('0x1f')](_0x31d839);}};}function respondWithFilteredResult(_0x3519e2,_0xc4e164){return function(_0x419fb2){if(_0x419fb2){var _0x2f5d95=typeof _0xc4e164['offset']===_0x0b86('0x20')&&typeof _0xc4e164['limit']==='undefined';var _0x57e8b8=_0x419fb2['count'];var _0x56ab84=_0x2f5d95?0x0:_0xc4e164['offset'];var _0x109f52=_0x2f5d95?_0x419fb2[_0x0b86('0x21')]:_0xc4e164[_0x0b86('0x22')]+_0xc4e164['limit'];var _0x4edccc;if(_0x109f52>=_0x57e8b8){_0x109f52=_0x57e8b8;_0x4edccc=0xc8;}else{_0x4edccc=0xce;}_0x3519e2[_0x0b86('0x1d')](_0x4edccc);return _0x3519e2[_0x0b86('0x23')](_0x0b86('0x24'),_0x56ab84+'-'+_0x109f52+'/'+_0x57e8b8)[_0x0b86('0x1f')](_0x419fb2);}return null;};}function patchUpdates(_0x154abe){return function(_0x51e92a){try{jsonpatch[_0x0b86('0x25')](_0x51e92a,_0x154abe,!![]);}catch(_0x47a7ff){return BPromise[_0x0b86('0x26')](_0x47a7ff);}return _0x51e92a[_0x0b86('0x27')]();};}function saveUpdates(_0x55b626,_0x201b5c){return function(_0x28234c){if(_0x28234c){return _0x28234c['update'](_0x55b626)[_0x0b86('0x28')](function(_0x25dc18){return _0x25dc18;});}return null;};}function removeEntity(_0x5c4832,_0x57eb76){return function(_0x25c4dc){if(_0x25c4dc){return _0x25c4dc[_0x0b86('0x29')]()[_0x0b86('0x28')](function(){_0x5c4832[_0x0b86('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40c301,_0x425a8f){return function(_0x58f9f1){if(!_0x58f9f1){_0x40c301[_0x0b86('0x2a')](0x194);}return _0x58f9f1;};}function handleError(_0x19f594,_0x4a4892){_0x4a4892=_0x4a4892||0x1f4;return function(_0x4482e4){logger[_0x0b86('0x2b')](_0x4482e4[_0x0b86('0x2c')]);if(_0x4482e4['name']){delete _0x4482e4[_0x0b86('0x2d')];}_0x19f594['status'](_0x4a4892)[_0x0b86('0x2e')](_0x4482e4);};}exports[_0x0b86('0x2f')]=function(_0x26a91a,_0x241079){var _0x6bb7d3={},_0x958688={},_0x20b35b={'count':0x0,'rows':[]};var _0x424001=_[_0x0b86('0x30')](db[_0x0b86('0x31')]['rawAttributes'],function(_0x44e0aa){return{'name':_0x44e0aa[_0x0b86('0x32')],'type':_0x44e0aa[_0x0b86('0x33')]['key']};});_0x958688[_0x0b86('0x34')]=_[_0x0b86('0x35')](_[_0x0b86('0x30')](_0x424001,'name'),['name']);_0x958688[_0x0b86('0x36')]=_[_0x0b86('0x37')](_0x26a91a['query']);_0x958688['filters']=_[_0x0b86('0x38')](_0x958688[_0x0b86('0x34')],_0x958688[_0x0b86('0x36')]);_0x6bb7d3[_0x0b86('0x39')]=_[_0x0b86('0x38')](_0x958688['model'],qs['fields'](_0x26a91a[_0x0b86('0x36')][_0x0b86('0x3a')]));_0x6bb7d3[_0x0b86('0x39')]=_0x6bb7d3['attributes'][_0x0b86('0x3b')]?_0x6bb7d3[_0x0b86('0x39')]:_0x958688[_0x0b86('0x34')];if(!_0x26a91a[_0x0b86('0x36')]['hasOwnProperty'](_0x0b86('0x3c'))){_0x6bb7d3['limit']=qs[_0x0b86('0x3d')](_0x26a91a['query'][_0x0b86('0x3d')]);_0x6bb7d3['offset']=qs[_0x0b86('0x22')](_0x26a91a['query'][_0x0b86('0x22')]);}_0x6bb7d3[_0x0b86('0x3e')]=qs['sort'](_0x26a91a[_0x0b86('0x36')][_0x0b86('0x3f')]);_0x6bb7d3[_0x0b86('0x40')]=qs[_0x0b86('0x41')](_['pick'](_0x26a91a[_0x0b86('0x36')],_0x958688[_0x0b86('0x41')]),_0x424001);if(_0x26a91a[_0x0b86('0x36')]['filter']){_0x6bb7d3[_0x0b86('0x40')]=_['merge'](_0x6bb7d3[_0x0b86('0x40')],{'$or':_['map'](_0x424001,function(_0x452606){if(_0x452606[_0x0b86('0x33')]!==_0x0b86('0x42')){var _0x3bdee9={};_0x3bdee9[_0x452606[_0x0b86('0x2d')]]={'$like':'%'+_0x26a91a[_0x0b86('0x36')][_0x0b86('0x43')]+'%'};return _0x3bdee9;}})});}_0x6bb7d3=_[_0x0b86('0x44')]({},_0x6bb7d3,_0x26a91a[_0x0b86('0x45')]);var _0x5c4222={'where':_0x6bb7d3[_0x0b86('0x40')]};return db[_0x0b86('0x31')][_0x0b86('0x21')](_0x5c4222)[_0x0b86('0x28')](function(_0x14100c){_0x20b35b[_0x0b86('0x21')]=_0x14100c;if(_0x26a91a[_0x0b86('0x36')][_0x0b86('0x46')]){_0x6bb7d3[_0x0b86('0x47')]=[{'all':!![]}];}return db[_0x0b86('0x31')]['findAll'](_0x6bb7d3);})[_0x0b86('0x28')](function(_0x10f34d){_0x20b35b[_0x0b86('0x48')]=_0x10f34d;return _0x20b35b;})[_0x0b86('0x28')](respondWithFilteredResult(_0x241079,_0x6bb7d3))['catch'](handleError(_0x241079,null));};exports[_0x0b86('0x49')]=function(_0x51aa0d,_0x3b8c79){var _0x245161={'raw':!![],'where':{'id':_0x51aa0d['params']['id']}},_0x51eb23={};_0x51eb23['model']=_[_0x0b86('0x37')](db[_0x0b86('0x31')][_0x0b86('0x4a')]);_0x51eb23[_0x0b86('0x36')]=_[_0x0b86('0x37')](_0x51aa0d[_0x0b86('0x36')]);_0x51eb23[_0x0b86('0x41')]=_[_0x0b86('0x38')](_0x51eb23[_0x0b86('0x34')],_0x51eb23[_0x0b86('0x36')]);_0x245161[_0x0b86('0x39')]=_[_0x0b86('0x38')](_0x51eb23[_0x0b86('0x34')],qs[_0x0b86('0x3a')](_0x51aa0d[_0x0b86('0x36')][_0x0b86('0x3a')]));_0x245161[_0x0b86('0x39')]=_0x245161[_0x0b86('0x39')][_0x0b86('0x3b')]?_0x245161[_0x0b86('0x39')]:_0x51eb23['model'];if(_0x51aa0d['query'][_0x0b86('0x46')]){_0x245161[_0x0b86('0x47')]=[{'all':!![]}];}_0x245161=_[_0x0b86('0x44')]({},_0x245161,_0x51aa0d[_0x0b86('0x45')]);return db[_0x0b86('0x31')][_0x0b86('0x4b')](_0x245161)[_0x0b86('0x28')](handleEntityNotFound(_0x3b8c79,null))[_0x0b86('0x28')](respondWithResult(_0x3b8c79,null))[_0x0b86('0x4c')](handleError(_0x3b8c79,null));};exports[_0x0b86('0x4d')]=function(_0x391710,_0x2cda09){return db[_0x0b86('0x31')][_0x0b86('0x4d')](_0x391710[_0x0b86('0x4e')],{})[_0x0b86('0x28')](respondWithResult(_0x2cda09,0xc9))[_0x0b86('0x4c')](handleError(_0x2cda09,null));};exports[_0x0b86('0x4f')]=function(_0x58908b,_0x27851f){if(_0x58908b[_0x0b86('0x4e')]['id']){delete _0x58908b[_0x0b86('0x4e')]['id'];}return db[_0x0b86('0x31')][_0x0b86('0x4b')]({'where':{'id':_0x58908b[_0x0b86('0x50')]['id']}})[_0x0b86('0x28')](handleEntityNotFound(_0x27851f,null))[_0x0b86('0x28')](saveUpdates(_0x58908b[_0x0b86('0x4e')],null))[_0x0b86('0x28')](respondWithResult(_0x27851f,null))['catch'](handleError(_0x27851f,null));};exports[_0x0b86('0x29')]=function(_0x27e346,_0x545e72){return db[_0x0b86('0x31')][_0x0b86('0x4b')]({'where':{'id':_0x27e346[_0x0b86('0x50')]['id']}})['then'](handleEntityNotFound(_0x545e72,null))[_0x0b86('0x28')](removeEntity(_0x545e72,null))[_0x0b86('0x4c')](handleError(_0x545e72,null));};exports[_0x0b86('0x51')]=function(_0x234dc4,_0x4dec9d,_0x25fa0c){return db[_0x0b86('0x31')][_0x0b86('0x4b')]({'where':{'id':_0x234dc4['params']['id']},'attributes':['id','recording','msg_id']})[_0x0b86('0x28')](handleEntityNotFound(_0x4dec9d,null))[_0x0b86('0x28')](function(_0x514b7b){if(_0x514b7b){if(!_0x514b7b[_0x0b86('0x52')]){throw new db[(_0x0b86('0x53'))][(_0x0b86('0x54'))]('VoiceMailMessage\x20not\x20found');}var _0x278bf8={'Content-Type':_0x0b86('0x55'),'Content-Disposition':_0x0b86('0x56')};if(_0x514b7b[_0x0b86('0x57')]){_0x278bf8[_0x0b86('0x58')]=_0x0b86('0x59')+_0x514b7b[_0x0b86('0x57')]+_0x0b86('0x5a');}_0x4dec9d[_0x0b86('0x23')](_0x278bf8);return _0x4dec9d[_0x0b86('0x2e')](new Buffer(_0x514b7b[_0x0b86('0x52')]));}})[_0x0b86('0x4c')](handleError(_0x4dec9d,null));}; \ No newline at end of file +var _0xb9c4=['save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','limit','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','create','body','find','params','recording','msg_id','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0xaa4f3,_0x37be20){var _0x163cc9=function(_0x4fa98c){while(--_0x4fa98c){_0xaa4f3['push'](_0xaa4f3['shift']());}};_0x163cc9(++_0x37be20);}(_0xb9c4,0x16d));var _0x4b9c=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xb9c4[_0x45d1fd];return _0xd0e542;};'use strict';var emlformat=require(_0x4b9c('0x0'));var rimraf=require(_0x4b9c('0x1'));var zipdir=require(_0x4b9c('0x2'));var jsonpatch=require(_0x4b9c('0x3'));var rp=require(_0x4b9c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b9c('0x5'));var util=require(_0x4b9c('0x6'));var path=require('path');var sox=require(_0x4b9c('0x7'));var csv=require('to-csv');var ejs=require(_0x4b9c('0x8'));var fs=require('fs');var fs_extra=require(_0x4b9c('0x9'));var _=require(_0x4b9c('0xa'));var squel=require(_0x4b9c('0xb'));var crypto=require(_0x4b9c('0xc'));var jsforce=require(_0x4b9c('0xd'));var deskjs=require(_0x4b9c('0xe'));var toCsv=require(_0x4b9c('0xf'));var querystring=require(_0x4b9c('0x10'));var Papa=require(_0x4b9c('0x11'));var Redis=require(_0x4b9c('0x12'));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(_0x4b9c('0x13'))(_0x4b9c('0x14'));var utils=require('../../config/utils');var config=require(_0x4b9c('0x15'));var licenseUtil=require(_0x4b9c('0x16'));var db=require(_0x4b9c('0x17'))['db'];function respondWithStatusCode(_0x4564d1,_0x4937c3){_0x4937c3=_0x4937c3||0xcc;return function(_0x531124){if(_0x531124){return _0x4564d1[_0x4b9c('0x18')](_0x4937c3);}return _0x4564d1['status'](_0x4937c3)[_0x4b9c('0x19')]();};}function respondWithResult(_0x25acc7,_0x176abf){_0x176abf=_0x176abf||0xc8;return function(_0x520a81){if(_0x520a81){return _0x25acc7[_0x4b9c('0x1a')](_0x176abf)[_0x4b9c('0x1b')](_0x520a81);}};}function respondWithFilteredResult(_0x4dbfb4,_0x1b2181){return function(_0x2ab576){if(_0x2ab576){var _0x5bf788=typeof _0x1b2181[_0x4b9c('0x1c')]===_0x4b9c('0x1d')&&typeof _0x1b2181['limit']==='undefined';var _0x262599=_0x2ab576[_0x4b9c('0x1e')];var _0x475734=_0x5bf788?0x0:_0x1b2181[_0x4b9c('0x1c')];var _0x5ce934=_0x5bf788?_0x2ab576[_0x4b9c('0x1e')]:_0x1b2181[_0x4b9c('0x1c')]+_0x1b2181['limit'];var _0xd987ff;if(_0x5ce934>=_0x262599){_0x5ce934=_0x262599;_0xd987ff=0xc8;}else{_0xd987ff=0xce;}_0x4dbfb4[_0x4b9c('0x1a')](_0xd987ff);return _0x4dbfb4[_0x4b9c('0x1f')](_0x4b9c('0x20'),_0x475734+'-'+_0x5ce934+'/'+_0x262599)[_0x4b9c('0x1b')](_0x2ab576);}return null;};}function patchUpdates(_0x41bea7){return function(_0x64d628){try{jsonpatch[_0x4b9c('0x21')](_0x64d628,_0x41bea7,!![]);}catch(_0xbd2eb2){return BPromise[_0x4b9c('0x22')](_0xbd2eb2);}return _0x64d628[_0x4b9c('0x23')]();};}function saveUpdates(_0x48f3b4,_0x197e99){return function(_0x32d664){if(_0x32d664){return _0x32d664[_0x4b9c('0x24')](_0x48f3b4)[_0x4b9c('0x25')](function(_0x276e2b){return _0x276e2b;});}return null;};}function removeEntity(_0x398b6a,_0x54d95e){return function(_0x46c086){if(_0x46c086){return _0x46c086[_0x4b9c('0x26')]()[_0x4b9c('0x25')](function(){_0x398b6a[_0x4b9c('0x1a')](0xcc)[_0x4b9c('0x19')]();});}};}function handleEntityNotFound(_0x530b96,_0x5b8ad6){return function(_0x11d886){if(!_0x11d886){_0x530b96[_0x4b9c('0x18')](0x194);}return _0x11d886;};}function handleError(_0x450948,_0x1a657e){_0x1a657e=_0x1a657e||0x1f4;return function(_0x20eefa){logger[_0x4b9c('0x27')](_0x20eefa[_0x4b9c('0x28')]);if(_0x20eefa[_0x4b9c('0x29')]){delete _0x20eefa[_0x4b9c('0x29')];}_0x450948[_0x4b9c('0x1a')](_0x1a657e)[_0x4b9c('0x2a')](_0x20eefa);};}exports[_0x4b9c('0x2b')]=function(_0xbe5c0,_0x5c5e50){var _0xb138bb={},_0x213419={},_0x5b59f5={'count':0x0,'rows':[]};var _0x3b032a=_[_0x4b9c('0x2c')](db[_0x4b9c('0x2d')][_0x4b9c('0x2e')],function(_0x3b6170){return{'name':_0x3b6170[_0x4b9c('0x2f')],'type':_0x3b6170['type']['key']};});_0x213419[_0x4b9c('0x30')]=_[_0x4b9c('0x31')](_['map'](_0x3b032a,'name'),['name']);_0x213419['query']=_[_0x4b9c('0x32')](_0xbe5c0['query']);_0x213419[_0x4b9c('0x33')]=_[_0x4b9c('0x34')](_0x213419[_0x4b9c('0x30')],_0x213419[_0x4b9c('0x35')]);_0xb138bb['attributes']=_[_0x4b9c('0x34')](_0x213419['model'],qs['fields'](_0xbe5c0[_0x4b9c('0x35')][_0x4b9c('0x36')]));_0xb138bb['attributes']=_0xb138bb[_0x4b9c('0x37')][_0x4b9c('0x38')]?_0xb138bb[_0x4b9c('0x37')]:_0x213419[_0x4b9c('0x30')];if(!_0xbe5c0[_0x4b9c('0x35')][_0x4b9c('0x39')]('nolimit')){_0xb138bb[_0x4b9c('0x3a')]=qs[_0x4b9c('0x3a')](_0xbe5c0[_0x4b9c('0x35')]['limit']);_0xb138bb[_0x4b9c('0x1c')]=qs[_0x4b9c('0x1c')](_0xbe5c0['query'][_0x4b9c('0x1c')]);}_0xb138bb['order']=qs[_0x4b9c('0x3b')](_0xbe5c0[_0x4b9c('0x35')][_0x4b9c('0x3b')]);_0xb138bb['where']=qs[_0x4b9c('0x33')](_[_0x4b9c('0x3c')](_0xbe5c0['query'],_0x213419[_0x4b9c('0x33')]),_0x3b032a);if(_0xbe5c0[_0x4b9c('0x35')]['filter']){_0xb138bb['where']=_[_0x4b9c('0x3d')](_0xb138bb[_0x4b9c('0x3e')],{'$or':_[_0x4b9c('0x2c')](_0x3b032a,function(_0x39d9d8){if(_0x39d9d8[_0x4b9c('0x3f')]!==_0x4b9c('0x40')){var _0x5ebf8d={};_0x5ebf8d[_0x39d9d8[_0x4b9c('0x29')]]={'$like':'%'+_0xbe5c0['query'][_0x4b9c('0x41')]+'%'};return _0x5ebf8d;}})});}_0xb138bb=_['merge']({},_0xb138bb,_0xbe5c0[_0x4b9c('0x42')]);var _0x44b10f={'where':_0xb138bb[_0x4b9c('0x3e')]};return db['VoiceMailMessage'][_0x4b9c('0x1e')](_0x44b10f)['then'](function(_0x46c98e){_0x5b59f5[_0x4b9c('0x1e')]=_0x46c98e;if(_0xbe5c0[_0x4b9c('0x35')][_0x4b9c('0x43')]){_0xb138bb[_0x4b9c('0x44')]=[{'all':!![]}];}return db[_0x4b9c('0x2d')][_0x4b9c('0x45')](_0xb138bb);})[_0x4b9c('0x25')](function(_0x443a14){_0x5b59f5['rows']=_0x443a14;return _0x5b59f5;})['then'](respondWithFilteredResult(_0x5c5e50,_0xb138bb))[_0x4b9c('0x46')](handleError(_0x5c5e50,null));};exports[_0x4b9c('0x47')]=function(_0xce039a,_0x5105ef){var _0x58f748={'raw':!![],'where':{'id':_0xce039a['params']['id']}},_0x50063a={};_0x50063a[_0x4b9c('0x30')]=_['keys'](db['VoiceMailMessage'][_0x4b9c('0x2e')]);_0x50063a[_0x4b9c('0x35')]=_[_0x4b9c('0x32')](_0xce039a[_0x4b9c('0x35')]);_0x50063a['filters']=_['intersection'](_0x50063a[_0x4b9c('0x30')],_0x50063a[_0x4b9c('0x35')]);_0x58f748[_0x4b9c('0x37')]=_['intersection'](_0x50063a[_0x4b9c('0x30')],qs[_0x4b9c('0x36')](_0xce039a[_0x4b9c('0x35')][_0x4b9c('0x36')]));_0x58f748[_0x4b9c('0x37')]=_0x58f748[_0x4b9c('0x37')][_0x4b9c('0x38')]?_0x58f748[_0x4b9c('0x37')]:_0x50063a[_0x4b9c('0x30')];if(_0xce039a[_0x4b9c('0x35')]['includeAll']){_0x58f748['include']=[{'all':!![]}];}_0x58f748=_[_0x4b9c('0x3d')]({},_0x58f748,_0xce039a[_0x4b9c('0x42')]);return db['VoiceMailMessage']['find'](_0x58f748)[_0x4b9c('0x25')](handleEntityNotFound(_0x5105ef,null))[_0x4b9c('0x25')](respondWithResult(_0x5105ef,null))['catch'](handleError(_0x5105ef,null));};exports[_0x4b9c('0x48')]=function(_0x4b8831,_0x107ff9){return db['VoiceMailMessage']['create'](_0x4b8831[_0x4b9c('0x49')],{})[_0x4b9c('0x25')](respondWithResult(_0x107ff9,0xc9))['catch'](handleError(_0x107ff9,null));};exports['update']=function(_0x497bf1,_0x3504bb){if(_0x497bf1['body']['id']){delete _0x497bf1['body']['id'];}return db['VoiceMailMessage'][_0x4b9c('0x4a')]({'where':{'id':_0x497bf1[_0x4b9c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3504bb,null))[_0x4b9c('0x25')](saveUpdates(_0x497bf1['body'],null))[_0x4b9c('0x25')](respondWithResult(_0x3504bb,null))[_0x4b9c('0x46')](handleError(_0x3504bb,null));};exports[_0x4b9c('0x26')]=function(_0x44b9be,_0xbf950e){return db[_0x4b9c('0x2d')][_0x4b9c('0x4a')]({'where':{'id':_0x44b9be[_0x4b9c('0x4b')]['id']}})[_0x4b9c('0x25')](handleEntityNotFound(_0xbf950e,null))[_0x4b9c('0x25')](removeEntity(_0xbf950e,null))[_0x4b9c('0x46')](handleError(_0xbf950e,null));};exports['download']=function(_0x3667a0,_0x463b01,_0x4a38b8){return db[_0x4b9c('0x2d')][_0x4b9c('0x4a')]({'where':{'id':_0x3667a0['params']['id']},'attributes':['id',_0x4b9c('0x4c'),'msg_id']})[_0x4b9c('0x25')](handleEntityNotFound(_0x463b01,null))['then'](function(_0x4af6f5){if(_0x4af6f5){if(!_0x4af6f5[_0x4b9c('0x4c')]){throw new db['Sequelize']['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x2bda03={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4af6f5[_0x4b9c('0x4d')]){_0x2bda03[_0x4b9c('0x4e')]='attachment;\x20filename=\x22'+_0x4af6f5[_0x4b9c('0x4d')]+_0x4b9c('0x4f');}_0x463b01['set'](_0x2bda03);return _0x463b01[_0x4b9c('0x2a')](new Buffer(_0x4af6f5[_0x4b9c('0x4c')]));}})[_0x4b9c('0x46')](handleError(_0x463b01,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ebaa3b3..93e2164 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 _0x948d=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x948d,0x176));var _0xd948=function(_0x24c3cc,_0x599bce){_0x24c3cc=_0x24c3cc-0x0;var _0x223959=_0x948d[_0x24c3cc];return _0x223959;};'use strict';var _=require('lodash');var util=require(_0xd948('0x0'));var logger=require(_0xd948('0x1'))(_0xd948('0x2'));var moment=require(_0xd948('0x3'));var BPromise=require(_0xd948('0x4'));var rp=require(_0xd948('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd948('0x6'));var config=require(_0xd948('0x7'));var attributes=require(_0xd948('0x8'));module[_0xd948('0x9')]=function(_0xd0b5f9,_0x1e9b39){return _0xd0b5f9[_0xd948('0xa')](_0xd948('0xb'),attributes,{'tableName':_0xd948('0xc'),'paranoid':![],'indexes':[{'name':_0xd948('0xd'),'fields':[_0xd948('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4114=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','../../config/logger'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0x4114,0xe2));var _0x4411=function(_0x30817e,_0x1445bc){_0x30817e=_0x30817e-0x0;var _0x24842b=_0x4114[_0x30817e];return _0x24842b;};'use strict';var _=require(_0x4411('0x0'));var util=require('util');var logger=require(_0x4411('0x1'))(_0x4411('0x2'));var moment=require(_0x4411('0x3'));var BPromise=require(_0x4411('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4411('0x5'));var rimraf=require(_0x4411('0x6'));var config=require(_0x4411('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x4411('0x8')]=function(_0x183263,_0x55d96b){return _0x183263[_0x4411('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x4411('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x4411('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 1a91885..b3ff630 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 _0x8d9a=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3c217a,_0x1b4f43){var _0x2b24de=function(_0x244ffd){while(--_0x244ffd){_0x3c217a['push'](_0x3c217a['shift']());}};_0x2b24de(++_0x1b4f43);}(_0x8d9a,0xa4));var _0xa8d9=function(_0x17577f,_0x1e40ab){_0x17577f=_0x17577f-0x0;var _0x1c27e3=_0x8d9a[_0x17577f];return _0x1c27e3;};'use strict';var _=require('lodash');var util=require(_0xa8d9('0x0'));var moment=require(_0xa8d9('0x1'));var BPromise=require(_0xa8d9('0x2'));var rs=require(_0xa8d9('0x3'));var fs=require('fs');var Redis=require(_0xa8d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8d9('0x5'));var logger=require(_0xa8d9('0x6'))('rpc');var config=require(_0xa8d9('0x7'));var jayson=require(_0xa8d9('0x8'));var client=jayson[_0xa8d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e400b,_0xb5e418,_0x3f05bc){return new BPromise(function(_0x1c9ca3,_0xd797f8){return client['request'](_0x2e400b,_0x3f05bc)[_0xa8d9('0xa')](function(_0x373a24){logger[_0xa8d9('0xb')](_0xa8d9('0xc'),_0xb5e418,_0xa8d9('0xd'));logger[_0xa8d9('0xe')](_0xa8d9('0xf'),_0xb5e418,_0xa8d9('0xd'),JSON[_0xa8d9('0x10')](_0x373a24));if(_0x373a24['error']){if(_0x373a24[_0xa8d9('0x11')]['code']===0x1f4){logger[_0xa8d9('0x11')](_0xa8d9('0xc'),_0xb5e418,_0x373a24[_0xa8d9('0x11')]['message']);return _0xd797f8(_0x373a24[_0xa8d9('0x11')][_0xa8d9('0x12')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xb5e418,_0x373a24[_0xa8d9('0x11')][_0xa8d9('0x12')]);return _0x1c9ca3(_0x373a24[_0xa8d9('0x11')][_0xa8d9('0x12')]);}else{logger[_0xa8d9('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0xb5e418,_0xa8d9('0xd'));_0x1c9ca3(_0x373a24[_0xa8d9('0x13')]['message']);}})[_0xa8d9('0x14')](function(_0x1d5da5){logger[_0xa8d9('0x11')](_0xa8d9('0xc'),_0xb5e418,_0x1d5da5);_0xd797f8(_0x1d5da5);});});} \ No newline at end of file +var _0xd7f7=['then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7f7,0xb4));var _0x7d7f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd7f7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7d7f('0x0'));var util=require(_0x7d7f('0x1'));var moment=require(_0x7d7f('0x2'));var BPromise=require(_0x7d7f('0x3'));var rs=require(_0x7d7f('0x4'));var fs=require('fs');var Redis=require(_0x7d7f('0x5'));var db=require(_0x7d7f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d7f('0x7'))('rpc');var config=require(_0x7d7f('0x8'));var jayson=require(_0x7d7f('0x9'));var client=jayson[_0x7d7f('0xa')][_0x7d7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402a73,_0x3155cd,_0x25cb42){return new BPromise(function(_0x1f5b2d,_0x376b2a){return client['request'](_0x402a73,_0x25cb42)[_0x7d7f('0xc')](function(_0x2e692f){logger[_0x7d7f('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x3155cd,_0x7d7f('0xe'));logger[_0x7d7f('0xf')](_0x7d7f('0x10'),_0x3155cd,_0x7d7f('0xe'),JSON[_0x7d7f('0x11')](_0x2e692f));if(_0x2e692f[_0x7d7f('0x12')]){if(_0x2e692f['error'][_0x7d7f('0x13')]===0x1f4){logger[_0x7d7f('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x3155cd,_0x2e692f[_0x7d7f('0x12')][_0x7d7f('0x14')]);return _0x376b2a(_0x2e692f[_0x7d7f('0x12')]['message']);}logger[_0x7d7f('0x12')](_0x7d7f('0x15'),_0x3155cd,_0x2e692f[_0x7d7f('0x12')][_0x7d7f('0x14')]);return _0x1f5b2d(_0x2e692f[_0x7d7f('0x12')][_0x7d7f('0x14')]);}else{logger[_0x7d7f('0xd')](_0x7d7f('0x15'),_0x3155cd,_0x7d7f('0xe'));_0x1f5b2d(_0x2e692f[_0x7d7f('0x16')][_0x7d7f('0x14')]);}})[_0x7d7f('0x17')](function(_0x498b75){logger['error'](_0x7d7f('0x15'),_0x3155cd,_0x498b75);_0x376b2a(_0x498b75);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9f6186a..9ee683c 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 _0xcf8c=['/:id/sounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d61c5,_0x2e558f){var _0x1d05bb=function(_0x184439){while(--_0x184439){_0x2d61c5['push'](_0x2d61c5['shift']());}};_0x1d05bb(++_0x2e558f);}(_0xcf8c,0xec));var _0xccf8=function(_0x482c05,_0x5d03eb){_0x482c05=_0x482c05-0x0;var _0x468bc6=_0xcf8c[_0x482c05];return _0x468bc6;};'use strict';var multer=require(_0xccf8('0x0'));var util=require('util');var path=require(_0xccf8('0x1'));var timeout=require(_0xccf8('0x2'));var express=require('express');var router=express[_0xccf8('0x3')]();var fs_extra=require(_0xccf8('0x4'));var auth=require(_0xccf8('0x5'));var interaction=require(_0xccf8('0x6'));var config=require(_0xccf8('0x7'));var controller=require(_0xccf8('0x8'));router[_0xccf8('0x9')]('/',auth[_0xccf8('0xa')](),controller[_0xccf8('0xb')]);router[_0xccf8('0x9')](_0xccf8('0xc'),auth[_0xccf8('0xa')](),controller[_0xccf8('0xd')]);router['get'](_0xccf8('0xe'),auth[_0xccf8('0xa')](),controller['getSounds']);router[_0xccf8('0xf')]('/',auth[_0xccf8('0xa')](),controller[_0xccf8('0x10')]);router[_0xccf8('0xf')](_0xccf8('0xe'),auth['isAuthenticated'](),controller[_0xccf8('0x11')]);router[_0xccf8('0x12')](_0xccf8('0xc'),auth[_0xccf8('0xa')](),controller[_0xccf8('0x13')]);router[_0xccf8('0x14')](_0xccf8('0xc'),auth[_0xccf8('0xa')](),controller[_0xccf8('0x15')]);router['delete'](_0xccf8('0x16'),auth[_0xccf8('0xa')](),controller[_0xccf8('0x17')]);module[_0xccf8('0x18')]=router; \ No newline at end of file +var _0xf2b1=['/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x834637,_0x1b0ce9){var _0x44d3a0=function(_0x10f79b){while(--_0x10f79b){_0x834637['push'](_0x834637['shift']());}};_0x44d3a0(++_0x1b0ce9);}(_0xf2b1,0x1af));var _0x1f2b=function(_0x56eb70,_0x2bd75c){_0x56eb70=_0x56eb70-0x0;var _0x47f1fe=_0xf2b1[_0x56eb70];return _0x47f1fe;};'use strict';var multer=require(_0x1f2b('0x0'));var util=require(_0x1f2b('0x1'));var path=require('path');var timeout=require(_0x1f2b('0x2'));var express=require('express');var router=express[_0x1f2b('0x3')]();var fs_extra=require(_0x1f2b('0x4'));var auth=require(_0x1f2b('0x5'));var interaction=require(_0x1f2b('0x6'));var config=require(_0x1f2b('0x7'));var controller=require(_0x1f2b('0x8'));router[_0x1f2b('0x9')]('/',auth[_0x1f2b('0xa')](),controller[_0x1f2b('0xb')]);router[_0x1f2b('0x9')]('/:id',auth[_0x1f2b('0xa')](),controller[_0x1f2b('0xc')]);router['get'](_0x1f2b('0xd'),auth[_0x1f2b('0xa')](),controller[_0x1f2b('0xe')]);router[_0x1f2b('0xf')]('/',auth[_0x1f2b('0xa')](),controller[_0x1f2b('0x10')]);router['post'](_0x1f2b('0xd'),auth[_0x1f2b('0xa')](),controller[_0x1f2b('0x11')]);router[_0x1f2b('0x12')](_0x1f2b('0x13'),auth['isAuthenticated'](),controller[_0x1f2b('0x14')]);router[_0x1f2b('0x15')](_0x1f2b('0x13'),auth[_0x1f2b('0xa')](),controller[_0x1f2b('0x16')]);router['delete'](_0x1f2b('0x17'),auth[_0x1f2b('0xa')](),controller[_0x1f2b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d5da353..af38760 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 _0x05c8=['BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x05c8,0x69));var _0x805c=function(_0x33795f,_0x26627f){_0x33795f=_0x33795f-0x0;var _0x330565=_0x05c8[_0x33795f];return _0x330565;};'use strict';var Sequelize=require(_0x805c('0x0'));module[_0x805c('0x1')]={'name':{'type':Sequelize[_0x805c('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x805c('0x3')](_0x805c('0x4'),_0x805c('0x5'),_0x805c('0x6'),_0x805c('0x7'),_0x805c('0x8'),_0x805c('0x9')),'allowNull':!![],'defaultValue':_0x805c('0x5')},'directory':{'type':Sequelize[_0x805c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x805c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x805c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x805c('0x2')],'allowNull':!![],'defaultValue':_0x805c('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x805c('0xb')},'defaultEntry':{'type':Sequelize[_0x805c('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3112=['name','custom','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','exports','STRING'];(function(_0xc9c426,_0x54306f){var _0x251a5a=function(_0x7645ae){while(--_0x7645ae){_0xc9c426['push'](_0xc9c426['shift']());}};_0x251a5a(++_0x54306f);}(_0x3112,0x148));var _0x2311=function(_0x5dbfca,_0x413e97){_0x5dbfca=_0x5dbfca-0x0;var _0x5e6cba=_0x3112[_0x5dbfca];return _0x5e6cba;};'use strict';var Sequelize=require('sequelize');module[_0x2311('0x0')]={'name':{'type':Sequelize[_0x2311('0x1')],'allowNull':![],'unique':_0x2311('0x2')},'mode':{'type':Sequelize['ENUM'](_0x2311('0x3'),'files','mp3nb',_0x2311('0x4'),_0x2311('0x5'),_0x2311('0x6')),'allowNull':!![],'defaultValue':_0x2311('0x7')},'directory':{'type':Sequelize[_0x2311('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x2311('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2311('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2311('0x8')},'format':{'type':Sequelize[_0x2311('0x1')],'allowNull':!![]},'stamp':{'type':_0x2311('0x9')},'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 943ea01..cc75aaa 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 _0x3516=['request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','create','sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','message','removeSound','id2','getSounds','pick','eml-format','rimraf','fast-json-patch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3516,0x6a));var _0x6351=function(_0x3b76e6,_0x499b94){_0x3b76e6=_0x3b76e6-0x0;var _0x305893=_0x3516[_0x3b76e6];return _0x305893;};'use strict';var emlformat=require(_0x6351('0x0'));var rimraf=require(_0x6351('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6351('0x2'));var rp=require(_0x6351('0x3'));var moment=require('moment');var BPromise=require(_0x6351('0x4'));var Mustache=require(_0x6351('0x5'));var util=require(_0x6351('0x6'));var path=require(_0x6351('0x7'));var sox=require('sox');var csv=require(_0x6351('0x8'));var ejs=require(_0x6351('0x9'));var fs=require('fs');var fs_extra=require(_0x6351('0xa'));var _=require(_0x6351('0xb'));var squel=require(_0x6351('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6351('0xd'));var toCsv=require(_0x6351('0x8'));var querystring=require(_0x6351('0xe'));var Papa=require('papaparse');var Redis=require(_0x6351('0xf'));var authService=require(_0x6351('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6351('0x11'))(_0x6351('0x12'));var utils=require('../../config/utils');var config=require(_0x6351('0x13'));var licenseUtil=require(_0x6351('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4afd7e,_0x53cd68){_0x53cd68=_0x53cd68||0xcc;return function(_0x4d07eb){if(_0x4d07eb){return _0x4afd7e[_0x6351('0x15')](_0x53cd68);}return _0x4afd7e[_0x6351('0x16')](_0x53cd68)[_0x6351('0x17')]();};}function respondWithResult(_0x14b1c6,_0x41f4e4){_0x41f4e4=_0x41f4e4||0xc8;return function(_0x305651){if(_0x305651){return _0x14b1c6['status'](_0x41f4e4)[_0x6351('0x18')](_0x305651);}};}function respondWithFilteredResult(_0x42ebe4,_0x5bb981){return function(_0x263ee4){if(_0x263ee4){var _0x5e5770=typeof _0x5bb981[_0x6351('0x19')]===_0x6351('0x1a')&&typeof _0x5bb981[_0x6351('0x1b')]==='undefined';var _0x2b3bac=_0x263ee4[_0x6351('0x1c')];var _0x3bfae6=_0x5e5770?0x0:_0x5bb981['offset'];var _0x4694d7=_0x5e5770?_0x263ee4[_0x6351('0x1c')]:_0x5bb981[_0x6351('0x19')]+_0x5bb981[_0x6351('0x1b')];var _0x3c5adc;if(_0x4694d7>=_0x2b3bac){_0x4694d7=_0x2b3bac;_0x3c5adc=0xc8;}else{_0x3c5adc=0xce;}_0x42ebe4['status'](_0x3c5adc);return _0x42ebe4[_0x6351('0x1d')]('Content-Range',_0x3bfae6+'-'+_0x4694d7+'/'+_0x2b3bac)[_0x6351('0x18')](_0x263ee4);}return null;};}function patchUpdates(_0x19c24f){return function(_0x216bff){try{jsonpatch[_0x6351('0x1e')](_0x216bff,_0x19c24f,!![]);}catch(_0x537469){return BPromise[_0x6351('0x1f')](_0x537469);}return _0x216bff[_0x6351('0x20')]();};}function saveUpdates(_0x5885df,_0x2ad4db){return function(_0x2a7106){if(_0x2a7106){return _0x2a7106[_0x6351('0x21')](_0x5885df)['then'](function(_0x2b2df8){return _0x2b2df8;});}return null;};}function removeEntity(_0x3fa927,_0x34f56d){return function(_0x305fca){if(_0x305fca){return _0x305fca['destroy']()[_0x6351('0x22')](function(){var _0x442321=_0x305fca[_0x6351('0x23')]({'plain':!![]});var _0x384147=_0x6351('0x24');return db[_0x6351('0x25')][_0x6351('0x26')]({'where':{'type':_0x384147,'resourceId':_0x442321['id']}})[_0x6351('0x22')](function(){return _0x305fca;});})[_0x6351('0x22')](function(){_0x3fa927[_0x6351('0x16')](0xcc)[_0x6351('0x17')]();});}};}function handleEntityNotFound(_0x4b26bf,_0x3e3cd2){return function(_0x31a12b){if(!_0x31a12b){_0x4b26bf[_0x6351('0x15')](0x194);}return _0x31a12b;};}function handleError(_0x2d6026,_0x331c3d){_0x331c3d=_0x331c3d||0x1f4;return function(_0x4b9073){logger[_0x6351('0x27')](_0x4b9073['stack']);if(_0x4b9073[_0x6351('0x28')]){delete _0x4b9073['name'];}_0x2d6026[_0x6351('0x16')](_0x331c3d)[_0x6351('0x29')](_0x4b9073);};}exports[_0x6351('0x2a')]=function(_0x35e0a0,_0x1ad808){var _0x4a3813={},_0x2053c9={},_0x1b4d87={'count':0x0,'rows':[]};var _0x5342de=_[_0x6351('0x2b')](db[_0x6351('0x2c')][_0x6351('0x2d')],function(_0x365013){return{'name':_0x365013['fieldName'],'type':_0x365013[_0x6351('0x2e')][_0x6351('0x2f')]};});_0x2053c9[_0x6351('0x30')]=_[_0x6351('0x2b')](_0x5342de,_0x6351('0x28'));_0x2053c9['query']=_['keys'](_0x35e0a0[_0x6351('0x31')]);_0x2053c9['filters']=_[_0x6351('0x32')](_0x2053c9[_0x6351('0x30')],_0x2053c9[_0x6351('0x31')]);_0x4a3813[_0x6351('0x33')]=_[_0x6351('0x32')](_0x2053c9[_0x6351('0x30')],qs['fields'](_0x35e0a0['query'][_0x6351('0x34')]));_0x4a3813['attributes']=_0x4a3813[_0x6351('0x33')][_0x6351('0x35')]?_0x4a3813[_0x6351('0x33')]:_0x2053c9['model'];if(!_0x35e0a0[_0x6351('0x31')][_0x6351('0x36')](_0x6351('0x37'))){_0x4a3813[_0x6351('0x1b')]=qs[_0x6351('0x1b')](_0x35e0a0[_0x6351('0x31')][_0x6351('0x1b')]);_0x4a3813[_0x6351('0x19')]=qs[_0x6351('0x19')](_0x35e0a0[_0x6351('0x31')][_0x6351('0x19')]);}_0x4a3813[_0x6351('0x38')]=qs['sort'](_0x35e0a0[_0x6351('0x31')][_0x6351('0x39')]);delete _0x35e0a0['query']['sort'];_0x4a3813['where']=qs[_0x6351('0x3a')](_['pick'](_0x35e0a0[_0x6351('0x31')],_0x2053c9[_0x6351('0x3a')]),_0x5342de);if(_0x35e0a0['query'][_0x6351('0x3b')]){_0x4a3813[_0x6351('0x3c')]=_[_0x6351('0x3d')](_0x4a3813['where'],{'$or':_[_0x6351('0x2b')](_0x5342de,function(_0x12a95a){if(_0x12a95a[_0x6351('0x2e')]!==_0x6351('0x3e')){var _0x5723e3={};_0x5723e3[_0x12a95a[_0x6351('0x28')]]={'$like':'%'+_0x35e0a0['query'][_0x6351('0x3b')]+'%'};return _0x5723e3;}})});}_0x4a3813=_[_0x6351('0x3d')]({},_0x4a3813,_0x35e0a0[_0x6351('0x3f')]);var _0x45f89f={'where':_0x4a3813[_0x6351('0x3c')]};return db['VoiceMusicOnHold'][_0x6351('0x1c')](_0x45f89f)['then'](function(_0x218f14){_0x1b4d87[_0x6351('0x1c')]=_0x218f14;if(_0x35e0a0[_0x6351('0x31')][_0x6351('0x40')]){_0x4a3813[_0x6351('0x41')]=[{'all':!![]}];}return db[_0x6351('0x2c')]['findAll'](_0x4a3813);})[_0x6351('0x22')](function(_0x471ce5){_0x1b4d87[_0x6351('0x42')]=_0x471ce5;return _0x1b4d87;})[_0x6351('0x22')](respondWithFilteredResult(_0x1ad808,_0x4a3813))[_0x6351('0x43')](handleError(_0x1ad808,null));};exports[_0x6351('0x44')]=function(_0x1d65d6,_0x1c200f){var _0x2a7c69={'raw':![],'where':{'id':_0x1d65d6[_0x6351('0x45')]['id']}},_0x1e9587={};_0x1e9587['model']=_[_0x6351('0x46')](db[_0x6351('0x2c')]['rawAttributes']);_0x1e9587['query']=_[_0x6351('0x46')](_0x1d65d6[_0x6351('0x31')]);_0x1e9587[_0x6351('0x3a')]=_[_0x6351('0x32')](_0x1e9587[_0x6351('0x30')],_0x1e9587[_0x6351('0x31')]);_0x2a7c69[_0x6351('0x33')]=_['intersection'](_0x1e9587[_0x6351('0x30')],qs[_0x6351('0x34')](_0x1d65d6[_0x6351('0x31')][_0x6351('0x34')]));_0x2a7c69[_0x6351('0x33')]=_0x2a7c69[_0x6351('0x33')][_0x6351('0x35')]?_0x2a7c69['attributes']:_0x1e9587[_0x6351('0x30')];if(_0x1d65d6[_0x6351('0x31')]['includeAll']){_0x2a7c69[_0x6351('0x41')]=[{'all':!![]}];}_0x2a7c69=_[_0x6351('0x3d')]({},_0x2a7c69,_0x1d65d6[_0x6351('0x3f')]);return db[_0x6351('0x2c')][_0x6351('0x47')](_0x2a7c69)[_0x6351('0x22')](handleEntityNotFound(_0x1c200f,null))[_0x6351('0x22')](respondWithResult(_0x1c200f,null))[_0x6351('0x43')](handleError(_0x1c200f,null));};exports['update']=function(_0x388546,_0x18a669){if(_0x388546['body']['id']){delete _0x388546[_0x6351('0x48')]['id'];}return db[_0x6351('0x2c')][_0x6351('0x47')]({'where':{'id':_0x388546[_0x6351('0x45')]['id']}})[_0x6351('0x22')](handleEntityNotFound(_0x18a669,null))[_0x6351('0x22')](saveUpdates(_0x388546[_0x6351('0x48')],null))['then'](respondWithResult(_0x18a669,null))['catch'](handleError(_0x18a669,null));};exports[_0x6351('0x49')]=function(_0x57713d,_0x21c629,_0x4ee5a6){return db[_0x6351('0x4a')][_0x6351('0x4b')](function(_0x5133a9){if(_0x57713d[_0x6351('0x48')][_0x6351('0x4c')]===_0x6351('0x4d')){_0x57713d[_0x6351('0x48')]['directory']=path['join'](config[_0x6351('0x4e')],_0x6351('0x4f'),_0x57713d[_0x6351('0x48')][_0x6351('0x28')]);}return db[_0x6351('0x2c')][_0x6351('0x49')](_0x57713d[_0x6351('0x48')],{'transaction':_0x5133a9})[_0x6351('0x22')](function(_0x2bd165){if(_0x57713d[_0x6351('0x48')][_0x6351('0x4c')]===_0x6351('0x4d')){fs[_0x6351('0x50')](_0x2bd165['directory'],parseInt('0777',0x8));}var _0x205d2f=_0x57713d[_0x6351('0x51')][_0x6351('0x23')]({'plain':!![]});if(!_0x205d2f)throw new Error(_0x6351('0x52'));if(_0x205d2f['role']==='user'){var _0x37ed7e=_0x2bd165[_0x6351('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x6351('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x205d2f[_0x6351('0x53')]},'raw':!![]})[_0x6351('0x22')](function(_0x1a0c1b){if(_0x1a0c1b&&_0x1a0c1b[_0x6351('0x54')]===0x0){return db[_0x6351('0x25')][_0x6351('0x49')]({'name':_0x37ed7e[_0x6351('0x28')],'resourceId':_0x37ed7e['id'],'type':_0x1a0c1b['name'],'sectionId':_0x1a0c1b['id']},{})[_0x6351('0x22')](function(){return _0x2bd165;});}else{return _0x2bd165;}})['catch'](function(_0x219217){logger[_0x6351('0x27')](_0x6351('0x55'),_0x219217);});}return _0x2bd165;});})['then'](respondWithResult(_0x21c629,0xc9))[_0x6351('0x43')](handleError(_0x21c629,null));};exports[_0x6351('0x26')]=function(_0x3098f6,_0x22b29c,_0x281fa2){var _0x4dbb37;return db[_0x6351('0x2c')][_0x6351('0x47')]({'where':{'id':_0x3098f6[_0x6351('0x45')]['id']}})['then'](function(_0x44269d){if(_0x44269d){return db[_0x6351('0x4a')][_0x6351('0x4b')](function(_0xfd9383){return _0x44269d[_0x6351('0x26')]({'transaction':_0xfd9383,'raw':!![]})[_0x6351('0x22')](function(_0x4fafbf){if(_0x4fafbf[_0x6351('0x56')]){fs['readdirSync'](_0x4fafbf['directory'])[_0x6351('0x57')](function(_0x10e977){fs[_0x6351('0x58')](path[_0x6351('0x59')](_0x4fafbf['directory'],_0x10e977));});fs[_0x6351('0x5a')](_0x4fafbf[_0x6351('0x56')]);}return _0x4fafbf;});})[_0x6351('0x43')](function(_0x400eb0){throw new db[(_0x6351('0x5b'))][(_0x6351('0x5c'))](_0x400eb0['message']);});}})[_0x6351('0x22')](handleEntityNotFound(_0x22b29c,null))['then'](removeEntity(_0x22b29c,null))['catch'](handleError(_0x22b29c,null));};exports[_0x6351('0x5d')]=function(_0xeab8f2,_0x91e971,_0x6ef4ad){return db[_0x6351('0x4a')]['transaction'](function(_0xc0c0fc){var _0x5d356d;return db[_0x6351('0x2c')][_0x6351('0x47')]({'where':{'id':_0xeab8f2[_0x6351('0x45')]['id']}})[_0x6351('0x22')](function(_0x7a3af5){if(_0x7a3af5){_0x5d356d=_0x7a3af5;return _0x7a3af5['addSound'](_0xeab8f2[_0x6351('0x48')]['id'],{'transaction':_0xc0c0fc});}})[_0x6351('0x22')](function(_0x53ac92){if(_0x53ac92){return db[_0x6351('0x5e')][_0x6351('0x5f')]({'where':{'id':_0xeab8f2[_0x6351('0x48')]['id']},'attributes':['id',_0x6351('0x28'),_0x6351('0x60'),_0x6351('0x61'),_0x6351('0x62')],'raw':!![]});}})[_0x6351('0x22')](function(_0x38519a){if(_0x38519a){var _0x329a52=path[_0x6351('0x59')](config[_0x6351('0x4e')],_0x6351('0x63'),util[_0x6351('0x64')](_0x6351('0x65'),path[_0x6351('0x66')](_0x38519a['save_name'],path['extname'](_0x38519a[_0x6351('0x60')])),_0x38519a[_0x6351('0x61')]));var _0x46cd96=path[_0x6351('0x59')](config[_0x6351('0x4e')],_0x6351('0x4f'),_0x5d356d[_0x6351('0x28')],util[_0x6351('0x64')]('%s.%s',_0x38519a[_0x6351('0x28')],_0x38519a[_0x6351('0x61')]));fs[_0x6351('0x67')](_0x329a52,_0x46cd96);return _0x38519a;}})[_0x6351('0x43')](function(_0x376bdd){throw new db[(_0x6351('0x5b'))][(_0x6351('0x5c'))](_0x376bdd[_0x6351('0x68')]);});})[_0x6351('0x22')](handleEntityNotFound(_0x91e971,null))[_0x6351('0x22')](respondWithResult(_0x91e971,0xc9))[_0x6351('0x43')](handleError(_0x91e971,null));};exports[_0x6351('0x69')]=function(_0x102435,_0x5aa08d,_0x49548a){return db['sequelize'][_0x6351('0x4b')](function(_0x3d89e9){var _0x34942f;return db[_0x6351('0x2c')][_0x6351('0x5f')]({'where':{'id':_0x102435[_0x6351('0x45')]['id']}})[_0x6351('0x22')](handleEntityNotFound(_0x5aa08d,null))[_0x6351('0x22')](function(_0x41896e){if(_0x41896e){_0x34942f=_0x41896e;return _0x41896e[_0x6351('0x69')](_0x102435[_0x6351('0x45')]['id2']);}})[_0x6351('0x22')](function(_0xd84a85){if(_0xd84a85){return db['Sound'][_0x6351('0x5f')]({'where':{'id':_0x102435['params'][_0x6351('0x6a')]},'attributes':['id',_0x6351('0x28'),_0x6351('0x60'),_0x6351('0x61'),_0x6351('0x62')],'raw':!![]});}})[_0x6351('0x22')](function(_0x55f521){if(_0x55f521){fs['unlinkSync'](path[_0x6351('0x59')](_0x34942f[_0x6351('0x56')],util[_0x6351('0x64')]('%s.%s',_0x55f521[_0x6351('0x28')],_0x55f521[_0x6351('0x61')])));return _0x55f521;}})[_0x6351('0x43')](function(_0x1bbf1c){throw new db['Sequelize']['ValidationError'](_0x1bbf1c['message']);});})['then'](handleEntityNotFound(_0x5aa08d,null))[_0x6351('0x22')](respondWithStatusCode(_0x5aa08d,0xcc))['catch'](handleError(_0x5aa08d,null));};exports[_0x6351('0x6b')]=function(_0x3f8d13,_0xd6b448,_0xf67660){var _0x39657c={};var _0x1169e3={};var _0x316fc8;var _0x1a5b59;return db['VoiceMusicOnHold'][_0x6351('0x5f')]({'where':{'id':_0x3f8d13['params']['id']}})[_0x6351('0x22')](handleEntityNotFound(_0xd6b448,null))[_0x6351('0x22')](function(_0x11d864){if(_0x11d864){_0x316fc8=_0x11d864;_0x1169e3[_0x6351('0x30')]=_['keys'](db[_0x6351('0x5e')][_0x6351('0x2d')]);_0x1169e3[_0x6351('0x31')]=_[_0x6351('0x46')](_0x3f8d13[_0x6351('0x31')]);_0x1169e3[_0x6351('0x3a')]=_[_0x6351('0x32')](_0x1169e3[_0x6351('0x30')],_0x1169e3[_0x6351('0x31')]);_0x39657c['attributes']=_['intersection'](_0x1169e3[_0x6351('0x30')],qs[_0x6351('0x34')](_0x3f8d13[_0x6351('0x31')]['fields']));_0x39657c[_0x6351('0x33')]=_0x39657c[_0x6351('0x33')][_0x6351('0x35')]?_0x39657c['attributes']:_0x1169e3['model'];_0x39657c[_0x6351('0x38')]=qs[_0x6351('0x39')](_0x3f8d13[_0x6351('0x31')][_0x6351('0x39')]);_0x39657c['where']=qs[_0x6351('0x3a')](_[_0x6351('0x6c')](_0x3f8d13[_0x6351('0x31')],_0x1169e3[_0x6351('0x3a')]));if(_0x3f8d13['query'][_0x6351('0x3b')]){_0x39657c[_0x6351('0x3c')]=_[_0x6351('0x3d')](_0x39657c['where'],{'$or':_['map'](_0x39657c[_0x6351('0x33')],function(_0x59680a){var _0x22b387={};_0x22b387[_0x59680a]={'$like':'%'+_0x3f8d13['query'][_0x6351('0x3b')]+'%'};return _0x22b387;})});}_0x39657c=_['merge']({},_0x39657c,_0x3f8d13['options']);return _0x316fc8[_0x6351('0x6b')](_0x39657c);}})['then'](function(_0x3ee193){if(_0x3ee193){_0x1a5b59=_0x3ee193[_0x6351('0x35')];if(!_0x3f8d13['query']['hasOwnProperty'](_0x6351('0x37'))){_0x39657c[_0x6351('0x1b')]=qs[_0x6351('0x1b')](_0x3f8d13['query'][_0x6351('0x1b')]);_0x39657c[_0x6351('0x19')]=qs[_0x6351('0x19')](_0x3f8d13['query'][_0x6351('0x19')]);}return _0x316fc8[_0x6351('0x6b')](_0x39657c);}})[_0x6351('0x22')](function(_0x530c0a){if(_0x530c0a){return _0x530c0a?{'count':_0x1a5b59,'rows':_0x530c0a}:null;}})[_0x6351('0x22')](respondWithResult(_0xd6b448,null))['catch'](handleError(_0xd6b448,null));}; \ No newline at end of file +var _0x55d3=['MusicOnHolds','UserProfileResource','end','error','name','send','VoiceMusicOnHold','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','body','params','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','role','userProfileId','autoAssociation','readdirSync','forEach','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','id2','unlinkSync','getSounds','rawAttributes','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55d3,0x193));var _0x355d=function(_0x2528ba,_0x4dca83){_0x2528ba=_0x2528ba-0x0;var _0x3c557a=_0x55d3[_0x2528ba];return _0x3c557a;};'use strict';var emlformat=require(_0x355d('0x0'));var rimraf=require(_0x355d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x355d('0x2'));var rp=require(_0x355d('0x3'));var moment=require(_0x355d('0x4'));var BPromise=require(_0x355d('0x5'));var Mustache=require(_0x355d('0x6'));var util=require(_0x355d('0x7'));var path=require(_0x355d('0x8'));var sox=require('sox');var csv=require(_0x355d('0x9'));var ejs=require(_0x355d('0xa'));var fs=require('fs');var fs_extra=require(_0x355d('0xb'));var _=require(_0x355d('0xc'));var squel=require(_0x355d('0xd'));var crypto=require(_0x355d('0xe'));var jsforce=require(_0x355d('0xf'));var deskjs=require(_0x355d('0x10'));var toCsv=require(_0x355d('0x9'));var querystring=require(_0x355d('0x11'));var Papa=require('papaparse');var Redis=require(_0x355d('0x12'));var authService=require(_0x355d('0x13'));var qs=require(_0x355d('0x14'));var as=require(_0x355d('0x15'));var hardwareService=require(_0x355d('0x16'));var logger=require(_0x355d('0x17'))(_0x355d('0x18'));var utils=require(_0x355d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x355d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1286b3,_0x37fbf5){_0x37fbf5=_0x37fbf5||0xcc;return function(_0x30c792){if(_0x30c792){return _0x1286b3[_0x355d('0x1b')](_0x37fbf5);}return _0x1286b3[_0x355d('0x1c')](_0x37fbf5)['end']();};}function respondWithResult(_0x42944c,_0x48c305){_0x48c305=_0x48c305||0xc8;return function(_0xbecc29){if(_0xbecc29){return _0x42944c[_0x355d('0x1c')](_0x48c305)[_0x355d('0x1d')](_0xbecc29);}};}function respondWithFilteredResult(_0x41fd7f,_0x2c5314){return function(_0x51a0c8){if(_0x51a0c8){var _0x1d88cc=typeof _0x2c5314[_0x355d('0x1e')]===_0x355d('0x1f')&&typeof _0x2c5314[_0x355d('0x20')]===_0x355d('0x1f');var _0x1c6cea=_0x51a0c8[_0x355d('0x21')];var _0x4cf258=_0x1d88cc?0x0:_0x2c5314['offset'];var _0x3b26c6=_0x1d88cc?_0x51a0c8[_0x355d('0x21')]:_0x2c5314[_0x355d('0x1e')]+_0x2c5314[_0x355d('0x20')];var _0x16ebbe;if(_0x3b26c6>=_0x1c6cea){_0x3b26c6=_0x1c6cea;_0x16ebbe=0xc8;}else{_0x16ebbe=0xce;}_0x41fd7f[_0x355d('0x1c')](_0x16ebbe);return _0x41fd7f[_0x355d('0x22')]('Content-Range',_0x4cf258+'-'+_0x3b26c6+'/'+_0x1c6cea)[_0x355d('0x1d')](_0x51a0c8);}return null;};}function patchUpdates(_0x34ad72){return function(_0x441e46){try{jsonpatch['apply'](_0x441e46,_0x34ad72,!![]);}catch(_0x12b2e3){return BPromise[_0x355d('0x23')](_0x12b2e3);}return _0x441e46[_0x355d('0x24')]();};}function saveUpdates(_0x27fc5c,_0x383cb1){return function(_0x36db89){if(_0x36db89){return _0x36db89[_0x355d('0x25')](_0x27fc5c)[_0x355d('0x26')](function(_0xeb01ff){return _0xeb01ff;});}return null;};}function removeEntity(_0x44ebee,_0x1e9a79){return function(_0x1bebcc){if(_0x1bebcc){return _0x1bebcc[_0x355d('0x27')]()['then'](function(){var _0x32d826=_0x1bebcc[_0x355d('0x28')]({'plain':!![]});var _0xad7ee2=_0x355d('0x29');return db[_0x355d('0x2a')][_0x355d('0x27')]({'where':{'type':_0xad7ee2,'resourceId':_0x32d826['id']}})[_0x355d('0x26')](function(){return _0x1bebcc;});})[_0x355d('0x26')](function(){_0x44ebee[_0x355d('0x1c')](0xcc)[_0x355d('0x2b')]();});}};}function handleEntityNotFound(_0x1d01df,_0x265e9a){return function(_0x84d313){if(!_0x84d313){_0x1d01df[_0x355d('0x1b')](0x194);}return _0x84d313;};}function handleError(_0x144fda,_0x4bc190){_0x4bc190=_0x4bc190||0x1f4;return function(_0x37efd4){logger[_0x355d('0x2c')](_0x37efd4['stack']);if(_0x37efd4[_0x355d('0x2d')]){delete _0x37efd4['name'];}_0x144fda[_0x355d('0x1c')](_0x4bc190)[_0x355d('0x2e')](_0x37efd4);};}exports['index']=function(_0x4705a0,_0x153fd1){var _0x20ebdc={},_0x29aa96={},_0x335e6a={'count':0x0,'rows':[]};var _0x1bc60b=_['map'](db[_0x355d('0x2f')]['rawAttributes'],function(_0x5a7d21){return{'name':_0x5a7d21['fieldName'],'type':_0x5a7d21[_0x355d('0x30')][_0x355d('0x31')]};});_0x29aa96[_0x355d('0x32')]=_[_0x355d('0x33')](_0x1bc60b,'name');_0x29aa96[_0x355d('0x34')]=_[_0x355d('0x35')](_0x4705a0[_0x355d('0x34')]);_0x29aa96[_0x355d('0x36')]=_[_0x355d('0x37')](_0x29aa96[_0x355d('0x32')],_0x29aa96[_0x355d('0x34')]);_0x20ebdc[_0x355d('0x38')]=_[_0x355d('0x37')](_0x29aa96[_0x355d('0x32')],qs[_0x355d('0x39')](_0x4705a0[_0x355d('0x34')][_0x355d('0x39')]));_0x20ebdc[_0x355d('0x38')]=_0x20ebdc[_0x355d('0x38')][_0x355d('0x3a')]?_0x20ebdc[_0x355d('0x38')]:_0x29aa96[_0x355d('0x32')];if(!_0x4705a0['query'][_0x355d('0x3b')]('nolimit')){_0x20ebdc['limit']=qs[_0x355d('0x20')](_0x4705a0[_0x355d('0x34')][_0x355d('0x20')]);_0x20ebdc[_0x355d('0x1e')]=qs[_0x355d('0x1e')](_0x4705a0['query']['offset']);}_0x20ebdc[_0x355d('0x3c')]=qs[_0x355d('0x3d')](_0x4705a0[_0x355d('0x34')]['sort']);delete _0x4705a0[_0x355d('0x34')][_0x355d('0x3d')];_0x20ebdc['where']=qs[_0x355d('0x36')](_[_0x355d('0x3e')](_0x4705a0[_0x355d('0x34')],_0x29aa96[_0x355d('0x36')]),_0x1bc60b);if(_0x4705a0[_0x355d('0x34')][_0x355d('0x3f')]){_0x20ebdc[_0x355d('0x40')]=_[_0x355d('0x41')](_0x20ebdc[_0x355d('0x40')],{'$or':_[_0x355d('0x33')](_0x1bc60b,function(_0x45ad1b){if(_0x45ad1b['type']!==_0x355d('0x42')){var _0x4f8c04={};_0x4f8c04[_0x45ad1b[_0x355d('0x2d')]]={'$like':'%'+_0x4705a0[_0x355d('0x34')][_0x355d('0x3f')]+'%'};return _0x4f8c04;}})});}_0x20ebdc=_['merge']({},_0x20ebdc,_0x4705a0[_0x355d('0x43')]);var _0x1572ab={'where':_0x20ebdc[_0x355d('0x40')]};return db[_0x355d('0x2f')][_0x355d('0x21')](_0x1572ab)[_0x355d('0x26')](function(_0x4b7919){_0x335e6a[_0x355d('0x21')]=_0x4b7919;if(_0x4705a0['query'][_0x355d('0x44')]){_0x20ebdc[_0x355d('0x45')]=[{'all':!![]}];}return db[_0x355d('0x2f')]['findAll'](_0x20ebdc);})['then'](function(_0x2ef099){_0x335e6a[_0x355d('0x46')]=_0x2ef099;return _0x335e6a;})['then'](respondWithFilteredResult(_0x153fd1,_0x20ebdc))[_0x355d('0x47')](handleError(_0x153fd1,null));};exports[_0x355d('0x48')]=function(_0x28cafe,_0x43692d){var _0x5f5a75={'raw':![],'where':{'id':_0x28cafe['params']['id']}},_0x3628ae={};_0x3628ae[_0x355d('0x32')]=_['keys'](db[_0x355d('0x2f')]['rawAttributes']);_0x3628ae['query']=_[_0x355d('0x35')](_0x28cafe[_0x355d('0x34')]);_0x3628ae[_0x355d('0x36')]=_[_0x355d('0x37')](_0x3628ae[_0x355d('0x32')],_0x3628ae[_0x355d('0x34')]);_0x5f5a75[_0x355d('0x38')]=_['intersection'](_0x3628ae['model'],qs[_0x355d('0x39')](_0x28cafe[_0x355d('0x34')][_0x355d('0x39')]));_0x5f5a75[_0x355d('0x38')]=_0x5f5a75[_0x355d('0x38')][_0x355d('0x3a')]?_0x5f5a75['attributes']:_0x3628ae[_0x355d('0x32')];if(_0x28cafe[_0x355d('0x34')][_0x355d('0x44')]){_0x5f5a75[_0x355d('0x45')]=[{'all':!![]}];}_0x5f5a75=_['merge']({},_0x5f5a75,_0x28cafe[_0x355d('0x43')]);return db[_0x355d('0x2f')][_0x355d('0x49')](_0x5f5a75)[_0x355d('0x26')](handleEntityNotFound(_0x43692d,null))['then'](respondWithResult(_0x43692d,null))[_0x355d('0x47')](handleError(_0x43692d,null));};exports[_0x355d('0x25')]=function(_0x535918,_0x51d59a){if(_0x535918['body']['id']){delete _0x535918[_0x355d('0x4a')]['id'];}return db[_0x355d('0x2f')][_0x355d('0x49')]({'where':{'id':_0x535918[_0x355d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51d59a,null))[_0x355d('0x26')](saveUpdates(_0x535918['body'],null))['then'](respondWithResult(_0x51d59a,null))[_0x355d('0x47')](handleError(_0x51d59a,null));};exports[_0x355d('0x4c')]=function(_0x5e53be,_0x2cfe8c,_0x4e1f04){return db[_0x355d('0x4d')][_0x355d('0x4e')](function(_0x266e2c){if(_0x5e53be[_0x355d('0x4a')][_0x355d('0x4f')]===_0x355d('0x50')){_0x5e53be[_0x355d('0x4a')]['directory']=path[_0x355d('0x51')](config[_0x355d('0x52')],_0x355d('0x53'),_0x5e53be[_0x355d('0x4a')]['name']);}return db['VoiceMusicOnHold'][_0x355d('0x4c')](_0x5e53be[_0x355d('0x4a')],{'transaction':_0x266e2c})[_0x355d('0x26')](function(_0x4151ff){if(_0x5e53be[_0x355d('0x4a')][_0x355d('0x4f')]===_0x355d('0x50')){fs[_0x355d('0x54')](_0x4151ff[_0x355d('0x55')],parseInt(_0x355d('0x56'),0x8));}var _0x3ceed0=_0x5e53be[_0x355d('0x57')][_0x355d('0x28')]({'plain':!![]});if(!_0x3ceed0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ceed0[_0x355d('0x58')]==='user'){var _0x3bfded=_0x4151ff[_0x355d('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x355d('0x49')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3ceed0[_0x355d('0x59')]},'raw':!![]})[_0x355d('0x26')](function(_0x28e017){if(_0x28e017&&_0x28e017[_0x355d('0x5a')]===0x0){return db[_0x355d('0x2a')][_0x355d('0x4c')]({'name':_0x3bfded[_0x355d('0x2d')],'resourceId':_0x3bfded['id'],'type':_0x28e017[_0x355d('0x2d')],'sectionId':_0x28e017['id']},{})[_0x355d('0x26')](function(){return _0x4151ff;});}else{return _0x4151ff;}})[_0x355d('0x47')](function(_0x189c4e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x189c4e);});}return _0x4151ff;});})[_0x355d('0x26')](respondWithResult(_0x2cfe8c,0xc9))['catch'](handleError(_0x2cfe8c,null));};exports[_0x355d('0x27')]=function(_0x438951,_0x837514,_0x5784a3){var _0x260a58;return db[_0x355d('0x2f')][_0x355d('0x49')]({'where':{'id':_0x438951[_0x355d('0x4b')]['id']}})['then'](function(_0x5100cf){if(_0x5100cf){return db[_0x355d('0x4d')][_0x355d('0x4e')](function(_0x17a060){return _0x5100cf['destroy']({'transaction':_0x17a060,'raw':!![]})[_0x355d('0x26')](function(_0x43126b){if(_0x43126b[_0x355d('0x55')]){fs[_0x355d('0x5b')](_0x43126b[_0x355d('0x55')])[_0x355d('0x5c')](function(_0x1f539b){fs['unlinkSync'](path[_0x355d('0x51')](_0x43126b['directory'],_0x1f539b));});fs['rmdirSync'](_0x43126b[_0x355d('0x55')]);}return _0x43126b;});})[_0x355d('0x47')](function(_0x8f9151){throw new db[(_0x355d('0x5d'))][(_0x355d('0x5e'))](_0x8f9151[_0x355d('0x5f')]);});}})[_0x355d('0x26')](handleEntityNotFound(_0x837514,null))[_0x355d('0x26')](removeEntity(_0x837514,null))[_0x355d('0x47')](handleError(_0x837514,null));};exports[_0x355d('0x60')]=function(_0x11c67c,_0x5e433f,_0x133300){return db[_0x355d('0x4d')][_0x355d('0x4e')](function(_0x309a66){var _0x564308;return db[_0x355d('0x2f')]['find']({'where':{'id':_0x11c67c[_0x355d('0x4b')]['id']}})['then'](function(_0x2febc9){if(_0x2febc9){_0x564308=_0x2febc9;return _0x2febc9[_0x355d('0x60')](_0x11c67c[_0x355d('0x4a')]['id'],{'transaction':_0x309a66});}})[_0x355d('0x26')](function(_0x4f0508){if(_0x4f0508){return db[_0x355d('0x61')][_0x355d('0x62')]({'where':{'id':_0x11c67c[_0x355d('0x4a')]['id']},'attributes':['id',_0x355d('0x2d'),'save_name',_0x355d('0x63'),_0x355d('0x64')],'raw':!![]});}})[_0x355d('0x26')](function(_0x503399){if(_0x503399){var _0xbdb43f=path[_0x355d('0x51')](config[_0x355d('0x52')],_0x355d('0x65'),util[_0x355d('0x66')](_0x355d('0x67'),path[_0x355d('0x68')](_0x503399[_0x355d('0x69')],path['extname'](_0x503399[_0x355d('0x69')])),_0x503399['converted_format']));var _0x509797=path[_0x355d('0x51')](config[_0x355d('0x52')],'server/files/moh',_0x564308[_0x355d('0x2d')],util[_0x355d('0x66')](_0x355d('0x67'),_0x503399[_0x355d('0x2d')],_0x503399['converted_format']));fs['symlinkSync'](_0xbdb43f,_0x509797);return _0x503399;}})[_0x355d('0x47')](function(_0x439980){throw new db[(_0x355d('0x5d'))][(_0x355d('0x5e'))](_0x439980[_0x355d('0x5f')]);});})['then'](handleEntityNotFound(_0x5e433f,null))[_0x355d('0x26')](respondWithResult(_0x5e433f,0xc9))[_0x355d('0x47')](handleError(_0x5e433f,null));};exports['removeSound']=function(_0x24479a,_0x266a7a,_0x4319ae){return db[_0x355d('0x4d')][_0x355d('0x4e')](function(_0xb16659){var _0x3c4f32;return db[_0x355d('0x2f')]['findOne']({'where':{'id':_0x24479a['params']['id']}})['then'](handleEntityNotFound(_0x266a7a,null))[_0x355d('0x26')](function(_0x223858){if(_0x223858){_0x3c4f32=_0x223858;return _0x223858['removeSound'](_0x24479a[_0x355d('0x4b')][_0x355d('0x6a')]);}})[_0x355d('0x26')](function(_0x314fa3){if(_0x314fa3){return db[_0x355d('0x61')]['findOne']({'where':{'id':_0x24479a['params'][_0x355d('0x6a')]},'attributes':['id',_0x355d('0x2d'),_0x355d('0x69'),'converted_format','createdAt'],'raw':!![]});}})[_0x355d('0x26')](function(_0x2eddd2){if(_0x2eddd2){fs[_0x355d('0x6b')](path['join'](_0x3c4f32[_0x355d('0x55')],util[_0x355d('0x66')](_0x355d('0x67'),_0x2eddd2[_0x355d('0x2d')],_0x2eddd2['converted_format'])));return _0x2eddd2;}})[_0x355d('0x47')](function(_0x5b0900){throw new db[(_0x355d('0x5d'))][(_0x355d('0x5e'))](_0x5b0900[_0x355d('0x5f')]);});})[_0x355d('0x26')](handleEntityNotFound(_0x266a7a,null))[_0x355d('0x26')](respondWithStatusCode(_0x266a7a,0xcc))[_0x355d('0x47')](handleError(_0x266a7a,null));};exports[_0x355d('0x6c')]=function(_0x35d908,_0x516f74,_0x1fb819){var _0x510c81={};var _0x11e233={};var _0x54f6e4;var _0x313e18;return db[_0x355d('0x2f')][_0x355d('0x62')]({'where':{'id':_0x35d908[_0x355d('0x4b')]['id']}})[_0x355d('0x26')](handleEntityNotFound(_0x516f74,null))[_0x355d('0x26')](function(_0x2fa406){if(_0x2fa406){_0x54f6e4=_0x2fa406;_0x11e233[_0x355d('0x32')]=_[_0x355d('0x35')](db[_0x355d('0x61')][_0x355d('0x6d')]);_0x11e233[_0x355d('0x34')]=_['keys'](_0x35d908[_0x355d('0x34')]);_0x11e233['filters']=_[_0x355d('0x37')](_0x11e233[_0x355d('0x32')],_0x11e233[_0x355d('0x34')]);_0x510c81[_0x355d('0x38')]=_[_0x355d('0x37')](_0x11e233['model'],qs[_0x355d('0x39')](_0x35d908[_0x355d('0x34')][_0x355d('0x39')]));_0x510c81[_0x355d('0x38')]=_0x510c81['attributes'][_0x355d('0x3a')]?_0x510c81[_0x355d('0x38')]:_0x11e233['model'];_0x510c81[_0x355d('0x3c')]=qs['sort'](_0x35d908[_0x355d('0x34')][_0x355d('0x3d')]);_0x510c81['where']=qs[_0x355d('0x36')](_[_0x355d('0x3e')](_0x35d908[_0x355d('0x34')],_0x11e233[_0x355d('0x36')]));if(_0x35d908[_0x355d('0x34')]['filter']){_0x510c81[_0x355d('0x40')]=_[_0x355d('0x41')](_0x510c81[_0x355d('0x40')],{'$or':_[_0x355d('0x33')](_0x510c81[_0x355d('0x38')],function(_0x132e13){var _0x52d88f={};_0x52d88f[_0x132e13]={'$like':'%'+_0x35d908[_0x355d('0x34')][_0x355d('0x3f')]+'%'};return _0x52d88f;})});}_0x510c81=_['merge']({},_0x510c81,_0x35d908['options']);return _0x54f6e4['getSounds'](_0x510c81);}})[_0x355d('0x26')](function(_0x2db72e){if(_0x2db72e){_0x313e18=_0x2db72e[_0x355d('0x3a')];if(!_0x35d908[_0x355d('0x34')][_0x355d('0x3b')](_0x355d('0x6e'))){_0x510c81[_0x355d('0x20')]=qs[_0x355d('0x20')](_0x35d908[_0x355d('0x34')][_0x355d('0x20')]);_0x510c81[_0x355d('0x1e')]=qs[_0x355d('0x1e')](_0x35d908[_0x355d('0x34')][_0x355d('0x1e')]);}return _0x54f6e4[_0x355d('0x6c')](_0x510c81);}})[_0x355d('0x26')](function(_0x34c61a){if(_0x34c61a){return _0x34c61a?{'count':_0x313e18,'rows':_0x34c61a}:null;}})[_0x355d('0x26')](respondWithResult(_0x516f74,null))['catch'](handleError(_0x516f74,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 81888bb..6cad6fa 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 _0x3fe9=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports','define'];(function(_0xd0e82d,_0x179182){var _0x2e61ef=function(_0x491f3c){while(--_0x491f3c){_0xd0e82d['push'](_0xd0e82d['shift']());}};_0x2e61ef(++_0x179182);}(_0x3fe9,0x198));var _0x93fe=function(_0x4247b0,_0x478b94){_0x4247b0=_0x4247b0-0x0;var _0x1d6325=_0x3fe9[_0x4247b0];return _0x1d6325;};'use strict';var _=require(_0x93fe('0x0'));var util=require('util');var logger=require(_0x93fe('0x1'))(_0x93fe('0x2'));var moment=require(_0x93fe('0x3'));var BPromise=require(_0x93fe('0x4'));var rp=require(_0x93fe('0x5'));var fs=require('fs');var path=require(_0x93fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x93fe('0x7'));module[_0x93fe('0x8')]=function(_0x4023d7,_0x213cc7){return _0x4023d7[_0x93fe('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x93fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3892=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','util','../../config/logger','moment','bluebird'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3892,0xee));var _0x2389=function(_0x1a8094,_0x1ac44c){_0x1a8094=_0x1a8094-0x0;var _0x123631=_0x3892[_0x1a8094];return _0x123631;};'use strict';var _=require('lodash');var util=require(_0x2389('0x0'));var logger=require(_0x2389('0x1'))('api');var moment=require(_0x2389('0x2'));var BPromise=require(_0x2389('0x3'));var rp=require(_0x2389('0x4'));var fs=require('fs');var path=require(_0x2389('0x5'));var rimraf=require(_0x2389('0x6'));var config=require(_0x2389('0x7'));var attributes=require(_0x2389('0x8'));module[_0x2389('0x9')]=function(_0x4988d4,_0x92b471){return _0x4988d4['define'](_0x2389('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 42ce634..1274a0c 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x59f4ad,_0x5c969d){var _0x19584a=function(_0x30bae7){while(--_0x30bae7){_0x59f4ad['push'](_0x59f4ad['shift']());}};_0x19584a(++_0x5c969d);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ 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','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x11b9a6,_0x486d80){var _0xb0b4a6=function(_0xd4e805){while(--_0xd4e805){_0x11b9a6['push'](_0x11b9a6['shift']());}};_0xb0b4a6(++_0x486d80);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0xcb91[_0x3725ee];return _0x399c71;};'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')]('VoiceMusicOnHold,\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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3198fef..f5e9afc 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 _0x56e6=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','create','post','addTeams','update','delete','destroy','removeTeams','multer'];(function(_0x54c7eb,_0x466d57){var _0x50e720=function(_0x4dd44e){while(--_0x4dd44e){_0x54c7eb['push'](_0x54c7eb['shift']());}};_0x50e720(++_0x466d57);}(_0x56e6,0x6b));var _0x656e=function(_0x2b2f18,_0x6958ea){_0x2b2f18=_0x2b2f18-0x0;var _0x228471=_0x56e6[_0x2b2f18];return _0x228471;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var timeout=require(_0x656e('0x3'));var express=require(_0x656e('0x4'));var router=express[_0x656e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x656e('0x6'));var interaction=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var controller=require(_0x656e('0x9'));router[_0x656e('0xa')]('/',auth[_0x656e('0xb')](),controller[_0x656e('0xc')]);router['get'](_0x656e('0xd'),auth[_0x656e('0xb')](),controller[_0x656e('0xe')]);router[_0x656e('0xa')](_0x656e('0xf'),auth[_0x656e('0xb')](),controller[_0x656e('0x10')]);router[_0x656e('0xa')](_0x656e('0x11'),auth[_0x656e('0xb')](),controller[_0x656e('0x12')]);router[_0x656e('0xa')](_0x656e('0x13'),auth[_0x656e('0xb')](),controller['getTeams']);router['post']('/',auth[_0x656e('0xb')](),controller[_0x656e('0x14')]);router[_0x656e('0x15')](_0x656e('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x656e('0x15')](_0x656e('0x13'),auth['isAuthenticated'](),controller[_0x656e('0x16')]);router['put'](_0x656e('0xf'),auth[_0x656e('0xb')](),controller[_0x656e('0x17')]);router[_0x656e('0x18')]('/:id',auth[_0x656e('0xb')](),controller[_0x656e('0x19')]);router[_0x656e('0x18')](_0x656e('0x11'),auth[_0x656e('0xb')](),controller['removeAgents']);router['delete']('/:id/teams',auth[_0x656e('0xb')](),controller[_0x656e('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x51f2=['delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','destroy'];(function(_0x5a9316,_0x164192){var _0x5e9323=function(_0x46ec20){while(--_0x46ec20){_0x5a9316['push'](_0x5a9316['shift']());}};_0x5e9323(++_0x164192);}(_0x51f2,0xeb));var _0x251f=function(_0x19d9a8,_0x730d94){_0x19d9a8=_0x19d9a8-0x0;var _0xcd1f9b=_0x51f2[_0x19d9a8];return _0xcd1f9b;};'use strict';var multer=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var path=require(_0x251f('0x2'));var timeout=require(_0x251f('0x3'));var express=require(_0x251f('0x4'));var router=express[_0x251f('0x5')]();var fs_extra=require(_0x251f('0x6'));var auth=require(_0x251f('0x7'));var interaction=require(_0x251f('0x8'));var config=require('../../config/environment');var controller=require(_0x251f('0x9'));router[_0x251f('0xa')]('/',auth[_0x251f('0xb')](),controller[_0x251f('0xc')]);router[_0x251f('0xa')]('/describe',auth[_0x251f('0xb')](),controller[_0x251f('0xd')]);router[_0x251f('0xa')](_0x251f('0xe'),auth['isAuthenticated'](),controller[_0x251f('0xf')]);router[_0x251f('0xa')](_0x251f('0x10'),auth[_0x251f('0xb')](),controller['getAgents']);router[_0x251f('0xa')](_0x251f('0x11'),auth[_0x251f('0xb')](),controller[_0x251f('0x12')]);router['post']('/',auth[_0x251f('0xb')](),controller[_0x251f('0x13')]);router[_0x251f('0x14')](_0x251f('0x10'),auth[_0x251f('0xb')](),controller[_0x251f('0x15')]);router[_0x251f('0x14')](_0x251f('0x11'),auth[_0x251f('0xb')](),controller[_0x251f('0x16')]);router[_0x251f('0x17')]('/:id',auth[_0x251f('0xb')](),controller[_0x251f('0x18')]);router['delete'](_0x251f('0xe'),auth[_0x251f('0xb')](),controller[_0x251f('0x19')]);router[_0x251f('0x1a')](_0x251f('0x10'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x251f('0x1a')](_0x251f('0x11'),auth[_0x251f('0xb')](),controller[_0x251f('0x1b')]);module[_0x251f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 18f25af..41f0b15 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 _0xa13d=['name','VIRTUAL','system-','getDataValue','INTEGER','exports','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa13d,0xfa));var _0xda13=function(_0x57a6fd,_0x5d4663){_0x57a6fd=_0x57a6fd-0x0;var _0x51df0b=_0xa13d[_0x57a6fd];return _0x51df0b;};'use strict';var Sequelize=require('sequelize');module[_0xda13('0x0')]={'name':{'type':Sequelize[_0xda13('0x1')],'allowNull':![],'unique':_0xda13('0x2')},'prefix':{'type':Sequelize[_0xda13('0x3')],'get':function(_0xbd259f){return _0xda13('0x4')+this[_0xda13('0x5')](_0xda13('0x2'))+'-';}},'description':{'type':Sequelize[_0xda13('0x1')]},'callerIdAll':{'type':Sequelize[_0xda13('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xda13('0x6')]}}; \ No newline at end of file +var _0x65d9=['sequelize','name','VIRTUAL','system-','INTEGER'];(function(_0x580c04,_0x385555){var _0x1f2d60=function(_0x12f590){while(--_0x12f590){_0x580c04['push'](_0x580c04['shift']());}};_0x1f2d60(++_0x385555);}(_0x65d9,0x6e));var _0x965d=function(_0x1dca3f,_0x238bc0){_0x1dca3f=_0x1dca3f-0x0;var _0x54121d=_0x65d9[_0x1dca3f];return _0x54121d;};'use strict';var Sequelize=require(_0x965d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x965d('0x1')},'prefix':{'type':Sequelize[_0x965d('0x2')],'get':function(_0xebd0d0){return _0x965d('0x3')+this['getDataValue'](_0x965d('0x1'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x965d('0x4')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 551bbb8..f29c4f0 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 _0x7880=['userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','pick','nolimit','getTeams','Team','online','voicePause','flatMap','Agents','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','all','union','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','set','apply','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','fields','includeAll','include','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','update','body','system-','findById','addAgents','ids','omit','spread','emit'];(function(_0x2e6663,_0x396d71){var _0x257342=function(_0x2b28c0){while(--_0x2b28c0){_0x2e6663['push'](_0x2e6663['shift']());}};_0x257342(++_0x396d71);}(_0x7880,0x1f4));var _0x0788=function(_0x2554b6,_0x22e703){_0x2554b6=_0x2554b6-0x0;var _0x4b23b9=_0x7880[_0x2554b6];return _0x4b23b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];config[_0x0788('0x1a')]=_[_0x0788('0x1b')](config[_0x0788('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0788('0x1c'))(new Redis(config[_0x0788('0x1a')]));require(_0x0788('0x1d'))[_0x0788('0x1e')](socket);function respondWithStatusCode(_0x51e5d3,_0x43ca01){_0x43ca01=_0x43ca01||0xcc;return function(_0x4ed024){if(_0x4ed024){return _0x51e5d3[_0x0788('0x1f')](_0x43ca01);}return _0x51e5d3[_0x0788('0x20')](_0x43ca01)[_0x0788('0x21')]();};}function respondWithResult(_0xb406fb,_0x2ddd1a){_0x2ddd1a=_0x2ddd1a||0xc8;return function(_0x430e34){if(_0x430e34){return _0xb406fb['status'](_0x2ddd1a)['json'](_0x430e34);}};}function respondWithFilteredResult(_0x17d805,_0x461d9d){return function(_0x5b2bdc){if(_0x5b2bdc){var _0x654e4b=typeof _0x461d9d[_0x0788('0x22')]===_0x0788('0x23')&&typeof _0x461d9d['limit']===_0x0788('0x23');var _0x3fb723=_0x5b2bdc['count'];var _0x11ea01=_0x654e4b?0x0:_0x461d9d['offset'];var _0x7d0869=_0x654e4b?_0x5b2bdc['count']:_0x461d9d[_0x0788('0x22')]+_0x461d9d[_0x0788('0x24')];var _0x18ff22;if(_0x7d0869>=_0x3fb723){_0x7d0869=_0x3fb723;_0x18ff22=0xc8;}else{_0x18ff22=0xce;}_0x17d805[_0x0788('0x20')](_0x18ff22);return _0x17d805[_0x0788('0x25')]('Content-Range',_0x11ea01+'-'+_0x7d0869+'/'+_0x3fb723)['json'](_0x5b2bdc);}return null;};}function patchUpdates(_0x2270d4){return function(_0x2a1460){try{jsonpatch[_0x0788('0x26')](_0x2a1460,_0x2270d4,!![]);}catch(_0x7a99a1){return BPromise['reject'](_0x7a99a1);}return _0x2a1460['save']();};}function saveUpdates(_0x79204e,_0x18cc33){return function(_0x40309d){if(_0x40309d){return _0x40309d['update'](_0x79204e)['then'](function(_0x240459){return _0x240459;});}return null;};}function removeEntity(_0xa1f7dc,_0x5f2dda){return function(_0x48816a){if(_0x48816a){return _0x48816a[_0x0788('0x27')]()[_0x0788('0x28')](function(){var _0x57fda1=_0x48816a[_0x0788('0x29')]({'plain':!![]});var _0x40e7a6=_0x0788('0x2a');return db[_0x0788('0x2b')][_0x0788('0x27')]({'where':{'type':_0x40e7a6,'resourceId':_0x57fda1['id']}})[_0x0788('0x28')](function(){return _0x48816a;});})[_0x0788('0x28')](function(){_0xa1f7dc[_0x0788('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5178,_0x3c5246){return function(_0x40d345){if(!_0x40d345){_0x5a5178['sendStatus'](0x194);}return _0x40d345;};}function handleError(_0x4aa48b,_0x2e2ca8){_0x2e2ca8=_0x2e2ca8||0x1f4;return function(_0x68658a){logger[_0x0788('0x2c')](_0x68658a[_0x0788('0x2d')]);if(_0x68658a[_0x0788('0x2e')]){delete _0x68658a[_0x0788('0x2e')];}_0x4aa48b[_0x0788('0x20')](_0x2e2ca8)[_0x0788('0x2f')](_0x68658a);};}exports[_0x0788('0x30')]=function(_0x85e579,_0x5ec0ed){var _0x2a08b7={},_0x1aab6a={},_0x2db509={'count':0x0,'rows':[]};var _0x2a64e4=_[_0x0788('0x31')](db[_0x0788('0x32')][_0x0788('0x33')],function(_0x15d67a){return{'name':_0x15d67a[_0x0788('0x34')],'type':_0x15d67a[_0x0788('0x35')]['key']};});_0x1aab6a['model']=_['map'](_0x2a64e4,'name');_0x1aab6a['query']=_['keys'](_0x85e579[_0x0788('0x36')]);_0x1aab6a[_0x0788('0x37')]=_[_0x0788('0x38')](_0x1aab6a['model'],_0x1aab6a[_0x0788('0x36')]);_0x2a08b7[_0x0788('0x39')]=_[_0x0788('0x38')](_0x1aab6a[_0x0788('0x3a')],qs['fields'](_0x85e579[_0x0788('0x36')]['fields']));_0x2a08b7[_0x0788('0x39')]=_0x2a08b7['attributes'][_0x0788('0x3b')]?_0x2a08b7[_0x0788('0x39')]:_0x1aab6a['model'];if(!_0x85e579[_0x0788('0x36')][_0x0788('0x3c')]('nolimit')){_0x2a08b7[_0x0788('0x24')]=qs['limit'](_0x85e579[_0x0788('0x36')]['limit']);_0x2a08b7[_0x0788('0x22')]=qs['offset'](_0x85e579[_0x0788('0x36')]['offset']);}_0x2a08b7['order']=qs[_0x0788('0x3d')](_0x85e579[_0x0788('0x36')][_0x0788('0x3d')]);_0x2a08b7[_0x0788('0x3e')]=qs[_0x0788('0x37')](_['pick'](_0x85e579['query'],_0x1aab6a['filters']),_0x2a64e4);if(_0x85e579['query'][_0x0788('0x3f')]){_0x2a08b7[_0x0788('0x3e')]=_[_0x0788('0x40')](_0x2a08b7[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x2a64e4,function(_0x5993ad){if(_0x5993ad['type']!==_0x0788('0x41')){var _0x6770a8={};_0x6770a8[_0x5993ad[_0x0788('0x2e')]]={'$like':'%'+_0x85e579[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x6770a8;}})});}_0x2a08b7=_[_0x0788('0x40')]({},_0x2a08b7,_0x85e579[_0x0788('0x42')]);var _0x38ca94={'where':_0x2a08b7[_0x0788('0x3e')]};return db['VoicePrefix']['count'](_0x38ca94)[_0x0788('0x28')](function(_0x1d579d){_0x2db509[_0x0788('0x43')]=_0x1d579d;if(_0x85e579['query']['includeAll']){_0x2a08b7['include']=[{'all':!![]}];}return db[_0x0788('0x32')][_0x0788('0x44')](_0x2a08b7);})[_0x0788('0x28')](function(_0x189d33){_0x2db509[_0x0788('0x45')]=_0x189d33;return _0x2db509;})[_0x0788('0x28')](respondWithFilteredResult(_0x5ec0ed,_0x2a08b7))[_0x0788('0x46')](handleError(_0x5ec0ed,null));};exports[_0x0788('0x47')]=function(_0x4bd0d9,_0x15c618){var _0x19d111={'raw':![],'where':{'id':_0x4bd0d9[_0x0788('0x48')]['id']}},_0x4281ef={};_0x4281ef['model']=_[_0x0788('0x49')](db[_0x0788('0x32')]['rawAttributes']);_0x4281ef['query']=_['keys'](_0x4bd0d9[_0x0788('0x36')]);_0x4281ef['filters']=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],_0x4281ef[_0x0788('0x36')]);_0x19d111[_0x0788('0x39')]=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x4bd0d9[_0x0788('0x36')]['fields']));_0x19d111['attributes']=_0x19d111[_0x0788('0x39')][_0x0788('0x3b')]?_0x19d111[_0x0788('0x39')]:_0x4281ef['model'];if(_0x4bd0d9[_0x0788('0x36')][_0x0788('0x4b')]){_0x19d111[_0x0788('0x4c')]=[{'all':!![]}];}_0x19d111=_[_0x0788('0x40')]({},_0x19d111,_0x4bd0d9[_0x0788('0x42')]);return db['VoicePrefix']['find'](_0x19d111)[_0x0788('0x28')](handleEntityNotFound(_0x15c618,null))[_0x0788('0x28')](respondWithResult(_0x15c618,null))['catch'](handleError(_0x15c618,null));};exports[_0x0788('0x27')]=function(_0x4a6cde,_0x2103aa){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4a6cde[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x2103aa,null))[_0x0788('0x28')](removeEntity(_0x2103aa,null))[_0x0788('0x46')](handleError(_0x2103aa,null));};exports[_0x0788('0x4e')]=function(_0x5f3bda,_0x179c6e){return db[_0x0788('0x32')][_0x0788('0x4e')]()['then'](respondWithResult(_0x179c6e,null))[_0x0788('0x46')](handleError(_0x179c6e,null));};exports[_0x0788('0x4f')]=function(_0x59f00e,_0x18e55e){var _0x41110d;return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x137e24){return db[_0x0788('0x32')]['create'](_0x59f00e['body'],{'transaction':_0x137e24})[_0x0788('0x28')](function(_0x36304b){_0x41110d=_0x36304b['get']({'plain':!![]});return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x41110d[_0x0788('0x53')]},'raw':!![]})[_0x0788('0x28')](function(_0xf543a8){return createVoicePrefixExtensions(_0x41110d,_0xf543a8,_0x137e24);});});})[_0x0788('0x28')](function(){var _0x112870=_0x59f00e[_0x0788('0x54')][_0x0788('0x29')]({'plain':!![]});if(!_0x112870)throw new Error(_0x0788('0x55'));if(_0x112870[_0x0788('0x56')]===_0x0788('0x54')){var _0x55481c=_0x41110d;return db[_0x0788('0x57')][_0x0788('0x4d')]({'where':{'name':_0x0788('0x2a'),'userProfileId':_0x112870['userProfileId']},'raw':!![]})[_0x0788('0x28')](function(_0x329d44){if(_0x329d44&&_0x329d44['autoAssociation']===0x0){return db['UserProfileResource'][_0x0788('0x4f')]({'name':_0x55481c[_0x0788('0x2e')],'resourceId':_0x55481c['id'],'type':_0x329d44[_0x0788('0x2e')],'sectionId':_0x329d44['id']},{})[_0x0788('0x28')](function(){return _0x41110d;});}else{return _0x41110d;}})[_0x0788('0x46')](function(_0x4c08f9){logger['error'](_0x0788('0x58'),_0x4c08f9);throw _0x4c08f9;});}return _0x41110d;})[_0x0788('0x28')](respondWithResult(_0x18e55e,null))[_0x0788('0x46')](handleError(_0x18e55e,null));};function Extension(_0x47be71,_0x533f71,_0x3a25d3,_0x5419d9){this[_0x0788('0x59')]=_0x0788('0x5a');this[_0x0788('0x5b')]=_0x47be71;this[_0x0788('0x5c')]=_0x3a25d3;this[_0x0788('0x35')]=_0x0788('0x5d');this[_0x0788('0x5e')]=_0x0788('0x5f');this[_0x0788('0x60')]=_0x533f71;this[_0x0788('0x61')]=_0x5419d9;}function createVoicePrefixExtensions(_0x59fcbc,_0xe1a934,_0x446170){return new BPromise(function(_0x602e3b,_0x2822aa){var _0x582fed=new Extension(formatPrefixName(_0x59fcbc[_0x0788('0x62')]),0x1,_0x0788('0x63'),_0x0788('0x64'));_0x582fed[_0x0788('0x65')]=_0x59fcbc['id'];return db[_0x0788('0x52')]['create'](_0x582fed,{'transaction':_0x446170})[_0x0788('0x28')](function(_0x4aa3af){var _0x439224=_0x4aa3af[_0x0788('0x29')]({'plain':!![]});var _0x184b66=_[_0x0788('0x31')](addVoicePrefixExtensions(_0x59fcbc,_0xe1a934),function(_0x3baf23){_0x3baf23[_0x0788('0x53')]=_0x439224['id'];_0x3baf23[_0x0788('0x65')]=_0x59fcbc['id'];return _0x3baf23;});return db[_0x0788('0x52')][_0x0788('0x66')](_0x184b66,{'transaction':_0x446170})['then'](function(_0x25201f){if(!_0x25201f){return _0x2822aa(_0x0788('0x67'));}else{return _0x602e3b(_0x25201f);}})[_0x0788('0x46')](function(_0x59a436){return _0x2822aa(_0x59a436);});});;});};function addVoicePrefixExtensions(_0x50eeae,_0x6d255b){var _0x1bb234=[];var _0x31ed44=formatPrefixName(_0x50eeae['prefix']);_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x2,_0x0788('0x69'),_0x0788('0x6a')+_0x50eeae[_0x0788('0x2e')]));if(_0x50eeae['callerIdAll']){_0x1bb234['push'](new Extension(_0x31ed44,0x3,'Set',_0x0788('0x6b')+_0x50eeae[_0x0788('0x6c')]));}else{_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x3,'NoOp','No\x20callerid\x20available'));}_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x4,'goto',_0x6d255b[_0x0788('0x59')]+','+_0x0788('0x6d')+(0x8+_0x50eeae[_0x0788('0x2e')][_0x0788('0x3b')])+'}'+','+0x1));return _0x1bb234;}function formatPrefixName(_0x1834fb){var _0x345755='_';for(var _0x20b01a=0x0;_0x20b01a<_0x1834fb[_0x0788('0x3b')];_0x20b01a++){if(_0x1834fb[_0x0788('0x6e')](_0x20b01a)=='-'){_0x345755+=_0x1834fb[_0x0788('0x6e')](_0x20b01a);}else{_0x345755+='['+_0x1834fb['charAt'](_0x20b01a)+']';}}_0x345755+='.';return _0x345755;}exports[_0x0788('0x6f')]=function(_0x30248c,_0x52926f,_0x5ab357){var _0x3b053e=_0x30248c[_0x0788('0x70')];_0x3b053e[_0x0788('0x62')]=_0x0788('0x71')+_0x3b053e[_0x0788('0x2e')]+'-';return db[_0x0788('0x50')]['transaction'](function(_0x384401){return db[_0x0788('0x32')][_0x0788('0x6f')](_0x3b053e,{'where':{'id':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db['VoiceExtension'][_0x0788('0x27')]({'where':{'VoicePrefixId':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x3b053e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x7e11f){return createVoicePrefixExtensions(_0x3b053e,_0x7e11f,_0x384401);});});});})[_0x0788('0x28')](function(){return db[_0x0788('0x32')][_0x0788('0x72')](_0x3b053e['id']);})[_0x0788('0x28')](respondWithResult(_0x52926f,null))[_0x0788('0x46')](handleError(_0x52926f,null));};exports[_0x0788('0x73')]=function(_0x31b806,_0x1bd4ec,_0x4e6c4f){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x31b806[_0x0788('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bd4ec,null))['then'](function(_0x14fc12){if(_0x14fc12){return _0x14fc12['addAgents'](_0x31b806[_0x0788('0x70')][_0x0788('0x74')],_[_0x0788('0x75')](_0x31b806[_0x0788('0x70')],[_0x0788('0x74'),'id'])||{})[_0x0788('0x76')](function(_0xb944){for(var _0x216ea9=0x0;_0x216ea9<_0x31b806[_0x0788('0x70')]['ids'][_0x0788('0x3b')];_0x216ea9+=0x1){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':Number(_0x31b806['body'][_0x0788('0x74')][_0x216ea9]),'VoicePrefixId':Number(_0x31b806[_0x0788('0x48')]['id'])});}return _0xb944;});}})[_0x0788('0x28')](respondWithResult(_0x1bd4ec,null))['catch'](handleError(_0x1bd4ec,null));};exports[_0x0788('0x79')]=function(_0x4486ee,_0x9b98bf,_0x33a2fb){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4486ee[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x9b98bf,null))[_0x0788('0x28')](function(_0x5d8ddb){if(_0x5d8ddb){return _0x5d8ddb[_0x0788('0x79')](_0x4486ee[_0x0788('0x36')][_0x0788('0x74')])[_0x0788('0x28')](function(){if(_[_0x0788('0x7a')](_0x4486ee['query'][_0x0788('0x74')])){for(var _0x358048=0x0;_0x358048<_0x4486ee[_0x0788('0x36')]['ids'][_0x0788('0x3b')];_0x358048+=0x1){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee[_0x0788('0x36')][_0x0788('0x74')][_0x358048]),'VoicePrefixId':Number(_0x4486ee['params']['id'])});}}else{socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee['query'][_0x0788('0x74')]),'VoicePrefixId':Number(_0x4486ee[_0x0788('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x9b98bf,null))[_0x0788('0x46')](handleError(_0x9b98bf,null));};exports[_0x0788('0x7c')]=function(_0x9a0ef,_0x5c2d95,_0x28ad96){var _0x42c537={};var _0xbb5b1d={};var _0x53730a;var _0xddfb97;return db[_0x0788('0x32')][_0x0788('0x7d')]({'where':{'id':_0x9a0ef[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x5c2d95,null))[_0x0788('0x28')](function(_0x2545a7){if(_0x2545a7){_0x53730a=_0x2545a7;_0xbb5b1d[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x7e')][_0x0788('0x33')]);_0xbb5b1d[_0x0788('0x36')]=_[_0x0788('0x49')](_0x9a0ef['query']);_0xbb5b1d['filters']=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],_0xbb5b1d['query']);_0x42c537[_0x0788('0x39')]=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],qs['fields'](_0x9a0ef['query'][_0x0788('0x4a')]));_0x42c537[_0x0788('0x39')]=_0x42c537['attributes']['length']?_0x42c537['attributes']:_0xbb5b1d[_0x0788('0x3a')];_0x42c537[_0x0788('0x7f')]=qs['sort'](_0x9a0ef[_0x0788('0x36')][_0x0788('0x3d')]);_0x42c537[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x9a0ef['query'],_0xbb5b1d[_0x0788('0x37')]));if(_0x9a0ef['query'][_0x0788('0x3f')]){_0x42c537['where']=_[_0x0788('0x40')](_0x42c537[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x42c537[_0x0788('0x39')],function(_0x13f796){var _0x2238f6={};_0x2238f6[_0x13f796]={'$like':'%'+_0x9a0ef[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x2238f6;})});}_0x42c537=_[_0x0788('0x40')]({},_0x42c537,_0x9a0ef[_0x0788('0x42')]);return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x1d0cb5){if(_0x1d0cb5){_0xddfb97=_0x1d0cb5['length'];if(!_0x9a0ef['query']['hasOwnProperty'](_0x0788('0x81'))){_0x42c537[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x24')]);_0x42c537[_0x0788('0x22')]=qs[_0x0788('0x22')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x22')]);}return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x4a4ad4){if(_0x4a4ad4){return _0x4a4ad4?{'count':_0xddfb97,'rows':_0x4a4ad4}:null;}})['then'](respondWithResult(_0x5c2d95,null))[_0x0788('0x46')](handleError(_0x5c2d95,null));};exports[_0x0788('0x82')]=function(_0x104a70,_0x1a3f4d,_0x45e33c){var _0x14ac26={};var _0x37d04b={};var _0x3c77f9;var _0x4e80d1;return db['VoicePrefix'][_0x0788('0x7d')]({'where':{'id':_0x104a70[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x1a3f4d,null))[_0x0788('0x28')](function(_0x437086){if(_0x437086){_0x3c77f9=_0x437086;_0x37d04b[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x83')][_0x0788('0x33')]);_0x37d04b[_0x0788('0x36')]=_[_0x0788('0x49')](_0x104a70[_0x0788('0x36')]);_0x37d04b[_0x0788('0x37')]=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],_0x37d04b[_0x0788('0x36')]);_0x14ac26['attributes']=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x104a70[_0x0788('0x36')][_0x0788('0x4a')]));_0x14ac26[_0x0788('0x39')]=_0x14ac26['attributes'][_0x0788('0x3b')]?_0x14ac26[_0x0788('0x39')]:_0x37d04b[_0x0788('0x3a')];_0x14ac26[_0x0788('0x7f')]=qs[_0x0788('0x3d')](_0x104a70[_0x0788('0x36')][_0x0788('0x3d')]);_0x14ac26[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x104a70['query'],_0x37d04b[_0x0788('0x37')]));if(_0x104a70['query'][_0x0788('0x3f')]){_0x14ac26['where']=_[_0x0788('0x40')](_0x14ac26['where'],{'$or':_[_0x0788('0x31')](_0x14ac26[_0x0788('0x39')],function(_0x1f1f92){var _0xdfcfaf={};_0xdfcfaf[_0x1f1f92]={'$like':'%'+_0x104a70['query'][_0x0788('0x3f')]+'%'};return _0xdfcfaf;})});}_0x14ac26=_[_0x0788('0x40')]({},_0x14ac26,_0x104a70[_0x0788('0x42')]);return _0x3c77f9['getTeams'](_0x14ac26);}})[_0x0788('0x28')](function(_0x372c4f){if(_0x372c4f){_0x4e80d1=_0x372c4f['length'];if(!_0x104a70[_0x0788('0x36')][_0x0788('0x3c')](_0x0788('0x81'))){_0x14ac26[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x104a70[_0x0788('0x36')][_0x0788('0x24')]);_0x14ac26['offset']=qs[_0x0788('0x22')](_0x104a70[_0x0788('0x36')][_0x0788('0x22')]);}return _0x3c77f9[_0x0788('0x82')](_0x14ac26);}})[_0x0788('0x28')](function(_0x374a10){if(_0x374a10){return _0x374a10?{'count':_0x4e80d1,'rows':_0x374a10}:null;}})[_0x0788('0x28')](respondWithResult(_0x1a3f4d,null))[_0x0788('0x46')](handleError(_0x1a3f4d,null));};exports['addTeams']=function(_0x5130c4,_0x26233b,_0x42f6df){var _0x198501=_0x5130c4[_0x0788('0x70')][_0x0788('0x74')];var _0xbedb18;return db[_0x0788('0x83')]['findAll']({'where':{'id':_0x198501},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':'Agents','attributes':['id','name',_0x0788('0x84'),_0x0788('0x85'),'interface'],'raw':!![]}]})[_0x0788('0x28')](function(_0x66474b){if(_0x66474b){_0xbedb18=_0x66474b;var _0x28d0f8=_[_0x0788('0x86')](_0x66474b,function(_0x3b7f9c){var _0x328606=_0x3b7f9c['get']({'plain':!![]});return _0x328606[_0x0788('0x87')];});return db[_0x0788('0x32')]['find']({'where':{'id':_0x5130c4[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x4c59c4){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x28417e){return _0x4c59c4[_0x0788('0x88')](_0x198501,{'transaction':_0x28417e})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0xbedb18,function(_0x129506){return db['TeamVoicePrefix'][_0x0788('0x8a')]({'TeamId':_0x129506['id'],'VoicePrefixId':_0x5130c4[_0x0788('0x48')]['id']},{'transaction':_0x28417e});});})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0x28d0f8,function(_0x4c0f3d){return db[_0x0788('0x8b')][_0x0788('0x8c')]({'where':{'UserId':_0x4c0f3d['id'],'VoicePrefixId':_0x5130c4['params']['id']},'transaction':_0x28417e});});})['then'](function(){_0x28d0f8[_0x0788('0x8d')](function(_0x15a70b){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':_0x15a70b['id'],'VoicePrefixId':_0x4c59c4['id']});});});});});}})[_0x0788('0x28')](respondWithStatusCode(_0x26233b,null))[_0x0788('0x46')](handleError(_0x26233b,null));};exports['removeTeams']=function(_0x3309e1,_0x38e809,_0x1d25bf){return db[_0x0788('0x83')][_0x0788('0x44')]({'where':{'id':_0x3309e1[_0x0788('0x36')][_0x0788('0x74')]},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':_0x0788('0x87'),'attributes':['id'],'raw':!![]}]})[_0x0788('0x28')](handleEntityNotFound(_0x38e809,null))[_0x0788('0x28')](function(_0x2297ab){var _0x235106=_[_0x0788('0x31')](_0x2297ab,'id');var _0x17da6a=[];var _0x150a05=[];var _0x1e0fb7=squel['select']();_0x1e0fb7[_0x0788('0x8e')](_0x0788('0x8f'))[_0x0788('0x90')](_0x0788('0x91'),'tq')['join'](_0x0788('0x92'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0788('0x3e')]('VoicePrefixId\x20=\x20?',_0x3309e1['params']['id']);for(var _0x34a12a=0x0;_0x34a12a<_0x2297ab[_0x0788('0x3b')];_0x34a12a+=0x1){let _0x552a5c=_0x2297ab[_0x34a12a];for(var _0x605f17=0x0;_0x605f17<_0x552a5c['Agents'][_0x0788('0x3b')];_0x605f17+=0x1){let _0x4c86ef=_0x552a5c[_0x0788('0x87')][_0x605f17];var _0x197568=_0x1e0fb7[_0x0788('0x93')]();_0x197568[_0x0788('0x3e')](_0x0788('0x94'),_0x4c86ef['id']);_0x150a05[_0x0788('0x68')](db['sequelize'][_0x0788('0x36')](_0x197568['toString'](),{'type':db[_0x0788('0x50')][_0x0788('0x95')]['SELECT']})['then'](function(_0x4c1ca6){if(_0x4c1ca6[_0x0788('0x3b')]===0x1){return _0x4c86ef['id'];}else{var _0x4b2ca7=_['every'](_['map'](_0x4c1ca6,'TeamId'),function(_0x4ce12d){return _['includes'](_0x235106,_0x4ce12d);});if(_0x4b2ca7){return _0x4c86ef['id'];}}}));}}return BPromise[_0x0788('0x96')](_0x150a05)[_0x0788('0x28')](function(_0x55e987){_0x17da6a=_(_0x17da6a)[_0x0788('0x97')](_0x55e987)['compact']()[_0x0788('0x98')]();return db['VoicePrefix'][_0x0788('0x4d')]({'where':{'id':_0x3309e1[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x12448a){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x2e0714){return _0x12448a[_0x0788('0x99')](_0x3309e1[_0x0788('0x36')][_0x0788('0x74')],{'transaction':_0x2e0714})['then'](function(){if(!_[_0x0788('0x9a')](_0x17da6a)){return _0x12448a['removeAgents'](_0x17da6a,{'transaction':_0x2e0714});}})[_0x0788('0x28')](function(){_0x17da6a['forEach'](function(_0x58769c){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':_0x58769c,'VoicePrefixId':_0x12448a['id']});});});});});});})[_0x0788('0x28')](respondWithStatusCode(_0x38e809,null))['catch'](handleError(_0x38e809,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x1bfc4c,_0x13383e){_0x1bfc4c=_0x1bfc4c-0x0;var _0x141d23=_0x8603[_0x1bfc4c];return _0x141d23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5e616dd..9c7ec87 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 _0x285d=['save','update','emit','exports','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x4b3599,_0x2d5a43){var _0x14084e=function(_0x303844){while(--_0x303844){_0x4b3599['push'](_0x4b3599['shift']());}};_0x14084e(++_0x2d5a43);}(_0x285d,0xec));var _0xd285=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x285d[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xd285('0x0'));var VoicePrefix=require(_0xd285('0x1'))['db'][_0xd285('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd285('0x3')](0x0);var events={'afterCreate':_0xd285('0x4'),'afterUpdate':_0xd285('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b4218){return function(_0x3eff43,_0x4f297c,_0x1e7449){VoicePrefixEvents[_0xd285('0x6')](_0x1b4218+':'+_0x3eff43['id'],_0x3eff43);VoicePrefixEvents['emit'](_0x1b4218,_0x3eff43);_0x1e7449(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xd285('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xc8bb=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x5f0363,_0x5e5bc7){var _0x3926b6=function(_0x4de546){while(--_0x4de546){_0x5f0363['push'](_0x5f0363['shift']());}};_0x3926b6(++_0x5e5bc7);}(_0xc8bb,0x16f));var _0xbc8b=function(_0x543a3f,_0x842939){_0x543a3f=_0x543a3f-0x0;var _0x121d10=_0xc8bb[_0x543a3f];return _0x121d10;};'use strict';var EventEmitter=require(_0xbc8b('0x0'));var VoicePrefix=require(_0xbc8b('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbc8b('0x2')](0x0);var events={'afterCreate':_0xbc8b('0x3'),'afterUpdate':_0xbc8b('0x4'),'afterDestroy':_0xbc8b('0x5')};function emitEvent(_0x57b81f){return function(_0x224466,_0x5a01b3,_0x3a9150){VoicePrefixEvents[_0xbc8b('0x6')](_0x57b81f+':'+_0x224466['id'],_0x224466);VoicePrefixEvents[_0xbc8b('0x6')](_0x57b81f,_0x224466);_0x3a9150(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xbc8b('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4d5ece7..72ea81a 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 _0x839a=['bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x30aa4d,_0x2b360f){var _0x16fc87=function(_0x5c8565){while(--_0x5c8565){_0x30aa4d['push'](_0x30aa4d['shift']());}};_0x16fc87(++_0x2b360f);}(_0x839a,0x1bd));var _0xa839=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x839a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa839('0x0'));var util=require(_0xa839('0x1'));var logger=require(_0xa839('0x2'))(_0xa839('0x3'));var moment=require(_0xa839('0x4'));var BPromise=require(_0xa839('0x5'));var rp=require(_0xa839('0x6'));var fs=require('fs');var path=require(_0xa839('0x7'));var rimraf=require(_0xa839('0x8'));var config=require(_0xa839('0x9'));var attributes=require(_0xa839('0xa'));module[_0xa839('0xb')]=function(_0x1d3e2b,_0x48158e){return _0x1d3e2b[_0xa839('0xc')](_0xa839('0xd'),attributes,{'tableName':_0xa839('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8561=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define'];(function(_0x2017fb,_0x355923){var _0xd200de=function(_0x38babe){while(--_0x38babe){_0x2017fb['push'](_0x2017fb['shift']());}};_0xd200de(++_0x355923);}(_0x8561,0x1a2));var _0x1856=function(_0x452968,_0x31e391){_0x452968=_0x452968-0x0;var _0xb6f9ae=_0x8561[_0x452968];return _0xb6f9ae;};'use strict';var _=require(_0x1856('0x0'));var util=require(_0x1856('0x1'));var logger=require(_0x1856('0x2'))(_0x1856('0x3'));var moment=require(_0x1856('0x4'));var BPromise=require('bluebird');var rp=require(_0x1856('0x5'));var fs=require('fs');var path=require(_0x1856('0x6'));var rimraf=require(_0x1856('0x7'));var config=require(_0x1856('0x8'));var attributes=require(_0x1856('0x9'));module['exports']=function(_0x20e912,_0x5921ed){return _0x20e912[_0x1856('0xa')](_0x1856('0xb'),attributes,{'tableName':_0x1856('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index af826e4..cde7bf8 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 _0xa93a=['defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoicePrefix,\x20%s,\x20%s','result','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2c348f,_0x214126){var _0x231a64=function(_0x39036c){while(--_0x39036c){_0x2c348f['push'](_0x2c348f['shift']());}};_0x231a64(++_0x214126);}(_0xa93a,0xb8));var _0xaa93=function(_0x4a32eb,_0x19f83d){_0x4a32eb=_0x4a32eb-0x0;var _0x4d8d1a=_0xa93a[_0x4a32eb];return _0x4d8d1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa93('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa93('0x2'));var logger=require('../../config/logger')(_0xaa93('0x3'));var config=require(_0xaa93('0x4'));var jayson=require(_0xaa93('0x5'));var client=jayson[_0xaa93('0x6')][_0xaa93('0x7')]({'port':0x232a});config['redis']=_[_0xaa93('0x8')](config[_0xaa93('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa93('0xa'))(new Redis(config['redis']));require(_0xaa93('0xb'))[_0xaa93('0xc')](socket);function respondWithRpcPromise(_0x5409d9,_0x4f3681,_0x51001d){return new BPromise(function(_0x194d64,_0x521bfe){return client[_0xaa93('0xd')](_0x5409d9,_0x51001d)[_0xaa93('0xe')](function(_0x35e162){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x4f3681,_0xaa93('0xf'));logger['debug'](_0xaa93('0x10'),_0x4f3681,'request\x20sent',JSON[_0xaa93('0x11')](_0x35e162));if(_0x35e162[_0xaa93('0x12')]){if(_0x35e162[_0xaa93('0x12')][_0xaa93('0x13')]===0x1f4){logger[_0xaa93('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4f3681,_0x35e162[_0xaa93('0x12')]['message']);return _0x521bfe(_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4f3681,_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);return _0x194d64(_0x35e162[_0xaa93('0x12')][_0xaa93('0x14')]);}else{logger[_0xaa93('0x15')](_0xaa93('0x16'),_0x4f3681,_0xaa93('0xf'));_0x194d64(_0x35e162[_0xaa93('0x17')][_0xaa93('0x14')]);}})['catch'](function(_0x142635){logger[_0xaa93('0x12')](_0xaa93('0x16'),_0x4f3681,_0x142635);_0x521bfe(_0x142635);});});} \ No newline at end of file +var _0x3c03=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1302cc,_0xd2c925){var _0x40bd9e=function(_0x1a50d6){while(--_0x1a50d6){_0x1302cc['push'](_0x1302cc['shift']());}};_0x40bd9e(++_0xd2c925);}(_0x3c03,0x16d));var _0x33c0=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x3c03[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x33c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33c0('0x1'));var fs=require('fs');var Redis=require(_0x33c0('0x2'));var db=require(_0x33c0('0x3'))['db'];var utils=require(_0x33c0('0x4'));var logger=require('../../config/logger')(_0x33c0('0x5'));var config=require(_0x33c0('0x6'));var jayson=require(_0x33c0('0x7'));var client=jayson[_0x33c0('0x8')][_0x33c0('0x9')]({'port':0x232a});config[_0x33c0('0xa')]=_[_0x33c0('0xb')](config['redis'],{'host':_0x33c0('0xc'),'port':0x18eb});var socket=require(_0x33c0('0xd'))(new Redis(config['redis']));require(_0x33c0('0xe'))[_0x33c0('0xf')](socket);function respondWithRpcPromise(_0x596abd,_0x2bb7f6,_0xb2741f){return new BPromise(function(_0x43362b,_0x142af7){return client['request'](_0x596abd,_0xb2741f)['then'](function(_0x45897d){logger[_0x33c0('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x2bb7f6,'request\x20sent');logger['debug'](_0x33c0('0x11'),_0x2bb7f6,_0x33c0('0x12'),JSON[_0x33c0('0x13')](_0x45897d));if(_0x45897d[_0x33c0('0x14')]){if(_0x45897d[_0x33c0('0x14')][_0x33c0('0x15')]===0x1f4){logger['error'](_0x33c0('0x16'),_0x2bb7f6,_0x45897d[_0x33c0('0x14')][_0x33c0('0x17')]);return _0x142af7(_0x45897d['error'][_0x33c0('0x17')]);}logger['error'](_0x33c0('0x16'),_0x2bb7f6,_0x45897d['error'][_0x33c0('0x17')]);return _0x43362b(_0x45897d[_0x33c0('0x14')][_0x33c0('0x17')]);}else{logger[_0x33c0('0x10')](_0x33c0('0x16'),_0x2bb7f6,_0x33c0('0x12'));_0x43362b(_0x45897d['result'][_0x33c0('0x17')]);}})[_0x33c0('0x18')](function(_0x1b775f){logger[_0x33c0('0x14')](_0x33c0('0x16'),_0x2bb7f6,_0x1b775f);_0x142af7(_0x1b775f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4d01e43..b504f96 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 _0x9090=['remove','update','emit','register','length','./voicePrefix.events','save'];(function(_0x3f5f3b,_0x511e2c){var _0x119388=function(_0x16b8bc){while(--_0x16b8bc){_0x3f5f3b['push'](_0x3f5f3b['shift']());}};_0x119388(++_0x511e2c);}(_0x9090,0x17f));var _0x0909=function(_0x425b30,_0x24a9ab){_0x425b30=_0x425b30-0x0;var _0x5b471a=_0x9090[_0x425b30];return _0x5b471a;};'use strict';var VoicePrefixEvents=require(_0x0909('0x0'));var events=[_0x0909('0x1'),_0x0909('0x2'),_0x0909('0x3')];function createListener(_0x27eba2,_0x5466c8){return function(_0x51923f){_0x5466c8[_0x0909('0x4')](_0x27eba2,_0x51923f);};}function removeListener(_0x289665,_0x29bc19){return function(){VoicePrefixEvents['removeListener'](_0x289665,_0x29bc19);};}exports[_0x0909('0x5')]=function(_0x42af40){for(var _0x5317db=0x0,_0x41d8fc=events[_0x0909('0x6')];_0x5317db<_0x41d8fc;_0x5317db++){var _0x32bf48=events[_0x5317db];var _0x1755ee=createListener('voicePrefix:'+_0x32bf48,_0x42af40);VoicePrefixEvents['on'](_0x32bf48,_0x1755ee);}}; \ No newline at end of file +var _0x6611=['emit','removeListener','register','length','save','remove','update'];(function(_0x4218a0,_0xe7fbac){var _0x45bbc9=function(_0x1e48d6){while(--_0x1e48d6){_0x4218a0['push'](_0x4218a0['shift']());}};_0x45bbc9(++_0xe7fbac);}(_0x6611,0xdd));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x1661('0x0'),_0x1661('0x1'),_0x1661('0x2')];function createListener(_0x1a93fb,_0x3dcfbd){return function(_0x474832){_0x3dcfbd[_0x1661('0x3')](_0x1a93fb,_0x474832);};}function removeListener(_0x25bce6,_0x277da8){return function(){VoicePrefixEvents[_0x1661('0x4')](_0x25bce6,_0x277da8);};}exports[_0x1661('0x5')]=function(_0x1e5dab){for(var _0x58781d=0x0,_0x516d22=events[_0x1661('0x6')];_0x58781d<_0x516d22;_0x58781d++){var _0x3be60f=events[_0x58781d];var _0x57e4b8=createListener('voicePrefix:'+_0x3be60f,_0x1e5dab);VoicePrefixEvents['on'](_0x3be60f,_0x57e4b8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index dd36116..d01a599 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(_0x26b9cb,_0x12bc4c){var _0x3f44e6=function(_0x1a5a4e){while(--_0x1a5a4e){_0x26b9cb['push'](_0x26b9cb['shift']());}};_0x3f44e6(++_0x12bc4c);}(_0xb10b,0x12a));var _0xbb10=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0xb10b[_0x414166];return _0x373505;};'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(_0x5c7374,_0x41a29e){var _0x509b24=function(_0x5ec195){while(--_0x5ec195){_0x5c7374['push'](_0x5c7374['shift']());}};_0x509b24(++_0x41a29e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 ff4e2c5..c0f5698 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 _0xde0b=['STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','preview','booked','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','Active/Disactive\x20AMD','#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports'];(function(_0x36a560,_0x57378b){var _0x10923a=function(_0xd1fa18){while(--_0xd1fa18){_0x36a560['push'](_0x36a560['shift']());}};_0x10923a(++_0x57378b);}(_0xde0b,0x9c));var _0xbde0=function(_0x39ce76,_0x3d356f){_0x39ce76=_0x39ce76-0x0;var _0x2141b3=_0xde0b[_0x39ce76];return _0x2141b3;};'use strict';var Sequelize=require(_0xbde0('0x0'));module[_0xbde0('0x1')]={'name':{'type':Sequelize[_0xbde0('0x2')],'allowNull':![],'unique':_0xbde0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbde0('0x4'),_0xbde0('0x5')),'allowNull':![],'defaultValue':_0xbde0('0x4')},'musiconhold':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':_0xbde0('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xbde0('0x7')]('rr',_0xbde0('0x8'),_0xbde0('0x9'),_0xbde0('0xa'),_0xbde0('0xb'),_0xbde0('0xc'),'linear',_0xbde0('0xd'),_0xbde0('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x34fa9e){this[_0xbde0('0xf')](_0xbde0('0x10'),_0x34fa9e?_0x34fa9e:'rrmemory');},'get':function(){var _0x457ca3=this[_0xbde0('0x11')]('type');var _0x435792=this[_0xbde0('0x11')]('dialMethod');var _0x19e5d7=this[_0xbde0('0x11')](_0xbde0('0x10'));if(_0x457ca3===_0xbde0('0x5')){if(_0x435792===_0xbde0('0x12')){return null;}if(_0x435792===_0xbde0('0x13')&&![_0xbde0('0xc'),'roundrobin']['includes'](_0x19e5d7)){this[_0xbde0('0xf')](_0xbde0('0x10'),'rrmemory');}}return _0x19e5d7;}},'servicelevel':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbde0('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbde0('0x2')]},'weight':{'type':Sequelize[_0xbde0('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xbde0('0x15'),'no'),'defaultValue':_0xbde0('0x15')},'autopause':{'type':Sequelize[_0xbde0('0x7')]('yes','no',_0xbde0('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbde0('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xbde0('0x7')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xbde0('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbde0('0x7')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbde0('0x7')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbde0('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbde0('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defaultValue':_0xbde0('0x15')},'announce_holdtime':{'type':Sequelize[_0xbde0('0x7')]('yes','no',_0xbde0('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xbde0('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbde0('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbde0('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbde0('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbde0('0x2')]},'queue_quantity1':{'type':Sequelize[_0xbde0('0x2')]},'queue_quantity2':{'type':Sequelize[_0xbde0('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xbde0('0x2')]},'queue_less_than':{'type':Sequelize[_0xbde0('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x5eface){this[_0xbde0('0xf')](_0xbde0('0x18'),_0x5eface?_0x5eface[_0xbde0('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0xbde0('0x18'))?this[_0xbde0('0x11')](_0xbde0('0x18'))[_0xbde0('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':_0xbde0('0x15'),'set':function(_0x4def03){this[_0xbde0('0xf')](_0xbde0('0x1b'),_0x4def03?_0x4def03[_0xbde0('0x19')](','):undefined);},'get':function(){return this[_0xbde0('0x11')]('joinempty')?this[_0xbde0('0x11')]('joinempty')[_0xbde0('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':'no','set':function(_0x5e4b9f){this['setDataValue'](_0xbde0('0x1c'),_0x5e4b9f?_0x5e4b9f[_0xbde0('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xbde0('0x1c'))?this['getDataValue'](_0xbde0('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xbde0('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbde0('0x2')]},'description':{'type':Sequelize[_0xbde0('0x2')]},'acw':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':0x0,'set':function(_0x1921dd){this[_0xbde0('0xf')](_0xbde0('0x1e'),_0x1921dd);if(_0x1921dd){if(this[_0xbde0('0x11')]('wrapuptime')<0x2){this[_0xbde0('0xf')](_0xbde0('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbde0('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':0x0,'comment':_0xbde0('0x20')},'dialMethod':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x12'),'progressive',_0xbde0('0x21'),_0xbde0('0x22'),_0xbde0('0x13')),'defaultValue':_0xbde0('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xbde0('0x14')](0x4)[_0xbde0('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbde0('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xbde0('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbde0('0x26')},'dialPowerLevel':{'type':Sequelize[_0xbde0('0x27')](0x2)[_0xbde0('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbde0('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x29'),_0xbde0('0x2a')),'defaultValue':'dropRate','comment':_0xbde0('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbde0('0x27')](0x2)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbde0('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xbde0('0x2d'),'comment':_0xbde0('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x2f')},'dialQueueProject':{'type':Sequelize[_0xbde0('0x2')],'comment':_0xbde0('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'comment':_0xbde0('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbde0('0x36')},'dialTimezone':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbde0('0x37')},'dialPrefix':{'type':Sequelize[_0xbde0('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':0x0,'comment':_0xbde0('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbde0('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbde0('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xbde0('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbde0('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbde0('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbde0('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbde0('0x14')](0x9)[_0xbde0('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbde0('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':0x0,'comment':_0xbde0('0x3f')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbde0('0x7')](_0xbde0('0x40'),_0xbde0('0x41')),'defaultValue':_0xbde0('0x40')},'dialQueueProject2':{'type':Sequelize[_0xbde0('0x2')],'comment':_0xbde0('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbde0('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xbde0('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbde0('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbde0('0x14')](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbde0('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbde0('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbde0('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbde0('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbde0('0x1d')],'defaultValue':![],'comment':_0xbde0('0x4d'),'set':function(_0x4a1915){if(!_0x4a1915)this[_0xbde0('0xf')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbde0('0x4e'),_0x4a1915);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xbde0('0x14')](0x3)[_0xbde0('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x80d6=['leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','ringall'];(function(_0x1f30c7,_0x564a7f){var _0x4d42cc=function(_0x296840){while(--_0x296840){_0x1f30c7['push'](_0x1f30c7['shift']());}};_0x4d42cc(++_0x564a7f);}(_0x80d6,0x1ea));var _0x680d=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x80d6[_0x2fd160];return _0x5c2031;};'use strict';var Sequelize=require(_0x680d('0x0'));module[_0x680d('0x1')]={'name':{'type':Sequelize[_0x680d('0x2')],'allowNull':![],'unique':_0x680d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x680d('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x680d('0x4')},'musiconhold':{'type':Sequelize[_0x680d('0x2')],'defaultValue':_0x680d('0x5')},'announce':{'type':Sequelize[_0x680d('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x680d('0x6')]('rr',_0x680d('0x7'),_0x680d('0x8'),_0x680d('0x9'),_0x680d('0xa'),_0x680d('0xb'),_0x680d('0xc'),'wrandom',_0x680d('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x4c6c72){this[_0x680d('0xe')](_0x680d('0xf'),_0x4c6c72?_0x4c6c72:_0x680d('0xb'));},'get':function(){var _0xf35ed6=this[_0x680d('0x10')](_0x680d('0x11'));var _0x54e8b1=this['getDataValue'](_0x680d('0x12'));var _0x51ced7=this['getDataValue'](_0x680d('0xf'));if(_0xf35ed6===_0x680d('0x13')){if(_0x54e8b1===_0x680d('0x14')){return null;}if(_0x54e8b1===_0x680d('0x15')&&![_0x680d('0xb'),_0x680d('0x16')][_0x680d('0x17')](_0x51ced7)){this[_0x680d('0xe')]('strategy','rrmemory');}}return _0x51ced7;}},'servicelevel':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x680d('0x18')](0xb)},'timeout':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x680d('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':_0x680d('0x19')},'autopause':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no',_0x680d('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x680d('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x680d('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x680d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x680d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x680d('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':_0x680d('0x19')},'announce_holdtime':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x680d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x680d('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x680d('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x680d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x680d('0x2')]},'queue_youarenext':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x680d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x680d('0x2')]},'queue_quantity1':{'type':Sequelize[_0x680d('0x2')]},'queue_quantity2':{'type':Sequelize[_0x680d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x680d('0x2')]},'queue_less_than':{'type':Sequelize[_0x680d('0x2')]},'periodic_announce':{'type':Sequelize[_0x680d('0x1b')],'set':function(_0x433bfc){this[_0x680d('0xe')](_0x680d('0x1c'),_0x433bfc?_0x433bfc[_0x680d('0x1d')](','):[]);},'get':function(){return this[_0x680d('0x10')](_0x680d('0x1c'))?this[_0x680d('0x10')](_0x680d('0x1c'))[_0x680d('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x680d('0x19'),'set':function(_0x3ef501){this[_0x680d('0xe')](_0x680d('0x1f'),_0x3ef501?_0x3ef501[_0x680d('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x680d('0x1f'))?this[_0x680d('0x10')](_0x680d('0x1f'))[_0x680d('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x136ef7){this[_0x680d('0xe')]('leavewhenempty',_0x136ef7?_0x136ef7['join'](','):undefined);},'get':function(){return this[_0x680d('0x10')](_0x680d('0x20'))?this[_0x680d('0x10')](_0x680d('0x20'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x680d('0x6')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x680d('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x680d('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x680d('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x32b3b0){this[_0x680d('0xe')](_0x680d('0x21'),_0x32b3b0);if(_0x32b3b0){if(this['getDataValue'](_0x680d('0x22'))<0x2){this[_0x680d('0xe')](_0x680d('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x680d('0x23')],'defaultValue':0x0,'comment':_0x680d('0x24')},'dialMethod':{'type':Sequelize[_0x680d('0x6')]('preview',_0x680d('0x25'),_0x680d('0x26'),_0x680d('0x27'),_0x680d('0x15')),'defaultValue':_0x680d('0x25'),'comment':_0x680d('0x28')},'dialLimitChannel':{'type':Sequelize[_0x680d('0x18')](0x4)[_0x680d('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x680d('0x2a')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x680d('0x2b')},'dialPowerLevel':{'type':Sequelize[_0x680d('0x2c')](0x2)[_0x680d('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x680d('0x2d')},'dialPredictiveOptimization':{'type':Sequelize[_0x680d('0x6')]('agentBusyFactor',_0x680d('0x2e')),'defaultValue':_0x680d('0x2e'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x680d('0x2c')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x680d('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x680d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x680d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x680d('0x2')],'defaultValue':'tTxX','comment':_0x680d('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x680d('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x680d('0x18')](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x3,'comment':_0x680d('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x680d('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x680d('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'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':_0x680d('0x37')},'dialPrefix':{'type':Sequelize[_0x680d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x38'),_0x680d('0x39'),'onlyIfOpen'),'defaultValue':_0x680d('0x38')},'dialAMDActive':{'type':Sequelize[_0x680d('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x680d('0x18')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x680d('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x680d('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x680d('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x680d('0x18')](0x9)[_0x680d('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x680d('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x680d('0x18')](0x9)[_0x680d('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x680d('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x680d('0x18')](0x9)[_0x680d('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x680d('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x680d('0x18')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x680d('0x18')](0x5)[_0x680d('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x680d('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x680d('0x18')](0x9)[_0x680d('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x680d('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x680d('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x680d('0x23')],'defaultValue':0x0,'comment':_0x680d('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x680d('0x6')](_0x680d('0x43'),_0x680d('0x44')),'defaultValue':_0x680d('0x43')},'dialQueueProject2':{'type':Sequelize[_0x680d('0x2')],'comment':_0x680d('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x680d('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x680d('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x680d('0x45')},'dialCutDigit':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x680d('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x680d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x680d('0x18')](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x680d('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x680d('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x680d('0x18')](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x680d('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x680d('0x18')](0x3)[_0x680d('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x680d('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x680d('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x680d('0x18')],'allowNull':!![],'comment':_0x680d('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x680d('0x23')],'defaultValue':![],'comment':_0x680d('0x50'),'set':function(_0x347208){if(!_0x347208)this['setDataValue'](_0x680d('0x51'),null);this[_0x680d('0xe')](_0x680d('0x52'),_0x347208);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x680d('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x680d('0x18')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x680d('0x23')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x680d('0x23')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e22b0f2..c2512cd 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 _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x2574f0,_0x5752d9){var _0x4050f1=function(_0x42ccff){while(--_0x42ccff){_0x2574f0['push'](_0x2574f0['shift']());}};_0x4050f1(++_0x5752d9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x5fc3[_0x3e0763];return _0x351ca2;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x3686a1,_0x41ad9a){var _0x3c4e9c=function(_0x35e956){while(--_0x35e956){_0x3686a1['push'](_0x3686a1['shift']());}};_0x3c4e9c(++_0x41ad9a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x5fc3[_0x587ba2];return _0x50ec73;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e1482bf..06ebfe6 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 _0x2794=['../../mysqldb','VoiceQueue','update','hasOwnProperty','hook','exports'];(function(_0x430678,_0x50ccc2){var _0xca6e8b=function(_0x24c4f2){while(--_0x24c4f2){_0x430678['push'](_0x430678['shift']());}};_0xca6e8b(++_0x50ccc2);}(_0x2794,0x17a));var _0x4279=function(_0xaa993e,_0x1bfc06){_0xaa993e=_0xaa993e-0x0;var _0x714376=_0x2794[_0xaa993e];return _0x714376;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4279('0x0'))['db'][_0x4279('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4279('0x2'),'afterDestroy':'remove'};function emitEvent(_0x471f31){return function(_0x4e4c39,_0x1abe40,_0x30641c){VoiceQueueEvents['emit'](_0x471f31+':'+_0x4e4c39['id'],_0x4e4c39);VoiceQueueEvents['emit'](_0x471f31,_0x4e4c39);_0x30641c(null);};}for(var e in events){if(events[_0x4279('0x3')](e)){var event=events[e];VoiceQueue[_0x4279('0x4')](e,emitEvent(event));}}module[_0x4279('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0xefae=['remove','emit','exports','VoiceQueue','setMaxListeners','save','update'];(function(_0x70607a,_0x5458b3){var _0x75ae6=function(_0x57d46e){while(--_0x57d46e){_0x70607a['push'](_0x70607a['shift']());}};_0x75ae6(++_0x5458b3);}(_0xefae,0x8f));var _0xeefa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefae[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xeefa('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xeefa('0x1')](0x0);var events={'afterCreate':_0xeefa('0x2'),'afterUpdate':_0xeefa('0x3'),'afterDestroy':_0xeefa('0x4')};function emitEvent(_0x10103c){return function(_0x4ec395,_0x5c367d,_0x239686){VoiceQueueEvents[_0xeefa('0x5')](_0x10103c+':'+_0x4ec395['id'],_0x4ec395);VoiceQueueEvents[_0xeefa('0x5')](_0x10103c,_0x4ec395);_0x239686(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xeefa('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 689f3d2..3095216 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x913b85,_0x213182){var _0x1ce434=function(_0x4c9c8b){while(--_0x4c9c8b){_0x913b85['push'](_0x913b85['shift']());}};_0x1ce434(++_0x213182);}(_0x3e74,0x175));var _0x43e7=function(_0x2e3862,_0x3bc936){_0x2e3862=_0x2e3862-0x0;var _0x3f3ae9=_0x3e74[_0x2e3862];return _0x3f3ae9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x57ef4b,_0x3e1bb0){var _0x468c9c=function(_0x46b7f9){while(--_0x46b7f9){_0x57ef4b['push'](_0x57ef4b['shift']());}};_0x468c9c(++_0x3e1bb0);}(_0x34e8,0x12c));var _0x834e=function(_0x496ed9,_0x3dd97d){_0x496ed9=_0x496ed9-0x0;var _0x24ba93=_0x34e8[_0x496ed9];return _0x24ba93;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a27c3f0..c44d4c7 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 _0xeee1=['then','info','debug','stringify','catch','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x55e1c1,_0x2fb19a){var _0x34f5a3=function(_0x1fc7bf){while(--_0x1fc7bf){_0x55e1c1['push'](_0x55e1c1['shift']());}};_0x34f5a3(++_0x2fb19a);}(_0xeee1,0xd4));var _0x1eee=function(_0x58d7f3,_0x392ce4){_0x58d7f3=_0x58d7f3-0x0;var _0x3aaea0=_0xeee1[_0x58d7f3];return _0x3aaea0;};'use strict';var _=require(_0x1eee('0x0'));var util=require(_0x1eee('0x1'));var moment=require(_0x1eee('0x2'));var BPromise=require(_0x1eee('0x3'));var rs=require(_0x1eee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1eee('0x5'))['db'];var utils=require(_0x1eee('0x6'));var logger=require(_0x1eee('0x7'))(_0x1eee('0x8'));var config=require(_0x1eee('0x9'));var jayson=require(_0x1eee('0xa'));var client=jayson[_0x1eee('0xb')]['http']({'port':0x232a});config[_0x1eee('0xc')]=_[_0x1eee('0xd')](config[_0x1eee('0xc')],{'host':_0x1eee('0xe'),'port':0x18eb});var socket=require(_0x1eee('0xf'))(new Redis(config[_0x1eee('0xc')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x8da49e,_0x5621c1,_0x3e84d8){return new BPromise(function(_0x488471,_0x22d0ce){return client[_0x1eee('0x10')](_0x8da49e,_0x3e84d8)['then'](function(_0x168ad6){logger['info'](_0x1eee('0x11'),_0x5621c1,_0x1eee('0x12'));logger['debug'](_0x1eee('0x13'),_0x5621c1,'request\x20sent',JSON['stringify'](_0x168ad6));if(_0x168ad6[_0x1eee('0x14')]){if(_0x168ad6[_0x1eee('0x14')][_0x1eee('0x15')]===0x1f4){logger[_0x1eee('0x14')](_0x1eee('0x11'),_0x5621c1,_0x168ad6['error'][_0x1eee('0x16')]);return _0x22d0ce(_0x168ad6[_0x1eee('0x14')][_0x1eee('0x16')]);}logger[_0x1eee('0x14')](_0x1eee('0x11'),_0x5621c1,_0x168ad6[_0x1eee('0x14')][_0x1eee('0x16')]);return _0x488471(_0x168ad6[_0x1eee('0x14')][_0x1eee('0x16')]);}else{logger['info'](_0x1eee('0x11'),_0x5621c1,_0x1eee('0x12'));_0x488471(_0x168ad6[_0x1eee('0x17')][_0x1eee('0x16')]);}})['catch'](function(_0x8098ea){logger[_0x1eee('0x14')](_0x1eee('0x11'),_0x5621c1,_0x8098ea);_0x22d0ce(_0x8098ea);});});}exports[_0x1eee('0x18')]=function(_0x583f43){var _0x90e07=this;return new Promise(function(_0x359f16,_0x174687){return db[_0x1eee('0x19')]['findAll']({'raw':_0x583f43[_0x1eee('0x1a')]?_0x583f43[_0x1eee('0x1a')][_0x1eee('0x1b')]===undefined?!![]:![]:!![],'where':_0x583f43['options']?_0x583f43[_0x1eee('0x1a')][_0x1eee('0x1c')]||null:null,'attributes':_0x583f43['options']?_0x583f43[_0x1eee('0x1a')][_0x1eee('0x1d')]||null:null,'limit':_0x583f43[_0x1eee('0x1a')]?_0x583f43['options'][_0x1eee('0x1e')]||null:null,'include':_0x583f43[_0x1eee('0x1a')]?_0x583f43['options'][_0x1eee('0x1f')]?_[_0x1eee('0x20')](_0x583f43[_0x1eee('0x1a')][_0x1eee('0x1f')],function(_0x2be3c4){return{'model':db[_0x2be3c4[_0x1eee('0x21')]],'as':_0x2be3c4['as'],'attributes':_0x2be3c4[_0x1eee('0x1d')],'include':_0x2be3c4['include']?_[_0x1eee('0x20')](_0x2be3c4['include'],function(_0x315cda){return{'model':db[_0x315cda['model']],'as':_0x315cda['as'],'attributes':_0x315cda[_0x1eee('0x1d')],'include':_0x315cda[_0x1eee('0x1f')]?_[_0x1eee('0x20')](_0x315cda[_0x1eee('0x1f')],function(_0xc3f725){return{'model':db[_0xc3f725[_0x1eee('0x21')]],'as':_0xc3f725['as'],'attributes':_0xc3f725[_0x1eee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1eee('0x22')](function(_0xa4d900){logger[_0x1eee('0x23')](_0x1eee('0x18'),_0x583f43);logger[_0x1eee('0x24')](_0x1eee('0x18'),_0x583f43,JSON[_0x1eee('0x25')](_0xa4d900));_0x359f16(_0xa4d900);})[_0x1eee('0x26')](function(_0xb76c59){logger[_0x1eee('0x14')](_0x1eee('0x18'),_0xb76c59[_0x1eee('0x16')],_0x583f43);_0x174687(_0x90e07[_0x1eee('0x14')](0x1f4,_0xb76c59[_0x1eee('0x16')]));});});};exports[_0x1eee('0x27')]=function(_0x469f32){var _0xef051a=this;return new Promise(function(_0x2dd9a2,_0x288420){return db['VoiceQueue'][_0x1eee('0x28')]({'raw':_0x469f32['options']?_0x469f32['options'][_0x1eee('0x1b')]===undefined?!![]:![]:!![],'where':_0x469f32['options']?_0x469f32['options']['where']||null:null,'attributes':_0x469f32[_0x1eee('0x1a')]?_0x469f32[_0x1eee('0x1a')][_0x1eee('0x1d')]||null:null,'include':_0x469f32[_0x1eee('0x1a')]?_0x469f32[_0x1eee('0x1a')][_0x1eee('0x1f')]?_[_0x1eee('0x20')](_0x469f32[_0x1eee('0x1a')][_0x1eee('0x1f')],function(_0x5e829d){return{'model':db[_0x5e829d[_0x1eee('0x21')]],'as':_0x5e829d['as'],'attributes':_0x5e829d[_0x1eee('0x1d')],'include':_0x5e829d[_0x1eee('0x1f')]?_[_0x1eee('0x20')](_0x5e829d[_0x1eee('0x1f')],function(_0x38687c){return{'model':db[_0x38687c['model']],'as':_0x38687c['as'],'attributes':_0x38687c[_0x1eee('0x1d')],'include':_0x38687c[_0x1eee('0x1f')]?_[_0x1eee('0x20')](_0x38687c[_0x1eee('0x1f')],function(_0x20daa4){return{'model':db[_0x20daa4[_0x1eee('0x21')]],'as':_0x20daa4['as'],'attributes':_0x20daa4[_0x1eee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1eee('0x22')](function(_0x196cb8){logger[_0x1eee('0x23')](_0x1eee('0x27'),_0x469f32);logger[_0x1eee('0x24')](_0x1eee('0x27'),_0x469f32,JSON[_0x1eee('0x25')](_0x196cb8));_0x2dd9a2(_0x196cb8);})[_0x1eee('0x26')](function(_0xe93776){logger[_0x1eee('0x14')](_0x1eee('0x27'),_0xe93776[_0x1eee('0x16')],_0x469f32);_0x288420(_0xef051a['error'](0x1f4,_0xe93776[_0x1eee('0x16')]));});});}; \ No newline at end of file +var _0xd599=['limit','include','map','model','catch','ShowVoiceQueue','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','GetVoiceQueue','VoiceQueue','options','raw','attributes'];(function(_0x1a00f,_0x531fbc){var _0x321a53=function(_0x160705){while(--_0x160705){_0x1a00f['push'](_0x1a00f['shift']());}};_0x321a53(++_0x531fbc);}(_0xd599,0x73));var _0x9d59=function(_0x4ba847,_0x3cb676){_0x4ba847=_0x4ba847-0x0;var _0x3dec58=_0xd599[_0x4ba847];return _0x3dec58;};'use strict';var _=require(_0x9d59('0x0'));var util=require(_0x9d59('0x1'));var moment=require(_0x9d59('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d59('0x3'));var fs=require('fs');var Redis=require(_0x9d59('0x4'));var db=require(_0x9d59('0x5'))['db'];var utils=require(_0x9d59('0x6'));var logger=require(_0x9d59('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d59('0x8')][_0x9d59('0x9')]({'port':0x232a});config[_0x9d59('0xa')]=_['defaults'](config[_0x9d59('0xa')],{'host':_0x9d59('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d59('0xa')]));require(_0x9d59('0xc'))['register'](socket);function respondWithRpcPromise(_0x54fefa,_0x37c871,_0x1f2771){return new BPromise(function(_0x41060a,_0x426462){return client[_0x9d59('0xd')](_0x54fefa,_0x1f2771)[_0x9d59('0xe')](function(_0x49a166){logger[_0x9d59('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x37c871,_0x9d59('0x10'));logger[_0x9d59('0x11')](_0x9d59('0x12'),_0x37c871,_0x9d59('0x10'),JSON[_0x9d59('0x13')](_0x49a166));if(_0x49a166['error']){if(_0x49a166[_0x9d59('0x14')][_0x9d59('0x15')]===0x1f4){logger[_0x9d59('0x14')](_0x9d59('0x16'),_0x37c871,_0x49a166[_0x9d59('0x14')][_0x9d59('0x17')]);return _0x426462(_0x49a166[_0x9d59('0x14')][_0x9d59('0x17')]);}logger[_0x9d59('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x37c871,_0x49a166[_0x9d59('0x14')][_0x9d59('0x17')]);return _0x41060a(_0x49a166[_0x9d59('0x14')]['message']);}else{logger[_0x9d59('0xf')](_0x9d59('0x16'),_0x37c871,'request\x20sent');_0x41060a(_0x49a166['result'][_0x9d59('0x17')]);}})['catch'](function(_0x578214){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x37c871,_0x578214);_0x426462(_0x578214);});});}exports[_0x9d59('0x18')]=function(_0x4f90fb){var _0x87f052=this;return new Promise(function(_0x3dbe58,_0xa9d912){return db[_0x9d59('0x19')]['findAll']({'raw':_0x4f90fb['options']?_0x4f90fb[_0x9d59('0x1a')][_0x9d59('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f90fb[_0x9d59('0x1a')]?_0x4f90fb[_0x9d59('0x1a')]['where']||null:null,'attributes':_0x4f90fb[_0x9d59('0x1a')]?_0x4f90fb[_0x9d59('0x1a')][_0x9d59('0x1c')]||null:null,'limit':_0x4f90fb['options']?_0x4f90fb[_0x9d59('0x1a')][_0x9d59('0x1d')]||null:null,'include':_0x4f90fb[_0x9d59('0x1a')]?_0x4f90fb[_0x9d59('0x1a')][_0x9d59('0x1e')]?_[_0x9d59('0x1f')](_0x4f90fb[_0x9d59('0x1a')][_0x9d59('0x1e')],function(_0xb9ab1){return{'model':db[_0xb9ab1['model']],'as':_0xb9ab1['as'],'attributes':_0xb9ab1[_0x9d59('0x1c')],'include':_0xb9ab1[_0x9d59('0x1e')]?_['map'](_0xb9ab1[_0x9d59('0x1e')],function(_0x21d06a){return{'model':db[_0x21d06a[_0x9d59('0x20')]],'as':_0x21d06a['as'],'attributes':_0x21d06a['attributes'],'include':_0x21d06a[_0x9d59('0x1e')]?_[_0x9d59('0x1f')](_0x21d06a[_0x9d59('0x1e')],function(_0x17e74f){return{'model':db[_0x17e74f[_0x9d59('0x20')]],'as':_0x17e74f['as'],'attributes':_0x17e74f[_0x9d59('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45b500){logger[_0x9d59('0xf')]('GetVoiceQueue',_0x4f90fb);logger[_0x9d59('0x11')](_0x9d59('0x18'),_0x4f90fb,JSON[_0x9d59('0x13')](_0x45b500));_0x3dbe58(_0x45b500);})[_0x9d59('0x21')](function(_0x2f3567){logger[_0x9d59('0x14')](_0x9d59('0x18'),_0x2f3567[_0x9d59('0x17')],_0x4f90fb);_0xa9d912(_0x87f052[_0x9d59('0x14')](0x1f4,_0x2f3567[_0x9d59('0x17')]));});});};exports[_0x9d59('0x22')]=function(_0x2056bf){var _0x368ce7=this;return new Promise(function(_0x1c08cb,_0x1aaf87){return db[_0x9d59('0x19')]['find']({'raw':_0x2056bf['options']?_0x2056bf[_0x9d59('0x1a')][_0x9d59('0x1b')]===undefined?!![]:![]:!![],'where':_0x2056bf[_0x9d59('0x1a')]?_0x2056bf[_0x9d59('0x1a')][_0x9d59('0x23')]||null:null,'attributes':_0x2056bf[_0x9d59('0x1a')]?_0x2056bf['options'][_0x9d59('0x1c')]||null:null,'include':_0x2056bf['options']?_0x2056bf[_0x9d59('0x1a')]['include']?_[_0x9d59('0x1f')](_0x2056bf[_0x9d59('0x1a')][_0x9d59('0x1e')],function(_0xbadc46){return{'model':db[_0xbadc46[_0x9d59('0x20')]],'as':_0xbadc46['as'],'attributes':_0xbadc46[_0x9d59('0x1c')],'include':_0xbadc46[_0x9d59('0x1e')]?_[_0x9d59('0x1f')](_0xbadc46[_0x9d59('0x1e')],function(_0x2b8352){return{'model':db[_0x2b8352[_0x9d59('0x20')]],'as':_0x2b8352['as'],'attributes':_0x2b8352[_0x9d59('0x1c')],'include':_0x2b8352['include']?_['map'](_0x2b8352['include'],function(_0x558aa1){return{'model':db[_0x558aa1[_0x9d59('0x20')]],'as':_0x558aa1['as'],'attributes':_0x558aa1[_0x9d59('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40c034){logger[_0x9d59('0xf')]('ShowVoiceQueue',_0x2056bf);logger[_0x9d59('0x11')](_0x9d59('0x22'),_0x2056bf,JSON[_0x9d59('0x13')](_0x40c034));_0x1c08cb(_0x40c034);})['catch'](function(_0x747b42){logger[_0x9d59('0x14')](_0x9d59('0x22'),_0x747b42[_0x9d59('0x17')],_0x2056bf);_0x1aaf87(_0x368ce7[_0x9d59('0x14')](0x1f4,_0x747b42[_0x9d59('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b06bb23..6b4191a 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 _0xf778=['remove','update','emit','register','voiceQueue:','save'];(function(_0x109fc9,_0xd26cd7){var _0xac1b2e=function(_0x3aebc6){while(--_0x3aebc6){_0x109fc9['push'](_0x109fc9['shift']());}};_0xac1b2e(++_0xd26cd7);}(_0xf778,0xa1));var _0x8f77=function(_0x3c4895,_0x48b94e){_0x3c4895=_0x3c4895-0x0;var _0x314112=_0xf778[_0x3c4895];return _0x314112;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x8f77('0x0'),_0x8f77('0x1'),_0x8f77('0x2')];function createListener(_0x21971b,_0x4c035b){return function(_0x5ad902){_0x4c035b[_0x8f77('0x3')](_0x21971b,_0x5ad902);};}function removeListener(_0x3528f5,_0x22a1c2){return function(){VoiceQueueEvents['removeListener'](_0x3528f5,_0x22a1c2);};}exports[_0x8f77('0x4')]=function(_0x46f2fb){for(var _0x38a764=0x0,_0x296af6=events['length'];_0x38a764<_0x296af6;_0x38a764++){var _0x1e2517=events[_0x38a764];var _0x309e89=createListener(_0x8f77('0x5')+_0x1e2517,_0x46f2fb);VoiceQueueEvents['on'](_0x1e2517,_0x309e89);}}; \ No newline at end of file +var _0x683b=['save','remove','update','emit','removeListener','voiceQueue:'];(function(_0x54beb5,_0x10b92b){var _0x507412=function(_0x20974f){while(--_0x20974f){_0x54beb5['push'](_0x54beb5['shift']());}};_0x507412(++_0x10b92b);}(_0x683b,0x126));var _0xb683=function(_0x1127fa,_0x472b8){_0x1127fa=_0x1127fa-0x0;var _0x11ab31=_0x683b[_0x1127fa];return _0x11ab31;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb683('0x0'),_0xb683('0x1'),_0xb683('0x2')];function createListener(_0x3a7943,_0x427e00){return function(_0x34b315){_0x427e00[_0xb683('0x3')](_0x3a7943,_0x34b315);};}function removeListener(_0x57be0d,_0x8bc010){return function(){VoiceQueueEvents[_0xb683('0x4')](_0x57be0d,_0x8bc010);};}exports['register']=function(_0x3d9dfc){for(var _0x4576ca=0x0,_0x365b63=events['length'];_0x4576ca<_0x365b63;_0x4576ca++){var _0x6c4750=events[_0x4576ca];var _0x2e91df=createListener(_0xb683('0x5')+_0x6c4750,_0x3d9dfc);VoiceQueueEvents['on'](_0x6c4750,_0x2e91df);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 510af16..6b5b5ee 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 _0x4cb0=['create','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x5a11b6,_0x5586be){var _0x2722c0=function(_0xf418cd){while(--_0xf418cd){_0x5a11b6['push'](_0x5a11b6['shift']());}};_0x2722c0(++_0x5586be);}(_0x4cb0,0x1a3));var _0x04cb=function(_0x4dabcd,_0x516207){_0x4dabcd=_0x4dabcd-0x0;var _0x21ad40=_0x4cb0[_0x4dabcd];return _0x21ad40;};'use strict';var multer=require(_0x04cb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x04cb('0x1'));var express=require(_0x04cb('0x2'));var router=express[_0x04cb('0x3')]();var fs_extra=require(_0x04cb('0x4'));var auth=require(_0x04cb('0x5'));var interaction=require(_0x04cb('0x6'));var config=require(_0x04cb('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x04cb('0x8')]('/',auth[_0x04cb('0x9')](),controller['index']);router[_0x04cb('0x8')](_0x04cb('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x04cb('0x8')](_0x04cb('0xb'),auth['isAuthenticated'](),controller[_0x04cb('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x04cb('0xd')]);router[_0x04cb('0xe')](_0x04cb('0xb'),auth['isAuthenticated'](),controller[_0x04cb('0xf')]);router[_0x04cb('0x10')]('/:id',auth[_0x04cb('0x9')](),controller['destroy']);module[_0x04cb('0x11')]=router; \ No newline at end of file +var _0xa7e6=['util','path','express','Router','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','delete','exports'];(function(_0x50ceed,_0x2cf670){var _0x9034e2=function(_0x3a4747){while(--_0x3a4747){_0x50ceed['push'](_0x50ceed['shift']());}};_0x9034e2(++_0x2cf670);}(_0xa7e6,0xab));var _0x6a7e=function(_0x3b2f10,_0x34dc5f){_0x3b2f10=_0x3b2f10-0x0;var _0x563d79=_0xa7e6[_0x3b2f10];return _0x563d79;};'use strict';var multer=require('multer');var util=require(_0x6a7e('0x0'));var path=require(_0x6a7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a7e('0x2'));var router=express[_0x6a7e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a7e('0x4'));var config=require('../../config/environment');var controller=require(_0x6a7e('0x5'));router[_0x6a7e('0x6')]('/',auth[_0x6a7e('0x7')](),controller[_0x6a7e('0x8')]);router[_0x6a7e('0x6')](_0x6a7e('0x9'),auth[_0x6a7e('0x7')](),controller[_0x6a7e('0xa')]);router[_0x6a7e('0x6')](_0x6a7e('0xb'),auth[_0x6a7e('0x7')](),controller[_0x6a7e('0xc')]);router[_0x6a7e('0x6')](_0x6a7e('0xd'),auth[_0x6a7e('0x7')](),controller[_0x6a7e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a7e('0xf')]);router[_0x6a7e('0x10')](_0x6a7e('0xd'),auth[_0x6a7e('0x7')](),controller['update']);router[_0x6a7e('0x11')](_0x6a7e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6a7e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index da56eeb..5fc9e45 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 _0xddfd=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x1ac242,_0x442a00){var _0x5011a5=function(_0x446fce){while(--_0x446fce){_0x1ac242['push'](_0x1ac242['shift']());}};_0x5011a5(++_0x442a00);}(_0xddfd,0xf5));var _0xdddf=function(_0x8ff7c1,_0x5142c3){_0x8ff7c1=_0x8ff7c1-0x0;var _0x244efa=_0xddfd[_0x8ff7c1];return _0x244efa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdddf('0x0'));module[_0xdddf('0x1')]={'type':{'type':Sequelize[_0xdddf('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdddf('0x2')]},'calleridname':{'type':Sequelize[_0xdddf('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xdddf('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xdddf('0x3')],'set':function(_0x42a24b){var _0x178688=moment(_0x42a24b);var _0x3d76db=moment(this[_0xdddf('0x4')](_0xdddf('0x5')))[_0xdddf('0x6')](_0xdddf('0x7'));var _0x53e8f1=_0x178688[_0xdddf('0x8')](_0x3d76db,_0xdddf('0x9'));this[_0xdddf('0xa')](_0xdddf('0xb'),_0x42a24b);this[_0xdddf('0xa')](_0xdddf('0xc'),_0x53e8f1||null);}},'position':{'type':Sequelize[_0xdddf('0xd')]},'count':{'type':Sequelize[_0xdddf('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xdddf('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xdddf('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xdddf('0xe')},'originalposition':{'type':Sequelize[_0xdddf('0xd')]},'channel':{'type':Sequelize[_0xdddf('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdddf('0x2')]},'connectedlinename':{'type':Sequelize[_0xdddf('0x2')]},'accountcode':{'type':Sequelize[_0xdddf('0x2')]},'context':{'type':Sequelize[_0xdddf('0x2')]},'exten':{'type':Sequelize[_0xdddf('0x2')]},'priority':{'type':Sequelize[_0xdddf('0x2')]},'holdtime':{'type':Sequelize[_0xdddf('0xd')]},'mohtime':{'type':Sequelize[_0xdddf('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdddf('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xdddf('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xdddf('0x2')],'comment':_0xdddf('0x10')},'transferexten':{'type':Sequelize[_0xdddf('0x2')]},'transferuniqueid':{'type':Sequelize[_0xdddf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xdddf('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xdddf('0x2')]}}; \ No newline at end of file +var _0x35a9=['sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x12e1ac,_0x558f0e){var _0x22976c=function(_0x3549c1){while(--_0x3549c1){_0x12e1ac['push'](_0x12e1ac['shift']());}};_0x22976c(++_0x558f0e);}(_0x35a9,0x1a4));var _0x935a=function(_0x52419e,_0x31ebe6){_0x52419e=_0x52419e-0x0;var _0x51fa20=_0x35a9[_0x52419e];return _0x51fa20;};'use strict';var Sequelize=require(_0x935a('0x0'));var moment=require(_0x935a('0x1'));module[_0x935a('0x2')]={'type':{'type':Sequelize[_0x935a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x935a('0x3')]},'calleridname':{'type':Sequelize[_0x935a('0x3')]},'queue':{'type':Sequelize[_0x935a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x935a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x935a('0x4')],'set':function(_0x46329d){var _0x5997e0=moment(_0x46329d);var _0x54ddbc=moment(this[_0x935a('0x5')]('queuecallerjoinAt'))[_0x935a('0x6')](_0x935a('0x7'));var _0x2144b6=_0x5997e0['diff'](_0x54ddbc,_0x935a('0x8'));this[_0x935a('0x9')](_0x935a('0xa'),_0x46329d);this[_0x935a('0x9')](_0x935a('0xb'),_0x2144b6||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x935a('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x935a('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x935a('0x4')]},'queuecallerexit':{'type':Sequelize[_0x935a('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x935a('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x935a('0xe')},'originalposition':{'type':Sequelize[_0x935a('0xc')]},'channel':{'type':Sequelize[_0x935a('0x3')]},'connectedlinenum':{'type':Sequelize[_0x935a('0x3')]},'connectedlinename':{'type':Sequelize[_0x935a('0x3')]},'accountcode':{'type':Sequelize[_0x935a('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x935a('0x3')]},'priority':{'type':Sequelize[_0x935a('0x3')]},'holdtime':{'type':Sequelize[_0x935a('0xc')]},'mohtime':{'type':Sequelize[_0x935a('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x935a('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x935a('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x935a('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x935a('0x3')]},'disposition':{'type':Sequelize[_0x935a('0x3')]},'secondDisposition':{'type':Sequelize[_0x935a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x935a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x935a('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 9f922c9..494756d 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 _0x06a3=['describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','rawAttributes','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','params'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x06a3,0x142));var _0x306a=function(_0x2cf891,_0x54171b){_0x2cf891=_0x2cf891-0x0;var _0x307493=_0x06a3[_0x2cf891];return _0x307493;};'use strict';var emlformat=require(_0x306a('0x0'));var rimraf=require(_0x306a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x306a('0x2'));var rp=require('request-promise');var moment=require(_0x306a('0x3'));var BPromise=require(_0x306a('0x4'));var Mustache=require(_0x306a('0x5'));var util=require(_0x306a('0x6'));var path=require('path');var sox=require(_0x306a('0x7'));var csv=require(_0x306a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x306a('0x9'));var _=require(_0x306a('0xa'));var squel=require(_0x306a('0xb'));var crypto=require(_0x306a('0xc'));var jsforce=require(_0x306a('0xd'));var deskjs=require(_0x306a('0xe'));var toCsv=require(_0x306a('0x8'));var querystring=require('querystring');var Papa=require(_0x306a('0xf'));var Redis=require(_0x306a('0x10'));var authService=require(_0x306a('0x11'));var qs=require(_0x306a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x306a('0x13'));var logger=require('../../config/logger')(_0x306a('0x14'));var utils=require('../../config/utils');var config=require(_0x306a('0x15'));var licenseUtil=require(_0x306a('0x16'));var db=require('../../mysqldb')['db'];config[_0x306a('0x17')]=_['defaults'](config['redis'],{'host':_0x306a('0x18'),'port':0x18eb});var socket=require(_0x306a('0x19'))(new Redis(config[_0x306a('0x17')]));require(_0x306a('0x1a'))[_0x306a('0x1b')](socket);function respondWithStatusCode(_0x5a266f,_0x372a12){_0x372a12=_0x372a12||0xcc;return function(_0x2947a7){if(_0x2947a7){return _0x5a266f['sendStatus'](_0x372a12);}return _0x5a266f[_0x306a('0x1c')](_0x372a12)[_0x306a('0x1d')]();};}function respondWithResult(_0x2f217a,_0x3ec234){_0x3ec234=_0x3ec234||0xc8;return function(_0xbb8166){if(_0xbb8166){return _0x2f217a[_0x306a('0x1c')](_0x3ec234)[_0x306a('0x1e')](_0xbb8166);}};}function respondWithFilteredResult(_0x45aa78,_0x1b8304){return function(_0x45eb34){if(_0x45eb34){var _0x4c668a=typeof _0x1b8304[_0x306a('0x1f')]===_0x306a('0x20')&&typeof _0x1b8304[_0x306a('0x21')]===_0x306a('0x20');var _0x423fd0=_0x45eb34[_0x306a('0x22')];var _0x316802=_0x4c668a?0x0:_0x1b8304[_0x306a('0x1f')];var _0x59662b=_0x4c668a?_0x45eb34['count']:_0x1b8304[_0x306a('0x1f')]+_0x1b8304[_0x306a('0x21')];var _0x8853fa;if(_0x59662b>=_0x423fd0){_0x59662b=_0x423fd0;_0x8853fa=0xc8;}else{_0x8853fa=0xce;}_0x45aa78[_0x306a('0x1c')](_0x8853fa);return _0x45aa78[_0x306a('0x23')](_0x306a('0x24'),_0x316802+'-'+_0x59662b+'/'+_0x423fd0)[_0x306a('0x1e')](_0x45eb34);}return null;};}function patchUpdates(_0x407180){return function(_0x394a20){try{jsonpatch[_0x306a('0x25')](_0x394a20,_0x407180,!![]);}catch(_0x3fbdb0){return BPromise['reject'](_0x3fbdb0);}return _0x394a20[_0x306a('0x26')]();};}function saveUpdates(_0x411bdf,_0x47ac11){return function(_0x424c95){if(_0x424c95){return _0x424c95[_0x306a('0x27')](_0x411bdf)[_0x306a('0x28')](function(_0x1f8d0e){return _0x1f8d0e;});}return null;};}function removeEntity(_0xe9225c,_0x1d998d){return function(_0x141d37){if(_0x141d37){return _0x141d37[_0x306a('0x29')]()[_0x306a('0x28')](function(){_0xe9225c[_0x306a('0x1c')](0xcc)[_0x306a('0x1d')]();});}};}function handleEntityNotFound(_0x2e03c6,_0x349e82){return function(_0xaf09c9){if(!_0xaf09c9){_0x2e03c6['sendStatus'](0x194);}return _0xaf09c9;};}function handleError(_0x30d6ad,_0x27b28a){_0x27b28a=_0x27b28a||0x1f4;return function(_0x2684b3){logger[_0x306a('0x2a')](_0x2684b3[_0x306a('0x2b')]);if(_0x2684b3[_0x306a('0x2c')]){delete _0x2684b3[_0x306a('0x2c')];}_0x30d6ad[_0x306a('0x1c')](_0x27b28a)[_0x306a('0x2d')](_0x2684b3);};}exports['index']=function(_0x157730,_0x40d8de){var _0x1eda03={},_0x2b43c5={},_0x4fa919={'count':0x0,'rows':[]};var _0x682a79=_[_0x306a('0x2e')](db[_0x306a('0x2f')][_0x306a('0x30')],function(_0x1b0696){return{'name':_0x1b0696['fieldName'],'type':_0x1b0696['type'][_0x306a('0x31')]};});_0x2b43c5[_0x306a('0x32')]=_['map'](_0x682a79,'name');_0x2b43c5['query']=_['keys'](_0x157730['query']);_0x2b43c5[_0x306a('0x33')]=_[_0x306a('0x34')](_0x2b43c5[_0x306a('0x32')],_0x2b43c5[_0x306a('0x35')]);_0x1eda03[_0x306a('0x36')]=_[_0x306a('0x34')](_0x2b43c5[_0x306a('0x32')],qs[_0x306a('0x37')](_0x157730[_0x306a('0x35')][_0x306a('0x37')]));_0x1eda03[_0x306a('0x36')]=_0x1eda03[_0x306a('0x36')][_0x306a('0x38')]?_0x1eda03['attributes']:_0x2b43c5[_0x306a('0x32')];if(!_0x157730[_0x306a('0x35')][_0x306a('0x39')](_0x306a('0x3a'))){_0x1eda03['limit']=qs['limit'](_0x157730[_0x306a('0x35')][_0x306a('0x21')]);_0x1eda03[_0x306a('0x1f')]=qs['offset'](_0x157730[_0x306a('0x35')][_0x306a('0x1f')]);}_0x1eda03[_0x306a('0x3b')]=qs[_0x306a('0x3c')](_0x157730[_0x306a('0x35')]['sort']);_0x1eda03['where']=qs[_0x306a('0x33')](_[_0x306a('0x3d')](_0x157730[_0x306a('0x35')],_0x2b43c5[_0x306a('0x33')]),_0x682a79);if(_0x157730[_0x306a('0x35')][_0x306a('0x3e')]){_0x1eda03[_0x306a('0x3f')]=_[_0x306a('0x40')](_0x1eda03[_0x306a('0x3f')],{'$or':_['map'](_0x682a79,function(_0x9b849c){if(_0x9b849c[_0x306a('0x41')]!==_0x306a('0x42')){var _0x139a9f={};_0x139a9f[_0x9b849c[_0x306a('0x2c')]]={'$like':'%'+_0x157730[_0x306a('0x35')][_0x306a('0x3e')]+'%'};return _0x139a9f;}})});}_0x1eda03=_[_0x306a('0x40')]({},_0x1eda03,_0x157730[_0x306a('0x43')]);var _0x36119c={'where':_0x1eda03[_0x306a('0x3f')]};return db[_0x306a('0x2f')][_0x306a('0x22')](_0x36119c)[_0x306a('0x28')](function(_0x439b1d){_0x4fa919['count']=_0x439b1d;if(_0x157730[_0x306a('0x35')][_0x306a('0x44')]){_0x1eda03[_0x306a('0x45')]=[{'all':!![]}];}return db[_0x306a('0x2f')]['findAll'](_0x1eda03);})[_0x306a('0x28')](function(_0x46d8cb){_0x4fa919[_0x306a('0x46')]=_0x46d8cb;return _0x4fa919;})[_0x306a('0x28')](respondWithFilteredResult(_0x40d8de,_0x1eda03))[_0x306a('0x47')](handleError(_0x40d8de,null));};exports[_0x306a('0x48')]=function(_0x5f5872,_0x5b7d97){var _0xaac6c0={'raw':![],'where':{'id':_0x5f5872['params']['id']}},_0x2d003a={};_0x2d003a[_0x306a('0x32')]=_[_0x306a('0x49')](db['VoiceQueueReport']['rawAttributes']);_0x2d003a[_0x306a('0x35')]=_[_0x306a('0x49')](_0x5f5872[_0x306a('0x35')]);_0x2d003a['filters']=_['intersection'](_0x2d003a[_0x306a('0x32')],_0x2d003a[_0x306a('0x35')]);_0xaac6c0[_0x306a('0x36')]=_[_0x306a('0x34')](_0x2d003a[_0x306a('0x32')],qs[_0x306a('0x37')](_0x5f5872[_0x306a('0x35')][_0x306a('0x37')]));_0xaac6c0['attributes']=_0xaac6c0[_0x306a('0x36')][_0x306a('0x38')]?_0xaac6c0[_0x306a('0x36')]:_0x2d003a[_0x306a('0x32')];if(_0x5f5872[_0x306a('0x35')][_0x306a('0x44')]){_0xaac6c0[_0x306a('0x45')]=[{'all':!![]}];}_0xaac6c0=_[_0x306a('0x40')]({},_0xaac6c0,_0x5f5872['options']);return db['VoiceQueueReport'][_0x306a('0x4a')](_0xaac6c0)[_0x306a('0x28')](handleEntityNotFound(_0x5b7d97,null))[_0x306a('0x28')](respondWithResult(_0x5b7d97,null))[_0x306a('0x47')](handleError(_0x5b7d97,null));};exports[_0x306a('0x4b')]=function(_0xd2d0a4,_0x57eecc){return db[_0x306a('0x2f')][_0x306a('0x4b')](_0xd2d0a4[_0x306a('0x4c')],{})[_0x306a('0x28')](respondWithResult(_0x57eecc,0xc9))[_0x306a('0x47')](handleError(_0x57eecc,null));};exports[_0x306a('0x27')]=function(_0x393c64,_0x4844c){if(_0x393c64['body']['id']){delete _0x393c64[_0x306a('0x4c')]['id'];}return db[_0x306a('0x2f')][_0x306a('0x4a')]({'where':{'id':_0x393c64[_0x306a('0x4d')]['id']}})[_0x306a('0x28')](handleEntityNotFound(_0x4844c,null))[_0x306a('0x28')](saveUpdates(_0x393c64[_0x306a('0x4c')],null))[_0x306a('0x28')](respondWithResult(_0x4844c,null))['catch'](handleError(_0x4844c,null));};exports[_0x306a('0x29')]=function(_0x3b1918,_0x34860a){return db[_0x306a('0x2f')][_0x306a('0x4a')]({'where':{'id':_0x3b1918['params']['id']}})['then'](handleEntityNotFound(_0x34860a,null))[_0x306a('0x28')](removeEntity(_0x34860a,null))[_0x306a('0x47')](handleError(_0x34860a,null));};exports[_0x306a('0x4e')]=function(_0xa30887,_0x3d17c6){return db[_0x306a('0x2f')][_0x306a('0x4e')]()[_0x306a('0x28')](respondWithResult(_0x3d17c6,null))['catch'](handleError(_0x3d17c6,null));};exports[_0x306a('0x4f')]=function(_0x52b52f,_0x23d137){var _0x44a3a0={},_0x40d0bb={},_0x500d38={'count':0x0,'rows':[]};_0x40d0bb[_0x306a('0x32')]=_[_0x306a('0x49')](db[_0x306a('0x2f')][_0x306a('0x30')]);_0x40d0bb[_0x306a('0x35')]=_[_0x306a('0x49')](_0x52b52f[_0x306a('0x35')]);_0x40d0bb[_0x306a('0x33')]=_[_0x306a('0x34')](_0x40d0bb['model'],_0x40d0bb[_0x306a('0x35')]);_0x44a3a0['attributes']=_[_0x306a('0x34')](_0x40d0bb[_0x306a('0x32')],qs['fields'](_0x52b52f[_0x306a('0x35')][_0x306a('0x37')]));_0x44a3a0[_0x306a('0x36')]=_0x44a3a0['attributes'][_0x306a('0x38')]?_0x44a3a0[_0x306a('0x36')]:_0x40d0bb['model'];if(!_0x52b52f['query'][_0x306a('0x39')](_0x306a('0x3a'))){_0x44a3a0[_0x306a('0x21')]=qs[_0x306a('0x21')](_0x52b52f['query'][_0x306a('0x21')]);_0x44a3a0[_0x306a('0x1f')]=qs['offset'](_0x52b52f['query'][_0x306a('0x1f')]);}_0x44a3a0[_0x306a('0x3b')]=qs[_0x306a('0x3c')](_0x52b52f[_0x306a('0x35')][_0x306a('0x3c')]);_0x44a3a0[_0x306a('0x3f')]=qs['filters'](_[_0x306a('0x3d')](_0x52b52f[_0x306a('0x35')],_0x40d0bb[_0x306a('0x33')]));if(_0x52b52f[_0x306a('0x35')][_0x306a('0x3e')]){_0x44a3a0['where']=_[_0x306a('0x40')](_0x44a3a0[_0x306a('0x3f')],{'$or':_[_0x306a('0x2e')](_0x44a3a0[_0x306a('0x36')],function(_0x46545c){var _0x329617={};_0x329617[_0x46545c]={'$like':'%'+_0x52b52f[_0x306a('0x35')]['filter']+'%'};return _0x329617;})});}_0x44a3a0=_[_0x306a('0x40')]({},_0x44a3a0,_0x52b52f['options']);var _0x22c3bb={'where':_0x44a3a0[_0x306a('0x3f')]};return db[_0x306a('0x2f')][_0x306a('0x22')](_0x22c3bb)[_0x306a('0x28')](function(_0x3745b7){_0x500d38[_0x306a('0x22')]=_0x3745b7;if(_0x52b52f[_0x306a('0x35')][_0x306a('0x44')]){_0x44a3a0[_0x306a('0x45')]=[{'all':!![]}];}return db[_0x306a('0x2f')]['findAll'](_0x44a3a0);})[_0x306a('0x28')](function(_0x5b1ec0){_0x500d38[_0x306a('0x46')]=_0x5b1ec0;return _0x500d38;})['then'](respondWithFilteredResult(_0x23d137,_0x44a3a0,_0x306a('0x4f')))[_0x306a('0x47')](handleError(_0x23d137,null,_0x306a('0x4f')));}; \ No newline at end of file +var _0x54b3=['options','find','create','body','update','params','describe','findAll','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','name','send','map','VoiceQueueReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','rawAttributes'];(function(_0x1f8481,_0x228fae){var _0x2f41ae=function(_0x323c4c){while(--_0x323c4c){_0x1f8481['push'](_0x1f8481['shift']());}};_0x2f41ae(++_0x228fae);}(_0x54b3,0x194));var _0x354b=function(_0x1c7369,_0x4598e8){_0x1c7369=_0x1c7369-0x0;var _0x405117=_0x54b3[_0x1c7369];return _0x405117;};'use strict';var emlformat=require(_0x354b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x354b('0x1'));var jsonpatch=require(_0x354b('0x2'));var rp=require(_0x354b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x354b('0x4'));var util=require(_0x354b('0x5'));var path=require(_0x354b('0x6'));var sox=require(_0x354b('0x7'));var csv=require(_0x354b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354b('0x9'));var _=require(_0x354b('0xa'));var squel=require(_0x354b('0xb'));var crypto=require(_0x354b('0xc'));var jsforce=require(_0x354b('0xd'));var deskjs=require(_0x354b('0xe'));var toCsv=require(_0x354b('0x8'));var querystring=require('querystring');var Papa=require(_0x354b('0xf'));var Redis=require(_0x354b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x354b('0x11'));var hardwareService=require(_0x354b('0x12'));var logger=require(_0x354b('0x13'))(_0x354b('0x14'));var utils=require(_0x354b('0x15'));var config=require(_0x354b('0x16'));var licenseUtil=require(_0x354b('0x17'));var db=require(_0x354b('0x18'))['db'];config[_0x354b('0x19')]=_[_0x354b('0x1a')](config[_0x354b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x354b('0x1b'))(new Redis(config['redis']));require(_0x354b('0x1c'))['register'](socket);function respondWithStatusCode(_0x240a84,_0x427c15){_0x427c15=_0x427c15||0xcc;return function(_0x1b24be){if(_0x1b24be){return _0x240a84[_0x354b('0x1d')](_0x427c15);}return _0x240a84[_0x354b('0x1e')](_0x427c15)[_0x354b('0x1f')]();};}function respondWithResult(_0x3ec8c8,_0x4632dd){_0x4632dd=_0x4632dd||0xc8;return function(_0x316ebf){if(_0x316ebf){return _0x3ec8c8[_0x354b('0x1e')](_0x4632dd)[_0x354b('0x20')](_0x316ebf);}};}function respondWithFilteredResult(_0xa0ff28,_0x3c43fd){return function(_0x1aae2f){if(_0x1aae2f){var _0x50e54c=typeof _0x3c43fd['offset']==='undefined'&&typeof _0x3c43fd['limit']==='undefined';var _0x3a8bfa=_0x1aae2f[_0x354b('0x21')];var _0x11a374=_0x50e54c?0x0:_0x3c43fd['offset'];var _0x19245a=_0x50e54c?_0x1aae2f[_0x354b('0x21')]:_0x3c43fd[_0x354b('0x22')]+_0x3c43fd['limit'];var _0x268927;if(_0x19245a>=_0x3a8bfa){_0x19245a=_0x3a8bfa;_0x268927=0xc8;}else{_0x268927=0xce;}_0xa0ff28[_0x354b('0x1e')](_0x268927);return _0xa0ff28[_0x354b('0x23')](_0x354b('0x24'),_0x11a374+'-'+_0x19245a+'/'+_0x3a8bfa)[_0x354b('0x20')](_0x1aae2f);}return null;};}function patchUpdates(_0x14d95d){return function(_0x2d9532){try{jsonpatch[_0x354b('0x25')](_0x2d9532,_0x14d95d,!![]);}catch(_0x2da4f2){return BPromise['reject'](_0x2da4f2);}return _0x2d9532[_0x354b('0x26')]();};}function saveUpdates(_0xef2aec,_0x8a20e6){return function(_0x4bc76d){if(_0x4bc76d){return _0x4bc76d['update'](_0xef2aec)[_0x354b('0x27')](function(_0x35c31f){return _0x35c31f;});}return null;};}function removeEntity(_0x4ecd7a,_0x3a4be7){return function(_0x2efe10){if(_0x2efe10){return _0x2efe10[_0x354b('0x28')]()[_0x354b('0x27')](function(){_0x4ecd7a[_0x354b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x142fac,_0xdb2dd8){return function(_0x1d59f1){if(!_0x1d59f1){_0x142fac[_0x354b('0x1d')](0x194);}return _0x1d59f1;};}function handleError(_0x40bef6,_0x139339){_0x139339=_0x139339||0x1f4;return function(_0x304048){logger['error'](_0x304048['stack']);if(_0x304048[_0x354b('0x29')]){delete _0x304048['name'];}_0x40bef6[_0x354b('0x1e')](_0x139339)[_0x354b('0x2a')](_0x304048);};}exports['index']=function(_0x37f31f,_0x4bc4d6){var _0x3ba1be={},_0x517c5e={},_0x422de3={'count':0x0,'rows':[]};var _0x49af9b=_[_0x354b('0x2b')](db[_0x354b('0x2c')]['rawAttributes'],function(_0x28ea71){return{'name':_0x28ea71[_0x354b('0x2d')],'type':_0x28ea71['type']['key']};});_0x517c5e['model']=_['map'](_0x49af9b,'name');_0x517c5e[_0x354b('0x2e')]=_[_0x354b('0x2f')](_0x37f31f['query']);_0x517c5e[_0x354b('0x30')]=_[_0x354b('0x31')](_0x517c5e[_0x354b('0x32')],_0x517c5e['query']);_0x3ba1be[_0x354b('0x33')]=_[_0x354b('0x31')](_0x517c5e[_0x354b('0x32')],qs[_0x354b('0x34')](_0x37f31f[_0x354b('0x2e')]['fields']));_0x3ba1be[_0x354b('0x33')]=_0x3ba1be[_0x354b('0x33')][_0x354b('0x35')]?_0x3ba1be['attributes']:_0x517c5e[_0x354b('0x32')];if(!_0x37f31f[_0x354b('0x2e')][_0x354b('0x36')](_0x354b('0x37'))){_0x3ba1be[_0x354b('0x38')]=qs[_0x354b('0x38')](_0x37f31f[_0x354b('0x2e')][_0x354b('0x38')]);_0x3ba1be[_0x354b('0x22')]=qs[_0x354b('0x22')](_0x37f31f[_0x354b('0x2e')][_0x354b('0x22')]);}_0x3ba1be[_0x354b('0x39')]=qs[_0x354b('0x3a')](_0x37f31f[_0x354b('0x2e')][_0x354b('0x3a')]);_0x3ba1be[_0x354b('0x3b')]=qs[_0x354b('0x30')](_[_0x354b('0x3c')](_0x37f31f[_0x354b('0x2e')],_0x517c5e[_0x354b('0x30')]),_0x49af9b);if(_0x37f31f['query']['filter']){_0x3ba1be['where']=_[_0x354b('0x3d')](_0x3ba1be['where'],{'$or':_[_0x354b('0x2b')](_0x49af9b,function(_0x1481fe){if(_0x1481fe[_0x354b('0x3e')]!=='VIRTUAL'){var _0x118325={};_0x118325[_0x1481fe[_0x354b('0x29')]]={'$like':'%'+_0x37f31f[_0x354b('0x2e')][_0x354b('0x3f')]+'%'};return _0x118325;}})});}_0x3ba1be=_['merge']({},_0x3ba1be,_0x37f31f['options']);var _0xe25d18={'where':_0x3ba1be['where']};return db[_0x354b('0x2c')]['count'](_0xe25d18)[_0x354b('0x27')](function(_0xb86713){_0x422de3[_0x354b('0x21')]=_0xb86713;if(_0x37f31f[_0x354b('0x2e')][_0x354b('0x40')]){_0x3ba1be[_0x354b('0x41')]=[{'all':!![]}];}return db[_0x354b('0x2c')]['findAll'](_0x3ba1be);})['then'](function(_0x73e394){_0x422de3[_0x354b('0x42')]=_0x73e394;return _0x422de3;})[_0x354b('0x27')](respondWithFilteredResult(_0x4bc4d6,_0x3ba1be))[_0x354b('0x43')](handleError(_0x4bc4d6,null));};exports[_0x354b('0x44')]=function(_0x16788f,_0x36cbc7){var _0x2b9dcc={'raw':![],'where':{'id':_0x16788f['params']['id']}},_0x356193={};_0x356193['model']=_[_0x354b('0x2f')](db['VoiceQueueReport'][_0x354b('0x45')]);_0x356193[_0x354b('0x2e')]=_[_0x354b('0x2f')](_0x16788f['query']);_0x356193[_0x354b('0x30')]=_[_0x354b('0x31')](_0x356193[_0x354b('0x32')],_0x356193[_0x354b('0x2e')]);_0x2b9dcc[_0x354b('0x33')]=_[_0x354b('0x31')](_0x356193[_0x354b('0x32')],qs[_0x354b('0x34')](_0x16788f[_0x354b('0x2e')][_0x354b('0x34')]));_0x2b9dcc[_0x354b('0x33')]=_0x2b9dcc[_0x354b('0x33')]['length']?_0x2b9dcc[_0x354b('0x33')]:_0x356193[_0x354b('0x32')];if(_0x16788f[_0x354b('0x2e')][_0x354b('0x40')]){_0x2b9dcc[_0x354b('0x41')]=[{'all':!![]}];}_0x2b9dcc=_[_0x354b('0x3d')]({},_0x2b9dcc,_0x16788f[_0x354b('0x46')]);return db[_0x354b('0x2c')][_0x354b('0x47')](_0x2b9dcc)[_0x354b('0x27')](handleEntityNotFound(_0x36cbc7,null))[_0x354b('0x27')](respondWithResult(_0x36cbc7,null))[_0x354b('0x43')](handleError(_0x36cbc7,null));};exports['create']=function(_0x22800a,_0x3a4831){return db[_0x354b('0x2c')][_0x354b('0x48')](_0x22800a[_0x354b('0x49')],{})[_0x354b('0x27')](respondWithResult(_0x3a4831,0xc9))[_0x354b('0x43')](handleError(_0x3a4831,null));};exports[_0x354b('0x4a')]=function(_0x27c4d1,_0x7ab84){if(_0x27c4d1[_0x354b('0x49')]['id']){delete _0x27c4d1['body']['id'];}return db[_0x354b('0x2c')][_0x354b('0x47')]({'where':{'id':_0x27c4d1[_0x354b('0x4b')]['id']}})[_0x354b('0x27')](handleEntityNotFound(_0x7ab84,null))['then'](saveUpdates(_0x27c4d1[_0x354b('0x49')],null))[_0x354b('0x27')](respondWithResult(_0x7ab84,null))[_0x354b('0x43')](handleError(_0x7ab84,null));};exports[_0x354b('0x28')]=function(_0x31861e,_0x57de0f){return db[_0x354b('0x2c')][_0x354b('0x47')]({'where':{'id':_0x31861e[_0x354b('0x4b')]['id']}})[_0x354b('0x27')](handleEntityNotFound(_0x57de0f,null))[_0x354b('0x27')](removeEntity(_0x57de0f,null))[_0x354b('0x43')](handleError(_0x57de0f,null));};exports[_0x354b('0x4c')]=function(_0x307ac7,_0x23386e){return db[_0x354b('0x2c')][_0x354b('0x4c')]()[_0x354b('0x27')](respondWithResult(_0x23386e,null))[_0x354b('0x43')](handleError(_0x23386e,null));};exports['getVoiceQueuesReport']=function(_0x17e5a4,_0x2eeb41){var _0x582d95={},_0x339577={},_0x1cb98a={'count':0x0,'rows':[]};_0x339577[_0x354b('0x32')]=_[_0x354b('0x2f')](db[_0x354b('0x2c')][_0x354b('0x45')]);_0x339577[_0x354b('0x2e')]=_[_0x354b('0x2f')](_0x17e5a4[_0x354b('0x2e')]);_0x339577[_0x354b('0x30')]=_[_0x354b('0x31')](_0x339577['model'],_0x339577['query']);_0x582d95[_0x354b('0x33')]=_[_0x354b('0x31')](_0x339577[_0x354b('0x32')],qs['fields'](_0x17e5a4['query'][_0x354b('0x34')]));_0x582d95[_0x354b('0x33')]=_0x582d95['attributes'][_0x354b('0x35')]?_0x582d95[_0x354b('0x33')]:_0x339577['model'];if(!_0x17e5a4[_0x354b('0x2e')][_0x354b('0x36')](_0x354b('0x37'))){_0x582d95[_0x354b('0x38')]=qs['limit'](_0x17e5a4[_0x354b('0x2e')][_0x354b('0x38')]);_0x582d95[_0x354b('0x22')]=qs['offset'](_0x17e5a4['query'][_0x354b('0x22')]);}_0x582d95[_0x354b('0x39')]=qs[_0x354b('0x3a')](_0x17e5a4['query'][_0x354b('0x3a')]);_0x582d95[_0x354b('0x3b')]=qs[_0x354b('0x30')](_[_0x354b('0x3c')](_0x17e5a4[_0x354b('0x2e')],_0x339577[_0x354b('0x30')]));if(_0x17e5a4[_0x354b('0x2e')][_0x354b('0x3f')]){_0x582d95[_0x354b('0x3b')]=_[_0x354b('0x3d')](_0x582d95[_0x354b('0x3b')],{'$or':_[_0x354b('0x2b')](_0x582d95[_0x354b('0x33')],function(_0x171dd0){var _0x3fc592={};_0x3fc592[_0x171dd0]={'$like':'%'+_0x17e5a4[_0x354b('0x2e')][_0x354b('0x3f')]+'%'};return _0x3fc592;})});}_0x582d95=_[_0x354b('0x3d')]({},_0x582d95,_0x17e5a4['options']);var _0x13a994={'where':_0x582d95[_0x354b('0x3b')]};return db['VoiceQueueReport'][_0x354b('0x21')](_0x13a994)['then'](function(_0x5569e8){_0x1cb98a[_0x354b('0x21')]=_0x5569e8;if(_0x17e5a4['query'][_0x354b('0x40')]){_0x582d95['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x354b('0x4d')](_0x582d95);})[_0x354b('0x27')](function(_0x19561a){_0x1cb98a[_0x354b('0x42')]=_0x19561a;return _0x1cb98a;})[_0x354b('0x27')](respondWithFilteredResult(_0x2eeb41,_0x582d95,'getVoiceQueuesReport'))['catch'](handleError(_0x2eeb41,null,_0x354b('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0b2962c..debf902 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 _0xf873=['setMaxListeners','save','update','remove','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x3aa6d4,_0x58a363){var _0x2bce8b=function(_0x104c5d){while(--_0x104c5d){_0x3aa6d4['push'](_0x3aa6d4['shift']());}};_0x2bce8b(++_0x58a363);}(_0xf873,0x177));var _0x3f87=function(_0x409b66,_0x2a4f26){_0x409b66=_0x409b66-0x0;var _0x154127=_0xf873[_0x409b66];return _0x154127;};'use strict';var EventEmitter=require(_0x3f87('0x0'));var VoiceQueueReport=require(_0x3f87('0x1'))['db'][_0x3f87('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3f87('0x3')](0x0);var events={'afterCreate':_0x3f87('0x4'),'afterUpdate':_0x3f87('0x5'),'afterDestroy':_0x3f87('0x6')};function emitEvent(_0x3a8b54){return function(_0x3b5868,_0x5b92d1,_0x3f14e0){VoiceQueueReportEvents['emit'](_0x3a8b54+':'+_0x3b5868['id'],_0x3b5868);VoiceQueueReportEvents['emit'](_0x3a8b54,_0x3b5868);_0x3f14e0(null);};}for(var e in events){if(events[_0x3f87('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x3f87('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9d5e=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x9d5e,0x6c));var _0xe9d5=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x9d5e[_0x42bafd];return _0x2ed705;};'use strict';var EventEmitter=require(_0xe9d5('0x0'));var VoiceQueueReport=require(_0xe9d5('0x1'))['db'][_0xe9d5('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe9d5('0x3')](0x0);var events={'afterCreate':_0xe9d5('0x4'),'afterUpdate':_0xe9d5('0x5'),'afterDestroy':_0xe9d5('0x6')};function emitEvent(_0x34eed6){return function(_0x34428e,_0x35b052,_0xb7c0b9){VoiceQueueReportEvents[_0xe9d5('0x7')](_0x34eed6+':'+_0x34428e['id'],_0x34428e);VoiceQueueReportEvents[_0xe9d5('0x7')](_0x34eed6,_0x34428e);_0xb7c0b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xe9d5('0x8')](e,emitEvent(event));}}module[_0xe9d5('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 54d10fd..d35fe7a 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 _0x166d=['rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0x166d,0x1ab));var _0xd166=function(_0x24fa1d,_0x44709e){_0x24fa1d=_0x24fa1d-0x0;var _0x480157=_0x166d[_0x24fa1d];return _0x480157;};'use strict';var _=require(_0xd166('0x0'));var util=require(_0xd166('0x1'));var logger=require(_0xd166('0x2'))(_0xd166('0x3'));var moment=require(_0xd166('0x4'));var BPromise=require(_0xd166('0x5'));var rp=require(_0xd166('0x6'));var fs=require('fs');var path=require(_0xd166('0x7'));var rimraf=require(_0xd166('0x8'));var config=require(_0xd166('0x9'));var attributes=require(_0xd166('0xa'));module['exports']=function(_0x48c6bf,_0x586491){return _0x48c6bf[_0xd166('0xb')](_0xd166('0xc'),attributes,{'tableName':_0xd166('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xd166('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x214a=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x214a,0xd7));var _0xa214=function(_0x3e050c,_0x24897b){_0x3e050c=_0x3e050c-0x0;var _0x297e2d=_0x214a[_0x3e050c];return _0x297e2d;};'use strict';var _=require('lodash');var util=require(_0xa214('0x0'));var logger=require(_0xa214('0x1'))('api');var moment=require(_0xa214('0x2'));var BPromise=require(_0xa214('0x3'));var rp=require(_0xa214('0x4'));var fs=require('fs');var path=require(_0xa214('0x5'));var rimraf=require(_0xa214('0x6'));var config=require(_0xa214('0x7'));var attributes=require(_0xa214('0x8'));module[_0xa214('0x9')]=function(_0x2ec7d4,_0x286d36){return _0x2ec7d4['define'](_0xa214('0xa'),attributes,{'tableName':_0xa214('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa214('0xc')]},{'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 245ab63..f04eb72 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 _0x121f=['UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','then','body','debug','CreateVoiceQueueReport'];(function(_0x37bcec,_0x4aaf70){var _0x56c135=function(_0x3e442d){while(--_0x3e442d){_0x37bcec['push'](_0x37bcec['shift']());}};_0x56c135(++_0x4aaf70);}(_0x121f,0x1ee));var _0xf121=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x121f[_0x1f6f84];return _0x177f40;};'use strict';var _=require(_0xf121('0x0'));var util=require(_0xf121('0x1'));var moment=require(_0xf121('0x2'));var BPromise=require(_0xf121('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf121('0x4'));var db=require(_0xf121('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf121('0x6'));var jayson=require(_0xf121('0x7'));var client=jayson['client'][_0xf121('0x8')]({'port':0x232a});config[_0xf121('0x9')]=_[_0xf121('0xa')](config[_0xf121('0x9')],{'host':_0xf121('0xb'),'port':0x18eb});var socket=require(_0xf121('0xc'))(new Redis(config[_0xf121('0x9')]));require(_0xf121('0xd'))[_0xf121('0xe')](socket);function respondWithRpcPromise(_0x3abfe6,_0x132489,_0x3fba11){return new BPromise(function(_0x56663b,_0x1e6e03){return client['request'](_0x3abfe6,_0x3fba11)['then'](function(_0xcdaafd){logger[_0xf121('0xf')](_0xf121('0x10'),_0x132489,_0xf121('0x11'));logger['debug'](_0xf121('0x12'),_0x132489,_0xf121('0x11'),JSON[_0xf121('0x13')](_0xcdaafd));if(_0xcdaafd[_0xf121('0x14')]){if(_0xcdaafd[_0xf121('0x14')][_0xf121('0x15')]===0x1f4){logger['error'](_0xf121('0x10'),_0x132489,_0xcdaafd['error']['message']);return _0x1e6e03(_0xcdaafd[_0xf121('0x14')][_0xf121('0x16')]);}logger[_0xf121('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x132489,_0xcdaafd[_0xf121('0x14')][_0xf121('0x16')]);return _0x56663b(_0xcdaafd['error'][_0xf121('0x16')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x132489,_0xf121('0x11'));_0x56663b(_0xcdaafd[_0xf121('0x17')][_0xf121('0x16')]);}})[_0xf121('0x18')](function(_0x22d00a){logger[_0xf121('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x132489,_0x22d00a);_0x1e6e03(_0x22d00a);});});}exports[_0xf121('0x19')]=function(_0x3e9a54){var _0x581f11=this;return new Promise(function(_0x13b755,_0x28b160){return db[_0xf121('0x1a')][_0xf121('0x1b')]({'raw':_0x3e9a54['options']?_0x3e9a54[_0xf121('0x1c')][_0xf121('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e9a54[_0xf121('0x1c')]?_0x3e9a54[_0xf121('0x1c')][_0xf121('0x1e')]||null:null,'attributes':_0x3e9a54[_0xf121('0x1c')]?_0x3e9a54['options'][_0xf121('0x1f')]||null:null,'limit':_0x3e9a54['options']?_0x3e9a54[_0xf121('0x1c')]['limit']||null:null,'include':_0x3e9a54['options']?_0x3e9a54['options'][_0xf121('0x20')]?_[_0xf121('0x21')](_0x3e9a54[_0xf121('0x1c')]['include'],function(_0x4bec5c){return{'model':db[_0x4bec5c[_0xf121('0x22')]],'as':_0x4bec5c['as'],'attributes':_0x4bec5c[_0xf121('0x1f')],'include':_0x4bec5c[_0xf121('0x20')]?_['map'](_0x4bec5c[_0xf121('0x20')],function(_0x43a3bd){return{'model':db[_0x43a3bd[_0xf121('0x22')]],'as':_0x43a3bd['as'],'attributes':_0x43a3bd[_0xf121('0x1f')],'include':_0x43a3bd[_0xf121('0x20')]?_[_0xf121('0x21')](_0x43a3bd[_0xf121('0x20')],function(_0x15b9b4){return{'model':db[_0x15b9b4[_0xf121('0x22')]],'as':_0x15b9b4['as'],'attributes':_0x15b9b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xf121('0x23')](function(_0x285010){logger[_0xf121('0xf')](_0xf121('0x19'),_0x3e9a54);logger['debug'](_0xf121('0x19'),_0x3e9a54,JSON[_0xf121('0x13')](_0x285010));_0x13b755(_0x285010);})[_0xf121('0x18')](function(_0x5705e2){logger[_0xf121('0x14')](_0xf121('0x19'),_0x5705e2['message'],_0x3e9a54);_0x28b160(_0x581f11['error'](0x1f4,_0x5705e2['message']));});});};exports['CreateVoiceQueueReport']=function(_0x50c9da){var _0x25dd57=this;return new Promise(function(_0x54c52d,_0xb2e1a7){return db['VoiceQueueReport']['create'](_0x50c9da[_0xf121('0x24')],{'raw':_0x50c9da['options']?_0x50c9da[_0xf121('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2a7d75){logger[_0xf121('0xf')]('CreateVoiceQueueReport',_0x50c9da);logger[_0xf121('0x25')](_0xf121('0x26'),_0x50c9da,JSON[_0xf121('0x13')](_0x2a7d75));_0x54c52d(_0x2a7d75);})['catch'](function(_0x4bf187){logger[_0xf121('0x14')](_0xf121('0x26'),_0x4bf187[_0xf121('0x16')],_0x50c9da);_0xb2e1a7(_0x25dd57[_0xf121('0x14')](0x1f4,_0x4bf187[_0xf121('0x16')]));});});};exports[_0xf121('0x27')]=function(_0x389252){var _0x444858=this;return new Promise(function(_0x127dec,_0x3c07a6){return db[_0xf121('0x1a')][_0xf121('0x28')](_0x389252[_0xf121('0x24')],{'raw':_0x389252[_0xf121('0x1c')]?_0x389252[_0xf121('0x1c')][_0xf121('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389252[_0xf121('0x1c')]?_0x389252[_0xf121('0x1c')][_0xf121('0x1e')]||null:null,'attributes':_0x389252['options']?_0x389252[_0xf121('0x1c')][_0xf121('0x1f')]||null:null,'limit':_0x389252[_0xf121('0x1c')]?_0x389252[_0xf121('0x1c')]['limit']||null:null})[_0xf121('0x23')](function(_0x2fb581){logger[_0xf121('0xf')](_0xf121('0x27'),_0x389252);logger['debug'](_0xf121('0x27'),_0x389252,JSON[_0xf121('0x13')](_0x2fb581));_0x127dec(_0x2fb581);})[_0xf121('0x18')](function(_0x1eabe4){logger['error'](_0xf121('0x27'),_0x1eabe4[_0xf121('0x16')],_0x389252);_0x3c07a6(_0x444858[_0xf121('0x14')](0x1f4,_0x1eabe4[_0xf121('0x16')]));});});}; \ No newline at end of file +var _0x1979=['model','GetVoiceQueueReport','CreateVoiceQueueReport','create','raw','update','body','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueueReport','findAll','options','where','attributes','limit','map','include'];(function(_0xfac14a,_0x41c58f){var _0x5326d2=function(_0x5271be){while(--_0x5271be){_0xfac14a['push'](_0xfac14a['shift']());}};_0x5326d2(++_0x41c58f);}(_0x1979,0x104));var _0x9197=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x1979[_0x34bf97];return _0x292719;};'use strict';var _=require(_0x9197('0x0'));var util=require(_0x9197('0x1'));var moment=require('moment');var BPromise=require(_0x9197('0x2'));var rs=require(_0x9197('0x3'));var fs=require('fs');var Redis=require(_0x9197('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9197('0x5'));var logger=require('../../config/logger')(_0x9197('0x6'));var config=require(_0x9197('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9197('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9197('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9197('0xa'))(new Redis(config[_0x9197('0xb')]));require(_0x9197('0xc'))[_0x9197('0xd')](socket);function respondWithRpcPromise(_0x68a0e8,_0x370574,_0x166c62){return new BPromise(function(_0x4bdd9a,_0x6e268a){return client[_0x9197('0xe')](_0x68a0e8,_0x166c62)[_0x9197('0xf')](function(_0xbf5f9d){logger[_0x9197('0x10')](_0x9197('0x11'),_0x370574,_0x9197('0x12'));logger[_0x9197('0x13')](_0x9197('0x14'),_0x370574,_0x9197('0x12'),JSON[_0x9197('0x15')](_0xbf5f9d));if(_0xbf5f9d[_0x9197('0x16')]){if(_0xbf5f9d[_0x9197('0x16')][_0x9197('0x17')]===0x1f4){logger[_0x9197('0x16')](_0x9197('0x11'),_0x370574,_0xbf5f9d[_0x9197('0x16')][_0x9197('0x18')]);return _0x6e268a(_0xbf5f9d[_0x9197('0x16')][_0x9197('0x18')]);}logger[_0x9197('0x16')](_0x9197('0x11'),_0x370574,_0xbf5f9d[_0x9197('0x16')][_0x9197('0x18')]);return _0x4bdd9a(_0xbf5f9d['error'][_0x9197('0x18')]);}else{logger[_0x9197('0x10')](_0x9197('0x11'),_0x370574,_0x9197('0x12'));_0x4bdd9a(_0xbf5f9d['result']['message']);}})[_0x9197('0x19')](function(_0x563d4a){logger[_0x9197('0x16')](_0x9197('0x11'),_0x370574,_0x563d4a);_0x6e268a(_0x563d4a);});});}exports['GetVoiceQueueReport']=function(_0x142343){var _0x4bc63d=this;return new Promise(function(_0x120d5c,_0x23e17e){return db[_0x9197('0x1a')][_0x9197('0x1b')]({'raw':_0x142343[_0x9197('0x1c')]?_0x142343[_0x9197('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x142343[_0x9197('0x1c')]?_0x142343[_0x9197('0x1c')][_0x9197('0x1d')]||null:null,'attributes':_0x142343[_0x9197('0x1c')]?_0x142343['options'][_0x9197('0x1e')]||null:null,'limit':_0x142343[_0x9197('0x1c')]?_0x142343[_0x9197('0x1c')][_0x9197('0x1f')]||null:null,'include':_0x142343[_0x9197('0x1c')]?_0x142343['options']['include']?_[_0x9197('0x20')](_0x142343[_0x9197('0x1c')][_0x9197('0x21')],function(_0x543e17){return{'model':db[_0x543e17[_0x9197('0x22')]],'as':_0x543e17['as'],'attributes':_0x543e17[_0x9197('0x1e')],'include':_0x543e17[_0x9197('0x21')]?_['map'](_0x543e17[_0x9197('0x21')],function(_0x3326fc){return{'model':db[_0x3326fc[_0x9197('0x22')]],'as':_0x3326fc['as'],'attributes':_0x3326fc[_0x9197('0x1e')],'include':_0x3326fc[_0x9197('0x21')]?_[_0x9197('0x20')](_0x3326fc[_0x9197('0x21')],function(_0xb30267){return{'model':db[_0xb30267['model']],'as':_0xb30267['as'],'attributes':_0xb30267[_0x9197('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9197('0xf')](function(_0x36aef5){logger[_0x9197('0x10')](_0x9197('0x23'),_0x142343);logger[_0x9197('0x13')](_0x9197('0x23'),_0x142343,JSON[_0x9197('0x15')](_0x36aef5));_0x120d5c(_0x36aef5);})[_0x9197('0x19')](function(_0xf4622f){logger[_0x9197('0x16')](_0x9197('0x23'),_0xf4622f['message'],_0x142343);_0x23e17e(_0x4bc63d[_0x9197('0x16')](0x1f4,_0xf4622f[_0x9197('0x18')]));});});};exports[_0x9197('0x24')]=function(_0x5b5edc){var _0x5606a0=this;return new Promise(function(_0x5ccf53,_0x54af23){return db['VoiceQueueReport'][_0x9197('0x25')](_0x5b5edc['body'],{'raw':_0x5b5edc[_0x9197('0x1c')]?_0x5b5edc[_0x9197('0x1c')][_0x9197('0x26')]===undefined?!![]:![]:!![]})[_0x9197('0xf')](function(_0x31f12e){logger[_0x9197('0x10')](_0x9197('0x24'),_0x5b5edc);logger[_0x9197('0x13')](_0x9197('0x24'),_0x5b5edc,JSON[_0x9197('0x15')](_0x31f12e));_0x5ccf53(_0x31f12e);})[_0x9197('0x19')](function(_0x42b2dd){logger[_0x9197('0x16')](_0x9197('0x24'),_0x42b2dd[_0x9197('0x18')],_0x5b5edc);_0x54af23(_0x5606a0['error'](0x1f4,_0x42b2dd[_0x9197('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x57246b){var _0x56df63=this;return new Promise(function(_0x224013,_0x2df832){return db['VoiceQueueReport'][_0x9197('0x27')](_0x57246b[_0x9197('0x28')],{'raw':_0x57246b[_0x9197('0x1c')]?_0x57246b[_0x9197('0x1c')][_0x9197('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57246b[_0x9197('0x1c')]?_0x57246b[_0x9197('0x1c')][_0x9197('0x1d')]||null:null,'attributes':_0x57246b[_0x9197('0x1c')]?_0x57246b[_0x9197('0x1c')][_0x9197('0x1e')]||null:null,'limit':_0x57246b[_0x9197('0x1c')]?_0x57246b[_0x9197('0x1c')][_0x9197('0x1f')]||null:null})[_0x9197('0xf')](function(_0x2bd41f){logger[_0x9197('0x10')](_0x9197('0x29'),_0x57246b);logger['debug']('UpdateVoiceQueueReport',_0x57246b,JSON['stringify'](_0x2bd41f));_0x224013(_0x2bd41f);})[_0x9197('0x19')](function(_0xe6d20c){logger[_0x9197('0x16')](_0x9197('0x29'),_0xe6d20c['message'],_0x57246b);_0x2df832(_0x56df63[_0x9197('0x16')](0x1f4,_0xe6d20c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 49d2b96..d136d36 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 _0x102b=['length','voiceQueueReport:','save','update','emit','removeListener'];(function(_0x111214,_0x5ea70b){var _0x3e1265=function(_0x175418){while(--_0x175418){_0x111214['push'](_0x111214['shift']());}};_0x3e1265(++_0x5ea70b);}(_0x102b,0x1be));var _0xb102=function(_0x415f9a,_0x2f319e){_0x415f9a=_0x415f9a-0x0;var _0x1214f1=_0x102b[_0x415f9a];return _0x1214f1;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xb102('0x0'),'remove',_0xb102('0x1')];function createListener(_0x3e1311,_0x42172c){return function(_0x1be904){_0x42172c[_0xb102('0x2')](_0x3e1311,_0x1be904);};}function removeListener(_0x1402fb,_0x19e35d){return function(){VoiceQueueReportEvents[_0xb102('0x3')](_0x1402fb,_0x19e35d);};}exports['register']=function(_0x3325b7){for(var _0x370baa=0x0,_0xd131eb=events[_0xb102('0x4')];_0x370baa<_0xd131eb;_0x370baa++){var _0x1ee0c0=events[_0x370baa];var _0x5879bb=createListener(_0xb102('0x5')+_0x1ee0c0,_0x3325b7);VoiceQueueReportEvents['on'](_0x1ee0c0,_0x5879bb);}}; \ No newline at end of file +var _0x48c6=['removeListener','register','length','./voiceQueueReport.events','save','update'];(function(_0x34fba1,_0x3b1e8d){var _0xab750c=function(_0x570ad8){while(--_0x570ad8){_0x34fba1['push'](_0x34fba1['shift']());}};_0xab750c(++_0x3b1e8d);}(_0x48c6,0x17d));var _0x648c=function(_0x1ffe31,_0x39bb28){_0x1ffe31=_0x1ffe31-0x0;var _0x3ed24b=_0x48c6[_0x1ffe31];return _0x3ed24b;};'use strict';var VoiceQueueReportEvents=require(_0x648c('0x0'));var events=[_0x648c('0x1'),'remove',_0x648c('0x2')];function createListener(_0x23f4c8,_0x5aca90){return function(_0x45073a){_0x5aca90['emit'](_0x23f4c8,_0x45073a);};}function removeListener(_0x2c039c,_0x2346d2){return function(){VoiceQueueReportEvents[_0x648c('0x3')](_0x2c039c,_0x2346d2);};}exports[_0x648c('0x4')]=function(_0x5eab0d){for(var _0x5d7b66=0x0,_0x486379=events[_0x648c('0x5')];_0x5d7b66<_0x486379;_0x5d7b66++){var _0x349b2e=events[_0x5d7b66];var _0x21cdfc=createListener('voiceQueueReport:'+_0x349b2e,_0x5eab0d);VoiceQueueReportEvents['on'](_0x349b2e,_0x21cdfc);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8943a36..ae6732f 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 _0x25f0=['get','index','isAuthenticated','show','post','put','/:id','exports','multer','util','Router','../../components/auth/service','../../config/environment'];(function(_0x4bf485,_0xa8db09){var _0xdfb631=function(_0x401b08){while(--_0x401b08){_0x4bf485['push'](_0x4bf485['shift']());}};_0xdfb631(++_0xa8db09);}(_0x25f0,0x10c));var _0x025f=function(_0x1d32c7,_0x4da15b){_0x1d32c7=_0x1d32c7-0x0;var _0x18d5b4=_0x25f0[_0x1d32c7];return _0x18d5b4;};'use strict';var multer=require(_0x025f('0x0'));var util=require(_0x025f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x025f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x025f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x025f('0x4'));var controller=require('./voiceQueuesLog.controller');router[_0x025f('0x5')]('/',auth['isAuthenticated'](),controller[_0x025f('0x6')]);router['get']('/:id',auth[_0x025f('0x7')](),controller[_0x025f('0x8')]);router[_0x025f('0x9')]('/',auth[_0x025f('0x7')](),controller['create']);router[_0x025f('0xa')](_0x025f('0xb'),auth[_0x025f('0x7')](),controller['update']);router['delete'](_0x025f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x025f('0xc')]=router; \ No newline at end of file +var _0x4946=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0xc686b0,_0x5b578e){var _0x36781c=function(_0x38bb51){while(--_0x38bb51){_0xc686b0['push'](_0xc686b0['shift']());}};_0x36781c(++_0x5b578e);}(_0x4946,0x1b6));var _0x6494=function(_0x2a16f0,_0x5e516e){_0x2a16f0=_0x2a16f0-0x0;var _0x2b2b9b=_0x4946[_0x2a16f0];return _0x2b2b9b;};'use strict';var multer=require(_0x6494('0x0'));var util=require(_0x6494('0x1'));var path=require('path');var timeout=require(_0x6494('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6494('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6494('0x4'));var controller=require('./voiceQueuesLog.controller');router[_0x6494('0x5')]('/',auth['isAuthenticated'](),controller[_0x6494('0x6')]);router[_0x6494('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x6494('0x7')]);router[_0x6494('0x8')]('/',auth[_0x6494('0x9')](),controller['create']);router[_0x6494('0xa')](_0x6494('0xb'),auth[_0x6494('0x9')](),controller[_0x6494('0xc')]);router[_0x6494('0xd')](_0x6494('0xb'),auth[_0x6494('0x9')](),controller[_0x6494('0xe')]);module[_0x6494('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7d6620d..a2ad3eb 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 _0x3d32=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports','STRING','DATE'];(function(_0x4310d8,_0xd76aa0){var _0x5e61c0=function(_0x340b2b){while(--_0x340b2b){_0x4310d8['push'](_0x4310d8['shift']());}};_0x5e61c0(++_0xd76aa0);}(_0x3d32,0x14b));var _0x23d3=function(_0x513e2a,_0x2da897){_0x513e2a=_0x513e2a-0x0;var _0x37d567=_0x3d32[_0x513e2a];return _0x37d567;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x23d3('0x0'));module[_0x23d3('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x23d3('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x23d3('0x4'))}}; \ No newline at end of file +var _0xa206=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','DATE'];(function(_0x2815e1,_0x53d74c){var _0x5c0746=function(_0x55b699){while(--_0x55b699){_0x2815e1['push'](_0x2815e1['shift']());}};_0x5c0746(++_0x53d74c);}(_0xa206,0xb8));var _0x6a20=function(_0xc64699,_0x1b3076){_0xc64699=_0xc64699-0x0;var _0x40732e=_0xa206[_0xc64699];return _0x40732e;};'use strict';var Sequelize=require(_0x6a20('0x0'));var moment=require(_0x6a20('0x1'));module[_0x6a20('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6a20('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6a20('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x6a20('0x5')](_0x6a20('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1b17e46..52d482e 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 _0x332a=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','Content-Range','reject','save','then','destroy','sendStatus','stack','name','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x201d15,_0x5ad378){var _0x3719ae=function(_0x409bf3){while(--_0x409bf3){_0x201d15['push'](_0x201d15['shift']());}};_0x3719ae(++_0x5ad378);}(_0x332a,0xd9));var _0xa332=function(_0x33dcba,_0x2cf761){_0x33dcba=_0x33dcba-0x0;var _0x3a42a3=_0x332a[_0x33dcba];return _0x3a42a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa332('0x0'));var zipdir=require(_0xa332('0x1'));var jsonpatch=require(_0xa332('0x2'));var rp=require(_0xa332('0x3'));var moment=require(_0xa332('0x4'));var BPromise=require(_0xa332('0x5'));var Mustache=require(_0xa332('0x6'));var util=require(_0xa332('0x7'));var path=require('path');var sox=require(_0xa332('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa332('0x9'));var _=require(_0xa332('0xa'));var squel=require(_0xa332('0xb'));var crypto=require(_0xa332('0xc'));var jsforce=require(_0xa332('0xd'));var deskjs=require(_0xa332('0xe'));var toCsv=require(_0xa332('0xf'));var querystring=require(_0xa332('0x10'));var Papa=require(_0xa332('0x11'));var Redis=require(_0xa332('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa332('0x13'));var as=require(_0xa332('0x14'));var hardwareService=require(_0xa332('0x15'));var logger=require(_0xa332('0x16'))(_0xa332('0x17'));var utils=require('../../config/utils');var config=require(_0xa332('0x18'));var licenseUtil=require(_0xa332('0x19'));var db=require(_0xa332('0x1a'))['db'];function respondWithStatusCode(_0x177d97,_0x161852){_0x161852=_0x161852||0xcc;return function(_0x5a8246){if(_0x5a8246){return _0x177d97['sendStatus'](_0x161852);}return _0x177d97['status'](_0x161852)[_0xa332('0x1b')]();};}function respondWithResult(_0x56c7d8,_0x24a008){_0x24a008=_0x24a008||0xc8;return function(_0x434ee7){if(_0x434ee7){return _0x56c7d8['status'](_0x24a008)[_0xa332('0x1c')](_0x434ee7);}};}function respondWithFilteredResult(_0x338036,_0x482315){return function(_0x44b88b){if(_0x44b88b){var _0xd1c49d=typeof _0x482315[_0xa332('0x1d')]==='undefined'&&typeof _0x482315[_0xa332('0x1e')]===_0xa332('0x1f');var _0xbf0a62=_0x44b88b[_0xa332('0x20')];var _0x11fced=_0xd1c49d?0x0:_0x482315['offset'];var _0x29cd7d=_0xd1c49d?_0x44b88b[_0xa332('0x20')]:_0x482315[_0xa332('0x1d')]+_0x482315['limit'];var _0x50c9b0;if(_0x29cd7d>=_0xbf0a62){_0x29cd7d=_0xbf0a62;_0x50c9b0=0xc8;}else{_0x50c9b0=0xce;}_0x338036[_0xa332('0x21')](_0x50c9b0);return _0x338036['set'](_0xa332('0x22'),_0x11fced+'-'+_0x29cd7d+'/'+_0xbf0a62)[_0xa332('0x1c')](_0x44b88b);}return null;};}function patchUpdates(_0x20941c){return function(_0x2d470b){try{jsonpatch['apply'](_0x2d470b,_0x20941c,!![]);}catch(_0x1aac90){return BPromise[_0xa332('0x23')](_0x1aac90);}return _0x2d470b[_0xa332('0x24')]();};}function saveUpdates(_0x53f8b0,_0x325e37){return function(_0x385416){if(_0x385416){return _0x385416['update'](_0x53f8b0)[_0xa332('0x25')](function(_0x175226){return _0x175226;});}return null;};}function removeEntity(_0x3352e3,_0x47eaee){return function(_0x455f96){if(_0x455f96){return _0x455f96[_0xa332('0x26')]()[_0xa332('0x25')](function(){_0x3352e3[_0xa332('0x21')](0xcc)[_0xa332('0x1b')]();});}};}function handleEntityNotFound(_0x288d1e,_0xe061c7){return function(_0x845408){if(!_0x845408){_0x288d1e[_0xa332('0x27')](0x194);}return _0x845408;};}function handleError(_0x4181e6,_0x2689ff){_0x2689ff=_0x2689ff||0x1f4;return function(_0x2df59e){logger['error'](_0x2df59e[_0xa332('0x28')]);if(_0x2df59e[_0xa332('0x29')]){delete _0x2df59e[_0xa332('0x29')];}_0x4181e6[_0xa332('0x21')](_0x2689ff)['send'](_0x2df59e);};}exports[_0xa332('0x2a')]=function(_0x33d74e,_0x34eb16){var _0x1c3f33={},_0x3eba77={},_0x5c1a20={'count':0x0,'rows':[]};var _0x2938ac=_[_0xa332('0x2b')](db[_0xa332('0x2c')][_0xa332('0x2d')],function(_0x44f862){return{'name':_0x44f862[_0xa332('0x2e')],'type':_0x44f862[_0xa332('0x2f')][_0xa332('0x30')]};});_0x3eba77[_0xa332('0x31')]=_['map'](_0x2938ac,_0xa332('0x29'));_0x3eba77['query']=_['keys'](_0x33d74e[_0xa332('0x32')]);_0x3eba77[_0xa332('0x33')]=_[_0xa332('0x34')](_0x3eba77[_0xa332('0x31')],_0x3eba77[_0xa332('0x32')]);_0x1c3f33[_0xa332('0x35')]=_[_0xa332('0x34')](_0x3eba77['model'],qs[_0xa332('0x36')](_0x33d74e[_0xa332('0x32')][_0xa332('0x36')]));_0x1c3f33['attributes']=_0x1c3f33[_0xa332('0x35')][_0xa332('0x37')]?_0x1c3f33['attributes']:_0x3eba77['model'];if(!_0x33d74e[_0xa332('0x32')]['hasOwnProperty'](_0xa332('0x38'))){_0x1c3f33[_0xa332('0x1e')]=qs['limit'](_0x33d74e['query']['limit']);_0x1c3f33[_0xa332('0x1d')]=qs['offset'](_0x33d74e[_0xa332('0x32')][_0xa332('0x1d')]);}_0x1c3f33[_0xa332('0x39')]=qs[_0xa332('0x3a')](_0x33d74e[_0xa332('0x32')][_0xa332('0x3a')]);_0x1c3f33[_0xa332('0x3b')]=qs['filters'](_[_0xa332('0x3c')](_0x33d74e['query'],_0x3eba77[_0xa332('0x33')]),_0x2938ac);if(_0x33d74e[_0xa332('0x32')][_0xa332('0x3d')]){_0x1c3f33['where']=_[_0xa332('0x3e')](_0x1c3f33[_0xa332('0x3b')],{'$or':_[_0xa332('0x2b')](_0x2938ac,function(_0x37e17f){if(_0x37e17f[_0xa332('0x2f')]!==_0xa332('0x3f')){var _0x13fad2={};_0x13fad2[_0x37e17f[_0xa332('0x29')]]={'$like':'%'+_0x33d74e[_0xa332('0x32')][_0xa332('0x3d')]+'%'};return _0x13fad2;}})});}_0x1c3f33=_[_0xa332('0x3e')]({},_0x1c3f33,_0x33d74e[_0xa332('0x40')]);var _0x2e13d1={'where':_0x1c3f33[_0xa332('0x3b')]};return db[_0xa332('0x2c')][_0xa332('0x20')](_0x2e13d1)[_0xa332('0x25')](function(_0x1b2066){_0x5c1a20[_0xa332('0x20')]=_0x1b2066;if(_0x33d74e[_0xa332('0x32')][_0xa332('0x41')]){_0x1c3f33[_0xa332('0x42')]=[{'all':!![]}];}return db[_0xa332('0x2c')]['findAll'](_0x1c3f33);})[_0xa332('0x25')](function(_0x13119f){_0x5c1a20[_0xa332('0x43')]=_0x13119f;return _0x5c1a20;})[_0xa332('0x25')](respondWithFilteredResult(_0x34eb16,_0x1c3f33))[_0xa332('0x44')](handleError(_0x34eb16,null));};exports['show']=function(_0x1dcd3a,_0x473a83){var _0x2a0e04={'raw':!![],'where':{'id':_0x1dcd3a[_0xa332('0x45')]['id']}},_0x31b565={};_0x31b565['model']=_[_0xa332('0x46')](db['VoiceQueuesLog'][_0xa332('0x2d')]);_0x31b565[_0xa332('0x32')]=_[_0xa332('0x46')](_0x1dcd3a[_0xa332('0x32')]);_0x31b565[_0xa332('0x33')]=_[_0xa332('0x34')](_0x31b565['model'],_0x31b565[_0xa332('0x32')]);_0x2a0e04[_0xa332('0x35')]=_[_0xa332('0x34')](_0x31b565[_0xa332('0x31')],qs[_0xa332('0x36')](_0x1dcd3a[_0xa332('0x32')][_0xa332('0x36')]));_0x2a0e04[_0xa332('0x35')]=_0x2a0e04[_0xa332('0x35')][_0xa332('0x37')]?_0x2a0e04[_0xa332('0x35')]:_0x31b565[_0xa332('0x31')];if(_0x1dcd3a[_0xa332('0x32')][_0xa332('0x41')]){_0x2a0e04['include']=[{'all':!![]}];}_0x2a0e04=_[_0xa332('0x3e')]({},_0x2a0e04,_0x1dcd3a[_0xa332('0x40')]);return db[_0xa332('0x2c')][_0xa332('0x47')](_0x2a0e04)['then'](handleEntityNotFound(_0x473a83,null))[_0xa332('0x25')](respondWithResult(_0x473a83,null))[_0xa332('0x44')](handleError(_0x473a83,null));};exports[_0xa332('0x48')]=function(_0x45c667,_0x4d1a07){return db['VoiceQueuesLog'][_0xa332('0x48')](_0x45c667[_0xa332('0x49')],{})[_0xa332('0x25')](respondWithResult(_0x4d1a07,0xc9))[_0xa332('0x44')](handleError(_0x4d1a07,null));};exports[_0xa332('0x4a')]=function(_0x473f66,_0x5dabc6){if(_0x473f66[_0xa332('0x49')]['id']){delete _0x473f66[_0xa332('0x49')]['id'];}return db['VoiceQueuesLog'][_0xa332('0x47')]({'where':{'id':_0x473f66[_0xa332('0x45')]['id']}})[_0xa332('0x25')](handleEntityNotFound(_0x5dabc6,null))[_0xa332('0x25')](saveUpdates(_0x473f66['body'],null))[_0xa332('0x25')](respondWithResult(_0x5dabc6,null))[_0xa332('0x44')](handleError(_0x5dabc6,null));};exports[_0xa332('0x26')]=function(_0x662b5b,_0x2b4325){return db[_0xa332('0x2c')][_0xa332('0x47')]({'where':{'id':_0x662b5b[_0xa332('0x45')]['id']}})[_0xa332('0x25')](handleEntityNotFound(_0x2b4325,null))[_0xa332('0x25')](removeEntity(_0x2b4325,null))[_0xa332('0x44')](handleError(_0x2b4325,null));}; \ No newline at end of file +var _0xc123=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceQueuesLog','includeAll','include','findAll','catch','show','params','create','body','find'];(function(_0x35b99b,_0x2efd45){var _0xc34057=function(_0x59ffe9){while(--_0x59ffe9){_0x35b99b['push'](_0x35b99b['shift']());}};_0xc34057(++_0x2efd45);}(_0xc123,0x19e));var _0x3c12=function(_0x97f936,_0x3ac440){_0x97f936=_0x97f936-0x0;var _0x535f88=_0xc123[_0x97f936];return _0x535f88;};'use strict';var emlformat=require(_0x3c12('0x0'));var rimraf=require(_0x3c12('0x1'));var zipdir=require(_0x3c12('0x2'));var jsonpatch=require(_0x3c12('0x3'));var rp=require(_0x3c12('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c12('0x5'));var util=require(_0x3c12('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3c12('0x7'));var ejs=require(_0x3c12('0x8'));var fs=require('fs');var fs_extra=require(_0x3c12('0x9'));var _=require('lodash');var squel=require(_0x3c12('0xa'));var crypto=require('crypto');var jsforce=require(_0x3c12('0xb'));var deskjs=require(_0x3c12('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c12('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3c12('0xe'));var as=require(_0x3c12('0xf'));var hardwareService=require(_0x3c12('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x3c12('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3c12('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51e57e,_0x4c2a57){_0x4c2a57=_0x4c2a57||0xcc;return function(_0x387668){if(_0x387668){return _0x51e57e[_0x3c12('0x13')](_0x4c2a57);}return _0x51e57e['status'](_0x4c2a57)[_0x3c12('0x14')]();};}function respondWithResult(_0x422933,_0x4a63ff){_0x4a63ff=_0x4a63ff||0xc8;return function(_0x533e1c){if(_0x533e1c){return _0x422933['status'](_0x4a63ff)[_0x3c12('0x15')](_0x533e1c);}};}function respondWithFilteredResult(_0x371485,_0x4848ff){return function(_0x2231ce){if(_0x2231ce){var _0xd53aa8=typeof _0x4848ff[_0x3c12('0x16')]===_0x3c12('0x17')&&typeof _0x4848ff[_0x3c12('0x18')]===_0x3c12('0x17');var _0x31a80f=_0x2231ce['count'];var _0x5b1217=_0xd53aa8?0x0:_0x4848ff[_0x3c12('0x16')];var _0x2b8969=_0xd53aa8?_0x2231ce[_0x3c12('0x19')]:_0x4848ff['offset']+_0x4848ff[_0x3c12('0x18')];var _0x416c0c;if(_0x2b8969>=_0x31a80f){_0x2b8969=_0x31a80f;_0x416c0c=0xc8;}else{_0x416c0c=0xce;}_0x371485[_0x3c12('0x1a')](_0x416c0c);return _0x371485['set'](_0x3c12('0x1b'),_0x5b1217+'-'+_0x2b8969+'/'+_0x31a80f)['json'](_0x2231ce);}return null;};}function patchUpdates(_0x15a8b0){return function(_0x17129b){try{jsonpatch[_0x3c12('0x1c')](_0x17129b,_0x15a8b0,!![]);}catch(_0x22ab33){return BPromise[_0x3c12('0x1d')](_0x22ab33);}return _0x17129b['save']();};}function saveUpdates(_0x181ce2,_0x1e44b7){return function(_0x40313e){if(_0x40313e){return _0x40313e[_0x3c12('0x1e')](_0x181ce2)[_0x3c12('0x1f')](function(_0x1905c6){return _0x1905c6;});}return null;};}function removeEntity(_0xae4524,_0x43f48f){return function(_0x5f2300){if(_0x5f2300){return _0x5f2300[_0x3c12('0x20')]()[_0x3c12('0x1f')](function(){_0xae4524[_0x3c12('0x1a')](0xcc)[_0x3c12('0x14')]();});}};}function handleEntityNotFound(_0x311159,_0x17e5a9){return function(_0xf357c0){if(!_0xf357c0){_0x311159[_0x3c12('0x13')](0x194);}return _0xf357c0;};}function handleError(_0xe20cf8,_0x5a8436){_0x5a8436=_0x5a8436||0x1f4;return function(_0x277a39){logger[_0x3c12('0x21')](_0x277a39['stack']);if(_0x277a39['name']){delete _0x277a39[_0x3c12('0x22')];}_0xe20cf8[_0x3c12('0x1a')](_0x5a8436)['send'](_0x277a39);};}exports[_0x3c12('0x23')]=function(_0x117050,_0x3fd2b8){var _0x114da4={},_0x3e8709={},_0x5f5136={'count':0x0,'rows':[]};var _0x3b6afd=_[_0x3c12('0x24')](db['VoiceQueuesLog'][_0x3c12('0x25')],function(_0x437cab){return{'name':_0x437cab[_0x3c12('0x26')],'type':_0x437cab[_0x3c12('0x27')][_0x3c12('0x28')]};});_0x3e8709[_0x3c12('0x29')]=_[_0x3c12('0x24')](_0x3b6afd,_0x3c12('0x22'));_0x3e8709['query']=_[_0x3c12('0x2a')](_0x117050[_0x3c12('0x2b')]);_0x3e8709[_0x3c12('0x2c')]=_[_0x3c12('0x2d')](_0x3e8709['model'],_0x3e8709[_0x3c12('0x2b')]);_0x114da4[_0x3c12('0x2e')]=_[_0x3c12('0x2d')](_0x3e8709[_0x3c12('0x29')],qs['fields'](_0x117050[_0x3c12('0x2b')][_0x3c12('0x2f')]));_0x114da4[_0x3c12('0x2e')]=_0x114da4[_0x3c12('0x2e')][_0x3c12('0x30')]?_0x114da4[_0x3c12('0x2e')]:_0x3e8709[_0x3c12('0x29')];if(!_0x117050[_0x3c12('0x2b')][_0x3c12('0x31')](_0x3c12('0x32'))){_0x114da4['limit']=qs['limit'](_0x117050[_0x3c12('0x2b')][_0x3c12('0x18')]);_0x114da4[_0x3c12('0x16')]=qs[_0x3c12('0x16')](_0x117050[_0x3c12('0x2b')]['offset']);}_0x114da4[_0x3c12('0x33')]=qs[_0x3c12('0x34')](_0x117050[_0x3c12('0x2b')][_0x3c12('0x34')]);_0x114da4[_0x3c12('0x35')]=qs[_0x3c12('0x2c')](_[_0x3c12('0x36')](_0x117050[_0x3c12('0x2b')],_0x3e8709[_0x3c12('0x2c')]),_0x3b6afd);if(_0x117050['query'][_0x3c12('0x37')]){_0x114da4['where']=_['merge'](_0x114da4['where'],{'$or':_[_0x3c12('0x24')](_0x3b6afd,function(_0x2684d4){if(_0x2684d4['type']!==_0x3c12('0x38')){var _0x120e0d={};_0x120e0d[_0x2684d4['name']]={'$like':'%'+_0x117050[_0x3c12('0x2b')][_0x3c12('0x37')]+'%'};return _0x120e0d;}})});}_0x114da4=_[_0x3c12('0x39')]({},_0x114da4,_0x117050[_0x3c12('0x3a')]);var _0x4bf063={'where':_0x114da4[_0x3c12('0x35')]};return db[_0x3c12('0x3b')]['count'](_0x4bf063)[_0x3c12('0x1f')](function(_0x295f76){_0x5f5136['count']=_0x295f76;if(_0x117050[_0x3c12('0x2b')][_0x3c12('0x3c')]){_0x114da4[_0x3c12('0x3d')]=[{'all':!![]}];}return db[_0x3c12('0x3b')][_0x3c12('0x3e')](_0x114da4);})['then'](function(_0x2dd086){_0x5f5136['rows']=_0x2dd086;return _0x5f5136;})[_0x3c12('0x1f')](respondWithFilteredResult(_0x3fd2b8,_0x114da4))[_0x3c12('0x3f')](handleError(_0x3fd2b8,null));};exports[_0x3c12('0x40')]=function(_0x4d16cf,_0xe959ad){var _0x753b81={'raw':!![],'where':{'id':_0x4d16cf[_0x3c12('0x41')]['id']}},_0x5d0950={};_0x5d0950[_0x3c12('0x29')]=_[_0x3c12('0x2a')](db['VoiceQueuesLog']['rawAttributes']);_0x5d0950['query']=_[_0x3c12('0x2a')](_0x4d16cf['query']);_0x5d0950[_0x3c12('0x2c')]=_['intersection'](_0x5d0950[_0x3c12('0x29')],_0x5d0950[_0x3c12('0x2b')]);_0x753b81[_0x3c12('0x2e')]=_[_0x3c12('0x2d')](_0x5d0950['model'],qs[_0x3c12('0x2f')](_0x4d16cf[_0x3c12('0x2b')][_0x3c12('0x2f')]));_0x753b81[_0x3c12('0x2e')]=_0x753b81[_0x3c12('0x2e')][_0x3c12('0x30')]?_0x753b81[_0x3c12('0x2e')]:_0x5d0950[_0x3c12('0x29')];if(_0x4d16cf[_0x3c12('0x2b')][_0x3c12('0x3c')]){_0x753b81['include']=[{'all':!![]}];}_0x753b81=_[_0x3c12('0x39')]({},_0x753b81,_0x4d16cf[_0x3c12('0x3a')]);return db[_0x3c12('0x3b')]['find'](_0x753b81)[_0x3c12('0x1f')](handleEntityNotFound(_0xe959ad,null))[_0x3c12('0x1f')](respondWithResult(_0xe959ad,null))['catch'](handleError(_0xe959ad,null));};exports[_0x3c12('0x42')]=function(_0x389567,_0x4d19b2){return db[_0x3c12('0x3b')]['create'](_0x389567[_0x3c12('0x43')],{})[_0x3c12('0x1f')](respondWithResult(_0x4d19b2,0xc9))['catch'](handleError(_0x4d19b2,null));};exports[_0x3c12('0x1e')]=function(_0x33531a,_0x26ab48){if(_0x33531a[_0x3c12('0x43')]['id']){delete _0x33531a[_0x3c12('0x43')]['id'];}return db['VoiceQueuesLog'][_0x3c12('0x44')]({'where':{'id':_0x33531a['params']['id']}})[_0x3c12('0x1f')](handleEntityNotFound(_0x26ab48,null))['then'](saveUpdates(_0x33531a[_0x3c12('0x43')],null))[_0x3c12('0x1f')](respondWithResult(_0x26ab48,null))[_0x3c12('0x3f')](handleError(_0x26ab48,null));};exports[_0x3c12('0x20')]=function(_0xc003ba,_0x42d541){return db['VoiceQueuesLog'][_0x3c12('0x44')]({'where':{'id':_0xc003ba[_0x3c12('0x41')]['id']}})[_0x3c12('0x1f')](handleEntityNotFound(_0x42d541,null))[_0x3c12('0x1f')](removeEntity(_0x42d541,null))['catch'](handleError(_0x42d541,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 71d277e..e9e8c60 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 _0xdf97=['dtm','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log'];(function(_0x2bb3f2,_0x5d6899){var _0x5746d6=function(_0x2aae89){while(--_0x2aae89){_0x2bb3f2['push'](_0x2bb3f2['shift']());}};_0x5746d6(++_0x5d6899);}(_0xdf97,0x1c4));var _0x7df9=function(_0x207630,_0x355f5e){_0x207630=_0x207630-0x0;var _0x2bd94f=_0xdf97[_0x207630];return _0x2bd94f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7df9('0x0'))(_0x7df9('0x1'));var moment=require('moment');var BPromise=require(_0x7df9('0x2'));var rp=require(_0x7df9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7df9('0x4'));var config=require(_0x7df9('0x5'));var attributes=require(_0x7df9('0x6'));module[_0x7df9('0x7')]=function(_0x562c40,_0x1db832){return _0x562c40['define'](_0x7df9('0x8'),attributes,{'tableName':_0x7df9('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x7df9('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1e46=['util','api','bluebird','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash'];(function(_0x4de5b2,_0x1aef54){var _0xb0e7ae=function(_0x2839e4){while(--_0x2839e4){_0x4de5b2['push'](_0x4de5b2['shift']());}};_0xb0e7ae(++_0x1aef54);}(_0x1e46,0x1bb));var _0x61e4=function(_0x5ac3fb,_0x55862a){_0x5ac3fb=_0x5ac3fb-0x0;var _0x116a74=_0x1e46[_0x5ac3fb];return _0x116a74;};'use strict';var _=require(_0x61e4('0x0'));var util=require(_0x61e4('0x1'));var logger=require('../../config/logger')(_0x61e4('0x2'));var moment=require('moment');var BPromise=require(_0x61e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61e4('0x4'));var rimraf=require('rimraf');var config=require(_0x61e4('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x61e4('0x6')]=function(_0x21fcd3,_0x4a8dff){return _0x21fcd3[_0x61e4('0x7')](_0x61e4('0x8'),attributes,{'tableName':_0x61e4('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x61e4('0xa'),_0x61e4('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f19d9b7..99d90c7 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 _0x2544=['jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2544,0x8b));var _0x4254=function(_0x226b2a,_0x5b7fec){_0x226b2a=_0x226b2a-0x0;var _0x37fa83=_0x2544[_0x226b2a];return _0x37fa83;};'use strict';var _=require(_0x4254('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4254('0x1'));var rs=require(_0x4254('0x2'));var fs=require('fs');var Redis=require(_0x4254('0x3'));var db=require(_0x4254('0x4'))['db'];var utils=require(_0x4254('0x5'));var logger=require(_0x4254('0x6'))('rpc');var config=require(_0x4254('0x7'));var jayson=require(_0x4254('0x8'));var client=jayson['client'][_0x4254('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a4b4,_0x2ccc7e,_0x5e6b7b){return new BPromise(function(_0x5b1b2e,_0x25e46b){return client[_0x4254('0xa')](_0x34a4b4,_0x5e6b7b)[_0x4254('0xb')](function(_0x281b55){logger['info'](_0x4254('0xc'),_0x2ccc7e,_0x4254('0xd'));logger['debug'](_0x4254('0xe'),_0x2ccc7e,_0x4254('0xd'),JSON[_0x4254('0xf')](_0x281b55));if(_0x281b55['error']){if(_0x281b55[_0x4254('0x10')][_0x4254('0x11')]===0x1f4){logger[_0x4254('0x10')](_0x4254('0xc'),_0x2ccc7e,_0x281b55[_0x4254('0x10')][_0x4254('0x12')]);return _0x25e46b(_0x281b55[_0x4254('0x10')][_0x4254('0x12')]);}logger[_0x4254('0x10')](_0x4254('0xc'),_0x2ccc7e,_0x281b55[_0x4254('0x10')]['message']);return _0x5b1b2e(_0x281b55[_0x4254('0x10')][_0x4254('0x12')]);}else{logger[_0x4254('0x13')](_0x4254('0xc'),_0x2ccc7e,_0x4254('0xd'));_0x5b1b2e(_0x281b55[_0x4254('0x14')][_0x4254('0x12')]);}})['catch'](function(_0x18b9e9){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2ccc7e,_0x18b9e9);_0x25e46b(_0x18b9e9);});});} \ No newline at end of file +var _0x4f83=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x4f83,0x6d));var _0x34f8=function(_0x3b96d9,_0x1c5182){_0x3b96d9=_0x3b96d9-0x0;var _0xf02e5b=_0x4f83[_0x3b96d9];return _0xf02e5b;};'use strict';var _=require(_0x34f8('0x0'));var util=require(_0x34f8('0x1'));var moment=require(_0x34f8('0x2'));var BPromise=require(_0x34f8('0x3'));var rs=require(_0x34f8('0x4'));var fs=require('fs');var Redis=require(_0x34f8('0x5'));var db=require(_0x34f8('0x6'))['db'];var utils=require(_0x34f8('0x7'));var logger=require(_0x34f8('0x8'))(_0x34f8('0x9'));var config=require(_0x34f8('0xa'));var jayson=require(_0x34f8('0xb'));var client=jayson['client'][_0x34f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4353dc,_0x511718,_0x33752c){return new BPromise(function(_0x322872,_0x3dd944){return client[_0x34f8('0xd')](_0x4353dc,_0x33752c)[_0x34f8('0xe')](function(_0x3071a8){logger[_0x34f8('0xf')](_0x34f8('0x10'),_0x511718,_0x34f8('0x11'));logger[_0x34f8('0x12')](_0x34f8('0x13'),_0x511718,_0x34f8('0x11'),JSON[_0x34f8('0x14')](_0x3071a8));if(_0x3071a8[_0x34f8('0x15')]){if(_0x3071a8['error'][_0x34f8('0x16')]===0x1f4){logger[_0x34f8('0x15')](_0x34f8('0x10'),_0x511718,_0x3071a8[_0x34f8('0x15')][_0x34f8('0x17')]);return _0x3dd944(_0x3071a8[_0x34f8('0x15')][_0x34f8('0x17')]);}logger[_0x34f8('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x511718,_0x3071a8[_0x34f8('0x15')][_0x34f8('0x17')]);return _0x322872(_0x3071a8[_0x34f8('0x15')][_0x34f8('0x17')]);}else{logger['info'](_0x34f8('0x10'),_0x511718,_0x34f8('0x11'));_0x322872(_0x3071a8['result']['message']);}})[_0x34f8('0x18')](function(_0x11c4c0){logger[_0x34f8('0x15')](_0x34f8('0x10'),_0x511718,_0x11c4c0);_0x3dd944(_0x11c4c0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index cf99f92..fd6a8ca 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 _0xddfd=['/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xddfd,0x16b));var _0xdddf=function(_0x2691d0,_0x3de301){_0x2691d0=_0x2691d0-0x0;var _0x467010=_0xddfd[_0x2691d0];return _0x467010;};'use strict';var multer=require(_0xdddf('0x0'));var util=require(_0xdddf('0x1'));var path=require('path');var timeout=require(_0xdddf('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdddf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdddf('0x4'));var config=require(_0xdddf('0x5'));var controller=require(_0xdddf('0x6'));router['get']('/',auth[_0xdddf('0x7')](),controller[_0xdddf('0x8')]);router[_0xdddf('0x9')](_0xdddf('0xa'),auth[_0xdddf('0x7')](),controller[_0xdddf('0xb')]);router[_0xdddf('0x9')](_0xdddf('0xc'),auth[_0xdddf('0x7')](),controller[_0xdddf('0xd')]);router['get'](_0xdddf('0xe'),auth[_0xdddf('0x7')](),controller[_0xdddf('0xf')]);router[_0xdddf('0x9')](_0xdddf('0x10'),controller[_0xdddf('0x11')]);router[_0xdddf('0x9')](_0xdddf('0x12'),auth[_0xdddf('0x7')](),controller['downloadTranscribe']);router[_0xdddf('0x13')]('/',auth['isAuthenticated'](),controller[_0xdddf('0x14')]);router[_0xdddf('0x13')](_0xdddf('0x12'),auth[_0xdddf('0x7')](),controller[_0xdddf('0x15')]);router['put'](_0xdddf('0xc'),auth[_0xdddf('0x7')](),controller['update']);router[_0xdddf('0x16')](_0xdddf('0xc'),auth['isAuthenticated'](),controller[_0xdddf('0x17')]);module[_0xdddf('0x18')]=router; \ No newline at end of file +var _0x2a14=['show','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/:id'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x2a14,0x196));var _0x42a1=function(_0x191a75,_0x3d229c){_0x191a75=_0x191a75-0x0;var _0x137f81=_0x2a14[_0x191a75];return _0x137f81;};'use strict';var multer=require(_0x42a1('0x0'));var util=require('util');var path=require(_0x42a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x42a1('0x2'));var router=express[_0x42a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x42a1('0x4'));var interaction=require(_0x42a1('0x5'));var config=require(_0x42a1('0x6'));var controller=require(_0x42a1('0x7'));router[_0x42a1('0x8')]('/',auth[_0x42a1('0x9')](),controller[_0x42a1('0xa')]);router['get']('/describe',auth[_0x42a1('0x9')](),controller['describe']);router[_0x42a1('0x8')](_0x42a1('0xb'),auth['isAuthenticated'](),controller[_0x42a1('0xc')]);router[_0x42a1('0x8')]('/:id/download',auth[_0x42a1('0x9')](),controller['download']);router[_0x42a1('0x8')](_0x42a1('0xd'),controller[_0x42a1('0xe')]);router[_0x42a1('0x8')]('/:id/transcribe',auth[_0x42a1('0x9')](),controller['downloadTranscribe']);router[_0x42a1('0xf')]('/',auth[_0x42a1('0x9')](),controller[_0x42a1('0x10')]);router[_0x42a1('0xf')](_0x42a1('0x11'),auth[_0x42a1('0x9')](),controller[_0x42a1('0x12')]);router[_0x42a1('0x13')]('/:id',auth[_0x42a1('0x9')](),controller[_0x42a1('0x14')]);router['delete'](_0x42a1('0xb'),auth['isAuthenticated'](),controller[_0x42a1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index bbafccb..66beee2 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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 658f44d..3a2b3bc 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 _0xed41=['then','destroy','end','error','name','map','VoiceRecording','fieldName','type','key','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','download','uniqueid','value','format','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send','downloads','../../components/encryptor','where','sequelize','MD5','col','$and','push','%s.cypher','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Sequelize','Cloud\x20Provider\x20not\x20available','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','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x3c9851,_0x456a06){var _0x13a106=function(_0x136163){while(--_0x136163){_0x3c9851['push'](_0x3c9851['shift']());}};_0x13a106(++_0x456a06);}(_0xed41,0x10a));var _0x1ed4=function(_0x56c59a,_0x468d84){_0x56c59a=_0x56c59a-0x0;var _0x232d39=_0xed41[_0x56c59a];return _0x232d39;};'use strict';var emlformat=require(_0x1ed4('0x0'));var rimraf=require(_0x1ed4('0x1'));var zipdir=require(_0x1ed4('0x2'));var jsonpatch=require(_0x1ed4('0x3'));var rp=require('request-promise');var moment=require(_0x1ed4('0x4'));var BPromise=require(_0x1ed4('0x5'));var Mustache=require(_0x1ed4('0x6'));var util=require('util');var path=require(_0x1ed4('0x7'));var sox=require(_0x1ed4('0x8'));var csv=require(_0x1ed4('0x9'));var ejs=require(_0x1ed4('0xa'));var fs=require('fs');var fs_extra=require(_0x1ed4('0xb'));var _=require(_0x1ed4('0xc'));var squel=require('squel');var crypto=require(_0x1ed4('0xd'));var jsforce=require(_0x1ed4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1ed4('0x9'));var querystring=require('querystring');var Papa=require(_0x1ed4('0xf'));var AWS=require(_0x1ed4('0x10'));var uuidv4=require(_0x1ed4('0x11'));var Redis=require('ioredis');var authService=require(_0x1ed4('0x12'));var qs=require(_0x1ed4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ed4('0x14'));var logger=require(_0x1ed4('0x15'))('api');var utils=require(_0x1ed4('0x16'));var config=require(_0x1ed4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ed4('0x18'))['db'];function respondWithStatusCode(_0x218165,_0x4e7571){_0x4e7571=_0x4e7571||0xcc;return function(_0x3e80e9){if(_0x3e80e9){return _0x218165[_0x1ed4('0x19')](_0x4e7571);}return _0x218165[_0x1ed4('0x1a')](_0x4e7571)['end']();};}function respondWithResult(_0x572a29,_0x4bcdec){_0x4bcdec=_0x4bcdec||0xc8;return function(_0x55d070){if(_0x55d070){return _0x572a29[_0x1ed4('0x1a')](_0x4bcdec)[_0x1ed4('0x1b')](_0x55d070);}};}function respondWithFilteredResult(_0x43f631,_0x48d241){return function(_0x3bc7f0){if(_0x3bc7f0){var _0x196934=typeof _0x48d241[_0x1ed4('0x1c')]===_0x1ed4('0x1d')&&typeof _0x48d241['limit']===_0x1ed4('0x1d');var _0x12d1f7=_0x3bc7f0['count'];var _0x3d1ab8=_0x196934?0x0:_0x48d241['offset'];var _0x22681f=_0x196934?_0x3bc7f0[_0x1ed4('0x1e')]:_0x48d241['offset']+_0x48d241['limit'];var _0x1040c5;if(_0x22681f>=_0x12d1f7){_0x22681f=_0x12d1f7;_0x1040c5=0xc8;}else{_0x1040c5=0xce;}_0x43f631[_0x1ed4('0x1a')](_0x1040c5);return _0x43f631[_0x1ed4('0x1f')](_0x1ed4('0x20'),_0x3d1ab8+'-'+_0x22681f+'/'+_0x12d1f7)[_0x1ed4('0x1b')](_0x3bc7f0);}return null;};}function patchUpdates(_0x50a74d){return function(_0x5b9082){try{jsonpatch[_0x1ed4('0x21')](_0x5b9082,_0x50a74d,!![]);}catch(_0x461da3){return BPromise[_0x1ed4('0x22')](_0x461da3);}return _0x5b9082[_0x1ed4('0x23')]();};}function saveUpdates(_0x12501c,_0x24a850){return function(_0x571585){if(_0x571585){return _0x571585['update'](_0x12501c)[_0x1ed4('0x24')](function(_0x369bdb){return _0x369bdb;});}return null;};}function removeEntity(_0x2ec5bc,_0x369624){return function(_0x17b396){if(_0x17b396){return _0x17b396[_0x1ed4('0x25')]()['then'](function(){_0x2ec5bc['status'](0xcc)[_0x1ed4('0x26')]();});}};}function handleEntityNotFound(_0x23c48b,_0x5ac3c2){return function(_0x55cb5d){if(!_0x55cb5d){_0x23c48b['sendStatus'](0x194);}return _0x55cb5d;};}function handleError(_0x4806d7,_0xadcff9){_0xadcff9=_0xadcff9||0x1f4;return function(_0xac2a94){logger[_0x1ed4('0x27')](_0xac2a94['stack']);if(_0xac2a94[_0x1ed4('0x28')]){delete _0xac2a94['name'];}_0x4806d7[_0x1ed4('0x1a')](_0xadcff9)['send'](_0xac2a94);};}exports['index']=function(_0x3d336b,_0x101927){var _0x18ea21={},_0x13d77a={},_0x4dbcdf={'count':0x0,'rows':[]};var _0x4e6306=_[_0x1ed4('0x29')](db[_0x1ed4('0x2a')]['rawAttributes'],function(_0x28bafe){return{'name':_0x28bafe[_0x1ed4('0x2b')],'type':_0x28bafe[_0x1ed4('0x2c')][_0x1ed4('0x2d')]};});_0x13d77a[_0x1ed4('0x2e')]=_[_0x1ed4('0x2f')](_['map'](_0x4e6306,_0x1ed4('0x28')),['format']);_0x13d77a[_0x1ed4('0x30')]=_[_0x1ed4('0x31')](_0x3d336b[_0x1ed4('0x30')]);_0x13d77a['filters']=_[_0x1ed4('0x32')](_0x13d77a[_0x1ed4('0x2e')],_0x13d77a[_0x1ed4('0x30')]);_0x18ea21['attributes']=_['intersection'](_0x13d77a[_0x1ed4('0x2e')],qs[_0x1ed4('0x33')](_0x3d336b['query'][_0x1ed4('0x33')]));_0x18ea21[_0x1ed4('0x34')]=_0x18ea21['attributes'][_0x1ed4('0x35')]?_0x18ea21['attributes']:_0x13d77a[_0x1ed4('0x2e')];if(!_0x3d336b[_0x1ed4('0x30')][_0x1ed4('0x36')]('nolimit')){_0x18ea21['limit']=qs[_0x1ed4('0x37')](_0x3d336b['query'][_0x1ed4('0x37')]);_0x18ea21[_0x1ed4('0x1c')]=qs[_0x1ed4('0x1c')](_0x3d336b[_0x1ed4('0x30')][_0x1ed4('0x1c')]);}_0x18ea21[_0x1ed4('0x38')]=qs[_0x1ed4('0x39')](_0x3d336b[_0x1ed4('0x30')]['sort']);_0x18ea21['where']=qs[_0x1ed4('0x3a')](_['pick'](_0x3d336b[_0x1ed4('0x30')],_0x13d77a[_0x1ed4('0x3a')]),_0x4e6306);if(_0x3d336b['query'][_0x1ed4('0x3b')]){_0x18ea21['where']=_[_0x1ed4('0x3c')](_0x18ea21['where'],{'$or':_[_0x1ed4('0x29')](_0x4e6306,function(_0xee16f1){if(_0xee16f1[_0x1ed4('0x2c')]!=='VIRTUAL'){var _0x4e39cf={};_0x4e39cf[_0xee16f1['name']]={'$like':'%'+_0x3d336b[_0x1ed4('0x30')][_0x1ed4('0x3b')]+'%'};return _0x4e39cf;}})});}_0x18ea21=_[_0x1ed4('0x3c')]({},_0x18ea21,_0x3d336b[_0x1ed4('0x3d')]);var _0x1a217d={'where':_0x18ea21['where']};return db[_0x1ed4('0x2a')][_0x1ed4('0x1e')](_0x1a217d)[_0x1ed4('0x24')](function(_0x254794){_0x4dbcdf[_0x1ed4('0x1e')]=_0x254794;if(_0x3d336b['query'][_0x1ed4('0x3e')]){_0x18ea21[_0x1ed4('0x3f')]=[{'all':!![]}];}return db[_0x1ed4('0x2a')][_0x1ed4('0x40')](_0x18ea21);})[_0x1ed4('0x24')](function(_0x364514){_0x4dbcdf[_0x1ed4('0x41')]=_0x364514;return _0x4dbcdf;})['then'](respondWithFilteredResult(_0x101927,_0x18ea21))['catch'](handleError(_0x101927,null));};exports[_0x1ed4('0x42')]=function(_0x4721a5,_0x3aec88){var _0x4329d2={'raw':![],'where':{'id':_0x4721a5[_0x1ed4('0x43')]['id']}},_0x5e00d1={};_0x5e00d1[_0x1ed4('0x2e')]=_['keys'](db['VoiceRecording'][_0x1ed4('0x44')]);_0x5e00d1['query']=_[_0x1ed4('0x31')](_0x4721a5[_0x1ed4('0x30')]);_0x5e00d1['filters']=_['intersection'](_0x5e00d1[_0x1ed4('0x2e')],_0x5e00d1['query']);_0x4329d2[_0x1ed4('0x34')]=_[_0x1ed4('0x32')](_0x5e00d1[_0x1ed4('0x2e')],qs['fields'](_0x4721a5['query']['fields']));_0x4329d2[_0x1ed4('0x34')]=_0x4329d2[_0x1ed4('0x34')]['length']?_0x4329d2[_0x1ed4('0x34')]:_0x5e00d1[_0x1ed4('0x2e')];if(_0x4721a5[_0x1ed4('0x30')][_0x1ed4('0x3e')]){_0x4329d2[_0x1ed4('0x3f')]=[{'all':!![]}];}_0x4329d2=_[_0x1ed4('0x3c')]({},_0x4329d2,_0x4721a5[_0x1ed4('0x3d')]);return db[_0x1ed4('0x2a')][_0x1ed4('0x45')](_0x4329d2)['then'](handleEntityNotFound(_0x3aec88,null))[_0x1ed4('0x24')](respondWithResult(_0x3aec88,null))[_0x1ed4('0x46')](handleError(_0x3aec88,null));};exports[_0x1ed4('0x47')]=function(_0x133338,_0x3640c9){return db[_0x1ed4('0x2a')]['create'](_0x133338[_0x1ed4('0x48')],{})[_0x1ed4('0x24')](respondWithResult(_0x3640c9,0xc9))['catch'](handleError(_0x3640c9,null));};exports['update']=function(_0x5ae1f4,_0x2f3a81){if(_0x5ae1f4[_0x1ed4('0x48')]['id']){delete _0x5ae1f4[_0x1ed4('0x48')]['id'];}return db[_0x1ed4('0x2a')][_0x1ed4('0x45')]({'where':{'id':_0x5ae1f4[_0x1ed4('0x43')]['id']}})[_0x1ed4('0x24')](handleEntityNotFound(_0x2f3a81,null))[_0x1ed4('0x24')](saveUpdates(_0x5ae1f4[_0x1ed4('0x48')],null))['then'](respondWithResult(_0x2f3a81,null))['catch'](handleError(_0x2f3a81,null));};exports[_0x1ed4('0x49')]=function(_0x21400c,_0x3eee64){return db[_0x1ed4('0x2a')][_0x1ed4('0x49')]()[_0x1ed4('0x24')](respondWithResult(_0x3eee64,null))[_0x1ed4('0x46')](handleError(_0x3eee64,null));};exports[_0x1ed4('0x4a')]=function(_0xbded70,_0x46b045,_0x52d127){var _0x15a1dc=require('../../components/encryptor');var _0x137eb8=![];var _0xb397e={};if(_0xbded70['query'][_0x1ed4('0x2c')]&&_0xbded70[_0x1ed4('0x30')]['type']===_0x1ed4('0x4b')){_0xb397e['uniqueid']=_0xbded70[_0x1ed4('0x43')]['id'];}else{_0xb397e['id']=_0xbded70[_0x1ed4('0x43')]['id'];}return db[_0x1ed4('0x2a')]['find']({'where':_0xb397e,'attributes':['id',_0x1ed4('0x4c')],'raw':!![]})[_0x1ed4('0x24')](handleEntityNotFound(_0x46b045,null))[_0x1ed4('0x24')](function(_0x4d38ab){if(_0x4d38ab){var _0x314fab=_0x4d38ab['value'];var _0x3d29ff=util[_0x1ed4('0x4d')]('%s.cypher',_0x314fab);if(fs[_0x1ed4('0x4e')](_0x3d29ff)){_0x137eb8=!![];return _0x15a1dc[_0x1ed4('0x4f')](_0x3d29ff,_0x314fab,config[_0x1ed4('0x50')][_0x1ed4('0x51')])['then'](function(){return _0x4d38ab;});}return _0x4d38ab;}})[_0x1ed4('0x24')](function(_0x5105c2){if(_0x5105c2){var _0x4b9f0b=_0x5105c2['value'];if(!fs['existsSync'](_0x4b9f0b)){throw new db['Sequelize'][(_0x1ed4('0x52'))](_0x1ed4('0x53'));}if(_0x5105c2[_0x1ed4('0x54')]){return _0x46b045[_0x1ed4('0x4a')](_0x4b9f0b,_0x5105c2[_0x1ed4('0x54')]+path['extname'](_0x4b9f0b),function(){if(_0x137eb8){fs['unlink'](_0x4b9f0b);}});}else{return _0x46b045[_0x1ed4('0x4a')](_0x4b9f0b,function(_0x434b91){if(_0x137eb8){fs[_0x1ed4('0x55')](_0x4b9f0b);}});}}})[_0x1ed4('0x46')](function(_0x312abf){if(_0x312abf[_0x1ed4('0x56')]===_0x1ed4('0x53')){_0x46b045[_0x1ed4('0x1a')](0x194)[_0x1ed4('0x57')]('Not\x20found');}else{return handleError(_0x46b045,null);}});};exports[_0x1ed4('0x58')]=function(_0x403c81,_0x33ba86,_0x173993){var _0x20ab79=require(_0x1ed4('0x59'));var _0x401159=![];var _0x78aee0={'$and':[db['sequelize'][_0x1ed4('0x5a')](db[_0x1ed4('0x5b')]['fn'](_0x1ed4('0x5c'),db[_0x1ed4('0x5b')][_0x1ed4('0x5d')](_0x1ed4('0x4b'))),_0x403c81[_0x1ed4('0x30')]['token'])]};if(_0x403c81[_0x1ed4('0x30')][_0x1ed4('0x2c')]&&_0x403c81['query'][_0x1ed4('0x2c')]==='uniqueid'){_0x78aee0[_0x1ed4('0x5e')][_0x1ed4('0x5f')]({'uniqueid':_0x403c81[_0x1ed4('0x43')]['id']});}else{_0x78aee0['$and'][_0x1ed4('0x5f')]({'id':_0x403c81[_0x1ed4('0x43')]['id']});}return db[_0x1ed4('0x2a')][_0x1ed4('0x45')]({'where':_0x78aee0,'attributes':['id',_0x1ed4('0x4c')],'raw':!![]})[_0x1ed4('0x24')](handleEntityNotFound(_0x33ba86,null))[_0x1ed4('0x24')](function(_0x4cf3c1){if(_0x4cf3c1){var _0x44f66c=util['format'](_0x1ed4('0x60'),_0x4cf3c1['value']);if(fs[_0x1ed4('0x4e')](_0x44f66c)){_0x401159=!![];return _0x20ab79[_0x1ed4('0x4f')](_0x44f66c,_0x4cf3c1[_0x1ed4('0x4c')],config[_0x1ed4('0x50')][_0x1ed4('0x51')])[_0x1ed4('0x24')](function(){return _0x4cf3c1;});}return _0x4cf3c1;}})[_0x1ed4('0x24')](function(_0x4c57a7){if(_0x4c57a7){if(!fs[_0x1ed4('0x4e')](_0x4c57a7[_0x1ed4('0x4c')])){throw new db['Sequelize'][(_0x1ed4('0x52'))](_0x1ed4('0x53'));}if(_0x4c57a7[_0x1ed4('0x54')]){return _0x33ba86[_0x1ed4('0x4a')](_0x4c57a7[_0x1ed4('0x4c')],_0x4c57a7[_0x1ed4('0x54')]+path[_0x1ed4('0x61')](_0x4c57a7[_0x1ed4('0x4c')]),function(){if(_0x401159){fs[_0x1ed4('0x55')](_0x4c57a7['value']);}});}else{return _0x33ba86[_0x1ed4('0x4a')](_0x4c57a7[_0x1ed4('0x4c')],function(_0x4306fc){if(_0x401159){fs[_0x1ed4('0x55')](_0x4c57a7[_0x1ed4('0x4c')]);}});}}})[_0x1ed4('0x46')](handleError(_0x33ba86,null));};exports['destroy']=function(_0x27c6a4,_0x554d5a){return db[_0x1ed4('0x2a')][_0x1ed4('0x45')]({'where':{'id':_0x27c6a4['params']['id']}})[_0x1ed4('0x24')](function(_0x1831f4){if(_['isNil'](_0x1831f4)){throw new ReferenceError(_0x1ed4('0x62'));}return _0x1831f4;})[_0x1ed4('0x24')](function(_0xab06b5){var _0x58be7a=_0xab06b5[_0x1ed4('0x4c')];logger[_0x1ed4('0x63')](_0x1ed4('0x64'),_0x58be7a);if(!_[_0x1ed4('0x65')](_0xab06b5[_0x1ed4('0x4c')])&&fs[_0x1ed4('0x4e')](_0x58be7a)){logger[_0x1ed4('0x63')](_0x1ed4('0x66')+_0x58be7a+_0x1ed4('0x67'));fs[_0x1ed4('0x68')](_0x58be7a);}_0x58be7a=_0x58be7a+'.cypher';if(!_[_0x1ed4('0x65')](_0xab06b5['value'])&&fs['existsSync'](_0x58be7a)){logger[_0x1ed4('0x63')](_0x1ed4('0x66')+_0x58be7a+_0x1ed4('0x67'));fs['unlinkSync'](_0x58be7a);}return _0xab06b5;})[_0x1ed4('0x24')](function(_0x3bd3af){if(!_0x3bd3af)throw new InternalError();return _0x3bd3af[_0x1ed4('0x25')]();})[_0x1ed4('0x24')](function(){_0x554d5a[_0x1ed4('0x1a')](0xcc)[_0x1ed4('0x26')]();})['catch'](handleError(_0x554d5a,null));};function getBucketslist(_0x1e6fd9,_0x1e0ff3,_0x8165d6){return new Promise(function(_0x51b559,_0x4eb078){var _0x318837=new AWS['S3']({'accessKeyId':_0x1e0ff3,'secretAccessKey':_0x1e6fd9,'region':_0x8165d6});_0x318837['listBuckets']({},function(_0x189704,_0x5723b6){if(_0x189704){return _0x4eb078(_0x189704);}else{return _0x51b559(_0x5723b6);}});});}function createBucket(_0x2370c1,_0x470f59,_0x7e2b4e,_0x27b90d){return new Promise(function(_0x59ba57,_0x4f79b1){var _0x5eea0d=new AWS['S3']({'accessKeyId':_0x470f59,'secretAccessKey':_0x2370c1,'region':_0x7e2b4e});_0x5eea0d[_0x1ed4('0x69')]({'Bucket':_0x27b90d},function(_0x113623,_0x10353e){if(_0x113623){return _0x4f79b1(_0x113623);}else{return _0x59ba57(_0x10353e);}});});}function uploadFile(_0x2e306e,_0x4c3102,_0x15460f,_0x56864e,_0xf69ff2,_0x3ca865){return new Promise(function(_0x40f6e5,_0x8e605f){var _0x36454b=new AWS['S3']({'accessKeyId':_0x4c3102,'secretAccessKey':_0x2e306e,'region':_0x15460f});_0x36454b[_0x1ed4('0x6a')]({'Bucket':_0x56864e,'Key':_0xf69ff2,'Body':_0x3ca865},function(_0x1958e8,_0x2956df){if(_0x1958e8){return _0x8e605f(_0x1958e8);}else{return _0x40f6e5(_0x2956df);}});});}function startTranscribe(_0x1451d6,_0x5a4bdc,_0x4658e6,_0x583ff0,_0x354211,_0x30916a){return new Promise(function(_0xf32281,_0x1ee1a5){var _0x3bfc6b=new AWS['TranscribeService']({'accessKeyId':_0x5a4bdc,'secretAccessKey':_0x1451d6,'region':_0x4658e6});_0x3bfc6b[_0x1ed4('0x6b')]({'TranscriptionJobName':_0x583ff0,'LanguageCode':_0x354211,'Media':{'MediaFileUri':_0x30916a}},function(_0x5ba63b,_0x5c32a6){if(_0x5ba63b){return _0x1ee1a5(_0x5ba63b);}else{return _0xf32281(_0x5c32a6);}});});}function transcribe(_0x1541c0,_0x3eed2c,_0x2a383d,_0x48bd47,_0x2bf981,_0x45044e,_0x3f856c){return new Promise(function(_0x5da11d,_0xf3383e){var _0x326df8={};logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')](_0x1ed4('0x6c'),_0x1541c0,_0x2bf981));return uploadFile(_0x3eed2c,_0x2a383d,_0x48bd47,_0x2bf981,path[_0x1ed4('0x6d')](_0x45044e),fs[_0x1ed4('0x6e')](_0x45044e))[_0x1ed4('0x24')](function(_0x1d8b1a){logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')](_0x1ed4('0x6f'),_0x1541c0,_0x2bf981,_0x1d8b1a['Location']));_0x326df8[_0x1ed4('0x70')]=_0x1d8b1a[_0x1ed4('0x71')];_0x326df8[_0x1ed4('0x72')]=_0x1d8b1a['Location'];logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1541c0));return startTranscribe(_0x3eed2c,_0x2a383d,_0x48bd47,uuidv4(),_0x3f856c,_0x1d8b1a['Location']);})['then'](function(_0x4c6e06){logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')](_0x1ed4('0x73'),_0x1541c0,_0x4c6e06[_0x1ed4('0x74')][_0x1ed4('0x75')]));_0x326df8[_0x1ed4('0x76')]=_0x4c6e06[_0x1ed4('0x74')]['TranscriptionJobName'];_0x326df8[_0x1ed4('0x77')]=_0x4c6e06['TranscriptionJob'][_0x1ed4('0x78')];return _0x5da11d(_0x326df8);})[_0x1ed4('0x46')](function(_0x59719f){return _0xf3383e(_0x59719f);});});}exports['runTranscribe']=function(_0x334602,_0x3edf5b,_0x321b71){var _0x7ac873;var _0x2562da;var _0x204789;var _0x2c2293=require(_0x1ed4('0x59'));return db[_0x1ed4('0x2a')][_0x1ed4('0x79')]({'where':{'id':_0x334602['params']['id']}})[_0x1ed4('0x24')](function(_0x87f9ec){if(_0x87f9ec){var _0xd6abbd=util[_0x1ed4('0x4d')](_0x1ed4('0x60'),_0x87f9ec[_0x1ed4('0x4c')]);if(fs[_0x1ed4('0x4e')](_0xd6abbd)){cypher=!![];return _0x2c2293['decryptFile'](_0xd6abbd,_0x87f9ec[_0x1ed4('0x4c')],config[_0x1ed4('0x50')][_0x1ed4('0x51')])[_0x1ed4('0x24')](function(){return _0x87f9ec;});}return _0x87f9ec;}})[_0x1ed4('0x24')](function(_0x6818a){if(!_0x6818a){throw new db['Sequelize']['ValidationError'](_0x1ed4('0x7a'));}_0x2562da=_0x6818a;return db['Setting'][_0x1ed4('0x79')]({'where':{'id':0x1}});})[_0x1ed4('0x24')](handleEntityNotFound(_0x3edf5b,null))[_0x1ed4('0x24')](function(_0x27bb19){if(_0x27bb19){_0x7ac873=_0x27bb19;if(!_0x7ac873[_0x1ed4('0x7b')]||!_0x7ac873[_0x1ed4('0x7c')]||!_0x7ac873[_0x1ed4('0x7d')]||!_0x7ac873[_0x1ed4('0x7e')]||!_0x7ac873[_0x1ed4('0x70')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x334602['body']['runSentiment']&&(!_0x7ac873[_0x1ed4('0x7f')]||!_0x7ac873[_0x1ed4('0x80')]||!_0x7ac873[_0x1ed4('0x81')]||!_0x7ac873[_0x1ed4('0x7e')]||!_0x7ac873[_0x1ed4('0x70')])){throw new db['Sequelize'][(_0x1ed4('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1ed4('0x82')][_0x1ed4('0x79')]({'where':{'id':_0x7ac873[_0x1ed4('0x7c')]}});}})[_0x1ed4('0x24')](function(_0x1309c3){if(!_0x1309c3){throw new db[(_0x1ed4('0x83'))][(_0x1ed4('0x52'))](_0x1ed4('0x84'));}if(!_0x1309c3[_0x1ed4('0x85')]||!_0x1309c3[_0x1ed4('0x86')]){throw new db['Sequelize'][(_0x1ed4('0x52'))](_0x1ed4('0x87'));}_0x204789=_0x1309c3;return getBucketslist(_0x204789[_0x1ed4('0x85')],_0x204789[_0x1ed4('0x86')],_0x7ac873['transcribeRegion']);})[_0x1ed4('0x24')](function(_0x237b82){if(_0x237b82&&_0x237b82[_0x1ed4('0x88')]){var _0x38a45e=_[_0x1ed4('0x45')](_0x237b82[_0x1ed4('0x88')],function(_0x5a284e){return _0x5a284e[_0x1ed4('0x89')]===_0x7ac873[_0x1ed4('0x70')];});if(!_0x38a45e){logger[_0x1ed4('0x63')](util['format'](_0x1ed4('0x8a'),_0x334602[_0x1ed4('0x43')]['id'],_0x7ac873[_0x1ed4('0x70')]));return createBucket(_0x204789[_0x1ed4('0x85')],_0x204789[_0x1ed4('0x86')],_0x7ac873[_0x1ed4('0x7d')],_0x7ac873['bucket']);}logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')](_0x1ed4('0x8b'),_0x334602[_0x1ed4('0x43')]['id'],_0x7ac873['bucket']));return;}})[_0x1ed4('0x24')](function(_0x257101){if(_0x2562da['transcribeStatus']===_0x1ed4('0x8c')){return transcribe(_0x334602['params']['id'],_0x204789['data1'],_0x204789['data2'],_0x7ac873[_0x1ed4('0x7d')],_0x7ac873['bucket'],_0x2562da[_0x1ed4('0x4c')],_0x7ac873[_0x1ed4('0x7e')]);}else{logger[_0x1ed4('0x63')](util[_0x1ed4('0x4d')](_0x1ed4('0x8d'),_0x334602[_0x1ed4('0x43')]['id']));return{'transcribeStatus':_0x1ed4('0x8e')};}})['then'](function(_0x4f864e){if(_0x4f864e){_0x4f864e[_0x1ed4('0x8f')]=_0x334602[_0x1ed4('0x48')][_0x1ed4('0x90')];return _0x2562da[_0x1ed4('0x91')](_0x4f864e);}})[_0x1ed4('0x24')](respondWithResult(_0x3edf5b,null))['catch'](handleError(_0x3edf5b,null));};function writeFile(_0x4a61e9,_0x586b5a){return new Promise(function(_0x3ef2e,_0x35bb0c){fs[_0x1ed4('0x92')](_0x586b5a,_0x4a61e9,function(_0x37b174,_0x3bc3e9){if(_0x37b174){return _0x35bb0c(_0x37b174);}else{return _0x3ef2e(_0x3bc3e9);}});});}exports[_0x1ed4('0x93')]=function(_0x19a79b,_0x1800fa,_0x11e7bb){return db[_0x1ed4('0x2a')]['findOne']({'where':{'id':_0x19a79b[_0x1ed4('0x43')]['id']}})[_0x1ed4('0x24')](handleEntityNotFound(_0x1800fa))['then'](function(_0x316f24){if(_0x316f24&&_0x316f24[_0x1ed4('0x94')]){var _0x1c64a1=_0x316f24[_0x1ed4('0x94')];var _0x118c1a=config[_0x1ed4('0x95')]+'/server/files/transcribes/transcribe_'+_0x316f24['id']+'.txt';if(fs[_0x1ed4('0x4e')](_0x118c1a)){return _0x118c1a;}return writeFile(_0x1c64a1,_0x118c1a)['then'](function(){return _0x118c1a;});}else{throw new db[(_0x1ed4('0x83'))][(_0x1ed4('0x52'))](_0x1ed4('0x96'));}})[_0x1ed4('0x24')](function(_0x594004){return _0x1800fa[_0x1ed4('0x4a')](_0x594004);})[_0x1ed4('0x46')](handleError(_0x1800fa));}; \ No newline at end of file +var _0xa2a6=['transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','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','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','aws-sdk','uuid/v4','../../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','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','differenceBy','map','format','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','findOne','Setting','transcribe'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0xa2a6,0x14b));var _0x6a2a=function(_0x3b1253,_0xdf87e0){_0x3b1253=_0x3b1253-0x0;var _0x1f5132=_0xa2a6[_0x3b1253];return _0x1f5132;};'use strict';var emlformat=require(_0x6a2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a2a('0x1'));var jsonpatch=require(_0x6a2a('0x2'));var rp=require(_0x6a2a('0x3'));var moment=require(_0x6a2a('0x4'));var BPromise=require(_0x6a2a('0x5'));var Mustache=require(_0x6a2a('0x6'));var util=require(_0x6a2a('0x7'));var path=require(_0x6a2a('0x8'));var sox=require(_0x6a2a('0x9'));var csv=require(_0x6a2a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a2a('0xb'));var squel=require(_0x6a2a('0xc'));var crypto=require(_0x6a2a('0xd'));var jsforce=require(_0x6a2a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a2a('0xa'));var querystring=require('querystring');var Papa=require(_0x6a2a('0xf'));var AWS=require(_0x6a2a('0x10'));var uuidv4=require(_0x6a2a('0x11'));var Redis=require('ioredis');var authService=require(_0x6a2a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a2a('0x13'));var hardwareService=require(_0x6a2a('0x14'));var logger=require(_0x6a2a('0x15'))(_0x6a2a('0x16'));var utils=require(_0x6a2a('0x17'));var config=require(_0x6a2a('0x18'));var licenseUtil=require(_0x6a2a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28edca,_0x16e711){_0x16e711=_0x16e711||0xcc;return function(_0x2943f1){if(_0x2943f1){return _0x28edca[_0x6a2a('0x1a')](_0x16e711);}return _0x28edca[_0x6a2a('0x1b')](_0x16e711)[_0x6a2a('0x1c')]();};}function respondWithResult(_0x35908a,_0x2b4a2e){_0x2b4a2e=_0x2b4a2e||0xc8;return function(_0x1bf1c7){if(_0x1bf1c7){return _0x35908a[_0x6a2a('0x1b')](_0x2b4a2e)[_0x6a2a('0x1d')](_0x1bf1c7);}};}function respondWithFilteredResult(_0x1af223,_0x173f96){return function(_0x1e0cf1){if(_0x1e0cf1){var _0x27257f=typeof _0x173f96[_0x6a2a('0x1e')]===_0x6a2a('0x1f')&&typeof _0x173f96['limit']===_0x6a2a('0x1f');var _0x20d9c8=_0x1e0cf1['count'];var _0x56d68d=_0x27257f?0x0:_0x173f96['offset'];var _0x328e74=_0x27257f?_0x1e0cf1[_0x6a2a('0x20')]:_0x173f96[_0x6a2a('0x1e')]+_0x173f96[_0x6a2a('0x21')];var _0x4d9614;if(_0x328e74>=_0x20d9c8){_0x328e74=_0x20d9c8;_0x4d9614=0xc8;}else{_0x4d9614=0xce;}_0x1af223['status'](_0x4d9614);return _0x1af223[_0x6a2a('0x22')](_0x6a2a('0x23'),_0x56d68d+'-'+_0x328e74+'/'+_0x20d9c8)[_0x6a2a('0x1d')](_0x1e0cf1);}return null;};}function patchUpdates(_0x235613){return function(_0x120ca3){try{jsonpatch['apply'](_0x120ca3,_0x235613,!![]);}catch(_0x4323ce){return BPromise[_0x6a2a('0x24')](_0x4323ce);}return _0x120ca3[_0x6a2a('0x25')]();};}function saveUpdates(_0x765df8,_0x279f1e){return function(_0x49cf72){if(_0x49cf72){return _0x49cf72['update'](_0x765df8)[_0x6a2a('0x26')](function(_0x264761){return _0x264761;});}return null;};}function removeEntity(_0x531ff1,_0x15d5d2){return function(_0x56c062){if(_0x56c062){return _0x56c062[_0x6a2a('0x27')]()['then'](function(){_0x531ff1[_0x6a2a('0x1b')](0xcc)[_0x6a2a('0x1c')]();});}};}function handleEntityNotFound(_0x28053a,_0x3f3744){return function(_0x147fb6){if(!_0x147fb6){_0x28053a[_0x6a2a('0x1a')](0x194);}return _0x147fb6;};}function handleError(_0x4a6357,_0x585293){_0x585293=_0x585293||0x1f4;return function(_0x2bce8b){logger[_0x6a2a('0x28')](_0x2bce8b[_0x6a2a('0x29')]);if(_0x2bce8b['name']){delete _0x2bce8b[_0x6a2a('0x2a')];}_0x4a6357[_0x6a2a('0x1b')](_0x585293)[_0x6a2a('0x2b')](_0x2bce8b);};}exports[_0x6a2a('0x2c')]=function(_0x26a8ac,_0x594855){var _0x105dbc={},_0x51d9b2={},_0xee842b={'count':0x0,'rows':[]};var _0x17b0f7=_['map'](db['VoiceRecording'][_0x6a2a('0x2d')],function(_0x1f8029){return{'name':_0x1f8029[_0x6a2a('0x2e')],'type':_0x1f8029[_0x6a2a('0x2f')]['key']};});_0x51d9b2['model']=_[_0x6a2a('0x30')](_[_0x6a2a('0x31')](_0x17b0f7,_0x6a2a('0x2a')),[_0x6a2a('0x32')]);_0x51d9b2['query']=_[_0x6a2a('0x33')](_0x26a8ac[_0x6a2a('0x34')]);_0x51d9b2['filters']=_[_0x6a2a('0x35')](_0x51d9b2[_0x6a2a('0x36')],_0x51d9b2[_0x6a2a('0x34')]);_0x105dbc[_0x6a2a('0x37')]=_[_0x6a2a('0x35')](_0x51d9b2[_0x6a2a('0x36')],qs['fields'](_0x26a8ac['query'][_0x6a2a('0x38')]));_0x105dbc[_0x6a2a('0x37')]=_0x105dbc[_0x6a2a('0x37')][_0x6a2a('0x39')]?_0x105dbc[_0x6a2a('0x37')]:_0x51d9b2[_0x6a2a('0x36')];if(!_0x26a8ac['query']['hasOwnProperty'](_0x6a2a('0x3a'))){_0x105dbc[_0x6a2a('0x21')]=qs[_0x6a2a('0x21')](_0x26a8ac[_0x6a2a('0x34')][_0x6a2a('0x21')]);_0x105dbc[_0x6a2a('0x1e')]=qs[_0x6a2a('0x1e')](_0x26a8ac[_0x6a2a('0x34')][_0x6a2a('0x1e')]);}_0x105dbc[_0x6a2a('0x3b')]=qs[_0x6a2a('0x3c')](_0x26a8ac['query'][_0x6a2a('0x3c')]);_0x105dbc[_0x6a2a('0x3d')]=qs[_0x6a2a('0x3e')](_[_0x6a2a('0x3f')](_0x26a8ac[_0x6a2a('0x34')],_0x51d9b2[_0x6a2a('0x3e')]),_0x17b0f7);if(_0x26a8ac['query'][_0x6a2a('0x40')]){_0x105dbc[_0x6a2a('0x3d')]=_[_0x6a2a('0x41')](_0x105dbc[_0x6a2a('0x3d')],{'$or':_[_0x6a2a('0x31')](_0x17b0f7,function(_0x3f1637){if(_0x3f1637[_0x6a2a('0x2f')]!=='VIRTUAL'){var _0x21f234={};_0x21f234[_0x3f1637[_0x6a2a('0x2a')]]={'$like':'%'+_0x26a8ac['query'][_0x6a2a('0x40')]+'%'};return _0x21f234;}})});}_0x105dbc=_[_0x6a2a('0x41')]({},_0x105dbc,_0x26a8ac[_0x6a2a('0x42')]);var _0x27fedf={'where':_0x105dbc['where']};return db[_0x6a2a('0x43')]['count'](_0x27fedf)[_0x6a2a('0x26')](function(_0x205efb){_0xee842b[_0x6a2a('0x20')]=_0x205efb;if(_0x26a8ac[_0x6a2a('0x34')][_0x6a2a('0x44')]){_0x105dbc[_0x6a2a('0x45')]=[{'all':!![]}];}return db[_0x6a2a('0x43')][_0x6a2a('0x46')](_0x105dbc);})[_0x6a2a('0x26')](function(_0x30df98){_0xee842b[_0x6a2a('0x47')]=_0x30df98;return _0xee842b;})[_0x6a2a('0x26')](respondWithFilteredResult(_0x594855,_0x105dbc))[_0x6a2a('0x48')](handleError(_0x594855,null));};exports[_0x6a2a('0x49')]=function(_0x287341,_0x50668f){var _0x3da22e={'raw':![],'where':{'id':_0x287341[_0x6a2a('0x4a')]['id']}},_0x2e1e2d={};_0x2e1e2d[_0x6a2a('0x36')]=_[_0x6a2a('0x33')](db[_0x6a2a('0x43')][_0x6a2a('0x2d')]);_0x2e1e2d[_0x6a2a('0x34')]=_[_0x6a2a('0x33')](_0x287341[_0x6a2a('0x34')]);_0x2e1e2d[_0x6a2a('0x3e')]=_[_0x6a2a('0x35')](_0x2e1e2d['model'],_0x2e1e2d[_0x6a2a('0x34')]);_0x3da22e['attributes']=_['intersection'](_0x2e1e2d[_0x6a2a('0x36')],qs[_0x6a2a('0x38')](_0x287341[_0x6a2a('0x34')][_0x6a2a('0x38')]));_0x3da22e[_0x6a2a('0x37')]=_0x3da22e[_0x6a2a('0x37')][_0x6a2a('0x39')]?_0x3da22e[_0x6a2a('0x37')]:_0x2e1e2d[_0x6a2a('0x36')];if(_0x287341[_0x6a2a('0x34')][_0x6a2a('0x44')]){_0x3da22e[_0x6a2a('0x45')]=[{'all':!![]}];}_0x3da22e=_[_0x6a2a('0x41')]({},_0x3da22e,_0x287341[_0x6a2a('0x42')]);return db['VoiceRecording'][_0x6a2a('0x4b')](_0x3da22e)[_0x6a2a('0x26')](handleEntityNotFound(_0x50668f,null))['then'](respondWithResult(_0x50668f,null))[_0x6a2a('0x48')](handleError(_0x50668f,null));};exports[_0x6a2a('0x4c')]=function(_0x45b67c,_0x3926f2){return db['VoiceRecording'][_0x6a2a('0x4c')](_0x45b67c[_0x6a2a('0x4d')],{})['then'](respondWithResult(_0x3926f2,0xc9))[_0x6a2a('0x48')](handleError(_0x3926f2,null));};exports[_0x6a2a('0x4e')]=function(_0x3fc261,_0x34570f){if(_0x3fc261[_0x6a2a('0x4d')]['id']){delete _0x3fc261[_0x6a2a('0x4d')]['id'];}return db['VoiceRecording'][_0x6a2a('0x4b')]({'where':{'id':_0x3fc261[_0x6a2a('0x4a')]['id']}})[_0x6a2a('0x26')](handleEntityNotFound(_0x34570f,null))[_0x6a2a('0x26')](saveUpdates(_0x3fc261['body'],null))[_0x6a2a('0x26')](respondWithResult(_0x34570f,null))['catch'](handleError(_0x34570f,null));};exports[_0x6a2a('0x4f')]=function(_0x3d4413,_0x3a20fe){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0x3a20fe,null))[_0x6a2a('0x48')](handleError(_0x3a20fe,null));};exports[_0x6a2a('0x50')]=function(_0x1e7966,_0x116cbc,_0x4ca8e4){var _0x5459ff=require(_0x6a2a('0x51'));var _0x5b87c9=![];var _0x5d06d6={};if(_0x1e7966[_0x6a2a('0x34')][_0x6a2a('0x2f')]&&_0x1e7966['query'][_0x6a2a('0x2f')]==='uniqueid'){_0x5d06d6[_0x6a2a('0x52')]=_0x1e7966[_0x6a2a('0x4a')]['id'];}else{_0x5d06d6['id']=_0x1e7966[_0x6a2a('0x4a')]['id'];}return db['VoiceRecording'][_0x6a2a('0x4b')]({'where':_0x5d06d6,'attributes':['id',_0x6a2a('0x53')],'raw':!![]})[_0x6a2a('0x26')](handleEntityNotFound(_0x116cbc,null))['then'](function(_0x32e2a9){if(_0x32e2a9){var _0x1b1329=_0x32e2a9[_0x6a2a('0x53')];var _0x3023d0=util[_0x6a2a('0x32')](_0x6a2a('0x54'),_0x1b1329);if(fs['existsSync'](_0x3023d0)){_0x5b87c9=!![];return _0x5459ff[_0x6a2a('0x55')](_0x3023d0,_0x1b1329,config[_0x6a2a('0x56')][_0x6a2a('0x57')])['then'](function(){return _0x32e2a9;});}return _0x32e2a9;}})[_0x6a2a('0x26')](function(_0x322a80){if(_0x322a80){var _0x532d6f=_0x322a80[_0x6a2a('0x53')];if(!fs[_0x6a2a('0x58')](_0x532d6f)){throw new db[(_0x6a2a('0x59'))]['ValidationError'](_0x6a2a('0x5a'));}if(_0x322a80[_0x6a2a('0x5b')]){return _0x116cbc[_0x6a2a('0x50')](_0x532d6f,_0x322a80[_0x6a2a('0x5b')]+path[_0x6a2a('0x5c')](_0x532d6f),function(){if(_0x5b87c9){fs[_0x6a2a('0x5d')](_0x532d6f);}});}else{return _0x116cbc[_0x6a2a('0x50')](_0x532d6f,function(_0x23b070){if(_0x5b87c9){fs[_0x6a2a('0x5d')](_0x532d6f);}});}}})[_0x6a2a('0x48')](function(_0xb10c8c){if(_0xb10c8c[_0x6a2a('0x5e')]===_0x6a2a('0x5a')){_0x116cbc[_0x6a2a('0x1b')](0x194)[_0x6a2a('0x2b')](_0x6a2a('0x5f'));}else{return handleError(_0x116cbc,null);}});};exports[_0x6a2a('0x60')]=function(_0x45d42b,_0x40fe12,_0x17672d){var _0x30d8e3=require(_0x6a2a('0x51'));var _0x1751d5=![];var _0x3688ab={'$and':[db[_0x6a2a('0x61')]['where'](db[_0x6a2a('0x61')]['fn'](_0x6a2a('0x62'),db[_0x6a2a('0x61')][_0x6a2a('0x63')](_0x6a2a('0x52'))),_0x45d42b[_0x6a2a('0x34')][_0x6a2a('0x64')])]};if(_0x45d42b['query']['type']&&_0x45d42b[_0x6a2a('0x34')]['type']===_0x6a2a('0x52')){_0x3688ab[_0x6a2a('0x65')][_0x6a2a('0x66')]({'uniqueid':_0x45d42b[_0x6a2a('0x4a')]['id']});}else{_0x3688ab[_0x6a2a('0x65')][_0x6a2a('0x66')]({'id':_0x45d42b[_0x6a2a('0x4a')]['id']});}return db['VoiceRecording'][_0x6a2a('0x4b')]({'where':_0x3688ab,'attributes':['id',_0x6a2a('0x53')],'raw':!![]})[_0x6a2a('0x26')](handleEntityNotFound(_0x40fe12,null))[_0x6a2a('0x26')](function(_0x54e902){if(_0x54e902){var _0x3955bc=util[_0x6a2a('0x32')](_0x6a2a('0x54'),_0x54e902[_0x6a2a('0x53')]);if(fs[_0x6a2a('0x58')](_0x3955bc)){_0x1751d5=!![];return _0x30d8e3['decryptFile'](_0x3955bc,_0x54e902[_0x6a2a('0x53')],config['secrets'][_0x6a2a('0x57')])[_0x6a2a('0x26')](function(){return _0x54e902;});}return _0x54e902;}})[_0x6a2a('0x26')](function(_0x442340){if(_0x442340){if(!fs[_0x6a2a('0x58')](_0x442340[_0x6a2a('0x53')])){throw new db[(_0x6a2a('0x59'))][(_0x6a2a('0x67'))]('VoiceRecording\x20not\x20found');}if(_0x442340[_0x6a2a('0x5b')]){return _0x40fe12[_0x6a2a('0x50')](_0x442340[_0x6a2a('0x53')],_0x442340['filename']+path[_0x6a2a('0x5c')](_0x442340[_0x6a2a('0x53')]),function(){if(_0x1751d5){fs[_0x6a2a('0x5d')](_0x442340[_0x6a2a('0x53')]);}});}else{return _0x40fe12['download'](_0x442340[_0x6a2a('0x53')],function(_0x4818f5){if(_0x1751d5){fs[_0x6a2a('0x5d')](_0x442340[_0x6a2a('0x53')]);}});}}})[_0x6a2a('0x48')](handleError(_0x40fe12,null));};exports[_0x6a2a('0x27')]=function(_0x38a7c5,_0x56b898){return db[_0x6a2a('0x43')][_0x6a2a('0x4b')]({'where':{'id':_0x38a7c5['params']['id']}})[_0x6a2a('0x26')](function(_0x3b31f8){if(_[_0x6a2a('0x68')](_0x3b31f8)){throw new ReferenceError(_0x6a2a('0x69'));}return _0x3b31f8;})[_0x6a2a('0x26')](function(_0x594992){var _0x2cffa5=_0x594992[_0x6a2a('0x53')];logger[_0x6a2a('0x6a')](_0x6a2a('0x6b'),_0x2cffa5);if(!_[_0x6a2a('0x68')](_0x594992['value'])&&fs['existsSync'](_0x2cffa5)){logger['info'](_0x6a2a('0x6c')+_0x2cffa5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x2cffa5);}_0x2cffa5=_0x2cffa5+_0x6a2a('0x6d');if(!_[_0x6a2a('0x68')](_0x594992[_0x6a2a('0x53')])&&fs[_0x6a2a('0x58')](_0x2cffa5)){logger[_0x6a2a('0x6a')](_0x6a2a('0x6c')+_0x2cffa5+_0x6a2a('0x6e'));fs['unlinkSync'](_0x2cffa5);}return _0x594992;})['then'](function(_0x2a3264){if(!_0x2a3264)throw new InternalError();return _0x2a3264[_0x6a2a('0x27')]();})[_0x6a2a('0x26')](function(){_0x56b898['status'](0xcc)[_0x6a2a('0x1c')]();})[_0x6a2a('0x48')](handleError(_0x56b898,null));};function getBucketslist(_0x42a7ba,_0x3e50b5,_0x11332e){return new Promise(function(_0x133cf4,_0x19a582){var _0x50eecb=new AWS['S3']({'accessKeyId':_0x3e50b5,'secretAccessKey':_0x42a7ba,'region':_0x11332e});_0x50eecb[_0x6a2a('0x6f')]({},function(_0x37db12,_0x415cc7){if(_0x37db12){return _0x19a582(_0x37db12);}else{return _0x133cf4(_0x415cc7);}});});}function createBucket(_0x259de6,_0x398116,_0x5b0f4a,_0x1a0dac){return new Promise(function(_0x2e0991,_0x327ae9){var _0x5011bb=new AWS['S3']({'accessKeyId':_0x398116,'secretAccessKey':_0x259de6,'region':_0x5b0f4a});_0x5011bb['createBucket']({'Bucket':_0x1a0dac},function(_0x565f45,_0x498591){if(_0x565f45){return _0x327ae9(_0x565f45);}else{return _0x2e0991(_0x498591);}});});}function uploadFile(_0x51117f,_0x2f9b2f,_0x5b61e3,_0x2227f5,_0x4adceb,_0x258fd9){return new Promise(function(_0x4272ec,_0x5e06b8){var _0x2d5046=new AWS['S3']({'accessKeyId':_0x2f9b2f,'secretAccessKey':_0x51117f,'region':_0x5b61e3});_0x2d5046[_0x6a2a('0x70')]({'Bucket':_0x2227f5,'Key':_0x4adceb,'Body':_0x258fd9},function(_0x1c8a94,_0x4134b8){if(_0x1c8a94){return _0x5e06b8(_0x1c8a94);}else{return _0x4272ec(_0x4134b8);}});});}function startTranscribe(_0x36c0d6,_0x2947c7,_0x4b40c3,_0x5c4a4e,_0x507b43,_0x2c9e9f){return new Promise(function(_0x1b914d,_0x1a3764){var _0x54f8db=new AWS[(_0x6a2a('0x71'))]({'accessKeyId':_0x2947c7,'secretAccessKey':_0x36c0d6,'region':_0x4b40c3});_0x54f8db[_0x6a2a('0x72')]({'TranscriptionJobName':_0x5c4a4e,'LanguageCode':_0x507b43,'Media':{'MediaFileUri':_0x2c9e9f}},function(_0x57df88,_0x489fd1){if(_0x57df88){return _0x1a3764(_0x57df88);}else{return _0x1b914d(_0x489fd1);}});});}function transcribe(_0x44fc7e,_0x696ee3,_0x4792f2,_0x2838f7,_0x245a17,_0x16eefd,_0x31fa4d){return new Promise(function(_0x65f3b1,_0x53fe2f){var _0xc429dd={};logger[_0x6a2a('0x6a')](util['format'](_0x6a2a('0x73'),_0x44fc7e,_0x245a17));return uploadFile(_0x696ee3,_0x4792f2,_0x2838f7,_0x245a17,path['basename'](_0x16eefd),fs[_0x6a2a('0x74')](_0x16eefd))[_0x6a2a('0x26')](function(_0x2dcfd6){logger[_0x6a2a('0x6a')](util[_0x6a2a('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x44fc7e,_0x245a17,_0x2dcfd6[_0x6a2a('0x75')]));_0xc429dd[_0x6a2a('0x76')]=_0x2dcfd6['Bucket'];_0xc429dd[_0x6a2a('0x77')]=_0x2dcfd6[_0x6a2a('0x75')];logger[_0x6a2a('0x6a')](util[_0x6a2a('0x32')](_0x6a2a('0x78'),_0x44fc7e));return startTranscribe(_0x696ee3,_0x4792f2,_0x2838f7,uuidv4(),_0x31fa4d,_0x2dcfd6['Location']);})[_0x6a2a('0x26')](function(_0x29e765){logger['info'](util[_0x6a2a('0x32')](_0x6a2a('0x79'),_0x44fc7e,_0x29e765[_0x6a2a('0x7a')][_0x6a2a('0x7b')]));_0xc429dd['transcribeName']=_0x29e765[_0x6a2a('0x7a')][_0x6a2a('0x7b')];_0xc429dd['transcribeStatus']=_0x29e765[_0x6a2a('0x7a')]['TranscriptionJobStatus'];return _0x65f3b1(_0xc429dd);})['catch'](function(_0xc350b0){return _0x53fe2f(_0xc350b0);});});}exports[_0x6a2a('0x7c')]=function(_0x29b1a3,_0x1b2764,_0xce6d4){var _0x4746f4;var _0x2d3fce;var _0xf5d8e2;var _0xeb8838=require(_0x6a2a('0x51'));return db[_0x6a2a('0x43')][_0x6a2a('0x7d')]({'where':{'id':_0x29b1a3[_0x6a2a('0x4a')]['id']}})['then'](function(_0x5b43b5){if(_0x5b43b5){var _0x14706c=util[_0x6a2a('0x32')](_0x6a2a('0x54'),_0x5b43b5[_0x6a2a('0x53')]);if(fs[_0x6a2a('0x58')](_0x14706c)){cypher=!![];return _0xeb8838[_0x6a2a('0x55')](_0x14706c,_0x5b43b5['value'],config['secrets'][_0x6a2a('0x57')])[_0x6a2a('0x26')](function(){return _0x5b43b5;});}return _0x5b43b5;}})[_0x6a2a('0x26')](function(_0x18ebbd){if(!_0x18ebbd){throw new db[(_0x6a2a('0x59'))][(_0x6a2a('0x67'))]('Voice\x20Recording\x20not\x20found');}_0x2d3fce=_0x18ebbd;return db[_0x6a2a('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x6a2a('0x26')](handleEntityNotFound(_0x1b2764,null))[_0x6a2a('0x26')](function(_0x3590d8){if(_0x3590d8){_0x4746f4=_0x3590d8;if(!_0x4746f4[_0x6a2a('0x7f')]||!_0x4746f4[_0x6a2a('0x80')]||!_0x4746f4[_0x6a2a('0x81')]||!_0x4746f4['language']||!_0x4746f4[_0x6a2a('0x76')]){throw new db['Sequelize'][(_0x6a2a('0x67'))]('Transcribe\x20not\x20configured');}if(_0x29b1a3[_0x6a2a('0x4d')][_0x6a2a('0x82')]&&(!_0x4746f4[_0x6a2a('0x83')]||!_0x4746f4['sentimentAccountId']||!_0x4746f4[_0x6a2a('0x84')]||!_0x4746f4['language']||!_0x4746f4[_0x6a2a('0x76')])){throw new db[(_0x6a2a('0x59'))][(_0x6a2a('0x67'))](_0x6a2a('0x85'));}return db['CloudProvider'][_0x6a2a('0x7d')]({'where':{'id':_0x4746f4[_0x6a2a('0x80')]}});}})[_0x6a2a('0x26')](function(_0x36e4ba){if(!_0x36e4ba){throw new db[(_0x6a2a('0x59'))]['ValidationError'](_0x6a2a('0x86'));}if(!_0x36e4ba[_0x6a2a('0x87')]||!_0x36e4ba[_0x6a2a('0x88')]){throw new db[(_0x6a2a('0x59'))][(_0x6a2a('0x67'))](_0x6a2a('0x89'));}_0xf5d8e2=_0x36e4ba;return getBucketslist(_0xf5d8e2[_0x6a2a('0x87')],_0xf5d8e2[_0x6a2a('0x88')],_0x4746f4['transcribeRegion']);})[_0x6a2a('0x26')](function(_0x3337e8){if(_0x3337e8&&_0x3337e8[_0x6a2a('0x8a')]){var _0x29ba4d=_[_0x6a2a('0x4b')](_0x3337e8[_0x6a2a('0x8a')],function(_0x5519f0){return _0x5519f0[_0x6a2a('0x8b')]===_0x4746f4[_0x6a2a('0x76')];});if(!_0x29ba4d){logger[_0x6a2a('0x6a')](util[_0x6a2a('0x32')](_0x6a2a('0x8c'),_0x29b1a3[_0x6a2a('0x4a')]['id'],_0x4746f4[_0x6a2a('0x76')]));return createBucket(_0xf5d8e2[_0x6a2a('0x87')],_0xf5d8e2[_0x6a2a('0x88')],_0x4746f4[_0x6a2a('0x81')],_0x4746f4['bucket']);}logger['info'](util['format'](_0x6a2a('0x8d'),_0x29b1a3[_0x6a2a('0x4a')]['id'],_0x4746f4[_0x6a2a('0x76')]));return;}})[_0x6a2a('0x26')](function(_0x3836cd){if(_0x2d3fce['transcribeStatus']===_0x6a2a('0x8e')){return transcribe(_0x29b1a3['params']['id'],_0xf5d8e2[_0x6a2a('0x87')],_0xf5d8e2[_0x6a2a('0x88')],_0x4746f4[_0x6a2a('0x81')],_0x4746f4['bucket'],_0x2d3fce[_0x6a2a('0x53')],_0x4746f4['language']);}else{logger[_0x6a2a('0x6a')](util[_0x6a2a('0x32')](_0x6a2a('0x8f'),_0x29b1a3[_0x6a2a('0x4a')]['id']));return{'transcribeStatus':_0x6a2a('0x90')};}})[_0x6a2a('0x26')](function(_0x563727){if(_0x563727){_0x563727[_0x6a2a('0x91')]=_0x29b1a3['body'][_0x6a2a('0x82')];return _0x2d3fce['updateAttributes'](_0x563727);}})['then'](respondWithResult(_0x1b2764,null))[_0x6a2a('0x48')](handleError(_0x1b2764,null));};function writeFile(_0x404aff,_0x112283){return new Promise(function(_0x56e6a8,_0x84139c){fs[_0x6a2a('0x92')](_0x112283,_0x404aff,function(_0x500273,_0x3064fe){if(_0x500273){return _0x84139c(_0x500273);}else{return _0x56e6a8(_0x3064fe);}});});}exports[_0x6a2a('0x93')]=function(_0x2715b3,_0x1b6ba0,_0x204a6e){return db['VoiceRecording'][_0x6a2a('0x7d')]({'where':{'id':_0x2715b3['params']['id']}})['then'](handleEntityNotFound(_0x1b6ba0))[_0x6a2a('0x26')](function(_0x33bddf){if(_0x33bddf&&_0x33bddf[_0x6a2a('0x94')]){var _0x2ec89c=_0x33bddf['fileText'];var _0x529426=config[_0x6a2a('0x95')]+_0x6a2a('0x96')+_0x33bddf['id']+_0x6a2a('0x97');if(fs['existsSync'](_0x529426)){return _0x529426;}return writeFile(_0x2ec89c,_0x529426)[_0x6a2a('0x26')](function(){return _0x529426;});}else{throw new db[(_0x6a2a('0x59'))][(_0x6a2a('0x67'))](_0x6a2a('0x98'));}})['then'](function(_0x43d398){return _0x1b6ba0[_0x6a2a('0x50')](_0x43d398);})[_0x6a2a('0x48')](handleError(_0x1b6ba0));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6b6fd00..e9e472d 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 _0x0eaa=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x457bdf,_0xa7fd08){_0x457bdf=_0x457bdf-0x0;var _0xcd434a=_0x0eaa[_0x457bdf];return _0xcd434a;};'use strict';var attributes=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]=function(_0x565be6,_0x5ceeb7){return _0x565be6[_0xa0ea('0x2')](_0xa0ea('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xa0ea('0x4'),'fields':[_0xa0ea('0x4')]},{'name':_0xa0ea('0x5'),'fields':[_0xa0ea('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7333=['./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x316688,_0x35d368){var _0x6ca93d=function(_0x2b3f52){while(--_0x2b3f52){_0x316688['push'](_0x316688['shift']());}};_0x6ca93d(++_0x35d368);}(_0x7333,0xfc));var _0x3733=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7333[_0x4565bf];return _0x5610ba;};'use strict';var attributes=require(_0x3733('0x0'));module['exports']=function(_0x42c214,_0x51cf3a){return _0x42c214[_0x3733('0x1')](_0x3733('0x2'),attributes,{'tableName':_0x3733('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3733('0x4')]},{'name':_0x3733('0x5'),'fields':[_0x3733('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 170ba44..b89e6c5 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 _0xc6ac=['Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','stringify','catch','CreateVoiceRecording','../../components/encryptor'];(function(_0xcf139b,_0x1eacb8){var _0x4a72ae=function(_0x46e62d){while(--_0x46e62d){_0xcf139b['push'](_0xcf139b['shift']());}};_0x4a72ae(++_0x1eacb8);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2be30d,_0x1d1182){_0x2be30d=_0x2be30d-0x0;var _0x182162=_0xc6ac[_0x2be30d];return _0x182162;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')](_0x33079c[_0xcc6a('0x1b')],{'raw':_0x33079c['options']?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1e')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1f')]||null:null,'limit':_0x33079c[_0xcc6a('0x1c')]?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x20')]||null:null})[_0xcc6a('0xf')](function(_0x51be9a){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger[_0xcc6a('0x12')]('UpdateVoiceRecording',_0x33079c,JSON[_0xcc6a('0x21')](_0x51be9a));_0x2d9585(_0x51be9a);})[_0xcc6a('0x22')](function(_0x3a00e5){logger[_0xcc6a('0x15')](_0xcc6a('0x18'),_0x3a00e5[_0xcc6a('0x17')],_0x33079c);_0x412bc7(_0x12ef33['error'](0x1f4,_0x3a00e5[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x23')]=function(_0x3514f3){var _0x5f27e5=this;return new Promise(function(_0x3afb3a,_0x3dad72){var _0x4da301=require(_0xcc6a('0x24'));var _0x8b1b2b;return db[_0xcc6a('0x25')][_0xcc6a('0x26')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xcc6a('0xf')](function(_0x3cf14c){_0x8b1b2b=_0x3cf14c;return db[_0xcc6a('0x19')]['create'](_0x3514f3[_0xcc6a('0x1b')]);})['then'](function(_0x4f67d3){if(_0x8b1b2b[_0xcc6a('0x27')]&&fs[_0xcc6a('0x28')](_0x4f67d3[_0xcc6a('0x29')])){var _0x11b481=util[_0xcc6a('0x2a')](_0xcc6a('0x2b'),_0x4f67d3['value']);return _0x4da301[_0xcc6a('0x2c')](_0x4f67d3[_0xcc6a('0x29')],_0x11b481,config[_0xcc6a('0x2d')][_0xcc6a('0x2e')])[_0xcc6a('0xf')](function(){fs[_0xcc6a('0x2f')](_0x4f67d3[_0xcc6a('0x29')]);logger[_0xcc6a('0x10')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4f67d3;});}return _0x4f67d3;})[_0xcc6a('0xf')](function(_0xc8c90c){logger[_0xcc6a('0x10')](_0xcc6a('0x23'),_0x3514f3);logger[_0xcc6a('0x12')](_0xcc6a('0x23'),_0x3514f3,JSON[_0xcc6a('0x21')](_0xc8c90c));_0x3afb3a(_0xc8c90c);})['catch'](function(_0x5d2287){logger['error']('CreateVoiceRecording',_0x5d2287['message'],_0x3514f3);_0x3dad72(_0x5f27e5[_0xcc6a('0x15')](0x1f4,_0x5d2287[_0xcc6a('0x17')]));});});}; \ No newline at end of file +var _0x8aad=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info'];(function(_0x4bba9f,_0x3e9ca0){var _0x313c71=function(_0x8dea36){while(--_0x8dea36){_0x4bba9f['push'](_0x4bba9f['shift']());}};_0x313c71(++_0x3e9ca0);}(_0x8aad,0x146));var _0xd8aa=function(_0xdddca3,_0x50f8cd){_0xdddca3=_0xdddca3-0x0;var _0x4cec3e=_0x8aad[_0xdddca3];return _0x4cec3e;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});}exports[_0xd8aa('0x14')]=function(_0x32e2cd){var _0x3a29ca=this;return new Promise(function(_0x2d34ac,_0x4953be){return db[_0xd8aa('0x15')][_0xd8aa('0x16')](_0x32e2cd[_0xd8aa('0x17')],{'raw':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')][_0xd8aa('0x1a')]||null:null,'attributes':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x1b')]||null:null,'limit':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')]['limit']||null:null})[_0xd8aa('0x1c')](function(_0x7a4ce7){logger[_0xd8aa('0x9')](_0xd8aa('0x14'),_0x32e2cd);logger[_0xd8aa('0xc')](_0xd8aa('0x14'),_0x32e2cd,JSON[_0xd8aa('0xe')](_0x7a4ce7));_0x2d34ac(_0x7a4ce7);})[_0xd8aa('0x13')](function(_0x375f64){logger[_0xd8aa('0xf')](_0xd8aa('0x14'),_0x375f64[_0xd8aa('0x11')],_0x32e2cd);_0x4953be(_0x3a29ca[_0xd8aa('0xf')](0x1f4,_0x375f64['message']));});});};exports[_0xd8aa('0x1d')]=function(_0x59eb3f){var _0xd4d204=this;return new Promise(function(_0x1f6ab2,_0x26cff3){var _0x3696fd=require(_0xd8aa('0x1e'));var _0x19edee;return db[_0xd8aa('0x1f')][_0xd8aa('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xd8aa('0x1c')](function(_0x34b792){_0x19edee=_0x34b792;return db[_0xd8aa('0x15')]['create'](_0x59eb3f[_0xd8aa('0x17')]);})['then'](function(_0x3052c6){if(_0x19edee[_0xd8aa('0x21')]&&fs[_0xd8aa('0x22')](_0x3052c6[_0xd8aa('0x23')])){var _0x44f783=util[_0xd8aa('0x24')](_0xd8aa('0x25'),_0x3052c6[_0xd8aa('0x23')]);return _0x3696fd['encryptFile'](_0x3052c6[_0xd8aa('0x23')],_0x44f783,config[_0xd8aa('0x26')][_0xd8aa('0x27')])[_0xd8aa('0x1c')](function(){fs[_0xd8aa('0x28')](_0x3052c6[_0xd8aa('0x23')]);logger[_0xd8aa('0x9')](_0xd8aa('0x29'));return _0x3052c6;});}return _0x3052c6;})['then'](function(_0x265217){logger[_0xd8aa('0x9')](_0xd8aa('0x1d'),_0x59eb3f);logger['debug'](_0xd8aa('0x1d'),_0x59eb3f,JSON[_0xd8aa('0xe')](_0x265217));_0x1f6ab2(_0x265217);})[_0xd8aa('0x13')](function(_0x45c216){logger[_0xd8aa('0xf')](_0xd8aa('0x1d'),_0x45c216[_0xd8aa('0x11')],_0x59eb3f);_0x26cff3(_0xd4d204[_0xd8aa('0xf')](0x1f4,_0x45c216[_0xd8aa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 04ccc26..1f12030 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 _0xfc1d=['put','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x45ddc1,_0x5b40cb){var _0x17f3a7=function(_0x288075){while(--_0x288075){_0x45ddc1['push'](_0x45ddc1['shift']());}};_0x17f3a7(++_0x5b40cb);}(_0xfc1d,0x16b));var _0xdfc1=function(_0x121fac,_0x42a298){_0x121fac=_0x121fac-0x0;var _0x5717e3=_0xfc1d[_0x121fac];return _0x5717e3;};'use strict';var multer=require(_0xdfc1('0x0'));var util=require('util');var path=require(_0xdfc1('0x1'));var timeout=require(_0xdfc1('0x2'));var express=require(_0xdfc1('0x3'));var router=express['Router']();var fs_extra=require(_0xdfc1('0x4'));var auth=require(_0xdfc1('0x5'));var interaction=require(_0xdfc1('0x6'));var config=require(_0xdfc1('0x7'));var controller=require(_0xdfc1('0x8'));router[_0xdfc1('0x9')]('/',auth['isAuthenticated'](),controller[_0xdfc1('0xa')]);router[_0xdfc1('0x9')](_0xdfc1('0xb'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0xd')]);router['get'](_0xdfc1('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdfc1('0xf')]('/',auth[_0xdfc1('0xc')](),controller[_0xdfc1('0x10')]);router[_0xdfc1('0x11')](_0xdfc1('0xe'),auth[_0xdfc1('0xc')](),controller['update']);router['delete']('/:id',auth[_0xdfc1('0xc')](),controller['destroy']);module[_0xdfc1('0x12')]=router; \ No newline at end of file +var _0x694e=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x330a51,_0x42c33b){var _0x55aa63=function(_0x5ddc09){while(--_0x5ddc09){_0x330a51['push'](_0x330a51['shift']());}};_0x55aa63(++_0x42c33b);}(_0x694e,0x1ed));var _0xe694=function(_0x1aa04b,_0xa0c822){_0x1aa04b=_0x1aa04b-0x0;var _0x3949d0=_0x694e[_0x1aa04b];return _0x3949d0;};'use strict';var multer=require(_0xe694('0x0'));var util=require(_0xe694('0x1'));var path=require(_0xe694('0x2'));var timeout=require('connect-timeout');var express=require(_0xe694('0x3'));var router=express[_0xe694('0x4')]();var fs_extra=require(_0xe694('0x5'));var auth=require(_0xe694('0x6'));var interaction=require(_0xe694('0x7'));var config=require('../../config/environment');var controller=require(_0xe694('0x8'));router[_0xe694('0x9')]('/',auth[_0xe694('0xa')](),controller[_0xe694('0xb')]);router[_0xe694('0x9')]('/describe',auth[_0xe694('0xa')](),controller[_0xe694('0xc')]);router[_0xe694('0x9')](_0xe694('0xd'),auth[_0xe694('0xa')](),controller[_0xe694('0xe')]);router[_0xe694('0xf')]('/',auth[_0xe694('0xa')](),controller[_0xe694('0x10')]);router[_0xe694('0x11')](_0xe694('0xd'),auth[_0xe694('0xa')](),controller[_0xe694('0x12')]);router[_0xe694('0x13')](_0xe694('0xd'),auth[_0xe694('0xa')](),controller[_0xe694('0x14')]);module[_0xe694('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9faa768..4f66ef7 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 _0x1e0e=['sequelize','moment','exports','ENUM','STRING','Yes'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x1e0e,0x1c8));var _0xe1e0=function(_0x2ef5a8,_0x1e053d){_0x2ef5a8=_0x2ef5a8-0x0;var _0x3608ef=_0x1e0e[_0x2ef5a8];return _0x3608ef;};'use strict';var Sequelize=require(_0xe1e0('0x0'));var moment=require(_0xe1e0('0x1'));module[_0xe1e0('0x2')]={'type':{'type':Sequelize[_0xe1e0('0x3')]('blind','attended')},'result':{'type':Sequelize[_0xe1e0('0x4')]},'transfererchannel':{'type':Sequelize[_0xe1e0('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xe1e0('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe1e0('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xe1e0('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe1e0('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xe1e0('0x4')]},'transfereechannel':{'type':Sequelize[_0xe1e0('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xe1e0('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xe1e0('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xe1e0('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe1e0('0x4')]},'isexternal':{'type':Sequelize[_0xe1e0('0x3')](_0xe1e0('0x5'),'No')},'context':{'type':Sequelize[_0xe1e0('0x4')]},'extension':{'type':Sequelize[_0xe1e0('0x4')]}}; \ No newline at end of file +var _0x2e39=['exports','blind','STRING','ENUM','Yes'];(function(_0x424aba,_0x59764d){var _0x1e91ac=function(_0x345479){while(--_0x345479){_0x424aba['push'](_0x424aba['shift']());}};_0x1e91ac(++_0x59764d);}(_0x2e39,0xeb));var _0x92e3=function(_0x1f4002,_0x5a97a5){_0x1f4002=_0x1f4002-0x0;var _0x5cb534=_0x2e39[_0x1f4002];return _0x5cb534;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x92e3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x92e3('0x1'),'attended')},'result':{'type':Sequelize[_0x92e3('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x92e3('0x2')]},'transferercalleridname':{'type':Sequelize[_0x92e3('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x92e3('0x2')]},'transfererconnectedlinename':{'type':Sequelize[_0x92e3('0x2')]},'transfereraccountcode':{'type':Sequelize[_0x92e3('0x2')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x92e3('0x2')]},'transfereecalleridname':{'type':Sequelize[_0x92e3('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x92e3('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x92e3('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x92e3('0x2')]},'transfereecontext':{'type':Sequelize[_0x92e3('0x2')]},'transfereeexten':{'type':Sequelize[_0x92e3('0x2')]},'transfereelinkedid':{'type':Sequelize[_0x92e3('0x2')]},'isexternal':{'type':Sequelize[_0x92e3('0x3')](_0x92e3('0x4'),'No')},'context':{'type':Sequelize[_0x92e3('0x2')]},'extension':{'type':Sequelize[_0x92e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8fbf89d..08565dd 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 _0x7fb0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x7fb0,0x128));var _0x07fb=function(_0x2ad647,_0x22e3d6){_0x2ad647=_0x2ad647-0x0;var _0x1f33ac=_0x7fb0[_0x2ad647];return _0x1f33ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07fb('0x0'));var zipdir=require(_0x07fb('0x1'));var jsonpatch=require(_0x07fb('0x2'));var rp=require(_0x07fb('0x3'));var moment=require(_0x07fb('0x4'));var BPromise=require(_0x07fb('0x5'));var Mustache=require(_0x07fb('0x6'));var util=require(_0x07fb('0x7'));var path=require(_0x07fb('0x8'));var sox=require(_0x07fb('0x9'));var csv=require(_0x07fb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07fb('0xb'));var _=require(_0x07fb('0xc'));var squel=require('squel');var crypto=require(_0x07fb('0xd'));var jsforce=require(_0x07fb('0xe'));var deskjs=require(_0x07fb('0xf'));var toCsv=require(_0x07fb('0xa'));var querystring=require(_0x07fb('0x10'));var Papa=require(_0x07fb('0x11'));var Redis=require(_0x07fb('0x12'));var authService=require(_0x07fb('0x13'));var qs=require(_0x07fb('0x14'));var as=require(_0x07fb('0x15'));var hardwareService=require(_0x07fb('0x16'));var logger=require('../../config/logger')(_0x07fb('0x17'));var utils=require(_0x07fb('0x18'));var config=require(_0x07fb('0x19'));var licenseUtil=require(_0x07fb('0x1a'));var db=require(_0x07fb('0x1b'))['db'];function respondWithStatusCode(_0x39ef6b,_0x24db4c){_0x24db4c=_0x24db4c||0xcc;return function(_0x3f73f1){if(_0x3f73f1){return _0x39ef6b[_0x07fb('0x1c')](_0x24db4c);}return _0x39ef6b[_0x07fb('0x1d')](_0x24db4c)[_0x07fb('0x1e')]();};}function respondWithResult(_0x5af44a,_0x57d468){_0x57d468=_0x57d468||0xc8;return function(_0x79e9f2){if(_0x79e9f2){return _0x5af44a[_0x07fb('0x1d')](_0x57d468)[_0x07fb('0x1f')](_0x79e9f2);}};}function respondWithFilteredResult(_0x3796a2,_0x23c8ab){return function(_0x1f9eb8){if(_0x1f9eb8){var _0xe2585e=typeof _0x23c8ab[_0x07fb('0x20')]===_0x07fb('0x21')&&typeof _0x23c8ab[_0x07fb('0x22')]===_0x07fb('0x21');var _0x4f7dbf=_0x1f9eb8[_0x07fb('0x23')];var _0x2a2250=_0xe2585e?0x0:_0x23c8ab[_0x07fb('0x20')];var _0x533573=_0xe2585e?_0x1f9eb8[_0x07fb('0x23')]:_0x23c8ab[_0x07fb('0x20')]+_0x23c8ab[_0x07fb('0x22')];var _0x180190;if(_0x533573>=_0x4f7dbf){_0x533573=_0x4f7dbf;_0x180190=0xc8;}else{_0x180190=0xce;}_0x3796a2[_0x07fb('0x1d')](_0x180190);return _0x3796a2[_0x07fb('0x24')]('Content-Range',_0x2a2250+'-'+_0x533573+'/'+_0x4f7dbf)[_0x07fb('0x1f')](_0x1f9eb8);}return null;};}function patchUpdates(_0x5454f2){return function(_0x56cfc4){try{jsonpatch[_0x07fb('0x25')](_0x56cfc4,_0x5454f2,!![]);}catch(_0x2d2bdf){return BPromise['reject'](_0x2d2bdf);}return _0x56cfc4[_0x07fb('0x26')]();};}function saveUpdates(_0x2a3b14,_0x36195b){return function(_0x38bfa1){if(_0x38bfa1){return _0x38bfa1[_0x07fb('0x27')](_0x2a3b14)['then'](function(_0x55d09f){return _0x55d09f;});}return null;};}function removeEntity(_0x43aee3,_0x42def3){return function(_0x286084){if(_0x286084){return _0x286084[_0x07fb('0x28')]()[_0x07fb('0x29')](function(){_0x43aee3['status'](0xcc)[_0x07fb('0x1e')]();});}};}function handleEntityNotFound(_0x394a63,_0x18d9bc){return function(_0x5a9550){if(!_0x5a9550){_0x394a63[_0x07fb('0x1c')](0x194);}return _0x5a9550;};}function handleError(_0xc9a39f,_0x539196){_0x539196=_0x539196||0x1f4;return function(_0x9c09ff){logger[_0x07fb('0x2a')](_0x9c09ff['stack']);if(_0x9c09ff[_0x07fb('0x2b')]){delete _0x9c09ff[_0x07fb('0x2b')];}_0xc9a39f['status'](_0x539196)[_0x07fb('0x2c')](_0x9c09ff);};}exports[_0x07fb('0x2d')]=function(_0x355c3a,_0x387e73){var _0x1be22={},_0x133aba={},_0x10232a={'count':0x0,'rows':[]};var _0x264cc2=_[_0x07fb('0x2e')](db['VoiceTransferReport']['rawAttributes'],function(_0x421b64){return{'name':_0x421b64['fieldName'],'type':_0x421b64[_0x07fb('0x2f')][_0x07fb('0x30')]};});_0x133aba[_0x07fb('0x31')]=_['map'](_0x264cc2,_0x07fb('0x2b'));_0x133aba[_0x07fb('0x32')]=_['keys'](_0x355c3a[_0x07fb('0x32')]);_0x133aba[_0x07fb('0x33')]=_['intersection'](_0x133aba[_0x07fb('0x31')],_0x133aba[_0x07fb('0x32')]);_0x1be22['attributes']=_[_0x07fb('0x34')](_0x133aba[_0x07fb('0x31')],qs[_0x07fb('0x35')](_0x355c3a[_0x07fb('0x32')][_0x07fb('0x35')]));_0x1be22[_0x07fb('0x36')]=_0x1be22[_0x07fb('0x36')][_0x07fb('0x37')]?_0x1be22[_0x07fb('0x36')]:_0x133aba[_0x07fb('0x31')];if(!_0x355c3a[_0x07fb('0x32')][_0x07fb('0x38')]('nolimit')){_0x1be22['limit']=qs['limit'](_0x355c3a[_0x07fb('0x32')]['limit']);_0x1be22[_0x07fb('0x20')]=qs[_0x07fb('0x20')](_0x355c3a['query'][_0x07fb('0x20')]);}_0x1be22[_0x07fb('0x39')]=qs[_0x07fb('0x3a')](_0x355c3a['query'][_0x07fb('0x3a')]);_0x1be22['where']=qs[_0x07fb('0x33')](_[_0x07fb('0x3b')](_0x355c3a[_0x07fb('0x32')],_0x133aba['filters']),_0x264cc2);if(_0x355c3a['query'][_0x07fb('0x3c')]){_0x1be22[_0x07fb('0x3d')]=_[_0x07fb('0x3e')](_0x1be22['where'],{'$or':_['map'](_0x264cc2,function(_0x39b7ea){if(_0x39b7ea[_0x07fb('0x2f')]!==_0x07fb('0x3f')){var _0x56b62b={};_0x56b62b[_0x39b7ea[_0x07fb('0x2b')]]={'$like':'%'+_0x355c3a[_0x07fb('0x32')][_0x07fb('0x3c')]+'%'};return _0x56b62b;}})});}_0x1be22=_[_0x07fb('0x3e')]({},_0x1be22,_0x355c3a[_0x07fb('0x40')]);var _0x44d746={'where':_0x1be22[_0x07fb('0x3d')]};return db['VoiceTransferReport'][_0x07fb('0x23')](_0x44d746)[_0x07fb('0x29')](function(_0x1b64e4){_0x10232a['count']=_0x1b64e4;if(_0x355c3a[_0x07fb('0x32')][_0x07fb('0x41')]){_0x1be22[_0x07fb('0x42')]=[{'all':!![]}];}return db[_0x07fb('0x43')][_0x07fb('0x44')](_0x1be22);})['then'](function(_0x435346){_0x10232a[_0x07fb('0x45')]=_0x435346;return _0x10232a;})[_0x07fb('0x29')](respondWithFilteredResult(_0x387e73,_0x1be22))[_0x07fb('0x46')](handleError(_0x387e73,null));};exports[_0x07fb('0x47')]=function(_0x1adc47,_0x102577){var _0x2f895e={'raw':!![],'where':{'id':_0x1adc47[_0x07fb('0x48')]['id']}},_0x1af7b0={};_0x1af7b0[_0x07fb('0x31')]=_[_0x07fb('0x49')](db[_0x07fb('0x43')]['rawAttributes']);_0x1af7b0[_0x07fb('0x32')]=_['keys'](_0x1adc47[_0x07fb('0x32')]);_0x1af7b0[_0x07fb('0x33')]=_[_0x07fb('0x34')](_0x1af7b0[_0x07fb('0x31')],_0x1af7b0[_0x07fb('0x32')]);_0x2f895e[_0x07fb('0x36')]=_['intersection'](_0x1af7b0[_0x07fb('0x31')],qs[_0x07fb('0x35')](_0x1adc47['query']['fields']));_0x2f895e[_0x07fb('0x36')]=_0x2f895e[_0x07fb('0x36')][_0x07fb('0x37')]?_0x2f895e['attributes']:_0x1af7b0[_0x07fb('0x31')];if(_0x1adc47[_0x07fb('0x32')][_0x07fb('0x41')]){_0x2f895e[_0x07fb('0x42')]=[{'all':!![]}];}_0x2f895e=_[_0x07fb('0x3e')]({},_0x2f895e,_0x1adc47[_0x07fb('0x40')]);return db[_0x07fb('0x43')][_0x07fb('0x4a')](_0x2f895e)[_0x07fb('0x29')](handleEntityNotFound(_0x102577,null))['then'](respondWithResult(_0x102577,null))[_0x07fb('0x46')](handleError(_0x102577,null));};exports[_0x07fb('0x4b')]=function(_0x370a08,_0x392789){return db[_0x07fb('0x43')][_0x07fb('0x4b')](_0x370a08[_0x07fb('0x4c')],{})['then'](respondWithResult(_0x392789,0xc9))[_0x07fb('0x46')](handleError(_0x392789,null));};exports['update']=function(_0x3a0cce,_0x2fb98f){if(_0x3a0cce[_0x07fb('0x4c')]['id']){delete _0x3a0cce[_0x07fb('0x4c')]['id'];}return db[_0x07fb('0x43')]['find']({'where':{'id':_0x3a0cce[_0x07fb('0x48')]['id']}})[_0x07fb('0x29')](handleEntityNotFound(_0x2fb98f,null))['then'](saveUpdates(_0x3a0cce[_0x07fb('0x4c')],null))['then'](respondWithResult(_0x2fb98f,null))[_0x07fb('0x46')](handleError(_0x2fb98f,null));};exports[_0x07fb('0x28')]=function(_0x11c212,_0x171412){return db['VoiceTransferReport'][_0x07fb('0x4a')]({'where':{'id':_0x11c212['params']['id']}})['then'](handleEntityNotFound(_0x171412,null))[_0x07fb('0x29')](removeEntity(_0x171412,null))[_0x07fb('0x46')](handleError(_0x171412,null));};exports[_0x07fb('0x4d')]=function(_0xa3bd4f,_0x5b0fd8){return db[_0x07fb('0x43')][_0x07fb('0x4d')]()[_0x07fb('0x29')](respondWithResult(_0x5b0fd8,null))[_0x07fb('0x46')](handleError(_0x5b0fd8,null));}; \ No newline at end of file +var _0xc1be=['json','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','VoiceTransferReport','includeAll','include','rows','catch','params','length','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x5aa964,_0x48fe36){var _0x26accd=function(_0x171707){while(--_0x171707){_0x5aa964['push'](_0x5aa964['shift']());}};_0x26accd(++_0x48fe36);}(_0xc1be,0xbb));var _0xec1b=function(_0x2fe1d1,_0x2f0a87){_0x2fe1d1=_0x2fe1d1-0x0;var _0x434d20=_0xc1be[_0x2fe1d1];return _0x434d20;};'use strict';var emlformat=require(_0xec1b('0x0'));var rimraf=require(_0xec1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec1b('0x2'));var rp=require(_0xec1b('0x3'));var moment=require(_0xec1b('0x4'));var BPromise=require(_0xec1b('0x5'));var Mustache=require('mustache');var util=require(_0xec1b('0x6'));var path=require(_0xec1b('0x7'));var sox=require(_0xec1b('0x8'));var csv=require(_0xec1b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xec1b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xec1b('0xb'));var toCsv=require(_0xec1b('0x9'));var querystring=require(_0xec1b('0xc'));var Papa=require(_0xec1b('0xd'));var Redis=require(_0xec1b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xec1b('0xf'));var as=require(_0xec1b('0x10'));var hardwareService=require(_0xec1b('0x11'));var logger=require(_0xec1b('0x12'))(_0xec1b('0x13'));var utils=require(_0xec1b('0x14'));var config=require(_0xec1b('0x15'));var licenseUtil=require(_0xec1b('0x16'));var db=require(_0xec1b('0x17'))['db'];function respondWithStatusCode(_0x12c930,_0x583979){_0x583979=_0x583979||0xcc;return function(_0x51c450){if(_0x51c450){return _0x12c930[_0xec1b('0x18')](_0x583979);}return _0x12c930[_0xec1b('0x19')](_0x583979)[_0xec1b('0x1a')]();};}function respondWithResult(_0x3c9eb7,_0xd2bf7e){_0xd2bf7e=_0xd2bf7e||0xc8;return function(_0x2b4f6c){if(_0x2b4f6c){return _0x3c9eb7['status'](_0xd2bf7e)['json'](_0x2b4f6c);}};}function respondWithFilteredResult(_0x5e93eb,_0x5b65ef){return function(_0x288654){if(_0x288654){var _0x1d71f0=typeof _0x5b65ef[_0xec1b('0x1b')]===_0xec1b('0x1c')&&typeof _0x5b65ef[_0xec1b('0x1d')]==='undefined';var _0x1d3ea5=_0x288654[_0xec1b('0x1e')];var _0x120d82=_0x1d71f0?0x0:_0x5b65ef[_0xec1b('0x1b')];var _0x3748cc=_0x1d71f0?_0x288654[_0xec1b('0x1e')]:_0x5b65ef[_0xec1b('0x1b')]+_0x5b65ef[_0xec1b('0x1d')];var _0xa360f8;if(_0x3748cc>=_0x1d3ea5){_0x3748cc=_0x1d3ea5;_0xa360f8=0xc8;}else{_0xa360f8=0xce;}_0x5e93eb[_0xec1b('0x19')](_0xa360f8);return _0x5e93eb[_0xec1b('0x1f')]('Content-Range',_0x120d82+'-'+_0x3748cc+'/'+_0x1d3ea5)[_0xec1b('0x20')](_0x288654);}return null;};}function patchUpdates(_0x3b72a3){return function(_0x1e3841){try{jsonpatch[_0xec1b('0x21')](_0x1e3841,_0x3b72a3,!![]);}catch(_0x36343c){return BPromise[_0xec1b('0x22')](_0x36343c);}return _0x1e3841[_0xec1b('0x23')]();};}function saveUpdates(_0x461efd,_0x13dac9){return function(_0x534ec4){if(_0x534ec4){return _0x534ec4['update'](_0x461efd)[_0xec1b('0x24')](function(_0x4f4335){return _0x4f4335;});}return null;};}function removeEntity(_0x3d8685,_0x3d2e95){return function(_0x56617){if(_0x56617){return _0x56617[_0xec1b('0x25')]()[_0xec1b('0x24')](function(){_0x3d8685[_0xec1b('0x19')](0xcc)[_0xec1b('0x1a')]();});}};}function handleEntityNotFound(_0x106458,_0x1e2eec){return function(_0x2ff209){if(!_0x2ff209){_0x106458[_0xec1b('0x18')](0x194);}return _0x2ff209;};}function handleError(_0xa33b68,_0x3d0f51){_0x3d0f51=_0x3d0f51||0x1f4;return function(_0x5036c7){logger[_0xec1b('0x26')](_0x5036c7[_0xec1b('0x27')]);if(_0x5036c7[_0xec1b('0x28')]){delete _0x5036c7[_0xec1b('0x28')];}_0xa33b68['status'](_0x3d0f51)['send'](_0x5036c7);};}exports[_0xec1b('0x29')]=function(_0x110ce5,_0x12e004){var _0x58a2af={},_0x24ad02={},_0x2f82bf={'count':0x0,'rows':[]};var _0x318b60=_[_0xec1b('0x2a')](db['VoiceTransferReport'][_0xec1b('0x2b')],function(_0x572478){return{'name':_0x572478[_0xec1b('0x2c')],'type':_0x572478['type'][_0xec1b('0x2d')]};});_0x24ad02[_0xec1b('0x2e')]=_[_0xec1b('0x2a')](_0x318b60,_0xec1b('0x28'));_0x24ad02[_0xec1b('0x2f')]=_[_0xec1b('0x30')](_0x110ce5['query']);_0x24ad02[_0xec1b('0x31')]=_[_0xec1b('0x32')](_0x24ad02[_0xec1b('0x2e')],_0x24ad02[_0xec1b('0x2f')]);_0x58a2af[_0xec1b('0x33')]=_[_0xec1b('0x32')](_0x24ad02[_0xec1b('0x2e')],qs['fields'](_0x110ce5['query'][_0xec1b('0x34')]));_0x58a2af[_0xec1b('0x33')]=_0x58a2af[_0xec1b('0x33')]['length']?_0x58a2af[_0xec1b('0x33')]:_0x24ad02[_0xec1b('0x2e')];if(!_0x110ce5[_0xec1b('0x2f')][_0xec1b('0x35')](_0xec1b('0x36'))){_0x58a2af[_0xec1b('0x1d')]=qs[_0xec1b('0x1d')](_0x110ce5[_0xec1b('0x2f')][_0xec1b('0x1d')]);_0x58a2af[_0xec1b('0x1b')]=qs['offset'](_0x110ce5[_0xec1b('0x2f')][_0xec1b('0x1b')]);}_0x58a2af[_0xec1b('0x37')]=qs[_0xec1b('0x38')](_0x110ce5[_0xec1b('0x2f')][_0xec1b('0x38')]);_0x58a2af['where']=qs[_0xec1b('0x31')](_['pick'](_0x110ce5[_0xec1b('0x2f')],_0x24ad02[_0xec1b('0x31')]),_0x318b60);if(_0x110ce5['query']['filter']){_0x58a2af[_0xec1b('0x39')]=_[_0xec1b('0x3a')](_0x58a2af[_0xec1b('0x39')],{'$or':_['map'](_0x318b60,function(_0x33cd05){if(_0x33cd05[_0xec1b('0x3b')]!=='VIRTUAL'){var _0x6af724={};_0x6af724[_0x33cd05[_0xec1b('0x28')]]={'$like':'%'+_0x110ce5[_0xec1b('0x2f')][_0xec1b('0x3c')]+'%'};return _0x6af724;}})});}_0x58a2af=_[_0xec1b('0x3a')]({},_0x58a2af,_0x110ce5['options']);var _0x5d89a7={'where':_0x58a2af[_0xec1b('0x39')]};return db[_0xec1b('0x3d')]['count'](_0x5d89a7)['then'](function(_0x5e441d){_0x2f82bf[_0xec1b('0x1e')]=_0x5e441d;if(_0x110ce5['query'][_0xec1b('0x3e')]){_0x58a2af[_0xec1b('0x3f')]=[{'all':!![]}];}return db[_0xec1b('0x3d')]['findAll'](_0x58a2af);})['then'](function(_0x302f86){_0x2f82bf[_0xec1b('0x40')]=_0x302f86;return _0x2f82bf;})[_0xec1b('0x24')](respondWithFilteredResult(_0x12e004,_0x58a2af))[_0xec1b('0x41')](handleError(_0x12e004,null));};exports['show']=function(_0x173e89,_0x13a8fc){var _0x2dda64={'raw':!![],'where':{'id':_0x173e89[_0xec1b('0x42')]['id']}},_0x4d9f97={};_0x4d9f97[_0xec1b('0x2e')]=_[_0xec1b('0x30')](db['VoiceTransferReport'][_0xec1b('0x2b')]);_0x4d9f97['query']=_['keys'](_0x173e89[_0xec1b('0x2f')]);_0x4d9f97[_0xec1b('0x31')]=_[_0xec1b('0x32')](_0x4d9f97[_0xec1b('0x2e')],_0x4d9f97['query']);_0x2dda64['attributes']=_['intersection'](_0x4d9f97[_0xec1b('0x2e')],qs[_0xec1b('0x34')](_0x173e89['query']['fields']));_0x2dda64[_0xec1b('0x33')]=_0x2dda64[_0xec1b('0x33')][_0xec1b('0x43')]?_0x2dda64[_0xec1b('0x33')]:_0x4d9f97['model'];if(_0x173e89['query'][_0xec1b('0x3e')]){_0x2dda64['include']=[{'all':!![]}];}_0x2dda64=_[_0xec1b('0x3a')]({},_0x2dda64,_0x173e89[_0xec1b('0x44')]);return db['VoiceTransferReport']['find'](_0x2dda64)['then'](handleEntityNotFound(_0x13a8fc,null))[_0xec1b('0x24')](respondWithResult(_0x13a8fc,null))['catch'](handleError(_0x13a8fc,null));};exports[_0xec1b('0x45')]=function(_0x57310,_0x2fc3e7){return db['VoiceTransferReport'][_0xec1b('0x45')](_0x57310[_0xec1b('0x46')],{})[_0xec1b('0x24')](respondWithResult(_0x2fc3e7,0xc9))['catch'](handleError(_0x2fc3e7,null));};exports['update']=function(_0x34d112,_0x507e37){if(_0x34d112[_0xec1b('0x46')]['id']){delete _0x34d112[_0xec1b('0x46')]['id'];}return db[_0xec1b('0x3d')][_0xec1b('0x47')]({'where':{'id':_0x34d112[_0xec1b('0x42')]['id']}})[_0xec1b('0x24')](handleEntityNotFound(_0x507e37,null))[_0xec1b('0x24')](saveUpdates(_0x34d112['body'],null))['then'](respondWithResult(_0x507e37,null))[_0xec1b('0x41')](handleError(_0x507e37,null));};exports[_0xec1b('0x25')]=function(_0x25ffdf,_0xb33fa5){return db[_0xec1b('0x3d')][_0xec1b('0x47')]({'where':{'id':_0x25ffdf[_0xec1b('0x42')]['id']}})[_0xec1b('0x24')](handleEntityNotFound(_0xb33fa5,null))[_0xec1b('0x24')](removeEntity(_0xb33fa5,null))[_0xec1b('0x41')](handleError(_0xb33fa5,null));};exports['describe']=function(_0x838d58,_0x2d7b34){return db[_0xec1b('0x3d')][_0xec1b('0x48')]()['then'](respondWithResult(_0x2d7b34,null))[_0xec1b('0x41')](handleError(_0x2d7b34,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a6621b4..385540d 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 _0x270d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x5dfdf9,_0x38c144){var _0x35407a=function(_0x59fcee){while(--_0x59fcee){_0x5dfdf9['push'](_0x5dfdf9['shift']());}};_0x35407a(++_0x38c144);}(_0x270d,0x138));var _0xd270=function(_0x234444,_0x361a64){_0x234444=_0x234444-0x0;var _0x520ef1=_0x270d[_0x234444];return _0x520ef1;};'use strict';var _=require(_0xd270('0x0'));var util=require(_0xd270('0x1'));var logger=require('../../config/logger')(_0xd270('0x2'));var moment=require(_0xd270('0x3'));var BPromise=require(_0xd270('0x4'));var rp=require(_0xd270('0x5'));var fs=require('fs');var path=require(_0xd270('0x6'));var rimraf=require(_0xd270('0x7'));var config=require(_0xd270('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xd270('0x9')]=function(_0x5410f2,_0x20ffae){return _0x5410f2[_0xd270('0xa')](_0xd270('0xb'),attributes,{'tableName':_0xd270('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1085=['request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3a60a2,_0x597acc){var _0x382b0d=function(_0x46e6e2){while(--_0x46e6e2){_0x3a60a2['push'](_0x3a60a2['shift']());}};_0x382b0d(++_0x597acc);}(_0x1085,0x1b6));var _0x5108=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1085[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5108('0x0'));var util=require(_0x5108('0x1'));var logger=require(_0x5108('0x2'))(_0x5108('0x3'));var moment=require(_0x5108('0x4'));var BPromise=require(_0x5108('0x5'));var rp=require(_0x5108('0x6'));var fs=require('fs');var path=require(_0x5108('0x7'));var rimraf=require('rimraf');var config=require(_0x5108('0x8'));var attributes=require(_0x5108('0x9'));module[_0x5108('0xa')]=function(_0x7e26,_0x52da70){return _0x7e26['define']('VoiceTransferReport',attributes,{'tableName':_0x5108('0xb'),'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 96a0905..6ecb388 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 _0x9dea=['info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x9dea,0x10d));var _0xa9de=function(_0x23059f,_0x20200c){_0x23059f=_0x23059f-0x0;var _0x7e6ad1=_0x9dea[_0x23059f];return _0x7e6ad1;};'use strict';var _=require(_0xa9de('0x0'));var util=require('util');var moment=require(_0xa9de('0x1'));var BPromise=require(_0xa9de('0x2'));var rs=require(_0xa9de('0x3'));var fs=require('fs');var Redis=require(_0xa9de('0x4'));var db=require(_0xa9de('0x5'))['db'];var utils=require(_0xa9de('0x6'));var logger=require(_0xa9de('0x7'))(_0xa9de('0x8'));var config=require(_0xa9de('0x9'));var jayson=require(_0xa9de('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597504,_0x20e6ea,_0x113761){return new BPromise(function(_0x2ddc02,_0x583464){return client[_0xa9de('0xb')](_0x597504,_0x113761)[_0xa9de('0xc')](function(_0x57e2f1){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x20e6ea,'request\x20sent');logger[_0xa9de('0xd')](_0xa9de('0xe'),_0x20e6ea,_0xa9de('0xf'),JSON[_0xa9de('0x10')](_0x57e2f1));if(_0x57e2f1[_0xa9de('0x11')]){if(_0x57e2f1[_0xa9de('0x11')][_0xa9de('0x12')]===0x1f4){logger[_0xa9de('0x11')](_0xa9de('0x13'),_0x20e6ea,_0x57e2f1['error']['message']);return _0x583464(_0x57e2f1[_0xa9de('0x11')]['message']);}logger['error'](_0xa9de('0x13'),_0x20e6ea,_0x57e2f1[_0xa9de('0x11')][_0xa9de('0x14')]);return _0x2ddc02(_0x57e2f1['error'][_0xa9de('0x14')]);}else{logger[_0xa9de('0x15')](_0xa9de('0x13'),_0x20e6ea,_0xa9de('0xf'));_0x2ddc02(_0x57e2f1[_0xa9de('0x16')]['message']);}})[_0xa9de('0x17')](function(_0x37204d){logger[_0xa9de('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x20e6ea,_0x37204d);_0x583464(_0x37204d);});});}exports[_0xa9de('0x18')]=function(_0x1aaf07){var _0x1ac4e3=this;return new Promise(function(_0x489f78,_0x2834eb){return db[_0xa9de('0x19')][_0xa9de('0x1a')](_0x1aaf07['body'],{'raw':_0x1aaf07[_0xa9de('0x1b')]?_0x1aaf07[_0xa9de('0x1b')][_0xa9de('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x16cd60){logger[_0xa9de('0x15')](_0xa9de('0x18'),_0x1aaf07);logger[_0xa9de('0xd')]('CreateVoiceTransferReport',_0x1aaf07,JSON[_0xa9de('0x10')](_0x16cd60));_0x489f78(_0x16cd60);})[_0xa9de('0x17')](function(_0x459973){logger[_0xa9de('0x11')](_0xa9de('0x18'),_0x459973[_0xa9de('0x14')],_0x1aaf07);_0x2834eb(_0x1ac4e3[_0xa9de('0x11')](0x1f4,_0x459973[_0xa9de('0x14')]));});});}; \ No newline at end of file +var _0xd1f1=['VoiceTransferReport','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x14855e,_0x1f88b4){var _0x2439ab=function(_0x28eb86){while(--_0x28eb86){_0x14855e['push'](_0x14855e['shift']());}};_0x2439ab(++_0x1f88b4);}(_0xd1f1,0x1e5));var _0x1d1f=function(_0x4e63f1,_0x34a2db){_0x4e63f1=_0x4e63f1-0x0;var _0xdbd910=_0xd1f1[_0x4e63f1];return _0xdbd910;};'use strict';var _=require(_0x1d1f('0x0'));var util=require('util');var moment=require(_0x1d1f('0x1'));var BPromise=require(_0x1d1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d1f('0x3'));var db=require(_0x1d1f('0x4'))['db'];var utils=require(_0x1d1f('0x5'));var logger=require(_0x1d1f('0x6'))(_0x1d1f('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d1f('0x8'));var client=jayson[_0x1d1f('0x9')][_0x1d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb285,_0x56e339,_0x48b5c6){return new BPromise(function(_0x4b49f7,_0x4cf389){return client[_0x1d1f('0xb')](_0x5eb285,_0x48b5c6)[_0x1d1f('0xc')](function(_0x203861){logger[_0x1d1f('0xd')](_0x1d1f('0xe'),_0x56e339,_0x1d1f('0xf'));logger[_0x1d1f('0x10')](_0x1d1f('0x11'),_0x56e339,_0x1d1f('0xf'),JSON[_0x1d1f('0x12')](_0x203861));if(_0x203861[_0x1d1f('0x13')]){if(_0x203861[_0x1d1f('0x13')][_0x1d1f('0x14')]===0x1f4){logger[_0x1d1f('0x13')](_0x1d1f('0xe'),_0x56e339,_0x203861[_0x1d1f('0x13')][_0x1d1f('0x15')]);return _0x4cf389(_0x203861['error'][_0x1d1f('0x15')]);}logger[_0x1d1f('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x56e339,_0x203861[_0x1d1f('0x13')][_0x1d1f('0x15')]);return _0x4b49f7(_0x203861[_0x1d1f('0x13')][_0x1d1f('0x15')]);}else{logger[_0x1d1f('0xd')](_0x1d1f('0xe'),_0x56e339,_0x1d1f('0xf'));_0x4b49f7(_0x203861[_0x1d1f('0x16')][_0x1d1f('0x15')]);}})[_0x1d1f('0x17')](function(_0x8792d6){logger[_0x1d1f('0x13')](_0x1d1f('0xe'),_0x56e339,_0x8792d6);_0x4cf389(_0x8792d6);});});}exports[_0x1d1f('0x18')]=function(_0x47c189){var _0x29ed84=this;return new Promise(function(_0x34ded5,_0x29dd08){return db[_0x1d1f('0x19')][_0x1d1f('0x1a')](_0x47c189[_0x1d1f('0x1b')],{'raw':_0x47c189['options']?_0x47c189[_0x1d1f('0x1c')][_0x1d1f('0x1d')]===undefined?!![]:![]:!![]})[_0x1d1f('0xc')](function(_0x1ba9b4){logger['info'](_0x1d1f('0x18'),_0x47c189);logger[_0x1d1f('0x10')]('CreateVoiceTransferReport',_0x47c189,JSON[_0x1d1f('0x12')](_0x1ba9b4));_0x34ded5(_0x1ba9b4);})[_0x1d1f('0x17')](function(_0x34c153){logger[_0x1d1f('0x13')](_0x1d1f('0x18'),_0x34c153[_0x1d1f('0x15')],_0x47c189);_0x29dd08(_0x29ed84[_0x1d1f('0x13')](0x1f4,_0x34c153[_0x1d1f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6e38bdd..f954e35 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0x91a7,0xe7));var _0x791a=function(_0x58db70,_0x54b4c9){_0x58db70=_0x58db70-0x0;var _0x2288b6=_0x91a7[_0x58db70];return _0x2288b6;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x35d120,_0x2ca28c){var _0x69e008=function(_0x182896){while(--_0x182896){_0x35d120['push'](_0x35d120['shift']());}};_0x69e008(++_0x2ca28c);}(_0x91a7,0xe7));var _0x791a=function(_0x181cd3,_0xbb7f9e){_0x181cd3=_0x181cd3-0x0;var _0x50b066=_0x91a7[_0x181cd3];return _0x50b066;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 611ffd8..12713f9 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 _0xe706=['calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','\x20not\x20found!','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls'];(function(_0x1ca0f9,_0x3c63aa){var _0x2d440e=function(_0x3284a7){while(--_0x3284a7){_0x1ca0f9['push'](_0x1ca0f9['shift']());}};_0x2d440e(++_0x3c63aa);}(_0xe706,0xa3));var _0x6e70=function(_0x2db055,_0x5bde11){_0x2db055=_0x2db055-0x0;var _0xb2f3a4=_0xe706[_0x2db055];return _0xb2f3a4;};'use strict';var path=require(_0x6e70('0x0'));var fs=require('fs');var _=require(_0x6e70('0x1'));var db=require(_0x6e70('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var jayson=require(_0x6e70('0x5'));var amiClient=jayson[_0x6e70('0x6')][_0x6e70('0x7')]({'port':0x232a});var logger=require(_0x6e70('0x8'))(_0x6e70('0x9'));var Redis=require(_0x6e70('0xa'));config[_0x6e70('0xb')]=_[_0x6e70('0xc')](config[_0x6e70('0xb')],{'host':_0x6e70('0xd'),'port':0x18eb});var io=require(_0x6e70('0xe'))(new Redis(config[_0x6e70('0xb')]));var Schema=require(_0x6e70('0xf'));var originateValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'callNumber':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x13')]},'callerId':{'type':_0x6e70('0x12')},'callbackUrl':{'type':_0x6e70('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'sessionId':{'type':_0x6e70('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6e70('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'sessionId':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x14')]},'transferNumber':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6e70('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6e70('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x24f3ac,_0x5c3fe7,_0x2efc0f){logger[_0x6e70('0x16')](_0x24f3ac,_0x5c3fe7,JSON['stringify'](_0x2efc0f));io['to'](_0x24f3ac)['emit'](_0x5c3fe7,_0x2efc0f);}function handleError(_0x3bd572){return function(_0x5ea7a5){console[_0x6e70('0x17')](_0x6e70('0x18'),_0x5ea7a5,_0x5ea7a5 instanceof RangeError);logger['error'](_0x5ea7a5['stack']);if(_0x5ea7a5 instanceof RangeError){if(_0x5ea7a5[_0x6e70('0x19')]){delete _0x5ea7a5[_0x6e70('0x19')];}_0x3bd572[_0x6e70('0x1a')](0x194)[_0x6e70('0x1b')](_0x5ea7a5);}else{if(_0x5ea7a5[_0x6e70('0x19')]){delete _0x5ea7a5[_0x6e70('0x19')];}_0x3bd572[_0x6e70('0x1a')](0x1f4)[_0x6e70('0x1b')](_0x5ea7a5);}};}function checkError(){return function(_0x29326f){if(!_0x29326f){throw new RangeError(_0x6e70('0x1c'));}return _0x29326f;};}function respondWithRpcPromise(_0x4a0cfe,_0x228350){return new BPromise(function(_0x344b65,_0x27b294){var _0x502b2d=amiClient;return _0x502b2d[_0x6e70('0x1d')](_0x4a0cfe,_0x228350)[_0x6e70('0x1e')](function(_0x3337a6){if(_0x3337a6['error']){if(_0x3337a6[_0x6e70('0x1f')]['code']===0x1f4){return _0x27b294(_0x3337a6['error']['message']);}return _0x344b65(_0x3337a6[_0x6e70('0x1f')][_0x6e70('0x20')]);}else{_0x344b65(_0x3337a6['result']);}})[_0x6e70('0x21')](function(_0x1196ed){_0x27b294(_0x1196ed);});});}function getAgent(_0x5f268f){return db[_0x6e70('0x22')][_0x6e70('0x23')]({'where':{'id':_0x5f268f,'role':_0x6e70('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x54a5fe,_0x2c4d37){return new BPromise(function(_0x3af17f,_0x83c836){var _0x114344=respondWithRpcPromise(_0x6e70('0x25'));var _0x5d772a=getAgent(_0x54a5fe);Promise[_0x6e70('0x26')]([_0x114344,_0x5d772a])[_0x6e70('0x1e')](function(_0xecf336){var _0x2864a0=_0xecf336[0x0];var _0x396a67=_0xecf336[0x1];var _0x20a225=_[_0x6e70('0x27')](_0x2864a0[_0x6e70('0x28')],function(_0x3a0821){return _0x3a0821[_0x6e70('0x29')]==_0x396a67['id']&&_0x3a0821['sessionId']==_0x2c4d37;});if(_0x20a225[_0x6e70('0x2a')]==0x1){_0x3af17f(_0x396a67);}else{_0x83c836(new RangeError('sessionId\x20'+_0x2c4d37+_0x6e70('0x2b')));}});});}exports['originate']=function(_0xdd7cc1,_0x2722e8){logger[_0x6e70('0x16')]('originate\x20fired:',_0xdd7cc1[_0x6e70('0x2c')]);var _0x42b094=originateValidation['validate'](_0xdd7cc1[_0x6e70('0x2c')]);if(_0x42b094[_0x6e70('0x2a')]>0x0){return _0x2722e8['status'](0x190)[_0x6e70('0x2d')](_0x42b094);}var _0x3665a1=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x3b4a13=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x2f')];var _0x3f42bd=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x30')];var _0x4d32d8=_0xdd7cc1[_0x6e70('0x2c')]['callbackUrl'];return getAgent(_0x3665a1)[_0x6e70('0x1e')](function(_0x3222a2){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x3222a2[_0x6e70('0x19')]),_0x6e70('0x34'),{'callNumber':_0x3b4a13,'callerId':_0x3f42bd,'callbackUrl':_0x4d32d8});return _0x2722e8[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x35')});})[_0x6e70('0x21')](handleError(_0x2722e8));};exports['hangup']=function(_0x5446a2,_0x5424eb){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x5446a2[_0x6e70('0x2c')]);var _0x1f6955=hangupValidation[_0x6e70('0xf')](_0x5446a2[_0x6e70('0x2c')]);if(_0x1f6955['length']>0x0){return _0x5424eb[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x1f6955);}var _0x1c5cde=_0x5446a2[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x37bf46=_0x5446a2[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x1c5cde)['then'](function(_0x2c0bd1){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2c0bd1[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x2c0bd1[_0x6e70('0x19')]),'webbar:hangup',{'sessionId':_0x37bf46});return _0x5424eb['status'](0xc8)['json']({'error':![],'message':_0x6e70('0x38')});})[_0x6e70('0x21')](handleError(_0x5424eb));};exports[_0x6e70('0x39')]=function(_0x64ff8e,_0x45c83a){logger['info'](_0x6e70('0x3a'),_0x64ff8e[_0x6e70('0x2c')]);var _0x2a2aca=answerValidation['validate'](_0x64ff8e['body']);if(_0x2a2aca['length']>0x0){return _0x45c83a[_0x6e70('0x1a')](0x190)['json'](_0x2a2aca);}var _0x42f49a=_0x64ff8e[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x75a90d=_0x64ff8e['body'][_0x6e70('0x37')];return getAgent(_0x42f49a)['then'](function(_0x9f5b94){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x9f5b94[_0x6e70('0x19')]);emit(util['format'](_0x6e70('0x33'),_0x9f5b94[_0x6e70('0x19')]),_0x6e70('0x3b'),{'sessionId':_0x75a90d});return _0x45c83a[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x3c')});})[_0x6e70('0x21')](handleError(_0x45c83a));};exports['hold']=function(_0x5f1c92,_0x3884a4){logger[_0x6e70('0x16')](_0x6e70('0x3d'),_0x5f1c92[_0x6e70('0x2c')]);var _0x172e8a=holdValidation[_0x6e70('0xf')](_0x5f1c92['body']);if(_0x172e8a[_0x6e70('0x2a')]>0x0){return _0x3884a4['status'](0x190)[_0x6e70('0x2d')](_0x172e8a);}var _0x3836e4=_0x5f1c92['body']['userId'];var _0x333abd=_0x5f1c92[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x3836e4)['then'](function(_0x4af9b1){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x4af9b1[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x4af9b1[_0x6e70('0x19')]),'webbar:hold',{'sessionId':_0x333abd});return _0x3884a4[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x3e')});})[_0x6e70('0x21')](handleError(_0x3884a4));};exports[_0x6e70('0x3f')]=function(_0x4b354e,_0x4ae901){logger[_0x6e70('0x16')](_0x6e70('0x40'),_0x4b354e[_0x6e70('0x2c')]);var _0x15f994=unholdValidation[_0x6e70('0xf')](_0x4b354e['body']);if(_0x15f994[_0x6e70('0x2a')]>0x0){return _0x4ae901[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x15f994);}var _0x23ebfb=_0x4b354e[_0x6e70('0x2c')]['userId'];var _0x1142cd=_0x4b354e[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x23ebfb)[_0x6e70('0x1e')](function(_0x8ef4f7){logger[_0x6e70('0x16')]('entityFound:',_0x8ef4f7[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')]('user:%s',_0x8ef4f7[_0x6e70('0x19')]),_0x6e70('0x41'),{'sessionId':_0x1142cd});return _0x4ae901['status'](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x42')});})[_0x6e70('0x21')](handleError(_0x4ae901));};exports[_0x6e70('0x43')]=function(_0xfcadfe,_0x53f8fc){logger[_0x6e70('0x16')](_0x6e70('0x44'),_0x53f8fc[_0x6e70('0x2c')]);var _0x13be81=callsValidation[_0x6e70('0xf')](_0xfcadfe[_0x6e70('0x2c')]);if(_0x13be81[_0x6e70('0x2a')]>0x0){return _0x53f8fc[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x13be81);}var _0x344676=_0xfcadfe[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0xb8f78=respondWithRpcPromise(_0x6e70('0x25'));var _0x2a9173=getAgent(_0x344676);return Promise[_0x6e70('0x26')]([_0xb8f78,_0x2a9173])[_0x6e70('0x1e')](function(_0x4329a6){var _0x2a8627=_0x4329a6[0x0];var _0x1c7dca=_0x4329a6[0x1];var _0x4c6aab=_[_0x6e70('0x27')](_0x2a8627[_0x6e70('0x28')],function(_0x180a13){return _0x180a13[_0x6e70('0x29')]==_0x1c7dca['id'];});return _0x53f8fc[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'count':_0x4c6aab['length'],'rows':_0x4c6aab});})[_0x6e70('0x21')](handleError(_0x53f8fc));};exports[_0x6e70('0x45')]=function(_0x4f813a,_0x246ea2){logger[_0x6e70('0x16')](_0x6e70('0x46'),_0x4f813a['body']);var _0x51f268=conferenceValidation[_0x6e70('0xf')](_0x4f813a[_0x6e70('0x2c')]);if(_0x51f268[_0x6e70('0x2a')]>0x0){return _0x246ea2[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x51f268);}var _0x739946=_0x4f813a[_0x6e70('0x2c')]['userId'];return getAgent(_0x739946)['then'](function(_0x2c8dc6){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2c8dc6[_0x6e70('0x19')]);emit(util['format']('user:%s',_0x2c8dc6[_0x6e70('0x19')]),_0x6e70('0x47'));return _0x246ea2['status'](0xc8)['json']({'error':![],'message':_0x6e70('0x48')});})['catch'](handleError(_0x246ea2));};exports[_0x6e70('0x49')]=function(_0x23900b,_0x3b4da0){logger[_0x6e70('0x16')](_0x6e70('0x4a'),_0x23900b[_0x6e70('0x2c')]);var _0x2a9876=transferValidation[_0x6e70('0xf')](_0x23900b['body']);if(_0x2a9876[_0x6e70('0x2a')]>0x0){return _0x3b4da0[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x2a9876);}var _0x346c79=_0x23900b[_0x6e70('0x2c')]['userId'];var _0x5f5b02=_0x23900b['body'][_0x6e70('0x37')];var _0xd91b9=_0x23900b[_0x6e70('0x2c')]['transferNumber'];return getAgent(_0x346c79)['then'](function(_0x2fc2a2){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2fc2a2[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x2fc2a2['name']),_0x6e70('0x4b'),{'sessionId':_0x5f5b02,'transferNumber':_0xd91b9});return _0x3b4da0[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x4c')});})['catch'](handleError(_0x3b4da0));}; \ No newline at end of file +var _0xda55=['sessionId\x20','\x20not\x20found!','originate','info','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','webbar:conference','transfer','transfer\x20fired:','path','lodash','util','bluebird','jayson/promise','client','http','webbarapi','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','stack','name','status','send','NotFound','then','error','code','message','result','User','VoiceChannels','all','filter','rows','length'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xda55,0x6d));var _0x5da5=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0xda55[_0x533897];return _0x340bbd;};'use strict';var path=require(_0x5da5('0x0'));var fs=require('fs');var _=require(_0x5da5('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var jayson=require(_0x5da5('0x4'));var amiClient=jayson[_0x5da5('0x5')][_0x5da5('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x5da5('0x7'));var Redis=require('ioredis');config[_0x5da5('0x8')]=_['defaults'](config[_0x5da5('0x8')],{'host':_0x5da5('0x9'),'port':0x18eb});var io=require(_0x5da5('0xa'))(new Redis(config[_0x5da5('0x8')]));var Schema=require(_0x5da5('0xb'));var originateValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'callNumber':{'type':_0x5da5('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5da5('0xe')},'callbackUrl':{'type':_0x5da5('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':'string','required':[!![],_0x5da5('0xf')]},'transferNumber':{'type':_0x5da5('0xe'),'required':[!![],_0x5da5('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]},'sessionId':{'type':_0x5da5('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5da5('0xc'),'required':[!![],_0x5da5('0xd')]}});function emit(_0x11bd3,_0x134afa,_0x3aff51){logger['info'](_0x11bd3,_0x134afa,JSON[_0x5da5('0x11')](_0x3aff51));io['to'](_0x11bd3)[_0x5da5('0x12')](_0x134afa,_0x3aff51);}function handleError(_0x1a4849){return function(_0x16b11f){console[_0x5da5('0x13')](_0x5da5('0x14'),_0x16b11f,_0x16b11f instanceof RangeError);logger['error'](_0x16b11f[_0x5da5('0x15')]);if(_0x16b11f instanceof RangeError){if(_0x16b11f[_0x5da5('0x16')]){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x194)[_0x5da5('0x18')](_0x16b11f);}else{if(_0x16b11f['name']){delete _0x16b11f[_0x5da5('0x16')];}_0x1a4849[_0x5da5('0x17')](0x1f4)[_0x5da5('0x18')](_0x16b11f);}};}function checkError(){return function(_0x560ea7){if(!_0x560ea7){throw new RangeError(_0x5da5('0x19'));}return _0x560ea7;};}function respondWithRpcPromise(_0x15aa62,_0x20c8a6){return new BPromise(function(_0x2e68d5,_0xec69f2){var _0x436960=amiClient;return _0x436960['request'](_0x15aa62,_0x20c8a6)[_0x5da5('0x1a')](function(_0x568ddf){if(_0x568ddf[_0x5da5('0x1b')]){if(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1c')]===0x1f4){return _0xec69f2(_0x568ddf['error'][_0x5da5('0x1d')]);}return _0x2e68d5(_0x568ddf[_0x5da5('0x1b')][_0x5da5('0x1d')]);}else{_0x2e68d5(_0x568ddf[_0x5da5('0x1e')]);}})['catch'](function(_0x5b0b43){_0xec69f2(_0x5b0b43);});});}function getAgent(_0x50aadc){return db[_0x5da5('0x1f')]['findOne']({'where':{'id':_0x50aadc,'role':'agent'}})[_0x5da5('0x1a')](checkError());}function getAgentCheckSession(_0x3974d8,_0x5740a7){return new BPromise(function(_0x1798ae,_0x1ab83e){var _0x558b12=respondWithRpcPromise(_0x5da5('0x20'));var _0x27de55=getAgent(_0x3974d8);Promise[_0x5da5('0x21')]([_0x558b12,_0x27de55])[_0x5da5('0x1a')](function(_0x766ed9){var _0x5734ce=_0x766ed9[0x0];var _0x3ae664=_0x766ed9[0x1];var _0x2e3c5d=_[_0x5da5('0x22')](_0x5734ce[_0x5da5('0x23')],function(_0x55e2bf){return _0x55e2bf['UserId']==_0x3ae664['id']&&_0x55e2bf['sessionId']==_0x5740a7;});if(_0x2e3c5d[_0x5da5('0x24')]==0x1){_0x1798ae(_0x3ae664);}else{_0x1ab83e(new RangeError(_0x5da5('0x25')+_0x5740a7+_0x5da5('0x26')));}});});}exports[_0x5da5('0x27')]=function(_0x51b712,_0x585298){logger[_0x5da5('0x28')]('originate\x20fired:',_0x51b712['body']);var _0x2dd4b6=originateValidation['validate'](_0x51b712[_0x5da5('0x29')]);if(_0x2dd4b6[_0x5da5('0x24')]>0x0){return _0x585298[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2dd4b6);}var _0x6c556d=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x3dc66a=_0x51b712['body'][_0x5da5('0x2c')];var _0x48de0b=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2d')];var _0x28c5eb=_0x51b712[_0x5da5('0x29')][_0x5da5('0x2e')];return getAgent(_0x6c556d)[_0x5da5('0x1a')](function(_0x325ccd){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x325ccd[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x325ccd[_0x5da5('0x16')]),'webbar:originate',{'callNumber':_0x3dc66a,'callerId':_0x48de0b,'callbackUrl':_0x28c5eb});return _0x585298[_0x5da5('0x17')](0xc8)['json']({'error':![],'message':_0x5da5('0x32')});})[_0x5da5('0x33')](handleError(_0x585298));};exports[_0x5da5('0x34')]=function(_0x24842c,_0x59c92e){logger[_0x5da5('0x28')](_0x5da5('0x35'),_0x24842c[_0x5da5('0x29')]);var _0x56fd57=hangupValidation[_0x5da5('0xb')](_0x24842c[_0x5da5('0x29')]);if(_0x56fd57['length']>0x0){return _0x59c92e[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x56fd57);}var _0xe9888e=_0x24842c[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x664a8d=_0x24842c['body'][_0x5da5('0x36')];return getAgent(_0xe9888e)[_0x5da5('0x1a')](function(_0x14c3f5){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x14c3f5['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x14c3f5['name']),_0x5da5('0x37'),{'sessionId':_0x664a8d});return _0x59c92e['status'](0xc8)['json']({'error':![],'message':_0x5da5('0x38')});})[_0x5da5('0x33')](handleError(_0x59c92e));};exports[_0x5da5('0x39')]=function(_0x29d9a7,_0x52b618){logger[_0x5da5('0x28')](_0x5da5('0x3a'),_0x29d9a7[_0x5da5('0x29')]);var _0x40cf69=answerValidation[_0x5da5('0xb')](_0x29d9a7[_0x5da5('0x29')]);if(_0x40cf69[_0x5da5('0x24')]>0x0){return _0x52b618[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x40cf69);}var _0x284d40=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4464a7=_0x29d9a7[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x284d40)['then'](function(_0x485326){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x485326['name']);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x485326[_0x5da5('0x16')]),_0x5da5('0x3b'),{'sessionId':_0x4464a7});return _0x52b618[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x3c')});})[_0x5da5('0x33')](handleError(_0x52b618));};exports[_0x5da5('0x3d')]=function(_0x44de08,_0x4fc584){logger[_0x5da5('0x28')]('hold\x20fired:',_0x44de08['body']);var _0x2a0fb6=holdValidation[_0x5da5('0xb')](_0x44de08[_0x5da5('0x29')]);if(_0x2a0fb6[_0x5da5('0x24')]>0x0){return _0x4fc584[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x2a0fb6);}var _0x5aa561=_0x44de08[_0x5da5('0x29')]['userId'];var _0x5325ad=_0x44de08[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x5aa561)['then'](function(_0x419d74){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x419d74[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x419d74[_0x5da5('0x16')]),'webbar:hold',{'sessionId':_0x5325ad});return _0x4fc584['status'](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'hold\x20executed!'});})[_0x5da5('0x33')](handleError(_0x4fc584));};exports[_0x5da5('0x3e')]=function(_0x17581a,_0x1ec725){logger[_0x5da5('0x28')](_0x5da5('0x3f'),_0x17581a['body']);var _0x5cb8d8=unholdValidation[_0x5da5('0xb')](_0x17581a[_0x5da5('0x29')]);if(_0x5cb8d8['length']>0x0){return _0x1ec725['status'](0x190)[_0x5da5('0x2a')](_0x5cb8d8);}var _0x4c1321=_0x17581a[_0x5da5('0x29')]['userId'];var _0x505ea4=_0x17581a[_0x5da5('0x29')][_0x5da5('0x36')];return getAgent(_0x4c1321)[_0x5da5('0x1a')](function(_0x39d428){logger['info'](_0x5da5('0x2f'),_0x39d428[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')]('user:%s',_0x39d428[_0x5da5('0x16')]),_0x5da5('0x40'),{'sessionId':_0x505ea4});return _0x1ec725[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':_0x5da5('0x41')});})[_0x5da5('0x33')](handleError(_0x1ec725));};exports[_0x5da5('0x42')]=function(_0x53c7dd,_0x3d1a54){logger[_0x5da5('0x28')](_0x5da5('0x43'),_0x3d1a54[_0x5da5('0x29')]);var _0x211b80=callsValidation[_0x5da5('0xb')](_0x53c7dd[_0x5da5('0x29')]);if(_0x211b80[_0x5da5('0x24')]>0x0){return _0x3d1a54[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x211b80);}var _0x191691=_0x53c7dd[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x4cc539=respondWithRpcPromise(_0x5da5('0x20'));var _0x35939b=getAgent(_0x191691);return Promise['all']([_0x4cc539,_0x35939b])['then'](function(_0x509c9e){var _0x1959af=_0x509c9e[0x0];var _0x469907=_0x509c9e[0x1];var _0x20c269=_['filter'](_0x1959af['rows'],function(_0x462317){return _0x462317[_0x5da5('0x44')]==_0x469907['id'];});return _0x3d1a54[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'count':_0x20c269['length'],'rows':_0x20c269});})[_0x5da5('0x33')](handleError(_0x3d1a54));};exports[_0x5da5('0x45')]=function(_0x34b4b0,_0x4e4ffa){logger[_0x5da5('0x28')]('conference\x20fired:',_0x34b4b0[_0x5da5('0x29')]);var _0x4496d2=conferenceValidation[_0x5da5('0xb')](_0x34b4b0[_0x5da5('0x29')]);if(_0x4496d2[_0x5da5('0x24')]>0x0){return _0x4e4ffa[_0x5da5('0x17')](0x190)[_0x5da5('0x2a')](_0x4496d2);}var _0x2c13f1=_0x34b4b0[_0x5da5('0x29')][_0x5da5('0x2b')];return getAgent(_0x2c13f1)[_0x5da5('0x1a')](function(_0xe3fc79){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0xe3fc79[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0xe3fc79[_0x5da5('0x16')]),_0x5da5('0x46'));return _0x4e4ffa[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x4e4ffa));};exports[_0x5da5('0x47')]=function(_0x35cca1,_0x4041e8){logger['info'](_0x5da5('0x48'),_0x35cca1[_0x5da5('0x29')]);var _0x43b55e=transferValidation[_0x5da5('0xb')](_0x35cca1['body']);if(_0x43b55e[_0x5da5('0x24')]>0x0){return _0x4041e8['status'](0x190)[_0x5da5('0x2a')](_0x43b55e);}var _0x5f862f=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x2b')];var _0x57966d=_0x35cca1[_0x5da5('0x29')][_0x5da5('0x36')];var _0x512f01=_0x35cca1['body']['transferNumber'];return getAgent(_0x5f862f)[_0x5da5('0x1a')](function(_0x446241){logger[_0x5da5('0x28')](_0x5da5('0x2f'),_0x446241[_0x5da5('0x16')]);emit(util[_0x5da5('0x30')](_0x5da5('0x31'),_0x446241[_0x5da5('0x16')]),'webbar:transfer',{'sessionId':_0x57966d,'transferNumber':_0x512f01});return _0x4041e8[_0x5da5('0x17')](0xc8)[_0x5da5('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4041e8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cd1b452..476edb9 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 _0x8a3b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout'];(function(_0x57af27,_0x158aec){var _0x5442a3=function(_0x1e74a8){while(--_0x1e74a8){_0x57af27['push'](_0x57af27['shift']());}};_0x5442a3(++_0x158aec);}(_0x8a3b,0xf2));var _0xb8a3=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8a3b[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xb8a3('0x0'));var util=require(_0xb8a3('0x1'));var path=require('path');var timeout=require(_0xb8a3('0x2'));var express=require('express');var router=express[_0xb8a3('0x3')]();var fs_extra=require(_0xb8a3('0x4'));var auth=require(_0xb8a3('0x5'));var interaction=require(_0xb8a3('0x6'));var config=require(_0xb8a3('0x7'));var controller=require(_0xb8a3('0x8'));router[_0xb8a3('0x9')]('/',auth[_0xb8a3('0xa')](),controller[_0xb8a3('0xb')]);router[_0xb8a3('0x9')](_0xb8a3('0xc'),auth['isAuthenticated'](),controller[_0xb8a3('0xd')]);router[_0xb8a3('0x9')](_0xb8a3('0xe'),auth['isAuthenticated'](),controller[_0xb8a3('0xf')]);router[_0xb8a3('0x9')](_0xb8a3('0x10'),auth[_0xb8a3('0xa')](),controller['getDispositions']);router[_0xb8a3('0x9')]('/:id/canned_answers',auth[_0xb8a3('0xa')](),controller['getAnswers']);router['get'](_0xb8a3('0x11'),auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x12')]);router[_0xb8a3('0x9')](_0xb8a3('0x13'),auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x14')]);router[_0xb8a3('0x15')]('/',auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x16')]);router[_0xb8a3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb8a3('0x17')]);router[_0xb8a3('0x15')](_0xb8a3('0x18'),auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x19')]);router[_0xb8a3('0x15')]('/:id/users',auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x1a')]);router['post'](_0xb8a3('0x13'),auth['isAuthenticated'](),controller[_0xb8a3('0x1b')]);router[_0xb8a3('0x15')](_0xb8a3('0x1c'),controller['notify']);router['post'](_0xb8a3('0x1d'),auth[_0xb8a3('0xa')](),controller['send']);router['put'](_0xb8a3('0xe'),auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x1e')]);router[_0xb8a3('0x1f')]('/:id',auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x20')]);router['delete'](_0xb8a3('0x10'),auth[_0xb8a3('0xa')](),controller['removeDispositions']);router[_0xb8a3('0x1f')](_0xb8a3('0x18'),auth[_0xb8a3('0xa')](),controller['removeAnswers']);router[_0xb8a3('0x1f')](_0xb8a3('0x11'),auth[_0xb8a3('0xa')](),controller[_0xb8a3('0x21')]);module[_0xb8a3('0x22')]=router; \ No newline at end of file +var _0x93d5=['addApplications','/:id/notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents'];(function(_0x389721,_0x2138cd){var _0xd20a49=function(_0x3673ab){while(--_0x3673ab){_0x389721['push'](_0x389721['shift']());}};_0xd20a49(++_0x2138cd);}(_0x93d5,0x17e));var _0x593d=function(_0x3ae4b5,_0x58ccc8){_0x3ae4b5=_0x3ae4b5-0x0;var _0x4d408c=_0x93d5[_0x3ae4b5];return _0x4d408c;};'use strict';var multer=require('multer');var util=require(_0x593d('0x0'));var path=require(_0x593d('0x1'));var timeout=require(_0x593d('0x2'));var express=require(_0x593d('0x3'));var router=express[_0x593d('0x4')]();var fs_extra=require(_0x593d('0x5'));var auth=require(_0x593d('0x6'));var interaction=require(_0x593d('0x7'));var config=require(_0x593d('0x8'));var controller=require('./whatsappAccount.controller');router[_0x593d('0x9')]('/',auth[_0x593d('0xa')](),controller[_0x593d('0xb')]);router[_0x593d('0x9')]('/describe',auth[_0x593d('0xa')](),controller[_0x593d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x593d('0xd')]);router[_0x593d('0x9')](_0x593d('0xe'),auth[_0x593d('0xa')](),controller['getDispositions']);router['get'](_0x593d('0xf'),auth[_0x593d('0xa')](),controller[_0x593d('0x10')]);router[_0x593d('0x9')](_0x593d('0x11'),auth[_0x593d('0xa')](),controller[_0x593d('0x12')]);router['get'](_0x593d('0x13'),auth[_0x593d('0xa')](),controller[_0x593d('0x14')]);router[_0x593d('0x15')]('/',auth[_0x593d('0xa')](),controller['create']);router[_0x593d('0x15')](_0x593d('0xe'),auth[_0x593d('0xa')](),controller[_0x593d('0x16')]);router[_0x593d('0x15')](_0x593d('0xf'),auth[_0x593d('0xa')](),controller[_0x593d('0x17')]);router[_0x593d('0x15')](_0x593d('0x11'),auth[_0x593d('0xa')](),controller[_0x593d('0x18')]);router[_0x593d('0x15')](_0x593d('0x13'),auth[_0x593d('0xa')](),controller[_0x593d('0x19')]);router[_0x593d('0x15')](_0x593d('0x1a'),controller['notify']);router[_0x593d('0x15')](_0x593d('0x1b'),auth[_0x593d('0xa')](),controller[_0x593d('0x1c')]);router['put'](_0x593d('0x1d'),auth[_0x593d('0xa')](),controller[_0x593d('0x1e')]);router[_0x593d('0x1f')](_0x593d('0x1d'),auth[_0x593d('0xa')](),controller[_0x593d('0x20')]);router[_0x593d('0x1f')](_0x593d('0xe'),auth[_0x593d('0xa')](),controller[_0x593d('0x21')]);router[_0x593d('0x1f')](_0x593d('0xf'),auth[_0x593d('0xa')](),controller[_0x593d('0x22')]);router[_0x593d('0x1f')](_0x593d('0x11'),auth[_0x593d('0xa')](),controller[_0x593d('0x23')]);module[_0x593d('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f8161e4..e797490 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 _0x8112=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','twilio','sinch'];(function(_0xa08bdf,_0x4989d7){var _0x5ce623=function(_0x24965f){while(--_0x24965f){_0xa08bdf['push'](_0xa08bdf['shift']());}};_0x5ce623(++_0x4989d7);}(_0x8112,0xc8));var _0x2811=function(_0x4d35c0,_0x413c5b){_0x4d35c0=_0x4d35c0-0x0;var _0x1e80fe=_0x8112[_0x4d35c0];return _0x1e80fe;};'use strict';var Sequelize=require(_0x2811('0x0'));var rs=require(_0x2811('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2811('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2811('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2811('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2811('0x3')],'defaultValue':function(){return rs[_0x2811('0x4')]();}},'phone':{'type':Sequelize[_0x2811('0x3')]},'type':{'type':Sequelize[_0x2811('0x5')](_0x2811('0x6'),_0x2811('0x7'))},'accountSid':{'type':Sequelize[_0x2811('0x3')]},'baseUrl':{'type':Sequelize[_0x2811('0x3')]},'authToken':{'type':Sequelize[_0x2811('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2811('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2811('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2811('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2811('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2811('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2811('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2811('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2811('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2811('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x2811('0x9')],'defaultValue':![],'comment':_0x2811('0xc'),'set':function(_0x22d777){if(!_0x22d777){this['setDataValue'](_0x2811('0xd'),null);}this[_0x2811('0xe')](_0x2811('0xf'),_0x22d777);}},'description':{'type':Sequelize[_0x2811('0x3')]}}; \ No newline at end of file +var _0x4cc3=['exports','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4cc3,0x14f));var _0x34cc=function(_0x571f12,_0x564824){_0x571f12=_0x571f12-0x0;var _0x1c6337=_0x4cc3[_0x571f12];return _0x1c6337;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x34cc('0x0'));module[_0x34cc('0x1')]={'name':{'type':Sequelize[_0x34cc('0x2')],'unique':_0x34cc('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x34cc('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x34cc('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x34cc('0x2')],'defaultValue':function(){return rs[_0x34cc('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x34cc('0x5')](_0x34cc('0x6'),_0x34cc('0x7'))},'accountSid':{'type':Sequelize[_0x34cc('0x2')]},'baseUrl':{'type':Sequelize[_0x34cc('0x2')]},'authToken':{'type':Sequelize[_0x34cc('0x2')]},'notificationTemplate':{'type':Sequelize[_0x34cc('0x8')],'defaultValue':function(){return _0x34cc('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x34cc('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x34cc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x34cc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x34cc('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34cc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x34cc('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x34cc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34cc('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x34cc('0xa')],'defaultValue':![],'comment':_0x34cc('0xc'),'set':function(_0x1c3151){if(!_0x1c3151){this[_0x34cc('0xd')](_0x34cc('0xe'),null);}this[_0x34cc('0xd')](_0x34cc('0xf'),_0x1c3151);}},'description':{'type':Sequelize[_0x34cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 28dd622..80e9e9b 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 _0x431c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','params','Disposition','getDispositions','findOne','order','sort','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','notifications','message_id','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','push','close','unmanaged','created','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','waitForTheAssignedQueue','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','map','WhatsappAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation'];(function(_0x1c7a74,_0x3afa7d){var _0x3e039b=function(_0x42def7){while(--_0x42def7){_0x1c7a74['push'](_0x1c7a74['shift']());}};_0x3e039b(++_0x3afa7d);}(_0x431c,0x1e8));var _0xc431=function(_0x3858ed,_0x3aa61a){_0x3858ed=_0x3858ed-0x0;var _0x5d3ead=_0x431c[_0x3858ed];return _0x5d3ead;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc431('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc431('0x1'));var rp=require(_0xc431('0x2'));var moment=require(_0xc431('0x3'));var BPromise=require(_0xc431('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc431('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc431('0x6'));var squel=require(_0xc431('0x7'));var crypto=require(_0xc431('0x8'));var jsforce=require(_0xc431('0x9'));var deskjs=require(_0xc431('0xa'));var toCsv=require(_0xc431('0xb'));var querystring=require(_0xc431('0xc'));var Papa=require('papaparse');var Redis=require(_0xc431('0xd'));var authService=require(_0xc431('0xe'));var qs=require(_0xc431('0xf'));var as=require(_0xc431('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc431('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc431('0x12'));var licenseUtil=require(_0xc431('0x13'));var db=require(_0xc431('0x14'))['db'];config[_0xc431('0x15')]=_['defaults'](config[_0xc431('0x15')],{'host':_0xc431('0x16'),'port':0x18eb});var socket=require(_0xc431('0x17'))(new Redis(config[_0xc431('0x15')]));require(_0xc431('0x18'))[_0xc431('0x19')](socket);var jayson=require(_0xc431('0x1a'));var client=jayson[_0xc431('0x1b')][_0xc431('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x24ce39,_0x5ec1d8,_0x1c4039,_0x56f252){return new BPromise(function(_0x38ee10,_0x4c4bbf){var _0x526796=_0x56f252||client;return _0x526796[_0xc431('0x1d')](_0x24ce39,_0x1c4039)[_0xc431('0x1e')](function(_0x3e68f5){logger['info'](_0xc431('0x1f'),_0x5ec1d8,_0xc431('0x20'));logger[_0xc431('0x21')](_0xc431('0x22'),_0x5ec1d8,'request\x20sent',JSON[_0xc431('0x23')](_0x3e68f5));if(_0x3e68f5[_0xc431('0x24')]){if(_0x3e68f5[_0xc431('0x24')][_0xc431('0x25')]===0x1f4){logger[_0xc431('0x24')](_0xc431('0x1f'),_0x5ec1d8,_0x3e68f5[_0xc431('0x24')][_0xc431('0x26')]);return _0x4c4bbf(_0x3e68f5[_0xc431('0x24')][_0xc431('0x26')]);}logger[_0xc431('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5ec1d8,_0x3e68f5[_0xc431('0x24')][_0xc431('0x26')]);return _0x38ee10(_0x3e68f5[_0xc431('0x24')][_0xc431('0x26')]);}else{logger[_0xc431('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x5ec1d8,_0xc431('0x20'));_0x38ee10(_0x3e68f5[_0xc431('0x28')][_0xc431('0x26')]);}})['catch'](function(_0x1b4b90){logger[_0xc431('0x24')](_0xc431('0x1f'),_0x5ec1d8,_0x1b4b90);_0x4c4bbf(_0x1b4b90);});});}function respondWithStatusCode(_0x133df4,_0x4d4127){_0x4d4127=_0x4d4127||0xcc;return function(_0x44137f){if(_0x44137f){return _0x133df4['sendStatus'](_0x4d4127);}return _0x133df4['status'](_0x4d4127)[_0xc431('0x29')]();};}function respondWithResult(_0x46e0c4,_0x3d2a83){_0x3d2a83=_0x3d2a83||0xc8;return function(_0x1105c1){if(_0x1105c1){return _0x46e0c4[_0xc431('0x2a')](_0x3d2a83)[_0xc431('0x2b')](_0x1105c1);}};}function respondWithFilteredResult(_0x13ec7d,_0x5c14cb){return function(_0x3b51d5){if(_0x3b51d5){var _0x1d1f0f=typeof _0x5c14cb[_0xc431('0x2c')]===_0xc431('0x2d')&&typeof _0x5c14cb[_0xc431('0x2e')]==='undefined';var _0x3501b6=_0x3b51d5[_0xc431('0x2f')];var _0x135e76=_0x1d1f0f?0x0:_0x5c14cb[_0xc431('0x2c')];var _0x486ce9=_0x1d1f0f?_0x3b51d5['count']:_0x5c14cb[_0xc431('0x2c')]+_0x5c14cb['limit'];var _0x3d6b94;if(_0x486ce9>=_0x3501b6){_0x486ce9=_0x3501b6;_0x3d6b94=0xc8;}else{_0x3d6b94=0xce;}_0x13ec7d[_0xc431('0x2a')](_0x3d6b94);return _0x13ec7d[_0xc431('0x30')]('Content-Range',_0x135e76+'-'+_0x486ce9+'/'+_0x3501b6)[_0xc431('0x2b')](_0x3b51d5);}return null;};}function patchUpdates(_0x3fd1c3){return function(_0x38f967){try{jsonpatch[_0xc431('0x31')](_0x38f967,_0x3fd1c3,!![]);}catch(_0x26e210){return BPromise[_0xc431('0x32')](_0x26e210);}return _0x38f967[_0xc431('0x33')]();};}function saveUpdates(_0x3e4524,_0x595548){return function(_0x3d9574){if(_0x3d9574){return _0x3d9574[_0xc431('0x34')](_0x3e4524)[_0xc431('0x1e')](function(_0x369bc4){return _0x369bc4;});}return null;};}function removeEntity(_0x6fb569,_0x52669a){return function(_0x48d005){if(_0x48d005){return _0x48d005[_0xc431('0x35')]()[_0xc431('0x1e')](function(){var _0xa96868=_0x48d005[_0xc431('0x36')]({'plain':!![]});var _0x3fa8dc=_0xc431('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x3fa8dc,'resourceId':_0xa96868['id']}})[_0xc431('0x1e')](function(){return _0x48d005;});})['then'](function(){_0x6fb569[_0xc431('0x2a')](0xcc)[_0xc431('0x29')]();});}};}function handleEntityNotFound(_0xe1edcc,_0x37874e){return function(_0xe7f09b){if(!_0xe7f09b){_0xe1edcc['sendStatus'](0x194);}return _0xe7f09b;};}function handleError(_0x26a634,_0x2199dd){_0x2199dd=_0x2199dd||0x1f4;return function(_0x4b5e43){logger[_0xc431('0x24')](_0x4b5e43[_0xc431('0x38')]);if(_0x4b5e43[_0xc431('0x39')]){delete _0x4b5e43['name'];}_0x26a634[_0xc431('0x2a')](_0x2199dd)[_0xc431('0x3a')](_0x4b5e43);};}exports[_0xc431('0x3b')]=function(_0x3d1126,_0xc449d){var _0xb7df31={'include':[{'model':db[_0xc431('0x3c')],'as':'mandatoryDispositionPause'}]},_0x107d09={},_0x6fe5c6={'count':0x0,'rows':[]};var _0x3ece7b=_[_0xc431('0x3d')](db[_0xc431('0x3e')]['rawAttributes'],function(_0x159fbe){return{'name':_0x159fbe[_0xc431('0x3f')],'type':_0x159fbe[_0xc431('0x40')][_0xc431('0x41')]};});_0x107d09[_0xc431('0x42')]=_[_0xc431('0x3d')](_0x3ece7b,_0xc431('0x39'));_0x107d09[_0xc431('0x43')]=_['keys'](_0x3d1126['query']);_0x107d09[_0xc431('0x44')]=_[_0xc431('0x45')](_0x107d09['model'],_0x107d09[_0xc431('0x43')]);_0xb7df31[_0xc431('0x46')]=_['intersection'](_0x107d09['model'],qs['fields'](_0x3d1126[_0xc431('0x43')][_0xc431('0x47')]));_0xb7df31[_0xc431('0x46')]=_0xb7df31[_0xc431('0x46')]['length']?_0xb7df31[_0xc431('0x46')]:_0x107d09['model'];if(!_0x3d1126['query'][_0xc431('0x48')](_0xc431('0x49'))){_0xb7df31['limit']=qs[_0xc431('0x2e')](_0x3d1126[_0xc431('0x43')]['limit']);_0xb7df31[_0xc431('0x2c')]=qs[_0xc431('0x2c')](_0x3d1126[_0xc431('0x43')][_0xc431('0x2c')]);}_0xb7df31['order']=qs['sort'](_0x3d1126[_0xc431('0x43')]['sort']);_0xb7df31[_0xc431('0x4a')]=qs['filters'](_[_0xc431('0x4b')](_0x3d1126[_0xc431('0x43')],_0x107d09[_0xc431('0x44')]),_0x3ece7b);if(_0x3d1126[_0xc431('0x43')][_0xc431('0x4c')]){_0xb7df31[_0xc431('0x4a')]=_[_0xc431('0x4d')](_0xb7df31[_0xc431('0x4a')],{'$or':_[_0xc431('0x3d')](_0x3ece7b,function(_0x501fc8){if(_0x501fc8['type']!==_0xc431('0x4e')){var _0x4a38a7={};_0x4a38a7[_0x501fc8[_0xc431('0x39')]]={'$like':'%'+_0x3d1126[_0xc431('0x43')][_0xc431('0x4c')]+'%'};return _0x4a38a7;}})});}_0xb7df31=_[_0xc431('0x4d')]({},_0xb7df31,_0x3d1126[_0xc431('0x4f')]);var _0x586713={'where':_0xb7df31[_0xc431('0x4a')]};return db['WhatsappAccount'][_0xc431('0x2f')](_0x586713)[_0xc431('0x1e')](function(_0x269899){_0x6fe5c6['count']=_0x269899;if(_0x3d1126['query'][_0xc431('0x50')]){_0xb7df31[_0xc431('0x51')]=[{'all':!![]}];}return db[_0xc431('0x3e')][_0xc431('0x52')](_0xb7df31);})[_0xc431('0x1e')](function(_0x1814ed){_0x6fe5c6[_0xc431('0x53')]=_0x1814ed;return _0x6fe5c6;})[_0xc431('0x1e')](respondWithFilteredResult(_0xc449d,_0xb7df31))[_0xc431('0x54')](handleError(_0xc449d,null));};exports['show']=function(_0x114432,_0x181899){var _0x4477bb={'raw':![],'where':{'id':_0x114432['params']['id']},'include':[{'model':db[_0xc431('0x3c')],'as':'mandatoryDispositionPause'}]},_0x14a764={};_0x14a764[_0xc431('0x42')]=_[_0xc431('0x55')](db[_0xc431('0x3e')][_0xc431('0x56')]);_0x14a764[_0xc431('0x43')]=_[_0xc431('0x55')](_0x114432['query']);_0x14a764[_0xc431('0x44')]=_[_0xc431('0x45')](_0x14a764['model'],_0x14a764['query']);_0x4477bb[_0xc431('0x46')]=_['intersection'](_0x14a764[_0xc431('0x42')],qs['fields'](_0x114432[_0xc431('0x43')][_0xc431('0x47')]));_0x4477bb[_0xc431('0x46')]=_0x4477bb[_0xc431('0x46')][_0xc431('0x57')]?_0x4477bb[_0xc431('0x46')]:_0x14a764[_0xc431('0x42')];if(_0x114432['query']['includeAll']){_0x4477bb[_0xc431('0x51')]=[{'all':!![]}];}_0x4477bb=_[_0xc431('0x4d')]({},_0x4477bb,_0x114432[_0xc431('0x4f')]);return db['WhatsappAccount'][_0xc431('0x58')](_0x4477bb)['then'](handleEntityNotFound(_0x181899,null))[_0xc431('0x1e')](respondWithResult(_0x181899,null))[_0xc431('0x54')](handleError(_0x181899,null));};exports[_0xc431('0x59')]=function(_0x3a6fd1,_0x56f37c){return db[_0xc431('0x3e')][_0xc431('0x59')](_0x3a6fd1['body'],{})[_0xc431('0x1e')](function(_0x11ef74){var _0x289402=_0x3a6fd1[_0xc431('0x5a')][_0xc431('0x36')]({'plain':!![]});if(!_0x289402)throw new Error(_0xc431('0x5b'));if(_0x289402['role']==='user'){var _0x349c24=_0x11ef74[_0xc431('0x36')]({'plain':!![]});var _0x22b227='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x22b227,'userProfileId':_0x289402[_0xc431('0x5c')]},'raw':!![]})[_0xc431('0x1e')](function(_0x471476){if(_0x471476&&_0x471476[_0xc431('0x5d')]===0x0){return db['UserProfileResource'][_0xc431('0x59')]({'name':_0x349c24['name'],'resourceId':_0x349c24['id'],'type':_0x471476[_0xc431('0x39')],'sectionId':_0x471476['id']},{})[_0xc431('0x1e')](function(){return _0x11ef74;});}else{return _0x11ef74;}})[_0xc431('0x54')](function(_0x2380ad){logger[_0xc431('0x24')](_0xc431('0x5e'),_0x2380ad);throw _0x2380ad;});}return _0x11ef74;})[_0xc431('0x1e')](respondWithResult(_0x56f37c,0xc9))['catch'](handleError(_0x56f37c,null));};exports[_0xc431('0x34')]=function(_0x151d2a,_0x20c469){if(_0x151d2a[_0xc431('0x5f')]['id']){delete _0x151d2a[_0xc431('0x5f')]['id'];}return db['WhatsappAccount'][_0xc431('0x58')]({'where':{'id':_0x151d2a['params']['id']},'include':[{'model':db['Pause'],'as':_0xc431('0x60')}]})['then'](handleEntityNotFound(_0x20c469,null))[_0xc431('0x1e')](saveUpdates(_0x151d2a[_0xc431('0x5f')],null))[_0xc431('0x1e')](respondWithResult(_0x20c469,null))[_0xc431('0x54')](handleError(_0x20c469,null));};exports[_0xc431('0x35')]=function(_0x541349,_0x4921a9){return db[_0xc431('0x3e')]['find']({'where':{'id':_0x541349['params']['id']}})['then'](handleEntityNotFound(_0x4921a9,null))[_0xc431('0x1e')](removeEntity(_0x4921a9,null))['catch'](handleError(_0x4921a9,null));};exports[_0xc431('0x61')]=function(_0x76472,_0x17b6a7){return db[_0xc431('0x3e')]['describe']()[_0xc431('0x1e')](respondWithResult(_0x17b6a7,null))[_0xc431('0x54')](handleError(_0x17b6a7,null));};exports['addDisposition']=function(_0x56a610,_0x4bf890,_0xc11299){if(_0x56a610['body']['id']){delete _0x56a610[_0xc431('0x5f')]['id'];}return db['WhatsappAccount'][_0xc431('0x58')]({'where':{'id':_0x56a610[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x4bf890,null))[_0xc431('0x1e')](function(_0x15f8e8){if(_0x15f8e8){_0x56a610[_0xc431('0x5f')]['WhatsappAccountId']=_0x15f8e8['id'];return db[_0xc431('0x63')][_0xc431('0x59')](_0x56a610['body']);}})[_0xc431('0x1e')](respondWithResult(_0x4bf890,null))[_0xc431('0x54')](handleError(_0x4bf890,null));};exports[_0xc431('0x64')]=function(_0x9fe152,_0x1efe63,_0x2dad9b){var _0x54b102={'raw':![],'where':{}};var _0x128681={};var _0x3776f5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc431('0x65')]({'where':{'id':_0x9fe152[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x1efe63,null))[_0xc431('0x1e')](function(_0x499518){if(_0x499518){_0x128681['model']=_['keys'](db[_0xc431('0x63')][_0xc431('0x56')]);_0x128681[_0xc431('0x43')]=_[_0xc431('0x55')](_0x9fe152['query']);_0x128681[_0xc431('0x44')]=_[_0xc431('0x45')](_0x128681[_0xc431('0x42')],_0x128681[_0xc431('0x43')]);_0x54b102[_0xc431('0x46')]=_['intersection'](_0x128681[_0xc431('0x42')],qs[_0xc431('0x47')](_0x9fe152[_0xc431('0x43')][_0xc431('0x47')]));_0x54b102[_0xc431('0x46')]=_0x54b102[_0xc431('0x46')]['length']?_0x54b102[_0xc431('0x46')]:_0x128681[_0xc431('0x42')];if(!_0x9fe152[_0xc431('0x43')]['hasOwnProperty'](_0xc431('0x49'))){_0x54b102[_0xc431('0x2e')]=qs['limit'](_0x9fe152[_0xc431('0x43')][_0xc431('0x2e')]);_0x54b102[_0xc431('0x2c')]=qs['offset'](_0x9fe152[_0xc431('0x43')][_0xc431('0x2c')]);}_0x54b102[_0xc431('0x66')]=qs['sort'](_0x9fe152[_0xc431('0x43')][_0xc431('0x67')]);_0x54b102[_0xc431('0x4a')]=qs[_0xc431('0x44')](_['pick'](_0x9fe152[_0xc431('0x43')],_0x128681[_0xc431('0x44')]));_0x54b102[_0xc431('0x4a')][_0xc431('0x68')]=_0x499518['id'];if(_0x9fe152[_0xc431('0x43')][_0xc431('0x4c')]){_0x54b102[_0xc431('0x4a')]=_['merge'](_0x54b102[_0xc431('0x4a')],{'$or':_['map'](_0x54b102['attributes'],function(_0xfec027){var _0x56c882={};_0x56c882[_0xfec027]={'$like':'%'+_0x9fe152[_0xc431('0x43')][_0xc431('0x4c')]+'%'};return _0x56c882;})});}_0x54b102=_['merge']({},_0x54b102,_0x9fe152[_0xc431('0x4f')]);return db[_0xc431('0x63')]['count']({'where':_0x54b102[_0xc431('0x4a')]})[_0xc431('0x1e')](function(_0x56975c){_0x3776f5['count']=_0x56975c;if(_0x9fe152['query'][_0xc431('0x50')]){_0x54b102[_0xc431('0x51')]=[{'all':!![]}];}return db['Disposition'][_0xc431('0x52')](_0x54b102);})[_0xc431('0x1e')](function(_0xea4c5d){_0x3776f5['rows']=_0xea4c5d;return _0x3776f5;});}})[_0xc431('0x1e')](respondWithFilteredResult(_0x1efe63,_0x54b102))['catch'](handleError(_0x1efe63,null));};exports[_0xc431('0x69')]=function(_0x24f536,_0x33f223,_0x5b5c94){return db[_0xc431('0x3e')][_0xc431('0x58')]({'where':{'id':_0x24f536[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x33f223,null))[_0xc431('0x1e')](function(_0x241c54){if(_0x241c54){return _0x241c54['removeDispositions'](_0x24f536['query'][_0xc431('0x6a')]);}})[_0xc431('0x1e')](respondWithStatusCode(_0x33f223,null))['catch'](handleError(_0x33f223,null));};exports[_0xc431('0x6b')]=function(_0x41c649,_0x35aa31,_0xdff2e7){if(_0x41c649[_0xc431('0x5f')]['id']){delete _0x41c649[_0xc431('0x5f')]['id'];}return db[_0xc431('0x3e')][_0xc431('0x58')]({'where':{'id':_0x41c649[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x35aa31,null))[_0xc431('0x1e')](function(_0x3909f6){if(_0x3909f6){_0x41c649['body'][_0xc431('0x68')]=_0x3909f6['id'];return db[_0xc431('0x6c')][_0xc431('0x59')](_0x41c649[_0xc431('0x5f')]);}})[_0xc431('0x1e')](respondWithResult(_0x35aa31,null))[_0xc431('0x54')](handleError(_0x35aa31,null));};exports[_0xc431('0x6d')]=function(_0x372cd3,_0x57ecdf,_0x5af92c){var _0x22bc44={'raw':![],'where':{}};var _0x296069={};var _0x107d43={'count':0x0,'rows':[]};return db[_0xc431('0x3e')][_0xc431('0x65')]({'where':{'id':_0x372cd3[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x57ecdf,null))[_0xc431('0x1e')](function(_0x1babab){if(_0x1babab){_0x296069[_0xc431('0x42')]=_[_0xc431('0x55')](db[_0xc431('0x6c')][_0xc431('0x56')]);_0x296069[_0xc431('0x43')]=_[_0xc431('0x55')](_0x372cd3[_0xc431('0x43')]);_0x296069[_0xc431('0x44')]=_[_0xc431('0x45')](_0x296069[_0xc431('0x42')],_0x296069['query']);_0x22bc44[_0xc431('0x46')]=_[_0xc431('0x45')](_0x296069[_0xc431('0x42')],qs[_0xc431('0x47')](_0x372cd3[_0xc431('0x43')][_0xc431('0x47')]));_0x22bc44[_0xc431('0x46')]=_0x22bc44[_0xc431('0x46')][_0xc431('0x57')]?_0x22bc44[_0xc431('0x46')]:_0x296069[_0xc431('0x42')];if(!_0x372cd3[_0xc431('0x43')]['hasOwnProperty'](_0xc431('0x49'))){_0x22bc44[_0xc431('0x2e')]=qs[_0xc431('0x2e')](_0x372cd3[_0xc431('0x43')][_0xc431('0x2e')]);_0x22bc44[_0xc431('0x2c')]=qs[_0xc431('0x2c')](_0x372cd3[_0xc431('0x43')][_0xc431('0x2c')]);}_0x22bc44[_0xc431('0x66')]=qs['sort'](_0x372cd3[_0xc431('0x43')][_0xc431('0x67')]);_0x22bc44[_0xc431('0x4a')]=qs[_0xc431('0x44')](_[_0xc431('0x4b')](_0x372cd3[_0xc431('0x43')],_0x296069[_0xc431('0x44')]));_0x22bc44[_0xc431('0x4a')][_0xc431('0x68')]=_0x1babab['id'];if(_0x372cd3[_0xc431('0x43')][_0xc431('0x4c')]){_0x22bc44[_0xc431('0x4a')]=_[_0xc431('0x4d')](_0x22bc44[_0xc431('0x4a')],{'$or':_[_0xc431('0x3d')](_0x22bc44['attributes'],function(_0x1bd44c){var _0x2dcade={};_0x2dcade[_0x1bd44c]={'$like':'%'+_0x372cd3[_0xc431('0x43')]['filter']+'%'};return _0x2dcade;})});}_0x22bc44=_[_0xc431('0x4d')]({},_0x22bc44,_0x372cd3[_0xc431('0x4f')]);return db['CannedAnswer'][_0xc431('0x2f')]({'where':_0x22bc44[_0xc431('0x4a')]})[_0xc431('0x1e')](function(_0x3f36d9){_0x107d43[_0xc431('0x2f')]=_0x3f36d9;if(_0x372cd3[_0xc431('0x43')][_0xc431('0x50')]){_0x22bc44['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x22bc44);})[_0xc431('0x1e')](function(_0x4ee9ac){_0x107d43[_0xc431('0x53')]=_0x4ee9ac;return _0x107d43;});}})['then'](respondWithFilteredResult(_0x57ecdf,_0x22bc44))[_0xc431('0x54')](handleError(_0x57ecdf,null));};exports[_0xc431('0x6e')]=function(_0x2f1e8,_0xd83c9c,_0x48333b){return db[_0xc431('0x3e')]['find']({'where':{'id':_0x2f1e8[_0xc431('0x62')]['id']}})['then'](handleEntityNotFound(_0xd83c9c,null))[_0xc431('0x1e')](function(_0x5e5586){if(_0x5e5586){return _0x5e5586[_0xc431('0x6e')](_0x2f1e8['query'][_0xc431('0x6a')]);}})[_0xc431('0x1e')](respondWithStatusCode(_0xd83c9c,null))['catch'](handleError(_0xd83c9c,null));};exports[_0xc431('0x6f')]=function(_0x5709ca,_0x2720f9,_0xf57d59){return db[_0xc431('0x3e')]['find']({'where':{'id':_0x5709ca[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x2720f9,null))[_0xc431('0x1e')](function(_0x5ce074){if(_0x5ce074){return _0x5ce074[_0xc431('0x6f')](_0x5709ca[_0xc431('0x5f')][_0xc431('0x6a')],_[_0xc431('0x70')](_0x5709ca[_0xc431('0x5f')],['ids','id'])||{})[_0xc431('0x71')](function(_0x27323f){for(var _0x49180c=0x0;_0x49180c<_0x5709ca[_0xc431('0x5f')][_0xc431('0x6a')]['length'];_0x49180c+=0x1){socket[_0xc431('0x72')](_0xc431('0x73'),{'UserId':Number(_0x5709ca[_0xc431('0x5f')][_0xc431('0x6a')][_0x49180c]),'WhatsappAccountId':Number(_0x5709ca[_0xc431('0x62')]['id'])});}return _0x27323f;});}})['then'](respondWithResult(_0x2720f9,null))[_0xc431('0x54')](handleError(_0x2720f9,null));};exports['removeAgents']=function(_0x7d505f,_0x316488,_0x47347a){return db[_0xc431('0x3e')]['find']({'where':{'id':_0x7d505f[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x316488,null))[_0xc431('0x1e')](function(_0x5b2382){if(_0x5b2382){return _0x5b2382[_0xc431('0x74')](_0x7d505f[_0xc431('0x43')][_0xc431('0x6a')])[_0xc431('0x1e')](function(){if(_[_0xc431('0x75')](_0x7d505f[_0xc431('0x43')][_0xc431('0x6a')])){for(var _0xd96ae3=0x0;_0xd96ae3<_0x7d505f[_0xc431('0x43')][_0xc431('0x6a')][_0xc431('0x57')];_0xd96ae3+=0x1){socket[_0xc431('0x72')](_0xc431('0x76'),{'UserId':Number(_0x7d505f[_0xc431('0x43')]['ids'][_0xd96ae3]),'WhatsappAccountId':Number(_0x7d505f['params']['id'])});}}else{socket[_0xc431('0x72')](_0xc431('0x76'),{'UserId':Number(_0x7d505f[_0xc431('0x43')][_0xc431('0x6a')]),'WhatsappAccountId':Number(_0x7d505f[_0xc431('0x62')]['id'])});}});}})[_0xc431('0x1e')](respondWithStatusCode(_0x316488,null))[_0xc431('0x54')](handleError(_0x316488,null));};exports[_0xc431('0x77')]=function(_0x57c5fa,_0x2441ab,_0x4d8538){var _0xb8ab8d={};var _0x1a4d90={};var _0x52c3f6;var _0x105348;return db[_0xc431('0x3e')]['findOne']({'where':{'id':_0x57c5fa[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x2441ab,null))['then'](function(_0x16eae9){if(_0x16eae9){_0x52c3f6=_0x16eae9;_0x1a4d90[_0xc431('0x42')]=_[_0xc431('0x55')](db['User'][_0xc431('0x56')]);_0x1a4d90[_0xc431('0x43')]=_[_0xc431('0x55')](_0x57c5fa[_0xc431('0x43')]);_0x1a4d90[_0xc431('0x44')]=_[_0xc431('0x45')](_0x1a4d90[_0xc431('0x42')],_0x1a4d90[_0xc431('0x43')]);_0xb8ab8d[_0xc431('0x46')]=_[_0xc431('0x45')](_0x1a4d90[_0xc431('0x42')],qs[_0xc431('0x47')](_0x57c5fa['query'][_0xc431('0x47')]));_0xb8ab8d[_0xc431('0x46')]=_0xb8ab8d[_0xc431('0x46')][_0xc431('0x57')]?_0xb8ab8d[_0xc431('0x46')]:_0x1a4d90[_0xc431('0x42')];_0xb8ab8d[_0xc431('0x66')]=qs['sort'](_0x57c5fa[_0xc431('0x43')]['sort']);_0xb8ab8d['where']=qs[_0xc431('0x44')](_[_0xc431('0x4b')](_0x57c5fa[_0xc431('0x43')],_0x1a4d90['filters']));if(_0x57c5fa[_0xc431('0x43')][_0xc431('0x4c')]){_0xb8ab8d[_0xc431('0x4a')]=_['merge'](_0xb8ab8d[_0xc431('0x4a')],{'$or':_[_0xc431('0x3d')](_0xb8ab8d[_0xc431('0x46')],function(_0x27be7d){var _0x5d831b={};_0x5d831b[_0x27be7d]={'$like':'%'+_0x57c5fa[_0xc431('0x43')][_0xc431('0x4c')]+'%'};return _0x5d831b;})});}_0xb8ab8d=_[_0xc431('0x4d')]({},_0xb8ab8d,_0x57c5fa[_0xc431('0x4f')]);return _0x52c3f6[_0xc431('0x77')](_0xb8ab8d);}})['then'](function(_0xd59521){if(_0xd59521){_0x105348=_0xd59521[_0xc431('0x57')];if(!_0x57c5fa['query'][_0xc431('0x48')]('nolimit')){_0xb8ab8d[_0xc431('0x2e')]=qs[_0xc431('0x2e')](_0x57c5fa[_0xc431('0x43')]['limit']);_0xb8ab8d[_0xc431('0x2c')]=qs[_0xc431('0x2c')](_0x57c5fa['query'][_0xc431('0x2c')]);}return _0x52c3f6[_0xc431('0x77')](_0xb8ab8d);}})[_0xc431('0x1e')](function(_0x307c22){if(_0x307c22){return _0x307c22?{'count':_0x105348,'rows':_0x307c22}:null;}})[_0xc431('0x1e')](respondWithResult(_0x2441ab,null))[_0xc431('0x54')](handleError(_0x2441ab,null));};exports[_0xc431('0x78')]=function(_0x2aabae,_0x16c64f){var _0x47ff1e=_0x2aabae['params']['id'];var _0x328a76=_0x2aabae[_0xc431('0x5f')];var _0x256d16=0xc8;var _0x34b67f=null;return db[_0xc431('0x79')][_0xc431('0x7a')]({'isolationLevel':db['sequelize'][_0xc431('0x7b')][_0xc431('0x7c')][_0xc431('0x7d')]},function(_0x2a8b63){return db['WhatsappAccount'][_0xc431('0x65')]({'where':{'id':_0x47ff1e},'transaction':_0x2a8b63})[_0xc431('0x1e')](function(_0x321c4d){if(_0x321c4d){return db[_0xc431('0x7e')][_0xc431('0x35')]({'where':{'WhatsappAccountId':_0x47ff1e},'transaction':_0x2a8b63})['then'](function(){var _0x22d154=_[_0xc431('0x3d')](_0x328a76,function(_0x3d4111){_0x3d4111[_0xc431('0x68')]=_0x47ff1e;return _0x3d4111;});return db[_0xc431('0x7e')][_0xc431('0x7f')](_0x22d154,{'transaction':_0x2a8b63});});}else{_0x256d16=0x194;_0x34b67f=[];}});})[_0xc431('0x1e')](function(){if(_0x256d16!==0x194){return db[_0xc431('0x7e')][_0xc431('0x80')]({'where':{'WhatsappAccountId':_0x47ff1e},'order':'priority'})[_0xc431('0x1e')](function(_0x577d8c){_0x34b67f=_0x577d8c;});}})[_0xc431('0x54')](function(_0x757ca4){_0x256d16=0x1f4;logger[_0xc431('0x24')](_0x757ca4[_0xc431('0x38')]);if(_0x757ca4[_0xc431('0x39')]){delete _0x757ca4[_0xc431('0x39')];}_0x34b67f=_0x757ca4;})[_0xc431('0x81')](function(){if(_0x34b67f===null){_0x16c64f['sendStatus'](_0x256d16);}else{if(_0x256d16===0x1f4){_0x16c64f[_0xc431('0x2a')](_0x256d16)[_0xc431('0x3a')](_0x34b67f);}else{_0x16c64f[_0xc431('0x2a')](_0x256d16)[_0xc431('0x2b')](_0x34b67f);}}});};exports[_0xc431('0x82')]=function(_0x31743d,_0x36b7df,_0x2df0ac){var _0x39c60d={};var _0x1ada8e={};var _0x5273b9;var _0x23529f;return db[_0xc431('0x3e')][_0xc431('0x65')]({'where':{'id':_0x31743d[_0xc431('0x62')]['id']}})[_0xc431('0x1e')](handleEntityNotFound(_0x36b7df,null))[_0xc431('0x1e')](function(_0x5a696a){if(_0x5a696a){_0x5273b9=_0x5a696a;_0x1ada8e[_0xc431('0x42')]=_[_0xc431('0x55')](db[_0xc431('0x7e')]['rawAttributes']);_0x1ada8e['query']=_[_0xc431('0x55')](_0x31743d[_0xc431('0x43')]);_0x1ada8e['filters']=_['intersection'](_0x1ada8e[_0xc431('0x42')],_0x1ada8e['query']);_0x39c60d[_0xc431('0x46')]=_[_0xc431('0x45')](_0x1ada8e[_0xc431('0x42')],qs[_0xc431('0x47')](_0x31743d['query'][_0xc431('0x47')]));_0x39c60d[_0xc431('0x46')]=_0x39c60d['attributes'][_0xc431('0x57')]?_0x39c60d['attributes']:_0x1ada8e['model'];_0x39c60d['order']=qs[_0xc431('0x67')](_0x31743d['query']['sort']);_0x39c60d[_0xc431('0x4a')]=qs[_0xc431('0x44')](_[_0xc431('0x4b')](_0x31743d['query'],_0x1ada8e[_0xc431('0x44')]));if(_0x31743d[_0xc431('0x43')][_0xc431('0x4c')]){_0x39c60d[_0xc431('0x4a')]=_[_0xc431('0x4d')](_0x39c60d[_0xc431('0x4a')],{'$or':_[_0xc431('0x3d')](_0x39c60d[_0xc431('0x46')],function(_0x44a6cc){var _0x207ad5={};_0x207ad5[_0x44a6cc]={'$like':'%'+_0x31743d[_0xc431('0x43')][_0xc431('0x4c')]+'%'};return _0x207ad5;})});}_0x39c60d=_[_0xc431('0x4d')]({},_0x39c60d,_0x31743d['options']);return _0x5273b9[_0xc431('0x82')](_0x39c60d);}})[_0xc431('0x1e')](function(_0x51987e){if(_0x51987e){_0x23529f=_0x51987e[_0xc431('0x57')];if(!_0x31743d[_0xc431('0x43')][_0xc431('0x48')]('nolimit')){_0x39c60d['limit']=qs[_0xc431('0x2e')](_0x31743d['query'][_0xc431('0x2e')]);_0x39c60d['offset']=qs[_0xc431('0x2c')](_0x31743d['query'][_0xc431('0x2c')]);}return _0x5273b9[_0xc431('0x82')](_0x39c60d);}})['then'](function(_0x57fe3b){if(_0x57fe3b){return _0x57fe3b?{'count':_0x23529f,'rows':_0x57fe3b}:null;}})[_0xc431('0x1e')](respondWithResult(_0x36b7df,null))['catch'](handleError(_0x36b7df,null));};exports[_0xc431('0x83')]=function(_0x43dfb0,_0x26ebaa,_0x1e4872){var _0x1ce944={'channel':_0xc431('0x84')};var _0x23b97b=[];var _0x2d6366=[];var _0x34c601={};return db[_0xc431('0x3e')]['find']({'where':{'id':_0x43dfb0[_0xc431('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc431('0x85')}]})[_0xc431('0x1e')](handleEntityNotFound(_0x26ebaa,null))[_0xc431('0x1e')](function(_0x4c8c0a){_0x1ce944[_0xc431('0x86')]=_0x4c8c0a;if(_0x1ce944['account']&&_0x1ce944[_0xc431('0x86')]['type']===_0xc431('0x87')&&_0x43dfb0[_0xc431('0x5f')][_0xc431('0x88')]){if(_0x43dfb0[_0xc431('0x5f')][_0xc431('0x88')][_0xc431('0x57')]===0x0)return;if(_0x43dfb0[_0xc431('0x5f')]['statuses'][0x0][_0xc431('0x89')]!=='read')return;return db[_0xc431('0x8a')][_0xc431('0x34')]({'read':!![],'readAt':_0x43dfb0[_0xc431('0x5f')][_0xc431('0x88')][0x0][_0xc431('0x8b')]},{'where':{'messageId':_0x43dfb0[_0xc431('0x5f')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xc431('0x1e')](function(_0x2ad567){return _0x26ebaa[_0xc431('0x2a')](0xc8)['json'](_0x2ad567);});}_0x1ce944[_0xc431('0x8c')]=_['orderBy'](_0x4c8c0a[_0xc431('0x85')],['priority'],['asc']);if(_0x1ce944[_0xc431('0x86')][_0xc431('0x85')]){delete _0x1ce944['account'][_0xc431('0x85')];}return db[_0xc431('0x8d')][_0xc431('0x61')]()[_0xc431('0x1e')](function(_0x4d47a7){if(!_0x4d47a7){throw new db[(_0xc431('0x8e'))][(_0xc431('0x8f'))](_0xc431('0x90'));}_0x23b97b=_[_0xc431('0x91')](_[_0xc431('0x55')](_0x4d47a7),[_0xc431('0x92'),_0xc431('0x93')]);_0x2d6366=_[_0xc431('0x91')](_[_0xc431('0x55')](_0x4d47a7),['createdAt',_0xc431('0x93'),_0xc431('0x94'),_0xc431('0x95')]);_0x1ce944[_0xc431('0x5f')]={'mapKey':_0xc431('0x96')};if(_0x1ce944[_0xc431('0x86')]&&_0x1ce944['account'][_0xc431('0x40')]===_0xc431('0x97')){_0x1ce944['body'][_0xc431('0x98')]=_0x43dfb0[_0xc431('0x5f')][_0xc431('0x99')][_0xc431('0x9a')](_0xc431('0x9b'),'');_0x1ce944[_0xc431('0x5f')][_0xc431('0x5f')]=_0x43dfb0[_0xc431('0x5f')]['Body'];_0x1ce944[_0xc431('0x5f')][_0xc431('0x9c')]=_0x43dfb0['body']['MessageSid'];}if(_0x1ce944['account']&&_0x1ce944[_0xc431('0x86')][_0xc431('0x40')]===_0xc431('0x87')){_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')]=_0x43dfb0[_0xc431('0x5f')]['notifications'][0x0][_0xc431('0x98')];_0x1ce944[_0xc431('0x5f')][_0xc431('0x5f')]=_0x43dfb0['body'][_0xc431('0x9d')][0x0]['message'][_0xc431('0x5f')];_0x1ce944['body'][_0xc431('0x9c')]=_0x43dfb0[_0xc431('0x5f')]['notifications'][0x0][_0xc431('0x9e')];}if(_0x1ce944[_0xc431('0x5f')]['id']){delete _0x1ce944['body']['id'];}if(_[_0xc431('0x9f')](_0x1ce944['body'][_0xc431('0x98')])){throw new db[(_0xc431('0x8e'))][(_0xc431('0x8f'))]('from\x20is\x20mandatory');}if(_[_0xc431('0x9f')](_0x1ce944['body']['body'])||_0x1ce944[_0xc431('0x5f')][_0xc431('0x5f')]===''){throw new db[(_0xc431('0x8e'))][(_0xc431('0x8f'))](_0xc431('0xa0'));}if(_[_0xc431('0x9f')](_0x1ce944[_0xc431('0x5f')]['mapKey'])){throw new db[(_0xc431('0x8e'))][(_0xc431('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d6366);}if(!_[_0xc431('0xa1')](_0x2d6366,_0x1ce944[_0xc431('0x5f')][_0xc431('0xa2')])){throw new db[(_0xc431('0x8e'))][(_0xc431('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d6366);}_0x34c601[_0x1ce944['body']['mapKey']]=_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')];return db[_0xc431('0xa3')]['find']({'where':{'id':_0x1ce944['account'][_0xc431('0x95')]},'include':[{'model':db[_0xc431('0x8d')],'as':_0xc431('0xa4'),'where':_0x34c601,'limit':0x1,'order':[[_0xc431('0x93'),_0xc431('0xa5')]]}]});})[_0xc431('0x1e')](handleEntityNotFound(_0x26ebaa,null))['then'](function(_0x3a347d){if(_0x3a347d){_0x1ce944['list']=_[_0xc431('0x70')](_0x3a347d,[_0xc431('0xa4')]);if(_0x3a347d['Contacts']['length']){return _0x3a347d[_0xc431('0xa4')][0x0];}var _0x16f5b2=_[_0xc431('0xa6')](_0x1ce944[_0xc431('0x5f')],{'firstName':_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')],'ListId':_0x3a347d['id']});_0x16f5b2[_0x1ce944['body'][_0xc431('0xa2')]]=_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')];return db[_0xc431('0x8d')]['create'](_0x16f5b2,{'fields':_0x23b97b,'raw':!![]});}})['then'](handleEntityNotFound(_0x26ebaa,null))['then'](function(_0x2d78c5){if(_0x2d78c5){_0x1ce944[_0xc431('0xa7')]=_0x2d78c5;var _0x441db8={'ContactId':_0x2d78c5['id'],'phone':_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')],'WhatsappAccountId':_0x43dfb0[_0xc431('0x62')]['id']};var _0x1bb90a={'ContactId':_0x2d78c5['id'],'WhatsappAccountId':_0x43dfb0['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0xc431('0x58')]({'where':_0x1bb90a})[_0xc431('0x1e')](function(_0x53aa86){if(_0x53aa86){return[_0x53aa86,![]];}return db[_0xc431('0xa8')]['create'](_0x441db8)[_0xc431('0x1e')](function(_0x3902ee){return[_0x3902ee,!![]];});});}})[_0xc431('0x71')](function(_0x2e9e79,_0x3dd070){_0x1ce944[_0xc431('0xa9')]=_0x2e9e79[_0xc431('0x36')]({'plain':!![]});_0x1ce944['interaction']['created']=![];if(_0x3dd070){if(_0x1ce944[_0xc431('0x86')]['autoclose']){_0x1ce944[_0xc431('0x8c')][_0xc431('0xaa')]({'id':0x0,'priority':_0x1ce944[_0xc431('0x8c')][_0xc431('0x57')]+0x1,'app':_0xc431('0xab'),'appdata':_0xc431('0xac'),'interval':'*,*,*,*'});}_0x1ce944[_0xc431('0xa9')][_0xc431('0xad')]=!![];}return db[_0xc431('0x8a')][_0xc431('0x59')]({'phone':_0x1ce944[_0xc431('0x5f')][_0xc431('0x98')],'messageId':_0x1ce944['body'][_0xc431('0x9c')],'body':_0x1ce944['body'][_0xc431('0x5f')],'WhatsappAccountId':_0x43dfb0['params']['id'],'WhatsappInteractionId':_0x2e9e79['id'],'direction':'in','ContactId':_0x2e9e79[_0xc431('0xae')],'AttachmentId':_0x1ce944[_0xc431('0x5f')][_0xc431('0xaf')]});})[_0xc431('0x1e')](function(_0x2cafcc){_0x1ce944[_0xc431('0x26')]=_0x2cafcc;if(!_0x1ce944['interaction'][_0xc431('0xb0')])return;return db[_0xc431('0xb1')]['find']({'attributes':['id',_0xc431('0x39')],'where':{'id':_0x1ce944[_0xc431('0xa9')][_0xc431('0xb0')]}});})[_0xc431('0x1e')](function(_0x3a3c8d){if(_0x3a3c8d){_0x1ce944[_0xc431('0x8c')][_0xc431('0xb2')]({'id':0x0,'priority':0x0,'app':_0xc431('0xb3'),'appdata':_0x3a3c8d[_0xc431('0x39')]+','+(_0x1ce944[_0xc431('0x86')][_0xc431('0xb4')]||0xa),'interval':_0xc431('0xb5')});}if(!_0x1ce944[_0xc431('0xa9')][_0xc431('0xb6')])return;return db[_0xc431('0xb7')][_0xc431('0x58')]({'attributes':['id',_0xc431('0x39')],'where':{'id':_0x1ce944[_0xc431('0xa9')][_0xc431('0xb6')]}});})['then'](function(_0x15ee77){if(_0x15ee77){_0x1ce944[_0xc431('0x8c')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x15ee77[_0xc431('0x39')]+','+(_0x1ce944[_0xc431('0x86')][_0xc431('0xb8')]||0x12c),'interval':_0xc431('0xb5')});}return respondWithRpcPromise('Start','startRouting',_0x1ce944);})[_0xc431('0x1e')](function(_0x2e432e){if(_0x2e432e){var _0x451f83=0xc8;var _0x11ed00=_0xc431('0xb9');logger['info'](_0xc431('0x22'),_0x11ed00,_0x451f83,_0xc431('0xba'));logger['debug'](_0xc431('0xbb'),_0x11ed00,_0x451f83,_0xc431('0xba'),JSON['stringify'](_0x2e432e));if(_0x1ce944[_0xc431('0x86')][_0xc431('0x40')]===_0xc431('0x97')){return _0x26ebaa[_0xc431('0x2a')](_0x451f83)[_0xc431('0x30')](_0xc431('0xbc'),_0xc431('0xbd'))[_0xc431('0x3a')]('\x0a');}else{return _0x26ebaa[_0xc431('0x2a')](_0x451f83)[_0xc431('0x2b')](_0x2e432e);}}});})[_0xc431('0x54')](handleError(_0x26ebaa,null));};exports['send']=function(_0x16a212,_0x16322c,_0x48ca2f){var _0x3a55c8,_0x4ae610,_0x5c9a1c;if(_[_0xc431('0x9f')](_0x16a212['body']['body'])||_0x16a212[_0xc431('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xc431('0xa0'));}if(_[_0xc431('0x9f')](_0x16a212['body']['to'])){throw new db['Sequelize'][(_0xc431('0x8f'))](_0xc431('0xbe'));}_0x3a55c8=_0x16a212['body']['to'];return db[_0xc431('0x3e')]['find']({'where':{'id':_0x16a212[_0xc431('0x62')]['id']},'include':[{'model':db[_0xc431('0xa3')],'as':_0xc431('0xbf'),'include':[{'model':db['CmContact'],'as':_0xc431('0xa4'),'where':{'mobile':_0x3a55c8},'limit':0x1,'order':[['updatedAt',_0xc431('0xa5')]]}]}]})[_0xc431('0x1e')](handleEntityNotFound(_0x16322c,null))[_0xc431('0x1e')](function(_0x19c8a1){if(_0x19c8a1&&_0x19c8a1[_0xc431('0xbf')]){_0x4ae610=_0x19c8a1[_0xc431('0x36')]({'plain':!![]});if(_0x4ae610['List']&&_0x4ae610[_0xc431('0xbf')]['Contacts']['length']){return _0x4ae610[_0xc431('0xbf')][_0xc431('0xa4')][0x0];}return db[_0xc431('0x8d')][_0xc431('0x59')](_['defaults'](_0x16a212['body'],{'firstName':_0x3a55c8,'mobile':_0x3a55c8,'phone':_0x3a55c8,'ListId':_0x4ae610[_0xc431('0x95')]}));}})[_0xc431('0x1e')](handleEntityNotFound(_0x16322c,null))['then'](function(_0x360005){if(_0x360005){_0x5c9a1c=_0x360005;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x5c9a1c['id'],'closed':![],'WhatsappAccountId':_0x4ae610['id']}})[_0xc431('0x1e')](function(_0xf9a636){if(_0xf9a636){return[_0xf9a636,![]];}return db[_0xc431('0xa8')][_0xc431('0x59')]({'UserId':_0x16a212['user']['id'],'ContactId':_0x5c9a1c['id'],'WhatsappAccountId':_0x4ae610['id'],'phone':_0x3a55c8,'firstMsgDirection':_0xc431('0xc0'),'Messages':[_[_0xc431('0x4d')](_0x16a212[_0xc431('0x5f')],{'read':![],'body':_0x16a212['body']['body'],'phone':_0x3a55c8,'WhatsappAccountId':_0x4ae610['id'],'UserId':_0x16a212[_0xc431('0x5a')]['id'],'ContactId':_0x5c9a1c['id']})]},{'include':[{'model':db[_0xc431('0x8a')],'as':_0xc431('0xc1')}]})[_0xc431('0x1e')](function(_0x3deda7){return[_0x3deda7,!![]];});});}})[_0xc431('0x71')](function(_0x372229,_0x4a5a2d){if(_0x4a5a2d){return _0x372229;}return db[_0xc431('0x8a')][_0xc431('0x59')](_['merge'](_0x16a212[_0xc431('0x5f')],{'read':![],'body':_0x16a212[_0xc431('0x5f')]['body'],'phone':_0x3a55c8,'WhatsappAccountId':_0x4ae610['id'],'WhatsappInteractionId':_0x372229['id'],'UserId':_0x16a212[_0xc431('0x5a')]['id'],'ContactId':_0x5c9a1c['id']}))[_0xc431('0x1e')](function(_0x4c2975){_0x372229['dataValues']['Messages']=[];_0x372229['dataValues']['Messages'][_0xc431('0xaa')](_0x4c2975['dataValues']);return _0x372229;});})[_0xc431('0x1e')](respondWithResult(_0x16322c,null))['catch'](handleError(_0x16322c,null));}; \ No newline at end of file +var _0xabd3=['getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','sinch','statuses','state','WhatsappMessage','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','from\x20is\x20mandatory','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','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','user','out','dataValues','Messages','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','type','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','describe','Disposition','getDispositions','findOne','hasOwnProperty','WhatsappAccountId','removeDispositions','addAnswer'];(function(_0x5b68ba,_0x3cc447){var _0x5dd90f=function(_0x548b1c){while(--_0x548b1c){_0x5b68ba['push'](_0x5b68ba['shift']());}};_0x5dd90f(++_0x3cc447);}(_0xabd3,0x1f1));var _0x3abd=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xabd3[_0x288f5e];return _0x476cc9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3abd('0x0'));var jsonpatch=require(_0x3abd('0x1'));var rp=require('request-promise');var moment=require(_0x3abd('0x2'));var BPromise=require(_0x3abd('0x3'));var Mustache=require('mustache');var util=require(_0x3abd('0x4'));var path=require(_0x3abd('0x5'));var sox=require(_0x3abd('0x6'));var csv=require(_0x3abd('0x7'));var ejs=require(_0x3abd('0x8'));var fs=require('fs');var fs_extra=require(_0x3abd('0x9'));var _=require(_0x3abd('0xa'));var squel=require(_0x3abd('0xb'));var crypto=require(_0x3abd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3abd('0xd'));var toCsv=require(_0x3abd('0x7'));var querystring=require(_0x3abd('0xe'));var Papa=require(_0x3abd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3abd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3abd('0x11'))(_0x3abd('0x12'));var utils=require('../../config/utils');var config=require(_0x3abd('0x13'));var licenseUtil=require(_0x3abd('0x14'));var db=require(_0x3abd('0x15'))['db'];config[_0x3abd('0x16')]=_[_0x3abd('0x17')](config[_0x3abd('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3abd('0x18'))(new Redis(config[_0x3abd('0x16')]));require(_0x3abd('0x19'))[_0x3abd('0x1a')](socket);var jayson=require(_0x3abd('0x1b'));var client=jayson[_0x3abd('0x1c')][_0x3abd('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4f4064,_0x444e63,_0x536cf4,_0x3844fa){return new BPromise(function(_0x567f8f,_0x487e91){var _0x554b10=_0x3844fa||client;return _0x554b10[_0x3abd('0x1e')](_0x4f4064,_0x536cf4)['then'](function(_0x1769de){logger[_0x3abd('0x1f')](_0x3abd('0x20'),_0x444e63,_0x3abd('0x21'));logger[_0x3abd('0x22')](_0x3abd('0x23'),_0x444e63,_0x3abd('0x21'),JSON[_0x3abd('0x24')](_0x1769de));if(_0x1769de[_0x3abd('0x25')]){if(_0x1769de['error'][_0x3abd('0x26')]===0x1f4){logger[_0x3abd('0x25')](_0x3abd('0x20'),_0x444e63,_0x1769de[_0x3abd('0x25')][_0x3abd('0x27')]);return _0x487e91(_0x1769de['error']['message']);}logger[_0x3abd('0x25')](_0x3abd('0x20'),_0x444e63,_0x1769de['error'][_0x3abd('0x27')]);return _0x567f8f(_0x1769de[_0x3abd('0x25')][_0x3abd('0x27')]);}else{logger['info'](_0x3abd('0x20'),_0x444e63,_0x3abd('0x21'));_0x567f8f(_0x1769de[_0x3abd('0x28')][_0x3abd('0x27')]);}})['catch'](function(_0x4d23dc){logger['error'](_0x3abd('0x20'),_0x444e63,_0x4d23dc);_0x487e91(_0x4d23dc);});});}function respondWithStatusCode(_0x279084,_0x820950){_0x820950=_0x820950||0xcc;return function(_0x5aa520){if(_0x5aa520){return _0x279084[_0x3abd('0x29')](_0x820950);}return _0x279084['status'](_0x820950)[_0x3abd('0x2a')]();};}function respondWithResult(_0x4957d7,_0x558951){_0x558951=_0x558951||0xc8;return function(_0x10d521){if(_0x10d521){return _0x4957d7[_0x3abd('0x2b')](_0x558951)[_0x3abd('0x2c')](_0x10d521);}};}function respondWithFilteredResult(_0xbbd204,_0x5321b2){return function(_0x452811){if(_0x452811){var _0x18fe76=typeof _0x5321b2['offset']===_0x3abd('0x2d')&&typeof _0x5321b2[_0x3abd('0x2e')]===_0x3abd('0x2d');var _0x17e710=_0x452811[_0x3abd('0x2f')];var _0x5a8a91=_0x18fe76?0x0:_0x5321b2['offset'];var _0x4e1490=_0x18fe76?_0x452811[_0x3abd('0x2f')]:_0x5321b2[_0x3abd('0x30')]+_0x5321b2[_0x3abd('0x2e')];var _0x73754e;if(_0x4e1490>=_0x17e710){_0x4e1490=_0x17e710;_0x73754e=0xc8;}else{_0x73754e=0xce;}_0xbbd204['status'](_0x73754e);return _0xbbd204['set']('Content-Range',_0x5a8a91+'-'+_0x4e1490+'/'+_0x17e710)[_0x3abd('0x2c')](_0x452811);}return null;};}function patchUpdates(_0x357d95){return function(_0x5ea464){try{jsonpatch[_0x3abd('0x31')](_0x5ea464,_0x357d95,!![]);}catch(_0xbc7458){return BPromise[_0x3abd('0x32')](_0xbc7458);}return _0x5ea464[_0x3abd('0x33')]();};}function saveUpdates(_0x340b8d,_0x24ea97){return function(_0x2850de){if(_0x2850de){return _0x2850de[_0x3abd('0x34')](_0x340b8d)[_0x3abd('0x35')](function(_0x1e8409){return _0x1e8409;});}return null;};}function removeEntity(_0x531bdd,_0x4de600){return function(_0x480ea7){if(_0x480ea7){return _0x480ea7['destroy']()[_0x3abd('0x35')](function(){var _0x55101a=_0x480ea7[_0x3abd('0x36')]({'plain':!![]});var _0x36c04f='WhatsappAccounts';return db[_0x3abd('0x37')]['destroy']({'where':{'type':_0x36c04f,'resourceId':_0x55101a['id']}})['then'](function(){return _0x480ea7;});})['then'](function(){_0x531bdd[_0x3abd('0x2b')](0xcc)[_0x3abd('0x2a')]();});}};}function handleEntityNotFound(_0x3b5997,_0x33f7a9){return function(_0x20f23c){if(!_0x20f23c){_0x3b5997[_0x3abd('0x29')](0x194);}return _0x20f23c;};}function handleError(_0x5ca241,_0x5368d7){_0x5368d7=_0x5368d7||0x1f4;return function(_0x3515f7){logger[_0x3abd('0x25')](_0x3515f7[_0x3abd('0x38')]);if(_0x3515f7['name']){delete _0x3515f7[_0x3abd('0x39')];}_0x5ca241[_0x3abd('0x2b')](_0x5368d7)[_0x3abd('0x3a')](_0x3515f7);};}exports[_0x3abd('0x3b')]=function(_0xbafceb,_0x1d65f1){var _0x1e72aa={'include':[{'model':db[_0x3abd('0x3c')],'as':_0x3abd('0x3d')}]},_0x30d944={},_0x4c5827={'count':0x0,'rows':[]};var _0x496b50=_[_0x3abd('0x3e')](db[_0x3abd('0x3f')]['rawAttributes'],function(_0x557aa4){return{'name':_0x557aa4['fieldName'],'type':_0x557aa4[_0x3abd('0x40')]['key']};});_0x30d944[_0x3abd('0x41')]=_[_0x3abd('0x3e')](_0x496b50,_0x3abd('0x39'));_0x30d944[_0x3abd('0x42')]=_[_0x3abd('0x43')](_0xbafceb[_0x3abd('0x42')]);_0x30d944['filters']=_[_0x3abd('0x44')](_0x30d944['model'],_0x30d944[_0x3abd('0x42')]);_0x1e72aa[_0x3abd('0x45')]=_['intersection'](_0x30d944['model'],qs[_0x3abd('0x46')](_0xbafceb[_0x3abd('0x42')]['fields']));_0x1e72aa[_0x3abd('0x45')]=_0x1e72aa[_0x3abd('0x45')]['length']?_0x1e72aa[_0x3abd('0x45')]:_0x30d944[_0x3abd('0x41')];if(!_0xbafceb[_0x3abd('0x42')]['hasOwnProperty'](_0x3abd('0x47'))){_0x1e72aa[_0x3abd('0x2e')]=qs[_0x3abd('0x2e')](_0xbafceb['query']['limit']);_0x1e72aa[_0x3abd('0x30')]=qs[_0x3abd('0x30')](_0xbafceb['query'][_0x3abd('0x30')]);}_0x1e72aa[_0x3abd('0x48')]=qs[_0x3abd('0x49')](_0xbafceb[_0x3abd('0x42')]['sort']);_0x1e72aa[_0x3abd('0x4a')]=qs['filters'](_[_0x3abd('0x4b')](_0xbafceb[_0x3abd('0x42')],_0x30d944[_0x3abd('0x4c')]),_0x496b50);if(_0xbafceb[_0x3abd('0x42')][_0x3abd('0x4d')]){_0x1e72aa[_0x3abd('0x4a')]=_[_0x3abd('0x4e')](_0x1e72aa[_0x3abd('0x4a')],{'$or':_[_0x3abd('0x3e')](_0x496b50,function(_0x2f92df){if(_0x2f92df['type']!=='VIRTUAL'){var _0x3fadbb={};_0x3fadbb[_0x2f92df[_0x3abd('0x39')]]={'$like':'%'+_0xbafceb[_0x3abd('0x42')][_0x3abd('0x4d')]+'%'};return _0x3fadbb;}})});}_0x1e72aa=_[_0x3abd('0x4e')]({},_0x1e72aa,_0xbafceb[_0x3abd('0x4f')]);var _0x1e50bd={'where':_0x1e72aa['where']};return db[_0x3abd('0x3f')]['count'](_0x1e50bd)[_0x3abd('0x35')](function(_0x2b186f){_0x4c5827[_0x3abd('0x2f')]=_0x2b186f;if(_0xbafceb[_0x3abd('0x42')][_0x3abd('0x50')]){_0x1e72aa[_0x3abd('0x51')]=[{'all':!![]}];}return db[_0x3abd('0x3f')][_0x3abd('0x52')](_0x1e72aa);})[_0x3abd('0x35')](function(_0x13b975){_0x4c5827[_0x3abd('0x53')]=_0x13b975;return _0x4c5827;})['then'](respondWithFilteredResult(_0x1d65f1,_0x1e72aa))['catch'](handleError(_0x1d65f1,null));};exports[_0x3abd('0x54')]=function(_0x1ce7ef,_0x5c231f){var _0x293180={'raw':![],'where':{'id':_0x1ce7ef['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2b1700={};_0x2b1700['model']=_[_0x3abd('0x43')](db[_0x3abd('0x3f')][_0x3abd('0x55')]);_0x2b1700[_0x3abd('0x42')]=_[_0x3abd('0x43')](_0x1ce7ef[_0x3abd('0x42')]);_0x2b1700['filters']=_[_0x3abd('0x44')](_0x2b1700['model'],_0x2b1700[_0x3abd('0x42')]);_0x293180[_0x3abd('0x45')]=_[_0x3abd('0x44')](_0x2b1700[_0x3abd('0x41')],qs['fields'](_0x1ce7ef[_0x3abd('0x42')]['fields']));_0x293180[_0x3abd('0x45')]=_0x293180[_0x3abd('0x45')][_0x3abd('0x56')]?_0x293180[_0x3abd('0x45')]:_0x2b1700['model'];if(_0x1ce7ef[_0x3abd('0x42')][_0x3abd('0x50')]){_0x293180[_0x3abd('0x51')]=[{'all':!![]}];}_0x293180=_['merge']({},_0x293180,_0x1ce7ef[_0x3abd('0x4f')]);return db['WhatsappAccount'][_0x3abd('0x57')](_0x293180)[_0x3abd('0x35')](handleEntityNotFound(_0x5c231f,null))[_0x3abd('0x35')](respondWithResult(_0x5c231f,null))[_0x3abd('0x58')](handleError(_0x5c231f,null));};exports[_0x3abd('0x59')]=function(_0x2689ef,_0x25e57c){return db[_0x3abd('0x3f')][_0x3abd('0x59')](_0x2689ef['body'],{})[_0x3abd('0x35')](function(_0x3b1b13){var _0x194ddc=_0x2689ef['user'][_0x3abd('0x36')]({'plain':!![]});if(!_0x194ddc)throw new Error(_0x3abd('0x5a'));if(_0x194ddc['role']==='user'){var _0x45c44e=_0x3b1b13[_0x3abd('0x36')]({'plain':!![]});var _0x15e1e9=_0x3abd('0x5b');return db[_0x3abd('0x5c')][_0x3abd('0x57')]({'where':{'name':_0x15e1e9,'userProfileId':_0x194ddc['userProfileId']},'raw':!![]})[_0x3abd('0x35')](function(_0x92007d){if(_0x92007d&&_0x92007d[_0x3abd('0x5d')]===0x0){return db[_0x3abd('0x37')][_0x3abd('0x59')]({'name':_0x45c44e['name'],'resourceId':_0x45c44e['id'],'type':_0x92007d[_0x3abd('0x39')],'sectionId':_0x92007d['id']},{})['then'](function(){return _0x3b1b13;});}else{return _0x3b1b13;}})[_0x3abd('0x58')](function(_0x356cec){logger[_0x3abd('0x25')](_0x3abd('0x5e'),_0x356cec);throw _0x356cec;});}return _0x3b1b13;})[_0x3abd('0x35')](respondWithResult(_0x25e57c,0xc9))[_0x3abd('0x58')](handleError(_0x25e57c,null));};exports[_0x3abd('0x34')]=function(_0x4d58a7,_0x335663){if(_0x4d58a7['body']['id']){delete _0x4d58a7[_0x3abd('0x5f')]['id'];}return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0x4d58a7['params']['id']},'include':[{'model':db[_0x3abd('0x3c')],'as':_0x3abd('0x3d')}]})['then'](handleEntityNotFound(_0x335663,null))['then'](saveUpdates(_0x4d58a7['body'],null))['then'](respondWithResult(_0x335663,null))[_0x3abd('0x58')](handleError(_0x335663,null));};exports[_0x3abd('0x60')]=function(_0xe05184,_0x3c2095){return db[_0x3abd('0x3f')]['find']({'where':{'id':_0xe05184[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x3c2095,null))[_0x3abd('0x35')](removeEntity(_0x3c2095,null))[_0x3abd('0x58')](handleError(_0x3c2095,null));};exports['describe']=function(_0x4f25ca,_0x9d963d){return db[_0x3abd('0x3f')][_0x3abd('0x62')]()[_0x3abd('0x35')](respondWithResult(_0x9d963d,null))[_0x3abd('0x58')](handleError(_0x9d963d,null));};exports['addDisposition']=function(_0x329c03,_0xef2ac3,_0x208e59){if(_0x329c03['body']['id']){delete _0x329c03[_0x3abd('0x5f')]['id'];}return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0x329c03[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0xef2ac3,null))[_0x3abd('0x35')](function(_0x282f52){if(_0x282f52){_0x329c03[_0x3abd('0x5f')]['WhatsappAccountId']=_0x282f52['id'];return db[_0x3abd('0x63')][_0x3abd('0x59')](_0x329c03['body']);}})[_0x3abd('0x35')](respondWithResult(_0xef2ac3,null))[_0x3abd('0x58')](handleError(_0xef2ac3,null));};exports[_0x3abd('0x64')]=function(_0x4200d7,_0x317974,_0x2e0805){var _0x426e87={'raw':![],'where':{}};var _0x524d76={};var _0x7238d1={'count':0x0,'rows':[]};return db[_0x3abd('0x3f')][_0x3abd('0x65')]({'where':{'id':_0x4200d7['params']['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x317974,null))[_0x3abd('0x35')](function(_0x120a08){if(_0x120a08){_0x524d76[_0x3abd('0x41')]=_['keys'](db[_0x3abd('0x63')][_0x3abd('0x55')]);_0x524d76[_0x3abd('0x42')]=_['keys'](_0x4200d7[_0x3abd('0x42')]);_0x524d76[_0x3abd('0x4c')]=_[_0x3abd('0x44')](_0x524d76['model'],_0x524d76['query']);_0x426e87[_0x3abd('0x45')]=_[_0x3abd('0x44')](_0x524d76[_0x3abd('0x41')],qs[_0x3abd('0x46')](_0x4200d7['query'][_0x3abd('0x46')]));_0x426e87['attributes']=_0x426e87[_0x3abd('0x45')][_0x3abd('0x56')]?_0x426e87[_0x3abd('0x45')]:_0x524d76[_0x3abd('0x41')];if(!_0x4200d7[_0x3abd('0x42')][_0x3abd('0x66')](_0x3abd('0x47'))){_0x426e87[_0x3abd('0x2e')]=qs[_0x3abd('0x2e')](_0x4200d7[_0x3abd('0x42')]['limit']);_0x426e87[_0x3abd('0x30')]=qs[_0x3abd('0x30')](_0x4200d7[_0x3abd('0x42')]['offset']);}_0x426e87[_0x3abd('0x48')]=qs[_0x3abd('0x49')](_0x4200d7[_0x3abd('0x42')][_0x3abd('0x49')]);_0x426e87['where']=qs[_0x3abd('0x4c')](_[_0x3abd('0x4b')](_0x4200d7[_0x3abd('0x42')],_0x524d76[_0x3abd('0x4c')]));_0x426e87['where'][_0x3abd('0x67')]=_0x120a08['id'];if(_0x4200d7['query']['filter']){_0x426e87['where']=_['merge'](_0x426e87['where'],{'$or':_[_0x3abd('0x3e')](_0x426e87[_0x3abd('0x45')],function(_0x3d8b19){var _0x1d2c0c={};_0x1d2c0c[_0x3d8b19]={'$like':'%'+_0x4200d7[_0x3abd('0x42')][_0x3abd('0x4d')]+'%'};return _0x1d2c0c;})});}_0x426e87=_[_0x3abd('0x4e')]({},_0x426e87,_0x4200d7[_0x3abd('0x4f')]);return db[_0x3abd('0x63')][_0x3abd('0x2f')]({'where':_0x426e87[_0x3abd('0x4a')]})[_0x3abd('0x35')](function(_0x1b82ba){_0x7238d1[_0x3abd('0x2f')]=_0x1b82ba;if(_0x4200d7['query']['includeAll']){_0x426e87[_0x3abd('0x51')]=[{'all':!![]}];}return db[_0x3abd('0x63')]['findAll'](_0x426e87);})['then'](function(_0x28580f){_0x7238d1['rows']=_0x28580f;return _0x7238d1;});}})['then'](respondWithFilteredResult(_0x317974,_0x426e87))['catch'](handleError(_0x317974,null));};exports[_0x3abd('0x68')]=function(_0x510680,_0x5e3948,_0x5d198f){return db['WhatsappAccount'][_0x3abd('0x57')]({'where':{'id':_0x510680[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x5e3948,null))[_0x3abd('0x35')](function(_0x1272b0){if(_0x1272b0){return _0x1272b0[_0x3abd('0x68')](_0x510680[_0x3abd('0x42')]['ids']);}})[_0x3abd('0x35')](respondWithStatusCode(_0x5e3948,null))['catch'](handleError(_0x5e3948,null));};exports[_0x3abd('0x69')]=function(_0xbf5d6c,_0x114430,_0x877535){if(_0xbf5d6c['body']['id']){delete _0xbf5d6c[_0x3abd('0x5f')]['id'];}return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0xbf5d6c[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x114430,null))['then'](function(_0x3af7f4){if(_0x3af7f4){_0xbf5d6c[_0x3abd('0x5f')]['WhatsappAccountId']=_0x3af7f4['id'];return db['CannedAnswer'][_0x3abd('0x59')](_0xbf5d6c[_0x3abd('0x5f')]);}})[_0x3abd('0x35')](respondWithResult(_0x114430,null))[_0x3abd('0x58')](handleError(_0x114430,null));};exports[_0x3abd('0x6a')]=function(_0x180497,_0x151d45,_0x4da4d3){var _0x1c5380={'raw':![],'where':{}};var _0x47c58f={};var _0x29471d={'count':0x0,'rows':[]};return db[_0x3abd('0x3f')][_0x3abd('0x65')]({'where':{'id':_0x180497[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x151d45,null))[_0x3abd('0x35')](function(_0x43c79b){if(_0x43c79b){_0x47c58f[_0x3abd('0x41')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x47c58f[_0x3abd('0x42')]=_['keys'](_0x180497[_0x3abd('0x42')]);_0x47c58f[_0x3abd('0x4c')]=_['intersection'](_0x47c58f[_0x3abd('0x41')],_0x47c58f[_0x3abd('0x42')]);_0x1c5380[_0x3abd('0x45')]=_[_0x3abd('0x44')](_0x47c58f[_0x3abd('0x41')],qs[_0x3abd('0x46')](_0x180497['query'][_0x3abd('0x46')]));_0x1c5380[_0x3abd('0x45')]=_0x1c5380['attributes'][_0x3abd('0x56')]?_0x1c5380[_0x3abd('0x45')]:_0x47c58f[_0x3abd('0x41')];if(!_0x180497['query'][_0x3abd('0x66')](_0x3abd('0x47'))){_0x1c5380[_0x3abd('0x2e')]=qs['limit'](_0x180497[_0x3abd('0x42')]['limit']);_0x1c5380['offset']=qs['offset'](_0x180497[_0x3abd('0x42')][_0x3abd('0x30')]);}_0x1c5380[_0x3abd('0x48')]=qs[_0x3abd('0x49')](_0x180497[_0x3abd('0x42')]['sort']);_0x1c5380['where']=qs['filters'](_[_0x3abd('0x4b')](_0x180497[_0x3abd('0x42')],_0x47c58f[_0x3abd('0x4c')]));_0x1c5380[_0x3abd('0x4a')][_0x3abd('0x67')]=_0x43c79b['id'];if(_0x180497['query'][_0x3abd('0x4d')]){_0x1c5380[_0x3abd('0x4a')]=_[_0x3abd('0x4e')](_0x1c5380[_0x3abd('0x4a')],{'$or':_[_0x3abd('0x3e')](_0x1c5380[_0x3abd('0x45')],function(_0x3d35c4){var _0x4c2149={};_0x4c2149[_0x3d35c4]={'$like':'%'+_0x180497[_0x3abd('0x42')]['filter']+'%'};return _0x4c2149;})});}_0x1c5380=_['merge']({},_0x1c5380,_0x180497[_0x3abd('0x4f')]);return db[_0x3abd('0x6b')][_0x3abd('0x2f')]({'where':_0x1c5380['where']})[_0x3abd('0x35')](function(_0x44bb90){_0x29471d['count']=_0x44bb90;if(_0x180497[_0x3abd('0x42')]['includeAll']){_0x1c5380[_0x3abd('0x51')]=[{'all':!![]}];}return db[_0x3abd('0x6b')][_0x3abd('0x52')](_0x1c5380);})[_0x3abd('0x35')](function(_0x4e1128){_0x29471d[_0x3abd('0x53')]=_0x4e1128;return _0x29471d;});}})[_0x3abd('0x35')](respondWithFilteredResult(_0x151d45,_0x1c5380))[_0x3abd('0x58')](handleError(_0x151d45,null));};exports['removeAnswers']=function(_0x40a806,_0x1b367f,_0x43a020){return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0x40a806[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x1b367f,null))[_0x3abd('0x35')](function(_0x42b003){if(_0x42b003){return _0x42b003[_0x3abd('0x6c')](_0x40a806[_0x3abd('0x42')][_0x3abd('0x6d')]);}})[_0x3abd('0x35')](respondWithStatusCode(_0x1b367f,null))[_0x3abd('0x58')](handleError(_0x1b367f,null));};exports[_0x3abd('0x6e')]=function(_0x32f2b7,_0x23c218,_0x18fc03){return db['WhatsappAccount'][_0x3abd('0x57')]({'where':{'id':_0x32f2b7[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x23c218,null))['then'](function(_0x2ff639){if(_0x2ff639){return _0x2ff639[_0x3abd('0x6e')](_0x32f2b7[_0x3abd('0x5f')][_0x3abd('0x6d')],_[_0x3abd('0x6f')](_0x32f2b7[_0x3abd('0x5f')],[_0x3abd('0x6d'),'id'])||{})[_0x3abd('0x70')](function(_0x5d93ac){for(var _0x5dde87=0x0;_0x5dde87<_0x32f2b7['body']['ids'][_0x3abd('0x56')];_0x5dde87+=0x1){socket[_0x3abd('0x71')](_0x3abd('0x72'),{'UserId':Number(_0x32f2b7[_0x3abd('0x5f')][_0x3abd('0x6d')][_0x5dde87]),'WhatsappAccountId':Number(_0x32f2b7[_0x3abd('0x61')]['id'])});}return _0x5d93ac;});}})[_0x3abd('0x35')](respondWithResult(_0x23c218,null))['catch'](handleError(_0x23c218,null));};exports[_0x3abd('0x73')]=function(_0x1870d4,_0xac5db8,_0x9716f5){return db['WhatsappAccount'][_0x3abd('0x57')]({'where':{'id':_0x1870d4[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0xac5db8,null))[_0x3abd('0x35')](function(_0x1fe102){if(_0x1fe102){return _0x1fe102[_0x3abd('0x73')](_0x1870d4[_0x3abd('0x42')][_0x3abd('0x6d')])['then'](function(){if(_[_0x3abd('0x74')](_0x1870d4['query'][_0x3abd('0x6d')])){for(var _0x43b666=0x0;_0x43b666<_0x1870d4['query'][_0x3abd('0x6d')]['length'];_0x43b666+=0x1){socket['emit'](_0x3abd('0x75'),{'UserId':Number(_0x1870d4['query']['ids'][_0x43b666]),'WhatsappAccountId':Number(_0x1870d4[_0x3abd('0x61')]['id'])});}}else{socket[_0x3abd('0x71')](_0x3abd('0x75'),{'UserId':Number(_0x1870d4['query'][_0x3abd('0x6d')]),'WhatsappAccountId':Number(_0x1870d4[_0x3abd('0x61')]['id'])});}});}})[_0x3abd('0x35')](respondWithStatusCode(_0xac5db8,null))[_0x3abd('0x58')](handleError(_0xac5db8,null));};exports[_0x3abd('0x76')]=function(_0x523b33,_0x10940a,_0x5d6157){var _0x25d5a6={};var _0x3fbd48={};var _0x3f4050;var _0x490b71;return db[_0x3abd('0x3f')][_0x3abd('0x65')]({'where':{'id':_0x523b33['params']['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x10940a,null))['then'](function(_0x5c282a){if(_0x5c282a){_0x3f4050=_0x5c282a;_0x3fbd48[_0x3abd('0x41')]=_['keys'](db[_0x3abd('0x77')]['rawAttributes']);_0x3fbd48[_0x3abd('0x42')]=_[_0x3abd('0x43')](_0x523b33[_0x3abd('0x42')]);_0x3fbd48['filters']=_[_0x3abd('0x44')](_0x3fbd48['model'],_0x3fbd48['query']);_0x25d5a6[_0x3abd('0x45')]=_['intersection'](_0x3fbd48[_0x3abd('0x41')],qs[_0x3abd('0x46')](_0x523b33[_0x3abd('0x42')][_0x3abd('0x46')]));_0x25d5a6[_0x3abd('0x45')]=_0x25d5a6[_0x3abd('0x45')][_0x3abd('0x56')]?_0x25d5a6['attributes']:_0x3fbd48[_0x3abd('0x41')];_0x25d5a6[_0x3abd('0x48')]=qs['sort'](_0x523b33[_0x3abd('0x42')]['sort']);_0x25d5a6[_0x3abd('0x4a')]=qs[_0x3abd('0x4c')](_[_0x3abd('0x4b')](_0x523b33[_0x3abd('0x42')],_0x3fbd48[_0x3abd('0x4c')]));if(_0x523b33['query']['filter']){_0x25d5a6[_0x3abd('0x4a')]=_[_0x3abd('0x4e')](_0x25d5a6[_0x3abd('0x4a')],{'$or':_[_0x3abd('0x3e')](_0x25d5a6[_0x3abd('0x45')],function(_0x3f593b){var _0x4ed030={};_0x4ed030[_0x3f593b]={'$like':'%'+_0x523b33[_0x3abd('0x42')][_0x3abd('0x4d')]+'%'};return _0x4ed030;})});}_0x25d5a6=_[_0x3abd('0x4e')]({},_0x25d5a6,_0x523b33['options']);return _0x3f4050[_0x3abd('0x76')](_0x25d5a6);}})[_0x3abd('0x35')](function(_0x3e33cc){if(_0x3e33cc){_0x490b71=_0x3e33cc[_0x3abd('0x56')];if(!_0x523b33[_0x3abd('0x42')][_0x3abd('0x66')](_0x3abd('0x47'))){_0x25d5a6[_0x3abd('0x2e')]=qs[_0x3abd('0x2e')](_0x523b33[_0x3abd('0x42')][_0x3abd('0x2e')]);_0x25d5a6[_0x3abd('0x30')]=qs[_0x3abd('0x30')](_0x523b33[_0x3abd('0x42')][_0x3abd('0x30')]);}return _0x3f4050[_0x3abd('0x76')](_0x25d5a6);}})[_0x3abd('0x35')](function(_0x2c8d7a){if(_0x2c8d7a){return _0x2c8d7a?{'count':_0x490b71,'rows':_0x2c8d7a}:null;}})[_0x3abd('0x35')](respondWithResult(_0x10940a,null))[_0x3abd('0x58')](handleError(_0x10940a,null));};exports[_0x3abd('0x78')]=function(_0x9fe0a2,_0x3131fd){var _0x166bde=_0x9fe0a2[_0x3abd('0x61')]['id'];var _0x199f2c=_0x9fe0a2[_0x3abd('0x5f')];var _0x4e9745=0xc8;var _0x277d48=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3abd('0x79')]['Transaction'][_0x3abd('0x7a')][_0x3abd('0x7b')]},function(_0xb23f83){return db['WhatsappAccount']['findOne']({'where':{'id':_0x166bde},'transaction':_0xb23f83})[_0x3abd('0x35')](function(_0x8f89a2){if(_0x8f89a2){return db[_0x3abd('0x7c')][_0x3abd('0x60')]({'where':{'WhatsappAccountId':_0x166bde},'transaction':_0xb23f83})['then'](function(){var _0x192929=_[_0x3abd('0x3e')](_0x199f2c,function(_0x3e65ab){_0x3e65ab['WhatsappAccountId']=_0x166bde;return _0x3e65ab;});return db[_0x3abd('0x7c')][_0x3abd('0x7d')](_0x192929,{'transaction':_0xb23f83});});}else{_0x4e9745=0x194;_0x277d48=[];}});})['then'](function(){if(_0x4e9745!==0x194){return db[_0x3abd('0x7c')][_0x3abd('0x7e')]({'where':{'WhatsappAccountId':_0x166bde},'order':_0x3abd('0x7f')})[_0x3abd('0x35')](function(_0x58a535){_0x277d48=_0x58a535;});}})[_0x3abd('0x58')](function(_0xd61a57){_0x4e9745=0x1f4;logger[_0x3abd('0x25')](_0xd61a57[_0x3abd('0x38')]);if(_0xd61a57[_0x3abd('0x39')]){delete _0xd61a57[_0x3abd('0x39')];}_0x277d48=_0xd61a57;})['finally'](function(){if(_0x277d48===null){_0x3131fd['sendStatus'](_0x4e9745);}else{if(_0x4e9745===0x1f4){_0x3131fd[_0x3abd('0x2b')](_0x4e9745)[_0x3abd('0x3a')](_0x277d48);}else{_0x3131fd['status'](_0x4e9745)[_0x3abd('0x2c')](_0x277d48);}}});};exports[_0x3abd('0x80')]=function(_0x74ce7,_0x4225d1,_0x981c13){var _0x2ba9cc={};var _0x13dc02={};var _0x4aae61;var _0x574736;return db['WhatsappAccount'][_0x3abd('0x65')]({'where':{'id':_0x74ce7[_0x3abd('0x61')]['id']}})[_0x3abd('0x35')](handleEntityNotFound(_0x4225d1,null))[_0x3abd('0x35')](function(_0x5e064a){if(_0x5e064a){_0x4aae61=_0x5e064a;_0x13dc02['model']=_[_0x3abd('0x43')](db[_0x3abd('0x7c')][_0x3abd('0x55')]);_0x13dc02['query']=_[_0x3abd('0x43')](_0x74ce7[_0x3abd('0x42')]);_0x13dc02[_0x3abd('0x4c')]=_[_0x3abd('0x44')](_0x13dc02['model'],_0x13dc02[_0x3abd('0x42')]);_0x2ba9cc[_0x3abd('0x45')]=_[_0x3abd('0x44')](_0x13dc02[_0x3abd('0x41')],qs['fields'](_0x74ce7[_0x3abd('0x42')][_0x3abd('0x46')]));_0x2ba9cc['attributes']=_0x2ba9cc[_0x3abd('0x45')][_0x3abd('0x56')]?_0x2ba9cc[_0x3abd('0x45')]:_0x13dc02['model'];_0x2ba9cc[_0x3abd('0x48')]=qs['sort'](_0x74ce7[_0x3abd('0x42')][_0x3abd('0x49')]);_0x2ba9cc[_0x3abd('0x4a')]=qs['filters'](_['pick'](_0x74ce7[_0x3abd('0x42')],_0x13dc02[_0x3abd('0x4c')]));if(_0x74ce7['query'][_0x3abd('0x4d')]){_0x2ba9cc[_0x3abd('0x4a')]=_[_0x3abd('0x4e')](_0x2ba9cc[_0x3abd('0x4a')],{'$or':_[_0x3abd('0x3e')](_0x2ba9cc[_0x3abd('0x45')],function(_0x45f385){var _0x165532={};_0x165532[_0x45f385]={'$like':'%'+_0x74ce7[_0x3abd('0x42')][_0x3abd('0x4d')]+'%'};return _0x165532;})});}_0x2ba9cc=_[_0x3abd('0x4e')]({},_0x2ba9cc,_0x74ce7[_0x3abd('0x4f')]);return _0x4aae61[_0x3abd('0x80')](_0x2ba9cc);}})[_0x3abd('0x35')](function(_0x2280bf){if(_0x2280bf){_0x574736=_0x2280bf[_0x3abd('0x56')];if(!_0x74ce7[_0x3abd('0x42')][_0x3abd('0x66')](_0x3abd('0x47'))){_0x2ba9cc[_0x3abd('0x2e')]=qs['limit'](_0x74ce7[_0x3abd('0x42')][_0x3abd('0x2e')]);_0x2ba9cc[_0x3abd('0x30')]=qs[_0x3abd('0x30')](_0x74ce7['query'][_0x3abd('0x30')]);}return _0x4aae61[_0x3abd('0x80')](_0x2ba9cc);}})[_0x3abd('0x35')](function(_0xf2810e){if(_0xf2810e){return _0xf2810e?{'count':_0x574736,'rows':_0xf2810e}:null;}})[_0x3abd('0x35')](respondWithResult(_0x4225d1,null))[_0x3abd('0x58')](handleError(_0x4225d1,null));};exports[_0x3abd('0x81')]=function(_0x111c36,_0x35dce0,_0x6e4629){var _0x3a5efd={'channel':_0x3abd('0x82')};var _0x27748e=[];var _0x69b8a4=[];var _0x47e16f={};return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0x111c36[_0x3abd('0x61')]['id']},'include':[{'model':db[_0x3abd('0x7c')],'as':'Applications'}]})[_0x3abd('0x35')](handleEntityNotFound(_0x35dce0,null))['then'](function(_0x2080d5){_0x3a5efd[_0x3abd('0x83')]=_0x2080d5;if(_0x3a5efd[_0x3abd('0x83')]&&_0x3a5efd[_0x3abd('0x83')][_0x3abd('0x40')]===_0x3abd('0x84')&&_0x111c36[_0x3abd('0x5f')][_0x3abd('0x85')]){if(_0x111c36[_0x3abd('0x5f')]['statuses'][_0x3abd('0x56')]===0x0)return;if(_0x111c36[_0x3abd('0x5f')]['statuses'][0x0][_0x3abd('0x86')]!=='read')return;return db[_0x3abd('0x87')][_0x3abd('0x34')]({'read':!![],'readAt':_0x111c36[_0x3abd('0x5f')][_0x3abd('0x85')][0x0]['timestamp']},{'where':{'messageId':_0x111c36['body'][_0x3abd('0x85')][0x0][_0x3abd('0x88')]},'individualHooks':!![]})['then'](function(_0x4550eb){return _0x35dce0[_0x3abd('0x2b')](0xc8)[_0x3abd('0x2c')](_0x4550eb);});}_0x3a5efd[_0x3abd('0x89')]=_[_0x3abd('0x8a')](_0x2080d5[_0x3abd('0x8b')],[_0x3abd('0x7f')],[_0x3abd('0x8c')]);if(_0x3a5efd[_0x3abd('0x83')][_0x3abd('0x8b')]){delete _0x3a5efd[_0x3abd('0x83')][_0x3abd('0x8b')];}return db[_0x3abd('0x8d')][_0x3abd('0x62')]()['then'](function(_0x5be202){if(!_0x5be202){throw new db[(_0x3abd('0x8e'))][(_0x3abd('0x8f'))](_0x3abd('0x90'));}_0x27748e=_[_0x3abd('0x91')](_[_0x3abd('0x43')](_0x5be202),[_0x3abd('0x92'),_0x3abd('0x93')]);_0x69b8a4=_[_0x3abd('0x91')](_[_0x3abd('0x43')](_0x5be202),[_0x3abd('0x92'),_0x3abd('0x93'),'CompanyId',_0x3abd('0x94')]);_0x3a5efd[_0x3abd('0x5f')]={'mapKey':_0x3abd('0x95')};if(_0x3a5efd[_0x3abd('0x83')]&&_0x3a5efd[_0x3abd('0x83')][_0x3abd('0x40')]===_0x3abd('0x96')){_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')]=_0x111c36[_0x3abd('0x5f')][_0x3abd('0x98')][_0x3abd('0x99')](_0x3abd('0x9a'),'');_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x5f')]=_0x111c36[_0x3abd('0x5f')][_0x3abd('0x9b')];_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x9c')]=_0x111c36[_0x3abd('0x5f')][_0x3abd('0x9d')];}if(_0x3a5efd['account']&&_0x3a5efd[_0x3abd('0x83')]['type']==='sinch'){_0x3a5efd[_0x3abd('0x5f')]['from']=_0x111c36['body'][_0x3abd('0x9e')][0x0][_0x3abd('0x97')];_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x5f')]=_0x111c36[_0x3abd('0x5f')][_0x3abd('0x9e')][0x0][_0x3abd('0x27')][_0x3abd('0x5f')];_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x9c')]=_0x111c36[_0x3abd('0x5f')][_0x3abd('0x9e')][0x0]['message_id'];}if(_0x3a5efd[_0x3abd('0x5f')]['id']){delete _0x3a5efd['body']['id'];}if(_['isNil'](_0x3a5efd[_0x3abd('0x5f')]['from'])){throw new db['Sequelize'][(_0x3abd('0x8f'))](_0x3abd('0x9f'));}if(_['isNil'](_0x3a5efd['body'][_0x3abd('0x5f')])||_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x5f')]===''){throw new db[(_0x3abd('0x8e'))][(_0x3abd('0x8f'))](_0x3abd('0xa0'));}if(_[_0x3abd('0xa1')](_0x3a5efd['body'][_0x3abd('0xa2')])){throw new db[(_0x3abd('0x8e'))][(_0x3abd('0x8f'))](_0x3abd('0xa3')+_0x69b8a4);}if(!_[_0x3abd('0xa4')](_0x69b8a4,_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0xa2')])){throw new db[(_0x3abd('0x8e'))]['ValidationError'](_0x3abd('0xa5')+_0x69b8a4);}_0x47e16f[_0x3a5efd['body'][_0x3abd('0xa2')]]=_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')];return db['CmList'][_0x3abd('0x57')]({'where':{'id':_0x3a5efd[_0x3abd('0x83')][_0x3abd('0x94')]},'include':[{'model':db[_0x3abd('0x8d')],'as':'Contacts','where':_0x47e16f,'limit':0x1,'order':[['updatedAt',_0x3abd('0xa6')]]}]});})[_0x3abd('0x35')](handleEntityNotFound(_0x35dce0,null))[_0x3abd('0x35')](function(_0x2d182b){if(_0x2d182b){_0x3a5efd[_0x3abd('0xa7')]=_['omit'](_0x2d182b,[_0x3abd('0xa8')]);if(_0x2d182b[_0x3abd('0xa8')]['length']){return _0x2d182b[_0x3abd('0xa8')][0x0];}var _0xc0797e=_[_0x3abd('0x17')](_0x3a5efd[_0x3abd('0x5f')],{'firstName':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')],'ListId':_0x2d182b['id']});_0xc0797e[_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0xa2')]]=_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')];return db[_0x3abd('0x8d')]['create'](_0xc0797e,{'fields':_0x27748e,'raw':!![]});}})[_0x3abd('0x35')](handleEntityNotFound(_0x35dce0,null))[_0x3abd('0x35')](function(_0x28ba81){if(_0x28ba81){_0x3a5efd[_0x3abd('0xa9')]=_0x28ba81;var _0x4156ef={'ContactId':_0x28ba81['id'],'phone':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')],'WhatsappAccountId':_0x111c36[_0x3abd('0x61')]['id']};var _0x28f7bb={'ContactId':_0x28ba81['id'],'WhatsappAccountId':_0x111c36[_0x3abd('0x61')]['id'],'closed':![]};return db[_0x3abd('0xaa')]['find']({'where':_0x28f7bb})['then'](function(_0x561c47){if(_0x561c47){return[_0x561c47,![]];}return db[_0x3abd('0xaa')][_0x3abd('0x59')](_0x4156ef)[_0x3abd('0x35')](function(_0x6fc38c){return[_0x6fc38c,!![]];});});}})[_0x3abd('0x70')](function(_0x40b39b,_0x4bbeab){_0x3a5efd[_0x3abd('0xab')]=_0x40b39b[_0x3abd('0x36')]({'plain':!![]});_0x3a5efd[_0x3abd('0xab')][_0x3abd('0xac')]=![];if(_0x4bbeab){if(_0x3a5efd[_0x3abd('0x83')][_0x3abd('0xad')]){_0x3a5efd[_0x3abd('0x89')][_0x3abd('0xae')]({'id':0x0,'priority':_0x3a5efd[_0x3abd('0x89')]['length']+0x1,'app':_0x3abd('0xaf'),'appdata':_0x3abd('0xb0'),'interval':_0x3abd('0xb1')});}_0x3a5efd['interaction'][_0x3abd('0xac')]=!![];}return db['WhatsappMessage'][_0x3abd('0x59')]({'phone':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x97')],'messageId':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x9c')],'body':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0x5f')],'WhatsappAccountId':_0x111c36[_0x3abd('0x61')]['id'],'WhatsappInteractionId':_0x40b39b['id'],'direction':'in','ContactId':_0x40b39b[_0x3abd('0xb2')],'AttachmentId':_0x3a5efd[_0x3abd('0x5f')][_0x3abd('0xb3')]});})['then'](function(_0x2790a9){_0x3a5efd[_0x3abd('0x27')]=_0x2790a9;if(!_0x3a5efd[_0x3abd('0xab')][_0x3abd('0xb4')])return;return db[_0x3abd('0x77')][_0x3abd('0x57')]({'attributes':['id',_0x3abd('0x39')],'where':{'id':_0x3a5efd[_0x3abd('0xab')][_0x3abd('0xb4')]}});})[_0x3abd('0x35')](function(_0x1284e4){if(_0x1284e4){_0x3a5efd['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3abd('0xb5'),'appdata':_0x1284e4[_0x3abd('0x39')]+','+(_0x3a5efd[_0x3abd('0x83')][_0x3abd('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0x3a5efd[_0x3abd('0xab')][_0x3abd('0xb7')])return;return db[_0x3abd('0xb8')][_0x3abd('0x57')]({'attributes':['id',_0x3abd('0x39')],'where':{'id':_0x3a5efd[_0x3abd('0xab')][_0x3abd('0xb7')]}});})[_0x3abd('0x35')](function(_0x520f6f){if(_0x520f6f){_0x3a5efd['applications'][_0x3abd('0xb9')]({'id':0x0,'priority':0x1,'app':_0x3abd('0xba'),'appdata':_0x520f6f[_0x3abd('0x39')]+','+(_0x3a5efd['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x3abd('0xb1')});}return respondWithRpcPromise(_0x3abd('0xbb'),_0x3abd('0xbc'),_0x3a5efd);})[_0x3abd('0x35')](function(_0x180c86){if(_0x180c86){var _0x4f0d00=0xc8;var _0x32bf68='receiveMessage';logger['info'](_0x3abd('0x23'),_0x32bf68,_0x4f0d00,_0x3abd('0xbd'));logger[_0x3abd('0x22')](_0x3abd('0xbe'),_0x32bf68,_0x4f0d00,_0x3abd('0xbd'),JSON[_0x3abd('0x24')](_0x180c86));if(_0x3a5efd[_0x3abd('0x83')][_0x3abd('0x40')]===_0x3abd('0x96')){return _0x35dce0['status'](_0x4f0d00)[_0x3abd('0xbf')](_0x3abd('0xc0'),_0x3abd('0xc1'))[_0x3abd('0x3a')](_0x3abd('0xc2'));}else{return _0x35dce0['status'](_0x4f0d00)['json'](_0x180c86);}}});})[_0x3abd('0x58')](handleError(_0x35dce0,null));};exports[_0x3abd('0x3a')]=function(_0x1d1293,_0x50a1fb,_0x366316){var _0x4f809e,_0x6dd501,_0xbb74f;if(_['isNil'](_0x1d1293['body'][_0x3abd('0x5f')])||_0x1d1293[_0x3abd('0x5f')]['body']===''){throw new db[(_0x3abd('0x8e'))]['ValidationError'](_0x3abd('0xa0'));}if(_['isNil'](_0x1d1293['body']['to'])){throw new db[(_0x3abd('0x8e'))][(_0x3abd('0x8f'))](_0x3abd('0xc3'));}_0x4f809e=_0x1d1293[_0x3abd('0x5f')]['to'];return db[_0x3abd('0x3f')][_0x3abd('0x57')]({'where':{'id':_0x1d1293[_0x3abd('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x3abd('0xc4'),'include':[{'model':db[_0x3abd('0x8d')],'as':_0x3abd('0xa8'),'where':{'mobile':_0x4f809e},'limit':0x1,'order':[[_0x3abd('0x93'),'DESC']]}]}]})[_0x3abd('0x35')](handleEntityNotFound(_0x50a1fb,null))['then'](function(_0x31d043){if(_0x31d043&&_0x31d043[_0x3abd('0xc4')]){_0x6dd501=_0x31d043[_0x3abd('0x36')]({'plain':!![]});if(_0x6dd501[_0x3abd('0xc4')]&&_0x6dd501[_0x3abd('0xc4')][_0x3abd('0xa8')][_0x3abd('0x56')]){return _0x6dd501['List'][_0x3abd('0xa8')][0x0];}return db[_0x3abd('0x8d')][_0x3abd('0x59')](_[_0x3abd('0x17')](_0x1d1293[_0x3abd('0x5f')],{'firstName':_0x4f809e,'mobile':_0x4f809e,'phone':_0x4f809e,'ListId':_0x6dd501[_0x3abd('0x94')]}));}})[_0x3abd('0x35')](handleEntityNotFound(_0x50a1fb,null))['then'](function(_0x30fb12){if(_0x30fb12){_0xbb74f=_0x30fb12;return db[_0x3abd('0xaa')]['find']({'where':{'ContactId':_0xbb74f['id'],'closed':![],'WhatsappAccountId':_0x6dd501['id']}})[_0x3abd('0x35')](function(_0x49635c){if(_0x49635c){return[_0x49635c,![]];}return db[_0x3abd('0xaa')]['create']({'UserId':_0x1d1293[_0x3abd('0xc5')]['id'],'ContactId':_0xbb74f['id'],'WhatsappAccountId':_0x6dd501['id'],'phone':_0x4f809e,'firstMsgDirection':_0x3abd('0xc6'),'Messages':[_[_0x3abd('0x4e')](_0x1d1293[_0x3abd('0x5f')],{'read':![],'body':_0x1d1293[_0x3abd('0x5f')][_0x3abd('0x5f')],'phone':_0x4f809e,'WhatsappAccountId':_0x6dd501['id'],'UserId':_0x1d1293['user']['id'],'ContactId':_0xbb74f['id']})]},{'include':[{'model':db[_0x3abd('0x87')],'as':'Messages'}]})[_0x3abd('0x35')](function(_0x220147){return[_0x220147,!![]];});});}})['spread'](function(_0x4df505,_0x256ebb){if(_0x256ebb){return _0x4df505;}return db['WhatsappMessage']['create'](_[_0x3abd('0x4e')](_0x1d1293[_0x3abd('0x5f')],{'read':![],'body':_0x1d1293['body'][_0x3abd('0x5f')],'phone':_0x4f809e,'WhatsappAccountId':_0x6dd501['id'],'WhatsappInteractionId':_0x4df505['id'],'UserId':_0x1d1293['user']['id'],'ContactId':_0xbb74f['id']}))['then'](function(_0x47c8cf){_0x4df505[_0x3abd('0xc7')][_0x3abd('0xc8')]=[];_0x4df505[_0x3abd('0xc7')]['Messages'][_0x3abd('0xae')](_0x47c8cf[_0x3abd('0xc7')]);return _0x4df505;});})[_0x3abd('0x35')](respondWithResult(_0x50a1fb,null))[_0x3abd('0x58')](handleError(_0x50a1fb,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d7dfb4b..fda40e5 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 _0xede9=['exports','events','../../mysqldb','setMaxListeners','emit','hook'];(function(_0x261687,_0x71d65f){var _0x4c858f=function(_0x1bf62f){while(--_0x1bf62f){_0x261687['push'](_0x261687['shift']());}};_0x4c858f(++_0x71d65f);}(_0xede9,0x169));var _0x9ede=function(_0x3caa4,_0x4bb5d3){_0x3caa4=_0x3caa4-0x0;var _0x55729d=_0xede9[_0x3caa4];return _0x55729d;};'use strict';var EventEmitter=require(_0x9ede('0x0'));var WhatsappAccount=require(_0x9ede('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9ede('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x100294){return function(_0x178561,_0x5f2ead,_0x1be86f){WhatsappAccountEvents[_0x9ede('0x3')](_0x100294+':'+_0x178561['id'],_0x178561);WhatsappAccountEvents[_0x9ede('0x3')](_0x100294,_0x178561);_0x1be86f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9ede('0x4')](e,emitEvent(event));}}module[_0x9ede('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6501=['save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x39f6f6,_0x5ee9f2){var _0x3cdbce=function(_0x147fda){while(--_0x147fda){_0x39f6f6['push'](_0x39f6f6['shift']());}};_0x3cdbce(++_0x5ee9f2);}(_0x6501,0x18c));var _0x1650=function(_0xbd7d4,_0xcbf94e){_0xbd7d4=_0xbd7d4-0x0;var _0x1ceb01=_0x6501[_0xbd7d4];return _0x1ceb01;};'use strict';var EventEmitter=require(_0x1650('0x0'));var WhatsappAccount=require(_0x1650('0x1'))['db'][_0x1650('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1650('0x3')](0x0);var events={'afterCreate':_0x1650('0x4'),'afterUpdate':_0x1650('0x5'),'afterDestroy':_0x1650('0x6')};function emitEvent(_0x3bdf2f){return function(_0x3dcc56,_0x5eafde,_0x589284){WhatsappAccountEvents['emit'](_0x3bdf2f+':'+_0x3dcc56['id'],_0x3dcc56);WhatsappAccountEvents[_0x1650('0x7')](_0x3bdf2f,_0x3dcc56);_0x589284(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x1650('0x8')](e,emitEvent(event));}}module[_0x1650('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 29b2737..cc0ebbe 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 _0xffb3=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x15518c,_0x2fe291){var _0x46eec6=function(_0x32f20c){while(--_0x32f20c){_0x15518c['push'](_0x15518c['shift']());}};_0x46eec6(++_0x2fe291);}(_0xffb3,0xd3));var _0x3ffb=function(_0x1961ea,_0x124708){_0x1961ea=_0x1961ea-0x0;var _0x331762=_0xffb3[_0x1961ea];return _0x331762;};'use strict';var _=require(_0x3ffb('0x0'));var util=require('util');var logger=require(_0x3ffb('0x1'))('api');var moment=require(_0x3ffb('0x2'));var BPromise=require(_0x3ffb('0x3'));var rp=require(_0x3ffb('0x4'));var fs=require('fs');var path=require(_0x3ffb('0x5'));var rimraf=require(_0x3ffb('0x6'));var config=require(_0x3ffb('0x7'));var attributes=require(_0x3ffb('0x8'));module[_0x3ffb('0x9')]=function(_0x2645f9,_0x5e0ad9){return _0x2645f9[_0x3ffb('0xa')]('WhatsappAccount',attributes,{'tableName':_0x3ffb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa413=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3a7016,_0x219357){var _0x1032df=function(_0x5466c3){while(--_0x5466c3){_0x3a7016['push'](_0x3a7016['shift']());}};_0x1032df(++_0x219357);}(_0xa413,0xd0));var _0x3a41=function(_0x33b9a6,_0xc10de7){_0x33b9a6=_0x33b9a6-0x0;var _0x555255=_0xa413[_0x33b9a6];return _0x555255;};'use strict';var _=require(_0x3a41('0x0'));var util=require(_0x3a41('0x1'));var logger=require(_0x3a41('0x2'))(_0x3a41('0x3'));var moment=require(_0x3a41('0x4'));var BPromise=require('bluebird');var rp=require(_0x3a41('0x5'));var fs=require('fs');var path=require(_0x3a41('0x6'));var rimraf=require(_0x3a41('0x7'));var config=require(_0x3a41('0x8'));var attributes=require(_0x3a41('0x9'));module[_0x3a41('0xa')]=function(_0x5ebad3,_0xa72203){return _0x5ebad3[_0x3a41('0xb')](_0x3a41('0xc'),attributes,{'tableName':_0x3a41('0xd'),'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 3aabc0f..f3c19c7 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 _0x97a0=['options','raw','where','include','model','map','attributes','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','WhatsappAccount'];(function(_0x4d5d93,_0x4dc2ec){var _0x3a1adc=function(_0x349871){while(--_0x349871){_0x4d5d93['push'](_0x4d5d93['shift']());}};_0x3a1adc(++_0x4dc2ec);}(_0x97a0,0x171));var _0x097a=function(_0x173644,_0x580185){_0x173644=_0x173644-0x0;var _0x4ce756=_0x97a0[_0x173644];return _0x4ce756;};'use strict';var _=require(_0x097a('0x0'));var util=require(_0x097a('0x1'));var moment=require(_0x097a('0x2'));var BPromise=require(_0x097a('0x3'));var rs=require(_0x097a('0x4'));var fs=require('fs');var Redis=require(_0x097a('0x5'));var db=require(_0x097a('0x6'))['db'];var utils=require(_0x097a('0x7'));var logger=require(_0x097a('0x8'))(_0x097a('0x9'));var config=require(_0x097a('0xa'));var jayson=require(_0x097a('0xb'));var client=jayson[_0x097a('0xc')][_0x097a('0xd')]({'port':0x232a});config[_0x097a('0xe')]=_['defaults'](config['redis'],{'host':_0x097a('0xf'),'port':0x18eb});var socket=require(_0x097a('0x10'))(new Redis(config[_0x097a('0xe')]));require(_0x097a('0x11'))[_0x097a('0x12')](socket);function respondWithRpcPromise(_0x343fa1,_0x5b2e0d,_0x352efe){return new BPromise(function(_0x9a5e4d,_0x143c0f){return client[_0x097a('0x13')](_0x343fa1,_0x352efe)[_0x097a('0x14')](function(_0x4b9f68){logger[_0x097a('0x15')](_0x097a('0x16'),_0x5b2e0d,_0x097a('0x17'));logger[_0x097a('0x18')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5b2e0d,_0x097a('0x17'),JSON[_0x097a('0x19')](_0x4b9f68));if(_0x4b9f68[_0x097a('0x1a')]){if(_0x4b9f68[_0x097a('0x1a')][_0x097a('0x1b')]===0x1f4){logger[_0x097a('0x1a')](_0x097a('0x16'),_0x5b2e0d,_0x4b9f68[_0x097a('0x1a')][_0x097a('0x1c')]);return _0x143c0f(_0x4b9f68[_0x097a('0x1a')][_0x097a('0x1c')]);}logger['error'](_0x097a('0x16'),_0x5b2e0d,_0x4b9f68['error'][_0x097a('0x1c')]);return _0x9a5e4d(_0x4b9f68['error'][_0x097a('0x1c')]);}else{logger[_0x097a('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x5b2e0d,_0x097a('0x17'));_0x9a5e4d(_0x4b9f68[_0x097a('0x1d')][_0x097a('0x1c')]);}})['catch'](function(_0x408769){logger[_0x097a('0x1a')](_0x097a('0x16'),_0x5b2e0d,_0x408769);_0x143c0f(_0x408769);});});}exports['ShowWhatsappAccount']=function(_0xd2f348){var _0x42c910=this;return new Promise(function(_0x109a40,_0x74755f){return db[_0x097a('0x1e')]['find']({'raw':_0xd2f348[_0x097a('0x1f')]?_0xd2f348['options'][_0x097a('0x20')]===undefined?!![]:![]:!![],'where':_0xd2f348[_0x097a('0x1f')]?_0xd2f348[_0x097a('0x1f')][_0x097a('0x21')]||null:null,'attributes':_0xd2f348[_0x097a('0x1f')]?_0xd2f348[_0x097a('0x1f')]['attributes']||null:null,'include':_0xd2f348[_0x097a('0x1f')]?_0xd2f348['options'][_0x097a('0x22')]?_['map'](_0xd2f348['options'][_0x097a('0x22')],function(_0x9bb465){return{'model':db[_0x9bb465[_0x097a('0x23')]],'as':_0x9bb465['as'],'attributes':_0x9bb465['attributes'],'include':_0x9bb465[_0x097a('0x22')]?_[_0x097a('0x24')](_0x9bb465[_0x097a('0x22')],function(_0x43370c){return{'model':db[_0x43370c[_0x097a('0x23')]],'as':_0x43370c['as'],'attributes':_0x43370c[_0x097a('0x25')],'include':_0x43370c[_0x097a('0x22')]?_[_0x097a('0x24')](_0x43370c['include'],function(_0x4ff851){return{'model':db[_0x4ff851[_0x097a('0x23')]],'as':_0x4ff851['as'],'attributes':_0x4ff851[_0x097a('0x25')]};}):[]};}):[]};}):[]:[]})[_0x097a('0x14')](function(_0x12e181){logger[_0x097a('0x15')]('ShowWhatsappAccount',_0xd2f348);logger['debug'](_0x097a('0x26'),_0xd2f348,JSON['stringify'](_0x12e181));_0x109a40(_0x12e181);})[_0x097a('0x27')](function(_0x5ab419){logger[_0x097a('0x1a')](_0x097a('0x26'),_0x5ab419[_0x097a('0x1c')],_0xd2f348);_0x74755f(_0x42c910[_0x097a('0x1a')](0x1f4,_0x5ab419[_0x097a('0x1c')]));});});}; \ No newline at end of file +var _0xdf2a=['stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x23901f,_0x49b717){var _0x4b6f31=function(_0x2c5d0f){while(--_0x2c5d0f){_0x23901f['push'](_0x23901f['shift']());}};_0x4b6f31(++_0x49b717);}(_0xdf2a,0x1b1));var _0xadf2=function(_0xed6e8b,_0x184c10){_0xed6e8b=_0xed6e8b-0x0;var _0x5627dc=_0xdf2a[_0xed6e8b];return _0x5627dc;};'use strict';var _=require('lodash');var util=require(_0xadf2('0x0'));var moment=require(_0xadf2('0x1'));var BPromise=require(_0xadf2('0x2'));var rs=require(_0xadf2('0x3'));var fs=require('fs');var Redis=require(_0xadf2('0x4'));var db=require(_0xadf2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xadf2('0x6'))(_0xadf2('0x7'));var config=require(_0xadf2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xadf2('0x9')][_0xadf2('0xa')]({'port':0x232a});config['redis']=_[_0xadf2('0xb')](config[_0xadf2('0xc')],{'host':_0xadf2('0xd'),'port':0x18eb});var socket=require(_0xadf2('0xe'))(new Redis(config[_0xadf2('0xc')]));require(_0xadf2('0xf'))[_0xadf2('0x10')](socket);function respondWithRpcPromise(_0x3b3ac4,_0x541962,_0xa51d75){return new BPromise(function(_0x4f4e4a,_0x155c7b){return client[_0xadf2('0x11')](_0x3b3ac4,_0xa51d75)[_0xadf2('0x12')](function(_0x180b9c){logger[_0xadf2('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x541962,_0xadf2('0x14'));logger[_0xadf2('0x15')](_0xadf2('0x16'),_0x541962,'request\x20sent',JSON[_0xadf2('0x17')](_0x180b9c));if(_0x180b9c[_0xadf2('0x18')]){if(_0x180b9c[_0xadf2('0x18')][_0xadf2('0x19')]===0x1f4){logger[_0xadf2('0x18')](_0xadf2('0x1a'),_0x541962,_0x180b9c[_0xadf2('0x18')][_0xadf2('0x1b')]);return _0x155c7b(_0x180b9c[_0xadf2('0x18')][_0xadf2('0x1b')]);}logger[_0xadf2('0x18')](_0xadf2('0x1a'),_0x541962,_0x180b9c['error'][_0xadf2('0x1b')]);return _0x4f4e4a(_0x180b9c[_0xadf2('0x18')][_0xadf2('0x1b')]);}else{logger[_0xadf2('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x541962,_0xadf2('0x14'));_0x4f4e4a(_0x180b9c['result']['message']);}})['catch'](function(_0x62584b){logger['error'](_0xadf2('0x1a'),_0x541962,_0x62584b);_0x155c7b(_0x62584b);});});}exports[_0xadf2('0x1c')]=function(_0x53d607){var _0x1874df=this;return new Promise(function(_0x2b5342,_0x4d8b07){return db[_0xadf2('0x1d')][_0xadf2('0x1e')]({'raw':_0x53d607[_0xadf2('0x1f')]?_0x53d607[_0xadf2('0x1f')][_0xadf2('0x20')]===undefined?!![]:![]:!![],'where':_0x53d607[_0xadf2('0x1f')]?_0x53d607[_0xadf2('0x1f')]['where']||null:null,'attributes':_0x53d607['options']?_0x53d607[_0xadf2('0x1f')][_0xadf2('0x21')]||null:null,'include':_0x53d607['options']?_0x53d607[_0xadf2('0x1f')][_0xadf2('0x22')]?_[_0xadf2('0x23')](_0x53d607[_0xadf2('0x1f')][_0xadf2('0x22')],function(_0x57f6c4){return{'model':db[_0x57f6c4[_0xadf2('0x24')]],'as':_0x57f6c4['as'],'attributes':_0x57f6c4[_0xadf2('0x21')],'include':_0x57f6c4[_0xadf2('0x22')]?_[_0xadf2('0x23')](_0x57f6c4[_0xadf2('0x22')],function(_0x5d57e2){return{'model':db[_0x5d57e2[_0xadf2('0x24')]],'as':_0x5d57e2['as'],'attributes':_0x5d57e2[_0xadf2('0x21')],'include':_0x5d57e2[_0xadf2('0x22')]?_['map'](_0x5d57e2['include'],function(_0x38e08d){return{'model':db[_0x38e08d[_0xadf2('0x24')]],'as':_0x38e08d['as'],'attributes':_0x38e08d[_0xadf2('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8a9099){logger[_0xadf2('0x13')](_0xadf2('0x1c'),_0x53d607);logger[_0xadf2('0x15')]('ShowWhatsappAccount',_0x53d607,JSON['stringify'](_0x8a9099));_0x2b5342(_0x8a9099);})[_0xadf2('0x25')](function(_0x458113){logger[_0xadf2('0x18')](_0xadf2('0x1c'),_0x458113[_0xadf2('0x1b')],_0x53d607);_0x4d8b07(_0x1874df[_0xadf2('0x18')](0x1f4,_0x458113[_0xadf2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4e4e735..c901929 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 _0x05a6=['whatsappAccount:','./whatsappAccount.events','save','register','length'];(function(_0x41199f,_0x537da9){var _0x626cc7=function(_0x36300d){while(--_0x36300d){_0x41199f['push'](_0x41199f['shift']());}};_0x626cc7(++_0x537da9);}(_0x05a6,0x1a0));var _0x605a=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x05a6[_0x5eaa0b];return _0x28b295;};'use strict';var WhatsappAccountEvents=require(_0x605a('0x0'));var events=[_0x605a('0x1'),'remove','update'];function createListener(_0xac6da7,_0x399d16){return function(_0x30da4b){_0x399d16['emit'](_0xac6da7,_0x30da4b);};}function removeListener(_0x47c524,_0x202301){return function(){WhatsappAccountEvents['removeListener'](_0x47c524,_0x202301);};}exports[_0x605a('0x2')]=function(_0x382b6c){for(var _0xeff178=0x0,_0x52c80f=events[_0x605a('0x3')];_0xeff178<_0x52c80f;_0xeff178++){var _0x5e154b=events[_0xeff178];var _0x474c70=createListener(_0x605a('0x4')+_0x5e154b,_0x382b6c);WhatsappAccountEvents['on'](_0x5e154b,_0x474c70);}}; \ No newline at end of file +var _0x64c8=['length','whatsappAccount:','./whatsappAccount.events','remove','update','emit','register'];(function(_0x521b8a,_0xac9f6b){var _0x5d1ebf=function(_0x149cc3){while(--_0x149cc3){_0x521b8a['push'](_0x521b8a['shift']());}};_0x5d1ebf(++_0xac9f6b);}(_0x64c8,0x1de));var _0x864c=function(_0x326a5f,_0x382a59){_0x326a5f=_0x326a5f-0x0;var _0x34271c=_0x64c8[_0x326a5f];return _0x34271c;};'use strict';var WhatsappAccountEvents=require(_0x864c('0x0'));var events=['save',_0x864c('0x1'),_0x864c('0x2')];function createListener(_0x5d6bbe,_0x236d12){return function(_0x4e4a23){_0x236d12[_0x864c('0x3')](_0x5d6bbe,_0x4e4a23);};}function removeListener(_0x23db08,_0x1c4fdf){return function(){WhatsappAccountEvents['removeListener'](_0x23db08,_0x1c4fdf);};}exports[_0x864c('0x4')]=function(_0x244990){for(var _0x6c0d73=0x0,_0x162713=events[_0x864c('0x5')];_0x6c0d73<_0x162713;_0x6c0d73++){var _0x1052c5=events[_0x6c0d73];var _0x141215=createListener(_0x864c('0x6')+_0x1052c5,_0x244990);WhatsappAccountEvents['on'](_0x1052c5,_0x141215);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 872b414..210835d 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 _0xd36a=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index'];(function(_0x2de003,_0x536415){var _0x2c4ab4=function(_0x353cfc){while(--_0x353cfc){_0x2de003['push'](_0x2de003['shift']());}};_0x2c4ab4(++_0x536415);}(_0xd36a,0xd2));var _0xad36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd36a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xad36('0x0'));var path=require(_0xad36('0x1'));var timeout=require(_0xad36('0x2'));var express=require(_0xad36('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad36('0x4'));var interaction=require(_0xad36('0x5'));var config=require(_0xad36('0x6'));var controller=require(_0xad36('0x7'));router[_0xad36('0x8')]('/',auth['isAuthenticated'](),controller[_0xad36('0x9')]);router[_0xad36('0x8')](_0xad36('0xa'),auth[_0xad36('0xb')](),controller[_0xad36('0xc')]);router[_0xad36('0xd')]('/',auth[_0xad36('0xb')](),controller[_0xad36('0xe')]);router[_0xad36('0xf')](_0xad36('0xa'),auth['isAuthenticated'](),controller[_0xad36('0x10')]);router[_0xad36('0x11')]('/:id',auth[_0xad36('0xb')](),controller[_0xad36('0x12')]);module[_0xad36('0x13')]=router; \ No newline at end of file +var _0x8204=['get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x872c13,_0x4631f9){var _0x35d99f=function(_0x446d32){while(--_0x446d32){_0x872c13['push'](_0x872c13['shift']());}};_0x35d99f(++_0x4631f9);}(_0x8204,0x1c1));var _0x4820=function(_0x210f7e,_0x355201){_0x210f7e=_0x210f7e-0x0;var _0x6df118=_0x8204[_0x210f7e];return _0x6df118;};'use strict';var multer=require(_0x4820('0x0'));var util=require(_0x4820('0x1'));var path=require(_0x4820('0x2'));var timeout=require(_0x4820('0x3'));var express=require(_0x4820('0x4'));var router=express[_0x4820('0x5')]();var fs_extra=require(_0x4820('0x6'));var auth=require(_0x4820('0x7'));var interaction=require(_0x4820('0x8'));var config=require(_0x4820('0x9'));var controller=require(_0x4820('0xa'));router[_0x4820('0xb')]('/',auth[_0x4820('0xc')](),controller['index']);router['get'](_0x4820('0xd'),auth[_0x4820('0xc')](),controller['show']);router[_0x4820('0xe')]('/',auth[_0x4820('0xc')](),controller[_0x4820('0xf')]);router[_0x4820('0x10')](_0x4820('0xd'),auth[_0x4820('0xc')](),controller[_0x4820('0x11')]);router['delete'](_0x4820('0xd'),auth[_0x4820('0xc')](),controller[_0x4820('0x12')]);module[_0x4820('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index bf9d092..886b081 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 _0x58c4=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3e7e99,_0x307f70){var _0x320794=function(_0xd905d){while(--_0xd905d){_0x3e7e99['push'](_0x3e7e99['shift']());}};_0x320794(++_0x307f70);}(_0x58c4,0xbc));var _0x458c=function(_0x4441fc,_0x1c3e74){_0x4441fc=_0x4441fc-0x0;var _0x20859a=_0x58c4[_0x4441fc];return _0x20859a;};'use strict';var Sequelize=require(_0x458c('0x0'));module[_0x458c('0x1')]={'priority':{'type':Sequelize[_0x458c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x458c('0x3')],'allowNull':![],'defaultValue':_0x458c('0x4')},'appdata':{'type':Sequelize[_0x458c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x458c('0x3')],'defaultValue':_0x458c('0x6')}}; \ No newline at end of file +var _0x13ab=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x218823,_0x1ea2d3){var _0x3f5147=function(_0x28c927){while(--_0x28c927){_0x218823['push'](_0x218823['shift']());}};_0x3f5147(++_0x1ea2d3);}(_0x13ab,0x130));var _0xb13a=function(_0x512693,_0x35c06e){_0x512693=_0x512693-0x0;var _0x15d01e=_0x13ab[_0x512693];return _0x15d01e;};'use strict';var Sequelize=require(_0xb13a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb13a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb13a('0x2')],'allowNull':![],'defaultValue':_0xb13a('0x3')},'appdata':{'type':Sequelize[_0xb13a('0x4')]()},'description':{'type':Sequelize[_0xb13a('0x2')]},'interval':{'type':Sequelize[_0xb13a('0x2')],'defaultValue':_0xb13a('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9452c58..7ead57f 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 _0xb4b6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','query','keys','filters','attributes','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','fields','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x790977,_0x306a4a){var _0x540592=function(_0x3ee6f7){while(--_0x3ee6f7){_0x790977['push'](_0x790977['shift']());}};_0x540592(++_0x306a4a);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x2e9610,_0x31d10b){_0x2e9610=_0x2e9610-0x0;var _0x2f4ad7=_0xb4b6[_0x2e9610];return _0x2f4ad7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b4b('0x0'));var zipdir=require(_0x6b4b('0x1'));var jsonpatch=require(_0x6b4b('0x2'));var rp=require(_0x6b4b('0x3'));var moment=require(_0x6b4b('0x4'));var BPromise=require(_0x6b4b('0x5'));var Mustache=require(_0x6b4b('0x6'));var util=require(_0x6b4b('0x7'));var path=require(_0x6b4b('0x8'));var sox=require('sox');var csv=require(_0x6b4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b4b('0xa'));var _=require(_0x6b4b('0xb'));var squel=require(_0x6b4b('0xc'));var crypto=require(_0x6b4b('0xd'));var jsforce=require(_0x6b4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b4b('0x9'));var querystring=require(_0x6b4b('0xf'));var Papa=require(_0x6b4b('0x10'));var Redis=require(_0x6b4b('0x11'));var authService=require(_0x6b4b('0x12'));var qs=require(_0x6b4b('0x13'));var as=require(_0x6b4b('0x14'));var hardwareService=require(_0x6b4b('0x15'));var logger=require('../../config/logger')(_0x6b4b('0x16'));var utils=require('../../config/utils');var config=require(_0x6b4b('0x17'));var licenseUtil=require(_0x6b4b('0x18'));var db=require(_0x6b4b('0x19'))['db'];function respondWithStatusCode(_0x2ba8a0,_0x476d20){_0x476d20=_0x476d20||0xcc;return function(_0xa50ae5){if(_0xa50ae5){return _0x2ba8a0[_0x6b4b('0x1a')](_0x476d20);}return _0x2ba8a0['status'](_0x476d20)[_0x6b4b('0x1b')]();};}function respondWithResult(_0x2acc64,_0x3b99db){_0x3b99db=_0x3b99db||0xc8;return function(_0x587ed1){if(_0x587ed1){return _0x2acc64['status'](_0x3b99db)[_0x6b4b('0x1c')](_0x587ed1);}};}function respondWithFilteredResult(_0x2bf3fe,_0x5bf378){return function(_0x21ab38){if(_0x21ab38){var _0x3842a6=typeof _0x5bf378[_0x6b4b('0x1d')]===_0x6b4b('0x1e')&&typeof _0x5bf378[_0x6b4b('0x1f')]===_0x6b4b('0x1e');var _0x2fecb4=_0x21ab38[_0x6b4b('0x20')];var _0x15333b=_0x3842a6?0x0:_0x5bf378['offset'];var _0x5a1afc=_0x3842a6?_0x21ab38[_0x6b4b('0x20')]:_0x5bf378['offset']+_0x5bf378[_0x6b4b('0x1f')];var _0x44c5f6;if(_0x5a1afc>=_0x2fecb4){_0x5a1afc=_0x2fecb4;_0x44c5f6=0xc8;}else{_0x44c5f6=0xce;}_0x2bf3fe[_0x6b4b('0x21')](_0x44c5f6);return _0x2bf3fe[_0x6b4b('0x22')]('Content-Range',_0x15333b+'-'+_0x5a1afc+'/'+_0x2fecb4)[_0x6b4b('0x1c')](_0x21ab38);}return null;};}function patchUpdates(_0x6235eb){return function(_0x5f2224){try{jsonpatch['apply'](_0x5f2224,_0x6235eb,!![]);}catch(_0x5ec8a9){return BPromise[_0x6b4b('0x23')](_0x5ec8a9);}return _0x5f2224[_0x6b4b('0x24')]();};}function saveUpdates(_0x203f2a,_0x222e23){return function(_0x1a9fba){if(_0x1a9fba){return _0x1a9fba['update'](_0x203f2a)[_0x6b4b('0x25')](function(_0xbee434){return _0xbee434;});}return null;};}function removeEntity(_0x3a0376,_0xef64c9){return function(_0x595f33){if(_0x595f33){return _0x595f33['destroy']()['then'](function(){_0x3a0376['status'](0xcc)[_0x6b4b('0x1b')]();});}};}function handleEntityNotFound(_0x526f6d,_0x5df887){return function(_0x24e78a){if(!_0x24e78a){_0x526f6d[_0x6b4b('0x1a')](0x194);}return _0x24e78a;};}function handleError(_0x46580b,_0x35b517){_0x35b517=_0x35b517||0x1f4;return function(_0x5afba8){logger['error'](_0x5afba8[_0x6b4b('0x26')]);if(_0x5afba8[_0x6b4b('0x27')]){delete _0x5afba8[_0x6b4b('0x27')];}_0x46580b[_0x6b4b('0x21')](_0x35b517)['send'](_0x5afba8);};}exports[_0x6b4b('0x28')]=function(_0x5e6096,_0x1c2f42){var _0x1ab47c={},_0x334cf8={},_0x5efba8={'count':0x0,'rows':[]};var _0x195726=_[_0x6b4b('0x29')](db[_0x6b4b('0x2a')][_0x6b4b('0x2b')],function(_0x102305){return{'name':_0x102305[_0x6b4b('0x2c')],'type':_0x102305['type']['key']};});_0x334cf8['model']=_[_0x6b4b('0x29')](_0x195726,_0x6b4b('0x27'));_0x334cf8[_0x6b4b('0x2d')]=_[_0x6b4b('0x2e')](_0x5e6096[_0x6b4b('0x2d')]);_0x334cf8[_0x6b4b('0x2f')]=_['intersection'](_0x334cf8['model'],_0x334cf8['query']);_0x1ab47c[_0x6b4b('0x30')]=_['intersection'](_0x334cf8[_0x6b4b('0x31')],qs['fields'](_0x5e6096['query']['fields']));_0x1ab47c[_0x6b4b('0x30')]=_0x1ab47c[_0x6b4b('0x30')][_0x6b4b('0x32')]?_0x1ab47c[_0x6b4b('0x30')]:_0x334cf8[_0x6b4b('0x31')];if(!_0x5e6096['query'][_0x6b4b('0x33')]('nolimit')){_0x1ab47c[_0x6b4b('0x1f')]=qs['limit'](_0x5e6096[_0x6b4b('0x2d')][_0x6b4b('0x1f')]);_0x1ab47c[_0x6b4b('0x1d')]=qs['offset'](_0x5e6096[_0x6b4b('0x2d')][_0x6b4b('0x1d')]);}_0x1ab47c[_0x6b4b('0x34')]=qs['sort'](_0x5e6096['query'][_0x6b4b('0x35')]);_0x1ab47c[_0x6b4b('0x36')]=qs[_0x6b4b('0x2f')](_[_0x6b4b('0x37')](_0x5e6096[_0x6b4b('0x2d')],_0x334cf8[_0x6b4b('0x2f')]),_0x195726);if(_0x5e6096['query'][_0x6b4b('0x38')]){_0x1ab47c['where']=_[_0x6b4b('0x39')](_0x1ab47c[_0x6b4b('0x36')],{'$or':_['map'](_0x195726,function(_0x51fb38){if(_0x51fb38['type']!==_0x6b4b('0x3a')){var _0xda8ef3={};_0xda8ef3[_0x51fb38[_0x6b4b('0x27')]]={'$like':'%'+_0x5e6096[_0x6b4b('0x2d')][_0x6b4b('0x38')]+'%'};return _0xda8ef3;}})});}_0x1ab47c=_[_0x6b4b('0x39')]({},_0x1ab47c,_0x5e6096[_0x6b4b('0x3b')]);var _0x2fd761={'where':_0x1ab47c[_0x6b4b('0x36')]};return db['WhatsappApplication'][_0x6b4b('0x20')](_0x2fd761)[_0x6b4b('0x25')](function(_0x5d6612){_0x5efba8['count']=_0x5d6612;if(_0x5e6096[_0x6b4b('0x2d')][_0x6b4b('0x3c')]){_0x1ab47c[_0x6b4b('0x3d')]=[{'all':!![]}];}return db[_0x6b4b('0x2a')][_0x6b4b('0x3e')](_0x1ab47c);})[_0x6b4b('0x25')](function(_0x561716){_0x5efba8['rows']=_0x561716;return _0x5efba8;})[_0x6b4b('0x25')](respondWithFilteredResult(_0x1c2f42,_0x1ab47c))[_0x6b4b('0x3f')](handleError(_0x1c2f42,null));};exports[_0x6b4b('0x40')]=function(_0x504865,_0xcd3673){var _0x15642c={'raw':!![],'where':{'id':_0x504865[_0x6b4b('0x41')]['id']}},_0x4f1d57={};_0x4f1d57[_0x6b4b('0x31')]=_[_0x6b4b('0x2e')](db[_0x6b4b('0x2a')][_0x6b4b('0x2b')]);_0x4f1d57[_0x6b4b('0x2d')]=_[_0x6b4b('0x2e')](_0x504865[_0x6b4b('0x2d')]);_0x4f1d57['filters']=_[_0x6b4b('0x42')](_0x4f1d57[_0x6b4b('0x31')],_0x4f1d57[_0x6b4b('0x2d')]);_0x15642c['attributes']=_['intersection'](_0x4f1d57[_0x6b4b('0x31')],qs[_0x6b4b('0x43')](_0x504865[_0x6b4b('0x2d')]['fields']));_0x15642c[_0x6b4b('0x30')]=_0x15642c['attributes'][_0x6b4b('0x32')]?_0x15642c[_0x6b4b('0x30')]:_0x4f1d57['model'];if(_0x504865[_0x6b4b('0x2d')]['includeAll']){_0x15642c[_0x6b4b('0x3d')]=[{'all':!![]}];}_0x15642c=_['merge']({},_0x15642c,_0x504865['options']);return db[_0x6b4b('0x2a')][_0x6b4b('0x44')](_0x15642c)[_0x6b4b('0x25')](handleEntityNotFound(_0xcd3673,null))[_0x6b4b('0x25')](respondWithResult(_0xcd3673,null))['catch'](handleError(_0xcd3673,null));};exports[_0x6b4b('0x45')]=function(_0x136785,_0x2f58d3){return db['WhatsappApplication']['create'](_0x136785[_0x6b4b('0x46')],{})['then'](respondWithResult(_0x2f58d3,0xc9))['catch'](handleError(_0x2f58d3,null));};exports[_0x6b4b('0x47')]=function(_0x31a012,_0x11dee4){if(_0x31a012[_0x6b4b('0x46')]['id']){delete _0x31a012['body']['id'];}return db[_0x6b4b('0x2a')][_0x6b4b('0x44')]({'where':{'id':_0x31a012[_0x6b4b('0x41')]['id']}})[_0x6b4b('0x25')](handleEntityNotFound(_0x11dee4,null))[_0x6b4b('0x25')](saveUpdates(_0x31a012[_0x6b4b('0x46')],null))[_0x6b4b('0x25')](respondWithResult(_0x11dee4,null))[_0x6b4b('0x3f')](handleError(_0x11dee4,null));};exports[_0x6b4b('0x48')]=function(_0x449557,_0x34fbe9){return db[_0x6b4b('0x2a')]['find']({'where':{'id':_0x449557[_0x6b4b('0x41')]['id']}})[_0x6b4b('0x25')](handleEntityNotFound(_0x34fbe9,null))['then'](removeEntity(_0x34fbe9,null))['catch'](handleError(_0x34fbe9,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53ca5d,_0x11e148){_0x53ca5d=_0x53ca5d-0x0;var _0x17b26d=_0x5f2f[_0x53ca5d];return _0x17b26d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 94ff895..8e363d1 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 _0xd6d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x30ca6a,_0x473f7f){var _0x249cea=function(_0x3d0428){while(--_0x3d0428){_0x30ca6a['push'](_0x30ca6a['shift']());}};_0x249cea(++_0x473f7f);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5049e8,_0x9a0750){_0x5049e8=_0x5049e8-0x0;var _0x233baa=_0xd6d6[_0x5049e8];return _0x233baa;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d6d('0xe'),'collate':_0x6d6d('0xf')});}; \ No newline at end of file +var _0xe647=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0xa84425,_0x2442a2){var _0xfe4280=function(_0x3e0450){while(--_0x3e0450){_0xa84425['push'](_0xa84425['shift']());}};_0xfe4280(++_0x2442a2);}(_0xe647,0x16d));var _0x7e64=function(_0x3c1a07,_0x3138c9){_0x3c1a07=_0x3c1a07-0x0;var _0x4020c3=_0xe647[_0x3c1a07];return _0x4020c3;};'use strict';var _=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var logger=require('../../config/logger')(_0x7e64('0x2'));var moment=require(_0x7e64('0x3'));var BPromise=require(_0x7e64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e64('0x5'));var config=require(_0x7e64('0x6'));var attributes=require(_0x7e64('0x7'));module[_0x7e64('0x8')]=function(_0x221235,_0x552ed3){return _0x221235[_0x7e64('0x9')](_0x7e64('0xa'),attributes,{'tableName':_0x7e64('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e64('0xc'),'collate':_0x7e64('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7dbe0b4..436baf4 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 _0x8d0e=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0x90f29,_0x232842){var _0x31aec3=function(_0x347315){while(--_0x347315){_0x90f29['push'](_0x90f29['shift']());}};_0x31aec3(++_0x232842);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x570f69,_0x56fe19){_0x570f69=_0x570f69-0x0;var _0x521d8a=_0x8d0e[_0x570f69];return _0x521d8a;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file +var _0xbd50=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x2820de,_0x5a0b23){_0x2820de=_0x2820de-0x0;var _0x253f15=_0xbd50[_0x2820de];return _0x253f15;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index a804f80..1979b93 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 _0xc03e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','whatsappinteraction:update','delete','removeTags','multer','connect-timeout'];(function(_0x304fc0,_0x350911){var _0x9c5be4=function(_0x5f1faf){while(--_0x5f1faf){_0x304fc0['push'](_0x304fc0['shift']());}};_0x9c5be4(++_0x350911);}(_0xc03e,0x15a));var _0xec03=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xc03e[_0x4c4037];return _0x357862;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xec03('0x3'));var interaction=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var controller=require(_0xec03('0x6'));router[_0xec03('0x7')]('/',auth[_0xec03('0x8')](),controller[_0xec03('0x9')]);router[_0xec03('0x7')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0xb')]);router[_0xec03('0x7')](_0xec03('0xc'),auth[_0xec03('0x8')](),controller['show']);router[_0xec03('0x7')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0xe')]);router[_0xec03('0x7')](_0xec03('0xf'),auth[_0xec03('0x8')](),controller[_0xec03('0x10')]);router['post']('/',auth[_0xec03('0x8')](),controller[_0xec03('0x11')]);router[_0xec03('0x12')](_0xec03('0xd'),auth[_0xec03('0x8')](),controller[_0xec03('0x13')]);router[_0xec03('0x12')](_0xec03('0x14'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xec03('0x15')),controller[_0xec03('0x16')]);router[_0xec03('0x17')](_0xec03('0xc'),auth[_0xec03('0x8')](),interaction[_0xec03('0x18')](_0xec03('0x19'),_0xec03('0x1a')),controller['update']);router[_0xec03('0x1b')]('/:id',auth[_0xec03('0x8')](),interaction['tracked'](_0xec03('0x19'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xec03('0x1b')](_0xec03('0x14'),auth[_0xec03('0x8')](),controller[_0xec03('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb4c7=['post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','create'];(function(_0x2c2954,_0x3cadf4){var _0x1e834e=function(_0x9f157e){while(--_0x9f157e){_0x2c2954['push'](_0x2c2954['shift']());}};_0x1e834e(++_0x3cadf4);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xd10bc5,_0x29ba8e){_0xd10bc5=_0xd10bc5-0x0;var _0x47923a=_0xb4c7[_0xd10bc5];return _0x47923a;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0xc')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0xc')](_0x7b4c('0x12'),auth[_0x7b4c('0xa')](),controller['download']);router['post']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x14')](_0x7b4c('0x10'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x14')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x18')),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')](_0x7b4c('0x1b'),_0x7b4c('0x1c')),controller['update']);router[_0x7b4c('0x1d')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),interaction[_0x7b4c('0x17')]('whatsapp',_0x7b4c('0x1e')),controller[_0x7b4c('0x1f')]);router[_0x7b4c('0x1d')](_0x7b4c('0x16'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x20')]);module[_0x7b4c('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index dafbdbd..8e9ebc2 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 _0x0137=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','INTEGER'];(function(_0x3f3bee,_0x2750aa){var _0x5f1916=function(_0x229b9d){while(--_0x229b9d){_0x3f3bee['push'](_0x3f3bee['shift']());}};_0x5f1916(++_0x2750aa);}(_0x0137,0x1d8));var _0x7013=function(_0x59c6dc,_0x2f43d2){_0x59c6dc=_0x59c6dc-0x0;var _0x3ae1b6=_0x0137[_0x59c6dc];return _0x3ae1b6;};'use strict';var Sequelize=require(_0x7013('0x0'));var moment=require(_0x7013('0x1'));module[_0x7013('0x2')]={'closed':{'type':Sequelize[_0x7013('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7013('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7013('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7013('0x5')]},'note':{'type':Sequelize[_0x7013('0x5')]},'phone':{'type':Sequelize[_0x7013('0x5')]},'read1stAt':{'type':Sequelize[_0x7013('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7013('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7013('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7013('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7013('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7013('0x7')]}}; \ No newline at end of file +var _0xc2a2=['STRING','DATE','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x5eea6f,_0x3d7e06){var _0x582c2a=function(_0x3a39c3){while(--_0x3a39c3){_0x5eea6f['push'](_0x5eea6f['shift']());}};_0x582c2a(++_0x3d7e06);}(_0xc2a2,0x84));var _0x2c2a=function(_0x2cc4f9,_0x485664){_0x2cc4f9=_0x2cc4f9-0x0;var _0xacecde=_0xc2a2[_0x2cc4f9];return _0xacecde;};'use strict';var Sequelize=require(_0x2c2a('0x0'));var moment=require(_0x2c2a('0x1'));module[_0x2c2a('0x2')]={'closed':{'type':Sequelize[_0x2c2a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2c2a('0x4')]},'secondDisposition':{'type':Sequelize[_0x2c2a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2c2a('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2c2a('0x4')]},'read1stAt':{'type':Sequelize[_0x2c2a('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x2c2a('0x6')]('in',_0x2c2a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 66c18a8..0729bc0 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 _0xd803=['format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Messages','secret','read','Owner','fullname','get','mkdirSync','createdAt','closedAt','disposition','Attachment','basename','existsSync','pipe','createWriteStream','direction','out','System','value','renderFile','views','downloadInteraction.ejs','Whatsapp','createPdfFromHTML','log','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','update','destroy','then','error','name','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','hasOwnProperty','nolimit','sort','where','WhatsappInteractionId','filter','$gte','split'];(function(_0x3279c9,_0xe7d108){var _0x64aa31=function(_0x265b65){while(--_0x265b65){_0x3279c9['push'](_0x3279c9['shift']());}};_0x64aa31(++_0xe7d108);}(_0xd803,0x129));var _0x3d80=function(_0x445467,_0x11814c){_0x445467=_0x445467-0x0;var _0x25f83a=_0xd803[_0x445467];return _0x25f83a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3d80('0x0'));var moment=require(_0x3d80('0x1'));var BPromise=require(_0x3d80('0x2'));var util=require(_0x3d80('0x3'));var path=require(_0x3d80('0x4'));var ejs=require(_0x3d80('0x5'));var fs=require('fs');var _=require(_0x3d80('0x6'));var Redis=require(_0x3d80('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x3d80('0x8'));var pdf=require(_0x3d80('0x9'));var logger=require(_0x3d80('0xa'))(_0x3d80('0xb'));var config=require(_0x3d80('0xc'));var db=require(_0x3d80('0xd'))['db'];config[_0x3d80('0xe')]=_[_0x3d80('0xf')](config[_0x3d80('0xe')],{'host':_0x3d80('0x10'),'port':0x18eb});var socket=require(_0x3d80('0x11'))(new Redis(config['redis']));require(_0x3d80('0x12'))['register'](socket);function respondWithStatusCode(_0x4fa9ff,_0x51866c){_0x51866c=_0x51866c||0xcc;return function(_0x3ed934){if(_0x3ed934){return _0x4fa9ff[_0x3d80('0x13')](_0x51866c);}return _0x4fa9ff['status'](_0x51866c)[_0x3d80('0x14')]();};}function respondWithResult(_0x5a080f,_0x54c28d){_0x54c28d=_0x54c28d||0xc8;return function(_0x28a195){if(_0x28a195){return _0x5a080f[_0x3d80('0x15')](_0x54c28d)[_0x3d80('0x16')](_0x28a195);}};}function respondWithFilteredResult(_0x49cf4d,_0x4986b8){return function(_0x5caabf){if(_0x5caabf){var _0x213872=typeof _0x4986b8[_0x3d80('0x17')]===_0x3d80('0x18')&&typeof _0x4986b8[_0x3d80('0x19')]===_0x3d80('0x18');var _0x321838=_0x5caabf[_0x3d80('0x1a')];var _0x1d0f73=_0x213872?0x0:_0x4986b8[_0x3d80('0x17')];var _0x75120=_0x213872?_0x5caabf[_0x3d80('0x1a')]:_0x4986b8[_0x3d80('0x17')]+_0x4986b8[_0x3d80('0x19')];var _0x369017;if(_0x75120>=_0x321838){_0x75120=_0x321838;_0x369017=0xc8;}else{_0x369017=0xce;}_0x49cf4d[_0x3d80('0x15')](_0x369017);return _0x49cf4d['set']('Content-Range',_0x1d0f73+'-'+_0x75120+'/'+_0x321838)[_0x3d80('0x16')](_0x5caabf);}return null;};}function saveUpdates(_0x2d5992){return function(_0x119d1f){if(_0x119d1f){return _0x119d1f[_0x3d80('0x1b')](_0x2d5992)['then'](function(_0x52153f){return _0x52153f;});}return null;};}function removeEntity(_0xf53f1e){return function(_0xd87612){if(_0xd87612){return _0xd87612[_0x3d80('0x1c')]()[_0x3d80('0x1d')](function(){_0xf53f1e[_0x3d80('0x15')](0xcc)[_0x3d80('0x14')]();});}};}function handleEntityNotFound(_0x55dbc5){return function(_0x4a5d51){if(!_0x4a5d51){_0x55dbc5[_0x3d80('0x13')](0x194);}return _0x4a5d51;};}function handleError(_0xf0bab6,_0x41b04a){_0x41b04a=_0x41b04a||0x1f4;return function(_0xf6d7a4){logger[_0x3d80('0x1e')](_0xf6d7a4['stack']);if(_0xf6d7a4[_0x3d80('0x1f')]){delete _0xf6d7a4[_0x3d80('0x1f')];}_0xf0bab6[_0x3d80('0x15')](_0x41b04a)['send'](_0xf6d7a4);};}exports['index']=function(_0x32f2ff,_0x2d6f88){var _0x589529={};var _0x93809d=_[_0x3d80('0x20')](db[_0x3d80('0x21')][_0x3d80('0x22')],function(_0x4fb4c9){return{'name':_0x4fb4c9[_0x3d80('0x23')],'type':_0x4fb4c9['type'][_0x3d80('0x24')]};});_0x589529=qs[_0x3d80('0x25')](_0x93809d,_0x32f2ff);return interaction[_0x3d80('0x26')](_0x3d80('0x27'),_0x32f2ff[_0x3d80('0x28')],_0x32f2ff['user'],_0x589529,_0x93809d)[_0x3d80('0x1d')](respondWithFilteredResult(_0x2d6f88,_0x589529))['catch'](handleError(_0x2d6f88,null));};exports[_0x3d80('0x29')]=function(_0x62e348,_0x25462f){var _0x3c0170={'raw':![],'where':{'id':_0x62e348[_0x3d80('0x2a')]['id']}},_0x419074={};_0x419074[_0x3d80('0x2b')]=_[_0x3d80('0x2c')](db['WhatsappInteraction']['rawAttributes']);_0x419074[_0x3d80('0x28')]=_['keys'](_0x62e348[_0x3d80('0x28')]);_0x419074[_0x3d80('0x2d')]=_[_0x3d80('0x2e')](_0x419074[_0x3d80('0x2b')],_0x419074[_0x3d80('0x28')]);_0x3c0170[_0x3d80('0x2f')]=_[_0x3d80('0x2e')](_0x419074[_0x3d80('0x2b')],qs[_0x3d80('0x30')](_0x62e348[_0x3d80('0x28')]['fields']));_0x3c0170['attributes']=_0x3c0170[_0x3d80('0x2f')][_0x3d80('0x31')]?_0x3c0170[_0x3d80('0x2f')]:_0x419074['model'];if(_0x62e348[_0x3d80('0x28')][_0x3d80('0x32')]){_0x3c0170['include']=[{'all':!![]}];}_0x3c0170=_[_0x3d80('0x33')]({},_0x3c0170,_0x62e348['options']);return db[_0x3d80('0x21')][_0x3d80('0x34')](_0x3c0170)[_0x3d80('0x1d')](handleEntityNotFound(_0x25462f,null))[_0x3d80('0x1d')](respondWithResult(_0x25462f,null))[_0x3d80('0x35')](handleError(_0x25462f,null));};exports[_0x3d80('0x36')]=function(_0x4b7faf,_0x2a6b5f){return db[_0x3d80('0x21')][_0x3d80('0x36')](_0x4b7faf[_0x3d80('0x37')],{})[_0x3d80('0x1d')](respondWithResult(_0x2a6b5f,0xc9))['catch'](handleError(_0x2a6b5f,null));};exports[_0x3d80('0x1b')]=function(_0x2071ef,_0x1c1d6a){if(_0x2071ef[_0x3d80('0x37')]['id']){delete _0x2071ef[_0x3d80('0x37')]['id'];}return db[_0x3d80('0x21')][_0x3d80('0x34')]({'where':{'id':_0x2071ef['params']['id']}})['then'](handleEntityNotFound(_0x1c1d6a,null))['then'](saveUpdates(_0x2071ef[_0x3d80('0x37')],null))[_0x3d80('0x1d')](respondWithResult(_0x1c1d6a,null))['catch'](handleError(_0x1c1d6a,null));};exports[_0x3d80('0x1c')]=function(_0x40dcb1,_0x20e6be){return db[_0x3d80('0x21')]['find']({'where':{'id':_0x40dcb1['params']['id']}})['then'](handleEntityNotFound(_0x20e6be,null))[_0x3d80('0x1d')](removeEntity(_0x20e6be,null))[_0x3d80('0x35')](handleError(_0x20e6be,null));};exports[_0x3d80('0x38')]=function(_0x46083d,_0x1664e1){return db[_0x3d80('0x21')]['describe']()[_0x3d80('0x1d')](respondWithResult(_0x1664e1,null))[_0x3d80('0x35')](handleError(_0x1664e1,null));};exports[_0x3d80('0x39')]=function(_0x75834a,_0x21c504){return db[_0x3d80('0x3a')]['find']({'where':{'id':_0x75834a['params']['id']}})['then'](handleEntityNotFound(_0x21c504,null))['then'](function(_0x45e7e4){if(_0x45e7e4){return _0x45e7e4[_0x3d80('0x39')](_0x75834a[_0x3d80('0x37')]['ids'],_['omit'](_0x75834a[_0x3d80('0x37')],[_0x3d80('0x3b'),'id'])||{});}})[_0x3d80('0x1d')](respondWithResult(_0x21c504,null))[_0x3d80('0x35')](handleError(_0x21c504,null));};exports[_0x3d80('0x3c')]=function(_0xb59329,_0x4b495c){var _0x5909a6={'raw':![],'where':{}};var _0x4832d9={};var _0x1436b8={'count':0x0,'rows':[]};return db[_0x3d80('0x21')]['findOne']({'where':{'id':_0xb59329['params']['id']}})[_0x3d80('0x1d')](handleEntityNotFound(_0x4b495c,null))['then'](function(_0x14b7fa){if(_0x14b7fa){_0x4832d9[_0x3d80('0x2b')]=_['keys'](db[_0x3d80('0x3a')][_0x3d80('0x22')]);_0x4832d9['query']=_['keys'](_0xb59329[_0x3d80('0x28')]);_0x4832d9['filters']=_[_0x3d80('0x2e')](_0x4832d9[_0x3d80('0x2b')],_0x4832d9[_0x3d80('0x28')]);_0x5909a6['attributes']=_[_0x3d80('0x2e')](_0x4832d9[_0x3d80('0x2b')],qs[_0x3d80('0x30')](_0xb59329[_0x3d80('0x28')][_0x3d80('0x30')]));_0x5909a6[_0x3d80('0x2f')]=_0x5909a6[_0x3d80('0x2f')][_0x3d80('0x31')]?_0x5909a6['attributes']:_0x4832d9['model'];if(!_0xb59329[_0x3d80('0x28')][_0x3d80('0x3d')](_0x3d80('0x3e'))){_0x5909a6['limit']=qs[_0x3d80('0x19')](_0xb59329[_0x3d80('0x28')][_0x3d80('0x19')]);_0x5909a6[_0x3d80('0x17')]=qs[_0x3d80('0x17')](_0xb59329[_0x3d80('0x28')][_0x3d80('0x17')]);}_0x5909a6['order']=qs[_0x3d80('0x3f')](_0xb59329[_0x3d80('0x28')][_0x3d80('0x3f')]);_0x5909a6[_0x3d80('0x40')]=qs[_0x3d80('0x2d')](_['pick'](_0xb59329[_0x3d80('0x28')],_0x4832d9['filters']));_0x5909a6[_0x3d80('0x40')][_0x3d80('0x41')]=_0x14b7fa['id'];if(_0xb59329[_0x3d80('0x28')]['filter']){_0x5909a6[_0x3d80('0x40')]=_[_0x3d80('0x33')](_0x5909a6['where'],{'$or':_[_0x3d80('0x20')](_0x5909a6[_0x3d80('0x2f')],function(_0x500d33){var _0x12570c={};_0x12570c[_0x500d33]={'$like':'%'+_0xb59329['query'][_0x3d80('0x42')]+'%'};return _0x12570c;})});}if(_0xb59329['query']['$gte']){var _0x481f2=_0xb59329[_0x3d80('0x28')][_0x3d80('0x43')][_0x3d80('0x44')](',');var _0x1b670e={};_0x1b670e[_0x481f2[0x0]]={'$gte':moment(_0x481f2[0x1])[_0x3d80('0x45')](_0x3d80('0x46'))};_0x5909a6[_0x3d80('0x40')]=_[_0x3d80('0x33')](_0x5909a6[_0x3d80('0x40')],_0x1b670e);}_0x5909a6=_[_0x3d80('0x33')]({},_0x5909a6,_0xb59329[_0x3d80('0x47')]);return db[_0x3d80('0x3a')][_0x3d80('0x1a')]({'where':_0x5909a6['where']})[_0x3d80('0x1d')](function(_0x2c8f93){_0x1436b8['count']=_0x2c8f93;if(_0xb59329['query'][_0x3d80('0x32')]){_0x5909a6[_0x3d80('0x48')]=[{'all':!![]}];}return db[_0x3d80('0x3a')]['findAll'](_0x5909a6);})[_0x3d80('0x1d')](function(_0x4dde03){_0x1436b8[_0x3d80('0x49')]=_0x4dde03;return _0x1436b8;});}})['then'](respondWithFilteredResult(_0x4b495c,_0x5909a6))['catch'](handleError(_0x4b495c,null));};exports[_0x3d80('0x4a')]=function(_0x3062db,_0xfb3259){return db['WhatsappInteraction']['find']({'where':{'id':_0x3062db[_0x3d80('0x2a')]['id']}})[_0x3d80('0x1d')](handleEntityNotFound(_0xfb3259,null))[_0x3d80('0x1d')](function(_0x3e0b75){if(_0x3e0b75){return _0x3e0b75[_0x3d80('0x4b')](_0x3062db[_0x3d80('0x37')][_0x3d80('0x3b')],_['omit'](_0x3062db[_0x3d80('0x37')],[_0x3d80('0x3b'),'id'])||{})['spread'](function(){return db[_0x3d80('0x4c')][_0x3d80('0x26')]({'attributes':['id',_0x3d80('0x1f'),_0x3d80('0x4d')],'where':{'id':_0x3062db[_0x3d80('0x37')][_0x3d80('0x3b')]}});})['then'](function(_0x21f538){socket[_0x3d80('0x4e')]('whatsappInteractionTags:save',{'id':Number(_0x3062db['params']['id']),'tags':_0x21f538||[]});return{'id':Number(_0x3062db[_0x3d80('0x2a')]['id']),'tags':_0x21f538||[]};});}})[_0x3d80('0x1d')](respondWithResult(_0xfb3259,null))[_0x3d80('0x35')](handleError(_0xfb3259,null));};exports[_0x3d80('0x4f')]=function(_0x1c3256,_0x1efe15){return db['WhatsappInteraction']['find']({'where':{'id':_0x1c3256[_0x3d80('0x2a')]['id']}})[_0x3d80('0x1d')](handleEntityNotFound(_0x1efe15,null))['then'](function(_0x2ad9f4){if(_0x2ad9f4){return _0x2ad9f4[_0x3d80('0x4f')](_0x1c3256['query'][_0x3d80('0x3b')]);}})[_0x3d80('0x1d')](respondWithStatusCode(_0x1efe15,null))['catch'](handleError(_0x1efe15,null));};exports[_0x3d80('0x50')]=function(_0x38e90e,_0x5a10c0){var _0x577b3c=moment()[_0x3d80('0x51')]()[_0x3d80('0x52')]();var _0x5109cd=path[_0x3d80('0x53')](config[_0x3d80('0x54')],_0x3d80('0x55'),_0x3d80('0x56'),_0x3d80('0x57'));var _0x370c5a=path[_0x3d80('0x53')](config[_0x3d80('0x54')],_0x3d80('0x55'),_0x3d80('0x56'),_0x3d80('0x58'));var _0xd17b03=path[_0x3d80('0x53')](_0x5109cd,_0x577b3c);var _0x5f5250=util[_0x3d80('0x45')](_0x3d80('0x59'),_0x38e90e[_0x3d80('0x2a')]['id'],_0x577b3c);var _0x323ca=path['join'](_0x5109cd,_0x5f5250);var _0x52b76b=[];_0x52b76b['push']({'model':db[_0x3d80('0x5a')],'as':_0x3d80('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x52b76b[_0x3d80('0x5b')]({'model':db[_0x3d80('0x5c')],'as':_0x3d80('0x5d'),'attributes':['id',_0x3d80('0x5e'),_0x3d80('0x5f')],'raw':!![]});if(_0x38e90e['query'][_0x3d80('0x58')]){_0x52b76b[_0x3d80('0x5b')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x86ca91=[{'model':db[_0x3d80('0x3a')],'as':_0x3d80('0x60'),'attributes':['id',_0x3d80('0x37'),'createdAt','direction',_0x3d80('0x61'),_0x3d80('0x62')],'include':_0x52b76b}];_0x86ca91[_0x3d80('0x5b')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x3d80('0x1f')]});_0x86ca91[_0x3d80('0x5b')]({'model':db[_0x3d80('0x5a')],'as':_0x3d80('0x63'),'attributes':['id',_0x3d80('0x64')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x38e90e['params']['id']},'include':_0x86ca91})[_0x3d80('0x1d')](handleEntityNotFound(_0x5a10c0,null))[_0x3d80('0x1d')](function(_0x1ab67b){if(_0x1ab67b){var _0x3cd1d1=_0x1ab67b[_0x3d80('0x65')]({'plain':!![]});fs[_0x3d80('0x66')](_0xd17b03);var _0x21754e={'channel':'Whatsapp','account':_0x3cd1d1['Account'][_0x3d80('0x1f')],'agent':_0x3cd1d1[_0x3d80('0x63')]?_0x3cd1d1[_0x3d80('0x63')][_0x3d80('0x64')]:'N.A.','createdAt':moment(_0x3cd1d1[_0x3d80('0x67')])[_0x3d80('0x45')](_0x3d80('0x46'))[_0x3d80('0x52')](),'closedAt':_0x3cd1d1['closed']?moment(_0x3cd1d1[_0x3d80('0x68')])['format'](_0x3d80('0x46'))[_0x3d80('0x52')]():'','disposition':_0x3cd1d1[_0x3d80('0x69')],'messages':_(_0x3cd1d1[_0x3d80('0x60')])[_0x3d80('0x42')]({'secret':![]})[_0x3d80('0x20')](function(_0x2c5282){if(_0x2c5282[_0x3d80('0x6a')]){var _0x2cae40=path[_0x3d80('0x53')](_0x370c5a,_0x2c5282[_0x3d80('0x6a')][_0x3d80('0x6b')]);if(fs[_0x3d80('0x6c')](_0x2cae40)){fs['createReadStream'](_0x2cae40)[_0x3d80('0x6d')](fs[_0x3d80('0x6e')](path[_0x3d80('0x53')](_0xd17b03,_0x2c5282['Attachment'][_0x3d80('0x6b')])));}}return{'date':moment(_0x2c5282[_0x3d80('0x67')])[_0x3d80('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3d80('0x52')](),'sender':_0x2c5282[_0x3d80('0x6f')]===_0x3d80('0x70')?_0x2c5282[_0x3d80('0x5a')]?_0x2c5282[_0x3d80('0x5a')][_0x3d80('0x64')]:_0x3d80('0x71'):_0x2c5282[_0x3d80('0x5d')][_0x3d80('0x5e')]+(_0x2c5282[_0x3d80('0x5d')]['lastName']?'\x20'+_0x2c5282[_0x3d80('0x5d')][_0x3d80('0x5f')]:''),'body':_0x2c5282[_0x3d80('0x6a')]?_0x2c5282['Attachment'][_0x3d80('0x6b')]:_0x2c5282[_0x3d80('0x37')],'direction':_0x2c5282[_0x3d80('0x6f')]==='out'?'A':'C','secret':_0x2c5282[_0x3d80('0x61')],'read':_0x2c5282[_0x3d80('0x62')],'attachment':_0x2c5282[_0x3d80('0x6a')]};})[_0x3d80('0x72')]()};return ejs[_0x3d80('0x73')](path[_0x3d80('0x53')](config['root'],_0x3d80('0x55'),_0x3d80('0x74'),_0x3d80('0x75')),{'interaction':_0x21754e})['then'](function(_0x3abfa5){var _0x17e045=path[_0x3d80('0x53')](_0xd17b03,'transcript-'+_0x3cd1d1['id']+'-'+_0x577b3c+'.pdf');var _0xe88e9a={'path':_0x17e045,'channel':_0x3d80('0x76'),'interactionId':_0x3cd1d1['id']};return pdf[_0x3d80('0x77')](_0x3abfa5,_0xe88e9a);})[_0x3d80('0x1d')](function(){return new BPromise(function(_0xdbdc7a,_0x424cb8){zipdir(_0xd17b03,{'saveTo':_0x323ca},function(_0xa7afed,_0x53eaf1){if(_0xa7afed)return _0x424cb8(_0xa7afed);return _0xdbdc7a(_0x53eaf1);});})[_0x3d80('0x1d')](function(){return new BPromise(function(_0x2182d3,_0x5b39b5){rimraf(_0xd17b03,function(_0x286901){if(_0x286901)_0x5b39b5(_0x286901);return _0x2182d3();});});})[_0x3d80('0x1d')](function(){return _0x5a10c0[_0x3d80('0x50')](_0x323ca,_0x5f5250,function(_0x11b390){if(_0x11b390){console[_0x3d80('0x78')]('err',_0x11b390);}else{fs[_0x3d80('0x79')](_0x323ca);}});});});}else{return _0x5a10c0[_0x3d80('0x13')](0xc8);}})[_0x3d80('0x35')](handleError(_0x5a10c0,null));}; \ No newline at end of file +var _0x9185=['sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','map','rawAttributes','key','getOptions','findAll','user','catch','show','params','model','WhatsappInteraction','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','find','describe','addMessage','WhatsappMessage','body','ids','getMessages','findOne','keys','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','files','join','root','server','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','pipe','createWriteStream','toString','out','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x3dfa3e,_0x293558){var _0x3ff9ed=function(_0x400e9b){while(--_0x400e9b){_0x3dfa3e['push'](_0x3dfa3e['shift']());}};_0x3ff9ed(++_0x293558);}(_0x9185,0x1de));var _0x5918=function(_0x2edf17,_0x5c731d){_0x2edf17=_0x2edf17-0x0;var _0x3c028a=_0x9185[_0x2edf17];return _0x3c028a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5918('0x0'));var moment=require(_0x5918('0x1'));var BPromise=require(_0x5918('0x2'));var util=require('util');var path=require(_0x5918('0x3'));var ejs=require(_0x5918('0x4'));var fs=require('fs');var _=require(_0x5918('0x5'));var Redis=require(_0x5918('0x6'));var interaction=require(_0x5918('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x5918('0x8'))(_0x5918('0x9'));var config=require(_0x5918('0xa'));var db=require(_0x5918('0xb'))['db'];config[_0x5918('0xc')]=_[_0x5918('0xd')](config['redis'],{'host':_0x5918('0xe'),'port':0x18eb});var socket=require(_0x5918('0xf'))(new Redis(config[_0x5918('0xc')]));require(_0x5918('0x10'))[_0x5918('0x11')](socket);function respondWithStatusCode(_0x4ed32b,_0x2b38ed){_0x2b38ed=_0x2b38ed||0xcc;return function(_0x5f3925){if(_0x5f3925){return _0x4ed32b[_0x5918('0x12')](_0x2b38ed);}return _0x4ed32b[_0x5918('0x13')](_0x2b38ed)[_0x5918('0x14')]();};}function respondWithResult(_0x58e605,_0x5ea656){_0x5ea656=_0x5ea656||0xc8;return function(_0x3ab0ae){if(_0x3ab0ae){return _0x58e605[_0x5918('0x13')](_0x5ea656)['json'](_0x3ab0ae);}};}function respondWithFilteredResult(_0x27560f,_0x30feb0){return function(_0x40ed17){if(_0x40ed17){var _0x28bdbd=typeof _0x30feb0[_0x5918('0x15')]===_0x5918('0x16')&&typeof _0x30feb0['limit']==='undefined';var _0x573e1a=_0x40ed17[_0x5918('0x17')];var _0x287c52=_0x28bdbd?0x0:_0x30feb0[_0x5918('0x15')];var _0xe8b684=_0x28bdbd?_0x40ed17['count']:_0x30feb0[_0x5918('0x15')]+_0x30feb0[_0x5918('0x18')];var _0x4201cb;if(_0xe8b684>=_0x573e1a){_0xe8b684=_0x573e1a;_0x4201cb=0xc8;}else{_0x4201cb=0xce;}_0x27560f[_0x5918('0x13')](_0x4201cb);return _0x27560f[_0x5918('0x19')](_0x5918('0x1a'),_0x287c52+'-'+_0xe8b684+'/'+_0x573e1a)[_0x5918('0x1b')](_0x40ed17);}return null;};}function saveUpdates(_0x175fb6){return function(_0x3c3190){if(_0x3c3190){return _0x3c3190[_0x5918('0x1c')](_0x175fb6)[_0x5918('0x1d')](function(_0x59e90b){return _0x59e90b;});}return null;};}function removeEntity(_0x36e046){return function(_0x2c1ce6){if(_0x2c1ce6){return _0x2c1ce6[_0x5918('0x1e')]()[_0x5918('0x1d')](function(){_0x36e046['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x338b5a){return function(_0x26b5f7){if(!_0x26b5f7){_0x338b5a[_0x5918('0x12')](0x194);}return _0x26b5f7;};}function handleError(_0x11f089,_0x78557e){_0x78557e=_0x78557e||0x1f4;return function(_0x126104){logger[_0x5918('0x1f')](_0x126104[_0x5918('0x20')]);if(_0x126104[_0x5918('0x21')]){delete _0x126104['name'];}_0x11f089[_0x5918('0x13')](_0x78557e)[_0x5918('0x22')](_0x126104);};}exports['index']=function(_0x2cb08a,_0x4ff41d){var _0x5b6a38={};var _0x23ec8d=_[_0x5918('0x23')](db['WhatsappInteraction'][_0x5918('0x24')],function(_0x12cec7){return{'name':_0x12cec7['fieldName'],'type':_0x12cec7['type'][_0x5918('0x25')]};});_0x5b6a38=qs[_0x5918('0x26')](_0x23ec8d,_0x2cb08a);return interaction[_0x5918('0x27')]('whatsapp',_0x2cb08a['query'],_0x2cb08a[_0x5918('0x28')],_0x5b6a38,_0x23ec8d)[_0x5918('0x1d')](respondWithFilteredResult(_0x4ff41d,_0x5b6a38))[_0x5918('0x29')](handleError(_0x4ff41d,null));};exports[_0x5918('0x2a')]=function(_0x12d6a1,_0x3b6897){var _0x468c44={'raw':![],'where':{'id':_0x12d6a1[_0x5918('0x2b')]['id']}},_0x13e890={};_0x13e890[_0x5918('0x2c')]=_['keys'](db[_0x5918('0x2d')][_0x5918('0x24')]);_0x13e890[_0x5918('0x2e')]=_['keys'](_0x12d6a1['query']);_0x13e890[_0x5918('0x2f')]=_[_0x5918('0x30')](_0x13e890[_0x5918('0x2c')],_0x13e890[_0x5918('0x2e')]);_0x468c44[_0x5918('0x31')]=_[_0x5918('0x30')](_0x13e890['model'],qs[_0x5918('0x32')](_0x12d6a1[_0x5918('0x2e')]['fields']));_0x468c44[_0x5918('0x31')]=_0x468c44[_0x5918('0x31')][_0x5918('0x33')]?_0x468c44['attributes']:_0x13e890[_0x5918('0x2c')];if(_0x12d6a1['query'][_0x5918('0x34')]){_0x468c44['include']=[{'all':!![]}];}_0x468c44=_[_0x5918('0x35')]({},_0x468c44,_0x12d6a1[_0x5918('0x36')]);return db[_0x5918('0x2d')]['find'](_0x468c44)[_0x5918('0x1d')](handleEntityNotFound(_0x3b6897,null))[_0x5918('0x1d')](respondWithResult(_0x3b6897,null))[_0x5918('0x29')](handleError(_0x3b6897,null));};exports[_0x5918('0x37')]=function(_0x85b95d,_0x2e5a74){return db[_0x5918('0x2d')][_0x5918('0x37')](_0x85b95d['body'],{})[_0x5918('0x1d')](respondWithResult(_0x2e5a74,0xc9))[_0x5918('0x29')](handleError(_0x2e5a74,null));};exports[_0x5918('0x1c')]=function(_0x49abc8,_0x33a31c){if(_0x49abc8['body']['id']){delete _0x49abc8['body']['id'];}return db[_0x5918('0x2d')][_0x5918('0x38')]({'where':{'id':_0x49abc8['params']['id']}})[_0x5918('0x1d')](handleEntityNotFound(_0x33a31c,null))['then'](saveUpdates(_0x49abc8['body'],null))[_0x5918('0x1d')](respondWithResult(_0x33a31c,null))[_0x5918('0x29')](handleError(_0x33a31c,null));};exports[_0x5918('0x1e')]=function(_0x46e956,_0x496038){return db[_0x5918('0x2d')][_0x5918('0x38')]({'where':{'id':_0x46e956[_0x5918('0x2b')]['id']}})[_0x5918('0x1d')](handleEntityNotFound(_0x496038,null))[_0x5918('0x1d')](removeEntity(_0x496038,null))['catch'](handleError(_0x496038,null));};exports[_0x5918('0x39')]=function(_0xd8c156,_0x106660){return db[_0x5918('0x2d')][_0x5918('0x39')]()[_0x5918('0x1d')](respondWithResult(_0x106660,null))[_0x5918('0x29')](handleError(_0x106660,null));};exports[_0x5918('0x3a')]=function(_0x14dfe0,_0x10a578){return db[_0x5918('0x3b')][_0x5918('0x38')]({'where':{'id':_0x14dfe0[_0x5918('0x2b')]['id']}})['then'](handleEntityNotFound(_0x10a578,null))[_0x5918('0x1d')](function(_0x5d1e38){if(_0x5d1e38){return _0x5d1e38[_0x5918('0x3a')](_0x14dfe0[_0x5918('0x3c')][_0x5918('0x3d')],_['omit'](_0x14dfe0['body'],[_0x5918('0x3d'),'id'])||{});}})[_0x5918('0x1d')](respondWithResult(_0x10a578,null))[_0x5918('0x29')](handleError(_0x10a578,null));};exports[_0x5918('0x3e')]=function(_0x2f09ba,_0x330df0){var _0x1293e9={'raw':![],'where':{}};var _0x11a8f1={};var _0x4d961b={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x5918('0x3f')]({'where':{'id':_0x2f09ba[_0x5918('0x2b')]['id']}})[_0x5918('0x1d')](handleEntityNotFound(_0x330df0,null))['then'](function(_0x1bdeb0){if(_0x1bdeb0){_0x11a8f1[_0x5918('0x2c')]=_[_0x5918('0x40')](db[_0x5918('0x3b')]['rawAttributes']);_0x11a8f1[_0x5918('0x2e')]=_['keys'](_0x2f09ba['query']);_0x11a8f1[_0x5918('0x2f')]=_[_0x5918('0x30')](_0x11a8f1[_0x5918('0x2c')],_0x11a8f1[_0x5918('0x2e')]);_0x1293e9[_0x5918('0x31')]=_[_0x5918('0x30')](_0x11a8f1[_0x5918('0x2c')],qs[_0x5918('0x32')](_0x2f09ba[_0x5918('0x2e')][_0x5918('0x32')]));_0x1293e9[_0x5918('0x31')]=_0x1293e9[_0x5918('0x31')]['length']?_0x1293e9[_0x5918('0x31')]:_0x11a8f1['model'];if(!_0x2f09ba['query'][_0x5918('0x41')]('nolimit')){_0x1293e9[_0x5918('0x18')]=qs[_0x5918('0x18')](_0x2f09ba['query']['limit']);_0x1293e9[_0x5918('0x15')]=qs[_0x5918('0x15')](_0x2f09ba['query'][_0x5918('0x15')]);}_0x1293e9[_0x5918('0x42')]=qs[_0x5918('0x43')](_0x2f09ba[_0x5918('0x2e')][_0x5918('0x43')]);_0x1293e9[_0x5918('0x44')]=qs[_0x5918('0x2f')](_[_0x5918('0x45')](_0x2f09ba['query'],_0x11a8f1['filters']));_0x1293e9[_0x5918('0x44')][_0x5918('0x46')]=_0x1bdeb0['id'];if(_0x2f09ba[_0x5918('0x2e')][_0x5918('0x47')]){_0x1293e9['where']=_[_0x5918('0x35')](_0x1293e9['where'],{'$or':_['map'](_0x1293e9['attributes'],function(_0x3a12f9){var _0x4f90e6={};_0x4f90e6[_0x3a12f9]={'$like':'%'+_0x2f09ba[_0x5918('0x2e')][_0x5918('0x47')]+'%'};return _0x4f90e6;})});}if(_0x2f09ba[_0x5918('0x2e')]['$gte']){var _0x5c233f=_0x2f09ba[_0x5918('0x2e')][_0x5918('0x48')][_0x5918('0x49')](',');var _0x1afa9a={};_0x1afa9a[_0x5c233f[0x0]]={'$gte':moment(_0x5c233f[0x1])[_0x5918('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1293e9[_0x5918('0x44')]=_[_0x5918('0x35')](_0x1293e9[_0x5918('0x44')],_0x1afa9a);}_0x1293e9=_[_0x5918('0x35')]({},_0x1293e9,_0x2f09ba['options']);return db['WhatsappMessage'][_0x5918('0x17')]({'where':_0x1293e9[_0x5918('0x44')]})[_0x5918('0x1d')](function(_0x4a4284){_0x4d961b['count']=_0x4a4284;if(_0x2f09ba[_0x5918('0x2e')][_0x5918('0x34')]){_0x1293e9['include']=[{'all':!![]}];}return db[_0x5918('0x3b')][_0x5918('0x27')](_0x1293e9);})['then'](function(_0x3ab434){_0x4d961b['rows']=_0x3ab434;return _0x4d961b;});}})[_0x5918('0x1d')](respondWithFilteredResult(_0x330df0,_0x1293e9))[_0x5918('0x29')](handleError(_0x330df0,null));};exports[_0x5918('0x4b')]=function(_0x309e36,_0x35e8cc){return db[_0x5918('0x2d')]['find']({'where':{'id':_0x309e36[_0x5918('0x2b')]['id']}})[_0x5918('0x1d')](handleEntityNotFound(_0x35e8cc,null))[_0x5918('0x1d')](function(_0x3c3ddb){if(_0x3c3ddb){return _0x3c3ddb[_0x5918('0x4c')](_0x309e36[_0x5918('0x3c')]['ids'],_[_0x5918('0x4d')](_0x309e36[_0x5918('0x3c')],[_0x5918('0x3d'),'id'])||{})[_0x5918('0x4e')](function(){return db[_0x5918('0x4f')][_0x5918('0x27')]({'attributes':['id',_0x5918('0x21'),'color'],'where':{'id':_0x309e36['body'][_0x5918('0x3d')]}});})[_0x5918('0x1d')](function(_0x375c2c){socket[_0x5918('0x50')](_0x5918('0x51'),{'id':Number(_0x309e36[_0x5918('0x2b')]['id']),'tags':_0x375c2c||[]});return{'id':Number(_0x309e36['params']['id']),'tags':_0x375c2c||[]};});}})['then'](respondWithResult(_0x35e8cc,null))[_0x5918('0x29')](handleError(_0x35e8cc,null));};exports[_0x5918('0x52')]=function(_0x4295fc,_0x32359d){return db[_0x5918('0x2d')][_0x5918('0x38')]({'where':{'id':_0x4295fc[_0x5918('0x2b')]['id']}})[_0x5918('0x1d')](handleEntityNotFound(_0x32359d,null))[_0x5918('0x1d')](function(_0x33bd26){if(_0x33bd26){return _0x33bd26[_0x5918('0x52')](_0x4295fc[_0x5918('0x2e')][_0x5918('0x3d')]);}})[_0x5918('0x1d')](respondWithStatusCode(_0x32359d,null))['catch'](handleError(_0x32359d,null));};exports[_0x5918('0x53')]=function(_0x32b829,_0x177ed8){var _0x5b84be=moment()['unix']()['toString']();var _0x1c33b9=path['join'](config['root'],'server',_0x5918('0x54'),'tmp');var _0x307266=path[_0x5918('0x55')](config[_0x5918('0x56')],_0x5918('0x57'),_0x5918('0x54'),_0x5918('0x58'));var _0x2e6cd9=path[_0x5918('0x55')](_0x1c33b9,_0x5b84be);var _0x2cf30e=util['format'](_0x5918('0x59'),_0x32b829[_0x5918('0x2b')]['id'],_0x5b84be);var _0x48e73b=path['join'](_0x1c33b9,_0x2cf30e);var _0x3cef6c=[];_0x3cef6c[_0x5918('0x5a')]({'model':db[_0x5918('0x5b')],'as':_0x5918('0x5b'),'attributes':['id',_0x5918('0x5c')],'raw':!![]});_0x3cef6c[_0x5918('0x5a')]({'model':db[_0x5918('0x5d')],'as':_0x5918('0x5e'),'attributes':['id',_0x5918('0x5f'),_0x5918('0x60')],'raw':!![]});if(_0x32b829[_0x5918('0x2e')][_0x5918('0x58')]){_0x3cef6c[_0x5918('0x5a')]({'model':db[_0x5918('0x61')],'as':_0x5918('0x61'),'raw':!![]});}var _0x57f1b2=[{'model':db[_0x5918('0x3b')],'as':_0x5918('0x62'),'attributes':['id','body',_0x5918('0x63'),_0x5918('0x64'),_0x5918('0x65'),_0x5918('0x66')],'include':_0x3cef6c}];_0x57f1b2[_0x5918('0x5a')]({'model':db['WhatsappAccount'],'as':_0x5918('0x67'),'attributes':['id',_0x5918('0x21')]});_0x57f1b2[_0x5918('0x5a')]({'model':db[_0x5918('0x5b')],'as':_0x5918('0x68'),'attributes':['id',_0x5918('0x5c')]});return db[_0x5918('0x2d')]['find']({'where':{'id':_0x32b829['params']['id']},'include':_0x57f1b2})['then'](handleEntityNotFound(_0x177ed8,null))['then'](function(_0x4a912c){if(_0x4a912c){var _0x2a3a72=_0x4a912c[_0x5918('0x69')]({'plain':!![]});fs[_0x5918('0x6a')](_0x2e6cd9);var _0x156e93={'channel':_0x5918('0x6b'),'account':_0x2a3a72[_0x5918('0x67')][_0x5918('0x21')],'agent':_0x2a3a72[_0x5918('0x68')]?_0x2a3a72['Owner']['fullname']:_0x5918('0x6c'),'createdAt':moment(_0x2a3a72[_0x5918('0x63')])[_0x5918('0x4a')](_0x5918('0x6d'))['toString'](),'closedAt':_0x2a3a72[_0x5918('0x6e')]?moment(_0x2a3a72[_0x5918('0x6f')])[_0x5918('0x4a')](_0x5918('0x6d'))['toString']():'','disposition':_0x2a3a72['disposition'],'messages':_(_0x2a3a72[_0x5918('0x62')])[_0x5918('0x47')]({'secret':![]})['map'](function(_0x53c4ef){if(_0x53c4ef[_0x5918('0x61')]){var _0x3fbc5d=path['join'](_0x307266,_0x53c4ef['Attachment'][_0x5918('0x70')]);if(fs['existsSync'](_0x3fbc5d)){fs['createReadStream'](_0x3fbc5d)[_0x5918('0x71')](fs[_0x5918('0x72')](path[_0x5918('0x55')](_0x2e6cd9,_0x53c4ef['Attachment'][_0x5918('0x70')])));}}return{'date':moment(_0x53c4ef['createdAt'])[_0x5918('0x4a')](_0x5918('0x6d'))[_0x5918('0x73')](),'sender':_0x53c4ef['direction']===_0x5918('0x74')?_0x53c4ef['User']?_0x53c4ef[_0x5918('0x5b')][_0x5918('0x5c')]:'System':_0x53c4ef[_0x5918('0x5e')][_0x5918('0x5f')]+(_0x53c4ef[_0x5918('0x5e')][_0x5918('0x60')]?'\x20'+_0x53c4ef['Contact'][_0x5918('0x60')]:''),'body':_0x53c4ef[_0x5918('0x61')]?_0x53c4ef['Attachment'][_0x5918('0x70')]:_0x53c4ef[_0x5918('0x3c')],'direction':_0x53c4ef['direction']==='out'?'A':'C','secret':_0x53c4ef['secret'],'read':_0x53c4ef[_0x5918('0x66')],'attachment':_0x53c4ef['Attachment']};})[_0x5918('0x75')]()};return ejs['renderFile'](path[_0x5918('0x55')](config['root'],'server','views',_0x5918('0x76')),{'interaction':_0x156e93})['then'](function(_0x4fbb9e){var _0x58ad0e=path['join'](_0x2e6cd9,_0x5918('0x77')+_0x2a3a72['id']+'-'+_0x5b84be+_0x5918('0x78'));var _0x45dd94={'path':_0x58ad0e,'channel':'Whatsapp','interactionId':_0x2a3a72['id']};return pdf[_0x5918('0x79')](_0x4fbb9e,_0x45dd94);})[_0x5918('0x1d')](function(){return new BPromise(function(_0x1f4b01,_0x2bac5c){zipdir(_0x2e6cd9,{'saveTo':_0x48e73b},function(_0x3d8c1b,_0x2039b8){if(_0x3d8c1b)return _0x2bac5c(_0x3d8c1b);return _0x1f4b01(_0x2039b8);});})[_0x5918('0x1d')](function(){return new BPromise(function(_0xc42b9d,_0x3d2bf4){rimraf(_0x2e6cd9,function(_0x2d0561){if(_0x2d0561)_0x3d2bf4(_0x2d0561);return _0xc42b9d();});});})[_0x5918('0x1d')](function(){return _0x177ed8[_0x5918('0x53')](_0x48e73b,_0x2cf30e,function(_0x846ce2){if(_0x846ce2){console[_0x5918('0x7a')]('err',_0x846ce2);}else{fs[_0x5918('0x7b')](_0x48e73b);}});});});}else{return _0x177ed8[_0x5918('0x12')](0xc8);}})[_0x5918('0x29')](handleError(_0x177ed8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 43a2baf..b7601b7 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 _0xee11=['findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x24ab07,_0x55c21b){var _0x3c76fa=function(_0x21f05b){while(--_0x21f05b){_0x24ab07['push'](_0x24ab07['shift']());}};_0x3c76fa(++_0x55c21b);}(_0xee11,0x146));var _0x1ee1=function(_0x3e3f8b,_0x98ea26){_0x3e3f8b=_0x3e3f8b-0x0;var _0x354e47=_0xee11[_0x3e3f8b];return _0x354e47;};'use strict';var EventEmitter=require(_0x1ee1('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x1ee1('0x1'))['db'][_0x1ee1('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1ee1('0x3')](0x0);var events={'afterCreate':_0x1ee1('0x4'),'afterUpdate':_0x1ee1('0x5'),'afterDestroy':_0x1ee1('0x6')};function emitEvent(_0x3eb96f){return function(_0x3990df,_0x517892,_0x1322a7){_0x3990df[_0x1ee1('0x7')]({'attributes':['id'],'raw':!![]})[_0x1ee1('0x8')](function(_0x289d4c){_0x3990df[_0x1ee1('0x9')]('Users',_0x289d4c['map'](function(_0x3ae411){return{'id':_0x3ae411['id']};}));return WhatsappMessage[_0x1ee1('0xa')]({'where':{'WhatsappInteractionId':_0x3990df['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1ee1('0x8')](function(_0x3bd418){_0x3990df['setDataValue'](_0x1ee1('0xb'),_0x3bd418['length']);WhatsappInteractionEvents[_0x1ee1('0xc')](_0x3eb96f+':'+_0x3990df['id'],_0x3990df);WhatsappInteractionEvents[_0x1ee1('0xc')](_0x3eb96f,_0x3990df);_0x1322a7(null);})[_0x1ee1('0xd')](_0x1322a7(null));};}for(var e in events){if(events[_0x1ee1('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x1ee1('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7035=['../../mysqldb','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7035,0x15e));var _0x5703=function(_0x4eb116,_0x5903ed){_0x4eb116=_0x4eb116-0x0;var _0x33f733=_0x7035[_0x4eb116];return _0x33f733;};'use strict';var EventEmitter=require(_0x5703('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x5703('0x1')];var WhatsappMessage=require(_0x5703('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5703('0x3')](0x0);var events={'afterCreate':_0x5703('0x4'),'afterUpdate':_0x5703('0x5'),'afterDestroy':_0x5703('0x6')};function emitEvent(_0x7e0ebb){return function(_0x5939bc,_0x37b0c8,_0x3fd6a6){_0x5939bc['getUsers']({'attributes':['id'],'raw':!![]})[_0x5703('0x7')](function(_0x1b1ee9){_0x5939bc[_0x5703('0x8')](_0x5703('0x9'),_0x1b1ee9[_0x5703('0xa')](function(_0x4690de){return{'id':_0x4690de['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x5939bc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x169e83){_0x5939bc['setDataValue'](_0x5703('0xb'),_0x169e83['length']);WhatsappInteractionEvents['emit'](_0x7e0ebb+':'+_0x5939bc['id'],_0x5939bc);WhatsappInteractionEvents[_0x5703('0xc')](_0x7e0ebb,_0x5939bc);_0x3fd6a6(null);})[_0x5703('0xd')](_0x3fd6a6(null));};}for(var e in events){if(events[_0x5703('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x5703('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 5686017..c4aa616 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 _0x00f4=['define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x4baa9b,_0x423046){var _0x446740=function(_0x4eaf86){while(--_0x4eaf86){_0x4baa9b['push'](_0x4baa9b['shift']());}};_0x446740(++_0x423046);}(_0x00f4,0x137));var _0x400f=function(_0x8bf06,_0x791b7e){_0x8bf06=_0x8bf06-0x0;var _0xde4556=_0x00f4[_0x8bf06];return _0xde4556;};'use strict';var _=require(_0x400f('0x0'));var util=require('util');var logger=require(_0x400f('0x1'))(_0x400f('0x2'));var moment=require(_0x400f('0x3'));var BPromise=require(_0x400f('0x4'));var rp=require(_0x400f('0x5'));var fs=require('fs');var path=require(_0x400f('0x6'));var rimraf=require(_0x400f('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x400f('0x8')]=function(_0x4b5171,_0x119326){return _0x4b5171[_0x400f('0x9')](_0x400f('0xa'),attributes,{'tableName':_0x400f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32a24e,_0x3e2cfb,_0x3c50b4){if(_0x32a24e['changed'](_0x400f('0xc'))){_0x32a24e[_0x400f('0xd')]=moment()[_0x400f('0xe')](_0x400f('0xf'));}_0x3c50b4(null,_0x32a24e);}}});}; \ No newline at end of file +var _0xe443=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_interactions','changed','closed','closedAt','lodash','util'];(function(_0x3d6a03,_0xe45f69){var _0x3a31b8=function(_0x59e424){while(--_0x59e424){_0x3d6a03['push'](_0x3d6a03['shift']());}};_0x3a31b8(++_0xe45f69);}(_0xe443,0xee));var _0x3e44=function(_0x22ce75,_0x2a36c3){_0x22ce75=_0x22ce75-0x0;var _0x120066=_0xe443[_0x22ce75];return _0x120066;};'use strict';var _=require(_0x3e44('0x0'));var util=require(_0x3e44('0x1'));var logger=require(_0x3e44('0x2'))(_0x3e44('0x3'));var moment=require(_0x3e44('0x4'));var BPromise=require(_0x3e44('0x5'));var rp=require(_0x3e44('0x6'));var fs=require('fs');var path=require(_0x3e44('0x7'));var rimraf=require(_0x3e44('0x8'));var config=require(_0x3e44('0x9'));var attributes=require('./whatsappInteraction.attributes');module[_0x3e44('0xa')]=function(_0x22bf45,_0x5f1135){return _0x22bf45[_0x3e44('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x3e44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x115c79,_0x26d0aa,_0x2adb99){if(_0x115c79[_0x3e44('0xd')](_0x3e44('0xe'))){_0x115c79[_0x3e44('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2adb99(null,_0x115c79);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0e70723..b4f3623 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 _0x6eae=['AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','limit','then','debug','catch'];(function(_0x4fa19e,_0x255766){var _0x510b65=function(_0x1a1c59){while(--_0x1a1c59){_0x4fa19e['push'](_0x4fa19e['shift']());}};_0x510b65(++_0x255766);}(_0x6eae,0x195));var _0xe6ea=function(_0x3fe1a1,_0x4af32e){_0x3fe1a1=_0x3fe1a1-0x0;var _0x447836=_0x6eae[_0x3fe1a1];return _0x447836;};'use strict';var _=require('lodash');var util=require(_0xe6ea('0x0'));var moment=require(_0xe6ea('0x1'));var BPromise=require(_0xe6ea('0x2'));var rs=require(_0xe6ea('0x3'));var fs=require('fs');var Redis=require(_0xe6ea('0x4'));var db=require(_0xe6ea('0x5'))['db'];var utils=require(_0xe6ea('0x6'));var logger=require(_0xe6ea('0x7'))(_0xe6ea('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6ea('0x9'));var client=jayson[_0xe6ea('0xa')][_0xe6ea('0xb')]({'port':0x232a});config[_0xe6ea('0xc')]=_[_0xe6ea('0xd')](config['redis'],{'host':_0xe6ea('0xe'),'port':0x18eb});var socket=require(_0xe6ea('0xf'))(new Redis(config[_0xe6ea('0xc')]));require('./whatsappInteraction.socket')[_0xe6ea('0x10')](socket);function respondWithRpcPromise(_0x19e6a9,_0x5f1cf0,_0x1cfc79){return new BPromise(function(_0xeb084c,_0x51efcd){return client[_0xe6ea('0x11')](_0x19e6a9,_0x1cfc79)['then'](function(_0x542d6e){logger[_0xe6ea('0x12')](_0xe6ea('0x13'),_0x5f1cf0,_0xe6ea('0x14'));logger['debug'](_0xe6ea('0x15'),_0x5f1cf0,_0xe6ea('0x14'),JSON[_0xe6ea('0x16')](_0x542d6e));if(_0x542d6e[_0xe6ea('0x17')]){if(_0x542d6e[_0xe6ea('0x17')][_0xe6ea('0x18')]===0x1f4){logger[_0xe6ea('0x17')](_0xe6ea('0x13'),_0x5f1cf0,_0x542d6e[_0xe6ea('0x17')][_0xe6ea('0x19')]);return _0x51efcd(_0x542d6e['error'][_0xe6ea('0x19')]);}logger[_0xe6ea('0x17')](_0xe6ea('0x13'),_0x5f1cf0,_0x542d6e['error'][_0xe6ea('0x19')]);return _0xeb084c(_0x542d6e[_0xe6ea('0x17')][_0xe6ea('0x19')]);}else{logger[_0xe6ea('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5f1cf0,_0xe6ea('0x14'));_0xeb084c(_0x542d6e[_0xe6ea('0x1a')][_0xe6ea('0x19')]);}})['catch'](function(_0x50b78c){logger[_0xe6ea('0x17')](_0xe6ea('0x13'),_0x5f1cf0,_0x50b78c);_0x51efcd(_0x50b78c);});});}exports[_0xe6ea('0x1b')]=function(_0x3289f6){var _0x35a929=this;return new Promise(function(_0x341721,_0x3f01b6){return db['WhatsappInteraction'][_0xe6ea('0x1c')](_0x3289f6[_0xe6ea('0x1d')],{'raw':_0x3289f6['options']?_0x3289f6[_0xe6ea('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3289f6[_0xe6ea('0x1e')]?_0x3289f6['options']['where']||null:null,'attributes':_0x3289f6[_0xe6ea('0x1e')]?_0x3289f6[_0xe6ea('0x1e')]['attributes']||null:null,'limit':_0x3289f6[_0xe6ea('0x1e')]?_0x3289f6[_0xe6ea('0x1e')][_0xe6ea('0x1f')]||null:null})[_0xe6ea('0x20')](function(_0x4a8fcf){logger['info'](_0xe6ea('0x1b'),_0x3289f6);logger[_0xe6ea('0x21')](_0xe6ea('0x1b'),_0x3289f6,JSON[_0xe6ea('0x16')](_0x4a8fcf));_0x341721(_0x4a8fcf);})[_0xe6ea('0x22')](function(_0x1d5e8b){logger[_0xe6ea('0x17')]('UpdateWhatsappInteraction',_0x1d5e8b[_0xe6ea('0x19')],_0x3289f6);_0x3f01b6(_0x35a929[_0xe6ea('0x17')](0x1f4,_0x1d5e8b['message']));});});};exports[_0xe6ea('0x23')]=function(_0x2c9ceb){return new Promise(function(_0x50b6bd,_0x426761){return db[_0xe6ea('0x24')][_0xe6ea('0x25')]({'where':_0x2c9ceb[_0xe6ea('0x1e')]?_0x2c9ceb[_0xe6ea('0x1e')][_0xe6ea('0x26')]||null:null})['then'](function(_0x9703c0){if(_0x9703c0){return _0x9703c0[_0xe6ea('0x27')](_0x2c9ceb[_0xe6ea('0x1d')][_0xe6ea('0x28')],_[_0xe6ea('0x29')](_0x2c9ceb[_0xe6ea('0x1d')],[_0xe6ea('0x28'),'id'])||{});}})[_0xe6ea('0x2a')](function(_0x36a7f8){logger[_0xe6ea('0x12')](_0xe6ea('0x2b'),_0x2c9ceb);logger['debug']('AddTags',_0x2c9ceb,JSON[_0xe6ea('0x16')](_0x36a7f8));_0x50b6bd(_0x36a7f8);})[_0xe6ea('0x22')](function(_0x3be2e9){logger['error'](_0xe6ea('0x2b'),_0x3be2e9[_0xe6ea('0x19')],_0x2c9ceb);_0x426761(_this['error'](0x1f4,_0x3be2e9[_0xe6ea('0x19')]));});});}; \ No newline at end of file +var _0x39f1=['error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4930c0,_0x124eee){var _0x18137c=function(_0x47aaf5){while(--_0x47aaf5){_0x4930c0['push'](_0x4930c0['shift']());}};_0x18137c(++_0x124eee);}(_0x39f1,0xd3));var _0x139f=function(_0x4dfedb,_0x21222a){_0x4dfedb=_0x4dfedb-0x0;var _0x4dcf7e=_0x39f1[_0x4dfedb];return _0x4dcf7e;};'use strict';var _=require('lodash');var util=require(_0x139f('0x0'));var moment=require(_0x139f('0x1'));var BPromise=require('bluebird');var rs=require(_0x139f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x139f('0x3'))['db'];var utils=require(_0x139f('0x4'));var logger=require(_0x139f('0x5'))(_0x139f('0x6'));var config=require('../../config/environment');var jayson=require(_0x139f('0x7'));var client=jayson[_0x139f('0x8')][_0x139f('0x9')]({'port':0x232a});config[_0x139f('0xa')]=_[_0x139f('0xb')](config[_0x139f('0xa')],{'host':_0x139f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x139f('0xa')]));require(_0x139f('0xd'))[_0x139f('0xe')](socket);function respondWithRpcPromise(_0x4ce5fe,_0x1c605b,_0x377572){return new BPromise(function(_0x296d03,_0x353937){return client[_0x139f('0xf')](_0x4ce5fe,_0x377572)[_0x139f('0x10')](function(_0x1bc329){logger[_0x139f('0x11')](_0x139f('0x12'),_0x1c605b,_0x139f('0x13'));logger[_0x139f('0x14')](_0x139f('0x15'),_0x1c605b,_0x139f('0x13'),JSON[_0x139f('0x16')](_0x1bc329));if(_0x1bc329['error']){if(_0x1bc329['error']['code']===0x1f4){logger[_0x139f('0x17')](_0x139f('0x12'),_0x1c605b,_0x1bc329[_0x139f('0x17')]['message']);return _0x353937(_0x1bc329['error'][_0x139f('0x18')]);}logger[_0x139f('0x17')](_0x139f('0x12'),_0x1c605b,_0x1bc329['error'][_0x139f('0x18')]);return _0x296d03(_0x1bc329[_0x139f('0x17')][_0x139f('0x18')]);}else{logger[_0x139f('0x11')](_0x139f('0x12'),_0x1c605b,_0x139f('0x13'));_0x296d03(_0x1bc329[_0x139f('0x19')]['message']);}})['catch'](function(_0x48e90e){logger['error'](_0x139f('0x12'),_0x1c605b,_0x48e90e);_0x353937(_0x48e90e);});});}exports[_0x139f('0x1a')]=function(_0x578a93){var _0x50c6ff=this;return new Promise(function(_0x186e9b,_0x3893a5){return db[_0x139f('0x1b')][_0x139f('0x1c')](_0x578a93[_0x139f('0x1d')],{'raw':_0x578a93[_0x139f('0x1e')]?_0x578a93[_0x139f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578a93[_0x139f('0x1e')]?_0x578a93[_0x139f('0x1e')]['where']||null:null,'attributes':_0x578a93[_0x139f('0x1e')]?_0x578a93[_0x139f('0x1e')][_0x139f('0x1f')]||null:null,'limit':_0x578a93['options']?_0x578a93[_0x139f('0x1e')]['limit']||null:null})[_0x139f('0x10')](function(_0x20e371){logger[_0x139f('0x11')]('UpdateWhatsappInteraction',_0x578a93);logger['debug']('UpdateWhatsappInteraction',_0x578a93,JSON['stringify'](_0x20e371));_0x186e9b(_0x20e371);})['catch'](function(_0x29f852){logger['error'](_0x139f('0x1a'),_0x29f852[_0x139f('0x18')],_0x578a93);_0x3893a5(_0x50c6ff[_0x139f('0x17')](0x1f4,_0x29f852[_0x139f('0x18')]));});});};exports[_0x139f('0x20')]=function(_0xb80721){return new Promise(function(_0x46e5c3,_0x5b2a3a){return db['WhatsappInteraction']['find']({'where':_0xb80721[_0x139f('0x1e')]?_0xb80721['options'][_0x139f('0x21')]||null:null})['then'](function(_0x368e2b){if(_0x368e2b){return _0x368e2b[_0x139f('0x22')](_0xb80721[_0x139f('0x1d')][_0x139f('0x23')],_[_0x139f('0x24')](_0xb80721[_0x139f('0x1d')],[_0x139f('0x23'),'id'])||{});}})[_0x139f('0x25')](function(_0x145571){logger[_0x139f('0x11')]('AddTags',_0xb80721);logger[_0x139f('0x14')]('AddTags',_0xb80721,JSON['stringify'](_0x145571));_0x46e5c3(_0x145571);})['catch'](function(_0x3008da){logger[_0x139f('0x17')](_0x139f('0x26'),_0x3008da[_0x139f('0x18')],_0xb80721);_0x5b2a3a(_this[_0x139f('0x17')](0x1f4,_0x3008da[_0x139f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7dddaad..cd998e0 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 _0x1b06=['remove','update','removeListener','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1b06,0x18b));var _0x61b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b06[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require(_0x61b0('0x0'));var events=['save',_0x61b0('0x1'),_0x61b0('0x2')];function createListener(_0x26eb70,_0x2c7c85){return function(_0x246082){_0x2c7c85['emit'](_0x26eb70,_0x246082);};}function removeListener(_0x403155,_0x8ad716){return function(){WhatsappInteractionEvents[_0x61b0('0x3')](_0x403155,_0x8ad716);};}exports['register']=function(_0xd6438a){for(var _0xb06c8f=0x0,_0xe65893=events[_0x61b0('0x4')];_0xb06c8f<_0xe65893;_0xb06c8f++){var _0x31742c=events[_0xb06c8f];var _0x2c8cd0=createListener(_0x61b0('0x5')+_0x31742c,_0xd6438a);WhatsappInteractionEvents['on'](_0x31742c,_0x2c8cd0);}}; \ No newline at end of file +var _0x88f1=['update','emit','removeListener','length','whatsappInteraction:','save','remove'];(function(_0x2972da,_0x4c7efe){var _0x935b68=function(_0x5b6575){while(--_0x5b6575){_0x2972da['push'](_0x2972da['shift']());}};_0x935b68(++_0x4c7efe);}(_0x88f1,0x147));var _0x188f=function(_0x427b73,_0x48914d){_0x427b73=_0x427b73-0x0;var _0x575ec0=_0x88f1[_0x427b73];return _0x575ec0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x188f('0x0'),_0x188f('0x1'),_0x188f('0x2')];function createListener(_0x33b18c,_0x27d878){return function(_0x5bc70c){_0x27d878[_0x188f('0x3')](_0x33b18c,_0x5bc70c);};}function removeListener(_0x51fdd0,_0x160880){return function(){WhatsappInteractionEvents[_0x188f('0x4')](_0x51fdd0,_0x160880);};}exports['register']=function(_0x5a6876){for(var _0x5af700=0x0,_0x4f8fbf=events[_0x188f('0x5')];_0x5af700<_0x4f8fbf;_0x5af700++){var _0x5c935b=events[_0x5af700];var _0x2041ca=createListener(_0x188f('0x6')+_0x5c935b,_0x5a6876);WhatsappInteractionEvents['on'](_0x5c935b,_0x2041ca);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5fe89bd..0bcd634 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 _0x7511=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','whatsappmessage:create','put','/:id','update','/:id/accept','accept','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7511,0xea));var _0x1751=function(_0x26ec1c,_0x274d1b){_0x26ec1c=_0x26ec1c-0x0;var _0x3759c0=_0x7511[_0x26ec1c];return _0x3759c0;};'use strict';var multer=require(_0x1751('0x0'));var util=require(_0x1751('0x1'));var path=require(_0x1751('0x2'));var timeout=require(_0x1751('0x3'));var express=require(_0x1751('0x4'));var router=express[_0x1751('0x5')]();var fs_extra=require(_0x1751('0x6'));var auth=require(_0x1751('0x7'));var interaction=require(_0x1751('0x8'));var config=require(_0x1751('0x9'));var controller=require(_0x1751('0xa'));router[_0x1751('0xb')]('/',auth[_0x1751('0xc')](),controller[_0x1751('0xd')]);router[_0x1751('0xb')](_0x1751('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x1751('0xb')]('/:id',auth[_0x1751('0xc')](),controller[_0x1751('0xf')]);router[_0x1751('0x10')]('/',auth['isAuthenticated'](),interaction[_0x1751('0x11')]('whatsapp',_0x1751('0x12')),controller['create']);router[_0x1751('0x10')]('/:id/status',controller['status']);router[_0x1751('0x13')](_0x1751('0x14'),auth['isAuthenticated'](),controller[_0x1751('0x15')]);router['put'](_0x1751('0x16'),auth[_0x1751('0xc')](),controller[_0x1751('0x17')]);router[_0x1751('0x13')]('/:id/reject',auth[_0x1751('0xc')](),controller[_0x1751('0x18')]);router[_0x1751('0x19')](_0x1751('0x14'),auth[_0x1751('0xc')](),controller['destroy']);module[_0x1751('0x1a')]=router; \ No newline at end of file +var _0xb526=['/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','update','put'];(function(_0x105ede,_0x6ecf){var _0x4993fb=function(_0x568cba){while(--_0x568cba){_0x105ede['push'](_0x105ede['shift']());}};_0x4993fb(++_0x6ecf);}(_0xb526,0x19a));var _0x6b52=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xb526[_0x47b15f];return _0x55bf25;};'use strict';var multer=require(_0x6b52('0x0'));var util=require(_0x6b52('0x1'));var path=require(_0x6b52('0x2'));var timeout=require(_0x6b52('0x3'));var express=require(_0x6b52('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b52('0x5'));var config=require(_0x6b52('0x6'));var controller=require(_0x6b52('0x7'));router[_0x6b52('0x8')]('/',auth[_0x6b52('0x9')](),controller[_0x6b52('0xa')]);router[_0x6b52('0x8')](_0x6b52('0xb'),auth[_0x6b52('0x9')](),controller[_0x6b52('0xc')]);router[_0x6b52('0x8')](_0x6b52('0xd'),auth[_0x6b52('0x9')](),controller[_0x6b52('0xe')]);router[_0x6b52('0xf')]('/',auth[_0x6b52('0x9')](),interaction[_0x6b52('0x10')](_0x6b52('0x11'),_0x6b52('0x12')),controller['create']);router[_0x6b52('0xf')](_0x6b52('0x13'),controller['status']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6b52('0x14')]);router[_0x6b52('0x15')](_0x6b52('0x16'),auth[_0x6b52('0x9')](),controller['accept']);router[_0x6b52('0x15')](_0x6b52('0x17'),auth[_0x6b52('0x9')](),controller['reject']);router[_0x6b52('0x18')](_0x6b52('0xd'),auth['isAuthenticated'](),controller[_0x6b52('0x19')]);module[_0x6b52('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c7efaa4..51dbf39 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 _0xadb2=['BOOLEAN','out','STRING','DATE','exports','TEXT','medium'];(function(_0x502ca3,_0x36be36){var _0x27f42c=function(_0x1e3045){while(--_0x1e3045){_0x502ca3['push'](_0x502ca3['shift']());}};_0x27f42c(++_0x36be36);}(_0xadb2,0xf2));var _0x2adb=function(_0x17d77d,_0x571a4a){_0x17d77d=_0x17d77d-0x0;var _0x197ddf=_0xadb2[_0x17d77d];return _0x197ddf;};'use strict';var Sequelize=require('sequelize');module[_0x2adb('0x0')]={'body':{'type':Sequelize[_0x2adb('0x1')](_0x2adb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2adb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2adb('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2adb('0x5')]},'readAt':{'type':Sequelize[_0x2adb('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2adb('0x5')]},'providerResponse':{'type':Sequelize[_0x2adb('0x1')]}}; \ No newline at end of file +var _0x2c7b=['exports','medium','BOOLEAN','out','STRING','DATE','TEXT','sequelize'];(function(_0x4565eb,_0x167f79){var _0x67832=function(_0x5322ff){while(--_0x5322ff){_0x4565eb['push'](_0x4565eb['shift']());}};_0x67832(++_0x167f79);}(_0x2c7b,0x1af));var _0xb2c7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x2c7b[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xb2c7('0x0'));module[_0xb2c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb2c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb2c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb2c7('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb2c7('0x5')](0xbe)},'phone':{'type':Sequelize[_0xb2c7('0x5')]},'readAt':{'type':Sequelize[_0xb2c7('0x6')]},'secret':{'type':Sequelize[_0xb2c7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb2c7('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index aacddbd..aa06e85 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 _0xcc29=['User','fullname','email','internal','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappMessage','findAll','rows','show','create','body','find','params','describe','../../config/logger','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact'];(function(_0x51dc24,_0xc53ce0){var _0x32c31e=function(_0x1d86ce){while(--_0x1d86ce){_0x51dc24['push'](_0x51dc24['shift']());}};_0x32c31e(++_0xc53ce0);}(_0xcc29,0x1bb));var _0x9cc2=function(_0x12eb15,_0xc9a9a3){_0x12eb15=_0x12eb15-0x0;var _0x400009=_0xcc29[_0x12eb15];return _0x400009;};'use strict';var emlformat=require(_0x9cc2('0x0'));var rimraf=require(_0x9cc2('0x1'));var zipdir=require(_0x9cc2('0x2'));var jsonpatch=require(_0x9cc2('0x3'));var rp=require(_0x9cc2('0x4'));var moment=require(_0x9cc2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cc2('0x6'));var util=require('util');var path=require(_0x9cc2('0x7'));var sox=require(_0x9cc2('0x8'));var csv=require(_0x9cc2('0x9'));var ejs=require(_0x9cc2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cc2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9cc2('0x9'));var querystring=require(_0x9cc2('0xc'));var Papa=require(_0x9cc2('0xd'));var Redis=require(_0x9cc2('0xe'));var authService=require(_0x9cc2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9cc2('0x10'));var hardwareService=require(_0x9cc2('0x11'));var logger=require('../../config/logger')(_0x9cc2('0x12'));var utils=require(_0x9cc2('0x13'));var config=require(_0x9cc2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9cc2('0x15'))['db'];config[_0x9cc2('0x16')]=_[_0x9cc2('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9cc2('0x18'))(new Redis(config[_0x9cc2('0x16')]));require('./whatsappMessage.socket')[_0x9cc2('0x19')](socket);var jayson=require(_0x9cc2('0x1a'));var client=jayson[_0x9cc2('0x1b')][_0x9cc2('0x1c')]({'port':0x232c});var client9002=jayson[_0x9cc2('0x1b')][_0x9cc2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xaa712e,_0xf5afe0,_0x1f6950,_0xb8b4ca){return new BPromise(function(_0x5a6f98,_0x1e3f69){var _0xd246cb=_0xb8b4ca||client;return _0xd246cb[_0x9cc2('0x1d')](_0xaa712e,_0x1f6950)['then'](function(_0x2e0a22){logger[_0x9cc2('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0xf5afe0,_0x9cc2('0x1f'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf5afe0,_0x9cc2('0x1f'),JSON[_0x9cc2('0x20')](_0x2e0a22));if(_0x2e0a22[_0x9cc2('0x21')]){if(_0x2e0a22[_0x9cc2('0x21')][_0x9cc2('0x22')]===0x1f4){logger[_0x9cc2('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0xf5afe0,_0x2e0a22['error']['message']);return _0x1e3f69(_0x2e0a22[_0x9cc2('0x21')][_0x9cc2('0x23')]);}logger[_0x9cc2('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0xf5afe0,_0x2e0a22[_0x9cc2('0x21')]['message']);return _0x5a6f98(_0x2e0a22[_0x9cc2('0x21')][_0x9cc2('0x23')]);}else{logger['info'](_0x9cc2('0x24'),_0xf5afe0,_0x9cc2('0x1f'));_0x5a6f98(_0x2e0a22['result'][_0x9cc2('0x23')]);}})[_0x9cc2('0x25')](function(_0x3413a9){logger[_0x9cc2('0x21')](_0x9cc2('0x24'),_0xf5afe0,_0x3413a9);_0x1e3f69(_0x3413a9);});});}function respondWithStatusCode(_0x1fa4c2,_0x1a3860){_0x1a3860=_0x1a3860||0xcc;return function(_0x4d32d2){if(_0x4d32d2){return _0x1fa4c2['sendStatus'](_0x1a3860);}return _0x1fa4c2[_0x9cc2('0x26')](_0x1a3860)[_0x9cc2('0x27')]();};}function respondWithResult(_0x506b50,_0x193e8c){_0x193e8c=_0x193e8c||0xc8;return function(_0x49fcb4){if(_0x49fcb4){return _0x506b50['status'](_0x193e8c)[_0x9cc2('0x28')](_0x49fcb4);}};}function respondWithFilteredResult(_0x5d238f,_0x27b873){return function(_0x4d7857){if(_0x4d7857){var _0x54f683=typeof _0x27b873[_0x9cc2('0x29')]===_0x9cc2('0x2a')&&typeof _0x27b873[_0x9cc2('0x2b')]===_0x9cc2('0x2a');var _0x3ad369=_0x4d7857[_0x9cc2('0x2c')];var _0x507aa7=_0x54f683?0x0:_0x27b873[_0x9cc2('0x29')];var _0x2a967e=_0x54f683?_0x4d7857['count']:_0x27b873[_0x9cc2('0x29')]+_0x27b873[_0x9cc2('0x2b')];var _0x217e40;if(_0x2a967e>=_0x3ad369){_0x2a967e=_0x3ad369;_0x217e40=0xc8;}else{_0x217e40=0xce;}_0x5d238f[_0x9cc2('0x26')](_0x217e40);return _0x5d238f['set'](_0x9cc2('0x2d'),_0x507aa7+'-'+_0x2a967e+'/'+_0x3ad369)['json'](_0x4d7857);}return null;};}function patchUpdates(_0x36428f){return function(_0x60f89f){try{jsonpatch[_0x9cc2('0x2e')](_0x60f89f,_0x36428f,!![]);}catch(_0x2726a5){return BPromise[_0x9cc2('0x2f')](_0x2726a5);}return _0x60f89f[_0x9cc2('0x30')]();};}function saveUpdates(_0x8d2fb0,_0x21644e){return function(_0x4652ac){if(_0x4652ac){return _0x4652ac[_0x9cc2('0x31')](_0x8d2fb0)[_0x9cc2('0x32')](function(_0x3f34e3){return _0x3f34e3;});}return null;};}function removeEntity(_0x7afca3,_0x35d9a8){return function(_0x10ba82){if(_0x10ba82){return _0x10ba82['destroy']()[_0x9cc2('0x32')](function(){_0x7afca3[_0x9cc2('0x26')](0xcc)[_0x9cc2('0x27')]();});}};}function handleEntityNotFound(_0x333049,_0x1630bd){return function(_0x113ce0){if(!_0x113ce0){_0x333049[_0x9cc2('0x33')](0x194);}return _0x113ce0;};}function handleError(_0x45f398,_0x29d908){_0x29d908=_0x29d908||0x1f4;return function(_0xb665ce){logger[_0x9cc2('0x21')](_0xb665ce[_0x9cc2('0x34')]);if(_0xb665ce['name']){delete _0xb665ce['name'];}_0x45f398[_0x9cc2('0x26')](_0x29d908)[_0x9cc2('0x35')](_0xb665ce);};}exports[_0x9cc2('0x36')]=function(_0x547cda,_0x5e4241){var _0x49ba11={},_0x152e0c={},_0x3323bc={'count':0x0,'rows':[]};var _0x277544=_[_0x9cc2('0x37')](db['WhatsappMessage'][_0x9cc2('0x38')],function(_0x466a3b){return{'name':_0x466a3b[_0x9cc2('0x39')],'type':_0x466a3b[_0x9cc2('0x3a')][_0x9cc2('0x3b')]};});_0x152e0c[_0x9cc2('0x3c')]=_[_0x9cc2('0x37')](_0x277544,_0x9cc2('0x3d'));_0x152e0c[_0x9cc2('0x3e')]=_[_0x9cc2('0x3f')](_0x547cda[_0x9cc2('0x3e')]);_0x152e0c[_0x9cc2('0x40')]=_[_0x9cc2('0x41')](_0x152e0c[_0x9cc2('0x3c')],_0x152e0c[_0x9cc2('0x3e')]);_0x49ba11[_0x9cc2('0x42')]=_[_0x9cc2('0x41')](_0x152e0c['model'],qs[_0x9cc2('0x43')](_0x547cda['query'][_0x9cc2('0x43')]));_0x49ba11[_0x9cc2('0x42')]=_0x49ba11[_0x9cc2('0x42')][_0x9cc2('0x44')]?_0x49ba11[_0x9cc2('0x42')]:_0x152e0c[_0x9cc2('0x3c')];if(!_0x547cda[_0x9cc2('0x3e')][_0x9cc2('0x45')](_0x9cc2('0x46'))){_0x49ba11[_0x9cc2('0x2b')]=qs[_0x9cc2('0x2b')](_0x547cda[_0x9cc2('0x3e')]['limit']);_0x49ba11['offset']=qs[_0x9cc2('0x29')](_0x547cda[_0x9cc2('0x3e')]['offset']);}_0x49ba11['order']=qs[_0x9cc2('0x47')](_0x547cda[_0x9cc2('0x3e')][_0x9cc2('0x47')]);_0x49ba11[_0x9cc2('0x48')]=qs[_0x9cc2('0x40')](_[_0x9cc2('0x49')](_0x547cda[_0x9cc2('0x3e')],_0x152e0c['filters']),_0x277544);if(_0x547cda[_0x9cc2('0x3e')][_0x9cc2('0x4a')]){_0x49ba11[_0x9cc2('0x48')]=_[_0x9cc2('0x4b')](_0x49ba11[_0x9cc2('0x48')],{'$or':_[_0x9cc2('0x37')](_0x277544,function(_0x4ab6e9){if(_0x4ab6e9[_0x9cc2('0x3a')]!==_0x9cc2('0x4c')){var _0x542c9d={};_0x542c9d[_0x4ab6e9[_0x9cc2('0x3d')]]={'$like':'%'+_0x547cda[_0x9cc2('0x3e')][_0x9cc2('0x4a')]+'%'};return _0x542c9d;}})});}_0x49ba11=_[_0x9cc2('0x4b')]({},_0x49ba11,_0x547cda[_0x9cc2('0x4d')]);var _0x4ccff1={'where':_0x49ba11[_0x9cc2('0x48')]};return db['WhatsappMessage'][_0x9cc2('0x2c')](_0x4ccff1)[_0x9cc2('0x32')](function(_0x313868){_0x3323bc['count']=_0x313868;if(_0x547cda[_0x9cc2('0x3e')][_0x9cc2('0x4e')]){_0x49ba11[_0x9cc2('0x4f')]=[{'all':!![]}];}return db[_0x9cc2('0x50')][_0x9cc2('0x51')](_0x49ba11);})['then'](function(_0x1e756b){_0x3323bc[_0x9cc2('0x52')]=_0x1e756b;return _0x3323bc;})[_0x9cc2('0x32')](respondWithFilteredResult(_0x5e4241,_0x49ba11))['catch'](handleError(_0x5e4241,null));};exports[_0x9cc2('0x53')]=function(_0x7072e1,_0x5a8eee){var _0x60eaa2={'raw':!![],'where':{'id':_0x7072e1['params']['id']}},_0x68223c={};_0x68223c[_0x9cc2('0x3c')]=_[_0x9cc2('0x3f')](db[_0x9cc2('0x50')][_0x9cc2('0x38')]);_0x68223c[_0x9cc2('0x3e')]=_[_0x9cc2('0x3f')](_0x7072e1['query']);_0x68223c[_0x9cc2('0x40')]=_[_0x9cc2('0x41')](_0x68223c[_0x9cc2('0x3c')],_0x68223c[_0x9cc2('0x3e')]);_0x60eaa2[_0x9cc2('0x42')]=_[_0x9cc2('0x41')](_0x68223c['model'],qs[_0x9cc2('0x43')](_0x7072e1[_0x9cc2('0x3e')]['fields']));_0x60eaa2[_0x9cc2('0x42')]=_0x60eaa2[_0x9cc2('0x42')][_0x9cc2('0x44')]?_0x60eaa2[_0x9cc2('0x42')]:_0x68223c[_0x9cc2('0x3c')];if(_0x7072e1['query'][_0x9cc2('0x4e')]){_0x60eaa2[_0x9cc2('0x4f')]=[{'all':!![]}];}_0x60eaa2=_[_0x9cc2('0x4b')]({},_0x60eaa2,_0x7072e1['options']);return db[_0x9cc2('0x50')]['find'](_0x60eaa2)[_0x9cc2('0x32')](handleEntityNotFound(_0x5a8eee,null))['then'](respondWithResult(_0x5a8eee,null))[_0x9cc2('0x25')](handleError(_0x5a8eee,null));};exports['create']=function(_0x1f0004,_0x140a69){return db['WhatsappMessage'][_0x9cc2('0x54')](_0x1f0004[_0x9cc2('0x55')],{})[_0x9cc2('0x32')](respondWithResult(_0x140a69,0xc9))[_0x9cc2('0x25')](handleError(_0x140a69,null));};exports['update']=function(_0x49a082,_0x4aa1ec){if(_0x49a082[_0x9cc2('0x55')]['id']){delete _0x49a082['body']['id'];}return db[_0x9cc2('0x50')][_0x9cc2('0x56')]({'where':{'id':_0x49a082[_0x9cc2('0x57')]['id']}})[_0x9cc2('0x32')](handleEntityNotFound(_0x4aa1ec,null))[_0x9cc2('0x32')](saveUpdates(_0x49a082[_0x9cc2('0x55')],null))['then'](respondWithResult(_0x4aa1ec,null))[_0x9cc2('0x25')](handleError(_0x4aa1ec,null));};exports['destroy']=function(_0x4ac0c7,_0x2c2778){return db[_0x9cc2('0x50')][_0x9cc2('0x56')]({'where':{'id':_0x4ac0c7[_0x9cc2('0x57')]['id']}})[_0x9cc2('0x32')](handleEntityNotFound(_0x2c2778,null))[_0x9cc2('0x32')](removeEntity(_0x2c2778,null))[_0x9cc2('0x25')](handleError(_0x2c2778,null));};exports[_0x9cc2('0x58')]=function(_0x90d99b,_0x21f636){return db[_0x9cc2('0x50')]['describe']()[_0x9cc2('0x32')](respondWithResult(_0x21f636,null))['catch'](handleError(_0x21f636,null));};var interaction_log=require(_0x9cc2('0x59'))('whatsapp-interactions');exports[_0x9cc2('0x5a')]=function(_0x4d7f76,_0x494d76,_0x43c571){var _0x183de0={'agent':{},'channel':_0x9cc2('0x5b')};if(_0x4d7f76[_0x9cc2('0x55')]['id']){delete _0x4d7f76[_0x9cc2('0x55')]['id'];}_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5c')]=!![];_0x4d7f76['body']['readAt']=moment()[_0x9cc2('0x5d')](_0x9cc2('0x5e'));_0x4d7f76[_0x9cc2('0x55')]['UserId']=_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5f')]||_0x4d7f76[_0x9cc2('0x60')]['id'];_0x183de0[_0x9cc2('0x61')]['id']=_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5f')];return db[_0x9cc2('0x50')][_0x9cc2('0x56')]({'where':{'id':_0x4d7f76[_0x9cc2('0x57')]['id'],'UserId':null}})[_0x9cc2('0x32')](handleEntityNotFound(_0x494d76,null))['then'](saveUpdates(_0x4d7f76[_0x9cc2('0x55')],null))[_0x9cc2('0x32')](function(_0x529efa){if(_0x529efa){_0x183de0[_0x9cc2('0x23')]=_0x529efa[_0x9cc2('0x62')]({'plain':!![]});return db[_0x9cc2('0x63')][_0x9cc2('0x56')]({'where':{'id':_0x529efa['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x494d76,null))[_0x9cc2('0x32')](function(_0x3026e2){if(_0x3026e2){return _0x3026e2[_0x9cc2('0x31')]({'UserId':_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5f')],'read1stAt':_[_0x9cc2('0x64')](_0x3026e2[_0x9cc2('0x65')])?moment()[_0x9cc2('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9cc2('0x32')](function(_0x29eeb6){if(_0x29eeb6){_0x183de0[_0x9cc2('0x66')]=_0x29eeb6[_0x9cc2('0x62')]({'plain':!![]});interaction_log[_0x9cc2('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d7f76['user']['id'],_0x4d7f76[_0x9cc2('0x60')][_0x9cc2('0x3d')],_0x4d7f76[_0x9cc2('0x60')][_0x9cc2('0x67')],_0x183de0[_0x9cc2('0x66')]['id'],_0x4d7f76[_0x9cc2('0x55')]?JSON[_0x9cc2('0x20')](_0x4d7f76[_0x9cc2('0x55')]):'null');return respondWithRpcPromise(_0x9cc2('0x68'),_0x9cc2('0x69'),_0x183de0);}return null;})['then'](function(_0x57b236){var _0x553c97=_0x9cc2('0x6a')+_0x57b236[_0x9cc2('0x23')][_0x9cc2('0x6b')];return db[_0x9cc2('0x6c')][_0x9cc2('0x3e')](_0x553c97,{'type':db[_0x9cc2('0x6d')][_0x9cc2('0x6e')][_0x9cc2('0x6f')],'raw':!![]})[_0x9cc2('0x32')](function(_0x5eb9e6){return _0x5eb9e6;});})[_0x9cc2('0x32')](function(_0x284621){if(_0x284621){_0x183de0[_0x9cc2('0x23')][_0x9cc2('0x70')]=_0x284621[0x0];if(!_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5f')])return;return db[_0x9cc2('0x71')][_0x9cc2('0x56')]({'where':{'id':_0x4d7f76[_0x9cc2('0x55')][_0x9cc2('0x5f')],'role':_0x9cc2('0x61')},'attributes':['id',_0x9cc2('0x3d'),_0x9cc2('0x72'),_0x9cc2('0x73'),_0x9cc2('0x74')],'raw':!![]});}return null;})['then'](function(_0x22cc3e){if(!_0x22cc3e)return null;_0x183de0[_0x9cc2('0x23')][_0x9cc2('0x61')]=_0x22cc3e;return _0x183de0;})[_0x9cc2('0x32')](function(_0x7ed1ec){if(_0x7ed1ec){if(_0x4d7f76[_0x9cc2('0x55')]['manual']){_0x183de0[_0x9cc2('0x23')][_0x9cc2('0x75')]=util[_0x9cc2('0x5d')](_0x9cc2('0x76'),_0x4d7f76[_0x9cc2('0x60')][_0x9cc2('0x3d')]);_0x183de0[_0x9cc2('0x23')]['channel']=_0x183de0[_0x9cc2('0x77')];_0x183de0['message']['motionChannel']=_0x183de0[_0x9cc2('0x77')];_0x183de0[_0x9cc2('0x23')]['event']=_0x9cc2('0x5a');return respondWithRpcPromise(_0x9cc2('0x78'),'EventManager',{'event':_0x9cc2('0x79'),'message':_0x183de0[_0x9cc2('0x23')]},client9002)[_0x9cc2('0x32')](function(){return _0x183de0;});}return _0x183de0;}return null;})[_0x9cc2('0x32')](respondWithResult(_0x494d76,null))['catch'](handleError(_0x494d76,null));};var interaction_log=require(_0x9cc2('0x59'))(_0x9cc2('0x7a'));exports[_0x9cc2('0x2f')]=function(_0x50e785,_0x8049fc,_0x599587){var _0x548654={'agent':{},'channel':_0x9cc2('0x5b')};if(_0x50e785['body']['id']){delete _0x50e785['body']['id'];}_0x50e785['body']['UserId']=_0x50e785['body'][_0x9cc2('0x5f')]||_0x50e785['user']['id'];_0x548654[_0x9cc2('0x61')]['id']=_0x50e785[_0x9cc2('0x55')]['UserId'];return db['WhatsappMessage'][_0x9cc2('0x56')]({'where':{'id':_0x50e785[_0x9cc2('0x57')]['id'],'UserId':null}})[_0x9cc2('0x32')](handleEntityNotFound(_0x8049fc,null))['then'](function(_0xbfb88a){if(_0xbfb88a){_0x548654['message']=_0xbfb88a[_0x9cc2('0x62')]({'plain':!![]});return db[_0x9cc2('0x63')][_0x9cc2('0x56')]({'where':{'id':_0xbfb88a[_0x9cc2('0x7b')]}});}return null;})[_0x9cc2('0x32')](handleEntityNotFound(_0x8049fc,null))[_0x9cc2('0x32')](function(_0x13db9c){if(_0x13db9c){_0x548654[_0x9cc2('0x66')]=_0x13db9c['get']({'plain':!![]});interaction_log[_0x9cc2('0x1e')](_0x9cc2('0x7c'),_0x50e785[_0x9cc2('0x60')]['id'],_0x50e785[_0x9cc2('0x60')][_0x9cc2('0x3d')],_0x50e785['user'][_0x9cc2('0x67')],_0x548654['interaction']['id'],_0x50e785['body']?JSON['stringify'](_0x50e785[_0x9cc2('0x55')]):_0x9cc2('0x7d'));return respondWithRpcPromise('RejectMessage',_0x9cc2('0x7e'),_0x548654);}return null;})[_0x9cc2('0x32')](function(_0x1afdd9){var _0x4da783=_0x9cc2('0x6a')+_0x1afdd9['message'][_0x9cc2('0x6b')];return db[_0x9cc2('0x6c')][_0x9cc2('0x3e')](_0x4da783,{'type':db['Sequelize'][_0x9cc2('0x6e')][_0x9cc2('0x6f')],'raw':!![]})[_0x9cc2('0x32')](function(_0x1e432b){return _0x1e432b;});})[_0x9cc2('0x32')](function(_0x497995){if(_0x497995){_0x548654[_0x9cc2('0x23')][_0x9cc2('0x70')]=_0x497995[0x0];if(!_0x50e785[_0x9cc2('0x55')][_0x9cc2('0x5f')])return;return db['User'][_0x9cc2('0x56')]({'where':{'id':_0x50e785[_0x9cc2('0x55')][_0x9cc2('0x5f')],'role':_0x9cc2('0x61')},'attributes':['id','name',_0x9cc2('0x72'),'email',_0x9cc2('0x74')],'raw':!![]});}return null;})[_0x9cc2('0x32')](function(_0x1fce5e){if(!_0x1fce5e)return null;_0x548654[_0x9cc2('0x23')]['agent']=_0x1fce5e;return _0x548654;})[_0x9cc2('0x32')](function(_0x13e8f9){if(_0x13e8f9){_0x13e8f9[_0x9cc2('0x23')][_0x9cc2('0x75')]=util[_0x9cc2('0x5d')](_0x9cc2('0x76'),_0x50e785[_0x9cc2('0x60')][_0x9cc2('0x3d')]);_0x13e8f9[_0x9cc2('0x23')][_0x9cc2('0x77')]=_0x548654[_0x9cc2('0x77')];_0x13e8f9['message']['motionChannel']=_0x548654[_0x9cc2('0x77')];_0x13e8f9['message']['event']='reject';respondWithRpcPromise(_0x9cc2('0x78'),_0x9cc2('0x78'),{'event':_0x9cc2('0x7f'),'message':_0x13e8f9[_0x9cc2('0x23')]},client9002);return _0x548654;}return null;})[_0x9cc2('0x32')](respondWithResult(_0x8049fc,null))[_0x9cc2('0x25')](handleError(_0x8049fc,null));};exports[_0x9cc2('0x26')]=function(_0x165283,_0x58c2e6,_0x403cdb){if(_0x165283['body']['id']){delete _0x165283['body']['id'];}var _0x5240f4;return db[_0x9cc2('0x50')]['find']({'where':{'id':_0x165283[_0x9cc2('0x57')]['id']}})[_0x9cc2('0x32')](handleEntityNotFound(_0x58c2e6,null))[_0x9cc2('0x32')](function(_0x21dcf4){if(_0x21dcf4){_0x5240f4=_0x21dcf4;return db[_0x9cc2('0x80')]['find']({'where':{'id':_0x21dcf4[_0x9cc2('0x81')]}});}})[_0x9cc2('0x32')](handleEntityNotFound(_0x58c2e6,null))[_0x9cc2('0x32')](function(_0x284f40){if(_0x284f40){logger[_0x9cc2('0x82')](_0x9cc2('0x83'),'status',_0x9cc2('0x84'),_0x284f40[_0x9cc2('0x3a')],util[_0x9cc2('0x85')](_0x165283[_0x9cc2('0x55')],{'showHidden':![],'depth':null}));switch(_0x284f40['type']){case _0x9cc2('0x86'):if(_0x165283[_0x9cc2('0x55')][_0x9cc2('0x87')]&&_0x165283[_0x9cc2('0x55')][_0x9cc2('0x87')]===_0x5240f4[_0x9cc2('0x88')]&&_0x165283[_0x9cc2('0x55')][_0x9cc2('0x89')]&&_0x165283[_0x9cc2('0x55')][_0x9cc2('0x89')]===_0x9cc2('0x5c')){return _0x5240f4['update']({'read':!![]});}else{logger[_0x9cc2('0x21')](_0x9cc2('0x8a'),'status',_0x9cc2('0x86'),util['inspect'](_0x165283[_0x9cc2('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x5240f4;}})['then'](respondWithResult(_0x58c2e6,null))['catch'](handleError(_0x58c2e6,null));}; \ No newline at end of file +var _0x406d=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','params','describe','../../config/logger','whatsapp-interactions','whatsapp','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','ContactId','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','destroy','stack','send','index','WhatsappMessage','rawAttributes','fieldName','key','map','name','query','keys','filters'];(function(_0x3e6133,_0x2a227a){var _0x494686=function(_0x57c652){while(--_0x57c652){_0x3e6133['push'](_0x3e6133['shift']());}};_0x494686(++_0x2a227a);}(_0x406d,0x16d));var _0xd406=function(_0x1483ab,_0x76d502){_0x1483ab=_0x1483ab-0x0;var _0x54ecd0=_0x406d[_0x1483ab];return _0x54ecd0;};'use strict';var emlformat=require(_0xd406('0x0'));var rimraf=require(_0xd406('0x1'));var zipdir=require(_0xd406('0x2'));var jsonpatch=require(_0xd406('0x3'));var rp=require(_0xd406('0x4'));var moment=require(_0xd406('0x5'));var BPromise=require(_0xd406('0x6'));var Mustache=require(_0xd406('0x7'));var util=require('util');var path=require(_0xd406('0x8'));var sox=require(_0xd406('0x9'));var csv=require(_0xd406('0xa'));var ejs=require(_0xd406('0xb'));var fs=require('fs');var fs_extra=require(_0xd406('0xc'));var _=require('lodash');var squel=require(_0xd406('0xd'));var crypto=require(_0xd406('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd406('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd406('0x10'));var Papa=require(_0xd406('0x11'));var Redis=require(_0xd406('0x12'));var authService=require(_0xd406('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd406('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd406('0x15'));var utils=require(_0xd406('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd406('0x17'));var db=require(_0xd406('0x18'))['db'];config[_0xd406('0x19')]=_[_0xd406('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd406('0x1b'))(new Redis(config['redis']));require(_0xd406('0x1c'))[_0xd406('0x1d')](socket);var jayson=require(_0xd406('0x1e'));var client=jayson[_0xd406('0x1f')][_0xd406('0x20')]({'port':0x232c});var client9002=jayson[_0xd406('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x326699,_0x27ec18,_0x18fdc0,_0x5e9e79){return new BPromise(function(_0x5cabb0,_0x12c0ea){var _0x3185f0=_0x5e9e79||client;return _0x3185f0[_0xd406('0x21')](_0x326699,_0x18fdc0)[_0xd406('0x22')](function(_0x17857c){logger[_0xd406('0x23')](_0xd406('0x24'),_0x27ec18,_0xd406('0x25'));logger[_0xd406('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x27ec18,_0xd406('0x25'),JSON[_0xd406('0x27')](_0x17857c));if(_0x17857c[_0xd406('0x28')]){if(_0x17857c['error'][_0xd406('0x29')]===0x1f4){logger[_0xd406('0x28')](_0xd406('0x24'),_0x27ec18,_0x17857c['error'][_0xd406('0x2a')]);return _0x12c0ea(_0x17857c[_0xd406('0x28')][_0xd406('0x2a')]);}logger['error'](_0xd406('0x24'),_0x27ec18,_0x17857c[_0xd406('0x28')][_0xd406('0x2a')]);return _0x5cabb0(_0x17857c['error'][_0xd406('0x2a')]);}else{logger['info'](_0xd406('0x24'),_0x27ec18,'request\x20sent');_0x5cabb0(_0x17857c[_0xd406('0x2b')][_0xd406('0x2a')]);}})[_0xd406('0x2c')](function(_0x54dcb3){logger[_0xd406('0x28')](_0xd406('0x24'),_0x27ec18,_0x54dcb3);_0x12c0ea(_0x54dcb3);});});}function respondWithStatusCode(_0x5aaaa3,_0x11f6e9){_0x11f6e9=_0x11f6e9||0xcc;return function(_0x57a526){if(_0x57a526){return _0x5aaaa3[_0xd406('0x2d')](_0x11f6e9);}return _0x5aaaa3[_0xd406('0x2e')](_0x11f6e9)[_0xd406('0x2f')]();};}function respondWithResult(_0x8d64f4,_0xeefd91){_0xeefd91=_0xeefd91||0xc8;return function(_0x4baadb){if(_0x4baadb){return _0x8d64f4['status'](_0xeefd91)[_0xd406('0x30')](_0x4baadb);}};}function respondWithFilteredResult(_0xcb67f4,_0x39dc7f){return function(_0x2009c5){if(_0x2009c5){var _0x373518=typeof _0x39dc7f['offset']===_0xd406('0x31')&&typeof _0x39dc7f[_0xd406('0x32')]===_0xd406('0x31');var _0x1ba379=_0x2009c5[_0xd406('0x33')];var _0x2f3114=_0x373518?0x0:_0x39dc7f['offset'];var _0x3d63fb=_0x373518?_0x2009c5[_0xd406('0x33')]:_0x39dc7f['offset']+_0x39dc7f[_0xd406('0x32')];var _0x4c4257;if(_0x3d63fb>=_0x1ba379){_0x3d63fb=_0x1ba379;_0x4c4257=0xc8;}else{_0x4c4257=0xce;}_0xcb67f4[_0xd406('0x2e')](_0x4c4257);return _0xcb67f4[_0xd406('0x34')]('Content-Range',_0x2f3114+'-'+_0x3d63fb+'/'+_0x1ba379)[_0xd406('0x30')](_0x2009c5);}return null;};}function patchUpdates(_0x93e190){return function(_0x5dbcd1){try{jsonpatch[_0xd406('0x35')](_0x5dbcd1,_0x93e190,!![]);}catch(_0x232a4f){return BPromise[_0xd406('0x36')](_0x232a4f);}return _0x5dbcd1[_0xd406('0x37')]();};}function saveUpdates(_0x4774d3,_0x537d4f){return function(_0x2e93d8){if(_0x2e93d8){return _0x2e93d8[_0xd406('0x38')](_0x4774d3)[_0xd406('0x22')](function(_0x2cd6d9){return _0x2cd6d9;});}return null;};}function removeEntity(_0x53dcb9,_0x14145f){return function(_0x393dc9){if(_0x393dc9){return _0x393dc9[_0xd406('0x39')]()[_0xd406('0x22')](function(){_0x53dcb9[_0xd406('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4603,_0x4722e2){return function(_0x5a1c05){if(!_0x5a1c05){_0x3c4603[_0xd406('0x2d')](0x194);}return _0x5a1c05;};}function handleError(_0x4b0502,_0x38c9bf){_0x38c9bf=_0x38c9bf||0x1f4;return function(_0x32ce40){logger['error'](_0x32ce40[_0xd406('0x3a')]);if(_0x32ce40['name']){delete _0x32ce40['name'];}_0x4b0502[_0xd406('0x2e')](_0x38c9bf)[_0xd406('0x3b')](_0x32ce40);};}exports[_0xd406('0x3c')]=function(_0x319aab,_0x547414){var _0x5df95c={},_0x5dadc2={},_0x111b1b={'count':0x0,'rows':[]};var _0x5d4158=_['map'](db[_0xd406('0x3d')][_0xd406('0x3e')],function(_0x9b885b){return{'name':_0x9b885b[_0xd406('0x3f')],'type':_0x9b885b['type'][_0xd406('0x40')]};});_0x5dadc2['model']=_[_0xd406('0x41')](_0x5d4158,_0xd406('0x42'));_0x5dadc2[_0xd406('0x43')]=_[_0xd406('0x44')](_0x319aab[_0xd406('0x43')]);_0x5dadc2[_0xd406('0x45')]=_['intersection'](_0x5dadc2[_0xd406('0x46')],_0x5dadc2[_0xd406('0x43')]);_0x5df95c[_0xd406('0x47')]=_[_0xd406('0x48')](_0x5dadc2[_0xd406('0x46')],qs[_0xd406('0x49')](_0x319aab[_0xd406('0x43')]['fields']));_0x5df95c[_0xd406('0x47')]=_0x5df95c['attributes'][_0xd406('0x4a')]?_0x5df95c[_0xd406('0x47')]:_0x5dadc2[_0xd406('0x46')];if(!_0x319aab[_0xd406('0x43')][_0xd406('0x4b')](_0xd406('0x4c'))){_0x5df95c[_0xd406('0x32')]=qs[_0xd406('0x32')](_0x319aab[_0xd406('0x43')][_0xd406('0x32')]);_0x5df95c['offset']=qs[_0xd406('0x4d')](_0x319aab['query'][_0xd406('0x4d')]);}_0x5df95c[_0xd406('0x4e')]=qs['sort'](_0x319aab[_0xd406('0x43')][_0xd406('0x4f')]);_0x5df95c['where']=qs[_0xd406('0x45')](_[_0xd406('0x50')](_0x319aab[_0xd406('0x43')],_0x5dadc2[_0xd406('0x45')]),_0x5d4158);if(_0x319aab[_0xd406('0x43')][_0xd406('0x51')]){_0x5df95c[_0xd406('0x52')]=_[_0xd406('0x53')](_0x5df95c[_0xd406('0x52')],{'$or':_[_0xd406('0x41')](_0x5d4158,function(_0x260e52){if(_0x260e52[_0xd406('0x54')]!==_0xd406('0x55')){var _0xe508a4={};_0xe508a4[_0x260e52[_0xd406('0x42')]]={'$like':'%'+_0x319aab['query']['filter']+'%'};return _0xe508a4;}})});}_0x5df95c=_[_0xd406('0x53')]({},_0x5df95c,_0x319aab[_0xd406('0x56')]);var _0x359420={'where':_0x5df95c['where']};return db[_0xd406('0x3d')]['count'](_0x359420)[_0xd406('0x22')](function(_0x48ad47){_0x111b1b['count']=_0x48ad47;if(_0x319aab[_0xd406('0x43')][_0xd406('0x57')]){_0x5df95c[_0xd406('0x58')]=[{'all':!![]}];}return db[_0xd406('0x3d')][_0xd406('0x59')](_0x5df95c);})['then'](function(_0x5c4ef7){_0x111b1b[_0xd406('0x5a')]=_0x5c4ef7;return _0x111b1b;})[_0xd406('0x22')](respondWithFilteredResult(_0x547414,_0x5df95c))['catch'](handleError(_0x547414,null));};exports[_0xd406('0x5b')]=function(_0x2fd765,_0x1a9b63){var _0x2ff1f8={'raw':!![],'where':{'id':_0x2fd765['params']['id']}},_0x34c166={};_0x34c166[_0xd406('0x46')]=_['keys'](db['WhatsappMessage'][_0xd406('0x3e')]);_0x34c166[_0xd406('0x43')]=_['keys'](_0x2fd765[_0xd406('0x43')]);_0x34c166[_0xd406('0x45')]=_[_0xd406('0x48')](_0x34c166['model'],_0x34c166[_0xd406('0x43')]);_0x2ff1f8[_0xd406('0x47')]=_[_0xd406('0x48')](_0x34c166[_0xd406('0x46')],qs['fields'](_0x2fd765[_0xd406('0x43')][_0xd406('0x49')]));_0x2ff1f8[_0xd406('0x47')]=_0x2ff1f8['attributes'][_0xd406('0x4a')]?_0x2ff1f8[_0xd406('0x47')]:_0x34c166[_0xd406('0x46')];if(_0x2fd765[_0xd406('0x43')][_0xd406('0x57')]){_0x2ff1f8[_0xd406('0x58')]=[{'all':!![]}];}_0x2ff1f8=_[_0xd406('0x53')]({},_0x2ff1f8,_0x2fd765[_0xd406('0x56')]);return db[_0xd406('0x3d')][_0xd406('0x5c')](_0x2ff1f8)[_0xd406('0x22')](handleEntityNotFound(_0x1a9b63,null))['then'](respondWithResult(_0x1a9b63,null))[_0xd406('0x2c')](handleError(_0x1a9b63,null));};exports[_0xd406('0x5d')]=function(_0xc85744,_0x404cd3){return db[_0xd406('0x3d')]['create'](_0xc85744['body'],{})['then'](respondWithResult(_0x404cd3,0xc9))[_0xd406('0x2c')](handleError(_0x404cd3,null));};exports[_0xd406('0x38')]=function(_0x32705b,_0xcd2209){if(_0x32705b[_0xd406('0x5e')]['id']){delete _0x32705b[_0xd406('0x5e')]['id'];}return db[_0xd406('0x3d')][_0xd406('0x5c')]({'where':{'id':_0x32705b[_0xd406('0x5f')]['id']}})[_0xd406('0x22')](handleEntityNotFound(_0xcd2209,null))[_0xd406('0x22')](saveUpdates(_0x32705b[_0xd406('0x5e')],null))['then'](respondWithResult(_0xcd2209,null))[_0xd406('0x2c')](handleError(_0xcd2209,null));};exports[_0xd406('0x39')]=function(_0x2c85e8,_0x3457d3){return db[_0xd406('0x3d')]['find']({'where':{'id':_0x2c85e8[_0xd406('0x5f')]['id']}})[_0xd406('0x22')](handleEntityNotFound(_0x3457d3,null))[_0xd406('0x22')](removeEntity(_0x3457d3,null))[_0xd406('0x2c')](handleError(_0x3457d3,null));};exports[_0xd406('0x60')]=function(_0x30e06d,_0x439e18){return db[_0xd406('0x3d')]['describe']()['then'](respondWithResult(_0x439e18,null))['catch'](handleError(_0x439e18,null));};var interaction_log=require(_0xd406('0x61'))(_0xd406('0x62'));exports['accept']=function(_0x34ff5d,_0x15cae7,_0xcc4a2a){var _0x26dabf={'agent':{},'channel':_0xd406('0x63')};if(_0x34ff5d['body']['id']){delete _0x34ff5d[_0xd406('0x5e')]['id'];}_0x34ff5d['body']['read']=!![];_0x34ff5d[_0xd406('0x5e')][_0xd406('0x64')]=moment()[_0xd406('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x34ff5d[_0xd406('0x5e')]['UserId']=_0x34ff5d[_0xd406('0x5e')][_0xd406('0x66')]||_0x34ff5d[_0xd406('0x67')]['id'];_0x26dabf[_0xd406('0x68')]['id']=_0x34ff5d[_0xd406('0x5e')][_0xd406('0x66')];return db[_0xd406('0x3d')][_0xd406('0x5c')]({'where':{'id':_0x34ff5d[_0xd406('0x5f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x15cae7,null))[_0xd406('0x22')](saveUpdates(_0x34ff5d[_0xd406('0x5e')],null))['then'](function(_0x2c30d8){if(_0x2c30d8){_0x26dabf[_0xd406('0x2a')]=_0x2c30d8[_0xd406('0x69')]({'plain':!![]});return db[_0xd406('0x6a')][_0xd406('0x5c')]({'where':{'id':_0x2c30d8[_0xd406('0x6b')]}});}return null;})[_0xd406('0x22')](handleEntityNotFound(_0x15cae7,null))[_0xd406('0x22')](function(_0x230548){if(_0x230548){return _0x230548[_0xd406('0x38')]({'UserId':_0x34ff5d[_0xd406('0x5e')][_0xd406('0x66')],'read1stAt':_['isNil'](_0x230548[_0xd406('0x6c')])?moment()[_0xd406('0x65')](_0xd406('0x6d')):undefined});}return null;})[_0xd406('0x22')](function(_0x1709bc){if(_0x1709bc){_0x26dabf['interaction']=_0x1709bc[_0xd406('0x69')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34ff5d[_0xd406('0x67')]['id'],_0x34ff5d['user'][_0xd406('0x42')],_0x34ff5d[_0xd406('0x67')][_0xd406('0x6e')],_0x26dabf['interaction']['id'],_0x34ff5d[_0xd406('0x5e')]?JSON[_0xd406('0x27')](_0x34ff5d[_0xd406('0x5e')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd406('0x6f'),_0x26dabf);}return null;})[_0xd406('0x22')](function(_0x1e9b12){var _0x73b83f=_0xd406('0x70')+_0x1e9b12[_0xd406('0x2a')]['ContactId'];return db[_0xd406('0x71')][_0xd406('0x43')](_0x73b83f,{'type':db[_0xd406('0x72')][_0xd406('0x73')][_0xd406('0x74')],'raw':!![]})['then'](function(_0x33a99d){return _0x33a99d;});})[_0xd406('0x22')](function(_0x46834a){if(_0x46834a){_0x26dabf['message'][_0xd406('0x75')]=_0x46834a[0x0];if(!_0x34ff5d['body'][_0xd406('0x66')])return;return db[_0xd406('0x76')][_0xd406('0x5c')]({'where':{'id':_0x34ff5d[_0xd406('0x5e')][_0xd406('0x66')],'role':_0xd406('0x68')},'attributes':['id',_0xd406('0x42'),_0xd406('0x77'),_0xd406('0x78'),_0xd406('0x79')],'raw':!![]});}return null;})['then'](function(_0x905fcb){if(!_0x905fcb)return null;_0x26dabf[_0xd406('0x2a')]['agent']=_0x905fcb;return _0x26dabf;})[_0xd406('0x22')](function(_0x16124c){if(_0x16124c){if(_0x34ff5d['body'][_0xd406('0x7a')]){_0x26dabf[_0xd406('0x2a')][_0xd406('0x7b')]=util[_0xd406('0x65')](_0xd406('0x7c'),_0x34ff5d[_0xd406('0x67')][_0xd406('0x42')]);_0x26dabf[_0xd406('0x2a')][_0xd406('0x7d')]=_0x26dabf[_0xd406('0x7d')];_0x26dabf[_0xd406('0x2a')][_0xd406('0x7e')]=_0x26dabf['channel'];_0x26dabf[_0xd406('0x2a')][_0xd406('0x7f')]=_0xd406('0x80');return respondWithRpcPromise('EventManager',_0xd406('0x81'),{'event':'acceptmessage','message':_0x26dabf[_0xd406('0x2a')]},client9002)['then'](function(){return _0x26dabf;});}return _0x26dabf;}return null;})['then'](respondWithResult(_0x15cae7,null))[_0xd406('0x2c')](handleError(_0x15cae7,null));};var interaction_log=require(_0xd406('0x61'))('whatsapp-interactions');exports[_0xd406('0x36')]=function(_0x3acbbb,_0xb7ec18,_0x43cbaf){var _0x216422={'agent':{},'channel':'whatsapp'};if(_0x3acbbb['body']['id']){delete _0x3acbbb['body']['id'];}_0x3acbbb[_0xd406('0x5e')][_0xd406('0x66')]=_0x3acbbb['body'][_0xd406('0x66')]||_0x3acbbb[_0xd406('0x67')]['id'];_0x216422[_0xd406('0x68')]['id']=_0x3acbbb[_0xd406('0x5e')]['UserId'];return db[_0xd406('0x3d')][_0xd406('0x5c')]({'where':{'id':_0x3acbbb[_0xd406('0x5f')]['id'],'UserId':null}})[_0xd406('0x22')](handleEntityNotFound(_0xb7ec18,null))[_0xd406('0x22')](function(_0x2e1a4c){if(_0x2e1a4c){_0x216422['message']=_0x2e1a4c['get']({'plain':!![]});return db['WhatsappInteraction'][_0xd406('0x5c')]({'where':{'id':_0x2e1a4c[_0xd406('0x6b')]}});}return null;})[_0xd406('0x22')](handleEntityNotFound(_0xb7ec18,null))[_0xd406('0x22')](function(_0x292ac4){if(_0x292ac4){_0x216422['interaction']=_0x292ac4[_0xd406('0x69')]({'plain':!![]});interaction_log['info'](_0xd406('0x82'),_0x3acbbb[_0xd406('0x67')]['id'],_0x3acbbb['user'][_0xd406('0x42')],_0x3acbbb[_0xd406('0x67')][_0xd406('0x6e')],_0x216422[_0xd406('0x83')]['id'],_0x3acbbb[_0xd406('0x5e')]?JSON[_0xd406('0x27')](_0x3acbbb[_0xd406('0x5e')]):'null');return respondWithRpcPromise(_0xd406('0x84'),'rejectMessage',_0x216422);}return null;})['then'](function(_0x27367c){var _0x2246a3=_0xd406('0x70')+_0x27367c[_0xd406('0x2a')][_0xd406('0x85')];return db[_0xd406('0x71')]['query'](_0x2246a3,{'type':db[_0xd406('0x72')][_0xd406('0x73')][_0xd406('0x74')],'raw':!![]})[_0xd406('0x22')](function(_0x5157ab){return _0x5157ab;});})[_0xd406('0x22')](function(_0x1309d2){if(_0x1309d2){_0x216422[_0xd406('0x2a')]['contact']=_0x1309d2[0x0];if(!_0x3acbbb['body']['UserId'])return;return db[_0xd406('0x76')][_0xd406('0x5c')]({'where':{'id':_0x3acbbb[_0xd406('0x5e')][_0xd406('0x66')],'role':'agent'},'attributes':['id',_0xd406('0x42'),_0xd406('0x77'),_0xd406('0x78'),_0xd406('0x79')],'raw':!![]});}return null;})[_0xd406('0x22')](function(_0xefc1b7){if(!_0xefc1b7)return null;_0x216422[_0xd406('0x2a')][_0xd406('0x68')]=_0xefc1b7;return _0x216422;})[_0xd406('0x22')](function(_0x32da33){if(_0x32da33){_0x32da33[_0xd406('0x2a')][_0xd406('0x7b')]=util['format'](_0xd406('0x7c'),_0x3acbbb[_0xd406('0x67')][_0xd406('0x42')]);_0x32da33['message'][_0xd406('0x7d')]=_0x216422[_0xd406('0x7d')];_0x32da33[_0xd406('0x2a')]['motionChannel']=_0x216422[_0xd406('0x7d')];_0x32da33[_0xd406('0x2a')][_0xd406('0x7f')]=_0xd406('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x32da33[_0xd406('0x2a')]},client9002);return _0x216422;}return null;})['then'](respondWithResult(_0xb7ec18,null))[_0xd406('0x2c')](handleError(_0xb7ec18,null));};exports[_0xd406('0x2e')]=function(_0x50a2f3,_0x100d48,_0xf0459){if(_0x50a2f3['body']['id']){delete _0x50a2f3[_0xd406('0x5e')]['id'];}var _0x3306c7;return db[_0xd406('0x3d')][_0xd406('0x5c')]({'where':{'id':_0x50a2f3[_0xd406('0x5f')]['id']}})[_0xd406('0x22')](handleEntityNotFound(_0x100d48,null))[_0xd406('0x22')](function(_0x2243be){if(_0x2243be){_0x3306c7=_0x2243be;return db[_0xd406('0x86')][_0xd406('0x5c')]({'where':{'id':_0x2243be[_0xd406('0x87')]}});}})['then'](handleEntityNotFound(_0x100d48,null))['then'](function(_0x5cfd08){if(_0x5cfd08){logger[_0xd406('0x26')](_0xd406('0x88'),_0xd406('0x2e'),_0xd406('0x89'),_0x5cfd08[_0xd406('0x54')],util[_0xd406('0x8a')](_0x50a2f3[_0xd406('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5cfd08[_0xd406('0x54')]){case'twilio':if(_0x50a2f3[_0xd406('0x5e')][_0xd406('0x8b')]&&_0x50a2f3['body'][_0xd406('0x8b')]===_0x3306c7[_0xd406('0x8c')]&&_0x50a2f3[_0xd406('0x5e')]['MessageStatus']&&_0x50a2f3[_0xd406('0x5e')][_0xd406('0x8d')]===_0xd406('0x8e')){return _0x3306c7[_0xd406('0x38')]({'read':!![]});}else{logger[_0xd406('0x28')](_0xd406('0x8f'),'status',_0xd406('0x90'),util['inspect'](_0x50a2f3[_0xd406('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x3306c7;}})[_0xd406('0x22')](respondWithResult(_0x100d48,null))[_0xd406('0x2c')](handleError(_0x100d48,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c526461..0ed4908 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 _0x97c1=['../../mysqldb','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x27d99e,_0x2324b1){var _0x3758bd=function(_0x2323b9){while(--_0x2323b9){_0x27d99e['push'](_0x27d99e['shift']());}};_0x3758bd(++_0x2324b1);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x197c('0x0'));var WhatsappMessage=require(_0x197c('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x197c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x197c('0x3')};function emitEvent(_0xbb081d){return function(_0x26833e,_0x37ac05,_0x40863c){WhatsappMessageEvents['emit'](_0xbb081d+':'+_0x26833e['id'],_0x26833e);WhatsappMessageEvents['emit'](_0xbb081d,_0x26833e);_0x40863c(null);};}for(var e in events){if(events[_0x197c('0x4')](e)){var event=events[e];WhatsappMessage[_0x197c('0x5')](e,emitEvent(event));}}module[_0x197c('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x39cb=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','save'];(function(_0x5986b5,_0x3e5444){var _0x4d8e00=function(_0x228cfc){while(--_0x228cfc){_0x5986b5['push'](_0x5986b5['shift']());}};_0x4d8e00(++_0x3e5444);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xb39c('0x0'))['db'][_0xb39c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb39c('0x2'),'afterUpdate':_0xb39c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x412f1c){return function(_0x285eca,_0x398d07,_0x2bca14){WhatsappMessageEvents[_0xb39c('0x4')](_0x412f1c+':'+_0x285eca['id'],_0x285eca);WhatsappMessageEvents['emit'](_0x412f1c,_0x285eca);_0x2bca14(null);};}for(var e in events){if(events[_0xb39c('0x5')](e)){var event=events[e];WhatsappMessage[_0xb39c('0x6')](e,emitEvent(event));}}module[_0xb39c('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c1759c7..aad99c5 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 _0x5b1d=['catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','findOne','WhatsappInteractionId','update'];(function(_0x4d442b,_0x2959e4){var _0x46c813=function(_0xfb8a0c){while(--_0xfb8a0c){_0x4d442b['push'](_0x4d442b['shift']());}};_0x46c813(++_0x2959e4);}(_0x5b1d,0xc3));var _0xd5b1=function(_0x59fefd,_0x50624f){_0x59fefd=_0x59fefd-0x0;var _0x36ac6f=_0x5b1d[_0x59fefd];return _0x36ac6f;};'use strict';var _=require(_0xd5b1('0x0'));var util=require(_0xd5b1('0x1'));var logger=require(_0xd5b1('0x2'))(_0xd5b1('0x3'));var moment=require(_0xd5b1('0x4'));var BPromise=require(_0xd5b1('0x5'));var rp=require(_0xd5b1('0x6'));var fetch=require(_0xd5b1('0x7'));var fs=require('fs');var path=require(_0xd5b1('0x8'));var rimraf=require(_0xd5b1('0x9'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xd5b1('0xa')]=function(_0x31f4b1,_0x176113){return _0x31f4b1[_0xd5b1('0xb')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd5b1('0xc'),'fields':[_0xd5b1('0xc')]},{'name':_0xd5b1('0xd'),'fields':[_0xd5b1('0xe')],'type':_0xd5b1('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x456a86,_0x311e46,_0x41f2d6){var _0x4128b6=_0x31f4b1[_0xd5b1('0x10')];var _0x43c550=_0x456a86['get']({'plain':!![]});if(_0x43c550[_0xd5b1('0x11')][_0xd5b1('0x12')]()==='in'||_0x43c550[_0xd5b1('0x11')][_0xd5b1('0x12')]()==='out'&&!_0x43c550[_0xd5b1('0x13')]&&!_[_0xd5b1('0x14')](_0x43c550[_0xd5b1('0x15')])){_0x4128b6['WhatsappInteraction'][_0xd5b1('0x16')]({'where':{'id':_0x43c550[_0xd5b1('0x17')]}})['then'](function(_0x5102ac){if(_0x5102ac){_0x5102ac[_0xd5b1('0x18')]({'lastMsgAt':_0x43c550['createdAt'],'lastMsgDirection':_0x43c550['direction']['toLowerCase']()});}})[_0xd5b1('0x19')](function(_0x3220ce){console[_0xd5b1('0x1a')](_0x3220ce);});}if(_0x43c550[_0xd5b1('0x11')]==='out'&&!_0x43c550[_0xd5b1('0x13')]){var _0x1bb928;_0x4128b6[_0xd5b1('0x1b')]['find']({'where':{'id':_0x43c550[_0xd5b1('0x1c')]},'raw':!![]})['then'](function(_0x3a5fab){_0x1bb928=_0x3a5fab;if(_0x1bb928&&_0x1bb928[_0xd5b1('0x1d')]){switch(_0x1bb928['type']){case _0xd5b1('0x1e'):var _0x228955=require('twilio');if(_0x1bb928[_0xd5b1('0x1f')]&&_0x1bb928[_0xd5b1('0x20')]&&_0x1bb928[_0xd5b1('0x21')]){var _0x327552=new _0x228955(_0x1bb928['accountSid'],_0x1bb928[_0xd5b1('0x20')]);_0x327552[_0xd5b1('0x22')][_0xd5b1('0x23')]({'body':_0x43c550['body'],'to':_0xd5b1('0x24')+_0x43c550['phone'],'from':_0xd5b1('0x24')+_0x1bb928['phone'],'statusCallback':_0x1bb928['remote']+_0xd5b1('0x25')+_0x43c550['id']+_0xd5b1('0x26')+_0x1bb928['token']})[_0xd5b1('0x27')](function(_0xc0f7d0){if(_0xc0f7d0[_0xd5b1('0x28')]){return _0x456a86[_0xd5b1('0x18')]({'messageId':_0xc0f7d0[_0xd5b1('0x28')]});}})[_0xd5b1('0x19')](function(_0x5d2cd3){logger['error'](_0xd5b1('0x29'),'afterCreate',_0xd5b1('0x1e'),util['inspect'](_0x5d2cd3,{'showHidden':![],'depth':null}));});}else{logger[_0xd5b1('0x1a')](_0xd5b1('0x29'),_0xd5b1('0x2a'),_0xd5b1('0x1e'),_0xd5b1('0x2b'));}break;case'sinch':var _0x12e2e9=_0x1bb928[_0xd5b1('0x1f')];var _0x908c4f=_0x1bb928[_0xd5b1('0x20')];var _0x41d87f=_0x1bb928['baseUrl']+_0xd5b1('0x2c')+_0x12e2e9+_0xd5b1('0x2d');var _0x51812e={'to':[_0x43c550[_0xd5b1('0x21')]],'message':{'type':_0xd5b1('0x2e'),'text':_0x43c550['body']}};var _0x1d9b15={'method':_0xd5b1('0x2f'),'uri':_0x41d87f,'headers':{'Authorization':'Bearer\x20'+_0x908c4f,'Content-Type':_0xd5b1('0x30')},'body':_0x51812e,'json':!![]};rp(_0x1d9b15)[_0xd5b1('0x27')](function(_0x2d0fb2){if(_0x2d0fb2[_0xd5b1('0x31')][0x0][_0xd5b1('0x32')]){return _0x456a86['update']({'messageId':_0x2d0fb2[_0xd5b1('0x31')][0x0][_0xd5b1('0x32')]});}})[_0xd5b1('0x19')](function(_0x1ed351){logger[_0xd5b1('0x33')](_0xd5b1('0x34'),_0x1ed351);});break;}}})[_0xd5b1('0x35')](function(){_0x41f2d6();});}else{_0x41f2d6();}}},'charset':_0xd5b1('0x36'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x496b=['UserId','findOne','then','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','application/json','statuses','message_id','catch','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','models','direction','toLowerCase','secret'];(function(_0xe31165,_0x23cebf){var _0x3cd681=function(_0x5cfe54){while(--_0x5cfe54){_0xe31165['push'](_0xe31165['shift']());}};_0x3cd681(++_0x23cebf);}(_0x496b,0x1c4));var _0xb496=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x496b[_0x1064bc];return _0x5edc45;};'use strict';var _=require(_0xb496('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb496('0x1'));var rp=require(_0xb496('0x2'));var fetch=require(_0xb496('0x3'));var fs=require('fs');var path=require(_0xb496('0x4'));var rimraf=require('rimraf');var config=require(_0xb496('0x5'));var attributes=require(_0xb496('0x6'));module[_0xb496('0x7')]=function(_0x24e7e7,_0x291513){return _0x24e7e7[_0xb496('0x8')](_0xb496('0x9'),attributes,{'tableName':_0xb496('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb496('0xb')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cbd65,_0x2d7e59,_0x474f3e){var _0x52fb89=_0x24e7e7[_0xb496('0xc')];var _0x2a17d2=_0x4cbd65['get']({'plain':!![]});if(_0x2a17d2[_0xb496('0xd')][_0xb496('0xe')]()==='in'||_0x2a17d2[_0xb496('0xd')][_0xb496('0xe')]()==='out'&&!_0x2a17d2[_0xb496('0xf')]&&!_['isNil'](_0x2a17d2[_0xb496('0x10')])){_0x52fb89['WhatsappInteraction'][_0xb496('0x11')]({'where':{'id':_0x2a17d2['WhatsappInteractionId']}})[_0xb496('0x12')](function(_0xbc02db){if(_0xbc02db){_0xbc02db['update']({'lastMsgAt':_0x2a17d2['createdAt'],'lastMsgDirection':_0x2a17d2['direction']['toLowerCase']()});}})['catch'](function(_0x3a4784){console[_0xb496('0x13')](_0x3a4784);});}if(_0x2a17d2[_0xb496('0xd')]===_0xb496('0x14')&&!_0x2a17d2[_0xb496('0xf')]){var _0x17c97c;_0x52fb89[_0xb496('0x15')][_0xb496('0x16')]({'where':{'id':_0x2a17d2[_0xb496('0x17')]},'raw':!![]})[_0xb496('0x12')](function(_0x4c9a84){_0x17c97c=_0x4c9a84;if(_0x17c97c&&_0x17c97c[_0xb496('0x18')]){switch(_0x17c97c['type']){case'twilio':var _0x43d794=require(_0xb496('0x19'));if(_0x17c97c[_0xb496('0x1a')]&&_0x17c97c[_0xb496('0x1b')]&&_0x17c97c[_0xb496('0x1c')]){var _0x532125=new _0x43d794(_0x17c97c[_0xb496('0x1a')],_0x17c97c[_0xb496('0x1b')]);_0x532125[_0xb496('0x1d')][_0xb496('0x1e')]({'body':_0x2a17d2[_0xb496('0x1f')],'to':'whatsapp:'+_0x2a17d2[_0xb496('0x1c')],'from':'whatsapp:'+_0x17c97c[_0xb496('0x1c')],'statusCallback':_0x17c97c[_0xb496('0x20')]+'/api/whatsapp/messages/'+_0x2a17d2['id']+_0xb496('0x21')+_0x17c97c[_0xb496('0x22')]})[_0xb496('0x12')](function(_0x4c8e34){if(_0x4c8e34[_0xb496('0x23')]){return _0x4cbd65[_0xb496('0x24')]({'messageId':_0x4c8e34[_0xb496('0x23')]});}})['catch'](function(_0x589209){logger[_0xb496('0x13')](_0xb496('0x25'),_0xb496('0x26'),_0xb496('0x19'),util[_0xb496('0x27')](_0x589209,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb496('0x25'),_0xb496('0x26'),_0xb496('0x19'),_0xb496('0x28'));}break;case _0xb496('0x29'):var _0x2c001b=_0x17c97c[_0xb496('0x1a')];var _0x4c9783=_0x17c97c[_0xb496('0x1b')];var _0x558901=_0x17c97c[_0xb496('0x2a')]+'/whatsapp/v1/'+_0x2c001b+_0xb496('0x2b');var _0x2cdb3c={'to':[_0x2a17d2[_0xb496('0x1c')]],'message':{'type':'text','text':_0x2a17d2[_0xb496('0x1f')]}};var _0x161978={'method':'POST','uri':_0x558901,'headers':{'Authorization':'Bearer\x20'+_0x4c9783,'Content-Type':_0xb496('0x2c')},'body':_0x2cdb3c,'json':!![]};rp(_0x161978)['then'](function(_0x249a0c){if(_0x249a0c[_0xb496('0x2d')][0x0]['message_id']){return _0x4cbd65['update']({'messageId':_0x249a0c[_0xb496('0x2d')][0x0][_0xb496('0x2e')]});}})[_0xb496('0x2f')](function(_0x2ad450){logger['err'](_0xb496('0x30'),_0x2ad450);});break;}}})[_0xb496('0x31')](function(){_0x474f3e();});}else{_0x474f3e();}}},'charset':_0xb496('0x32'),'collate':_0xb496('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 63b5d53..1253499 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 _0x35e6=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','create','body','options','then','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x498d4f,_0x6e928e){var _0x1c81a8=function(_0x11dd33){while(--_0x11dd33){_0x498d4f['push'](_0x498d4f['shift']());}};_0x1c81a8(++_0x6e928e);}(_0x35e6,0x12e));var _0x635e=function(_0x18e0c9,_0x1cdaeb){_0x18e0c9=_0x18e0c9-0x0;var _0x2c35fd=_0x35e6[_0x18e0c9];return _0x2c35fd;};'use strict';var _=require(_0x635e('0x0'));var util=require(_0x635e('0x1'));var moment=require(_0x635e('0x2'));var BPromise=require('bluebird');var rs=require(_0x635e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x635e('0x4'))['db'];var utils=require(_0x635e('0x5'));var logger=require(_0x635e('0x6'))(_0x635e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x635e('0x8')][_0x635e('0x9')]({'port':0x232a});config[_0x635e('0xa')]=_[_0x635e('0xb')](config[_0x635e('0xa')],{'host':_0x635e('0xc'),'port':0x18eb});var socket=require(_0x635e('0xd'))(new Redis(config[_0x635e('0xa')]));require(_0x635e('0xe'))['register'](socket);function respondWithRpcPromise(_0x503bd3,_0x2b9d33,_0x8c62bd){return new BPromise(function(_0x52bac7,_0x860c32){return client[_0x635e('0xf')](_0x503bd3,_0x8c62bd)['then'](function(_0x2cc9f2){logger[_0x635e('0x10')](_0x635e('0x11'),_0x2b9d33,_0x635e('0x12'));logger[_0x635e('0x13')](_0x635e('0x14'),_0x2b9d33,'request\x20sent',JSON[_0x635e('0x15')](_0x2cc9f2));if(_0x2cc9f2[_0x635e('0x16')]){if(_0x2cc9f2[_0x635e('0x16')]['code']===0x1f4){logger[_0x635e('0x16')](_0x635e('0x11'),_0x2b9d33,_0x2cc9f2['error'][_0x635e('0x17')]);return _0x860c32(_0x2cc9f2['error'][_0x635e('0x17')]);}logger['error'](_0x635e('0x11'),_0x2b9d33,_0x2cc9f2[_0x635e('0x16')]['message']);return _0x52bac7(_0x2cc9f2[_0x635e('0x16')][_0x635e('0x17')]);}else{logger[_0x635e('0x10')](_0x635e('0x11'),_0x2b9d33,_0x635e('0x12'));_0x52bac7(_0x2cc9f2[_0x635e('0x18')]['message']);}})[_0x635e('0x19')](function(_0x471e29){logger[_0x635e('0x16')](_0x635e('0x11'),_0x2b9d33,_0x471e29);_0x860c32(_0x471e29);});});}exports[_0x635e('0x1a')]=function(_0x5aaed3){var _0x293273=this;return new Promise(function(_0x5de1cc,_0x32536a){return db['WhatsappMessage'][_0x635e('0x1b')](_0x5aaed3[_0x635e('0x1c')],{'raw':_0x5aaed3[_0x635e('0x1d')]?_0x5aaed3[_0x635e('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x635e('0x1e')](function(_0x906541){logger[_0x635e('0x10')](_0x635e('0x1a'),_0x5aaed3);logger[_0x635e('0x13')]('CreateWhatsappMessage',_0x5aaed3,JSON[_0x635e('0x15')](_0x906541));_0x5de1cc(_0x906541);})[_0x635e('0x19')](function(_0x16b2bd){logger[_0x635e('0x16')](_0x635e('0x1a'),_0x16b2bd[_0x635e('0x17')],_0x5aaed3);_0x32536a(_0x293273['error'](0x1f4,_0x16b2bd['message']));});});}; \ No newline at end of file +var _0x708b=['catch','CreateWhatsappMessage','create','options','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x708b,0xfd));var _0xb708=function(_0x4cc02f,_0x4030da){_0x4cc02f=_0x4cc02f-0x0;var _0x8100f=_0x708b[_0x4cc02f];return _0x8100f;};'use strict';var _=require('lodash');var util=require(_0xb708('0x0'));var moment=require(_0xb708('0x1'));var BPromise=require(_0xb708('0x2'));var rs=require(_0xb708('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb708('0x4'))['db'];var utils=require(_0xb708('0x5'));var logger=require(_0xb708('0x6'))(_0xb708('0x7'));var config=require(_0xb708('0x8'));var jayson=require(_0xb708('0x9'));var client=jayson[_0xb708('0xa')][_0xb708('0xb')]({'port':0x232a});config['redis']=_[_0xb708('0xc')](config['redis'],{'host':_0xb708('0xd'),'port':0x18eb});var socket=require(_0xb708('0xe'))(new Redis(config[_0xb708('0xf')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5b55d,_0x343eb4,_0x1fd1ed){return new BPromise(function(_0xed2528,_0x35d807){return client[_0xb708('0x10')](_0x5b55d,_0x1fd1ed)['then'](function(_0x1774da){logger[_0xb708('0x11')](_0xb708('0x12'),_0x343eb4,'request\x20sent');logger[_0xb708('0x13')](_0xb708('0x14'),_0x343eb4,'request\x20sent',JSON['stringify'](_0x1774da));if(_0x1774da['error']){if(_0x1774da['error'][_0xb708('0x15')]===0x1f4){logger[_0xb708('0x16')](_0xb708('0x12'),_0x343eb4,_0x1774da['error']['message']);return _0x35d807(_0x1774da[_0xb708('0x16')][_0xb708('0x17')]);}logger['error'](_0xb708('0x12'),_0x343eb4,_0x1774da[_0xb708('0x16')][_0xb708('0x17')]);return _0xed2528(_0x1774da[_0xb708('0x16')][_0xb708('0x17')]);}else{logger[_0xb708('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x343eb4,_0xb708('0x18'));_0xed2528(_0x1774da[_0xb708('0x19')]['message']);}})[_0xb708('0x1a')](function(_0x4b8607){logger[_0xb708('0x16')](_0xb708('0x12'),_0x343eb4,_0x4b8607);_0x35d807(_0x4b8607);});});}exports[_0xb708('0x1b')]=function(_0x394ab1){var _0x3de0bd=this;return new Promise(function(_0x279ddd,_0x53f5b9){return db['WhatsappMessage'][_0xb708('0x1c')](_0x394ab1['body'],{'raw':_0x394ab1[_0xb708('0x1d')]?_0x394ab1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x26c12a){logger[_0xb708('0x11')](_0xb708('0x1b'),_0x394ab1);logger[_0xb708('0x13')]('CreateWhatsappMessage',_0x394ab1,JSON[_0xb708('0x1e')](_0x26c12a));_0x279ddd(_0x26c12a);})['catch'](function(_0x10fb57){logger[_0xb708('0x16')](_0xb708('0x1b'),_0x10fb57[_0xb708('0x17')],_0x394ab1);_0x53f5b9(_0x3de0bd[_0xb708('0x16')](0x1f4,_0x10fb57[_0xb708('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 85895b1..95d1bd8 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 _0x5b5b=['save','remove','update','register','length','whatsappMessage:'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5b5b,0x1ec));var _0xb5b5=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x5b5b[_0x2e0443];return _0x52d450;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xb5b5('0x0'),_0xb5b5('0x1'),_0xb5b5('0x2')];function createListener(_0x58251a,_0x221b4b){return function(_0x2cbbc1){_0x221b4b['emit'](_0x58251a,_0x2cbbc1);};}function removeListener(_0x17945c,_0x1ea638){return function(){WhatsappMessageEvents['removeListener'](_0x17945c,_0x1ea638);};}exports[_0xb5b5('0x3')]=function(_0x54403b){for(var _0x219fb7=0x0,_0x1d4ba3=events[_0xb5b5('0x4')];_0x219fb7<_0x1d4ba3;_0x219fb7++){var _0x5f0324=events[_0x219fb7];var _0x529761=createListener(_0xb5b5('0x5')+_0x5f0324,_0x54403b);WhatsappMessageEvents['on'](_0x5f0324,_0x529761);}}; \ No newline at end of file +var _0x6b3b=['./whatsappMessage.events','save','remove','emit','removeListener','length','whatsappMessage:'];(function(_0x1c026b,_0x1dd90b){var _0x597581=function(_0x4967b8){while(--_0x4967b8){_0x1c026b['push'](_0x1c026b['shift']());}};_0x597581(++_0x1dd90b);}(_0x6b3b,0x1ea));var _0xb6b3=function(_0x3ad69b,_0x2d7f6f){_0x3ad69b=_0x3ad69b-0x0;var _0x469318=_0x6b3b[_0x3ad69b];return _0x469318;};'use strict';var WhatsappMessageEvents=require(_0xb6b3('0x0'));var events=[_0xb6b3('0x1'),_0xb6b3('0x2'),'update'];function createListener(_0x24f80b,_0x354ac4){return function(_0x5430c2){_0x354ac4[_0xb6b3('0x3')](_0x24f80b,_0x5430c2);};}function removeListener(_0x5b11c8,_0x303a55){return function(){WhatsappMessageEvents[_0xb6b3('0x4')](_0x5b11c8,_0x303a55);};}exports['register']=function(_0x1ad69b){for(var _0x2e60a1=0x0,_0x3933da=events[_0xb6b3('0x5')];_0x2e60a1<_0x3933da;_0x2e60a1++){var _0x3910a2=events[_0x2e60a1];var _0x3d4574=createListener(_0xb6b3('0x6')+_0x3910a2,_0x1ad69b);WhatsappMessageEvents['on'](_0x3910a2,_0x3d4574);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c9103c7..693ae3c 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 _0x7110=['../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','/:id/users','addAgents','put','update','delete','destroy','/:id/teams','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7110,0xca));var _0x0711=function(_0x1a514e,_0x269f87){_0x1a514e=_0x1a514e-0x0;var _0x1b2456=_0x7110[_0x1a514e];return _0x1b2456;};'use strict';var multer=require(_0x0711('0x0'));var util=require('util');var path=require(_0x0711('0x1'));var timeout=require(_0x0711('0x2'));var express=require(_0x0711('0x3'));var router=express['Router']();var fs_extra=require(_0x0711('0x4'));var auth=require(_0x0711('0x5'));var interaction=require(_0x0711('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x0711('0x7')](),controller[_0x0711('0x8')]);router[_0x0711('0x9')](_0x0711('0xa'),auth[_0x0711('0x7')](),controller[_0x0711('0xb')]);router[_0x0711('0x9')](_0x0711('0xc'),auth[_0x0711('0x7')](),controller[_0x0711('0xd')]);router[_0x0711('0x9')](_0x0711('0xe'),auth['isAuthenticated'](),controller[_0x0711('0xf')]);router[_0x0711('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x0711('0x10')]);router[_0x0711('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x0711('0x11')]);router[_0x0711('0x12')]('/',auth[_0x0711('0x7')](),controller['create']);router[_0x0711('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x0711('0x12')](_0x0711('0x13'),auth['isAuthenticated'](),controller[_0x0711('0x14')]);router[_0x0711('0x15')](_0x0711('0xc'),auth[_0x0711('0x7')](),controller[_0x0711('0x16')]);router[_0x0711('0x17')]('/:id',auth[_0x0711('0x7')](),controller[_0x0711('0x18')]);router['delete'](_0x0711('0x19'),auth[_0x0711('0x7')](),controller['removeTeams']);router[_0x0711('0x17')](_0x0711('0x13'),auth[_0x0711('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8eeb=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy','removeAgents'];(function(_0x1caedc,_0x5af999){var _0x477add=function(_0x22fd7b){while(--_0x22fd7b){_0x1caedc['push'](_0x1caedc['shift']());}};_0x477add(++_0x5af999);}(_0x8eeb,0xb5));var _0xb8ee=function(_0x3d3614,_0x51f639){_0x3d3614=_0x3d3614-0x0;var _0x3b2dbc=_0x8eeb[_0x3d3614];return _0x3b2dbc;};'use strict';var multer=require('multer');var util=require(_0xb8ee('0x0'));var path=require(_0xb8ee('0x1'));var timeout=require(_0xb8ee('0x2'));var express=require(_0xb8ee('0x3'));var router=express[_0xb8ee('0x4')]();var fs_extra=require(_0xb8ee('0x5'));var auth=require(_0xb8ee('0x6'));var interaction=require(_0xb8ee('0x7'));var config=require('../../config/environment');var controller=require(_0xb8ee('0x8'));router['get']('/',auth[_0xb8ee('0x9')](),controller[_0xb8ee('0xa')]);router[_0xb8ee('0xb')](_0xb8ee('0xc'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0xd')]);router[_0xb8ee('0xb')](_0xb8ee('0xe'),auth['isAuthenticated'](),controller[_0xb8ee('0xf')]);router[_0xb8ee('0xb')](_0xb8ee('0x10'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x11')]);router[_0xb8ee('0xb')](_0xb8ee('0x12'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xb8ee('0x13'),auth['isAuthenticated'](),controller[_0xb8ee('0x14')]);router['post']('/',auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x15')]);router[_0xb8ee('0x16')](_0xb8ee('0x12'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x17')]);router['post'](_0xb8ee('0x13'),auth[_0xb8ee('0x9')](),controller['addAgents']);router[_0xb8ee('0x18')](_0xb8ee('0xe'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x19')]);router[_0xb8ee('0x1a')](_0xb8ee('0xe'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x1b')]);router['delete']('/:id/teams',auth[_0xb8ee('0x9')](),controller['removeTeams']);router['delete'](_0xb8ee('0x13'),auth[_0xb8ee('0x9')](),controller[_0xb8ee('0x1c')]);module[_0xb8ee('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 33741e5..2f4a4a1 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 _0xa446=['sequelize','exports','name','ENUM','beepall','STRING'];(function(_0x2ec91a,_0x1c5d39){var _0x19ea39=function(_0x203999){while(--_0x203999){_0x2ec91a['push'](_0x2ec91a['shift']());}};_0x19ea39(++_0x1c5d39);}(_0xa446,0xc6));var _0x6a44=function(_0xa56d53,_0x3b264a){_0xa56d53=_0xa56d53-0x0;var _0x503a7e=_0xa446[_0xa56d53];return _0x503a7e;};'use strict';var Sequelize=require(_0x6a44('0x0'));module[_0x6a44('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6a44('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a44('0x3')]('rrmemory',_0x6a44('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x6a44('0x5')]}}; \ No newline at end of file +var _0xd87e=['exports','name','INTEGER','ENUM','beepall','STRING','sequelize'];(function(_0x1d8b1d,_0x11d691){var _0x109ed1=function(_0x5a9dab){while(--_0x5a9dab){_0x1d8b1d['push'](_0x1d8b1d['shift']());}};_0x109ed1(++_0x11d691);}(_0xd87e,0x1bf));var _0xed87=function(_0x4f4d5f,_0x6d3210){_0x4f4d5f=_0x4f4d5f-0x0;var _0x51d83e=_0xd87e[_0x4f4d5f];return _0x51d83e;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xed87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xed87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed87('0x4')]('rrmemory',_0xed87('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xed87('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index eb1d41f..04dafdf 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 _0xe69b=['omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','fieldName','type','getOptions','WhatsappQueue','include','query','findAll','rows','catch','show','model','rawAttributes','keys','attributes','intersection','fields','length','includeAll','merge','options','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','filters','WhatsappQueueId','filter','findAndCountAll','UserId','updatedAt','createdAt','format','getTeams','pick','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','addAgents'];(function(_0x481520,_0x5b9e16){var _0x3298a2=function(_0x1f6dab){while(--_0x1f6dab){_0x481520['push'](_0x481520['shift']());}};_0x3298a2(++_0x5b9e16);}(_0xe69b,0x168));var _0xbe69=function(_0x17dead,_0x1fe916){_0x17dead=_0x17dead-0x0;var _0x359f57=_0xe69b[_0x17dead];return _0x359f57;};'use strict';var BPromise=require(_0xbe69('0x0'));var util=require('util');var _=require(_0xbe69('0x1'));var squel=require(_0xbe69('0x2'));var Redis=require(_0xbe69('0x3'));var qs=require(_0xbe69('0x4'));var logger=require(_0xbe69('0x5'))(_0xbe69('0x6'));var config=require('../../config/environment');var db=require(_0xbe69('0x7'))['db'];config['redis']=_[_0xbe69('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe69('0x9')]));require(_0xbe69('0xa'))['register'](socket);function respondWithStatusCode(_0x1a5a73,_0x260bc8){_0x260bc8=_0x260bc8||0xcc;return function(_0xe78732){if(_0xe78732){return _0x1a5a73[_0xbe69('0xb')](_0x260bc8);}return _0x1a5a73[_0xbe69('0xc')](_0x260bc8)[_0xbe69('0xd')]();};}function respondWithResult(_0x515c07,_0xe7985a){_0xe7985a=_0xe7985a||0xc8;return function(_0x580c0d){if(_0x580c0d){return _0x515c07[_0xbe69('0xc')](_0xe7985a)['json'](_0x580c0d);}};}function respondWithFilteredResult(_0x1af305,_0x21a6a6){return function(_0x9ec590){if(_0x9ec590){var _0x535e5e=typeof _0x21a6a6[_0xbe69('0xe')]===_0xbe69('0xf')&&typeof _0x21a6a6[_0xbe69('0x10')]===_0xbe69('0xf');var _0x437edd=_0x9ec590[_0xbe69('0x11')];var _0x369639=_0x535e5e?0x0:_0x21a6a6[_0xbe69('0xe')];var _0x29b7a6=_0x535e5e?_0x9ec590[_0xbe69('0x11')]:_0x21a6a6[_0xbe69('0xe')]+_0x21a6a6[_0xbe69('0x10')];var _0x720ce8;if(_0x29b7a6>=_0x437edd){_0x29b7a6=_0x437edd;_0x720ce8=0xc8;}else{_0x720ce8=0xce;}_0x1af305[_0xbe69('0xc')](_0x720ce8);return _0x1af305[_0xbe69('0x12')]('Content-Range',_0x369639+'-'+_0x29b7a6+'/'+_0x437edd)[_0xbe69('0x13')](_0x9ec590);}return null;};}function saveUpdates(_0x255989){return function(_0x317b40){if(_0x317b40){return _0x317b40[_0xbe69('0x14')](_0x255989)[_0xbe69('0x15')](function(_0x1e2b57){return _0x1e2b57;});}return null;};}function removeEntity(_0x2f01a){return function(_0x372fbf){if(_0x372fbf){return _0x372fbf[_0xbe69('0x16')]()[_0xbe69('0x15')](function(){var _0x67db0d=_0x372fbf['get']({'plain':!![]});var _0xa7d000=_0xbe69('0x17');return db[_0xbe69('0x18')]['destroy']({'where':{'type':_0xa7d000,'resourceId':_0x67db0d['id']}})['then'](function(){return _0x372fbf;});})[_0xbe69('0x15')](function(){_0x2f01a['status'](0xcc)[_0xbe69('0xd')]();});}};}function handleEntityNotFound(_0x12f36c){return function(_0x43e438){if(!_0x43e438){_0x12f36c[_0xbe69('0xb')](0x194);}return _0x43e438;};}function handleError(_0x3f9fe9,_0x3a9c44){_0x3a9c44=_0x3a9c44||0x1f4;return function(_0x23e325){logger[_0xbe69('0x19')](_0x23e325[_0xbe69('0x1a')]);if(_0x23e325[_0xbe69('0x1b')]){delete _0x23e325[_0xbe69('0x1b')];}_0x3f9fe9['status'](_0x3a9c44)[_0xbe69('0x1c')](_0x23e325);};}exports[_0xbe69('0x1d')]=function(_0x489a4e,_0x53769e){var _0x15227d={};var _0x1e053d={'count':0x0,'rows':[]};var _0x84150=_[_0xbe69('0x1e')](db['WhatsappQueue']['rawAttributes'],function(_0x3a44c7){return{'name':_0x3a44c7[_0xbe69('0x1f')],'type':_0x3a44c7[_0xbe69('0x20')]['key']};});_0x15227d=qs[_0xbe69('0x21')](_0x84150,_0x489a4e);var _0x43e65a={'where':_0x15227d['where']};return db[_0xbe69('0x22')][_0xbe69('0x11')](_0x43e65a)[_0xbe69('0x15')](function(_0x55d9b8){_0x1e053d[_0xbe69('0x11')]=_0x55d9b8;_0x15227d['include']=qs[_0xbe69('0x23')](_0x489a4e[_0xbe69('0x24')]);return db[_0xbe69('0x22')][_0xbe69('0x25')](_0x15227d);})['then'](function(_0x3e5cd5){_0x1e053d[_0xbe69('0x26')]=_0x3e5cd5;return _0x1e053d;})[_0xbe69('0x15')](respondWithFilteredResult(_0x53769e,_0x15227d))[_0xbe69('0x27')](handleError(_0x53769e,null));};exports[_0xbe69('0x28')]=function(_0x3fa4a9,_0x4181af){var _0xf4d73={'raw':!![],'where':{'id':_0x3fa4a9['params']['id']}},_0x23b9c0={};_0x23b9c0[_0xbe69('0x29')]=_['keys'](db['WhatsappQueue'][_0xbe69('0x2a')]);_0x23b9c0[_0xbe69('0x24')]=_[_0xbe69('0x2b')](_0x3fa4a9[_0xbe69('0x24')]);_0x23b9c0['filters']=_['intersection'](_0x23b9c0[_0xbe69('0x29')],_0x23b9c0[_0xbe69('0x24')]);_0xf4d73[_0xbe69('0x2c')]=_[_0xbe69('0x2d')](_0x23b9c0[_0xbe69('0x29')],qs['fields'](_0x3fa4a9[_0xbe69('0x24')][_0xbe69('0x2e')]));_0xf4d73[_0xbe69('0x2c')]=_0xf4d73[_0xbe69('0x2c')][_0xbe69('0x2f')]?_0xf4d73[_0xbe69('0x2c')]:_0x23b9c0[_0xbe69('0x29')];if(_0x3fa4a9['query'][_0xbe69('0x30')]){_0xf4d73['include']=[{'all':!![]}];}_0xf4d73=_[_0xbe69('0x31')]({},_0xf4d73,_0x3fa4a9[_0xbe69('0x32')]);return db[_0xbe69('0x22')][_0xbe69('0x33')](_0xf4d73)[_0xbe69('0x15')](handleEntityNotFound(_0x4181af,null))['then'](respondWithResult(_0x4181af,null))[_0xbe69('0x27')](handleError(_0x4181af,null));};exports[_0xbe69('0x34')]=function(_0x34d91c,_0xa980f3){return db['WhatsappQueue'][_0xbe69('0x34')](_0x34d91c['body'],{})[_0xbe69('0x15')](function(_0x4cc9e3){var _0x5cf6db=_0x34d91c[_0xbe69('0x35')][_0xbe69('0x36')]({'plain':!![]});if(!_0x5cf6db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cf6db['role']===_0xbe69('0x35')){var _0x4ce0c3=_0x4cc9e3[_0xbe69('0x36')]({'plain':!![]});var _0xc2477c=_0xbe69('0x17');return db[_0xbe69('0x37')][_0xbe69('0x33')]({'where':{'name':_0xc2477c,'userProfileId':_0x5cf6db[_0xbe69('0x38')]},'raw':!![]})[_0xbe69('0x15')](function(_0x5cb5f3){if(_0x5cb5f3&&_0x5cb5f3[_0xbe69('0x39')]===0x0){return db['UserProfileResource'][_0xbe69('0x34')]({'name':_0x4ce0c3['name'],'resourceId':_0x4ce0c3['id'],'type':_0x5cb5f3[_0xbe69('0x1b')],'sectionId':_0x5cb5f3['id']},{})[_0xbe69('0x15')](function(){return _0x4cc9e3;});}else{return _0x4cc9e3;}})[_0xbe69('0x27')](function(_0x31ecb7){logger[_0xbe69('0x19')](_0xbe69('0x3a'),_0x31ecb7);throw _0x31ecb7;});}return _0x4cc9e3;})[_0xbe69('0x15')](respondWithResult(_0xa980f3,0xc9))[_0xbe69('0x27')](handleError(_0xa980f3,null));};exports['update']=function(_0x46bdac,_0x1eac85){if(_0x46bdac[_0xbe69('0x3b')]['id']){delete _0x46bdac['body']['id'];}return db[_0xbe69('0x22')][_0xbe69('0x33')]({'where':{'id':_0x46bdac[_0xbe69('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1eac85,null))[_0xbe69('0x15')](saveUpdates(_0x46bdac[_0xbe69('0x3b')],null))[_0xbe69('0x15')](respondWithResult(_0x1eac85,null))['catch'](handleError(_0x1eac85,null));};exports[_0xbe69('0x16')]=function(_0x2a156f,_0x2fce77){return db[_0xbe69('0x22')][_0xbe69('0x33')]({'where':{'id':_0x2a156f[_0xbe69('0x3c')]['id']}})[_0xbe69('0x15')](handleEntityNotFound(_0x2fce77,null))[_0xbe69('0x15')](removeEntity(_0x2fce77,null))['catch'](handleError(_0x2fce77,null));};exports['describe']=function(_0x56c05b,_0xfe9d16){return db[_0xbe69('0x22')]['describe']()[_0xbe69('0x15')](respondWithResult(_0xfe9d16,null))['catch'](handleError(_0xfe9d16,null));};exports[_0xbe69('0x3d')]=function(_0x1eab87,_0x3a7fc5){var _0x31ba88={'raw':!![],'where':{}},_0x5150e1={},_0x42141f;return db[_0xbe69('0x22')][_0xbe69('0x3e')]({'where':{'id':_0x1eab87[_0xbe69('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3a7fc5,null))[_0xbe69('0x15')](function(_0x26025c){if(_0x26025c){_0x42141f=_0x26025c[_0xbe69('0x36')]({'plain':!![]});_0x5150e1[_0xbe69('0x29')]=_[_0xbe69('0x2b')](db[_0xbe69('0x3f')]['rawAttributes']);_0x5150e1[_0xbe69('0x24')]=_[_0xbe69('0x2b')](_0x1eab87[_0xbe69('0x24')]);_0x5150e1['filters']=_[_0xbe69('0x2d')](_0x5150e1[_0xbe69('0x29')],_0x5150e1['query']);_0x31ba88['attributes']=_[_0xbe69('0x2d')](_0x5150e1['model'],qs['fields'](_0x1eab87['query'][_0xbe69('0x2e')]));_0x31ba88[_0xbe69('0x2c')]=_0x31ba88[_0xbe69('0x2c')]['length']?_0x31ba88['attributes']:_0x5150e1[_0xbe69('0x29')];if(!_0x1eab87[_0xbe69('0x24')][_0xbe69('0x40')](_0xbe69('0x41'))){_0x31ba88[_0xbe69('0x10')]=qs[_0xbe69('0x10')](_0x1eab87[_0xbe69('0x24')]['limit']);_0x31ba88[_0xbe69('0xe')]=qs['offset'](_0x1eab87[_0xbe69('0x24')][_0xbe69('0xe')]);}_0x31ba88[_0xbe69('0x42')]=qs[_0xbe69('0x43')](_0x1eab87[_0xbe69('0x24')][_0xbe69('0x43')]);_0x31ba88[_0xbe69('0x44')]=qs[_0xbe69('0x45')](_['pick'](_0x1eab87[_0xbe69('0x24')],_0x5150e1[_0xbe69('0x45')]));_0x31ba88[_0xbe69('0x44')][_0xbe69('0x46')]=_0x26025c['id'];if(_0x1eab87['query']['filter']){_0x31ba88[_0xbe69('0x44')]=_[_0xbe69('0x31')](_0x31ba88[_0xbe69('0x44')],{'$or':_['map'](_0x31ba88[_0xbe69('0x2c')],function(_0xadc054){var _0x358e6b={};_0x358e6b[_0xadc054]={'$like':'%'+_0x1eab87[_0xbe69('0x24')][_0xbe69('0x47')]+'%'};return _0x358e6b;})});}_0x31ba88=_[_0xbe69('0x31')]({},_0x31ba88,_0x1eab87[_0xbe69('0x32')]);return db['UserWhatsappQueue']['findAll'](_0x31ba88);}})['then'](function(_0x4926bc){if(_0x4926bc){return db['User'][_0xbe69('0x48')]({'where':{'id':_['map'](_0x4926bc,_0xbe69('0x49')),'role':'agent'},'attributes':['id','name','whatsappPause',_0xbe69('0x4a'),_0xbe69('0x4b')]});}})[_0xbe69('0x15')](function(_0xaae35){if(_0xaae35){return{'count':_0xaae35[_0xbe69('0x11')],'rows':_[_0xbe69('0x1e')](_0xaae35['rows'],function(_0x27bffb){return{'membername':_0x27bffb[_0xbe69('0x1b')],'UserId':_0x27bffb['id'],'queue_name':_0x42141f['name'],'WhatsappQueueId':_0x42141f['id'],'interface':util[_0xbe69('0x4c')]('%s/%s','SIP',_0x27bffb[_0xbe69('0x1b')]),'penalty':0x0,'paused':_0x27bffb['whatsappPause'],'createdAt':_0x27bffb[_0xbe69('0x4b')],'updatedAt':_0x27bffb[_0xbe69('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a7fc5,_0x31ba88))[_0xbe69('0x27')](handleError(_0x3a7fc5,null));};exports[_0xbe69('0x4d')]=function(_0x3d0aad,_0x207d9c){var _0x80852d={};var _0x4fe289={};var _0x62e136;var _0x44ed3a;return db['WhatsappQueue'][_0xbe69('0x3e')]({'where':{'id':_0x3d0aad['params']['id']}})['then'](handleEntityNotFound(_0x207d9c,null))[_0xbe69('0x15')](function(_0x9f4a15){if(_0x9f4a15){_0x62e136=_0x9f4a15;_0x4fe289['model']=_['keys'](db['Team']['rawAttributes']);_0x4fe289[_0xbe69('0x24')]=_['keys'](_0x3d0aad[_0xbe69('0x24')]);_0x4fe289[_0xbe69('0x45')]=_['intersection'](_0x4fe289[_0xbe69('0x29')],_0x4fe289[_0xbe69('0x24')]);_0x80852d[_0xbe69('0x2c')]=_[_0xbe69('0x2d')](_0x4fe289[_0xbe69('0x29')],qs[_0xbe69('0x2e')](_0x3d0aad['query'][_0xbe69('0x2e')]));_0x80852d[_0xbe69('0x2c')]=_0x80852d['attributes'][_0xbe69('0x2f')]?_0x80852d[_0xbe69('0x2c')]:_0x4fe289['model'];_0x80852d[_0xbe69('0x42')]=qs[_0xbe69('0x43')](_0x3d0aad['query'][_0xbe69('0x43')]);_0x80852d['where']=qs[_0xbe69('0x45')](_[_0xbe69('0x4e')](_0x3d0aad[_0xbe69('0x24')],_0x4fe289[_0xbe69('0x45')]));if(_0x3d0aad[_0xbe69('0x24')]['filter']){_0x80852d['where']=_[_0xbe69('0x31')](_0x80852d[_0xbe69('0x44')],{'$or':_[_0xbe69('0x1e')](_0x80852d['attributes'],function(_0x23a24f){var _0x204ae1={};_0x204ae1[_0x23a24f]={'$like':'%'+_0x3d0aad[_0xbe69('0x24')][_0xbe69('0x47')]+'%'};return _0x204ae1;})});}_0x80852d=_[_0xbe69('0x31')]({},_0x80852d,_0x3d0aad[_0xbe69('0x32')]);return _0x62e136[_0xbe69('0x4d')](_0x80852d);}})[_0xbe69('0x15')](function(_0x137fb7){if(_0x137fb7){_0x44ed3a=_0x137fb7['length'];if(!_0x3d0aad['query']['hasOwnProperty']('nolimit')){_0x80852d[_0xbe69('0x10')]=qs[_0xbe69('0x10')](_0x3d0aad[_0xbe69('0x24')][_0xbe69('0x10')]);_0x80852d[_0xbe69('0xe')]=qs[_0xbe69('0xe')](_0x3d0aad[_0xbe69('0x24')][_0xbe69('0xe')]);}return _0x62e136[_0xbe69('0x4d')](_0x80852d);}})[_0xbe69('0x15')](function(_0x31d6a6){if(_0x31d6a6){return _0x31d6a6?{'count':_0x44ed3a,'rows':_0x31d6a6}:null;}})[_0xbe69('0x15')](respondWithResult(_0x207d9c,null))['catch'](handleError(_0x207d9c,null));};exports[_0xbe69('0x4f')]=function(_0x500068,_0x206831){var _0x3dabcb=_0x500068[_0xbe69('0x3b')][_0xbe69('0x50')];return db[_0xbe69('0x51')][_0xbe69('0x25')]({'where':{'id':_0x3dabcb},'attributes':['id'],'include':[{'model':db[_0xbe69('0x52')],'as':_0xbe69('0x53'),'attributes':['id','name',_0xbe69('0x54'),_0xbe69('0x55'),_0xbe69('0x56')],'raw':!![]}]})[_0xbe69('0x15')](function(_0x5b22f2){if(_0x5b22f2){var _0x239d01=_[_0xbe69('0x57')](_0x5b22f2,function(_0x4f839a){var _0x2bd093=_0x4f839a[_0xbe69('0x36')]({'plain':!![]});return _0x2bd093['Agents'];});return db[_0xbe69('0x22')][_0xbe69('0x33')]({'where':{'id':_0x500068['params']['id']}})[_0xbe69('0x15')](function(_0xc44c9){return db[_0xbe69('0x58')]['transaction'](function(_0x1e28d4){return _0xc44c9[_0xbe69('0x4f')](_0x3dabcb,{'transaction':_0x1e28d4})[_0xbe69('0x15')](function(){return BPromise[_0xbe69('0x59')](_0x239d01,function(_0x19fef7){return db[_0xbe69('0x3f')][_0xbe69('0x5a')]({'where':{'UserId':_0x19fef7['id'],'WhatsappQueueId':_0x500068[_0xbe69('0x3c')]['id']},'transaction':_0x1e28d4});});})[_0xbe69('0x15')](function(){_0x239d01[_0xbe69('0x5b')](function(_0x5a9724){socket[_0xbe69('0x5c')]('userWhatsappQueue:save',{'UserId':_0x5a9724['id'],'WhatsappQueueId':_0xc44c9['id']});});});});});}})[_0xbe69('0x15')](respondWithStatusCode(_0x206831,null))['catch'](handleError(_0x206831,null));};exports[_0xbe69('0x5d')]=function(_0x4fdb52,_0x313374){return db[_0xbe69('0x51')][_0xbe69('0x25')]({'where':{'id':_0x4fdb52[_0xbe69('0x24')][_0xbe69('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe69('0x15')](handleEntityNotFound(_0x313374,null))[_0xbe69('0x15')](function(_0x1a6e8f){var _0x5aa3bc=_[_0xbe69('0x1e')](_0x1a6e8f,'id');var _0x15ee24=[];var _0x48ed46=[];var _0x5adbbf=squel['select']();_0x5adbbf['field']('tq.TeamId')[_0xbe69('0x5e')](_0xbe69('0x5f'),'tq')['join'](_0xbe69('0x60'),'ut',_0xbe69('0x61'))[_0xbe69('0x44')]('WhatsappQueueId\x20=\x20?',_0x4fdb52['params']['id']);for(var _0x1f4c84=0x0;_0x1f4c84<_0x1a6e8f[_0xbe69('0x2f')];_0x1f4c84+=0x1){let _0x1cae08=_0x1a6e8f[_0x1f4c84];for(var _0x3016a0=0x0;_0x3016a0<_0x1cae08['Agents']['length'];_0x3016a0+=0x1){let _0x334a57=_0x1cae08['Agents'][_0x3016a0];var _0xf309b7=_0x5adbbf[_0xbe69('0x62')]();_0xf309b7[_0xbe69('0x44')]('ut.UserId\x20=\x20?',_0x334a57['id']);_0x48ed46[_0xbe69('0x63')](db['sequelize']['query'](_0xf309b7[_0xbe69('0x64')](),{'type':db[_0xbe69('0x58')]['QueryTypes'][_0xbe69('0x65')]})['then'](function(_0x3195c8){if(_0x3195c8[_0xbe69('0x2f')]===0x1){return _0x334a57['id'];}else{var _0x358c4b=_[_0xbe69('0x66')](_[_0xbe69('0x1e')](_0x3195c8,_0xbe69('0x67')),function(_0xc74804){return _[_0xbe69('0x68')](_0x5aa3bc,_0xc74804);});if(_0x358c4b){return _0x334a57['id'];}}}));}}return BPromise[_0xbe69('0x69')](_0x48ed46)[_0xbe69('0x15')](function(_0x5be787){_0x15ee24=_(_0x15ee24)[_0xbe69('0x6a')](_0x5be787)['compact']()[_0xbe69('0x6b')]();return db[_0xbe69('0x22')][_0xbe69('0x33')]({'where':{'id':_0x4fdb52[_0xbe69('0x3c')]['id']}})[_0xbe69('0x15')](function(_0x2a84b5){return db['sequelize'][_0xbe69('0x6c')](function(_0x722794){return _0x2a84b5[_0xbe69('0x5d')](_0x4fdb52[_0xbe69('0x24')][_0xbe69('0x50')],{'transaction':_0x722794})[_0xbe69('0x15')](function(){if(!_[_0xbe69('0x6d')](_0x15ee24)){return _0x2a84b5[_0xbe69('0x6e')](_0x15ee24,{'transaction':_0x722794});}})[_0xbe69('0x15')](function(){_0x15ee24[_0xbe69('0x5b')](function(_0x9caa71){socket[_0xbe69('0x5c')]('userWhatsappQueue:remove',{'UserId':_0x9caa71,'WhatsappQueueId':_0x2a84b5['id']});});});});});});})[_0xbe69('0x15')](respondWithStatusCode(_0x313374,null))[_0xbe69('0x27')](handleError(_0x313374,null));};exports['addAgents']=function(_0x2d0ed7,_0x5621aa){return db['WhatsappQueue'][_0xbe69('0x33')]({'where':{'id':_0x2d0ed7[_0xbe69('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5621aa,null))['then'](function(_0x18ae44){if(_0x18ae44){return _0x18ae44[_0xbe69('0x6f')](_0x2d0ed7[_0xbe69('0x3b')][_0xbe69('0x50')],_[_0xbe69('0x70')](_0x2d0ed7[_0xbe69('0x3b')],[_0xbe69('0x50'),'id'])||{})[_0xbe69('0x71')](function(_0x17fb27){for(var _0x2e0e33=0x0;_0x2e0e33<_0x2d0ed7[_0xbe69('0x3b')][_0xbe69('0x50')][_0xbe69('0x2f')];_0x2e0e33+=0x1){socket[_0xbe69('0x5c')](_0xbe69('0x72'),{'UserId':Number(_0x2d0ed7[_0xbe69('0x3b')][_0xbe69('0x50')][_0x2e0e33]),'WhatsappQueueId':Number(_0x2d0ed7[_0xbe69('0x3c')]['id'])});}return _0x17fb27;});}})['then'](respondWithResult(_0x5621aa,null))['catch'](handleError(_0x5621aa,null));};exports[_0xbe69('0x6e')]=function(_0x19dbce,_0x206768){return db['WhatsappQueue'][_0xbe69('0x33')]({'where':{'id':_0x19dbce[_0xbe69('0x3c')]['id']}})[_0xbe69('0x15')](handleEntityNotFound(_0x206768,null))[_0xbe69('0x15')](function(_0x36c491){if(_0x36c491){return _0x36c491[_0xbe69('0x6e')](_0x19dbce[_0xbe69('0x24')][_0xbe69('0x50')])[_0xbe69('0x15')](function(){if(_[_0xbe69('0x73')](_0x19dbce[_0xbe69('0x24')][_0xbe69('0x50')])){for(var _0x35c276=0x0;_0x35c276<_0x19dbce[_0xbe69('0x24')][_0xbe69('0x50')][_0xbe69('0x2f')];_0x35c276+=0x1){socket[_0xbe69('0x5c')](_0xbe69('0x74'),{'UserId':Number(_0x19dbce[_0xbe69('0x24')][_0xbe69('0x50')][_0x35c276]),'WhatsappQueueId':Number(_0x19dbce['params']['id'])});}}else{socket['emit'](_0xbe69('0x74'),{'UserId':Number(_0x19dbce['query']['ids']),'WhatsappQueueId':Number(_0x19dbce[_0xbe69('0x3c')]['id'])});}});}})[_0xbe69('0x15')](respondWithStatusCode(_0x206768,null))[_0xbe69('0x27')](handleError(_0x206768,null));};exports[_0xbe69('0x75')]=function(_0x4f0394,_0x26b9de){var _0x58a360={};var _0x40e8dc={};var _0x102ecc;var _0xa84c60;return db[_0xbe69('0x22')][_0xbe69('0x3e')]({'where':{'id':_0x4f0394[_0xbe69('0x3c')]['id']}})['then'](handleEntityNotFound(_0x26b9de,null))[_0xbe69('0x15')](function(_0x55ac62){if(_0x55ac62){_0x102ecc=_0x55ac62;_0x40e8dc[_0xbe69('0x29')]=_[_0xbe69('0x2b')](db['User'][_0xbe69('0x2a')]);_0x40e8dc['query']=_[_0xbe69('0x2b')](_0x4f0394[_0xbe69('0x24')]);_0x40e8dc[_0xbe69('0x45')]=_['intersection'](_0x40e8dc['model'],_0x40e8dc[_0xbe69('0x24')]);_0x58a360[_0xbe69('0x2c')]=_[_0xbe69('0x2d')](_0x40e8dc['model'],qs['fields'](_0x4f0394[_0xbe69('0x24')][_0xbe69('0x2e')]));_0x58a360[_0xbe69('0x2c')]=_0x58a360['attributes'][_0xbe69('0x2f')]?_0x58a360[_0xbe69('0x2c')]:_0x40e8dc[_0xbe69('0x29')];_0x58a360[_0xbe69('0x42')]=qs['sort'](_0x4f0394['query'][_0xbe69('0x43')]);_0x58a360[_0xbe69('0x44')]=qs[_0xbe69('0x45')](_[_0xbe69('0x4e')](_0x4f0394[_0xbe69('0x24')],_0x40e8dc[_0xbe69('0x45')]));if(_0x4f0394[_0xbe69('0x24')][_0xbe69('0x47')]){_0x58a360['where']=_[_0xbe69('0x31')](_0x58a360['where'],{'$or':_[_0xbe69('0x1e')](_0x58a360['attributes'],function(_0x3abf6d){var _0x103135={};_0x103135[_0x3abf6d]={'$like':'%'+_0x4f0394[_0xbe69('0x24')][_0xbe69('0x47')]+'%'};return _0x103135;})});}_0x58a360=_[_0xbe69('0x31')]({},_0x58a360,_0x4f0394[_0xbe69('0x32')]);return _0x102ecc['getAgents'](_0x58a360);}})['then'](function(_0x61f5cd){if(_0x61f5cd){_0xa84c60=_0x61f5cd['length'];if(!_0x4f0394[_0xbe69('0x24')][_0xbe69('0x40')](_0xbe69('0x41'))){_0x58a360[_0xbe69('0x10')]=qs[_0xbe69('0x10')](_0x4f0394[_0xbe69('0x24')][_0xbe69('0x10')]);_0x58a360[_0xbe69('0xe')]=qs[_0xbe69('0xe')](_0x4f0394['query'][_0xbe69('0xe')]);}return _0x102ecc[_0xbe69('0x75')](_0x58a360);}})[_0xbe69('0x15')](function(_0x170fe6){if(_0x170fe6){return _0x170fe6?{'count':_0xa84c60,'rows':_0x170fe6}:null;}})[_0xbe69('0x15')](respondWithResult(_0x26b9de,null))[_0xbe69('0x27')](handleError(_0x26b9de,null));}; \ No newline at end of file +var _0x090d=['sequelize','toString','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','where','include','findAll','rows','show','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','sort','pick','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','ids','User','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x3d1996,_0x1f08f0){var _0x550afd=function(_0xb3b511){while(--_0xb3b511){_0x3d1996['push'](_0x3d1996['shift']());}};_0x550afd(++_0x1f08f0);}(_0x090d,0x105));var _0xd090=function(_0x56e4a7,_0x4db6cb){_0x56e4a7=_0x56e4a7-0x0;var _0x43a822=_0x090d[_0x56e4a7];return _0x43a822;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd090('0x0'));var squel=require(_0xd090('0x1'));var Redis=require(_0xd090('0x2'));var qs=require(_0xd090('0x3'));var logger=require(_0xd090('0x4'))(_0xd090('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd090('0x6')]=_[_0xd090('0x7')](config[_0xd090('0x6')],{'host':_0xd090('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd090('0x9'))[_0xd090('0xa')](socket);function respondWithStatusCode(_0xbecceb,_0x32ae14){_0x32ae14=_0x32ae14||0xcc;return function(_0x133acf){if(_0x133acf){return _0xbecceb[_0xd090('0xb')](_0x32ae14);}return _0xbecceb[_0xd090('0xc')](_0x32ae14)[_0xd090('0xd')]();};}function respondWithResult(_0x3c27aa,_0xfbd460){_0xfbd460=_0xfbd460||0xc8;return function(_0x48ca95){if(_0x48ca95){return _0x3c27aa['status'](_0xfbd460)[_0xd090('0xe')](_0x48ca95);}};}function respondWithFilteredResult(_0x10206a,_0x2911f1){return function(_0x373ce6){if(_0x373ce6){var _0x39bf62=typeof _0x2911f1[_0xd090('0xf')]===_0xd090('0x10')&&typeof _0x2911f1[_0xd090('0x11')]===_0xd090('0x10');var _0x1cd440=_0x373ce6[_0xd090('0x12')];var _0xb84eb5=_0x39bf62?0x0:_0x2911f1[_0xd090('0xf')];var _0x2ab897=_0x39bf62?_0x373ce6['count']:_0x2911f1[_0xd090('0xf')]+_0x2911f1['limit'];var _0x16a7b1;if(_0x2ab897>=_0x1cd440){_0x2ab897=_0x1cd440;_0x16a7b1=0xc8;}else{_0x16a7b1=0xce;}_0x10206a[_0xd090('0xc')](_0x16a7b1);return _0x10206a[_0xd090('0x13')](_0xd090('0x14'),_0xb84eb5+'-'+_0x2ab897+'/'+_0x1cd440)[_0xd090('0xe')](_0x373ce6);}return null;};}function saveUpdates(_0x48a56a){return function(_0x2c2639){if(_0x2c2639){return _0x2c2639[_0xd090('0x15')](_0x48a56a)[_0xd090('0x16')](function(_0x1bf613){return _0x1bf613;});}return null;};}function removeEntity(_0x14522c){return function(_0x26582a){if(_0x26582a){return _0x26582a[_0xd090('0x17')]()['then'](function(){var _0x348720=_0x26582a[_0xd090('0x18')]({'plain':!![]});var _0x12c2d8=_0xd090('0x19');return db['UserProfileResource'][_0xd090('0x17')]({'where':{'type':_0x12c2d8,'resourceId':_0x348720['id']}})['then'](function(){return _0x26582a;});})[_0xd090('0x16')](function(){_0x14522c[_0xd090('0xc')](0xcc)[_0xd090('0xd')]();});}};}function handleEntityNotFound(_0x11e18f){return function(_0x481e30){if(!_0x481e30){_0x11e18f[_0xd090('0xb')](0x194);}return _0x481e30;};}function handleError(_0x50ee6f,_0x5e14ba){_0x5e14ba=_0x5e14ba||0x1f4;return function(_0x29a26c){logger[_0xd090('0x1a')](_0x29a26c[_0xd090('0x1b')]);if(_0x29a26c[_0xd090('0x1c')]){delete _0x29a26c[_0xd090('0x1c')];}_0x50ee6f['status'](_0x5e14ba)[_0xd090('0x1d')](_0x29a26c);};}exports[_0xd090('0x1e')]=function(_0x4dad21,_0x22814d){var _0x4bc5a0={};var _0xe51789={'count':0x0,'rows':[]};var _0x44ff18=_[_0xd090('0x1f')](db[_0xd090('0x20')][_0xd090('0x21')],function(_0x243919){return{'name':_0x243919[_0xd090('0x22')],'type':_0x243919[_0xd090('0x23')]['key']};});_0x4bc5a0=qs['getOptions'](_0x44ff18,_0x4dad21);var _0x563c78={'where':_0x4bc5a0[_0xd090('0x24')]};return db['WhatsappQueue'][_0xd090('0x12')](_0x563c78)[_0xd090('0x16')](function(_0x4d576b){_0xe51789[_0xd090('0x12')]=_0x4d576b;_0x4bc5a0[_0xd090('0x25')]=qs[_0xd090('0x25')](_0x4dad21['query']);return db['WhatsappQueue'][_0xd090('0x26')](_0x4bc5a0);})['then'](function(_0x24dab8){_0xe51789[_0xd090('0x27')]=_0x24dab8;return _0xe51789;})[_0xd090('0x16')](respondWithFilteredResult(_0x22814d,_0x4bc5a0))['catch'](handleError(_0x22814d,null));};exports[_0xd090('0x28')]=function(_0x844127,_0x562984){var _0x2dc291={'raw':!![],'where':{'id':_0x844127['params']['id']}},_0x475fed={};_0x475fed[_0xd090('0x29')]=_[_0xd090('0x2a')](db[_0xd090('0x20')][_0xd090('0x21')]);_0x475fed[_0xd090('0x2b')]=_[_0xd090('0x2a')](_0x844127[_0xd090('0x2b')]);_0x475fed[_0xd090('0x2c')]=_[_0xd090('0x2d')](_0x475fed[_0xd090('0x29')],_0x475fed[_0xd090('0x2b')]);_0x2dc291[_0xd090('0x2e')]=_[_0xd090('0x2d')](_0x475fed[_0xd090('0x29')],qs[_0xd090('0x2f')](_0x844127[_0xd090('0x2b')][_0xd090('0x2f')]));_0x2dc291[_0xd090('0x2e')]=_0x2dc291[_0xd090('0x2e')][_0xd090('0x30')]?_0x2dc291[_0xd090('0x2e')]:_0x475fed[_0xd090('0x29')];if(_0x844127[_0xd090('0x2b')][_0xd090('0x31')]){_0x2dc291[_0xd090('0x25')]=[{'all':!![]}];}_0x2dc291=_[_0xd090('0x32')]({},_0x2dc291,_0x844127['options']);return db[_0xd090('0x20')][_0xd090('0x33')](_0x2dc291)[_0xd090('0x16')](handleEntityNotFound(_0x562984,null))[_0xd090('0x16')](respondWithResult(_0x562984,null))[_0xd090('0x34')](handleError(_0x562984,null));};exports[_0xd090('0x35')]=function(_0x5bf37b,_0x58b224){return db['WhatsappQueue'][_0xd090('0x35')](_0x5bf37b[_0xd090('0x36')],{})[_0xd090('0x16')](function(_0x129743){var _0x159c63=_0x5bf37b[_0xd090('0x37')][_0xd090('0x18')]({'plain':!![]});if(!_0x159c63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x159c63[_0xd090('0x38')]===_0xd090('0x37')){var _0x50e273=_0x129743[_0xd090('0x18')]({'plain':!![]});var _0x51e1b3=_0xd090('0x19');return db[_0xd090('0x39')][_0xd090('0x33')]({'where':{'name':_0x51e1b3,'userProfileId':_0x159c63[_0xd090('0x3a')]},'raw':!![]})[_0xd090('0x16')](function(_0x24f2fa){if(_0x24f2fa&&_0x24f2fa[_0xd090('0x3b')]===0x0){return db[_0xd090('0x3c')]['create']({'name':_0x50e273['name'],'resourceId':_0x50e273['id'],'type':_0x24f2fa[_0xd090('0x1c')],'sectionId':_0x24f2fa['id']},{})[_0xd090('0x16')](function(){return _0x129743;});}else{return _0x129743;}})[_0xd090('0x34')](function(_0x46b6fd){logger['error'](_0xd090('0x3d'),_0x46b6fd);throw _0x46b6fd;});}return _0x129743;})[_0xd090('0x16')](respondWithResult(_0x58b224,0xc9))[_0xd090('0x34')](handleError(_0x58b224,null));};exports['update']=function(_0x5cdbd4,_0x2e2c33){if(_0x5cdbd4[_0xd090('0x36')]['id']){delete _0x5cdbd4[_0xd090('0x36')]['id'];}return db[_0xd090('0x20')]['find']({'where':{'id':_0x5cdbd4[_0xd090('0x3e')]['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x2e2c33,null))[_0xd090('0x16')](saveUpdates(_0x5cdbd4[_0xd090('0x36')],null))[_0xd090('0x16')](respondWithResult(_0x2e2c33,null))[_0xd090('0x34')](handleError(_0x2e2c33,null));};exports[_0xd090('0x17')]=function(_0xba3c6,_0x509212){return db[_0xd090('0x20')][_0xd090('0x33')]({'where':{'id':_0xba3c6['params']['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x509212,null))[_0xd090('0x16')](removeEntity(_0x509212,null))[_0xd090('0x34')](handleError(_0x509212,null));};exports[_0xd090('0x3f')]=function(_0x2bdc4e,_0xddc418){return db[_0xd090('0x20')][_0xd090('0x3f')]()[_0xd090('0x16')](respondWithResult(_0xddc418,null))['catch'](handleError(_0xddc418,null));};exports[_0xd090('0x40')]=function(_0x2b7ee3,_0x5100ec){var _0x1c71dd={'raw':!![],'where':{}},_0x22ddc9={},_0x136ba2;return db[_0xd090('0x20')][_0xd090('0x41')]({'where':{'id':_0x2b7ee3[_0xd090('0x3e')]['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x5100ec,null))[_0xd090('0x16')](function(_0x2eb296){if(_0x2eb296){_0x136ba2=_0x2eb296[_0xd090('0x18')]({'plain':!![]});_0x22ddc9[_0xd090('0x29')]=_[_0xd090('0x2a')](db[_0xd090('0x42')]['rawAttributes']);_0x22ddc9[_0xd090('0x2b')]=_[_0xd090('0x2a')](_0x2b7ee3[_0xd090('0x2b')]);_0x22ddc9[_0xd090('0x2c')]=_[_0xd090('0x2d')](_0x22ddc9[_0xd090('0x29')],_0x22ddc9[_0xd090('0x2b')]);_0x1c71dd[_0xd090('0x2e')]=_['intersection'](_0x22ddc9[_0xd090('0x29')],qs['fields'](_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x2f')]));_0x1c71dd[_0xd090('0x2e')]=_0x1c71dd[_0xd090('0x2e')][_0xd090('0x30')]?_0x1c71dd[_0xd090('0x2e')]:_0x22ddc9[_0xd090('0x29')];if(!_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x43')]('nolimit')){_0x1c71dd[_0xd090('0x11')]=qs[_0xd090('0x11')](_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x11')]);_0x1c71dd[_0xd090('0xf')]=qs[_0xd090('0xf')](_0x2b7ee3['query']['offset']);}_0x1c71dd[_0xd090('0x44')]=qs['sort'](_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x45')]);_0x1c71dd[_0xd090('0x24')]=qs[_0xd090('0x2c')](_[_0xd090('0x46')](_0x2b7ee3[_0xd090('0x2b')],_0x22ddc9['filters']));_0x1c71dd['where']['WhatsappQueueId']=_0x2eb296['id'];if(_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x47')]){_0x1c71dd[_0xd090('0x24')]=_[_0xd090('0x32')](_0x1c71dd[_0xd090('0x24')],{'$or':_['map'](_0x1c71dd[_0xd090('0x2e')],function(_0x3bf8d2){var _0x39b568={};_0x39b568[_0x3bf8d2]={'$like':'%'+_0x2b7ee3[_0xd090('0x2b')][_0xd090('0x47')]+'%'};return _0x39b568;})});}_0x1c71dd=_[_0xd090('0x32')]({},_0x1c71dd,_0x2b7ee3['options']);return db[_0xd090('0x42')][_0xd090('0x26')](_0x1c71dd);}})[_0xd090('0x16')](function(_0x4bcd23){if(_0x4bcd23){return db['User'][_0xd090('0x48')]({'where':{'id':_[_0xd090('0x1f')](_0x4bcd23,_0xd090('0x49')),'role':_0xd090('0x4a')},'attributes':['id',_0xd090('0x1c'),'whatsappPause',_0xd090('0x4b'),_0xd090('0x4c')]});}})['then'](function(_0x5f4fd1){if(_0x5f4fd1){return{'count':_0x5f4fd1[_0xd090('0x12')],'rows':_['map'](_0x5f4fd1[_0xd090('0x27')],function(_0x2b345e){return{'membername':_0x2b345e[_0xd090('0x1c')],'UserId':_0x2b345e['id'],'queue_name':_0x136ba2[_0xd090('0x1c')],'WhatsappQueueId':_0x136ba2['id'],'interface':util[_0xd090('0x4d')](_0xd090('0x4e'),_0xd090('0x4f'),_0x2b345e[_0xd090('0x1c')]),'penalty':0x0,'paused':_0x2b345e['whatsappPause'],'createdAt':_0x2b345e[_0xd090('0x4c')],'updatedAt':_0x2b345e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd090('0x16')](respondWithFilteredResult(_0x5100ec,_0x1c71dd))[_0xd090('0x34')](handleError(_0x5100ec,null));};exports[_0xd090('0x50')]=function(_0x1c6be8,_0x488578){var _0x5c931c={};var _0x195f9e={};var _0x4474d2;var _0x118c79;return db[_0xd090('0x20')][_0xd090('0x41')]({'where':{'id':_0x1c6be8[_0xd090('0x3e')]['id']}})['then'](handleEntityNotFound(_0x488578,null))[_0xd090('0x16')](function(_0x9844ba){if(_0x9844ba){_0x4474d2=_0x9844ba;_0x195f9e[_0xd090('0x29')]=_['keys'](db[_0xd090('0x51')]['rawAttributes']);_0x195f9e['query']=_[_0xd090('0x2a')](_0x1c6be8['query']);_0x195f9e[_0xd090('0x2c')]=_[_0xd090('0x2d')](_0x195f9e[_0xd090('0x29')],_0x195f9e['query']);_0x5c931c[_0xd090('0x2e')]=_[_0xd090('0x2d')](_0x195f9e['model'],qs[_0xd090('0x2f')](_0x1c6be8['query']['fields']));_0x5c931c[_0xd090('0x2e')]=_0x5c931c[_0xd090('0x2e')][_0xd090('0x30')]?_0x5c931c[_0xd090('0x2e')]:_0x195f9e[_0xd090('0x29')];_0x5c931c['order']=qs[_0xd090('0x45')](_0x1c6be8['query'][_0xd090('0x45')]);_0x5c931c[_0xd090('0x24')]=qs[_0xd090('0x2c')](_[_0xd090('0x46')](_0x1c6be8[_0xd090('0x2b')],_0x195f9e['filters']));if(_0x1c6be8[_0xd090('0x2b')][_0xd090('0x47')]){_0x5c931c['where']=_[_0xd090('0x32')](_0x5c931c[_0xd090('0x24')],{'$or':_[_0xd090('0x1f')](_0x5c931c[_0xd090('0x2e')],function(_0x50bfbc){var _0x52754c={};_0x52754c[_0x50bfbc]={'$like':'%'+_0x1c6be8[_0xd090('0x2b')][_0xd090('0x47')]+'%'};return _0x52754c;})});}_0x5c931c=_['merge']({},_0x5c931c,_0x1c6be8[_0xd090('0x52')]);return _0x4474d2[_0xd090('0x50')](_0x5c931c);}})['then'](function(_0x3242f2){if(_0x3242f2){_0x118c79=_0x3242f2[_0xd090('0x30')];if(!_0x1c6be8[_0xd090('0x2b')][_0xd090('0x43')]('nolimit')){_0x5c931c[_0xd090('0x11')]=qs['limit'](_0x1c6be8[_0xd090('0x2b')]['limit']);_0x5c931c[_0xd090('0xf')]=qs['offset'](_0x1c6be8[_0xd090('0x2b')][_0xd090('0xf')]);}return _0x4474d2[_0xd090('0x50')](_0x5c931c);}})[_0xd090('0x16')](function(_0x348540){if(_0x348540){return _0x348540?{'count':_0x118c79,'rows':_0x348540}:null;}})[_0xd090('0x16')](respondWithResult(_0x488578,null))[_0xd090('0x34')](handleError(_0x488578,null));};exports['addTeams']=function(_0x21a284,_0x1e4643){var _0x138fe6=_0x21a284[_0xd090('0x36')][_0xd090('0x53')];return db[_0xd090('0x51')][_0xd090('0x26')]({'where':{'id':_0x138fe6},'attributes':['id'],'include':[{'model':db[_0xd090('0x54')],'as':_0xd090('0x55'),'attributes':['id','name',_0xd090('0x56'),'voicePause',_0xd090('0x57')],'raw':!![]}]})[_0xd090('0x16')](function(_0x2b028a){if(_0x2b028a){var _0x3860d1=_[_0xd090('0x58')](_0x2b028a,function(_0x14f420){var _0x1230b8=_0x14f420['get']({'plain':!![]});return _0x1230b8[_0xd090('0x55')];});return db['WhatsappQueue'][_0xd090('0x33')]({'where':{'id':_0x21a284[_0xd090('0x3e')]['id']}})[_0xd090('0x16')](function(_0x428c91){return db['sequelize'][_0xd090('0x59')](function(_0x19fc75){return _0x428c91['addTeams'](_0x138fe6,{'transaction':_0x19fc75})[_0xd090('0x16')](function(){return BPromise['each'](_0x3860d1,function(_0x42dbfa){return db[_0xd090('0x42')][_0xd090('0x5a')]({'where':{'UserId':_0x42dbfa['id'],'WhatsappQueueId':_0x21a284[_0xd090('0x3e')]['id']},'transaction':_0x19fc75});});})[_0xd090('0x16')](function(){_0x3860d1[_0xd090('0x5b')](function(_0x4aba50){socket[_0xd090('0x5c')]('userWhatsappQueue:save',{'UserId':_0x4aba50['id'],'WhatsappQueueId':_0x428c91['id']});});});});});}})['then'](respondWithStatusCode(_0x1e4643,null))[_0xd090('0x34')](handleError(_0x1e4643,null));};exports[_0xd090('0x5d')]=function(_0x290811,_0x12e58a){return db[_0xd090('0x51')]['findAll']({'where':{'id':_0x290811[_0xd090('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd090('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd090('0x16')](handleEntityNotFound(_0x12e58a,null))[_0xd090('0x16')](function(_0x5df45f){var _0x711018=_[_0xd090('0x1f')](_0x5df45f,'id');var _0x26e89d=[];var _0x128d01=[];var _0x2b79ee=squel['select']();_0x2b79ee[_0xd090('0x5e')](_0xd090('0x5f'))[_0xd090('0x60')](_0xd090('0x61'),'tq')[_0xd090('0x62')](_0xd090('0x63'),'ut',_0xd090('0x64'))[_0xd090('0x24')](_0xd090('0x65'),_0x290811[_0xd090('0x3e')]['id']);for(var _0x31fb51=0x0;_0x31fb51<_0x5df45f[_0xd090('0x30')];_0x31fb51+=0x1){let _0x565118=_0x5df45f[_0x31fb51];for(var _0xee3f2c=0x0;_0xee3f2c<_0x565118[_0xd090('0x55')][_0xd090('0x30')];_0xee3f2c+=0x1){let _0x5e1208=_0x565118['Agents'][_0xee3f2c];var _0x1f0d28=_0x2b79ee[_0xd090('0x66')]();_0x1f0d28['where'](_0xd090('0x67'),_0x5e1208['id']);_0x128d01[_0xd090('0x68')](db[_0xd090('0x69')][_0xd090('0x2b')](_0x1f0d28[_0xd090('0x6a')](),{'type':db[_0xd090('0x69')][_0xd090('0x6b')][_0xd090('0x6c')]})['then'](function(_0x1ebc9b){if(_0x1ebc9b[_0xd090('0x30')]===0x1){return _0x5e1208['id'];}else{var _0x59bd9c=_[_0xd090('0x6d')](_[_0xd090('0x1f')](_0x1ebc9b,_0xd090('0x6e')),function(_0x316ede){return _['includes'](_0x711018,_0x316ede);});if(_0x59bd9c){return _0x5e1208['id'];}}}));}}return BPromise[_0xd090('0x6f')](_0x128d01)['then'](function(_0xb2e889){_0x26e89d=_(_0x26e89d)['union'](_0xb2e889)['compact']()[_0xd090('0x70')]();return db['WhatsappQueue'][_0xd090('0x33')]({'where':{'id':_0x290811[_0xd090('0x3e')]['id']}})['then'](function(_0x3edb14){return db['sequelize']['transaction'](function(_0x5ae4c4){return _0x3edb14['removeTeams'](_0x290811[_0xd090('0x2b')][_0xd090('0x53')],{'transaction':_0x5ae4c4})[_0xd090('0x16')](function(){if(!_[_0xd090('0x71')](_0x26e89d)){return _0x3edb14['removeAgents'](_0x26e89d,{'transaction':_0x5ae4c4});}})[_0xd090('0x16')](function(){_0x26e89d[_0xd090('0x5b')](function(_0x3885c8){socket[_0xd090('0x5c')](_0xd090('0x72'),{'UserId':_0x3885c8,'WhatsappQueueId':_0x3edb14['id']});});});});});});})['then'](respondWithStatusCode(_0x12e58a,null))[_0xd090('0x34')](handleError(_0x12e58a,null));};exports[_0xd090('0x73')]=function(_0x48467d,_0x4b46de){return db[_0xd090('0x20')][_0xd090('0x33')]({'where':{'id':_0x48467d['params']['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x4b46de,null))[_0xd090('0x16')](function(_0x2610bc){if(_0x2610bc){return _0x2610bc[_0xd090('0x73')](_0x48467d[_0xd090('0x36')][_0xd090('0x53')],_[_0xd090('0x74')](_0x48467d[_0xd090('0x36')],[_0xd090('0x53'),'id'])||{})[_0xd090('0x75')](function(_0x118834){for(var _0x4da981=0x0;_0x4da981<_0x48467d['body'][_0xd090('0x53')][_0xd090('0x30')];_0x4da981+=0x1){socket[_0xd090('0x5c')](_0xd090('0x76'),{'UserId':Number(_0x48467d[_0xd090('0x36')][_0xd090('0x53')][_0x4da981]),'WhatsappQueueId':Number(_0x48467d[_0xd090('0x3e')]['id'])});}return _0x118834;});}})[_0xd090('0x16')](respondWithResult(_0x4b46de,null))[_0xd090('0x34')](handleError(_0x4b46de,null));};exports['removeAgents']=function(_0x2b5ff9,_0x53d0eb){return db[_0xd090('0x20')][_0xd090('0x33')]({'where':{'id':_0x2b5ff9['params']['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x53d0eb,null))[_0xd090('0x16')](function(_0x5c369b){if(_0x5c369b){return _0x5c369b[_0xd090('0x77')](_0x2b5ff9['query'][_0xd090('0x53')])[_0xd090('0x16')](function(){if(_[_0xd090('0x78')](_0x2b5ff9[_0xd090('0x2b')][_0xd090('0x53')])){for(var _0x182ddb=0x0;_0x182ddb<_0x2b5ff9[_0xd090('0x2b')]['ids']['length'];_0x182ddb+=0x1){socket[_0xd090('0x5c')]('userWhatsappQueue:remove',{'UserId':Number(_0x2b5ff9[_0xd090('0x2b')][_0xd090('0x53')][_0x182ddb]),'WhatsappQueueId':Number(_0x2b5ff9[_0xd090('0x3e')]['id'])});}}else{socket[_0xd090('0x5c')]('userWhatsappQueue:remove',{'UserId':Number(_0x2b5ff9[_0xd090('0x2b')][_0xd090('0x53')]),'WhatsappQueueId':Number(_0x2b5ff9['params']['id'])});}});}})[_0xd090('0x16')](respondWithStatusCode(_0x53d0eb,null))[_0xd090('0x34')](handleError(_0x53d0eb,null));};exports[_0xd090('0x79')]=function(_0x24c1a9,_0x30ce4a){var _0x335596={};var _0x5ad48a={};var _0x4e3f89;var _0x370bb7;return db[_0xd090('0x20')][_0xd090('0x41')]({'where':{'id':_0x24c1a9['params']['id']}})[_0xd090('0x16')](handleEntityNotFound(_0x30ce4a,null))[_0xd090('0x16')](function(_0x1d3706){if(_0x1d3706){_0x4e3f89=_0x1d3706;_0x5ad48a[_0xd090('0x29')]=_['keys'](db['User'][_0xd090('0x21')]);_0x5ad48a['query']=_['keys'](_0x24c1a9['query']);_0x5ad48a['filters']=_[_0xd090('0x2d')](_0x5ad48a[_0xd090('0x29')],_0x5ad48a[_0xd090('0x2b')]);_0x335596['attributes']=_[_0xd090('0x2d')](_0x5ad48a[_0xd090('0x29')],qs[_0xd090('0x2f')](_0x24c1a9[_0xd090('0x2b')][_0xd090('0x2f')]));_0x335596['attributes']=_0x335596[_0xd090('0x2e')][_0xd090('0x30')]?_0x335596[_0xd090('0x2e')]:_0x5ad48a[_0xd090('0x29')];_0x335596[_0xd090('0x44')]=qs['sort'](_0x24c1a9[_0xd090('0x2b')][_0xd090('0x45')]);_0x335596[_0xd090('0x24')]=qs[_0xd090('0x2c')](_[_0xd090('0x46')](_0x24c1a9[_0xd090('0x2b')],_0x5ad48a['filters']));if(_0x24c1a9[_0xd090('0x2b')]['filter']){_0x335596[_0xd090('0x24')]=_[_0xd090('0x32')](_0x335596[_0xd090('0x24')],{'$or':_[_0xd090('0x1f')](_0x335596[_0xd090('0x2e')],function(_0x2a37dd){var _0x18aca9={};_0x18aca9[_0x2a37dd]={'$like':'%'+_0x24c1a9[_0xd090('0x2b')][_0xd090('0x47')]+'%'};return _0x18aca9;})});}_0x335596=_['merge']({},_0x335596,_0x24c1a9[_0xd090('0x52')]);return _0x4e3f89['getAgents'](_0x335596);}})[_0xd090('0x16')](function(_0x2b09a0){if(_0x2b09a0){_0x370bb7=_0x2b09a0[_0xd090('0x30')];if(!_0x24c1a9[_0xd090('0x2b')][_0xd090('0x43')]('nolimit')){_0x335596[_0xd090('0x11')]=qs[_0xd090('0x11')](_0x24c1a9['query'][_0xd090('0x11')]);_0x335596['offset']=qs[_0xd090('0xf')](_0x24c1a9[_0xd090('0x2b')][_0xd090('0xf')]);}return _0x4e3f89[_0xd090('0x79')](_0x335596);}})[_0xd090('0x16')](function(_0x11191b){if(_0x11191b){return _0x11191b?{'count':_0x370bb7,'rows':_0x11191b}:null;}})['then'](respondWithResult(_0x30ce4a,null))[_0xd090('0x34')](handleError(_0x30ce4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ff0a750..d493271 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 _0xd60b=['../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xd60b,0x167));var _0xbd60=function(_0x571457,_0x17e257){_0x571457=_0x571457-0x0;var _0xb75a5a=_0xd60b[_0x571457];return _0xb75a5a;};'use strict';var EventEmitter=require(_0xbd60('0x0'));var WhatsappQueue=require(_0xbd60('0x1'))['db'][_0xbd60('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd60('0x3'),'afterUpdate':_0xbd60('0x4'),'afterDestroy':_0xbd60('0x5')};function emitEvent(_0x25d84f){return function(_0x5f1a35,_0x2a240e,_0x2464c7){WhatsappQueueEvents[_0xbd60('0x6')](_0x25d84f+':'+_0x5f1a35['id'],_0x5f1a35);WhatsappQueueEvents['emit'](_0x25d84f,_0x5f1a35);_0x2464c7(null);};}for(var e in events){if(events[_0xbd60('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xbd60('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x7473=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x258ab5,_0x3262dd){var _0x14867=function(_0xa77e4e){while(--_0xa77e4e){_0x258ab5['push'](_0x258ab5['shift']());}};_0x14867(++_0x3262dd);}(_0x7473,0x1ab));var _0x3747=function(_0xb31e93,_0x5a5f57){_0xb31e93=_0xb31e93-0x0;var _0x117ea6=_0x7473[_0xb31e93];return _0x117ea6;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x3747('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3747('0x1'),'afterUpdate':'update','afterDestroy':_0x3747('0x2')};function emitEvent(_0x4000c2){return function(_0x167ea7,_0x4790a5,_0xc4d04b){WhatsappQueueEvents[_0x3747('0x3')](_0x4000c2+':'+_0x167ea7['id'],_0x167ea7);WhatsappQueueEvents[_0x3747('0x3')](_0x4000c2,_0x167ea7);_0xc4d04b(null);};}for(var e in events){if(events[_0x3747('0x4')](e)){var event=events[e];WhatsappQueue[_0x3747('0x5')](e,emitEvent(event));}}module[_0x3747('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a2b18cc..4b57734 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 _0xfa4b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x4722b3,_0x5bde86){var _0x216af3=function(_0x29e714){while(--_0x29e714){_0x4722b3['push'](_0x4722b3['shift']());}};_0x216af3(++_0x5bde86);}(_0xfa4b,0x6f));var _0xbfa4=function(_0x50f04d,_0x2596db){_0x50f04d=_0x50f04d-0x0;var _0x545d15=_0xfa4b[_0x50f04d];return _0x545d15;};'use strict';var _=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var logger=require(_0xbfa4('0x2'))('api');var moment=require(_0xbfa4('0x3'));var BPromise=require(_0xbfa4('0x4'));var rp=require(_0xbfa4('0x5'));var fs=require('fs');var path=require(_0xbfa4('0x6'));var rimraf=require(_0xbfa4('0x7'));var config=require(_0xbfa4('0x8'));var attributes=require(_0xbfa4('0x9'));module[_0xbfa4('0xa')]=function(_0x3d7c1b,_0x3a352a){return _0x3d7c1b[_0xbfa4('0xb')](_0xbfa4('0xc'),attributes,{'tableName':_0xbfa4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4104=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x1ba6a8,_0x1a10e5){var _0xb7e4d9=function(_0x2cf1b2){while(--_0x2cf1b2){_0x1ba6a8['push'](_0x1ba6a8['shift']());}};_0xb7e4d9(++_0x1a10e5);}(_0x4104,0x9a));var _0x4410=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x4104[_0x337a10];return _0x575f98;};'use strict';var _=require('lodash');var util=require(_0x4410('0x0'));var logger=require(_0x4410('0x1'))(_0x4410('0x2'));var moment=require(_0x4410('0x3'));var BPromise=require(_0x4410('0x4'));var rp=require(_0x4410('0x5'));var fs=require('fs');var path=require(_0x4410('0x6'));var rimraf=require('rimraf');var config=require(_0x4410('0x7'));var attributes=require(_0x4410('0x8'));module[_0x4410('0x9')]=function(_0x2fdc30,_0x4d152c){return _0x2fdc30['define'](_0x4410('0xa'),attributes,{'tableName':'whatsapp_queues','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 8302647..53d13b7 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 _0x332d=['info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then'];(function(_0x428d8f,_0x3c0013){var _0x182950=function(_0x3e0065){while(--_0x3e0065){_0x428d8f['push'](_0x428d8f['shift']());}};_0x182950(++_0x3c0013);}(_0x332d,0x6a));var _0xd332=function(_0x2e51a3,_0x11363d){_0x2e51a3=_0x2e51a3-0x0;var _0x4438be=_0x332d[_0x2e51a3];return _0x4438be;};'use strict';var _=require(_0xd332('0x0'));var util=require(_0xd332('0x1'));var moment=require(_0xd332('0x2'));var BPromise=require(_0xd332('0x3'));var rs=require(_0xd332('0x4'));var fs=require('fs');var Redis=require(_0xd332('0x5'));var db=require(_0xd332('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd332('0x7'))(_0xd332('0x8'));var config=require(_0xd332('0x9'));var jayson=require(_0xd332('0xa'));var client=jayson[_0xd332('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd332('0xc')](config[_0xd332('0xd')],{'host':_0xd332('0xe'),'port':0x18eb});var socket=require(_0xd332('0xf'))(new Redis(config[_0xd332('0xd')]));require(_0xd332('0x10'))[_0xd332('0x11')](socket);function respondWithRpcPromise(_0x28d1e2,_0x248d67,_0x43802e){return new BPromise(function(_0x2bbb72,_0x4cf242){return client[_0xd332('0x12')](_0x28d1e2,_0x43802e)[_0xd332('0x13')](function(_0x5cd92f){logger[_0xd332('0x14')](_0xd332('0x15'),_0x248d67,_0xd332('0x16'));logger[_0xd332('0x17')](_0xd332('0x18'),_0x248d67,_0xd332('0x16'),JSON[_0xd332('0x19')](_0x5cd92f));if(_0x5cd92f['error']){if(_0x5cd92f[_0xd332('0x1a')][_0xd332('0x1b')]===0x1f4){logger[_0xd332('0x1a')](_0xd332('0x15'),_0x248d67,_0x5cd92f['error'][_0xd332('0x1c')]);return _0x4cf242(_0x5cd92f[_0xd332('0x1a')][_0xd332('0x1c')]);}logger[_0xd332('0x1a')](_0xd332('0x15'),_0x248d67,_0x5cd92f[_0xd332('0x1a')]['message']);return _0x2bbb72(_0x5cd92f['error'][_0xd332('0x1c')]);}else{logger['info'](_0xd332('0x15'),_0x248d67,_0xd332('0x16'));_0x2bbb72(_0x5cd92f['result'][_0xd332('0x1c')]);}})['catch'](function(_0x4fb536){logger[_0xd332('0x1a')](_0xd332('0x15'),_0x248d67,_0x4fb536);_0x4cf242(_0x4fb536);});});}exports[_0xd332('0x1d')]=function(_0x3692d0){var _0x54579d=this;return new Promise(function(_0x3e0747,_0x3c0645){return db[_0xd332('0x1e')][_0xd332('0x1f')]({'raw':_0x3692d0['options']?_0x3692d0['options'][_0xd332('0x20')]===undefined?!![]:![]:!![],'where':_0x3692d0['options']?_0x3692d0[_0xd332('0x21')][_0xd332('0x22')]||null:null,'attributes':_0x3692d0[_0xd332('0x21')]?_0x3692d0['options'][_0xd332('0x23')]||null:null,'limit':_0x3692d0['options']?_0x3692d0[_0xd332('0x21')][_0xd332('0x24')]||null:null,'include':_0x3692d0[_0xd332('0x21')]?_0x3692d0[_0xd332('0x21')][_0xd332('0x25')]?_[_0xd332('0x26')](_0x3692d0['options'][_0xd332('0x25')],function(_0x6027b9){return{'model':db[_0x6027b9['model']],'as':_0x6027b9['as'],'attributes':_0x6027b9['attributes'],'include':_0x6027b9[_0xd332('0x25')]?_[_0xd332('0x26')](_0x6027b9['include'],function(_0x6e5348){return{'model':db[_0x6e5348[_0xd332('0x27')]],'as':_0x6e5348['as'],'attributes':_0x6e5348[_0xd332('0x23')],'include':_0x6e5348['include']?_['map'](_0x6e5348[_0xd332('0x25')],function(_0x252d8b){return{'model':db[_0x252d8b[_0xd332('0x27')]],'as':_0x252d8b['as'],'attributes':_0x252d8b[_0xd332('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd332('0x13')](function(_0x111e11){logger[_0xd332('0x14')]('GetWhatsappQueue',_0x3692d0);logger[_0xd332('0x17')]('GetWhatsappQueue',_0x3692d0,JSON[_0xd332('0x19')](_0x111e11));_0x3e0747(_0x111e11);})[_0xd332('0x28')](function(_0x153078){logger['error']('GetWhatsappQueue',_0x153078['message'],_0x3692d0);_0x3c0645(_0x54579d[_0xd332('0x1a')](0x1f4,_0x153078[_0xd332('0x1c')]));});});};exports[_0xd332('0x29')]=function(_0x2ea6f4){var _0x5322f2=this;return new Promise(function(_0xfbe151,_0x1e9010){return db['WhatsappQueue']['find']({'raw':_0x2ea6f4[_0xd332('0x21')]?_0x2ea6f4[_0xd332('0x21')][_0xd332('0x20')]===undefined?!![]:![]:!![],'where':_0x2ea6f4['options']?_0x2ea6f4[_0xd332('0x21')][_0xd332('0x22')]||null:null,'attributes':_0x2ea6f4[_0xd332('0x21')]?_0x2ea6f4[_0xd332('0x21')][_0xd332('0x23')]||null:null,'include':_0x2ea6f4['options']?_0x2ea6f4['options']['include']?_[_0xd332('0x26')](_0x2ea6f4[_0xd332('0x21')][_0xd332('0x25')],function(_0x188126){return{'model':db[_0x188126['model']],'as':_0x188126['as'],'attributes':_0x188126[_0xd332('0x23')],'include':_0x188126[_0xd332('0x25')]?_['map'](_0x188126[_0xd332('0x25')],function(_0x500e13){return{'model':db[_0x500e13['model']],'as':_0x500e13['as'],'attributes':_0x500e13[_0xd332('0x23')],'include':_0x500e13[_0xd332('0x25')]?_[_0xd332('0x26')](_0x500e13['include'],function(_0x91da30){return{'model':db[_0x91da30['model']],'as':_0x91da30['as'],'attributes':_0x91da30[_0xd332('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd332('0x13')](function(_0x49cdec){logger['info'](_0xd332('0x29'),_0x2ea6f4);logger[_0xd332('0x17')]('ShowWhatsappQueue',_0x2ea6f4,JSON[_0xd332('0x19')](_0x49cdec));_0xfbe151(_0x49cdec);})['catch'](function(_0x357e42){logger[_0xd332('0x1a')](_0xd332('0x29'),_0x357e42['message'],_0x2ea6f4);_0x1e9010(_0x5322f2['error'](0x1f4,_0x357e42[_0xd332('0x1c')]));});});}; \ No newline at end of file +var _0xbd40=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','where'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0xbd40,0x1ec));var _0x0bd4=function(_0xf92345,_0x3e945b){_0xf92345=_0xf92345-0x0;var _0x11e908=_0xbd40[_0xf92345];return _0x11e908;};'use strict';var _=require(_0x0bd4('0x0'));var util=require(_0x0bd4('0x1'));var moment=require(_0x0bd4('0x2'));var BPromise=require(_0x0bd4('0x3'));var rs=require(_0x0bd4('0x4'));var fs=require('fs');var Redis=require(_0x0bd4('0x5'));var db=require(_0x0bd4('0x6'))['db'];var utils=require(_0x0bd4('0x7'));var logger=require(_0x0bd4('0x8'))('rpc');var config=require(_0x0bd4('0x9'));var jayson=require(_0x0bd4('0xa'));var client=jayson[_0x0bd4('0xb')][_0x0bd4('0xc')]({'port':0x232a});config[_0x0bd4('0xd')]=_[_0x0bd4('0xe')](config[_0x0bd4('0xd')],{'host':_0x0bd4('0xf'),'port':0x18eb});var socket=require(_0x0bd4('0x10'))(new Redis(config[_0x0bd4('0xd')]));require('./whatsappQueue.socket')[_0x0bd4('0x11')](socket);function respondWithRpcPromise(_0x2482b3,_0x257d60,_0x1e585f){return new BPromise(function(_0x5272df,_0x1bc2fd){return client[_0x0bd4('0x12')](_0x2482b3,_0x1e585f)[_0x0bd4('0x13')](function(_0x34742d){logger['info'](_0x0bd4('0x14'),_0x257d60,_0x0bd4('0x15'));logger[_0x0bd4('0x16')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x257d60,_0x0bd4('0x15'),JSON[_0x0bd4('0x17')](_0x34742d));if(_0x34742d[_0x0bd4('0x18')]){if(_0x34742d['error'][_0x0bd4('0x19')]===0x1f4){logger['error'](_0x0bd4('0x14'),_0x257d60,_0x34742d[_0x0bd4('0x18')][_0x0bd4('0x1a')]);return _0x1bc2fd(_0x34742d[_0x0bd4('0x18')][_0x0bd4('0x1a')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x257d60,_0x34742d[_0x0bd4('0x18')][_0x0bd4('0x1a')]);return _0x5272df(_0x34742d[_0x0bd4('0x18')][_0x0bd4('0x1a')]);}else{logger[_0x0bd4('0x1b')](_0x0bd4('0x14'),_0x257d60,_0x0bd4('0x15'));_0x5272df(_0x34742d[_0x0bd4('0x1c')][_0x0bd4('0x1a')]);}})[_0x0bd4('0x1d')](function(_0x16e365){logger[_0x0bd4('0x18')](_0x0bd4('0x14'),_0x257d60,_0x16e365);_0x1bc2fd(_0x16e365);});});}exports[_0x0bd4('0x1e')]=function(_0x20325f){var _0x2d4cc8=this;return new Promise(function(_0x5b392d,_0x50013b){return db[_0x0bd4('0x1f')]['findAll']({'raw':_0x20325f['options']?_0x20325f[_0x0bd4('0x20')][_0x0bd4('0x21')]===undefined?!![]:![]:!![],'where':_0x20325f[_0x0bd4('0x20')]?_0x20325f[_0x0bd4('0x20')]['where']||null:null,'attributes':_0x20325f[_0x0bd4('0x20')]?_0x20325f['options'][_0x0bd4('0x22')]||null:null,'limit':_0x20325f['options']?_0x20325f[_0x0bd4('0x20')][_0x0bd4('0x23')]||null:null,'include':_0x20325f[_0x0bd4('0x20')]?_0x20325f[_0x0bd4('0x20')][_0x0bd4('0x24')]?_[_0x0bd4('0x25')](_0x20325f[_0x0bd4('0x20')][_0x0bd4('0x24')],function(_0x2b9239){return{'model':db[_0x2b9239[_0x0bd4('0x26')]],'as':_0x2b9239['as'],'attributes':_0x2b9239[_0x0bd4('0x22')],'include':_0x2b9239[_0x0bd4('0x24')]?_[_0x0bd4('0x25')](_0x2b9239[_0x0bd4('0x24')],function(_0x1c057d){return{'model':db[_0x1c057d[_0x0bd4('0x26')]],'as':_0x1c057d['as'],'attributes':_0x1c057d['attributes'],'include':_0x1c057d[_0x0bd4('0x24')]?_[_0x0bd4('0x25')](_0x1c057d[_0x0bd4('0x24')],function(_0x434920){return{'model':db[_0x434920['model']],'as':_0x434920['as'],'attributes':_0x434920[_0x0bd4('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x169589){logger['info']('GetWhatsappQueue',_0x20325f);logger[_0x0bd4('0x16')](_0x0bd4('0x1e'),_0x20325f,JSON[_0x0bd4('0x17')](_0x169589));_0x5b392d(_0x169589);})[_0x0bd4('0x1d')](function(_0x37a286){logger['error'](_0x0bd4('0x1e'),_0x37a286[_0x0bd4('0x1a')],_0x20325f);_0x50013b(_0x2d4cc8[_0x0bd4('0x18')](0x1f4,_0x37a286[_0x0bd4('0x1a')]));});});};exports[_0x0bd4('0x27')]=function(_0x3a04f2){var _0x2fc736=this;return new Promise(function(_0x2b86a7,_0x34312c){return db[_0x0bd4('0x1f')]['find']({'raw':_0x3a04f2[_0x0bd4('0x20')]?_0x3a04f2[_0x0bd4('0x20')][_0x0bd4('0x21')]===undefined?!![]:![]:!![],'where':_0x3a04f2[_0x0bd4('0x20')]?_0x3a04f2[_0x0bd4('0x20')][_0x0bd4('0x28')]||null:null,'attributes':_0x3a04f2[_0x0bd4('0x20')]?_0x3a04f2[_0x0bd4('0x20')][_0x0bd4('0x22')]||null:null,'include':_0x3a04f2['options']?_0x3a04f2[_0x0bd4('0x20')][_0x0bd4('0x24')]?_['map'](_0x3a04f2[_0x0bd4('0x20')][_0x0bd4('0x24')],function(_0x331263){return{'model':db[_0x331263[_0x0bd4('0x26')]],'as':_0x331263['as'],'attributes':_0x331263[_0x0bd4('0x22')],'include':_0x331263['include']?_[_0x0bd4('0x25')](_0x331263[_0x0bd4('0x24')],function(_0x1dd85e){return{'model':db[_0x1dd85e['model']],'as':_0x1dd85e['as'],'attributes':_0x1dd85e[_0x0bd4('0x22')],'include':_0x1dd85e[_0x0bd4('0x24')]?_['map'](_0x1dd85e['include'],function(_0x219d9b){return{'model':db[_0x219d9b[_0x0bd4('0x26')]],'as':_0x219d9b['as'],'attributes':_0x219d9b[_0x0bd4('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e63a9){logger[_0x0bd4('0x1b')](_0x0bd4('0x27'),_0x3a04f2);logger[_0x0bd4('0x16')](_0x0bd4('0x27'),_0x3a04f2,JSON[_0x0bd4('0x17')](_0x5e63a9));_0x2b86a7(_0x5e63a9);})[_0x0bd4('0x1d')](function(_0x28eb97){logger[_0x0bd4('0x18')](_0x0bd4('0x27'),_0x28eb97[_0x0bd4('0x1a')],_0x3a04f2);_0x34312c(_0x2fc736['error'](0x1f4,_0x28eb97[_0x0bd4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0c58032..09b56cf 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 _0xb927=['length','whatsappQueue:','save','remove','emit','removeListener','register'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb927,0xf7));var _0x7b92=function(_0x449750,_0x434522){_0x449750=_0x449750-0x0;var _0x414c17=_0xb927[_0x449750];return _0x414c17;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x7b92('0x0'),_0x7b92('0x1'),'update'];function createListener(_0x2b320e,_0x50c6a2){return function(_0x14b816){_0x50c6a2[_0x7b92('0x2')](_0x2b320e,_0x14b816);};}function removeListener(_0x5011d2,_0x204fab){return function(){WhatsappQueueEvents[_0x7b92('0x3')](_0x5011d2,_0x204fab);};}exports[_0x7b92('0x4')]=function(_0x1db9b8){for(var _0x145484=0x0,_0x150460=events[_0x7b92('0x5')];_0x145484<_0x150460;_0x145484++){var _0x2e99d9=events[_0x145484];var _0x542dae=createListener(_0x7b92('0x6')+_0x2e99d9,_0x1db9b8);WhatsappQueueEvents['on'](_0x2e99d9,_0x542dae);}}; \ No newline at end of file +var _0xd3df=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd3df,0x184));var _0xfd3d=function(_0x97385e,_0x17e853){_0x97385e=_0x97385e-0x0;var _0x5d337e=_0xd3df[_0x97385e];return _0x5d337e;};'use strict';var WhatsappQueueEvents=require(_0xfd3d('0x0'));var events=[_0xfd3d('0x1'),_0xfd3d('0x2'),_0xfd3d('0x3')];function createListener(_0x49b192,_0x3c3616){return function(_0x40f3ff){_0x3c3616['emit'](_0x49b192,_0x40f3ff);};}function removeListener(_0x30aa8f,_0x1a23ba){return function(){WhatsappQueueEvents[_0xfd3d('0x4')](_0x30aa8f,_0x1a23ba);};}exports[_0xfd3d('0x5')]=function(_0x440bc5){for(var _0xb1e740=0x0,_0x3cabd3=events[_0xfd3d('0x6')];_0xb1e740<_0x3cabd3;_0xb1e740++){var _0x2903e1=events[_0xb1e740];var _0x568c82=createListener(_0xfd3d('0x7')+_0x2903e1,_0x440bc5);WhatsappQueueEvents['on'](_0x2903e1,_0x568c82);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5a7e4f5..33ae0c5 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 _0x9d75=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x206daf,_0x239929){var _0x53a4ce=function(_0x2a394d){while(--_0x2a394d){_0x206daf['push'](_0x206daf['shift']());}};_0x53a4ce(++_0x239929);}(_0x9d75,0x162));var _0x59d7=function(_0x47159c,_0x1c8216){_0x47159c=_0x47159c-0x0;var _0x454dbe=_0x9d75[_0x47159c];return _0x454dbe;};'use strict';var multer=require(_0x59d7('0x0'));var util=require(_0x59d7('0x1'));var path=require(_0x59d7('0x2'));var timeout=require(_0x59d7('0x3'));var express=require(_0x59d7('0x4'));var router=express[_0x59d7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59d7('0x6'));var interaction=require(_0x59d7('0x7'));var config=require(_0x59d7('0x8'));var controller=require(_0x59d7('0x9'));router[_0x59d7('0xa')]('/',auth[_0x59d7('0xb')](),controller['index']);router['get'](_0x59d7('0xc'),auth[_0x59d7('0xb')](),controller[_0x59d7('0xd')]);router[_0x59d7('0xa')](_0x59d7('0xe'),auth[_0x59d7('0xb')](),controller[_0x59d7('0xf')]);router[_0x59d7('0x10')]('/',auth[_0x59d7('0xb')](),controller[_0x59d7('0x11')]);router['put'](_0x59d7('0xe'),auth[_0x59d7('0xb')](),controller[_0x59d7('0x12')]);router[_0x59d7('0x13')]('/:id',auth[_0x59d7('0xb')](),controller[_0x59d7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2c45=['connect-timeout','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','create','update','delete','multer'];(function(_0x2463c8,_0x436b45){var _0x2127e7=function(_0x51fea1){while(--_0x51fea1){_0x2463c8['push'](_0x2463c8['shift']());}};_0x2127e7(++_0x436b45);}(_0x2c45,0x1b1));var _0x52c4=function(_0x27b17f,_0xb70065){_0x27b17f=_0x27b17f-0x0;var _0x2dd677=_0x2c45[_0x27b17f];return _0x2dd677;};'use strict';var multer=require(_0x52c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x52c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x52c4('0x2'));var config=require(_0x52c4('0x3'));var controller=require(_0x52c4('0x4'));router['get']('/',auth[_0x52c4('0x5')](),controller['index']);router['get'](_0x52c4('0x6'),auth[_0x52c4('0x5')](),controller[_0x52c4('0x7')]);router[_0x52c4('0x8')](_0x52c4('0x9'),auth[_0x52c4('0x5')](),controller[_0x52c4('0xa')]);router['post']('/',auth[_0x52c4('0x5')](),controller[_0x52c4('0xb')]);router['put'](_0x52c4('0x9'),auth['isAuthenticated'](),controller[_0x52c4('0xc')]);router[_0x52c4('0xd')](_0x52c4('0x9'),auth[_0x52c4('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index db89996..f4651b9 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(_0x3a05e8,_0x4400ff){var _0x5dd5df=function(_0x3c230a){while(--_0x3c230a){_0x3a05e8['push'](_0x3a05e8['shift']());}};_0x5dd5df(++_0x4400ff);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5bfc5b,_0x2e6287){var _0x1d4544=function(_0x3e0645){while(--_0x3e0645){_0x5bfc5b['push'](_0x5bfc5b['shift']());}};_0x1d4544(++_0x2e6287);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 7c4ed41..d0d364d 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 _0xa571=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','end','error','name','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xffb37d,_0x5f4837){var _0x49e46c=function(_0x489812){while(--_0x489812){_0xffb37d['push'](_0xffb37d['shift']());}};_0x49e46c(++_0x5f4837);}(_0xa571,0x107));var _0x1a57=function(_0x2c91cb,_0xd9729b){_0x2c91cb=_0x2c91cb-0x0;var _0xe3c976=_0xa571[_0x2c91cb];return _0xe3c976;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x23')]();});}};}function handleEntityNotFound(_0x2f9454,_0x182649){return function(_0x25c1e9){if(!_0x25c1e9){_0x2f9454[_0x1a57('0x18')](0x194);}return _0x25c1e9;};}function handleError(_0x27cfe1,_0xf6ffef){_0xf6ffef=_0xf6ffef||0x1f4;return function(_0x26584b){logger[_0x1a57('0x24')](_0x26584b['stack']);if(_0x26584b['name']){delete _0x26584b[_0x1a57('0x25')];}_0x27cfe1[_0x1a57('0x19')](_0xf6ffef)['send'](_0x26584b);};}exports[_0x1a57('0x26')]=function(_0x54f6a5,_0x2d8738){var _0x4a2901={},_0x53bf6e={},_0x8179a4={'count':0x0,'rows':[]};var _0x274fe6=_[_0x1a57('0x27')](db[_0x1a57('0x28')]['rawAttributes'],function(_0x366d5f){return{'name':_0x366d5f[_0x1a57('0x29')],'type':_0x366d5f[_0x1a57('0x2a')][_0x1a57('0x2b')]};});_0x53bf6e['model']=_[_0x1a57('0x27')](_0x274fe6,_0x1a57('0x25'));_0x53bf6e[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x54f6a5[_0x1a57('0x2c')]);_0x53bf6e[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],_0x53bf6e[_0x1a57('0x2c')]);_0x4a2901['attributes']=_[_0x1a57('0x2f')](_0x53bf6e[_0x1a57('0x30')],qs['fields'](_0x54f6a5['query'][_0x1a57('0x31')]));_0x4a2901[_0x1a57('0x32')]=_0x4a2901[_0x1a57('0x32')][_0x1a57('0x33')]?_0x4a2901[_0x1a57('0x32')]:_0x53bf6e[_0x1a57('0x30')];if(!_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x34')](_0x1a57('0x35'))){_0x4a2901[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x4a2901[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x1e')]);}_0x4a2901[_0x1a57('0x36')]=qs['sort'](_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x37')]);_0x4a2901[_0x1a57('0x38')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x39')](_0x54f6a5[_0x1a57('0x2c')],_0x53bf6e[_0x1a57('0x2e')]),_0x274fe6);if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]){_0x4a2901['where']=_['merge'](_0x4a2901['where'],{'$or':_['map'](_0x274fe6,function(_0x333b32){if(_0x333b32[_0x1a57('0x2a')]!==_0x1a57('0x3b')){var _0x4d6e1e={};_0x4d6e1e[_0x333b32[_0x1a57('0x25')]]={'$like':'%'+_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3a')]+'%'};return _0x4d6e1e;}})});}_0x4a2901=_[_0x1a57('0x3c')]({},_0x4a2901,_0x54f6a5['options']);var _0x1be254={'where':_0x4a2901['where']};return db[_0x1a57('0x28')][_0x1a57('0x1d')](_0x1be254)[_0x1a57('0x21')](function(_0x534a9a){_0x8179a4[_0x1a57('0x1d')]=_0x534a9a;if(_0x54f6a5[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x4a2901[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x28')]['findAll'](_0x4a2901);})[_0x1a57('0x21')](function(_0x47e998){_0x8179a4['rows']=_0x47e998;return _0x8179a4;})[_0x1a57('0x21')](respondWithFilteredResult(_0x2d8738,_0x4a2901))['catch'](handleError(_0x2d8738,null));};exports[_0x1a57('0x3f')]=function(_0x398c59,_0x3fbae1){var _0x59abb1={'raw':!![],'where':{'id':_0x398c59[_0x1a57('0x40')]['id']}},_0x188a50={};_0x188a50[_0x1a57('0x30')]=_[_0x1a57('0x2d')](db['WhatsappQueueReport'][_0x1a57('0x41')]);_0x188a50[_0x1a57('0x2c')]=_['keys'](_0x398c59[_0x1a57('0x2c')]);_0x188a50['filters']=_['intersection'](_0x188a50[_0x1a57('0x30')],_0x188a50[_0x1a57('0x2c')]);_0x59abb1[_0x1a57('0x32')]=_[_0x1a57('0x2f')](_0x188a50['model'],qs[_0x1a57('0x31')](_0x398c59[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x59abb1[_0x1a57('0x32')]=_0x59abb1[_0x1a57('0x32')]['length']?_0x59abb1[_0x1a57('0x32')]:_0x188a50[_0x1a57('0x30')];if(_0x398c59[_0x1a57('0x2c')][_0x1a57('0x3d')]){_0x59abb1['include']=[{'all':!![]}];}_0x59abb1=_[_0x1a57('0x3c')]({},_0x59abb1,_0x398c59['options']);return db[_0x1a57('0x28')][_0x1a57('0x42')](_0x59abb1)[_0x1a57('0x21')](handleEntityNotFound(_0x3fbae1,null))[_0x1a57('0x21')](respondWithResult(_0x3fbae1,null))[_0x1a57('0x43')](handleError(_0x3fbae1,null));};exports[_0x1a57('0x44')]=function(_0x28f629,_0x401285){return db[_0x1a57('0x28')][_0x1a57('0x44')](_0x28f629[_0x1a57('0x45')],{})[_0x1a57('0x21')](respondWithResult(_0x401285,0xc9))[_0x1a57('0x43')](handleError(_0x401285,null));};exports['update']=function(_0xf4d056,_0x480aff){if(_0xf4d056[_0x1a57('0x45')]['id']){delete _0xf4d056[_0x1a57('0x45')]['id'];}return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0xf4d056[_0x1a57('0x40')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x480aff,null))[_0x1a57('0x21')](saveUpdates(_0xf4d056[_0x1a57('0x45')],null))[_0x1a57('0x21')](respondWithResult(_0x480aff,null))['catch'](handleError(_0x480aff,null));};exports[_0x1a57('0x22')]=function(_0x439a42,_0x51651d){return db[_0x1a57('0x28')][_0x1a57('0x42')]({'where':{'id':_0x439a42['params']['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x51651d,null))[_0x1a57('0x21')](removeEntity(_0x51651d,null))['catch'](handleError(_0x51651d,null));};exports['describe']=function(_0x5b0563,_0x2c1bac){return db[_0x1a57('0x28')]['describe']()[_0x1a57('0x21')](respondWithResult(_0x2c1bac,null))[_0x1a57('0x43')](handleError(_0x2c1bac,null));}; \ No newline at end of file +var _0x28f2=['where','pick','filter','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','merge','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x28f2,0x193));var _0x228f=function(_0x5f4893,_0x3bdc21){_0x5f4893=_0x5f4893-0x0;var _0x45a813=_0x28f2[_0x5f4893];return _0x45a813;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x306928,_0x2b3553){return function(_0x272c7d){if(!_0x272c7d){_0x306928[_0x228f('0x1a')](0x194);}return _0x272c7d;};}function handleError(_0x539faa,_0xe8aac){_0xe8aac=_0xe8aac||0x1f4;return function(_0x49efe9){logger[_0x228f('0x28')](_0x49efe9['stack']);if(_0x49efe9['name']){delete _0x49efe9[_0x228f('0x29')];}_0x539faa[_0x228f('0x1b')](_0xe8aac)[_0x228f('0x2a')](_0x49efe9);};}exports[_0x228f('0x2b')]=function(_0x34c735,_0x2c964e){var _0x2eaf4f={},_0x2511e5={},_0xe67c83={'count':0x0,'rows':[]};var _0x2f13d9=_[_0x228f('0x2c')](db[_0x228f('0x2d')][_0x228f('0x2e')],function(_0xc6921f){return{'name':_0xc6921f[_0x228f('0x2f')],'type':_0xc6921f['type'][_0x228f('0x30')]};});_0x2511e5[_0x228f('0x31')]=_[_0x228f('0x2c')](_0x2f13d9,'name');_0x2511e5[_0x228f('0x32')]=_[_0x228f('0x33')](_0x34c735['query']);_0x2511e5[_0x228f('0x34')]=_[_0x228f('0x35')](_0x2511e5[_0x228f('0x31')],_0x2511e5[_0x228f('0x32')]);_0x2eaf4f['attributes']=_[_0x228f('0x35')](_0x2511e5['model'],qs[_0x228f('0x36')](_0x34c735[_0x228f('0x32')][_0x228f('0x36')]));_0x2eaf4f[_0x228f('0x37')]=_0x2eaf4f['attributes'][_0x228f('0x38')]?_0x2eaf4f[_0x228f('0x37')]:_0x2511e5['model'];if(!_0x34c735['query']['hasOwnProperty'](_0x228f('0x39'))){_0x2eaf4f[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x34c735[_0x228f('0x32')][_0x228f('0x1f')]);_0x2eaf4f[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x34c735[_0x228f('0x32')][_0x228f('0x1e')]);}_0x2eaf4f['order']=qs['sort'](_0x34c735[_0x228f('0x32')][_0x228f('0x3a')]);_0x2eaf4f[_0x228f('0x3b')]=qs[_0x228f('0x34')](_[_0x228f('0x3c')](_0x34c735[_0x228f('0x32')],_0x2511e5[_0x228f('0x34')]),_0x2f13d9);if(_0x34c735[_0x228f('0x32')][_0x228f('0x3d')]){_0x2eaf4f[_0x228f('0x3b')]=_['merge'](_0x2eaf4f['where'],{'$or':_[_0x228f('0x2c')](_0x2f13d9,function(_0x29a250){if(_0x29a250[_0x228f('0x3e')]!==_0x228f('0x3f')){var _0x5b7b44={};_0x5b7b44[_0x29a250[_0x228f('0x29')]]={'$like':'%'+_0x34c735[_0x228f('0x32')]['filter']+'%'};return _0x5b7b44;}})});}_0x2eaf4f=_['merge']({},_0x2eaf4f,_0x34c735[_0x228f('0x40')]);var _0x2f6f54={'where':_0x2eaf4f['where']};return db[_0x228f('0x2d')][_0x228f('0x41')](_0x2f6f54)['then'](function(_0x536166){_0xe67c83[_0x228f('0x41')]=_0x536166;if(_0x34c735['query'][_0x228f('0x42')]){_0x2eaf4f[_0x228f('0x43')]=[{'all':!![]}];}return db[_0x228f('0x2d')][_0x228f('0x44')](_0x2eaf4f);})[_0x228f('0x26')](function(_0x20c178){_0xe67c83['rows']=_0x20c178;return _0xe67c83;})[_0x228f('0x26')](respondWithFilteredResult(_0x2c964e,_0x2eaf4f))['catch'](handleError(_0x2c964e,null));};exports[_0x228f('0x45')]=function(_0xc59d9b,_0x285af1){var _0x96126c={'raw':!![],'where':{'id':_0xc59d9b[_0x228f('0x46')]['id']}},_0x41cba5={};_0x41cba5[_0x228f('0x31')]=_[_0x228f('0x33')](db[_0x228f('0x2d')][_0x228f('0x2e')]);_0x41cba5[_0x228f('0x32')]=_[_0x228f('0x33')](_0xc59d9b[_0x228f('0x32')]);_0x41cba5['filters']=_['intersection'](_0x41cba5[_0x228f('0x31')],_0x41cba5[_0x228f('0x32')]);_0x96126c[_0x228f('0x37')]=_[_0x228f('0x35')](_0x41cba5[_0x228f('0x31')],qs[_0x228f('0x36')](_0xc59d9b[_0x228f('0x32')][_0x228f('0x36')]));_0x96126c[_0x228f('0x37')]=_0x96126c[_0x228f('0x37')]['length']?_0x96126c[_0x228f('0x37')]:_0x41cba5[_0x228f('0x31')];if(_0xc59d9b['query'][_0x228f('0x42')]){_0x96126c['include']=[{'all':!![]}];}_0x96126c=_[_0x228f('0x47')]({},_0x96126c,_0xc59d9b['options']);return db[_0x228f('0x2d')]['find'](_0x96126c)[_0x228f('0x26')](handleEntityNotFound(_0x285af1,null))[_0x228f('0x26')](respondWithResult(_0x285af1,null))[_0x228f('0x48')](handleError(_0x285af1,null));};exports[_0x228f('0x49')]=function(_0x3dea4e,_0x2e0054){return db[_0x228f('0x2d')][_0x228f('0x49')](_0x3dea4e[_0x228f('0x4a')],{})[_0x228f('0x26')](respondWithResult(_0x2e0054,0xc9))[_0x228f('0x48')](handleError(_0x2e0054,null));};exports[_0x228f('0x25')]=function(_0x4099d4,_0x250345){if(_0x4099d4[_0x228f('0x4a')]['id']){delete _0x4099d4[_0x228f('0x4a')]['id'];}return db[_0x228f('0x2d')][_0x228f('0x4b')]({'where':{'id':_0x4099d4[_0x228f('0x46')]['id']}})['then'](handleEntityNotFound(_0x250345,null))['then'](saveUpdates(_0x4099d4[_0x228f('0x4a')],null))[_0x228f('0x26')](respondWithResult(_0x250345,null))[_0x228f('0x48')](handleError(_0x250345,null));};exports['destroy']=function(_0x17bcd9,_0x9750ca){return db[_0x228f('0x2d')]['find']({'where':{'id':_0x17bcd9['params']['id']}})['then'](handleEntityNotFound(_0x9750ca,null))[_0x228f('0x26')](removeEntity(_0x9750ca,null))[_0x228f('0x48')](handleError(_0x9750ca,null));};exports[_0x228f('0x4c')]=function(_0x466a2b,_0x42036c){return db[_0x228f('0x2d')][_0x228f('0x4c')]()[_0x228f('0x26')](respondWithResult(_0x42036c,null))[_0x228f('0x48')](handleError(_0x42036c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a6b5452..1f9b41d 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 _0xad72=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid'];(function(_0x1687a9,_0x56e61f){var _0x276d10=function(_0x5a5f46){while(--_0x5a5f46){_0x1687a9['push'](_0x1687a9['shift']());}};_0x276d10(++_0x56e61f);}(_0xad72,0x84));var _0x2ad7=function(_0x3541cd,_0x3c4f1f){_0x3541cd=_0x3541cd-0x0;var _0x3d1ceb=_0xad72[_0x3541cd];return _0x3d1ceb;};'use strict';var _=require('lodash');var util=require(_0x2ad7('0x0'));var logger=require('../../config/logger')(_0x2ad7('0x1'));var moment=require('moment');var BPromise=require(_0x2ad7('0x2'));var rp=require(_0x2ad7('0x3'));var fs=require('fs');var path=require(_0x2ad7('0x4'));var rimraf=require(_0x2ad7('0x5'));var config=require(_0x2ad7('0x6'));var attributes=require(_0x2ad7('0x7'));module[_0x2ad7('0x8')]=function(_0x1acec9,_0x21d7ed){return _0x1acec9[_0x2ad7('0x9')](_0x2ad7('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x2ad7('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0c8=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x48c03c,_0x3a0d41){var _0x33b898=function(_0x1d5f1a){while(--_0x1d5f1a){_0x48c03c['push'](_0x48c03c['shift']());}};_0x33b898(++_0x3a0d41);}(_0xd0c8,0x1d1));var _0x8d0c=function(_0x3ee915,_0x2b50b1){_0x3ee915=_0x3ee915-0x0;var _0x150e50=_0xd0c8[_0x3ee915];return _0x150e50;};'use strict';var _=require(_0x8d0c('0x0'));var util=require(_0x8d0c('0x1'));var logger=require(_0x8d0c('0x2'))(_0x8d0c('0x3'));var moment=require(_0x8d0c('0x4'));var BPromise=require(_0x8d0c('0x5'));var rp=require(_0x8d0c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d0c('0x7'));var config=require(_0x8d0c('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x8d0c('0x9')]=function(_0x283f04,_0xc27cc4){return _0x283f04[_0x8d0c('0xa')](_0x8d0c('0xb'),attributes,{'tableName':_0x8d0c('0xc'),'paranoid':![],'indexes':[{'name':_0x8d0c('0xd'),'fields':[_0x8d0c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e77a3d8..84ac01e 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 _0xc3ba=['debug','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','catch','CreateWhatsappQueueReport','create','body','options','raw','info','WhatsappQueueReport','where','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x4feb79,_0x931f04){var _0x1d8c56=function(_0x86874e){while(--_0x86874e){_0x4feb79['push'](_0x4feb79['shift']());}};_0x1d8c56(++_0x931f04);}(_0xc3ba,0x11a));var _0xac3b=function(_0x2bc188,_0xbcc2fc){_0x2bc188=_0x2bc188-0x0;var _0x3b0a0a=_0xc3ba[_0x2bc188];return _0x3b0a0a;};'use strict';var _=require(_0xac3b('0x0'));var util=require('util');var moment=require(_0xac3b('0x1'));var BPromise=require(_0xac3b('0x2'));var rs=require(_0xac3b('0x3'));var fs=require('fs');var Redis=require(_0xac3b('0x4'));var db=require(_0xac3b('0x5'))['db'];var utils=require(_0xac3b('0x6'));var logger=require(_0xac3b('0x7'))('rpc');var config=require(_0xac3b('0x8'));var jayson=require(_0xac3b('0x9'));var client=jayson[_0xac3b('0xa')][_0xac3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x251f64,_0x12cd53,_0x217f12){return new BPromise(function(_0xd8df61,_0x5787e0){return client[_0xac3b('0xc')](_0x251f64,_0x217f12)[_0xac3b('0xd')](function(_0x21191e){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x12cd53,_0xac3b('0xe'));logger[_0xac3b('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x12cd53,'request\x20sent',JSON[_0xac3b('0x10')](_0x21191e));if(_0x21191e[_0xac3b('0x11')]){if(_0x21191e[_0xac3b('0x11')][_0xac3b('0x12')]===0x1f4){logger[_0xac3b('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x12cd53,_0x21191e[_0xac3b('0x11')][_0xac3b('0x13')]);return _0x5787e0(_0x21191e['error'][_0xac3b('0x13')]);}logger['error'](_0xac3b('0x14'),_0x12cd53,_0x21191e[_0xac3b('0x11')][_0xac3b('0x13')]);return _0xd8df61(_0x21191e['error'][_0xac3b('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x12cd53,'request\x20sent');_0xd8df61(_0x21191e['result'][_0xac3b('0x13')]);}})[_0xac3b('0x15')](function(_0x487b72){logger['error'](_0xac3b('0x14'),_0x12cd53,_0x487b72);_0x5787e0(_0x487b72);});});}exports[_0xac3b('0x16')]=function(_0x40e44c){var _0x57f6df=this;return new Promise(function(_0xf21c5c,_0xb37ede){return db['WhatsappQueueReport'][_0xac3b('0x17')](_0x40e44c[_0xac3b('0x18')],{'raw':_0x40e44c[_0xac3b('0x19')]?_0x40e44c[_0xac3b('0x19')][_0xac3b('0x1a')]===undefined?!![]:![]:!![]})[_0xac3b('0xd')](function(_0x29e2a2){logger[_0xac3b('0x1b')](_0xac3b('0x16'),_0x40e44c);logger[_0xac3b('0xf')](_0xac3b('0x16'),_0x40e44c,JSON['stringify'](_0x29e2a2));_0xf21c5c(_0x29e2a2);})[_0xac3b('0x15')](function(_0x1d2f3e){logger['error'](_0xac3b('0x16'),_0x1d2f3e['message'],_0x40e44c);_0xb37ede(_0x57f6df[_0xac3b('0x11')](0x1f4,_0x1d2f3e[_0xac3b('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x3925de){var _0x4b53c6=this;return new Promise(function(_0x13e0df,_0x51be1a){return db[_0xac3b('0x1c')]['update'](_0x3925de[_0xac3b('0x18')],{'raw':_0x3925de[_0xac3b('0x19')]?_0x3925de['options'][_0xac3b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3925de[_0xac3b('0x19')]?_0x3925de[_0xac3b('0x19')][_0xac3b('0x1d')]||null:null,'attributes':_0x3925de[_0xac3b('0x19')]?_0x3925de[_0xac3b('0x19')][_0xac3b('0x1e')]||null:null,'limit':_0x3925de[_0xac3b('0x19')]?_0x3925de[_0xac3b('0x19')][_0xac3b('0x1f')]||null:null})['then'](function(_0x4a46a6){logger[_0xac3b('0x1b')](_0xac3b('0x20'),_0x3925de);logger[_0xac3b('0xf')](_0xac3b('0x20'),_0x3925de,JSON[_0xac3b('0x10')](_0x4a46a6));_0x13e0df(_0x4a46a6);})[_0xac3b('0x15')](function(_0x11de6b){logger[_0xac3b('0x11')](_0xac3b('0x20'),_0x11de6b[_0xac3b('0x13')],_0x3925de);_0x51be1a(_0x4b53c6[_0xac3b('0x11')](0x1f4,_0x11de6b[_0xac3b('0x13')]));});});}; \ No newline at end of file +var _0xe962=['WhatsappQueueReport','body','options','debug','stringify','UpdateWhatsappQueueReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport'];(function(_0x2133a1,_0x561b0a){var _0x4773e7=function(_0x2f2008){while(--_0x2f2008){_0x2133a1['push'](_0x2133a1['shift']());}};_0x4773e7(++_0x561b0a);}(_0xe962,0x154));var _0x2e96=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe962[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2e96('0x0'));var util=require(_0x2e96('0x1'));var moment=require(_0x2e96('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e96('0x3'));var fs=require('fs');var Redis=require(_0x2e96('0x4'));var db=require(_0x2e96('0x5'))['db'];var utils=require(_0x2e96('0x6'));var logger=require(_0x2e96('0x7'))(_0x2e96('0x8'));var config=require(_0x2e96('0x9'));var jayson=require(_0x2e96('0xa'));var client=jayson[_0x2e96('0xb')][_0x2e96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x196aa0,_0x4096df,_0xc99158){return new BPromise(function(_0x5527cd,_0x2affc9){return client[_0x2e96('0xd')](_0x196aa0,_0xc99158)[_0x2e96('0xe')](function(_0x5efd70){logger[_0x2e96('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4096df,_0x2e96('0x10'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4096df,_0x2e96('0x10'),JSON['stringify'](_0x5efd70));if(_0x5efd70[_0x2e96('0x11')]){if(_0x5efd70['error'][_0x2e96('0x12')]===0x1f4){logger[_0x2e96('0x11')](_0x2e96('0x13'),_0x4096df,_0x5efd70['error'][_0x2e96('0x14')]);return _0x2affc9(_0x5efd70[_0x2e96('0x11')]['message']);}logger[_0x2e96('0x11')](_0x2e96('0x13'),_0x4096df,_0x5efd70[_0x2e96('0x11')][_0x2e96('0x14')]);return _0x5527cd(_0x5efd70[_0x2e96('0x11')]['message']);}else{logger[_0x2e96('0xf')](_0x2e96('0x13'),_0x4096df,_0x2e96('0x10'));_0x5527cd(_0x5efd70['result']['message']);}})[_0x2e96('0x15')](function(_0x317316){logger['error'](_0x2e96('0x13'),_0x4096df,_0x317316);_0x2affc9(_0x317316);});});}exports[_0x2e96('0x16')]=function(_0xd50037){var _0x49924b=this;return new Promise(function(_0x4a8d35,_0x50253d){return db[_0x2e96('0x17')]['create'](_0xd50037[_0x2e96('0x18')],{'raw':_0xd50037[_0x2e96('0x19')]?_0xd50037[_0x2e96('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4634bf){logger[_0x2e96('0xf')](_0x2e96('0x16'),_0xd50037);logger[_0x2e96('0x1a')](_0x2e96('0x16'),_0xd50037,JSON[_0x2e96('0x1b')](_0x4634bf));_0x4a8d35(_0x4634bf);})['catch'](function(_0x92c13d){logger[_0x2e96('0x11')](_0x2e96('0x16'),_0x92c13d[_0x2e96('0x14')],_0xd50037);_0x50253d(_0x49924b[_0x2e96('0x11')](0x1f4,_0x92c13d['message']));});});};exports[_0x2e96('0x1c')]=function(_0x65bf56){var _0x48ec64=this;return new Promise(function(_0x28d280,_0x1b784e){return db[_0x2e96('0x17')][_0x2e96('0x1d')](_0x65bf56[_0x2e96('0x18')],{'raw':_0x65bf56[_0x2e96('0x19')]?_0x65bf56[_0x2e96('0x19')][_0x2e96('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x65bf56[_0x2e96('0x19')]?_0x65bf56[_0x2e96('0x19')][_0x2e96('0x1f')]||null:null,'attributes':_0x65bf56[_0x2e96('0x19')]?_0x65bf56[_0x2e96('0x19')][_0x2e96('0x20')]||null:null,'limit':_0x65bf56[_0x2e96('0x19')]?_0x65bf56[_0x2e96('0x19')]['limit']||null:null})['then'](function(_0x19960a){logger[_0x2e96('0xf')](_0x2e96('0x1c'),_0x65bf56);logger[_0x2e96('0x1a')](_0x2e96('0x1c'),_0x65bf56,JSON[_0x2e96('0x1b')](_0x19960a));_0x28d280(_0x19960a);})['catch'](function(_0x598051){logger[_0x2e96('0x11')]('UpdateWhatsappQueueReport',_0x598051[_0x2e96('0x14')],_0x65bf56);_0x1b784e(_0x48ec64[_0x2e96('0x11')](0x1f4,_0x598051['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 01012da..2aedfd7 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 _0x3578=['create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','post'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3578,0x114));var _0x8357=function(_0x179b68,_0x339d82){_0x179b68=_0x179b68-0x0;var _0x5e6d69=_0x3578[_0x179b68];return _0x5e6d69;};'use strict';var multer=require(_0x8357('0x0'));var util=require(_0x8357('0x1'));var path=require(_0x8357('0x2'));var timeout=require('connect-timeout');var express=require(_0x8357('0x3'));var router=express[_0x8357('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8357('0x5'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0x8357('0x6')]('/',auth['isAuthenticated'](),controller[_0x8357('0x7')]);router['get'](_0x8357('0x8'),auth[_0x8357('0x9')](),controller[_0x8357('0xa')]);router[_0x8357('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8357('0xb')]('/',auth[_0x8357('0x9')](),controller[_0x8357('0xc')]);router[_0x8357('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8357('0xe')](_0x8357('0xf'),auth[_0x8357('0x9')](),controller[_0x8357('0x10')]);module[_0x8357('0x11')]=router; \ No newline at end of file +var _0xf432=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xf432,0x109));var _0x2f43=function(_0x5f35c5,_0x48949c){_0x5f35c5=_0x5f35c5-0x0;var _0x5e5d64=_0xf432[_0x5f35c5];return _0x5e5d64;};'use strict';var multer=require(_0x2f43('0x0'));var util=require(_0x2f43('0x1'));var path=require(_0x2f43('0x2'));var timeout=require(_0x2f43('0x3'));var express=require('express');var router=express[_0x2f43('0x4')]();var fs_extra=require(_0x2f43('0x5'));var auth=require(_0x2f43('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f43('0x7'));var controller=require(_0x2f43('0x8'));router['get']('/',auth[_0x2f43('0x9')](),controller[_0x2f43('0xa')]);router[_0x2f43('0xb')](_0x2f43('0xc'),auth[_0x2f43('0x9')](),controller[_0x2f43('0xd')]);router[_0x2f43('0xb')](_0x2f43('0xe'),auth['isAuthenticated'](),controller[_0x2f43('0xf')]);router[_0x2f43('0x10')]('/',auth[_0x2f43('0x9')](),controller[_0x2f43('0x11')]);router[_0x2f43('0x12')](_0x2f43('0xe'),auth[_0x2f43('0x9')](),controller['update']);router[_0x2f43('0x13')](_0x2f43('0xe'),auth[_0x2f43('0x9')](),controller[_0x2f43('0x14')]);module[_0x2f43('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 bf0070f..e5f4588 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 _0x78e2=['STRING','ENUM','account','queue','sequelize','exports'];(function(_0x24ad48,_0x31c1d6){var _0x6b5cc1=function(_0x597f57){while(--_0x597f57){_0x24ad48['push'](_0x24ad48['shift']());}};_0x6b5cc1(++_0x31c1d6);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x278e('0x0'));module[_0x278e('0x1')]={'uniqueid':{'type':Sequelize[_0x278e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x278e('0x3')](_0x278e('0x4'),'agent',_0x278e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2964=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x2335bd,_0x54e892){var _0x2aac2c=function(_0x3194dc){while(--_0x3194dc){_0x2335bd['push'](_0x2335bd['shift']());}};_0x2aac2c(++_0x54e892);}(_0x2964,0x108));var _0x4296=function(_0x5d19be,_0x25d90b){_0x5d19be=_0x5d19be-0x0;var _0x367003=_0x2964[_0x5d19be];return _0x367003;};'use strict';var Sequelize=require(_0x4296('0x0'));module[_0x4296('0x1')]={'uniqueid':{'type':Sequelize[_0x4296('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4296('0x3')](_0x4296('0x4'),_0x4296('0x5'),_0x4296('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4296('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6cb3aa6..c685228 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 _0xff69=['keys','find','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff69,0x119));var _0x9ff6=function(_0x3f4a8e,_0x507c39){_0x3f4a8e=_0x3f4a8e-0x0;var _0x7f68fd=_0xff69[_0x3f4a8e];return _0x7f68fd;};'use strict';var emlformat=require(_0x9ff6('0x0'));var rimraf=require(_0x9ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ff6('0x2'));var rp=require(_0x9ff6('0x3'));var moment=require(_0x9ff6('0x4'));var BPromise=require(_0x9ff6('0x5'));var Mustache=require(_0x9ff6('0x6'));var util=require('util');var path=require(_0x9ff6('0x7'));var sox=require(_0x9ff6('0x8'));var csv=require(_0x9ff6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ff6('0xa'));var _=require(_0x9ff6('0xb'));var squel=require('squel');var crypto=require(_0x9ff6('0xc'));var jsforce=require(_0x9ff6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ff6('0x9'));var querystring=require(_0x9ff6('0xe'));var Papa=require(_0x9ff6('0xf'));var Redis=require(_0x9ff6('0x10'));var authService=require(_0x9ff6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ff6('0x12'));var hardwareService=require(_0x9ff6('0x13'));var logger=require(_0x9ff6('0x14'))('api');var utils=require(_0x9ff6('0x15'));var config=require(_0x9ff6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff6('0x17'))['db'];function respondWithStatusCode(_0x545b8c,_0x54d7b8){_0x54d7b8=_0x54d7b8||0xcc;return function(_0x59ac90){if(_0x59ac90){return _0x545b8c[_0x9ff6('0x18')](_0x54d7b8);}return _0x545b8c['status'](_0x54d7b8)[_0x9ff6('0x19')]();};}function respondWithResult(_0x1322f6,_0x451796){_0x451796=_0x451796||0xc8;return function(_0x238358){if(_0x238358){return _0x1322f6['status'](_0x451796)[_0x9ff6('0x1a')](_0x238358);}};}function respondWithFilteredResult(_0x1eb958,_0x1d8539){return function(_0x1ef441){if(_0x1ef441){var _0x2399b5=typeof _0x1d8539[_0x9ff6('0x1b')]===_0x9ff6('0x1c')&&typeof _0x1d8539[_0x9ff6('0x1d')]==='undefined';var _0x36e1d5=_0x1ef441[_0x9ff6('0x1e')];var _0x4e590f=_0x2399b5?0x0:_0x1d8539[_0x9ff6('0x1b')];var _0x16a068=_0x2399b5?_0x1ef441[_0x9ff6('0x1e')]:_0x1d8539[_0x9ff6('0x1b')]+_0x1d8539[_0x9ff6('0x1d')];var _0xbfca9e;if(_0x16a068>=_0x36e1d5){_0x16a068=_0x36e1d5;_0xbfca9e=0xc8;}else{_0xbfca9e=0xce;}_0x1eb958[_0x9ff6('0x1f')](_0xbfca9e);return _0x1eb958[_0x9ff6('0x20')]('Content-Range',_0x4e590f+'-'+_0x16a068+'/'+_0x36e1d5)[_0x9ff6('0x1a')](_0x1ef441);}return null;};}function patchUpdates(_0x46ea91){return function(_0x284400){try{jsonpatch['apply'](_0x284400,_0x46ea91,!![]);}catch(_0x477c1b){return BPromise[_0x9ff6('0x21')](_0x477c1b);}return _0x284400[_0x9ff6('0x22')]();};}function saveUpdates(_0x4023bf,_0x46a523){return function(_0x2c7830){if(_0x2c7830){return _0x2c7830['update'](_0x4023bf)[_0x9ff6('0x23')](function(_0x5bd5da){return _0x5bd5da;});}return null;};}function removeEntity(_0x4d5236,_0xef6254){return function(_0x38d281){if(_0x38d281){return _0x38d281['destroy']()['then'](function(){_0x4d5236[_0x9ff6('0x1f')](0xcc)[_0x9ff6('0x19')]();});}};}function handleEntityNotFound(_0xc6f160,_0x236038){return function(_0x21c211){if(!_0x21c211){_0xc6f160['sendStatus'](0x194);}return _0x21c211;};}function handleError(_0x3725b2,_0x2bcfba){_0x2bcfba=_0x2bcfba||0x1f4;return function(_0x122ca4){logger[_0x9ff6('0x24')](_0x122ca4['stack']);if(_0x122ca4[_0x9ff6('0x25')]){delete _0x122ca4[_0x9ff6('0x25')];}_0x3725b2[_0x9ff6('0x1f')](_0x2bcfba)[_0x9ff6('0x26')](_0x122ca4);};}exports[_0x9ff6('0x27')]=function(_0x31a9a1,_0x1158e0){var _0x260749={},_0x3088ee={},_0x3a9df1={'count':0x0,'rows':[]};var _0x4a00be=_[_0x9ff6('0x28')](db[_0x9ff6('0x29')][_0x9ff6('0x2a')],function(_0x171109){return{'name':_0x171109['fieldName'],'type':_0x171109[_0x9ff6('0x2b')][_0x9ff6('0x2c')]};});_0x3088ee[_0x9ff6('0x2d')]=_['map'](_0x4a00be,_0x9ff6('0x25'));_0x3088ee[_0x9ff6('0x2e')]=_['keys'](_0x31a9a1[_0x9ff6('0x2e')]);_0x3088ee[_0x9ff6('0x2f')]=_[_0x9ff6('0x30')](_0x3088ee[_0x9ff6('0x2d')],_0x3088ee[_0x9ff6('0x2e')]);_0x260749['attributes']=_[_0x9ff6('0x30')](_0x3088ee[_0x9ff6('0x2d')],qs['fields'](_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x31')]));_0x260749[_0x9ff6('0x32')]=_0x260749[_0x9ff6('0x32')][_0x9ff6('0x33')]?_0x260749[_0x9ff6('0x32')]:_0x3088ee[_0x9ff6('0x2d')];if(!_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x34')]('nolimit')){_0x260749[_0x9ff6('0x1d')]=qs[_0x9ff6('0x1d')](_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x1d')]);_0x260749[_0x9ff6('0x1b')]=qs[_0x9ff6('0x1b')](_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x1b')]);}_0x260749['order']=qs['sort'](_0x31a9a1['query']['sort']);_0x260749[_0x9ff6('0x35')]=qs[_0x9ff6('0x2f')](_[_0x9ff6('0x36')](_0x31a9a1[_0x9ff6('0x2e')],_0x3088ee[_0x9ff6('0x2f')]),_0x4a00be);if(_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x37')]){_0x260749[_0x9ff6('0x35')]=_[_0x9ff6('0x38')](_0x260749[_0x9ff6('0x35')],{'$or':_[_0x9ff6('0x28')](_0x4a00be,function(_0x1bb9bc){if(_0x1bb9bc['type']!==_0x9ff6('0x39')){var _0x5e63f8={};_0x5e63f8[_0x1bb9bc[_0x9ff6('0x25')]]={'$like':'%'+_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x37')]+'%'};return _0x5e63f8;}})});}_0x260749=_[_0x9ff6('0x38')]({},_0x260749,_0x31a9a1[_0x9ff6('0x3a')]);var _0xc1ae25={'where':_0x260749[_0x9ff6('0x35')]};return db[_0x9ff6('0x29')][_0x9ff6('0x1e')](_0xc1ae25)[_0x9ff6('0x23')](function(_0x5bfe10){_0x3a9df1[_0x9ff6('0x1e')]=_0x5bfe10;if(_0x31a9a1[_0x9ff6('0x2e')][_0x9ff6('0x3b')]){_0x260749[_0x9ff6('0x3c')]=[{'all':!![]}];}return db[_0x9ff6('0x29')]['findAll'](_0x260749);})[_0x9ff6('0x23')](function(_0x443741){_0x3a9df1['rows']=_0x443741;return _0x3a9df1;})[_0x9ff6('0x23')](respondWithFilteredResult(_0x1158e0,_0x260749))[_0x9ff6('0x3d')](handleError(_0x1158e0,null));};exports[_0x9ff6('0x3e')]=function(_0x1e52fd,_0xe077e8){var _0x4b2405={'raw':!![],'where':{'id':_0x1e52fd[_0x9ff6('0x3f')]['id']}},_0x446fd8={};_0x446fd8['model']=_[_0x9ff6('0x40')](db['WhatsappTransferReport']['rawAttributes']);_0x446fd8[_0x9ff6('0x2e')]=_[_0x9ff6('0x40')](_0x1e52fd[_0x9ff6('0x2e')]);_0x446fd8[_0x9ff6('0x2f')]=_[_0x9ff6('0x30')](_0x446fd8['model'],_0x446fd8[_0x9ff6('0x2e')]);_0x4b2405[_0x9ff6('0x32')]=_[_0x9ff6('0x30')](_0x446fd8[_0x9ff6('0x2d')],qs[_0x9ff6('0x31')](_0x1e52fd['query']['fields']));_0x4b2405['attributes']=_0x4b2405[_0x9ff6('0x32')][_0x9ff6('0x33')]?_0x4b2405[_0x9ff6('0x32')]:_0x446fd8[_0x9ff6('0x2d')];if(_0x1e52fd['query']['includeAll']){_0x4b2405[_0x9ff6('0x3c')]=[{'all':!![]}];}_0x4b2405=_['merge']({},_0x4b2405,_0x1e52fd['options']);return db[_0x9ff6('0x29')][_0x9ff6('0x41')](_0x4b2405)[_0x9ff6('0x23')](handleEntityNotFound(_0xe077e8,null))[_0x9ff6('0x23')](respondWithResult(_0xe077e8,null))['catch'](handleError(_0xe077e8,null));};exports['create']=function(_0x1b0588,_0x453ab3){return db[_0x9ff6('0x29')]['create'](_0x1b0588[_0x9ff6('0x42')],{})[_0x9ff6('0x23')](respondWithResult(_0x453ab3,0xc9))[_0x9ff6('0x3d')](handleError(_0x453ab3,null));};exports['update']=function(_0x53f8b6,_0x4b4ab5){if(_0x53f8b6['body']['id']){delete _0x53f8b6[_0x9ff6('0x42')]['id'];}return db[_0x9ff6('0x29')][_0x9ff6('0x41')]({'where':{'id':_0x53f8b6[_0x9ff6('0x3f')]['id']}})[_0x9ff6('0x23')](handleEntityNotFound(_0x4b4ab5,null))[_0x9ff6('0x23')](saveUpdates(_0x53f8b6['body'],null))[_0x9ff6('0x23')](respondWithResult(_0x4b4ab5,null))[_0x9ff6('0x3d')](handleError(_0x4b4ab5,null));};exports[_0x9ff6('0x43')]=function(_0x36ee89,_0x24501e){return db[_0x9ff6('0x29')]['find']({'where':{'id':_0x36ee89[_0x9ff6('0x3f')]['id']}})[_0x9ff6('0x23')](handleEntityNotFound(_0x24501e,null))['then'](removeEntity(_0x24501e,null))[_0x9ff6('0x3d')](handleError(_0x24501e,null));};exports[_0x9ff6('0x44')]=function(_0x46e1bb,_0x4cf97a){return db[_0x9ff6('0x29')][_0x9ff6('0x44')]()[_0x9ff6('0x23')](respondWithResult(_0x4cf97a,null))[_0x9ff6('0x3d')](handleError(_0x4cf97a,null));}; \ No newline at end of file +var _0x65c5=['name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x65c5,0x1c5));var _0x565c=function(_0x309a00,_0xfd034b){_0x309a00=_0x309a00-0x0;var _0x599ae8=_0x65c5[_0x309a00];return _0x599ae8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x565c('0x0'));var jsonpatch=require(_0x565c('0x1'));var rp=require('request-promise');var moment=require(_0x565c('0x2'));var BPromise=require(_0x565c('0x3'));var Mustache=require(_0x565c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x565c('0x5'));var csv=require(_0x565c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x565c('0x7'));var _=require(_0x565c('0x8'));var squel=require(_0x565c('0x9'));var crypto=require(_0x565c('0xa'));var jsforce=require(_0x565c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x565c('0xc'));var Papa=require(_0x565c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x565c('0xe'));var logger=require(_0x565c('0xf'))(_0x565c('0x10'));var utils=require(_0x565c('0x11'));var config=require(_0x565c('0x12'));var licenseUtil=require(_0x565c('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3abf1e,_0x538907){_0x538907=_0x538907||0xcc;return function(_0x438a38){if(_0x438a38){return _0x3abf1e[_0x565c('0x14')](_0x538907);}return _0x3abf1e[_0x565c('0x15')](_0x538907)['end']();};}function respondWithResult(_0x37e857,_0x508f30){_0x508f30=_0x508f30||0xc8;return function(_0x5be86c){if(_0x5be86c){return _0x37e857['status'](_0x508f30)[_0x565c('0x16')](_0x5be86c);}};}function respondWithFilteredResult(_0x3ada97,_0x190b75){return function(_0x4624d0){if(_0x4624d0){var _0x544292=typeof _0x190b75['offset']===_0x565c('0x17')&&typeof _0x190b75[_0x565c('0x18')]==='undefined';var _0x4889e2=_0x4624d0['count'];var _0xc00936=_0x544292?0x0:_0x190b75[_0x565c('0x19')];var _0x42bc0c=_0x544292?_0x4624d0[_0x565c('0x1a')]:_0x190b75[_0x565c('0x19')]+_0x190b75[_0x565c('0x18')];var _0x12a098;if(_0x42bc0c>=_0x4889e2){_0x42bc0c=_0x4889e2;_0x12a098=0xc8;}else{_0x12a098=0xce;}_0x3ada97[_0x565c('0x15')](_0x12a098);return _0x3ada97[_0x565c('0x1b')](_0x565c('0x1c'),_0xc00936+'-'+_0x42bc0c+'/'+_0x4889e2)[_0x565c('0x16')](_0x4624d0);}return null;};}function patchUpdates(_0x38726a){return function(_0x1045d1){try{jsonpatch[_0x565c('0x1d')](_0x1045d1,_0x38726a,!![]);}catch(_0x4d319c){return BPromise[_0x565c('0x1e')](_0x4d319c);}return _0x1045d1[_0x565c('0x1f')]();};}function saveUpdates(_0x5b8dd1,_0x49d676){return function(_0x263ef4){if(_0x263ef4){return _0x263ef4[_0x565c('0x20')](_0x5b8dd1)['then'](function(_0xcd4e71){return _0xcd4e71;});}return null;};}function removeEntity(_0x1631f1,_0x1de035){return function(_0xa0209d){if(_0xa0209d){return _0xa0209d[_0x565c('0x21')]()[_0x565c('0x22')](function(){_0x1631f1[_0x565c('0x15')](0xcc)[_0x565c('0x23')]();});}};}function handleEntityNotFound(_0x5896ea,_0x209c9d){return function(_0x84224a){if(!_0x84224a){_0x5896ea[_0x565c('0x14')](0x194);}return _0x84224a;};}function handleError(_0x88acbd,_0x3c1223){_0x3c1223=_0x3c1223||0x1f4;return function(_0x104da8){logger[_0x565c('0x24')](_0x104da8['stack']);if(_0x104da8[_0x565c('0x25')]){delete _0x104da8[_0x565c('0x25')];}_0x88acbd[_0x565c('0x15')](_0x3c1223)['send'](_0x104da8);};}exports[_0x565c('0x26')]=function(_0x3203a4,_0x4a12f2){var _0xc96ece={},_0x355a15={},_0x3263c5={'count':0x0,'rows':[]};var _0x5b401e=_[_0x565c('0x27')](db[_0x565c('0x28')][_0x565c('0x29')],function(_0x379caa){return{'name':_0x379caa[_0x565c('0x2a')],'type':_0x379caa[_0x565c('0x2b')][_0x565c('0x2c')]};});_0x355a15[_0x565c('0x2d')]=_[_0x565c('0x27')](_0x5b401e,_0x565c('0x25'));_0x355a15[_0x565c('0x2e')]=_[_0x565c('0x2f')](_0x3203a4[_0x565c('0x2e')]);_0x355a15['filters']=_[_0x565c('0x30')](_0x355a15['model'],_0x355a15[_0x565c('0x2e')]);_0xc96ece[_0x565c('0x31')]=_[_0x565c('0x30')](_0x355a15['model'],qs['fields'](_0x3203a4[_0x565c('0x2e')][_0x565c('0x32')]));_0xc96ece[_0x565c('0x31')]=_0xc96ece[_0x565c('0x31')]['length']?_0xc96ece['attributes']:_0x355a15[_0x565c('0x2d')];if(!_0x3203a4[_0x565c('0x2e')][_0x565c('0x33')](_0x565c('0x34'))){_0xc96ece[_0x565c('0x18')]=qs[_0x565c('0x18')](_0x3203a4[_0x565c('0x2e')][_0x565c('0x18')]);_0xc96ece['offset']=qs[_0x565c('0x19')](_0x3203a4[_0x565c('0x2e')]['offset']);}_0xc96ece['order']=qs[_0x565c('0x35')](_0x3203a4[_0x565c('0x2e')][_0x565c('0x35')]);_0xc96ece[_0x565c('0x36')]=qs['filters'](_['pick'](_0x3203a4[_0x565c('0x2e')],_0x355a15['filters']),_0x5b401e);if(_0x3203a4[_0x565c('0x2e')]['filter']){_0xc96ece['where']=_[_0x565c('0x37')](_0xc96ece[_0x565c('0x36')],{'$or':_['map'](_0x5b401e,function(_0x59992d){if(_0x59992d[_0x565c('0x2b')]!==_0x565c('0x38')){var _0x1ab5c5={};_0x1ab5c5[_0x59992d[_0x565c('0x25')]]={'$like':'%'+_0x3203a4[_0x565c('0x2e')]['filter']+'%'};return _0x1ab5c5;}})});}_0xc96ece=_[_0x565c('0x37')]({},_0xc96ece,_0x3203a4[_0x565c('0x39')]);var _0x3ffbbd={'where':_0xc96ece[_0x565c('0x36')]};return db[_0x565c('0x28')][_0x565c('0x1a')](_0x3ffbbd)[_0x565c('0x22')](function(_0xa81703){_0x3263c5[_0x565c('0x1a')]=_0xa81703;if(_0x3203a4['query']['includeAll']){_0xc96ece[_0x565c('0x3a')]=[{'all':!![]}];}return db[_0x565c('0x28')][_0x565c('0x3b')](_0xc96ece);})['then'](function(_0x35cb64){_0x3263c5[_0x565c('0x3c')]=_0x35cb64;return _0x3263c5;})[_0x565c('0x22')](respondWithFilteredResult(_0x4a12f2,_0xc96ece))[_0x565c('0x3d')](handleError(_0x4a12f2,null));};exports[_0x565c('0x3e')]=function(_0x1ab1eb,_0x1fe724){var _0x32f87c={'raw':!![],'where':{'id':_0x1ab1eb[_0x565c('0x3f')]['id']}},_0x56f830={};_0x56f830[_0x565c('0x2d')]=_[_0x565c('0x2f')](db[_0x565c('0x28')][_0x565c('0x29')]);_0x56f830[_0x565c('0x2e')]=_[_0x565c('0x2f')](_0x1ab1eb[_0x565c('0x2e')]);_0x56f830[_0x565c('0x40')]=_[_0x565c('0x30')](_0x56f830[_0x565c('0x2d')],_0x56f830[_0x565c('0x2e')]);_0x32f87c[_0x565c('0x31')]=_[_0x565c('0x30')](_0x56f830[_0x565c('0x2d')],qs[_0x565c('0x32')](_0x1ab1eb[_0x565c('0x2e')][_0x565c('0x32')]));_0x32f87c['attributes']=_0x32f87c[_0x565c('0x31')][_0x565c('0x41')]?_0x32f87c[_0x565c('0x31')]:_0x56f830[_0x565c('0x2d')];if(_0x1ab1eb[_0x565c('0x2e')]['includeAll']){_0x32f87c[_0x565c('0x3a')]=[{'all':!![]}];}_0x32f87c=_[_0x565c('0x37')]({},_0x32f87c,_0x1ab1eb[_0x565c('0x39')]);return db[_0x565c('0x28')][_0x565c('0x42')](_0x32f87c)['then'](handleEntityNotFound(_0x1fe724,null))[_0x565c('0x22')](respondWithResult(_0x1fe724,null))['catch'](handleError(_0x1fe724,null));};exports[_0x565c('0x43')]=function(_0x577970,_0x2a04a7){return db[_0x565c('0x28')][_0x565c('0x43')](_0x577970[_0x565c('0x44')],{})[_0x565c('0x22')](respondWithResult(_0x2a04a7,0xc9))[_0x565c('0x3d')](handleError(_0x2a04a7,null));};exports[_0x565c('0x20')]=function(_0x2b6cd6,_0x5e330b){if(_0x2b6cd6[_0x565c('0x44')]['id']){delete _0x2b6cd6[_0x565c('0x44')]['id'];}return db['WhatsappTransferReport'][_0x565c('0x42')]({'where':{'id':_0x2b6cd6[_0x565c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e330b,null))['then'](saveUpdates(_0x2b6cd6[_0x565c('0x44')],null))[_0x565c('0x22')](respondWithResult(_0x5e330b,null))[_0x565c('0x3d')](handleError(_0x5e330b,null));};exports[_0x565c('0x21')]=function(_0xaf1795,_0x2b6552){return db[_0x565c('0x28')][_0x565c('0x42')]({'where':{'id':_0xaf1795[_0x565c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2b6552,null))['then'](removeEntity(_0x2b6552,null))['catch'](handleError(_0x2b6552,null));};exports[_0x565c('0x45')]=function(_0x33a7c9,_0x45c509){return db[_0x565c('0x28')]['describe']()[_0x565c('0x22')](respondWithResult(_0x45c509,null))[_0x565c('0x3d')](handleError(_0x45c509,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8f7e4a8..57aeea3 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 _0xc3b1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3b1,0xed));var _0x1c3b=function(_0x1e4b80,_0x34c3f6){_0x1e4b80=_0x1e4b80-0x0;var _0x4cc1bd=_0xc3b1[_0x1e4b80];return _0x4cc1bd;};'use strict';var _=require(_0x1c3b('0x0'));var util=require(_0x1c3b('0x1'));var logger=require(_0x1c3b('0x2'))(_0x1c3b('0x3'));var moment=require(_0x1c3b('0x4'));var BPromise=require(_0x1c3b('0x5'));var rp=require(_0x1c3b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c3b('0x7'));var config=require(_0x1c3b('0x8'));var attributes=require(_0x1c3b('0x9'));module['exports']=function(_0x106c9d,_0x2d8982){return _0x106c9d[_0x1c3b('0xa')](_0x1c3b('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe38=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x6787a4,_0x3f549f){var _0x26c1c9=function(_0x340e98){while(--_0x340e98){_0x6787a4['push'](_0x6787a4['shift']());}};_0x26c1c9(++_0x3f549f);}(_0xbe38,0xc4));var _0x8be3=function(_0x29186d,_0x4743c9){_0x29186d=_0x29186d-0x0;var _0x157360=_0xbe38[_0x29186d];return _0x157360;};'use strict';var _=require(_0x8be3('0x0'));var util=require('util');var logger=require(_0x8be3('0x1'))(_0x8be3('0x2'));var moment=require(_0x8be3('0x3'));var BPromise=require('bluebird');var rp=require(_0x8be3('0x4'));var fs=require('fs');var path=require(_0x8be3('0x5'));var rimraf=require(_0x8be3('0x6'));var config=require(_0x8be3('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x8be3('0x8')]=function(_0x5cb302,_0xb3add){return _0x5cb302['define'](_0x8be3('0x9'),attributes,{'tableName':_0x8be3('0xa'),'paranoid':![],'indexes':[{'name':_0x8be3('0xb'),'fields':[_0x8be3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index fa78e6f..4c0234f 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 _0x382a=['request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x382a,0x19a));var _0xa382=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x382a[_0x903228];return _0xcec81d;};'use strict';var _=require(_0xa382('0x0'));var util=require(_0xa382('0x1'));var moment=require(_0xa382('0x2'));var BPromise=require(_0xa382('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa382('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa382('0x5'))(_0xa382('0x6'));var config=require(_0xa382('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa382('0x8')][_0xa382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ea3a,_0x4cdd7f,_0x4339c0){return new BPromise(function(_0x125843,_0x5280f5){return client[_0xa382('0xa')](_0x23ea3a,_0x4339c0)[_0xa382('0xb')](function(_0x5f3f64){logger[_0xa382('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4cdd7f,'request\x20sent');logger['debug'](_0xa382('0xd'),_0x4cdd7f,_0xa382('0xe'),JSON['stringify'](_0x5f3f64));if(_0x5f3f64[_0xa382('0xf')]){if(_0x5f3f64[_0xa382('0xf')][_0xa382('0x10')]===0x1f4){logger[_0xa382('0xf')](_0xa382('0x11'),_0x4cdd7f,_0x5f3f64['error']['message']);return _0x5280f5(_0x5f3f64['error'][_0xa382('0x12')]);}logger[_0xa382('0xf')](_0xa382('0x11'),_0x4cdd7f,_0x5f3f64['error'][_0xa382('0x12')]);return _0x125843(_0x5f3f64[_0xa382('0xf')]['message']);}else{logger[_0xa382('0xc')](_0xa382('0x11'),_0x4cdd7f,'request\x20sent');_0x125843(_0x5f3f64[_0xa382('0x13')]['message']);}})['catch'](function(_0x536abe){logger[_0xa382('0xf')](_0xa382('0x11'),_0x4cdd7f,_0x536abe);_0x5280f5(_0x536abe);});});} \ No newline at end of file +var _0x6bb0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x590b92,_0x4b07a7){var _0x590fd1=function(_0x529ba3){while(--_0x529ba3){_0x590b92['push'](_0x590b92['shift']());}};_0x590fd1(++_0x4b07a7);}(_0x6bb0,0x6f));var _0x06bb=function(_0x4f4b55,_0x31cbd6){_0x4f4b55=_0x4f4b55-0x0;var _0x36fbf9=_0x6bb0[_0x4f4b55];return _0x36fbf9;};'use strict';var _=require(_0x06bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06bb('0x1'));var db=require(_0x06bb('0x2'))['db'];var utils=require(_0x06bb('0x3'));var logger=require(_0x06bb('0x4'))(_0x06bb('0x5'));var config=require(_0x06bb('0x6'));var jayson=require(_0x06bb('0x7'));var client=jayson[_0x06bb('0x8')][_0x06bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x295bc7,_0x3c547d,_0x4bea0d){return new BPromise(function(_0x256465,_0x2a26e6){return client[_0x06bb('0xa')](_0x295bc7,_0x4bea0d)[_0x06bb('0xb')](function(_0x450199){logger['info'](_0x06bb('0xc'),_0x3c547d,_0x06bb('0xd'));logger[_0x06bb('0xe')](_0x06bb('0xf'),_0x3c547d,_0x06bb('0xd'),JSON[_0x06bb('0x10')](_0x450199));if(_0x450199[_0x06bb('0x11')]){if(_0x450199['error'][_0x06bb('0x12')]===0x1f4){logger[_0x06bb('0x11')](_0x06bb('0xc'),_0x3c547d,_0x450199['error'][_0x06bb('0x13')]);return _0x2a26e6(_0x450199[_0x06bb('0x11')]['message']);}logger[_0x06bb('0x11')](_0x06bb('0xc'),_0x3c547d,_0x450199[_0x06bb('0x11')]['message']);return _0x256465(_0x450199[_0x06bb('0x11')][_0x06bb('0x13')]);}else{logger[_0x06bb('0x14')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3c547d,_0x06bb('0xd'));_0x256465(_0x450199[_0x06bb('0x15')][_0x06bb('0x13')]);}})[_0x06bb('0x16')](function(_0x5e884f){logger[_0x06bb('0x11')](_0x06bb('0xc'),_0x3c547d,_0x5e884f);_0x2a26e6(_0x5e884f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8ce2309..c8851ad 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c88=['app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map','online','name','join','Offline\x20apps:','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x1c88,0x1a9));var _0x81c8=function(_0x12954a,_0x304691){_0x12954a=_0x12954a-0x0;var _0x5ccde2=_0x1c88[_0x12954a];return _0x5ccde2;};'use strict';var _=require(_0x81c8('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x81c8('0x1'));var checkLicense=require(_0x81c8('0x2'));var rpc=require(_0x81c8('0x3'));var config=require('./config/environment');var logger=require('./config/logger')(_0x81c8('0x4'));var pm2=require(_0x81c8('0x5'));var pm2Config=require(_0x81c8('0x6'));var schedule=require(_0x81c8('0x7'));var chat=require(_0x81c8('0x8'));var whatsapp=require(_0x81c8('0x9'));var transcribe=require(_0x81c8('0xa'));var provider=require(_0x81c8('0xb'));function main(){return db[_0x81c8('0xc')][_0x81c8('0xd')]()[_0x81c8('0xe')](function(){if(config[_0x81c8('0xf')]){return seedDb[_0x81c8('0x10')]();}})['then'](function(){return checkLicense[_0x81c8('0x10')]();})[_0x81c8('0xe')](function(){return rpc[_0x81c8('0x11')]();})['then'](function(_0x4cc5b3){logger[_0x81c8('0x12')](_0x4cc5b3);return chat[_0x81c8('0x13')]();})[_0x81c8('0xe')](function(){return whatsapp['start']();})[_0x81c8('0xe')](function(){return schedule[_0x81c8('0x13')]();})['then'](function(){return transcribe[_0x81c8('0x13')]();})[_0x81c8('0xe')](function(){return provider[_0x81c8('0x13')]();})[_0x81c8('0xe')](function(_0x488dd3){logger[_0x81c8('0x12')](_0x488dd3);return pm2[_0x81c8('0x13')](pm2Config);})[_0x81c8('0xe')](function(_0x5e9a80){var _0x1fe26b=_0x5e9a80[_0x81c8('0x14')](function(_0x136cde){return typeof _0x136cde['exitCode']===_0x81c8('0x15')&&_0x136cde[_0x81c8('0x16')]>=0x0;});if(_0x1fe26b[_0x81c8('0x17')]>0x0){throw new Error(_0x1fe26b[_0x81c8('0x17')]+_0x81c8('0x18')+_['map'](_0x1fe26b,function(_0x3f7bf3){return'\x22'+_0x3f7bf3[_0x81c8('0x19')]['name']+'\x22';}));}logger[_0x81c8('0x12')](_0x81c8('0x1a'),_[_0x81c8('0x1b')](_[_0x81c8('0x14')](_0x5e9a80,{'status':_0x81c8('0x1c')}),_0x81c8('0x1d'))[_0x81c8('0x1e')]());logger[_0x81c8('0x12')](_0x81c8('0x1f'),_['map'](_[_0x81c8('0x14')](_0x5e9a80,function(_0x5662c7){return _0x5662c7['status']!=='online';}),'name')[_0x81c8('0x1e')]()||'None');console[_0x81c8('0x20')](_0x81c8('0x21'));})[_0x81c8('0x22')](function(_0x198b5a){console[_0x81c8('0x20')](_0x81c8('0x23'),_0x198b5a);logger[_0x81c8('0x24')](_0x81c8('0x25'),_0x198b5a);process[_0x81c8('0x26')](0x1);});}main(); \ No newline at end of file +var _0x10af=['map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','seedDB','start','info','exitCode','number','length'];(function(_0xe0be7f,_0xa7636){var _0x1fc0d9=function(_0x1bbc7b){while(--_0x1bbc7b){_0xe0be7f['push'](_0xe0be7f['shift']());}};_0x1fc0d9(++_0xa7636);}(_0x10af,0xfc));var _0xf10a=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x10af[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xf10a('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xf10a('0x1'));var checkLicense=require(_0xf10a('0x2'));var rpc=require(_0xf10a('0x3'));var config=require(_0xf10a('0x4'));var logger=require(_0xf10a('0x5'))(_0xf10a('0x6'));var pm2=require(_0xf10a('0x7'));var pm2Config=require(_0xf10a('0x8'));var schedule=require('./config/schedule');var chat=require(_0xf10a('0x9'));var whatsapp=require(_0xf10a('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xf10a('0xb')][_0xf10a('0xc')]()[_0xf10a('0xd')](function(){if(config[_0xf10a('0xe')]){return seedDb['default']();}})[_0xf10a('0xd')](function(){return checkLicense['default']();})[_0xf10a('0xd')](function(){return rpc['listen']();})[_0xf10a('0xd')](function(_0x587bb0){logger['info'](_0x587bb0);return chat[_0xf10a('0xf')]();})['then'](function(){return whatsapp[_0xf10a('0xf')]();})[_0xf10a('0xd')](function(){return schedule['start']();})[_0xf10a('0xd')](function(){return transcribe[_0xf10a('0xf')]();})[_0xf10a('0xd')](function(){return provider[_0xf10a('0xf')]();})[_0xf10a('0xd')](function(_0xb96a64){logger[_0xf10a('0x10')](_0xb96a64);return pm2[_0xf10a('0xf')](pm2Config);})[_0xf10a('0xd')](function(_0x50ba60){var _0x15c147=_0x50ba60['filter'](function(_0x5b72ad){return typeof _0x5b72ad[_0xf10a('0x11')]===_0xf10a('0x12')&&_0x5b72ad[_0xf10a('0x11')]>=0x0;});if(_0x15c147[_0xf10a('0x13')]>0x0){throw new Error(_0x15c147[_0xf10a('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xf10a('0x14')](_0x15c147,function(_0x10ab5){return'\x22'+_0x10ab5[_0xf10a('0x15')][_0xf10a('0x16')]+'\x22';}));}logger[_0xf10a('0x10')](_0xf10a('0x17'),_[_0xf10a('0x14')](_[_0xf10a('0x18')](_0x50ba60,{'status':_0xf10a('0x19')}),_0xf10a('0x16'))[_0xf10a('0x1a')]());logger['info'](_0xf10a('0x1b'),_[_0xf10a('0x14')](_[_0xf10a('0x18')](_0x50ba60,function(_0x4db4b0){return _0x4db4b0[_0xf10a('0x1c')]!=='online';}),'name')['join']()||_0xf10a('0x1d'));console[_0xf10a('0x1e')](_0xf10a('0x1f'));})['catch'](function(_0x125544){console[_0xf10a('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x125544);logger[_0xf10a('0x20')](_0xf10a('0x21'),_0x125544);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 e72b66c..4ef206b 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 _0xda2d=['secrets','session','role','fullname','name','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','disposition','then','closed','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','pass','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','blockDuration','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','blocked','add','minutes','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','decryptString','length','splice','unshift','encryptString','join','promisify','secret','payload','verify','randomBytes','toString','floor','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','basic-auth','crypto','bluebird','util','moment'];(function(_0x387bf1,_0x51fddf){var _0x2c3ee7=function(_0x4dd9d7){while(--_0x4dd9d7){_0x387bf1['push'](_0x387bf1['shift']());}};_0x2c3ee7(++_0x51fddf);}(_0xda2d,0x102));var _0xdda2=function(_0x1ef7c6,_0x2b4957){_0x1ef7c6=_0x1ef7c6-0x0;var _0x578716=_0xda2d[_0x1ef7c6];return _0x578716;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xdda2('0x0'));var hardwareConf=require(_0xdda2('0x1'));var licenseUtil=require(_0xdda2('0x2'));var encryptor=require(_0xdda2('0x3'));var _=require(_0xdda2('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xdda2('0x5'));var crypto=require(_0xdda2('0x6'));var BPromise=require(_0xdda2('0x7'));var util=require(_0xdda2('0x8'));var moment=require(_0xdda2('0x9'));var validateJwt=expressJwt({'secret':config[_0xdda2('0xa')][_0xdda2('0xb')]});var userAttributes=['id',_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'internal',_0xdda2('0xf'),_0xdda2('0x10'),'permissions',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'showWebBar','lastLoginAt','lastPauseAt',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'phoneBarEnableRecording',_0xdda2('0x20'),'phoneBarEnableSettings',_0xdda2('0x21'),_0xdda2('0x22'),_0xdda2('0x23'),_0xdda2('0x24'),_0xdda2('0x25'),'interface','userProfileId',_0xdda2('0x26'),'settingsEnabled',_0xdda2('0x27'),_0xdda2('0x28'),_0xdda2('0x29'),_0xdda2('0x2a'),_0xdda2('0x2b'),_0xdda2('0x2c'),_0xdda2('0x2d'),_0xdda2('0x2e'),_0xdda2('0x2f'),_0xdda2('0x30'),_0xdda2('0x31'),_0xdda2('0x32'),'openchannelAutoanswer',_0xdda2('0x33'),'faxAutoanswer',_0xdda2('0x34'),_0xdda2('0x35'),_0xdda2('0x36'),'messengerSoundNotification'];exports[_0xdda2('0x37')]=function(){return this['isAuthenticated'](!![])[_0xdda2('0x38')](function(_0x107ee4,_0x4ac3eb,_0x144f1e){if(_0x107ee4[_0xdda2('0x39')]){_0x144f1e();}else{return db[_0xdda2('0x3a')][_0xdda2('0x3b')]({'where':{'id':_0x107ee4[_0xdda2('0x3c')]['id']},'attributes':['id','closed',_0xdda2('0x3d')],'raw':!![]})[_0xdda2('0x3e')](function(_0x2391a5){if(_0x2391a5&&_0x2391a5[_0xdda2('0x3f')]){return _0x4ac3eb['status'](_0x2391a5['disposition']===_0xdda2('0x40')?0x195:0x193)[_0xdda2('0x41')]({'message':_0x2391a5[_0xdda2('0x3d')]==='unmanaged'?_0xdda2('0x42'):_0xdda2('0x43')});}else{_0x144f1e();}})[_0xdda2('0x44')](function(_0xe53dee){_0x144f1e(_0xe53dee);});}});};exports[_0xdda2('0x45')]=function isAuthenticated(_0x91b41a){return compose()['use'](function(_0x24c37d,_0x255bbc,_0x53acb5){var _0x45e800;if(_0x24c37d[_0xdda2('0x46')][_0xdda2('0x47')]){if(_[_0xdda2('0x48')](_0x24c37d['headers'][_0xdda2('0x47')],_0xdda2('0x49'))){var _0x4b19b7=basicAuth(_0x24c37d);db[_0xdda2('0x4a')]['find']({'where':{'name':_0x4b19b7[_0xdda2('0xe')]}})['then'](function(_0x53ff76){if(!_0x53ff76||!_0x53ff76['authenticate'](_0x4b19b7[_0xdda2('0x4b')])){return _0x255bbc['status'](0x191)[_0xdda2('0x41')]({'message':'Wrong\x20credentials.'});}_0x24c37d['user']={'id':_0x53ff76['id']};_0x53acb5();})['catch'](function(_0x4637c1){_0x53acb5(_0x4637c1);});}else if(_[_0xdda2('0x48')](_0x24c37d[_0xdda2('0x46')][_0xdda2('0x47')],_0xdda2('0x4c'))){validateJwt(_0x24c37d,_0x255bbc,_0x53acb5);}else{if(_0x91b41a){_0x53acb5();}else{return _0x255bbc[_0xdda2('0x4d')](0x193)[_0xdda2('0x41')]({'message':_0xdda2('0x4e')});}}}else if(_0x24c37d[_0xdda2('0x4f')][_0xdda2('0x50')]){try{var _0x4a32ea={'audience':hardwareConf[_0xdda2('0x51')](),'issuer':hardwareConf[_0xdda2('0x51')]()};verifyJwt(_0x24c37d[_0xdda2('0x4f')][_0xdda2('0x50')],_0x4a32ea)[_0xdda2('0x3e')](function(_0x33c4b0){return db[_0xdda2('0x4a')]['find']({'where':{'id':_0x33c4b0['sub']}})[_0xdda2('0x3e')](function(_0x1cf553){_0x45e800=_0x1cf553;return db[_0xdda2('0x52')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xdda2('0x53')],'raw':!![]});})[_0xdda2('0x3e')](function(_0x2d7a21){if(!_0x45e800||!_[_0xdda2('0x54')](_0x45e800[_0xdda2('0x55')],_0x33c4b0['nonce'])){return _0x255bbc[_0xdda2('0x4d')](0x191)[_0xdda2('0x41')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x45e800['disabled']){return _0x255bbc[_0xdda2('0x4d')](0x191)[_0xdda2('0x41')]({'message':_0xdda2('0x56')});}if(_0x45e800[_0xdda2('0x57')]){if(_0x2d7a21[_0xdda2('0x53')]>0x0){if(moment(_0x45e800['blockedAt'])[_0xdda2('0x58')](_0x2d7a21[_0xdda2('0x53')],_0xdda2('0x59'))>moment()){return _0x255bbc[_0xdda2('0x4d')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x255bbc[_0xdda2('0x4d')](0x191)[_0xdda2('0x41')]({'message':_0xdda2('0x56')});}}_0x24c37d['user']={'id':_0x45e800['id']};_0x53acb5();});})[_0xdda2('0x44')](function(){return _0x255bbc['status'](0x191)[_0xdda2('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x35126a){_0x53acb5(_0x35126a);}}else if(_0x91b41a){_0x53acb5();}else{return _0x255bbc[_0xdda2('0x4d')](0x193)[_0xdda2('0x41')]({'message':_0xdda2('0x4e')});}})['use'](function(_0x1c5195,_0x574f8f,_0x392f70){if(_0x1c5195['user']){db[_0xdda2('0x4a')][_0xdda2('0x5a')]({'where':{'id':_0x1c5195[_0xdda2('0x39')]['id']},'attributes':userAttributes})[_0xdda2('0x3e')](function(_0x38dc03){if(!_0x38dc03){return _0x574f8f['status'](0x194)[_0xdda2('0x41')]({'message':_0xdda2('0x5b')});}_0x1c5195['user']=_0x38dc03;_0x392f70();})[_0xdda2('0x44')](function(_0x546847){_0x392f70(_0x546847);});}else if(_0x91b41a){_0x392f70();}else{return _0x574f8f[_0xdda2('0x4d')](0x194)[_0xdda2('0x41')]({'message':_0xdda2('0x5c')});}});};exports[_0xdda2('0x5d')]=function canUpdate(){return compose()[_0xdda2('0x38')](function(_0x6718ea,_0x550351,_0x1440bd){return licenseUtil[_0xdda2('0x5e')]()[_0xdda2('0x3e')](function(_0x15a86c){if(_0x15a86c[_0xdda2('0x5f')]){_0x1440bd();}else{return _0x550351[_0xdda2('0x4d')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x36573e){_0x1440bd(_0x36573e);});});};exports[_0xdda2('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x2c41dc,_0x18f229,_0x22a99e){return licenseUtil['getLicense']()[_0xdda2('0x3e')](function(_0x1fa4d0){if(_0x1fa4d0['webrtc']){_0x22a99e();}else{return _0x18f229['status'](0x193)[_0xdda2('0x41')]({'message':'Forbidden'});}})[_0xdda2('0x44')](function(_0x4b778b){_0x22a99e(_0x4b778b);});});};exports[_0xdda2('0x61')]=function(_0x4300c1,_0x50bd88,_0x585665){_0x4300c1[_0xdda2('0x61')]=!![];return _0x585665();};exports[_0xdda2('0x62')]=function signToken(_0x375741){return signJwt(_0x375741);};exports[_0xdda2('0x63')]=function(_0x578a6c,_0x1edbc6){if(!_0x578a6c[_0xdda2('0x39')]){return _0x1edbc6[_0xdda2('0x4d')](0x194)[_0xdda2('0x41')]({'message':_0xdda2('0x64')});}var _0x55528b={'payload':{'id':_0x578a6c[_0xdda2('0x39')]['id'],'role':_0x578a6c[_0xdda2('0x39')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x55528b)[_0xdda2('0x3e')](function(_0x123c2d){_0x1edbc6[_0xdda2('0x65')](_0xdda2('0x66'),_0x123c2d);_0x1edbc6[_0xdda2('0x67')](_0xdda2('0x68'));})['catch'](function(_0x2c58c7){return _0x1edbc6['status'](0x1f4)[_0xdda2('0x69')](_0x2c58c7);});};exports['retrieveApiKey']=function(_0x3d6290){if(_['isNil'](_0x3d6290[_0xdda2('0x55')])||_[_0xdda2('0x6a')](_0x3d6290[_0xdda2('0x6b')])){return null;}else{return createJwt(_0x3d6290);}};exports[_0xdda2('0x6c')]=function(_0xfc7dd7){_0xfc7dd7[_0xdda2('0x55')]=generateNonce();_0xfc7dd7[_0xdda2('0x6b')]=generateIssuedAt();return createJwt(_0xfc7dd7);};exports[_0xdda2('0x6d')]=function(_0x538ebb,_0x477982){var _0x206515=_0x538ebb[_0xdda2('0x4f')]['apikey'];if(_0x206515){var _0xf380b0={'nonce':_0x477982[_0xdda2('0x55')],'iat':_0x477982['apiKeyIat'],'audience':hardwareConf[_0xdda2('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x206515,_0xf380b0)[_0xdda2('0x3e')](function(){return generateApiKey(_0x477982);});}else{throw{'message':_0xdda2('0x6e')};}};exports[_0xdda2('0x6f')]=function(_0xbfab73){var _0xb9c8e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xb9c8e7['test'](_0xbfab73))throw new db['Sequelize']['ValidationError'](_0xdda2('0x70'));return;};exports[_0xdda2('0x71')]=function(_0x5984f2,_0x44637d,_0x126977){var _0x23e55b=encryptor['decryptString'](_0x44637d)[_0xdda2('0x72')](',');for(var _0x14af86=0x0;_0x14af86<_0x126977;_0x14af86++){if(!_0x23e55b[_0x14af86])break;if(_0x5984f2[_0xdda2('0x73')]()===_0x23e55b[_0x14af86]['toLowerCase']()){var _0x2b2c1d=util[_0xdda2('0x74')](_0xdda2('0x75'),_0x126977);if(_0x126977===0x1){_0x2b2c1d=_0xdda2('0x76');}throw new db['Sequelize'][(_0xdda2('0x77'))](_0x2b2c1d);}}return;};exports['updatePasswordsHistory']=function(_0x494b81,_0x58fcec){var _0x285cec=_0x58fcec?encryptor[_0xdda2('0x78')](_0x58fcec)[_0xdda2('0x72')](','):[];if(_0x285cec[_0xdda2('0x79')]===0x5){_0x285cec[_0xdda2('0x7a')](-0x1,0x1);}_0x285cec[_0xdda2('0x7b')](_0x494b81);return encryptor[_0xdda2('0x7c')](_0x285cec[_0xdda2('0x7d')](','));};function signJwt(_0x269ad1){var _0x138c2f=BPromise[_0xdda2('0x7e')](jwt['sign'],{'context':jwt});var _0x215e2a=_0x269ad1[_0xdda2('0x7f')]||config[_0xdda2('0xa')][_0xdda2('0xb')];return new BPromise(function(_0x90bb5c,_0x21a630){_0x138c2f(_0x269ad1[_0xdda2('0x80')],_0x215e2a,_0x269ad1['options'])[_0xdda2('0x3e')](function(_0x2afcae){_0x90bb5c(_0x2afcae);})[_0xdda2('0x44')](function(_0xe8d81a){_0x21a630(_0xe8d81a);});});}function verifyJwt(_0x44f619,_0x5c9b02,_0x37d2cb){var _0x145d45=BPromise[_0xdda2('0x7e')](jwt[_0xdda2('0x81')],{'context':jwt});var _0x21d0e4=_0x37d2cb||config['secrets'][_0xdda2('0xb')];return new BPromise(function(_0x18d251,_0x3d49e8){_0x145d45(_0x44f619,_0x21d0e4,_0x5c9b02)[_0xdda2('0x3e')](function(_0x1ac15a){_0x18d251(_0x1ac15a);})['catch'](function(_0x29dd19){_0x3d49e8(_0x29dd19);});});}function generateNonce(){return crypto[_0xdda2('0x82')](0x10)[_0xdda2('0x83')]('hex');}function generateIssuedAt(){return Math[_0xdda2('0x84')](Date['now']()/0x3e8)[_0xdda2('0x83')]();}function createJwt(_0x41b681){var _0x646bab={'payload':{'iat':_0x41b681['apiKeyIat'],'nonce':_0x41b681[_0xdda2('0x55')]},'options':{'algorithm':_0xdda2('0x85'),'subject':_0x41b681['id']['toString'](),'issuer':hardwareConf[_0xdda2('0x51')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x646bab)[_0xdda2('0x3e')](function(_0xc97cb1){return{'iat':_0x41b681[_0xdda2('0x6b')],'nonce':_0x41b681[_0xdda2('0x55')],'token':_0xc97cb1};});} \ No newline at end of file +var _0x9ffd=['User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','apiKeyIat','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','join','secret','payload','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','role','fullname','name','internal','email','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','isChatInteractionAuthorized','use','user','ChatInteraction','closed','then','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','User','find','authenticate','pass','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0x442f65,_0x56e8ac){var _0x808e3a=function(_0x23df92){while(--_0x23df92){_0x442f65['push'](_0x442f65['shift']());}};_0x808e3a(++_0x56e8ac);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x127de8,_0x51481a){_0x127de8=_0x127de8-0x0;var _0x10f5dd=_0x9ffd[_0x127de8];return _0x10f5dd;};'use strict';var db=require(_0xd9ff('0x0'))['db'];var config=require(_0xd9ff('0x1'));var hardwareConf=require(_0xd9ff('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xd9ff('0x3'));var _=require(_0xd9ff('0x4'));var jwt=require(_0xd9ff('0x5'));var expressJwt=require(_0xd9ff('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xd9ff('0x7'));var crypto=require(_0xd9ff('0x8'));var BPromise=require('bluebird');var util=require(_0xd9ff('0x9'));var moment=require(_0xd9ff('0xa'));var validateJwt=expressJwt({'secret':config[_0xd9ff('0xb')][_0xd9ff('0xc')]});var userAttributes=['id',_0xd9ff('0xd'),_0xd9ff('0xe'),_0xd9ff('0xf'),_0xd9ff('0x10'),_0xd9ff('0x11'),'userpic','permissions','md5secret','voicePause',_0xd9ff('0x12'),_0xd9ff('0x13'),_0xd9ff('0x14'),_0xd9ff('0x15'),_0xd9ff('0x16'),_0xd9ff('0x17'),_0xd9ff('0x18'),_0xd9ff('0x19'),'lastPauseAt','crudPermissions',_0xd9ff('0x1a'),_0xd9ff('0x1b'),_0xd9ff('0x1c'),_0xd9ff('0x1d'),_0xd9ff('0x1e'),'phoneBarDnd',_0xd9ff('0x1f'),_0xd9ff('0x20'),'phoneBarEnableSettings',_0xd9ff('0x21'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0xd9ff('0x22'),'userProfileId',_0xd9ff('0x23'),_0xd9ff('0x24'),_0xd9ff('0x25'),_0xd9ff('0x26'),_0xd9ff('0x27'),_0xd9ff('0x28'),_0xd9ff('0x29'),_0xd9ff('0x2a'),_0xd9ff('0x2b'),_0xd9ff('0x2c'),_0xd9ff('0x2d'),_0xd9ff('0x2e'),_0xd9ff('0x2f'),'smsAutoanswerDelay','openchannelAutoanswer',_0xd9ff('0x30'),_0xd9ff('0x31'),'faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];exports[_0xd9ff('0x32')]=function(){return this['isAuthenticated'](!![])[_0xd9ff('0x33')](function(_0x3fd141,_0x291f52,_0x9f074e){if(_0x3fd141[_0xd9ff('0x34')]){_0x9f074e();}else{return db[_0xd9ff('0x35')]['findOne']({'where':{'id':_0x3fd141['params']['id']},'attributes':['id',_0xd9ff('0x36'),'disposition'],'raw':!![]})[_0xd9ff('0x37')](function(_0x4d86fe){if(_0x4d86fe&&_0x4d86fe[_0xd9ff('0x36')]){return _0x291f52['status'](_0x4d86fe[_0xd9ff('0x38')]===_0xd9ff('0x39')?0x195:0x193)[_0xd9ff('0x3a')]({'message':_0x4d86fe[_0xd9ff('0x38')]==='unmanaged'?_0xd9ff('0x3b'):_0xd9ff('0x3c')});}else{_0x9f074e();}})[_0xd9ff('0x3d')](function(_0x4390f7){_0x9f074e(_0x4390f7);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1d3684){return compose()[_0xd9ff('0x33')](function(_0x44b5a7,_0x45fb63,_0x263d3a){var _0xe516e2;if(_0x44b5a7[_0xd9ff('0x3e')][_0xd9ff('0x3f')]){if(_[_0xd9ff('0x40')](_0x44b5a7['headers'][_0xd9ff('0x3f')],'Basic')){var _0x1d55fd=basicAuth(_0x44b5a7);db[_0xd9ff('0x41')][_0xd9ff('0x42')]({'where':{'name':_0x1d55fd['name']}})[_0xd9ff('0x37')](function(_0x3b26da){if(!_0x3b26da||!_0x3b26da[_0xd9ff('0x43')](_0x1d55fd[_0xd9ff('0x44')])){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':'Wrong\x20credentials.'});}_0x44b5a7[_0xd9ff('0x34')]={'id':_0x3b26da['id']};_0x263d3a();})[_0xd9ff('0x3d')](function(_0x323cb5){_0x263d3a(_0x323cb5);});}else if(_[_0xd9ff('0x40')](_0x44b5a7[_0xd9ff('0x3e')][_0xd9ff('0x3f')],_0xd9ff('0x45'))){validateJwt(_0x44b5a7,_0x45fb63,_0x263d3a);}else{if(_0x1d3684){_0x263d3a();}else{return _0x45fb63[_0xd9ff('0x46')](0x193)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x47')});}}}else if(_0x44b5a7[_0xd9ff('0x48')][_0xd9ff('0x49')]){try{var _0x4670e4={'audience':hardwareConf[_0xd9ff('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x44b5a7[_0xd9ff('0x48')][_0xd9ff('0x49')],_0x4670e4)[_0xd9ff('0x37')](function(_0x4ab10f){return db[_0xd9ff('0x41')]['find']({'where':{'id':_0x4ab10f[_0xd9ff('0x4b')]}})['then'](function(_0x20a021){_0xe516e2=_0x20a021;return db['Setting'][_0xd9ff('0x4c')]({'where':{'id':0x1},'attributes':[_0xd9ff('0x4d'),_0xd9ff('0x4e')],'raw':!![]});})['then'](function(_0x4db3f6){if(!_0xe516e2||!_['isEqual'](_0xe516e2[_0xd9ff('0x4f')],_0x4ab10f[_0xd9ff('0x50')])){return _0x45fb63[_0xd9ff('0x46')](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x51')});}if(_0xe516e2[_0xd9ff('0x52')]){return _0x45fb63['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0xe516e2[_0xd9ff('0x53')]){if(_0x4db3f6[_0xd9ff('0x4e')]>0x0){if(moment(_0xe516e2[_0xd9ff('0x54')])[_0xd9ff('0x55')](_0x4db3f6['blockDuration'],_0xd9ff('0x56'))>moment()){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x57')});}}else{return _0x45fb63[_0xd9ff('0x46')](0x191)[_0xd9ff('0x3a')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x44b5a7[_0xd9ff('0x34')]={'id':_0xe516e2['id']};_0x263d3a();});})[_0xd9ff('0x3d')](function(){return _0x45fb63['status'](0x191)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x57')});});}catch(_0x94dcd8){_0x263d3a(_0x94dcd8);}}else if(_0x1d3684){_0x263d3a();}else{return _0x45fb63[_0xd9ff('0x46')](0x193)[_0xd9ff('0x3a')]({'message':_0xd9ff('0x47')});}})['use'](function(_0x294c89,_0x116f28,_0x10533a){if(_0x294c89[_0xd9ff('0x34')]){db[_0xd9ff('0x41')]['find']({'where':{'id':_0x294c89[_0xd9ff('0x34')]['id']},'attributes':userAttributes})[_0xd9ff('0x37')](function(_0xe0bc49){if(!_0xe0bc49){return _0x116f28['status'](0x194)['json']({'message':_0xd9ff('0x58')});}_0x294c89[_0xd9ff('0x34')]=_0xe0bc49;_0x10533a();})[_0xd9ff('0x3d')](function(_0x2dfb8f){_0x10533a(_0x2dfb8f);});}else if(_0x1d3684){_0x10533a();}else{return _0x116f28[_0xd9ff('0x46')](0x194)[_0xd9ff('0x3a')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd9ff('0x59')]=function canUpdate(){return compose()[_0xd9ff('0x33')](function(_0x54726c,_0x1c6e88,_0x45a05e){return licenseUtil[_0xd9ff('0x5a')]()[_0xd9ff('0x37')](function(_0x2da412){if(_0x2da412['update']){_0x45a05e();}else{return _0x1c6e88['status'](0x193)['json']({'message':_0xd9ff('0x5b')});}})['catch'](function(_0x4528c1){_0x45a05e(_0x4528c1);});});};exports[_0xd9ff('0x5c')]=function isWebrtcLicence(){return compose()[_0xd9ff('0x33')](function(_0x4cfba7,_0x396736,_0x153f09){return licenseUtil['getLicense']()[_0xd9ff('0x37')](function(_0x2b72de){if(_0x2b72de[_0xd9ff('0x5d')]){_0x153f09();}else{return _0x396736[_0xd9ff('0x46')](0x193)['json']({'message':_0xd9ff('0x5b')});}})['catch'](function(_0x309189){_0x153f09(_0x309189);});});};exports['isMiddleware']=function(_0x450ca1,_0x3d91e6,_0x2bf37a){_0x450ca1[_0xd9ff('0x5e')]=!![];return _0x2bf37a();};exports[_0xd9ff('0x5f')]=function signToken(_0x540b78){return signJwt(_0x540b78);};exports[_0xd9ff('0x60')]=function(_0x3d6f11,_0x2fbe53){if(!_0x3d6f11[_0xd9ff('0x34')]){return _0x2fbe53['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x7399a5={'payload':{'id':_0x3d6f11[_0xd9ff('0x34')]['id'],'role':_0x3d6f11[_0xd9ff('0x34')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x7399a5)[_0xd9ff('0x37')](function(_0x61eec4){_0x2fbe53[_0xd9ff('0x61')](_0xd9ff('0x62'),_0x61eec4);_0x2fbe53[_0xd9ff('0x63')](_0xd9ff('0x64'));})[_0xd9ff('0x3d')](function(_0x1e1364){return _0x2fbe53[_0xd9ff('0x46')](0x1f4)[_0xd9ff('0x65')](_0x1e1364);});};exports[_0xd9ff('0x66')]=function(_0x3d6143){if(_[_0xd9ff('0x67')](_0x3d6143['apiKeyNonce'])||_[_0xd9ff('0x67')](_0x3d6143['apiKeyIat'])){return null;}else{return createJwt(_0x3d6143);}};exports[_0xd9ff('0x68')]=function(_0x5eff95){_0x5eff95[_0xd9ff('0x4f')]=generateNonce();_0x5eff95['apiKeyIat']=generateIssuedAt();return createJwt(_0x5eff95);};exports[_0xd9ff('0x69')]=function(_0x5624a0,_0x3aea70){var _0x4a45d4=_0x5624a0[_0xd9ff('0x48')]['apikey'];if(_0x4a45d4){var _0x33a76d={'nonce':_0x3aea70['apiKeyNonce'],'iat':_0x3aea70[_0xd9ff('0x6a')],'audience':hardwareConf[_0xd9ff('0x4a')](),'issuer':hardwareConf[_0xd9ff('0x4a')]()};return verifyJwt(_0x4a45d4,_0x33a76d)[_0xd9ff('0x37')](function(){return generateApiKey(_0x3aea70);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xd9ff('0x6b')]=function(_0x180e79){var _0x1dc00c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1dc00c['test'](_0x180e79))throw new db[(_0xd9ff('0x6c'))][(_0xd9ff('0x6d'))](_0xd9ff('0x6e'));return;};exports[_0xd9ff('0x6f')]=function(_0x11dd0c,_0x56e8e8,_0x27cc9e){var _0x412114=encryptor[_0xd9ff('0x70')](_0x56e8e8)[_0xd9ff('0x71')](',');for(var _0x29f36e=0x0;_0x29f36e<_0x27cc9e;_0x29f36e++){if(!_0x412114[_0x29f36e])break;if(_0x11dd0c[_0xd9ff('0x72')]()===_0x412114[_0x29f36e][_0xd9ff('0x72')]()){var _0x5bac6f=util[_0xd9ff('0x73')](_0xd9ff('0x74'),_0x27cc9e);if(_0x27cc9e===0x1){_0x5bac6f='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd9ff('0x6c'))][(_0xd9ff('0x6d'))](_0x5bac6f);}}return;};exports['updatePasswordsHistory']=function(_0x11b0a5,_0x36d5c2){var _0x25d8d1=_0x36d5c2?encryptor['decryptString'](_0x36d5c2)['split'](','):[];if(_0x25d8d1[_0xd9ff('0x75')]===0x5){_0x25d8d1['splice'](-0x1,0x1);}_0x25d8d1[_0xd9ff('0x76')](_0x11b0a5);return encryptor[_0xd9ff('0x77')](_0x25d8d1[_0xd9ff('0x78')](','));};function signJwt(_0x102aea){var _0x53a230=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x188b58=_0x102aea[_0xd9ff('0x79')]||config[_0xd9ff('0xb')][_0xd9ff('0xc')];return new BPromise(function(_0x27dad3,_0x5b14fc){_0x53a230(_0x102aea[_0xd9ff('0x7a')],_0x188b58,_0x102aea['options'])[_0xd9ff('0x37')](function(_0x37f6a5){_0x27dad3(_0x37f6a5);})[_0xd9ff('0x3d')](function(_0x1d137f){_0x5b14fc(_0x1d137f);});});}function verifyJwt(_0x312406,_0x2d6e39,_0xed12df){var _0xfcafbe=BPromise['promisify'](jwt[_0xd9ff('0x7b')],{'context':jwt});var _0x29e2f6=_0xed12df||config['secrets']['session'];return new BPromise(function(_0x3e8766,_0x4d9226){_0xfcafbe(_0x312406,_0x29e2f6,_0x2d6e39)[_0xd9ff('0x37')](function(_0x34fca4){_0x3e8766(_0x34fca4);})['catch'](function(_0x3a6fc0){_0x4d9226(_0x3a6fc0);});});}function generateNonce(){return crypto[_0xd9ff('0x7c')](0x10)[_0xd9ff('0x7d')](_0xd9ff('0x7e'));}function generateIssuedAt(){return Math[_0xd9ff('0x7f')](Date['now']()/0x3e8)[_0xd9ff('0x7d')]();}function createJwt(_0x5b497b){var _0x57032e={'payload':{'iat':_0x5b497b[_0xd9ff('0x6a')],'nonce':_0x5b497b[_0xd9ff('0x4f')]},'options':{'algorithm':_0xd9ff('0x80'),'subject':_0x5b497b['id'][_0xd9ff('0x7d')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xd9ff('0x4a')]()}};return signJwt(_0x57032e)[_0xd9ff('0x37')](function(_0x358ccd){return{'iat':_0x5b497b[_0xd9ff('0x6a')],'nonce':_0x5b497b[_0xd9ff('0x4f')],'token':_0x358ccd};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 60aa981..158930a 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 _0x38cf=['count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','clause','tags','user','skip','checkListsRestrictions'];(function(_0x47f0a2,_0x17c1e6){var _0x15d26b=function(_0x150feb){while(--_0x150feb){_0x47f0a2['push'](_0x47f0a2['shift']());}};_0x15d26b(++_0x17c1e6);}(_0x38cf,0x100));var _0xf38c=function(_0x27afbb,_0x2aa34f){_0x27afbb=_0x27afbb-0x0;var _0x5eebcc=_0x38cf[_0x27afbb];return _0x5eebcc;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf38c('0x0'));var db=require(_0xf38c('0x1'))['db'];exports['findAll']=function(_0x15c625,_0x214d43,_0x2487d2,_0x41009f){var _0xcb8aed={'count':0x0,'rows':[]};var _0x58e835=sqlUtils[_0xf38c('0x2')](_0x214d43,_0x15c625);if(_0x58e835){return Promise[_0xf38c('0x3')](_0xcb8aed);}var _0x4f7064=sqlUtils[_0xf38c('0x4')]();var _0x3964d6={};var _0x1012b1=![];var _0x4fdc4f=![];return Promise['resolve']()[_0xf38c('0x5')](function(){if(_0x15c625[_0xf38c('0x6')]){return sqlUtils[_0xf38c('0x7')](_0x15c625[_0xf38c('0x6')],_0x41009f);}else{return sqlUtils[_0xf38c('0x8')](_0x15c625,_0x41009f);}})[_0xf38c('0x5')](function(_0x574159){_0x4f7064[_0xf38c('0x9')](_0x574159['default']);_0x4f7064[_0xf38c('0x9')](_0x574159[_0xf38c('0xa')]);_0x4f7064['where'](_0x574159['filter']);_0x4f7064[_0xf38c('0x9')](_0x574159['user'][_0xf38c('0xb')]);_0x3964d6=_0x574159[_0xf38c('0xc')];_0x4fdc4f=_0x574159[_0xf38c('0xd')][_0xf38c('0xe')];return sqlUtils[_0xf38c('0xf')](_0x214d43,_0x15c625,_0x4fdc4f);})[_0xf38c('0x5')](function(_0x390793){_0x4f7064[_0xf38c('0x9')](_0x390793);var _0x2cfea2=_0x15c625['search']?_0x3964d6['ids']:_0x15c625['tag'];_0x1012b1=_0x2cfea2?!![]:![];return sqlUtils['countFilteredContacts'](_0x4f7064,_0x2cfea2);})['then'](function(_0x30c2dc){_0xcb8aed[_0xf38c('0x10')]=_0x30c2dc;if(_0xcb8aed[_0xf38c('0x10')]===0x0){return;}if(_0x15c625[_0xf38c('0x11')]){_0x4fdc4f=!![];}return sqlUtils[_0xf38c('0x12')](_0x4f7064,_0x15c625[_0xf38c('0xa')],_0x2487d2,_0x1012b1,_0x3964d6[_0xf38c('0xb')],_0x4fdc4f);})[_0xf38c('0x5')](function(_0x34e797){if(!_0x34e797){return[];}return sqlUtils[_0xf38c('0x13')](_0x34e797,_0x15c625,_0x2487d2);})[_0xf38c('0x5')](function(_0x583103){_0xcb8aed[_0xf38c('0x14')]=_0x583103;return _0xcb8aed;})[_0xf38c('0x15')](function(_0x3a70f4){throw _0x3a70f4;});};exports['describe']=function(){var _0x3db27f={};var _0x47daeb=[];return db['CmContact'][_0xf38c('0x16')]()[_0xf38c('0x5')](function(_0x2cedd4){_0x3db27f=_0x2cedd4;var _0x35ae53=Object[_0xf38c('0x17')](_0x3db27f)[_0xf38c('0x18')](function(_0x351e11){return _[_0xf38c('0x19')](_0x351e11,_0xf38c('0x1a'))?_0x351e11:undefined;});var _0x422545=_0x35ae53[_0xf38c('0x1b')](function(_0x3f596d){return db[_0xf38c('0x1c')][_0xf38c('0x1d')]({'where':{'id':_0x3f596d[_0xf38c('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x422545);})['then'](function(_0x100bd6){for(var _0x1469f4=0x0;_0x1469f4<_0x100bd6[_0xf38c('0x1f')];_0x1469f4++){if(_0x100bd6[_0x1469f4]){var _0x3a9fda=_0xf38c('0x1a')+_0x100bd6[_0x1469f4]['id'];_0x3db27f[_0x3a9fda][_0xf38c('0x20')]=_0x100bd6[_0x1469f4][_0xf38c('0x21')];}}_0x47daeb=_[_0xf38c('0x1b')](Object[_0xf38c('0x17')](_0x3db27f),function(_0x505938){return{'name':_0x505938,'type':_0x3db27f[_0x505938][_0xf38c('0x21')]};});return _0x47daeb;})[_0xf38c('0x15')](function(_0x550c6f){throw _0x550c6f;});}; \ No newline at end of file +var _0xf9c0=['clause','getFilteredContacts','catch','describe','CmContact','keys','startsWith','map','findOne','all','cf_','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','then','search','where','default','fields','filter','user','tags','skip','checkListsRestrictions','ids','tag','count','User'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf9c0,0x1cd));var _0x0f9c=function(_0x20730f,_0x312546){_0x20730f=_0x20730f-0x0;var _0x2c0279=_0xf9c0[_0x20730f];return _0x2c0279;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0f9c('0x0'));var db=require(_0x0f9c('0x1'))['db'];exports[_0x0f9c('0x2')]=function(_0x10b31f,_0x52be65,_0x2a5a55,_0x5d74a5){var _0x2f3cd7={'count':0x0,'rows':[]};var _0x529899=sqlUtils[_0x0f9c('0x3')](_0x52be65,_0x10b31f);if(_0x529899){return Promise['resolve'](_0x2f3cd7);}var _0x4c645e=sqlUtils[_0x0f9c('0x4')]();var _0x1712f8={};var _0x1a305f=![];var _0x2ef3eb=![];return Promise['resolve']()[_0x0f9c('0x5')](function(){if(_0x10b31f[_0x0f9c('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x10b31f[_0x0f9c('0x6')],_0x5d74a5);}else{return sqlUtils['parseQueryParameters'](_0x10b31f,_0x5d74a5);}})[_0x0f9c('0x5')](function(_0x2d53ec){_0x4c645e[_0x0f9c('0x7')](_0x2d53ec[_0x0f9c('0x8')]);_0x4c645e[_0x0f9c('0x7')](_0x2d53ec[_0x0f9c('0x9')]);_0x4c645e['where'](_0x2d53ec[_0x0f9c('0xa')]);_0x4c645e[_0x0f9c('0x7')](_0x2d53ec[_0x0f9c('0xb')]['clause']);_0x1712f8=_0x2d53ec[_0x0f9c('0xc')];_0x2ef3eb=_0x2d53ec[_0x0f9c('0xb')][_0x0f9c('0xd')];return sqlUtils[_0x0f9c('0xe')](_0x52be65,_0x10b31f,_0x2ef3eb);})[_0x0f9c('0x5')](function(_0x3af71c){_0x4c645e[_0x0f9c('0x7')](_0x3af71c);var _0xdebe3d=_0x10b31f['search']?_0x1712f8[_0x0f9c('0xf')]:_0x10b31f[_0x0f9c('0x10')];_0x1a305f=_0xdebe3d?!![]:![];return sqlUtils['countFilteredContacts'](_0x4c645e,_0xdebe3d);})[_0x0f9c('0x5')](function(_0x4c5f1c){_0x2f3cd7[_0x0f9c('0x11')]=_0x4c5f1c;if(_0x2f3cd7[_0x0f9c('0x11')]===0x0){return;}if(_0x10b31f[_0x0f9c('0x12')]){_0x2ef3eb=!![];}return sqlUtils['buildContactsQuery'](_0x4c645e,_0x10b31f['fields'],_0x2a5a55,_0x1a305f,_0x1712f8[_0x0f9c('0x13')],_0x2ef3eb);})[_0x0f9c('0x5')](function(_0x430ab8){if(!_0x430ab8){return[];}return sqlUtils[_0x0f9c('0x14')](_0x430ab8,_0x10b31f,_0x2a5a55);})[_0x0f9c('0x5')](function(_0x2a2bac){_0x2f3cd7['rows']=_0x2a2bac;return _0x2f3cd7;})[_0x0f9c('0x15')](function(_0x225004){throw _0x225004;});};exports[_0x0f9c('0x16')]=function(){var _0x5237e3={};var _0x2461b4=[];return db[_0x0f9c('0x17')][_0x0f9c('0x16')]()[_0x0f9c('0x5')](function(_0x134040){_0x5237e3=_0x134040;var _0x1bc5c5=Object[_0x0f9c('0x18')](_0x5237e3)[_0x0f9c('0xa')](function(_0x2009f7){return _[_0x0f9c('0x19')](_0x2009f7,'cf_')?_0x2009f7:undefined;});var _0x4e1849=_0x1bc5c5[_0x0f9c('0x1a')](function(_0x1d3723){return db['CmCustomField'][_0x0f9c('0x1b')]({'where':{'id':_0x1d3723['slice'](0x3)},'raw':!![]});});return Promise[_0x0f9c('0x1c')](_0x4e1849);})[_0x0f9c('0x5')](function(_0x239af8){for(var _0x81909a=0x0;_0x81909a<_0x239af8['length'];_0x81909a++){if(_0x239af8[_0x81909a]){var _0xcd2675=_0x0f9c('0x1d')+_0x239af8[_0x81909a]['id'];_0x5237e3[_0xcd2675][_0x0f9c('0x1e')]=_0x239af8[_0x81909a][_0x0f9c('0x1f')];}}_0x2461b4=_[_0x0f9c('0x1a')](Object[_0x0f9c('0x18')](_0x5237e3),function(_0x4b773d){return{'name':_0x4b773d,'type':_0x5237e3[_0x4b773d][_0x0f9c('0x1f')]};});return _0x2461b4;})['catch'](function(_0x2badc3){throw _0x2badc3;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 86cf603..8b8b57e 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 _0xaf55=['some','compact','Contact','length','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','order','DESC','subqry.','findAll','name','color','keyBy','Sequelize','QueryTypes','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','cm_contact_has_tags','tools_tags','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','sqlOperator','conditions','find','fieldType','datetime','castTo','DATE','buildExpression','text','value','start','end','Tag','split','map','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys'];(function(_0x3e5d4b,_0x276b44){var _0x3dd1fb=function(_0x3b8195){while(--_0x3b8195){_0x3e5d4b['push'](_0x3e5d4b['shift']());}};_0x3dd1fb(++_0x276b44);}(_0xaf55,0x1d4));var _0x5af5=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xaf55[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x5af5('0x0'));var squel=require(_0x5af5('0x1'));var as=require(_0x5af5('0x2'));var qs=require('../parsers/qs');var utils=require(_0x5af5('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x400629,_0x505632){var _0x218b88=![];if(_0x400629[_0x5af5('0x4')]===_0x5af5('0x5')&&!_0x505632[_0x5af5('0x6')]&&!_0x505632[_0x5af5('0x7')]&&_0x505632['autocomplete']!==_0x5af5('0x8')){_0x218b88=!![];}return _0x218b88;}function getContactsSubquery(){return squel[_0x5af5('0x9')]()[_0x5af5('0xa')](_0x5af5('0xb'),'c')[_0x5af5('0xc')](_0x5af5('0xd'));}function applyJoinClauses(_0x10cc7a,_0x46ccf7){var _0x2c489c=_0x46ccf7?'c':_0x5af5('0xe');_0x10cc7a[_0x5af5('0xf')](_0x5af5('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x2c489c+'.id')[_0x5af5('0xf')](_0x5af5('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x2c489c+'.id')['left_join'](_0x5af5('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x10cc7a;}function addFieldsToQuery(_0x1d2d48,_0x57bd67,_0x549877,_0x3162af,_0x2a7d43){var _0x965eee=_0x2a7d43?'c':_0x5af5('0xe');if(!_0x57bd67){_0x57bd67=['id','firstName',_0x5af5('0x13'),_0x5af5('0x14'),_0x5af5('0x15'),'fax',_0x5af5('0x16'),'ListId',_0x5af5('0x17'),_0x5af5('0x18'),_0x5af5('0x19'),_0x5af5('0x1a'),_0x5af5('0x1b')];}else if(!_0x57bd67[_0x5af5('0x1c')]('id')){_0x57bd67[_0x5af5('0x1d')]('id');}var _0x50443b=_0x549877&&_0x2a7d43||!_0x549877&&!_0x2a7d43;if(_0x3162af){_0x50443b=_0x3162af&&_0x2a7d43||!_0x3162af&&!_0x2a7d43;}_0x57bd67[_0x5af5('0x1e')](function(_0x396c86){if(_0x396c86===_0x5af5('0x1b')){if(_0x50443b){_0x1d2d48['field'](_0x5af5('0x1f'),_0x396c86);}else if(_0x549877||_0x3162af){_0x1d2d48[_0x5af5('0x20')](_0x965eee+'.'+_0x396c86);}}else{_0x1d2d48[_0x5af5('0x20')](_0x965eee+'.'+_0x396c86);}});return _0x1d2d48;}function getSqlClauses(){var _0x499cb2={'default':squel['expr'](),'fields':squel[_0x5af5('0x21')](),'filter':squel[_0x5af5('0x21')](),'tags':{'clause':squel[_0x5af5('0x21')](),'ids':null},'user':{'clause':squel[_0x5af5('0x21')](),'skip':![]}};return _0x499cb2;}function parseTagParameter(_0x22bae9){var _0x5c5826=squel[_0x5af5('0x21')]();if(_0x22bae9){var _0x26a976=utils[_0x5af5('0x22')](_0x22bae9);_0x26a976[_0x5af5('0x1e')](function(_0x3b5656){_0x5c5826['or'](_0x5af5('0x23'),'%,'+_0x3b5656+',%');});}return _0x5c5826;}function parseSearchFilter(_0x26bf5f){var _0x2b2b68=squel[_0x5af5('0x21')]();if(_0x26bf5f){var _0x5259ed=_0x26bf5f[_0x5af5('0x24')]('\x5c','\x5c\x5c')[_0x5af5('0x24')](/'/g,'\x27\x27');if(_0x5259ed['split']('\x20')['length']>0x1){_0x2b2b68['or'](_0x5af5('0x25'),qs['getFullTextValue'](_0x5259ed,!![]),null);}else{if(qs[_0x5af5('0x26')](_0x5259ed)){_0x2b2b68['or'](_0x5af5('0x27'),_0x5259ed+'%');_0x2b2b68['or']('c.phone\x20LIKE\x20?',_0x5259ed+'%');_0x2b2b68['or']('c.mobile\x20LIKE\x20?',_0x5259ed+'%');_0x2b2b68['or'](_0x5af5('0x28'),_0x5259ed+'%');}else if(qs[_0x5af5('0x29')](_0x5259ed)){_0x2b2b68['or'](_0x5af5('0x2a'),_0x5259ed+'%');}else{_0x2b2b68['or']('c.firstName\x20LIKE\x20?','%'+_0x5259ed+'%');_0x2b2b68['or']('c.lastName\x20LIKE\x20?','%'+_0x5259ed+'%');_0x2b2b68['or'](_0x5af5('0x2a'),'%'+_0x5259ed+'%');}}}return _0x2b2b68;}function parseAdvancedSearchFilter(_0x419be7,_0x55dd8e){var _0x455619=getSqlClauses();var _0x20cc51=as['parseSearch'](_0x419be7);var _0x29face=_0x20cc51[_0x5af5('0x2b')];for(var _0x3407e4=0x0;_0x3407e4<_0x20cc51[_0x5af5('0x2c')]['length'];_0x3407e4++){var _0x1c3177=_0x20cc51['conditions'][_0x3407e4];var _0x259aca='c';var _0xec07ac=_[_0x5af5('0x2d')](_0x55dd8e,['name',_0x1c3177[_0x5af5('0x20')]]);if(_0xec07ac){if(_0x1c3177['field']==='dateOfBirth'||_0xec07ac[_0x5af5('0x2e')]===_0x5af5('0x2f')){_0x1c3177[_0x5af5('0x30')]=_0x5af5('0x31');}var _0x33ab82=as[_0x5af5('0x32')](_0x259aca,_0xec07ac['type'],_0x1c3177);_0x455619['default'][_0x29face](_0x33ab82[_0x5af5('0x33')],_0x33ab82[_0x5af5('0x34')][_0x5af5('0x35')],_0x33ab82['value'][_0x5af5('0x36')]);}else{if(_0x1c3177[_0x5af5('0x20')]===_0x5af5('0x37')){var _0x21519d=_0x1c3177[_0x5af5('0x34')][_0x5af5('0x38')](',')[_0x5af5('0x39')](function(_0x486fa7){return Number(_0x486fa7);});var _0x572b45=parseTagParameter(_0x21519d);_0x455619[_0x5af5('0x3a')][_0x5af5('0x3b')]['and'](_0x572b45);_0x455619[_0x5af5('0x3a')][_0x5af5('0x3c')]=_0x21519d;}else if(_0x1c3177[_0x5af5('0x20')]===_0x5af5('0x3d')){_0x455619[_0x5af5('0x3e')][_0x5af5('0x3b')][_0x5af5('0x3f')](_0x5af5('0x40'),_0x1c3177[_0x5af5('0x34')]);_0x455619['user'][_0x5af5('0x41')]=!![];}}}return _0x455619;}function parseModelFields(_0x3c0e28,_0x5ad9aa){var _0x1ebae4=squel[_0x5af5('0x21')]();var _0x3f808f=_(_0x3c0e28)[_0x5af5('0x42')]()[_0x5af5('0x39')](function(_0x11522c){return _[_0x5af5('0x43')](_0x5ad9aa,['name',_0x11522c])?_0x11522c:undefined;})[_0x5af5('0x44')]()['value']();if(_0x3c0e28[_0x5af5('0x45')]){_0x3f808f[_0x5af5('0x1d')](_0x5af5('0x45'));}if(_0x3c0e28[_0x5af5('0x3d')]){_0x3f808f['push']('User');}if(_0x3f808f[_0x5af5('0x46')]>0x0){_0x3f808f[_0x5af5('0x1e')](function(_0x4a5f25){if(_0x4a5f25===_0x5af5('0x7')){_0x1ebae4[_0x5af5('0x3f')](_0x5af5('0x47'),[][_0x5af5('0x48')](_0x3c0e28[_0x4a5f25]));}else if(_0x4a5f25===_0x5af5('0x45')){var _0x48ae0d='%'+_0x3c0e28[_0x4a5f25]+'%';_0x1ebae4[_0x5af5('0x3f')](_0x5af5('0x49'),_0x48ae0d);}else if(_0x4a5f25===_0x5af5('0x3d')){_0x1ebae4[_0x5af5('0x3f')](_0x5af5('0x40'),_0x3c0e28[_0x4a5f25]);}else{_0x1ebae4[_0x5af5('0x3f')]('c.'+_0x4a5f25+_0x5af5('0x4a'),_0x3c0e28[_0x4a5f25]);}});}return _0x1ebae4;}function parseQueryParameters(_0x2c531f,_0x198412){var _0x92a595=getSqlClauses();return Promise[_0x5af5('0x4b')]()[_0x5af5('0x4c')](function(){return parseModelFields(_0x2c531f,_0x198412);})[_0x5af5('0x4c')](function(_0x26d5e7){_0x92a595[_0x5af5('0x4d')][_0x5af5('0x3f')](_0x26d5e7);return parseTagParameter(_0x2c531f[_0x5af5('0x4e')]);})[_0x5af5('0x4c')](function(_0x55ccf1){_0x92a595[_0x5af5('0x3a')][_0x5af5('0x3b')][_0x5af5('0x3f')](_0x55ccf1);return parseSearchFilter(_0x2c531f[_0x5af5('0x4f')]);})[_0x5af5('0x4c')](function(_0x1e6fb5){_0x92a595[_0x5af5('0x4f')]=_0x1e6fb5;return _0x92a595;});}function checkListsRestrictions(_0xc98e1b,_0x475b30,_0x566624){var _0x403cba=squel[_0x5af5('0x21')]();return Promise[_0x5af5('0x4b')]()['then'](function(){if(_0x475b30[_0x5af5('0x6')]&&_0xc98e1b[_0x5af5('0x4')]===_0x5af5('0x5')&&!_0x566624){return _0xc98e1b[_0x5af5('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x5af5('0x4c')](function(_0x327bb7){if(_0x327bb7){if(_0x327bb7[_0x5af5('0x46')]===0x0){_0x403cba['and'](_0x5af5('0x51'));}else{_0x403cba[_0x5af5('0x3f')](_0x5af5('0x47'),_[_0x5af5('0x39')](_0x327bb7,'id'));}}})[_0x5af5('0x4c')](function(){return _0x403cba;});}function buildContactsQuery(_0x34c15c,_0x3db47e,_0x446b6b,_0x265a55,_0xd5fa62,_0x3c4917){if(_0x3db47e){_0x3db47e=_0x446b6b[_0x5af5('0x52')];}_0x34c15c=addFieldsToQuery(_0x34c15c,_0x3db47e,_0x265a55,_0x3c4917,!![]);var _0x5e2722=squel[_0x5af5('0x9')]();_0x5e2722=addFieldsToQuery(_0x5e2722,_0x3db47e,_0x265a55,_0x3c4917,![]);if(_0x265a55||_0x3c4917){_0x34c15c=applyJoinClauses(_0x34c15c,!![]);_0x34c15c[_0x5af5('0x53')]('c.id');if(_0x446b6b['limit']){_0x5e2722[_0x5af5('0x54')](_0x446b6b[_0x5af5('0x54')]);}if(_0x446b6b[_0x5af5('0x55')]){_0x5e2722[_0x5af5('0x55')](_0x446b6b[_0x5af5('0x55')]);}}else{_0x5e2722=applyJoinClauses(_0x5e2722,![]);_0x5e2722[_0x5af5('0x53')](_0x5af5('0x56'));if(_0x446b6b[_0x5af5('0x54')]){_0x34c15c[_0x5af5('0x54')](_0x446b6b[_0x5af5('0x54')]);}if(_0x446b6b[_0x5af5('0x55')]){_0x34c15c['offset'](_0x446b6b[_0x5af5('0x55')]);}}_0x5e2722['having'](_0xd5fa62);if(_0x446b6b['order']){_0x446b6b[_0x5af5('0x57')][_0x5af5('0x1e')](function(_0x193e7c){_0x34c15c[_0x5af5('0x57')]('c.'+_0x193e7c[0x0],_0x193e7c[0x1]===_0x5af5('0x58')?![]:!![]);_0x5e2722[_0x5af5('0x57')](_0x5af5('0x59')+_0x193e7c[0x0],_0x193e7c[0x1]==='DESC'?![]:!![]);});}_0x5e2722[_0x5af5('0xa')](_0x34c15c,_0x5af5('0xe'));return _0x5e2722;}function getFilteredContacts(_0x2b1741){var _0x3d797f=[];return db[_0x5af5('0x37')][_0x5af5('0x5a')]({'attributes':['id',_0x5af5('0x5b'),_0x5af5('0x5c')],'raw':!![]})[_0x5af5('0x4c')](function(_0x236782){_0x3d797f=_[_0x5af5('0x5d')](_0x236782,'id');var _0x54fa21={'type':db[_0x5af5('0x5e')][_0x5af5('0x5f')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x5af5('0x60')][_0x5af5('0x61')](_0x2b1741[_0x5af5('0x62')](),_0x54fa21);})[_0x5af5('0x4c')](function(_0xaa48aa){_0xaa48aa['forEach'](function(_0x18b78c){if(_0x18b78c[_0x5af5('0x1b')]){_0x18b78c[_0x5af5('0x63')]=[];_0x18b78c[_0x5af5('0x1b')][_0x5af5('0x38')](',')[_0x5af5('0x1e')](function(_0x24b0c3){_0x18b78c[_0x5af5('0x63')]['push'](_0x3d797f[_0x24b0c3]);});}delete _0x18b78c[_0x5af5('0x1b')];});return _0xaa48aa;});}function countFilteredContacts(_0x437b1b,_0x4ed2b5){var _0x4c958e=_0x437b1b[_0x5af5('0x64')]();_0x4c958e[_0x5af5('0x20')](_0x5af5('0x65'));_0x4c958e=applyJoinClauses(_0x4c958e,!![]);_0x437b1b[_0x5af5('0x53')](_0x5af5('0x66'));var _0x2c84ad=utils['getSelectedTags'](_0x4ed2b5);if(!_[_0x5af5('0x67')](_0x2c84ad)){_0x4c958e[_0x5af5('0xc')](_0x5af5('0x68'),_0x2c84ad);}var _0x4e11e7={'type':db[_0x5af5('0x5e')][_0x5af5('0x5f')][_0x5af5('0x69')],'raw':!![]};return db[_0x5af5('0x60')][_0x5af5('0x61')](_0x4c958e['toString'](),_0x4e11e7)[_0x5af5('0x4c')](function(_0x57d0f6){return _0x57d0f6[0x0][_0x5af5('0x65')];});}module[_0x5af5('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x3787=['ListId','autocomplete','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','firstName','lastName','mobile','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','length','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','value','start','end','split','map','clause','and','User','user','skip','some','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','tag','tags','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','from','Tag','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search'];(function(_0x500de5,_0x123f6d){var _0x2fe9ec=function(_0x4f61fa){while(--_0x4f61fa){_0x500de5['push'](_0x500de5['shift']());}};_0x2fe9ec(++_0x123f6d);}(_0x3787,0x1a7));var _0x7378=function(_0xb54811,_0x297983){_0xb54811=_0xb54811-0x0;var _0x1139a3=_0x3787[_0xb54811];return _0x1139a3;};'use strict';var _=require(_0x7378('0x0'));var squel=require(_0x7378('0x1'));var as=require(_0x7378('0x2'));var qs=require(_0x7378('0x3'));var utils=require(_0x7378('0x4'));var db=require(_0x7378('0x5'))['db'];function skipContactsQuery(_0x1e6220,_0x1dc52b){var _0x15c17e=![];if(_0x1e6220[_0x7378('0x6')]===_0x7378('0x7')&&!_0x1dc52b[_0x7378('0x8')]&&!_0x1dc52b[_0x7378('0x9')]&&_0x1dc52b[_0x7378('0xa')]!=='true'){_0x15c17e=!![];}return _0x15c17e;}function getContactsSubquery(){return squel['select']()['from'](_0x7378('0xb'),'c')[_0x7378('0xc')](_0x7378('0xd'));}function applyJoinClauses(_0x19f309,_0x2d2506){var _0x20e4a5=_0x2d2506?'c':_0x7378('0xe');_0x19f309[_0x7378('0xf')](_0x7378('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x20e4a5+_0x7378('0x11'))['left_join'](_0x7378('0x12'),'ct',_0x7378('0x13')+_0x20e4a5+_0x7378('0x11'))[_0x7378('0xf')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x19f309;}function addFieldsToQuery(_0x495ab2,_0x2e5472,_0x8a0145,_0x284604,_0x314641){var _0x4adbff=_0x314641?'c':_0x7378('0xe');if(!_0x2e5472){_0x2e5472=['id',_0x7378('0x14'),_0x7378('0x15'),'phone',_0x7378('0x16'),'fax','email','ListId',_0x7378('0x17'),_0x7378('0x18'),_0x7378('0x19'),_0x7378('0x1a'),_0x7378('0x1b')];}else if(!_0x2e5472[_0x7378('0x1c')]('id')){_0x2e5472[_0x7378('0x1d')]('id');}var _0x58cd95=_0x8a0145&&_0x314641||!_0x8a0145&&!_0x314641;if(_0x284604){_0x58cd95=_0x284604&&_0x314641||!_0x284604&&!_0x314641;}_0x2e5472[_0x7378('0x1e')](function(_0x3163c9){if(_0x3163c9===_0x7378('0x1b')){if(_0x58cd95){_0x495ab2[_0x7378('0x1f')](_0x7378('0x20'),_0x3163c9);}else if(_0x8a0145||_0x284604){_0x495ab2[_0x7378('0x1f')](_0x4adbff+'.'+_0x3163c9);}}else{_0x495ab2[_0x7378('0x1f')](_0x4adbff+'.'+_0x3163c9);}});return _0x495ab2;}function getSqlClauses(){var _0x16f686={'default':squel[_0x7378('0x21')](),'fields':squel[_0x7378('0x21')](),'filter':squel[_0x7378('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x7378('0x21')](),'skip':![]}};return _0x16f686;}function parseTagParameter(_0x5a3679){var _0x4f9652=squel[_0x7378('0x21')]();if(_0x5a3679){var _0x2281be=utils['getSelectedTags'](_0x5a3679);_0x2281be[_0x7378('0x1e')](function(_0x1f2e7a){_0x4f9652['or'](_0x7378('0x22'),'%,'+_0x1f2e7a+',%');});}return _0x4f9652;}function parseSearchFilter(_0x4f58d7){var _0x572f5f=squel[_0x7378('0x21')]();if(_0x4f58d7){var _0x40b01a=_0x4f58d7[_0x7378('0x23')]('\x5c','\x5c\x5c')[_0x7378('0x23')](/'/g,'\x27\x27');if(_0x40b01a['split']('\x20')['length']>0x1){_0x572f5f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7378('0x24')](_0x40b01a,!![]),null);}else{if(qs[_0x7378('0x25')](_0x40b01a)){_0x572f5f['or']('c.id\x20LIKE\x20?',_0x40b01a+'%');_0x572f5f['or'](_0x7378('0x26'),_0x40b01a+'%');_0x572f5f['or'](_0x7378('0x27'),_0x40b01a+'%');_0x572f5f['or']('c.fax\x20LIKE\x20?',_0x40b01a+'%');}else if(qs[_0x7378('0x28')](_0x40b01a)){_0x572f5f['or'](_0x7378('0x29'),_0x40b01a+'%');}else{_0x572f5f['or'](_0x7378('0x2a'),'%'+_0x40b01a+'%');_0x572f5f['or'](_0x7378('0x2b'),'%'+_0x40b01a+'%');_0x572f5f['or'](_0x7378('0x29'),'%'+_0x40b01a+'%');}}}return _0x572f5f;}function parseAdvancedSearchFilter(_0xfce727,_0x14f023){var _0x5e8c35=getSqlClauses();var _0x37e345=as['parseSearch'](_0xfce727);var _0x1e4520=_0x37e345[_0x7378('0x2c')];for(var _0x44dbfe=0x0;_0x44dbfe<_0x37e345[_0x7378('0x2d')][_0x7378('0x2e')];_0x44dbfe++){var _0x2551d5=_0x37e345[_0x7378('0x2d')][_0x44dbfe];var _0x43c620='c';var _0x573504=_[_0x7378('0x2f')](_0x14f023,[_0x7378('0x30'),_0x2551d5['field']]);if(_0x573504){if(_0x2551d5[_0x7378('0x1f')]===_0x7378('0x31')||_0x573504[_0x7378('0x32')]===_0x7378('0x33')){_0x2551d5[_0x7378('0x34')]=_0x7378('0x35');}var _0x5982c1=as[_0x7378('0x36')](_0x43c620,_0x573504[_0x7378('0x37')],_0x2551d5);_0x5e8c35['default'][_0x1e4520](_0x5982c1[_0x7378('0x38')],_0x5982c1[_0x7378('0x39')][_0x7378('0x3a')],_0x5982c1[_0x7378('0x39')][_0x7378('0x3b')]);}else{if(_0x2551d5['field']==='Tag'){var _0x2b646a=_0x2551d5[_0x7378('0x39')][_0x7378('0x3c')](',')[_0x7378('0x3d')](function(_0x1ae5ae){return Number(_0x1ae5ae);});var _0x144fad=parseTagParameter(_0x2b646a);_0x5e8c35['tags'][_0x7378('0x3e')][_0x7378('0x3f')](_0x144fad);_0x5e8c35['tags']['ids']=_0x2b646a;}else if(_0x2551d5[_0x7378('0x1f')]===_0x7378('0x40')){_0x5e8c35['user']['clause'][_0x7378('0x3f')]('uc.UserId\x20=\x20?',_0x2551d5[_0x7378('0x39')]);_0x5e8c35[_0x7378('0x41')][_0x7378('0x42')]=!![];}}}return _0x5e8c35;}function parseModelFields(_0xcb6108,_0x37109e){var _0x58ed61=squel[_0x7378('0x21')]();var _0x4f6e39=_(_0xcb6108)['keys']()[_0x7378('0x3d')](function(_0x10af15){return _[_0x7378('0x43')](_0x37109e,[_0x7378('0x30'),_0x10af15])?_0x10af15:undefined;})['compact']()['value']();if(_0xcb6108['Contact']){_0x4f6e39['push']('Contact');}if(_0xcb6108[_0x7378('0x40')]){_0x4f6e39['push'](_0x7378('0x40'));}if(_0x4f6e39[_0x7378('0x2e')]>0x0){_0x4f6e39['forEach'](function(_0x1479cc){if(_0x1479cc===_0x7378('0x9')){_0x58ed61[_0x7378('0x3f')]('c.ListId\x20IN\x20?',[][_0x7378('0x44')](_0xcb6108[_0x1479cc]));}else if(_0x1479cc===_0x7378('0x45')){var _0x1ab71f='%'+_0xcb6108[_0x1479cc]+'%';_0x58ed61['and'](_0x7378('0x46'),_0x1ab71f);}else if(_0x1479cc===_0x7378('0x40')){_0x58ed61[_0x7378('0x3f')](_0x7378('0x47'),_0xcb6108[_0x1479cc]);}else{_0x58ed61['and']('c.'+_0x1479cc+'\x20=\x20?',_0xcb6108[_0x1479cc]);}});}return _0x58ed61;}function parseQueryParameters(_0x30da6a,_0x352d37){var _0x358de9=getSqlClauses();return Promise[_0x7378('0x48')]()[_0x7378('0x49')](function(){return parseModelFields(_0x30da6a,_0x352d37);})[_0x7378('0x49')](function(_0x16971a){_0x358de9[_0x7378('0x4a')][_0x7378('0x3f')](_0x16971a);return parseTagParameter(_0x30da6a[_0x7378('0x4b')]);})['then'](function(_0x10c30d){_0x358de9[_0x7378('0x4c')][_0x7378('0x3e')]['and'](_0x10c30d);return parseSearchFilter(_0x30da6a[_0x7378('0x4d')]);})[_0x7378('0x49')](function(_0x33043c){_0x358de9[_0x7378('0x4d')]=_0x33043c;return _0x358de9;});}function checkListsRestrictions(_0x46cba8,_0x52d1d6,_0x37a0e7){var _0x521194=squel[_0x7378('0x21')]();return Promise['resolve']()[_0x7378('0x49')](function(){if(_0x52d1d6['search']&&_0x46cba8[_0x7378('0x6')]===_0x7378('0x7')&&!_0x37a0e7){return _0x46cba8[_0x7378('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x7378('0x49')](function(_0x9f8c4){if(_0x9f8c4){if(_0x9f8c4[_0x7378('0x2e')]===0x0){_0x521194[_0x7378('0x3f')](_0x7378('0x4f'));}else{_0x521194[_0x7378('0x3f')]('c.ListId\x20IN\x20?',_[_0x7378('0x3d')](_0x9f8c4,'id'));}}})['then'](function(){return _0x521194;});}function buildContactsQuery(_0x11f0a6,_0x54a280,_0xa6f519,_0x1dec1c,_0x5d6fcb,_0x3bc34b){if(_0x54a280){_0x54a280=_0xa6f519[_0x7378('0x50')];}_0x11f0a6=addFieldsToQuery(_0x11f0a6,_0x54a280,_0x1dec1c,_0x3bc34b,!![]);var _0x1da83d=squel[_0x7378('0x51')]();_0x1da83d=addFieldsToQuery(_0x1da83d,_0x54a280,_0x1dec1c,_0x3bc34b,![]);if(_0x1dec1c||_0x3bc34b){_0x11f0a6=applyJoinClauses(_0x11f0a6,!![]);_0x11f0a6[_0x7378('0x52')](_0x7378('0x53'));if(_0xa6f519[_0x7378('0x54')]){_0x1da83d[_0x7378('0x54')](_0xa6f519[_0x7378('0x54')]);}if(_0xa6f519['offset']){_0x1da83d['offset'](_0xa6f519[_0x7378('0x55')]);}}else{_0x1da83d=applyJoinClauses(_0x1da83d,![]);_0x1da83d[_0x7378('0x52')](_0x7378('0x56'));if(_0xa6f519[_0x7378('0x54')]){_0x11f0a6[_0x7378('0x54')](_0xa6f519[_0x7378('0x54')]);}if(_0xa6f519[_0x7378('0x55')]){_0x11f0a6[_0x7378('0x55')](_0xa6f519[_0x7378('0x55')]);}}_0x1da83d[_0x7378('0x57')](_0x5d6fcb);if(_0xa6f519['order']){_0xa6f519['order']['forEach'](function(_0x1b439a){_0x11f0a6[_0x7378('0x58')]('c.'+_0x1b439a[0x0],_0x1b439a[0x1]===_0x7378('0x59')?![]:!![]);_0x1da83d['order']('subqry.'+_0x1b439a[0x0],_0x1b439a[0x1]===_0x7378('0x59')?![]:!![]);});}_0x1da83d[_0x7378('0x5a')](_0x11f0a6,_0x7378('0xe'));return _0x1da83d;}function getFilteredContacts(_0xfcb388){var _0x4136d7=[];return db[_0x7378('0x5b')][_0x7378('0x5c')]({'attributes':['id',_0x7378('0x30'),_0x7378('0x5d')],'raw':!![]})[_0x7378('0x49')](function(_0x4676d9){_0x4136d7=_[_0x7378('0x5e')](_0x4676d9,'id');var _0x2d9979={'type':db[_0x7378('0x5f')][_0x7378('0x60')][_0x7378('0x61')],'model':db[_0x7378('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x7378('0x63')](_0xfcb388[_0x7378('0x64')](),_0x2d9979);})[_0x7378('0x49')](function(_0x486fb1){_0x486fb1[_0x7378('0x1e')](function(_0x2851b2){if(_0x2851b2[_0x7378('0x1b')]){_0x2851b2[_0x7378('0x65')]=[];_0x2851b2['TagIds'][_0x7378('0x3c')](',')[_0x7378('0x1e')](function(_0x1b030e){_0x2851b2['Tags'][_0x7378('0x1d')](_0x4136d7[_0x1b030e]);});}delete _0x2851b2['TagIds'];});return _0x486fb1;});}function countFilteredContacts(_0x11737c,_0x87a223){var _0x54e344=_0x11737c[_0x7378('0x66')]();_0x54e344[_0x7378('0x1f')](_0x7378('0x67'));_0x54e344=applyJoinClauses(_0x54e344,!![]);_0x11737c[_0x7378('0x52')](_0x7378('0x53'));var _0x61cfc4=utils[_0x7378('0x68')](_0x87a223);if(!_[_0x7378('0x69')](_0x61cfc4)){_0x54e344[_0x7378('0xc')](_0x7378('0x6a'),_0x61cfc4);}var _0x2d717a={'type':db[_0x7378('0x5f')][_0x7378('0x60')]['SELECT'],'raw':!![]};return db['sequelize'][_0x7378('0x63')](_0x54e344[_0x7378('0x64')](),_0x2d717a)[_0x7378('0x49')](function(_0x1e282d){return _0x1e282d[0x0]['COUNT(*)'];});}module[_0x7378('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 76d431e..7243db2 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 _0x4e0f=['createDecipher','encryptString','update','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','binary','write','end','final','close','decryptFile'];(function(_0xfbceb4,_0x392f3b){var _0x563dbe=function(_0x3ac1cf){while(--_0x3ac1cf){_0xfbceb4['push'](_0xfbceb4['shift']());}};_0x563dbe(++_0x392f3b);}(_0x4e0f,0x82));var _0xf4e0=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0x4e0f[_0x786e9];return _0x1f891b;};'use strict';var crypto=require(_0xf4e0('0x0'));var fs=require('fs');var BPromise=require(_0xf4e0('0x1'));var _=require(_0xf4e0('0x2'));var config=require(_0xf4e0('0x3'));var logger=require(_0xf4e0('0x4'))(_0xf4e0('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf4e0('0x6')][_0xf4e0('0x7')],'algorithm':_0xf4e0('0x8')};const fileOptions={'algorithm':_0xf4e0('0x9')};if(config[_0xf4e0('0xa')]&&config[_0xf4e0('0xa')][_0xf4e0('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xf4e0('0xb')]);if(isSupported){fileOptions[_0xf4e0('0xb')]=config[_0xf4e0('0xa')][_0xf4e0('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf4e0('0xc')](',\x20');logger[_0xf4e0('0xd')](config[_0xf4e0('0xa')][_0xf4e0('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5e1218){return AES_SUPPORTED_RX['test'](_0x5e1218);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x451411){return getSupportedCiphers()[_0xf4e0('0xe')](_0x451411)>-0x1;}function combineOptions(_0x3f3dfe){var _0x16bd55={};for(var _0x37ecf2 in fileOptions){if(fileOptions[_0xf4e0('0xf')](_0x37ecf2)){_0x16bd55[_0x37ecf2]=fileOptions[_0x37ecf2];}}if(_0x3f3dfe){for(var _0x559d05 in _0x3f3dfe){if(_0x3f3dfe[_0xf4e0('0xf')](_0x559d05)){_0x16bd55[_0x559d05]=_0x3f3dfe[_0x559d05];}}}return _0x16bd55;}exports['encryptFile']=function(_0x31a718,_0x37bfb1,_0x149360,_0x5a23b4){return new BPromise(function(_0x1134d0,_0x49fb36){_0x5a23b4=combineOptions(_0x5a23b4);var _0x1cbc85=new Buffer(_0x149360);var _0x36b143=fs[_0xf4e0('0x10')](_0x31a718);var _0x256446=fs[_0xf4e0('0x11')](_0x37bfb1);var _0x584fc0=crypto['createCipher'](_0x5a23b4[_0xf4e0('0xb')],_0x1cbc85);_0x36b143['on'](_0xf4e0('0x12'),function(_0x1475ca){var _0x5e48aa=new Buffer(_0x584fc0['update'](_0x1475ca),_0xf4e0('0x13'));_0x256446[_0xf4e0('0x14')](_0x5e48aa);});_0x36b143['on'](_0xf4e0('0x15'),function(){try{var _0x44e992=new Buffer(_0x584fc0[_0xf4e0('0x16')](_0xf4e0('0x13')),_0xf4e0('0x13'));_0x256446[_0xf4e0('0x14')](_0x44e992);_0x256446['end']();_0x256446['on'](_0xf4e0('0x17'),function(){return _0x1134d0(_0x37bfb1);});}catch(_0x57a8c7){fs['unlink'](_0x37bfb1);return _0x49fb36(_0x57a8c7);}});});};exports[_0xf4e0('0x18')]=function(_0x23949a,_0x3db30a,_0x3fe1cf,_0xeef930){return new BPromise(function(_0x59f020,_0x5dbf45){_0xeef930=combineOptions(_0xeef930);var _0x51f53f=new Buffer(_0x3fe1cf);var _0x15c311=fs['createReadStream'](_0x23949a);var _0x26c283=fs['createWriteStream'](_0x3db30a);var _0xff903f=crypto[_0xf4e0('0x19')](_0xeef930['algorithm'],_0x51f53f);_0x15c311['on'](_0xf4e0('0x12'),function(_0x24ca61){var _0x3fac6c=new Buffer(_0xff903f['update'](_0x24ca61),_0xf4e0('0x13'));_0x26c283[_0xf4e0('0x14')](_0x3fac6c);});_0x15c311['on']('end',function(){try{var _0x68c898=new Buffer(_0xff903f['final'](_0xf4e0('0x13')),'binary');_0x26c283[_0xf4e0('0x14')](_0x68c898);_0x26c283['end']();_0x26c283['on'](_0xf4e0('0x17'),function(){return _0x59f020(_0x3db30a);});}catch(_0x55025b){fs['unlink'](_0x3db30a);return _0x5dbf45(_0x55025b);}});});};exports[_0xf4e0('0x1a')]=function(_0x1e61bd,_0x411c57,_0x10f009){var _0x23a7b3=_0x10f009||stringOptions[_0xf4e0('0xb')];var _0x214e89=_0x411c57||stringOptions['secret'];var _0x5e58e5=crypto['createCipher'](_0x23a7b3,_0x214e89);var _0x1eb08a=_0x5e58e5[_0xf4e0('0x1b')](_0x1e61bd,'utf8',_0xf4e0('0x1c'));_0x1eb08a+=_0x5e58e5['final'](_0xf4e0('0x1c'));return _0x1eb08a;};exports[_0xf4e0('0x1d')]=function(_0x3b3a4a,_0x2e7870,_0x1d7b69){var _0x13ca06=_0x1d7b69||stringOptions[_0xf4e0('0xb')];var _0x350fb2=_0x2e7870||stringOptions['secret'];var _0x147629=crypto[_0xf4e0('0x19')](_0x13ca06,_0x350fb2);var _0x221170=_0x147629[_0xf4e0('0x1b')](_0x3b3a4a,_0xf4e0('0x1c'),'utf8');_0x221170+=_0x147629[_0xf4e0('0x16')](_0xf4e0('0x1e'));return _0x221170;}; \ No newline at end of file +var _0x886e=['final','write','end','decryptFile','createDecipher','close','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x886e,0xea));var _0xe886=function(_0x6a7e4f,_0x439e7a){_0x6a7e4f=_0x6a7e4f-0x0;var _0x1482d3=_0x886e[_0x6a7e4f];return _0x1482d3;};'use strict';var crypto=require(_0xe886('0x0'));var fs=require('fs');var BPromise=require(_0xe886('0x1'));var _=require('lodash');var config=require(_0xe886('0x2'));var logger=require(_0xe886('0x3'))(_0xe886('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe886('0x5')][_0xe886('0x6')],'algorithm':_0xe886('0x7')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0xe886('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xe886('0x8')][_0xe886('0x9')]);if(isSupported){fileOptions[_0xe886('0x9')]=config[_0xe886('0x8')][_0xe886('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe886('0xa')](',\x20');logger[_0xe886('0xb')](config['encrypt'][_0xe886('0x9')],_0xe886('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x481fa7){return AES_SUPPORTED_RX[_0xe886('0xd')](_0x481fa7);}function getSupportedCiphers(){return crypto[_0xe886('0xe')]()[_0xe886('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xf3fa1e){return getSupportedCiphers()[_0xe886('0x10')](_0xf3fa1e)>-0x1;}function combineOptions(_0x3a07b2){var _0x160f5e={};for(var _0x1d4875 in fileOptions){if(fileOptions[_0xe886('0x11')](_0x1d4875)){_0x160f5e[_0x1d4875]=fileOptions[_0x1d4875];}}if(_0x3a07b2){for(var _0x442a3e in _0x3a07b2){if(_0x3a07b2[_0xe886('0x11')](_0x442a3e)){_0x160f5e[_0x442a3e]=_0x3a07b2[_0x442a3e];}}}return _0x160f5e;}exports[_0xe886('0x12')]=function(_0x30fa4b,_0x4fc841,_0x5b5ca1,_0x122f83){return new BPromise(function(_0x43bc31,_0x39fd69){_0x122f83=combineOptions(_0x122f83);var _0x5f1afd=new Buffer(_0x5b5ca1);var _0x3afb6d=fs[_0xe886('0x13')](_0x30fa4b);var _0x1fcedf=fs[_0xe886('0x14')](_0x4fc841);var _0x540dff=crypto[_0xe886('0x15')](_0x122f83[_0xe886('0x9')],_0x5f1afd);_0x3afb6d['on'](_0xe886('0x16'),function(_0x14b023){var _0x40c4f9=new Buffer(_0x540dff[_0xe886('0x17')](_0x14b023),_0xe886('0x18'));_0x1fcedf['write'](_0x40c4f9);});_0x3afb6d['on']('end',function(){try{var _0x39fd89=new Buffer(_0x540dff[_0xe886('0x19')](_0xe886('0x18')),_0xe886('0x18'));_0x1fcedf[_0xe886('0x1a')](_0x39fd89);_0x1fcedf[_0xe886('0x1b')]();_0x1fcedf['on']('close',function(){return _0x43bc31(_0x4fc841);});}catch(_0x30ee0c){fs['unlink'](_0x4fc841);return _0x39fd69(_0x30ee0c);}});});};exports[_0xe886('0x1c')]=function(_0x4d7496,_0x534027,_0x5094bb,_0xc917e7){return new BPromise(function(_0x39d4dd,_0x40e78c){_0xc917e7=combineOptions(_0xc917e7);var _0x11ec9a=new Buffer(_0x5094bb);var _0x4900da=fs['createReadStream'](_0x4d7496);var _0x55d89d=fs[_0xe886('0x14')](_0x534027);var _0x34dc5b=crypto[_0xe886('0x1d')](_0xc917e7[_0xe886('0x9')],_0x11ec9a);_0x4900da['on'](_0xe886('0x16'),function(_0x308a2b){var _0x7c4d5d=new Buffer(_0x34dc5b[_0xe886('0x17')](_0x308a2b),_0xe886('0x18'));_0x55d89d[_0xe886('0x1a')](_0x7c4d5d);});_0x4900da['on'](_0xe886('0x1b'),function(){try{var _0x277bff=new Buffer(_0x34dc5b[_0xe886('0x19')](_0xe886('0x18')),_0xe886('0x18'));_0x55d89d['write'](_0x277bff);_0x55d89d[_0xe886('0x1b')]();_0x55d89d['on'](_0xe886('0x1e'),function(){return _0x39d4dd(_0x534027);});}catch(_0x5e2914){fs[_0xe886('0x1f')](_0x534027);return _0x40e78c(_0x5e2914);}});});};exports[_0xe886('0x20')]=function(_0x2b4acc,_0x45cdf4,_0x126adc){var _0xb4d26e=_0x126adc||stringOptions[_0xe886('0x9')];var _0x4b2cf6=_0x45cdf4||stringOptions[_0xe886('0x21')];var _0x5d9016=crypto[_0xe886('0x15')](_0xb4d26e,_0x4b2cf6);var _0x3a86db=_0x5d9016[_0xe886('0x17')](_0x2b4acc,_0xe886('0x22'),'base64');_0x3a86db+=_0x5d9016[_0xe886('0x19')](_0xe886('0x23'));return _0x3a86db;};exports[_0xe886('0x24')]=function(_0x14eebc,_0x852c06,_0x38d35a){var _0x104336=_0x38d35a||stringOptions[_0xe886('0x9')];var _0x3b70de=_0x852c06||stringOptions[_0xe886('0x21')];var _0x52425c=crypto[_0xe886('0x1d')](_0x104336,_0x3b70de);var _0x227242=_0x52425c[_0xe886('0x17')](_0x14eebc,_0xe886('0x23'),'utf8');_0x227242+=_0x52425c[_0xe886('0x19')](_0xe886('0x22'));return _0x227242;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ff1a46a..38a38a0 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 _0x211e=['rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','length','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','path','lodash','to-csv','zip-dir'];(function(_0x894b01,_0x36ff79){var _0x14a50f=function(_0x5e225f){while(--_0x5e225f){_0x894b01['push'](_0x894b01['shift']());}};_0x14a50f(++_0x36ff79);}(_0x211e,0x11c));var _0xe211=function(_0x4e4e74,_0x32c335){_0x4e4e74=_0x4e4e74-0x0;var _0x68a0d0=_0x211e[_0x4e4e74];return _0x68a0d0;};'use strict';var util=require('util');var path=require(_0xe211('0x0'));var _=require(_0xe211('0x1'));var csv=require(_0xe211('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xe211('0x3'));var rimraf=require(_0xe211('0x4'));var db=require(_0xe211('0x5'))['db'];var dbH=require(_0xe211('0x5'))[_0xe211('0x6')];var logger=require(_0xe211('0x7'))(_0xe211('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe211('0x9')][0x2]);var QUERY=process[_0xe211('0x9')][0x3];var PATH=process[_0xe211('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x26f869,_0x49f501){var _0x3a1e90={'status':_0x26f869};var _0x50c3f3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49f501){_0x3a1e90[_0xe211('0xa')]=_0x49f501;}return db['AnalyticExtractedReport'][_0xe211('0xb')](_0x3a1e90,_0x50c3f3);}function main(){var _0x3906b6=0x1388;var _0x5912ab;logger[_0xe211('0xc')](util['format'](_0xe211('0xd'),EXTRACTED_REPORT_ID,_0xe211('0xe')));return db[_0xe211('0xf')][_0xe211('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe211('0x11'),_0xe211('0x12')]})['then'](function(_0x23e582){if(_0x23e582){_0x5912ab=_0x23e582;_0x3906b6=_0x5912ab[_0xe211('0x12')]||0x1388;}})[_0xe211('0x13')](function(){return dbH[_0xe211('0x14')][_0xe211('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe211('0x14')][_0xe211('0x16')][_0xe211('0x17')]});})['then'](function(_0x2c73c1){if(!_0x2c73c1[0x0][_0xe211('0x18')]){return analyticExtractedReport('Empty');}var _0x12c24e=[];var _0x201852=0x0;if(_0x5912ab['split']){if(_0x2c73c1&&_0x2c73c1[_0xe211('0x19')]){var _0x5e82dc=_['range'](_0x2c73c1[0x0][_0xe211('0x18')]/_0x3906b6);var _0x13c9b6=Number[_0xe211('0x1a')](_0x2c73c1[0x0][_0xe211('0x18')]/_0x3906b6)?_0x2c73c1[0x0][_0xe211('0x18')]%_0x3906b6:0x0;_0x5e82dc[_0xe211('0x1b')](function(_0x5c14cd){if(_0x5c14cd>0x0){_0x201852+=_0x3906b6;}_0x12c24e[_0xe211('0x1c')](dbH['sequelize'][_0xe211('0x15')](util[_0xe211('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3906b6,_0x201852),{'type':dbH[_0xe211('0x14')]['QueryTypes'][_0xe211('0x17')]}));});if(_0x13c9b6>0x0){_0x201852+=_0x3906b6;_0x12c24e['push'](dbH[_0xe211('0x14')][_0xe211('0x15')](util[_0xe211('0x1d')](_0xe211('0x1e'),QUERY,_0x13c9b6,_0x201852),{'type':dbH[_0xe211('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x12c24e[_0xe211('0x1c')](dbH['sequelize'][_0xe211('0x15')](QUERY,{'type':dbH[_0xe211('0x14')][_0xe211('0x16')][_0xe211('0x17')]}));}var _0x114024=path['dirname'](PATH);var _0x5c27e9=path[_0xe211('0x1f')](PATH,_0xe211('0x20'));var _0x48173d=_0x5912ab[_0xe211('0x11')]&&_0x12c24e[_0xe211('0x19')]>0x1;var _0x55113e=[];if(!fs['existsSync'](path[_0xe211('0x21')](_0x114024,_0x5c27e9))&&_0x48173d){fs[_0xe211('0x22')](path[_0xe211('0x21')](_0x114024,_0x5c27e9));}return BPromise[_0xe211('0x23')](_0x12c24e,function(_0x181690){_0x55113e[_0xe211('0x1c')](_0x181690);})[_0xe211('0x13')](function(){for(var _0x11aa75=0x0;_0x11aa75<_0x55113e[_0xe211('0x19')];_0x11aa75+=0x1){var _0x2e6b59;var _0x57ec6d=_0x55113e[_0x11aa75];if(_0x48173d){_0x2e6b59=path[_0xe211('0x21')](_0x114024,_0x5c27e9,util['format'](_0xe211('0x24'),_0x5c27e9,_0x11aa75,_0xe211('0x25')));}else{_0x2e6b59=path[_0xe211('0x21')](_0x114024,util[_0xe211('0x1d')](_0xe211('0x26'),_0x5c27e9,_0xe211('0x25')));}fs[_0xe211('0x27')](_0x2e6b59,csv(_0x57ec6d));}})[_0xe211('0x13')](function(){if(_0x48173d){return new Promise(function(_0x3bbf95){zipdir(path[_0xe211('0x21')](_0x114024,_0x5c27e9),{'saveTo':path['join'](_0x114024,util[_0xe211('0x1d')]('%s.%s',_0x5c27e9,_0xe211('0x28')))},function(_0x5f529f,_0xc7e8be){rimraf(path[_0xe211('0x21')](_0x114024,_0x5c27e9),function(){});_0x3bbf95(_0xe211('0x29'));});});}})[_0xe211('0x13')](function(){logger['info'](util[_0xe211('0x1d')](_0xe211('0x2a'),EXTRACTED_REPORT_ID,_0xe211('0xe')));return analyticExtractedReport(_0xe211('0x2b'),_0x48173d?util['format'](_0xe211('0x26'),_0x5c27e9,_0x48173d?'zip':_0xe211('0x25')):null);});})[_0xe211('0x2c')](function(_0x255c9c){logger['info'](util['format'](_0xe211('0x2d'),EXTRACTED_REPORT_ID,_0xe211('0xe')),util[_0xe211('0x2e')](_0x255c9c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe211('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4553=['CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4553,0x100));var _0x3455=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x4553[_0x3c4737];return _0x2bb926;};'use strict';var util=require(_0x3455('0x0'));var path=require(_0x3455('0x1'));var _=require(_0x3455('0x2'));var csv=require(_0x3455('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x3455('0x4'));var db=require(_0x3455('0x5'))['db'];var dbH=require(_0x3455('0x5'))['dbH'];var logger=require(_0x3455('0x6'))(_0x3455('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3455('0x8')][0x2]);var QUERY=process[_0x3455('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1943be,_0xcf17d6){var _0x1a1c09={'status':_0x1943be};var _0x1653c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcf17d6){_0x1a1c09[_0x3455('0x9')]=_0xcf17d6;}return db[_0x3455('0xa')][_0x3455('0xb')](_0x1a1c09,_0x1653c6);}function main(){var _0x1d25c4=0x1388;var _0x6c95bf;logger[_0x3455('0xc')](util[_0x3455('0xd')](_0x3455('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x3455('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3455('0x10'),_0x3455('0x11')]})[_0x3455('0x12')](function(_0x5f1f02){if(_0x5f1f02){_0x6c95bf=_0x5f1f02;_0x1d25c4=_0x6c95bf['splitSizeCsv']||0x1388;}})[_0x3455('0x12')](function(){return dbH[_0x3455('0x13')]['query'](util['format'](_0x3455('0x14'),QUERY),{'type':dbH[_0x3455('0x13')][_0x3455('0x15')][_0x3455('0x16')]});})[_0x3455('0x12')](function(_0x10c3af){if(!_0x10c3af[0x0][_0x3455('0x17')]){return analyticExtractedReport(_0x3455('0x18'));}var _0xfba907=[];var _0x111a4c=0x0;if(_0x6c95bf[_0x3455('0x10')]){if(_0x10c3af&&_0x10c3af[_0x3455('0x19')]){var _0xa2996e=_[_0x3455('0x1a')](_0x10c3af[0x0][_0x3455('0x17')]/_0x1d25c4);var _0x3dd3fd=Number[_0x3455('0x1b')](_0x10c3af[0x0][_0x3455('0x17')]/_0x1d25c4)?_0x10c3af[0x0][_0x3455('0x17')]%_0x1d25c4:0x0;_0xa2996e['forEach'](function(_0x35e487){if(_0x35e487>0x0){_0x111a4c+=_0x1d25c4;}_0xfba907[_0x3455('0x1c')](dbH[_0x3455('0x13')][_0x3455('0x1d')](util[_0x3455('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1d25c4,_0x111a4c),{'type':dbH['sequelize'][_0x3455('0x15')][_0x3455('0x16')]}));});if(_0x3dd3fd>0x0){_0x111a4c+=_0x1d25c4;_0xfba907[_0x3455('0x1c')](dbH[_0x3455('0x13')][_0x3455('0x1d')](util[_0x3455('0xd')](_0x3455('0x1e'),QUERY,_0x3dd3fd,_0x111a4c),{'type':dbH[_0x3455('0x13')][_0x3455('0x15')]['SELECT']}));}}}else{_0xfba907['push'](dbH[_0x3455('0x13')][_0x3455('0x1d')](QUERY,{'type':dbH['sequelize'][_0x3455('0x15')][_0x3455('0x16')]}));}var _0x3d1fa9=path[_0x3455('0x1f')](PATH);var _0x48cfd7=path[_0x3455('0x20')](PATH,'.csv');var _0x37d21f=_0x6c95bf['split']&&_0xfba907[_0x3455('0x19')]>0x1;var _0x11aab3=[];if(!fs[_0x3455('0x21')](path[_0x3455('0x22')](_0x3d1fa9,_0x48cfd7))&&_0x37d21f){fs[_0x3455('0x23')](path[_0x3455('0x22')](_0x3d1fa9,_0x48cfd7));}return BPromise[_0x3455('0x24')](_0xfba907,function(_0x3c086d){_0x11aab3[_0x3455('0x1c')](_0x3c086d);})[_0x3455('0x12')](function(){for(var _0x27c727=0x0;_0x27c727<_0x11aab3[_0x3455('0x19')];_0x27c727+=0x1){var _0x5dda93;var _0x277582=_0x11aab3[_0x27c727];if(_0x37d21f){_0x5dda93=path[_0x3455('0x22')](_0x3d1fa9,_0x48cfd7,util[_0x3455('0xd')](_0x3455('0x25'),_0x48cfd7,_0x27c727,_0x3455('0x26')));}else{_0x5dda93=path['join'](_0x3d1fa9,util[_0x3455('0xd')]('%s.%s',_0x48cfd7,_0x3455('0x26')));}fs[_0x3455('0x27')](_0x5dda93,csv(_0x277582));}})[_0x3455('0x12')](function(){if(_0x37d21f){return new Promise(function(_0x11545a){zipdir(path[_0x3455('0x22')](_0x3d1fa9,_0x48cfd7),{'saveTo':path[_0x3455('0x22')](_0x3d1fa9,util['format'](_0x3455('0x28'),_0x48cfd7,_0x3455('0x29')))},function(_0x56303e,_0x11b95b){rimraf(path[_0x3455('0x22')](_0x3d1fa9,_0x48cfd7),function(){});_0x11545a(_0x3455('0x2a'));});});}})[_0x3455('0x12')](function(){logger['info'](util[_0x3455('0xd')](_0x3455('0x2b'),EXTRACTED_REPORT_ID,_0x3455('0x2c')));return analyticExtractedReport(_0x3455('0x2d'),_0x37d21f?util[_0x3455('0xd')](_0x3455('0x28'),_0x48cfd7,_0x37d21f?'zip':_0x3455('0x26')):null);});})['catch'](function(_0x4a0a0b){logger[_0x3455('0xc')](util['format'](_0x3455('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x3455('0x2f')](_0x4a0a0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3455('0x30'));})['finally'](function(){process[_0x3455('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 68ecddb..a87852a 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 _0xe507=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','value','length','auto','body','push','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','format','header','before','margin','landscape','toString','footer','Arial','black','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','sequelize','QueryTypes','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','zip\x20finished','info'];(function(_0x1c89ed,_0x5c560c){var _0x72ef7d=function(_0xc52407){while(--_0xc52407){_0x1c89ed['push'](_0x1c89ed['shift']());}};_0x72ef7d(++_0x5c560c);}(_0xe507,0x6e));var _0x7e50=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0xe507[_0x246f0c];return _0x30fe50;};'use strict';var _=require(_0x7e50('0x0'));var fs=require('fs');var util=require(_0x7e50('0x1'));var path=require(_0x7e50('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x7e50('0x3'));var PdfPrinter=require(_0x7e50('0x4'));var zipdir=require(_0x7e50('0x5'));var rimraf=require(_0x7e50('0x6'));var JSDOM=require(_0x7e50('0x7'))[_0x7e50('0x8')];var window=new JSDOM('')[_0x7e50('0x9')];var BPromise=require(_0x7e50('0xa'));var db=require(_0x7e50('0xb'))['db'];var dbH=require(_0x7e50('0xb'))['dbH'];var logger=require(_0x7e50('0xc'))(_0x7e50('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x7e50('0xe')][0x2]);var QUERY=process[_0x7e50('0xe')][0x3];var PATH=process[_0x7e50('0xe')][0x4];var NAME=process[_0x7e50('0xe')][0x5];var FORMAT=_0x7e50('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1e647d,_0x3d5f28){var _0x31fe9a={'status':_0x1e647d};var _0x432ecf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d5f28){_0x31fe9a['savename']=_0x3d5f28;}return db[_0x7e50('0x10')]['update'](_0x31fe9a,_0x432ecf);}function getHeaders(_0x5703ce){return _['map'](_0x5703ce,function(_0x5e20d4){return{'text':_0x5e20d4,'style':'tableHeader'};});}function getRows(_0xb95500,_0x4adb46){return _[_0x7e50('0x11')](_0x4adb46,function(_0x38fc9a){return _(_0x38fc9a)['pick'](_0xb95500)[_0x7e50('0x11')](function(_0x53e367){return _0x53e367?_['toString'](_0x53e367):'';})[_0x7e50('0x12')]();});}function createTable(_0x16b51e,_0x1ce852){var _0x1abead={'widths':_['fill'](Array(_0x16b51e[_0x7e50('0x13')]),0x91),'heights':function(_0x11354d){return _0x11354d===0x0?_0x7e50('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x22f1a5=getHeaders(_0x16b51e);_0x1abead[_0x7e50('0x15')][_0x7e50('0x16')](_0x22f1a5);var _0x3eb102=getRows(_0x16b51e,_0x1ce852);_0x1abead['body']=_0x1abead[_0x7e50('0x15')]['concat'](_0x3eb102);return _0x1abead;}function createTables(_0x271197){var _0x4ada16=[];var _0x16a6e0=_[_0x7e50('0x17')](Object['keys'](_0x271197[0x0]),0x5);_0x16a6e0[_0x7e50('0x18')](function(_0x21cafe){_0x4ada16[_0x7e50('0x16')](createTable(_0x21cafe,_0x271197));});return _0x4ada16;}function getPDFDocDefinition(_0x467808){var _0xc65cac=util['format'](_0x7e50('0x19'),NAME,EXTRACTED_REPORT[_0x7e50('0x1a')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x7e50('0x1b')])[_0x7e50('0x1c')](FORMAT));var _0x52efe2=[];for(var _0x4fec72=0x0;_0x4fec72<_0x467808[_0x7e50('0x13')];_0x4fec72++){var _0x26a406=[];if(_0x4fec72===0x0){_0x26a406[_0x7e50('0x16')]({'text':_0xc65cac,'style':_0x7e50('0x1d')});}var _0x3ee93c={'table':_0x467808[_0x4fec72]};if(_0x4fec72>0x0){_0x3ee93c['pageBreak']=_0x7e50('0x1e');_0x3ee93c[_0x7e50('0x1f')]=[0x0,0x46,0x0,0x0];}_0x26a406[_0x7e50('0x16')](_0x3ee93c);_0x52efe2[_0x7e50('0x16')](_0x26a406);}return{'pageSize':'A4','pageOrientation':_0x7e50('0x20'),'content':_0x52efe2,'footer':function(_0x1b12e4,_0x3100fb){return{'text':_0x1b12e4[_0x7e50('0x21')]()+'\x20/\x20'+_0x3100fb,'style':_0x7e50('0x22')};},'defaultStyle':{'font':_0x7e50('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7e50('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1de367){var _0x2c8947=0x1388;var _0x1693e4;if(!_0x1de367[0x0][_0x7e50('0x25')]){return analyticExtractedReport(_0x7e50('0x26'));}return db[_0x7e50('0x27')][_0x7e50('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7e50('0x29'),_0x7e50('0x2a')]})[_0x7e50('0x2b')](function(_0x3ad5b2){if(_0x3ad5b2){_0x1693e4=_0x3ad5b2;_0x2c8947=_0x1693e4[_0x7e50('0x2a')]||0x3e8;}})['then'](function(){var _0x4c9257=[];var _0x1d5e47=0x0;if(_0x1693e4[_0x7e50('0x29')]){if(_0x1de367&&_0x1de367[_0x7e50('0x13')]){var _0xe96697=_[_0x7e50('0x2c')](_0x1de367[0x0][_0x7e50('0x25')]/_0x2c8947);var _0x570f57=Number[_0x7e50('0x2d')](_0x1de367[0x0][_0x7e50('0x25')]/_0x2c8947)?_0x1de367[0x0][_0x7e50('0x25')]%_0x2c8947:0x0;_0xe96697[_0x7e50('0x18')](function(_0x1b653d){if(_0x1b653d>0x0){_0x1d5e47+=_0x2c8947;}_0x4c9257[_0x7e50('0x16')](dbH['sequelize'][_0x7e50('0x2e')](util[_0x7e50('0x1c')](_0x7e50('0x2f'),QUERY,_0x2c8947,_0x1d5e47),{'type':dbH['sequelize']['QueryTypes'][_0x7e50('0x30')]}));});if(_0x570f57>0x0){_0x1d5e47+=_0x2c8947;_0x4c9257['push'](dbH[_0x7e50('0x31')]['query'](util[_0x7e50('0x1c')](_0x7e50('0x2f'),QUERY,_0x570f57,_0x1d5e47),{'type':dbH[_0x7e50('0x31')][_0x7e50('0x32')][_0x7e50('0x30')]}));}}}else{_0x4c9257['push'](dbH[_0x7e50('0x31')][_0x7e50('0x2e')](QUERY,{'type':dbH[_0x7e50('0x31')]['QueryTypes']['SELECT']}));}var _0x511b06=path['dirname'](PATH);var _0x158fb8=path[_0x7e50('0x33')](PATH,_0x7e50('0x34'));var _0x43ec6b=_0x1693e4[_0x7e50('0x29')]&&_0x4c9257[_0x7e50('0x13')]>0x1;var _0x5a2f1=[];if(!fs[_0x7e50('0x35')](path[_0x7e50('0x36')](_0x511b06,_0x158fb8))&&_0x43ec6b){fs['mkdirSync'](path[_0x7e50('0x36')](_0x511b06,_0x158fb8));}return BPromise[_0x7e50('0x37')](_0x4c9257,function(_0x321a49){_0x5a2f1[_0x7e50('0x16')](_0x321a49);})[_0x7e50('0x2b')](function(){var _0x38597d=[];for(var _0x4cf85f=0x0;_0x4cf85f<_0x5a2f1[_0x7e50('0x13')];_0x4cf85f+=0x1){var _0x4b9ad9=_0x5a2f1[_0x4cf85f];var _0x58462e=createTables(_[_0x7e50('0x38')](_0x4b9ad9));var _0xbc89d;var _0x25d974=getPDFDocDefinition(_0x58462e);var _0x3a517f=getPDFPrinter();var _0x373f41=_0x3a517f[_0x7e50('0x39')](_0x25d974);if(_0x43ec6b){_0xbc89d=path[_0x7e50('0x36')](_0x511b06,_0x158fb8,util[_0x7e50('0x1c')](_0x7e50('0x3a'),_0x158fb8,_0x4cf85f,'pdf'));}else{_0xbc89d=path[_0x7e50('0x36')](_0x511b06,util[_0x7e50('0x1c')](_0x7e50('0x3b'),_0x158fb8,'pdf'));}_0x38597d['push'](writePDFDocument(_0x373f41,_0xbc89d));}return Promise[_0x7e50('0x3c')](_0x38597d);})[_0x7e50('0x2b')](function(){if(_0x43ec6b){return new Promise(function(_0x4368ff){zipdir(path[_0x7e50('0x36')](_0x511b06,_0x158fb8),{'saveTo':path[_0x7e50('0x36')](_0x511b06,util[_0x7e50('0x1c')](_0x7e50('0x3b'),_0x158fb8,_0x7e50('0x3d')))},function(){rimraf(path['join'](_0x511b06,_0x158fb8),function(){});_0x4368ff(_0x7e50('0x3e'));});});}})[_0x7e50('0x2b')](function(){if(!_0x43ec6b)return;rimraf(path[_0x7e50('0x36')](_0x511b06,_0x158fb8),function(){});})[_0x7e50('0x2b')](function(){logger[_0x7e50('0x3f')](util[_0x7e50('0x1c')](_0x7e50('0x40'),EXTRACTED_REPORT_ID,_0x7e50('0x41')));return analyticExtractedReport(_0x7e50('0x42'),_0x43ec6b?util[_0x7e50('0x1c')](_0x7e50('0x3b'),_0x158fb8,_0x43ec6b?_0x7e50('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7e50('0x3f')](util[_0x7e50('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7e50('0x41')));return db[_0x7e50('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7e50('0x2b')](function(_0x5f09c7){EXTRACTED_REPORT=_0x5f09c7;return dbH[_0x7e50('0x31')][_0x7e50('0x2e')](util[_0x7e50('0x1c')](_0x7e50('0x43'),QUERY),{'type':dbH[_0x7e50('0x31')]['QueryTypes'][_0x7e50('0x30')]});})['then'](extractReport)[_0x7e50('0x44')](function(_0x119673){logger[_0x7e50('0x3f')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7e50('0x41')),util[_0x7e50('0x45')](_0x119673,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7e50('0x46'));})[_0x7e50('0x47')](function(){process[_0x7e50('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xcfe086=new PdfPrinter({'Arial':{'normal':__dirname+_0x7e50('0x49'),'bold':__dirname+_0x7e50('0x4a'),'italics':__dirname+_0x7e50('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xcfe086;}function getPDFDocDefinitionFromHTML(_0x9fcacf,_0x47188f){var _0x1d8302=util[_0x7e50('0x1c')](_0x7e50('0x4c'),_0x47188f[_0x7e50('0x4d')],_0x47188f[_0x7e50('0x4e')]);var _0x303a5a=moment()[_0x7e50('0x1c')](_0x7e50('0x4f'))['toString']();var _0x38c1bd=htmlToPdfmake(_0x9fcacf,{'window':window,'tableAutoSize':!![]});return{'content':[_0x38c1bd],'defaultStyle':{'font':_0x7e50('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7e50('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7e50('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7e50('0x50')}},'header':function(){return[{'text':_0x7e50('0x51'),'style':_0x7e50('0x1d')}];},'footer':function(_0x1a0a2a,_0x2f9e64){return[{'text':util['format'](_0x7e50('0x52'),_0x1d8302,_0x1a0a2a,_0x2f9e64,_0x303a5a),'style':_0x7e50('0x22')}];}};}function writePDFDocument(_0x25ef11,_0x2bdf3a){return new Promise(function(_0x378578,_0xa99e20){var _0x3b352d=_0x25ef11['pipe'](fs[_0x7e50('0x53')](_0x2bdf3a));_0x3b352d['on']('finish',function(){_0x378578(_0x7e50('0x54'));});_0x3b352d['on'](_0x7e50('0x55'),function(_0x3af387){_0xa99e20(_0x3af387);});_0x25ef11['end']();});}exports[_0x7e50('0x56')]=function(_0x16f0de,_0x22e4b4){var _0x45c7d3=getPDFPrinter();var _0x8c7006=getPDFDocDefinitionFromHTML(_0x16f0de,_0x22e4b4);var _0x1138fc=_0x45c7d3['createPdfKitDocument'](_0x8c7006);return writePDFDocument(_0x1138fc,_0x22e4b4[_0x7e50('0x2')])['catch'](function(_0x2da85c){throw _0x2da85c;});}; \ No newline at end of file +var _0x4d1c=['pick','toString','value','fill','length','push','body','chunk','keys','forEach','format','name','startDate','endDate','header','before','margin','landscape','\x20/\x20','footer','Arial','Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','end','createPdfFromHTML','path','lodash','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader'];(function(_0x5ed749,_0x495a63){var _0xfa073a=function(_0x367989){while(--_0x367989){_0x5ed749['push'](_0x5ed749['shift']());}};_0xfa073a(++_0x495a63);}(_0x4d1c,0xa4));var _0xc4d1=function(_0x510d1c,_0x342192){_0x510d1c=_0x510d1c-0x0;var _0x1df58c=_0x4d1c[_0x510d1c];return _0x1df58c;};'use strict';var _=require(_0xc4d1('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0xc4d1('0x1'));var htmlToPdfmake=require(_0xc4d1('0x2'));var PdfPrinter=require(_0xc4d1('0x3'));var zipdir=require(_0xc4d1('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xc4d1('0x5'))[_0xc4d1('0x6')];var window=new JSDOM('')[_0xc4d1('0x7')];var BPromise=require(_0xc4d1('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc4d1('0x9'))[_0xc4d1('0xa')];var logger=require(_0xc4d1('0xb'))(_0xc4d1('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xc4d1('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc4d1('0xd')][0x4];var NAME=process[_0xc4d1('0xd')][0x5];var FORMAT=_0xc4d1('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ce21a,_0x3e88f7){var _0xacc810={'status':_0x5ce21a};var _0x209e30={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e88f7){_0xacc810[_0xc4d1('0xf')]=_0x3e88f7;}return db[_0xc4d1('0x10')][_0xc4d1('0x11')](_0xacc810,_0x209e30);}function getHeaders(_0x130ece){return _[_0xc4d1('0x12')](_0x130ece,function(_0x481def){return{'text':_0x481def,'style':_0xc4d1('0x13')};});}function getRows(_0x31d0d8,_0x4779c4){return _['map'](_0x4779c4,function(_0x4cd6db){return _(_0x4cd6db)[_0xc4d1('0x14')](_0x31d0d8)[_0xc4d1('0x12')](function(_0xf87e10){return _0xf87e10?_[_0xc4d1('0x15')](_0xf87e10):'';})[_0xc4d1('0x16')]();});}function createTable(_0x16b3d2,_0x30f69e){var _0x264065={'widths':_[_0xc4d1('0x17')](Array(_0x16b3d2[_0xc4d1('0x18')]),0x91),'heights':function(_0x47dd39){return _0x47dd39===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x46f6d8=getHeaders(_0x16b3d2);_0x264065['body'][_0xc4d1('0x19')](_0x46f6d8);var _0x1e8be1=getRows(_0x16b3d2,_0x30f69e);_0x264065['body']=_0x264065[_0xc4d1('0x1a')]['concat'](_0x1e8be1);return _0x264065;}function createTables(_0x2481b7){var _0x4fd5d2=[];var _0x3222fc=_[_0xc4d1('0x1b')](Object[_0xc4d1('0x1c')](_0x2481b7[0x0]),0x5);_0x3222fc[_0xc4d1('0x1d')](function(_0x479b31){_0x4fd5d2[_0xc4d1('0x19')](createTable(_0x479b31,_0x2481b7));});return _0x4fd5d2;}function getPDFDocDefinition(_0x156549){var _0x226363=util[_0xc4d1('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xc4d1('0x1f')],moment(EXTRACTED_REPORT[_0xc4d1('0x20')])[_0xc4d1('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xc4d1('0x21')])['format'](FORMAT));var _0x59cac6=[];for(var _0x45a5b7=0x0;_0x45a5b7<_0x156549[_0xc4d1('0x18')];_0x45a5b7++){var _0x662c9e=[];if(_0x45a5b7===0x0){_0x662c9e['push']({'text':_0x226363,'style':_0xc4d1('0x22')});}var _0x13a460={'table':_0x156549[_0x45a5b7]};if(_0x45a5b7>0x0){_0x13a460['pageBreak']=_0xc4d1('0x23');_0x13a460[_0xc4d1('0x24')]=[0x0,0x46,0x0,0x0];}_0x662c9e[_0xc4d1('0x19')](_0x13a460);_0x59cac6[_0xc4d1('0x19')](_0x662c9e);}return{'pageSize':'A4','pageOrientation':_0xc4d1('0x25'),'content':_0x59cac6,'footer':function(_0x2aa3b2,_0x146758){return{'text':_0x2aa3b2['toString']()+_0xc4d1('0x26')+_0x146758,'style':_0xc4d1('0x27')};},'defaultStyle':{'font':_0xc4d1('0x28')},'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(_0x254ae8){var _0x529b6c=0x1388;var _0x3f8b9b;if(!_0x254ae8[0x0]['num']){return analyticExtractedReport(_0xc4d1('0x29'));}return db[_0xc4d1('0x2a')][_0xc4d1('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc4d1('0x2c'),_0xc4d1('0x2d')]})[_0xc4d1('0x2e')](function(_0xfea6a0){if(_0xfea6a0){_0x3f8b9b=_0xfea6a0;_0x529b6c=_0x3f8b9b[_0xc4d1('0x2d')]||0x3e8;}})['then'](function(){var _0x5a67b8=[];var _0x14e102=0x0;if(_0x3f8b9b[_0xc4d1('0x2c')]){if(_0x254ae8&&_0x254ae8[_0xc4d1('0x18')]){var _0x582636=_[_0xc4d1('0x2f')](_0x254ae8[0x0][_0xc4d1('0x30')]/_0x529b6c);var _0x3d54e9=Number[_0xc4d1('0x31')](_0x254ae8[0x0][_0xc4d1('0x30')]/_0x529b6c)?_0x254ae8[0x0]['num']%_0x529b6c:0x0;_0x582636['forEach'](function(_0x4dcf6c){if(_0x4dcf6c>0x0){_0x14e102+=_0x529b6c;}_0x5a67b8[_0xc4d1('0x19')](dbH[_0xc4d1('0x32')][_0xc4d1('0x33')](util[_0xc4d1('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x529b6c,_0x14e102),{'type':dbH[_0xc4d1('0x32')][_0xc4d1('0x34')][_0xc4d1('0x35')]}));});if(_0x3d54e9>0x0){_0x14e102+=_0x529b6c;_0x5a67b8['push'](dbH['sequelize'][_0xc4d1('0x33')](util[_0xc4d1('0x1e')](_0xc4d1('0x36'),QUERY,_0x3d54e9,_0x14e102),{'type':dbH['sequelize'][_0xc4d1('0x34')][_0xc4d1('0x35')]}));}}}else{_0x5a67b8[_0xc4d1('0x19')](dbH[_0xc4d1('0x32')][_0xc4d1('0x33')](QUERY,{'type':dbH[_0xc4d1('0x32')]['QueryTypes'][_0xc4d1('0x35')]}));}var _0x5dda3d=path['dirname'](PATH);var _0x4d90f8=path[_0xc4d1('0x37')](PATH,_0xc4d1('0x38'));var _0x1a9533=_0x3f8b9b[_0xc4d1('0x2c')]&&_0x5a67b8[_0xc4d1('0x18')]>0x1;var _0x325a54=[];if(!fs[_0xc4d1('0x39')](path['join'](_0x5dda3d,_0x4d90f8))&&_0x1a9533){fs['mkdirSync'](path[_0xc4d1('0x3a')](_0x5dda3d,_0x4d90f8));}return BPromise[_0xc4d1('0x3b')](_0x5a67b8,function(_0x2185e5){_0x325a54[_0xc4d1('0x19')](_0x2185e5);})[_0xc4d1('0x2e')](function(){var _0x3f6263=[];for(var _0x126734=0x0;_0x126734<_0x325a54['length'];_0x126734+=0x1){var _0x34f98c=_0x325a54[_0x126734];var _0x532eea=createTables(_[_0xc4d1('0x3c')](_0x34f98c));var _0x312be7;var _0x70202a=getPDFDocDefinition(_0x532eea);var _0x287367=getPDFPrinter();var _0xead8c2=_0x287367[_0xc4d1('0x3d')](_0x70202a);if(_0x1a9533){_0x312be7=path[_0xc4d1('0x3a')](_0x5dda3d,_0x4d90f8,util[_0xc4d1('0x1e')](_0xc4d1('0x3e'),_0x4d90f8,_0x126734,_0xc4d1('0x3f')));}else{_0x312be7=path[_0xc4d1('0x3a')](_0x5dda3d,util[_0xc4d1('0x1e')]('%s.%s',_0x4d90f8,'pdf'));}_0x3f6263['push'](writePDFDocument(_0xead8c2,_0x312be7));}return Promise[_0xc4d1('0x40')](_0x3f6263);})[_0xc4d1('0x2e')](function(){if(_0x1a9533){return new Promise(function(_0x1ec571){zipdir(path[_0xc4d1('0x3a')](_0x5dda3d,_0x4d90f8),{'saveTo':path[_0xc4d1('0x3a')](_0x5dda3d,util[_0xc4d1('0x1e')](_0xc4d1('0x41'),_0x4d90f8,_0xc4d1('0x42')))},function(){rimraf(path[_0xc4d1('0x3a')](_0x5dda3d,_0x4d90f8),function(){});_0x1ec571(_0xc4d1('0x43'));});});}})['then'](function(){if(!_0x1a9533)return;rimraf(path[_0xc4d1('0x3a')](_0x5dda3d,_0x4d90f8),function(){});})[_0xc4d1('0x2e')](function(){logger[_0xc4d1('0x44')](util[_0xc4d1('0x1e')](_0xc4d1('0x45'),EXTRACTED_REPORT_ID,_0xc4d1('0x46')));return analyticExtractedReport(_0xc4d1('0x47'),_0x1a9533?util['format']('%s.%s',_0x4d90f8,_0x1a9533?_0xc4d1('0x42'):_0xc4d1('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc4d1('0x44')](util[_0xc4d1('0x1e')](_0xc4d1('0x48'),EXTRACTED_REPORT_ID,_0xc4d1('0x46')));return db[_0xc4d1('0x10')][_0xc4d1('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc4d1('0x2e')](function(_0x36878c){EXTRACTED_REPORT=_0x36878c;return dbH['sequelize']['query'](util['format'](_0xc4d1('0x4a'),QUERY),{'type':dbH[_0xc4d1('0x32')]['QueryTypes'][_0xc4d1('0x35')]});})[_0xc4d1('0x2e')](extractReport)[_0xc4d1('0x4b')](function(_0xe1a7c6){logger[_0xc4d1('0x44')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc4d1('0x46')),util[_0xc4d1('0x4c')](_0xe1a7c6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc4d1('0x4d'));})[_0xc4d1('0x4e')](function(){process[_0xc4d1('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2cb7e8=new PdfPrinter({'Arial':{'normal':__dirname+_0xc4d1('0x50'),'bold':__dirname+_0xc4d1('0x51'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xc4d1('0x52')}});return _0x2cb7e8;}function getPDFDocDefinitionFromHTML(_0x56677e,_0x4411f8){var _0x409cd3=util['format'](_0xc4d1('0x53'),_0x4411f8[_0xc4d1('0x54')],_0x4411f8['interactionId']);var _0xc0417d=moment()[_0xc4d1('0x1e')](_0xc4d1('0x55'))['toString']();var _0x502a79=htmlToPdfmake(_0x56677e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x502a79],'defaultStyle':{'font':_0xc4d1('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc4d1('0x56')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xc4d1('0x22')}];},'footer':function(_0x16d039,_0x1aa037){return[{'text':util[_0xc4d1('0x1e')](_0xc4d1('0x57'),_0x409cd3,_0x16d039,_0x1aa037,_0xc0417d),'style':_0xc4d1('0x27')}];}};}function writePDFDocument(_0x55f309,_0x4c503b){return new Promise(function(_0x4069aa,_0x1ad179){var _0x5716e0=_0x55f309['pipe'](fs['createWriteStream'](_0x4c503b));_0x5716e0['on']('finish',function(){_0x4069aa(_0xc4d1('0x58'));});_0x5716e0['on']('error',function(_0x3d07a5){_0x1ad179(_0x3d07a5);});_0x55f309[_0xc4d1('0x59')]();});}exports[_0xc4d1('0x5a')]=function(_0x364cd5,_0x4e372d){var _0x50b5b1=getPDFPrinter();var _0x24cd50=getPDFDocDefinitionFromHTML(_0x364cd5,_0x4e372d);var _0x1bd65a=_0x50b5b1[_0xc4d1('0x3d')](_0x24cd50);return writePDFDocument(_0x1bd65a,_0x4e372d[_0xc4d1('0x5b')])[_0xc4d1('0x4b')](function(_0x4c16b6){throw _0x4c16b6;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1565b67..9b18686 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 _0x1f05=['join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync'];(function(_0x24e73b,_0x3cd8aa){var _0x4044b4=function(_0x503827){while(--_0x503827){_0x24e73b['push'](_0x24e73b['shift']());}};_0x4044b4(++_0x3cd8aa);}(_0x1f05,0x98));var _0x51f0=function(_0x13896c,_0x4e222a){_0x13896c=_0x13896c-0x0;var _0x3f383c=_0x1f05[_0x13896c];return _0x3f383c;};'use strict';var util=require(_0x51f0('0x0'));var path=require(_0x51f0('0x1'));var _=require(_0x51f0('0x2'));var fs=require('fs');var json2xls=require(_0x51f0('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x51f0('0x4'));var rimraf=require(_0x51f0('0x5'));var db=require(_0x51f0('0x6'))['db'];var dbH=require(_0x51f0('0x6'))[_0x51f0('0x7')];var logger=require(_0x51f0('0x8'))(_0x51f0('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x499353,_0x49f133){var _0x24deb2={'status':_0x499353};var _0x1af9c8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49f133){_0x24deb2[_0x51f0('0xa')]=_0x49f133;}return db['AnalyticExtractedReport'][_0x51f0('0xb')](_0x24deb2,_0x1af9c8);}function main(){var _0x3aaf22=0x1388;var _0x48d81a;logger[_0x51f0('0xc')](util[_0x51f0('0xd')](_0x51f0('0xe'),EXTRACTED_REPORT_ID,_0x51f0('0xf')));return db[_0x51f0('0x10')][_0x51f0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x51f0('0x12'),_0x51f0('0x13')]})[_0x51f0('0x14')](function(_0x812595){if(_0x812595){_0x48d81a=_0x812595;_0x3aaf22=_0x48d81a[_0x51f0('0x13')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x51f0('0x15')](util[_0x51f0('0xd')](_0x51f0('0x16'),QUERY),{'type':dbH[_0x51f0('0x17')]['QueryTypes'][_0x51f0('0x18')]});})[_0x51f0('0x14')](function(_0x412f57){if(!_0x412f57[0x0][_0x51f0('0x19')]){return analyticExtractedReport('Empty');}var _0x49d042=[];var _0x588f68=0x0;if(_0x48d81a[_0x51f0('0x12')]){if(_0x412f57&&_0x412f57[_0x51f0('0x1a')]){var _0x512cf3=_[_0x51f0('0x1b')](_0x412f57[0x0]['num']/_0x3aaf22);var _0x536d7b=Number[_0x51f0('0x1c')](_0x412f57[0x0]['num']/_0x3aaf22)?_0x412f57[0x0][_0x51f0('0x19')]%_0x3aaf22:0x0;_0x512cf3['forEach'](function(_0x30bc52){if(_0x30bc52>0x0){_0x588f68+=_0x3aaf22;}_0x49d042[_0x51f0('0x1d')](dbH[_0x51f0('0x17')][_0x51f0('0x15')](util[_0x51f0('0xd')](_0x51f0('0x1e'),QUERY,_0x3aaf22,_0x588f68),{'type':dbH[_0x51f0('0x17')][_0x51f0('0x1f')]['SELECT']}));});if(_0x536d7b>0x0){_0x588f68+=_0x3aaf22;_0x49d042[_0x51f0('0x1d')](dbH[_0x51f0('0x17')][_0x51f0('0x15')](util['format'](_0x51f0('0x1e'),QUERY,_0x536d7b,_0x588f68),{'type':dbH['sequelize'][_0x51f0('0x1f')][_0x51f0('0x18')]}));}}}else{_0x49d042['push'](dbH[_0x51f0('0x17')]['query'](QUERY,{'type':dbH['sequelize'][_0x51f0('0x1f')]['SELECT']}));}var _0x4a166d=path[_0x51f0('0x20')](PATH);var _0x290a6e=path[_0x51f0('0x21')](PATH,_0x51f0('0x22'));var _0x5b9257=_0x48d81a[_0x51f0('0x12')]&&_0x49d042['length']>0x1;var _0x4c7627=[];if(!fs[_0x51f0('0x23')](path[_0x51f0('0x24')](_0x4a166d,_0x290a6e))&&_0x5b9257){fs[_0x51f0('0x25')](path[_0x51f0('0x24')](_0x4a166d,_0x290a6e));}return BPromise[_0x51f0('0x26')](_0x49d042,function(_0x2343c9){_0x4c7627[_0x51f0('0x1d')](_0x2343c9);})['then'](function(){for(var _0xeebe6a=0x0;_0xeebe6a<_0x4c7627[_0x51f0('0x1a')];_0xeebe6a+=0x1){var _0x18dedf;var _0x31b53a=_0x4c7627[_0xeebe6a];if(_0x5b9257){_0x18dedf=path[_0x51f0('0x24')](_0x4a166d,_0x290a6e,util[_0x51f0('0xd')](_0x51f0('0x27'),_0x290a6e,_0xeebe6a,_0x51f0('0x28')));}else{_0x18dedf=path[_0x51f0('0x24')](_0x4a166d,util[_0x51f0('0xd')](_0x51f0('0x29'),_0x290a6e,_0x51f0('0x28')));}fs['writeFileSync'](_0x18dedf,json2xls(_0x31b53a),_0x51f0('0x2a'));}})[_0x51f0('0x14')](function(){if(_0x5b9257){return new Promise(function(_0x195942){zipdir(path[_0x51f0('0x24')](_0x4a166d,_0x290a6e),{'saveTo':path[_0x51f0('0x24')](_0x4a166d,util['format'](_0x51f0('0x29'),_0x290a6e,_0x51f0('0x2b')))},function(_0x2394e3,_0x3ab784){rimraf(path[_0x51f0('0x24')](_0x4a166d,_0x290a6e),function(){});_0x195942('zip\x20finished');});});}})[_0x51f0('0x14')](function(){logger['info'](util[_0x51f0('0xd')](_0x51f0('0x2c'),EXTRACTED_REPORT_ID,_0x51f0('0xf')));return analyticExtractedReport('Completed',_0x5b9257?util['format']('%s.%s',_0x290a6e,_0x5b9257?_0x51f0('0x2b'):_0x51f0('0x28')):null);});})['catch'](function(_0x3bbdf9){logger[_0x51f0('0xc')](util['format'](_0x51f0('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x3bbdf9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x51f0('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdc9b=['basename','.xlsx','length','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes','SELECT','num','Empty','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x5b89d8,_0x578e77){var _0x4bbbfe=function(_0x59ba4a){while(--_0x59ba4a){_0x5b89d8['push'](_0x5b89d8['shift']());}};_0x4bbbfe(++_0x578e77);}(_0xdc9b,0x70));var _0xbdc9=function(_0x458a1f,_0x5810f3){_0x458a1f=_0x458a1f-0x0;var _0x23a267=_0xdc9b[_0x458a1f];return _0x23a267;};'use strict';var util=require(_0xbdc9('0x0'));var path=require(_0xbdc9('0x1'));var _=require(_0xbdc9('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xbdc9('0x3'));var zipdir=require(_0xbdc9('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xbdc9('0x5'))[_0xbdc9('0x6')];var logger=require('../../config/logger')(_0xbdc9('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xbdc9('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xbdc9('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x597a18,_0x3a3dc9){var _0x15236a={'status':_0x597a18};var _0x3b3cbd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a3dc9){_0x15236a[_0xbdc9('0x9')]=_0x3a3dc9;}return db[_0xbdc9('0xa')][_0xbdc9('0xb')](_0x15236a,_0x3b3cbd);}function main(){var _0x7e6df8=0x1388;var _0x2d1c34;logger[_0xbdc9('0xc')](util[_0xbdc9('0xd')](_0xbdc9('0xe'),EXTRACTED_REPORT_ID,_0xbdc9('0xf')));return db[_0xbdc9('0x10')][_0xbdc9('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbdc9('0x12'),_0xbdc9('0x13')]})[_0xbdc9('0x14')](function(_0x465acf){if(_0x465acf){_0x2d1c34=_0x465acf;_0x7e6df8=_0x2d1c34[_0xbdc9('0x13')]||0x1388;}})[_0xbdc9('0x14')](function(){return dbH[_0xbdc9('0x15')]['query'](util[_0xbdc9('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xbdc9('0x16')][_0xbdc9('0x17')]});})['then'](function(_0x2ace40){if(!_0x2ace40[0x0][_0xbdc9('0x18')]){return analyticExtractedReport(_0xbdc9('0x19'));}var _0x18bd36=[];var _0x46d44d=0x0;if(_0x2d1c34[_0xbdc9('0x12')]){if(_0x2ace40&&_0x2ace40['length']){var _0x5c78df=_[_0xbdc9('0x1a')](_0x2ace40[0x0][_0xbdc9('0x18')]/_0x7e6df8);var _0x32b094=Number['isInteger'](_0x2ace40[0x0]['num']/_0x7e6df8)?_0x2ace40[0x0][_0xbdc9('0x18')]%_0x7e6df8:0x0;_0x5c78df[_0xbdc9('0x1b')](function(_0x595aaa){if(_0x595aaa>0x0){_0x46d44d+=_0x7e6df8;}_0x18bd36[_0xbdc9('0x1c')](dbH[_0xbdc9('0x15')][_0xbdc9('0x1d')](util['format'](_0xbdc9('0x1e'),QUERY,_0x7e6df8,_0x46d44d),{'type':dbH[_0xbdc9('0x15')][_0xbdc9('0x16')][_0xbdc9('0x17')]}));});if(_0x32b094>0x0){_0x46d44d+=_0x7e6df8;_0x18bd36[_0xbdc9('0x1c')](dbH[_0xbdc9('0x15')]['query'](util['format'](_0xbdc9('0x1e'),QUERY,_0x32b094,_0x46d44d),{'type':dbH[_0xbdc9('0x15')][_0xbdc9('0x16')]['SELECT']}));}}}else{_0x18bd36[_0xbdc9('0x1c')](dbH[_0xbdc9('0x15')]['query'](QUERY,{'type':dbH[_0xbdc9('0x15')][_0xbdc9('0x16')][_0xbdc9('0x17')]}));}var _0x23a571=path[_0xbdc9('0x1f')](PATH);var _0x27c6c7=path[_0xbdc9('0x20')](PATH,_0xbdc9('0x21'));var _0x1f085f=_0x2d1c34['split']&&_0x18bd36[_0xbdc9('0x22')]>0x1;var _0x1a1324=[];if(!fs['existsSync'](path[_0xbdc9('0x23')](_0x23a571,_0x27c6c7))&&_0x1f085f){fs[_0xbdc9('0x24')](path[_0xbdc9('0x23')](_0x23a571,_0x27c6c7));}return BPromise[_0xbdc9('0x25')](_0x18bd36,function(_0xbd96bc){_0x1a1324[_0xbdc9('0x1c')](_0xbd96bc);})['then'](function(){for(var _0x1e1397=0x0;_0x1e1397<_0x1a1324[_0xbdc9('0x22')];_0x1e1397+=0x1){var _0x1cb43b;var _0x5338ea=_0x1a1324[_0x1e1397];if(_0x1f085f){_0x1cb43b=path['join'](_0x23a571,_0x27c6c7,util['format'](_0xbdc9('0x26'),_0x27c6c7,_0x1e1397,_0xbdc9('0x27')));}else{_0x1cb43b=path[_0xbdc9('0x23')](_0x23a571,util[_0xbdc9('0xd')](_0xbdc9('0x28'),_0x27c6c7,_0xbdc9('0x27')));}fs['writeFileSync'](_0x1cb43b,json2xls(_0x5338ea),_0xbdc9('0x29'));}})[_0xbdc9('0x14')](function(){if(_0x1f085f){return new Promise(function(_0x10eee2){zipdir(path[_0xbdc9('0x23')](_0x23a571,_0x27c6c7),{'saveTo':path['join'](_0x23a571,util[_0xbdc9('0xd')](_0xbdc9('0x28'),_0x27c6c7,_0xbdc9('0x2a')))},function(_0x309589,_0x1b572d){rimraf(path['join'](_0x23a571,_0x27c6c7),function(){});_0x10eee2(_0xbdc9('0x2b'));});});}})['then'](function(){logger[_0xbdc9('0xc')](util[_0xbdc9('0xd')](_0xbdc9('0x2c'),EXTRACTED_REPORT_ID,_0xbdc9('0xf')));return analyticExtractedReport(_0xbdc9('0x2d'),_0x1f085f?util[_0xbdc9('0xd')](_0xbdc9('0x28'),_0x27c6c7,_0x1f085f?_0xbdc9('0x2a'):_0xbdc9('0x27')):null);});})['catch'](function(_0xa97b2a){logger[_0xbdc9('0xc')](util['format'](_0xbdc9('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0xa97b2a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xbdc9('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index fbc7155..3bb2c08 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 _0x1218=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','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','destroy','bulkCreate','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','push','type','Set','format','CDR(type)=%s','context','extensions','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto('];(function(_0x50c599,_0x21de75){var _0x245ca1=function(_0x3a1de8){while(--_0x3a1de8){_0x50c599['push'](_0x50c599['shift']());}};_0x245ca1(++_0x21de75);}(_0x1218,0x70));var _0x8121=function(_0x5ecec0,_0x3ddd48){_0x5ecec0=_0x5ecec0-0x0;var _0x17a807=_0x1218[_0x5ecec0];return _0x17a807;};'use strict';var _=require(_0x8121('0x0'));var util=require('util');function rewrite(_0x26398a,_0x43298a){var _0x4072ea=this;return _0x26398a[_0x8121('0x1')][_0x8121('0x2')][_0x8121('0x3')]({'raw':!![]})[_0x8121('0x4')](function(_0x12d3f3){_0x4072ea['intervals']=_0x12d3f3;return _0x26398a[_0x8121('0x1')]['VoiceExtension'][_0x8121('0x3')]({'where':{'IntervalId':_0x43298a[_0x8121('0x5')]},'raw':!![]});})[_0x8121('0x4')](function(_0x4e430e){return _0x26398a['models'][_0x8121('0x6')][_0x8121('0x3')]({'where':{'exten':{'$in':_[_0x8121('0x7')](_[_0x8121('0x8')](_0x4e430e,_0x8121('0x9')))}},'order':[{'raw':_0x8121('0xa')}],'raw':!![]});})[_0x8121('0x4')](function(_0x101ea8){var _0x27780e=_[_0x8121('0xb')](_0x101ea8,{'priority':'1'});var _0x1c725d=_['filter'](_0x101ea8,{'isApp':0x1});var _0x53f058=_[_0x8121('0xc')](_0x1c725d,_0x8121('0x9'));var _0x112d77=[_0x8121('0xd'),_0x8121('0xe')];var _0x5f73f=[];var _0x10f36a=[];for(var _0x2143bc in _0x53f058){if(_0x53f058['hasOwnProperty'](_0x2143bc)){_0x4072ea[_0x8121('0xf')]=0x2;_0x4072ea['extensions']=[];_0x4072ea[_0x8121('0x10')]=_[_0x8121('0x11')](_0x27780e,{'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')]});_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':util[_0x8121('0x15')](_0x8121('0x16'),_0x53f058[_0x2143bc][0x0][_0x8121('0x13')]),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});if(_0x53f058[_0x2143bc][0x0][_0x8121('0x13')]==='inbound'){_0x4072ea[_0x8121('0x18')][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':_0x8121('0x19')+_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')],'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});}else if(_0x53f058[_0x2143bc][0x0][_0x8121('0x13')]===_0x8121('0x1b')){if(_0x4072ea[_0x8121('0x10')]){_0x4072ea[_0x8121('0x18')][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':'Set','appdata':_0x8121('0x1c')+(_0x4072ea[_0x8121('0x10')][_0x8121('0x1d')]?_0x8121('0x1e')+_0x4072ea[_0x8121('0x10')][_0x8121('0x1d')]+'}':_0x8121('0x1f')),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});}_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0]['type'],'app':_0x8121('0x14'),'appdata':'CDR(routeid)='+_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')],'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0]['exten'],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});var _0x7d47b1=_0x4072ea['priority']++;_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x7d47b1+0x2)+_0x8121('0x21')+(_0x7d47b1+0x1)+')','context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0]['exten'],'priority':_0x7d47b1,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});if(_0x4072ea['extension']){_0x4072ea[_0x8121('0x18')]['push']({'type':_0x53f058[_0x2143bc][0x0]['type'],'app':_0x8121('0x14'),'appdata':_0x4072ea[_0x8121('0x10')][_0x8121('0x1d')]?_0x8121('0x22')+_0x4072ea[_0x8121('0x10')][_0x8121('0x1d')]+'}':_0x8121('0x23'),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});}_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':'outboundrouteid='+_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')],'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});if(_0x4072ea[_0x8121('0x10')]&&_0x4072ea['extension'][_0x8121('0x24')](_0x8121('0x25'))&&_0x4072ea[_0x8121('0x10')][_0x8121('0x25')]!==_0x8121('0x26')){_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':'Set','appdata':_0x8121('0x27'),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0]['exten'],'priority':_0x4072ea['priority']++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});_0x4072ea[_0x8121('0x18')]['push']({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':_0x8121('0x28')+_0x4072ea[_0x8121('0x10')][_0x8121('0x25')]||'wav','context':_0x53f058[_0x2143bc][0x0]['context'],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});}}_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':_0x8121('0x29'),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});_0x4072ea[_0x8121('0x18')]['push']({'type':_0x53f058[_0x2143bc][0x0][_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x53f058[_0x2143bc][0x0]['context'],'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'priority':_0x4072ea[_0x8121('0xf')]++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0]['VoiceExtensionId']});_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0]['type'],'app':_0x8121('0x14'),'appdata':_0x8121('0x2a'),'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'exten':_0x53f058[_0x2143bc][0x0]['exten'],'priority':_0x4072ea['priority']++,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});for(var _0x410f6f=0x0,_0x44a58d=0x0;_0x410f6f<_0x53f058[_0x2143bc][_0x8121('0x2b')];_0x410f6f+=0x1,_0x44a58d=0x0){var _0x338a5f=_0x53f058[_0x2143bc][_0x410f6f];if(_0x338a5f[_0x8121('0x13')]){_0x338a5f[_0x8121('0x13')]=_0x338a5f[_0x8121('0x13')]['toLowerCase']();}var _0x5bb649=[];var _0x440767=[];delete _0x338a5f['id'];delete _0x338a5f[_0x8121('0x2c')];delete _0x338a5f[_0x8121('0x2d')];var _0x4a44a1=_0x338a5f[_0x8121('0x2e')]!==_0x8121('0x2f')?[_0x338a5f[_0x8121('0x2e')]]:_0x338a5f[_0x8121('0x5')]?_[_0x8121('0x8')](_[_0x8121('0xb')](_0x4072ea[_0x8121('0x30')],{'IntervalId':_0x338a5f[_0x8121('0x5')]}),_0x8121('0x2e')):[];if(_0x338a5f[_0x8121('0x24')](_0x8121('0x31'))){if(_0x338a5f['tag']&&_0x338a5f[_0x8121('0x31')]!=='--'){_0x5bb649['push']({'type':_0x338a5f[_0x8121('0x13')],'app':_0x8121('0x14'),'appdata':_0x8121('0x32')+_0x338a5f[_0x8121('0x31')],'context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f[_0x8121('0x9')],'priority':_0x4a44a1[_0x8121('0x2b')]+_0x4072ea['priority']+_0x44a58d++,'VoiceExtensionId':_0x338a5f[_0x8121('0x1a')]});}}if(_0x338a5f[_0x8121('0x13')]===_0x8121('0x1b')&&_0x338a5f[_0x8121('0x24')](_0x8121('0x33'))){if(_0x338a5f[_0x8121('0x33')]){_0x5bb649['push']({'type':_0x338a5f['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x338a5f[_0x8121('0x33')]+')','context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f['exten'],'priority':_0x4a44a1[_0x8121('0x2b')]+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f[_0x8121('0x1a')]});}else{_0x5bb649[_0x8121('0x12')]({'type':_0x338a5f[_0x8121('0x13')],'app':'ExecIf','appdata':_0x8121('0x34'),'context':_0x338a5f['context'],'exten':_0x338a5f['exten'],'priority':_0x4a44a1[_0x8121('0x2b')]+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f[_0x8121('0x1a')]});}}if(_0x338a5f[_0x8121('0x24')](_0x8121('0x35'))){if(_0x112d77['indexOf'](_0x338a5f[_0x8121('0x36')][_0x8121('0x37')]())>=0x0&&_0x338a5f[_0x8121('0x38')]!==_0x8121('0x39')){if(_0x338a5f[_0x8121('0x35')]){_0x5bb649['push']({'type':_0x338a5f[_0x8121('0x13')],'app':_0x8121('0x20'),'appdata':_0x8121('0x3a'),'context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f[_0x8121('0x9')],'priority':_0x4a44a1['length']+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f['VoiceExtensionId']});_0x5bb649[_0x8121('0x12')]({'type':_0x338a5f[_0x8121('0x13')],'app':'Set','appdata':_0x8121('0x3b'),'context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f[_0x8121('0x9')],'priority':_0x4a44a1[_0x8121('0x2b')]+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f[_0x8121('0x1a')]});}else{_0x5bb649[_0x8121('0x12')]({'type':_0x338a5f[_0x8121('0x13')],'app':_0x8121('0x20'),'appdata':_0x8121('0x3c'),'context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f[_0x8121('0x9')],'priority':_0x4a44a1[_0x8121('0x2b')]+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f[_0x8121('0x1a')]});_0x5bb649[_0x8121('0x12')]({'type':_0x338a5f['type'],'app':_0x8121('0x14'),'appdata':_0x8121('0x3d'),'context':_0x338a5f[_0x8121('0x17')],'exten':_0x338a5f['exten'],'priority':_0x4a44a1['length']+_0x4072ea[_0x8121('0xf')]+_0x44a58d++,'VoiceExtensionId':_0x338a5f['VoiceExtensionId']});}}}for(var _0x3bc748=0x0;_0x3bc748<_0x4a44a1[_0x8121('0x2b')];_0x3bc748+=0x1){var _0x3dc831=_0x4072ea[_0x8121('0xf')]+_0x4a44a1[_0x8121('0x2b')];var _0x10f6a6=_0x3bc748===_0x4a44a1['length']-0x1?_0x4072ea['priority']+_0x5bb649['length']+_0x440767[_0x8121('0x2b')]+0x2:_0x4072ea['priority']+_0x3bc748+0x1;_0x5bb649[_0x8121('0x3e')](_0x3bc748,0x0,{'type':_0x338a5f[_0x8121('0x13')],'app':_0x8121('0x3f'),'appdata':_0x4a44a1[_0x3bc748]+'?'+_0x338a5f[_0x8121('0x17')]+_0x8121('0x40')+_0x3dc831+':'+_0x338a5f[_0x8121('0x17')]+_0x8121('0x40')+_0x10f6a6,'exten':_0x338a5f[_0x8121('0x9')],'context':_0x338a5f[_0x8121('0x17')],'priority':_0x4072ea[_0x8121('0xf')]+_0x3bc748,'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});}_0x338a5f[_0x8121('0xf')]=_0x5bb649['length']?_[_0x8121('0x41')](_0x5bb649)[_0x8121('0xf')]+0x1:_0x4072ea[_0x8121('0xf')];_0x4072ea[_0x8121('0xf')]=(_0x440767[_0x8121('0x2b')]?_['last'](_0x440767)['priority']:_0x338a5f['priority'])+0x1;_0x4072ea[_0x8121('0x18')]=_[_0x8121('0x42')](_0x4072ea[_0x8121('0x18')],_0x5bb649,[_0x338a5f],_0x440767);}_0x4072ea['extensions'][_0x8121('0x12')]({'type':_0x53f058[_0x2143bc][0x0]['type'],'app':_0x8121('0x43'),'exten':_0x53f058[_0x2143bc][0x0][_0x8121('0x9')],'context':_0x53f058[_0x2143bc][0x0][_0x8121('0x17')],'priority':_0x4072ea[_0x8121('0xf')],'VoiceExtensionId':_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]});_0x5f73f['push'](_0x53f058[_0x2143bc][0x0][_0x8121('0x1a')]);_0x10f36a=_[_0x8121('0x42')](_0x10f36a,_0x4072ea['extensions']);}}return _0x26398a['transaction'](function(_0x1aa477){return _0x26398a[_0x8121('0x1')][_0x8121('0x6')][_0x8121('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x5f73f}},'transaction':_0x1aa477})[_0x8121('0x4')](function(_0x1b08a4){return _0x26398a[_0x8121('0x1')][_0x8121('0x6')][_0x8121('0x45')](_[_0x8121('0x46')](_0x10f36a,_0x8121('0xf')),{'transaction':_0x1aa477});});});})[_0x8121('0x47')](function(_0x2bd052){console['error'](_0x2bd052);});}exports[_0x8121('0x48')]=rewrite; \ No newline at end of file +var _0xe307=['hasOwnProperty','priority','extension','find','extensions','Set','format','CDR(type)=%s','type','VoiceExtensionId','inbound','push','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','intervals','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','util','models','Interval','findAll','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','exten','queue'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xe307,0x10a));var _0x7e30=function(_0x3548b7,_0x462673){_0x3548b7=_0x3548b7-0x0;var _0x2d80e6=_0xe307[_0x3548b7];return _0x2d80e6;};'use strict';var _=require('lodash');var util=require(_0x7e30('0x0'));function rewrite(_0x2d3676,_0x3686e5){var _0x1a1606=this;return _0x2d3676[_0x7e30('0x1')][_0x7e30('0x2')][_0x7e30('0x3')]({'raw':!![]})['then'](function(_0x5441f5){_0x1a1606['intervals']=_0x5441f5;return _0x2d3676[_0x7e30('0x1')]['VoiceExtension'][_0x7e30('0x3')]({'where':{'IntervalId':_0x3686e5[_0x7e30('0x4')]},'raw':!![]});})['then'](function(_0xf9c4da){return _0x2d3676[_0x7e30('0x1')][_0x7e30('0x5')][_0x7e30('0x3')]({'where':{'exten':{'$in':_[_0x7e30('0x6')](_[_0x7e30('0x7')](_0xf9c4da,'exten'))}},'order':[{'raw':_0x7e30('0x8')}],'raw':!![]});})[_0x7e30('0x9')](function(_0x3dd423){var _0x345106=_[_0x7e30('0xa')](_0x3dd423,{'priority':'1'});var _0x207400=_[_0x7e30('0xa')](_0x3dd423,{'isApp':0x1});var _0x30a308=_[_0x7e30('0xb')](_0x207400,_0x7e30('0xc'));var _0xd4417b=[_0x7e30('0xd'),'playback'];var _0x37d311=[];var _0x4acb2f=[];for(var _0x25ab27 in _0x30a308){if(_0x30a308[_0x7e30('0xe')](_0x25ab27)){_0x1a1606[_0x7e30('0xf')]=0x2;_0x1a1606['extensions']=[];_0x1a1606[_0x7e30('0x10')]=_[_0x7e30('0x11')](_0x345106,{'exten':_0x30a308[_0x25ab27][0x0]['exten']});_0x1a1606[_0x7e30('0x12')]['push']({'type':_0x30a308[_0x25ab27][0x0]['type'],'app':_0x7e30('0x13'),'appdata':util[_0x7e30('0x14')](_0x7e30('0x15'),_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')]),'context':_0x30a308[_0x25ab27][0x0]['context'],'exten':_0x30a308[_0x25ab27][0x0]['exten'],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});if(_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')]===_0x7e30('0x18')){_0x1a1606['extensions'][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':'Set','appdata':'CDR(routeid)='+_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')],'context':_0x30a308[_0x25ab27][0x0]['context'],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});}else if(_0x30a308[_0x25ab27][0x0]['type']===_0x7e30('0x1a')){if(_0x1a1606[_0x7e30('0x10')]){_0x1a1606[_0x7e30('0x12')]['push']({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x1b')+(_0x1a1606[_0x7e30('0x10')]['cutdigits']?_0x7e30('0x1c')+_0x1a1606['extension']['cutdigits']+'}':_0x7e30('0x1d')),'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0]['exten'],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});}_0x1a1606[_0x7e30('0x12')]['push']({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':'CDR(routeid)='+_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')],'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0]['VoiceExtensionId']});var _0x3b9db1=_0x1a1606[_0x7e30('0xf')]++;_0x1a1606[_0x7e30('0x12')][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x1f'),'appdata':_0x7e30('0x20')+(_0x3b9db1+0x2)+_0x7e30('0x21')+(_0x3b9db1+0x1)+')','context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x3b9db1,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});if(_0x1a1606[_0x7e30('0x10')]){_0x1a1606[_0x7e30('0x12')][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':_0x1a1606['extension'][_0x7e30('0x22')]?'CDR(prefix)=${EXTEN:0:'+_0x1a1606[_0x7e30('0x10')][_0x7e30('0x22')]+'}':'CDR(prefix)=noprefix','context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});}_0x1a1606[_0x7e30('0x12')]['push']({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x23')+_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')],'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});if(_0x1a1606[_0x7e30('0x10')]&&_0x1a1606['extension'][_0x7e30('0xe')](_0x7e30('0x24'))&&_0x1a1606[_0x7e30('0x10')][_0x7e30('0x24')]!==_0x7e30('0x25')){_0x1a1606[_0x7e30('0x12')][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x26'),'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});_0x1a1606['extensions']['push']({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1a1606[_0x7e30('0x10')]['recordingFormat']||_0x7e30('0x27'),'context':_0x30a308[_0x25ab27][0x0]['context'],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});}}_0x1a1606[_0x7e30('0x12')][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0]['type'],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x28'),'context':_0x30a308[_0x25ab27][0x0]['context'],'exten':_0x30a308[_0x25ab27][0x0]['exten'],'priority':_0x1a1606[_0x7e30('0xf')]++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});_0x1a1606['extensions'][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0]['exten'],'priority':_0x1a1606['priority']++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0]['VoiceExtensionId']});_0x1a1606['extensions']['push']({'type':_0x30a308[_0x25ab27][0x0]['type'],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x29'),'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'priority':_0x1a1606['priority']++,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});for(var _0x5d7a29=0x0,_0x41469c=0x0;_0x5d7a29<_0x30a308[_0x25ab27][_0x7e30('0x2a')];_0x5d7a29+=0x1,_0x41469c=0x0){var _0x5a2ef4=_0x30a308[_0x25ab27][_0x5d7a29];if(_0x5a2ef4[_0x7e30('0x16')]){_0x5a2ef4[_0x7e30('0x16')]=_0x5a2ef4['type'][_0x7e30('0x2b')]();}var _0x4bd9f1=[];var _0x3f7239=[];delete _0x5a2ef4['id'];delete _0x5a2ef4[_0x7e30('0x2c')];delete _0x5a2ef4[_0x7e30('0x2d')];var _0x300820=_0x5a2ef4[_0x7e30('0x2e')]!=='*,*,*,*'?[_0x5a2ef4[_0x7e30('0x2e')]]:_0x5a2ef4[_0x7e30('0x4')]?_[_0x7e30('0x7')](_[_0x7e30('0xa')](_0x1a1606[_0x7e30('0x2f')],{'IntervalId':_0x5a2ef4[_0x7e30('0x4')]}),_0x7e30('0x2e')):[];if(_0x5a2ef4['hasOwnProperty']('tag')){if(_0x5a2ef4[_0x7e30('0x30')]&&_0x5a2ef4[_0x7e30('0x30')]!=='--'){_0x4bd9f1['push']({'type':_0x5a2ef4['type'],'app':_0x7e30('0x13'),'appdata':'CDR(tag)='+_0x5a2ef4['tag'],'context':_0x5a2ef4[_0x7e30('0x1e')],'exten':_0x5a2ef4[_0x7e30('0xc')],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606[_0x7e30('0xf')]+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});}}if(_0x5a2ef4['type']===_0x7e30('0x1a')&&_0x5a2ef4[_0x7e30('0xe')]('callerID')){if(_0x5a2ef4[_0x7e30('0x31')]){_0x4bd9f1[_0x7e30('0x19')]({'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x1f'),'appdata':_0x7e30('0x32')+_0x5a2ef4['callerID']+')','context':_0x5a2ef4[_0x7e30('0x1e')],'exten':_0x5a2ef4[_0x7e30('0xc')],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606[_0x7e30('0xf')]+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});}else{_0x4bd9f1[_0x7e30('0x19')]({'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x1f'),'appdata':_0x7e30('0x33'),'context':_0x5a2ef4[_0x7e30('0x1e')],'exten':_0x5a2ef4['exten'],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606['priority']+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});}}if(_0x5a2ef4[_0x7e30('0xe')](_0x7e30('0x34'))){if(_0xd4417b['indexOf'](_0x5a2ef4[_0x7e30('0x35')][_0x7e30('0x2b')]())>=0x0&&_0x5a2ef4[_0x7e30('0x36')]!==_0x7e30('0x37')){if(_0x5a2ef4['answer']){_0x4bd9f1[_0x7e30('0x19')]({'type':_0x5a2ef4['type'],'app':'ExecIf','appdata':_0x7e30('0x38'),'context':_0x5a2ef4['context'],'exten':_0x5a2ef4[_0x7e30('0xc')],'priority':_0x300820['length']+_0x1a1606['priority']+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});_0x4bd9f1[_0x7e30('0x19')]({'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5a2ef4[_0x7e30('0x1e')],'exten':_0x5a2ef4[_0x7e30('0xc')],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606['priority']+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});}else{_0x4bd9f1['push']({'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x1f'),'appdata':_0x7e30('0x39'),'context':_0x5a2ef4['context'],'exten':_0x5a2ef4['exten'],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606[_0x7e30('0xf')]+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});_0x4bd9f1['push']({'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x13'),'appdata':_0x7e30('0x3a'),'context':_0x5a2ef4[_0x7e30('0x1e')],'exten':_0x5a2ef4[_0x7e30('0xc')],'priority':_0x300820[_0x7e30('0x2a')]+_0x1a1606[_0x7e30('0xf')]+_0x41469c++,'VoiceExtensionId':_0x5a2ef4[_0x7e30('0x17')]});}}}for(var _0x59741e=0x0;_0x59741e<_0x300820['length'];_0x59741e+=0x1){var _0x3c5eaa=_0x1a1606[_0x7e30('0xf')]+_0x300820[_0x7e30('0x2a')];var _0x855d4f=_0x59741e===_0x300820['length']-0x1?_0x1a1606['priority']+_0x4bd9f1[_0x7e30('0x2a')]+_0x3f7239[_0x7e30('0x2a')]+0x2:_0x1a1606[_0x7e30('0xf')]+_0x59741e+0x1;_0x4bd9f1[_0x7e30('0x3b')](_0x59741e,0x0,{'type':_0x5a2ef4[_0x7e30('0x16')],'app':_0x7e30('0x3c'),'appdata':_0x300820[_0x59741e]+'?'+_0x5a2ef4[_0x7e30('0x1e')]+_0x7e30('0x3d')+_0x3c5eaa+':'+_0x5a2ef4[_0x7e30('0x1e')]+_0x7e30('0x3d')+_0x855d4f,'exten':_0x5a2ef4[_0x7e30('0xc')],'context':_0x5a2ef4['context'],'priority':_0x1a1606['priority']+_0x59741e,'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});}_0x5a2ef4[_0x7e30('0xf')]=_0x4bd9f1[_0x7e30('0x2a')]?_[_0x7e30('0x3e')](_0x4bd9f1)['priority']+0x1:_0x1a1606['priority'];_0x1a1606['priority']=(_0x3f7239['length']?_[_0x7e30('0x3e')](_0x3f7239)[_0x7e30('0xf')]:_0x5a2ef4[_0x7e30('0xf')])+0x1;_0x1a1606['extensions']=_['concat'](_0x1a1606[_0x7e30('0x12')],_0x4bd9f1,[_0x5a2ef4],_0x3f7239);}_0x1a1606[_0x7e30('0x12')][_0x7e30('0x19')]({'type':_0x30a308[_0x25ab27][0x0][_0x7e30('0x16')],'app':_0x7e30('0x3f'),'exten':_0x30a308[_0x25ab27][0x0][_0x7e30('0xc')],'context':_0x30a308[_0x25ab27][0x0][_0x7e30('0x1e')],'priority':_0x1a1606[_0x7e30('0xf')],'VoiceExtensionId':_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]});_0x37d311[_0x7e30('0x19')](_0x30a308[_0x25ab27][0x0][_0x7e30('0x17')]);_0x4acb2f=_[_0x7e30('0x40')](_0x4acb2f,_0x1a1606[_0x7e30('0x12')]);}}return _0x2d3676[_0x7e30('0x41')](function(_0x36c058){return _0x2d3676[_0x7e30('0x1')][_0x7e30('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x37d311}},'transaction':_0x36c058})[_0x7e30('0x9')](function(_0x2620ad){return _0x2d3676[_0x7e30('0x1')][_0x7e30('0x5')][_0x7e30('0x42')](_[_0x7e30('0x43')](_0x4acb2f,_0x7e30('0xf')),{'transaction':_0x36c058});});});})[_0x7e30('0x44')](function(_0x179553){console[_0x7e30('0x45')](_0x179553);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1c38536..7335775 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 _0xcbe3=['The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','length','find','duplicate','CmContact','create','keys','then','catch','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','phone','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','where','\x20=\x20?','calleridnum','insert','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','VoiceQueueId','onlyIfOpen','sequelize','query','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','../../../config/environment','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil'];(function(_0x73f6cf,_0x3d4206){var _0x5d7de2=function(_0x31eaad){while(--_0x31eaad){_0x73f6cf['push'](_0x73f6cf['shift']());}};_0x5d7de2(++_0x3d4206);}(_0xcbe3,0x121));var _0x3cbe=function(_0x5708b3,_0x56b26c){_0x5708b3=_0x5708b3-0x0;var _0x7d5bd5=_0xcbe3[_0x5708b3];return _0x7d5bd5;};'use strict';var BPromise=require(_0x3cbe('0x0'));var util=require(_0x3cbe('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x3cbe('0x2'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x3cbe('0x3'));var logger=require('../../../config/logger')('api');config[_0x3cbe('0x4')]=_[_0x3cbe('0x5')](config[_0x3cbe('0x4')],{'host':_0x3cbe('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3cbe('0x4')]));require(_0x3cbe('0x7'))[_0x3cbe('0x8')](socket);try{if(!process['argv'][0x2]||process[_0x3cbe('0x9')][0x2]===_0x3cbe('0xa')||process[_0x3cbe('0x9')][0x2]===_0x3cbe('0xb')){throw new Error(_0x3cbe('0xc'));}var FILEPATH=process[_0x3cbe('0x9')][0x2];if(!process[_0x3cbe('0x9')][0x3]||process[_0x3cbe('0x9')][0x3]===_0x3cbe('0xa')||process['argv'][0x3]===_0x3cbe('0xb')||!process[_0x3cbe('0x9')][0x4]||process[_0x3cbe('0x9')][0x4]===_0x3cbe('0xa')||process[_0x3cbe('0x9')][0x4]==='null'){throw new Error(_0x3cbe('0xd'));}var FIELDS=_[_0x3cbe('0xe')](process['argv'][0x3][_0x3cbe('0xf')](','),process[_0x3cbe('0x9')][0x4][_0x3cbe('0xf')](','));if(!process[_0x3cbe('0x9')][0x5]||process[_0x3cbe('0x9')][0x5]===_0x3cbe('0xa')||process[_0x3cbe('0x9')][0x5]===_0x3cbe('0xb')){throw new Error(_0x3cbe('0x10'));}var LISTID=process[_0x3cbe('0x9')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3cbe('0x9')][0x6]!==_0x3cbe('0xa')&&process[_0x3cbe('0x9')][0x6]!==_0x3cbe('0xb')?process['argv'][0x6]:null;var DUPLICATES=process[_0x3cbe('0x9')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x3cbe('0x9')][0x7]!==_0x3cbe('0xb')?process[_0x3cbe('0x9')][0x7]:null;if(!process[_0x3cbe('0x9')][0x8]||process[_0x3cbe('0x9')][0x8]==='undefined'||process[_0x3cbe('0x9')][0x8]===_0x3cbe('0xb')){throw new Error(_0x3cbe('0x11'));}var SOCKET_TIMESTAMP=process[_0x3cbe('0x9')][0x8];}catch(_0x40eac6){logger[_0x3cbe('0x12')](_0x40eac6);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(_0x5d3af9,_0x6b48,_0xc66829,_0x19a52d){var _0x1b4194={'message':_0x6b48};_0x1b4194[_0x5d3af9]=!![];if(_0xc66829){_0x1b4194[_0x3cbe('0x13')]=_0xc66829;}if(_0x19a52d){_0x1b4194[_0x3cbe('0x14')]=_0x19a52d;}return _0x1b4194;}function isEmail(_0x43785d){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))*$/[_0x3cbe('0x15')](_0x43785d);}function checkRow(_0x50c0bd,_0x3f38dd,_0x1d7fec){return new BPromise(function(_0x52205d,_0x449cac){if(_[_0x3cbe('0x16')](_0x50c0bd)){return _0x449cac(handleCheckRowError('error',_0x3cbe('0x17'),null,_0x1d7fec));}if(_0x50c0bd[_0x3cbe('0x18')]&&_0x50c0bd[_0x3cbe('0x18')]['length']){var _0xb951a3=_[_0x3cbe('0x19')](_0x50c0bd[_0x3cbe('0x18')],_0x3cbe('0x1a'))[_0x3cbe('0x1b')](';');return _0x449cac(handleCheckRowError(_0x3cbe('0x12'),_0xb951a3,null,_0x1d7fec));}var _0x3b25ed={};for(var _0x15f23a in FIELDS){if(FIELDS[_0x3cbe('0x1c')](_0x15f23a)&&FIELDS[_0x15f23a]){_0x3b25ed[_0x15f23a]=_0x50c0bd['data'][0x0][FIELDS[_0x15f23a]]||_0x50c0bd['data'][0x0]['\ufeff'+FIELDS[_0x15f23a]];}}if(!_0x3b25ed['firstName']){return _0x449cac(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x1d7fec));}if(!_0x3b25ed['phone']){return _0x449cac(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x1d7fec));}if(_0x3b25ed['birthDate']){var _0x391afa=moment(_0x3b25ed[_0x3cbe('0x1d')],_0x3cbe('0x1e'));if(!_0x391afa[_0x3cbe('0x1f')]()){return _0x449cac(handleCheckRowError(_0x3cbe('0x12'),_0x3cbe('0x20'),null,_0x1d7fec));}}if(_0x3b25ed['email']){if(!isEmail(_0x3b25ed['email'])){return _0x449cac(handleCheckRowError(_0x3cbe('0x12'),_0x3cbe('0x21'),null,_0x1d7fec));}}_0x3b25ed['ListId']=LISTID;_0x3b25ed['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3cbe('0x22')]&&_0x3f38dd){var _0x29f773={};for(var _0x52ed61=0x0,_0x55ed9b=DUPLICATES[_0x3cbe('0x22')];_0x52ed61<_0x55ed9b;_0x52ed61+=0x1){_0x29f773[DUPLICATES[_0x52ed61]]=_0x3b25ed[DUPLICATES[_0x52ed61]];}var _0x3a8422=_[_0x3cbe('0x23')](_0x3f38dd,_0x29f773);if(_0x3a8422){return _0x449cac(handleCheckRowError(_0x3cbe('0x24'),'Duplicate\x20Contact',_0x3a8422,_0x1d7fec));}}return db[_0x3cbe('0x25')][_0x3cbe('0x26')](_0x3b25ed,{'raw':!![],'hooks':![],'fields':_[_0x3cbe('0x27')](_0x3b25ed)})[_0x3cbe('0x28')](function(_0x51fcf8){if(DUPLICATES&&DUPLICATES[_0x3cbe('0x22')]&&_0x3f38dd){_0x3f38dd['push'](_['pick'](_0x3b25ed,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x51fcf8['id'];return _0x52205d();})[_0x3cbe('0x29')](function(_0x3aef3c){return _0x449cac(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x3aef3c[_0x3cbe('0x1a')]||JSON['stringify'](_0x3aef3c)),null,_0x1d7fec));});});}function checkHopper(){function _0x463442(){return function(_0x4b821f){logger[_0x3cbe('0x12')](_0x3cbe('0x2a'),_0x3cbe('0x2b'),util[_0x3cbe('0x2c')](_0x4b821f,{'showHidden':![],'depth':null}));};}var _0x284002=function(_0x566f46,_0x576b34){var _0xb4b3d8=squel['insert']()[_0x3cbe('0x2d')](_0x3cbe('0x2e'))[_0x3cbe('0x2f')](['phone',_0x3cbe('0x30'),_0x3cbe('0x31'),_0x3cbe('0x32'),_0x576b34,_0x3cbe('0x33'),_0x3cbe('0x34')],squel[_0x3cbe('0x35')]()[_0x3cbe('0x36')](_0x3cbe('0x37'),_0x3cbe('0x37'))[_0x3cbe('0x36')]('NOW()','scheduledAt')[_0x3cbe('0x36')]('id',_0x3cbe('0x31'))[_0x3cbe('0x36')](LISTID[_0x3cbe('0x38')](),_0x3cbe('0x32'))[_0x3cbe('0x36')](_0x566f46['id']['toString'](),_0x576b34)[_0x3cbe('0x36')]('NOW()',_0x3cbe('0x33'))[_0x3cbe('0x36')](_0x3cbe('0x39'),_0x3cbe('0x34'))[_0x3cbe('0x3a')](_0x3cbe('0x3b'))['where'](_0x3cbe('0x3c'))['where'](_0x3cbe('0x3d'),LISTID[_0x3cbe('0x38')]())['where'](_0x3cbe('0x3e'))['where'](_0x3cbe('0x3f'),squel['select']()[_0x3cbe('0x36')](_0x3cbe('0x37'))[_0x3cbe('0x3a')]('cm_hopper')[_0x3cbe('0x40')](_0x576b34+_0x3cbe('0x41'),_0x566f46['id'][_0x3cbe('0x38')]())))['toString']();return _0xb4b3d8;};var _0x1e5603=function(_0x712a5c,_0x274aaa){var _0xac0ecc=squel['insert']()[_0x3cbe('0x2d')]('cm_hopper')['fromQuery'](['phone',_0x3cbe('0x30'),_0x3cbe('0x31'),'ListId',_0x274aaa,_0x3cbe('0x33'),'updatedAt'],squel[_0x3cbe('0x35')]()[_0x3cbe('0x36')]('phone',_0x3cbe('0x37'))[_0x3cbe('0x36')](_0x3cbe('0x39'),_0x3cbe('0x30'))[_0x3cbe('0x36')]('id',_0x3cbe('0x31'))[_0x3cbe('0x36')](LISTID[_0x3cbe('0x38')](),'ListId')[_0x3cbe('0x36')](_0x712a5c['id'][_0x3cbe('0x38')](),_0x274aaa)[_0x3cbe('0x36')]('NOW()',_0x3cbe('0x33'))[_0x3cbe('0x36')](_0x3cbe('0x39'),_0x3cbe('0x34'))[_0x3cbe('0x3a')](_0x3cbe('0x3b'))['where'](_0x3cbe('0x3c'))[_0x3cbe('0x40')](_0x3cbe('0x3d'),LISTID[_0x3cbe('0x38')]())[_0x3cbe('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x3cbe('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x3cbe('0x40')](_0x3cbe('0x3f'),squel[_0x3cbe('0x35')]()[_0x3cbe('0x36')](_0x3cbe('0x42'))[_0x3cbe('0x3a')]('cm_hopper_final')[_0x3cbe('0x40')](_0x274aaa+_0x3cbe('0x41'),_0x712a5c['id']['toString']()))[_0x3cbe('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3cbe('0x35')]()[_0x3cbe('0x36')](_0x3cbe('0x37'))[_0x3cbe('0x3a')](_0x3cbe('0x2e'))[_0x3cbe('0x40')](_0x274aaa+'\x20=\x20?',_0x712a5c['id'][_0x3cbe('0x38')]())))[_0x3cbe('0x38')]();return _0xac0ecc;};function _0x5bd7dc(_0x56815a,_0x37445f){var _0x48535d=squel[_0x3cbe('0x43')]()[_0x3cbe('0x2d')](_0x3cbe('0x2e'))[_0x3cbe('0x2f')](['phone','scheduledAt',_0x3cbe('0x31'),'ListId',_0x37445f,_0x3cbe('0x33'),'updatedAt'],squel[_0x3cbe('0x35')]()['field']('phone','phone')[_0x3cbe('0x36')](_0x3cbe('0x39'),_0x3cbe('0x30'))[_0x3cbe('0x36')]('id',_0x3cbe('0x31'))[_0x3cbe('0x36')](LISTID[_0x3cbe('0x38')](),'ListId')[_0x3cbe('0x36')](_0x56815a['id'][_0x3cbe('0x38')](),_0x37445f)['field']('NOW()',_0x3cbe('0x33'))[_0x3cbe('0x36')](_0x3cbe('0x39'),_0x3cbe('0x34'))[_0x3cbe('0x3a')](_0x3cbe('0x3b'))[_0x3cbe('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x3cbe('0x3d'),LISTID['toString']())[_0x3cbe('0x40')](_0x3cbe('0x44'),squel[_0x3cbe('0x45')](hopperContacts))['where'](_0x3cbe('0x3e')))[_0x3cbe('0x38')]();return _0x48535d;}function _0x33f345(_0x29603c,_0x427242){var _0x27f7e2=squel[_0x3cbe('0x43')]()[_0x3cbe('0x2d')](_0x3cbe('0x46'))['fromQuery'](['phone','ContactId',_0x3cbe('0x32'),_0x427242,_0x3cbe('0x33'),_0x3cbe('0x34')],squel[_0x3cbe('0x35')]()[_0x3cbe('0x36')](_0x3cbe('0x37'),'phone')[_0x3cbe('0x36')]('id',_0x3cbe('0x31'))['field'](LISTID[_0x3cbe('0x38')](),_0x3cbe('0x32'))[_0x3cbe('0x36')](_0x29603c['id'][_0x3cbe('0x38')](),_0x427242)['field'](_0x3cbe('0x39'),_0x3cbe('0x33'))['field'](_0x3cbe('0x39'),_0x3cbe('0x34'))[_0x3cbe('0x3a')](_0x3cbe('0x3b'))[_0x3cbe('0x40')]('deletedAt\x20IS\x20NULL')[_0x3cbe('0x40')](_0x3cbe('0x3d'),LISTID['toString']())['where'](_0x3cbe('0x44'),squel[_0x3cbe('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x27f7e2;}return db[_0x3cbe('0x47')][_0x3cbe('0x48')]({'where':{'type':_0x3cbe('0x49')},'attributes':['id',_0x3cbe('0x4a')],'include':[{'model':db[_0x3cbe('0x4b')],'as':_0x3cbe('0x4c'),'where':{'id':LISTID}}]})[_0x3cbe('0x28')](function(_0x455d4e){var _0x1f1cfe=[];if(_0x455d4e){var _0x825ab5;for(var _0x310699=0x0,_0x4a2693;_0x310699<_0x455d4e[_0x3cbe('0x22')];_0x310699+=0x1){_0x4a2693=_0x455d4e[_0x310699][_0x3cbe('0x4d')]({'plain':!![]});switch(_0x4a2693['dialCheckDuplicateType']){case _0x3cbe('0x4e'):_0x1f1cfe[_0x3cbe('0x4f')](db['sequelize']['query'](_0x1e5603(_0x4a2693,_0x3cbe('0x50')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));break;case _0x3cbe('0x51'):_0x1f1cfe[_0x3cbe('0x4f')](db[_0x3cbe('0x52')][_0x3cbe('0x53')](_0x284002(_0x4a2693,'VoiceQueueId'))['then'](function(){})[_0x3cbe('0x29')](_0x463442()));break;default:_0x1f1cfe['push'](db[_0x3cbe('0x52')]['query'](_0x5bd7dc(_0x4a2693,'VoiceQueueId'))['then'](function(){})['catch'](_0x463442()));}}}return _0x1f1cfe;})['all']()[_0x3cbe('0x28')](function(){return db[_0x3cbe('0x47')][_0x3cbe('0x48')]({'where':{'type':_0x3cbe('0x49')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x3cbe('0x54'),'where':{'id':LISTID}}]})[_0x3cbe('0x28')](function(_0x252e18){var _0x11bb7f=[];if(_0x252e18){var _0x3f9cd1;for(var _0x366073=0x0,_0x133d47;_0x366073<_0x252e18[_0x3cbe('0x22')];_0x366073+=0x1){_0x133d47=_0x252e18[_0x366073][_0x3cbe('0x4d')]({'plain':!![]});_0x11bb7f['push'](db[_0x3cbe('0x52')]['query'](_0x33f345(_0x133d47,_0x3cbe('0x50')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));}}return _0x11bb7f;})[_0x3cbe('0x55')]();})['then'](function(){return db[_0x3cbe('0x56')][_0x3cbe('0x48')]({'attributes':['id',_0x3cbe('0x4a')],'include':[{'model':db[_0x3cbe('0x4b')],'as':_0x3cbe('0x4c'),'where':{'id':LISTID}}]})[_0x3cbe('0x28')](function(_0x414524){var _0x26f852=[];if(_0x414524){for(var _0x1a63a3=0x0,_0x2e2201;_0x1a63a3<_0x414524[_0x3cbe('0x22')];_0x1a63a3+=0x1){_0x2e2201=_0x414524[_0x1a63a3][_0x3cbe('0x4d')]({'plain':!![]});switch(_0x2e2201[_0x3cbe('0x4a')]){case _0x3cbe('0x4e'):_0x26f852['push'](db['sequelize']['query'](_0x1e5603(_0x2e2201,_0x3cbe('0x57')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));break;case _0x3cbe('0x51'):_0x26f852[_0x3cbe('0x4f')](db[_0x3cbe('0x52')][_0x3cbe('0x53')](_0x284002(_0x2e2201,_0x3cbe('0x57')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));break;default:_0x26f852[_0x3cbe('0x4f')](db[_0x3cbe('0x52')][_0x3cbe('0x53')](_0x5bd7dc(_0x2e2201,_0x3cbe('0x57')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));}}}return _0x26f852;})[_0x3cbe('0x55')]();})[_0x3cbe('0x28')](function(){return db[_0x3cbe('0x56')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3cbe('0x4b')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x47f88){var _0x593607=[];if(_0x47f88){for(var _0x7ba619=0x0,_0x23cda3;_0x7ba619<_0x47f88['length'];_0x7ba619+=0x1){_0x23cda3=_0x47f88[_0x7ba619][_0x3cbe('0x4d')]({'plain':!![]});_0x593607[_0x3cbe('0x4f')](db[_0x3cbe('0x52')][_0x3cbe('0x53')](_0x33f345(_0x23cda3,_0x3cbe('0x57')))[_0x3cbe('0x28')](function(){})[_0x3cbe('0x29')](_0x463442()));}}return _0x593607;})[_0x3cbe('0x55')]();})['catch'](function(_0x87b307){logger[_0x3cbe('0x12')](_0x3cbe('0x58'),'generalCheckHopper',_0x87b307[_0x3cbe('0x1a')]);});}var processPromises=function(_0x54dfd6){return BPromise[_0x3cbe('0x55')](promises)[_0x3cbe('0x28')](function(_0x4a3048){})[_0x3cbe('0x29')](function(_0x27542a){logger[_0x3cbe('0x12')](_0x3cbe('0x59'),JSON[_0x3cbe('0x5a')](_0x27542a));})[_0x3cbe('0x5b')](function(){socket[_0x3cbe('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x54dfd6){return _0x54dfd6['resume']();}});};var endCsv=function(){return BPromise[_0x3cbe('0x5d')]()[_0x3cbe('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x3cbe('0x28')](function(){socket[_0x3cbe('0x5c')](_0x3cbe('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3cbe('0x5f')](FILEPATH);}catch(_0x137ee0){logger[_0x3cbe('0x12')](_0x3cbe('0x60'),JSON[_0x3cbe('0x5a')](_0x137ee0));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0x3cbe('0x61')](_0x3cbe('0x62'));endCsv();});function main(){return BPromise[_0x3cbe('0x5d')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3cbe('0xf')](',');return db[_0x3cbe('0x25')][_0x3cbe('0x48')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3cbe('0x28')](function(_0xe8e766){var _0x1d97a9=fs[_0x3cbe('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1d97a9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x428227,_0x372903){total+=0x1;var _0x5024d0=total;promises[_0x3cbe('0x4f')](checkRow(_0x428227,_0xe8e766,_0x5024d0)['then'](function(){success+=0x1;})[_0x3cbe('0x29')](function(_0xa842ec){if(_0xa842ec[_0x3cbe('0x12')]){errors+=0x1;delete _0xa842ec[_0x3cbe('0x12')];}else if(_0xa842ec['duplicate']){duplicates+=0x1;delete _0xa842ec['duplicate'];}rows[_0x3cbe('0x4f')](_0xa842ec);}));if(total%0xc8===0x0){_0x372903[_0x3cbe('0x64')]();return processPromises(_0x372903);}},'complete':function(){return processPromises()[_0x3cbe('0x28')](function(){logger[_0x3cbe('0x61')](_0x3cbe('0x65'));endCsv();});},'error':function(_0x522cb1,_0x270a6f){logger[_0x3cbe('0x61')](_0x3cbe('0x66'),JSON[_0x3cbe('0x5a')](_0x522cb1));endCsv();}});})[_0x3cbe('0x29')](function(_0x1288fc){logger[_0x3cbe('0x12')](_0x3cbe('0x67'),JSON[_0x3cbe('0x5a')](_0x1288fc));});}main(); \ No newline at end of file +var _0x213c=['errors','length','map','message','join','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','fromQuery','phone','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','from','where','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','updatedAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','all','findAll','BlackLists','CampaignId','onlyIfOpen','Campaign','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x213c,0x131));var _0xc213=function(_0x197723,_0x305ce7){_0x197723=_0x197723-0x0;var _0xe5b8e1=_0x213c[_0x197723];return _0xe5b8e1;};'use strict';var BPromise=require('bluebird');var util=require(_0xc213('0x0'));var _=require(_0xc213('0x1'));var fs=require('fs');var squel=require(_0xc213('0x2'));var Papa=require('papaparse');var Redis=require(_0xc213('0x3'));var db=require(_0xc213('0x4'))['db'];var config=require(_0xc213('0x5'));var logger=require(_0xc213('0x6'))(_0xc213('0x7'));config['redis']=_[_0xc213('0x8')](config[_0xc213('0x9')],{'host':_0xc213('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc213('0x9')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0xc213('0xb')][0x2]||process['argv'][0x2]===_0xc213('0xc')||process[_0xc213('0xb')][0x2]==='null'){throw new Error(_0xc213('0xd'));}var FILEPATH=process[_0xc213('0xb')][0x2];if(!process[_0xc213('0xb')][0x3]||process[_0xc213('0xb')][0x3]===_0xc213('0xc')||process[_0xc213('0xb')][0x3]===_0xc213('0xe')||!process['argv'][0x4]||process[_0xc213('0xb')][0x4]===_0xc213('0xc')||process[_0xc213('0xb')][0x4]===_0xc213('0xe')){throw new Error(_0xc213('0xf'));}var FIELDS=_['zipObject'](process['argv'][0x3][_0xc213('0x10')](','),process[_0xc213('0xb')][0x4]['split'](','));if(!process[_0xc213('0xb')][0x5]||process['argv'][0x5]==='undefined'||process[_0xc213('0xb')][0x5]===_0xc213('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xc213('0xb')][0x5];var COMPANYID=process[_0xc213('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xc213('0xb')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xc213('0xb')][0x7]&&process[_0xc213('0xb')][0x7]!==_0xc213('0xc')&&process[_0xc213('0xb')][0x7]!==_0xc213('0xe')?process['argv'][0x7]:null;if(!process[_0xc213('0xb')][0x8]||process[_0xc213('0xb')][0x8]==='undefined'||process[_0xc213('0xb')][0x8]===_0xc213('0xe')){throw new Error(_0xc213('0x11'));}var SOCKET_TIMESTAMP=process[_0xc213('0xb')][0x8];}catch(_0x4e9368){logger['error'](_0x4e9368);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(_0x2be54c,_0x1d3eab,_0x1ce830,_0x54eba3){var _0x32599d={'message':_0x1d3eab};_0x32599d[_0x2be54c]=!![];if(_0x1ce830){_0x32599d[_0xc213('0x12')]=_0x1ce830;}if(_0x54eba3){_0x32599d[_0xc213('0x13')]=_0x54eba3;}return _0x32599d;}function isEmail(_0xdc735a){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))*$/[_0xc213('0x14')](_0xdc735a);}function checkRow(_0x211d5d,_0x375413,_0x2df025){return new BPromise(function(_0x2b95db,_0x5789d5){if(_['isNil'](_0x211d5d)){return _0x5789d5(handleCheckRowError('error',_0xc213('0x15'),null,_0x2df025));}if(_0x211d5d[_0xc213('0x16')]&&_0x211d5d[_0xc213('0x16')][_0xc213('0x17')]){var _0x5a9fe8=_[_0xc213('0x18')](_0x211d5d[_0xc213('0x16')],_0xc213('0x19'))[_0xc213('0x1a')](';');return _0x5789d5(handleCheckRowError(_0xc213('0x1b'),_0x5a9fe8,null,_0x2df025));}var _0x3dc439={};for(var _0x3337ab in FIELDS){if(FIELDS[_0xc213('0x1c')](_0x3337ab)&&FIELDS[_0x3337ab]){_0x3dc439[_0x3337ab]=_0x211d5d[_0xc213('0x1d')][0x0][FIELDS[_0x3337ab]]||_0x211d5d[_0xc213('0x1d')][0x0]['\ufeff'+FIELDS[_0x3337ab]];}}if(!_0x3dc439[_0xc213('0x1e')]){return _0x5789d5(handleCheckRowError(_0xc213('0x1b'),_0xc213('0x1f'),null,_0x2df025));}if(!_0x3dc439['phone']){return _0x5789d5(handleCheckRowError('error',_0xc213('0x20'),null,_0x2df025));}if(_0x3dc439[_0xc213('0x21')]){var _0x51bf92=moment(_0x3dc439[_0xc213('0x21')],'YYYY-MM-DD');if(!_0x51bf92['isValid']()){return _0x5789d5(handleCheckRowError(_0xc213('0x1b'),_0xc213('0x22'),null,_0x2df025));}}if(_0x3dc439[_0xc213('0x23')]){if(!isEmail(_0x3dc439[_0xc213('0x23')])){return _0x5789d5(handleCheckRowError(_0xc213('0x1b'),'email\x20format\x20is\x20not\x20valid!',null,_0x2df025));}}_0x3dc439[_0xc213('0x24')]=LISTID;_0x3dc439[_0xc213('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x375413){var _0x45e1ac={};for(var _0x426523=0x0,_0x272982=DUPLICATES['length'];_0x426523<_0x272982;_0x426523+=0x1){_0x45e1ac[DUPLICATES[_0x426523]]=_0x3dc439[DUPLICATES[_0x426523]];}var _0x1ec81c=_[_0xc213('0x26')](_0x375413,_0x45e1ac);if(_0x1ec81c){return _0x5789d5(handleCheckRowError(_0xc213('0x27'),_0xc213('0x28'),_0x1ec81c,_0x2df025));}}return db[_0xc213('0x29')]['create'](_0x3dc439,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3dc439)})['then'](function(_0x4e3038){if(DUPLICATES&&DUPLICATES[_0xc213('0x17')]&&_0x375413){_0x375413[_0xc213('0x2a')](_[_0xc213('0x2b')](_0x3dc439,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4e3038['id'];return _0x2b95db();})[_0xc213('0x2c')](function(_0x111db8){return _0x5789d5(handleCheckRowError('error',_0xc213('0x2d')+(_0x111db8[_0xc213('0x19')]||JSON[_0xc213('0x2e')](_0x111db8)),null,_0x2df025));});});}function checkHopper(){function _0x235707(){return function(_0x3ce29e){logger[_0xc213('0x1b')](_0xc213('0x2f'),'checkHopper',util[_0xc213('0x30')](_0x3ce29e,{'showHidden':![],'depth':null}));};}var _0x191045=function(_0x3f0d59,_0x4e583d){var _0x57832=squel[_0xc213('0x31')]()['into']('cm_hopper')[_0xc213('0x32')]([_0xc213('0x33'),_0xc213('0x34'),_0xc213('0x35'),'ListId',_0x4e583d,_0xc213('0x36'),'updatedAt'],squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x33'),_0xc213('0x33'))[_0xc213('0x38')](_0xc213('0x39'),_0xc213('0x34'))[_0xc213('0x38')]('id',_0xc213('0x35'))[_0xc213('0x38')](LISTID[_0xc213('0x3a')](),_0xc213('0x24'))['field'](_0x3f0d59['id']['toString'](),_0x4e583d)[_0xc213('0x38')](_0xc213('0x39'),'createdAt')[_0xc213('0x38')](_0xc213('0x39'),'updatedAt')[_0xc213('0x3b')]('cm_contacts')[_0xc213('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xc213('0x3a')]())[_0xc213('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xc213('0x3c')](_0xc213('0x3d'),squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x33'))[_0xc213('0x3b')](_0xc213('0x3e'))[_0xc213('0x3c')](_0x4e583d+_0xc213('0x3f'),_0x3f0d59['id']['toString']())))['toString']();return _0x57832;};var _0x271cc0=function(_0x28fc32,_0x1c32ba){var _0x232f8f=squel[_0xc213('0x31')]()['into'](_0xc213('0x3e'))[_0xc213('0x32')]([_0xc213('0x33'),_0xc213('0x34'),'ContactId',_0xc213('0x24'),_0x1c32ba,'createdAt',_0xc213('0x40')],squel[_0xc213('0x37')]()[_0xc213('0x38')]('phone',_0xc213('0x33'))['field'](_0xc213('0x39'),_0xc213('0x34'))[_0xc213('0x38')]('id','ContactId')[_0xc213('0x38')](LISTID['toString'](),_0xc213('0x24'))[_0xc213('0x38')](_0x28fc32['id'][_0xc213('0x3a')](),_0x1c32ba)[_0xc213('0x38')](_0xc213('0x39'),_0xc213('0x36'))[_0xc213('0x38')](_0xc213('0x39'),_0xc213('0x40'))[_0xc213('0x3b')]('cm_contacts')['where'](_0xc213('0x41'))[_0xc213('0x3c')](_0xc213('0x42'),LISTID['toString']())[_0xc213('0x3c')](_0xc213('0x43'),squel[_0xc213('0x44')](hopperContacts))[_0xc213('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xc213('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x45'))[_0xc213('0x3b')](_0xc213('0x46'))[_0xc213('0x3c')](_0x1c32ba+'\x20=\x20?',_0x28fc32['id'][_0xc213('0x3a')]()))[_0xc213('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x33'))['from'](_0xc213('0x3e'))[_0xc213('0x3c')](_0x1c32ba+_0xc213('0x3f'),_0x28fc32['id'][_0xc213('0x3a')]())))[_0xc213('0x3a')]();return _0x232f8f;};function _0x4ec535(_0x13f703,_0x1085d4){var _0x592a33=squel[_0xc213('0x31')]()[_0xc213('0x47')]('cm_hopper')[_0xc213('0x32')](['phone',_0xc213('0x34'),_0xc213('0x35'),'ListId',_0x1085d4,_0xc213('0x36'),_0xc213('0x40')],squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x33'),'phone')['field'](_0xc213('0x39'),_0xc213('0x34'))[_0xc213('0x38')]('id',_0xc213('0x35'))['field'](LISTID[_0xc213('0x3a')](),_0xc213('0x24'))[_0xc213('0x38')](_0x13f703['id'][_0xc213('0x3a')](),_0x1085d4)[_0xc213('0x38')](_0xc213('0x39'),_0xc213('0x36'))[_0xc213('0x38')](_0xc213('0x39'),'updatedAt')['from'](_0xc213('0x48'))[_0xc213('0x3c')](_0xc213('0x41'))['where'](_0xc213('0x42'),LISTID['toString']())[_0xc213('0x3c')](_0xc213('0x43'),squel['str'](hopperContacts))[_0xc213('0x3c')](_0xc213('0x49')))[_0xc213('0x3a')]();return _0x592a33;}function _0x14c553(_0x8a3363,_0x11d39a){var _0x27be51=squel[_0xc213('0x31')]()['into'](_0xc213('0x4a'))[_0xc213('0x32')]([_0xc213('0x33'),_0xc213('0x35'),'ListId',_0x11d39a,_0xc213('0x36'),_0xc213('0x40')],squel[_0xc213('0x37')]()[_0xc213('0x38')](_0xc213('0x33'),_0xc213('0x33'))['field']('id',_0xc213('0x35'))[_0xc213('0x38')](LISTID[_0xc213('0x3a')](),'ListId')[_0xc213('0x38')](_0x8a3363['id'][_0xc213('0x3a')](),_0x11d39a)['field']('NOW()',_0xc213('0x36'))['field']('NOW()',_0xc213('0x40'))[_0xc213('0x3b')](_0xc213('0x48'))[_0xc213('0x3c')](_0xc213('0x41'))[_0xc213('0x3c')](_0xc213('0x42'),LISTID[_0xc213('0x3a')]())['where'](_0xc213('0x43'),squel[_0xc213('0x44')](hopperContacts))[_0xc213('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xc213('0x3a')]();return _0x27be51;}return db[_0xc213('0x4b')]['findAll']({'where':{'type':_0xc213('0x4c')},'attributes':['id',_0xc213('0x4d')],'include':[{'model':db[_0xc213('0x4e')],'as':_0xc213('0x4f'),'where':{'id':LISTID}}]})[_0xc213('0x50')](function(_0x145f88){var _0x170c48=[];if(_0x145f88){var _0x31ee2c;for(var _0x244249=0x0,_0x2b31cf;_0x244249<_0x145f88[_0xc213('0x17')];_0x244249+=0x1){_0x2b31cf=_0x145f88[_0x244249][_0xc213('0x51')]({'plain':!![]});switch(_0x2b31cf[_0xc213('0x4d')]){case _0xc213('0x52'):_0x170c48[_0xc213('0x2a')](db[_0xc213('0x53')]['query'](_0x271cc0(_0x2b31cf,'VoiceQueueId'))[_0xc213('0x50')](function(){})['catch'](_0x235707()));break;case'onlyIfOpen':_0x170c48[_0xc213('0x2a')](db[_0xc213('0x53')][_0xc213('0x54')](_0x191045(_0x2b31cf,_0xc213('0x55')))['then'](function(){})[_0xc213('0x2c')](_0x235707()));break;default:_0x170c48[_0xc213('0x2a')](db['sequelize'][_0xc213('0x54')](_0x4ec535(_0x2b31cf,_0xc213('0x55')))[_0xc213('0x50')](function(){})[_0xc213('0x2c')](_0x235707()));}}}return _0x170c48;})[_0xc213('0x56')]()[_0xc213('0x50')](function(){return db[_0xc213('0x4b')][_0xc213('0x57')]({'where':{'type':_0xc213('0x4c')},'attributes':['id'],'include':[{'model':db[_0xc213('0x4e')],'as':_0xc213('0x58'),'where':{'id':LISTID}}]})[_0xc213('0x50')](function(_0xd3aacd){var _0x28a1f1=[];if(_0xd3aacd){var _0x21af41;for(var _0x3531a8=0x0,_0x5cdec2;_0x3531a8<_0xd3aacd[_0xc213('0x17')];_0x3531a8+=0x1){_0x5cdec2=_0xd3aacd[_0x3531a8][_0xc213('0x51')]({'plain':!![]});_0x28a1f1[_0xc213('0x2a')](db[_0xc213('0x53')][_0xc213('0x54')](_0x14c553(_0x5cdec2,_0xc213('0x55')))['then'](function(){})[_0xc213('0x2c')](_0x235707()));}}return _0x28a1f1;})[_0xc213('0x56')]();})[_0xc213('0x50')](function(){return db['Campaign'][_0xc213('0x57')]({'attributes':['id',_0xc213('0x4d')],'include':[{'model':db[_0xc213('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2ecf47){var _0x49bb46=[];if(_0x2ecf47){for(var _0x40786f=0x0,_0x62b1df;_0x40786f<_0x2ecf47[_0xc213('0x17')];_0x40786f+=0x1){_0x62b1df=_0x2ecf47[_0x40786f][_0xc213('0x51')]({'plain':!![]});switch(_0x62b1df[_0xc213('0x4d')]){case _0xc213('0x52'):_0x49bb46[_0xc213('0x2a')](db[_0xc213('0x53')]['query'](_0x271cc0(_0x62b1df,_0xc213('0x59')))[_0xc213('0x50')](function(){})[_0xc213('0x2c')](_0x235707()));break;case _0xc213('0x5a'):_0x49bb46[_0xc213('0x2a')](db[_0xc213('0x53')][_0xc213('0x54')](_0x191045(_0x62b1df,_0xc213('0x59')))[_0xc213('0x50')](function(){})[_0xc213('0x2c')](_0x235707()));break;default:_0x49bb46['push'](db[_0xc213('0x53')]['query'](_0x4ec535(_0x62b1df,_0xc213('0x59')))[_0xc213('0x50')](function(){})['catch'](_0x235707()));}}}return _0x49bb46;})['all']();})['then'](function(){return db[_0xc213('0x5b')][_0xc213('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xc213('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x1894c1){var _0x227746=[];if(_0x1894c1){for(var _0x784ff9=0x0,_0x18dda6;_0x784ff9<_0x1894c1[_0xc213('0x17')];_0x784ff9+=0x1){_0x18dda6=_0x1894c1[_0x784ff9][_0xc213('0x51')]({'plain':!![]});_0x227746[_0xc213('0x2a')](db[_0xc213('0x53')][_0xc213('0x54')](_0x14c553(_0x18dda6,_0xc213('0x59')))[_0xc213('0x50')](function(){})['catch'](_0x235707()));}}return _0x227746;})['all']();})[_0xc213('0x2c')](function(_0x28c1d5){logger[_0xc213('0x1b')]('cmContact,\x20%s,\x20%s',_0xc213('0x5c'),_0x28c1d5[_0xc213('0x19')]);});}var processPromises=function(_0x43a265){return BPromise[_0xc213('0x56')](promises)[_0xc213('0x50')](function(_0x5bcd78){})[_0xc213('0x2c')](function(_0x3f5365){logger[_0xc213('0x1b')](_0xc213('0x5d'),JSON[_0xc213('0x2e')](_0x3f5365));})[_0xc213('0x5e')](function(){socket[_0xc213('0x5f')](_0xc213('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x43a265){return _0x43a265[_0xc213('0x61')]();}});};var endCsv=function(){return BPromise[_0xc213('0x62')]()[_0xc213('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0xc213('0x50')](function(){socket[_0xc213('0x5f')](_0xc213('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc213('0x63')](FILEPATH);}catch(_0x154e74){logger[_0xc213('0x1b')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x154e74));}finally{process[_0xc213('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0xc213('0x65')](_0xc213('0x66'));endCsv();});function main(){return BPromise[_0xc213('0x62')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc213('0x10')](',');return db[_0xc213('0x29')][_0xc213('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x3c440d){var _0x5dc09a=fs[_0xc213('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc213('0x68')](_0x5dc09a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x199ab2,_0x1f6d65){total+=0x1;var _0x13a498=total;promises['push'](checkRow(_0x199ab2,_0x3c440d,_0x13a498)[_0xc213('0x50')](function(){success+=0x1;})[_0xc213('0x2c')](function(_0x3ba0dc){if(_0x3ba0dc[_0xc213('0x1b')]){errors+=0x1;delete _0x3ba0dc[_0xc213('0x1b')];}else if(_0x3ba0dc[_0xc213('0x27')]){duplicates+=0x1;delete _0x3ba0dc[_0xc213('0x27')];}rows['push'](_0x3ba0dc);}));if(total%0xc8===0x0){_0x1f6d65[_0xc213('0x69')]();return processPromises(_0x1f6d65);}},'complete':function(){return processPromises()[_0xc213('0x50')](function(){logger[_0xc213('0x65')](_0xc213('0x6a'));endCsv();});},'error':function(_0x3288ff,_0x449812){logger[_0xc213('0x65')](_0xc213('0x6b'),JSON[_0xc213('0x2e')](_0x3288ff));endCsv();}});})[_0xc213('0x2c')](function(_0x1fe7bb){logger['error'](_0xc213('0x6c'),JSON['stringify'](_0x1fe7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6ce0159..e4a458a 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 _0x5ac7=['findAll','name','writeFileSync','parse','createReadStream','data','rows','find','_description','hasOwnProperty','trim','replace','priority','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','isValid','firstName','\x20not\x20specified','SystemRow','emit','contact:import:','errors','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','affectedRows','unlink','exit','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','.id\x20=\x20','\x20=\x20','join','then','push','all','AdditionalPhones','length','split','findOne','CmContactHasItem','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','phone','scheduledat','createdAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','where','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','into','fromQuery','ContactId','updatedAt','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper_black','ListId','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','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=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','.csv','keys','includes','header'];(function(_0x21c1f2,_0x1c307c){var _0x54d10e=function(_0x3b5560){while(--_0x3b5560){_0x21c1f2['push'](_0x21c1f2['shift']());}};_0x54d10e(++_0x1c307c);}(_0x5ac7,0xe9));var _0x75ac=function(_0x5b4701,_0x37cb88){_0x5b4701=_0x5b4701-0x0;var _0x5f55e1=_0x5ac7[_0x5b4701];return _0x5f55e1;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x75ac('0x0'));var Papa=require(_0x75ac('0x1'));var util=require(_0x75ac('0x2'));var BPromise=require(_0x75ac('0x3'));var moment=require('moment');var squel=require(_0x75ac('0x4'));var Redis=require(_0x75ac('0x5'));var db=require(_0x75ac('0x6'))['db'];var config=require(_0x75ac('0x7'));var shared=require(_0x75ac('0x8'));var logger=require(_0x75ac('0x9'))(_0x75ac('0xa'));config[_0x75ac('0xb')]=_[_0x75ac('0xc')](config['redis'],{'host':_0x75ac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75ac('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x75ac('0xe')](_0x75ac('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x75ac('0xe')](_0x75ac('0xf'));function isEmail(_0x567292){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'](_0x567292);}function selectNotIn(_0x2f0492,_0x138f06,_0x453f78,_0x3a7f02,_0x4860b0){return squel[_0x75ac('0x10')]()[_0x75ac('0x11')]('phone')[_0x75ac('0x12')](_0x3a7f02)['join'](_0x138f06,null,_0x138f06+_0x75ac('0x13')+_0x3a7f02+'.'+_0x453f78)['where'](_0x3a7f02+'.'+_0x453f78+_0x75ac('0x14')+_0x2f0492+'.'+_0x453f78)['where'](_0x138f06+'.dialCheckDuplicateType\x20IN\x20('+_0x4860b0[_0x75ac('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x43d541,_0x1164b7){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x75ac('0x16')](function(_0x1679d7){if(_0x1679d7!==null){var _0x3ee7f2=[];for(var _0x3e37cd=0x0;_0x3e37cd<_0x1679d7['length'];_0x3e37cd++){var _0x3416b0=_0x1679d7[_0x3e37cd];_0x3ee7f2[_0x75ac('0x17')](insertAdditionalPhones(_0x3416b0));}}Promise[_0x75ac('0x18')](_0x3ee7f2)[_0x75ac('0x16')](function(){_0x43d541({'val':0x1});});});});}function insertAdditionalPhones(_0x5bb18d){return new Promise(function(_0x5467f3,_0x4e65af){var _0xe514ff=_0x5bb18d[_0x75ac('0x19')];var _0x42ff29=_0xe514ff['split'](';');var _0x2ad154=[];orderBy=0x0;for(var _0x5d0e7b=0x0;_0x5d0e7b<_0x42ff29[_0x75ac('0x1a')];_0x5d0e7b++){_0x2ad154[_0x75ac('0x17')](splitAdditionalPhone(_0x5bb18d['id'],_0x42ff29[_0x5d0e7b]));}Promise['all'](_0x2ad154)[_0x75ac('0x16')](function(){_0x5467f3({'val':_0x42ff29['length']});});});}function splitAdditionalPhone(_0x29fc5,_0x5c398d){return new Promise(function(_0x52b89f,_0xb87631){var _0x38ff55=_0x5c398d[_0x75ac('0x1b')](':');var _0x4cafa5=_0x38ff55[0x0];var _0x382eaa=_0x38ff55[0x1];if(!_['isNil'](_0x382eaa)){var _0x20223a=_0x382eaa['split']('|');var _0x1aec07=[];for(var _0x24155a=0x0;_0x24155a<_0x20223a['length'];_0x24155a++){if(_0x20223a[_0x24155a]!==''){var _0x26e076=_['filter'](promisesAdditionalPhones,{'contactId':_0x29fc5,'phone':_0x20223a[_0x24155a]});if(_0x26e076[_0x75ac('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x75ac('0x17')]({'contactId':_0x29fc5,'contactTypeId':_0x4cafa5,'phone':_0x20223a[_0x24155a],'orderBy':orderBy});}}}_0x52b89f({'ok':0x1});}else _0x52b89f({'res':0x0});});}function createAdditionalPhone(_0x42d988,_0x194c76,_0x467e2f,_0x2c2008){var _0x38997b='';var _0x16bfae='';var _0x2edc03=_0x467e2f['split']('§');_0x38997b=_0x2edc03[0x0];if(_0x2edc03['length']==0x2)_0x16bfae=_0x2edc03[0x1];return new Promise(function(_0x4f4b6b,_0x16dc38){return db['CmContactHasItem'][_0x75ac('0x1c')]({'where':{'CmContactId':_0x42d988,'item':_0x38997b}})[_0x75ac('0x16')](function(_0x21eb4d){if(_0x21eb4d){return db[_0x75ac('0x1d')][_0x75ac('0x1e')]({'ItemTypeId':_0x194c76,'description':_0x16bfae,'OrderBy':_0x2c2008},{'where':{'CmContactId':_0x42d988,'item':_0x38997b}})[_0x75ac('0x16')](function(_0x37b6e4){_0x4f4b6b({'res':'updated'});});}else{return db[_0x75ac('0x1d')][_0x75ac('0x1f')]({'CmContactId':_0x42d988,'item':_0x38997b,'description':_0x16bfae,'ItemTypeId':_0x194c76,'OrderBy':_0x2c2008,'ItemClass':_0x75ac('0x20')})['then'](function(_0x118f5c){_0x4f4b6b({'res':_0x75ac('0x21')});});}});});}function insertCmHopper(_0x1cfa92,_0xbc7039,_0x2887a0,_0x180b3c,_0x84fc2d){var _0x37a84a=[_0x75ac('0x22'),_0x75ac('0x23'),_0x75ac('0x24'),'cm_contacts.ListId',_0xbc7039+'.'+_0x180b3c,_0x75ac('0x25'),'cm_contacts.updatedAt',_0x75ac('0x26'),_0x75ac('0x27'),'\x22'+_0x84fc2d+'\x22'];return squel[_0x75ac('0x28')]()['into'](_0x75ac('0x29'))['fromQuery']([_0x75ac('0x2a'),_0x75ac('0x2b'),'ContactId','ListId',_0x180b3c,_0x75ac('0x2c'),'updatedAt','priority',_0x75ac('0x2d'),_0x75ac('0x2e')],squel[_0x75ac('0x10')]()[_0x75ac('0x2f')](_0x37a84a)[_0x75ac('0x12')](_0xbc7039)[_0x75ac('0x15')]('cm_contacts',null,_0x75ac('0x30')+_0xbc7039+'.CmListId')[_0x75ac('0x15')](_0x2887a0,null,_0x2887a0+_0x75ac('0x13')+_0xbc7039+'.'+_0x180b3c)[_0x75ac('0x31')](_0xbc7039+'.CmListId\x20=\x20?',_0x1cfa92)[_0x75ac('0x31')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x75ac('0x31')](_0x75ac('0x32'),selectNotIn(_0xbc7039,_0x2887a0,_0x180b3c,_0x75ac('0x29'),[_0x75ac('0x33'),_0x75ac('0x34')]))[_0x75ac('0x31')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xbc7039,_0x2887a0,_0x180b3c,'cm_hopper',[_0x75ac('0x33')])))[_0x75ac('0x35')]();}function insertCmHopperBlack(_0x4b16ad,_0x4ae22d,_0x5e5606,_0x4273a0){var _0x30ddc8=['cm_contacts.phone',_0x75ac('0x24'),_0x75ac('0x36'),_0x4ae22d+'.'+_0x4273a0,'cm_contacts.createdAt',_0x75ac('0x37')];return squel['insert']()[_0x75ac('0x38')]('cm_hopper_black')[_0x75ac('0x39')]([_0x75ac('0x2a'),_0x75ac('0x3a'),'ListId',_0x4273a0,'createdAt',_0x75ac('0x3b')],squel[_0x75ac('0x10')]()[_0x75ac('0x2f')](_0x30ddc8)[_0x75ac('0x12')](_0x4ae22d)[_0x75ac('0x15')](_0x75ac('0x3c'),null,_0x75ac('0x30')+_0x4ae22d+_0x75ac('0x3d'))['join'](_0x5e5606,null,_0x5e5606+_0x75ac('0x13')+_0x4ae22d+'.'+_0x4273a0)['where'](_0x4ae22d+_0x75ac('0x3e'),_0x4b16ad)['where'](_0x75ac('0x3f'),NOW)[_0x75ac('0x31')](_0x75ac('0x32'),squel[_0x75ac('0x10')]()[_0x75ac('0x11')](_0x75ac('0x2a'))['from']('cm_hopper_black')[_0x75ac('0x31')]('ListId\x20=\x20?',_0x4b16ad)['where'](_0x4273a0+_0x75ac('0x14')+_0x4ae22d+'.'+_0x4273a0)))[_0x75ac('0x35')]();}function insertTzCmHopper(_0x2c5d01,_0x2935ee,_0x1d9b9f,_0x37be13,_0x487cd6,_0x49b837){var _0x47cb03=['cm_contacts.phone',_0x75ac('0x40')+_0x49b837+_0x75ac('0x41'),_0x75ac('0x24'),'cm_contacts.ListId',_0x2935ee+'.'+_0x37be13,_0x75ac('0x25'),_0x75ac('0x37'),_0x75ac('0x26'),_0x75ac('0x27'),'\x22'+_0x487cd6+'\x22'];var _0x45db44=squel[_0x75ac('0x28')]()['into'](_0x75ac('0x29'))[_0x75ac('0x39')]([_0x75ac('0x2a'),_0x75ac('0x2b'),_0x75ac('0x3a'),'ListId',_0x37be13,_0x75ac('0x2c'),'updatedAt','priority',_0x75ac('0x2d'),'recallme'],squel[_0x75ac('0x10')]()[_0x75ac('0x2f')](_0x47cb03)[_0x75ac('0x12')](_0x2935ee)[_0x75ac('0x15')](_0x75ac('0x3c'),null,_0x75ac('0x30')+_0x2935ee+'.CmListId')[_0x75ac('0x15')](_0x1d9b9f,null,_0x1d9b9f+'.id\x20=\x20'+_0x2935ee+'.'+_0x37be13)[_0x75ac('0x15')](_0x49b837,null,_0x49b837+_0x75ac('0x13')+_0x2935ee+'.'+_0x37be13)[_0x75ac('0x31')](_0x2935ee+_0x75ac('0x3e'),_0x2c5d01)[_0x75ac('0x31')](_0x75ac('0x3f'),NOW)[_0x75ac('0x31')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2935ee,_0x1d9b9f,_0x37be13,_0x75ac('0x29'),[_0x75ac('0x33'),_0x75ac('0x34')]))['where'](_0x75ac('0x32'),selectNotIn(_0x2935ee,_0x1d9b9f,_0x37be13,_0x75ac('0x29'),[_0x75ac('0x33')])))[_0x75ac('0x35')]();return _0x45db44;}function insertTzCmHopperBlack(_0x3e2492,_0x859d84,_0x2f63ea,_0x1432f2){var _0x36a887=['cm_contacts.phone',_0x75ac('0x24'),'cm_contacts.ListId',_0x859d84+'.'+_0x1432f2,_0x75ac('0x25'),_0x75ac('0x37')];return squel[_0x75ac('0x28')]()['into'](_0x75ac('0x42'))[_0x75ac('0x39')](['phone',_0x75ac('0x3a'),_0x75ac('0x43'),_0x1432f2,_0x75ac('0x2c'),_0x75ac('0x3b')],squel['select']()[_0x75ac('0x2f')](_0x36a887)[_0x75ac('0x12')](_0x859d84)[_0x75ac('0x15')]('cm_contacts',null,_0x75ac('0x30')+_0x859d84+'.CmListId')['join'](_0x2f63ea,null,_0x2f63ea+'.id\x20=\x20'+_0x859d84+'.'+_0x1432f2)[_0x75ac('0x31')](_0x859d84+_0x75ac('0x3e'),_0x3e2492)[_0x75ac('0x31')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x75ac('0x31')](_0x75ac('0x32'),squel[_0x75ac('0x10')]()[_0x75ac('0x11')]('phone')[_0x75ac('0x12')](_0x75ac('0x42'))['where']('ListId\x20=\x20?',_0x3e2492)[_0x75ac('0x31')](_0x1432f2+'\x20=\x20'+_0x859d84+'.'+_0x1432f2)))[_0x75ac('0x35')]();}function insertCmHopperAdditionalPhones(_0x5307ba){var _0x107db7=[_0x75ac('0x44'),'cm_contact_has_items.item',_0x75ac('0x45'),_0x75ac('0x46'),_0x75ac('0x47')];return squel[_0x75ac('0x28')]()[_0x75ac('0x38')](_0x75ac('0x48'))[_0x75ac('0x39')](['CmHopperId',_0x75ac('0x2a'),'OrderBy',_0x75ac('0x2c'),'updatedAt'],squel['select']()[_0x75ac('0x2f')](_0x107db7)[_0x75ac('0x12')](_0x75ac('0x29'))[_0x75ac('0x15')](_0x75ac('0x3c'),null,_0x75ac('0x49'))['join'](_0x75ac('0x4a'),null,_0x75ac('0x4b'))[_0x75ac('0x31')]('cm_hopper.ListId\x20=\x20?',_0x5307ba)[_0x75ac('0x31')](_0x75ac('0x3f'),NOW))[_0x75ac('0x35')]();}function insertCmContact(_0x5f4bd1,_0x52c6c9,_0x2bc844,_0x57a4a1){var _0x187001=_[_0x75ac('0x4c')](_['keys'](_0x57a4a1),[_0x75ac('0x43'),_0x75ac('0x4d'),_0x75ac('0x2c'),_0x75ac('0x3b'),_0x75ac('0x4e')]);return squel['insert']()[_0x75ac('0x38')](_0x75ac('0x3c'))[_0x75ac('0x39')](_0x187001,squel[_0x75ac('0x10')]()[_0x75ac('0x2f')](_0x187001)[_0x75ac('0x12')](_0x52c6c9)[_0x75ac('0x31')]('('+_0x2bc844[_0x75ac('0x15')](',')+_0x75ac('0x4f'),squel['select']()[_0x75ac('0x2f')](_0x2bc844)[_0x75ac('0x12')](_0x75ac('0x3c'))[_0x75ac('0x31')]('ListId\x20=\x20?',_0x5f4bd1)[_0x75ac('0x31')]('deletedAt\x20IS\x20NULL'))['where'](_0x75ac('0x50'),squel[_0x75ac('0x10')]()[_0x75ac('0x11')](_0x75ac('0x51'),_0x75ac('0x52'))[_0x75ac('0x12')](_0x52c6c9)['group'](_0x2bc844[_0x75ac('0x15')](','))))[_0x75ac('0x35')]();}function handleStop(){logger[_0x75ac('0x53')](_0x75ac('0x54'));stopped=!![];}function handleUncaughtException(_0x259fbe){logger[_0x75ac('0x55')](_0x259fbe[_0x75ac('0x56')]);process['exit'](0x1);}function handleError(_0x2c2136,_0x4a0e66){stats['errors'][_0x75ac('0x17')]({'name':_0x4a0e66['code'],'message':_0x4a0e66[_0x75ac('0x56')],'row':_0x2c2136});}function handleQuery(_0x407d33){logger[_0x75ac('0x53')](_0x407d33);return db['sequelize'][_0x75ac('0x57')](_0x407d33)[_0x75ac('0x58')](function(_0x471b6e){results['push'](_0x471b6e);})['catch'](function(_0x2f304b){logger[_0x75ac('0x55')](_0x2f304b['message']);});}function updateTzCampaigns(_0x1a5f2a){return new Promise(function(_0x3d35dc,_0x5bed32){var _0x43a84a=squel[_0x75ac('0x10')]()[_0x75ac('0x2f')]([_0x75ac('0x59'),_0x75ac('0x5a')])[_0x75ac('0x12')](_0x75ac('0x5b'))[_0x75ac('0x15')](_0x75ac('0x5c'),null,_0x75ac('0x5d'))[_0x75ac('0x31')](_0x75ac('0x5e')+_0x1a5f2a);db[_0x75ac('0x5f')][_0x75ac('0x57')](_0x43a84a[_0x75ac('0x35')]())[_0x75ac('0x58')](function(_0x14e29a){var _0x31fd98=[];for(var _0x24a444=0x0;_0x24a444<_0x14e29a[_0x75ac('0x1a')];_0x24a444++){_0x31fd98['push'](getTimezoneData(_0x14e29a[_0x24a444],tmp_campaigns));}BPromise['all'](_0x31fd98)[_0x75ac('0x16')](function(){_0x3d35dc({'val':0x1});});})[_0x75ac('0x60')](function(_0x37e2ee){logger[_0x75ac('0x55')](_0x37e2ee['message']);_0x3d35dc({'val':0x0});});});}function updateTzVoiceQueues(_0x3ecc37){return new Promise(function(_0x261999,_0xc80e7){var _0x171a99=squel[_0x75ac('0x10')]()[_0x75ac('0x2f')]([_0x75ac('0x61'),_0x75ac('0x62')])['from'](_0x75ac('0x63'))[_0x75ac('0x15')](_0x75ac('0x64'),null,_0x75ac('0x65'))[_0x75ac('0x31')](_0x75ac('0x66')+_0x3ecc37);db[_0x75ac('0x5f')]['query'](_0x171a99[_0x75ac('0x35')]())[_0x75ac('0x58')](function(_0x1eb494){var _0x542bda=[];for(var _0x11f50b=0x0;_0x11f50b<_0x1eb494[_0x75ac('0x1a')];_0x11f50b++){_0x542bda[_0x75ac('0x17')](getTimezoneData(_0x1eb494[_0x11f50b],tmp_voice_queues));}BPromise[_0x75ac('0x18')](_0x542bda)['then'](function(){_0x261999({'val':0x1});});})[_0x75ac('0x60')](function(_0x5c3855){logger['error'](_0x5c3855['message']);_0x261999({'val':0x0});});});}function getTimezoneData(_0x50b7e0,_0x5bd612){return new Promise(function(_0x17c0c7,_0x5bb066){var _0xae1ae8=shared[_0x75ac('0x67')];var _0x20710e=_0xae1ae8[_0x50b7e0[_0x75ac('0x68')]];if(_[_0x75ac('0x69')](_0x20710e)){_0x17c0c7({'ret':0x1});}else{var _0x12aad9=_0x20710e[_0x75ac('0x6a')];var _0x3e918a=squel['insert']()[_0x75ac('0x38')](_0x5bd612)[_0x75ac('0x6b')]('id',_0x50b7e0['id'])[_0x75ac('0x6b')](_0x75ac('0x6c'),_0x12aad9)[_0x75ac('0x6b')](_0x75ac('0x68'),_0x50b7e0[_0x75ac('0x68')])[_0x75ac('0x35')]();return db[_0x75ac('0x5f')][_0x75ac('0x57')](_0x3e918a)[_0x75ac('0x58')](function(_0x54d5d9){_0x17c0c7({'ret':0x1});})[_0x75ac('0x60')](function(_0x2090ab){logger['error'](_0x2090ab[_0x75ac('0x56')]);_0x5bb066({'ret':0x1});});}});}function handleTZQuery(_0x4294bc){logger[_0x75ac('0x53')](_0x4294bc);return db[_0x75ac('0x5f')]['query'](_0x4294bc)[_0x75ac('0x58')](function(_0x271073){})[_0x75ac('0x60')](function(_0x25ef2e){logger['error'](_0x25ef2e[_0x75ac('0x56')]);});}function main(_0x1eadb2,_0x1ab20d,_0x418bf5,_0x2883bc){logger[_0x75ac('0x53')](_0x75ac('0x6d'),_0x1eadb2,JSON[_0x75ac('0x6e')](_0x1ab20d));process[_0x75ac('0x6f')]('start');var _0x366e3b=_0x1ab20d[_0x75ac('0x70')];var _0x463d9a=_[_0x75ac('0x71')](_0x366e3b);var _0x4bed09=_0x1ab20d[_0x75ac('0x72')];var _0x4096e6=path[_0x75ac('0x15')](config[_0x75ac('0x73')],_0x75ac('0x74'),_0x4bed09+_0x75ac('0x75'));hasTZ=_[_0x75ac('0x76')](_0x366e3b)[_0x75ac('0x77')](_0x75ac('0x68'));var _0x421bed=_['keys'](_0x366e3b)['join']();logger[_0x75ac('0x53')](_0x75ac('0x78'),_0x421bed);db['ContactItemType'][_0x75ac('0x79')]({'raw':!![],'attributes':['id',_0x75ac('0x7a')]})[_0x75ac('0x16')](function(_0x563401){for(var _0x4823b3=0x0;_0x4823b3<_0x563401[_0x75ac('0x1a')];_0x4823b3++){if(_0x563401[_0x4823b3][_0x75ac('0x7a')]in _0x366e3b){contactItemTypes[_0x75ac('0x17')](_0x563401[_0x4823b3]);delete _0x463d9a[_0x563401[_0x4823b3][_0x75ac('0x7a')]];hasAdditionalPhones=!![];}for(var _0xa2d35e in _0x366e3b){if(_0x563401[_0x4823b3][_0x75ac('0x7a')]+'_description'===_0xa2d35e){phoneDescriptions[_0x75ac('0x17')]({'itemTypeId':_0x563401[_0x4823b3]['id'],'description':_0xa2d35e});delete _0x463d9a[_0xa2d35e];}}}if(hasAdditionalPhones)_0x463d9a[_0x75ac('0x19')]='';var _0x1131fe=_[_0x75ac('0x76')](_0x463d9a)[_0x75ac('0x15')]();logger['info'](_0x75ac('0x78'),_0x1131fe);fs[_0x75ac('0x7b')](_0x4096e6,_0x1131fe+'\x0a');Papa[_0x75ac('0x7c')](fs[_0x75ac('0x7d')](_0x1eadb2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ec47c,_0x415b45){try{for(var _0x57acc7=0x0,_0x56b266=[];_0x57acc7<_0x3ec47c[_0x75ac('0x7e')][_0x75ac('0x1a')];_0x57acc7++){stats[_0x75ac('0x7f')]+=0x1;if(_0x3ec47c['errors'][_0x57acc7]){handleError(_0x3ec47c['data'][_0x57acc7],_0x3ec47c['errors'][_0x57acc7]);}else{var _0x33127c=[];var _0x32ad39=[];var _0x405345={};for(var _0x1257f2 in _0x366e3b){let _0x5c3c05=contactItemTypes[_0x75ac('0x80')](_0x4b80eb=>_0x4b80eb[_0x75ac('0x7a')]===_0x1257f2);let _0x1c0289=contactItemTypes[_0x75ac('0x80')](_0x12e5c9=>_0x12e5c9[_0x75ac('0x7a')]+_0x75ac('0x81')===_0x1257f2);if(_[_0x75ac('0x69')](_0x5c3c05)&&_[_0x75ac('0x69')](_0x1c0289)){if(_0x366e3b[_0x75ac('0x82')](_0x1257f2)){if(_0x3ec47c[_0x75ac('0x7e')][_0x57acc7][_0x366e3b[_0x1257f2]]){var _0x13e1c0=_[_0x75ac('0x83')](_0x3ec47c[_0x75ac('0x7e')][_0x57acc7][_0x366e3b[_0x1257f2]][_0x75ac('0x84')](/"/g,'\x27'));switch(_0x1257f2){case _0x75ac('0x2b'):var _0x5266fa=moment(_0x13e1c0,_0x75ac('0xf'),!![]);if(_0x5266fa['isValid']()){_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');}else{_0x33127c['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x75ac('0x85'):var _0x4ac852=parseInt(_0x13e1c0);_0x13e1c0=_[_0x75ac('0x86')](_0x4ac852)||_0x4ac852<0x0||_0x4ac852>0x4?_0x2883bc?0x3:0x2:_0x4ac852;_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');break;case _0x75ac('0x2d'):var _0xce7bc5=parseInt(_0x13e1c0);if(_[_0x75ac('0x87')](_0xce7bc5)&&_[_0x75ac('0x77')](_0x418bf5,_0xce7bc5)){_0x56b266[_0x75ac('0x17')]('\x22'+_0xce7bc5+'\x22');}else{_0x33127c[_0x75ac('0x17')](_0x75ac('0x88'));}break;case _0x75ac('0x89'):if(isEmail(_0x13e1c0)){_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');}else{_0x33127c[_0x75ac('0x17')]('email\x20wrong\x20format');}break;case _0x75ac('0x8a'):var _0x2bacfb=moment(_0x13e1c0,'YYYY-MM-DD',!![]);if(_0x2bacfb[_0x75ac('0x8b')]()){_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');}else{_0x33127c[_0x75ac('0x17')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x75ac('0x68'):var _0x1bfa2a=shared[_0x75ac('0x67')];var _0x20e554=_0x1bfa2a[_0x13e1c0];if(!_[_0x75ac('0x69')](_0x20e554)){var _0x59c048=_0x20e554['utcOffset'];_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');_0x56b266[_0x75ac('0x17')]('\x22'+_0x59c048+'\x22');}break;default:_0x56b266[_0x75ac('0x17')]('\x22'+_0x13e1c0+'\x22');}}else{switch(_0x1257f2){case _0x75ac('0x8c'):case _0x75ac('0x2a'):_0x33127c[_0x75ac('0x17')](_0x1257f2+_0x75ac('0x8d'));break;default:_0x56b266[_0x75ac('0x17')]('\x22\x22');}}}}else{var _0x54f01d='';if(!_[_0x75ac('0x69')](_0x5c3c05)){if(!_0x405345[_0x75ac('0x82')](_0x5c3c05['id'])){if(!_[_0x75ac('0x69')](_0x3ec47c[_0x75ac('0x7e')][_0x57acc7][_0x366e3b[_0x1257f2]])){var _0x13e1c0=_[_0x75ac('0x83')](_0x3ec47c['data'][_0x57acc7][_0x366e3b[_0x1257f2]][_0x75ac('0x84')](/"/g,'\x27'));var _0x194958=phoneDescriptions[_0x75ac('0x80')](_0x1b686c=>_0x1b686c['itemTypeId']===_0x5c3c05['id']);if(!_[_0x75ac('0x69')](_0x194958)){var _0x1388c0=_[_0x75ac('0x83')](_0x3ec47c[_0x75ac('0x7e')][_0x57acc7][_0x366e3b[_0x194958['description']]][_0x75ac('0x84')](/"/g,'\x27'));if(!_[_0x75ac('0x69')](_0x1388c0))_0x13e1c0=_0x13e1c0+'§'+_0x1388c0;}if(_0x54f01d=='')_0x54f01d=_0x13e1c0;else _0x54f01d+='|'+_0x13e1c0;}_0x32ad39['push'](_0x5c3c05['id']+':'+_0x54f01d);_0x405345[_0x5c3c05['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56b266['push']('\x22'+_0x32ad39[_0x75ac('0x15')](';')+'\x22');}if(_0x33127c[_0x75ac('0x1a')]){handleError(_0x3ec47c[_0x75ac('0x7e')][_0x57acc7],{'code':_0x75ac('0x8e'),'message':_0x33127c['join']()});}else{fs['appendFileSync'](_0x4096e6,_0x56b266[_0x75ac('0x15')]()+'\x0a');}_0x56b266=[];}if(!(stats[_0x75ac('0x7f')]%0xc8)){socket[_0x75ac('0x8f')](_0x75ac('0x90')+_0x4bed09,stats);stats[_0x75ac('0x91')]=[];}}if(stopped){logger[_0x75ac('0x53')](_0x75ac('0x92'));_0x415b45[_0x75ac('0x93')]();}}catch(_0x5e40b8){handleError(_0x3ec47c[_0x75ac('0x7e')][_0x57acc7],{'code':'SystemError','message':_0x5e40b8['message']});logger[_0x75ac('0x55')](_0x75ac('0x94'),_0x5e40b8[_0x75ac('0x56')]);}},'complete':function(){try{var _0xce1215=[];var _0x255b79=[];var _0x44367d='cm_contacts';if(_0x1ab20d[_0x75ac('0x95')]&&_0x1ab20d[_0x75ac('0x95')]['length']){_0x44367d=_0x75ac('0x96')+_0x4bed09;_0xce1215[_0x75ac('0x17')](_0x75ac('0x97')+_0x44367d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x4bed09;tmp_voice_queues='voice_queues_'+_0x4bed09;_0x255b79[_0x75ac('0x17')](_0x75ac('0x97')+tmp_campaigns+_0x75ac('0x98'));_0x255b79[_0x75ac('0x17')](_0x75ac('0x97')+tmp_voice_queues+_0x75ac('0x98'));BPromise[_0x75ac('0x99')](_0x255b79,handleTZQuery)[_0x75ac('0x16')](function(_0x58b382){updateTzCampaigns(_0x1ab20d[_0x75ac('0x43')])['then'](function(_0x34da64){updateTzVoiceQueues(_0x1ab20d['ListId'])['then'](function(_0x442d1b){if(hasTZ)_0x1131fe=_0x1131fe[_0x75ac('0x84')]('dialTimezone',_0x75ac('0x9a'));var _0x892b1f=util[_0x75ac('0xe')](_0x75ac('0x9b'),_0x4096e6,_0x44367d,_0x1131fe,_0x1ab20d[_0x75ac('0x43')],_0x1ab20d[_0x75ac('0x4d')]||null,NOW,NOW);if(_[_0x75ac('0x69')](_0x366e3b[_0x75ac('0x2b')])){_0x892b1f+=_0x75ac('0x9c');}_0xce1215[_0x75ac('0x17')](_0x892b1f);if(_0x1ab20d[_0x75ac('0x95')]&&_0x1ab20d['duplicates'][_0x75ac('0x1a')]){_0xce1215[_0x75ac('0x17')](insertCmContact(_0x1ab20d['ListId'],_0x44367d,_0x1ab20d[_0x75ac('0x95')],_0x366e3b));_0xce1215[_0x75ac('0x17')](_0x75ac('0x9d')+_0x44367d+';');}BPromise[_0x75ac('0x99')](_0xce1215,handleQuery)['then'](function(_0x43a676){BPromise[_0x75ac('0x18')]([handleAdditionalPhones()])[_0x75ac('0x16')](function(){_0xce1215=[];for(var _0x1fadee=0x0;_0x1fadee\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc00b,0xaa));var _0xbc00=function(_0x1bb47b,_0x54e02e){_0x1bb47b=_0x1bb47b-0x0;var _0x566418=_0xc00b[_0x1bb47b];return _0x566418;};'use strict';var fs=require('fs');var path=require(_0xbc00('0x0'));var _=require(_0xbc00('0x1'));var Papa=require(_0xbc00('0x2'));var util=require(_0xbc00('0x3'));var BPromise=require('bluebird');var moment=require(_0xbc00('0x4'));var squel=require(_0xbc00('0x5'));var Redis=require(_0xbc00('0x6'));var db=require(_0xbc00('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xbc00('0x8'));config[_0xbc00('0x9')]=_[_0xbc00('0xa')](config['redis'],{'host':_0xbc00('0xb'),'port':0x18eb});var socket=require(_0xbc00('0xc'))(new Redis(config[_0xbc00('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xbc00('0xd')](_0xbc00('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbc00('0xd')](_0xbc00('0xe'));function isEmail(_0x2a18c5){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))*$/[_0xbc00('0xf')](_0x2a18c5);}function selectNotIn(_0x34cf69,_0x4b6bfa,_0x439d0b,_0x2e3c2a,_0x2c024d){return squel[_0xbc00('0x10')]()['field']('phone')['from'](_0x2e3c2a)[_0xbc00('0x11')](_0x4b6bfa,null,_0x4b6bfa+_0xbc00('0x12')+_0x2e3c2a+'.'+_0x439d0b)[_0xbc00('0x13')](_0x2e3c2a+'.'+_0x439d0b+_0xbc00('0x14')+_0x34cf69+'.'+_0x439d0b)[_0xbc00('0x13')](_0x4b6bfa+_0xbc00('0x15')+_0x2c024d[_0xbc00('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2a28b5,_0x385b47){promisesAdditionalPhones=[];return db[_0xbc00('0x16')][_0xbc00('0x17')]({'raw':!![],'attributes':['id',_0xbc00('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbc00('0x19')](function(_0x4a13c6){if(_0x4a13c6!==null){var _0x10c27e=[];for(var _0x1ab283=0x0;_0x1ab283<_0x4a13c6[_0xbc00('0x1a')];_0x1ab283++){var _0x4ba67c=_0x4a13c6[_0x1ab283];_0x10c27e['push'](insertAdditionalPhones(_0x4ba67c));}}Promise[_0xbc00('0x1b')](_0x10c27e)[_0xbc00('0x19')](function(){_0x2a28b5({'val':0x1});});});});}function insertAdditionalPhones(_0x53d498){return new Promise(function(_0x1c27a5,_0xf47b70){var _0x5b8463=_0x53d498[_0xbc00('0x18')];var _0x3683f1=_0x5b8463[_0xbc00('0x1c')](';');var _0x2382c7=[];orderBy=0x0;for(var _0x3936ab=0x0;_0x3936ab<_0x3683f1['length'];_0x3936ab++){_0x2382c7['push'](splitAdditionalPhone(_0x53d498['id'],_0x3683f1[_0x3936ab]));}Promise[_0xbc00('0x1b')](_0x2382c7)['then'](function(){_0x1c27a5({'val':_0x3683f1[_0xbc00('0x1a')]});});});}function splitAdditionalPhone(_0x1b6161,_0x4a5ff7){return new Promise(function(_0xe4061c,_0xd94d94){var _0x3af267=_0x4a5ff7[_0xbc00('0x1c')](':');var _0x599e05=_0x3af267[0x0];var _0x1dac3b=_0x3af267[0x1];if(!_['isNil'](_0x1dac3b)){var _0x3ae1b8=_0x1dac3b[_0xbc00('0x1c')]('|');var _0xe1de1c=[];for(var _0x19b944=0x0;_0x19b944<_0x3ae1b8[_0xbc00('0x1a')];_0x19b944++){if(_0x3ae1b8[_0x19b944]!==''){var _0x5d6080=_[_0xbc00('0x1d')](promisesAdditionalPhones,{'contactId':_0x1b6161,'phone':_0x3ae1b8[_0x19b944]});if(_0x5d6080[_0xbc00('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1b6161,'contactTypeId':_0x599e05,'phone':_0x3ae1b8[_0x19b944],'orderBy':orderBy});}}}_0xe4061c({'ok':0x1});}else _0xe4061c({'res':0x0});});}function createAdditionalPhone(_0x546e2f,_0x5ce402,_0x46cdbf,_0x2c2857){var _0x460e16='';var _0x1b11c8='';var _0x10b3e3=_0x46cdbf[_0xbc00('0x1c')]('§');_0x460e16=_0x10b3e3[0x0];if(_0x10b3e3[_0xbc00('0x1a')]==0x2)_0x1b11c8=_0x10b3e3[0x1];return new Promise(function(_0x5658ca,_0x272661){return db[_0xbc00('0x1e')][_0xbc00('0x1f')]({'where':{'CmContactId':_0x546e2f,'item':_0x460e16}})['then'](function(_0xab0748){if(_0xab0748){return db[_0xbc00('0x1e')][_0xbc00('0x20')]({'ItemTypeId':_0x5ce402,'description':_0x1b11c8,'OrderBy':_0x2c2857},{'where':{'CmContactId':_0x546e2f,'item':_0x460e16}})[_0xbc00('0x19')](function(_0x4dbcce){_0x5658ca({'res':_0xbc00('0x21')});});}else{return db[_0xbc00('0x1e')]['create']({'CmContactId':_0x546e2f,'item':_0x460e16,'description':_0x1b11c8,'ItemTypeId':_0x5ce402,'OrderBy':_0x2c2857,'ItemClass':_0xbc00('0x22')})[_0xbc00('0x19')](function(_0x536f0d){_0x5658ca({'res':_0xbc00('0x23')});});}});});}function insertCmHopper(_0x345916,_0x2475bd,_0xf867cf,_0x5861c0,_0x5d8ad0){var _0x19357a=[_0xbc00('0x24'),_0xbc00('0x25'),_0xbc00('0x26'),_0xbc00('0x27'),_0x2475bd+'.'+_0x5861c0,'cm_contacts.createdAt',_0xbc00('0x28'),'cm_contacts.priority',_0xbc00('0x29'),'\x22'+_0x5d8ad0+'\x22'];return squel['insert']()[_0xbc00('0x2a')](_0xbc00('0x2b'))[_0xbc00('0x2c')]([_0xbc00('0x2d'),_0xbc00('0x2e'),_0xbc00('0x2f'),'ListId',_0x5861c0,_0xbc00('0x30'),_0xbc00('0x31'),_0xbc00('0x32'),_0xbc00('0x33'),_0xbc00('0x34')],squel['select']()[_0xbc00('0x35')](_0x19357a)[_0xbc00('0x36')](_0x2475bd)[_0xbc00('0x11')](_0xbc00('0x37'),null,_0xbc00('0x38')+_0x2475bd+_0xbc00('0x39'))['join'](_0xf867cf,null,_0xf867cf+'.id\x20=\x20'+_0x2475bd+'.'+_0x5861c0)[_0xbc00('0x13')](_0x2475bd+_0xbc00('0x3a'),_0x345916)[_0xbc00('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbc00('0x13')](_0xbc00('0x3b'),selectNotIn(_0x2475bd,_0xf867cf,_0x5861c0,_0xbc00('0x2b'),[_0xbc00('0x3c'),'\x22onlyIfOpen\x22']))['where'](_0xbc00('0x3b'),selectNotIn(_0x2475bd,_0xf867cf,_0x5861c0,_0xbc00('0x2b'),[_0xbc00('0x3c')])))[_0xbc00('0x3d')]();}function insertCmHopperBlack(_0x2757c6,_0x41924a,_0x1867c0,_0x14be1c){var _0x505a06=[_0xbc00('0x24'),_0xbc00('0x26'),_0xbc00('0x27'),_0x41924a+'.'+_0x14be1c,_0xbc00('0x3e'),_0xbc00('0x28')];return squel[_0xbc00('0x3f')]()[_0xbc00('0x2a')](_0xbc00('0x40'))[_0xbc00('0x2c')]([_0xbc00('0x2d'),_0xbc00('0x2f'),_0xbc00('0x41'),_0x14be1c,_0xbc00('0x30'),_0xbc00('0x31')],squel['select']()[_0xbc00('0x35')](_0x505a06)[_0xbc00('0x36')](_0x41924a)[_0xbc00('0x11')]('cm_contacts',null,_0xbc00('0x38')+_0x41924a+'.CmListId')[_0xbc00('0x11')](_0x1867c0,null,_0x1867c0+'.id\x20=\x20'+_0x41924a+'.'+_0x14be1c)[_0xbc00('0x13')](_0x41924a+_0xbc00('0x3a'),_0x2757c6)[_0xbc00('0x13')](_0xbc00('0x42'),NOW)[_0xbc00('0x13')](_0xbc00('0x3b'),squel[_0xbc00('0x10')]()[_0xbc00('0x43')]('phone')[_0xbc00('0x36')](_0xbc00('0x40'))['where'](_0xbc00('0x44'),_0x2757c6)['where'](_0x14be1c+_0xbc00('0x14')+_0x41924a+'.'+_0x14be1c)))[_0xbc00('0x3d')]();}function insertTzCmHopper(_0x1d03ce,_0x5cb9d9,_0x521da3,_0x3f3fdd,_0x49f998,_0x5849a0){var _0x5688f8=[_0xbc00('0x24'),_0xbc00('0x45')+_0x5849a0+_0xbc00('0x46'),_0xbc00('0x26'),'cm_contacts.ListId',_0x5cb9d9+'.'+_0x3f3fdd,_0xbc00('0x3e'),_0xbc00('0x28'),_0xbc00('0x47'),'cm_contacts.UserId','\x22'+_0x49f998+'\x22'];var _0x3159a9=squel['insert']()[_0xbc00('0x2a')](_0xbc00('0x2b'))[_0xbc00('0x2c')]([_0xbc00('0x2d'),_0xbc00('0x2e'),_0xbc00('0x2f'),_0xbc00('0x41'),_0x3f3fdd,_0xbc00('0x30'),'updatedAt',_0xbc00('0x32'),_0xbc00('0x33'),_0xbc00('0x34')],squel[_0xbc00('0x10')]()['fields'](_0x5688f8)[_0xbc00('0x36')](_0x5cb9d9)[_0xbc00('0x11')](_0xbc00('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x5cb9d9+_0xbc00('0x39'))['join'](_0x521da3,null,_0x521da3+'.id\x20=\x20'+_0x5cb9d9+'.'+_0x3f3fdd)[_0xbc00('0x11')](_0x5849a0,null,_0x5849a0+_0xbc00('0x12')+_0x5cb9d9+'.'+_0x3f3fdd)[_0xbc00('0x13')](_0x5cb9d9+_0xbc00('0x3a'),_0x1d03ce)[_0xbc00('0x13')](_0xbc00('0x42'),NOW)[_0xbc00('0x13')](_0xbc00('0x3b'),selectNotIn(_0x5cb9d9,_0x521da3,_0x3f3fdd,_0xbc00('0x2b'),[_0xbc00('0x3c'),_0xbc00('0x48')]))[_0xbc00('0x13')](_0xbc00('0x3b'),selectNotIn(_0x5cb9d9,_0x521da3,_0x3f3fdd,_0xbc00('0x2b'),[_0xbc00('0x3c')])))['toString']();return _0x3159a9;}function insertTzCmHopperBlack(_0x31902d,_0x5596e0,_0x3fdef7,_0x4319d4){var _0x24da8b=['cm_contacts.phone','cm_contacts.id',_0xbc00('0x27'),_0x5596e0+'.'+_0x4319d4,_0xbc00('0x3e'),_0xbc00('0x28')];return squel['insert']()[_0xbc00('0x2a')](_0xbc00('0x40'))[_0xbc00('0x2c')]([_0xbc00('0x2d'),_0xbc00('0x2f'),_0xbc00('0x41'),_0x4319d4,_0xbc00('0x30'),_0xbc00('0x31')],squel[_0xbc00('0x10')]()[_0xbc00('0x35')](_0x24da8b)[_0xbc00('0x36')](_0x5596e0)[_0xbc00('0x11')](_0xbc00('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x5596e0+_0xbc00('0x39'))[_0xbc00('0x11')](_0x3fdef7,null,_0x3fdef7+'.id\x20=\x20'+_0x5596e0+'.'+_0x4319d4)[_0xbc00('0x13')](_0x5596e0+_0xbc00('0x3a'),_0x31902d)['where'](_0xbc00('0x42'),NOW)[_0xbc00('0x13')](_0xbc00('0x3b'),squel['select']()['field'](_0xbc00('0x2d'))[_0xbc00('0x36')](_0xbc00('0x40'))['where']('ListId\x20=\x20?',_0x31902d)[_0xbc00('0x13')](_0x4319d4+'\x20=\x20'+_0x5596e0+'.'+_0x4319d4)))['toString']();}function insertCmHopperAdditionalPhones(_0xddaf3a){var _0x3c3ac0=[_0xbc00('0x49'),_0xbc00('0x4a'),_0xbc00('0x4b'),_0xbc00('0x4c'),_0xbc00('0x4d')];return squel[_0xbc00('0x3f')]()[_0xbc00('0x2a')](_0xbc00('0x4e'))[_0xbc00('0x2c')]([_0xbc00('0x4f'),'phone','OrderBy',_0xbc00('0x30'),_0xbc00('0x31')],squel[_0xbc00('0x10')]()[_0xbc00('0x35')](_0x3c3ac0)[_0xbc00('0x36')]('cm_hopper')[_0xbc00('0x11')]('cm_contacts',null,_0xbc00('0x50'))[_0xbc00('0x11')](_0xbc00('0x51'),null,_0xbc00('0x52'))[_0xbc00('0x13')](_0xbc00('0x53'),_0xddaf3a)[_0xbc00('0x13')](_0xbc00('0x42'),NOW))[_0xbc00('0x3d')]();}function insertCmContact(_0x2d8905,_0x13a19f,_0x12b8ac,_0x5610a2){var _0x24cf33=_[_0xbc00('0x54')](_['keys'](_0x5610a2),[_0xbc00('0x41'),_0xbc00('0x55'),'createdAt','updatedAt',_0xbc00('0x56')]);return squel[_0xbc00('0x3f')]()[_0xbc00('0x2a')](_0xbc00('0x37'))['fromQuery'](_0x24cf33,squel[_0xbc00('0x10')]()[_0xbc00('0x35')](_0x24cf33)[_0xbc00('0x36')](_0x13a19f)[_0xbc00('0x13')]('('+_0x12b8ac['join'](',')+_0xbc00('0x57'),squel[_0xbc00('0x10')]()[_0xbc00('0x35')](_0x12b8ac)['from'](_0xbc00('0x37'))[_0xbc00('0x13')](_0xbc00('0x44'),_0x2d8905)[_0xbc00('0x13')](_0xbc00('0x58')))['where'](_0xbc00('0x59'),squel[_0xbc00('0x10')]()['field'](_0xbc00('0x5a'),_0xbc00('0x5b'))[_0xbc00('0x36')](_0x13a19f)[_0xbc00('0x5c')](_0x12b8ac[_0xbc00('0x11')](','))))[_0xbc00('0x3d')]();}function handleStop(){logger[_0xbc00('0x5d')](_0xbc00('0x5e'));stopped=!![];}function handleUncaughtException(_0x5d96ed){logger[_0xbc00('0x5f')](_0x5d96ed[_0xbc00('0x60')]);process[_0xbc00('0x61')](0x1);}function handleError(_0x232253,_0x25a78c){stats[_0xbc00('0x62')]['push']({'name':_0x25a78c[_0xbc00('0x63')],'message':_0x25a78c['message'],'row':_0x232253});}function handleQuery(_0x1094d9){logger[_0xbc00('0x5d')](_0x1094d9);return db['sequelize'][_0xbc00('0x64')](_0x1094d9)[_0xbc00('0x65')](function(_0x3a0b75){results[_0xbc00('0x66')](_0x3a0b75);})[_0xbc00('0x67')](function(_0x110fb3){logger[_0xbc00('0x5f')](_0x110fb3[_0xbc00('0x60')]);});}function updateTzCampaigns(_0x29e855){return new Promise(function(_0x551b12,_0x52aefd){var _0x30d096=squel[_0xbc00('0x10')]()[_0xbc00('0x35')]([_0xbc00('0x68'),_0xbc00('0x69')])['from']('campaigns')[_0xbc00('0x11')](_0xbc00('0x6a'),null,_0xbc00('0x6b'))[_0xbc00('0x13')](_0xbc00('0x6c')+_0x29e855);db['sequelize'][_0xbc00('0x64')](_0x30d096['toString']())['spread'](function(_0x26df01){var _0x19a225=[];for(var _0x1b69d1=0x0;_0x1b69d1<_0x26df01[_0xbc00('0x1a')];_0x1b69d1++){_0x19a225[_0xbc00('0x66')](getTimezoneData(_0x26df01[_0x1b69d1],tmp_campaigns));}BPromise[_0xbc00('0x1b')](_0x19a225)[_0xbc00('0x19')](function(){_0x551b12({'val':0x1});});})[_0xbc00('0x67')](function(_0x1a71f7){logger[_0xbc00('0x5f')](_0x1a71f7['message']);_0x551b12({'val':0x0});});});}function updateTzVoiceQueues(_0x233890){return new Promise(function(_0x1c175a,_0x5ebc72){var _0xfd2e6d=squel['select']()['fields']([_0xbc00('0x6d'),_0xbc00('0x6e')])['from']('voice_queues')['join'](_0xbc00('0x6f'),null,_0xbc00('0x70'))[_0xbc00('0x13')]('voice_queues_has_cm_lists.CmListId='+_0x233890);db[_0xbc00('0x71')]['query'](_0xfd2e6d[_0xbc00('0x3d')]())[_0xbc00('0x65')](function(_0x1294fe){var _0x1a6827=[];for(var _0x2184a0=0x0;_0x2184a0<_0x1294fe['length'];_0x2184a0++){_0x1a6827[_0xbc00('0x66')](getTimezoneData(_0x1294fe[_0x2184a0],tmp_voice_queues));}BPromise['all'](_0x1a6827)['then'](function(){_0x1c175a({'val':0x1});});})[_0xbc00('0x67')](function(_0x263d46){logger[_0xbc00('0x5f')](_0x263d46[_0xbc00('0x60')]);_0x1c175a({'val':0x0});});});}function getTimezoneData(_0x36b537,_0x2b6168){return new Promise(function(_0x7a433f,_0x16690e){var _0x218e83=shared[_0xbc00('0x72')];var _0x324b58=_0x218e83[_0x36b537[_0xbc00('0x73')]];if(_[_0xbc00('0x74')](_0x324b58)){_0x7a433f({'ret':0x1});}else{var _0x4b25ec=_0x324b58[_0xbc00('0x75')];var _0x4d1ded=squel[_0xbc00('0x3f')]()['into'](_0x2b6168)[_0xbc00('0x76')]('id',_0x36b537['id'])[_0xbc00('0x76')](_0xbc00('0x77'),_0x4b25ec)[_0xbc00('0x76')]('dialTimezone',_0x36b537[_0xbc00('0x73')])[_0xbc00('0x3d')]();return db[_0xbc00('0x71')][_0xbc00('0x64')](_0x4d1ded)['spread'](function(_0x4acd51){_0x7a433f({'ret':0x1});})['catch'](function(_0x5f53c0){logger['error'](_0x5f53c0['message']);_0x16690e({'ret':0x1});});}});}function handleTZQuery(_0x298e34){logger['info'](_0x298e34);return db[_0xbc00('0x71')][_0xbc00('0x64')](_0x298e34)['spread'](function(_0x1c8fd5){})[_0xbc00('0x67')](function(_0x32e197){logger[_0xbc00('0x5f')](_0x32e197[_0xbc00('0x60')]);});}function main(_0x9620a1,_0x34b8e4,_0x52fbdf,_0xf0894b){logger[_0xbc00('0x5d')](_0xbc00('0x78'),_0x9620a1,JSON['stringify'](_0x34b8e4));process['send']('start');var _0x1be181=_0x34b8e4[_0xbc00('0x79')];var _0x33a00b=_[_0xbc00('0x7a')](_0x1be181);var _0x5bf0d8=_0x34b8e4['socket_timestamp'];var _0x37a085=path['join'](config[_0xbc00('0x7b')],_0xbc00('0x7c'),_0x5bf0d8+_0xbc00('0x7d'));hasTZ=_[_0xbc00('0x7e')](_0x1be181)[_0xbc00('0x7f')](_0xbc00('0x73'));var _0x2389ab=_[_0xbc00('0x7e')](_0x1be181)['join']();logger[_0xbc00('0x5d')](_0xbc00('0x80'),_0x2389ab);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0xbc00('0x81')]})[_0xbc00('0x19')](function(_0x4732b4){for(var _0x32180c=0x0;_0x32180c<_0x4732b4[_0xbc00('0x1a')];_0x32180c++){if(_0x4732b4[_0x32180c][_0xbc00('0x81')]in _0x1be181){contactItemTypes[_0xbc00('0x66')](_0x4732b4[_0x32180c]);delete _0x33a00b[_0x4732b4[_0x32180c][_0xbc00('0x81')]];hasAdditionalPhones=!![];}for(var _0x3b633d in _0x1be181){if(_0x4732b4[_0x32180c][_0xbc00('0x81')]+_0xbc00('0x82')===_0x3b633d){phoneDescriptions[_0xbc00('0x66')]({'itemTypeId':_0x4732b4[_0x32180c]['id'],'description':_0x3b633d});delete _0x33a00b[_0x3b633d];}}}if(hasAdditionalPhones)_0x33a00b['AdditionalPhones']='';var _0x67b3ec=_[_0xbc00('0x7e')](_0x33a00b)[_0xbc00('0x11')]();logger['info'](_0xbc00('0x80'),_0x67b3ec);fs['writeFileSync'](_0x37a085,_0x67b3ec+'\x0a');Papa[_0xbc00('0x83')](fs['createReadStream'](_0x9620a1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x285634,_0x34ed1e){try{for(var _0x45dfd9=0x0,_0x487aa8=[];_0x45dfd9<_0x285634[_0xbc00('0x84')][_0xbc00('0x1a')];_0x45dfd9++){stats[_0xbc00('0x85')]+=0x1;if(_0x285634[_0xbc00('0x62')][_0x45dfd9]){handleError(_0x285634['data'][_0x45dfd9],_0x285634[_0xbc00('0x62')][_0x45dfd9]);}else{var _0x450ea0=[];var _0x3fb29d=[];var _0x36f394={};for(var _0x82cdb7 in _0x1be181){let _0x3c81bd=contactItemTypes[_0xbc00('0x86')](_0x4889f4=>_0x4889f4['name']===_0x82cdb7);let _0x4bcda4=contactItemTypes['find'](_0x228cb4=>_0x228cb4[_0xbc00('0x81')]+_0xbc00('0x82')===_0x82cdb7);if(_[_0xbc00('0x74')](_0x3c81bd)&&_[_0xbc00('0x74')](_0x4bcda4)){if(_0x1be181[_0xbc00('0x87')](_0x82cdb7)){if(_0x285634[_0xbc00('0x84')][_0x45dfd9][_0x1be181[_0x82cdb7]]){var _0x2b96af=_['trim'](_0x285634['data'][_0x45dfd9][_0x1be181[_0x82cdb7]][_0xbc00('0x88')](/"/g,'\x27'));switch(_0x82cdb7){case _0xbc00('0x2e'):var _0x5b9e23=moment(_0x2b96af,_0xbc00('0xe'),!![]);if(_0x5b9e23[_0xbc00('0x89')]()){_0x487aa8[_0xbc00('0x66')]('\x22'+_0x2b96af+'\x22');}else{_0x450ea0['push'](_0xbc00('0x8a'));}break;case'priority':var _0x437a2a=parseInt(_0x2b96af);_0x2b96af=_[_0xbc00('0x8b')](_0x437a2a)||_0x437a2a<0x0||_0x437a2a>0x4?_0xf0894b?0x3:0x2:_0x437a2a;_0x487aa8['push']('\x22'+_0x2b96af+'\x22');break;case'UserId':var _0x2be72d=parseInt(_0x2b96af);if(_[_0xbc00('0x8c')](_0x2be72d)&&_[_0xbc00('0x7f')](_0x52fbdf,_0x2be72d)){_0x487aa8['push']('\x22'+_0x2be72d+'\x22');}else{_0x450ea0['push']('agent\x20not\x20exists');}break;case _0xbc00('0x8d'):if(isEmail(_0x2b96af)){_0x487aa8[_0xbc00('0x66')]('\x22'+_0x2b96af+'\x22');}else{_0x450ea0[_0xbc00('0x66')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x48b751=moment(_0x2b96af,_0xbc00('0x8e'),!![]);if(_0x48b751[_0xbc00('0x89')]()){_0x487aa8[_0xbc00('0x66')]('\x22'+_0x2b96af+'\x22');}else{_0x450ea0[_0xbc00('0x66')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xbc00('0x73'):var _0x41ed39=shared['timezones'];var _0x5a9e5f=_0x41ed39[_0x2b96af];if(!_[_0xbc00('0x74')](_0x5a9e5f)){var _0x31cef8=_0x5a9e5f[_0xbc00('0x75')];_0x487aa8['push']('\x22'+_0x2b96af+'\x22');_0x487aa8[_0xbc00('0x66')]('\x22'+_0x31cef8+'\x22');}break;default:_0x487aa8[_0xbc00('0x66')]('\x22'+_0x2b96af+'\x22');}}else{switch(_0x82cdb7){case _0xbc00('0x8f'):case'phone':_0x450ea0[_0xbc00('0x66')](_0x82cdb7+_0xbc00('0x90'));break;default:_0x487aa8[_0xbc00('0x66')]('\x22\x22');}}}}else{var _0x296245='';if(!_[_0xbc00('0x74')](_0x3c81bd)){if(!_0x36f394[_0xbc00('0x87')](_0x3c81bd['id'])){if(!_[_0xbc00('0x74')](_0x285634[_0xbc00('0x84')][_0x45dfd9][_0x1be181[_0x82cdb7]])){var _0x2b96af=_[_0xbc00('0x91')](_0x285634[_0xbc00('0x84')][_0x45dfd9][_0x1be181[_0x82cdb7]][_0xbc00('0x88')](/"/g,'\x27'));var _0x3ec2a5=phoneDescriptions[_0xbc00('0x86')](_0x457b6b=>_0x457b6b[_0xbc00('0x92')]===_0x3c81bd['id']);if(!_[_0xbc00('0x74')](_0x3ec2a5)){var _0xc71bc1=_['trim'](_0x285634['data'][_0x45dfd9][_0x1be181[_0x3ec2a5[_0xbc00('0x93')]]][_0xbc00('0x88')](/"/g,'\x27'));if(!_[_0xbc00('0x74')](_0xc71bc1))_0x2b96af=_0x2b96af+'§'+_0xc71bc1;}if(_0x296245=='')_0x296245=_0x2b96af;else _0x296245+='|'+_0x2b96af;}_0x3fb29d['push'](_0x3c81bd['id']+':'+_0x296245);_0x36f394[_0x3c81bd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x487aa8[_0xbc00('0x66')]('\x22'+_0x3fb29d[_0xbc00('0x11')](';')+'\x22');}if(_0x450ea0[_0xbc00('0x1a')]){handleError(_0x285634['data'][_0x45dfd9],{'code':_0xbc00('0x94'),'message':_0x450ea0[_0xbc00('0x11')]()});}else{fs[_0xbc00('0x95')](_0x37a085,_0x487aa8['join']()+'\x0a');}_0x487aa8=[];}if(!(stats[_0xbc00('0x85')]%0xc8)){socket['emit'](_0xbc00('0x96')+_0x5bf0d8,stats);stats[_0xbc00('0x62')]=[];}}if(stopped){logger['info'](_0xbc00('0x97'));_0x34ed1e[_0xbc00('0x98')]();}}catch(_0x2a579e){handleError(_0x285634['data'][_0x45dfd9],{'code':_0xbc00('0x99'),'message':_0x2a579e[_0xbc00('0x60')]});logger[_0xbc00('0x5f')](_0xbc00('0x9a'),_0x2a579e['message']);}},'complete':function(){try{var _0xdcee29=[];var _0xf42314=[];var _0x245733=_0xbc00('0x37');if(_0x34b8e4[_0xbc00('0x9b')]&&_0x34b8e4[_0xbc00('0x9b')][_0xbc00('0x1a')]){_0x245733='cm_contacts_'+_0x5bf0d8;_0xdcee29[_0xbc00('0x66')]('CREATE\x20TABLE\x20'+_0x245733+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xbc00('0x9c')+_0x5bf0d8;tmp_voice_queues='voice_queues_'+_0x5bf0d8;_0xf42314[_0xbc00('0x66')](_0xbc00('0x9d')+tmp_campaigns+_0xbc00('0x9e'));_0xf42314[_0xbc00('0x66')](_0xbc00('0x9d')+tmp_voice_queues+_0xbc00('0x9e'));BPromise[_0xbc00('0x9f')](_0xf42314,handleTZQuery)['then'](function(_0x2be342){updateTzCampaigns(_0x34b8e4['ListId'])['then'](function(_0x19cf45){updateTzVoiceQueues(_0x34b8e4['ListId'])[_0xbc00('0x19')](function(_0x13b5ae){if(hasTZ)_0x67b3ec=_0x67b3ec[_0xbc00('0x88')]('dialTimezone','dialTimezone,utcOffset');var _0x6baa44=util[_0xbc00('0xd')](_0xbc00('0xa0'),_0x37a085,_0x245733,_0x67b3ec,_0x34b8e4['ListId'],_0x34b8e4['CompanyId']||null,NOW,NOW);if(_[_0xbc00('0x74')](_0x1be181['scheduledat'])){_0x6baa44+=_0xbc00('0xa1');}_0xdcee29['push'](_0x6baa44);if(_0x34b8e4[_0xbc00('0x9b')]&&_0x34b8e4[_0xbc00('0x9b')][_0xbc00('0x1a')]){_0xdcee29[_0xbc00('0x66')](insertCmContact(_0x34b8e4[_0xbc00('0x41')],_0x245733,_0x34b8e4[_0xbc00('0x9b')],_0x1be181));_0xdcee29[_0xbc00('0x66')](_0xbc00('0xa2')+_0x245733+';');}BPromise[_0xbc00('0x9f')](_0xdcee29,handleQuery)[_0xbc00('0x19')](function(_0x413de1){BPromise['all']([handleAdditionalPhones()])[_0xbc00('0x19')](function(){_0xdcee29=[];for(var _0x22cde3=0x0;_0x22cde3_0x56d3b9['name']===_0x3be957);let _0x16db6f=contactItemTypes[_0x4cdb('0x6e')](_0x35fedd=>_0x35fedd[_0x4cdb('0x65')]+_0x4cdb('0x66')===_0x3be957);if(_[_0x4cdb('0x1c')](_0x7b969d)&&_[_0x4cdb('0x1c')](_0x16db6f)){if(_0x456ef1[_0x4cdb('0x6f')](_0x3be957)){if(_0x172bd9[_0x4cdb('0x6b')][_0x13e21a][_0x456ef1[_0x3be957]]){var _0x4ced72=_[_0x4cdb('0x70')](_0x172bd9['data'][_0x13e21a][_0x456ef1[_0x3be957]]['replace'](/"/g,'\x27'));switch(_0x3be957){case _0x4cdb('0x37'):var _0x4d5c3c=moment(_0x4ced72,_0x4cdb('0xb'),!![]);if(_0x4d5c3c[_0x4cdb('0x71')]()){_0x5a92a6['push']('\x22'+_0x4ced72+'\x22');}else{_0x487724[_0x4cdb('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x4cdb('0x3b'):var _0x483ed0=parseInt(_0x4ced72);_0x4ced72=_['isNaN'](_0x483ed0)||_0x483ed0<0x0||_0x483ed0>0x4?_0x3dde14?0x3:0x2:_0x483ed0;_0x5a92a6[_0x4cdb('0x1e')]('\x22'+_0x4ced72+'\x22');break;case _0x4cdb('0x3c'):var _0x350207=parseInt(_0x4ced72);if(_['isNumber'](_0x350207)&&_['includes'](_0xc47c04,_0x350207)){_0x5a92a6[_0x4cdb('0x1e')]('\x22'+_0x350207+'\x22');}else{_0x487724[_0x4cdb('0x1e')](_0x4cdb('0x72'));}break;case _0x4cdb('0x73'):if(isEmail(_0x4ced72)){_0x5a92a6[_0x4cdb('0x1e')]('\x22'+_0x4ced72+'\x22');}else{_0x487724[_0x4cdb('0x1e')](_0x4cdb('0x74'));}break;case _0x4cdb('0x75'):var _0x137556=moment(_0x4ced72,_0x4cdb('0x76'),!![]);if(_0x137556[_0x4cdb('0x71')]()){_0x5a92a6['push']('\x22'+_0x4ced72+'\x22');}else{_0x487724[_0x4cdb('0x1e')](_0x4cdb('0x77'));}break;default:_0x5a92a6[_0x4cdb('0x1e')]('\x22'+_0x4ced72+'\x22');}}else{switch(_0x3be957){case _0x4cdb('0x78'):case _0x4cdb('0x11'):_0x487724[_0x4cdb('0x1e')](_0x3be957+_0x4cdb('0x79'));break;default:_0x5a92a6['push']('\x22\x22');}}}}else{var _0x1d8276='';if(!_[_0x4cdb('0x1c')](_0x7b969d)){if(!_0x4fbd73['hasOwnProperty'](_0x7b969d['id'])){for(var _0x1bef4f=0x0;_0x1bef4f<_0x456ef1[_0x3be957][_0x4cdb('0x1b')];_0x1bef4f++){var _0x4ced72=_[_0x4cdb('0x70')](_0x172bd9[_0x4cdb('0x6b')][_0x13e21a][_0x456ef1[_0x3be957][_0x1bef4f]]['replace'](/"/g,'\x27'));var _0x16c6b8=phoneDescriptions[_0x4cdb('0x6e')](_0x3258a3=>_0x3258a3['itemTypeId']===_0x7b969d['id']);if(!_[_0x4cdb('0x1c')](_0x16c6b8)){var _0x5dd5cb=_[_0x4cdb('0x70')](_0x172bd9[_0x4cdb('0x6b')][_0x13e21a][_0x456ef1[_0x16c6b8[_0x4cdb('0x7a')]][0x0]][_0x4cdb('0x7b')](/"/g,'\x27'));if(!_[_0x4cdb('0x1c')](_0x5dd5cb))_0x4ced72=_0x4ced72+'§'+_0x5dd5cb;}if(_0x1d8276=='')_0x1d8276=_0x4ced72;else _0x1d8276+='|'+_0x4ced72;}_0x9b501c['push'](_0x7b969d['id']+':'+_0x1d8276);_0x4fbd73[_0x7b969d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5a92a6[_0x4cdb('0x1e')]('\x22'+_0x9b501c['join'](';')+'\x22');}if(_0x487724['length']){handleError(_0x172bd9[_0x4cdb('0x6b')][_0x13e21a],{'code':'SystemRow','message':_0x487724[_0x4cdb('0x13')]()});}else{fs[_0x4cdb('0x7c')](_0x53ae51,_0x5a92a6['join']()+'\x0a');}_0x5a92a6=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x4cdb('0x7d')+_0x5c6811,stats);stats[_0x4cdb('0x6d')]=[];}}if(stopped){logger[_0x4cdb('0x56')](_0x4cdb('0x7e'));_0x15064a['abort']();}}catch(_0x3aa096){handleError(_0x172bd9[_0x4cdb('0x6b')][_0x13e21a],{'code':_0x4cdb('0x7f'),'message':_0x3aa096[_0x4cdb('0x22')]});logger[_0x4cdb('0x21')](_0x4cdb('0x80'),_0x3aa096[_0x4cdb('0x22')]);}},'complete':function(){try{var _0xff49dd=[];var _0x3bf3d5=tempTableName;_0xff49dd[_0x4cdb('0x1e')](_0x4cdb('0x81')+_0x3bf3d5+_0x4cdb('0x82'));logger[_0x4cdb('0x56')](_0x4cdb('0x83'),contactItemTypes[_0x4cdb('0x1b')]);var _0x4b7a87=util[_0x4cdb('0xd')]('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',_0x53ae51,_0x3bf3d5,_0x4ed28a,_0x3df9cf[_0x4cdb('0x54')],_0x3df9cf[_0x4cdb('0x84')]||null,NOW,NOW);if(_[_0x4cdb('0x1c')](_0x456ef1['scheduledat'])){_0x4b7a87+=_0x4cdb('0x85');}_0xff49dd[_0x4cdb('0x1e')](_0x4b7a87);BPromise[_0x4cdb('0x86')](_0xff49dd,handleQuery)['then'](function(_0xeeb886){BPromise[_0x4cdb('0x1f')]([handleAdditionalPhones()])[_0x4cdb('0x20')](function(){_0xff49dd=[];for(var _0x3bb955=0x0;_0x3bb955\x20\x20');}var _0x1e1165=path[_0x4cdb('0x13')](config[_0x4cdb('0x60')],_0x4cdb('0x61'),process['argv'][0x2]);if(!fs[_0x4cdb('0x90')](_0x1e1165)){throw new Error(_0x4cdb('0x91'));}var _0x16b8ea={};try{_0x16b8ea=JSON['parse'](process[_0x4cdb('0x8f')][0x3]);if(!_0x16b8ea[_0x4cdb('0x5e')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x3fa981=0x0;if(_0x16b8ea['binding'][_0x4cdb('0x3c')]){_0x3fa981=0x1;}if(!_0x16b8ea[_0x4cdb('0x54')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x228a0c){throw new Error('body\x20id\x20mandatory');}var _0x15de5e=[];try{_0x15de5e=_[_0x4cdb('0x92')](JSON['parse'](process[_0x4cdb('0x8f')][0x4]),'id');}catch(_0x293f56){logger[_0x4cdb('0x56')](_0x4cdb('0x93'));}main(_0x1e1165,_0x16b8ea,_0x15de5e,_0x3fa981);}validate();process['on'](_0x4cdb('0x94'),handleStop);process['on'](_0x4cdb('0x95'),handleUncaughtException); \ No newline at end of file +var _0x5919=['YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','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','all','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','emit','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','then','error','AdditionalPhones','split','filter','CmContactHasItem','findOne','update','create','PHONE','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','ListId','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','message','catch','main','stringify','start','binding','clone','server/files/tmp','.csv','body','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth'];(function(_0x461ba7,_0x1fe4ff){var _0x46a23f=function(_0x591597){while(--_0x591597){_0x461ba7['push'](_0x461ba7['shift']());}};_0x46a23f(++_0x1fe4ff);}(_0x5919,0x15d));var _0x9591=function(_0x27567e,_0x2f60b0){_0x27567e=_0x27567e-0x0;var _0xb71bfe=_0x5919[_0x27567e];return _0xb71bfe;};'use strict';var fs=require('fs');var path=require(_0x9591('0x0'));var _=require(_0x9591('0x1'));var Papa=require('papaparse');var util=require(_0x9591('0x2'));var BPromise=require(_0x9591('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x9591('0x4'));var db=require(_0x9591('0x5'))['db'];var config=require(_0x9591('0x6'));var logger=require(_0x9591('0x7'))(_0x9591('0x8'));config[_0x9591('0x9')]=_['defaults'](config[_0x9591('0x9')],{'host':_0x9591('0xa'),'port':0x18eb});var socket=require(_0x9591('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x9591('0xc')](_0x9591('0xd'));var tempTableName='cm_contacts_temp_'+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x39f28a){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))*$/[_0x9591('0xe')](_0x39f28a);}function selectNotIn(_0x29d373,_0x5cb4fd,_0x5e07d6,_0x424753,_0x2099cb){return squel[_0x9591('0xf')]()[_0x9591('0x10')](_0x9591('0x11'))[_0x9591('0x12')](_0x424753)['join'](_0x5cb4fd,null,_0x5cb4fd+_0x9591('0x13')+_0x424753+'.'+_0x5e07d6)['where'](_0x424753+'.'+_0x5e07d6+'\x20=\x20'+_0x29d373+'.'+_0x5e07d6)['where'](_0x5cb4fd+'.dialCheckDuplicateType\x20IN\x20('+_0x2099cb[_0x9591('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24d4fb,_0x42f6c6){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9591('0x15')][_0x9591('0x16')](_0x9591('0x17')+tempTableName)[_0x9591('0x18')](function(_0x2725a2){if(_0x2725a2!==null){var _0x455b14=[];for(var _0x37363c=0x0;_0x37363c<_0x2725a2[_0x9591('0x19')];_0x37363c++){var _0x40a735=_0x2725a2[_0x37363c];if(!_[_0x9591('0x1a')](_0x40a735[_0x9591('0x11')])){if(!_[_0x9591('0x1a')](_0x40a735['AdditionalPhones']))_0x455b14[_0x9591('0x1b')](insertAdditionalPhones(_0x40a735));promisesContact[_0x9591('0x1b')]({'contact':_0x40a735});}}}Promise['all'](_0x455b14)[_0x9591('0x1c')](function(){_0x24d4fb({'val':0x1});});})['catch'](function(_0x574104){logger[_0x9591('0x1d')](_0x574104['message']);});});}function insertAdditionalPhones(_0x1e83e6){return new Promise(function(_0x4c53dc,_0x81c5bd){var _0x1f1709=_0x1e83e6[_0x9591('0x1e')];if(_['isNil'](_0x1f1709))_0x81c5bd({'val':0x0});else{var _0x7d77a9=_0x1f1709[_0x9591('0x1f')](';');var _0x1c83e0=[];orderBy=0x0;for(var _0x5ee9a7=0x0;_0x5ee9a7<_0x7d77a9[_0x9591('0x19')];_0x5ee9a7++){_0x1c83e0['push'](splitAdditionalPhone(_0x1e83e6['id'],_0x7d77a9[_0x5ee9a7]));}Promise['all'](_0x1c83e0)[_0x9591('0x1c')](function(){_0x4c53dc({'val':_0x7d77a9[_0x9591('0x19')]});});}});}function splitAdditionalPhone(_0x1f73e7,_0x474f73){return new Promise(function(_0x26b7d4,_0xaa1ed1){var _0x57def9=_0x474f73[_0x9591('0x1f')](':');var _0x2b093a=_0x57def9[0x0];var _0x3d2af9=_0x57def9[0x1];if(_0x3d2af9!==''){var _0x49464c=_0x3d2af9['split']('|');var _0x237c09=[];for(var _0x3c0148=0x0;_0x3c0148<_0x49464c[_0x9591('0x19')];_0x3c0148++){if(_0x49464c[_0x3c0148]!==''){var _0xf198b0=_[_0x9591('0x20')](promisesAdditionalPhones,{'contactId':_0x1f73e7,'phone':_0x49464c[_0x3c0148]});if(_0xf198b0[_0x9591('0x19')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1f73e7,'contactTypeId':_0x2b093a,'phone':_0x49464c[_0x3c0148],'orderBy':orderBy});}}}_0x26b7d4({'ok':0x1});}else _0x26b7d4({'res':0x0});});}function createAdditionalPhone(_0x49ac73,_0x11592b,_0xfbb60,_0x566079){var _0x26ce9a='';var _0x44d543='';var _0x1c1c4a=_0xfbb60[_0x9591('0x1f')]('§');_0x26ce9a=_0x1c1c4a[0x0];if(_0x1c1c4a[_0x9591('0x19')]==0x2)_0x44d543=_0x1c1c4a[0x1];return new Promise(function(_0x5074ba,_0x4562a7){return db[_0x9591('0x21')][_0x9591('0x22')]({'where':{'CmContactId':_0x49ac73,'item':_0x26ce9a}})[_0x9591('0x1c')](function(_0x19b5e4){if(_0x19b5e4){return db[_0x9591('0x21')][_0x9591('0x23')]({'ItemTypeId':_0x11592b,'description':_0x44d543,'OrderBy':_0x566079},{'where':{'CmContactId':_0x49ac73,'item':_0x26ce9a}})[_0x9591('0x1c')](function(_0x1c0617){_0x5074ba({'res':'updated'});});}else{return db[_0x9591('0x21')][_0x9591('0x24')]({'CmContactId':_0x49ac73,'item':_0x26ce9a,'ItemTypeId':_0x11592b,'description':_0x44d543,'OrderBy':_0x566079,'ItemClass':_0x9591('0x25')})[_0x9591('0x1c')](function(_0x5f3caf){_0x5074ba({'res':'inserted'});});}});});}function updateContact(_0x5e360b){return new Promise(function(_0x2977d4,_0x47a8d2){var _0x577478=_0x5e360b['id'];delete _0x5e360b['id'];return db['CmContact']['update'](_0x5e360b,{'where':{'id':_0x577478}})[_0x9591('0x1c')](function(_0x56c545){updatedRows+=0x1;return db[_0x9591('0x26')]['update']({'phone':_0x5e360b[_0x9591('0x11')]},{'where':{'ContactId':_0x577478}})['then'](function(_0x34f6d6){_0x2977d4({'ret':'OK'});});});});}function insertCmHopper(_0x156ab3,_0x7e4a1,_0x4a6d2b,_0x4cc976,_0x34f134){var _0x548d18=['cm_contacts.phone',_0x9591('0x27'),_0x9591('0x28'),'cm_contacts.ListId',_0x7e4a1+'.'+_0x4cc976,_0x9591('0x29'),_0x9591('0x2a'),_0x9591('0x2b'),_0x9591('0x2c'),'\x22'+_0x34f134+'\x22'];return squel[_0x9591('0x2d')]()[_0x9591('0x2e')](_0x9591('0x2f'))[_0x9591('0x30')]([_0x9591('0x11'),_0x9591('0x31'),_0x9591('0x32'),'ListId',_0x4cc976,_0x9591('0x33'),_0x9591('0x34'),_0x9591('0x35'),_0x9591('0x36'),'recallme'],squel[_0x9591('0xf')]()['fields'](_0x548d18)['from'](_0x7e4a1)[_0x9591('0x14')](_0x9591('0x37'),null,_0x9591('0x38')+_0x7e4a1+_0x9591('0x39'))[_0x9591('0x14')](_0x4a6d2b,null,_0x4a6d2b+_0x9591('0x13')+_0x7e4a1+'.'+_0x4cc976)[_0x9591('0x3a')](_0x7e4a1+_0x9591('0x3b'),_0x156ab3)['where'](_0x9591('0x3c'),NOW)[_0x9591('0x3a')](_0x9591('0x3d'),selectNotIn(_0x7e4a1,_0x4a6d2b,_0x4cc976,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x9591('0x3a')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x7e4a1,_0x4a6d2b,_0x4cc976,'cm_hopper',['\x22always\x22'])))[_0x9591('0x3e')]();}function insertCmHopperBlack(_0x478202,_0x28fd21,_0x4d3dc2,_0xa76b2e){var _0x250e8b=[_0x9591('0x3f'),_0x9591('0x28'),_0x9591('0x40'),_0x28fd21+'.'+_0xa76b2e,_0x9591('0x29'),_0x9591('0x2a')];return squel[_0x9591('0x2d')]()['into'](_0x9591('0x41'))[_0x9591('0x30')]([_0x9591('0x11'),_0x9591('0x32'),_0x9591('0x42'),_0xa76b2e,_0x9591('0x33'),_0x9591('0x34')],squel[_0x9591('0xf')]()['fields'](_0x250e8b)['from'](_0x28fd21)[_0x9591('0x14')](_0x9591('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x28fd21+_0x9591('0x39'))[_0x9591('0x14')](_0x4d3dc2,null,_0x4d3dc2+'.id\x20=\x20'+_0x28fd21+'.'+_0xa76b2e)[_0x9591('0x3a')](_0x28fd21+_0x9591('0x3b'),_0x478202)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9591('0xf')]()[_0x9591('0x10')](_0x9591('0x11'))[_0x9591('0x12')](_0x9591('0x41'))['where'](_0x9591('0x43'),_0x478202)[_0x9591('0x3a')](_0xa76b2e+_0x9591('0x44'),_0x28fd21+'.'+_0xa76b2e)))[_0x9591('0x3e')]();}function insertCmHopperAdditionalPhones(_0x48756){var _0x8df2c2=['cm_hopper.id',_0x9591('0x45'),_0x9591('0x46'),_0x9591('0x47'),_0x9591('0x48')];return squel['insert']()[_0x9591('0x2e')]('cm_hopper_additional_phones')[_0x9591('0x30')]([_0x9591('0x49'),_0x9591('0x11'),'OrderBy',_0x9591('0x33'),_0x9591('0x34')],squel['select']()[_0x9591('0x4a')](_0x8df2c2)[_0x9591('0x12')]('cm_hopper')[_0x9591('0x14')](_0x9591('0x37'),null,_0x9591('0x4b'))[_0x9591('0x14')]('cm_contact_has_items',null,_0x9591('0x4c'))[_0x9591('0x3a')](_0x9591('0x4d'),_0x48756)['where'](_0x9591('0x3c'),NOW))['toString']();}function insertCmContact(_0x5dd0b1,_0x4bfc82,_0x125a0a,_0x54e8c4){var _0x4e5ed1=_[_0x9591('0x4e')](_[_0x9591('0x4f')](_0x54e8c4),[_0x9591('0x42'),_0x9591('0x50'),_0x9591('0x33'),'updatedAt']);return squel[_0x9591('0x2d')]()[_0x9591('0x2e')](_0x9591('0x37'))[_0x9591('0x30')](_0x4e5ed1,squel[_0x9591('0xf')]()['fields'](_0x4e5ed1)[_0x9591('0x12')](_0x4bfc82)[_0x9591('0x3a')]('('+_0x125a0a[_0x9591('0x14')](',')+_0x9591('0x51'),squel['select']()[_0x9591('0x4a')](_0x125a0a)[_0x9591('0x12')](_0x9591('0x37'))['where'](_0x9591('0x43'),_0x5dd0b1))['where'](_0x9591('0x52'),squel[_0x9591('0xf')]()[_0x9591('0x10')](_0x9591('0x53'),_0x9591('0x54'))[_0x9591('0x12')](_0x4bfc82)[_0x9591('0x55')](_0x125a0a[_0x9591('0x14')](','))))['toString']();}function handleStop(){logger[_0x9591('0x56')](_0x9591('0x57'));stopped=!![];}function handleUncaughtException(_0x4e91ca){logger['error'](_0x4e91ca['message']);process[_0x9591('0x58')](0x1);}function handleError(_0x3f480e,_0x315877){stats[_0x9591('0x59')][_0x9591('0x1b')]({'name':_0x315877[_0x9591('0x5a')],'message':_0x315877[_0x9591('0x5b')],'row':_0x3f480e});}function handleQuery(_0x4e331c){logger[_0x9591('0x56')](_0x4e331c);return db[_0x9591('0x15')][_0x9591('0x16')](_0x4e331c)[_0x9591('0x18')](function(_0x36a3a7){results[_0x9591('0x1b')](_0x36a3a7);})[_0x9591('0x5c')](function(_0x5bbc88){logger[_0x9591('0x1d')](_0x5bbc88[_0x9591('0x5b')]);});}function main(_0x18c61c,_0x10b224,_0x20d5e0,_0xf3ca72){logger['info'](_0x9591('0x5d'),_0x18c61c,JSON[_0x9591('0x5e')](_0x10b224));process['send'](_0x9591('0x5f'));var _0xd8c090=_0x10b224[_0x9591('0x60')];var _0x123060=_[_0x9591('0x61')](_0xd8c090);var _0x52d3d9=_0x10b224['socket_timestamp'];var _0x510a71=path['join'](config['root'],_0x9591('0x62'),_0x52d3d9+_0x9591('0x63'));logger['info'](_0x9591('0x64'),_0x10b224);db['ContactItemType'][_0x9591('0x65')]({'raw':!![],'attributes':['id','name']})[_0x9591('0x1c')](function(_0xe6620d){for(var _0x1aaa2a=0x0;_0x1aaa2a<_0xe6620d[_0x9591('0x19')];_0x1aaa2a++){if(_0xe6620d[_0x1aaa2a][_0x9591('0x66')]in _0xd8c090){contactItemTypes[_0x9591('0x1b')](_0xe6620d[_0x1aaa2a]);delete _0x123060[_0xe6620d[_0x1aaa2a][_0x9591('0x66')]];hasAdditionalPhones=!![];}for(var _0x7f26c8 in _0xd8c090){if(_0xe6620d[_0x1aaa2a]['name']+_0x9591('0x67')===_0x7f26c8){phoneDescriptions['push']({'itemTypeId':_0xe6620d[_0x1aaa2a]['id'],'description':_0x7f26c8});delete _0x123060[_0x7f26c8];}}}if(hasAdditionalPhones)_0x123060['AdditionalPhones']='';var _0x9b398a=_[_0x9591('0x4f')](_0x123060)[_0x9591('0x14')]();logger[_0x9591('0x56')]('header',_0x9b398a);fs[_0x9591('0x68')](_0x510a71,_0x9b398a+'\x0a');Papa[_0x9591('0x69')](fs[_0x9591('0x6a')](_0x18c61c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f1fb9,_0x5cf222){try{for(var _0x567cec=0x0,_0x2cdc50=[];_0x567cec<_0x1f1fb9[_0x9591('0x6b')][_0x9591('0x19')];_0x567cec++){stats[_0x9591('0x6c')]+=0x1;if(_0x1f1fb9['errors'][_0x567cec]){handleError(_0x1f1fb9[_0x9591('0x6b')][_0x567cec],_0x1f1fb9[_0x9591('0x59')][_0x567cec]);}else{var _0x55098f=[];var _0x46fe86=[];var _0x319993={};for(var _0x359de5 in _0xd8c090){let _0x56c294=contactItemTypes['find'](_0x23bfb7=>_0x23bfb7[_0x9591('0x66')]===_0x359de5);let _0x3d404f=contactItemTypes['find'](_0xf630f=>_0xf630f[_0x9591('0x66')]+_0x9591('0x67')===_0x359de5);if(_[_0x9591('0x1a')](_0x56c294)&&_[_0x9591('0x1a')](_0x3d404f)){if(_0xd8c090[_0x9591('0x6d')](_0x359de5)){if(_0x1f1fb9['data'][_0x567cec][_0xd8c090[_0x359de5]]){var _0x18cbfb=_[_0x9591('0x6e')](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x359de5]][_0x9591('0x6f')](/"/g,'\x27'));switch(_0x359de5){case'scheduledat':var _0x1afa5b=moment(_0x18cbfb,_0x9591('0xd'),!![]);if(_0x1afa5b[_0x9591('0x70')]()){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9591('0x35'):var _0x5be835=parseInt(_0x18cbfb);_0x18cbfb=_[_0x9591('0x71')](_0x5be835)||_0x5be835<0x0||_0x5be835>0x4?_0xf3ca72?0x3:0x2:_0x5be835;_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');break;case _0x9591('0x36'):var _0x3a1f39=parseInt(_0x18cbfb);if(_[_0x9591('0x72')](_0x3a1f39)&&_[_0x9591('0x73')](_0x20d5e0,_0x3a1f39)){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x3a1f39+'\x22');}else{_0x55098f['push']('agent\x20not\x20exists');}break;case _0x9591('0x74'):if(isEmail(_0x18cbfb)){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')](_0x9591('0x75'));}break;case _0x9591('0x76'):var _0x34188e=moment(_0x18cbfb,_0x9591('0x77'),!![]);if(_0x34188e[_0x9591('0x70')]()){_0x2cdc50['push']('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')](_0x9591('0x78'));}break;default:_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}}else{switch(_0x359de5){case'firstName':case _0x9591('0x11'):_0x55098f[_0x9591('0x1b')](_0x359de5+_0x9591('0x79'));break;default:_0x2cdc50[_0x9591('0x1b')]('\x22\x22');}}}}else{var _0x32bbaa='';if(!_[_0x9591('0x1a')](_0x56c294)){if(!_0x319993['hasOwnProperty'](_0x56c294['id'])){for(var _0x30b0f5=0x0;_0x30b0f5<_0xd8c090[_0x359de5][_0x9591('0x19')];_0x30b0f5++){var _0x18cbfb=_['trim'](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x359de5][_0x30b0f5]]['replace'](/"/g,'\x27'));var _0x6ddba=phoneDescriptions['find'](_0x26bc64=>_0x26bc64[_0x9591('0x7a')]===_0x56c294['id']);if(!_[_0x9591('0x1a')](_0x6ddba)){var _0x53c7c0=_[_0x9591('0x6e')](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x6ddba[_0x9591('0x7b')]][0x0]][_0x9591('0x6f')](/"/g,'\x27'));if(!_[_0x9591('0x1a')](_0x53c7c0))_0x18cbfb=_0x18cbfb+'§'+_0x53c7c0;}if(_0x32bbaa=='')_0x32bbaa=_0x18cbfb;else _0x32bbaa+='|'+_0x18cbfb;}_0x46fe86[_0x9591('0x1b')](_0x56c294['id']+':'+_0x32bbaa);_0x319993[_0x56c294['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2cdc50['push']('\x22'+_0x46fe86[_0x9591('0x14')](';')+'\x22');}if(_0x55098f['length']){handleError(_0x1f1fb9[_0x9591('0x6b')][_0x567cec],{'code':_0x9591('0x7c'),'message':_0x55098f[_0x9591('0x14')]()});}else{fs[_0x9591('0x7d')](_0x510a71,_0x2cdc50[_0x9591('0x14')]()+'\x0a');}_0x2cdc50=[];}if(!(stats[_0x9591('0x6c')]%0xc8)){socket['emit'](_0x9591('0x7e')+_0x52d3d9,stats);stats[_0x9591('0x59')]=[];}}if(stopped){logger[_0x9591('0x56')](_0x9591('0x7f'));_0x5cf222[_0x9591('0x80')]();}}catch(_0x46b110){handleError(_0x1f1fb9['data'][_0x567cec],{'code':_0x9591('0x81'),'message':_0x46b110['message']});logger[_0x9591('0x1d')](_0x9591('0x82'),_0x46b110[_0x9591('0x5b')]);}},'complete':function(){try{var _0xbd025=[];var _0x3ca676=tempTableName;_0xbd025[_0x9591('0x1b')](_0x9591('0x83')+_0x3ca676+_0x9591('0x84'));logger[_0x9591('0x56')](_0x9591('0x85'),contactItemTypes[_0x9591('0x19')]);var _0x387715=util[_0x9591('0xc')](_0x9591('0x86'),_0x510a71,_0x3ca676,_0x9b398a,_0x10b224[_0x9591('0x42')],_0x10b224['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xd8c090[_0x9591('0x31')])){_0x387715+=_0x9591('0x87');}_0xbd025[_0x9591('0x1b')](_0x387715);BPromise[_0x9591('0x88')](_0xbd025,handleQuery)[_0x9591('0x1c')](function(_0x3ba287){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xbd025=[];for(var _0x58b96a=0x0;_0x58b96a\x20\x20');}var _0x33863f=path[_0x9591('0x14')](config[_0x9591('0x94')],_0x9591('0x62'),process[_0x9591('0x93')][0x2]);if(!fs[_0x9591('0x95')](_0x33863f)){throw new Error(_0x9591('0x96'));}var _0x4f0f1d={};try{_0x4f0f1d=JSON[_0x9591('0x69')](process[_0x9591('0x93')][0x3]);if(!_0x4f0f1d['binding']){throw new Error(_0x9591('0x97'));}var _0x87b65b=0x0;if(_0x4f0f1d['binding']['UserId']){_0x87b65b=0x1;}if(!_0x4f0f1d['ListId']){throw new Error(_0x9591('0x98'));}}catch(_0x4ab100){throw new Error('body\x20id\x20mandatory');}var _0x52716d=[];try{_0x52716d=_[_0x9591('0x99')](JSON[_0x9591('0x69')](process[_0x9591('0x93')][0x4]),'id');}catch(_0x452e79){logger[_0x9591('0x56')](_0x9591('0x9a'));}main(_0x33863f,_0x4f0f1d,_0x52716d,_0x87b65b);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9591('0x9b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5b8a997..3d74fb9 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x564c=['outbound','Outbound\x20Call','destcalleridnum','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Queue','queue','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','uniqueid','Date','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','inbound','push','variable','calleridnum'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x564c,0x118));var _0xc564=function(_0x253673,_0x3287fb){_0x253673=_0x253673-0x0;var _0x259903=_0x564c[_0x253673];return _0x259903;};'use strict';exports[_0xc564('0x0')]=function(_0x48a18a,_0x270ca9){var _0x4104d9=[{'type':_0xc564('0x1'),'content':_0xc564('0x2'),'variableName':null}];switch(_0x48a18a['toLowerCase']()){case _0xc564('0x3'):switch(_0x270ca9['toLowerCase']()){case _0xc564('0x4'):_0x4104d9[_0xc564('0x5')]({'type':_0xc564('0x6'),'content':'','variableName':'queue'});_0x4104d9[_0xc564('0x5')]({'type':_0xc564('0x6'),'content':'','variableName':_0xc564('0x7')});break;case _0xc564('0x8'):_0x4104d9[_0xc564('0x5')]({'type':'string','content':_0xc564('0x9'),'variableName':null});_0x4104d9['push']({'type':_0xc564('0x6'),'content':'','variableName':_0xc564('0xa')});break;}}return _0x4104d9;};exports[_0xc564('0xb')]=function(_0x155c84,_0x1ec947){var _0x674570=[];switch(_0x155c84[_0xc564('0xc')]()){case _0xc564('0x3'):switch(_0x1ec947[_0xc564('0xc')]()){case _0xc564('0x4'):_0x674570=[{'type':_0xc564('0x1'),'content':_0xc564('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0xf'),'keyType':_0xc564('0x6'),'variableName':_0xc564('0x7')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x10'),'keyType':_0xc564('0x6'),'variableName':'calleridname'},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x11'),'keyType':'variable','variableName':_0xc564('0x12')},{'type':'keyValue','content':'','key':_0xc564('0x13'),'keyType':_0xc564('0x6'),'variableName':_0xc564('0x14')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x15'),'keyType':_0xc564('0x6'),'variableName':'uniqueid'},{'type':_0xc564('0xe'),'content':'','key':'Date','keyType':_0xc564('0x6'),'variableName':_0xc564('0x16')},{'type':_0xc564('0x1'),'content':_0xc564('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xc564('0xe'),'content':'','key':'Agent\x20Name','keyType':_0xc564('0x6'),'variableName':_0xc564('0x18')},{'type':_0xc564('0xe'),'content':'','key':'Agent\x20Number','keyType':_0xc564('0x6'),'variableName':'destcalleridnum'},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x19'),'keyType':_0xc564('0x6'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xc564('0x1a'),'keyType':'variable','variableName':_0xc564('0x1b')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x1c'),'keyType':_0xc564('0x6'),'variableName':_0xc564('0x1d')},{'type':'keyValue','content':'','key':_0xc564('0x1e'),'keyType':_0xc564('0x6'),'variableName':_0xc564('0x1f')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x20'),'keyType':_0xc564('0x6'),'variableName':_0xc564('0x21')}];break;case _0xc564('0x8'):_0x674570=[{'type':_0xc564('0x1'),'content':_0xc564('0xd'),'variableName':null},{'type':_0xc564('0xe'),'content':'','key':'Called\x20Number','keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0xa')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x22'),'keyType':'variable','keyContent':'','variableName':_0xc564('0x23')},{'type':_0xc564('0xe'),'content':'','key':'UniqueId','keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0x24')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x25'),'keyType':'variable','keyContent':'','variableName':_0xc564('0x26')},{'type':'string','content':_0xc564('0x27')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x28'),'keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0x29')},{'type':_0xc564('0xe'),'content':'','key':_0xc564('0x2a'),'keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0x2b')},{'type':'keyValue','content':'','key':_0xc564('0x2c'),'keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0x2d')},{'type':'keyValue','content':'','key':_0xc564('0x2e'),'keyType':_0xc564('0x6'),'keyContent':'','variableName':_0xc564('0x2f')}];break;}}return _0x674570;}; \ No newline at end of file +var _0x0e49=['destcalleridnum','getDescriptions','toLowerCase','Caller\x20Number','calleridnum','keyValue','Caller\x20Name','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','Talk\x20Time','Called\x20Number','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','voice','inbound','variable','queue','push','outbound','Outbound\x20Call'];(function(_0x1bf210,_0x282b46){var _0x113f60=function(_0x1f9f48){while(--_0x1f9f48){_0x1bf210['push'](_0x1bf210['shift']());}};_0x113f60(++_0x282b46);}(_0x0e49,0x17d));var _0x90e4=function(_0x330fdc,_0x28443d){_0x330fdc=_0x330fdc-0x0;var _0x19fa25=_0x0e49[_0x330fdc];return _0x19fa25;};'use strict';exports['getSubjects']=function(_0xa33b14,_0x3f8a8f){var _0x2fe7f1=[{'type':_0x90e4('0x0'),'content':_0x90e4('0x1'),'variableName':null}];switch(_0xa33b14['toLowerCase']()){case _0x90e4('0x2'):switch(_0x3f8a8f['toLowerCase']()){case _0x90e4('0x3'):_0x2fe7f1['push']({'type':_0x90e4('0x4'),'content':'','variableName':_0x90e4('0x5')});_0x2fe7f1[_0x90e4('0x6')]({'type':_0x90e4('0x4'),'content':'','variableName':'calleridnum'});break;case _0x90e4('0x7'):_0x2fe7f1['push']({'type':_0x90e4('0x0'),'content':_0x90e4('0x8'),'variableName':null});_0x2fe7f1[_0x90e4('0x6')]({'type':_0x90e4('0x4'),'content':'','variableName':_0x90e4('0x9')});break;}}return _0x2fe7f1;};exports[_0x90e4('0xa')]=function(_0x5acb66,_0x575075){var _0x25c3f7=[];switch(_0x5acb66['toLowerCase']()){case _0x90e4('0x2'):switch(_0x575075[_0x90e4('0xb')]()){case _0x90e4('0x3'):_0x25c3f7=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x90e4('0xc'),'keyType':'variable','variableName':_0x90e4('0xd')},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0xf'),'keyType':_0x90e4('0x4'),'variableName':'calleridname'},{'type':_0x90e4('0xe'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0x90e4('0x10')},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x11'),'keyType':'variable','variableName':'queue'},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x12'),'keyType':'variable','variableName':_0x90e4('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x90e4('0x4'),'variableName':_0x90e4('0x14')},{'type':'string','content':_0x90e4('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x90e4('0x16'),'keyType':'variable','variableName':_0x90e4('0x17')},{'type':_0x90e4('0xe'),'content':'','key':'Agent\x20Number','keyType':_0x90e4('0x4'),'variableName':_0x90e4('0x9')},{'type':_0x90e4('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x18'),'keyType':_0x90e4('0x4'),'variableName':_0x90e4('0x14')},{'type':_0x90e4('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0x90e4('0x4'),'variableName':_0x90e4('0x19')},{'type':_0x90e4('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0x90e4('0x4'),'variableName':_0x90e4('0x1a')},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x1b'),'keyType':'variable','variableName':'holdtime'},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x1c'),'keyType':_0x90e4('0x4'),'variableName':'talktime'}];break;case _0x90e4('0x7'):_0x25c3f7=[{'type':_0x90e4('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x1d'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x90e4('0xe'),'content':'','key':'Member\x20Name','keyType':_0x90e4('0x4'),'keyContent':'','variableName':'membername'},{'type':_0x90e4('0xe'),'content':'','key':'UniqueId','keyType':_0x90e4('0x4'),'keyContent':'','variableName':_0x90e4('0x13')},{'type':_0x90e4('0xe'),'content':'','key':'Date','keyType':_0x90e4('0x4'),'keyContent':'','variableName':_0x90e4('0x1e')},{'type':'string','content':_0x90e4('0x1f')},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x20'),'keyType':_0x90e4('0x4'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x90e4('0x21'),'keyType':_0x90e4('0x4'),'keyContent':'','variableName':_0x90e4('0x22')},{'type':_0x90e4('0xe'),'content':'','key':_0x90e4('0x23'),'keyType':_0x90e4('0x4'),'keyContent':'','variableName':_0x90e4('0x24')},{'type':'keyValue','content':'','key':_0x90e4('0x25'),'keyType':_0x90e4('0x4'),'keyContent':'','variableName':_0x90e4('0x26')}];break;}}return _0x25c3f7;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index fb41a77..675c201 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaaa=['parseQueryParameters','then','where','body','default','fields','filter','user','i.id','ids','tag','count','having','clause','order','forEach','contactName','closed','rows','tracked','query','clone','omit','html','fax','mobile','./sql-utils','findAll','skipInteractionsQuery','resolve','search','parseAdvancedSearchFilter'];(function(_0x16b7bc,_0x4fc90c){var _0x2614cf=function(_0x4e7255){while(--_0x4e7255){_0x16b7bc['push'](_0x16b7bc['shift']());}};_0x2614cf(++_0x4fc90c);}(_0xaaaa,0xba));var _0xaaaa=function(_0x1cbc85,_0xd29591){_0x1cbc85=_0x1cbc85-0x0;var _0x56ecf3=_0xaaaa[_0x1cbc85];return _0x56ecf3;};'use strict';var _=require('lodash');var sqlUtils=require(_0xaaaa('0x0'));var utils=require('./utils');exports[_0xaaaa('0x1')]=function(_0x31fdff,_0x347b58,_0x4abd6d,_0x1b223b,_0x2a83fc){var _0x5c0690={'count':0x0,'rows':[]};var _0x2e6721=sqlUtils[_0xaaaa('0x2')](_0x31fdff,_0x4abd6d,_0x347b58);if(_0x2e6721){return Promise[_0xaaaa('0x3')](_0x5c0690);}var _0x342aa1=sqlUtils['getInteractionsQuery'](_0x31fdff);var _0x5c2db5={};return Promise[_0xaaaa('0x3')]()['then'](function(){if(_0x347b58[_0xaaaa('0x4')]){return sqlUtils[_0xaaaa('0x5')](_0x347b58['search'],_0x2a83fc);}else{return sqlUtils[_0xaaaa('0x6')](_0x31fdff,_0x347b58,_0x2a83fc);}})[_0xaaaa('0x7')](function(_0x381268){_0x342aa1[_0xaaaa('0x8')](_0x381268[_0xaaaa('0x9')]);_0x342aa1[_0xaaaa('0x8')](_0x381268['contact']);_0x342aa1['where'](_0x381268[_0xaaaa('0xa')]);_0x342aa1[_0xaaaa('0x8')](_0x381268[_0xaaaa('0xb')]);_0x342aa1['where'](_0x381268[_0xaaaa('0xc')]);_0x342aa1[_0xaaaa('0x8')](_0x381268[_0xaaaa('0xd')]);_0x342aa1['having'](_0x381268['read']);_0x5c2db5=_0x381268['tags'];return sqlUtils['checkAccountsRestrictions'](_0x31fdff,_0x4abd6d,_0x347b58);})[_0xaaaa('0x7')](function(_0x4103c0){_0x342aa1[_0xaaaa('0x8')](_0x4103c0);_0x342aa1['group'](_0xaaaa('0xe'));var _0x171fb4=_0x347b58[_0xaaaa('0x4')]?_0x5c2db5[_0xaaaa('0xf')]:_0x347b58[_0xaaaa('0x10')];return sqlUtils['countFilteredInteractions'](_0x342aa1,_0x171fb4);})[_0xaaaa('0x7')](function(_0x50d6e0){_0x5c0690[_0xaaaa('0x11')]=_0x50d6e0['length'];if(_0x5c0690[_0xaaaa('0x11')]===0x0){return[];}_0x342aa1[_0xaaaa('0x12')](_0x5c2db5[_0xaaaa('0x13')]);if(_0x1b223b[_0xaaaa('0x14')]){_0x1b223b['order'][_0xaaaa('0x15')](function(_0x467575){var _0x165dd3=_0x467575[0x0]===_0xaaaa('0x16')?_0x467575[0x0]:'i.'+_0x467575[0x0];_0x342aa1[_0xaaaa('0x14')](_0x165dd3,_0x467575[0x1]==='DESC'?![]:!![]);if(_0x467575[0x0]===_0xaaaa('0x17')){var _0x3202c5=sqlUtils['getClosedOrderClause'](_0x31fdff,_0x347b58);_0x342aa1[_0xaaaa('0x14')](_0x3202c5,_0x467575[0x1]==='DESC'?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x31fdff,_0x342aa1,_0x347b58,_0x1b223b);})['then'](function(_0x6aea9d){_0x5c0690[_0xaaaa('0x18')]=_0x6aea9d;return _0x5c0690;})['catch'](function(_0x5e32b8){throw _0x5e32b8;});};exports[_0xaaaa('0x19')]=function(_0x14db9a,_0x52771a){return function(_0x303616,_0x501f84,_0x1f8323){var _0x5ab8f6=_0x303616[_0xaaaa('0xd')];var _0x366d9a={};var _0x26352a=_0x303616[_0xaaaa('0x1a')];if(_0x366d9a){_0x366d9a=_[_0xaaaa('0x1b')](_0x303616[_0xaaaa('0x9')]);_0x366d9a=_[_0xaaaa('0x1c')](_0x366d9a,[_0xaaaa('0x9'),_0xaaaa('0x1d'),'phone',_0xaaaa('0x1e'),_0xaaaa('0x1f')]);}utils['updateUser'](_0x5ab8f6,_0x366d9a,_0x26352a,_0x14db9a,_0x52771a);_0x1f8323(null);};}; \ No newline at end of file +var _0xcba4=['tags','checkAccountsRestrictions','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','clone','body','omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','having','read'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xcba4,0x9c));var _0x4cba=function(_0x52edca,_0x19cdc7){_0x52edca=_0x52edca-0x0;var _0x2fd69e=_0xcba4[_0x52edca];return _0x2fd69e;};'use strict';var _=require(_0x4cba('0x0'));var sqlUtils=require(_0x4cba('0x1'));var utils=require(_0x4cba('0x2'));exports[_0x4cba('0x3')]=function(_0xe2c4d1,_0x3b4a4a,_0x33abd1,_0x228b27,_0x200f45){var _0x410a68={'count':0x0,'rows':[]};var _0x58235d=sqlUtils[_0x4cba('0x4')](_0xe2c4d1,_0x33abd1,_0x3b4a4a);if(_0x58235d){return Promise[_0x4cba('0x5')](_0x410a68);}var _0x20a17b=sqlUtils['getInteractionsQuery'](_0xe2c4d1);var _0x5d2546={};return Promise[_0x4cba('0x5')]()[_0x4cba('0x6')](function(){if(_0x3b4a4a[_0x4cba('0x7')]){return sqlUtils[_0x4cba('0x8')](_0x3b4a4a[_0x4cba('0x7')],_0x200f45);}else{return sqlUtils[_0x4cba('0x9')](_0xe2c4d1,_0x3b4a4a,_0x200f45);}})['then'](function(_0x2a9060){_0x20a17b[_0x4cba('0xa')](_0x2a9060['body']);_0x20a17b[_0x4cba('0xa')](_0x2a9060['contact']);_0x20a17b[_0x4cba('0xa')](_0x2a9060[_0x4cba('0xb')]);_0x20a17b[_0x4cba('0xa')](_0x2a9060['fields']);_0x20a17b['where'](_0x2a9060[_0x4cba('0xc')]);_0x20a17b['where'](_0x2a9060[_0x4cba('0xd')]);_0x20a17b[_0x4cba('0xe')](_0x2a9060[_0x4cba('0xf')]);_0x5d2546=_0x2a9060[_0x4cba('0x10')];return sqlUtils[_0x4cba('0x11')](_0xe2c4d1,_0x33abd1,_0x3b4a4a);})[_0x4cba('0x6')](function(_0x23d0f2){_0x20a17b[_0x4cba('0xa')](_0x23d0f2);_0x20a17b['group'](_0x4cba('0x12'));var _0x27e398=_0x3b4a4a[_0x4cba('0x7')]?_0x5d2546[_0x4cba('0x13')]:_0x3b4a4a[_0x4cba('0x14')];return sqlUtils[_0x4cba('0x15')](_0x20a17b,_0x27e398);})['then'](function(_0x3df07b){_0x410a68[_0x4cba('0x16')]=_0x3df07b[_0x4cba('0x17')];if(_0x410a68[_0x4cba('0x16')]===0x0){return[];}_0x20a17b['having'](_0x5d2546[_0x4cba('0x18')]);if(_0x228b27[_0x4cba('0x19')]){_0x228b27['order'][_0x4cba('0x1a')](function(_0x3ba6ac){var _0x59ca50=_0x3ba6ac[0x0]===_0x4cba('0x1b')?_0x3ba6ac[0x0]:'i.'+_0x3ba6ac[0x0];_0x20a17b[_0x4cba('0x19')](_0x59ca50,_0x3ba6ac[0x1]===_0x4cba('0x1c')?![]:!![]);if(_0x3ba6ac[0x0]===_0x4cba('0x1d')){var _0x3e78c5=sqlUtils[_0x4cba('0x1e')](_0xe2c4d1,_0x3b4a4a);_0x20a17b[_0x4cba('0x19')](_0x3e78c5,_0x3ba6ac[0x1]===_0x4cba('0x1c')?![]:!![]);}});}return sqlUtils[_0x4cba('0x1f')](_0xe2c4d1,_0x20a17b,_0x3b4a4a,_0x228b27);})[_0x4cba('0x6')](function(_0x5a3495){_0x410a68[_0x4cba('0x20')]=_0x5a3495;return _0x410a68;})[_0x4cba('0x21')](function(_0x426b9c){throw _0x426b9c;});};exports[_0x4cba('0x22')]=function(_0x42df4b,_0x2e4030){return function(_0x3e000e,_0x5d1935,_0x555113){var _0x1c2d54=_0x3e000e[_0x4cba('0xd')];var _0x3a9c83={};var _0x3c89f6=_0x3e000e['query'];if(_0x3a9c83){_0x3a9c83=_[_0x4cba('0x23')](_0x3e000e[_0x4cba('0x24')]);_0x3a9c83=_[_0x4cba('0x25')](_0x3a9c83,[_0x4cba('0x24'),_0x4cba('0x26'),_0x4cba('0x27'),_0x4cba('0x28'),_0x4cba('0x29')]);}utils[_0x4cba('0x2a')](_0x1c2d54,_0x3a9c83,_0x3c89f6,_0x42df4b,_0x2e4030);_0x555113(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index b904a10..77101f3 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8529=['fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','and','Contact','operator','$substring','split','contact','ContactId','Tag','tags','clause','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','user','body','plainBody','keys','compact','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','read','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','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.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.email','Contact.email','Contact.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','agent','select','field','name','color','getInteractionFK','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?'];(function(_0x584af2,_0x4cf534){var _0x130ef2=function(_0x3339ec){while(--_0x3339ec){_0x584af2['push'](_0x584af2['shift']());}};_0x130ef2(++_0x4cf534);}(_0x8529,0x1c3));var _0x9852=function(_0x18014c,_0x2a5da5){_0x18014c=_0x18014c-0x0;var _0x3d80f4=_0x8529[_0x18014c];return _0x3d80f4;};'use strict';var _=require(_0x9852('0x0'));var squel=require('squel');var as=require(_0x9852('0x1'));var qs=require(_0x9852('0x2'));var updateInteraction=require(_0x9852('0x3'))[_0x9852('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x349461,_0x1b1acf,_0x52bc6b){var _0x3c106a=![];var _0x2d42f8=utils[_0x9852('0x5')](_0x349461);if(_0x1b1acf['role']===_0x9852('0x6')&&!_0x52bc6b['search']&&!_0x52bc6b[_0x2d42f8]){_0x3c106a=!![];}return _0x3c106a;}function getTagsQuery(){return squel[_0x9852('0x7')]()['field']('id')[_0x9852('0x8')](_0x9852('0x9'))[_0x9852('0x8')](_0x9852('0xa'))['from']('tools_tags');}function getUsersQuery(_0x6fc6e6,_0x2db7a3){var _0x146004=utils[_0x9852('0xb')](_0x6fc6e6);var _0x363d11='user_has_'+_0x6fc6e6+'_interactions';var _0x59611b=squel[_0x9852('0x7')]()[_0x9852('0x8')]('u.id')['field'](_0x9852('0xc'))[_0x9852('0x8')](_0x9852('0xd')+_0x146004)[_0x9852('0xe')](_0x363d11,'ui')[_0x9852('0xf')](_0x9852('0x10'),'u',_0x9852('0x11'));if(_0x2db7a3[_0x9852('0x12')]>0x0){_0x59611b[_0x9852('0x13')](_0x9852('0xd')+_0x146004+'\x20IN\x20?',_[_0x9852('0x14')](_0x2db7a3,'id'));}return _0x59611b;}function getInteractionsQuery(_0x4041a7){var _0x50684e=utils[_0x9852('0x15')](_0x4041a7);var _0x4c21bb=utils[_0x9852('0x5')](_0x4041a7);var _0x3e573c=utils[_0x9852('0xb')](_0x4041a7);return squel[_0x9852('0x7')]()[_0x9852('0xe')](_0x50684e[_0x9852('0x16')],'i')[_0x9852('0xf')](_0x9852('0x17'),'c',_0x9852('0x18'))[_0x9852('0xf')](_0x9852('0x10'),'o',_0x9852('0x19'))[_0x9852('0xf')](_0x50684e[_0x9852('0x1a')],'a',_0x9852('0x1b')+_0x4c21bb)[_0x9852('0xf')](_0x50684e[_0x9852('0x1c')],'me','me.'+_0x3e573c+_0x9852('0x1d'))[_0x9852('0xf')](_0x50684e[_0x9852('0x1e')],'it',_0x9852('0x1f')+_0x3e573c+_0x9852('0x1d'))[_0x9852('0xf')](_0x9852('0x20'),'t',_0x9852('0x21'));}function getSqlClauses(){var _0x51d502={'body':squel[_0x9852('0x22')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x9852('0x22')](),'filter':squel[_0x9852('0x22')](),'read':squel[_0x9852('0x22')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x9852('0x22')]()};return _0x51d502;}function parseTagParameter(_0x44d41e){var _0x28c830=squel[_0x9852('0x22')]();if(_0x44d41e){var _0x3fa2a8=utils[_0x9852('0x23')](_0x44d41e);_0x3fa2a8[_0x9852('0x24')](function(_0x32ac52){_0x28c830['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x32ac52+',%');});}return _0x28c830;}function parseReadParameter(_0x52b290){var _0x3aca3a='';if(_0x52b290){_0x3aca3a='unreadMessages\x20{OPERATOR}\x200';if(_0x52b290==='1'){_0x3aca3a=_0x3aca3a[_0x9852('0x25')](_0x9852('0x26'),'=');}else{_0x3aca3a=_0x3aca3a['replace'](_0x9852('0x26'),'>');}}return _0x3aca3a;}function parseSearchFilter(_0x57238f,_0x5eb5fc){var _0x391f0a=squel[_0x9852('0x22')]();if(_0x5eb5fc){var _0x3a77c9=_0x5eb5fc[_0x9852('0x25')]('\x5c','\x5c\x5c')[_0x9852('0x25')](/'/g,'\x27\x27');if(qs[_0x9852('0x27')](_0x3a77c9)){_0x391f0a['or'](_0x9852('0x28'),_0x3a77c9+'%');if([_0x9852('0x29'),_0x9852('0x2a')]['includes'](_0x57238f)){_0x391f0a['or'](_0x9852('0x2b'),_0x3a77c9+'%');}else if(_0x57238f===_0x9852('0x2c')){_0x391f0a['or'](_0x9852('0x2d'),_0x3a77c9+'%');}else if(_0x57238f===_0x9852('0x2e')){_0x391f0a['or'](_0x9852('0x2f'),_0x3a77c9+'%');}}else if(_0x57238f===_0x9852('0x30')&&qs['isEmail'](_0x3a77c9)){_0x391f0a['or'](_0x9852('0x31'),_0x3a77c9+'%');}else{if(_0x57238f===_0x9852('0x30')){_0x391f0a['or'](_0x9852('0x32'),qs[_0x9852('0x33')](_0x3a77c9,!![]))['or'](_0x9852('0x34'),qs[_0x9852('0x33')](_0x3a77c9));}else if(_0x57238f!=='fax'){_0x391f0a['or'](_0x9852('0x35'),qs['getFullTextValue'](_0x3a77c9));}_0x391f0a['or'](_0x9852('0x36'),qs[_0x9852('0x33')](_0x3a77c9,!![]),null);}}return _0x391f0a;}function parseAdvancedSearchFilter(_0x98e770,_0x4519b6){var _0x306afa=getSqlClauses();var _0x2f46c3=as[_0x9852('0x37')](_0x98e770);var _0x435ab5=_0x2f46c3['sqlOperator'];for(var _0x12a191=0x0;_0x12a191<_0x2f46c3[_0x9852('0x38')][_0x9852('0x12')];_0x12a191++){var _0x1368ed=_0x2f46c3['conditions'][_0x12a191];var _0xf9858a='i';var _0x10a98c=_[_0x9852('0x39')](_0x4519b6,[_0x9852('0x9'),_0x1368ed[_0x9852('0x8')]]);if(_0x10a98c){var _0x5cdbf8=as[_0x9852('0x3a')](_0xf9858a,_0x10a98c[_0x9852('0x3b')],_0x1368ed);_0x306afa[_0x9852('0x3c')][_0x435ab5](_0x5cdbf8[_0x9852('0x3d')],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x3f')],_0x5cdbf8['value'][_0x9852('0x40')]);}else{switch(_0x1368ed['field']){case _0x9852('0x41'):var _0x10b505=parseReadParameter(_0x1368ed['value']);_0x306afa['read'][_0x9852('0x42')](_0x10b505);break;case _0x9852('0x43'):if(_0x1368ed[_0x9852('0x44')]===_0x9852('0x45')){if(_0x1368ed[_0x9852('0x3e')][_0x9852('0x46')]('\x20')[_0x9852('0x12')]>0x1){_0x306afa[_0x9852('0x47')][_0x435ab5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9852('0x33')](_0x1368ed['value'],!![]),null);}else{var _0x2c970a='%'+_0x1368ed[_0x9852('0x3e')]+'%';_0x306afa[_0x9852('0x47')][_0x435ab5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2c970a,_0x2c970a,_0x2c970a);}}else{_0x10a98c=_['find'](_0x4519b6,[_0x9852('0x9'),'ContactId']);_0x1368ed[_0x9852('0x8')]=_0x9852('0x48');_0x5cdbf8=as[_0x9852('0x3a')](_0xf9858a,_0x10a98c[_0x9852('0x3b')],_0x1368ed);_0x306afa[_0x9852('0x47')][_0x435ab5](_0x5cdbf8['text'],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x3f')],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x40')]);}break;case _0x9852('0x49'):var _0x515d36=_0x1368ed[_0x9852('0x3e')][_0x9852('0x46')](',')[_0x9852('0x14')](function(_0x4a55ce){return Number(_0x4a55ce);});var _0x57d312=parseTagParameter(_0x515d36);_0x306afa[_0x9852('0x4a')][_0x9852('0x4b')]['and'](_0x57d312);_0x306afa[_0x9852('0x4a')][_0x9852('0x4c')]=_0x515d36;break;case'User':if(_0x1368ed[_0x9852('0x44')]===_0x9852('0x45')){_0x306afa['user'][_0x435ab5](_0x9852('0x4d'),'%'+_0x1368ed['value']+'%',null);}else{_0x10a98c=_[_0x9852('0x39')](_0x4519b6,[_0x9852('0x9'),_0x9852('0x4e')]);_0x1368ed[_0x9852('0x8')]='UserId';_0x5cdbf8=as[_0x9852('0x3a')](_0xf9858a,_0x10a98c[_0x9852('0x3b')],_0x1368ed);_0x306afa[_0x9852('0x4f')][_0x435ab5](_0x5cdbf8[_0x9852('0x3d')],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x3f')],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x40')]);}break;case _0x9852('0x50'):case _0x9852('0x51'):_0x5cdbf8=as[_0x9852('0x3a')]('me',null,_0x1368ed);_0x306afa[_0x9852('0x50')][_0x435ab5](_0x5cdbf8['text'],_0x5cdbf8['value'][_0x9852('0x3f')],_0x5cdbf8[_0x9852('0x3e')][_0x9852('0x40')]);break;}}}return _0x306afa;}function parseModelFields(_0x21e632,_0x582712,_0x5a770d){var _0xd48b8e=utils[_0x9852('0x5')](_0x21e632);var _0x5721fd=squel[_0x9852('0x22')]();var _0x51cf55=_(_0x582712)[_0x9852('0x52')]()[_0x9852('0x14')](function(_0x2e1162){return _['some'](_0x5a770d,[_0x9852('0x9'),_0x2e1162])?_0x2e1162:undefined;})[_0x9852('0x53')]()[_0x9852('0x3e')]();if(_0x51cf55[_0x9852('0x12')]>0x0){_0x51cf55[_0x9852('0x24')](function(_0x53bed7){if(_0x53bed7===_0xd48b8e){_0x5721fd[_0x9852('0x42')]('i.'+_0xd48b8e+_0x9852('0x54'),[][_0x9852('0x55')](_0x582712[_0x53bed7]));}else if(_0x53bed7===_0x9852('0x56')){var _0x2a386d=JSON[_0x9852('0x57')](_0x582712[_0x53bed7])[_0x9852('0x58')];var _0x379b87=JSON[_0x9852('0x57')](_0x582712[_0x53bed7])[_0x9852('0x59')];_0x5721fd[_0x9852('0x42')](_0x9852('0x5a'),_0x2a386d,_0x379b87);}else{if(_0x582712[_0x53bed7]===_0x9852('0x5b')){_0x5721fd['and']('i.'+_0x53bed7+'\x20IS\x20NULL');}else{_0x5721fd[_0x9852('0x42')]('i.'+_0x53bed7+_0x9852('0x5c'),_0x582712[_0x53bed7]);}}});}return _0x5721fd;}function parseQueryParameters(_0x5d2710,_0x51b884,_0x14038e){var _0x1c744a=getSqlClauses();return Promise[_0x9852('0x5d')]()[_0x9852('0x5e')](function(){return parseModelFields(_0x5d2710,_0x51b884,_0x14038e);})[_0x9852('0x5e')](function(_0x4b6680){_0x1c744a[_0x9852('0x5f')][_0x9852('0x42')](_0x4b6680);return parseReadParameter(_0x51b884[_0x9852('0x60')]);})[_0x9852('0x5e')](function(_0x40bed6){_0x1c744a[_0x9852('0x60')][_0x9852('0x42')](_0x40bed6);return parseTagParameter(_0x51b884['tag']);})[_0x9852('0x5e')](function(_0x414b39){_0x1c744a[_0x9852('0x4a')][_0x9852('0x4b')][_0x9852('0x42')](_0x414b39);return parseSearchFilter(_0x5d2710,_0x51b884[_0x9852('0x61')]);})[_0x9852('0x5e')](function(_0x1981e2){_0x1c744a[_0x9852('0x61')]=_0x1981e2;return _0x1c744a;});}function checkAccountsRestrictions(_0x2f44de,_0x287b26,_0x3497a1){var _0x4d22c1=utils[_0x9852('0x5')](_0x2f44de);var _0x370d3d='get'+_[_0x9852('0x62')](_0x2f44de)+(_0x2f44de===_0x9852('0x63')?_0x9852('0x64'):_0x9852('0x65'));var _0x2a66e3=squel[_0x9852('0x22')]();return Promise[_0x9852('0x5d')]()[_0x9852('0x5e')](function(){if(_0x3497a1[_0x9852('0x66')]&&_0x287b26['role']===_0x9852('0x6')){return _0x287b26[_0x370d3d]({'attributes':['id'],'raw':!![]});}})[_0x9852('0x5e')](function(_0xa9e055){if(_0xa9e055){if(_0xa9e055[_0x9852('0x12')]===0x0){_0x2a66e3['and']('i.'+_0x4d22c1+_0x9852('0x67'));}else{_0x2a66e3['and']('i.'+_0x4d22c1+'\x20IN\x20?',_[_0x9852('0x14')](_0xa9e055,'id'));}}else if(!_0x3497a1[_0x4d22c1]){_0x2a66e3[_0x9852('0x42')]('i.'+_0x4d22c1+_0x9852('0x68'));}})['then'](function(){return _0x2a66e3;});}function getClosedOrderClause(_0xd41e5,_0x4501b5){var _0x56ffff='';var _0xd9bb7b=[_0x9852('0x69'),_0x9852('0x6a'),'i.disposition'];if(_0xd41e5===_0x9852('0x30')){_0xd9bb7b['unshift'](_0x9852('0x6b'));}if(_0x4501b5[_0x9852('0x6c')]==='0'&&_0xd41e5===_0x9852('0x30')){_0x56ffff=_0x9852('0x6b');}else{if(_0x4501b5[_0x9852('0x6c')]==='1'){_0xd9bb7b[_0x9852('0x6d')]();}_0x56ffff=_0x9852('0x6e')+_0xd9bb7b[_0x9852('0x6f')](',\x20')+')';}return _0x56ffff;}function getFilteredInteractions(_0x5e9ab0,_0x141fde,_0x4ab57d,_0x157e28){var _0x5ad756=utils[_0x9852('0xb')](_0x5e9ab0);var _0x1ad4d8=_['capitalize'](_0x5e9ab0)+'Interaction';var _0x493a7b=[];var _0x12ba93=getTagsQuery();var _0x507774={'type':db[_0x9852('0x70')][_0x9852('0x71')]['SELECT'],'raw':!![]};var _0x305960=[];var _0x3949f6=[];return db[_0x9852('0x72')][_0x9852('0x73')](_0x12ba93[_0x9852('0x74')](),_0x507774)['then'](function(_0x3554c8){_0x493a7b=_[_0x9852('0x75')](_0x3554c8,'id');_0x507774=_[_0x9852('0x76')](_0x507774,{'model':db[_0x1ad4d8],'mapToModel':!![],'nest':!![]});if(_0x4ab57d[_0x9852('0x5f')]){_0x157e28['attributes'][_0x9852('0x24')](function(_0x3fbb9e){_0x141fde[_0x9852('0x8')]('i.'+_0x3fbb9e);});}else{_0x141fde['field'](_0x9852('0x77'),'unreadMessages');_0x141fde['field'](_0x9852('0x78'),_0x9852('0x79'));_0x141fde[_0x9852('0x8')](_0x9852('0x7a'),_0x9852('0x7b'));if(_0x5e9ab0===_0x9852('0x30')){_0x141fde[_0x9852('0x8')](_0x9852('0x7c'),_0x9852('0x7d'));_0x141fde['field'](_0x9852('0x7e'),_0x9852('0x7f'));_0x141fde[_0x9852('0x8')](_0x9852('0x80'));_0x141fde[_0x9852('0x8')](_0x9852('0x81'));_0x141fde[_0x9852('0x8')]('i.updatedAt');_0x141fde[_0x9852('0x8')](_0x9852('0x82'));_0x141fde[_0x9852('0x8')](_0x9852('0x83'));_0x141fde['field'](_0x9852('0x84'));_0x141fde['field'](_0x9852('0x85'));_0x141fde[_0x9852('0x8')](_0x9852('0x86'));_0x141fde[_0x9852('0x8')]('i.subject');_0x141fde['field'](_0x9852('0x87'));_0x141fde['field']('i.secondDisposition');_0x141fde[_0x9852('0x8')](_0x9852('0x69'));_0x141fde[_0x9852('0x8')]('i.substatus');_0x141fde[_0x9852('0x8')](_0x9852('0x88'));_0x141fde[_0x9852('0x8')](_0x9852('0x89'));_0x141fde['field']('i.MailAccountId');_0x141fde[_0x9852('0x8')](_0x9852('0x8a'));}else if(_0x5e9ab0==='openchannel'){_0x141fde[_0x9852('0x8')](_0x9852('0x8b'),_0x9852('0x7f'));}else{_0x141fde[_0x9852('0x8')](_0x9852('0x8c'),'contactName');}if(_0x5e9ab0!==_0x9852('0x30')){_0x141fde[_0x9852('0x8')](_0x9852('0x8d'));}_0x141fde[_0x9852('0x8')](_0x9852('0x8e'),_0x9852('0x8f'));_0x141fde[_0x9852('0x8')]('c.lastName','Contact.lastName');_0x141fde[_0x9852('0x8')](_0x9852('0x90'),_0x9852('0x91'));_0x141fde[_0x9852('0x8')]('c.phone','Contact.phone');_0x141fde['field']('c.mobile',_0x9852('0x92'));_0x141fde['field']('c.fax',_0x9852('0x93'));_0x141fde[_0x9852('0x8')](_0x9852('0x94'),'Owner.fullname');_0x141fde[_0x9852('0x8')]('o.internal',_0x9852('0x95'));_0x141fde[_0x9852('0x8')](_0x9852('0x96'),_0x9852('0x97'));}if(_0x157e28['limit']){_0x141fde[_0x9852('0x98')](_0x157e28[_0x9852('0x98')]);}if(_0x157e28[_0x9852('0x99')]){_0x141fde[_0x9852('0x99')](_0x157e28['offset']);}return db[_0x9852('0x72')][_0x9852('0x73')](_0x141fde[_0x9852('0x74')](),_0x507774);})[_0x9852('0x5e')](function(_0x4380be){_0x305960=_0x4380be;var _0x3bf660=getUsersQuery(_0x5e9ab0,_0x305960);return db[_0x9852('0x72')][_0x9852('0x73')](_0x3bf660[_0x9852('0x74')](),_0x507774);})[_0x9852('0x5e')](function(_0x401ea0){_0x3949f6=_[_0x9852('0x9a')](_0x401ea0,_0x5ad756);if(_0x5e9ab0===_0x9852('0x30')){return db[_0x9852('0x9b')][_0x9852('0x9c')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x9852('0x5e')](function(_0x3e9868){var _0x49a1eb=_0x3e9868?_0x3e9868[_0x9852('0x9d')]:undefined;var _0x4dd5d0=_0x305960[_0x9852('0x14')](function(_0x21c0c7){return updateInteraction(_0x21c0c7,_0x493a7b,_0x3949f6,_0x49a1eb);});return Promise[_0x9852('0x9e')](_0x4dd5d0);});}function countFilteredInteractions(_0x36a714,_0x13c7c8){var _0x21c72e=_0x36a714[_0x9852('0x9f')]();_0x21c72e[_0x9852('0x8')](_0x9852('0xa0'));_0x21c72e[_0x9852('0x8')](_0x9852('0x77'),'unreadMessages');var _0x352a82=utils[_0x9852('0x23')](_0x13c7c8);if(!_[_0x9852('0xa1')](_0x352a82)){_0x21c72e[_0x9852('0x13')](_0x9852('0xa2'),_0x352a82);}var _0x4cfe8f={'type':db[_0x9852('0x70')][_0x9852('0x71')][_0x9852('0xa3')],'raw':!![]};return db[_0x9852('0x72')][_0x9852('0x73')](_0x21c72e[_0x9852('0x74')](),_0x4cfe8f);}module[_0x9852('0xa4')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x7790=['select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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)','sqlOperator','conditions','find','buildExpression','type','default','text','value','start','unreadMessages','read','Contact','$substring','contact','ContactId','end','Tag','split','tags','clause','ids','User','operator','user','UserId','plainBody','keys','compact','and','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','then','fields','filter','get','capitalize','chat','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','Sequelize','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','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\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search'];(function(_0x93778c,_0x57d498){var _0x601bf=function(_0x1fd8d5){while(--_0x1fd8d5){_0x93778c['push'](_0x93778c['shift']());}};_0x601bf(++_0x57d498);}(_0x7790,0x1f2));var _0x0779=function(_0x5c73ae,_0x34ac95){_0x5c73ae=_0x5c73ae-0x0;var _0x577b93=_0x7790[_0x5c73ae];return _0x577b93;};'use strict';var _=require(_0x0779('0x0'));var squel=require(_0x0779('0x1'));var as=require(_0x0779('0x2'));var qs=require(_0x0779('0x3'));var updateInteraction=require(_0x0779('0x4'))[_0x0779('0x5')];var utils=require(_0x0779('0x6'));var db=require(_0x0779('0x7'))['db'];function skipInteractionsQuery(_0xcf0e8,_0x27de16,_0x594b12){var _0x3a7c33=![];var _0x6bab31=utils[_0x0779('0x8')](_0xcf0e8);if(_0x27de16[_0x0779('0x9')]===_0x0779('0xa')&&!_0x594b12[_0x0779('0xb')]&&!_0x594b12[_0x6bab31]){_0x3a7c33=!![];}return _0x3a7c33;}function getTagsQuery(){return squel[_0x0779('0xc')]()[_0x0779('0xd')]('id')[_0x0779('0xd')](_0x0779('0xe'))['field'](_0x0779('0xf'))[_0x0779('0x10')](_0x0779('0x11'));}function getUsersQuery(_0xadcec0,_0x102eb8){var _0x59a79e=utils[_0x0779('0x12')](_0xadcec0);var _0xd613c1=_0x0779('0x13')+_0xadcec0+_0x0779('0x14');var _0x136a86=squel[_0x0779('0xc')]()[_0x0779('0xd')](_0x0779('0x15'))[_0x0779('0xd')](_0x0779('0x16'))['field'](_0x0779('0x17')+_0x59a79e)[_0x0779('0x10')](_0xd613c1,'ui')[_0x0779('0x18')](_0x0779('0x19'),'u',_0x0779('0x1a'));if(_0x102eb8[_0x0779('0x1b')]>0x0){_0x136a86['where'](_0x0779('0x17')+_0x59a79e+_0x0779('0x1c'),_[_0x0779('0x1d')](_0x102eb8,'id'));}return _0x136a86;}function getInteractionsQuery(_0x2f61e2){var _0x528c1d=utils[_0x0779('0x1e')](_0x2f61e2);var _0x5840b6=utils['getAccountFK'](_0x2f61e2);var _0x231c51=utils[_0x0779('0x12')](_0x2f61e2);return squel[_0x0779('0xc')]()[_0x0779('0x10')](_0x528c1d[_0x0779('0x1f')],'i')[_0x0779('0x18')](_0x0779('0x20'),'c',_0x0779('0x21'))[_0x0779('0x18')](_0x0779('0x19'),'o',_0x0779('0x22'))['left_join'](_0x528c1d[_0x0779('0x23')],'a',_0x0779('0x24')+_0x5840b6)[_0x0779('0x18')](_0x528c1d[_0x0779('0x25')],'me',_0x0779('0x26')+_0x231c51+'\x20=\x20i.id')[_0x0779('0x18')](_0x528c1d[_0x0779('0x27')],'it',_0x0779('0x28')+_0x231c51+_0x0779('0x29'))[_0x0779('0x18')]('tools_tags','t',_0x0779('0x2a'));}function getSqlClauses(){var _0x162e68={'body':squel[_0x0779('0x2b')](),'contact':squel[_0x0779('0x2b')](),'default':squel[_0x0779('0x2b')](),'fields':squel[_0x0779('0x2b')](),'filter':squel['expr'](),'read':squel[_0x0779('0x2b')](),'tags':{'clause':squel[_0x0779('0x2b')](),'ids':null},'user':squel[_0x0779('0x2b')]()};return _0x162e68;}function parseTagParameter(_0x36f196){var _0x46d4cc=squel[_0x0779('0x2b')]();if(_0x36f196){var _0x4012ad=utils[_0x0779('0x2c')](_0x36f196);_0x4012ad[_0x0779('0x2d')](function(_0x34fcb5){_0x46d4cc['or'](_0x0779('0x2e'),'%,'+_0x34fcb5+',%');});}return _0x46d4cc;}function parseReadParameter(_0x1f17cd){var _0xf7c053='';if(_0x1f17cd){_0xf7c053=_0x0779('0x2f');if(_0x1f17cd==='1'){_0xf7c053=_0xf7c053[_0x0779('0x30')]('{OPERATOR}','=');}else{_0xf7c053=_0xf7c053[_0x0779('0x30')](_0x0779('0x31'),'>');}}return _0xf7c053;}function parseSearchFilter(_0x58f8a7,_0x486d4d){var _0xb40498=squel[_0x0779('0x2b')]();if(_0x486d4d){var _0x40f629=_0x486d4d[_0x0779('0x30')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0779('0x32')](_0x40f629)){_0xb40498['or']('i.id\x20LIKE\x20?',_0x40f629+'%');if([_0x0779('0x33'),_0x0779('0x34')][_0x0779('0x35')](_0x58f8a7)){_0xb40498['or'](_0x0779('0x36'),_0x40f629+'%');}else if(_0x58f8a7===_0x0779('0x37')){_0xb40498['or'](_0x0779('0x38'),_0x40f629+'%');}else if(_0x58f8a7===_0x0779('0x39')){_0xb40498['or'](_0x0779('0x3a'),_0x40f629+'%');}}else if(_0x58f8a7===_0x0779('0x3b')&&qs[_0x0779('0x3c')](_0x40f629)){_0xb40498['or']('c.email\x20LIKE\x20?',_0x40f629+'%');}else{if(_0x58f8a7===_0x0779('0x3b')){_0xb40498['or'](_0x0779('0x3d'),qs['getFullTextValue'](_0x40f629,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0779('0x3e')](_0x40f629));}else if(_0x58f8a7!==_0x0779('0x37')){_0xb40498['or'](_0x0779('0x3f'),qs['getFullTextValue'](_0x40f629));}_0xb40498['or'](_0x0779('0x40'),qs[_0x0779('0x3e')](_0x40f629,!![]),null);}}return _0xb40498;}function parseAdvancedSearchFilter(_0x20ec48,_0x3bc4d1){var _0x3e8b67=getSqlClauses();var _0x4d8cc5=as['parseSearch'](_0x20ec48);var _0x181bb1=_0x4d8cc5[_0x0779('0x41')];for(var _0x2cdc7f=0x0;_0x2cdc7f<_0x4d8cc5['conditions'][_0x0779('0x1b')];_0x2cdc7f++){var _0x407951=_0x4d8cc5[_0x0779('0x42')][_0x2cdc7f];var _0x7669ef='i';var _0xda1f50=_[_0x0779('0x43')](_0x3bc4d1,[_0x0779('0xe'),_0x407951[_0x0779('0xd')]]);if(_0xda1f50){var _0x52519b=as[_0x0779('0x44')](_0x7669ef,_0xda1f50[_0x0779('0x45')],_0x407951);_0x3e8b67[_0x0779('0x46')][_0x181bb1](_0x52519b[_0x0779('0x47')],_0x52519b[_0x0779('0x48')][_0x0779('0x49')],_0x52519b[_0x0779('0x48')]['end']);}else{switch(_0x407951[_0x0779('0xd')]){case _0x0779('0x4a'):var _0x206814=parseReadParameter(_0x407951['value']);_0x3e8b67[_0x0779('0x4b')]['and'](_0x206814);break;case _0x0779('0x4c'):if(_0x407951['operator']===_0x0779('0x4d')){if(_0x407951[_0x0779('0x48')]['split']('\x20')[_0x0779('0x1b')]>0x1){_0x3e8b67['contact'][_0x181bb1](_0x0779('0x40'),qs[_0x0779('0x3e')](_0x407951['value'],!![]),null);}else{var _0x12cff2='%'+_0x407951[_0x0779('0x48')]+'%';_0x3e8b67[_0x0779('0x4e')][_0x181bb1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x12cff2,_0x12cff2,_0x12cff2);}}else{_0xda1f50=_['find'](_0x3bc4d1,[_0x0779('0xe'),_0x0779('0x4f')]);_0x407951[_0x0779('0xd')]='ContactId';_0x52519b=as['buildExpression'](_0x7669ef,_0xda1f50['type'],_0x407951);_0x3e8b67[_0x0779('0x4e')][_0x181bb1](_0x52519b[_0x0779('0x47')],_0x52519b['value'][_0x0779('0x49')],_0x52519b[_0x0779('0x48')][_0x0779('0x50')]);}break;case _0x0779('0x51'):var _0x1e0934=_0x407951[_0x0779('0x48')][_0x0779('0x52')](',')[_0x0779('0x1d')](function(_0x750d83){return Number(_0x750d83);});var _0x212abe=parseTagParameter(_0x1e0934);_0x3e8b67[_0x0779('0x53')][_0x0779('0x54')]['and'](_0x212abe);_0x3e8b67['tags'][_0x0779('0x55')]=_0x1e0934;break;case _0x0779('0x56'):if(_0x407951[_0x0779('0x57')]===_0x0779('0x4d')){_0x3e8b67[_0x0779('0x58')][_0x181bb1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x407951[_0x0779('0x48')]+'%',null);}else{_0xda1f50=_[_0x0779('0x43')](_0x3bc4d1,['name','UserId']);_0x407951[_0x0779('0xd')]=_0x0779('0x59');_0x52519b=as[_0x0779('0x44')](_0x7669ef,_0xda1f50[_0x0779('0x45')],_0x407951);_0x3e8b67[_0x0779('0x58')][_0x181bb1](_0x52519b['text'],_0x52519b[_0x0779('0x48')][_0x0779('0x49')],_0x52519b[_0x0779('0x48')][_0x0779('0x50')]);}break;case'body':case _0x0779('0x5a'):_0x52519b=as[_0x0779('0x44')]('me',null,_0x407951);_0x3e8b67['body'][_0x181bb1](_0x52519b['text'],_0x52519b[_0x0779('0x48')][_0x0779('0x49')],_0x52519b[_0x0779('0x48')]['end']);break;}}}return _0x3e8b67;}function parseModelFields(_0x119813,_0x23dbb8,_0x2b52e7){var _0x47a3cb=utils[_0x0779('0x8')](_0x119813);var _0x302860=squel[_0x0779('0x2b')]();var _0x399cbe=_(_0x23dbb8)[_0x0779('0x5b')]()[_0x0779('0x1d')](function(_0x4a034c){return _['some'](_0x2b52e7,[_0x0779('0xe'),_0x4a034c])?_0x4a034c:undefined;})[_0x0779('0x5c')]()[_0x0779('0x48')]();if(_0x399cbe['length']>0x0){_0x399cbe[_0x0779('0x2d')](function(_0x394c8c){if(_0x394c8c===_0x47a3cb){_0x302860[_0x0779('0x5d')]('i.'+_0x47a3cb+_0x0779('0x1c'),[]['concat'](_0x23dbb8[_0x394c8c]));}else if(_0x394c8c===_0x0779('0x5e')){var _0x5846b0=JSON[_0x0779('0x5f')](_0x23dbb8[_0x394c8c])[_0x0779('0x60')];var _0x303693=JSON[_0x0779('0x5f')](_0x23dbb8[_0x394c8c])[_0x0779('0x61')];_0x302860[_0x0779('0x5d')](_0x0779('0x62'),_0x5846b0,_0x303693);}else{if(_0x23dbb8[_0x394c8c]===_0x0779('0x63')){_0x302860[_0x0779('0x5d')]('i.'+_0x394c8c+_0x0779('0x64'));}else{_0x302860[_0x0779('0x5d')]('i.'+_0x394c8c+_0x0779('0x65'),_0x23dbb8[_0x394c8c]);}}});}return _0x302860;}function parseQueryParameters(_0x2d53ae,_0x33548f,_0xd44eca){var _0x2732a8=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x2d53ae,_0x33548f,_0xd44eca);})[_0x0779('0x66')](function(_0x54114a){_0x2732a8[_0x0779('0x67')][_0x0779('0x5d')](_0x54114a);return parseReadParameter(_0x33548f['read']);})[_0x0779('0x66')](function(_0x221336){_0x2732a8[_0x0779('0x4b')][_0x0779('0x5d')](_0x221336);return parseTagParameter(_0x33548f['tag']);})[_0x0779('0x66')](function(_0x1c1070){_0x2732a8[_0x0779('0x53')][_0x0779('0x54')][_0x0779('0x5d')](_0x1c1070);return parseSearchFilter(_0x2d53ae,_0x33548f[_0x0779('0x68')]);})[_0x0779('0x66')](function(_0x57a43e){_0x2732a8[_0x0779('0x68')]=_0x57a43e;return _0x2732a8;});}function checkAccountsRestrictions(_0x1c95a3,_0x442808,_0x484938){var _0x55efad=utils['getAccountFK'](_0x1c95a3);var _0x24a6ca=_0x0779('0x69')+_[_0x0779('0x6a')](_0x1c95a3)+(_0x1c95a3===_0x0779('0x6b')?'Websites':'Accounts');var _0x301b34=squel[_0x0779('0x2b')]();return Promise[_0x0779('0x6c')]()[_0x0779('0x66')](function(){if(_0x484938['search']&&_0x442808[_0x0779('0x9')]===_0x0779('0xa')){return _0x442808[_0x24a6ca]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3875d1){if(_0x3875d1){if(_0x3875d1[_0x0779('0x1b')]===0x0){_0x301b34[_0x0779('0x5d')]('i.'+_0x55efad+_0x0779('0x64'));}else{_0x301b34[_0x0779('0x5d')]('i.'+_0x55efad+_0x0779('0x1c'),_[_0x0779('0x1d')](_0x3875d1,'id'));}}else if(!_0x484938[_0x55efad]){_0x301b34[_0x0779('0x5d')]('i.'+_0x55efad+_0x0779('0x6d'));}})[_0x0779('0x66')](function(){return _0x301b34;});}function getClosedOrderClause(_0x4d601c,_0x511557){var _0x75754b='';var _0x54a7f7=[_0x0779('0x6e'),_0x0779('0x6f'),_0x0779('0x70')];if(_0x4d601c===_0x0779('0x3b')){_0x54a7f7[_0x0779('0x71')](_0x0779('0x72'));}if(_0x511557[_0x0779('0x73')]==='0'&&_0x4d601c==='mail'){_0x75754b=_0x0779('0x72');}else{if(_0x511557[_0x0779('0x73')]==='1'){_0x54a7f7[_0x0779('0x74')]();}_0x75754b='CONCAT_WS(\x27\x27,\x20'+_0x54a7f7[_0x0779('0x75')](',\x20')+')';}return _0x75754b;}function getFilteredInteractions(_0x39795e,_0x3a9e5b,_0x313fcd,_0x12821b){var _0x1f37e5=utils[_0x0779('0x12')](_0x39795e);var _0x564c45=_[_0x0779('0x6a')](_0x39795e)+_0x0779('0x76');var _0x19c465=[];var _0x18cc73=getTagsQuery();var _0x8830a3={'type':db[_0x0779('0x77')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3c77dc=[];var _0x215e18=[];return db[_0x0779('0x78')][_0x0779('0x79')](_0x18cc73[_0x0779('0x7a')](),_0x8830a3)['then'](function(_0x51c82e){_0x19c465=_[_0x0779('0x7b')](_0x51c82e,'id');_0x8830a3=_[_0x0779('0x7c')](_0x8830a3,{'model':db[_0x564c45],'mapToModel':!![],'nest':!![]});if(_0x313fcd['fields']){_0x12821b['attributes'][_0x0779('0x2d')](function(_0x491211){_0x3a9e5b[_0x0779('0xd')]('i.'+_0x491211);});}else{_0x3a9e5b['field'](_0x0779('0x7d'),_0x0779('0x4a'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x7e'),_0x0779('0x7f'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x80'),_0x0779('0x81'));if(_0x39795e===_0x0779('0x3b')){_0x3a9e5b[_0x0779('0xd')](_0x0779('0x82'),_0x0779('0x83'));_0x3a9e5b['field'](_0x0779('0x84'),_0x0779('0x85'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x86'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x87'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x88'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x89'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x8a'));_0x3a9e5b['field'](_0x0779('0x8b'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x8c'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x8d'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x8e'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x70'));_0x3a9e5b[_0x0779('0xd')]('i.secondDisposition');_0x3a9e5b[_0x0779('0xd')](_0x0779('0x6e'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x72'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x8f'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x90'));_0x3a9e5b['field'](_0x0779('0x91'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x92'));}else if(_0x39795e===_0x0779('0x39')){_0x3a9e5b[_0x0779('0xd')]('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',_0x0779('0x85'));}else{_0x3a9e5b[_0x0779('0xd')](_0x0779('0x93'),'contactName');}if(_0x39795e!==_0x0779('0x3b')){_0x3a9e5b[_0x0779('0xd')]('i.*');}_0x3a9e5b['field']('c.firstName','Contact.firstName');_0x3a9e5b['field'](_0x0779('0x94'),_0x0779('0x95'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x96'),'Contact.email');_0x3a9e5b[_0x0779('0xd')](_0x0779('0x97'),_0x0779('0x98'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x99'),'Contact.mobile');_0x3a9e5b[_0x0779('0xd')]('c.fax',_0x0779('0x9a'));_0x3a9e5b['field'](_0x0779('0x9b'),_0x0779('0x9c'));_0x3a9e5b[_0x0779('0xd')](_0x0779('0x9d'),'Owner.internal');_0x3a9e5b['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0779('0x9e'));}if(_0x12821b[_0x0779('0x9f')]){_0x3a9e5b[_0x0779('0x9f')](_0x12821b[_0x0779('0x9f')]);}if(_0x12821b['offset']){_0x3a9e5b['offset'](_0x12821b[_0x0779('0xa0')]);}return db[_0x0779('0x78')][_0x0779('0x79')](_0x3a9e5b[_0x0779('0x7a')](),_0x8830a3);})['then'](function(_0x53573a){_0x3c77dc=_0x53573a;var _0x561feb=getUsersQuery(_0x39795e,_0x3c77dc);return db[_0x0779('0x78')][_0x0779('0x79')](_0x561feb[_0x0779('0x7a')](),_0x8830a3);})[_0x0779('0x66')](function(_0x4de9ce){_0x215e18=_['groupBy'](_0x4de9ce,_0x1f37e5);if(_0x39795e===_0x0779('0x3b')){return db[_0x0779('0xa1')]['findOne']({'attributes':[_0x0779('0xa2')],'raw':!![]});}})['then'](function(_0x283269){var _0x146b7c=_0x283269?_0x283269['enableEmailPreview']:undefined;var _0x1a6701=_0x3c77dc['map'](function(_0x293aac){return updateInteraction(_0x293aac,_0x19c465,_0x215e18,_0x146b7c);});return Promise[_0x0779('0xa3')](_0x1a6701);});}function countFilteredInteractions(_0x5d6462,_0x244766){var _0x5ecf85=_0x5d6462[_0x0779('0xa4')]();_0x5ecf85[_0x0779('0xd')](_0x0779('0xa5'));_0x5ecf85['field'](_0x0779('0x7d'),_0x0779('0x4a'));var _0x1e8b89=utils[_0x0779('0x2c')](_0x244766);if(!_[_0x0779('0xa6')](_0x1e8b89)){_0x5ecf85['where'](_0x0779('0xa7'),_0x1e8b89);}var _0x25c026={'type':db[_0x0779('0x77')][_0x0779('0xa8')]['SELECT'],'raw':!![]};return db[_0x0779('0x78')][_0x0779('0x79')](_0x5ecf85['toString'](),_0x25c026);}module[_0x0779('0xa9')]={'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 cb2caff..a0e79e9 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 _0x9836=['then','TagIds','Tags','catch','lodash','../../mysqldb','map','fullname','forEach','push','waiting','talking','answered','unmanaged','closed','disposition','abandoned','UserId','total','MailMessage','findOne','out','plainBody','lastMsgText','trimStart','updateInteraction'];(function(_0x71c2ac,_0x32eb1f){var _0x47582e=function(_0x2365f8){while(--_0x2365f8){_0x71c2ac['push'](_0x71c2ac['shift']());}};_0x47582e(++_0x32eb1f);}(_0x9836,0xd4));var _0x6983=function(_0x2cbc48,_0x316303){_0x2cbc48=_0x2cbc48-0x0;var _0x30f314=_0x9836[_0x2cbc48];return _0x30f314;};'use strict';var _=require(_0x6983('0x0'));var db=require(_0x6983('0x1'))['db'];function getInteractionUsers(_0x32dc7a,_0x30ee4f){return new Promise(function(_0x4e86fc,_0xc42a60){try{var _0x14ad3b=[];if(_0x30ee4f[_0x32dc7a]){_0x14ad3b=_0x30ee4f[_0x32dc7a][_0x6983('0x2')](function(_0x469d25){return{'id':_0x469d25['id'],'fullname':_0x469d25[_0x6983('0x3')]};});}return _0x4e86fc(_0x14ad3b);}catch(_0x2ea3bd){_0xc42a60(_0x2ea3bd);}});}function getInteractionTags(_0x18c809,_0x317ace){var _0x38b212=[];if(_0x18c809){_0x18c809['split'](',')[_0x6983('0x4')](function(_0x122db9){_0x38b212[_0x6983('0x5')](_0x317ace[_0x122db9]);});}return _0x38b212;}function updateWaitingCounter(_0x42031f){if(_0x42031f[_0x6983('0x6')]){_0x42031f[_0x6983('0x6')]-=0x1;}}function updateInteractionCounters(_0x46fb63){_0x46fb63[_0x6983('0x6')]=0x0;_0x46fb63[_0x6983('0x7')]=0x0;_0x46fb63[_0x6983('0x8')]=0x0;_0x46fb63[_0x6983('0x9')]=0x0;_0x46fb63['abandoned']=0x0;_0x46fb63['total']=0x0;if(_0x46fb63[_0x6983('0xa')]){if(_0x46fb63[_0x6983('0xb')]===_0x6983('0xc')){_0x46fb63[_0x6983('0xc')]+=0x1;updateWaitingCounter(_0x46fb63);}if(_0x46fb63[_0x6983('0xd')]){_0x46fb63['answered']+=0x1;if(_0x46fb63[_0x6983('0x7')]){_0x46fb63[_0x6983('0x7')]-=0x1;}}else{if(_0x46fb63['disposition']){_0x46fb63[_0x6983('0x9')]+=0x1;updateWaitingCounter(_0x46fb63);}}}else{if(!_0x46fb63[_0x6983('0xd')]){_0x46fb63[_0x6983('0x6')]+=0x1;}if(_0x46fb63[_0x6983('0xd')]){_0x46fb63[_0x6983('0x7')]+=0x1;updateWaitingCounter(_0x46fb63);}}_0x46fb63[_0x6983('0xe')]+=0x1;return _0x46fb63;}function getLastMessageText(_0x1754b0){return db[_0x6983('0xf')][_0x6983('0x10')]({'where':{'$and':[{'MailInteractionId':_0x1754b0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6983('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6983('0x12')],'order':'-id','raw':!![]})['then'](function(_0x2b2f8d){if(_0x2b2f8d&&_0x2b2f8d[_0x6983('0x12')]){_0x1754b0[_0x6983('0x13')]=_[_0x6983('0x14')](_0x2b2f8d[_0x6983('0x12')]);}return _0x1754b0;})['catch'](function(_0xcf79af){throw _0xcf79af;});}exports[_0x6983('0x15')]=function(_0x552d28,_0x104b17,_0x346fe9,_0x2b9685){return new Promise(function(_0x8138e8,_0x21aaeb){return getInteractionUsers(_0x552d28['id'],_0x346fe9)[_0x6983('0x16')](function(_0x15e478){_0x552d28['Users']=_0x15e478;return getInteractionTags(_0x552d28[_0x6983('0x17')],_0x104b17);})['then'](function(_0x107ac3){_0x552d28[_0x6983('0x18')]=_0x107ac3;delete _0x552d28[_0x6983('0x17')];return updateInteractionCounters(_0x552d28);})[_0x6983('0x16')](function(_0xeafded){if(_0x2b9685){return getLastMessageText(_0xeafded);}else{return _0xeafded;}})[_0x6983('0x16')](function(_0x20c094){_0x8138e8(_0x20c094);})[_0x6983('0x19')](function(_0xcbec26){_0x21aaeb(_0xcbec26);});});}; \ No newline at end of file +var _0x65c3=['talking','answered','unmanaged','abandoned','total','closed','UserId','disposition','MailMessage','out','-id','then','lastMsgText','trimStart','plainBody','catch','Users','Tags','lodash','../../mysqldb','map','split','push','waiting'];(function(_0x128e85,_0x50d240){var _0x36e54a=function(_0x1d7609){while(--_0x1d7609){_0x128e85['push'](_0x128e85['shift']());}};_0x36e54a(++_0x50d240);}(_0x65c3,0xd2));var _0x365c=function(_0x23535,_0x50d4e8){_0x23535=_0x23535-0x0;var _0x25be31=_0x65c3[_0x23535];return _0x25be31;};'use strict';var _=require(_0x365c('0x0'));var db=require(_0x365c('0x1'))['db'];function getInteractionUsers(_0x35448e,_0x56f2cf){return new Promise(function(_0x5f705f,_0x43aada){try{var _0x24b6a3=[];if(_0x56f2cf[_0x35448e]){_0x24b6a3=_0x56f2cf[_0x35448e][_0x365c('0x2')](function(_0x383011){return{'id':_0x383011['id'],'fullname':_0x383011['fullname']};});}return _0x5f705f(_0x24b6a3);}catch(_0x15f88a){_0x43aada(_0x15f88a);}});}function getInteractionTags(_0x41e770,_0x161345){var _0x3b7b80=[];if(_0x41e770){_0x41e770[_0x365c('0x3')](',')['forEach'](function(_0x34377a){_0x3b7b80[_0x365c('0x4')](_0x161345[_0x34377a]);});}return _0x3b7b80;}function updateWaitingCounter(_0x543fd3){if(_0x543fd3[_0x365c('0x5')]){_0x543fd3['waiting']-=0x1;}}function updateInteractionCounters(_0x44c626){_0x44c626[_0x365c('0x5')]=0x0;_0x44c626[_0x365c('0x6')]=0x0;_0x44c626[_0x365c('0x7')]=0x0;_0x44c626[_0x365c('0x8')]=0x0;_0x44c626[_0x365c('0x9')]=0x0;_0x44c626[_0x365c('0xa')]=0x0;if(_0x44c626[_0x365c('0xb')]){if(_0x44c626['disposition']===_0x365c('0x9')){_0x44c626['abandoned']+=0x1;updateWaitingCounter(_0x44c626);}if(_0x44c626[_0x365c('0xc')]){_0x44c626[_0x365c('0x7')]+=0x1;if(_0x44c626['talking']){_0x44c626[_0x365c('0x6')]-=0x1;}}else{if(_0x44c626[_0x365c('0xd')]){_0x44c626[_0x365c('0x8')]+=0x1;updateWaitingCounter(_0x44c626);}}}else{if(!_0x44c626[_0x365c('0xc')]){_0x44c626['waiting']+=0x1;}if(_0x44c626[_0x365c('0xc')]){_0x44c626[_0x365c('0x6')]+=0x1;updateWaitingCounter(_0x44c626);}}_0x44c626[_0x365c('0xa')]+=0x1;return _0x44c626;}function getLastMessageText(_0x493c17){return db[_0x365c('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x493c17['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x365c('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x365c('0x10'),'raw':!![]})[_0x365c('0x11')](function(_0x36b781){if(_0x36b781&&_0x36b781['plainBody']){_0x493c17[_0x365c('0x12')]=_[_0x365c('0x13')](_0x36b781[_0x365c('0x14')]);}return _0x493c17;})[_0x365c('0x15')](function(_0x5a16dd){throw _0x5a16dd;});}exports['updateInteraction']=function(_0x5ab512,_0x1f88ba,_0x575bf1,_0x32035a){return new Promise(function(_0x2c6945,_0xfbcf89){return getInteractionUsers(_0x5ab512['id'],_0x575bf1)[_0x365c('0x11')](function(_0xf66c95){_0x5ab512[_0x365c('0x16')]=_0xf66c95;return getInteractionTags(_0x5ab512['TagIds'],_0x1f88ba);})[_0x365c('0x11')](function(_0x1a6e0c){_0x5ab512[_0x365c('0x17')]=_0x1a6e0c;delete _0x5ab512['TagIds'];return updateInteractionCounters(_0x5ab512);})['then'](function(_0x49afd4){if(_0x32035a){return getLastMessageText(_0x49afd4);}else{return _0x49afd4;}})[_0x365c('0x11')](function(_0x7e8d14){_0x2c6945(_0x7e8d14);})[_0x365c('0x15')](function(_0xeb0227){_0xfbcf89(_0xeb0227);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 28b3c84..2c7bd44 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 _0x2ea2=['../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','Website','InteractionId','upperFirst','unknown','chat','websites','accounts','_interaction_has_tags','_messages','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','update','then','info','catch','error','exports','lodash'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x2ea2,0x1b9));var _0x22ea=function(_0x42ab66,_0x485c4b){_0x42ab66=_0x42ab66-0x0;var _0xed120a=_0x2ea2[_0x42ab66];return _0xed120a;};'use strict';var _=require(_0x22ea('0x0'));var db=require(_0x22ea('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x22ea('0x2')),'mail':require(_0x22ea('0x3'))(_0x22ea('0x4')),'fax':require(_0x22ea('0x3'))(_0x22ea('0x5')),'sms':require(_0x22ea('0x3'))(_0x22ea('0x6')),'chat':require(_0x22ea('0x3'))('chat-interactions'),'whatsapp':require(_0x22ea('0x3'))(_0x22ea('0x7'))};function getAccountFK(_0x3f9c62){return _[_0x22ea('0x8')](_0x3f9c62)+(_0x3f9c62==='chat'?_0x22ea('0x9'):'Account')+'Id';}function getInteractionFK(_0x59f774){return _[_0x22ea('0x8')](_0x59f774)+_0x22ea('0xa');}function getInteractionId(_0x304427,_0x412029,_0x161868){if(_0x304427&&_0x304427[_['upperFirst'](_0x161868)+_0x22ea('0xa')]){return _0x304427[_[_0x22ea('0xb')](_0x161868)+_0x22ea('0xa')];}else if(_0x304427&&_0x304427['id']){return _0x304427['id'];}else if(_0x412029&&_0x412029['id']){return _0x412029['id'];}else{return _0x22ea('0xc');}}function getInteractionsTables(_0x4356e0){return{'accounts':_0x4356e0+'_'+(_0x4356e0===_0x22ea('0xd')?_0x22ea('0xe'):_0x22ea('0xf')),'interactions':_0x4356e0+'_interactions','interactionsTags':_0x4356e0+_0x22ea('0x10'),'messages':_0x4356e0+_0x22ea('0x11'),'userInteractions':'user_has_'+_0x4356e0+_0x22ea('0x12')};}function getSelectedTags(_0x43cb29){var _0x55883c=[];if(_0x43cb29){_0x55883c=Array[_0x22ea('0x13')](_0x43cb29)?_0x43cb29:[_0x43cb29];}return _0x55883c;}function log(_0x1e5e67,_0x6b1495,_0x8c980,_0x110096,_0x35ca13,_0x2d9bbd){loggers[_0x35ca13[_0x22ea('0x14')]()][_0x1e5e67](_0x22ea('0x15'),_0x2d9bbd[_0x22ea('0x16')](),_0x6b1495?_0x6b1495['id']:null,_0x6b1495?_0x6b1495[_0x22ea('0x17')]:null,_0x6b1495?_0x6b1495[_0x22ea('0x18')]:null,getInteractionId(_0x8c980,_0x110096,_0x35ca13),_0x8c980?JSON[_0x22ea('0x19')](_0x8c980):_0x22ea('0x1a'));}function updateUser(_0x57d964,_0x3cc861,_0x19e84e,_0x2d1235,_0x2db9a1){db[_[_0x22ea('0xb')](_0x2d1235)+_0x22ea('0x1b')]['findOne']({'where':{'id':getInteractionId(_0x3cc861,_0x19e84e,_0x2d1235)}})['then'](function(_0xac4633){if(_0xac4633){return _0xac4633[_0x22ea('0x1c')]({'UserId':_0x57d964?_0x57d964['id']:null});}})[_0x22ea('0x1d')](function(_0xd6c595){if(_0xd6c595){log(_0x22ea('0x1e'),_0x57d964,_0x3cc861,_0x19e84e,_0x2d1235,_0x2db9a1);}})[_0x22ea('0x1f')](function(){log(_0x22ea('0x20'),_0x57d964,_0x3cc861,_0x19e84e,_0x2d1235,_0x2db9a1);});}module[_0x22ea('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x8141=['update','info','catch','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','toUpperCase','name','stringify','null','Interaction','findOne','then'];(function(_0x5db168,_0x4dcb67){var _0x4608c7=function(_0x21cbc1){while(--_0x21cbc1){_0x5db168['push'](_0x5db168['shift']());}};_0x4608c7(++_0x4dcb67);}(_0x8141,0x103));var _0x1814=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8141[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1814('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x1814('0x1'))(_0x1814('0x2')),'mail':require('../../config/logger')(_0x1814('0x3')),'fax':require('../../config/logger')(_0x1814('0x4')),'sms':require('../../config/logger')(_0x1814('0x5')),'chat':require(_0x1814('0x1'))(_0x1814('0x6')),'whatsapp':require('../../config/logger')(_0x1814('0x7'))};function getAccountFK(_0x18e199){return _['capitalize'](_0x18e199)+(_0x18e199===_0x1814('0x8')?_0x1814('0x9'):_0x1814('0xa'))+'Id';}function getInteractionFK(_0x1db5b1){return _[_0x1814('0xb')](_0x1db5b1)+_0x1814('0xc');}function getInteractionId(_0x511f90,_0x47f886,_0x547b17){if(_0x511f90&&_0x511f90[_[_0x1814('0xd')](_0x547b17)+_0x1814('0xc')]){return _0x511f90[_[_0x1814('0xd')](_0x547b17)+_0x1814('0xc')];}else if(_0x511f90&&_0x511f90['id']){return _0x511f90['id'];}else if(_0x47f886&&_0x47f886['id']){return _0x47f886['id'];}else{return _0x1814('0xe');}}function getInteractionsTables(_0xc88a89){return{'accounts':_0xc88a89+'_'+(_0xc88a89==='chat'?_0x1814('0xf'):_0x1814('0x10')),'interactions':_0xc88a89+_0x1814('0x11'),'interactionsTags':_0xc88a89+_0x1814('0x12'),'messages':_0xc88a89+_0x1814('0x13'),'userInteractions':'user_has_'+_0xc88a89+_0x1814('0x11')};}function getSelectedTags(_0x1c71e6){var _0x109a67=[];if(_0x1c71e6){_0x109a67=Array[_0x1814('0x14')](_0x1c71e6)?_0x1c71e6:[_0x1c71e6];}return _0x109a67;}function log(_0x1aedc0,_0xeab3e2,_0x1ca432,_0x3a5034,_0x4ac9b4,_0x508e89){loggers[_0x4ac9b4[_0x1814('0x15')]()][_0x1aedc0]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x508e89[_0x1814('0x16')](),_0xeab3e2?_0xeab3e2['id']:null,_0xeab3e2?_0xeab3e2[_0x1814('0x17')]:null,_0xeab3e2?_0xeab3e2['role']:null,getInteractionId(_0x1ca432,_0x3a5034,_0x4ac9b4),_0x1ca432?JSON[_0x1814('0x18')](_0x1ca432):_0x1814('0x19'));}function updateUser(_0x15a626,_0x544f44,_0x392261,_0x1e8987,_0x3f712a){db[_['upperFirst'](_0x1e8987)+_0x1814('0x1a')][_0x1814('0x1b')]({'where':{'id':getInteractionId(_0x544f44,_0x392261,_0x1e8987)}})[_0x1814('0x1c')](function(_0x393019){if(_0x393019){return _0x393019[_0x1814('0x1d')]({'UserId':_0x15a626?_0x15a626['id']:null});}})[_0x1814('0x1c')](function(_0xcc34f9){if(_0xcc34f9){log(_0x1814('0x1e'),_0x15a626,_0x544f44,_0x392261,_0x1e8987,_0x3f712a);}})[_0x1814('0x1f')](function(){log('error',_0x15a626,_0x544f44,_0x392261,_0x1e8987,_0x3f712a);});}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 58a91e3..14bc2bd 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 _0x9127=['final','parse','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','data1','license','split','aes-256-ctr','%s:%s:%s','base64'];(function(_0x2d6d2b,_0x37b253){var _0x5bea9b=function(_0xaa0484){while(--_0xaa0484){_0x2d6d2b['push'](_0x2d6d2b['shift']());}};_0x5bea9b(++_0x37b253);}(_0x9127,0x1b9));var _0x7912=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x9127[_0x49a57c];return _0x4e0316;};'use strict';var crypto=require('crypto');var util=require(_0x7912('0x0'));var compose=require(_0x7912('0x1'));var db=require(_0x7912('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1368e1,_0x47a5fa){if(_0x1368e1&&_0x47a5fa){if(_0x47a5fa[_0x7912('0x3')]&&_0x47a5fa[_0x7912('0x4')]){var _0x1b055a=_0x47a5fa['data1'];var _0x93ac61=_0x47a5fa[_0x7912('0x4')];var _0x35db67=_0x1b055a[_0x7912('0x5')]('-')[0x4];var _0x413d27=_0x1b055a['split']('-')[0x0];var _0x24a18c=crypto['createDecipher'](_0x7912('0x6'),util['format'](_0x7912('0x7'),_0x35db67,_0x1b055a,_0x413d27));var _0x1a5d42=_0x24a18c['update'](_0x93ac61,_0x7912('0x8'),'utf8');_0x1a5d42+=_0x24a18c[_0x7912('0x9')]('utf8');var _0x4c6436=JSON[_0x7912('0xa')](_0x1a5d42);return _0x4c6436['hasOwnProperty'](_0x1368e1)?_0x4c6436[_0x1368e1]:null;}}return null;}function isLimit(_0x373297,_0x37db7a,_0x1ce4df,_0x297821){var _0x1367ee=_0x37db7a;return compose()[_0x7912('0xb')](function(_0x2377aa,_0x3fccfd,_0x3ece3d){return db[_0x7912('0xc')][_0x7912('0xd')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x15b481){var _0x1a268f=getValueFromLicense(_0x373297,_0x15b481);return _0x1a268f?_0x1a268f:_0x1367ee;})[_0x7912('0xe')](function(_0x2de881){_0x1367ee=_0x2de881;return _0x1ce4df[_0x7912('0xf')](_0x297821);})[_0x7912('0xe')](function(_0x399569){if(_0x399569>=_0x1367ee){return _0x3fccfd[_0x7912('0x10')](0x193)['json']({'message':util[_0x7912('0x11')](_0x7912('0x12'),_0x373297)});}_0x3ece3d();})[_0x7912('0x13')](function(_0x47134d){_0x3ece3d(_0x47134d);});});}function isUserLimit(){return isLimit(_0x7912('0x14'),0x1,db[_0x7912('0x15')],{'where':{'$or':[{'role':_0x7912('0x16')},{'role':_0x7912('0x17')}]}});}exports[_0x7912('0x18')]=isUserLimit; \ No newline at end of file +var _0x5496=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','util','composable-middleware','../../config/environment','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','utf8','parse','License','findOne','then','count'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x5496,0x1bf));var _0x6549=function(_0x444b0c,_0x3ed0b9){_0x444b0c=_0x444b0c-0x0;var _0xdcdea8=_0x5496[_0x444b0c];return _0xdcdea8;};'use strict';var crypto=require('crypto');var util=require(_0x6549('0x0'));var compose=require(_0x6549('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x6549('0x2'));function getValueFromLicense(_0x17a6e5,_0x50bbcc){if(_0x17a6e5&&_0x50bbcc){if(_0x50bbcc['data1']&&_0x50bbcc['license']){var _0x52858a=_0x50bbcc['data1'];var _0x48ec0a=_0x50bbcc[_0x6549('0x3')];var _0x2c6520=_0x52858a[_0x6549('0x4')]('-')[0x4];var _0x40f6d9=_0x52858a[_0x6549('0x4')]('-')[0x0];var _0xd9d1ae=crypto[_0x6549('0x5')](_0x6549('0x6'),util['format'](_0x6549('0x7'),_0x2c6520,_0x52858a,_0x40f6d9));var _0x2a39f5=_0xd9d1ae[_0x6549('0x8')](_0x48ec0a,'base64',_0x6549('0x9'));_0x2a39f5+=_0xd9d1ae['final'](_0x6549('0x9'));var _0x5af8c4=JSON[_0x6549('0xa')](_0x2a39f5);return _0x5af8c4['hasOwnProperty'](_0x17a6e5)?_0x5af8c4[_0x17a6e5]:null;}}return null;}function isLimit(_0x230d4f,_0x566a63,_0x3c5991,_0x3ac8e4){var _0x39e39b=_0x566a63;return compose()['use'](function(_0x3aab0e,_0x3b85a8,_0x4ab950){return db[_0x6549('0xb')][_0x6549('0xc')]({'where':{'id':0x1},'raw':!![]})[_0x6549('0xd')](function(_0x51cf91){var _0x307f29=getValueFromLicense(_0x230d4f,_0x51cf91);return _0x307f29?_0x307f29:_0x39e39b;})[_0x6549('0xd')](function(_0x4582ab){_0x39e39b=_0x4582ab;return _0x3c5991[_0x6549('0xe')](_0x3ac8e4);})['then'](function(_0x394cd8){if(_0x394cd8>=_0x39e39b){return _0x3b85a8['status'](0x193)['json']({'message':util['format'](_0x6549('0xf'),_0x230d4f)});}_0x4ab950();})[_0x6549('0x10')](function(_0x212285){_0x4ab950(_0x212285);});});}function isUserLimit(){return isLimit(_0x6549('0x11'),0x1,db['User'],{'where':{'$or':[{'role':_0x6549('0x12')},{'role':_0x6549('0x13')}]}});}exports[_0x6549('0x14')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index e9c77d0..1da43e4 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 _0x5915=['days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','seconds','lodash','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add'];(function(_0x140010,_0x4d7233){var _0x373bb8=function(_0x2b6291){while(--_0x2b6291){_0x140010['push'](_0x140010['shift']());}};_0x373bb8(++_0x4d7233);}(_0x5915,0x180));var _0x5591=function(_0x2cbaef,_0x1224b1){_0x2cbaef=_0x2cbaef-0x0;var _0x566b12=_0x5915[_0x2cbaef];return _0x566b12;};'use strict';var _=require(_0x5591('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x2c2f91){var _0x5519c3={'conditions':[]};_0x5519c3[_0x5591('0x1')]=_[_0x5591('0x2')](_0x2c2f91,_0x5591('0x3'))?'or':_0x5591('0x4');var _0x28c371=_0x2c2f91['replace'](_0x5591('0x5'),'')[_0x5591('0x6')](_0x5591('0x3'),'')[_0x5591('0x7')]('||');for(var _0x2f7a3d=0x0;_0x2f7a3d<_0x28c371[_0x5591('0x8')];_0x2f7a3d++){var _0x44d68a=_0x28c371[_0x2f7a3d][_0x5591('0x7')](':=');var _0x2ad06a=_0x44d68a[0x0];var _0x340628=_0x44d68a[_0x5591('0x9')](0x1);_0x340628[_0x5591('0xa')](function(_0x308868){var _0x26b2d5=_0x308868[_0x5591('0x7')]('[')[_0x5591('0xb')]();var _0x394b48=_0x308868[_0x5591('0xc')](/\[(.*?)\]/g);_0x394b48[_0x5591('0xa')](function(_0xe2edce){var _0x575f58=_0xe2edce[_0x5591('0x7')]('[')[_0x5591('0xd')](function(_0x1bdbee){return _0x1bdbee[_0x5591('0xe')](']')>-0x1;})['map'](function(_0x300c97){return _0x300c97[_0x5591('0x7')](']')[0x0];})[0x0];_0x5519c3['conditions']['push']({'field':_0x2ad06a,'operator':_0x26b2d5,'value':_0x575f58});});});}return _0x5519c3;};exports[_0x5591('0xf')]=function(_0x1d1901,_0x44553d,_0x49faab){var _0x1bd43e={};if(_0x44553d===_0x5591('0x10')){if(_0x49faab[_0x5591('0x11')]===_0x5591('0x12')){_0x49faab[_0x5591('0x11')]=_0x5591('0x13');_0x49faab[_0x5591('0x14')]+=','+_0x49faab['value'];}else if(_[_0x5591('0x15')](['$gt',_0x5591('0x16')],_0x49faab[_0x5591('0x11')])){_0x49faab[_0x5591('0x14')]=moment(_0x49faab[_0x5591('0x14')])[_0x5591('0x17')](0x1,_0x5591('0x18'))[_0x5591('0x19')](_0x5591('0x1a'));}}if(_0x49faab[_0x5591('0x1b')]){_0x44553d=_0x49faab[_0x5591('0x1b')];_0x1bd43e[_0x5591('0x1c')]=_0x5591('0x1d')+_0x1d1901+'.'+_0x49faab[_0x5591('0x1e')]+'\x20AS\x20'+_0x49faab[_0x5591('0x1b')]+')\x20'+parseOperator(_0x49faab[_0x5591('0x11')]);}else{_0x1bd43e[_0x5591('0x1c')]=_0x1d1901+'.'+_0x49faab[_0x5591('0x1e')]+'\x20'+parseOperator(_0x49faab[_0x5591('0x11')]);}if(_['includes']([_0x5591('0x1f'),_0x5591('0x20')],_0x49faab[_0x5591('0x11')]))_0x1bd43e[_0x5591('0x1c')]='('+_0x1bd43e[_0x5591('0x1c')]+_0x5591('0x21')+_0x1d1901+'.'+_0x49faab['field']+_0x5591('0x22');_0x1bd43e[_0x5591('0x14')]=parseValue(_0x44553d,_0x49faab['operator'],_0x49faab[_0x5591('0x14')]);return _0x1bd43e;};function parseOperator(_0x4881ba){var _0x38b1da;switch(_0x4881ba){case _0x5591('0x23'):_0x38b1da=_0x5591('0x24');break;case _0x5591('0x20'):_0x38b1da=_0x5591('0x25');break;case _0x5591('0x12'):_0x38b1da=_0x5591('0x26');break;case'$ne':_0x38b1da='<>\x20?';break;case _0x5591('0x27'):case _0x5591('0x28'):case _0x5591('0x29'):_0x38b1da='LIKE\x20?';break;case'$lt':_0x38b1da=_0x5591('0x2a');break;case'$gt':_0x38b1da=_0x5591('0x2b');break;case _0x5591('0x16'):_0x38b1da=_0x5591('0x2c');break;case'$gte':_0x38b1da='>=\x20?';break;case'$between':_0x38b1da=_0x5591('0x2d');break;}return _0x38b1da;}function parseValue(_0x3b45ef,_0x5ba7c8,_0x458ded){var _0x4cf66c={'start':undefined,'end':undefined};switch(_0x5ba7c8){case _0x5591('0x23'):case _0x5591('0x20'):_0x4cf66c['start']=_0x458ded[_0x5591('0x7')](',');break;case'$substring':_0x4cf66c[_0x5591('0x2e')]='%'+_0x458ded+'%';break;case _0x5591('0x28'):_0x4cf66c[_0x5591('0x2e')]=_0x458ded+'%';break;case'$endsWith':_0x4cf66c[_0x5591('0x2e')]='%'+_0x458ded;break;case'$between':var _0x587442=_0x458ded[_0x5591('0x7')](',');var _0x458ded=_0x587442[_0x5591('0xb')]();var _0x2f048b=_0x587442[_0x5591('0x2f')]();if(_0x3b45ef==='DATE'){_0x458ded=moment(_0x458ded)[_0x5591('0x30')](0x0,!![])[_0x5591('0x19')]();_0x2f048b=moment(_0x2f048b)['utcOffset'](0x0,!![])[_0x5591('0x17')](0x17,_0x5591('0x31'))['add'](0x3b,'minutes')['add'](0x3b,_0x5591('0x32'))['format']();}_0x4cf66c={'start':_0x458ded,'end':_0x2f048b};break;default:_0x4cf66c[_0x5591('0x2e')]=_0x458ded;break;}return _0x4cf66c;} \ No newline at end of file +var _0x7cb2=['[$or]','and','replace','[$and]','split','length','slice','match','forEach','indexOf','push','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start','$startsWith','$between','shift','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith'];(function(_0x5904a3,_0xf433ea){var _0x4c16c2=function(_0x28deb5){while(--_0x28deb5){_0x5904a3['push'](_0x5904a3['shift']());}};_0x4c16c2(++_0xf433ea);}(_0x7cb2,0x157));var _0x27cb=function(_0x2950ac,_0x5caee7){_0x2950ac=_0x2950ac-0x0;var _0x4f421a=_0x7cb2[_0x2950ac];return _0x4f421a;};'use strict';var _=require(_0x27cb('0x0'));var moment=require(_0x27cb('0x1'));exports[_0x27cb('0x2')]=function(_0x55a45a){var _0x4d5e9c={'conditions':[]};_0x4d5e9c[_0x27cb('0x3')]=_[_0x27cb('0x4')](_0x55a45a,_0x27cb('0x5'))?'or':_0x27cb('0x6');var _0x451aee=_0x55a45a[_0x27cb('0x7')](_0x27cb('0x8'),'')[_0x27cb('0x7')](_0x27cb('0x5'),'')[_0x27cb('0x9')]('||');for(var _0x32cc24=0x0;_0x32cc24<_0x451aee[_0x27cb('0xa')];_0x32cc24++){var _0x13b3ef=_0x451aee[_0x32cc24]['split'](':=');var _0x314e4d=_0x13b3ef[0x0];var _0x47a875=_0x13b3ef[_0x27cb('0xb')](0x1);_0x47a875['forEach'](function(_0xd494e6){var _0x4fdb11=_0xd494e6[_0x27cb('0x9')]('[')['shift']();var _0x5b3e01=_0xd494e6[_0x27cb('0xc')](/\[(.*?)\]/g);_0x5b3e01[_0x27cb('0xd')](function(_0x53696f){var _0x3b7198=_0x53696f[_0x27cb('0x9')]('[')['filter'](function(_0x5b9e33){return _0x5b9e33[_0x27cb('0xe')](']')>-0x1;})['map'](function(_0x10fd77){return _0x10fd77[_0x27cb('0x9')](']')[0x0];})[0x0];_0x4d5e9c['conditions'][_0x27cb('0xf')]({'field':_0x314e4d,'operator':_0x4fdb11,'value':_0x3b7198});});});}return _0x4d5e9c;};exports['buildExpression']=function(_0x4b00a5,_0x2bd10e,_0x583528){var _0x1f4130={};if(_0x2bd10e===_0x27cb('0x10')){if(_0x583528[_0x27cb('0x11')]===_0x27cb('0x12')){_0x583528['operator']='$between';_0x583528[_0x27cb('0x13')]+=','+_0x583528[_0x27cb('0x13')];}else if(_[_0x27cb('0x14')]([_0x27cb('0x15'),_0x27cb('0x16')],_0x583528['operator'])){_0x583528['value']=moment(_0x583528['value'])[_0x27cb('0x17')](0x1,_0x27cb('0x18'))[_0x27cb('0x19')](_0x27cb('0x1a'));}}if(_0x583528[_0x27cb('0x1b')]){_0x2bd10e=_0x583528['castTo'];_0x1f4130[_0x27cb('0x1c')]='CAST('+_0x4b00a5+'.'+_0x583528[_0x27cb('0x1d')]+_0x27cb('0x1e')+_0x583528['castTo']+')\x20'+parseOperator(_0x583528[_0x27cb('0x11')]);}else{_0x1f4130['text']=_0x4b00a5+'.'+_0x583528['field']+'\x20'+parseOperator(_0x583528[_0x27cb('0x11')]);}if(_['includes']([_0x27cb('0x1f'),_0x27cb('0x20')],_0x583528['operator']))_0x1f4130[_0x27cb('0x1c')]='('+_0x1f4130[_0x27cb('0x1c')]+_0x27cb('0x21')+_0x4b00a5+'.'+_0x583528[_0x27cb('0x1d')]+_0x27cb('0x22');_0x1f4130[_0x27cb('0x13')]=parseValue(_0x2bd10e,_0x583528['operator'],_0x583528[_0x27cb('0x13')]);return _0x1f4130;};function parseOperator(_0x139e9e){var _0x9074e7;switch(_0x139e9e){case _0x27cb('0x23'):_0x9074e7=_0x27cb('0x24');break;case _0x27cb('0x20'):_0x9074e7=_0x27cb('0x25');break;case _0x27cb('0x12'):_0x9074e7=_0x27cb('0x26');break;case'$ne':_0x9074e7=_0x27cb('0x27');break;case'$substring':case'$startsWith':case _0x27cb('0x28'):_0x9074e7=_0x27cb('0x29');break;case _0x27cb('0x2a'):_0x9074e7=_0x27cb('0x2b');break;case _0x27cb('0x15'):_0x9074e7=_0x27cb('0x2c');break;case _0x27cb('0x16'):_0x9074e7=_0x27cb('0x2d');break;case _0x27cb('0x2e'):_0x9074e7=_0x27cb('0x2f');break;case'$between':_0x9074e7=_0x27cb('0x30');break;}return _0x9074e7;}function parseValue(_0x4e13ab,_0x32d0b4,_0x2f6a5c){var _0x210066={'start':undefined,'end':undefined};switch(_0x32d0b4){case _0x27cb('0x23'):case'$notIn':_0x210066['start']=_0x2f6a5c[_0x27cb('0x9')](',');break;case _0x27cb('0x31'):_0x210066[_0x27cb('0x32')]='%'+_0x2f6a5c+'%';break;case _0x27cb('0x33'):_0x210066[_0x27cb('0x32')]=_0x2f6a5c+'%';break;case'$endsWith':_0x210066['start']='%'+_0x2f6a5c;break;case _0x27cb('0x34'):var _0x5be295=_0x2f6a5c['split'](',');var _0x2f6a5c=_0x5be295[_0x27cb('0x35')]();var _0x3e8d41=_0x5be295['pop']();if(_0x4e13ab===_0x27cb('0x10')){_0x2f6a5c=moment(_0x2f6a5c)[_0x27cb('0x36')](0x0,!![])[_0x27cb('0x19')]();_0x3e8d41=moment(_0x3e8d41)[_0x27cb('0x36')](0x0,!![])[_0x27cb('0x17')](0x17,_0x27cb('0x37'))['add'](0x3b,_0x27cb('0x38'))[_0x27cb('0x17')](0x3b,_0x27cb('0x39'))['format']();}_0x210066={'start':_0x2f6a5c,'end':_0x3e8d41};break;default:_0x210066[_0x27cb('0x32')]=_0x2f6a5c;break;}return _0x210066;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d0281d3..ee11bfa 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 _0x4209=['col','priority','DESC','unsigned','omit','length','isObject','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','name','intersection','attributes','order','pick','filter','object','value','where','merge','lower','options','include','lodash','sequelize','../../mysqldb','parse','keys','includes','model','alias','raw','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','cast'];(function(_0x381874,_0x2834ea){var _0x5de217=function(_0xc86e9b){while(--_0xc86e9b){_0x381874['push'](_0x381874['shift']());}};_0x5de217(++_0x2834ea);}(_0x4209,0x11c));var _0x9420=function(_0x4738b7,_0x9096f0){_0x4738b7=_0x4738b7-0x0;var _0x47cb9e=_0x4209[_0x4738b7];return _0x47cb9e;};'use strict';var _=require(_0x9420('0x0'));var sequelize=require(_0x9420('0x1'));var moment=require('moment');var db=require(_0x9420('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x8bbdbf){var _0x50dc12=['ne'];try{var _0x13fb2a=JSON[_0x9420('0x3')](_0x8bbdbf);var _0x1f9d87=Object[_0x9420('0x4')](_0x13fb2a)[0x0];return _0x50dc12[_0x9420('0x5')](_0x1f9d87);}catch(_0x2dcf24){return![];}}function getOperatorValue(_0x47915e){var _0x2d5bd3=JSON[_0x9420('0x3')](_0x47915e);var _0x37b985=Object[_0x9420('0x4')](_0x2d5bd3)[0x0];var _0x540ab8=_0x2d5bd3[_0x37b985];return{['$'+_0x37b985]:_0x540ab8};}function parseIncludeModel(_0x688091){var _0x3b8e0a=JSON['parse'](_0x688091);return{'model':db[_0x3b8e0a[_0x9420('0x6')]],'as':_0x3b8e0a[_0x9420('0x7')],'attributes':_0x3b8e0a['fields'],'raw':_0x3b8e0a[_0x9420('0x8')]};}exports[_0x9420('0x9')]=function(_0x53ca9c){var _0x2eb705=null;if(_0x53ca9c){_0x2eb705=_0x53ca9c[_0x9420('0xa')](',');}return _0x2eb705;};exports[_0x9420('0xb')]=function(_0x5c38d2,_0x499fee){var _0x2f2de9={};if(!_[_0x9420('0xc')](_0x5c38d2)){_['forOwn'](_0x5c38d2,function(_0x2a2472,_0x4335f6){try{if(_0x499fee){var _0xc2a74d=_[_0x9420('0xd')](_0x499fee,{'name':_0x4335f6})||{};if(hasSequelizeOperator(_0x2a2472)){_0x2f2de9[_0x4335f6]=getOperatorValue(_0x2a2472);}else if(_0xc2a74d[_0x9420('0xe')]===_0x9420('0xf')&&_[_0x9420('0x10')](_0x2a2472)){var _0x47f10d=JSON[_0x9420('0x3')](_0x2a2472);var _0x30c09b={'$gte':moment(moment(_0x47f10d[_0x9420('0x11')])[_0x9420('0x12')](_0x9420('0x13')))[_0x9420('0x14')]()[_0x9420('0x12')](),'$lte':moment(moment(_0x47f10d[_0x9420('0x15')])[_0x9420('0x12')](_0x9420('0x13')))[_0x9420('0x14')]()[_0x9420('0x16')](0x1,'s')[_0x9420('0x12')]()};_0x2f2de9[_0x4335f6]=_0x30c09b;}else if(_0xc2a74d['name']===_0x9420('0x17')){_0x2f2de9[_0x4335f6]=_0x2a2472;}else{_0x2f2de9[_0x4335f6]=_['isArray'](_0x2a2472)?_0x2a2472:JSON[_0x9420('0x3')](_0x2a2472);}}else{_0x2f2de9[_0x4335f6]=_[_0x9420('0x18')](_0x2a2472)?_0x2a2472:JSON[_0x9420('0x3')](_0x2a2472);}}catch(_0x1912dc){_0x2f2de9[_0x4335f6]=_0x2a2472['split'](',');}});}return _0x2f2de9;};exports[_0x9420('0x19')]=function(_0x12f654){_0x12f654=parseInt(_0x12f654,0xa);if(!_0x12f654||_0x12f654<0x0){_0x12f654=LIMIT_VALUE;}return _0x12f654;};exports[_0x9420('0x1a')]=function(_0x593375){_0x593375=parseInt(_0x593375,0xa);if(!_0x593375||_0x593375<0x0){_0x593375=0x0;}return _0x593375;};exports[_0x9420('0x1b')]=function(_0x36d1fd){var _0x3a85da,_0x5704e2=null;if(_0x36d1fd){_0x3a85da=_0x36d1fd[_0x9420('0xa')](',');_0x5704e2=_[_0x9420('0x1c')](_0x3a85da,function(_0x183e4c){if(_0x183e4c[_0x9420('0x1d')]('-')===0x0){return[_0x183e4c==='priority'?sequelize[_0x9420('0x1e')](sequelize[_0x9420('0x1f')](_0x9420('0x20')),'unsigned'):_0x183e4c['substr'](0x1),_0x9420('0x21')];}else{return[_0x183e4c==='priority'?sequelize[_0x9420('0x1e')](sequelize[_0x9420('0x1f')]('priority'),_0x9420('0x22')):_0x183e4c,'ASC'];}});}return _0x5704e2;};exports[_0x9420('0x23')]=function(_0x5a2311,_0x4d9941){if(_[_0x9420('0xc')](_0x5a2311)){return _0x5a2311;}if(_[_0x9420('0x18')](_0x5a2311)){for(var _0x208dfc=0x0;_0x208dfc<_0x5a2311[_0x9420('0x24')];_0x208dfc+=0x1){_0x5a2311[_0x208dfc]=this[_0x9420('0x23')](_0x5a2311[_0x208dfc],_0x4d9941);}return _0x5a2311;}if(!_[_0x9420('0x25')](_0x5a2311)){return _0x5a2311;}if(_['isString'](_0x4d9941)){_0x4d9941=[_0x4d9941];}if(!_[_0x9420('0x18')](_0x4d9941)){return _0x5a2311;}for(var _0x271dc2=0x0;_0x271dc2<_0x4d9941[_0x9420('0x24')];_0x271dc2+=0x1){_['unset'](_0x5a2311,_0x4d9941[_0x271dc2]);}for(var _0x545eb6 in _0x5a2311){if(_0x5a2311[_0x9420('0x26')](_0x545eb6)){_0x5a2311[_0x545eb6]=this[_0x9420('0x23')](_0x5a2311[_0x545eb6],_0x4d9941);}}return _0x5a2311;};exports[_0x9420('0x27')]=function(_0x4fed9e){return _0x4fed9e[_0x9420('0x28')](RegExp(_0x9420('0x29')))?!![]:![];};exports[_0x9420('0x2a')]=function(_0x2f9d7b){return _0x2f9d7b[_0x9420('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x9420('0x2b')]=function(_0x37f506,_0x454363){var _0x22f7d4=[];var _0x46ed2b=/[ `!@#$%^&*()_\-?~]/;var _0x2f8048=_0x454363?'\x22{EXPR}\x22':'{EXPR}';_0x37f506[_0x9420('0xa')](/[ ,]+/)[_0x9420('0x2c')](function(_0x53f15d){_0x53f15d=_0x53f15d['replace'](/([^:]")"+/g,'$1');_0x53f15d='+'+_0x53f15d+'*';var _0x445958=_0x53f15d[_0x9420('0x28')](_0x46ed2b);if(_0x445958){_0x53f15d='\x22'+_0x53f15d+'\x22';}_0x22f7d4['push'](_0x53f15d);});_0x2f8048=_0x2f8048[_0x9420('0x2d')]('{EXPR}',_0x22f7d4[_0x9420('0x2e')]('\x20'));return _0x2f8048;};exports[_0x9420('0x2f')]=function(_0x13fcb2,_0x425687,_0x4d5c76){var _0x945915={},_0x19d5a8={};if(_0x425687[_0x9420('0x30')][_0x9420('0x31')]){_0x425687[_0x9420('0x30')]['id']=_0x425687['query'][_0x9420('0x31')];delete _0x425687[_0x9420('0x30')]['$id'];}_0x945915[_0x9420('0x6')]=_[_0x9420('0x1c')](_0x13fcb2,_0x9420('0x32'));_0x945915[_0x9420('0x30')]=_[_0x9420('0x4')](_0x425687[_0x9420('0x30')]);_0x945915[_0x9420('0xb')]=_[_0x9420('0x33')](_0x945915['model'],_0x945915[_0x9420('0x30')]);_0x19d5a8[_0x9420('0x34')]=_['intersection'](_0x945915['model'],this[_0x9420('0x9')](_0x425687[_0x9420('0x30')][_0x9420('0x9')]));_0x19d5a8['attributes']=_0x19d5a8[_0x9420('0x34')][_0x9420('0x24')]?_0x19d5a8['attributes']:_0x945915[_0x9420('0x6')];if(!_0x425687['query'][_0x9420('0x26')]('nolimit')){_0x19d5a8['limit']=this['limit'](_0x425687[_0x9420('0x30')][_0x9420('0x19')]);_0x19d5a8[_0x9420('0x1a')]=this['offset'](_0x425687[_0x9420('0x30')][_0x9420('0x1a')]);}_0x19d5a8[_0x9420('0x35')]=this[_0x9420('0x1b')](_0x425687[_0x9420('0x30')][_0x9420('0x1b')]);_0x19d5a8['where']=this[_0x9420('0xb')](_[_0x9420('0x36')](_0x425687[_0x9420('0x30')],_0x945915[_0x9420('0xb')]),_0x13fcb2);if(_0x425687['query']['filter']){var _0xc0875f=_0x13fcb2;var _0x4c9700=_0x425687[_0x9420('0x30')][_0x9420('0x37')];if(typeof _0x4c9700===_0x9420('0x38')){_0xc0875f=_['filter'](_0x13fcb2,function(_0x328304){return _[_0x9420('0x5')](_0x4c9700['columns'],_0x328304[_0x9420('0x32')]);});_0x4c9700=_0x4c9700[_0x9420('0x39')];}_0x19d5a8[_0x9420('0x3a')]=_[_0x9420('0x3b')](_0x19d5a8['where'],{'$or':_[_0x9420('0x1c')](_0xc0875f,function(_0x104078){if(_0x104078[_0x9420('0xe')]!=='VIRTUAL'){if(_0x4d5c76){return sequelize['where'](sequelize['fn'](_0x9420('0x3c'),sequelize[_0x9420('0x1f')](_0x104078[_0x9420('0x32')])),{'$like':sequelize['fn'](_0x9420('0x3c'),'%'+_0x425687['query']['filter']+'%')});}else{var _0x505f01={};_0x505f01[_0x104078[_0x9420('0x32')]]={'$like':'%'+_0x425687[_0x9420('0x30')][_0x9420('0x37')]+'%'};return _0x505f01;}}})});}_0x19d5a8=_[_0x9420('0x3b')]({},_0x19d5a8,_0x425687[_0x9420('0x3d')]);return _0x19d5a8;};exports['include']=function(_0x1a39f3){var _0xe6d439=[];if(_0x1a39f3['includeAll']){_0xe6d439['push']({'all':!![]});}else if(_0x1a39f3[_0x9420('0x3e')]){if(Array['isArray'](_0x1a39f3[_0x9420('0x3e')])){_0xe6d439=Object[_0x9420('0x4')](_0x1a39f3[_0x9420('0x3e')])[_0x9420('0x1c')](function(_0x8e4474){return parseIncludeModel(_0x1a39f3['include'][_0x8e4474]);});}else{var _0x22c5bd=parseIncludeModel(_0x1a39f3[_0x9420('0x3e')]);_0xe6d439['push'](_0x22c5bd);}}return _0xe6d439;}; \ No newline at end of file +var _0x77a5=['filters','intersection','attributes','limit','order','sort','where','pick','filter','object','value','merge','VIRTUAL','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','fields','raw','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','map','indexOf','col','priority','unsigned','substr','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','isEmail','\x22{EXPR}\x22','{EXPR}','replace','push','getOptions','query','$id'];(function(_0x4c931,_0x30e3ff){var _0x342d99=function(_0x53c13d){while(--_0x53c13d){_0x4c931['push'](_0x4c931['shift']());}};_0x342d99(++_0x30e3ff);}(_0x77a5,0x196));var _0x577a=function(_0x384dc4,_0x55b8da){_0x384dc4=_0x384dc4-0x0;var _0x52c079=_0x77a5[_0x384dc4];return _0x52c079;};'use strict';var _=require(_0x577a('0x0'));var sequelize=require(_0x577a('0x1'));var moment=require(_0x577a('0x2'));var db=require(_0x577a('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x21f087){var _0x428642=['ne'];try{var _0x31eb76=JSON[_0x577a('0x4')](_0x21f087);var _0x950e98=Object[_0x577a('0x5')](_0x31eb76)[0x0];return _0x428642[_0x577a('0x6')](_0x950e98);}catch(_0x29dec9){return![];}}function getOperatorValue(_0x57be67){var _0x62614c=JSON[_0x577a('0x4')](_0x57be67);var _0x4f066d=Object[_0x577a('0x5')](_0x62614c)[0x0];var _0x5244c9=_0x62614c[_0x4f066d];return{['$'+_0x4f066d]:_0x5244c9};}function parseIncludeModel(_0x4dafad){var _0x62a3dc=JSON['parse'](_0x4dafad);return{'model':db[_0x62a3dc[_0x577a('0x7')]],'as':_0x62a3dc['alias'],'attributes':_0x62a3dc[_0x577a('0x8')],'raw':_0x62a3dc[_0x577a('0x9')]};}exports[_0x577a('0x8')]=function(_0x5a73bc){var _0x2ac4b4=null;if(_0x5a73bc){_0x2ac4b4=_0x5a73bc[_0x577a('0xa')](',');}return _0x2ac4b4;};exports['filters']=function(_0x5899e4,_0x20e00c){var _0x231643={};if(!_[_0x577a('0xb')](_0x5899e4)){_[_0x577a('0xc')](_0x5899e4,function(_0x4fe208,_0xff8314){try{if(_0x20e00c){var _0x309927=_[_0x577a('0xd')](_0x20e00c,{'name':_0xff8314})||{};if(hasSequelizeOperator(_0x4fe208)){_0x231643[_0xff8314]=getOperatorValue(_0x4fe208);}else if(_0x309927[_0x577a('0xe')]===_0x577a('0xf')&&_[_0x577a('0x10')](_0x4fe208)){var _0x370ccc=JSON[_0x577a('0x4')](_0x4fe208);var _0x59ad12={'$gte':moment(moment(_0x370ccc[_0x577a('0x11')])[_0x577a('0x12')](_0x577a('0x13')))[_0x577a('0x14')]()[_0x577a('0x12')](),'$lte':moment(moment(_0x370ccc[_0x577a('0x15')])['format']('YYYY-MM-DD'))[_0x577a('0x14')]()[_0x577a('0x16')](0x1,'s')['format']()};_0x231643[_0xff8314]=_0x59ad12;}else if(_0x309927[_0x577a('0x17')]===_0x577a('0x18')){_0x231643[_0xff8314]=_0x4fe208;}else{_0x231643[_0xff8314]=_[_0x577a('0x19')](_0x4fe208)?_0x4fe208:JSON[_0x577a('0x4')](_0x4fe208);}}else{_0x231643[_0xff8314]=_[_0x577a('0x19')](_0x4fe208)?_0x4fe208:JSON[_0x577a('0x4')](_0x4fe208);}}catch(_0x13ef95){_0x231643[_0xff8314]=_0x4fe208[_0x577a('0xa')](',');}});}return _0x231643;};exports['limit']=function(_0x2b6af0){_0x2b6af0=parseInt(_0x2b6af0,0xa);if(!_0x2b6af0||_0x2b6af0<0x0){_0x2b6af0=LIMIT_VALUE;}return _0x2b6af0;};exports[_0x577a('0x1a')]=function(_0x5df708){_0x5df708=parseInt(_0x5df708,0xa);if(!_0x5df708||_0x5df708<0x0){_0x5df708=0x0;}return _0x5df708;};exports['sort']=function(_0x3fa344){var _0xe69a08,_0x3346e2=null;if(_0x3fa344){_0xe69a08=_0x3fa344[_0x577a('0xa')](',');_0x3346e2=_[_0x577a('0x1b')](_0xe69a08,function(_0x2469ec){if(_0x2469ec[_0x577a('0x1c')]('-')===0x0){return[_0x2469ec==='priority'?sequelize['cast'](sequelize[_0x577a('0x1d')](_0x577a('0x1e')),_0x577a('0x1f')):_0x2469ec[_0x577a('0x20')](0x1),'DESC'];}else{return[_0x2469ec===_0x577a('0x1e')?sequelize['cast'](sequelize[_0x577a('0x1d')](_0x577a('0x1e')),_0x577a('0x1f')):_0x2469ec,_0x577a('0x21')];}});}return _0x3346e2;};exports[_0x577a('0x22')]=function(_0x3553e0,_0x5f4058){if(_['isEmpty'](_0x3553e0)){return _0x3553e0;}if(_[_0x577a('0x19')](_0x3553e0)){for(var _0x48ab3a=0x0;_0x48ab3a<_0x3553e0[_0x577a('0x23')];_0x48ab3a+=0x1){_0x3553e0[_0x48ab3a]=this[_0x577a('0x22')](_0x3553e0[_0x48ab3a],_0x5f4058);}return _0x3553e0;}if(!_[_0x577a('0x24')](_0x3553e0)){return _0x3553e0;}if(_[_0x577a('0x25')](_0x5f4058)){_0x5f4058=[_0x5f4058];}if(!_[_0x577a('0x19')](_0x5f4058)){return _0x3553e0;}for(var _0x147ed2=0x0;_0x147ed2<_0x5f4058['length'];_0x147ed2+=0x1){_['unset'](_0x3553e0,_0x5f4058[_0x147ed2]);}for(var _0x1e555e in _0x3553e0){if(_0x3553e0[_0x577a('0x26')](_0x1e555e)){_0x3553e0[_0x1e555e]=this[_0x577a('0x22')](_0x3553e0[_0x1e555e],_0x5f4058);}}return _0x3553e0;};exports[_0x577a('0x27')]=function(_0x16e576){return _0x16e576[_0x577a('0x28')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x577a('0x29')]=function(_0x1070e3){return _0x1070e3[_0x577a('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x205e53,_0x1d02c9){var _0x49ea7c=[];var _0x5a6402=/[ `!@#$%^&*()_\-?~]/;var _0xa1a2b1=_0x1d02c9?_0x577a('0x2a'):_0x577a('0x2b');_0x205e53['split'](/[ ,]+/)['forEach'](function(_0x2bb784){_0x2bb784=_0x2bb784[_0x577a('0x2c')](/([^:]")"+/g,'$1');_0x2bb784='+'+_0x2bb784+'*';var _0x1dec5c=_0x2bb784[_0x577a('0x28')](_0x5a6402);if(_0x1dec5c){_0x2bb784='\x22'+_0x2bb784+'\x22';}_0x49ea7c[_0x577a('0x2d')](_0x2bb784);});_0xa1a2b1=_0xa1a2b1[_0x577a('0x2c')](_0x577a('0x2b'),_0x49ea7c['join']('\x20'));return _0xa1a2b1;};exports[_0x577a('0x2e')]=function(_0x1ce791,_0x233a93,_0x2d99df){var _0x45bc0a={},_0x3a78b9={};if(_0x233a93[_0x577a('0x2f')]['$id']){_0x233a93[_0x577a('0x2f')]['id']=_0x233a93[_0x577a('0x2f')][_0x577a('0x30')];delete _0x233a93[_0x577a('0x2f')][_0x577a('0x30')];}_0x45bc0a[_0x577a('0x7')]=_[_0x577a('0x1b')](_0x1ce791,_0x577a('0x17'));_0x45bc0a['query']=_['keys'](_0x233a93[_0x577a('0x2f')]);_0x45bc0a[_0x577a('0x31')]=_[_0x577a('0x32')](_0x45bc0a[_0x577a('0x7')],_0x45bc0a[_0x577a('0x2f')]);_0x3a78b9[_0x577a('0x33')]=_[_0x577a('0x32')](_0x45bc0a[_0x577a('0x7')],this[_0x577a('0x8')](_0x233a93['query'][_0x577a('0x8')]));_0x3a78b9[_0x577a('0x33')]=_0x3a78b9[_0x577a('0x33')]['length']?_0x3a78b9[_0x577a('0x33')]:_0x45bc0a[_0x577a('0x7')];if(!_0x233a93['query'][_0x577a('0x26')]('nolimit')){_0x3a78b9[_0x577a('0x34')]=this['limit'](_0x233a93[_0x577a('0x2f')][_0x577a('0x34')]);_0x3a78b9[_0x577a('0x1a')]=this[_0x577a('0x1a')](_0x233a93['query'][_0x577a('0x1a')]);}_0x3a78b9[_0x577a('0x35')]=this[_0x577a('0x36')](_0x233a93[_0x577a('0x2f')][_0x577a('0x36')]);_0x3a78b9[_0x577a('0x37')]=this[_0x577a('0x31')](_[_0x577a('0x38')](_0x233a93[_0x577a('0x2f')],_0x45bc0a['filters']),_0x1ce791);if(_0x233a93['query'][_0x577a('0x39')]){var _0xb3de78=_0x1ce791;var _0x41a52e=_0x233a93[_0x577a('0x2f')][_0x577a('0x39')];if(typeof _0x41a52e===_0x577a('0x3a')){_0xb3de78=_[_0x577a('0x39')](_0x1ce791,function(_0x358ee2){return _[_0x577a('0x6')](_0x41a52e['columns'],_0x358ee2[_0x577a('0x17')]);});_0x41a52e=_0x41a52e[_0x577a('0x3b')];}_0x3a78b9[_0x577a('0x37')]=_[_0x577a('0x3c')](_0x3a78b9[_0x577a('0x37')],{'$or':_['map'](_0xb3de78,function(_0x165b2e){if(_0x165b2e[_0x577a('0xe')]!==_0x577a('0x3d')){if(_0x2d99df){return sequelize[_0x577a('0x37')](sequelize['fn']('lower',sequelize[_0x577a('0x1d')](_0x165b2e['name'])),{'$like':sequelize['fn']('lower','%'+_0x233a93[_0x577a('0x2f')][_0x577a('0x39')]+'%')});}else{var _0x90225c={};_0x90225c[_0x165b2e[_0x577a('0x17')]]={'$like':'%'+_0x233a93[_0x577a('0x2f')][_0x577a('0x39')]+'%'};return _0x90225c;}}})});}_0x3a78b9=_[_0x577a('0x3c')]({},_0x3a78b9,_0x233a93[_0x577a('0x3e')]);return _0x3a78b9;};exports[_0x577a('0x3f')]=function(_0x4b2a20){var _0x677556=[];if(_0x4b2a20[_0x577a('0x40')]){_0x677556[_0x577a('0x2d')]({'all':!![]});}else if(_0x4b2a20['include']){if(Array[_0x577a('0x19')](_0x4b2a20[_0x577a('0x3f')])){_0x677556=Object[_0x577a('0x5')](_0x4b2a20['include'])[_0x577a('0x1b')](function(_0x4a8dc2){return parseIncludeModel(_0x4b2a20[_0x577a('0x3f')][_0x4a8dc2]);});}else{var _0x4fb8a7=parseIncludeModel(_0x4b2a20[_0x577a('0x3f')]);_0x677556['push'](_0x4fb8a7);}}return _0x677556;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d910528..11258ae 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 _0x1e4c=['queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','faxPause','online','omit','filterAgentAttributes','lodash','jayson/promise','client','http','chatPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','voicePause','pause','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','busy','getAgentIdsByStatus','resolve','User','findAll','name','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1e4c,0x128));var _0xc1e4=function(_0x1967ac,_0x1d0eb1){_0x1967ac=_0x1967ac-0x0;var _0x40e1db=_0x1e4c[_0x1967ac];return _0x40e1db;};'use strict';var _=require(_0xc1e4('0x0'));var jayson=require(_0xc1e4('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xc1e4('0x2')][_0xc1e4('0x3')]({'port':0x232a});var routingClient=jayson[_0xc1e4('0x2')][_0xc1e4('0x3')]({'port':0x232c});function isAgentPaused(_0xb7697f,_0x24b122){var _0x520f33=[_0xb7697f[_0xc1e4('0x4')],_0xb7697f['faxPause'],_0xb7697f[_0xc1e4('0x5')],_0xb7697f[_0xc1e4('0x6')],_0xb7697f[_0xc1e4('0x7')],_0xb7697f['voicePause'],_0xb7697f[_0xc1e4('0x8')]];if(!_0x24b122)return _[_0xc1e4('0x9')](_0x520f33);var _0x21239c=_[_0xc1e4('0xa')](_0x520f33);return _0x21239c[_0xc1e4('0xb')]>0x0&&_0x21239c[_0xc1e4('0xb')]<_0x520f33[_0xc1e4('0xb')]?!![]:![];}function isIdle(_0x1e9bc5){return _0x1e9bc5===_0xc1e4('0xc')||_0x1e9bc5===_0xc1e4('0xd')||_0x1e9bc5===_0xc1e4('0xe')||_0x1e9bc5==='ringing'||_[_0xc1e4('0xf')](_0x1e9bc5);}function isAgentIdle(_0x22fc1f){if(_0x22fc1f[_0xc1e4('0x10')]!==_0xc1e4('0xc')&&_0x22fc1f[_0xc1e4('0x11')]){_0x22fc1f[_0xc1e4('0x10')]=_0xc1e4('0x12');return![];}return _[_0xc1e4('0x9')]([_0x22fc1f[_0xc1e4('0x13')],_0x22fc1f['faxStatus'],_0x22fc1f[_0xc1e4('0x14')],_0x22fc1f[_0xc1e4('0x15')],_0x22fc1f['smsStatus'],_0x22fc1f[_0xc1e4('0x10')],_0x22fc1f[_0xc1e4('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xc1e4('0x17')](_0xc1e4('0x18'),{})[_0xc1e4('0x19')](function(_0x5a15a2){if(_0x5a15a2[_0xc1e4('0x1a')]){throw new Error(_0xc1e4('0x1b'));}var _0x4f12d1=_0x5a15a2[_0xc1e4('0x1c')];return routingClient[_0xc1e4('0x17')](_0xc1e4('0x18'),{})[_0xc1e4('0x19')](function(_0x5d6ec2){if(_0x5d6ec2[_0xc1e4('0x1a')]){throw new Error(_0xc1e4('0x1d'));}var _0x553b37=_0x5d6ec2[_0xc1e4('0x1c')];return _[_0xc1e4('0x1e')]({},_0x4f12d1,_0x553b37);});})[_0xc1e4('0x1f')](function(_0x50eb43){throw _0x50eb43;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x5466d6){var _0x27d888=_0xc1e4('0xd');if(isAgentPaused(_0x5466d6))_0x27d888='pause';else if(isAgentPaused(_0x5466d6,!![]))_0x27d888=_0xc1e4('0x20');else if(isAgentIdle(_0x5466d6))_0x27d888=_0xc1e4('0xc');else _0x27d888='busy';return _0x27d888;}exports[_0xc1e4('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4b7ab0,_0xf73f66){var _0x1e5f6a=_[_0xc1e4('0x22')](_0x4b7ab0)?_0x4b7ab0:[_0x4b7ab0];var _0x5d5b54=_[_0xc1e4('0x23')](_0xf73f66)+_0xc1e4('0x24');var _0x27b8f2=_[_0xc1e4('0x25')](_0x1e5f6a,function(_0x5783c9){return db[_0x5d5b54][_0xc1e4('0x26')]({'where':{'id':_0x5783c9}})[_0xc1e4('0x19')](function(_0x56744f){if(!_0x56744f)return[];return _0x56744f[_0xc1e4('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc1e4('0x28')](_0x27b8f2)[_0xc1e4('0x19')](function(_0x9c1aee){var _0x5a6625=_(_0x9c1aee)[_0xc1e4('0x29')]()[_0xc1e4('0x25')]('id')[_0xc1e4('0x2a')]()[_0xc1e4('0x2b')]();return _0x5a6625;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c84f0,_0x264eac,_0x2d282a){try{if(_0x264eac['length']>0x0){_0x1c84f0=_0x1c84f0['filter'](function(_0xa9bcb8){return _0x264eac[_0xc1e4('0x2c')](_0xa9bcb8['id']);});}var _0x26f9f4=_0x1c84f0[_0xc1e4('0xa')](function(_0x565737){var _0xd289b=_0xc1e4('0x2d');if(isAgentIdle(_0x565737)){_0xd289b=_0xc1e4('0xc');}return _0xd289b===_0x2d282a;});return _[_0xc1e4('0x25')](_0x26f9f4,'id');}catch(_0x5b0d57){throw _0x5b0d57;}}exports[_0xc1e4('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x37d6cb,_0x41eed2,_0x57cc48){return Promise[_0xc1e4('0x2f')]()['then'](function(){if(_0x41eed2[_0xc1e4('0xb')]>0x0){_0x37d6cb=_0x37d6cb[_0xc1e4('0xa')](function(_0xf47b5){return _0x41eed2[_0xc1e4('0x2c')](_0xf47b5['id']);});}return _0x37d6cb;})[_0xc1e4('0x19')](function(){return db[_0xc1e4('0x30')][_0xc1e4('0x31')]({'attributes':['id',_0xc1e4('0x32'),'fullname',_0xc1e4('0x4'),'faxPause','mailPause',_0xc1e4('0x6'),_0xc1e4('0x7'),_0xc1e4('0x11'),'whatsappPause',_0xc1e4('0x33')],'where':{'id':{'$in':_['map'](_0x37d6cb,'id')}},'raw':!![]});})[_0xc1e4('0x19')](function(_0x2b4319){return _0x2b4319[_0xc1e4('0x25')](function(_0x24b413){var _0x2ef0f5=_[_0xc1e4('0x34')](_0x37d6cb,['id',_0x24b413['id']]);var _0x3cb72d=filterAgentAttributes(_0x2ef0f5);_['merge'](_0x24b413,_0x3cb72d);_0x24b413[_0xc1e4('0x35')]=getAgentStatus(_0x24b413);return _0x24b413;});})[_0xc1e4('0x19')](function(_0x9e128c){var _0x38e7a6=sortAgentsByStatus(_0x9e128c,_0x57cc48);return _['map'](_0x38e7a6,'id');})[_0xc1e4('0x1f')](function(_0x392a62){throw _0x392a62;});}exports[_0xc1e4('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x59ec63){var _0x47ed54={'fields':[],'order':null};var _0x41f212=_0x59ec63['split'](',');_0x47ed54[_0xc1e4('0x37')]=_[_0xc1e4('0xa')](_0x41f212,function(_0x43771f){if(!_0x43771f[_0xc1e4('0x2c')](_0xc1e4('0x35'))){return!![];}_0x47ed54['order']=_[_0xc1e4('0x38')](_0x43771f,'-')?_0xc1e4('0x39'):_0xc1e4('0x3a');return![];});return _0x47ed54;}exports[_0xc1e4('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x38ffb5){if(!_0x38ffb5){_0x38ffb5='fullname,internal';}if(_0x38ffb5[_0xc1e4('0x2c')](_0xc1e4('0x3c'))&&!_0x38ffb5[_0xc1e4('0x2c')](_0xc1e4('0x3d'))){var _0xce0f7a=_0x38ffb5[_0xc1e4('0x3e')](0x0,_0x38ffb5[_0xc1e4('0x3f')](_0xc1e4('0x3c')));_0x38ffb5+=','+_0xce0f7a+'internal';}return _0x38ffb5;}exports[_0xc1e4('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x136c25,_0x8d67bc){var _0x5563d1=_0x136c25[_0xc1e4('0x41')](function(_0x368d4d,_0x4f5cdc){if(_0x368d4d[_0xc1e4('0x35')]===_0x4f5cdc[_0xc1e4('0x35')]){if(_0x368d4d['globalStatus']==='pause'){if(_0x8d67bc===_0xc1e4('0x39')){return(_0x368d4d[_0xc1e4('0x33')]||'')<(_0x4f5cdc[_0xc1e4('0x33')]||'')||_0x368d4d[_0xc1e4('0x3c')][_0xc1e4('0x42')]()>_0x4f5cdc[_0xc1e4('0x3c')][_0xc1e4('0x42')]()?0x1:-0x1;}else{return(_0x368d4d['pauseType']||'')<(_0x4f5cdc[_0xc1e4('0x33')]||'')||_0x368d4d[_0xc1e4('0x3c')][_0xc1e4('0x42')]()>_0x4f5cdc['fullname'][_0xc1e4('0x42')]()?-0x1:0x1;}}else{if(_0x8d67bc==='DESC'){return _0x368d4d[_0xc1e4('0x3c')]['toLowerCase']()<_0x4f5cdc[_0xc1e4('0x3c')][_0xc1e4('0x42')]()?0x1:-0x1;}else{return _0x368d4d['fullname'][_0xc1e4('0x42')]()<_0x4f5cdc[_0xc1e4('0x3c')][_0xc1e4('0x42')]()?-0x1:0x1;}}}else{if(_0x8d67bc===_0xc1e4('0x39')){return _0x368d4d[_0xc1e4('0x35')]<_0x4f5cdc[_0xc1e4('0x35')]?0x1:-0x1;}else{return _0x368d4d[_0xc1e4('0x35')]<_0x4f5cdc['globalStatus']?-0x1:0x1;}}});return _0x5563d1;}exports[_0xc1e4('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x1a164a){var _0x2c7f1e=[_0xc1e4('0x44'),'online','lastLoginAt',_0xc1e4('0x45'),_0xc1e4('0x33'),_0xc1e4('0x45'),_0xc1e4('0x3d'),_0xc1e4('0x46'),_0xc1e4('0x4'),_0xc1e4('0x6'),_0xc1e4('0x5'),'smsPause',_0xc1e4('0x8'),'faxPause',_0xc1e4('0x11'),_0xc1e4('0x47'),_0xc1e4('0x48'),_0xc1e4('0x49'),_0xc1e4('0x4a'),_0xc1e4('0x4b'),_0xc1e4('0x4c'),_0xc1e4('0x4d'),_0xc1e4('0x4e'),_0xc1e4('0x4f'),_0xc1e4('0x50'),'whatsappCurrentCapacity',_0xc1e4('0x51'),_0xc1e4('0x13'),_0xc1e4('0x15'),_0xc1e4('0x14'),'smsStatus',_0xc1e4('0x16'),'faxStatus','voiceStatus',_0xc1e4('0x52'),_0xc1e4('0x53'),'mailStatusTime',_0xc1e4('0x54'),_0xc1e4('0x55'),_0xc1e4('0x56'),_0xc1e4('0x57'),_0xc1e4('0x58'),_0xc1e4('0x59'),_0xc1e4('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0xc1e4('0x5b'),'routealias'];var _0x3d789e=[_0xc1e4('0x4'),_0xc1e4('0x6'),'mailPause',_0xc1e4('0x7'),_0xc1e4('0x8'),_0xc1e4('0x5c'),_0xc1e4('0x11'),_0xc1e4('0x5d')];var _0x4e7ad1=_(_0x1a164a)[_0xc1e4('0x5e')](_0x3d789e)['pick'](_0x2c7f1e)[_0xc1e4('0x2b')]();return _0x4e7ad1;}exports[_0xc1e4('0x5f')]=filterAgentAttributes; \ No newline at end of file +var _0xdb47=['catch','getRealtimeAgents','unknown','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','pauseType','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','fullname','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','smsStatus','whatsappStatus','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result'];(function(_0x52bb0b,_0x445aff){var _0x108e00=function(_0x348991){while(--_0x348991){_0x52bb0b['push'](_0x52bb0b['shift']());}};_0x108e00(++_0x445aff);}(_0xdb47,0x1d0));var _0x7db4=function(_0x55a1dd,_0x922e97){_0x55a1dd=_0x55a1dd-0x0;var _0x58beeb=_0xdb47[_0x55a1dd];return _0x58beeb;};'use strict';var _=require(_0x7db4('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x7db4('0x1')][_0x7db4('0x2')]({'port':0x232a});var routingClient=jayson[_0x7db4('0x1')][_0x7db4('0x2')]({'port':0x232c});function isAgentPaused(_0x38228c,_0x3cdd30){var _0x4baa0a=[_0x38228c[_0x7db4('0x3')],_0x38228c[_0x7db4('0x4')],_0x38228c[_0x7db4('0x5')],_0x38228c[_0x7db4('0x6')],_0x38228c['smsPause'],_0x38228c[_0x7db4('0x7')],_0x38228c[_0x7db4('0x8')]];if(!_0x3cdd30)return _[_0x7db4('0x9')](_0x4baa0a);var _0x4ba59f=_[_0x7db4('0xa')](_0x4baa0a);return _0x4ba59f[_0x7db4('0xb')]>0x0&&_0x4ba59f['length']<_0x4baa0a[_0x7db4('0xb')]?!![]:![];}function isIdle(_0x195e67){return _0x195e67===_0x7db4('0xc')||_0x195e67==='unknown'||_0x195e67===_0x7db4('0xd')||_0x195e67===_0x7db4('0xe')||_[_0x7db4('0xf')](_0x195e67);}function isAgentIdle(_0x5083b3){if(_0x5083b3['voiceStatus']!==_0x7db4('0xc')&&_0x5083b3[_0x7db4('0x7')]){_0x5083b3[_0x7db4('0x10')]=_0x7db4('0x11');return![];}return _[_0x7db4('0x9')]([_0x5083b3[_0x7db4('0x12')],_0x5083b3[_0x7db4('0x13')],_0x5083b3['mailStatus'],_0x5083b3['openchannelStatus'],_0x5083b3['smsStatus'],_0x5083b3[_0x7db4('0x10')],_0x5083b3['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x7db4('0x14')](_0x7db4('0x15'),{})[_0x7db4('0x16')](function(_0x36fa34){if(_0x36fa34[_0x7db4('0x17')]){throw new Error(_0x7db4('0x18'));}var _0x27161d=_0x36fa34[_0x7db4('0x19')];return routingClient[_0x7db4('0x14')](_0x7db4('0x15'),{})['then'](function(_0xbc23df){if(_0xbc23df[_0x7db4('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x176cb0=_0xbc23df[_0x7db4('0x19')];return _['merge']({},_0x27161d,_0x176cb0);});})[_0x7db4('0x1a')](function(_0x581054){throw _0x581054;});}exports[_0x7db4('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x5ebf34){var _0x520a5e=_0x7db4('0x1c');if(isAgentPaused(_0x5ebf34))_0x520a5e=_0x7db4('0x11');else if(isAgentPaused(_0x5ebf34,!![]))_0x520a5e=_0x7db4('0x1d');else if(isAgentIdle(_0x5ebf34))_0x520a5e=_0x7db4('0xc');else _0x520a5e=_0x7db4('0x1e');return _0x520a5e;}exports[_0x7db4('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x39a33a,_0x5e9fa7){var _0x17853d=_['isArray'](_0x39a33a)?_0x39a33a:[_0x39a33a];var _0x61ed47=_[_0x7db4('0x20')](_0x5e9fa7)+_0x7db4('0x21');var _0x38aa2c=_[_0x7db4('0x22')](_0x17853d,function(_0x1adf3f){return db[_0x61ed47][_0x7db4('0x23')]({'where':{'id':_0x1adf3f}})[_0x7db4('0x16')](function(_0x4907bd){if(!_0x4907bd)return[];return _0x4907bd[_0x7db4('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7db4('0x25')](_0x38aa2c)[_0x7db4('0x16')](function(_0x2be604){var _0x2d7799=_(_0x2be604)[_0x7db4('0x26')]()['map']('id')[_0x7db4('0x27')]()[_0x7db4('0x28')]();return _0x2d7799;});}exports[_0x7db4('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3d74a9,_0x5ef7c1,_0x304fdb){try{if(_0x5ef7c1[_0x7db4('0xb')]>0x0){_0x3d74a9=_0x3d74a9[_0x7db4('0xa')](function(_0x418ffe){return _0x5ef7c1[_0x7db4('0x2a')](_0x418ffe['id']);});}var _0x14cf91=_0x3d74a9['filter'](function(_0x251ace){var _0x5ebf9a=_0x7db4('0x1e');if(isAgentIdle(_0x251ace)){_0x5ebf9a=_0x7db4('0xc');}return _0x5ebf9a===_0x304fdb;});return _[_0x7db4('0x22')](_0x14cf91,'id');}catch(_0x1c4da3){throw _0x1c4da3;}}exports[_0x7db4('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3fd410,_0x2ff71d,_0x517771){return Promise[_0x7db4('0x2c')]()[_0x7db4('0x16')](function(){if(_0x2ff71d['length']>0x0){_0x3fd410=_0x3fd410[_0x7db4('0xa')](function(_0x4caa28){return _0x2ff71d[_0x7db4('0x2a')](_0x4caa28['id']);});}return _0x3fd410;})['then'](function(){return db['User'][_0x7db4('0x2d')]({'attributes':['id','name','fullname',_0x7db4('0x3'),'faxPause',_0x7db4('0x5'),'openchannelPause','smsPause',_0x7db4('0x7'),'whatsappPause',_0x7db4('0x2e')],'where':{'id':{'$in':_['map'](_0x3fd410,'id')}},'raw':!![]});})[_0x7db4('0x16')](function(_0x2fa0d8){return _0x2fa0d8['map'](function(_0x191b44){var _0x535e12=_[_0x7db4('0x2f')](_0x3fd410,['id',_0x191b44['id']]);var _0x5abba4=filterAgentAttributes(_0x535e12);_[_0x7db4('0x30')](_0x191b44,_0x5abba4);_0x191b44[_0x7db4('0x31')]=getAgentStatus(_0x191b44);return _0x191b44;});})[_0x7db4('0x16')](function(_0x59ba6e){var _0x2d8b0a=sortAgentsByStatus(_0x59ba6e,_0x517771);return _['map'](_0x2d8b0a,'id');})[_0x7db4('0x1a')](function(_0x2b6108){throw _0x2b6108;});}exports[_0x7db4('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3c4bc4){var _0x54b712={'fields':[],'order':null};var _0x53f5d8=_0x3c4bc4[_0x7db4('0x33')](',');_0x54b712[_0x7db4('0x34')]=_['filter'](_0x53f5d8,function(_0x5ab47d){if(!_0x5ab47d[_0x7db4('0x2a')](_0x7db4('0x31'))){return!![];}_0x54b712['order']=_[_0x7db4('0x35')](_0x5ab47d,'-')?_0x7db4('0x36'):_0x7db4('0x37');return![];});return _0x54b712;}exports[_0x7db4('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x5903f9){if(!_0x5903f9){_0x5903f9=_0x7db4('0x39');}if(_0x5903f9[_0x7db4('0x2a')](_0x7db4('0x3a'))&&!_0x5903f9[_0x7db4('0x2a')](_0x7db4('0x3b'))){var _0x5779ac=_0x5903f9[_0x7db4('0x3c')](0x0,_0x5903f9[_0x7db4('0x3d')](_0x7db4('0x3a')));_0x5903f9+=','+_0x5779ac+'internal';}return _0x5903f9;}exports[_0x7db4('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1c68aa,_0x280818){var _0x9a14d4=_0x1c68aa[_0x7db4('0x3f')](function(_0x2ed040,_0x41bd){if(_0x2ed040['globalStatus']===_0x41bd[_0x7db4('0x31')]){if(_0x2ed040[_0x7db4('0x31')]===_0x7db4('0x11')){if(_0x280818===_0x7db4('0x36')){return(_0x2ed040[_0x7db4('0x2e')]||'')<(_0x41bd[_0x7db4('0x2e')]||'')||_0x2ed040[_0x7db4('0x3a')][_0x7db4('0x40')]()>_0x41bd[_0x7db4('0x3a')]['toLowerCase']()?0x1:-0x1;}else{return(_0x2ed040[_0x7db4('0x2e')]||'')<(_0x41bd[_0x7db4('0x2e')]||'')||_0x2ed040['fullname'][_0x7db4('0x40')]()>_0x41bd['fullname'][_0x7db4('0x40')]()?-0x1:0x1;}}else{if(_0x280818===_0x7db4('0x36')){return _0x2ed040[_0x7db4('0x3a')]['toLowerCase']()<_0x41bd[_0x7db4('0x3a')][_0x7db4('0x40')]()?0x1:-0x1;}else{return _0x2ed040['fullname']['toLowerCase']()<_0x41bd['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x280818===_0x7db4('0x36')){return _0x2ed040['globalStatus']<_0x41bd[_0x7db4('0x31')]?0x1:-0x1;}else{return _0x2ed040[_0x7db4('0x31')]<_0x41bd[_0x7db4('0x31')]?-0x1:0x1;}}});return _0x9a14d4;}exports[_0x7db4('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x3968fe){var _0x1c12df=[_0x7db4('0x42'),_0x7db4('0x43'),_0x7db4('0x44'),'lastPauseAt',_0x7db4('0x2e'),_0x7db4('0x45'),'internal',_0x7db4('0x46'),_0x7db4('0x3'),'openchannelPause',_0x7db4('0x5'),_0x7db4('0x47'),'whatsappPause',_0x7db4('0x4'),_0x7db4('0x7'),_0x7db4('0x48'),_0x7db4('0x49'),_0x7db4('0x4a'),_0x7db4('0x4b'),'whatsappCapacity',_0x7db4('0x4c'),_0x7db4('0x4d'),_0x7db4('0x4e'),'mailCurrentCapacity',_0x7db4('0x4f'),_0x7db4('0x50'),_0x7db4('0x51'),_0x7db4('0x12'),_0x7db4('0x52'),'mailStatus',_0x7db4('0x53'),_0x7db4('0x54'),_0x7db4('0x13'),'voiceStatus','chatStatusTime',_0x7db4('0x55'),'mailStatusTime',_0x7db4('0x56'),_0x7db4('0x57'),_0x7db4('0x58'),_0x7db4('0x59'),_0x7db4('0x5a'),'destconnectedlinenum',_0x7db4('0x5b'),_0x7db4('0x5c'),_0x7db4('0x5d'),_0x7db4('0x5e')];var _0x4ee837=[_0x7db4('0x3'),_0x7db4('0x6'),_0x7db4('0x5'),_0x7db4('0x47'),'whatsappPause',_0x7db4('0x4'),_0x7db4('0x7'),_0x7db4('0x43')];var _0x5b5fcf=_(_0x3968fe)[_0x7db4('0x5f')](_0x4ee837)[_0x7db4('0x60')](_0x1c12df)[_0x7db4('0x28')]();return _0x5b5fcf;}exports[_0x7db4('0x61')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index ffdb3df..21be4e9 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 _0xdcd6=['outbound','concat','map','get','loggedInDb','waiting','find','merge','pick','initializeQueues','jayson/promise','util','client','available','loggedIn','paused','busy','inUse','invalid','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','dialActive','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xdcd6,0xd6));var _0x6dcd=function(_0x2113d8,_0x5a3232){_0x2113d8=_0x2113d8-0x0;var _0x1c8538=_0xdcd6[_0x2113d8];return _0x1c8538;};'use strict';var _=require('lodash');var jayson=require(_0x6dcd('0x0'));var util=require(_0x6dcd('0x1'));var amiClient=jayson[_0x6dcd('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x6dcd('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x6dcd('0x3'),_0x6dcd('0x4'),_0x6dcd('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x6dcd('0x6'),_0x6dcd('0x7'),_0x6dcd('0x8'),'loggedInDb','notInUse',_0x6dcd('0x9'),_0x6dcd('0xa'),_0x6dcd('0xb'),_0x6dcd('0xc'),'unavailable',_0x6dcd('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6dcd('0xe'),_0x6dcd('0xf'),_0x6dcd('0x10'),'statusMessage',_0x6dcd('0x11'),'dialMethod',_0x6dcd('0x12'),'startPredictive',_0x6dcd('0x13'),'erlangCalls',_0x6dcd('0x14'),_0x6dcd('0x15'),_0x6dcd('0x16'),_0x6dcd('0x17'),_0x6dcd('0x18'),_0x6dcd('0x19'),_0x6dcd('0x1a'),_0x6dcd('0x1b'),_0x6dcd('0x1c'),'predictiveIntervalDroppedCallsTimeout',_0x6dcd('0x1d'),_0x6dcd('0x1e'),_0x6dcd('0x1f')];function getRealtimeQueues(_0x4fecc1,_0x172b43){var _0x399046=_0x172b43===_0x6dcd('0x20')?amiClient:routingClient;return _0x399046[_0x6dcd('0x21')](_[_0x6dcd('0x22')](_0x172b43)+'Queues',_0x4fecc1)['then'](function(_0x478166){if(_0x478166[_0x6dcd('0x23')])throw new Error(util[_0x6dcd('0x24')](_0x6dcd('0x25'),_0x172b43));return _0x478166[_0x6dcd('0x26')];})[_0x6dcd('0x27')](function(_0x588a32){throw _0x588a32;});}exports[_0x6dcd('0x28')]=getRealtimeQueues;function initializeQueues(_0x3be89a,_0x431503,_0x12bbfd,_0x422648){var _0x44b47a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x12bbfd===_0x6dcd('0x20')){if(_0x422648==='inbound'){_0x44b47a=_0x44b47a['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x422648===_0x6dcd('0x29')){_0x44b47a=_0x44b47a[_0x6dcd('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3be89a[_0x6dcd('0x2b')](function(_0x5cdc22){var _0x2b3745=_0x5cdc22[_0x6dcd('0x2c')]({'plain':!![]});_0x2b3745[_0x6dcd('0x5')]=0x0;_0x2b3745[_0x6dcd('0x2d')]=0x0;_0x2b3745['loggedIn']=0x0;_0x2b3745['available']=0x0;_0x2b3745[_0x6dcd('0x2e')]=0x0;if(_0x12bbfd===_0x6dcd('0x20')){_0x2b3745[_0x6dcd('0xc')]=0x0;_0x2b3745[_0x6dcd('0x6')]=0x0;if(_0x422648===_0x6dcd('0x29')){_0x2b3745[_0x6dcd('0xe')]=0x0;_0x2b3745[_0x6dcd('0xf')]=0x0;}}var _0x44e85e=_[_0x6dcd('0x2f')](_0x431503,['id',_0x2b3745['id']]);if(_0x44e85e){_[_0x6dcd('0x30')](_0x2b3745,_[_0x6dcd('0x31')](_0x44e85e,_0x44b47a));}return _0x2b3745;});}exports[_0x6dcd('0x32')]=initializeQueues; \ No newline at end of file +var _0x8466=['available','busy','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','paused','waiting','invalid','loggedInDb','notInUse','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','loggedIn'];(function(_0x555f21,_0x257577){var _0x415303=function(_0x303d6f){while(--_0x303d6f){_0x555f21['push'](_0x555f21['shift']());}};_0x415303(++_0x257577);}(_0x8466,0xa2));var _0x6846=function(_0x27a571,_0x23b4f6){_0x27a571=_0x27a571-0x0;var _0x1a2c48=_0x8466[_0x27a571];return _0x1a2c48;};'use strict';var _=require(_0x6846('0x0'));var jayson=require(_0x6846('0x1'));var util=require(_0x6846('0x2'));var amiClient=jayson[_0x6846('0x3')][_0x6846('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x6846('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x6846('0x5'),_0x6846('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x6846('0x7'),_0x6846('0x8'),_0x6846('0x9'),'onHold',_0x6846('0xa'),_0x6846('0xb'),_0x6846('0xc'),_0x6846('0xd'),_0x6846('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6846('0xf'),_0x6846('0x10'),'message',_0x6846('0x11'),_0x6846('0x12'),'dialMethod','Trunk',_0x6846('0x13'),_0x6846('0x14'),_0x6846('0x15'),'erlangCallToSecond',_0x6846('0x16'),_0x6846('0x17'),_0x6846('0x18'),_0x6846('0x19'),'dialPredictiveIntervalMinThreshold',_0x6846('0x1a'),_0x6846('0x1b'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x6846('0x1c'),_0x6846('0x1d'),_0x6846('0x1e')];function getRealtimeQueues(_0x40fafd,_0x3ad4ed){var _0x23ad07=_0x3ad4ed===_0x6846('0x1f')?amiClient:routingClient;return _0x23ad07['request'](_[_0x6846('0x20')](_0x3ad4ed)+_0x6846('0x21'),_0x40fafd)[_0x6846('0x22')](function(_0x5a7b42){if(_0x5a7b42[_0x6846('0x23')])throw new Error(util[_0x6846('0x24')](_0x6846('0x25'),_0x3ad4ed));return _0x5a7b42[_0x6846('0x26')];})[_0x6846('0x27')](function(_0x3d67dd){throw _0x3d67dd;});}exports[_0x6846('0x28')]=getRealtimeQueues;function initializeQueues(_0x40da13,_0x377049,_0xecb91,_0x43f5f6){var _0x2d9126=DEFAULT_QUEUE_ATTRIBUTES;if(_0xecb91===_0x6846('0x1f')){if(_0x43f5f6===_0x6846('0x29')){_0x2d9126=_0x2d9126[_0x6846('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x43f5f6===_0x6846('0x2b')){_0x2d9126=_0x2d9126[_0x6846('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x40da13[_0x6846('0x2c')](function(_0x43536a){var _0x293f58=_0x43536a['get']({'plain':!![]});_0x293f58[_0x6846('0x5')]=0x0;_0x293f58[_0x6846('0x8')]=0x0;_0x293f58[_0x6846('0x2d')]=0x0;_0x293f58[_0x6846('0x2e')]=0x0;_0x293f58[_0x6846('0x6')]=0x0;if(_0xecb91===_0x6846('0x1f')){_0x293f58['talking']=0x0;_0x293f58[_0x6846('0x2f')]=0x0;if(_0x43f5f6===_0x6846('0x2b')){_0x293f58[_0x6846('0xf')]=0x0;_0x293f58[_0x6846('0x10')]=0x0;}}var _0x5c9c7b=_[_0x6846('0x30')](_0x377049,['id',_0x293f58['id']]);if(_0x5c9c7b){_[_0x6846('0x31')](_0x293f58,_[_0x6846('0x32')](_0x5c9c7b,_0x2d9126));}return _0x293f58;});}exports[_0x6846('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 39ec2d6..8c918c9 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(_0x560bdd,_0x1e1937){var _0x34b589=function(_0x426fb6){while(--_0x426fb6){_0x560bdd['push'](_0x560bdd['shift']());}};_0x34b589(++_0x1e1937);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0x4dc0bc,_0x490bf0){var _0x470317=function(_0x324033){while(--_0x324033){_0x4dc0bc['push'](_0x4dc0bc['shift']());}};_0x470317(++_0x490bf0);}(_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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9b33bd0..21a4118 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 _0x04f7=['orderBy','keys','length','filter','family','IPv4','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces'];(function(_0x35ab97,_0x3caa28){var _0x334e68=function(_0x7d41d1){while(--_0x7d41d1){_0x35ab97['push'](_0x35ab97['shift']());}};_0x334e68(++_0x3caa28);}(_0x04f7,0x186));var _0x704f=function(_0x3a340f,_0x5a0b68){_0x3a340f=_0x3a340f-0x0;var _0x55389a=_0x04f7[_0x3a340f];return _0x55389a;};'use strict';var _=require(_0x704f('0x0'));var os=require('os');var crypto=require(_0x704f('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x704f('0x2'))[_0x704f('0x3')];var config=require(_0x704f('0x4'));function getInterfaces(){var _0x244be7=[];var _0x47efb=os[_0x704f('0x5')]();var _0x101251=_[_0x704f('0x6')](_[_0x704f('0x7')](_0x47efb));for(var _0x2b42a0=0x0;_0x2b42a0<_0x101251[_0x704f('0x8')];_0x2b42a0++){var _0x3efd49=_0x47efb[_0x101251[_0x2b42a0]][_0x704f('0x9')](function(_0x45e37b){return _0x45e37b[_0x704f('0xa')]===_0x704f('0xb')&&_0x45e37b['internal']===![];});_0x244be7=_0x244be7['concat'](_0x3efd49);}return _0x244be7;}function getFirstInterface(){var _0x2201fc=_[_0x704f('0xc')](getInterfaces());return{'macAddress':_0x2201fc&&_0x2201fc[_0x704f('0xd')]?_0x2201fc[_0x704f('0xd')]:'00:00:00:00:00:00','ipAddress':_0x2201fc&&_0x2201fc[_0x704f('0xe')]?_0x2201fc[_0x704f('0xe')]:_0x704f('0xf')};}exports[_0x704f('0x10')]=getFirstInterface;function getCPUhash(){var _0x1528f9=_[_0x704f('0x6')](os[_0x704f('0x11')]()['map'](function(_0xd50580){return _0xd50580[_0x704f('0x12')];}))['join'](':');return crypto[_0x704f('0x13')](_0x704f('0x14'))['update'](_0x1528f9)[_0x704f('0x15')](_0x704f('0x16'));}exports[_0x704f('0x17')]=function(){var _0x280b74=os[_0x704f('0x18')]();var _0x4d8023=/[0-9a-f-]{36}/;if(config[_0x704f('0x19')]&&_0x4d8023[_0x704f('0x1a')](config['licenseToken'])){return config[_0x704f('0x19')];}else if(_0x280b74===_0x704f('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x704f('0x1c')})[_0x704f('0x1d')]('\x0d\x0a','');}else{var _0x560790=getFirstInterface();var _0x558d88=getCPUhash();var _0x449a59=_0x558d88+'|'+os[_0x704f('0x1e')]()+'|'+_0x560790['macAddress']+'|'+_0x560790[_0x704f('0x1f')];var _0x22df79=crypto[_0x704f('0x13')](_0x704f('0x14'))['update'](_0x449a59)[_0x704f('0x15')](_0x704f('0x16'));return _0x22df79['substring'](0x0,0x8)+'-'+_0x22df79[_0x704f('0x20')](0x8,0xc)+'-'+_0x22df79[_0x704f('0x20')](0xc,0x10)+'-'+_0x22df79[_0x704f('0x20')](0x10,0x14)+'-'+_0x22df79['substring'](0x14);}}; \ No newline at end of file +var _0x04e5=['dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','md5','update','digest','hex','platform','licenseToken','test','win32'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x04e5,0x1ab));var _0x504e=function(_0xaf4b95,_0x402972){_0xaf4b95=_0xaf4b95-0x0;var _0x5b4e99=_0x04e5[_0xaf4b95];return _0x5b4e99;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x504e('0x0'));var machine=require(_0x504e('0x1'));var exec=require(_0x504e('0x2'))[_0x504e('0x3')];var config=require(_0x504e('0x4'));function getInterfaces(){var _0x27b600=[];var _0x4c8e04=os[_0x504e('0x5')]();var _0x7342e3=_[_0x504e('0x6')](_['keys'](_0x4c8e04));for(var _0x47a933=0x0;_0x47a933<_0x7342e3[_0x504e('0x7')];_0x47a933++){var _0x42953f=_0x4c8e04[_0x7342e3[_0x47a933]][_0x504e('0x8')](function(_0x230a04){return _0x230a04[_0x504e('0x9')]===_0x504e('0xa')&&_0x230a04[_0x504e('0xb')]===![];});_0x27b600=_0x27b600[_0x504e('0xc')](_0x42953f);}return _0x27b600;}function getFirstInterface(){var _0x4177a9=_[_0x504e('0xd')](getInterfaces());return{'macAddress':_0x4177a9&&_0x4177a9['mac']?_0x4177a9['mac']:_0x504e('0xe'),'ipAddress':_0x4177a9&&_0x4177a9[_0x504e('0xf')]?_0x4177a9['address']:_0x504e('0x10')};}exports[_0x504e('0x11')]=getFirstInterface;function getCPUhash(){var _0x37627e=_[_0x504e('0x6')](os[_0x504e('0x12')]()['map'](function(_0x29445a){return _0x29445a[_0x504e('0x13')];}))['join'](':');return crypto['createHash'](_0x504e('0x14'))[_0x504e('0x15')](_0x37627e)[_0x504e('0x16')](_0x504e('0x17'));}exports['getUuid']=function(){var _0x934204=os[_0x504e('0x18')]();var _0x53fd83=/[0-9a-f-]{36}/;if(config[_0x504e('0x19')]&&_0x53fd83[_0x504e('0x1a')](config['licenseToken'])){return config['licenseToken'];}else if(_0x934204===_0x504e('0x1b')){return exec(_0x504e('0x1c'),{'encoding':_0x504e('0x1d')})[_0x504e('0x1e')]('\x0d\x0a','');}else{var _0x58e771=getFirstInterface();var _0x12e91c=getCPUhash();var _0x4ca30f=_0x12e91c+'|'+os[_0x504e('0x1f')]()+'|'+_0x58e771[_0x504e('0x20')]+'|'+_0x58e771[_0x504e('0x21')];var _0x3a7f55=crypto['createHash'](_0x504e('0x14'))[_0x504e('0x15')](_0x4ca30f)[_0x504e('0x16')](_0x504e('0x17'));return _0x3a7f55[_0x504e('0x22')](0x0,0x8)+'-'+_0x3a7f55[_0x504e('0x22')](0x8,0xc)+'-'+_0x3a7f55[_0x504e('0x22')](0xc,0x10)+'-'+_0x3a7f55[_0x504e('0x22')](0x10,0x14)+'-'+_0x3a7f55['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d507ec1..0653dbc 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 _0xd425=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x209cc4,_0x57581a){var _0x2121e2=function(_0x3e8f7b){while(--_0x3e8f7b){_0x209cc4['push'](_0x209cc4['shift']());}};_0x2121e2(++_0x57581a);}(_0xd425,0xe3));var _0x5d42=function(_0x3fcf72,_0x3c133e){_0x3fcf72=_0x3fcf72-0x0;var _0x33bdd2=_0xd425[_0x3fcf72];return _0x33bdd2;};'use strict';var util=require('util');var moment=require(_0x5d42('0x0'));var rp=require(_0x5d42('0x1'));var BPromise=require(_0x5d42('0x2'));var pkginfo=require(_0x5d42('0x3'))(module,'version');var db=require(_0x5d42('0x4'))['db'];var encryptor=require(_0x5d42('0x5'));var hardware=require(_0x5d42('0x6'));var logger=require(_0x5d42('0x7'))(_0x5d42('0x8'));var HOST=_0x5d42('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x114503){return new BPromise(function(_0x3636c2,_0x204f4a){var _0x2460e3=util[_0x5d42('0xa')](_0x5d42('0xb'),HOST,_0x114503,module['exports'][_0x5d42('0xc')]);if(oldToken){_0x2460e3=util[_0x5d42('0xa')](_0x5d42('0xd'),HOST,_0x114503,module['exports'][_0x5d42('0xc')],oldToken);}var _0x2347f9={'uri':_0x2460e3,'method':_0x5d42('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2347f9)[_0x5d42('0xf')](function(_0x28d1f3){_0x3636c2(_0x28d1f3);})[_0x5d42('0x10')](function(_0x5c6426){_0x204f4a(_0x5c6426);});});}function manageLicense(_0x3d6299,_0x27b2b6){var _0x2dcc62=_0x27b2b6[_0x5d42('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x2dcc62[_0x5d42('0x12')]!==_0x3d6299&&!_0x2dcc62[_0x5d42('0x13')]){oldToken=_0x2dcc62[_0x5d42('0x12')];}httpRequest(_0x3d6299)[_0x5d42('0xf')](function(_0xba48dc){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xba48dc[_0x5d42('0x14')]){isOldTokenSent=![];if(!_0x2dcc62[_0x5d42('0x8')]&&_0x2dcc62[_0x5d42('0x8')]!=_0xba48dc['license']||_0x2dcc62[_0x5d42('0x8')]&&_0x2dcc62[_0x5d42('0x13')]){logger[_0x5d42('0x15')](_0x5d42('0x16'));}if(_0x2dcc62[_0x5d42('0x8')]&&!_0x2dcc62[_0x5d42('0x13')]&&_0x2dcc62[_0x5d42('0x8')]!=_0xba48dc[_0x5d42('0x8')]){logger['info'](_0x5d42('0x17'));}if(_0x2dcc62[_0x5d42('0x8')]&&!_0x2dcc62['data2']&&_0x2dcc62[_0x5d42('0x8')]==_0xba48dc['license']){return _0x27b2b6;}return _0x27b2b6[_0x5d42('0x18')]({'data1':_0x3d6299,'data2':null,'license':_0xba48dc['license']});}else{if(_0xba48dc[_0x5d42('0x8')]||_0x2dcc62[_0x5d42('0x8')]){if(!_0x2dcc62[_0x5d42('0x13')]){if(_0x2dcc62[_0x5d42('0x12')]==_0x3d6299){GRAY_PERIOD_REASON=_0x5d42('0x19');logger[_0x5d42('0x15')](_0x5d42('0x1a'));}else{GRAY_PERIOD_REASON=_0x5d42('0x1b');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2dcc62[_0x5d42('0x12')],_0x3d6299);}logger[_0x5d42('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x5d42('0x1c')](),moment()[_0x5d42('0xa')](_0x5d42('0x1d')));return _0x27b2b6[_0x5d42('0x18')]({'data2':encryptor[_0x5d42('0x1e')](moment()[_0x5d42('0xa')](_0x5d42('0x1d')))});}else{if(moment()['diff'](encryptor[_0x5d42('0x1f')](_0x2dcc62['data2']),_0x5d42('0x20'))>DAYS){logger[_0x5d42('0x15')](_0x5d42('0x21'),moment()[_0x5d42('0xa')](_0x5d42('0x1d')));isOldTokenSent=![];return _0x27b2b6['update']({'data1':_0x3d6299,'data2':null,'license':null});}}}else{if(_0x2dcc62[_0x5d42('0x12')]!=_0x3d6299){logger[_0x5d42('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2dcc62[_0x5d42('0x12')],_0x3d6299);return _0x27b2b6[_0x5d42('0x18')]({'data1':_0x3d6299,'data2':null,'license':null});}}}return _0x27b2b6;})[_0x5d42('0xf')](function(_0x55fed6){_0x27b2b6=_0x55fed6;})[_0x5d42('0x10')](function(_0x625a0d){logger[_0x5d42('0x22')](_0x625a0d[_0x5d42('0x23')]);})[_0x5d42('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x27b2b6);},TIME);});}function defaultLicense(){var _0x3d4e5b=hardware[_0x5d42('0x25')]();if(_0x3d4e5b){return db['License'][_0x5d42('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3d4e5b}})[_0x5d42('0x27')](function(_0x322fc8,_0x12f4b6){logger[_0x5d42('0x15')](_0x5d42('0x28'),_0x3d4e5b);manageLicense(_0x3d4e5b,_0x322fc8);})[_0x5d42('0x10')](function(_0x245707){logger[_0x5d42('0x22')](_0x245707[_0x5d42('0x23')]);});}}exports[_0x5d42('0x29')]=defaultLicense; \ No newline at end of file +var _0x667c=['./hardware','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','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','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','bluebird','../../mysqldb'];(function(_0x2351c6,_0x13d107){var _0x2c46e4=function(_0x510d91){while(--_0x510d91){_0x2351c6['push'](_0x2351c6['shift']());}};_0x2c46e4(++_0x13d107);}(_0x667c,0x14d));var _0xc667=function(_0x1086c0,_0xa35489){_0x1086c0=_0x1086c0-0x0;var _0x425bef=_0x667c[_0x1086c0];return _0x425bef;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xc667('0x0'));var BPromise=require(_0xc667('0x1'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xc667('0x2'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xc667('0x3'));var logger=require('../logger')(_0xc667('0x4'));var HOST=_0xc667('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2427fa){return new BPromise(function(_0x3c7f08,_0x23d90e){var _0x238a34=util['format'](_0xc667('0x6'),HOST,_0x2427fa,module['exports'][_0xc667('0x7')]);if(oldToken){_0x238a34=util[_0xc667('0x8')](_0xc667('0x9'),HOST,_0x2427fa,module['exports'][_0xc667('0x7')],oldToken);}var _0x4932ce={'uri':_0x238a34,'method':_0xc667('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x4932ce)[_0xc667('0xb')](function(_0x306d90){_0x3c7f08(_0x306d90);})[_0xc667('0xc')](function(_0x30af09){_0x23d90e(_0x30af09);});});}function manageLicense(_0x278812,_0x609e0f){var _0x4871a9=_0x609e0f[_0xc667('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x4871a9[_0xc667('0xe')]!==_0x278812&&!_0x4871a9[_0xc667('0xf')]){oldToken=_0x4871a9[_0xc667('0xe')];}httpRequest(_0x278812)[_0xc667('0xb')](function(_0x132c69){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x132c69[_0xc667('0x10')]){isOldTokenSent=![];if(!_0x4871a9['license']&&_0x4871a9[_0xc667('0x4')]!=_0x132c69[_0xc667('0x4')]||_0x4871a9[_0xc667('0x4')]&&_0x4871a9['data2']){logger[_0xc667('0x11')](_0xc667('0x12'));}if(_0x4871a9[_0xc667('0x4')]&&!_0x4871a9[_0xc667('0xf')]&&_0x4871a9[_0xc667('0x4')]!=_0x132c69['license']){logger[_0xc667('0x11')](_0xc667('0x13'));}if(_0x4871a9['license']&&!_0x4871a9[_0xc667('0xf')]&&_0x4871a9[_0xc667('0x4')]==_0x132c69['license']){return _0x609e0f;}return _0x609e0f[_0xc667('0x14')]({'data1':_0x278812,'data2':null,'license':_0x132c69[_0xc667('0x4')]});}else{if(_0x132c69[_0xc667('0x4')]||_0x4871a9['license']){if(!_0x4871a9[_0xc667('0xf')]){if(_0x4871a9[_0xc667('0xe')]==_0x278812){GRAY_PERIOD_REASON=_0xc667('0x15');logger[_0xc667('0x11')](_0xc667('0x16'));}else{GRAY_PERIOD_REASON=_0xc667('0x17');logger[_0xc667('0x11')](_0xc667('0x18'),_0x4871a9['data1'],_0x278812);}logger[_0xc667('0x11')](_0xc667('0x19'),GRAY_PERIOD_REASON[_0xc667('0x1a')](),moment()[_0xc667('0x8')](_0xc667('0x1b')));return _0x609e0f['update']({'data2':encryptor[_0xc667('0x1c')](moment()[_0xc667('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xc667('0x1d')](encryptor[_0xc667('0x1e')](_0x4871a9[_0xc667('0xf')]),_0xc667('0x1f'))>DAYS){logger[_0xc667('0x11')](_0xc667('0x20'),moment()[_0xc667('0x8')](_0xc667('0x1b')));isOldTokenSent=![];return _0x609e0f[_0xc667('0x14')]({'data1':_0x278812,'data2':null,'license':null});}}}else{if(_0x4871a9[_0xc667('0xe')]!=_0x278812){logger['info'](_0xc667('0x18'),_0x4871a9[_0xc667('0xe')],_0x278812);return _0x609e0f[_0xc667('0x14')]({'data1':_0x278812,'data2':null,'license':null});}}}return _0x609e0f;})[_0xc667('0xb')](function(_0x187c2d){_0x609e0f=_0x187c2d;})['catch'](function(_0x1f03f5){logger[_0xc667('0x21')](_0x1f03f5[_0xc667('0x22')]);})[_0xc667('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xc667('0x24')](),_0x609e0f);},TIME);});}function defaultLicense(){var _0x4f5483=hardware[_0xc667('0x24')]();if(_0x4f5483){return db[_0xc667('0x25')][_0xc667('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x4f5483}})[_0xc667('0x27')](function(_0x313fb9,_0x289bfb){logger[_0xc667('0x11')](_0xc667('0x28'),_0x4f5483);manageLicense(_0x4f5483,_0x313fb9);})['catch'](function(_0x4e734d){logger[_0xc667('0x21')](_0x4e734d[_0xc667('0x22')]);});}}exports[_0xc667('0x29')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 42b0dc0..0c05e41 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 _0x7a88=['deadline','add','days','disabled','message','User','findAll','role','COUNT','col','count','admin','telephone','telephones','forEach','user','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString'];(function(_0x306174,_0x17e044){var _0x182348=function(_0x1d16ad){while(--_0x1d16ad){_0x306174['push'](_0x306174['shift']());}};_0x182348(++_0x17e044);}(_0x7a88,0x1df));var _0x87a8=function(_0x3881bf,_0x1b016){_0x3881bf=_0x3881bf-0x0;var _0x539015=_0x7a88[_0x3881bf];return _0x539015;};'use strict';var util=require(_0x87a8('0x0'));var _=require('lodash');var moment=require(_0x87a8('0x1'));var BPromise=require(_0x87a8('0x2'));var hardware=require(_0x87a8('0x3'));var encryptor=require(_0x87a8('0x4'));var db=require(_0x87a8('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x87a8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x87a8('0x7'),'machineUuid':hardware[_0x87a8('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x87a8('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x87a8('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x6e5819){return new BPromise(function(_0x342506,_0x24d34b){return db[_0x87a8('0xa')]['find'](_[_0x87a8('0xb')](_0x6e5819,{'raw':!![],'where':{'id':0x1}}))[_0x87a8('0xc')](function(_0x4fcd7c){return checkLicense(_0x4fcd7c,null);})[_0x87a8('0xc')](function(_0x413389){_0x342506(_0x413389);return;})[_0x87a8('0xd')](function(_0x2b2982){_0x24d34b(_0x2b2982);});});}function checkLicense(_0x462bd6,_0x26e183){if(!_0x462bd6){demoLicense[_0x87a8('0xe')]=_0x462bd6[_0x87a8('0xf')];return demoLicense;}try{var _0x32d992=_0x26e183||_0x462bd6[_0x87a8('0x10')];if(_[_0x87a8('0x11')](_0x32d992)){throw new Error(_0x87a8('0x12'));}var _0x23b833=_0x462bd6[_0x87a8('0xf')];var _0x58e673=_0x462bd6[_0x87a8('0x13')];var _0x21a031=_0x23b833[_0x87a8('0x14')]('-')[0x4];var _0x30a218=_0x23b833[_0x87a8('0x14')]('-')[0x0];var _0x1271e2=encryptor['decryptString'](_0x32d992,util[_0x87a8('0x15')](_0x87a8('0x16'),_0x21a031,_0x23b833,_0x30a218));var _0x4b9e20=JSON[_0x87a8('0x17')](_0x1271e2);_0x4b9e20[_0x87a8('0x18')]=![];_0x4b9e20[_0x87a8('0xe')]=_0x23b833;_0x4b9e20[_0x87a8('0x19')]=hardware[_0x87a8('0x8')]();if(_0x58e673){var _0x43aa4f=encryptor[_0x87a8('0x1a')](_0x58e673);_0x4b9e20['gray']=_0x43aa4f;_0x4b9e20[_0x87a8('0x1b')]=moment(_0x43aa4f)[_0x87a8('0x1c')](0x7,_0x87a8('0x1d'))['format']();_0x4b9e20['grayReason']=_0x4b9e20['uuid']!=_0x4b9e20[_0x87a8('0x19')]?'changed':_0x87a8('0x1e');}return _0x4b9e20;}catch(_0x3e6262){breakingLicense[_0x87a8('0xe')]=_0x462bd6[_0x87a8('0xf')];breakingLicense['message']=_0x3e6262[_0x87a8('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e80e3,_0x5c41fe){getLicense()[_0x87a8('0xc')](function(_0x55936b){return db[_0x87a8('0x20')][_0x87a8('0x21')]({'attributes':[_0x87a8('0x22'),[db['sequelize']['fn'](_0x87a8('0x23'),db['sequelize'][_0x87a8('0x24')]('role')),_0x87a8('0x25')]],'group':'role','where':{'role':{'$or':[_0x87a8('0x26'),'user',_0x87a8('0x27')]}},'raw':!![]})['then'](function(_0xc251e7){var _0x5bb386={'user':_0x55936b['users']||0x0,'telephone':_0x55936b[_0x87a8('0x28')]||0x0};_0xc251e7[_0x87a8('0x29')](function(_0x3947f5){var _0x4ce1fd=_0x3947f5[_0x87a8('0x22')]===_0x87a8('0x26')?_0x87a8('0x2a'):_0x3947f5[_0x87a8('0x22')];_0x5bb386[_0x4ce1fd]-=_0x3947f5[_0x87a8('0x25')];if(_0x5bb386[_0x4ce1fd]<0x0)_0x5bb386[_0x4ce1fd]=0x0;});_0x2e80e3(_0x5bb386);return;});})['catch'](function(_0x26e4a3){_0x5c41fe(_0x26e4a3);});});}function checkUserLimits(_0x192f25){return new BPromise(function(_0x3cc25d,_0xea83cd){getLimits()[_0x87a8('0xc')](function(_0xda98ae){var _0x27d54c=_['pick'](_[_0x87a8('0x2b')](_0x192f25,_0x87a8('0x22')),[_0x87a8('0x26'),_0x87a8('0x2a'),_0x87a8('0x27')]);var _0x137246=(_0x27d54c[_0x87a8('0x26')]||0x0)+(_0x27d54c['user']||0x0);var _0xe4d5fa=_0x27d54c[_0x87a8('0x27')]||0x0;if(_0x137246>_0xda98ae[_0x87a8('0x2a')])return _0xea83cd(_0x87a8('0x2c'));if(_0xe4d5fa>_0xda98ae[_0x87a8('0x27')])return _0xea83cd(_0x87a8('0x2d'));return _0x3cc25d();})[_0x87a8('0xd')](function(_0x211179){_0xea83cd(_0x211179);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf880=['sequelize','COUNT','col','telephone','users','telephones','admin','user','count','catch','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','data1','isEmpty','data2','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','grayReason','disabled','message','findAll','role'];(function(_0x33b96d,_0x4544b1){var _0x246aa8=function(_0x2b3f56){while(--_0x2b3f56){_0x33b96d['push'](_0x33b96d['shift']());}};_0x246aa8(++_0x4544b1);}(_0xf880,0x68));var _0x0f88=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xf880[_0x9b5bb2];return _0x2e1e92;};'use strict';var util=require(_0x0f88('0x0'));var _=require('lodash');var moment=require(_0x0f88('0x1'));var BPromise=require('bluebird');var hardware=require(_0x0f88('0x2'));var encryptor=require(_0x0f88('0x3'));var db=require(_0x0f88('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0f88('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0f88('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0f88('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0f88('0x7'),'machineUuid':hardware[_0x0f88('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x26182f){return new BPromise(function(_0x19ce3d,_0x74927a){return db[_0x0f88('0x9')][_0x0f88('0xa')](_[_0x0f88('0xb')](_0x26182f,{'raw':!![],'where':{'id':0x1}}))[_0x0f88('0xc')](function(_0x36283e){return checkLicense(_0x36283e,null);})['then'](function(_0x360226){_0x19ce3d(_0x360226);return;})['catch'](function(_0x322245){_0x74927a(_0x322245);});});}function checkLicense(_0x3bdfd0,_0x47ff43){if(!_0x3bdfd0){demoLicense['uuid']=_0x3bdfd0[_0x0f88('0xd')];return demoLicense;}try{var _0x21ce35=_0x47ff43||_0x3bdfd0['license'];if(_[_0x0f88('0xe')](_0x21ce35)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4770ad=_0x3bdfd0[_0x0f88('0xd')];var _0xdf1af=_0x3bdfd0[_0x0f88('0xf')];var _0x2061a8=_0x4770ad['split']('-')[0x4];var _0x338968=_0x4770ad['split']('-')[0x0];var _0x5db1b0=encryptor[_0x0f88('0x10')](_0x21ce35,util[_0x0f88('0x11')](_0x0f88('0x12'),_0x2061a8,_0x4770ad,_0x338968));var _0x12c61b=JSON[_0x0f88('0x13')](_0x5db1b0);_0x12c61b[_0x0f88('0x14')]=![];_0x12c61b[_0x0f88('0x15')]=_0x4770ad;_0x12c61b[_0x0f88('0x16')]=hardware[_0x0f88('0x8')]();if(_0xdf1af){var _0x5b1311=encryptor[_0x0f88('0x10')](_0xdf1af);_0x12c61b[_0x0f88('0x17')]=_0x5b1311;_0x12c61b[_0x0f88('0x18')]=moment(_0x5b1311)[_0x0f88('0x19')](0x7,'days')[_0x0f88('0x11')]();_0x12c61b[_0x0f88('0x1a')]=_0x12c61b[_0x0f88('0x15')]!=_0x12c61b[_0x0f88('0x16')]?'changed':_0x0f88('0x1b');}return _0x12c61b;}catch(_0x2f083a){breakingLicense['uuid']=_0x3bdfd0['data1'];breakingLicense[_0x0f88('0x1c')]=_0x2f083a['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xafcf7b,_0x9fcb4b){getLicense()[_0x0f88('0xc')](function(_0x5df487){return db['User'][_0x0f88('0x1d')]({'attributes':[_0x0f88('0x1e'),[db[_0x0f88('0x1f')]['fn'](_0x0f88('0x20'),db[_0x0f88('0x1f')][_0x0f88('0x21')](_0x0f88('0x1e'))),'count']],'group':'role','where':{'role':{'$or':['admin','user',_0x0f88('0x22')]}},'raw':!![]})['then'](function(_0x14f5f3){var _0x236157={'user':_0x5df487[_0x0f88('0x23')]||0x0,'telephone':_0x5df487[_0x0f88('0x24')]||0x0};_0x14f5f3['forEach'](function(_0x46a996){var _0x431491=_0x46a996[_0x0f88('0x1e')]===_0x0f88('0x25')?_0x0f88('0x26'):_0x46a996[_0x0f88('0x1e')];_0x236157[_0x431491]-=_0x46a996[_0x0f88('0x27')];if(_0x236157[_0x431491]<0x0)_0x236157[_0x431491]=0x0;});_0xafcf7b(_0x236157);return;});})[_0x0f88('0x28')](function(_0x499b93){_0x9fcb4b(_0x499b93);});});}function checkUserLimits(_0x16d413){return new BPromise(function(_0x4008cd,_0xecf641){getLimits()[_0x0f88('0xc')](function(_0x160b55){var _0xb80b9e=_[_0x0f88('0x29')](_['countBy'](_0x16d413,_0x0f88('0x1e')),[_0x0f88('0x25'),_0x0f88('0x26'),_0x0f88('0x22')]);var _0x29e7f4=(_0xb80b9e[_0x0f88('0x25')]||0x0)+(_0xb80b9e[_0x0f88('0x26')]||0x0);var _0x53d2e7=_0xb80b9e['telephone']||0x0;if(_0x29e7f4>_0x160b55[_0x0f88('0x26')])return _0xecf641(_0x0f88('0x2a'));if(_0x53d2e7>_0x160b55[_0x0f88('0x22')])return _0xecf641(_0x0f88('0x2b'));return _0x4008cd();})[_0x0f88('0x28')](function(_0x34612c){_0xecf641(_0x34612c);});});}module[_0x0f88('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index e8870be..c6ac66b 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 _0x6343=['myappanuglar-secret','app-id'];(function(_0x19470e,_0x380567){var _0x13c2c2=function(_0x12c311){while(--_0x12c311){_0x19470e['push'](_0x19470e['shift']());}};_0x13c2c2(++_0x380567);}(_0x6343,0x168));var _0x3634=function(_0x55805b,_0x7e8387){_0x55805b=_0x55805b-0x0;var _0x43a3b3=_0x6343[_0x55805b];return _0x43a3b3;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3634('0x0'),'GOOGLE_ID':_0x3634('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x8aad=['http://localhost:9000','app-id','exports'];(function(_0x1f909a,_0x15d56f){var _0x543f16=function(_0x17a991){while(--_0x17a991){_0x1f909a['push'](_0x1f909a['shift']());}};_0x543f16(++_0x15d56f);}(_0x8aad,0x146));var _0xd8aa=function(_0x31fb12,_0x2e9153){_0x31fb12=_0x31fb12-0x0;var _0xf0a2e6=_0x8aad[_0x31fb12];return _0xf0a2e6;};'use strict';module[_0xd8aa('0x0')]={'DOMAIN':_0xd8aa('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd8aa('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3660450..90ecddb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8cc=['fileLogger','../utils/loggers'];(function(_0x80180c,_0x78f4d7){var _0x4dcef5=function(_0x58c5ee){while(--_0x58c5ee){_0x80180c['push'](_0x80180c['shift']());}};_0x4dcef5(++_0x78f4d7);}(_0xb8cc,0x185));var _0xcb8c=function(_0xd80721,_0x22e217){_0xd80721=_0xd80721-0x0;var _0x1daaff=_0xb8cc[_0xd80721];return _0x1daaff;};'use strict';var fileLogger=require(_0xcb8c('0x0'))[_0xcb8c('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x1d45=['../utils/loggers','fileLogger','exports'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x1d45,0x1ad));var _0x51d4=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x1d45[_0x599e60];return _0x468e19;};'use strict';var fileLogger=require(_0x51d4('0x0'))[_0x51d4('0x1')];module[_0x51d4('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6a31c23..25b5eba 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 _0xceb0=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','legacy-libs','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','routing'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xceb0,0x162));var _0x0ceb=function(_0x1d88e6,_0x1c86e7){_0x1d88e6=_0x1d88e6-0x0;var _0x76e210=_0xceb0[_0x1d88e6];return _0x76e210;};'use strict';var path=require(_0x0ceb('0x0'));var cfg=require(_0x0ceb('0x1'));var env={'NODE_PATH':path[_0x0ceb('0x2')](path[_0x0ceb('0x3')](cfg['root'],_0x0ceb('0x4')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x0ceb('0x5')),'env':env},{'name':'ami','script':path[_0x0ceb('0x3')](__dirname,_0x0ceb('0x6')),'env':env},{'name':_0x0ceb('0x7'),'script':path[_0x0ceb('0x3')](__dirname,_0x0ceb('0x8')),'env':env},{'name':'email','script':path[_0x0ceb('0x3')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x0ceb('0x9'),'script':path['join'](__dirname,_0x0ceb('0xa')),'env':env},{'name':_0x0ceb('0xb'),'script':path[_0x0ceb('0x3')](__dirname,_0x0ceb('0xc')),'env':env}]};module[_0x0ceb('0xd')]=pm2config; \ No newline at end of file +var _0x87a3=['agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','exports','path','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x61a588,_0x50b482){var _0x3b4b47=function(_0x52e700){while(--_0x52e700){_0x61a588['push'](_0x61a588['shift']());}};_0x3b4b47(++_0x50b482);}(_0x87a3,0x1d7));var _0x387a=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x87a3[_0x4bfac3];return _0x15f0f2;};'use strict';var path=require(_0x387a('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x387a('0x1')](path[_0x387a('0x2')](cfg[_0x387a('0x3')],_0x387a('0x4')))};var pm2config={'apps':[{'name':_0x387a('0x5'),'script':path[_0x387a('0x2')](__dirname,_0x387a('0x6')),'env':env},{'name':_0x387a('0x7'),'script':path[_0x387a('0x2')](__dirname,_0x387a('0x8')),'env':env},{'name':_0x387a('0x9'),'script':path['join'](__dirname,_0x387a('0xa')),'env':env},{'name':_0x387a('0xb'),'script':path[_0x387a('0x2')](__dirname,_0x387a('0xc')),'env':env},{'name':'routing','script':path[_0x387a('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x387a('0xd'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x387a('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fa68a1e..4acb912 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 _0x3406=['list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart'];(function(_0x3b46ca,_0x408e4b){var _0x21aea2=function(_0x2df6c1){while(--_0x2df6c1){_0x3b46ca['push'](_0x3b46ca['shift']());}};_0x21aea2(++_0x408e4b);}(_0x3406,0x1b7));var _0x6340=function(_0x2ea199,_0x1636ad){_0x2ea199=_0x2ea199-0x0;var _0x16adb7=_0x3406[_0x2ea199];return _0x16adb7;};'use strict';var pm2=require(_0x6340('0x0'));var BPromise=require(_0x6340('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x261724,_0x59d914){return pm2[_0x6340('0x2')](function(_0x1f1649){if(_0x1f1649){return _0x59d914(_0x1f1649);}return _0x261724(_0x6340('0x3'));});});};exports[_0x6340('0x4')]=function(_0x50b770){return connect()[_0x6340('0x5')](function(){return new BPromise(function(_0x4650e4,_0x3bf069){return pm2[_0x6340('0x4')](_0x50b770,function(_0x409840,_0x128d63){if(_0x409840){return _0x3bf069(_0x409840);}pm2[_0x6340('0x6')]();return _0x4650e4(_0x128d63);});});});};exports[_0x6340('0x7')]=function(_0x13aefa){return connect()['then'](function(){return new BPromise(function(_0x1f5268,_0x53357f){return pm2[_0x6340('0x7')](_0x13aefa,function(_0xadbb9e,_0x5e20b6){if(_0xadbb9e){return _0x53357f(_0xadbb9e);}pm2[_0x6340('0x6')]();return _0x1f5268(_0x5e20b6);});});});};exports['restart']=function(_0x43506c){return connect()[_0x6340('0x5')](function(){return new BPromise(function(_0x30b553,_0x25c8a0){return pm2[_0x6340('0x8')](_0x43506c,function(_0x17c0dc,_0x3c732a){if(_0x17c0dc){return _0x25c8a0(_0x17c0dc);}pm2[_0x6340('0x6')]();return _0x30b553(_0x3c732a);});});});};exports[_0x6340('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0xd4065b,_0x6d4555){return pm2['list'](function(_0x43633f,_0x15d08f){if(_0x43633f){return _0x6d4555(_0x43633f);}pm2[_0x6340('0x6')]();return _0xd4065b(_0x15d08f);});});});};exports['describe']=function(_0x2f2cd7){return connect()[_0x6340('0x5')](function(){return new BPromise(function(_0x26dceb,_0x1bf5bc){return pm2[_0x6340('0xa')](_0x2f2cd7,function(_0x33b10f,_0x237edb){if(_0x33b10f){return _0x1bf5bc(_0x33b10f);}pm2[_0x6340('0x6')]();return _0x26dceb(_0x237edb);});});});};exports['delete']=function(_0x569121){return connect()[_0x6340('0x5')](function(){return new BPromise(function(_0x5c1856,_0x45391f){return pm2[_0x6340('0xb')](_0x569121,function(_0xe97094,_0x403d64){if(_0xe97094){return _0x45391f(_0xe97094);}pm2[_0x6340('0x6')]();return _0x5c1856(_0x403d64);});});});};exports[_0x6340('0xc')]=function(){return connect()[_0x6340('0x5')](function(){return new BPromise(function(_0x3d1607,_0x62444c){return pm2[_0x6340('0xc')](function(_0x3d1876){if(_0x3d1876){return _0x62444c(_0x3d1876);}return _0x3d1607(_0x6340('0xd'));});});});}; \ No newline at end of file +var _0xf678=['bluebird','./config','then','stop','restart','list','disconnect','describe','delete','dump','saved'];(function(_0x1fde0e,_0x21db86){var _0x133d5e=function(_0x53124d){while(--_0x53124d){_0x1fde0e['push'](_0x1fde0e['shift']());}};_0x133d5e(++_0x21db86);}(_0xf678,0x8f));var _0x8f67=function(_0x1036b7,_0x3735e8){_0x1036b7=_0x1036b7-0x0;var _0x3daabd=_0xf678[_0x1036b7];return _0x3daabd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8f67('0x0'));var config=require(_0x8f67('0x1'));function connect(){return new BPromise(function(_0x3770f3,_0x2face7){return pm2['connect'](function(_0x4c97b9){if(_0x4c97b9){return _0x2face7(_0x4c97b9);}return _0x3770f3('connected');});});};exports['start']=function(_0x2d7102){return connect()['then'](function(){return new BPromise(function(_0xba7f9,_0x1a4aa8){return pm2['start'](_0x2d7102,function(_0x4fcc60,_0x5804d5){if(_0x4fcc60){return _0x1a4aa8(_0x4fcc60);}pm2['disconnect']();return _0xba7f9(_0x5804d5);});});});};exports['stop']=function(_0x1011aa){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x3b2dc8,_0xb265d5){return pm2[_0x8f67('0x3')](_0x1011aa,function(_0x2056d7,_0x54ec1b){if(_0x2056d7){return _0xb265d5(_0x2056d7);}pm2['disconnect']();return _0x3b2dc8(_0x54ec1b);});});});};exports[_0x8f67('0x4')]=function(_0x43e743){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x246643,_0x1fca5f){return pm2[_0x8f67('0x4')](_0x43e743,function(_0x70509e,_0x3a4fc4){if(_0x70509e){return _0x1fca5f(_0x70509e);}pm2['disconnect']();return _0x246643(_0x3a4fc4);});});});};exports[_0x8f67('0x5')]=function(){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x123642,_0x1e47bf){return pm2['list'](function(_0x47903f,_0x268d32){if(_0x47903f){return _0x1e47bf(_0x47903f);}pm2[_0x8f67('0x6')]();return _0x123642(_0x268d32);});});});};exports[_0x8f67('0x7')]=function(_0x236de9){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x1c4289,_0x44fdb4){return pm2[_0x8f67('0x7')](_0x236de9,function(_0x3bfe61,_0x4bdb0d){if(_0x3bfe61){return _0x44fdb4(_0x3bfe61);}pm2['disconnect']();return _0x1c4289(_0x4bdb0d);});});});};exports['delete']=function(_0x413a73){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x28e009,_0xec55c4){return pm2[_0x8f67('0x8')](_0x413a73,function(_0x4b7475,_0x9d18d){if(_0x4b7475){return _0xec55c4(_0x4b7475);}pm2[_0x8f67('0x6')]();return _0x28e009(_0x9d18d);});});});};exports[_0x8f67('0x9')]=function(){return connect()[_0x8f67('0x2')](function(){return new BPromise(function(_0x25fd1a,_0x5b7a45){return pm2[_0x8f67('0x9')](function(_0x15d3af){if(_0x15d3af){return _0x5b7a45(_0x15d3af);}return _0x25fd1a(_0x8f67('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ca42e41..c9b4904 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 _0xa033=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','info'];(function(_0x2e7ffc,_0x31b2ee){var _0x41e9a4=function(_0x32fb1d){while(--_0x32fb1d){_0x2e7ffc['push'](_0x2e7ffc['shift']());}};_0x41e9a4(++_0x31b2ee);}(_0xa033,0x1e4));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a03('0x0'));var moment=require(_0x3a03('0x1'));var Redis=require(_0x3a03('0x2'));var util=require(_0x3a03('0x3'));var config=require(_0x3a03('0x4'));var db=require(_0x3a03('0x5'))['db'];var logger=require(_0x3a03('0x6'))('schedule');config['redis']=_[_0x3a03('0x7')](config['redis'],{'host':_0x3a03('0x8'),'port':0x18eb});var io=require(_0x3a03('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4f6dd0=0x0;var _0x1ec59a=[];return db[_0x3a03('0xa')][_0x3a03('0xb')]({'raw':!![],'attributes':['id',_0x3a03('0xc')],'where':{'id':0x1}})[_0x3a03('0xd')](function(_0x328cb1){_0x4f6dd0=_0x328cb1[_0x3a03('0xc')];if(_0x4f6dd0){return db[_0x3a03('0xe')][_0x3a03('0xf')]({'raw':!![],'attributes':['id',_0x3a03('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3a03('0x11')](_0x328cb1[_0x3a03('0xc')],_0x3a03('0x12'))}}});}else{return[];}})[_0x3a03('0xd')](function(_0x459b5d){if(_0x459b5d&&_0x459b5d['length']){_0x1ec59a=_['map'](_0x459b5d||[],'id');logger[_0x3a03('0x13')](_0x3a03('0x14'),_0x1ec59a[_0x3a03('0x15')]());return db[_0x3a03('0xe')][_0x3a03('0x16')]({'closeReason':_0x3a03('0x17'),'disposition':_0x3a03('0x18'),'closed':!![],'closedAt':moment()[_0x3a03('0x19')](_0x3a03('0x1a'))},{'where':{'id':_0x1ec59a}});}})[_0x3a03('0xd')](function(){if(_0x1ec59a&&_0x1ec59a[_0x3a03('0x1b')]){logger[_0x3a03('0x13')](_0x3a03('0x1c'),_0x1ec59a[_0x3a03('0x15')]());for(var _0x1d77d5=0x0;_0x1d77d5<_0x1ec59a['length'];_0x1d77d5++){io[_0x3a03('0x1d')](_0x3a03('0x1e'),{'id':_0x1ec59a[_0x1d77d5],'closed':!![]});}}})[_0x3a03('0x1f')](function(_0x53d44d){logger[_0x3a03('0x20')](_0x3a03('0x21'),_0x53d44d?util[_0x3a03('0x22')](_0x53d44d,{'showHidden':![],'depth':null}):'');});}exports[_0x3a03('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xeaa7=['localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','info','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xeaa7,0x137));var _0x7eaa=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xeaa7[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x7eaa('0x0'));var moment=require(_0x7eaa('0x1'));var Redis=require(_0x7eaa('0x2'));var util=require(_0x7eaa('0x3'));var config=require(_0x7eaa('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x7eaa('0x5'))(_0x7eaa('0x6'));config[_0x7eaa('0x7')]=_[_0x7eaa('0x8')](config[_0x7eaa('0x7')],{'host':_0x7eaa('0x9'),'port':0x18eb});var io=require(_0x7eaa('0xa'))(new Redis(config[_0x7eaa('0x7')]));function closeInteractions(){var _0x4a7aa6=0x0;var _0x434e21=[];return db[_0x7eaa('0xb')]['find']({'raw':!![],'attributes':['id',_0x7eaa('0xc')],'where':{'id':0x1}})['then'](function(_0x5625e9){_0x4a7aa6=_0x5625e9[_0x7eaa('0xc')];if(_0x4a7aa6){return db[_0x7eaa('0xd')][_0x7eaa('0xe')]({'raw':!![],'attributes':['id',_0x7eaa('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7eaa('0x10')](_0x5625e9[_0x7eaa('0xc')],_0x7eaa('0x11'))}}});}else{return[];}})[_0x7eaa('0x12')](function(_0x30e018){if(_0x30e018&&_0x30e018[_0x7eaa('0x13')]){_0x434e21=_[_0x7eaa('0x14')](_0x30e018||[],'id');logger['info'](_0x7eaa('0x15'),_0x434e21[_0x7eaa('0x16')]());return db[_0x7eaa('0xd')][_0x7eaa('0x17')]({'closeReason':_0x7eaa('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x7eaa('0x19'))},{'where':{'id':_0x434e21}});}})[_0x7eaa('0x12')](function(){if(_0x434e21&&_0x434e21['length']){logger[_0x7eaa('0x1a')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x434e21[_0x7eaa('0x16')]());for(var _0x672009=0x0;_0x672009<_0x434e21[_0x7eaa('0x13')];_0x672009++){io[_0x7eaa('0x1b')](_0x7eaa('0x1c'),{'id':_0x434e21[_0x672009],'closed':!![]});}}})['catch'](function(_0x161ef8){logger['error'](_0x7eaa('0x1d'),_0x161ef8?util[_0x7eaa('0x1e')](_0x161ef8,{'showHidden':![],'depth':null}):'');});}exports[_0x7eaa('0x1f')]=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 04ccfdd..338486b 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 _0x81cf=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x81cf,0x1e2));var _0xf81c=function(_0x2bd03e,_0x5ba25d){_0x2bd03e=_0x2bd03e-0x0;var _0x4d0f96=_0x81cf[_0x2bd03e];return _0x4d0f96;};'use strict';function start(){var _0x47b663=require(_0xf81c('0x0'));return _0x47b663[_0xf81c('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x144f=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0xe540c0,_0x2d98e5){var _0x130549=function(_0x4cfd79){while(--_0x4cfd79){_0xe540c0['push'](_0xe540c0['shift']());}};_0x130549(++_0x2d98e5);}(_0x144f,0x169));var _0xf144=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x144f[_0x39e283];return _0x7de89f;};'use strict';function start(){var _0x5ade95=require(_0xf144('0x0'));return _0x5ade95[_0xf144('0x1')]();}module[_0xf144('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index cc23809..1588b75 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 _0x1eaa=['sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','then','no\x20report\x20id','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','stop','stop\x20cron','update\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x1eaa,0x86));var _0xa1ea=function(_0x1ba920,_0x4fdeba){_0x1ba920=_0x1ba920-0x0;var _0xdae151=_0x1eaa[_0x1ba920];return _0xdae151;};'use strict';var fs=require('fs');var util=require(_0xa1ea('0x0'));var path=require(_0xa1ea('0x1'));var _=require(_0xa1ea('0x2'));var moment=require(_0xa1ea('0x3'));var CronJobManager=require(_0xa1ea('0x4'));var jayson=require(_0xa1ea('0x5'));var BPromise=require(_0xa1ea('0x6'));var logger=require(_0xa1ea('0x7'))(_0xa1ea('0x8'));var db=require(_0xa1ea('0x9'))['db'];var analyticCustomReportController=require(_0xa1ea('0xa'));var analyticDefaultReportController=require(_0xa1ea('0xb'));var client=jayson['client'][_0xa1ea('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3cab52,_0x357e8d){return function(){logger[_0xa1ea('0xd')](_0xa1ea('0xe'),_0x3cab52[_0xa1ea('0xf')]);var _0x346e01=!![];var _0x37a620=_0x3cab52[_0xa1ea('0x10')]['getSmtpOptions']();var _0x5dadfc={'account':_0x37a620,'message':{'from':util[_0xa1ea('0x11')](_0xa1ea('0x12'),_0x3cab52[_0xa1ea('0x10')]['name'],_0x3cab52[_0xa1ea('0x10')][_0xa1ea('0xf')]||_0x3cab52[_0xa1ea('0x10')][_0xa1ea('0x13')][_0xa1ea('0x14')]),'to':_0x3cab52['email'],'cc':_0x3cab52['cc'],'bcc':_0x3cab52[_0xa1ea('0x15')],'subject':util[_0xa1ea('0x11')](_0xa1ea('0x16'),_0x357e8d[_0xa1ea('0x17')],_0x3cab52[_0xa1ea('0x18')],_0x3cab52[_0xa1ea('0x19')])}};var _0x28842c=path[_0xa1ea('0x1a')](__dirname,_0xa1ea('0x1b'));var _0x1f4d5f=_0x357e8d['savename'];var _0x391d85=util[_0xa1ea('0x11')](_0xa1ea('0x1c'),path['basename'](_0x357e8d[_0xa1ea('0x1d')],path[_0xa1ea('0x1e')](_0x357e8d['savename'])),_0xa1ea('0x1f'));var _0x1e7bc9=path[_0xa1ea('0x1a')](_0x28842c,_0x1f4d5f);var _0x83ab4=path['join'](_0x28842c,_0x391d85);if(fs[_0xa1ea('0x20')](_0x1e7bc9)){_0x357e8d[_0xa1ea('0x21')]=_0xa1ea('0x22');_0x5dadfc[_0xa1ea('0x23')][_0xa1ea('0x24')]=[{'filename':_0x1f4d5f,'path':_0x1e7bc9}];_0x5dadfc['message']['text']=util[_0xa1ea('0x11')](_0xa1ea('0x25'),JSON['stringify'](_0x357e8d,null,0x2));}else if(fs[_0xa1ea('0x20')](_0x83ab4)){_0x357e8d[_0xa1ea('0x21')]=_0xa1ea('0x22');_0x5dadfc[_0xa1ea('0x23')][_0xa1ea('0x24')]=[{'filename':_0x391d85,'path':_0x83ab4}];}else{_0x5dadfc[_0xa1ea('0x23')][_0xa1ea('0x26')]=_0xa1ea('0x27');if(!_0x3cab52[_0xa1ea('0x28')]){_0x346e01=![];logger['info'](_0xa1ea('0x29'));}}if(_0x346e01){return client[_0xa1ea('0x2a')](_0xa1ea('0x2b'),_0x5dadfc)['then'](function(_0x5b3570){if(_0x5b3570[_0xa1ea('0x2c')]){return logger[_0xa1ea('0x2c')](_0xa1ea('0x2d'),JSON[_0xa1ea('0x2e')](_0x5b3570));}return logger[_0xa1ea('0xd')](_0xa1ea('0x2f'));})[_0xa1ea('0x30')](function(_0x4885dd){return logger[_0xa1ea('0x2c')](_0xa1ea('0x2d'),JSON['stringify'](_0x4885dd));});}};}function handleError(){return function(_0x36ceea){return logger[_0xa1ea('0x2c')](JSON[_0xa1ea('0x2e')](_0x36ceea));};}function handleResult(_0x256358){return function(_0xbe530){logger[_0xa1ea('0xd')](_0xa1ea('0x31'),JSON[_0xa1ea('0x2e')](_0xbe530));if(_0x256358[_0xa1ea('0x10')]&&_0x256358[_0xa1ea('0x10')][_0xa1ea('0x13')]&&!_[_0xa1ea('0x32')](_0x256358[_0xa1ea('0xf')])){setTimeout(handleSendEmail(_0x256358,_0xbe530),0x3c*0x3e8);}};}function handleJob(_0x343404){return function(){try{if(_[_0xa1ea('0x32')](_0x343404[_0xa1ea('0x18')])){return logger[_0xa1ea('0xd')](_0xa1ea('0x33'));}if(_[_0xa1ea('0x32')](_0x343404[_0xa1ea('0x19')])){return logger['info'](_0xa1ea('0x34'));}var _0x24a499={'startDate':moment()[_0xa1ea('0x35')](_0x343404[_0xa1ea('0x18')],_0x343404[_0xa1ea('0x19')])[_0xa1ea('0x11')](_0xa1ea('0x36')),'endDate':moment()[_0xa1ea('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x343404[_0xa1ea('0x37')],'name':_0x343404[_0xa1ea('0x17')]};if(!_['isNil'](_0x343404[_0xa1ea('0x38')])){logger[_0xa1ea('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x343404[_0xa1ea('0x38')]);return analyticDefaultReportController[_0xa1ea('0x39')]({'id':_0x343404[_0xa1ea('0x38')]},_0x24a499)['then'](handleResult(_0x343404))[_0xa1ea('0x30')](handleError());}if(!_[_0xa1ea('0x32')](_0x343404['CustomReportId'])){logger['info'](_0xa1ea('0x3a'),_0x343404[_0xa1ea('0x3b')]);return analyticCustomReportController[_0xa1ea('0x39')]({'id':_0x343404[_0xa1ea('0x3b')]},_0x24a499)[_0xa1ea('0x3c')](handleResult(_0x343404))[_0xa1ea('0x30')](handleError());}}catch(_0x375cf1){logger[_0xa1ea('0x2c')](JSON[_0xa1ea('0x2e')](_0x375cf1));}return logger[_0xa1ea('0xd')](_0xa1ea('0x3d'));};}function getJobs(_0x4e03eb){var _0x38f7ce={};if(_0x4e03eb){_0x38f7ce['id']=_0x4e03eb;}return db['Schedule']['findAll']({'where':_0x38f7ce,'include':[{'model':db[_0xa1ea('0x10')],'attributes':['id','name','email'],'include':[{'model':db[_0xa1ea('0x3e')],'as':_0xa1ea('0x13'),'include':[{'model':db[_0xa1ea('0x3f')],'as':_0xa1ea('0x3f')}]}]}]})[_0xa1ea('0x3c')](function(_0x1521aa){var _0x3bb389=_[_0xa1ea('0x40')](manager['jobs']);var _0x3258bf=_[_0xa1ea('0x41')](_0x1521aa,function(_0xfba71d){return _0xfba71d['id']['toString']();});var _0xd7d87a=_[_0xa1ea('0x42')](_0x1521aa,function(_0x210339){return _0x210339['id'][_0xa1ea('0x43')]();});var _0x5f29d9=_0x4e03eb?_0x3258bf:_[_0xa1ea('0x44')](_0x3258bf,_0x3bb389);var _0x31e457=_[_0xa1ea('0x45')](_0x3258bf,_0x3bb389);var _0x15f227=_[_0xa1ea('0x44')](_0x3bb389,_0x3258bf);var _0x2fe2ca;var _0x3f2f43;for(_0x2fe2ca=0x0;_0x2fe2ca<_0x15f227[_0xa1ea('0x46')]&&!_0x4e03eb;_0x2fe2ca+=0x1){_0x3f2f43=_0x15f227[_0x2fe2ca][_0xa1ea('0x43')]();if(manager[_0xa1ea('0x47')](_0x3f2f43)){manager['stop'](_0x3f2f43);manager[_0xa1ea('0x48')](_0x3f2f43);logger['info'](_0xa1ea('0x49'),_0x3f2f43);}}logger[_0xa1ea('0xd')](_0xa1ea('0x4a'),JSON[_0xa1ea('0x2e')](_0x5f29d9));for(_0x2fe2ca=0x0;_0x2fe2ca<_0x5f29d9[_0xa1ea('0x46')];_0x2fe2ca+=0x1){_0x3f2f43=_0x5f29d9[_0x2fe2ca]['toString']();logger[_0xa1ea('0xd')](_0xa1ea('0x4b'),_0x3f2f43);if(_0x4e03eb){logger[_0xa1ea('0xd')]('my\x20id',_0x4e03eb);logger['info'](JSON[_0xa1ea('0x2e')](_0xd7d87a[_0x3f2f43]));BPromise[_0xa1ea('0x4c')]()[_0xa1ea('0x3c')](handleJob(_0xd7d87a[_0x3f2f43]));logger[_0xa1ea('0xd')](_0xa1ea('0x4d'),_0xd7d87a[_0x3f2f43][_0xa1ea('0x17')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]);}else if(_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]&&_0xd7d87a[_0x3f2f43][_0xa1ea('0x4f')]&&moment()[_0xa1ea('0x50')](_0xd7d87a[_0x3f2f43][_0xa1ea('0x51')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x52')])){manager[_0xa1ea('0x53')](_0x3f2f43,_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')],handleJob(_0xd7d87a[_0x3f2f43]));manager['start'](_0x3f2f43);logger[_0xa1ea('0xd')]('add\x20cron',_0xd7d87a[_0x3f2f43][_0xa1ea('0x17')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]);}else if(manager[_0xa1ea('0x47')](_0x3f2f43)){manager[_0xa1ea('0x54')](_0x3f2f43);manager[_0xa1ea('0x48')](_0x3f2f43);logger['info'](_0xa1ea('0x55'),_0xd7d87a[_0x3f2f43][_0xa1ea('0x17')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]);}}for(_0x2fe2ca=0x0,_0x3f2f43;_0x2fe2ca<_0x31e457[_0xa1ea('0x46')]&&!_0x4e03eb;_0x2fe2ca+=0x1){_0x3f2f43=_0x31e457[_0x2fe2ca][_0xa1ea('0x43')]();if(manager['exists'](_0x3f2f43)){if(_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]&&_0xd7d87a[_0x3f2f43][_0xa1ea('0x4f')]&&moment()[_0xa1ea('0x50')](_0xd7d87a[_0x3f2f43][_0xa1ea('0x51')],_0xd7d87a[_0x3f2f43]['endAt'])){manager['update'](_0x3f2f43,_0xd7d87a[_0x3f2f43]['cron'],handleJob(_0xd7d87a[_0x3f2f43]));logger[_0xa1ea('0xd')](_0xa1ea('0x56'),_0xd7d87a[_0x3f2f43][_0xa1ea('0x17')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]);}else{manager[_0xa1ea('0x54')](_0x3f2f43);manager[_0xa1ea('0x48')](_0x3f2f43);logger[_0xa1ea('0xd')]('stop\x20cron',_0xd7d87a[_0x3f2f43][_0xa1ea('0x17')],_0xd7d87a[_0x3f2f43][_0xa1ea('0x4e')]);}}}})['catch'](function(_0x477cbd){logger[_0xa1ea('0x2c')](JSON[_0xa1ea('0x2e')](_0x477cbd));});}exports['run']=function(_0x20b59b){return getJobs(_0x20b59b);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8af4=['startAt','endAt','add','start','stop','isBetween','update','update\x20cron','stop\x20cron','run','util','lodash','moment','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','status','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','index','resolve','run\x20job','cron'];(function(_0x208ee7,_0x470620){var _0x3c28ed=function(_0x3e26c0){while(--_0x3e26c0){_0x208ee7['push'](_0x208ee7['shift']());}};_0x3c28ed(++_0x470620);}(_0x8af4,0x103));var _0x48af=function(_0x56f972,_0x49b459){_0x56f972=_0x56f972-0x0;var _0xf415ef=_0x8af4[_0x56f972];return _0xf415ef;};'use strict';var fs=require('fs');var util=require(_0x48af('0x0'));var path=require('path');var _=require(_0x48af('0x1'));var moment=require(_0x48af('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x48af('0x3'));var BPromise=require(_0x48af('0x4'));var logger=require('../logger')(_0x48af('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x48af('0x6'));var analyticDefaultReportController=require(_0x48af('0x7'));var client=jayson[_0x48af('0x8')][_0x48af('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x54e92a,_0x28a6ac){return function(){logger[_0x48af('0xa')](_0x48af('0xb'),_0x54e92a[_0x48af('0xc')]);var _0x5a658e=!![];var _0x58ef47=_0x54e92a['MailAccount'][_0x48af('0xd')]();var _0x443cb6={'account':_0x58ef47,'message':{'from':util[_0x48af('0xe')](_0x48af('0xf'),_0x54e92a[_0x48af('0x10')]['name'],_0x54e92a[_0x48af('0x10')][_0x48af('0xc')]||_0x54e92a[_0x48af('0x10')][_0x48af('0x11')][_0x48af('0x12')]),'to':_0x54e92a[_0x48af('0xc')],'cc':_0x54e92a['cc'],'bcc':_0x54e92a['bcc'],'subject':util[_0x48af('0xe')](_0x48af('0x13'),_0x28a6ac[_0x48af('0x14')],_0x54e92a[_0x48af('0x15')],_0x54e92a[_0x48af('0x16')])}};var _0x56c287=path[_0x48af('0x17')](__dirname,_0x48af('0x18'));var _0x517dd1=_0x28a6ac[_0x48af('0x19')];var _0x2e2038=util[_0x48af('0xe')](_0x48af('0x1a'),path[_0x48af('0x1b')](_0x28a6ac[_0x48af('0x19')],path['extname'](_0x28a6ac[_0x48af('0x19')])),'zip');var _0x54ecef=path['join'](_0x56c287,_0x517dd1);var _0x4fb128=path[_0x48af('0x17')](_0x56c287,_0x2e2038);if(fs['existsSync'](_0x54ecef)){_0x28a6ac[_0x48af('0x1c')]='Sent';_0x443cb6['message'][_0x48af('0x1d')]=[{'filename':_0x517dd1,'path':_0x54ecef}];_0x443cb6[_0x48af('0x1e')][_0x48af('0x1f')]=util[_0x48af('0xe')](_0x48af('0x20'),JSON[_0x48af('0x21')](_0x28a6ac,null,0x2));}else if(fs[_0x48af('0x22')](_0x4fb128)){_0x28a6ac[_0x48af('0x1c')]=_0x48af('0x23');_0x443cb6[_0x48af('0x1e')][_0x48af('0x1d')]=[{'filename':_0x2e2038,'path':_0x4fb128}];}else{_0x443cb6['message']['text']=_0x48af('0x24');if(!_0x54e92a['sendIfEmpty']){_0x5a658e=![];logger[_0x48af('0xa')](_0x48af('0x25'));}}if(_0x5a658e){return client[_0x48af('0x26')](_0x48af('0x27'),_0x443cb6)[_0x48af('0x28')](function(_0x50259a){if(_0x50259a['error']){return logger[_0x48af('0x29')](_0x48af('0x2a'),JSON['stringify'](_0x50259a));}return logger['info'](_0x48af('0x2b'));})['catch'](function(_0x19883b){return logger[_0x48af('0x29')](_0x48af('0x2a'),JSON['stringify'](_0x19883b));});}};}function handleError(){return function(_0x3cd014){return logger['error'](JSON[_0x48af('0x21')](_0x3cd014));};}function handleResult(_0x2521b6){return function(_0x367e23){logger[_0x48af('0xa')]('data',JSON[_0x48af('0x21')](_0x367e23));if(_0x2521b6[_0x48af('0x10')]&&_0x2521b6[_0x48af('0x10')][_0x48af('0x11')]&&!_[_0x48af('0x2c')](_0x2521b6[_0x48af('0xc')])){setTimeout(handleSendEmail(_0x2521b6,_0x367e23),0x3c*0x3e8);}};}function handleJob(_0x57247f){return function(){try{if(_['isNil'](_0x57247f[_0x48af('0x15')])){return logger[_0x48af('0xa')](_0x48af('0x2d'));}if(_['isNil'](_0x57247f[_0x48af('0x16')])){return logger[_0x48af('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1a01a5={'startDate':moment()[_0x48af('0x2e')](_0x57247f[_0x48af('0x15')],_0x57247f[_0x48af('0x16')])[_0x48af('0xe')](_0x48af('0x2f')),'endDate':moment()[_0x48af('0xe')](_0x48af('0x2f')),'type':_0x48af('0x30'),'output':_0x57247f['output'],'name':_0x57247f[_0x48af('0x14')]};if(!_[_0x48af('0x2c')](_0x57247f[_0x48af('0x31')])){logger[_0x48af('0xa')](_0x48af('0x32'),_0x57247f[_0x48af('0x31')]);return analyticDefaultReportController[_0x48af('0x33')]({'id':_0x57247f[_0x48af('0x31')]},_0x1a01a5)['then'](handleResult(_0x57247f))[_0x48af('0x34')](handleError());}if(!_[_0x48af('0x2c')](_0x57247f[_0x48af('0x35')])){logger[_0x48af('0xa')](_0x48af('0x36'),_0x57247f[_0x48af('0x35')]);return analyticCustomReportController['runReport']({'id':_0x57247f[_0x48af('0x35')]},_0x1a01a5)['then'](handleResult(_0x57247f))[_0x48af('0x34')](handleError());}}catch(_0x3b043d){logger['error'](JSON['stringify'](_0x3b043d));}return logger[_0x48af('0xa')](_0x48af('0x37'));};}function getJobs(_0x9161e2){var _0x414f64={};if(_0x9161e2){_0x414f64['id']=_0x9161e2;}return db[_0x48af('0x38')][_0x48af('0x39')]({'where':_0x414f64,'include':[{'model':db['MailAccount'],'attributes':['id',_0x48af('0x14'),_0x48af('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x48af('0x11'),'include':[{'model':db[_0x48af('0x3a')],'as':_0x48af('0x3a')}]}]}]})[_0x48af('0x28')](function(_0xb4d72d){var _0x4c566e=_[_0x48af('0x3b')](manager[_0x48af('0x3c')]);var _0x438625=_[_0x48af('0x3d')](_0xb4d72d,function(_0x55a36e){return _0x55a36e['id'][_0x48af('0x3e')]();});var _0x5710f0=_[_0x48af('0x3f')](_0xb4d72d,function(_0x4e77a2){return _0x4e77a2['id'][_0x48af('0x3e')]();});var _0x3fe307=_0x9161e2?_0x438625:_['difference'](_0x438625,_0x4c566e);var _0x1d0d22=_['intersection'](_0x438625,_0x4c566e);var _0x532d39=_[_0x48af('0x40')](_0x4c566e,_0x438625);var _0x2105ff;var _0x5ee4c8;for(_0x2105ff=0x0;_0x2105ff<_0x532d39[_0x48af('0x41')]&&!_0x9161e2;_0x2105ff+=0x1){_0x5ee4c8=_0x532d39[_0x2105ff][_0x48af('0x3e')]();if(manager[_0x48af('0x42')](_0x5ee4c8)){manager['stop'](_0x5ee4c8);manager[_0x48af('0x43')](_0x5ee4c8);logger['info'](_0x48af('0x44'),_0x5ee4c8);}}logger[_0x48af('0xa')]('toRun',JSON[_0x48af('0x21')](_0x3fe307));for(_0x2105ff=0x0;_0x2105ff<_0x3fe307['length'];_0x2105ff+=0x1){_0x5ee4c8=_0x3fe307[_0x2105ff][_0x48af('0x3e')]();logger[_0x48af('0xa')](_0x48af('0x45'),_0x5ee4c8);if(_0x9161e2){logger[_0x48af('0xa')]('my\x20id',_0x9161e2);logger[_0x48af('0xa')](JSON[_0x48af('0x21')](_0x5710f0[_0x5ee4c8]));BPromise[_0x48af('0x46')]()['then'](handleJob(_0x5710f0[_0x5ee4c8]));logger[_0x48af('0xa')](_0x48af('0x47'),_0x5710f0[_0x5ee4c8][_0x48af('0x14')],_0x5710f0[_0x5ee4c8][_0x48af('0x48')]);}else if(_0x5710f0[_0x5ee4c8]['cron']&&_0x5710f0[_0x5ee4c8]['active']&&moment()['isBetween'](_0x5710f0[_0x5ee4c8][_0x48af('0x49')],_0x5710f0[_0x5ee4c8][_0x48af('0x4a')])){manager[_0x48af('0x4b')](_0x5ee4c8,_0x5710f0[_0x5ee4c8][_0x48af('0x48')],handleJob(_0x5710f0[_0x5ee4c8]));manager[_0x48af('0x4c')](_0x5ee4c8);logger[_0x48af('0xa')]('add\x20cron',_0x5710f0[_0x5ee4c8][_0x48af('0x14')],_0x5710f0[_0x5ee4c8][_0x48af('0x48')]);}else if(manager[_0x48af('0x42')](_0x5ee4c8)){manager[_0x48af('0x4d')](_0x5ee4c8);manager[_0x48af('0x43')](_0x5ee4c8);logger[_0x48af('0xa')]('stop\x20cron',_0x5710f0[_0x5ee4c8][_0x48af('0x14')],_0x5710f0[_0x5ee4c8][_0x48af('0x48')]);}}for(_0x2105ff=0x0,_0x5ee4c8;_0x2105ff<_0x1d0d22[_0x48af('0x41')]&&!_0x9161e2;_0x2105ff+=0x1){_0x5ee4c8=_0x1d0d22[_0x2105ff][_0x48af('0x3e')]();if(manager[_0x48af('0x42')](_0x5ee4c8)){if(_0x5710f0[_0x5ee4c8][_0x48af('0x48')]&&_0x5710f0[_0x5ee4c8]['active']&&moment()[_0x48af('0x4e')](_0x5710f0[_0x5ee4c8][_0x48af('0x49')],_0x5710f0[_0x5ee4c8][_0x48af('0x4a')])){manager[_0x48af('0x4f')](_0x5ee4c8,_0x5710f0[_0x5ee4c8][_0x48af('0x48')],handleJob(_0x5710f0[_0x5ee4c8]));logger[_0x48af('0xa')](_0x48af('0x50'),_0x5710f0[_0x5ee4c8][_0x48af('0x14')],_0x5710f0[_0x5ee4c8][_0x48af('0x48')]);}else{manager['stop'](_0x5ee4c8);manager[_0x48af('0x43')](_0x5ee4c8);logger[_0x48af('0xa')](_0x48af('0x51'),_0x5710f0[_0x5ee4c8][_0x48af('0x14')],_0x5710f0[_0x5ee4c8][_0x48af('0x48')]);}}}})[_0x48af('0x34')](function(_0x5e8678){logger[_0x48af('0x29')](JSON[_0x48af('0x21')](_0x5e8678));});}exports[_0x48af('0x52')]=function(_0x569223){return getJobs(_0x569223);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 1f6e405..ccb4f21 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 _0x2f68=['No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','SequelizeValidationError','start','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll'];(function(_0x56d826,_0x1b6540){var _0x282f3d=function(_0x1fe820){while(--_0x1fe820){_0x56d826['push'](_0x56d826['shift']());}};_0x282f3d(++_0x1b6540);}(_0x2f68,0x9a));var _0x82f6=function(_0x3c0b53,_0x36a14b){_0x3c0b53=_0x3c0b53-0x0;var _0x4ca2f2=_0x2f68[_0x3c0b53];return _0x4ca2f2;};var _=require('lodash');var AWS=require(_0x82f6('0x0'));var rp=require(_0x82f6('0x1'));var util=require(_0x82f6('0x2'));var BPromise=require(_0x82f6('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x82f6('0x4'))('transcribe');function getTranscriptionJob(_0x2a06dc,_0x2ab73d,_0x5dad09,_0x3ad120){return new Promise(function(_0x2c4302,_0x542737){var _0x5a8089=new AWS[(_0x82f6('0x5'))]({'accessKeyId':_0x2ab73d,'secretAccessKey':_0x2a06dc,'region':_0x5dad09});_0x5a8089['getTranscriptionJob']({'TranscriptionJobName':_0x3ad120},function(_0x5daa3c,_0x864400){if(_0x5daa3c){return _0x542737(_0x5daa3c);}else{return _0x2c4302(_0x864400);}});});}function sentiment(_0xbd30d5,_0x250d71,_0x5ee0e5,_0x27db58,_0x432289){return new Promise(function(_0x4e7c12,_0x1cf88e){var _0x1eec2f=new AWS[(_0x82f6('0x6'))]({'accessKeyId':_0x250d71,'secretAccessKey':_0xbd30d5,'region':_0x5ee0e5});_0x1eec2f[_0x82f6('0x7')]({'Text':_0x27db58,'LanguageCode':_0x432289[_0x82f6('0x8')](0x0,0x2)},function(_0x34bd7c,_0x4c870e){if(_0x34bd7c){return _0x1cf88e(_0x34bd7c);}else{return _0x4e7c12(_0x4c870e);}});});}function checkTranscribeJob(_0x12c5bc,_0x442262,_0x4cc967){var _0x194da7;return new BPromise(function(_0x1f8bf5,_0x397527){logger[_0x82f6('0x9')](util[_0x82f6('0xa')](_0x82f6('0xb'),_0x12c5bc['id'],_0x12c5bc[_0x82f6('0xc')]));return getTranscriptionJob(_0x4cc967[_0x82f6('0xd')],_0x4cc967[_0x82f6('0xe')],_0x442262['transcribeRegion'],_0x12c5bc[_0x82f6('0xc')])['then'](function(_0x249222){logger[_0x82f6('0x9')](util[_0x82f6('0xa')](_0x82f6('0xf'),_0x12c5bc['id'],_0x12c5bc[_0x82f6('0xc')],_0x249222[_0x82f6('0x10')][_0x82f6('0x11')]));if(!_0x12c5bc[_0x82f6('0x12')]){switch(_0x249222[_0x82f6('0x10')][_0x82f6('0x11')]){case _0x82f6('0x13'):var _0x1d9091={'transcribeStatus':_0x249222[_0x82f6('0x10')][_0x82f6('0x11')],'fileUri':_0x249222[_0x82f6('0x10')]['Transcript'][_0x82f6('0x14')]};logger[_0x82f6('0x9')](util['format'](_0x82f6('0x15'),_0x12c5bc['id']));return rp({'uri':_0x249222[_0x82f6('0x10')][_0x82f6('0x16')][_0x82f6('0x14')],'json':!![]})['then'](function(_0xdc4dea){logger['info'](util[_0x82f6('0xa')](_0x82f6('0x17'),_0x12c5bc['id']));if(_0xdc4dea&&_0xdc4dea['results']&&_0xdc4dea['results'][_0x82f6('0x18')]&&_0xdc4dea[_0x82f6('0x19')]['transcripts']['length']){_0x1d9091[_0x82f6('0x12')]='';for(var _0x31face=0x0;_0x31face<_0xdc4dea['results'][_0x82f6('0x18')][_0x82f6('0x1a')];_0x31face++){_0x1d9091['fileText']+=_0xdc4dea['results'][_0x82f6('0x18')][_0x31face]['transcript']+'';}}return _0x12c5bc[_0x82f6('0x1b')](_0x1d9091);})[_0x82f6('0x1c')](function(){logger['info'](util[_0x82f6('0xa')](_0x82f6('0x1d'),_0x12c5bc['id']));if(!_0x12c5bc[_0x82f6('0x1e')]){throw new db[(_0x82f6('0x1f'))]['ValidationError'](_0x82f6('0x20'));}if(!_0x442262[_0x82f6('0x21')]||!_0x442262[_0x82f6('0x22')]||!_0x442262[_0x82f6('0x23')]||!_0x442262[_0x82f6('0x24')]||!_0x442262[_0x82f6('0x25')]){throw new db[(_0x82f6('0x1f'))][(_0x82f6('0x26'))](_0x82f6('0x27'));}if(!_0x1d9091[_0x82f6('0x12')]){throw new Error(_0x82f6('0x28'));}if(_0x442262[_0x82f6('0x22')]===_0x4cc967['id']){return _0x4cc967;}else{return db[_0x82f6('0x29')][_0x82f6('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x82f6('0x1c')](function(_0x2c764f){if(!_0x2c764f){throw new db[(_0x82f6('0x1f'))]['ValidationError'](_0x82f6('0x2b'));}if(!_0x2c764f[_0x82f6('0xd')]||!_0x2c764f[_0x82f6('0xe')]){throw new db[(_0x82f6('0x1f'))][(_0x82f6('0x26'))](_0x82f6('0x2c'));}_0x194da7=_0x2c764f;logger[_0x82f6('0x9')](util[_0x82f6('0xa')](_0x82f6('0x2d'),_0x12c5bc['id']));return sentiment(_0x194da7[_0x82f6('0xd')],_0x194da7[_0x82f6('0xe')],_0x442262[_0x82f6('0x23')],_0x1d9091[_0x82f6('0x12')],_0x442262[_0x82f6('0x24')]);})['then'](function(_0x13a409){logger[_0x82f6('0x9')](util[_0x82f6('0xa')](_0x82f6('0x2e'),_0x12c5bc['id']));return _0x12c5bc[_0x82f6('0x1b')]({'sentiment':_0x13a409[_0x82f6('0x2f')],'sPositive':_0x13a409[_0x82f6('0x30')][_0x82f6('0x31')],'sNegative':_0x13a409[_0x82f6('0x30')][_0x82f6('0x32')],'sMixed':_0x13a409[_0x82f6('0x30')][_0x82f6('0x33')],'sNeutral':_0x13a409[_0x82f6('0x30')][_0x82f6('0x34')]});})['then'](function(){logger[_0x82f6('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x12c5bc['id']));_0x1f8bf5();});case _0x82f6('0x35'):return _0x12c5bc[_0x82f6('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x249222[_0x82f6('0x10')][_0x82f6('0x36')]})[_0x82f6('0x1c')](function(){logger['info'](util[_0x82f6('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x12c5bc['id']));_0x1f8bf5();});default:logger[_0x82f6('0x9')](util['format'](_0x82f6('0x37'),_0x12c5bc['id']));break;}}else{return BPromise['resolve']()[_0x82f6('0x1c')](function(){if(!_0x12c5bc[_0x82f6('0x1e')]){throw new db['Sequelize'][(_0x82f6('0x26'))](_0x82f6('0x20'));}if(!_0x442262[_0x82f6('0x21')]||!_0x442262[_0x82f6('0x22')]||!_0x442262['sentimentRegion']||!_0x442262[_0x82f6('0x24')]||!_0x442262[_0x82f6('0x25')]){throw new db[(_0x82f6('0x1f'))][(_0x82f6('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x12c5bc[_0x82f6('0x12')]){throw new Error(_0x82f6('0x28'));}if(_0x442262['sentimentAccountId']===_0x4cc967['id']){return _0x4cc967;}else{return db[_0x82f6('0x29')][_0x82f6('0x2a')]({'where':{'id':_settings[_0x82f6('0x22')]}});}})[_0x82f6('0x1c')](function(_0xc3e250){if(!_0xc3e250){throw new db['Sequelize'][(_0x82f6('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xc3e250[_0x82f6('0xd')]||!_0xc3e250[_0x82f6('0xe')]){throw new db[(_0x82f6('0x1f'))][(_0x82f6('0x26'))](_0x82f6('0x2c'));}_0x194da7=_0xc3e250;logger[_0x82f6('0x9')](util[_0x82f6('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x12c5bc['id']));return sentiment(_0x194da7[_0x82f6('0xd')],_0x194da7[_0x82f6('0xe')],_0x442262[_0x82f6('0x23')],_0x12c5bc[_0x82f6('0x12')],_0x442262['language']);})[_0x82f6('0x1c')](function(_0x4797af){logger[_0x82f6('0x9')](util[_0x82f6('0xa')](_0x82f6('0x2e'),_0x12c5bc['id']));return _0x12c5bc[_0x82f6('0x1b')]({'sentiment':_0x4797af[_0x82f6('0x2f')],'sPositive':_0x4797af[_0x82f6('0x30')]['Positive'],'sNegative':_0x4797af[_0x82f6('0x30')][_0x82f6('0x32')],'sMixed':_0x4797af[_0x82f6('0x30')][_0x82f6('0x33')],'sNeutral':_0x4797af[_0x82f6('0x30')][_0x82f6('0x34')],'transcribeStatus':_0x82f6('0x13')});})[_0x82f6('0x1c')](function(){logger['info'](util[_0x82f6('0xa')](_0x82f6('0x1d'),_0x12c5bc['id']));_0x1f8bf5();});}})['catch'](function(_0xfedf51){if(_0xfedf51){if(!_0xfedf51['name']||_0xfedf51[_0x82f6('0x38')]!=='SequelizeValidationError'){logger[_0x82f6('0x39')](util[_0x82f6('0xa')](_0x82f6('0x3a'),_0x12c5bc['id']),util[_0x82f6('0x3b')](_0xfedf51,{'showHidden':![],'depth':null}));}}_0x1f8bf5();});});}function checkTranscribe(){var _0x17a5ae;var _0x2fdcc6;var _0x53f7d4;return db[_0x82f6('0x3c')][_0x82f6('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3868cc){if(!_0x3868cc||!_0x3868cc[_0x82f6('0x1a')]){throw new db[(_0x82f6('0x1f'))]['ValidationError'](_0x82f6('0x3e'));}_0x17a5ae=_0x3868cc;return db[_0x82f6('0x3f')][_0x82f6('0x2a')]({'where':{'id':0x1}});})[_0x82f6('0x1c')](function(_0x4e9e13){if(!_0x4e9e13){throw new db['Sequelize'][(_0x82f6('0x26'))](_0x82f6('0x40'));}_0x2fdcc6=_0x4e9e13;if(!_0x2fdcc6[_0x82f6('0x41')]||!_0x2fdcc6['transcribeAccountId']||!_0x2fdcc6[_0x82f6('0x42')]||!_0x2fdcc6[_0x82f6('0x24')]||!_0x2fdcc6['bucket']){throw new db['Sequelize']['ValidationError'](_0x82f6('0x43'));}return db['CloudProvider'][_0x82f6('0x2a')]({'where':{'id':_0x2fdcc6['transcribeAccountId']}});})[_0x82f6('0x1c')](function(_0x4f69de){if(!_0x4f69de){throw new db[(_0x82f6('0x1f'))]['ValidationError'](_0x82f6('0x2b'));}if(!_0x4f69de[_0x82f6('0xd')]||!_0x4f69de[_0x82f6('0xe')]){throw new db[(_0x82f6('0x1f'))][(_0x82f6('0x26'))](_0x82f6('0x2c'));}_0x53f7d4=_0x4f69de;var _0x597844=[];_0x17a5ae[_0x82f6('0x44')](function(_0x1c8304){_0x597844[_0x82f6('0x45')](checkTranscribeJob(_0x1c8304,_0x2fdcc6,_0x53f7d4));});return BPromise['all'](_0x597844);})['catch'](function(_0x13406f){if(_0x13406f){if(!_0x13406f[_0x82f6('0x38')]||_0x13406f[_0x82f6('0x38')]!==_0x82f6('0x46')){logger['error'](util[_0x82f6('0x3b')](_0x13406f,{'showHidden':![],'depth':null}));}}});}exports[_0x82f6('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x659c=['Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','SequelizeValidationError','error','start','lodash','util','bluebird','../../config/logger','transcribe','TranscribeService'];(function(_0x3773fa,_0x14820a){var _0x15e765=function(_0x524e24){while(--_0x524e24){_0x3773fa['push'](_0x3773fa['shift']());}};_0x15e765(++_0x14820a);}(_0x659c,0x1aa));var _0xc659=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0x659c[_0x158e3b];return _0x551a1d;};var _=require(_0xc659('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xc659('0x1'));var BPromise=require(_0xc659('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc659('0x3'))(_0xc659('0x4'));function getTranscriptionJob(_0x4b3258,_0x5464e2,_0x162413,_0x18bbdf){return new Promise(function(_0x369dc0,_0x312440){var _0x15e20b=new AWS[(_0xc659('0x5'))]({'accessKeyId':_0x5464e2,'secretAccessKey':_0x4b3258,'region':_0x162413});_0x15e20b['getTranscriptionJob']({'TranscriptionJobName':_0x18bbdf},function(_0x51b67f,_0x2cc93d){if(_0x51b67f){return _0x312440(_0x51b67f);}else{return _0x369dc0(_0x2cc93d);}});});}function sentiment(_0x56885a,_0x5e8272,_0x4fadc2,_0x29a052,_0x2ea975){return new Promise(function(_0x422e00,_0x35a046){var _0x3f6f5a=new AWS[(_0xc659('0x6'))]({'accessKeyId':_0x5e8272,'secretAccessKey':_0x56885a,'region':_0x4fadc2});_0x3f6f5a[_0xc659('0x7')]({'Text':_0x29a052,'LanguageCode':_0x2ea975[_0xc659('0x8')](0x0,0x2)},function(_0x51cf76,_0x28e508){if(_0x51cf76){return _0x35a046(_0x51cf76);}else{return _0x422e00(_0x28e508);}});});}function checkTranscribeJob(_0x416ee0,_0x13e626,_0x4a2a9d){var _0x592f01;return new BPromise(function(_0xa6c74e,_0x33beaf){logger['info'](util[_0xc659('0x9')](_0xc659('0xa'),_0x416ee0['id'],_0x416ee0[_0xc659('0xb')]));return getTranscriptionJob(_0x4a2a9d[_0xc659('0xc')],_0x4a2a9d[_0xc659('0xd')],_0x13e626[_0xc659('0xe')],_0x416ee0[_0xc659('0xb')])[_0xc659('0xf')](function(_0x29bbef){logger[_0xc659('0x10')](util['format'](_0xc659('0x11'),_0x416ee0['id'],_0x416ee0[_0xc659('0xb')],_0x29bbef[_0xc659('0x12')][_0xc659('0x13')]));if(!_0x416ee0[_0xc659('0x14')]){switch(_0x29bbef[_0xc659('0x12')]['TranscriptionJobStatus']){case _0xc659('0x15'):var _0x33e118={'transcribeStatus':_0x29bbef[_0xc659('0x12')]['TranscriptionJobStatus'],'fileUri':_0x29bbef['TranscriptionJob'][_0xc659('0x16')][_0xc659('0x17')]};logger['info'](util[_0xc659('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x416ee0['id']));return rp({'uri':_0x29bbef['TranscriptionJob']['Transcript'][_0xc659('0x17')],'json':!![]})[_0xc659('0xf')](function(_0x3b3d95){logger[_0xc659('0x10')](util[_0xc659('0x9')](_0xc659('0x18'),_0x416ee0['id']));if(_0x3b3d95&&_0x3b3d95['results']&&_0x3b3d95['results']['transcripts']&&_0x3b3d95[_0xc659('0x19')][_0xc659('0x1a')]['length']){_0x33e118[_0xc659('0x14')]='';for(var _0x5db7cf=0x0;_0x5db7cf<_0x3b3d95[_0xc659('0x19')][_0xc659('0x1a')][_0xc659('0x1b')];_0x5db7cf++){_0x33e118[_0xc659('0x14')]+=_0x3b3d95[_0xc659('0x19')][_0xc659('0x1a')][_0x5db7cf][_0xc659('0x1c')]+'';}}return _0x416ee0[_0xc659('0x1d')](_0x33e118);})[_0xc659('0xf')](function(){logger[_0xc659('0x10')](util[_0xc659('0x9')](_0xc659('0x1e'),_0x416ee0['id']));if(!_0x416ee0['tempSentiment']){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x13e626['sentiment']||!_0x13e626[_0xc659('0x21')]||!_0x13e626[_0xc659('0x22')]||!_0x13e626[_0xc659('0x23')]||!_0x13e626[_0xc659('0x24')]){throw new db['Sequelize'][(_0xc659('0x20'))](_0xc659('0x25'));}if(!_0x33e118[_0xc659('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x13e626[_0xc659('0x21')]===_0x4a2a9d['id']){return _0x4a2a9d;}else{return db[_0xc659('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc659('0xf')](function(_0x4c7529){if(!_0x4c7529){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4c7529[_0xc659('0xc')]||!_0x4c7529[_0xc659('0xd')]){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x592f01=_0x4c7529;logger[_0xc659('0x10')](util[_0xc659('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x416ee0['id']));return sentiment(_0x592f01[_0xc659('0xc')],_0x592f01['data2'],_0x13e626[_0xc659('0x22')],_0x33e118['fileText'],_0x13e626[_0xc659('0x23')]);})['then'](function(_0x18b651){logger[_0xc659('0x10')](util[_0xc659('0x9')](_0xc659('0x27'),_0x416ee0['id']));return _0x416ee0[_0xc659('0x1d')]({'sentiment':_0x18b651[_0xc659('0x28')],'sPositive':_0x18b651[_0xc659('0x29')][_0xc659('0x2a')],'sNegative':_0x18b651[_0xc659('0x29')][_0xc659('0x2b')],'sMixed':_0x18b651['SentimentScore'][_0xc659('0x2c')],'sNeutral':_0x18b651[_0xc659('0x29')][_0xc659('0x2d')]});})[_0xc659('0xf')](function(){logger['info'](util[_0xc659('0x9')](_0xc659('0x1e'),_0x416ee0['id']));_0xa6c74e();});case _0xc659('0x2e'):return _0x416ee0[_0xc659('0x1d')]({'transcribeStatus':_0xc659('0x2e'),'failureReason':_0x29bbef[_0xc659('0x12')]['FailureReason']})['then'](function(){logger[_0xc659('0x10')](util[_0xc659('0x9')](_0xc659('0x1e'),_0x416ee0['id']));_0xa6c74e();});default:logger['info'](util[_0xc659('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x416ee0['id']));break;}}else{return BPromise['resolve']()[_0xc659('0xf')](function(){if(!_0x416ee0[_0xc659('0x2f')]){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))](_0xc659('0x30'));}if(!_0x13e626[_0xc659('0x31')]||!_0x13e626['sentimentAccountId']||!_0x13e626[_0xc659('0x22')]||!_0x13e626[_0xc659('0x23')]||!_0x13e626[_0xc659('0x24')]){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x416ee0[_0xc659('0x14')]){throw new Error(_0xc659('0x32'));}if(_0x13e626['sentimentAccountId']===_0x4a2a9d['id']){return _0x4a2a9d;}else{return db[_0xc659('0x26')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc659('0xf')](function(_0x571a40){if(!_0x571a40){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))](_0xc659('0x33'));}if(!_0x571a40[_0xc659('0xc')]||!_0x571a40[_0xc659('0xd')]){throw new db['Sequelize'][(_0xc659('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x592f01=_0x571a40;logger['info'](util['format'](_0xc659('0x34'),_0x416ee0['id']));return sentiment(_0x592f01[_0xc659('0xc')],_0x592f01[_0xc659('0xd')],_0x13e626[_0xc659('0x22')],_0x416ee0[_0xc659('0x14')],_0x13e626[_0xc659('0x23')]);})['then'](function(_0x2a53bf){logger[_0xc659('0x10')](util[_0xc659('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x416ee0['id']));return _0x416ee0[_0xc659('0x1d')]({'sentiment':_0x2a53bf[_0xc659('0x28')],'sPositive':_0x2a53bf[_0xc659('0x29')]['Positive'],'sNegative':_0x2a53bf[_0xc659('0x29')][_0xc659('0x2b')],'sMixed':_0x2a53bf[_0xc659('0x29')][_0xc659('0x2c')],'sNeutral':_0x2a53bf['SentimentScore'][_0xc659('0x2d')],'transcribeStatus':_0xc659('0x15')});})[_0xc659('0xf')](function(){logger[_0xc659('0x10')](util[_0xc659('0x9')](_0xc659('0x1e'),_0x416ee0['id']));_0xa6c74e();});}})[_0xc659('0x35')](function(_0x11e9f5){if(_0x11e9f5){if(!_0x11e9f5[_0xc659('0x36')]||_0x11e9f5[_0xc659('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0xc659('0x9')](_0xc659('0x37'),_0x416ee0['id']),util[_0xc659('0x38')](_0x11e9f5,{'showHidden':![],'depth':null}));}}_0xa6c74e();});});}function checkTranscribe(){var _0x3f81b7;var _0x39a393;var _0x3cd4e6;return db['VoiceRecording'][_0xc659('0x39')]({'where':{'transcribeStatus':_0xc659('0x3a')}})[_0xc659('0xf')](function(_0x3d1fb4){if(!_0x3d1fb4||!_0x3d1fb4['length']){throw new db[(_0xc659('0x1f'))]['ValidationError'](_0xc659('0x3b'));}_0x3f81b7=_0x3d1fb4;return db[_0xc659('0x3c')][_0xc659('0x3d')]({'where':{'id':0x1}});})[_0xc659('0xf')](function(_0x22efd6){if(!_0x22efd6){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))](_0xc659('0x3e'));}_0x39a393=_0x22efd6;if(!_0x39a393[_0xc659('0x4')]||!_0x39a393['transcribeAccountId']||!_0x39a393[_0xc659('0xe')]||!_0x39a393[_0xc659('0x23')]||!_0x39a393[_0xc659('0x24')]){throw new db['Sequelize'][(_0xc659('0x20'))](_0xc659('0x3f'));}return db[_0xc659('0x26')][_0xc659('0x3d')]({'where':{'id':_0x39a393[_0xc659('0x40')]}});})[_0xc659('0xf')](function(_0x2e64ec){if(!_0x2e64ec){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2e64ec[_0xc659('0xc')]||!_0x2e64ec['data2']){throw new db[(_0xc659('0x1f'))][(_0xc659('0x20'))](_0xc659('0x41'));}_0x3cd4e6=_0x2e64ec;var _0x708c07=[];_0x3f81b7[_0xc659('0x42')](function(_0x4381b6){_0x708c07[_0xc659('0x43')](checkTranscribeJob(_0x4381b6,_0x39a393,_0x3cd4e6));});return BPromise[_0xc659('0x44')](_0x708c07);})[_0xc659('0x35')](function(_0x492a1e){if(_0x492a1e){if(!_0x492a1e[_0xc659('0x36')]||_0x492a1e[_0xc659('0x36')]!==_0xc659('0x45')){logger[_0xc659('0x46')](util[_0xc659('0x38')](_0x492a1e,{'showHidden':![],'depth':null}));}}});}exports[_0xc659('0x47')]=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 efbc46a..ae227a8 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 _0x0a62=['length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','catch','error','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then'];(function(_0x2a3274,_0xc881f7){var _0x95809e=function(_0x4c4ec0){while(--_0x4c4ec0){_0x2a3274['push'](_0x2a3274['shift']());}};_0x95809e(++_0xc881f7);}(_0x0a62,0xa4));var _0x20a6=function(_0x5f49bc,_0x548555){_0x5f49bc=_0x5f49bc-0x0;var _0x44bbb9=_0x0a62[_0x5f49bc];return _0x44bbb9;};'use strict';var _=require(_0x20a6('0x0'));var moment=require('moment');var Redis=require(_0x20a6('0x1'));var util=require(_0x20a6('0x2'));var config=require(_0x20a6('0x3'));var db=require(_0x20a6('0x4'))['db'];var logger=require(_0x20a6('0x5'))(_0x20a6('0x6'));config[_0x20a6('0x7')]=_[_0x20a6('0x8')](config[_0x20a6('0x7')],{'host':_0x20a6('0x9'),'port':0x18eb});var io=require(_0x20a6('0xa'))(new Redis(config[_0x20a6('0x7')]));function closeInteractions(){var _0x5d623c=[];return db[_0x20a6('0xb')][_0x20a6('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x20a6('0xd')](0x18,_0x20a6('0xe'))}}})[_0x20a6('0xf')](function(_0x66bd9c){if(_0x66bd9c&&_0x66bd9c[_0x20a6('0x10')]){_0x5d623c=_[_0x20a6('0x11')](_0x66bd9c||[],'id');logger[_0x20a6('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x5d623c[_0x20a6('0x13')]());return db[_0x20a6('0xb')][_0x20a6('0x14')]({'closeReason':_0x20a6('0x15'),'disposition':_0x20a6('0x16'),'closed':!![],'closedAt':moment()[_0x20a6('0x17')](_0x20a6('0x18'))},{'where':{'id':_0x5d623c}});}})[_0x20a6('0xf')](function(){if(_0x5d623c&&_0x5d623c[_0x20a6('0x10')]){logger[_0x20a6('0x12')](_0x20a6('0x19'),_0x5d623c[_0x20a6('0x13')]());for(var _0x3ecf62=0x0;_0x3ecf62<_0x5d623c[_0x20a6('0x10')];_0x3ecf62++){io['emit']('whatsappInteraction:update',{'id':_0x5d623c[_0x3ecf62],'closed':!![]});}}})[_0x20a6('0x1a')](function(_0x450db3){logger[_0x20a6('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x450db3?util[_0x20a6('0x1c')](_0x450db3,{'showHidden':![],'depth':null}):'');});}exports[_0x20a6('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa057=['subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','then','emit','whatsappInteraction:update','catch','error','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','WhatsappInteraction','lastMsgAt'];(function(_0x3a99f4,_0x2a81c1){var _0xea0b42=function(_0x41f533){while(--_0x41f533){_0x3a99f4['push'](_0x3a99f4['shift']());}};_0xea0b42(++_0x2a81c1);}(_0xa057,0x123));var _0x7a05=function(_0x1ea168,_0x52123b){_0x1ea168=_0x1ea168-0x0;var _0x4cd6c8=_0xa057[_0x1ea168];return _0x4cd6c8;};'use strict';var _=require(_0x7a05('0x0'));var moment=require(_0x7a05('0x1'));var Redis=require('ioredis');var util=require(_0x7a05('0x2'));var config=require(_0x7a05('0x3'));var db=require(_0x7a05('0x4'))['db'];var logger=require('../logger')(_0x7a05('0x5'));config[_0x7a05('0x6')]=_['defaults'](config[_0x7a05('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a05('0x6')]));function closeInteractions(){var _0x19e056=[];return db[_0x7a05('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x7a05('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7a05('0x9')](0x18,_0x7a05('0xa'))}}})['then'](function(_0x31841c){if(_0x31841c&&_0x31841c[_0x7a05('0xb')]){_0x19e056=_[_0x7a05('0xc')](_0x31841c||[],'id');logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x19e056[_0x7a05('0xf')]());return db['WhatsappInteraction'][_0x7a05('0x10')]({'closeReason':_0x7a05('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x7a05('0x12'))},{'where':{'id':_0x19e056}});}})[_0x7a05('0x13')](function(){if(_0x19e056&&_0x19e056['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x19e056[_0x7a05('0xf')]());for(var _0x4efea=0x0;_0x4efea<_0x19e056[_0x7a05('0xb')];_0x4efea++){io[_0x7a05('0x14')](_0x7a05('0x15'),{'id':_0x19e056[_0x4efea],'closed':!![]});}}})[_0x7a05('0x16')](function(_0x300d6d){logger[_0x7a05('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x300d6d?util['inspect'](_0x300d6d,{'showHidden':![],'depth':null}):'');});}exports[_0x7a05('0x18')]=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 3acdfa5..fe2e04e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf994=['util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch'];(function(_0x4d94fd,_0x24cc0e){var _0x447e0f=function(_0x5921e2){while(--_0x5921e2){_0x4d94fd['push'](_0x4d94fd['shift']());}};_0x447e0f(++_0x24cc0e);}(_0xf994,0x168));var _0x4f99=function(_0x1a08d5,_0x540a04){_0x1a08d5=_0x1a08d5-0x0;var _0x15a657=_0xf994[_0x1a08d5];return _0x15a657;};'use strict';var util=require(_0x4f99('0x0'));var db=require(_0x4f99('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x4f99('0x2')+i,'lastName':_0x4f99('0x3')+i,'phone':0xf879fb460+i,'email':_0x4f99('0x4')+i+_0x4f99('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4f99('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4f99('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x4f99('0x2')+i,'lastName':_0x4f99('0x3')+i,'phone':0xf879fb460+i,'email':_0x4f99('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4f99('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x4f99('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4f99('0x7')](),'updatedAt':Date[_0x4f99('0x7')]()});}db['CmContact'][_0x4f99('0x8')]({'where':{}})[_0x4f99('0x9')](function(){return db[_0x4f99('0xa')][_0x4f99('0xb')](contacts);})[_0x4f99('0x9')](function(){console[_0x4f99('0xc')](_0x4f99('0xd'),_0x4f99('0xe'));return db[_0x4f99('0xf')][_0x4f99('0x8')]({'where':{}});})[_0x4f99('0x9')](function(){return db['CmHopper'][_0x4f99('0xb')](hopper);})[_0x4f99('0x9')](function(){console[_0x4f99('0xc')](_0x4f99('0xd'),_0x4f99('0x10'));return db[_0x4f99('0xa')][_0x4f99('0xb')](contacts2);})[_0x4f99('0x9')](function(){console['log'](_0x4f99('0xd'),_0x4f99('0x11'));return db[_0x4f99('0xf')][_0x4f99('0xb')](hopper2);})[_0x4f99('0x9')](function(){console[_0x4f99('0xc')](_0x4f99('0xd'),_0x4f99('0x12'));})[_0x4f99('0x13')](function(_0x360614){console[_0x4f99('0xc')](_0x360614);}); \ No newline at end of file +var _0x4627=['then','CmContact','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','catch','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0x4627,0x15a));var _0x7462=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x4627[_0x3b231a];return _0x18d67a;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7462('0x0')+i,'phone':0xf879fb460+i,'email':_0x7462('0x1')+i+_0x7462('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7462('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x7462('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7462('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7462('0x3')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x7462('0x0')+i,'phone':0xf879fb460+i,'email':_0x7462('0x1')+i+_0x7462('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x7462('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x7462('0x4')]()});}db['CmContact'][_0x7462('0x5')]({'where':{}})[_0x7462('0x6')](function(){return db[_0x7462('0x7')]['bulkCreate'](contacts);})[_0x7462('0x6')](function(){console[_0x7462('0x8')](_0x7462('0x9'),_0x7462('0xa'));return db[_0x7462('0xb')][_0x7462('0x5')]({'where':{}});})[_0x7462('0x6')](function(){return db[_0x7462('0xb')][_0x7462('0xc')](hopper);})[_0x7462('0x6')](function(){console[_0x7462('0x8')]('finished\x20populating',_0x7462('0xd'));return db['CmContact'][_0x7462('0xc')](contacts2);})[_0x7462('0x6')](function(){console['log'](_0x7462('0x9'),_0x7462('0xe'));return db['CmHopper'][_0x7462('0xc')](hopper2);})[_0x7462('0x6')](function(){console[_0x7462('0x8')]('finished\x20populating','hopper2');})[_0x7462('0xf')](function(_0x59afdd){console[_0x7462('0x8')](_0x59afdd);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index dc02efe..29deb95 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0d=['log','catch','util','../mysqldb','push','%s%s','format','agent','password','friend','udp','wss','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','then'];(function(_0x12486e,_0x5a0307){var _0x56b64b=function(_0x17b0a0){while(--_0x17b0a0){_0x12486e['push'](_0x12486e['shift']());}};_0x56b64b(++_0x5a0307);}(_0xef0d,0x101));var _0xdef0=function(_0x1d7928,_0x13f8d6){_0x1d7928=_0x1d7928-0x0;var _0x534324=_0xef0d[_0x1d7928];return _0x534324;};'use strict';var util=require(_0xdef0('0x0'));var db=require(_0xdef0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdef0('0x2')]({'name':util['format'](_0xdef0('0x3'),'agent',i),'fullname':util['format'](_0xdef0('0x3'),'agent',i),'email':util[_0xdef0('0x4')]('%s%s@xcally.com','agent',i),'role':_0xdef0('0x5'),'password':_0xdef0('0x6'),'internal':0xfa0+i,'type':_0xdef0('0x7'),'transport':[_0xdef0('0x8'),'ws',_0xdef0('0x9')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0xdef0('0x3'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':'yes','icesupport':_0xdef0('0xa'),'dtlsenable':_0xdef0('0xa'),'dtlsverify':'no','dtlscertfile':_0xdef0('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xdef0('0xc'),'callerid':util[_0xdef0('0x4')](_0xdef0('0xd'),util[_0xdef0('0x4')]('%s%s','agent',i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xdef0('0xe')](function(){console[_0xdef0('0xf')]('add\x20user');})[_0xdef0('0x10')](function(_0x32304a){console[_0xdef0('0xf')](_0x32304a);}); \ No newline at end of file +var _0x3bd1=['format','agent','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','User','then','log','add\x20user','util','../mysqldb','push','%s%s'];(function(_0xa7eed8,_0x4f7987){var _0x1bb403=function(_0x58b0bc){while(--_0x58b0bc){_0xa7eed8['push'](_0xa7eed8['shift']());}};_0x1bb403(++_0x4f7987);}(_0x3bd1,0x84));var _0x13bd=function(_0x3db2c6,_0x2a0463){_0x3db2c6=_0x3db2c6-0x0;var _0x353911=_0x3bd1[_0x3db2c6];return _0x353911;};'use strict';var util=require(_0x13bd('0x0'));var db=require(_0x13bd('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x13bd('0x2')]({'name':util['format'](_0x13bd('0x3'),'agent',i),'fullname':util[_0x13bd('0x4')](_0x13bd('0x3'),_0x13bd('0x5'),i),'email':util[_0x13bd('0x4')](_0x13bd('0x6'),_0x13bd('0x5'),i),'role':'agent','password':_0x13bd('0x7'),'internal':0xfa0+i,'type':_0x13bd('0x8'),'transport':[_0x13bd('0x9'),'ws','wss'],'disallow':[_0x13bd('0xa')],'allow':['ulaw'],'defaultuser':util[_0x13bd('0x4')]('%s%s',_0x13bd('0x5'),i),'encryption':_0x13bd('0xb'),'avpf':_0x13bd('0xb'),'force_avp':_0x13bd('0xb'),'icesupport':_0x13bd('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x13bd('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x13bd('0x4')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x13bd('0x5'),i),0xfa0+i)});}db[_0x13bd('0xd')]['bulkCreate'](users)[_0x13bd('0xe')](function(){console[_0x13bd('0xf')](_0x13bd('0x10'));})['catch'](function(_0x371089){console[_0x13bd('0xf')](_0x371089);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index df12c47..8fa9d71 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x543b=['connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','./environment','name','Agents','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','map','User','Campaign','where','format','%s:queue:%s','length','user:%s','query','userProfileId','handshake','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','FaxQueues','MailQueue','WhatsappQueues','Trunks','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remotePort'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0x543b,0x18d));var _0xb543=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x543b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var BPromise=require(_0xb543('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xb543('0x3'));var queryQueues={'attributes':['id',_0xb543('0x4')],'include':[{'as':_0xb543('0x5'),'model':db['User'],'attributes':['id',_0xb543('0x4'),_0xb543('0x6')],'raw':!![],'where':{'role':_0xb543('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb543('0x4')],'where':{'role':_0xb543('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb543('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb543('0x4')],'where':{'role':_0xb543('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb543('0x4'),_0xb543('0x9')],'where':{'type':_0xb543('0xa')}};function getAssociatedResources(_0x3ff455,_0x528767,_0xa94776){return db['UserProfileSection'][_0xb543('0xb')]({'where':{'name':_0x3ff455,'userProfileId':_0x528767},'raw':!![]})[_0xb543('0xc')](function(_0x1e6d97){if(_0x1e6d97){if(_0x1e6d97[_0xb543('0xd')]){switch(_0x3ff455){case _0xb543('0xe'):case _0xb543('0xf'):case'FaxQueues':case _0xb543('0x10'):case _0xb543('0x11'):case _0xb543('0x12'):case'WhatsappQueues':return db[_0xa94776][_0xb543('0x13')](queryQueues);case _0xb543('0x14'):return db[_0xa94776][_0xb543('0x13')](queryTelephones);case'Trunks':return db[_0xa94776]['findAll'](queryTrunks);case _0xb543('0x15'):return db[_0xa94776][_0xb543('0x13')](queryCampaigns);}}else{return db[_0xb543('0x16')][_0xb543('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x1e6d97['id']},'raw':!![]})[_0xb543('0xc')](function(_0x399b28){if(_0x399b28){var _0x44da22={'where':{'id':_[_0xb543('0x17')](_0x399b28,'resourceId')},'raw':!![]};switch(_0xa94776){case _0xb543('0x18'):_0x44da22['where'][_0xb543('0x6')]=_0xb543('0x8');break;case _0xb543('0x19'):_0x44da22[_0xb543('0x1a')]['type']=_0xb543('0xa');break;}return db[_0xa94776][_0xb543('0x13')](_0x44da22);}else{return[];}});}}else{return[];}})[_0xb543('0xc')](function(_0x5aff96){return _0x5aff96;});}function joinOrLeaveQueues(_0x5738bd,_0x1c2857,_0x8c3c71,_0x281b95){_0x5738bd[_0x1c2857](util[_0xb543('0x1b')](_0xb543('0x1c'),_0x8c3c71,_0x281b95[_0xb543('0x4')]));if(_0x281b95[_0xb543('0x5')]){for(var _0x1a4b73=0x0;_0x1a4b73<_0x281b95['Agents'][_0xb543('0x1d')];_0x1a4b73+=0x1){_0x5738bd[_0x1c2857](util[_0xb543('0x1b')](_0xb543('0x1e'),_0x281b95[_0xb543('0x5')][_0x1a4b73][_0xb543('0x4')]));}}}function joinOrLeave(_0x4dc406,_0x54e603,_0x5e763c){var _0x5d4ac2;if(_0x4dc406['handshake'][_0xb543('0x1f')]['id']){db[_0xb543('0x18')]['find']({'attributes':['id','name',_0xb543('0x6'),_0xb543('0x20')],'where':{'id':_0x4dc406[_0xb543('0x21')]['query']['id']},'include':[{'model':db[_0xb543('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb543('0x23')],'as':_0xb543('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb543('0x25')],'as':_0xb543('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb543('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb543('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xb543('0x29'),'attributes':['id'],'raw':!![]}]})[_0xb543('0xc')](function(_0x3cb2ed){if(_0x3cb2ed){_0x5d4ac2=_0x3cb2ed;_0x4dc406[_0x54e603](util[_0xb543('0x1b')](_0xb543('0x1e'),_0x3cb2ed[_0xb543('0x4')]));var _0x531ae0=[];switch(_0x3cb2ed[_0xb543('0x6')]){case'admin':_0x4dc406[_0x54e603](_0xb543('0x2a'));_0x4dc406[_0x54e603](_0xb543('0x2b'));if(queryQueues[_0xb543('0x2c')](_0xb543('0x2d'))){delete queryQueues['include'];}_0x531ae0[_0xb543('0x2e')](db['VoiceQueue'][_0xb543('0x13')](queryQueues));_0x531ae0[_0xb543('0x2e')](db[_0xb543('0x2f')][_0xb543('0x13')](queryQueues));_0x531ae0['push'](db[_0xb543('0x30')][_0xb543('0x13')](queryQueues));_0x531ae0[_0xb543('0x2e')](db[_0xb543('0x31')][_0xb543('0x13')](queryQueues));_0x531ae0[_0xb543('0x2e')](db['MailQueue'][_0xb543('0x13')](queryQueues));_0x531ae0[_0xb543('0x2e')](db[_0xb543('0x32')]['findAll'](queryQueues));_0x531ae0['push'](db[_0xb543('0x33')][_0xb543('0x13')](queryQueues));_0x531ae0[_0xb543('0x2e')](db[_0xb543('0x18')][_0xb543('0x13')](queryTelephones));_0x531ae0[_0xb543('0x2e')](db[_0xb543('0x34')][_0xb543('0x13')](queryTrunks));_0x531ae0[_0xb543('0x2e')](db['Campaign'][_0xb543('0x13')](queryCampaigns));_0x531ae0[_0xb543('0x2e')](db['User'][_0xb543('0x13')](queryAgents));break;case _0xb543('0x35'):_0x4dc406[_0x54e603](_0xb543('0x2a'));_0x4dc406[_0x54e603]('voice:outbound');_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0xe'),_0x3cb2ed['userProfileId'],_0xb543('0x36')));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0xf'),_0x3cb2ed['userProfileId'],'ChatQueue'));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x37'),_0x3cb2ed[_0xb543('0x20')],_0xb543('0x30')));_0x531ae0['push'](getAssociatedResources('SmsQueues',_0x3cb2ed['userProfileId'],'SmsQueue'));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x11'),_0x3cb2ed[_0xb543('0x20')],_0xb543('0x38')));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x12'),_0x3cb2ed['userProfileId'],_0xb543('0x32')));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x39'),_0x3cb2ed[_0xb543('0x20')],'WhatsappQueue'));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x14'),_0x3cb2ed[_0xb543('0x20')],_0xb543('0x18')));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x3a'),_0x3cb2ed[_0xb543('0x20')],_0xb543('0x34')));_0x531ae0[_0xb543('0x2e')](getAssociatedResources(_0xb543('0x15'),_0x3cb2ed[_0xb543('0x20')],_0xb543('0x19')));_0x531ae0[_0xb543('0x2e')](db['User'][_0xb543('0x13')](queryAgents));break;case _0xb543('0x7'):_0x4dc406[_0x54e603](_0xb543('0x2a'));_0x4dc406[_0x54e603](_0xb543('0x2b'));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed[_0xb543('0x3b')]({'attributes':['id','name']}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed[_0xb543('0x3c')]({'attributes':['id',_0xb543('0x4')]}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed['getFaxQueues']({'attributes':['id','name']}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed[_0xb543('0x3d')]({'attributes':['id',_0xb543('0x4')]}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed['getMailQueues']({'attributes':['id',_0xb543('0x4')]}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed[_0xb543('0x3e')]({'attributes':['id',_0xb543('0x4')]}));_0x531ae0[_0xb543('0x2e')](_0x3cb2ed[_0xb543('0x3f')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x531ae0);}})[_0xb543('0xc')](function(_0x155374){if(_0x155374&&_0x155374['length']){for(var _0x5e44c4=0x0;_0x5e44c4<_0x155374[_0xb543('0x1d')];_0x5e44c4+=0x1){for(var _0x27aa1c=0x0;_0x27aa1c<_0x155374[_0x5e44c4][_0xb543('0x1d')];_0x27aa1c+=0x1){switch(_0x5e44c4){case 0x0:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x40'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x1:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x41'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x2:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x42'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x3:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x43'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x4:joinOrLeaveQueues(_0x4dc406,_0x54e603,'mail',_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x5:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x44'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x6:joinOrLeaveQueues(_0x4dc406,_0x54e603,_0xb543('0x45'),_0x155374[_0x5e44c4][_0x27aa1c]);break;case 0x7:if(_0x5d4ac2['role']!==_0xb543('0x7'))_0x4dc406[_0x54e603](util['format']('telephone:%s',_0x155374[_0x5e44c4][_0x27aa1c][_0xb543('0x4')]));break;case 0x8:if(_0x5d4ac2['role']!==_0xb543('0x7'))_0x4dc406[_0x54e603](util[_0xb543('0x1b')](_0xb543('0x46'),_0x155374[_0x5e44c4][_0x27aa1c][_0xb543('0x4')]));break;case 0x9:if(_0x5d4ac2['role']!==_0xb543('0x7'))_0x4dc406[_0x54e603](util[_0xb543('0x1b')](_0xb543('0x47'),_0x155374[_0x5e44c4][_0x27aa1c][_0xb543('0x9')],_0x155374[_0x5e44c4][_0x27aa1c][_0xb543('0x4')]));break;case 0xa:_0x4dc406[_0x54e603](util[_0xb543('0x1b')](_0xb543('0x1e'),_0x155374[_0x5e44c4][_0x27aa1c][_0xb543('0x4')]));break;}}}}})[_0xb543('0xc')](function(){if(_0x54e603===_0xb543('0x48')){var _0x515364=_[_0xb543('0x17')](_0x5d4ac2[_0xb543('0x49')],'id');return _0x5d4ac2[_0xb543('0x4a')](_0x515364)[_0xb543('0xc')](function(){for(var _0x258bd4=0x0;_0x258bd4<_0x515364[_0xb543('0x1d')];_0x258bd4+=0x1){_0x5e763c[_0xb543('0x4b')](_0xb543('0x4c'),{'ChatInteractionId':Number(_0x515364[_0x258bd4]),'UserId':Number(_0x5d4ac2['id'])});}});}})['then'](function(){if(_0x54e603==='leave'){var _0x3d2ed1=_[_0xb543('0x17')](_0x5d4ac2[_0xb543('0x24')],'id');return _0x5d4ac2[_0xb543('0x4d')](_0x3d2ed1)[_0xb543('0xc')](function(){for(var _0x514afa=0x0;_0x514afa<_0x3d2ed1['length'];_0x514afa+=0x1){_0x5e763c[_0xb543('0x4b')](_0xb543('0x4e'),{'MailInteractionId':Number(_0x3d2ed1[_0x514afa]),'UserId':Number(_0x5d4ac2['id'])});}});}})[_0xb543('0xc')](function(){if(_0x54e603===_0xb543('0x48')){var _0x10b2cc=_[_0xb543('0x17')](_0x5d4ac2[_0xb543('0x26')],'id');return _0x5d4ac2[_0xb543('0x4f')](_0x10b2cc)[_0xb543('0xc')](function(){for(var _0x224153=0x0;_0x224153<_0x10b2cc[_0xb543('0x1d')];_0x224153+=0x1){_0x5e763c[_0xb543('0x4b')](_0xb543('0x50'),{'FaxInteractionId':Number(_0x10b2cc[_0x224153]),'UserId':Number(_0x5d4ac2['id'])});}});}})[_0xb543('0xc')](function(){if(_0x54e603===_0xb543('0x48')){var _0x25f247=_[_0xb543('0x17')](_0x5d4ac2['SmsInteractions'],'id');return _0x5d4ac2[_0xb543('0x51')](_0x25f247)[_0xb543('0xc')](function(){for(var _0x40a0d3=0x0;_0x40a0d3<_0x25f247[_0xb543('0x1d')];_0x40a0d3+=0x1){_0x5e763c[_0xb543('0x4b')](_0xb543('0x52'),{'SmsInteractionId':Number(_0x25f247[_0x40a0d3]),'UserId':Number(_0x5d4ac2['id'])});}});}})[_0xb543('0xc')](function(){if(_0x54e603===_0xb543('0x48')){var _0x2beb21=_[_0xb543('0x17')](_0x5d4ac2[_0xb543('0x53')],'id');return _0x5d4ac2['removeOpenchannelInteractions'](_0x2beb21)[_0xb543('0xc')](function(){for(var _0x561203=0x0;_0x561203<_0x2beb21[_0xb543('0x1d')];_0x561203+=0x1){_0x5e763c[_0xb543('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2beb21[_0x561203]),'UserId':Number(_0x5d4ac2['id'])});}});}})[_0xb543('0xc')](function(){if(_0x54e603===_0xb543('0x48')){var _0x2a71cf=_['map'](_0x5d4ac2['WhatsappInteractions'],'id');return _0x5d4ac2[_0xb543('0x54')](_0x2a71cf)[_0xb543('0xc')](function(){for(var _0x54cba1=0x0;_0x54cba1<_0x2a71cf['length'];_0x54cba1+=0x1){_0x5e763c[_0xb543('0x4b')](_0xb543('0x55'),{'WhatsappInteractionId':Number(_0x2a71cf[_0x54cba1]),'UserId':Number(_0x5d4ac2['id'])});}});}})[_0xb543('0x56')](function(_0x520b3d){_0x4dc406[_0xb543('0x57')](_0x520b3d);});}}function onDisconnect(_0x1c61ec,_0x491d63){joinOrLeave(_0x1c61ec,_0xb543('0x48'),_0x491d63);}function onConnect(_0x3c8129){joinOrLeave(_0x3c8129,_0xb543('0x58'));}exports['default']=function(_0x30518f){_0x30518f['on'](_0xb543('0x59'),function(_0x816aca){_0x816aca['setMaxListeners'](0x0);_0x816aca[_0xb543('0x5a')]=_0x816aca[_0xb543('0x5b')][_0xb543('0x59')]['remoteAddress']+':'+_0x816aca['request'][_0xb543('0x59')][_0xb543('0x5c')];_0x816aca[_0xb543('0x5d')]=new Date();_0x816aca[_0xb543('0x57')]=function(_0x1ee5f8){console['log'](_0xb543('0x5e')+_0x816aca[_0xb543('0x5f')]['name']+'['+_0x816aca[_0xb543('0x5a')]+']',_0x1ee5f8);};_0x816aca['on'](_0xb543('0x60'),function(){onDisconnect(_0x816aca,_0x30518f);_0x816aca[_0xb543('0x57')](_0xb543('0x61'));});onConnect(_0x816aca);_0x816aca['log']('CONNECTED');});}; \ No newline at end of file +var _0xc42c=['user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','CONNECTED','util','bluebird','../mysqldb','User','name','role','agent','telephone','ivr','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','Trunks','IvrCampaigns','UserProfileResource','findAll','resourceId','map','where','Campaign','type','format','%s:queue:%s','Agents','length','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove'];(function(_0x56bef9,_0x40a34d){var _0x225efc=function(_0x5e3bc8){while(--_0x5e3bc8){_0x56bef9['push'](_0x56bef9['shift']());}};_0x225efc(++_0x40a34d);}(_0xc42c,0x13e));var _0xcc42=function(_0x30b2b7,_0x5869bc){_0x30b2b7=_0x30b2b7-0x0;var _0x540a28=_0xc42c[_0x30b2b7];return _0x540a28;};'use strict';var _=require('lodash');var util=require(_0xcc42('0x0'));var BPromise=require(_0xcc42('0x1'));var db=require(_0xcc42('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xcc42('0x3')],'attributes':['id',_0xcc42('0x4'),_0xcc42('0x5')],'raw':!![],'where':{'role':_0xcc42('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcc42('0x4')],'where':{'role':_0xcc42('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcc42('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xcc42('0x4')],'where':{'role':_0xcc42('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xcc42('0x8')}};function getAssociatedResources(_0x3f80c6,_0x58c250,_0x11c838){return db['UserProfileSection']['findOne']({'where':{'name':_0x3f80c6,'userProfileId':_0x58c250},'raw':!![]})[_0xcc42('0x9')](function(_0x18b89f){if(_0x18b89f){if(_0x18b89f[_0xcc42('0xa')]){switch(_0x3f80c6){case'VoiceQueues':case'ChatQueues':case _0xcc42('0xb'):case _0xcc42('0xc'):case _0xcc42('0xd'):case _0xcc42('0xe'):case _0xcc42('0xf'):return db[_0x11c838]['findAll'](queryQueues);case _0xcc42('0x10'):return db[_0x11c838]['findAll'](queryTelephones);case _0xcc42('0x11'):return db[_0x11c838]['findAll'](queryTrunks);case _0xcc42('0x12'):return db[_0x11c838]['findAll'](queryCampaigns);}}else{return db[_0xcc42('0x13')][_0xcc42('0x14')]({'attributes':[_0xcc42('0x15')],'where':{'sectionId':_0x18b89f['id']},'raw':!![]})[_0xcc42('0x9')](function(_0x260ff0){if(_0x260ff0){var _0x34f385={'where':{'id':_[_0xcc42('0x16')](_0x260ff0,_0xcc42('0x15'))},'raw':!![]};switch(_0x11c838){case _0xcc42('0x3'):_0x34f385[_0xcc42('0x17')][_0xcc42('0x5')]=_0xcc42('0x7');break;case _0xcc42('0x18'):_0x34f385[_0xcc42('0x17')][_0xcc42('0x19')]=_0xcc42('0x8');break;}return db[_0x11c838][_0xcc42('0x14')](_0x34f385);}else{return[];}});}}else{return[];}})['then'](function(_0x1d7450){return _0x1d7450;});}function joinOrLeaveQueues(_0x328e67,_0x47120c,_0x1d93e6,_0x5c8b91){_0x328e67[_0x47120c](util[_0xcc42('0x1a')](_0xcc42('0x1b'),_0x1d93e6,_0x5c8b91[_0xcc42('0x4')]));if(_0x5c8b91[_0xcc42('0x1c')]){for(var _0x32ac2a=0x0;_0x32ac2a<_0x5c8b91[_0xcc42('0x1c')][_0xcc42('0x1d')];_0x32ac2a+=0x1){_0x328e67[_0x47120c](util[_0xcc42('0x1a')]('user:%s',_0x5c8b91[_0xcc42('0x1c')][_0x32ac2a][_0xcc42('0x4')]));}}}function joinOrLeave(_0x524223,_0x15a950,_0x4f3e36){var _0x5f1314;if(_0x524223['handshake'][_0xcc42('0x1e')]['id']){db[_0xcc42('0x3')][_0xcc42('0x1f')]({'attributes':['id',_0xcc42('0x4'),'role',_0xcc42('0x20')],'where':{'id':_0x524223[_0xcc42('0x21')]['query']['id']},'include':[{'model':db[_0xcc42('0x22')],'as':_0xcc42('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc42('0x24')],'as':_0xcc42('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc42('0x26')],'as':_0xcc42('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc42('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xcc42('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xcc42('0x2a')],'as':_0xcc42('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xcc42('0x9')](function(_0x313b6d){if(_0x313b6d){_0x5f1314=_0x313b6d;_0x524223[_0x15a950](util[_0xcc42('0x1a')](_0xcc42('0x2c'),_0x313b6d[_0xcc42('0x4')]));var _0x16388a=[];switch(_0x313b6d[_0xcc42('0x5')]){case _0xcc42('0x2d'):_0x524223[_0x15a950](_0xcc42('0x2e'));_0x524223[_0x15a950](_0xcc42('0x2f'));if(queryQueues[_0xcc42('0x30')](_0xcc42('0x31'))){delete queryQueues['include'];}_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x33')][_0xcc42('0x14')](queryQueues));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x34')][_0xcc42('0x14')](queryQueues));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x35')][_0xcc42('0x14')](queryQueues));_0x16388a['push'](db[_0xcc42('0x36')][_0xcc42('0x14')](queryQueues));_0x16388a['push'](db['MailQueue'][_0xcc42('0x14')](queryQueues));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x37')][_0xcc42('0x14')](queryQueues));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x38')][_0xcc42('0x14')](queryQueues));_0x16388a['push'](db[_0xcc42('0x3')][_0xcc42('0x14')](queryTelephones));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x39')][_0xcc42('0x14')](queryTrunks));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x18')]['findAll'](queryCampaigns));_0x16388a[_0xcc42('0x32')](db[_0xcc42('0x3')]['findAll'](queryAgents));break;case _0xcc42('0x3a'):_0x524223[_0x15a950]('voice:inbound');_0x524223[_0x15a950](_0xcc42('0x2f'));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0x3b'),_0x313b6d[_0xcc42('0x20')],_0xcc42('0x33')));_0x16388a[_0xcc42('0x32')](getAssociatedResources('ChatQueues',_0x313b6d[_0xcc42('0x20')],_0xcc42('0x34')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0xb'),_0x313b6d['userProfileId'],_0xcc42('0x35')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0xc'),_0x313b6d['userProfileId'],'SmsQueue'));_0x16388a[_0xcc42('0x32')](getAssociatedResources('MailQueues',_0x313b6d['userProfileId'],_0xcc42('0x3c')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0xe'),_0x313b6d[_0xcc42('0x20')],_0xcc42('0x37')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0xf'),_0x313b6d[_0xcc42('0x20')],_0xcc42('0x38')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0x10'),_0x313b6d[_0xcc42('0x20')],'User'));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0x11'),_0x313b6d[_0xcc42('0x20')],_0xcc42('0x39')));_0x16388a[_0xcc42('0x32')](getAssociatedResources(_0xcc42('0x12'),_0x313b6d[_0xcc42('0x20')],_0xcc42('0x18')));_0x16388a['push'](db['User'][_0xcc42('0x14')](queryAgents));break;case _0xcc42('0x6'):_0x524223[_0x15a950](_0xcc42('0x2e'));_0x524223[_0x15a950](_0xcc42('0x2f'));_0x16388a['push'](_0x313b6d[_0xcc42('0x3d')]({'attributes':['id',_0xcc42('0x4')]}));_0x16388a['push'](_0x313b6d[_0xcc42('0x3e')]({'attributes':['id','name']}));_0x16388a[_0xcc42('0x32')](_0x313b6d[_0xcc42('0x3f')]({'attributes':['id',_0xcc42('0x4')]}));_0x16388a[_0xcc42('0x32')](_0x313b6d[_0xcc42('0x40')]({'attributes':['id','name']}));_0x16388a[_0xcc42('0x32')](_0x313b6d[_0xcc42('0x41')]({'attributes':['id',_0xcc42('0x4')]}));_0x16388a['push'](_0x313b6d['getOpenchannelQueues']({'attributes':['id',_0xcc42('0x4')]}));_0x16388a[_0xcc42('0x32')](_0x313b6d['getWhatsappQueues']({'attributes':['id',_0xcc42('0x4')]}));break;}return BPromise['all'](_0x16388a);}})[_0xcc42('0x9')](function(_0x53ed4d){if(_0x53ed4d&&_0x53ed4d[_0xcc42('0x1d')]){for(var _0x52e097=0x0;_0x52e097<_0x53ed4d[_0xcc42('0x1d')];_0x52e097+=0x1){for(var _0x38fd2e=0x0;_0x38fd2e<_0x53ed4d[_0x52e097][_0xcc42('0x1d')];_0x38fd2e+=0x1){switch(_0x52e097){case 0x0:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x42'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x1:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x43'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x2:joinOrLeaveQueues(_0x524223,_0x15a950,'fax',_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x3:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x44'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x4:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x45'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x5:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x46'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x6:joinOrLeaveQueues(_0x524223,_0x15a950,_0xcc42('0x47'),_0x53ed4d[_0x52e097][_0x38fd2e]);break;case 0x7:if(_0x5f1314['role']!==_0xcc42('0x6'))_0x524223[_0x15a950](util['format'](_0xcc42('0x48'),_0x53ed4d[_0x52e097][_0x38fd2e][_0xcc42('0x4')]));break;case 0x8:if(_0x5f1314[_0xcc42('0x5')]!==_0xcc42('0x6'))_0x524223[_0x15a950](util['format'](_0xcc42('0x49'),_0x53ed4d[_0x52e097][_0x38fd2e][_0xcc42('0x4')]));break;case 0x9:if(_0x5f1314[_0xcc42('0x5')]!==_0xcc42('0x6'))_0x524223[_0x15a950](util[_0xcc42('0x1a')](_0xcc42('0x4a'),_0x53ed4d[_0x52e097][_0x38fd2e][_0xcc42('0x19')],_0x53ed4d[_0x52e097][_0x38fd2e]['name']));break;case 0xa:_0x524223[_0x15a950](util[_0xcc42('0x1a')](_0xcc42('0x2c'),_0x53ed4d[_0x52e097][_0x38fd2e]['name']));break;}}}}})['then'](function(){if(_0x15a950===_0xcc42('0x4b')){var _0xafbd02=_[_0xcc42('0x16')](_0x5f1314[_0xcc42('0x23')],'id');return _0x5f1314['removeChatInteractions'](_0xafbd02)[_0xcc42('0x9')](function(){for(var _0x512793=0x0;_0x512793<_0xafbd02['length'];_0x512793+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x4d'),{'ChatInteractionId':Number(_0xafbd02[_0x512793]),'UserId':Number(_0x5f1314['id'])});}});}})[_0xcc42('0x9')](function(){if(_0x15a950===_0xcc42('0x4b')){var _0x5496fe=_['map'](_0x5f1314['MailInteractions'],'id');return _0x5f1314[_0xcc42('0x4e')](_0x5496fe)[_0xcc42('0x9')](function(){for(var _0x4f36e2=0x0;_0x4f36e2<_0x5496fe[_0xcc42('0x1d')];_0x4f36e2+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x4f'),{'MailInteractionId':Number(_0x5496fe[_0x4f36e2]),'UserId':Number(_0x5f1314['id'])});}});}})['then'](function(){if(_0x15a950===_0xcc42('0x4b')){var _0x3c4336=_[_0xcc42('0x16')](_0x5f1314[_0xcc42('0x27')],'id');return _0x5f1314['removeFaxInteractions'](_0x3c4336)[_0xcc42('0x9')](function(){for(var _0x2dd92f=0x0;_0x2dd92f<_0x3c4336[_0xcc42('0x1d')];_0x2dd92f+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x50'),{'FaxInteractionId':Number(_0x3c4336[_0x2dd92f]),'UserId':Number(_0x5f1314['id'])});}});}})[_0xcc42('0x9')](function(){if(_0x15a950===_0xcc42('0x4b')){var _0x1c4536=_[_0xcc42('0x16')](_0x5f1314[_0xcc42('0x51')],'id');return _0x5f1314[_0xcc42('0x52')](_0x1c4536)[_0xcc42('0x9')](function(){for(var _0x1965bb=0x0;_0x1965bb<_0x1c4536[_0xcc42('0x1d')];_0x1965bb+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x53'),{'SmsInteractionId':Number(_0x1c4536[_0x1965bb]),'UserId':Number(_0x5f1314['id'])});}});}})['then'](function(){if(_0x15a950===_0xcc42('0x4b')){var _0x1b66eb=_[_0xcc42('0x16')](_0x5f1314[_0xcc42('0x29')],'id');return _0x5f1314[_0xcc42('0x54')](_0x1b66eb)[_0xcc42('0x9')](function(){for(var _0x6b41dc=0x0;_0x6b41dc<_0x1b66eb['length'];_0x6b41dc+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x55'),{'OpenchannelInteractionId':Number(_0x1b66eb[_0x6b41dc]),'UserId':Number(_0x5f1314['id'])});}});}})['then'](function(){if(_0x15a950==='leave'){var _0x3b1912=_[_0xcc42('0x16')](_0x5f1314['WhatsappInteractions'],'id');return _0x5f1314['removeWhatsappInteractions'](_0x3b1912)[_0xcc42('0x9')](function(){for(var _0x38e6cf=0x0;_0x38e6cf<_0x3b1912[_0xcc42('0x1d')];_0x38e6cf+=0x1){_0x4f3e36[_0xcc42('0x4c')](_0xcc42('0x56'),{'WhatsappInteractionId':Number(_0x3b1912[_0x38e6cf]),'UserId':Number(_0x5f1314['id'])});}});}})[_0xcc42('0x57')](function(_0x51d3e3){_0x524223[_0xcc42('0x58')](_0x51d3e3);});}}function onDisconnect(_0x58d432,_0x52563e){joinOrLeave(_0x58d432,_0xcc42('0x4b'),_0x52563e);}function onConnect(_0x39642c){joinOrLeave(_0x39642c,_0xcc42('0x59'));}exports[_0xcc42('0x5a')]=function(_0x5dab7e){_0x5dab7e['on'](_0xcc42('0x5b'),function(_0x17759e){_0x17759e[_0xcc42('0x5c')](0x0);_0x17759e[_0xcc42('0x5d')]=_0x17759e[_0xcc42('0x5e')][_0xcc42('0x5b')][_0xcc42('0x5f')]+':'+_0x17759e['request'][_0xcc42('0x5b')][_0xcc42('0x60')];_0x17759e[_0xcc42('0x61')]=new Date();_0x17759e[_0xcc42('0x58')]=function(_0x196f19){console[_0xcc42('0x58')](_0xcc42('0x62')+_0x17759e[_0xcc42('0x63')][_0xcc42('0x4')]+'['+_0x17759e[_0xcc42('0x5d')]+']',_0x196f19);};_0x17759e['on']('disconnect',function(){onDisconnect(_0x17759e,_0x5dab7e);_0x17759e[_0xcc42('0x58')]('DISCONNECTED');});onConnect(_0x17759e);_0x17759e[_0xcc42('0x58')](_0xcc42('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 0c04abc..88d7372 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 _0xc0f4=['client','http','ChatInteraction','newinteraction','Chat','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','SmsInteraction','Sms','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelMessage','request','EventManager','error','Trigger,\x20%s','catch','channel','event','direction','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','contact','UserId','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','motionChannel','opened','resolve','SELECT','changed','closed','substatus','interface','AfterUpdate','User','fullname','email','internal','length','hasOwnProperty','model','callback','condition','jayson/promise','../logger','triggers'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xc0f4,0x119));var _0x4c0f=function(_0x50074f,_0x13cc6f){_0x50074f=_0x50074f-0x0;var _0x187cd2=_0xc0f4[_0x50074f];return _0x187cd2;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x4c0f('0x0'));var logger=require(_0x4c0f('0x1'))(_0x4c0f('0x2'));var client=jayson[_0x4c0f('0x3')][_0x4c0f('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x4c0f('0x5'),'event':'afterCreate','condition':_0x4c0f('0x6'),'callback':afterCreate},{'channel':_0x4c0f('0x7'),'model':_0x4c0f('0x5'),'event':'afterUpdate','condition':_0x4c0f('0x8'),'callback':afterUpdate},{'channel':_0x4c0f('0x7'),'model':_0x4c0f('0x9'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x4c0f('0xc'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x4c0f('0xd'),'event':_0x4c0f('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4c0f('0xe'),'model':_0x4c0f('0xd'),'event':_0x4c0f('0xf'),'condition':_0x4c0f('0x8'),'callback':afterUpdate},{'channel':'Sms','model':_0x4c0f('0x10'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateMessage},{'channel':_0x4c0f('0x11'),'model':_0x4c0f('0x12'),'event':'afterCreate','condition':_0x4c0f('0x6'),'callback':afterCreate},{'channel':_0x4c0f('0x11'),'model':'WhatsappInteraction','event':_0x4c0f('0xf'),'condition':_0x4c0f('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x4c0f('0x13'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateMessage},{'channel':_0x4c0f('0x14'),'model':_0x4c0f('0x15'),'event':'afterCreate','condition':_0x4c0f('0x6'),'callback':afterCreate},{'channel':_0x4c0f('0x14'),'model':_0x4c0f('0x15'),'event':'afterUpdate','condition':_0x4c0f('0x8'),'callback':afterUpdate},{'channel':_0x4c0f('0x14'),'model':_0x4c0f('0x16'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateMessage},{'channel':_0x4c0f('0x17'),'model':_0x4c0f('0x18'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0x6'),'callback':afterCreate},{'channel':_0x4c0f('0x17'),'model':_0x4c0f('0x18'),'event':_0x4c0f('0xf'),'condition':_0x4c0f('0x8'),'callback':afterUpdate},{'channel':_0x4c0f('0x17'),'model':'MailMessage','event':'afterCreate','condition':_0x4c0f('0xb'),'callback':afterCreateMessage},{'channel':_0x4c0f('0x19'),'model':'OpenchannelInteraction','event':_0x4c0f('0xa'),'condition':_0x4c0f('0x6'),'callback':afterCreate},{'channel':_0x4c0f('0x19'),'model':'OpenchannelInteraction','event':_0x4c0f('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4c0f('0x19'),'model':_0x4c0f('0x1a'),'event':_0x4c0f('0xa'),'condition':_0x4c0f('0xb'),'callback':afterCreateMessage}];function request(_0x319816){return client[_0x4c0f('0x1b')](_0x4c0f('0x1c'),_0x319816)['then'](function(_0x36ec89){logger['info']('Trigger,\x20%s',_0x4c0f('0x1c'),_0x36ec89);if(_0x36ec89[_0x4c0f('0x1d')]){if(_0x36ec89[_0x4c0f('0x1d')]['code']===0x1f4){logger[_0x4c0f('0x1d')](_0x4c0f('0x1e'),_0x4c0f('0x1c'),_0x36ec89['error']);}}})[_0x4c0f('0x1f')](function(_0x22731b){logger[_0x4c0f('0x1d')](_0x4c0f('0x1e'),_0x4c0f('0x1c'),_0x22731b);});}function afterCreateMessage(_0x5224d8){return function(_0x353e17){_0x353e17=_0x353e17['get']({'plain':!![]});_0x353e17[_0x4c0f('0x20')]=_0x5224d8;_0x353e17['motionChannel']=_0x5224d8;_0x353e17[_0x4c0f('0x21')]=_0x353e17[_0x4c0f('0x22')];Promise['resolve']()[_0x4c0f('0x23')](function(){if(typeof _0x353e17[_0x4c0f('0x24')]===_0x4c0f('0x25'))return null;var _0x387396=_0x4c0f('0x26')+_0x353e17[_0x4c0f('0x24')];return db[_0x4c0f('0x27')][_0x4c0f('0x28')](_0x387396,{'type':db[_0x4c0f('0x29')][_0x4c0f('0x2a')]['SELECT'],'raw':!![]});})[_0x4c0f('0x23')](function(_0x1c8493){if(_0x1c8493){_0x353e17[_0x4c0f('0x2b')]=_0x1c8493[0x0];}if(typeof _0x353e17['UserId']===_0x4c0f('0x25'))return;return getAgent(_0x353e17[_0x4c0f('0x2c')]);})['then'](function(_0xc7ca20){if(_0xc7ca20){_0x353e17['interface']=util[_0x4c0f('0x2d')](_0x4c0f('0x2e'),_0xc7ca20[_0x4c0f('0x2f')]);_0x353e17[_0x4c0f('0x30')]=_0xc7ca20;_0x353e17[_0x4c0f('0x20')]=_0x5224d8;return request({'event':_0x4c0f('0x31'),'message':_0x353e17});}else{return request({'event':_0x4c0f('0x32'),'message':_0x353e17});}})[_0x4c0f('0x1f')](function(_0x3e4c8a){logger[_0x4c0f('0x1d')](_0x4c0f('0x1e'),_0x4c0f('0x33'),_0x3e4c8a);});};}function afterCreateOfflineMessage(_0x6d02c2){return function(_0x41ceb5){_0x41ceb5=_0x41ceb5[_0x4c0f('0x34')]({'plain':!![]});_0x41ceb5['channel']=_0x6d02c2;_0x41ceb5[_0x4c0f('0x35')]=_0x6d02c2;_0x41ceb5[_0x4c0f('0x21')]='offlineMessage';return request({'event':_0x41ceb5[_0x4c0f('0x21')],'message':_0x41ceb5});};}function afterCreate(_0x2aeaf9,_0x3f11e1){return function(_0x330351){_0x330351=_0x330351[_0x4c0f('0x34')]({'plain':!![]});_0x330351['channel']=_0x2aeaf9;_0x330351['motionChannel']=_0x2aeaf9;_0x330351[_0x4c0f('0x21')]=_0x4c0f('0x36');Promise[_0x4c0f('0x37')]()['then'](function(){var _0x587799='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330351['ContactId'];return db['sequelize'][_0x4c0f('0x28')](_0x587799,{'type':db['Sequelize'][_0x4c0f('0x2a')][_0x4c0f('0x38')],'raw':!![]});})[_0x4c0f('0x23')](function(_0x38a116){if(_0x38a116){_0x330351[_0x4c0f('0x2b')]=_0x38a116[0x0];}if(typeof _0x330351[_0x4c0f('0x2c')]===_0x4c0f('0x25'))return;return getAgent(_0x330351[_0x4c0f('0x2c')]);})[_0x4c0f('0x23')](function(_0x1f46b8){if(_0x1f46b8){_0x330351['interface']=util['format']('SIP/%s',_0x1f46b8['name']);_0x330351[_0x4c0f('0x30')]=_0x1f46b8;}return request({'event':_0x3f11e1,'message':_0x330351});})[_0x4c0f('0x1f')](function(_0x4c8857){logger[_0x4c0f('0x1d')](_0x4c0f('0x1e'),'AfterCreate',_0x4c8857);});};}function afterUpdate(_0x5b7af8){return function(_0x559aae){var _0x19bcdd=_0x559aae[_0x4c0f('0x39')](_0x4c0f('0x3a'))&&_0x559aae[_0x4c0f('0x3a')];var _0x4c3224=_0x559aae[_0x4c0f('0x39')]('substatus');if(_0x19bcdd||_0x4c3224){var _0x264eb5=_0x19bcdd?_0x4c0f('0x8'):_0x4c0f('0x3b');var _0x513ac2=_0x559aae[_0x4c0f('0x34')]({'plain':!![]});_0x513ac2[_0x4c0f('0x20')]=_0x5b7af8;_0x513ac2[_0x4c0f('0x35')]=_0x5b7af8;_0x513ac2['event']=_0x19bcdd?_0x4c0f('0x3a'):'substatus';var _0x206d0f=_0x4c0f('0x26')+_0x513ac2['ContactId'];return db[_0x4c0f('0x27')][_0x4c0f('0x28')](_0x206d0f,{'type':db[_0x4c0f('0x29')][_0x4c0f('0x2a')][_0x4c0f('0x38')],'raw':!![]})[_0x4c0f('0x23')](function(_0x20c008){if(_0x20c008){_0x513ac2[_0x4c0f('0x2b')]=_0x20c008[0x0];}if(typeof _0x513ac2[_0x4c0f('0x2c')]===_0x4c0f('0x25'))return;return getAgent(_0x513ac2[_0x4c0f('0x2c')]);})[_0x4c0f('0x23')](function(_0x2d6afa){if(_0x2d6afa){_0x513ac2[_0x4c0f('0x3c')]=util[_0x4c0f('0x2d')]('SIP/%s',_0x2d6afa[_0x4c0f('0x2f')]);_0x513ac2[_0x4c0f('0x30')]=_0x2d6afa;}return request({'event':_0x264eb5,'message':_0x513ac2});})[_0x4c0f('0x1f')](function(_0x1513c2){logger[_0x4c0f('0x1d')](_0x4c0f('0x1e'),_0x4c0f('0x3d'),_0x1513c2);});}};}function getAgent(_0x2fc06f){return db[_0x4c0f('0x3e')]['find']({'where':{'id':_0x2fc06f},'attributes':['id',_0x4c0f('0x2f'),_0x4c0f('0x3f'),_0x4c0f('0x40'),_0x4c0f('0x41')],'raw':!![]})[_0x4c0f('0x23')](function(_0x486638){return _0x486638;});}exports['default']=function(){for(var _0x52df9f=0x0;_0x52df9f=_0x261fac[_0xa193('0x13')]){throw Error(_0xa193('0x14'));}_0x5a1f55(_0x38f753);})[_0xa193('0x15')](function(_0xf6bd91){_0x5c2a05(_0xf6bd91);});});}; \ No newline at end of file +var _0xa351=['User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','chat','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent'];(function(_0x3e346b,_0x596f92){var _0x3639a8=function(_0x42a2ab){while(--_0x42a2ab){_0x3e346b['push'](_0x3e346b['shift']());}};_0x3639a8(++_0x596f92);}(_0xa351,0x1cf));var _0x1a35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa351[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x1a35('0x0'));var BPromise=require(_0x1a35('0x1'));var db=require(_0x1a35('0x2'))['db'];var util=require(_0x1a35('0x3'));var channels=['voice','mail',_0x1a35('0x4'),'fax',_0x1a35('0x5'),_0x1a35('0x6'),'openchannel'];exports[_0x1a35('0x7')]=function(){return channels;};exports[_0x1a35('0x8')]=function(_0x8c45aa){_0x8c45aa=_0x8c45aa[_0x1a35('0x9')]();return _[_0x1a35('0xa')](channels,_0x8c45aa);};exports[_0x1a35('0xb')]=function(_0x408369,_0x180435,_0x2e29a7,_0x1384cb){var _0x2a5819={'loginAttempts':_0x180435,'blocked':_0x2e29a7};if(!_[_0x1a35('0xc')](_0x1384cb)){_0x2a5819[_0x1a35('0xd')]=_0x1384cb;}return _0x408369[_0x1a35('0xe')](_0x2a5819);};exports['getLicense']=function(_0x1daaed){return new BPromise(function(_0x5b7c8b,_0x2d74bf){var _0x32ffac=0x0;if(_0x1daaed[_0x1a35('0xf')]!==_0x1a35('0x10')){_0x5b7c8b(_0x1daaed);}db[_0x1a35('0x11')][_0x1a35('0x12')]({'where':{'role':_0x1a35('0x10'),'online':!![],'id':{'$ne':_0x1daaed['id']}}})[_0x1a35('0x13')](function(_0x37afc6){_0x32ffac=_0x37afc6;return util[_0x1a35('0x14')]();})[_0x1a35('0x13')](function(_0x40d499){if(_0x40d499&&_0x40d499[_0x1a35('0x15')]&&_0x32ffac>=_0x40d499[_0x1a35('0x15')]){throw Error(_0x1a35('0x16'));}_0x5b7c8b(_0x1daaed);})[_0x1a35('0x17')](function(_0x4f2d80){_0x2d74bf(_0x4f2d80);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 03f6863..d34a401 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x4fc75a,_0x4617fb){var _0x4f8d61=function(_0x7c3bf7){while(--_0x7c3bf7){_0x4fc75a['push'](_0x4fc75a['shift']());}};_0x4f8d61(++_0x4617fb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x5f3730,_0x968294){var _0x387506=function(_0x350861){while(--_0x350861){_0x5f3730['push'](_0x5f3730['shift']());}};_0x387506(++_0x968294);}(_0x814b,0x1a2));var _0xb814=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x814b[_0x2125f0];return _0x12d6eb;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b7ea255..9d6b11b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x271e=['404','status','render','exports'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x271e,0x123));var _0xe271=function(_0x2b7f4c,_0x273b44){_0x2b7f4c=_0x2b7f4c-0x0;var _0x239d57=_0x271e[_0x2b7f4c];return _0x239d57;};'use strict';module[_0xe271('0x0')][0x194]=function pageNotFound(_0x781079,_0xc45880){var _0x3e7789=_0xe271('0x1');var _0x1f38c4=0x194;var _0x1e956c={'status':_0x1f38c4};_0xc45880['status'](_0x1e956c[_0xe271('0x2')]);_0xc45880[_0xe271('0x3')](_0x3e7789,{},function(_0x261a71,_0x2ed7e6){if(_0x261a71){return _0xc45880[_0xe271('0x2')](_0x1e956c[_0xe271('0x2')])['json'](_0x1e956c);}_0xc45880['send'](_0x2ed7e6);});}; \ No newline at end of file +var _0xdf4b=['render','status','json','send','exports','404'];(function(_0x136961,_0x276697){var _0x365843=function(_0x22b587){while(--_0x22b587){_0x136961['push'](_0x136961['shift']());}};_0x365843(++_0x276697);}(_0xdf4b,0x88));var _0xbdf4=function(_0x4614bc,_0x184686){_0x4614bc=_0x4614bc-0x0;var _0x1cc222=_0xdf4b[_0x4614bc];return _0x1cc222;};'use strict';module[_0xbdf4('0x0')][0x194]=function pageNotFound(_0x7a25cf,_0x578c54){var _0x25516e=_0xbdf4('0x1');var _0x3dc4d5=0x194;var _0x576f5d={'status':_0x3dc4d5};_0x578c54['status'](_0x576f5d['status']);_0x578c54[_0xbdf4('0x2')](_0x25516e,{},function(_0x460118,_0x3f3583){if(_0x460118){return _0x578c54[_0xbdf4('0x3')](_0x576f5d['status'])[_0xbdf4('0x4')](_0x576f5d);}_0x578c54[_0xbdf4('0x5')](_0x3f3583);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b55c171..ea0f09d 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ed870a5..100164d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd51f=['./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/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/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','/api/version','/api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','get','sendFile','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/recordings','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks'];(function(_0x3920c1,_0x59530d){var _0x47b676=function(_0x49f9b8){while(--_0x49f9b8){_0x3920c1['push'](_0x3920c1['shift']());}};_0x47b676(++_0x59530d);}(_0xd51f,0xf0));var _0xfd51=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd51f[_0x178e48];return _0x440d7e;};'use strict';var path=require(_0xfd51('0x0'));var express=require(_0xfd51('0x1'));var errors=require('./errors');var config=require(_0xfd51('0x2'));var setupLoggers=require(_0xfd51('0x3'))['setupLoggers'];var clientSideLogs=require(_0xfd51('0x4'));exports[_0xfd51('0x5')]=function(_0x49bb3e){return setupLoggers(_0x49bb3e)[_0xfd51('0x6')](function(){_0x49bb3e[_0xfd51('0x7')]('/api/users',require(_0xfd51('0x8')));_0x49bb3e[_0xfd51('0x7')]('/api/voice/chanspy',require(_0xfd51('0x9')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa'),require(_0xfd51('0xb')));_0x49bb3e[_0xfd51('0x7')]('/api/voice/extensions',require(_0xfd51('0xc')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xd'),require('./api/voiceMusicOnHold'));_0x49bb3e[_0xfd51('0x7')]('/api/voice/queues',require('./api/voiceQueue'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xe'),require(_0xfd51('0xf')));_0x49bb3e['use']('/api/screen/recordings',require('./api/screenRecording'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x10'),require(_0xfd51('0x11')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x12'),require(_0xfd51('0x13')));_0x49bb3e[_0xfd51('0x7')]('/api/voice/calls/reports',require(_0xfd51('0x14')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x15'),require(_0xfd51('0x16')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x17'),require(_0xfd51('0x18')));_0x49bb3e[_0xfd51('0x7')]('/api/voice/queues/reports',require(_0xfd51('0x19')));_0x49bb3e['use'](_0xfd51('0x1a'),require(_0xfd51('0x1b')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x1c'),require(_0xfd51('0x1d')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x1e'),require(_0xfd51('0x1f')));_0x49bb3e['use'](_0xfd51('0x20'),require(_0xfd51('0x21')));_0x49bb3e[_0xfd51('0x7')]('/api/mail/accounts',require(_0xfd51('0x22')));_0x49bb3e['use'](_0xfd51('0x23'),require(_0xfd51('0x24')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x25'),require('./api/mailSubstatus'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x26'),require(_0xfd51('0x27')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x28'),require(_0xfd51('0x29')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x2a'),require('./api/mailApplication'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x2b'),require(_0xfd51('0x2c')));_0x49bb3e[_0xfd51('0x7')]('/api/dashboards',require(_0xfd51('0x2d')));_0x49bb3e[_0xfd51('0x7')]('/api/dashboards/items',require(_0xfd51('0x2e')));_0x49bb3e[_0xfd51('0x7')]('/api/fax/accounts',require(_0xfd51('0x2f')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x30'),require(_0xfd51('0x31')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x32'),require(_0xfd51('0x33')));_0x49bb3e['use'](_0xfd51('0x34'),require(_0xfd51('0x35')));_0x49bb3e['use']('/api/fax/queues',require(_0xfd51('0x36')));_0x49bb3e['use'](_0xfd51('0x37'),require(_0xfd51('0x38')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x39'),require(_0xfd51('0x3a')));_0x49bb3e['use'](_0xfd51('0x3b'),require(_0xfd51('0x3c')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x3d'),require(_0xfd51('0x3e')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x3f'),require(_0xfd51('0x40')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x41'),require(_0xfd51('0x42')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x43'),require(_0xfd51('0x44')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x45'),require(_0xfd51('0x46')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x47'),require(_0xfd51('0x48')));_0x49bb3e['use'](_0xfd51('0x49'),require('./api/openchannelMessage'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x4a'),require(_0xfd51('0x4b')));_0x49bb3e['use']('/api/chat/websites',require('./api/chatWebsite'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x4c'),require(_0xfd51('0x4d')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x4e'),require(_0xfd51('0x4f')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x50'),require('./api/chatInteraction'));_0x49bb3e[_0xfd51('0x7')]('/api/chat/messages',require(_0xfd51('0x51')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x52'),require('./api/chatOfflineMessage'));_0x49bb3e['use'](_0xfd51('0x53'),require('./api/chatQueue'));_0x49bb3e['use']('/api/chat/groups',require(_0xfd51('0x54')));_0x49bb3e['use'](_0xfd51('0x55'),require(_0xfd51('0x56')));_0x49bb3e[_0xfd51('0x7')]('/api/cm/companies',require(_0xfd51('0x57')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x58'),require('./api/cmContact'));_0x49bb3e['use']('/api/cm/hopper',require(_0xfd51('0x59')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x5a'),require(_0xfd51('0x5b')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x5c'),require(_0xfd51('0x5d')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x5e'),require(_0xfd51('0x5f')));_0x49bb3e['use'](_0xfd51('0x60'),require(_0xfd51('0x61')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x62'),require('./api/action'));_0x49bb3e[_0xfd51('0x7')]('/api/automations',require(_0xfd51('0x63')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x64'),require(_0xfd51('0x65')));_0x49bb3e[_0xfd51('0x7')]('/api/dispositions',require('./api/disposition'));_0x49bb3e['use'](_0xfd51('0x66'),require(_0xfd51('0x67')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x68'),require(_0xfd51('0x69')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x6a'),require(_0xfd51('0x6b')));_0x49bb3e[_0xfd51('0x7')]('/api/cdr',require(_0xfd51('0x6c')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x6d'),require(_0xfd51('0x6e')));_0x49bb3e[_0xfd51('0x7')]('/api/schedules',require(_0xfd51('0x6f')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x70'),require(_0xfd51('0x71')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x72'),require(_0xfd51('0x73')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x74'),require('./api/contactItemType'));_0x49bb3e['use'](_0xfd51('0x75'),require(_0xfd51('0x76')));_0x49bb3e['use'](_0xfd51('0x77'),require(_0xfd51('0x78')));_0x49bb3e['use'](_0xfd51('0x79'),require(_0xfd51('0x7a')));_0x49bb3e[_0xfd51('0x7')]('/api/triggers',require(_0xfd51('0x7b')));_0x49bb3e['use'](_0xfd51('0x7c'),require(_0xfd51('0x7d')));_0x49bb3e['use']('/api/integrations',require(_0xfd51('0x7e')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/reports',require('./api/integrationReport'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x7f'),require(_0xfd51('0x80')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x81'),require('./api/analyticDefaultReport'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x82'),require(_0xfd51('0x83')));_0x49bb3e[_0xfd51('0x7')]('/api/analytics/metrics',require(_0xfd51('0x84')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x85'),require(_0xfd51('0x86')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x87'),require(_0xfd51('0x88')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/salesforce/accounts',require(_0xfd51('0x89')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x8a'),require(_0xfd51('0x8b')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x8c'),require(_0xfd51('0x8d')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x8e'),require(_0xfd51('0x8f')));_0x49bb3e['use'](_0xfd51('0x90'),require('./api/intSugarcrmField'));_0x49bb3e['use'](_0xfd51('0x91'),require(_0xfd51('0x92')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x93'),require(_0xfd51('0x94')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x95'),require(_0xfd51('0x96')));_0x49bb3e['use'](_0xfd51('0x97'),require(_0xfd51('0x98')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x99'),require(_0xfd51('0x9a')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/zoho/fields',require(_0xfd51('0x9b')));_0x49bb3e['use']('/api/integrations/zendesk/accounts',require(_0xfd51('0x9c')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/zendesk/configurations',require(_0xfd51('0x9d')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x9e'),require('./api/intZendeskField'));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/freshdesk/accounts',require(_0xfd51('0x9f')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa0'),require(_0xfd51('0xa1')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa2'),require('./api/intFreshdeskField'));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/vtiger/accounts',require(_0xfd51('0xa3')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa4'),require(_0xfd51('0xa5')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/vtiger/fields',require(_0xfd51('0xa6')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa7'),require(_0xfd51('0xa8')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xa9'),require('./api/intServicenowConfiguration'));_0x49bb3e['use'](_0xfd51('0xaa'),require(_0xfd51('0xab')));_0x49bb3e[_0xfd51('0x7')]('/api/integrations/dynamics365/accounts',require(_0xfd51('0xac')));_0x49bb3e['use'](_0xfd51('0xad'),require(_0xfd51('0xae')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xaf'),require(_0xfd51('0xb0')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xb1'),require(_0xfd51('0xb2')));_0x49bb3e['use'](_0xfd51('0xb3'),require('./api/intFreshsalesConfiguration'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xb4'),require(_0xfd51('0xb5')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xb6'),require(_0xfd51('0xb7')));_0x49bb3e['use']('/api/chat/reports/queue',require(_0xfd51('0xb8')));_0x49bb3e['use'](_0xfd51('0xb9'),require(_0xfd51('0xba')));_0x49bb3e[_0xfd51('0x7')]('/api/jscripty/answers/reports',require(_0xfd51('0xbb')));_0x49bb3e['use']('/api/jscripty/questions/reports',require(_0xfd51('0xbc')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xbd'),require(_0xfd51('0xbe')));_0x49bb3e['use'](_0xfd51('0xbf'),require(_0xfd51('0xc0')));_0x49bb3e[_0xfd51('0x7')]('/api/square/reports',require('./api/squareReport'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xc1'),require(_0xfd51('0xc2')));_0x49bb3e['use'](_0xfd51('0xc3'),require(_0xfd51('0xc4')));_0x49bb3e[_0xfd51('0x7')]('/api/settings',require('./api/setting'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xc5'),require(_0xfd51('0xc6')));_0x49bb3e[_0xfd51('0x7')]('/api/square/projects',require('./api/squareProject'));_0x49bb3e['use'](_0xfd51('0xc7'),require(_0xfd51('0xc8')));_0x49bb3e['use'](_0xfd51('0xc9'),require('./api/squareMessage'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xca'),require(_0xfd51('0xcb')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xcc'),require(_0xfd51('0xcd')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xce'),require('./api/campaign'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xcf'),require('./api/migration'));_0x49bb3e['use'](_0xfd51('0xd0'),require('./api/attachment'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xd1'),require(_0xfd51('0xd2')));_0x49bb3e[_0xfd51('0x7')]('/api/mail/reports/transfer',require(_0xfd51('0xd3')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xd4'),require(_0xfd51('0xd5')));_0x49bb3e[_0xfd51('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xd6'),require(_0xfd51('0xd7')));_0x49bb3e['use']('/api/sms/reports/transfer',require(_0xfd51('0xd8')));_0x49bb3e[_0xfd51('0x7')]('/api/cm/lists',require(_0xfd51('0xd9')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xda'),require(_0xfd51('0xdb')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xdc'),require(_0xfd51('0xdd')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xde'),require(_0xfd51('0xdf')));_0x49bb3e[_0xfd51('0x7')]('/api/userProfile/resources',require(_0xfd51('0xe0')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xe1'),require(_0xfd51('0xe2')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xe3'),require('./api/whatsappAccount'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xe4'),require(_0xfd51('0xe5')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xe6'),require(_0xfd51('0xe7')));_0x49bb3e['use'](_0xfd51('0xe8'),require(_0xfd51('0xe9')));_0x49bb3e[_0xfd51('0x7')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xea'),require(_0xfd51('0xeb')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xec'),require(_0xfd51('0xed')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xee'),require('./api/cloudProvider'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xef'),require(_0xfd51('0xf0')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xf1'),require(_0xfd51('0xf2')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xf3'),require(_0xfd51('0xf4')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xf5'),require(_0xfd51('0xf6')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xf7'),require(_0xfd51('0xf8')));_0x49bb3e[_0xfd51('0x7')]('/api/jira',require(_0xfd51('0xf9')));_0x49bb3e[_0xfd51('0x7')]('/api/rpc',require(_0xfd51('0xfa')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xfb'),require('./api/version'));_0x49bb3e[_0xfd51('0x7')]('/api/system',require('./api/system'));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xfc'),require('./api/pm2'));_0x49bb3e[_0xfd51('0x7')]('/api/webbar',require(_0xfd51('0xfd')));_0x49bb3e['use'](_0xfd51('0xfe'),clientSideLogs);_0x49bb3e[_0xfd51('0x7')](_0xfd51('0xff'),express[_0xfd51('0x100')](path[_0xfd51('0x101')](config[_0xfd51('0x102')],'/apidoc')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x103'),express['static'](path[_0xfd51('0x101')](config[_0xfd51('0x102')],_0xfd51('0x103'))));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x104'),express[_0xfd51('0x100')](path['join'](config[_0xfd51('0x102')],_0xfd51('0x104'))));_0x49bb3e[_0xfd51('0x7')]('/snippet',express[_0xfd51('0x100')](path[_0xfd51('0x101')](config['root'],_0xfd51('0x105'),'3.5.0')));_0x49bb3e[_0xfd51('0x7')](_0xfd51('0x106'),express['static'](path[_0xfd51('0x101')](config[_0xfd51('0x102')],_0xfd51('0x107'))));_0x49bb3e[_0xfd51('0x108')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xfd51('0x109')](errors[0x194]);_0x49bb3e[_0xfd51('0x108')]('/*')[_0xfd51('0x109')](function(_0xf94118,_0x2e805a){_0x2e805a[_0xfd51('0x10a')](path['resolve'](_0x49bb3e[_0xfd51('0x109')](_0xfd51('0x10b'))+_0xfd51('0x10c')));});return _0x49bb3e;});}; \ No newline at end of file +var _0xf2fa=['/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatProactiveAction','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./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/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/cm/lists','./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/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','join','/www','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue'];(function(_0x5c9f56,_0x42c9ad){var _0x2a726b=function(_0x4a13cd){while(--_0x4a13cd){_0x5c9f56['push'](_0x5c9f56['shift']());}};_0x2a726b(++_0x42c9ad);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fa[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xaf2f('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0xaf2f('0x1'));var setupLoggers=require(_0xaf2f('0x2'))[_0xaf2f('0x3')];var clientSideLogs=require(_0xaf2f('0x4'));exports[_0xaf2f('0x5')]=function(_0x45ae14){return setupLoggers(_0x45ae14)[_0xaf2f('0x6')](function(){_0x45ae14['use']('/api/users',require(_0xaf2f('0x7')));_0x45ae14['use'](_0xaf2f('0x8'),require(_0xaf2f('0x9')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xb'),require(_0xaf2f('0xc')));_0x45ae14['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xd'),require(_0xaf2f('0xe')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf'),require(_0xaf2f('0x10')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x11'),require('./api/voiceRecording'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x12'),require(_0xaf2f('0x13')));_0x45ae14['use']('/api/voice/mails',require('./api/voiceMail'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x14'),require('./api/voiceMailMessage'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x15'),require('./api/voiceCallReport'));_0x45ae14[_0xaf2f('0xa')]('/api/voice/dials/reports',require(_0xaf2f('0x16')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x17'),require(_0xaf2f('0x18')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x19'),require(_0xaf2f('0x1a')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x1b'),require(_0xaf2f('0x1c')));_0x45ae14['use'](_0xaf2f('0x1d'),require(_0xaf2f('0x1e')));_0x45ae14['use']('/api/voice/transfers/reports',require(_0xaf2f('0x1f')));_0x45ae14[_0xaf2f('0xa')]('/api/mail/out_servers',require(_0xaf2f('0x20')));_0x45ae14['use'](_0xaf2f('0x21'),require('./api/mailAccount'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x22'),require('./api/mailQueue'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x23'),require(_0xaf2f('0x24')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x25'),require(_0xaf2f('0x26')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x27'),require('./api/mailMessage'));_0x45ae14['use'](_0xaf2f('0x28'),require(_0xaf2f('0x29')));_0x45ae14[_0xaf2f('0xa')]('/api/mail/reports/queue',require(_0xaf2f('0x2a')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x2b'),require(_0xaf2f('0x2c')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x2d'),require('./api/dashboardItem'));_0x45ae14['use']('/api/fax/accounts',require(_0xaf2f('0x2e')));_0x45ae14['use']('/api/fax/applications',require(_0xaf2f('0x2f')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x30'),require(_0xaf2f('0x31')));_0x45ae14[_0xaf2f('0xa')]('/api/fax/messages',require(_0xaf2f('0x32')));_0x45ae14[_0xaf2f('0xa')]('/api/fax/queues',require(_0xaf2f('0x33')));_0x45ae14[_0xaf2f('0xa')]('/api/fax/reports/queue',require(_0xaf2f('0x34')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x35'),require(_0xaf2f('0x36')));_0x45ae14['use'](_0xaf2f('0x37'),require(_0xaf2f('0x38')));_0x45ae14['use']('/api/sms/interactions',require(_0xaf2f('0x39')));_0x45ae14['use'](_0xaf2f('0x3a'),require(_0xaf2f('0x3b')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x3c'),require(_0xaf2f('0x3d')));_0x45ae14['use'](_0xaf2f('0x3e'),require('./api/openchannelAccount'));_0x45ae14['use'](_0xaf2f('0x3f'),require(_0xaf2f('0x40')));_0x45ae14['use']('/api/openchannel/interactions',require(_0xaf2f('0x41')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x42'),require(_0xaf2f('0x43')));_0x45ae14[_0xaf2f('0xa')]('/api/openchannel/queues',require(_0xaf2f('0x44')));_0x45ae14['use'](_0xaf2f('0x45'),require(_0xaf2f('0x46')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x47'),require(_0xaf2f('0x48')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x49'),require(_0xaf2f('0x4a')));_0x45ae14['use']('/api/chat/interactions',require(_0xaf2f('0x4b')));_0x45ae14['use'](_0xaf2f('0x4c'),require('./api/chatMessage'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x4d'),require('./api/chatOfflineMessage'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x4e'),require('./api/chatQueue'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x4f'),require('./api/chatGroup'));_0x45ae14[_0xaf2f('0xa')]('/api/chat/proactive_actions',require(_0xaf2f('0x50')));_0x45ae14['use']('/api/cm/companies',require('./api/cmCompany'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x51'),require('./api/cmContact'));_0x45ae14[_0xaf2f('0xa')]('/api/cm/hopper',require('./api/cmHopper'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x52'),require(_0xaf2f('0x53')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x54'),require(_0xaf2f('0x55')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x56'),require('./api/cmHopperHistory'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x57'),require(_0xaf2f('0x58')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x59'),require('./api/action'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x5a'),require(_0xaf2f('0x5b')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x5c'),require('./api/cannedAnswer'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x5d'),require('./api/disposition'));_0x45ae14[_0xaf2f('0xa')]('/api/conditions',require(_0xaf2f('0x5e')));_0x45ae14[_0xaf2f('0xa')]('/api/intervals',require(_0xaf2f('0x5f')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x60'),require(_0xaf2f('0x61')));_0x45ae14['use']('/api/cdr',require(_0xaf2f('0x62')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x63'),require('./api/voiceQueuesLog'));_0x45ae14['use'](_0xaf2f('0x64'),require('./api/schedule'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x65'),require('./api/sound'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x66'),require(_0xaf2f('0x67')));_0x45ae14['use']('/api/contact_item_types',require(_0xaf2f('0x68')));_0x45ae14['use'](_0xaf2f('0x69'),require(_0xaf2f('0x6a')));_0x45ae14['use'](_0xaf2f('0x6b'),require(_0xaf2f('0x6c')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x6d'),require(_0xaf2f('0x6e')));_0x45ae14['use']('/api/triggers',require('./api/trigger'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x6f'),require('./api/variable'));_0x45ae14['use'](_0xaf2f('0x70'),require(_0xaf2f('0x71')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x72'),require(_0xaf2f('0x73')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x74'),require('./api/analyticCustomReport'));_0x45ae14['use'](_0xaf2f('0x75'),require(_0xaf2f('0x76')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x77'),require('./api/analyticExtractedReport'));_0x45ae14['use'](_0xaf2f('0x78'),require(_0xaf2f('0x79')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x7a'),require(_0xaf2f('0x7b')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x7c'),require(_0xaf2f('0x7d')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x7e'),require(_0xaf2f('0x7f')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x80'),require('./api/intSalesforceConfiguration'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x81'),require(_0xaf2f('0x82')));_0x45ae14['use']('/api/integrations/sugarcrm/accounts',require(_0xaf2f('0x83')));_0x45ae14[_0xaf2f('0xa')]('/api/integrations/sugarcrm/configurations',require(_0xaf2f('0x84')));_0x45ae14['use'](_0xaf2f('0x85'),require(_0xaf2f('0x86')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x87'),require(_0xaf2f('0x88')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x89'),require('./api/intDeskConfiguration'));_0x45ae14[_0xaf2f('0xa')]('/api/integrations/desk/fields',require(_0xaf2f('0x8a')));_0x45ae14['use'](_0xaf2f('0x8b'),require(_0xaf2f('0x8c')));_0x45ae14['use']('/api/integrations/zoho/configurations',require(_0xaf2f('0x8d')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x8e'),require(_0xaf2f('0x8f')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x90'),require(_0xaf2f('0x91')));_0x45ae14['use']('/api/integrations/zendesk/configurations',require(_0xaf2f('0x92')));_0x45ae14['use'](_0xaf2f('0x93'),require(_0xaf2f('0x94')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x95'),require(_0xaf2f('0x96')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x97'),require(_0xaf2f('0x98')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x99'),require(_0xaf2f('0x9a')));_0x45ae14['use'](_0xaf2f('0x9b'),require(_0xaf2f('0x9c')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x9d'),require(_0xaf2f('0x9e')));_0x45ae14['use'](_0xaf2f('0x9f'),require(_0xaf2f('0xa0')));_0x45ae14['use'](_0xaf2f('0xa1'),require('./api/intServicenowAccount'));_0x45ae14[_0xaf2f('0xa')]('/api/integrations/servicenow/configurations',require(_0xaf2f('0xa2')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xa3'),require('./api/intServicenowField'));_0x45ae14['use'](_0xaf2f('0xa4'),require(_0xaf2f('0xa5')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xa6'),require(_0xaf2f('0xa7')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xa8'),require(_0xaf2f('0xa9')));_0x45ae14['use'](_0xaf2f('0xaa'),require(_0xaf2f('0xab')));_0x45ae14['use'](_0xaf2f('0xac'),require(_0xaf2f('0xad')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xae'),require(_0xaf2f('0xaf')));_0x45ae14[_0xaf2f('0xa')]('/api/networks',require(_0xaf2f('0xb0')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xb1'),require(_0xaf2f('0xb2')));_0x45ae14['use'](_0xaf2f('0xb3'),require(_0xaf2f('0xb4')));_0x45ae14['use'](_0xaf2f('0xb5'),require(_0xaf2f('0xb6')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xb7'),require('./api/jscriptyQuestionReport'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xb8'),require(_0xaf2f('0xb9')));_0x45ae14['use'](_0xaf2f('0xba'),require(_0xaf2f('0xbb')));_0x45ae14['use'](_0xaf2f('0xbc'),require(_0xaf2f('0xbd')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xbe'),require(_0xaf2f('0xbf')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xc0'),require(_0xaf2f('0xc1')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xc2'),require(_0xaf2f('0xc3')));_0x45ae14[_0xaf2f('0xa')]('/api/square/odbc',require(_0xaf2f('0xc4')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xc5'),require(_0xaf2f('0xc6')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xc7'),require(_0xaf2f('0xc8')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xc9'),require(_0xaf2f('0xca')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xcb'),require(_0xaf2f('0xcc')));_0x45ae14[_0xaf2f('0xa')]('/api/license',require('./api/license'));_0x45ae14['use'](_0xaf2f('0xcd'),require(_0xaf2f('0xce')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xcf'),require(_0xaf2f('0xd0')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xd1'),require(_0xaf2f('0xd2')));_0x45ae14[_0xaf2f('0xa')]('/api/plugins',require(_0xaf2f('0xd3')));_0x45ae14[_0xaf2f('0xa')]('/api/mail/reports/transfer',require(_0xaf2f('0xd4')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xd5'),require(_0xaf2f('0xd6')));_0x45ae14[_0xaf2f('0xa')]('/api/fax/reports/transfer',require(_0xaf2f('0xd7')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xd8'),require('./api/openchannelTransferReport'));_0x45ae14[_0xaf2f('0xa')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x45ae14['use'](_0xaf2f('0xd9'),require(_0xaf2f('0xda')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xdb'),require(_0xaf2f('0xdc')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xdd'),require(_0xaf2f('0xde')));_0x45ae14['use'](_0xaf2f('0xdf'),require(_0xaf2f('0xe0')));_0x45ae14['use'](_0xaf2f('0xe1'),require(_0xaf2f('0xe2')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xe3'),require(_0xaf2f('0xe4')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xe5'),require(_0xaf2f('0xe6')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xe7'),require('./api/whatsappApplication'));_0x45ae14[_0xaf2f('0xa')]('/api/whatsapp/interactions',require(_0xaf2f('0xe8')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xe9'),require('./api/whatsappMessage'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xea'),require(_0xaf2f('0xeb')));_0x45ae14['use'](_0xaf2f('0xec'),require(_0xaf2f('0xed')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xee'),require('./api/whatsappQueue'));_0x45ae14['use'](_0xaf2f('0xef'),require('./api/cloudProvider'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf0'),require('./api/realtime'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf1'),require(_0xaf2f('0xf2')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf3'),require(_0xaf2f('0xf4')));_0x45ae14['use'](_0xaf2f('0xf5'),require('./api/authGoogle'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf6'),require('./api/authActiveDirectory'));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf7'),require(_0xaf2f('0xf8')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xf9'),require(_0xaf2f('0xfa')));_0x45ae14['use'](_0xaf2f('0xfb'),require(_0xaf2f('0xfc')));_0x45ae14['use'](_0xaf2f('0xfd'),require(_0xaf2f('0xfe')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0xff'),require(_0xaf2f('0x100')));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x101'),require(_0xaf2f('0x102')));_0x45ae14[_0xaf2f('0xa')]('/api/logs',clientSideLogs);_0x45ae14['use']('/apidoc',express[_0xaf2f('0x103')](path['join'](config[_0xaf2f('0x104')],_0xaf2f('0x105'))));_0x45ae14[_0xaf2f('0xa')]('/www',express['static'](path[_0xaf2f('0x106')](config['root'],_0xaf2f('0x107'))));_0x45ae14[_0xaf2f('0xa')]('/demo',express['static'](path[_0xaf2f('0x106')](config['root'],_0xaf2f('0x108'))));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x109'),express[_0xaf2f('0x103')](path[_0xaf2f('0x106')](config[_0xaf2f('0x104')],_0xaf2f('0x10a'),_0xaf2f('0x10b'))));_0x45ae14[_0xaf2f('0xa')](_0xaf2f('0x10c'),express[_0xaf2f('0x103')](path[_0xaf2f('0x106')](config[_0xaf2f('0x104')],_0xaf2f('0x10d'))));_0x45ae14[_0xaf2f('0x10e')](_0xaf2f('0x10f'))[_0xaf2f('0x110')](errors[0x194]);_0x45ae14[_0xaf2f('0x10e')]('/*')[_0xaf2f('0x110')](function(_0x5eb271,_0x174a5e){_0x174a5e[_0xaf2f('0x111')](path[_0xaf2f('0x112')](_0x45ae14[_0xaf2f('0x110')](_0xaf2f('0x113'))+_0xaf2f('0x114')));});return _0x45ae14;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 479fd65..3172386 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d2a=['../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x4b444f,_0x130e1d){var _0x2042ca=function(_0x1ac678){while(--_0x1ac678){_0x4b444f['push'](_0x4b444f['shift']());}};_0x2042ca(++_0x130e1d);}(_0x6d2a,0x12a));var _0xa6d2=function(_0x1a0620,_0x4f40c3){_0x1a0620=_0x1a0620-0x0;var _0x475abc=_0x6d2a[_0x1a0620];return _0x475abc;};'use strict';var jayson=require(_0xa6d2('0x0'));var _=require(_0xa6d2('0x1'));var config=require(_0xa6d2('0x2'));exports['listen']=function(){return new Promise(function(_0xa21060,_0x588c7d){var _0x1cff5e={};_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/user/user.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/voiceExtension/voiceExtension.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x4')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x5')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x6')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x7')));_0x1cff5e=_['merge'](_0x1cff5e,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x8')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/memberReport/memberReport.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x9')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0xa')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0xb')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0xc')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0xd')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0xe')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/mailMessage/mailMessage.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/mailApplication/mailApplication.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0xf')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x10')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/faxApplication/faxApplication.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x11')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x12')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x13')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x14')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x15')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x16')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x17')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x18')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x19')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1a')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1b')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1c')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1d')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1e')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/chatQueue/chatQueue.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x1f')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x20')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x21')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x22')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x23')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x24')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x25')));_0x1cff5e=_['merge'](_0x1cff5e,require('../api/sound/sound.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x26')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/template/template.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x27')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x28')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x29')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x2a')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x2b')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x2c')));_0x1cff5e=_['merge'](_0x1cff5e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x2d')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x2e')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x2f')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x30')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x31')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x32')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/setting/setting.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/squareOdbc/squareOdbc.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require('../api/squareProject/squareProject.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x33')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/squareMessage/squareMessage.rpc'));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x34')));_0x1cff5e=_['merge'](_0x1cff5e,require(_0xa6d2('0x35')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x36')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x37')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x38')));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1cff5e=_[_0xa6d2('0x3')](_0x1cff5e,require(_0xa6d2('0x39')));var _0x1be7db=jayson[_0xa6d2('0x3a')](_0x1cff5e)[_0xa6d2('0x3b')]();var _0x33ab71=config[_0xa6d2('0x3c')][_0xa6d2('0x3d')]||config[_0xa6d2('0x3d')]+0x1;var _0x439ac1=config[_0xa6d2('0x3c')]['ip']||_0xa6d2('0x3e');_0x1be7db['on'](_0xa6d2('0x3f'),function(_0x1b1ce2){return _0x588c7d(_0x1b1ce2);});_0x1be7db[_0xa6d2('0x40')](_0x33ab71,_0x439ac1,function(){console[_0xa6d2('0x41')](_0xa6d2('0x42'),_0x439ac1,_0x33ab71);require(_0xa6d2('0x43'))[_0xa6d2('0x44')]();return _0xa21060(_0xa6d2('0x45')+_0x439ac1+':'+_0x33ab71);});});}; \ No newline at end of file +var _0x195a=['../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x195a,0xf2));var _0xa195=function(_0xd7b91e,_0x245e37){_0xd7b91e=_0xd7b91e-0x0;var _0x1179ba=_0x195a[_0xd7b91e];return _0x1179ba;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa195('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x32b261,_0x3d8aca){var _0x3a8cb4={};_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x3')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x4')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x5')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x6')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x7')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/memberReport/memberReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x8')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x9')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0xa')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0xb')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/mailInteraction/mailInteraction.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0xc')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0xd')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0xe')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/faxAccount/faxAccount.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/faxApplication/faxApplication.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0xf')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x10')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x11')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x12')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/smsAccount/smsAccount.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x13')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x14')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x15')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x16')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x17')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x18')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x19')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/chatInteraction/chatInteraction.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x1a')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/chatQueue/chatQueue.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x1b')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/cmHopper/cmHopper.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x1c')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x1d')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x1e')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x1f')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/sound/sound.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x20')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/trigger/trigger.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x21')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x22')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x23')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x24')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x25')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x26')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x27')));_0x3a8cb4=_['merge'](_0x3a8cb4,require(_0xa195('0x28')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x29')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2a')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2b')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/squareOdbc/squareOdbc.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2c')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2d')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2e')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require('../api/campaign/campaign.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x2f')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x30')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x31')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x32')));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x33')));_0x3a8cb4=_['merge'](_0x3a8cb4,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3a8cb4=_[_0xa195('0x1')](_0x3a8cb4,require(_0xa195('0x34')));var _0x819482=jayson['server'](_0x3a8cb4)[_0xa195('0x35')]();var _0x40f6d1=config[_0xa195('0x36')][_0xa195('0x37')]||config[_0xa195('0x37')]+0x1;var _0x1faf16=config[_0xa195('0x36')]['ip']||_0xa195('0x38');_0x819482['on'](_0xa195('0x39'),function(_0x1deac9){return _0x3d8aca(_0x1deac9);});_0x819482[_0xa195('0x3a')](_0x40f6d1,_0x1faf16,function(){console[_0xa195('0x3b')](_0xa195('0x3c'),_0x1faf16,_0x40f6d1);require('../config/triggers')[_0xa195('0x3d')]();return _0x32b261(_0xa195('0x3e')+_0x1faf16+':'+_0x40f6d1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f17ebbe..bfaa332 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 _0x0eb2=['indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','prototype','sync','answer','sendRequest','ANSWER','getData','beep','noop','VERBOSE\x20\x22%s\x22','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','exec','AGI','WAIT','label','exports','util','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','replace','result='];(function(_0x25601d,_0x564bd7){var _0x21ea8b=function(_0x7ab135){while(--_0x7ab135){_0x25601d['push'](_0x25601d['shift']());}};_0x21ea8b(++_0x564bd7);}(_0x0eb2,0x11c));var _0x20eb=function(_0x345865,_0x1d878d){_0x345865=_0x345865-0x0;var _0x2e14f4=_0x0eb2[_0x345865];return _0x2e14f4;};'use strict';var util=require(_0x20eb('0x0'));var _=require('lodash');var EventEmitter=require(_0x20eb('0x1'))[_0x20eb('0x2')];var AGIReply=require(_0x20eb('0x3'));var AGIError=require(_0x20eb('0x4'));function AGIChannel(_0x275df0){var _0x525ecf=this,_0x118292=new AGIReply(),_0x59e891=![],_0x48d831={};EventEmitter['call'](_0x525ecf);_0x275df0[_0x20eb('0x5')](_0x20eb('0x6'));_0x275df0[_0x20eb('0x7')](0x8*0x3c*0x3c*0x3e8);_0x118292['setEncoding'](_0x20eb('0x6'));_0x118292['on'](_0x20eb('0x8'),function(_0x4443ea){for(var _0x153a36 in _0x4443ea){_0x525ecf[_0x153a36]=_0x4443ea[_0x153a36];}_0x525ecf[_0x20eb('0x9')](_0x20eb('0xa'));});_0x118292['on'](_0x20eb('0xb'),function(_0x178e1a){if(_0x178e1a[_0x20eb('0xc')]()==_0x20eb('0xd')){_0x525ecf[_0x20eb('0x9')](_0x20eb('0xd'));return;}if(_0x178e1a[_0x20eb('0xe')](0x0,0xb)==_0x20eb('0xf')){_0x59e891=!![];}if(_0x59e891){_0x48d831['rx']+=_0x178e1a+'\x0a';if(_0x178e1a['search'](_0x20eb('0x10'))!=-0x1){_0x59e891=![];}}else{_0x48d831['rx']=_0x178e1a;}if(_0x59e891){return;}if(typeof _0x48d831['cb']=='function'){var _0x120651=_0x48d831['rx'][_0x20eb('0xe')](0x0,0x3),_0x5371a8=null,_0x2ffef9=null;_0x120651=parseInt(_0x120651);if(isNaN(_0x120651)){_0x48d831['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x20eb('0x11')});return;}if(_0x120651!=0xc8){_0x48d831['cb'](null,{'code':_0x120651,'result':-0x1,'extra':'KO'});return;}_0x5371a8=_0x48d831['rx'][_0x20eb('0xe')](0x4)[_0x20eb('0x12')](_0x20eb('0x13'),'');if(_0x5371a8[_0x20eb('0x14')]('\x20')!=-0x1){_0x5371a8=_0x5371a8[_0x20eb('0x15')](0x0,_0x5371a8[_0x20eb('0x14')]('\x20'));}if(_[_0x20eb('0x16')](_0x5371a8,'-1')){_0x5371a8=parseInt(_0x5371a8);}_0x2ffef9=_0x48d831['rx'][_0x20eb('0x17')]('\x20');if(_0x2ffef9[_0x20eb('0x18')]==0x3){_0x2ffef9=_0x2ffef9[0x2][_0x20eb('0xe')](0x1,_0x2ffef9[0x2][_0x20eb('0x18')]-0x1);}else if(_0x2ffef9[_0x20eb('0x18')]>0x3){var _0x5a6d1d=/\((.+)\)/;var _0x1c86de=_0x48d831['rx']['match'](_0x5a6d1d);if(_0x1c86de){_0x2ffef9=_0x1c86de[0x1];}else{_0x2ffef9=null;}}else{_0x2ffef9=null;}_0x48d831['cb'](null,{'code':_0x120651,'result':_0x5371a8,'extra':_0x2ffef9});}});_0x275df0['on'](_0x20eb('0x19'),function(_0x21765e){_0x525ecf[_0x20eb('0x9')](_0x20eb('0x19'),new AGIError(_0x20eb('0x1a'),_0x21765e[_0x20eb('0x1b')]));});_0x275df0['on'](_0x20eb('0x1c'),function(){_0x525ecf['emit'](_0x20eb('0x1c'),new AGIError(_0x20eb('0x1d')));});_0x275df0['on']('timeout',function(){_0x525ecf[_0x20eb('0x9')](_0x20eb('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x275df0[_0x20eb('0x1f')]();});_0x275df0[_0x20eb('0x20')](_0x118292);this[_0x20eb('0x21')]=function(_0x4b199c,_0x989b4){var _0x4b199c=_0x4b199c||'',_0x989b4=typeof _0x989b4=='function'?_0x989b4:new Function();_0x48d831={'tx':_0x4b199c,'rx':'','cb':_0x989b4};_0x275df0[_0x20eb('0x22')](_0x4b199c+'\x0a');},this[_0x20eb('0x1c')]=function(){_0x275df0[_0x20eb('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x20eb('0x23')]['sendRequest']=function(_0x271f6b){return this[_0x20eb('0x21')][_0x20eb('0x24')](this,_0x271f6b);};AGIChannel[_0x20eb('0x23')][_0x20eb('0x25')]=function(){return this[_0x20eb('0x26')](_0x20eb('0x27'));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x28')]=function(_0x58b8c3,_0x2f2ffa,_0x33a365){_0x58b8c3=_0x58b8c3===undefined?_0x20eb('0x29'):_0x58b8c3;_0x2f2ffa=_0x2f2ffa===undefined?'5':_0x2f2ffa;_0x33a365=_0x33a365===undefined?'1':_0x33a365;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x58b8c3,_0x2f2ffa*0x3e8,_0x33a365));};AGIChannel['prototype'][_0x20eb('0x2a')]=function(_0xd3592a){_0xd3592a=_0xd3592a||'NO\x20MESSAGE';return this[_0x20eb('0x26')](util['format'](_0x20eb('0x2b'),_0xd3592a));};AGIChannel['prototype']['exec']=function(_0x125a23,_0x3999ec){if(_['isArray'](_0x3999ec)){return this['sendRequest'](util[_0x20eb('0x2c')](_0x20eb('0x2d'),_0x125a23,_0x3999ec['join'](',')));}return this[_0x20eb('0x26')](util[_0x20eb('0x2c')]('EXEC\x20%s\x20%s',_0x125a23,_0x3999ec));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x2e')]=function(_0x56847a){return this[_0x20eb('0x26')](util['format'](_0x20eb('0x2f'),_0x56847a));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x30')]=function(_0x51a314){return this[_0x20eb('0x26')](util[_0x20eb('0x2c')](_0x20eb('0x31'),_0x51a314));};AGIChannel[_0x20eb('0x23')]['setPriority']=function(_0x66a4ee){return this[_0x20eb('0x26')](util[_0x20eb('0x2c')](_0x20eb('0x32'),_0x66a4ee));};AGIChannel[_0x20eb('0x23')][_0x20eb('0xd')]=function(){return this[_0x20eb('0x26')](_0x20eb('0x33'));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x34')]=function(_0xe5f7b2,_0x503eb7){var _0x35ef9c=_[_0x20eb('0x35')](_0x503eb7)||_[_0x20eb('0x36')](_0x503eb7)?_0x503eb7[_0x20eb('0x37')]():_0x503eb7;return this['sendRequest'](util[_0x20eb('0x2c')](_0x20eb('0x38'),_0xe5f7b2,_0x35ef9c?_0x35ef9c[_0x20eb('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x39')]=function(_0x185c0c,_0x1254c6){return this[_0x20eb('0x26')](util[_0x20eb('0x2c')](_0x20eb('0x3a'),_0x185c0c,_0x1254c6));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x3b')]=function(_0x193c9c,_0x588837){return this[_0x20eb('0x26')](util['format'](_0x20eb('0x3c'),_0x193c9c,_0x588837));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x3d')]=function(_0x341f62,_0x370e5c){return this[_0x20eb('0x26')](util[_0x20eb('0x2c')](_0x20eb('0x3e'),_0x341f62,_0x370e5c));};AGIChannel[_0x20eb('0x23')]['continueAt']=function(_0x330903,_0x4cba6e,_0x30aeaa){_0x4cba6e=_0x4cba6e||this['extension'];_0x30aeaa=_0x30aeaa||0x1;this[_0x20eb('0x2e')](_0x330903);this[_0x20eb('0x30')](_0x4cba6e);this['setPriority'](_0x30aeaa);return this[_0x20eb('0x2a')](util[_0x20eb('0x2c')](_0x20eb('0x3f'),_0x330903,_0x4cba6e,_0x30aeaa));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x40')]=function(_0xb9b902){return this[_0x20eb('0x26')](util[_0x20eb('0x2c')](_0x20eb('0x41'),_0xb9b902));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x42')]=function(_0x19a6e8,_0xeb74d2,_0x265b02,_0x212092,_0xa59e81,_0x1fbe29){_0xeb74d2=_0xeb74d2||_0x20eb('0x43');_0x265b02=_0x265b02||'';_0x212092=_0x212092===undefined?-0x1:_0x212092==='-1'?-0x1:_0x212092*0x3e8;_0xa59e81=_0xa59e81===undefined?'':'s='+_0xa59e81;_0x1fbe29=_0x1fbe29?_0x20eb('0x44'):'';return this['sendRequest'](util[_0x20eb('0x2c')](_0x20eb('0x45'),_0x19a6e8,_0xeb74d2,_0x265b02,_0x212092,_0x1fbe29,_0xa59e81));};AGIChannel[_0x20eb('0x23')][_0x20eb('0x46')]=function(_0xcd2491,_0x530c8f){_0x530c8f=_0x530c8f||'';return this[_0x20eb('0x26')](util[_0x20eb('0x2c')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xcd2491,_0x530c8f));};AGIChannel[_0x20eb('0x23')]['agi']=function(_0x2701e6){return this[_0x20eb('0x47')](_0x20eb('0x48'),_0x2701e6);};AGIChannel[_0x20eb('0x23')]['wait']=function(_0x6fca4e){return this[_0x20eb('0x47')](_0x20eb('0x49'),_0x6fca4e);};AGIChannel['prototype'][_0x20eb('0x19')]=function(_0x5190a1,_0x27bd65){this[_0x20eb('0x2a')](util[_0x20eb('0x2c')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5190a1['id'],_0x5190a1[_0x20eb('0x4a')],_0x27bd65));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x20eb('0x4b')]=AGIChannel; \ No newline at end of file +var _0xc3d5=['exports','lodash','call','setTimeout','setEncoding','emit','hangup','substring','function','no\x20code','substr','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0xc3d5,0x16f));var _0x5c3d=function(_0x54f804,_0x2992c5){_0x54f804=_0x54f804-0x0;var _0x418607=_0xc3d5[_0x54f804];return _0x418607;};'use strict';var util=require('util');var _=require(_0x5c3d('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x2ca6d8){var _0x17021e=this,_0x5671de=new AGIReply(),_0x25d40b=![],_0x18e693={};EventEmitter[_0x5c3d('0x1')](_0x17021e);_0x2ca6d8['setEncoding']('utf8');_0x2ca6d8[_0x5c3d('0x2')](0x8*0x3c*0x3c*0x3e8);_0x5671de[_0x5c3d('0x3')]('utf8');_0x5671de['on']('headers',function(_0x54f866){for(var _0xeb27d5 in _0x54f866){_0x17021e[_0xeb27d5]=_0x54f866[_0xeb27d5];}_0x17021e[_0x5c3d('0x4')]('ready');});_0x5671de['on']('line',function(_0x2bdb1f){if(_0x2bdb1f['toLowerCase']()==_0x5c3d('0x5')){_0x17021e[_0x5c3d('0x4')](_0x5c3d('0x5'));return;}if(_0x2bdb1f[_0x5c3d('0x6')](0x0,0xb)=='520-Invalid'){_0x25d40b=!![];}if(_0x25d40b){_0x18e693['rx']+=_0x2bdb1f+'\x0a';if(_0x2bdb1f['search']('520\x20End\x20of\x20proper')!=-0x1){_0x25d40b=![];}}else{_0x18e693['rx']=_0x2bdb1f;}if(_0x25d40b){return;}if(typeof _0x18e693['cb']==_0x5c3d('0x7')){var _0x5478db=_0x18e693['rx'][_0x5c3d('0x6')](0x0,0x3),_0x19b6db=null,_0x1d98ac=null;_0x5478db=parseInt(_0x5478db);if(isNaN(_0x5478db)){_0x18e693['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5c3d('0x8')});return;}if(_0x5478db!=0xc8){_0x18e693['cb'](null,{'code':_0x5478db,'result':-0x1,'extra':'KO'});return;}_0x19b6db=_0x18e693['rx'][_0x5c3d('0x6')](0x4)['replace']('result=','');if(_0x19b6db['indexOf']('\x20')!=-0x1){_0x19b6db=_0x19b6db[_0x5c3d('0x9')](0x0,_0x19b6db[_0x5c3d('0xa')]('\x20'));}if(_['startsWith'](_0x19b6db,'-1')){_0x19b6db=parseInt(_0x19b6db);}_0x1d98ac=_0x18e693['rx'][_0x5c3d('0xb')]('\x20');if(_0x1d98ac[_0x5c3d('0xc')]==0x3){_0x1d98ac=_0x1d98ac[0x2][_0x5c3d('0x6')](0x1,_0x1d98ac[0x2][_0x5c3d('0xc')]-0x1);}else if(_0x1d98ac[_0x5c3d('0xc')]>0x3){var _0x111d6a=/\((.+)\)/;var _0x4f8d09=_0x18e693['rx']['match'](_0x111d6a);if(_0x4f8d09){_0x1d98ac=_0x4f8d09[0x1];}else{_0x1d98ac=null;}}else{_0x1d98ac=null;}_0x18e693['cb'](null,{'code':_0x5478db,'result':_0x19b6db,'extra':_0x1d98ac});}});_0x2ca6d8['on'](_0x5c3d('0xd'),function(_0xc3cf04){_0x17021e[_0x5c3d('0x4')](_0x5c3d('0xd'),new AGIError(_0x5c3d('0xe'),_0xc3cf04[_0x5c3d('0xf')]));});_0x2ca6d8['on'](_0x5c3d('0x10'),function(){_0x17021e[_0x5c3d('0x4')](_0x5c3d('0x10'),new AGIError(_0x5c3d('0x11')));});_0x2ca6d8['on'](_0x5c3d('0x12'),function(){_0x17021e[_0x5c3d('0x4')]('timeout',new AGIError(_0x5c3d('0x13')));_0x2ca6d8[_0x5c3d('0x14')]();});_0x2ca6d8['pipe'](_0x5671de);this['command']=function(_0x296899,_0xbb3514){var _0x296899=_0x296899||'',_0xbb3514=typeof _0xbb3514==_0x5c3d('0x7')?_0xbb3514:new Function();_0x18e693={'tx':_0x296899,'rx':'','cb':_0xbb3514};_0x2ca6d8[_0x5c3d('0x15')](_0x296899+'\x0a');},this[_0x5c3d('0x10')]=function(){_0x2ca6d8[_0x5c3d('0x14')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x17')]=function(_0x37164f){return this['command']['sync'](this,_0x37164f);};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x18')]=function(){return this['sendRequest'](_0x5c3d('0x19'));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x1a')]=function(_0x19a100,_0x5b8d09,_0x7bca50){_0x19a100=_0x19a100===undefined?_0x5c3d('0x1b'):_0x19a100;_0x5b8d09=_0x5b8d09===undefined?'5':_0x5b8d09;_0x7bca50=_0x7bca50===undefined?'1':_0x7bca50;return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x1d'),_0x19a100,_0x5b8d09*0x3e8,_0x7bca50));};AGIChannel['prototype'][_0x5c3d('0x1e')]=function(_0x554295){_0x554295=_0x554295||'NO\x20MESSAGE';return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x1f'),_0x554295));};AGIChannel['prototype'][_0x5c3d('0x20')]=function(_0x5d1fee,_0x1d247e){if(_[_0x5c3d('0x21')](_0x1d247e)){return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x22'),_0x5d1fee,_0x1d247e[_0x5c3d('0x23')](',')));}return this['sendRequest'](util[_0x5c3d('0x1c')](_0x5c3d('0x22'),_0x5d1fee,_0x1d247e));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x24')]=function(_0x5d105b){return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x25'),_0x5d105b));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x26')]=function(_0x3eff65){return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x27'),_0x3eff65));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x28')]=function(_0x19bce0){return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')]('SET\x20PRIORITY\x20%s',_0x19bce0));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x5')]=function(){return this[_0x5c3d('0x17')]('HANGUP');};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x29')]=function(_0x3bc544,_0xd2091b){var _0x1d07c9=_[_0x5c3d('0x2a')](_0xd2091b)||_['isNumber'](_0xd2091b)?_0xd2091b[_0x5c3d('0x2b')]():_0xd2091b;return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x2c'),_0x3bc544,_0x1d07c9?_0x1d07c9[_0x5c3d('0x2b')]()[_0x5c3d('0x2d')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x2e')]=function(_0x1bbc2d,_0xc8a706){return this['sendRequest'](util['format'](_0x5c3d('0x2f'),_0x1bbc2d,_0xc8a706));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x30')]=function(_0x5ccca9,_0x191be3){return this[_0x5c3d('0x17')](util['format'](_0x5c3d('0x31'),_0x5ccca9,_0x191be3));};AGIChannel[_0x5c3d('0x16')]['sayPhonetic']=function(_0x2de33d,_0x466087){return this[_0x5c3d('0x17')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2de33d,_0x466087));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x32')]=function(_0x2ba5aa,_0x3cff07,_0x592abc){_0x3cff07=_0x3cff07||this[_0x5c3d('0x33')];_0x592abc=_0x592abc||0x1;this[_0x5c3d('0x24')](_0x2ba5aa);this[_0x5c3d('0x26')](_0x3cff07);this[_0x5c3d('0x28')](_0x592abc);return this[_0x5c3d('0x1e')](util[_0x5c3d('0x1c')](_0x5c3d('0x34'),_0x2ba5aa,_0x3cff07,_0x592abc));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x35')]=function(_0x579c69){return this[_0x5c3d('0x17')](util[_0x5c3d('0x1c')](_0x5c3d('0x36'),_0x579c69));};AGIChannel[_0x5c3d('0x16')]['recordFile']=function(_0x453c6,_0x4aab3c,_0x2f4a0c,_0x5f57ba,_0x558536,_0x39bbd5){_0x4aab3c=_0x4aab3c||'wav';_0x2f4a0c=_0x2f4a0c||'';_0x5f57ba=_0x5f57ba===undefined?-0x1:_0x5f57ba==='-1'?-0x1:_0x5f57ba*0x3e8;_0x558536=_0x558536===undefined?'':'s='+_0x558536;_0x39bbd5=_0x39bbd5?'BEEP':'';return this[_0x5c3d('0x17')](util['format'](_0x5c3d('0x37'),_0x453c6,_0x4aab3c,_0x2f4a0c,_0x5f57ba,_0x39bbd5,_0x558536));};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0x38')]=function(_0x21e05f,_0x3ebaee){_0x3ebaee=_0x3ebaee||'';return this['sendRequest'](util[_0x5c3d('0x1c')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x21e05f,_0x3ebaee));};AGIChannel['prototype'][_0x5c3d('0x39')]=function(_0x5a1394){return this[_0x5c3d('0x20')](_0x5c3d('0x3a'),_0x5a1394);};AGIChannel[_0x5c3d('0x16')]['wait']=function(_0x5b7632){return this[_0x5c3d('0x20')]('WAIT',_0x5b7632);};AGIChannel[_0x5c3d('0x16')][_0x5c3d('0xd')]=function(_0x5a19b6,_0x24f8e2){this[_0x5c3d('0x1e')](util[_0x5c3d('0x1c')](_0x5c3d('0x3b'),_0x5a19b6['id'],_0x5a19b6['label'],_0x24f8e2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5c3d('0x3c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 79baad9..ec4723b 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 _0xc2dd=['format','apply','message','exports','util','Undefined\x20error.','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.','Missing\x20\x27ivr.agi_network_script\x27.','push'];(function(_0x593b0f,_0x17009c){var _0x2b93c1=function(_0x43cab8){while(--_0x43cab8){_0x593b0f['push'](_0x593b0f['shift']());}};_0x2b93c1(++_0x17009c);}(_0xc2dd,0x94));var _0xdc2d=function(_0x4d40c2,_0x2368ea){_0x4d40c2=_0x4d40c2-0x0;var _0x20baa3=_0xc2dd[_0x4d40c2];return _0x20baa3;};'use strict';var util=require(_0xdc2d('0x0'));var error={'E_AGI_UNDEFINED':_0xdc2d('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xdc2d('0x2'),'E_AGI_SERVER_CLOSE':_0xdc2d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xdc2d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xdc2d('0x5'),'E_AGI_SOCKET_ERROR':_0xdc2d('0x6'),'E_AGI_SOCKET_CLOSE':_0xdc2d('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xdc2d('0x8'),'E_AGI_COMMAND_EMPTY':_0xdc2d('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdc2d('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xa295ac){var _0xa295ac=_0xa295ac||null,_0x226262=_0x226262||[],_0x2ab769=0x1,_0xb7e0ed='';if(!error[_0xa295ac]){_0xa295ac='E_AGI_UNDEFINED';}_0x226262[_0xdc2d('0xb')](error[_0xa295ac]);while(arguments[_0x2ab769]){_0x226262[_0xdc2d('0xb')](arguments[_0x2ab769]);_0x2ab769++;}_0xb7e0ed=util[_0xdc2d('0xc')][_0xdc2d('0xd')](util,_0x226262);this[_0xdc2d('0xe')]=_0xb7e0ed;this['name']=_0xa295ac;}module[_0xdc2d('0xf')]=AGIError; \ No newline at end of file +var _0xb716=['format','apply','message','name','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','push'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xb716,0x12f));var _0x6b71=function(_0x2a9fb9,_0x105224){_0x2a9fb9=_0x2a9fb9-0x0;var _0x972b37=_0xb716[_0x2a9fb9];return _0x972b37;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x6b71('0x0'),'E_AGI_SERVER_ERROR':_0x6b71('0x1'),'E_AGI_SERVER_CLOSE':_0x6b71('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6b71('0x3'),'E_AGI_SOCKET_ERROR':_0x6b71('0x4'),'E_AGI_SOCKET_CLOSE':_0x6b71('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x6b71('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6b71('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x10ea00){var _0x10ea00=_0x10ea00||null,_0x3d9462=_0x3d9462||[],_0x47e2b4=0x1,_0x16aa65='';if(!error[_0x10ea00]){_0x10ea00='E_AGI_UNDEFINED';}_0x3d9462['push'](error[_0x10ea00]);while(arguments[_0x47e2b4]){_0x3d9462[_0x6b71('0x8')](arguments[_0x47e2b4]);_0x47e2b4++;}_0x16aa65=util[_0x6b71('0x9')][_0x6b71('0xa')](util,_0x3d9462);this[_0x6b71('0xb')]=_0x16aa65;this[_0x6b71('0xc')]=_0x10ea00;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0c6d00f..593aa4b 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 _0xca3f=['E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','agi','emit'];(function(_0x3816f1,_0x3d14f9){var _0x541c4e=function(_0x4e568f){while(--_0x4e568f){_0x3816f1['push'](_0x3816f1['shift']());}};_0x541c4e(++_0x3d14f9);}(_0xca3f,0xc5));var _0xfca3=function(_0x32599b,_0x1b803f){_0x32599b=_0x32599b-0x0;var _0x4ac7f2=_0xca3f[_0x32599b];return _0x4ac7f2;};'use strict';var _=require(_0xfca3('0x0'));var EventEmitter=require(_0xfca3('0x1'))[_0xfca3('0x2')];var Redis=require(_0xfca3('0x3'));var AGIError=require(_0xfca3('0x4'));var config=require(_0xfca3('0x5'));config[_0xfca3('0x6')]=_[_0xfca3('0x7')](config[_0xfca3('0x6')],{'host':_0xfca3('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xfca3('0x6')]);sub['subscribe'](_0xfca3('0x9'),function(_0x582b32){if(_0x582b32)return eventEmitter[_0xfca3('0xa')]('error',new AGIError(_0xfca3('0xb'),_0x582b32));});sub['on'](_0xfca3('0xc'),function(_0x3eaf77,_0x3041a1){if(_0x3eaf77!==_0xfca3('0x9'))return;try{var _0x11c9da=JSON[_0xfca3('0xd')](_0x3041a1);eventEmitter['emit'](_0xfca3('0xe'),_0x11c9da);}catch(_0x38a9f7){eventEmitter[_0xfca3('0xa')](_0xfca3('0xf'),new AGIError(_0xfca3('0xb'),_0x38a9f7));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xb16b=['redis','defaults','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','lodash','events','EventEmitter','ioredis','../../config/environment'];(function(_0x5d1d99,_0x10ca23){var _0x2957ec=function(_0x4f4ba){while(--_0x4f4ba){_0x5d1d99['push'](_0x5d1d99['shift']());}};_0x2957ec(++_0x10ca23);}(_0xb16b,0x7b));var _0xbb16=function(_0x132399,_0x1c4b0f){_0x132399=_0x132399-0x0;var _0x2a27e9=_0xb16b[_0x132399];return _0x2a27e9;};'use strict';var _=require(_0xbb16('0x0'));var EventEmitter=require(_0xbb16('0x1'))[_0xbb16('0x2')];var Redis=require(_0xbb16('0x3'));var AGIError=require('./error');var config=require(_0xbb16('0x4'));config[_0xbb16('0x5')]=_[_0xbb16('0x6')](config[_0xbb16('0x5')],{'host':_0xbb16('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xbb16('0x5')]);sub[_0xbb16('0x8')](_0xbb16('0x9'),function(_0x2fd3d5){if(_0x2fd3d5)return eventEmitter[_0xbb16('0xa')](_0xbb16('0xb'),new AGIError(_0xbb16('0xc'),_0x2fd3d5));});sub['on'](_0xbb16('0xd'),function(_0x54e02e,_0x215315){if(_0x54e02e!=='agi')return;try{var _0x3663ee=JSON[_0xbb16('0xe')](_0x215315);eventEmitter['emit'](_0xbb16('0xf'),_0x3663ee);}catch(_0x2a68d0){eventEmitter[_0xbb16('0xa')]('error',new AGIError(_0xbb16('0xc'),_0x2a68d0));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5ca8b8e..6a41c61 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 _0x3f09=['relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','push','size'];(function(_0x1bf96d,_0x1ee9bb){var _0x469774=function(_0xeb9399){while(--_0xeb9399){_0x1bf96d['push'](_0x1bf96d['shift']());}};_0x469774(++_0x1ee9bb);}(_0x3f09,0xa2));var _0x93f0=function(_0x347cee,_0x4c36f6){_0x347cee=_0x347cee-0x0;var _0x26d403=_0x3f09[_0x347cee];return _0x26d403;};'use strict';var _=require(_0x93f0('0x0'));var logger=require(_0x93f0('0x1'))('agi');var verticesWithRetry=[_0x93f0('0x2'),_0x93f0('0x3'),_0x93f0('0x4')];var Graph=function(){this[_0x93f0('0x5')]={};this['edges']={};this[_0x93f0('0x6')]=0x0;};Graph[_0x93f0('0x7')][_0x93f0('0x8')]=function(_0x18d915){this[_0x93f0('0x5')][_0x18d915['id']]=_0x18d915;this['edges'][_0x18d915['id']]=[];};Graph[_0x93f0('0x7')]['addEdge']=function(_0x5f36ca,_0x209105,_0x22127f){this[_0x93f0('0x9')][_0x5f36ca][_0x93f0('0xa')]({'target':_0x209105,'condition':_0x22127f});this['numberOfEdges']+=0x1;};Graph[_0x93f0('0x7')][_0x93f0('0xb')]=function(){return _['size'](this['vertices']);};Graph[_0x93f0('0x7')][_0x93f0('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x93f0('0x7')][_0x93f0('0xd')]=function(_0x57bd9d){return this[_0x93f0('0x5')][_0x57bd9d];};Graph[_0x93f0('0x7')][_0x93f0('0xe')]=function(_0x5e763d,_0x4e9d57){if(!this['vertices'][_0x5e763d]){return logger[_0x93f0('0xf')](_0x93f0('0x10'));}var _0x5afcd6=_0x4e9d57(this[_0x93f0('0x5')][_0x5e763d]);if(!_0x5afcd6){return logger['info']('stop\x20traverse');}if(this[_0x93f0('0x9')][_0x5e763d][_0x93f0('0x11')]===0x0){return logger[_0x93f0('0xf')](_0x93f0('0x12'));}for(var _0x3ba433=0x0,_0x2b6ff7=[],_0x18ddb9=![];_0x3ba433\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','indexOf','substring','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','find','handleNotFound','production','getLicense','voice','callysquare'];(function(_0x207e96,_0x32bfa7){var _0x332533=function(_0x43036f){while(--_0x43036f){_0x207e96['push'](_0x207e96['shift']());}};_0x332533(++_0x32bfa7);}(_0x4625,0x125));var _0x5462=function(_0x30876f,_0x5def7f){_0x30876f=_0x30876f-0x0;var _0x41c660=_0x4625[_0x30876f];return _0x41c660;};'use strict';var _=require(_0x5462('0x0'));var syncho=require(_0x5462('0x1'));var util=require(_0x5462('0x2'));var config=require('../../config/environment');var logger=require(_0x5462('0x3'))(_0x5462('0x4'));var utilLicense=require(_0x5462('0x5'));var rpc=require('./rpc');var Project=require(_0x5462('0x6'));var AGIEmitter=require(_0x5462('0x7'))[_0x5462('0x8')];var projects=[];config[_0x5462('0x4')]=_['defaults'](config[_0x5462('0x4')],{'ip':_0x5462('0x9'),'port':0x11dd});AGIEmitter['on'](_0x5462('0xa'),projectUpdateHandler);function connectionHandler(_0x3c1161){process[_0x5462('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3c1161);agiHandler(_0x3c1161);}catch(_0xa49ed1){logger[_0x5462('0xc')](_0xa49ed1[_0x5462('0xd')]);}});});}function projectUpdateHandler(_0x65d1a7){try{var _0x22844e=_[_0x5462('0xe')](projects,['id',_0x65d1a7['id']]);if(_0x22844e>-0x1){if(_0x65d1a7[_0x5462('0xf')]===!![]){projects[_0x5462('0x10')](_0x22844e,0x1);}else{projects[_0x22844e]=_0x65d1a7;}}else{projects[_0x5462('0x11')](_0x65d1a7);}}catch(_0x374b72){logger['error'](_0x374b72[_0x5462('0xd')]);}}function listeningHandler(){console['log'](_0x5462('0x12'),config[_0x5462('0x4')]['port']);logger[_0x5462('0x13')](util['format'](_0x5462('0x14'),config[_0x5462('0x4')]['ip'],config[_0x5462('0x4')][_0x5462('0x15')]));}function errorHandler(_0xc04cdc){if(_0xc04cdc&&_0xc04cdc[_0x5462('0x16')]&&_0xc04cdc[_0x5462('0x17')]){logger[_0x5462('0xc')](util[_0x5462('0x18')](_0x5462('0x19'),_0xc04cdc[_0x5462('0x16')],_0xc04cdc[_0x5462('0x17')]));}else{logger[_0x5462('0xc')](util[_0x5462('0x18')](_0x5462('0x1a'),_0xc04cdc[_0x5462('0xd')]));}}function closeHandler(){logger['info'](util['format'](_0x5462('0x1b'),this[_0x5462('0x1c')],this[_0x5462('0x1d')],this[_0x5462('0x1e')],this[_0x5462('0x1f')],this[_0x5462('0x20')]));try{createSquareReport(this);}catch(_0x5c3a9a){logger[_0x5462('0xc')](_0x5c3a9a[_0x5462('0xd')]);}}function timeoutHandler(){logger[_0x5462('0x13')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x5462('0x1d')],this[_0x5462('0x1e')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x5462('0x18')](_0x5462('0x21'),this[_0x5462('0x1c')],this[_0x5462('0x1d')],this[_0x5462('0x1e')],this[_0x5462('0x1f')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0xb4dd13,_0x427e63){rpc[_0x5462('0x22')](_0xb4dd13)[_0x5462('0x23')](function(_0x3b57df){if(_0x427e63){_0x427e63(null,_0x3b57df);}})['catch'](function(_0x3ac0a0){if(_0x427e63){_0x427e63(null,_0x3ac0a0);}});}function setChannelVariables(_0x1acc3b){for(var _0x588db6 in _0x1acc3b){if(_0x1acc3b['hasOwnProperty'](_0x588db6)){if(_0x588db6[_0x5462('0x24')]('agi_')===0x0){_0x1acc3b[_0x588db6[_0x5462('0x25')](0x4)]=_0x1acc3b[_0x588db6];delete _0x1acc3b[_0x588db6];}}}}function agiHandler(_0x58b58d){logger['debug'](_0x5462('0x26'),JSON['stringify'](_0x58b58d,null,0x2));logger[_0x5462('0x13')](util[_0x5462('0x18')](_0x5462('0x27'),_0x58b58d[_0x5462('0x1c')],_0x58b58d[_0x5462('0x1d')],_0x58b58d[_0x5462('0x1e')],_0x58b58d[_0x5462('0x1f')],_0x58b58d[_0x5462('0x20')]));_0x58b58d['on'](_0x5462('0xc'),errorHandler);_0x58b58d['on'](_0x5462('0x28'),closeHandler);_0x58b58d['on'](_0x5462('0x29'),timeoutHandler);_0x58b58d[_0x5462('0x2a')]=![];_0x58b58d['on']('hangup',hangupHandler);var _0xe7a4bf=_[_0x5462('0x2b')](projects,[_0x5462('0x16'),_0x58b58d[_0x5462('0x1c')]]);if(!_0xe7a4bf)return Project[_0x5462('0x2c')](_0x58b58d);if(!_0xe7a4bf[_0x5462('0x2d')])return Project['handleUnpublished'](_0x58b58d);return Project['initialize'](_0xe7a4bf,_0x58b58d);}function main(){var _0x53434a;return utilLicense[_0x5462('0x2e')]()[_0x5462('0x23')](function(_0x1c1d4e){if(!_0x1c1d4e)return;if(_0x1c1d4e[_0x5462('0x2f')]){if(_0x1c1d4e[_0x5462('0x30')]&&_0x1c1d4e['callysquare']>0x0){logger[_0x5462('0x13')](util[_0x5462('0x18')](_0x5462('0x31'),_0x1c1d4e['callysquare']));_0x53434a=_0x1c1d4e['callysquare'];}else{logger[_0x5462('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x5462('0x13')](_0x5462('0x32'));_0x53434a=-0x1;}})[_0x5462('0x23')](function(){return Project[_0x5462('0x33')]();})[_0x5462('0x23')](function(_0x21767a){projects=_0x21767a;return;})[_0x5462('0x34')](function(_0x118a7e){logger['error'](_0x5462('0x35'),_0x118a7e['stack']);})[_0x5462('0x36')](function(){var _0x394bb0=require(_0x5462('0x37'))(config[_0x5462('0x4')][_0x5462('0x15')],config[_0x5462('0x4')]['ip'],_0x53434a);_0x394bb0['on']('error',errorHandler);_0x394bb0['on'](_0x5462('0x38'),listeningHandler);_0x394bb0['on']('connection',connectionHandler);_0x394bb0['on'](_0x5462('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0xae11=['127.0.0.1','projectUpdate','nextTick','stack','splice','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','format','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xae11,0xf1));var _0x1ae1=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0xae11[_0x2cc0b3];return _0x1667ef;};'use strict';var _=require(_0x1ae1('0x0'));var syncho=require(_0x1ae1('0x1'));var util=require(_0x1ae1('0x2'));var config=require(_0x1ae1('0x3'));var logger=require(_0x1ae1('0x4'))('agi');var utilLicense=require(_0x1ae1('0x5'));var rpc=require('./rpc');var Project=require(_0x1ae1('0x6'));var AGIEmitter=require(_0x1ae1('0x7'))[_0x1ae1('0x8')];var projects=[];config[_0x1ae1('0x9')]=_[_0x1ae1('0xa')](config['agi'],{'ip':_0x1ae1('0xb'),'port':0x11dd});AGIEmitter['on'](_0x1ae1('0xc'),projectUpdateHandler);function connectionHandler(_0x1a65ad){process[_0x1ae1('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1a65ad);agiHandler(_0x1a65ad);}catch(_0x15a8ae){logger['error'](_0x15a8ae[_0x1ae1('0xe')]);}});});}function projectUpdateHandler(_0x1bfd1f){try{var _0x35233d=_['findIndex'](projects,['id',_0x1bfd1f['id']]);if(_0x35233d>-0x1){if(_0x1bfd1f['deleted']===!![]){projects[_0x1ae1('0xf')](_0x35233d,0x1);}else{projects[_0x35233d]=_0x1bfd1f;}}else{projects[_0x1ae1('0x10')](_0x1bfd1f);}}catch(_0x511c12){logger[_0x1ae1('0x11')](_0x511c12[_0x1ae1('0xe')]);}}function listeningHandler(){console[_0x1ae1('0x12')](_0x1ae1('0x13'),config['agi']['port']);logger[_0x1ae1('0x14')](util['format'](_0x1ae1('0x15'),config[_0x1ae1('0x9')]['ip'],config['agi'][_0x1ae1('0x16')]));}function errorHandler(_0x4c43d3){if(_0x4c43d3&&_0x4c43d3['name']&&_0x4c43d3['message']){logger['error'](util[_0x1ae1('0x17')]('[%s]\x20%s',_0x4c43d3['name'],_0x4c43d3[_0x1ae1('0x18')]));}else{logger[_0x1ae1('0x11')](util[_0x1ae1('0x17')](_0x1ae1('0x19'),_0x4c43d3[_0x1ae1('0xe')]));}}function closeHandler(){logger['info'](util[_0x1ae1('0x17')](_0x1ae1('0x1a'),this[_0x1ae1('0x1b')],this[_0x1ae1('0x1c')],this[_0x1ae1('0x1d')],this['dnid'],this[_0x1ae1('0x1e')]));try{createSquareReport(this);}catch(_0x2e7f4f){logger[_0x1ae1('0x11')](_0x2e7f4f[_0x1ae1('0xe')]);}}function timeoutHandler(){logger[_0x1ae1('0x14')](util['format'](_0x1ae1('0x1f'),this[_0x1ae1('0x1b')],this[_0x1ae1('0x1c')],this[_0x1ae1('0x1d')],this[_0x1ae1('0x20')],this[_0x1ae1('0x1e')]));}function hangupHandler(){logger[_0x1ae1('0x14')](util[_0x1ae1('0x17')](_0x1ae1('0x21'),this[_0x1ae1('0x1b')],this[_0x1ae1('0x1c')],this[_0x1ae1('0x1d')],this[_0x1ae1('0x20')],this[_0x1ae1('0x1e')]));this[_0x1ae1('0x22')]=!![];}function createSquareReport(_0x4c1710,_0x57fedf){rpc[_0x1ae1('0x23')](_0x4c1710)[_0x1ae1('0x24')](function(_0x42ceef){if(_0x57fedf){_0x57fedf(null,_0x42ceef);}})[_0x1ae1('0x25')](function(_0x2a7849){if(_0x57fedf){_0x57fedf(null,_0x2a7849);}});}function setChannelVariables(_0x4c5284){for(var _0x500cb5 in _0x4c5284){if(_0x4c5284[_0x1ae1('0x26')](_0x500cb5)){if(_0x500cb5[_0x1ae1('0x27')](_0x1ae1('0x28'))===0x0){_0x4c5284[_0x500cb5[_0x1ae1('0x29')](0x4)]=_0x4c5284[_0x500cb5];delete _0x4c5284[_0x500cb5];}}}}function agiHandler(_0x3b184){logger[_0x1ae1('0x2a')](_0x1ae1('0x2b'),JSON[_0x1ae1('0x2c')](_0x3b184,null,0x2));logger[_0x1ae1('0x14')](util[_0x1ae1('0x17')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b184[_0x1ae1('0x1b')],_0x3b184[_0x1ae1('0x1c')],_0x3b184['callerid'],_0x3b184[_0x1ae1('0x20')],_0x3b184['uniqueid']));_0x3b184['on'](_0x1ae1('0x11'),errorHandler);_0x3b184['on'](_0x1ae1('0x2d'),closeHandler);_0x3b184['on'](_0x1ae1('0x2e'),timeoutHandler);_0x3b184['evtHangup']=![];_0x3b184['on'](_0x1ae1('0x2f'),hangupHandler);var _0x2da7f6=_[_0x1ae1('0x30')](projects,['name',_0x3b184[_0x1ae1('0x1b')]]);if(!_0x2da7f6)return Project[_0x1ae1('0x31')](_0x3b184);if(!_0x2da7f6['production'])return Project[_0x1ae1('0x32')](_0x3b184);return Project[_0x1ae1('0x33')](_0x2da7f6,_0x3b184);}function main(){var _0x49babf;return utilLicense[_0x1ae1('0x34')]()[_0x1ae1('0x24')](function(_0x18ea14){if(!_0x18ea14)return;if(_0x18ea14[_0x1ae1('0x35')]){if(_0x18ea14['callysquare']&&_0x18ea14[_0x1ae1('0x36')]>0x0){logger[_0x1ae1('0x14')](util['format'](_0x1ae1('0x37'),_0x18ea14['callysquare']));_0x49babf=_0x18ea14['callysquare'];}else{logger['info'](_0x1ae1('0x38'));}}else{logger[_0x1ae1('0x14')](_0x1ae1('0x39'));_0x49babf=-0x1;}})[_0x1ae1('0x24')](function(){return Project[_0x1ae1('0x3a')]();})[_0x1ae1('0x24')](function(_0x4e1ef2){projects=_0x4e1ef2;return;})[_0x1ae1('0x25')](function(_0x1ad344){logger[_0x1ae1('0x11')](_0x1ae1('0x3b'),_0x1ad344[_0x1ae1('0xe')]);})[_0x1ae1('0x3c')](function(){var _0x54e1af=require('./server')(config[_0x1ae1('0x9')][_0x1ae1('0x16')],config['agi']['ip'],_0x49babf);_0x54e1af['on'](_0x1ae1('0x11'),errorHandler);_0x54e1af['on'](_0x1ae1('0x3d'),listeningHandler);_0x54e1af['on'](_0x1ae1('0x3e'),connectionHandler);_0x54e1af['on'](_0x1ae1('0x2d'),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 1e65cae..b64b514 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 _0x66de=['bluebird','jayson/promise','http','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x88523e,_0x3cd155){var _0x84b0c8=function(_0x3bba55){while(--_0x3bba55){_0x88523e['push'](_0x88523e['shift']());}};_0x84b0c8(++_0x3cd155);}(_0x66de,0x6e));var _0xe66d=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0x66de[_0x9faff7];return _0x4f8043;};'use strict';var BPromise=require(_0xe66d('0x0'));var jayson=require(_0xe66d('0x1'));var client=jayson['client'][_0xe66d('0x2')]({'port':0x232b});function request(_0x1eda74,_0xc222bb){return new BPromise(function(_0x2cac9c,_0x224d17){return client[_0xe66d('0x3')](_0x1eda74,_0xc222bb)[_0xe66d('0x4')](function(_0x46b374){if(_0x46b374[_0xe66d('0x5')]){return _0x224d17(_0x46b374['error'][_0xe66d('0x6')]);}else{return _0x2cac9c(_0x46b374['result']);}})[_0xe66d('0x7')](function(_0x119af6){return _0x224d17(_0x119af6);});});}exports[_0xe66d('0x8')]=function(_0xffdba3,_0x2ae415){return request(_0xe66d('0x9'),{'account':_0xffdba3,'message':_0x2ae415});}; \ No newline at end of file +var _0xaa45=['request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x4e6412,_0x3c1a3f){var _0xcb8be2=function(_0xd3a386){while(--_0xd3a386){_0x4e6412['push'](_0x4e6412['shift']());}};_0xcb8be2(++_0x3c1a3f);}(_0xaa45,0x1d5));var _0x5aa4=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xaa45[_0x216428];return _0x313dd4;};'use strict';var BPromise=require(_0x5aa4('0x0'));var jayson=require(_0x5aa4('0x1'));var client=jayson[_0x5aa4('0x2')][_0x5aa4('0x3')]({'port':0x232b});function request(_0x250302,_0x1efc7f){return new BPromise(function(_0x31a3d1,_0x428ca5){return client[_0x5aa4('0x4')](_0x250302,_0x1efc7f)[_0x5aa4('0x5')](function(_0x2bb0f7){if(_0x2bb0f7[_0x5aa4('0x6')]){return _0x428ca5(_0x2bb0f7['error'][_0x5aa4('0x7')]);}else{return _0x31a3d1(_0x2bb0f7['result']);}})[_0x5aa4('0x8')](function(_0x574619){return _0x428ca5(_0x574619);});});}exports[_0x5aa4('0x9')]=function(_0x8a04ac,_0x38a025){return request(_0x5aa4('0xa'),{'account':_0x8a04ac,'message':_0x38a025});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index a2145a2..f80bbd0 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 _0xa161=['info','arg_1','calleridname','callerid','dnid','traverseBFS','clear','vertex','stringify','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','code','debug','response','result','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','context','close','Project\x20%s\x20not\x20found','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','retry','addVertex','omit','mxCell','length','source','addEdge','target','value','mxGraphModel','root','inspect','start','joinAt','format'];(function(_0x9cc63e,_0x6f7666){var _0x357bd5=function(_0x54b1d7){while(--_0x54b1d7){_0x9cc63e['push'](_0x9cc63e['shift']());}};_0x357bd5(++_0x6f7666);}(_0xa161,0x1b5));var _0x1a16=function(_0x453fe3,_0xd35d7){_0x453fe3=_0x453fe3-0x0;var _0x21265e=_0xa161[_0x453fe3];return _0x21265e;};'use strict';var _=require('lodash');var moment=require(_0x1a16('0x0'));var parser=require(_0x1a16('0x1'));var util=require(_0x1a16('0x2'));var logger=require(_0x1a16('0x3'))(_0x1a16('0x4'));var rpc=require(_0x1a16('0x5'));var mailRpc=require(_0x1a16('0x6'));var Graph=require(_0x1a16('0x7'));var Vertices=require(_0x1a16('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1a16('0x9')]()[_0x1a16('0xa')](function(_0x5f0816){logger[_0x1a16('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5f0816['stack']);return[];});}function addVertex(_0x509426,_0x5daf2e,_0x5d3e39){_0x5daf2e['agicommand']=_0x5d3e39;if(_0x5daf2e['hasOwnProperty'](_0x1a16('0xc'))){_0x5daf2e['maxRetry']=parseInt(_0x5daf2e['retry'],0xa);}_0x509426[_0x1a16('0xd')](_[_0x1a16('0xe')](_0x5daf2e,_0x1a16('0xf')));}function initGraph(_0x107948,_0x6d8012){var _0x265bb1=new Graph();for(var _0x4b494 in _0x107948){if(_0x107948['hasOwnProperty'](_0x4b494)){if(_['isArray'](_0x107948[_0x4b494])){for(var _0x160d35=0x0;_0x160d35<_0x107948[_0x4b494][_0x1a16('0x10')];_0x160d35+=0x1){addVertex(_0x265bb1,_0x107948[_0x4b494][_0x160d35],_0x4b494);}}else{addVertex(_0x265bb1,_0x107948[_0x4b494],_0x4b494);}}}for(var _0x1d6152=0x0;_0x1d6152<_0x6d8012[_0x1a16('0x10')];_0x1d6152+=0x1){if(_0x6d8012[_0x1d6152][_0x1a16('0x11')]&&_0x6d8012[_0x1d6152]['target']){_0x265bb1[_0x1a16('0x12')](_0x6d8012[_0x1d6152][_0x1a16('0x11')],_0x6d8012[_0x1d6152][_0x1a16('0x13')],_0x6d8012[_0x1d6152][_0x1a16('0x14')]);}}return _0x265bb1;}function getRoot(_0x46ceec){return parser['toJson'](_0x46ceec,{'object':!![]})[_0x1a16('0x15')][_0x1a16('0x16')];}function inspect(_0x1a4771){return util[_0x1a16('0x17')](_0x1a4771,{'showHidden':![],'depth':null});}function initialize(_0x53c43b,_0x516820){var _0x236298=getRoot(_0x53c43b['production']);if(!_0x236298||!_0x236298[_0x1a16('0x18')])return;var _0x3acee0,_0x3a06c9,_0x3ac5e8;logger['debug'](_0x1a16('0x16'),JSON['stringify'](_0x236298,null,0x2));_0x516820[_0x1a16('0x19')]=moment()[_0x1a16('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3acee0=initGraph(_[_0x1a16('0xe')](_0x236298,'mxCell'),_0x236298[_0x1a16('0xf')]);_0x3a06c9=new Vertices(_0x516820,rpc,mailRpc);logger[_0x1a16('0x1b')](util[_0x1a16('0x1a')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x516820[_0x1a16('0x1c')],_0x516820[_0x1a16('0x1d')],_0x516820[_0x1a16('0x1e')],_0x516820[_0x1a16('0x1f')],_0x516820['uniqueid']));_0x3acee0[_0x1a16('0x20')](_0x236298[_0x1a16('0x18')]['id'],function(_0x3c1aca){try{_0x3c1aca=_0x3a06c9[_0x1a16('0x21')](_0x3c1aca);logger['debug'](_0x1a16('0x22'),JSON[_0x1a16('0x23')](_0x3c1aca,null,0x2));if(_0x3c1aca[_0x1a16('0x24')]==='gotoc'){logger['info'](_0x1a16('0x25'));_0x516820['context']=_0x3c1aca['context']||_0x516820['context'];_0x516820[_0x1a16('0x26')]=_0x3c1aca['extension'];_0x516820[_0x1a16('0x27')]=_0x3c1aca['priority']?_0x3c1aca[_0x1a16('0x27')]-0x1:0x1;return null;}else if(_0x3c1aca&&_0x3a06c9[_0x3c1aca[_0x1a16('0x24')]]){_0x3ac5e8=_0x3a06c9[_0x3c1aca[_0x1a16('0x24')]](_0x3c1aca);logger[_0x1a16('0x1b')]('response',JSON['stringify'](_0x3ac5e8,null,0x2));if(_0x3ac5e8&&_0x3ac5e8[_0x1a16('0x28')]===AGI_CODE_SUCCESS&&_0x3ac5e8['result']!==AGI_RESULT_ERROR&&!_0x516820['evtHangup']){logger[_0x1a16('0x29')](_0x1a16('0x2a'),inspect(_0x3ac5e8));return _['isUndefined'](_0x3ac5e8[_0x1a16('0x2b')])?null:_0x3ac5e8[_0x1a16('0x2b')][_0x1a16('0x2c')]();}else{logger[_0x1a16('0xb')](_0x1a16('0x2a'),inspect(_0x3ac5e8));return null;}}else{logger[_0x1a16('0xb')](_0x1a16('0x2d'));return null;}}catch(_0x180afb){logger[_0x1a16('0xb')](_0x180afb[_0x1a16('0x2e')]);return null;}});if(_0x236298[_0x1a16('0x2f')]){logger['info'](util[_0x1a16('0x1a')](_0x1a16('0x30'),_0x516820[_0x1a16('0x1c')],_0x516820[_0x1a16('0x1d')],_0x516820[_0x1a16('0x1e')],_0x516820[_0x1a16('0x1f')],_0x516820['uniqueid']));_0x3acee0['traverseBFS'](_0x236298[_0x1a16('0x2f')]['id'],function(_0x49b8fd){try{_0x49b8fd=_0x3a06c9[_0x1a16('0x21')](_0x49b8fd);logger[_0x1a16('0x29')]('vertex',JSON[_0x1a16('0x23')](_0x49b8fd,null,0x2));if(_0x49b8fd&&_0x3a06c9[_0x49b8fd[_0x1a16('0x24')]]){_0x3ac5e8=_0x3a06c9[_0x49b8fd[_0x1a16('0x24')]](_0x49b8fd);if(_0x3ac5e8){logger[_0x1a16('0x29')](_0x1a16('0x2a'),inspect(_0x3ac5e8));return _[_0x1a16('0x31')](_0x3ac5e8[_0x1a16('0x2b')])?null:_0x3ac5e8['result']['toString']();}else{logger[_0x1a16('0xb')](_0x1a16('0x2a'),inspect(_0x3ac5e8));return null;}}else{logger[_0x1a16('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x4bc6a3){logger['error'](_0x4bc6a3[_0x1a16('0x2e')]);return null;}});}logger[_0x1a16('0x1b')](util[_0x1a16('0x1a')](_0x1a16('0x32'),_0x516820[_0x1a16('0x1c')],_0x516820['calleridname'],_0x516820['callerid'],_0x516820[_0x1a16('0x1f')],_0x516820[_0x1a16('0x33')]));logger[_0x1a16('0x1b')](util['format'](_0x1a16('0x34'),_0x516820['context'],_0x516820[_0x1a16('0x26')],parseInt(_0x516820[_0x1a16('0x27')],0xa)+0x1));_0x516820[_0x1a16('0x35')](_0x516820[_0x1a16('0x36')],_0x516820[_0x1a16('0x26')],parseInt(_0x516820[_0x1a16('0x27')],0xa)+0x1);_0x516820[_0x1a16('0x37')]();}function handleNotFound(_0xf1c7f8){logger[_0x1a16('0xb')](util[_0x1a16('0x1a')](_0x1a16('0x38'),_0xf1c7f8['arg_1']));_0xf1c7f8[_0x1a16('0x35')](_0xf1c7f8['context'],_0xf1c7f8['extension'],parseInt(_0xf1c7f8[_0x1a16('0x27')],0xa)+0x1);_0xf1c7f8[_0x1a16('0x37')]();}function handleUnpublished(_0x3915aa){logger[_0x1a16('0xb')](util['format']('Project\x20%s\x20not\x20published',_0x3915aa['arg_1']));_0x3915aa['continueAt'](_0x3915aa[_0x1a16('0x36')],_0x3915aa[_0x1a16('0x26')],parseInt(_0x3915aa[_0x1a16('0x27')],0xa)+0x1);_0x3915aa[_0x1a16('0x37')]();}module[_0x1a16('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xe270=['length','target','addEdge','source','value','toJson','mxGraphModel','root','inspect','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','traverseBFS','clear','vertex','gotoc','context','extension','priority','info','response','code','result','evtHangup','debug','isUndefined','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','finally','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xe270,0x1ed));var _0x0e27=function(_0x3ba5d5,_0x550b1a){_0x3ba5d5=_0x3ba5d5-0x0;var _0x408418=_0xe270[_0x3ba5d5];return _0x408418;};'use strict';var _=require('lodash');var moment=require(_0x0e27('0x0'));var parser=require(_0x0e27('0x1'));var util=require(_0x0e27('0x2'));var logger=require(_0x0e27('0x3'))(_0x0e27('0x4'));var rpc=require(_0x0e27('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x0e27('0x6'));var Vertices=require(_0x0e27('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x0e27('0x8')](function(_0x169da2){logger[_0x0e27('0x9')](_0x0e27('0xa'),_0x169da2[_0x0e27('0xb')]);return[];});}function addVertex(_0x110bf1,_0x2ac9f9,_0x1b347f){_0x2ac9f9[_0x0e27('0xc')]=_0x1b347f;if(_0x2ac9f9[_0x0e27('0xd')](_0x0e27('0xe'))){_0x2ac9f9[_0x0e27('0xf')]=parseInt(_0x2ac9f9[_0x0e27('0xe')],0xa);}_0x110bf1['addVertex'](_[_0x0e27('0x10')](_0x2ac9f9,_0x0e27('0x11')));}function initGraph(_0x57cc83,_0x2e707f){var _0x49f3d5=new Graph();for(var _0x3ba4e2 in _0x57cc83){if(_0x57cc83[_0x0e27('0xd')](_0x3ba4e2)){if(_[_0x0e27('0x12')](_0x57cc83[_0x3ba4e2])){for(var _0x4341f0=0x0;_0x4341f0<_0x57cc83[_0x3ba4e2][_0x0e27('0x13')];_0x4341f0+=0x1){addVertex(_0x49f3d5,_0x57cc83[_0x3ba4e2][_0x4341f0],_0x3ba4e2);}}else{addVertex(_0x49f3d5,_0x57cc83[_0x3ba4e2],_0x3ba4e2);}}}for(var _0x1de964=0x0;_0x1de964<_0x2e707f[_0x0e27('0x13')];_0x1de964+=0x1){if(_0x2e707f[_0x1de964]['source']&&_0x2e707f[_0x1de964][_0x0e27('0x14')]){_0x49f3d5[_0x0e27('0x15')](_0x2e707f[_0x1de964][_0x0e27('0x16')],_0x2e707f[_0x1de964]['target'],_0x2e707f[_0x1de964][_0x0e27('0x17')]);}}return _0x49f3d5;}function getRoot(_0x50fa7d){return parser[_0x0e27('0x18')](_0x50fa7d,{'object':!![]})[_0x0e27('0x19')][_0x0e27('0x1a')];}function inspect(_0xd66929){return util[_0x0e27('0x1b')](_0xd66929,{'showHidden':![],'depth':null});}function initialize(_0x3a6572,_0x1442a8){var _0x8da457=getRoot(_0x3a6572[_0x0e27('0x1c')]);if(!_0x8da457||!_0x8da457[_0x0e27('0x1d')])return;var _0x57bf32,_0x158584,_0x3d7133;logger['debug'](_0x0e27('0x1a'),JSON[_0x0e27('0x1e')](_0x8da457,null,0x2));_0x1442a8[_0x0e27('0x1f')]=moment()['format'](_0x0e27('0x20'));_0x57bf32=initGraph(_['omit'](_0x8da457,_0x0e27('0x11')),_0x8da457['mxCell']);_0x158584=new Vertices(_0x1442a8,rpc,mailRpc);logger['info'](util[_0x0e27('0x21')](_0x0e27('0x22'),_0x1442a8['arg_1'],_0x1442a8['calleridname'],_0x1442a8[_0x0e27('0x23')],_0x1442a8[_0x0e27('0x24')],_0x1442a8['uniqueid']));_0x57bf32[_0x0e27('0x25')](_0x8da457[_0x0e27('0x1d')]['id'],function(_0x2832e5){try{_0x2832e5=_0x158584[_0x0e27('0x26')](_0x2832e5);logger['debug'](_0x0e27('0x27'),JSON['stringify'](_0x2832e5,null,0x2));if(_0x2832e5[_0x0e27('0xc')]===_0x0e27('0x28')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1442a8['context']=_0x2832e5[_0x0e27('0x29')]||_0x1442a8['context'];_0x1442a8[_0x0e27('0x2a')]=_0x2832e5[_0x0e27('0x2a')];_0x1442a8[_0x0e27('0x2b')]=_0x2832e5[_0x0e27('0x2b')]?_0x2832e5[_0x0e27('0x2b')]-0x1:0x1;return null;}else if(_0x2832e5&&_0x158584[_0x2832e5[_0x0e27('0xc')]]){_0x3d7133=_0x158584[_0x2832e5[_0x0e27('0xc')]](_0x2832e5);logger[_0x0e27('0x2c')](_0x0e27('0x2d'),JSON[_0x0e27('0x1e')](_0x3d7133,null,0x2));if(_0x3d7133&&_0x3d7133[_0x0e27('0x2e')]===AGI_CODE_SUCCESS&&_0x3d7133[_0x0e27('0x2f')]!==AGI_RESULT_ERROR&&!_0x1442a8[_0x0e27('0x30')]){logger[_0x0e27('0x31')](_0x0e27('0x2d'),inspect(_0x3d7133));return _[_0x0e27('0x32')](_0x3d7133[_0x0e27('0x2f')])?null:_0x3d7133[_0x0e27('0x2f')][_0x0e27('0x33')]();}else{logger[_0x0e27('0x9')](_0x0e27('0x2d'),inspect(_0x3d7133));return null;}}else{logger[_0x0e27('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x40c75c){logger[_0x0e27('0x9')](_0x40c75c[_0x0e27('0xb')]);return null;}});if(_0x8da457['finally']){logger[_0x0e27('0x2c')](util['format'](_0x0e27('0x34'),_0x1442a8[_0x0e27('0x35')],_0x1442a8[_0x0e27('0x36')],_0x1442a8[_0x0e27('0x23')],_0x1442a8['dnid'],_0x1442a8[_0x0e27('0x37')]));_0x57bf32[_0x0e27('0x25')](_0x8da457[_0x0e27('0x38')]['id'],function(_0x38c2df){try{_0x38c2df=_0x158584[_0x0e27('0x26')](_0x38c2df);logger[_0x0e27('0x31')](_0x0e27('0x27'),JSON[_0x0e27('0x1e')](_0x38c2df,null,0x2));if(_0x38c2df&&_0x158584[_0x38c2df[_0x0e27('0xc')]]){_0x3d7133=_0x158584[_0x38c2df[_0x0e27('0xc')]](_0x38c2df);if(_0x3d7133){logger[_0x0e27('0x31')](_0x0e27('0x2d'),inspect(_0x3d7133));return _[_0x0e27('0x32')](_0x3d7133[_0x0e27('0x2f')])?null:_0x3d7133[_0x0e27('0x2f')][_0x0e27('0x33')]();}else{logger['error'](_0x0e27('0x2d'),inspect(_0x3d7133));return null;}}else{logger['error'](_0x0e27('0x39'));return null;}}catch(_0x30e66b){logger[_0x0e27('0x9')](_0x30e66b['stack']);return null;}});}logger['info'](util[_0x0e27('0x21')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1442a8[_0x0e27('0x35')],_0x1442a8[_0x0e27('0x36')],_0x1442a8[_0x0e27('0x23')],_0x1442a8['dnid'],_0x1442a8[_0x0e27('0x37')]));logger['info'](util['format'](_0x0e27('0x3a'),_0x1442a8['context'],_0x1442a8[_0x0e27('0x2a')],parseInt(_0x1442a8[_0x0e27('0x2b')],0xa)+0x1));_0x1442a8['continueAt'](_0x1442a8[_0x0e27('0x29')],_0x1442a8[_0x0e27('0x2a')],parseInt(_0x1442a8[_0x0e27('0x2b')],0xa)+0x1);_0x1442a8[_0x0e27('0x3b')]();}function handleNotFound(_0x46dcab){logger[_0x0e27('0x9')](util[_0x0e27('0x21')](_0x0e27('0x3c'),_0x46dcab[_0x0e27('0x35')]));_0x46dcab[_0x0e27('0x3d')](_0x46dcab[_0x0e27('0x29')],_0x46dcab[_0x0e27('0x2a')],parseInt(_0x46dcab[_0x0e27('0x2b')],0xa)+0x1);_0x46dcab[_0x0e27('0x3b')]();}function handleUnpublished(_0x5b4a8e){logger[_0x0e27('0x9')](util['format'](_0x0e27('0x3e'),_0x5b4a8e[_0x0e27('0x35')]));_0x5b4a8e[_0x0e27('0x3d')](_0x5b4a8e[_0x0e27('0x29')],_0x5b4a8e[_0x0e27('0x2a')],parseInt(_0x5b4a8e[_0x0e27('0x2b')],0xa)+0x1);_0x5b4a8e[_0x0e27('0x3b')]();}module[_0x0e27('0x3f')]={'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 9da2481..83836e7 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 _0x8430=['\x0d\x0a\x0d\x0a','toString','_localBuffer','substring','length','indexOf','trim','slice','emit','headers','exports','stream','Transform','call','_inBody','inherits','prototype'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8430,0xd7));var _0x0843=function(_0x339ded,_0xb38a57){_0x339ded=_0x339ded-0x0;var _0x37f8dc=_0x8430[_0x339ded];return _0x37f8dc;};'use strict';var util=require('util');var Transform=require(_0x0843('0x0'))[_0x0843('0x1')];function AGIReply(_0x4b8db8){Transform[_0x0843('0x2')](this,_0x4b8db8);this['_localBuffer']='';this[_0x0843('0x3')]=![];}util[_0x0843('0x4')](AGIReply,Transform);AGIReply[_0x0843('0x5')]['_transform']=function(_0x2ad5d2,_0x53613d,_0x1e4981){var _0xc79f33='\x0a',_0x568d49=['\x0a\x0a',_0x0843('0x6')],_0x137069=-0x1,_0x43d908=-0x1,_0x45c2e7='',_0x4c0b5e=0x0,_0x14b3de='',_0x231f60='';this['_localBuffer']+=_0x2ad5d2[_0x0843('0x7')]();_0x14b3de=this[_0x0843('0x8')];if(!this['_inBody']){_0x4c0b5e=0x0;while(_0x568d49[_0x4c0b5e]){while((_0x43d908=_0x14b3de['indexOf'](_0x568d49[_0x4c0b5e]))!=-0x1){_0x45c2e7=_0x568d49[_0x4c0b5e];_0x231f60=_0x14b3de[_0x0843('0x9')](0x0,_0x43d908);_0x14b3de=_0x14b3de[_0x0843('0x9')](_0x43d908+_0x45c2e7[_0x0843('0xa')]);var _0x25d191=_0x231f60['split'](_0xc79f33),_0x4207d1=0x0,_0x35e3a2={},_0x7e54f4='',_0x46cbfe='',_0x4668f2=-0x1;while(_0x25d191[_0x4207d1]){_0x4668f2=_0x25d191[_0x4207d1][_0x0843('0xb')](':');if(_0x4668f2!=-0x1){_0x7e54f4=_0x25d191[_0x4207d1]['slice'](0x0,_0x4668f2)[_0x0843('0xc')]();_0x46cbfe=_0x25d191[_0x4207d1][_0x0843('0xd')](_0x4668f2+0x1)[_0x0843('0xc')]();if(_0x7e54f4['length']>0x0){_0x35e3a2[_0x7e54f4]=_0x46cbfe;}}else{}_0x4207d1++;}this[_0x0843('0xe')](_0x0843('0xf'),_0x35e3a2);this[_0x0843('0x3')]=!![];}_0x4c0b5e++;}this[_0x0843('0x8')]=_0x14b3de;}else{while((_0x137069=_0x14b3de['indexOf'](_0xc79f33))!=-0x1){_0x231f60=_0x14b3de['substring'](0x0,_0x137069);this[_0x0843('0xe')]('line',_0x231f60);_0x14b3de=_0x14b3de['substring'](_0x137069+_0xc79f33[_0x0843('0xa')]);}this[_0x0843('0x8')]=_0x14b3de;}_0x1e4981();};module[_0x0843('0x10')]=AGIReply; \ No newline at end of file +var _0xac72=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xac72,0x1eb));var _0x2ac7=function(_0x328ce9,_0xa5d809){_0x328ce9=_0x328ce9-0x0;var _0x5d4ce4=_0xac72[_0x328ce9];return _0x5d4ce4;};'use strict';var util=require(_0x2ac7('0x0'));var Transform=require(_0x2ac7('0x1'))[_0x2ac7('0x2')];function AGIReply(_0x49fa28){Transform[_0x2ac7('0x3')](this,_0x49fa28);this[_0x2ac7('0x4')]='';this[_0x2ac7('0x5')]=![];}util[_0x2ac7('0x6')](AGIReply,Transform);AGIReply[_0x2ac7('0x7')][_0x2ac7('0x8')]=function(_0x167510,_0x3b7564,_0x2c56b0){var _0x28add9='\x0a',_0x4e11a4=['\x0a\x0a',_0x2ac7('0x9')],_0x19d2f0=-0x1,_0xf836e2=-0x1,_0x5055f1='',_0x2bcc25=0x0,_0x215876='',_0x4a142a='';this[_0x2ac7('0x4')]+=_0x167510[_0x2ac7('0xa')]();_0x215876=this[_0x2ac7('0x4')];if(!this[_0x2ac7('0x5')]){_0x2bcc25=0x0;while(_0x4e11a4[_0x2bcc25]){while((_0xf836e2=_0x215876[_0x2ac7('0xb')](_0x4e11a4[_0x2bcc25]))!=-0x1){_0x5055f1=_0x4e11a4[_0x2bcc25];_0x4a142a=_0x215876[_0x2ac7('0xc')](0x0,_0xf836e2);_0x215876=_0x215876['substring'](_0xf836e2+_0x5055f1[_0x2ac7('0xd')]);var _0x519915=_0x4a142a['split'](_0x28add9),_0x3aab03=0x0,_0x52d4c8={},_0x1f054d='',_0x80af2c='',_0x4ddc6c=-0x1;while(_0x519915[_0x3aab03]){_0x4ddc6c=_0x519915[_0x3aab03][_0x2ac7('0xb')](':');if(_0x4ddc6c!=-0x1){_0x1f054d=_0x519915[_0x3aab03][_0x2ac7('0xe')](0x0,_0x4ddc6c)[_0x2ac7('0xf')]();_0x80af2c=_0x519915[_0x3aab03][_0x2ac7('0xe')](_0x4ddc6c+0x1)[_0x2ac7('0xf')]();if(_0x1f054d['length']>0x0){_0x52d4c8[_0x1f054d]=_0x80af2c;}}else{}_0x3aab03++;}this[_0x2ac7('0x10')](_0x2ac7('0x11'),_0x52d4c8);this['_inBody']=!![];}_0x2bcc25++;}this['_localBuffer']=_0x215876;}else{while((_0x19d2f0=_0x215876[_0x2ac7('0xb')](_0x28add9))!=-0x1){_0x4a142a=_0x215876[_0x2ac7('0xc')](0x0,_0x19d2f0);this[_0x2ac7('0x10')](_0x2ac7('0x12'),_0x4a142a);_0x215876=_0x215876['substring'](_0x19d2f0+_0x28add9[_0x2ac7('0xd')]);}this[_0x2ac7('0x4')]=_0x215876;}_0x2c56b0();};module[_0x2ac7('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index bfb84b8..ffcf0bc 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 _0x1738=['Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareMessage','createCmContact','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','http','request','then','error','message','result','catch','getSquareProjects','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','name','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval'];(function(_0x47935e,_0x1f30cf){var _0x459fe4=function(_0x78934e){while(--_0x78934e){_0x47935e['push'](_0x47935e['shift']());}};_0x459fe4(++_0x1f30cf);}(_0x1738,0x1bc));var _0x8173=function(_0x4bac77,_0x365935){_0x4bac77=_0x4bac77-0x0;var _0x6dd0ce=_0x1738[_0x4bac77];return _0x6dd0ce;};'use strict';var _=require(_0x8173('0x0'));var moment=require(_0x8173('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8173('0x2')]({'port':0x2329});function request(_0x26a1a5,_0x28552c){return new Promise(function(_0x4e83f2,_0x555d4e){return client[_0x8173('0x3')](_0x26a1a5,_0x28552c)[_0x8173('0x4')](function(_0x2993f1){if(_0x2993f1[_0x8173('0x5')]){return _0x555d4e(_0x2993f1[_0x8173('0x5')][_0x8173('0x6')]);}else{return _0x4e83f2(_0x2993f1[_0x8173('0x7')]);}})[_0x8173('0x8')](function(_0x13a621){return _0x555d4e(_0x13a621);});});}exports[_0x8173('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name',_0x8173('0xa')]}});};exports[_0x8173('0xb')]=function(_0x426619){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x426619},'attributes':['production']}});};exports[_0x8173('0xc')]=function(_0x12e6ca){return request(_0x8173('0xd'),{'options':{'raw':![],'where':{'id':_0x12e6ca},'include':[{'model':_0x8173('0xe'),'as':_0x8173('0xf'),'include':[{'model':'CloudProvider','as':_0x8173('0x10')}]}],'attributes':['id','name',_0x8173('0x11')],'smtp':!![]}});};exports[_0x8173('0x12')]=function(_0x37d172){return request(_0x8173('0x13'),{'options':{'where':{'id':_0x37d172},'attributes':[_0x8173('0x14')]}});};exports['getVoiceQueueById']=function(_0x40bb6b){return request(_0x8173('0x15'),{'options':{'where':{'id':_0x40bb6b},'attributes':[_0x8173('0x14')]}});};exports['getVariableById']=function(_0x5a3870){return request(_0x8173('0x16'),{'options':{'where':{'id':_0x5a3870},'attributes':[_0x8173('0x14')]}});};exports[_0x8173('0x17')]=function(_0x58fcf1){return request(_0x8173('0x18'),{'options':{'where':{'id':_0x58fcf1},'attributes':[_0x8173('0x19')]}});};exports['getUserById']=function(_0x70e7fc){return request(_0x8173('0x1a'),{'options':{'where':{'id':_0x70e7fc},'attributes':[_0x8173('0x14')]}});};exports[_0x8173('0x1b')]=function(_0x1c78cd){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1c78cd[_0x8173('0x1c')]},'attributes':['id']}});};exports[_0x8173('0x1d')]=function(_0xce80fe){return request(_0x8173('0x1e'),{'options':{'where':{'id':_0xce80fe},'attributes':[_0x8173('0x14')]}});};exports[_0x8173('0x1f')]=function(_0xf348b2){return request(_0x8173('0x20'),{'options':{'where':{'id':_0xf348b2},'attributes':[_0x8173('0x21')]}});};exports[_0x8173('0x22')]=function(_0x4d9be1){return request(_0x8173('0x23'),{'options':{'raw':![],'where':{'id':_0x4d9be1},'include':[{'model':_0x8173('0x24'),'as':'Intervals'}]}});};exports[_0x8173('0x25')]=function(_0x5c6d79){return request(_0x8173('0x26'),{'options':{'where':{'id':_0x5c6d79},'attributes':['id','name']}});};exports[_0x8173('0x27')]=function(_0x5c6831){return request(_0x8173('0x28'),{'body':_0x5c6831});};exports[_0x8173('0x29')]=function(_0x5f2044){return request(_0x8173('0x2a'),{'body':_0x5f2044});};exports['createSquareReport']=function(_0x2f258d){return request(_0x8173('0x2b'),{'body':_[_0x8173('0x2c')](_0x2f258d,{'project_name':_0x2f258d[_0x8173('0x2d')],'prev_project_name':_0x2f258d[_0x8173('0x2e')]||'','is_subproject':_0x2f258d[_0x8173('0x2e')]?!![]:![],'leaveAt':moment()[_0x8173('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x8173('0x30')]=function(_0x8fcf1e){return request('CreateSquareRecording',{'body':_0x8fcf1e});};exports['createSquareMessage']=function(_0x2eea21){return request(_0x8173('0x31'),{'body':_0x2eea21});};exports[_0x8173('0x32')]=function(_0x5ee6e0){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5ee6e0[_0x8173('0x1c')],'ListId':_0x5ee6e0[_0x8173('0x33')]}}})[_0x8173('0x4')](function(_0x10d969){if(_0x10d969){return _0x10d969;}return request('CreateCmContact',{'body':_0x5ee6e0});});};exports[_0x8173('0x34')]=function(_0x547b3a){return request('ShowPause',{'options':{'where':{'id':_0x547b3a},'attributes':[_0x8173('0x14')]}});};exports[_0x8173('0x35')]=function(_0x4c8b01,_0x49f109){return request(_0x8173('0x36'),{'body':{'interface':_0x49f109},'options':{'where':_0x4c8b01}});};exports[_0x8173('0x37')]=function(_0x36c282,_0x55a6df,_0xb85876){return request(_0x8173('0x38'),{'body':{'type':_0x55a6df,'uniqueid':_0xb85876},'options':{'where':_0x36c282}});};exports[_0x8173('0x39')]=function(_0x464998){return request(_0x8173('0x3a'),{'body':{},'options':{'where':_0x464998}});};exports['agentLogout']=function(_0x448e32){return request(_0x8173('0x3b'),{'body':{},'options':{'where':_0x448e32}});}; \ No newline at end of file +var _0x383d=['save_name','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','http','request','then','error','message','result','catch','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById'];(function(_0xbdeae7,_0x3fd32a){var _0x3ead80=function(_0x4fdf3e){while(--_0x4fdf3e){_0xbdeae7['push'](_0xbdeae7['shift']());}};_0x3ead80(++_0x3fd32a);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0xd383('0x0'));var client=jayson[_0xd383('0x1')][_0xd383('0x2')]({'port':0x2329});function request(_0x559dd3,_0x7554ef){return new Promise(function(_0x229076,_0x319f67){return client[_0xd383('0x3')](_0x559dd3,_0x7554ef)[_0xd383('0x4')](function(_0x43ab08){if(_0x43ab08['error']){return _0x319f67(_0x43ab08[_0xd383('0x5')][_0xd383('0x6')]);}else{return _0x229076(_0x43ab08[_0xd383('0x7')]);}})[_0xd383('0x8')](function(_0xffa778){return _0x319f67(_0xffa778);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xd383('0x9'),_0xd383('0xa')]}});};exports['getSquareProject']=function(_0x2abc3a){return request(_0xd383('0xb'),{'options':{'raw':![],'where':{'name':_0x2abc3a},'attributes':[_0xd383('0xa')]}});};exports[_0xd383('0xc')]=function(_0x3f6155){return request(_0xd383('0xd'),{'options':{'raw':![],'where':{'id':_0x3f6155},'include':[{'model':'MailServerOut','as':_0xd383('0xe'),'include':[{'model':_0xd383('0xf'),'as':_0xd383('0xf')}]}],'attributes':['id',_0xd383('0x9'),'email'],'smtp':!![]}});};exports[_0xd383('0x10')]=function(_0x23fecb){return request(_0xd383('0xb'),{'options':{'where':{'id':_0x23fecb},'attributes':[_0xd383('0x9')]}});};exports['getVoiceQueueById']=function(_0x39985a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x39985a},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x11')]=function(_0xf2dcb6){return request(_0xd383('0x12'),{'options':{'where':{'id':_0xf2dcb6},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x13')]=function(_0x5359c6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5359c6},'attributes':[_0xd383('0x14')]}});};exports[_0xd383('0x15')]=function(_0x8639e8){return request(_0xd383('0x16'),{'options':{'where':{'id':_0x8639e8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x17')]=function(_0x21d2ed){return request(_0xd383('0x18'),{'options':{'where':{'phone':_0x21d2ed['phone']},'attributes':['id']}});};exports[_0xd383('0x19')]=function(_0x3714c8){return request(_0xd383('0x1a'),{'options':{'where':{'id':_0x3714c8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x1b')]=function(_0x3618d9){return request('ShowSound',{'options':{'where':{'id':_0x3618d9},'attributes':[_0xd383('0x1c')]}});};exports['getIntervalById']=function(_0x1a8e78){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1a8e78},'include':[{'model':_0xd383('0x1d'),'as':_0xd383('0x1e')}]}});};exports['getSmsAccountById']=function(_0x10c054){return request(_0xd383('0x1f'),{'options':{'where':{'id':_0x10c054},'attributes':['id',_0xd383('0x9')]}});};exports['createSmsMessage']=function(_0x48d34b){return request(_0xd383('0x20'),{'body':_0x48d34b});};exports['createSquareDetailsReport']=function(_0x58bf08){return request(_0xd383('0x21'),{'body':_0x58bf08});};exports['createSquareReport']=function(_0xdc2c45){return request('CreateSquareReport',{'body':_['merge'](_0xdc2c45,{'project_name':_0xdc2c45['arg_1'],'prev_project_name':_0xdc2c45[_0xd383('0x22')]||'','is_subproject':_0xdc2c45[_0xd383('0x22')]?!![]:![],'leaveAt':moment()[_0xd383('0x23')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xd383('0x24')]=function(_0x2b3ab6){return request(_0xd383('0x25'),{'body':_0x2b3ab6});};exports[_0xd383('0x26')]=function(_0x27750a){return request(_0xd383('0x27'),{'body':_0x27750a});};exports[_0xd383('0x28')]=function(_0x208247){return request(_0xd383('0x29'),{'options':{'raw':![],'where':{'phone':_0x208247['phone'],'ListId':_0x208247[_0xd383('0x2a')]}}})[_0xd383('0x4')](function(_0x13924e){if(_0x13924e){return _0x13924e;}return request(_0xd383('0x2b'),{'body':_0x208247});});};exports[_0xd383('0x2c')]=function(_0x16be76){return request(_0xd383('0x2d'),{'options':{'where':{'id':_0x16be76},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x2e')]=function(_0xcea4cf,_0x1f87da){return request(_0xd383('0x2f'),{'body':{'interface':_0x1f87da},'options':{'where':_0xcea4cf}});};exports[_0xd383('0x30')]=function(_0x4284dd,_0x15b20b,_0x5a2cc5){return request(_0xd383('0x31'),{'body':{'type':_0x15b20b,'uniqueid':_0x5a2cc5},'options':{'where':_0x4284dd}});};exports[_0xd383('0x32')]=function(_0x12f159){return request(_0xd383('0x33'),{'body':{},'options':{'where':_0x12f159}});};exports[_0xd383('0x34')]=function(_0x18f305){return request(_0xd383('0x35'),{'body':{},'options':{'where':_0x18f305}});}; \ 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 570a1c8..5074c90 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 _0xac6a=['./lex','exports','./polly'];(function(_0x460358,_0x354877){var _0xdfdfa8=function(_0x4cc317){while(--_0x4cc317){_0x460358['push'](_0x460358['shift']());}};_0xdfdfa8(++_0x354877);}(_0xac6a,0xc2));var _0xaac6=function(_0x2b3f25,_0x35eef6){_0x2b3f25=_0x2b3f25-0x0;var _0x50f592=_0xac6a[_0x2b3f25];return _0x50f592;};var polly=require(_0xaac6('0x0'));var lex=require(_0xaac6('0x1'));module[_0xaac6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x448a=['exports','./lex'];(function(_0x3289bc,_0x27eb14){var _0x3d5e97=function(_0x4f58cd){while(--_0x4f58cd){_0x3289bc['push'](_0x3289bc['shift']());}};_0x3d5e97(++_0x27eb14);}(_0x448a,0x1ef));var _0xa448=function(_0x95ed33,_0x329ccb){_0x95ed33=_0x95ed33-0x0;var _0x59c28a=_0x448a[_0x95ed33];return _0x59c28a;};var polly=require('./polly');var lex=require(_0xa448('0x0'));module[_0xa448('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1344a4c..b1a1653 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['exports'];(function(_0x407562,_0x56154b){var _0x17e58d=function(_0x325425){while(--_0x325425){_0x407562['push'](_0x407562['shift']());}};_0x17e58d(++_0x56154b);}(_0x878f,0x173));var _0xf878=function(_0x2c9a5d,_0x161fea){_0x2c9a5d=_0x2c9a5d-0x0;var _0x3627c2=_0x878f[_0x2c9a5d];return _0x3627c2;};'use strict';var lex=require('./lib/api');module[_0xf878('0x0')]=function(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783){return lex(_0x658976,_0x2e1d23,_0x12df2b,_0x1b3d0b,_0x3d74cf,_0x9e6783);}; \ No newline at end of file +var _0x3c81=['./lib/api','exports'];(function(_0x6d262d,_0x541089){var _0x32f9e7=function(_0x3b7684){while(--_0x3b7684){_0x6d262d['push'](_0x6d262d['shift']());}};_0x32f9e7(++_0x541089);}(_0x3c81,0x102));var _0x13c8=function(_0x3c11a1,_0x4aea0f){_0x3c11a1=_0x3c11a1-0x0;var _0xdb159d=_0x3c81[_0x3c11a1];return _0xdb159d;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ 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 9a0ab59..d07f947 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(_0x533c00,_0x19371c){var _0x2a40e3=function(_0x56757c){while(--_0x56757c){_0x533c00['push'](_0x533c00['shift']());}};_0x2a40e3(++_0x19371c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x74ce49,_0x2880a2){var _0x426d12=function(_0x1e94b8){while(--_0x1e94b8){_0x74ce49['push'](_0x74ce49['shift']());}};_0x426d12(++_0x2880a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 3572cab..2ecafb2 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 _0xea52=['./lib/api','exports'];(function(_0x21c6dc,_0x12fd4e){var _0x168740=function(_0xbb8d38){while(--_0xbb8d38){_0x21c6dc['push'](_0x21c6dc['shift']());}};_0x168740(++_0x12fd4e);}(_0xea52,0x6e));var _0x2ea5=function(_0x16b156,_0x50304a){_0x16b156=_0x16b156-0x0;var _0x4e65ef=_0xea52[_0x16b156];return _0x4e65ef;};'use strict';var polly=require(_0x2ea5('0x0'));module[_0x2ea5('0x1')]=function(_0x87232e,_0x374f56,_0x39c86a,_0xef6eaa,_0x4fcc4f,_0x4b3d5f,_0x180a9f){return polly(_0x87232e,_0x374f56,_0x39c86a,_0xef6eaa,_0x4fcc4f,_0x4b3d5f,_0x180a9f);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0xfbe7b2,_0xfcb0b7,_0x2e6404,_0x33b886,_0x5208c3,_0xb70e9b,_0x33c6b5){return polly(_0xfbe7b2,_0xfcb0b7,_0x2e6404,_0x33b886,_0x5208c3,_0xb70e9b,_0x33c6b5);}; \ 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 d121244..cf9d5b1 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 _0x88d1=['bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x3e8035,_0x17f78d){var _0x387ac4=function(_0x5e8a96){while(--_0x5e8a96){_0x3e8035['push'](_0x3e8035['shift']());}};_0x387ac4(++_0x17f78d);}(_0x88d1,0x6b));var _0x188d=function(_0x357cb8,_0x23750a){_0x357cb8=_0x357cb8-0x0;var _0x5cdb5f=_0x88d1[_0x357cb8];return _0x5cdb5f;};'use strict';var fs=require('fs');var path=require(_0x188d('0x0'));var BPromise=require(_0x188d('0x1'));var rs=require('randomstring');var AWS=require(_0x188d('0x2'));function pollyResult(_0x4f3e19,_0x3d3a37,_0x4bf44c){return new BPromise(function(_0x5a5f30,_0x2aa51c){_0x4f3e19[_0x188d('0x3')](_0x3d3a37,function(_0x3bba16,_0x35b582){if(_0x3bba16){_0x2aa51c(_0x3bba16);}else if(_0x35b582){if(_0x35b582['AudioStream']instanceof Buffer){fs[_0x188d('0x4')](_0x4bf44c,_0x35b582[_0x188d('0x5')],function(_0x4537af){if(_0x4537af){_0x2aa51c(_0x4537af);}else{_0x5a5f30();}});}else{_0x2aa51c(new Error(_0x188d('0x6')));}}else{_0x2aa51c(new Error(_0x188d('0x7')));}});});}module[_0x188d('0x8')]=function(_0x5a84b2,_0x3db099,_0x25f70c,_0x5e785b,_0x465ba7,_0x40e792,_0x11d208){var _0x2b3496=new AWS[(_0x188d('0x9'))]({'accessKeyId':_0x5a84b2,'secretAccessKey':_0x3db099,'region':_0x25f70c});var _0x17d51c={'Text':_0x465ba7,'TextType':_0x40e792||_0x188d('0xa'),'OutputFormat':_0x188d('0xb'),'VoiceId':_0x5e785b};return pollyResult(_0x2b3496,_0x17d51c,_0x11d208);}; \ No newline at end of file +var _0x3500=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3500,0x1d5));var _0x0350=function(_0x59bef9,_0x523272){_0x59bef9=_0x59bef9-0x0;var _0x246cf3=_0x3500[_0x59bef9];return _0x246cf3;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x352475,_0x3d58b7,_0x5b6c62){return new BPromise(function(_0x146de1,_0x3d06ee){_0x352475[_0x0350('0x0')](_0x3d58b7,function(_0x5e150c,_0x2a3d9b){if(_0x5e150c){_0x3d06ee(_0x5e150c);}else if(_0x2a3d9b){if(_0x2a3d9b[_0x0350('0x1')]instanceof Buffer){fs[_0x0350('0x2')](_0x5b6c62,_0x2a3d9b['AudioStream'],function(_0xcb3802){if(_0xcb3802){_0x3d06ee(_0xcb3802);}else{_0x146de1();}});}else{_0x3d06ee(new Error(_0x0350('0x3')));}}else{_0x3d06ee(new Error(_0x0350('0x4')));}});});}module['exports']=function(_0x4c5ddc,_0x1e140d,_0x453c29,_0x5322d0,_0x4e01ec,_0x250844,_0x283f58){var _0x1c40f9=new AWS[(_0x0350('0x5'))]({'accessKeyId':_0x4c5ddc,'secretAccessKey':_0x1e140d,'region':_0x453c29});var _0x480411={'Text':_0x4e01ec,'TextType':_0x250844||_0x0350('0x6'),'OutputFormat':'mp3','VoiceId':_0x5322d0};return pollyResult(_0x1c40f9,_0x480411,_0x283f58);}; \ 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 426bbf9..daecd77 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 _0x6a19=['exports','./lib/api'];(function(_0x368788,_0xb3213f){var _0x12c465=function(_0x28a9af){while(--_0x28a9af){_0x368788['push'](_0x368788['shift']());}};_0x12c465(++_0xb3213f);}(_0x6a19,0xe5));var _0x96a1=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x6a19[_0x3c6ae2];return _0x4edda;};'use strict';var asr=require(_0x96a1('0x0'));module[_0x96a1('0x1')]=function(_0x3da384,_0x5f3021,_0x301fb0,_0x18c546){return asr(_0x3da384,_0x5f3021,_0x301fb0);}; \ No newline at end of file +var _0x4cc8=['exports','./lib/api'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x4cc8,0x187));var _0x84cc=function(_0x1e29c7,_0x59a045){_0x1e29c7=_0x1e29c7-0x0;var _0x515b3c=_0x4cc8[_0x1e29c7];return _0x515b3c;};'use strict';var asr=require(_0x84cc('0x0'));module[_0x84cc('0x1')]=function(_0x16650f,_0x37f2ed,_0x2af94d,_0x8342bd){return asr(_0x16650f,_0x37f2ed,_0x2af94d);}; \ 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 65198bc..679cc6e 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(_0x36d44c,_0xd3f88d){var _0x156a2d=function(_0x397826){while(--_0x397826){_0x36d44c['push'](_0x36d44c['shift']());}};_0x156a2d(++_0xd3f88d);}(_0xb28a,0x166));var _0xab28=function(_0x252a4b,_0x6e5423){_0x252a4b=_0x252a4b-0x0;var _0x449185=_0xb28a[_0x252a4b];return _0x449185;};'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 _0xb4e6=['length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','https://speech.googleapis.com','exports','string'];(function(_0x3595d5,_0x5f2c14){var _0x2b4725=function(_0xadb34d){while(--_0xadb34d){_0x3595d5['push'](_0x3595d5['shift']());}};_0x2b4725(++_0x5f2c14);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xb4e6[_0x5ef905];return _0x367808;};'use strict';var url=require(_0x6b4e('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x6b4e('0x1');module[_0x6b4e('0x2')]=function(_0x365912,_0x25ffcb,_0x44e781){return new BPromise(function(_0x31e8ad,_0x1929b8){var _0x52313b;if(typeof _0x365912!==_0x6b4e('0x3')||_0x365912[_0x6b4e('0x4')]===0x0){return _0x1929b8(_0x6b4e('0x5'));}if(typeof _0x25ffcb!=='string'||_0x25ffcb[_0x6b4e('0x4')]===0x0){return _0x1929b8('key\x20should\x20be\x20a\x20string');}if(typeof _0x44e781!=='undefined'&&(typeof _0x44e781!==_0x6b4e('0x3')||_0x44e781['length']===0x0)){return _0x1929b8('lang\x20should\x20be\x20a\x20string');}try{_0x52313b=fs[_0x6b4e('0x6')](_0x365912)[_0x6b4e('0x7')](_0x6b4e('0x8'));}catch(_0x39ed74){return _0x1929b8(_0x39ed74);}return _0x31e8ad({'method':_0x6b4e('0x9'),'uri':host+_0x6b4e('0xa')+_0x25ffcb,'body':{'config':{'encoding':_0x6b4e('0xb'),'sampleRateHertz':'8000','languageCode':_0x44e781},'audio':{'content':_0x52313b}},'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 6c6ee83..5944f6d 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 _0x8b23=['./asr','exports'];(function(_0x4e4039,_0x11e658){var _0x36f758=function(_0x281120){while(--_0x281120){_0x4e4039['push'](_0x4e4039['shift']());}};_0x36f758(++_0x11e658);}(_0x8b23,0x1d8));var _0x38b2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8b23[_0x42cae2];return _0x5f256f;};var asr=require(_0x38b2('0x0'));module[_0x38b2('0x1')]={'asr':asr}; \ No newline at end of file +var _0x062c=['./asr'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x062c,0x11b));var _0xc062=function(_0x12500a,_0x5b1c7c){_0x12500a=_0x12500a-0x0;var _0x2c357b=_0x062c[_0x12500a];return _0x2c357b;};var asr=require(_0xc062('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 e52d04b..9cf2826 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 _0x2ceb=['awsPolly','polly','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','path','querystring','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','wav','error\x20convert','info','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','input','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','actionIncomplete','speech','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence'];(function(_0x3df3ae,_0x4d81ea){var _0x5bcfa5=function(_0x2fde20){while(--_0x2fde20){_0x3df3ae['push'](_0x3df3ae['shift']());}};_0x5bcfa5(++_0x4d81ea);}(_0x2ceb,0x19d));var _0xb2ce=function(_0x2251a2,_0x22549e){_0x2251a2=_0x2251a2-0x0;var _0x487677=_0x2ceb[_0x2251a2];return _0x487677;};'use strict';var apiai=require(_0xb2ce('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xb2ce('0x1'));var fs=require('fs');var http=require(_0xb2ce('0x2'));var https=require(_0xb2ce('0x3'));var md5=require('md5');var path=require(_0xb2ce('0x4'));var querystring=require(_0xb2ce('0x5'));var rp=require('request-promise');var rs=require(_0xb2ce('0x6'));var sox=require(_0xb2ce('0x7'));var tts=require(_0xb2ce('0x8'));var urlParse=require(_0xb2ce('0x9'))[_0xb2ce('0xa')];var util=require('util');var aws=require(_0xb2ce('0xb'));var google=require(_0xb2ce('0xc'));var sestek=require(_0xb2ce('0xd'));var tilde=require(_0xb2ce('0xe'));var logger=require(_0xb2ce('0xf'))(_0xb2ce('0x10'));var ISPEECH_API=_0xb2ce('0x11');function downloadFile(_0x525b8c,_0x2472e7){return new BPromise(function(_0xb09a29,_0x5921a2){var _0x3ad5c1=urlParse(_0x525b8c);var _0x58ec8c=_0x3ad5c1[_0xb2ce('0x12')]===_0xb2ce('0x13')?https:http;var _0x1f233e={'host':_0x3ad5c1[_0xb2ce('0x14')],'path':_0x3ad5c1['path'],'headers':{'user-agent':_0xb2ce('0x15')}};_0x58ec8c[_0xb2ce('0x16')](_0x1f233e,function(_0x1bc5e3){if(_0x1bc5e3[_0xb2ce('0x17')]!==0xc8){logger[_0xb2ce('0x18')]('request\x20to\x20'+_0x525b8c+_0xb2ce('0x19')+_0x1bc5e3['statusCode']+'\x20('+_0x1bc5e3[_0xb2ce('0x1a')]+')');_0x5921a2(new Error(_0xb2ce('0x1b')+_0x525b8c+_0xb2ce('0x19')+_0x1bc5e3[_0xb2ce('0x17')]+'\x20('+_0x1bc5e3[_0xb2ce('0x1a')]+')'));return;}var _0x56832b=fs[_0xb2ce('0x1c')](_0x2472e7);_0x56832b['on']('finish',function(){logger['info'](_0xb2ce('0x1d'));_0x56832b[_0xb2ce('0x1e')](_0xb09a29);});_0x56832b['on'](_0xb2ce('0x18'),function(_0x579640){fs[_0xb2ce('0x1f')](_0x2472e7);logger[_0xb2ce('0x18')]('download\x20error',_0x579640);_0x5921a2(_0x579640);});_0x1bc5e3[_0xb2ce('0x20')](_0x56832b);})['on'](_0xb2ce('0x18'),function(_0x3eb90f){logger[_0xb2ce('0x18')](_0x3eb90f);_0x5921a2(_0x3eb90f);})[_0xb2ce('0x21')]();});}function uploadFile(_0x45185f){return new BPromise(function(_0x5348a2,_0x3957db){var _0x5b0e09=urlParse(_0x45185f);var _0x4af09a=_0x5b0e09[_0xb2ce('0x12')]===_0xb2ce('0x13')?https:http;var _0x12b499={'host':_0x5b0e09['host'],'path':_0x5b0e09[_0xb2ce('0x4')],'headers':{'user-agent':_0xb2ce('0x15')}};_0x4af09a['get'](_0x12b499,function(_0x5d4957){if(_0x5d4957['statusCode']!==0xc8){_0x3957db(new Error(_0xb2ce('0x1b')+_0x45185f+_0xb2ce('0x19')+_0x5d4957['statusCode']+'\x20('+_0x5d4957[_0xb2ce('0x1a')]+')'));return;}var _0x3dc939='';_0x5d4957['on'](_0xb2ce('0x22'),function(_0x874848){_0x3dc939+=_0x874848;});_0x5d4957['on'](_0xb2ce('0x21'),function(){_0x5348a2(_0x3dc939);});})['on']('error',function(_0x327252){_0x3957db(_0x327252);})['end']();});}function convertFile(_0xe30351,_0x34055b){return new BPromise(function(_0x5723c3,_0x3b94d2){var _0x2ca3e8=sox[_0xb2ce('0x23')](_0xe30351,_0x34055b,{'sampleRate':0x1f40,'format':_0xb2ce('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ca3e8['on'](_0xb2ce('0x18'),function(_0x1f38a7){logger[_0xb2ce('0x18')](_0xb2ce('0x25'),_0x1f38a7);_0x3b94d2(_0x1f38a7);});_0x2ca3e8['on']('end',function(){logger[_0xb2ce('0x26')]('finish\x20to\x20convert');_0x5723c3();});_0x2ca3e8[_0xb2ce('0x27')]();});}function base64Decode(_0x1da837,_0x4695b9){var _0x2217a5=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x2b'));fs[_0xb2ce('0x2c')](_0x2217a5,_0x1da837,_0xb2ce('0x2d'));return convertFile(_0x2217a5,_0x4695b9)['then'](function(){try{fs['unlink'](_0x2217a5);fs[_0xb2ce('0x2e')](_0x4695b9,_0xb2ce('0x2f'));}catch(_0x5af768){logger[_0xb2ce('0x18')](_0x5af768);}return _0x4695b9[_0xb2ce('0x30')]('.')[0x0];});}function base64Encode(_0x3ba5b5){var _0x2905cf=fs[_0xb2ce('0x31')](_0x3ba5b5);return new Buffer(_0x2905cf)[_0xb2ce('0x32')](_0xb2ce('0x2d'));}exports[_0xb2ce('0x33')]=function(_0x4ee35d,_0x328197,_0xfd5de6,_0x2e3b8d,_0x22502f,_0x1b46c5){var _0x5f619f,_0x3fb5a0;var _0x4c94a5='https://texttospeech.googleapis.com/v1/';var _0x1005e3='?key='+_0x4ee35d;var _0x49bde5={};if(_0x328197==='ssml'){_0x49bde5[_0xb2ce('0x34')]={'ssml':_0xfd5de6};}else{_0x49bde5[_0xb2ce('0x34')]={'text':_0xfd5de6};};_0x49bde5['voice']={'languageCode':_0x2e3b8d,'ssmlGender':_0x22502f};_0x49bde5[_0xb2ce('0x35')]={'audioEncoding':_0xb2ce('0x36'),'sampleRateHertz':0x1f40};var _0x2dcd1d={'url':_0x4c94a5+_0xb2ce('0x37')+_0x1005e3,'method':_0xb2ce('0x38'),'json':!![],'body':_0x49bde5};return rp(_0x2dcd1d)[_0xb2ce('0x39')](function(_0x31fa9a){return new BPromise(function(_0x26fb92,_0x2d7b6e){_0x5f619f=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x3a'));var _0x4334de=Buffer[_0xb2ce('0x3b')](_0x31fa9a[_0xb2ce('0x3c')],_0xb2ce('0x2d'));return fs[_0xb2ce('0x3d')](_0x5f619f,_0x4334de,function(_0x431e3d){_0x2d7b6e(_0x431e3d);},function(_0x4b63b2){fs[_0xb2ce('0x2e')](_0x5f619f,'777');_0x26fb92(_0x4b63b2);});});})['then'](function(_0x20135f){_0x3fb5a0=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x2b'));return convertFile(_0x5f619f,_0x3fb5a0);})[_0xb2ce('0x39')](function(){try{fs['unlink'](_0x5f619f);fs[_0xb2ce('0x2e')](_0x3fb5a0,_0xb2ce('0x2f'));}catch(_0x2154ce){logger[_0xb2ce('0x18')](_0x2154ce);}logger[_0xb2ce('0x26')](_0xb2ce('0x3e'),_0x3fb5a0[_0xb2ce('0x30')]('.')[0x0]);return _0x3fb5a0['split']('.')[0x0];});};exports['googleTTS']=function(_0x53dcc8,_0x5ed943){var _0x3b51ea=_0xb2ce('0x3f');var _0x488ae5,_0x4f1fb5;var _0x444a3d;var _0x23f3a4={'encoding':_0xb2ce('0x40'),'method':_0xb2ce('0x38'),'timeout':0x2710,'url':_0x3b51ea,'headers':{'Content-Type':_0xb2ce('0x41')},'body':_0xb2ce('0x42')+encodeURIComponent(JSON[_0xb2ce('0x43')]([[[_0xb2ce('0x44'),JSON[_0xb2ce('0x43')]([_0x53dcc8,_0x5ed943||'en',![],_0xb2ce('0x45')]),null,_0xb2ce('0x46')]]]))};return rp(_0x23f3a4)[_0xb2ce('0x39')](function(_0x30fc18){try{_0x444a3d=eval(_0x30fc18[_0xb2ce('0x47')](0x5))[0x0][0x2];}catch(_0x50ffad){throw new Error(_0xb2ce('0x48')+_0x30fc18['data']);}if(!_0x444a3d){if(_0x53dcc8[_0xb2ce('0x49')]>0xc8){throw new Error(_0xb2ce('0x4a'));}else{throw new Error(_0xb2ce('0x4b')+_0x5ed943+'\x22\x20might\x20not\x20exist');}}try{_0x444a3d=eval(_0x444a3d)[0x0];}catch(_0x58329a){throw new Error(_0xb2ce('0x48')+res[_0xb2ce('0x22')]);}const _0x52a590=_0x444a3d;_0x488ae5=path['resolve'](__dirname,_0xb2ce('0x29'),rs['generate'](0x4)+_0xb2ce('0x3a'));fs['writeFileSync'](_0x488ae5,_0x444a3d,{'encoding':_0xb2ce('0x2d')});_0x4f1fb5=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x2b'));return convertFile(_0x488ae5,_0x4f1fb5);})[_0xb2ce('0x39')](function(){try{fs['unlink'](_0x488ae5);fs[_0xb2ce('0x2e')](_0x4f1fb5,_0xb2ce('0x2f'));}catch(_0x5bb71a){logger[_0xb2ce('0x18')](_0x5bb71a);}logger[_0xb2ce('0x26')](_0xb2ce('0x4c'),_0x4f1fb5[_0xb2ce('0x30')]('.')[0x0]);return _0x4f1fb5['split']('.')[0x0];});};exports[_0xb2ce('0x4d')]=function(_0x10a480,_0x272573,_0x2ba9f6){return google[_0xb2ce('0x4e')](_0x10a480,_0x272573,_0x2ba9f6)['then'](function(_0x217b8e){logger[_0xb2ce('0x26')](_0x217b8e['uri']);return rp(_0x217b8e);})[_0xb2ce('0x39')](function(_0x24d3b5){var _0x4f205e='';var _0x5d2716=0x0;try{fs[_0xb2ce('0x1f')](_0x10a480);}catch(_0x3db385){logger['error'](_0x3db385);}if(_0x24d3b5&&_0x24d3b5['results']){_0x4f205e=_0x24d3b5[_0xb2ce('0x4f')][_0xb2ce('0x50')](function(_0x5b2d71){return _0x5b2d71&&_0x5b2d71[_0xb2ce('0x51')][0x0]&&_0x5b2d71[_0xb2ce('0x51')][0x0]['transcript']?_0x5b2d71[_0xb2ce('0x51')][0x0]['transcript']:'';})[_0xb2ce('0x52')]('\x0a');_0x5d2716=_0x24d3b5[_0xb2ce('0x4f')][_0xb2ce('0x50')](function(_0x2a25ad){return _0x2a25ad&&_0x2a25ad[_0xb2ce('0x51')][0x0]&&_0x2a25ad[_0xb2ce('0x51')][0x0]['confidence']?_0x2a25ad[_0xb2ce('0x51')][0x0][_0xb2ce('0x53')]:0x0;})[_0xb2ce('0x52')]('\x0a');}logger[_0xb2ce('0x26')](_0xb2ce('0x54'),_0x4f205e);logger[_0xb2ce('0x26')](_0xb2ce('0x55'),_0x5d2716);return{'transcript':_0x4f205e,'confidence':_0x5d2716};})[_0xb2ce('0x56')](function(_0x370a58){logger[_0xb2ce('0x18')](_0xb2ce('0x57'),_0x370a58[_0xb2ce('0x17')],_0x370a58[_0xb2ce('0x58')],_0x370a58[_0xb2ce('0x59')]);});};exports[_0xb2ce('0x5a')]=function(_0x3475aa,_0x858b2a,_0x57a3f9,_0x4ddd5c){var _0x61749f=apiai(_0x858b2a,{'language':_0x4ddd5c||'en'});return _0x61749f[_0xb2ce('0x5b')](_0x57a3f9,{'sessionId':md5(_0x3475aa)})[_0xb2ce('0x39')](function(_0x2e7ec4){logger[_0xb2ce('0x26')](JSON[_0xb2ce('0x43')](_0x2e7ec4));return{'source':_0x2e7ec4['result']['source'],'resolvedQuery':_0x2e7ec4[_0xb2ce('0x5c')][_0xb2ce('0x5d')],'action':_0x2e7ec4[_0xb2ce('0x5c')]['action'],'actionIncomplete':_0x2e7ec4[_0xb2ce('0x5c')][_0xb2ce('0x5e')],'speech':_0x2e7ec4[_0xb2ce('0x5c')]['fulfillment'][_0xb2ce('0x5f')],'score':_0x2e7ec4[_0xb2ce('0x5c')][_0xb2ce('0x60')],'statusCode':_0x2e7ec4['status']['code'],'endConversation':_0x2e7ec4[_0xb2ce('0x5c')][_0xb2ce('0x61')][_0xb2ce('0x62')]||![],'isFallbackIntent':_0x2e7ec4[_0xb2ce('0x5c')]['metadata'][_0xb2ce('0x63')]};});};exports[_0xb2ce('0x64')]=function(_0x4333f0,_0x148964,_0x37d635,_0x2f4c7c,_0x3efb13,_0x36044c){var _0x3be4f1=_0x2f4c7c[_0xb2ce('0x65')](/\\n/g,'\x0a');var _0x2b98b7={'credentials':{'private_key':_0x3be4f1,'client_email':_0x37d635}};var _0x3b8100=new dialogflow[(_0xb2ce('0x66'))](_0x2b98b7);var _0x19330c=_0x3b8100[_0xb2ce('0x67')](_0x148964,md5(_0x4333f0));var _0x3bc9a9={'session':_0x19330c,'queryInput':{'text':{'text':_0x3efb13,'languageCode':_0x36044c}}};return _0x3b8100['detectIntent'](_0x3bc9a9)['then'](function(_0x17f9a5){if(_0x17f9a5&&_0x17f9a5[_0xb2ce('0x49')]){logger[_0xb2ce('0x26')]('Dialogflow\x20V2\x20response:',JSON[_0xb2ce('0x43')](_0x17f9a5));var _0x554f0e=_0x17f9a5[0x0];if(_0x554f0e){var _0x8c7c6a={'action':_0x554f0e['queryResult'][_0xb2ce('0x68')],'allRequiredParamsPresent':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6a')],'endConversation':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6b')]&&_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6b')][_0xb2ce('0x6c')]?_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6b')][_0xb2ce('0x6c')][_0xb2ce('0x6d')]['boolValue']:![],'fulfillmentText':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6e')],'intentName':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6f')][_0xb2ce('0x58')],'intentDisplayName':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6f')]['displayName'],'isFallbackIntent':_0x554f0e['queryResult'][_0xb2ce('0x6f')]['isFallback'],'languageCode':_0x554f0e['queryResult'][_0xb2ce('0x70')],'queryText':_0x554f0e[_0xb2ce('0x69')]['queryText'],'responseId':_0x554f0e[_0xb2ce('0x71')],'score':_0x554f0e['queryResult'][_0xb2ce('0x72')],'speech':_0x554f0e[_0xb2ce('0x69')][_0xb2ce('0x6e')],'providerResponse':JSON[_0xb2ce('0x43')](_0x17f9a5)};return _0x8c7c6a;}}});};exports[_0xb2ce('0x73')]=function(_0x568127,_0x2003b1,_0x528175,_0x4be7cb){return tilde[_0xb2ce('0x4e')](_0x568127,_0x2003b1,_0x528175,_0x4be7cb)[_0xb2ce('0x39')](function(_0x54d01d){try{fs['unlink'](_0x568127);}catch(_0x336913){logger[_0xb2ce('0x18')](_0x336913);}logger[_0xb2ce('0x26')](_0xb2ce('0x74'),_0x54d01d[_0xb2ce('0x75')]);logger[_0xb2ce('0x26')](_0xb2ce('0x76'),_0x54d01d[_0xb2ce('0x53')]);return _0x54d01d;});};exports[_0xb2ce('0x77')]=function(_0x45c7eb,_0x583161,_0x3b1add,_0x444c53,_0x33e0ec,_0x40d9a3){var _0x32da71=path[_0xb2ce('0x28')](__dirname,'tmp',rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x3a'));var _0x32bb04;return aws[_0xb2ce('0x78')](_0x45c7eb,_0x583161,_0x3b1add,_0x444c53,_0x33e0ec,_0x40d9a3,_0x32da71)[_0xb2ce('0x39')](function(){_0x32bb04=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x2b'));return convertFile(_0x32da71,_0x32bb04);})[_0xb2ce('0x39')](function(){try{fs[_0xb2ce('0x1f')](_0x32da71);fs[_0xb2ce('0x2e')](_0x32bb04,'777');}catch(_0x49aa39){logger[_0xb2ce('0x18')](_0x49aa39);}return _0x32bb04[_0xb2ce('0x30')]('.')[0x0];});};exports['awsLex']=function(_0xdf23c7,_0x52a475,_0x6c45ad,_0x4e5570,_0x37b1ca,_0x296544){return aws['lex'](_0xdf23c7,_0x52a475,_0x6c45ad,_0x4e5570,_0x37b1ca,_0x296544)['then'](function(_0x48eec0){logger[_0xb2ce('0x26')](JSON['stringify'](_0x48eec0));return _0x48eec0;});};exports['ispeechTTS']=function(_0x1f9de6,_0x3fc1c8,_0x5568e7,_0x163f2a){var _0x39fe54=util['format'](_0xb2ce('0x79'),ISPEECH_API,_0x1f9de6,encodeURIComponent(_0x3fc1c8),_0x5568e7,_0x163f2a);var _0x7fbd51=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x3a'));var _0x26b96b;return downloadFile(_0x39fe54,_0x7fbd51)[_0xb2ce('0x39')](function(){_0x26b96b=path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+_0xb2ce('0x2b'));return convertFile(_0x7fbd51,_0x26b96b);})[_0xb2ce('0x39')](function(){try{fs[_0xb2ce('0x1f')](_0x7fbd51);fs['chmodSync'](_0x26b96b,_0xb2ce('0x2f'));}catch(_0x9a7712){logger['error'](_0x9a7712);}return _0x26b96b['split']('.')[0x0];});};exports['ispeechASR']=function(_0x5eb46e,_0x117220,_0x49117e,_0x572fac){var _0x48f9e3=util[_0xb2ce('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x117220,_0x49117e,base64Encode(_0x5eb46e),_0x572fac?util['format']('model=%s',encodeURIComponent(_0x572fac)):_0xb2ce('0x7b'));return uploadFile(_0x48f9e3)[_0xb2ce('0x39')](function(_0x261817){return querystring[_0xb2ce('0xa')](_0x261817);});};exports[_0xb2ce('0x7c')]=function(_0xf9677c,_0x7b5a5e){return sestek[_0xb2ce('0x7d')](_0xf9677c,_0x7b5a5e)['then'](function(_0x563003){logger[_0xb2ce('0x26')](JSON[_0xb2ce('0x43')](_0x563003));var _0x52740f={'speech':_0x563003['text'],'action':_0x563003[_0xb2ce('0x7e')]?_0x563003[_0xb2ce('0x7e')][_0xb2ce('0x7f')]:undefined,'actiondata':_0x563003[_0xb2ce('0x7e')]?_0x563003[_0xb2ce('0x7e')][_0xb2ce('0x80')]:undefined};if(_0x563003[_0xb2ce('0x7e')]&&_0x563003[_0xb2ce('0x7e')][_0xb2ce('0x81')]){return base64Decode(_0x563003[_0xb2ce('0x7e')][_0xb2ce('0x81')][_0xb2ce('0x82')],path[_0xb2ce('0x28')](__dirname,_0xb2ce('0x29'),rs[_0xb2ce('0x2a')](0x4)+'.wav'))[_0xb2ce('0x39')](function(_0x364558){_0x52740f[_0xb2ce('0x83')]=_0x364558;return _0x52740f;});}return _0x52740f;});};exports[_0xb2ce('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0xa1c7=['https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','download\x20error','end','WHAT_EVER','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','.mp3','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','googleDialogflowV2','SessionsClient','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa1c7,0x71));var _0x7a1c=function(_0x2a4f8b,_0x318959){_0x2a4f8b=_0x2a4f8b-0x0;var _0x55f9b7=_0xa1c7[_0x2a4f8b];return _0x55f9b7;};'use strict';var apiai=require(_0x7a1c('0x0'));var BPromise=require(_0x7a1c('0x1'));var dialogflow=require(_0x7a1c('0x2'));var fs=require('fs');var http=require(_0x7a1c('0x3'));var https=require(_0x7a1c('0x4'));var md5=require(_0x7a1c('0x5'));var path=require(_0x7a1c('0x6'));var querystring=require(_0x7a1c('0x7'));var rp=require(_0x7a1c('0x8'));var rs=require(_0x7a1c('0x9'));var sox=require(_0x7a1c('0xa'));var tts=require('google-tts-api');var urlParse=require('url')[_0x7a1c('0xb')];var util=require('util');var aws=require(_0x7a1c('0xc'));var google=require(_0x7a1c('0xd'));var sestek=require(_0x7a1c('0xe'));var tilde=require(_0x7a1c('0xf'));var logger=require(_0x7a1c('0x10'))(_0x7a1c('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xa20f16,_0x11d023){return new BPromise(function(_0xfe2788,_0x1eff6b){var _0x531a6d=urlParse(_0xa20f16);var _0x2ea1d5=_0x531a6d[_0x7a1c('0x12')]===_0x7a1c('0x13')?https:http;var _0x57829f={'host':_0x531a6d[_0x7a1c('0x14')],'path':_0x531a6d[_0x7a1c('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x2ea1d5[_0x7a1c('0x15')](_0x57829f,function(_0x5230e2){if(_0x5230e2[_0x7a1c('0x16')]!==0xc8){logger[_0x7a1c('0x17')](_0x7a1c('0x18')+_0xa20f16+_0x7a1c('0x19')+_0x5230e2['statusCode']+'\x20('+_0x5230e2[_0x7a1c('0x1a')]+')');_0x1eff6b(new Error(_0x7a1c('0x18')+_0xa20f16+'\x20failed,\x20status\x20code\x20=\x20'+_0x5230e2[_0x7a1c('0x16')]+'\x20('+_0x5230e2['statusMessage']+')'));return;}var _0x186983=fs['createWriteStream'](_0x11d023);_0x186983['on'](_0x7a1c('0x1b'),function(){logger[_0x7a1c('0x1c')](_0x7a1c('0x1d'));_0x186983['close'](_0xfe2788);});_0x186983['on'](_0x7a1c('0x17'),function(_0x390bb9){fs[_0x7a1c('0x1e')](_0x11d023);logger[_0x7a1c('0x17')](_0x7a1c('0x1f'),_0x390bb9);_0x1eff6b(_0x390bb9);});_0x5230e2['pipe'](_0x186983);})['on'](_0x7a1c('0x17'),function(_0x42f11c){logger[_0x7a1c('0x17')](_0x42f11c);_0x1eff6b(_0x42f11c);})[_0x7a1c('0x20')]();});}function uploadFile(_0x2b88e0){return new BPromise(function(_0x19d5c0,_0x49ffc8){var _0x611648=urlParse(_0x2b88e0);var _0x3940a1=_0x611648[_0x7a1c('0x12')]===_0x7a1c('0x13')?https:http;var _0x3f39ae={'host':_0x611648[_0x7a1c('0x14')],'path':_0x611648[_0x7a1c('0x6')],'headers':{'user-agent':_0x7a1c('0x21')}};_0x3940a1[_0x7a1c('0x15')](_0x3f39ae,function(_0xc490a7){if(_0xc490a7['statusCode']!==0xc8){_0x49ffc8(new Error(_0x7a1c('0x18')+_0x2b88e0+_0x7a1c('0x19')+_0xc490a7[_0x7a1c('0x16')]+'\x20('+_0xc490a7[_0x7a1c('0x1a')]+')'));return;}var _0x41a580='';_0xc490a7['on'](_0x7a1c('0x22'),function(_0x4b1237){_0x41a580+=_0x4b1237;});_0xc490a7['on'](_0x7a1c('0x20'),function(){_0x19d5c0(_0x41a580);});})['on'](_0x7a1c('0x17'),function(_0x53d33e){_0x49ffc8(_0x53d33e);})[_0x7a1c('0x20')]();});}function convertFile(_0x4b1021,_0x532867){return new BPromise(function(_0x4c6c1e,_0x36f7ea){var _0x26a746=sox[_0x7a1c('0x23')](_0x4b1021,_0x532867,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26a746['on']('error',function(_0x37f460){logger[_0x7a1c('0x17')](_0x7a1c('0x24'),_0x37f460);_0x36f7ea(_0x37f460);});_0x26a746['on'](_0x7a1c('0x20'),function(){logger['info'](_0x7a1c('0x25'));_0x4c6c1e();});_0x26a746[_0x7a1c('0x26')]();});}function base64Decode(_0x4a35cc,_0x18d465){var _0x441cf5=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs[_0x7a1c('0x29')](0x4)+_0x7a1c('0x2a'));fs[_0x7a1c('0x2b')](_0x441cf5,_0x4a35cc,_0x7a1c('0x2c'));return convertFile(_0x441cf5,_0x18d465)[_0x7a1c('0x2d')](function(){try{fs[_0x7a1c('0x1e')](_0x441cf5);fs[_0x7a1c('0x2e')](_0x18d465,'777');}catch(_0x1759e0){logger['error'](_0x1759e0);}return _0x18d465[_0x7a1c('0x2f')]('.')[0x0];});}function base64Encode(_0x577fd7){var _0x56ccc6=fs[_0x7a1c('0x30')](_0x577fd7);return new Buffer(_0x56ccc6)[_0x7a1c('0x31')](_0x7a1c('0x2c'));}exports[_0x7a1c('0x32')]=function(_0x4251f6,_0xbac1b9,_0x31d494,_0x3e3094,_0x1f41c0,_0x2e85eb){var _0x1730f9,_0x1ffd58;var _0x520f88=_0x7a1c('0x33');var _0x55c289='?key='+_0x4251f6;var _0x29b294={};if(_0xbac1b9===_0x7a1c('0x34')){_0x29b294[_0x7a1c('0x35')]={'ssml':_0x31d494};}else{_0x29b294[_0x7a1c('0x35')]={'text':_0x31d494};};_0x29b294[_0x7a1c('0x36')]={'languageCode':_0x3e3094,'ssmlGender':_0x1f41c0};_0x29b294[_0x7a1c('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2969e0={'url':_0x520f88+_0x7a1c('0x38')+_0x55c289,'method':_0x7a1c('0x39'),'json':!![],'body':_0x29b294};return rp(_0x2969e0)[_0x7a1c('0x2d')](function(_0x456145){return new BPromise(function(_0x102ae8,_0x344b12){_0x1730f9=path[_0x7a1c('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x7a1c('0x3a'));var _0x4c3902=Buffer['from'](_0x456145[_0x7a1c('0x3b')],_0x7a1c('0x2c'));return fs[_0x7a1c('0x3c')](_0x1730f9,_0x4c3902,function(_0x258cce){_0x344b12(_0x258cce);},function(_0x45eaed){fs['chmodSync'](_0x1730f9,_0x7a1c('0x3d'));_0x102ae8(_0x45eaed);});});})[_0x7a1c('0x2d')](function(_0x27cc4d){_0x1ffd58=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs[_0x7a1c('0x29')](0x4)+_0x7a1c('0x2a'));return convertFile(_0x1730f9,_0x1ffd58);})[_0x7a1c('0x2d')](function(){try{fs['unlink'](_0x1730f9);fs['chmodSync'](_0x1ffd58,_0x7a1c('0x3d'));}catch(_0x47a2b6){logger[_0x7a1c('0x17')](_0x47a2b6);}logger[_0x7a1c('0x1c')](_0x7a1c('0x3e'),_0x1ffd58[_0x7a1c('0x2f')]('.')[0x0]);return _0x1ffd58['split']('.')[0x0];});};exports[_0x7a1c('0x3f')]=function(_0x4c2a3f,_0x2d3aea){var _0x4ddcc9=_0x7a1c('0x40');var _0x271678,_0x2602f1;var _0x154a97;var _0x33a8b5={'encoding':_0x7a1c('0x41'),'method':'POST','timeout':0x2710,'url':_0x4ddcc9,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x7a1c('0x42')]([[[_0x7a1c('0x43'),JSON['stringify']([_0x4c2a3f,_0x2d3aea||'en',![],_0x7a1c('0x44')]),null,_0x7a1c('0x45')]]]))};return rp(_0x33a8b5)[_0x7a1c('0x2d')](function(_0x281c84){try{_0x154a97=eval(_0x281c84['slice'](0x5))[0x0][0x2];}catch(_0x50465e){throw new Error(_0x7a1c('0x46')+_0x281c84[_0x7a1c('0x22')]);}if(!_0x154a97){if(_0x4c2a3f[_0x7a1c('0x47')]>0xc8){throw new Error(_0x7a1c('0x48'));}else{throw new Error(_0x7a1c('0x49')+_0x2d3aea+'\x22\x20might\x20not\x20exist');}}try{_0x154a97=eval(_0x154a97)[0x0];}catch(_0x2acbff){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x543df9=_0x154a97;_0x271678=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs[_0x7a1c('0x29')](0x4)+_0x7a1c('0x3a'));fs[_0x7a1c('0x2b')](_0x271678,_0x154a97,{'encoding':_0x7a1c('0x2c')});_0x2602f1=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs[_0x7a1c('0x29')](0x4)+'.wav');return convertFile(_0x271678,_0x2602f1);})['then'](function(){try{fs[_0x7a1c('0x1e')](_0x271678);fs[_0x7a1c('0x2e')](_0x2602f1,_0x7a1c('0x3d'));}catch(_0x327f53){logger[_0x7a1c('0x17')](_0x327f53);}logger[_0x7a1c('0x1c')](_0x7a1c('0x4a'),_0x2602f1['split']('.')[0x0]);return _0x2602f1[_0x7a1c('0x2f')]('.')[0x0];});};exports[_0x7a1c('0x4b')]=function(_0xf84c7,_0x1f2ffc,_0xa73d84){return google[_0x7a1c('0x4c')](_0xf84c7,_0x1f2ffc,_0xa73d84)[_0x7a1c('0x2d')](function(_0x1eb835){logger[_0x7a1c('0x1c')](_0x1eb835[_0x7a1c('0x4d')]);return rp(_0x1eb835);})[_0x7a1c('0x2d')](function(_0x149c87){var _0x34e0c7='';var _0x70010d=0x0;try{fs[_0x7a1c('0x1e')](_0xf84c7);}catch(_0x19ff24){logger[_0x7a1c('0x17')](_0x19ff24);}if(_0x149c87&&_0x149c87[_0x7a1c('0x4e')]){_0x34e0c7=_0x149c87[_0x7a1c('0x4e')]['map'](function(_0x3983e2){return _0x3983e2&&_0x3983e2[_0x7a1c('0x4f')][0x0]&&_0x3983e2[_0x7a1c('0x4f')][0x0]['transcript']?_0x3983e2['alternatives'][0x0][_0x7a1c('0x50')]:'';})[_0x7a1c('0x51')]('\x0a');_0x70010d=_0x149c87[_0x7a1c('0x4e')]['map'](function(_0x5a26ac){return _0x5a26ac&&_0x5a26ac['alternatives'][0x0]&&_0x5a26ac[_0x7a1c('0x4f')][0x0][_0x7a1c('0x52')]?_0x5a26ac[_0x7a1c('0x4f')][0x0]['confidence']:0x0;})[_0x7a1c('0x51')]('\x0a');}logger['info']('googleASR\x20transcription',_0x34e0c7);logger[_0x7a1c('0x1c')](_0x7a1c('0x53'),_0x70010d);return{'transcript':_0x34e0c7,'confidence':_0x70010d};})[_0x7a1c('0x54')](function(_0x183d97){logger[_0x7a1c('0x17')](_0x7a1c('0x55'),_0x183d97[_0x7a1c('0x16')],_0x183d97['name'],_0x183d97[_0x7a1c('0x56')]);});};exports['googleDialogflow']=function(_0x3c505d,_0x2902b1,_0x41e729,_0x347b83){var _0x203d61=apiai(_0x2902b1,{'language':_0x347b83||'en'});return _0x203d61[_0x7a1c('0x57')](_0x41e729,{'sessionId':md5(_0x3c505d)})['then'](function(_0x4ae4a8){logger[_0x7a1c('0x1c')](JSON['stringify'](_0x4ae4a8));return{'source':_0x4ae4a8[_0x7a1c('0x58')]['source'],'resolvedQuery':_0x4ae4a8[_0x7a1c('0x58')][_0x7a1c('0x59')],'action':_0x4ae4a8[_0x7a1c('0x58')][_0x7a1c('0x5a')],'actionIncomplete':_0x4ae4a8[_0x7a1c('0x58')][_0x7a1c('0x5b')],'speech':_0x4ae4a8[_0x7a1c('0x58')][_0x7a1c('0x5c')][_0x7a1c('0x5d')],'score':_0x4ae4a8['result'][_0x7a1c('0x5e')],'statusCode':_0x4ae4a8[_0x7a1c('0x5f')]['code'],'endConversation':_0x4ae4a8['result'][_0x7a1c('0x60')][_0x7a1c('0x61')]||![],'isFallbackIntent':_0x4ae4a8[_0x7a1c('0x58')][_0x7a1c('0x60')]['isFallbackIntent']};});};exports[_0x7a1c('0x62')]=function(_0x5a8877,_0x241cb8,_0x38a875,_0x17e339,_0x1c9c1f,_0x6e73de){var _0xf0fbaf=_0x17e339['replace'](/\\n/g,'\x0a');var _0x11dde1={'credentials':{'private_key':_0xf0fbaf,'client_email':_0x38a875}};var _0x2b43ba=new dialogflow[(_0x7a1c('0x63'))](_0x11dde1);var _0x364849=_0x2b43ba['sessionPath'](_0x241cb8,md5(_0x5a8877));var _0x481d83={'session':_0x364849,'queryInput':{'text':{'text':_0x1c9c1f,'languageCode':_0x6e73de}}};return _0x2b43ba['detectIntent'](_0x481d83)[_0x7a1c('0x2d')](function(_0x3f3633){if(_0x3f3633&&_0x3f3633[_0x7a1c('0x47')]){logger[_0x7a1c('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0x7a1c('0x42')](_0x3f3633));var _0xe00854=_0x3f3633[0x0];if(_0xe00854){var _0x34555d={'action':_0xe00854['queryResult'][_0x7a1c('0x5a')],'allRequiredParamsPresent':_0xe00854[_0x7a1c('0x64')]['allRequiredParamsPresent'],'endConversation':_0xe00854['queryResult'][_0x7a1c('0x65')]&&_0xe00854[_0x7a1c('0x64')]['diagnosticInfo'][_0x7a1c('0x66')]?_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x65')]['fields'][_0x7a1c('0x67')][_0x7a1c('0x68')]:![],'fulfillmentText':_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x69')],'intentName':_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x6a')][_0x7a1c('0x6b')],'intentDisplayName':_0xe00854['queryResult'][_0x7a1c('0x6a')]['displayName'],'isFallbackIntent':_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x6a')]['isFallback'],'languageCode':_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x6c')],'queryText':_0xe00854['queryResult'][_0x7a1c('0x6d')],'responseId':_0xe00854[_0x7a1c('0x6e')],'score':_0xe00854[_0x7a1c('0x64')]['intentDetectionConfidence'],'speech':_0xe00854[_0x7a1c('0x64')][_0x7a1c('0x69')],'providerResponse':JSON[_0x7a1c('0x42')](_0x3f3633)};return _0x34555d;}}});};exports[_0x7a1c('0x6f')]=function(_0x10f865,_0x317f8e,_0x61cea,_0x5f2838){return tilde[_0x7a1c('0x4c')](_0x10f865,_0x317f8e,_0x61cea,_0x5f2838)['then'](function(_0x53488c){try{fs[_0x7a1c('0x1e')](_0x10f865);}catch(_0x33aea5){logger[_0x7a1c('0x17')](_0x33aea5);}logger[_0x7a1c('0x1c')]('Tilde\x20ASR\x20transcription',_0x53488c[_0x7a1c('0x50')]);logger[_0x7a1c('0x1c')](_0x7a1c('0x70'),_0x53488c[_0x7a1c('0x52')]);return _0x53488c;});};exports[_0x7a1c('0x71')]=function(_0x105338,_0x5358cc,_0x1f2f2b,_0x2a8825,_0x440dc5,_0x276a97){var _0x13b9b4=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs[_0x7a1c('0x29')](0x4)+'.mp3');var _0x5f105f;return aws[_0x7a1c('0x72')](_0x105338,_0x5358cc,_0x1f2f2b,_0x2a8825,_0x440dc5,_0x276a97,_0x13b9b4)['then'](function(){_0x5f105f=path['resolve'](__dirname,_0x7a1c('0x28'),rs['generate'](0x4)+_0x7a1c('0x2a'));return convertFile(_0x13b9b4,_0x5f105f);})[_0x7a1c('0x2d')](function(){try{fs[_0x7a1c('0x1e')](_0x13b9b4);fs[_0x7a1c('0x2e')](_0x5f105f,_0x7a1c('0x3d'));}catch(_0x557f37){logger[_0x7a1c('0x17')](_0x557f37);}return _0x5f105f[_0x7a1c('0x2f')]('.')[0x0];});};exports[_0x7a1c('0x73')]=function(_0x174807,_0x432f0d,_0x180c8f,_0xf8bc31,_0x1a50b7,_0x34f44a){return aws[_0x7a1c('0x74')](_0x174807,_0x432f0d,_0x180c8f,_0xf8bc31,_0x1a50b7,_0x34f44a)[_0x7a1c('0x2d')](function(_0x413818){logger['info'](JSON[_0x7a1c('0x42')](_0x413818));return _0x413818;});};exports['ispeechTTS']=function(_0x571816,_0xd17663,_0xd6036e,_0x46e1a9){var _0x2dcf79=util['format'](_0x7a1c('0x75'),ISPEECH_API,_0x571816,encodeURIComponent(_0xd17663),_0xd6036e,_0x46e1a9);var _0x59d036=path['resolve'](__dirname,_0x7a1c('0x28'),rs['generate'](0x4)+_0x7a1c('0x3a'));var _0x1cf861;return downloadFile(_0x2dcf79,_0x59d036)[_0x7a1c('0x2d')](function(){_0x1cf861=path[_0x7a1c('0x27')](__dirname,_0x7a1c('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x59d036,_0x1cf861);})['then'](function(){try{fs['unlink'](_0x59d036);fs[_0x7a1c('0x2e')](_0x1cf861,_0x7a1c('0x3d'));}catch(_0x146e09){logger[_0x7a1c('0x17')](_0x146e09);}return _0x1cf861[_0x7a1c('0x2f')]('.')[0x0];});};exports[_0x7a1c('0x76')]=function(_0x2fc2e5,_0x4e1c21,_0x4721cd,_0x40c72c){var _0x2df0a6=util[_0x7a1c('0x77')](_0x7a1c('0x78'),ISPEECH_API,_0x4e1c21,_0x4721cd,base64Encode(_0x2fc2e5),_0x40c72c?util['format'](_0x7a1c('0x79'),encodeURIComponent(_0x40c72c)):_0x7a1c('0x7a'));return uploadFile(_0x2df0a6)['then'](function(_0x4ff460){return querystring['parse'](_0x4ff460);});};exports[_0x7a1c('0x7b')]=function(_0x50211c,_0x2cf89f){return sestek[_0x7a1c('0x7c')](_0x50211c,_0x2cf89f)['then'](function(_0x4a6807){logger['info'](JSON[_0x7a1c('0x42')](_0x4a6807));var _0x36d30f={'speech':_0x4a6807[_0x7a1c('0x7d')],'action':_0x4a6807[_0x7a1c('0x7e')]?_0x4a6807[_0x7a1c('0x7e')][_0x7a1c('0x7f')]:undefined,'actiondata':_0x4a6807[_0x7a1c('0x7e')]?_0x4a6807[_0x7a1c('0x7e')]['CustomActionData']:undefined};if(_0x4a6807[_0x7a1c('0x7e')]&&_0x4a6807[_0x7a1c('0x7e')][_0x7a1c('0x80')]){return base64Decode(_0x4a6807['channelData'][_0x7a1c('0x80')][_0x7a1c('0x81')],path['resolve'](__dirname,_0x7a1c('0x28'),rs['generate'](0x4)+'.wav'))['then'](function(_0x36e812){_0x36d30f[_0x7a1c('0x82')]=_0x36e812;return _0x36d30f;});}return _0x36d30f;});};exports[_0x7a1c('0x83')]=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 06b1c3c..29a6d74 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 _0x3ed4=['exports','./nda'];(function(_0x3dd2ca,_0x47ac4e){var _0x720ef8=function(_0x551397){while(--_0x551397){_0x3dd2ca['push'](_0x3dd2ca['shift']());}};_0x720ef8(++_0x47ac4e);}(_0x3ed4,0x103));var _0x43ed=function(_0xf7f96f,_0x132272){_0xf7f96f=_0xf7f96f-0x0;var _0x324a98=_0x3ed4[_0xf7f96f];return _0x324a98;};var nda=require(_0x43ed('0x0'));module[_0x43ed('0x1')]={'nda':nda}; \ No newline at end of file +var _0xba29=['./nda','exports'];(function(_0x2456f7,_0x33072b){var _0x196522=function(_0x37c716){while(--_0x37c716){_0x2456f7['push'](_0x2456f7['shift']());}};_0x196522(++_0x33072b);}(_0xba29,0x18a));var _0x9ba2=function(_0x537216,_0x22a0e9){_0x537216=_0x537216-0x0;var _0x48968c=_0xba29[_0x537216];return _0x48968c;};var nda=require(_0x9ba2('0x0'));module[_0x9ba2('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 8ee9202..0208633 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 _0x5106=['callerid','calleridname','dnid','extension','text','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x27bb8d,_0x5261c7){var _0x5a181d=function(_0x3be372){while(--_0x3be372){_0x27bb8d['push'](_0x27bb8d['shift']());}};_0x5a181d(++_0x5261c7);}(_0x5106,0x116));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var rp=require(_0x6510('0x0'));var url=require('url');var logger=require(_0x6510('0x1'))('agi');module[_0x6510('0x2')]=function(_0x4b0419,_0x579fe8){var _0x4d9e2c={'method':_0x6510('0x3'),'uri':url[_0x6510('0x4')](_0x579fe8[_0x6510('0x5')],_0x6510('0x6')),'form':{'grant_type':_0x6510('0x7'),'username':_0x579fe8[_0x6510('0x8')],'password':_0x579fe8['password']},'json':!![]};return rp(_0x4d9e2c)['then'](function(_0x57164e){var _0x226e1a={'method':'POST','uri':url[_0x6510('0x4')](_0x579fe8['ndassistant_url'],_0x6510('0x9')),'body':{'type':_0x579fe8[_0x6510('0xa')]||_0x6510('0xb'),'channelId':'Nda','conversation':{'id':_0x4b0419['uniqueid']},'from':{'id':_0x4b0419[_0x6510('0xc')],'name':_0x4b0419[_0x6510('0xd')]},'recipient':{'id':_0x4b0419[_0x6510('0xe')],'name':_0x4b0419[_0x6510('0xf')]},'text':_0x579fe8[_0x6510('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x57164e[_0x6510('0x11')]},'json':!![]};if(_0x579fe8[_0x6510('0x12')]){_0x226e1a[_0x6510('0x13')][_0x6510('0x14')][_0x6510('0x15')]=_0x579fe8['project'];}if(_0x579fe8['ndagenerate_audio']=='1'){_0x226e1a[_0x6510('0x13')][_0x6510('0x14')][_0x6510('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6510('0x17')};}if(_0x579fe8[_0x6510('0x18')]){_0x226e1a['body']['channelData'][_0x6510('0x19')]=_0x579fe8[_0x6510('0x18')];if(_0x579fe8[_0x6510('0x1a')]){_0x226e1a[_0x6510('0x13')]['channelData'][_0x6510('0x1b')]=_0x579fe8['custom_action_data'];}}logger['info'](JSON[_0x6510('0x1c')](_0x226e1a));return rp(_0x226e1a);});}; \ No newline at end of file +var _0xa769=['ndauth_url','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','dnid','extension','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','resolve'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0xa769,0xfb));var _0x9a76=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa769[_0x4cf98e];return _0x1623ac;};'use strict';var rp=require(_0x9a76('0x0'));var url=require('url');var logger=require(_0x9a76('0x1'))(_0x9a76('0x2'));module[_0x9a76('0x3')]=function(_0x488ec5,_0x449889){var _0x52df44={'method':'POST','uri':url[_0x9a76('0x4')](_0x449889[_0x9a76('0x5')],'/token'),'form':{'grant_type':_0x9a76('0x6'),'username':_0x449889[_0x9a76('0x7')],'password':_0x449889[_0x9a76('0x6')]},'json':!![]};return rp(_0x52df44)[_0x9a76('0x8')](function(_0x1556d6){var _0xe396ab={'method':_0x9a76('0x9'),'uri':url['resolve'](_0x449889[_0x9a76('0xa')],_0x9a76('0xb')),'body':{'type':_0x449889[_0x9a76('0xc')]||_0x9a76('0xd'),'channelId':'Nda','conversation':{'id':_0x488ec5['uniqueid']},'from':{'id':_0x488ec5[_0x9a76('0xe')],'name':_0x488ec5['calleridname']},'recipient':{'id':_0x488ec5[_0x9a76('0xf')],'name':_0x488ec5[_0x9a76('0x10')]},'text':_0x449889['text'],'channelData':{}},'headers':{'Authorization':_0x9a76('0x11')+_0x1556d6[_0x9a76('0x12')]},'json':!![]};if(_0x449889['project']){_0xe396ab[_0x9a76('0x13')][_0x9a76('0x14')][_0x9a76('0x15')]=_0x449889[_0x9a76('0x16')];}if(_0x449889[_0x9a76('0x17')]=='1'){_0xe396ab[_0x9a76('0x13')][_0x9a76('0x14')][_0x9a76('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9a76('0x19')};}if(_0x449889[_0x9a76('0x1a')]){_0xe396ab[_0x9a76('0x13')][_0x9a76('0x14')][_0x9a76('0x1b')]=_0x449889['custom_action'];if(_0x449889[_0x9a76('0x1c')]){_0xe396ab['body'][_0x9a76('0x14')][_0x9a76('0x1d')]=_0x449889[_0x9a76('0x1c')];}}logger[_0x9a76('0x1e')](JSON[_0x9a76('0x1f')](_0xe396ab));return rp(_0xe396ab);});}; \ 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 ec29b8b..c652e74 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 _0xea77=['exports','./lib/api'];(function(_0x5938c4,_0xfc0b6e){var _0x51ae50=function(_0x255a22){while(--_0x255a22){_0x5938c4['push'](_0x5938c4['shift']());}};_0x51ae50(++_0xfc0b6e);}(_0xea77,0x169));var _0x7ea7=function(_0x337d23,_0x1485a6){_0x337d23=_0x337d23-0x0;var _0x2b940c=_0xea77[_0x337d23];return _0x2b940c;};'use strict';var asr=require(_0x7ea7('0x0'));module[_0x7ea7('0x1')]=function(_0x2a3cb6,_0x55210e,_0x35f638,_0x4e847b){return asr(_0x2a3cb6,_0x55210e,_0x35f638,_0x4e847b);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x57398d,_0x41da2f,_0x4eeab5,_0x5b90e6){return asr(_0x57398d,_0x41da2f,_0x4eeab5,_0x5b90e6);}; \ 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 75ebc78..578fd27 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 _0x1da4=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x1da4,0x12f));var _0x41da=function(_0x42ec50,_0x13563d){_0x42ec50=_0x42ec50-0x0;var _0x35e7c0=_0x1da4[_0x42ec50];return _0x35e7c0;};'use strict';var BPromise=require(_0x41da('0x0'));var _=require(_0x41da('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x41da('0x2'));var crypto=require(_0x41da('0x3'));var logger=require(_0x41da('0x4'))('agi');module[_0x41da('0x5')]=function(_0x140c5d,_0x52464c,_0x3baa8b,_0x1aa933){return new BPromise(function(_0x464c61,_0x321e3f){logger[_0x41da('0x6')](_0x41da('0x7'),_0x1aa933||_0x41da('0x8'));var _0x2f531a=new WebSocket(_0x1aa933||_0x41da('0x8'),{'perMessageDeflate':![]});var _0x30594f='';var _0x4925bc='0';var _0x499eea='1';var _0x2ac7fc=_0x41da('0x9');function _0x418c97(_0x3c7e26){var _0x807159=crypto[_0x41da('0xa')](_0x41da('0xb'));_0x807159[_0x41da('0xc')](_0x3c7e26);return _0x807159[_0x41da('0xd')](_0x41da('0xe'));}function _0x2e9285(){try{logger[_0x41da('0x6')](_0x41da('0xf'));var _0xb6162b=moment()[_0x41da('0x10')]();var _0x205e18=_0x418c97(_0xb6162b+_0x52464c+_0x3baa8b);_0x2f531a[_0x41da('0x11')](JSON['stringify']({'appID':_0x52464c,'timestamp':_0xb6162b,'appKey':_0x205e18}));var _0x4e6ff7=fs['createReadStream'](_0x140c5d);_0x4e6ff7['on'](_0x41da('0x12'),function(_0x2fc25d){_0x2f531a[_0x41da('0x11')](_0x2fc25d);});_0x4e6ff7['on'](_0x41da('0x13'),function(){_0x2f531a[_0x41da('0x11')](_0x41da('0x14'));});}catch(_0xa67f53){logger[_0x41da('0x15')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0xa67f53));_0x2f531a[_0x41da('0x16')]();}}function _0x9194a0(_0x126bce){try{if(_0x126bce){var _0x14ba57=JSON[_0x41da('0x17')](_0x126bce);switch(_0x14ba57['status']){case 0x0:if(_0x14ba57['result']){if(_0x14ba57[_0x41da('0x18')][_0x41da('0x19')]){logger['info'](_0x41da('0x1a'),JSON['stringify'](_0x14ba57[_0x41da('0x18')][_0x41da('0x1b')]));_0x30594f=_0x14ba57[_0x41da('0x18')][_0x41da('0x1b')][0x0]['transcript'];_0x4925bc=_0x14ba57[_0x41da('0x18')][_0x41da('0x1b')][0x0][_0x41da('0x1c')];_0x499eea='0';_0x2ac7fc=_0x41da('0x1d');_0x2f531a[_0x41da('0x16')]();}}break;case 0x1:logger[_0x41da('0x6')](_0x41da('0x9'));_0x499eea='1';_0x2ac7fc=_0x41da('0x9');break;case 0x2:logger[_0x41da('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x499eea='2';_0x2ac7fc=_0x41da('0x1e');break;case 0x9:logger[_0x41da('0x6')](_0x41da('0x1f'));_0x499eea='9';_0x2ac7fc=_0x41da('0x1f');break;case 0xa:logger[_0x41da('0x6')]('Authentication\x20failed.');_0x499eea='10';_0x2ac7fc=_0x41da('0x20');break;case 0xb:logger[_0x41da('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x499eea='11';_0x2ac7fc='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1dadcd){logger['error'](_0x41da('0x21'),JSON['stringify'](_0x1dadcd));_0x2f531a[_0x41da('0x16')]();}}function _0x4e1700(){logger['info'](_0x41da('0x22'));_0x464c61({'transcript':_0x30594f,'confidence':_0x4925bc,'status':_0x499eea,'status_message':_0x2ac7fc});}function _0x30fa24(_0x4d7c68){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x4d7c68)){logger[_0x41da('0x15')](_[_0x41da('0x23')](_0x4d7c68)?JSON['stringify'](_0x4d7c68):_0x4d7c68);}}_0x2f531a['on'](_0x41da('0x24'),_0x2e9285);_0x2f531a['on']('message',_0x9194a0);_0x2f531a['on']('close',_0x4e1700);_0x2f531a['on'](_0x41da('0x15'),_0x30fa24);});}; \ No newline at end of file +var _0x7de4=['error','terminate','parse','status','result','final','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.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS'];(function(_0x26efae,_0xc8b772){var _0x44b3d9=function(_0x279917){while(--_0x279917){_0x26efae['push'](_0x26efae['shift']());}};_0x44b3d9(++_0xc8b772);}(_0x7de4,0xa3));var _0x47de=function(_0x325f9e,_0x211c32){_0x325f9e=_0x325f9e-0x0;var _0x10c843=_0x7de4[_0x325f9e];return _0x10c843;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x47de('0x0'));var crypto=require(_0x47de('0x1'));var logger=require(_0x47de('0x2'))(_0x47de('0x3'));module[_0x47de('0x4')]=function(_0x334679,_0x238d22,_0x12c5c4,_0x15e8e6){return new BPromise(function(_0x246084,_0x307819){logger[_0x47de('0x5')](_0x47de('0x6'),_0x15e8e6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xed9930=new WebSocket(_0x15e8e6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x45ca9a='';var _0x29ca6f='0';var _0x3e6cae='1';var _0x1668b2='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x2d1545(_0x562b8b){var _0x1a7e54=crypto['createHash'](_0x47de('0x7'));_0x1a7e54[_0x47de('0x8')](_0x562b8b);return _0x1a7e54[_0x47de('0x9')]('hex');}function _0x3f61b3(){try{logger[_0x47de('0x5')](_0x47de('0xa'));var _0x96c6c9=moment()['unix']();var _0x52ea36=_0x2d1545(_0x96c6c9+_0x238d22+_0x12c5c4);_0xed9930[_0x47de('0xb')](JSON[_0x47de('0xc')]({'appID':_0x238d22,'timestamp':_0x96c6c9,'appKey':_0x52ea36}));var _0x24a184=fs[_0x47de('0xd')](_0x334679);_0x24a184['on'](_0x47de('0xe'),function(_0x2d1e26){_0xed9930[_0x47de('0xb')](_0x2d1e26);});_0x24a184['on'](_0x47de('0xf'),function(){_0xed9930[_0x47de('0xb')](_0x47de('0x10'));});}catch(_0x55e699){logger[_0x47de('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x47de('0xc')](_0x55e699));_0xed9930[_0x47de('0x12')]();}}function _0x179451(_0x3cdf92){try{if(_0x3cdf92){var _0x396229=JSON[_0x47de('0x13')](_0x3cdf92);switch(_0x396229[_0x47de('0x14')]){case 0x0:if(_0x396229[_0x47de('0x15')]){if(_0x396229['result'][_0x47de('0x16')]){logger[_0x47de('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x47de('0xc')](_0x396229['result']['hypotheses']));_0x45ca9a=_0x396229['result'][_0x47de('0x17')][0x0]['transcript'];_0x29ca6f=_0x396229['result']['hypotheses'][0x0][_0x47de('0x18')];_0x3e6cae='0';_0x1668b2=_0x47de('0x19');_0xed9930[_0x47de('0x12')]();}}break;case 0x1:logger[_0x47de('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3e6cae='1';_0x1668b2=_0x47de('0x1a');break;case 0x2:logger['info'](_0x47de('0x1b'));_0x3e6cae='2';_0x1668b2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x47de('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3e6cae='9';_0x1668b2=_0x47de('0x1c');break;case 0xa:logger[_0x47de('0x5')](_0x47de('0x1d'));_0x3e6cae='10';_0x1668b2='Authentication\x20failed.';break;case 0xb:logger[_0x47de('0x5')](_0x47de('0x1e'));_0x3e6cae='11';_0x1668b2=_0x47de('0x1e');}}}catch(_0x4cb3da){logger[_0x47de('0x11')](_0x47de('0x1f'),JSON[_0x47de('0xc')](_0x4cb3da));_0xed9930[_0x47de('0x12')]();}}function _0x83dfdb(){logger[_0x47de('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x246084({'transcript':_0x45ca9a,'confidence':_0x29ca6f,'status':_0x3e6cae,'status_message':_0x1668b2});}function _0x103044(_0x518faa){logger[_0x47de('0x11')](_0x47de('0x20'));if(!_[_0x47de('0x21')](_0x518faa)){logger[_0x47de('0x11')](_[_0x47de('0x22')](_0x518faa)?JSON['stringify'](_0x518faa):_0x518faa);}}_0xed9930['on']('open',_0x3f61b3);_0xed9930['on'](_0x47de('0x23'),_0x179451);_0xed9930['on'](_0x47de('0xf'),_0x83dfdb);_0xed9930['on'](_0x47de('0x11'),_0x103044);});}; \ 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 f4b09d7..0ca5b46 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 _0x89f7=['./asr','exports'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x89f7,0x9e));var _0x789f=function(_0x8d8917,_0x504e20){_0x8d8917=_0x8d8917-0x0;var _0x55bd93=_0x89f7[_0x8d8917];return _0x55bd93;};var asr=require(_0x789f('0x0'));module[_0x789f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf051=['./asr'];(function(_0x16cfb1,_0x576387){var _0xd1373e=function(_0x99c19b){while(--_0x99c19b){_0x16cfb1['push'](_0x16cfb1['shift']());}};_0xd1373e(++_0x576387);}(_0xf051,0xc2));var _0x1f05=function(_0x56caf3,_0x44ac27){_0x56caf3=_0x56caf3-0x0;var _0x402e37=_0xf051[_0x56caf3];return _0x402e37;};var asr=require(_0x1f05('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5e5f124..315cf01 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 _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x1a18c8,_0x2177f7){var _0x251e46=function(_0x3bf8f7){while(--_0x3bf8f7){_0x1a18c8['push'](_0x1a18c8['shift']());}};_0x251e46(++_0x2177f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ 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(_0x407461,_0x1cf61c){var _0x2b3ffa=function(_0x2acb31){while(--_0x2acb31){_0x407461['push'](_0x407461['shift']());}};_0x2b3ffa(++_0x1cf61c);}(_0xe706,0xa3));var _0x6e70=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0xe706[_0x4dab14];return _0xf41aa;};'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 88b81ba..3b148c0 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 _0x7118=['An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','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','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','callback_priority','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','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_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','getVariable','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','name','prototype','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','googleTTS','url','method','timeout','number','includes','POST','PUT','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0x7118,0x159));var _0x8711=function(_0x1df0c9,_0x3b4a46){_0x1df0c9=_0x1df0c9-0x0;var _0x24d05d=_0x7118[_0x1df0c9];return _0x24d05d;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0x8711('0x0'));var odbc=require(_0x8711('0x1'))();var rs=require('randomstring');var moment=require(_0x8711('0x2'));var Mustache=require(_0x8711('0x3'));var rp=require(_0x8711('0x4'));var logger=require(_0x8711('0x5'))(_0x8711('0x6'));var config=require(_0x8711('0x7'));var scripts=require(_0x8711('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8711('0x9'),_0x8711('0xa')];var verticesWithRetry=[_0x8711('0xb'),_0x8711('0xc'),_0x8711('0xd')];var AGIVertices=function(_0xa46f29,_0x7f7ca7,_0x2f01ca){this[_0x8711('0xe')]=_0xa46f29;this[_0x8711('0xf')]=_0x7f7ca7;this[_0x8711('0x10')]=_0x2f01ca;};AGIVertices['prototype']['getVariable']=function(_0x2892a2,_0x64f7b4){this[_0x8711('0xf')]['getVariableById'](_0x2892a2)['then'](function(_0x162559){_0x64f7b4(null,_0x162559?_0x162559[_0x8711('0x11')]:![]);})['catch'](function(_0x49b241){_0x64f7b4(_0x49b241);});};AGIVertices[_0x8711('0x12')][_0x8711('0x13')]=function(_0x25a608,_0x2758ee){this[_0x8711('0xf')][_0x8711('0x14')](_0x25a608)[_0x8711('0x15')](function(_0x4a2330){_0x2758ee(null,_0x4a2330?_0x4a2330[_0x8711('0x11')]:![]);})[_0x8711('0x16')](function(_0x13f394){_0x2758ee(_0x13f394);});};AGIVertices[_0x8711('0x12')][_0x8711('0x17')]=function(_0x4628e9,_0x57fedb){this[_0x8711('0xf')][_0x8711('0x18')](_0x4628e9)[_0x8711('0x15')](function(_0xe1e9b3){_0x57fedb(null,_0xe1e9b3?_0xe1e9b3[_0x8711('0x11')]:![]);})['catch'](function(_0x5b2bf8){_0x57fedb(_0x5b2bf8);});};AGIVertices['prototype'][_0x8711('0x19')]=function(_0x3689be,_0x2f6134){this['rpc']['getSquareOdbcById'](_0x3689be)[_0x8711('0x15')](function(_0x16e628){_0x2f6134(null,_0x16e628?_0x16e628[_0x8711('0x1a')]:![]);})[_0x8711('0x16')](function(_0x23d977){_0x2f6134(_0x23d977);});};AGIVertices[_0x8711('0x12')][_0x8711('0x1b')]=function(_0x349fc2,_0xace829){this[_0x8711('0xf')]['getUserById'](_0x349fc2)[_0x8711('0x15')](function(_0x31cdc6){_0xace829(null,_0x31cdc6?_0x31cdc6[_0x8711('0x11')]:![]);})[_0x8711('0x16')](function(_0x4cf830){_0xace829(_0x4cf830);});};AGIVertices[_0x8711('0x12')][_0x8711('0x1c')]=function(_0x3e92d4,_0x5ab925){this[_0x8711('0xf')][_0x8711('0x1d')](_0x3e92d4)[_0x8711('0x15')](function(_0x217197){_0x5ab925(null,_0x217197?_0x217197[_0x8711('0x11')]:![]);})['catch'](function(_0x494683){_0x5ab925(_0x494683);});};AGIVertices['prototype'][_0x8711('0x1e')]=function(_0x16ea3b,_0x2d0901){var _0x15e1b8=this;this[_0x8711('0xf')][_0x8711('0x1f')](_0x16ea3b)[_0x8711('0x15')](function(_0x3ca2b5){_0x2d0901(null,_0x3ca2b5?_0x15e1b8[_0x8711('0x20')](_0x3ca2b5['save_name']):![]);})[_0x8711('0x16')](function(_0x591380){_0x2d0901(_0x591380);});};AGIVertices[_0x8711('0x12')][_0x8711('0x21')]=function(_0x11a977,_0x5a11dd){this[_0x8711('0xf')]['getMailAccountById'](_0x11a977)[_0x8711('0x15')](function(_0xa85687){_0x5a11dd(null,_0xa85687?_0xa85687:![]);})[_0x8711('0x16')](function(_0x5c4fcc){_0x5a11dd(_0x5c4fcc);});};AGIVertices['prototype'][_0x8711('0x22')]=function(_0x31efa0,_0x35af69,_0x6ab2c7){this[_0x8711('0x10')][_0x8711('0x22')](_0x31efa0,_0x35af69)[_0x8711('0x15')](function(){_0x6ab2c7(null);})[_0x8711('0x16')](function(_0x356303){_0x6ab2c7(_0x356303);});};AGIVertices[_0x8711('0x12')]['getIntervals']=function(_0x3ede91,_0x11c1e9){this[_0x8711('0xf')][_0x8711('0x23')](_0x3ede91)[_0x8711('0x15')](function(_0x23a78b){if(_0x23a78b){if(_0x23a78b[_0x8711('0x24')]){_0x11c1e9(null,[_0x23a78b[_0x8711('0x25')]]);}else{_0x11c1e9(null,_[_0x8711('0x26')](_0x23a78b[_0x8711('0x27')],'interval'));}}else{_0x11c1e9(null,![]);}})[_0x8711('0x16')](function(_0x318e5d){_0x11c1e9(_0x318e5d);});};AGIVertices[_0x8711('0x12')][_0x8711('0x20')]=function(_0x2ddf9f){return util['format'](_0x8711('0x28'),FILES_PATH,_0x2ddf9f);};AGIVertices[_0x8711('0x12')][_0x8711('0x29')]=function(_0x59486c,_0xee57e,_0x37fc30){odbc[_0x8711('0x2a')](_0x59486c,function(_0x1f2b1f){if(_0x1f2b1f){logger[_0x8711('0x2b')](_0x8711('0x2c'),_0x1f2b1f);_0x37fc30(_0x1f2b1f);}else{logger[_0x8711('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x8711('0x2e')](_0xee57e,function(_0x1c1f1b,_0x392d32){if(_0x1c1f1b){logger[_0x8711('0x2d')]('Error\x20executing\x20query\x20%s',_0xee57e);_0x37fc30(_0x1c1f1b);}else{logger['info'](_0x8711('0x2f'),_0xee57e);odbc[_0x8711('0x30')](function(_0x3074f2){if(_0x3074f2){logger[_0x8711('0x2b')](_0x8711('0x31'),_0x3074f2);}_0x37fc30(null,_0x392d32);});}});}});};AGIVertices[_0x8711('0x12')][_0x8711('0x32')]=function(_0x2db474,_0x15f9cd){this[_0x8711('0xf')][_0x8711('0x33')](_0x2db474)[_0x8711('0x15')](function(_0x1efd42){_0x15f9cd(null,_0x1efd42?_0x1efd42:![]);})[_0x8711('0x16')](function(_0x468b74){_0x15f9cd(_0x468b74);});};AGIVertices[_0x8711('0x12')][_0x8711('0x34')]=function(_0x37b4c1,_0xea76d8){this[_0x8711('0xf')][_0x8711('0x34')](_0x37b4c1)['then'](function(_0x477b72){_0xea76d8(null,_0x477b72);})['catch'](function(_0x1d4df2){_0xea76d8(_0x1d4df2);});};AGIVertices[_0x8711('0x12')][_0x8711('0x35')]=function(_0x38c0c4,_0x5f2c0c,_0x1645f6){this[_0x8711('0xf')][_0x8711('0x35')]({'uniqueid':this[_0x8711('0xe')][_0x8711('0x36')],'node':_0x38c0c4[_0x8711('0x37')],'application':_0x38c0c4['agicommand'],'data':_0x5f2c0c||null,'project_name':this[_0x8711('0xe')][_0x8711('0x38')],'callerid':this[_0x8711('0xe')][_0x8711('0x39')]})['then'](function(_0x1922a0){if(_0x1645f6){_0x1645f6(null,_0x1922a0);}})[_0x8711('0x16')](function(_0x2003ad){if(_0x1645f6){_0x1645f6(_0x2003ad);}});};AGIVertices[_0x8711('0x12')][_0x8711('0x3a')]=function(_0x572285,_0x4a0436,_0x29ce7d,_0x291d0e){this['rpc'][_0x8711('0x3a')]({'uniqueid':this[_0x8711('0xe')][_0x8711('0x36')],'callerid':this[_0x8711('0xe')]['callerid'],'calleridname':this[_0x8711('0xe')][_0x8711('0x3b')],'context':this[_0x8711('0xe')]['context'],'extension':this[_0x8711('0xe')][_0x8711('0x3c')],'priority':this['channel'][_0x8711('0x3d')],'accountcode':this[_0x8711('0xe')]['accountcode'],'dnid':this[_0x8711('0xe')][_0x8711('0x3e')],'projectName':this['channel'][_0x8711('0x38')],'saveName':_0x4a0436,'filename':_0x572285[_0x8711('0x3f')]||_0x4a0436,'savePath':_0x29ce7d})[_0x8711('0x15')](function(_0x17a3f5){_0x291d0e(null,_0x17a3f5);})['catch'](function(_0x3aa2c9){_0x291d0e(_0x3aa2c9);});};AGIVertices[_0x8711('0x12')]['createSquareMessage']=function(_0x1f7ee2,_0x209813,_0x495f7e,_0x588473,_0x4f0afb){this['rpc'][_0x8711('0x40')]({'uniqueid':this[_0x8711('0xe')][_0x8711('0x36')],'body':_0x1f7ee2,'direction':_0x209813,'providerName':_0x495f7e,'providerResponse':_0x588473})[_0x8711('0x15')](function(_0x24dc63){if(_0x4f0afb){_0x4f0afb(null,_0x24dc63);}})[_0x8711('0x16')](function(_0x26d97d){if(_0x4f0afb){_0x4f0afb(_0x26d97d);}});};AGIVertices['prototype']['createCmContact']=function(_0x54d8da,_0x3b9e2b){this[_0x8711('0xf')][_0x8711('0x41')]({'firstName':_[_0x8711('0x42')](_0x54d8da[_0x8711('0x11')])||_[_0x8711('0x43')](_0x54d8da['name'])?_0x8711('0x44')+Math[_0x8711('0x45')]():_0x54d8da[_0x8711('0x11')],'lastName':_['isEmpty'](_0x54d8da[_0x8711('0x46')])||_[_0x8711('0x43')](_0x54d8da[_0x8711('0x46')])?null:_0x54d8da[_0x8711('0x46')],'phone':_0x54d8da[_0x8711('0x47')],'ListId':_0x54d8da[_0x8711('0x48')],'scheduledat':_0x54d8da[_0x8711('0x49')],'callbackUniqueid':this[_0x8711('0xe')]['uniqueid'],'tags':_0x8711('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x54d8da[_0x8711('0x49')]['toString'](),'priority':_0x54d8da['callback_priority']})['then'](function(_0x40cecd){_0x3b9e2b(null,_0x40cecd);})[_0x8711('0x16')](function(_0x5a1468){_0x3b9e2b(_0x5a1468);});};AGIVertices[_0x8711('0x12')]['getPause']=function(_0x30f839,_0x152863){this['rpc'][_0x8711('0x4b')](_0x30f839)['then'](function(_0x41d964){_0x152863(null,_0x41d964?_0x41d964[_0x8711('0x11')]:![]);})['catch'](function(_0x530031){_0x152863(_0x530031);});};AGIVertices[_0x8711('0x12')]['agentPause']=function(_0x15c02f,_0x1e089b,_0x457a86){var _0x158d97={'role':_0x8711('0x4c')};_0x158d97[_0x15c02f]=this['channel'][_0x8711('0x39')];this[_0x8711('0xf')][_0x8711('0x4d')](_0x158d97,_0x1e089b,this[_0x8711('0xe')][_0x8711('0x36')])['then'](function(_0x19a481){_0x457a86(null,_[_0x8711('0x43')](_0x19a481)?![]:!![]);})[_0x8711('0x16')](function(_0x5d9978){logger['error'](_0x5d9978);_0x457a86(null,![]);});};AGIVertices[_0x8711('0x12')][_0x8711('0x4e')]=function(_0x4a4a9c,_0x5bde6b){var _0x4944ac={'role':_0x8711('0x4c')};_0x4944ac[_0x4a4a9c]=this[_0x8711('0xe')][_0x8711('0x39')];this[_0x8711('0xf')][_0x8711('0x4e')](_0x4944ac)[_0x8711('0x15')](function(_0xc2e94b){_0x5bde6b(null,_[_0x8711('0x43')](_0xc2e94b)?![]:!![]);})[_0x8711('0x16')](function(_0x453606){logger[_0x8711('0x2b')](_0x453606);_0x5bde6b(null,![]);});};AGIVertices['prototype'][_0x8711('0x4f')]=function(_0x343d0f,_0xe83288){var _0x337940={'role':_0x8711('0x4c')};_0x337940[_0x343d0f]=this[_0x8711('0xe')][_0x8711('0x39')];this[_0x8711('0xf')][_0x8711('0x4f')](_0x337940)[_0x8711('0x15')](function(_0x5706f5){_0xe83288(null,_[_0x8711('0x43')](_0x5706f5)?![]:!![]);})[_0x8711('0x16')](function(_0x46f6b7){logger['error'](_0x46f6b7);_0xe83288(null,![]);});};AGIVertices[_0x8711('0x12')][_0x8711('0x50')]=function(_0x411d8c,_0x53eaa8){var _0x5011c0={'role':'agent'};_0x5011c0[_0x411d8c]=this[_0x8711('0xe')][_0x8711('0x39')];var _0x53f8da=_0x411d8c!=_0x8711('0x51')?util[_0x8711('0x52')]('%s/%s@from-sip/n',_0x8711('0x53'),this[_0x8711('0xe')][_0x8711('0x39')]):undefined;this[_0x8711('0xf')]['agentLogin'](_0x5011c0,_0x53f8da)[_0x8711('0x15')](function(_0xf5326c){_0x53eaa8(null,_['isNil'](_0xf5326c)?![]:!![]);})[_0x8711('0x16')](function(_0xcc1d7b){logger['error'](_0xcc1d7b);_0x53eaa8(null,![]);});};AGIVertices[_0x8711('0x12')]['shellCommand']=function(_0x2fa3b4,_0x3c86d3){sh[_0x8711('0x54')](_[_0x8711('0x55')](_0x2fa3b4),function(_0x42a2f9,_0x30d378){var _0x2ef0bd=_0x30d378[_0x8711('0x56')](/(\r\n|\n|\r)/gm,'');_0x3c86d3(null,_0x2ef0bd);});};AGIVertices[_0x8711('0x12')][_0x8711('0x57')]=function(_0x3bcc6f,_0x12102b){scripts[_0x8711('0x57')](_0x3bcc6f[_0x8711('0x58')],_0x3bcc6f[_0x8711('0x59')]||_0x8711('0x5a'),_0x3bcc6f[_0x8711('0x5a')],_0x3bcc6f['languageCode']||_0x8711('0x5b'),_0x3bcc6f[_0x8711('0x5c')]||_0x8711('0x5d'),_0x3bcc6f['audioEncoding']||'MP3')[_0x8711('0x15')](function(_0x150ae6){_0x12102b(null,_0x150ae6);})[_0x8711('0x16')](function(_0x4bf466){_0x12102b(_0x4bf466);});};AGIVertices[_0x8711('0x12')]['googleTTS']=function(_0x2c1cbe,_0x41b6cb){scripts[_0x8711('0x5e')](_0x2c1cbe[_0x8711('0x5a')],_0x2c1cbe['google_tts_language']||'en',0x1)[_0x8711('0x15')](function(_0xa72924){_0x41b6cb(null,_0xa72924);})[_0x8711('0x16')](function(_0x4dd151){_0x41b6cb(_0x4dd151);});};AGIVertices[_0x8711('0x12')]['restAPI']=function(_0x1e9ceb,_0x1491e5){var _0x5f5d85={'uri':_0x1e9ceb[_0x8711('0x5f')],'method':_0x1e9ceb[_0x8711('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1e9ceb[_0x8711('0x61')])===_0x8711('0x62')&&parseInt(_0x1e9ceb[_0x8711('0x61')])>=0x1?parseInt(_0x1e9ceb[_0x8711('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x8711('0x63')]([_0x8711('0x64'),_0x8711('0x65')],_0x5f5d85[_0x8711('0x60')]['toUpperCase']())){try{_0x5f5d85[_0x8711('0x66')]=_0x1e9ceb['rawBody']?JSON['parse'](_0x1e9ceb[_0x8711('0xa')]):{};}catch(_0x550bf1){logger[_0x8711('0x2b')](_0x8711('0x67'),_0x550bf1);}}try{_0x5f5d85[_0x8711('0x68')]=_0x1e9ceb[_0x8711('0x9')]?JSON[_0x8711('0x69')](_0x1e9ceb[_0x8711('0x9')]):{};}catch(_0xb87799){logger[_0x8711('0x2b')](_0x8711('0x6a'),_0xb87799);}if(_0x1e9ceb[_0x8711('0x6b')]){try{var _0x357abf=require(_0x1e9ceb[_0x8711('0x6b')])[_0x8711('0x6c')](this,_0x5f5d85);_0x5f5d85[_0x8711('0x6d')]=Mustache[_0x8711('0x6e')](_0x1e9ceb[_0x8711('0x5f')],_0x357abf,{},['$$','$$']);if(_0x5f5d85[_0x8711('0x68')]){_0x5f5d85['headers']=JSON[_0x8711('0x69')](Mustache[_0x8711('0x6e')](JSON[_0x8711('0x6f')](_0x5f5d85['headers']),_0x357abf,{},['$$','$$']));}if(_0x5f5d85['body']){_0x5f5d85['body']=JSON[_0x8711('0x69')](Mustache[_0x8711('0x6e')](JSON['stringify'](_0x5f5d85[_0x8711('0x66')]),_0x357abf,{},['$$','$$']));}}catch(_0x2843c2){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2843c2);}}rp(_0x5f5d85)[_0x8711('0x15')](function(_0x19ee31){var _0x2b167c={'statusCode':_0x19ee31[_0x8711('0x70')]||0xc8,'statusMessage':_0x19ee31[_0x8711('0x71')]||'OK','headers':_0x19ee31[_0x8711('0x68')]||{},'body':_0x19ee31[_0x8711('0x66')]||{}};_0x1491e5(null,_0x2b167c);})[_0x8711('0x16')](function(_0x2ad62e){var _0x2ab2d4={'statusCode':_0x2ad62e[_0x8711('0x70')]||0x1f4,'statusMessage':_0x2ad62e[_0x8711('0x72')]||_0x8711('0x73'),'headers':_0x2ad62e[_0x8711('0x74')]['headers']||{},'body':_0x2ad62e[_0x8711('0x74')][_0x8711('0x66')]||{}};_0x1491e5(null,_0x2ab2d4);});};AGIVertices[_0x8711('0x12')]['googleDialogflow']=function(_0x2a9cfe,_0x4fec3d){scripts[_0x8711('0x75')](this[_0x8711('0xe')][_0x8711('0x36')],_0x2a9cfe[_0x8711('0x76')],_0x2a9cfe[_0x8711('0x5a')],_0x2a9cfe[_0x8711('0x77')]||'en')[_0x8711('0x15')](function(_0x1bd0fa){_0x4fec3d(null,_0x1bd0fa);})[_0x8711('0x16')](function(_0x796e12){_0x4fec3d(_0x796e12);});};AGIVertices[_0x8711('0x12')][_0x8711('0x78')]=function(_0x364e10,_0x3fd11e){scripts[_0x8711('0x78')](this['channel'][_0x8711('0x36')],_0x364e10[_0x8711('0x79')],_0x364e10[_0x8711('0x7a')],_0x364e10['private_key'],_0x364e10[_0x8711('0x5a')],_0x364e10[_0x8711('0x7b')]||'en')[_0x8711('0x15')](function(_0x4e5c25){_0x3fd11e(null,_0x4e5c25);})[_0x8711('0x16')](function(_0x4b3773){_0x3fd11e(_0x4b3773);});};AGIVertices[_0x8711('0x12')]['sestekNDA']=function(_0x3ed062,_0x45e8c5){scripts[_0x8711('0x7c')](this[_0x8711('0xe')],_0x3ed062)[_0x8711('0x15')](function(_0x927dde){_0x45e8c5(null,_0x927dde);})[_0x8711('0x16')](function(_0x1c0159){_0x45e8c5(_0x1c0159);});};AGIVertices[_0x8711('0x12')]['ispeechTTS']=function(_0x4ef677,_0x2e803c){scripts['ispeechTTS'](_0x4ef677[_0x8711('0x76')],_0x4ef677[_0x8711('0x5a')],_0x4ef677[_0x8711('0x7d')]||'en-US',_0x4ef677['speed'])['then'](function(_0x443d53){_0x2e803c(null,_0x443d53);})[_0x8711('0x16')](function(_0x330ed1){_0x2e803c(_0x330ed1);});};AGIVertices[_0x8711('0x12')]['ispeechASR']=function(_0x5d7678,_0x403539,_0x2b961e){scripts[_0x8711('0x7e')](_0x403539,_0x5d7678['key'],_0x5d7678[_0x8711('0x7f')]||_0x8711('0x5b'),this[_0x8711('0x80')](_0x5d7678['model'])?_0x5d7678[_0x8711('0x81')]:undefined)[_0x8711('0x15')](function(_0x2d5491){_0x2b961e(null,_0x2d5491);})[_0x8711('0x16')](function(_0x29d705){_0x2b961e(_0x29d705);});};AGIVertices['prototype'][_0x8711('0x82')]=function(_0x410c4a,_0x444146){scripts[_0x8711('0x82')](_0x410c4a[_0x8711('0x83')],_0x410c4a['aws_secret_access_key'],_0x410c4a[_0x8711('0x84')],_0x410c4a[_0x8711('0x85')]||_0x8711('0x86'),_0x410c4a[_0x8711('0x5a')],_0x410c4a[_0x8711('0x87')]||'text')[_0x8711('0x15')](function(_0x384ab3){_0x444146(null,_0x384ab3);})[_0x8711('0x16')](function(_0xa49d38){_0x444146(_0xa49d38);});};AGIVertices[_0x8711('0x12')][_0x8711('0x88')]=function(_0x24e569,_0x423f6b){scripts[_0x8711('0x88')](this[_0x8711('0xe')][_0x8711('0x36')],_0x24e569['aws_access_key_id'],_0x24e569[_0x8711('0x89')],_0x24e569[_0x8711('0x8a')],_0x24e569[_0x8711('0x5a')],_0x24e569[_0x8711('0x8b')])['then'](function(_0x578859){_0x423f6b(null,_0x578859);})[_0x8711('0x16')](function(_0x18e046){_0x423f6b(_0x18e046);});};AGIVertices[_0x8711('0x12')][_0x8711('0x8c')]=function(_0x39d273,_0x3af46b,_0x4ee504){scripts[_0x8711('0x8c')](_0x3af46b,_0x39d273[_0x8711('0x76')],_0x39d273[_0x8711('0x8d')]||_0x8711('0x5b'))[_0x8711('0x15')](function(_0x3b6b8a){_0x4ee504(null,_0x3b6b8a);})[_0x8711('0x16')](function(_0x5b4754){_0x4ee504(_0x5b4754);});};AGIVertices[_0x8711('0x12')][_0x8711('0x8e')]=function(_0x21b9a8,_0x536180,_0x3fe51f){scripts[_0x8711('0x8e')](_0x536180,_0x21b9a8[_0x8711('0x8f')],_0x21b9a8[_0x8711('0x90')],_0x21b9a8[_0x8711('0x6d')])[_0x8711('0x15')](function(_0x4ac127){_0x3fe51f(null,_0x4ac127);})[_0x8711('0x16')](function(_0x2eead0){_0x3fe51f(_0x2eead0);});};AGIVertices['prototype'][_0x8711('0x91')]=function(_0x44db8c){var _0x1eab14=_['includes'](verticesWithRetry,_0x44db8c['agicommand'])?_0x44db8c:_[_0x8711('0x92')](_0x44db8c);for(var _0x5300f7 in _0x1eab14){if(_0x1eab14[_0x8711('0x93')](_0x5300f7)){if(_0x1eab14[_0x5300f7]&&_[_0x8711('0x94')](_0x1eab14[_0x5300f7])){if(_[_0x8711('0x63')](recursiveMapAttributes,_0x5300f7)){_0x1eab14[_0x5300f7]=this['replaceObjectAllVariables'](_0x1eab14[_0x5300f7]);}else{_0x1eab14[_0x5300f7]=this[_0x8711('0x95')](_0x1eab14[_0x5300f7]);}}}}return _0x1eab14;};AGIVertices[_0x8711('0x12')][_0x8711('0x96')]=function(_0x258e60){for(var _0x3550a8 in _0x258e60){if(_0x258e60[_0x8711('0x93')](_0x3550a8)){if(_[_0x8711('0x97')](_0x258e60[_0x3550a8])){this[_0x8711('0x96')](_0x258e60[_0x3550a8]);}else if(_[_0x8711('0x98')](_0x258e60[_0x3550a8])){for(var _0x24ed84=0x0;_0x24ed84<_0x258e60[_0x3550a8][_0x8711('0x99')];_0x24ed84++){this[_0x8711('0x96')](_0x258e60[_0x3550a8][_0x24ed84]);}}else if(_['isString'](_0x258e60[_0x3550a8])){_0x258e60[_0x3550a8]=this[_0x8711('0x95')](_0x258e60[_0x3550a8]);}}}};AGIVertices['prototype'][_0x8711('0x9a')]=function(_0x4ee3f3,_0x261096){for(var _0x41c453 in _0x4ee3f3){if(_0x4ee3f3[_0x8711('0x93')](_0x41c453)){if(_[_0x8711('0x97')](_0x4ee3f3[_0x41c453])){if(!_[_0x8711('0x42')](_0x4ee3f3[_0x41c453])){this[_0x8711('0x9a')](_0x4ee3f3[_0x41c453],util[_0x8711('0x52')](_0x8711('0x9b'),_0x261096,_0x41c453));}}else if(_[_0x8711('0x98')](_0x4ee3f3[_0x41c453])){for(var _0x283c56=0x0;_0x283c56<_0x4ee3f3[_0x41c453][_0x8711('0x99')];_0x283c56++){this[_0x8711('0x9a')](_0x4ee3f3[_0x41c453][_0x283c56],util[_0x8711('0x52')]('%s.%s',_0x261096,_0x41c453+'['+_0x283c56+']'));}}else{if(!_[_0x8711('0x43')](_0x4ee3f3[_0x41c453])){this['channel']['setVariable'](util[_0x8711('0x52')]('%s.%s',_0x261096,_0x41c453),_0x4ee3f3[_0x41c453]);}}}}};AGIVertices[_0x8711('0x12')][_0x8711('0x9c')]=function(_0x5dfeb0){try{var _0x42e4bd=JSON[_0x8711('0x69')](_0x5dfeb0);this[_0x8711('0x96')](_0x42e4bd);return JSON[_0x8711('0x6f')](_0x42e4bd);}catch(_0x2953fa){return this[_0x8711('0x95')](_0x5dfeb0);}};AGIVertices[_0x8711('0x12')][_0x8711('0x95')]=function(_0x121390){var _0x13403f=_0x121390[_0x8711('0x9d')]('{');for(var _0x219e1c=0x1;_0x219e1c<_0x13403f['length'];_0x219e1c+=0x1){var _0x1f00d1=_0x13403f[_0x219e1c][_0x8711('0x9d')]('}');if(_0x1f00d1[_0x8711('0x99')]>0x1){_0x121390=_0x121390[_0x8711('0x9e')]('{'+_0x1f00d1[0x0]+'}',this[_0x8711('0xe')]['getVariable'](_0x1f00d1[0x0])[_0x8711('0x9f')]||_0x1f00d1[0x0]);}}if(_0x13403f[_0x8711('0x99')]===0x1){return _0x121390[_0x8711('0xa0')]();}return this[_0x8711('0x95')](_0x121390);};AGIVertices[_0x8711('0x12')][_0x8711('0xa1')]=function(_0x3d3d3a,_0x15e0c2){var _0x48ff93=this[_0x8711('0xe')]['getVariable'](_0x3d3d3a);if(_0x48ff93[_0x8711('0xa2')]===-0x1){return _0x48ff93;}logger[_0x8711('0x2d')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x15e0c2,_0x48ff93['extra']));return this[_0x8711('0xe')]['setVariable'](_0x15e0c2,_0x48ff93[_0x8711('0x9f')]);};AGIVertices[_0x8711('0x12')][_0x8711('0x80')]=function(_0xe39975){return _0xe39975&&_0xe39975!=='0'&&_0xe39975!=='-1'&&_0xe39975!=='';};AGIVertices[_0x8711('0x12')][_0x8711('0xa3')]=function(_0x12e6d1){this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x12e6d1,'-');_0x12e6d1[_0x8711('0xa4')]=_0x12e6d1['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8711('0x12')][_0x8711('0xa5')]=function(_0x26662c){logger['info'](util['format'](_0x8711('0xa6'),_0x26662c[_0x8711('0x37')]));if(!this['isConfigured'](_0x26662c[_0x8711('0x5a')])){return this['channel'][_0x8711('0xa7')](_0x8711('0xa8'));}var _0x2248dd='\x22'+_0x26662c[_0x8711('0x5a')]+'\x22';if(this['isConfigured'](_0x26662c[_0x8711('0x74')])){_0x2248dd+=','+_0x26662c[_0x8711('0x74')];}var _0x2c379d=this[_0x8711('0xe')]['exec'](_0x8711('0xa9'),_0x2248dd);if(_0x2c379d[_0x8711('0xa2')]===-0x1){return _0x2c379d;}return this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0xaa'),_0x2248dd));};AGIVertices[_0x8711('0x12')][_0x8711('0xab')]=function(_0x1639b0){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xac'),_0x1639b0['label']));if(!this[_0x8711('0x80')](_0x1639b0[_0x8711('0xad')])){return this[_0x8711('0xe')][_0x8711('0xa7')]('no\x20grammar\x20configured');}var _0x1efc86=_0x1639b0[_0x8711('0xad')];if(this[_0x8711('0x80')](_0x1639b0[_0x8711('0x74')])){_0x1efc86+=','+_0x1639b0[_0x8711('0x74')];}var _0x3b4957=this[_0x8711('0xe')][_0x8711('0x54')](_0x8711('0xae'),_0x1efc86);if(_0x3b4957[_0x8711('0xa2')]===-0x1){return _0x3b4957;}var _0x1f71d1=this['getAndSetVariable'](_0x8711('0xaf'),_0x8711('0xb0'));if(_0x1f71d1[_0x8711('0xa2')]===-0x1){return _0x1f71d1;}var _0x2a5542=this[_0x8711('0xa1')](_0x8711('0xb1'),_0x8711('0xb2'));if(_0x2a5542[_0x8711('0xa2')]===-0x1){return _0x2a5542;}var _0x206d6b=this[_0x8711('0xa1')](_0x8711('0xb3'),_0x8711('0xb4'));if(_0x206d6b['result']===-0x1){return _0x206d6b;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xb5'),_0x1efc86));};AGIVertices[_0x8711('0x12')]['agi']=function(_0x7c57){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xb6'),_0x7c57[_0x8711('0x37')]));return this[_0x8711('0xe')][_0x8711('0x6')]([_0x7c57[_0x8711('0xb7')],_0x7c57[_0x8711('0xb8')]]);};AGIVertices[_0x8711('0x12')][_0x8711('0xb9')]=function(_0x2c4cad){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xba'),_0x2c4cad[_0x8711('0x37')]));if(this['isConfigured'](_0x2c4cad[_0x8711('0x61')])){logger[_0x8711('0x2d')](util['format'](_0x8711('0xbb'),_0x2c4cad[_0x8711('0x61')]));var _0x423acb=this[_0x8711('0xe')][_0x8711('0xbc')](_0x2c4cad[_0x8711('0x61')]);if(_0x423acb['result']===-0x1){return _0x423acb;}}return this['channel'][_0x8711('0xb9')]();};AGIVertices['prototype']['callback']=function(_0x46564a){logger[_0x8711('0x2d')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x46564a['label']));if(!this[_0x8711('0x80')](_0x46564a[_0x8711('0x48')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x46564a,_0x8711('0xbd'));}_0x46564a[_0x8711('0x49')]=moment();if(this[_0x8711('0x80')](_0x46564a[_0x8711('0xbe')])){_0x46564a['scheduledAt']=moment()[_0x8711('0xbf')](_0x46564a[_0x8711('0xbe')],_0x8711('0xc0'));}if(!this['isConfigured'](_0x46564a[_0x8711('0xc1')])){_0x46564a[_0x8711('0xc1')]=0x2;}this[_0x8711('0x41')][_0x8711('0x6c')](this,_0x46564a);return this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x46564a[_0x8711('0x47')],_0x46564a[_0x8711('0x48')],_0x46564a[_0x8711('0x49')]));};AGIVertices['prototype'][_0x8711('0xc2')]=function(_0x489023){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x489023['label']));var _0x2b605e=this[_0x8711('0xe')][_0x8711('0x54')](_0x489023[_0x8711('0xc3')],_0x489023[_0x8711('0x74')]);if(_0x2b605e[_0x8711('0xa2')]===-0x1){return _0x2b605e;}return this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xc4'),_0x489023[_0x8711('0xc3')],_0x489023[_0x8711('0x74')]));};AGIVertices['prototype'][_0x8711('0xc5')]=function(_0xf97064){logger[_0x8711('0x2d')](util['format'](_0x8711('0xc6'),_0xf97064['label']));if(!this['isConfigured'](_0xf97064['text'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xa8'));}var _0x195ce0='\x22'+_0xf97064[_0x8711('0x5a')]+'\x22';if(this[_0x8711('0x80')](_0xf97064['options'])){_0x195ce0+=','+_0xf97064['options'];}var _0x5c8b5e=this[_0x8711('0xe')][_0x8711('0x54')](_0x8711('0xa9'),_0x195ce0);if(_0x5c8b5e[_0x8711('0xa2')]===-0x1){return _0x5c8b5e;}return this['channel']['noop'](util[_0x8711('0x52')](_0x8711('0xaa'),_0x195ce0));};AGIVertices[_0x8711('0x12')]['sestektts']=function(_0x39db70){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xc7'),_0x39db70['label']));if(!this[_0x8711('0x80')](_0x39db70[_0x8711('0x5a')])){return this[_0x8711('0xe')]['noop'](_0x8711('0xa8'));}var _0x21d879='\x22'+_0x39db70[_0x8711('0x5a')]+'\x22';if(this['isConfigured'](_0x39db70[_0x8711('0x74')])){_0x21d879+=','+_0x39db70['options'];}var _0x545cd9=this[_0x8711('0xe')][_0x8711('0x54')](_0x8711('0xa9'),_0x21d879);if(_0x545cd9['result']===-0x1){return _0x545cd9;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xaa'),_0x21d879));};AGIVertices[_0x8711('0x12')]['lumenvoxasr']=function(_0x2571e8){logger[_0x8711('0x2d')](util['format'](_0x8711('0xc8'),_0x2571e8['label']));if(!this['isConfigured'](_0x2571e8[_0x8711('0xad')])){return this['channel']['noop'](_0x8711('0xc9'));}var _0x15a3b9=_0x2571e8[_0x8711('0xad')];if(this[_0x8711('0x80')](_0x2571e8['options'])){_0x15a3b9+=','+_0x2571e8[_0x8711('0x74')];}var _0x1af9fe=this[_0x8711('0xe')][_0x8711('0x54')]('MRCPRecog',_0x15a3b9);if(_0x1af9fe[_0x8711('0xa2')]===-0x1){return _0x1af9fe;}var _0x546f45=this[_0x8711('0xa1')](_0x8711('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x546f45[_0x8711('0xa2')]===-0x1){return _0x546f45;}var _0x1ad50a=this[_0x8711('0xa1')](_0x8711('0xb1'),_0x8711('0xca'));if(_0x1ad50a[_0x8711('0xa2')]===-0x1){return _0x1ad50a;}var _0x29edfc=this[_0x8711('0xa1')](_0x8711('0xb3'),_0x8711('0xcb'));if(_0x29edfc[_0x8711('0xa2')]===-0x1){return _0x29edfc;}return this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0xb5'),_0x15a3b9));};AGIVertices[_0x8711('0x12')][_0x8711('0xcc')]=function(_0x3c98d0){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xcd'),_0x3c98d0['label']));if(!this[_0x8711('0x80')](_0x3c98d0[_0x8711('0xad')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xc9'));}var _0x1edd67=_0x3c98d0[_0x8711('0xad')];if(this['isConfigured'](_0x3c98d0[_0x8711('0x74')])){_0x1edd67+=','+_0x3c98d0['options'];}var _0x43fe92=this[_0x8711('0xe')][_0x8711('0x54')](_0x8711('0xae'),_0x1edd67);if(_0x43fe92['result']===-0x1){return _0x43fe92;}var _0x4ee6d8=this[_0x8711('0xa1')]('RECOG_CONFIDENCE()',_0x8711('0xce'));if(_0x4ee6d8[_0x8711('0xa2')]===-0x1){return _0x4ee6d8;}var _0x2acd09=this[_0x8711('0xa1')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x2acd09[_0x8711('0xa2')]===-0x1){return _0x2acd09;}var _0x185e78=this[_0x8711('0xa1')](_0x8711('0xb3'),_0x8711('0xcf'));if(_0x185e78[_0x8711('0xa2')]===-0x1){return _0x185e78;}return this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0xb5'),_0x1edd67));};AGIVertices[_0x8711('0x12')][_0x8711('0xd0')]=function(_0x48ebda){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x48ebda[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x48ebda[_0x8711('0xd1')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x48ebda,'no\x20database\x20selected');}var _0x2a7b87=this[_0x8711('0x19')]['sync'](this,_0x48ebda[_0x8711('0xd1')]);if(!_0x2a7b87){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x48ebda,_0x8711('0xd2'));}if(!this[_0x8711('0x80')](_0x48ebda[_0x8711('0x2e')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x48ebda,_0x8711('0xd3'));}var _0x405719=_0x48ebda[_0x8711('0x2e')][_0x8711('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xd4'),_0x405719));var _0x58dc05=this[_0x8711('0x29')][_0x8711('0x6c')](this,_0x2a7b87,_0x405719);this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x48ebda,_0x405719);if(!this[_0x8711('0x80')](_0x48ebda[_0x8711('0xd5')])){return this['channel'][_0x8711('0xa7')](_0x8711('0xd6'));}var _0x16a582=this['getVariable']['sync'](this,_0x48ebda[_0x8711('0xd5')]);if(!_0x16a582){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x48ebda,'no\x20variable\x20found');}var _0x321ace=this;_0x58dc05[_0x8711('0xd7')](function(_0x358089,_0x229a6a){Object[_0x8711('0xd8')](_0x358089)[_0x8711('0xd7')](function(_0x3db618){_0x321ace[_0x8711('0xe')][_0x8711('0xd9')](util[_0x8711('0x52')](_0x8711('0xda'),_0x16a582,_0x229a6a,_0x3db618),_0x358089[_0x3db618]);});});this['channel'][_0x8711('0xd9')](util['format'](_0x8711('0xdb'),_0x16a582),_0x58dc05[_0x8711('0x99')]);return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xdc'),_0x16a582));};AGIVertices[_0x8711('0x12')][_0x8711('0xdd')]=function(_0x76a92a){logger[_0x8711('0xde')](util[_0x8711('0x52')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x76a92a[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x76a92a[_0x8711('0xdf')])){return this[_0x8711('0xe')]['error'](_0x76a92a,_0x8711('0xe0'));}var _0x52f02e=this[_0x8711('0x1b')][_0x8711('0x6c')](this,_0x76a92a[_0x8711('0xdf')]);if(!_0x52f02e){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x76a92a,_0x8711('0xe1'));}var _0x56fdf8=this['channel']['exec'](_0x8711('0xe2'),[util[_0x8711('0x52')]('SIP/%s',_0x52f02e),_0x76a92a[_0x8711('0x61')],_0x76a92a[_0x8711('0xe3')],_0x76a92a[_0x8711('0x5f')]]);if(_0x56fdf8[_0x8711('0xa2')]===-0x1){return _0x56fdf8;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xe4'),'DIAL'));};AGIVertices['prototype'][_0x8711('0xe5')]=function(_0x4999cb){logger[_0x8711('0x2d')](util['format'](_0x8711('0xe6'),_0x4999cb[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x4999cb[_0x8711('0x76')])){return this['channel']['noop'](_0x8711('0xe7'));}if(!this['isConfigured'](_0x4999cb['text'])){return this['channel'][_0x8711('0xa7')](_0x8711('0xa8'));}this['channel'][_0x8711('0xe8')]=!![];this[_0x8711('0x35')](_0x4999cb);this[_0x8711('0x40')](_0x4999cb['text'],'in','','');this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('Trying\x20Dialogflow:\x20%s',_0x4999cb[_0x8711('0x5a')]));var _0x4d337a=this['googleDialogflow'][_0x8711('0x6c')](this,_0x4999cb);if(_0x4d337a){for(var _0x2238b9 in _0x4d337a){if(_0x4d337a[_0x8711('0x93')](_0x2238b9)){this[_0x8711('0xe')]['setVariable'](util[_0x8711('0x52')](_0x8711('0xe9'),_0x2238b9[_0x8711('0xea')]()),_0x4d337a[_0x2238b9]);}}this[_0x8711('0x40')](_0x4d337a[_0x8711('0xeb')],_0x8711('0xec'),_0x8711('0xe5'),'');return this['channel'][_0x8711('0xa7')](util['format'](_0x8711('0xed'),_0x4d337a[_0x8711('0xeb')]));}return this[_0x8711('0xe')][_0x8711('0x2b')](_0x4999cb,_0x8711('0xee'));};AGIVertices[_0x8711('0x12')]['dialogflowV2']=function(_0x1eb7a1){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xef'),_0x1eb7a1[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x1eb7a1['dialogflowV2_project_id'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xf0'));}if(!this[_0x8711('0x80')](_0x1eb7a1[_0x8711('0x7a')])){return this[_0x8711('0xe')]['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x1eb7a1[_0x8711('0xf1')])){return this['channel']['noop'](_0x8711('0xf2'));}if(!this[_0x8711('0x80')](_0x1eb7a1['dialogflowV2_language'])){return this['channel'][_0x8711('0xa7')](_0x8711('0xf3'));}if(!this[_0x8711('0x80')](_0x1eb7a1[_0x8711('0x5a')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xa8'));}this[_0x8711('0xe')][_0x8711('0xe8')]=!![];this[_0x8711('0x35')](_0x1eb7a1);this[_0x8711('0x40')](_0x1eb7a1[_0x8711('0x5a')],'in','','');this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0xf4'),_0x1eb7a1[_0x8711('0x5a')]));var _0x3c0e3a=this['googleDialogflowV2']['sync'](this,_0x1eb7a1);if(_0x3c0e3a){for(var _0x56137b in _0x3c0e3a){if(_0x3c0e3a[_0x8711('0x93')](_0x56137b)){if(_0x56137b!==_0x8711('0xf5')){this[_0x8711('0xe')][_0x8711('0xd9')](util[_0x8711('0x52')](_0x8711('0xe9'),_0x56137b[_0x8711('0xea')]()),_0x3c0e3a[_0x56137b]);}}}this[_0x8711('0x40')](_0x3c0e3a[_0x8711('0xeb')],_0x8711('0xec'),'dialogflowV2',_0x3c0e3a[_0x8711('0xf5')]);return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('DialogflowV2\x20Result\x20%s',_0x3c0e3a[_0x8711('0xeb')]));}return this[_0x8711('0xe')]['error'](_0x1eb7a1,_0x8711('0xf6'));};AGIVertices[_0x8711('0x12')][_0x8711('0xf7')]=function(_0x1dfdad){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0xf8'),_0x1dfdad[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x1dfdad[_0x8711('0xf9')])){return this[_0x8711('0xe')]['noop'](_0x8711('0xfa'));}if(!this[_0x8711('0x80')](_0x1dfdad['username'])){return this['channel'][_0x8711('0xa7')]('no\x20username\x20configured');}if(!this[_0x8711('0x80')](_0x1dfdad['password'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xfb'));}if(!this['isConfigured'](_0x1dfdad[_0x8711('0xfc')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xa8'));}this['channel'][_0x8711('0xe8')]=!![];this[_0x8711('0x35')](_0x1dfdad);this['createSquareMessage'](_0x1dfdad[_0x8711('0x5a')],'in','','');this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xfd'),_0x1dfdad[_0x8711('0x5a')]));var _0x921eb4=this['sestekNDA'][_0x8711('0x6c')](this,_0x1dfdad);if(_0x921eb4){for(var _0x4b959a in _0x921eb4){if(_0x921eb4[_0x8711('0x93')](_0x4b959a)){this[_0x8711('0xe')]['setVariable'](util[_0x8711('0x52')](_0x8711('0xfe'),_0x4b959a[_0x8711('0xea')]()),_0x921eb4[_0x4b959a]);}}this[_0x8711('0x40')](_0x921eb4[_0x8711('0xeb')],_0x8711('0xec'),_0x8711('0xf7'),'');if(_0x921eb4[_0x8711('0xff')]){this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x100'),_0x921eb4[_0x8711('0xff')]));var _0x201434=this[_0x8711('0xe')][_0x8711('0x101')](_0x921eb4['audiofile']);try{fs[_0x8711('0x102')](_0x921eb4['audiofile']+_0x8711('0x103'));}catch(_0x2c0ccb){logger[_0x8711('0x2b')](_0x2c0ccb);}return _0x201434;}else{return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('SestekNDA\x20Result\x20%s',_0x921eb4['speech']));}}return this['channel'][_0x8711('0x2b')](_0x1dfdad,_0x8711('0x104'));};AGIVertices[_0x8711('0x12')][_0x8711('0x105')]=function(_0x4476a2){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x4476a2[_0x8711('0x37')]));return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x105'));};AGIVertices['prototype'][_0x8711('0x106')]=function(_0x5e558d){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x107'),_0x5e558d[_0x8711('0x37')]));var _0x141bc6='';if(_0x5e558d[_0x8711('0x108')]){if(!this[_0x8711('0x80')](_0x5e558d[_0x8711('0x108')])){return this['channel'][_0x8711('0x2b')](_0x5e558d,_0x8711('0x109'));}else{var _0xf581bc=parseInt(_0x5e558d['trunk_id'],0xa);if(isNaN(_0xf581bc)){_0x141bc6=_0x5e558d[_0x8711('0x108')];}else{_0x141bc6=this[_0x8711('0x1c')][_0x8711('0x6c')](this,_0x5e558d[_0x8711('0x108')]);if(!_0x141bc6){return this['channel'][_0x8711('0x2b')](_0x5e558d,'no\x20trunk\x20found');}}}}else if(_0x5e558d[_0x8711('0x10a')]){_0x141bc6=_0x5e558d['trunk_name'];}else{return this['channel']['error'](_0x5e558d,_0x8711('0x109'));}var _0x30c6bb=this[_0x8711('0xe')]['exec'](_0x8711('0xe2'),[util[_0x8711('0x52')](_0x8711('0x10b'),_0x141bc6,_0x5e558d['phone']),_0x5e558d[_0x8711('0x61')],_0x5e558d['opts'],_0x5e558d['url']]);if(_0x30c6bb[_0x8711('0xa2')]===-0x1){return _0x30c6bb;}return this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0xe4'),_0x8711('0xe2')));};AGIVertices[_0x8711('0x12')][_0x8711('0x10c')]=function(_0x440351){logger['info'](util[_0x8711('0x52')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x440351['label']));return this['channel'][_0x8711('0xa7')](_0x8711('0x10c'));};AGIVertices['prototype'][_0x8711('0xc')]=function(_0x128e50){logger[_0x8711('0x2d')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x128e50[_0x8711('0x37')]));if(_0x128e50[_0x8711('0xa4')]===0x0){return this[_0x8711('0xa3')](_0x128e50);}_0x128e50[_0x8711('0xa4')]-=0x1;if(!this[_0x8711('0x80')](_0x128e50[_0x8711('0x10d')])){return this['channel']['error'](_0x128e50,_0x8711('0x10e'));}var _0x263a06=this[_0x8711('0x1e')]['sync'](this,_0x128e50['file_id']);if(!_0x263a06){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x128e50,_0x8711('0x10f'));}if(!this[_0x8711('0x80')](_0x128e50[_0x8711('0xd5')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x8711('0xd6'));}var _0x25f480=this[_0x8711('0xe')]['getData'](_0x263a06,_0x128e50[_0x8711('0x110')],_0x128e50[_0x8711('0x111')]);var _0x274004=_0x25f480[_0x8711('0xa2')]?_0x25f480[_0x8711('0xa2')][_0x8711('0xa0')]():'';logger[_0x8711('0x2d')](_0x8711('0x112'),JSON[_0x8711('0x6f')](_0x25f480));if(_0x25f480[_0x8711('0xa2')]===-0x1){this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x128e50,_0x274004);return _0x25f480;}else if(_0x25f480[_0x8711('0x9f')]==='timeout'){_0x25f480[_0x8711('0xa2')]=_0x274004[_0x8711('0x99')]>=parseInt(_0x128e50[_0x8711('0x113')])?'x':'i';}else{_0x25f480[_0x8711('0xa2')]=_0x274004[_0x8711('0x99')]>=parseInt(_0x128e50[_0x8711('0x113')])&&_0x274004['length']<=parseInt(_0x128e50[_0x8711('0x111')])?'x':'i';}var _0x3b5d8c=this[_0x8711('0x114')]['sync'](this,_0x128e50[_0x8711('0xd5')]);if(!_0x3b5d8c){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x128e50,'no\x20variable\x20found');}this[_0x8711('0xe')]['setVariable'](_0x3b5d8c,_0x274004);if(this[_0x8711('0x80')](_0x128e50['hiddendigitsnum'])){var _0x284a84=parseInt(_0x128e50[_0x8711('0x115')],0xa);var _0x1aba82=rs[_0x8711('0x116')]({'charset':'*','length':_0x284a84});var _0x2ca7b3=_0x274004[_0x8711('0x99')];if(_0x2ca7b3>0x0){if(_0x2ca7b3>_0x284a84){this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x128e50,_0x128e50[_0x8711('0x117')]===_0x8711('0x118')?_0x1aba82+_0x274004['substr'](_0x284a84):_0x274004[_0x8711('0x119')](0x0,_0x2ca7b3-_0x284a84)+_0x1aba82);}else{this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x128e50,rs['generate']({'charset':'*','length':_0x2ca7b3}));}}else{this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x128e50,'');}}else{this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x128e50,_0x274004);}return _0x25f480;};AGIVertices[_0x8711('0x12')][_0x8711('0xd')]=function(_0xd03375){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0xd03375['label']));return this[_0x8711('0xc')](_0xd03375);};AGIVertices[_0x8711('0x12')][_0x8711('0x11a')]=function(_0x545921){logger['info'](util[_0x8711('0x52')](_0x8711('0x11b'),_0x545921[_0x8711('0x37')]));this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x545921,_0x545921[_0x8711('0x11c')]);return this[_0x8711('0xe')][_0x8711('0xa7')](util['format']('GOAL\x20%s',_0x545921[_0x8711('0x11c')]));};AGIVertices[_0x8711('0x12')][_0x8711('0x11d')]=function(_0x1607f5){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x11e'),_0x1607f5[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x1607f5[_0x8711('0x83')])||!this[_0x8711('0x80')](_0x1607f5['aws_secret_access_key'])){return this['channel']['noop'](_0x8711('0x11f'));}if(!this['isConfigured'](_0x1607f5[_0x8711('0x5a')])){return this['channel'][_0x8711('0xa7')](_0x8711('0xa8'));}this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x120'),_0x1607f5[_0x8711('0x5a')]));var _0x453270=this[_0x8711('0x82')]['sync'](this,_0x1607f5);if(_0x453270){this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0x121'),_0x453270));var _0x5d83ab=this[_0x8711('0xe')]['streamFile'](_0x453270);try{fs[_0x8711('0x102')](_0x453270+_0x8711('0x103'));}catch(_0x5483d1){logger['error'](_0x5483d1);}return _0x5d83ab;}return this[_0x8711('0xe')][_0x8711('0x2b')](_0x1607f5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x8711('0x12')]['awslex']=function(_0x3500d2){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x3500d2[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x3500d2[_0x8711('0x83')])||!this[_0x8711('0x80')](_0x3500d2['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3500d2['aws_bot_name'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x122'));}if(!this['isConfigured'](_0x3500d2['text'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xa8'));}this['channel'][_0x8711('0xe8')]=!![];this[_0x8711('0x35')](_0x3500d2);this[_0x8711('0x40')](_0x3500d2[_0x8711('0x5a')],'in','','');this['channel'][_0x8711('0xa7')](util['format'](_0x8711('0x123'),_0x3500d2[_0x8711('0x5a')]));var _0x413a54=this[_0x8711('0x88')][_0x8711('0x6c')](this,_0x3500d2);if(_0x413a54){for(var _0x2cecbc in _0x413a54){if(_0x413a54[_0x8711('0x93')](_0x2cecbc)&&_['isString'](_0x413a54[_0x2cecbc])){this[_0x8711('0xe')][_0x8711('0xd9')](util['format'](_0x8711('0x124'),_0x2cecbc[_0x8711('0xea')]()),_0x413a54[_0x2cecbc]);}}if(_['isNil'](_0x413a54[_0x8711('0x72')])){return this['channel'][_0x8711('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x8711('0x40')](_0x413a54['message'],'out',_0x8711('0x125'),'');return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x126'),_0x413a54['message']));}}return this[_0x8711('0xe')][_0x8711('0x2b')](_0x3500d2,_0x8711('0x127'));};AGIVertices[_0x8711('0x12')][_0x8711('0x128')]=function(_0x7a31da){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x129'),_0x7a31da[_0x8711('0x37')],_0x7a31da['timeout']));if(!this[_0x8711('0x80')](_0x7a31da[_0x8711('0x76')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xe7'));}var _0x168ff0=_0x8711('0x12a');var _0x3a347a=util[_0x8711('0x52')]('%s/recordings/%s',FILES_PATH,rs[_0x8711('0x116')](0x4));var _0x130532=util[_0x8711('0x52')]('%s.%s',_0x3a347a,_0x168ff0);var _0x56aa94=!![];if(_0x7a31da[_0x8711('0x12b')]===_0x8711('0x12c')){_0x56aa94=![];}var _0x3f9393=this[_0x8711('0xe')][_0x8711('0x12d')](_0x3a347a,_0x168ff0,_0x7a31da[_0x8711('0x12e')],_0x7a31da[_0x8711('0x61')],undefined,_0x56aa94);if(_0x3f9393[_0x8711('0xa2')]!==-0x1){this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0x12f'),_0x130532));var _0x3c72b7=this[_0x8711('0x8c')]['sync'](this,_0x7a31da,_0x130532);if(_0x3c72b7){for(var _0x34aef0 in _0x3c72b7){if(_0x3c72b7[_0x8711('0x93')](_0x34aef0)){this[_0x8711('0xe')]['setVariable'](util[_0x8711('0x52')](_0x8711('0x130'),_0x34aef0[_0x8711('0xea')]()),_0x3c72b7[_0x34aef0]);}}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x131'),JSON[_0x8711('0x6f')](_0x3c72b7)));}}return _0x3f9393;};AGIVertices[_0x8711('0x12')]['tildeasr']=function(_0x53d077){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x132'),_0x53d077[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x53d077[_0x8711('0x8f')])){return this[_0x8711('0xe')]['noop'](_0x8711('0x133'));}if(!this[_0x8711('0x80')](_0x53d077[_0x8711('0x90')])){return this['channel']['noop'](_0x8711('0x134'));}var _0x11bc79=_0x8711('0x12a');var _0x30cb1e=util['format'](_0x8711('0x135'),FILES_PATH,rs[_0x8711('0x116')](0x4));var _0x60e98d=util[_0x8711('0x52')](_0x8711('0x9b'),_0x30cb1e,_0x11bc79);var _0x41ef90=!![];if(_0x53d077[_0x8711('0x12b')]===_0x8711('0x12c')){_0x41ef90=![];}var _0x1532b0=this[_0x8711('0xe')][_0x8711('0x12d')](_0x30cb1e,_0x11bc79,_0x53d077[_0x8711('0x12e')],_0x53d077[_0x8711('0x61')],undefined,_0x41ef90);if(_0x1532b0[_0x8711('0xa2')]!==-0x1){this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x136'),_0x60e98d));var _0x59bb4b=this[_0x8711('0x8e')][_0x8711('0x6c')](this,_0x53d077,_0x60e98d);if(_0x59bb4b){for(var _0x21ddef in _0x59bb4b){if(_0x59bb4b[_0x8711('0x93')](_0x21ddef)){this[_0x8711('0xe')][_0x8711('0xd9')](util[_0x8711('0x52')](_0x8711('0x137'),_0x21ddef[_0x8711('0xea')]()),_0x59bb4b[_0x21ddef]);}}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('TildeASR\x20Result\x20%s',JSON[_0x8711('0x6f')](_0x59bb4b)));}}return _0x1532b0;};AGIVertices[_0x8711('0x12')][_0x8711('0x138')]=function(_0x15fb7d){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x139'),_0x15fb7d['label']));return this[_0x8711('0xe')][_0x8711('0x13a')](_0x15fb7d['context'],_0x15fb7d['extension'],_0x15fb7d[_0x8711('0x3d')]);};AGIVertices[_0x8711('0x12')][_0x8711('0x13b')]=function(_0x35d0b6){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x35d0b6[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x35d0b6[_0x8711('0x13c')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x35d0b6,_0x8711('0x13d'));}try{var _0x4722d5=eval(_0x35d0b6[_0x8711('0x13c')])?_0x8711('0x13e'):_0x8711('0x13f');this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('EVAL\x20CONDITION\x20%s\x20%s',_0x35d0b6[_0x8711('0x13c')],_0x4722d5));return{'code':0xc8,'result':_0x4722d5};}catch(_0x5b558f){return{'code':0xc8,'result':_0x8711('0x13f')};}};AGIVertices[_0x8711('0x12')][_0x8711('0x140')]=function(_0x55cb4f){logger['info'](util[_0x8711('0x52')](_0x8711('0x141'),_0x55cb4f['label']));if(!this[_0x8711('0x80')](_0x55cb4f['interval_id'])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x55cb4f,_0x8711('0x142'));}var _0x41d14b=this['getIntervals'][_0x8711('0x6c')](this,_0x55cb4f[_0x8711('0x143')]);if(!_0x41d14b){return this[_0x8711('0xe')]['error'](_0x55cb4f,_0x8711('0x144'));}for(var _0x497715=0x0;_0x497715<_0x41d14b[_0x8711('0x99')];_0x497715+=0x1){var _0x458936=this[_0x8711('0xe')][_0x8711('0x114')](util[_0x8711('0x52')](_0x8711('0x145'),_0x41d14b[_0x497715]));if(_0x458936[_0x8711('0xa2')]===-0x1){return _0x458936;}logger[_0x8711('0x2d')](util['format'](_0x8711('0x146'),_0x41d14b[_0x497715],_0x458936[_0x8711('0x9f')]));if(_0x458936[_0x8711('0x9f')]==='true'){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x146'),_0x41d14b[_0x497715],_0x8711('0x13e')));this[_0x8711('0xe')][_0x8711('0xa7')](util['format']('IFTIME\x20%s\x20%s',_0x41d14b[_0x497715],_0x8711('0x13e')));return{'code':0xc8,'result':_0x8711('0x13e')};}else{logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x146'),_0x41d14b[_0x497715],_0x8711('0x13f')));this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0x146'),_0x41d14b[_0x497715],_0x8711('0x13f')));}}return{'code':0xc8,'result':_0x8711('0x13f')};};AGIVertices[_0x8711('0x12')][_0x8711('0x147')]=function(_0x3f71ae){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x148'),_0x3f71ae[_0x8711('0x37')]));return this[_0x8711('0xe')][_0x8711('0x147')]();};AGIVertices[_0x8711('0x12')][_0x8711('0x149')]=function(_0x280160){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x14a'),_0x280160[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x280160['key'])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0xe7'));}var _0x102b17=_0x8711('0x12a');var _0x3b35d5=util[_0x8711('0x52')]('%s/recordings/%s',FILES_PATH,rs[_0x8711('0x116')](0x4));var _0x57f7e4=util[_0x8711('0x52')](_0x8711('0x9b'),_0x3b35d5,_0x102b17);var _0x2bd0b2=!![];if(_0x280160[_0x8711('0x12b')]===_0x8711('0x12c')){_0x2bd0b2=![];}var _0x550360=this[_0x8711('0xe')][_0x8711('0x12d')](_0x3b35d5,_0x102b17,_0x280160[_0x8711('0x12e')],_0x280160[_0x8711('0x61')],undefined,_0x2bd0b2);if(_0x550360['result']!==-0x1){this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0x14b'),_0x57f7e4));var _0x5eed71=this[_0x8711('0x7e')][_0x8711('0x6c')](this,_0x280160,_0x57f7e4);if(_0x5eed71){for(var _0x2a6214 in _0x5eed71){if(_0x5eed71[_0x8711('0x93')](_0x2a6214)){this[_0x8711('0xe')][_0x8711('0xd9')](util[_0x8711('0x52')](_0x8711('0x14c'),_0x2a6214[_0x8711('0xea')]()),_0x5eed71[_0x2a6214]);}}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x14d'),JSON[_0x8711('0x6f')](_0x5eed71)));}}return _0x550360;};AGIVertices[_0x8711('0x12')][_0x8711('0x14e')]=function(_0xb22041){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x14f'),_0xb22041[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0xb22041['key'])){return this['channel'][_0x8711('0xa7')](_0x8711('0xe7'));}if(!this[_0x8711('0x80')](_0xb22041[_0x8711('0x5a')])){return this['channel'][_0x8711('0xa7')]('no\x20text\x20configured');}this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('Trying\x20ispeech\x20TTS\x20%s',_0xb22041[_0x8711('0x5a')]));var _0x17a05c=this['ispeechTTS']['sync'](this,_0xb22041);if(_0x17a05c){this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('ispeech\x20%s\x20file\x20created',_0x17a05c));var _0x560332=this[_0x8711('0xe')]['streamFile'](_0x17a05c,_0xb22041[_0x8711('0x12e')]);try{fs[_0x8711('0x102')](_0x17a05c+_0x8711('0x103'));}catch(_0x29e1ba){logger[_0x8711('0x2b')](_0x29e1ba);}return _0x560332;}return this[_0x8711('0xe')]['error'](_0xb22041,_0x8711('0x150'));};AGIVertices[_0x8711('0x12')][_0x8711('0x151')]=function(_0x42344c){logger['info'](util[_0x8711('0x52')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x42344c[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x42344c[_0x8711('0x152')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x42344c,'no\x20find\x20by\x20configured');}logger['info'](util[_0x8711('0x52')](_0x8711('0x153'),this[_0x8711('0xe')]['callerid'],_0x42344c['findBy']));var _0x48e819=this[_0x8711('0x50')][_0x8711('0x6c')](this,_0x42344c[_0x8711('0x152')]);if(_0x48e819){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x154'),this[_0x8711('0xe')]['callerid'],_0x42344c[_0x8711('0x152')]));this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8711('0x39')],_0x42344c[_0x8711('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8711('0x2d')](util[_0x8711('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8711('0xe')][_0x8711('0x39')],_0x42344c[_0x8711('0x152')]));this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x155'),this[_0x8711('0xe')][_0x8711('0x39')],_0x42344c[_0x8711('0x152')]));return{'code':0xc8,'result':_0x8711('0x156')};}};AGIVertices[_0x8711('0x12')][_0x8711('0x157')]=function(_0x324484){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x158'),_0x324484[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x324484[_0x8711('0x152')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x324484,_0x8711('0x159'));}logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x153'),this[_0x8711('0xe')][_0x8711('0x39')],_0x324484[_0x8711('0x152')]));var _0x4cc632=this[_0x8711('0x4f')][_0x8711('0x6c')](this,_0x324484['findBy']);if(_0x4cc632){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x324484[_0x8711('0x152')]));this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x154'),this['channel']['callerid'],_0x324484[_0x8711('0x152')]));return{'code':0xc8,'result':_0x8711('0x15a')};}else{logger['info'](util['format'](_0x8711('0x155'),this[_0x8711('0xe')][_0x8711('0x39')],_0x324484[_0x8711('0x152')]));this['channel'][_0x8711('0xa7')](util['format'](_0x8711('0x155'),this[_0x8711('0xe')][_0x8711('0x39')],_0x324484['findBy']));return{'code':0xc8,'result':_0x8711('0x156')};}};AGIVertices[_0x8711('0x12')][_0x8711('0x15b')]=function(_0x905c4d){logger[_0x8711('0x2d')](util['format'](_0x8711('0x15c'),_0x905c4d[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x905c4d[_0x8711('0x15d')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x905c4d,_0x8711('0x15e'));}this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x15f'),_0x905c4d[_0x8711('0x15d')]));var _0xc335ea=eval(_0x905c4d[_0x8711('0x15d')]);if(!this[_0x8711('0x80')](_0x905c4d['variable_id'])){return this['channel'][_0x8711('0xa7')](_0x8711('0xd6'));}var _0x450629=this[_0x8711('0x114')][_0x8711('0x6c')](this,_0x905c4d[_0x8711('0xd5')]);if(!_0x450629){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x905c4d,_0x8711('0x160'));}if(_[_0x8711('0x98')](_0xc335ea)){var _0x357e45=this;_0xc335ea['forEach'](function(_0x23ed12,_0x5b583e){_0x357e45['channel'][_0x8711('0xd9')](util[_0x8711('0x52')]('%s[%s]',_0x450629,_0x5b583e),_0x23ed12);});return this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x161'),_0x450629));}else{return this[_0x8711('0xe')]['setVariable'](_0x450629,_0xc335ea);}};AGIVertices[_0x8711('0x12')][_0x8711('0xb')]=function(_0x40ace2){logger['info'](util[_0x8711('0x52')](_0x8711('0x162'),_0x40ace2[_0x8711('0x37')]));if(_0x40ace2['retry']===0x0){return this[_0x8711('0xa3')](_0x40ace2);}_0x40ace2[_0x8711('0xa4')]-=0x1;if(!this['isConfigured'](_0x40ace2[_0x8711('0x10d')])){return this['channel'][_0x8711('0x2b')](_0x40ace2,'no\x20file\x20audio\x20selected');}var _0x112cdd=this[_0x8711('0x1e')][_0x8711('0x6c')](this,_0x40ace2[_0x8711('0x10d')]);if(!_0x112cdd){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x40ace2,_0x8711('0x10f'));}var _0x3c12a8=this[_0x8711('0xe')][_0x8711('0x163')](_0x112cdd,_0x40ace2[_0x8711('0x110')],_0x40ace2['digit']);var _0x13f01e=_0x3c12a8[_0x8711('0xa2')];if(_0x3c12a8[_0x8711('0xa2')]===-0x1){this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x40ace2,'-1');return _0x3c12a8;}else if(_0x3c12a8[_0x8711('0x9f')]===_0x8711('0x61')){_0x3c12a8[_0x8711('0xa2')]=_0x3c12a8[_0x8711('0xa2')][_0x8711('0x99')]>0x0?_0x3c12a8[_0x8711('0xa2')]:'t';}else if(_[_0x8711('0x42')](_0x3c12a8[_0x8711('0xa2')])){_0x3c12a8['result']='#';_0x13f01e='#';}if(!this[_0x8711('0x80')](_0x40ace2[_0x8711('0xd5')])){this['channel'][_0x8711('0xa7')](_0x8711('0xd6'));}else{var _0x39239a=this[_0x8711('0x114')][_0x8711('0x6c')](this,_0x40ace2['variable_id']);if(!_0x39239a){return this['channel'][_0x8711('0x2b')](_0x40ace2,'no\x20variable\x20found');}this[_0x8711('0xe')][_0x8711('0xd9')](_0x39239a,_0x13f01e);}this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x40ace2,_0x13f01e);return _0x3c12a8;};AGIVertices[_0x8711('0x12')][_0x8711('0xa7')]=function(_0x56df81){logger['info'](util[_0x8711('0x52')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x56df81[_0x8711('0x37')]));return this['channel']['noop'](_0x56df81[_0x8711('0x164')]||_0x56df81[_0x8711('0x37')]);};AGIVertices['prototype'][_0x8711('0x165')]=function(_0x33715a){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x166'),_0x33715a['label']));if(!this[_0x8711('0x80')](_0x33715a['findBy'])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x33715a,_0x8711('0x159'));}logger[_0x8711('0x2d')](util[_0x8711('0x52')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8711('0xe')][_0x8711('0x39')],_0x33715a[_0x8711('0x152')]));var _0x283388=this['getPause'][_0x8711('0x6c')](this,_0x33715a[_0x8711('0x167')]);var _0xb4a7bf=this[_0x8711('0x4d')][_0x8711('0x6c')](this,_0x33715a[_0x8711('0x152')],_0x283388);if(_0xb4a7bf){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x154'),this[_0x8711('0xe')]['callerid'],_0x33715a['findBy']));this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x154'),this[_0x8711('0xe')][_0x8711('0x39')],_0x33715a[_0x8711('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x155'),this[_0x8711('0xe')][_0x8711('0x39')],_0x33715a[_0x8711('0x152')]));this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0x154'),this[_0x8711('0xe')][_0x8711('0x39')],_0x33715a[_0x8711('0x152')]));return{'code':0xc8,'result':_0x8711('0x156')};}};AGIVertices[_0x8711('0x12')][_0x8711('0x168')]=function(_0x5e9028){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x169'),_0x5e9028[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x5e9028[_0x8711('0x10d')])){return this['channel'][_0x8711('0x2b')](_0x5e9028,'no\x20file\x20audio\x20selected');}var _0x5c718c=this[_0x8711('0x1e')][_0x8711('0x6c')](this,_0x5e9028[_0x8711('0x10d')]);if(!_0x5c718c){return this[_0x8711('0xe')]['error'](_0x5e9028,_0x8711('0x10f'));}var _0x2c8a91=this[_0x8711('0xe')]['exec'](_0x8711('0x16a'),[_0x5c718c,_0x5e9028[_0x8711('0xe3')]]);if(_0x2c8a91[_0x8711('0xa2')]===-0x1){return _0x2c8a91;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('Executed\x20command\x20%s\x20%s',_0x8711('0x16a'),_0x5c718c));};AGIVertices[_0x8711('0x12')]['queue']=function(_0x52ce4c){logger['info'](util[_0x8711('0x52')](_0x8711('0x16b'),_0x52ce4c[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x52ce4c[_0x8711('0x16c')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x52ce4c,_0x8711('0x16d'));}var _0x2972a1='';var _0x274d9b=parseInt(_0x52ce4c[_0x8711('0x16c')],0xa);if(isNaN(_0x274d9b)){_0x2972a1=_0x52ce4c[_0x8711('0x16c')];}else{_0x2972a1=this['getVoiceQueue']['sync'](this,_0x52ce4c[_0x8711('0x16c')]);if(!_0x2972a1){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x52ce4c,'no\x20queue\x20found');}}var _0x6ded0d='';if(this[_0x8711('0x80')](_0x52ce4c[_0x8711('0x10d')])){var _0x166f83=this['getSound']['sync'](this,_0x52ce4c[_0x8711('0x10d')]);if(_0x166f83){_0x6ded0d=_0x166f83;}}this['createSquareDetailsReport']['sync'](this,_0x52ce4c,_0x2972a1);if(_0x52ce4c[_0x8711('0xe3')][_0x8711('0x16e')]('x')<0x0){_0x52ce4c[_0x8711('0xe3')]+='x';}if(_0x52ce4c['opts']['indexOf']('X')<0x0){_0x52ce4c[_0x8711('0xe3')]+='X';}this[_0x8711('0xe')]['setVariable']('XMCS-QUEUE',_0x2972a1?_0x2972a1[_0x8711('0x16f')]():'');var _0x33e279=this[_0x8711('0xe')][_0x8711('0x54')](_0x8711('0x170'),[_0x2972a1,_0x52ce4c[_0x8711('0xe3')],_0x52ce4c[_0x8711('0x5f')],_0x6ded0d,_0x52ce4c[_0x8711('0x61')],_0x52ce4c['agi'],_0x52ce4c[_0x8711('0x171')],_0x52ce4c[_0x8711('0x172')],'',_0x52ce4c[_0x8711('0x173')]]);if(_0x33e279[_0x8711('0xa2')]===-0x1){return _0x33e279;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('Executed\x20command\x20%s\x20%s',_0x8711('0x170'),_0x2972a1));};AGIVertices[_0x8711('0x12')][_0x8711('0x174')]=function(_0x2afec){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2afec[_0x8711('0x37')]));var _0x276631=_0x2afec[_0x8711('0x175')]||'wav';var _0x10a124=util['format'](_0x8711('0x176'),this[_0x8711('0xe')]['uniqueid'],rs[_0x8711('0x116')](0x5));var _0x4403dd=util[_0x8711('0x52')](_0x8711('0x177'),FILES_PATH,_0x10a124,_0x276631);var _0x4a7f22=util[_0x8711('0x52')](_0x8711('0x135'),FILES_PATH,_0x10a124);this[_0x8711('0x3a')][_0x8711('0x6c')](this,_0x2afec,_0x10a124,_0x4403dd);this[_0x8711('0xe')][_0x8711('0xd9')](_0x8711('0x178'),_0x10a124);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x4a7f22,_0x276631,_0x2afec['escape_digits'],_0x2afec[_0x8711('0x61')]);return this[_0x8711('0xe')][_0x8711('0x12d')](_0x4a7f22,_0x276631,_0x2afec[_0x8711('0x179')],_0x2afec['timeout'],undefined,!![]);};AGIVertices[_0x8711('0x12')]['restapi']=function(_0x21942f){logger['info'](util[_0x8711('0x52')](_0x8711('0x17a'),_0x21942f['label']));if(!this[_0x8711('0x80')](_0x21942f[_0x8711('0x5f')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x17b'));}var _0x59e2a9=this[_0x8711('0x17c')][_0x8711('0x6c')](this,_0x21942f);logger['info'](util['format'](_0x8711('0x17d'),util[_0x8711('0x17e')](_0x59e2a9,{'showHidden':![],'depth':null})));if(!this[_0x8711('0x80')](_0x21942f[_0x8711('0xd5')])){return this[_0x8711('0xe')]['noop'](_0x8711('0x17f'));}var _0x3f9a5c=this[_0x8711('0x114')][_0x8711('0x6c')](this,_0x21942f[_0x8711('0xd5')]);if(!_0x3f9a5c){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x21942f,_0x8711('0x160'));}this[_0x8711('0xe')][_0x8711('0xd9')](util[_0x8711('0x52')]('%s_STATUS_CODE',_0x3f9a5c),_0x59e2a9['statusCode']?_0x59e2a9['statusCode']:'200');this[_0x8711('0xe')]['setVariable'](util[_0x8711('0x52')](_0x8711('0x180'),_0x3f9a5c),_0x59e2a9[_0x8711('0x71')]?_0x59e2a9[_0x8711('0x71')]:'OK');if(_0x59e2a9[_0x8711('0x66')]){try{this['saveRestApiResult'](_0x59e2a9[_0x8711('0x66')],_0x3f9a5c);}catch(_0x3a64f4){logger['error'](util[_0x8711('0x52')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3f9a5c));}}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xdc'),_0x3f9a5c));};AGIVertices[_0x8711('0x12')][_0x8711('0x181')]=function(_0x523a9a){logger['info'](util[_0x8711('0x52')](_0x8711('0x182'),_0x523a9a['label']));return this[_0x8711('0xe')][_0x8711('0x183')](_0x523a9a[_0x8711('0x184')][_0x8711('0x56')](/\s+/g,''),_0x523a9a[_0x8711('0x179')]);};AGIVertices['prototype']['saynumber']=function(_0x37b438){logger[_0x8711('0x2d')](util['format'](_0x8711('0x185'),_0x37b438['label']));return this[_0x8711('0xe')][_0x8711('0x186')](_0x37b438[_0x8711('0x62')][_0x8711('0x56')](/\s+/g,''),_0x37b438['escape_digits']);};AGIVertices[_0x8711('0x12')]['sayphonetic']=function(_0x3d57af){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x187'),_0x3d57af[_0x8711('0x37')]));return this['channel'][_0x8711('0x188')](_0x3d57af[_0x8711('0x5a')],_0x3d57af[_0x8711('0x179')]);};AGIVertices[_0x8711('0x12')][_0x8711('0x189')]=function(_0x1dcd22){logger['info'](util[_0x8711('0x52')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1dcd22[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x1dcd22[_0x8711('0x18a')])){return this['channel']['noop'](_0x8711('0x18b'));}var _0x3e750b=this[_0x8711('0x21')]['sync'](this,_0x1dcd22[_0x8711('0x18a')]);if(!_0x3e750b||!_0x3e750b[_0x8711('0x18c')]){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x1dcd22,'no\x20mail\x20account\x20found');}var _0x4c0ef7={'from':util[_0x8711('0x52')](_0x8711('0x18d'),_0x3e750b[_0x8711('0x11')],_0x3e750b[_0x8711('0x18e')]||_0x3e750b[_0x8711('0x18c')][_0x8711('0x18f')]),'to':_0x1dcd22['to']||'','cc':_0x1dcd22['cc']||'','bcc':_0x1dcd22[_0x8711('0x190')]||'','subject':_0x1dcd22['subject'],'html':_0x1dcd22['text'],'text':_0x1dcd22[_0x8711('0x5a')]};if(this['isConfigured'](_0x1dcd22[_0x8711('0x191')])){}logger[_0x8711('0xde')]('sendMail\x20message',JSON[_0x8711('0x6f')](_0x4c0ef7));this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x1dcd22,_0x1dcd22[_0x8711('0x18a')]);this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0x192'),_0x3e750b[_0x8711('0x11')]));this['sendMailMessage'][_0x8711('0x6c')](this,_0x3e750b[_0x8711('0x193')],_0x4c0ef7);return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x194'));};AGIVertices[_0x8711('0x12')][_0x8711('0x195')]=function(_0x453b57){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x453b57[_0x8711('0x37')]));return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x196'));};AGIVertices[_0x8711('0x12')][_0x8711('0x197')]=function(_0x466cff){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x466cff['label']));if(!this[_0x8711('0x80')](_0x466cff[_0x8711('0x198')])){return this[_0x8711('0xe')]['noop'](_0x8711('0x199'));}var _0x26604d=this[_0x8711('0x32')][_0x8711('0x6c')](this,_0x466cff[_0x8711('0x198')]);if(!_0x26604d){return this['channel'][_0x8711('0x2b')](_0x466cff,_0x8711('0x19a'));}var _0x253b02={'body':_0x466cff[_0x8711('0x19b')],'phone':_0x466cff['to']||'','SmsAccountId':_0x26604d['id']};logger[_0x8711('0xde')](_0x8711('0x19c'),JSON[_0x8711('0x6f')](_0x253b02));this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x466cff,_0x466cff[_0x8711('0x198')]);this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x19d'),_0x26604d['name']));this['createSmsMessage'][_0x8711('0x6c')](this,_0x253b02);return this[_0x8711('0xe')]['noop'](_0x8711('0x19e'));};AGIVertices[_0x8711('0x12')][_0x8711('0x19f')]=function(_0x1fd748){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x1fd748['label']));if(!this[_0x8711('0x80')](_0x1fd748[_0x8711('0xd5')])){return this[_0x8711('0xe')]['error'](_0x1fd748,_0x8711('0x1a0'));}var _0x59bbf5=this['getVariable']['sync'](this,_0x1fd748[_0x8711('0xd5')]);if(!_0x59bbf5){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x1fd748,_0x8711('0x160'));}return this[_0x8711('0xe')][_0x8711('0xd9')](_0x59bbf5,_0x1fd748[_0x8711('0x1a1')]);};AGIVertices[_0x8711('0x12')][_0x8711('0x1a2')]=function(_0x4a6248){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4a6248['label']));this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x1a3'));var _0x2266bd=this[_0x8711('0xe')][_0x8711('0x114')](_0x8711('0x1a4'));if(!_[_0x8711('0x42')](_0x2266bd[_0x8711('0x9f')])){this[_0x8711('0xe')][_0x8711('0x36')]=_0x2266bd[_0x8711('0x9f')];}if(_0x4a6248[_0x8711('0xb9')]===_0x8711('0x1a5')){this[_0x8711('0xe')]['noop'](_0x8711('0x1a6'));return this[_0x8711('0xe')][_0x8711('0xb9')]();}return this[_0x8711('0xe')]['noop'](_0x8711('0x1a7'));};AGIVertices[_0x8711('0x12')][_0x8711('0x1a8')]=function(_0x4a918f){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1a9'),_0x4a918f[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x4a918f[_0x8711('0x1aa')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x4a918f,_0x8711('0x1ab'));}var _0x17c8e6=this[_0x8711('0x17')][_0x8711('0x6c')](this,_0x4a918f[_0x8711('0x1aa')]);if(!this[_0x8711('0x80')](_0x17c8e6)){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x4a918f,util[_0x8711('0x52')](_0x8711('0x1ac'),_0x4a918f[_0x8711('0x1aa')]));}if(_0x17c8e6===this[_0x8711('0xe')]['arg_1']){return this['channel']['error'](_0x4a918f,_0x8711('0x1ad'));}this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x4a918f,_0x17c8e6);var _0x4f68fa=this['channel'][_0x8711('0x54')]('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x8711('0x1ae')]||_0x8711('0x1af'),_0x17c8e6,this[_0x8711('0xe')][_0x8711('0x38')]));if(_0x4f68fa[_0x8711('0xa2')]===-0x1){return _0x4f68fa;}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0xc4'),_0x8711('0x1b0'),_0x17c8e6));};AGIVertices['prototype'][_0x8711('0x1b1')]=function(_0x50ee17){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1b2'),_0x50ee17[_0x8711('0x37')]));var _0x36d840=this['shellCommand']['sync'](this,_0x50ee17[_0x8711('0xb7')]);this[_0x8711('0x35')][_0x8711('0x6c')](this,_0x50ee17,_0x50ee17[_0x8711('0xb7')]);if(this[_0x8711('0x80')](_0x50ee17['variable_id'])){var _0x59ddd3=this[_0x8711('0x114')][_0x8711('0x6c')](this,_0x50ee17[_0x8711('0xd5')]);if(_0x59ddd3){this['channel'][_0x8711('0xd9')](_0x59ddd3,_0x36d840);return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x50ee17[_0x8711('0xb7')],_0x59ddd3));}}return this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x1b3'),_0x50ee17[_0x8711('0xb7')]));};AGIVertices[_0x8711('0x12')][_0x8711('0x1b4')]=function(_0x1c33da){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1b5'),_0x1c33da[_0x8711('0x37')]));_0x1c33da[_0x8711('0x5a')]=_0x1c33da['text'][_0x8711('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8711('0x80')](_0x1c33da[_0x8711('0x58')])){return this[_0x8711('0xe')][_0x8711('0xa7')](_0x8711('0x1b6'));}if(!this['isConfigured'](_0x1c33da[_0x8711('0x5a')])){return this[_0x8711('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x1b7'),_0x1c33da[_0x8711('0x5a')]));var _0x5d7076=this['googleCloudTTS'][_0x8711('0x6c')](this,_0x1c33da);if(_0x5d7076){this[_0x8711('0xe')][_0x8711('0xa7')](util['format'](_0x8711('0x1b8'),_0x5d7076));var _0x496e53=this[_0x8711('0xe')][_0x8711('0x101')](_0x5d7076);try{fs[_0x8711('0x102')](_0x5d7076+'.wav');}catch(_0xdf08f6){logger['error'](_0xdf08f6);}return _0x496e53;}return this['channel'][_0x8711('0x2b')](_0x1c33da,_0x8711('0x1b9'));};AGIVertices['prototype']['tts']=function(_0x3b77c2){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1ba'),_0x3b77c2[_0x8711('0x37')]));_0x3b77c2[_0x8711('0x5a')]=_0x3b77c2[_0x8711('0x5a')][_0x8711('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3b77c2[_0x8711('0x5a')])){return this[_0x8711('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0x8711('0xa7')](util[_0x8711('0x52')]('Trying\x20Google\x20TTS\x20%s',_0x3b77c2[_0x8711('0x5a')]));var _0x51fddc=this[_0x8711('0x5e')][_0x8711('0x6c')](this,_0x3b77c2);if(_0x51fddc){this[_0x8711('0xe')][_0x8711('0xa7')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x51fddc));var _0x489224=this[_0x8711('0xe')][_0x8711('0x101')](_0x51fddc);try{fs[_0x8711('0x102')](_0x51fddc+'.wav');}catch(_0x159d36){logger[_0x8711('0x2b')](_0x159d36);}return _0x489224;}return this[_0x8711('0xe')][_0x8711('0x2b')](_0x3b77c2,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8711('0x12')][_0x8711('0x1bb')]=function(_0x56ade5){logger['info'](util[_0x8711('0x52')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x56ade5[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x56ade5['findBy'])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x56ade5,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x8711('0x153'),this[_0x8711('0xe')][_0x8711('0x39')],_0x56ade5[_0x8711('0x152')]));var _0xd6b397=this[_0x8711('0x4e')][_0x8711('0x6c')](this,_0x56ade5[_0x8711('0x152')]);if(_0xd6b397){logger[_0x8711('0x2d')](util[_0x8711('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8711('0xe')]['callerid'],_0x56ade5[_0x8711('0x152')]));this['channel']['noop'](util[_0x8711('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8711('0xe')][_0x8711('0x39')],_0x56ade5[_0x8711('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x155'),this[_0x8711('0xe')][_0x8711('0x39')],_0x56ade5[_0x8711('0x152')]));this[_0x8711('0xe')][_0x8711('0xa7')](util[_0x8711('0x52')](_0x8711('0x155'),this['channel'][_0x8711('0x39')],_0x56ade5[_0x8711('0x152')]));return{'code':0xc8,'result':_0x8711('0x156')};}};AGIVertices[_0x8711('0x12')][_0x8711('0x1bc')]=function(_0xfb3a20){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1bd'),_0xfb3a20[_0x8711('0x37')]));var _0x1a3f8a=this[_0x8711('0xe')][_0x8711('0x54')]('VOICEMAIL',[_0xfb3a20[_0x8711('0x1be')],_0xfb3a20[_0x8711('0x74')]]);if(_0x1a3f8a[_0x8711('0xa2')]===-0x1){return _0x1a3f8a;}return this[_0x8711('0xe')]['noop'](util[_0x8711('0x52')](_0x8711('0xc4'),_0x8711('0x1bf'),_0xfb3a20[_0x8711('0x1be')]));};AGIVertices[_0x8711('0x12')][_0x8711('0x1c0')]=function(_0x2fe85a){logger[_0x8711('0x2d')](util[_0x8711('0x52')](_0x8711('0x1c1'),_0x2fe85a[_0x8711('0x37')]));if(!this[_0x8711('0x80')](_0x2fe85a[_0x8711('0xd5')])){return this[_0x8711('0xe')][_0x8711('0x2b')](_0x2fe85a,'no\x20variable\x20selected');}var _0x5e958a=this['getVariable']['sync'](this,_0x2fe85a[_0x8711('0xd5')]);if(!_0x5e958a){return this['channel']['error'](_0x2fe85a,'no\x20variable\x20found');}var _0x2255db=this['channel'][_0x8711('0x114')](_0x5e958a);return{'code':0xc8,'result':_0x2255db[_0x8711('0x9f')]?_0x2255db[_0x8711('0x9f')]:'-'};};String[_0x8711('0x12')][_0x8711('0x9e')]=function(_0x409106,_0x2ce0dd){return this[_0x8711('0x9d')](_0x409106)[_0x8711('0x1c2')](_0x2ce0dd);};module['exports']=AGIVertices; \ No newline at end of file +var _0xf8b2=['body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','awsLex','aws_access_key_id','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceAllVariables','length','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','sync','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','SestekNDA\x20is\x20unreachable','end','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','no\x20file\x20audio\x20found','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','position','QUEUE','record','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','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','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','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','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','timeout','includes','POST','PUT','toUpperCase'];(function(_0x495470,_0x53e1b7){var _0x51c30a=function(_0x5ebae5){while(--_0x5ebae5){_0x495470['push'](_0x495470['shift']());}};_0x51c30a(++_0x53e1b7);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x331dd8,_0x15e211){_0x331dd8=_0x331dd8-0x0;var _0x56408f=_0xf8b2[_0x331dd8];return _0x56408f;};'use strict';var fs=require('fs');var util=require(_0x2f8b('0x0'));var _=require(_0x2f8b('0x1'));var sh=require(_0x2f8b('0x2'));var odbc=require(_0x2f8b('0x3'))();var rs=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var Mustache=require(_0x2f8b('0x6'));var rp=require(_0x2f8b('0x7'));var logger=require('../../config/logger')('agi');var config=require(_0x2f8b('0x8'));var scripts=require(_0x2f8b('0x9'));var FILES_PATH=_0x2f8b('0xa');var recursiveMapAttributes=[_0x2f8b('0xb'),_0x2f8b('0xc')];var verticesWithRetry=[_0x2f8b('0xd'),_0x2f8b('0xe'),_0x2f8b('0xf')];var AGIVertices=function(_0x366bac,_0x5ca31b,_0xdb9718){this[_0x2f8b('0x10')]=_0x366bac;this[_0x2f8b('0x11')]=_0x5ca31b;this['mailRpc']=_0xdb9718;};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x13')]=function(_0x13a059,_0x4b43e1){this['rpc'][_0x2f8b('0x14')](_0x13a059)[_0x2f8b('0x15')](function(_0x1e1cce){_0x4b43e1(null,_0x1e1cce?_0x1e1cce[_0x2f8b('0x16')]:![]);})[_0x2f8b('0x17')](function(_0x4cb1e0){_0x4b43e1(_0x4cb1e0);});};AGIVertices[_0x2f8b('0x12')]['getVoiceQueue']=function(_0x40c097,_0x5e9eb1){this[_0x2f8b('0x11')][_0x2f8b('0x18')](_0x40c097)[_0x2f8b('0x15')](function(_0x19d5b3){_0x5e9eb1(null,_0x19d5b3?_0x19d5b3[_0x2f8b('0x16')]:![]);})[_0x2f8b('0x17')](function(_0x532fe4){_0x5e9eb1(_0x532fe4);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x19')]=function(_0x2daba9,_0xcc7e2c){this[_0x2f8b('0x11')][_0x2f8b('0x1a')](_0x2daba9)[_0x2f8b('0x15')](function(_0x1fe74a){_0xcc7e2c(null,_0x1fe74a?_0x1fe74a[_0x2f8b('0x16')]:![]);})['catch'](function(_0x23dd63){_0xcc7e2c(_0x23dd63);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1b')]=function(_0x4b94d1,_0xdc8171){this['rpc'][_0x2f8b('0x1c')](_0x4b94d1)[_0x2f8b('0x15')](function(_0x1da005){_0xdc8171(null,_0x1da005?_0x1da005[_0x2f8b('0x1d')]:![]);})[_0x2f8b('0x17')](function(_0x5efe6e){_0xdc8171(_0x5efe6e);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1e')]=function(_0x124881,_0x17b251){this[_0x2f8b('0x11')][_0x2f8b('0x1f')](_0x124881)[_0x2f8b('0x15')](function(_0x5cb36a){_0x17b251(null,_0x5cb36a?_0x5cb36a[_0x2f8b('0x16')]:![]);})[_0x2f8b('0x17')](function(_0x3560c4){_0x17b251(_0x3560c4);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x20')]=function(_0x52edde,_0x3681b4){this[_0x2f8b('0x11')][_0x2f8b('0x21')](_0x52edde)[_0x2f8b('0x15')](function(_0x183e51){_0x3681b4(null,_0x183e51?_0x183e51[_0x2f8b('0x16')]:![]);})[_0x2f8b('0x17')](function(_0x347f5a){_0x3681b4(_0x347f5a);});};AGIVertices[_0x2f8b('0x12')]['getSound']=function(_0x1578c2,_0x4a8bce){var _0x44e667=this;this[_0x2f8b('0x11')][_0x2f8b('0x22')](_0x1578c2)[_0x2f8b('0x15')](function(_0x72b23b){_0x4a8bce(null,_0x72b23b?_0x44e667['getSoundPath'](_0x72b23b[_0x2f8b('0x23')]):![]);})['catch'](function(_0x5207a8){_0x4a8bce(_0x5207a8);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x24')]=function(_0x4aff54,_0x163dd8){this[_0x2f8b('0x11')][_0x2f8b('0x25')](_0x4aff54)[_0x2f8b('0x15')](function(_0x1fe3d0){_0x163dd8(null,_0x1fe3d0?_0x1fe3d0:![]);})[_0x2f8b('0x17')](function(_0x5b2879){_0x163dd8(_0x5b2879);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x26')]=function(_0x296eac,_0x3279dc,_0x1f886f){this[_0x2f8b('0x27')][_0x2f8b('0x26')](_0x296eac,_0x3279dc)['then'](function(){_0x1f886f(null);})[_0x2f8b('0x17')](function(_0x5593b0){_0x1f886f(_0x5593b0);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x28')]=function(_0x43dc46,_0x103b81){this[_0x2f8b('0x11')][_0x2f8b('0x29')](_0x43dc46)[_0x2f8b('0x15')](function(_0x2e9786){if(_0x2e9786){if(_0x2e9786[_0x2f8b('0x2a')]){_0x103b81(null,[_0x2e9786['interval']]);}else{_0x103b81(null,_['map'](_0x2e9786[_0x2f8b('0x2b')],_0x2f8b('0x2c')));}}else{_0x103b81(null,![]);}})[_0x2f8b('0x17')](function(_0x3f7f9c){_0x103b81(_0x3f7f9c);});};AGIVertices['prototype'][_0x2f8b('0x2d')]=function(_0x96534f){return util[_0x2f8b('0x2e')](_0x2f8b('0x2f'),FILES_PATH,_0x96534f);};AGIVertices[_0x2f8b('0x12')]['getQueryOdbc']=function(_0x56c05c,_0x179952,_0x25c805){odbc[_0x2f8b('0x30')](_0x56c05c,function(_0x410c15){if(_0x410c15){logger[_0x2f8b('0x31')](_0x2f8b('0x32'),_0x410c15);_0x25c805(_0x410c15);}else{logger[_0x2f8b('0x33')]('ODBC\x20connection\x20successfully');odbc[_0x2f8b('0x34')](_0x179952,function(_0x9aebcb,_0x4d814d){if(_0x9aebcb){logger[_0x2f8b('0x33')](_0x2f8b('0x35'),_0x179952);_0x25c805(_0x9aebcb);}else{logger[_0x2f8b('0x33')]('Query\x20executed\x20correctly\x20%s',_0x179952);odbc[_0x2f8b('0x36')](function(_0x27f30e){if(_0x27f30e){logger['error'](_0x2f8b('0x37'),_0x27f30e);}_0x25c805(null,_0x4d814d);});}});}});};AGIVertices[_0x2f8b('0x12')]['getSmsAccount']=function(_0x92b37a,_0x57576e){this[_0x2f8b('0x11')][_0x2f8b('0x38')](_0x92b37a)['then'](function(_0x9030da){_0x57576e(null,_0x9030da?_0x9030da:![]);})[_0x2f8b('0x17')](function(_0x20c642){_0x57576e(_0x20c642);});};AGIVertices['prototype'][_0x2f8b('0x39')]=function(_0x4c7d61,_0xb7c7c9){this[_0x2f8b('0x11')][_0x2f8b('0x39')](_0x4c7d61)[_0x2f8b('0x15')](function(_0x2ceda8){_0xb7c7c9(null,_0x2ceda8);})[_0x2f8b('0x17')](function(_0x1e0de5){_0xb7c7c9(_0x1e0de5);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x3a')]=function(_0x40577c,_0x45c92c,_0xb8658e){this[_0x2f8b('0x11')][_0x2f8b('0x3a')]({'uniqueid':this[_0x2f8b('0x10')][_0x2f8b('0x3b')],'node':_0x40577c[_0x2f8b('0x3c')],'application':_0x40577c[_0x2f8b('0x3d')],'data':_0x45c92c||null,'project_name':this[_0x2f8b('0x10')][_0x2f8b('0x3e')],'callerid':this[_0x2f8b('0x10')][_0x2f8b('0x3f')]})[_0x2f8b('0x15')](function(_0xca42ff){if(_0xb8658e){_0xb8658e(null,_0xca42ff);}})[_0x2f8b('0x17')](function(_0x564b81){if(_0xb8658e){_0xb8658e(_0x564b81);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x33a468,_0x4d126a,_0x2d0196,_0x13ffa0){this[_0x2f8b('0x11')]['createSquareRecording']({'uniqueid':this[_0x2f8b('0x10')]['uniqueid'],'callerid':this[_0x2f8b('0x10')]['callerid'],'calleridname':this[_0x2f8b('0x10')][_0x2f8b('0x40')],'context':this['channel'][_0x2f8b('0x41')],'extension':this[_0x2f8b('0x10')][_0x2f8b('0x42')],'priority':this[_0x2f8b('0x10')][_0x2f8b('0x43')],'accountcode':this[_0x2f8b('0x10')][_0x2f8b('0x44')],'dnid':this[_0x2f8b('0x10')][_0x2f8b('0x45')],'projectName':this['channel'][_0x2f8b('0x3e')],'saveName':_0x4d126a,'filename':_0x33a468[_0x2f8b('0x46')]||_0x4d126a,'savePath':_0x2d0196})[_0x2f8b('0x15')](function(_0x1bb257){_0x13ffa0(null,_0x1bb257);})[_0x2f8b('0x17')](function(_0x487c81){_0x13ffa0(_0x487c81);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x47')]=function(_0x45cf87,_0x53cde8,_0x12be3c,_0x4fa8d1,_0x26dfb1){this[_0x2f8b('0x11')][_0x2f8b('0x47')]({'uniqueid':this[_0x2f8b('0x10')][_0x2f8b('0x3b')],'body':_0x45cf87,'direction':_0x53cde8,'providerName':_0x12be3c,'providerResponse':_0x4fa8d1})['then'](function(_0x4c89c7){if(_0x26dfb1){_0x26dfb1(null,_0x4c89c7);}})['catch'](function(_0x33a416){if(_0x26dfb1){_0x26dfb1(_0x33a416);}});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x48')]=function(_0x128a1f,_0x49e047){this['rpc'][_0x2f8b('0x48')]({'firstName':_[_0x2f8b('0x49')](_0x128a1f[_0x2f8b('0x16')])||_[_0x2f8b('0x4a')](_0x128a1f['name'])?_0x2f8b('0x4b')+Math[_0x2f8b('0x4c')]():_0x128a1f['name'],'lastName':_[_0x2f8b('0x49')](_0x128a1f['lastName'])||_[_0x2f8b('0x4a')](_0x128a1f['lastName'])?null:_0x128a1f[_0x2f8b('0x4d')],'phone':_0x128a1f[_0x2f8b('0x4e')],'ListId':_0x128a1f[_0x2f8b('0x4f')],'scheduledat':_0x128a1f['scheduledAt'],'callbackUniqueid':this[_0x2f8b('0x10')]['uniqueid'],'tags':_0x2f8b('0x50'),'description':'Callback\x20scheduled\x20at\x20'+_0x128a1f[_0x2f8b('0x51')][_0x2f8b('0x52')](),'priority':_0x128a1f[_0x2f8b('0x53')]})[_0x2f8b('0x15')](function(_0xcdde65){_0x49e047(null,_0xcdde65);})[_0x2f8b('0x17')](function(_0x40457b){_0x49e047(_0x40457b);});};AGIVertices[_0x2f8b('0x12')]['getPause']=function(_0xc31f84,_0x2151d5){this[_0x2f8b('0x11')][_0x2f8b('0x54')](_0xc31f84)[_0x2f8b('0x15')](function(_0xdd8791){_0x2151d5(null,_0xdd8791?_0xdd8791[_0x2f8b('0x16')]:![]);})[_0x2f8b('0x17')](function(_0x2da9ba){_0x2151d5(_0x2da9ba);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x55')]=function(_0x337e53,_0x5698fa,_0x324fa2){var _0x52abb8={'role':_0x2f8b('0x56')};_0x52abb8[_0x337e53]=this[_0x2f8b('0x10')][_0x2f8b('0x3f')];this[_0x2f8b('0x11')][_0x2f8b('0x55')](_0x52abb8,_0x5698fa,this['channel'][_0x2f8b('0x3b')])[_0x2f8b('0x15')](function(_0x1facad){_0x324fa2(null,_[_0x2f8b('0x4a')](_0x1facad)?![]:!![]);})['catch'](function(_0x5dc9c6){logger[_0x2f8b('0x31')](_0x5dc9c6);_0x324fa2(null,![]);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x57')]=function(_0x34870f,_0x5441ea){var _0x19dc5f={'role':_0x2f8b('0x56')};_0x19dc5f[_0x34870f]=this['channel']['callerid'];this['rpc'][_0x2f8b('0x57')](_0x19dc5f)['then'](function(_0xd7d136){_0x5441ea(null,_[_0x2f8b('0x4a')](_0xd7d136)?![]:!![]);})[_0x2f8b('0x17')](function(_0x311658){logger[_0x2f8b('0x31')](_0x311658);_0x5441ea(null,![]);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x58')]=function(_0x16e36e,_0x526785){var _0x49a2ca={'role':_0x2f8b('0x56')};_0x49a2ca[_0x16e36e]=this[_0x2f8b('0x10')][_0x2f8b('0x3f')];this[_0x2f8b('0x11')][_0x2f8b('0x58')](_0x49a2ca)[_0x2f8b('0x15')](function(_0x189025){_0x526785(null,_[_0x2f8b('0x4a')](_0x189025)?![]:!![]);})[_0x2f8b('0x17')](function(_0x32cae9){logger['error'](_0x32cae9);_0x526785(null,![]);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x59')]=function(_0x3552ee,_0x158322){var _0x19bde5={'role':'agent'};_0x19bde5[_0x3552ee]=this[_0x2f8b('0x10')][_0x2f8b('0x3f')];var _0x4d68c0=_0x3552ee!=_0x2f8b('0x5a')?util['format']('%s/%s@from-sip/n',_0x2f8b('0x5b'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')]):undefined;this['rpc'][_0x2f8b('0x59')](_0x19bde5,_0x4d68c0)['then'](function(_0x351301){_0x158322(null,_[_0x2f8b('0x4a')](_0x351301)?![]:!![]);})[_0x2f8b('0x17')](function(_0x4df27d){logger[_0x2f8b('0x31')](_0x4df27d);_0x158322(null,![]);});};AGIVertices['prototype'][_0x2f8b('0x5c')]=function(_0xe8f67b,_0x506a62){sh[_0x2f8b('0x5d')](_[_0x2f8b('0x5e')](_0xe8f67b),function(_0x796d75,_0x5e3f87){var _0x55e699=_0x5e3f87[_0x2f8b('0x5f')](/(\r\n|\n|\r)/gm,'');_0x506a62(null,_0x55e699);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x60')]=function(_0x53f254,_0x1966fb){scripts[_0x2f8b('0x60')](_0x53f254['apiKey'],_0x53f254[_0x2f8b('0x61')]||'text',_0x53f254[_0x2f8b('0x62')],_0x53f254[_0x2f8b('0x63')]||'en-US',_0x53f254['ssmlGender']||'MALE',_0x53f254[_0x2f8b('0x64')]||_0x2f8b('0x65'))['then'](function(_0x52f8dd){_0x1966fb(null,_0x52f8dd);})['catch'](function(_0x57d6f3){_0x1966fb(_0x57d6f3);});};AGIVertices['prototype']['googleTTS']=function(_0x450163,_0xd34319){scripts[_0x2f8b('0x66')](_0x450163[_0x2f8b('0x62')],_0x450163[_0x2f8b('0x67')]||'en',0x1)['then'](function(_0x497e11){_0xd34319(null,_0x497e11);})[_0x2f8b('0x17')](function(_0x2cdc96){_0xd34319(_0x2cdc96);});};AGIVertices[_0x2f8b('0x12')]['restAPI']=function(_0x5ae32e,_0x55254b){var _0x4358e0={'uri':_0x5ae32e[_0x2f8b('0x68')],'method':_0x5ae32e[_0x2f8b('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5ae32e['timeout'])===_0x2f8b('0x6a')&&parseInt(_0x5ae32e[_0x2f8b('0x6b')])>=0x1?parseInt(_0x5ae32e[_0x2f8b('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x2f8b('0x6c')]([_0x2f8b('0x6d'),_0x2f8b('0x6e')],_0x4358e0['method'][_0x2f8b('0x6f')]())){try{_0x4358e0[_0x2f8b('0x70')]=_0x5ae32e['rawBody']?JSON[_0x2f8b('0x71')](_0x5ae32e[_0x2f8b('0xc')]):{};}catch(_0x2d3d69){logger[_0x2f8b('0x31')](_0x2f8b('0x72'),_0x2d3d69);}}try{_0x4358e0[_0x2f8b('0x73')]=_0x5ae32e[_0x2f8b('0xb')]?JSON[_0x2f8b('0x71')](_0x5ae32e['rawHeaders']):{};}catch(_0x1f0b41){logger['error'](_0x2f8b('0x74'),_0x1f0b41);}if(_0x5ae32e[_0x2f8b('0x75')]){try{var _0x5dc95e=require(_0x5ae32e[_0x2f8b('0x75')])['sync'](this,_0x4358e0);_0x4358e0[_0x2f8b('0x76')]=Mustache[_0x2f8b('0x77')](_0x5ae32e[_0x2f8b('0x68')],_0x5dc95e,{},['$$','$$']);if(_0x4358e0[_0x2f8b('0x73')]){_0x4358e0['headers']=JSON[_0x2f8b('0x71')](Mustache['render'](JSON['stringify'](_0x4358e0[_0x2f8b('0x73')]),_0x5dc95e,{},['$$','$$']));}if(_0x4358e0[_0x2f8b('0x70')]){_0x4358e0[_0x2f8b('0x70')]=JSON[_0x2f8b('0x71')](Mustache[_0x2f8b('0x77')](JSON[_0x2f8b('0x78')](_0x4358e0[_0x2f8b('0x70')]),_0x5dc95e,{},['$$','$$']));}}catch(_0x1be1f5){logger['error'](_0x2f8b('0x79'),_0x1be1f5);}}rp(_0x4358e0)[_0x2f8b('0x15')](function(_0x43a7ad){var _0x45b128={'statusCode':_0x43a7ad[_0x2f8b('0x7a')]||0xc8,'statusMessage':_0x43a7ad[_0x2f8b('0x7b')]||'OK','headers':_0x43a7ad[_0x2f8b('0x73')]||{},'body':_0x43a7ad['body']||{}};_0x55254b(null,_0x45b128);})[_0x2f8b('0x17')](function(_0x4e20df){var _0x467beb={'statusCode':_0x4e20df[_0x2f8b('0x7a')]||0x1f4,'statusMessage':_0x4e20df['message']||_0x2f8b('0x7c'),'headers':_0x4e20df[_0x2f8b('0x7d')][_0x2f8b('0x73')]||{},'body':_0x4e20df[_0x2f8b('0x7d')][_0x2f8b('0x70')]||{}};_0x55254b(null,_0x467beb);});};AGIVertices[_0x2f8b('0x12')]['googleDialogflow']=function(_0x1ba4d2,_0x55dcc1){scripts[_0x2f8b('0x7e')](this['channel']['uniqueid'],_0x1ba4d2[_0x2f8b('0x7f')],_0x1ba4d2[_0x2f8b('0x62')],_0x1ba4d2[_0x2f8b('0x80')]||'en')[_0x2f8b('0x15')](function(_0xee1eb8){_0x55dcc1(null,_0xee1eb8);})[_0x2f8b('0x17')](function(_0x3281f2){_0x55dcc1(_0x3281f2);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x81')]=function(_0x2deff8,_0x405dd9){scripts[_0x2f8b('0x81')](this[_0x2f8b('0x10')][_0x2f8b('0x3b')],_0x2deff8[_0x2f8b('0x82')],_0x2deff8['client_email'],_0x2deff8[_0x2f8b('0x83')],_0x2deff8['text'],_0x2deff8[_0x2f8b('0x84')]||'en')['then'](function(_0x2cacf8){_0x405dd9(null,_0x2cacf8);})[_0x2f8b('0x17')](function(_0x4eb5af){_0x405dd9(_0x4eb5af);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x85')]=function(_0x34fe96,_0x42aebc){scripts[_0x2f8b('0x85')](this[_0x2f8b('0x10')],_0x34fe96)[_0x2f8b('0x15')](function(_0x3403c3){_0x42aebc(null,_0x3403c3);})[_0x2f8b('0x17')](function(_0x43735d){_0x42aebc(_0x43735d);});};AGIVertices[_0x2f8b('0x12')]['ispeechTTS']=function(_0x137985,_0x3fa544){scripts[_0x2f8b('0x86')](_0x137985['key'],_0x137985[_0x2f8b('0x62')],_0x137985[_0x2f8b('0x87')]||_0x2f8b('0x88'),_0x137985[_0x2f8b('0x89')])[_0x2f8b('0x15')](function(_0x480dbf){_0x3fa544(null,_0x480dbf);})[_0x2f8b('0x17')](function(_0x1f5bd4){_0x3fa544(_0x1f5bd4);});};AGIVertices['prototype']['ispeechASR']=function(_0x5e08fc,_0x2e103c,_0x2c688a){scripts[_0x2f8b('0x8a')](_0x2e103c,_0x5e08fc[_0x2f8b('0x7f')],_0x5e08fc[_0x2f8b('0x8b')]||_0x2f8b('0x88'),this[_0x2f8b('0x8c')](_0x5e08fc[_0x2f8b('0x8d')])?_0x5e08fc[_0x2f8b('0x8d')]:undefined)[_0x2f8b('0x15')](function(_0x366662){_0x2c688a(null,_0x366662);})[_0x2f8b('0x17')](function(_0x466f20){_0x2c688a(_0x466f20);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x8e')]=function(_0xc79a7d,_0x4a5147){scripts[_0x2f8b('0x8e')](_0xc79a7d['aws_access_key_id'],_0xc79a7d['aws_secret_access_key'],_0xc79a7d[_0x2f8b('0x8f')],_0xc79a7d['aws_polly_voice']||'Amy',_0xc79a7d['text'],_0xc79a7d['aws_text_type']||'text')['then'](function(_0x498c7e){_0x4a5147(null,_0x498c7e);})[_0x2f8b('0x17')](function(_0x36362f){_0x4a5147(_0x36362f);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x90')]=function(_0x217b07,_0x181e00){scripts['awsLex'](this['channel'][_0x2f8b('0x3b')],_0x217b07[_0x2f8b('0x91')],_0x217b07[_0x2f8b('0x92')],_0x217b07['aws_lex_region'],_0x217b07[_0x2f8b('0x62')],_0x217b07[_0x2f8b('0x93')])[_0x2f8b('0x15')](function(_0x56854a){_0x181e00(null,_0x56854a);})['catch'](function(_0x417320){_0x181e00(_0x417320);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x94')]=function(_0x52ef71,_0x1fa35a,_0x5cd828){scripts['googleASR'](_0x1fa35a,_0x52ef71[_0x2f8b('0x7f')],_0x52ef71['google_asr_language']||'en-US')[_0x2f8b('0x15')](function(_0x845d40){_0x5cd828(null,_0x845d40);})['catch'](function(_0x4eb6a7){_0x5cd828(_0x4eb6a7);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x95')]=function(_0x3278f9,_0x43f156,_0x2b0e98){scripts[_0x2f8b('0x95')](_0x43f156,_0x3278f9[_0x2f8b('0x96')],_0x3278f9['appsecret'],_0x3278f9[_0x2f8b('0x76')])[_0x2f8b('0x15')](function(_0x11f101){_0x2b0e98(null,_0x11f101);})[_0x2f8b('0x17')](function(_0x4b4eb7){_0x2b0e98(_0x4b4eb7);});};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x97')]=function(_0x43874c){var _0x286774=_['includes'](verticesWithRetry,_0x43874c['agicommand'])?_0x43874c:_[_0x2f8b('0x98')](_0x43874c);for(var _0x113b8e in _0x286774){if(_0x286774[_0x2f8b('0x99')](_0x113b8e)){if(_0x286774[_0x113b8e]&&_[_0x2f8b('0x9a')](_0x286774[_0x113b8e])){if(_[_0x2f8b('0x6c')](recursiveMapAttributes,_0x113b8e)){_0x286774[_0x113b8e]=this[_0x2f8b('0x9b')](_0x286774[_0x113b8e]);}else{_0x286774[_0x113b8e]=this['replaceAllVariables'](_0x286774[_0x113b8e]);}}}}return _0x286774;};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x9c')]=function(_0x61816b){for(var _0x4ad3b0 in _0x61816b){if(_0x61816b['hasOwnProperty'](_0x4ad3b0)){if(_['isPlainObject'](_0x61816b[_0x4ad3b0])){this[_0x2f8b('0x9c')](_0x61816b[_0x4ad3b0]);}else if(_[_0x2f8b('0x9d')](_0x61816b[_0x4ad3b0])){for(var _0x1927e1=0x0;_0x1927e1<_0x61816b[_0x4ad3b0]['length'];_0x1927e1++){this[_0x2f8b('0x9c')](_0x61816b[_0x4ad3b0][_0x1927e1]);}}else if(_[_0x2f8b('0x9a')](_0x61816b[_0x4ad3b0])){_0x61816b[_0x4ad3b0]=this['replaceAllVariables'](_0x61816b[_0x4ad3b0]);}}}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x9e')]=function(_0x14e366,_0xc8bd5){for(var _0xed3685 in _0x14e366){if(_0x14e366[_0x2f8b('0x99')](_0xed3685)){if(_[_0x2f8b('0x9f')](_0x14e366[_0xed3685])){if(!_[_0x2f8b('0x49')](_0x14e366[_0xed3685])){this[_0x2f8b('0x9e')](_0x14e366[_0xed3685],util[_0x2f8b('0x2e')](_0x2f8b('0xa0'),_0xc8bd5,_0xed3685));}}else if(_[_0x2f8b('0x9d')](_0x14e366[_0xed3685])){for(var _0x5256ba=0x0;_0x5256ba<_0x14e366[_0xed3685]['length'];_0x5256ba++){this[_0x2f8b('0x9e')](_0x14e366[_0xed3685][_0x5256ba],util[_0x2f8b('0x2e')](_0x2f8b('0xa0'),_0xc8bd5,_0xed3685+'['+_0x5256ba+']'));}}else{if(!_['isNil'](_0x14e366[_0xed3685])){this['channel'][_0x2f8b('0xa1')](util['format']('%s.%s',_0xc8bd5,_0xed3685),_0x14e366[_0xed3685]);}}}}};AGIVertices[_0x2f8b('0x12')]['replaceObjectAllVariables']=function(_0x9053de){try{var _0x183011=JSON[_0x2f8b('0x71')](_0x9053de);this[_0x2f8b('0x9c')](_0x183011);return JSON[_0x2f8b('0x78')](_0x183011);}catch(_0x1c77ae){return this['replaceAllVariables'](_0x9053de);}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xa2')]=function(_0x3a3aab){var _0x57228d=_0x3a3aab['split']('{');for(var _0x3cd0b9=0x1;_0x3cd0b9<_0x57228d[_0x2f8b('0xa3')];_0x3cd0b9+=0x1){var _0x336804=_0x57228d[_0x3cd0b9][_0x2f8b('0xa4')]('}');if(_0x336804[_0x2f8b('0xa3')]>0x1){_0x3a3aab=_0x3a3aab[_0x2f8b('0xa5')]('{'+_0x336804[0x0]+'}',this[_0x2f8b('0x10')]['getVariable'](_0x336804[0x0])['extra']||_0x336804[0x0]);}}if(_0x57228d[_0x2f8b('0xa3')]===0x1){return _0x3a3aab[_0x2f8b('0x52')]();}return this[_0x2f8b('0xa2')](_0x3a3aab);};AGIVertices[_0x2f8b('0x12')]['getAndSetVariable']=function(_0x23d8e1,_0x216042){var _0x26c981=this[_0x2f8b('0x10')][_0x2f8b('0x13')](_0x23d8e1);if(_0x26c981[_0x2f8b('0xa6')]===-0x1){return _0x26c981;}logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xa7'),_0x216042,_0x26c981['extra']));return this[_0x2f8b('0x10')][_0x2f8b('0xa1')](_0x216042,_0x26c981[_0x2f8b('0xa8')]);};AGIVertices[_0x2f8b('0x12')]['isConfigured']=function(_0x50a435){return _0x50a435&&_0x50a435!=='0'&&_0x50a435!=='-1'&&_0x50a435!=='';};AGIVertices['prototype'][_0x2f8b('0xa9')]=function(_0x1f5c76){this['createSquareDetailsReport']['sync'](this,_0x1f5c76,'-');_0x1f5c76['retry']=_0x1f5c76[_0x2f8b('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xaa')]=function(_0x57444c){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0xab'),_0x57444c[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x57444c[_0x2f8b('0x62')])){return this['channel']['noop'](_0x2f8b('0xac'));}var _0x202500='\x22'+_0x57444c[_0x2f8b('0x62')]+'\x22';if(this[_0x2f8b('0x8c')](_0x57444c[_0x2f8b('0x7d')])){_0x202500+=','+_0x57444c[_0x2f8b('0x7d')];}var _0x352ff1=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xad'),_0x202500);if(_0x352ff1['result']===-0x1){return _0x352ff1;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xaf'),_0x202500));};AGIVertices[_0x2f8b('0x12')]['mrcprecog']=function(_0x27c905){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xb0'),_0x27c905[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x27c905['grammar'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20grammar\x20configured');}var _0x152a94=_0x27c905[_0x2f8b('0xb1')];if(this[_0x2f8b('0x8c')](_0x27c905['options'])){_0x152a94+=','+_0x27c905['options'];}var _0x3706be=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xb2'),_0x152a94);if(_0x3706be[_0x2f8b('0xa6')]===-0x1){return _0x3706be;}var _0x5ccf8d=this[_0x2f8b('0xb3')](_0x2f8b('0xb4'),_0x2f8b('0xb5'));if(_0x5ccf8d[_0x2f8b('0xa6')]===-0x1){return _0x5ccf8d;}var _0x1d0ec9=this[_0x2f8b('0xb3')](_0x2f8b('0xb6'),_0x2f8b('0xb7'));if(_0x1d0ec9[_0x2f8b('0xa6')]===-0x1){return _0x1d0ec9;}var _0x432715=this[_0x2f8b('0xb3')](_0x2f8b('0xb8'),_0x2f8b('0xb9'));if(_0x432715[_0x2f8b('0xa6')]===-0x1){return _0x432715;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xba'),_0x152a94));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xbb')]=function(_0x3e8709){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0xbc'),_0x3e8709['label']));return this['channel'][_0x2f8b('0xbb')]([_0x3e8709[_0x2f8b('0xbd')],_0x3e8709['args']]);};AGIVertices['prototype'][_0x2f8b('0xbe')]=function(_0xcc0d6a){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xcc0d6a[_0x2f8b('0x3c')]));if(this[_0x2f8b('0x8c')](_0xcc0d6a[_0x2f8b('0x6b')])){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xcc0d6a[_0x2f8b('0x6b')]));var _0x51e561=this[_0x2f8b('0x10')][_0x2f8b('0xbf')](_0xcc0d6a['timeout']);if(_0x51e561[_0x2f8b('0xa6')]===-0x1){return _0x51e561;}}return this[_0x2f8b('0x10')][_0x2f8b('0xbe')]();};AGIVertices[_0x2f8b('0x12')]['callback']=function(_0x2cea1d){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xc0'),_0x2cea1d[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x2cea1d[_0x2f8b('0x4f')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x2cea1d,_0x2f8b('0xc1'));}_0x2cea1d[_0x2f8b('0x51')]=moment();if(this['isConfigured'](_0x2cea1d['delay'])){_0x2cea1d[_0x2f8b('0x51')]=moment()[_0x2f8b('0xc2')](_0x2cea1d[_0x2f8b('0xc3')],_0x2f8b('0xc4'));}if(!this['isConfigured'](_0x2cea1d[_0x2f8b('0x53')])){_0x2cea1d[_0x2f8b('0x53')]=0x2;}this['createCmContact'][_0x2f8b('0xc5')](this,_0x2cea1d);return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0xc6'),_0x2cea1d[_0x2f8b('0x4e')],_0x2cea1d[_0x2f8b('0x4f')],_0x2cea1d[_0x2f8b('0x51')]));};AGIVertices[_0x2f8b('0x12')]['custom_app']=function(_0x25b64e){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0xc7'),_0x25b64e[_0x2f8b('0x3c')]));var _0x2bf139=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x25b64e[_0x2f8b('0xc8')],_0x25b64e[_0x2f8b('0x7d')]);if(_0x2bf139[_0x2f8b('0xa6')]===-0x1){return _0x2bf139;}return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0xc9'),_0x25b64e[_0x2f8b('0xc8')],_0x25b64e[_0x2f8b('0x7d')]));};AGIVertices['prototype'][_0x2f8b('0xca')]=function(_0x23a545){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xcb'),_0x23a545['label']));if(!this['isConfigured'](_0x23a545[_0x2f8b('0x62')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xac'));}var _0xfb15ad='\x22'+_0x23a545[_0x2f8b('0x62')]+'\x22';if(this[_0x2f8b('0x8c')](_0x23a545['options'])){_0xfb15ad+=','+_0x23a545[_0x2f8b('0x7d')];}var _0xefaf29=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xad'),_0xfb15ad);if(_0xefaf29[_0x2f8b('0xa6')]===-0x1){return _0xefaf29;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0xaf'),_0xfb15ad));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xcc')]=function(_0x2de5ba){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xcd'),_0x2de5ba[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x2de5ba[_0x2f8b('0x62')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xac'));}var _0x1ccf5a='\x22'+_0x2de5ba['text']+'\x22';if(this[_0x2f8b('0x8c')](_0x2de5ba[_0x2f8b('0x7d')])){_0x1ccf5a+=','+_0x2de5ba[_0x2f8b('0x7d')];}var _0x572540=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xad'),_0x1ccf5a);if(_0x572540[_0x2f8b('0xa6')]===-0x1){return _0x572540;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1ccf5a));};AGIVertices[_0x2f8b('0x12')]['lumenvoxasr']=function(_0x734356){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xce'),_0x734356[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x734356['grammar'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xcf'));}var _0x4e7f42=_0x734356[_0x2f8b('0xb1')];if(this[_0x2f8b('0x8c')](_0x734356[_0x2f8b('0x7d')])){_0x4e7f42+=','+_0x734356[_0x2f8b('0x7d')];}var _0x5c4ba4=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xb2'),_0x4e7f42);if(_0x5c4ba4['result']===-0x1){return _0x5c4ba4;}var _0x3c2ca1=this[_0x2f8b('0xb3')](_0x2f8b('0xb4'),_0x2f8b('0xd0'));if(_0x3c2ca1[_0x2f8b('0xa6')]===-0x1){return _0x3c2ca1;}var _0x2834a8=this['getAndSetVariable'](_0x2f8b('0xb6'),_0x2f8b('0xd1'));if(_0x2834a8[_0x2f8b('0xa6')]===-0x1){return _0x2834a8;}var _0x3db002=this[_0x2f8b('0xb3')]('RECOG_INSTANCE()',_0x2f8b('0xd2'));if(_0x3db002['result']===-0x1){return _0x3db002;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xba'),_0x4e7f42));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xd3')]=function(_0x592fe2){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x592fe2[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x592fe2['grammar'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xcf'));}var _0x1be33b=_0x592fe2[_0x2f8b('0xb1')];if(this[_0x2f8b('0x8c')](_0x592fe2[_0x2f8b('0x7d')])){_0x1be33b+=','+_0x592fe2[_0x2f8b('0x7d')];}var _0x3f6db0=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xb2'),_0x1be33b);if(_0x3f6db0[_0x2f8b('0xa6')]===-0x1){return _0x3f6db0;}var _0x157458=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x2f8b('0xd4'));if(_0x157458[_0x2f8b('0xa6')]===-0x1){return _0x157458;}var _0x56a895=this[_0x2f8b('0xb3')](_0x2f8b('0xb6'),_0x2f8b('0xd5'));if(_0x56a895[_0x2f8b('0xa6')]===-0x1){return _0x56a895;}var _0x421279=this['getAndSetVariable'](_0x2f8b('0xb8'),_0x2f8b('0xd6'));if(_0x421279[_0x2f8b('0xa6')]===-0x1){return _0x421279;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xba'),_0x1be33b));};AGIVertices[_0x2f8b('0x12')]['database']=function(_0xd0e0b3){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xd7'),_0xd0e0b3[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0xd0e0b3['odbc_id'])){return this[_0x2f8b('0x10')]['error'](_0xd0e0b3,_0x2f8b('0xd8'));}var _0x36466c=this[_0x2f8b('0x1b')][_0x2f8b('0xc5')](this,_0xd0e0b3[_0x2f8b('0xd9')]);if(!_0x36466c){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0xd0e0b3,_0x2f8b('0xda'));}if(!this[_0x2f8b('0x8c')](_0xd0e0b3[_0x2f8b('0x34')])){return this['channel']['error'](_0xd0e0b3,_0x2f8b('0xdb'));}var _0x1753e6=_0xd0e0b3['query'][_0x2f8b('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0xdc'),_0x1753e6));var _0x4ee21c=this[_0x2f8b('0xdd')][_0x2f8b('0xc5')](this,_0x36466c,_0x1753e6);this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0xd0e0b3,_0x1753e6);if(!this['isConfigured'](_0xd0e0b3[_0x2f8b('0xde')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xdf'));}var _0x14f964=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0xd0e0b3[_0x2f8b('0xde')]);if(!_0x14f964){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0xd0e0b3,_0x2f8b('0xe0'));}var _0x2ff883=this;_0x4ee21c[_0x2f8b('0xe1')](function(_0x44371d,_0x2330b1){Object[_0x2f8b('0xe2')](_0x44371d)['forEach'](function(_0x1be9ef){_0x2ff883[_0x2f8b('0x10')][_0x2f8b('0xa1')](util['format'](_0x2f8b('0xe3'),_0x14f964,_0x2330b1,_0x1be9ef),_0x44371d[_0x1be9ef]);});});this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util['format'](_0x2f8b('0xe4'),_0x14f964),_0x4ee21c[_0x2f8b('0xa3')]);return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format']('variable\x20%s\x20set',_0x14f964));};AGIVertices['prototype'][_0x2f8b('0xe5')]=function(_0x4fe2e1){logger[_0x2f8b('0xe6')](util[_0x2f8b('0x2e')](_0x2f8b('0xe7'),_0x4fe2e1[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x4fe2e1[_0x2f8b('0xe8')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x4fe2e1,_0x2f8b('0xe9'));}var _0x401df9=this[_0x2f8b('0x1e')]['sync'](this,_0x4fe2e1[_0x2f8b('0xe8')]);if(!_0x401df9){return this[_0x2f8b('0x10')]['error'](_0x4fe2e1,_0x2f8b('0xea'));}var _0x4cb745=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0xeb'),[util[_0x2f8b('0x2e')](_0x2f8b('0xec'),_0x401df9),_0x4fe2e1[_0x2f8b('0x6b')],_0x4fe2e1[_0x2f8b('0xed')],_0x4fe2e1[_0x2f8b('0x68')]]);if(_0x4cb745[_0x2f8b('0xa6')]===-0x1){return _0x4cb745;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0xee'),_0x2f8b('0xeb')));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xef')]=function(_0x47b0ca){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0xf0'),_0x47b0ca[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x47b0ca['key'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20key\x20configured');}if(!this[_0x2f8b('0x8c')](_0x47b0ca['text'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xac'));}this[_0x2f8b('0x10')][_0x2f8b('0xf1')]=!![];this[_0x2f8b('0x3a')](_0x47b0ca);this[_0x2f8b('0x47')](_0x47b0ca['text'],'in','','');this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xf2'),_0x47b0ca['text']));var _0x44a6e3=this[_0x2f8b('0x7e')][_0x2f8b('0xc5')](this,_0x47b0ca);if(_0x44a6e3){for(var _0x24cc9f in _0x44a6e3){if(_0x44a6e3[_0x2f8b('0x99')](_0x24cc9f)){this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')](_0x2f8b('0xf3'),_0x24cc9f[_0x2f8b('0x6f')]()),_0x44a6e3[_0x24cc9f]);}}this[_0x2f8b('0x47')](_0x44a6e3[_0x2f8b('0xf4')],'out',_0x2f8b('0xef'),'');return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xf5'),_0x44a6e3[_0x2f8b('0xf4')]));}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x47b0ca,_0x2f8b('0xf6'));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xf7')]=function(_0x5070e1){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0xf8'),_0x5070e1[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x5070e1['dialogflowV2_project_id'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20project_id\x20configured');}if(!this[_0x2f8b('0x8c')](_0x5070e1[_0x2f8b('0xf9')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xfa'));}if(!this[_0x2f8b('0x8c')](_0x5070e1[_0x2f8b('0x83')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xfb'));}if(!this[_0x2f8b('0x8c')](_0x5070e1[_0x2f8b('0x84')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xfc'));}if(!this[_0x2f8b('0x8c')](_0x5070e1['text'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xac'));}this[_0x2f8b('0x10')][_0x2f8b('0xf1')]=!![];this[_0x2f8b('0x3a')](_0x5070e1);this[_0x2f8b('0x47')](_0x5070e1[_0x2f8b('0x62')],'in','','');this['channel'][_0x2f8b('0xae')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x5070e1['text']));var _0x2ba16a=this[_0x2f8b('0x81')][_0x2f8b('0xc5')](this,_0x5070e1);if(_0x2ba16a){for(var _0x3bb01e in _0x2ba16a){if(_0x2ba16a['hasOwnProperty'](_0x3bb01e)){if(_0x3bb01e!==_0x2f8b('0xfd')){this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')](_0x2f8b('0xf3'),_0x3bb01e['toUpperCase']()),_0x2ba16a[_0x3bb01e]);}}}this['createSquareMessage'](_0x2ba16a['speech'],_0x2f8b('0xfe'),_0x2f8b('0xf7'),_0x2ba16a[_0x2f8b('0xfd')]);return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xff'),_0x2ba16a[_0x2f8b('0xf4')]));}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x5070e1,_0x2f8b('0x100'));};AGIVertices['prototype']['sesteknda']=function(_0x340d42){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x101'),_0x340d42['label']));if(!this[_0x2f8b('0x8c')](_0x340d42[_0x2f8b('0x102')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x2f8b('0x8c')](_0x340d42[_0x2f8b('0x103')])){return this['channel'][_0x2f8b('0xae')](_0x2f8b('0x104'));}if(!this[_0x2f8b('0x8c')](_0x340d42[_0x2f8b('0x105')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x106'));}if(!this['isConfigured'](_0x340d42[_0x2f8b('0x107')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20text\x20configured');}this[_0x2f8b('0x10')][_0x2f8b('0xf1')]=!![];this[_0x2f8b('0x3a')](_0x340d42);this[_0x2f8b('0x47')](_0x340d42[_0x2f8b('0x62')],'in','','');this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x108'),_0x340d42['text']));var _0x382743=this[_0x2f8b('0x85')][_0x2f8b('0xc5')](this,_0x340d42);if(_0x382743){for(var _0x198e33 in _0x382743){if(_0x382743[_0x2f8b('0x99')](_0x198e33)){this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')](_0x2f8b('0x109'),_0x198e33[_0x2f8b('0x6f')]()),_0x382743[_0x198e33]);}}this[_0x2f8b('0x47')](_0x382743[_0x2f8b('0xf4')],_0x2f8b('0xfe'),'sesteknda','');if(_0x382743[_0x2f8b('0x10a')]){this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x382743['audiofile']));var _0x4f0f85=this[_0x2f8b('0x10')]['streamFile'](_0x382743[_0x2f8b('0x10a')]);try{fs[_0x2f8b('0x10b')](_0x382743[_0x2f8b('0x10a')]+'.wav');}catch(_0x3476a0){logger['error'](_0x3476a0);}return _0x4f0f85;}else{return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('SestekNDA\x20Result\x20%s',_0x382743['speech']));}}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x340d42,_0x2f8b('0x10c'));};AGIVertices[_0x2f8b('0x12')]['end']=function(_0x5d8ae1){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20END\x20(%s)\x20block',_0x5d8ae1['label']));return this[_0x2f8b('0x10')]['noop'](_0x2f8b('0x10d'));};AGIVertices[_0x2f8b('0x12')]['ext_dial']=function(_0x25c516){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x25c516[_0x2f8b('0x3c')]));var _0x273558='';if(_0x25c516[_0x2f8b('0x10e')]){if(!this[_0x2f8b('0x8c')](_0x25c516[_0x2f8b('0x10e')])){return this['channel'][_0x2f8b('0x31')](_0x25c516,'no\x20trunk\x20selected');}else{var _0x2bac4e=parseInt(_0x25c516['trunk_id'],0xa);if(isNaN(_0x2bac4e)){_0x273558=_0x25c516[_0x2f8b('0x10e')];}else{_0x273558=this[_0x2f8b('0x20')][_0x2f8b('0xc5')](this,_0x25c516[_0x2f8b('0x10e')]);if(!_0x273558){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x25c516,_0x2f8b('0x10f'));}}}}else if(_0x25c516[_0x2f8b('0x110')]){_0x273558=_0x25c516[_0x2f8b('0x110')];}else{return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x25c516,_0x2f8b('0x111'));}var _0x32c8dd=this[_0x2f8b('0x10')][_0x2f8b('0x5d')]('DIAL',[util['format'](_0x2f8b('0x112'),_0x273558,_0x25c516[_0x2f8b('0x4e')]),_0x25c516[_0x2f8b('0x6b')],_0x25c516[_0x2f8b('0xed')],_0x25c516[_0x2f8b('0x68')]]);if(_0x32c8dd[_0x2f8b('0xa6')]===-0x1){return _0x32c8dd;}return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('Executed\x20command\x20%s',_0x2f8b('0xeb')));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x113')]=function(_0xed605c){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x114'),_0xed605c['label']));return this[_0x2f8b('0x10')]['noop'](_0x2f8b('0x113'));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xe')]=function(_0x529272){logger[_0x2f8b('0x33')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x529272[_0x2f8b('0x3c')]));if(_0x529272['retry']===0x0){return this['maxRetry'](_0x529272);}_0x529272[_0x2f8b('0x115')]-=0x1;if(!this[_0x2f8b('0x8c')](_0x529272[_0x2f8b('0x116')])){return this['channel']['error'](_0x529272,_0x2f8b('0x117'));}var _0x5d2b23=this['getSound'][_0x2f8b('0xc5')](this,_0x529272['file_id']);if(!_0x5d2b23){return this[_0x2f8b('0x10')]['error'](_0x529272,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x529272[_0x2f8b('0xde')])){return this['channel'][_0x2f8b('0x31')](_0x2f8b('0xdf'));}var _0x267bbc=this[_0x2f8b('0x10')][_0x2f8b('0x118')](_0x5d2b23,_0x529272[_0x2f8b('0x119')],_0x529272[_0x2f8b('0x11a')]);var _0x2e4597=_0x267bbc[_0x2f8b('0xa6')]?_0x267bbc[_0x2f8b('0xa6')][_0x2f8b('0x52')]():'';logger[_0x2f8b('0x33')](_0x2f8b('0x11b'),JSON['stringify'](_0x267bbc));if(_0x267bbc[_0x2f8b('0xa6')]===-0x1){this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x529272,_0x2e4597);return _0x267bbc;}else if(_0x267bbc[_0x2f8b('0xa8')]==='timeout'){_0x267bbc['result']=_0x2e4597[_0x2f8b('0xa3')]>=parseInt(_0x529272[_0x2f8b('0x11c')])?'x':'i';}else{_0x267bbc[_0x2f8b('0xa6')]=_0x2e4597[_0x2f8b('0xa3')]>=parseInt(_0x529272[_0x2f8b('0x11c')])&&_0x2e4597['length']<=parseInt(_0x529272[_0x2f8b('0x11a')])?'x':'i';}var _0x1728b3=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0x529272[_0x2f8b('0xde')]);if(!_0x1728b3){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x529272,_0x2f8b('0xe0'));}this[_0x2f8b('0x10')]['setVariable'](_0x1728b3,_0x2e4597);if(this[_0x2f8b('0x8c')](_0x529272[_0x2f8b('0x11d')])){var _0x5b67a0=parseInt(_0x529272['hiddendigitsnum'],0xa);var _0x49cdec=rs[_0x2f8b('0x11e')]({'charset':'*','length':_0x5b67a0});var _0x4b7e99=_0x2e4597[_0x2f8b('0xa3')];if(_0x4b7e99>0x0){if(_0x4b7e99>_0x5b67a0){this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x529272,_0x529272[_0x2f8b('0x11f')]===_0x2f8b('0x120')?_0x49cdec+_0x2e4597['substr'](_0x5b67a0):_0x2e4597[_0x2f8b('0x121')](0x0,_0x4b7e99-_0x5b67a0)+_0x49cdec);}else{this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x529272,rs[_0x2f8b('0x11e')]({'charset':'*','length':_0x4b7e99}));}}else{this['createSquareDetailsReport'][_0x2f8b('0xc5')](this,_0x529272,'');}}else{this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x529272,_0x2e4597);}return _0x267bbc;};AGIVertices[_0x2f8b('0x12')]['getsecretdigits']=function(_0x140bfe){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x122'),_0x140bfe['label']));return this['getdigits'](_0x140bfe);};AGIVertices[_0x2f8b('0x12')]['goal']=function(_0x3021f6){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x123'),_0x3021f6[_0x2f8b('0x3c')]));this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x3021f6,_0x3021f6['goalname']);return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x124'),_0x3021f6[_0x2f8b('0x125')]));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x126')]=function(_0x307339){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x127'),_0x307339[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x307339[_0x2f8b('0x91')])||!this[_0x2f8b('0x8c')](_0x307339[_0x2f8b('0x92')])){return this[_0x2f8b('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x2f8b('0x8c')](_0x307339['text'])){return this['channel'][_0x2f8b('0xae')]('no\x20text\x20configured');}this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('Trying\x20aws\x20Polly\x20%s',_0x307339[_0x2f8b('0x62')]));var _0x26a958=this[_0x2f8b('0x8e')][_0x2f8b('0xc5')](this,_0x307339);if(_0x26a958){this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('aws\x20Polly\x20%s\x20file\x20created',_0x26a958));var _0x5f823c=this[_0x2f8b('0x10')]['streamFile'](_0x26a958);try{fs[_0x2f8b('0x10b')](_0x26a958+_0x2f8b('0x128'));}catch(_0x11f81b){logger['error'](_0x11f81b);}return _0x5f823c;}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x307339,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x129')]=function(_0x993cdb){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x12a'),_0x993cdb['label']));if(!this[_0x2f8b('0x8c')](_0x993cdb[_0x2f8b('0x91')])||!this[_0x2f8b('0x8c')](_0x993cdb[_0x2f8b('0x92')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x993cdb[_0x2f8b('0x93')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20bot\x20name\x20configured');}if(!this[_0x2f8b('0x8c')](_0x993cdb[_0x2f8b('0x62')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20text\x20configured');}this[_0x2f8b('0x10')]['bot']=!![];this['createSquareDetailsReport'](_0x993cdb);this[_0x2f8b('0x47')](_0x993cdb[_0x2f8b('0x62')],'in','','');this[_0x2f8b('0x10')]['noop'](util['format'](_0x2f8b('0x12b'),_0x993cdb[_0x2f8b('0x62')]));var _0xbe94b1=this[_0x2f8b('0x90')]['sync'](this,_0x993cdb);if(_0xbe94b1){for(var _0x4a611e in _0xbe94b1){if(_0xbe94b1[_0x2f8b('0x99')](_0x4a611e)&&_[_0x2f8b('0x9a')](_0xbe94b1[_0x4a611e])){this['channel'][_0x2f8b('0xa1')](util['format'](_0x2f8b('0x12c'),_0x4a611e[_0x2f8b('0x6f')]()),_0xbe94b1[_0x4a611e]);}}if(_[_0x2f8b('0x4a')](_0xbe94b1[_0x2f8b('0x12d')])){return this['channel'][_0x2f8b('0xae')](_0x2f8b('0x12e'));}else{this[_0x2f8b('0x47')](_0xbe94b1[_0x2f8b('0x12d')],_0x2f8b('0xfe'),_0x2f8b('0x12f'),'');return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('Amazon\x20Lex\x20Result\x20%s',_0xbe94b1[_0x2f8b('0x12d')]));}}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x993cdb,_0x2f8b('0x130'));};AGIVertices['prototype']['googleasr']=function(_0x255899){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x131'),_0x255899['label'],_0x255899['timeout']));if(!this[_0x2f8b('0x8c')](_0x255899[_0x2f8b('0x7f')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x132'));}var _0x458e20=_0x2f8b('0x133');var _0x1b5573=util[_0x2f8b('0x2e')](_0x2f8b('0x134'),FILES_PATH,rs[_0x2f8b('0x11e')](0x4));var _0x187966=util['format'](_0x2f8b('0xa0'),_0x1b5573,_0x458e20);var _0x2715ae=!![];if(_0x255899[_0x2f8b('0x135')]==='NOBEEP'){_0x2715ae=![];}var _0x36da16=this[_0x2f8b('0x10')][_0x2f8b('0x136')](_0x1b5573,_0x458e20,_0x255899[_0x2f8b('0x137')],_0x255899[_0x2f8b('0x6b')],undefined,_0x2715ae);if(_0x36da16['result']!==-0x1){this[_0x2f8b('0x10')]['noop'](util['format']('google\x20%s\x20file\x20created',_0x187966));var _0x12c903=this[_0x2f8b('0x94')][_0x2f8b('0xc5')](this,_0x255899,_0x187966);if(_0x12c903){for(var _0x3bc73a in _0x12c903){if(_0x12c903[_0x2f8b('0x99')](_0x3bc73a)){this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')]('GOOGLE_ASR_%s',_0x3bc73a[_0x2f8b('0x6f')]()),_0x12c903[_0x3bc73a]);}}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0x138'),JSON['stringify'](_0x12c903)));}}return _0x36da16;};AGIVertices['prototype'][_0x2f8b('0x139')]=function(_0x37e283){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x13a'),_0x37e283[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x37e283[_0x2f8b('0x96')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x13b'));}if(!this[_0x2f8b('0x8c')](_0x37e283['appsecret'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x13c'));}var _0x40bfb3=_0x2f8b('0x133');var _0x2b65ec=util['format'](_0x2f8b('0x134'),FILES_PATH,rs[_0x2f8b('0x11e')](0x4));var _0x297676=util[_0x2f8b('0x2e')](_0x2f8b('0xa0'),_0x2b65ec,_0x40bfb3);var _0x5a65aa=!![];if(_0x37e283[_0x2f8b('0x135')]==='NOBEEP'){_0x5a65aa=![];}var _0xd18ed2=this[_0x2f8b('0x10')][_0x2f8b('0x136')](_0x2b65ec,_0x40bfb3,_0x37e283[_0x2f8b('0x137')],_0x37e283['timeout'],undefined,_0x5a65aa);if(_0xd18ed2['result']!==-0x1){this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format']('tilde\x20%s\x20file\x20created',_0x297676));var _0x379671=this[_0x2f8b('0x95')][_0x2f8b('0xc5')](this,_0x37e283,_0x297676);if(_0x379671){for(var _0x4766bd in _0x379671){if(_0x379671['hasOwnProperty'](_0x4766bd)){this[_0x2f8b('0x10')]['setVariable'](util[_0x2f8b('0x2e')](_0x2f8b('0x13d'),_0x4766bd[_0x2f8b('0x6f')]()),_0x379671[_0x4766bd]);}}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0x13e'),JSON[_0x2f8b('0x78')](_0x379671)));}}return _0xd18ed2;};AGIVertices['prototype']['gotoc']=function(_0x41206d){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x13f'),_0x41206d[_0x2f8b('0x3c')]));return this['channel'][_0x2f8b('0x140')](_0x41206d[_0x2f8b('0x41')],_0x41206d['extension'],_0x41206d[_0x2f8b('0x43')]);};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x141')]=function(_0x4a5181){logger['info'](util['format'](_0x2f8b('0x142'),_0x4a5181[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x4a5181['condition'])){return this['channel'][_0x2f8b('0x31')](_0x4a5181,_0x2f8b('0x143'));}try{var _0x2b062c=eval(_0x4a5181[_0x2f8b('0x144')])?_0x2f8b('0x145'):_0x2f8b('0x146');this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x147'),_0x4a5181[_0x2f8b('0x144')],_0x2b062c));return{'code':0xc8,'result':_0x2b062c};}catch(_0x302a44){return{'code':0xc8,'result':_0x2f8b('0x146')};}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x148')]=function(_0xb378bf){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x149'),_0xb378bf[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0xb378bf[_0x2f8b('0x14a')])){return this[_0x2f8b('0x10')]['error'](_0xb378bf,_0x2f8b('0x14b'));}var _0x5f04ce=this['getIntervals'][_0x2f8b('0xc5')](this,_0xb378bf['interval_id']);if(!_0x5f04ce){return this['channel']['error'](_0xb378bf,'no\x20intervals\x20found');}for(var _0x48936c=0x0;_0x48936c<_0x5f04ce['length'];_0x48936c+=0x1){var _0x482c87=this[_0x2f8b('0x10')][_0x2f8b('0x13')](util[_0x2f8b('0x2e')](_0x2f8b('0x14c'),_0x5f04ce[_0x48936c]));if(_0x482c87[_0x2f8b('0xa6')]===-0x1){return _0x482c87;}logger['info'](util[_0x2f8b('0x2e')]('IFTIME\x20%s\x20%s',_0x5f04ce[_0x48936c],_0x482c87[_0x2f8b('0xa8')]));if(_0x482c87[_0x2f8b('0xa8')]===_0x2f8b('0x145')){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('IFTIME\x20%s\x20%s',_0x5f04ce[_0x48936c],_0x2f8b('0x145')));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x14d'),_0x5f04ce[_0x48936c],_0x2f8b('0x145')));return{'code':0xc8,'result':_0x2f8b('0x145')};}else{logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x14d'),_0x5f04ce[_0x48936c],_0x2f8b('0x146')));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')]('IFTIME\x20%s\x20%s',_0x5f04ce[_0x48936c],_0x2f8b('0x146')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x14e')]=function(_0x22616b){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x14f'),_0x22616b[_0x2f8b('0x3c')]));return this[_0x2f8b('0x10')][_0x2f8b('0x14e')]();};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x150')]=function(_0x445f61){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x151'),_0x445f61[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x445f61[_0x2f8b('0x7f')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')]('no\x20key\x20configured');}var _0x3e04c6=_0x2f8b('0x133');var _0xc598d9=util[_0x2f8b('0x2e')](_0x2f8b('0x134'),FILES_PATH,rs[_0x2f8b('0x11e')](0x4));var _0x179f5b=util['format'](_0x2f8b('0xa0'),_0xc598d9,_0x3e04c6);var _0x324144=!![];if(_0x445f61[_0x2f8b('0x135')]==='NOBEEP'){_0x324144=![];}var _0x4c752f=this[_0x2f8b('0x10')][_0x2f8b('0x136')](_0xc598d9,_0x3e04c6,_0x445f61['intKey'],_0x445f61[_0x2f8b('0x6b')],undefined,_0x324144);if(_0x4c752f['result']!==-0x1){this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x152'),_0x179f5b));var _0x1d90a4=this[_0x2f8b('0x8a')][_0x2f8b('0xc5')](this,_0x445f61,_0x179f5b);if(_0x1d90a4){for(var _0x286786 in _0x1d90a4){if(_0x1d90a4[_0x2f8b('0x99')](_0x286786)){this['channel'][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')](_0x2f8b('0x153'),_0x286786[_0x2f8b('0x6f')]()),_0x1d90a4[_0x286786]);}}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x154'),JSON[_0x2f8b('0x78')](_0x1d90a4)));}}return _0x4c752f;};AGIVertices['prototype'][_0x2f8b('0x155')]=function(_0x1546c9){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x156'),_0x1546c9[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x1546c9[_0x2f8b('0x7f')])){return this[_0x2f8b('0x10')]['noop'](_0x2f8b('0x132'));}if(!this[_0x2f8b('0x8c')](_0x1546c9['text'])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xac'));}this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x157'),_0x1546c9[_0x2f8b('0x62')]));var _0x25e927=this[_0x2f8b('0x86')]['sync'](this,_0x1546c9);if(_0x25e927){this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x152'),_0x25e927));var _0x9d5a53=this[_0x2f8b('0x10')][_0x2f8b('0x158')](_0x25e927,_0x1546c9[_0x2f8b('0x137')]);try{fs['unlink'](_0x25e927+_0x2f8b('0x128'));}catch(_0x5c2af6){logger[_0x2f8b('0x31')](_0x5c2af6);}return _0x9d5a53;}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x1546c9,_0x2f8b('0x159'));};AGIVertices['prototype']['login']=function(_0x4ebcff){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x15a'),_0x4ebcff[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x4ebcff['findBy'])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x4ebcff,'no\x20find\x20by\x20configured');}logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x15b'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x4ebcff[_0x2f8b('0x15c')]));var _0x3929c6=this[_0x2f8b('0x59')]['sync'](this,_0x4ebcff[_0x2f8b('0x15c')]);if(_0x3929c6){logger['info'](util[_0x2f8b('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x2f8b('0x3f')],_0x4ebcff[_0x2f8b('0x15c')]));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0x15d'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x4ebcff['findBy']));return{'code':0xc8,'result':_0x2f8b('0x15e')};}else{logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x15f'),this[_0x2f8b('0x10')]['callerid'],_0x4ebcff[_0x2f8b('0x15c')]));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x15f'),this['channel'][_0x2f8b('0x3f')],_0x4ebcff['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x160')]=function(_0x52e697){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x161'),_0x52e697[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x52e697[_0x2f8b('0x15c')])){return this[_0x2f8b('0x10')]['error'](_0x52e697,'no\x20find\x20by\x20configured');}logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x15b'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x52e697[_0x2f8b('0x15c')]));var _0x536238=this['agentLogout'][_0x2f8b('0xc5')](this,_0x52e697[_0x2f8b('0x15c')]);if(_0x536238){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x15d'),this[_0x2f8b('0x10')]['callerid'],_0x52e697[_0x2f8b('0x15c')]));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x15d'),this['channel']['callerid'],_0x52e697[_0x2f8b('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x15f'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x52e697['findBy']));this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x52e697['findBy']));return{'code':0xc8,'result':_0x2f8b('0x162')};}};AGIVertices[_0x2f8b('0x12')]['math']=function(_0x554515){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x163'),_0x554515[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x554515['operation'])){return this[_0x2f8b('0x10')]['error'](_0x554515,_0x2f8b('0x164'));}this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x165'),_0x554515['operation']));var _0x35c156=eval(_0x554515[_0x2f8b('0x166')]);if(!this[_0x2f8b('0x8c')](_0x554515[_0x2f8b('0xde')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xdf'));}var _0x4ed1ed=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0x554515[_0x2f8b('0xde')]);if(!_0x4ed1ed){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x554515,'no\x20variable\x20found');}if(_[_0x2f8b('0x9d')](_0x35c156)){var _0x16bf8c=this;_0x35c156[_0x2f8b('0xe1')](function(_0x4900e2,_0x50ef30){_0x16bf8c[_0x2f8b('0x10')][_0x2f8b('0xa1')](util['format'](_0x2f8b('0x167'),_0x4ed1ed,_0x50ef30),_0x4900e2);});return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format']('variable\x20%s[key]\x20set',_0x4ed1ed));}else{return this[_0x2f8b('0x10')]['setVariable'](_0x4ed1ed,_0x35c156);}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xd')]=function(_0x51197f){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x168'),_0x51197f['label']));if(_0x51197f[_0x2f8b('0x115')]===0x0){return this[_0x2f8b('0xa9')](_0x51197f);}_0x51197f['retry']-=0x1;if(!this[_0x2f8b('0x8c')](_0x51197f[_0x2f8b('0x116')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x51197f,_0x2f8b('0x117'));}var _0x154ec3=this[_0x2f8b('0x169')][_0x2f8b('0xc5')](this,_0x51197f[_0x2f8b('0x116')]);if(!_0x154ec3){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x51197f,_0x2f8b('0x16a'));}var _0x16c41e=this['channel'][_0x2f8b('0x118')](_0x154ec3,_0x51197f[_0x2f8b('0x119')],_0x51197f['digit']);var _0x34317e=_0x16c41e[_0x2f8b('0xa6')];if(_0x16c41e[_0x2f8b('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x2f8b('0xc5')](this,_0x51197f,'-1');return _0x16c41e;}else if(_0x16c41e['extra']===_0x2f8b('0x6b')){_0x16c41e[_0x2f8b('0xa6')]=_0x16c41e[_0x2f8b('0xa6')][_0x2f8b('0xa3')]>0x0?_0x16c41e[_0x2f8b('0xa6')]:'t';}else if(_[_0x2f8b('0x49')](_0x16c41e[_0x2f8b('0xa6')])){_0x16c41e[_0x2f8b('0xa6')]='#';_0x34317e='#';}if(!this['isConfigured'](_0x51197f[_0x2f8b('0xde')])){this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0xdf'));}else{var _0x2a2c80=this[_0x2f8b('0x13')]['sync'](this,_0x51197f[_0x2f8b('0xde')]);if(!_0x2a2c80){return this[_0x2f8b('0x10')]['error'](_0x51197f,'no\x20variable\x20found');}this['channel'][_0x2f8b('0xa1')](_0x2a2c80,_0x34317e);}this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x51197f,_0x34317e);return _0x16c41e;};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0xae')]=function(_0x2e1edb){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2e1edb[_0x2f8b('0x3c')]));return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2e1edb[_0x2f8b('0x16b')]||_0x2e1edb[_0x2f8b('0x3c')]);};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x16c')]=function(_0x3196e0){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x16d'),_0x3196e0[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x3196e0[_0x2f8b('0x15c')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x3196e0,_0x2f8b('0x16e'));}logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x15b'),this['channel'][_0x2f8b('0x3f')],_0x3196e0[_0x2f8b('0x15c')]));var _0x163bc9=this[_0x2f8b('0x16f')][_0x2f8b('0xc5')](this,_0x3196e0[_0x2f8b('0x170')]);var _0x5b93f7=this['agentPause'][_0x2f8b('0xc5')](this,_0x3196e0[_0x2f8b('0x15c')],_0x163bc9);if(_0x5b93f7){logger[_0x2f8b('0x33')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x3196e0[_0x2f8b('0x15c')]));this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x3196e0[_0x2f8b('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x15f'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x3196e0[_0x2f8b('0x15c')]));this['channel']['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x15d'),this['channel'][_0x2f8b('0x3f')],_0x3196e0['findBy']));return{'code':0xc8,'result':_0x2f8b('0x162')};}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x171')]=function(_0x3f1556){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x172'),_0x3f1556['label']));if(!this['isConfigured'](_0x3f1556[_0x2f8b('0x116')])){return this[_0x2f8b('0x10')]['error'](_0x3f1556,'no\x20file\x20audio\x20selected');}var _0x561a55=this[_0x2f8b('0x169')][_0x2f8b('0xc5')](this,_0x3f1556[_0x2f8b('0x116')]);if(!_0x561a55){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x3f1556,_0x2f8b('0x16a'));}var _0x250e25=this[_0x2f8b('0x10')]['exec'](_0x2f8b('0x173'),[_0x561a55,_0x3f1556['opts']]);if(_0x250e25[_0x2f8b('0xa6')]===-0x1){return _0x250e25;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xc9'),_0x2f8b('0x173'),_0x561a55));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x174')]=function(_0x28c4c0){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x175'),_0x28c4c0[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x28c4c0[_0x2f8b('0x176')])){return this['channel']['error'](_0x28c4c0,'no\x20queue\x20selected');}var _0x43776b='';var _0x1c0bdf=parseInt(_0x28c4c0[_0x2f8b('0x176')],0xa);if(isNaN(_0x1c0bdf)){_0x43776b=_0x28c4c0[_0x2f8b('0x176')];}else{_0x43776b=this[_0x2f8b('0x177')][_0x2f8b('0xc5')](this,_0x28c4c0[_0x2f8b('0x176')]);if(!_0x43776b){return this[_0x2f8b('0x10')]['error'](_0x28c4c0,_0x2f8b('0x178'));}}var _0x377264='';if(this['isConfigured'](_0x28c4c0[_0x2f8b('0x116')])){var _0x503f66=this['getSound'][_0x2f8b('0xc5')](this,_0x28c4c0['file_id']);if(_0x503f66){_0x377264=_0x503f66;}}this['createSquareDetailsReport']['sync'](this,_0x28c4c0,_0x43776b);if(_0x28c4c0[_0x2f8b('0xed')]['indexOf']('x')<0x0){_0x28c4c0[_0x2f8b('0xed')]+='x';}if(_0x28c4c0['opts'][_0x2f8b('0x179')]('X')<0x0){_0x28c4c0[_0x2f8b('0xed')]+='X';}this[_0x2f8b('0x10')]['setVariable'](_0x2f8b('0x17a'),_0x43776b?_0x43776b['toLowerCase']():'');var _0x524073=this[_0x2f8b('0x10')][_0x2f8b('0x5d')]('QUEUE',[_0x43776b,_0x28c4c0['opts'],_0x28c4c0[_0x2f8b('0x68')],_0x377264,_0x28c4c0[_0x2f8b('0x6b')],_0x28c4c0[_0x2f8b('0xbb')],_0x28c4c0['macro'],_0x28c4c0[_0x2f8b('0x17b')],'',_0x28c4c0[_0x2f8b('0x17c')]]);if(_0x524073[_0x2f8b('0xa6')]===-0x1){return _0x524073;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0xc9'),_0x2f8b('0x17d'),_0x43776b));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x17e')]=function(_0x225334){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x225334[_0x2f8b('0x3c')]));var _0xf58755=_0x225334['recordingFormat']||_0x2f8b('0x133');var _0x3f2bf7=util[_0x2f8b('0x2e')]('%s_%s',this[_0x2f8b('0x10')][_0x2f8b('0x3b')],rs[_0x2f8b('0x11e')](0x5));var _0x89ff70=util[_0x2f8b('0x2e')](_0x2f8b('0x17f'),FILES_PATH,_0x3f2bf7,_0xf58755);var _0x17ce9e=util[_0x2f8b('0x2e')]('%s/recordings/%s',FILES_PATH,_0x3f2bf7);this[_0x2f8b('0x180')][_0x2f8b('0xc5')](this,_0x225334,_0x3f2bf7,_0x89ff70);this[_0x2f8b('0x10')][_0x2f8b('0xa1')](_0x2f8b('0x181'),_0x3f2bf7);logger[_0x2f8b('0x33')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x17ce9e,_0xf58755,_0x225334[_0x2f8b('0x182')],_0x225334[_0x2f8b('0x6b')]);return this[_0x2f8b('0x10')][_0x2f8b('0x136')](_0x17ce9e,_0xf58755,_0x225334[_0x2f8b('0x182')],_0x225334[_0x2f8b('0x6b')],undefined,!![]);};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x183')]=function(_0x416f75){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x184'),_0x416f75[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x416f75[_0x2f8b('0x68')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x185'));}var _0x35e470=this['restAPI'][_0x2f8b('0xc5')](this,_0x416f75);logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x186'),util['inspect'](_0x35e470,{'showHidden':![],'depth':null})));if(!this[_0x2f8b('0x8c')](_0x416f75[_0x2f8b('0xde')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x187'));}var _0x1ae667=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0x416f75['variable_id']);if(!_0x1ae667){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x416f75,_0x2f8b('0xe0'));}this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util['format'](_0x2f8b('0x188'),_0x1ae667),_0x35e470[_0x2f8b('0x7a')]?_0x35e470[_0x2f8b('0x7a')]:_0x2f8b('0x189'));this[_0x2f8b('0x10')][_0x2f8b('0xa1')](util[_0x2f8b('0x2e')]('%s_STATUS_MESSAGE',_0x1ae667),_0x35e470[_0x2f8b('0x7b')]?_0x35e470[_0x2f8b('0x7b')]:'OK');if(_0x35e470[_0x2f8b('0x70')]){try{this['saveRestApiResult'](_0x35e470[_0x2f8b('0x70')],_0x1ae667);}catch(_0x21ed1e){logger[_0x2f8b('0x31')](util['format'](_0x2f8b('0x18a'),_0x1ae667));}}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x18b'),_0x1ae667));};AGIVertices[_0x2f8b('0x12')]['saydigits']=function(_0x1112a6){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x18c'),_0x1112a6['label']));return this['channel'][_0x2f8b('0x18d')](_0x1112a6[_0x2f8b('0x18e')][_0x2f8b('0x5f')](/\s+/g,''),_0x1112a6[_0x2f8b('0x182')]);};AGIVertices['prototype']['saynumber']=function(_0x66a5bd){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x18f'),_0x66a5bd[_0x2f8b('0x3c')]));return this[_0x2f8b('0x10')]['sayNumber'](_0x66a5bd[_0x2f8b('0x6a')][_0x2f8b('0x5f')](/\s+/g,''),_0x66a5bd[_0x2f8b('0x182')]);};AGIVertices['prototype'][_0x2f8b('0x190')]=function(_0x1607c){logger[_0x2f8b('0x33')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1607c[_0x2f8b('0x3c')]));return this[_0x2f8b('0x10')][_0x2f8b('0x191')](_0x1607c[_0x2f8b('0x62')],_0x1607c[_0x2f8b('0x182')]);};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x192')]=function(_0x35f4cb){logger['info'](util[_0x2f8b('0x2e')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x35f4cb[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x35f4cb[_0x2f8b('0x193')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x194'));}var _0x59a56f=this[_0x2f8b('0x24')][_0x2f8b('0xc5')](this,_0x35f4cb[_0x2f8b('0x193')]);if(!_0x59a56f||!_0x59a56f['Smtp']){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x35f4cb,_0x2f8b('0x195'));}var _0x515006={'from':util[_0x2f8b('0x2e')]('\x22%s\x22\x20<%s>',_0x59a56f['name'],_0x59a56f[_0x2f8b('0x196')]||_0x59a56f['Smtp'][_0x2f8b('0x197')]),'to':_0x35f4cb['to']||'','cc':_0x35f4cb['cc']||'','bcc':_0x35f4cb['bcc']||'','subject':_0x35f4cb[_0x2f8b('0x198')],'html':_0x35f4cb[_0x2f8b('0x62')],'text':_0x35f4cb[_0x2f8b('0x62')]};if(this[_0x2f8b('0x8c')](_0x35f4cb[_0x2f8b('0x199')])){}logger[_0x2f8b('0xe6')](_0x2f8b('0x19a'),JSON[_0x2f8b('0x78')](_0x515006));this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x35f4cb,_0x35f4cb['account_id']);this['channel'][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x19b'),_0x59a56f['name']));this['sendMailMessage'][_0x2f8b('0xc5')](this,_0x59a56f[_0x2f8b('0x19c')],_0x515006);return this['channel'][_0x2f8b('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x19d')]=function(_0x4f32c3){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x19e'),_0x4f32c3[_0x2f8b('0x3c')]));return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x19f'));};AGIVertices['prototype'][_0x2f8b('0x1a0')]=function(_0x26f719){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x1a1'),_0x26f719[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x26f719[_0x2f8b('0x1a2')])){return this[_0x2f8b('0x10')]['noop'](_0x2f8b('0x1a3'));}var _0x30d7fb=this[_0x2f8b('0x1a4')][_0x2f8b('0xc5')](this,_0x26f719[_0x2f8b('0x1a2')]);if(!_0x30d7fb){return this['channel'][_0x2f8b('0x31')](_0x26f719,_0x2f8b('0x1a5'));}var _0x5a93c3={'body':_0x26f719[_0x2f8b('0x1a6')],'phone':_0x26f719['to']||'','SmsAccountId':_0x30d7fb['id']};logger[_0x2f8b('0xe6')]('sendSMS\x20message',JSON[_0x2f8b('0x78')](_0x5a93c3));this['createSquareDetailsReport'][_0x2f8b('0xc5')](this,_0x26f719,_0x26f719[_0x2f8b('0x1a2')]);this['channel'][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x1a7'),_0x30d7fb[_0x2f8b('0x16')]));this[_0x2f8b('0x39')][_0x2f8b('0xc5')](this,_0x5a93c3);return this['channel'][_0x2f8b('0xae')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1a8')]=function(_0x538c57){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x1a9'),_0x538c57[_0x2f8b('0x3c')]));if(!this['isConfigured'](_0x538c57[_0x2f8b('0xde')])){return this['channel'][_0x2f8b('0x31')](_0x538c57,_0x2f8b('0x1aa'));}var _0x17ab65=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0x538c57[_0x2f8b('0xde')]);if(!_0x17ab65){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x538c57,_0x2f8b('0xe0'));}return this['channel']['setVariable'](_0x17ab65,_0x538c57['variable_value']);};AGIVertices[_0x2f8b('0x12')]['start']=function(_0x570c33){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x1ab'),_0x570c33[_0x2f8b('0x3c')]));this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x1ac'));var _0x4727ce=this[_0x2f8b('0x10')][_0x2f8b('0x13')](_0x2f8b('0x1ad'));if(!_[_0x2f8b('0x49')](_0x4727ce[_0x2f8b('0xa8')])){this[_0x2f8b('0x10')][_0x2f8b('0x3b')]=_0x4727ce['extra'];}if(_0x570c33[_0x2f8b('0xbe')]==='yes'){this['channel'][_0x2f8b('0xae')]('Answer');return this[_0x2f8b('0x10')][_0x2f8b('0xbe')]();}return this['channel'][_0x2f8b('0xae')](_0x2f8b('0x1ae'));};AGIVertices[_0x2f8b('0x12')]['subproject']=function(_0x28008b){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x1af'),_0x28008b[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x28008b[_0x2f8b('0x1b0')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x28008b,_0x2f8b('0x1b1'));}var _0x4e3f62=this[_0x2f8b('0x19')][_0x2f8b('0xc5')](this,_0x28008b[_0x2f8b('0x1b0')]);if(!this[_0x2f8b('0x8c')](_0x4e3f62)){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x28008b,util[_0x2f8b('0x2e')](_0x2f8b('0x1b2'),_0x28008b['project_id']));}if(_0x4e3f62===this[_0x2f8b('0x10')][_0x2f8b('0x3e')]){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x28008b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x2f8b('0x3a')][_0x2f8b('0xc5')](this,_0x28008b,_0x4e3f62);var _0x5a198a=this[_0x2f8b('0x10')][_0x2f8b('0x5d')](_0x2f8b('0x1b3'),util[_0x2f8b('0x2e')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2f8b('0xbb')][_0x2f8b('0x1b4')]||_0x2f8b('0x1b5'),_0x4e3f62,this[_0x2f8b('0x10')][_0x2f8b('0x3e')]));if(_0x5a198a[_0x2f8b('0xa6')]===-0x1){return _0x5a198a;}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')]('Executed\x20command\x20%s\x20%s','AGI',_0x4e3f62));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1b6')]=function(_0x413e7c){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x413e7c['label']));var _0x33c6a9=this[_0x2f8b('0x5c')]['sync'](this,_0x413e7c[_0x2f8b('0xbd')]);this[_0x2f8b('0x3a')]['sync'](this,_0x413e7c,_0x413e7c[_0x2f8b('0xbd')]);if(this[_0x2f8b('0x8c')](_0x413e7c[_0x2f8b('0xde')])){var _0x299228=this[_0x2f8b('0x13')][_0x2f8b('0xc5')](this,_0x413e7c[_0x2f8b('0xde')]);if(_0x299228){this[_0x2f8b('0x10')][_0x2f8b('0xa1')](_0x299228,_0x33c6a9);return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x1b7'),_0x413e7c[_0x2f8b('0xbd')],_0x299228));}}return this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0x1b8'),_0x413e7c[_0x2f8b('0xbd')]));};AGIVertices['prototype'][_0x2f8b('0x1b9')]=function(_0x2cb8e7){logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x1ba'),_0x2cb8e7[_0x2f8b('0x3c')]));_0x2cb8e7['text']=_0x2cb8e7[_0x2f8b('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2f8b('0x8c')](_0x2cb8e7[_0x2f8b('0x1bb')])){return this[_0x2f8b('0x10')][_0x2f8b('0xae')](_0x2f8b('0x1bc'));}if(!this[_0x2f8b('0x8c')](_0x2cb8e7[_0x2f8b('0x62')])){return this['channel'][_0x2f8b('0xae')](_0x2f8b('0xac'));}this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x1bd'),_0x2cb8e7[_0x2f8b('0x62')]));var _0x5b19ec=this[_0x2f8b('0x60')]['sync'](this,_0x2cb8e7);if(_0x5b19ec){this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0x1be'),_0x5b19ec));var _0x333362=this[_0x2f8b('0x10')][_0x2f8b('0x158')](_0x5b19ec);try{fs[_0x2f8b('0x10b')](_0x5b19ec+_0x2f8b('0x128'));}catch(_0x471263){logger[_0x2f8b('0x31')](_0x471263);}return _0x333362;}return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x2cb8e7,_0x2f8b('0x1bf'));};AGIVertices['prototype']['tts']=function(_0x21bb79){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x1c0'),_0x21bb79[_0x2f8b('0x3c')]));_0x21bb79['text']=_0x21bb79[_0x2f8b('0x62')][_0x2f8b('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2f8b('0x8c')](_0x21bb79[_0x2f8b('0x62')])){return this['channel'][_0x2f8b('0xae')](_0x2f8b('0xac'));}this[_0x2f8b('0x10')][_0x2f8b('0xae')](util['format'](_0x2f8b('0x1c1'),_0x21bb79[_0x2f8b('0x62')]));var _0x49bcfd=this[_0x2f8b('0x66')][_0x2f8b('0xc5')](this,_0x21bb79);if(_0x49bcfd){this[_0x2f8b('0x10')][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x1c2'),_0x49bcfd));var _0x119c54=this[_0x2f8b('0x10')][_0x2f8b('0x158')](_0x49bcfd);try{fs['unlink'](_0x49bcfd+'.wav');}catch(_0x477641){logger['error'](_0x477641);}return _0x119c54;}return this[_0x2f8b('0x10')]['error'](_0x21bb79,_0x2f8b('0x1c3'));};AGIVertices['prototype'][_0x2f8b('0x1c4')]=function(_0x38f9a6){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x1c5'),_0x38f9a6['label']));if(!this[_0x2f8b('0x8c')](_0x38f9a6[_0x2f8b('0x15c')])){return this[_0x2f8b('0x10')][_0x2f8b('0x31')](_0x38f9a6,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x2f8b('0x15b'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x38f9a6[_0x2f8b('0x15c')]));var _0x15b05e=this['agentUnpause'][_0x2f8b('0xc5')](this,_0x38f9a6[_0x2f8b('0x15c')]);if(_0x15b05e){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x15d'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x38f9a6[_0x2f8b('0x15c')]));this['channel'][_0x2f8b('0xae')](util[_0x2f8b('0x2e')](_0x2f8b('0x15d'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x38f9a6['findBy']));return{'code':0xc8,'result':_0x2f8b('0x15e')};}else{logger['info'](util[_0x2f8b('0x2e')](_0x2f8b('0x15f'),this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x38f9a6[_0x2f8b('0x15c')]));this['channel'][_0x2f8b('0xae')](util[_0x2f8b('0x2e')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2f8b('0x10')][_0x2f8b('0x3f')],_0x38f9a6[_0x2f8b('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1c6')]=function(_0x53fd7d){logger[_0x2f8b('0x33')](util[_0x2f8b('0x2e')](_0x2f8b('0x1c7'),_0x53fd7d[_0x2f8b('0x3c')]));var _0x13df72=this[_0x2f8b('0x10')]['exec'](_0x2f8b('0x1c8'),[_0x53fd7d[_0x2f8b('0x1c9')],_0x53fd7d[_0x2f8b('0x7d')]]);if(_0x13df72[_0x2f8b('0xa6')]===-0x1){return _0x13df72;}return this[_0x2f8b('0x10')]['noop'](util[_0x2f8b('0x2e')](_0x2f8b('0xc9'),'VOICEMAIL',_0x53fd7d[_0x2f8b('0x1c9')]));};AGIVertices[_0x2f8b('0x12')][_0x2f8b('0x1ca')]=function(_0x5dcc8d){logger[_0x2f8b('0x33')](util['format'](_0x2f8b('0x1cb'),_0x5dcc8d[_0x2f8b('0x3c')]));if(!this[_0x2f8b('0x8c')](_0x5dcc8d[_0x2f8b('0xde')])){return this['channel'][_0x2f8b('0x31')](_0x5dcc8d,_0x2f8b('0x1aa'));}var _0x90395b=this['getVariable']['sync'](this,_0x5dcc8d['variable_id']);if(!_0x90395b){return this['channel'][_0x2f8b('0x31')](_0x5dcc8d,_0x2f8b('0xe0'));}var _0x38ee1c=this[_0x2f8b('0x10')][_0x2f8b('0x13')](_0x90395b);return{'code':0xc8,'result':_0x38ee1c[_0x2f8b('0xa8')]?_0x38ee1c['extra']:'-'};};String[_0x2f8b('0x12')][_0x2f8b('0xa5')]=function(_0x4457f0,_0x120fd7){return this['split'](_0x4457f0)[_0x2f8b('0x1cc')](_0x120fd7);};module[_0x2f8b('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 f949d65..14c74f2 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 _0x524e=['[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','message','syncAgentConnect','mandatoryDisposition','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid'];(function(_0x5219ca,_0x10b9f5){var _0x50c2e4=function(_0x491d7d){while(--_0x491d7d){_0x5219ca['push'](_0x5219ca['shift']());}};_0x50c2e4(++_0x10b9f5);}(_0x524e,0x15e));var _0xe524=function(_0x5a7ca3,_0x3e281c){_0x5a7ca3=_0x5a7ca3-0x0;var _0x42a61e=_0x524e[_0x5a7ca3];return _0x42a61e;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0xe524('0x0'));var logger=require(_0xe524('0x1'))(_0xe524('0x2'));var RpcUser=require(_0xe524('0x3'));var RpcVoiceAgentReport=require(_0xe524('0x4'));function Acw(_0x379eb1){this[_0xe524('0x5')]=_0x379eb1[_0xe524('0x5')];this[_0xe524('0x6')]=_0x379eb1[_0xe524('0x6')];this['timers']=_0x379eb1[_0xe524('0x7')];this[_0xe524('0x8')]={};ami['on'](_0xe524('0x9'),this['syncAgentConnect'][_0xe524('0xa')](this));ami['on'](_0xe524('0xb'),this[_0xe524('0xc')][_0xe524('0xa')](this));ami['on'](_0xe524('0xd'),this[_0xe524('0xe')][_0xe524('0xa')](this));ami['on'](_0xe524('0xf'),this[_0xe524('0x10')][_0xe524('0xa')](this));ami['on'](_0xe524('0x11'),this[_0xe524('0x12')][_0xe524('0xa')](this));ami['on'](_0xe524('0x13'),this[_0xe524('0x14')][_0xe524('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xe524('0xa')](this));}function getDiff(_0x1541d8){var _0x11adbc=moment()[_0xe524('0x15')](0x0);var _0x20a852=moment(_0x1541d8)['milliseconds'](0x0);return _0x11adbc[_0xe524('0x16')](_0x20a852,'seconds');}Acw[_0xe524('0x17')][_0xe524('0x18')]=function(_0x48165e,_0x569660){var _0x488fce=this;var _0x109795=getDiff(_0x488fce['timers'][_0x48165e][_0xe524('0x19')]);clearTimeout(_0x488fce['timers'][_0x48165e]['timer']);_0x488fce['timers'][_0x48165e][_0xe524('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x109795},_0x488fce[_0xe524('0x7')][_0x48165e][_0xe524('0x1b')],_0x48165e)[_0xe524('0x1c')](function(_0x209d0b){logger['info'](_0xe524('0x1d'),_0x569660,_0x109795,_0x209d0b);})[_0xe524('0x1e')](function(_0x49d104){logger[_0xe524('0x1f')](_0xe524('0x20'),_0x569660,_0x49d104);})[_0xe524('0x21')](function(){delete _0x488fce[_0xe524('0x7')][_0x48165e];});};Acw[_0xe524('0x17')][_0xe524('0x22')]=function(_0xbf059b){try{var _0x375219=this;var _0x7dfe97=this['channels'][_0xbf059b][_0xe524('0x23')];var _0x5bb00b=this['channels'][_0xbf059b][_0xe524('0x24')];var _0x23df5e=this[_0xe524('0x5')][_0x5bb00b];var _0x85fc51=![];var _0x599d5d=_0xe524('0x25');if(_0x23df5e['mandatoryDisposition']&&_0x23df5e[_0xe524('0x26')][_0xe524('0x27')]){_0x85fc51=!![];_0x599d5d=_0x23df5e[_0xe524('0x26')][_0xe524('0x27')];}if(!_0x375219[_0xe524('0x6')][_0x7dfe97]){return Promise[_0xe524('0x28')]();}return RpcUser[_0xe524('0x29')](_0x375219['agents'][_0x7dfe97]['id'])['then'](function(_0x283f18){if(!_0x283f18||_0x283f18[_0xe524('0x2a')]){logger[_0xe524('0x2b')](_0xe524('0x2c'),_0xbf059b,_0x7dfe97,_0x5bb00b);return;}logger[_0xe524('0x2b')]('[%s][START][AGENT:%s][QUEUE:%s]',_0xbf059b,_0x7dfe97,_0x5bb00b);var _0x52f140=_0x375219[_0xe524('0x8')][_0xbf059b][_0xe524('0x2d')]&&_0x375219[_0xe524('0x8')][_0xbf059b][_0xe524('0x2e')]?_0x375219[_0xe524('0x8')][_0xbf059b]['destlinkedid']:_0xbf059b;return RpcUser[_0xe524('0x2f')](_0x375219[_0xe524('0x6')][_0x7dfe97],_0x599d5d,_0x52f140);})['then'](function(_0x5b7ded){if(_0x85fc51||!_0x5b7ded){return;}_0x375219[_0xe524('0x7')][_0x7dfe97]={};logger[_0xe524('0x2b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xbf059b,_0x375219[_0xe524('0x5')][_0x5bb00b]['acwTimeout'],_0x7dfe97,_0x5bb00b);_0x375219[_0xe524('0x7')][_0x7dfe97]['timer']=setTimeout(_0x375219[_0xe524('0x30')][_0xe524('0xa')](_0x375219,_0x7dfe97),_0x375219[_0xe524('0x5')][_0x5bb00b]['acwTimeout']*0x3e8);_0x375219[_0xe524('0x7')][_0x7dfe97]['lastPauseAt']=moment()[_0xe524('0x31')](_0xe524('0x32'));_0x375219[_0xe524('0x7')][_0x7dfe97]['uniqueid']=_0xbf059b;_0x375219[_0xe524('0x7')][_0x7dfe97][_0xe524('0x24')]=_0x5bb00b;_0x375219['timers'][_0x7dfe97][_0xe524('0x18')]=_0x375219[_0xe524('0x18')][_0xe524('0xa')](_0x375219,_0x7dfe97,_0xbf059b);})[_0xe524('0x1e')](function(){logger['error'](_0xe524('0x33'),_0xbf059b,_0x375219[_0xe524('0x5')][_0x5bb00b][_0xe524('0x34')],_0x7dfe97,_0x5bb00b);})[_0xe524('0x21')](function(){delete _0x375219[_0xe524('0x8')][_0xbf059b];});}catch(_0x369073){logger[_0xe524('0x1f')](_0xe524('0x35'),_0x369073['message']);}};Acw[_0xe524('0x17')]['stopAcw']=function(_0x1d463b){try{var _0x53eeee=this;if(_0x53eeee['timers'][_0x1d463b]){_0x53eeee[_0xe524('0x7')][_0x1d463b]['timer']=![];var _0x1c3aae=_0x53eeee[_0xe524('0x7')][_0x1d463b][_0xe524('0x1b')];var _0x3103e9=_0x53eeee[_0xe524('0x7')][_0x1d463b][_0xe524('0x24')];var _0x3a0d20=_0x53eeee[_0xe524('0x5')][_0x3103e9]['acwTimeout'];logger[_0xe524('0x2b')](_0xe524('0x36'),_0x1c3aae,_0x1d463b);RpcUser[_0xe524('0x37')](this[_0xe524('0x6')][_0x1d463b]);RpcVoiceAgentReport[_0xe524('0x38')]({'acwtime':_0x3a0d20,'agentacw':!![]},_0x1c3aae,_0x1d463b)[_0xe524('0x1c')](function(_0x1d9648){logger[_0xe524('0x2b')]('[%s][UPDATE][ACWTIME:%s]',_0x1c3aae,_0x3a0d20,_0x1d9648);})[_0xe524('0x1e')](function(_0x849307){logger[_0xe524('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x1c3aae,_0x849307);});}else{logger[_0xe524('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1d463b);if(_0x53eeee[_0xe524('0x7')]){logger[_0xe524('0x2b')](_0xe524('0x39'),JSON[_0xe524('0x3a')](_0x53eeee[_0xe524('0x7')]));}}}catch(_0x4746cd){logger[_0xe524('0x1f')]('[ACW][STOP]\x20%s',_0x4746cd[_0xe524('0x3b')]);}};Acw[_0xe524('0x17')][_0xe524('0x3c')]=function(_0x376505){try{if(this[_0xe524('0x5')][_0x376505[_0xe524('0x24')]]&&(this['voiceQueues'][_0x376505[_0xe524('0x24')]][_0xe524('0x2')]||this[_0xe524('0x5')][_0x376505['queue']][_0xe524('0x3d')])){if(this['agents'][_0x376505['interface']]){this[_0xe524('0x8')][_0x376505[_0xe524('0x1b')]]={'queue':_0x376505['queue'],'interface':_0x376505[_0xe524('0x23')],'destlinkedid':_0x376505[_0xe524('0x2e')]};}}}catch(_0x302605){logger[_0xe524('0x1f')]('[ACW][syncAgentConnect]\x20%s',_0x302605['message']);}};Acw[_0xe524('0x17')][_0xe524('0x3e')]=function(_0x53c204){try{if(this[_0xe524('0x5')][_0x53c204['queue']]&&(this[_0xe524('0x5')][_0x53c204[_0xe524('0x24')]][_0xe524('0x2')]||this[_0xe524('0x5')][_0x53c204[_0xe524('0x24')]][_0xe524('0x3d')])){if(this[_0xe524('0x6')][_0x53c204[_0xe524('0x23')]]){this[_0xe524('0x8')][_0x53c204[_0xe524('0x1b')]]={'queue':_0x53c204[_0xe524('0x24')],'interface':_0x53c204[_0xe524('0x23')]};}}}catch(_0x3d7ab7){logger[_0xe524('0x1f')](_0xe524('0x3f'),_0x3d7ab7['message']);}};Acw[_0xe524('0x17')]['syncHangupRequest']=function(_0x539f90){try{if(this[_0xe524('0x8')][_0x539f90['uniqueid']]&&_[_0xe524('0x40')](this[_0xe524('0x8')][_0x539f90['uniqueid']][_0xe524('0x2d')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x539f90[_0xe524('0x1b')]);this[_0xe524('0x22')](_0x539f90[_0xe524('0x1b')]);}else if(this['channels'][_0x539f90['linkedid']]&&_['isUndefined'](this['channels'][_0x539f90['linkedid']]['attended'])){logger[_0xe524('0x2b')](_0xe524('0x41'),_0x539f90['linkedid']);this[_0xe524('0x22')](_0x539f90[_0xe524('0x42')]);}}catch(_0x254168){logger[_0xe524('0x1f')](_0xe524('0x43'),_0x254168['message']);}};Acw[_0xe524('0x17')][_0xe524('0xe')]=function(_0x34ca5e){try{if(this['channels'][_0x34ca5e[_0xe524('0x1b')]]&&this['channels'][_0x34ca5e[_0xe524('0x1b')]][_0xe524('0x2d')]){logger[_0xe524('0x2b')](_0xe524('0x44'),_0x34ca5e[_0xe524('0x1b')]);this[_0xe524('0x22')](_0x34ca5e[_0xe524('0x1b')]);}else if(this[_0xe524('0x8')][_0x34ca5e[_0xe524('0x42')]]&&this[_0xe524('0x8')][_0x34ca5e[_0xe524('0x42')]][_0xe524('0x2d')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x34ca5e['linkedid']);this[_0xe524('0x22')](_0x34ca5e[_0xe524('0x42')]);}}catch(_0xe7de83){logger[_0xe524('0x1f')](_0xe524('0x45'),_0xe7de83[_0xe524('0x3b')]);}};Acw[_0xe524('0x17')][_0xe524('0x12')]=function(_0x1e9006){try{if(!_[_0xe524('0x46')](this[_0xe524('0x8')][_0x1e9006['transfereeuniqueid']])){this[_0xe524('0x22')](_0x1e9006[_0xe524('0x47')]);if(this['channels'][_0x1e9006['secondtransfereruniqueid']]){this['channels'][_0x1e9006['secondtransfereruniqueid']][_0xe524('0x2d')]=!![];this[_0xe524('0x8')][_0x1e9006[_0xe524('0x48')]]=this[_0xe524('0x8')][_0x1e9006['secondtransfereruniqueid']];delete this[_0xe524('0x8')][_0x1e9006[_0xe524('0x49')]];}}else if(!_[_0xe524('0x46')](this[_0xe524('0x8')][_0x1e9006['transfertargetuniqueid']])){this['startAcw'](_0x1e9006['transfertargetuniqueid']);if(this[_0xe524('0x8')][_0x1e9006['origtransfereruniqueid']]){this[_0xe524('0x8')][_0x1e9006[_0xe524('0x4a')]][_0xe524('0x2d')]=!![];this[_0xe524('0x8')][_0x1e9006[_0xe524('0x47')]]=this['channels'][_0x1e9006['origtransfereruniqueid']];delete this[_0xe524('0x8')][_0x1e9006[_0xe524('0x4a')]];}}}catch(_0x3b0c8f){logger[_0xe524('0x1f')](_0xe524('0x4b'),_0x3b0c8f[_0xe524('0x3b')]);}};Acw['prototype'][_0xe524('0x14')]=function(_0x26160b){try{if(this[_0xe524('0x8')][_0x26160b['transfereruniqueid']]){logger[_0xe524('0x2b')](_0xe524('0x4c'),JSON[_0xe524('0x3a')](_0x26160b['transfereruniqueid']));this['startAcw'](_0x26160b[_0xe524('0x4d')]);}else if(this[_0xe524('0x8')][_0x26160b[_0xe524('0x4e')]]){logger[_0xe524('0x2b')](_0xe524('0x4f'),JSON['stringify'](_0x26160b[_0xe524('0x4e')]));this[_0xe524('0x22')](_0x26160b[_0xe524('0x4e')]);}}catch(_0x21a625){logger[_0xe524('0x1f')](_0xe524('0x50'),_0x21a625[_0xe524('0x3b')]);}};Acw[_0xe524('0x17')][_0xe524('0x10')]=function(_0x7e5992){try{if(this[_0xe524('0x5')][_0x7e5992['queue']]&&this[_0xe524('0x5')][_0x7e5992[_0xe524('0x24')]][_0xe524('0x51')]===_0xe524('0x52')){if(this[_0xe524('0x6')][_0x7e5992['interface']]){logger[_0xe524('0x2b')](_0xe524('0x53'),_0x7e5992[_0xe524('0x1b')],_0x7e5992[_0xe524('0x23')],_0x7e5992[_0xe524('0x24')]);return RpcUser[_0xe524('0x2f')](this[_0xe524('0x6')][_0x7e5992['interface']],_0xe524('0x54'),_0x7e5992[_0xe524('0x1b')]);}}}catch(_0x35ca22){logger[_0xe524('0x1f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x35ca22[_0xe524('0x3b')]);}};module['exports']=Acw; \ No newline at end of file +var _0x6691=['acwTimeout','stopAcw','format','catch','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','syncHangupRequest','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','bind','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','error','finally','startAcw','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','voicePause','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x6691,0x12d));var _0x1669=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6691[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1669('0x0'));var moment=require(_0x1669('0x1'));var ami=require(_0x1669('0x2'));var logger=require(_0x1669('0x3'))(_0x1669('0x4'));var RpcUser=require(_0x1669('0x5'));var RpcVoiceAgentReport=require(_0x1669('0x6'));function Acw(_0x455cbd){this[_0x1669('0x7')]=_0x455cbd[_0x1669('0x7')];this['agents']=_0x455cbd[_0x1669('0x8')];this[_0x1669('0x9')]=_0x455cbd[_0x1669('0x9')];this[_0x1669('0xa')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x1669('0xb'),this['syncHangupRequest']['bind'](this));ami['on']('hangup',this[_0x1669('0xc')]['bind'](this));ami['on'](_0x1669('0xd'),this[_0x1669('0xe')][_0x1669('0xf')](this));ami['on'](_0x1669('0x10'),this[_0x1669('0x11')][_0x1669('0xf')](this));ami['on'](_0x1669('0x12'),this[_0x1669('0x13')][_0x1669('0xf')](this));ami['on'](_0x1669('0x14'),this[_0x1669('0x15')][_0x1669('0xf')](this));}function getDiff(_0x3a484a){var _0x182520=moment()[_0x1669('0x16')](0x0);var _0x355ac3=moment(_0x3a484a)[_0x1669('0x16')](0x0);return _0x182520[_0x1669('0x17')](_0x355ac3,_0x1669('0x18'));}Acw[_0x1669('0x19')][_0x1669('0x1a')]=function(_0x31b2be,_0x1f9ea6){var _0x4d2f66=this;var _0x21a5d2=getDiff(_0x4d2f66[_0x1669('0x9')][_0x31b2be][_0x1669('0x1b')]);clearTimeout(_0x4d2f66[_0x1669('0x9')][_0x31b2be][_0x1669('0x1c')]);_0x4d2f66['timers'][_0x31b2be]['timer']=![];return RpcVoiceAgentReport[_0x1669('0x1d')]({'acwtime':_0x21a5d2},_0x4d2f66[_0x1669('0x9')][_0x31b2be][_0x1669('0x1e')],_0x31b2be)[_0x1669('0x1f')](function(_0x214b8b){logger[_0x1669('0x20')](_0x1669('0x21'),_0x1f9ea6,_0x21a5d2,_0x214b8b);})['catch'](function(_0x31483f){logger[_0x1669('0x22')]('[%s][UPDATE][ERRORS:%s]',_0x1f9ea6,_0x31483f);})[_0x1669('0x23')](function(){delete _0x4d2f66[_0x1669('0x9')][_0x31b2be];});};Acw['prototype'][_0x1669('0x24')]=function(_0x2d6f16){try{var _0x2e95c3=this;var _0x17c227=this[_0x1669('0xa')][_0x2d6f16]['interface'];var _0x41bc1e=this[_0x1669('0xa')][_0x2d6f16][_0x1669('0x25')];var _0x5796f2=this[_0x1669('0x7')][_0x41bc1e];var _0x553b09=![];var _0x50b7b2=_0x1669('0x26');if(_0x5796f2['mandatoryDisposition']&&_0x5796f2[_0x1669('0x27')][_0x1669('0x28')]){_0x553b09=!![];_0x50b7b2=_0x5796f2[_0x1669('0x27')][_0x1669('0x28')];}if(!_0x2e95c3[_0x1669('0x8')][_0x17c227]){return Promise[_0x1669('0x29')]();}return RpcUser[_0x1669('0x2a')](_0x2e95c3['agents'][_0x17c227]['id'])[_0x1669('0x1f')](function(_0x597c69){if(!_0x597c69||_0x597c69[_0x1669('0x2b')]){logger[_0x1669('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x2d6f16,_0x17c227,_0x41bc1e);return;}logger[_0x1669('0x20')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2d6f16,_0x17c227,_0x41bc1e);var _0x29aff9=_0x2e95c3[_0x1669('0xa')][_0x2d6f16][_0x1669('0x2c')]&&_0x2e95c3[_0x1669('0xa')][_0x2d6f16]['destlinkedid']?_0x2e95c3['channels'][_0x2d6f16]['destlinkedid']:_0x2d6f16;return RpcUser[_0x1669('0x2d')](_0x2e95c3[_0x1669('0x8')][_0x17c227],_0x50b7b2,_0x29aff9);})[_0x1669('0x1f')](function(_0x1eaa0c){if(_0x553b09||!_0x1eaa0c){return;}_0x2e95c3[_0x1669('0x9')][_0x17c227]={};logger['info'](_0x1669('0x2e'),_0x2d6f16,_0x2e95c3[_0x1669('0x7')][_0x41bc1e][_0x1669('0x2f')],_0x17c227,_0x41bc1e);_0x2e95c3[_0x1669('0x9')][_0x17c227][_0x1669('0x1c')]=setTimeout(_0x2e95c3[_0x1669('0x30')][_0x1669('0xf')](_0x2e95c3,_0x17c227),_0x2e95c3[_0x1669('0x7')][_0x41bc1e]['acwTimeout']*0x3e8);_0x2e95c3[_0x1669('0x9')][_0x17c227]['lastPauseAt']=moment()[_0x1669('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e95c3['timers'][_0x17c227][_0x1669('0x1e')]=_0x2d6f16;_0x2e95c3[_0x1669('0x9')][_0x17c227][_0x1669('0x25')]=_0x41bc1e;_0x2e95c3[_0x1669('0x9')][_0x17c227][_0x1669('0x1a')]=_0x2e95c3[_0x1669('0x1a')][_0x1669('0xf')](_0x2e95c3,_0x17c227,_0x2d6f16);})[_0x1669('0x32')](function(){logger[_0x1669('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2d6f16,_0x2e95c3[_0x1669('0x7')][_0x41bc1e][_0x1669('0x2f')],_0x17c227,_0x41bc1e);})[_0x1669('0x23')](function(){delete _0x2e95c3[_0x1669('0xa')][_0x2d6f16];});}catch(_0x3b1fb2){logger[_0x1669('0x22')](_0x1669('0x33'),_0x3b1fb2['message']);}};Acw[_0x1669('0x19')][_0x1669('0x30')]=function(_0x373c81){try{var _0x13ec42=this;if(_0x13ec42[_0x1669('0x9')][_0x373c81]){_0x13ec42[_0x1669('0x9')][_0x373c81]['timer']=![];var _0x5c2629=_0x13ec42['timers'][_0x373c81][_0x1669('0x1e')];var _0x2439d8=_0x13ec42[_0x1669('0x9')][_0x373c81][_0x1669('0x25')];var _0x3d996b=_0x13ec42[_0x1669('0x7')][_0x2439d8][_0x1669('0x2f')];logger['info'](_0x1669('0x34'),_0x5c2629,_0x373c81);RpcUser[_0x1669('0x35')](this['agents'][_0x373c81]);RpcVoiceAgentReport['update']({'acwtime':_0x3d996b,'agentacw':!![]},_0x5c2629,_0x373c81)[_0x1669('0x1f')](function(_0x36d2f3){logger[_0x1669('0x20')](_0x1669('0x21'),_0x5c2629,_0x3d996b,_0x36d2f3);})[_0x1669('0x32')](function(_0x52747f){logger[_0x1669('0x22')]('[%s][UPDATE][ERRORS:%s]',_0x5c2629,_0x52747f);});}else{logger['error'](_0x1669('0x36'),_0x373c81);if(_0x13ec42['timers']){logger[_0x1669('0x20')](_0x1669('0x37'),JSON[_0x1669('0x38')](_0x13ec42[_0x1669('0x9')]));}}}catch(_0x5e21eb){logger[_0x1669('0x22')](_0x1669('0x39'),_0x5e21eb[_0x1669('0x3a')]);}};Acw['prototype'][_0x1669('0x3b')]=function(_0x297c30){try{if(this[_0x1669('0x7')][_0x297c30[_0x1669('0x25')]]&&(this[_0x1669('0x7')][_0x297c30[_0x1669('0x25')]][_0x1669('0x4')]||this['voiceQueues'][_0x297c30[_0x1669('0x25')]]['mandatoryDisposition'])){if(this[_0x1669('0x8')][_0x297c30['interface']]){this[_0x1669('0xa')][_0x297c30[_0x1669('0x1e')]]={'queue':_0x297c30[_0x1669('0x25')],'interface':_0x297c30[_0x1669('0x3c')],'destlinkedid':_0x297c30[_0x1669('0x3d')]};}}}catch(_0xa4b268){logger['error'](_0x1669('0x3e'),_0xa4b268[_0x1669('0x3a')]);}};Acw[_0x1669('0x19')]['syncAgentConnectPreview']=function(_0x58f3e1){try{if(this['voiceQueues'][_0x58f3e1['queue']]&&(this[_0x1669('0x7')][_0x58f3e1[_0x1669('0x25')]][_0x1669('0x4')]||this['voiceQueues'][_0x58f3e1['queue']][_0x1669('0x3f')])){if(this['agents'][_0x58f3e1[_0x1669('0x3c')]]){this[_0x1669('0xa')][_0x58f3e1[_0x1669('0x1e')]]={'queue':_0x58f3e1[_0x1669('0x25')],'interface':_0x58f3e1[_0x1669('0x3c')]};}}}catch(_0x2ad0eb){logger[_0x1669('0x22')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2ad0eb[_0x1669('0x3a')]);}};Acw['prototype'][_0x1669('0x40')]=function(_0x48b609){try{if(this['channels'][_0x48b609[_0x1669('0x1e')]]&&_[_0x1669('0x41')](this[_0x1669('0xa')][_0x48b609[_0x1669('0x1e')]][_0x1669('0x2c')])){logger[_0x1669('0x20')]('[%s][HANGUP:UNIQUEID]',_0x48b609[_0x1669('0x1e')]);this[_0x1669('0x24')](_0x48b609['uniqueid']);}else if(this[_0x1669('0xa')][_0x48b609[_0x1669('0x42')]]&&_['isUndefined'](this['channels'][_0x48b609[_0x1669('0x42')]][_0x1669('0x2c')])){logger[_0x1669('0x20')](_0x1669('0x43'),_0x48b609['linkedid']);this[_0x1669('0x24')](_0x48b609[_0x1669('0x42')]);}}catch(_0x13a606){logger['error'](_0x1669('0x44'),_0x13a606['message']);}};Acw['prototype'][_0x1669('0xc')]=function(_0x4a98a7){try{if(this['channels'][_0x4a98a7[_0x1669('0x1e')]]&&this['channels'][_0x4a98a7[_0x1669('0x1e')]][_0x1669('0x2c')]){logger[_0x1669('0x20')](_0x1669('0x45'),_0x4a98a7['uniqueid']);this[_0x1669('0x24')](_0x4a98a7['uniqueid']);}else if(this['channels'][_0x4a98a7['linkedid']]&&this[_0x1669('0xa')][_0x4a98a7[_0x1669('0x42')]][_0x1669('0x2c')]){logger[_0x1669('0x20')](_0x1669('0x46'),_0x4a98a7[_0x1669('0x42')]);this[_0x1669('0x24')](_0x4a98a7[_0x1669('0x42')]);}}catch(_0x43636c){logger[_0x1669('0x22')](_0x1669('0x47'),_0x43636c[_0x1669('0x3a')]);}};Acw['prototype'][_0x1669('0x11')]=function(_0x516a48){try{if(!_['isNil'](this[_0x1669('0xa')][_0x516a48['transfereeuniqueid']])){this[_0x1669('0x24')](_0x516a48[_0x1669('0x48')]);if(this[_0x1669('0xa')][_0x516a48[_0x1669('0x49')]]){this['channels'][_0x516a48['secondtransfereruniqueid']]['attended']=!![];this[_0x1669('0xa')][_0x516a48[_0x1669('0x4a')]]=this[_0x1669('0xa')][_0x516a48['secondtransfereruniqueid']];delete this['channels'][_0x516a48[_0x1669('0x49')]];}}else if(!_[_0x1669('0x4b')](this[_0x1669('0xa')][_0x516a48[_0x1669('0x4a')]])){this['startAcw'](_0x516a48[_0x1669('0x4a')]);if(this[_0x1669('0xa')][_0x516a48[_0x1669('0x4c')]]){this[_0x1669('0xa')][_0x516a48[_0x1669('0x4c')]]['attended']=!![];this['channels'][_0x516a48['transfereeuniqueid']]=this[_0x1669('0xa')][_0x516a48[_0x1669('0x4c')]];delete this[_0x1669('0xa')][_0x516a48['origtransfereruniqueid']];}}}catch(_0x5e29f0){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x5e29f0[_0x1669('0x3a')]);}};Acw[_0x1669('0x19')][_0x1669('0x13')]=function(_0x3c0b3c){try{if(this['channels'][_0x3c0b3c[_0x1669('0x4d')]]){logger[_0x1669('0x20')](_0x1669('0x4e'),JSON[_0x1669('0x38')](_0x3c0b3c[_0x1669('0x4d')]));this['startAcw'](_0x3c0b3c['transfereruniqueid']);}else if(this[_0x1669('0xa')][_0x3c0b3c[_0x1669('0x4f')]]){logger['info'](_0x1669('0x50'),JSON[_0x1669('0x38')](_0x3c0b3c[_0x1669('0x4f')]));this[_0x1669('0x24')](_0x3c0b3c['transfererlinkedid']);}}catch(_0x5854ae){logger[_0x1669('0x22')](_0x1669('0x51'),_0x5854ae[_0x1669('0x3a')]);}};Acw[_0x1669('0x19')][_0x1669('0xe')]=function(_0x413697){try{if(this[_0x1669('0x7')][_0x413697['queue']]&&this[_0x1669('0x7')][_0x413697[_0x1669('0x25')]]['autopause']===_0x1669('0x52')){if(this[_0x1669('0x8')][_0x413697['interface']]){logger['info'](_0x1669('0x53'),_0x413697[_0x1669('0x1e')],_0x413697[_0x1669('0x3c')],_0x413697[_0x1669('0x25')]);return RpcUser[_0x1669('0x2d')](this[_0x1669('0x8')][_0x413697[_0x1669('0x3c')]],_0x1669('0x54'),_0x413697[_0x1669('0x1e')]);}}}catch(_0xae224c){logger[_0x1669('0x22')](_0x1669('0x55'),_0xae224c[_0x1669('0x3a')]);}};module[_0x1669('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 14898ed..c434967 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 _0x6831=['actionSipPeerStatus','catch','exports','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList'];(function(_0x3561e3,_0x41dfef){var _0x5c5b58=function(_0x9fa6a7){while(--_0x9fa6a7){_0x3561e3['push'](_0x3561e3['shift']());}};_0x5c5b58(++_0x41dfef);}(_0x6831,0xb7));var _0x1683=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6831[_0x321bb2];return _0x9c12ed;};'use strict';var Manager=require(_0x1683('0x0'));var BPromise=require(_0x1683('0x1'));var util=require(_0x1683('0x2'));var logger=require('../../config/logger')(_0x1683('0x3'));var config=require(_0x1683('0x4'));var ami=new Manager(config[_0x1683('0x5')][_0x1683('0x6')],config[_0x1683('0x5')]['ip'],config[_0x1683('0x5')][_0x1683('0x7')],config[_0x1683('0x5')][_0x1683('0x8')],!![]);ami[_0x1683('0x9')]();ami[_0x1683('0xa')]=BPromise[_0x1683('0xb')](ami[_0x1683('0xc')]);function error(_0x27ac72){logger[_0x1683('0xd')](util['format'](_0x1683('0xe'),config[_0x1683('0x5')]['username'],config['asterisk']['ip'],config[_0x1683('0x5')]['port'],util[_0x1683('0xf')](_0x27ac72,![],null)));}function close(){logger[_0x1683('0xd')](util[_0x1683('0x10')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x1683('0x5')][_0x1683('0x7')],config[_0x1683('0x5')]['ip'],config[_0x1683('0x5')]['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x1683('0xa')]({'action':_0x1683('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x1683('0xa')]({'action':_0x1683('0x12')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x1683('0x13')});};};ami[_0x1683('0x14')]=function(){return function(){return ami['Action']({'action':_0x1683('0x15')});};};ami[_0x1683('0x16')]=function(){return function(){return ami[_0x1683('0xa')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x1683('0x10')](_0x1683('0x17'),config[_0x1683('0x5')][_0x1683('0x7')],config['asterisk']['ip'],config[_0x1683('0x5')]['port']));ami['once']('error',error);ami[_0x1683('0x18')](_0x1683('0x19'),close);}ami['on'](_0x1683('0x1a'),connect);ami['on']('shutdown',function(_0x1c1a07){logger[_0x1683('0x1b')](util[_0x1683('0x10')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x1683('0x5')][_0x1683('0x7')],config[_0x1683('0x5')]['ip'],config['asterisk'][_0x1683('0x6')],util[_0x1683('0xf')](_0x1c1a07,![],null)));});ami['on'](_0x1683('0x1c'),function(){logger[_0x1683('0x1b')](util[_0x1683('0x10')](_0x1683('0x1d'),config[_0x1683('0x5')]['username'],config['asterisk']['ip'],config[_0x1683('0x5')]['port']));return Promise[_0x1683('0x1e')]()[_0x1683('0x1f')](ami['actionSipShowRegistry']())[_0x1683('0x1f')](ami[_0x1683('0x20')]())['then'](ami[_0x1683('0x21')]())[_0x1683('0x1f')](ami[_0x1683('0x14')]())['then'](ami[_0x1683('0x16')]())[_0x1683('0x22')](function(_0x5a454f){logger['error']('[ami.js][fullybooted]',util[_0x1683('0xf')](_0x5a454f,{'showHidden':![],'depth':null}));});});ami['once'](_0x1683('0xd'),error);ami['once'](_0x1683('0x19'),close);module[_0x1683('0x23')]=ami; \ No newline at end of file +var _0x88b3=['../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','error','format','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','catch','once','close','asterisk-manager','util'];(function(_0x5cce78,_0x17590e){var _0x3c61af=function(_0x4b7fdc){while(--_0x4b7fdc){_0x5cce78['push'](_0x5cce78['shift']());}};_0x3c61af(++_0x17590e);}(_0x88b3,0x1df));var _0x388b=function(_0x27017d,_0x560504){_0x27017d=_0x27017d-0x0;var _0x2b3c71=_0x88b3[_0x27017d];return _0x2b3c71;};'use strict';var Manager=require(_0x388b('0x0'));var BPromise=require('bluebird');var util=require(_0x388b('0x1'));var logger=require(_0x388b('0x2'))(_0x388b('0x3'));var config=require(_0x388b('0x4'));var ami=new Manager(config[_0x388b('0x5')][_0x388b('0x6')],config['asterisk']['ip'],config['asterisk']['username'],config['asterisk'][_0x388b('0x7')],!![]);ami[_0x388b('0x8')]();ami[_0x388b('0x9')]=BPromise[_0x388b('0xa')](ami[_0x388b('0xb')]);function error(_0x1febe8){logger[_0x388b('0xc')](util[_0x388b('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x388b('0x5')][_0x388b('0xe')],config['asterisk']['ip'],config[_0x388b('0x5')][_0x388b('0x6')],util[_0x388b('0xf')](_0x1febe8,![],null)));}function close(){logger[_0x388b('0xc')](util['format'](_0x388b('0x10'),config['asterisk'][_0x388b('0xe')],config[_0x388b('0x5')]['ip'],config[_0x388b('0x5')][_0x388b('0x6')]));}ami[_0x388b('0x11')]=function(){return function(){return ami[_0x388b('0x9')]({'action':_0x388b('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x388b('0x9')]({'action':_0x388b('0x13')});};};ami[_0x388b('0x14')]=function(){return function(){return ami[_0x388b('0x9')]({'action':_0x388b('0x15')});};};ami[_0x388b('0x16')]=function(){return function(){return ami[_0x388b('0x9')]({'action':_0x388b('0x17')});};};ami[_0x388b('0x18')]=function(){return function(){return ami[_0x388b('0x9')]({'action':_0x388b('0x19')});};};function connect(){logger[_0x388b('0x1a')](util[_0x388b('0xd')](_0x388b('0x1b'),config['asterisk']['username'],config[_0x388b('0x5')]['ip'],config['asterisk']['port']));ami['once'](_0x388b('0xc'),error);ami['once']('close',close);}ami['on'](_0x388b('0x1c'),connect);ami['on'](_0x388b('0x1d'),function(_0x463c54){logger['info'](util[_0x388b('0xd')](_0x388b('0x1e'),config[_0x388b('0x5')][_0x388b('0xe')],config[_0x388b('0x5')]['ip'],config[_0x388b('0x5')][_0x388b('0x6')],util['inspect'](_0x463c54,![],null)));});ami['on']('fullybooted',function(){logger[_0x388b('0x1a')](util[_0x388b('0xd')](_0x388b('0x1f'),config['asterisk'][_0x388b('0xe')],config['asterisk']['ip'],config[_0x388b('0x5')][_0x388b('0x6')]));return Promise['resolve']()[_0x388b('0x20')](ami[_0x388b('0x11')]())[_0x388b('0x20')](ami[_0x388b('0x21')]())['then'](ami[_0x388b('0x14')]())['then'](ami[_0x388b('0x16')]())[_0x388b('0x20')](ami[_0x388b('0x18')]())[_0x388b('0x22')](function(_0x2def96){logger[_0x388b('0xc')]('[ami.js][fullybooted]',util['inspect'](_0x2def96,{'showHidden':![],'depth':null}));});});ami[_0x388b('0x23')](_0x388b('0xc'),error);ami[_0x388b('0x23')](_0x388b('0x24'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0a45f82..af1cad2 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xda3f,0xec));var _0xfda3=function(_0x5726ec,_0xc6d07d){_0x5726ec=_0x5726ec-0x0;var _0x197c05=_0xda3f[_0x5726ec];return _0x197c05;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x5cfe9b,_0x34335f){var _0x583e61=function(_0x553e2b){while(--_0x553e2b){_0x5cfe9b['push'](_0x5cfe9b['shift']());}};_0x583e61(++_0x34335f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1de12c,_0x24ef8a){_0x1de12c=_0x1de12c-0x0;var _0x5736ae=_0xb43b[_0x1de12c];return _0x5736ae;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('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 17d3c0c..4be1b79 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 _0x3f84=['predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','CAMPAIGN_STATUS','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','prototype','isTrunkReachable','active','format','reachable','SIP/%s','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','Action','command','iftime\x20%s,%s','content','indexOf','true','catch','all','some','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','verifyAdditionalPhones','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','VoiceQueueId','[rescheduleContact][Abandoned]','Abandoned','channel','actionid','strategy','rrmemory','roundrobin','locked','status','stateinterface','queueBooked','push','idHopper','paused','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','isNil','unlockRR','[booked][RR]','run','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','ivr','getQueue','response','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','amd','saveInDb','MACHINE','Machine','AMD','countmachineretry','buildObj','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','countcongestionretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','resolve','statusMessage','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact]','checkPreviewRecallReminder','handlePreviewRecallNotifications','launchHandleIvr','handleIvr','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','available','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','recallme','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','checkContactEmpty','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','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','[busyFactor]','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x23c519,_0x364e9d){var _0x157876=function(_0x19a74f){while(--_0x19a74f){_0x23c519['push'](_0x23c519['shift']());}};_0x157876(++_0x364e9d);}(_0x3f84,0x1bd));var _0x43f8=function(_0x3ac31a,_0x18f1b9){_0x3ac31a=_0x3ac31a-0x0;var _0x4caa11=_0x3f84[_0x3ac31a];return _0x4caa11;};'use strict';var util=require(_0x43f8('0x0'));var _=require('lodash');var uuid=require(_0x43f8('0x1'));var moment=require(_0x43f8('0x2'));var rr=require('rr');var Redis=require(_0x43f8('0x3'));var utils=require(_0x43f8('0x4'));var hopperUtils=require(_0x43f8('0x5'));var ut=require('../preview/util/util');var config=require(_0x43f8('0x6'));var logger=require(_0x43f8('0x7'))(_0x43f8('0x8'));var loggerBooked=require(_0x43f8('0x7'))(_0x43f8('0x9'));var loggerPredictive=require(_0x43f8('0x7'))(_0x43f8('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x43f8('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x43f8('0xc'));var ami=require(_0x43f8('0xd'));config[_0x43f8('0xe')]=_[_0x43f8('0xf')](config[_0x43f8('0xe')],{'host':_0x43f8('0x10'),'port':0x18eb});var io=require(_0x43f8('0x11'))(new Redis(config[_0x43f8('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x43f8('0x12'));var Interval=require(_0x43f8('0x13'));var Action=require(_0x43f8('0x14'));var History=require(_0x43f8('0x15'));var Final=require(_0x43f8('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x43f8('0x17'));var Hangup=require(_0x43f8('0x18'));var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x43f8('0x19')]=function(_0x37c19d){this['tail']=this[_0x43f8('0x1a')]?this[_0x43f8('0x1a')][_0x43f8('0x1b')](_0x37c19d):_0x37c19d();};function Dialer(_0x13dc54,_0x20fd44){this[_0x43f8('0x1c')]=new Sequence();this[_0x43f8('0x1d')]=_0x20fd44;this[_0x43f8('0x1e')]=_0x13dc54[_0x43f8('0x1e')];this[_0x43f8('0x1f')]=_0x13dc54[_0x43f8('0x1f')];this[_0x43f8('0x20')]=_0x13dc54[_0x43f8('0x20')];this['trunks']=_0x13dc54[_0x43f8('0x21')];this[_0x43f8('0x22')]=config[_0x43f8('0x22')]||0x2;this[_0x43f8('0x23')]={};this[_0x43f8('0x24')]={};this['contactsId']={};this[_0x43f8('0x25')]={};this[_0x43f8('0x26')]={};this['startPredictive']={};this[_0x43f8('0x27')]={};this[_0x43f8('0x28')]={};this['queueBooked']={};this[_0x43f8('0x29')]={};this['queuesSummary']={};ami['on'](_0x43f8('0x2a'),this[_0x43f8('0x2b')]['bind'](this));ami['on'](_0x43f8('0x2c'),this['syncQueueCallerAbandon'][_0x43f8('0x2d')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x43f8('0x2e'),this[_0x43f8('0x2f')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x43f8('0x2d')](this));ami['on']('custom:queuesummarycomplete',this[_0x43f8('0x30')][_0x43f8('0x2d')](this));ami['on'](_0x43f8('0x31'),this[_0x43f8('0x32')][_0x43f8('0x2d')](this));ami['on']('newexten',this[_0x43f8('0x33')][_0x43f8('0x2d')](this));ami['on'](_0x43f8('0x34'),this['syncVarSet'][_0x43f8('0x2d')](this));ami['on'](_0x43f8('0x35'),this[_0x43f8('0x36')][_0x43f8('0x2d')](this));ami['on']('queuestatuscomplete',this[_0x43f8('0x37')][_0x43f8('0x2d')](this));this[_0x43f8('0x38')]();this[_0x43f8('0x39')]();RpcSetting[_0x43f8('0x3a')]()[_0x43f8('0x3b')](function(_0xd5ece){previewRecallmeReminderInterval=_0xd5ece[_0x43f8('0x3c')];});}function isNotNull(_0x42970b){return _0x42970b!==null&&!_[_0x43f8('0x3d')](_0x42970b);}function msgResponse(_0x59589d,_0x17a07d,_0x2e2376){return{'action':_0x59589d,'response':_0x17a07d,'message':_0x2e2376,'stack':_0x2e2376};}function emit(_0x34bd3f,_0x401284,_0x3f00ee){io['to'](_0x34bd3f)[_0x43f8('0x3e')](_0x401284,_0x3f00ee);}function emitOutboundVoiceQueueSummary(_0x8f7f0c){if(_0x8f7f0c[_0x43f8('0x3f')]===_0x43f8('0x40')){logger[_0x43f8('0x41')](_0x43f8('0x42'),util[_0x43f8('0x43')](_0x8f7f0c,{'showHidden':![],'depth':null}));emit(util['format'](_0x43f8('0x44'),_0x8f7f0c[_0x43f8('0x45')]),'voice_queue:save',_0x8f7f0c);}}function checkGetDataPredictive(_0x42bf6d){if(isNotNull(_0x42bf6d)&&!_[_0x43f8('0x46')](_0x42bf6d)){loggerPredictive['info'](_0x43f8('0x47'));loggerPredictive[_0x43f8('0x48')](_0x43f8('0x49'),_0x42bf6d['predictiveIntervalTotalCalls']);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x4a'),_0x42bf6d['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x43f8('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42bf6d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x43f8('0x48')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42bf6d[_0x43f8('0x4b')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42bf6d[_0x43f8('0x4c')]);loggerPredictive[_0x43f8('0x48')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42bf6d[_0x43f8('0x4d')]);loggerPredictive['info'](_0x43f8('0x4e'));if(_0x42bf6d[_0x43f8('0x4f')]>0x0){if(!_['isUndefined'](_0x42bf6d[_0x43f8('0x4d')])&&_0x42bf6d[_0x43f8('0x4d')]>0x0){return!![];}loggerPredictive[_0x43f8('0x48')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x43f8('0x3d')](_0x42bf6d['predictiveIntervalAvgHoldtime'])&&_0x42bf6d[_0x43f8('0x4c')]>0x0){return!![];}loggerPredictive['info'](_0x43f8('0x50'));}else{loggerPredictive['info'](_0x43f8('0x51'));}}else{loggerPredictive['info'](_0x43f8('0x52'));}return![];}function mergeDataErlangB(_0xa88612){return function(_0x5c8a2d){loggerPredictive[_0x43f8('0x48')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x43f8('0x48')](_0x43f8('0x53'),_0x5c8a2d[_0x43f8('0x54')]);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x55'),_0x5c8a2d[_0x43f8('0x56')]);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x57'),_0x5c8a2d[_0x43f8('0x58')]);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x59'),_0x5c8a2d[_0x43f8('0x5a')]);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x57'),_0x5c8a2d[_0x43f8('0x58')]);loggerPredictive['info'](_0x43f8('0x4e'));_[_0x43f8('0x5b')](_0xa88612,_0x5c8a2d);};}function ifInterval(_0x1e1237,_0x31aa63){if(_[_0x43f8('0x3d')](_0x31aa63)){return![];}return utils[_0x43f8('0x5c')](undefined,_0x31aa63)<_0x1e1237*0x3c;}function clearPredictiveAttributes(_0x2ffef1){if(_0x2ffef1[_0x43f8('0x27')]){_0x2ffef1[_0x43f8('0x27')]=undefined;loggerPredictive[_0x43f8('0x41')](_0x2ffef1[_0x43f8('0x45')],_0x43f8('0x5d'));}if(_0x2ffef1[_0x43f8('0x5e')]){_0x2ffef1[_0x43f8('0x5e')]=undefined;loggerPredictive['debug'](_0x2ffef1[_0x43f8('0x45')],_0x43f8('0x5f'));}if(_0x2ffef1[_0x43f8('0x60')]){clearInterval(_0x2ffef1[_0x43f8('0x60')]);_0x2ffef1['handlePredictive']=undefined;loggerPredictive[_0x43f8('0x41')](_0x2ffef1[_0x43f8('0x45')],_0x43f8('0x61'));}}function loggerCatchPredictive(_0x1431d4,_0xf37b81){return function(_0x357da9){loggerPredictive[_0x43f8('0x62')](_0xf37b81[_0x43f8('0x45')],_0x1431d4);loggerPredictive[_0x43f8('0x62')](_0x357da9['stack']);clearPredictiveAttributes(_0xf37b81);};}function loggerCatch(_0x1ab70b){return function(_0x26be87){logger[_0x43f8('0x62')](_0x1ab70b,util[_0x43f8('0x43')](_0x26be87,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x57c772,_0x46f027,_0x16f18e){return function(_0xc7280){utils[_0x43f8('0x63')](_0x46f027,_0x16f18e,0x0);_0x46f027[_0x43f8('0x64')]=0x0;logger[_0x43f8('0x62')](_0x57c772,util[_0x43f8('0x43')](_0xc7280,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x13322a){return function(_0x2e39af){if(isNotNull(_0x2e39af)&&isNotNull(_0x2e39af[0x0])){if(_0x2e39af[0x0][_0x43f8('0x65')]>0x0){_0x13322a['message']=utils['CAMPAIGN_STATUS'][_0x43f8('0x66')];logger['info'](_0x43f8('0x67')+_0x13322a[_0x43f8('0x45')],_0x2e39af[0x0][_0x43f8('0x65')],'contacts');}else{_0x13322a[_0x43f8('0x68')]=utils['CAMPAIGN_STATUS'][_0x43f8('0x69')];logger[_0x43f8('0x48')](_0x43f8('0x6a')+_0x13322a[_0x43f8('0x45')]);}}};}function createObjHistory(_0x286ad9,_0x1c7ea9,_0x56c27b,_0x3ec550,_0x29ae6d){_0x286ad9['message']=_0x56c27b;var _0x48a7ea=new Action(_0x286ad9,_0x1c7ea9);var _0x2aca91=new History(_0x48a7ea);_0x2aca91[_0x43f8('0x6b')]=_0x3ec550;_0x2aca91['statedesc']=_0x29ae6d;_0x2aca91[_0x43f8('0x6c')]=_0x48a7ea[_0x43f8('0x6d')];return _0x2aca91;}function unlockQueueStatus(_0xb313d1,_0x39b1aa){setTimeout(function(){if(_[_0x43f8('0x3d')](_0xb313d1[_0x43f8('0x6e')])){loggerBooked['error'](_0x43f8('0x6f'),_0x39b1aa);}_0xb313d1[_0x43f8('0x6e')]=!![];loggerBooked[_0x43f8('0x48')](_0x43f8('0x70'),_0x39b1aa,JSON[_0x43f8('0x71')](_[_0x43f8('0x72')](_0xb313d1,[_0x43f8('0x45'),_0x43f8('0x6e')])));},0x1f3);}function checkInterval(_0xa8352c){return function(){if(!isNotNull(_0xa8352c[_0x43f8('0x73')])){_0xa8352c['message']=utils[_0x43f8('0x74')]['NULL_INTERVAL'];throw _0xa8352c[_0x43f8('0x45')]+_0x43f8('0x75');}if(!isNotNull(_0xa8352c[_0x43f8('0x73')][_0x43f8('0x76')])){_0xa8352c[_0x43f8('0x68')]=utils[_0x43f8('0x74')][_0x43f8('0x77')];throw _0xa8352c[_0x43f8('0x45')]+_0x43f8('0x75');}if(!isNotNull(_[_0x43f8('0x46')](_0xa8352c[_0x43f8('0x73')][_0x43f8('0x76')]))){_0xa8352c['message']=utils[_0x43f8('0x74')][_0x43f8('0x77')];throw _0xa8352c[_0x43f8('0x45')]+_0x43f8('0x75');}};}function checkIsIVRCampaignActive(_0x17744f){return function(){if(!utils[_0x43f8('0x78')](_0x17744f)){_0x17744f[_0x43f8('0x68')]=utils['CAMPAIGN_STATUS'][_0x43f8('0x79')];throw _0x17744f[_0x43f8('0x45')]+_0x43f8('0x7a');}};}function emitCampaignSummary(_0x519ed0){if(utils[_0x43f8('0x7b')](_0x519ed0)){emit(util['format'](_0x43f8('0x7c'),_0x519ed0[_0x43f8('0x45')]),_0x43f8('0x7d'),_0x519ed0);}}function loggerCatchQueueSummary(_0x146ae7,_0x1c3126){return function(_0x225434){clearPredictiveAttributes(_0x1c3126);emitCampaignSummary(_0x1c3126);loggerSyncQueueSummary[_0x43f8('0x41')](_0x146ae7,util[_0x43f8('0x43')](_0x225434,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5e3e92){if(_0x5e3e92[_0x43f8('0x7e')]){if(_0x5e3e92[_0x43f8('0x7f')]===0x0){_0x5e3e92[_0x43f8('0x7e')]=![];_0x5e3e92['message']=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x43f8('0x41')](_0x43f8('0x80'),_0x5e3e92['name'],_0x43f8('0x81'));}else{_0x5e3e92['message']=utils['CAMPAIGN_STATUS'][_0x43f8('0x82')];loggerSyncQueueSummary[_0x43f8('0x41')](_0x43f8('0x80'),_0x5e3e92[_0x43f8('0x45')],_0x43f8('0x83'));}emitCampaignSummary(_0x5e3e92);}}function myreject(_0x1ef7f8){return function(_0x50e7f2){return _0x1ef7f8(msgResponse('[ifTime][Action]',_0x43f8('0x84'),JSON['stringify'](_0x50e7f2)));};}Dialer[_0x43f8('0x85')][_0x43f8('0x86')]=function(_0x327c8c){return!_[_0x43f8('0x3d')](_0x327c8c)&&_0x327c8c&&!_[_0x43f8('0x3d')](_0x327c8c['name'])&&!_['isUndefined'](_0x327c8c[_0x43f8('0x87')])&&_0x327c8c['active']&&(this[_0x43f8('0x21')][util[_0x43f8('0x88')]('SIP/%s',_0x327c8c[_0x43f8('0x45')])]['status']===_0x43f8('0x89')||this[_0x43f8('0x21')][util[_0x43f8('0x88')](_0x43f8('0x8a'),_0x327c8c[_0x43f8('0x45')])]['status']==='unmonitored');};Dialer['prototype'][_0x43f8('0x8b')]=function(_0x2f2e54){var _0x41a93f=this;return function(){if(!_0x41a93f['isTrunkReachable'](_0x2f2e54[_0x43f8('0x8c')])){if(!_0x41a93f['isTrunkReachable'](_0x2f2e54[_0x43f8('0x8d')])){_0x2f2e54[_0x43f8('0x68')]=utils[_0x43f8('0x74')][_0x43f8('0x8e')];throw _0x2f2e54[_0x43f8('0x45')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x43f8('0x8f')]=function(_0x462933,_0x55ffef,_0x2f3708,_0x2d9c87){var _0x2eee8d=this;return function(){var _0xa90510=!![];return _0x2eee8d['ifTimeIvr'](_0x462933,_0x55ffef,_0x2f3708,_0x2d9c87,_0xa90510);};};Dialer[_0x43f8('0x85')][_0x43f8('0x90')]=function(_0x24c86c,_0x2e0743,_0x366735,_0x1eb101){var _0x59d7dc=this;return function(){var _0x282ca8=![];return _0x59d7dc[_0x43f8('0x91')](_0x24c86c[_0x43f8('0x76')],_0x2e0743,_0x366735,_0x1eb101,_0x282ca8);};};Dialer['prototype'][_0x43f8('0x91')]=function(_0x6c0250,_0x359985,_0x3e401c,_0x4230db,_0x5ad6d5){var _0xcff178=[];return new Promise(function(_0x3eeb98,_0x43d5e4){if(!isNotNull(_0x6c0250)){_0x4230db[_0x43f8('0x68')]=utils['CAMPAIGN_STATUS'][_0x43f8('0x77')];return _0x43d5e4(msgResponse(_0x43f8('0x92'),_0x43f8('0x93'),_0x3e401c+_0x43f8('0x94')));}if(_[_0x43f8('0x46')](_0x6c0250)){_0x4230db[_0x43f8('0x68')]=utils[_0x43f8('0x74')]['EMPTY_INTERVAL'];return _0x43d5e4(msgResponse('ifTime','Failure',_0x3e401c+_0x43f8('0x95')));}if(_0x359985&&_[_0x43f8('0x3d')](config['timezones'][_0x359985])){_0x4230db[_0x43f8('0x68')]=utils[_0x43f8('0x74')][_0x43f8('0x96')];return _0x43d5e4(msgResponse(_0x43f8('0x92'),_0x43f8('0x93'),_0x3e401c+'\x20Timezone\x20unknow\x20'+_0x359985));}if(_[_0x43f8('0x97')](_0x6c0250)){for(var _0xa6d338=0x0;_0xa6d338<_0x6c0250['length'];_0xa6d338+=0x1){_0xcff178['push'](ami[_0x43f8('0x98')]({'action':_0x43f8('0x99'),'command':util[_0x43f8('0x88')](_0x43f8('0x9a'),_0x6c0250[_0xa6d338]['interval'],!_[_0x43f8('0x3d')](config['timezones'][_0x359985])?_0x359985:'')})[_0x43f8('0x3b')](function(_0x3abc87){return _0x3abc87[_0x43f8('0x9b')][_0x43f8('0x9c')](_0x43f8('0x9d'))>=0x0;})[_0x43f8('0x9e')](myreject(_0x43d5e4)));}}else{_0xcff178['push'](ami[_0x43f8('0x98')]({'action':_0x43f8('0x99'),'command':util['format'](_0x43f8('0x9a'),_0x6c0250,!_[_0x43f8('0x3d')](config['timezones'][_0x359985])?_0x359985:'')})['then'](function(_0x1e39a1){return _0x1e39a1[_0x43f8('0x9b')][_0x43f8('0x9c')](_0x43f8('0x9d'))>=0x0;})[_0x43f8('0x9e')](myreject(_0x43d5e4)));}Promise[_0x43f8('0x9f')](_0xcff178)[_0x43f8('0x3b')](function(_0x105be4){var _0x1e75d=_[_0x43f8('0xa0')](_0x105be4);if(_0x1e75d){return _0x3eeb98(_0x1e75d);}else{_0x4230db[_0x43f8('0x68')]=_0x5ad6d5?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x43f8('0x74')]['OVERTIME_INTERVAL'];return _0x43d5e4(msgResponse('[ifTime][promiseAll]',_0x43f8('0x93'),_0x43f8('0xa1')+_0x5ad6d5+'\x20'+_0x3e401c+_0x43f8('0xa2')+util[_0x43f8('0x43')](_0x6c0250,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x359985));}})[_0x43f8('0x9e')](function(_0x3d3309){return _0x43d5e4(msgResponse(_0x43f8('0x92'),_0x43f8('0x93'),JSON[_0x43f8('0x71')](_0x3d3309)));});});};Dialer[_0x43f8('0x85')][_0x43f8('0x38')]=function(){var _0x203245=this;return cmHopper[_0x43f8('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0x43f8('0x3b')](function(){setInterval(function(){_0x203245[_0x43f8('0xa4')]();},0x3e8);});};Dialer[_0x43f8('0x85')][_0x43f8('0xa4')]=function(){var _0x2e82f7=this;var _0x31e141;for(var _0x560f8e in this['campaigns']){if(typeof this[_0x43f8('0x1f')][_0x560f8e]!==_0x43f8('0xa5')){_0x31e141=this[_0x43f8('0x1f')][_0x560f8e];if(utils[_0x43f8('0x7b')](_0x31e141)&&utils[_0x43f8('0x78')](_0x31e141)){_0x31e141['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x43f8('0x3b')](checkIsIVRCampaignActive(_0x31e141))['then'](checkInterval(_0x31e141))[_0x43f8('0x3b')](_0x2e82f7['checkIsTrunkReachable'](_0x31e141))[_0x43f8('0x3b')](_0x2e82f7[_0x43f8('0x8f')](_0x31e141[_0x43f8('0xa6')],_0x31e141[_0x43f8('0xa7')],_0x31e141[_0x43f8('0x45')],_0x31e141))[_0x43f8('0x3b')](_0x2e82f7['checkIfTimeIntervals'](_0x31e141[_0x43f8('0x73')],_0x31e141[_0x43f8('0xa7')],_0x31e141[_0x43f8('0x45')],_0x31e141))[_0x43f8('0x3b')](_0x2e82f7['launchHandleIvr'](_0x31e141))[_0x43f8('0x9e')](loggerCatchQueueSummary(_0x43f8('0xa8'),_0x31e141));}else{notSendMessagesCampaign(_0x31e141);}}}};Dialer['prototype'][_0x43f8('0xa9')]=function(_0x4e8d75){if(_0x4e8d75[_0x43f8('0xaa')]!==_0x43f8('0xa')){clearPredictiveAttributes(_0x4e8d75);}switch(_0x4e8d75['dialMethod']){case _0x43f8('0xab'):this[_0x43f8('0xac')](_0x4e8d75,0x1);break;case _0x43f8('0xad'):this['handlePower'](_0x4e8d75,_0x4e8d75[_0x43f8('0xae')]);break;case _0x43f8('0xa'):this[_0x43f8('0xa')](_0x4e8d75);break;case'booked':this[_0x43f8('0xac')](_0x4e8d75,0x1);break;default:logger[_0x43f8('0x62')](_0x43f8('0xaf'),_0x4e8d75[_0x43f8('0x45')],_0x43f8('0xb0'));}};Dialer[_0x43f8('0x85')][_0x43f8('0x92')]=function(_0x11f741,_0x221aac){var _0x165653=_0x11f741['dialTimezone'];var _0x1113a5=_0x221aac?_0x11f741[_0x43f8('0xa6')]:_0x11f741[_0x43f8('0x73')][_0x43f8('0x76')];logger[_0x43f8('0xb1')]('Dialer::ifTime()',_0x1113a5,_0x165653,_0x11f741[_0x43f8('0x45')],util[_0x43f8('0x88')](_0x43f8('0xb2'),_0x11f741['name'],_0x11f741['id']));var _0xdb3284=null;return Interval[_0x43f8('0xb3')](_0x1113a5,_0x165653)['then'](function(_0x3617f9){if(_0x3617f9===!![]){return _0x3617f9;}else{_0x11f741['message']=_0x221aac?utils['CAMPAIGN_STATUS'][_0x43f8('0xb4')]:utils[_0x43f8('0x74')][_0x43f8('0xb5')];_0xdb3284=msgResponse(_0x43f8('0xb6'),_0x43f8('0x93'),_0x43f8('0xa1')+_0x221aac+'\x20'+_0x11f741['name']+_0x43f8('0xa2')+util['inspect'](_0x1113a5,{'showHidden':![],'depth':null})+_0x43f8('0xb7')+_0x165653);}if(_0xdb3284!==null){logger[_0x43f8('0xb1')](_0x43f8('0xb8'),_0xdb3284);_0xdb3284[_0x43f8('0xb9')]=_0x221aac;throw _0xdb3284;}})[_0x43f8('0x9e')](function(_0x56fb8e){logger[_0x43f8('0x62')](_0x43f8('0xba'),_0x56fb8e);throw msgResponse(_0x43f8('0xbb'),_0x43f8('0x84'),util['inspect'](_0x56fb8e,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x43f8('0x2b')]=function(_0x305525){if(this['voiceQueues'][_0x305525[_0x43f8('0xbc')]]){if(this[_0x43f8('0x25')][_0x305525['uniqueid']]&&this[_0x43f8('0x25')][_0x305525[_0x43f8('0xbd')]][_0x43f8('0x3f')]!=='ivr'){this['updateOriginated'](this[_0x43f8('0x1e')][_0x305525['queue']]);this[_0x43f8('0x25')][_0x305525[_0x43f8('0xbd')]][_0x43f8('0xbe')]=moment()['format'](_0x43f8('0xbf'));}}};Dialer[_0x43f8('0x85')]['syncAgentComplete']=function(_0x49fdd5){var _0x333926=this[_0x43f8('0x25')][_0x49fdd5[_0x43f8('0xbd')]];if(this[_0x43f8('0x1e')][_0x49fdd5['queue']]){if(_0x333926&&_0x333926['type']!=='ivr'){delete this[_0x43f8('0x25')][_0x49fdd5[_0x43f8('0xbd')]];this[_0x43f8('0x1e')][_0x49fdd5[_0x43f8('0xbc')]][_0x43f8('0xc0')]+=0x1;var _0x36a5c3=new AgentComplete(_0x333926,_0x49fdd5);if(_0x49fdd5[_0x43f8('0xc1')]===_0x43f8('0xc2')){_0x36a5c3[_0x43f8('0xc3')]=this['voiceQueues'][_0x49fdd5['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x49fdd5['queue']][_0x43f8('0xc4')]?moment()['format'](_0x43f8('0xbf')):undefined;}hopperUtils[_0x43f8('0xc5')](_0x36a5c3)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0xc6')));hopperUtils['moveContactManagedDialer'](_0x36a5c3)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0xc7')));}}};Dialer[_0x43f8('0x85')][_0x43f8('0xc8')]=function(_0x5bc00f){var _0x2706d5=this[_0x43f8('0x25')][_0x5bc00f[_0x43f8('0xbd')]];var _0x4f1b91=this;var _0x287955=![];var _0x84b11a;var _0x44af61;if(this[_0x43f8('0x1e')][_0x5bc00f['queue']]){if(_0x2706d5&&_0x2706d5[_0x43f8('0x3f')]!=='ivr'){delete this[_0x43f8('0x25')][_0x5bc00f['uniqueid']];this[_0x43f8('0xc9')](this[_0x43f8('0x1e')][_0x5bc00f['queue']]);_0x2706d5[_0x43f8('0xca')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x3c053d=new QueueCallerAbandon(_0x2706d5,_0x5bc00f);if(utils[_0x43f8('0x5c')](_0x2706d5[_0x43f8('0xca')],_0x2706d5['responsetime'])>=_0x2706d5[_0x43f8('0xcb')]){this['voiceQueues'][_0x5bc00f['queue']][_0x43f8('0xcc')]+=0x1;this[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xcd')]+=0x1;this[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xce')]+=0x1;_0x3c053d['state']=0xa;_0x3c053d[_0x43f8('0xcf')]=_0x43f8('0xd0');_0x3c053d[_0x43f8('0xd1')]=_0x43f8('0xd2');_0x3c053d['agiafterat']=this[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xd3')]?moment()[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x3c053d[_0x43f8('0xd4')]+=0x1;_0x3c053d[_0x43f8('0xd5')]+=0x1;_0x84b11a=this[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xd6')];_0x44af61=this[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xd7')];hopperUtils['verifyAdditionalPhones'](_0x3c053d,_0x3c053d[_0x43f8('0x6b')],_0x2706d5['voiceQueue'])[_0x43f8('0x3b')](function(_0x11bef2){_0x287955=_0x11bef2[_0x43f8('0xd8')]==0x1;if(_0x3c053d[_0x43f8('0xd4')]>=_0x4f1b91[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xd9')]){_0x4f1b91[_0x43f8('0xda')](_0x3c053d,_0x11bef2[_0x43f8('0xd8')]);}else{hopperUtils[_0x43f8('0xdb')]({'active':![],'countdropretry':_0x3c053d[_0x43f8('0xd4')],'scheduledat':moment()[_0x43f8('0xdc')](_0x4f1b91[_0x43f8('0x1e')][_0x5bc00f['queue']][_0x43f8('0xd6')],_0x43f8('0xdd'))[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2706d5[_0x43f8('0xde')],'ListId':_0x2706d5[_0x43f8('0xdf')],'VoiceQueueId':_0x2706d5['VoiceQueueId']||undefined,'CampaignId':_0x2706d5[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch('[rescheduleContact][Drop]'));var _0x3e766f=new History(_0x3c053d);_0x3e766f[_0x43f8('0x6b')]=0xa;_0x3e766f[_0x43f8('0xcf')]=_0x43f8('0xd0');_0x3e766f['starttime']=moment()[_0x43f8('0x88')](_0x43f8('0xbf'));_0x3e766f[_0x43f8('0x6c')]=_0x3e766f[_0x43f8('0x6d')];_0x3e766f[_0x43f8('0xe1')]=_0x3c053d[_0x43f8('0xe1')];_0x3e766f[_0x43f8('0xe2')]=_0x3c053d[_0x43f8('0xe2')];hopperUtils[_0x43f8('0xc5')](_0x3e766f)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0xe3')));}})[_0x43f8('0x3b')](function(){if(_0x287955)hopperUtils[_0x43f8('0xe4')](_0x3c053d,_0x84b11a,_0x44af61)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0x4b')]+=0x1;this['voiceQueues'][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xe5')]+=0x1;_0x3c053d[_0x43f8('0x6b')]=0xb;_0x3c053d['statedesc']='Abandoned';_0x3c053d[_0x43f8('0xd1')]=_0x43f8('0xe6');_0x3c053d['countabandonedretry']+=0x1;_0x3c053d[_0x43f8('0xd5')]+=0x1;_0x84b11a=this[_0x43f8('0x1e')][_0x5bc00f['queue']][_0x43f8('0xe7')];_0x44af61=this['voiceQueues'][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xd7')];hopperUtils[_0x43f8('0xe8')](_0x3c053d,_0x3c053d[_0x43f8('0x6b')],_0x2706d5[_0x43f8('0xe9')])[_0x43f8('0x3b')](function(_0x583efc){if(_0x3c053d[_0x43f8('0xea')]>=_0x4f1b91[_0x43f8('0x1e')][_0x5bc00f[_0x43f8('0xbc')]][_0x43f8('0xeb')]){_0x4f1b91[_0x43f8('0xda')](_0x3c053d,_0x583efc['additional']);}else{hopperUtils[_0x43f8('0xdb')]({'active':![],'countabandonedretry':_0x3c053d['countabandonedretry'],'scheduledat':moment()[_0x43f8('0xdc')](_0x4f1b91[_0x43f8('0x1e')][_0x5bc00f['queue']][_0x43f8('0xe7')],_0x43f8('0xdd'))[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2706d5['ContactId'],'ListId':_0x2706d5['ListId'],'VoiceQueueId':_0x2706d5[_0x43f8('0xec')]||undefined,'CampaignId':_0x2706d5[_0x43f8('0xe0')]||undefined})['catch'](loggerCatch(_0x43f8('0xed')));var _0x2dbd75=new History(_0x3c053d);_0x2dbd75['state']=0xb;_0x2dbd75[_0x43f8('0xcf')]=_0x43f8('0xee');_0x2dbd75[_0x43f8('0x6d')]=moment()['format'](_0x43f8('0xbf'));_0x2dbd75[_0x43f8('0x6c')]=_0x2dbd75[_0x43f8('0x6d')];_0x2dbd75[_0x43f8('0xe1')]=_0x3c053d['calleridname'];_0x2dbd75['calleridnum']=_0x3c053d[_0x43f8('0xe2')];hopperUtils[_0x43f8('0xc5')](_0x2dbd75)[_0x43f8('0x9e')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x43f8('0x3b')](function(){if(_0x287955)hopperUtils[_0x43f8('0xe4')](_0x3c053d,_0x84b11a,_0x44af61)[_0x43f8('0x3b')](function(){return 0x1;});});}}}};Dialer[_0x43f8('0x85')][_0x43f8('0x33')]=function(_0x4db2a6){if(this[_0x43f8('0x24')][_0x4db2a6[_0x43f8('0xbd')]]){this['actions'][_0x4db2a6[_0x43f8('0xbd')]][_0x43f8('0xef')]=_0x4db2a6['channel'];}if(this['uniqueId'][_0x4db2a6['uniqueid']]){this['uniqueId'][_0x4db2a6[_0x43f8('0xbd')]][_0x43f8('0xef')]=_0x4db2a6[_0x43f8('0xef')];}};Dialer[_0x43f8('0x85')]['syncQueueMember']=function(_0x32c0e5){if(!this[_0x43f8('0x24')][_0x32c0e5['actionid']]){return;}var _0x3c3c2f=this['voiceQueues'][this['actions'][_0x32c0e5[_0x43f8('0xf0')]][_0x43f8('0xbc')]][_0x43f8('0xf1')]||_0x43f8('0xf2');if(_0x3c3c2f===_0x43f8('0xf3')){if(this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]]&&_['isNil'](this[_0x43f8('0x24')][_0x32c0e5['actionid']][_0x43f8('0xf4')])&&_0x32c0e5[_0x43f8('0xf5')]==='1'&&_0x32c0e5['paused']==='0'){if(this[_0x43f8('0x20')][_0x32c0e5[_0x43f8('0xf6')]]){if(!this[_0x43f8('0x20')][_0x32c0e5[_0x43f8('0xf6')]][_0x43f8('0xf4')]){this[_0x43f8('0x20')][_0x32c0e5[_0x43f8('0xf6')]]['locked']=!![];this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]]['locked']=!![];this['actions'][_0x32c0e5[_0x43f8('0xf0')]][_0x43f8('0xf6')]=_0x32c0e5[_0x43f8('0xf6')];}}}}else if(_0x3c3c2f===_0x43f8('0xf2')){if(this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]]){if(this['agents'][_0x32c0e5[_0x43f8('0xf6')]]){this['actions'][_0x32c0e5[_0x43f8('0xf0')]][_0x43f8('0xf6')]=_0x32c0e5[_0x43f8('0xf6')];if(_['isNil'](this[_0x43f8('0xf7')][this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]][_0x43f8('0xbc')]])){this['queueBooked'][this['actions'][_0x32c0e5['actionid']][_0x43f8('0xbc')]]=[];}this['queueBooked'][this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]][_0x43f8('0xbc')]][_0x43f8('0xf8')](_[_0x43f8('0x5b')](_['pick'](this[_0x43f8('0x24')][_0x32c0e5[_0x43f8('0xf0')]],[_0x43f8('0xf9'),_0x43f8('0xf6')]),{'status':_0x32c0e5[_0x43f8('0xf5')],'paused':_0x32c0e5[_0x43f8('0xfa')]}));}}}};Dialer[_0x43f8('0x85')][_0x43f8('0x37')]=function(_0x24f20a){if(!this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]){return;}var _0x2ef70f=this;var _0x891fa6=this[_0x43f8('0x1e')][this[_0x43f8('0x24')][_0x24f20a['actionid']][_0x43f8('0xbc')]];var _0x234fa6=_0x891fa6[_0x43f8('0xf1')]||'rrmemory';if(_0x234fa6===_0x43f8('0xf3')){if(this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]&&this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xf6')]){this[_0x43f8('0x1d')]['run'](this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['idHopper'],this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xf6')])['catch'](function(_0x2e1818){logger[_0x43f8('0x62')](_0x43f8('0xfb'),util[_0x43f8('0x43')](_0x2e1818,{'showHidden':![],'depth':null}));})[_0x43f8('0x1b')](function(){_0x2ef70f['updateOriginated'](_0x2ef70f['voiceQueues'][_0x2ef70f['actions'][_0x24f20a[_0x43f8('0xf0')]]['queue']]);_0x2ef70f[_0x43f8('0x20')][_0x2ef70f[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xf6')]][_0x43f8('0xf4')]=![];delete _0x2ef70f[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]];unlockQueueStatus(_0x891fa6);});}else{this['updateOriginated'](this[_0x43f8('0x1e')][this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['queue']]);hopperUtils[_0x43f8('0xdb')]({'active':![],'ContactId':this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['ContactId'],'ListId':this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xdf')],'VoiceQueueId':this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xec')]||undefined,'CampaignId':this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x43f8('0xfc')));delete this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]];unlockQueueStatus(_0x891fa6);}}else if(_0x234fa6===_0x43f8('0xf2')){var _0x26d31c;if(this[_0x43f8('0x24')][_0x24f20a['actionid']]&&!_['isEmpty'](this[_0x43f8('0xf7')][this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['queue']])){if(this[_0x43f8('0x29')][_0x2ef70f[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xbc')]]){this[_0x43f8('0x29')][_0x2ef70f[_0x43f8('0x24')][_0x24f20a['actionid']][_0x43f8('0xbc')]]=this[_0x43f8('0x29')][this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]]['queue']]?this[_0x43f8('0x29')][this[_0x43f8('0x24')][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xbc')]]:this[_0x43f8('0xf7')][this['actions'][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xbc')]]?this[_0x43f8('0xf7')][this['actions'][_0x24f20a[_0x43f8('0xf0')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this['actions'][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xbc')]][_0x43f8('0xfd')]=this[_0x43f8('0x29')][this['actions'][_0x24f20a[_0x43f8('0xf0')]][_0x43f8('0xbc')]];for(var _0x196930=0x0;_0x196930=_0x53f829[_0x43f8('0x125')]){_0x4d5e4f['stateGlobal'](_0x2131b1,_0x188fa7,_0x21502d,_0x43f8('0x126'));}else{if(_0x2131b1['countmachineretry']>=_0x53f829[_0x43f8('0x127')]){_0x4d5e4f[_0x43f8('0x128')](_0x2131b1,_0x188fa7,_0x21502d,_0x43f8('0x129'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2131b1[_0x43f8('0x11f')],'scheduledat':moment()[_0x43f8('0xdc')](_0x53f829[_0x43f8('0x12a')],_0x43f8('0xdd'))[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2131b1[_0x43f8('0xde')],'ListId':_0x2131b1[_0x43f8('0xdf')],'VoiceQueueId':_0x2131b1['VoiceQueueId']||undefined,'CampaignId':_0x2131b1[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x12b')));_0x188fa7({'reschedule':0x1});}}});}if(_0x271835[_0x43f8('0x3f')]===_0x43f8('0x10b')&&this[_0x43f8('0x1f')][_0x271835[_0x43f8('0xbc')]][_0x43f8('0x114')]&&_0xc90f05[_0x43f8('0x115')]===_0x43f8('0x116')){delete this['uniqueId'][_0xc90f05[_0x43f8('0xbd')]];this['updateOriginated'](this[_0x43f8('0x1f')][_0x271835[_0x43f8('0xbc')]]);_0x2152d2=new Hangup(_0x271835,_0xc90f05);_0x2152d2['state']=0x12;_0x2152d2[_0x43f8('0xcf')]=_0x43f8('0x12c');_0x2152d2[_0x43f8('0x118')]=_0x43f8('0x11e');ami['emit']('custom:amd',ut[_0x43f8('0x120')](_0x2152d2,_0x43f8('0x11a')));this['saveInDb'](_0x2152d2,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x271835[_0x43f8('0x3f')]===_0x43f8('0x10b')&&this[_0x43f8('0x1f')][_0x271835[_0x43f8('0xbc')]][_0x43f8('0x114')]&&_0xc90f05['value']===_0x43f8('0x11c')){return new Promise(function(_0x130e31,_0x413eed){delete _0x4d5e4f[_0x43f8('0x25')][_0xc90f05[_0x43f8('0xbd')]];_0x4d5e4f[_0x43f8('0xc9')](_0x4d5e4f[_0x43f8('0x1f')][_0x271835['queue']]);_0x4d5e4f[_0x43f8('0x1f')][_0x271835[_0x43f8('0xbc')]][_0x43f8('0xc0')]+=0x1;_0x4d5e4f['campaigns'][_0x271835[_0x43f8('0xbc')]][_0x43f8('0x117')]+=0x1;var _0xd464b3=_0x4d5e4f[_0x43f8('0x1f')][_0x271835['queue']];var _0x5bc826=new Hangup(_0x271835,_0xc90f05);_0x5bc826[_0x43f8('0x6b')]=0x13;_0x5bc826[_0x43f8('0xcf')]=_0x43f8('0x11d');_0x5bc826['membername']=_0x43f8('0x11e');_0x5bc826[_0x43f8('0x11f')]+=0x1;_0x5bc826['countglobal']+=0x1;_0x5bc826['amd']=!![];ami[_0x43f8('0x3e')]('custom:amd',ut['buildObj'](_0x5bc826,'amd'));hopperUtils[_0x43f8('0xc5')](_0x5bc826)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5bc826[_0x43f8('0x121')]+_0x5bc826[_0x43f8('0x12d')]+_0x5bc826[_0x43f8('0x122')]+_0x5bc826[_0x43f8('0x123')]+_0x5bc826[_0x43f8('0xd4')]+_0x5bc826[_0x43f8('0xea')]+_0x5bc826[_0x43f8('0x11f')]+_0x5bc826[_0x43f8('0x124')]>=_0xd464b3[_0x43f8('0x125')]){_0x4d5e4f[_0x43f8('0x12e')](_0x5bc826,_0x130e31,_0x413eed,_0x43f8('0x126'));}else{if(_0x5bc826['countmachineretry']>=_0xd464b3['dialMachineMaxRetry']){_0x4d5e4f[_0x43f8('0x128')](_0x5bc826,_0x130e31,_0x413eed,'reason\x2019\x20machine....');}else{hopperUtils[_0x43f8('0xdb')]({'active':![],'countmachineretry':_0x5bc826[_0x43f8('0x11f')],'scheduledat':moment()[_0x43f8('0xdc')](_0xd464b3[_0x43f8('0x12a')],_0x43f8('0xdd'))[_0x43f8('0x88')](_0x43f8('0xbf')),'ContactId':_0x5bc826[_0x43f8('0xde')],'ListId':_0x5bc826[_0x43f8('0xdf')],'VoiceQueueId':_0x5bc826['VoiceQueueId']||undefined,'CampaignId':_0x5bc826[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch('[rescheduleContact][Machine]'));_0x130e31({'reschedule':0x1});}}});}}};Dialer[_0x43f8('0x85')][_0x43f8('0x32')]=function(_0x393094){var _0x4f1444=this[_0x43f8('0x25')][_0x393094['uniqueid']];var _0xf7e361;if(_0x4f1444&&_0x4f1444['type']===_0x43f8('0x10b')){delete this[_0x43f8('0x25')][_0x393094[_0x43f8('0xbd')]];this[_0x43f8('0xc9')](this[_0x43f8('0x1f')][_0x4f1444[_0x43f8('0xbc')]]);this[_0x43f8('0x1f')][_0x4f1444[_0x43f8('0xbc')]][_0x43f8('0x12f')]+=0x1;_0xf7e361=new Hangup(_0x4f1444,_0x393094);hopperUtils[_0x43f8('0xc5')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x130')));hopperUtils[_0x43f8('0x131')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x132')));}if(_0x4f1444&&_0x4f1444[_0x43f8('0x3f')]!=='ivr'&&isNotNull(this[_0x43f8('0x1e')][_0x4f1444[_0x43f8('0xbc')]]['dialQueueProject'])){delete this['uniqueId'][_0x393094['uniqueid']];this[_0x43f8('0xc9')](this[_0x43f8('0x1e')][_0x4f1444[_0x43f8('0xbc')]]);this[_0x43f8('0x1e')][_0x4f1444[_0x43f8('0xbc')]][_0x43f8('0xc0')]+=0x1;this[_0x43f8('0x1e')][_0x4f1444['queue']][_0x43f8('0x117')]+=0x1;_0xf7e361=new Hangup(_0x4f1444,_0x393094);_0xf7e361[_0x43f8('0x6b')]=0x10;_0xf7e361[_0x43f8('0xcf')]='AnswerAGI';_0xf7e361[_0x43f8('0x118')]='AGI';hopperUtils[_0x43f8('0xc5')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x43f8('0x131')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x132')));}if(_0x4f1444&&_0x4f1444[_0x43f8('0x3f')]!==_0x43f8('0x10b')&&!isNotNull(this[_0x43f8('0x1e')][_0x4f1444['queue']][_0x43f8('0x133')])){delete this['uniqueId'][_0x393094[_0x43f8('0xbd')]];this[_0x43f8('0xc9')](this[_0x43f8('0x1e')][_0x4f1444[_0x43f8('0xbc')]]);this[_0x43f8('0x1e')][_0x4f1444[_0x43f8('0xbc')]]['outboundUnknownCallsDay']+=0x1;_0xf7e361=new Hangup(_0x4f1444,_0x393094);_0xf7e361['state']=0xc;_0xf7e361['statedesc']=_0x393094[_0x43f8('0x134')];_0xf7e361[_0x43f8('0x118')]=_0x43f8('0x135');hopperUtils[_0x43f8('0xc5')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x130')));hopperUtils[_0x43f8('0x131')](_0xf7e361)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x132')));}};Dialer[_0x43f8('0x85')][_0x43f8('0xc')]=function(_0x53ca2e){var _0x343cf0=this;if(!_0x343cf0[_0x43f8('0x136')][_0x53ca2e[_0x43f8('0x45')]]){_0x343cf0[_0x43f8('0x136')][_0x53ca2e[_0x43f8('0x45')]]={'running':![]};}else if(_0x343cf0[_0x43f8('0x136')][_0x53ca2e['name']][_0x43f8('0x137')]===!![]){return;}else if(_0x343cf0[_0x43f8('0x136')][_0x53ca2e[_0x43f8('0x45')]][_0x43f8('0x137')]===![]){_0x343cf0[_0x43f8('0x136')][_0x53ca2e['name']][_0x43f8('0x137')]=!![];}var _0x5d9f1e=_0x343cf0[_0x43f8('0x1e')][_0x53ca2e['name']];var _0x5a52e6=_0x5d9f1e['message']!==utils[_0x43f8('0x74')][_0x43f8('0x79')];var _0x275baf=utils[_0x43f8('0x138')](_0x5d9f1e);_0x5d9f1e['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5d9f1e,_0x343cf0[_0x43f8('0x21')]);Promise[_0x43f8('0x139')]()[_0x43f8('0x3b')](function(){if(_0x5d9f1e[_0x43f8('0x13a')]===utils[_0x43f8('0x74')][_0x43f8('0x79')]){if(_0x5a52e6){clearPredictiveAttributes(_0x5d9f1e);_0x53ca2e[_0x43f8('0x5e')]=undefined;_0x53ca2e[_0x43f8('0x27')]=undefined;}if(_0x5d9f1e[_0x43f8('0x13a')]===utils['CAMPAIGN_STATUS'][_0x43f8('0x79')]){_0x53ca2e['available']=0x0;_0x53ca2e['paused']=0x0;_0x53ca2e['inUse']=0x0;_0x53ca2e[_0x43f8('0x13b')]=0x0;_0x53ca2e[_0x43f8('0x13c')]=0x0;}}else if(_0x5d9f1e[_0x43f8('0x13a')]===utils[_0x43f8('0x74')][_0x43f8('0x13d')]&&!_0x275baf){return _0x343cf0['ifTime'](_0x5d9f1e,!![])[_0x43f8('0x3b')](function(){return _0x343cf0[_0x43f8('0x92')](_0x5d9f1e,![]);})[_0x43f8('0x3b')](function(){return _0x343cf0[_0x43f8('0xa9')](_0x5d9f1e);})[_0x43f8('0x9e')](function(_0x56d090){loggerSyncQueueSummary[_0x43f8('0x41')](_0x43f8('0x13e'),util[_0x43f8('0x43')](_0x56d090,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5d9f1e);});}else{clearPredictiveAttributes(_0x5d9f1e);}})[_0x43f8('0x3b')](function(){var _0x5a1fe2=_0x53ca2e['compareToOutboundQueue'](_0x5d9f1e);if(_0x5a1fe2||_0x5d9f1e['queueSummaryCountersUpdated']){_0x5d9f1e[_0x43f8('0x13f')]=![];_0x53ca2e['updateReportFromOutboundQueue'](_0x5d9f1e);Object['assign'](_0x5d9f1e,_0x53ca2e);emitOutboundVoiceQueueSummary(_0x53ca2e);}_0x343cf0[_0x43f8('0x136')][_0x5d9f1e[_0x43f8('0x45')]][_0x43f8('0x137')]=![];})[_0x43f8('0x9e')](function(_0x5c4e5b){logger[_0x43f8('0x62')](_0x43f8('0x13e'),util['inspect'](_0x5c4e5b,{'showHidden':![],'depth':null}));_0x343cf0[_0x43f8('0x136')][_0x5d9f1e['name']][_0x43f8('0x137')]=![];});};Dialer[_0x43f8('0x85')]['syncQueueSummaryComplete']=_[_0x43f8('0x140')](function(){var _0x168899=_[_0x43f8('0x141')](this[_0x43f8('0x1e')],function(_0x4805b8){return _0x4805b8[_0x43f8('0x142')];});var _0x3e901=_[_0x43f8('0x141')](this[_0x43f8('0x20')],function(_0x529a4d){return _0x529a4d[_0x43f8('0x143')]&&_0x529a4d['status']==='reachable';});if(_0x168899[_0x43f8('0xfe')]>0x0&&_0x3e901[_0x43f8('0xfe')]>0x0){return Promise[_0x43f8('0x139')]()[_0x43f8('0x3b')](cmHopper['handlePreviewRecallNotifications'](_[_0x43f8('0x144')](_0x168899,'id'),previewRecallmeReminderInterval,_[_0x43f8('0x144')](_0x3e901,'id')))[_0x43f8('0x3b')](function(_0x309681){for(var _0x4974ec=0x0;_0x4974ec<_0x309681[_0x43f8('0xfe')];_0x4974ec++){var _0x1a68ef=_0x309681[_0x4974ec][_0x43f8('0x145')][_0x43f8('0x45')];if(_0x1a68ef)io['to'](util[_0x43f8('0x88')](_0x43f8('0x146'),_0x1a68ef))[_0x43f8('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x309681[_0x4974ec]});}})[_0x43f8('0x9e')](function(_0x1ca779){logger['error']('checkPreviewRecallReminder',_0x1ca779);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x43f8('0x85')][_0x43f8('0x39')]=function(){var _0x465398=this;setInterval(function(){_0x465398[_0x43f8('0x147')](_0x465398[_0x43f8('0x25')],_0x43f8('0x148'));_0x465398['clearZombieChannels'](_0x465398[_0x43f8('0x24')],_0x43f8('0x149'));},0x32c8);};Dialer[_0x43f8('0x85')]['clearZombieChannels']=function(_0x151333,_0x4acf06){var _0x32b906=this;for(var _0x3a3774 in _0x151333){if(typeof _0x151333[_0x3a3774]!==_0x43f8('0xa5')){this[_0x43f8('0x1c')][_0x43f8('0x19')](function(){if(!_['isNil'](_0x151333[_0x3a3774])){return ami[_0x43f8('0x98')]({'action':_0x43f8('0xf5'),'channel':_0x151333[_0x3a3774][_0x43f8('0xef')]})[_0x43f8('0x9e')](function(_0x3284ac){if(_0x3284ac[_0x43f8('0x68')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x151333[_0x3a3774]&&_0x151333[_0x3a3774][_0x43f8('0x3f')]!==_0x43f8('0x10b')){_0x32b906['updateOriginated'](_0x32b906['voiceQueues'][_0x151333[_0x3a3774][_0x43f8('0xbc')]]);logger[_0x43f8('0x62')](_0x43f8('0x14a'),_0x4acf06,_0x3a3774,_0x151333[_0x3a3774][_0x43f8('0xbc')]);delete _0x151333[_0x3a3774];}if(_0x151333[_0x3a3774]&&_0x151333[_0x3a3774][_0x43f8('0x3f')]===_0x43f8('0x10b')){_0x32b906[_0x43f8('0xc9')](_0x32b906[_0x43f8('0x1f')][_0x151333[_0x3a3774]['queue']]);logger[_0x43f8('0x62')](_0x43f8('0x14b'),_0x4acf06,_0x3a3774,_0x151333[_0x3a3774][_0x43f8('0xbc')]);delete _0x151333[_0x3a3774];}},0x2328);}});}});}}};Dialer['prototype'][_0x43f8('0x14c')]=function(_0x5401b9){return Promise[_0x43f8('0x139')]()[_0x43f8('0x3b')](voiceQueueRt[_0x43f8('0x14c')](_0x5401b9))[_0x43f8('0x9e')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x43f8('0xc9')]=function(_0x26db5c){if(!_[_0x43f8('0x3d')](_0x26db5c)&&_0x26db5c!==null){if(typeof _0x26db5c[_0x43f8('0x7f')]!==_0x43f8('0xa5')){if(_0x26db5c[_0x43f8('0x7f')]>0x0){_0x26db5c[_0x43f8('0x7f')]-=0x1;}else{logger[_0x43f8('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x43f8('0x62')](_0x43f8('0x14d'));}};Dialer[_0x43f8('0x85')]['loggerHandler']=function(_0x46ded8,_0x431a20){var _0x430042=this;return function(_0x3a715d){_0x430042['updateOriginated'](_0x431a20);logger['error'](_0x46ded8,util['inspect'](_0x3a715d,{'showHidden':![],'depth':null}));};};Dialer[_0x43f8('0x85')][_0x43f8('0x14e')]=function(_0x2df870,_0x8ee3d2,_0x10583d){var _0x1708bf={'state':0x19,'statedesc':_0x43f8('0x14f')};this['updateOriginated'](_0x8ee3d2);this[_0x43f8('0x11b')](_[_0x43f8('0x5b')](_0x1708bf,_['pick'](_0x10583d,[_0x43f8('0xde'),_0x43f8('0xdf'),_0x43f8('0x150'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0x43f8('0x151'));logger['error'](_0x2df870);};Dialer[_0x43f8('0x85')][_0x43f8('0x11b')]=function(_0x10ea6e,_0x9c6e84,_0x16893a){hopperUtils[_0x43f8('0xc5')](_0x10ea6e)[_0x43f8('0x9e')](loggerCatch(_0x9c6e84));hopperUtils['moveContactManagedDialer'](_0x10ea6e)[_0x43f8('0x9e')](loggerCatch(_0x16893a));};Dialer[_0x43f8('0x85')][_0x43f8('0xda')]=function(_0x59a031,_0x5b7827){hopperUtils[_0x43f8('0xc5')](_0x59a031)[_0x43f8('0x9e')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5b7827==0x0){hopperUtils['moveContactManagedDialer'](_0x59a031)[_0x43f8('0x9e')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x43f8('0x85')][_0x43f8('0x152')]=function(_0x2e84c4){return Promise[_0x43f8('0x139')]()['then'](cmHopper[_0x43f8('0x153')](_0x2e84c4['id'],previewRecallmeReminderInterval))[_0x43f8('0x3b')](function(_0x1a637e){for(var _0x110d4d=0x0;_0x110d4d<_0x1a637e['length'];_0x110d4d++){var _0x18707f=_0x1a637e[_0x110d4d]['Agent'][_0x43f8('0x45')];if(_0x18707f)io['to'](util[_0x43f8('0x88')](_0x43f8('0x146'),_0x18707f))[_0x43f8('0x3e')]('user:dialPreviewRecallReminder',{'hopper':_0x1a637e[_0x110d4d]});}})[_0x43f8('0x9e')](function(){});};Dialer[_0x43f8('0x85')][_0x43f8('0x154')]=function(_0x8ce56a){var _0x380c13=this;return function(){_0x380c13[_0x43f8('0x155')](_0x8ce56a);};};Dialer[_0x43f8('0x85')]['actionOriginate']=function(_0x8b3c97,_0x4f1e8f){var _0x3ed42b=this;var _0x4c1052=uuid['v4']();this[_0x43f8('0x24')][_0x4c1052]=new Action(_0x8b3c97,_0x4f1e8f,_0x4c1052);return new Promise(function(_0x45719a,_0x2727b9){if(_[_0x43f8('0x3d')](_0x8b3c97)&&typeof _0x8b3c97!=='object'){return _0x2727b9(msgResponse(_0x43f8('0x156'),_0x43f8('0x93'),_0x43f8('0x157')));}if(_[_0x43f8('0x3d')](_0x4f1e8f[_0x43f8('0x158')])||_0x4f1e8f['phone']===null){return _0x2727b9(msgResponse(_0x43f8('0x156'),_0x43f8('0x93'),_0x43f8('0x159')));}var _0x11247a={'XMD-CALLERID':_0x3ed42b[_0x43f8('0x24')][_0x4c1052][_0x43f8('0x15a')](),'XMD-AGI':_0x8b3c97[_0x43f8('0x133')]?util[_0x43f8('0x88')](_0x43f8('0x15b'),ipAgi,_0x8b3c97[_0x43f8('0x133')]):_0x43f8('0x15c'),'XMD-AGIAFTER':_0x8b3c97[_0x43f8('0xd3')]?util[_0x43f8('0x88')](_0x43f8('0x15b'),ipAgi,_0x8b3c97[_0x43f8('0xd3')]):'NONE','XMD-QUEUE':utils[_0x43f8('0x15d')](_0x8b3c97)?util[_0x43f8('0x88')](_0x43f8('0x15e'),_0x8b3c97['name'],_0x8b3c97[_0x43f8('0x15f')]||'',_0x8b3c97[_0x43f8('0xc4')]?'c':'',_0x8b3c97[_0x43f8('0xcb')]||0x3):_0x43f8('0x15c'),'XMD-CONTACTID':_0x4f1e8f[_0x43f8('0xde')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3ed42b['actions'][_0x4c1052][_0x43f8('0x15a')](),'XMD-AMD':_0x8b3c97['dialAMDActive']?_0x43f8('0x13d'):'NONE','XMD-DESTINATION':_0x43f8('0x113')};if(_0x8b3c97[_0x43f8('0x114')]){_0x11247a[_0x43f8('0x160')]=_0x8b3c97[_0x43f8('0x161')]||0x9c4;_0x11247a[_0x43f8('0x162')]=_0x8b3c97['dialAMDGreeting']||0x5dc;_0x11247a[_0x43f8('0x163')]=_0x8b3c97[_0x43f8('0x164')]||0x320;_0x11247a[_0x43f8('0x165')]=_0x8b3c97['dialAMDTotalAnalysisTime']||0x1388;_0x11247a[_0x43f8('0x166')]=_0x8b3c97[_0x43f8('0x167')]||0x64;_0x11247a[_0x43f8('0x168')]=_0x8b3c97[_0x43f8('0x169')]||0x32;_0x11247a[_0x43f8('0x16a')]=_0x8b3c97[_0x43f8('0x16b')]||0x3;_0x11247a[_0x43f8('0x16c')]=_0x8b3c97[_0x43f8('0x16d')]||0x100;_0x11247a['XMD-AMDMAXIMUMWORDLENGTH']=_0x8b3c97[_0x43f8('0x16e')]||0x1388;}if(utils[_0x43f8('0x15d')](_0x8b3c97)){_0x11247a[_0x43f8('0x16f')]=_0x4f1e8f[_0x43f8('0xec')];}else{_0x11247a[_0x43f8('0x170')]=_0x4f1e8f['CampaignId'];}var _0x518512=utils[_0x43f8('0x171')](_0x4f1e8f[_0x43f8('0x172')]);Object['assign'](_0x11247a,_0x518512);var _0x439da9=_0x3ed42b['isTrunkReachable'](_0x8b3c97['Trunk'])?utils[_0x43f8('0x173')](_0x8b3c97['Trunk']['callerid'],_0x8b3c97[_0x43f8('0x174')],_0x8b3c97[_0x43f8('0x175')]>0x0?utils[_0x43f8('0x176')](_0x8b3c97[_0x43f8('0x177')],_0x8b3c97[_0x43f8('0x175')]):_0x8b3c97[_0x43f8('0x177')]):utils[_0x43f8('0x173')](_['isNil'](_0x8b3c97[_0x43f8('0x8d')])?_0x8b3c97[_0x43f8('0x8c')]['callerid']:_0x8b3c97[_0x43f8('0x8d')]['callerid'],_0x8b3c97[_0x43f8('0x174')],_0x8b3c97[_0x43f8('0x175')]>0x0?utils['getCallerIdRandom'](_0x8b3c97[_0x43f8('0x177')],_0x8b3c97[_0x43f8('0x175')]):_0x8b3c97[_0x43f8('0x177')]);if(_0x439da9){_0x11247a['XMD-ORIGINATECALLERIDNAME']=_0x3ed42b[_0x43f8('0x24')][_0x4c1052][_0x43f8('0x178')]=utils['extractCalleridName'](_0x439da9);_0x11247a['XMD-ORIGINATECALLERIDNUM']=_0x4f1e8f[_0x43f8('0x158')];}_0x8b3c97[_0x43f8('0x179')]=_0x11247a;return ami[_0x43f8('0x98')]({'actionid':_0x4c1052,'action':_0x43f8('0x156'),'channel':_0x3ed42b['isTrunkReachable'](_0x8b3c97['Trunk'])?util[_0x43f8('0x88')](_0x43f8('0x17a'),_0x8b3c97[_0x43f8('0x8c')][_0x43f8('0x45')],isNotNull(_0x8b3c97[_0x43f8('0x17b')])?_0x8b3c97['dialPrefix']['trim']()||'':'',_0x8b3c97[_0x43f8('0x17c')]>0x0?_0x4f1e8f[_0x43f8('0x158')]['substring'](_0x8b3c97[_0x43f8('0x17c')]):_0x4f1e8f[_0x43f8('0x158')]):util[_0x43f8('0x88')](_0x43f8('0x17a'),_['isNil'](_0x8b3c97[_0x43f8('0x8d')])?_0x8b3c97[_0x43f8('0x8c')][_0x43f8('0x45')]:_0x8b3c97[_0x43f8('0x8d')][_0x43f8('0x45')],isNotNull(_0x8b3c97['dialPrefix'])?_0x8b3c97[_0x43f8('0x17b')]['trim']()||'':'',_0x8b3c97[_0x43f8('0x17c')]>0x0?_0x4f1e8f['phone'][_0x43f8('0x17d')](_0x8b3c97[_0x43f8('0x17c')]):_0x4f1e8f[_0x43f8('0x158')]),'callerid':_0x439da9,'Exten':_0x43f8('0x113'),'Context':_0x43f8('0x17e'),'Priority':'1','variable':_0x11247a,'timeout':(_0x8b3c97[_0x43f8('0x17f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4c1052})[_0x43f8('0x3b')](function(_0x16c7ff){return _0x45719a(_0x16c7ff);})[_0x43f8('0x9e')](function(_0x3a52ad){_0x8b3c97[_0x43f8('0x180')]+=0x1;var _0x5c1b10=new History(_0x3ed42b[_0x43f8('0x24')][_0x4c1052]);logger['error'](util['format'](_0x43f8('0x181'),JSON[_0x43f8('0x71')](_0x3a52ad)));_0x5c1b10[_0x43f8('0x6b')]=0xe;_0x5c1b10['statedesc']='OriginateError';_0x5c1b10[_0x43f8('0x6d')]=moment()[_0x43f8('0x88')](_0x43f8('0xbf'));_0x5c1b10['endtime']=_0x5c1b10[_0x43f8('0x6d')];hopperUtils[_0x43f8('0xc5')](_0x5c1b10)['catch'](loggerCatch('[originate][error]'));_0x3ed42b['moveContactManagedDialer'](_0x5c1b10)[_0x43f8('0x9e')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3ed42b[_0x43f8('0x24')][_0x4c1052];return _0x2727b9(msgResponse(_0x43f8('0x156'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0x43f8('0x85')][_0x43f8('0x182')]=function(_0x1e9272,_0xc84078,_0x5b64c3){var _0x19fab1=new History(_0xc84078);if(_0x19fab1[_0x43f8('0x121')]+_0x19fab1[_0x43f8('0x12d')]+_0x19fab1[_0x43f8('0x122')]+_0x19fab1[_0x43f8('0x123')]+_0x19fab1[_0x43f8('0xd4')]+_0x19fab1[_0x43f8('0xea')]+_0x19fab1[_0x43f8('0x11f')]+_0x19fab1[_0x43f8('0x124')]>=_0x5b64c3[_0x43f8('0x125')]-0x1){return!![];}switch(_0x1e9272){case 0x3:if(_0x19fab1[_0x43f8('0x122')]>=_0x5b64c3['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x43f8('0xdb')]({'active':![],'countnoanswerretry':_0x19fab1[_0x43f8('0x122')]+=0x1,'scheduledat':moment()[_0x43f8('0xdc')](_0x5b64c3[_0x43f8('0x183')],_0x43f8('0xdd'))['format'](_0x43f8('0xbf')),'ContactId':_0x19fab1['ContactId'],'ListId':_0x19fab1['ListId'],'VoiceQueueId':_0x19fab1['VoiceQueueId']||undefined,'CampaignId':_0x19fab1[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x184')));break;case 0x5:if(_0x19fab1[_0x43f8('0x121')]>=_0x5b64c3['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x43f8('0xdb')]({'active':![],'countbusyretry':_0x19fab1[_0x43f8('0x121')]+=0x1,'scheduledat':moment()[_0x43f8('0xdc')](_0x5b64c3[_0x43f8('0x185')],_0x43f8('0xdd'))[_0x43f8('0x88')](_0x43f8('0xbf')),'ContactId':_0x19fab1['ContactId'],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x186')));break;case 0x8:if(_0x19fab1[_0x43f8('0x12d')]>=_0x5b64c3[_0x43f8('0x187')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x19fab1['countcongestionretry']+=0x1,'scheduledat':moment()[_0x43f8('0xdc')](_0x5b64c3['dialCongestionRetryFrequency'],_0x43f8('0xdd'))['format'](_0x43f8('0xbf')),'ContactId':_0x19fab1['ContactId'],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x188')));break;case 0x0:if(_0x19fab1['countnosuchnumberretry']>=_0x5b64c3[_0x43f8('0x189')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x19fab1[_0x43f8('0x123')]+=0x1,'scheduledat':moment()[_0x43f8('0xdc')](_0x5b64c3[_0x43f8('0x18a')],_0x43f8('0xdd'))[_0x43f8('0x88')](_0x43f8('0xbf')),'ContactId':_0x19fab1[_0x43f8('0xde')],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1['VoiceQueueId']||undefined,'CampaignId':_0x19fab1['CampaignId']||undefined})[_0x43f8('0x9e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x19fab1[_0x43f8('0xd4')]>=_0x5b64c3[_0x43f8('0xd9')]-0x1){return!![];}hopperUtils[_0x43f8('0xdb')]({'active':![],'countdropretry':_0x19fab1[_0x43f8('0xd4')]+=0x1,'scheduledat':moment()[_0x43f8('0xdc')](_0x5b64c3['dialDropRetryFrequency'],_0x43f8('0xdd'))['format'](_0x43f8('0xbf')),'ContactId':_0x19fab1['ContactId'],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1['CampaignId']||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x18b')));break;case 0xb:if(_0x19fab1['countabandonedretry']>=_0x5b64c3[_0x43f8('0xeb')]-0x1){return!![];}hopperUtils[_0x43f8('0xdb')]({'active':![],'countabandonedretry':_0x19fab1[_0x43f8('0xea')]+=0x1,'scheduledat':moment()['add'](_0x5b64c3[_0x43f8('0xe7')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fab1[_0x43f8('0xde')],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1['CampaignId']||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0xed')));break;case 0x13:if(_0x19fab1[_0x43f8('0x11f')]>=_0x5b64c3['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x43f8('0xdb')]({'active':![],'countmachineretry':_0x19fab1['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x5b64c3['dialMachineRetryFrequency'],_0x43f8('0xdd'))[_0x43f8('0x88')](_0x43f8('0xbf')),'ContactId':_0x19fab1[_0x43f8('0xde')],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1[_0x43f8('0xe0')]||undefined})['catch'](loggerCatch(_0x43f8('0x12b')));break;case 0x14:if(_0x19fab1[_0x43f8('0x124')]>=_0x5b64c3[_0x43f8('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x19fab1[_0x43f8('0x124')]+=0x1,'scheduledat':moment()['add'](_0x5b64c3[_0x43f8('0x18d')],_0x43f8('0xdd'))[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fab1['ContactId'],'ListId':_0x19fab1[_0x43f8('0xdf')],'VoiceQueueId':_0x19fab1[_0x43f8('0xec')]||undefined,'CampaignId':_0x19fab1['CampaignId']||undefined})['catch'](loggerCatch(_0x43f8('0x18e')));break;default:return!![];}};Dialer[_0x43f8('0x85')]['callProgressDetecting']=function(_0x4e6eca,_0x4b8c15,_0x3cba72){var _0x52998d=this;var _0x486215=new History(_0x4e6eca);var _0xc29c5c=![];var _0xfd91f8;var _0x5ee2a4;return new Promise(function(_0x33cdbf,_0x24346a){if(_[_0x43f8('0x3d')](_0x4b8c15)&&typeof _0x4b8c15!=='object'){return _0x24346a(msgResponse(_0x43f8('0x18f'),_0x43f8('0x93'),'entity\x20is\x20undefine'));}if(_[_0x43f8('0x3d')](_0x3cba72)&&typeof _0x3cba72!=='object'){return _0x24346a(msgResponse('[callProgressDetecting]',_0x43f8('0x93'),_0x43f8('0x190')));}hopperUtils['verifyAdditionalPhones'](_0x486215,_0x3cba72[_0x43f8('0xc1')],_0x4b8c15)['then'](function(_0x542804){if(_0x542804[_0x43f8('0xd8')]==0x1)_0xc29c5c=!![];switch(_0x3cba72['reason']){case'0':_0x4b8c15[_0x43f8('0x191')]+=0x1;_0x486215[_0x43f8('0x6b')]=0x0;_0x486215[_0x43f8('0xcf')]=_0x43f8('0x192');_0x486215[_0x43f8('0x123')]+=0x1;_0x486215[_0x43f8('0xd5')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x43f8('0x120')](_0x4e6eca,_0x43f8('0x193')));_0xfd91f8=_0x4b8c15[_0x43f8('0x18a')];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];hopperUtils[_0x43f8('0xc5')](_0x486215)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x194')));if(_0x52998d[_0x43f8('0x182')](0x0,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215[_0x43f8('0x123')]>=_0x4b8c15[_0x43f8('0x189')]){_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x195'));}else{_0x52998d['stateGlobal'](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x195'));}}break;case'3':_0x4b8c15['outboundNoAnswerCallsDay']+=0x1;_0x486215[_0x43f8('0x6b')]=0x3;_0x486215['statedesc']='NoAnswer';_0x486215[_0x43f8('0x122')]+=0x1;_0x486215[_0x43f8('0xd5')]+=0x1;var _0x3aac3c=ut['buildNoAnswerEventPayload'](_0x4e6eca,_0x4b8c15);ami['emit']('custom:agentnoanswer',_0x3aac3c);_0xfd91f8=_0x4b8c15['dialNoAnswerRetryFrequency'];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];hopperUtils[_0x43f8('0xc5')](_0x486215)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x196')));if(_0x52998d[_0x43f8('0x182')](0x3,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215[_0x43f8('0x122')]>=_0x4b8c15[_0x43f8('0x197')]){_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x198'));}else{_0x52998d['stateGlobal'](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x198'));}}break;case'5':_0x4b8c15['outboundBusyCallsDay']+=0x1;_0x486215['state']=0x5;_0x486215[_0x43f8('0xcf')]='Busy';_0x486215['countbusyretry']+=0x1;_0x486215['countglobal']+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x4e6eca,'busy'));_0xfd91f8=_0x4b8c15['dialBusyRetryFrequency'];_0x5ee2a4=_0x4b8c15['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x486215)['catch'](loggerCatch(_0x43f8('0x199')));if(_0x52998d[_0x43f8('0x182')](0x5,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215[_0x43f8('0x121')]>=_0x4b8c15[_0x43f8('0x19a')]){_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x19b'));}else{_0x52998d[_0x43f8('0x12e')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x19b'));}}break;case'8':_0x4b8c15['outboundCongestionCallsDay']+=0x1;_0x486215[_0x43f8('0x6b')]=0x8;_0x486215[_0x43f8('0xcf')]='Congestion';_0x486215[_0x43f8('0x12d')]+=0x1;_0x486215[_0x43f8('0xd5')]+=0x1;_0xfd91f8=_0x4b8c15[_0x43f8('0x19c')];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];ami['emit'](_0x43f8('0x19d'),ut['buildObj'](_0x4e6eca,_0x43f8('0x19e')));hopperUtils[_0x43f8('0xc5')](_0x486215)[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x19f')));if(_0x52998d['checkRetriveMax'](0x8,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215[_0x43f8('0x12d')]>=_0x4b8c15[_0x43f8('0x187')]){_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,'reason\x208\x20congestion');}else{_0x52998d[_0x43f8('0x12e')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x1a0'));}}break;case'11':_0x4b8c15['outboundAbandonedCallsDay']+=0x1;_0x486215[_0x43f8('0x6b')]=0xb;_0x486215[_0x43f8('0xcf')]=_0x43f8('0xee');_0x486215[_0x43f8('0xea')]+=0x1;_0x486215[_0x43f8('0xd5')]+=0x1;_0xfd91f8=_0x4b8c15[_0x43f8('0xe7')];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];hopperUtils[_0x43f8('0xc5')](_0x486215)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x52998d['checkRetriveMax'](0xb,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215['countabandonedretry']>=_0x4b8c15['dialAbandonedMaxRetry']){_0x52998d['createStateFinal'](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x1a1'));}else{_0x52998d['stateGlobal'](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x1a1'));}}break;case'20':_0x4b8c15[_0x43f8('0x1a2')]+=0x1;_0x486215['state']=0x14;_0x486215[_0x43f8('0xcf')]=_0x43f8('0x1a3');_0x486215[_0x43f8('0x124')]+=0x1;_0x486215['countglobal']+=0x1;_0xfd91f8=_0x4b8c15[_0x43f8('0x18d')];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];ami[_0x43f8('0x3e')](_0x43f8('0x1a4'),ut[_0x43f8('0x120')](_0x4e6eca,'agentreject'));hopperUtils[_0x43f8('0xc5')](_0x486215)[_0x43f8('0x9e')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x52998d['checkRetriveMax'](0x14,_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215[_0x43f8('0x124')]>=_0x4b8c15[_0x43f8('0x18c')]){_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x1a5'));}else{_0x52998d['stateGlobal'](_0x486215,_0x33cdbf,_0x24346a,_0x43f8('0x1a5'));}}break;default:_0x4b8c15[_0x43f8('0x1a6')]+=0x1;_0x486215[_0x43f8('0x6b')]=0xc;_0x486215[_0x43f8('0xcf')]=_0x3cba72['reason'];_0xfd91f8=_0x4b8c15[_0x43f8('0x18d')];_0x5ee2a4=_0x4b8c15[_0x43f8('0xd7')];hopperUtils[_0x43f8('0xc5')](_0x486215)['catch'](loggerCatch(_0x43f8('0x1a7')));if(_0x52998d['checkRetriveMax'](_0x3cba72[_0x43f8('0xc1')],_0x4e6eca,_0x4b8c15)&&!_0xc29c5c){if(_0x486215['countbusyretry']+_0x486215[_0x43f8('0x12d')]+_0x486215[_0x43f8('0x122')]+_0x486215[_0x43f8('0x123')]+_0x486215[_0x43f8('0xd4')]+_0x486215['countabandonedretry']+_0x486215[_0x43f8('0x11f')]+_0x486215['countagentrejectretry']>=_0x4b8c15[_0x43f8('0x125')]){_0x52998d['stateGlobal'](_0x486215,_0x33cdbf,_0x24346a,_0x3cba72['reason']);}else{_0x52998d[_0x43f8('0x128')](_0x486215,_0x33cdbf,_0x24346a,_0x3cba72[_0x43f8('0xc1')]);}}}})['then'](function(){if(_0xc29c5c){hopperUtils[_0x43f8('0xe4')](_0x486215,_0xfd91f8,_0x5ee2a4)[_0x43f8('0x3b')](function(){return _0x33cdbf(0x1);});}});});};Dialer[_0x43f8('0x85')][_0x43f8('0x12e')]=function(_0x363494,_0x4ddec1,_0x92cc23,_0x4fa223){var _0x10f902=new Final(_0x363494);_0x10f902['state']=0xf;_0x10f902[_0x43f8('0xcf')]='Global';this[_0x43f8('0x128')](_0x10f902,_0x4ddec1,_0x92cc23,_0x4fa223);};Dialer[_0x43f8('0x85')][_0x43f8('0x128')]=function(_0x4e19ac,_0x1d66a0,_0x2140f5,_0x7bfb93){hopperUtils[_0x43f8('0x131')](_0x4e19ac)[_0x43f8('0x3b')](function(){return _0x1d66a0(msgResponse(_0x43f8('0x18f'),'Success',_0x7bfb93));})[_0x43f8('0x9e')](function(){return _0x2140f5(msgResponse(_0x43f8('0x1a8'),_0x43f8('0x93'),_0x43f8('0x1a9')));});};Dialer[_0x43f8('0x85')]['predictive']=function(_0x124d51){var _0x3a825c=_0x124d51[_0x43f8('0x1aa')]/0x64;var _0x98c4ec=_0x124d51[_0x43f8('0xcd')]/(_0x124d51[_0x43f8('0xcd')]+_0x124d51['outboundAnswerCallsDay']);var _0x5001b2=Math[_0x43f8('0x1ab')](_0x124d51[_0x43f8('0x1ac')]*(_0x124d51['predictiveIntervalMaxThreshold']/0x64));var _0x36d977=Math[_0x43f8('0x1ab')](_0x124d51[_0x43f8('0x1ac')]*(_0x124d51['predictiveIntervalMinThreshold']/0x64));var _0x3abb27=_0x124d51[_0x43f8('0x1ad')]+_0x124d51[_0x43f8('0x13b')];var _0x3a9287=Math[_0x43f8('0x1ae')](_0x124d51['erlangCalls']*_0x124d51['erlangAbandonmentRate']*_0x124d51['predictiveIntervalHitRate']*_0x124d51['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x124d51[_0x43f8('0x27')])){if(!_[_0x43f8('0x3d')](_0x124d51[_0x43f8('0x5e')])){_0x124d51[_0x43f8('0x5e')]=undefined;loggerPredictive[_0x43f8('0x62')](_0x43f8('0x1af'),_0x43f8('0x1b0'));}if(!_['isUndefined'](_0x124d51['handlePredictive'])){loggerPredictive[_0x43f8('0x62')](_0x43f8('0x1af'),_0x43f8('0x1b1'));clearInterval(_0x124d51[_0x43f8('0x60')]);_0x124d51[_0x43f8('0x60')]=undefined;}_0x124d51[_0x43f8('0x27')]=moment()[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x43f8('0x48')](_0x124d51[_0x43f8('0x45')],_0x43f8('0x1b2'),_0x124d51[_0x43f8('0x27')]);this[_0x43f8('0xac')](_0x124d51,0x1);}else if(ifInterval(_0x124d51['dialPredictiveInterval'],_0x124d51[_0x43f8('0x27')])){this['handlePower'](_0x124d51,0x1);loggerPredictiveCalls[_0x43f8('0x48')](_0x43f8('0x1b3'),_0x124d51[_0x43f8('0x27')],_0x124d51['name']);_0x124d51['erlangCalls']=0x0;_0x124d51[_0x43f8('0xce')]=0x0;}else if(_0x3a825c<_0x98c4ec&&_0x124d51['dialPredictiveOptimization']===_0x43f8('0x1b4')){clearPredictiveAttributes(_0x124d51);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1b5'),'Dropped\x20calls\x20day',_0x98c4ec,_0x43f8('0x27'),_0x124d51[_0x43f8('0x45')]);}else if(_0x3a9287<_0x124d51[_0x43f8('0xce')]&&_0x124d51[_0x43f8('0x1b6')]==='dropRate'){clearPredictiveAttributes(_0x124d51);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x43f8('0x1b7'),_0x3a9287,_0x43f8('0x1b8'),_0x124d51['predictiveIntervalErlangCallsDroppedCalls'],_0x43f8('0x27'),_0x124d51[_0x43f8('0x45')]);}else if(!ifInterval(_0x124d51[_0x43f8('0x1b9')],_0x124d51[_0x43f8('0x27')])&&_['isUndefined'](_0x124d51[_0x43f8('0x5e')])&&!_[_0x43f8('0x3d')](_0x124d51['startProgressive'])){_0x124d51['startPredictive']=moment()[_0x43f8('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x43f8('0x48')](_0x124d51['name'],'started\x20in\x20predictive\x20at',_0x124d51[_0x43f8('0x5e')]);hopperUtils[_0x43f8('0x1ba')](_0x124d51[_0x43f8('0x1b9')])[_0x43f8('0x3b')](this[_0x43f8('0x1bb')](_0x124d51))[_0x43f8('0x3b')](mergeDataErlangB(_0x124d51))[_0x43f8('0x3b')](this[_0x43f8('0x1bc')](_0x124d51))[_0x43f8('0x9e')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x124d51));}else if(!ifInterval(_0x124d51[_0x43f8('0x1b9')],_0x124d51[_0x43f8('0x5e')])){_0x124d51[_0x43f8('0xce')]=0x0;_0x124d51['startPredictive']=moment()[_0x43f8('0x88')](_0x43f8('0xbf'));loggerPredictive[_0x43f8('0x48')](_0x124d51[_0x43f8('0x45')],_0x43f8('0x1bd'),_0x124d51['startPredictive']);clearInterval(_0x124d51[_0x43f8('0x60')]);_0x124d51[_0x43f8('0x60')]=undefined;hopperUtils[_0x43f8('0x1ba')](_0x124d51['dialPredictiveInterval'])[_0x43f8('0x3b')](this[_0x43f8('0x1bb')](_0x124d51))['then'](mergeDataErlangB(_0x124d51))[_0x43f8('0x3b')](this[_0x43f8('0x1bc')](_0x124d51))['catch'](loggerCatchPredictive(_0x43f8('0x1be'),_0x124d51));}else if(_0x124d51[_0x43f8('0x1ac')]&&_0x3abb27<_0x124d51[_0x43f8('0x1ac')]-_0x36d977){clearPredictiveAttributes(_0x124d51);loggerPredictive[_0x43f8('0x48')](_0x124d51[_0x43f8('0x45')],_0x43f8('0x1bf'),_0x3abb27,_0x43f8('0x1c0'),_0x124d51[_0x43f8('0x1ac')],'-',_0x36d977,'=',_0x124d51['predictiveIntervalAvailable']-_0x36d977,')');}else if(_0x124d51[_0x43f8('0x1ac')]&&_0x3abb27>_0x124d51[_0x43f8('0x1ac')]+_0x5001b2){clearPredictiveAttributes(_0x124d51);loggerPredictive[_0x43f8('0x48')](_0x124d51[_0x43f8('0x45')],_0x43f8('0x1bf'),_0x3abb27,')\x20are\x20more\x20than\x20threshold\x20(',_0x124d51[_0x43f8('0x1ac')],'+',_0x5001b2,'=',_0x124d51[_0x43f8('0x1ac')]+_0x5001b2,')');}};Dialer[_0x43f8('0x85')][_0x43f8('0x1bb')]=function(_0x46e2c0){var _0x286258=this;return function(_0xc75b78){return new Promise(function(_0x1b166c,_0x529218){_['merge'](_0x46e2c0,_0xc75b78[0x0]);if(checkGetDataPredictive(_0xc75b78[0x0])){var _0x240b3d=_0x46e2c0['predictiveIntervalAvailable']=_0x46e2c0['talking']+_0x46e2c0[_0x43f8('0x1ad')];var _0x16e44e=_0x46e2c0[_0x43f8('0x1b9')]*0x3c;var _0x5e2914=_0xc75b78[0x0]['predictiveIntervalAvgTalktime']+_0xc75b78[0x0][_0x43f8('0x4c')];var _0x2a2215=(_0xc75b78[0x0][_0x43f8('0x1c1')]+_0xc75b78[0x0][_0x43f8('0xcc')]+_0xc75b78[0x0][_0x43f8('0x4b')])/_0xc75b78[0x0][_0x43f8('0x4f')];_0x46e2c0['predictiveIntervalHitRate']=_0x2a2215>0x0?_0x2a2215:0x1;switch(_0x46e2c0[_0x43f8('0x1b6')]){case'dropRate':var _0x22245d=_0x46e2c0[_0x43f8('0x1aa')]/0x64;return _0x286258[_0x43f8('0x1c2')](_0x240b3d,_0x16e44e,_0x5e2914,_0x2a2215,_0x22245d)['then'](function(_0x21c648){return _0x1b166c(_0x21c648);});case'agentBusyFactor':var _0x482626=_0x46e2c0['dialPredictiveOptimizationPercentage']/0x64;return _0x286258[_0x43f8('0x1c3')](_0x240b3d,_0x16e44e,_0x5e2914,_0x2a2215,_0x482626)['then'](function(_0x4679b2){return _0x1b166c(_0x4679b2);});default:return _0x529218(msgResponse(_0x43f8('0x1c4'),_0x43f8('0x93'),_0x43f8('0x1c5')));}}else{return _0x529218(msgResponse(_0x43f8('0x1c4'),_0x43f8('0x93'),_0x43f8('0x1c6')));}});};};Dialer['prototype'][_0x43f8('0x1c7')]=function(_0x3d2ca6){var _0x12cb45=this;return function(_0xa6a875){return new Promise(function(_0x3c0d34,_0x1fb310){_['merge'](_0x3d2ca6,_0xa6a875[0x0]);if(checkGetDataPredictive(_0xa6a875[0x0])){loggerPredictive[_0x43f8('0x48')](JSON[_0x43f8('0x71')](_0xa6a875[0x0]));if(_0x3d2ca6[_0x43f8('0x1b6')]===_0x43f8('0x1b4')){return _0x12cb45[_0x43f8('0x14c')](_0x3d2ca6['id'])[_0x43f8('0x3b')](function(_0x33e605){var _0x2a68dd=_0x3d2ca6[_0x43f8('0x1c8')]-_0x33e605[0x0]['outboundQueuePauses'];var _0x4453f1=_0x3d2ca6[_0x43f8('0x1b9')]*0x3c;var _0xe0834a=_0xa6a875[0x0][_0x43f8('0x4d')]+_0xa6a875[0x0][_0x43f8('0x4c')];var _0x3baed1=(_0xa6a875[0x0][_0x43f8('0x1c1')]+_0xa6a875[0x0][_0x43f8('0xcc')]+_0xa6a875[0x0][_0x43f8('0x4b')])/_0xa6a875[0x0]['predictiveIntervalTotalCalls'];var _0x1a2b71=_0x3d2ca6['dialPredictiveOptimizationPercentage']/0x64;_0x3d2ca6[_0x43f8('0x1c9')]=_0x33e605[0x0]['outboundQueuePauses']||0x0;_0x3d2ca6[_0x43f8('0x1ca')]=_0x3baed1>0x0?_0x3baed1:0x1;return _0x12cb45[_0x43f8('0x1c2')](_0x2a68dd,_0x4453f1,_0xe0834a,_0x3baed1,_0x1a2b71);})[_0x43f8('0x3b')](function(_0x5034dd){return _0x3c0d34(_0x5034dd);})[_0x43f8('0x9e')](function(_0xc12078){return _0x1fb310(msgResponse(_0x43f8('0x1cb'),_0x43f8('0x93'),JSON[_0x43f8('0x71')](_0xc12078)));});}if(_0x3d2ca6[_0x43f8('0x1b6')]===_0x43f8('0x1cc')){return _0x12cb45[_0x43f8('0x14c')](_0x3d2ca6['id'])[_0x43f8('0x3b')](function(_0x55c694){var _0x1405c8=_0x3d2ca6[_0x43f8('0x1c8')]-_0x55c694[0x0][_0x43f8('0x1cd')];var _0x36b7d1=_0x3d2ca6[_0x43f8('0x1b9')]*0x3c;var _0x496705=_0xa6a875[0x0][_0x43f8('0x4d')]+_0xa6a875[0x0]['predictiveIntervalAvgHoldtime'];var _0x9f7bc5=(_0xa6a875[0x0][_0x43f8('0x1c1')]+_0xa6a875[0x0][_0x43f8('0xcc')]+_0xa6a875[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xa6a875[0x0][_0x43f8('0x4f')];var _0x5716a5=_0x3d2ca6['dialPredictiveOptimizationPercentage']/0x64;_0x3d2ca6['predictiveIntervalPauses']=_0x55c694[0x0]['outboundQueuePauses']||0x0;_0x3d2ca6[_0x43f8('0x1ca')]=_0x9f7bc5>0x0?_0x9f7bc5:0x1;return _0x12cb45[_0x43f8('0x1c3')](_0x1405c8,_0x36b7d1,_0x496705,_0x9f7bc5,_0x5716a5);})[_0x43f8('0x3b')](function(_0x450425){return _0x3c0d34(_0x450425);})[_0x43f8('0x9e')](function(_0x4f83dd){return _0x1fb310(msgResponse(_0x43f8('0x1cb'),_0x43f8('0x93'),JSON[_0x43f8('0x71')](_0x4f83dd)));});}}else{return _0x1fb310(msgResponse(_0x43f8('0x1c4'),_0x43f8('0x93'),'check\x20failure'));}});};};Dialer[_0x43f8('0x85')][_0x43f8('0x1bc')]=function(_0x57374f){var _0x27d02b=this;return function(){var _0x76b3d6=0x0;var _0x26221f=Math['floor'](_0x57374f[_0x43f8('0x56')]*0x3e8);if(_0x26221f>0x0){_0x26221f=_0x26221f<0x64?0x64:_0x26221f;loggerPredictive[_0x43f8('0x48')](_0x57374f['name'],_0x43f8('0x1ce'),_0x26221f,_0x43f8('0x1cf'));_0x57374f[_0x43f8('0x60')]=setInterval(function(){_0x27d02b[_0x43f8('0x60')](_0x57374f);loggerPredictiveCalls[_0x43f8('0x48')]('[handlePredictive]',_0x76b3d6+=0x1);},_0x26221f);}else{loggerPredictive[_0x43f8('0x48')](_0x57374f['name'],_0x43f8('0x1d0'));}};};Dialer[_0x43f8('0x85')]['checkContactBlack']=function(_0x392005,_0x3f6b1b){var _0x17fbb7=this;return function(_0x130344){if(_[_0x43f8('0x46')](_0x130344)){if(_[_0x43f8('0xff')](_0x3f6b1b[_0x43f8('0x150')])||!_0x3f6b1b[_0x43f8('0x1d1')]){if(_0x392005['dialMethod']===_0x43f8('0x9')){_0x392005[_0x43f8('0x6e')]=_[_0x43f8('0x3d')](_0x392005[_0x43f8('0x6e')])?!![]:_0x392005[_0x43f8('0x6e')];var _0xf611c7=uuid['v4']();_0x17fbb7['actions'][_0xf611c7]=new Action(_0x392005,_0x3f6b1b,_0xf611c7);loggerBooked[_0x43f8('0x48')]('[booked][checkContactBlack]',_0xf611c7,'queueStatusComplete:\x20',JSON[_0x43f8('0x71')](_0x392005['queueStatusComplete']),_0x43f8('0x1d2'),_0x392005[_0x43f8('0x45')]);if(_0x392005[_0x43f8('0x6e')]){_0x392005['queueStatusComplete']=![];_0x17fbb7[_0x43f8('0xf7')][_0x17fbb7['actions'][_0xf611c7][_0x43f8('0xbc')]]=[];ami['Action']({'actionid':_0xf611c7,'action':_0x43f8('0x1d3'),'queue':_0x392005[_0x43f8('0x45')]})[_0x43f8('0x9e')](function(){_0x17fbb7[_0x43f8('0xc9')](_0x392005);hopperUtils[_0x43f8('0xdb')]({'active':![],'ContactId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7]['ContactId'],'ListId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7][_0x43f8('0xdf')],'VoiceQueueId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7][_0x43f8('0xec')]||undefined,'CampaignId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x17fbb7[_0x43f8('0x24')][_0xf611c7];});}else{loggerBooked[_0x43f8('0x48')](_0x43f8('0x1d4'),JSON['stringify'](_0x392005[_0x43f8('0x6e')]),_0x43f8('0x1d2'),_0x392005[_0x43f8('0x45')]);_0x17fbb7[_0x43f8('0xc9')](_0x392005);hopperUtils[_0x43f8('0xdb')]({'active':![],'ContactId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7][_0x43f8('0xde')],'ListId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7]['ListId'],'VoiceQueueId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7]['VoiceQueueId']||undefined,'CampaignId':_0x17fbb7[_0x43f8('0x24')][_0xf611c7][_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x1d5')));delete _0x17fbb7['actions'][_0xf611c7];}}else{return _0x17fbb7[_0x43f8('0x1d6')](_0x392005,_0x3f6b1b);}}else{if(utils[_0x43f8('0x5c')](undefined,_0x3f6b1b[_0x43f8('0x1d7')])<_0x392005['dialRecallMeTimeout']*0x3c){if(_0x3f6b1b[_0x43f8('0x145')]&&!_0x3f6b1b[_0x43f8('0x145')][_0x43f8('0x1d8')]){_0x17fbb7['preview']['run'](_0x3f6b1b['id'])[_0x43f8('0x1b')](function(){_0x17fbb7['updateOriginated'](_0x392005);});}else{hopperUtils[_0x43f8('0x1d9')]({'active':![]},_0x3f6b1b['id'],0x1)['finally'](function(){_0x17fbb7[_0x43f8('0xc9')](_0x392005);});}}else{_0x392005['outboundReCallsDay']+=0x1;_0x17fbb7['updateOriginated'](_0x392005);if(_0x392005[_0x43f8('0x1da')]){hopperUtils[_0x43f8('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f6b1b[_0x43f8('0xde')],'ListId':_0x3f6b1b[_0x43f8('0xdf')],'VoiceQueueId':_0x3f6b1b[_0x43f8('0xec')]||undefined,'CampaignId':_0x3f6b1b[_0x43f8('0xe0')]||undefined})[_0x43f8('0x9e')](loggerCatch(_0x43f8('0x1db')));hopperUtils['createHistory'](createObjHistory(_0x392005,_0x3f6b1b,utils[_0x43f8('0x74')][_0x43f8('0x1dc')],0x17,'RecallInQueue'))[_0x43f8('0x9e')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x17fbb7[_0x43f8('0x11b')](createObjHistory(_0x392005,_0x3f6b1b,utils['CAMPAIGN_STATUS'][_0x43f8('0x1dd')],0x16,_0x43f8('0x1de')),_0x43f8('0x1df'),'[Originate][HistoryRecallClose]');}}}}else{_0x392005[_0x43f8('0x1e0')]+=0x1;_0x17fbb7[_0x43f8('0x11b')](createObjHistory(_0x392005,_0x3f6b1b,utils[_0x43f8('0x74')][_0x43f8('0x1e1')],0xd,'Blacklist'),_0x43f8('0x1e2'),_0x43f8('0x1e3'));throw _0x43f8('0x1e4');}};};Dialer[_0x43f8('0x85')][_0x43f8('0x155')]=function(_0x2bae16){var _0xd7c444=this;var _0x55d314=_0x2bae16[_0x43f8('0x1e5')]-_0x2bae16[_0x43f8('0x7f')];emitCampaignSummary(_0x2bae16);if(_0x55d314>0x0&&_0x2bae16[_0x43f8('0x64')]==0x0){if(_0x55d314>this[_0x43f8('0x22')]){_0x55d314=this['maxNumberOriginate'];}_0x2bae16['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x2bae16,_0x55d314)[_0x43f8('0x3b')](function(_0x3eaa86){_0x2bae16[_0x43f8('0x64')]=0x0;if(_0x3eaa86){if(!utils['checkContactEmpty'](_0x3eaa86)){_0x2bae16['message']=utils[_0x43f8('0x74')][_0x43f8('0x69')];logger[_0x43f8('0x48')](_0x43f8('0x1e6')+_0x2bae16['name']);}else{_0x2bae16[_0x43f8('0x7f')]+=_0x3eaa86[_0x43f8('0xfe')];_0x2bae16[_0x43f8('0x68')]=utils[_0x43f8('0x74')][_0x43f8('0x1e7')];for(var _0x4d3725=0x0;_0x4d3725<_0x3eaa86['length'];_0x4d3725+=0x1){_0x2bae16[_0x43f8('0x1e8')]+=0x1;if(_[_0x43f8('0xff')](_0x3eaa86[_0x4d3725])||_[_0x43f8('0xff')](_0x3eaa86[_0x4d3725]['Contact'])||_[_0x43f8('0xff')](_0x3eaa86[_0x4d3725][_0x43f8('0x158')])){_0xd7c444[_0x43f8('0x14e')](_0x43f8('0x1e9'),_0x2bae16,_0x3eaa86[_0x4d3725]);}else{hopperUtils[_0x43f8('0x1ea')](_['pick'](_0x3eaa86[_0x4d3725],[_0x43f8('0xe0'),_0x43f8('0x158')]))['then'](_0xd7c444[_0x43f8('0x1eb')](_0x2bae16,_0x3eaa86[_0x4d3725]))[_0x43f8('0x9e')](_0xd7c444[_0x43f8('0x1ec')](_0x43f8('0x1ed'),_0x2bae16));}}}}})[_0x43f8('0x9e')](loggerGetContactDialer(_0x43f8('0x1ee'),_0x2bae16,_0x55d314));}};Dialer[_0x43f8('0x85')][_0x43f8('0xac')]=function(_0x1f4dd1,_0x23419c){var _0x5c706c=this;var _0x2d836c=[];if(_0x23419c<0x1||_0x1f4dd1[_0x43f8('0xaa')]==='booked'){_0x23419c=0x1;}var _0x2d153d=Math[_0x43f8('0x1ae')](_0x1f4dd1['available']*_0x23419c)-_0x1f4dd1['originated'];if(_0x1f4dd1['dialLimitQueue']>0x0){var _0x2b79b3=_0x1f4dd1[_0x43f8('0x1ef')]-_0x1f4dd1[_0x43f8('0x7f')]-_0x1f4dd1[_0x43f8('0x13b')]-_0x1f4dd1['pTalking'];if(_0x2d153d>_0x2b79b3){_0x2d153d=_0x2b79b3;}}if(_0x2d153d>0x0&&_0x1f4dd1[_0x43f8('0x64')]==0x0){if(_0x1f4dd1[_0x43f8('0xaa')]===_0x43f8('0x9')){_0x2d153d=0x1;}if(_0x2d153d>this['maxNumberOriginate']){_0x2d153d=this[_0x43f8('0x22')];}for(var _0x4373a5 in this[_0x43f8('0x20')]){if(typeof this[_0x43f8('0x20')][_0x4373a5]!==_0x43f8('0xa5')){if(this[_0x43f8('0x20')][_0x4373a5][_0x43f8('0x6b')]===_0x43f8('0x1f0')&&this[_0x43f8('0x20')][_0x4373a5][_0x43f8('0xf5')]===_0x43f8('0x89')){_0x2d836c['push'](this[_0x43f8('0x20')][_0x4373a5]['id']);}}}_0x1f4dd1[_0x43f8('0x64')]=0x1;hopperUtils['getContactDialer'](_0x1f4dd1,_0x2d836c,_0x2d153d)[_0x43f8('0x3b')](function(_0x45b70f){_0x1f4dd1[_0x43f8('0x64')]=0x0;if(_0x45b70f){if(!utils[_0x43f8('0x1f1')](_0x45b70f)){hopperUtils[_0x43f8('0x1f2')](_0x1f4dd1)['then'](sendMessageReschedule(_0x1f4dd1))[_0x43f8('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x1f4dd1[_0x43f8('0x7f')]+=_0x45b70f[_0x43f8('0xfe')];_0x1f4dd1[_0x43f8('0x68')]=_0x1f4dd1['dialMethod']===_0x43f8('0x9')?utils[_0x43f8('0x74')]['ACTIVE']:utils[_0x43f8('0x74')][_0x43f8('0x1e7')];for(var _0x2de4d3=0x0;_0x2de4d3<_0x45b70f[_0x43f8('0xfe')];_0x2de4d3+=0x1){if(_[_0x43f8('0xff')](_0x45b70f[_0x2de4d3])||_[_0x43f8('0xff')](_0x45b70f[_0x2de4d3]['Contact'])||_['isNil'](_0x45b70f[_0x2de4d3][_0x43f8('0x158')])){_0x5c706c[_0x43f8('0x14e')]('[actionOriginate]\x20',_0x1f4dd1,_0x45b70f[_0x2de4d3]);}else{hopperUtils[_0x43f8('0x1f3')](_[_0x43f8('0x72')](_0x45b70f[_0x2de4d3],[_0x43f8('0xec'),_0x43f8('0x158')]))[_0x43f8('0x3b')](_0x5c706c['checkContactBlack'](_0x1f4dd1,_0x45b70f[_0x2de4d3]))[_0x43f8('0x9e')](_0x5c706c[_0x43f8('0x1ec')](_0x43f8('0x1e9'),_0x1f4dd1));}}}}})[_0x43f8('0x9e')](loggerGetContactDialer(_0x43f8('0x1f4'),_0x1f4dd1,_0x2d153d));}};Dialer[_0x43f8('0x85')][_0x43f8('0x60')]=function(_0xc246f){if(_0xc246f[_0x43f8('0x1ef')]>0x0){var _0x4588c5=_0xc246f[_0x43f8('0x1ef')]-_0xc246f[_0x43f8('0x7f')]-_0xc246f['talking'];if(_0x4588c5>0x0&&_0xc246f[_0x43f8('0x64')]==0x0){this[_0x43f8('0x1f5')](_0xc246f);}else{loggerPredictiveCalls[_0x43f8('0x48')](_0x43f8('0x1f6'));}}else{this[_0x43f8('0x1f5')](_0xc246f);}};Dialer[_0x43f8('0x85')][_0x43f8('0x1f5')]=function(_0x30a5f3){var _0x45c244=this;var _0x3837b6=[];_0x30a5f3[_0x43f8('0x7f')]+=0x1;for(var _0x384f72 in this['agents']){if(typeof this[_0x43f8('0x20')][_0x384f72]!==_0x43f8('0xa5')){if(this['agents'][_0x384f72][_0x43f8('0x6b')]===_0x43f8('0x1f0')&&this[_0x43f8('0x20')][_0x384f72]['status']===_0x43f8('0x89')){_0x3837b6[_0x43f8('0xf8')](this[_0x43f8('0x20')][_0x384f72]['id']);}}}_0x30a5f3[_0x43f8('0x64')]=0x1;return this[_0x43f8('0x1f7')](_0x30a5f3['id'],_0x3837b6,0x1,_0x30a5f3[_0x43f8('0x1f8')],_0x30a5f3)[_0x43f8('0x3b')](function(_0x576295){_0x30a5f3[_0x43f8('0x64')]=0x1;if(_0x576295){if(!utils[_0x43f8('0x1f1')](_0x576295)){utils[_0x43f8('0x63')](_0x30a5f3,0x1,0x0);return hopperUtils['countReScheduled'](_0x30a5f3)['then'](sendMessageReschedule(_0x30a5f3))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x30a5f3['message']=utils[_0x43f8('0x74')][_0x43f8('0x1e7')];if(_[_0x43f8('0xff')](_0x576295[0x0])||_[_0x43f8('0xff')](_0x576295[0x0][_0x43f8('0x172')])||_[_0x43f8('0xff')](_0x576295[0x0]['phone'])){_0x45c244[_0x43f8('0x14e')](_0x43f8('0x1e9'),_0x30a5f3,_0x576295[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x576295[0x0],[_0x43f8('0xec'),_0x43f8('0x158')]))[_0x43f8('0x3b')](_0x45c244[_0x43f8('0x1eb')](_0x30a5f3,_0x576295[0x0]))[_0x43f8('0x9e')](_0x45c244[_0x43f8('0x1ec')](_0x43f8('0x1f9'),_0x30a5f3));}}}})[_0x43f8('0x9e')](loggerGetContactDialer(_0x43f8('0x1fa'),_0x30a5f3,0x1));};Dialer[_0x43f8('0x85')]['abandonmentRate']=function(_0x38a9f5,_0x317377,_0x8ef6d,_0x2aaac6,_0x844974,_0xa635df){loggerPredictive[_0x43f8('0x48')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x43f8('0x48')]('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',_0x38a9f5);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fb'),_0x317377);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fc'),_0x8ef6d);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fd'),_0x2aaac6);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fe'),_0x844974);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x4e'));return new Promise(function(_0x4bed83,_0x10562e){if(_0x38a9f5<=0x0||isNaN(_0x38a9f5)){return _0x10562e(msgResponse(_0x43f8('0x1ff'),_0x43f8('0x84'),_0x43f8('0x200')+_0x38a9f5));}if(_0x8ef6d<=0x0||isNaN(_0x8ef6d)){return _0x10562e(msgResponse(_0x43f8('0x1ff'),'Error',_0x43f8('0x201')+_0x8ef6d));}if(_0x2aaac6<=0x0||isNaN(_0x2aaac6)){return _0x10562e(msgResponse('[abandonmentRate]',_0x43f8('0x84'),_0x43f8('0x202')+_0x2aaac6));}if(_0x317377<=0x0||isNaN(_0x317377)){return _0x10562e(msgResponse(_0x43f8('0x1ff'),_0x43f8('0x84'),_0x43f8('0x203')+_0x317377));}if(_0x844974<=0x0||isNaN(_0x844974)){return _0x10562e(msgResponse(_0x43f8('0x1ff'),_0x43f8('0x84'),_0x43f8('0x204')+_0x844974));}_0xa635df=_0xa635df||0x0;var _0x4e324c=0x1/_0x8ef6d;var _0x5132a9=0x0;var _0x53b566=0x0;var _0x27317a=0x0;var _0x44ab2f=0x0;for(var _0x53fee8=0x0;_0x27317a<_0x844974;_0x53fee8+=0x1){_0x53b566=_0x53fee8/_0x317377;_0x5132a9=(_0x2aaac6*_0x53b566+_0xa635df)/_0x4e324c;_0x27317a=utils[_0x43f8('0x205')](_0x5132a9,_0x38a9f5);_0x44ab2f=_0x5132a9/_0x38a9f5*(0x1-utils['erlangb'](_0x5132a9,_0x38a9f5));}return _0x4bed83({'erlangCalls':_0x53fee8,'erlangCallToSecond':_0x317377/_0x53fee8,'erlangAbandonmentRate':_0x27317a,'erlangBusyFactor':_0x44ab2f});});};Dialer['prototype'][_0x43f8('0x1c3')]=function(_0x43dfb1,_0x43d467,_0x381984,_0x1d505f,_0x2be4d9,_0x4cbbb6){loggerPredictive['info'](_0x43f8('0x206'));loggerPredictive[_0x43f8('0x48')]('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',_0x43dfb1);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fb'),_0x43d467);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fc'),_0x381984);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x1fd'),_0x1d505f);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x207'),_0x2be4d9);loggerPredictive[_0x43f8('0x48')](_0x43f8('0x4e'));return new Promise(function(_0x2eb2b1,_0x1496e4){if(_0x43dfb1<=0x0||isNaN(_0x43dfb1)){return _0x1496e4(msgResponse(_0x43f8('0x208'),_0x43f8('0x84'),_0x43f8('0x200')+_0x43dfb1));}if(_0x381984<=0x0||isNaN(_0x381984)){return _0x1496e4(msgResponse('[busyFactor]','Error',_0x43f8('0x201')+_0x381984));}if(_0x1d505f<=0x0||isNaN(_0x1d505f)){return _0x1496e4(msgResponse(_0x43f8('0x208'),_0x43f8('0x84'),_0x43f8('0x202')+_0x1d505f));}if(_0x43d467<=0x0||isNaN(_0x43d467)){return _0x1496e4(msgResponse(_0x43f8('0x208'),_0x43f8('0x84'),_0x43f8('0x203')+_0x43d467));}if(_0x2be4d9<=0x0||isNaN(_0x2be4d9)){return _0x1496e4(msgResponse(_0x43f8('0x208'),'Error',_0x43f8('0x209')+_0x2be4d9));}_0x4cbbb6=_0x4cbbb6||0x0;var _0x147cdf=0x1/_0x381984;var _0x11dd6c=0x0;var _0x59d676=0x0;var _0xd2bede=0x0;var _0x38b4fc=0x0;for(var _0x133499=0x0;_0x38b4fc<_0x2be4d9;_0x133499+=0x1){_0x59d676=_0x133499/_0x43d467;_0x11dd6c=(_0x1d505f*_0x59d676+_0x4cbbb6)/_0x147cdf;_0xd2bede=utils[_0x43f8('0x205')](_0x11dd6c,_0x43dfb1);_0x38b4fc=_0x11dd6c/_0x43dfb1*(0x1-utils[_0x43f8('0x205')](_0x11dd6c,_0x43dfb1));}return _0x2eb2b1({'erlangCalls':_0x133499,'erlangCallToSecond':_0x43d467/_0x133499,'erlangAbandonmentRate':_0xd2bede,'erlangBusyFactor':_0x38b4fc});});};module['exports']=Dialer; \ No newline at end of file +var _0xf6ab=['_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','buildObj','value','countmachineretry','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','dialQueueProject','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','dialPreviewRecallmeReminder','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','saveInDb','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','launchHandleIvr','handleIvr','actionOriginate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','nosuchnumber','[syncAgentComplete][createHistory][0]','checkRetriveMax','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','talking','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummarycomplete','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','type','debug','inspect','format','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','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','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','statedesc','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','isEmpty','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','isArray','push','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialTimezone','silly','Dialer::ifTime()','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','additional','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','agents','stateinterface','pick','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6ab,0x11b));var _0xbf6a=function(_0x47f8e9,_0xc4e866){_0x47f8e9=_0x47f8e9-0x0;var _0x4815eb=_0xf6ab[_0x47f8e9];return _0x4815eb;};'use strict';var util=require(_0xbf6a('0x0'));var _=require(_0xbf6a('0x1'));var uuid=require(_0xbf6a('0x2'));var moment=require(_0xbf6a('0x3'));var rr=require('rr');var Redis=require(_0xbf6a('0x4'));var utils=require(_0xbf6a('0x5'));var hopperUtils=require(_0xbf6a('0x6'));var ut=require(_0xbf6a('0x7'));var config=require('../../../config/environment/');var logger=require(_0xbf6a('0x8'))(_0xbf6a('0x9'));var loggerBooked=require(_0xbf6a('0x8'))(_0xbf6a('0xa'));var loggerPredictive=require(_0xbf6a('0x8'))(_0xbf6a('0xb'));var loggerPredictiveCalls=require(_0xbf6a('0x8'))(_0xbf6a('0xc'));var loggerSyncQueueSummary=require(_0xbf6a('0x8'))(_0xbf6a('0xd'));var ami=require(_0xbf6a('0xe'));config[_0xbf6a('0xf')]=_[_0xbf6a('0x10')](config['redis'],{'host':_0xbf6a('0x11'),'port':0x18eb});var io=require(_0xbf6a('0x12'))(new Redis(config['redis']));var cmHopper=require(_0xbf6a('0x13'));var voiceQueueRt=require(_0xbf6a('0x14'));var RpcSetting=require(_0xbf6a('0x15'));var Interval=require(_0xbf6a('0x16'));var Action=require(_0xbf6a('0x17'));var History=require(_0xbf6a('0x18'));var Final=require(_0xbf6a('0x19'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xbf6a('0x1a'));var Hangup=require('./models/hangup');var ipAgi=process[_0xbf6a('0x1b')][_0xbf6a('0x1c')]||_0xbf6a('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xbf6a('0x1e')]=function(_0x3eb88f){this[_0xbf6a('0x1f')]=this[_0xbf6a('0x1f')]?this['tail'][_0xbf6a('0x20')](_0x3eb88f):_0x3eb88f();};function Dialer(_0x50d13b,_0x255704){this['sequence']=new Sequence();this[_0xbf6a('0x21')]=_0x255704;this[_0xbf6a('0x22')]=_0x50d13b[_0xbf6a('0x22')];this[_0xbf6a('0x23')]=_0x50d13b['campaigns'];this['agents']=_0x50d13b['agents'];this[_0xbf6a('0x24')]=_0x50d13b[_0xbf6a('0x24')];this['maxNumberOriginate']=config[_0xbf6a('0x25')]||0x2;this[_0xbf6a('0x26')]={};this[_0xbf6a('0x27')]={};this[_0xbf6a('0x28')]={};this[_0xbf6a('0x29')]={};this[_0xbf6a('0x2a')]={};this[_0xbf6a('0x2b')]={};this[_0xbf6a('0x2c')]={};this[_0xbf6a('0x2d')]={};this[_0xbf6a('0x2e')]={};this['queueBookedRR']={};this[_0xbf6a('0x2f')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xbf6a('0x30')](this));ami['on'](_0xbf6a('0x31'),this[_0xbf6a('0x32')]['bind'](this));ami['on'](_0xbf6a('0x33'),this[_0xbf6a('0x34')]['bind'](this));ami['on']('agentcomplete',this[_0xbf6a('0x35')][_0xbf6a('0x30')](this));ami['on']('custom:queuesummary',this[_0xbf6a('0xd')]['bind'](this));ami['on'](_0xbf6a('0x36'),this['syncQueueSummaryComplete'][_0xbf6a('0x30')](this));ami['on']('hangup',this['syncHangup'][_0xbf6a('0x30')](this));ami['on'](_0xbf6a('0x37'),this[_0xbf6a('0x38')]['bind'](this));ami['on'](_0xbf6a('0x39'),this[_0xbf6a('0x3a')]['bind'](this));ami['on'](_0xbf6a('0x3b'),this['syncQueueMember'][_0xbf6a('0x30')](this));ami['on']('queuestatuscomplete',this[_0xbf6a('0x3c')][_0xbf6a('0x30')](this));this[_0xbf6a('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0xbf6a('0x3e')]()['then'](function(_0x382c80){previewRecallmeReminderInterval=_0x382c80[_0xbf6a('0x3f')];});}function isNotNull(_0x28591e){return _0x28591e!==null&&!_[_0xbf6a('0x40')](_0x28591e);}function msgResponse(_0x21f5a7,_0x55d414,_0x1379d0){return{'action':_0x21f5a7,'response':_0x55d414,'message':_0x1379d0,'stack':_0x1379d0};}function emit(_0x12ff65,_0x277dcc,_0x3f9d91){io['to'](_0x12ff65)['emit'](_0x277dcc,_0x3f9d91);}function emitOutboundVoiceQueueSummary(_0x254d84){if(_0x254d84[_0xbf6a('0x41')]==='outbound'){logger[_0xbf6a('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xbf6a('0x43')](_0x254d84,{'showHidden':![],'depth':null}));emit(util[_0xbf6a('0x44')]('voice:queue:%s',_0x254d84[_0xbf6a('0x45')]),_0xbf6a('0x46'),_0x254d84);}}function checkGetDataPredictive(_0x55fc63){if(isNotNull(_0x55fc63)&&!_['isEmpty'](_0x55fc63)){loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x48'));loggerPredictive['info'](_0xbf6a('0x49'),_0x55fc63[_0xbf6a('0x4a')]);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x4b'),_0x55fc63[_0xbf6a('0x4c')]);loggerPredictive[_0xbf6a('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x55fc63[_0xbf6a('0x4d')]);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x4e'),_0x55fc63[_0xbf6a('0x4f')]);loggerPredictive['info'](_0xbf6a('0x50'),_0x55fc63['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x51'),_0x55fc63['predictiveIntervalAvgTalktime']);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x52'));if(_0x55fc63[_0xbf6a('0x4a')]>0x0){if(!_['isUndefined'](_0x55fc63[_0xbf6a('0x53')])&&_0x55fc63['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xbf6a('0x54'));if(!_[_0xbf6a('0x40')](_0x55fc63[_0xbf6a('0x55')])&&_0x55fc63[_0xbf6a('0x55')]>0x0){return!![];}loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x56'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x57'));}return![];}function mergeDataErlangB(_0x4a7eb1){return function(_0x389ba7){loggerPredictive['info'](_0xbf6a('0x58'));loggerPredictive['info'](_0xbf6a('0x59'),_0x389ba7[_0xbf6a('0x5a')]);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x5b'),_0x389ba7[_0xbf6a('0x5c')]);loggerPredictive['info'](_0xbf6a('0x5d'),_0x389ba7[_0xbf6a('0x5e')]);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x5f'),_0x389ba7[_0xbf6a('0x60')]);loggerPredictive['info'](_0xbf6a('0x5d'),_0x389ba7['erlangAbandonmentRate']);loggerPredictive[_0xbf6a('0x47')]('---------------------------');_[_0xbf6a('0x61')](_0x4a7eb1,_0x389ba7);};}function ifInterval(_0x31325b,_0x18254a){if(_[_0xbf6a('0x40')](_0x18254a)){return![];}return utils[_0xbf6a('0x62')](undefined,_0x18254a)<_0x31325b*0x3c;}function clearPredictiveAttributes(_0x1cd67a){if(_0x1cd67a['startProgressive']){_0x1cd67a['startProgressive']=undefined;loggerPredictive[_0xbf6a('0x42')](_0x1cd67a['name'],'startProgressive\x20value\x20cleared');}if(_0x1cd67a[_0xbf6a('0x2b')]){_0x1cd67a[_0xbf6a('0x2b')]=undefined;loggerPredictive['debug'](_0x1cd67a[_0xbf6a('0x45')],_0xbf6a('0x63'));}if(_0x1cd67a[_0xbf6a('0x64')]){clearInterval(_0x1cd67a['handlePredictive']);_0x1cd67a[_0xbf6a('0x64')]=undefined;loggerPredictive[_0xbf6a('0x42')](_0x1cd67a['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x13759b,_0x52a5b5){return function(_0xccaea){loggerPredictive['error'](_0x52a5b5[_0xbf6a('0x45')],_0x13759b);loggerPredictive[_0xbf6a('0x65')](_0xccaea[_0xbf6a('0x66')]);clearPredictiveAttributes(_0x52a5b5);};}function loggerCatch(_0xc614a5){return function(_0x414e06){logger['error'](_0xc614a5,util[_0xbf6a('0x43')](_0x414e06,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x339646,_0x43ef55,_0xc464e8){return function(_0xac2483){utils[_0xbf6a('0x67')](_0x43ef55,_0xc464e8,0x0);_0x43ef55[_0xbf6a('0x68')]=0x0;logger[_0xbf6a('0x65')](_0x339646,util['inspect'](_0xac2483,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x9fc6c){return function(_0x405dc0){if(isNotNull(_0x405dc0)&&isNotNull(_0x405dc0[0x0])){if(_0x405dc0[0x0][_0xbf6a('0x69')]>0x0){_0x9fc6c[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x6c')];logger[_0xbf6a('0x47')](_0xbf6a('0x6d')+_0x9fc6c[_0xbf6a('0x45')],_0x405dc0[0x0][_0xbf6a('0x69')],_0xbf6a('0x6e'));}else{_0x9fc6c['message']=utils['CAMPAIGN_STATUS'][_0xbf6a('0x6f')];logger['info']('[getContactDialer2][Empty]'+_0x9fc6c[_0xbf6a('0x45')]);}}};}function createObjHistory(_0x1ee84c,_0x388b91,_0x42000b,_0x589034,_0x4b2bd1){_0x1ee84c[_0xbf6a('0x6a')]=_0x42000b;var _0x4e2a10=new Action(_0x1ee84c,_0x388b91);var _0x21a148=new History(_0x4e2a10);_0x21a148[_0xbf6a('0x70')]=_0x589034;_0x21a148[_0xbf6a('0x71')]=_0x4b2bd1;_0x21a148['endtime']=_0x4e2a10['starttime'];return _0x21a148;}function unlockQueueStatus(_0xe55697,_0x57677f){setTimeout(function(){if(_[_0xbf6a('0x40')](_0xe55697['queueStatusComplete'])){loggerBooked[_0xbf6a('0x65')](_0xbf6a('0x72'),_0x57677f);}_0xe55697[_0xbf6a('0x73')]=!![];loggerBooked[_0xbf6a('0x47')](_0xbf6a('0x74'),_0x57677f,JSON[_0xbf6a('0x75')](_['pick'](_0xe55697,[_0xbf6a('0x45'),_0xbf6a('0x73')])));},0x1f3);}function checkInterval(_0x5ca603){return function(){if(!isNotNull(_0x5ca603[_0xbf6a('0x76')])){_0x5ca603[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')]['NULL_INTERVAL'];throw _0x5ca603[_0xbf6a('0x45')]+_0xbf6a('0x77');}if(!isNotNull(_0x5ca603[_0xbf6a('0x76')][_0xbf6a('0x78')])){_0x5ca603[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x79')];throw _0x5ca603[_0xbf6a('0x45')]+_0xbf6a('0x77');}if(!isNotNull(_['isEmpty'](_0x5ca603[_0xbf6a('0x76')]['Intervals']))){_0x5ca603['message']=utils[_0xbf6a('0x6b')][_0xbf6a('0x79')];throw _0x5ca603[_0xbf6a('0x45')]+_0xbf6a('0x77');}};}function checkIsIVRCampaignActive(_0x44dd1f){return function(){if(!utils[_0xbf6a('0x7a')](_0x44dd1f)){_0x44dd1f[_0xbf6a('0x6a')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x44dd1f['name']+_0xbf6a('0x7b');}};}function emitCampaignSummary(_0x289806){if(utils[_0xbf6a('0x7c')](_0x289806)){emit(util[_0xbf6a('0x44')](_0xbf6a('0x7d'),_0x289806[_0xbf6a('0x45')]),_0xbf6a('0x7e'),_0x289806);}}function loggerCatchQueueSummary(_0x507009,_0x181d95){return function(_0x5e7488){clearPredictiveAttributes(_0x181d95);emitCampaignSummary(_0x181d95);loggerSyncQueueSummary['debug'](_0x507009,util[_0xbf6a('0x43')](_0x5e7488,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1488bb){if(_0x1488bb[_0xbf6a('0x7f')]){if(_0x1488bb[_0xbf6a('0x80')]===0x0){_0x1488bb[_0xbf6a('0x7f')]=![];_0x1488bb[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x81')];loggerSyncQueueSummary[_0xbf6a('0x42')](_0xbf6a('0x82'),_0x1488bb[_0xbf6a('0x45')],'is\x20not\x20active');}else{_0x1488bb[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x83')];loggerSyncQueueSummary['debug'](_0xbf6a('0x82'),_0x1488bb['name'],_0xbf6a('0x84'));}emitCampaignSummary(_0x1488bb);}}function myreject(_0x2bc18c){return function(_0x2eba19){return _0x2bc18c(msgResponse(_0xbf6a('0x85'),_0xbf6a('0x86'),JSON['stringify'](_0x2eba19)));};}Dialer[_0xbf6a('0x87')][_0xbf6a('0x88')]=function(_0x130547){return!_[_0xbf6a('0x40')](_0x130547)&&_0x130547&&!_['isUndefined'](_0x130547['name'])&&!_[_0xbf6a('0x40')](_0x130547[_0xbf6a('0x89')])&&_0x130547[_0xbf6a('0x89')]&&(this['trunks'][util[_0xbf6a('0x44')]('SIP/%s',_0x130547['name'])][_0xbf6a('0x8a')]===_0xbf6a('0x8b')||this['trunks'][util[_0xbf6a('0x44')]('SIP/%s',_0x130547[_0xbf6a('0x45')])][_0xbf6a('0x8a')]===_0xbf6a('0x8c'));};Dialer[_0xbf6a('0x87')][_0xbf6a('0x8d')]=function(_0x254ebe){var _0x570284=this;return function(){if(!_0x570284['isTrunkReachable'](_0x254ebe[_0xbf6a('0x8e')])){if(!_0x570284[_0xbf6a('0x88')](_0x254ebe[_0xbf6a('0x8f')])){_0x254ebe['message']=utils['CAMPAIGN_STATUS'][_0xbf6a('0x90')];throw _0x254ebe[_0xbf6a('0x45')]+_0xbf6a('0x91');}}};};Dialer[_0xbf6a('0x87')]['checkIfTime']=function(_0x2b7b0e,_0x167e4b,_0x489f4d,_0x2560b4){var _0x2be32b=this;return function(){var _0x3c4894=!![];return _0x2be32b['ifTimeIvr'](_0x2b7b0e,_0x167e4b,_0x489f4d,_0x2560b4,_0x3c4894);};};Dialer[_0xbf6a('0x87')]['checkIfTimeIntervals']=function(_0x17361f,_0x1fcca0,_0x16bd1e,_0x5c446d){var _0x47bf0d=this;return function(){var _0x557398=![];return _0x47bf0d[_0xbf6a('0x92')](_0x17361f[_0xbf6a('0x78')],_0x1fcca0,_0x16bd1e,_0x5c446d,_0x557398);};};Dialer[_0xbf6a('0x87')][_0xbf6a('0x92')]=function(_0x1d9cd7,_0xb27172,_0x8540d5,_0x437de8,_0x295af0){var _0x5da19a=[];return new Promise(function(_0x3b2bbf,_0x32bef4){if(!isNotNull(_0x1d9cd7)){_0x437de8['message']=utils[_0xbf6a('0x6b')]['NULL_INTERVAL'];return _0x32bef4(msgResponse(_0xbf6a('0x93'),'Failure',_0x8540d5+_0xbf6a('0x94')));}if(_[_0xbf6a('0x95')](_0x1d9cd7)){_0x437de8[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x96')];return _0x32bef4(msgResponse(_0xbf6a('0x93'),_0xbf6a('0x97'),_0x8540d5+_0xbf6a('0x98')));}if(_0xb27172&&_[_0xbf6a('0x40')](config[_0xbf6a('0x99')][_0xb27172])){_0x437de8[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')]['UNKNOWN_TIMEZONE'];return _0x32bef4(msgResponse(_0xbf6a('0x93'),_0xbf6a('0x97'),_0x8540d5+'\x20Timezone\x20unknow\x20'+_0xb27172));}if(_[_0xbf6a('0x9a')](_0x1d9cd7)){for(var _0x1dea8d=0x0;_0x1dea8d<_0x1d9cd7['length'];_0x1dea8d+=0x1){_0x5da19a[_0xbf6a('0x9b')](ami[_0xbf6a('0x9c')]({'action':_0xbf6a('0x9d'),'command':util[_0xbf6a('0x44')](_0xbf6a('0x9e'),_0x1d9cd7[_0x1dea8d][_0xbf6a('0x9f')],!_[_0xbf6a('0x40')](config[_0xbf6a('0x99')][_0xb27172])?_0xb27172:'')})[_0xbf6a('0xa0')](function(_0x261e56){return _0x261e56[_0xbf6a('0xa1')][_0xbf6a('0xa2')](_0xbf6a('0xa3'))>=0x0;})[_0xbf6a('0xa4')](myreject(_0x32bef4)));}}else{_0x5da19a[_0xbf6a('0x9b')](ami[_0xbf6a('0x9c')]({'action':'command','command':util[_0xbf6a('0x44')](_0xbf6a('0x9e'),_0x1d9cd7,!_[_0xbf6a('0x40')](config[_0xbf6a('0x99')][_0xb27172])?_0xb27172:'')})[_0xbf6a('0xa0')](function(_0xde4ba1){return _0xde4ba1[_0xbf6a('0xa1')][_0xbf6a('0xa2')](_0xbf6a('0xa3'))>=0x0;})[_0xbf6a('0xa4')](myreject(_0x32bef4)));}Promise[_0xbf6a('0xa5')](_0x5da19a)[_0xbf6a('0xa0')](function(_0x5e7fd8){var _0x4632b2=_[_0xbf6a('0xa6')](_0x5e7fd8);if(_0x4632b2){return _0x3b2bbf(_0x4632b2);}else{_0x437de8['message']=_0x295af0?utils[_0xbf6a('0x6b')][_0xbf6a('0xa7')]:utils['CAMPAIGN_STATUS'][_0xbf6a('0xa8')];return _0x32bef4(msgResponse(_0xbf6a('0xa9'),_0xbf6a('0x97'),_0xbf6a('0xaa')+_0x295af0+'\x20'+_0x8540d5+_0xbf6a('0xab')+util['inspect'](_0x1d9cd7,{'showHidden':![],'depth':null})+_0xbf6a('0xac')+_0xb27172));}})['catch'](function(_0x37fadf){return _0x32bef4(msgResponse(_0xbf6a('0x93'),_0xbf6a('0x97'),JSON['stringify'](_0x37fadf)));});});};Dialer[_0xbf6a('0x87')][_0xbf6a('0x3d')]=function(){var _0xc2774f=this;return cmHopper[_0xbf6a('0xad')]({'active':![]},{'where':{'active':!![]}})[_0xbf6a('0xa0')](function(){setInterval(function(){_0xc2774f[_0xbf6a('0xae')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x31d6cf=this;var _0x2cb270;for(var _0x672a0f in this[_0xbf6a('0x23')]){if(typeof this[_0xbf6a('0x23')][_0x672a0f]!==_0xbf6a('0xaf')){_0x2cb270=this[_0xbf6a('0x23')][_0x672a0f];if(utils['isIVRCampaign'](_0x2cb270)&&utils[_0xbf6a('0x7a')](_0x2cb270)){_0x2cb270['sendMessageOneNotActive']=!![];Promise[_0xbf6a('0xb0')]()['then'](checkIsIVRCampaignActive(_0x2cb270))[_0xbf6a('0xa0')](checkInterval(_0x2cb270))[_0xbf6a('0xa0')](_0x31d6cf['checkIsTrunkReachable'](_0x2cb270))[_0xbf6a('0xa0')](_0x31d6cf['checkIfTime'](_0x2cb270[_0xbf6a('0xb1')],_0x2cb270['dialTimezone'],_0x2cb270['name'],_0x2cb270))[_0xbf6a('0xa0')](_0x31d6cf[_0xbf6a('0xb2')](_0x2cb270[_0xbf6a('0x76')],_0x2cb270['dialTimezone'],_0x2cb270[_0xbf6a('0x45')],_0x2cb270))['then'](_0x31d6cf['launchHandleIvr'](_0x2cb270))[_0xbf6a('0xa4')](loggerCatchQueueSummary(_0xbf6a('0xb3'),_0x2cb270));}else{notSendMessagesCampaign(_0x2cb270);}}}};Dialer[_0xbf6a('0x87')][_0xbf6a('0xb4')]=function(_0x368949){if(_0x368949[_0xbf6a('0xb5')]!==_0xbf6a('0xb')){clearPredictiveAttributes(_0x368949);}switch(_0x368949[_0xbf6a('0xb5')]){case'progressive':this[_0xbf6a('0xb6')](_0x368949,0x1);break;case _0xbf6a('0xb7'):this[_0xbf6a('0xb6')](_0x368949,_0x368949[_0xbf6a('0xb8')]);break;case _0xbf6a('0xb'):this[_0xbf6a('0xb')](_0x368949);break;case _0xbf6a('0xa'):this[_0xbf6a('0xb6')](_0x368949,0x1);break;default:logger['error'](_0xbf6a('0xb9'),_0x368949['name'],_0xbf6a('0xba'));}};Dialer[_0xbf6a('0x87')]['ifTime']=function(_0xa59a25,_0x44312f){var _0x9b4e89=_0xa59a25[_0xbf6a('0xbb')];var _0x2520e3=_0x44312f?_0xa59a25['dialGlobalInterval']:_0xa59a25[_0xbf6a('0x76')][_0xbf6a('0x78')];logger[_0xbf6a('0xbc')](_0xbf6a('0xbd'),_0x2520e3,_0x9b4e89,_0xa59a25[_0xbf6a('0x45')],util[_0xbf6a('0x44')]('Voice\x20Queue\x20%s\x20$s',_0xa59a25[_0xbf6a('0x45')],_0xa59a25['id']));var _0x3d75c4=null;return Interval[_0xbf6a('0xbe')](_0x2520e3,_0x9b4e89)[_0xbf6a('0xa0')](function(_0x12d40c){if(_0x12d40c===!![]){return _0x12d40c;}else{_0xa59a25[_0xbf6a('0x6a')]=_0x44312f?utils['CAMPAIGN_STATUS'][_0xbf6a('0xa7')]:utils[_0xbf6a('0x6b')][_0xbf6a('0xa8')];_0x3d75c4=msgResponse(_0xbf6a('0xa9'),_0xbf6a('0x97'),'Global:\x20'+_0x44312f+'\x20'+_0xa59a25['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0xbf6a('0x43')](_0x2520e3,{'showHidden':![],'depth':null})+_0xbf6a('0xac')+_0x9b4e89);}if(_0x3d75c4!==null){logger[_0xbf6a('0xbc')](_0xbf6a('0xbf'),_0x3d75c4);_0x3d75c4[_0xbf6a('0xc0')]=_0x44312f;throw _0x3d75c4;}})[_0xbf6a('0xa4')](function(_0x12191c){logger[_0xbf6a('0x65')](_0xbf6a('0xc1'),_0x12191c);throw msgResponse(_0xbf6a('0x85'),_0xbf6a('0x86'),util[_0xbf6a('0x43')](_0x12191c,{'showHidden':![],'depth':null}));});};Dialer[_0xbf6a('0x87')][_0xbf6a('0xc2')]=function(_0x1b236b){if(this['voiceQueues'][_0x1b236b[_0xbf6a('0xc3')]]){if(this[_0xbf6a('0x29')][_0x1b236b['uniqueid']]&&this['uniqueId'][_0x1b236b[_0xbf6a('0xc4')]][_0xbf6a('0x41')]!==_0xbf6a('0xc5')){this['updateOriginated'](this[_0xbf6a('0x22')][_0x1b236b['queue']]);this[_0xbf6a('0x29')][_0x1b236b[_0xbf6a('0xc4')]]['answertime']=moment()['format'](_0xbf6a('0xc6'));}}};Dialer[_0xbf6a('0x87')]['syncAgentComplete']=function(_0x321d59){var _0x360a97=this[_0xbf6a('0x29')][_0x321d59[_0xbf6a('0xc4')]];if(this['voiceQueues'][_0x321d59[_0xbf6a('0xc3')]]){if(_0x360a97&&_0x360a97[_0xbf6a('0x41')]!=='ivr'){delete this[_0xbf6a('0x29')][_0x321d59[_0xbf6a('0xc4')]];this[_0xbf6a('0x22')][_0x321d59['queue']]['outboundAnswerCallsDay']+=0x1;var _0x34a30d=new AgentComplete(_0x360a97,_0x321d59);if(_0x321d59[_0xbf6a('0xc7')]===_0xbf6a('0xc8')){_0x34a30d[_0xbf6a('0xc9')]=this[_0xbf6a('0x22')][_0x321d59[_0xbf6a('0xc3')]]['dialQueueProject2']&&this['voiceQueues'][_0x321d59[_0xbf6a('0xc3')]][_0xbf6a('0xca')]?moment()[_0xbf6a('0x44')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xbf6a('0xcb')](_0x34a30d)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xcc')));hopperUtils[_0xbf6a('0xcd')](_0x34a30d)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xce')));}}};Dialer[_0xbf6a('0x87')]['syncQueueCallerAbandon']=function(_0xb7b86b){var _0x5d772e=this[_0xbf6a('0x29')][_0xb7b86b['uniqueid']];var _0x235a56=this;var _0x4fe9fe=![];var _0x2cce99;var _0x535c70;if(this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]]){if(_0x5d772e&&_0x5d772e[_0xbf6a('0x41')]!==_0xbf6a('0xc5')){delete this[_0xbf6a('0x29')][_0xb7b86b[_0xbf6a('0xc4')]];this[_0xbf6a('0xcf')](this[_0xbf6a('0x22')][_0xb7b86b['queue']]);_0x5d772e[_0xbf6a('0xd0')]=moment()[_0xbf6a('0x44')](_0xbf6a('0xc6'));var _0x4f1164=new QueueCallerAbandon(_0x5d772e,_0xb7b86b);if(utils[_0xbf6a('0x62')](_0x5d772e[_0xbf6a('0xd0')],_0x5d772e['responsetime'])>=_0x5d772e[_0xbf6a('0xd1')]){this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0x4d')]+=0x1;this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xd2')]+=0x1;_0x4f1164[_0xbf6a('0x70')]=0xa;_0x4f1164[_0xbf6a('0x71')]=_0xbf6a('0xd3');_0x4f1164['dropreason']='TIMEOUT';_0x4f1164[_0xbf6a('0xc9')]=this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xd4')]?moment()[_0xbf6a('0x44')](_0xbf6a('0xc6')):undefined;_0x4f1164[_0xbf6a('0xd5')]+=0x1;_0x4f1164[_0xbf6a('0xd6')]+=0x1;_0x2cce99=this['voiceQueues'][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xd7')];_0x535c70=this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xbf6a('0xd8')](_0x4f1164,_0x4f1164[_0xbf6a('0x70')],_0x5d772e[_0xbf6a('0xd9')])['then'](function(_0x1846c9){_0x4fe9fe=_0x1846c9['additional']==0x1;if(_0x4f1164[_0xbf6a('0xd5')]>=_0x235a56[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xda')]){_0x235a56[_0xbf6a('0xdb')](_0x4f1164,_0x1846c9['additional']);}else{hopperUtils[_0xbf6a('0xdc')]({'active':![],'countdropretry':_0x4f1164['countdropretry'],'scheduledat':moment()[_0xbf6a('0xdd')](_0x235a56[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xd7')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x5d772e[_0xbf6a('0xdf')],'ListId':_0x5d772e['ListId'],'VoiceQueueId':_0x5d772e[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x5d772e[_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xe2')));var _0x5e1e36=new History(_0x4f1164);_0x5e1e36['state']=0xa;_0x5e1e36[_0xbf6a('0x71')]='Drop';_0x5e1e36[_0xbf6a('0xe3')]=moment()[_0xbf6a('0x44')](_0xbf6a('0xc6'));_0x5e1e36[_0xbf6a('0xe4')]=_0x5e1e36[_0xbf6a('0xe3')];_0x5e1e36[_0xbf6a('0xe5')]=_0x4f1164[_0xbf6a('0xe5')];_0x5e1e36[_0xbf6a('0xe6')]=_0x4f1164[_0xbf6a('0xe6')];hopperUtils['createHistory'](_0x5e1e36)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xe7')));}})[_0xbf6a('0xa0')](function(){if(_0x4fe9fe)hopperUtils['swapAdditionalPhones'](_0x4f1164,_0x2cce99,_0x535c70)[_0xbf6a('0xa0')](function(){return 0x1;});});}else{this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0x4f')]+=0x1;this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xe8')]+=0x1;_0x4f1164[_0xbf6a('0x70')]=0xb;_0x4f1164['statedesc']=_0xbf6a('0xe9');_0x4f1164[_0xbf6a('0xea')]=_0xbf6a('0xeb');_0x4f1164[_0xbf6a('0xec')]+=0x1;_0x4f1164[_0xbf6a('0xd6')]+=0x1;_0x2cce99=this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xed')];_0x535c70=this[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xee')];hopperUtils[_0xbf6a('0xd8')](_0x4f1164,_0x4f1164[_0xbf6a('0x70')],_0x5d772e[_0xbf6a('0xd9')])['then'](function(_0x17d1a3){if(_0x4f1164[_0xbf6a('0xec')]>=_0x235a56[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xef')]){_0x235a56[_0xbf6a('0xdb')](_0x4f1164,_0x17d1a3[_0xbf6a('0xf0')]);}else{hopperUtils[_0xbf6a('0xdc')]({'active':![],'countabandonedretry':_0x4f1164[_0xbf6a('0xec')],'scheduledat':moment()[_0xbf6a('0xdd')](_0x235a56[_0xbf6a('0x22')][_0xb7b86b[_0xbf6a('0xc3')]][_0xbf6a('0xed')],_0xbf6a('0xde'))['format'](_0xbf6a('0xc6')),'ContactId':_0x5d772e['ContactId'],'ListId':_0x5d772e[_0xbf6a('0xf1')],'VoiceQueueId':_0x5d772e[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x5d772e['CampaignId']||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xf2')));var _0x4635e4=new History(_0x4f1164);_0x4635e4[_0xbf6a('0x70')]=0xb;_0x4635e4[_0xbf6a('0x71')]='Abandoned';_0x4635e4[_0xbf6a('0xe3')]=moment()[_0xbf6a('0x44')](_0xbf6a('0xc6'));_0x4635e4[_0xbf6a('0xe4')]=_0x4635e4[_0xbf6a('0xe3')];_0x4635e4[_0xbf6a('0xe5')]=_0x4f1164[_0xbf6a('0xe5')];_0x4635e4[_0xbf6a('0xe6')]=_0x4f1164['calleridnum'];hopperUtils[_0xbf6a('0xcb')](_0x4635e4)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xf3')));}})['then'](function(){if(_0x4fe9fe)hopperUtils['swapAdditionalPhones'](_0x4f1164,_0x2cce99,_0x535c70)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0xbf6a('0x38')]=function(_0x1393de){if(this['actions'][_0x1393de[_0xbf6a('0xc4')]]){this[_0xbf6a('0x27')][_0x1393de[_0xbf6a('0xc4')]][_0xbf6a('0xf4')]=_0x1393de[_0xbf6a('0xf4')];}if(this[_0xbf6a('0x29')][_0x1393de[_0xbf6a('0xc4')]]){this[_0xbf6a('0x29')][_0x1393de['uniqueid']]['channel']=_0x1393de[_0xbf6a('0xf4')];}};Dialer[_0xbf6a('0x87')][_0xbf6a('0xf5')]=function(_0x1e9616){if(!this[_0xbf6a('0x27')][_0x1e9616[_0xbf6a('0xf6')]]){return;}var _0x3548a9=this['voiceQueues'][this[_0xbf6a('0x27')][_0x1e9616['actionid']]['queue']][_0xbf6a('0xf7')]||_0xbf6a('0xf8');if(_0x3548a9===_0xbf6a('0xf9')){if(this[_0xbf6a('0x27')][_0x1e9616[_0xbf6a('0xf6')]]&&_[_0xbf6a('0xfa')](this[_0xbf6a('0x27')][_0x1e9616['actionid']][_0xbf6a('0xfb')])&&_0x1e9616[_0xbf6a('0x8a')]==='1'&&_0x1e9616[_0xbf6a('0xfc')]==='0'){if(this[_0xbf6a('0xfd')][_0x1e9616[_0xbf6a('0xfe')]]){if(!this[_0xbf6a('0xfd')][_0x1e9616['stateinterface']][_0xbf6a('0xfb')]){this[_0xbf6a('0xfd')][_0x1e9616[_0xbf6a('0xfe')]][_0xbf6a('0xfb')]=!![];this['actions'][_0x1e9616[_0xbf6a('0xf6')]][_0xbf6a('0xfb')]=!![];this[_0xbf6a('0x27')][_0x1e9616['actionid']]['stateinterface']=_0x1e9616['stateinterface'];}}}}else if(_0x3548a9==='rrmemory'){if(this['actions'][_0x1e9616[_0xbf6a('0xf6')]]){if(this['agents'][_0x1e9616['stateinterface']]){this[_0xbf6a('0x27')][_0x1e9616[_0xbf6a('0xf6')]][_0xbf6a('0xfe')]=_0x1e9616['stateinterface'];if(_[_0xbf6a('0xfa')](this[_0xbf6a('0x2e')][this[_0xbf6a('0x27')][_0x1e9616[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]])){this[_0xbf6a('0x2e')][this['actions'][_0x1e9616['actionid']][_0xbf6a('0xc3')]]=[];}this[_0xbf6a('0x2e')][this[_0xbf6a('0x27')][_0x1e9616[_0xbf6a('0xf6')]]['queue']][_0xbf6a('0x9b')](_[_0xbf6a('0x61')](_[_0xbf6a('0xff')](this[_0xbf6a('0x27')][_0x1e9616['actionid']],[_0xbf6a('0x100'),_0xbf6a('0xfe')]),{'status':_0x1e9616[_0xbf6a('0x8a')],'paused':_0x1e9616[_0xbf6a('0xfc')]}));}}}};Dialer['prototype'][_0xbf6a('0x3c')]=function(_0x3fc107){if(!this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]]){return;}var _0x23bbad=this;var _0x1f0b70=this[_0xbf6a('0x22')][this[_0xbf6a('0x27')][_0x3fc107['actionid']][_0xbf6a('0xc3')]];var _0x81c2=_0x1f0b70[_0xbf6a('0xf7')]||_0xbf6a('0xf8');if(_0x81c2===_0xbf6a('0xf9')){if(this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]]&&this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xfe')]){this[_0xbf6a('0x21')]['run'](this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0x100')],this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xfe')])[_0xbf6a('0xa4')](function(_0x3358a3){logger[_0xbf6a('0x65')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x3358a3,{'showHidden':![],'depth':null}));})['finally'](function(){_0x23bbad[_0xbf6a('0xcf')](_0x23bbad[_0xbf6a('0x22')][_0x23bbad[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]);_0x23bbad[_0xbf6a('0xfd')][_0x23bbad[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]]['stateinterface']][_0xbf6a('0xfb')]=![];delete _0x23bbad[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]];unlockQueueStatus(_0x1f0b70);});}else{this[_0xbf6a('0xcf')](this[_0xbf6a('0x22')][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xdf')],'ListId':this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xf1')],'VoiceQueueId':this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xe0')]||undefined,'CampaignId':this[_0xbf6a('0x27')][_0x3fc107['actionid']][_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x101')));delete this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]];unlockQueueStatus(_0x1f0b70);}}else if(_0x81c2===_0xbf6a('0xf8')){var _0x3239da;if(this[_0xbf6a('0x27')][_0x3fc107['actionid']]&&!_['isEmpty'](this['queueBooked'][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]])){if(this[_0xbf6a('0x102')][_0x23bbad[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]){this[_0xbf6a('0x102')][_0x23bbad['actions'][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]=this[_0xbf6a('0x102')][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]?this[_0xbf6a('0x102')][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]]['queue']]:this[_0xbf6a('0x2e')][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]]?this[_0xbf6a('0x2e')][this[_0xbf6a('0x27')][_0x3fc107['actionid']][_0xbf6a('0xc3')]][_0xbf6a('0x103')]||0x0:0x0;}this[_0xbf6a('0x2e')][this['actions'][_0x3fc107[_0xbf6a('0xf6')]]['queue']][_0xbf6a('0x103')]=this[_0xbf6a('0x102')][this[_0xbf6a('0x27')][_0x3fc107[_0xbf6a('0xf6')]][_0xbf6a('0xc3')]];for(var _0x418cb5=0x0;_0x418cb5=_0x192b16['dialGlobalMaxRetry']){_0x4d88b9[_0xbf6a('0x129')](_0x554637,_0x2647ee,_0x2fdaf7,_0xbf6a('0x12a'));}else{if(_0x554637[_0xbf6a('0x122')]>=_0x192b16['dialMachineMaxRetry']){_0x4d88b9[_0xbf6a('0x12b')](_0x554637,_0x2647ee,_0x2fdaf7,'reason\x2019\x20machine....');}else{hopperUtils[_0xbf6a('0xdc')]({'active':![],'countmachineretry':_0x554637[_0xbf6a('0x122')],'scheduledat':moment()[_0xbf6a('0xdd')](_0x192b16[_0xbf6a('0x12c')],'minutes')[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x554637['ContactId'],'ListId':_0x554637[_0xbf6a('0xf1')],'VoiceQueueId':_0x554637[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x554637[_0xbf6a('0xe1')]||undefined})['catch'](loggerCatch(_0xbf6a('0x12d')));_0x2647ee({'reschedule':0x1});}}});}if(_0x131453[_0xbf6a('0x41')]===_0xbf6a('0xc5')&&this[_0xbf6a('0x23')][_0x131453[_0xbf6a('0xc3')]][_0xbf6a('0x118')]&&_0x37606f[_0xbf6a('0x121')]===_0xbf6a('0x119')){delete this['uniqueId'][_0x37606f[_0xbf6a('0xc4')]];this[_0xbf6a('0xcf')](this[_0xbf6a('0x23')][_0x131453[_0xbf6a('0xc3')]]);_0x2bd588=new Hangup(_0x131453,_0x37606f);_0x2bd588['state']=0x12;_0x2bd588[_0xbf6a('0x71')]=_0xbf6a('0x11c');_0x2bd588[_0xbf6a('0x11d')]=_0xbf6a('0x11e');ami['emit'](_0xbf6a('0x12e'),ut[_0xbf6a('0x120')](_0x2bd588,_0xbf6a('0x123')));this['saveInDb'](_0x2bd588,_0xbf6a('0x12f'),'[syncHangupInAMDIvr]');}if(_0x131453['type']===_0xbf6a('0xc5')&&this[_0xbf6a('0x23')][_0x131453[_0xbf6a('0xc3')]][_0xbf6a('0x118')]&&_0x37606f[_0xbf6a('0x121')]===_0xbf6a('0x130')){return new Promise(function(_0xb61f37,_0x4bc029){delete _0x4d88b9[_0xbf6a('0x29')][_0x37606f[_0xbf6a('0xc4')]];_0x4d88b9['updateOriginated'](_0x4d88b9['campaigns'][_0x131453['queue']]);_0x4d88b9['campaigns'][_0x131453[_0xbf6a('0xc3')]]['outboundAnswerCallsDay']+=0x1;_0x4d88b9[_0xbf6a('0x23')][_0x131453[_0xbf6a('0xc3')]][_0xbf6a('0x11b')]+=0x1;var _0x3744be=_0x4d88b9[_0xbf6a('0x23')][_0x131453['queue']];var _0x442972=new Hangup(_0x131453,_0x37606f);_0x442972[_0xbf6a('0x70')]=0x13;_0x442972['statedesc']=_0xbf6a('0x131');_0x442972['membername']=_0xbf6a('0x11e');_0x442972[_0xbf6a('0x122')]+=0x1;_0x442972[_0xbf6a('0xd6')]+=0x1;_0x442972['amd']=!![];ami[_0xbf6a('0x11f')](_0xbf6a('0x12e'),ut[_0xbf6a('0x120')](_0x442972,'amd'));hopperUtils[_0xbf6a('0xcb')](_0x442972)[_0xbf6a('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x442972[_0xbf6a('0x124')]+_0x442972['countcongestionretry']+_0x442972[_0xbf6a('0x126')]+_0x442972[_0xbf6a('0x127')]+_0x442972[_0xbf6a('0xd5')]+_0x442972[_0xbf6a('0xec')]+_0x442972[_0xbf6a('0x122')]+_0x442972[_0xbf6a('0x128')]>=_0x3744be[_0xbf6a('0x132')]){_0x4d88b9[_0xbf6a('0x129')](_0x442972,_0xb61f37,_0x4bc029,_0xbf6a('0x12a'));}else{if(_0x442972['countmachineretry']>=_0x3744be[_0xbf6a('0x133')]){_0x4d88b9[_0xbf6a('0x12b')](_0x442972,_0xb61f37,_0x4bc029,_0xbf6a('0x134'));}else{hopperUtils[_0xbf6a('0xdc')]({'active':![],'countmachineretry':_0x442972[_0xbf6a('0x122')],'scheduledat':moment()[_0xbf6a('0xdd')](_0x3744be[_0xbf6a('0x12c')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x442972[_0xbf6a('0xdf')],'ListId':_0x442972['ListId'],'VoiceQueueId':_0x442972[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x442972[_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x12d')));_0xb61f37({'reschedule':0x1});}}});}}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x135')]=function(_0x49febc){var _0xaf4953=this[_0xbf6a('0x29')][_0x49febc[_0xbf6a('0xc4')]];var _0x520fdd;if(_0xaf4953&&_0xaf4953[_0xbf6a('0x41')]===_0xbf6a('0xc5')){delete this[_0xbf6a('0x29')][_0x49febc['uniqueid']];this['updateOriginated'](this[_0xbf6a('0x23')][_0xaf4953[_0xbf6a('0xc3')]]);this['campaigns'][_0xaf4953[_0xbf6a('0xc3')]][_0xbf6a('0x136')]+=0x1;_0x520fdd=new Hangup(_0xaf4953,_0x49febc);hopperUtils[_0xbf6a('0xcb')](_0x520fdd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x137')));hopperUtils[_0xbf6a('0xcd')](_0x520fdd)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xaf4953&&_0xaf4953[_0xbf6a('0x41')]!=='ivr'&&isNotNull(this[_0xbf6a('0x22')][_0xaf4953[_0xbf6a('0xc3')]]['dialQueueProject'])){delete this[_0xbf6a('0x29')][_0x49febc[_0xbf6a('0xc4')]];this[_0xbf6a('0xcf')](this[_0xbf6a('0x22')][_0xaf4953[_0xbf6a('0xc3')]]);this[_0xbf6a('0x22')][_0xaf4953[_0xbf6a('0xc3')]][_0xbf6a('0x11a')]+=0x1;this['voiceQueues'][_0xaf4953[_0xbf6a('0xc3')]][_0xbf6a('0x11b')]+=0x1;_0x520fdd=new Hangup(_0xaf4953,_0x49febc);_0x520fdd[_0xbf6a('0x70')]=0x10;_0x520fdd['statedesc']=_0xbf6a('0x138');_0x520fdd[_0xbf6a('0x11d')]='AGI';hopperUtils[_0xbf6a('0xcb')](_0x520fdd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x137')));hopperUtils['moveContactManagedDialer'](_0x520fdd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x139')));}if(_0xaf4953&&_0xaf4953['type']!=='ivr'&&!isNotNull(this[_0xbf6a('0x22')][_0xaf4953['queue']][_0xbf6a('0x13a')])){delete this[_0xbf6a('0x29')][_0x49febc['uniqueid']];this[_0xbf6a('0xcf')](this[_0xbf6a('0x22')][_0xaf4953['queue']]);this[_0xbf6a('0x22')][_0xaf4953[_0xbf6a('0xc3')]]['outboundUnknownCallsDay']+=0x1;_0x520fdd=new Hangup(_0xaf4953,_0x49febc);_0x520fdd['state']=0xc;_0x520fdd[_0xbf6a('0x71')]=_0x49febc['cause-txt'];_0x520fdd['membername']=_0xbf6a('0x13b');hopperUtils['createHistory'](_0x520fdd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x137')));hopperUtils[_0xbf6a('0xcd')](_0x520fdd)['catch'](loggerCatch(_0xbf6a('0x139')));}};Dialer[_0xbf6a('0x87')][_0xbf6a('0xd')]=function(_0x416c6a){var _0x106c13=this;if(!_0x106c13[_0xbf6a('0x2f')][_0x416c6a[_0xbf6a('0x45')]]){_0x106c13[_0xbf6a('0x2f')][_0x416c6a[_0xbf6a('0x45')]]={'running':![]};}else if(_0x106c13[_0xbf6a('0x2f')][_0x416c6a[_0xbf6a('0x45')]][_0xbf6a('0x13c')]===!![]){return;}else if(_0x106c13[_0xbf6a('0x2f')][_0x416c6a['name']][_0xbf6a('0x13c')]===![]){_0x106c13[_0xbf6a('0x2f')][_0x416c6a[_0xbf6a('0x45')]][_0xbf6a('0x13c')]=!![];}var _0x116704=_0x106c13[_0xbf6a('0x22')][_0x416c6a[_0xbf6a('0x45')]];var _0x568840=_0x116704[_0xbf6a('0x6a')]!==utils[_0xbf6a('0x6b')][_0xbf6a('0x81')];var _0x442b17=utils[_0xbf6a('0x13d')](_0x116704);_0x116704[_0xbf6a('0x13e')]=utils[_0xbf6a('0x13f')](_0x116704,_0x106c13[_0xbf6a('0x24')]);Promise[_0xbf6a('0xb0')]()[_0xbf6a('0xa0')](function(){if(_0x116704[_0xbf6a('0x13e')]===utils[_0xbf6a('0x6b')]['INACTIVE']){if(_0x568840){clearPredictiveAttributes(_0x116704);_0x416c6a[_0xbf6a('0x2b')]=undefined;_0x416c6a[_0xbf6a('0x2c')]=undefined;}if(_0x116704[_0xbf6a('0x13e')]===utils[_0xbf6a('0x6b')][_0xbf6a('0x81')]){_0x416c6a['available']=0x0;_0x416c6a[_0xbf6a('0xfc')]=0x0;_0x416c6a[_0xbf6a('0x140')]=0x0;_0x416c6a['talking']=0x0;_0x416c6a['pTalking']=0x0;}}else if(_0x116704['statusMessage']===utils[_0xbf6a('0x6b')][_0xbf6a('0x141')]&&!_0x442b17){return _0x106c13['ifTime'](_0x116704,!![])[_0xbf6a('0xa0')](function(){return _0x106c13[_0xbf6a('0x93')](_0x116704,![]);})[_0xbf6a('0xa0')](function(){return _0x106c13[_0xbf6a('0xb4')](_0x116704);})[_0xbf6a('0xa4')](function(_0x365b39){loggerSyncQueueSummary[_0xbf6a('0x42')](_0xbf6a('0x142'),util[_0xbf6a('0x43')](_0x365b39,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x116704);});}else{clearPredictiveAttributes(_0x116704);}})['then'](function(){var _0x598af3=_0x416c6a['compareToOutboundQueue'](_0x116704);if(_0x598af3||_0x116704['queueSummaryCountersUpdated']){_0x116704[_0xbf6a('0x143')]=![];_0x416c6a[_0xbf6a('0x144')](_0x116704);Object[_0xbf6a('0x145')](_0x116704,_0x416c6a);emitOutboundVoiceQueueSummary(_0x416c6a);}_0x106c13[_0xbf6a('0x2f')][_0x116704['name']]['running']=![];})[_0xbf6a('0xa4')](function(_0x2cf68f){logger[_0xbf6a('0x65')]('[syncQueueSummary]',util[_0xbf6a('0x43')](_0x2cf68f,{'showHidden':![],'depth':null}));_0x106c13['queuesSummary'][_0x116704[_0xbf6a('0x45')]][_0xbf6a('0x13c')]=![];});};Dialer[_0xbf6a('0x87')][_0xbf6a('0x146')]=_['throttle'](function(){var _0x5f3629=_['filter'](this['voiceQueues'],function(_0x7607c){return _0x7607c[_0xbf6a('0x147')];});var _0x3ea36d=_[_0xbf6a('0x148')](this[_0xbf6a('0xfd')],function(_0x1f62a9){return _0x1f62a9[_0xbf6a('0x149')]&&_0x1f62a9[_0xbf6a('0x8a')]===_0xbf6a('0x8b');});if(_0x5f3629[_0xbf6a('0x104')]>0x0&&_0x3ea36d[_0xbf6a('0x104')]>0x0){return Promise[_0xbf6a('0xb0')]()[_0xbf6a('0xa0')](cmHopper['handlePreviewRecallNotifications'](_[_0xbf6a('0x14a')](_0x5f3629,'id'),previewRecallmeReminderInterval,_[_0xbf6a('0x14a')](_0x3ea36d,'id')))['then'](function(_0x47b280){for(var _0x21336f=0x0;_0x21336f<_0x47b280['length'];_0x21336f++){var _0x396af2=_0x47b280[_0x21336f][_0xbf6a('0x14b')][_0xbf6a('0x45')];if(_0x396af2)io['to'](util[_0xbf6a('0x44')](_0xbf6a('0x14c'),_0x396af2))[_0xbf6a('0x11f')](_0xbf6a('0x14d'),{'hopper':_0x47b280[_0x21336f]});}})[_0xbf6a('0xa4')](function(_0x2a3afa){logger['error'](_0xbf6a('0x14e'),_0x2a3afa);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbf6a('0x87')][_0xbf6a('0x14f')]=function(){var _0x546f6f=this;setInterval(function(){_0x546f6f[_0xbf6a('0x150')](_0x546f6f[_0xbf6a('0x29')],_0xbf6a('0x151'));_0x546f6f[_0xbf6a('0x150')](_0x546f6f[_0xbf6a('0x27')],_0xbf6a('0x152'));},0x32c8);};Dialer[_0xbf6a('0x87')][_0xbf6a('0x150')]=function(_0x30e1f2,_0x41c046){var _0x3c46a6=this;for(var _0x52c87 in _0x30e1f2){if(typeof _0x30e1f2[_0x52c87]!==_0xbf6a('0xaf')){this[_0xbf6a('0x153')][_0xbf6a('0x1e')](function(){if(!_[_0xbf6a('0xfa')](_0x30e1f2[_0x52c87])){return ami[_0xbf6a('0x9c')]({'action':_0xbf6a('0x8a'),'channel':_0x30e1f2[_0x52c87][_0xbf6a('0xf4')]})[_0xbf6a('0xa4')](function(_0x34e61b){if(_0x34e61b[_0xbf6a('0x6a')]===_0xbf6a('0x154')){setTimeout(function(){if(_0x30e1f2[_0x52c87]&&_0x30e1f2[_0x52c87][_0xbf6a('0x41')]!==_0xbf6a('0xc5')){_0x3c46a6[_0xbf6a('0xcf')](_0x3c46a6[_0xbf6a('0x22')][_0x30e1f2[_0x52c87]['queue']]);logger[_0xbf6a('0x65')](_0xbf6a('0x155'),_0x41c046,_0x52c87,_0x30e1f2[_0x52c87][_0xbf6a('0xc3')]);delete _0x30e1f2[_0x52c87];}if(_0x30e1f2[_0x52c87]&&_0x30e1f2[_0x52c87]['type']===_0xbf6a('0xc5')){_0x3c46a6['updateOriginated'](_0x3c46a6[_0xbf6a('0x23')][_0x30e1f2[_0x52c87][_0xbf6a('0xc3')]]);logger[_0xbf6a('0x65')](_0xbf6a('0x156'),_0x41c046,_0x52c87,_0x30e1f2[_0x52c87]['queue']);delete _0x30e1f2[_0x52c87];}},0x2328);}});}});}}};Dialer[_0xbf6a('0x87')]['getVoiceQueueRtPauses']=function(_0x3c593f){return Promise[_0xbf6a('0xb0')]()['then'](voiceQueueRt[_0xbf6a('0x157')](_0x3c593f))['catch'](loggerCatch(_0xbf6a('0x158')));};Dialer[_0xbf6a('0x87')][_0xbf6a('0xcf')]=function(_0x98dc42){if(!_[_0xbf6a('0x40')](_0x98dc42)&&_0x98dc42!==null){if(typeof _0x98dc42['originated']!==_0xbf6a('0xaf')){if(_0x98dc42[_0xbf6a('0x80')]>0x0){_0x98dc42[_0xbf6a('0x80')]-=0x1;}else{logger['error'](_0xbf6a('0x159'));}}}else{logger[_0xbf6a('0x65')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x15a')]=function(_0x34f6c5,_0x5c27ba){var _0x428368=this;return function(_0x1260cd){_0x428368[_0xbf6a('0xcf')](_0x5c27ba);logger['error'](_0x34f6c5,util[_0xbf6a('0x43')](_0x1260cd,{'showHidden':![],'depth':null}));};};Dialer[_0xbf6a('0x87')]['emptyContact']=function(_0x53cf1c,_0x281ff5,_0x1ff406){var _0x548350={'state':0x19,'statedesc':_0xbf6a('0x15b')};this[_0xbf6a('0xcf')](_0x281ff5);this[_0xbf6a('0x15c')](_[_0xbf6a('0x61')](_0x548350,_[_0xbf6a('0xff')](_0x1ff406,[_0xbf6a('0xdf'),'ListId',_0xbf6a('0x15d'),_0xbf6a('0xe0'),'CampaignId'])),'[emptyContact][createHistory]',_0xbf6a('0x15e'));logger[_0xbf6a('0x65')](_0x53cf1c);};Dialer[_0xbf6a('0x87')][_0xbf6a('0x15c')]=function(_0x27e318,_0x3fe957,_0x562321){hopperUtils[_0xbf6a('0xcb')](_0x27e318)['catch'](loggerCatch(_0x3fe957));hopperUtils[_0xbf6a('0xcd')](_0x27e318)['catch'](loggerCatch(_0x562321));};Dialer['prototype'][_0xbf6a('0xdb')]=function(_0x4f6c98,_0x46a14a){hopperUtils['createHistory'](_0x4f6c98)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xcc')));if(_0x46a14a==0x0){hopperUtils['moveContactManagedDialer'](_0x4f6c98)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x15f')));}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x14e')]=function(_0xeb331c){return Promise[_0xbf6a('0xb0')]()[_0xbf6a('0xa0')](cmHopper[_0xbf6a('0x160')](_0xeb331c['id'],previewRecallmeReminderInterval))[_0xbf6a('0xa0')](function(_0x452162){for(var _0x247377=0x0;_0x247377<_0x452162[_0xbf6a('0x104')];_0x247377++){var _0x2f76ae=_0x452162[_0x247377][_0xbf6a('0x14b')][_0xbf6a('0x45')];if(_0x2f76ae)io['to'](util['format']('user:%s',_0x2f76ae))[_0xbf6a('0x11f')]('user:dialPreviewRecallReminder',{'hopper':_0x452162[_0x247377]});}})[_0xbf6a('0xa4')](function(){});};Dialer[_0xbf6a('0x87')][_0xbf6a('0x161')]=function(_0x558ee2){var _0x2f5b2e=this;return function(){_0x2f5b2e[_0xbf6a('0x162')](_0x558ee2);};};Dialer[_0xbf6a('0x87')][_0xbf6a('0x163')]=function(_0x43c25e,_0x2c1894){var _0x20465b=this;var _0x12729e=uuid['v4']();this[_0xbf6a('0x27')][_0x12729e]=new Action(_0x43c25e,_0x2c1894,_0x12729e);return new Promise(function(_0x11e012,_0x554309){if(_[_0xbf6a('0x40')](_0x43c25e)&&typeof _0x43c25e!=='object'){return _0x554309(msgResponse('originate',_0xbf6a('0x97'),_0xbf6a('0x164')));}if(_['isUndefined'](_0x2c1894[_0xbf6a('0x165')])||_0x2c1894[_0xbf6a('0x165')]===null){return _0x554309(msgResponse('originate',_0xbf6a('0x97'),_0xbf6a('0x166')));}var _0x592042={'XMD-CALLERID':_0x20465b[_0xbf6a('0x27')][_0x12729e][_0xbf6a('0x167')](),'XMD-AGI':_0x43c25e[_0xbf6a('0x13a')]?util[_0xbf6a('0x44')](_0xbf6a('0x168'),ipAgi,_0x43c25e[_0xbf6a('0x13a')]):'NONE','XMD-AGIAFTER':_0x43c25e['dialQueueProject2']?util[_0xbf6a('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x43c25e[_0xbf6a('0xd4')]):_0xbf6a('0x169'),'XMD-QUEUE':utils[_0xbf6a('0x16a')](_0x43c25e)?util['format'](_0xbf6a('0x16b'),_0x43c25e[_0xbf6a('0x45')],_0x43c25e[_0xbf6a('0x16c')]||'',_0x43c25e[_0xbf6a('0xca')]?'c':'',_0x43c25e[_0xbf6a('0xd1')]||0x3):_0xbf6a('0x169'),'XMD-CONTACTID':_0x2c1894[_0xbf6a('0xdf')],'XMD-CDRTYPE':_0xbf6a('0x9'),'CALLERID(all)':_0x20465b[_0xbf6a('0x27')][_0x12729e][_0xbf6a('0x167')](),'XMD-AMD':_0x43c25e[_0xbf6a('0x118')]?_0xbf6a('0x141'):_0xbf6a('0x169'),'XMD-DESTINATION':_0xbf6a('0x117')};if(_0x43c25e[_0xbf6a('0x118')]){_0x592042[_0xbf6a('0x16d')]=_0x43c25e['dialAMDInitialSilence']||0x9c4;_0x592042[_0xbf6a('0x16e')]=_0x43c25e[_0xbf6a('0x16f')]||0x5dc;_0x592042[_0xbf6a('0x170')]=_0x43c25e['dialAMDAfterGreetingSilence']||0x320;_0x592042[_0xbf6a('0x171')]=_0x43c25e[_0xbf6a('0x172')]||0x1388;_0x592042['XMD-AMDMINWORDLENGTH']=_0x43c25e[_0xbf6a('0x173')]||0x64;_0x592042[_0xbf6a('0x174')]=_0x43c25e[_0xbf6a('0x175')]||0x32;_0x592042[_0xbf6a('0x176')]=_0x43c25e[_0xbf6a('0x177')]||0x3;_0x592042['XMD-AMDSILENCETHRESHOLD']=_0x43c25e[_0xbf6a('0x178')]||0x100;_0x592042[_0xbf6a('0x179')]=_0x43c25e['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xbf6a('0x16a')](_0x43c25e)){_0x592042[_0xbf6a('0x17a')]=_0x2c1894[_0xbf6a('0xe0')];}else{_0x592042[_0xbf6a('0x17b')]=_0x2c1894['CampaignId'];}var _0x32f2f6=utils[_0xbf6a('0x17c')](_0x2c1894[_0xbf6a('0x17d')]);Object[_0xbf6a('0x145')](_0x592042,_0x32f2f6);var _0x1a0b47=_0x20465b[_0xbf6a('0x88')](_0x43c25e[_0xbf6a('0x8e')])?utils[_0xbf6a('0x17e')](_0x43c25e[_0xbf6a('0x8e')]['callerid'],_0x43c25e[_0xbf6a('0x17f')],_0x43c25e[_0xbf6a('0x180')]>0x0?utils[_0xbf6a('0x181')](_0x43c25e[_0xbf6a('0x182')],_0x43c25e[_0xbf6a('0x180')]):_0x43c25e[_0xbf6a('0x182')]):utils[_0xbf6a('0x17e')](_[_0xbf6a('0xfa')](_0x43c25e['TrunkBackup'])?_0x43c25e[_0xbf6a('0x8e')][_0xbf6a('0x183')]:_0x43c25e[_0xbf6a('0x8f')][_0xbf6a('0x183')],_0x43c25e['dialOriginateCallerIdName'],_0x43c25e[_0xbf6a('0x180')]>0x0?utils[_0xbf6a('0x181')](_0x43c25e[_0xbf6a('0x182')],_0x43c25e[_0xbf6a('0x180')]):_0x43c25e[_0xbf6a('0x182')]);if(_0x1a0b47){_0x592042['XMD-ORIGINATECALLERIDNAME']=_0x20465b[_0xbf6a('0x27')][_0x12729e][_0xbf6a('0x184')]=utils['extractCalleridName'](_0x1a0b47);_0x592042[_0xbf6a('0x185')]=_0x2c1894[_0xbf6a('0x165')];}_0x43c25e[_0xbf6a('0x186')]=_0x592042;return ami['Action']({'actionid':_0x12729e,'action':_0xbf6a('0x187'),'channel':_0x20465b['isTrunkReachable'](_0x43c25e[_0xbf6a('0x8e')])?util[_0xbf6a('0x44')](_0xbf6a('0x188'),_0x43c25e[_0xbf6a('0x8e')][_0xbf6a('0x45')],isNotNull(_0x43c25e[_0xbf6a('0x189')])?_0x43c25e[_0xbf6a('0x189')][_0xbf6a('0x18a')]()||'':'',_0x43c25e[_0xbf6a('0x18b')]>0x0?_0x2c1894[_0xbf6a('0x165')][_0xbf6a('0x18c')](_0x43c25e[_0xbf6a('0x18b')]):_0x2c1894[_0xbf6a('0x165')]):util[_0xbf6a('0x44')](_0xbf6a('0x188'),_[_0xbf6a('0xfa')](_0x43c25e[_0xbf6a('0x8f')])?_0x43c25e[_0xbf6a('0x8e')][_0xbf6a('0x45')]:_0x43c25e['TrunkBackup']['name'],isNotNull(_0x43c25e[_0xbf6a('0x189')])?_0x43c25e['dialPrefix'][_0xbf6a('0x18a')]()||'':'',_0x43c25e[_0xbf6a('0x18b')]>0x0?_0x2c1894[_0xbf6a('0x165')][_0xbf6a('0x18c')](_0x43c25e['dialCutDigit']):_0x2c1894[_0xbf6a('0x165')]),'callerid':_0x1a0b47,'Exten':_0xbf6a('0x117'),'Context':_0xbf6a('0x18d'),'Priority':'1','variable':_0x592042,'timeout':(_0x43c25e[_0xbf6a('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x12729e})['then'](function(_0x48bcd1){return _0x11e012(_0x48bcd1);})[_0xbf6a('0xa4')](function(_0x2f0af7){_0x43c25e[_0xbf6a('0x18f')]+=0x1;var _0x3543b5=new History(_0x20465b[_0xbf6a('0x27')][_0x12729e]);logger[_0xbf6a('0x65')](util[_0xbf6a('0x44')](_0xbf6a('0x190'),JSON['stringify'](_0x2f0af7)));_0x3543b5[_0xbf6a('0x70')]=0xe;_0x3543b5[_0xbf6a('0x71')]=_0xbf6a('0x191');_0x3543b5[_0xbf6a('0xe3')]=moment()[_0xbf6a('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3543b5[_0xbf6a('0xe4')]=_0x3543b5[_0xbf6a('0xe3')];hopperUtils[_0xbf6a('0xcb')](_0x3543b5)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x192')));_0x20465b[_0xbf6a('0xcd')](_0x3543b5)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x192')))[_0xbf6a('0x20')](function(){delete _0x20465b[_0xbf6a('0x27')][_0x12729e];return _0x554309(msgResponse('originate','Error',_0xbf6a('0x193')));});});});};Dialer[_0xbf6a('0x87')]['checkRetriveMax']=function(_0xf032d6,_0x2e8caf,_0x24ac39){var _0x2cbd98=new History(_0x2e8caf);if(_0x2cbd98[_0xbf6a('0x124')]+_0x2cbd98[_0xbf6a('0x125')]+_0x2cbd98['countnoanswerretry']+_0x2cbd98[_0xbf6a('0x127')]+_0x2cbd98[_0xbf6a('0xd5')]+_0x2cbd98[_0xbf6a('0xec')]+_0x2cbd98[_0xbf6a('0x122')]+_0x2cbd98[_0xbf6a('0x128')]>=_0x24ac39[_0xbf6a('0x132')]-0x1){return!![];}switch(_0xf032d6){case 0x3:if(_0x2cbd98['countnoanswerretry']>=_0x24ac39['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2cbd98['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0x194')],_0xbf6a('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cbd98[_0xbf6a('0xdf')],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98['CampaignId']||undefined})[_0xbf6a('0xa4')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2cbd98['countbusyretry']>=_0x24ac39['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xbf6a('0xdc')]({'active':![],'countbusyretry':_0x2cbd98[_0xbf6a('0x124')]+=0x1,'scheduledat':moment()['add'](_0x24ac39[_0xbf6a('0x195')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x2cbd98[_0xbf6a('0xdf')],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98['CampaignId']||undefined})['catch'](loggerCatch(_0xbf6a('0x196')));break;case 0x8:if(_0x2cbd98[_0xbf6a('0x125')]>=_0x24ac39['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0xbf6a('0xdc')]({'active':![],'countcongestionretry':_0x2cbd98[_0xbf6a('0x125')]+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0x197')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x2cbd98[_0xbf6a('0xdf')],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98[_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x198')));break;case 0x0:if(_0x2cbd98[_0xbf6a('0x127')]>=_0x24ac39[_0xbf6a('0x199')]-0x1){return!![];}else{hopperUtils[_0xbf6a('0xdc')]({'active':![],'countnosuchnumberretry':_0x2cbd98[_0xbf6a('0x127')]+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0x19a')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x2cbd98['ContactId'],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98[_0xbf6a('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2cbd98['countdropretry']>=_0x24ac39[_0xbf6a('0xda')]-0x1){return!![];}hopperUtils[_0xbf6a('0xdc')]({'active':![],'countdropretry':_0x2cbd98['countdropretry']+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0xd7')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x2cbd98['ContactId'],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98[_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xe2')));break;case 0xb:if(_0x2cbd98[_0xbf6a('0xec')]>=_0x24ac39[_0xbf6a('0xef')]-0x1){return!![];}hopperUtils[_0xbf6a('0xdc')]({'active':![],'countabandonedretry':_0x2cbd98['countabandonedretry']+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0xed')],'minutes')[_0xbf6a('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cbd98[_0xbf6a('0xdf')],'ListId':_0x2cbd98['ListId'],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98['CampaignId']||undefined})['catch'](loggerCatch(_0xbf6a('0xf2')));break;case 0x13:if(_0x2cbd98['countmachineretry']>=_0x24ac39[_0xbf6a('0x133')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2cbd98['countmachineretry']+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0x12c')],_0xbf6a('0xde'))[_0xbf6a('0x44')](_0xbf6a('0xc6')),'ContactId':_0x2cbd98['ContactId'],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98['VoiceQueueId']||undefined,'CampaignId':_0x2cbd98[_0xbf6a('0xe1')]||undefined})[_0xbf6a('0xa4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2cbd98['countagentrejectretry']>=_0x24ac39[_0xbf6a('0x19b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x2cbd98[_0xbf6a('0x128')]+=0x1,'scheduledat':moment()[_0xbf6a('0xdd')](_0x24ac39[_0xbf6a('0x19c')],_0xbf6a('0xde'))['format'](_0xbf6a('0xc6')),'ContactId':_0x2cbd98[_0xbf6a('0xdf')],'ListId':_0x2cbd98[_0xbf6a('0xf1')],'VoiceQueueId':_0x2cbd98[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x2cbd98['CampaignId']||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x19d')));break;default:return!![];}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x113')]=function(_0x1ce4a8,_0x1d1431,_0x45cd6a){var _0x42eb66=this;var _0x46b5fd=new History(_0x1ce4a8);var _0x501632=![];var _0x29da3;var _0x39e00c;return new Promise(function(_0x1b722a,_0xf0f1aa){if(_['isUndefined'](_0x1d1431)&&typeof _0x1d1431!==_0xbf6a('0x19e')){return _0xf0f1aa(msgResponse(_0xbf6a('0x19f'),_0xbf6a('0x97'),_0xbf6a('0x1a0')));}if(_[_0xbf6a('0x40')](_0x45cd6a)&&typeof _0x45cd6a!==_0xbf6a('0x19e')){return _0xf0f1aa(msgResponse(_0xbf6a('0x19f'),_0xbf6a('0x97'),'evt\x20is\x20undefine'));}hopperUtils[_0xbf6a('0xd8')](_0x46b5fd,_0x45cd6a[_0xbf6a('0xc7')],_0x1d1431)[_0xbf6a('0xa0')](function(_0x4810ce){if(_0x4810ce[_0xbf6a('0xf0')]==0x1)_0x501632=!![];switch(_0x45cd6a[_0xbf6a('0xc7')]){case'0':_0x1d1431['outboundNoSuchCallsDay']+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0x0;_0x46b5fd['statedesc']='NoSuchNumber';_0x46b5fd[_0xbf6a('0x127')]+=0x1;_0x46b5fd[_0xbf6a('0xd6')]+=0x1;ami[_0xbf6a('0x11f')]('custom:agentnosuchnumber',ut[_0xbf6a('0x120')](_0x1ce4a8,_0xbf6a('0x1a1')));_0x29da3=_0x1d1431['dialNoSuchNumberRetryFrequency'];_0x39e00c=_0x1d1431[_0xbf6a('0xee')];hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x1a2')));if(_0x42eb66[_0xbf6a('0x1a3')](0x0,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd['countnosuchnumberretry']>=_0x1d1431[_0xbf6a('0x199')]){_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1a4'));}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1d1431['outboundNoAnswerCallsDay']+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0x3;_0x46b5fd[_0xbf6a('0x71')]='NoAnswer';_0x46b5fd[_0xbf6a('0x126')]+=0x1;_0x46b5fd['countglobal']+=0x1;var _0x31f8b8=ut[_0xbf6a('0x1a5')](_0x1ce4a8,_0x1d1431);ami[_0xbf6a('0x11f')](_0xbf6a('0x1a6'),_0x31f8b8);_0x29da3=_0x1d1431[_0xbf6a('0x194')];_0x39e00c=_0x1d1431[_0xbf6a('0xee')];hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x1a7')));if(_0x42eb66[_0xbf6a('0x1a3')](0x3,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd[_0xbf6a('0x126')]>=_0x1d1431[_0xbf6a('0x1a8')]){_0x42eb66['createStateFinal'](_0x46b5fd,_0x1b722a,_0xf0f1aa,'reason\x203\x20ringing\x20no\x20answer');}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1d1431[_0xbf6a('0x1a9')]+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0x5;_0x46b5fd['statedesc']='Busy';_0x46b5fd[_0xbf6a('0x124')]+=0x1;_0x46b5fd['countglobal']+=0x1;ami[_0xbf6a('0x11f')](_0xbf6a('0x1aa'),ut[_0xbf6a('0x120')](_0x1ce4a8,_0xbf6a('0x1ab')));_0x29da3=_0x1d1431[_0xbf6a('0x195')];_0x39e00c=_0x1d1431[_0xbf6a('0xee')];hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x1ac')));if(_0x42eb66[_0xbf6a('0x1a3')](0x5,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd[_0xbf6a('0x124')]>=_0x1d1431[_0xbf6a('0x1ad')]){_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1ae'));}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1ae'));}}break;case'8':_0x1d1431[_0xbf6a('0x1af')]+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0x8;_0x46b5fd[_0xbf6a('0x71')]=_0xbf6a('0x1b0');_0x46b5fd['countcongestionretry']+=0x1;_0x46b5fd['countglobal']+=0x1;_0x29da3=_0x1d1431['dialCongestionRetryFrequency'];_0x39e00c=_0x1d1431[_0xbf6a('0xee')];ami[_0xbf6a('0x11f')](_0xbf6a('0x1b1'),ut[_0xbf6a('0x120')](_0x1ce4a8,_0xbf6a('0x1b2')));hopperUtils['createHistory'](_0x46b5fd)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x42eb66[_0xbf6a('0x1a3')](0x8,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd[_0xbf6a('0x125')]>=_0x1d1431[_0xbf6a('0x1b3')]){_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1b4'));}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1b4'));}}break;case'11':_0x1d1431['outboundAbandonedCallsDay']+=0x1;_0x46b5fd['state']=0xb;_0x46b5fd[_0xbf6a('0x71')]=_0xbf6a('0xe9');_0x46b5fd[_0xbf6a('0xec')]+=0x1;_0x46b5fd[_0xbf6a('0xd6')]+=0x1;_0x29da3=_0x1d1431[_0xbf6a('0xed')];_0x39e00c=_0x1d1431[_0xbf6a('0xee')];hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0xf3')));if(_0x42eb66[_0xbf6a('0x1a3')](0xb,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd[_0xbf6a('0xec')]>=_0x1d1431[_0xbf6a('0xef')]){_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1b5'));}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,'reason\x2011\x20abandoned');}}break;case'20':_0x1d1431[_0xbf6a('0x1b6')]+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0x14;_0x46b5fd[_0xbf6a('0x71')]='AgentReject';_0x46b5fd[_0xbf6a('0x128')]+=0x1;_0x46b5fd[_0xbf6a('0xd6')]+=0x1;_0x29da3=_0x1d1431[_0xbf6a('0x19c')];_0x39e00c=_0x1d1431['callAdditionalPhoneAfterMin'];ami[_0xbf6a('0x11f')](_0xbf6a('0x1b7'),ut[_0xbf6a('0x120')](_0x1ce4a8,'agentreject'));hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)['catch'](loggerCatch(_0xbf6a('0x1b8')));if(_0x42eb66[_0xbf6a('0x1a3')](0x14,_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd['countagentrejectretry']>=_0x1d1431[_0xbf6a('0x19b')]){_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1b9'));}else{_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0xbf6a('0x1b9'));}}break;default:_0x1d1431['outboundUnknownCallsDay']+=0x1;_0x46b5fd[_0xbf6a('0x70')]=0xc;_0x46b5fd[_0xbf6a('0x71')]=_0x45cd6a[_0xbf6a('0xc7')];_0x29da3=_0x1d1431[_0xbf6a('0x19c')];_0x39e00c=_0x1d1431['callAdditionalPhoneAfterMin'];hopperUtils[_0xbf6a('0xcb')](_0x46b5fd)[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x1ba')));if(_0x42eb66[_0xbf6a('0x1a3')](_0x45cd6a['reason'],_0x1ce4a8,_0x1d1431)&&!_0x501632){if(_0x46b5fd['countbusyretry']+_0x46b5fd[_0xbf6a('0x125')]+_0x46b5fd[_0xbf6a('0x126')]+_0x46b5fd[_0xbf6a('0x127')]+_0x46b5fd[_0xbf6a('0xd5')]+_0x46b5fd[_0xbf6a('0xec')]+_0x46b5fd[_0xbf6a('0x122')]+_0x46b5fd[_0xbf6a('0x128')]>=_0x1d1431[_0xbf6a('0x132')]){_0x42eb66[_0xbf6a('0x129')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0x45cd6a[_0xbf6a('0xc7')]);}else{_0x42eb66[_0xbf6a('0x12b')](_0x46b5fd,_0x1b722a,_0xf0f1aa,_0x45cd6a[_0xbf6a('0xc7')]);}}}})[_0xbf6a('0xa0')](function(){if(_0x501632){hopperUtils[_0xbf6a('0x1bb')](_0x46b5fd,_0x29da3,_0x39e00c)[_0xbf6a('0xa0')](function(){return _0x1b722a(0x1);});}});});};Dialer[_0xbf6a('0x87')]['stateGlobal']=function(_0x18f1b0,_0x5c0353,_0x2b0220,_0x1b1211){var _0x4f6ad3=new Final(_0x18f1b0);_0x4f6ad3[_0xbf6a('0x70')]=0xf;_0x4f6ad3[_0xbf6a('0x71')]='Global';this[_0xbf6a('0x12b')](_0x4f6ad3,_0x5c0353,_0x2b0220,_0x1b1211);};Dialer[_0xbf6a('0x87')]['createStateFinal']=function(_0xf189d3,_0x4c361e,_0xc184ff,_0x5ca987){hopperUtils['moveContactManagedDialer'](_0xf189d3)[_0xbf6a('0xa0')](function(){return _0x4c361e(msgResponse('[callProgressDetecting]',_0xbf6a('0x112'),_0x5ca987));})[_0xbf6a('0xa4')](function(){return _0xc184ff(msgResponse(_0xbf6a('0x1bc'),_0xbf6a('0x97'),_0xbf6a('0x1bd')));});};Dialer['prototype'][_0xbf6a('0xb')]=function(_0x531930){var _0x2819cc=_0x531930[_0xbf6a('0x1be')]/0x64;var _0x1433ac=_0x531930[_0xbf6a('0x1bf')]/(_0x531930[_0xbf6a('0x1bf')]+_0x531930[_0xbf6a('0x11a')]);var _0x26d4de=Math[_0xbf6a('0x1c0')](_0x531930[_0xbf6a('0x1c1')]*(_0x531930[_0xbf6a('0x1c2')]/0x64));var _0x35054c=Math[_0xbf6a('0x1c0')](_0x531930[_0xbf6a('0x1c1')]*(_0x531930[_0xbf6a('0x1c3')]/0x64));var _0x5901a6=_0x531930[_0xbf6a('0x1c4')]+_0x531930[_0xbf6a('0x1c5')];var _0x204660=Math[_0xbf6a('0x1c6')](_0x531930[_0xbf6a('0x5a')]*_0x531930[_0xbf6a('0x5e')]*_0x531930[_0xbf6a('0x1c7')]*_0x531930[_0xbf6a('0x1c8')]);if(_[_0xbf6a('0x40')](_0x531930[_0xbf6a('0x2c')])){if(!_[_0xbf6a('0x40')](_0x531930[_0xbf6a('0x2b')])){_0x531930['startPredictive']=undefined;loggerPredictive['error'](_0xbf6a('0x1c9'),_0xbf6a('0x1ca'));}if(!_[_0xbf6a('0x40')](_0x531930[_0xbf6a('0x64')])){loggerPredictive['error'](_0xbf6a('0x1c9'),_0xbf6a('0x1cb'));clearInterval(_0x531930[_0xbf6a('0x64')]);_0x531930[_0xbf6a('0x64')]=undefined;}_0x531930['startProgressive']=moment()['format'](_0xbf6a('0xc6'));loggerPredictive['info'](_0x531930['name'],'collection\x20data\x20in\x20progressive\x20at',_0x531930[_0xbf6a('0x2c')]);this[_0xbf6a('0xb6')](_0x531930,0x1);}else if(ifInterval(_0x531930[_0xbf6a('0x1cc')],_0x531930[_0xbf6a('0x2c')])){this[_0xbf6a('0xb6')](_0x531930,0x1);loggerPredictiveCalls[_0xbf6a('0x47')]('[startMethodPredictive][StartProgressive][Loop]',_0x531930[_0xbf6a('0x2c')],_0x531930[_0xbf6a('0x45')]);_0x531930[_0xbf6a('0x5a')]=0x0;_0x531930['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x2819cc<_0x1433ac&&_0x531930[_0xbf6a('0x1cd')]===_0xbf6a('0x1ce')){clearPredictiveAttributes(_0x531930);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1433ac,'startProgressive',_0x531930['name']);}else if(_0x204660<_0x531930[_0xbf6a('0xd2')]&&_0x531930['dialPredictiveOptimization']===_0xbf6a('0x1ce')){clearPredictiveAttributes(_0x531930);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xbf6a('0x1cf'),_0x204660,'Drop\x20in\x20this\x20interval',_0x531930[_0xbf6a('0xd2')],_0xbf6a('0x2c'),_0x531930[_0xbf6a('0x45')]);}else if(!ifInterval(_0x531930[_0xbf6a('0x1cc')],_0x531930[_0xbf6a('0x2c')])&&_[_0xbf6a('0x40')](_0x531930['startPredictive'])&&!_[_0xbf6a('0x40')](_0x531930[_0xbf6a('0x2c')])){_0x531930[_0xbf6a('0x2b')]=moment()[_0xbf6a('0x44')](_0xbf6a('0xc6'));loggerPredictive[_0xbf6a('0x47')](_0x531930[_0xbf6a('0x45')],'started\x20in\x20predictive\x20at',_0x531930[_0xbf6a('0x2b')]);hopperUtils[_0xbf6a('0x1d0')](_0x531930[_0xbf6a('0x1cc')])[_0xbf6a('0xa0')](this[_0xbf6a('0x1d1')](_0x531930))[_0xbf6a('0xa0')](mergeDataErlangB(_0x531930))[_0xbf6a('0xa0')](this[_0xbf6a('0x1d2')](_0x531930))['catch'](loggerCatchPredictive(_0xbf6a('0x1d3'),_0x531930));}else if(!ifInterval(_0x531930[_0xbf6a('0x1cc')],_0x531930['startPredictive'])){_0x531930[_0xbf6a('0xd2')]=0x0;_0x531930['startPredictive']=moment()['format'](_0xbf6a('0xc6'));loggerPredictive['info'](_0x531930[_0xbf6a('0x45')],_0xbf6a('0x1d4'),_0x531930['startPredictive']);clearInterval(_0x531930['handlePredictive']);_0x531930[_0xbf6a('0x64')]=undefined;hopperUtils[_0xbf6a('0x1d0')](_0x531930[_0xbf6a('0x1cc')])[_0xbf6a('0xa0')](this[_0xbf6a('0x1d1')](_0x531930))[_0xbf6a('0xa0')](mergeDataErlangB(_0x531930))['then'](this[_0xbf6a('0x1d2')](_0x531930))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x531930));}else if(_0x531930[_0xbf6a('0x1c1')]&&_0x5901a6<_0x531930[_0xbf6a('0x1c1')]-_0x35054c){clearPredictiveAttributes(_0x531930);loggerPredictive['info'](_0x531930[_0xbf6a('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5901a6,')\x20are\x20less\x20than\x20threshold\x20(',_0x531930[_0xbf6a('0x1c1')],'-',_0x35054c,'=',_0x531930[_0xbf6a('0x1c1')]-_0x35054c,')');}else if(_0x531930[_0xbf6a('0x1c1')]&&_0x5901a6>_0x531930[_0xbf6a('0x1c1')]+_0x26d4de){clearPredictiveAttributes(_0x531930);loggerPredictive['info'](_0x531930[_0xbf6a('0x45')],_0xbf6a('0x1d5'),_0x5901a6,_0xbf6a('0x1d6'),_0x531930[_0xbf6a('0x1c1')],'+',_0x26d4de,'=',_0x531930['predictiveIntervalAvailable']+_0x26d4de,')');}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x1d1')]=function(_0x3e6616){var _0x4e9ab3=this;return function(_0x4ab334){return new Promise(function(_0x33af0e,_0x174dc0){_['merge'](_0x3e6616,_0x4ab334[0x0]);if(checkGetDataPredictive(_0x4ab334[0x0])){var _0x3d86a8=_0x3e6616[_0xbf6a('0x1c1')]=_0x3e6616[_0xbf6a('0x1c5')]+_0x3e6616[_0xbf6a('0x1c4')];var _0x209743=_0x3e6616['dialPredictiveInterval']*0x3c;var _0x445ee3=_0x4ab334[0x0]['predictiveIntervalAvgTalktime']+_0x4ab334[0x0][_0xbf6a('0x55')];var _0x4ac2d6=(_0x4ab334[0x0]['predictiveIntervalAnsweredCalls']+_0x4ab334[0x0][_0xbf6a('0x4d')]+_0x4ab334[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ab334[0x0]['predictiveIntervalTotalCalls'];_0x3e6616[_0xbf6a('0x1c7')]=_0x4ac2d6>0x0?_0x4ac2d6:0x1;switch(_0x3e6616[_0xbf6a('0x1cd')]){case _0xbf6a('0x1ce'):var _0x1a66e1=_0x3e6616['dialPredictiveOptimizationPercentage']/0x64;return _0x4e9ab3['abandonmentRate'](_0x3d86a8,_0x209743,_0x445ee3,_0x4ac2d6,_0x1a66e1)[_0xbf6a('0xa0')](function(_0x4ecd5f){return _0x33af0e(_0x4ecd5f);});case _0xbf6a('0x1d7'):var _0x220e49=_0x3e6616[_0xbf6a('0x1be')]/0x64;return _0x4e9ab3[_0xbf6a('0x1d8')](_0x3d86a8,_0x209743,_0x445ee3,_0x4ac2d6,_0x220e49)['then'](function(_0x70fb01){return _0x33af0e(_0x70fb01);});default:return _0x174dc0(msgResponse(_0xbf6a('0x1d9'),_0xbf6a('0x97'),'Unknown\x20Predictive'));}}else{return _0x174dc0(msgResponse('[getDataPredictive]',_0xbf6a('0x97'),'check\x20failure'));}});};};Dialer[_0xbf6a('0x87')][_0xbf6a('0x1da')]=function(_0x104a7b){var _0x6d0a1f=this;return function(_0xc8be67){return new Promise(function(_0x5aba43,_0x135c55){_[_0xbf6a('0x61')](_0x104a7b,_0xc8be67[0x0]);if(checkGetDataPredictive(_0xc8be67[0x0])){loggerPredictive['info'](JSON[_0xbf6a('0x75')](_0xc8be67[0x0]));if(_0x104a7b[_0xbf6a('0x1cd')]===_0xbf6a('0x1ce')){return _0x6d0a1f[_0xbf6a('0x157')](_0x104a7b['id'])[_0xbf6a('0xa0')](function(_0x1c8079){var _0x43f09b=_0x104a7b[_0xbf6a('0x1db')]-_0x1c8079[0x0][_0xbf6a('0x1dc')];var _0x132880=_0x104a7b['dialPredictiveInterval']*0x3c;var _0x5af45d=_0xc8be67[0x0][_0xbf6a('0x53')]+_0xc8be67[0x0][_0xbf6a('0x55')];var _0x57d9f4=(_0xc8be67[0x0]['predictiveIntervalAnsweredCalls']+_0xc8be67[0x0][_0xbf6a('0x4d')]+_0xc8be67[0x0][_0xbf6a('0x4f')])/_0xc8be67[0x0]['predictiveIntervalTotalCalls'];var _0xf662f2=_0x104a7b[_0xbf6a('0x1be')]/0x64;_0x104a7b[_0xbf6a('0x1dd')]=_0x1c8079[0x0][_0xbf6a('0x1dc')]||0x0;_0x104a7b[_0xbf6a('0x1c7')]=_0x57d9f4>0x0?_0x57d9f4:0x1;return _0x6d0a1f[_0xbf6a('0x1de')](_0x43f09b,_0x132880,_0x5af45d,_0x57d9f4,_0xf662f2);})[_0xbf6a('0xa0')](function(_0x92e447){return _0x5aba43(_0x92e447);})[_0xbf6a('0xa4')](function(_0x1c3760){return _0x135c55(msgResponse(_0xbf6a('0x1df'),_0xbf6a('0x97'),JSON[_0xbf6a('0x75')](_0x1c3760)));});}if(_0x104a7b[_0xbf6a('0x1cd')]===_0xbf6a('0x1d7')){return _0x6d0a1f[_0xbf6a('0x157')](_0x104a7b['id'])['then'](function(_0x317831){var _0x34163d=_0x104a7b[_0xbf6a('0x1db')]-_0x317831[0x0][_0xbf6a('0x1dc')];var _0x5edcda=_0x104a7b[_0xbf6a('0x1cc')]*0x3c;var _0x3ce74=_0xc8be67[0x0][_0xbf6a('0x53')]+_0xc8be67[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a4e9a=(_0xc8be67[0x0]['predictiveIntervalAnsweredCalls']+_0xc8be67[0x0][_0xbf6a('0x4d')]+_0xc8be67[0x0][_0xbf6a('0x4f')])/_0xc8be67[0x0][_0xbf6a('0x4a')];var _0x16e040=_0x104a7b[_0xbf6a('0x1be')]/0x64;_0x104a7b[_0xbf6a('0x1dd')]=_0x317831[0x0]['outboundQueuePauses']||0x0;_0x104a7b[_0xbf6a('0x1c7')]=_0x5a4e9a>0x0?_0x5a4e9a:0x1;return _0x6d0a1f[_0xbf6a('0x1d8')](_0x34163d,_0x5edcda,_0x3ce74,_0x5a4e9a,_0x16e040);})[_0xbf6a('0xa0')](function(_0x24f4b9){return _0x5aba43(_0x24f4b9);})[_0xbf6a('0xa4')](function(_0x12da9a){return _0x135c55(msgResponse('[CatchErlangB]','Failure',JSON[_0xbf6a('0x75')](_0x12da9a)));});}}else{return _0x135c55(msgResponse('[getDataPredictive]','Failure',_0xbf6a('0x1e0')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x496e2e){var _0x9aae55=this;return function(){var _0x339289=0x0;var _0x287a2b=Math[_0xbf6a('0x1c6')](_0x496e2e[_0xbf6a('0x5c')]*0x3e8);if(_0x287a2b>0x0){_0x287a2b=_0x287a2b<0x64?0x64:_0x287a2b;loggerPredictive[_0xbf6a('0x47')](_0x496e2e[_0xbf6a('0x45')],_0xbf6a('0x1e1'),_0x287a2b,_0xbf6a('0x1e2'));_0x496e2e['handlePredictive']=setInterval(function(){_0x9aae55[_0xbf6a('0x64')](_0x496e2e);loggerPredictiveCalls['info'](_0xbf6a('0x1e3'),_0x339289+=0x1);},_0x287a2b);}else{loggerPredictive[_0xbf6a('0x47')](_0x496e2e['name'],_0xbf6a('0x1e4'));}};};Dialer[_0xbf6a('0x87')][_0xbf6a('0x1e5')]=function(_0x93b128,_0x5cbe99){var _0x291c17=this;return function(_0x3d2aa9){if(_[_0xbf6a('0x95')](_0x3d2aa9)){if(_['isNil'](_0x5cbe99[_0xbf6a('0x15d')])||!_0x5cbe99['recallme']){if(_0x93b128[_0xbf6a('0xb5')]==='booked'){_0x93b128[_0xbf6a('0x73')]=_[_0xbf6a('0x40')](_0x93b128['queueStatusComplete'])?!![]:_0x93b128[_0xbf6a('0x73')];var _0xf9fa62=uuid['v4']();_0x291c17[_0xbf6a('0x27')][_0xf9fa62]=new Action(_0x93b128,_0x5cbe99,_0xf9fa62);loggerBooked['info']('[booked][checkContactBlack]',_0xf9fa62,_0xbf6a('0x1e6'),JSON[_0xbf6a('0x75')](_0x93b128[_0xbf6a('0x73')]),_0xbf6a('0x1e7'),_0x93b128[_0xbf6a('0x45')]);if(_0x93b128['queueStatusComplete']){_0x93b128[_0xbf6a('0x73')]=![];_0x291c17[_0xbf6a('0x2e')][_0x291c17[_0xbf6a('0x27')][_0xf9fa62]['queue']]=[];ami[_0xbf6a('0x9c')]({'actionid':_0xf9fa62,'action':_0xbf6a('0x1e8'),'queue':_0x93b128['name']})[_0xbf6a('0xa4')](function(){_0x291c17[_0xbf6a('0xcf')](_0x93b128);hopperUtils[_0xbf6a('0xdc')]({'active':![],'ContactId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62][_0xbf6a('0xdf')],'ListId':_0x291c17['actions'][_0xf9fa62][_0xbf6a('0xf1')],'VoiceQueueId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62][_0xbf6a('0xe0')]||undefined,'CampaignId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62][_0xbf6a('0xe1')]||undefined})['catch'](loggerCatch(_0xbf6a('0x1e9')));delete _0x291c17[_0xbf6a('0x27')][_0xf9fa62];});}else{loggerBooked[_0xbf6a('0x47')]('[booked][checkContactBlack][else]',JSON[_0xbf6a('0x75')](_0x93b128[_0xbf6a('0x73')]),'Queue:\x20',_0x93b128[_0xbf6a('0x45')]);_0x291c17[_0xbf6a('0xcf')](_0x93b128);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62]['ContactId'],'ListId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62]['ListId'],'VoiceQueueId':_0x291c17[_0xbf6a('0x27')][_0xf9fa62][_0xbf6a('0xe0')]||undefined,'CampaignId':_0x291c17['actions'][_0xf9fa62][_0xbf6a('0xe1')]||undefined})['catch'](loggerCatch(_0xbf6a('0x1e9')));delete _0x291c17[_0xbf6a('0x27')][_0xf9fa62];}}else{return _0x291c17[_0xbf6a('0x163')](_0x93b128,_0x5cbe99);}}else{if(utils[_0xbf6a('0x62')](undefined,_0x5cbe99[_0xbf6a('0x1ea')])<_0x93b128[_0xbf6a('0x1eb')]*0x3c){if(_0x5cbe99[_0xbf6a('0x14b')]&&!_0x5cbe99[_0xbf6a('0x14b')][_0xbf6a('0x1ec')]){_0x291c17[_0xbf6a('0x21')][_0xbf6a('0x109')](_0x5cbe99['id'])[_0xbf6a('0x20')](function(){_0x291c17[_0xbf6a('0xcf')](_0x93b128);});}else{hopperUtils[_0xbf6a('0x1ed')]({'active':![]},_0x5cbe99['id'],0x1)[_0xbf6a('0x20')](function(){_0x291c17[_0xbf6a('0xcf')](_0x93b128);});}}else{_0x93b128[_0xbf6a('0x1ee')]+=0x1;_0x291c17['updateOriginated'](_0x93b128);if(_0x93b128[_0xbf6a('0x1ef')]){hopperUtils[_0xbf6a('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5cbe99[_0xbf6a('0xdf')],'ListId':_0x5cbe99[_0xbf6a('0xf1')],'VoiceQueueId':_0x5cbe99[_0xbf6a('0xe0')]||undefined,'CampaignId':_0x5cbe99['CampaignId']||undefined})[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x1f0')));hopperUtils[_0xbf6a('0xcb')](createObjHistory(_0x93b128,_0x5cbe99,utils[_0xbf6a('0x6b')][_0xbf6a('0x1f1')],0x17,_0xbf6a('0x1f2')))['catch'](loggerCatch(_0xbf6a('0x1f3')));}else{_0x291c17[_0xbf6a('0x15c')](createObjHistory(_0x93b128,_0x5cbe99,utils[_0xbf6a('0x6b')]['RECALL_TIMEOUT'],0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xbf6a('0x1f4'));}}}}else{_0x93b128['outboundBlacklistCallsDay']+=0x1;_0x291c17[_0xbf6a('0x15c')](createObjHistory(_0x93b128,_0x5cbe99,utils[_0xbf6a('0x6b')][_0xbf6a('0x1f5')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xbf6a('0x1f6'));throw _0xbf6a('0x1f7');}};};Dialer['prototype'][_0xbf6a('0x162')]=function(_0x358947){var _0x1de4d4=this;var _0x3e4524=_0x358947['limitCalls']-_0x358947[_0xbf6a('0x80')];emitCampaignSummary(_0x358947);if(_0x3e4524>0x0&&_0x358947[_0xbf6a('0x68')]==0x0){if(_0x3e4524>this[_0xbf6a('0x25')]){_0x3e4524=this[_0xbf6a('0x25')];}_0x358947[_0xbf6a('0x68')]=0x1;hopperUtils[_0xbf6a('0x1f8')](_0x358947,_0x3e4524)[_0xbf6a('0xa0')](function(_0x4fd3da){_0x358947[_0xbf6a('0x68')]=0x0;if(_0x4fd3da){if(!utils[_0xbf6a('0x1f9')](_0x4fd3da)){_0x358947['message']=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xbf6a('0x47')](_0xbf6a('0x1fa')+_0x358947[_0xbf6a('0x45')]);}else{_0x358947[_0xbf6a('0x80')]+=_0x4fd3da[_0xbf6a('0x104')];_0x358947['message']=utils['CAMPAIGN_STATUS'][_0xbf6a('0x1fb')];for(var _0x459234=0x0;_0x459234<_0x4fd3da['length'];_0x459234+=0x1){_0x358947['ivrTotalCallsDays']+=0x1;if(_[_0xbf6a('0xfa')](_0x4fd3da[_0x459234])||_[_0xbf6a('0xfa')](_0x4fd3da[_0x459234]['Contact'])||_[_0xbf6a('0xfa')](_0x4fd3da[_0x459234][_0xbf6a('0x165')])){_0x1de4d4[_0xbf6a('0x1fc')](_0xbf6a('0x1fd'),_0x358947,_0x4fd3da[_0x459234]);}else{hopperUtils[_0xbf6a('0x1fe')](_[_0xbf6a('0xff')](_0x4fd3da[_0x459234],[_0xbf6a('0xe1'),_0xbf6a('0x165')]))[_0xbf6a('0xa0')](_0x1de4d4[_0xbf6a('0x1e5')](_0x358947,_0x4fd3da[_0x459234]))['catch'](_0x1de4d4[_0xbf6a('0x15a')](_0xbf6a('0x1ff'),_0x358947));}}}}})[_0xbf6a('0xa4')](loggerGetContactDialer('[getContactCampaign2]',_0x358947,_0x3e4524));}};Dialer[_0xbf6a('0x87')][_0xbf6a('0xb6')]=function(_0x17151d,_0x49f66e){var _0x286929=this;var _0x11687f=[];if(_0x49f66e<0x1||_0x17151d[_0xbf6a('0xb5')]===_0xbf6a('0xa')){_0x49f66e=0x1;}var _0x54069b=Math[_0xbf6a('0x1c6')](_0x17151d[_0xbf6a('0x1c4')]*_0x49f66e)-_0x17151d['originated'];if(_0x17151d[_0xbf6a('0x200')]>0x0){var _0x39bbcc=_0x17151d['dialLimitQueue']-_0x17151d[_0xbf6a('0x80')]-_0x17151d[_0xbf6a('0x1c5')]-_0x17151d[_0xbf6a('0x201')];if(_0x54069b>_0x39bbcc){_0x54069b=_0x39bbcc;}}if(_0x54069b>0x0&&_0x17151d['temp']==0x0){if(_0x17151d['dialMethod']===_0xbf6a('0xa')){_0x54069b=0x1;}if(_0x54069b>this[_0xbf6a('0x25')]){_0x54069b=this['maxNumberOriginate'];}for(var _0x13aef0 in this[_0xbf6a('0xfd')]){if(typeof this[_0xbf6a('0xfd')][_0x13aef0]!=='undefined'){if(this['agents'][_0x13aef0][_0xbf6a('0x70')]===_0xbf6a('0x202')&&this[_0xbf6a('0xfd')][_0x13aef0][_0xbf6a('0x8a')]==='reachable'){_0x11687f[_0xbf6a('0x9b')](this['agents'][_0x13aef0]['id']);}}}_0x17151d[_0xbf6a('0x68')]=0x1;hopperUtils[_0xbf6a('0x203')](_0x17151d,_0x11687f,_0x54069b)[_0xbf6a('0xa0')](function(_0x57dbec){_0x17151d['temp']=0x0;if(_0x57dbec){if(!utils['checkContactEmpty'](_0x57dbec)){hopperUtils[_0xbf6a('0x204')](_0x17151d)[_0xbf6a('0xa0')](sendMessageReschedule(_0x17151d))[_0xbf6a('0xa4')](loggerCatch(_0xbf6a('0x205')));}else{_0x17151d['originated']+=_0x57dbec[_0xbf6a('0x104')];_0x17151d[_0xbf6a('0x6a')]=_0x17151d['dialMethod']==='booked'?utils[_0xbf6a('0x6b')][_0xbf6a('0x141')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x34ca10=0x0;_0x34ca10<_0x57dbec[_0xbf6a('0x104')];_0x34ca10+=0x1){if(_['isNil'](_0x57dbec[_0x34ca10])||_[_0xbf6a('0xfa')](_0x57dbec[_0x34ca10][_0xbf6a('0x17d')])||_[_0xbf6a('0xfa')](_0x57dbec[_0x34ca10][_0xbf6a('0x165')])){_0x286929[_0xbf6a('0x1fc')](_0xbf6a('0x1fd'),_0x17151d,_0x57dbec[_0x34ca10]);}else{hopperUtils['checkIsBlackList'](_[_0xbf6a('0xff')](_0x57dbec[_0x34ca10],[_0xbf6a('0xe0'),'phone']))['then'](_0x286929[_0xbf6a('0x1e5')](_0x17151d,_0x57dbec[_0x34ca10]))[_0xbf6a('0xa4')](_0x286929[_0xbf6a('0x15a')]('[actionOriginate]\x20',_0x17151d));}}}}})[_0xbf6a('0xa4')](loggerGetContactDialer(_0xbf6a('0x206'),_0x17151d,_0x54069b));}};Dialer['prototype']['handlePredictive']=function(_0x5295db){if(_0x5295db[_0xbf6a('0x200')]>0x0){var _0x3e08a3=_0x5295db[_0xbf6a('0x200')]-_0x5295db[_0xbf6a('0x80')]-_0x5295db[_0xbf6a('0x1c5')];if(_0x3e08a3>0x0&&_0x5295db['temp']==0x0){this[_0xbf6a('0x207')](_0x5295db);}else{loggerPredictiveCalls[_0xbf6a('0x47')](_0xbf6a('0x208'));}}else{this['tryOriginatePredictive'](_0x5295db);}};Dialer[_0xbf6a('0x87')][_0xbf6a('0x207')]=function(_0x1ac8d8){var _0x2c6833=this;var _0x3ea41f=[];_0x1ac8d8['originated']+=0x1;for(var _0x26513b in this['agents']){if(typeof this[_0xbf6a('0xfd')][_0x26513b]!==_0xbf6a('0xaf')){if(this[_0xbf6a('0xfd')][_0x26513b]['state']===_0xbf6a('0x202')&&this[_0xbf6a('0xfd')][_0x26513b][_0xbf6a('0x8a')]===_0xbf6a('0x8b')){_0x3ea41f[_0xbf6a('0x9b')](this['agents'][_0x26513b]['id']);}}}_0x1ac8d8[_0xbf6a('0x68')]=0x1;return this[_0xbf6a('0x203')](_0x1ac8d8['id'],_0x3ea41f,0x1,_0x1ac8d8[_0xbf6a('0x209')],_0x1ac8d8)[_0xbf6a('0xa0')](function(_0x4744eb){_0x1ac8d8[_0xbf6a('0x68')]=0x1;if(_0x4744eb){if(!utils[_0xbf6a('0x1f9')](_0x4744eb)){utils[_0xbf6a('0x67')](_0x1ac8d8,0x1,0x0);return hopperUtils['countReScheduled'](_0x1ac8d8)[_0xbf6a('0xa0')](sendMessageReschedule(_0x1ac8d8))[_0xbf6a('0xa4')](loggerCatch('[countReScheduled]\x20'));}else{_0x1ac8d8[_0xbf6a('0x6a')]=utils[_0xbf6a('0x6b')][_0xbf6a('0x1fb')];if(_[_0xbf6a('0xfa')](_0x4744eb[0x0])||_['isNil'](_0x4744eb[0x0][_0xbf6a('0x17d')])||_['isNil'](_0x4744eb[0x0]['phone'])){_0x2c6833[_0xbf6a('0x1fc')](_0xbf6a('0x1fd'),_0x1ac8d8,_0x4744eb[0x0]);}else{return hopperUtils[_0xbf6a('0x20a')](_['pick'](_0x4744eb[0x0],[_0xbf6a('0xe0'),_0xbf6a('0x165')]))[_0xbf6a('0xa0')](_0x2c6833[_0xbf6a('0x1e5')](_0x1ac8d8,_0x4744eb[0x0]))[_0xbf6a('0xa4')](_0x2c6833[_0xbf6a('0x15a')](_0xbf6a('0x20b'),_0x1ac8d8));}}}})[_0xbf6a('0xa4')](loggerGetContactDialer(_0xbf6a('0x20c'),_0x1ac8d8,0x1));};Dialer[_0xbf6a('0x87')]['abandonmentRate']=function(_0x3ecdc8,_0x34c512,_0x526d8b,_0x455084,_0x50b5a2,_0x2d042e){loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x20d'));loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x20e'),_0x3ecdc8);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x20f'),_0x34c512);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x210'),_0x526d8b);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x211'),_0x455084);loggerPredictive['info'](_0xbf6a('0x212'),_0x50b5a2);loggerPredictive['info'](_0xbf6a('0x52'));return new Promise(function(_0x1a40f2,_0x2bf30e){if(_0x3ecdc8<=0x0||isNaN(_0x3ecdc8)){return _0x2bf30e(msgResponse(_0xbf6a('0x213'),_0xbf6a('0x86'),_0xbf6a('0x214')+_0x3ecdc8));}if(_0x526d8b<=0x0||isNaN(_0x526d8b)){return _0x2bf30e(msgResponse('[abandonmentRate]',_0xbf6a('0x86'),'Ts\x20=\x20'+_0x526d8b));}if(_0x455084<=0x0||isNaN(_0x455084)){return _0x2bf30e(msgResponse('[abandonmentRate]',_0xbf6a('0x86'),_0xbf6a('0x215')+_0x455084));}if(_0x34c512<=0x0||isNaN(_0x34c512)){return _0x2bf30e(msgResponse(_0xbf6a('0x213'),'Error',_0xbf6a('0x216')+_0x34c512));}if(_0x50b5a2<=0x0||isNaN(_0x50b5a2)){return _0x2bf30e(msgResponse(_0xbf6a('0x213'),_0xbf6a('0x86'),_0xbf6a('0x217')+_0x50b5a2));}_0x2d042e=_0x2d042e||0x0;var _0x5b9256=0x1/_0x526d8b;var _0x3ad159=0x0;var _0x2709a2=0x0;var _0xd64989=0x0;var _0x6c9944=0x0;for(var _0x5ceffe=0x0;_0xd64989<_0x50b5a2;_0x5ceffe+=0x1){_0x2709a2=_0x5ceffe/_0x34c512;_0x3ad159=(_0x455084*_0x2709a2+_0x2d042e)/_0x5b9256;_0xd64989=utils[_0xbf6a('0x218')](_0x3ad159,_0x3ecdc8);_0x6c9944=_0x3ad159/_0x3ecdc8*(0x1-utils['erlangb'](_0x3ad159,_0x3ecdc8));}return _0x1a40f2({'erlangCalls':_0x5ceffe,'erlangCallToSecond':_0x34c512/_0x5ceffe,'erlangAbandonmentRate':_0xd64989,'erlangBusyFactor':_0x6c9944});});};Dialer[_0xbf6a('0x87')][_0xbf6a('0x1d8')]=function(_0x26708c,_0x157d82,_0xd5975d,_0x108f38,_0x1564dc,_0x5bc49c){loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x219'));loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x20e'),_0x26708c);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x20f'),_0x157d82);loggerPredictive[_0xbf6a('0x47')](_0xbf6a('0x210'),_0xd5975d);loggerPredictive[_0xbf6a('0x47')]('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',_0x108f38);loggerPredictive[_0xbf6a('0x47')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1564dc);loggerPredictive[_0xbf6a('0x47')]('---------------------------');return new Promise(function(_0xd13e9e,_0x28dfee){if(_0x26708c<=0x0||isNaN(_0x26708c)){return _0x28dfee(msgResponse(_0xbf6a('0x21a'),'Error','m\x20=\x20'+_0x26708c));}if(_0xd5975d<=0x0||isNaN(_0xd5975d)){return _0x28dfee(msgResponse('[busyFactor]',_0xbf6a('0x86'),_0xbf6a('0x21b')+_0xd5975d));}if(_0x108f38<=0x0||isNaN(_0x108f38)){return _0x28dfee(msgResponse('[busyFactor]',_0xbf6a('0x86'),_0xbf6a('0x215')+_0x108f38));}if(_0x157d82<=0x0||isNaN(_0x157d82)){return _0x28dfee(msgResponse(_0xbf6a('0x21a'),_0xbf6a('0x86'),_0xbf6a('0x216')+_0x157d82));}if(_0x1564dc<=0x0||isNaN(_0x1564dc)){return _0x28dfee(msgResponse(_0xbf6a('0x21a'),'Error',_0xbf6a('0x21c')+_0x1564dc));}_0x5bc49c=_0x5bc49c||0x0;var _0x637545=0x1/_0xd5975d;var _0x534b08=0x0;var _0x9d7981=0x0;var _0x55a9d9=0x0;var _0x4400ad=0x0;for(var _0x30a6fc=0x0;_0x4400ad<_0x1564dc;_0x30a6fc+=0x1){_0x9d7981=_0x30a6fc/_0x157d82;_0x534b08=(_0x108f38*_0x9d7981+_0x5bc49c)/_0x637545;_0x55a9d9=utils[_0xbf6a('0x218')](_0x534b08,_0x26708c);_0x4400ad=_0x534b08/_0x26708c*(0x1-utils[_0xbf6a('0x218')](_0x534b08,_0x26708c));}return _0xd13e9e({'erlangCalls':_0x30a6fc,'erlangCallToSecond':_0x157d82/_0x30a6fc,'erlangAbandonmentRate':_0x55a9d9,'erlangBusyFactor':_0x4400ad});});};module[_0xbf6a('0x21d')]=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 cf407de..4cba64a 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 _0xed41=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','dialCutDigit','number','substring','voiceQueue','prototype','getQueue','exports','util','moment','isNil','string','uniqueid','name','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed41,0x1d4));var _0x1ed4=function(_0x112da2,_0x3737fc){_0x112da2=_0x112da2-0x0;var _0x3ce5d1=_0xed41[_0x112da2];return _0x3ce5d1;};'use strict';var util=require(_0x1ed4('0x0'));var _=require('lodash');var moment=require(_0x1ed4('0x1'));function checkNameSurname(_0x858e2f,_0x3e9649,_0x4536fa){var _0x4f9683='';if(!_[_0x1ed4('0x2')](_0x3e9649)&&_0x1ed4('0x3')===typeof _0x3e9649){_0x4f9683+=_0x3e9649;}if(!_['isNil'](_0x4536fa)&&_0x1ed4('0x3')===typeof _0x4536fa){_0x4f9683+='\x20'+_0x4536fa;}if(_0x4f9683!==''){return _0x4f9683;}return _0x858e2f;}function Action(_0x467da5,_0x1870e7,_0x8d7344){this['voiceQueue']=_0x467da5;this[_0x1ed4('0x4')]=_0x8d7344||undefined;this[_0x1ed4('0x5')]=checkNameSurname(_0x1870e7[_0x1ed4('0x6')]['phone'],_0x1870e7[_0x1ed4('0x6')][_0x1ed4('0x7')],_0x1870e7['Contact'][_0x1ed4('0x8')]);this['number']=_0x1870e7['phone'];this[_0x1ed4('0x9')]=_0x467da5[_0x1ed4('0x5')];this['active']=_0x1870e7[_0x1ed4('0xa')]||![];this['type']=_0x467da5[_0x1ed4('0xb')];this[_0x1ed4('0xc')]=_0x467da5[_0x1ed4('0xc')]||0x3;this[_0x1ed4('0xd')]=_0x1870e7[_0x1ed4('0xd')];this['countbusyretry']=_0x1870e7[_0x1ed4('0xe')];this[_0x1ed4('0xf')]=_0x1870e7[_0x1ed4('0xf')];this[_0x1ed4('0x10')]=_0x1870e7[_0x1ed4('0x10')];this[_0x1ed4('0x11')]=_0x1870e7[_0x1ed4('0x11')];this[_0x1ed4('0x12')]=_0x1870e7[_0x1ed4('0x12')];this[_0x1ed4('0x13')]=_0x1870e7[_0x1ed4('0x13')];this[_0x1ed4('0x14')]=_0x1870e7[_0x1ed4('0x14')];this['countagentrejectretry']=_0x1870e7[_0x1ed4('0x15')];this[_0x1ed4('0x16')]=_0x1870e7[_0x1ed4('0x16')];this[_0x1ed4('0x17')]=_0x1870e7[_0x1ed4('0x17')];this[_0x1ed4('0x18')]=_0x1870e7[_0x1ed4('0x18')];this[_0x1ed4('0x19')]=_0x1870e7['VoiceQueueId'];this[_0x1ed4('0x1a')]=_0x1870e7[_0x1ed4('0x1a')];this[_0x1ed4('0x1b')]=_0x1870e7['id'];this[_0x1ed4('0x1c')]=_0x1870e7['Contact']['firstName']||'';this['starttime']=moment()[_0x1ed4('0x1d')](_0x1ed4('0x1e'));this[_0x1ed4('0x1f')]=_0x1870e7[_0x1ed4('0x1f')];this['callbackuniqueid']=_0x1870e7[_0x1ed4('0x20')];this[_0x1ed4('0x21')]=_0x1870e7[_0x1ed4('0x21')];this[_0x1ed4('0x22')]=_0x1870e7[_0x1ed4('0x22')];this[_0x1ed4('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x1ed4('0x24')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0x1ed4('0x25')]>0x0?this[_0x1ed4('0x26')][_0x1ed4('0x27')](this[_0x1ed4('0x28')]['dialCutDigit']):this['number']);};Action[_0x1ed4('0x29')][_0x1ed4('0x2a')]=function(){return this[_0x1ed4('0x9')];};module[_0x1ed4('0x2b')]=Action; \ No newline at end of file +var _0xdcf7=['exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','substring','dialCutDigit'];(function(_0x12bea0,_0x533503){var _0xfba461=function(_0x4a997c){while(--_0x4a997c){_0x12bea0['push'](_0x12bea0['shift']());}};_0xfba461(++_0x533503);}(_0xdcf7,0x161));var _0x7dcf=function(_0x28d28e,_0x135141){_0x28d28e=_0x28d28e-0x0;var _0xa83fab=_0xdcf7[_0x28d28e];return _0xa83fab;};'use strict';var util=require(_0x7dcf('0x0'));var _=require('lodash');var moment=require(_0x7dcf('0x1'));function checkNameSurname(_0x312fc9,_0x52b690,_0x3a9b48){var _0x35c0d8='';if(!_[_0x7dcf('0x2')](_0x52b690)&&_0x7dcf('0x3')===typeof _0x52b690){_0x35c0d8+=_0x52b690;}if(!_[_0x7dcf('0x2')](_0x3a9b48)&&'string'===typeof _0x3a9b48){_0x35c0d8+='\x20'+_0x3a9b48;}if(_0x35c0d8!==''){return _0x35c0d8;}return _0x312fc9;}function Action(_0x441366,_0x2fa882,_0x438c46){this[_0x7dcf('0x4')]=_0x441366;this[_0x7dcf('0x5')]=_0x438c46||undefined;this[_0x7dcf('0x6')]=checkNameSurname(_0x2fa882[_0x7dcf('0x7')][_0x7dcf('0x8')],_0x2fa882[_0x7dcf('0x7')][_0x7dcf('0x9')],_0x2fa882['Contact']['lastName']);this[_0x7dcf('0xa')]=_0x2fa882[_0x7dcf('0x8')];this[_0x7dcf('0xb')]=_0x441366[_0x7dcf('0x6')];this[_0x7dcf('0xc')]=_0x2fa882['active']||![];this['type']=_0x441366[_0x7dcf('0xd')];this[_0x7dcf('0xe')]=_0x441366['dialQueueTimeout']||0x3;this[_0x7dcf('0xf')]=_0x2fa882[_0x7dcf('0xf')];this[_0x7dcf('0x10')]=_0x2fa882[_0x7dcf('0x10')];this[_0x7dcf('0x11')]=_0x2fa882[_0x7dcf('0x11')];this[_0x7dcf('0x12')]=_0x2fa882[_0x7dcf('0x12')];this[_0x7dcf('0x13')]=_0x2fa882[_0x7dcf('0x13')];this[_0x7dcf('0x14')]=_0x2fa882[_0x7dcf('0x14')];this['countabandonedretry']=_0x2fa882[_0x7dcf('0x15')];this[_0x7dcf('0x16')]=_0x2fa882['countmachineretry'];this[_0x7dcf('0x17')]=_0x2fa882[_0x7dcf('0x17')];this['ContactId']=_0x2fa882[_0x7dcf('0x18')];this['ListId']=_0x2fa882[_0x7dcf('0x19')];this[_0x7dcf('0x1a')]=_0x2fa882[_0x7dcf('0x1a')];this[_0x7dcf('0x1b')]=_0x2fa882['VoiceQueueId'];this[_0x7dcf('0x1c')]=_0x2fa882[_0x7dcf('0x1c')];this[_0x7dcf('0x1d')]=_0x2fa882['id'];this[_0x7dcf('0x1e')]=_0x2fa882[_0x7dcf('0x7')][_0x7dcf('0x9')]||'';this[_0x7dcf('0x1f')]=moment()[_0x7dcf('0x20')](_0x7dcf('0x21'));this[_0x7dcf('0x22')]=_0x2fa882[_0x7dcf('0x22')];this[_0x7dcf('0x23')]=_0x2fa882[_0x7dcf('0x23')];this[_0x7dcf('0x24')]=_0x2fa882['callbackat'];this[_0x7dcf('0x25')]=_0x2fa882[_0x7dcf('0x25')];this[_0x7dcf('0x26')]='';this[_0x7dcf('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0x7dcf('0x20')](_0x7dcf('0x28'),this[_0x7dcf('0x6')],this[_0x7dcf('0x4')]['dialCutDigit']>0x0?this[_0x7dcf('0xa')][_0x7dcf('0x29')](this[_0x7dcf('0x4')][_0x7dcf('0x2a')]):this[_0x7dcf('0xa')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0x7dcf('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 81864d4..097dc26 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 _0xd7b5=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','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','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x51a1e7,_0x54cc87){var _0x4980d2=function(_0x54d17e){while(--_0x54d17e){_0x51a1e7['push'](_0x51a1e7['shift']());}};_0x4980d2(++_0x54cc87);}(_0xd7b5,0x171));var _0x5d7b=function(_0x58d36f,_0x242b9f){_0x58d36f=_0x58d36f-0x0;var _0x59a1fa=_0xd7b5[_0x58d36f];return _0x59a1fa;};'use strict';var moment=require(_0x5d7b('0x0'));var utils=require('../utils');function AgentComplete(_0x25b317,_0x3e5a24){this[_0x5d7b('0x1')]=0x4;this[_0x5d7b('0x2')]=_0x5d7b('0x3');this[_0x5d7b('0x4')]=_0x25b317[_0x5d7b('0x4')];this[_0x5d7b('0x5')]=_0x25b317['type'];this[_0x5d7b('0x6')]=_0x25b317['type']===_0x5d7b('0x7')?_0x5d7b('0x8'):_0x25b317['type'];this[_0x5d7b('0x9')]=_0x25b317[_0x5d7b('0x9')];this[_0x5d7b('0xa')]=_0x25b317[_0x5d7b('0xa')];this[_0x5d7b('0xb')]=_0x25b317[_0x5d7b('0xb')];this[_0x5d7b('0xc')]=_0x25b317[_0x5d7b('0x9')]+_0x25b317[_0x5d7b('0xa')]+_0x25b317[_0x5d7b('0xb')]+_0x25b317[_0x5d7b('0xd')]+_0x25b317[_0x5d7b('0xe')]+_0x25b317[_0x5d7b('0xf')]+_0x25b317[_0x5d7b('0x10')]+_0x25b317[_0x5d7b('0x11')];this['countnosuchnumberretry']=_0x25b317['countnosuchnumberretry'];this[_0x5d7b('0xe')]=_0x25b317[_0x5d7b('0xe')];this['countabandonedretry']=_0x25b317['countabandonedretry'];this['countmachineretry']=_0x25b317[_0x5d7b('0x10')];this[_0x5d7b('0x11')]=_0x25b317[_0x5d7b('0x11')];this[_0x5d7b('0x12')]=_0x3e5a24[_0x5d7b('0x12')];this[_0x5d7b('0x13')]=_0x25b317[_0x5d7b('0x14')];this[_0x5d7b('0x15')]=_0x25b317[_0x5d7b('0x16')];this[_0x5d7b('0x17')]=_0x25b317[_0x5d7b('0x17')];this[_0x5d7b('0x18')]=_0x25b317[_0x5d7b('0x18')];this[_0x5d7b('0x19')]=_0x25b317[_0x5d7b('0x19')];this[_0x5d7b('0x1a')]=moment()[_0x5d7b('0x1b')](_0x5d7b('0x1c'));this[_0x5d7b('0x1d')]=utils[_0x5d7b('0x1e')](_0x25b317[_0x5d7b('0x18')],_0x25b317[_0x5d7b('0x17')]);this[_0x5d7b('0x1f')]=utils[_0x5d7b('0x1e')](_0x25b317[_0x5d7b('0x19')],_0x25b317['responsetime']);this[_0x5d7b('0x20')]=utils['getSeconds'](this[_0x5d7b('0x1a')],_0x25b317[_0x5d7b('0x19')]);this[_0x5d7b('0x8')]=_0x3e5a24[_0x5d7b('0x8')];this[_0x5d7b('0x21')]=_0x3e5a24[_0x5d7b('0x21')];this[_0x5d7b('0x22')]=_0x3e5a24['reason'];this[_0x5d7b('0x23')]=_0x25b317[_0x5d7b('0x23')];this[_0x5d7b('0x24')]=_0x25b317[_0x5d7b('0x24')];this[_0x5d7b('0x25')]=_0x25b317['callbackat'];this['recallme']=_0x25b317[_0x5d7b('0x26')];this[_0x5d7b('0x27')]=_0x25b317['ContactId'];this[_0x5d7b('0x28')]=_0x25b317['ListId'];this['UserId']=_0x25b317[_0x5d7b('0x29')];this[_0x5d7b('0x2a')]=_0x25b317[_0x5d7b('0x2a')];this['CampaignId']=_0x25b317[_0x5d7b('0x2b')];this[_0x5d7b('0x2c')]=_0x25b317[_0x5d7b('0x2c')]||'';this[_0x5d7b('0x2d')]=_0x25b317[_0x5d7b('0x2d')]||'';this[_0x5d7b('0x2e')]=_0x25b317[_0x5d7b('0x2e')];}module[_0x5d7b('0x2f')]=AgentComplete; \ No newline at end of file +var _0xd8cd=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','answertime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd8cd,0x160));var _0xdd8c=function(_0x5c7312,_0x572262){_0x5c7312=_0x5c7312-0x0;var _0x84b472=_0xd8cd[_0x5c7312];return _0x84b472;};'use strict';var moment=require(_0xdd8c('0x0'));var utils=require('../utils');function AgentComplete(_0x2f7939,_0x5a6c7a){this[_0xdd8c('0x1')]=0x4;this[_0xdd8c('0x2')]=_0xdd8c('0x3');this[_0xdd8c('0x4')]=_0x2f7939[_0xdd8c('0x4')];this[_0xdd8c('0x5')]=_0x2f7939[_0xdd8c('0x5')];this[_0xdd8c('0x6')]=_0x2f7939[_0xdd8c('0x5')]===_0xdd8c('0x7')?_0xdd8c('0x8'):_0x2f7939[_0xdd8c('0x5')];this[_0xdd8c('0x9')]=_0x2f7939[_0xdd8c('0x9')];this[_0xdd8c('0xa')]=_0x2f7939['countcongestionretry'];this[_0xdd8c('0xb')]=_0x2f7939[_0xdd8c('0xb')];this[_0xdd8c('0xc')]=_0x2f7939[_0xdd8c('0x9')]+_0x2f7939[_0xdd8c('0xa')]+_0x2f7939[_0xdd8c('0xb')]+_0x2f7939[_0xdd8c('0xd')]+_0x2f7939['countdropretry']+_0x2f7939['countabandonedretry']+_0x2f7939[_0xdd8c('0xe')]+_0x2f7939['countagentrejectretry'];this[_0xdd8c('0xd')]=_0x2f7939[_0xdd8c('0xd')];this[_0xdd8c('0xf')]=_0x2f7939[_0xdd8c('0xf')];this['countabandonedretry']=_0x2f7939[_0xdd8c('0x10')];this[_0xdd8c('0xe')]=_0x2f7939[_0xdd8c('0xe')];this[_0xdd8c('0x11')]=_0x2f7939[_0xdd8c('0x11')];this['uniqueid']=_0x5a6c7a[_0xdd8c('0x12')];this[_0xdd8c('0x13')]=_0x2f7939[_0xdd8c('0x14')];this[_0xdd8c('0x15')]=_0x2f7939[_0xdd8c('0x16')];this[_0xdd8c('0x17')]=_0x2f7939[_0xdd8c('0x17')];this[_0xdd8c('0x18')]=_0x2f7939['responsetime'];this['answertime']=_0x2f7939['answertime'];this[_0xdd8c('0x19')]=moment()[_0xdd8c('0x1a')](_0xdd8c('0x1b'));this[_0xdd8c('0x1c')]=utils[_0xdd8c('0x1d')](_0x2f7939['responsetime'],_0x2f7939[_0xdd8c('0x17')]);this[_0xdd8c('0x1e')]=utils[_0xdd8c('0x1d')](_0x2f7939[_0xdd8c('0x1f')],_0x2f7939[_0xdd8c('0x18')]);this['talktime']=utils[_0xdd8c('0x1d')](this[_0xdd8c('0x19')],_0x2f7939[_0xdd8c('0x1f')]);this['queue']=_0x5a6c7a[_0xdd8c('0x8')];this[_0xdd8c('0x20')]=_0x5a6c7a[_0xdd8c('0x20')];this[_0xdd8c('0x21')]=_0x5a6c7a[_0xdd8c('0x21')];this['callback']=_0x2f7939[_0xdd8c('0x22')];this[_0xdd8c('0x23')]=_0x2f7939[_0xdd8c('0x23')];this[_0xdd8c('0x24')]=_0x2f7939[_0xdd8c('0x24')];this['recallme']=_0x2f7939['recallme'];this[_0xdd8c('0x25')]=_0x2f7939[_0xdd8c('0x25')];this[_0xdd8c('0x26')]=_0x2f7939[_0xdd8c('0x26')];this[_0xdd8c('0x27')]=_0x2f7939[_0xdd8c('0x27')];this[_0xdd8c('0x28')]=_0x2f7939[_0xdd8c('0x28')];this[_0xdd8c('0x29')]=_0x2f7939[_0xdd8c('0x29')];this[_0xdd8c('0x2a')]=_0x2f7939[_0xdd8c('0x2a')]||'';this[_0xdd8c('0x2b')]=_0x2f7939[_0xdd8c('0x2b')]||'';this['agiafterat']=_0x2f7939['agiafterat'];}module[_0xdd8c('0x2c')]=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 ba43cd8..6b70916 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 _0xbde5=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x236eee,_0x32421f){var _0x1dd280=function(_0x2250c6){while(--_0x2250c6){_0x236eee['push'](_0x236eee['shift']());}};_0x1dd280(++_0x32421f);}(_0xbde5,0x83));var _0x5bde=function(_0xc9601b,_0x56398b){_0xc9601b=_0xc9601b-0x0;var _0x5e8d8e=_0xbde5[_0xc9601b];return _0x5e8d8e;};'use strict';function Final(_0x52b128){this['uniqueid']=_0x52b128[_0x5bde('0x0')];this[_0x5bde('0x1')]=_0x52b128['scheduledat'];this[_0x5bde('0x2')]=_0x52b128[_0x5bde('0x2')];this[_0x5bde('0x3')]=_0x52b128['type']===_0x5bde('0x4')?_0x5bde('0x5'):_0x52b128[_0x5bde('0x2')];this['countbusyretry']=_0x52b128[_0x5bde('0x6')];this[_0x5bde('0x7')]=_0x52b128['countcongestionretry'];this[_0x5bde('0x8')]=_0x52b128[_0x5bde('0x8')];this['countglobal']=_0x52b128[_0x5bde('0x6')]+_0x52b128['countcongestionretry']+_0x52b128[_0x5bde('0x8')]+_0x52b128[_0x5bde('0x9')]+_0x52b128[_0x5bde('0xa')]+_0x52b128[_0x5bde('0xb')]+_0x52b128['countmachineretry']+_0x52b128['countagentrejectretry'];this['countnosuchnumberretry']=_0x52b128[_0x5bde('0x9')];this[_0x5bde('0xa')]=_0x52b128[_0x5bde('0xa')];this['countabandonedretry']=_0x52b128[_0x5bde('0xb')];this['countmachineretry']=_0x52b128[_0x5bde('0xc')];this[_0x5bde('0xd')]=_0x52b128[_0x5bde('0xd')];this['queue']=_0x52b128[_0x5bde('0x5')];this[_0x5bde('0xe')]=_0x52b128[_0x5bde('0xe')];this[_0x5bde('0xf')]=_0x52b128[_0x5bde('0xf')];this['starttime']=_0x52b128[_0x5bde('0x10')];this[_0x5bde('0x11')]=_0x52b128[_0x5bde('0x11')];this['endtime']=_0x52b128[_0x5bde('0x11')];this['ringtime']=_0x52b128['ringtime']||0x0;this[_0x5bde('0x12')]=_0x52b128[_0x5bde('0x12')]||0x0;this[_0x5bde('0x13')]=_0x52b128[_0x5bde('0x13')]||0x0;this[_0x5bde('0x14')]=_0x52b128[_0x5bde('0x14')];this[_0x5bde('0x15')]=_0x52b128[_0x5bde('0x15')];this[_0x5bde('0x16')]=_0x52b128[_0x5bde('0x16')];this[_0x5bde('0x17')]=_0x52b128['recallme'];this[_0x5bde('0x18')]=_0x52b128[_0x5bde('0x18')];this[_0x5bde('0x19')]=_0x52b128[_0x5bde('0x19')];this[_0x5bde('0x1a')]=_0x52b128[_0x5bde('0x1a')];this[_0x5bde('0x1b')]=_0x52b128['VoiceQueueId'];this[_0x5bde('0x1c')]=_0x52b128[_0x5bde('0x1c')];this[_0x5bde('0x1d')]=_0x52b128['originatecalleridnum']||'';this['originatecalleridname']=_0x52b128[_0x5bde('0x1e')]||'';this[_0x5bde('0x1f')]=_0x52b128['state'];this[_0x5bde('0x20')]=_0x52b128['statedesc'];}module[_0x5bde('0x21')]=Final; \ No newline at end of file +var _0x4d47=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x4d47,0x1f0));var _0x74d4=function(_0x1aec78,_0x30ddc1){_0x1aec78=_0x1aec78-0x0;var _0xd768d2=_0x4d47[_0x1aec78];return _0xd768d2;};'use strict';function Final(_0x54af59){this[_0x74d4('0x0')]=_0x54af59[_0x74d4('0x0')];this[_0x74d4('0x1')]=_0x54af59[_0x74d4('0x1')];this[_0x74d4('0x2')]=_0x54af59[_0x74d4('0x2')];this[_0x74d4('0x3')]=_0x54af59['type']===_0x74d4('0x4')?_0x74d4('0x5'):_0x54af59[_0x74d4('0x2')];this[_0x74d4('0x6')]=_0x54af59[_0x74d4('0x6')];this[_0x74d4('0x7')]=_0x54af59['countcongestionretry'];this[_0x74d4('0x8')]=_0x54af59[_0x74d4('0x8')];this[_0x74d4('0x9')]=_0x54af59[_0x74d4('0x6')]+_0x54af59[_0x74d4('0x7')]+_0x54af59['countnoanswerretry']+_0x54af59[_0x74d4('0xa')]+_0x54af59[_0x74d4('0xb')]+_0x54af59[_0x74d4('0xc')]+_0x54af59[_0x74d4('0xd')]+_0x54af59[_0x74d4('0xe')];this[_0x74d4('0xa')]=_0x54af59[_0x74d4('0xa')];this['countdropretry']=_0x54af59['countdropretry'];this[_0x74d4('0xc')]=_0x54af59[_0x74d4('0xc')];this[_0x74d4('0xd')]=_0x54af59[_0x74d4('0xd')];this[_0x74d4('0xe')]=_0x54af59[_0x74d4('0xe')];this[_0x74d4('0x5')]=_0x54af59[_0x74d4('0x5')];this[_0x74d4('0xf')]=_0x54af59['calleridname'];this['calleridnum']=_0x54af59[_0x74d4('0x10')];this['starttime']=_0x54af59[_0x74d4('0x11')];this['responsetime']=_0x54af59[_0x74d4('0x12')];this[_0x74d4('0x13')]=_0x54af59[_0x74d4('0x12')];this[_0x74d4('0x14')]=_0x54af59['ringtime']||0x0;this[_0x74d4('0x15')]=_0x54af59[_0x74d4('0x15')]||0x0;this[_0x74d4('0x16')]=_0x54af59['talktime']||0x0;this[_0x74d4('0x17')]=_0x54af59['callback'];this[_0x74d4('0x18')]=_0x54af59[_0x74d4('0x18')];this['callbackat']=_0x54af59[_0x74d4('0x19')];this[_0x74d4('0x1a')]=_0x54af59[_0x74d4('0x1a')];this[_0x74d4('0x1b')]=_0x54af59[_0x74d4('0x1b')];this[_0x74d4('0x1c')]=_0x54af59[_0x74d4('0x1c')];this[_0x74d4('0x1d')]=_0x54af59[_0x74d4('0x1d')];this[_0x74d4('0x1e')]=_0x54af59[_0x74d4('0x1e')];this[_0x74d4('0x1f')]=_0x54af59[_0x74d4('0x1f')];this[_0x74d4('0x20')]=_0x54af59[_0x74d4('0x20')]||'';this['originatecalleridname']=_0x54af59[_0x74d4('0x21')]||'';this['state']=_0x54af59[_0x74d4('0x22')];this['statedesc']=_0x54af59[_0x74d4('0x23')];}module['exports']=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 8578de9..c1a0150 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 _0x15b0=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime'];(function(_0x12c3ff,_0xb0fc77){var _0x2e721b=function(_0x1d3e9a){while(--_0x1d3e9a){_0x12c3ff['push'](_0x12c3ff['shift']());}};_0x2e721b(++_0xb0fc77);}(_0x15b0,0x90));var _0x015b=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x15b0[_0x1af98d];return _0x3553ea;};'use strict';var moment=require(_0x015b('0x0'));var utils=require(_0x015b('0x1'));function Hangup(_0x41bcbf,_0x3c6209){this[_0x015b('0x2')]=0x4;this['statedesc']=_0x015b('0x3');this[_0x015b('0x4')]=_0x41bcbf['scheduledat'];this[_0x015b('0x5')]=_0x41bcbf[_0x015b('0x5')];this[_0x015b('0x6')]=_0x41bcbf[_0x015b('0x5')]===_0x015b('0x7')?_0x015b('0x8'):_0x41bcbf[_0x015b('0x5')];this[_0x015b('0x9')]=_0x41bcbf[_0x015b('0x9')]||![];this[_0x015b('0xa')]=_0x41bcbf[_0x015b('0xa')];this[_0x015b('0xb')]=_0x41bcbf[_0x015b('0xb')];this[_0x015b('0xc')]=_0x41bcbf[_0x015b('0xc')];this[_0x015b('0xd')]=_0x41bcbf[_0x015b('0xa')]+_0x41bcbf['countcongestionretry']+_0x41bcbf[_0x015b('0xc')]+_0x41bcbf['countnosuchnumberretry']+_0x41bcbf['countdropretry']+_0x41bcbf[_0x015b('0xe')]+_0x41bcbf['countmachineretry']+_0x41bcbf[_0x015b('0xf')];this[_0x015b('0x10')]=_0x41bcbf[_0x015b('0x10')];this[_0x015b('0x11')]=_0x41bcbf['countdropretry'];this[_0x015b('0xe')]=_0x41bcbf[_0x015b('0xe')];this[_0x015b('0x12')]=_0x41bcbf['countmachineretry'];this['countagentrejectretry']=_0x41bcbf[_0x015b('0xf')];this[_0x015b('0x13')]=_0x3c6209[_0x015b('0x13')];this[_0x015b('0x14')]=_0x41bcbf[_0x015b('0x15')];this['calleridnum']=_0x41bcbf[_0x015b('0x16')];this[_0x015b('0x17')]=_0x41bcbf['starttime'];this[_0x015b('0x18')]=_0x41bcbf[_0x015b('0x18')];this[_0x015b('0x19')]=moment()[_0x015b('0x1a')](_0x015b('0x1b'));this[_0x015b('0x1c')]=utils[_0x015b('0x1d')](_0x41bcbf[_0x015b('0x18')],_0x41bcbf[_0x015b('0x17')]);this['holdtime']=0x0;this['talktime']=utils[_0x015b('0x1d')](this[_0x015b('0x19')],_0x41bcbf[_0x015b('0x18')]);this[_0x015b('0x8')]=_0x41bcbf[_0x015b('0x8')];this['membername']=_0x015b('0x1e');this[_0x015b('0x1f')]=_0x3c6209[_0x015b('0x20')];this['callback']=_0x41bcbf[_0x015b('0x21')];this['callbackuniqueid']=_0x41bcbf[_0x015b('0x22')];this['callbackat']=_0x41bcbf[_0x015b('0x23')];this[_0x015b('0x24')]=_0x41bcbf[_0x015b('0x24')];this[_0x015b('0x25')]=_0x41bcbf[_0x015b('0x25')];this['ListId']=_0x41bcbf['ListId'];this[_0x015b('0x26')]=_0x41bcbf[_0x015b('0x26')];this['VoiceQueueId']=_0x41bcbf[_0x015b('0x27')];this[_0x015b('0x28')]=_0x41bcbf['CampaignId'];}module[_0x015b('0x29')]=Hangup; \ No newline at end of file +var _0x3daa=['VoiceQueueId','CampaignId','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId'];(function(_0x2ab407,_0x5329da){var _0x704200=function(_0x3855bf){while(--_0x3855bf){_0x2ab407['push'](_0x2ab407['shift']());}};_0x704200(++_0x5329da);}(_0x3daa,0x1c6));var _0xa3da=function(_0x5f5656,_0x1bb8b2){_0x5f5656=_0x5f5656-0x0;var _0x476647=_0x3daa[_0x5f5656];return _0x476647;};'use strict';var moment=require('moment');var utils=require(_0xa3da('0x0'));function Hangup(_0x5abc18,_0x4cd922){this['state']=0x4;this[_0xa3da('0x1')]=_0xa3da('0x2');this[_0xa3da('0x3')]=_0x5abc18['scheduledat'];this[_0xa3da('0x4')]=_0x5abc18[_0xa3da('0x4')];this[_0xa3da('0x5')]=_0x5abc18['type']===_0xa3da('0x6')?_0xa3da('0x7'):_0x5abc18['type'];this[_0xa3da('0x8')]=_0x5abc18[_0xa3da('0x8')]||![];this[_0xa3da('0x9')]=_0x5abc18['countbusyretry'];this[_0xa3da('0xa')]=_0x5abc18[_0xa3da('0xa')];this[_0xa3da('0xb')]=_0x5abc18[_0xa3da('0xb')];this[_0xa3da('0xc')]=_0x5abc18[_0xa3da('0x9')]+_0x5abc18[_0xa3da('0xa')]+_0x5abc18[_0xa3da('0xb')]+_0x5abc18['countnosuchnumberretry']+_0x5abc18[_0xa3da('0xd')]+_0x5abc18[_0xa3da('0xe')]+_0x5abc18['countmachineretry']+_0x5abc18[_0xa3da('0xf')];this[_0xa3da('0x10')]=_0x5abc18[_0xa3da('0x10')];this[_0xa3da('0xd')]=_0x5abc18[_0xa3da('0xd')];this['countabandonedretry']=_0x5abc18[_0xa3da('0xe')];this['countmachineretry']=_0x5abc18['countmachineretry'];this[_0xa3da('0xf')]=_0x5abc18[_0xa3da('0xf')];this[_0xa3da('0x11')]=_0x4cd922[_0xa3da('0x11')];this[_0xa3da('0x12')]=_0x5abc18['name'];this[_0xa3da('0x13')]=_0x5abc18[_0xa3da('0x14')];this[_0xa3da('0x15')]=_0x5abc18[_0xa3da('0x15')];this[_0xa3da('0x16')]=_0x5abc18['responsetime'];this[_0xa3da('0x17')]=moment()[_0xa3da('0x18')](_0xa3da('0x19'));this[_0xa3da('0x1a')]=utils[_0xa3da('0x1b')](_0x5abc18[_0xa3da('0x16')],_0x5abc18['starttime']);this[_0xa3da('0x1c')]=0x0;this[_0xa3da('0x1d')]=utils[_0xa3da('0x1b')](this[_0xa3da('0x17')],_0x5abc18[_0xa3da('0x16')]);this[_0xa3da('0x7')]=_0x5abc18[_0xa3da('0x7')];this['membername']='IVR';this[_0xa3da('0x1e')]=_0x4cd922[_0xa3da('0x1f')];this[_0xa3da('0x20')]=_0x5abc18['callback'];this[_0xa3da('0x21')]=_0x5abc18[_0xa3da('0x21')];this['callbackat']=_0x5abc18[_0xa3da('0x22')];this[_0xa3da('0x23')]=_0x5abc18[_0xa3da('0x23')];this['ContactId']=_0x5abc18['ContactId'];this[_0xa3da('0x24')]=_0x5abc18['ListId'];this['UserId']=_0x5abc18[_0xa3da('0x25')];this[_0xa3da('0x26')]=_0x5abc18[_0xa3da('0x26')];this[_0xa3da('0x27')]=_0x5abc18[_0xa3da('0x27')];}module[_0xa3da('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 766e606..244ab61 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 _0x84a0=['../utils','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x3f0d2d,_0x2fbb09){var _0x104d01=function(_0x54c5c0){while(--_0x54c5c0){_0x3f0d2d['push'](_0x3f0d2d['shift']());}};_0x104d01(++_0x2fbb09);}(_0x84a0,0x66));var _0x084a=function(_0x3d96c7,_0x25955e){_0x3d96c7=_0x3d96c7-0x0;var _0x44adce=_0x84a0[_0x3d96c7];return _0x44adce;};'use strict';var utils=require(_0x084a('0x0'));function History(_0x1538c2){this[_0x084a('0x1')]=_0x1538c2[_0x084a('0x1')];this['scheduledat']=_0x1538c2[_0x084a('0x2')]||undefined;this[_0x084a('0x3')]=_0x1538c2['type'];this['campaigntype']=_0x1538c2[_0x084a('0x3')]===_0x084a('0x4')?'queue':_0x1538c2[_0x084a('0x3')];this[_0x084a('0x5')]=_0x1538c2[_0x084a('0x5')];this[_0x084a('0x6')]=_0x1538c2[_0x084a('0x6')];this['countnoanswerretry']=_0x1538c2[_0x084a('0x7')];this[_0x084a('0x8')]=_0x1538c2[_0x084a('0x5')]+_0x1538c2[_0x084a('0x6')]+_0x1538c2[_0x084a('0x7')]+_0x1538c2['countnosuchnumberretry']+_0x1538c2['countdropretry']+_0x1538c2[_0x084a('0x9')]+_0x1538c2[_0x084a('0xa')]+_0x1538c2[_0x084a('0xb')];this[_0x084a('0xc')]=_0x1538c2[_0x084a('0xc')];this['countdropretry']=_0x1538c2['countdropretry'];this[_0x084a('0x9')]=_0x1538c2[_0x084a('0x9')];this[_0x084a('0xa')]=_0x1538c2[_0x084a('0xa')];this[_0x084a('0xb')]=_0x1538c2[_0x084a('0xb')];this[_0x084a('0xd')]=_0x1538c2[_0x084a('0xd')];this['calleridname']=_0x1538c2[_0x084a('0xe')];this['calleridnum']=_0x1538c2[_0x084a('0xf')];this[_0x084a('0x10')]=_0x1538c2[_0x084a('0x10')];this[_0x084a('0x11')]=_0x1538c2[_0x084a('0x11')];this['endtime']=_0x1538c2[_0x084a('0x11')];this['ringtime']=utils[_0x084a('0x12')](_0x1538c2[_0x084a('0x11')],_0x1538c2['starttime']);this[_0x084a('0x13')]=0x0;this[_0x084a('0x14')]=0x0;this[_0x084a('0x15')]=_0x1538c2[_0x084a('0x15')];this[_0x084a('0x16')]=_0x1538c2[_0x084a('0x16')];this[_0x084a('0x17')]=_0x1538c2[_0x084a('0x17')];this[_0x084a('0x18')]=_0x1538c2[_0x084a('0x18')];this[_0x084a('0x19')]=_0x1538c2[_0x084a('0x19')];this[_0x084a('0x1a')]=_0x1538c2[_0x084a('0x1a')];this[_0x084a('0x1b')]=_0x1538c2['UserId'];this[_0x084a('0x1c')]=_0x1538c2[_0x084a('0x1c')];this[_0x084a('0x1d')]=_0x1538c2[_0x084a('0x1d')];this[_0x084a('0x1e')]=_0x1538c2['originatecalleridnum']||'';this[_0x084a('0x1f')]=_0x1538c2[_0x084a('0x1f')]||'';this[_0x084a('0x20')]=_0x1538c2[_0x084a('0x20')];this[_0x084a('0x21')]=_0x1538c2[_0x084a('0x21')];}module['exports']=History; \ No newline at end of file +var _0x4c2f=['callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime'];(function(_0x30d927,_0x8d172a){var _0x4779e2=function(_0x23d3ce){while(--_0x23d3ce){_0x30d927['push'](_0x30d927['shift']());}};_0x4779e2(++_0x8d172a);}(_0x4c2f,0x8a));var _0xf4c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c2f[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('../utils');function History(_0x1e76a4){this['uniqueid']=_0x1e76a4[_0xf4c2('0x0')];this['scheduledat']=_0x1e76a4['scheduledat']||undefined;this[_0xf4c2('0x1')]=_0x1e76a4['type'];this[_0xf4c2('0x2')]=_0x1e76a4['type']===_0xf4c2('0x3')?_0xf4c2('0x4'):_0x1e76a4['type'];this['countbusyretry']=_0x1e76a4['countbusyretry'];this[_0xf4c2('0x5')]=_0x1e76a4[_0xf4c2('0x5')];this[_0xf4c2('0x6')]=_0x1e76a4['countnoanswerretry'];this[_0xf4c2('0x7')]=_0x1e76a4['countbusyretry']+_0x1e76a4['countcongestionretry']+_0x1e76a4[_0xf4c2('0x6')]+_0x1e76a4['countnosuchnumberretry']+_0x1e76a4[_0xf4c2('0x8')]+_0x1e76a4['countabandonedretry']+_0x1e76a4[_0xf4c2('0x9')]+_0x1e76a4[_0xf4c2('0xa')];this[_0xf4c2('0xb')]=_0x1e76a4['countnosuchnumberretry'];this['countdropretry']=_0x1e76a4[_0xf4c2('0x8')];this[_0xf4c2('0xc')]=_0x1e76a4['countabandonedretry'];this[_0xf4c2('0x9')]=_0x1e76a4[_0xf4c2('0x9')];this[_0xf4c2('0xa')]=_0x1e76a4[_0xf4c2('0xa')];this[_0xf4c2('0x4')]=_0x1e76a4['queue'];this[_0xf4c2('0xd')]=_0x1e76a4['name'];this[_0xf4c2('0xe')]=_0x1e76a4[_0xf4c2('0xf')];this[_0xf4c2('0x10')]=_0x1e76a4[_0xf4c2('0x10')];this['responsetime']=_0x1e76a4[_0xf4c2('0x11')];this['endtime']=_0x1e76a4[_0xf4c2('0x11')];this[_0xf4c2('0x12')]=utils[_0xf4c2('0x13')](_0x1e76a4[_0xf4c2('0x11')],_0x1e76a4[_0xf4c2('0x10')]);this[_0xf4c2('0x14')]=0x0;this[_0xf4c2('0x15')]=0x0;this['callback']=_0x1e76a4['callback'];this[_0xf4c2('0x16')]=_0x1e76a4[_0xf4c2('0x16')];this[_0xf4c2('0x17')]=_0x1e76a4[_0xf4c2('0x17')];this[_0xf4c2('0x18')]=_0x1e76a4[_0xf4c2('0x18')];this[_0xf4c2('0x19')]=_0x1e76a4[_0xf4c2('0x19')];this['ListId']=_0x1e76a4['ListId'];this[_0xf4c2('0x1a')]=_0x1e76a4[_0xf4c2('0x1a')];this['VoiceQueueId']=_0x1e76a4[_0xf4c2('0x1b')];this['CampaignId']=_0x1e76a4['CampaignId'];this[_0xf4c2('0x1c')]=_0x1e76a4[_0xf4c2('0x1c')]||'';this[_0xf4c2('0x1d')]=_0x1e76a4[_0xf4c2('0x1d')]||'';this[_0xf4c2('0x1e')]=_0x1e76a4[_0xf4c2('0x1e')];this[_0xf4c2('0x1f')]=_0x1e76a4[_0xf4c2('0x1f')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index d0e43d0..ec3be12 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 _0x7a76=['holdtime','getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime'];(function(_0x5e388f,_0xafafc8){var _0x38a510=function(_0x32ab1a){while(--_0x32ab1a){_0x5e388f['push'](_0x5e388f['shift']());}};_0x38a510(++_0xafafc8);}(_0x7a76,0x6b));var _0x67a7=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x7a76[_0x5b1c50];return _0x2d379b;};'use strict';var utils=require(_0x67a7('0x0'));function QueueCallerAbandon(_0x43292d,_0x36b336){this[_0x67a7('0x1')]=_0x43292d[_0x67a7('0x1')];this['type']=_0x43292d[_0x67a7('0x2')];this[_0x67a7('0x3')]=_0x43292d[_0x67a7('0x2')]===_0x67a7('0x4')?_0x67a7('0x5'):_0x43292d[_0x67a7('0x2')];this[_0x67a7('0x6')]=_0x43292d['countbusyretry'];this['countcongestionretry']=_0x43292d[_0x67a7('0x7')];this['countnoanswerretry']=_0x43292d[_0x67a7('0x8')];this[_0x67a7('0x9')]=_0x43292d[_0x67a7('0x6')]+_0x43292d['countcongestionretry']+_0x43292d[_0x67a7('0x8')]+_0x43292d[_0x67a7('0xa')]+_0x43292d[_0x67a7('0xb')]+_0x43292d[_0x67a7('0xc')]+_0x43292d[_0x67a7('0xd')]+_0x43292d[_0x67a7('0xe')];this['countnosuchnumberretry']=_0x43292d[_0x67a7('0xa')];this[_0x67a7('0xb')]=_0x43292d['countdropretry'];this[_0x67a7('0xc')]=_0x43292d['countabandonedretry'];this['countmachineretry']=_0x43292d[_0x67a7('0xd')];this[_0x67a7('0xe')]=_0x43292d[_0x67a7('0xe')];this['uniqueid']=_0x36b336['uniqueid'];this[_0x67a7('0xf')]=_0x43292d[_0x67a7('0x10')];this[_0x67a7('0x11')]=_0x43292d[_0x67a7('0x12')];this[_0x67a7('0x13')]=_0x43292d[_0x67a7('0x13')];this[_0x67a7('0x14')]=_0x43292d[_0x67a7('0x14')];this['droptime']=_0x43292d[_0x67a7('0x15')];this[_0x67a7('0x16')]=_0x43292d[_0x67a7('0x16')];this[_0x67a7('0x17')]=this[_0x67a7('0x15')];this[_0x67a7('0x18')]=utils['getSeconds'](_0x43292d['responsetime'],_0x43292d[_0x67a7('0x13')]);this[_0x67a7('0x19')]=utils[_0x67a7('0x1a')](this[_0x67a7('0x15')],_0x43292d['responsetime']);this[_0x67a7('0x1b')]=0x0;this['queue']=_0x36b336[_0x67a7('0x5')];this['membername']=_0x36b336[_0x67a7('0x1c')];this[_0x67a7('0x1d')]=_0x36b336[_0x67a7('0x1d')];this[_0x67a7('0x1e')]=_0x43292d[_0x67a7('0x1e')];this[_0x67a7('0x1f')]=_0x43292d[_0x67a7('0x1f')];this[_0x67a7('0x20')]=_0x43292d[_0x67a7('0x20')];this['recallme']=_0x43292d[_0x67a7('0x21')];this[_0x67a7('0x22')]=_0x43292d[_0x67a7('0x22')];this[_0x67a7('0x23')]=_0x43292d['ListId'];this[_0x67a7('0x24')]=_0x43292d['UserId'];this[_0x67a7('0x25')]=_0x43292d[_0x67a7('0x25')];this[_0x67a7('0x26')]=_0x43292d['CampaignId'];this['originatecalleridnum']=_0x43292d[_0x67a7('0x27')]||'';this['originatecalleridname']=_0x43292d[_0x67a7('0x28')]||'';this[_0x67a7('0x29')]=_0x43292d[_0x67a7('0x29')];this['state']=_0x43292d[_0x67a7('0x2a')];this['statedesc']=_0x43292d['statedesc'];}module[_0x67a7('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x1841=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','dropreason','droptime','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type'];(function(_0x23b2d2,_0x3126bf){var _0x2a8ca3=function(_0x607913){while(--_0x607913){_0x23b2d2['push'](_0x23b2d2['shift']());}};_0x2a8ca3(++_0x3126bf);}(_0x1841,0x180));var _0x1184=function(_0x1e0b78,_0xfc0156){_0x1e0b78=_0x1e0b78-0x0;var _0x2ba2b5=_0x1841[_0x1e0b78];return _0x2ba2b5;};'use strict';var utils=require(_0x1184('0x0'));function QueueCallerAbandon(_0x1a5d5a,_0x18c477){this[_0x1184('0x1')]=_0x1a5d5a[_0x1184('0x1')];this[_0x1184('0x2')]=_0x1a5d5a[_0x1184('0x2')];this[_0x1184('0x3')]=_0x1a5d5a[_0x1184('0x2')]===_0x1184('0x4')?_0x1184('0x5'):_0x1a5d5a[_0x1184('0x2')];this[_0x1184('0x6')]=_0x1a5d5a[_0x1184('0x6')];this[_0x1184('0x7')]=_0x1a5d5a[_0x1184('0x7')];this['countnoanswerretry']=_0x1a5d5a[_0x1184('0x8')];this[_0x1184('0x9')]=_0x1a5d5a[_0x1184('0x6')]+_0x1a5d5a[_0x1184('0x7')]+_0x1a5d5a[_0x1184('0x8')]+_0x1a5d5a[_0x1184('0xa')]+_0x1a5d5a[_0x1184('0xb')]+_0x1a5d5a['countabandonedretry']+_0x1a5d5a['countmachineretry']+_0x1a5d5a[_0x1184('0xc')];this[_0x1184('0xa')]=_0x1a5d5a['countnosuchnumberretry'];this[_0x1184('0xb')]=_0x1a5d5a[_0x1184('0xb')];this[_0x1184('0xd')]=_0x1a5d5a['countabandonedretry'];this['countmachineretry']=_0x1a5d5a[_0x1184('0xe')];this[_0x1184('0xc')]=_0x1a5d5a['countagentrejectretry'];this[_0x1184('0xf')]=_0x18c477[_0x1184('0xf')];this[_0x1184('0x10')]=_0x1a5d5a[_0x1184('0x11')];this[_0x1184('0x12')]=_0x1a5d5a['number'];this[_0x1184('0x13')]=_0x1a5d5a[_0x1184('0x13')];this[_0x1184('0x14')]=_0x1a5d5a['responsetime'];this['droptime']=_0x1a5d5a['droptime'];this[_0x1184('0x15')]=_0x1a5d5a[_0x1184('0x15')];this['endtime']=this[_0x1184('0x16')];this[_0x1184('0x17')]=utils[_0x1184('0x18')](_0x1a5d5a[_0x1184('0x14')],_0x1a5d5a[_0x1184('0x13')]);this[_0x1184('0x19')]=utils[_0x1184('0x18')](this[_0x1184('0x16')],_0x1a5d5a['responsetime']);this[_0x1184('0x1a')]=0x0;this[_0x1184('0x5')]=_0x18c477[_0x1184('0x5')];this[_0x1184('0x1b')]=_0x18c477['connectedlinename'];this[_0x1184('0x1c')]=_0x18c477['reason'];this[_0x1184('0x1d')]=_0x1a5d5a[_0x1184('0x1d')];this['callbackuniqueid']=_0x1a5d5a[_0x1184('0x1e')];this[_0x1184('0x1f')]=_0x1a5d5a['callbackat'];this['recallme']=_0x1a5d5a['recallme'];this[_0x1184('0x20')]=_0x1a5d5a['ContactId'];this[_0x1184('0x21')]=_0x1a5d5a[_0x1184('0x21')];this[_0x1184('0x22')]=_0x1a5d5a['UserId'];this[_0x1184('0x23')]=_0x1a5d5a[_0x1184('0x23')];this[_0x1184('0x24')]=_0x1a5d5a[_0x1184('0x24')];this[_0x1184('0x25')]=_0x1a5d5a[_0x1184('0x25')]||'';this[_0x1184('0x26')]=_0x1a5d5a['originatecalleridname']||'';this['agiafterat']=_0x1a5d5a[_0x1184('0x27')];this[_0x1184('0x28')]=_0x1a5d5a[_0x1184('0x28')];this[_0x1184('0x29')]=_0x1a5d5a[_0x1184('0x29')];}module[_0x1184('0x2a')]=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 421aa50..f00b8c6 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 _0xf2e3=['../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack'];(function(_0x2927e1,_0x1e98ff){var _0x38cc3a=function(_0x2158fc){while(--_0x2158fc){_0x2927e1['push'](_0x2927e1['shift']());}};_0x38cc3a(++_0x1e98ff);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xf2e3[_0x45b034];return _0x509cb0;};'use strict';var util=require(_0x3f2e('0x0'));var logger=require('../../../../config/logger')(_0x3f2e('0x1'));var cmHopper=require(_0x3f2e('0x2'));var cmHopperAdditionalPhone=require(_0x3f2e('0x3'));var cmHopperBlack=require(_0x3f2e('0x4'));var cmHopperHistory=require(_0x3f2e('0x5'));function inspectError(_0x1634cd){return util[_0x3f2e('0x6')](_0x1634cd,{'showHidden':![],'depth':null});}function getContactDialer(_0xabcf5c,_0x216b26,_0x5f254a){return cmHopper[_0x3f2e('0x7')](_0xabcf5c['id'],_0x216b26,_0x5f254a,_0xabcf5c[_0x3f2e('0x8')])[_0x3f2e('0x9')](function(_0xdf499f){_0xabcf5c[_0x3f2e('0xa')]=0x0;logger[_0x3f2e('0xb')](_0x3f2e('0xc'),inspectError(_0xdf499f));});}exports[_0x3f2e('0x7')]=getContactDialer;function getContactDialerIvr(_0x2676a7,_0x29a6cc){return cmHopper[_0x3f2e('0xd')](_0x2676a7['id'],_0x29a6cc,_0x2676a7[_0x3f2e('0x8')])[_0x3f2e('0x9')](function(_0x10a392){_0x2676a7[_0x3f2e('0xa')]=0x0;logger[_0x3f2e('0xb')](_0x3f2e('0xe'),inspectError(_0x10a392));});}exports[_0x3f2e('0xd')]=getContactDialerIvr;function countReScheduled(_0x39b819){return cmHopper['countReScheduled'](_0x39b819)[_0x3f2e('0x9')](function(_0xaa6ef5){logger['error'](_0x3f2e('0xf'),inspectError(_0xaa6ef5));});}exports[_0x3f2e('0x10')]=countReScheduled;function rescheduleContact(_0x9dd50b){return cmHopper[_0x3f2e('0x11')](_0x9dd50b)[_0x3f2e('0x9')](function(_0x57cba7){logger[_0x3f2e('0xb')](_0x3f2e('0x12'),inspectError(_0x57cba7));});}exports[_0x3f2e('0x11')]=rescheduleContact;function unlockContact(_0x4f2e38,_0x43f69e,_0x218b44){return cmHopper[_0x3f2e('0x13')](_0x4f2e38,_0x43f69e,_0x218b44)[_0x3f2e('0x9')](function(_0x1dc5d0){logger[_0x3f2e('0xb')](_0x3f2e('0x14'),inspectError(_0x1dc5d0));});}exports[_0x3f2e('0x13')]=unlockContact;function moveContactManagedDialer(_0x178283){return cmHopper[_0x3f2e('0x15')](_0x178283)[_0x3f2e('0x9')](function(_0x5b9989){logger[_0x3f2e('0xb')](_0x3f2e('0x16'),inspectError(_0x5b9989));});}exports[_0x3f2e('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0xbe899c){return cmHopperBlack[_0x3f2e('0x17')](_0xbe899c)['catch'](function(_0x4ba868){logger[_0x3f2e('0xb')](_0x3f2e('0x18'),inspectError(_0x4ba868));});}exports[_0x3f2e('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ac500){return cmHopperBlack[_0x3f2e('0x19')](_0x2ac500)[_0x3f2e('0x9')](function(_0x552443){logger['error'](_0x3f2e('0x1a'),inspectError(_0x552443));});}exports[_0x3f2e('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5a66d6,_0x541292,_0x46bb1c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5a66d6,_0x541292,_0x46bb1c)[_0x3f2e('0x9')](function(_0x401ed9){logger['error']('[verifyAdditionalPhone]',inspectError(_0x401ed9));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x265bf1,_0x3d7631,_0x4c61d9){return cmHopperAdditionalPhone[_0x3f2e('0x1b')](_0x265bf1,_0x3d7631,_0x4c61d9)['catch'](function(_0x1ad875){logger['error'](_0x3f2e('0x1c'),inspectError(_0x1ad875));});}exports[_0x3f2e('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x12926e){return cmHopperHistory[_0x3f2e('0x1d')](_0x12926e)[_0x3f2e('0x9')](function(_0x4799d3){logger[_0x3f2e('0xb')](_0x3f2e('0x1e'),inspectError(_0x4799d3));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x528063){return cmHopperHistory[_0x3f2e('0x1f')](_0x528063)[_0x3f2e('0x9')](function(_0x35f421){logger[_0x3f2e('0xb')]('[createHistory]',inspectError(_0x35f421));});}exports[_0x3f2e('0x1f')]=createHistory; \ No newline at end of file +var _0x33af=['../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack'];(function(_0x4c1325,_0x331163){var _0x4637b7=function(_0x2605f4){while(--_0x2605f4){_0x4c1325['push'](_0x4c1325['shift']());}};_0x4637b7(++_0x331163);}(_0x33af,0xec));var _0xf33a=function(_0x5690a4,_0x572d64){_0x5690a4=_0x5690a4-0x0;var _0x170f91=_0x33af[_0x5690a4];return _0x170f91;};'use strict';var util=require('util');var logger=require(_0xf33a('0x0'))('dialer');var cmHopper=require(_0xf33a('0x1'));var cmHopperAdditionalPhone=require(_0xf33a('0x2'));var cmHopperBlack=require(_0xf33a('0x3'));var cmHopperHistory=require(_0xf33a('0x4'));function inspectError(_0x169f02){return util[_0xf33a('0x5')](_0x169f02,{'showHidden':![],'depth':null});}function getContactDialer(_0x4c734e,_0x433e25,_0x44cfa5){return cmHopper['getContactDialer'](_0x4c734e['id'],_0x433e25,_0x44cfa5,_0x4c734e[_0xf33a('0x6')])[_0xf33a('0x7')](function(_0x1b2b01){_0x4c734e[_0xf33a('0x8')]=0x0;logger[_0xf33a('0x9')](_0xf33a('0xa'),inspectError(_0x1b2b01));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x29bb24,_0x14eb0e){return cmHopper[_0xf33a('0xb')](_0x29bb24['id'],_0x14eb0e,_0x29bb24[_0xf33a('0x6')])[_0xf33a('0x7')](function(_0x27f30a){_0x29bb24['temp']=0x0;logger['error'](_0xf33a('0xc'),inspectError(_0x27f30a));});}exports[_0xf33a('0xb')]=getContactDialerIvr;function countReScheduled(_0x170468){return cmHopper[_0xf33a('0xd')](_0x170468)[_0xf33a('0x7')](function(_0x5959c9){logger[_0xf33a('0x9')](_0xf33a('0xe'),inspectError(_0x5959c9));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x506924){return cmHopper[_0xf33a('0xf')](_0x506924)[_0xf33a('0x7')](function(_0x17043){logger[_0xf33a('0x9')](_0xf33a('0x10'),inspectError(_0x17043));});}exports[_0xf33a('0xf')]=rescheduleContact;function unlockContact(_0x45e311,_0x1f2b1b,_0x507cb9){return cmHopper[_0xf33a('0x11')](_0x45e311,_0x1f2b1b,_0x507cb9)['catch'](function(_0x75848d){logger[_0xf33a('0x9')]('[unlockContact]',inspectError(_0x75848d));});}exports[_0xf33a('0x11')]=unlockContact;function moveContactManagedDialer(_0x25c931){return cmHopper['moveContactManagedDialer'](_0x25c931)[_0xf33a('0x7')](function(_0x23d9e2){logger[_0xf33a('0x9')](_0xf33a('0x12'),inspectError(_0x23d9e2));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x11efa0){return cmHopperBlack[_0xf33a('0x13')](_0x11efa0)[_0xf33a('0x7')](function(_0x30e383){logger[_0xf33a('0x9')](_0xf33a('0x14'),inspectError(_0x30e383));});}exports[_0xf33a('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x288275){return cmHopperBlack[_0xf33a('0x15')](_0x288275)[_0xf33a('0x7')](function(_0x520dc4){logger[_0xf33a('0x9')](_0xf33a('0x16'),inspectError(_0x520dc4));});}exports[_0xf33a('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27faa1,_0x2ab756,_0x51d3fd){return cmHopperAdditionalPhone[_0xf33a('0x17')](_0x27faa1,_0x2ab756,_0x51d3fd)['catch'](function(_0x492986){logger[_0xf33a('0x9')](_0xf33a('0x18'),inspectError(_0x492986));});}exports[_0xf33a('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x429b83,_0x4b9801,_0x57cb1d){return cmHopperAdditionalPhone[_0xf33a('0x19')](_0x429b83,_0x4b9801,_0x57cb1d)['catch'](function(_0x4af24a){logger[_0xf33a('0x9')]('[swapAdditionalPhone]',inspectError(_0x4af24a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x38eba2){return cmHopperHistory['avgHandleTime'](_0x38eba2)[_0xf33a('0x7')](function(_0x553480){logger[_0xf33a('0x9')](_0xf33a('0x1a'),inspectError(_0x553480));});}exports[_0xf33a('0x1b')]=avgHandleTime;function createHistory(_0x729fca){return cmHopperHistory[_0xf33a('0x1c')](_0x729fca)[_0xf33a('0x7')](function(_0x1d19ee){logger[_0xf33a('0x9')](_0xf33a('0x1d'),inspectError(_0x1d19ee));});}exports[_0xf33a('0x1c')]=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 e7712d8..d972072 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 _0xef04=['RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','lodash','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT'];(function(_0x57b07b,_0xd661ce){var _0x191ed4=function(_0x122d32){while(--_0x122d32){_0x57b07b['push'](_0x57b07b['shift']());}};_0x191ed4(++_0xd661ce);}(_0xef04,0xa0));var _0x4ef0=function(_0x5275a7,_0x1e1456){_0x5275a7=_0x5275a7-0x0;var _0xd694bb=_0xef04[_0x5275a7];return _0xd694bb;};'use strict';var _=require(_0x4ef0('0x0'));var moment=require('moment');var util=require('util');var logger=require('../../../../config/logger')(_0x4ef0('0x1'));var timezones=require('../../../../config/environment/shared')[_0x4ef0('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x4ef0('0x3'),'BLACKLIST':_0x4ef0('0x4'),'CONTACTS_RESCHEDULED':_0x4ef0('0x5'),'DEACTIVATED':_0x4ef0('0x6'),'DISACTIVED':_0x4ef0('0x7'),'EMPTY_INTERVAL':_0x4ef0('0x8'),'INACTIVE':_0x4ef0('0x9'),'NO_AGENTS_LOGGED':_0x4ef0('0xa'),'NO_AVAILABLE_CONTACTS':_0x4ef0('0xb'),'NULL_INTERVAL':_0x4ef0('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x4ef0('0xd'),'QUEUE_RECALL':_0x4ef0('0xe'),'RECALL_TIMEOUT':_0x4ef0('0xf'),'RUNNING':_0x4ef0('0x10'),'UNKNOWN_TIMEZONE':_0x4ef0('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x4ef0('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x458cd3){return _0x458cd3[_0x4ef0('0x13')]===_0x4ef0('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x15dba3){return _0x15dba3[_0x4ef0('0x15')]===_0x4ef0('0x16');}exports[_0x4ef0('0x17')]=isIVRCampaign;function isOutboundQueue(_0x39b0f2){return _0x39b0f2[_0x4ef0('0x15')]===_0x4ef0('0x18');}exports[_0x4ef0('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x4ef586){return _0x4ef586[_0x4ef0('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x3c76de){return _0x3c76de['active'];}exports[_0x4ef0('0x1b')]=isIVRCampaignActive;function getSeconds(_0x59bd42,_0x34db28){var _0x5c725a=moment(_0x59bd42)[_0x4ef0('0x1c')](0x0);var _0x3a7fb4=moment(_0x34db28)[_0x4ef0('0x1c')](0x0);return _0x5c725a[_0x4ef0('0x1d')](_0x3a7fb4,_0x4ef0('0x1e'));}exports[_0x4ef0('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0xff5ea2,_0x262262){var _0x30ebe1=![];var _0x106200=_0xff5ea2['dialMethod']!==_0x262262[_0x4ef0('0x13')]||_0xff5ea2[_0x4ef0('0x1a')]!==_0x262262[_0x4ef0('0x1a')]||_0xff5ea2[_0x4ef0('0x20')]!==_0x262262[_0x4ef0('0x20')];var _0x55c0d1=_0xff5ea2[_0x4ef0('0x21')]!==_0x262262[_0x4ef0('0x21')]||_0xff5ea2['loggedIn']!==_0x262262[_0x4ef0('0x22')]||_0xff5ea2[_0x4ef0('0x23')]!==_0x262262[_0x4ef0('0x23')]||_0xff5ea2[_0x4ef0('0x24')]!==_0x262262[_0x4ef0('0x24')]||_0xff5ea2[_0x4ef0('0x25')]!==_0x262262[_0x4ef0('0x25')]||_0xff5ea2[_0x4ef0('0x26')]!==_0x262262[_0x4ef0('0x26')]||_0xff5ea2[_0x4ef0('0x27')]!==_0x262262[_0x4ef0('0x27')]||_0xff5ea2[_0x4ef0('0x28')]!==_0x262262['inUse']||_0xff5ea2['originated']!==_0x262262[_0x4ef0('0x29')];if(_0xff5ea2[_0x4ef0('0x2a')]&&_0x262262['Trunk']){_0x30ebe1=_0xff5ea2[_0x4ef0('0x2a')]['name']!==_0x262262[_0x4ef0('0x2a')][_0x4ef0('0x2b')]||_0xff5ea2[_0x4ef0('0x2a')][_0x4ef0('0x2c')]!==_0x262262[_0x4ef0('0x2a')][_0x4ef0('0x2c')];}return _0x106200||_0x55c0d1||_0x30ebe1;}exports[_0x4ef0('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5aaf8e){var _0x5daeee=null;var _0x54725a=_0x5aaf8e[_0x4ef0('0x2e')];if(_['isNil'](_0x5aaf8e[_0x4ef0('0x2f')])||_[_0x4ef0('0x30')](_0x5aaf8e['Interval'])||_[_0x4ef0('0x30')](_0x5aaf8e['Interval'][_0x4ef0('0x31')])){_0x5daeee=CAMPAIGN_STATUS[_0x4ef0('0x32')];}else if(_[_0x4ef0('0x33')](_0x5aaf8e['dialGlobalInterval'])||_[_0x4ef0('0x33')](_0x5aaf8e['Interval'][_0x4ef0('0x31')])){_0x5daeee=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x54725a&&!timezones[_0x54725a]){_0x5daeee=CAMPAIGN_STATUS[_0x4ef0('0x34')];}return _0x5daeee;}function checkAnyValidTrunk(_0x92c976,_0x133548){var _0x3e2664=null;var _0xc81868=_0x4ef0('0x35');var _0x468228=[_0x4ef0('0x36'),'unmonitored'];var _0x4c1343=!![];if(_0x92c976[_0x4ef0('0x2a')]&&_0x92c976[_0x4ef0('0x2a')]['active']){_0xc81868+=_0x92c976[_0x4ef0('0x2a')][_0x4ef0('0x2b')];_0x3e2664=_0x133548[_0xc81868];_0x4c1343=_0x468228['includes'](_0x3e2664[_0x4ef0('0x37')]);}else if(_0x92c976[_0x4ef0('0x38')]&&_0x92c976['TrunkBackup']['active']){_0xc81868+=_0x92c976[_0x4ef0('0x38')][_0x4ef0('0x2b')];_0x3e2664=_0x133548[_0xc81868];_0x4c1343=_0x468228[_0x4ef0('0x39')](_0x3e2664['status']);}return _0x4c1343;}function getQueueCampaignStatusMessage(_0x49f438,_0x4411aa){var _0x50b366=CAMPAIGN_STATUS['ACTIVE'];var _0xc17657=isPreviewCampaign(_0x49f438);if(!isQueueCampaignActive(_0x49f438)){if(_0xc17657){_0x50b366=CAMPAIGN_STATUS[_0x4ef0('0x3a')];}else{if(_0x49f438[_0x4ef0('0x29')]===0x0&&_0x49f438[_0x4ef0('0x25')]===0x0&&_0x49f438[_0x4ef0('0x27')]===0x0&&(_0x49f438[_0x4ef0('0x26')]||0x0)===0x0){_0x50b366=CAMPAIGN_STATUS[_0x4ef0('0x3a')];}else{_0x50b366=CAMPAIGN_STATUS[_0x4ef0('0x3b')];}}}else if(_0x49f438[_0x4ef0('0x22')]===0x0){_0x50b366=CAMPAIGN_STATUS[_0x4ef0('0x3c')];}else if(!checkAnyValidTrunk(_0x49f438,_0x4411aa)){_0x50b366=CAMPAIGN_STATUS[_0x4ef0('0x3d')];}else if(!isPreviewCampaign(_0x49f438)){var _0xd33973=checkAnyValidQueueCampaignInterval(_0x49f438);if(_0xd33973){_0x50b366=_0xd33973;}}return _0x50b366;}exports[_0x4ef0('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1085fa){var _0x5d0e2e=CAMPAIGN_STATUS[_0x4ef0('0x3b')];if(_0x1085fa[_0x4ef0('0x29')]===0x0&&_0x1085fa['talking']===0x0&&_0x1085fa['waiting']===0x0&&(_0x1085fa[_0x4ef0('0x26')]||0x0)===0x0){_0x5d0e2e=CAMPAIGN_STATUS[_0x4ef0('0x3a')];}return _0x5d0e2e;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3fb0a0){var _0x43d368=_0x3fb0a0['match'](/"(.*?)"/);return _0x43d368?_0x43d368[0x1]:_0x3fb0a0;}exports[_0x4ef0('0x3f')]=extractCalleridName;function getCallerId(_0x1d22c9,_0x221449,_0x2bf0e5){if(!_[_0x4ef0('0x40')](_0x2bf0e5)&&typeof _0x2bf0e5===_0x4ef0('0x41')&&!_[_0x4ef0('0x33')](_0x2bf0e5)){if(!_[_0x4ef0('0x40')](_0x221449)&&typeof _0x221449===_0x4ef0('0x41')&&!_[_0x4ef0('0x33')](_0x221449)){return util[_0x4ef0('0x42')](_0x4ef0('0x43'),_0x221449,_0x2bf0e5);}return util['format']('\x22%s\x22\x20<%s>',_0x2bf0e5,_0x2bf0e5);}if(!_[_0x4ef0('0x40')](_0x1d22c9)&&typeof _0x1d22c9==='string'&&!_['isEmpty'](_0x1d22c9)){return _0x1d22c9;}return'\x22\x22\x20<>';}exports[_0x4ef0('0x44')]=getCallerId;function getCallerIdRandom(_0x3b4760,_0x2630f0){var _0x4028bf;var _0x2fee44;var _0x21ec02;if(_0x2630f0<=0x0){_0x2630f0=0x1;}_0x4028bf=new RegExp(_0x4ef0('0x45')+_0x2630f0+'}$');_0x2fee44=Math['pow'](0xa,_0x2630f0-0x1);_0x21ec02=Math[_0x4ef0('0x46')](0xa,_0x2630f0)-0x1;return util[_0x4ef0('0x42')]('%s',_[_0x4ef0('0x47')](_0x3b4760,_0x4028bf,_['random'](_0x2fee44,_0x21ec02)[_0x4ef0('0x48')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x1bc003){if(_0x1bc003[_0x4ef0('0x29')]&&_0x1bc003[_0x4ef0('0x29')]>0x0){_0x1bc003[_0x4ef0('0x29')]-=0x1;}else{logger[_0x4ef0('0x49')](_0x4ef0('0x4a'));}}exports[_0x4ef0('0x4b')]=decrementOriginate;function checkContactEmpty(_0x1a3a36){return _0x1a3a36&&_0x1a3a36[_0x4ef0('0x4c')]>0x0;}exports[_0x4ef0('0x4d')]=checkContactEmpty;function erlangb(_0x4fe3c1,_0x229ea7){if(_0x229ea7===0x0){return 0x0;}var _0x5e1bbb=0x1;for(var _0x20a7e9=0x1;_0x20a7e9<=_0x229ea7;_0x20a7e9+=0x1){_0x5e1bbb=0x1+_0x5e1bbb*_0x20a7e9/_0x4fe3c1;}return 0x1/_0x5e1bbb;}exports[_0x4ef0('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x3e8d36,_0x24c492,_0x1e5909){if(_0x24c492>_0x1e5909){for(var _0x306693=0x0;_0x306693<_0x24c492-_0x1e5909;_0x306693+=0x1){decrementOriginate(_0x3e8d36);}}}exports[_0x4ef0('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x36620e){var _0x5db992={};var _0x427cda=['id',_0x4ef0('0x50'),_0x4ef0('0x51'),_0x4ef0('0x52'),_0x4ef0('0x53')];if(_0x36620e){for(var _0x34cc5b in _0x36620e){if(typeof _0x36620e[_0x34cc5b]!==_0x4ef0('0x54')){if(!_[_0x4ef0('0x30')](_0x36620e[_0x34cc5b])&&!_0x427cda['includes'](_0x34cc5b)){_0x5db992[util[_0x4ef0('0x42')](_0x4ef0('0x55'),_0x4ef0('0x56'),_0x34cc5b[_0x4ef0('0x57')]())]=_0x36620e[_0x34cc5b];}}}}return _0x5db992;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x7e5e=['active','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7e5e,0x1f4));var _0xe7e5=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0x7e5e[_0x3b085];return _0x476a57;};'use strict';var _=require(_0xe7e5('0x0'));var moment=require(_0xe7e5('0x1'));var util=require(_0xe7e5('0x2'));var logger=require('../../../../config/logger')(_0xe7e5('0x3'));var timezones=require(_0xe7e5('0x4'))[_0xe7e5('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xe7e5('0x6'),'BLACKLIST':_0xe7e5('0x7'),'CONTACTS_RESCHEDULED':_0xe7e5('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xe7e5('0x9'),'INACTIVE':_0xe7e5('0xa'),'NO_AGENTS_LOGGED':_0xe7e5('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xe7e5('0xc'),'OVERTIME_INTERVAL':_0xe7e5('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xe7e5('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xe7e5('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xe7e5('0x10'),'UNREACHABLE_TRUNK':_0xe7e5('0x11')};exports[_0xe7e5('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x327b6f){return _0x327b6f[_0xe7e5('0x13')]===_0xe7e5('0x14');}exports[_0xe7e5('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x1b1442){return _0x1b1442[_0xe7e5('0x16')]===_0xe7e5('0x17');}exports[_0xe7e5('0x18')]=isIVRCampaign;function isOutboundQueue(_0x5496d7){return _0x5496d7['type']===_0xe7e5('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x2dc45a){return _0x2dc45a[_0xe7e5('0x1a')];}exports[_0xe7e5('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x543e75){return _0x543e75[_0xe7e5('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x2bd9f1,_0x54c7ff){var _0x2c1986=moment(_0x2bd9f1)[_0xe7e5('0x1d')](0x0);var _0x2fe63c=moment(_0x54c7ff)[_0xe7e5('0x1d')](0x0);return _0x2c1986[_0xe7e5('0x1e')](_0x2fe63c,'seconds');}exports[_0xe7e5('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x26b72b,_0x46c951){var _0x4fa558=![];var _0x3106a7=_0x26b72b[_0xe7e5('0x13')]!==_0x46c951[_0xe7e5('0x13')]||_0x26b72b[_0xe7e5('0x1a')]!==_0x46c951['dialActive']||_0x26b72b[_0xe7e5('0x20')]!==_0x46c951[_0xe7e5('0x20')];var _0x217de6=_0x26b72b[_0xe7e5('0x21')]!==_0x46c951[_0xe7e5('0x21')]||_0x26b72b[_0xe7e5('0x22')]!==_0x46c951[_0xe7e5('0x22')]||_0x26b72b[_0xe7e5('0x23')]!==_0x46c951[_0xe7e5('0x23')]||_0x26b72b['paused']!==_0x46c951[_0xe7e5('0x24')]||_0x26b72b[_0xe7e5('0x25')]!==_0x46c951[_0xe7e5('0x25')]||_0x26b72b[_0xe7e5('0x26')]!==_0x46c951[_0xe7e5('0x26')]||_0x26b72b[_0xe7e5('0x27')]!==_0x46c951['waiting']||_0x26b72b[_0xe7e5('0x28')]!==_0x46c951[_0xe7e5('0x28')]||_0x26b72b['originated']!==_0x46c951[_0xe7e5('0x29')];if(_0x26b72b[_0xe7e5('0x2a')]&&_0x46c951[_0xe7e5('0x2a')]){_0x4fa558=_0x26b72b['Trunk'][_0xe7e5('0x2b')]!==_0x46c951[_0xe7e5('0x2a')]['name']||_0x26b72b['Trunk']['active']!==_0x46c951[_0xe7e5('0x2a')][_0xe7e5('0x1c')];}return _0x3106a7||_0x217de6||_0x4fa558;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x217ef2){var _0x4e3e10=null;var _0x1de13f=_0x217ef2[_0xe7e5('0x2c')];if(_[_0xe7e5('0x2d')](_0x217ef2[_0xe7e5('0x2e')])||_[_0xe7e5('0x2d')](_0x217ef2[_0xe7e5('0x2f')])||_[_0xe7e5('0x2d')](_0x217ef2[_0xe7e5('0x2f')][_0xe7e5('0x30')])){_0x4e3e10=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xe7e5('0x31')](_0x217ef2[_0xe7e5('0x2e')])||_[_0xe7e5('0x31')](_0x217ef2[_0xe7e5('0x2f')][_0xe7e5('0x30')])){_0x4e3e10=CAMPAIGN_STATUS[_0xe7e5('0x32')];}else if(_0x1de13f&&!timezones[_0x1de13f]){_0x4e3e10=CAMPAIGN_STATUS[_0xe7e5('0x33')];}return _0x4e3e10;}function checkAnyValidTrunk(_0x474f8b,_0xf96dc6){var _0x511710=null;var _0x4656cd=_0xe7e5('0x34');var _0x5932d8=[_0xe7e5('0x35'),_0xe7e5('0x36')];var _0x44242f=!![];if(_0x474f8b[_0xe7e5('0x2a')]&&_0x474f8b['Trunk'][_0xe7e5('0x1c')]){_0x4656cd+=_0x474f8b[_0xe7e5('0x2a')]['name'];_0x511710=_0xf96dc6[_0x4656cd];_0x44242f=_0x5932d8[_0xe7e5('0x37')](_0x511710['status']);}else if(_0x474f8b[_0xe7e5('0x38')]&&_0x474f8b['TrunkBackup']['active']){_0x4656cd+=_0x474f8b[_0xe7e5('0x38')][_0xe7e5('0x2b')];_0x511710=_0xf96dc6[_0x4656cd];_0x44242f=_0x5932d8[_0xe7e5('0x37')](_0x511710[_0xe7e5('0x39')]);}return _0x44242f;}function getQueueCampaignStatusMessage(_0x2c0ae4,_0x44a4dd){var _0x326a2e=CAMPAIGN_STATUS[_0xe7e5('0x6')];var _0x3d8f67=isPreviewCampaign(_0x2c0ae4);if(!isQueueCampaignActive(_0x2c0ae4)){if(_0x3d8f67){_0x326a2e=CAMPAIGN_STATUS[_0xe7e5('0x3a')];}else{if(_0x2c0ae4[_0xe7e5('0x29')]===0x0&&_0x2c0ae4[_0xe7e5('0x25')]===0x0&&_0x2c0ae4['waiting']===0x0&&(_0x2c0ae4[_0xe7e5('0x26')]||0x0)===0x0){_0x326a2e=CAMPAIGN_STATUS[_0xe7e5('0x3a')];}else{_0x326a2e=CAMPAIGN_STATUS[_0xe7e5('0x3b')];}}}else if(_0x2c0ae4['loggedIn']===0x0){_0x326a2e=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2c0ae4,_0x44a4dd)){_0x326a2e=CAMPAIGN_STATUS[_0xe7e5('0x3c')];}else if(!isPreviewCampaign(_0x2c0ae4)){var _0x10036f=checkAnyValidQueueCampaignInterval(_0x2c0ae4);if(_0x10036f){_0x326a2e=_0x10036f;}}return _0x326a2e;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5309aa){var _0x339b98=CAMPAIGN_STATUS[_0xe7e5('0x3b')];if(_0x5309aa[_0xe7e5('0x29')]===0x0&&_0x5309aa[_0xe7e5('0x25')]===0x0&&_0x5309aa[_0xe7e5('0x27')]===0x0&&(_0x5309aa[_0xe7e5('0x26')]||0x0)===0x0){_0x339b98=CAMPAIGN_STATUS['INACTIVE'];}return _0x339b98;}exports[_0xe7e5('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1c121f){var _0x5717ee=_0x1c121f[_0xe7e5('0x3e')](/"(.*?)"/);return _0x5717ee?_0x5717ee[0x1]:_0x1c121f;}exports[_0xe7e5('0x3f')]=extractCalleridName;function getCallerId(_0x354e85,_0x4fe1b9,_0x103ad2){if(!_[_0xe7e5('0x40')](_0x103ad2)&&typeof _0x103ad2==='string'&&!_[_0xe7e5('0x31')](_0x103ad2)){if(!_['isUndefined'](_0x4fe1b9)&&typeof _0x4fe1b9===_0xe7e5('0x41')&&!_['isEmpty'](_0x4fe1b9)){return util[_0xe7e5('0x42')](_0xe7e5('0x43'),_0x4fe1b9,_0x103ad2);}return util[_0xe7e5('0x42')](_0xe7e5('0x43'),_0x103ad2,_0x103ad2);}if(!_[_0xe7e5('0x40')](_0x354e85)&&typeof _0x354e85==='string'&&!_[_0xe7e5('0x31')](_0x354e85)){return _0x354e85;}return _0xe7e5('0x44');}exports[_0xe7e5('0x45')]=getCallerId;function getCallerIdRandom(_0x35ee3f,_0x42864b){var _0x203c8e;var _0x1c2f08;var _0x1e4d1a;if(_0x42864b<=0x0){_0x42864b=0x1;}_0x203c8e=new RegExp(_0xe7e5('0x46')+_0x42864b+'}$');_0x1c2f08=Math[_0xe7e5('0x47')](0xa,_0x42864b-0x1);_0x1e4d1a=Math[_0xe7e5('0x47')](0xa,_0x42864b)-0x1;return util['format']('%s',_[_0xe7e5('0x48')](_0x35ee3f,_0x203c8e,_[_0xe7e5('0x49')](_0x1c2f08,_0x1e4d1a)[_0xe7e5('0x4a')]()));}exports[_0xe7e5('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x5593c0){if(_0x5593c0[_0xe7e5('0x29')]&&_0x5593c0[_0xe7e5('0x29')]>0x0){_0x5593c0['originated']-=0x1;}else{logger[_0xe7e5('0x4c')](_0xe7e5('0x4d'));}}exports[_0xe7e5('0x4e')]=decrementOriginate;function checkContactEmpty(_0x4c591e){return _0x4c591e&&_0x4c591e[_0xe7e5('0x4f')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x5d12cb,_0x498b2f){if(_0x498b2f===0x0){return 0x0;}var _0x3d27c1=0x1;for(var _0x5f3182=0x1;_0x5f3182<=_0x498b2f;_0x5f3182+=0x1){_0x3d27c1=0x1+_0x3d27c1*_0x5f3182/_0x5d12cb;}return 0x1/_0x3d27c1;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x4e2926,_0x56148f,_0x424c8a){if(_0x56148f>_0x424c8a){for(var _0x53f680=0x0;_0x53f680<_0x56148f-_0x424c8a;_0x53f680+=0x1){decrementOriginate(_0x4e2926);}}}exports[_0xe7e5('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1bdcd3){var _0xa72d21={};var _0x5ac594=['id','createdAt',_0xe7e5('0x51'),_0xe7e5('0x52'),_0xe7e5('0x53')];if(_0x1bdcd3){for(var _0xc3bd31 in _0x1bdcd3){if(typeof _0x1bdcd3[_0xc3bd31]!==_0xe7e5('0x54')){if(!_[_0xe7e5('0x2d')](_0x1bdcd3[_0xc3bd31])&&!_0x5ac594[_0xe7e5('0x37')](_0xc3bd31)){_0xa72d21[util[_0xe7e5('0x42')](_0xe7e5('0x55'),_0xe7e5('0x56'),_0xc3bd31['toUpperCase']())]=_0x1bdcd3[_0xc3bd31];}}}}return _0xa72d21;}exports[_0xe7e5('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 574dc5a..fcb02d0 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(_0x250671,_0x2e54c){var _0x19b2ab=function(_0x45ddb6){while(--_0x45ddb6){_0x250671['push'](_0x250671['shift']());}};_0x19b2ab(++_0x2e54c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x1241fc,_0x349344){var _0x121ab2=function(_0x4ba166){while(--_0x4ba166){_0x1241fc['push'](_0x1241fc['shift']());}};_0x121ab2(++_0x349344);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 749a0e6..aef89d6 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 _0xf770=['send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','../../../config/logger','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','variable','value','prototype','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','calleridnum','fax','.pdf','catch','error','stringify','\x20receiveFax\x20','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf770,0x107));var _0x0f77=function(_0x90b6f2,_0xa71b8a){_0x90b6f2=_0x90b6f2-0x0;var _0x26bc9c=_0xf770[_0x90b6f2];return _0x26bc9c;};'use strict';var util=require(_0x0f77('0x0'));var _=require('lodash');var BPromise=require(_0x0f77('0x1'));var uuid=require('uuid');var moment=require(_0x0f77('0x2'));var path=require(_0x0f77('0x3'));var tiff2pdf=require(_0x0f77('0x4'));var gs=require('./util/gs');var logger=require(_0x0f77('0x5'))('fax');var ami=require('../ami');var rpcDb=require(_0x0f77('0x6'));var Channel=require('./channel');var ut=require(_0x0f77('0x7'));var Action=require('./action');var faxAccount=require(_0x0f77('0x8'));var attachment=require(_0x0f77('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2f3d3b){this[_0x0f77('0xa')]={};this[_0x0f77('0xb')]=_0x2f3d3b[_0x0f77('0xb')];this[_0x0f77('0xc')]=_0x2f3d3b['trunks'];this['actions']={};ami['on'](_0x0f77('0xd'),this['syncNewchannel'][_0x0f77('0xe')](this));ami['on'](_0x0f77('0xf'),this[_0x0f77('0x10')][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x11'),this[_0x0f77('0x12')][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x13'),this[_0x0f77('0x14')][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x15'),this['syncFaxStatus'][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x16'),this[_0x0f77('0x17')][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x18'),this[_0x0f77('0x19')][_0x0f77('0xe')](this));ami['on'](_0x0f77('0x1a'),this[_0x0f77('0x1b')][_0x0f77('0xe')](this));}Fax['prototype'][_0x0f77('0x1c')]=function(_0xd76eef){if(_0xd76eef[_0x0f77('0x1d')]===_0x0f77('0x1e')){for(var _0xcd5b9f in this[_0x0f77('0xb')]){if(this[_0x0f77('0xb')][_0x0f77('0x1f')](_0xcd5b9f)){if(_0xd76eef[_0x0f77('0x20')]===this['faxAccounts'][_0xcd5b9f][_0x0f77('0x21')]){this['channels'][_0xd76eef[_0x0f77('0x22')]]={};this['channels'][_0xd76eef[_0x0f77('0x22')]][_0x0f77('0x23')]=_0xd76eef[_0x0f77('0x23')];this[_0x0f77('0xa')][_0xd76eef['uniqueid']]['id']=this[_0x0f77('0xb')][_0xcd5b9f]['id'];this['channels'][_0xd76eef[_0x0f77('0x22')]]['name']=this[_0x0f77('0xb')][_0xcd5b9f][_0x0f77('0x24')];logger['info'](_0xd76eef[_0x0f77('0x22')],_0x0f77('0x25'));}}}}if(this[_0x0f77('0x26')][_0xd76eef[_0x0f77('0x22')]]){this[_0x0f77('0xa')][_0xd76eef[_0x0f77('0x22')]]={};this[_0x0f77('0xa')][_0xd76eef[_0x0f77('0x22')]][_0x0f77('0x23')]=_0xd76eef['channel'];logger[_0x0f77('0x27')](_0xd76eef[_0x0f77('0x22')],_0x0f77('0x25'));}};Fax['prototype'][_0x0f77('0x10')]=function(_0x4a2269){if(this[_0x0f77('0xa')][_0x4a2269[_0x0f77('0x22')]]){for(var _0x5ea6a0 in _0x4a2269[_0x0f77('0x28')]){if(_0x4a2269[_0x0f77('0x28')][_0x0f77('0x1f')](_0x5ea6a0)){this[_0x0f77('0xa')][_0x4a2269[_0x0f77('0x22')]][_0x5ea6a0]=_0x4a2269[_0x0f77('0x29')];}}}};Fax[_0x0f77('0x2a')][_0x0f77('0x12')]=function(_0x1ca71a){if(this[_0x0f77('0xa')][_0x1ca71a['uniqueid']]){this[_0x0f77('0xa')][_0x1ca71a[_0x0f77('0x22')]][_0x0f77('0x2b')]=_0x1ca71a[_0x0f77('0x2b')];this[_0x0f77('0xa')][_0x1ca71a[_0x0f77('0x22')]][_0x0f77('0x2c')]=_0x1ca71a[_0x0f77('0x2c')];}};Fax['prototype'][_0x0f77('0x14')]=function(_0xfdcc3b){if(this['channels'][_0xfdcc3b[_0x0f77('0x22')]]){for(var _0x5edb39 in _0xfdcc3b['variable']){if(_0xfdcc3b['variable'][_0x0f77('0x1f')](_0x5edb39)){this[_0x0f77('0xa')][_0xfdcc3b['uniqueid']][_0x5edb39]=_0xfdcc3b['value'];}}}};Fax[_0x0f77('0x2a')][_0x0f77('0x2d')]=function(_0x3f2da0){if(this[_0x0f77('0xa')][_0x3f2da0[_0x0f77('0x22')]]){this[_0x0f77('0xa')][_0x3f2da0[_0x0f77('0x22')]][_0x0f77('0x2e')]=_0x3f2da0[_0x0f77('0x2e')];this[_0x0f77('0xa')][_0x3f2da0[_0x0f77('0x22')]][_0x0f77('0x2f')]=_0x3f2da0[_0x0f77('0x2f')];this['channels'][_0x3f2da0[_0x0f77('0x22')]][_0x0f77('0x21')]=_0x3f2da0[_0x0f77('0x21')];this[_0x0f77('0xa')][_0x3f2da0[_0x0f77('0x22')]][_0x0f77('0x30')]=_0x3f2da0['filename'];logger[_0x0f77('0x27')](_0x3f2da0[_0x0f77('0x22')],_0x0f77('0x31'));}};Fax['prototype'][_0x0f77('0x17')]=function(_0x8e14b0){var _0x1c793c=this;if(this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]]){var _0x41d019=this[_0x0f77('0xa')][_0x8e14b0['uniqueid']]['id'];this[_0x0f77('0xa')][_0x8e14b0['uniqueid']][_0x0f77('0x32')]=_0x8e14b0['remotestationid'];this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]][_0x0f77('0x33')]=_0x8e14b0[_0x0f77('0x33')];this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]][_0x0f77('0x21')]=_0x8e14b0[_0x0f77('0x21')];this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]]['resolution']=_0x8e14b0[_0x0f77('0x34')];this['channels'][_0x8e14b0['uniqueid']][_0x0f77('0x35')]=_0x8e14b0['transferrate'];this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]]['filename']=_0x8e14b0[_0x0f77('0x30')];this['channels'][_0x8e14b0[_0x0f77('0x22')]]['calleridnum']=_0x8e14b0['calleridnum'];if(this[_0x0f77('0xa')][_0x8e14b0[_0x0f77('0x22')]][_0x0f77('0x33')]>0x0){tiff2pdf(_0x8e14b0[_0x0f77('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x54cf57){logger[_0x0f77('0x27')](_0x8e14b0[_0x0f77('0x22')],_0x0f77('0x36'),_0x54cf57[_0x0f77('0x37')]);attachment['create']({'name':path[_0x0f77('0x38')](_0x8e14b0['filename'])[_0x0f77('0x24')],'basename':path['parse'](_0x8e14b0['filename'])[_0x0f77('0x24')]+'.pdf','type':_0x0f77('0x39')})[_0x0f77('0x3a')](function(_0x42cd17){faxAccount['notify'](_0x41d019,{'from':_0x8e14b0[_0x0f77('0x3b')],'mapKey':_0x0f77('0x3c'),'body':path[_0x0f77('0x38')](_0x8e14b0[_0x0f77('0x30')])[_0x0f77('0x24')]+_0x0f77('0x3d'),'AttachmentId':_0x42cd17['id']})[_0x0f77('0x3e')](function(_0x254445){logger[_0x0f77('0x3f')](_0x8e14b0[_0x0f77('0x22')],'\x20notify\x20',JSON[_0x0f77('0x40')](_0x254445));});})['catch'](function(_0x11d92e){logger['error'](_0x8e14b0[_0x0f77('0x22')],_0x0f77('0x41'),JSON['stringify'](_0x11d92e));});});}logger[_0x0f77('0x27')](_0x8e14b0[_0x0f77('0x22')],_0x0f77('0x41'));}};Fax[_0x0f77('0x2a')]['syncOriginateResponse']=function(_0x2b6aab){if(this['actions'][_0x2b6aab[_0x0f77('0x22')]]){_['merge'](this[_0x0f77('0xa')][_0x2b6aab[_0x0f77('0x22')]],_['pick'](_0x2b6aab,['response',_0x0f77('0x42')]));}};function updateStatus(_0x53a23c){if(_0x53a23c[_0x0f77('0x43')]){faxMessage[_0x0f77('0x44')](_0x53a23c['AttachmentId'],{'failMessage':_0x0f77('0x45')})[_0x0f77('0x3a')](function(_0x1b4c1d){ut[_0x0f77('0x46')](_0x0f77('0x47'),_0x1b4c1d);})[_0x0f77('0x3e')](function(_0x225c3a){ut[_0x0f77('0x46')](_0x0f77('0x48'),_0x225c3a);});}else{ut[_0x0f77('0x46')](_0x0f77('0x49'));}}Fax['prototype'][_0x0f77('0x4a')]=function(_0x887c89,_0x14ba66,_0x2caba5){var _0x47b868=this;var _0x101279={};if(_0x14ba66){_0x101279={'read':_0x14ba66};}else{_0x101279={'failMessage':_0x2caba5};}if(this[_0x0f77('0x26')][_0x887c89][_0x0f77('0x43')]){faxMessage[_0x0f77('0x44')](this[_0x0f77('0x26')][_0x887c89][_0x0f77('0x43')],_0x101279)[_0x0f77('0x3a')](function(_0x3d8c55){ut[_0x0f77('0x46')]('[Fax][Message][Updated]',_0x3d8c55);})[_0x0f77('0x3e')](function(_0x502efb){ut[_0x0f77('0x46')](_0x0f77('0x4b'),_0x502efb);})[_0x0f77('0x4c')](function(){delete _0x47b868['channels'][_0x887c89];delete _0x47b868[_0x0f77('0x26')][_0x887c89];});}else{ut[_0x0f77('0x46')](_0x0f77('0x4d'));delete this[_0x0f77('0xa')][_0x887c89];delete this[_0x0f77('0x26')][_0x887c89];}};Fax[_0x0f77('0x2a')]['syncHangup']=function(_0x21a55e){var _0x52d789=this;if(this[_0x0f77('0xa')][_0x21a55e[_0x0f77('0x22')]]){if(this[_0x0f77('0x26')][_0x21a55e[_0x0f77('0x22')]]){this[_0x0f77('0xa')][_0x21a55e[_0x0f77('0x22')]]['id']=this[_0x0f77('0x26')][_0x21a55e[_0x0f77('0x22')]]['id'];this[_0x0f77('0xa')][_0x21a55e[_0x0f77('0x22')]]['name']=this[_0x0f77('0x26')][_0x21a55e[_0x0f77('0x22')]][_0x0f77('0x24')];}logger[_0x0f77('0x27')](_0x21a55e[_0x0f77('0x22')],this[_0x0f77('0x26')][_0x21a55e[_0x0f77('0x22')]]?_0x0f77('0x4e'):_0x0f77('0x4f'),JSON[_0x0f77('0x40')](this['channels'][_0x21a55e[_0x0f77('0x22')]]));if(this[_0x0f77('0x26')][_0x21a55e['uniqueid']]){if(this['channels'][_0x21a55e['uniqueid']][_0x0f77('0x50')]>0x0&&this['channels'][_0x21a55e[_0x0f77('0x22')]][_0x0f77('0x15')]===_0x0f77('0x51')){this[_0x0f77('0x4a')](_0x21a55e['uniqueid'],!![]);}else{this['updateStatus'](_0x21a55e[_0x0f77('0x22')],![],this[_0x0f77('0xa')][_0x21a55e[_0x0f77('0x22')]][_0x0f77('0x52')]?_0x0f77('0x53')+this['channels'][_0x21a55e[_0x0f77('0x22')]][_0x0f77('0x52')]:_0x0f77('0x54'));}}}};Fax[_0x0f77('0x2a')][_0x0f77('0x55')]=function(_0x4bc9d8){var _0x25020d=this;return new BPromise(function(_0x569334,_0x193428){_0x25020d[_0x0f77('0x56')](_0x4bc9d8,_0x25020d['faxAccounts'][_0x4bc9d8[_0x0f77('0x57')]])['then'](function(_0x12c59f){ut[_0x0f77('0x46')](_0x0f77('0x58'),_0x12c59f);_0x569334(ut[_0x0f77('0x37')]('Fax\x20received'));})[_0x0f77('0x3e')](function(_0x5c2a21){ut[_0x0f77('0x46')](_0x0f77('0x59'),_0x5c2a21);updateStatus(_0x4bc9d8);_0x193428(ut[_0x0f77('0x37')](_0x0f77('0x5a')));});});};Fax[_0x0f77('0x2a')][_0x0f77('0x5b')]=function(_0x180b4c){var _0x4fc879=this;return new BPromise(function(_0x1b1c43,_0x1a52e3){var _0xa3e2b4=_0x4fc879['checkTrunk'](_0x4fc879[_0x0f77('0xb')][_0x180b4c[_0x0f77('0x57')]][_0x0f77('0x5c')],_0x180b4c);if(_0xa3e2b4[_0x0f77('0x5d')]){_0x1b1c43(ut[_0x0f77('0x37')](_0x0f77('0x5e')));}else{_0x1a52e3(ut[_0x0f77('0x37')](_0xa3e2b4[_0x0f77('0x37')]));}});};function originate(_0x4991e9,_0x4534da,_0x2cd293){return new BPromise(function(_0x5d5c7a,_0x511efd){if(_0x2cd293){var _0x42a130=util[_0x0f77('0x5f')](_0x0f77('0x60'),path[_0x0f77('0x38')](_0x4991e9['path'])[_0x0f77('0x24')],_0x4991e9[_0x0f77('0x3')]);gs['execute'](_0x42a130)[_0x0f77('0x3a')](function(){_0x4991e9[_0x0f77('0x3')]=util[_0x0f77('0x5f')](_0x0f77('0x61'),path[_0x0f77('0x38')](_0x4991e9[_0x0f77('0x3')])[_0x0f77('0x62')],path[_0x0f77('0x38')](_0x4991e9[_0x0f77('0x3')])['name']);_0x4534da[_0x0f77('0x63')]=_0x4991e9['path'];ut['logger'](_0x0f77('0x64'),'');ami[_0x0f77('0x65')](ut['variablesAction'](_0x4991e9,_0x4534da))['then'](function(_0x3fbf18){_0x5d5c7a(_0x3fbf18);})[_0x0f77('0x3e')](function(_0x4f7268){_0x511efd(_0x4f7268);});})['catch'](function(_0x317499){_0x511efd(_0x317499);});}else{ami[_0x0f77('0x65')](ut['variablesAction'](_0x4991e9,_0x4534da))[_0x0f77('0x3a')](function(_0x248ec6){_0x5d5c7a(_0x248ec6);})['catch'](function(_0x540ce3){_0x511efd(_0x540ce3);});}});}Fax[_0x0f77('0x2a')][_0x0f77('0x56')]=function(_0x4c13e7,_0x2497c0){var _0x128f3c=this;return new BPromise(function(_0x2a4b88,_0x576fa0){var _0x1a380f=uuid['v4']();var _0x1f4a56=ut[_0x0f77('0x66')](_0x4c13e7,_0x2497c0);_0x128f3c[_0x0f77('0x26')][_0x1a380f]=new Action(_0x1a380f,_0x2497c0,_0x4c13e7);var _0x5d983c=_0x128f3c[_0x0f77('0x26')][_0x1a380f];if(path[_0x0f77('0x38')](_0x4c13e7['path'])[_0x0f77('0x67')]===_0x0f77('0x3d')){originate(_0x5d983c,_0x1f4a56,!![])[_0x0f77('0x3a')](function(_0x1ef791){_0x2a4b88(_0x1ef791);})[_0x0f77('0x3e')](function(_0x392d5d){_0x576fa0(_0x392d5d);});}else{originate(_0x5d983c,_0x1f4a56,![])[_0x0f77('0x3a')](function(_0x5bedc1){_0x2a4b88(_0x5bedc1);})['catch'](function(_0x5378b6){_0x576fa0(_0x5378b6);});}});};Fax['prototype']['isTrunkReachable']=function(_0x337e3d){return!_[_0x0f77('0x68')](_0x337e3d)&&!_['isNil'](_0x337e3d[_0x0f77('0x24')])&&!_['isNil'](_0x337e3d['active'])&&_0x337e3d[_0x0f77('0x69')]&&!_[_0x0f77('0x68')](this['trunks'][util[_0x0f77('0x5f')](_0x0f77('0x6a'),_0x337e3d['name'])])&&!_[_0x0f77('0x68')](this[_0x0f77('0xc')][util[_0x0f77('0x5f')](_0x0f77('0x6a'),_0x337e3d[_0x0f77('0x24')])][_0x0f77('0x2f')])&&(this[_0x0f77('0xc')][util[_0x0f77('0x5f')]('SIP/%s',_0x337e3d[_0x0f77('0x24')])][_0x0f77('0x2f')]===_0x0f77('0x6b')||this[_0x0f77('0xc')][util['format'](_0x0f77('0x6a'),_0x337e3d[_0x0f77('0x24')])][_0x0f77('0x2f')]==='unmonitored');};Fax[_0x0f77('0x2a')]['checkTrunk']=function(_0x47da5e,_0x306585){if(!this['isTrunkReachable'](_0x47da5e)){ut[_0x0f77('0x46')](_0x0f77('0x6c'),_[_0x0f77('0x68')](_0x47da5e)?'':_0x47da5e[_0x0f77('0x24')]+_0x0f77('0x6d'));return{'isValid':![],'message':_0x0f77('0x6e')};}if(_[_0x0f77('0x68')](_0x306585['fax'])){ut[_0x0f77('0x46')](_0x0f77('0x6f'),JSON[_0x0f77('0x40')](_0x306585));return{'isValid':![],'message':_0x0f77('0x70')};}if(_[_0x0f77('0x68')](_0x306585['path'])){ut[_0x0f77('0x46')](_0x0f77('0x71'),JSON[_0x0f77('0x40')](_0x306585));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0f77('0x72')};};module[_0x0f77('0x73')]=Fax; \ No newline at end of file +var _0x5548=['path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','application/pdf','then','.pdf','catch','error','stringify','\x20receiveFax\x20','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','actions','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','message','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment'];(function(_0x5c376d,_0x1309d7){var _0x5f0980=function(_0x5dff99){while(--_0x5dff99){_0x5c376d['push'](_0x5c376d['shift']());}};_0x5f0980(++_0x1309d7);}(_0x5548,0x70));var _0x8554=function(_0x5b4a57,_0x256746){_0x5b4a57=_0x5b4a57-0x0;var _0x350ead=_0x5548[_0x5b4a57];return _0x350ead;};'use strict';var util=require(_0x8554('0x0'));var _=require('lodash');var BPromise=require(_0x8554('0x1'));var uuid=require(_0x8554('0x2'));var moment=require(_0x8554('0x3'));var path=require(_0x8554('0x4'));var tiff2pdf=require(_0x8554('0x5'));var gs=require(_0x8554('0x6'));var logger=require(_0x8554('0x7'))(_0x8554('0x8'));var ami=require(_0x8554('0x9'));var rpcDb=require(_0x8554('0xa'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x8554('0xb'));var faxAccount=require(_0x8554('0xc'));var attachment=require(_0x8554('0xd'));var faxMessage=require(_0x8554('0xe'));function Fax(_0x28fe21){this[_0x8554('0xf')]={};this[_0x8554('0x10')]=_0x28fe21[_0x8554('0x10')];this['trunks']=_0x28fe21[_0x8554('0x11')];this['actions']={};ami['on'](_0x8554('0x12'),this['syncNewchannel']['bind'](this));ami['on'](_0x8554('0x13'),this[_0x8554('0x14')][_0x8554('0x15')](this));ami['on'](_0x8554('0x16'),this['syncNewState']['bind'](this));ami['on'](_0x8554('0x17'),this[_0x8554('0x18')][_0x8554('0x15')](this));ami['on'](_0x8554('0x19'),this[_0x8554('0x1a')]['bind'](this));ami['on']('receivefax',this[_0x8554('0x1b')]['bind'](this));ami['on'](_0x8554('0x1c'),this[_0x8554('0x1d')]['bind'](this));ami['on'](_0x8554('0x1e'),this[_0x8554('0x1f')][_0x8554('0x15')](this));}Fax[_0x8554('0x20')][_0x8554('0x21')]=function(_0x473eb4){if(_0x473eb4[_0x8554('0x22')]===_0x8554('0x23')){for(var _0x176d6b in this[_0x8554('0x10')]){if(this['faxAccounts'][_0x8554('0x24')](_0x176d6b)){if(_0x473eb4[_0x8554('0x25')]===this['faxAccounts'][_0x176d6b][_0x8554('0x26')]){this['channels'][_0x473eb4[_0x8554('0x27')]]={};this[_0x8554('0xf')][_0x473eb4['uniqueid']][_0x8554('0x28')]=_0x473eb4[_0x8554('0x28')];this[_0x8554('0xf')][_0x473eb4[_0x8554('0x27')]]['id']=this[_0x8554('0x10')][_0x176d6b]['id'];this[_0x8554('0xf')][_0x473eb4[_0x8554('0x27')]][_0x8554('0x29')]=this[_0x8554('0x10')][_0x176d6b][_0x8554('0x29')];logger['info'](_0x473eb4[_0x8554('0x27')],_0x8554('0x2a'));}}}}if(this['actions'][_0x473eb4[_0x8554('0x27')]]){this['channels'][_0x473eb4['uniqueid']]={};this[_0x8554('0xf')][_0x473eb4[_0x8554('0x27')]][_0x8554('0x28')]=_0x473eb4['channel'];logger[_0x8554('0x2b')](_0x473eb4[_0x8554('0x27')],'\x20syncNewchannel\x20');}};Fax[_0x8554('0x20')]['syncVarSet']=function(_0x4c49b7){if(this[_0x8554('0xf')][_0x4c49b7[_0x8554('0x27')]]){for(var _0x9b5b02 in _0x4c49b7[_0x8554('0x2c')]){if(_0x4c49b7['variable'][_0x8554('0x24')](_0x9b5b02)){this['channels'][_0x4c49b7['uniqueid']][_0x9b5b02]=_0x4c49b7[_0x8554('0x2d')];}}}};Fax['prototype'][_0x8554('0x2e')]=function(_0x1bddf3){if(this[_0x8554('0xf')][_0x1bddf3[_0x8554('0x27')]]){this['channels'][_0x1bddf3[_0x8554('0x27')]][_0x8554('0x2f')]=_0x1bddf3[_0x8554('0x2f')];this[_0x8554('0xf')][_0x1bddf3[_0x8554('0x27')]][_0x8554('0x30')]=_0x1bddf3['channelstatedesc'];}};Fax[_0x8554('0x20')][_0x8554('0x18')]=function(_0x1ac2fa){if(this[_0x8554('0xf')][_0x1ac2fa[_0x8554('0x27')]]){for(var _0x5194af in _0x1ac2fa['variable']){if(_0x1ac2fa[_0x8554('0x2c')]['hasOwnProperty'](_0x5194af)){this[_0x8554('0xf')][_0x1ac2fa[_0x8554('0x27')]][_0x5194af]=_0x1ac2fa[_0x8554('0x2d')];}}}};Fax[_0x8554('0x20')][_0x8554('0x1a')]=function(_0x181a77){if(this[_0x8554('0xf')][_0x181a77[_0x8554('0x27')]]){this[_0x8554('0xf')][_0x181a77[_0x8554('0x27')]]['operation']=_0x181a77[_0x8554('0x31')];this[_0x8554('0xf')][_0x181a77[_0x8554('0x27')]][_0x8554('0x32')]=_0x181a77['status'];this[_0x8554('0xf')][_0x181a77[_0x8554('0x27')]][_0x8554('0x26')]=_0x181a77[_0x8554('0x26')];this[_0x8554('0xf')][_0x181a77[_0x8554('0x27')]][_0x8554('0x33')]=_0x181a77[_0x8554('0x33')];logger[_0x8554('0x2b')](_0x181a77['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x8554('0x1b')]=function(_0x21d527){var _0x28c795=this;if(this['channels'][_0x21d527[_0x8554('0x27')]]){var _0x1471f0=this[_0x8554('0xf')][_0x21d527['uniqueid']]['id'];this[_0x8554('0xf')][_0x21d527[_0x8554('0x27')]][_0x8554('0x34')]=_0x21d527[_0x8554('0x34')];this['channels'][_0x21d527[_0x8554('0x27')]][_0x8554('0x35')]=_0x21d527[_0x8554('0x35')];this[_0x8554('0xf')][_0x21d527[_0x8554('0x27')]][_0x8554('0x26')]=_0x21d527[_0x8554('0x26')];this[_0x8554('0xf')][_0x21d527[_0x8554('0x27')]]['resolution']=_0x21d527[_0x8554('0x36')];this['channels'][_0x21d527['uniqueid']][_0x8554('0x37')]=_0x21d527['transferrate'];this[_0x8554('0xf')][_0x21d527[_0x8554('0x27')]][_0x8554('0x33')]=_0x21d527[_0x8554('0x33')];this['channels'][_0x21d527[_0x8554('0x27')]]['calleridnum']=_0x21d527[_0x8554('0x38')];if(this['channels'][_0x21d527['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x21d527[_0x8554('0x33')],_0x8554('0x39'),function(_0x16eee9){logger[_0x8554('0x2b')](_0x21d527[_0x8554('0x27')],'\x20result\x20conversion\x20file\x20',_0x16eee9['message']);attachment[_0x8554('0x3a')]({'name':path['parse'](_0x21d527['filename'])[_0x8554('0x29')],'basename':path[_0x8554('0x3b')](_0x21d527[_0x8554('0x33')])[_0x8554('0x29')]+'.pdf','type':_0x8554('0x3c')})[_0x8554('0x3d')](function(_0x907117){faxAccount['notify'](_0x1471f0,{'from':_0x21d527[_0x8554('0x38')],'mapKey':'fax','body':path[_0x8554('0x3b')](_0x21d527[_0x8554('0x33')])[_0x8554('0x29')]+_0x8554('0x3e'),'AttachmentId':_0x907117['id']})[_0x8554('0x3f')](function(_0x3407bf){logger[_0x8554('0x40')](_0x21d527[_0x8554('0x27')],'\x20notify\x20',JSON[_0x8554('0x41')](_0x3407bf));});})[_0x8554('0x3f')](function(_0x57571a){logger['error'](_0x21d527[_0x8554('0x27')],_0x8554('0x42'),JSON[_0x8554('0x41')](_0x57571a));});});}logger['info'](_0x21d527[_0x8554('0x27')],_0x8554('0x42'));}};Fax[_0x8554('0x20')][_0x8554('0x1f')]=function(_0x4a4181){if(this['actions'][_0x4a4181[_0x8554('0x27')]]){_['merge'](this[_0x8554('0xf')][_0x4a4181['uniqueid']],_['pick'](_0x4a4181,[_0x8554('0x43'),_0x8554('0x44')]));}};function updateStatus(_0x3d0cbd){if(_0x3d0cbd[_0x8554('0x45')]){faxMessage[_0x8554('0x46')](_0x3d0cbd[_0x8554('0x45')],{'failMessage':_0x8554('0x47')})[_0x8554('0x3d')](function(_0x567630){ut[_0x8554('0x48')](_0x8554('0x49'),_0x567630);})[_0x8554('0x3f')](function(_0xac8512){ut[_0x8554('0x48')](_0x8554('0x4a'),_0xac8512);});}else{ut[_0x8554('0x48')](_0x8554('0x4b'));}}Fax[_0x8554('0x20')][_0x8554('0x4c')]=function(_0x3f476d,_0x3093cd,_0x38fbda){var _0x327189=this;var _0x36e49a={};if(_0x3093cd){_0x36e49a={'read':_0x3093cd};}else{_0x36e49a={'failMessage':_0x38fbda};}if(this['actions'][_0x3f476d][_0x8554('0x45')]){faxMessage['update'](this['actions'][_0x3f476d][_0x8554('0x45')],_0x36e49a)[_0x8554('0x3d')](function(_0x336f24){ut[_0x8554('0x48')]('[Fax][Message][Updated]',_0x336f24);})['catch'](function(_0x138742){ut[_0x8554('0x48')](_0x8554('0x4d'),_0x138742);})[_0x8554('0x4e')](function(){delete _0x327189['channels'][_0x3f476d];delete _0x327189[_0x8554('0x4f')][_0x3f476d];});}else{ut[_0x8554('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x8554('0xf')][_0x3f476d];delete this[_0x8554('0x4f')][_0x3f476d];}};Fax['prototype'][_0x8554('0x1d')]=function(_0x1ff127){var _0x358c37=this;if(this['channels'][_0x1ff127['uniqueid']]){if(this[_0x8554('0x4f')][_0x1ff127['uniqueid']]){this['channels'][_0x1ff127[_0x8554('0x27')]]['id']=this[_0x8554('0x4f')][_0x1ff127[_0x8554('0x27')]]['id'];this[_0x8554('0xf')][_0x1ff127[_0x8554('0x27')]][_0x8554('0x29')]=this[_0x8554('0x4f')][_0x1ff127[_0x8554('0x27')]]['name'];}logger[_0x8554('0x2b')](_0x1ff127[_0x8554('0x27')],this[_0x8554('0x4f')][_0x1ff127['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x8554('0x50'),JSON[_0x8554('0x41')](this[_0x8554('0xf')][_0x1ff127['uniqueid']]));if(this[_0x8554('0x4f')][_0x1ff127['uniqueid']]){if(this[_0x8554('0xf')][_0x1ff127[_0x8554('0x27')]][_0x8554('0x51')]>0x0&&this[_0x8554('0xf')][_0x1ff127[_0x8554('0x27')]][_0x8554('0x19')]===_0x8554('0x52')){this['updateStatus'](_0x1ff127[_0x8554('0x27')],!![]);}else{this[_0x8554('0x4c')](_0x1ff127[_0x8554('0x27')],![],this[_0x8554('0xf')][_0x1ff127[_0x8554('0x27')]][_0x8554('0x53')]?_0x8554('0x54')+this['channels'][_0x1ff127[_0x8554('0x27')]][_0x8554('0x53')]:_0x8554('0x55'));}}}};Fax[_0x8554('0x20')][_0x8554('0x56')]=function(_0x98f9a6){var _0x3c0b1c=this;return new BPromise(function(_0x5b3661,_0x4bf777){_0x3c0b1c[_0x8554('0x57')](_0x98f9a6,_0x3c0b1c[_0x8554('0x10')][_0x98f9a6[_0x8554('0x58')]])[_0x8554('0x3d')](function(_0x59a3bc){ut['logger'](_0x8554('0x59'),_0x59a3bc);_0x5b3661(ut['message']('Fax\x20received'));})[_0x8554('0x3f')](function(_0x3d90ea){ut['logger'](_0x8554('0x5a'),_0x3d90ea);updateStatus(_0x98f9a6);_0x4bf777(ut['message'](_0x8554('0x5b')));});});};Fax[_0x8554('0x20')][_0x8554('0x5c')]=function(_0x20cbad){var _0x52a902=this;return new BPromise(function(_0x5972b0,_0x41f6c5){var _0x7a1a3e=_0x52a902[_0x8554('0x5d')](_0x52a902[_0x8554('0x10')][_0x20cbad['FaxAccountId']]['Trunk'],_0x20cbad);if(_0x7a1a3e[_0x8554('0x5e')]){_0x5972b0(ut[_0x8554('0x5f')](_0x8554('0x60')));}else{_0x41f6c5(ut[_0x8554('0x5f')](_0x7a1a3e[_0x8554('0x5f')]));}});};function originate(_0x1a00cc,_0x124a24,_0x216f65){return new BPromise(function(_0x33a18d,_0x4f30af){if(_0x216f65){var _0x156913=util['format'](_0x8554('0x61'),path[_0x8554('0x3b')](_0x1a00cc['path'])[_0x8554('0x29')],_0x1a00cc[_0x8554('0x4')]);gs[_0x8554('0x62')](_0x156913)[_0x8554('0x3d')](function(){_0x1a00cc['path']=util[_0x8554('0x63')](_0x8554('0x64'),path[_0x8554('0x3b')](_0x1a00cc[_0x8554('0x4')])[_0x8554('0x65')],path[_0x8554('0x3b')](_0x1a00cc['path'])[_0x8554('0x29')]);_0x124a24[_0x8554('0x66')]=_0x1a00cc[_0x8554('0x4')];ut[_0x8554('0x48')](_0x8554('0x67'),'');ami[_0x8554('0x68')](ut['variablesAction'](_0x1a00cc,_0x124a24))[_0x8554('0x3d')](function(_0x5a3c07){_0x33a18d(_0x5a3c07);})[_0x8554('0x3f')](function(_0x453344){_0x4f30af(_0x453344);});})['catch'](function(_0xbabd43){_0x4f30af(_0xbabd43);});}else{ami[_0x8554('0x68')](ut[_0x8554('0x69')](_0x1a00cc,_0x124a24))[_0x8554('0x3d')](function(_0x5413ff){_0x33a18d(_0x5413ff);})[_0x8554('0x3f')](function(_0x4ebbfb){_0x4f30af(_0x4ebbfb);});}});}Fax[_0x8554('0x20')]['execOriginate']=function(_0x47c644,_0x1a9f1e){var _0x5a9668=this;return new BPromise(function(_0xbcc17e,_0x16538b){var _0x359f16=uuid['v4']();var _0x444d85=ut[_0x8554('0x6a')](_0x47c644,_0x1a9f1e);_0x5a9668[_0x8554('0x4f')][_0x359f16]=new Action(_0x359f16,_0x1a9f1e,_0x47c644);var _0x5573cb=_0x5a9668[_0x8554('0x4f')][_0x359f16];if(path[_0x8554('0x3b')](_0x47c644[_0x8554('0x4')])['ext']===_0x8554('0x3e')){originate(_0x5573cb,_0x444d85,!![])[_0x8554('0x3d')](function(_0x53d15d){_0xbcc17e(_0x53d15d);})[_0x8554('0x3f')](function(_0x22b908){_0x16538b(_0x22b908);});}else{originate(_0x5573cb,_0x444d85,![])['then'](function(_0x18580b){_0xbcc17e(_0x18580b);})[_0x8554('0x3f')](function(_0x3aff78){_0x16538b(_0x3aff78);});}});};Fax[_0x8554('0x20')][_0x8554('0x6b')]=function(_0x5c818d){return!_[_0x8554('0x6c')](_0x5c818d)&&!_[_0x8554('0x6c')](_0x5c818d[_0x8554('0x29')])&&!_[_0x8554('0x6c')](_0x5c818d['active'])&&_0x5c818d[_0x8554('0x6d')]&&!_[_0x8554('0x6c')](this[_0x8554('0x11')][util[_0x8554('0x63')](_0x8554('0x6e'),_0x5c818d[_0x8554('0x29')])])&&!_[_0x8554('0x6c')](this[_0x8554('0x11')][util['format']('SIP/%s',_0x5c818d[_0x8554('0x29')])]['status'])&&(this[_0x8554('0x11')][util[_0x8554('0x63')](_0x8554('0x6e'),_0x5c818d[_0x8554('0x29')])][_0x8554('0x32')]==='reachable'||this['trunks'][util['format']('SIP/%s',_0x5c818d[_0x8554('0x29')])]['status']==='unmonitored');};Fax[_0x8554('0x20')][_0x8554('0x5d')]=function(_0x4179d4,_0x3df107){if(!this['isTrunkReachable'](_0x4179d4)){ut[_0x8554('0x48')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0x4179d4)?'':_0x4179d4[_0x8554('0x29')]+_0x8554('0x6f'));return{'isValid':![],'message':_0x8554('0x70')};}if(_['isNil'](_0x3df107['fax'])){ut[_0x8554('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8554('0x41')](_0x3df107));return{'isValid':![],'message':_0x8554('0x71')};}if(_['isNil'](_0x3df107[_0x8554('0x4')])){ut[_0x8554('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8554('0x41')](_0x3df107));return{'isValid':![],'message':_0x8554('0x72')};}return{'isValid':!![],'message':_0x8554('0x73')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d84120d..bd77c84 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 _0x7aee=['util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then','[Notify]\x20'];(function(_0x1c18d7,_0x112781){var _0x31bea7=function(_0x25ed65){while(--_0x25ed65){_0x1c18d7['push'](_0x1c18d7['shift']());}};_0x31bea7(++_0x112781);}(_0x7aee,0x15e));var _0xe7ae=function(_0x2b928b,_0x134c21){_0x2b928b=_0x2b928b-0x0;var _0x567f4b=_0x7aee[_0x2b928b];return _0x567f4b;};'use strict';var util=require(_0xe7ae('0x0'));var BPromise=require(_0xe7ae('0x1'));var logger=require('../../../config/logger')(_0xe7ae('0x2'));var _=require(_0xe7ae('0x3'));var faxAccount=require(_0xe7ae('0x4'));function loggerCatch(_0x25d644){return function(_0x5dde91){logger[_0xe7ae('0x5')](_0x25d644,util[_0xe7ae('0x6')](_0x5dde91,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x34e15a,_0x59f0c5){return BPromise[_0xe7ae('0x7')]()[_0xe7ae('0x8')](faxAccount['notify'](_0x34e15a,_0x59f0c5))['catch'](loggerCatch(_0xe7ae('0x9')));}; \ No newline at end of file +var _0x2811=['lodash','../rpc/faxAccount','error','notify','util','preview'];(function(_0xa6e83b,_0x266b29){var _0x21d379=function(_0x20e42c){while(--_0x20e42c){_0xa6e83b['push'](_0xa6e83b['shift']());}};_0x21d379(++_0x266b29);}(_0x2811,0xac));var _0x1281=function(_0x26ffcb,_0x27f794){_0x26ffcb=_0x26ffcb-0x0;var _0x2a7d4c=_0x2811[_0x26ffcb];return _0x2a7d4c;};'use strict';var util=require(_0x1281('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x1281('0x1'));var _=require(_0x1281('0x2'));var faxAccount=require(_0x1281('0x3'));function loggerCatch(_0x536b91){return function(_0x3b4514){logger[_0x1281('0x4')](_0x536b91,util['inspect'](_0x3b4514,{'showHidden':![],'depth':null}));};}exports[_0x1281('0x5')]=function(_0x49a67f,_0x54ceb0){return BPromise['resolve']()['then'](faxAccount[_0x1281('0x5')](_0x49a67f,_0x54ceb0))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7ea3c8b..f3632a5 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 _0x419f=['util','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','info'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x419f,0x78));var _0xf419=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x419f[_0x8c43de];return _0xa6591b;};'use strict';var util=require(_0xf419('0x0'));var logger=require(_0xf419('0x1'))(_0xf419('0x2'));var BPromise=require(_0xf419('0x3'));var exec=require('child_process')[_0xf419('0x4')];exports[_0xf419('0x5')]=function(_0x587bfa){return new BPromise(function(_0x176fad,_0x33403e){exec(_0x587bfa,function(_0x180486,_0x3e8c95,_0x3ce3ee){logger['info'](_0xf419('0x6'),_0x3e8c95);if(_0x180486){logger[_0xf419('0x7')](_0xf419('0x6'),'\x20Error\x20:',util['inspect'](_0x180486,{'showHidden':![],'depth':null}),_0x3e8c95,_0x3ce3ee);_0x33403e(_0x180486);}_0x176fad(_0x3e8c95);});});}; \ No newline at end of file +var _0xa6a5=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x207edc,_0x2fb34e){var _0xfa49c6=function(_0x2703d6){while(--_0x2703d6){_0x207edc['push'](_0x207edc['shift']());}};_0xfa49c6(++_0x2fb34e);}(_0xa6a5,0x17d));var _0x5a6a=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xa6a5[_0x1030ce];return _0x3367fd;};'use strict';var util=require(_0x5a6a('0x0'));var logger=require(_0x5a6a('0x1'))(_0x5a6a('0x2'));var BPromise=require(_0x5a6a('0x3'));var exec=require(_0x5a6a('0x4'))[_0x5a6a('0x5')];exports['execute']=function(_0x57f48b){return new BPromise(function(_0x3f48c2,_0x1d7e0a){exec(_0x57f48b,function(_0x407058,_0x197ccc,_0xedff01){logger[_0x5a6a('0x6')]('Exec\x20gs',_0x197ccc);if(_0x407058){logger[_0x5a6a('0x6')](_0x5a6a('0x7'),_0x5a6a('0x8'),util[_0x5a6a('0x9')](_0x407058,{'showHidden':![],'depth':null}),_0x197ccc,_0xedff01);_0x1d7e0a(_0x407058);}_0x3f48c2(_0x197ccc);});});}; \ 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 fb02946..8481465 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 _0x6354=['format','\x22%s\x22','faxdetect','localstationid','path','uniqueid','originate','xcally-motion-fax','from-sip','lodash','moment','message','logger','ecm','headerinfo'];(function(_0x1bc5b2,_0x376104){var _0x5907a5=function(_0x4b681d){while(--_0x4b681d){_0x1bc5b2['push'](_0x1bc5b2['shift']());}};_0x5907a5(++_0x376104);}(_0x6354,0xcc));var _0x4635=function(_0x3dd409,_0x29c8c3){_0x3dd409=_0x3dd409-0x0;var _0x2d09a0=_0x6354[_0x3dd409];return _0x2d09a0;};'use strict';var util=require('util');var _=require(_0x4635('0x0'));var moment=require(_0x4635('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x4635('0x2')]=function(_0x26c7ad){return{'message':_0x26c7ad};};exports[_0x4635('0x3')]=function(_0x54cb94,_0x179bfb){logger['info'](_0x54cb94,util['inspect'](_0x179bfb,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1a2f85,_0x4d5afe){var _0x456f31={'XMF-ECM':_0x4d5afe[_0x4635('0x4')],'XMF-HEADERINFO':_0x4d5afe[_0x4635('0x5')],'XMF-MINRATE':_0x4d5afe['minrate'],'XMF-MAXRATE':_0x4d5afe['maxrate'],'XMF-MODEM':util[_0x4635('0x6')](_0x4635('0x7'),_0x4d5afe['modem']),'XMF-GATEWAY':_0x4d5afe['gateway'],'XMF-FAXDETECT':_0x4d5afe[_0x4635('0x8')],'XMF-T38TIMEOUT':_0x4d5afe['t38timeout'],'XMF-LOCALSTATIONID':_0x4d5afe[_0x4635('0x9')],'XMF-PATH':_0x1a2f85[_0x4635('0xa')]};return _0x456f31;};exports['variablesAction']=function(_0x4b0da4,_0x5b6621){return{'actionid':_0x4b0da4[_0x4635('0xb')],'action':_0x4635('0xc'),'channel':_0x4b0da4['channel'],'Exten':_0x4635('0xd'),'Context':_0x4635('0xe'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4b0da4[_0x4635('0x5')]?_0x4b0da4[_0x4635('0x5')]:'',_0x4b0da4[_0x4635('0x9')]),'variable':_0x5b6621,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b0da4[_0x4635('0xb')]};}; \ No newline at end of file +var _0xd408=['uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','../../../../config/logger','fax','message','logger','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction'];(function(_0x599acc,_0x2e54a4){var _0x47bacc=function(_0x134ade){while(--_0x134ade){_0x599acc['push'](_0x599acc['shift']());}};_0x47bacc(++_0x2e54a4);}(_0xd408,0x6d));var _0x8d40=function(_0x1b4e8a,_0x2ac96e){_0x1b4e8a=_0x1b4e8a-0x0;var _0x45f3c9=_0xd408[_0x1b4e8a];return _0x45f3c9;};'use strict';var util=require(_0x8d40('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x8d40('0x1'))(_0x8d40('0x2'));exports[_0x8d40('0x3')]=function(_0x1371f2){return{'message':_0x1371f2};};exports[_0x8d40('0x4')]=function(_0x20427d,_0x41f0a2){logger['info'](_0x20427d,util['inspect'](_0x41f0a2,{'showHidden':![],'depth':null}));};exports[_0x8d40('0x5')]=function(_0xf3b457,_0x3dcf7c){var _0x27bc1d={'XMF-ECM':_0x3dcf7c[_0x8d40('0x6')],'XMF-HEADERINFO':_0x3dcf7c[_0x8d40('0x7')],'XMF-MINRATE':_0x3dcf7c['minrate'],'XMF-MAXRATE':_0x3dcf7c[_0x8d40('0x8')],'XMF-MODEM':util[_0x8d40('0x9')](_0x8d40('0xa'),_0x3dcf7c[_0x8d40('0xb')]),'XMF-GATEWAY':_0x3dcf7c[_0x8d40('0xc')],'XMF-FAXDETECT':_0x3dcf7c[_0x8d40('0xd')],'XMF-T38TIMEOUT':_0x3dcf7c['t38timeout'],'XMF-LOCALSTATIONID':_0x3dcf7c[_0x8d40('0xe')],'XMF-PATH':_0xf3b457[_0x8d40('0xf')]};return _0x27bc1d;};exports[_0x8d40('0x10')]=function(_0x3fb874,_0x5a8373){return{'actionid':_0x3fb874[_0x8d40('0x11')],'action':'originate','channel':_0x3fb874[_0x8d40('0x12')],'Exten':_0x8d40('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x8d40('0x9')](_0x8d40('0x14'),_0x3fb874[_0x8d40('0x7')]?_0x3fb874['headerinfo']:'',_0x3fb874[_0x8d40('0xe')]),'variable':_0x5a8373,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3fb874['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index faac889..8fa32a9 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 _0x7181=['./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTrunks','initTrunks','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger'];(function(_0x4e3bc2,_0x45d4f5){var _0x25fd31=function(_0x57af0f){while(--_0x57af0f){_0x4e3bc2['push'](_0x4e3bc2['shift']());}};_0x25fd31(++_0x45d4f5);}(_0x7181,0xf5));var _0x1718=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7181[_0x3b5250];return _0xc844a1;};'use strict';var util=require(_0x1718('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x1718('0x1'));var Acw=require(_0x1718('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x1718('0x3'));var Preview=require(_0x1718('0x4'));var Fax=require(_0x1718('0x5'));var user=require(_0x1718('0x6'));var voiceQueue=require(_0x1718('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x1718('0x8'));var trunk=require(_0x1718('0x9'));var trigger=require(_0x1718('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x1718('0xb'));var campaign=require(_0x1718('0xc'));var voiceExtension=require(_0x1718('0xd'));var faxAccount=require(_0x1718('0xe'));var zendesk=require(_0x1718('0xf'));var salesforce=require(_0x1718('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x1718('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x1718('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x1718('0x13'));var servicenow=require(_0x1718('0x14'));var dynamics365=require(_0x1718('0x15'));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(_0x1718('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1718('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1718('0x17')](_0x1718('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x1718('0x19')]()[_0x1718('0x1a')](user[_0x1718('0x1b')]())[_0x1718('0x1a')](realtime[_0x1718('0x1c')]())[_0x1718('0x1a')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x1718('0x1a')](trunk[_0x1718('0x1d')]())[_0x1718('0x1a')](realtime[_0x1718('0x1e')]())[_0x1718('0x1a')](voiceQueue['getVoiceQueues']())[_0x1718('0x1a')](realtime[_0x1718('0x1f')]())[_0x1718('0x1a')](trigger['getTriggers']())[_0x1718('0x1a')](realtime[_0x1718('0x20')]())[_0x1718('0x1a')](template['getTemplates']())[_0x1718('0x1a')](realtime[_0x1718('0x21')]())[_0x1718('0x1a')](zendesk[_0x1718('0x22')]())[_0x1718('0x1a')](realtime[_0x1718('0x23')]())[_0x1718('0x1a')](salesforce[_0x1718('0x24')]())[_0x1718('0x1a')](realtime[_0x1718('0x25')]())['then'](sugarcrm[_0x1718('0x26')]())['then'](realtime[_0x1718('0x27')]())[_0x1718('0x1a')](freshdesk[_0x1718('0x28')]())['then'](realtime['initFreshdeskAccounts']())[_0x1718('0x1a')](desk[_0x1718('0x29')]())['then'](realtime[_0x1718('0x2a')]())[_0x1718('0x1a')](zoho[_0x1718('0x2b')]())[_0x1718('0x1a')](realtime[_0x1718('0x2c')]())[_0x1718('0x1a')](vtiger[_0x1718('0x2d')]())[_0x1718('0x1a')](realtime[_0x1718('0x2e')]())[_0x1718('0x1a')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x1718('0x2f')]())[_0x1718('0x1a')](servicenow[_0x1718('0x30')]())[_0x1718('0x1a')](realtime[_0x1718('0x31')]())['then'](dynamics365['getDynamics365Accounts']())[_0x1718('0x1a')](realtime['initDynamics365Accounts']())['then'](campaign[_0x1718('0x32')]())[_0x1718('0x1a')](realtime['initCampaigns']())[_0x1718('0x1a')](voiceExtension[_0x1718('0x33')]())[_0x1718('0x1a')](realtime['initVoiceExtensions']())[_0x1718('0x1a')](faxAccount[_0x1718('0x34')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x1718('0x19')]()[_0x1718('0x1a')](voiceQueueReport['getVoiceQueueReports']())[_0x1718('0x1a')](realtime[_0x1718('0x35')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1718('0x1a')](realtime[_0x1718('0x36')]())[_0x1718('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x1718('0x1a')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x1718('0x37')]())['then'](realtime[_0x1718('0x38')]())[_0x1718('0x39')](function(_0x1a1e5c){logger[_0x1718('0x3a')](_0x1718('0x3b'),util[_0x1718('0x3c')](_0x1a1e5c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1718('0x3d')](realtime,preview,fax)[_0x1718('0x1a')](function(){return initRealtime();})[_0x1718('0x1a')](function(){return initParams();})[_0x1718('0x1a')](function(){report[_0x1718('0x3e')]();setInterval(initRealtime,0x1388);})[_0x1718('0x39')](function(_0x21a10a){logger[_0x1718('0x3a')](_0x1718('0x3f'),util[_0x1718('0x3c')](_0x21a10a,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xe755=['ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','[index.js][initParams]','listen','sync','catch','error','[index.js][main]','inspect','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365'];(function(_0x12cd8f,_0x4bed51){var _0x3f054e=function(_0x474bc3){while(--_0x474bc3){_0x12cd8f['push'](_0x12cd8f['shift']());}};_0x3f054e(++_0x4bed51);}(_0xe755,0xfc));var _0x5e75=function(_0x1b8e43,_0x5a2f01){_0x1b8e43=_0x1b8e43-0x0;var _0x4cf943=_0xe755[_0x1b8e43];return _0x4cf943;};'use strict';var util=require('util');var moment=require(_0x5e75('0x0'));var server=require(_0x5e75('0x1'));var Realtime=require('./realtime');var Report=require(_0x5e75('0x2'));var Acw=require(_0x5e75('0x3'));var Trigger=require(_0x5e75('0x4'));var Dialer=require(_0x5e75('0x5'));var Preview=require(_0x5e75('0x6'));var Fax=require(_0x5e75('0x7'));var user=require(_0x5e75('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x5e75('0x9'));var voiceCallReport=require(_0x5e75('0xa'));var trunk=require(_0x5e75('0xb'));var trigger=require(_0x5e75('0xc'));var template=require(_0x5e75('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x5e75('0xe'));var voiceExtension=require(_0x5e75('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x5e75('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x5e75('0x11'));var freshdesk=require(_0x5e75('0x12'));var desk=require(_0x5e75('0x13'));var zoho=require(_0x5e75('0x14'));var vtiger=require(_0x5e75('0x15'));var freshsales=require(_0x5e75('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x5e75('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x5e75('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5e75('0x19')](_0x5e75('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5e75('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x5e75('0x1b')]()[_0x5e75('0x1c')](user[_0x5e75('0x1d')]())[_0x5e75('0x1c')](realtime['initAgents']())[_0x5e75('0x1c')](user[_0x5e75('0x1e')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x1f')]())[_0x5e75('0x1c')](trunk['getTrunks']())[_0x5e75('0x1c')](realtime[_0x5e75('0x20')]())['then'](voiceQueue[_0x5e75('0x21')]())['then'](realtime['initVoiceQueues']())[_0x5e75('0x1c')](trigger[_0x5e75('0x22')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x23')]())[_0x5e75('0x1c')](template[_0x5e75('0x24')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x25')]())[_0x5e75('0x1c')](zendesk['getZendeskAccounts']())['then'](realtime[_0x5e75('0x26')]())[_0x5e75('0x1c')](salesforce['getSalesforceAccounts']())[_0x5e75('0x1c')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x5e75('0x27')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x28')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x5e75('0x1c')](realtime['initFreshdeskAccounts']())[_0x5e75('0x1c')](desk[_0x5e75('0x29')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x2a')]())[_0x5e75('0x1c')](zoho[_0x5e75('0x2b')]())['then'](realtime['initZohoAccounts']())[_0x5e75('0x1c')](vtiger[_0x5e75('0x2c')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x2d')]())[_0x5e75('0x1c')](freshsales['getFreshsalesAccounts']())[_0x5e75('0x1c')](realtime[_0x5e75('0x2e')]())['then'](servicenow[_0x5e75('0x2f')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x30')]())[_0x5e75('0x1c')](dynamics365[_0x5e75('0x31')]())['then'](realtime['initDynamics365Accounts']())[_0x5e75('0x1c')](campaign['getCampaigns']())[_0x5e75('0x1c')](realtime[_0x5e75('0x32')]())[_0x5e75('0x1c')](voiceExtension[_0x5e75('0x33')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x34')]())[_0x5e75('0x1c')](faxAccount[_0x5e75('0x35')]())['then'](realtime[_0x5e75('0x36')]())[_0x5e75('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x5e75('0x1b')]()['then'](voiceQueueReport[_0x5e75('0x37')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x38')]())[_0x5e75('0x1c')](cmHopperHistory[_0x5e75('0x39')]())[_0x5e75('0x1c')](realtime[_0x5e75('0x3a')]())[_0x5e75('0x1c')](cmHopperHistory[_0x5e75('0x3b')]())['then'](realtime[_0x5e75('0x3c')]())[_0x5e75('0x1c')](voiceCallReport[_0x5e75('0x3d')]())[_0x5e75('0x1c')](realtime['initVoiceCallReports']())['catch'](function(_0x51a1d3){logger['error'](_0x5e75('0x3e'),util['inspect'](_0x51a1d3,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5e75('0x3f')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x5e75('0x1c')](function(){return initParams();})[_0x5e75('0x1c')](function(){report[_0x5e75('0x40')]();setInterval(initRealtime,0x1388);})[_0x5e75('0x41')](function(_0x2a0fc1){logger[_0x5e75('0x42')](_0x5e75('0x43'),util[_0x5e75('0x44')](_0x2a0fc1,{'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 bc99b1f..7ac68fe 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 _0x39b3=['talking','statePause','toNumber','format','voiceStatusQueue','user:%s','emit','user:presence','exports','lodash','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','not_inuse'];(function(_0x4e5ab2,_0x5c86b6){var _0x1e81c8=function(_0x288653){while(--_0x288653){_0x4e5ab2['push'](_0x4e5ab2['shift']());}};_0x1e81c8(++_0x5c86b6);}(_0x39b3,0xc9));var _0x339b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x39b3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x339b('0x0'));var util=require('util');var moment=require('moment');var Redis=require(_0x339b('0x1'));var config=require('../../../config/environment');config[_0x339b('0x2')]=_['defaults'](config[_0x339b('0x2')],{'host':_0x339b('0x3'),'port':0x18eb});var io=require(_0x339b('0x4'))(new Redis(config[_0x339b('0x2')]));function Agent(_0x2e7bd8){this['id']=_0x2e7bd8['id']||0x0;this[_0x339b('0x5')]=_0x2e7bd8[_0x339b('0x5')]||'';this[_0x339b('0x6')]=_0x2e7bd8[_0x339b('0x6')]||'';this[_0x339b('0x7')]=_0x2e7bd8[_0x339b('0x7')]||'';this[_0x339b('0x8')]=_0x2e7bd8[_0x339b('0x8')]||'';this[_0x339b('0x9')]=_0x339b('0xa');this[_0x339b('0xb')]=0x0;this[_0x339b('0xc')]=_0x339b('0xa');this[_0x339b('0xd')]='';this[_0x339b('0xe')]='';this['mobile']='';this['interface']='';this['online']=_0x2e7bd8['online']||![];this[_0x339b('0xf')]=_0x339b('0xa');this[_0x339b('0x10')]=0x0;this[_0x339b('0x11')]='';this['voiceStatusQueue']='';this[_0x339b('0x12')]=![];this[_0x339b('0x13')]=![];}Agent[_0x339b('0x14')][_0x339b('0x15')]=function(_0x494be9){if(!_0x494be9['state']){return;}var _0x47cb4d=null;var _0x30595c=_0x494be9[_0x339b('0x9')]['toLowerCase']();switch(_0x30595c){case _0x339b('0x16'):_0x30595c='idle';break;case'inuse':_0x30595c=_0x339b('0x17');break;}if(this[_0x339b('0xf')]!==_0x30595c||_0x494be9[_0x339b('0x18')]){_0x47cb4d=_[_0x339b('0x19')](moment()[_0x339b('0x1a')]('x'));}var _0x480ee5={'id':this['id'],'name':this[_0x339b('0x5')],'email':this[_0x339b('0x6')],'accountcode':this[_0x339b('0x7')],'fullname':this[_0x339b('0x8')],'state':this[_0x339b('0x9')],'stateTime':this['stateTime'],'status':this[_0x339b('0xc')],'address':this[_0x339b('0xd')],'voiceStatus':_0x30595c||this[_0x339b('0xf')],'voiceStatusTime':_0x47cb4d||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x339b('0x11')],'voiceStatusQueue':this[_0x339b('0x1b')],'interface':this['interface'],'onhold':this[_0x339b('0x12')]};if(this[_0x339b('0xf')]!==_0x30595c){this[_0x339b('0xf')]=_0x30595c;io['to'](util['format'](_0x339b('0x1c'),_0x480ee5['name']))[_0x339b('0x1d')]('user:ami:update',_0x480ee5);io[_0x339b('0x1d')](_0x339b('0x1e'),_0x480ee5);}};module[_0x339b('0x1f')]=Agent; \ No newline at end of file +var _0x9009=['toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','name','interface','user:%s','emit','user:ami:update','exports','lodash','moment','ioredis','redis','defaults','localhost','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','online','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x9009,0x1d4));var _0x9900=function(_0x12b0fe,_0x129986){_0x12b0fe=_0x12b0fe-0x0;var _0x2fc470=_0x9009[_0x12b0fe];return _0x2fc470;};'use strict';var _=require(_0x9900('0x0'));var util=require('util');var moment=require(_0x9900('0x1'));var Redis=require(_0x9900('0x2'));var config=require('../../../config/environment');config[_0x9900('0x3')]=_[_0x9900('0x4')](config[_0x9900('0x3')],{'host':_0x9900('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9900('0x3')]));function Agent(_0x273e50){this['id']=_0x273e50['id']||0x0;this['name']=_0x273e50['name']||'';this[_0x9900('0x6')]=_0x273e50[_0x9900('0x6')]||'';this['accountcode']=_0x273e50[_0x9900('0x7')]||'';this[_0x9900('0x8')]=_0x273e50[_0x9900('0x8')]||'';this[_0x9900('0x9')]='unknown';this[_0x9900('0xa')]=0x0;this[_0x9900('0xb')]=_0x9900('0xc');this[_0x9900('0xd')]='';this[_0x9900('0xe')]='';this['mobile']='';this['interface']='';this[_0x9900('0xf')]=_0x273e50[_0x9900('0xf')]||![];this['voiceStatus']='unknown';this[_0x9900('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x9900('0x11')]='';this[_0x9900('0x12')]=![];this[_0x9900('0x13')]=![];}Agent[_0x9900('0x14')][_0x9900('0x15')]=function(_0x1014e8){if(!_0x1014e8[_0x9900('0x9')]){return;}var _0x7cab33=null;var _0x126c36=_0x1014e8[_0x9900('0x9')][_0x9900('0x16')]();switch(_0x126c36){case _0x9900('0x17'):_0x126c36=_0x9900('0x18');break;case _0x9900('0x19'):_0x126c36=_0x9900('0x1a');break;}if(this[_0x9900('0x1b')]!==_0x126c36||_0x1014e8[_0x9900('0x1c')]){_0x7cab33=_['toNumber'](moment()['format']('x'));}var _0x1017a5={'id':this['id'],'name':this[_0x9900('0x1d')],'email':this[_0x9900('0x6')],'accountcode':this[_0x9900('0x7')],'fullname':this['fullname'],'state':this[_0x9900('0x9')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x9900('0xd')],'voiceStatus':_0x126c36||this['voiceStatus'],'voiceStatusTime':_0x7cab33||this[_0x9900('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9900('0x1e')],'onhold':this[_0x9900('0x12')]};if(this[_0x9900('0x1b')]!==_0x126c36){this[_0x9900('0x1b')]=_0x126c36;io['to'](util['format'](_0x9900('0x1f'),_0x1017a5[_0x9900('0x1d')]))[_0x9900('0x20')](_0x9900('0x21'),_0x1017a5);io[_0x9900('0x20')]('user:presence',_0x1017a5);}};module[_0x9900('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5870550..6f458d4 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 _0xdd54=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x251569,_0x448f07){var _0xdae64=function(_0x4d0d1d){while(--_0x4d0d1d){_0x251569['push'](_0x251569['shift']());}};_0xdae64(++_0x448f07);}(_0xdd54,0x15d));var _0x4dd5=function(_0x5a7f64,_0x347d57){_0x5a7f64=_0x5a7f64-0x0;var _0x3d30f1=_0xdd54[_0x5a7f64];return _0x3d30f1;};'use strict';function Campaign(_0x148681){this['id']=_0x148681['id']||0x0;this['name']=_0x148681['name']||'';this['type']=_0x148681[_0x4dd5('0x0')]||_0x4dd5('0x1');this[_0x4dd5('0x2')]=0x0;this[_0x4dd5('0x3')]=0x0;this[_0x4dd5('0x4')]=0x0;this[_0x4dd5('0x5')]=0x0;this[_0x4dd5('0x6')]='';this[_0x4dd5('0x7')]=!![];this[_0x4dd5('0x8')]=_0x148681['active'];this['limitCalls']=_0x148681['limitCalls'];this[_0x4dd5('0x9')]=_0x148681['dialTimezone']||null;this[_0x4dd5('0xa')]=_0x148681[_0x4dd5('0xa')]?_0x148681[_0x4dd5('0xa')]:null;this[_0x4dd5('0xb')]=_0x148681[_0x4dd5('0xb')];this[_0x4dd5('0xc')]=_0x148681[_0x4dd5('0xc')];this['dialOriginateTimeout']=_0x148681[_0x4dd5('0xd')]||0x1e;this[_0x4dd5('0xe')]=_0x148681[_0x4dd5('0xe')];this['dialCongestionRetryFrequency']=_0x148681['dialCongestionRetryFrequency'];this[_0x4dd5('0xf')]=_0x148681[_0x4dd5('0xf')];this[_0x4dd5('0x10')]=_0x148681[_0x4dd5('0x10')];this[_0x4dd5('0x11')]=_0x148681[_0x4dd5('0x11')];this[_0x4dd5('0x12')]=_0x148681[_0x4dd5('0x12')];this[_0x4dd5('0x13')]=_0x148681['dialGlobalMaxRetry'];this[_0x4dd5('0x14')]=_0x148681[_0x4dd5('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x148681[_0x4dd5('0x15')]||0x96;this[_0x4dd5('0x16')]=_0x148681[_0x4dd5('0x16')]||0x3;this[_0x4dd5('0x17')]=_0x148681['dialDropRetryFrequency']||0x96;this[_0x4dd5('0x18')]=_0x148681['dialAbandonedMaxRetry']||0x3;this[_0x4dd5('0x19')]=_0x148681[_0x4dd5('0x19')]||0x96;this[_0x4dd5('0x1a')]=_0x148681['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x148681[_0x4dd5('0x1b')]||0x96;this[_0x4dd5('0x1c')]=_0x148681['dialAgentRejectMaxRetry']||0x3;this[_0x4dd5('0x1d')]=_0x148681[_0x4dd5('0x1d')]||0x96;this[_0x4dd5('0x1e')]=_0x148681[_0x4dd5('0x1e')]||_0x4dd5('0x1f');this['dialPrefix']=_0x148681[_0x4dd5('0x20')]||undefined;this[_0x4dd5('0x21')]=_0x148681[_0x4dd5('0x21')]||undefined;this[_0x4dd5('0x22')]=_0x148681[_0x4dd5('0x22')]||undefined;this[_0x4dd5('0x23')]=_0x148681[_0x4dd5('0x23')]?_0x148681[_0x4dd5('0x23')]:undefined;this['Trunk']=_0x148681[_0x4dd5('0x24')]?_0x148681[_0x4dd5('0x24')]:undefined;this['Interval']=_0x148681['Interval']?_0x148681[_0x4dd5('0x25')]:undefined;this[_0x4dd5('0x26')]=_0x148681[_0x4dd5('0x26')]?_0x148681[_0x4dd5('0x26')]:undefined;this[_0x4dd5('0x27')]=_0x148681[_0x4dd5('0x26')]?_0x148681[_0x4dd5('0x26')][_0x4dd5('0x28')]:undefined;this[_0x4dd5('0x29')]=_0x148681['dialAMDActive']||![];this[_0x4dd5('0x2a')]=_0x148681['dialAMDInitialSilence'];this[_0x4dd5('0x2b')]=_0x148681[_0x4dd5('0x2b')];this[_0x4dd5('0x2c')]=_0x148681[_0x4dd5('0x2c')];this[_0x4dd5('0x2d')]=_0x148681['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x148681[_0x4dd5('0x2e')];this[_0x4dd5('0x2f')]=_0x148681[_0x4dd5('0x2f')];this[_0x4dd5('0x30')]=_0x148681[_0x4dd5('0x30')];this['dialAMDSilenceThreshold']=_0x148681[_0x4dd5('0x31')];this['dialAMDMaximumWordLength']=_0x148681[_0x4dd5('0x32')];}module[_0x4dd5('0x33')]=Campaign; \ No newline at end of file +var _0xc81b=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','type','campaign','originated','ivrAnswerCallsDay','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x529f36,_0x6b4496){var _0x64d301=function(_0x5a1399){while(--_0x5a1399){_0x529f36['push'](_0x529f36['shift']());}};_0x64d301(++_0x6b4496);}(_0xc81b,0x152));var _0xbc81=function(_0x371b48,_0x31adb6){_0x371b48=_0x371b48-0x0;var _0x152b9c=_0xc81b[_0x371b48];return _0x152b9c;};'use strict';function Campaign(_0x50420a){this['id']=_0x50420a['id']||0x0;this['name']=_0x50420a['name']||'';this[_0xbc81('0x0')]=_0x50420a[_0xbc81('0x0')]||_0xbc81('0x1');this[_0xbc81('0x2')]=0x0;this['temp']=0x0;this[_0xbc81('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xbc81('0x4')]=_0x50420a[_0xbc81('0x4')];this[_0xbc81('0x5')]=_0x50420a[_0xbc81('0x5')];this['dialTimezone']=_0x50420a[_0xbc81('0x6')]||null;this[_0xbc81('0x7')]=_0x50420a[_0xbc81('0x7')]?_0x50420a[_0xbc81('0x7')]:null;this[_0xbc81('0x8')]=_0x50420a[_0xbc81('0x8')];this['dialOriginateCallerIdNumber']=_0x50420a[_0xbc81('0x9')];this[_0xbc81('0xa')]=_0x50420a['dialOriginateTimeout']||0x1e;this[_0xbc81('0xb')]=_0x50420a['dialCongestionMaxRetry'];this[_0xbc81('0xc')]=_0x50420a['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x50420a[_0xbc81('0xd')];this[_0xbc81('0xe')]=_0x50420a[_0xbc81('0xe')];this['dialNoAnswerMaxRetry']=_0x50420a['dialNoAnswerMaxRetry'];this[_0xbc81('0xf')]=_0x50420a[_0xbc81('0xf')];this['dialGlobalMaxRetry']=_0x50420a['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x50420a[_0xbc81('0x10')]||0x3;this[_0xbc81('0x11')]=_0x50420a[_0xbc81('0x11')]||0x96;this[_0xbc81('0x12')]=_0x50420a[_0xbc81('0x12')]||0x3;this['dialDropRetryFrequency']=_0x50420a[_0xbc81('0x13')]||0x96;this['dialAbandonedMaxRetry']=_0x50420a[_0xbc81('0x14')]||0x3;this[_0xbc81('0x15')]=_0x50420a[_0xbc81('0x15')]||0x96;this[_0xbc81('0x16')]=_0x50420a[_0xbc81('0x16')]||0x3;this[_0xbc81('0x17')]=_0x50420a[_0xbc81('0x17')]||0x96;this[_0xbc81('0x18')]=_0x50420a[_0xbc81('0x18')]||0x3;this['dialAgentRejectRetryFrequency']=_0x50420a[_0xbc81('0x19')]||0x96;this[_0xbc81('0x1a')]=_0x50420a[_0xbc81('0x1a')]||_0xbc81('0x1b');this[_0xbc81('0x1c')]=_0x50420a[_0xbc81('0x1c')]||undefined;this[_0xbc81('0x1d')]=_0x50420a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbc81('0x1e')]=_0x50420a[_0xbc81('0x1e')]||undefined;this[_0xbc81('0x1f')]=_0x50420a[_0xbc81('0x1f')]?_0x50420a[_0xbc81('0x1f')]:undefined;this[_0xbc81('0x20')]=_0x50420a[_0xbc81('0x20')]?_0x50420a[_0xbc81('0x20')]:undefined;this[_0xbc81('0x21')]=_0x50420a[_0xbc81('0x21')]?_0x50420a[_0xbc81('0x21')]:undefined;this[_0xbc81('0x22')]=_0x50420a['SquareProject']?_0x50420a['SquareProject']:undefined;this[_0xbc81('0x23')]=_0x50420a[_0xbc81('0x22')]?_0x50420a[_0xbc81('0x22')][_0xbc81('0x24')]:undefined;this['dialAMDActive']=_0x50420a[_0xbc81('0x25')]||![];this['dialAMDInitialSilence']=_0x50420a[_0xbc81('0x26')];this['dialAMDGreeting']=_0x50420a[_0xbc81('0x27')];this[_0xbc81('0x28')]=_0x50420a[_0xbc81('0x28')];this[_0xbc81('0x29')]=_0x50420a[_0xbc81('0x29')];this[_0xbc81('0x2a')]=_0x50420a[_0xbc81('0x2a')];this['dialAMDBetweenWordsSilence']=_0x50420a['dialAMDBetweenWordsSilence'];this[_0xbc81('0x2b')]=_0x50420a['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x50420a['dialAMDSilenceThreshold'];this[_0xbc81('0x2c')]=_0x50420a[_0xbc81('0x2c')];}module[_0xbc81('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ad71e9d..c371424 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 _0x65da=['starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports'];(function(_0x43bcfd,_0x6fedc0){var _0x2f17e9=function(_0x4f2b8d){while(--_0x4f2b8d){_0x43bcfd['push'](_0x43bcfd['shift']());}};_0x2f17e9(++_0x6fedc0);}(_0x65da,0x152));var _0xa65d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x65da[_0x68c979];return _0x4f0001;};'use strict';function Channel(){this[_0xa65d('0x0')]=null;this['channel']='';this[_0xa65d('0x1')]='';this[_0xa65d('0x2')]=0x0;this[_0xa65d('0x3')]='';this['connectedlinenum']=undefined;this[_0xa65d('0x4')]=undefined;this[_0xa65d('0x5')]=0x0;this[_0xa65d('0x6')]='';this[_0xa65d('0x7')]=0x0;this[_0xa65d('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xa65d('0x9')]=null;this[_0xa65d('0xa')]=null;this[_0xa65d('0xb')]=![];this[_0xa65d('0xc')]=![];this[_0xa65d('0xd')]='';this[_0xa65d('0xe')]='';this[_0xa65d('0xf')]=0x0;this['billableseconds']=0x0;this[_0xa65d('0x10')]=0x0;this[_0xa65d('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0xa65d('0x12')]=![];this[_0xa65d('0x13')]=null;this[_0xa65d('0x14')]=null;this[_0xa65d('0x15')]=[];this['transfercalleridnum']=undefined;this[_0xa65d('0x16')]=undefined;this[_0xa65d('0x17')]=undefined;this[_0xa65d('0x18')]=0x0;}module[_0xa65d('0x19')]=Channel; \ No newline at end of file +var _0xacf7=['accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x1644f2,_0x2884e8){var _0x1fcb31=function(_0x41773c){while(--_0x41773c){_0x1644f2['push'](_0x1644f2['shift']());}};_0x1fcb31(++_0x2884e8);}(_0xacf7,0x1bd));var _0x7acf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xacf7[_0xfae23b];return _0x200640;};'use strict';function Channel(){this[_0x7acf('0x0')]=null;this[_0x7acf('0x1')]='';this[_0x7acf('0x2')]='';this[_0x7acf('0x3')]=0x0;this[_0x7acf('0x4')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x7acf('0x5')]=0x0;this[_0x7acf('0x6')]='';this[_0x7acf('0x7')]=0x0;this[_0x7acf('0x8')]=0x0;this[_0x7acf('0x9')]=0x0;this[_0x7acf('0xa')]=![];this['answertime']=null;this[_0x7acf('0xb')]=null;this[_0x7acf('0xc')]=![];this[_0x7acf('0xd')]=![];this['lastapplication']='';this[_0x7acf('0xe')]='';this[_0x7acf('0xf')]=0x0;this[_0x7acf('0x10')]=0x0;this[_0x7acf('0x11')]=0x0;this[_0x7acf('0x12')]=null;this[_0x7acf('0x13')]=null;this[_0x7acf('0x14')]=null;this[_0x7acf('0x15')]=![];this[_0x7acf('0x16')]=null;this[_0x7acf('0x17')]=null;this[_0x7acf('0x18')]=[];this[_0x7acf('0x19')]=undefined;this[_0x7acf('0x1a')]=undefined;this[_0x7acf('0x1b')]=undefined;this[_0x7acf('0x1c')]=0x0;}module[_0x7acf('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9d4ab77..9435c47 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 _0x2873=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x363445,_0x2c64cb){var _0x26b290=function(_0x70ac37){while(--_0x70ac37){_0x363445['push'](_0x363445['shift']());}};_0x26b290(++_0x2c64cb);}(_0x2873,0x1a8));var _0x3287=function(_0x97c700,_0x1dc32b){_0x97c700=_0x97c700-0x0;var _0x480a38=_0x2873[_0x97c700];return _0x480a38;};'use strict';function DeskAccount(_0x2bcbf8){this['id']=_0x2bcbf8['id']||0x0;this['name']=_0x2bcbf8[_0x3287('0x0')]||'';this[_0x3287('0x1')]=_0x2bcbf8[_0x3287('0x1')]||'';this['remoteUri']=_0x2bcbf8[_0x3287('0x2')]||'';this[_0x3287('0x3')]=_0x2bcbf8[_0x3287('0x3')]||'';this[_0x3287('0x4')]=_0x2bcbf8['password']||'';this['consumerKey']=_0x2bcbf8[_0x3287('0x5')]||'';this[_0x3287('0x6')]=_0x2bcbf8[_0x3287('0x6')]||'';this[_0x3287('0x7')]=_0x2bcbf8[_0x3287('0x7')]||'';this['tokenSecret']=_0x2bcbf8[_0x3287('0x8')]||'';this['type']=_0x2bcbf8[_0x3287('0x9')]||'';this[_0x3287('0xa')]=_0x2bcbf8[_0x3287('0xa')]||'';this[_0x3287('0xb')]=_0x2bcbf8[_0x3287('0xb')]||{};}module[_0x3287('0xc')]=DeskAccount; \ No newline at end of file +var _0x97c8=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','exports','name','username'];(function(_0x49405d,_0x2d08bf){var _0x588320=function(_0x3523e4){while(--_0x3523e4){_0x49405d['push'](_0x49405d['shift']());}};_0x588320(++_0x2d08bf);}(_0x97c8,0xee));var _0x897c=function(_0x23c262,_0x74765a){_0x23c262=_0x23c262-0x0;var _0x9b913f=_0x97c8[_0x23c262];return _0x9b913f;};'use strict';function DeskAccount(_0x4f6977){this['id']=_0x4f6977['id']||0x0;this['name']=_0x4f6977[_0x897c('0x0')]||'';this['username']=_0x4f6977[_0x897c('0x1')]||'';this[_0x897c('0x2')]=_0x4f6977[_0x897c('0x2')]||'';this[_0x897c('0x3')]=_0x4f6977[_0x897c('0x3')]||'';this['password']=_0x4f6977[_0x897c('0x4')]||'';this[_0x897c('0x5')]=_0x4f6977[_0x897c('0x5')]||'';this[_0x897c('0x6')]=_0x4f6977['consumerSecret']||'';this[_0x897c('0x7')]=_0x4f6977[_0x897c('0x7')]||'';this['tokenSecret']=_0x4f6977[_0x897c('0x8')]||'';this[_0x897c('0x9')]=_0x4f6977['type']||'';this[_0x897c('0xa')]=_0x4f6977['serverUrl']||'';this['Configurations']=_0x4f6977['Configurations']||{};}module[_0x897c('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 25b2414..84f4492 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 _0x3373=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x3373,0x16d));var _0x3337=function(_0x2f0ed2,_0x115f0d){_0x2f0ed2=_0x2f0ed2-0x0;var _0x70ce5e=_0x3373[_0x2f0ed2];return _0x70ce5e;};'use strict';function Dynamics365Account(_0x337224){this['id']=_0x337224['id']||0x0;this['name']=_0x337224[_0x3337('0x0')]||'';this['username']=_0x337224[_0x3337('0x1')]||'';this[_0x3337('0x2')]=_0x337224[_0x3337('0x2')]||'';this[_0x3337('0x3')]=_0x337224[_0x3337('0x3')]||'';this['tenantId']=_0x337224[_0x3337('0x4')]||'';this['clientId']=_0x337224[_0x3337('0x5')]||'';this['clientSecret']=_0x337224[_0x3337('0x6')]||{};this[_0x3337('0x7')]=_0x337224['serverUrl']||'';this['modernAuthentication']=_0x337224['modernAuthentication']||![];this[_0x3337('0x8')]=_0x337224[_0x3337('0x8')]||{};this[_0x3337('0x9')]=_0x337224[_0x3337('0x9')]||{};}module[_0x3337('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xc228=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x24e15c,_0xda29bf){var _0x79e46d=function(_0x5a3401){while(--_0x5a3401){_0x24e15c['push'](_0x24e15c['shift']());}};_0x79e46d(++_0xda29bf);}(_0xc228,0x13e));var _0x8c22=function(_0x35ab20,_0x3e6c56){_0x35ab20=_0x35ab20-0x0;var _0xf62940=_0xc228[_0x35ab20];return _0xf62940;};'use strict';function Dynamics365Account(_0x165dd1){this['id']=_0x165dd1['id']||0x0;this[_0x8c22('0x0')]=_0x165dd1[_0x8c22('0x0')]||'';this[_0x8c22('0x1')]=_0x165dd1['username']||'';this[_0x8c22('0x2')]=_0x165dd1[_0x8c22('0x2')]||'';this[_0x8c22('0x3')]=_0x165dd1[_0x8c22('0x3')]||'';this[_0x8c22('0x4')]=_0x165dd1[_0x8c22('0x4')]||'';this[_0x8c22('0x5')]=_0x165dd1[_0x8c22('0x5')]||'';this[_0x8c22('0x6')]=_0x165dd1[_0x8c22('0x6')]||{};this['serverUrl']=_0x165dd1[_0x8c22('0x7')]||'';this[_0x8c22('0x8')]=_0x165dd1['modernAuthentication']||![];this[_0x8c22('0x9')]=_0x165dd1['Configurations']||{};this[_0x8c22('0xa')]=_0x165dd1[_0x8c22('0xa')]||{};}module[_0x8c22('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 2cc34bf..6620c65 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 _0xe15f=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe15f,0xea));var _0xfe15=function(_0x5db2ab,_0x58d691){_0x5db2ab=_0x5db2ab-0x0;var _0x214938=_0xe15f[_0x5db2ab];return _0x214938;};'use strict';function FaxAccount(_0x582681){this['id']=_0x582681['id']||0x0;this[_0xfe15('0x0')]=_0x582681[_0xfe15('0x0')]||'';this[_0xfe15('0x1')]=_0x582681[_0xfe15('0x1')];this[_0xfe15('0x2')]=_0x582681['ecm'];this[_0xfe15('0x3')]=_0x582681[_0xfe15('0x3')];this['localstationid']=_0x582681[_0xfe15('0x4')];this[_0xfe15('0x5')]=_0x582681[_0xfe15('0x5')]||0x960;this['maxrate']=_0x582681[_0xfe15('0x6')]||0x3840;this[_0xfe15('0x7')]=_0x582681[_0xfe15('0x7')]||_0xfe15('0x8');this[_0xfe15('0x9')]=_0x582681[_0xfe15('0x9')]||'no';this[_0xfe15('0xa')]=_0x582681['faxdetect']||'no';this[_0xfe15('0xb')]=_0x582681[_0xfe15('0xb')]||0x1388;this[_0xfe15('0xc')]=_0x582681[_0xfe15('0xc')]||_0xfe15('0xd');this['Trunk']=_0x582681[_0xfe15('0xe')]?_0x582681[_0xfe15('0xe')]:undefined;this['ListId']=_0x582681[_0xfe15('0xf')];this[_0xfe15('0x10')]=_0x582681['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x0588=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','ecm','headerinfo','localstationid','modem','v17,v27,v29','gateway'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0588,0x111));var _0x8058=function(_0x2ab20d,_0x1df2da){_0x2ab20d=_0x2ab20d-0x0;var _0x38e66f=_0x0588[_0x2ab20d];return _0x38e66f;};'use strict';function FaxAccount(_0x3258d7){this['id']=_0x3258d7['id']||0x0;this[_0x8058('0x0')]=_0x3258d7[_0x8058('0x0')]||'';this['description']=_0x3258d7['description'];this[_0x8058('0x1')]=_0x3258d7['ecm'];this[_0x8058('0x2')]=_0x3258d7['headerinfo'];this['localstationid']=_0x3258d7[_0x8058('0x3')];this['minrate']=_0x3258d7['minrate']||0x960;this['maxrate']=_0x3258d7['maxrate']||0x3840;this[_0x8058('0x4')]=_0x3258d7['modem']||_0x8058('0x5');this['gateway']=_0x3258d7[_0x8058('0x6')]||'no';this[_0x8058('0x7')]=_0x3258d7[_0x8058('0x7')]||'no';this[_0x8058('0x8')]=_0x3258d7[_0x8058('0x8')]||0x1388;this[_0x8058('0x9')]=_0x3258d7['tech']||_0x8058('0xa');this[_0x8058('0xb')]=_0x3258d7[_0x8058('0xb')]?_0x3258d7[_0x8058('0xb')]:undefined;this['ListId']=_0x3258d7[_0x8058('0xc')];this[_0x8058('0xd')]=_0x3258d7[_0x8058('0xd')];}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 742c524..729d1de 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 _0x8273=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x8273,0x1ef));var _0x3827=function(_0x438e53,_0x507238){_0x438e53=_0x438e53-0x0;var _0x46a255=_0x8273[_0x438e53];return _0x46a255;};'use strict';function FreshdeskAccount(_0x4bd020){this['id']=_0x4bd020['id']||0x0;this['name']=_0x4bd020[_0x3827('0x0')]||'';this[_0x3827('0x1')]=_0x4bd020[_0x3827('0x1')]||'';this[_0x3827('0x2')]=_0x4bd020[_0x3827('0x3')]||'';this['remoteUri']=_0x4bd020[_0x3827('0x4')]||'';this[_0x3827('0x5')]=_0x4bd020[_0x3827('0x5')]||'';this[_0x3827('0x6')]=_0x4bd020[_0x3827('0x6')]||{};}module[_0x3827('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x1a22=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x335a25,_0x56b388){var _0x5ae9da=function(_0x20c13b){while(--_0x20c13b){_0x335a25['push'](_0x335a25['shift']());}};_0x5ae9da(++_0x56b388);}(_0x1a22,0x11a));var _0x21a2=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0x1a22[_0x4bcbc2];return _0xe5b888;};'use strict';function FreshdeskAccount(_0x282144){this['id']=_0x282144['id']||0x0;this['name']=_0x282144[_0x21a2('0x0')]||'';this[_0x21a2('0x1')]=_0x282144[_0x21a2('0x1')]||'';this[_0x21a2('0x2')]=_0x282144[_0x21a2('0x3')]||'';this[_0x21a2('0x4')]=_0x282144[_0x21a2('0x4')]||'';this[_0x21a2('0x5')]=_0x282144['serverUrl']||'';this[_0x21a2('0x6')]=_0x282144[_0x21a2('0x6')]||{};}module[_0x21a2('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 d1dc2be..6bea174 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 _0xb0df=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x31ff45,_0x24119b){var _0x440b72=function(_0x372f2b){while(--_0x372f2b){_0x31ff45['push'](_0x31ff45['shift']());}};_0x440b72(++_0x24119b);}(_0xb0df,0x85));var _0xfb0d=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xb0df[_0x214266];return _0x568f75;};'use strict';function FreshsalesAccount(_0x26aff2){this['id']=_0x26aff2['id']||0x0;this[_0xfb0d('0x0')]=_0x26aff2[_0xfb0d('0x0')]||'';this[_0xfb0d('0x1')]=_0x26aff2[_0xfb0d('0x1')]||'';this[_0xfb0d('0x2')]=_0x26aff2[_0xfb0d('0x3')]||'';this[_0xfb0d('0x4')]=_0x26aff2[_0xfb0d('0x4')]||'';this[_0xfb0d('0x5')]=_0x26aff2['serverUrl']||'';this[_0xfb0d('0x6')]=_0x26aff2[_0xfb0d('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x556b=['serverUrl','name','username','token','remoteUri'];(function(_0x467eee,_0x416c33){var _0x553ebe=function(_0x387103){while(--_0x387103){_0x467eee['push'](_0x467eee['shift']());}};_0x553ebe(++_0x416c33);}(_0x556b,0x1d7));var _0xb556=function(_0x40b005,_0x292fb9){_0x40b005=_0x40b005-0x0;var _0x349a74=_0x556b[_0x40b005];return _0x349a74;};'use strict';function FreshsalesAccount(_0x5eb61d){this['id']=_0x5eb61d['id']||0x0;this[_0xb556('0x0')]=_0x5eb61d[_0xb556('0x0')]||'';this[_0xb556('0x1')]=_0x5eb61d[_0xb556('0x1')]||'';this['apiKey']=_0x5eb61d[_0xb556('0x2')]||'';this[_0xb556('0x3')]=_0x5eb61d[_0xb556('0x3')]||'';this[_0xb556('0x4')]=_0x5eb61d[_0xb556('0x4')]||'';this['Configurations']=_0x5eb61d['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index ed8dae2..a31f7cc 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 _0x679e=['connectedlinename','context','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','type','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum'];(function(_0x3072d9,_0x4c7cd8){var _0x56372a=function(_0x449577){while(--_0x449577){_0x3072d9['push'](_0x3072d9['shift']());}};_0x56372a(++_0x4c7cd8);}(_0x679e,0xe1));var _0xe679=function(_0x5366d7,_0x3125a3){_0x5366d7=_0x5366d7-0x0;var _0x57b143=_0x679e[_0x5366d7];return _0x57b143;};'use strict';function QueueReport(){this[_0xe679('0x0')]='inbound';this['uniqueid']='';this[_0xe679('0x1')]='';this[_0xe679('0x2')]='';this[_0xe679('0x3')]='';this[_0xe679('0x4')]=null;this[_0xe679('0x5')]=null;this[_0xe679('0x6')]=0x1;this[_0xe679('0x7')]=0x1;this[_0xe679('0x8')]=![];this[_0xe679('0x9')]=null;this[_0xe679('0xa')]=![];this[_0xe679('0xb')]=null;this['queuecallerexit']=![];this[_0xe679('0xc')]=null;this['originalposition']=0x1;this[_0xe679('0xd')]='';this[_0xe679('0xe')]='';this[_0xe679('0xf')]='';this['accountcode']='';this[_0xe679('0x10')]='';this['exten']='';this['priority']='';this[_0xe679('0x11')]=0x0;this[_0xe679('0x12')]=![];this[_0xe679('0x13')]='';this[_0xe679('0x14')]=_0xe679('0x15');this[_0xe679('0x16')]=null;this[_0xe679('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x8e38=['accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x13edbd,_0x8a6ce1){var _0x26a90c=function(_0x4a9bf5){while(--_0x4a9bf5){_0x13edbd['push'](_0x13edbd['shift']());}};_0x26a90c(++_0x8a6ce1);}(_0x8e38,0x185));var _0x88e3=function(_0x589abb,_0x4848ad){_0x589abb=_0x589abb-0x0;var _0x33d5f8=_0x8e38[_0x589abb];return _0x33d5f8;};'use strict';function QueueReport(){this['type']=_0x88e3('0x0');this[_0x88e3('0x1')]='';this[_0x88e3('0x2')]='';this[_0x88e3('0x3')]='';this[_0x88e3('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x88e3('0x5')]=0x1;this[_0x88e3('0x6')]=0x1;this[_0x88e3('0x7')]=![];this[_0x88e3('0x8')]=null;this[_0x88e3('0x9')]=![];this[_0x88e3('0xa')]=null;this[_0x88e3('0xb')]=![];this[_0x88e3('0xc')]=null;this[_0x88e3('0xd')]=0x1;this[_0x88e3('0xe')]='';this[_0x88e3('0xf')]='';this[_0x88e3('0x10')]='';this[_0x88e3('0x11')]='';this[_0x88e3('0x12')]='';this['exten']='';this[_0x88e3('0x13')]='';this[_0x88e3('0x14')]=0x0;this[_0x88e3('0x15')]=![];this[_0x88e3('0x16')]='';this[_0x88e3('0x17')]=_0x88e3('0x18');this[_0x88e3('0x19')]=null;this[_0x88e3('0x1a')]=0x0;this[_0x88e3('0x1b')]={};}module[_0x88e3('0x1c')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b8ae94b..fe67f6e 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 _0x6903=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x6903,0x1c5));var _0x3690=function(_0x61118f,_0xd26530){_0x61118f=_0x61118f-0x0;var _0x4e9411=_0x6903[_0x61118f];return _0x4e9411;};'use strict';function SalesforceAccount(_0x422da){this['id']=_0x422da['id']||0x0;this[_0x3690('0x0')]=_0x422da[_0x3690('0x0')]||'';this[_0x3690('0x1')]=_0x422da[_0x3690('0x1')]||'';this[_0x3690('0x2')]=_0x422da[_0x3690('0x2')]||'';this[_0x3690('0x3')]=_0x422da[_0x3690('0x3')]||'';this[_0x3690('0x4')]=_0x422da['clientId']||'';this[_0x3690('0x5')]=_0x422da[_0x3690('0x5')]||'';this[_0x3690('0x6')]=_0x422da[_0x3690('0x6')]||'';this['type']=_0x422da[_0x3690('0x7')]||_0x3690('0x8');this['serverUrl']=_0x422da[_0x3690('0x9')]||'';this[_0x3690('0xa')]=_0x422da[_0x3690('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xbe60=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','name','username'];(function(_0x279fc8,_0x1ba427){var _0x4521a5=function(_0xbd2f4c){while(--_0xbd2f4c){_0x279fc8['push'](_0x279fc8['shift']());}};_0x4521a5(++_0x1ba427);}(_0xbe60,0x1d4));var _0x0be6=function(_0x352d99,_0x520d3d){_0x352d99=_0x352d99-0x0;var _0x3a28c5=_0xbe60[_0x352d99];return _0x3a28c5;};'use strict';function SalesforceAccount(_0x22c0e1){this['id']=_0x22c0e1['id']||0x0;this[_0x0be6('0x0')]=_0x22c0e1[_0x0be6('0x0')]||'';this[_0x0be6('0x1')]=_0x22c0e1[_0x0be6('0x1')]||'';this['remoteUri']=_0x22c0e1[_0x0be6('0x2')]||'';this[_0x0be6('0x3')]=_0x22c0e1[_0x0be6('0x3')]||'';this[_0x0be6('0x4')]=_0x22c0e1[_0x0be6('0x4')]||'';this[_0x0be6('0x5')]=_0x22c0e1[_0x0be6('0x5')]||'';this[_0x0be6('0x6')]=_0x22c0e1[_0x0be6('0x6')]||'';this[_0x0be6('0x7')]=_0x22c0e1[_0x0be6('0x7')]||'integrationTab';this[_0x0be6('0x8')]=_0x22c0e1[_0x0be6('0x8')]||'';this[_0x0be6('0x9')]=_0x22c0e1[_0x0be6('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d0a8c17..233c5ee 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 _0x0006=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x2fc44e,_0x26e811){var _0x972de6=function(_0x3e721c){while(--_0x3e721c){_0x2fc44e['push'](_0x2fc44e['shift']());}};_0x972de6(++_0x26e811);}(_0x0006,0x1c3));var _0x6000=function(_0x232b30,_0x5be386){_0x232b30=_0x232b30-0x0;var _0x209c1b=_0x0006[_0x232b30];return _0x209c1b;};'use strict';function ServicenowAccount(_0x119f5c){this['id']=_0x119f5c['id']||0x0;this[_0x6000('0x0')]=_0x119f5c[_0x6000('0x0')]||'';this['username']=_0x119f5c[_0x6000('0x1')]||'';this[_0x6000('0x2')]=_0x119f5c['password']||'';this[_0x6000('0x3')]=_0x119f5c[_0x6000('0x3')]||'';this[_0x6000('0x4')]=_0x119f5c[_0x6000('0x4')]||'';this[_0x6000('0x5')]=_0x119f5c['Configurations']||{};}module[_0x6000('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xae4b=['serverUrl','Configurations','exports','name','password','remoteUri'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xae4b,0xb7));var _0xbae4=function(_0xbbda5,_0x5b0707){_0xbbda5=_0xbbda5-0x0;var _0x33c4fd=_0xae4b[_0xbbda5];return _0x33c4fd;};'use strict';function ServicenowAccount(_0x37c04f){this['id']=_0x37c04f['id']||0x0;this[_0xbae4('0x0')]=_0x37c04f['name']||'';this['username']=_0x37c04f['username']||'';this[_0xbae4('0x1')]=_0x37c04f[_0xbae4('0x1')]||'';this[_0xbae4('0x2')]=_0x37c04f[_0xbae4('0x2')]||'';this[_0xbae4('0x3')]=_0x37c04f[_0xbae4('0x3')]||'';this[_0xbae4('0x4')]=_0x37c04f[_0xbae4('0x4')]||{};}module[_0xbae4('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index db20ead..5e39b53 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 _0xdc00=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2da545,_0x54ed0d){var _0x21b5ed=function(_0x1e153f){while(--_0x1e153f){_0x2da545['push'](_0x2da545['shift']());}};_0x21b5ed(++_0x54ed0d);}(_0xdc00,0x120));var _0x0dc0=function(_0x371288,_0x472037){_0x371288=_0x371288-0x0;var _0x556c83=_0xdc00[_0x371288];return _0x556c83;};'use strict';function SugarcrmAccount(_0xe852da){this['id']=_0xe852da['id']||0x0;this[_0x0dc0('0x0')]=_0xe852da['name']||'';this[_0x0dc0('0x1')]=_0xe852da['username']||'';this[_0x0dc0('0x2')]=_0xe852da[_0x0dc0('0x2')]||'';this[_0x0dc0('0x3')]=_0xe852da[_0x0dc0('0x3')]||'';this['serverUrl']=_0xe852da[_0x0dc0('0x4')]||'';this[_0x0dc0('0x5')]=_0xe852da[_0x0dc0('0x5')]||{};}module[_0x0dc0('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xa95d=['password','serverUrl','Configurations','name','username'];(function(_0x3e8627,_0x1b8b14){var _0x7fa50d=function(_0x25dc26){while(--_0x25dc26){_0x3e8627['push'](_0x3e8627['shift']());}};_0x7fa50d(++_0x1b8b14);}(_0xa95d,0x134));var _0xda95=function(_0x11110e,_0x231c06){_0x11110e=_0x11110e-0x0;var _0x53e0ad=_0xa95d[_0x11110e];return _0x53e0ad;};'use strict';function SugarcrmAccount(_0x566133){this['id']=_0x566133['id']||0x0;this[_0xda95('0x0')]=_0x566133[_0xda95('0x0')]||'';this[_0xda95('0x1')]=_0x566133[_0xda95('0x1')]||'';this[_0xda95('0x2')]=_0x566133['password']||'';this['remoteUri']=_0x566133['remoteUri']||'';this[_0xda95('0x3')]=_0x566133['serverUrl']||'';this['Configurations']=_0x566133[_0xda95('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 26ec9ea..30f26a0 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 _0x78f5=['status','address','name','accountcode','state','unknown'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x78f5,0xbc));var _0x578f=function(_0x22a27c,_0x1aac06){_0x22a27c=_0x22a27c-0x0;var _0x9ecf55=_0x78f5[_0x22a27c];return _0x9ecf55;};'use strict';function Telephone(_0x39682f){this['id']=_0x39682f['id']||0x0;this[_0x578f('0x0')]=_0x39682f[_0x578f('0x0')]||'';this[_0x578f('0x1')]=_0x39682f[_0x578f('0x1')]||'';this[_0x578f('0x2')]=_0x578f('0x3');this['stateTime']=0x0;this[_0x578f('0x4')]=_0x578f('0x3');this[_0x578f('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x720e=['status','unknown','address','exports','name','state','stateTime'];(function(_0x2fefdc,_0x8160c9){var _0xf3823a=function(_0x118d21){while(--_0x118d21){_0x2fefdc['push'](_0x2fefdc['shift']());}};_0xf3823a(++_0x8160c9);}(_0x720e,0x1cb));var _0xe720=function(_0x138975,_0x319d77){_0x138975=_0x138975-0x0;var _0x2ff39a=_0x720e[_0x138975];return _0x2ff39a;};'use strict';function Telephone(_0x25fa84){this['id']=_0x25fa84['id']||0x0;this[_0xe720('0x0')]=_0x25fa84[_0xe720('0x0')]||'';this['accountcode']=_0x25fa84['accountcode']||'';this[_0xe720('0x1')]='unknown';this[_0xe720('0x2')]=0x0;this[_0xe720('0x3')]=_0xe720('0x4');this[_0xe720('0x5')]='';}module[_0xe720('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 261e479..cb7fcae 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(_0x186383,_0x2cbcb7){var _0x2db811=function(_0x472874){while(--_0x472874){_0x186383['push'](_0x186383['shift']());}};_0x2db811(++_0x2cbcb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x1b208b,_0x4aa391){var _0x31b6cf=function(_0x24d18d){while(--_0x24d18d){_0x1b208b['push'](_0x1b208b['shift']());}};_0x31b6cf(++_0x4aa391);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 5b368f3..caf3069 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x568e7f,_0x39a8e1){var _0xbdeb52=function(_0x142021){while(--_0x142021){_0x568e7f['push'](_0x568e7f['shift']());}};_0xbdeb52(++_0x39a8e1);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c9fcf,_0x4f639f){_0x3c9fcf=_0x3c9fcf-0x0;var _0x26d6a5=_0xb10b[_0x3c9fcf];return _0x26d6a5;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6c659b7..31a29ed 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 _0x285d=['address','defaultuser','active','name','state','unknown','registry','split','host','domain','domainport','registrationtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x285d,0x1b2));var _0xd285=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x285d[_0x134c2e];return _0x2825db;};'use strict';function Trunk(_0x42033e){this['id']=_0x42033e['id']||0x0;this[_0xd285('0x0')]=_0x42033e[_0xd285('0x0')]||![];this[_0xd285('0x1')]=_0x42033e[_0xd285('0x1')]||'';this[_0xd285('0x2')]=_0xd285('0x3');this['stateTime']=0x0;this['status']=_0xd285('0x3');this[_0xd285('0x4')]=_0x42033e[_0xd285('0x4')]&&_0x42033e[_0xd285('0x4')]['indexOf'](':')?_0x42033e[_0xd285('0x4')][_0xd285('0x5')](':')[0x0]:'';this[_0xd285('0x6')]='';this['port']='';this[_0xd285('0x7')]='';this[_0xd285('0x8')]='';this['refresh']='';this['stateRegistry']=_0xd285('0x3');this[_0xd285('0x9')]='';this[_0xd285('0xa')]='';this[_0xd285('0xb')]=_0x42033e[_0xd285('0xb')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x807e=['registry','split','host','port','domainport','refresh','address','defaultuser','exports','active','name','unknown','stateTime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x807e,0x182));var _0xe807=function(_0x4e1274,_0x2446ca){_0x4e1274=_0x4e1274-0x0;var _0x4b2caa=_0x807e[_0x4e1274];return _0x4b2caa;};'use strict';function Trunk(_0x5a869f){this['id']=_0x5a869f['id']||0x0;this[_0xe807('0x0')]=_0x5a869f[_0xe807('0x0')]||![];this[_0xe807('0x1')]=_0x5a869f['name']||'';this['state']=_0xe807('0x2');this[_0xe807('0x3')]=0x0;this['status']='unknown';this[_0xe807('0x4')]=_0x5a869f[_0xe807('0x4')]&&_0x5a869f[_0xe807('0x4')]['indexOf'](':')?_0x5a869f[_0xe807('0x4')][_0xe807('0x5')](':')[0x0]:'';this[_0xe807('0x6')]='';this[_0xe807('0x7')]='';this['domain']='';this[_0xe807('0x8')]='';this[_0xe807('0x9')]='';this['stateRegistry']=_0xe807('0x2');this['registrationtime']='';this[_0xe807('0xa')]='';this[_0xe807('0xb')]=_0x5a869f[_0xe807('0xb')]||'';}module[_0xe807('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c2ee8f3..77d0bdf 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 _0x13e6=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x13e6,0xce));var _0x613e=function(_0x1454cb,_0x3f8202){_0x1454cb=_0x1454cb-0x0;var _0x18f630=_0x13e6[_0x1454cb];return _0x18f630;};'use strict';function voiceExtension(_0x31b475){this['id']=_0x31b475['id']||0x0;this[_0x613e('0x0')]=_0x31b475[_0x613e('0x0')]||'';this[_0x613e('0x1')]=_0x31b475[_0x613e('0x1')]||_0x613e('0x2');this[_0x613e('0x3')]=_0x31b475[_0x613e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x6d13=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x242499,_0x463338){var _0x5e65d6=function(_0x64e3f0){while(--_0x64e3f0){_0x242499['push'](_0x242499['shift']());}};_0x5e65d6(++_0x463338);}(_0x6d13,0xd7));var _0x36d1=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x6d13[_0x4fbb15];return _0x436338;};'use strict';function voiceExtension(_0x27b40e){this['id']=_0x27b40e['id']||0x0;this[_0x36d1('0x0')]=_0x27b40e[_0x36d1('0x0')]||'';this[_0x36d1('0x1')]=_0x27b40e[_0x36d1('0x1')]||_0x36d1('0x2');this[_0x36d1('0x3')]=_0x27b40e[_0x36d1('0x3')]||![];}module[_0x36d1('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index bf4ac32..6c98be3 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 _0x5785=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumBillable','unmanaged','abandoned','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay'];(function(_0x345f64,_0x1c2839){var _0x392c7a=function(_0x12a9ef){while(--_0x12a9ef){_0x345f64['push'](_0x345f64['shift']());}};_0x392c7a(++_0x1c2839);}(_0x5785,0x119));var _0x5578=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x5785[_0x576170];return _0x397c70;};'use strict';var monitorFormat={'wav':_0x5578('0x0'),'wav49':_0x5578('0x1'),'gsm':_0x5578('0x2')};var strategy={'fewestcalls':_0x5578('0x3'),'leastrecent':_0x5578('0x4'),'linear':'linear','random':_0x5578('0x5'),'ringall':_0x5578('0x6'),'rr':_0x5578('0x7'),'rrmemory':_0x5578('0x8'),'rrordered':_0x5578('0x9'),'wrandom':_0x5578('0xa')};function VoiceQueue(_0x35a1f4){this['id']=_0x35a1f4['id']||0x0;this[_0x5578('0xb')]=_0x35a1f4[_0x5578('0xb')]||'';this[_0x5578('0xc')]=_0x35a1f4['monitor_format']||'';this[_0x5578('0xd')]=_0x35a1f4[_0x5578('0xd')]||_0x5578('0xe');this['waiting']=0x0;this[_0x5578('0xf')]=0x0;this['answered']=0x0;this[_0x5578('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x5578('0x11')]=0x0;this[_0x5578('0x12')]=0x0;this[_0x5578('0x13')]=0x0;this['available']=0x0;this['busy']=0x0;this[_0x5578('0x14')]=0x0;this[_0x5578('0x15')]=0x0;this[_0x5578('0x16')]=0x0;this[_0x5578('0x17')]=0x0;this[_0x5578('0x18')]=0x0;this[_0x5578('0x19')]=0x0;this[_0x5578('0x1a')]=0x0;this[_0x5578('0x1b')]=0x0;this[_0x5578('0x1c')]=0x0;this[_0x5578('0x1d')]=0x0;this['unknown']=0x0;this[_0x5578('0x1e')]=_0x35a1f4[_0x5578('0x1e')]||![];this[_0x5578('0x1f')]=_0x35a1f4[_0x5578('0x1f')]||0xa;this[_0x5578('0x20')]=_0x35a1f4[_0x5578('0x20')]||'no';this[_0x5578('0x21')]=!![];this[_0x5578('0x22')]='';this[_0x5578('0x23')]='';this[_0x5578('0x24')]=0x0;this['temp']=0x0;this[_0x5578('0x25')]=_0x35a1f4[_0x5578('0x25')]||null;this['dialGlobalInterval']=_0x35a1f4['dialGlobalInterval']?_0x35a1f4[_0x5578('0x26')]:null;this[_0x5578('0x27')]=_0x35a1f4['dialActive'];this[_0x5578('0x28')]=_0x35a1f4[_0x5578('0x28')]||_0x5578('0x29');this[_0x5578('0x2a')]=_0x35a1f4[_0x5578('0x2a')]||0x0;this[_0x5578('0x2b')]=_0x35a1f4[_0x5578('0x2b')]||0x0;this[_0x5578('0x2c')]=_0x35a1f4[_0x5578('0x2c')]||0x1;this[_0x5578('0x2d')]=_0x35a1f4[_0x5578('0x2d')]||_0x5578('0x2e');this[_0x5578('0x2f')]=_0x35a1f4[_0x5578('0x2f')]||0.03;this['dialPredictiveInterval']=_0x35a1f4[_0x5578('0x30')]||0x258;this['dialOriginateCallerIdName']=_0x35a1f4[_0x5578('0x31')]||_0x5578('0x32');this[_0x5578('0x33')]=_0x35a1f4[_0x5578('0x33')]||_0x5578('0x32');this[_0x5578('0x34')]=_0x35a1f4['dialOriginateTimeout']||0x1e;this[_0x5578('0x35')]=_0x35a1f4['dialQueueOptions']||'tTxX';this[_0x5578('0x36')]=_0x35a1f4['dialQueueTimeout']||0x3;this[_0x5578('0x37')]=_0x35a1f4[_0x5578('0x37')]||undefined;this[_0x5578('0x38')]=_0x35a1f4['dialCongestionMaxRetry']||0x3;this[_0x5578('0x39')]=_0x35a1f4[_0x5578('0x39')]||0x96;this['dialBusyMaxRetry']=_0x35a1f4['dialBusyMaxRetry']||0x3;this[_0x5578('0x3a')]=_0x35a1f4[_0x5578('0x3a')]||0x96;this[_0x5578('0x3b')]=_0x35a1f4[_0x5578('0x3b')]||0x3;this[_0x5578('0x3c')]=_0x35a1f4['dialNoAnswerRetryFrequency']||0x96;this[_0x5578('0x3d')]=_0x35a1f4[_0x5578('0x3d')]||0x3;this[_0x5578('0x3e')]=_0x35a1f4[_0x5578('0x3e')]||0x96;this[_0x5578('0x3f')]=_0x35a1f4[_0x5578('0x3f')]||0x3;this[_0x5578('0x40')]=_0x35a1f4[_0x5578('0x40')]||0x96;this['dialAbandonedMaxRetry']=_0x35a1f4['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x35a1f4[_0x5578('0x41')]||0x96;this['dialMachineMaxRetry']=_0x35a1f4['dialMachineMaxRetry']||0x3;this[_0x5578('0x42')]=_0x35a1f4['dialMachineRetryFrequency']||0x96;this[_0x5578('0x43')]=_0x35a1f4[_0x5578('0x43')]||0x3;this[_0x5578('0x44')]=_0x35a1f4[_0x5578('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x35a1f4[_0x5578('0x45')]||0x3;this[_0x5578('0x46')]=_0x35a1f4[_0x5578('0x46')]||0x4;this[_0x5578('0x47')]=_0x35a1f4['Trunk']?_0x35a1f4[_0x5578('0x47')]:undefined;this[_0x5578('0x48')]=_0x35a1f4[_0x5578('0x48')]?_0x35a1f4['TrunkBackup']:undefined;this[_0x5578('0x49')]=_0x35a1f4[_0x5578('0x49')]||undefined;this['Interval']=_0x35a1f4[_0x5578('0x4a')]?_0x35a1f4['Interval']:undefined;this[_0x5578('0x4b')]=_0x35a1f4[_0x5578('0x4b')]||'DESC';this[_0x5578('0x4c')]=_0x35a1f4[_0x5578('0x4c')]||undefined;this[_0x5578('0x4d')]=_0x35a1f4[_0x5578('0x4d')]||undefined;this['strategy']=strategy[_0x35a1f4[_0x5578('0x4e')]];this[_0x5578('0x4f')]=!![];this[_0x5578('0x50')]=_0x35a1f4[_0x5578('0x50')]||![];this['dialAMDInitialSilence']=_0x35a1f4[_0x5578('0x51')];this[_0x5578('0x52')]=_0x35a1f4[_0x5578('0x52')];this['dialAMDAfterGreetingSilence']=_0x35a1f4[_0x5578('0x53')];this['dialAMDTotalAnalysisTime']=_0x35a1f4['dialAMDTotalAnalysisTime'];this[_0x5578('0x54')]=_0x35a1f4[_0x5578('0x54')];this[_0x5578('0x55')]=_0x35a1f4['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x35a1f4[_0x5578('0x56')];this[_0x5578('0x57')]=_0x35a1f4[_0x5578('0x57')];this[_0x5578('0x58')]=_0x35a1f4[_0x5578('0x58')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x5578('0x59')]=_0x35a1f4['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x5578('0x5a')]=0x0;this[_0x5578('0x5b')]=0x0;this[_0x5578('0x5c')]=0x0;this[_0x5578('0x5d')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x5578('0x5e')]=0x0;this[_0x5578('0x5f')]=0x0;this[_0x5578('0x60')]=0x0;this[_0x5578('0x61')]=0x0;this[_0x5578('0x62')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5578('0x63')]=0x0;this[_0x5578('0x64')]=0x0;this['startProgressive']=undefined;this[_0x5578('0x65')]=undefined;this[_0x5578('0x66')]=undefined;this[_0x5578('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x5578('0x68')]=0x0;this[_0x5578('0x69')]=0x0;this[_0x5578('0x6a')]=0x0;this[_0x5578('0x6b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5578('0x6c')]=0x0;this[_0x5578('0x6d')]=0x0;this[_0x5578('0x6e')]=_0x35a1f4['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x35a1f4[_0x5578('0x6f')]||0xa;this[_0x5578('0x70')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x5578('0x71')]=0x1;this[_0x5578('0x72')]=0x0;this[_0x5578('0x73')]=0x0;this[_0x5578('0x74')]=0x0;this[_0x5578('0x75')]=0x0;this[_0x5578('0x76')]=_0x35a1f4[_0x5578('0x76')]||0x1e;this['dialRecallInQueue']=_0x35a1f4['dialRecallInQueue']||![];this[_0x5578('0x77')]=!!_0x35a1f4[_0x5578('0x77')]||![];this['dialPreviewRecallmeReminder']=!!_0x35a1f4['dialPreviewRecallmeReminder']||![];this[_0x5578('0x78')]=_0x35a1f4[_0x5578('0x78')]||undefined;this[_0x5578('0x79')]=_0x35a1f4[_0x5578('0x79')]||![];this[_0x5578('0x7a')]=_0x35a1f4[_0x5578('0x7a')]||![];this['monitor_format']=monitorFormat[_0x35a1f4['monitor_format']]?monitorFormat[_0x35a1f4[_0x5578('0xc')]]:undefined;this[_0x5578('0x7b')]=_0x35a1f4[_0x5578('0x7b')]||![];this[_0x5578('0x7c')]=_0x35a1f4[_0x5578('0x7c')]?_0x35a1f4[_0x5578('0x7c')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x5578('0x7d')]=VoiceQueue; \ No newline at end of file +var _0x20b6=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','paused','ringing','talking','unavailable','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x20b6,0x1ab));var _0x620b=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x20b6[_0xec034];return _0x2c5a19;};'use strict';var monitorFormat={'wav':_0x620b('0x0'),'wav49':_0x620b('0x1'),'gsm':_0x620b('0x2')};var strategy={'fewestcalls':_0x620b('0x3'),'leastrecent':_0x620b('0x4'),'linear':'linear','random':_0x620b('0x5'),'ringall':'ringall','rr':_0x620b('0x6'),'rrmemory':'rrmemory','rrordered':_0x620b('0x7'),'wrandom':_0x620b('0x8')};function VoiceQueue(_0x57dfd4){this['id']=_0x57dfd4['id']||0x0;this[_0x620b('0x9')]=_0x57dfd4[_0x620b('0x9')]||'';this[_0x620b('0xa')]=_0x57dfd4[_0x620b('0xa')]||'';this[_0x620b('0xb')]=_0x57dfd4[_0x620b('0xb')]||_0x620b('0xc');this[_0x620b('0xd')]=0x0;this[_0x620b('0xe')]=0x0;this[_0x620b('0xf')]=0x0;this[_0x620b('0x10')]=0x0;this[_0x620b('0x11')]=0x0;this[_0x620b('0x12')]=0x0;this[_0x620b('0x13')]=0x0;this[_0x620b('0x14')]=0x0;this[_0x620b('0x15')]=0x0;this[_0x620b('0x16')]=0x0;this['inUse']=0x0;this[_0x620b('0x17')]=0x0;this[_0x620b('0x18')]=0x0;this[_0x620b('0x19')]=0x0;this['onHold']=0x0;this[_0x620b('0x1a')]=0x0;this[_0x620b('0x1b')]=0x0;this['ringInUse']=0x0;this[_0x620b('0x1c')]=0x0;this[_0x620b('0x1d')]=0x0;this['unknown']=0x0;this[_0x620b('0x1e')]=_0x57dfd4[_0x620b('0x1e')]||![];this['acwTimeout']=_0x57dfd4[_0x620b('0x1f')]||0xa;this['autopause']=_0x57dfd4['autopause']||'no';this[_0x620b('0x20')]=!![];this[_0x620b('0x21')]='';this['statusMessage']='';this[_0x620b('0x22')]=0x0;this[_0x620b('0x23')]=0x0;this[_0x620b('0x24')]=_0x57dfd4[_0x620b('0x24')]||null;this[_0x620b('0x25')]=_0x57dfd4[_0x620b('0x25')]?_0x57dfd4['dialGlobalInterval']:null;this['dialActive']=_0x57dfd4[_0x620b('0x26')];this[_0x620b('0x27')]=_0x57dfd4[_0x620b('0x27')]||'progressive';this[_0x620b('0x28')]=_0x57dfd4[_0x620b('0x28')]||0x0;this['dialLimitQueue']=_0x57dfd4[_0x620b('0x29')]||0x0;this[_0x620b('0x2a')]=_0x57dfd4['dialPowerLevel']||0x1;this[_0x620b('0x2b')]=_0x57dfd4[_0x620b('0x2b')]||_0x620b('0x2c');this['dialPredictiveOptimizationPercentage']=_0x57dfd4['dialPredictiveOptimizationPercentage']||0.03;this[_0x620b('0x2d')]=_0x57dfd4[_0x620b('0x2d')]||0x258;this[_0x620b('0x2e')]=_0x57dfd4[_0x620b('0x2e')]||'anonymous';this[_0x620b('0x2f')]=_0x57dfd4[_0x620b('0x2f')]||_0x620b('0x30');this[_0x620b('0x31')]=_0x57dfd4[_0x620b('0x31')]||0x1e;this[_0x620b('0x32')]=_0x57dfd4[_0x620b('0x32')]||_0x620b('0x33');this[_0x620b('0x34')]=_0x57dfd4[_0x620b('0x34')]||0x3;this[_0x620b('0x35')]=_0x57dfd4[_0x620b('0x35')]||undefined;this[_0x620b('0x36')]=_0x57dfd4[_0x620b('0x36')]||0x3;this[_0x620b('0x37')]=_0x57dfd4[_0x620b('0x37')]||0x96;this[_0x620b('0x38')]=_0x57dfd4[_0x620b('0x38')]||0x3;this[_0x620b('0x39')]=_0x57dfd4[_0x620b('0x39')]||0x96;this[_0x620b('0x3a')]=_0x57dfd4[_0x620b('0x3a')]||0x3;this[_0x620b('0x3b')]=_0x57dfd4[_0x620b('0x3b')]||0x96;this[_0x620b('0x3c')]=_0x57dfd4['dialNoSuchNumberMaxRetry']||0x3;this[_0x620b('0x3d')]=_0x57dfd4['dialNoSuchNumberRetryFrequency']||0x96;this[_0x620b('0x3e')]=_0x57dfd4['dialDropMaxRetry']||0x3;this[_0x620b('0x3f')]=_0x57dfd4[_0x620b('0x3f')]||0x96;this['dialAbandonedMaxRetry']=_0x57dfd4[_0x620b('0x40')]||0x3;this[_0x620b('0x41')]=_0x57dfd4[_0x620b('0x41')]||0x96;this[_0x620b('0x42')]=_0x57dfd4[_0x620b('0x42')]||0x3;this[_0x620b('0x43')]=_0x57dfd4['dialMachineRetryFrequency']||0x96;this[_0x620b('0x44')]=_0x57dfd4['dialAgentRejectMaxRetry']||0x3;this[_0x620b('0x45')]=_0x57dfd4['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x57dfd4['callAdditionalPhoneAfterMin']||0x3;this[_0x620b('0x46')]=_0x57dfd4[_0x620b('0x46')]||0x4;this[_0x620b('0x47')]=_0x57dfd4[_0x620b('0x47')]?_0x57dfd4[_0x620b('0x47')]:undefined;this['TrunkBackup']=_0x57dfd4[_0x620b('0x48')]?_0x57dfd4[_0x620b('0x48')]:undefined;this[_0x620b('0x49')]=_0x57dfd4[_0x620b('0x49')]||undefined;this[_0x620b('0x4a')]=_0x57dfd4['Interval']?_0x57dfd4[_0x620b('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x57dfd4[_0x620b('0x4b')]||_0x620b('0x4c');this['dialRandomLastDigitCallerIdNumber']=_0x57dfd4[_0x620b('0x4d')]||undefined;this[_0x620b('0x4e')]=_0x57dfd4['dialCutDigit']||undefined;this[_0x620b('0x4f')]=strategy[_0x57dfd4[_0x620b('0x4f')]];this[_0x620b('0x50')]=!![];this[_0x620b('0x51')]=_0x57dfd4['dialAMDActive']||![];this[_0x620b('0x52')]=_0x57dfd4[_0x620b('0x52')];this[_0x620b('0x53')]=_0x57dfd4[_0x620b('0x53')];this[_0x620b('0x54')]=_0x57dfd4['dialAMDAfterGreetingSilence'];this[_0x620b('0x55')]=_0x57dfd4[_0x620b('0x55')];this['dialAMDMinWordLength']=_0x57dfd4[_0x620b('0x56')];this['dialAMDBetweenWordsSilence']=_0x57dfd4['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x57dfd4['dialAMDMaximumNumberOfWords'];this[_0x620b('0x57')]=_0x57dfd4[_0x620b('0x57')];this[_0x620b('0x58')]=_0x57dfd4[_0x620b('0x58')];this[_0x620b('0x59')]=0x0;this[_0x620b('0x5a')]=0x0;this[_0x620b('0x5b')]=_0x57dfd4[_0x620b('0x5b')];this[_0x620b('0x5c')]=0x0;this[_0x620b('0x5d')]=0x0;this[_0x620b('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x620b('0x5f')]=0x0;this[_0x620b('0x60')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x620b('0x61')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x620b('0x62')]=0x0;this[_0x620b('0x63')]=0x0;this[_0x620b('0x64')]=0x0;this[_0x620b('0x65')]=undefined;this[_0x620b('0x66')]=undefined;this['handlePredictive']=undefined;this[_0x620b('0x67')]=1.05;this[_0x620b('0x68')]=0x0;this[_0x620b('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x620b('0x6a')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x620b('0x6b')]=0x0;this[_0x620b('0x6c')]=0x0;this[_0x620b('0x6d')]=_0x57dfd4[_0x620b('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x57dfd4[_0x620b('0x6e')]||0xa;this[_0x620b('0x6f')]=0x0;this[_0x620b('0x70')]=0x0;this[_0x620b('0x71')]=0x1;this['erlangCalls']=0x0;this[_0x620b('0x72')]=0x0;this[_0x620b('0x73')]=0x0;this[_0x620b('0x74')]=0x0;this[_0x620b('0x75')]=_0x57dfd4[_0x620b('0x75')]||0x1e;this[_0x620b('0x76')]=_0x57dfd4['dialRecallInQueue']||![];this[_0x620b('0x77')]=!!_0x57dfd4[_0x620b('0x77')]||![];this[_0x620b('0x78')]=!!_0x57dfd4[_0x620b('0x78')]||![];this['dialQueueProject2']=_0x57dfd4[_0x620b('0x79')]||undefined;this[_0x620b('0x7a')]=_0x57dfd4[_0x620b('0x7a')]||![];this[_0x620b('0x7b')]=_0x57dfd4[_0x620b('0x7b')]||![];this[_0x620b('0xa')]=monitorFormat[_0x57dfd4['monitor_format']]?monitorFormat[_0x57dfd4[_0x620b('0xa')]]:undefined;this['mandatoryDisposition']=_0x57dfd4['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x57dfd4[_0x620b('0x7c')]?_0x57dfd4['mandatoryDispositionPause']:undefined;this[_0x620b('0x7d')]=![];}module[_0x620b('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 5a563f7..b63feac 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 _0x55d2=['sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','SIP/','incall','includes','status','booked','xcally-motion-preview','compareToOutboundQueue','message','some','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','loggedInDb','paused','ringing','talking','waiting','available','inUse','loggedIn','originated','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','pTalking'];(function(_0x2d0da6,_0x3b48db){var _0x2c7de1=function(_0x2a213f){while(--_0x2a213f){_0x2d0da6['push'](_0x2d0da6['shift']());}};_0x2c7de1(++_0x3b48db);}(_0x55d2,0x9f));var _0x255d=function(_0x9ef902,_0x25ed15){_0x9ef902=_0x9ef902-0x0;var _0x126e46=_0x55d2[_0x9ef902];return _0x126e46;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0x255d('0x0'),_0x255d('0x1'),_0x255d('0x2'),_0x255d('0x3'),_0x255d('0x4')];var OUTBOUND_COUNTERS=[_0x255d('0x5'),'answered',_0x255d('0x6'),_0x255d('0x7'),_0x255d('0x0'),_0x255d('0x8'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0x255d('0x9'),_0x255d('0xa'),_0x255d('0xb'),_0x255d('0xc'),_0x255d('0xd'),'outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused',_0x255d('0xe'),'talking',_0x255d('0xf'),_0x255d('0x10'),_0x255d('0x11'),'waiting'];function VoiceQueueSummary(_0x5072e3){this['id']=_0x5072e3['id'];this[_0x255d('0x12')]=_0x5072e3[_0x255d('0x12')];this[_0x255d('0x13')]=_0x5072e3[_0x255d('0x13')];this[_0x255d('0x14')]=_0x5072e3[_0x255d('0x14')]||0x0;this[_0x255d('0x15')]=_0x5072e3[_0x255d('0x15')]||0x0;this[_0x255d('0x5')]=_0x5072e3[_0x255d('0x5')]||0x0;this[_0x255d('0x16')]=_0x5072e3[_0x255d('0x16')]||0x0;this[_0x255d('0x6')]=_0x5072e3['inUse']||0x0;this[_0x255d('0x17')]=_0x5072e3[_0x255d('0x17')]||0x0;this['loggedIn']=_0x5072e3[_0x255d('0x7')]||0x0;this[_0x255d('0x0')]=_0x5072e3[_0x255d('0x0')]||0x0;this[_0x255d('0x18')]=_0x5072e3[_0x255d('0x18')]||0x0;this[_0x255d('0x19')]=_0x5072e3[_0x255d('0x19')]||0x0;this[_0x255d('0x1')]=_0x5072e3[_0x255d('0x1')]||0x0;this[_0x255d('0x2')]=_0x5072e3['ringing']||0x0;this[_0x255d('0x1a')]=_0x5072e3[_0x255d('0x1a')];this[_0x255d('0xf')]=_0x5072e3[_0x255d('0xf')];this[_0x255d('0x10')]=_0x5072e3[_0x255d('0x10')];this[_0x255d('0x1b')]=_0x5072e3[_0x255d('0x1b')]||0x0;this[_0x255d('0x3')]=_0x5072e3['talking']||0x0;this[_0x255d('0x11')]=_0x5072e3[_0x255d('0x11')]||0x0;this[_0x255d('0x1c')]=_0x5072e3[_0x255d('0x1c')];this[_0x255d('0x1d')]=_0x5072e3[_0x255d('0x1d')]||0x0;this[_0x255d('0x1e')]=_0x5072e3[_0x255d('0x1e')]||0x0;this[_0x255d('0x1f')]=_0x5072e3[_0x255d('0x1f')]||0x0;this[_0x255d('0x4')]=_0x5072e3[_0x255d('0x4')]||0x0;if(_0x5072e3[_0x255d('0x1c')]===_0x255d('0x20')){this[_0x255d('0xe')]=_0x5072e3[_0x255d('0xe')]||0x0;this[_0x255d('0x21')]=_0x5072e3[_0x255d('0x21')];this[_0x255d('0x22')]=_0x5072e3['dialMethod'];this[_0x255d('0x23')]=_0x5072e3[_0x255d('0x23')];this[_0x255d('0x24')]=_0x5072e3[_0x255d('0x24')];this[_0x255d('0x25')]=_0x5072e3[_0x255d('0x25')];this[_0x255d('0x26')]=_0x5072e3[_0x255d('0x26')];this['temp']=_0x5072e3[_0x255d('0x27')];this[_0x255d('0x28')]=_0x5072e3[_0x255d('0x28')];this['outboundAnswerCallsDay']=_0x5072e3[_0x255d('0x29')];this[_0x255d('0x9')]=_0x5072e3[_0x255d('0x9')];this[_0x255d('0xa')]=_0x5072e3[_0x255d('0xa')];this[_0x255d('0xb')]=_0x5072e3['outboundCongestionCallsDay'];this[_0x255d('0x2a')]=_0x5072e3['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x5072e3[_0x255d('0x2b')];this[_0x255d('0x2c')]=_0x5072e3[_0x255d('0x2c')];this[_0x255d('0xc')]=_0x5072e3['outboundNoAnswerCallsDay'];this[_0x255d('0xd')]=_0x5072e3[_0x255d('0xd')];this[_0x255d('0x2d')]=_0x5072e3['outboundOriginateFailureCallsDay'];this[_0x255d('0x2e')]=_0x5072e3['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x5072e3[_0x255d('0x2f')];this[_0x255d('0x30')]=_0x5072e3[_0x255d('0x30')];this[_0x255d('0x31')]=_0x5072e3[_0x255d('0x31')];this['predictiveIntervalAvgHoldtime']=_0x5072e3[_0x255d('0x32')];this['predictiveIntervalAvgTalktime']=_0x5072e3[_0x255d('0x33')];this[_0x255d('0x34')]=_0x5072e3[_0x255d('0x34')];this[_0x255d('0x35')]=_0x5072e3['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x5072e3['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x5072e3[_0x255d('0x36')];this['predictiveIntervalHitRate']=_0x5072e3[_0x255d('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x5072e3[_0x255d('0x38')];this[_0x255d('0x39')]=_0x5072e3['predictiveIntervalPauses'];this[_0x255d('0x3a')]=_0x5072e3[_0x255d('0x3a')];this[_0x255d('0x3b')]=_0x5072e3[_0x255d('0x3b')];this[_0x255d('0x8')]=_0x5072e3[_0x255d('0x8')];this[_0x255d('0x3c')]=_0x5072e3[_0x255d('0x3c')];this['erlangCallToSecond']=_0x5072e3[_0x255d('0x3d')];this[_0x255d('0x3e')]=_0x5072e3[_0x255d('0x3e')];this['erlangBusyFactor']=_0x5072e3[_0x255d('0x3f')];this[_0x255d('0x40')]=_0x5072e3[_0x255d('0x40')];this[_0x255d('0x41')]=_0x5072e3['startProgressive'];this['message']=_0x5072e3['message'];this[_0x255d('0x42')]=_0x5072e3[_0x255d('0x42')];}if(_0x5072e3['Trunk']){this[_0x255d('0x43')]={'id':_0x5072e3['Trunk']['id'],'name':_0x5072e3[_0x255d('0x43')][_0x255d('0x12')],'active':_0x5072e3[_0x255d('0x43')][_0x255d('0x44')],'callerid':_0x5072e3['Trunk']['callerid']};}}VoiceQueueSummary[_0x255d('0x45')][_0x255d('0x46')]=function(_0xe5dbc,_0x50f87f,_0x403288,_0x158ac5){this['loggedInDb']=0x0;this['talking']=0x0;this['paused']=0x0;this[_0x255d('0x1e')]=0x0;this[_0x255d('0x19')]=0x0;this[_0x255d('0x6')]=0x0;this[_0x255d('0x16')]=0x0;this[_0x255d('0x17')]=0x0;this[_0x255d('0x1d')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0x255d('0x18')]=0x0;if(_0x403288){if(_0x403288[_0x255d('0x5')]){this[_0x255d('0x5')]=Number(_0x403288[_0x255d('0x5')]);}if(_0x403288['loggedin']){this[_0x255d('0x7')]=Number(_0x403288[_0x255d('0x47')]);}if(_0x403288[_0x255d('0x48')]){this[_0x255d('0x4')]=Number(_0x403288['callers']);}}for(var _0x57c6c2=0x0;_0x57c6c2<_0xe5dbc[_0x255d('0x49')];_0x57c6c2++){var _0x1cee70=_0x50f87f[_0x255d('0x4a')+_0xe5dbc[_0x57c6c2][_0x255d('0x12')]];if(_0x1cee70&&_0x1cee70['online']){this[_0x255d('0x0')]+=0x1;}if(_0xe5dbc[_0x57c6c2][_0x255d('0x4b')]==='1'){this[_0x255d('0x3')]+=0x1;}if(_0xe5dbc[_0x57c6c2][_0x255d('0x1')]==='1'&&!['2','7','8'][_0x255d('0x4c')](_0xe5dbc[_0x57c6c2][_0x255d('0x4d')])){this[_0x255d('0x1')]+=0x1;}switch(_0xe5dbc[_0x57c6c2][_0x255d('0x4d')]){case'0':this[_0x255d('0x1e')]+=0x1;break;case'1':this[_0x255d('0x19')]+=0x1;break;case'2':this[_0x255d('0x6')]+=0x1;break;case'3':this[_0x255d('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x255d('0x1d')]+=0x1;break;case'6':this[_0x255d('0x2')]+=0x1;break;case'7':this[_0x255d('0x1a')]+=0x1;break;case'8':this[_0x255d('0x18')]+=0x1;break;}}if(this[_0x255d('0x22')]===_0x255d('0x4e')){var _0x5987ef=Object['keys'](_0x158ac5);for(var _0x2911d2=0x0;_0x2911d2<_0x5987ef[_0x255d('0x49')];_0x2911d2++){var _0xa18d80=_0x5987ef[_0x2911d2];var _0x34612e=_0x158ac5[_0xa18d80];if(_0x34612e['queue']===this['name']&&_0x34612e['type']==='dialer'&&_0x34612e['exten']===_0x255d('0x4f')){this[_0x255d('0x3')]+=0x1;}}if(this[_0x255d('0x3')]>this['inUse']){this[_0x255d('0x3')]=this[_0x255d('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x547ddf){var _0x4da302=![];if(_0x547ddf){_0x4da302=INBOUND_COUNTERS['some'](function(_0x22a294){return this[_0x22a294]!==_0x547ddf[_0x22a294];},this);}return _0x4da302;};VoiceQueueSummary[_0x255d('0x45')][_0x255d('0x50')]=function(_0x2322b2){var _0x421ff0=![];var _0x597833=![];var _0x30ed1a=![];if(_0x2322b2){_0x421ff0=this['dialMethod']!==_0x2322b2[_0x255d('0x22')]||this[_0x255d('0x21')]!==_0x2322b2[_0x255d('0x21')]||this[_0x255d('0x51')]!==_0x2322b2['message']||this['statusMessage']!==_0x2322b2[_0x255d('0x42')];_0x597833=OUTBOUND_COUNTERS[_0x255d('0x52')](function(_0x5cea1c){return this[_0x5cea1c]!==_0x2322b2[_0x5cea1c];},this);if(this[_0x255d('0x43')]&&_0x2322b2[_0x255d('0x43')]){_0x30ed1a=this[_0x255d('0x43')][_0x255d('0x12')]!==_0x2322b2[_0x255d('0x43')][_0x255d('0x12')]||this['Trunk']['active']!==_0x2322b2[_0x255d('0x43')][_0x255d('0x44')];}}return _0x421ff0||_0x597833||_0x30ed1a;};VoiceQueueSummary[_0x255d('0x45')][_0x255d('0x53')]=function(_0x446be3){this['answered']=_0x446be3[_0x255d('0x15')];this[_0x255d('0x51')]=_0x446be3['message'];this[_0x255d('0x42')]=_0x446be3[_0x255d('0x42')];this['originated']=_0x446be3['originated'];this[_0x255d('0x54')]=_0x446be3[_0x255d('0x54')];this[_0x255d('0x29')]=_0x446be3[_0x255d('0x29')];this['outboundBlacklistCallsDay']=_0x446be3['outboundBlacklistCallsDay'];this[_0x255d('0xa')]=_0x446be3[_0x255d('0xa')];this[_0x255d('0xb')]=_0x446be3[_0x255d('0xb')];this[_0x255d('0xc')]=_0x446be3[_0x255d('0xc')];this[_0x255d('0xd')]=_0x446be3[_0x255d('0xd')];this[_0x255d('0x2e')]=_0x446be3[_0x255d('0x2e')];this['outboundRejectCallsDay']=_0x446be3[_0x255d('0x2f')];this['outboundUnknownCallsDay']=_0x446be3[_0x255d('0x30')];this['sumBillable']=_0x446be3['sumBillable'];this[_0x255d('0x10')]=_0x446be3['sumDuration'];this[_0x255d('0x11')]=_0x446be3['total'];if(this[_0x255d('0x22')]===_0x255d('0x55')){this['pTalking']=_0x446be3[_0x255d('0xe')];}};module[_0x255d('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x1c88=['name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','waiting','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport','talking','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','compareToInboundQueue','some','active','exports','available','loggedInDb','paused','ringing','answered','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0x1c88,0x1a9));var _0x81c8=function(_0x34c4e1,_0x310387){_0x34c4e1=_0x34c4e1-0x0;var _0x5a11ef=_0x1c88[_0x34c4e1];return _0x5a11ef;};'use strict';var INBOUND_COUNTERS=[_0x81c8('0x0'),'loggedIn',_0x81c8('0x1'),_0x81c8('0x2'),_0x81c8('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x81c8('0x0'),_0x81c8('0x4'),_0x81c8('0x5'),_0x81c8('0x6'),_0x81c8('0x1'),_0x81c8('0x7'),_0x81c8('0x8'),_0x81c8('0x9'),_0x81c8('0xa'),_0x81c8('0xb'),_0x81c8('0xc'),_0x81c8('0xd'),_0x81c8('0xe'),'outboundReCallsDay',_0x81c8('0xf'),_0x81c8('0x10'),_0x81c8('0x2'),'pTalking','talking',_0x81c8('0x11'),_0x81c8('0x12'),_0x81c8('0x13'),'waiting'];function VoiceQueueSummary(_0x18a57b){this['id']=_0x18a57b['id'];this[_0x81c8('0x14')]=_0x18a57b['name'];this[_0x81c8('0x15')]=_0x18a57b[_0x81c8('0x15')];this[_0x81c8('0x16')]=_0x18a57b[_0x81c8('0x16')]||0x0;this['answered']=_0x18a57b[_0x81c8('0x4')]||0x0;this[_0x81c8('0x0')]=_0x18a57b[_0x81c8('0x0')]||0x0;this['busy']=_0x18a57b[_0x81c8('0x17')]||0x0;this[_0x81c8('0x5')]=_0x18a57b[_0x81c8('0x5')]||0x0;this['invalid']=_0x18a57b[_0x81c8('0x18')]||0x0;this[_0x81c8('0x6')]=_0x18a57b[_0x81c8('0x6')]||0x0;this[_0x81c8('0x1')]=_0x18a57b[_0x81c8('0x1')]||0x0;this['onHold']=_0x18a57b[_0x81c8('0x19')]||0x0;this[_0x81c8('0x1a')]=_0x18a57b['notInUse']||0x0;this[_0x81c8('0x2')]=_0x18a57b[_0x81c8('0x2')]||0x0;this[_0x81c8('0x3')]=_0x18a57b[_0x81c8('0x3')]||0x0;this[_0x81c8('0x1b')]=_0x18a57b[_0x81c8('0x1b')];this[_0x81c8('0x11')]=_0x18a57b[_0x81c8('0x11')];this[_0x81c8('0x12')]=_0x18a57b['sumDuration'];this[_0x81c8('0x1c')]=_0x18a57b['sumHoldTime']||0x0;this['talking']=_0x18a57b['talking']||0x0;this['total']=_0x18a57b[_0x81c8('0x13')]||0x0;this['type']=_0x18a57b[_0x81c8('0x1d')];this[_0x81c8('0x1e')]=_0x18a57b[_0x81c8('0x1e')]||0x0;this[_0x81c8('0x1f')]=_0x18a57b[_0x81c8('0x1f')]||0x0;this[_0x81c8('0x20')]=_0x18a57b[_0x81c8('0x20')]||0x0;this[_0x81c8('0x21')]=_0x18a57b[_0x81c8('0x21')]||0x0;if(_0x18a57b[_0x81c8('0x1d')]===_0x81c8('0x22')){this[_0x81c8('0x23')]=_0x18a57b[_0x81c8('0x23')]||0x0;this['dialActive']=_0x18a57b[_0x81c8('0x24')];this[_0x81c8('0x25')]=_0x18a57b[_0x81c8('0x25')];this[_0x81c8('0x26')]=_0x18a57b['dialOriginateCallerIdName'];this[_0x81c8('0x27')]=_0x18a57b['dialOriginateCallerIdNumber'];this[_0x81c8('0x28')]=_0x18a57b[_0x81c8('0x28')];this[_0x81c8('0x29')]=_0x18a57b[_0x81c8('0x29')];this[_0x81c8('0x2a')]=_0x18a57b[_0x81c8('0x2a')];this[_0x81c8('0x2b')]=_0x18a57b[_0x81c8('0x2b')];this['outboundAnswerCallsDay']=_0x18a57b[_0x81c8('0x9')];this['outboundBlacklistCallsDay']=_0x18a57b[_0x81c8('0xa')];this[_0x81c8('0xb')]=_0x18a57b[_0x81c8('0xb')];this[_0x81c8('0xc')]=_0x18a57b[_0x81c8('0xc')];this[_0x81c8('0x2c')]=_0x18a57b[_0x81c8('0x2c')];this['outboundDropCallsDayCallersExit']=_0x18a57b[_0x81c8('0x2d')];this['outboundDropCallsDayTimeout']=_0x18a57b[_0x81c8('0x2e')];this[_0x81c8('0xd')]=_0x18a57b[_0x81c8('0xd')];this['outboundNoSuchCallsDay']=_0x18a57b[_0x81c8('0xe')];this[_0x81c8('0x2f')]=_0x18a57b['outboundOriginateFailureCallsDay'];this[_0x81c8('0x30')]=_0x18a57b['outboundReCallsDay'];this[_0x81c8('0xf')]=_0x18a57b['outboundRejectCallsDay'];this[_0x81c8('0x10')]=_0x18a57b['outboundUnknownCallsDay'];this[_0x81c8('0x31')]=_0x18a57b[_0x81c8('0x31')];this[_0x81c8('0x32')]=_0x18a57b[_0x81c8('0x32')];this[_0x81c8('0x33')]=_0x18a57b[_0x81c8('0x33')];this[_0x81c8('0x34')]=_0x18a57b[_0x81c8('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x18a57b[_0x81c8('0x35')];this['predictiveIntervalErlangCalls']=_0x18a57b[_0x81c8('0x36')];this[_0x81c8('0x37')]=_0x18a57b[_0x81c8('0x37')];this[_0x81c8('0x38')]=_0x18a57b[_0x81c8('0x38')];this['predictiveIntervalMultiplicativeFactor']=_0x18a57b[_0x81c8('0x39')];this['predictiveIntervalPauses']=_0x18a57b[_0x81c8('0x3a')];this[_0x81c8('0x3b')]=_0x18a57b[_0x81c8('0x3b')];this[_0x81c8('0x3c')]=_0x18a57b[_0x81c8('0x3c')];this[_0x81c8('0x7')]=_0x18a57b['originated'];this[_0x81c8('0x3d')]=_0x18a57b[_0x81c8('0x3d')];this[_0x81c8('0x3e')]=_0x18a57b[_0x81c8('0x3e')];this[_0x81c8('0x3f')]=_0x18a57b[_0x81c8('0x3f')];this[_0x81c8('0x40')]=_0x18a57b[_0x81c8('0x40')];this[_0x81c8('0x41')]=_0x18a57b[_0x81c8('0x41')];this['startProgressive']=_0x18a57b[_0x81c8('0x42')];this[_0x81c8('0x43')]=_0x18a57b['message'];this[_0x81c8('0x44')]=_0x18a57b[_0x81c8('0x44')];}if(_0x18a57b[_0x81c8('0x45')]){this[_0x81c8('0x45')]={'id':_0x18a57b['Trunk']['id'],'name':_0x18a57b[_0x81c8('0x45')][_0x81c8('0x14')],'active':_0x18a57b[_0x81c8('0x45')]['active'],'callerid':_0x18a57b[_0x81c8('0x45')]['callerid']};}}VoiceQueueSummary[_0x81c8('0x46')][_0x81c8('0x47')]=function(_0x3a5a00,_0x3da212,_0x33d480,_0x3b0980){this[_0x81c8('0x1')]=0x0;this[_0x81c8('0x48')]=0x0;this[_0x81c8('0x2')]=0x0;this[_0x81c8('0x1f')]=0x0;this['notInUse']=0x0;this[_0x81c8('0x5')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x81c8('0x1e')]=0x0;this[_0x81c8('0x3')]=0x0;this['ringInUse']=0x0;this[_0x81c8('0x19')]=0x0;if(_0x33d480){if(_0x33d480[_0x81c8('0x0')]){this['available']=Number(_0x33d480[_0x81c8('0x0')]);}if(_0x33d480['loggedin']){this[_0x81c8('0x6')]=Number(_0x33d480[_0x81c8('0x49')]);}if(_0x33d480[_0x81c8('0x4a')]){this[_0x81c8('0x21')]=Number(_0x33d480[_0x81c8('0x4a')]);}}for(var _0x221a7b=0x0;_0x221a7b<_0x3a5a00[_0x81c8('0x4b')];_0x221a7b++){var _0x31a04e=_0x3da212[_0x81c8('0x4c')+_0x3a5a00[_0x221a7b][_0x81c8('0x14')]];if(_0x31a04e&&_0x31a04e[_0x81c8('0x4d')]){this[_0x81c8('0x1')]+=0x1;}if(_0x3a5a00[_0x221a7b][_0x81c8('0x4e')]==='1'){this[_0x81c8('0x48')]+=0x1;}if(_0x3a5a00[_0x221a7b][_0x81c8('0x2')]==='1'&&!['2','7','8'][_0x81c8('0x4f')](_0x3a5a00[_0x221a7b][_0x81c8('0x50')])){this[_0x81c8('0x2')]+=0x1;}switch(_0x3a5a00[_0x221a7b]['status']){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x81c8('0x5')]+=0x1;break;case'3':this[_0x81c8('0x17')]+=0x1;break;case'4':this[_0x81c8('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x81c8('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x81c8('0x25')]===_0x81c8('0x51')){var _0x5056e9=Object[_0x81c8('0x52')](_0x3b0980);for(var _0x5057a9=0x0;_0x5057a9<_0x5056e9[_0x81c8('0x4b')];_0x5057a9++){var _0xcdede9=_0x5056e9[_0x5057a9];var _0x467092=_0x3b0980[_0xcdede9];if(_0x467092[_0x81c8('0x53')]===this[_0x81c8('0x14')]&&_0x467092['type']===_0x81c8('0x54')&&_0x467092['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this['talking']>this[_0x81c8('0x5')]){this[_0x81c8('0x48')]=this[_0x81c8('0x5')];}this[_0x81c8('0x23')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x81c8('0x55')]=function(_0x415d1d){var _0x70295=![];if(_0x415d1d){_0x70295=INBOUND_COUNTERS['some'](function(_0x4114bd){return this[_0x4114bd]!==_0x415d1d[_0x4114bd];},this);}return _0x70295;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x298c46){var _0x3db836=![];var _0x439a14=![];var _0x1f8f5e=![];if(_0x298c46){_0x3db836=this[_0x81c8('0x25')]!==_0x298c46[_0x81c8('0x25')]||this[_0x81c8('0x24')]!==_0x298c46[_0x81c8('0x24')]||this['message']!==_0x298c46[_0x81c8('0x43')]||this[_0x81c8('0x44')]!==_0x298c46[_0x81c8('0x44')];_0x439a14=OUTBOUND_COUNTERS[_0x81c8('0x56')](function(_0x4039d5){return this[_0x4039d5]!==_0x298c46[_0x4039d5];},this);if(this[_0x81c8('0x45')]&&_0x298c46[_0x81c8('0x45')]){_0x1f8f5e=this[_0x81c8('0x45')][_0x81c8('0x14')]!==_0x298c46['Trunk'][_0x81c8('0x14')]||this[_0x81c8('0x45')][_0x81c8('0x57')]!==_0x298c46['Trunk'][_0x81c8('0x57')];}}return _0x3db836||_0x439a14||_0x1f8f5e;};VoiceQueueSummary[_0x81c8('0x46')]['updateReportFromOutboundQueue']=function(_0x5375f8){this['answered']=_0x5375f8['answered'];this[_0x81c8('0x43')]=_0x5375f8[_0x81c8('0x43')];this[_0x81c8('0x44')]=_0x5375f8[_0x81c8('0x44')];this[_0x81c8('0x7')]=_0x5375f8[_0x81c8('0x7')];this[_0x81c8('0x8')]=_0x5375f8[_0x81c8('0x8')];this[_0x81c8('0x9')]=_0x5375f8['outboundAnswerCallsDay'];this[_0x81c8('0xa')]=_0x5375f8['outboundBlacklistCallsDay'];this[_0x81c8('0xb')]=_0x5375f8[_0x81c8('0xb')];this['outboundCongestionCallsDay']=_0x5375f8['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x5375f8[_0x81c8('0xd')];this['outboundNoSuchCallsDay']=_0x5375f8[_0x81c8('0xe')];this[_0x81c8('0x30')]=_0x5375f8['outboundReCallsDay'];this[_0x81c8('0xf')]=_0x5375f8[_0x81c8('0xf')];this[_0x81c8('0x10')]=_0x5375f8['outboundUnknownCallsDay'];this[_0x81c8('0x11')]=_0x5375f8[_0x81c8('0x11')];this[_0x81c8('0x12')]=_0x5375f8[_0x81c8('0x12')];this['total']=_0x5375f8[_0x81c8('0x13')];if(this['dialMethod']==='preview'){this[_0x81c8('0x23')]=_0x5375f8[_0x81c8('0x23')];}};module[_0x81c8('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index dbf10b7..0e5a667 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 _0x3021=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x30668c,_0x50499f){var _0x4af48a=function(_0x3fc4db){while(--_0x3fc4db){_0x30668c['push'](_0x30668c['shift']());}};_0x4af48a(++_0x50499f);}(_0x3021,0x7f));var _0x1302=function(_0x41af68,_0x2c506c){_0x41af68=_0x41af68-0x0;var _0x262ad8=_0x3021[_0x41af68];return _0x262ad8;};'use strict';function VtigerAccount(_0x848015){this['id']=_0x848015['id']||0x0;this[_0x1302('0x0')]=_0x848015['name']||'';this['username']=_0x848015[_0x1302('0x1')]||'';this['accessKey']=_0x848015['accessKey']||'';this[_0x1302('0x2')]=_0x848015[_0x1302('0x2')]||'';this['serverUrl']=_0x848015[_0x1302('0x3')]||'';this[_0x1302('0x4')]=_0x848015['Configurations']||{};}module[_0x1302('0x5')]=VtigerAccount; \ No newline at end of file +var _0x2e65=['remoteUri','serverUrl','exports','name','username','accessKey'];(function(_0x91968a,_0x280937){var _0x3e0787=function(_0x2343a5){while(--_0x2343a5){_0x91968a['push'](_0x91968a['shift']());}};_0x3e0787(++_0x280937);}(_0x2e65,0x1e3));var _0x52e6=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x2e65[_0x1347f8];return _0x218368;};'use strict';function VtigerAccount(_0x493043){this['id']=_0x493043['id']||0x0;this[_0x52e6('0x0')]=_0x493043[_0x52e6('0x0')]||'';this[_0x52e6('0x1')]=_0x493043[_0x52e6('0x1')]||'';this['accessKey']=_0x493043[_0x52e6('0x2')]||'';this['remoteUri']=_0x493043[_0x52e6('0x3')]||'';this[_0x52e6('0x4')]=_0x493043['serverUrl']||'';this['Configurations']=_0x493043['Configurations']||{};}module[_0x52e6('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index fa68d0c..8aa9bc6 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 _0x20c6=['exports','name','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x439df1,_0x233c87){var _0x1eb12f=function(_0x18f486){while(--_0x18f486){_0x439df1['push'](_0x439df1['shift']());}};_0x1eb12f(++_0x233c87);}(_0x20c6,0xe2));var _0x620c=function(_0x2f454b,_0x4f0132){_0x2f454b=_0x2f454b-0x0;var _0x3077ab=_0x20c6[_0x2f454b];return _0x3077ab;};'use strict';function ZendeskAccount(_0x216232){this['id']=_0x216232['id']||0x0;this[_0x620c('0x0')]=_0x216232[_0x620c('0x0')]||'';this['username']=_0x216232['username']||'';this['password']=_0x216232[_0x620c('0x1')]||'';this[_0x620c('0x2')]=_0x216232[_0x620c('0x2')]||'';this[_0x620c('0x3')]=_0x216232[_0x620c('0x3')]||'';this[_0x620c('0x4')]=_0x216232[_0x620c('0x4')]||'';this[_0x620c('0x5')]=_0x216232[_0x620c('0x5')]||_0x620c('0x6');this['serverUrl']=_0x216232[_0x620c('0x7')]||'';this['Configurations']=_0x216232['Configurations']||{};}module[_0x620c('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xdbaf=['token','remoteUri','authType','type','serverUrl','Configurations','name','username','password'];(function(_0x592a8f,_0x135341){var _0xc57bb2=function(_0x47b59e){while(--_0x47b59e){_0x592a8f['push'](_0x592a8f['shift']());}};_0xc57bb2(++_0x135341);}(_0xdbaf,0xe7));var _0xfdba=function(_0x1516da,_0x289abb){_0x1516da=_0x1516da-0x0;var _0x2091e5=_0xdbaf[_0x1516da];return _0x2091e5;};'use strict';function ZendeskAccount(_0x1e0b35){this['id']=_0x1e0b35['id']||0x0;this[_0xfdba('0x0')]=_0x1e0b35[_0xfdba('0x0')]||'';this[_0xfdba('0x1')]=_0x1e0b35[_0xfdba('0x1')]||'';this[_0xfdba('0x2')]=_0x1e0b35[_0xfdba('0x2')]||'';this[_0xfdba('0x3')]=_0x1e0b35['token']||'';this[_0xfdba('0x4')]=_0x1e0b35[_0xfdba('0x4')]||'';this[_0xfdba('0x5')]=_0x1e0b35[_0xfdba('0x5')]||'';this[_0xfdba('0x6')]=_0x1e0b35[_0xfdba('0x6')]||'integrationTab';this[_0xfdba('0x7')]=_0x1e0b35[_0xfdba('0x7')]||'';this[_0xfdba('0x8')]=_0x1e0b35[_0xfdba('0x8')]||{};}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 862c298..26cb2a5 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 _0x59fb=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0xab1898,_0x535f14){var _0x3a9c70=function(_0x57bb36){while(--_0x57bb36){_0xab1898['push'](_0xab1898['shift']());}};_0x3a9c70(++_0x535f14);}(_0x59fb,0x74));var _0xb59f=function(_0x59cfc9,_0x49146f){_0x59cfc9=_0x59cfc9-0x0;var _0x259a01=_0x59fb[_0x59cfc9];return _0x259a01;};'use strict';function ZohoAccount(_0x2d4fd0){this['id']=_0x2d4fd0['id']||0x0;this[_0xb59f('0x0')]=_0x2d4fd0[_0xb59f('0x0')]||'';this[_0xb59f('0x1')]=_0x2d4fd0[_0xb59f('0x1')]||'';this[_0xb59f('0x2')]=_0x2d4fd0[_0xb59f('0x2')]||'';this['zone']=_0x2d4fd0[_0xb59f('0x3')]||'';this[_0xb59f('0x4')]=_0x2d4fd0['clientId']||'';this[_0xb59f('0x5')]=_0x2d4fd0['clientSecret']||'';this['serverUrl']=_0x2d4fd0[_0xb59f('0x6')]||'';this[_0xb59f('0x7')]=_0x2d4fd0['code']||'';this[_0xb59f('0x8')]=_0x2d4fd0['refreshToken']||'';this[_0xb59f('0x9')]=_0x2d4fd0['Configurations']||{};}module[_0xb59f('0xa')]=ZohoAccount; \ No newline at end of file +var _0x7ef2=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x1f782d,_0x5906b8){var _0x228cce=function(_0x3036cc){while(--_0x3036cc){_0x1f782d['push'](_0x1f782d['shift']());}};_0x228cce(++_0x5906b8);}(_0x7ef2,0x16d));var _0x27ef=function(_0x3b842e,_0x46f2c1){_0x3b842e=_0x3b842e-0x0;var _0x48236d=_0x7ef2[_0x3b842e];return _0x48236d;};'use strict';function ZohoAccount(_0x4149d1){this['id']=_0x4149d1['id']||0x0;this['name']=_0x4149d1[_0x27ef('0x0')]||'';this['description']=_0x4149d1[_0x27ef('0x1')]||'';this[_0x27ef('0x2')]=_0x4149d1[_0x27ef('0x2')]||'';this['zone']=_0x4149d1[_0x27ef('0x3')]||'';this[_0x27ef('0x4')]=_0x4149d1['clientId']||'';this[_0x27ef('0x5')]=_0x4149d1['clientSecret']||'';this[_0x27ef('0x6')]=_0x4149d1[_0x27ef('0x6')]||'';this['code']=_0x4149d1[_0x27ef('0x7')]||'';this['refreshToken']=_0x4149d1[_0x27ef('0x8')]||'';this['Configurations']=_0x4149d1[_0x27ef('0x9')]||{};}module[_0x27ef('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 11970af..921859b 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 _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x154d05,_0x12f728){var _0x33a700=function(_0x4a14e6){while(--_0x4a14e6){_0x154d05['push'](_0x154d05['shift']());}};_0x33a700(++_0x12f728);}(_0xe820,0xd2));var _0x0e82=function(_0x60ddf9,_0x37b9e3){_0x60ddf9=_0x60ddf9-0x0;var _0x49c6e5=_0xe820[_0x60ddf9];return _0x49c6e5;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file +var _0xed3c=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xed3c,0x1a6));var _0xced3=function(_0xfe3407,_0x2d93f9){_0xfe3407=_0xfe3407-0x0;var _0x2a86ba=_0xed3c[_0xfe3407];return _0x2a86ba;};'use strict';var util=require(_0xced3('0x0'));var _=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));function checkNameSurname(_0x3fb5e1,_0x558ee8,_0xfdc1ed){var _0x144d14='';if(!_[_0xced3('0x3')](_0x558ee8)&&'string'===typeof _0x558ee8){_0x144d14+=_0x558ee8;}if(!_['isNil'](_0xfdc1ed)&&_0xced3('0x4')===typeof _0xfdc1ed){_0x144d14+='\x20'+_0xfdc1ed;}if(_0x144d14!==''){return _0x144d14;}return _0x3fb5e1;}function Action(_0x1ada18,_0x2f92f8,_0x1cd694,_0x4795cd,_0x510164){this['uniqueid']=_0x1cd694||undefined;this[_0xced3('0x5')]=_0x1ada18['id'];this['queue']=_0x2f92f8['name'];this['type']=_0x2f92f8[_0xced3('0x6')];this[_0xced3('0x7')]=_0xced3('0x8');this[_0xced3('0x9')]=![];this[_0xced3('0xa')]=_['isNil'](_0x1ada18[_0xced3('0xb')])?undefined:_0x1ada18[_0xced3('0xb')][_0xced3('0xc')];this['channelAgent']=this[_0xced3('0xa')]?util[_0xced3('0xd')](_0xced3('0xe'),this[_0xced3('0xa')]):_0x4795cd||undefined;this[_0xced3('0xf')]=checkNameSurname(_0x1ada18[_0xced3('0x10')][_0xced3('0x11')],_0x1ada18['Contact'][_0xced3('0x12')],_0x1ada18['Contact'][_0xced3('0x13')]);this[_0xced3('0x14')]=_0x1ada18[_0xced3('0x14')]||![];this[_0xced3('0x15')]=_0x1ada18['phone'];this[_0xced3('0x16')]=_0x1ada18[_0xced3('0x16')];this['countbusyretry']=_0x1ada18[_0xced3('0x17')]||0x0;this[_0xced3('0x18')]=_0x1ada18[_0xced3('0x18')]||0x0;this[_0xced3('0x19')]=_0x1ada18['countnoanswerretry']||0x0;this[_0xced3('0x1a')]=(_0x1ada18['countbusyretry']||0x0)+(_0x1ada18[_0xced3('0x18')]||0x0)+(_0x1ada18[_0xced3('0x19')]||0x0)+(_0x1ada18[_0xced3('0x1b')]||0x0)+(_0x1ada18[_0xced3('0x1c')]||0x0)+(_0x1ada18[_0xced3('0x1d')]||0x0)+(_0x1ada18[_0xced3('0x1e')]||0x0)+(_0x1ada18[_0xced3('0x1f')]||0x0);this[_0xced3('0x1b')]=_0x1ada18[_0xced3('0x1b')]||0x0;this[_0xced3('0x1c')]=_0x1ada18[_0xced3('0x1c')]||0x0;this['countabandonedretry']=_0x1ada18['countabandonedretry']||0x0;this['countmachineretry']=_0x1ada18[_0xced3('0x1e')]||0x0;this[_0xced3('0x1f')]=_0x1ada18[_0xced3('0x1f')]||0x0;this['callback']=_0x1ada18[_0xced3('0x20')];this[_0xced3('0x21')]=_0x1ada18['callbackuniqueid'];this['callbackat']=_0x1ada18[_0xced3('0x22')];this[_0xced3('0x23')]=_0x1ada18[_0xced3('0x23')];this[_0xced3('0x24')]=_0x1ada18['ContactId'];this[_0xced3('0x25')]=_0x1ada18[_0xced3('0x25')];this['UserId']=_[_0xced3('0x3')](_0x1ada18['Agent'])?_0x1ada18[_0xced3('0x26')]:_0x1ada18[_0xced3('0xb')]['id'];this[_0xced3('0x27')]=_0x1ada18[_0xced3('0x27')];this[_0xced3('0x28')]='';this['originatecalleridname']='';}Action['prototype'][_0xced3('0x29')]=function(){return util['format'](_0xced3('0x2a'),this[_0xced3('0xf')],this['number']);};module[_0xced3('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d07ff6c..b4aa0b7 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 _0xf45d=['transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','ioredis','../../../config/environment','../../../config/logger','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','message','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','preview','booked','type','outbound','dialActive','setMessage','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','recallMe','getContactRecallMe','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','then','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','buildAcw','complete','outboundAnswerCallsDay','total','answered','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','\x20Queue','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','isTrunkReachable','active','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','lookAgent','responsetime','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject'];(function(_0xc8a598,_0x8ffd7c){var _0x2a6225=function(_0x5f2d46){while(--_0x5f2d46){_0xc8a598['push'](_0xc8a598['shift']());}};_0x2a6225(++_0x8ffd7c);}(_0xf45d,0x151));var _0xdf45=function(_0x21754e,_0x124df3){_0x21754e=_0x21754e-0x0;var _0x321fbe=_0xf45d[_0x21754e];return _0x321fbe;};'use strict';var util=require(_0xdf45('0x0'));var _=require(_0xdf45('0x1'));var uuid=require('uuid');var moment=require(_0xdf45('0x2'));var Redis=require(_0xdf45('0x3'));var config=require(_0xdf45('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xdf45('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xdf45('0x6'));var cmHopperAdditionalPhone=require(_0xdf45('0x7'));var Action=require(_0xdf45('0x8'));var ut=require(_0xdf45('0x9'));var utils=require(_0xdf45('0xa'));config[_0xdf45('0xb')]=_[_0xdf45('0xc')](config[_0xdf45('0xb')],{'host':_0xdf45('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf45('0xb')]));var Sequence=function(){};Sequence[_0xdf45('0xe')][_0xdf45('0xf')]=function(_0x562b2b){this[_0xdf45('0x10')]=this['tail']?this['tail'][_0xdf45('0x11')](_0x562b2b):_0x562b2b();};function Preview(_0x3ebf00){this[_0xdf45('0x12')]=new Sequence();this[_0xdf45('0x13')]=_0x3ebf00['voiceQueues'];this[_0xdf45('0x14')]=_0x3ebf00[_0xdf45('0x14')];this[_0xdf45('0x15')]={};this[_0xdf45('0x16')]=_0x3ebf00['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xdf45('0x17'),this[_0xdf45('0x18')]['bind'](this));ami['on'](_0xdf45('0x19'),this[_0xdf45('0x1a')][_0xdf45('0x1b')](this));ami['on'](_0xdf45('0x1c'),this[_0xdf45('0x1d')][_0xdf45('0x1b')](this));ami['on'](_0xdf45('0x1e'),this[_0xdf45('0x1f')][_0xdf45('0x1b')](this));ami['on'](_0xdf45('0x20'),this[_0xdf45('0x21')][_0xdf45('0x1b')](this));ami['on']('varset',this[_0xdf45('0x22')][_0xdf45('0x1b')](this));ami['on'](_0xdf45('0x23'),this[_0xdf45('0x24')]['bind'](this));ami['on'](_0xdf45('0x25'),this[_0xdf45('0x26')][_0xdf45('0x1b')](this));this[_0xdf45('0x27')](this['campaignsPreview']);}function emit(_0x435adb,_0x2f8fb0,_0x283661){io['to'](_0x435adb)[_0xdf45('0x28')](_0x2f8fb0,_0x283661);}function emitVoiceQueueChannelRemove(_0x39981b){logger[_0xdf45('0x29')](_0xdf45('0x2a'),JSON[_0xdf45('0x2b')](_0x39981b));emit(util[_0xdf45('0x2c')](_0xdf45('0x2d'),_0x39981b[_0xdf45('0x2e')]),_0xdf45('0x2f'),_0x39981b);io['emit'](_0xdf45('0x30'),_0x39981b);}function notSendMessagesQueue(_0xc52e2b){if(_0xc52e2b['sendMessageOneNotActive']){if(_0xc52e2b[_0xdf45('0x31')]===0x0&&_0xc52e2b[_0xdf45('0x32')]===0x0){_0xc52e2b['sendMessageOneNotActive']=![];_0xc52e2b[_0xdf45('0x33')]=0x0;_0xc52e2b[_0xdf45('0x34')]=0x0;_0xc52e2b['message']=utils[_0xdf45('0x35')][_0xdf45('0x36')];ut[_0xdf45('0x37')](_0xdf45('0x38'),_0xc52e2b[_0xdf45('0x2e')]+_0xdf45('0x39'));}else{_0xc52e2b[_0xdf45('0x3a')]=utils[_0xdf45('0x35')][_0xdf45('0x3b')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xc52e2b['name']+_0xdf45('0x3c'));}}}Preview[_0xdf45('0xe')]['loopCampaigns']=function(){var _0x48ddce=this;setInterval(function(){_0x48ddce[_0xdf45('0x3d')]();},0x7cf);};Preview[_0xdf45('0xe')][_0xdf45('0x3d')]=function(){var _0x51302f=this[_0xdf45('0x13')];this[_0xdf45('0x3e')]+=0x1;for(var _0x2fabae in _0x51302f){if(_0x51302f[_0xdf45('0x3f')](_0x2fabae)&&(_0x51302f[_0x2fabae][_0xdf45('0x40')]===_0xdf45('0x41')||_0x51302f[_0x2fabae]['dialMethod']===_0xdf45('0x42'))&&_0x51302f[_0x2fabae][_0xdf45('0x43')]===_0xdf45('0x44')){if(this[_0xdf45('0x3e')]>0x7){this[_0xdf45('0x3e')]=0x0;this['clearZombieChannels']();}}if(_0x51302f[_0xdf45('0x3f')](_0x2fabae)&&_0x51302f[_0x2fabae][_0xdf45('0x40')]===_0xdf45('0x41')&&_0x51302f[_0x2fabae][_0xdf45('0x43')]==='outbound'){if(_0x51302f[_0x2fabae][_0xdf45('0x45')]){this[_0xdf45('0x46')](_0x51302f[_0x2fabae]);if(_0x51302f[_0x2fabae]['dialPreviewAutoRecallMe'])this['recallMe'](_0x51302f[_0x2fabae]);}else{notSendMessagesQueue(_0x51302f[_0x2fabae]);}}}};Preview[_0xdf45('0xe')][_0xdf45('0x47')]=function(_0x56512a){var _0x56cd9c=this;this[_0xdf45('0x12')][_0xdf45('0xf')](function(){if(!_['isNil'](_0x56cd9c['actions'][_0x56512a])){loggerAction[_0xdf45('0x29')](_0xdf45('0x48'),_0x56512a,_0xdf45('0x49'),_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')],_0xdf45('0x4b'),JSON[_0xdf45('0x2b')](_0x56cd9c[_0xdf45('0x13')][_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')]][_0xdf45('0x31')]),_0xdf45('0x4c'),JSON['stringify'](_0x56cd9c[_0xdf45('0x13')][_0x56cd9c['actions'][_0x56512a][_0xdf45('0x4a')]][_0xdf45('0x32')]),JSON[_0xdf45('0x2b')](_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4d')]),JSON[_0xdf45('0x2b')](_['pick'](_0x56cd9c[_0xdf45('0x15')][_0x56512a],['contactId',_0xdf45('0x4e'),_0xdf45('0x4f'),_0xdf45('0x50')])));return ami[_0xdf45('0x51')]({'action':_0xdf45('0x52'),'channel':_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x53')]})[_0xdf45('0x54')](function(_0x811865){if(_0x811865[_0xdf45('0x3a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x56cd9c['actions'][_0x56512a]){ut[_0xdf45('0x55')](_0x56cd9c['campaignsPreview'][_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')]],_0xdf45('0x56'));if(_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4d')]===!![]){ut[_0xdf45('0x57')](_0x56cd9c[_0xdf45('0x13')][_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')]],_0xdf45('0x56'));ut['loggerError'](_0xdf45('0x58')+_0x56512a,_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')]);}ut[_0xdf45('0x59')](_0xdf45('0x5a')+_0x56512a,_0x56cd9c[_0xdf45('0x15')][_0x56512a][_0xdf45('0x4a')]);delete _0x56cd9c[_0xdf45('0x15')][_0x56512a];}},0x2328);}});}});};Preview[_0xdf45('0xe')][_0xdf45('0x5b')]=function(){var _0x2b3162=this;loggerAction[_0xdf45('0x29')]('[action]',_[_0xdf45('0x5c')](this[_0xdf45('0x15')]));for(var _0x6b34e3 in this[_0xdf45('0x15')]){if(_0x2b3162[_0xdf45('0x15')]['hasOwnProperty'](_0x6b34e3)){_0x2b3162[_0xdf45('0x47')](_0x6b34e3);}}};Preview['prototype'][_0xdf45('0x5d')]=function(_0x245546){var _0x33e2a8=this;rpcDb[_0xdf45('0x5e')](_0x245546['id'],ut['agentReadyId'](this[_0xdf45('0x16')]))['then'](function(_0x14fcdb){if(!_[_0xdf45('0x5f')](_0x14fcdb)){for(var _0x4eb47e=0x0;_0x4eb47e<_0x14fcdb['length'];_0x4eb47e+=0x1){if(ut[_0xdf45('0x60')](_0x14fcdb[_0x4eb47e][_0xdf45('0x61')])<_0x245546[_0xdf45('0x62')]*0x3c){if(_0x14fcdb[_0x4eb47e]['Agent']&&!_0x14fcdb[_0x4eb47e][_0xdf45('0x63')]['voicePause']){_0x33e2a8['run'](_0x14fcdb[_0x4eb47e]['id'])[_0xdf45('0x64')](ut[_0xdf45('0x65')](_0xdf45('0x66')))[_0xdf45('0x54')](ut[_0xdf45('0x65')](_0xdf45('0x66')));}else{rpcDb[_0xdf45('0x67')](_0x14fcdb[_0x4eb47e]['id']);}}else{var _0x376691=new Action(_0x14fcdb[_0x4eb47e],_0x245546);_0x376691['starttime']=moment()['format'](_0xdf45('0x68'));_0x245546[_0xdf45('0x69')]+=0x1;ut[_0xdf45('0x6a')](_0x376691,0x17,_0xdf45('0x6b'));if(_0x245546[_0xdf45('0x6c')]){rpcDb['rescheduleContactInQueue'](ut[_0xdf45('0x6d')](_0x14fcdb[_0x4eb47e]));rpcDb[_0xdf45('0x6e')](_0x376691,_0xdf45('0x6f'));}else{ut[_0xdf45('0x6a')](_0x376691,0x16,'RecallFailedTimeout');rpcDb[_0xdf45('0x6e')](_0x376691,_0xdf45('0x70'));rpcDb['createCustomerFinal'](_0x376691,'[HistoryRecallClose]');}}}}})[_0xdf45('0x54')](ut[_0xdf45('0x65')](_0xdf45('0x71')));};Preview[_0xdf45('0xe')][_0xdf45('0x46')]=function(_0xf0c954){_0xf0c954['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0xf0c954[_0xdf45('0x72')])){_0xf0c954[_0xdf45('0x3a')]=utils[_0xdf45('0x35')][_0xdf45('0x73')];}else if(!ut[_0xdf45('0x74')](_0xf0c954[_0xdf45('0x45')])){_0xf0c954['message']=utils[_0xdf45('0x35')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0xf0c954[_0xdf45('0x75')])){if(!this['isTrunkReachable'](_0xf0c954[_0xdf45('0x76')])){_0xf0c954[_0xdf45('0x3a')]=utils[_0xdf45('0x35')][_0xdf45('0x77')];}else{_0xf0c954[_0xdf45('0x3a')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0xf0c954[_0xdf45('0x3a')]=utils[_0xdf45('0x35')][_0xdf45('0x78')];}};Preview[_0xdf45('0xe')][_0xdf45('0x79')]=function(_0x4a9c81,_0xe64f38,_0x43e4ed){var _0x3fcc06=this;var _0x1b3d37=this['actions'][_0xe64f38];var _0x68e9e6=this[_0xdf45('0x13')][_0x1b3d37[_0xdf45('0x4a')]];var _0x472485;var _0x3bc34a=![];var _0x473959=0x2;var _0x58e702=0x3;if(_0x68e9e6){switch(_0x43e4ed){case'1':_0x68e9e6[_0xdf45('0x7a')]+=0x1;_0x1b3d37['countnosuchnumberretry']+=0x1;_0x1b3d37['countglobal']=ut[_0xdf45('0x7b')](_0x1b3d37);ut['logCustomer'](_0x1b3d37,0x0,_0xdf45('0x7c'));ami[_0xdf45('0x28')](_0xdf45('0x7d'),ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0x7f')));rpcDb['createCustomerHistory'](_0x1b3d37,_0xdf45('0x80'));_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'0',_0x68e9e6)[_0xdf45('0x64')](function(_0x52649d){_0x3bc34a=_0x52649d[_0xdf45('0x82')]==0x1;_0x473959=_0x68e9e6['dialNoSuchNumberRetryFrequency'];_0x58e702=_0x68e9e6[_0xdf45('0x83')];if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut['cloneAction'](_0x1b3d37,0xf,'Global');rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0x86'));}else{if(_0x1b3d37[_0xdf45('0x87')]>=_0x68e9e6['dialNoSuchNumberMaxRetry']){rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0x86'));}else{rpcDb[_0xdf45('0x88')](ut[_0xdf45('0x89')](_0x1b3d37,'countnosuchnumberretry',_0x68e9e6[_0xdf45('0x8a')]),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37[_0xdf45('0x8c')]);}}delete this[_0xdf45('0x15')][_0x4a9c81[_0xdf45('0x8d')]];}else{_0x1b3d37[_0xdf45('0x87')]++;logger[_0xdf45('0x29')](_0xdf45('0x8e'),_0x1b3d37[_0xdf45('0x87')]);logger[_0xdf45('0x29')]('id',_0x1b3d37[_0xdf45('0x8f')]);_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countnosuchnumberretry':_0x1b3d37['countnosuchnumberretry']}})['then'](function(){_0x3fcc06['swapAdditionalPhones'](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});break;case _0xdf45('0x91'):var _0x127abf=moment()[_0xdf45('0x2c')](_0xdf45('0x68'));_0x1b3d37['responsetime']=_0x127abf;_0x1b3d37['answertime']=_0x127abf;_0x1b3d37[_0xdf45('0x4d')]=!![];_0x68e9e6[_0xdf45('0x32')]+=0x1;logger[_0xdf45('0x29')](_0xdf45('0x92'),_0x1b3d37[_0xdf45('0x93')],'\x20Queue',_0x68e9e6[_0xdf45('0x2e')],'pTalking:\x20',_0x68e9e6[_0xdf45('0x32')]);ami['emit'](_0xdf45('0x94'),ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0x95'),this[_0xdf45('0x13')][_0x1b3d37[_0xdf45('0x4a')]]));if(_0x68e9e6[_0xdf45('0x96')]){ami[_0xdf45('0x28')]('custom:agentConnectPreview',ut[_0xdf45('0x97')](_0x1b3d37));}break;case'16':ami[_0xdf45('0x28')]('custom:agentcomplete',ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0x98'),this[_0xdf45('0x13')][_0x1b3d37[_0xdf45('0x4a')]]));emitVoiceQueueChannelRemove(ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0x98')));_0x68e9e6[_0xdf45('0x99')]+=0x1;_0x68e9e6[_0xdf45('0x9a')]+=0x1;_0x68e9e6[_0xdf45('0x9b')]+=0x1;ut[_0xdf45('0x57')](_0x68e9e6,'[16]');_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut['logCustomer'](_0x1b3d37,0x4,_0xdf45('0x9d'));rpcDb['createCustomerHistory'](_0x1b3d37,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0x9e'));rpcDb['crateCustomerReportQueue'](_0x1b3d37);_0x68e9e6[_0xdf45('0x9f')]+=_0x1b3d37[_0xdf45('0xa0')];_0x68e9e6[_0xdf45('0xa1')]+=_0x1b3d37['talktime'];logger[_0xdf45('0x29')]('[syncHangup][talking][decrement]',_0x1b3d37['uniqueid'],_0xdf45('0xa2'),_0x68e9e6[_0xdf45('0x2e')],_0xdf45('0x4c'),_0x68e9e6['pTalking']);delete this[_0xdf45('0x15')][_0x4a9c81['linkedid']];break;case'BUSY':_0x68e9e6['outboundBusyCallsDay']+=0x1;_0x1b3d37[_0xdf45('0xa3')]+=0x1;_0x1b3d37['countglobal']=ut['totalGlobal'](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x5,_0xdf45('0xa4'));_0x473959=_0x68e9e6[_0xdf45('0xa5')];_0x58e702=_0x68e9e6['callAdditionalPhoneAfterMin'];ami['emit'](_0xdf45('0xa6'),ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0xa7')));rpcDb[_0xdf45('0x6e')](_0x1b3d37,'[callProgressDetectingCustomer][logBusy]');_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'5',_0x68e9e6)[_0xdf45('0x64')](function(_0x526e69){_0x3bc34a=_0x526e69['additional']==0x1;if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut[_0xdf45('0xa8')](_0x1b3d37,0xf,'Global');rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0xa9'));}else{if(_0x1b3d37[_0xdf45('0xa3')]>=_0x68e9e6[_0xdf45('0xaa')]){rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0xab'));}else{rpcDb[_0xdf45('0x88')](ut[_0xdf45('0x89')](_0x1b3d37,_0xdf45('0xa3'),_0x68e9e6[_0xdf45('0xa5')]),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37[_0xdf45('0x8c')]);}}}else{_0x1b3d37[_0xdf45('0xa3')]++;_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countbusyretry':_0x1b3d37[_0xdf45('0xa3')]}})['then'](function(){_0x3fcc06[_0xdf45('0xac')](_0x1b3d37,_0x473959,_0x58e702)['then'](function(){});});}});break;case _0xdf45('0xad'):_0x68e9e6[_0xdf45('0xae')]+=0x1;_0x1b3d37['countnoanswerretry']+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x3,_0xdf45('0xaf'));_0x473959=_0x68e9e6['dialNoAnswerRetryFrequency'];_0x58e702=_0x68e9e6[_0xdf45('0x83')];var _0x42a1ad=ut[_0xdf45('0xb0')](_0x1b3d37,_0x68e9e6);ami[_0xdf45('0x28')]('custom:agentnoanswer',_0x42a1ad);rpcDb['createCustomerHistory'](_0x1b3d37,_0xdf45('0xb1'));_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'3',_0x68e9e6)[_0xdf45('0x64')](function(_0xcdb935){_0x3bc34a=_0xcdb935[_0xdf45('0x82')]==0x1;if(!_0x3bc34a){if(ut['totalGlobal'](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut['cloneAction'](_0x1b3d37,0xf,_0xdf45('0xb2'));rpcDb['createCustomerFinal'](_0x472485,_0xdf45('0xb3'));}else{if(_0x1b3d37[_0xdf45('0xb4')]>=_0x68e9e6[_0xdf45('0xb5')]){rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0xb1'));}else{rpcDb['rescheduleContact'](ut[_0xdf45('0x89')](_0x1b3d37,_0xdf45('0xb4'),_0x68e9e6[_0xdf45('0xb6')]),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37[_0xdf45('0x8c')]);}}}else{_0x1b3d37['countnoanswerretry']++;_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countnoanswerretry':_0x1b3d37[_0xdf45('0xb4')]}})[_0xdf45('0x64')](function(){_0x3fcc06[_0xdf45('0xac')](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});break;case'CONGESTION':_0x68e9e6[_0xdf45('0xb7')]+=0x1;_0x1b3d37[_0xdf45('0xb8')]+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x8,_0xdf45('0xb9'));_0x473959=_0x68e9e6['dialCongestionRetryFrequency'];_0x58e702=_0x68e9e6['callAdditionalPhoneAfterMin'];ami[_0xdf45('0x28')](_0xdf45('0xba'),ut['buildObj'](_0x1b3d37,_0xdf45('0xbb')));rpcDb[_0xdf45('0x6e')](_0x1b3d37,_0xdf45('0xbc'));_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'8',_0x68e9e6)[_0xdf45('0x64')](function(_0x2eaac8){_0x3bc34a=_0x2eaac8['additional']==0x1;if(!_0x3bc34a){if(ut['totalGlobal'](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut['cloneAction'](_0x1b3d37,0xf,_0xdf45('0xb2'));rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0xbd'));}else{if(_0x1b3d37[_0xdf45('0xb8')]>=_0x68e9e6[_0xdf45('0xbe')]){rpcDb[_0xdf45('0x85')](_0x1b3d37,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xdf45('0x88')](ut[_0xdf45('0x89')](_0x1b3d37,_0xdf45('0xb8'),_0x68e9e6[_0xdf45('0xa5')]),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37['activeContact']);}}}else{_0x1b3d37['countcongestionretry']++;_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countcongestionretry':_0x1b3d37[_0xdf45('0xb8')]}})[_0xdf45('0x64')](function(){_0x3fcc06[_0xdf45('0xac')](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});break;case'CANCEL':_0x68e9e6[_0xdf45('0xbf')]+=0x1;_0x1b3d37[_0xdf45('0xc0')]+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x14,'AgentReject');_0x473959=_0x68e9e6[_0xdf45('0xc1')];_0x58e702=_0x68e9e6[_0xdf45('0x83')];ami['emit'](_0xdf45('0xc2'),ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0xc3')));rpcDb[_0xdf45('0x6e')](_0x1b3d37,'[syncHangupRequest][logAgentReject]');_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'20',_0x68e9e6)[_0xdf45('0x64')](function(_0x54bcda){_0x3bc34a=_0x54bcda[_0xdf45('0x82')]==0x1;if(!_0x3bc34a){if(ut['totalGlobal'](_0x1b3d37)>=_0x68e9e6['dialGlobalMaxRetry']){_0x472485=ut[_0xdf45('0xa8')](_0x1b3d37,0x14,_0xdf45('0xc4'));rpcDb['createCustomerFinal'](_0x472485,_0xdf45('0xc5'));}else{if(_0x1b3d37['countagentrejectretry']>=_0x68e9e6[_0xdf45('0xc6')]){rpcDb['createCustomerFinal'](_0x1b3d37,_0xdf45('0xc5'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1b3d37,'countagentrejectretry',_0x68e9e6[_0xdf45('0xc1')]),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37[_0xdf45('0x8c')]);}}}else{_0x1b3d37['countnoanswerretry']++;_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37['idContact'],'field':{'countnoanswerretry':_0x1b3d37[_0xdf45('0xb4')]}})[_0xdf45('0x64')](function(){_0x3fcc06['swapAdditionalPhones'](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});break;case'ABANDONED':_0x68e9e6[_0xdf45('0xc7')]+=0x1;_0x1b3d37[_0xdf45('0xc8')]+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0xb,_0xdf45('0xc9'));rpcDb['createCustomerHistory'](_0x1b3d37,_0xdf45('0xca'));_0x3fcc06['verifyAdditionalPhones'](_0x1b3d37,'11',_0x68e9e6)[_0xdf45('0x64')](function(_0x15a151){_0x3bc34a=_0x15a151[_0xdf45('0x82')]==0x1;if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut[_0xdf45('0xa8')](_0x1b3d37,0xf,_0xdf45('0xb2'));rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0xca'));}else{if(_0x1b3d37[_0xdf45('0xcb')]>=_0x68e9e6[_0xdf45('0xcc')]){rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0xca'));}else{rpcDb[_0xdf45('0x88')](ut[_0xdf45('0x89')](_0x1b3d37,_0xdf45('0xc8'),_0x68e9e6['dialAbandonedRetryFrequency']),_0x1b3d37[_0xdf45('0x8b')],_0x1b3d37['activeContact']);}}}else{_0x1b3d37['countnoanswerretry']++;_0x3fcc06['incrementPreviewCounters']({'id':_0x1b3d37['idContact'],'field':{'countnoanswerretry':_0x1b3d37['countnoanswerretry']}})[_0xdf45('0x64')](function(){_0x3fcc06['swapAdditionalPhones'](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});break;case'18':_0x68e9e6[_0xdf45('0xcd')]+=0x1;_0x1b3d37['countmachineretry']+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x12,_0x4a9c81[_0xdf45('0xce')]||_0x4a9c81[_0xdf45('0xcf')]);ami[_0xdf45('0x28')](_0xdf45('0xd0'),ut[_0xdf45('0x7e')](_0x1b3d37,_0xdf45('0xd1')));rpcDb[_0xdf45('0x6e')](_0x1b3d37,_0xdf45('0xd2'));_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'18',_0x68e9e6)['then'](function(_0x1d7962){_0x3bc34a=_0x1d7962[_0xdf45('0x82')]==0x1;if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut['cloneAction'](_0x1b3d37,0x12,_0xdf45('0xb2'));rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0xd2'));}else{rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0xd2'));}}else{_0x1b3d37['countnoanswerretry']++;_0x3fcc06[_0xdf45('0x90')]({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countnoanswerretry':_0x1b3d37[_0xdf45('0xb4')]}})[_0xdf45('0x64')](function(){_0x3fcc06[_0xdf45('0xac')](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});delete this[_0xdf45('0x15')][_0x4a9c81[_0xdf45('0x8d')]];break;case'19':_0x68e9e6[_0xdf45('0xcd')]+=0x1;_0x1b3d37['countglobal']=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0x13,_0x4a9c81[_0xdf45('0xce')]||_0x4a9c81[_0xdf45('0xcf')]);ami['emit'](_0xdf45('0xd0'),ut[_0xdf45('0x7e')](_0x1b3d37,'amd'));rpcDb[_0xdf45('0x6e')](_0x1b3d37,_0xdf45('0xd3'));_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'18',_0x68e9e6)[_0xdf45('0x64')](function(_0x407553){_0x3bc34a=_0x407553[_0xdf45('0x82')]==0x1;if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6[_0xdf45('0x84')]){_0x472485=ut[_0xdf45('0xa8')](_0x1b3d37,0xf,_0xdf45('0xb2'));rpcDb[_0xdf45('0x85')](_0x472485,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xdf45('0x85')](_0x1b3d37,'[callProgressDetectingCustomer][machine]');}}else{_0x1b3d37[_0xdf45('0xb4')]++;_0x3fcc06['incrementPreviewCounters']({'id':_0x1b3d37[_0xdf45('0x8f')],'field':{'countnoanswerretry':_0x1b3d37[_0xdf45('0xb4')]}})[_0xdf45('0x64')](function(){_0x3fcc06['swapAdditionalPhones'](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});});}});delete this[_0xdf45('0x15')][_0x4a9c81[_0xdf45('0x8d')]];break;default:if(_0x1b3d37['dialAnswer']){ut['decrementTalkink'](_0x68e9e6,_0xdf45('0xd4'));ut[_0xdf45('0x59')](_0xdf45('0xd5')+_0x68e9e6['name'],_0x4a9c81);}_0x68e9e6[_0xdf45('0xcd')]+=0x1;_0x1b3d37[_0xdf45('0x9c')]=ut[_0xdf45('0x7b')](_0x1b3d37);ut[_0xdf45('0x6a')](_0x1b3d37,0xc,_0x4a9c81['cause-txt']||_0x4a9c81[_0xdf45('0xcf')]);_0x473959=_0x68e9e6[_0xdf45('0xc1')];_0x58e702=_0x68e9e6[_0xdf45('0x83')];rpcDb['createCustomerHistory'](_0x1b3d37,'[callProgressDetectingCustomer][logUnknown]');_0x3fcc06[_0xdf45('0x81')](_0x1b3d37,'20',_0x68e9e6)[_0xdf45('0x64')](function(_0x3b8552){_0x3bc34a=_0x3b8552['additional']==0x1;if(!_0x3bc34a){if(ut[_0xdf45('0x7b')](_0x1b3d37)>=_0x68e9e6['dialGlobalMaxRetry']){_0x472485=ut[_0xdf45('0xa8')](_0x1b3d37,0xf,'Global');rpcDb[_0xdf45('0x85')](_0x472485,_0xdf45('0xd6'));}else{rpcDb[_0xdf45('0x85')](_0x1b3d37,_0xdf45('0xd6'));}delete this['actions'][_0x4a9c81[_0xdf45('0x8d')]];}else{_0x3fcc06[_0xdf45('0xac')](_0x1b3d37,_0x473959,_0x58e702)[_0xdf45('0x64')](function(){});}});}if(!(_0x1b3d37['dialAnswer']&&_0x43e4ed==='16')){ut['updateOriginated'](_0x68e9e6,_0xdf45('0xd7'));logger[_0xdf45('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0x1b3d37[_0xdf45('0x93')],'\x20Queue',_0x68e9e6['name'],_0xdf45('0x4b'),_0x68e9e6['originated']);}if(_0x43e4ed!==_0xdf45('0x91')){delete this['actions'][_0x4a9c81[_0xdf45('0x8d')]];delete this['actions'][_0x4a9c81[_0xdf45('0xd8')]];}_0x68e9e6[_0xdf45('0xd9')]=!![];}};Preview[_0xdf45('0xe')]['callProgressDetectingAgent']=function(_0x17eacd,_0x1329e1,_0x2afce3){if(_['isUndefined'](_0x1329e1)&&'object'!==typeof _0x1329e1){return;}if(_[_0xdf45('0xda')](_0x2afce3)&&_0xdf45('0xdb')!==typeof _0x2afce3){return;}switch(_0x2afce3[_0xdf45('0xdc')]){case'0':ut[_0xdf45('0xdd')](_0x17eacd,0x0,_0xdf45('0x7c'));rpcDb['createAgentHistory'](_0x17eacd,_0xdf45('0xde'));break;case'3':ut['logAgent'](_0x17eacd,0x3,_0xdf45('0xaf'));rpcDb[_0xdf45('0xdf')](_0x17eacd,_0xdf45('0xe0'));break;case'5':ut[_0xdf45('0xdd')](_0x17eacd,0x5,_0xdf45('0xa4'));rpcDb[_0xdf45('0xdf')](_0x17eacd,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x17eacd,0x8,_0xdf45('0xb9'));rpcDb[_0xdf45('0xdf')](_0x17eacd,_0xdf45('0xe1'));break;case'22':ut[_0xdf45('0xdd')](_0x17eacd,0x16,_0xdf45('0xe2'));rpcDb[_0xdf45('0xdf')](_0x17eacd,_0xdf45('0xe3'));break;default:ut[_0xdf45('0xdd')](_0x17eacd,0xc,_0x2afce3[_0xdf45('0xdc')]);rpcDb[_0xdf45('0xdf')](_0x17eacd,_0xdf45('0xe1'));}ut[_0xdf45('0x55')](_0x1329e1,_0xdf45('0xe4'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x17eacd[_0xdf45('0x93')],'\x20Queue',_0x1329e1[_0xdf45('0x2e')],_0xdf45('0x4b'),_0x1329e1[_0xdf45('0x31')]);delete this[_0xdf45('0x15')][_0x17eacd[_0xdf45('0x93')]];};Preview[_0xdf45('0xe')][_0xdf45('0x81')]=function(_0x6c7ae9,_0x3abe17,_0x599ecf){return cmHopperAdditionalPhone[_0xdf45('0x81')](_0x6c7ae9,_0x3abe17,_0x599ecf)[_0xdf45('0x54')](logger[_0xdf45('0x29')](_0xdf45('0xe5')));};Preview[_0xdf45('0xe')][_0xdf45('0xac')]=function(_0xe97b9c,_0x20c431,_0x1fd47b){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xe97b9c,_0x20c431,_0x1fd47b)[_0xdf45('0x54')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xdf45('0xe')][_0xdf45('0x90')]=function(_0x1ab796){return Promise[_0xdf45('0xe6')]()['then'](cmHopperAdditionalPhone[_0xdf45('0x90')](_0x1ab796))[_0xdf45('0x54')](logger[_0xdf45('0x29')](_0xdf45('0xe7')));};Preview[_0xdf45('0xe')]['checkInBlack']=function(_0x33b08c,_0x3d621e,_0x7da5d8,_0x4e6999,_0x2faf7a){var _0x543411=this;return new Promise(function(_0x3b521f,_0x4f6c60){if(_['isNil'](_0x3d621e)||_['isNil'](_0x3d621e[_0xdf45('0xe8')])||_['isNil'](_0x3d621e[_0xdf45('0xe9')])||_[_0xdf45('0x5f')](_0x3d621e[_0xdf45('0x4f')])){_0x4f6c60(ut['message'](_0xdf45('0xea'),_0x4e6999,_0x2faf7a));return;}var _0x232216=uuid['v4']();var _0x1be963=_0x543411[_0xdf45('0x13')][_0x3d621e['Queue'][_0xdf45('0x2e')]];var _0x22edb0=_0x7da5d8?_0x543411['agents'][_0x7da5d8]['id']:undefined;_0x543411['actions'][_0x232216]=new Action(_0x3d621e,_0x1be963,_0x232216,_0x7da5d8,_0x22edb0);var _0x17bd3b=_0x543411['actions'][_0x232216];_0x17bd3b['unlockAgent']=_0x4e6999;_0x17bd3b[_0xdf45('0x8c')]=_0x2faf7a;_0x17bd3b['lookAgent']=_0x7da5d8;if(_[_0xdf45('0xeb')](_0x33b08c)){_0x543411['execCall'](_0x17bd3b,_0x1be963,_0x3d621e,_0x7da5d8)[_0xdf45('0x64')](function(_0x19eaa7){logger[_0xdf45('0x29')]('[Preview][execCall][success]',_0xdf45('0xec')+_0x17bd3b[_0xdf45('0x4a')]+_0xdf45('0xed')+_0x17bd3b[_0xdf45('0x8f')],JSON[_0xdf45('0x2b')](_0x19eaa7));ami[_0xdf45('0x28')](_0xdf45('0xee'),ut[_0xdf45('0x7e')](_0x17bd3b,_0xdf45('0xef'),_0x543411[_0xdf45('0x13')][_0x17bd3b['queue']]));_0x3b521f(ut[_0xdf45('0x3a')](_0xdf45('0xf0')));})[_0xdf45('0x54')](function(_0x16c187){ut[_0xdf45('0x37')](_0xdf45('0xf1'),_0x16c187);_0x4f6c60(ut[_0xdf45('0x3a')](_0xdf45('0xf2'),_0x4e6999,_0x2faf7a));});}else{_0x1be963[_0xdf45('0xf3')]+=0x1;ut[_0xdf45('0xf4')](_0x17bd3b);rpcDb[_0xdf45('0xf5')](_0x17bd3b,_0xdf45('0xf6'));delete _0x543411['actions'][_0x232216];_0x4f6c60(ut[_0xdf45('0x3a')](_0xdf45('0xf7'),_0x4e6999,_0x2faf7a));}});};Preview['prototype'][_0xdf45('0xf8')]=function(_0x55dd0c){return!_[_0xdf45('0x5f')](_0x55dd0c)&&!_[_0xdf45('0x5f')](_0x55dd0c['name'])&&!_[_0xdf45('0x5f')](_0x55dd0c[_0xdf45('0xf9')])&&_0x55dd0c['active']&&!_[_0xdf45('0x5f')](this[_0xdf45('0x14')][util[_0xdf45('0x2c')](_0xdf45('0xfa'),_0x55dd0c[_0xdf45('0x2e')])])&&!_[_0xdf45('0x5f')](this[_0xdf45('0x14')][util[_0xdf45('0x2c')](_0xdf45('0xfa'),_0x55dd0c[_0xdf45('0x2e')])][_0xdf45('0x52')])&&(this[_0xdf45('0x14')][util[_0xdf45('0x2c')]('SIP/%s',_0x55dd0c[_0xdf45('0x2e')])][_0xdf45('0x52')]===_0xdf45('0xfb')||this[_0xdf45('0x14')][util[_0xdf45('0x2c')](_0xdf45('0xfa'),_0x55dd0c[_0xdf45('0x2e')])][_0xdf45('0x52')]===_0xdf45('0xfc'));};Preview['prototype'][_0xdf45('0xfd')]=function(_0x80e55c,_0x2241e5){return this[_0xdf45('0xfe')](_0x80e55c,_0x2241e5)[_0xdf45('0x64')](function(_0x453407){return _[_0xdf45('0xff')](_0x453407,[_0xdf45('0x3a')]);})['catch'](function(_0x4e9d95){if(_0x4e9d95[_0xdf45('0x100')]){rpcDb[_0xdf45('0x101')](_0x80e55c);}if(_0x4e9d95[_0xdf45('0xf9')]){rpcDb['disableContact'](_0x80e55c);}throw _[_0xdf45('0xff')](_0x4e9d95,[_0xdf45('0x3a')]);});};Preview[_0xdf45('0xe')][_0xdf45('0xfe')]=function(_0x389658,_0x3a907d){var _0x20a628=this;var _0x349e04,_0x52321c;return rpcDb[_0xdf45('0x102')](_0x389658)[_0xdf45('0x64')](function(_0x59cc9a){if(!_[_0xdf45('0x5f')](_0x59cc9a[0x0])){_0x52321c=_0x59cc9a[0x0][_0xdf45('0x103')]?![]:!![];_0x349e04=_0x59cc9a[0x0][_0xdf45('0x103')]?!![]:![];_0x349e04=_0x3a907d?!![]:_0x349e04;}var _0x3872fd=_0x20a628[_0xdf45('0x104')](_0x59cc9a);if(_0x3872fd[_0xdf45('0x105')]){rpcDb[_0xdf45('0x106')](_[_0xdf45('0xff')](_0x59cc9a[0x0],[_0xdf45('0x4f'),_0xdf45('0xe9')]))[_0xdf45('0x64')](function(_0x5d7c96){_0x20a628[_0xdf45('0x107')](_0x5d7c96,_0x59cc9a[0x0],_0x3a907d,_0x52321c,_0x349e04)[_0xdf45('0x64')](function(_0x2114e7){return _0x2114e7;})['catch'](function(_0x49df3d){throw _0x49df3d;});})[_0xdf45('0x54')](function(_0x2f786f){ut['logger'](_0xdf45('0x108'),_0x2f786f);throw ut['message'](_0xdf45('0x109'),_0x52321c,_0x349e04);});}else{throw ut[_0xdf45('0x3a')](_0x3872fd[_0xdf45('0x3a')],_0x52321c,_0x349e04);}})['catch'](function(_0x21b3d2){ut[_0xdf45('0x37')](_0xdf45('0x10a'),_0x21b3d2);throw ut[_0xdf45('0x3a')](_0xdf45('0x109'),![],!![]);});};Preview['prototype'][_0xdf45('0x104')]=function(_0x336815){if(_[_0xdf45('0x5f')](_0x336815)||_[_0xdf45('0xeb')](_0x336815)||!_['isNil'](_0x336815[0x0][_0xdf45('0x63')])&&_[_0xdf45('0x5f')](_0x336815[0x0][_0xdf45('0x63')]['name'])){ut[_0xdf45('0x37')]('[Preview][validateContact][Empty\x20Contact]',_0x336815);return{'isValid':![],'message':_0xdf45('0x10b')};}var _0x3379f6=this[_0xdf45('0x13')][_0x336815[0x0][_0xdf45('0x49')][_0xdf45('0x2e')]];_0x3379f6['message']=utils[_0xdf45('0x35')][_0xdf45('0x78')];if(_[_0xdf45('0x5f')](_0x3379f6)){ut[_0xdf45('0x37')](_0xdf45('0x10c'),_0x3379f6);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xdf45('0xf8')](_0x3379f6['Trunk'])){ut[_0xdf45('0x37')](_0xdf45('0x10d'),'campaign\x20Name:\x20'+_0x3379f6[_0xdf45('0x2e')]+_0xdf45('0x10e'));if(!this[_0xdf45('0xf8')](_0x3379f6[_0xdf45('0x76')])){ut['logger'](_0xdf45('0x10d'),_0x3379f6[_0xdf45('0x2e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xdf45('0x10f')};}}if(!ut[_0xdf45('0x74')](_0x3379f6[_0xdf45('0x45')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x3379f6[_0xdf45('0x2e')]+_0xdf45('0x110'));return{'isValid':![],'message':_0xdf45('0x111')+_0x3379f6['name']+_0xdf45('0x110')};}return{'isValid':!![],'message':_0xdf45('0x112')};};Preview[_0xdf45('0xe')]['execCall']=function(_0x213fd2,_0x404c3a,_0x3fd46a,_0x5131a1){var _0x2b638d=this;return new Promise(function(_0x214dfa,_0xd2049f){var _0x9ad521=_0x213fd2[_0xdf45('0x93')];var _0x310978=_0x2b638d[_0xdf45('0xf8')](_0x404c3a[_0xdf45('0x75')])?util['format']('SIP/%s/%s%s',_0x404c3a[_0xdf45('0x75')]['name'],_[_0xdf45('0x5f')](_0x404c3a['dialPrefix'])?'':_0x404c3a[_0xdf45('0x113')][_0xdf45('0x114')]()||'',_0x404c3a[_0xdf45('0x115')]>0x0?_0x3fd46a[_0xdf45('0xe9')][_0xdf45('0x116')](_0x404c3a[_0xdf45('0x115')]):_0x3fd46a[_0xdf45('0xe9')]):util[_0xdf45('0x2c')]('SIP/%s/%s%s',_[_0xdf45('0x5f')](_0x404c3a[_0xdf45('0x76')])?_0x404c3a[_0xdf45('0x75')]['name']:_0x404c3a[_0xdf45('0x76')][_0xdf45('0x2e')],_[_0xdf45('0x5f')](_0x404c3a['dialPrefix'])?'':_0x404c3a[_0xdf45('0x113')][_0xdf45('0x114')]()||'',_0x404c3a['dialCutDigit']>0x0?_0x3fd46a['phone']['substring'](_0x404c3a[_0xdf45('0x115')]):_0x3fd46a[_0xdf45('0xe9')]);var _0x579e4d=_0x2b638d[_0xdf45('0xf8')](_0x404c3a['Trunk'])?ut[_0xdf45('0x117')](_0x404c3a[_0xdf45('0x75')][_0xdf45('0x118')],_0x404c3a[_0xdf45('0x119')],_0x404c3a[_0xdf45('0x11a')]>0x0?ut[_0xdf45('0x11b')](_0x404c3a[_0xdf45('0x11c')],_0x404c3a[_0xdf45('0x11a')]):_0x404c3a['dialOriginateCallerIdNumber']):ut['getCallerId'](_['isNil'](_0x404c3a[_0xdf45('0x76')])?_0x404c3a['Trunk'][_0xdf45('0x118')]:_0x404c3a['TrunkBackup']['callerid'],_0x404c3a['dialOriginateCallerIdName'],_0x404c3a[_0xdf45('0x11a')]>0x0?ut['getCallerIdRandom'](_0x404c3a['dialOriginateCallerIdNumber'],_0x404c3a[_0xdf45('0x11a')]):_0x404c3a[_0xdf45('0x11c')]);if(_0x579e4d){_0x213fd2[_0xdf45('0x11d')]=ut[_0xdf45('0x11e')](_0x579e4d);_0x213fd2[_0xdf45('0x11f')]=ut[_0xdf45('0x120')](_0x579e4d);}var _0x585231=ut[_0xdf45('0x121')](_0x404c3a,_0x3fd46a,_0x310978,_0x579e4d,_0x9ad521,_0x213fd2);var _0x5b143e=utils[_0xdf45('0x122')](_0x3fd46a[_0xdf45('0xe8')]);Object[_0xdf45('0x123')](_0x585231,_0x5b143e);_[_0xdf45('0x124')](_0x213fd2,ut[_0xdf45('0x125')](_0x585231));_0x213fd2[_0xdf45('0x126')]=moment()[_0xdf45('0x2c')](_0xdf45('0x68'));_0x404c3a[_0xdf45('0x127')]=_0x585231;var _0x63e0e8=ut[_0xdf45('0x128')](_0x213fd2,_0x404c3a,_0x585231,_0x213fd2['activeContact'],_0x5131a1);return ami[_0xdf45('0x51')](_0x63e0e8)[_0xdf45('0x64')](function(_0x2c648b){_0x404c3a[_0xdf45('0x31')]+=0x1;logger[_0xdf45('0x29')](_0xdf45('0x129'),_0x9ad521,_0xdf45('0xa2'),_0x404c3a['name'],'originated:\x20',_0x404c3a[_0xdf45('0x31')]);_0x214dfa(_0x2c648b);})[_0xdf45('0x54')](function(_0xfaf05){ut[_0xdf45('0xdd')](_0x213fd2,0xe,_0xdf45('0x12a'));rpcDb[_0xdf45('0xdf')](_0x213fd2,_0xdf45('0x12b'));_0xd2049f(_0xfaf05);});});};Preview[_0xdf45('0xe')][_0xdf45('0x21')]=function(_0x5f262b){if(this[_0xdf45('0x15')][_0x5f262b[_0xdf45('0x8d')]]){this[_0xdf45('0x15')][_0x5f262b[_0xdf45('0x8d')]]['channel']=_0x5f262b['channel'];}};Preview['prototype'][_0xdf45('0x18')]=function(_0x1f8a66){var _0x2396d6=this;var _0x1b854a=this[_0xdf45('0x15')][_0x1f8a66['actionid']];if(_0x1b854a){if(_0x1b854a[_0xdf45('0x12c')]&&this[_0xdf45('0x16')][_0x1b854a[_0xdf45('0x12c')]]){ut['logLookAgent'](_0x1b854a,this[_0xdf45('0x16')][_0x1b854a[_0xdf45('0x12c')]][_0xdf45('0x2e')],this[_0xdf45('0x16')][_0x1b854a['lookAgent']]['id']);}var _0x125db2=_['clone'](_0x1b854a);_0x125db2[_0xdf45('0x12d')]=moment()[_0xdf45('0x2c')](_0xdf45('0x68'));var _0x51ad5c=_0x2396d6[_0xdf45('0x13')][_0x1b854a[_0xdf45('0x4a')]];if(ut['isFailure'](_0x1f8a66[_0xdf45('0x12e')])){if(_0x1b854a['unlockAgent']){rpcDb[_0xdf45('0x101')](_0x1b854a[_0xdf45('0x8f')]);}if(_0x1b854a['activeContact']){rpcDb[_0xdf45('0x67')](_0x1b854a[_0xdf45('0x8f')]);}ami[_0xdf45('0x28')](_0xdf45('0x12f'),ut[_0xdf45('0x7e')](_0x1b854a,_0xdf45('0x130'),this['campaignsPreview'][_0x1b854a['queue']]));this[_0xdf45('0x131')](_0x125db2,_0x51ad5c,_0x1f8a66);}else{_0x1b854a[_0xdf45('0x126')]=moment()[_0xdf45('0x2c')](_0xdf45('0x68'));ut[_0xdf45('0xdd')](_0x125db2,0x4,_0xdf45('0x9d'));rpcDb['createAgentHistory'](_0x125db2,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xdf45('0xe')]['syncHangup']=function(_0x786b22){var _0x433179=this[_0xdf45('0x15')][_0x786b22['linkedid']];var _0x5ec0a1;if(_0x433179){_0x5ec0a1=this[_0xdf45('0x13')][_0x433179[_0xdf45('0x4a')]];logger[_0xdf45('0x29')](_0xdf45('0x132'),_0x786b22[_0xdf45('0x8d')],'\x20Queue',_0x5ec0a1[_0xdf45('0x2e')],_0xdf45('0x4c'),_0x5ec0a1[_0xdf45('0x32')]);}if(this['actions'][_0x786b22['linkedid']]&&_0x786b22[_0xdf45('0x8d')]!==_0x786b22[_0xdf45('0x93')]){if(_0x786b22[_0xdf45('0x133')]==='16'&&this['actions'][_0x786b22[_0xdf45('0x8d')]][_0xdf45('0x4d')]){this[_0xdf45('0x79')](_0x786b22,_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')]);}else if(this[_0xdf45('0x15')][_0x786b22[_0xdf45('0x8d')]][_0xdf45('0x4d')]){logger[_0xdf45('0x29')](_0xdf45('0x134'),_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')],_0xdf45('0xa2'),_0x5ec0a1['name'],'pTalking:\x20',_0x5ec0a1[_0xdf45('0x32')]);this[_0xdf45('0x79')](_0x786b22,_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')]);}}else if(_0x433179&&_[_0xdf45('0x5f')](_0x433179[_0xdf45('0x135')])&&_0x5ec0a1[_0xdf45('0x136')]&&_0x786b22[_0xdf45('0x8d')]===_0x786b22[_0xdf45('0x93')]&&_[_0xdf45('0x5f')](_0x786b22[_0xdf45('0xdc')])&&_0x786b22[_0xdf45('0x133')]==='16'&&_0x786b22['channelstate']==='6'&&_['isUndefined'](_0x433179[_0xdf45('0x137')])){if(_0x433179[_0xdf45('0x8b')]){rpcDb[_0xdf45('0x101')](_0x433179[_0xdf45('0x8f')]);}if(_0x433179['activeContact']){rpcDb[_0xdf45('0x67')](_0x433179['idContact']);}_0x786b22[_0xdf45('0xdc')]='22';this[_0xdf45('0x131')](_0x433179,_0x5ec0a1,_0x786b22);}else if(_0x433179&&_0x433179[_0xdf45('0x137')]){if(_0x786b22[_0xdf45('0x133')]==='16'&&this[_0xdf45('0x15')][_0x786b22[_0xdf45('0x8d')]][_0xdf45('0x4d')]){logger[_0xdf45('0x29')](_0xdf45('0x138'),_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')],'\x20Queue',_0x5ec0a1[_0xdf45('0x2e')],'pTalking:\x20',_0x5ec0a1[_0xdf45('0x32')]);this[_0xdf45('0x79')](_0x786b22,_0x786b22['linkedid'],_0x786b22[_0xdf45('0x133')]);}else if(this[_0xdf45('0x15')][_0x786b22['linkedid']]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')],'\x20Queue',_0x5ec0a1[_0xdf45('0x2e')],_0xdf45('0x4c'),_0x5ec0a1[_0xdf45('0x32')]);this[_0xdf45('0x79')](_0x786b22,_0x786b22[_0xdf45('0x8d')],_0x786b22[_0xdf45('0x133')]);}}};Preview[_0xdf45('0xe')][_0xdf45('0x1f')]=function(_0x299a47){if(this['actions'][_0x299a47['destlinkedid']]&&_0x299a47[_0xdf45('0xd8')]!==_0x299a47[_0xdf45('0x139')]){this['callProgressDetectingCustomer'](_0x299a47,_0x299a47['destlinkedid'],_0x299a47[_0xdf45('0xcf')]);}};Preview[_0xdf45('0xe')][_0xdf45('0x1d')]=function(_0x5ec46a){if(this[_0xdf45('0x15')][_0x5ec46a[_0xdf45('0x8d')]]&&_0x5ec46a['linkedid']!==_0x5ec46a['uniqueid']&&!this[_0xdf45('0x15')][_0x5ec46a[_0xdf45('0x8d')]]['dialAnswer']){if(_0x5ec46a[_0xdf45('0x133')]==='1'){this['callProgressDetectingCustomer'](_0x5ec46a,_0x5ec46a[_0xdf45('0x8d')],_0x5ec46a[_0xdf45('0x133')]);}}};Preview['prototype'][_0xdf45('0x13a')]=function(_0x20bb71,_0x2282e7,_0x50f24c){if(this[_0xdf45('0x15')][_0x20bb71]){if(_[_0xdf45('0x5f')](this[_0xdf45('0x15')][_0x20bb71][_0xdf45('0x127')])){this['actions'][_0x20bb71][_0xdf45('0x127')]={};}this[_0xdf45('0x15')][_0x20bb71][_0xdf45('0x127')][_0x2282e7]=_0x50f24c;}};Preview['prototype'][_0xdf45('0x22')]=function(_0x230ca2){try{if(!_[_0xdf45('0x5f')](_0x230ca2)){if(ut['filterKey'](_[_0xdf45('0x13b')](_0x230ca2['variable'])[0x0])){this[_0xdf45('0x13a')](_0x230ca2[_0xdf45('0x93')],_[_0xdf45('0x13b')](_0x230ca2[_0xdf45('0x13c')])[0x0],_0x230ca2[_0xdf45('0x13d')]);}}}catch(_0x1e89e2){logger[_0xdf45('0x13e')](_0xdf45('0x13f'),util[_0xdf45('0x140')](_0x1e89e2,{'showHidden':![],'depth':null}));}};Preview[_0xdf45('0xe')][_0xdf45('0x24')]=function(_0x476768){if(_0x476768){if(this['actions'][_0x476768[_0xdf45('0x141')]]){this[_0xdf45('0x15')][_0x476768[_0xdf45('0x141')]][_0xdf45('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5ea19a){if(_0x5ea19a){if(this[_0xdf45('0x15')][_0x5ea19a[_0xdf45('0x142')]]){this['actions'][_0x5ea19a[_0xdf45('0x142')]]['transfer']=!![];}}};module[_0xdf45('0x143')]=Preview; \ No newline at end of file +var _0xf58a=['logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','message','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','then','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','totalGlobal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','additional','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','uniqueid','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','recallme','validateContact','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','filterKey','keys','variable','addVariable','error','inspect','transfertargetlinkedid','transfererlinkedid','lodash','uuid','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','./rpcDb','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','INACTIVE','logger','name','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','prototype','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','type','outbound','recallMe','clearZombieChannel','enqueue','isNil','info','Queue','queue','pTalking:\x20','pTalking','pick','UserId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','scheduledat','dialRecallMeTimeout','Agent','run'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf58a,0xde));var _0xaf58=function(_0x2b2a57,_0xbd2b24){_0x2b2a57=_0x2b2a57-0x0;var _0x1cfdd2=_0xf58a[_0x2b2a57];return _0x1cfdd2;};'use strict';var util=require('util');var _=require(_0xaf58('0x0'));var uuid=require(_0xaf58('0x1'));var moment=require('moment');var Redis=require(_0xaf58('0x2'));var config=require(_0xaf58('0x3'));var logger=require('../../../config/logger')(_0xaf58('0x4'));var loggerAction=require(_0xaf58('0x5'))(_0xaf58('0x6'));var ami=require('../ami');var rpcDb=require(_0xaf58('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xaf58('0x8'));var ut=require(_0xaf58('0x9'));var utils=require(_0xaf58('0xa'));config[_0xaf58('0xb')]=_[_0xaf58('0xc')](config['redis'],{'host':_0xaf58('0xd'),'port':0x18eb});var io=require(_0xaf58('0xe'))(new Redis(config[_0xaf58('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x583e86){this[_0xaf58('0xf')]=this[_0xaf58('0xf')]?this['tail'][_0xaf58('0x10')](_0x583e86):_0x583e86();};function Preview(_0x696594){this[_0xaf58('0x11')]=new Sequence();this[_0xaf58('0x12')]=_0x696594[_0xaf58('0x13')];this[_0xaf58('0x14')]=_0x696594[_0xaf58('0x14')];this[_0xaf58('0x15')]={};this[_0xaf58('0x16')]=_0x696594[_0xaf58('0x16')];this[_0xaf58('0x17')]=0x0;ami['on'](_0xaf58('0x18'),this[_0xaf58('0x19')][_0xaf58('0x1a')](this));ami['on']('hangup',this[_0xaf58('0x1b')][_0xaf58('0x1a')](this));ami['on'](_0xaf58('0x1c'),this[_0xaf58('0x1d')][_0xaf58('0x1a')](this));ami['on'](_0xaf58('0x1e'),this[_0xaf58('0x1f')]['bind'](this));ami['on']('newexten',this[_0xaf58('0x20')][_0xaf58('0x1a')](this));ami['on'](_0xaf58('0x21'),this[_0xaf58('0x22')][_0xaf58('0x1a')](this));ami['on'](_0xaf58('0x23'),this[_0xaf58('0x24')][_0xaf58('0x1a')](this));ami['on'](_0xaf58('0x25'),this['syncBlindTransfer'][_0xaf58('0x1a')](this));this[_0xaf58('0x26')](this[_0xaf58('0x12')]);}function emit(_0x26b6f7,_0x565912,_0x4ee83d){io['to'](_0x26b6f7)[_0xaf58('0x27')](_0x565912,_0x4ee83d);}function emitVoiceQueueChannelRemove(_0x2152e8){logger['info'](_0xaf58('0x28'),JSON[_0xaf58('0x29')](_0x2152e8));emit(util[_0xaf58('0x2a')](_0xaf58('0x2b'),_0x2152e8['name']),_0xaf58('0x2c'),_0x2152e8);io[_0xaf58('0x27')](_0xaf58('0x2d'),_0x2152e8);}function notSendMessagesQueue(_0x188ce4){if(_0x188ce4[_0xaf58('0x2e')]){if(_0x188ce4[_0xaf58('0x2f')]===0x0&&_0x188ce4['pTalking']===0x0){_0x188ce4[_0xaf58('0x2e')]=![];_0x188ce4['available']=0x0;_0x188ce4['paused']=0x0;_0x188ce4['message']=utils['CAMPAIGN_STATUS'][_0xaf58('0x30')];ut[_0xaf58('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x188ce4[_0xaf58('0x32')]+_0xaf58('0x33'));}else{_0x188ce4['message']=utils[_0xaf58('0x34')][_0xaf58('0x35')];ut['logger'](_0xaf58('0x36'),_0x188ce4[_0xaf58('0x32')]+'\x20is\x20deactivated');}}}Preview[_0xaf58('0x37')][_0xaf58('0x26')]=function(){var _0x30c99e=this;setInterval(function(){_0x30c99e[_0xaf58('0x38')]();},0x7cf);};Preview[_0xaf58('0x37')]['syncCampaigns']=function(){var _0x11a7f1=this['campaignsPreview'];this[_0xaf58('0x17')]+=0x1;for(var _0x7cd8ef in _0x11a7f1){if(_0x11a7f1[_0xaf58('0x39')](_0x7cd8ef)&&(_0x11a7f1[_0x7cd8ef][_0xaf58('0x3a')]===_0xaf58('0x4')||_0x11a7f1[_0x7cd8ef]['dialMethod']==='booked')&&_0x11a7f1[_0x7cd8ef]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xaf58('0x17')]=0x0;this[_0xaf58('0x3b')]();}}if(_0x11a7f1[_0xaf58('0x39')](_0x7cd8ef)&&_0x11a7f1[_0x7cd8ef][_0xaf58('0x3a')]===_0xaf58('0x4')&&_0x11a7f1[_0x7cd8ef][_0xaf58('0x3c')]===_0xaf58('0x3d')){if(_0x11a7f1[_0x7cd8ef]['dialActive']){this['setMessage'](_0x11a7f1[_0x7cd8ef]);if(_0x11a7f1[_0x7cd8ef]['dialPreviewAutoRecallMe'])this[_0xaf58('0x3e')](_0x11a7f1[_0x7cd8ef]);}else{notSendMessagesQueue(_0x11a7f1[_0x7cd8ef]);}}}};Preview[_0xaf58('0x37')][_0xaf58('0x3f')]=function(_0xf8acc9){var _0x54624a=this;this[_0xaf58('0x11')][_0xaf58('0x40')](function(){if(!_[_0xaf58('0x41')](_0x54624a[_0xaf58('0x15')][_0xf8acc9])){loggerAction[_0xaf58('0x42')]('[clearZombieChannels][talking]',_0xf8acc9,_0xaf58('0x43'),_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x44')],'originated:\x20',JSON[_0xaf58('0x29')](_0x54624a['campaignsPreview'][_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x44')]][_0xaf58('0x2f')]),_0xaf58('0x45'),JSON['stringify'](_0x54624a[_0xaf58('0x12')][_0x54624a['actions'][_0xf8acc9][_0xaf58('0x44')]][_0xaf58('0x46')]),JSON['stringify'](_0x54624a[_0xaf58('0x15')][_0xf8acc9]['dialAnswer']),JSON[_0xaf58('0x29')](_[_0xaf58('0x47')](_0x54624a[_0xaf58('0x15')][_0xf8acc9],['contactId',_0xaf58('0x48'),'VoiceQueueId','ListId'])));return ami[_0xaf58('0x49')]({'action':_0xaf58('0x4a'),'channel':_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x4b')]})[_0xaf58('0x4c')](function(_0x58dca1){if(_0x58dca1['message']===_0xaf58('0x4d')){setTimeout(function(){if(_0x54624a[_0xaf58('0x15')][_0xf8acc9]){ut[_0xaf58('0x4e')](_0x54624a[_0xaf58('0x12')][_0x54624a['actions'][_0xf8acc9]['queue']],_0xaf58('0x4f'));if(_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x50')]===!![]){ut['decrementTalkink'](_0x54624a[_0xaf58('0x12')][_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x44')]],_0xaf58('0x4f'));ut['loggerError'](_0xaf58('0x51')+_0xf8acc9,_0x54624a['actions'][_0xf8acc9][_0xaf58('0x44')]);}ut[_0xaf58('0x52')](_0xaf58('0x53')+_0xf8acc9,_0x54624a[_0xaf58('0x15')][_0xf8acc9][_0xaf58('0x44')]);delete _0x54624a[_0xaf58('0x15')][_0xf8acc9];}},0x2328);}});}});};Preview['prototype'][_0xaf58('0x3b')]=function(){var _0xd9e1a4=this;loggerAction[_0xaf58('0x42')](_0xaf58('0x54'),_['size'](this[_0xaf58('0x15')]));for(var _0x5329d3 in this['actions']){if(_0xd9e1a4['actions']['hasOwnProperty'](_0x5329d3)){_0xd9e1a4[_0xaf58('0x3f')](_0x5329d3);}}};Preview['prototype'][_0xaf58('0x3e')]=function(_0x38fbca){var _0x4b3c30=this;rpcDb[_0xaf58('0x55')](_0x38fbca['id'],ut[_0xaf58('0x56')](this[_0xaf58('0x16')]))['then'](function(_0x38decc){if(!_[_0xaf58('0x41')](_0x38decc)){for(var _0x574bf7=0x0;_0x574bf7<_0x38decc[_0xaf58('0x57')];_0x574bf7+=0x1){if(ut['getDiff'](_0x38decc[_0x574bf7][_0xaf58('0x58')])<_0x38fbca[_0xaf58('0x59')]*0x3c){if(_0x38decc[_0x574bf7][_0xaf58('0x5a')]&&!_0x38decc[_0x574bf7][_0xaf58('0x5a')]['voicePause']){_0x4b3c30[_0xaf58('0x5b')](_0x38decc[_0x574bf7]['id'])['then'](ut[_0xaf58('0x5c')]('[RecallMe]'))[_0xaf58('0x4c')](ut[_0xaf58('0x5c')](_0xaf58('0x5d')));}else{rpcDb[_0xaf58('0x5e')](_0x38decc[_0x574bf7]['id']);}}else{var _0x4786dd=new Action(_0x38decc[_0x574bf7],_0x38fbca);_0x4786dd['starttime']=moment()[_0xaf58('0x2a')](_0xaf58('0x5f'));_0x38fbca[_0xaf58('0x60')]+=0x1;ut['logCustomer'](_0x4786dd,0x17,'RecallInQueue');if(_0x38fbca[_0xaf58('0x61')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x38decc[_0x574bf7]));rpcDb[_0xaf58('0x62')](_0x4786dd,_0xaf58('0x63'));}else{ut[_0xaf58('0x64')](_0x4786dd,0x16,'RecallFailedTimeout');rpcDb[_0xaf58('0x62')](_0x4786dd,_0xaf58('0x65'));rpcDb['createCustomerFinal'](_0x4786dd,_0xaf58('0x65'));}}}}})['catch'](ut['logger2'](_0xaf58('0x66')));};Preview['prototype'][_0xaf58('0x67')]=function(_0x13441b){_0x13441b[_0xaf58('0x2e')]=!![];if(ut[_0xaf58('0x68')](_0x13441b['loggedIn'])){_0x13441b[_0xaf58('0x69')]=utils[_0xaf58('0x34')][_0xaf58('0x6a')];}else if(!ut[_0xaf58('0x6b')](_0x13441b[_0xaf58('0x6c')])){_0x13441b[_0xaf58('0x69')]=utils['CAMPAIGN_STATUS'][_0xaf58('0x30')];}else if(!this[_0xaf58('0x6d')](_0x13441b[_0xaf58('0x6e')])){if(!this[_0xaf58('0x6d')](_0x13441b[_0xaf58('0x6f')])){_0x13441b[_0xaf58('0x69')]=utils[_0xaf58('0x34')]['UNREACHABLE_TRUNK'];}else{_0x13441b[_0xaf58('0x69')]=utils[_0xaf58('0x34')][_0xaf58('0x70')];}}else{_0x13441b[_0xaf58('0x69')]=utils[_0xaf58('0x34')]['ACTIVE'];}};Preview[_0xaf58('0x37')][_0xaf58('0x71')]=function(_0x1ba78b,_0x34f2e0,_0x1c850c){var _0x4dbe93=this;var _0x22fb04=this['actions'][_0x34f2e0];var _0x40ebae=this[_0xaf58('0x12')][_0x22fb04[_0xaf58('0x44')]];var _0x1b7f30;var _0x5478af=![];var _0xae5645=0x2;var _0x3ac339=0x3;if(_0x40ebae){switch(_0x1c850c){case'1':_0x40ebae[_0xaf58('0x72')]+=0x1;_0x22fb04[_0xaf58('0x73')]+=0x1;_0x22fb04[_0xaf58('0x74')]=ut['totalGlobal'](_0x22fb04);ut['logCustomer'](_0x22fb04,0x0,_0xaf58('0x75'));ami[_0xaf58('0x27')]('custom:agentnosuchnumber',ut['buildObj'](_0x22fb04,_0xaf58('0x76')));rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0x77'));_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'0',_0x40ebae)[_0xaf58('0x79')](function(_0x36c41d){_0x5478af=_0x36c41d['additional']==0x1;_0xae5645=_0x40ebae['dialNoSuchNumberRetryFrequency'];_0x3ac339=_0x40ebae['callAdditionalPhoneAfterMin'];if(!_0x5478af){if(ut['totalGlobal'](_0x22fb04)>=_0x40ebae['dialGlobalMaxRetry']){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0xf,_0xaf58('0x7b'));rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0x7d'));}else{if(_0x22fb04[_0xaf58('0x73')]>=_0x40ebae[_0xaf58('0x7e')]){rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0x7d'));}else{rpcDb[_0xaf58('0x7f')](ut[_0xaf58('0x80')](_0x22fb04,'countnosuchnumberretry',_0x40ebae['dialNoSuchNumberRetryFrequency']),_0x22fb04[_0xaf58('0x81')],_0x22fb04[_0xaf58('0x82')]);}}delete this[_0xaf58('0x15')][_0x1ba78b[_0xaf58('0x83')]];}else{_0x22fb04[_0xaf58('0x73')]++;logger[_0xaf58('0x42')](_0xaf58('0x84'),_0x22fb04[_0xaf58('0x73')]);logger['info']('id',_0x22fb04[_0xaf58('0x85')]);_0x4dbe93[_0xaf58('0x86')]({'id':_0x22fb04[_0xaf58('0x85')],'field':{'countnosuchnumberretry':_0x22fb04[_0xaf58('0x73')]}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});break;case _0xaf58('0x88'):var _0x14849b=moment()[_0xaf58('0x2a')](_0xaf58('0x5f'));_0x22fb04[_0xaf58('0x89')]=_0x14849b;_0x22fb04[_0xaf58('0x8a')]=_0x14849b;_0x22fb04[_0xaf58('0x50')]=!![];_0x40ebae[_0xaf58('0x46')]+=0x1;logger[_0xaf58('0x42')](_0xaf58('0x8b'),_0x22fb04['uniqueid'],_0xaf58('0x8c'),_0x40ebae['name'],'pTalking:\x20',_0x40ebae[_0xaf58('0x46')]);ami['emit'](_0xaf58('0x8d'),ut[_0xaf58('0x8e')](_0x22fb04,_0xaf58('0x8f'),this[_0xaf58('0x12')][_0x22fb04[_0xaf58('0x44')]]));if(_0x40ebae[_0xaf58('0x90')]){ami['emit'](_0xaf58('0x91'),ut['buildAcw'](_0x22fb04));}break;case'16':ami[_0xaf58('0x27')](_0xaf58('0x92'),ut[_0xaf58('0x8e')](_0x22fb04,'complete',this['campaignsPreview'][_0x22fb04[_0xaf58('0x44')]]));emitVoiceQueueChannelRemove(ut[_0xaf58('0x8e')](_0x22fb04,_0xaf58('0x93')));_0x40ebae[_0xaf58('0x94')]+=0x1;_0x40ebae[_0xaf58('0x95')]+=0x1;_0x40ebae[_0xaf58('0x96')]+=0x1;ut[_0xaf58('0x97')](_0x40ebae,_0xaf58('0x98'));_0x22fb04[_0xaf58('0x74')]=ut[_0xaf58('0x99')](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0x4,'Answer');rpcDb[_0xaf58('0x62')](_0x22fb04,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0x9a'));rpcDb[_0xaf58('0x9b')](_0x22fb04);_0x40ebae[_0xaf58('0x9c')]+=_0x22fb04['talktime'];_0x40ebae[_0xaf58('0x9d')]+=_0x22fb04['talktime'];logger['info']('[syncHangup][talking][decrement]',_0x22fb04['uniqueid'],_0xaf58('0x8c'),_0x40ebae[_0xaf58('0x32')],'pTalking:\x20',_0x40ebae[_0xaf58('0x46')]);delete this['actions'][_0x1ba78b['linkedid']];break;case'BUSY':_0x40ebae[_0xaf58('0x9e')]+=0x1;_0x22fb04[_0xaf58('0x9f')]+=0x1;_0x22fb04[_0xaf58('0x74')]=ut[_0xaf58('0x99')](_0x22fb04);ut['logCustomer'](_0x22fb04,0x5,_0xaf58('0xa0'));_0xae5645=_0x40ebae[_0xaf58('0xa1')];_0x3ac339=_0x40ebae[_0xaf58('0xa2')];ami[_0xaf58('0x27')]('custom:agentbusy',ut['buildObj'](_0x22fb04,_0xaf58('0xa3')));rpcDb['createCustomerHistory'](_0x22fb04,_0xaf58('0xa4'));_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'5',_0x40ebae)['then'](function(_0x3b7afa){_0x5478af=_0x3b7afa[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut['totalGlobal'](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut['cloneAction'](_0x22fb04,0xf,'Global');rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0xa7'));}else{if(_0x22fb04['countbusyretry']>=_0x40ebae[_0xaf58('0xa8')]){rpcDb[_0xaf58('0x7c')](_0x22fb04,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xaf58('0x80')](_0x22fb04,_0xaf58('0x9f'),_0x40ebae[_0xaf58('0xa1')]),_0x22fb04[_0xaf58('0x81')],_0x22fb04[_0xaf58('0x82')]);}}}else{_0x22fb04[_0xaf58('0x9f')]++;_0x4dbe93['incrementPreviewCounters']({'id':_0x22fb04['idContact'],'field':{'countbusyretry':_0x22fb04['countbusyretry']}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});break;case'NOANSWER':_0x40ebae[_0xaf58('0xa9')]+=0x1;_0x22fb04[_0xaf58('0xaa')]+=0x1;_0x22fb04['countglobal']=ut[_0xaf58('0x99')](_0x22fb04);ut['logCustomer'](_0x22fb04,0x3,'NoAnswer');_0xae5645=_0x40ebae[_0xaf58('0xab')];_0x3ac339=_0x40ebae[_0xaf58('0xa2')];var _0x58d68f=ut[_0xaf58('0xac')](_0x22fb04,_0x40ebae);ami[_0xaf58('0x27')](_0xaf58('0xad'),_0x58d68f);rpcDb[_0xaf58('0x62')](_0x22fb04,'[callProgressDetectingCustomer][logNoAnswer]');_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'3',_0x40ebae)[_0xaf58('0x79')](function(_0x36fe30){_0x5478af=_0x36fe30[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0xf,_0xaf58('0x7b'));rpcDb['createCustomerFinal'](_0x1b7f30,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x22fb04[_0xaf58('0xaa')]>=_0x40ebae['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x22fb04,_0xaf58('0xae'));}else{rpcDb[_0xaf58('0x7f')](ut['scheduledAt'](_0x22fb04,'countnoanswerretry',_0x40ebae[_0xaf58('0xab')]),_0x22fb04['unlockAgent'],_0x22fb04[_0xaf58('0x82')]);}}}else{_0x22fb04[_0xaf58('0xaa')]++;_0x4dbe93['incrementPreviewCounters']({'id':_0x22fb04[_0xaf58('0x85')],'field':{'countnoanswerretry':_0x22fb04['countnoanswerretry']}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});break;case _0xaf58('0xaf'):_0x40ebae['outboundCongestionCallsDay']+=0x1;_0x22fb04[_0xaf58('0xb0')]+=0x1;_0x22fb04[_0xaf58('0x74')]=ut['totalGlobal'](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0x8,_0xaf58('0xb1'));_0xae5645=_0x40ebae['dialCongestionRetryFrequency'];_0x3ac339=_0x40ebae[_0xaf58('0xa2')];ami[_0xaf58('0x27')](_0xaf58('0xb2'),ut[_0xaf58('0x8e')](_0x22fb04,_0xaf58('0xb3')));rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0xb4'));_0x4dbe93['verifyAdditionalPhones'](_0x22fb04,'8',_0x40ebae)[_0xaf58('0x79')](function(_0x2bba05){_0x5478af=_0x2bba05[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0xf,_0xaf58('0x7b'));rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0xb5'));}else{if(_0x22fb04[_0xaf58('0xb0')]>=_0x40ebae[_0xaf58('0xb6')]){rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0xb4'));}else{rpcDb[_0xaf58('0x7f')](ut[_0xaf58('0x80')](_0x22fb04,'countcongestionretry',_0x40ebae[_0xaf58('0xa1')]),_0x22fb04['unlockAgent'],_0x22fb04[_0xaf58('0x82')]);}}}else{_0x22fb04[_0xaf58('0xb0')]++;_0x4dbe93['incrementPreviewCounters']({'id':_0x22fb04['idContact'],'field':{'countcongestionretry':_0x22fb04[_0xaf58('0xb0')]}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)['then'](function(){});});}});break;case _0xaf58('0xb7'):_0x40ebae['outboundRejectCallsDay']+=0x1;_0x22fb04['countagentrejectretry']+=0x1;_0x22fb04[_0xaf58('0x74')]=ut[_0xaf58('0x99')](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0x14,_0xaf58('0xb8'));_0xae5645=_0x40ebae[_0xaf58('0xb9')];_0x3ac339=_0x40ebae['callAdditionalPhoneAfterMin'];ami[_0xaf58('0x27')]('custom:agentreject',ut[_0xaf58('0x8e')](_0x22fb04,_0xaf58('0xba')));rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0xbb'));_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'20',_0x40ebae)[_0xaf58('0x79')](function(_0x8246ba){_0x5478af=_0x8246ba[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae['dialGlobalMaxRetry']){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0x14,_0xaf58('0xb8'));rpcDb['createCustomerFinal'](_0x1b7f30,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x22fb04[_0xaf58('0xbc')]>=_0x40ebae['dialAgentRejectMaxRetry']){rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0xbd'));}else{rpcDb[_0xaf58('0x7f')](ut[_0xaf58('0x80')](_0x22fb04,_0xaf58('0xbc'),_0x40ebae[_0xaf58('0xb9')]),_0x22fb04['unlockAgent'],_0x22fb04[_0xaf58('0x82')]);}}}else{_0x22fb04[_0xaf58('0xaa')]++;_0x4dbe93[_0xaf58('0x86')]({'id':_0x22fb04['idContact'],'field':{'countnoanswerretry':_0x22fb04['countnoanswerretry']}})['then'](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});break;case _0xaf58('0xbe'):_0x40ebae[_0xaf58('0xbf')]+=0x1;_0x22fb04[_0xaf58('0xc0')]+=0x1;_0x22fb04[_0xaf58('0x74')]=ut[_0xaf58('0x99')](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0xb,_0xaf58('0xc1'));rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0xc2'));_0x4dbe93['verifyAdditionalPhones'](_0x22fb04,'11',_0x40ebae)[_0xaf58('0x79')](function(_0x4eb67f){_0x5478af=_0x4eb67f[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0xf,_0xaf58('0x7b'));rpcDb['createCustomerFinal'](_0x1b7f30,_0xaf58('0xc2'));}else{if(_0x22fb04[_0xaf58('0xc3')]>=_0x40ebae[_0xaf58('0xc4')]){rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0xc2'));}else{rpcDb[_0xaf58('0x7f')](ut[_0xaf58('0x80')](_0x22fb04,_0xaf58('0xc0'),_0x40ebae['dialAbandonedRetryFrequency']),_0x22fb04[_0xaf58('0x81')],_0x22fb04[_0xaf58('0x82')]);}}}else{_0x22fb04[_0xaf58('0xaa')]++;_0x4dbe93[_0xaf58('0x86')]({'id':_0x22fb04[_0xaf58('0x85')],'field':{'countnoanswerretry':_0x22fb04[_0xaf58('0xaa')]}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});break;case'18':_0x40ebae[_0xaf58('0xc5')]+=0x1;_0x22fb04[_0xaf58('0xc6')]+=0x1;_0x22fb04['countglobal']=ut[_0xaf58('0x99')](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0x12,_0x1ba78b['cause-txt']||_0x1ba78b[_0xaf58('0xc7')]);ami[_0xaf58('0x27')]('custom:amd',ut[_0xaf58('0x8e')](_0x22fb04,'amd'));rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0xc8'));_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'18',_0x40ebae)['then'](function(_0x5ca7d7){_0x5478af=_0x5ca7d7[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut['cloneAction'](_0x22fb04,0x12,_0xaf58('0x7b'));rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0xc8'));}else{rpcDb[_0xaf58('0x7c')](_0x22fb04,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x22fb04['countnoanswerretry']++;_0x4dbe93['incrementPreviewCounters']({'id':_0x22fb04['idContact'],'field':{'countnoanswerretry':_0x22fb04[_0xaf58('0xaa')]}})[_0xaf58('0x79')](function(){_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});});}});delete this[_0xaf58('0x15')][_0x1ba78b[_0xaf58('0x83')]];break;case'19':_0x40ebae[_0xaf58('0xc5')]+=0x1;_0x22fb04[_0xaf58('0x74')]=ut[_0xaf58('0x99')](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0x13,_0x1ba78b[_0xaf58('0xc9')]||_0x1ba78b['dialstatus']);ami[_0xaf58('0x27')]('custom:amd',ut[_0xaf58('0x8e')](_0x22fb04,_0xaf58('0xca')));rpcDb[_0xaf58('0x62')](_0x22fb04,'[callProgressDetectingCustomer][machine]');_0x4dbe93['verifyAdditionalPhones'](_0x22fb04,'18',_0x40ebae)[_0xaf58('0x79')](function(_0x1b46a8){_0x5478af=_0x1b46a8['additional']==0x1;if(!_0x5478af){if(ut['totalGlobal'](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut['cloneAction'](_0x22fb04,0xf,_0xaf58('0x7b'));rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0xcb'));}else{rpcDb[_0xaf58('0x7c')](_0x22fb04,_0xaf58('0xcb'));}}else{_0x22fb04[_0xaf58('0xaa')]++;_0x4dbe93['incrementPreviewCounters']({'id':_0x22fb04[_0xaf58('0x85')],'field':{'countnoanswerretry':_0x22fb04[_0xaf58('0xaa')]}})[_0xaf58('0x79')](function(){_0x4dbe93['swapAdditionalPhones'](_0x22fb04,_0xae5645,_0x3ac339)['then'](function(){});});}});delete this[_0xaf58('0x15')][_0x1ba78b[_0xaf58('0x83')]];break;default:if(_0x22fb04[_0xaf58('0x50')]){ut[_0xaf58('0x97')](_0x40ebae,_0xaf58('0xcc'));ut['loggerError'](_0xaf58('0xcd')+_0x40ebae[_0xaf58('0x32')],_0x1ba78b);}_0x40ebae['outboundUnknownCallsDay']+=0x1;_0x22fb04[_0xaf58('0x74')]=ut['totalGlobal'](_0x22fb04);ut[_0xaf58('0x64')](_0x22fb04,0xc,_0x1ba78b['cause-txt']||_0x1ba78b[_0xaf58('0xc7')]);_0xae5645=_0x40ebae[_0xaf58('0xb9')];_0x3ac339=_0x40ebae[_0xaf58('0xa2')];rpcDb[_0xaf58('0x62')](_0x22fb04,_0xaf58('0xce'));_0x4dbe93[_0xaf58('0x78')](_0x22fb04,'20',_0x40ebae)[_0xaf58('0x79')](function(_0x235024){_0x5478af=_0x235024[_0xaf58('0xa5')]==0x1;if(!_0x5478af){if(ut[_0xaf58('0x99')](_0x22fb04)>=_0x40ebae[_0xaf58('0xa6')]){_0x1b7f30=ut[_0xaf58('0x7a')](_0x22fb04,0xf,'Global');rpcDb[_0xaf58('0x7c')](_0x1b7f30,_0xaf58('0xcf'));}else{rpcDb['createCustomerFinal'](_0x22fb04,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xaf58('0x15')][_0x1ba78b[_0xaf58('0x83')]];}else{_0x4dbe93[_0xaf58('0x87')](_0x22fb04,_0xae5645,_0x3ac339)[_0xaf58('0x79')](function(){});}});}if(!(_0x22fb04[_0xaf58('0x50')]&&_0x1c850c==='16')){ut['updateOriginated'](_0x40ebae,_0xaf58('0xd0'));logger[_0xaf58('0x42')]('[originated][decrement][callProgressDetectingCustomer]',_0x22fb04[_0xaf58('0xd1')],_0xaf58('0x8c'),_0x40ebae[_0xaf58('0x32')],'originated:\x20',_0x40ebae['originated']);}if(_0x1c850c!=='ANSWER'){delete this['actions'][_0x1ba78b[_0xaf58('0x83')]];delete this[_0xaf58('0x15')][_0x1ba78b[_0xaf58('0xd2')]];}_0x40ebae[_0xaf58('0xd3')]=!![];}};Preview[_0xaf58('0x37')][_0xaf58('0xd4')]=function(_0x53cf83,_0xc6c01d,_0x4a722a){if(_['isUndefined'](_0xc6c01d)&&_0xaf58('0xd5')!==typeof _0xc6c01d){return;}if(_[_0xaf58('0xd6')](_0x4a722a)&&_0xaf58('0xd5')!==typeof _0x4a722a){return;}switch(_0x4a722a[_0xaf58('0xd7')]){case'0':ut[_0xaf58('0xd8')](_0x53cf83,0x0,_0xaf58('0x75'));rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xda'));break;case'3':ut['logAgent'](_0x53cf83,0x3,_0xaf58('0xdb'));rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xdc'));break;case'5':ut[_0xaf58('0xd8')](_0x53cf83,0x5,_0xaf58('0xa0'));rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xdd'));break;case'8':ut['logAgent'](_0x53cf83,0x8,_0xaf58('0xb1'));rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xde'));break;case'22':ut[_0xaf58('0xd8')](_0x53cf83,0x16,_0xaf58('0xdf'));rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xe0'));break;default:ut['logAgent'](_0x53cf83,0xc,_0x4a722a[_0xaf58('0xd7')]);rpcDb[_0xaf58('0xd9')](_0x53cf83,_0xaf58('0xde'));}ut[_0xaf58('0x4e')](_0xc6c01d,_0xaf58('0xe1'));logger['info'](_0xaf58('0xe2'),_0x53cf83[_0xaf58('0xd1')],'\x20Queue',_0xc6c01d[_0xaf58('0x32')],_0xaf58('0xe3'),_0xc6c01d[_0xaf58('0x2f')]);delete this[_0xaf58('0x15')][_0x53cf83[_0xaf58('0xd1')]];};Preview[_0xaf58('0x37')][_0xaf58('0x78')]=function(_0x314400,_0x51c778,_0x14da4c){return cmHopperAdditionalPhone[_0xaf58('0x78')](_0x314400,_0x51c778,_0x14da4c)[_0xaf58('0x4c')](logger[_0xaf58('0x42')]('[verifyAdditionalPhone]\x20'));};Preview[_0xaf58('0x37')][_0xaf58('0x87')]=function(_0xf7b741,_0x3dc192,_0x5476d4){return cmHopperAdditionalPhone[_0xaf58('0x87')](_0xf7b741,_0x3dc192,_0x5476d4)['catch'](logger[_0xaf58('0x42')](_0xaf58('0xe4')));};Preview[_0xaf58('0x37')][_0xaf58('0x86')]=function(_0x136c34){return Promise[_0xaf58('0xe5')]()[_0xaf58('0x79')](cmHopperAdditionalPhone[_0xaf58('0x86')](_0x136c34))[_0xaf58('0x4c')](logger[_0xaf58('0x42')](_0xaf58('0xe6')));};Preview[_0xaf58('0x37')][_0xaf58('0xe7')]=function(_0x4cfec2,_0x1d5a72,_0x83664f,_0xd7fccc,_0x5025b6){var _0x14f977=this;return new Promise(function(_0x19d036,_0x191894){if(_[_0xaf58('0x41')](_0x1d5a72)||_[_0xaf58('0x41')](_0x1d5a72[_0xaf58('0xe8')])||_[_0xaf58('0x41')](_0x1d5a72[_0xaf58('0xe9')])||_[_0xaf58('0x41')](_0x1d5a72[_0xaf58('0xea')])){_0x191894(ut[_0xaf58('0x69')](_0xaf58('0xeb'),_0xd7fccc,_0x5025b6));return;}var _0x27b58e=uuid['v4']();var _0x9861e5=_0x14f977[_0xaf58('0x12')][_0x1d5a72[_0xaf58('0x43')][_0xaf58('0x32')]];var _0x46a377=_0x83664f?_0x14f977[_0xaf58('0x16')][_0x83664f]['id']:undefined;_0x14f977[_0xaf58('0x15')][_0x27b58e]=new Action(_0x1d5a72,_0x9861e5,_0x27b58e,_0x83664f,_0x46a377);var _0x18efdb=_0x14f977[_0xaf58('0x15')][_0x27b58e];_0x18efdb[_0xaf58('0x81')]=_0xd7fccc;_0x18efdb[_0xaf58('0x82')]=_0x5025b6;_0x18efdb['lookAgent']=_0x83664f;if(_[_0xaf58('0xec')](_0x4cfec2)){_0x14f977[_0xaf58('0xed')](_0x18efdb,_0x9861e5,_0x1d5a72,_0x83664f)[_0xaf58('0x79')](function(_0x154ade){logger['info'](_0xaf58('0xee'),'Queue:\x20'+_0x18efdb[_0xaf58('0x44')]+_0xaf58('0xef')+_0x18efdb['idContact'],JSON[_0xaf58('0x29')](_0x154ade));ami[_0xaf58('0x27')]('custom:agentcalled',ut[_0xaf58('0x8e')](_0x18efdb,_0xaf58('0xf0'),_0x14f977[_0xaf58('0x12')][_0x18efdb[_0xaf58('0x44')]]));_0x19d036(ut[_0xaf58('0x69')](_0xaf58('0xf1')));})[_0xaf58('0x4c')](function(_0xd3f20e){ut[_0xaf58('0x31')](_0xaf58('0xf2'),_0xd3f20e);_0x191894(ut['message']('Call\x20failed',_0xd7fccc,_0x5025b6));});}else{_0x9861e5[_0xaf58('0xf3')]+=0x1;ut[_0xaf58('0xf4')](_0x18efdb);rpcDb['createHistory'](_0x18efdb,_0xaf58('0xf5'));delete _0x14f977[_0xaf58('0x15')][_0x27b58e];_0x191894(ut['message'](_0xaf58('0xf6'),_0xd7fccc,_0x5025b6));}});};Preview[_0xaf58('0x37')][_0xaf58('0x6d')]=function(_0x335cd9){return!_[_0xaf58('0x41')](_0x335cd9)&&!_[_0xaf58('0x41')](_0x335cd9[_0xaf58('0x32')])&&!_[_0xaf58('0x41')](_0x335cd9[_0xaf58('0xf7')])&&_0x335cd9[_0xaf58('0xf7')]&&!_[_0xaf58('0x41')](this['trunks'][util[_0xaf58('0x2a')](_0xaf58('0xf8'),_0x335cd9[_0xaf58('0x32')])])&&!_['isNil'](this[_0xaf58('0x14')][util[_0xaf58('0x2a')](_0xaf58('0xf8'),_0x335cd9[_0xaf58('0x32')])][_0xaf58('0x4a')])&&(this['trunks'][util[_0xaf58('0x2a')](_0xaf58('0xf8'),_0x335cd9[_0xaf58('0x32')])][_0xaf58('0x4a')]===_0xaf58('0xf9')||this[_0xaf58('0x14')][util[_0xaf58('0x2a')](_0xaf58('0xf8'),_0x335cd9['name'])][_0xaf58('0x4a')]===_0xaf58('0xfa'));};Preview[_0xaf58('0x37')][_0xaf58('0x5b')]=function(_0x1c01d3,_0x163124){return this['execRun'](_0x1c01d3,_0x163124)[_0xaf58('0x79')](function(_0x41b691){return _[_0xaf58('0x47')](_0x41b691,[_0xaf58('0x69')]);})[_0xaf58('0x4c')](function(_0x2e2ef3){if(_0x2e2ef3[_0xaf58('0xfb')]){rpcDb[_0xaf58('0xfc')](_0x1c01d3);}if(_0x2e2ef3[_0xaf58('0xf7')]){rpcDb['disableContact'](_0x1c01d3);}throw _[_0xaf58('0x47')](_0x2e2ef3,[_0xaf58('0x69')]);});};Preview[_0xaf58('0x37')][_0xaf58('0xfd')]=function(_0xa039a3,_0x33602a){var _0x588003=this;var _0x523301,_0x3dcdf0;return rpcDb['getContactPreview'](_0xa039a3)[_0xaf58('0x79')](function(_0xc1af0d){if(!_['isNil'](_0xc1af0d[0x0])){_0x3dcdf0=_0xc1af0d[0x0][_0xaf58('0xfe')]?![]:!![];_0x523301=_0xc1af0d[0x0]['recallme']?!![]:![];_0x523301=_0x33602a?!![]:_0x523301;}var _0x1e2c19=_0x588003[_0xaf58('0xff')](_0xc1af0d);if(_0x1e2c19['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0xc1af0d[0x0],[_0xaf58('0xea'),'phone']))[_0xaf58('0x79')](function(_0x3aaa64){_0x588003[_0xaf58('0xe7')](_0x3aaa64,_0xc1af0d[0x0],_0x33602a,_0x3dcdf0,_0x523301)['then'](function(_0xc9accc){return _0xc9accc;})[_0xaf58('0x4c')](function(_0x349d81){throw _0x349d81;});})[_0xaf58('0x4c')](function(_0x358c2e){ut[_0xaf58('0x31')]('[Preview][checkIsBlackList]',_0x358c2e);throw ut[_0xaf58('0x69')](_0xaf58('0x100'),_0x3dcdf0,_0x523301);});}else{throw ut[_0xaf58('0x69')](_0x1e2c19[_0xaf58('0x69')],_0x3dcdf0,_0x523301);}})[_0xaf58('0x4c')](function(_0x256500){ut[_0xaf58('0x31')](_0xaf58('0x101'),_0x256500);throw ut['message'](_0xaf58('0x100'),![],!![]);});};Preview[_0xaf58('0x37')]['validateContact']=function(_0x572544){if(_[_0xaf58('0x41')](_0x572544)||_[_0xaf58('0xec')](_0x572544)||!_[_0xaf58('0x41')](_0x572544[0x0][_0xaf58('0x5a')])&&_[_0xaf58('0x41')](_0x572544[0x0][_0xaf58('0x5a')][_0xaf58('0x32')])){ut[_0xaf58('0x31')](_0xaf58('0x102'),_0x572544);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x35c852=this[_0xaf58('0x12')][_0x572544[0x0][_0xaf58('0x43')][_0xaf58('0x32')]];_0x35c852[_0xaf58('0x69')]=utils[_0xaf58('0x34')][_0xaf58('0x70')];if(_[_0xaf58('0x41')](_0x35c852)){ut[_0xaf58('0x31')](_0xaf58('0x103'),_0x35c852);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x35c852[_0xaf58('0x6e')])){ut[_0xaf58('0x31')](_0xaf58('0x104'),_0xaf58('0x105')+_0x35c852['name']+_0xaf58('0x106'));if(!this[_0xaf58('0x6d')](_0x35c852['TrunkBackup'])){ut['logger'](_0xaf58('0x104'),_0x35c852[_0xaf58('0x32')]+_0xaf58('0x107'));return{'isValid':![],'message':_0xaf58('0x108')};}}if(!ut[_0xaf58('0x6b')](_0x35c852[_0xaf58('0x6c')])){ut[_0xaf58('0x31')]('[Preview][validateContact][Campaign\x20Active]',_0x35c852['name']+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x35c852[_0xaf58('0x32')]+_0xaf58('0x109')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xaf58('0x37')][_0xaf58('0xed')]=function(_0x49e29b,_0xcc30a1,_0x5543c4,_0x5e5deb){var _0x194bff=this;return new Promise(function(_0x4afbf9,_0x46ab64){var _0x3859ef=_0x49e29b[_0xaf58('0xd1')];var _0x52cf4a=_0x194bff[_0xaf58('0x6d')](_0xcc30a1[_0xaf58('0x6e')])?util['format'](_0xaf58('0x10a'),_0xcc30a1[_0xaf58('0x6e')][_0xaf58('0x32')],_[_0xaf58('0x41')](_0xcc30a1[_0xaf58('0x10b')])?'':_0xcc30a1[_0xaf58('0x10b')][_0xaf58('0x10c')]()||'',_0xcc30a1[_0xaf58('0x10d')]>0x0?_0x5543c4['phone'][_0xaf58('0x10e')](_0xcc30a1[_0xaf58('0x10d')]):_0x5543c4['phone']):util[_0xaf58('0x2a')]('SIP/%s/%s%s',_[_0xaf58('0x41')](_0xcc30a1[_0xaf58('0x6f')])?_0xcc30a1['Trunk'][_0xaf58('0x32')]:_0xcc30a1[_0xaf58('0x6f')]['name'],_['isNil'](_0xcc30a1[_0xaf58('0x10b')])?'':_0xcc30a1['dialPrefix'][_0xaf58('0x10c')]()||'',_0xcc30a1[_0xaf58('0x10d')]>0x0?_0x5543c4[_0xaf58('0xe9')][_0xaf58('0x10e')](_0xcc30a1[_0xaf58('0x10d')]):_0x5543c4[_0xaf58('0xe9')]);var _0xf5191f=_0x194bff['isTrunkReachable'](_0xcc30a1[_0xaf58('0x6e')])?ut[_0xaf58('0x10f')](_0xcc30a1[_0xaf58('0x6e')][_0xaf58('0x110')],_0xcc30a1['dialOriginateCallerIdName'],_0xcc30a1[_0xaf58('0x111')]>0x0?ut[_0xaf58('0x112')](_0xcc30a1[_0xaf58('0x113')],_0xcc30a1[_0xaf58('0x111')]):_0xcc30a1[_0xaf58('0x113')]):ut[_0xaf58('0x10f')](_[_0xaf58('0x41')](_0xcc30a1['TrunkBackup'])?_0xcc30a1[_0xaf58('0x6e')]['callerid']:_0xcc30a1['TrunkBackup'][_0xaf58('0x110')],_0xcc30a1[_0xaf58('0x114')],_0xcc30a1[_0xaf58('0x111')]>0x0?ut['getCallerIdRandom'](_0xcc30a1[_0xaf58('0x113')],_0xcc30a1[_0xaf58('0x111')]):_0xcc30a1[_0xaf58('0x113')]);if(_0xf5191f){_0x49e29b[_0xaf58('0x115')]=ut['extractCalleridName'](_0xf5191f);_0x49e29b[_0xaf58('0x116')]=ut[_0xaf58('0x117')](_0xf5191f);}var _0xbe3d50=ut[_0xaf58('0x118')](_0xcc30a1,_0x5543c4,_0x52cf4a,_0xf5191f,_0x3859ef,_0x49e29b);var _0x22ee9d=utils['setXMDContactVariables'](_0x5543c4[_0xaf58('0xe8')]);Object[_0xaf58('0x119')](_0xbe3d50,_0x22ee9d);_[_0xaf58('0x11a')](_0x49e29b,ut[_0xaf58('0x11b')](_0xbe3d50));_0x49e29b[_0xaf58('0x11c')]=moment()[_0xaf58('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0xcc30a1[_0xaf58('0x11d')]=_0xbe3d50;var _0x5ec587=ut[_0xaf58('0x11e')](_0x49e29b,_0xcc30a1,_0xbe3d50,_0x49e29b[_0xaf58('0x82')],_0x5e5deb);return ami['Action'](_0x5ec587)[_0xaf58('0x79')](function(_0x3eb12b){_0xcc30a1[_0xaf58('0x2f')]+=0x1;logger[_0xaf58('0x42')](_0xaf58('0x11f'),_0x3859ef,_0xaf58('0x8c'),_0xcc30a1[_0xaf58('0x32')],_0xaf58('0xe3'),_0xcc30a1[_0xaf58('0x2f')]);_0x4afbf9(_0x3eb12b);})[_0xaf58('0x4c')](function(_0x379db3){ut['logAgent'](_0x49e29b,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x49e29b,_0xaf58('0x120'));_0x46ab64(_0x379db3);});});};Preview['prototype'][_0xaf58('0x20')]=function(_0x1153e7){if(this['actions'][_0x1153e7['linkedid']]){this[_0xaf58('0x15')][_0x1153e7[_0xaf58('0x83')]][_0xaf58('0x4b')]=_0x1153e7['channel'];}};Preview[_0xaf58('0x37')][_0xaf58('0x19')]=function(_0x363e14){var _0xf0eebd=this;var _0x53be14=this[_0xaf58('0x15')][_0x363e14[_0xaf58('0x121')]];if(_0x53be14){if(_0x53be14[_0xaf58('0x122')]&&this[_0xaf58('0x16')][_0x53be14[_0xaf58('0x122')]]){ut['logLookAgent'](_0x53be14,this[_0xaf58('0x16')][_0x53be14[_0xaf58('0x122')]][_0xaf58('0x32')],this[_0xaf58('0x16')][_0x53be14[_0xaf58('0x122')]]['id']);}var _0x12ce1a=_[_0xaf58('0x123')](_0x53be14);_0x12ce1a[_0xaf58('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x425e05=_0xf0eebd[_0xaf58('0x12')][_0x53be14[_0xaf58('0x44')]];if(ut[_0xaf58('0x124')](_0x363e14[_0xaf58('0x125')])){if(_0x53be14[_0xaf58('0x81')]){rpcDb[_0xaf58('0xfc')](_0x53be14[_0xaf58('0x85')]);}if(_0x53be14[_0xaf58('0x82')]){rpcDb[_0xaf58('0x5e')](_0x53be14[_0xaf58('0x85')]);}ami[_0xaf58('0x27')](_0xaf58('0x126'),ut[_0xaf58('0x8e')](_0x53be14,_0xaf58('0x127'),this[_0xaf58('0x12')][_0x53be14['queue']]));this[_0xaf58('0xd4')](_0x12ce1a,_0x425e05,_0x363e14);}else{_0x53be14['starttime']=moment()['format'](_0xaf58('0x5f'));ut[_0xaf58('0xd8')](_0x12ce1a,0x4,_0xaf58('0x128'));rpcDb[_0xaf58('0xd9')](_0x12ce1a,_0xaf58('0x129'));}}};Preview[_0xaf58('0x37')][_0xaf58('0x1b')]=function(_0x561144){var _0x3cb295=this[_0xaf58('0x15')][_0x561144[_0xaf58('0x83')]];var _0x273364;if(_0x3cb295){_0x273364=this['campaignsPreview'][_0x3cb295[_0xaf58('0x44')]];logger[_0xaf58('0x42')](_0xaf58('0x12a'),_0x561144[_0xaf58('0x83')],_0xaf58('0x8c'),_0x273364['name'],_0xaf58('0x45'),_0x273364[_0xaf58('0x46')]);}if(this[_0xaf58('0x15')][_0x561144['linkedid']]&&_0x561144[_0xaf58('0x83')]!==_0x561144['uniqueid']){if(_0x561144[_0xaf58('0x12b')]==='16'&&this[_0xaf58('0x15')][_0x561144[_0xaf58('0x83')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x561144,_0x561144['linkedid'],_0x561144[_0xaf58('0x12b')]);}else if(this[_0xaf58('0x15')][_0x561144['linkedid']]['dialAnswer']){logger[_0xaf58('0x42')](_0xaf58('0x12c'),_0x561144[_0xaf58('0x83')],_0x561144[_0xaf58('0x12b')],_0xaf58('0x8c'),_0x273364[_0xaf58('0x32')],_0xaf58('0x45'),_0x273364[_0xaf58('0x46')]);this['callProgressDetectingCustomer'](_0x561144,_0x561144[_0xaf58('0x83')],_0x561144[_0xaf58('0x12b')]);}}else if(_0x3cb295&&_['isNil'](_0x3cb295['statedesc'])&&_0x273364[_0xaf58('0x12d')]&&_0x561144[_0xaf58('0x83')]===_0x561144[_0xaf58('0xd1')]&&_[_0xaf58('0x41')](_0x561144[_0xaf58('0xd7')])&&_0x561144[_0xaf58('0x12b')]==='16'&&_0x561144[_0xaf58('0x12e')]==='6'&&_[_0xaf58('0xd6')](_0x3cb295[_0xaf58('0x12f')])){if(_0x3cb295[_0xaf58('0x81')]){rpcDb[_0xaf58('0xfc')](_0x3cb295['idContact']);}if(_0x3cb295[_0xaf58('0x82')]){rpcDb[_0xaf58('0x5e')](_0x3cb295[_0xaf58('0x85')]);}_0x561144[_0xaf58('0xd7')]='22';this[_0xaf58('0xd4')](_0x3cb295,_0x273364,_0x561144);}else if(_0x3cb295&&_0x3cb295[_0xaf58('0x12f')]){if(_0x561144[_0xaf58('0x12b')]==='16'&&this[_0xaf58('0x15')][_0x561144[_0xaf58('0x83')]]['dialAnswer']){logger['info'](_0xaf58('0x130'),_0x561144[_0xaf58('0x83')],_0x561144[_0xaf58('0x12b')],'\x20Queue',_0x273364[_0xaf58('0x32')],_0xaf58('0x45'),_0x273364[_0xaf58('0x46')]);this[_0xaf58('0x71')](_0x561144,_0x561144[_0xaf58('0x83')],_0x561144['cause']);}else if(this[_0xaf58('0x15')][_0x561144['linkedid']][_0xaf58('0x50')]){logger[_0xaf58('0x42')](_0xaf58('0x12c'),_0x561144[_0xaf58('0x83')],_0x561144['cause'],_0xaf58('0x8c'),_0x273364[_0xaf58('0x32')],_0xaf58('0x45'),_0x273364[_0xaf58('0x46')]);this[_0xaf58('0x71')](_0x561144,_0x561144[_0xaf58('0x83')],_0x561144['cause']);}}};Preview[_0xaf58('0x37')][_0xaf58('0x1f')]=function(_0x4d5e3c){if(this[_0xaf58('0x15')][_0x4d5e3c[_0xaf58('0xd2')]]&&_0x4d5e3c[_0xaf58('0xd2')]!==_0x4d5e3c[_0xaf58('0x131')]){this[_0xaf58('0x71')](_0x4d5e3c,_0x4d5e3c[_0xaf58('0xd2')],_0x4d5e3c[_0xaf58('0xc7')]);}};Preview[_0xaf58('0x37')][_0xaf58('0x1d')]=function(_0x3cfe00){if(this['actions'][_0x3cfe00[_0xaf58('0x83')]]&&_0x3cfe00['linkedid']!==_0x3cfe00[_0xaf58('0xd1')]&&!this['actions'][_0x3cfe00[_0xaf58('0x83')]][_0xaf58('0x50')]){if(_0x3cfe00['cause']==='1'){this['callProgressDetectingCustomer'](_0x3cfe00,_0x3cfe00[_0xaf58('0x83')],_0x3cfe00[_0xaf58('0x12b')]);}}};Preview[_0xaf58('0x37')]['addVariable']=function(_0x5921e4,_0x3e3d3b,_0x2c1f0c){if(this[_0xaf58('0x15')][_0x5921e4]){if(_['isNil'](this[_0xaf58('0x15')][_0x5921e4][_0xaf58('0x11d')])){this[_0xaf58('0x15')][_0x5921e4][_0xaf58('0x11d')]={};}this[_0xaf58('0x15')][_0x5921e4][_0xaf58('0x11d')][_0x3e3d3b]=_0x2c1f0c;}};Preview['prototype'][_0xaf58('0x22')]=function(_0x436339){try{if(!_[_0xaf58('0x41')](_0x436339)){if(ut[_0xaf58('0x132')](_[_0xaf58('0x133')](_0x436339[_0xaf58('0x134')])[0x0])){this[_0xaf58('0x135')](_0x436339['uniqueid'],_[_0xaf58('0x133')](_0x436339[_0xaf58('0x134')])[0x0],_0x436339['value']);}}}catch(_0x187afa){logger[_0xaf58('0x136')]('[syncVarSet][Preview]',util[_0xaf58('0x137')](_0x187afa,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x2c053d){if(_0x2c053d){if(this[_0xaf58('0x15')][_0x2c053d[_0xaf58('0x138')]]){this[_0xaf58('0x15')][_0x2c053d['transfertargetlinkedid']][_0xaf58('0x12f')]=!![];}}};Preview[_0xaf58('0x37')]['syncBlindTransfer']=function(_0x35c1e9){if(_0x35c1e9){if(this[_0xaf58('0x15')][_0x35c1e9[_0xaf58('0x139')]]){this['actions'][_0x35c1e9[_0xaf58('0x139')]][_0xaf58('0x12f')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 993e3de..1dc53db 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 _0x5e16=['[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','[createHistory]\x20','resolve','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue'];(function(_0x3bbad5,_0x39f834){var _0x338d99=function(_0x8ffdc9){while(--_0x8ffdc9){_0x3bbad5['push'](_0x3bbad5['shift']());}};_0x338d99(++_0x39f834);}(_0x5e16,0x9d));var _0x65e1=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x5e16[_0x4d21ff];return _0x22b554;};'use strict';var util=require(_0x65e1('0x0'));var BPromise=require(_0x65e1('0x1'));var logger=require('../../../config/logger')(_0x65e1('0x2'));var cmHopper=require(_0x65e1('0x3'));var cmHopperHistory=require(_0x65e1('0x4'));var cmHopperBlack=require(_0x65e1('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x65e1('0x6'));function loggerCatch(_0x12f1fc){return function(_0x42602e){logger['error'](_0x12f1fc,util[_0x65e1('0x7')](_0x42602e,{'showHidden':![],'depth':null}));};}function create(_0x51852f){return cmHopperHistory['createHistory'](_0x51852f)['catch'](loggerCatch(_0x65e1('0x8')));}function createAgent(_0x58f7eb){return BPromise[_0x65e1('0x9')]()['then'](agentReportPreview['createHistory'](_0x58f7eb))[_0x65e1('0xa')](loggerCatch(_0x65e1('0x8')));}function moveContact(_0x344689){return cmHopper['moveContactManagedDialer'](_0x344689,!![])[_0x65e1('0xa')](loggerCatch(_0x65e1('0xb')));}exports[_0x65e1('0xc')]=function(_0xf57e3a){return cmHopperBlack[_0x65e1('0xc')](_0xf57e3a)['catch'](loggerCatch(_0x65e1('0xd')));};exports[_0x65e1('0xe')]=function(_0x62dcc4){return BPromise[_0x65e1('0x9')]()['then'](cmHopper[_0x65e1('0xe')](_0x62dcc4))['catch'](loggerCatch(_0x65e1('0xf')));};exports['createHistory']=function(_0x30a508,_0x97edd1){create(_0x30a508)[_0x65e1('0xa')](loggerCatch(_0x97edd1));moveContact(_0x30a508)[_0x65e1('0xa')](loggerCatch(_0x97edd1));};exports[_0x65e1('0x10')]=function(_0x27a3c6,_0xeb75e5){createAgent(_0x27a3c6)[_0x65e1('0xa')](loggerCatch(_0xeb75e5));};exports[_0x65e1('0x11')]=function(_0x20567a,_0x5d3260){create(_0x20567a)[_0x65e1('0xa')](loggerCatch(_0x5d3260));};exports['createCustomerFinal']=function(_0x396c61,_0x2e72c0){moveContact(_0x396c61)[_0x65e1('0xa')](loggerCatch(_0x2e72c0));};exports[_0x65e1('0x12')]=function(_0x138d38,_0x37e3e1,_0xdeaa61){if(_0x37e3e1){_0x138d38[_0x65e1('0x13')]=null;}if(_0xdeaa61){_0x138d38['active']=![];}return cmHopper[_0x65e1('0x12')](_0x138d38)[_0x65e1('0xa')](loggerCatch(_0x65e1('0x14')));};exports['countReScheduled']=function(_0x333bc9){return cmHopper[_0x65e1('0x15')](_0x333bc9)[_0x65e1('0xa')](loggerCatch(_0x65e1('0x16')));};exports['unlockContact']=function(_0x113376){return cmHopper[_0x65e1('0x17')]({'UserId':null},_0x113376,0x1)[_0x65e1('0xa')](loggerCatch(_0x65e1('0x18')));};exports[_0x65e1('0x19')]=function(_0x3f6f87){return cmHopper[_0x65e1('0x17')]({'active':![]},_0x3f6f87,0x1)['catch'](loggerCatch(_0x65e1('0x1a')));};exports['crateCustomerReportQueue']=function(_0x4e9f75){var _0x449c75={};_0x449c75[_0x65e1('0x1b')]=_0x4e9f75[_0x65e1('0x1b')];_0x449c75[_0x65e1('0x1c')]=_0x4e9f75['uniqueid'];_0x449c75[_0x65e1('0x1d')]=_0x4e9f75['calleridnum'];_0x449c75[_0x65e1('0x1e')]=_0x4e9f75[_0x65e1('0x1e')];_0x449c75[_0x65e1('0x1f')]=_0x4e9f75[_0x65e1('0x1f')];_0x449c75[_0x65e1('0x20')]=_0x4e9f75[_0x65e1('0x21')];_0x449c75[_0x65e1('0x22')]=_0x4e9f75['answertime'];_0x449c75[_0x65e1('0x23')]=0x1;_0x449c75[_0x65e1('0x24')]=_0x4e9f75[_0x65e1('0x25')];_0x449c75[_0x65e1('0x26')]=_0x4e9f75['membername'];_0x449c75[_0x65e1('0x27')]=_0x65e1('0x28');_0x449c75[_0x65e1('0x29')]=_0x65e1('0x2a');_0x449c75['holdtime']=0x0;_0x449c75[_0x65e1('0x2b')]=0x1;_0x449c75[_0x65e1('0x2c')]=_0x4e9f75[_0x65e1('0x2d')];_0x449c75['queuecallerexitreason']=_0x65e1('0x2e');return BPromise[_0x65e1('0x9')]()['then'](voiceQueueReport[_0x65e1('0x2f')](_0x449c75))[_0x65e1('0xa')](loggerCatch(_0x65e1('0x30')));};exports['getContactRecallMe']=function(_0x513d0a,_0x13d951){return BPromise['resolve']()['then'](cmHopper[_0x65e1('0x31')](_0x513d0a,_0x13d951))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x65e1('0x32')]=function(_0x3943c5){return cmHopper[_0x65e1('0x12')](_0x3943c5,!![],!![])[_0x65e1('0xa')](loggerCatch(_0x65e1('0x33')));}; \ No newline at end of file +var _0x5ce3=['UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact'];(function(_0x12551a,_0x5af080){var _0x6f8fc0=function(_0xe92756){while(--_0xe92756){_0x12551a['push'](_0x12551a['shift']());}};_0x6f8fc0(++_0x5af080);}(_0x5ce3,0x1ce));var _0x35ce=function(_0x30fdf9,_0x89096d){_0x30fdf9=_0x30fdf9-0x0;var _0x3c43bb=_0x5ce3[_0x30fdf9];return _0x3c43bb;};'use strict';var util=require(_0x35ce('0x0'));var BPromise=require(_0x35ce('0x1'));var logger=require(_0x35ce('0x2'))(_0x35ce('0x3'));var cmHopper=require(_0x35ce('0x4'));var cmHopperHistory=require(_0x35ce('0x5'));var cmHopperBlack=require(_0x35ce('0x6'));var agentReportPreview=require(_0x35ce('0x7'));var voiceQueueReport=require(_0x35ce('0x8'));function loggerCatch(_0x26618f){return function(_0x5e91c6){logger[_0x35ce('0x9')](_0x26618f,util[_0x35ce('0xa')](_0x5e91c6,{'showHidden':![],'depth':null}));};}function create(_0xd8483f){return cmHopperHistory[_0x35ce('0xb')](_0xd8483f)[_0x35ce('0xc')](loggerCatch(_0x35ce('0xd')));}function createAgent(_0x235dbd){return BPromise[_0x35ce('0xe')]()[_0x35ce('0xf')](agentReportPreview[_0x35ce('0xb')](_0x235dbd))[_0x35ce('0xc')](loggerCatch(_0x35ce('0xd')));}function moveContact(_0x4416d5){return cmHopper['moveContactManagedDialer'](_0x4416d5,!![])[_0x35ce('0xc')](loggerCatch(_0x35ce('0x10')));}exports['checkIsBlackList']=function(_0x29fa6b){return cmHopperBlack[_0x35ce('0x11')](_0x29fa6b)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x35ce('0x12')]=function(_0x5be6ef){return BPromise['resolve']()['then'](cmHopper[_0x35ce('0x12')](_0x5be6ef))[_0x35ce('0xc')](loggerCatch(_0x35ce('0x13')));};exports['createHistory']=function(_0x238805,_0x9c156f){create(_0x238805)['catch'](loggerCatch(_0x9c156f));moveContact(_0x238805)[_0x35ce('0xc')](loggerCatch(_0x9c156f));};exports[_0x35ce('0x14')]=function(_0x1ca985,_0x26dd42){createAgent(_0x1ca985)[_0x35ce('0xc')](loggerCatch(_0x26dd42));};exports[_0x35ce('0x15')]=function(_0x37a0c0,_0x50ade1){create(_0x37a0c0)[_0x35ce('0xc')](loggerCatch(_0x50ade1));};exports[_0x35ce('0x16')]=function(_0x16800a,_0x485353){moveContact(_0x16800a)[_0x35ce('0xc')](loggerCatch(_0x485353));};exports[_0x35ce('0x17')]=function(_0x243830,_0x3edb61,_0x86c5cf){if(_0x3edb61){_0x243830[_0x35ce('0x18')]=null;}if(_0x86c5cf){_0x243830[_0x35ce('0x19')]=![];}return cmHopper[_0x35ce('0x17')](_0x243830)['catch'](loggerCatch(_0x35ce('0x1a')));};exports['countReScheduled']=function(_0x13aaf8){return cmHopper[_0x35ce('0x1b')](_0x13aaf8)['catch'](loggerCatch(_0x35ce('0x1c')));};exports[_0x35ce('0x1d')]=function(_0x2b8542){return cmHopper[_0x35ce('0x1d')]({'UserId':null},_0x2b8542,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x35ce('0x1e')]=function(_0x4a9bd8){return cmHopper['unlockContact']({'active':![]},_0x4a9bd8,0x1)[_0x35ce('0xc')](loggerCatch(_0x35ce('0x1f')));};exports['crateCustomerReportQueue']=function(_0x15e6a1){var _0x162e2d={};_0x162e2d['type']=_0x15e6a1[_0x35ce('0x20')];_0x162e2d['uniqueid']=_0x15e6a1[_0x35ce('0x21')];_0x162e2d[_0x35ce('0x22')]=_0x15e6a1[_0x35ce('0x22')];_0x162e2d[_0x35ce('0x23')]=_0x15e6a1[_0x35ce('0x23')];_0x162e2d[_0x35ce('0x24')]=_0x15e6a1[_0x35ce('0x24')];_0x162e2d[_0x35ce('0x25')]=_0x15e6a1[_0x35ce('0x26')];_0x162e2d['queuecallerleaveAt']=_0x15e6a1[_0x35ce('0x26')];_0x162e2d[_0x35ce('0x27')]=0x1;_0x162e2d[_0x35ce('0x28')]=_0x15e6a1[_0x35ce('0x29')];_0x162e2d['connectedlinename']=_0x15e6a1[_0x35ce('0x2a')];_0x162e2d['context']=_0x35ce('0x2b');_0x162e2d['exten']=_0x35ce('0x2c');_0x162e2d[_0x35ce('0x2d')]=0x0;_0x162e2d[_0x35ce('0x2e')]=0x1;_0x162e2d['lastAssignedTo']=_0x15e6a1[_0x35ce('0x2a')];_0x162e2d[_0x35ce('0x2f')]=_0x35ce('0x30');return BPromise[_0x35ce('0xe')]()[_0x35ce('0xf')](voiceQueueReport['create'](_0x162e2d))[_0x35ce('0xc')](loggerCatch(_0x35ce('0x31')));};exports[_0x35ce('0x32')]=function(_0x275509,_0x262c53){return BPromise[_0x35ce('0xe')]()['then'](cmHopper[_0x35ce('0x32')](_0x275509,_0x262c53))[_0x35ce('0xc')](loggerCatch(_0x35ce('0x33')));};exports[_0x35ce('0x34')]=function(_0x5b12de){return cmHopper[_0x35ce('0x17')](_0x5b12de,!![],!![])[_0x35ce('0xc')](loggerCatch(_0x35ce('0x35')));}; \ 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 047cd3d..dc65bdd 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 _0x1678=['sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','buildNoAnswerEventPayload','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','endtime','logAgent','state','starttime','logLookAgent','membername','logCustomer','ringtime','talktime','answertime','getSeconds','isFailure','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','buildObj','interface','agentReadyId','not_inuse','status','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countglobal','callback','recallme'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x1678,0x12c));var _0x8167=function(_0x1a433e,_0x4e0317){_0x1a433e=_0x1a433e-0x0;var _0x10f545=_0x1678[_0x1a433e];return _0x10f545;};'use strict';var util=require(_0x8167('0x0'));var _=require('lodash');var moment=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))('preview');var ipAgi=process[_0x8167('0x3')][_0x8167('0x4')]||_0x8167('0x5');var utils=require('../../dialer/utils');exports[_0x8167('0x6')]=function(_0x9c6ab0){return function(_0x459bd6){logger[_0x8167('0x7')](_0x9c6ab0,util[_0x8167('0x8')](_0x459bd6,{'showHidden':![],'depth':null}));};};exports[_0x8167('0x9')]=function(_0x25ffd8,_0x30e724){logger['info'](_0x25ffd8,util['inspect'](_0x30e724,{'showHidden':![],'depth':null}));};exports[_0x8167('0xa')]=function(_0xf2f528,_0x5bbc21){logger[_0x8167('0x7')](_0xf2f528,util[_0x8167('0x8')](_0x5bbc21,{'showHidden':![],'depth':null}));};exports[_0x8167('0xb')]=function(_0x26f47b){return function(_0x4c2cca){logger['info'](_0x26f47b,util['inspect'](_0x4c2cca,{'showHidden':![],'depth':null}));};};exports[_0x8167('0xc')]=function(_0x39aa97,_0x33497d,_0x62d764){return{'message':_0x39aa97,'unlock':_0x33497d,'active':_0x62d764};};exports[_0x8167('0xd')]=function(_0x517b3c,_0x710289,_0x453512){if(!_[_0x8167('0xe')](_0x453512)&&_0x8167('0xf')===typeof _0x453512&&!_[_0x8167('0x10')](_0x453512)){if(!_['isUndefined'](_0x710289)&&_0x8167('0xf')===typeof _0x710289&&!_[_0x8167('0x10')](_0x710289)){return util[_0x8167('0x11')]('\x22%s\x22\x20<%s>',_0x710289,_0x453512);}return util[_0x8167('0x11')](_0x8167('0x12'),_0x453512,_0x453512);}if(!_[_0x8167('0xe')](_0x517b3c)&&_0x8167('0xf')===typeof _0x517b3c&&!_[_0x8167('0x10')](_0x517b3c)){return _0x517b3c;}return _0x8167('0x13');};exports[_0x8167('0x14')]=function(_0x3b69b7){if(_['isNil'](_0x3b69b7)){return![];}return _0x3b69b7;};exports[_0x8167('0x15')]=function(_0x4669d1,_0x7538ea,_0x44d621,_0x4234f3,_0x2fecdc,_0x2848d3){var _0x5b33bc={'XMD-QUEUE':_0x7538ea['Queue']?_0x7538ea[_0x8167('0x16')]['name']:'','XMD-CALLERID':_0x4234f3,'XMD-CALLERID-PREVIEW':_0x2848d3?util['format'](_0x8167('0x12'),_0x2848d3[_0x8167('0x17')],_0x2848d3[_0x8167('0x18')]):_0x4234f3,'XMD-DIALID':_0x2fecdc,'XMD-CONTACTID':_0x7538ea[_0x8167('0x19')],'XMD-CDRTYPE':_0x8167('0x1a'),'CALLERID(all)':_0x4234f3,'XMD-VOICEQUEUEID':_0x7538ea[_0x8167('0x1b')],'XMD-DIALCHANNEL':_0x44d621,'XMD-DIALTIMEOUT':_0x4669d1[_0x8167('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x8167('0x11')]('\x22rtTxX%s%s\x22',_0x4669d1[_0x8167('0x1d')]?'g':'',_[_0x8167('0x10')](_0x4669d1['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4669d1[_0x8167('0x1e')]||'','XMD-AGI':_0x4669d1[_0x8167('0x1f')]?util['format'](_0x8167('0x20'),ipAgi,_0x4669d1[_0x8167('0x1f')]):_0x8167('0x21'),'XMD-AGIAFTER':_0x4669d1[_0x8167('0x1d')]?util['format'](_0x8167('0x20'),ipAgi,_0x4669d1[_0x8167('0x1d')]):_0x8167('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2848d3?_0x2848d3[_0x8167('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2848d3?_0x2848d3[_0x8167('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x8167('0x24')};if(!_['isEmpty'](_0x4669d1[_0x8167('0x25')])){_0x5b33bc[util[_0x8167('0x11')]('%s',_0x8167('0x26'))]=_0x4669d1[_0x8167('0x25')];_0x5b33bc[util[_0x8167('0x11')]('%s',_0x8167('0x27'))]=_0x2fecdc;}return _0x5b33bc;};exports[_0x8167('0x28')]=function(_0x332a50){var _0xda3c29={};for(var _0x217cc8 in _0x332a50){if(_0x332a50[_0x8167('0x29')](_0x217cc8)){_0xda3c29[util[_0x8167('0x11')]('%s',_['toLower'](_0x217cc8))]=_0x332a50[_0x217cc8];}}return{'variables':_0xda3c29};};exports[_0x8167('0x2a')]=function(_0x3c875e,_0xc7d221){if(!_[_0x8167('0x2b')](_0x3c875e)){if(_0x3c875e['hasOwnProperty'](_0x8167('0x2c'))){if(_0x3c875e[_0x8167('0x2c')]>0x0){_0x3c875e['originated']-=0x1;}else{logger['error'](_0x8167('0x2d'),_0xc7d221);}}}else{logger[_0x8167('0x7')](_0x8167('0x2e'),_0xc7d221);}};exports['logBlacklist']=function(_0xc5c3da){var _0xc71a24=moment()[_0x8167('0x11')](_0x8167('0x2f'));_0xc5c3da['state']=0xd;_0xc5c3da[_0x8167('0x30')]='Blacklist';_0xc5c3da['starttime']=_0xc71a24;_0xc5c3da[_0x8167('0x31')]=_0xc71a24;_0xc5c3da[_0x8167('0x32')]=_0xc71a24;};exports[_0x8167('0x33')]=function(_0x3338df,_0x491ead,_0x4a6636){var _0x535b43=moment()[_0x8167('0x11')](_0x8167('0x2f'));_0x3338df[_0x8167('0x34')]=_0x491ead;_0x3338df[_0x8167('0x30')]=_0x4a6636;_0x3338df['responsetime']=_0x535b43;_0x3338df['ringtime']=utils['getSeconds'](_0x3338df[_0x8167('0x31')],_0x3338df[_0x8167('0x35')]);};exports[_0x8167('0x36')]=function(_0x42a284,_0x2977a4,_0x30afe7){_0x42a284[_0x8167('0x37')]=_0x2977a4;_0x42a284['UserId']=_0x30afe7;};exports[_0x8167('0x38')]=function(_0xf64956,_0x89c187,_0x2c401d){var _0x344647=moment()[_0x8167('0x11')](_0x8167('0x2f'));_0xf64956[_0x8167('0x34')]=_0x89c187;_0xf64956['statedesc']=_0x2c401d;_0xf64956[_0x8167('0x31')]=_0xf64956[_0x8167('0x31')]?_0xf64956['responsetime']:_0x344647;_0xf64956[_0x8167('0x32')]=_0xf64956[_0x8167('0x32')]?_0xf64956[_0x8167('0x32')]:_0x344647;_0xf64956[_0x8167('0x39')]=utils['getSeconds'](_0xf64956[_0x8167('0x31')]||0x0,_0xf64956['starttime']||0x0);_0xf64956[_0x8167('0x3a')]=_0xf64956[_0x8167('0x3b')]?utils[_0x8167('0x3c')](_0xf64956[_0x8167('0x32')],_0xf64956[_0x8167('0x3b')]):0x0;};exports[_0x8167('0x3d')]=function(_0x5907ca){return _0x5907ca==='Failure';};exports['variablesAction']=function(_0x1919ce,_0xde30b1,_0x28e681,_0x40be0c,_0x4c049d){var _0x212ad9=_0x40be0c?'RECALL':_0x1919ce[_0x8167('0x17')];_0x212ad9=_0x4c049d?_0x8167('0x3e'):_0x212ad9;return{'actionid':_0x1919ce['uniqueid'],'action':_0x8167('0x3f'),'channel':_0x1919ce[_0x8167('0x40')],'callerid':util[_0x8167('0x11')](_0x8167('0x12'),_0x212ad9,_0x1919ce[_0x8167('0x18')]),'Exten':'xcally-motion-preview','Context':_0x8167('0x41'),'Priority':'1','variable':_0x28e681,'timeout':(_0xde30b1[_0x8167('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1919ce[_0x8167('0x43')]};};exports['totalGlobal']=function(_0x3db519){return _0x3db519[_0x8167('0x44')]+_0x3db519[_0x8167('0x45')]+_0x3db519[_0x8167('0x46')]+_0x3db519[_0x8167('0x47')]+_0x3db519['countnosuchnumberretry'];};exports[_0x8167('0x48')]=function(_0x3212c1){var _0x194568=_[_0x8167('0x49')](_0x3212c1);_0x194568[_0x8167('0x34')]=0xf;_0x194568['statedesc']=_0x8167('0x4a');return _0x194568;};exports['scheduledAt']=function(_0x1eeadf,_0x461059,_0x37d5f5){var _0x1a295b={};_0x1a295b[_0x461059]=_0x1eeadf[_0x461059];_0x1a295b[_0x8167('0x4b')]=![];_0x1a295b[_0x8167('0x4c')]=moment()[_0x8167('0x4d')](_0x37d5f5,_0x8167('0x4e'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1a295b['ContactId']=_0x1eeadf['ContactId'];_0x1a295b['ListId']=_0x1eeadf[_0x8167('0x4f')];_0x1a295b[_0x8167('0x1b')]=_0x1eeadf[_0x8167('0x1b')]||undefined;return _0x1a295b;};exports['decrementTalkink']=function(_0x3579c5,_0x268434){if(!_[_0x8167('0x2b')](_0x3579c5)){if(_0x3579c5[_0x8167('0x50')]>0x0){_0x3579c5[_0x8167('0x50')]-=0x1;}else{logger[_0x8167('0x7')](_0x268434,_0x8167('0x51'));}}else{logger[_0x8167('0x7')](_0x268434,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1964f3){if(_0x1964f3<=0x0){return!![];}return![];};function buildObj(_0x58c505,_0x4b54e9,_0x577936){_0x58c505[_0x8167('0x52')]=_0x4b54e9;_0x58c505[_0x8167('0x53')]=_0x58c505[_0x8167('0x54')];_0x58c505['interface']=_0x58c505[_0x8167('0x40')];_0x58c505[_0x8167('0x55')]=_0x8167('0x56');if(_0x577936){_0x58c505[_0x8167('0x57')]=_0x577936[_0x8167('0x57')];}return _0x58c505;}exports[_0x8167('0x58')]=buildObj;exports['buildAcw']=function(_0x556f4a){var _0x3f6543={};_0x3f6543[_0x8167('0x54')]=_0x556f4a['queue'];_0x3f6543[_0x8167('0x59')]=_0x556f4a[_0x8167('0x40')];_0x3f6543[_0x8167('0x43')]=_0x556f4a['uniqueid'];return _0x3f6543;};exports[_0x8167('0x5a')]=function(_0x296ca9){var _0x2d41e6=[];for(var _0x3859eb in _0x296ca9){if(_0x296ca9[_0x8167('0x29')](_0x3859eb)){if(!_[_0x8167('0x2b')](_0x296ca9[_0x3859eb])&&_0x296ca9[_0x3859eb]['state']===_0x8167('0x5b')&&_0x296ca9[_0x3859eb][_0x8167('0x5c')]==='reachable'){_0x2d41e6['push'](_0x296ca9[_0x3859eb]['id']);}}}return _0x2d41e6;};exports['getDiff']=function(_0x959f40){var _0x3072fc=moment()[_0x8167('0x5d')](0x0);var _0xfe65d8=moment(_0x959f40)['milliseconds'](0x0);return _0x3072fc[_0x8167('0x5e')](_0xfe65d8,_0x8167('0x5f'));};exports[_0x8167('0x60')]=function(_0x35ed53){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x35ed53[_0x8167('0x19')],'ListId':_0x35ed53[_0x8167('0x4f')],'VoiceQueueId':_0x35ed53[_0x8167('0x1b')]||undefined,'CampaignId':_0x35ed53[_0x8167('0x61')]||undefined};};exports[_0x8167('0x62')]=function(_0x47ee01){if(_0x47ee01===_0x8167('0x43')||_0x47ee01===_0x8167('0x63')||_0x47ee01===_0x8167('0x54')||_0x47ee01===_0x8167('0x64')||_0x47ee01==='campaigntype'||_0x47ee01===_0x8167('0x65')||_0x47ee01===_0x8167('0x37')||_0x47ee01==='channelAgent'||_0x47ee01===_0x8167('0x17')||_0x47ee01===_0x8167('0x4b')||_0x47ee01==='calleridnum'||_0x47ee01===_0x8167('0x4c')||_0x47ee01==='countbusyretry'||_0x47ee01===_0x8167('0x45')||_0x47ee01===_0x8167('0x46')||_0x47ee01===_0x8167('0x66')||_0x47ee01===_0x8167('0x67')||_0x47ee01==='callbackuniqueid'||_0x47ee01==='callbackat'||_0x47ee01===_0x8167('0x68')||_0x47ee01===_0x8167('0x19')||_0x47ee01===_0x8167('0x4f')||_0x47ee01==='UserId'||_0x47ee01===_0x8167('0x1b')||_0x47ee01===_0x8167('0x69')||_0x47ee01==='xmd-voicequeueid'||_0x47ee01==='xmd-queue'||_0x47ee01===_0x8167('0x6a')||_0x47ee01===_0x8167('0x6b')||_0x47ee01===_0x8167('0x6c')||_0x47ee01===_0x8167('0x6d')||_0x47ee01==='xmd-dialoptions'||_0x47ee01===_0x8167('0x6e')||_0x47ee01===_0x8167('0x6f')||_0x47ee01===_0x8167('0x70')||_0x47ee01===_0x8167('0x71')||_0x47ee01===_0x8167('0x72')||_0x47ee01==='xmd-agiafter'||_0x47ee01===_0x8167('0x73')||_0x47ee01===_0x8167('0x74')||_0x47ee01===_0x8167('0x75')||_0x47ee01===_0x8167('0x76')||_0x47ee01===_0x8167('0x77')||_0x47ee01==='rtpaudioqosloss'||_0x47ee01==='rtpaudioqoslossbridged'||_0x47ee01===_0x8167('0x78')||_0x47ee01===_0x8167('0x79')||_0x47ee01==='rtpaudioqos'||_0x47ee01===_0x8167('0x75')||_0x47ee01==='rtpaudioqosjitter'||_0x47ee01===_0x8167('0x77')||_0x47ee01==='rtpaudioqosloss'||_0x47ee01===_0x8167('0x7a')||_0x47ee01===_0x8167('0x78')||_0x47ee01===_0x8167('0x79')||_0x47ee01===_0x8167('0x7b')||_0x47ee01===_0x8167('0x7c')||_0x47ee01===_0x8167('0x34')||_0x47ee01===_0x8167('0x30')){return![];}return!![];};exports[_0x8167('0x7d')]=function(_0x578387,_0x2d71bb){var _0x359e85,_0x43a3c3,_0x161f38;if(_0x2d71bb<=0x0){_0x2d71bb=0x1;}_0x359e85=new RegExp(_0x8167('0x7e')+_0x2d71bb+'}$');_0x43a3c3=Math[_0x8167('0x7f')](0xa,_0x2d71bb-0x1);_0x161f38=Math[_0x8167('0x7f')](0xa,_0x2d71bb)-0x1;return util[_0x8167('0x11')]('%s',_[_0x8167('0x80')](_0x578387,_0x359e85,_['random'](_0x43a3c3,_0x161f38)));};exports[_0x8167('0x81')]=function(_0x198943){var _0x5568d5=_0x198943[_0x8167('0x82')](/"(.*?)"/);return _0x5568d5?_0x5568d5[0x1]:_0x198943;};exports[_0x8167('0x83')]=function(_0x467352){var _0x4c2160=_0x467352[_0x8167('0x82')](/<(.*?)>/);return _0x4c2160?_0x4c2160[0x1]:_0x467352;};function buildNoAnswerEventPayload(_0x2f4fbf,_0x2ba3f4){var _0xdda84=buildObj(_0x2f4fbf,_0x8167('0x84'));if(!_[_0x8167('0x10')](_0x2ba3f4[_0x8167('0x85')])){Object['keys'](_0x2ba3f4[_0x8167('0x85')])['forEach'](function(_0x5e0516){_0xdda84[_0x5e0516['toLowerCase']()]=_0x2ba3f4[_0x8167('0x85')][_0x5e0516];});}return _0xdda84;}exports[_0x8167('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x713d=['loggerCatch','inspect','loggerError','error','info','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','Queue','name','dialer','VoiceQueueId','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','getSeconds','isFailure','RECALL','BOOKED','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countagentrejectretry','Global','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countnoanswerretry','countglobal','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils'];(function(_0x3a02d1,_0x21120b){var _0x258805=function(_0x1562d8){while(--_0x1562d8){_0x3a02d1['push'](_0x3a02d1['shift']());}};_0x258805(++_0x21120b);}(_0x713d,0x7d));var _0xd713=function(_0x251610,_0x19c564){_0x251610=_0x251610-0x0;var _0x12335f=_0x713d[_0x251610];return _0x12335f;};'use strict';var util=require(_0xd713('0x0'));var _=require(_0xd713('0x1'));var moment=require('moment');var logger=require(_0xd713('0x2'))('preview');var ipAgi=process[_0xd713('0x3')][_0xd713('0x4')]||'127.0.0.1';var utils=require(_0xd713('0x5'));exports[_0xd713('0x6')]=function(_0x55a465){return function(_0x5e2c56){logger['error'](_0x55a465,util[_0xd713('0x7')](_0x5e2c56,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4292cd,_0xb8358e){logger['info'](_0x4292cd,util[_0xd713('0x7')](_0xb8358e,{'showHidden':![],'depth':null}));};exports[_0xd713('0x8')]=function(_0x46be1d,_0x37151f){logger[_0xd713('0x9')](_0x46be1d,util[_0xd713('0x7')](_0x37151f,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x198582){return function(_0x351a88){logger[_0xd713('0xa')](_0x198582,util[_0xd713('0x7')](_0x351a88,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xb47b0b,_0x188ca2,_0x4d5560){return{'message':_0xb47b0b,'unlock':_0x188ca2,'active':_0x4d5560};};exports['getCallerId']=function(_0x10d062,_0x5ca7d2,_0x2e007b){if(!_['isUndefined'](_0x2e007b)&&'string'===typeof _0x2e007b&&!_[_0xd713('0xb')](_0x2e007b)){if(!_[_0xd713('0xc')](_0x5ca7d2)&&_0xd713('0xd')===typeof _0x5ca7d2&&!_[_0xd713('0xb')](_0x5ca7d2)){return util[_0xd713('0xe')](_0xd713('0xf'),_0x5ca7d2,_0x2e007b);}return util[_0xd713('0xe')](_0xd713('0xf'),_0x2e007b,_0x2e007b);}if(!_[_0xd713('0xc')](_0x10d062)&&'string'===typeof _0x10d062&&!_['isEmpty'](_0x10d062)){return _0x10d062;}return _0xd713('0x10');};exports[_0xd713('0x11')]=function(_0x5def39){if(_['isNil'](_0x5def39)){return![];}return _0x5def39;};exports['addVariables']=function(_0x17152a,_0x45cfd3,_0x193297,_0x51b4cb,_0x333bfc,_0x1daf96){var _0x694c5={'XMD-QUEUE':_0x45cfd3[_0xd713('0x12')]?_0x45cfd3['Queue'][_0xd713('0x13')]:'','XMD-CALLERID':_0x51b4cb,'XMD-CALLERID-PREVIEW':_0x1daf96?util['format']('\x22%s\x22\x20<%s>',_0x1daf96['calleridname'],_0x1daf96['calleridnum']):_0x51b4cb,'XMD-DIALID':_0x333bfc,'XMD-CONTACTID':_0x45cfd3['ContactId'],'XMD-CDRTYPE':_0xd713('0x14'),'CALLERID(all)':_0x51b4cb,'XMD-VOICEQUEUEID':_0x45cfd3[_0xd713('0x15')],'XMD-DIALCHANNEL':_0x193297,'XMD-DIALTIMEOUT':_0x17152a[_0xd713('0x16')]||0x1e,'XMD-DIALOPTIONS':util[_0xd713('0xe')]('\x22rtTxX%s%s\x22',_0x17152a['dialQueueProject2']?'g':'',_['isEmpty'](_0x17152a['monitor_format'])?'':_0xd713('0x17')),'XMD-DIALURL':_0x17152a[_0xd713('0x18')]||'','XMD-AGI':_0x17152a[_0xd713('0x19')]?util['format'](_0xd713('0x1a'),ipAgi,_0x17152a[_0xd713('0x19')]):'NONE','XMD-AGIAFTER':_0x17152a[_0xd713('0x1b')]?util[_0xd713('0xe')](_0xd713('0x1a'),ipAgi,_0x17152a['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1daf96?_0x1daf96[_0xd713('0x1c')]:'','XMD-ORIGINATECALLERIDNAME':_0x1daf96?_0x1daf96[_0xd713('0x1d')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xd713('0x1e')};if(!_[_0xd713('0xb')](_0x17152a['monitor_format'])){_0x694c5[util[_0xd713('0xe')]('%s',_0xd713('0x1f'))]=_0x17152a[_0xd713('0x20')];_0x694c5[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x333bfc;}return _0x694c5;};exports[_0xd713('0x21')]=function(_0x17882a){var _0x3dde53={};for(var _0x4d56c5 in _0x17882a){if(_0x17882a[_0xd713('0x22')](_0x4d56c5)){_0x3dde53[util[_0xd713('0xe')]('%s',_[_0xd713('0x23')](_0x4d56c5))]=_0x17882a[_0x4d56c5];}}return{'variables':_0x3dde53};};exports[_0xd713('0x24')]=function(_0x4d45ac,_0x103d84){if(!_[_0xd713('0x25')](_0x4d45ac)){if(_0x4d45ac['hasOwnProperty']('originated')){if(_0x4d45ac[_0xd713('0x26')]>0x0){_0x4d45ac[_0xd713('0x26')]-=0x1;}else{logger[_0xd713('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x103d84);}}}else{logger[_0xd713('0x9')](_0xd713('0x27'),_0x103d84);}};exports[_0xd713('0x28')]=function(_0x5af8a7){var _0x2b921d=moment()[_0xd713('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x5af8a7[_0xd713('0x29')]=0xd;_0x5af8a7[_0xd713('0x2a')]='Blacklist';_0x5af8a7[_0xd713('0x2b')]=_0x2b921d;_0x5af8a7[_0xd713('0x2c')]=_0x2b921d;_0x5af8a7[_0xd713('0x2d')]=_0x2b921d;};exports[_0xd713('0x2e')]=function(_0x4161b2,_0x4ddc1b,_0x3617f3){var _0x36011e=moment()['format'](_0xd713('0x2f'));_0x4161b2[_0xd713('0x29')]=_0x4ddc1b;_0x4161b2[_0xd713('0x2a')]=_0x3617f3;_0x4161b2[_0xd713('0x2c')]=_0x36011e;_0x4161b2[_0xd713('0x30')]=utils['getSeconds'](_0x4161b2[_0xd713('0x2c')],_0x4161b2['starttime']);};exports[_0xd713('0x31')]=function(_0x53ae6a,_0x226b40,_0x3dee7b){_0x53ae6a[_0xd713('0x32')]=_0x226b40;_0x53ae6a[_0xd713('0x33')]=_0x3dee7b;};exports[_0xd713('0x34')]=function(_0x588fb6,_0x4cda1e,_0x3306d0){var _0x5b7f18=moment()[_0xd713('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x588fb6['state']=_0x4cda1e;_0x588fb6[_0xd713('0x2a')]=_0x3306d0;_0x588fb6['responsetime']=_0x588fb6[_0xd713('0x2c')]?_0x588fb6[_0xd713('0x2c')]:_0x5b7f18;_0x588fb6[_0xd713('0x2d')]=_0x588fb6['endtime']?_0x588fb6[_0xd713('0x2d')]:_0x5b7f18;_0x588fb6[_0xd713('0x30')]=utils['getSeconds'](_0x588fb6['responsetime']||0x0,_0x588fb6[_0xd713('0x2b')]||0x0);_0x588fb6[_0xd713('0x35')]=_0x588fb6[_0xd713('0x36')]?utils[_0xd713('0x37')](_0x588fb6[_0xd713('0x2d')],_0x588fb6[_0xd713('0x36')]):0x0;};exports[_0xd713('0x38')]=function(_0xf69d45){return _0xf69d45==='Failure';};exports['variablesAction']=function(_0x619dcd,_0x193b50,_0x58df12,_0x360c8d,_0x75079d){var _0x58f69e=_0x360c8d?_0xd713('0x39'):_0x619dcd['calleridname'];_0x58f69e=_0x75079d?_0xd713('0x3a'):_0x58f69e;return{'actionid':_0x619dcd['uniqueid'],'action':'originate','channel':_0x619dcd[_0xd713('0x3b')],'callerid':util[_0xd713('0xe')]('\x22%s\x22\x20<%s>',_0x58f69e,_0x619dcd['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xd713('0x3c'),'Priority':'1','variable':_0x58df12,'timeout':(_0x193b50[_0xd713('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x619dcd[_0xd713('0x3e')]};};exports[_0xd713('0x3f')]=function(_0xebd858){return _0xebd858['countbusyretry']+_0xebd858[_0xd713('0x40')]+_0xebd858['countnoanswerretry']+_0xebd858[_0xd713('0x41')]+_0xebd858['countnosuchnumberretry'];};exports['cloneAction']=function(_0x23772c){var _0x10e24f=_['clone'](_0x23772c);_0x10e24f[_0xd713('0x29')]=0xf;_0x10e24f[_0xd713('0x2a')]=_0xd713('0x42');return _0x10e24f;};exports['scheduledAt']=function(_0x3909b0,_0x1f5e07,_0x3f4a62){var _0x53c710={};_0x53c710[_0x1f5e07]=_0x3909b0[_0x1f5e07];_0x53c710[_0xd713('0x43')]=![];_0x53c710['scheduledat']=moment()[_0xd713('0x44')](_0x3f4a62,_0xd713('0x45'))[_0xd713('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x53c710[_0xd713('0x46')]=_0x3909b0['ContactId'];_0x53c710['ListId']=_0x3909b0[_0xd713('0x47')];_0x53c710['VoiceQueueId']=_0x3909b0[_0xd713('0x15')]||undefined;return _0x53c710;};exports[_0xd713('0x48')]=function(_0x51f5bc,_0x3f1ac8){if(!_['isNil'](_0x51f5bc)){if(_0x51f5bc[_0xd713('0x49')]>0x0){_0x51f5bc[_0xd713('0x49')]-=0x1;}else{logger['error'](_0x3f1ac8,_0xd713('0x4a'));}}else{logger[_0xd713('0x9')](_0x3f1ac8,_0xd713('0x4b'));}};exports[_0xd713('0x4c')]=function(_0xad8e3){if(_0xad8e3<=0x0){return!![];}return![];};function buildObj(_0x418acc,_0x5c80cf,_0x2668bc){_0x418acc['lastevent']=_0x5c80cf;_0x418acc['name']=_0x418acc[_0xd713('0x4d')];_0x418acc['interface']=_0x418acc[_0xd713('0x3b')];_0x418acc[_0xd713('0x4e')]='voice';if(_0x2668bc){_0x418acc[_0xd713('0x4f')]=_0x2668bc[_0xd713('0x4f')];}return _0x418acc;}exports[_0xd713('0x50')]=buildObj;exports[_0xd713('0x51')]=function(_0x345cf9){var _0x5502b0={};_0x5502b0[_0xd713('0x4d')]=_0x345cf9[_0xd713('0x4d')];_0x5502b0[_0xd713('0x52')]=_0x345cf9[_0xd713('0x3b')];_0x5502b0[_0xd713('0x3e')]=_0x345cf9[_0xd713('0x3e')];return _0x5502b0;};exports[_0xd713('0x53')]=function(_0x19a99a){var _0x52be1f=[];for(var _0x349739 in _0x19a99a){if(_0x19a99a[_0xd713('0x22')](_0x349739)){if(!_['isNil'](_0x19a99a[_0x349739])&&_0x19a99a[_0x349739][_0xd713('0x29')]===_0xd713('0x54')&&_0x19a99a[_0x349739][_0xd713('0x55')]===_0xd713('0x56')){_0x52be1f['push'](_0x19a99a[_0x349739]['id']);}}}return _0x52be1f;};exports[_0xd713('0x57')]=function(_0x10aafa){var _0x30a3b1=moment()[_0xd713('0x58')](0x0);var _0x3bd845=moment(_0x10aafa)['milliseconds'](0x0);return _0x30a3b1[_0xd713('0x59')](_0x3bd845,_0xd713('0x5a'));};exports[_0xd713('0x5b')]=function(_0x1b89d3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b89d3[_0xd713('0x46')],'ListId':_0x1b89d3[_0xd713('0x47')],'VoiceQueueId':_0x1b89d3[_0xd713('0x15')]||undefined,'CampaignId':_0x1b89d3[_0xd713('0x5c')]||undefined};};exports[_0xd713('0x5d')]=function(_0x13abf1){if(_0x13abf1===_0xd713('0x3e')||_0x13abf1==='idContact'||_0x13abf1==='queue'||_0x13abf1===_0xd713('0x5e')||_0x13abf1===_0xd713('0x5f')||_0x13abf1===_0xd713('0x60')||_0x13abf1===_0xd713('0x32')||_0x13abf1==='channelAgent'||_0x13abf1==='calleridname'||_0x13abf1==='active'||_0x13abf1==='calleridnum'||_0x13abf1===_0xd713('0x61')||_0x13abf1===_0xd713('0x62')||_0x13abf1===_0xd713('0x40')||_0x13abf1===_0xd713('0x63')||_0x13abf1===_0xd713('0x64')||_0x13abf1==='callback'||_0x13abf1===_0xd713('0x65')||_0x13abf1===_0xd713('0x66')||_0x13abf1==='recallme'||_0x13abf1==='ContactId'||_0x13abf1===_0xd713('0x47')||_0x13abf1==='UserId'||_0x13abf1==='VoiceQueueId'||_0x13abf1==='sipcallid'||_0x13abf1===_0xd713('0x67')||_0x13abf1===_0xd713('0x68')||_0x13abf1==='xmd-phone'||_0x13abf1===_0xd713('0x69')||_0x13abf1===_0xd713('0x6a')||_0x13abf1===_0xd713('0x6b')||_0x13abf1==='xmd-dialoptions'||_0x13abf1==='xmd-dialid'||_0x13abf1==='xmd-dialchannel'||_0x13abf1==='xmd-contactid'||_0x13abf1===_0xd713('0x6c')||_0x13abf1===_0xd713('0x6d')||_0x13abf1==='xmd-agiafter'||_0x13abf1===_0xd713('0x6e')||_0x13abf1==='rtpaudioqos'||_0x13abf1===_0xd713('0x6f')||_0x13abf1===_0xd713('0x70')||_0x13abf1===_0xd713('0x71')||_0x13abf1===_0xd713('0x72')||_0x13abf1===_0xd713('0x73')||_0x13abf1==='rtpaudioqosrtt'||_0x13abf1==='rtpaudioqosrttbridged'||_0x13abf1===_0xd713('0x74')||_0x13abf1===_0xd713('0x6f')||_0x13abf1===_0xd713('0x70')||_0x13abf1===_0xd713('0x71')||_0x13abf1===_0xd713('0x72')||_0x13abf1===_0xd713('0x73')||_0x13abf1===_0xd713('0x75')||_0x13abf1===_0xd713('0x76')||_0x13abf1==='bridgepeer'||_0x13abf1===_0xd713('0x77')||_0x13abf1===_0xd713('0x29')||_0x13abf1===_0xd713('0x2a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3d8a4c,_0x53c971){var _0x2589da,_0x4c89a9,_0x38a699;if(_0x53c971<=0x0){_0x53c971=0x1;}_0x2589da=new RegExp(_0xd713('0x78')+_0x53c971+'}$');_0x4c89a9=Math[_0xd713('0x79')](0xa,_0x53c971-0x1);_0x38a699=Math[_0xd713('0x79')](0xa,_0x53c971)-0x1;return util[_0xd713('0xe')]('%s',_[_0xd713('0x7a')](_0x3d8a4c,_0x2589da,_[_0xd713('0x7b')](_0x4c89a9,_0x38a699)));};exports[_0xd713('0x7c')]=function(_0xe3d13a){var _0x38c30b=_0xe3d13a[_0xd713('0x7d')](/"(.*?)"/);return _0x38c30b?_0x38c30b[0x1]:_0xe3d13a;};exports[_0xd713('0x7e')]=function(_0x3e4366){var _0x2202fd=_0x3e4366[_0xd713('0x7d')](/<(.*?)>/);return _0x2202fd?_0x2202fd[0x1]:_0x3e4366;};function buildNoAnswerEventPayload(_0x3426b7,_0x708737){var _0x12c493=buildObj(_0x3426b7,'noanswer');if(!_[_0xd713('0xb')](_0x708737[_0xd713('0x7f')])){Object['keys'](_0x708737['variables'])[_0xd713('0x80')](function(_0x4bee83){_0x12c493[_0x4bee83[_0xd713('0x81')]()]=_0x708737['variables'][_0x4bee83];});}return _0x12c493;}exports[_0xd713('0x82')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8d7334c..755025b 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 _0x5f38=['boolean','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queuepause'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x5f38,0x1b5));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x85f3('0x0')]={'queue':{'type':_0x85f3('0x1'),'required':!![]},'interface':{'type':_0x85f3('0x1'),'required':!![]},'membername':{'type':_0x85f3('0x1'),'required':!![]},'penalty':{'type':_0x85f3('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x85f3('0x1'),'required':!![]},'interface':{'type':_0x85f3('0x1'),'required':!![]}};exports[_0x85f3('0x3')]={'interface':{'type':_0x85f3('0x1'),'required':!![]},'paused':{'type':_0x85f3('0x4')},'reason':{'type':_0x85f3('0x1'),'required':![]}};exports[_0x85f3('0x5')]={'module':{'type':_0x85f3('0x1'),'required':![]}};exports[_0x85f3('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x85f3('0x1'),'required':!![]},'filename':{'type':_0x85f3('0x1')},'format':{'type':_0x85f3('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x85f3('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x85f3('0x8')]={'uniqueid':{'type':_0x85f3('0x1'),'required':!![]},'exten':{'type':_0x85f3('0x1'),'required':!![]},'context':{'type':_0x85f3('0x1')}}; \ No newline at end of file +var _0xaa32=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x16275c,_0x15975f){var _0x209e83=function(_0x501725){while(--_0x501725){_0x16275c['push'](_0x16275c['shift']());}};_0x209e83(++_0x15975f);}(_0xaa32,0x78));var _0x2aa3=function(_0x482611,_0x33356d){_0x482611=_0x482611-0x0;var _0x4aeb3a=_0xaa32[_0x482611];return _0x4aeb3a;};'use strict';exports[_0x2aa3('0x0')]={'queue':{'type':_0x2aa3('0x1'),'required':!![]},'interface':{'type':_0x2aa3('0x1'),'required':!![]},'membername':{'type':_0x2aa3('0x1'),'required':!![]},'penalty':{'type':_0x2aa3('0x2'),'required':![]},'paused':{'type':_0x2aa3('0x3'),'required':![]}};exports[_0x2aa3('0x4')]={'queue':{'type':_0x2aa3('0x1'),'required':!![]},'interface':{'type':_0x2aa3('0x1'),'required':!![]}};exports[_0x2aa3('0x5')]={'interface':{'type':_0x2aa3('0x1'),'required':!![]},'paused':{'type':_0x2aa3('0x3')},'reason':{'type':_0x2aa3('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x2aa3('0x6')]={'uniqueid':{'type':_0x2aa3('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x2aa3('0x1'),'required':!![]},'filename':{'type':_0x2aa3('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x2aa3('0x1')}};exports[_0x2aa3('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2aa3('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x2aa3('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 297982f..e86f0a5 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x202b05,_0x5a246c){_0x202b05=_0x202b05-0x0;var _0x22a0a7=_0x0b0e[_0x202b05];return _0x22a0a7;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x521136,_0x3725f5){var _0x31b695=function(_0x51400b){while(--_0x51400b){_0x521136['push'](_0x521136['shift']());}};_0x31b695(++_0x3725f5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index d1e332d..eeb9843 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 _0x9ba9=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x9ba9,0x192));var _0x99ba=function(_0x33a433,_0x24a7a4){_0x33a433=_0x33a433-0x0;var _0x4a8c57=_0x9ba9[_0x33a433];return _0x4a8c57;};'use strict';function mergeDBDataToRealtime(_0x32f9fc,_0x46ab04){var _0x4ef1f5=Object[_0x99ba('0x0')]({},_0x32f9fc);for(var _0x18bc5f in _0x46ab04){if(_0x4ef1f5[_0x99ba('0x1')](_0x18bc5f)){_0x4ef1f5[_0x18bc5f]=_0x46ab04[_0x18bc5f];}}return _0x4ef1f5;}exports[_0x99ba('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x9d7c=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x5d25c3,_0x4f9e53){var _0x2cd69c=function(_0x361a1c){while(--_0x361a1c){_0x5d25c3['push'](_0x5d25c3['shift']());}};_0x2cd69c(++_0x4f9e53);}(_0x9d7c,0x1cb));var _0xc9d7=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x9d7c[_0x5c18ef];return _0x33789d;};'use strict';function mergeDBDataToRealtime(_0x335a92,_0x55baf7){var _0x159ab5=Object[_0xc9d7('0x0')]({},_0x335a92);for(var _0x1bbf14 in _0x55baf7){if(_0x159ab5[_0xc9d7('0x1')](_0x1bbf14)){_0x159ab5[_0x1bbf14]=_0x55baf7[_0x1bbf14];}}return _0x159ab5;}exports[_0xc9d7('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 b289dd7..bc1eb22 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 _0x34ce=['split','outbound','internal','destination','type','dialer','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','uniqueid','getAgentByInternal','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','voiceAgentReport','isArray','forEach','Local','indexOf','mobile','phone','substring','lastIndexOf','voiceDialReport','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','keys'];(function(_0x222bf2,_0x3a22bc){var _0x4c5e51=function(_0xe183c){while(--_0xe183c){_0x222bf2['push'](_0x222bf2['shift']());}};_0x4c5e51(++_0x3a22bc);}(_0x34ce,0xe8));var _0xe34c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x34ce[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xe34c('0x0'));var moment=require(_0xe34c('0x1'));var util=require('util');var config=require(_0xe34c('0x2'));var ami=require(_0xe34c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xe34c('0x4'));var RpcVoiceDialReport=require(_0xe34c('0x5'));var RpcMemberReport=require(_0xe34c('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe34c('0x7'));var RpcVoiceTransferReport=require(_0xe34c('0x8'));var VoiceQueueReport=require(_0xe34c('0x9'));var VoiceCallReport=require(_0xe34c('0xa'));var VoiceAgentReport=require(_0xe34c('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xe34c('0xc'));function Report(_0x26b37b){this[_0xe34c('0xd')]=_0x26b37b;this[_0xe34c('0xe')]=_0x26b37b['agents'];this['telephones']=_0x26b37b[_0xe34c('0xf')];}Report[_0xe34c('0x10')][_0xe34c('0x11')]=function(_0x181333){var _0x4ccf0d=new VoiceQueueReport(this[_0xe34c('0xd')]);var _0x444760=new VoiceAgentReport(this[_0xe34c('0xd')]);var _0x40dc3b=new VoiceDialReport(this[_0xe34c('0xd')]);var _0x4b64b6=new VoiceCallReport(this[_0xe34c('0xd')]);var _0x41d441=new UserReport(this['realtime']);if(config[_0xe34c('0x12')]&&config[_0xe34c('0x12')][_0xe34c('0x13')]){ami['on'](_0xe34c('0x14'),this[_0xe34c('0x15')]['bind'](this));ami['on'](_0xe34c('0x16'),this[_0xe34c('0x17')][_0xe34c('0x18')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0xe34c('0x18')](this));ami['on'](_0xe34c('0x19'),this['voiceDialReport'][_0xe34c('0x18')](this));ami['on'](_0xe34c('0x1a'),this[_0xe34c('0x1b')][_0xe34c('0x18')](this));ami['on'](_0xe34c('0x1c'),this[_0xe34c('0x1d')][_0xe34c('0x18')](this));}};Report[_0xe34c('0x10')][_0xe34c('0x1e')]=function(_0x5c9265){var _0xbc802b;_0xbc802b=_[_0xe34c('0x1f')](this[_0xe34c('0xe')],function(_0x94f2d0){return _0x94f2d0[_0xe34c('0x20')]==_0x5c9265||_0x94f2d0['name']==_0x5c9265;});if(_[_0xe34c('0x21')](_0xbc802b)){var _0x514730=_[_0xe34c('0x1f')](this['telephones'],function(_0x474a3e){return _0x474a3e[_0xe34c('0x20')]==_0x5c9265||_0x474a3e[_0xe34c('0x22')]==_0x5c9265;});if(_0x514730){_0xbc802b=_[_0xe34c('0x1f')](this[_0xe34c('0xe')],function(_0x10e45c){return _0x10e45c[_0xe34c('0x23')]==util[_0xe34c('0x24')](_0xe34c('0x25'),_0x514730[_0xe34c('0x22')]);});}}return _0xbc802b;};Report[_0xe34c('0x10')][_0xe34c('0x15')]=function(_0x310483){for(var _0x2120c7=0x0;_0x2120c7<_0x310483[_0xe34c('0x26')];_0x2120c7+=0x1){var _0x2161c0=this[_0xe34c('0x1e')](_0x310483[_0x2120c7]['connectedlinenum']);if(_0x2161c0){_0x310483[_0x2120c7][_0xe34c('0x20')]=_0x2161c0[_0xe34c('0x20')];_0x310483[_0x2120c7]['assigned']=!![];_0x310483[_0x2120c7][_0xe34c('0x27')]=_0x2161c0['name'];_0x310483[_0x2120c7][_0xe34c('0x23')]=_[_0xe34c('0x21')](_0x2161c0[_0xe34c('0x23')])?util[_0xe34c('0x24')]('SIP/%s',_0x2161c0[_0xe34c('0x22')]):_0x2161c0['interface'];if(_0x310483[_0x2120c7][_0xe34c('0x28')]){_0x310483[_0x2120c7][_0xe34c('0x29')]=moment()[_0xe34c('0x24')](_0xe34c('0x2a'));}if(_0x310483[_0x2120c7]['queuecallerexit']){_0x310483[_0x2120c7][_0xe34c('0x2b')]=moment()[_0xe34c('0x24')](_0xe34c('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x310483[_0x2120c7]);}RpcVoiceQueueReport[_0xe34c('0x2c')](_0x310483[_0x2120c7]);}};function extractCalleridNumber(_0x270981){var _0x269c19=_0x270981[_0xe34c('0x2d')](/<(.*?)>/);return _0x269c19?_0x269c19[0x1]:_0x270981;}Report[_0xe34c('0x10')]['getAgentByInternal']=function(_0x94bc28){for(var _0x16a868=0x0;_0x16a868','linkedid','transfers','transfereelinkedid','UserId','membername','monitors','monitorFilename','filename','createdAt','exten','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','interface','transfererlinkedid','attendedTransfer','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','isNil','telephones','accountcode','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','name','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create'];(function(_0x465188,_0x315d2c){var _0x540fea=function(_0x4fde95){while(--_0x4fde95){_0x465188['push'](_0x465188['shift']());}};_0x540fea(++_0x315d2c);}(_0x6263,0x198));var _0x3626=function(_0x126a46,_0x2fcfcd){_0x126a46=_0x126a46-0x0;var _0xbe5786=_0x6263[_0x126a46];return _0xbe5786;};'use strict';var _=require(_0x3626('0x0'));var moment=require('moment');var util=require(_0x3626('0x1'));var config=require(_0x3626('0x2'));var ami=require(_0x3626('0x3'));var RpcVoiceAgentReport=require(_0x3626('0x4'));var RpcVoiceCallReport=require(_0x3626('0x5'));var RpcVoiceDialReport=require(_0x3626('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x3626('0x7'));var RpcVoiceRecording=require(_0x3626('0x8'));var RpcVoiceTransferReport=require(_0x3626('0x9'));var VoiceQueueReport=require(_0x3626('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x3626('0xb'));var VoiceDialReport=require(_0x3626('0xc'));var UserReport=require(_0x3626('0xd'));function Report(_0x3944db){this[_0x3626('0xe')]=_0x3944db;this['agents']=_0x3944db[_0x3626('0xf')];this['telephones']=_0x3944db['telephones'];}Report[_0x3626('0x10')][_0x3626('0x11')]=function(_0x598401){var _0x106be0=new VoiceQueueReport(this[_0x3626('0xe')]);var _0x27ec34=new VoiceAgentReport(this[_0x3626('0xe')]);var _0x257986=new VoiceDialReport(this[_0x3626('0xe')]);var _0x1ee0a8=new VoiceCallReport(this[_0x3626('0xe')]);var _0x427ef6=new UserReport(this[_0x3626('0xe')]);if(config[_0x3626('0x12')]&&config[_0x3626('0x12')][_0x3626('0x13')]){ami['on'](_0x3626('0x14'),this[_0x3626('0x15')][_0x3626('0x16')](this));ami['on'](_0x3626('0x17'),this[_0x3626('0x18')][_0x3626('0x16')](this));ami['on'](_0x3626('0x19'),this[_0x3626('0x1a')][_0x3626('0x16')](this));ami['on'](_0x3626('0x1b'),this[_0x3626('0x1c')][_0x3626('0x16')](this));ami['on'](_0x3626('0x1d'),this[_0x3626('0x1e')][_0x3626('0x16')](this));ami['on'](_0x3626('0x1f'),this['attendedTransfer'][_0x3626('0x16')](this));}};Report[_0x3626('0x10')][_0x3626('0x20')]=function(_0x3f025c){var _0x50aa11;_0x50aa11=_[_0x3626('0x21')](this[_0x3626('0xf')],function(_0x2d5baf){return _0x2d5baf['accountcode']==_0x3f025c||_0x2d5baf['name']==_0x3f025c;});if(_[_0x3626('0x22')](_0x50aa11)){var _0x51394d=_[_0x3626('0x21')](this[_0x3626('0x23')],function(_0x457244){return _0x457244[_0x3626('0x24')]==_0x3f025c||_0x457244['name']==_0x3f025c;});if(_0x51394d){_0x50aa11=_[_0x3626('0x21')](this['agents'],function(_0x190e8f){return _0x190e8f['interface']==util[_0x3626('0x25')](_0x3626('0x26'),_0x51394d['name']);});}}return _0x50aa11;};Report[_0x3626('0x10')][_0x3626('0x15')]=function(_0x150c27){for(var _0x572f18=0x0;_0x572f18<_0x150c27[_0x3626('0x27')];_0x572f18+=0x1){var _0x40c4a1=this[_0x3626('0x20')](_0x150c27[_0x572f18][_0x3626('0x28')]);if(_0x40c4a1){_0x150c27[_0x572f18][_0x3626('0x24')]=_0x40c4a1['accountcode'];_0x150c27[_0x572f18][_0x3626('0x29')]=!![];_0x150c27[_0x572f18][_0x3626('0x2a')]=_0x40c4a1[_0x3626('0x2b')];_0x150c27[_0x572f18]['interface']=_['isNil'](_0x40c4a1['interface'])?util['format'](_0x3626('0x26'),_0x40c4a1[_0x3626('0x2b')]):_0x40c4a1['interface'];if(_0x150c27[_0x572f18]['queuecallercomplete']){_0x150c27[_0x572f18]['queuecallercompleteAt']=moment()[_0x3626('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x150c27[_0x572f18][_0x3626('0x2c')]){_0x150c27[_0x572f18]['queuecallerexitAt']=moment()[_0x3626('0x25')](_0x3626('0x2d'));}RpcMemberReport[_0x3626('0x15')](_0x150c27[_0x572f18]);}RpcVoiceQueueReport[_0x3626('0x2e')](_0x150c27[_0x572f18]);}};function extractCalleridNumber(_0x50fda4){var _0x548ac6=_0x50fda4[_0x3626('0x2f')](/<(.*?)>/);return _0x548ac6?_0x548ac6[0x1]:_0x50fda4;}Report[_0x3626('0x10')]['getAgentByInternal']=function(_0x165a07){for(var _0x40542b=0x0;_0x40542b0x0?!![]:![];if(!_0x175321){return this[_0xe2cc('0x1a')](this[_0xe2cc('0x14')][_0xe2cc('0x6b')]);}};VoiceQueueReport[_0xe2cc('0x9')][_0xe2cc('0x1b')]=function(_0x22ce7d){var _0x2de6b4=this[_0xe2cc('0x14')]['id'];if(this[_0xe2cc('0x14')]['queuestatus'][_0x2de6b4]&&this[_0xe2cc('0x14')][_0xe2cc('0x68')][_0x2de6b4][_0x22ce7d[_0xe2cc('0x62')]]){this['summary'][_0xe2cc('0x68')][_0x2de6b4][_0x22ce7d['actionid']][_0xe2cc('0xf')][_0xe2cc('0x6c')](_0x22ce7d);}};VoiceQueueReport[_0xe2cc('0x9')]['syncQueueSummary']=function(_0x225c18){var _0x26cbb2=this;try{if(this[_0xe2cc('0x5d')](_0x225c18)&&this[_0xe2cc('0x5d')](_0x225c18[_0xe2cc('0x56')])){logger['debug'](_0xe2cc('0x6d'),util[_0xe2cc('0x44')](_0x225c18,{'showHidden':![],'depth':null}));var _0x599229=this['voiceQueues'][_0x225c18['queue']];if(_0x599229){logger[_0xe2cc('0x53')](_0xe2cc('0x6e'),_0x599229[_0xe2cc('0x5c')]);this[_0xe2cc('0x14')][_0xe2cc('0x5f')][_0x599229[_0xe2cc('0x5c')]]={'summaryEvent':_0x225c18};this[_0xe2cc('0x14')][_0xe2cc('0x6a')]+=0x1;return ami[_0xe2cc('0x3b')]({'action':_0xe2cc('0x68'),'queue':_0x599229[_0xe2cc('0x5c')]})[_0xe2cc('0x61')](function(_0x3dc6f7){if(!_0x26cbb2[_0xe2cc('0x14')][_0xe2cc('0x68')][_0x225c18[_0xe2cc('0x62')]]){_0x26cbb2['summary']['queuestatus'][_0x225c18[_0xe2cc('0x62')]]={};}_0x26cbb2[_0xe2cc('0x14')][_0xe2cc('0x68')][_0x225c18[_0xe2cc('0x62')]][_0x3dc6f7['actionid']]={'queue':_0x599229[_0xe2cc('0x5c')],'agents':[]};})[_0xe2cc('0x3e')](function(_0x158a68){throw _0x158a68;});}}}catch(_0x1fa308){logger['error']('[voiceQueueReport][queuesummary]',util[_0xe2cc('0x44')](_0x1fa308,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe2cc('0x9')]['syncQueueSummaryComplete']=function(_0x157424){if(this[_0xe2cc('0x14')]['statusRequests']>0x0){this[_0xe2cc('0x14')]['completeEvent']=_0x157424;return;}logger[_0xe2cc('0x53')](_0xe2cc('0x6f'),util[_0xe2cc('0x44')](_0x157424,{'showHidden':![],'depth':null}));this[_0xe2cc('0x14')]=initializeSummary();ami[_0xe2cc('0x49')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xe2cc('0x9')][_0xe2cc('0x1e')]=function(_0x3a6518){try{if(this['isNotNull'](_0x3a6518)){logger[_0xe2cc('0x53')](_0xe2cc('0x70'),_0x3a6518[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x3a6518,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x3a6518['uniqueid']])){this['queueReports'][_0x3a6518[_0xe2cc('0x4d')]]=[];}if(_[_0xe2cc('0x71')](this[_0xe2cc('0x10')][_0x3a6518['uniqueid']])){this[_0xe2cc('0x10')][_0x3a6518[_0xe2cc('0x4d')]]={};}var _0x366dab=new QueueReport();_0x366dab[_0xe2cc('0x56')]=_0x3a6518[_0xe2cc('0x56')];_0x366dab[_0xe2cc('0x5a')]=this[_0xe2cc('0x12')][_0x366dab['queue']]&&this['voiceQueues'][_0x366dab[_0xe2cc('0x56')]][_0xe2cc('0x5a')]?this['voiceQueues'][_0x366dab[_0xe2cc('0x56')]][_0xe2cc('0x5a')]||_0xe2cc('0x5b'):_0xe2cc('0x5b');_0x366dab['queuecallerjoinAt']=moment()[_0xe2cc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x366dab[_0xe2cc('0x72')]=_0x3a6518[_0xe2cc('0x72')];_0x366dab[_0xe2cc('0x73')]=_0x3a6518[_0xe2cc('0x73')];_0x366dab[_0xe2cc('0x4d')]=_0x3a6518[_0xe2cc('0x4d')];_0x366dab[_0xe2cc('0x74')]=this[_0xe2cc('0x10')][_0x3a6518[_0xe2cc('0x4d')]][_0xe2cc('0x74')];logger[_0xe2cc('0x75')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x366dab['queue'],_0x366dab[_0xe2cc('0x5a')]);Object['assign'](_0x366dab,_[_0xe2cc('0x76')](_0x3a6518,_[_0xe2cc('0x77')](_0x366dab)));this['queueReports'][_0x3a6518['uniqueid']][_0xe2cc('0x6c')](_0x366dab);this[_0xe2cc('0x10')][_0x3a6518[_0xe2cc('0x4d')]]=_0x366dab;this[_0xe2cc('0x4a')](_0x366dab,'queuecallerjoin');}}catch(_0x18f887){logger[_0xe2cc('0x41')](_0xe2cc('0x70'),_0x3a6518[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x18f887,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe2cc('0x1f')]=function(_0x39ac0c){try{if(this[_0xe2cc('0x5d')](_0x39ac0c)){logger[_0xe2cc('0x53')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39ac0c[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x39ac0c,{'showHidden':![],'depth':null}));if(this[_0xe2cc('0xd')][_0x39ac0c[_0xe2cc('0x4d')]]){var _0x35a63d=_[_0xe2cc('0x78')](this[_0xe2cc('0xd')][_0x39ac0c[_0xe2cc('0x4d')]]);_0x35a63d[_0xe2cc('0x38')]=![];_0x35a63d[_0xe2cc('0x79')]=null;_0x35a63d[_0xe2cc('0x7a')]=_0x39ac0c['holdtime'];_0x35a63d[_0xe2cc('0x7b')]=_0x39ac0c['originalposition'];_0x35a63d[_0xe2cc('0x37')]=!![];_0x35a63d['queuecallerabandonAt']=moment()[_0xe2cc('0x4e')](_0xe2cc('0x7c'));_0x35a63d[_0xe2cc('0x55')]=_0xe2cc('0x7d');_0x35a63d[_0xe2cc('0x7e')]=null;logger[_0xe2cc('0x75')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x35a63d[_0xe2cc('0x56')],_0x35a63d['type']);this[_0xe2cc('0x10')][_0x39ac0c['uniqueid']]=_0x35a63d;this['emitVoiceQueueChannelRemove'](_0x35a63d,_0xe2cc('0x37'));}}}catch(_0x2ca228){logger[_0xe2cc('0x41')]('[%s][voiceQueueReport][queuecallerabandon]',_0x39ac0c[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x2ca228,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe2cc('0x20')]=function(_0x4ec139){try{if(this['isNotNull'](_0x4ec139)){logger[_0xe2cc('0x53')](_0xe2cc('0x7f'),_0x4ec139[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x4ec139,{'showHidden':![],'depth':null}));if(this[_0xe2cc('0xd')][_0x4ec139['uniqueid']]){var _0x26742f=_[_0xe2cc('0x78')](this[_0xe2cc('0xd')][_0x4ec139[_0xe2cc('0x4d')]]);_0x26742f[_0xe2cc('0x80')]=moment()[_0xe2cc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x26742f['connectedlinenum']=_0x4ec139[_0xe2cc('0x81')];_0x26742f[_0xe2cc('0x82')]=_0x4ec139[_0xe2cc('0x82')];logger[_0xe2cc('0x75')](_0xe2cc('0x83'),_0x26742f['queue'],_0x26742f['type'],_0x4ec139['connectedlinenum'],_0x4ec139[_0xe2cc('0x82')]);this[_0xe2cc('0x10')][_0x4ec139[_0xe2cc('0x4d')]]=_0x26742f;this['emitVoiceQueueChannelSave'](_0x26742f,_0xe2cc('0x84'));}}}catch(_0x552b25){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4ec139[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x552b25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe2cc('0x9')]['syncAgentConnect']=function(_0x3b35df){try{if(this['isNotNull'](_0x3b35df)){logger[_0xe2cc('0x53')]('[%s][voiceQueueReport][agentconnect]',_0x3b35df[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x3b35df,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3b35df[_0xe2cc('0x4d')]]){var _0x5df921=_[_0xe2cc('0x78')](this[_0xe2cc('0xd')][_0x3b35df['uniqueid']]);_0x5df921[_0xe2cc('0x38')]=!![];_0x5df921[_0xe2cc('0x55')]=_0xe2cc('0x85');logger[_0xe2cc('0x75')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5df921['queue'],_0x5df921[_0xe2cc('0x5a')]);}}}catch(_0x4fea0d){logger[_0xe2cc('0x41')](_0xe2cc('0x86'),_0x3b35df[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x4fea0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe2cc('0x22')]=function(_0x52b50c){try{if(this[_0xe2cc('0x5d')](_0x52b50c)){logger[_0xe2cc('0x53')](_0xe2cc('0x87'),_0x52b50c[_0xe2cc('0x4d')],util['inspect'](_0x52b50c,{'showHidden':![],'depth':null}));if(this[_0xe2cc('0xd')][_0x52b50c[_0xe2cc('0x4d')]]){var _0xb27f1a=_[_0xe2cc('0x78')](this[_0xe2cc('0xd')][_0x52b50c[_0xe2cc('0x4d')]]);_0xb27f1a['queuecallerabandon']=![];_0xb27f1a['queuecallerabandonAt']=null;_0xb27f1a[_0xe2cc('0x88')]=!![];_0xb27f1a[_0xe2cc('0x7e')]=_0x52b50c[_0xe2cc('0x89')];_0xb27f1a[_0xe2cc('0x7a')]=_0x52b50c['holdtime'];_0xb27f1a['queuecallercomplete']=!![];_0xb27f1a[_0xe2cc('0x36')]=![];_0xb27f1a[_0xe2cc('0x8a')]=null;if(!_0xb27f1a[_0xe2cc('0x8b')]){if(_0x52b50c[_0xe2cc('0x8c')]=='transfer'){_0xb27f1a[_0xe2cc('0x55')]=_0xe2cc('0x8d');logger[_0xe2cc('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xb27f1a[_0xe2cc('0x56')],_0xb27f1a[_0xe2cc('0x5a')]);}else{if(_['startsWith'](_0x52b50c[_0xe2cc('0x3d')][_0xe2cc('0x8e')](),'local/')){if(this['queueReports'][_0x52b50c[_0xe2cc('0x8f')]]){var _0x3a4221=_[_0xe2cc('0x78')](this['queueReports'][_0x52b50c[_0xe2cc('0x8f')]]);_0x3a4221[_0xe2cc('0x38')]=![];_0x3a4221[_0xe2cc('0x36')]=!![];_0x3a4221['queuecallerexitAt']=moment(_0xb27f1a[_0xe2cc('0x90')])[_0xe2cc('0x91')](_0x52b50c[_0xe2cc('0x7a')],_0xe2cc('0x92'))[_0xe2cc('0x4e')](_0xe2cc('0x7c'));_0x3a4221[_0xe2cc('0x55')]=_0xe2cc('0x93');_0x3a4221[_0xe2cc('0x8b')]=!![];_0x3a4221[_0xe2cc('0x94')]=_0xe2cc('0x95');_0x3a4221['transferexten']=_0x52b50c['destexten'];_0x3a4221[_0xe2cc('0x96')]=_0x52b50c[_0xe2cc('0x4d')];logger['info'](_0xe2cc('0x97'),_0x3a4221['queue'],_0x3a4221['type']);var _0x22c0c5=this[_0xe2cc('0xd')][_0x52b50c['linkedid']];this['queueReports'][_0x52b50c[_0xe2cc('0x8f')]]=this[_0xe2cc('0xd')][_0x52b50c[_0xe2cc('0x4d')]];this[_0xe2cc('0xd')][_0x52b50c['uniqueid']]=_0x22c0c5;}}else{_0xb27f1a[_0xe2cc('0x55')]=_0xe2cc('0x98')+_0x52b50c[_0xe2cc('0x8c')][_0xe2cc('0x99')]();logger[_0xe2cc('0x75')](_0xe2cc('0x9a'),_0xb27f1a[_0xe2cc('0x56')],_0xb27f1a[_0xe2cc('0x5a')],_0xb27f1a['queuecallerexitreason']);}}}this[_0xe2cc('0x10')][_0x52b50c[_0xe2cc('0x4d')]]=_0xb27f1a;}}}catch(_0x5e4e9e){logger[_0xe2cc('0x41')](_0xe2cc('0x87'),_0x52b50c['uniqueid'],util[_0xe2cc('0x44')](_0x5e4e9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x355fbe){try{if(this[_0xe2cc('0x5d')](_0x355fbe)){logger[_0xe2cc('0x53')](_0xe2cc('0x9b'),_0x355fbe[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x355fbe,{'showHidden':![],'depth':null}));this['addVariable'](_0x355fbe[_0xe2cc('0x4d')],_[_0xe2cc('0x77')](_0x355fbe['variable'])[0x0],_0x355fbe[_0xe2cc('0x9c')]);if(this['queueReports'][_0x355fbe['uniqueid']]){var _0x311841=_[_0xe2cc('0x78')](this[_0xe2cc('0xd')][_0x355fbe[_0xe2cc('0x4d')]]);if(_0x311841){if(this[_0xe2cc('0x5d')](_0x355fbe[_0xe2cc('0x9d')])&&this[_0xe2cc('0x5d')](_0x355fbe['variable'][_0xe2cc('0x68')])){switch(_0x355fbe[_0xe2cc('0x9c')]){case _0xe2cc('0x9e'):_0x311841[_0xe2cc('0x36')]=![];_0x311841['queuecallerexitAt']=null;break;case _0xe2cc('0x9f'):_0x311841[_0xe2cc('0xa0')]=_0xe2cc('0xa1');_0x311841[_0xe2cc('0x36')]=!![];_0x311841['queuecallerexitAt']=moment()[_0xe2cc('0x4e')](_0xe2cc('0x7c'));_0x311841['queuecallerleaveAt']=moment()[_0xe2cc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xe2cc('0x53')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x355fbe[_0xe2cc('0x4d')],util[_0xe2cc('0x44')](_0x311841,{'showHidden':![],'depth':null}));ami[_0xe2cc('0x49')](_0xe2cc('0xa2'),_0x311841);break;default:_0x311841['queuecallerexit']=!![];_0x311841[_0xe2cc('0x8a')]=moment()[_0xe2cc('0x4e')](_0xe2cc('0x7c'));_0x311841[_0xe2cc('0x80')]=moment()[_0xe2cc('0x4e')](_0xe2cc('0x7c'));}_0x311841[_0xe2cc('0x37')]=![];_0x311841[_0xe2cc('0xa3')]=null;_0x311841[_0xe2cc('0x55')]=_0x355fbe[_0xe2cc('0x9c')];this[_0xe2cc('0x10')][_0x355fbe['uniqueid']]=_0x311841;this[_0xe2cc('0x52')](_0x311841,'varset');}else if(this[_0xe2cc('0x5d')](_0x355fbe[_0xe2cc('0x9d')])&&this[_0xe2cc('0x5d')](_0x355fbe[_0xe2cc('0x9d')][_0xe2cc('0xa4')])){if(!_0x311841[_0xe2cc('0x37')]){_0x311841[_0xe2cc('0x36')]=!![];_0x311841[_0xe2cc('0x8a')]=moment()['format'](_0xe2cc('0x7c'));_0x311841['queuecallerexitreason']=_0xe2cc('0xa5');_0x311841[_0xe2cc('0x80')]=moment()[_0xe2cc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x355fbe[_0xe2cc('0x4d')]]=_0x311841;}}logger[_0xe2cc('0x75')](_0xe2cc('0xa6'),_0x355fbe[_0xe2cc('0x4d')],_0x311841[_0xe2cc('0x56')],_0x311841[_0xe2cc('0x5a')],_['keys'](_0x355fbe[_0xe2cc('0x9d')])[0x0],_0x355fbe[_0xe2cc('0x9c')]);_0x311841[_0xe2cc('0x15')]=this['variables'][_0x355fbe[_0xe2cc('0x4d')]];}}}}catch(_0x4a85fd){logger[_0xe2cc('0x41')](_0xe2cc('0x9b'),_0x355fbe['uniqueid'],util[_0xe2cc('0x44')](_0x4a85fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe2cc('0x9')][_0xe2cc('0xa7')]=function(_0x51cb2e,_0x182c50,_0x2cd66c){var _0x162490=['rtpaudioqos','rtpaudioqosbridged',_0xe2cc('0xa8'),_0xe2cc('0xa9'),_0xe2cc('0xaa'),'rtpaudioqoslossbridged',_0xe2cc('0xab'),_0xe2cc('0xac'),'sipcallid',_0xe2cc('0xad'),'bridgepeer',_0xe2cc('0xae'),_0xe2cc('0xaf'),'memberdynamic',_0xe2cc('0xb0'),'memberlastcall','membername','memberpenalty',_0xe2cc('0xb1')];if(!_[_0xe2cc('0x3a')](_0x182c50)&&!_[_0xe2cc('0xb2')](_0x162490,_0x182c50)){if(_[_0xe2cc('0x71')](this[_0xe2cc('0x15')][_0x51cb2e])){this[_0xe2cc('0x15')][_0x51cb2e]={};}this[_0xe2cc('0x15')][_0x51cb2e][_0x182c50]=_0x2cd66c;}};VoiceQueueReport[_0xe2cc('0x9')]['handleHangup']=function(_0x15b770,_0x4d4420,_0x417533){try{var _0x27bcb6={};if(this[_0xe2cc('0xd')][_0x15b770]){for(var _0x2761fb=0x0;_0x2761fb0x0?!![]:![];if(!_0x2eca46){return this[_0x31c2('0x1a')](this[_0x31c2('0x15')][_0x31c2('0x70')]);}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x1c')]=function(_0x3fbda3){var _0x18abab=this[_0x31c2('0x15')]['id'];if(this[_0x31c2('0x15')][_0x31c2('0x63')][_0x18abab]&&this[_0x31c2('0x15')][_0x31c2('0x63')][_0x18abab][_0x3fbda3[_0x31c2('0x62')]]){this[_0x31c2('0x15')]['queuestatus'][_0x18abab][_0x3fbda3[_0x31c2('0x62')]]['agents'][_0x31c2('0x71')](_0x3fbda3);}};VoiceQueueReport[_0x31c2('0xc')]['syncQueueSummary']=function(_0x4b52db){var _0xb701af=this;try{if(this[_0x31c2('0x72')](_0x4b52db)&&this[_0x31c2('0x72')](_0x4b52db[_0x31c2('0x4f')])){logger[_0x31c2('0x51')](_0x31c2('0x73'),util[_0x31c2('0x43')](_0x4b52db,{'showHidden':![],'depth':null}));var _0x49f486=this[_0x31c2('0x13')][_0x4b52db[_0x31c2('0x4f')]];if(_0x49f486){logger[_0x31c2('0x51')](_0x31c2('0x74'),_0x49f486['name']);this[_0x31c2('0x15')][_0x31c2('0x5f')][_0x49f486[_0x31c2('0x66')]]={'summaryEvent':_0x4b52db};this['summary'][_0x31c2('0x6f')]+=0x1;return ami['Action']({'action':_0x31c2('0x63'),'queue':_0x49f486[_0x31c2('0x66')]})[_0x31c2('0x61')](function(_0x37d55d){if(!_0xb701af[_0x31c2('0x15')]['queuestatus'][_0x4b52db[_0x31c2('0x62')]]){_0xb701af['summary']['queuestatus'][_0x4b52db[_0x31c2('0x62')]]={};}_0xb701af[_0x31c2('0x15')]['queuestatus'][_0x4b52db[_0x31c2('0x62')]][_0x37d55d[_0x31c2('0x62')]]={'queue':_0x49f486['name'],'agents':[]};})[_0x31c2('0x3e')](function(_0x121dc2){throw _0x121dc2;});}}}catch(_0x514136){logger['error'](_0x31c2('0x64'),util[_0x31c2('0x43')](_0x514136,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x1a')]=function(_0x47d6cb){if(this[_0x31c2('0x15')][_0x31c2('0x6f')]>0x0){this[_0x31c2('0x15')][_0x31c2('0x70')]=_0x47d6cb;return;}logger[_0x31c2('0x51')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x31c2('0x43')](_0x47d6cb,{'showHidden':![],'depth':null}));this[_0x31c2('0x15')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2beaa8){try{if(this[_0x31c2('0x72')](_0x2beaa8)){logger[_0x31c2('0x51')](_0x31c2('0x75'),_0x2beaa8['uniqueid'],util['inspect'](_0x2beaa8,{'showHidden':![],'depth':null}));if(_[_0x31c2('0x5c')](this['queueReports'][_0x2beaa8[_0x31c2('0x4d')]])){this[_0x31c2('0x44')][_0x2beaa8[_0x31c2('0x4d')]]=[];}if(_['isUndefined'](this[_0x31c2('0x11')][_0x2beaa8['uniqueid']])){this[_0x31c2('0x11')][_0x2beaa8[_0x31c2('0x4d')]]={};}var _0x268542=new QueueReport();_0x268542[_0x31c2('0x4f')]=_0x2beaa8[_0x31c2('0x4f')];_0x268542[_0x31c2('0x59')]=this[_0x31c2('0x13')][_0x268542[_0x31c2('0x4f')]]&&this['voiceQueues'][_0x268542[_0x31c2('0x4f')]][_0x31c2('0x59')]?this[_0x31c2('0x13')][_0x268542[_0x31c2('0x4f')]][_0x31c2('0x59')]||'inbound':_0x31c2('0x5a');_0x268542[_0x31c2('0x76')]=moment()['format'](_0x31c2('0x77'));_0x268542[_0x31c2('0x78')]=_0x2beaa8['position'];_0x268542['count']=_0x2beaa8[_0x31c2('0x79')];_0x268542[_0x31c2('0x4d')]=_0x2beaa8[_0x31c2('0x4d')];_0x268542['routealias']=this[_0x31c2('0x11')][_0x2beaa8[_0x31c2('0x4d')]][_0x31c2('0x7a')];logger[_0x31c2('0x7b')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x268542[_0x31c2('0x4f')],_0x268542[_0x31c2('0x59')]);Object[_0x31c2('0x6b')](_0x268542,_[_0x31c2('0x7c')](_0x2beaa8,_[_0x31c2('0x7d')](_0x268542)));this['queueReports'][_0x2beaa8[_0x31c2('0x4d')]][_0x31c2('0x71')](_0x268542);this['channels'][_0x2beaa8[_0x31c2('0x4d')]]=_0x268542;this[_0x31c2('0x7e')](_0x268542,_0x31c2('0x1f'));}}catch(_0x279bc6){logger[_0x31c2('0x41')](_0x31c2('0x75'),_0x2beaa8[_0x31c2('0x4d')],util['inspect'](_0x279bc6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['syncQueueCallerAbandon']=function(_0x67daf4){try{if(this[_0x31c2('0x72')](_0x67daf4)){logger['debug'](_0x31c2('0x7f'),_0x67daf4['uniqueid'],util[_0x31c2('0x43')](_0x67daf4,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x67daf4[_0x31c2('0x4d')]]){var _0x4a99c6=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x67daf4['uniqueid']]);_0x4a99c6[_0x31c2('0x3a')]=![];_0x4a99c6[_0x31c2('0x81')]=null;_0x4a99c6[_0x31c2('0x82')]=_0x67daf4[_0x31c2('0x82')];_0x4a99c6[_0x31c2('0x83')]=_0x67daf4[_0x31c2('0x83')];_0x4a99c6[_0x31c2('0x21')]=!![];_0x4a99c6[_0x31c2('0x84')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0x4a99c6['queuecallerexitreason']=_0x31c2('0x85');_0x4a99c6[_0x31c2('0x86')]=null;logger[_0x31c2('0x7b')](_0x31c2('0x87'),_0x4a99c6[_0x31c2('0x4f')],_0x4a99c6[_0x31c2('0x59')]);this[_0x31c2('0x11')][_0x67daf4[_0x31c2('0x4d')]]=_0x4a99c6;this[_0x31c2('0x49')](_0x4a99c6,_0x31c2('0x21'));}}}catch(_0x49f0d9){logger['error'](_0x31c2('0x7f'),_0x67daf4[_0x31c2('0x4d')],util['inspect'](_0x49f0d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x23')]=function(_0x438818){try{if(this[_0x31c2('0x72')](_0x438818)){logger[_0x31c2('0x51')]('[%s][voiceQueueReport][queuecallerleave]',_0x438818[_0x31c2('0x4d')],util['inspect'](_0x438818,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x438818['uniqueid']]){var _0xdccd99=_[_0x31c2('0x80')](this['queueReports'][_0x438818['uniqueid']]);_0xdccd99[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0xdccd99[_0x31c2('0x89')]=_0x438818['connectedlinenum'];_0xdccd99[_0x31c2('0x8a')]=_0x438818[_0x31c2('0x8a')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xdccd99[_0x31c2('0x4f')],_0xdccd99[_0x31c2('0x59')],_0x438818[_0x31c2('0x89')],_0x438818[_0x31c2('0x8a')]);this[_0x31c2('0x11')][_0x438818[_0x31c2('0x4d')]]=_0xdccd99;this[_0x31c2('0x7e')](_0xdccd99,'queuecallerleave');}}}catch(_0xbc1b97){logger[_0x31c2('0x41')](_0x31c2('0x8b'),_0x438818[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0xbc1b97,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')][_0x31c2('0x27')]=function(_0x236ea2){try{if(this[_0x31c2('0x72')](_0x236ea2)){logger['debug'](_0x31c2('0x8c'),_0x236ea2[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x236ea2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x236ea2[_0x31c2('0x4d')]]){var _0x4d5428=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x236ea2[_0x31c2('0x4d')]]);_0x4d5428[_0x31c2('0x3a')]=!![];_0x4d5428[_0x31c2('0x53')]=_0x31c2('0x8d');logger['info'](_0x31c2('0x8e'),_0x4d5428[_0x31c2('0x4f')],_0x4d5428[_0x31c2('0x59')]);}}}catch(_0x4b8676){logger[_0x31c2('0x41')](_0x31c2('0x8c'),_0x236ea2[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x4b8676,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x21b2df){try{if(this[_0x31c2('0x72')](_0x21b2df)){logger[_0x31c2('0x51')](_0x31c2('0x8f'),_0x21b2df[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x21b2df,{'showHidden':![],'depth':null}));if(this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]){var _0x3edeb3=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]);_0x3edeb3[_0x31c2('0x21')]=![];_0x3edeb3['queuecallerabandonAt']=null;_0x3edeb3[_0x31c2('0x90')]=!![];_0x3edeb3[_0x31c2('0x86')]=_0x21b2df[_0x31c2('0x91')];_0x3edeb3[_0x31c2('0x82')]=_0x21b2df[_0x31c2('0x82')];_0x3edeb3[_0x31c2('0x3a')]=!![];_0x3edeb3[_0x31c2('0x39')]=![];_0x3edeb3[_0x31c2('0x92')]=null;if(!_0x3edeb3[_0x31c2('0x93')]){if(_0x21b2df[_0x31c2('0x94')]==_0x31c2('0x93')){_0x3edeb3['queuecallerexitreason']=_0x31c2('0x95');logger[_0x31c2('0x7b')](_0x31c2('0x96'),_0x3edeb3[_0x31c2('0x4f')],_0x3edeb3[_0x31c2('0x59')]);}else{if(_[_0x31c2('0x97')](_0x21b2df[_0x31c2('0x3d')][_0x31c2('0x98')](),_0x31c2('0x99'))){if(this[_0x31c2('0x44')][_0x21b2df['linkedid']]){var _0x334953=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x9a')]]);_0x334953[_0x31c2('0x3a')]=![];_0x334953[_0x31c2('0x39')]=!![];_0x334953['queuecallerexitAt']=moment(_0x3edeb3[_0x31c2('0x76')])['add'](_0x21b2df[_0x31c2('0x82')],_0x31c2('0x9b'))[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x334953[_0x31c2('0x53')]=_0x31c2('0x9c');_0x334953[_0x31c2('0x93')]=!![];_0x334953[_0x31c2('0x9d')]=_0x31c2('0x9e');_0x334953[_0x31c2('0x9f')]=_0x21b2df[_0x31c2('0xa0')];_0x334953[_0x31c2('0xa1')]=_0x21b2df[_0x31c2('0x4d')];logger[_0x31c2('0x7b')](_0x31c2('0xa2'),_0x334953[_0x31c2('0x4f')],_0x334953['type']);var _0x410aca=this['queueReports'][_0x21b2df['linkedid']];this['queueReports'][_0x21b2df[_0x31c2('0x9a')]]=this['queueReports'][_0x21b2df[_0x31c2('0x4d')]];this[_0x31c2('0x44')][_0x21b2df[_0x31c2('0x4d')]]=_0x410aca;}}else{_0x3edeb3[_0x31c2('0x53')]=_0x31c2('0xa3')+_0x21b2df['reason'][_0x31c2('0xa4')]();logger['info'](_0x31c2('0xa5'),_0x3edeb3['queue'],_0x3edeb3[_0x31c2('0x59')],_0x3edeb3['queuecallerexitreason']);}}}this[_0x31c2('0x11')][_0x21b2df[_0x31c2('0x4d')]]=_0x3edeb3;}}}catch(_0x4875e1){logger[_0x31c2('0x41')](_0x31c2('0x8f'),_0x21b2df[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x4875e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['syncVarSet']=function(_0x1074c8){try{if(this[_0x31c2('0x72')](_0x1074c8)){logger[_0x31c2('0x51')](_0x31c2('0xa6'),_0x1074c8[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x1074c8,{'showHidden':![],'depth':null}));this[_0x31c2('0xa7')](_0x1074c8[_0x31c2('0x4d')],_[_0x31c2('0x7d')](_0x1074c8[_0x31c2('0xa8')])[0x0],_0x1074c8['value']);if(this[_0x31c2('0x44')][_0x1074c8['uniqueid']]){var _0x162ab7=_[_0x31c2('0x80')](this[_0x31c2('0x44')][_0x1074c8['uniqueid']]);if(_0x162ab7){if(this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')])&&this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')][_0x31c2('0x63')])){switch(_0x1074c8[_0x31c2('0xa9')]){case _0x31c2('0xaa'):_0x162ab7[_0x31c2('0x39')]=![];_0x162ab7[_0x31c2('0x92')]=null;break;case _0x31c2('0xab'):_0x162ab7[_0x31c2('0xac')]=_0x31c2('0xad');_0x162ab7[_0x31c2('0x39')]=!![];_0x162ab7[_0x31c2('0x92')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));_0x162ab7['queuecallerleaveAt']=moment()[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1074c8['uniqueid'],util[_0x31c2('0x43')](_0x162ab7,{'showHidden':![],'depth':null}));ami[_0x31c2('0x4a')](_0x31c2('0xae'),_0x162ab7);break;default:_0x162ab7['queuecallerexit']=!![];_0x162ab7[_0x31c2('0x92')]=moment()[_0x31c2('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x162ab7[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));}_0x162ab7['queuecallerabandon']=![];_0x162ab7[_0x31c2('0x84')]=null;_0x162ab7['queuecallerexitreason']=_0x1074c8[_0x31c2('0xa9')];this[_0x31c2('0x11')][_0x1074c8[_0x31c2('0x4d')]]=_0x162ab7;this['emitVoiceQueueChannelRemove'](_0x162ab7,_0x31c2('0x28'));}else if(this[_0x31c2('0x72')](_0x1074c8['variable'])&&this[_0x31c2('0x72')](_0x1074c8[_0x31c2('0xa8')][_0x31c2('0xaf')])){if(!_0x162ab7[_0x31c2('0x21')]){_0x162ab7['queuecallerexit']=!![];_0x162ab7['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x162ab7[_0x31c2('0x53')]=_0x31c2('0xb0');_0x162ab7[_0x31c2('0x88')]=moment()[_0x31c2('0x4e')](_0x31c2('0x77'));this[_0x31c2('0x11')][_0x1074c8[_0x31c2('0x4d')]]=_0x162ab7;}}logger[_0x31c2('0x7b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1074c8[_0x31c2('0x4d')],_0x162ab7[_0x31c2('0x4f')],_0x162ab7['type'],_[_0x31c2('0x7d')](_0x1074c8['variable'])[0x0],_0x1074c8[_0x31c2('0xa9')]);_0x162ab7['variables']=this[_0x31c2('0x16')][_0x1074c8['uniqueid']];}}}}catch(_0x48e21c){logger[_0x31c2('0x41')]('[%s][voiceQueueReport][varset]',_0x1074c8[_0x31c2('0x4d')],util[_0x31c2('0x43')](_0x48e21c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31c2('0xc')]['addVariable']=function(_0x4e332a,_0x4ca8d7,_0x387d5){var _0x53fdde=[_0x31c2('0xb1'),_0x31c2('0xb2'),_0x31c2('0xb3'),_0x31c2('0xb4'),_0x31c2('0xb5'),_0x31c2('0xb6'),_0x31c2('0xb7'),_0x31c2('0xb8'),_0x31c2('0xb9'),_0x31c2('0xba'),_0x31c2('0xbb'),_0x31c2('0xbc'),_0x31c2('0xbd'),_0x31c2('0xbe'),_0x31c2('0xbf'),_0x31c2('0xc0'),_0x31c2('0x91'),_0x31c2('0xc1'),_0x31c2('0xc2')];if(!_['isNil'](_0x4ca8d7)&&!_[_0x31c2('0xc3')](_0x53fdde,_0x4ca8d7)){if(_['isUndefined'](this[_0x31c2('0x16')][_0x4e332a])){this['variables'][_0x4e332a]={};}this[_0x31c2('0x16')][_0x4e332a][_0x4ca8d7]=_0x387d5;}};VoiceQueueReport['prototype'][_0x31c2('0xc4')]=function(_0x155818,_0x2238da,_0x590354){try{var _0x5f2871={};if(this['queueReports'][_0x155818]){for(var _0x10f76b=0x0;_0x10f76b=0x0?moment(_0x4eda0f[_0x0d5a('0x1c')])['diff'](_0x4eda0f[_0x0d5a('0x1d')],_0x0d5a('0x10')):null,'data1':_0x0d5a('0x1e'),'data2':_0x4eda0f['accountcode'],'data3':_0x4eda0f[_0x0d5a('0x13')],'data4':_0x4eda0f[_0x0d5a('0x1f')]||null,'role':_0x0d5a('0x15'),'internal':_0x4eda0f['accountcode']?_[_0x0d5a('0x16')](_0x4eda0f['accountcode']):undefined,'uniqueid':_0x4eda0f[_0x0d5a('0x18')]},'log':_0x0d5a('0x19')});}; \ No newline at end of file +var _0xd5ba=['interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','dialstring','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5ba,0x170));var _0xad5b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xd5ba[_0x59c301];return _0x3866b9;};'use strict';var moment=require('moment');var _=require(_0xad5b('0x0'));var util=require('util');var client=require(_0xad5b('0x1'));exports[_0xad5b('0x2')]=function(_0x2ceef0){var _0x68e110=_0x2ceef0['queuecallercompleteAt']||_0x2ceef0[_0xad5b('0x3')];return client[_0xad5b('0x4')](_0xad5b('0x5'),{'body':{'channel':_0xad5b('0x6'),'membername':_0x2ceef0[_0xad5b('0x7')],'interface':_[_0xad5b('0x8')](_0x2ceef0[_0xad5b('0x9')])?util[_0xad5b('0xa')](_0xad5b('0xb'),_0x2ceef0[_0xad5b('0x7')]):_0x2ceef0['interface'],'type':_0xad5b('0xc'),'enterAt':_0x2ceef0[_0xad5b('0xd')],'exitAt':_0x68e110,'duration':moment(_0x68e110)[_0xad5b('0xe')](_0x2ceef0[_0xad5b('0xd')],_0xad5b('0xf')),'data1':_0xad5b('0x10'),'data2':_0x2ceef0[_0xad5b('0x11')],'data3':_0x2ceef0[_0xad5b('0x12')],'data4':null,'data5':_0x2ceef0[_0xad5b('0x13')],'role':_0xad5b('0x14'),'internal':_0x2ceef0[_0xad5b('0x15')]?_[_0xad5b('0x16')](_0x2ceef0[_0xad5b('0x15')]):undefined,'uniqueid':_0x2ceef0[_0xad5b('0x17')]},'log':_0xad5b('0x5')});};exports[_0xad5b('0x18')]=function(_0x32cd71){return client['Request'](_0xad5b('0x5'),{'body':{'channel':_0xad5b('0x6'),'membername':_0x32cd71[_0xad5b('0x19')],'interface':_0x32cd71[_0xad5b('0x9')],'type':_0xad5b('0xc'),'enterAt':_0x32cd71['starttime'],'exitAt':_0x32cd71['endtime'],'duration':moment(_0x32cd71[_0xad5b('0x1a')])[_0xad5b('0xe')](_0x32cd71[_0xad5b('0x1b')],'seconds')>=0x0?moment(_0x32cd71[_0xad5b('0x1a')])[_0xad5b('0xe')](_0x32cd71[_0xad5b('0x1b')],_0xad5b('0xf')):null,'data1':'outbound','data2':_0x32cd71[_0xad5b('0x15')],'data3':_0x32cd71['exten'],'data4':_0x32cd71[_0xad5b('0x1c')]||null,'role':_0xad5b('0x14'),'internal':_0x32cd71['accountcode']?_[_0xad5b('0x16')](_0x32cd71[_0xad5b('0x15')]):undefined,'uniqueid':_0x32cd71[_0xad5b('0x17')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c6c51fa..3b595ed 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 _0x28cd=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0xfe645a,_0x1da1d0){var _0x49581d=function(_0x5cf2aa){while(--_0x5cf2aa){_0xfe645a['push'](_0xfe645a['shift']());}};_0x49581d(++_0x1da1d0);}(_0x28cd,0x177));var _0xd28c=function(_0x587193,_0x10c52c){_0x587193=_0x587193-0x0;var _0x4e618c=_0x28cd[_0x587193];return _0x4e618c;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xd28c('0x0')](_0xd28c('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd28c('0x2'),_0xd28c('0x3')]},'log':_0xd28c('0x4')});}; \ No newline at end of file +var _0x3308=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3308,0x160));var _0x8330=function(_0xd31d3e,_0x5c7ca9){_0xd31d3e=_0xd31d3e-0x0;var _0x507eb6=_0x3308[_0xd31d3e];return _0x507eb6;};'use strict';var client=require(_0x8330('0x0'));exports[_0x8330('0x1')]=function(){return client[_0x8330('0x2')](_0x8330('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8330('0x4'),_0x8330('0x5')]},'log':_0x8330('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6f3fe6d..719ef0e 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 _0x0447=['GetTemplate','../client','getTemplates','Request','name','html'];(function(_0x30edce,_0x1162c7){var _0xadd980=function(_0x52c286){while(--_0x52c286){_0x30edce['push'](_0x30edce['shift']());}};_0xadd980(++_0x1162c7);}(_0x0447,0x8b));var _0x7044=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x0447[_0x462999];return _0x4b1366;};'use strict';var client=require(_0x7044('0x0'));exports[_0x7044('0x1')]=function(_0x1cdd9f){return function(_0x24b9f7){return client[_0x7044('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x7044('0x3'),_0x7044('0x4')]},'log':_0x7044('0x5')});};}; \ No newline at end of file +var _0xd921=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x174baf,_0x2b52c0){var _0xadcbb9=function(_0x41069d){while(--_0x41069d){_0x174baf['push'](_0x174baf['shift']());}};_0xadcbb9(++_0x2b52c0);}(_0xd921,0x19f));var _0x1d92=function(_0x37d5f0,_0x1dd34d){_0x37d5f0=_0x37d5f0-0x0;var _0x5c3ee2=_0xd921[_0x37d5f0];return _0x5c3ee2;};'use strict';var client=require(_0x1d92('0x0'));exports[_0x1d92('0x1')]=function(_0x42b00c){return function(_0x1c157d){return client[_0x1d92('0x2')](_0x1d92('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1d92('0x4'),_0x1d92('0x5')]},'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 be024cb..106a2c2 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 _0xf4e0=['Action','Actions','action','data1','data2','data5','data6','../client','getTriggers','Request','GetTrigger','channel','Condition','field','operator','value','AnyConditions'];(function(_0x1afd57,_0x24d036){var _0x191c63=function(_0x118576){while(--_0x118576){_0x1afd57['push'](_0x1afd57['shift']());}};_0x191c63(++_0x24d036);}(_0xf4e0,0x1c1));var _0x0f4e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4e0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0f4e('0x0'));exports[_0x0f4e('0x1')]=function(_0x24d02b){return function(_0x5f2fa1){return client[_0x0f4e('0x2')](_0x0f4e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0f4e('0x4'),'status'],'include':[{'model':_0x0f4e('0x5'),'as':'AllConditions','attributes':['id',_0x0f4e('0x6'),_0x0f4e('0x7'),_0x0f4e('0x8')]},{'model':_0x0f4e('0x5'),'as':_0x0f4e('0x9'),'attributes':['id',_0x0f4e('0x6'),_0x0f4e('0x7'),_0x0f4e('0x8')]},{'model':_0x0f4e('0xa'),'as':_0x0f4e('0xb'),'attributes':['id',_0x0f4e('0xc'),_0x0f4e('0xd'),_0x0f4e('0xe'),'data3','data4',_0x0f4e('0xf'),_0x0f4e('0x10'),'data7']}]},'log':_0x0f4e('0x3')});};}; \ No newline at end of file +var _0x3f53=['Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','status'];(function(_0x18e58f,_0xe7beb3){var _0x273290=function(_0xc7a3c6){while(--_0xc7a3c6){_0x18e58f['push'](_0x18e58f['shift']());}};_0x273290(++_0xe7beb3);}(_0x3f53,0x1c8));var _0x33f5=function(_0x4fb098,_0x4c1e11){_0x4fb098=_0x4fb098-0x0;var _0x73b01f=_0x3f53[_0x4fb098];return _0x73b01f;};'use strict';var client=require(_0x33f5('0x0'));exports[_0x33f5('0x1')]=function(_0x466ca6){return function(_0x3e166a){return client['Request'](_0x33f5('0x2'),{'options':{'raw':![],'attributes':['id',_0x33f5('0x3'),_0x33f5('0x4'),_0x33f5('0x5')],'include':[{'model':_0x33f5('0x6'),'as':_0x33f5('0x7'),'attributes':['id',_0x33f5('0x8'),_0x33f5('0x9'),'value']},{'model':'Condition','as':_0x33f5('0xa'),'attributes':['id','field',_0x33f5('0x9'),_0x33f5('0xb')]},{'model':_0x33f5('0xc'),'as':_0x33f5('0xd'),'attributes':['id',_0x33f5('0xe'),_0x33f5('0xf'),_0x33f5('0x10'),_0x33f5('0x11'),_0x33f5('0x12'),_0x33f5('0x13'),_0x33f5('0x14'),_0x33f5('0x15')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index efe844b..a41cd5d 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 _0x736a=['getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x499cd9,_0x5b8ade){var _0x1033e0=function(_0x2e5029){while(--_0x2e5029){_0x499cd9['push'](_0x499cd9['shift']());}};_0x1033e0(++_0x5b8ade);}(_0x736a,0x96));var _0xa736=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x736a[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0xa736('0x0')]=function(_0x2a591c){return function(_0x42bba1){return client[_0xa736('0x1')](_0xa736('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa736('0x3'),_0xa736('0x4'),_0xa736('0x5')]},'log':_0xa736('0x2')});};}; \ No newline at end of file +var _0x68da=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x68da,0x173));var _0xa68d=function(_0x4bbaba,_0x15097c){_0x4bbaba=_0x4bbaba-0x0;var _0x34ff2b=_0x68da[_0x4bbaba];return _0x34ff2b;};'use strict';var client=require(_0xa68d('0x0'));exports[_0xa68d('0x1')]=function(_0x4dbc6a){return function(_0x491959){return client[_0xa68d('0x2')](_0xa68d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa68d('0x4'),_0xa68d('0x5'),_0xa68d('0x6')]},'log':_0xa68d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9529122..69201bd 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x15eb4e,_0x4d4b52){var _0x174ec1=function(_0x692e20){while(--_0x692e20){_0x15eb4e['push'](_0x15eb4e['shift']());}};_0x174ec1(++_0x4d4b52);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0xcb91[_0x455150];return _0x12ca9c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2b77a4,_0x19d54f){var _0x331361=function(_0x43dd33){while(--_0x43dd33){_0x2b77a4['push'](_0x2b77a4['shift']());}};_0x331361(++_0x19d54f);}(_0x70e0,0x17b));var _0x070e=function(_0x5b8b62,_0x59bb5f){_0x5b8b62=_0x5b8b62-0x0;var _0xe514d2=_0x70e0[_0x5b8b62];return _0xe514d2;};'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 bf369d4..1f53c95 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 _0x8028=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x1286eb,_0x237b88){var _0x270cd8=function(_0x5a46e8){while(--_0x5a46e8){_0x1286eb['push'](_0x1286eb['shift']());}};_0x270cd8(++_0x237b88);}(_0x8028,0x180));var _0x8802=function(_0x4a5062,_0x585629){_0x4a5062=_0x4a5062-0x0;var _0x13bd76=_0x8028[_0x4a5062];return _0x13bd76;};'use strict';var client=require(_0x8802('0x0'));exports['create']=function(_0x4dbcd2){return client['Request'](_0x8802('0x1'),{'body':_0x4dbcd2,'log':_0x8802('0x1')});};exports[_0x8802('0x2')]=function(_0x4fb4fe,_0x185c2d,_0x4260a2){return client[_0x8802('0x3')](_0x8802('0x4'),{'body':_0x4fb4fe,'options':{'where':{'uniqueid':_0x185c2d,'interface':_0x4260a2,'agentcomplete':!![]}},'log':_0x8802('0x4')});}; \ No newline at end of file +var _0x5110=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0x5110,0x1ec));var _0x0511=function(_0x3c4060,_0x4567fe){_0x3c4060=_0x3c4060-0x0;var _0x15a870=_0x5110[_0x3c4060];return _0x15a870;};'use strict';var client=require(_0x0511('0x0'));exports[_0x0511('0x1')]=function(_0x33421d){return client[_0x0511('0x2')](_0x0511('0x3'),{'body':_0x33421d,'log':_0x0511('0x3')});};exports['update']=function(_0x5c14ac,_0x60261,_0x198de4){return client['Request'](_0x0511('0x4'),{'body':_0x5c14ac,'options':{'where':{'uniqueid':_0x60261,'interface':_0x198de4,'agentcomplete':!![]}},'log':_0x0511('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cfb134c..e125938 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 _0x8349=['startOf','YYYY-MM-DD\x20HH:mm:ss','day','format','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x3a2653,_0x10adac){var _0x251d1b=function(_0x19e56c){while(--_0x19e56c){_0x3a2653['push'](_0x3a2653['shift']());}};_0x251d1b(++_0x10adac);}(_0x8349,0x104));var _0x9834=function(_0x8f6830,_0x7c8a1e){_0x8f6830=_0x8f6830-0x0;var _0x4ce2e5=_0x8349[_0x8f6830];return _0x4ce2e5;};'use strict';var moment=require(_0x9834('0x0'));var util=require(_0x9834('0x1'));var _=require(_0x9834('0x2'));var client=require(_0x9834('0x3'));exports[_0x9834('0x4')]=function(_0x5dd80d){return client[_0x9834('0x5')](_0x9834('0x6'),{'body':_['merge'](_0x5dd80d,{'source':_0x5dd80d[_0x9834('0x7')],'destinationcontext':_0x5dd80d[_0x9834('0x8')],'callerid':_0x5dd80d['callerid'],'amaflags':_0x9834('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x9834('0xa')]=function(){return function(){return client[_0x9834('0x5')](_0x9834('0xb'),{'options':{'where':{'type':[_0x9834('0xc')],'createdAt':{'$between':[moment()[_0x9834('0xd')]('day')['format'](_0x9834('0xe')),moment()['endOf'](_0x9834('0xf'))[_0x9834('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9834('0x11'),_0x9834('0x12'),'duration',_0x9834('0x13')]},'log':_0x9834('0x14')});};}; \ No newline at end of file +var _0xbb6b=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb6b,0xdb));var _0xbbb6=function(_0x5b7fc7,_0x16ba12){_0x5b7fc7=_0x5b7fc7-0x0;var _0x15445e=_0xbb6b[_0x5b7fc7];return _0x15445e;};'use strict';var moment=require(_0xbbb6('0x0'));var util=require(_0xbbb6('0x1'));var _=require(_0xbbb6('0x2'));var client=require(_0xbbb6('0x3'));exports[_0xbbb6('0x4')]=function(_0x1a38a3){return client[_0xbbb6('0x5')](_0xbbb6('0x6'),{'body':_[_0xbbb6('0x7')](_0x1a38a3,{'source':_0x1a38a3[_0xbbb6('0x8')],'destinationcontext':_0x1a38a3[_0xbbb6('0x9')],'callerid':_0x1a38a3[_0xbbb6('0xa')],'amaflags':_0xbbb6('0xb')}),'log':'CreateVoiceCallReport'});};exports[_0xbbb6('0xc')]=function(){return function(){return client[_0xbbb6('0x5')](_0xbbb6('0xd'),{'options':{'where':{'type':[_0xbbb6('0xe')],'createdAt':{'$between':[moment()[_0xbbb6('0xf')](_0xbbb6('0x10'))['format'](_0xbbb6('0x11')),moment()[_0xbbb6('0x12')](_0xbbb6('0x10'))[_0xbbb6('0x13')](_0xbbb6('0x11'))]}},'attributes':[_0xbbb6('0x14'),_0xbbb6('0x15'),_0xbbb6('0x16'),_0xbbb6('0x17')]},'log':_0xbbb6('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a52b831..f4b9a39 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 _0x87c8=['CreateVoiceDialReport','create'];(function(_0x24b3f5,_0x1659fb){var _0x384509=function(_0x1ba57a){while(--_0x1ba57a){_0x24b3f5['push'](_0x24b3f5['shift']());}};_0x384509(++_0x1659fb);}(_0x87c8,0x197));var _0x887c=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x87c8[_0x32f7d7];return _0x133d09;};'use strict';var client=require('../client');exports[_0x887c('0x0')]=function(_0x58c0d9){return client['Request'](_0x887c('0x1'),{'body':_0x58c0d9,'log':_0x887c('0x1')});}; \ No newline at end of file +var _0x3602=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3602,0xab));var _0x2360=function(_0x14dac2,_0x2a1b12){_0x14dac2=_0x14dac2-0x0;var _0x16ff16=_0x3602[_0x14dac2];return _0x16ff16;};'use strict';var client=require(_0x2360('0x0'));exports[_0x2360('0x1')]=function(_0x5ea8fa){return client[_0x2360('0x2')](_0x2360('0x3'),{'body':_0x5ea8fa,'log':_0x2360('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 62adf59..fa975e8 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 _0x1789=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x4ac11e,_0x3711ee){var _0x5cd47d=function(_0xdfcd32){while(--_0xdfcd32){_0x4ac11e['push'](_0x4ac11e['shift']());}};_0x5cd47d(++_0x3711ee);}(_0x1789,0x92));var _0x9178=function(_0x349077,_0x2eafb1){_0x349077=_0x349077-0x0;var _0x277000=_0x1789[_0x349077];return _0x277000;};'use strict';var client=require(_0x9178('0x0'));exports[_0x9178('0x1')]=function(){return function(){return client[_0x9178('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x9178('0x3'),_0x9178('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x9178('0x1')});};}; \ No newline at end of file +var _0x1094=['getVoiceExtensions','GetVoiceExtension','recordingFormat','../client'];(function(_0x5a75e7,_0x3ad506){var _0x15c695=function(_0x4ba933){while(--_0x4ba933){_0x5a75e7['push'](_0x5a75e7['shift']());}};_0x15c695(++_0x3ad506);}(_0x1094,0x143));var _0x4109=function(_0x1ac33a,_0x52f6f8){_0x1ac33a=_0x1ac33a-0x0;var _0x3b6b87=_0x1094[_0x1ac33a];return _0x3b6b87;};'use strict';var client=require(_0x4109('0x0'));exports[_0x4109('0x1')]=function(){return function(){return client['Request'](_0x4109('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x4109('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x4109('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5051d1d..bb85c70 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 _0x4499=['mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','TrunkBackup','active','Interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x4499,0x145));var _0x9449=function(_0x5301b9,_0x438dd2){_0x5301b9=_0x5301b9-0x0;var _0xe1fe8c=_0x4499[_0x5301b9];return _0xe1fe8c;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x9449('0x0')](_0x9449('0x1'),{'options':{'raw':![],'attributes':['id',_0x9449('0x2'),_0x9449('0x3'),_0x9449('0x4'),_0x9449('0x5'),'monitor_format',_0x9449('0x6'),_0x9449('0x7'),'dialMethod','dialLimitChannel',_0x9449('0x8'),_0x9449('0x9'),_0x9449('0xa'),_0x9449('0xb'),_0x9449('0xc'),_0x9449('0xd'),'dialOriginateCallerIdNumber',_0x9449('0xe'),_0x9449('0xf'),_0x9449('0x10'),_0x9449('0x11'),_0x9449('0x12'),'dialCongestionRetryFrequency',_0x9449('0x13'),_0x9449('0x14'),_0x9449('0x15'),'dialNoAnswerRetryFrequency',_0x9449('0x16'),_0x9449('0x17'),_0x9449('0x18'),_0x9449('0x19'),_0x9449('0x1a'),_0x9449('0x1b'),_0x9449('0x1c'),_0x9449('0x1d'),_0x9449('0x1e'),_0x9449('0x1f'),_0x9449('0x20'),_0x9449('0x21'),_0x9449('0x22'),_0x9449('0x23'),_0x9449('0x24'),_0x9449('0x25'),_0x9449('0x26'),_0x9449('0x27'),_0x9449('0x28'),_0x9449('0x29'),_0x9449('0x2a'),'dialQueueProject2','monitor_format',_0x9449('0x2b'),_0x9449('0x2c'),'dialCutDigit',_0x9449('0x2d'),_0x9449('0x2e'),_0x9449('0x2f'),_0x9449('0x30'),_0x9449('0x31'),_0x9449('0x32'),_0x9449('0x33'),_0x9449('0x34'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x9449('0x35'),'dialPredictiveIntervalMaxThreshold',_0x9449('0x36'),_0x9449('0x37'),_0x9449('0x38')],'include':[{'model':'Trunk','as':_0x9449('0x39'),'attributes':['id',_0x9449('0x2'),_0x9449('0x3a'),'active']},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x9449('0x2')]},{'model':_0x9449('0x39'),'as':_0x9449('0x3b'),'attributes':['id',_0x9449('0x2'),_0x9449('0x3a'),_0x9449('0x3c')]},{'model':_0x9449('0x3d'),'as':_0x9449('0x3d'),'attributes':['id',_0x9449('0x2')],'include':[{'model':_0x9449('0x3d'),'as':'Intervals','attributes':['id',_0x9449('0x2'),'interval']}]}]},'log':_0x9449('0x3e')});};}; \ No newline at end of file +var _0xbd6f=['dialAMDMinWordLength','dialAMDMaximumNumberOfWords','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x40a541,_0x340357){var _0x46db52=function(_0x1dcffa){while(--_0x1dcffa){_0x40a541['push'](_0x40a541['shift']());}};_0x46db52(++_0x340357);}(_0xbd6f,0x17f));var _0xfbd6=function(_0x183d63,_0x399147){_0x183d63=_0x183d63-0x0;var _0x5e4a1d=_0xbd6f[_0x183d63];return _0x5e4a1d;};'use strict';var client=require(_0xfbd6('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xfbd6('0x1')](_0xfbd6('0x2'),{'options':{'raw':![],'attributes':['id',_0xfbd6('0x3'),_0xfbd6('0x4'),_0xfbd6('0x5'),'autopause',_0xfbd6('0x6'),_0xfbd6('0x7'),_0xfbd6('0x8'),_0xfbd6('0x9'),_0xfbd6('0xa'),_0xfbd6('0xb'),_0xfbd6('0xc'),'dialPredictiveOptimization',_0xfbd6('0xd'),_0xfbd6('0xe'),_0xfbd6('0xf'),_0xfbd6('0x10'),_0xfbd6('0x11'),_0xfbd6('0x12'),'dialQueueTimeout',_0xfbd6('0x13'),_0xfbd6('0x14'),_0xfbd6('0x15'),_0xfbd6('0x16'),'dialBusyRetryFrequency',_0xfbd6('0x17'),_0xfbd6('0x18'),'dialGlobalMaxRetry','dialTimezone','dialGlobalInterval',_0xfbd6('0x19'),'dialCheckDuplicateType','dialAMDActive',_0xfbd6('0x1a'),_0xfbd6('0x1b'),_0xfbd6('0x1c'),_0xfbd6('0x1d'),_0xfbd6('0x1e'),'dialAMDBetweenWordsSilence',_0xfbd6('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0xfbd6('0x20'),'dialRecallMeTimeout',_0xfbd6('0x21'),_0xfbd6('0x22'),_0xfbd6('0x23'),'dialAgiAfterHangupClient',_0xfbd6('0x24'),_0xfbd6('0x6'),_0xfbd6('0x25'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xfbd6('0x26'),_0xfbd6('0x27'),_0xfbd6('0x28'),_0xfbd6('0x29'),_0xfbd6('0x2a'),_0xfbd6('0x2b'),_0xfbd6('0x2c'),_0xfbd6('0x2d'),_0xfbd6('0x2e'),_0xfbd6('0x2f'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xfbd6('0x30'),_0xfbd6('0x31')],'include':[{'model':'Trunk','as':_0xfbd6('0x32'),'attributes':['id','name',_0xfbd6('0x33'),_0xfbd6('0x34')]},{'model':_0xfbd6('0x35'),'as':_0xfbd6('0x36'),'attributes':['id',_0xfbd6('0x3')]},{'model':'Trunk','as':_0xfbd6('0x37'),'attributes':['id',_0xfbd6('0x3'),_0xfbd6('0x33'),_0xfbd6('0x34')]},{'model':_0xfbd6('0x38'),'as':_0xfbd6('0x38'),'attributes':['id','name'],'include':[{'model':_0xfbd6('0x38'),'as':_0xfbd6('0x39'),'attributes':['id',_0xfbd6('0x3'),_0xfbd6('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c338b79..3fedcc9 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(_0x2681b8,_0x495162){var _0x5091c8=function(_0x3e849a){while(--_0x3e849a){_0x2681b8['push'](_0x2681b8['shift']());}};_0x5091c8(++_0x495162);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x16c2a7,_0x198cc0){var _0x37b58e=function(_0x1c5306){while(--_0x1c5306){_0x16c2a7['push'](_0x16c2a7['shift']());}};_0x37b58e(++_0x198cc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 34abe48..064fea6 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 _0x9d34=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x9d34,0xe2));var _0x49d3=function(_0x4eab88,_0xcc1ff8){_0x4eab88=_0x4eab88-0x0;var _0x2042e3=_0x9d34[_0x4eab88];return _0x2042e3;};'use strict';var client=require(_0x49d3('0x0'));exports[_0x49d3('0x1')]=function(_0x4372c4){return function(){return client['Request'](_0x49d3('0x2'),{'options':{'where':{'VoiceQueueId':_0x4372c4,'paused':!![]},'raw':!![]},'log':_0x49d3('0x1')});};}; \ No newline at end of file +var _0x0e85=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3dc121,_0x2cf9f3){var _0x18264e=function(_0x3b8896){while(--_0x3b8896){_0x3dc121['push'](_0x3dc121['shift']());}};_0x18264e(++_0x2cf9f3);}(_0x0e85,0xee));var _0x50e8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0e85[_0xbd08b4];return _0x314f1e;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x106a7a){return function(){return client[_0x50e8('0x0')](_0x50e8('0x1'),{'options':{'where':{'VoiceQueueId':_0x106a7a,'paused':!![]},'raw':!![]},'log':_0x50e8('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 84aab84..65b1ec7 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5a37d0,_0x405c62){var _0x429348=function(_0xa126dc){while(--_0xa126dc){_0x5a37d0['push'](_0x5a37d0['shift']());}};_0x429348(++_0x405c62);}(_0x7a54,0x106));var _0x47a5=function(_0x30a573,_0x4bc15e){_0x30a573=_0x30a573-0x0;var _0x3e8135=_0x7a54[_0x30a573];return _0x3e8135;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2a24fe,_0xf70dbf){var _0x141bdd=function(_0x512308){while(--_0x512308){_0x2a24fe['push'](_0x2a24fe['shift']());}};_0x141bdd(++_0xf70dbf);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 15b481f..d4dbba1 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 _0xa605=['blindTransfer','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','origtransfererexten','attended','../client'];(function(_0x41cbed,_0x554504){var _0x4308df=function(_0x385384){while(--_0x385384){_0x41cbed['push'](_0x41cbed['shift']());}};_0x4308df(++_0x554504);}(_0xa605,0xd7));var _0x5a60=function(_0x2375b7,_0x1fdff6){_0x2375b7=_0x2375b7-0x0;var _0x196523=_0xa605[_0x2375b7];return _0x196523;};'use strict';var client=require(_0x5a60('0x0'));exports['transfers']={};exports[_0x5a60('0x1')]=function(_0x314cb4){return client['Request'](_0x5a60('0x2'),{'body':{'result':_0x314cb4['result'],'transfererchannel':_0x314cb4[_0x5a60('0x3')],'transferercalleridnum':_0x314cb4['transferercalleridnum'],'transferercalleridname':_0x314cb4['transferercalleridname'],'transfererconnectedlinenum':_0x314cb4[_0x5a60('0x4')],'transfererconnectedlinename':_0x314cb4[_0x5a60('0x5')],'transfereraccountcode':_0x314cb4['transfereraccountcode'],'transferercontext':_0x314cb4[_0x5a60('0x6')],'transfererexten':_0x314cb4['transfererexten'],'transfererlinkedid':_0x314cb4[_0x5a60('0x7')],'transfereechannel':_0x314cb4[_0x5a60('0x8')],'transfereecalleridnum':_0x314cb4['transfereecalleridnum'],'transfereecalleridname':_0x314cb4['transfereecalleridname'],'transfereeconnectedlinenum':_0x314cb4[_0x5a60('0x9')],'transfereeconnectedlinename':_0x314cb4[_0x5a60('0xa')],'transfereeaccountcode':_0x314cb4[_0x5a60('0xb')],'transfereecontext':_0x314cb4[_0x5a60('0xc')],'transfereeexten':_0x314cb4[_0x5a60('0xd')],'transfereelinkedid':_0x314cb4[_0x5a60('0xe')],'isexternal':_0x314cb4[_0x5a60('0xf')],'context':_0x314cb4[_0x5a60('0x10')],'extension':_0x314cb4[_0x5a60('0x11')],'type':_0x5a60('0x12')},'log':_0x5a60('0x2')});};exports[_0x5a60('0x13')]=function(_0x2db900){return client['Request'](_0x5a60('0x2'),{'body':{'result':_0x2db900[_0x5a60('0x14')],'transfererchannel':_0x2db900[_0x5a60('0x15')],'transferercalleridnum':_0x2db900[_0x5a60('0x16')],'transferercalleridname':_0x2db900[_0x5a60('0x17')],'transfererconnectedlinenum':_0x2db900[_0x5a60('0x18')],'transfererconnectedlinename':_0x2db900[_0x5a60('0x19')],'transfereraccountcode':_0x2db900['origtransfereraccountcode'],'transferercontext':_0x2db900[_0x5a60('0x1a')],'transfererexten':_0x2db900[_0x5a60('0x1b')],'transfererlinkedid':_0x2db900[_0x5a60('0x1c')],'transfereechannel':_0x2db900[_0x5a60('0x1d')],'transfereecalleridnum':_0x2db900['transfertargetcalleridnum'],'transfereecalleridname':_0x2db900[_0x5a60('0x1e')],'transfereeconnectedlinenum':_0x2db900[_0x5a60('0x1f')],'transfereeconnectedlinename':_0x2db900[_0x5a60('0x20')],'transfereeaccountcode':_0x2db900['transfertargetaccountcode'],'transfereecontext':_0x2db900['transfertargetcontext'],'transfereeexten':_0x2db900['transfertargetexten'],'transfereelinkedid':_0x2db900[_0x5a60('0x21')],'isexternal':_0x2db900['isexternal'],'context':_0x2db900['origtransferercontext'],'extension':_0x2db900[_0x5a60('0x22')],'type':_0x5a60('0x23')},'log':_0x5a60('0x2')});}; \ No newline at end of file +var _0xcd42=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x1c3f0b,_0x47b98b){var _0x1bd981=function(_0x420bb2){while(--_0x420bb2){_0x1c3f0b['push'](_0x1c3f0b['shift']());}};_0x1bd981(++_0x47b98b);}(_0xcd42,0x1a2));var _0x2cd4=function(_0x10e044,_0x4976c8){_0x10e044=_0x10e044-0x0;var _0x58be0f=_0xcd42[_0x10e044];return _0x58be0f;};'use strict';var client=require(_0x2cd4('0x0'));exports[_0x2cd4('0x1')]={};exports[_0x2cd4('0x2')]=function(_0x37211e){return client[_0x2cd4('0x3')](_0x2cd4('0x4'),{'body':{'result':_0x37211e[_0x2cd4('0x5')],'transfererchannel':_0x37211e['transfererchannel'],'transferercalleridnum':_0x37211e[_0x2cd4('0x6')],'transferercalleridname':_0x37211e[_0x2cd4('0x7')],'transfererconnectedlinenum':_0x37211e[_0x2cd4('0x8')],'transfererconnectedlinename':_0x37211e['transfererconnectedlinename'],'transfereraccountcode':_0x37211e[_0x2cd4('0x9')],'transferercontext':_0x37211e[_0x2cd4('0xa')],'transfererexten':_0x37211e[_0x2cd4('0xb')],'transfererlinkedid':_0x37211e[_0x2cd4('0xc')],'transfereechannel':_0x37211e[_0x2cd4('0xd')],'transfereecalleridnum':_0x37211e['transfereecalleridnum'],'transfereecalleridname':_0x37211e[_0x2cd4('0xe')],'transfereeconnectedlinenum':_0x37211e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x37211e[_0x2cd4('0xf')],'transfereeaccountcode':_0x37211e['transfereeaccountcode'],'transfereecontext':_0x37211e[_0x2cd4('0x10')],'transfereeexten':_0x37211e[_0x2cd4('0x11')],'transfereelinkedid':_0x37211e[_0x2cd4('0x12')],'isexternal':_0x37211e[_0x2cd4('0x13')],'context':_0x37211e[_0x2cd4('0x14')],'extension':_0x37211e[_0x2cd4('0x15')],'type':_0x2cd4('0x16')},'log':_0x2cd4('0x4')});};exports[_0x2cd4('0x17')]=function(_0xacb74d){return client[_0x2cd4('0x3')](_0x2cd4('0x4'),{'body':{'result':_0xacb74d[_0x2cd4('0x5')],'transfererchannel':_0xacb74d[_0x2cd4('0x18')],'transferercalleridnum':_0xacb74d[_0x2cd4('0x19')],'transferercalleridname':_0xacb74d['origtransferercalleridname'],'transfererconnectedlinenum':_0xacb74d[_0x2cd4('0x1a')],'transfererconnectedlinename':_0xacb74d[_0x2cd4('0x1b')],'transfereraccountcode':_0xacb74d[_0x2cd4('0x1c')],'transferercontext':_0xacb74d[_0x2cd4('0x1d')],'transfererexten':_0xacb74d['secondtransfererexten'],'transfererlinkedid':_0xacb74d[_0x2cd4('0x1e')],'transfereechannel':_0xacb74d['transfertargetchannel'],'transfereecalleridnum':_0xacb74d[_0x2cd4('0x1f')],'transfereecalleridname':_0xacb74d[_0x2cd4('0x20')],'transfereeconnectedlinenum':_0xacb74d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xacb74d[_0x2cd4('0x21')],'transfereeaccountcode':_0xacb74d[_0x2cd4('0x22')],'transfereecontext':_0xacb74d[_0x2cd4('0x23')],'transfereeexten':_0xacb74d[_0x2cd4('0x24')],'transfereelinkedid':_0xacb74d[_0x2cd4('0x25')],'isexternal':_0xacb74d['isexternal'],'context':_0xacb74d[_0x2cd4('0x26')],'extension':_0xacb74d[_0x2cd4('0x27')],'type':_0x2cd4('0x28')},'log':_0x2cd4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b73c4ea..0f4a447 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2a6883,_0x474454){var _0x88469a=function(_0x66509d){while(--_0x66509d){_0x2a6883['push'](_0x2a6883['shift']());}};_0x88469a(++_0x474454);}(_0xb10b,0x12a));var _0xbb10=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0xb10b[_0x5538a4];return _0x530a52;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _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(_0x4f8792,_0x36b71f){var _0x99b70d=function(_0x37cfb7){while(--_0x37cfb7){_0x4f8792['push'](_0x4f8792['shift']());}};_0x99b70d(++_0x36b71f);}(_0x7a54,0x106));var _0x47a5=function(_0x2166fe,_0x457c9f){_0x2166fe=_0x2166fe-0x0;var _0x4079b4=_0x7a54[_0x2166fe];return _0x4079b4;};'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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index b4a0e55..abf1bee 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 _0x0f97=['[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','destcalleridnum','calleridnum','routeId','firstName','lastName','fax','ListId','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','','calleridname','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','merge','lodash','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info'];(function(_0x427e20,_0x3cf9eb){var _0x51d82e=function(_0x42093d){while(--_0x42093d){_0x427e20['push'](_0x427e20['shift']());}};_0x51d82e(++_0x3cf9eb);}(_0x0f97,0x66));var _0x70f9=function(_0x152a03,_0x41a4fe){_0x152a03=_0x152a03-0x0;var _0x3ccbd0=_0x0f97[_0x152a03];return _0x3ccbd0;};'use strict';var _=require(_0x70f9('0x0'));var BPromise=require('bluebird');var Redis=require(_0x70f9('0x1'));var util=require(_0x70f9('0x2'));var config=require(_0x70f9('0x3'));var logger=require('../../../../config/logger')(_0x70f9('0x4'));var cmContactRpc=require(_0x70f9('0x5'));config[_0x70f9('0x6')]=_['defaults'](config[_0x70f9('0x6')],{'host':_0x70f9('0x7'),'port':0x18eb});var io=require(_0x70f9('0x8'))(new Redis(config[_0x70f9('0x6')]));function emit(_0x56cf75,_0x1ecb49,_0x3db377,_0x560f87,_0x5ef565){logger[_0x70f9('0x9')](_0x70f9('0xa'),_0x56cf75,_0x1ecb49['id'],_0x3db377,_0x560f87,JSON['stringify'](_0x5ef565));io['to'](_0x3db377)[_0x70f9('0xb')](_0x560f87,_0x5ef565);}exports[_0x70f9('0xc')]=function(_0xbda6c3,_0x3e11f2,_0x2ec2df,_0x299fc2){var _0x285da5,_0x1ae8ed;var _0x4fbf75={};var _0x304a2d;var _0x2bceb0=Number(_0x2ec2df[_0x70f9('0xd')]);var _0x275ae5=_0x2ec2df[_0x70f9('0xe')]?Boolean(Number(_0x2ec2df[_0x70f9('0xe')])):![];var _0x6a427d;var _0xa57cd8=![];if(!_[_0x70f9('0xf')](_0x2ec2df[_0x70f9('0x10')])){if(_0x2ec2df[_0x70f9('0x10')]=='1')_0xa57cd8=!![];}if(!_0xa57cd8){if(_0x299fc2[_0x70f9('0x11')]){_0x4fbf75['id']=_0x299fc2[_0x70f9('0x11')];}}if(!_0x4fbf75['id']){_0x4fbf75['ListId']=_0x2bceb0;_0x6a427d=_0x2ec2df['data3']&&_0x2ec2df[_0x70f9('0x12')]!=='0'?_0x2ec2df['data3'][_0x70f9('0x13')](','):[_0x70f9('0x14')];_0x4fbf75[_0x70f9('0x15')]=_[_0x70f9('0x16')](_0x6a427d,function(_0x4ba24d){var _0x3b1fa={};_0x3b1fa[_0x4ba24d]=_0x299fc2['routeId']?_0x299fc2[_0x70f9('0x17')]:_0x299fc2[_0x70f9('0x18')];return _0x3b1fa;});_0x304a2d=_0x299fc2[_0x70f9('0x19')]?_0x299fc2['destcalleridnum']:_0x299fc2[_0x70f9('0x18')];}var _0x486062=['id',_0x70f9('0x1a'),_0x70f9('0x1b'),'phone','mobile',_0x70f9('0x1c'),_0x70f9('0x1d'),'createdAt',_0x70f9('0x1e'),_0x70f9('0x1f')];var _0x4d3577=_[_0x70f9('0x20')](_0x486062,_0x6a427d);BPromise[_0x70f9('0x21')]()['then'](cmContactRpc[_0x70f9('0x22')]({'attributes':_0x4d3577,'where':_0x4fbf75,'phone':_0x304a2d}))[_0x70f9('0x23')](function(_0x173d54){_0x1ae8ed=_0x173d54;if(!_[_0x70f9('0x24')](_0x1ae8ed)){if(_0x1ae8ed[_0x70f9('0x25')]===0x1){_0x285da5=_0x1ae8ed[0x0];logger[_0x70f9('0x9')](_0x70f9('0x26'),_0x299fc2[_0x70f9('0x27')],_0x3e11f2['id'],_0x285da5['id']);}else{logger[_0x70f9('0x9')](_0x70f9('0x28'),_0x299fc2['uniqueid'],_0x3e11f2['id'],_[_0x70f9('0x16')](_0x1ae8ed,'id')[_0x70f9('0x29')](','));}return;}else{logger[_0x70f9('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x299fc2['uniqueid'],_0x3e11f2['id']);var _0xd5b6b8={'ListId':_0x2bceb0};var _0x32bce2=_0x2ec2df[_0x70f9('0x2a')]&&_0x2ec2df[_0x70f9('0x2a')]!=='0'?_0x2ec2df[_0x70f9('0x2a')]:_0x70f9('0x14');if(_0x275ae5){logger[_0x70f9('0x9')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x299fc2[_0x70f9('0x27')],_0x3e11f2['id']);_0xd5b6b8[_0x32bce2]=_[_0x70f9('0xf')](_0x299fc2[_0x70f9('0x19')])?_0x299fc2['calleridnum']:_0x299fc2[_0x70f9('0x17')];if(_[_0x70f9('0xf')](_0x299fc2[_0x70f9('0x19')])){_0xd5b6b8[_0x70f9('0x1a')]=_0x299fc2['calleridname']&&_0x299fc2['calleridname']!==_0x70f9('0x2b')?_0x299fc2[_0x70f9('0x2c')]:_0x70f9('0x2d');}else{_0xd5b6b8[_0x70f9('0x1a')]=_0x299fc2['destcalleridname']&&_0x299fc2[_0x70f9('0x2e')]!==''?_0x299fc2[_0x70f9('0x2e')]:'Unknown';}return BPromise[_0x70f9('0x21')]()[_0x70f9('0x23')](cmContactRpc['createContact'](_0xd5b6b8))[_0x70f9('0x23')](function(_0x15138a){_0x285da5=_0x15138a;_0x1ae8ed['push'](_0x15138a);if(_0x285da5){logger[_0x70f9('0x9')](_0x70f9('0x2f'),_0x299fc2[_0x70f9('0x27')],_0x3e11f2['id'],_0x285da5['id']);}return;});}else{logger[_0x70f9('0x9')](_0x70f9('0x30'),_0x299fc2[_0x70f9('0x27')],_0x3e11f2['id']);_0xd5b6b8[_0x32bce2]=_[_0x70f9('0xf')](_0x299fc2['routeId'])?_0x299fc2[_0x70f9('0x18')]:_0x299fc2[_0x70f9('0x17')];if(_[_0x70f9('0xf')](_0x299fc2['routeId'])){_0xd5b6b8['firstName']=_0x299fc2[_0x70f9('0x2c')]&&_0x299fc2[_0x70f9('0x2c')]!==_0x70f9('0x2b')?_0x299fc2[_0x70f9('0x2c')]:_0x70f9('0x2d');}else{_0xd5b6b8[_0x70f9('0x1a')]=_0x299fc2[_0x70f9('0x2e')]&&_0x299fc2['destcalleridname']!==_0x70f9('0x2b')?_0x299fc2[_0x70f9('0x2e')]:_0x70f9('0x2d');}_0x285da5=_0xd5b6b8;_0x1ae8ed[_0x70f9('0x31')](_0xd5b6b8);return;}}})['then'](function(){if(_0xbda6c3){emit(_0x299fc2['uniqueid'],_0x3e11f2,util[_0x70f9('0x32')](_0x70f9('0x33'),_0xbda6c3[_0x70f9('0x34')]),util[_0x70f9('0x32')](_0x70f9('0x35'),_0x2ec2df[_0x70f9('0x36')]['toLowerCase']()),{'evt':_[_0x70f9('0x37')](_0x299fc2,{'autoCreate':_0x275ae5}),'contact':_0x285da5===undefined?{}:_0x285da5,'contacts':_0x1ae8ed[_0x70f9('0x25')]===0x0?undefined:_0x1ae8ed});}});}; \ No newline at end of file +var _0x8c1f=['merge','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','routeId','calleridnum','lastName','mobile','fax','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase'];(function(_0x395a63,_0x24e349){var _0x2494d8=function(_0x14d422){while(--_0x14d422){_0x395a63['push'](_0x395a63['shift']());}};_0x2494d8(++_0x24e349);}(_0x8c1f,0xe1));var _0xf8c1=function(_0x479182,_0x28d1df){_0x479182=_0x479182-0x0;var _0xf4c48e=_0x8c1f[_0x479182];return _0xf4c48e;};'use strict';var _=require('lodash');var BPromise=require(_0xf8c1('0x0'));var Redis=require(_0xf8c1('0x1'));var util=require('util');var config=require(_0xf8c1('0x2'));var logger=require(_0xf8c1('0x3'))(_0xf8c1('0x4'));var cmContactRpc=require(_0xf8c1('0x5'));config[_0xf8c1('0x6')]=_['defaults'](config[_0xf8c1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf8c1('0x7'))(new Redis(config['redis']));function emit(_0x11f580,_0x4086a7,_0x2927c4,_0x57023d,_0x385cd6){logger['info'](_0xf8c1('0x8'),_0x11f580,_0x4086a7['id'],_0x2927c4,_0x57023d,JSON['stringify'](_0x385cd6));io['to'](_0x2927c4)['emit'](_0x57023d,_0x385cd6);}exports[_0xf8c1('0x9')]=function(_0x7395ac,_0x11a600,_0x4d31e4,_0x10a4a1){var _0x5b77fb,_0x49f373;var _0x392769={};var _0x372276;var _0xb7c85e=Number(_0x4d31e4[_0xf8c1('0xa')]);var _0x3c788a=_0x4d31e4['data2']?Boolean(Number(_0x4d31e4[_0xf8c1('0xb')])):![];var _0x45c25a;var _0x4ae145=![];if(!_[_0xf8c1('0xc')](_0x4d31e4[_0xf8c1('0xd')])){if(_0x4d31e4[_0xf8c1('0xd')]=='1')_0x4ae145=!![];}if(!_0x4ae145){if(_0x10a4a1[_0xf8c1('0xe')]){_0x392769['id']=_0x10a4a1[_0xf8c1('0xe')];}}if(!_0x392769['id']){_0x392769[_0xf8c1('0xf')]=_0xb7c85e;_0x45c25a=_0x4d31e4[_0xf8c1('0x10')]&&_0x4d31e4[_0xf8c1('0x10')]!=='0'?_0x4d31e4[_0xf8c1('0x10')][_0xf8c1('0x11')](','):[_0xf8c1('0x12')];_0x392769[_0xf8c1('0x13')]=_[_0xf8c1('0x14')](_0x45c25a,function(_0x2fda59){var _0x1eab57={};_0x1eab57[_0x2fda59]=_0x10a4a1['routeId']?_0x10a4a1[_0xf8c1('0x15')]:_0x10a4a1['calleridnum'];return _0x1eab57;});_0x372276=_0x10a4a1[_0xf8c1('0x16')]?_0x10a4a1[_0xf8c1('0x15')]:_0x10a4a1[_0xf8c1('0x17')];}var _0x198360=['id','firstName',_0xf8c1('0x18'),_0xf8c1('0x12'),_0xf8c1('0x19'),_0xf8c1('0x1a'),_0xf8c1('0xf'),_0xf8c1('0x1b'),'scheduledAt',_0xf8c1('0x1c')];var _0x461317=_[_0xf8c1('0x1d')](_0x198360,_0x45c25a);BPromise[_0xf8c1('0x1e')]()['then'](cmContactRpc[_0xf8c1('0x1f')]({'attributes':_0x461317,'where':_0x392769,'phone':_0x372276}))[_0xf8c1('0x20')](function(_0xc8e8b8){_0x49f373=_0xc8e8b8;if(!_[_0xf8c1('0x21')](_0x49f373)){if(_0x49f373['length']===0x1){_0x5b77fb=_0x49f373[0x0];logger[_0xf8c1('0x22')](_0xf8c1('0x23'),_0x10a4a1[_0xf8c1('0x24')],_0x11a600['id'],_0x5b77fb['id']);}else{logger[_0xf8c1('0x22')](_0xf8c1('0x25'),_0x10a4a1[_0xf8c1('0x24')],_0x11a600['id'],_['map'](_0x49f373,'id')[_0xf8c1('0x26')](','));}return;}else{logger[_0xf8c1('0x22')](_0xf8c1('0x27'),_0x10a4a1[_0xf8c1('0x24')],_0x11a600['id']);var _0x33f221={'ListId':_0xb7c85e};var _0x857f21=_0x4d31e4[_0xf8c1('0x28')]&&_0x4d31e4['data4']!=='0'?_0x4d31e4[_0xf8c1('0x28')]:_0xf8c1('0x12');if(_0x3c788a){logger['info'](_0xf8c1('0x29'),_0x10a4a1[_0xf8c1('0x24')],_0x11a600['id']);_0x33f221[_0x857f21]=_[_0xf8c1('0xc')](_0x10a4a1[_0xf8c1('0x16')])?_0x10a4a1['calleridnum']:_0x10a4a1['destcalleridnum'];if(_[_0xf8c1('0xc')](_0x10a4a1[_0xf8c1('0x16')])){_0x33f221['firstName']=_0x10a4a1['calleridname']&&_0x10a4a1[_0xf8c1('0x2a')]!==_0xf8c1('0x2b')?_0x10a4a1['calleridname']:_0xf8c1('0x2c');}else{_0x33f221[_0xf8c1('0x2d')]=_0x10a4a1[_0xf8c1('0x2e')]&&_0x10a4a1[_0xf8c1('0x2e')]!==_0xf8c1('0x2b')?_0x10a4a1[_0xf8c1('0x2e')]:_0xf8c1('0x2c');}return BPromise[_0xf8c1('0x1e')]()[_0xf8c1('0x20')](cmContactRpc[_0xf8c1('0x2f')](_0x33f221))['then'](function(_0x35c5db){_0x5b77fb=_0x35c5db;_0x49f373[_0xf8c1('0x30')](_0x35c5db);if(_0x5b77fb){logger[_0xf8c1('0x22')](_0xf8c1('0x31'),_0x10a4a1[_0xf8c1('0x24')],_0x11a600['id'],_0x5b77fb['id']);}return;});}else{logger[_0xf8c1('0x22')](_0xf8c1('0x32'),_0x10a4a1['uniqueid'],_0x11a600['id']);_0x33f221[_0x857f21]=_['isNil'](_0x10a4a1[_0xf8c1('0x16')])?_0x10a4a1[_0xf8c1('0x17')]:_0x10a4a1[_0xf8c1('0x15')];if(_[_0xf8c1('0xc')](_0x10a4a1[_0xf8c1('0x16')])){_0x33f221[_0xf8c1('0x2d')]=_0x10a4a1[_0xf8c1('0x2a')]&&_0x10a4a1['calleridname']!==''?_0x10a4a1[_0xf8c1('0x2a')]:_0xf8c1('0x2c');}else{_0x33f221[_0xf8c1('0x2d')]=_0x10a4a1[_0xf8c1('0x2e')]&&_0x10a4a1[_0xf8c1('0x2e')]!==_0xf8c1('0x2b')?_0x10a4a1[_0xf8c1('0x2e')]:'Unknown';}_0x5b77fb=_0x33f221;_0x49f373[_0xf8c1('0x30')](_0x33f221);return;}}})[_0xf8c1('0x20')](function(){if(_0x7395ac){emit(_0x10a4a1[_0xf8c1('0x24')],_0x11a600,util[_0xf8c1('0x33')](_0xf8c1('0x34'),_0x7395ac['name']),util[_0xf8c1('0x33')](_0xf8c1('0x35'),_0x4d31e4['action'][_0xf8c1('0x36')]()),{'evt':_[_0xf8c1('0x37')](_0x10a4a1,{'autoCreate':_0x3c788a}),'contact':_0x5b77fb===undefined?{}:_0x5b77fb,'contacts':_0x49f373['length']===0x0?undefined:_0x49f373});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d5ec148..4864283 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 _0xba3c=['voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winapp','winApplication','winArguments','user:%s','name','format','trigger:%s:%s','jscripty','trigger:%s','exec','script','buildUri','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','field','chat','operator','value','ChatWebsiteId','AccountId','upperFirst','message','event','queue','agent','membername','lastevent','routeId','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','triggers','agents','voiceQueues','templates'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xba3c,0x1f2));var _0xcba3=function(_0x82bcd7,_0x2ac0b7){_0x82bcd7=_0x82bcd7-0x0;var _0x1ae6fc=_0xba3c[_0x82bcd7];return _0x1ae6fc;};'use strict';var util=require('util');var _=require(_0xcba3('0x0'));var url=require(_0xcba3('0x1'));var Mustache=require(_0xcba3('0x2'));var Redis=require(_0xcba3('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0xcba3('0x4'));var script=require(_0xcba3('0x5'));var config=require(_0xcba3('0x6'));var logger=require(_0xcba3('0x7'))(_0xcba3('0x8'));var ami=require(_0xcba3('0x9'));config[_0xcba3('0xa')]=_[_0xcba3('0xb')](config[_0xcba3('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xcba3('0xc'))(new Redis(config[_0xcba3('0xa')]));var operators={'equals':function(_0x1a5329,_0x37615f){return _0x1a5329==_0x37615f;},'not_equals':function(_0x1b7332,_0x985fea){return _0x1b7332!=_0x985fea;}};var barAndWebActions=[_0xcba3('0xd'),_0xcba3('0x1'),'winapp'];function Trigger(_0x1dcffe){this[_0xcba3('0xe')]=_0x1dcffe['triggers'];this[_0xcba3('0xf')]=_0x1dcffe[_0xcba3('0xf')];this['voiceQueues']=_0x1dcffe[_0xcba3('0x10')];this[_0xcba3('0x11')]=_0x1dcffe[_0xcba3('0x11')];this[_0xcba3('0x12')]=_0x1dcffe[_0xcba3('0x12')];this[_0xcba3('0x13')]=_0x1dcffe[_0xcba3('0x13')];this['freshdeskAccounts']=_0x1dcffe[_0xcba3('0x14')];this[_0xcba3('0x15')]=_0x1dcffe['salesforceAccounts'];this['sugarcrmAccounts']=_0x1dcffe[_0xcba3('0x16')];this['zohoAccounts']=_0x1dcffe['zohoAccounts'];this[_0xcba3('0x17')]=_0x1dcffe['deskAccounts'];this[_0xcba3('0x18')]=_0x1dcffe[_0xcba3('0x18')];this[_0xcba3('0x19')]=_0x1dcffe[_0xcba3('0x19')];this['dynamics365Accounts']=_0x1dcffe[_0xcba3('0x1a')];this['freshsalesAccounts']=_0x1dcffe[_0xcba3('0x1b')];this[_0xcba3('0x1c')]={'zendesk':this[_0xcba3('0x13')],'salesforce':this[_0xcba3('0x15')],'freshdesk':this[_0xcba3('0x14')],'sugarcrm':this[_0xcba3('0x16')],'zoho':this[_0xcba3('0x1d')],'desk':this[_0xcba3('0x17')],'vtiger':this[_0xcba3('0x18')],'dynamics365':this[_0xcba3('0x1a')],'freshsales':this[_0xcba3('0x1b')],'servicenow':this['servicenowAccounts']};ami['on'](_0xcba3('0x1e'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x21'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x22'),this[_0xcba3('0x1f')]['bind'](this));ami['on'](_0xcba3('0x23'),this[_0xcba3('0x1f')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x24'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x25'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on']('custom:agentcongestion',this[_0xcba3('0x1f')]['bind'](this));ami['on'](_0xcba3('0x26'),this[_0xcba3('0x1f')]['bind'](this));ami['on']('custom:amd',this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x27'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on']('custom:timeout',this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x28'),this[_0xcba3('0x29')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x2a'),this[_0xcba3('0x29')][_0xcba3('0x20')](this));ami['on']('custom:dialend',this[_0xcba3('0x29')][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x2b'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xcba3('0x20')](this));ami['on']('custom:substatus',this[_0xcba3('0x1f')]['bind'](this));ami['on'](_0xcba3('0x2c'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));ami['on']('custom:outgoingmessage',this[_0xcba3('0x1f')]['bind'](this));ami['on'](_0xcba3('0x2d'),this[_0xcba3('0x1f')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xcba3('0x20')](this));ami['on'](_0xcba3('0x2e'),this[_0xcba3('0x1f')][_0xcba3('0x20')](this));}Trigger[_0xcba3('0x2f')][_0xcba3('0x30')]=function(_0x135198,_0x26ffd3,_0x4e8492){logger[_0xcba3('0x31')](_0x135198,_0x26ffd3,JSON[_0xcba3('0x32')](_0x4e8492));io['to'](_0x135198)[_0xcba3('0x30')](_0x26ffd3,_0x4e8492);};Trigger['prototype'][_0xcba3('0x1f')]=function(_0x3f0dde){var _0x376d31=_[_0xcba3('0x33')](_0x3f0dde);if(typeof _0x376d31[_0xcba3('0x34')]===_0xcba3('0x35')){_0x376d31[_0xcba3('0x34')]=_0xcba3('0x36');}logger[_0xcba3('0x37')](_0xcba3('0x1f'),util[_0xcba3('0x38')](_0x376d31,{'showHidden':!![],'depth':null}));this[_0xcba3('0x39')](_0x376d31);};Trigger[_0xcba3('0x2f')][_0xcba3('0x29')]=function(_0x5cb2b4){if(this[_0xcba3('0xf')][_0x5cb2b4[_0xcba3('0x3a')]]){this[_0xcba3('0x1f')](_0x5cb2b4);}};Trigger[_0xcba3('0x2f')]['checkTriggers']=function(_0x250544){var _0xfae4ae;for(var _0x5b0c6d in this[_0xcba3('0xe')]){if(this[_0xcba3('0xe')][_0xcba3('0x3b')](_0x5b0c6d)){if(this['triggers'][_0x5b0c6d]['status']){_0xfae4ae=this[_0xcba3('0x3c')](this['triggers'][_0x5b0c6d],_0x250544);if(_0xfae4ae){_[_0xcba3('0x3d')](_0x250544,_0x250544[_0xcba3('0x3e')]);for(var _0x40a542=0x0,_0x5e132b,_0x2e48ee,_0xd6fab7;_0x40a5420x0){_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 _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x34c781,_0x4dc0e0){var _0x27817d=function(_0x2a7d1f){while(--_0x2a7d1f){_0x34c781['push'](_0x34c781['shift']());}};_0x27817d(++_0x4dc0e0);}(_0x55ca,0x126));var _0xa55c=function(_0x5316d3,_0x5cba98){_0x5316d3=_0x5316d3-0x0;var _0x27d9fa=_0x55ca[_0x5316d3];return _0x27d9fa;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 05e3efd..d33abef 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 _0x77d9=['then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','username','toLowerCase','destcalleridnum','POST','contacts','body','headers','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','length','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','callDirection','queue','phonecalls','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data5','clientId','password'];(function(_0x3e4903,_0x2e7b85){var _0x565327=function(_0x30b385){while(--_0x30b385){_0x3e4903['push'](_0x3e4903['shift']());}};_0x565327(++_0x2e7b85);}(_0x77d9,0x1a7));var _0x977d=function(_0x3645cc,_0x25ba47){_0x3645cc=_0x3645cc-0x0;var _0x351979=_0x77d9[_0x3645cc];return _0x351979;};'use strict';var _=require(_0x977d('0x0'));var rp=require(_0x977d('0x1'));var util=require(_0x977d('0x2'));var intUtil=require(_0x977d('0x3'));var md5=require(_0x977d('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x977d('0x5'));var config=require(_0x977d('0x6'));config['redis']=_[_0x977d('0x7')](config['redis'],{'host':_0x977d('0x8'),'port':0x18eb});var io=require(_0x977d('0x9'))(new Redis(config['redis']));function getAuthToken(_0x105880,_0x323c96,_0x395f95){if(_0x105880[_0x977d('0xa')]){_0x105880[_0x977d('0xb')]=_0x105880[_0x977d('0xc')][_0x977d('0xd')];_0x105880['tenantId']=_0x105880[_0x977d('0xc')]['data2'];return Promise['resolve'](_0x105880[_0x977d('0xc')][_0x977d('0xe')]);}var _0x2e9f99={'method':'POST','uri':_0x323c96,'form':{'client_id':_0x105880[_0x977d('0xf')],'resource':_0x105880[_0x977d('0xb')],'username':_0x105880['username'],'password':_0x105880['password'],'grant_type':_0x977d('0x10'),'client_secret':_0x105880['clientSecret']},'json':!![]};return rp(_0x2e9f99)[_0x977d('0x11')](function(_0x4e91cb){return _0x4e91cb[_0x977d('0x12')];})[_0x977d('0x13')](function(_0x4e0ac1){logger[_0x977d('0x14')]('['+[_0x395f95[_0x977d('0x15')]()]+_0x977d('0x16'));return _0x4e0ac1[_0x977d('0x17')];});}function getUser(_0x2ea267,_0x2b31f8,_0x411b9e,_0x419826,_0xd2bb28,_0x369563){return new Promise(function(_0x2cef59,_0x22978e){return getAuthToken(_0x2b31f8,_0x419826,_0x369563)['then'](function(_0x38ab85){var _0x2d8602={'method':_0x977d('0x18'),'uri':_0xd2bb28+_0x977d('0x19'),'headers':{'Authorization':_0x977d('0x1a')+_0x38ab85,'OData-Version':_0x977d('0x1b')},'json':!![]};return rp(_0x2d8602);})['then'](function(_0x5323bb){var _0x34ae4a=_0x5323bb[_0x977d('0x1c')];var _0x4dba59=![];var _0x58dbf6=null;if(!_[_0x977d('0x1d')](_0x411b9e)){if(intUtil[_0x977d('0x1e')](_0x411b9e[_0x977d('0x1f')])){_0x2ea267[_0x977d('0x20')]=_0x411b9e[_0x977d('0x1f')];for(_0x58dbf6=0x0;_0x58dbf6<_0x34ae4a['length'];_0x58dbf6++){if(_0x34ae4a[_0x58dbf6][_0x977d('0x21')]===_0x411b9e['email']&&!_0x34ae4a[_0x58dbf6][_0x977d('0x22')]){_0x4dba59=!![];logger['info']('['+[_0x369563[_0x977d('0x15')]()]+_0x977d('0x23')+_0x34ae4a[_0x58dbf6][_0x977d('0x24')]+'!');_0x2ea267[_0x977d('0x25')]=_0x34ae4a[_0x58dbf6]['systemuserid'];}}}}if(!_0x4dba59){logger['info']('['+[_0x369563[_0x977d('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2ea267['userEmail']=_0x2b31f8[_0x977d('0x26')];for(_0x58dbf6=0x0;_0x58dbf6<_0x34ae4a['length'];_0x58dbf6++){if(_0x34ae4a[_0x58dbf6]['internalemailaddress']===_0x2b31f8[_0x977d('0x26')]){_0x2ea267['userId']=_0x34ae4a[_0x58dbf6][_0x977d('0x24')];}}}_0x2cef59(_0x2ea267);})[_0x977d('0x13')](function(_0xff8b7b){_0x22978e(_0xff8b7b['message']);});});}function createEndUser(_0xa8b04e,_0x526129,_0x11d6ac,_0x276313,_0x962045,_0x54a84f,_0x2b852c){return new Promise(function(_0x54e53d,_0x2b3942){return getAuthToken(_0x526129,_0x11d6ac,_0x54a84f)[_0x977d('0x11')](function(_0x54d865){var _0x30c9d2=_0x54a84f[_0x977d('0x27')]()==='outbound'?_0x962045[_0x977d('0x28')]:_0x962045['calleridnum'];var _0x18b608={'method':_0x977d('0x29'),'uri':_0x276313+_0x977d('0x2a'),'body':{'fullname':_0x30c9d2,'firstname':_0x30c9d2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xa8b04e[_0x977d('0x25')]+')'},'headers':{'Authorization':_0x977d('0x1a')+_0x54d865,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x18b608[_0x977d('0x2b')][_0x2b852c]=_0x30c9d2;return rp(_0x18b608);})[_0x977d('0x11')](function(_0x344676){var _0x1e1c1=_0x344676[_0x977d('0x2c')]['odata-entityid'];var _0x1dffc9=_0x1e1c1[_0x977d('0x2d')](_0x1e1c1['lastIndexOf']('(')+0x1,_0x1e1c1[_0x977d('0x2e')](')'));_0xa8b04e[_0x977d('0x2f')]=_0x1dffc9;_0x54e53d(_0xa8b04e);})[_0x977d('0x13')](function(_0x1366a7){_0x2b3942(_0x1366a7['message']);});});}function getEndUser(_0x3dec5f,_0x5a0090,_0x106125,_0x471b0c,_0x4d6dc9,_0x41681a,_0x3a64f1,_0xc225d2){var _0x5bd8b5=_0x41681a[_0x977d('0x27')]()===_0x977d('0x30')?_0x4d6dc9[_0x977d('0x28')]:_0x4d6dc9[_0x977d('0x31')];return getAuthToken(_0x5a0090,_0x106125,_0x41681a)['then'](function(_0xd09707){_0xc225d2=_0xc225d2?_0xc225d2:_0x977d('0x32');var _0x45e44d={'method':'GET','uri':_0x471b0c+_0x977d('0x33')+_0xc225d2+_0x977d('0x34')+_0xc225d2+'\x20eq\x20\x27'+_0x5bd8b5[_0x977d('0x35')]('+',_0x977d('0x36'))+'\x27','headers':{'Authorization':_0x977d('0x1a')+_0xd09707,'If-None-Match':null,'OData-Version':_0x977d('0x1b')},'json':!![]};return rp(_0x45e44d);})[_0x977d('0x11')](function(_0x2d82ef){var _0x16d0a4=![];if(!_0x2d82ef)return _0x16d0a4;var _0x475182=_0x2d82ef['value'];for(var _0x46b8fb=0x0;_0x46b8fb<_0x475182[_0x977d('0x37')];_0x46b8fb++){if(_0x475182[_0x46b8fb][_0xc225d2]===_0x5bd8b5){_0x16d0a4=!![];_0x3dec5f[_0x977d('0x2f')]=_0x475182[_0x46b8fb]['contactid'];}}return _0x16d0a4;})[_0x977d('0x11')](function(_0x156f95){if(_0x156f95)return _0x3dec5f;if(_0x3a64f1===_0x977d('0x38')){logger[_0x977d('0x39')]('['+[_0x41681a[_0x977d('0x15')]()]+_0x977d('0x3a'));return _0x3dec5f;}return createEndUser(_0x3dec5f,_0x5a0090,_0x106125,_0x471b0c,_0x4d6dc9,_0x41681a,_0xc225d2)['then'](function(_0x823a1e){logger[_0x977d('0x39')]('['+[_0x41681a[_0x977d('0x15')]()]+_0x977d('0x3b'),_0x823a1e[_0x977d('0x2f')]);return _0x823a1e;});});}function getCustomFields(_0xee3f0b,_0x4cc189,_0x201f30){var _0x1bc4da={};if(_0xee3f0b['length']>0x0){_[_0x977d('0x3c')](_0xee3f0b,function(_0x17fd35){if(_[_0x977d('0x3d')]([_0x977d('0x3e'),'picklist'],_0x17fd35['type'])&&_0x17fd35[_0x977d('0x3f')]&&!_0x17fd35[_0x977d('0x40')]){var _0x6e7db2=_0x17fd35[_0x977d('0x41')]['toLowerCase']();var _0x31af03=_0x6e7db2[_0x977d('0x2d')](0x0,_0x6e7db2[_0x977d('0x42')]('_'));var _0x8ae9b9=_0x6e7db2[_0x977d('0x2d')](_0x6e7db2[_0x977d('0x42')]('_')+0x1);if(_0x31af03===_0x201f30){_0x1bc4da[_0x8ae9b9]=_0x17fd35[_0x977d('0x43')];}}});}return _0x1bc4da;}function getTicket(_0x3bafd3,_0x2e3469,_0x1fe2cf,_0x5a49a2,_0x207906,_0x35a177,_0x492218){return new Promise(function(_0x29c124,_0x5477c0){var _0x5c6ef7;return getAuthToken(_0x2e3469,_0x1fe2cf,_0x492218)[_0x977d('0x11')](function(_0x181919){if(_0x35a177[_0x977d('0x44')]===_0x977d('0x45')){_0x5c6ef7={'method':_0x977d('0x29'),'uri':_0x5a49a2+_0x977d('0x46'),'body':Object[_0x977d('0x47')]({},{'title':intUtil[_0x977d('0x48')](_0x35a177[_0x977d('0x49')],_0x207906,'\x20'),'description':intUtil[_0x977d('0x48')](_0x35a177[_0x977d('0x4a')],_0x207906,'\x0a'),'customerid_contact@odata.bind':_0x3bafd3[_0x977d('0x2f')]?_0x977d('0x4b')+_0x3bafd3['enduserId']+')':undefined,'ownerid@odata.bind':_0x977d('0x4c')+_0x3bafd3['userId']+')','caseorigincode':'1'},getCustomFields(_0x35a177[_0x977d('0x4d')],_0x207906,_0x35a177[_0x977d('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x181919,'OData-Version':_0x977d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x35a177[_0x977d('0x44')]==='phonecall'){var _0x790596=_0x3bafd3[_0x977d('0x2f')]?[{'partyid_systemuser@odata.bind':_0x977d('0x4c')+_0x3bafd3['userId']+')','participationtypemask':_0x3bafd3[_0x977d('0x4e')]===_0x977d('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x977d('0x4b')+_0x3bafd3[_0x977d('0x2f')]+')','participationtypemask':_0x3bafd3[_0x977d('0x4e')]===_0x977d('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x977d('0x4c')+_0x3bafd3[_0x977d('0x25')]+')','participationtypemask':_0x3bafd3[_0x977d('0x4e')]==='queue'?0x2:0x1}];_0x5c6ef7={'method':'POST','uri':_0x5a49a2+_0x977d('0x50'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x35a177['Subjects'],_0x207906,'\x20'),'phonenumber':String(_0x207906['calleridnum']),'description':intUtil[_0x977d('0x48')](_0x35a177[_0x977d('0x4a')],_0x207906,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3bafd3[_0x977d('0x2f')]?_0x977d('0x4b')+_0x3bafd3[_0x977d('0x2f')]+')':undefined,'ownerid@odata.bind':_0x977d('0x4c')+_0x3bafd3[_0x977d('0x25')]+')','directioncode':_0x3bafd3[_0x977d('0x4e')]===_0x977d('0x4f')?![]:!![],'phonecall_activity_parties':_0x790596},getCustomFields(_0x35a177[_0x977d('0x4d')],_0x207906,_0x35a177[_0x977d('0x44')])),'headers':{'Authorization':_0x977d('0x1a')+_0x181919,'OData-Version':_0x977d('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5c6ef7);})[_0x977d('0x11')](function(_0x34e9cb){var _0x6c5293=_0x34e9cb['headers'][_0x977d('0x51')];var _0x3030e7=_0x6c5293[_0x977d('0x2d')](_0x6c5293[_0x977d('0x2e')]('(')+0x1,_0x6c5293[_0x977d('0x2e')](')'));_0x3bafd3[_0x977d('0x52')]=_0x3030e7;_0x29c124(_0x3bafd3);})[_0x977d('0x13')](function(_0x205c37){_0x5477c0(_0x205c37['message']);});});}function emit(_0x4a387d,_0x3fecb4,_0x5690f2,_0x4049ac){var _0xec8773={'uri':util[_0x977d('0x53')](_0x977d('0x54'),_0x4a387d,_0x5690f2,_0x4049ac)};io['to'](util[_0x977d('0x53')](_0x977d('0x55'),_0x3fecb4))[_0x977d('0x56')](_0x977d('0x57'),_0xec8773);}exports['cs']=function(_0x343a46,_0x5719f1,_0x407ce9,_0x1b8f74,_0xac39d0,_0x1c0375,_0x1f4bb0,_0x28ab34){var _0x4f227e={};_0x1c0375[_0x977d('0xb')]=_0x1c0375['modernAuthentication']?intUtil[_0x977d('0x58')](_0x1c0375[_0x977d('0xc')]['data7']):intUtil[_0x977d('0x58')](_0x1c0375[_0x977d('0xb')]);_0x1c0375[_0x977d('0x59')]=intUtil[_0x977d('0x58')](_0x1c0375[_0x977d('0x59')]);_0x4f227e['callDirection']=_0x28ab34==='queue'||_0x28ab34===_0x977d('0x5a')?_0x977d('0x4f'):_0x977d('0x30');var _0x387ea6=_0x1c0375['modernAuthentication']?util[_0x977d('0x53')](_0x977d('0x5b'),_0x1c0375[_0x977d('0xc')][_0x977d('0xd')]):util[_0x977d('0x53')]('%s/api/data/v9.0/',_0x1c0375[_0x977d('0xb')]);var _0x2e5c3f=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x1c0375[_0x977d('0x5c')]);var _0x4778eb=util['format'](_0x977d('0x5d'),_0x1c0375[_0x977d('0x59')],_0x5719f1[_0x977d('0x5e')],md5(_0x5719f1['uniqueid']));if(_0xac39d0&&_0xac39d0[_0x977d('0x5f')]){logger[_0x977d('0x39')](_0x977d('0x60'),_0x977d('0x61'));_0x5719f1['recordingURL']=_0x4778eb;}else if(_0x1f4bb0&&_0x1f4bb0[_0x977d('0x62')]&&_0x1f4bb0[_0x977d('0x62')]!==_0x977d('0x63')){logger[_0x977d('0x39')](_0x977d('0x64'),'Recording\x20is\x20enabled!');_0x5719f1[_0x977d('0x65')]=_0x4778eb;}else{_0x5719f1['recordingURL']='';}return getUser(_0x4f227e,_0x1c0375,_0x1b8f74,_0x2e5c3f,_0x387ea6,_0x28ab34)[_0x977d('0x11')](function(_0x1a3de9){logger['info']('['+_0x28ab34[_0x977d('0x15')]()+_0x977d('0x66'),_0x1a3de9[_0x977d('0x25')]);logger[_0x977d('0x39')]('['+_0x28ab34[_0x977d('0x15')]()+_0x977d('0x67'),_0x1a3de9[_0x977d('0x20')]);return getEndUser(_0x1a3de9,_0x1c0375,_0x2e5c3f,_0x387ea6,_0x5719f1,_0x28ab34,_0x407ce9[_0x977d('0x68')],_0x407ce9[_0x977d('0x69')]);})['then'](function(_0x40ce53){logger[_0x977d('0x39')]('['+_0x28ab34[_0x977d('0x15')]()+_0x977d('0x6a'),_0x40ce53['enduserId']);logger[_0x977d('0x39')]('['+_0x28ab34[_0x977d('0x15')]()+_0x977d('0x6b'),_0x5719f1['calleridnum']);return getTicket(_0x40ce53,_0x1c0375,_0x2e5c3f,_0x387ea6,_0x5719f1,_0x407ce9,_0x28ab34);})[_0x977d('0x11')](function(_0xcba273){logger[_0x977d('0x39')](util[_0x977d('0x53')]('['+_0x28ab34[_0x977d('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x407ce9['ticketType'],_0xcba273[_0x977d('0x52')]));logger[_0x977d('0x39')](util[_0x977d('0x53')]('['+_0x28ab34[_0x977d('0x15')]()+']\x20Call\x20direction:\x20%s',_0x28ab34));if(_0x28ab34!==_0x977d('0x5a')&&_0x407ce9['openNewTab']){logger[_0x977d('0x39')]('['+_0x28ab34[_0x977d('0x15')]()+']',_0x977d('0x6c'));emit(_0x1c0375['remoteUri'],_0x1b8f74['name'],_0x407ce9[_0x977d('0x44')],_0xcba273[_0x977d('0x52')]);}})[_0x977d('0x13')](function(_0x3d4232){logger[_0x977d('0x14')]('['+_0x28ab34['toUpperCase']()+_0x977d('0x6d'),_0x3d4232[_0x977d('0x17')]);console[_0x977d('0x14')]('Error\x20running\x20Dynamics365\x20integration',_0x3d4232);});}; \ No newline at end of file +var _0x913f=['moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','resolve','POST','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','email','length','isdisabled','info','systemuserid','internalemailaddress','username','userId','then','outbound','calleridnum','Bearer\x20','4.0','body','headers','substring','lastIndexOf','enduserId','toLowerCase','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','userEmail'];(function(_0x57b575,_0x5801ea){var _0x577b10=function(_0x1c26be){while(--_0x1c26be){_0x57b575['push'](_0x57b575['shift']());}};_0x577b10(++_0x5801ea);}(_0x913f,0xe2));var _0xf913=function(_0x344807,_0x5c3e9e){_0x344807=_0x344807-0x0;var _0x440519=_0x913f[_0x344807];return _0x440519;};'use strict';var _=require(_0xf913('0x0'));var rp=require(_0xf913('0x1'));var util=require(_0xf913('0x2'));var intUtil=require('./util');var md5=require(_0xf913('0x3'));var Redis=require(_0xf913('0x4'));var logger=require(_0xf913('0x5'))('dynamics365');var config=require(_0xf913('0x6'));config[_0xf913('0x7')]=_[_0xf913('0x8')](config['redis'],{'host':_0xf913('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x3c8b57,_0x325f19,_0x28f761){if(_0x3c8b57[_0xf913('0xa')]){_0x3c8b57[_0xf913('0xb')]=_0x3c8b57['CloudProvider'][_0xf913('0xc')];_0x3c8b57[_0xf913('0xd')]=_0x3c8b57[_0xf913('0xe')]['data2'];return Promise[_0xf913('0xf')](_0x3c8b57[_0xf913('0xe')]['data5']);}var _0x670b78={'method':_0xf913('0x10'),'uri':_0x325f19,'form':{'client_id':_0x3c8b57['clientId'],'resource':_0x3c8b57[_0xf913('0xb')],'username':_0x3c8b57['username'],'password':_0x3c8b57['password'],'grant_type':_0xf913('0x11'),'client_secret':_0x3c8b57[_0xf913('0x12')]},'json':!![]};return rp(_0x670b78)['then'](function(_0x420c80){return _0x420c80[_0xf913('0x13')];})[_0xf913('0x14')](function(_0x5a6189){logger[_0xf913('0x15')]('['+[_0x28f761[_0xf913('0x16')]()]+_0xf913('0x17'));return _0x5a6189[_0xf913('0x18')];});}function getUser(_0x3d6464,_0x2f5992,_0x4ea340,_0x24185d,_0x105c78,_0x3cc72a){return new Promise(function(_0x2f6bbb,_0x2bedf2){return getAuthToken(_0x2f5992,_0x24185d,_0x3cc72a)['then'](function(_0x3f8801){var _0x4d1bac={'method':_0xf913('0x19'),'uri':_0x105c78+_0xf913('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x3f8801,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d1bac);})['then'](function(_0x12427e){var _0x594a3b=_0x12427e[_0xf913('0x1b')];var _0x554679=![];var _0x175594=null;if(!_[_0xf913('0x1c')](_0x4ea340)){if(intUtil[_0xf913('0x1d')](_0x4ea340['email'])){_0x3d6464['userEmail']=_0x4ea340[_0xf913('0x1e')];for(_0x175594=0x0;_0x175594<_0x594a3b[_0xf913('0x1f')];_0x175594++){if(_0x594a3b[_0x175594]['internalemailaddress']===_0x4ea340[_0xf913('0x1e')]&&!_0x594a3b[_0x175594][_0xf913('0x20')]){_0x554679=!![];logger[_0xf913('0x21')]('['+[_0x3cc72a['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x594a3b[_0x175594][_0xf913('0x22')]+'!');_0x3d6464['userId']=_0x594a3b[_0x175594][_0xf913('0x22')];}}}}if(!_0x554679){logger[_0xf913('0x21')]('['+[_0x3cc72a['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3d6464['userEmail']=_0x2f5992['username'];for(_0x175594=0x0;_0x175594<_0x594a3b[_0xf913('0x1f')];_0x175594++){if(_0x594a3b[_0x175594][_0xf913('0x23')]===_0x2f5992[_0xf913('0x24')]){_0x3d6464[_0xf913('0x25')]=_0x594a3b[_0x175594][_0xf913('0x22')];}}}_0x2f6bbb(_0x3d6464);})[_0xf913('0x14')](function(_0x1c1717){_0x2bedf2(_0x1c1717[_0xf913('0x18')]);});});}function createEndUser(_0x4d961f,_0x46963b,_0x451a44,_0x2d9a67,_0x3ed222,_0x3f166a,_0x3baf22){return new Promise(function(_0x5d6d69,_0x27a577){return getAuthToken(_0x46963b,_0x451a44,_0x3f166a)[_0xf913('0x26')](function(_0x6a3306){var _0xdf04e0=_0x3f166a['toLowerCase']()===_0xf913('0x27')?_0x3ed222['destcalleridnum']:_0x3ed222[_0xf913('0x28')];var _0x4d7570={'method':_0xf913('0x10'),'uri':_0x2d9a67+'contacts','body':{'fullname':_0xdf04e0,'firstname':_0xdf04e0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4d961f[_0xf913('0x25')]+')'},'headers':{'Authorization':_0xf913('0x29')+_0x6a3306,'OData-Version':_0xf913('0x2a')},'json':!![],'resolveWithFullResponse':!![]};_0x4d7570[_0xf913('0x2b')][_0x3baf22]=_0xdf04e0;return rp(_0x4d7570);})['then'](function(_0x2c5fae){var _0x29691b=_0x2c5fae[_0xf913('0x2c')]['odata-entityid'];var _0x1c8e52=_0x29691b[_0xf913('0x2d')](_0x29691b[_0xf913('0x2e')]('(')+0x1,_0x29691b[_0xf913('0x2e')](')'));_0x4d961f[_0xf913('0x2f')]=_0x1c8e52;_0x5d6d69(_0x4d961f);})[_0xf913('0x14')](function(_0xd27309){_0x27a577(_0xd27309[_0xf913('0x18')]);});});}function getEndUser(_0x5e87df,_0x22b079,_0x177089,_0x28a281,_0x45c246,_0x2ca064,_0x598308,_0x5e4e02){var _0x3def7f=_0x2ca064[_0xf913('0x30')]()===_0xf913('0x27')?_0x45c246['destcalleridnum']:_0x45c246[_0xf913('0x28')];return getAuthToken(_0x22b079,_0x177089,_0x2ca064)[_0xf913('0x26')](function(_0x2c9609){_0x5e4e02=_0x5e4e02?_0x5e4e02:_0xf913('0x31');var _0x4d1d39={'method':_0xf913('0x19'),'uri':_0x28a281+'contacts?$select='+_0x5e4e02+_0xf913('0x32')+_0x5e4e02+_0xf913('0x33')+_0x3def7f[_0xf913('0x34')]('+',_0xf913('0x35'))+'\x27','headers':{'Authorization':_0xf913('0x29')+_0x2c9609,'If-None-Match':null,'OData-Version':_0xf913('0x2a')},'json':!![]};return rp(_0x4d1d39);})['then'](function(_0x3df975){var _0x4f3cb4=![];if(!_0x3df975)return _0x4f3cb4;var _0x310c60=_0x3df975['value'];for(var _0x490709=0x0;_0x490709<_0x310c60['length'];_0x490709++){if(_0x310c60[_0x490709][_0x5e4e02]===_0x3def7f){_0x4f3cb4=!![];_0x5e87df[_0xf913('0x2f')]=_0x310c60[_0x490709][_0xf913('0x36')];}}return _0x4f3cb4;})[_0xf913('0x26')](function(_0x3fff93){if(_0x3fff93)return _0x5e87df;if(_0x598308===_0xf913('0x37')){logger[_0xf913('0x21')]('['+[_0x2ca064['toUpperCase']()]+_0xf913('0x38'));return _0x5e87df;}return createEndUser(_0x5e87df,_0x22b079,_0x177089,_0x28a281,_0x45c246,_0x2ca064,_0x5e4e02)['then'](function(_0xc599a){logger[_0xf913('0x21')]('['+[_0x2ca064[_0xf913('0x16')]()]+_0xf913('0x39'),_0xc599a[_0xf913('0x2f')]);return _0xc599a;});});}function getCustomFields(_0x199f4b,_0x5f3931,_0x54692f){var _0x375164={};if(_0x199f4b['length']>0x0){_[_0xf913('0x3a')](_0x199f4b,function(_0x43d67b){if(_[_0xf913('0x3b')](['string',_0xf913('0x3c')],_0x43d67b[_0xf913('0x3d')])&&_0x43d67b[_0xf913('0x3e')]&&!_0x43d67b[_0xf913('0x3f')]){var _0x16a2cf=_0x43d67b[_0xf913('0x40')][_0xf913('0x30')]();var _0x1c87e7=_0x16a2cf[_0xf913('0x2d')](0x0,_0x16a2cf['indexOf']('_'));var _0x30e386=_0x16a2cf['substring'](_0x16a2cf[_0xf913('0x41')]('_')+0x1);if(_0x1c87e7===_0x54692f){_0x375164[_0x30e386]=_0x43d67b[_0xf913('0x42')];}}});}return _0x375164;}function getTicket(_0x12fb11,_0x33cf30,_0x74895b,_0x5096eb,_0x4e9aca,_0x1fd437,_0x507b1a){return new Promise(function(_0x5d0569,_0x313360){var _0x31bf41;return getAuthToken(_0x33cf30,_0x74895b,_0x507b1a)[_0xf913('0x26')](function(_0x1da407){if(_0x1fd437[_0xf913('0x43')]==='incident'){_0x31bf41={'method':'POST','uri':_0x5096eb+'incidents','body':Object[_0xf913('0x44')]({},{'title':intUtil[_0xf913('0x45')](_0x1fd437[_0xf913('0x46')],_0x4e9aca,'\x20'),'description':intUtil[_0xf913('0x45')](_0x1fd437[_0xf913('0x47')],_0x4e9aca,'\x0a'),'customerid_contact@odata.bind':_0x12fb11[_0xf913('0x2f')]?_0xf913('0x48')+_0x12fb11[_0xf913('0x2f')]+')':undefined,'ownerid@odata.bind':_0xf913('0x49')+_0x12fb11[_0xf913('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x1fd437[_0xf913('0x4a')],_0x4e9aca,_0x1fd437[_0xf913('0x43')])),'headers':{'Authorization':_0xf913('0x29')+_0x1da407,'OData-Version':_0xf913('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1fd437[_0xf913('0x43')]===_0xf913('0x4b')){var _0x469c89=_0x12fb11[_0xf913('0x2f')]?[{'partyid_systemuser@odata.bind':_0xf913('0x49')+_0x12fb11['userId']+')','participationtypemask':_0x12fb11[_0xf913('0x4c')]===_0xf913('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x12fb11['enduserId']+')','participationtypemask':_0x12fb11['callDirection']===_0xf913('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf913('0x49')+_0x12fb11[_0xf913('0x25')]+')','participationtypemask':_0x12fb11[_0xf913('0x4c')]===_0xf913('0x4d')?0x2:0x1}];_0x31bf41={'method':_0xf913('0x10'),'uri':_0x5096eb+_0xf913('0x4e'),'body':Object[_0xf913('0x44')]({},{'subject':intUtil[_0xf913('0x45')](_0x1fd437[_0xf913('0x46')],_0x4e9aca,'\x20'),'phonenumber':String(_0x4e9aca[_0xf913('0x28')]),'description':intUtil[_0xf913('0x45')](_0x1fd437[_0xf913('0x47')],_0x4e9aca,'\x0a'),'regardingobjectid_contact@odata.bind':_0x12fb11[_0xf913('0x2f')]?_0xf913('0x48')+_0x12fb11['enduserId']+')':undefined,'ownerid@odata.bind':_0xf913('0x49')+_0x12fb11['userId']+')','directioncode':_0x12fb11['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x469c89},getCustomFields(_0x1fd437['Fields'],_0x4e9aca,_0x1fd437[_0xf913('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x1da407,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x31bf41);})['then'](function(_0xc9f0f0){var _0x52afde=_0xc9f0f0[_0xf913('0x2c')][_0xf913('0x4f')];var _0x3b6650=_0x52afde[_0xf913('0x2d')](_0x52afde[_0xf913('0x2e')]('(')+0x1,_0x52afde[_0xf913('0x2e')](')'));_0x12fb11[_0xf913('0x50')]=_0x3b6650;_0x5d0569(_0x12fb11);})[_0xf913('0x14')](function(_0x4a3d64){_0x313360(_0x4a3d64[_0xf913('0x18')]);});});}function emit(_0x496049,_0x451287,_0x255cb9,_0x46c7a3){var _0x555af1={'uri':util[_0xf913('0x51')](_0xf913('0x52'),_0x496049,_0x255cb9,_0x46c7a3)};io['to'](util[_0xf913('0x51')](_0xf913('0x53'),_0x451287))['emit'](_0xf913('0x54'),_0x555af1);}exports['cs']=function(_0x2235b5,_0x34b402,_0x4ff667,_0x5f2ddf,_0xbb7136,_0x38e732,_0x2cde59,_0xac0a25){var _0x13ede5={};_0x38e732[_0xf913('0xb')]=_0x38e732[_0xf913('0xa')]?intUtil['stripTrailingSlash'](_0x38e732[_0xf913('0xe')][_0xf913('0xc')]):intUtil['stripTrailingSlash'](_0x38e732[_0xf913('0xb')]);_0x38e732[_0xf913('0x55')]=intUtil['stripTrailingSlash'](_0x38e732[_0xf913('0x55')]);_0x13ede5[_0xf913('0x4c')]=_0xac0a25===_0xf913('0x4d')||_0xac0a25===_0xf913('0x56')?_0xf913('0x4d'):_0xf913('0x27');var _0xc0bd34=_0x38e732['modernAuthentication']?util['format'](_0xf913('0x57'),_0x38e732[_0xf913('0xe')][_0xf913('0xc')]):util[_0xf913('0x51')]('%s/api/data/v9.0/',_0x38e732[_0xf913('0xb')]);var _0x229f49=util[_0xf913('0x51')](_0xf913('0x58'),_0x38e732[_0xf913('0xd')]);var _0x32efed=util[_0xf913('0x51')](_0xf913('0x59'),_0x38e732[_0xf913('0x55')],_0x34b402[_0xf913('0x5a')],md5(_0x34b402[_0xf913('0x5a')]));if(_0xbb7136&&_0xbb7136['monitor_format']){logger['info'](_0xf913('0x5b'),_0xf913('0x5c'));_0x34b402[_0xf913('0x5d')]=_0x32efed;}else if(_0x2cde59&&_0x2cde59['recordingFormat']&&_0x2cde59[_0xf913('0x5e')]!==_0xf913('0x5f')){logger[_0xf913('0x21')](_0xf913('0x60'),_0xf913('0x5c'));_0x34b402[_0xf913('0x5d')]=_0x32efed;}else{_0x34b402[_0xf913('0x5d')]='';}return getUser(_0x13ede5,_0x38e732,_0x5f2ddf,_0x229f49,_0xc0bd34,_0xac0a25)[_0xf913('0x26')](function(_0x448990){logger[_0xf913('0x21')]('['+_0xac0a25[_0xf913('0x16')]()+']\x20The\x20User\x20ID\x20is:',_0x448990[_0xf913('0x25')]);logger[_0xf913('0x21')]('['+_0xac0a25[_0xf913('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x448990[_0xf913('0x61')]);return getEndUser(_0x448990,_0x38e732,_0x229f49,_0xc0bd34,_0x34b402,_0xac0a25,_0x4ff667[_0xf913('0x62')],_0x4ff667[_0xf913('0x63')]);})[_0xf913('0x26')](function(_0x44252a){logger[_0xf913('0x21')]('['+_0xac0a25[_0xf913('0x16')]()+_0xf913('0x64'),_0x44252a[_0xf913('0x2f')]);logger[_0xf913('0x21')]('['+_0xac0a25[_0xf913('0x16')]()+_0xf913('0x65'),_0x34b402[_0xf913('0x28')]);return getTicket(_0x44252a,_0x38e732,_0x229f49,_0xc0bd34,_0x34b402,_0x4ff667,_0xac0a25);})[_0xf913('0x26')](function(_0x55d9de){logger[_0xf913('0x21')](util[_0xf913('0x51')]('['+_0xac0a25[_0xf913('0x16')]()+_0xf913('0x66'),_0x4ff667['ticketType'],_0x55d9de[_0xf913('0x50')]));logger[_0xf913('0x21')](util[_0xf913('0x51')]('['+_0xac0a25[_0xf913('0x16')]()+_0xf913('0x67'),_0xac0a25));if(_0xac0a25!==_0xf913('0x56')&&_0x4ff667[_0xf913('0x68')]){logger['info']('['+_0xac0a25['toUpperCase']()+']',_0xf913('0x69'));emit(_0x38e732['remoteUri'],_0x5f2ddf['name'],_0x4ff667[_0xf913('0x43')],_0x55d9de[_0xf913('0x50')]);}})[_0xf913('0x14')](function(_0x4236fc){logger[_0xf913('0x15')]('['+_0xac0a25[_0xf913('0x16')]()+_0xf913('0x6a'),_0x4236fc[_0xf913('0x18')]);console[_0xf913('0x15')](_0xf913('0x6b'),_0x4236fc);});}; \ 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 ba0dd55..507a6fa 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 _0xdd7c=['Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','forEach','string','picklist','nameField','customField','toLowerCase','content','includes','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdd7c,0xf4));var _0xcdd7=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xdd7c[_0x339129];return _0x1570df;};'use strict';var _=require(_0xcdd7('0x0'));var rp=require(_0xcdd7('0x1'));var md5=require('md5');var util=require(_0xcdd7('0x2'));var Redis=require(_0xcdd7('0x3'));var intUtil=require(_0xcdd7('0x4'));var config=require(_0xcdd7('0x5'));var logger=require(_0xcdd7('0x6'))(_0xcdd7('0x7'));config[_0xcdd7('0x8')]=_['defaults'](config[_0xcdd7('0x8')],{'host':_0xcdd7('0x9'),'port':0x18eb});var io=require(_0xcdd7('0xa'))(new Redis(config[_0xcdd7('0x8')]));var headers={'Content-Type':_0xcdd7('0xb'),'Accept':_0xcdd7('0xb')};function emit(_0x21d6f7,_0x54a17f,_0x56402e){io['to'](_0x21d6f7)[_0xcdd7('0xc')](_0x54a17f,_0x56402e);}function getTicket(_0x181a89,_0x327716,_0x3396ee,_0x5a4179,_0xa872ee){logger['info'](_0xcdd7('0xd'));var _0x18e029=_[_0xcdd7('0xe')]({'responder_id':_0x327716['id'],'requester_id':_0x3396ee['id'],'name':util['format'](_0xcdd7('0xf'),_0xa872ee[_0xcdd7('0x10')]),'phone':_0xa872ee[_0xcdd7('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5a4179[_0xcdd7('0x12')],_0xa872ee,'\x20'),'description':intUtil['getString'](_0x5a4179[_0xcdd7('0x13')],_0xa872ee,'
'),'tags':getTags(_0x5a4179[_0xcdd7('0x14')],_0xcdd7('0x15'))},getCustomFields(_0x5a4179[_0xcdd7('0x16')],_0xa872ee));_0x18e029[_0xcdd7('0x17')]=_['mapValues'](_[_0xcdd7('0x18')](_0x18e029[_0xcdd7('0x17')],'id'),_0xcdd7('0x19'));return request({'uri':util[_0xcdd7('0x1a')](_0xcdd7('0x1b'),_0x181a89[_0xcdd7('0x1c')]),'method':_0xcdd7('0x1d'),'body':_0x18e029})[_0xcdd7('0x1e')](function(_0x1bd4ca){logger['info'](_0xcdd7('0x1f'));return _0x1bd4ca;});}function getUser(_0x1404a3,_0x4cc8c6){if(intUtil[_0xcdd7('0x20')](_0x4cc8c6)){return request({'uri':util['format']('%s/api/v2/agents',_0x1404a3['remoteUri']),'qs':{'email':_0x4cc8c6}})[_0xcdd7('0x1e')](function(_0x23074e){if(_0x23074e[_0xcdd7('0x21')]){logger[_0xcdd7('0x22')](_0xcdd7('0x23'));return _[_0xcdd7('0x24')](_0x23074e,function(_0xa067fe){return _0xa067fe['contact'][_0xcdd7('0x25')]===_0x4cc8c6;});}else{logger['info'](_0xcdd7('0x26'));return request({'uri':util['format'](_0xcdd7('0x27'),_0x1404a3[_0xcdd7('0x1c')])})[_0xcdd7('0x1e')](function(_0x46c4a5){logger['info'](_0xcdd7('0x28'));return _0x46c4a5;});}});}else{logger[_0xcdd7('0x22')](_0xcdd7('0x29'));return request({'uri':util[_0xcdd7('0x1a')](_0xcdd7('0x27'),_0x1404a3[_0xcdd7('0x1c')])})['then'](function(_0x507865){logger[_0xcdd7('0x22')](_0xcdd7('0x28'));return _0x507865;});}}function getEndUser(_0x1b4599,_0x4659bb,_0x3baa36){logger[_0xcdd7('0x22')]('Searching\x20enduser\x20with\x20phone',_0x3baa36);return request({'uri':util[_0xcdd7('0x1a')](_0xcdd7('0x2a'),_0x1b4599[_0xcdd7('0x1c')]),'qs':{'phone':_0x3baa36}})['then'](function(_0x13e6d6){if(_0x13e6d6['length']){logger[_0xcdd7('0x22')](_0xcdd7('0x2b'));return _[_0xcdd7('0x24')](_0x13e6d6,{'phone':_0x3baa36});}else{logger['info'](_0xcdd7('0x2c'));return request({'uri':util[_0xcdd7('0x1a')](_0xcdd7('0x2a'),_0x1b4599[_0xcdd7('0x1c')]),'method':_0xcdd7('0x1d'),'body':{'name':_0x4659bb,'phone':_0x3baa36}})['then'](function(_0x237962){logger[_0xcdd7('0x22')]('Enduser\x20created.');return _0x237962;});}});}function getAuth(_0x34ae84){return util[_0xcdd7('0x1a')](_0xcdd7('0x2d'),new Buffer(_0x34ae84['apiKey']+':X')[_0xcdd7('0x2e')](_0xcdd7('0x2f')));}function request(_0xd0ab0){logger[_0xcdd7('0x30')](_0xcdd7('0x31'),JSON[_0xcdd7('0x32')](_0xd0ab0));return rp(_[_0xcdd7('0x33')](_0xd0ab0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1766ea,_0x299a9e){var _0x21665e=[];if(_0x1766ea&&_0x1766ea[_0xcdd7('0x21')]>0x0){_0x21665e=_['map'](_0x1766ea,_0x299a9e);}return _0x21665e;}function getCustomFields(_0x57704c,_0x25b743){var _0x21fe81=[];var _0x37f9a2={'custom_fields':[]};if(_0x57704c[_0xcdd7('0x21')]>0x0){_[_0xcdd7('0x34')](_0x57704c,function(_0x1422a9){if(_['includes']([_0xcdd7('0x35'),_0xcdd7('0x36')],_0x1422a9['type'])&&_0x1422a9[_0xcdd7('0x37')]&&!_0x1422a9[_0xcdd7('0x38')]){_0x37f9a2[_0x1422a9[_0xcdd7('0x37')][_0xcdd7('0x39')]()]=_0x1422a9[_0xcdd7('0x3a')][_0xcdd7('0x2e')]();}else if(_[_0xcdd7('0x3b')]([_0xcdd7('0x35'),_0xcdd7('0x36')],_0x1422a9[_0xcdd7('0x3c')])&&_0x1422a9[_0xcdd7('0x3d')]&&_0x1422a9[_0xcdd7('0x38')]){_0x37f9a2['custom_fields'][_0xcdd7('0x3e')]({'id':_0x1422a9['idField'],'value':_0x1422a9[_0xcdd7('0x3a')][_0xcdd7('0x2e')]()});}else if(_0x1422a9[_0xcdd7('0x3c')]===_0xcdd7('0x3f')&&_0x1422a9[_0xcdd7('0x40')]&&_0x1422a9[_0xcdd7('0x3d')]&&_0x1422a9[_0xcdd7('0x38')]){_0x25b743[_0x1422a9[_0xcdd7('0x40')]]&&_0x37f9a2[_0xcdd7('0x17')][_0xcdd7('0x3e')]({'id':_0x1422a9['idField'],'value':_0x25b743[_0x1422a9[_0xcdd7('0x40')]]['toString']()});}else if(_0x1422a9[_0xcdd7('0x3c')]==='customVariable'&&_0x1422a9[_0xcdd7('0x41')]&&_0x1422a9['Variable'][_0xcdd7('0x15')]&&_0x1422a9[_0xcdd7('0x3d')]&&_0x1422a9['customField']){_0x25b743[_0x1422a9[_0xcdd7('0x41')][_0xcdd7('0x15')][_0xcdd7('0x39')]()]&&_0x37f9a2[_0xcdd7('0x17')][_0xcdd7('0x3e')]({'id':_0x1422a9[_0xcdd7('0x3d')],'value':_0x25b743[_0x1422a9['Variable'][_0xcdd7('0x15')][_0xcdd7('0x39')]()][_0xcdd7('0x2e')]()});}});}return _0x37f9a2;}exports[_0xcdd7('0x42')]=function(_0x9aa156,_0x45ab4e,_0x19c054,_0x3cf814,_0xdb4f03,_0x5a94bd){var _0x341893,_0xdef3f6;_0x5a94bd[_0xcdd7('0x1c')]=intUtil[_0xcdd7('0x43')](_0x5a94bd[_0xcdd7('0x1c')]);_0x5a94bd['serverUrl']=intUtil[_0xcdd7('0x43')](_0x5a94bd[_0xcdd7('0x44')]);if(_0xdb4f03&&_0xdb4f03['monitor_format']){logger[_0xcdd7('0x22')](_0xcdd7('0x45'),_0xcdd7('0x46'));_0x45ab4e[_0xcdd7('0x47')]=util[_0xcdd7('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a94bd['serverUrl'],_0x45ab4e['uniqueid'],md5(_0x45ab4e[_0xcdd7('0x48')]));}else{_0x45ab4e['recordingURL']='';}headers[_0xcdd7('0x49')]=getAuth(_0x5a94bd);return getUser(_0x5a94bd,_0x3cf814[_0xcdd7('0x25')])[_0xcdd7('0x1e')](function(_0x3bc2e0){_0x341893=_0x3bc2e0;logger[_0xcdd7('0x22')](_0xcdd7('0x4a'),_0x341893['id']);return getEndUser(_0x5a94bd,_0x45ab4e['calleridname'],_0x45ab4e[_0xcdd7('0x11')]);})[_0xcdd7('0x1e')](function(_0x10abfc){_0xdef3f6=_0x10abfc;logger[_0xcdd7('0x22')](_0xcdd7('0x4b'),_0xdef3f6['id']);return getTicket(_0x5a94bd,_0x341893,_0xdef3f6,_0x19c054,_0x45ab4e);})[_0xcdd7('0x1e')](function(_0x3dfe24){if(_0x3dfe24&&_0x3dfe24['id']){logger[_0xcdd7('0x22')](_0xcdd7('0x1f'));logger[_0xcdd7('0x22')](_0xcdd7('0x4c'),_0x3dfe24['id']);logger[_0xcdd7('0x22')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcdd7('0x1a')](_0xcdd7('0x4d'),_0x3cf814['name']),_0xcdd7('0x4e'),{'uri':util['format'](_0xcdd7('0x4f'),_0x5a94bd['remoteUri'],_0x3dfe24['id'])});}})[_0xcdd7('0x50')](function(_0x3ecdc5){logger[_0xcdd7('0x51')]('[QUEUE]',JSON[_0xcdd7('0x32')](_0x3ecdc5));});};exports['outbound']=function(_0x4d59d7,_0x44699b,_0x16ed17,_0x3655ed,_0xc1b1f6,_0x560e53,_0x4e973f){var _0x191030,_0xe871bc;_0x560e53['remoteUri']=intUtil['stripTrailingSlash'](_0x560e53[_0xcdd7('0x1c')]);_0x560e53[_0xcdd7('0x44')]=intUtil['stripTrailingSlash'](_0x560e53[_0xcdd7('0x44')]);if(_0x4e973f&&_0x4e973f[_0xcdd7('0x52')]&&_0x4e973f['recordingFormat']!==_0xcdd7('0x53')){logger[_0xcdd7('0x22')]('[OUTBOUND]',_0xcdd7('0x46'));_0x44699b[_0xcdd7('0x47')]=util[_0xcdd7('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x560e53[_0xcdd7('0x44')],_0x44699b[_0xcdd7('0x48')],md5(_0x44699b[_0xcdd7('0x48')]));}headers[_0xcdd7('0x49')]=getAuth(_0x560e53);return getUser(_0x560e53,_0x3655ed[_0xcdd7('0x25')])[_0xcdd7('0x1e')](function(_0x3dbd7e){_0x191030=_0x3dbd7e;logger[_0xcdd7('0x22')](_0xcdd7('0x4a'),_0x191030['id']);return getEndUser(_0x560e53,_0x44699b[_0xcdd7('0x54')],_0x44699b[_0xcdd7('0x55')]);})['then'](function(_0x88e519){_0xe871bc=_0x88e519;logger[_0xcdd7('0x22')]('The\x20Enduser\x20ID\x20is:',_0xe871bc['id']);return getTicket(_0x560e53,_0x191030,_0xe871bc,_0x16ed17,_0x44699b);})[_0xcdd7('0x1e')](function(_0x534144){if(_0x534144&&_0x534144['id']){logger[_0xcdd7('0x22')]('Ticket\x20created!');logger[_0xcdd7('0x22')](_0xcdd7('0x4c'),_0x534144['id']);logger[_0xcdd7('0x22')](_0xcdd7('0x56'),_0xcdd7('0x57'));emit(util['format']('user:%s',_0x3655ed['name']),_0xcdd7('0x4e'),{'uri':util['format'](_0xcdd7('0x4f'),_0x560e53[_0xcdd7('0x1c')],_0x534144['id'])});}})[_0xcdd7('0x50')](function(_0x38c0e4){logger[_0xcdd7('0x51')]('[OUTBOUND]',JSON[_0xcdd7('0x32')](_0x38c0e4));});};exports[_0xcdd7('0x58')]=function(_0x325fc3,_0x494343,_0x4ba8a1,_0x5cf884,_0x1e8b0c,_0x3ddfce){var _0x5c3891,_0x15b24a;_0x3ddfce[_0xcdd7('0x1c')]=intUtil[_0xcdd7('0x43')](_0x3ddfce[_0xcdd7('0x1c')]);_0x3ddfce[_0xcdd7('0x44')]=intUtil[_0xcdd7('0x43')](_0x3ddfce[_0xcdd7('0x44')]);if(_0x1e8b0c&&_0x1e8b0c[_0xcdd7('0x59')]){logger[_0xcdd7('0x22')]('['+_0x494343[_0xcdd7('0x5a')][_0xcdd7('0x5b')]()+']','Recording\x20is\x20enabled!');_0x494343[_0xcdd7('0x47')]=util[_0xcdd7('0x1a')](_0xcdd7('0x5c'),_0x3ddfce['serverUrl'],_0x494343[_0xcdd7('0x48')],md5(_0x494343['uniqueid']));}else{_0x494343['recordingURL']='';}headers[_0xcdd7('0x49')]=getAuth(_0x3ddfce);return getUser(_0x3ddfce,'')[_0xcdd7('0x1e')](function(_0x3f47a5){_0x5c3891=_0x3f47a5;logger[_0xcdd7('0x22')](_0xcdd7('0x4a'),_0x5c3891['id']);return getEndUser(_0x3ddfce,_0x494343[_0xcdd7('0x10')],_0x494343[_0xcdd7('0x11')]);})['then'](function(_0x4b768c){_0x15b24a=_0x4b768c;logger['info'](_0xcdd7('0x4b'),_0x15b24a['id']);return getTicket(_0x3ddfce,_0x5c3891,_0x15b24a,_0x4ba8a1,_0x494343);})[_0xcdd7('0x1e')](function(_0x4421b3){if(_0x4421b3){logger[_0xcdd7('0x22')](_0xcdd7('0x1f'));logger[_0xcdd7('0x22')](_0xcdd7('0x4c'),_0x4421b3['id']);}})[_0xcdd7('0x50')](function(_0x1fce3b){logger[_0xcdd7('0x51')]('['+_0x494343['lastevent'][_0xcdd7('0x5b')]()+']',JSON['stringify'](_0x1fce3b));});}; \ No newline at end of file +var _0x53b0=['Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','GET','forEach','string','picklist','nameField','toLowerCase','content','type','idField','customField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','trigger:browser:url','catch','stringify','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','md5','util','ioredis','../../../../config/logger','freshdesk','redis','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','remoteUri','POST','then','info','Ticket\x20created!','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me'];(function(_0x4c4b04,_0x569c2b){var _0xad2374=function(_0x1fb354){while(--_0x1fb354){_0x4c4b04['push'](_0x4c4b04['shift']());}};_0xad2374(++_0x569c2b);}(_0x53b0,0x1ad));var _0x053b=function(_0x1998d5,_0x46e5fe){_0x1998d5=_0x1998d5-0x0;var _0x2742fb=_0x53b0[_0x1998d5];return _0x2742fb;};'use strict';var _=require(_0x053b('0x0'));var rp=require('request-promise');var md5=require(_0x053b('0x1'));var util=require(_0x053b('0x2'));var Redis=require(_0x053b('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x053b('0x4'))(_0x053b('0x5'));config[_0x053b('0x6')]=_['defaults'](config[_0x053b('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x053b('0x6')]));var headers={'Content-Type':_0x053b('0x7'),'Accept':'application/json'};function emit(_0x40ab1c,_0x52c187,_0x4fcbcf){io['to'](_0x40ab1c)[_0x053b('0x8')](_0x52c187,_0x4fcbcf);}function getTicket(_0x57998c,_0x54fa64,_0x509c1c,_0x1e70b4,_0x5bb179){logger['info'](_0x053b('0x9'));var _0x21c698=_[_0x053b('0xa')]({'responder_id':_0x54fa64['id'],'requester_id':_0x509c1c['id'],'name':util[_0x053b('0xb')](_0x053b('0xc'),_0x5bb179[_0x053b('0xd')]),'phone':_0x5bb179[_0x053b('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x053b('0xf')](_0x1e70b4[_0x053b('0x10')],_0x5bb179,'\x20'),'description':intUtil[_0x053b('0xf')](_0x1e70b4[_0x053b('0x11')],_0x5bb179,_0x053b('0x12')),'tags':getTags(_0x1e70b4[_0x053b('0x13')],_0x053b('0x14'))},getCustomFields(_0x1e70b4[_0x053b('0x15')],_0x5bb179));_0x21c698['custom_fields']=_[_0x053b('0x16')](_[_0x053b('0x17')](_0x21c698['custom_fields'],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x57998c[_0x053b('0x18')]),'method':_0x053b('0x19'),'body':_0x21c698})[_0x053b('0x1a')](function(_0x3dd453){logger[_0x053b('0x1b')](_0x053b('0x1c'));return _0x3dd453;});}function getUser(_0x54cfd6,_0x42b1d6){if(intUtil['validateEmail'](_0x42b1d6)){return request({'uri':util['format']('%s/api/v2/agents',_0x54cfd6['remoteUri']),'qs':{'email':_0x42b1d6}})[_0x053b('0x1a')](function(_0xee92a3){if(_0xee92a3[_0x053b('0x1d')]){logger[_0x053b('0x1b')](_0x053b('0x1e'));return _[_0x053b('0x1f')](_0xee92a3,function(_0x308dd8){return _0x308dd8[_0x053b('0x20')][_0x053b('0x21')]===_0x42b1d6;});}else{logger['info'](_0x053b('0x22'));return request({'uri':util['format'](_0x053b('0x23'),_0x54cfd6[_0x053b('0x18')])})[_0x053b('0x1a')](function(_0x2eafdd){logger[_0x053b('0x1b')]('Admin\x20account\x20selected.');return _0x2eafdd;});}});}else{logger[_0x053b('0x1b')](_0x053b('0x24'));return request({'uri':util[_0x053b('0xb')](_0x053b('0x23'),_0x54cfd6[_0x053b('0x18')])})[_0x053b('0x1a')](function(_0x26848e){logger[_0x053b('0x1b')]('Admin\x20account\x20selected.');return _0x26848e;});}}function getEndUser(_0x4edaa3,_0x36c504,_0x9c04cc){logger[_0x053b('0x1b')](_0x053b('0x25'),_0x9c04cc);return request({'uri':util[_0x053b('0xb')](_0x053b('0x26'),_0x4edaa3['remoteUri']),'qs':{'phone':_0x9c04cc}})[_0x053b('0x1a')](function(_0x576198){if(_0x576198['length']){logger[_0x053b('0x1b')](_0x053b('0x27'));return _[_0x053b('0x1f')](_0x576198,{'phone':_0x9c04cc});}else{logger['info'](_0x053b('0x28'));return request({'uri':util[_0x053b('0xb')]('%s/api/v2/contacts',_0x4edaa3[_0x053b('0x18')]),'method':'POST','body':{'name':_0x36c504,'phone':_0x9c04cc}})[_0x053b('0x1a')](function(_0x3ef7a2){logger[_0x053b('0x1b')](_0x053b('0x29'));return _0x3ef7a2;});}});}function getAuth(_0xdd5171){return util[_0x053b('0xb')](_0x053b('0x2a'),new Buffer(_0xdd5171[_0x053b('0x2b')]+':X')[_0x053b('0x2c')](_0x053b('0x2d')));}function request(_0x1b0762){logger[_0x053b('0x2e')](_0x053b('0x2f'),JSON['stringify'](_0x1b0762));return rp(_[_0x053b('0x30')](_0x1b0762,{'method':_0x053b('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x50f656,_0x3888f3){var _0x2fb1ae=[];if(_0x50f656&&_0x50f656[_0x053b('0x1d')]>0x0){_0x2fb1ae=_['map'](_0x50f656,_0x3888f3);}return _0x2fb1ae;}function getCustomFields(_0x364368,_0x18894a){var _0x220f6d=[];var _0x3f8ba9={'custom_fields':[]};if(_0x364368[_0x053b('0x1d')]>0x0){_[_0x053b('0x32')](_0x364368,function(_0x5d7831){if(_['includes']([_0x053b('0x33'),_0x053b('0x34')],_0x5d7831['type'])&&_0x5d7831['nameField']&&!_0x5d7831['customField']){_0x3f8ba9[_0x5d7831[_0x053b('0x35')][_0x053b('0x36')]()]=_0x5d7831[_0x053b('0x37')][_0x053b('0x2c')]();}else if(_['includes']([_0x053b('0x33'),_0x053b('0x34')],_0x5d7831[_0x053b('0x38')])&&_0x5d7831[_0x053b('0x39')]&&_0x5d7831[_0x053b('0x3a')]){_0x3f8ba9[_0x053b('0x3b')]['push']({'id':_0x5d7831[_0x053b('0x39')],'value':_0x5d7831[_0x053b('0x37')][_0x053b('0x2c')]()});}else if(_0x5d7831[_0x053b('0x38')]===_0x053b('0x3c')&&_0x5d7831[_0x053b('0x3d')]&&_0x5d7831[_0x053b('0x39')]&&_0x5d7831['customField']){_0x18894a[_0x5d7831[_0x053b('0x3d')]]&&_0x3f8ba9['custom_fields'][_0x053b('0x3e')]({'id':_0x5d7831['idField'],'value':_0x18894a[_0x5d7831[_0x053b('0x3d')]][_0x053b('0x2c')]()});}else if(_0x5d7831[_0x053b('0x38')]===_0x053b('0x3f')&&_0x5d7831[_0x053b('0x40')]&&_0x5d7831[_0x053b('0x40')][_0x053b('0x14')]&&_0x5d7831[_0x053b('0x39')]&&_0x5d7831[_0x053b('0x3a')]){_0x18894a[_0x5d7831[_0x053b('0x40')][_0x053b('0x14')][_0x053b('0x36')]()]&&_0x3f8ba9['custom_fields']['push']({'id':_0x5d7831['idField'],'value':_0x18894a[_0x5d7831['Variable'][_0x053b('0x14')][_0x053b('0x36')]()][_0x053b('0x2c')]()});}});}return _0x3f8ba9;}exports[_0x053b('0x41')]=function(_0xf47afc,_0x56c2ca,_0x40bd41,_0x37e47a,_0x22dd9f,_0x33568c){var _0x1e1c03,_0x2e56fd;_0x33568c[_0x053b('0x18')]=intUtil[_0x053b('0x42')](_0x33568c[_0x053b('0x18')]);_0x33568c[_0x053b('0x43')]=intUtil[_0x053b('0x42')](_0x33568c['serverUrl']);if(_0x22dd9f&&_0x22dd9f[_0x053b('0x44')]){logger['info'](_0x053b('0x45'),_0x053b('0x46'));_0x56c2ca[_0x053b('0x47')]=util['format'](_0x053b('0x48'),_0x33568c[_0x053b('0x43')],_0x56c2ca['uniqueid'],md5(_0x56c2ca[_0x053b('0x49')]));}else{_0x56c2ca[_0x053b('0x47')]='';}headers['Authorization']=getAuth(_0x33568c);return getUser(_0x33568c,_0x37e47a[_0x053b('0x21')])['then'](function(_0x4207d3){_0x1e1c03=_0x4207d3;logger[_0x053b('0x1b')](_0x053b('0x4a'),_0x1e1c03['id']);return getEndUser(_0x33568c,_0x56c2ca[_0x053b('0xd')],_0x56c2ca['calleridnum']);})['then'](function(_0x24ae03){_0x2e56fd=_0x24ae03;logger[_0x053b('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x2e56fd['id']);return getTicket(_0x33568c,_0x1e1c03,_0x2e56fd,_0x40bd41,_0x56c2ca);})['then'](function(_0x450225){if(_0x450225&&_0x450225['id']){logger['info'](_0x053b('0x1c'));logger[_0x053b('0x1b')](_0x053b('0x4b'),_0x450225['id']);logger[_0x053b('0x1b')]('[QUEUE]',_0x053b('0x4c'));emit(util[_0x053b('0xb')](_0x053b('0x4d'),_0x37e47a['name']),'trigger:browser:url',{'uri':util['format'](_0x053b('0x4e'),_0x33568c['remoteUri'],_0x450225['id'])});}})['catch'](function(_0x5d1715){logger[_0x053b('0x4f')](_0x053b('0x45'),JSON['stringify'](_0x5d1715));});};exports[_0x053b('0x50')]=function(_0x46aee6,_0x4ffcb9,_0x282e0e,_0x126147,_0x53619c,_0x1171e1,_0x48be4c){var _0x27acc2,_0x4cf87f;_0x1171e1[_0x053b('0x18')]=intUtil['stripTrailingSlash'](_0x1171e1[_0x053b('0x18')]);_0x1171e1['serverUrl']=intUtil[_0x053b('0x42')](_0x1171e1['serverUrl']);if(_0x48be4c&&_0x48be4c['recordingFormat']&&_0x48be4c[_0x053b('0x51')]!=='none'){logger[_0x053b('0x1b')](_0x053b('0x52'),_0x053b('0x46'));_0x4ffcb9[_0x053b('0x47')]=util['format'](_0x053b('0x48'),_0x1171e1[_0x053b('0x43')],_0x4ffcb9[_0x053b('0x49')],md5(_0x4ffcb9['uniqueid']));}headers[_0x053b('0x53')]=getAuth(_0x1171e1);return getUser(_0x1171e1,_0x126147[_0x053b('0x21')])[_0x053b('0x1a')](function(_0xba24ac){_0x27acc2=_0xba24ac;logger[_0x053b('0x1b')]('The\x20User\x20ID\x20is:',_0x27acc2['id']);return getEndUser(_0x1171e1,_0x4ffcb9[_0x053b('0x54')],_0x4ffcb9[_0x053b('0x55')]);})['then'](function(_0xf2a558){_0x4cf87f=_0xf2a558;logger[_0x053b('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4cf87f['id']);return getTicket(_0x1171e1,_0x27acc2,_0x4cf87f,_0x282e0e,_0x4ffcb9);})['then'](function(_0x305bca){if(_0x305bca&&_0x305bca['id']){logger[_0x053b('0x1b')](_0x053b('0x1c'));logger[_0x053b('0x1b')](_0x053b('0x4b'),_0x305bca['id']);logger['info'](_0x053b('0x52'),_0x053b('0x4c'));emit(util[_0x053b('0xb')](_0x053b('0x4d'),_0x126147[_0x053b('0x14')]),_0x053b('0x56'),{'uri':util['format'](_0x053b('0x4e'),_0x1171e1[_0x053b('0x18')],_0x305bca['id'])});}})[_0x053b('0x57')](function(_0x354282){logger['error'](_0x053b('0x52'),JSON[_0x053b('0x58')](_0x354282));});};exports[_0x053b('0x59')]=function(_0x3cb3a7,_0x39ea74,_0x56a398,_0x352ae8,_0x45795a,_0x4d8afb){var _0x5b1337,_0x2bbdcd;_0x4d8afb[_0x053b('0x18')]=intUtil[_0x053b('0x42')](_0x4d8afb['remoteUri']);_0x4d8afb[_0x053b('0x43')]=intUtil[_0x053b('0x42')](_0x4d8afb['serverUrl']);if(_0x45795a&&_0x45795a[_0x053b('0x44')]){logger[_0x053b('0x1b')]('['+_0x39ea74[_0x053b('0x5a')][_0x053b('0x5b')]()+']',_0x053b('0x46'));_0x39ea74['recordingURL']=util[_0x053b('0xb')](_0x053b('0x48'),_0x4d8afb[_0x053b('0x43')],_0x39ea74[_0x053b('0x49')],md5(_0x39ea74['uniqueid']));}else{_0x39ea74[_0x053b('0x47')]='';}headers['Authorization']=getAuth(_0x4d8afb);return getUser(_0x4d8afb,'')[_0x053b('0x1a')](function(_0x5294d6){_0x5b1337=_0x5294d6;logger[_0x053b('0x1b')](_0x053b('0x4a'),_0x5b1337['id']);return getEndUser(_0x4d8afb,_0x39ea74[_0x053b('0xd')],_0x39ea74['calleridnum']);})['then'](function(_0x18c472){_0x2bbdcd=_0x18c472;logger[_0x053b('0x1b')](_0x053b('0x5c'),_0x2bbdcd['id']);return getTicket(_0x4d8afb,_0x5b1337,_0x2bbdcd,_0x56a398,_0x39ea74);})[_0x053b('0x1a')](function(_0x426dbc){if(_0x426dbc){logger[_0x053b('0x1b')](_0x053b('0x1c'));logger[_0x053b('0x1b')](_0x053b('0x4b'),_0x426dbc['id']);}})['catch'](function(_0x360256){logger['error']('['+_0x39ea74['lastevent'][_0x053b('0x5b')]()+']',JSON['stringify'](_0x360256));});}; \ 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 83180d7..b6d4562 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 _0xd685=['length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','message','/api/lookup?q=','&f=','find','contacts','catch','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then'];(function(_0x42c16b,_0xfefc9a){var _0x8fd791=function(_0x2172c1){while(--_0x2172c1){_0x42c16b['push'](_0x42c16b['shift']());}};_0x8fd791(++_0xfefc9a);}(_0xd685,0xe6));var _0x5d68=function(_0x1cf642,_0x337a9d){_0x1cf642=_0x1cf642-0x0;var _0x47d126=_0xd685[_0x1cf642];return _0x47d126;};'use strict';var _=require(_0x5d68('0x0'));var rp=require(_0x5d68('0x1'));var md5=require(_0x5d68('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0x5d68('0x3'));var Redis=require(_0x5d68('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x5d68('0x5'))(_0x5d68('0x6'));config[_0x5d68('0x7')]=_[_0x5d68('0x8')](config[_0x5d68('0x7')],{'host':_0x5d68('0x9'),'port':0x18eb});var io=require(_0x5d68('0xa'))(new Redis(config[_0x5d68('0x7')]));function getAdminId(_0x45b398,_0xd1e435,_0x2d05f5,_0x29e23d){return new Promise(function(_0x2c60ed,_0x7e058f){var _0x3a9743=![];var _0x221cab={'method':_0x5d68('0xb'),'uri':_0x29e23d+_0x5d68('0xc'),'json':!![]};_0x221cab[_0x5d68('0xd')]=_0x2d05f5;logger[_0x5d68('0xe')]('Getting\x20admin\x20information');return rp(_0x221cab)[_0x5d68('0xf')](function(_0x1ee747){if(_0x1ee747){var _0x524609=_0x1ee747['users'];var _0x5ab4fd=null;for(_0x5ab4fd=0x0;_0x5ab4fd<_0x524609[_0x5d68('0x10')];_0x5ab4fd++){if(_0x524609[_0x5ab4fd][_0x5d68('0x11')]===_0x45b398[_0x5d68('0x12')]){_0x45b398[_0x5d68('0x13')]=_0x524609[_0x5ab4fd]['id'];_0x3a9743=!![];}}if(_0x3a9743){logger[_0x5d68('0xe')](_0x5d68('0x14'),_0x45b398['adminId']);_0x2c60ed(_0x45b398);}else{_0x7e058f({'statusCode':0x194,'message':_0x5d68('0x15')});}}else{_0x7e058f({'statusCode':0x194,'message':_0x5d68('0x15')});}})['catch'](function(_0x3c3e92){logger['error']('['+[_0xd1e435[_0x5d68('0x16')]()]+']',_0x3c3e92['message']);_0x7e058f(_0x3c3e92);});});}function getUser(_0x4bd82c,_0x1fceb0,_0x2901c5){return function(_0x35f162){return new Promise(function(_0x33d3fd,_0x40ccbd){var _0x62f91e={'method':_0x5d68('0xb'),'uri':_0x2901c5+'/api/selector/owners','json':!![]};_0x62f91e[_0x5d68('0xd')]=_0x1fceb0;logger['info'](_0x5d68('0x17'));return rp(_0x62f91e)[_0x5d68('0xf')](function(_0x356a73){if(_0x356a73){var _0x2663aa=_0x356a73['users'];var _0x217bc9=![];var _0x217f62=null;if(_0x35f162['agentEmail']!==null){logger[_0x5d68('0xe')](_0x5d68('0x18'),_0x35f162[_0x5d68('0x19')]);_0x35f162[_0x5d68('0x1a')]=_0x35f162['agentEmail'];for(_0x217f62=0x0;_0x217f62<_0x2663aa[_0x5d68('0x10')];_0x217f62++){if(_0x2663aa[_0x217f62][_0x5d68('0x11')]===_0x35f162['agentEmail']){_0x217bc9=!![];_0x35f162[_0x5d68('0x1b')]=_0x2663aa[_0x217f62]['id'];logger[_0x5d68('0xe')](_0x5d68('0x1c'),_0x35f162['userId']);}}}if(!_0x217bc9){logger[_0x5d68('0xe')](_0x5d68('0x1d'));_0x35f162[_0x5d68('0x1a')]=_0x35f162[_0x5d68('0x12')];_0x35f162[_0x5d68('0x1b')]=_0x35f162[_0x5d68('0x13')];_0x217bc9=!![];}if(_0x217bc9){_0x33d3fd(_0x35f162);}else{_0x40ccbd({'statusCode':0x194,'message':_0x5d68('0x15')});}}else{_0x40ccbd({'statusCode':0x194,'message':_0x5d68('0x15')});}})['catch'](function(_0x553319){logger[_0x5d68('0x1e')]('['+[_0x4bd82c[_0x5d68('0x16')]()]+']',_0x553319[_0x5d68('0x1f')]);_0x40ccbd(_0x553319);});});};}function searchContact(_0x58feb7,_0x2c02eb,_0xfe3576,_0xab5e41){return new Promise(function(_0x5156cb,_0x2d9149){var _0x211d0b={'method':_0x5d68('0xb'),'headers':_0x2c02eb,'uri':_0x58feb7+_0x5d68('0x20')+_0xab5e41+_0x5d68('0x21')+_0xfe3576+'&entities=contact','json':!![]};rp(_0x211d0b)[_0x5d68('0xf')](function(_0x5bd593){var _0x27c9ae=_[_0x5d68('0x22')](_0x5bd593[_0x5d68('0x23')][_0x5d68('0x23')],[_0xfe3576,_0xab5e41]);_0x5156cb(_0x27c9ae);})[_0x5d68('0x24')](function(_0x15cfe0){_0x2d9149(_0x15cfe0);});});}function getEndUser(_0x1e62fe,_0x4a8f10,_0x3bc13a){return function(_0x7b710e){return new Promise(function(_0x31cc24,_0x128293){logger[_0x5d68('0xe')](util[_0x5d68('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x7b710e[_0x5d68('0x26')]));searchContact(_0x3bc13a,_0x4a8f10,_0x5d68('0x27'),_0x7b710e[_0x5d68('0x26')])[_0x5d68('0xf')](function(_0x3c54ff){if(_0x3c54ff){_0x7b710e[_0x5d68('0x28')]=_0x3c54ff['id'];logger[_0x5d68('0xe')](_0x5d68('0x29'),_0x7b710e[_0x5d68('0x28')]);return _0x31cc24(_0x7b710e);}searchContact(_0x3bc13a,_0x4a8f10,_0x5d68('0x2a'),_0x7b710e[_0x5d68('0x26')])[_0x5d68('0xf')](function(_0x2145c4){if(_0x2145c4){_0x7b710e['endUserId']=_0x2145c4['id'];logger[_0x5d68('0xe')](_0x5d68('0x2b'),_0x7b710e[_0x5d68('0x28')]);return _0x31cc24(_0x7b710e);}createEndUser(_0x7b710e,_0x1e62fe,_0x4a8f10,_0x3bc13a)[_0x5d68('0xf')](function(_0x48441f){logger[_0x5d68('0xe')](_0x5d68('0x2c'),_0x48441f['endUserId']);return _0x31cc24(_0x48441f);});});})[_0x5d68('0x24')](function(_0x1adfcb){_0x128293(_0x1adfcb);});});};}function createEndUser(_0x41506d,_0x5d8cae,_0x505aeb,_0x325195){return new Promise(function(_0x217724,_0x24a81a){var _0x196e34=moment();var _0x3cdb41={'method':_0x5d68('0x2d'),'uri':_0x325195+_0x5d68('0x2e'),'body':{'contact':{'last_name':_0x41506d['contactNumber'],'work_number':_0x41506d[_0x5d68('0x26')],'mobile_number':_0x41506d[_0x5d68('0x26')],'owner_id':_0x41506d[_0x5d68('0x1b')],'created_at':_0x196e34[_0x5d68('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3cdb41[_0x5d68('0xd')]=_0x505aeb;logger['info'](_0x5d68('0x2f'));return rp(_0x3cdb41)[_0x5d68('0xf')](function(_0x4f7984){_0x41506d[_0x5d68('0x28')]=_0x4f7984[_0x5d68('0x30')]['id'];_0x217724(_0x41506d);})[_0x5d68('0x24')](function(_0x535c4d){logger[_0x5d68('0x1e')]('['+[_0x5d8cae[_0x5d68('0x16')]()]+']',_0x535c4d[_0x5d68('0x1f')]);_0x24a81a(_0x535c4d[_0x5d68('0x1f')]);});});}function getTicket(_0xb6da,_0x35589,_0x2dc819,_0x2509a7,_0x29654f){return function(_0xeb4a81){logger[_0x5d68('0xe')](_0x5d68('0x31'));return new Promise(function(_0x206b53,_0x5d1f9e){var _0x5d0104=moment();var _0x5137fa={'method':_0x5d68('0x2d'),'uri':_0x2dc819+_0x5d68('0x32'),'body':{'title':intUtil[_0x5d68('0x33')](_0x2509a7['Subjects'],_0x29654f,'\x20'),'description':intUtil[_0x5d68('0x33')](_0x2509a7[_0x5d68('0x34')],_0x29654f,'\x0a'),'owner_id':_0xeb4a81[_0x5d68('0x1b')],'creater_id':_0xeb4a81[_0x5d68('0x13')],'targetable_id':_0xeb4a81[_0x5d68('0x28')],'targetable_type':'Contact','created_at':_0x5d0104[_0x5d68('0x25')](_0x5d68('0x35')),'due_date':_0x5d0104['add'](0x1e,'m')[_0x5d68('0x25')](_0x5d68('0x35'))},'json':!![]};_0x5137fa[_0x5d68('0xd')]=_0x35589;return rp(_0x5137fa)[_0x5d68('0xf')](function(_0x521ec0){_0xeb4a81[_0x5d68('0x36')]=_0x521ec0[_0x5d68('0x37')]['id'];logger[_0x5d68('0xe')](_0x5d68('0x38'),_0xeb4a81[_0x5d68('0x36')]);_0x206b53(_0xeb4a81);})[_0x5d68('0x24')](function(_0x47f6f7){logger[_0x5d68('0x1e')]('['+[_0xb6da[_0x5d68('0x16')]()]+']',_0x47f6f7[_0x5d68('0x1f')]);_0x5d1f9e(_0x47f6f7['message']);});});};}function emit(_0x18efa0,_0xbc949b,_0x57f1f2){var _0x553071={'uri':_0x18efa0+_0x5d68('0x39')+_0x57f1f2};io['to'](util[_0x5d68('0x25')](_0x5d68('0x3a'),_0xbc949b))[_0x5d68('0x3b')](_0x5d68('0x3c'),_0x553071);}exports['cs']=function(_0x381d15,_0x2c59f4,_0x130b5e,_0x38f7d0,_0xb7ee,_0x476931,_0xbd3e42,_0x215782){var _0x570698={};var _0x1de0b6={'Authorization':_0x5d68('0x3d')+_0x476931[_0x5d68('0x3e')]};_0x476931[_0x5d68('0x3f')]=intUtil['stripTrailingSlash'](_0x476931[_0x5d68('0x3f')]);_0x476931['serverUrl']=intUtil[_0x5d68('0x40')](_0x476931['serverUrl']);var _0x3cefbe=_0x476931['remoteUri'];_0x570698[_0x5d68('0x12')]=_0x476931['username'];_0x570698[_0x5d68('0x26')]=_0x215782['toLowerCase']()===_0x5d68('0x41')?_0x2c59f4[_0x5d68('0x42')]:_0x2c59f4[_0x5d68('0x43')];_0x570698[_0x5d68('0x44')]=_0x215782==='queue'||_0x215782===_0x5d68('0x45')?_0x5d68('0x46'):_0x5d68('0x41');if(_0x38f7d0){_0x570698[_0x5d68('0x19')]=_0x38f7d0[_0x5d68('0x11')];}var _0x14eaa3=util[_0x5d68('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x476931[_0x5d68('0x47')],_0x2c59f4[_0x5d68('0x48')],md5(_0x2c59f4[_0x5d68('0x48')]));if(_0xb7ee&&_0xb7ee[_0x5d68('0x49')]){logger[_0x5d68('0xe')](_0x5d68('0x4a'),'Recording\x20is\x20enabled!');_0x2c59f4[_0x5d68('0x4b')]=_0x14eaa3;}else if(_0xbd3e42&&_0xbd3e42[_0x5d68('0x4c')]&&_0xbd3e42[_0x5d68('0x4c')]!=='none'){logger['info'](_0x5d68('0x4d'),_0x5d68('0x4e'));_0x2c59f4[_0x5d68('0x4b')]=_0x14eaa3;}else{_0x2c59f4[_0x5d68('0x4b')]='';}return getAdminId(_0x570698,_0x215782,_0x1de0b6,_0x3cefbe)['then'](getUser(_0x215782,_0x1de0b6,_0x3cefbe))[_0x5d68('0xf')](getEndUser(_0x215782,_0x1de0b6,_0x3cefbe))[_0x5d68('0xf')](getTicket(_0x215782,_0x1de0b6,_0x3cefbe,_0x130b5e,_0x2c59f4))[_0x5d68('0xf')](function(_0xd3d7c4){logger[_0x5d68('0xe')](util['format'](_0x5d68('0x4f'),_0xd3d7c4[_0x5d68('0x36')]));if(_0x215782!==_0x5d68('0x45')){logger[_0x5d68('0xe')]('['+[_0x215782[_0x5d68('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3cefbe,_0x38f7d0[_0x5d68('0x50')],_0xd3d7c4[_0x5d68('0x28')]);}})[_0x5d68('0x24')](function(_0x486234){logger[_0x5d68('0x1e')]('['+[_0x215782[_0x5d68('0x16')]()]+_0x5d68('0x51'),util['inspect'](_0x486234,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf9fc=['Task\x20created:','/contacts/','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','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','name','lodash','request-promise','md5','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','GET','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','User\x20found:','userId','Admin\x20selected','catch','message','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','add','ticketId','task'];(function(_0x430205,_0x328c94){var _0x3f5146=function(_0x3cd6bd){while(--_0x3cd6bd){_0x430205['push'](_0x430205['shift']());}};_0x3f5146(++_0x328c94);}(_0xf9fc,0x160));var _0xcf9f=function(_0x4d4f91,_0xc5ae15){_0x4d4f91=_0x4d4f91-0x0;var _0x1add87=_0xf9fc[_0x4d4f91];return _0x1add87;};'use strict';var _=require(_0xcf9f('0x0'));var rp=require(_0xcf9f('0x1'));var md5=require(_0xcf9f('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0xcf9f('0x3'));var Redis=require(_0xcf9f('0x4'));var intUtil=require(_0xcf9f('0x5'));var config=require('../../../../config/environment');var logger=require(_0xcf9f('0x6'))(_0xcf9f('0x7'));config[_0xcf9f('0x8')]=_[_0xcf9f('0x9')](config['redis'],{'host':_0xcf9f('0xa'),'port':0x18eb});var io=require(_0xcf9f('0xb'))(new Redis(config[_0xcf9f('0x8')]));function getAdminId(_0x5b2e12,_0xcb53b5,_0x4d1aaf,_0x11d470){return new Promise(function(_0x273bd,_0x1f4841){var _0x4f0eca=![];var _0x4a43f8={'method':'GET','uri':_0x11d470+_0xcf9f('0xc'),'json':!![]};_0x4a43f8[_0xcf9f('0xd')]=_0x4d1aaf;logger[_0xcf9f('0xe')](_0xcf9f('0xf'));return rp(_0x4a43f8)[_0xcf9f('0x10')](function(_0x3ac5aa){if(_0x3ac5aa){var _0x1a2601=_0x3ac5aa[_0xcf9f('0x11')];var _0x78968e=null;for(_0x78968e=0x0;_0x78968e<_0x1a2601[_0xcf9f('0x12')];_0x78968e++){if(_0x1a2601[_0x78968e]['email']===_0x5b2e12[_0xcf9f('0x13')]){_0x5b2e12[_0xcf9f('0x14')]=_0x1a2601[_0x78968e]['id'];_0x4f0eca=!![];}}if(_0x4f0eca){logger['info'](_0xcf9f('0x15'),_0x5b2e12[_0xcf9f('0x14')]);_0x273bd(_0x5b2e12);}else{_0x1f4841({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1f4841({'statusCode':0x194,'message':_0xcf9f('0x16')});}})['catch'](function(_0x131209){logger[_0xcf9f('0x17')]('['+[_0xcb53b5[_0xcf9f('0x18')]()]+']',_0x131209['message']);_0x1f4841(_0x131209);});});}function getUser(_0x87e63d,_0xa7ea6b,_0x448855){return function(_0x4aa27c){return new Promise(function(_0x455e7e,_0x4826ca){var _0x598800={'method':_0xcf9f('0x19'),'uri':_0x448855+_0xcf9f('0xc'),'json':!![]};_0x598800[_0xcf9f('0xd')]=_0xa7ea6b;logger[_0xcf9f('0xe')](_0xcf9f('0x1a'));return rp(_0x598800)[_0xcf9f('0x10')](function(_0x45422d){if(_0x45422d){var _0x1189f6=_0x45422d[_0xcf9f('0x11')];var _0x4e5663=![];var _0x2a7bcc=null;if(_0x4aa27c['agentEmail']!==null){logger[_0xcf9f('0xe')](_0xcf9f('0x1b'),_0x4aa27c[_0xcf9f('0x1c')]);_0x4aa27c[_0xcf9f('0x1d')]=_0x4aa27c[_0xcf9f('0x1c')];for(_0x2a7bcc=0x0;_0x2a7bcc<_0x1189f6[_0xcf9f('0x12')];_0x2a7bcc++){if(_0x1189f6[_0x2a7bcc][_0xcf9f('0x1e')]===_0x4aa27c[_0xcf9f('0x1c')]){_0x4e5663=!![];_0x4aa27c['userId']=_0x1189f6[_0x2a7bcc]['id'];logger[_0xcf9f('0xe')](_0xcf9f('0x1f'),_0x4aa27c[_0xcf9f('0x20')]);}}}if(!_0x4e5663){logger[_0xcf9f('0xe')](_0xcf9f('0x21'));_0x4aa27c[_0xcf9f('0x1d')]=_0x4aa27c[_0xcf9f('0x13')];_0x4aa27c[_0xcf9f('0x20')]=_0x4aa27c[_0xcf9f('0x14')];_0x4e5663=!![];}if(_0x4e5663){_0x455e7e(_0x4aa27c);}else{_0x4826ca({'statusCode':0x194,'message':_0xcf9f('0x16')});}}else{_0x4826ca({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xcf9f('0x22')](function(_0x346d64){logger[_0xcf9f('0x17')]('['+[_0x87e63d['toUpperCase']()]+']',_0x346d64[_0xcf9f('0x23')]);_0x4826ca(_0x346d64);});});};}function searchContact(_0x4744e9,_0x11250,_0xbeee72,_0x4c45bf){return new Promise(function(_0x14474d,_0x4d0557){var _0x1959a3={'method':_0xcf9f('0x19'),'headers':_0x11250,'uri':_0x4744e9+_0xcf9f('0x24')+_0x4c45bf+_0xcf9f('0x25')+_0xbeee72+'&entities=contact','json':!![]};rp(_0x1959a3)[_0xcf9f('0x10')](function(_0x5c711c){var _0x3d5362=_[_0xcf9f('0x26')](_0x5c711c[_0xcf9f('0x27')]['contacts'],[_0xbeee72,_0x4c45bf]);_0x14474d(_0x3d5362);})[_0xcf9f('0x22')](function(_0x351227){_0x4d0557(_0x351227);});});}function getEndUser(_0x5512b1,_0x5b0d1b,_0xef8f36){return function(_0x59f38c){return new Promise(function(_0x366702,_0x315964){logger[_0xcf9f('0xe')](util[_0xcf9f('0x28')](_0xcf9f('0x29'),_0x59f38c[_0xcf9f('0x2a')]));searchContact(_0xef8f36,_0x5b0d1b,_0xcf9f('0x2b'),_0x59f38c['contactNumber'])[_0xcf9f('0x10')](function(_0x1a176f){if(_0x1a176f){_0x59f38c[_0xcf9f('0x2c')]=_0x1a176f['id'];logger[_0xcf9f('0xe')]('Contact\x20found\x20mobile_number:',_0x59f38c[_0xcf9f('0x2c')]);return _0x366702(_0x59f38c);}searchContact(_0xef8f36,_0x5b0d1b,'work_number',_0x59f38c['contactNumber'])[_0xcf9f('0x10')](function(_0xa4f0e4){if(_0xa4f0e4){_0x59f38c[_0xcf9f('0x2c')]=_0xa4f0e4['id'];logger[_0xcf9f('0xe')]('Contact\x20found\x20work_number:',_0x59f38c[_0xcf9f('0x2c')]);return _0x366702(_0x59f38c);}createEndUser(_0x59f38c,_0x5512b1,_0x5b0d1b,_0xef8f36)[_0xcf9f('0x10')](function(_0x4fcb30){logger[_0xcf9f('0xe')](_0xcf9f('0x2d'),_0x4fcb30['endUserId']);return _0x366702(_0x4fcb30);});});})[_0xcf9f('0x22')](function(_0x1e74d6){_0x315964(_0x1e74d6);});});};}function createEndUser(_0x190b0b,_0x4e0245,_0x859865,_0x29ee25){return new Promise(function(_0x5044d6,_0x67954c){var _0x3c2fda=moment();var _0x4a3ea3={'method':_0xcf9f('0x2e'),'uri':_0x29ee25+_0xcf9f('0x2f'),'body':{'contact':{'last_name':_0x190b0b[_0xcf9f('0x2a')],'work_number':_0x190b0b[_0xcf9f('0x2a')],'mobile_number':_0x190b0b[_0xcf9f('0x2a')],'owner_id':_0x190b0b[_0xcf9f('0x20')],'created_at':_0x3c2fda[_0xcf9f('0x28')](_0xcf9f('0x30'))}},'json':!![]};_0x4a3ea3[_0xcf9f('0xd')]=_0x859865;logger[_0xcf9f('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4a3ea3)[_0xcf9f('0x10')](function(_0x4536c7){_0x190b0b[_0xcf9f('0x2c')]=_0x4536c7[_0xcf9f('0x31')]['id'];_0x5044d6(_0x190b0b);})[_0xcf9f('0x22')](function(_0x3ec639){logger['error']('['+[_0x4e0245[_0xcf9f('0x18')]()]+']',_0x3ec639[_0xcf9f('0x23')]);_0x67954c(_0x3ec639[_0xcf9f('0x23')]);});});}function getTicket(_0x3cbd36,_0x4ad6d5,_0x2971da,_0x48c980,_0xceeef2){return function(_0x4162d5){logger['info'](_0xcf9f('0x32'));return new Promise(function(_0x1d9ca5,_0x365ebb){var _0x8eb1d5=moment();var _0x31df7c={'method':_0xcf9f('0x2e'),'uri':_0x2971da+_0xcf9f('0x33'),'body':{'title':intUtil['getString'](_0x48c980[_0xcf9f('0x34')],_0xceeef2,'\x20'),'description':intUtil[_0xcf9f('0x35')](_0x48c980['Descriptions'],_0xceeef2,'\x0a'),'owner_id':_0x4162d5[_0xcf9f('0x20')],'creater_id':_0x4162d5[_0xcf9f('0x14')],'targetable_id':_0x4162d5['endUserId'],'targetable_type':_0xcf9f('0x36'),'created_at':_0x8eb1d5[_0xcf9f('0x28')](_0xcf9f('0x30')),'due_date':_0x8eb1d5[_0xcf9f('0x37')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x31df7c[_0xcf9f('0xd')]=_0x4ad6d5;return rp(_0x31df7c)[_0xcf9f('0x10')](function(_0x3a076c){_0x4162d5[_0xcf9f('0x38')]=_0x3a076c[_0xcf9f('0x39')]['id'];logger[_0xcf9f('0xe')](_0xcf9f('0x3a'),_0x4162d5[_0xcf9f('0x38')]);_0x1d9ca5(_0x4162d5);})['catch'](function(_0x2f5cb5){logger[_0xcf9f('0x17')]('['+[_0x3cbd36[_0xcf9f('0x18')]()]+']',_0x2f5cb5['message']);_0x365ebb(_0x2f5cb5['message']);});});};}function emit(_0x3b517e,_0x3dc269,_0x10532e){var _0x222661={'uri':_0x3b517e+_0xcf9f('0x3b')+_0x10532e};io['to'](util[_0xcf9f('0x28')]('user:%s',_0x3dc269))[_0xcf9f('0x3c')](_0xcf9f('0x3d'),_0x222661);}exports['cs']=function(_0x814261,_0x1abc0d,_0x3e0f19,_0x58685f,_0x443f50,_0x38c8a3,_0xfec413,_0x3e89b1){var _0x57e862={};var _0x384d7a={'Authorization':'Token\x20token='+_0x38c8a3['apiKey']};_0x38c8a3[_0xcf9f('0x3e')]=intUtil[_0xcf9f('0x3f')](_0x38c8a3[_0xcf9f('0x3e')]);_0x38c8a3['serverUrl']=intUtil['stripTrailingSlash'](_0x38c8a3[_0xcf9f('0x40')]);var _0x277ad6=_0x38c8a3[_0xcf9f('0x3e')];_0x57e862['adminEmail']=_0x38c8a3[_0xcf9f('0x41')];_0x57e862[_0xcf9f('0x2a')]=_0x3e89b1[_0xcf9f('0x42')]()===_0xcf9f('0x43')?_0x1abc0d[_0xcf9f('0x44')]:_0x1abc0d[_0xcf9f('0x45')];_0x57e862[_0xcf9f('0x46')]=_0x3e89b1===_0xcf9f('0x47')||_0x3e89b1===_0xcf9f('0x48')?_0xcf9f('0x47'):_0xcf9f('0x43');if(_0x58685f){_0x57e862['agentEmail']=_0x58685f[_0xcf9f('0x1e')];}var _0xeadc8e=util[_0xcf9f('0x28')](_0xcf9f('0x49'),_0x38c8a3[_0xcf9f('0x40')],_0x1abc0d[_0xcf9f('0x4a')],md5(_0x1abc0d['uniqueid']));if(_0x443f50&&_0x443f50[_0xcf9f('0x4b')]){logger[_0xcf9f('0xe')](_0xcf9f('0x4c'),_0xcf9f('0x4d'));_0x1abc0d[_0xcf9f('0x4e')]=_0xeadc8e;}else if(_0xfec413&&_0xfec413[_0xcf9f('0x4f')]&&_0xfec413['recordingFormat']!==_0xcf9f('0x50')){logger[_0xcf9f('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1abc0d[_0xcf9f('0x4e')]=_0xeadc8e;}else{_0x1abc0d[_0xcf9f('0x4e')]='';}return getAdminId(_0x57e862,_0x3e89b1,_0x384d7a,_0x277ad6)['then'](getUser(_0x3e89b1,_0x384d7a,_0x277ad6))[_0xcf9f('0x10')](getEndUser(_0x3e89b1,_0x384d7a,_0x277ad6))[_0xcf9f('0x10')](getTicket(_0x3e89b1,_0x384d7a,_0x277ad6,_0x3e0f19,_0x1abc0d))[_0xcf9f('0x10')](function(_0x508613){logger[_0xcf9f('0xe')](util[_0xcf9f('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x508613[_0xcf9f('0x38')]));if(_0x3e89b1!==_0xcf9f('0x48')){logger[_0xcf9f('0xe')]('['+[_0x3e89b1[_0xcf9f('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x277ad6,_0x58685f[_0xcf9f('0x51')],_0x508613['endUserId']);}})['catch'](function(_0x2de847){logger[_0xcf9f('0x17')]('['+[_0x3e89b1[_0xcf9f('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x2de847,{'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 c772404..ab34a29 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 _0xd082=['vtiger','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','desk','dynamics365','servicenow','exec','data1','toLowerCase','Configurations','queue','routeId','log','EVENT\x20UNKNOWN','zendesk','zoho'];(function(_0x296db4,_0x3244dc){var _0x44e41c=function(_0x3c2119){while(--_0x3c2119){_0x296db4['push'](_0x296db4['shift']());}};_0x44e41c(++_0x3244dc);}(_0xd082,0x197));var _0x2d08=function(_0x2ff0d8,_0x994196){_0x2ff0d8=_0x2ff0d8-0x0;var _0x2b83fe=_0xd082[_0x2ff0d8];return _0x2b83fe;};'use strict';var _=require(_0x2d08('0x0'));var util=require(_0x2d08('0x1'));var zendesk=require(_0x2d08('0x2'));var salesforce=require(_0x2d08('0x3'));var sugarcrm=require(_0x2d08('0x4'));var freshdesk=require(_0x2d08('0x5'));var zoho=require(_0x2d08('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x2d08('0x7'));var dynamics365=require(_0x2d08('0x8'));var freshsales=require(_0x2d08('0x9'));var integrations=['zendesk','salesforce',_0x2d08('0xa'),_0x2d08('0xb'),'zoho',_0x2d08('0xc'),'vtiger',_0x2d08('0xd'),'freshsales',_0x2d08('0xe')];exports[_0x2d08('0xf')]=function(_0x1ca06a,_0x34878d,_0x2532e2,_0x277fee,_0x267347,_0xdd245c){if(_0x2532e2){if(_['includes'](integrations,_0x1ca06a[_0x2d08('0x10')][_0x2d08('0x11')]())){try{var _0x119d96=null;var _0x89c9ba='';var _0x193093=_0x2532e2[_0x1ca06a[_0x2d08('0x10')][_0x2d08('0x11')]()];if(_0x193093){var _0x585e44=_0x193093[_0x1ca06a['data2']];if(_0x585e44){var _0x1dfe94=_['find'](_0x585e44[_0x2d08('0x12')],{'id':parseInt(_0x1ca06a['data3'],0xa)});if(_0x1dfe94){if(_0x277fee){if(_0x267347&&_0x34878d[_0x2d08('0x13')]){_0x89c9ba=_0x2d08('0x13');}else if(_0x34878d[_0x2d08('0x14')]){_0x89c9ba='outbound';}else{console[_0x2d08('0x15')](_0x2d08('0x16'),_0x34878d);}}else{_0x89c9ba='unmanaged';}switch(_0x1ca06a[_0x2d08('0x10')][_0x2d08('0x11')]()){case _0x2d08('0x17'):zendesk[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case'salesforce':salesforce[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case _0x2d08('0xa'):sugarcrm[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case'freshdesk':freshdesk[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case _0x2d08('0x18'):zoho[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case _0x2d08('0xc'):desk[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case _0x2d08('0x19'):vtiger[_0x89c9ba](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c);break;case _0x2d08('0x1a'):freshsales['cs'](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c,_0x89c9ba);break;case _0x2d08('0xe'):servicenow['cs'](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c,_0x89c9ba);break;case'dynamics365':dynamics365['cs'](_0x1ca06a,_0x34878d,_0x1dfe94,_0x277fee,_0x267347,_0x585e44,_0xdd245c,_0x89c9ba);break;default:console[_0x2d08('0x15')](_0x2d08('0x1b'));}}else{_0x119d96=require(_0x2d08('0x1c'))(_0x1ca06a['data1'][_0x2d08('0x11')]());_0x119d96[_0x2d08('0x1d')](_0x2d08('0x1e'),util['format'](_0x2d08('0x1f'),_0x1ca06a[_0x2d08('0x10')]['toLowerCase'](),_0x1ca06a[_0x2d08('0x20')]));}}else{_0x119d96=require(_0x2d08('0x1c'))(_0x1ca06a['data1'][_0x2d08('0x11')]());_0x119d96['error'](_0x2d08('0x1e'),util[_0x2d08('0x21')](_0x2d08('0x22'),_0x1ca06a[_0x2d08('0x10')]['toLowerCase'](),_0x1ca06a[_0x2d08('0x23')]));}}else{}}catch(_0x578ce3){console['error'](_0x578ce3);}}}}; \ No newline at end of file +var _0x7b73=['./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','desk','servicenow','unknown\x20integration','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho'];(function(_0x1f4202,_0x5350da){var _0x47bb0d=function(_0x3052e9){while(--_0x3052e9){_0x1f4202['push'](_0x1f4202['shift']());}};_0x47bb0d(++_0x5350da);}(_0x7b73,0x1e8));var _0x37b7=function(_0x4afdbe,_0x478132){_0x4afdbe=_0x4afdbe-0x0;var _0x434c4a=_0x7b73[_0x4afdbe];return _0x434c4a;};'use strict';var _=require(_0x37b7('0x0'));var util=require('util');var zendesk=require(_0x37b7('0x1'));var salesforce=require(_0x37b7('0x2'));var sugarcrm=require(_0x37b7('0x3'));var freshdesk=require(_0x37b7('0x4'));var zoho=require(_0x37b7('0x5'));var desk=require(_0x37b7('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x37b7('0x7'));var dynamics365=require(_0x37b7('0x8'));var freshsales=require(_0x37b7('0x9'));var integrations=[_0x37b7('0xa'),_0x37b7('0xb'),_0x37b7('0xc'),_0x37b7('0xd'),_0x37b7('0xe'),'desk',_0x37b7('0xf'),_0x37b7('0x10'),_0x37b7('0x11'),'servicenow'];exports[_0x37b7('0x12')]=function(_0x1efd4a,_0x229050,_0x1fe2d0,_0x24eba4,_0x4681d8,_0x421f1e){if(_0x1fe2d0){if(_['includes'](integrations,_0x1efd4a[_0x37b7('0x13')][_0x37b7('0x14')]())){try{var _0x134d1d=null;var _0x4edb2c='';var _0x45bf4f=_0x1fe2d0[_0x1efd4a[_0x37b7('0x13')][_0x37b7('0x14')]()];if(_0x45bf4f){var _0x58a24e=_0x45bf4f[_0x1efd4a[_0x37b7('0x15')]];if(_0x58a24e){var _0x3c344a=_[_0x37b7('0x16')](_0x58a24e['Configurations'],{'id':parseInt(_0x1efd4a[_0x37b7('0x17')],0xa)});if(_0x3c344a){if(_0x24eba4){if(_0x4681d8&&_0x229050[_0x37b7('0x18')]){_0x4edb2c='queue';}else if(_0x229050[_0x37b7('0x19')]){_0x4edb2c='outbound';}else{console[_0x37b7('0x1a')](_0x37b7('0x1b'),_0x229050);}}else{_0x4edb2c=_0x37b7('0x1c');}switch(_0x1efd4a[_0x37b7('0x13')][_0x37b7('0x14')]()){case'zendesk':zendesk[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0xb'):salesforce[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0xc'):sugarcrm[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0xd'):freshdesk[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0xe'):zoho[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0x1d'):desk[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case'vtiger':vtiger[_0x4edb2c](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e);break;case _0x37b7('0x11'):freshsales['cs'](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e,_0x4edb2c);break;case _0x37b7('0x1e'):servicenow['cs'](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e,_0x4edb2c);break;case _0x37b7('0x10'):dynamics365['cs'](_0x1efd4a,_0x229050,_0x3c344a,_0x24eba4,_0x4681d8,_0x58a24e,_0x421f1e,_0x4edb2c);break;default:console[_0x37b7('0x1a')](_0x37b7('0x1f'));}}else{_0x134d1d=require(_0x37b7('0x20'))(_0x1efd4a[_0x37b7('0x13')][_0x37b7('0x14')]());_0x134d1d[_0x37b7('0x21')]('[EXEC]',util['format'](_0x37b7('0x22'),_0x1efd4a[_0x37b7('0x13')]['toLowerCase'](),_0x1efd4a[_0x37b7('0x17')]));}}else{_0x134d1d=require('../../../../config/logger')(_0x1efd4a['data1'][_0x37b7('0x14')]());_0x134d1d[_0x37b7('0x21')](_0x37b7('0x23'),util[_0x37b7('0x24')](_0x37b7('0x25'),_0x1efd4a[_0x37b7('0x13')][_0x37b7('0x14')](),_0x1efd4a[_0x37b7('0x15')]));}}else{}}catch(_0xe734ea){console[_0x37b7('0x21')](_0xe734ea);}}}}; \ 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 48de08e..743355d 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 _0xdeb3=['error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','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','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xdeb3,0x94));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3deb('0x0'));var rp=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var md5=require(_0x3deb('0x4'));var jsforce=require(_0x3deb('0x5'));var util=require(_0x3deb('0x6'));var Redis=require(_0x3deb('0x7'));var intUtil=require(_0x3deb('0x8'));var config=require('../../../../config/environment');var logger=require(_0x3deb('0x9'))(_0x3deb('0xa'));config[_0x3deb('0xb')]=_[_0x3deb('0xc')](config[_0x3deb('0xb')],{'host':_0x3deb('0xd'),'port':0x18eb});var io=require(_0x3deb('0xe'))(new Redis(config['redis']));function emit(_0x5333ce,_0x338ac2,_0x1779bc){io['to'](_0x5333ce)[_0x3deb('0xf')](_0x338ac2,_0x1779bc);}function getTicket(_0x25fb94,_0x39a754,_0x427fbe,_0x33c479,_0x36e4d3,_0x4935ea,_0xadfd8e,_0x4e9f84){var _0x407403=Object['assign']({},{'OwnerId':_0x39a754['id'],'Subject':intUtil[_0x3deb('0x10')](_0x33c479[_0x3deb('0x11')],_0x36e4d3,'\x20'),'Description':intUtil[_0x3deb('0x10')](_0x33c479[_0x3deb('0x12')],_0x36e4d3,'\x0a')},getCustomFields(_0x4935ea,_0x36e4d3));if(_0x427fbe){if(_0x33c479[_0x3deb('0x13')]==='Task'){_0x407403[_0x3deb('0x14')]=moment[_0x3deb('0x15')]();_0x407403[_0x3deb('0x16')]=![];_0x407403[_0x3deb('0x17')]=![];if(_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x19')||_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x1a')){_0x407403[_0x3deb('0x1b')]=_0x427fbe['id'];}else if(_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x1c')){_0x407403[_0x3deb('0x1d')]=_0x427fbe['id'];}}else if(_0x33c479['ticketType']===_0x3deb('0x1e')){if(_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x19')){_0x407403[_0x3deb('0x1f')]=_0x427fbe['id'];}else if(_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x1c')){_0x407403[_0x3deb('0x20')]=_0x427fbe['id'];}else if(_0x427fbe[_0x3deb('0x18')]===_0x3deb('0x1a')&&_0x33c479[_0x3deb('0x21')]){_0x407403[_0x33c479[_0x3deb('0x21')]]=_0x427fbe['id'];}else{logger['info'](_0x3deb('0x22'));}}}return _0xadfd8e[_0x3deb('0x23')](_0x33c479[_0x3deb('0x13')])[_0x3deb('0x24')](_0x407403);}function getUser(_0x17aa8d,_0x32cb95,_0x78c50a){if(!_['isNil'](_0x32cb95)&&intUtil[_0x3deb('0x25')](_0x32cb95)){var _0x531964={'Email':_0x32cb95};var _0x393aff={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x78c50a[_0x3deb('0x23')](_0x3deb('0x26'))[_0x3deb('0x27')](_0x531964,_0x393aff)[_0x3deb('0x28')]()[_0x3deb('0x29')](function(_0x496183){if(_0x496183[_0x3deb('0x2a')]){var _0x46aed5=_['find'](_0x496183,function(_0x13b7a3){return _0x13b7a3[_0x3deb('0x2b')]===_0x32cb95;});if(_0x46aed5){logger[_0x3deb('0x2c')](_0x3deb('0x2d'),_0x32cb95);return BPromise[_0x3deb('0x2e')]({'id':_0x46aed5['Id'],'name':_0x46aed5[_0x3deb('0x2f')]});}}else{logger[_0x3deb('0x2c')](_0x3deb('0x30'),_0x32cb95);return _0x78c50a[_0x3deb('0x31')]()[_0x3deb('0x29')](function(_0xa4602b){return BPromise[_0x3deb('0x2e')]({'id':_0xa4602b['user_id'],'name':_0xa4602b[_0x3deb('0x32')]});});}});}else{logger[_0x3deb('0x2c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x32cb95);return _0x78c50a[_0x3deb('0x31')]()[_0x3deb('0x29')](function(_0x2b7b05){return BPromise[_0x3deb('0x2e')]({'id':_0x2b7b05[_0x3deb('0x33')],'name':_0x2b7b05[_0x3deb('0x32')]});});}}function getEndUser(_0x8fd154,_0x37b473,_0x218db4,_0x108c39,_0x419e3d){var _0x20a129={'$or':{'Phone':_0x108c39}};var _0xee3ce5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3deb('0x2e')]()[_0x3deb('0x29')](function(){logger[_0x3deb('0x2c')](_0x3deb('0x34'),_0x108c39,_0x37b473[_0x3deb('0x35')]);switch(_0x37b473[_0x3deb('0x35')]){case _0x3deb('0x36'):var _0x4cbe16=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473[_0x3deb('0x38')]){var _0x351c62={};_0x351c62[_0x37b473[_0x3deb('0x38')]]=_0x108c39;_[_0x3deb('0x39')](_0x4cbe16[_0x3deb('0x3a')],_0x351c62);}return _0x419e3d['sobject']('Contact')[_0x3deb('0x27')](_0x4cbe16,_0xee3ce5)[_0x3deb('0x28')]()[_0x3deb('0x29')](function(_0x393442){if(_0x393442&&_0x393442[_0x3deb('0x2a')]){return _0x393442;}else{var _0x17bc90=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473[_0x3deb('0x3b')]){var _0x104bb8={};_0x104bb8[_0x37b473['additionalSearchLead']]=_0x108c39;_['merge'](_0x17bc90[_0x3deb('0x3a')],_0x104bb8);}return _0x419e3d[_0x3deb('0x23')](_0x3deb('0x3c'))[_0x3deb('0x27')](_0x17bc90,_0xee3ce5);}});case _0x3deb('0x3d'):var _0x433995=_['cloneDeep'](_0x20a129);if(_0x37b473['additionalSearchAccount']){var _0x351c62={};_0x351c62[_0x37b473[_0x3deb('0x3e')]]=_0x108c39;_[_0x3deb('0x39')](_0x433995[_0x3deb('0x3a')],_0x351c62);}return _0x419e3d['sobject'](_0x3deb('0x3f'))[_0x3deb('0x27')](_0x433995,_0xee3ce5)[_0x3deb('0x28')]()['then'](function(_0x34ee30){if(_0x34ee30&&_0x34ee30['length']){return _0x34ee30;}else{var _0x3331b2=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473['additionalSearchContact']){var _0x206f0a={};_0x206f0a[_0x37b473[_0x3deb('0x38')]]=_0x108c39;_[_0x3deb('0x39')](_0x3331b2[_0x3deb('0x3a')],_0x206f0a);}return _0x419e3d[_0x3deb('0x23')](_0x3deb('0x40'))['find'](_0x3331b2,_0xee3ce5)[_0x3deb('0x29')](function(_0xfea30f){if(_0xfea30f&&_0xfea30f[_0x3deb('0x2a')]){return _0xfea30f;}else{var _0x3d4c90=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473[_0x3deb('0x3b')]){var _0x3925eb={};_0x3925eb[_0x37b473[_0x3deb('0x3b')]]=_0x108c39;_[_0x3deb('0x39')](_0x3d4c90[_0x3deb('0x3a')],_0x3925eb);}return _0x419e3d[_0x3deb('0x23')](_0x3deb('0x3c'))[_0x3deb('0x27')](_0x3d4c90,_0xee3ce5);}});}});case'contact':var _0x4cbe16=_['cloneDeep'](_0x20a129);if(_0x37b473[_0x3deb('0x38')]){var _0x351c62={};_0x351c62[_0x37b473['additionalSearchContact']]=_0x108c39;_[_0x3deb('0x39')](_0x4cbe16[_0x3deb('0x3a')],_0x351c62);}return _0x419e3d[_0x3deb('0x23')]('Contact')[_0x3deb('0x27')](_0x4cbe16,_0xee3ce5)[_0x3deb('0x28')]();case _0x3deb('0x1a'):var _0x16cb0e=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473['additionalSearchLead']){var _0x351c62={};_0x351c62[_0x37b473[_0x3deb('0x3b')]]=_0x108c39;_[_0x3deb('0x39')](_0x16cb0e['$or'],_0x351c62);}return _0x419e3d[_0x3deb('0x23')](_0x3deb('0x3c'))[_0x3deb('0x27')](_0x16cb0e,_0xee3ce5);case _0x3deb('0x1c'):var _0x433995=_[_0x3deb('0x37')](_0x20a129);if(_0x37b473[_0x3deb('0x3e')]){var _0x351c62={};_0x351c62[_0x37b473[_0x3deb('0x3e')]]=_0x108c39;_[_0x3deb('0x39')](_0x433995['$or'],_0x351c62);}return _0x419e3d[_0x3deb('0x23')](_0x3deb('0x3f'))[_0x3deb('0x27')](_0x433995,_0xee3ce5);default:return null;}})[_0x3deb('0x29')](function(_0x3a11a5){if(_0x3a11a5&&_0x3a11a5[_0x3deb('0x2a')]){var _0x4143ec=_[_0x3deb('0x41')](_0x3a11a5);if(_0x4143ec){return BPromise['resolve']({'id':_0x4143ec['Id'],'name':_0x4143ec[_0x3deb('0x2f')],'phone':_0x4143ec['Phone'],'endUserType':_0x4143ec['attributes'][_0x3deb('0x42')][_0x3deb('0x43')]()});}}})[_0x3deb('0x29')](function(_0x248271){if(_0x248271){logger['info'](_0x3deb('0x44'),_0x248271[_0x3deb('0x18')],_0x108c39);return BPromise[_0x3deb('0x2e')](_0x248271);}else{logger[_0x3deb('0x2c')](_0x3deb('0x45'),_0x108c39);var _0x5859ba={'Phone':_0x108c39};if(_0x37b473[_0x3deb('0x46')]){if(_0x37b473[_0x3deb('0x46')]==='contact'){logger[_0x3deb('0x2c')](_0x3deb('0x47'),_0x108c39,_0x37b473[_0x3deb('0x46')]);_0x5859ba[_0x3deb('0x48')]=_0x218db4!==_0x3deb('0x49')?_0x218db4:util[_0x3deb('0x4a')](_0x3deb('0x4b'),_0x108c39);}else if(_0x37b473['moduleCreate']===_0x3deb('0x1a')){logger[_0x3deb('0x2c')](_0x3deb('0x47'),_0x108c39,_0x37b473[_0x3deb('0x46')]);_0x5859ba[_0x3deb('0x48')]=_0x218db4!==''?_0x218db4:util[_0x3deb('0x4a')](_0x3deb('0x4b'),_0x108c39);_0x5859ba[_0x3deb('0x4c')]='No\x20Company';}else if(_0x37b473[_0x3deb('0x46')]===_0x3deb('0x1c')){logger[_0x3deb('0x2c')](_0x3deb('0x47'),_0x108c39,_0x37b473[_0x3deb('0x46')]);_0x5859ba[_0x3deb('0x2f')]=_0x218db4!==_0x3deb('0x49')?_0x218db4:util[_0x3deb('0x4a')](_0x3deb('0x4b'),_0x108c39);}else{return null;}}return _0x419e3d[_0x3deb('0x23')](_[_0x3deb('0x4d')](_0x37b473[_0x3deb('0x46')]))[_0x3deb('0x24')](_0x5859ba)[_0x3deb('0x29')](function(_0x52bf96){return BPromise['resolve']({'id':_0x52bf96['id'],'endUserType':_0x37b473[_0x3deb('0x46')]});});}});}function getCustomFields(_0x61e79b,_0x46fe80){var _0x28ede9={};if(_0x61e79b['length']>0x0){_[_0x3deb('0x4e')](_0x61e79b,function(_0x4d08f4){if(_[_0x3deb('0x4f')]([_0x3deb('0x50'),'picklist'],_0x4d08f4[_0x3deb('0x42')])&&_0x4d08f4[_0x3deb('0x51')]){_0x28ede9[_0x4d08f4[_0x3deb('0x51')]]=_0x4d08f4[_0x3deb('0x52')][_0x3deb('0x53')]();}else if(_0x4d08f4[_0x3deb('0x42')]===_0x3deb('0x54')&&_0x4d08f4[_0x3deb('0x55')]&&_0x4d08f4[_0x3deb('0x51')]){_0x46fe80[_0x4d08f4[_0x3deb('0x55')]]&&(_0x28ede9[_0x4d08f4[_0x3deb('0x51')]]=_0x46fe80[_0x4d08f4['variableName']][_0x3deb('0x53')]());}else if(_0x4d08f4[_0x3deb('0x42')]===_0x3deb('0x56')&&_0x4d08f4[_0x3deb('0x57')]&&_0x4d08f4[_0x3deb('0x57')][_0x3deb('0x58')]&&_0x4d08f4['idField']){_0x46fe80[_0x4d08f4[_0x3deb('0x57')][_0x3deb('0x58')][_0x3deb('0x43')]()]&&(_0x28ede9[_0x4d08f4[_0x3deb('0x51')]]=_0x46fe80[_0x4d08f4[_0x3deb('0x57')][_0x3deb('0x58')][_0x3deb('0x43')]()]['toString']());}});}return _0x28ede9;}function getConnection(_0xd6c544){var _0x15e6c5=_0xd6c544[_0x3deb('0x59')][_0x3deb('0x5a')](_0xd6c544[_0x3deb('0x5b')]);var _0x5ce88e=new jsforce[(_0x3deb('0x5c'))]({'oauth2':{'loginUrl':_0xd6c544[_0x3deb('0x5d')]||'https://login.salesforce.com','clientId':_0xd6c544['clientId'],'clientSecret':_0xd6c544['clientSecret']}});return _0x5ce88e['login'](_0xd6c544['username'],_0x15e6c5)[_0x3deb('0x29')](function(){logger[_0x3deb('0x2c')](_0x3deb('0x5e'));return _0x5ce88e;});}exports[_0x3deb('0x5f')]=function(_0x2380a8,_0x262349,_0x375efa,_0x5df6cf,_0x49125e,_0x214bc3){var _0x4fb623,_0x2df936,_0x23c0d2,_0xcf775e;_0x214bc3[_0x3deb('0x60')]=intUtil[_0x3deb('0x61')](_0x214bc3['serverUrl']);_0x214bc3[_0x3deb('0x5d')]=intUtil[_0x3deb('0x61')](_0x214bc3[_0x3deb('0x5d')]);if(_0x49125e&&_0x49125e[_0x3deb('0x62')]){logger['info'](_0x3deb('0x63'),_0x3deb('0x64'));_0x262349[_0x3deb('0x65')]=util[_0x3deb('0x4a')](_0x3deb('0x66'),_0x214bc3[_0x3deb('0x60')],_0x262349['uniqueid'],md5(_0x262349[_0x3deb('0x67')]));}else{_0x262349['recordingURL']='';}return getConnection(_0x214bc3)[_0x3deb('0x29')](function(_0x48eefa){_0xcf775e=_0x48eefa;return getUser(_0x214bc3,_0x5df6cf[_0x3deb('0x68')],_0xcf775e);})['then'](function(_0x3d5aa8){_0x4fb623=_0x3d5aa8;return getEndUser(_0x214bc3,_0x375efa,_0x262349[_0x3deb('0x69')],_0x262349[_0x3deb('0x6a')],_0xcf775e);})['then'](function(_0x1fac03){_0x2df936=_0x1fac03;return getTicket(_0x214bc3,_0x4fb623,_0x2df936,_0x375efa,_0x262349,_0x375efa[_0x3deb('0x6b')],_0xcf775e,_0x3deb('0x5f'));})['then'](function(_0xa946){_0x23c0d2=_0xa946;logger[_0x3deb('0x2c')](_0x3deb('0x6c'),_0x23c0d2['id']);logger[_0x3deb('0x2c')](_0x3deb('0x6d'),_0x23c0d2['id'],_0x5df6cf['name'],_0x214bc3[_0x3deb('0x42')]);switch(_0x214bc3['type']){case'integrationTab':emit(util[_0x3deb('0x4a')](_0x3deb('0x6e'),_0x5df6cf[_0x3deb('0x58')]),_0x3deb('0x6f'),{'recordId':_0x23c0d2['id']});break;case _0x3deb('0x70'):emit(util[_0x3deb('0x4a')](_0x3deb('0x6e'),_0x5df6cf[_0x3deb('0x58')]),_0x3deb('0x71'),{'uri':util[_0x3deb('0x4a')]('%s/%s/e',_0xcf775e['instanceUrl'],_0x23c0d2['id'])});break;default:logger[_0x3deb('0x72')](_0x3deb('0x73'));}})[_0x3deb('0x74')](function(_0xe4d960){logger[_0x3deb('0x72')]('[QUEUE]',_0xe4d960);});};exports['outbound']=function(_0x1e3259,_0x2e3659,_0x3ce885,_0x5363c8,_0xc2d8d9,_0x50941e,_0x14630c){var _0x198c5d,_0x1b5c93,_0x377110,_0x21d2cf;_0x50941e['serverUrl']=intUtil['stripTrailingSlash'](_0x50941e['serverUrl']);_0x50941e[_0x3deb('0x5d')]=intUtil['stripTrailingSlash'](_0x50941e['remoteUri']);if(_0x14630c&&_0x14630c['recordingFormat']&&_0x14630c['recordingFormat']!==_0x3deb('0x75')){logger[_0x3deb('0x2c')](_0x3deb('0x76'),_0x3deb('0x64'));_0x2e3659['recordingURL']=util[_0x3deb('0x4a')](_0x3deb('0x66'),_0x50941e[_0x3deb('0x60')],_0x2e3659[_0x3deb('0x67')],md5(_0x2e3659[_0x3deb('0x67')]));}return getConnection(_0x50941e)[_0x3deb('0x29')](function(_0x32dc25){_0x21d2cf=_0x32dc25;return getUser(_0x50941e,_0x5363c8[_0x3deb('0x68')],_0x21d2cf);})[_0x3deb('0x29')](function(_0x2fd4ba){_0x198c5d=_0x2fd4ba;return getEndUser(_0x50941e,_0x3ce885,_0x2e3659['destcalleridname'],_0x2e3659[_0x3deb('0x77')],_0x21d2cf);})[_0x3deb('0x29')](function(_0x3823fb){_0x1b5c93=_0x3823fb;return getTicket(_0x50941e,_0x198c5d,_0x1b5c93,_0x3ce885,_0x2e3659,_0x3ce885[_0x3deb('0x6b')],_0x21d2cf,'outbound');})[_0x3deb('0x29')](function(_0x2e2648){_0x377110=_0x2e2648;logger[_0x3deb('0x2c')](_0x3deb('0x78'),_0x377110['id']);logger[_0x3deb('0x2c')](_0x3deb('0x79'),_0x377110['id'],_0x5363c8[_0x3deb('0x58')],_0x50941e['type']);switch(_0x50941e[_0x3deb('0x42')]){case _0x3deb('0x7a'):emit(util[_0x3deb('0x4a')]('user:%s',_0x5363c8[_0x3deb('0x58')]),_0x3deb('0x6f'),{'recordId':_0x377110['id']});break;case _0x3deb('0x70'):emit(util['format']('user:%s',_0x5363c8[_0x3deb('0x58')]),_0x3deb('0x71'),{'uri':util[_0x3deb('0x4a')](_0x3deb('0x7b'),_0x21d2cf[_0x3deb('0x7c')],_0x377110['id'])});break;default:logger[_0x3deb('0x72')](_0x3deb('0x76'),_0x3deb('0x7d'));}})[_0x3deb('0x74')](function(_0x1cb4dd){logger['error'](_0x3deb('0x76'),_0x1cb4dd);});};exports['unmanaged']=function(_0x4f1891,_0x4a2dad,_0x52c29f,_0x94d28b,_0x82b295,_0x46e6d4){var _0x2f47bb,_0x4d3203,_0x48f14c,_0x2c9699;_0x46e6d4[_0x3deb('0x60')]=intUtil[_0x3deb('0x61')](_0x46e6d4[_0x3deb('0x60')]);_0x46e6d4['remoteUri']=intUtil[_0x3deb('0x61')](_0x46e6d4[_0x3deb('0x5d')]);if(_0x82b295&&_0x82b295['monitor_format']){logger[_0x3deb('0x2c')]('['+_0x4a2dad[_0x3deb('0x7e')][_0x3deb('0x7f')]()+']',_0x3deb('0x64'));_0x4a2dad['recordingURL']=util[_0x3deb('0x4a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46e6d4[_0x3deb('0x60')],_0x4a2dad[_0x3deb('0x67')],md5(_0x4a2dad[_0x3deb('0x67')]));}else{_0x4a2dad[_0x3deb('0x65')]='';}return getConnection(_0x46e6d4)['then'](function(_0x4366a9){_0x2c9699=_0x4366a9;if(!_[_0x3deb('0x80')](_0x94d28b)){return getUser(_0x46e6d4,_0x94d28b[_0x3deb('0x58')],_0x2c9699);}else{return getUser(_0x46e6d4,null,_0x2c9699);}})[_0x3deb('0x29')](function(_0x178f56){_0x2f47bb=_0x178f56;return getEndUser(_0x46e6d4,_0x52c29f,_0x4a2dad['calleridname'],_0x4a2dad[_0x3deb('0x6a')],_0x2c9699);})[_0x3deb('0x29')](function(_0x4f071e){_0x4d3203=_0x4f071e;return getTicket(_0x46e6d4,_0x2f47bb,_0x4d3203,_0x52c29f,_0x4a2dad,_0x52c29f[_0x3deb('0x6b')],_0x2c9699);})[_0x3deb('0x29')](function(_0x16b6ea){_0x48f14c=_0x16b6ea;logger[_0x3deb('0x2c')]('['+_0x4a2dad[_0x3deb('0x7e')][_0x3deb('0x7f')]()+_0x3deb('0x81'),_0x48f14c['id']);logger[_0x3deb('0x2c')]('['+_0x4a2dad['lastevent'][_0x3deb('0x7f')]()+_0x3deb('0x82'),_0x46e6d4['type']);})[_0x3deb('0x74')](function(_0x2b95bb){logger['error']('['+_0x4a2dad[_0x3deb('0x7e')][_0x3deb('0x7f')]()+']',_0x2b95bb);});}; \ No newline at end of file +var _0x0117=[']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','redis','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','User','execute','find','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Name','Phone','attributes','type','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase'];(function(_0x4f229e,_0x1b1e6c){var _0x407c5e=function(_0x1f094f){while(--_0x1f094f){_0x4f229e['push'](_0x4f229e['shift']());}};_0x407c5e(++_0x1b1e6c);}(_0x0117,0x178));var _0x7011=function(_0x16cfff,_0x3fc70c){_0x16cfff=_0x16cfff-0x0;var _0x127aa2=_0x0117[_0x16cfff];return _0x127aa2;};'use strict';var _=require(_0x7011('0x0'));var rp=require(_0x7011('0x1'));var moment=require(_0x7011('0x2'));var BPromise=require(_0x7011('0x3'));var md5=require(_0x7011('0x4'));var jsforce=require('jsforce');var util=require(_0x7011('0x5'));var Redis=require(_0x7011('0x6'));var intUtil=require(_0x7011('0x7'));var config=require(_0x7011('0x8'));var logger=require(_0x7011('0x9'))(_0x7011('0xa'));config['redis']=_[_0x7011('0xb')](config['redis'],{'host':_0x7011('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7011('0xd')]));function emit(_0x5bfb37,_0x37c6f5,_0x28ecbd){io['to'](_0x5bfb37)[_0x7011('0xe')](_0x37c6f5,_0x28ecbd);}function getTicket(_0x2090fe,_0x51e734,_0x59c74d,_0x57936f,_0x1792c8,_0x5483e7,_0x36481a,_0xe45750){var _0x293038=Object[_0x7011('0xf')]({},{'OwnerId':_0x51e734['id'],'Subject':intUtil['getString'](_0x57936f[_0x7011('0x10')],_0x1792c8,'\x20'),'Description':intUtil['getString'](_0x57936f[_0x7011('0x11')],_0x1792c8,'\x0a')},getCustomFields(_0x5483e7,_0x1792c8));if(_0x59c74d){if(_0x57936f[_0x7011('0x12')]===_0x7011('0x13')){_0x293038[_0x7011('0x14')]=moment['utc']();_0x293038[_0x7011('0x15')]=![];_0x293038[_0x7011('0x16')]=![];if(_0x59c74d[_0x7011('0x17')]===_0x7011('0x18')||_0x59c74d[_0x7011('0x17')]===_0x7011('0x19')){_0x293038[_0x7011('0x1a')]=_0x59c74d['id'];}else if(_0x59c74d[_0x7011('0x17')]===_0x7011('0x1b')){_0x293038[_0x7011('0x1c')]=_0x59c74d['id'];}}else if(_0x57936f[_0x7011('0x12')]==='Case'){if(_0x59c74d[_0x7011('0x17')]==='contact'){_0x293038[_0x7011('0x1d')]=_0x59c74d['id'];}else if(_0x59c74d[_0x7011('0x17')]===_0x7011('0x1b')){_0x293038[_0x7011('0x1e')]=_0x59c74d['id'];}else if(_0x59c74d[_0x7011('0x17')]==='lead'&&_0x57936f[_0x7011('0x1f')]){_0x293038[_0x57936f[_0x7011('0x1f')]]=_0x59c74d['id'];}else{logger[_0x7011('0x20')](_0x7011('0x21'));}}}return _0x36481a['sobject'](_0x57936f[_0x7011('0x12')])[_0x7011('0x22')](_0x293038);}function getUser(_0x126dea,_0x502a8f,_0x17ba3b){if(!_[_0x7011('0x23')](_0x502a8f)&&intUtil['validateEmail'](_0x502a8f)){var _0xbedb0b={'Email':_0x502a8f};var _0x189180={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x17ba3b[_0x7011('0x24')](_0x7011('0x25'))['find'](_0xbedb0b,_0x189180)[_0x7011('0x26')]()['then'](function(_0x15f45c){if(_0x15f45c['length']){var _0x477a4a=_[_0x7011('0x27')](_0x15f45c,function(_0x60867e){return _0x60867e[_0x7011('0x28')]===_0x502a8f;});if(_0x477a4a){logger['info']('Agent\x20%s\x20found.',_0x502a8f);return BPromise[_0x7011('0x29')]({'id':_0x477a4a['Id'],'name':_0x477a4a['Name']});}}else{logger[_0x7011('0x20')](_0x7011('0x2a'),_0x502a8f);return _0x17ba3b[_0x7011('0x2b')]()[_0x7011('0x2c')](function(_0x49a477){return BPromise[_0x7011('0x29')]({'id':_0x49a477[_0x7011('0x2d')],'name':_0x49a477[_0x7011('0x2e')]});});}});}else{logger[_0x7011('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x502a8f);return _0x17ba3b['identity']()['then'](function(_0x4339e4){return BPromise[_0x7011('0x29')]({'id':_0x4339e4[_0x7011('0x2d')],'name':_0x4339e4[_0x7011('0x2e')]});});}}function getEndUser(_0x32982a,_0x21fd36,_0x51816a,_0x16472e,_0x4000c5){var _0x5e6702={'$or':{'Phone':_0x16472e}};var _0xfe3fc5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7011('0x29')]()[_0x7011('0x2c')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x16472e,_0x21fd36['moduleSearch']);switch(_0x21fd36[_0x7011('0x2f')]){case'contact_lead':var _0x352a2e=_['cloneDeep'](_0x5e6702);if(_0x21fd36[_0x7011('0x30')]){var _0x402c46={};_0x402c46[_0x21fd36[_0x7011('0x30')]]=_0x16472e;_[_0x7011('0x31')](_0x352a2e['$or'],_0x402c46);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x32'))[_0x7011('0x27')](_0x352a2e,_0xfe3fc5)[_0x7011('0x26')]()[_0x7011('0x2c')](function(_0x4b311f){if(_0x4b311f&&_0x4b311f['length']){return _0x4b311f;}else{var _0x3435b2=_[_0x7011('0x33')](_0x5e6702);if(_0x21fd36['additionalSearchLead']){var _0x2b7d2c={};_0x2b7d2c[_0x21fd36[_0x7011('0x34')]]=_0x16472e;_[_0x7011('0x31')](_0x3435b2[_0x7011('0x35')],_0x2b7d2c);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x36'))[_0x7011('0x27')](_0x3435b2,_0xfe3fc5);}});case _0x7011('0x37'):var _0xea1438=_[_0x7011('0x33')](_0x5e6702);if(_0x21fd36[_0x7011('0x38')]){var _0x402c46={};_0x402c46[_0x21fd36[_0x7011('0x38')]]=_0x16472e;_[_0x7011('0x31')](_0xea1438[_0x7011('0x35')],_0x402c46);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x39'))['find'](_0xea1438,_0xfe3fc5)[_0x7011('0x26')]()[_0x7011('0x2c')](function(_0x4288ea){if(_0x4288ea&&_0x4288ea[_0x7011('0x3a')]){return _0x4288ea;}else{var _0x1d03f0=_[_0x7011('0x33')](_0x5e6702);if(_0x21fd36[_0x7011('0x30')]){var _0x25aee4={};_0x25aee4[_0x21fd36[_0x7011('0x30')]]=_0x16472e;_[_0x7011('0x31')](_0x1d03f0[_0x7011('0x35')],_0x25aee4);}return _0x4000c5[_0x7011('0x24')]('Contact')[_0x7011('0x27')](_0x1d03f0,_0xfe3fc5)[_0x7011('0x2c')](function(_0x4fcb42){if(_0x4fcb42&&_0x4fcb42['length']){return _0x4fcb42;}else{var _0x2b20a5=_['cloneDeep'](_0x5e6702);if(_0x21fd36[_0x7011('0x34')]){var _0x1f514a={};_0x1f514a[_0x21fd36[_0x7011('0x34')]]=_0x16472e;_[_0x7011('0x31')](_0x2b20a5['$or'],_0x1f514a);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x36'))[_0x7011('0x27')](_0x2b20a5,_0xfe3fc5);}});}});case _0x7011('0x18'):var _0x352a2e=_[_0x7011('0x33')](_0x5e6702);if(_0x21fd36[_0x7011('0x30')]){var _0x402c46={};_0x402c46[_0x21fd36[_0x7011('0x30')]]=_0x16472e;_[_0x7011('0x31')](_0x352a2e[_0x7011('0x35')],_0x402c46);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x32'))['find'](_0x352a2e,_0xfe3fc5)[_0x7011('0x26')]();case _0x7011('0x19'):var _0x1c7b42=_[_0x7011('0x33')](_0x5e6702);if(_0x21fd36[_0x7011('0x34')]){var _0x402c46={};_0x402c46[_0x21fd36[_0x7011('0x34')]]=_0x16472e;_[_0x7011('0x31')](_0x1c7b42[_0x7011('0x35')],_0x402c46);}return _0x4000c5['sobject']('Lead')[_0x7011('0x27')](_0x1c7b42,_0xfe3fc5);case _0x7011('0x1b'):var _0xea1438=_['cloneDeep'](_0x5e6702);if(_0x21fd36[_0x7011('0x38')]){var _0x402c46={};_0x402c46[_0x21fd36[_0x7011('0x38')]]=_0x16472e;_[_0x7011('0x31')](_0xea1438[_0x7011('0x35')],_0x402c46);}return _0x4000c5[_0x7011('0x24')](_0x7011('0x39'))[_0x7011('0x27')](_0xea1438,_0xfe3fc5);default:return null;}})['then'](function(_0x93b24a){if(_0x93b24a&&_0x93b24a[_0x7011('0x3a')]){var _0x137b1f=_[_0x7011('0x3b')](_0x93b24a);if(_0x137b1f){return BPromise[_0x7011('0x29')]({'id':_0x137b1f['Id'],'name':_0x137b1f[_0x7011('0x3c')],'phone':_0x137b1f[_0x7011('0x3d')],'endUserType':_0x137b1f[_0x7011('0x3e')][_0x7011('0x3f')]['toLowerCase']()});}}})[_0x7011('0x2c')](function(_0x5b6675){if(_0x5b6675){logger[_0x7011('0x20')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5b6675[_0x7011('0x17')],_0x16472e);return BPromise[_0x7011('0x29')](_0x5b6675);}else{logger[_0x7011('0x20')](_0x7011('0x40'),_0x16472e);var _0x32ac03={'Phone':_0x16472e};if(_0x21fd36[_0x7011('0x41')]){if(_0x21fd36[_0x7011('0x41')]===_0x7011('0x18')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x16472e,_0x21fd36[_0x7011('0x41')]);_0x32ac03[_0x7011('0x42')]=_0x51816a!==_0x7011('0x43')?_0x51816a:util[_0x7011('0x44')](_0x7011('0x45'),_0x16472e);}else if(_0x21fd36[_0x7011('0x41')]==='lead'){logger[_0x7011('0x20')](_0x7011('0x46'),_0x16472e,_0x21fd36[_0x7011('0x41')]);_0x32ac03[_0x7011('0x42')]=_0x51816a!==_0x7011('0x43')?_0x51816a:util[_0x7011('0x44')](_0x7011('0x45'),_0x16472e);_0x32ac03[_0x7011('0x47')]=_0x7011('0x48');}else if(_0x21fd36['moduleCreate']===_0x7011('0x1b')){logger[_0x7011('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x16472e,_0x21fd36['moduleCreate']);_0x32ac03[_0x7011('0x3c')]=_0x51816a!==''?_0x51816a:util[_0x7011('0x44')](_0x7011('0x45'),_0x16472e);}else{return null;}}return _0x4000c5[_0x7011('0x24')](_[_0x7011('0x49')](_0x21fd36[_0x7011('0x41')]))['create'](_0x32ac03)[_0x7011('0x2c')](function(_0x769cf4){return BPromise[_0x7011('0x29')]({'id':_0x769cf4['id'],'endUserType':_0x21fd36[_0x7011('0x41')]});});}});}function getCustomFields(_0x4b9563,_0x1acde7){var _0x1363ee={};if(_0x4b9563[_0x7011('0x3a')]>0x0){_['forEach'](_0x4b9563,function(_0x448a42){if(_[_0x7011('0x4a')]([_0x7011('0x4b'),'picklist'],_0x448a42['type'])&&_0x448a42['idField']){_0x1363ee[_0x448a42[_0x7011('0x4c')]]=_0x448a42[_0x7011('0x4d')][_0x7011('0x4e')]();}else if(_0x448a42[_0x7011('0x3f')]===_0x7011('0x4f')&&_0x448a42[_0x7011('0x50')]&&_0x448a42[_0x7011('0x4c')]){_0x1acde7[_0x448a42[_0x7011('0x50')]]&&(_0x1363ee[_0x448a42['idField']]=_0x1acde7[_0x448a42[_0x7011('0x50')]][_0x7011('0x4e')]());}else if(_0x448a42[_0x7011('0x3f')]===_0x7011('0x51')&&_0x448a42[_0x7011('0x52')]&&_0x448a42[_0x7011('0x52')]['name']&&_0x448a42['idField']){_0x1acde7[_0x448a42['Variable'][_0x7011('0x53')][_0x7011('0x54')]()]&&(_0x1363ee[_0x448a42['idField']]=_0x1acde7[_0x448a42[_0x7011('0x52')]['name'][_0x7011('0x54')]()][_0x7011('0x4e')]());}});}return _0x1363ee;}function getConnection(_0x121d50){var _0x572ab8=_0x121d50[_0x7011('0x55')][_0x7011('0x56')](_0x121d50['securityToken']);var _0xa350f8=new jsforce[(_0x7011('0x57'))]({'oauth2':{'loginUrl':_0x121d50['remoteUri']||_0x7011('0x58'),'clientId':_0x121d50['clientId'],'clientSecret':_0x121d50[_0x7011('0x59')]}});return _0xa350f8[_0x7011('0x5a')](_0x121d50[_0x7011('0x5b')],_0x572ab8)[_0x7011('0x2c')](function(){logger['info'](_0x7011('0x5c'));return _0xa350f8;});}exports[_0x7011('0x5d')]=function(_0x4c1ae1,_0xcbade6,_0x14cba1,_0x4cf0e1,_0x4b9a3b,_0x112a9f){var _0x1f6b61,_0x276b17,_0x11bdbd,_0x134abf;_0x112a9f[_0x7011('0x5e')]=intUtil[_0x7011('0x5f')](_0x112a9f[_0x7011('0x5e')]);_0x112a9f[_0x7011('0x60')]=intUtil[_0x7011('0x5f')](_0x112a9f[_0x7011('0x60')]);if(_0x4b9a3b&&_0x4b9a3b['monitor_format']){logger[_0x7011('0x20')](_0x7011('0x61'),_0x7011('0x62'));_0xcbade6[_0x7011('0x63')]=util[_0x7011('0x44')](_0x7011('0x64'),_0x112a9f[_0x7011('0x5e')],_0xcbade6[_0x7011('0x65')],md5(_0xcbade6[_0x7011('0x65')]));}else{_0xcbade6[_0x7011('0x63')]='';}return getConnection(_0x112a9f)[_0x7011('0x2c')](function(_0x28699d){_0x134abf=_0x28699d;return getUser(_0x112a9f,_0x4cf0e1[_0x7011('0x66')],_0x134abf);})[_0x7011('0x2c')](function(_0x146cd3){_0x1f6b61=_0x146cd3;return getEndUser(_0x112a9f,_0x14cba1,_0xcbade6[_0x7011('0x67')],_0xcbade6['calleridnum'],_0x134abf);})[_0x7011('0x2c')](function(_0x585194){_0x276b17=_0x585194;return getTicket(_0x112a9f,_0x1f6b61,_0x276b17,_0x14cba1,_0xcbade6,_0x14cba1[_0x7011('0x68')],_0x134abf,_0x7011('0x5d'));})[_0x7011('0x2c')](function(_0x4df039){_0x11bdbd=_0x4df039;logger['info'](_0x7011('0x69'),_0x11bdbd['id']);logger[_0x7011('0x20')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x11bdbd['id'],_0x4cf0e1[_0x7011('0x53')],_0x112a9f[_0x7011('0x3f')]);switch(_0x112a9f[_0x7011('0x3f')]){case'integrationTab':emit(util[_0x7011('0x44')](_0x7011('0x6a'),_0x4cf0e1[_0x7011('0x53')]),_0x7011('0x6b'),{'recordId':_0x11bdbd['id']});break;case'newTab':emit(util[_0x7011('0x44')]('user:%s',_0x4cf0e1[_0x7011('0x53')]),'trigger:browser:url',{'uri':util[_0x7011('0x44')](_0x7011('0x6c'),_0x134abf[_0x7011('0x6d')],_0x11bdbd['id'])});break;default:logger[_0x7011('0x6e')](_0x7011('0x6f'));}})[_0x7011('0x70')](function(_0x26033c){logger[_0x7011('0x6e')](_0x7011('0x61'),_0x26033c);});};exports[_0x7011('0x71')]=function(_0x2ec99c,_0x55c51f,_0x5b11f2,_0x3dc69d,_0x1055f3,_0x22c6e6,_0x20b17a){var _0x5aa1ef,_0x4ad34d,_0x5c55c6,_0x4c3a42;_0x22c6e6[_0x7011('0x5e')]=intUtil[_0x7011('0x5f')](_0x22c6e6[_0x7011('0x5e')]);_0x22c6e6['remoteUri']=intUtil[_0x7011('0x5f')](_0x22c6e6[_0x7011('0x60')]);if(_0x20b17a&&_0x20b17a['recordingFormat']&&_0x20b17a[_0x7011('0x72')]!==_0x7011('0x73')){logger[_0x7011('0x20')](_0x7011('0x74'),_0x7011('0x62'));_0x55c51f[_0x7011('0x63')]=util[_0x7011('0x44')](_0x7011('0x64'),_0x22c6e6[_0x7011('0x5e')],_0x55c51f[_0x7011('0x65')],md5(_0x55c51f['uniqueid']));}return getConnection(_0x22c6e6)['then'](function(_0x37639d){_0x4c3a42=_0x37639d;return getUser(_0x22c6e6,_0x3dc69d['email'],_0x4c3a42);})[_0x7011('0x2c')](function(_0x571460){_0x5aa1ef=_0x571460;return getEndUser(_0x22c6e6,_0x5b11f2,_0x55c51f[_0x7011('0x75')],_0x55c51f['destcalleridnum'],_0x4c3a42);})[_0x7011('0x2c')](function(_0x387f83){_0x4ad34d=_0x387f83;return getTicket(_0x22c6e6,_0x5aa1ef,_0x4ad34d,_0x5b11f2,_0x55c51f,_0x5b11f2[_0x7011('0x68')],_0x4c3a42,_0x7011('0x71'));})[_0x7011('0x2c')](function(_0x29fefe){_0x5c55c6=_0x29fefe;logger[_0x7011('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5c55c6['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5c55c6['id'],_0x3dc69d[_0x7011('0x53')],_0x22c6e6[_0x7011('0x3f')]);switch(_0x22c6e6[_0x7011('0x3f')]){case _0x7011('0x76'):emit(util[_0x7011('0x44')](_0x7011('0x6a'),_0x3dc69d[_0x7011('0x53')]),'trigger:salesforce:display',{'recordId':_0x5c55c6['id']});break;case _0x7011('0x77'):emit(util[_0x7011('0x44')](_0x7011('0x6a'),_0x3dc69d[_0x7011('0x53')]),'trigger:browser:url',{'uri':util['format'](_0x7011('0x6c'),_0x4c3a42[_0x7011('0x6d')],_0x5c55c6['id'])});break;default:logger[_0x7011('0x6e')](_0x7011('0x74'),_0x7011('0x78'));}})[_0x7011('0x70')](function(_0x390acd){logger[_0x7011('0x6e')](_0x7011('0x74'),_0x390acd);});};exports[_0x7011('0x79')]=function(_0x410ac6,_0x5bce42,_0x33b2c4,_0x134a9b,_0x10e89d,_0x2cc92a){var _0x249679,_0x2df8dc,_0x4b4e95,_0x1d3a1b;_0x2cc92a[_0x7011('0x5e')]=intUtil[_0x7011('0x5f')](_0x2cc92a[_0x7011('0x5e')]);_0x2cc92a[_0x7011('0x60')]=intUtil[_0x7011('0x5f')](_0x2cc92a[_0x7011('0x60')]);if(_0x10e89d&&_0x10e89d[_0x7011('0x7a')]){logger[_0x7011('0x20')]('['+_0x5bce42['lastevent'][_0x7011('0x7b')]()+']',_0x7011('0x62'));_0x5bce42[_0x7011('0x63')]=util[_0x7011('0x44')](_0x7011('0x64'),_0x2cc92a['serverUrl'],_0x5bce42['uniqueid'],md5(_0x5bce42[_0x7011('0x65')]));}else{_0x5bce42[_0x7011('0x63')]='';}return getConnection(_0x2cc92a)[_0x7011('0x2c')](function(_0x338f50){_0x1d3a1b=_0x338f50;if(!_[_0x7011('0x23')](_0x134a9b)){return getUser(_0x2cc92a,_0x134a9b[_0x7011('0x53')],_0x1d3a1b);}else{return getUser(_0x2cc92a,null,_0x1d3a1b);}})[_0x7011('0x2c')](function(_0x3f90c3){_0x249679=_0x3f90c3;return getEndUser(_0x2cc92a,_0x33b2c4,_0x5bce42[_0x7011('0x67')],_0x5bce42['calleridnum'],_0x1d3a1b);})[_0x7011('0x2c')](function(_0x3f748b){_0x2df8dc=_0x3f748b;return getTicket(_0x2cc92a,_0x249679,_0x2df8dc,_0x33b2c4,_0x5bce42,_0x33b2c4[_0x7011('0x68')],_0x1d3a1b);})[_0x7011('0x2c')](function(_0x8a34c8){_0x4b4e95=_0x8a34c8;logger[_0x7011('0x20')]('['+_0x5bce42['lastevent'][_0x7011('0x7b')]()+_0x7011('0x7c'),_0x4b4e95['id']);logger[_0x7011('0x20')]('['+_0x5bce42['lastevent'][_0x7011('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2cc92a[_0x7011('0x3f')]);})['catch'](function(_0x269c80){logger['error']('['+_0x5bce42['lastevent']['toUpperCase']()+']',_0x269c80);});}; \ 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 f9c93e1..94acde9 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 _0x6903=['],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','type','nameField','customField','toLowerCase','content','toString','string','picklist','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','getString','Subjects','Descriptions','number','label','?sysparm_query=name%3D','Incident','ticketId','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','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','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/environment','servicenow','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','],\x20getUser\x20crm','catch','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema'];(function(_0x18a772,_0x1a4d3f){var _0xbaac04=function(_0x467aa6){while(--_0x467aa6){_0x18a772['push'](_0x18a772['shift']());}};_0xbaac04(++_0x1a4d3f);}(_0x6903,0x184));var _0x3690=function(_0x399f44,_0x5d343c){_0x399f44=_0x399f44-0x0;var _0x1fae5b=_0x6903[_0x399f44];return _0x1fae5b;};'use strict';var _=require(_0x3690('0x0'));var Promise=require(_0x3690('0x1'));var rp=require(_0x3690('0x2'));var util=require(_0x3690('0x3'));var md5=require(_0x3690('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3690('0x5'));var logger=require('../../../../config/logger')(_0x3690('0x6'));config['redis']=_[_0x3690('0x7')](config['redis'],{'host':_0x3690('0x8'),'port':0x18eb});var io=require(_0x3690('0x9'))(new Redis(config[_0x3690('0xa')]));function getAdminUser(_0x402a6d,_0x1a267a,_0xc23cb1,_0x356eb6,_0x177aef,_0x5412de){return new Promise(function(_0x3df63c,_0x1b4400){var _0x4fad04={'method':_0x3690('0xb'),'uri':_0x356eb6+_0x3690('0xc')+'&'+_0x177aef+'&'+_0x5412de,'auth':_0x1a267a,'json':!![]};return rp(_0x4fad04)[_0x3690('0xd')](function(_0x1aec3a){if(_0x1aec3a[_0x3690('0xe')][_0x3690('0xf')]>0x0){_0xc23cb1['adminId']=_0x1aec3a[_0x3690('0xe')][0x0][_0x3690('0x10')];}logger[_0x3690('0x11')]('['+[_0x402a6d[_0x3690('0x12')]()]+_0x3690('0x13'),_0xc23cb1);_0x3df63c(_0xc23cb1);})['catch'](function(_0xd81b8c){logger[_0x3690('0x14')]('['+[_0x402a6d[_0x3690('0x12')]()]+']',_0xd81b8c[_0x3690('0x15')]);_0x1b4400(_0xd81b8c[_0x3690('0x15')]);});});}function getUser(_0x15444,_0x299b47,_0x4c8480,_0x345ceb,_0xe94407){return function(_0x49e252){logger[_0x3690('0x11')]('['+[_0x15444[_0x3690('0x12')]()]+'],\x20getUser\x20input\x20crm',_0x49e252);return new Promise(function(_0x3d08c5,_0x284372){if(intUtil[_0x3690('0x16')](_0x49e252[_0x3690('0x17')])){var _0x248126={'method':_0x3690('0xb'),'uri':_0x4c8480+_0x3690('0x18')+_0x49e252[_0x3690('0x17')]+'&'+_0x345ceb+'&'+_0xe94407,'auth':_0x299b47,'json':!![]};logger[_0x3690('0x11')]('['+[_0x15444[_0x3690('0x12')]()]+_0x3690('0x19'),_0x248126);return rp(_0x248126)[_0x3690('0xd')](function(_0x1f10ae){logger[_0x3690('0x11')]('['+[_0x15444[_0x3690('0x12')]()]+_0x3690('0x1a'),_0x1f10ae);if(_0x1f10ae['result'][_0x3690('0xf')]>0x0&&String(_0x1f10ae['result'][0x0][_0x3690('0x1b')])===_0x3690('0x1c')){_0x49e252['userId']=_0x1f10ae[_0x3690('0xe')][0x0]['sys_id'];}else{_0x49e252[_0x3690('0x1d')]=_0x49e252[_0x3690('0x1e')];_0x49e252[_0x3690('0x17')]=_0x49e252['adminEmail'];}logger[_0x3690('0x11')]('['+[_0x15444[_0x3690('0x12')]()]+_0x3690('0x1f'),_0x49e252);_0x3d08c5(_0x49e252);})[_0x3690('0x20')](function(_0x108051){logger[_0x3690('0x14')]('['+[_0x15444[_0x3690('0x12')]()]+']',_0x108051[_0x3690('0x15')]);_0x284372(_0x108051[_0x3690('0x15')]);});}else{logger['info']('['+[_0x15444[_0x3690('0x12')]()]+']\x20using\x20admin\x20profile');_0x49e252[_0x3690('0x1d')]=_0x49e252[_0x3690('0x1e')];_0x49e252[_0x3690('0x17')]=_0x49e252[_0x3690('0x21')];_0x3d08c5(_0x49e252);}});};}function createEndUser(_0xd2ae3f,_0x9c11dd,_0x38d042,_0x1bba12,_0x33ee6a){logger[_0x3690('0x11')]('['+[_0xd2ae3f['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x38d042);return new Promise(function(_0x16e179,_0x4733ce){var _0x43623b={'method':_0x3690('0x22'),'uri':_0x1bba12+_0x3690('0x23')+_0x33ee6a,'body':{'user_name':_0x38d042[_0x3690('0x24')],'roles':_0x3690('0x25'),'first_name':_0x38d042[_0x3690('0x24')],'active':_0x3690('0x1c'),'date_format':_0x3690('0x26'),'phone':_0x38d042[_0x3690('0x24')]},'auth':_0x9c11dd,'json':!![]};return rp(_0x43623b)[_0x3690('0xd')](function(_0x2038b6){logger[_0x3690('0x11')]('['+[_0xd2ae3f[_0x3690('0x12')]()]+_0x3690('0x27'),_0x2038b6[_0x3690('0xe')]);_0x38d042['endUserId']=_0x2038b6['result'][_0x3690('0x10')];_0x16e179(_0x38d042);})[_0x3690('0x20')](function(_0x28c4c2){logger[_0x3690('0x14')]('['+[_0xd2ae3f[_0x3690('0x12')]()]+']',_0x28c4c2[_0x3690('0x15')]);_0x4733ce(_0x28c4c2['message']);});});}function getEndUser(_0x19bcab,_0x13e82e,_0x26119c,_0x51dcaa,_0x44c8ce){return function(_0x4f49aa){logger[_0x3690('0x11')]('['+[_0x19bcab[_0x3690('0x12')]()]+_0x3690('0x28'),_0x4f49aa);return new Promise(function(_0x4e99d3,_0x37857f){var _0xace815={'method':_0x3690('0xb'),'uri':_0x26119c+_0x3690('0x29')+_0x4f49aa[_0x3690('0x24')]+'&'+_0x51dcaa+'&'+_0x44c8ce,'auth':_0x13e82e,'json':!![]};return rp(_0xace815)[_0x3690('0xd')](function(_0x24ff64){if(_0x24ff64['result'][_0x3690('0xf')]>0x0){_0x4f49aa['endUserId']=_0x24ff64[_0x3690('0xe')][0x0][_0x3690('0x10')];logger[_0x3690('0x11')]('['+[_0x19bcab[_0x3690('0x12')]()]+_0x3690('0x2a'),_0x4f49aa);_0x4e99d3(_0x4f49aa);}else{return createEndUser(_0x19bcab,_0x13e82e,_0x4f49aa,_0x26119c,_0x51dcaa)[_0x3690('0xd')](function(_0x2011f9){logger[_0x3690('0x11')]('['+[_0x19bcab[_0x3690('0x12')]()]+'],\x20createEndUser\x20crm',_0x2011f9);_0x4e99d3(_0x2011f9);});}})['catch'](function(_0x2c24c6){logger[_0x3690('0x14')]('['+[_0x19bcab[_0x3690('0x12')]()]+']',_0x2c24c6[_0x3690('0x15')]);_0x37857f(_0x2c24c6[_0x3690('0x15')]);});});};}function getCustomFields(_0x45290e,_0x3769b3){var _0x4518ec={};if(_0x45290e[_0x3690('0xf')]>0x0){_['forEach'](_0x45290e,function(_0xd0d763){if(_[_0x3690('0x2b')](['string','picklist'],_0xd0d763[_0x3690('0x2c')])&&_0xd0d763[_0x3690('0x2d')]&&!_0xd0d763[_0x3690('0x2e')]){_0x4518ec[_0xd0d763[_0x3690('0x2d')][_0x3690('0x2f')]()]=_0xd0d763[_0x3690('0x30')][_0x3690('0x31')]();}else if(_[_0x3690('0x2b')]([_0x3690('0x32'),_0x3690('0x33')],_0xd0d763[_0x3690('0x2c')])&&_0xd0d763['idField']&&_0xd0d763[_0x3690('0x2e')]){_0x4518ec[_0xd0d763[_0x3690('0x34')][_0x3690('0x2f')]()]=_0xd0d763[_0x3690('0x30')][_0x3690('0x31')]();}else if(_0xd0d763[_0x3690('0x2c')]===_0x3690('0x35')&&_0xd0d763[_0x3690('0x36')]&&_0xd0d763['idField']&&_0xd0d763[_0x3690('0x2e')]){_0x4518ec[_0xd0d763[_0x3690('0x34')][_0x3690('0x2f')]()]=_0x3769b3[_0xd0d763['variableName']][_0x3690('0x31')]();}else if(_0xd0d763['type']===_0x3690('0x37')&&_0xd0d763['Variable']&&_0xd0d763[_0x3690('0x38')][_0x3690('0x39')]&&_0xd0d763['idField']&&_0xd0d763[_0x3690('0x2e')]){_0x4518ec[_0xd0d763['idField'][_0x3690('0x2f')]()]=_0x3769b3[_0xd0d763[_0x3690('0x38')][_0x3690('0x39')]['toLowerCase']()][_0x3690('0x31')]();}});}return _0x4518ec;}function getTicket(_0x2e9c35,_0x374f85,_0x4d83a4,_0x49330e,_0x3e5d89,_0x4873a6){return function(_0x16972e){logger['info']('['+[_0x2e9c35[_0x3690('0x12')]()]+_0x3690('0x3a'),_0x16972e);return new Promise(function(_0x55cc78,_0xd035cb){var _0x2bc310=_0x2e9c35[_0x3690('0x2f')]()===_0x3690('0x3b')?_0x16972e['userId']:_0x16972e[_0x3690('0x3c')];var _0x233c00={'method':_0x3690('0x22'),'uri':_0x4d83a4+_0x3690('0x3d')+'?'+_0x4873a6,'body':Object['assign']({},{'active':_0x3690('0x1c'),'caller_id':_0x2bc310,'assigned_to':_0x16972e[_0x3690('0x1d')],'short_description':intUtil[_0x3690('0x3e')](_0x49330e[_0x3690('0x3f')],_0x3e5d89,'\x20'),'description':intUtil[_0x3690('0x3e')](_0x49330e[_0x3690('0x40')],_0x3e5d89,'\x0a')},getCustomFields(_0x49330e['Fields'],_0x3e5d89)),'auth':_0x374f85,'json':!![]};return rp(_0x233c00)[_0x3690('0xd')](function(_0x340170){logger[_0x3690('0x11')]('['+[_0x2e9c35[_0x3690('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x340170[_0x3690('0xe')]);_0x16972e['ticketId']=_0x340170['result']['sys_id'];_0x16972e['ticketNumber']=_0x340170['result'][_0x3690('0x41')];logger[_0x3690('0x11')]('['+[_0x2e9c35[_0x3690('0x12')]()]+']\x20getTicket\x20crm',_0x16972e);_0x55cc78(_0x16972e);})['catch'](function(_0x442bef){logger[_0x3690('0x14')]('['+[_0x2e9c35[_0x3690('0x12')]()]+']',_0x442bef[_0x3690('0x15')]);_0xd035cb(_0x442bef['message']);});});};}function createRemoteTag(_0x1bc741,_0x34534e,_0x5dede1,_0x197f9a){return new Promise(function(_0x50fb0c,_0x3c01fc){var _0x31360d={'method':_0x3690('0x22'),'uri':_0x5dede1+_0x3690('0x42')+'?'+_0x197f9a,'body':{'short_description':_0x1bc741,'global':!![],'active':!![],'name':_0x1bc741},'auth':_0x34534e,'json':!![]};return rp(_0x31360d)[_0x3690('0xd')](function(_0x244ca0){var _0x38f815=_0x244ca0[_0x3690('0xe')]['sys_id'];_0x50fb0c(_0x38f815);});});}function getRemoteTag(_0x5b1041,_0xf79733,_0x3a9aec,_0x19962c,_0x36438d){return new Promise(function(_0x38afb1,_0x524be1){var _0x417f29={'method':_0x3690('0xb'),'uri':_0x3a9aec+_0x3690('0x42')+_0x3690('0x43')+_0x5b1041+'&'+_0x19962c,'auth':_0xf79733,'json':!![]};return rp(_0x417f29)[_0x3690('0xd')](function(_0x21a325){if(_0x21a325[_0x3690('0xe')][_0x3690('0xf')]>0x0){var _0x331cd0=_0x21a325[_0x3690('0xe')][0x0][_0x3690('0x10')];_0x38afb1(_0x331cd0);}else{return createRemoteTag(_0x5b1041,_0xf79733,_0x3a9aec,_0x19962c)[_0x3690('0xd')](function(_0x1cd219){_0x38afb1(_0x1cd219);});}});});}function assignTagToIncident(_0x5ba600,_0x15bca6,_0x1f8f60,_0x577694,_0x11e814){return new Promise(function(_0x4444b5,_0x580741){var _0x21685b={'method':_0x3690('0x22'),'uri':_0x1f8f60+'label_entry'+'?'+_0x11e814,'body':{'label':_0x5ba600,'table':_0x3690('0x3d'),'id_type':_0x3690('0x44'),'table_key':_0x577694[_0x3690('0x45')],'title':_0x3690('0x46')+_0x577694[_0x3690('0x47')],'id_display':_0x577694[_0x3690('0x47')]},'auth':_0x15bca6,'json':!![]};return rp(_0x21685b)[_0x3690('0xd')](function(_0x188cd5){_0x4444b5();})[_0x3690('0x20')](function(){_0x4444b5();});});}function manageTags(_0x35184b,_0xf31f36,_0x46ff19,_0x3ac4a2,_0x57118f,_0x45eb76,_0x45b60e){return new Promise(function(_0x38edb8,_0x58c8af){var _0x4ffe73=[];_0xf31f36['forEach'](function(_0x2aa9e7){_0x4ffe73['push'](getRemoteTag(_0x2aa9e7,_0x46ff19,_0x3ac4a2,_0x45eb76,_0x45b60e));});return Promise['all'](_0x4ffe73)[_0x3690('0xd')](function(_0x146920){if(_0x146920[_0x3690('0xf')]){logger[_0x3690('0x11')]('['+[_0x35184b['toUpperCase']()]+_0x3690('0x48'),_0x146920);var _0x309fab=[];_0x146920[_0x3690('0x49')](function(_0x36fad0){_0x309fab[_0x3690('0x4a')](assignTagToIncident(_0x36fad0,_0x46ff19,_0x3ac4a2,_0x57118f,_0x45eb76));});return Promise[_0x3690('0x4b')](_0x309fab)[_0x3690('0xd')](function(){_0x38edb8();})[_0x3690('0x20')](function(){_0x38edb8();});}else{_0x38edb8();}});});}function getTags(_0x371116,_0x570fb4,_0x449aaa,_0x30e906,_0x3ed3f9,_0x2d23c6){return function(_0x2d9689){return new Promise(function(_0x2e90c9,_0x21ea53){var _0x543618=[];var _0x3ae436=_0x30e906['Tags'];if(_0x3ae436&&_0x3ae436['length']>0x0){_0x543618=_[_0x3690('0x4c')](_0x3ae436,_0x3690('0x39'));}if(_0x543618[_0x3690('0xf')]>0x0){return manageTags(_0x371116,_0x543618,_0x570fb4,_0x449aaa,_0x2d9689,_0x3ed3f9,_0x2d23c6)[_0x3690('0xd')](function(){_0x2e90c9(_0x2d9689);});}else{_0x2e90c9(_0x2d9689);}});};}function emit(_0x5e5a10,_0xf42949,_0x36a1c8){var _0x544860=_0x3690('0x4d')+_0x3690('0x4e')+_0x3690('0x4f')+_0x3690('0x50');var _0x476d65={'uri':_0x5e5a10+_0x3690('0x51')+_0x36a1c8+_0x544860};io['to'](util[_0x3690('0x52')](_0x3690('0x53'),_0xf42949))[_0x3690('0x54')]('trigger:browser:url',_0x476d65);}exports['cs']=function(_0x2232a3,_0x216911,_0x54f266,_0x1695f9,_0x4652c5,_0x90d3f0,_0x179e02,_0x1bfffc){var _0x3adffe={};var _0x14478e={'user':_0x90d3f0['username'],'pass':_0x90d3f0[_0x3690('0x55')]};var _0x15037d=_0x3690('0x56');var _0x296697=_0x3690('0x57');_0x90d3f0[_0x3690('0x58')]=intUtil['stripTrailingSlash'](_0x90d3f0['remoteUri']);_0x90d3f0[_0x3690('0x59')]=intUtil[_0x3690('0x5a')](_0x90d3f0[_0x3690('0x59')]);var _0x1cae3c=util['format'](_0x3690('0x5b'),_0x90d3f0[_0x3690('0x58')]);_0x3adffe[_0x3690('0x17')]=!_[_0x3690('0x5c')](_0x1695f9)?_0x1695f9[_0x3690('0x5d')]:null;_0x3adffe[_0x3690('0x21')]=_0x90d3f0[_0x3690('0x5d')];_0x3adffe[_0x3690('0x24')]=_0x1bfffc['toLowerCase']()===_0x3690('0x3b')?_0x216911['destcalleridnum']:_0x216911[_0x3690('0x5e')];_0x3adffe[_0x3690('0x5f')]=_0x1bfffc==='queue'||_0x1bfffc==='unmanaged'?'queue':_0x3690('0x3b');var _0x5a0647=util[_0x3690('0x52')](_0x3690('0x60'),_0x90d3f0[_0x3690('0x59')],_0x216911[_0x3690('0x61')],md5(_0x216911['uniqueid']));if(_0x4652c5&&_0x4652c5['monitor_format']){logger['info']('[QUEUE]',_0x3690('0x62'));_0x216911[_0x3690('0x63')]=_0x5a0647;}else if(_0x179e02&&_0x179e02[_0x3690('0x64')]&&_0x179e02[_0x3690('0x64')]!==_0x3690('0x65')){logger[_0x3690('0x11')](_0x3690('0x66'),_0x3690('0x62'));_0x216911['recordingURL']=_0x5a0647;}else{_0x216911[_0x3690('0x63')]='';}return getAdminUser(_0x1bfffc,_0x14478e,_0x3adffe,_0x1cae3c,_0x296697,_0x15037d)[_0x3690('0xd')](getUser(_0x1bfffc,_0x14478e,_0x1cae3c,_0x296697,_0x15037d))[_0x3690('0xd')](getEndUser(_0x1bfffc,_0x14478e,_0x1cae3c,_0x296697,_0x15037d))['then'](getTicket(_0x1bfffc,_0x14478e,_0x1cae3c,_0x54f266,_0x216911,_0x296697))['then'](function(_0x42c1f4){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x42c1f4[_0x3690('0x45')]));logger['info'](util['format'](_0x3690('0x67'),_0x1bfffc));if(_0x1bfffc!==_0x3690('0x68')){logger[_0x3690('0x11')]('['+[_0x1bfffc[_0x3690('0x12')]()]+']',_0x3690('0x69'));emit(_0x90d3f0[_0x3690('0x58')],_0x1695f9[_0x3690('0x39')],_0x42c1f4[_0x3690('0x45')]);}})[_0x3690('0x20')](function(_0x4cf63c){logger[_0x3690('0x14')]('['+[_0x1bfffc[_0x3690('0x12')]()]+_0x3690('0x6a'),util['inspect'](_0x4cf63c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x444e=['System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','content','customField','idField','toString','variable','variableName','customVariable','Variable','name','incident','assign','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x444e,0x129));var _0xe444=function(_0x4f7110,_0x19927f){_0x4f7110=_0x4f7110-0x0;var _0x40dd24=_0x444e[_0x4f7110];return _0x40dd24;};'use strict';var _=require(_0xe444('0x0'));var Promise=require(_0xe444('0x1'));var rp=require('request-promise');var util=require(_0xe444('0x2'));var md5=require(_0xe444('0x3'));var Redis=require('ioredis');var intUtil=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var logger=require(_0xe444('0x6'))(_0xe444('0x7'));config[_0xe444('0x8')]=_['defaults'](config[_0xe444('0x8')],{'host':_0xe444('0x9'),'port':0x18eb});var io=require(_0xe444('0xa'))(new Redis(config[_0xe444('0x8')]));function getAdminUser(_0x4077a6,_0x171759,_0x336f12,_0x28d6ea,_0x497fc2,_0x29292a){return new Promise(function(_0x44be5e,_0x4989c2){var _0x38f417={'method':_0xe444('0xb'),'uri':_0x28d6ea+_0xe444('0xc')+'&'+_0x497fc2+'&'+_0x29292a,'auth':_0x171759,'json':!![]};return rp(_0x38f417)[_0xe444('0xd')](function(_0x478f6c){if(_0x478f6c[_0xe444('0xe')][_0xe444('0xf')]>0x0){_0x336f12[_0xe444('0x10')]=_0x478f6c[_0xe444('0xe')][0x0][_0xe444('0x11')];}logger['info']('['+[_0x4077a6[_0xe444('0x12')]()]+_0xe444('0x13'),_0x336f12);_0x44be5e(_0x336f12);})[_0xe444('0x14')](function(_0x23cf13){logger[_0xe444('0x15')]('['+[_0x4077a6[_0xe444('0x12')]()]+']',_0x23cf13[_0xe444('0x16')]);_0x4989c2(_0x23cf13[_0xe444('0x16')]);});});}function getUser(_0x3a6806,_0x512c8e,_0x3b58a0,_0x1667e9,_0x4c38cc){return function(_0x42b43a){logger[_0xe444('0x17')]('['+[_0x3a6806[_0xe444('0x12')]()]+_0xe444('0x18'),_0x42b43a);return new Promise(function(_0x56898b,_0x30c95c){if(intUtil[_0xe444('0x19')](_0x42b43a[_0xe444('0x1a')])){var _0x4b1f78={'method':_0xe444('0xb'),'uri':_0x3b58a0+_0xe444('0x1b')+_0x42b43a[_0xe444('0x1a')]+'&'+_0x1667e9+'&'+_0x4c38cc,'auth':_0x512c8e,'json':!![]};logger[_0xe444('0x17')]('['+[_0x3a6806['toUpperCase']()]+_0xe444('0x1c'),_0x4b1f78);return rp(_0x4b1f78)[_0xe444('0xd')](function(_0x58f749){logger[_0xe444('0x17')]('['+[_0x3a6806[_0xe444('0x12')]()]+_0xe444('0x1d'),_0x58f749);if(_0x58f749[_0xe444('0xe')]['length']>0x0&&String(_0x58f749[_0xe444('0xe')][0x0][_0xe444('0x1e')])===_0xe444('0x1f')){_0x42b43a[_0xe444('0x20')]=_0x58f749[_0xe444('0xe')][0x0][_0xe444('0x11')];}else{_0x42b43a['userId']=_0x42b43a[_0xe444('0x10')];_0x42b43a[_0xe444('0x1a')]=_0x42b43a[_0xe444('0x21')];}logger[_0xe444('0x17')]('['+[_0x3a6806[_0xe444('0x12')]()]+'],\x20getUser\x20crm',_0x42b43a);_0x56898b(_0x42b43a);})[_0xe444('0x14')](function(_0x3b2695){logger[_0xe444('0x15')]('['+[_0x3a6806['toUpperCase']()]+']',_0x3b2695[_0xe444('0x16')]);_0x30c95c(_0x3b2695[_0xe444('0x16')]);});}else{logger[_0xe444('0x17')]('['+[_0x3a6806[_0xe444('0x12')]()]+_0xe444('0x22'));_0x42b43a[_0xe444('0x20')]=_0x42b43a['adminId'];_0x42b43a[_0xe444('0x1a')]=_0x42b43a[_0xe444('0x21')];_0x56898b(_0x42b43a);}});};}function createEndUser(_0x2a4096,_0x23b2ca,_0x1f9384,_0x406fd5,_0x4293dd){logger[_0xe444('0x17')]('['+[_0x2a4096[_0xe444('0x12')]()]+_0xe444('0x23'),_0x1f9384);return new Promise(function(_0x40ce82,_0x365a44){var _0x1c4247={'method':_0xe444('0x24'),'uri':_0x406fd5+_0xe444('0x25')+_0x4293dd,'body':{'user_name':_0x1f9384['endUserNumber'],'roles':'user','first_name':_0x1f9384[_0xe444('0x26')],'active':'true','date_format':_0xe444('0x27'),'phone':_0x1f9384[_0xe444('0x26')]},'auth':_0x23b2ca,'json':!![]};return rp(_0x1c4247)[_0xe444('0xd')](function(_0x532a97){logger[_0xe444('0x17')]('['+[_0x2a4096['toUpperCase']()]+_0xe444('0x28'),_0x532a97[_0xe444('0xe')]);_0x1f9384['endUserId']=_0x532a97[_0xe444('0xe')]['sys_id'];_0x40ce82(_0x1f9384);})[_0xe444('0x14')](function(_0x237e8f){logger['error']('['+[_0x2a4096['toUpperCase']()]+']',_0x237e8f['message']);_0x365a44(_0x237e8f[_0xe444('0x16')]);});});}function getEndUser(_0x5a844a,_0xb3d029,_0x415b5e,_0x3d01ad,_0x2f4f72){return function(_0x529cf3){logger[_0xe444('0x17')]('['+[_0x5a844a[_0xe444('0x12')]()]+_0xe444('0x29'),_0x529cf3);return new Promise(function(_0x3059fd,_0x1fa5a5){var _0x2912d3={'method':_0xe444('0xb'),'uri':_0x415b5e+_0xe444('0x2a')+_0x529cf3['endUserNumber']+'&'+_0x3d01ad+'&'+_0x2f4f72,'auth':_0xb3d029,'json':!![]};return rp(_0x2912d3)[_0xe444('0xd')](function(_0x173b87){if(_0x173b87['result'][_0xe444('0xf')]>0x0){_0x529cf3[_0xe444('0x2b')]=_0x173b87[_0xe444('0xe')][0x0][_0xe444('0x11')];logger[_0xe444('0x17')]('['+[_0x5a844a[_0xe444('0x12')]()]+_0xe444('0x2c'),_0x529cf3);_0x3059fd(_0x529cf3);}else{return createEndUser(_0x5a844a,_0xb3d029,_0x529cf3,_0x415b5e,_0x3d01ad)[_0xe444('0xd')](function(_0x1803d4){logger[_0xe444('0x17')]('['+[_0x5a844a[_0xe444('0x12')]()]+_0xe444('0x2d'),_0x1803d4);_0x3059fd(_0x1803d4);});}})[_0xe444('0x14')](function(_0x294c7f){logger[_0xe444('0x15')]('['+[_0x5a844a['toUpperCase']()]+']',_0x294c7f[_0xe444('0x16')]);_0x1fa5a5(_0x294c7f[_0xe444('0x16')]);});});};}function getCustomFields(_0x648d4c,_0x12f26c){var _0x48b5aa={};if(_0x648d4c[_0xe444('0xf')]>0x0){_[_0xe444('0x2e')](_0x648d4c,function(_0x373261){if(_['includes']([_0xe444('0x2f'),_0xe444('0x30')],_0x373261[_0xe444('0x31')])&&_0x373261['nameField']&&!_0x373261['customField']){_0x48b5aa[_0x373261[_0xe444('0x32')][_0xe444('0x33')]()]=_0x373261[_0xe444('0x34')]['toString']();}else if(_['includes']([_0xe444('0x2f'),_0xe444('0x30')],_0x373261[_0xe444('0x31')])&&_0x373261['idField']&&_0x373261[_0xe444('0x35')]){_0x48b5aa[_0x373261[_0xe444('0x36')][_0xe444('0x33')]()]=_0x373261[_0xe444('0x34')][_0xe444('0x37')]();}else if(_0x373261['type']===_0xe444('0x38')&&_0x373261[_0xe444('0x39')]&&_0x373261[_0xe444('0x36')]&&_0x373261[_0xe444('0x35')]){_0x48b5aa[_0x373261['idField']['toLowerCase']()]=_0x12f26c[_0x373261['variableName']][_0xe444('0x37')]();}else if(_0x373261[_0xe444('0x31')]===_0xe444('0x3a')&&_0x373261[_0xe444('0x3b')]&&_0x373261[_0xe444('0x3b')][_0xe444('0x3c')]&&_0x373261[_0xe444('0x36')]&&_0x373261['customField']){_0x48b5aa[_0x373261[_0xe444('0x36')][_0xe444('0x33')]()]=_0x12f26c[_0x373261['Variable'][_0xe444('0x3c')][_0xe444('0x33')]()][_0xe444('0x37')]();}});}return _0x48b5aa;}function getTicket(_0x270920,_0x5c4ee1,_0x40189b,_0xa40784,_0x22d6af,_0x46aaef){return function(_0x2d94eb){logger['info']('['+[_0x270920[_0xe444('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x2d94eb);return new Promise(function(_0x3847ca,_0x246c50){var _0x45f68c=_0x270920[_0xe444('0x33')]()==='outbound'?_0x2d94eb[_0xe444('0x20')]:_0x2d94eb[_0xe444('0x2b')];var _0x29d948={'method':'POST','uri':_0x40189b+_0xe444('0x3d')+'?'+_0x46aaef,'body':Object[_0xe444('0x3e')]({},{'active':'true','caller_id':_0x45f68c,'assigned_to':_0x2d94eb['userId'],'short_description':intUtil['getString'](_0xa40784[_0xe444('0x3f')],_0x22d6af,'\x20'),'description':intUtil['getString'](_0xa40784[_0xe444('0x40')],_0x22d6af,'\x0a')},getCustomFields(_0xa40784[_0xe444('0x41')],_0x22d6af)),'auth':_0x5c4ee1,'json':!![]};return rp(_0x29d948)[_0xe444('0xd')](function(_0x2c2d4c){logger[_0xe444('0x17')]('['+[_0x270920[_0xe444('0x12')]()]+_0xe444('0x42'),_0x2c2d4c[_0xe444('0xe')]);_0x2d94eb['ticketId']=_0x2c2d4c[_0xe444('0xe')]['sys_id'];_0x2d94eb['ticketNumber']=_0x2c2d4c['result']['number'];logger[_0xe444('0x17')]('['+[_0x270920[_0xe444('0x12')]()]+_0xe444('0x43'),_0x2d94eb);_0x3847ca(_0x2d94eb);})[_0xe444('0x14')](function(_0x48157e){logger['error']('['+[_0x270920[_0xe444('0x12')]()]+']',_0x48157e[_0xe444('0x16')]);_0x246c50(_0x48157e['message']);});});};}function createRemoteTag(_0x57548b,_0x566ad8,_0x3df206,_0x22499e){return new Promise(function(_0xb567c2,_0x57ceaf){var _0x44885a={'method':_0xe444('0x24'),'uri':_0x3df206+'label'+'?'+_0x22499e,'body':{'short_description':_0x57548b,'global':!![],'active':!![],'name':_0x57548b},'auth':_0x566ad8,'json':!![]};return rp(_0x44885a)[_0xe444('0xd')](function(_0x413f0d){var _0x1beece=_0x413f0d[_0xe444('0xe')]['sys_id'];_0xb567c2(_0x1beece);});});}function getRemoteTag(_0x27a62a,_0x22d544,_0x5d7205,_0x2856c0,_0x357f89){return new Promise(function(_0x4a93fb,_0xfe2dbc){var _0x585c01={'method':_0xe444('0xb'),'uri':_0x5d7205+_0xe444('0x44')+_0xe444('0x45')+_0x27a62a+'&'+_0x2856c0,'auth':_0x22d544,'json':!![]};return rp(_0x585c01)['then'](function(_0x563c5b){if(_0x563c5b[_0xe444('0xe')][_0xe444('0xf')]>0x0){var _0x2b757b=_0x563c5b['result'][0x0][_0xe444('0x11')];_0x4a93fb(_0x2b757b);}else{return createRemoteTag(_0x27a62a,_0x22d544,_0x5d7205,_0x2856c0)['then'](function(_0x555fc7){_0x4a93fb(_0x555fc7);});}});});}function assignTagToIncident(_0x2879f3,_0x5c4192,_0x51ffa5,_0x2183c5,_0x431000){return new Promise(function(_0x45d5c2,_0x150456){var _0x3991e9={'method':_0xe444('0x24'),'uri':_0x51ffa5+_0xe444('0x46')+'?'+_0x431000,'body':{'label':_0x2879f3,'table':'incident','id_type':_0xe444('0x47'),'table_key':_0x2183c5[_0xe444('0x48')],'title':_0xe444('0x49')+_0x2183c5[_0xe444('0x4a')],'id_display':_0x2183c5[_0xe444('0x4a')]},'auth':_0x5c4192,'json':!![]};return rp(_0x3991e9)[_0xe444('0xd')](function(_0x56eddc){_0x45d5c2();})[_0xe444('0x14')](function(){_0x45d5c2();});});}function manageTags(_0xdeb04a,_0x5cb420,_0x5afc2a,_0xbbba3b,_0x4902cd,_0x240a35,_0x47780b){return new Promise(function(_0x27c894,_0xaf80be){var _0x23c86b=[];_0x5cb420[_0xe444('0x2e')](function(_0x10740a){_0x23c86b[_0xe444('0x4b')](getRemoteTag(_0x10740a,_0x5afc2a,_0xbbba3b,_0x240a35,_0x47780b));});return Promise[_0xe444('0x4c')](_0x23c86b)[_0xe444('0xd')](function(_0x24cf27){if(_0x24cf27[_0xe444('0xf')]){logger[_0xe444('0x17')]('['+[_0xdeb04a[_0xe444('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x24cf27);var _0x1e0eaa=[];_0x24cf27['forEach'](function(_0x677ce1){_0x1e0eaa[_0xe444('0x4b')](assignTagToIncident(_0x677ce1,_0x5afc2a,_0xbbba3b,_0x4902cd,_0x240a35));});return Promise[_0xe444('0x4c')](_0x1e0eaa)['then'](function(){_0x27c894();})['catch'](function(){_0x27c894();});}else{_0x27c894();}});});}function getTags(_0x17accc,_0x4a4089,_0x40477f,_0x1b618e,_0x3d5b87,_0x52f245){return function(_0x44e14b){return new Promise(function(_0x4c374c,_0x148334){var _0x38388a=[];var _0x14cbb6=_0x1b618e[_0xe444('0x4d')];if(_0x14cbb6&&_0x14cbb6[_0xe444('0xf')]>0x0){_0x38388a=_[_0xe444('0x4e')](_0x14cbb6,_0xe444('0x3c'));}if(_0x38388a['length']>0x0){return manageTags(_0x17accc,_0x38388a,_0x4a4089,_0x40477f,_0x44e14b,_0x3d5b87,_0x52f245)[_0xe444('0xd')](function(){_0x4c374c(_0x44e14b);});}else{_0x4c374c(_0x44e14b);}});};}function emit(_0x2f04b5,_0x2f7e03,_0x52a7e5){var _0x594996=_0xe444('0x4f')+_0xe444('0x50')+_0xe444('0x51')+_0xe444('0x52');var _0x2f8d60={'uri':_0x2f04b5+_0xe444('0x53')+_0x52a7e5+_0x594996};io['to'](util[_0xe444('0x54')](_0xe444('0x55'),_0x2f7e03))[_0xe444('0x56')]('trigger:browser:url',_0x2f8d60);}exports['cs']=function(_0x141028,_0x4c0a0f,_0x594846,_0x30948d,_0x5da069,_0x39262a,_0x52abf9,_0x355549){var _0x59b081={};var _0x1372ba={'user':_0x39262a['username'],'pass':_0x39262a['password']};var _0x171f2a=_0xe444('0x57');var _0x2f4636=_0xe444('0x58');_0x39262a[_0xe444('0x59')]=intUtil[_0xe444('0x5a')](_0x39262a['remoteUri']);_0x39262a[_0xe444('0x5b')]=intUtil['stripTrailingSlash'](_0x39262a[_0xe444('0x5b')]);var _0x426c87=util[_0xe444('0x54')](_0xe444('0x5c'),_0x39262a[_0xe444('0x59')]);_0x59b081[_0xe444('0x1a')]=!_[_0xe444('0x5d')](_0x30948d)?_0x30948d['email']:null;_0x59b081[_0xe444('0x21')]=_0x39262a[_0xe444('0x5e')];_0x59b081['endUserNumber']=_0x355549[_0xe444('0x33')]()===_0xe444('0x5f')?_0x4c0a0f[_0xe444('0x60')]:_0x4c0a0f[_0xe444('0x61')];_0x59b081[_0xe444('0x62')]=_0x355549===_0xe444('0x63')||_0x355549===_0xe444('0x64')?'queue':_0xe444('0x5f');var _0x623c16=util[_0xe444('0x54')](_0xe444('0x65'),_0x39262a[_0xe444('0x5b')],_0x4c0a0f[_0xe444('0x66')],md5(_0x4c0a0f[_0xe444('0x66')]));if(_0x5da069&&_0x5da069[_0xe444('0x67')]){logger[_0xe444('0x17')]('[QUEUE]',_0xe444('0x68'));_0x4c0a0f[_0xe444('0x69')]=_0x623c16;}else if(_0x52abf9&&_0x52abf9[_0xe444('0x6a')]&&_0x52abf9[_0xe444('0x6a')]!==_0xe444('0x6b')){logger[_0xe444('0x17')](_0xe444('0x6c'),'Recording\x20is\x20enabled!');_0x4c0a0f[_0xe444('0x69')]=_0x623c16;}else{_0x4c0a0f[_0xe444('0x69')]='';}return getAdminUser(_0x355549,_0x1372ba,_0x59b081,_0x426c87,_0x2f4636,_0x171f2a)[_0xe444('0xd')](getUser(_0x355549,_0x1372ba,_0x426c87,_0x2f4636,_0x171f2a))['then'](getEndUser(_0x355549,_0x1372ba,_0x426c87,_0x2f4636,_0x171f2a))[_0xe444('0xd')](getTicket(_0x355549,_0x1372ba,_0x426c87,_0x594846,_0x4c0a0f,_0x2f4636))['then'](function(_0x11d470){logger[_0xe444('0x17')](util[_0xe444('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x11d470[_0xe444('0x48')]));logger['info'](util[_0xe444('0x54')](_0xe444('0x6d'),_0x355549));if(_0x355549!==_0xe444('0x64')){logger[_0xe444('0x17')]('['+[_0x355549[_0xe444('0x12')]()]+']',_0xe444('0x6e'));emit(_0x39262a[_0xe444('0x59')],_0x30948d[_0xe444('0x3c')],_0x11d470[_0xe444('0x48')]);}})[_0xe444('0x14')](function(_0x56efd2){logger[_0xe444('0x15')]('['+[_0x355549[_0xe444('0x12')]()]+_0xe444('0x6f'),util['inspect'](_0x56efd2,{'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 6e2c0f3..55823a2 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 _0x7d1c=['Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','then','debug','[HTTP]','merge','map','string','customField','nameField','toLowerCase','content','custom_fields','variable','type','customVariable','Variable','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%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','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','users','contacts','charAt','toUpperCase','lastevent','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','apiKey','toString','get_server_info','stringify','isNil','info'];(function(_0x3ed0bf,_0x5bb8a9){var _0x1e618e=function(_0x4230b6){while(--_0x4230b6){_0x3ed0bf['push'](_0x3ed0bf['shift']());}};_0x1e618e(++_0x5bb8a9);}(_0x7d1c,0x144));var _0xc7d1=function(_0x48c841,_0x27374a){_0x48c841=_0x48c841-0x0;var _0x22c86f=_0x7d1c[_0x48c841];return _0x22c86f;};'use strict';var _=require('lodash');var rp=require(_0xc7d1('0x0'));var BPromise=require(_0xc7d1('0x1'));var md5=require('md5');var util=require(_0xc7d1('0x2'));var Redis=require(_0xc7d1('0x3'));var intUtil=require(_0xc7d1('0x4'));var config=require(_0xc7d1('0x5'));var logger=require(_0xc7d1('0x6'))(_0xc7d1('0x7'));config[_0xc7d1('0x8')]=_[_0xc7d1('0x9')](config[_0xc7d1('0x8')],{'host':_0xc7d1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7d1('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x1529d4,_0x218246,_0x18b9df){io['to'](_0x1529d4)[_0xc7d1('0xb')](_0x218246,_0x18b9df);}function getTicket(_0x5aa1db,_0x159e7b,_0x35ea3f,_0x120576,_0x10a56f,_0x3c111f,_0x50b430,_0x9d95cf){logger['info'](_0xc7d1('0xc'));var _0x52d71f=new Date();var _0x817edd=[{'name':_0xc7d1('0xd'),'value':intUtil[_0xc7d1('0xe')](_0x120576[_0xc7d1('0xf')],_0x10a56f,'\x20')},{'name':_0xc7d1('0x10'),'value':_0x159e7b['id']},{'name':_0xc7d1('0x11'),'value':_0x159e7b['id']},{'name':_0xc7d1('0x12'),'value':intUtil[_0xc7d1('0xe')](_0x120576[_0xc7d1('0x13')],_0x10a56f,'\x0a')},{'name':_0xc7d1('0x14'),'value':_0x52d71f[_0xc7d1('0x15')]()[_0xc7d1('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0xc7d1('0x17'),'value':'0'},{'name':_0xc7d1('0x18'),'value':'15'},{'name':'parent_id','value':_0x35ea3f['id']},{'name':_0xc7d1('0x19'),'value':_0xc7d1('0x1a')},{'name':_0xc7d1('0x1b'),'value':_0x35ea3f[_0xc7d1('0xd')]},{'name':'direction','value':_0x9d95cf}];if(_0x3c111f[_0xc7d1('0x1c')]){_[_0xc7d1('0x1d')](_0x3c111f,function(_0x2dd509){if(_0x10a56f[_0x2dd509[_0xc7d1('0x1e')]]){_0x817edd[_0xc7d1('0x1f')]({'name':_0x2dd509[_0xc7d1('0x20')],'value':_0x10a56f[_0x2dd509[_0xc7d1('0x1e')]]});}});}return request({'form':{'method':_0xc7d1('0x21'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON['stringify']({'session':_0x50b430['id'],'module_name':_0xc7d1('0x23'),'name_value_list':_0x817edd})}});}function getAuth(_0x5b1d7d){return util['format']('Basic\x20%s',new Buffer(_0x5b1d7d[_0xc7d1('0x24')]+':X')[_0xc7d1('0x25')]('base64'));}function getServerInfo(_0x24b7af){return request({'form':{'method':_0xc7d1('0x26'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON[_0xc7d1('0x27')]({'session':_0x24b7af['id']})}});}function getUser(_0x545f18,_0x29d333,_0x265984){if(!_[_0xc7d1('0x28')](_0x29d333)){logger[_0xc7d1('0x29')](_0xc7d1('0x2a'),_0x29d333);return request({'form':{'method':_0xc7d1('0x2b'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON[_0xc7d1('0x27')]({'session':_0x265984['id'],'module_name':_0xc7d1('0x2c'),'query':util['format'](_0xc7d1('0x2d'),_0x29d333),'order_by':'','offset':'0','select_fields':['id',_0xc7d1('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3b90d1){if(_0x3b90d1[_0xc7d1('0x2e')]['length']){var _0xe5e920=_[_0xc7d1('0x2f')](_0x3b90d1['entry_list'],function(_0x4c1b7d){return _0x4c1b7d[_0xc7d1('0x30')][_0xc7d1('0x31')][_0xc7d1('0x32')]===_0x29d333;});if(_0xe5e920){logger['info'](_0xc7d1('0x33'));return BPromise[_0xc7d1('0x34')]({'id':_0xe5e920[_0xc7d1('0x30')]['id'][_0xc7d1('0x32')],'name':_0xe5e920['name_value_list'][_0xc7d1('0xd')][_0xc7d1('0x32')]});}}logger[_0xc7d1('0x29')](_0xc7d1('0x35'));return BPromise['resolve']({'id':_0x265984[_0xc7d1('0x30')][_0xc7d1('0x36')]['value'],'name':_0x265984['name_value_list']['user_name'][_0xc7d1('0x32')]});});}else{logger[_0xc7d1('0x29')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc7d1('0x34')]({'id':_0x265984[_0xc7d1('0x30')][_0xc7d1('0x36')][_0xc7d1('0x32')],'name':_0x265984[_0xc7d1('0x30')][_0xc7d1('0x31')][_0xc7d1('0x32')]});}}function getEndUser(_0x681cab,_0x4355ae,_0x54644b,_0x5d0e50){logger[_0xc7d1('0x29')]('Searching\x20enduser\x20with\x20phone',_0x54644b);return request({'form':{'method':_0xc7d1('0x2b'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON['stringify']({'session':_0x5d0e50['id'],'module_name':_0xc7d1('0x1a'),'query':util['format'](_0xc7d1('0x37'),_0x54644b),'order_by':'','offset':'0','select_fields':['id',_0xc7d1('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x452be6){if(_0x452be6[_0xc7d1('0x2e')]['length']){var _0x261a41=_[_0xc7d1('0x2f')](_0x452be6[_0xc7d1('0x2e')],function(_0x3c1316){return _0x3c1316[_0xc7d1('0x30')][_0xc7d1('0x38')][_0xc7d1('0x32')]===_0x54644b;});if(_0x261a41){logger[_0xc7d1('0x29')](_0xc7d1('0x39'));return BPromise['resolve']({'id':_0x261a41[_0xc7d1('0x30')]['id'][_0xc7d1('0x32')],'name':_0x261a41[_0xc7d1('0x30')]['name']['value'],'phone':_0x261a41[_0xc7d1('0x30')][_0xc7d1('0x38')]['value']});}}else{logger['info'](_0xc7d1('0x3a'));return request({'form':{'method':_0xc7d1('0x21'),'input_type':_0xc7d1('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5d0e50['id'],'module_name':_0xc7d1('0x1a'),'name_value_list':[{'name':_0xc7d1('0x3b'),'value':_0x4355ae!==''?_0x4355ae:util['format'](_0xc7d1('0x3c'),_0x54644b)},{'name':_0xc7d1('0x38'),'value':_0x54644b}]})}})[_0xc7d1('0x3d')](function(_0x1b50c6){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x1b50c6['id'],'name':_0x1b50c6[_0xc7d1('0x2e')][_0xc7d1('0x3b')][_0xc7d1('0x32')],'phone':_0x1b50c6[_0xc7d1('0x2e')][_0xc7d1('0x38')][_0xc7d1('0x32')]});});}});}function request(_0x1e5c0d){logger[_0xc7d1('0x3e')](_0xc7d1('0x3f'),JSON[_0xc7d1('0x27')](_0x1e5c0d));return rp(_[_0xc7d1('0x40')](def,_0x1e5c0d));}function getTags(_0x12a6ec,_0x5a4e5d){var _0x28fe18=[];if(_0x12a6ec&&_0x12a6ec[_0xc7d1('0x1c')]>0x0){_0x28fe18=_[_0xc7d1('0x41')](_0x12a6ec,_0x5a4e5d);}return _0x28fe18;}function getCustomFields(_0x4638f2,_0x32d18e){var _0x420e30=[];var _0x396364={'custom_fields':[]};if(_0x4638f2[_0xc7d1('0x1c')]>0x0){_[_0xc7d1('0x1d')](_0x4638f2,function(_0x444327){if(_0x444327['type']===_0xc7d1('0x42')&&_0x444327['nameField']&&!_0x444327[_0xc7d1('0x43')]){_0x396364[_0x444327[_0xc7d1('0x44')][_0xc7d1('0x45')]()]=_0x444327[_0xc7d1('0x46')][_0xc7d1('0x25')]();}else if(_0x444327['type']===_0xc7d1('0x42')&&_0x444327['idField']&&_0x444327[_0xc7d1('0x43')]){_0x396364[_0xc7d1('0x47')][_0xc7d1('0x1f')]({'id':_0x444327['idField'],'value':_0x444327['content'][_0xc7d1('0x25')]()});}else if(_0x444327['type']===_0xc7d1('0x48')&&_0x444327['variableName']&&_0x444327[_0xc7d1('0x20')]&&_0x444327[_0xc7d1('0x43')]){_0x32d18e[_0x444327[_0xc7d1('0x1e')]]&&_0x396364[_0xc7d1('0x47')][_0xc7d1('0x1f')]({'id':_0x444327['idField'],'value':_0x32d18e[_0x444327[_0xc7d1('0x1e')]]['toString']()});}else if(_0x444327[_0xc7d1('0x49')]===_0xc7d1('0x4a')&&_0x444327[_0xc7d1('0x4b')]&&_0x444327['Variable'][_0xc7d1('0xd')]&&_0x444327[_0xc7d1('0x20')]&&_0x444327['customField']){_0x32d18e[_0x444327[_0xc7d1('0x4b')]['name'][_0xc7d1('0x45')]()]&&_0x396364['custom_fields'][_0xc7d1('0x1f')]({'id':_0x444327[_0xc7d1('0x20')],'value':_0x32d18e[_0x444327['Variable'][_0xc7d1('0xd')][_0xc7d1('0x45')]()][_0xc7d1('0x25')]()});}});}return _0x396364;}function getConnection(_0x55a18c){return request({'method':_0xc7d1('0x4c'),'form':{'method':_0xc7d1('0x4d'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON[_0xc7d1('0x27')]({'user_auth':{'user_name':_0x55a18c[_0xc7d1('0x4e')],'password':_0x55a18c[_0xc7d1('0x4f')],'encryption':_0xc7d1('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xc7d1('0x3d')](function(_0x55e0e1){var _0x15c2f3=_0x55e0e1;if(_0x15c2f3['id']){def[_0xc7d1('0x51')]=_0x15c2f3['id'];return BPromise[_0xc7d1('0x34')](_0x15c2f3);}else{throw new Error(util['format'](_0xc7d1('0x52'),_0x55a18c['id']));}});}function setRelationship(_0x2e82d6,_0x2bce4b,_0x41226d,_0x7de95b){return request({'form':{'method':_0xc7d1('0x53'),'input_type':_0xc7d1('0x22'),'response_type':_0xc7d1('0x22'),'rest_data':JSON[_0xc7d1('0x27')]({'session':_0x2e82d6['id'],'module_name':_0xc7d1('0x23'),'module_id':_0x41226d['id'],'link_field_name':_0x7de95b,'related_ids':[_0x2bce4b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc7d1('0x54')]=function(_0x45a8af,_0x415e94,_0x7cd9d0,_0x27af63,_0x34de90,_0x1a03b0){var _0x330ba4,_0x280ba3,_0x505e89,_0x323746;_0x1a03b0[_0xc7d1('0x55')]=intUtil['stripTrailingSlash'](_0x1a03b0[_0xc7d1('0x55')]);_0x1a03b0[_0xc7d1('0x56')]=intUtil[_0xc7d1('0x57')](_0x1a03b0[_0xc7d1('0x56')]);def[_0xc7d1('0x58')]=util['format'](_0xc7d1('0x59'),_0x1a03b0['remoteUri']);if(_0x34de90&&_0x34de90[_0xc7d1('0x5a')]){logger[_0xc7d1('0x29')](_0xc7d1('0x5b'),'Recording\x20is\x20enabled!');_0x415e94[_0xc7d1('0x5c')]=util[_0xc7d1('0x5d')](_0xc7d1('0x5e'),_0x1a03b0[_0xc7d1('0x56')],_0x415e94['uniqueid'],md5(_0x415e94[_0xc7d1('0x5f')]));}else{_0x415e94[_0xc7d1('0x5c')]='';}return getConnection(_0x1a03b0)[_0xc7d1('0x3d')](function(_0x3bbc46){_0x323746=_0x3bbc46;return getUser(_0x1a03b0,_0x27af63['name'],_0x323746);})[_0xc7d1('0x3d')](function(_0xbae67){_0x330ba4=_0xbae67;logger[_0xc7d1('0x29')](_0xc7d1('0x60'),_0x330ba4['id']);return getEndUser(_0x1a03b0,_0x415e94[_0xc7d1('0x61')],_0x415e94[_0xc7d1('0x62')],_0x323746);})[_0xc7d1('0x3d')](function(_0xcb3b16){_0x280ba3=_0xcb3b16;logger['info'](_0xc7d1('0x63'),_0x280ba3['id']);return getTicket(_0x1a03b0,_0x330ba4,_0x280ba3,_0x7cd9d0,_0x415e94,_0x7cd9d0[_0xc7d1('0x64')],_0x323746,_0xc7d1('0x65'));})[_0xc7d1('0x3d')](function(_0x4d6bcd){_0x505e89=_0x4d6bcd;logger[_0xc7d1('0x29')](_0xc7d1('0x66'));logger[_0xc7d1('0x29')](_0xc7d1('0x67'),_0x505e89['id']);return setRelationship(_0x323746,_0x330ba4,_0x505e89,'users');})[_0xc7d1('0x3d')](function(){return setRelationship(_0x323746,_0x280ba3,_0x505e89,'contacts');})['then'](function(){return getServerInfo(_0x323746);})[_0xc7d1('0x3d')](function(_0x166580){var _0x3db607=parseInt(_0x166580[_0xc7d1('0x68')]['charAt'](0x0));var _0x434a15=util['format'](_0xc7d1('0x69'),_0x1a03b0[_0xc7d1('0x55')],_0x505e89['id']);if(_0x3db607>0x6){_0x434a15=util[_0xc7d1('0x5d')](_0xc7d1('0x6a'),_0x1a03b0[_0xc7d1('0x55')],_0x505e89['id']);}logger['info'](_0xc7d1('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc7d1('0x5d')]('user:%s',_0x27af63[_0xc7d1('0xd')]),_0xc7d1('0x6b'),{'uri':_0x434a15});})[_0xc7d1('0x6c')](function(_0x29f6c5){logger[_0xc7d1('0x6d')](_0xc7d1('0x5b'),JSON['stringify'](_0x29f6c5));});};exports[_0xc7d1('0x6e')]=function(_0x519b65,_0xa5de97,_0x115c29,_0xb94e71,_0x1dddec,_0x31b3db,_0x40a555){var _0x52430f,_0x1618ff,_0x2333f3,_0x3425f3;_0x31b3db[_0xc7d1('0x55')]=intUtil[_0xc7d1('0x57')](_0x31b3db[_0xc7d1('0x55')]);_0x31b3db[_0xc7d1('0x56')]=intUtil[_0xc7d1('0x57')](_0x31b3db['serverUrl']);def[_0xc7d1('0x58')]=util[_0xc7d1('0x5d')](_0xc7d1('0x59'),_0x31b3db['remoteUri']);if(_0x40a555&&_0x40a555[_0xc7d1('0x6f')]&&_0x40a555[_0xc7d1('0x6f')]!=='none'){logger[_0xc7d1('0x29')](_0xc7d1('0x70'),_0xc7d1('0x71'));_0xa5de97['recordingURL']=util[_0xc7d1('0x5d')](_0xc7d1('0x5e'),_0x31b3db[_0xc7d1('0x56')],_0xa5de97['uniqueid'],md5(_0xa5de97['uniqueid']));}return getConnection(_0x31b3db)[_0xc7d1('0x3d')](function(_0x58734e){_0x3425f3=_0x58734e;return getUser(_0x31b3db,_0xb94e71['name'],_0x3425f3);})[_0xc7d1('0x3d')](function(_0x5bcbcc){_0x52430f=_0x5bcbcc;logger[_0xc7d1('0x29')](_0xc7d1('0x60'),_0x52430f['id']);return getEndUser(_0x31b3db,_0xa5de97[_0xc7d1('0x72')],_0xa5de97[_0xc7d1('0x73')],_0x3425f3);})[_0xc7d1('0x3d')](function(_0x25b0bf){_0x1618ff=_0x25b0bf;logger[_0xc7d1('0x29')]('The\x20Enduser\x20ID\x20is:',_0x1618ff['id']);return getTicket(_0x31b3db,_0x52430f,_0x1618ff,_0x115c29,_0xa5de97,_0x115c29[_0xc7d1('0x64')],_0x3425f3,_0xc7d1('0x74'));})[_0xc7d1('0x3d')](function(_0x508372){_0x2333f3=_0x508372;logger[_0xc7d1('0x29')](_0xc7d1('0x66'));logger[_0xc7d1('0x29')](_0xc7d1('0x67'),_0x2333f3['id']);return setRelationship(_0x3425f3,_0x52430f,_0x2333f3,_0xc7d1('0x75'));})[_0xc7d1('0x3d')](function(){return setRelationship(_0x3425f3,_0x1618ff,_0x2333f3,_0xc7d1('0x76'));})[_0xc7d1('0x3d')](function(){return getServerInfo(_0x3425f3);})[_0xc7d1('0x3d')](function(_0x5c630e){var _0x2f95c3=parseInt(_0x5c630e[_0xc7d1('0x68')][_0xc7d1('0x77')](0x0));var _0x115de8=util[_0xc7d1('0x5d')](_0xc7d1('0x69'),_0x31b3db[_0xc7d1('0x55')],_0x2333f3['id']);if(_0x2f95c3>0x6){_0x115de8=util['format'](_0xc7d1('0x6a'),_0x31b3db[_0xc7d1('0x55')],_0x2333f3['id']);}logger[_0xc7d1('0x29')](_0xc7d1('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc7d1('0x5d')]('user:%s',_0xb94e71[_0xc7d1('0xd')]),_0xc7d1('0x6b'),{'uri':_0x115de8});})[_0xc7d1('0x6c')](function(_0x3bb54b){logger[_0xc7d1('0x6d')](_0xc7d1('0x70'),JSON['stringify'](_0x3bb54b));});};exports['unmanaged']=function(_0x72f32a,_0x3027e0,_0x5a9c73,_0x4282ea,_0x2a6b99,_0x3152d4){var _0x34c231,_0x1054a8,_0x307a3e,_0x2f0414;_0x3152d4[_0xc7d1('0x55')]=intUtil[_0xc7d1('0x57')](_0x3152d4[_0xc7d1('0x55')]);_0x3152d4[_0xc7d1('0x56')]=intUtil['stripTrailingSlash'](_0x3152d4[_0xc7d1('0x56')]);def['uri']=util[_0xc7d1('0x5d')]('%s/service/v4_1/rest.php',_0x3152d4[_0xc7d1('0x55')]);if(_0x2a6b99&&_0x2a6b99['monitor_format']){logger['info']('['+_0x3027e0['lastevent'][_0xc7d1('0x78')]()+']','Recording\x20is\x20enabled!');_0x3027e0[_0xc7d1('0x5c')]=util['format'](_0xc7d1('0x5e'),_0x3152d4[_0xc7d1('0x56')],_0x3027e0['uniqueid'],md5(_0x3027e0[_0xc7d1('0x5f')]));}else{_0x3027e0[_0xc7d1('0x5c')]='';}return getConnection(_0x3152d4)[_0xc7d1('0x3d')](function(_0x15aa9a){_0x2f0414=_0x15aa9a;if(!_[_0xc7d1('0x28')](_0x4282ea)){return getUser(_0x3152d4,_0x4282ea['name'],_0x2f0414);}else{return getUser(_0x3152d4,null,_0x2f0414);}})[_0xc7d1('0x3d')](function(_0x2bab4e){_0x34c231=_0x2bab4e;logger['info'](_0xc7d1('0x60'),_0x34c231['id']);return getEndUser(_0x3152d4,_0x3027e0['calleridname'],_0x3027e0[_0xc7d1('0x62')],_0x2f0414);})['then'](function(_0x10870f){_0x1054a8=_0x10870f;logger[_0xc7d1('0x29')](_0xc7d1('0x63'),_0x1054a8['id']);return getTicket(_0x3152d4,_0x34c231,_0x1054a8,_0x5a9c73,_0x3027e0,_0x5a9c73['Fields'],_0x2f0414,_0xc7d1('0x65'));})[_0xc7d1('0x3d')](function(_0x5a1999){_0x307a3e=_0x5a1999;logger[_0xc7d1('0x29')]('Ticket\x20created!');logger[_0xc7d1('0x29')](_0xc7d1('0x67'),_0x307a3e['id']);return setRelationship(_0x2f0414,_0x34c231,_0x307a3e,_0xc7d1('0x75'));})[_0xc7d1('0x3d')](function(){return setRelationship(_0x2f0414,_0x1054a8,_0x307a3e,_0xc7d1('0x76'));})['then'](function(){return getServerInfo(_0x2f0414);})[_0xc7d1('0x6c')](function(_0x2a7124){logger[_0xc7d1('0x6d')]('['+_0x3027e0[_0xc7d1('0x79')]['toUpperCase']()+']',JSON[_0xc7d1('0x27')](_0x2a7124));});}; \ No newline at end of file +var _0xfe84=['JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','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','info','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\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','map','type','nameField','customField','content','string','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','outbound','stripTrailingSlash','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','lastevent','toUpperCase','isNil','The\x20Enduser\x20ID\x20is:','Fields','catch','lodash','request-promise','bluebird','md5','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','push','idField','set_entry'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xfe84,0xdb));var _0x4fe8=function(_0xf6763d,_0x1ee231){_0xf6763d=_0xf6763d-0x0;var _0x212ae2=_0xfe84[_0xf6763d];return _0x212ae2;};'use strict';var _=require(_0x4fe8('0x0'));var rp=require(_0x4fe8('0x1'));var BPromise=require(_0x4fe8('0x2'));var md5=require(_0x4fe8('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4fe8('0x4'));var logger=require(_0x4fe8('0x5'))(_0x4fe8('0x6'));config[_0x4fe8('0x7')]=_[_0x4fe8('0x8')](config[_0x4fe8('0x7')],{'host':_0x4fe8('0x9'),'port':0x18eb});var io=require(_0x4fe8('0xa'))(new Redis(config['redis']));var def={'method':_0x4fe8('0xb'),'json':!![]};function emit(_0x121f83,_0x31b7ee,_0x40bbfe){io['to'](_0x121f83)[_0x4fe8('0xc')](_0x31b7ee,_0x40bbfe);}function getTicket(_0x197179,_0x260d08,_0x69c591,_0x467290,_0x44c1ac,_0x4ed348,_0x248994,_0x91d864){logger['info'](_0x4fe8('0xd'));var _0x189299=new Date();var _0x268c97=[{'name':'name','value':intUtil[_0x4fe8('0xe')](_0x467290[_0x4fe8('0xf')],_0x44c1ac,'\x20')},{'name':_0x4fe8('0x10'),'value':_0x260d08['id']},{'name':'created_by','value':_0x260d08['id']},{'name':_0x4fe8('0x11'),'value':intUtil[_0x4fe8('0xe')](_0x467290[_0x4fe8('0x12')],_0x44c1ac,'\x0a')},{'name':'date_start','value':_0x189299[_0x4fe8('0x13')]()[_0x4fe8('0x14')](0x0,0x13)[_0x4fe8('0x15')]('T','\x20')},{'name':_0x4fe8('0x16'),'value':'0'},{'name':_0x4fe8('0x17'),'value':'15'},{'name':_0x4fe8('0x18'),'value':_0x69c591['id']},{'name':_0x4fe8('0x19'),'value':_0x4fe8('0x1a')},{'name':_0x4fe8('0x1b'),'value':_0x69c591[_0x4fe8('0x1c')]},{'name':_0x4fe8('0x1d'),'value':_0x91d864}];if(_0x4ed348['length']){_[_0x4fe8('0x1e')](_0x4ed348,function(_0x1aad30){if(_0x44c1ac[_0x1aad30[_0x4fe8('0x1f')]]){_0x268c97[_0x4fe8('0x20')]({'name':_0x1aad30[_0x4fe8('0x21')],'value':_0x44c1ac[_0x1aad30[_0x4fe8('0x1f')]]});}});}return request({'form':{'method':_0x4fe8('0x22'),'input_type':'JSON','response_type':_0x4fe8('0x23'),'rest_data':JSON[_0x4fe8('0x24')]({'session':_0x248994['id'],'module_name':_0x4fe8('0x25'),'name_value_list':_0x268c97})}});}function getAuth(_0x2aa342){return util[_0x4fe8('0x26')](_0x4fe8('0x27'),new Buffer(_0x2aa342['apiKey']+':X')[_0x4fe8('0x28')](_0x4fe8('0x29')));}function getServerInfo(_0xe1e7){return request({'form':{'method':_0x4fe8('0x2a'),'input_type':_0x4fe8('0x23'),'response_type':_0x4fe8('0x23'),'rest_data':JSON['stringify']({'session':_0xe1e7['id']})}});}function getUser(_0x344a22,_0x28b347,_0x2d1cdb){if(!_['isNil'](_0x28b347)){logger['info']('Getting\x20agent\x20with\x20name',_0x28b347);return request({'form':{'method':_0x4fe8('0x2b'),'input_type':_0x4fe8('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2d1cdb['id'],'module_name':_0x4fe8('0x2c'),'query':util[_0x4fe8('0x26')](_0x4fe8('0x2d'),_0x28b347),'order_by':'','offset':'0','select_fields':['id',_0x4fe8('0x1c'),_0x4fe8('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4fe8('0x2f')](function(_0x55718a){if(_0x55718a[_0x4fe8('0x30')][_0x4fe8('0x31')]){var _0x24e0da=_[_0x4fe8('0x32')](_0x55718a['entry_list'],function(_0x5d4427){return _0x5d4427[_0x4fe8('0x33')][_0x4fe8('0x2e')][_0x4fe8('0x34')]===_0x28b347;});if(_0x24e0da){logger[_0x4fe8('0x35')](_0x4fe8('0x36'));return BPromise[_0x4fe8('0x37')]({'id':_0x24e0da[_0x4fe8('0x33')]['id']['value'],'name':_0x24e0da[_0x4fe8('0x33')][_0x4fe8('0x1c')][_0x4fe8('0x34')]});}}logger[_0x4fe8('0x35')](_0x4fe8('0x38'));return BPromise['resolve']({'id':_0x2d1cdb[_0x4fe8('0x33')][_0x4fe8('0x39')][_0x4fe8('0x34')],'name':_0x2d1cdb[_0x4fe8('0x33')][_0x4fe8('0x2e')][_0x4fe8('0x34')]});});}else{logger[_0x4fe8('0x35')](_0x4fe8('0x3a'));return BPromise[_0x4fe8('0x37')]({'id':_0x2d1cdb[_0x4fe8('0x33')][_0x4fe8('0x39')][_0x4fe8('0x34')],'name':_0x2d1cdb['name_value_list'][_0x4fe8('0x2e')][_0x4fe8('0x34')]});}}function getEndUser(_0xfe2a76,_0x29a94e,_0x315313,_0x6730a6){logger[_0x4fe8('0x35')](_0x4fe8('0x3b'),_0x315313);return request({'form':{'method':_0x4fe8('0x2b'),'input_type':_0x4fe8('0x23'),'response_type':'JSON','rest_data':JSON[_0x4fe8('0x24')]({'session':_0x6730a6['id'],'module_name':_0x4fe8('0x1a'),'query':util[_0x4fe8('0x26')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x315313),'order_by':'','offset':'0','select_fields':['id',_0x4fe8('0x1c'),_0x4fe8('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4fe8('0x2f')](function(_0x303976){if(_0x303976[_0x4fe8('0x30')][_0x4fe8('0x31')]){var _0x1de51f=_[_0x4fe8('0x32')](_0x303976[_0x4fe8('0x30')],function(_0x2fc7c4){return _0x2fc7c4[_0x4fe8('0x33')]['phone_home'][_0x4fe8('0x34')]===_0x315313;});if(_0x1de51f){logger[_0x4fe8('0x35')](_0x4fe8('0x3d'));return BPromise['resolve']({'id':_0x1de51f['name_value_list']['id']['value'],'name':_0x1de51f[_0x4fe8('0x33')]['name']['value'],'phone':_0x1de51f['name_value_list'][_0x4fe8('0x3c')][_0x4fe8('0x34')]});}}else{logger[_0x4fe8('0x35')](_0x4fe8('0x3e'));return request({'form':{'method':_0x4fe8('0x22'),'input_type':_0x4fe8('0x23'),'response_type':_0x4fe8('0x23'),'rest_data':JSON[_0x4fe8('0x24')]({'session':_0x6730a6['id'],'module_name':'Contacts','name_value_list':[{'name':_0x4fe8('0x3f'),'value':_0x29a94e!==_0x4fe8('0x40')?_0x29a94e:util[_0x4fe8('0x26')](_0x4fe8('0x41'),_0x315313)},{'name':_0x4fe8('0x3c'),'value':_0x315313}]})}})['then'](function(_0x46057d){logger[_0x4fe8('0x35')](_0x4fe8('0x42'));return BPromise['resolve']({'id':_0x46057d['id'],'name':_0x46057d[_0x4fe8('0x30')]['first_name'][_0x4fe8('0x34')],'phone':_0x46057d[_0x4fe8('0x30')][_0x4fe8('0x3c')][_0x4fe8('0x34')]});});}});}function request(_0x1d37fa){logger['debug']('[HTTP]',JSON[_0x4fe8('0x24')](_0x1d37fa));return rp(_[_0x4fe8('0x43')](def,_0x1d37fa));}function getTags(_0x309827,_0x5516da){var _0x1e0dd1=[];if(_0x309827&&_0x309827[_0x4fe8('0x31')]>0x0){_0x1e0dd1=_[_0x4fe8('0x44')](_0x309827,_0x5516da);}return _0x1e0dd1;}function getCustomFields(_0x2fedde,_0x2bc79e){var _0x3169d1=[];var _0x3395c2={'custom_fields':[]};if(_0x2fedde[_0x4fe8('0x31')]>0x0){_[_0x4fe8('0x1e')](_0x2fedde,function(_0x1d8f0d){if(_0x1d8f0d[_0x4fe8('0x45')]==='string'&&_0x1d8f0d[_0x4fe8('0x46')]&&!_0x1d8f0d[_0x4fe8('0x47')]){_0x3395c2[_0x1d8f0d[_0x4fe8('0x46')]['toLowerCase']()]=_0x1d8f0d[_0x4fe8('0x48')][_0x4fe8('0x28')]();}else if(_0x1d8f0d[_0x4fe8('0x45')]===_0x4fe8('0x49')&&_0x1d8f0d[_0x4fe8('0x21')]&&_0x1d8f0d[_0x4fe8('0x47')]){_0x3395c2[_0x4fe8('0x4a')][_0x4fe8('0x20')]({'id':_0x1d8f0d['idField'],'value':_0x1d8f0d[_0x4fe8('0x48')][_0x4fe8('0x28')]()});}else if(_0x1d8f0d[_0x4fe8('0x45')]===_0x4fe8('0x4b')&&_0x1d8f0d[_0x4fe8('0x1f')]&&_0x1d8f0d[_0x4fe8('0x21')]&&_0x1d8f0d[_0x4fe8('0x47')]){_0x2bc79e[_0x1d8f0d[_0x4fe8('0x1f')]]&&_0x3395c2[_0x4fe8('0x4a')]['push']({'id':_0x1d8f0d['idField'],'value':_0x2bc79e[_0x1d8f0d[_0x4fe8('0x1f')]]['toString']()});}else if(_0x1d8f0d[_0x4fe8('0x45')]===_0x4fe8('0x4c')&&_0x1d8f0d[_0x4fe8('0x4d')]&&_0x1d8f0d[_0x4fe8('0x4d')][_0x4fe8('0x1c')]&&_0x1d8f0d['idField']&&_0x1d8f0d[_0x4fe8('0x47')]){_0x2bc79e[_0x1d8f0d[_0x4fe8('0x4d')][_0x4fe8('0x1c')][_0x4fe8('0x4e')]()]&&_0x3395c2['custom_fields']['push']({'id':_0x1d8f0d['idField'],'value':_0x2bc79e[_0x1d8f0d[_0x4fe8('0x4d')]['name']['toLowerCase']()][_0x4fe8('0x28')]()});}});}return _0x3395c2;}function getConnection(_0x2ba64a){return request({'method':_0x4fe8('0xb'),'form':{'method':_0x4fe8('0x4f'),'input_type':_0x4fe8('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2ba64a[_0x4fe8('0x50')],'password':_0x2ba64a[_0x4fe8('0x51')],'encryption':_0x4fe8('0x52')},'application':_0x4fe8('0x53')})}})[_0x4fe8('0x2f')](function(_0x21f624){var _0x37f786=_0x21f624;if(_0x37f786['id']){def[_0x4fe8('0x54')]=_0x37f786['id'];return BPromise[_0x4fe8('0x37')](_0x37f786);}else{throw new Error(util[_0x4fe8('0x26')](_0x4fe8('0x55'),_0x2ba64a['id']));}});}function setRelationship(_0x174ad1,_0x14853b,_0x15e834,_0x3c14ec){return request({'form':{'method':_0x4fe8('0x56'),'input_type':_0x4fe8('0x23'),'response_type':_0x4fe8('0x23'),'rest_data':JSON[_0x4fe8('0x24')]({'session':_0x174ad1['id'],'module_name':'Calls','module_id':_0x15e834['id'],'link_field_name':_0x3c14ec,'related_ids':[_0x14853b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4fe8('0x57')]=function(_0x9410c2,_0x1ad8ca,_0x2f01da,_0x4a4335,_0x570923,_0x10f72f){var _0x38b158,_0x332e72,_0x1856d1,_0x6138e2;_0x10f72f[_0x4fe8('0x58')]=intUtil['stripTrailingSlash'](_0x10f72f[_0x4fe8('0x58')]);_0x10f72f[_0x4fe8('0x59')]=intUtil['stripTrailingSlash'](_0x10f72f[_0x4fe8('0x59')]);def[_0x4fe8('0x5a')]=util[_0x4fe8('0x26')](_0x4fe8('0x5b'),_0x10f72f[_0x4fe8('0x58')]);if(_0x570923&&_0x570923[_0x4fe8('0x5c')]){logger['info'](_0x4fe8('0x5d'),_0x4fe8('0x5e'));_0x1ad8ca['recordingURL']=util[_0x4fe8('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10f72f[_0x4fe8('0x59')],_0x1ad8ca['uniqueid'],md5(_0x1ad8ca['uniqueid']));}else{_0x1ad8ca[_0x4fe8('0x5f')]='';}return getConnection(_0x10f72f)[_0x4fe8('0x2f')](function(_0x102544){_0x6138e2=_0x102544;return getUser(_0x10f72f,_0x4a4335[_0x4fe8('0x1c')],_0x6138e2);})[_0x4fe8('0x2f')](function(_0x1eaccb){_0x38b158=_0x1eaccb;logger['info'](_0x4fe8('0x60'),_0x38b158['id']);return getEndUser(_0x10f72f,_0x1ad8ca[_0x4fe8('0x61')],_0x1ad8ca[_0x4fe8('0x62')],_0x6138e2);})[_0x4fe8('0x2f')](function(_0x40dc70){_0x332e72=_0x40dc70;logger[_0x4fe8('0x35')]('The\x20Enduser\x20ID\x20is:',_0x332e72['id']);return getTicket(_0x10f72f,_0x38b158,_0x332e72,_0x2f01da,_0x1ad8ca,_0x2f01da['Fields'],_0x6138e2,_0x4fe8('0x63'));})[_0x4fe8('0x2f')](function(_0x2921c9){_0x1856d1=_0x2921c9;logger['info'](_0x4fe8('0x64'));logger[_0x4fe8('0x35')](_0x4fe8('0x65'),_0x1856d1['id']);return setRelationship(_0x6138e2,_0x38b158,_0x1856d1,_0x4fe8('0x66'));})[_0x4fe8('0x2f')](function(){return setRelationship(_0x6138e2,_0x332e72,_0x1856d1,_0x4fe8('0x67'));})[_0x4fe8('0x2f')](function(){return getServerInfo(_0x6138e2);})[_0x4fe8('0x2f')](function(_0x32f4e8){var _0x4e511b=parseInt(_0x32f4e8['version'][_0x4fe8('0x68')](0x0));var _0x39c1b1=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x10f72f[_0x4fe8('0x58')],_0x1856d1['id']);if(_0x4e511b>0x6){_0x39c1b1=util['format'](_0x4fe8('0x69'),_0x10f72f['remoteUri'],_0x1856d1['id']);}logger[_0x4fe8('0x35')](_0x4fe8('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4fe8('0x26')](_0x4fe8('0x6a'),_0x4a4335['name']),_0x4fe8('0x6b'),{'uri':_0x39c1b1});})['catch'](function(_0x40774e){logger[_0x4fe8('0x6c')](_0x4fe8('0x5d'),JSON[_0x4fe8('0x24')](_0x40774e));});};exports[_0x4fe8('0x6d')]=function(_0x358bd4,_0x4175aa,_0x21b359,_0x4f6c6b,_0x568a7f,_0x48d46b,_0x49e122){var _0x5b4ccd,_0xbaf2c3,_0x52fb2b,_0x30ac5b;_0x48d46b[_0x4fe8('0x58')]=intUtil[_0x4fe8('0x6e')](_0x48d46b[_0x4fe8('0x58')]);_0x48d46b['serverUrl']=intUtil[_0x4fe8('0x6e')](_0x48d46b[_0x4fe8('0x59')]);def[_0x4fe8('0x5a')]=util[_0x4fe8('0x26')](_0x4fe8('0x5b'),_0x48d46b[_0x4fe8('0x58')]);if(_0x49e122&&_0x49e122[_0x4fe8('0x6f')]&&_0x49e122['recordingFormat']!==_0x4fe8('0x70')){logger[_0x4fe8('0x35')]('[OUTBOUND]',_0x4fe8('0x5e'));_0x4175aa['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x48d46b[_0x4fe8('0x59')],_0x4175aa[_0x4fe8('0x71')],md5(_0x4175aa[_0x4fe8('0x71')]));}return getConnection(_0x48d46b)[_0x4fe8('0x2f')](function(_0x512f87){_0x30ac5b=_0x512f87;return getUser(_0x48d46b,_0x4f6c6b[_0x4fe8('0x1c')],_0x30ac5b);})[_0x4fe8('0x2f')](function(_0x558a0a){_0x5b4ccd=_0x558a0a;logger[_0x4fe8('0x35')](_0x4fe8('0x60'),_0x5b4ccd['id']);return getEndUser(_0x48d46b,_0x4175aa[_0x4fe8('0x72')],_0x4175aa[_0x4fe8('0x73')],_0x30ac5b);})['then'](function(_0x5192e6){_0xbaf2c3=_0x5192e6;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbaf2c3['id']);return getTicket(_0x48d46b,_0x5b4ccd,_0xbaf2c3,_0x21b359,_0x4175aa,_0x21b359['Fields'],_0x30ac5b,_0x4fe8('0x74'));})[_0x4fe8('0x2f')](function(_0x574501){_0x52fb2b=_0x574501;logger['info'](_0x4fe8('0x64'));logger[_0x4fe8('0x35')](_0x4fe8('0x65'),_0x52fb2b['id']);return setRelationship(_0x30ac5b,_0x5b4ccd,_0x52fb2b,_0x4fe8('0x66'));})[_0x4fe8('0x2f')](function(){return setRelationship(_0x30ac5b,_0xbaf2c3,_0x52fb2b,'contacts');})[_0x4fe8('0x2f')](function(){return getServerInfo(_0x30ac5b);})['then'](function(_0x292bf4){var _0x18be1e=parseInt(_0x292bf4['version'][_0x4fe8('0x68')](0x0));var _0x29438e=util[_0x4fe8('0x26')](_0x4fe8('0x75'),_0x48d46b[_0x4fe8('0x58')],_0x52fb2b['id']);if(_0x18be1e>0x6){_0x29438e=util[_0x4fe8('0x26')](_0x4fe8('0x69'),_0x48d46b[_0x4fe8('0x58')],_0x52fb2b['id']);}logger[_0x4fe8('0x35')]('[OUTBOUND]',_0x4fe8('0x76'));emit(util['format']('user:%s',_0x4f6c6b[_0x4fe8('0x1c')]),'trigger:browser:url',{'uri':_0x29438e});})['catch'](function(_0x312e45){logger[_0x4fe8('0x6c')](_0x4fe8('0x77'),JSON[_0x4fe8('0x24')](_0x312e45));});};exports[_0x4fe8('0x78')]=function(_0x52114a,_0x23b658,_0x1abe00,_0x5b339f,_0x297a93,_0x38e44c){var _0x442206,_0x3c9e75,_0x34ca63,_0xf83db3;_0x38e44c[_0x4fe8('0x58')]=intUtil[_0x4fe8('0x6e')](_0x38e44c['remoteUri']);_0x38e44c['serverUrl']=intUtil[_0x4fe8('0x6e')](_0x38e44c[_0x4fe8('0x59')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x38e44c[_0x4fe8('0x58')]);if(_0x297a93&&_0x297a93[_0x4fe8('0x5c')]){logger['info']('['+_0x23b658[_0x4fe8('0x79')][_0x4fe8('0x7a')]()+']',_0x4fe8('0x5e'));_0x23b658[_0x4fe8('0x5f')]=util[_0x4fe8('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38e44c[_0x4fe8('0x59')],_0x23b658[_0x4fe8('0x71')],md5(_0x23b658[_0x4fe8('0x71')]));}else{_0x23b658[_0x4fe8('0x5f')]='';}return getConnection(_0x38e44c)['then'](function(_0x37713e){_0xf83db3=_0x37713e;if(!_[_0x4fe8('0x7b')](_0x5b339f)){return getUser(_0x38e44c,_0x5b339f[_0x4fe8('0x1c')],_0xf83db3);}else{return getUser(_0x38e44c,null,_0xf83db3);}})[_0x4fe8('0x2f')](function(_0x50ea8d){_0x442206=_0x50ea8d;logger[_0x4fe8('0x35')](_0x4fe8('0x60'),_0x442206['id']);return getEndUser(_0x38e44c,_0x23b658[_0x4fe8('0x61')],_0x23b658[_0x4fe8('0x62')],_0xf83db3);})[_0x4fe8('0x2f')](function(_0x1d4e78){_0x3c9e75=_0x1d4e78;logger['info'](_0x4fe8('0x7c'),_0x3c9e75['id']);return getTicket(_0x38e44c,_0x442206,_0x3c9e75,_0x1abe00,_0x23b658,_0x1abe00[_0x4fe8('0x7d')],_0xf83db3,_0x4fe8('0x63'));})['then'](function(_0xf552aa){_0x34ca63=_0xf552aa;logger['info'](_0x4fe8('0x64'));logger[_0x4fe8('0x35')](_0x4fe8('0x65'),_0x34ca63['id']);return setRelationship(_0xf83db3,_0x442206,_0x34ca63,'users');})[_0x4fe8('0x2f')](function(){return setRelationship(_0xf83db3,_0x3c9e75,_0x34ca63,_0x4fe8('0x67'));})[_0x4fe8('0x2f')](function(){return getServerInfo(_0xf83db3);})[_0x4fe8('0x7e')](function(_0x57a763){logger[_0x4fe8('0x6c')]('['+_0x23b658[_0x4fe8('0x79')][_0x4fe8('0x7a')]()+']',JSON[_0x4fe8('0x24')](_0x57a763));});}; \ 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 76209b4..47c9f1c 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 _0xb968=['format','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','Variable','toLowerCase','name','keyValue','keyType','key'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xb968,0x1ba));var _0x8b96=function(_0x261320,_0x9df160){_0x261320=_0x261320-0x0;var _0x161228=_0xb968[_0x261320];return _0x161228;};'use strict';var _=require(_0x8b96('0x0'));var util=require(_0x8b96('0x1'));exports[_0x8b96('0x2')]=function(_0x34768a,_0x53e850,_0x464b4f){var _0x142f15=[];if(_0x34768a[_0x8b96('0x3')]>0x0){var _0x213c99=_[_0x8b96('0x4')](_0x34768a,['id']);for(var _0x259fd2=0x0;_0x259fd2<_0x213c99[_0x8b96('0x3')];_0x259fd2++){var _0x38da59=_0x213c99[_0x259fd2];if(_0x38da59[_0x8b96('0x5')]===_0x8b96('0x6')){_0x142f15[_0x8b96('0x7')](_0x38da59['content']);}else if(_0x38da59[_0x8b96('0x5')]===_0x8b96('0x8')&&_0x38da59[_0x8b96('0x9')]){_0x53e850[_0x38da59[_0x8b96('0x9')]]&&_0x142f15[_0x8b96('0x7')](_0x53e850[_0x38da59['variableName']][_0x8b96('0xa')]());}else if(_0x38da59[_0x8b96('0x5')]==='customVariable'&&_0x38da59[_0x8b96('0xb')]&&_0x38da59[_0x8b96('0xb')]['name']){_0x53e850[_0x38da59[_0x8b96('0xb')]['name'][_0x8b96('0xc')]()]&&_0x142f15[_0x8b96('0x7')](_0x53e850[_0x38da59[_0x8b96('0xb')][_0x8b96('0xd')][_0x8b96('0xc')]()][_0x8b96('0xa')]());}else if(_0x38da59['type']===_0x8b96('0xe')){if(_0x38da59[_0x8b96('0xf')]===_0x8b96('0x6')&&_0x38da59[_0x8b96('0x10')]){_0x142f15[_0x8b96('0x7')](util[_0x8b96('0x11')](_0x8b96('0x12'),_0x38da59[_0x8b96('0x10')],_0x38da59[_0x8b96('0x13')]));}else if(_0x38da59[_0x8b96('0xf')]==='variable'&&_0x38da59[_0x8b96('0x9')]&&_0x38da59['key']){_0x53e850[_0x38da59['variableName']]&&_0x142f15[_0x8b96('0x7')](util[_0x8b96('0x11')](_0x8b96('0x12'),_0x38da59[_0x8b96('0x10')],_0x53e850[_0x38da59['variableName']]));}else if(_0x38da59[_0x8b96('0xf')]===_0x8b96('0x14')&&_0x38da59[_0x8b96('0xb')]&&_0x38da59['Variable'][_0x8b96('0xd')]&&_0x38da59['key']){_0x53e850[_0x38da59[_0x8b96('0xb')]['name']['toLowerCase']()]&&_0x142f15[_0x8b96('0x7')](util[_0x8b96('0x11')](_0x8b96('0x12'),_0x38da59[_0x8b96('0x10')],_0x53e850[_0x38da59[_0x8b96('0xb')][_0x8b96('0xd')]['toLowerCase']()]));}}}}return _0x142f15[_0x8b96('0x15')](_0x464b4f);};exports[_0x8b96('0x16')]=function(_0x1c2014){var _0x1522c6=_0x1c2014[_0x8b96('0x17')](-0x1);if(_0x1522c6==='/'){_0x1c2014=_0x1c2014[_0x8b96('0x18')](0x0,_0x1c2014['lastIndexOf'](_0x1522c6));}return _0x1c2014;};exports[_0x8b96('0x19')]=function(_0x502a0a){if(!_[_0x8b96('0x1a')](_0x502a0a)&&_0x502a0a!==''){var _0x18032f=/^(([^<>()\[\]\\.,;:\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 _0x18032f['test'](String(_0x502a0a)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xde3a=['name','toLowerCase','keyValue','keyType','%s:\x20%s','key','keyContent','format','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','length','string','push','content','variable','variableName','toString','customVariable','Variable'];(function(_0x3df1ca,_0x49fb2a){var _0x5e7db8=function(_0x5aad74){while(--_0x5aad74){_0x3df1ca['push'](_0x3df1ca['shift']());}};_0x5e7db8(++_0x49fb2a);}(_0xde3a,0x13b));var _0xade3=function(_0x248c93,_0x59546d){_0x248c93=_0x248c93-0x0;var _0x532ca3=_0xde3a[_0x248c93];return _0x532ca3;};'use strict';var _=require(_0xade3('0x0'));var util=require('util');exports['getString']=function(_0xec7475,_0xc6ccc0,_0x5f2e89){var _0x3093fc=[];if(_0xec7475[_0xade3('0x1')]>0x0){var _0x5c12e2=_['sortBy'](_0xec7475,['id']);for(var _0x2a0e49=0x0;_0x2a0e49<_0x5c12e2[_0xade3('0x1')];_0x2a0e49++){var _0x247454=_0x5c12e2[_0x2a0e49];if(_0x247454['type']===_0xade3('0x2')){_0x3093fc[_0xade3('0x3')](_0x247454[_0xade3('0x4')]);}else if(_0x247454['type']===_0xade3('0x5')&&_0x247454[_0xade3('0x6')]){_0xc6ccc0[_0x247454[_0xade3('0x6')]]&&_0x3093fc['push'](_0xc6ccc0[_0x247454['variableName']][_0xade3('0x7')]());}else if(_0x247454['type']===_0xade3('0x8')&&_0x247454[_0xade3('0x9')]&&_0x247454['Variable'][_0xade3('0xa')]){_0xc6ccc0[_0x247454[_0xade3('0x9')][_0xade3('0xa')][_0xade3('0xb')]()]&&_0x3093fc[_0xade3('0x3')](_0xc6ccc0[_0x247454[_0xade3('0x9')][_0xade3('0xa')][_0xade3('0xb')]()][_0xade3('0x7')]());}else if(_0x247454['type']===_0xade3('0xc')){if(_0x247454[_0xade3('0xd')]===_0xade3('0x2')&&_0x247454['key']){_0x3093fc['push'](util['format'](_0xade3('0xe'),_0x247454[_0xade3('0xf')],_0x247454[_0xade3('0x10')]));}else if(_0x247454[_0xade3('0xd')]==='variable'&&_0x247454[_0xade3('0x6')]&&_0x247454[_0xade3('0xf')]){_0xc6ccc0[_0x247454[_0xade3('0x6')]]&&_0x3093fc[_0xade3('0x3')](util['format'](_0xade3('0xe'),_0x247454['key'],_0xc6ccc0[_0x247454[_0xade3('0x6')]]));}else if(_0x247454['keyType']===_0xade3('0x8')&&_0x247454['Variable']&&_0x247454[_0xade3('0x9')][_0xade3('0xa')]&&_0x247454[_0xade3('0xf')]){_0xc6ccc0[_0x247454[_0xade3('0x9')][_0xade3('0xa')]['toLowerCase']()]&&_0x3093fc['push'](util[_0xade3('0x11')](_0xade3('0xe'),_0x247454['key'],_0xc6ccc0[_0x247454['Variable'][_0xade3('0xa')][_0xade3('0xb')]()]));}}}}return _0x3093fc[_0xade3('0x12')](_0x5f2e89);};exports[_0xade3('0x13')]=function(_0x16cf16){var _0x85eecb=_0x16cf16[_0xade3('0x14')](-0x1);if(_0x85eecb==='/'){_0x16cf16=_0x16cf16['substring'](0x0,_0x16cf16[_0xade3('0x15')](_0x85eecb));}return _0x16cf16;};exports[_0xade3('0x16')]=function(_0xb348a0){if(!_[_0xade3('0x17')](_0xb348a0)&&_0xb348a0!==''){var _0x9a19a3=/^(([^<>()\[\]\\.,;:\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 _0x9a19a3[_0xade3('0x18')](String(_0xb348a0)[_0xade3('0xb')]());}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 daf4855..4e41be0 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _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(_0x4593e2,_0x4de5f0){var _0x8c7ce2=function(_0x116450){while(--_0x116450){_0x4593e2['push'](_0x4593e2['shift']());}};_0x8c7ce2(++_0x4de5f0);}(_0xe706,0xa3));var _0x6e70=function(_0x13af04,_0x34696c){_0x13af04=_0x13af04-0x0;var _0xd04e49=_0xe706[_0x13af04];return _0xd04e49;};'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 4ad49fd..86d1937 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 _0x3ecc=['/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','catch','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','format','%s/tickets.json','POST','merge','Tags','Subjects','getString','Descriptions','Fields','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','%s/users.json','Caller\x20-\x20%s','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','GET','map','forEach','string','picklist','type','nameField','toLowerCase','idField','customField','variableName','custom_fields','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3ecc,0x1b2));var _0xc3ec=function(_0x4a3182,_0x3f674b){_0x4a3182=_0x4a3182-0x0;var _0x333f22=_0x3ecc[_0x4a3182];return _0x333f22;};'use strict';var _=require('lodash');var rp=require(_0xc3ec('0x0'));var md5=require('md5');var util=require(_0xc3ec('0x1'));var Redis=require('ioredis');var intUtil=require(_0xc3ec('0x2'));var config=require(_0xc3ec('0x3'));var logger=require(_0xc3ec('0x4'))(_0xc3ec('0x5'));config[_0xc3ec('0x6')]=_[_0xc3ec('0x7')](config[_0xc3ec('0x6')],{'host':_0xc3ec('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc3ec('0x6')]));function emit(_0x497694,_0x18c850,_0x31cffa){io['to'](_0x497694)[_0xc3ec('0x9')](_0x18c850,_0x31cffa);}var headers={'Content-Type':_0xc3ec('0xa'),'Accept':'application/json'};function getTicket(_0x42687b,_0x1144c7,_0x3d13cc,_0x45f5e0,_0x1885f3){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0xc'),_0x42687b['remoteUri']),'method':_0xc3ec('0xd'),'body':{'ticket':_[_0xc3ec('0xe')]({'requester_id':_0x3d13cc['id'],'submitter_id':_0x1144c7?_0x1144c7['id']:undefined,'assignee_id':_0x1144c7?_0x1144c7['id']:undefined,'tags':getTags(_0x45f5e0[_0xc3ec('0xf')],'name'),'subject':intUtil['getString'](_0x45f5e0[_0xc3ec('0x10')],_0x1885f3,'\x20'),'description':intUtil[_0xc3ec('0x11')](_0x45f5e0[_0xc3ec('0x12')],_0x1885f3,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x45f5e0[_0xc3ec('0x12')],_0x1885f3,'\x0a')}},getCustomFields(_0x45f5e0[_0xc3ec('0x13')],_0x1885f3))}})['then'](function(_0x35e8a4){logger[_0xc3ec('0x14')](_0xc3ec('0x15'));return _0x35e8a4[_0xc3ec('0x16')];});}function getUser(_0x28570c,_0x147e03){if(intUtil[_0xc3ec('0x17')](_0x147e03)){logger[_0xc3ec('0x14')](_0xc3ec('0x18'),_0x147e03);return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x19'),_0x28570c[_0xc3ec('0x1a')]),'qs':{'query':util[_0xc3ec('0xb')](_0xc3ec('0x1b'),_0x147e03)}})[_0xc3ec('0x1c')](function(_0x2adfc9){if(_0x2adfc9[_0xc3ec('0x1d')]){logger[_0xc3ec('0x14')](_0xc3ec('0x1e'));return _[_0xc3ec('0x1f')](_0x2adfc9[_0xc3ec('0x20')],{'email':_0x147e03,'role':'agent'});}else{logger[_0xc3ec('0x14')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xc3ec('0x21'),_0x28570c['remoteUri'])})['then'](function(_0x4ba947){logger[_0xc3ec('0x14')](_0xc3ec('0x22'));return _0x4ba947[_0xc3ec('0x23')];});}});}else{logger[_0xc3ec('0x14')](_0xc3ec('0x24'));return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x21'),_0x28570c[_0xc3ec('0x1a')])})[_0xc3ec('0x1c')](function(_0x2ee1da){logger[_0xc3ec('0x14')](_0xc3ec('0x22'));return _0x2ee1da[_0xc3ec('0x23')];});}}function getEndUser(_0x5c36d4,_0x504d53,_0x3e58de){logger[_0xc3ec('0x14')](_0xc3ec('0x25'),_0x3e58de);return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x19'),_0x5c36d4[_0xc3ec('0x1a')]),'qs':{'query':util[_0xc3ec('0xb')](_0xc3ec('0x26'),_0x3e58de)}})['then'](function(_0x46d463){var _0xf3e0d4;if(_0x46d463[_0xc3ec('0x20')][_0xc3ec('0x27')]){_0x46d463[_0xc3ec('0x20')]=_[_0xc3ec('0x28')](_0x46d463[_0xc3ec('0x20')],{'suspended':![],'role':_0xc3ec('0x29')});if(_0x46d463[_0xc3ec('0x20')]['length']){_0xf3e0d4=_[_0xc3ec('0x2a')](_0x46d463[_0xc3ec('0x20')]);}}if(_0xf3e0d4){logger[_0xc3ec('0x14')]('Enduser\x20found!');return _0xf3e0d4;}else{logger[_0xc3ec('0x14')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x2b'),_0x5c36d4[_0xc3ec('0x1a')]),'method':'POST','body':{'user':{'role':_0xc3ec('0x29'),'name':util['format'](_0xc3ec('0x2c'),_0x504d53||_0x3e58de),'phone':_0x3e58de}}})[_0xc3ec('0x1c')](function(_0x514e82){logger[_0xc3ec('0x14')]('Enduser\x20created.');return _0x514e82[_0xc3ec('0x23')];});}});}function getAuth(_0x5ed146){var _0x585405;if(_0x5ed146[_0xc3ec('0x2d')]===_0xc3ec('0x2e')){_0x585405=util[_0xc3ec('0xb')]('%s:%s',_0x5ed146['username'],_0x5ed146[_0xc3ec('0x2e')]);}else if(_0x5ed146[_0xc3ec('0x2d')]===_0xc3ec('0x2f')){_0x585405=util[_0xc3ec('0xb')](_0xc3ec('0x30'),_0x5ed146[_0xc3ec('0x31')],_0x5ed146['token']);}return util[_0xc3ec('0xb')](_0xc3ec('0x32'),new Buffer(_0x585405)[_0xc3ec('0x33')]('base64'));}function request(_0x3e6136){logger[_0xc3ec('0x34')](_0xc3ec('0x35'),JSON['stringify'](_0x3e6136));return rp(_[_0xc3ec('0x7')](_0x3e6136,{'method':_0xc3ec('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x5cf4c0,_0x5281c1){var _0x8c1157=[];if(_0x5cf4c0&&_0x5cf4c0['length']>0x0){_0x8c1157=_[_0xc3ec('0x37')](_0x5cf4c0,_0x5281c1);}return _0x8c1157;}function getCustomFields(_0x202e5a,_0x474444){var _0x2e1d90=[];var _0x37d80a={'custom_fields':[]};if(_0x202e5a[_0xc3ec('0x27')]>0x0){_[_0xc3ec('0x38')](_0x202e5a,function(_0x4cd999){if(_['includes']([_0xc3ec('0x39'),_0xc3ec('0x3a')],_0x4cd999[_0xc3ec('0x3b')])&&_0x4cd999[_0xc3ec('0x3c')]&&!_0x4cd999['customField']){_0x37d80a[_0x4cd999[_0xc3ec('0x3c')][_0xc3ec('0x3d')]()]=_0x4cd999['content'][_0xc3ec('0x33')]();}else if(_['includes']([_0xc3ec('0x39'),'picklist'],_0x4cd999[_0xc3ec('0x3b')])&&_0x4cd999[_0xc3ec('0x3e')]&&_0x4cd999[_0xc3ec('0x3f')]){_0x37d80a['custom_fields']['push']({'id':_0x4cd999[_0xc3ec('0x3e')],'value':_0x4cd999['content'][_0xc3ec('0x33')]()});}else if(_0x4cd999[_0xc3ec('0x3b')]==='variable'&&_0x4cd999[_0xc3ec('0x40')]&&_0x4cd999[_0xc3ec('0x3e')]&&_0x4cd999[_0xc3ec('0x3f')]){_0x474444[_0x4cd999['variableName']]&&_0x37d80a[_0xc3ec('0x41')][_0xc3ec('0x42')]({'id':_0x4cd999['idField'],'value':_0x474444[_0x4cd999[_0xc3ec('0x40')]][_0xc3ec('0x33')]()});}else if(_0x4cd999[_0xc3ec('0x3b')]===_0xc3ec('0x43')&&_0x4cd999[_0xc3ec('0x44')]&&_0x4cd999[_0xc3ec('0x44')][_0xc3ec('0x45')]&&_0x4cd999[_0xc3ec('0x3e')]&&_0x4cd999[_0xc3ec('0x3f')]){_0x474444[_0x4cd999[_0xc3ec('0x44')][_0xc3ec('0x45')][_0xc3ec('0x3d')]()]&&_0x37d80a['custom_fields']['push']({'id':_0x4cd999['idField'],'value':_0x474444[_0x4cd999[_0xc3ec('0x44')][_0xc3ec('0x45')][_0xc3ec('0x3d')]()][_0xc3ec('0x33')]()});}});}return _0x37d80a;}exports[_0xc3ec('0x46')]=function(_0x437178,_0x2bd7a7,_0x1712c7,_0x59b7f6,_0x4a3e9c,_0x274359){var _0x322c45,_0x5b82d7;_0x274359[_0xc3ec('0x1a')]=intUtil[_0xc3ec('0x47')](_0x274359[_0xc3ec('0x1a')]);_0x274359['serverUrl']=intUtil[_0xc3ec('0x47')](_0x274359[_0xc3ec('0x48')]);if(_0x4a3e9c&&_0x4a3e9c[_0xc3ec('0x49')]){logger[_0xc3ec('0x14')](_0xc3ec('0x4a'),_0xc3ec('0x4b'));_0x2bd7a7[_0xc3ec('0x4c')]=util[_0xc3ec('0xb')](_0xc3ec('0x4d'),_0x274359[_0xc3ec('0x48')],_0x2bd7a7[_0xc3ec('0x4e')],md5(_0x2bd7a7[_0xc3ec('0x4e')]));}else{_0x2bd7a7['recordingURL']='';}headers[_0xc3ec('0x4f')]=getAuth(_0x274359);return getUser(_0x274359,_0x59b7f6['email'])[_0xc3ec('0x1c')](function(_0x1e7736){_0x322c45=_0x1e7736;logger[_0xc3ec('0x14')]('The\x20User\x20ID\x20is:',_0x322c45['id']);return getEndUser(_0x274359,_0x2bd7a7[_0xc3ec('0x50')],_0x2bd7a7['calleridnum']);})[_0xc3ec('0x1c')](function(_0x48b37f){_0x5b82d7=_0x48b37f;logger[_0xc3ec('0x14')](_0xc3ec('0x51'),_0x5b82d7['id']);return getTicket(_0x274359,_0x322c45,_0x5b82d7,_0x1712c7,_0x2bd7a7);})[_0xc3ec('0x1c')](function(_0x301c15){if(_0x301c15){logger[_0xc3ec('0x14')](_0xc3ec('0x52'),_0x301c15['id']);switch(_0x274359[_0xc3ec('0x3b')]){case _0xc3ec('0x53'):logger[_0xc3ec('0x14')](_0xc3ec('0x4a'),_0xc3ec('0x54'));return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x55'),_0x274359[_0xc3ec('0x1a')],_0x322c45['id'],_0x301c15['id']),'method':_0xc3ec('0xd')});case _0xc3ec('0x56'):logger[_0xc3ec('0x14')]('[QUEUE]',_0xc3ec('0x57'));emit(util['format']('user:%s',_0x59b7f6[_0xc3ec('0x45')]),_0xc3ec('0x58'),{'uri':util['format'](_0xc3ec('0x59'),_0x274359['remoteUri'][_0xc3ec('0x5a')](_0xc3ec('0x5b'),''),_0x301c15['id'])});break;default:logger['error']('[QUEUE]',_0xc3ec('0x5c'));}}})['catch'](function(_0x1c4e41){logger['error'](_0xc3ec('0x5d'),util[_0xc3ec('0x5e')](_0x1c4e41,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x265ba7,_0x59e2ff,_0x3d36d5,_0x491d49,_0x146c91,_0x220601,_0x4fd257){var _0x57bbb3,_0x42a67d;_0x220601[_0xc3ec('0x1a')]=intUtil[_0xc3ec('0x47')](_0x220601[_0xc3ec('0x1a')]);_0x220601[_0xc3ec('0x48')]=intUtil[_0xc3ec('0x47')](_0x220601['serverUrl']);if(_0x4fd257&&_0x4fd257[_0xc3ec('0x5f')]&&_0x4fd257[_0xc3ec('0x5f')]!=='none'){logger[_0xc3ec('0x14')](_0xc3ec('0x60'),_0xc3ec('0x4b'));_0x59e2ff[_0xc3ec('0x4c')]=util[_0xc3ec('0xb')](_0xc3ec('0x4d'),_0x220601[_0xc3ec('0x48')],_0x59e2ff[_0xc3ec('0x4e')],md5(_0x59e2ff[_0xc3ec('0x4e')]));}headers['Authorization']=getAuth(_0x220601);return getUser(_0x220601,_0x491d49[_0xc3ec('0x61')])['then'](function(_0x104e9a){_0x57bbb3=_0x104e9a;logger['info'](_0xc3ec('0x62'),_0x57bbb3['id']);return getEndUser(_0x220601,_0x59e2ff[_0xc3ec('0x63')],_0x59e2ff['destcalleridnum']);})[_0xc3ec('0x1c')](function(_0x21b629){_0x42a67d=_0x21b629;logger[_0xc3ec('0x14')](_0xc3ec('0x51'),_0x42a67d['id']);return getTicket(_0x220601,_0x57bbb3,_0x42a67d,_0x3d36d5,_0x59e2ff);})['then'](function(_0x7c21a1){if(_0x7c21a1){logger[_0xc3ec('0x14')](_0xc3ec('0x52'),_0x7c21a1['id']);switch(_0x220601[_0xc3ec('0x3b')]){case'integrationTab':logger[_0xc3ec('0x14')](_0xc3ec('0x60'),_0xc3ec('0x54'));return request({'uri':util[_0xc3ec('0xb')](_0xc3ec('0x55'),_0x220601['remoteUri'],_0x57bbb3['id'],_0x7c21a1['id']),'method':_0xc3ec('0xd')});case'newTab':logger[_0xc3ec('0x14')](_0xc3ec('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3ec('0xb')]('user:%s',_0x491d49[_0xc3ec('0x45')]),_0xc3ec('0x58'),{'uri':util[_0xc3ec('0xb')](_0xc3ec('0x59'),_0x220601[_0xc3ec('0x1a')][_0xc3ec('0x5a')](_0xc3ec('0x5b'),''),_0x7c21a1['id'])});break;default:logger[_0xc3ec('0x64')](_0xc3ec('0x60'),_0xc3ec('0x5c'));}}})['catch'](function(_0x42d00c){logger[_0xc3ec('0x64')](_0xc3ec('0x65'),util[_0xc3ec('0x5e')](_0x42d00c,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x956157,_0x4e9ca7,_0x5785cb,_0x2af900,_0x749d9e,_0x1f4d45){var _0x3e783d,_0x1a8482;_0x1f4d45[_0xc3ec('0x1a')]=intUtil['stripTrailingSlash'](_0x1f4d45['remoteUri']);_0x1f4d45[_0xc3ec('0x48')]=intUtil[_0xc3ec('0x47')](_0x1f4d45[_0xc3ec('0x48')]);if(_0x749d9e&&_0x749d9e[_0xc3ec('0x49')]){logger['info']('['+_0x4e9ca7[_0xc3ec('0x66')][_0xc3ec('0x67')]()+']','Recording\x20is\x20enabled!');_0x4e9ca7[_0xc3ec('0x4c')]=util[_0xc3ec('0xb')](_0xc3ec('0x4d'),_0x1f4d45[_0xc3ec('0x48')],_0x4e9ca7[_0xc3ec('0x4e')],md5(_0x4e9ca7[_0xc3ec('0x4e')]));}else{_0x4e9ca7['recordingURL']='';}headers[_0xc3ec('0x4f')]=getAuth(_0x1f4d45);return getUser(_0x1f4d45)['then'](function(_0x4d4345){_0x3e783d=_0x4d4345;logger[_0xc3ec('0x14')](_0xc3ec('0x62'),_0x3e783d['id']);return getEndUser(_0x1f4d45,_0x4e9ca7[_0xc3ec('0x50')],_0x4e9ca7['calleridnum']);})[_0xc3ec('0x1c')](function(_0xb1e67c){_0x1a8482=_0xb1e67c;logger[_0xc3ec('0x14')](_0xc3ec('0x51'),_0x1a8482['id']);return getTicket(_0x1f4d45,_0x3e783d,_0x1a8482,_0x5785cb,_0x4e9ca7);})[_0xc3ec('0x1c')](function(_0x14e1a5){if(_0x14e1a5){logger[_0xc3ec('0x14')](_0xc3ec('0x52'),_0x14e1a5['id']);}})[_0xc3ec('0x68')](function(_0x3538bc){logger['error']('['+_0x4e9ca7[_0xc3ec('0x66')][_0xc3ec('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xc3ec('0x5e')](_0x3538bc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4a2a=['[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','serverUrl','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','trigger:browser:url','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','stripTrailingSlash','lastevent','calleridname','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','localhost','socket.io-emitter','redis','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','first','Enduser\x20found!','%s/users.json','end-user','Caller\x20-\x20%s','%s:%s','username','password','authType','token','%s/token:%s','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch'];(function(_0x180a52,_0x32f833){var _0x128bf8=function(_0x48bfb0){while(--_0x48bfb0){_0x180a52['push'](_0x180a52['shift']());}};_0x128bf8(++_0x32f833);}(_0x4a2a,0x87));var _0xa4a2=function(_0x46492f,_0x4da396){_0x46492f=_0x46492f-0x0;var _0x55a427=_0x4a2a[_0x46492f];return _0x55a427;};'use strict';var _=require(_0xa4a2('0x0'));var rp=require('request-promise');var md5=require(_0xa4a2('0x1'));var util=require(_0xa4a2('0x2'));var Redis=require(_0xa4a2('0x3'));var intUtil=require(_0xa4a2('0x4'));var config=require(_0xa4a2('0x5'));var logger=require(_0xa4a2('0x6'))(_0xa4a2('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0xa4a2('0x8'),'port':0x18eb});var io=require(_0xa4a2('0x9'))(new Redis(config[_0xa4a2('0xa')]));function emit(_0x494617,_0x59f236,_0x375097){io['to'](_0x494617)[_0xa4a2('0xb')](_0x59f236,_0x375097);}var headers={'Content-Type':'application/json','Accept':_0xa4a2('0xc')};function getTicket(_0x4cdde4,_0x311dca,_0x28f7d0,_0x3a09af,_0xea63bf){logger['info'](_0xa4a2('0xd'));return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0xf'),_0x4cdde4['remoteUri']),'method':_0xa4a2('0x10'),'body':{'ticket':_[_0xa4a2('0x11')]({'requester_id':_0x28f7d0['id'],'submitter_id':_0x311dca?_0x311dca['id']:undefined,'assignee_id':_0x311dca?_0x311dca['id']:undefined,'tags':getTags(_0x3a09af[_0xa4a2('0x12')],'name'),'subject':intUtil[_0xa4a2('0x13')](_0x3a09af[_0xa4a2('0x14')],_0xea63bf,'\x20'),'description':intUtil['getString'](_0x3a09af[_0xa4a2('0x15')],_0xea63bf,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa4a2('0x13')](_0x3a09af[_0xa4a2('0x15')],_0xea63bf,'\x0a')}},getCustomFields(_0x3a09af[_0xa4a2('0x16')],_0xea63bf))}})[_0xa4a2('0x17')](function(_0x1c7fd1){logger[_0xa4a2('0x18')](_0xa4a2('0x19'));return _0x1c7fd1[_0xa4a2('0x1a')];});}function getUser(_0x4cafbe,_0x441faf){if(intUtil['validateEmail'](_0x441faf)){logger[_0xa4a2('0x18')]('Getting\x20agent\x20with\x20email',_0x441faf);return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x1b'),_0x4cafbe[_0xa4a2('0x1c')]),'qs':{'query':util[_0xa4a2('0xe')](_0xa4a2('0x1d'),_0x441faf)}})['then'](function(_0x1072c3){if(_0x1072c3['count']){logger[_0xa4a2('0x18')]('Agent\x20found!');return _['find'](_0x1072c3[_0xa4a2('0x1e')],{'email':_0x441faf,'role':_0xa4a2('0x1f')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x20'),_0x4cafbe[_0xa4a2('0x1c')])})['then'](function(_0x299689){logger[_0xa4a2('0x18')](_0xa4a2('0x21'));return _0x299689[_0xa4a2('0x22')];});}});}else{logger['info'](_0xa4a2('0x23'));return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x20'),_0x4cafbe[_0xa4a2('0x1c')])})['then'](function(_0x389549){logger[_0xa4a2('0x18')](_0xa4a2('0x21'));return _0x389549[_0xa4a2('0x22')];});}}function getEndUser(_0x1d2d6f,_0x45c306,_0x4b07ba){logger[_0xa4a2('0x18')](_0xa4a2('0x24'),_0x4b07ba);return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x1b'),_0x1d2d6f[_0xa4a2('0x1c')]),'qs':{'query':util[_0xa4a2('0xe')](_0xa4a2('0x25'),_0x4b07ba)}})[_0xa4a2('0x17')](function(_0x533497){var _0x35bf2f;if(_0x533497[_0xa4a2('0x1e')][_0xa4a2('0x26')]){_0x533497[_0xa4a2('0x1e')]=_['filter'](_0x533497['results'],{'suspended':![],'role':'end-user'});if(_0x533497[_0xa4a2('0x1e')]['length']){_0x35bf2f=_[_0xa4a2('0x27')](_0x533497[_0xa4a2('0x1e')]);}}if(_0x35bf2f){logger[_0xa4a2('0x18')](_0xa4a2('0x28'));return _0x35bf2f;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x29'),_0x1d2d6f[_0xa4a2('0x1c')]),'method':_0xa4a2('0x10'),'body':{'user':{'role':_0xa4a2('0x2a'),'name':util[_0xa4a2('0xe')](_0xa4a2('0x2b'),_0x45c306||_0x4b07ba),'phone':_0x4b07ba}}})[_0xa4a2('0x17')](function(_0x51f57e){logger[_0xa4a2('0x18')]('Enduser\x20created.');return _0x51f57e['user'];});}});}function getAuth(_0x23972b){var _0x5702ad;if(_0x23972b['authType']==='password'){_0x5702ad=util[_0xa4a2('0xe')](_0xa4a2('0x2c'),_0x23972b[_0xa4a2('0x2d')],_0x23972b[_0xa4a2('0x2e')]);}else if(_0x23972b[_0xa4a2('0x2f')]===_0xa4a2('0x30')){_0x5702ad=util['format'](_0xa4a2('0x31'),_0x23972b['username'],_0x23972b['token']);}return util[_0xa4a2('0xe')]('Basic\x20%s',new Buffer(_0x5702ad)['toString'](_0xa4a2('0x32')));}function request(_0x3fced6){logger[_0xa4a2('0x33')](_0xa4a2('0x34'),JSON[_0xa4a2('0x35')](_0x3fced6));return rp(_['defaults'](_0x3fced6,{'method':_0xa4a2('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x212059,_0x4c83b5){var _0x4af995=[];if(_0x212059&&_0x212059['length']>0x0){_0x4af995=_[_0xa4a2('0x37')](_0x212059,_0x4c83b5);}return _0x4af995;}function getCustomFields(_0x3e8075,_0x3cdf68){var _0x14c0c0=[];var _0x558f96={'custom_fields':[]};if(_0x3e8075[_0xa4a2('0x26')]>0x0){_[_0xa4a2('0x38')](_0x3e8075,function(_0x1a333e){if(_['includes']([_0xa4a2('0x39'),_0xa4a2('0x3a')],_0x1a333e[_0xa4a2('0x3b')])&&_0x1a333e[_0xa4a2('0x3c')]&&!_0x1a333e[_0xa4a2('0x3d')]){_0x558f96[_0x1a333e[_0xa4a2('0x3c')][_0xa4a2('0x3e')]()]=_0x1a333e[_0xa4a2('0x3f')][_0xa4a2('0x40')]();}else if(_[_0xa4a2('0x41')]([_0xa4a2('0x39'),_0xa4a2('0x3a')],_0x1a333e[_0xa4a2('0x3b')])&&_0x1a333e[_0xa4a2('0x42')]&&_0x1a333e[_0xa4a2('0x3d')]){_0x558f96[_0xa4a2('0x43')]['push']({'id':_0x1a333e[_0xa4a2('0x42')],'value':_0x1a333e[_0xa4a2('0x3f')][_0xa4a2('0x40')]()});}else if(_0x1a333e[_0xa4a2('0x3b')]===_0xa4a2('0x44')&&_0x1a333e[_0xa4a2('0x45')]&&_0x1a333e['idField']&&_0x1a333e[_0xa4a2('0x3d')]){_0x3cdf68[_0x1a333e[_0xa4a2('0x45')]]&&_0x558f96['custom_fields'][_0xa4a2('0x46')]({'id':_0x1a333e[_0xa4a2('0x42')],'value':_0x3cdf68[_0x1a333e[_0xa4a2('0x45')]][_0xa4a2('0x40')]()});}else if(_0x1a333e[_0xa4a2('0x3b')]===_0xa4a2('0x47')&&_0x1a333e[_0xa4a2('0x48')]&&_0x1a333e[_0xa4a2('0x48')][_0xa4a2('0x49')]&&_0x1a333e[_0xa4a2('0x42')]&&_0x1a333e['customField']){_0x3cdf68[_0x1a333e['Variable'][_0xa4a2('0x49')]['toLowerCase']()]&&_0x558f96[_0xa4a2('0x43')][_0xa4a2('0x46')]({'id':_0x1a333e[_0xa4a2('0x42')],'value':_0x3cdf68[_0x1a333e[_0xa4a2('0x48')][_0xa4a2('0x49')][_0xa4a2('0x3e')]()]['toString']()});}});}return _0x558f96;}exports['queue']=function(_0x117995,_0x3af744,_0x362c06,_0x19b740,_0x4977ac,_0x9641e0){var _0x5ba798,_0x28e6b6;_0x9641e0[_0xa4a2('0x1c')]=intUtil['stripTrailingSlash'](_0x9641e0[_0xa4a2('0x1c')]);_0x9641e0['serverUrl']=intUtil['stripTrailingSlash'](_0x9641e0['serverUrl']);if(_0x4977ac&&_0x4977ac[_0xa4a2('0x4a')]){logger[_0xa4a2('0x18')](_0xa4a2('0x4b'),_0xa4a2('0x4c'));_0x3af744[_0xa4a2('0x4d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9641e0['serverUrl'],_0x3af744[_0xa4a2('0x4e')],md5(_0x3af744['uniqueid']));}else{_0x3af744[_0xa4a2('0x4d')]='';}headers[_0xa4a2('0x4f')]=getAuth(_0x9641e0);return getUser(_0x9641e0,_0x19b740[_0xa4a2('0x50')])[_0xa4a2('0x17')](function(_0x1b81a5){_0x5ba798=_0x1b81a5;logger[_0xa4a2('0x18')](_0xa4a2('0x51'),_0x5ba798['id']);return getEndUser(_0x9641e0,_0x3af744['calleridname'],_0x3af744[_0xa4a2('0x52')]);})[_0xa4a2('0x17')](function(_0x5f23ce){_0x28e6b6=_0x5f23ce;logger[_0xa4a2('0x18')](_0xa4a2('0x53'),_0x28e6b6['id']);return getTicket(_0x9641e0,_0x5ba798,_0x28e6b6,_0x362c06,_0x3af744);})[_0xa4a2('0x17')](function(_0x28a5ca){if(_0x28a5ca){logger['info'](_0xa4a2('0x54'),_0x28a5ca['id']);switch(_0x9641e0[_0xa4a2('0x3b')]){case'integrationTab':logger['info']('[QUEUE]',_0xa4a2('0x55'));return request({'uri':util['format'](_0xa4a2('0x56'),_0x9641e0[_0xa4a2('0x1c')],_0x5ba798['id'],_0x28a5ca['id']),'method':'POST'});case'newTab':logger[_0xa4a2('0x18')](_0xa4a2('0x4b'),_0xa4a2('0x57'));emit(util[_0xa4a2('0xe')](_0xa4a2('0x58'),_0x19b740[_0xa4a2('0x49')]),'trigger:browser:url',{'uri':util[_0xa4a2('0xe')](_0xa4a2('0x59'),_0x9641e0['remoteUri']['replace']('/api/v2',''),_0x28a5ca['id'])});break;default:logger[_0xa4a2('0x5a')](_0xa4a2('0x4b'),_0xa4a2('0x5b'));}}})[_0xa4a2('0x5c')](function(_0xf8a806){logger[_0xa4a2('0x5a')](_0xa4a2('0x5d'),util['inspect'](_0xf8a806,{'showHidden':!![],'depth':null}));});};exports[_0xa4a2('0x5e')]=function(_0x4ad356,_0x2442c9,_0x45088f,_0x54dc79,_0x27aa3b,_0x4115da,_0x2a7616){var _0x192cb3,_0x2060c2;_0x4115da[_0xa4a2('0x1c')]=intUtil['stripTrailingSlash'](_0x4115da[_0xa4a2('0x1c')]);_0x4115da[_0xa4a2('0x5f')]=intUtil['stripTrailingSlash'](_0x4115da['serverUrl']);if(_0x2a7616&&_0x2a7616[_0xa4a2('0x60')]&&_0x2a7616[_0xa4a2('0x60')]!==_0xa4a2('0x61')){logger['info']('[OUTBOUND]',_0xa4a2('0x4c'));_0x2442c9[_0xa4a2('0x4d')]=util[_0xa4a2('0xe')](_0xa4a2('0x62'),_0x4115da[_0xa4a2('0x5f')],_0x2442c9[_0xa4a2('0x4e')],md5(_0x2442c9['uniqueid']));}headers[_0xa4a2('0x4f')]=getAuth(_0x4115da);return getUser(_0x4115da,_0x54dc79[_0xa4a2('0x50')])[_0xa4a2('0x17')](function(_0x5052e3){_0x192cb3=_0x5052e3;logger[_0xa4a2('0x18')]('The\x20User\x20ID\x20is:',_0x192cb3['id']);return getEndUser(_0x4115da,_0x2442c9[_0xa4a2('0x63')],_0x2442c9[_0xa4a2('0x64')]);})[_0xa4a2('0x17')](function(_0xaed8c){_0x2060c2=_0xaed8c;logger[_0xa4a2('0x18')](_0xa4a2('0x53'),_0x2060c2['id']);return getTicket(_0x4115da,_0x192cb3,_0x2060c2,_0x45088f,_0x2442c9);})['then'](function(_0x24929a){if(_0x24929a){logger['info'](_0xa4a2('0x54'),_0x24929a['id']);switch(_0x4115da[_0xa4a2('0x3b')]){case _0xa4a2('0x65'):logger[_0xa4a2('0x18')](_0xa4a2('0x66'),_0xa4a2('0x55'));return request({'uri':util[_0xa4a2('0xe')](_0xa4a2('0x56'),_0x4115da['remoteUri'],_0x192cb3['id'],_0x24929a['id']),'method':'POST'});case'newTab':logger[_0xa4a2('0x18')](_0xa4a2('0x66'),_0xa4a2('0x57'));emit(util[_0xa4a2('0xe')](_0xa4a2('0x58'),_0x54dc79[_0xa4a2('0x49')]),_0xa4a2('0x67'),{'uri':util[_0xa4a2('0xe')](_0xa4a2('0x59'),_0x4115da[_0xa4a2('0x1c')][_0xa4a2('0x68')](_0xa4a2('0x69'),''),_0x24929a['id'])});break;default:logger[_0xa4a2('0x5a')]('[OUTBOUND]',_0xa4a2('0x5b'));}}})[_0xa4a2('0x5c')](function(_0x3d4c5d){logger[_0xa4a2('0x5a')](_0xa4a2('0x6a'),util[_0xa4a2('0x6b')](_0x3d4c5d,{'showHidden':!![],'depth':null}));});};exports[_0xa4a2('0x6c')]=function(_0x10bbc1,_0x2e01a2,_0x3dc7d0,_0x209283,_0x12645e,_0x92b6ca){var _0x3f2212,_0x580c8c;_0x92b6ca[_0xa4a2('0x1c')]=intUtil[_0xa4a2('0x6d')](_0x92b6ca[_0xa4a2('0x1c')]);_0x92b6ca[_0xa4a2('0x5f')]=intUtil[_0xa4a2('0x6d')](_0x92b6ca[_0xa4a2('0x5f')]);if(_0x12645e&&_0x12645e[_0xa4a2('0x4a')]){logger[_0xa4a2('0x18')]('['+_0x2e01a2[_0xa4a2('0x6e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2e01a2['recordingURL']=util[_0xa4a2('0xe')](_0xa4a2('0x62'),_0x92b6ca[_0xa4a2('0x5f')],_0x2e01a2[_0xa4a2('0x4e')],md5(_0x2e01a2[_0xa4a2('0x4e')]));}else{_0x2e01a2[_0xa4a2('0x4d')]='';}headers[_0xa4a2('0x4f')]=getAuth(_0x92b6ca);return getUser(_0x92b6ca)[_0xa4a2('0x17')](function(_0x1cccc3){_0x3f2212=_0x1cccc3;logger[_0xa4a2('0x18')](_0xa4a2('0x51'),_0x3f2212['id']);return getEndUser(_0x92b6ca,_0x2e01a2[_0xa4a2('0x6f')],_0x2e01a2[_0xa4a2('0x52')]);})['then'](function(_0x51f54b){_0x580c8c=_0x51f54b;logger[_0xa4a2('0x18')](_0xa4a2('0x53'),_0x580c8c['id']);return getTicket(_0x92b6ca,_0x3f2212,_0x580c8c,_0x3dc7d0,_0x2e01a2);})[_0xa4a2('0x17')](function(_0x198572){if(_0x198572){logger[_0xa4a2('0x18')](_0xa4a2('0x54'),_0x198572['id']);}})['catch'](function(_0x1b5a57){logger[_0xa4a2('0x5a')]('['+_0x2e01a2['lastevent'][_0xa4a2('0x70')]()+']'+_0xa4a2('0x71'),util[_0xa4a2('0x6b')](_0x1b5a57,{'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 8b79404..b46257b 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 _0x559a=['recordingURL','serverUrl','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','monitor_format','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','idField','content','type','variable','variableName','Variable','name','toLowerCase','toString','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','enduserType','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','connect','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','starttime','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x50a330,_0x2e003c){var _0x475636=function(_0x1ce9ab){while(--_0x1ce9ab){_0x50a330['push'](_0x50a330['shift']());}};_0x475636(++_0x2e003c);}(_0x559a,0xb3));var _0xa559=function(_0x212e44,_0xefc291){_0x212e44=_0x212e44-0x0;var _0x44132c=_0x559a[_0x212e44];return _0x44132c;};'use strict';var _=require(_0xa559('0x0'));var rp=require(_0xa559('0x1'));var md5=require('md5');var util=require(_0xa559('0x2'));var intUtil=require(_0xa559('0x3'));var moment=require(_0xa559('0x4'));var Redis=require(_0xa559('0x5'));var BPromise=require(_0xa559('0x6'));var config=require(_0xa559('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0xa559('0x8')]=_[_0xa559('0x9')](config['redis'],{'host':_0xa559('0xa'),'port':0x18eb});var io=require(_0xa559('0xb'))(new Redis(config['redis']));function emit(_0xb8055,_0x218e3b,_0x15813d){io['to'](_0xb8055)[_0xa559('0xc')](_0x218e3b,_0x15813d);}function request(_0x48aa9a){logger[_0xa559('0xd')](_0xa559('0xe'),JSON[_0xa559('0xf')](_0x48aa9a));return rp(_0x48aa9a);}function getCustomFields(_0x2ee917,_0x5cf4d3){var _0x5ef2d5={};if(_0x2ee917[_0xa559('0x10')]>0x0){_[_0xa559('0x11')](_0x2ee917,function(_0x48bdf3){if(_[_0xa559('0x12')](['string',_0xa559('0x13')],_0x48bdf3['type'])&&_0x48bdf3[_0xa559('0x14')]){_0x5ef2d5[_0x48bdf3[_0xa559('0x14')]]=_0x48bdf3[_0xa559('0x15')]['toString']();}else if(_0x48bdf3[_0xa559('0x16')]===_0xa559('0x17')&&_0x48bdf3['variableName']&&_0x48bdf3[_0xa559('0x14')]&&_0x5cf4d3[_0x48bdf3[_0xa559('0x18')]]){_0x5ef2d5[_0x48bdf3[_0xa559('0x14')]]=_0x5cf4d3[_0x48bdf3[_0xa559('0x18')]]['toString']();}else if(_0x48bdf3[_0xa559('0x16')]==='customVariable'&&_0x48bdf3[_0xa559('0x19')]&&_0x48bdf3[_0xa559('0x19')]['name']&&_0x48bdf3[_0xa559('0x14')]&&_0x5cf4d3[_0x48bdf3[_0xa559('0x19')][_0xa559('0x1a')][_0xa559('0x1b')]()]){_0x5ef2d5[_0x48bdf3[_0xa559('0x14')]]=_0x5cf4d3[_0x48bdf3[_0xa559('0x19')][_0xa559('0x1a')][_0xa559('0x1b')]()][_0xa559('0x1c')]();}});}return _0x5ef2d5;}function getName(_0x9ae158){if(_0x9ae158['indexOf']('\x20')>0x0){var _0x5476f4=_0x9ae158[_0xa559('0x1d')](/ (.+)/);if(_0x5476f4[0x1]){return _0x5476f4;}}return[_0x9ae158,_0x9ae158];}var accountsTokens={};function getAccessToken(_0x3aa532){return new Promise(function(_0x47cb65,_0x3496c3){if(!_[_0xa559('0x1e')](accountsTokens[_0x3aa532['id']])&&!_[_0xa559('0x1e')](accountsTokens[_0x3aa532['id']][_0xa559('0x1f')])){if(moment()[_0xa559('0x20')](accountsTokens[_0x3aa532['id']][_0xa559('0x21')])){_0x47cb65(accountsTokens[_0x3aa532['id']]['access_token']);}}var _0x36aa43;switch(_0x3aa532['zone']){case'US':_0x36aa43=_0xa559('0x22');break;case'AU':_0x36aa43=_0xa559('0x23');break;case'EU':_0x36aa43=_0xa559('0x24');break;case'IN':_0x36aa43='https://accounts.zoho.in';break;case'CN':_0x36aa43=_0xa559('0x25');break;default:_0x36aa43='https://accounts.zoho.eu';break;}var _0xad00b0={'method':_0xa559('0x26'),'uri':_0x36aa43+'/oauth/v2/token','qs':{'refresh_token':_0x3aa532[_0xa559('0x27')],'client_id':_0x3aa532['clientId'],'client_secret':_0x3aa532['clientSecret'],'grant_type':_0xa559('0x28')},'json':!![]};return rp(_0xad00b0)[_0xa559('0x29')](function(_0x3fcf7f){accountsTokens[_0x3aa532['id']]={'access_token':_0x3fcf7f[_0xa559('0x1f')],'expires_in':moment()[_0xa559('0x2a')](_0x3fcf7f[_0xa559('0x21')],_0xa559('0x2b'))};_0x47cb65(_0x3fcf7f[_0xa559('0x1f')]);})['catch'](function(_0x11a3d2){logger[_0xa559('0x2c')](_0xa559('0x2d'),_0x11a3d2[_0xa559('0x2e')]);_0x3496c3(_0x11a3d2);});});}function getUser(_0x5f3fbb,_0x1fb70f,_0x32db9d,_0x195ec4){logger['info'](_0xa559('0x2f'));return request({'method':_0xa559('0x30'),'uri':util[_0xa559('0x31')](_0xa559('0x32'),_0x1fb70f),'qs':{'type':_0xa559('0x33')},'headers':{'Authorization':_0xa559('0x34')+_0x5f3fbb},'json':!![]})[_0xa559('0x29')](function(_0x13de18){if(_0x13de18[_0xa559('0x35')]){var _0x5a9f8d=-0x1;if(_[_0xa559('0x36')](_0x13de18[_0xa559('0x35')])){if(!_[_0xa559('0x1e')](_0x195ec4)){_0x5a9f8d=_[_0xa559('0x37')](_0x13de18['users'],function(_0x2b6eeb){return _0x2b6eeb['email']===_0x195ec4;});}if(_0x5a9f8d>=0x0){logger[_0xa559('0x38')](_0xa559('0x39'));}else{logger[_0xa559('0x38')](_0xa559('0x3a'));_0x5a9f8d=_[_0xa559('0x37')](_0x13de18[_0xa559('0x35')],function(_0x5edfa1){return _0x5edfa1[_0xa559('0x3b')][_0xa559('0x1a')]===_0xa559('0x3c');});}return _0x13de18[_0xa559('0x35')][_0x5a9f8d];}else{if(_0x13de18[_0xa559('0x3d')][_0xa559('0x3b')][_0xa559('0x1a')]===_0xa559('0x3c')){logger['info'](_0xa559('0x3a'));user=_0x13de18[_0xa559('0x3d')];return user;}else{logger[_0xa559('0x2c')](_0xa559('0x3e'),JSON[_0xa559('0xf')](_0x13de18));throw new Error(_0xa559('0x3f')+JSON[_0xa559('0xf')](_0x13de18));}}}else{logger['error'](_0xa559('0x3e'),JSON[_0xa559('0xf')](_0x13de18));throw new Error(_0xa559('0x3f')+JSON[_0xa559('0xf')](_0x13de18));}})[_0xa559('0x40')](function(_0x2e656d){console[_0xa559('0x2c')](_0x2e656d);});}function getZohoUser(_0x1d4790,_0x3bf8b1){return new BPromise(function(_0x317235,_0x4024cf){request(_0x1d4790)[_0xa559('0x29')](function(_0xe9dc78){var _0x586810=null;if(_0xe9dc78){_0x586810=_0xe9dc78[_0xa559('0x41')][0x0];_0x586810['enduserType']=_0x3bf8b1;}_0x317235(_0x586810);})[_0xa559('0x40')](function(_0x598185){_0x4024cf(_0x598185);});});}function createEndUser(_0x3f6798,_0x4be2c9,_0x3873c9,_0x1ef87b,_0x1ba33c,_0xb99f2){var _0x3873c9=getName(_0x3873c9);return request({'method':_0xa559('0x26'),'uri':_0xa559('0x42')+_0x4be2c9+'/crm/v2/'+_[_0xa559('0x43')](_0xb99f2[_0xa559('0x44')])+'s','body':{'data':[{'Last_Name':_0x3873c9[0x1],'First_Name':_0x3873c9[0x0],'Phone':_0x1ef87b,'Owner':{'name':!_[_0xa559('0x1e')](_0x1ba33c[_0xa559('0x45')][_0xa559('0x1a')])?_0x1ba33c[_0xa559('0x45')]['name']:!_[_0xa559('0x1e')](_0x1ba33c[_0xa559('0x46')])?_0x1ba33c[_0xa559('0x46')]+'\x20'+_0x1ba33c[_0xa559('0x47')]:_0x1ba33c['last_name'],'id':_0x1ba33c['id']}}]},'headers':{'Authorization':_0xa559('0x34')+_0x3f6798},'json':!![]})[_0xa559('0x29')](function(_0x16e21d){if(_0x16e21d&&_0x16e21d[_0xa559('0x41')][0x0][_0xa559('0x48')]==='SUCCESS'){var _0xdd0241=_0x16e21d[_0xa559('0x41')][0x0][_0xa559('0x49')];_0xdd0241[_0xa559('0x4a')]=_[_0xa559('0x43')](_0xb99f2[_0xa559('0x44')])+'s';return _0xdd0241;}logger[_0xa559('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xa559('0xf')](data));throw new Error(_0xa559('0x4b')+JSON[_0xa559('0xf')](data));})[_0xa559('0x40')](function(_0x39168b){console[_0xa559('0x4c')](_0xa559('0x4d'),_0x39168b);});}function getEndUser(_0x2df27d,_0x5102d6,_0x580870,_0x15f10c,_0xbb4127,_0x10c836,_0x40e965){var _0x3105aa={'method':_0xa559('0x30'),'uri':'','headers':{'Authorization':_0xa559('0x34')+_0x2df27d},'json':!![]};switch(_0x40e965['moduleSearch']){case _0xa559('0x4e'):_0x3105aa[_0xa559('0x4f')]=_0xa559('0x42')+_0x5102d6+_0xa559('0x50')+_0xbb4127+'))';return getZohoUser(_0x3105aa,_0xa559('0x51'))['then'](function(_0x3e917c){if(_0x3e917c)return _0x3e917c;_0x3105aa[_0xa559('0x4f')]='https://www.zohoapis.'+_0x5102d6+_0xa559('0x52')+_0xbb4127+'))';return getZohoUser(_0x3105aa,_0xa559('0x53'))['then'](function(_0x56a722){if(_0x56a722)return _0x56a722;if(_0x40e965[_0xa559('0x44')]!=_0xa559('0x54')){return createEndUser(_0x2df27d,_0x5102d6,_0x15f10c,_0xbb4127,_0x10c836,_0x40e965);}else{return{};}});});break;case _0xa559('0x55'):_0x3105aa[_0xa559('0x4f')]=_0xa559('0x42')+_0x5102d6+_0xa559('0x50')+_0xbb4127+'))';return getZohoUser(_0x3105aa,'Contacts')[_0xa559('0x29')](function(_0x53c454){if(_0x53c454)return _0x53c454;if(_0x40e965['moduleCreate']!='nothing'){return createEndUser(_0x2df27d,_0x5102d6,_0x15f10c,_0xbb4127,_0x10c836,_0x40e965);}else{return{};}});break;case _0xa559('0x56'):_0x3105aa[_0xa559('0x4f')]=_0xa559('0x42')+_0x5102d6+_0xa559('0x52')+_0xbb4127+'))';return getZohoUser(_0x3105aa,_0xa559('0x53'))[_0xa559('0x29')](function(_0x3a8090){if(_0x3a8090)return _0x3a8090;if(_0x40e965[_0xa559('0x44')]!=_0xa559('0x54')){return createEndUser(_0x2df27d,_0x5102d6,_0x15f10c,_0xbb4127,_0x10c836,_0x40e965);}else{return{};}});break;}}function getCall(_0x3ede86,_0x3be912,_0x4abc17,_0x284005,_0x2be007,_0x163e43,_0x580259,_0x38fb71){logger['info'](_0xa559('0x57'));var _0x8fcc9b={};_0x8fcc9b[_0xa559('0x58')]={'name':!_[_0xa559('0x1e')](_0x284005[_0xa559('0x45')][_0xa559('0x1a')])&&!_[_0xa559('0x1e')](_0x284005[_0xa559('0x3b')]['name'])&&_0x284005[_0xa559('0x3b')][_0xa559('0x1a')]===_0xa559('0x59')?_0x284005['role']['name']:!_[_0xa559('0x1e')](_0x284005[_0xa559('0x46')])?_0x284005['first_name']+'\x20'+_0x284005[_0xa559('0x47')]:_0x284005[_0xa559('0x47')],'id':_0x284005['id']};_0x8fcc9b[_0xa559('0x5a')]=intUtil['getString'](_0x163e43[_0xa559('0x5b')],_0x580259,'\x20');_0x8fcc9b[_0xa559('0x5c')]=intUtil['getString'](_0x163e43['Descriptions'],_0x580259,'\x0a');if(_0x2be007['enduserType']===_0xa559('0x51')){_0x8fcc9b[_0xa559('0x5d')]={'name':!_[_0xa559('0x1e')](_0x2be007[_0xa559('0x5e')])?_0x2be007[_0xa559('0x5e')]:!_[_0xa559('0x1e')](_0x2be007[_0xa559('0x5f')])?_0x2be007[_0xa559('0x5f')]+'\x20'+_0x2be007['Last_Name']:_0x2be007['Last_Name'],'id':_0x2be007['id']};}if(_0x2be007[_0xa559('0x4a')]===_0xa559('0x53')){_0x8fcc9b[_0xa559('0x60')]={'name':!_['isNil'](_0x2be007[_0xa559('0x5e')])?_0x2be007[_0xa559('0x5e')]:!_['isNil'](_0x2be007[_0xa559('0x5f')])?_0x2be007[_0xa559('0x5f')]+'\x20'+_0x2be007[_0xa559('0x61')]:_0x2be007[_0xa559('0x61')],'id':_0x2be007['id']};_0x8fcc9b[_0xa559('0x62')]=_[_0xa559('0x43')](_0x2be007[_0xa559('0x4a')]);}if(_0x580259[_0xa559('0x63')]){_0x8fcc9b['Call_Duration']=moment[_0xa559('0x64')](parseInt(_0x580259[_0xa559('0x63')])*0x3e8)['format'](_0xa559('0x65'));}else if(_0x580259[_0xa559('0x66')]&&_0x580259[_0xa559('0x67')]){_0x8fcc9b[_0xa559('0x68')]=moment[_0xa559('0x64')](moment(_0x580259[_0xa559('0x67')],_0xa559('0x69'))[_0xa559('0x6a')](moment(_0x580259['starttime'],_0xa559('0x69'))))[_0xa559('0x31')](_0xa559('0x65'));}switch(_0x580259[_0xa559('0x6b')]){case _0xa559('0x6c'):_0x8fcc9b[_0xa559('0x6d')]=_0xa559('0x6e');break;case'complete':case _0xa559('0x6f'):_0x8fcc9b[_0xa559('0x6d')]=_0xa559('0x70');break;case'rejected':_0x8fcc9b[_0xa559('0x6d')]=_0xa559('0x71');break;case _0xa559('0x72'):_0x8fcc9b[_0xa559('0x6d')]=_0xa559('0x73');break;case _0xa559('0x74'):_0x8fcc9b[_0xa559('0x6d')]=_0xa559('0x75');default:}_0x8fcc9b['Call_Start_Time']=(_0x38fb71===_0xa559('0x76')?moment(_0x580259[_0xa559('0x77')])[_0xa559('0x31')](_0xa559('0x69')):moment(_0x580259['agentcalledAt'])[_0xa559('0x31')](_0xa559('0x69')))||moment()['format'](_0xa559('0x69'));_0x8fcc9b[_0xa559('0x78')]=_0x38fb71||_0xa559('0x79');_0x8fcc9b=_[_0xa559('0x7a')](_0x8fcc9b,getCustomFields(_0x163e43[_0xa559('0x7b')],_0x580259));return request({'method':'POST','uri':_0xa559('0x42')+_0x3be912+_0xa559('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3ede86},'body':{'data':[_0x8fcc9b]},'json':!![]})[_0xa559('0x29')](function(_0x4a8451){if(_0x4a8451&&_0x4a8451[_0xa559('0x41')][0x0][_0xa559('0x48')]===_0xa559('0x7d')){logger[_0xa559('0x38')](_0xa559('0x7e'));return{'id':_0x4a8451[_0xa559('0x41')][0x0][_0xa559('0x49')]['id']};}})['catch'](function(_0x594b2c){logger[_0xa559('0x38')](_0xa559('0x7f'),_0x594b2c[_0xa559('0x2e')]);console['log'](_0xa559('0x7f'),_0x594b2c);});}exports[_0xa559('0x80')]=function(_0x222dbb,_0x63ffa,_0x428c9f,_0x26c4ee,_0x23ad01,_0x33ae39){var _0x119461,_0x103c18,_0x36d6de;_0x33ae39[_0xa559('0x81')]=intUtil[_0xa559('0x82')](_0x33ae39[_0xa559('0x81')]);_0x33ae39['serverUrl']=intUtil['stripTrailingSlash'](_0x33ae39['serverUrl']);if(_0x23ad01&&_0x23ad01['monitor_format']){logger[_0xa559('0x38')](_0xa559('0x83'),_0xa559('0x84'));_0x63ffa[_0xa559('0x85')]=_0x33ae39[_0xa559('0x86')]+'/api/voice/recordings/'+_0x63ffa[_0xa559('0x87')]+_0xa559('0x88')+md5(_0x63ffa[_0xa559('0x87')]);}else{_0x63ffa[_0xa559('0x85')]='';}var _0x4c8c18=_0x33ae39[_0xa559('0x81')]===_0xa559('0x89')?'eu':_0xa559('0x8a');return getAccessToken(_0x33ae39)['then'](function(_0x2c6a0a){_0x36d6de=_0x2c6a0a;return getUser(_0x36d6de,_0x4c8c18,_0x33ae39,_0x26c4ee['email']);})[_0xa559('0x29')](function(_0x5a887d){_0x119461=_0x5a887d;logger[_0xa559('0x38')](_0xa559('0x8b'),_0x119461['id']);return getEndUser(_0x36d6de,_0x4c8c18,_0x33ae39,_0x63ffa[_0xa559('0x8c')],_0x63ffa[_0xa559('0x8d')],_0x119461,_0x428c9f);})[_0xa559('0x29')](function(_0x42b7a2){_0x103c18=_0x42b7a2;return getCall(_0x36d6de,_0x4c8c18,_0x33ae39,_0x119461,_0x103c18,_0x428c9f,_0x63ffa,_0xa559('0x79'));})[_0xa559('0x29')](function(_0x115c74){if(_0x115c74){logger[_0xa559('0x38')](_0xa559('0x8e'),_0x115c74['id']);logger['info'](_0xa559('0x83'),_0xa559('0x8f'));emit(util[_0xa559('0x31')](_0xa559('0x90'),_0x26c4ee['name']),_0xa559('0x91'),{'uri':_0xa559('0x92')+_0x33ae39[_0xa559('0x81')]+_0xa559('0x93')+_0x115c74['id']});}})[_0xa559('0x40')](function(_0x2dd4c0){logger[_0xa559('0x2c')](_0xa559('0x83'),JSON[_0xa559('0xf')](_0x2dd4c0));});};exports[_0xa559('0x76')]=function(_0x57ca44,_0x2ccac2,_0x32a4f1,_0x51ad89,_0x530685,_0x2c0539,_0x1be560){var _0x35df22,_0x5b857c,_0x3281c5;_0x2c0539[_0xa559('0x81')]=intUtil[_0xa559('0x82')](_0x2c0539[_0xa559('0x81')]);_0x2c0539[_0xa559('0x86')]=intUtil[_0xa559('0x82')](_0x2c0539[_0xa559('0x86')]);if(_0x1be560&&_0x1be560['recordingFormat']&&_0x1be560[_0xa559('0x94')]!==_0xa559('0x95')){logger[_0xa559('0x38')](_0xa559('0x96'),_0xa559('0x84'));_0x2ccac2[_0xa559('0x85')]=_0x2c0539['serverUrl']+'/api/voice/recordings/'+_0x2ccac2[_0xa559('0x87')]+_0xa559('0x88')+md5(_0x2ccac2[_0xa559('0x87')]);}var _0x59a1ca=_0x2c0539[_0xa559('0x81')]===_0xa559('0x89')?'eu':_0xa559('0x8a');return getAccessToken(_0x2c0539)['then'](function(_0x456147){_0x3281c5=_0x456147;return getUser(_0x3281c5,_0x59a1ca,_0x2c0539,_0x51ad89['email']);})['then'](function(_0x129c98){_0x35df22=_0x129c98;logger[_0xa559('0x38')](_0xa559('0x8b'),_0x35df22['id']);return getEndUser(_0x3281c5,_0x59a1ca,_0x2c0539,_0x2ccac2[_0xa559('0x97')],_0x2ccac2[_0xa559('0x98')],_0x35df22,_0x32a4f1);})['then'](function(_0x48be34){_0x5b857c=_0x48be34;return getCall(_0x3281c5,_0x59a1ca,_0x2c0539,_0x35df22,_0x5b857c,_0x32a4f1,_0x2ccac2,_0xa559('0x99'));})['then'](function(_0x31b46f){if(_0x31b46f){logger[_0xa559('0x38')](_0xa559('0x8e'),_0x31b46f['id']);logger['info'](_0xa559('0x96'),_0xa559('0x8f'));emit(util[_0xa559('0x31')](_0xa559('0x90'),_0x51ad89[_0xa559('0x1a')]),_0xa559('0x91'),{'uri':_0xa559('0x92')+_0x2c0539['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x31b46f['id']});}})[_0xa559('0x40')](function(_0x4be727){logger['error']('[OUTBOUND]',JSON[_0xa559('0xf')](_0x4be727));});};exports['unmanaged']=function(_0x445857,_0x56ac8e,_0x2923b1,_0x117fcd,_0x331213,_0x2fe5a3){var _0x5321c5,_0x433d8e,_0x1331bc;_0x2fe5a3[_0xa559('0x81')]=intUtil[_0xa559('0x82')](_0x2fe5a3[_0xa559('0x81')]);_0x2fe5a3[_0xa559('0x86')]=intUtil['stripTrailingSlash'](_0x2fe5a3[_0xa559('0x86')]);if(_0x331213&&_0x331213[_0xa559('0x9a')]){logger[_0xa559('0x38')]('['+_0x56ac8e[_0xa559('0x6b')]['toUpperCase']()+']',_0xa559('0x84'));_0x56ac8e['recordingURL']=_0x2fe5a3[_0xa559('0x86')]+'/api/voice/recordings/'+_0x56ac8e[_0xa559('0x87')]+_0xa559('0x88')+md5(_0x56ac8e[_0xa559('0x87')]);}else{_0x56ac8e['recordingURL']='';}var _0x3fac85=_0x2fe5a3[_0xa559('0x81')]===_0xa559('0x89')?'eu':_0xa559('0x8a');return getAccessToken(_0x2fe5a3)['then'](function(_0x107a1d){_0x1331bc=_0x107a1d;return getUser(_0x1331bc,_0x3fac85,_0x2fe5a3);})[_0xa559('0x29')](function(_0x524899){_0x5321c5=_0x524899;logger[_0xa559('0x38')](_0xa559('0x8b'),_0x5321c5['id']);return getEndUser(_0x1331bc,_0x3fac85,_0x2fe5a3,_0x56ac8e[_0xa559('0x8c')],_0x56ac8e['calleridnum'],_0x5321c5,_0x2923b1);})[_0xa559('0x29')](function(_0x25a3ad){_0x433d8e=_0x25a3ad;return getCall(_0x1331bc,_0x3fac85,_0x2fe5a3,_0x5321c5,_0x433d8e,_0x2923b1,_0x56ac8e,_0xa559('0x79'));})['then'](function(_0xacd7b8){if(_0xacd7b8){logger[_0xa559('0x38')](_0xa559('0x8e'),_0xacd7b8['id']);}})['catch'](function(_0x3f15b3){logger[_0xa559('0x2c')]('['+_0x56ac8e[_0xa559('0x6b')][_0xa559('0x9b')]()+']',JSON[_0xa559('0xf')](_0x3f15b3));});}; \ No newline at end of file +var _0x7c26=['string','type','idField','content','toString','variable','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','add','seconds','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','lead','Leads','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','Rejected','abandoned','Abandoned','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','Inbound','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes'];(function(_0x267a86,_0x3b9cdf){var _0x57d0db=function(_0x52929){while(--_0x52929){_0x267a86['push'](_0x267a86['shift']());}};_0x57d0db(++_0x3b9cdf);}(_0x7c26,0x127));var _0x67c2=function(_0x500587,_0x504eb5){_0x500587=_0x500587-0x0;var _0x39a3a3=_0x7c26[_0x500587];return _0x39a3a3;};'use strict';var _=require('lodash');var rp=require(_0x67c2('0x0'));var md5=require(_0x67c2('0x1'));var util=require(_0x67c2('0x2'));var intUtil=require(_0x67c2('0x3'));var moment=require(_0x67c2('0x4'));var Redis=require(_0x67c2('0x5'));var BPromise=require(_0x67c2('0x6'));var config=require('../../../../config/environment');var logger=require(_0x67c2('0x7'))('zoho');config[_0x67c2('0x8')]=_['defaults'](config['redis'],{'host':_0x67c2('0x9'),'port':0x18eb});var io=require(_0x67c2('0xa'))(new Redis(config[_0x67c2('0x8')]));function emit(_0xe0fea1,_0x3476a7,_0x103dfb){io['to'](_0xe0fea1)[_0x67c2('0xb')](_0x3476a7,_0x103dfb);}function request(_0x2477bb){logger[_0x67c2('0xc')]('[HTTP]',JSON[_0x67c2('0xd')](_0x2477bb));return rp(_0x2477bb);}function getCustomFields(_0x22ee0b,_0x35184a){var _0x3e410e={};if(_0x22ee0b[_0x67c2('0xe')]>0x0){_[_0x67c2('0xf')](_0x22ee0b,function(_0x2c48a9){if(_[_0x67c2('0x10')]([_0x67c2('0x11'),'picklist'],_0x2c48a9[_0x67c2('0x12')])&&_0x2c48a9[_0x67c2('0x13')]){_0x3e410e[_0x2c48a9[_0x67c2('0x13')]]=_0x2c48a9[_0x67c2('0x14')][_0x67c2('0x15')]();}else if(_0x2c48a9[_0x67c2('0x12')]===_0x67c2('0x16')&&_0x2c48a9['variableName']&&_0x2c48a9[_0x67c2('0x13')]&&_0x35184a[_0x2c48a9['variableName']]){_0x3e410e[_0x2c48a9[_0x67c2('0x13')]]=_0x35184a[_0x2c48a9['variableName']][_0x67c2('0x15')]();}else if(_0x2c48a9[_0x67c2('0x12')]===_0x67c2('0x17')&&_0x2c48a9['Variable']&&_0x2c48a9[_0x67c2('0x18')][_0x67c2('0x19')]&&_0x2c48a9[_0x67c2('0x13')]&&_0x35184a[_0x2c48a9[_0x67c2('0x18')][_0x67c2('0x19')][_0x67c2('0x1a')]()]){_0x3e410e[_0x2c48a9[_0x67c2('0x13')]]=_0x35184a[_0x2c48a9[_0x67c2('0x18')][_0x67c2('0x19')]['toLowerCase']()][_0x67c2('0x15')]();}});}return _0x3e410e;}function getName(_0x43459a){if(_0x43459a[_0x67c2('0x1b')]('\x20')>0x0){var _0x477ae0=_0x43459a[_0x67c2('0x1c')](/ (.+)/);if(_0x477ae0[0x1]){return _0x477ae0;}}return[_0x43459a,_0x43459a];}var accountsTokens={};function getAccessToken(_0x431223){return new Promise(function(_0x40a65e,_0x1f00ad){if(!_[_0x67c2('0x1d')](accountsTokens[_0x431223['id']])&&!_[_0x67c2('0x1d')](accountsTokens[_0x431223['id']]['access_token'])){if(moment()[_0x67c2('0x1e')](accountsTokens[_0x431223['id']][_0x67c2('0x1f')])){_0x40a65e(accountsTokens[_0x431223['id']]['access_token']);}}var _0x5b1250;switch(_0x431223[_0x67c2('0x20')]){case'US':_0x5b1250=_0x67c2('0x21');break;case'AU':_0x5b1250=_0x67c2('0x22');break;case'EU':_0x5b1250='https://accounts.zoho.eu';break;case'IN':_0x5b1250=_0x67c2('0x23');break;case'CN':_0x5b1250=_0x67c2('0x24');break;default:_0x5b1250=_0x67c2('0x25');break;}var _0xa8d9a0={'method':'POST','uri':_0x5b1250+_0x67c2('0x26'),'qs':{'refresh_token':_0x431223[_0x67c2('0x27')],'client_id':_0x431223[_0x67c2('0x28')],'client_secret':_0x431223[_0x67c2('0x29')],'grant_type':_0x67c2('0x2a')},'json':!![]};return rp(_0xa8d9a0)['then'](function(_0x81cc2a){accountsTokens[_0x431223['id']]={'access_token':_0x81cc2a[_0x67c2('0x2b')],'expires_in':moment()[_0x67c2('0x2c')](_0x81cc2a[_0x67c2('0x1f')],_0x67c2('0x2d'))};_0x40a65e(_0x81cc2a[_0x67c2('0x2b')]);})[_0x67c2('0x2e')](function(_0xcd5e20){logger[_0x67c2('0x2f')]('Failing\x20creating\x20the\x20access_token',_0xcd5e20[_0x67c2('0x30')]);_0x1f00ad(_0xcd5e20);});});}function getUser(_0x4e6bfb,_0x36c2ef,_0x40d6a8,_0x163f65){logger['info'](_0x67c2('0x31'));return request({'method':_0x67c2('0x32'),'uri':util[_0x67c2('0x33')](_0x67c2('0x34'),_0x36c2ef),'qs':{'type':_0x67c2('0x35')},'headers':{'Authorization':_0x67c2('0x36')+_0x4e6bfb},'json':!![]})[_0x67c2('0x37')](function(_0x2ee787){if(_0x2ee787[_0x67c2('0x38')]){var _0x4326d9=-0x1;if(_[_0x67c2('0x39')](_0x2ee787[_0x67c2('0x38')])){if(!_[_0x67c2('0x1d')](_0x163f65)){_0x4326d9=_[_0x67c2('0x3a')](_0x2ee787[_0x67c2('0x38')],function(_0x38db15){return _0x38db15[_0x67c2('0x3b')]===_0x163f65;});}if(_0x4326d9>=0x0){logger[_0x67c2('0x3c')]('Agent\x20found!');}else{logger['info'](_0x67c2('0x3d'));_0x4326d9=_[_0x67c2('0x3a')](_0x2ee787['users'],function(_0x12da05){return _0x12da05[_0x67c2('0x3e')]['name']===_0x67c2('0x3f');});}return _0x2ee787[_0x67c2('0x38')][_0x4326d9];}else{if(_0x2ee787[_0x67c2('0x40')]['profile'][_0x67c2('0x19')]==='Administrator'){logger[_0x67c2('0x3c')]('Using\x20the\x20admin\x20account!');user=_0x2ee787[_0x67c2('0x40')];return user;}else{logger[_0x67c2('0x2f')](_0x67c2('0x41'),JSON[_0x67c2('0xd')](_0x2ee787));throw new Error(_0x67c2('0x42')+JSON[_0x67c2('0xd')](_0x2ee787));}}}else{logger[_0x67c2('0x2f')](_0x67c2('0x41'),JSON[_0x67c2('0xd')](_0x2ee787));throw new Error(_0x67c2('0x42')+JSON[_0x67c2('0xd')](_0x2ee787));}})['catch'](function(_0x18709f){console['error'](_0x18709f);});}function getZohoUser(_0x3d53db,_0x3ec423){return new BPromise(function(_0x5dba3b,_0x1f2b6b){request(_0x3d53db)[_0x67c2('0x37')](function(_0xd0aec8){var _0x209f27=null;if(_0xd0aec8){_0x209f27=_0xd0aec8[_0x67c2('0x43')][0x0];_0x209f27[_0x67c2('0x44')]=_0x3ec423;}_0x5dba3b(_0x209f27);})[_0x67c2('0x2e')](function(_0x5e8028){_0x1f2b6b(_0x5e8028);});});}function createEndUser(_0x1f25a6,_0x3a77ab,_0x58a91e,_0x57f432,_0x5a6f7f,_0x1790cc){var _0x58a91e=getName(_0x58a91e);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3a77ab+_0x67c2('0x45')+_[_0x67c2('0x46')](_0x1790cc[_0x67c2('0x47')])+'s','body':{'data':[{'Last_Name':_0x58a91e[0x1],'First_Name':_0x58a91e[0x0],'Phone':_0x57f432,'Owner':{'name':!_['isNil'](_0x5a6f7f[_0x67c2('0x48')][_0x67c2('0x19')])?_0x5a6f7f[_0x67c2('0x48')][_0x67c2('0x19')]:!_[_0x67c2('0x1d')](_0x5a6f7f['first_name'])?_0x5a6f7f[_0x67c2('0x49')]+'\x20'+_0x5a6f7f[_0x67c2('0x4a')]:_0x5a6f7f['last_name'],'id':_0x5a6f7f['id']}}]},'headers':{'Authorization':_0x67c2('0x36')+_0x1f25a6},'json':!![]})[_0x67c2('0x37')](function(_0x2295cf){if(_0x2295cf&&_0x2295cf['data'][0x0][_0x67c2('0x4b')]===_0x67c2('0x4c')){var _0x5d4a21=_0x2295cf[_0x67c2('0x43')][0x0][_0x67c2('0x4d')];_0x5d4a21['enduserType']=_[_0x67c2('0x46')](_0x1790cc[_0x67c2('0x47')])+'s';return _0x5d4a21;}logger['error'](_0x67c2('0x41'),JSON[_0x67c2('0xd')](data));throw new Error(_0x67c2('0x4e')+JSON[_0x67c2('0xd')](data));})[_0x67c2('0x2e')](function(_0xf88f5){console[_0x67c2('0x4f')](_0x67c2('0x50'),_0xf88f5);});}function getEndUser(_0x5eef7f,_0x82d7c1,_0x41922e,_0x1f7f53,_0x4d2427,_0x5993e6,_0x2bdd06){var _0x33274e={'method':_0x67c2('0x32'),'uri':'','headers':{'Authorization':_0x67c2('0x36')+_0x5eef7f},'json':!![]};switch(_0x2bdd06[_0x67c2('0x51')]){case _0x67c2('0x52'):_0x33274e[_0x67c2('0x53')]=_0x67c2('0x54')+_0x82d7c1+_0x67c2('0x55')+_0x4d2427+'))';return getZohoUser(_0x33274e,_0x67c2('0x56'))[_0x67c2('0x37')](function(_0x4cd17b){if(_0x4cd17b)return _0x4cd17b;_0x33274e[_0x67c2('0x53')]=_0x67c2('0x54')+_0x82d7c1+_0x67c2('0x57')+_0x4d2427+'))';return getZohoUser(_0x33274e,'Leads')[_0x67c2('0x37')](function(_0x4ad77e){if(_0x4ad77e)return _0x4ad77e;if(_0x2bdd06['moduleCreate']!='nothing'){return createEndUser(_0x5eef7f,_0x82d7c1,_0x1f7f53,_0x4d2427,_0x5993e6,_0x2bdd06);}else{return{};}});});break;case'contact':_0x33274e[_0x67c2('0x53')]=_0x67c2('0x54')+_0x82d7c1+_0x67c2('0x55')+_0x4d2427+'))';return getZohoUser(_0x33274e,_0x67c2('0x56'))[_0x67c2('0x37')](function(_0x87d0f8){if(_0x87d0f8)return _0x87d0f8;if(_0x2bdd06['moduleCreate']!=_0x67c2('0x58')){return createEndUser(_0x5eef7f,_0x82d7c1,_0x1f7f53,_0x4d2427,_0x5993e6,_0x2bdd06);}else{return{};}});break;case _0x67c2('0x59'):_0x33274e[_0x67c2('0x53')]='https://www.zohoapis.'+_0x82d7c1+_0x67c2('0x57')+_0x4d2427+'))';return getZohoUser(_0x33274e,_0x67c2('0x5a'))[_0x67c2('0x37')](function(_0x3a5247){if(_0x3a5247)return _0x3a5247;if(_0x2bdd06['moduleCreate']!='nothing'){return createEndUser(_0x5eef7f,_0x82d7c1,_0x1f7f53,_0x4d2427,_0x5993e6,_0x2bdd06);}else{return{};}});break;}}function getCall(_0x403e6a,_0x4e72ab,_0x339b1a,_0x29c0a1,_0x3d02a9,_0x2557be,_0xdd9bdd,_0x34b8bb){logger['info'](_0x67c2('0x5b'));var _0x4ec028={};_0x4ec028[_0x67c2('0x5c')]={'name':!_['isNil'](_0x29c0a1['role'][_0x67c2('0x19')])&&!_['isNil'](_0x29c0a1[_0x67c2('0x3e')]['name'])&&_0x29c0a1['profile']['name']==='administrator'?_0x29c0a1[_0x67c2('0x48')][_0x67c2('0x19')]:!_['isNil'](_0x29c0a1[_0x67c2('0x49')])?_0x29c0a1[_0x67c2('0x49')]+'\x20'+_0x29c0a1[_0x67c2('0x4a')]:_0x29c0a1['last_name'],'id':_0x29c0a1['id']};_0x4ec028[_0x67c2('0x5d')]=intUtil[_0x67c2('0x5e')](_0x2557be[_0x67c2('0x5f')],_0xdd9bdd,'\x20');_0x4ec028[_0x67c2('0x60')]=intUtil[_0x67c2('0x5e')](_0x2557be['Descriptions'],_0xdd9bdd,'\x0a');if(_0x3d02a9[_0x67c2('0x44')]===_0x67c2('0x56')){_0x4ec028[_0x67c2('0x61')]={'name':!_['isNil'](_0x3d02a9[_0x67c2('0x62')])?_0x3d02a9[_0x67c2('0x62')]:!_['isNil'](_0x3d02a9[_0x67c2('0x63')])?_0x3d02a9['First_Name']+'\x20'+_0x3d02a9[_0x67c2('0x64')]:_0x3d02a9['Last_Name'],'id':_0x3d02a9['id']};}if(_0x3d02a9[_0x67c2('0x44')]===_0x67c2('0x5a')){_0x4ec028[_0x67c2('0x65')]={'name':!_['isNil'](_0x3d02a9[_0x67c2('0x62')])?_0x3d02a9[_0x67c2('0x62')]:!_['isNil'](_0x3d02a9[_0x67c2('0x63')])?_0x3d02a9[_0x67c2('0x63')]+'\x20'+_0x3d02a9['Last_Name']:_0x3d02a9[_0x67c2('0x64')],'id':_0x3d02a9['id']};_0x4ec028[_0x67c2('0x66')]=_['startCase'](_0x3d02a9[_0x67c2('0x44')]);}if(_0xdd9bdd['talktime']){_0x4ec028[_0x67c2('0x67')]=moment[_0x67c2('0x68')](parseInt(_0xdd9bdd[_0x67c2('0x69')])*0x3e8)[_0x67c2('0x33')](_0x67c2('0x6a'));}else if(_0xdd9bdd[_0x67c2('0x6b')]&&_0xdd9bdd['endtime']){_0x4ec028[_0x67c2('0x67')]=moment[_0x67c2('0x68')](moment(_0xdd9bdd[_0x67c2('0x6c')],_0x67c2('0x6d'))[_0x67c2('0x6e')](moment(_0xdd9bdd[_0x67c2('0x6f')],_0x67c2('0x6d'))))[_0x67c2('0x33')](_0x67c2('0x6a'));}switch(_0xdd9bdd[_0x67c2('0x70')]){case'called':_0x4ec028[_0x67c2('0x71')]=_0x67c2('0x72');break;case _0x67c2('0x73'):case _0x67c2('0x74'):_0x4ec028[_0x67c2('0x71')]=_0x67c2('0x75');break;case'rejected':_0x4ec028[_0x67c2('0x71')]=_0x67c2('0x76');break;case _0x67c2('0x77'):_0x4ec028[_0x67c2('0x71')]=_0x67c2('0x78');break;case'timeout':_0x4ec028[_0x67c2('0x71')]='Timeout';default:}_0x4ec028['Call_Start_Time']=(_0x34b8bb===_0x67c2('0x79')?moment(_0xdd9bdd[_0x67c2('0x6f')])[_0x67c2('0x33')](_0x67c2('0x6d')):moment(_0xdd9bdd[_0x67c2('0x7a')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x67c2('0x33')](_0x67c2('0x6d'));_0x4ec028[_0x67c2('0x7b')]=_0x34b8bb||'Inbound';_0x4ec028=_[_0x67c2('0x7c')](_0x4ec028,getCustomFields(_0x2557be[_0x67c2('0x7d')],_0xdd9bdd));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4e72ab+_0x67c2('0x7e'),'headers':{'Authorization':_0x67c2('0x36')+_0x403e6a},'body':{'data':[_0x4ec028]},'json':!![]})[_0x67c2('0x37')](function(_0x4ec039){if(_0x4ec039&&_0x4ec039[_0x67c2('0x43')][0x0][_0x67c2('0x4b')]===_0x67c2('0x4c')){logger[_0x67c2('0x3c')]('Call\x20created!');return{'id':_0x4ec039[_0x67c2('0x43')][0x0][_0x67c2('0x4d')]['id']};}})[_0x67c2('0x2e')](function(_0x47efcd){logger['info'](_0x67c2('0x7f'),_0x47efcd[_0x67c2('0x30')]);console[_0x67c2('0x4f')](_0x67c2('0x7f'),_0x47efcd);});}exports[_0x67c2('0x80')]=function(_0x1fdc1d,_0x43711b,_0xdabf50,_0x18c884,_0x1fb3f6,_0x40ca82){var _0x59ce37,_0x45855d,_0x15703a;_0x40ca82['host']=intUtil[_0x67c2('0x81')](_0x40ca82[_0x67c2('0x82')]);_0x40ca82['serverUrl']=intUtil[_0x67c2('0x81')](_0x40ca82[_0x67c2('0x83')]);if(_0x1fb3f6&&_0x1fb3f6[_0x67c2('0x84')]){logger[_0x67c2('0x3c')](_0x67c2('0x85'),_0x67c2('0x86'));_0x43711b['recordingURL']=_0x40ca82[_0x67c2('0x83')]+'/api/voice/recordings/'+_0x43711b[_0x67c2('0x87')]+_0x67c2('0x88')+md5(_0x43711b['uniqueid']);}else{_0x43711b[_0x67c2('0x89')]='';}var _0x3c0da3=_0x40ca82['host']===_0x67c2('0x8a')?'eu':_0x67c2('0x8b');return getAccessToken(_0x40ca82)[_0x67c2('0x37')](function(_0x6a6baf){_0x15703a=_0x6a6baf;return getUser(_0x15703a,_0x3c0da3,_0x40ca82,_0x18c884[_0x67c2('0x3b')]);})[_0x67c2('0x37')](function(_0x184aca){_0x59ce37=_0x184aca;logger[_0x67c2('0x3c')]('The\x20User\x20ID\x20is:',_0x59ce37['id']);return getEndUser(_0x15703a,_0x3c0da3,_0x40ca82,_0x43711b[_0x67c2('0x8c')],_0x43711b[_0x67c2('0x8d')],_0x59ce37,_0xdabf50);})[_0x67c2('0x37')](function(_0x1878fd){_0x45855d=_0x1878fd;return getCall(_0x15703a,_0x3c0da3,_0x40ca82,_0x59ce37,_0x45855d,_0xdabf50,_0x43711b,'Inbound');})['then'](function(_0x298b1f){if(_0x298b1f){logger['info']('The\x20Call\x20ID\x20is:',_0x298b1f['id']);logger[_0x67c2('0x3c')](_0x67c2('0x85'),_0x67c2('0x8e'));emit(util[_0x67c2('0x33')]('user:%s',_0x18c884[_0x67c2('0x19')]),_0x67c2('0x8f'),{'uri':_0x67c2('0x90')+_0x40ca82['host']+_0x67c2('0x91')+_0x298b1f['id']});}})['catch'](function(_0x42f7aa){logger[_0x67c2('0x2f')](_0x67c2('0x85'),JSON[_0x67c2('0xd')](_0x42f7aa));});};exports['outbound']=function(_0x6da215,_0x4fb86a,_0x426fe1,_0x19ece,_0x30ecbd,_0x4c26b4,_0x2c7647){var _0x4b9813,_0x1bf07b,_0x5cf0e3;_0x4c26b4[_0x67c2('0x82')]=intUtil['stripTrailingSlash'](_0x4c26b4[_0x67c2('0x82')]);_0x4c26b4[_0x67c2('0x83')]=intUtil[_0x67c2('0x81')](_0x4c26b4[_0x67c2('0x83')]);if(_0x2c7647&&_0x2c7647[_0x67c2('0x92')]&&_0x2c7647[_0x67c2('0x92')]!==_0x67c2('0x93')){logger[_0x67c2('0x3c')]('[OUTBOUND]',_0x67c2('0x86'));_0x4fb86a[_0x67c2('0x89')]=_0x4c26b4[_0x67c2('0x83')]+_0x67c2('0x94')+_0x4fb86a['uniqueid']+_0x67c2('0x88')+md5(_0x4fb86a[_0x67c2('0x87')]);}var _0x572b05=_0x4c26b4['host']==='zoho.eu'?'eu':_0x67c2('0x8b');return getAccessToken(_0x4c26b4)[_0x67c2('0x37')](function(_0x5e5222){_0x5cf0e3=_0x5e5222;return getUser(_0x5cf0e3,_0x572b05,_0x4c26b4,_0x19ece['email']);})[_0x67c2('0x37')](function(_0x4a99e7){_0x4b9813=_0x4a99e7;logger[_0x67c2('0x3c')](_0x67c2('0x95'),_0x4b9813['id']);return getEndUser(_0x5cf0e3,_0x572b05,_0x4c26b4,_0x4fb86a['destcalleridname'],_0x4fb86a[_0x67c2('0x96')],_0x4b9813,_0x426fe1);})[_0x67c2('0x37')](function(_0x4d24f3){_0x1bf07b=_0x4d24f3;return getCall(_0x5cf0e3,_0x572b05,_0x4c26b4,_0x4b9813,_0x1bf07b,_0x426fe1,_0x4fb86a,'Outbound');})[_0x67c2('0x37')](function(_0x411dd2){if(_0x411dd2){logger[_0x67c2('0x3c')](_0x67c2('0x97'),_0x411dd2['id']);logger['info'](_0x67c2('0x98'),_0x67c2('0x8e'));emit(util[_0x67c2('0x33')]('user:%s',_0x19ece[_0x67c2('0x19')]),_0x67c2('0x8f'),{'uri':_0x67c2('0x90')+_0x4c26b4[_0x67c2('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x411dd2['id']});}})[_0x67c2('0x2e')](function(_0x4bc021){logger[_0x67c2('0x2f')]('[OUTBOUND]',JSON['stringify'](_0x4bc021));});};exports[_0x67c2('0x99')]=function(_0x15800e,_0x4bd35b,_0x35d68a,_0x245d38,_0xe29eac,_0x23d90a){var _0x1dabd9,_0x154828,_0x23c1a1;_0x23d90a[_0x67c2('0x82')]=intUtil[_0x67c2('0x81')](_0x23d90a[_0x67c2('0x82')]);_0x23d90a[_0x67c2('0x83')]=intUtil[_0x67c2('0x81')](_0x23d90a[_0x67c2('0x83')]);if(_0xe29eac&&_0xe29eac[_0x67c2('0x84')]){logger[_0x67c2('0x3c')]('['+_0x4bd35b[_0x67c2('0x70')][_0x67c2('0x9a')]()+']','Recording\x20is\x20enabled!');_0x4bd35b[_0x67c2('0x89')]=_0x23d90a[_0x67c2('0x83')]+_0x67c2('0x94')+_0x4bd35b[_0x67c2('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x4bd35b[_0x67c2('0x87')]);}else{_0x4bd35b['recordingURL']='';}var _0x185306=_0x23d90a['host']===_0x67c2('0x8a')?'eu':_0x67c2('0x8b');return getAccessToken(_0x23d90a)['then'](function(_0x21908a){_0x23c1a1=_0x21908a;return getUser(_0x23c1a1,_0x185306,_0x23d90a);})[_0x67c2('0x37')](function(_0x2fc471){_0x1dabd9=_0x2fc471;logger[_0x67c2('0x3c')]('The\x20User\x20ID\x20is:',_0x1dabd9['id']);return getEndUser(_0x23c1a1,_0x185306,_0x23d90a,_0x4bd35b[_0x67c2('0x8c')],_0x4bd35b['calleridnum'],_0x1dabd9,_0x35d68a);})[_0x67c2('0x37')](function(_0x24a8af){_0x154828=_0x24a8af;return getCall(_0x23c1a1,_0x185306,_0x23d90a,_0x1dabd9,_0x154828,_0x35d68a,_0x4bd35b,_0x67c2('0x9b'));})[_0x67c2('0x37')](function(_0x1b4669){if(_0x1b4669){logger[_0x67c2('0x3c')](_0x67c2('0x97'),_0x1b4669['id']);}})[_0x67c2('0x2e')](function(_0x1a5d63){logger[_0x67c2('0x2f')]('['+_0x4bd35b[_0x67c2('0x70')]['toUpperCase']()+']',JSON[_0x67c2('0xd')](_0x1a5d63));});}; \ 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 48fb175..b4b7fee 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 _0x19a2=['exec','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','../../../../config/logger','data2','Script','render','data3'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x19a2,0x15a));var _0x219a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x19a2[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x219a('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x219a('0x1'))('trigger');exports['exec']=function(_0x4bb5f1,_0x39686c){var _0x54b9df=_0x4bb5f1['data2']?_0x4bb5f1[_0x219a('0x2')]:_0x219a('0x3');var _0x41cb25=_0x4bb5f1['data3']?Mustache[_0x219a('0x4')](_0x4bb5f1[_0x219a('0x5')],_0x39686c):_0x39686c;sh[_0x219a('0x6')](_0x41cb25,function(_0x4d045c,_0x348579,_0x44d3c3){if(_0x4d045c!==0x0){logger[_0x219a('0x7')](util[_0x219a('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x54b9df,_0x41cb25,_0x4d045c,_0x44d3c3));}else{logger[_0x219a('0x9')](util[_0x219a('0x8')](_0x219a('0xa'),_0x54b9df,_0x41cb25,_0x348579));}});}; \ No newline at end of file +var _0x34f0=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x6ca94f,_0x5913f3){var _0x5e2af3=function(_0x286a0d){while(--_0x286a0d){_0x6ca94f['push'](_0x6ca94f['shift']());}};_0x5e2af3(++_0x5913f3);}(_0x34f0,0x1b4));var _0x034f=function(_0x430d64,_0x3acf42){_0x430d64=_0x430d64-0x0;var _0x582e04=_0x34f0[_0x430d64];return _0x582e04;};'use strict';var util=require(_0x034f('0x0'));var sh=require(_0x034f('0x1'));var Mustache=require(_0x034f('0x2'));var logger=require(_0x034f('0x3'))('trigger');exports[_0x034f('0x4')]=function(_0x2af0f8,_0x181acc){var _0x4e4739=_0x2af0f8[_0x034f('0x5')]?_0x2af0f8['data2']:_0x034f('0x6');var _0xcfbe15=_0x2af0f8[_0x034f('0x7')]?Mustache[_0x034f('0x8')](_0x2af0f8['data3'],_0x181acc):_0x181acc;sh[_0x034f('0x4')](_0xcfbe15,function(_0xea0de6,_0x5edadb,_0x337d15){if(_0xea0de6!==0x0){logger[_0x034f('0x9')](util[_0x034f('0xa')](_0x034f('0xb'),_0x4e4739,_0xcfbe15,_0xea0de6,_0x337d15));}else{logger[_0x034f('0xc')](util['format'](_0x034f('0xd'),_0x4e4739,_0xcfbe15,_0x5edadb));}});}; \ 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 1039483..6d54731 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 _0x4dfe=['number','data6','parse','error','toUpperCase','GET','DELETE','data7','render','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','isNil',',\x20request\x20body:\x20','object','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','data5'];(function(_0x3d1d03,_0x1c9184){var _0xbf2e8a=function(_0x1eabb4){while(--_0x1eabb4){_0x3d1d03['push'](_0x3d1d03['shift']());}};_0xbf2e8a(++_0x1c9184);}(_0x4dfe,0x137));var _0xe4df=function(_0x1f8578,_0x125208){_0x1f8578=_0x1f8578-0x0;var _0x225c4c=_0x4dfe[_0x1f8578];return _0x225c4c;};'use strict';var rp=require(_0xe4df('0x0'));var util=require(_0xe4df('0x1'));var _=require(_0xe4df('0x2'));var Mustache=require('mustache');var logger=require(_0xe4df('0x3'))(_0xe4df('0x4'));exports[_0xe4df('0x5')]=function(_0x33330c,_0xe7bb92){var _0x417e86,_0x27f2ef;var _0xb45723={'method':_0x33330c[_0xe4df('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x33330c['data2'],_0xe7bb92),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x33330c[_0xe4df('0x7')])===_0xe4df('0x8')&&parseInt(_0x33330c[_0xe4df('0x7')])>=0x1&&parseInt(_0x33330c[_0xe4df('0x7')])<=0xa?parseInt(_0x33330c[_0xe4df('0x7')])*0x3e8:0x5*0x3e8};try{_0xb45723['headers']=_0x33330c[_0xe4df('0x9')]?JSON[_0xe4df('0xa')](Mustache['render'](_0x33330c[_0xe4df('0x9')],_0xe7bb92)):{};}catch(_0x4c0c0c){logger[_0xe4df('0xb')](_0x4c0c0c['stack']);}switch(_0x33330c[_0xe4df('0x6')][_0xe4df('0xc')]()){case _0xe4df('0xd'):case _0xe4df('0xe'):_0x417e86=null;_0xb45723['qs']=_0xe7bb92;break;case'POST':case'PUT':if(_0x33330c[_0xe4df('0xf')]){try{_0x417e86=JSON[_0xe4df('0xa')](Mustache[_0xe4df('0x10')](_0x33330c[_0xe4df('0xf')],_0xe7bb92));_0xb45723[_0xe4df('0x11')]=_0x417e86;}catch(_0x1837cd){logger[_0xe4df('0xb')](_0x1837cd['stack']);logger[_0xe4df('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x417e86=_0xe7bb92;_0xb45723[_0xe4df('0x11')]=_0x417e86;}break;}logger[_0xe4df('0x12')](util[_0xe4df('0x13')](_0xe4df('0x14'),_0x33330c[_0xe4df('0x6')],_0x33330c[_0xe4df('0x15')],JSON['stringify'](_0xb45723)));rp(_0xb45723)['then'](function(_0x5da9ee){_0x417e86=!_[_0xe4df('0x16')](_0x417e86)?_0xe4df('0x17')+_0x417e86:'';_0x27f2ef=typeof _0x5da9ee[_0xe4df('0x11')]===_0xe4df('0x18')?JSON['stringify'](_0x5da9ee[_0xe4df('0x11')]):_0x5da9ee['body'];logger['info'](util[_0xe4df('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x33330c['data1'],_0x33330c['data2'],_0x5da9ee[_0xe4df('0x19')],_0x27f2ef));})['catch'](function(_0x2ad802){logger[_0xe4df('0xb')](util[_0xe4df('0x13')](_0xe4df('0x1a'),_0x33330c['data1'],_0x33330c[_0xe4df('0x15')],_0x2ad802['statusCode'],_0x2ad802[_0xe4df('0x1b')],_0x2ad802[_0xe4df('0x1c')]));});}; \ No newline at end of file +var _0x3e93=['util','lodash','mustache','../../../../config/logger','trigger','data1','render','data2','data5','number','parse','data6','error','stack','GET','POST','PUT','body','format','then','isNil','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x3e93,0xd7));var _0x33e9=function(_0x35d3e7,_0x50f65e){_0x35d3e7=_0x35d3e7-0x0;var _0x4f2ea3=_0x3e93[_0x35d3e7];return _0x4f2ea3;};'use strict';var rp=require(_0x33e9('0x0'));var util=require(_0x33e9('0x1'));var _=require(_0x33e9('0x2'));var Mustache=require(_0x33e9('0x3'));var logger=require(_0x33e9('0x4'))(_0x33e9('0x5'));exports['exec']=function(_0x4e7393,_0x53a10e){var _0xefe9d6,_0x5bb85a;var _0x1dbc7e={'method':_0x4e7393[_0x33e9('0x6')]['toUpperCase'](),'uri':Mustache[_0x33e9('0x7')](_0x4e7393[_0x33e9('0x8')],_0x53a10e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4e7393[_0x33e9('0x9')])===_0x33e9('0xa')&&parseInt(_0x4e7393[_0x33e9('0x9')])>=0x1&&parseInt(_0x4e7393[_0x33e9('0x9')])<=0xa?parseInt(_0x4e7393[_0x33e9('0x9')])*0x3e8:0x5*0x3e8};try{_0x1dbc7e['headers']=_0x4e7393['data6']?JSON[_0x33e9('0xb')](Mustache[_0x33e9('0x7')](_0x4e7393[_0x33e9('0xc')],_0x53a10e)):{};}catch(_0x3a3b64){logger[_0x33e9('0xd')](_0x3a3b64[_0x33e9('0xe')]);}switch(_0x4e7393[_0x33e9('0x6')]['toUpperCase']()){case _0x33e9('0xf'):case'DELETE':_0xefe9d6=null;_0x1dbc7e['qs']=_0x53a10e;break;case _0x33e9('0x10'):case _0x33e9('0x11'):if(_0x4e7393['data7']){try{_0xefe9d6=JSON[_0x33e9('0xb')](Mustache['render'](_0x4e7393['data7'],_0x53a10e));_0x1dbc7e[_0x33e9('0x12')]=_0xefe9d6;}catch(_0x769f3e){logger[_0x33e9('0xd')](_0x769f3e['stack']);logger[_0x33e9('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0xefe9d6=_0x53a10e;_0x1dbc7e[_0x33e9('0x12')]=_0xefe9d6;}break;}logger['info'](util[_0x33e9('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x4e7393['data1'],_0x4e7393[_0x33e9('0x8')],JSON['stringify'](_0x1dbc7e)));rp(_0x1dbc7e)[_0x33e9('0x14')](function(_0x3ffe4d){_0xefe9d6=!_[_0x33e9('0x15')](_0xefe9d6)?',\x20request\x20body:\x20'+_0xefe9d6:'';_0x5bb85a=typeof _0x3ffe4d[_0x33e9('0x12')]===_0x33e9('0x16')?JSON[_0x33e9('0x17')](_0x3ffe4d[_0x33e9('0x12')]):_0x3ffe4d[_0x33e9('0x12')];logger['info'](util[_0x33e9('0x13')](_0x33e9('0x18'),_0x4e7393[_0x33e9('0x6')],_0x4e7393[_0x33e9('0x8')],_0x3ffe4d['statusCode'],_0x5bb85a));})['catch'](function(_0x20f614){logger[_0x33e9('0xd')](util[_0x33e9('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4e7393[_0x33e9('0x6')],_0x4e7393[_0x33e9('0x8')],_0x20f614[_0x33e9('0x19')],_0x20f614[_0x33e9('0x1a')],_0x20f614['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 433c564..ee4765d 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 _0x23d4=['bluebird','../../config/logger','routing','client','Request','then','debug','rpc','error','message','result','exports','jayson/promise'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x23d4,0xdc));var _0x423d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d4[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x423d('0x0'));var BPromise=require(_0x423d('0x1'));var logger=require(_0x423d('0x2'))(_0x423d('0x3'));var client=jayson[_0x423d('0x4')]['http']({'port':0x2329});client[_0x423d('0x5')]=function(_0x1cd4dd,_0x314126){return new BPromise(function(_0x3a3944,_0x399eca){return client['request'](_0x1cd4dd,_0x314126)[_0x423d('0x6')](function(_0x2d0ca5){logger[_0x423d('0x7')](_0x423d('0x8'),'routing',_0x1cd4dd,_0x314126,_0x2d0ca5);if(_0x2d0ca5['error']){logger['error']('rpc',_0x423d('0x3'),_0x1cd4dd,_0x2d0ca5[_0x423d('0x9')][_0x423d('0xa')],_0x314126);return _0x399eca(_0x2d0ca5['error'][_0x423d('0xa')]);}else{return _0x3a3944(_0x2d0ca5[_0x423d('0xb')]);}})['catch'](function(_0x4fab9a){logger[_0x423d('0x9')](_0x423d('0x8'),_0x423d('0x3'),_0x1cd4dd,_0x4fab9a,_0x314126);return _0x399eca(_0x4fab9a);});});};module[_0x423d('0xc')]=client; \ No newline at end of file +var _0x4bf2=['http','request','debug','error','message','result','catch','rpc','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x24987f,_0x411c7e){var _0x241b28=function(_0x1ae82f){while(--_0x1ae82f){_0x24987f['push'](_0x24987f['shift']());}};_0x241b28(++_0x411c7e);}(_0x4bf2,0x14e));var _0x24bf=function(_0x4d275c,_0x522396){_0x4d275c=_0x4d275c-0x0;var _0x55b75f=_0x4bf2[_0x4d275c];return _0x55b75f;};'use strict';var jayson=require(_0x24bf('0x0'));var BPromise=require('bluebird');var logger=require(_0x24bf('0x1'))(_0x24bf('0x2'));var client=jayson[_0x24bf('0x3')][_0x24bf('0x4')]({'port':0x2329});client['Request']=function(_0x32b8cf,_0x2d046d){return new BPromise(function(_0x373c1d,_0x59c0ca){return client[_0x24bf('0x5')](_0x32b8cf,_0x2d046d)['then'](function(_0x16ec54){logger[_0x24bf('0x6')]('rpc',_0x24bf('0x2'),_0x32b8cf,_0x2d046d,_0x16ec54);if(_0x16ec54[_0x24bf('0x7')]){logger['error']('rpc',_0x24bf('0x2'),_0x32b8cf,_0x16ec54['error'][_0x24bf('0x8')],_0x2d046d);return _0x59c0ca(_0x16ec54[_0x24bf('0x7')][_0x24bf('0x8')]);}else{return _0x373c1d(_0x16ec54[_0x24bf('0x9')]);}})[_0x24bf('0xa')](function(_0x454747){logger[_0x24bf('0x7')](_0x24bf('0xb'),_0x24bf('0x2'),_0x32b8cf,_0x454747,_0x2d046d);return _0x59c0ca(_0x454747);});});};module[_0x24bf('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e69c05d..09a4984 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 _0x328d=['initMailAccounts','mailAccounts','listen','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts'];(function(_0x147e9e,_0x3dfac5){var _0x1b42cf=function(_0x3a9bdc){while(--_0x3a9bdc){_0x147e9e['push'](_0x147e9e['shift']());}};_0x1b42cf(++_0x3dfac5);}(_0x328d,0x19a));var _0xd328=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x328d[_0x5f3f88];return _0xd08119;};'use strict';var server=require(_0xd328('0x0'));var Realtime=require(_0xd328('0x1'));var EmailChannel=require(_0xd328('0x2'));var mailAccount=require(_0xd328('0x3'));var setting=require(_0xd328('0x4'));var logger=require(_0xd328('0x5'))(_0xd328('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd328('0x7')]()[_0xd328('0x8')](mailAccount[_0xd328('0x9')]())['then'](realtime[_0xd328('0xa')]())['then'](function(){email['refresh'](realtime[_0xd328('0xb')]);return realtime;});}function main(){return server[_0xd328('0xc')](realtime,email)[_0xd328('0x8')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})['then'](function(_0x54107a){return setInterval(initRealtime,_0x54107a['loginMailFrequency']*0x3e8);})[_0xd328('0xd')](function(_0x596d20){logger['error'](_0xd328('0xe'),_0x596d20);});}main(); \ No newline at end of file +var _0xf206=['initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts'];(function(_0x3c84f2,_0x44619e){var _0x3fb9aa=function(_0x32e52c){while(--_0x32e52c){_0x3c84f2['push'](_0x3c84f2['shift']());}};_0x3fb9aa(++_0x44619e);}(_0xf206,0x109));var _0x6f20=function(_0x27bf3c,_0x1e416a){_0x27bf3c=_0x27bf3c-0x0;var _0x15b8b3=_0xf206[_0x27bf3c];return _0x15b8b3;};'use strict';var server=require(_0x6f20('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x6f20('0x1'));var setting=require(_0x6f20('0x2'));var logger=require(_0x6f20('0x3'))(_0x6f20('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6f20('0x5')](mailAccount[_0x6f20('0x6')]())[_0x6f20('0x5')](realtime[_0x6f20('0x7')]())[_0x6f20('0x5')](function(){email[_0x6f20('0x8')](realtime[_0x6f20('0x9')]);return realtime;});}function main(){return server[_0x6f20('0xa')](realtime,email)[_0x6f20('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x6f20('0xb')]();})['then'](function(_0x3e17b0){return setInterval(initRealtime,_0x3e17b0[_0x6f20('0xc')]*0x3e8);})[_0x6f20('0xd')](function(_0x3706e5){logger[_0x6f20('0xe')](_0x6f20('0xf'),_0x3706e5);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6b0f391..4b0fa87 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 _0x74a0=['catch','stringify','lastSync','Smtp','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','total','mailAccount:update','refresh','hasOwnProperty','provider','service','email','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then'];(function(_0x46413f,_0x1944b0){var _0x1551f3=function(_0x1e080f){while(--_0x1e080f){_0x46413f['push'](_0x46413f['shift']());}};_0x1551f3(++_0x1944b0);}(_0x74a0,0x75));var _0x074a=function(_0x1e6980,_0x42d0d7){_0x1e6980=_0x1e6980-0x0;var _0x7b7996=_0x74a0[_0x1e6980];return _0x7b7996;};'use strict';var _=require(_0x074a('0x0'));var moment=require(_0x074a('0x1'));var BPromise=require(_0x074a('0x2'));var md5=require(_0x074a('0x3'));var Redis=require(_0x074a('0x4'));var config=require(_0x074a('0x5'));var logger=require(_0x074a('0x6'))('email');config[_0x074a('0x7')]=_[_0x074a('0x8')](config['redis'],{'host':_0x074a('0x9'),'port':0x18eb});var io=require(_0x074a('0xa'))(new Redis(config[_0x074a('0x7')]));var EmailImap=require(_0x074a('0xb'));var EmailSmtp=require(_0x074a('0xc'));var mailAccount=require(_0x074a('0xd'));var md5Accounts={};function EmailChannel(_0x4c9382){logger[_0x074a('0xe')](_0x074a('0xf'));this[_0x074a('0x10')]=_0x4c9382[_0x074a('0x10')];this[_0x074a('0x11')]={};this[_0x074a('0x12')]=new EmailSmtp();}EmailChannel[_0x074a('0x13')][_0x074a('0x14')]=function(_0x2852b6){var _0x4a9261=this[_0x074a('0x10')][_0x2852b6];var _0x533ba1={'id':_0x4a9261['id'],'name':_0x4a9261[_0x074a('0x15')],'key':_0x4a9261['key'],'active':_0x4a9261[_0x074a('0x16')],'Imap':{'status':_0x4a9261[_0x074a('0x17')][_0x074a('0x18')],'messageStatus':_0x4a9261[_0x074a('0x17')]['messageStatus'],'total':_0x4a9261[_0x074a('0x17')][_0x074a('0x19')]}};if(_['isNil'](md5Accounts[_0x2852b6])){md5Accounts[_0x2852b6]={};}var _0x5d1dcb=md5(JSON['stringify'](_0x533ba1));if(md5Accounts[_0x2852b6][_0x074a('0x3')]!==_0x5d1dcb){md5Accounts[_0x2852b6][_0x074a('0x3')]=_0x5d1dcb;io[_0x074a('0x14')](_0x074a('0x1a'),_0x533ba1);}};EmailChannel['prototype'][_0x074a('0x1b')]=function(_0x306767){for(var _0x435018 in _0x306767){if(_0x306767[_0x074a('0x1c')](_0x435018)){if(_0x306767[_0x435018][_0x074a('0x17')]&&_0x306767[_0x435018][_0x074a('0x16')]){var _0x1d9d91=_0x306767[_0x435018][_0x074a('0x17')];if(!_0x1d9d91['service']&&_0x306767[_0x435018][_0x074a('0x1d')]!=='custom')_0x1d9d91[_0x074a('0x1e')]=_0x306767[_0x435018][_0x074a('0x1d')];if(!this[_0x074a('0x11')][_0x074a('0x1c')](_0x1d9d91['id'])){this[_0x074a('0x11')][_0x1d9d91['id']]=new EmailImap(_0x1d9d91,_0x306767[_0x435018][_0x074a('0x1f')]);this[_0x074a('0x11')][_0x1d9d91['id']]['on'](_0x074a('0x20'),this['handleImapBox'][_0x074a('0x21')](this,_0x435018));this[_0x074a('0x11')][_0x1d9d91['id']]['on']('email',this[_0x074a('0x22')]['bind'](this,_0x435018));this[_0x074a('0x11')][_0x1d9d91['id']]['on'](_0x074a('0x23'),this[_0x074a('0x24')][_0x074a('0x21')](this,_0x435018));this['imapAccounts'][_0x1d9d91['id']]['on'](_0x074a('0x25'),this[_0x074a('0x26')]['bind'](this,_0x435018));}}else{if(_[_0x074a('0x27')](this[_0x074a('0x10')][_0x435018][_0x074a('0x17')])){this[_0x074a('0x10')][_0x435018][_0x074a('0x17')]={};}this[_0x074a('0x10')][_0x435018][_0x074a('0x17')][_0x074a('0x18')]=_0x074a('0x28');this[_0x074a('0x10')][_0x435018][_0x074a('0x17')][_0x074a('0x29')]='';this['emit'](_0x435018);}}}};EmailChannel[_0x074a('0x13')][_0x074a('0x2a')]=function(_0x4baffe,_0x569b79){if(this[_0x074a('0x10')][_0x4baffe]){this[_0x074a('0x10')][_0x4baffe][_0x074a('0x17')]['status']=_0x074a('0x2b');this[_0x074a('0x10')][_0x4baffe]['Imap']['messageStatus']=_0x569b79[_0x074a('0x15')];if(_0x569b79[_0x074a('0x2c')]){this['mailAccounts'][_0x4baffe][_0x074a('0x17')]['total']=_0x569b79[_0x074a('0x2c')]['total'];}return this['emit'](_0x4baffe);}};EmailChannel['prototype'][_0x074a('0x22')]=function(_0x2833b0,_0x41e0a5){logger[_0x074a('0xe')](_0x074a('0x2d'),_0x41e0a5[_0x074a('0x2e')],_0x41e0a5[_0x074a('0x2f')],_0x41e0a5[_0x074a('0x30')],_0x2833b0);if(this[_0x074a('0x10')][_0x2833b0]){return mailAccount[_0x074a('0x31')](_0x2833b0,_0x41e0a5)[_0x074a('0x32')](function(_0x1f5f7d){if(_0x1f5f7d){logger[_0x074a('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0x074a('0x33')](function(_0x136f1a){logger[_0x074a('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x074a('0x34')](_0x136f1a));});}};EmailChannel[_0x074a('0x13')][_0x074a('0x24')]=function(_0x231860){if(this['mailAccounts'][_0x231860]&&this[_0x074a('0x10')][_0x231860]['Imap']){if(this[_0x074a('0x11')][this[_0x074a('0x10')][_0x231860]['Imap']['id']]){delete this[_0x074a('0x11')][this['mailAccounts'][_0x231860][_0x074a('0x17')]['id']];}this[_0x074a('0x10')][_0x231860][_0x074a('0x17')][_0x074a('0x35')]=moment();this[_0x074a('0x14')](_0x231860);}};EmailChannel[_0x074a('0x13')][_0x074a('0x26')]=function(_0x1fe4d2,_0x3bc782){if(this[_0x074a('0x10')][_0x1fe4d2]){this['mailAccounts'][_0x1fe4d2][_0x074a('0x17')][_0x074a('0x18')]='error';this[_0x074a('0x10')][_0x1fe4d2][_0x074a('0x17')][_0x074a('0x29')]=_0x3bc782;return this[_0x074a('0x14')](_0x1fe4d2);}};EmailChannel[_0x074a('0x13')]['sendMail']=function(_0x20c551,_0x4272af){return this[_0x074a('0x12')]['send'](_0x20c551,_0x4272af);};EmailChannel[_0x074a('0x13')]['verifySmtp']=function(_0x44bf6d){var _0x513e81=this;if(this['mailAccounts'][_0x44bf6d['id']]){if(_[_0x074a('0x27')](this[_0x074a('0x10')][_0x44bf6d['id']][_0x074a('0x36')])){this['mailAccounts'][_0x44bf6d['id']][_0x074a('0x36')]={};}this[_0x074a('0x10')][_0x44bf6d['id']][_0x074a('0x36')][_0x074a('0x35')]=moment();return new BPromise(function(_0x1bc34a,_0x596db0){return _0x513e81[_0x074a('0x12')][_0x074a('0x37')](_0x44bf6d)[_0x074a('0x32')](function(_0x563425){_0x513e81[_0x074a('0x10')][_0x44bf6d['id']][_0x074a('0x36')][_0x074a('0x18')]='verified';_0x513e81[_0x074a('0x10')][_0x44bf6d['id']][_0x074a('0x36')][_0x074a('0x29')]='';_0x513e81[_0x074a('0x14')](_0x44bf6d['id']);_0x1bc34a(_0x563425);})['catch'](function(_0x4cd8c6){_0x513e81[_0x074a('0x10')][_0x44bf6d['id']][_0x074a('0x36')][_0x074a('0x18')]=_0x074a('0x25');_0x513e81[_0x074a('0x10')][_0x44bf6d['id']]['Smtp']['messageStatus']=_0x4cd8c6;_0x513e81['emit'](_0x44bf6d['id']);_0x596db0(_0x4cd8c6);});});}return this[_0x074a('0x12')][_0x074a('0x37')](_0x44bf6d);};module['exports']=EmailChannel; \ No newline at end of file +var _0xef12=['firstName','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','md5','refresh','hasOwnProperty','service','custom','box','bind','end','handleImapEnd','handleImapError','disabled','messageStatus','handleImapBox','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0x3dd754,_0x304562){var _0x4102d3=function(_0x3f8e98){while(--_0x3f8e98){_0x3dd754['push'](_0x3dd754['shift']());}};_0x4102d3(++_0x304562);}(_0xef12,0x1d5));var _0x2ef1=function(_0x3fcc69,_0x3bb8d4){_0x3fcc69=_0x3fcc69-0x0;var _0x342bc6=_0xef12[_0x3fcc69];return _0x342bc6;};'use strict';var _=require(_0x2ef1('0x0'));var moment=require(_0x2ef1('0x1'));var BPromise=require(_0x2ef1('0x2'));var md5=require('md5');var Redis=require(_0x2ef1('0x3'));var config=require(_0x2ef1('0x4'));var logger=require(_0x2ef1('0x5'))(_0x2ef1('0x6'));config[_0x2ef1('0x7')]=_[_0x2ef1('0x8')](config['redis'],{'host':_0x2ef1('0x9'),'port':0x18eb});var io=require(_0x2ef1('0xa'))(new Redis(config[_0x2ef1('0x7')]));var EmailImap=require(_0x2ef1('0xb'));var EmailSmtp=require(_0x2ef1('0xc'));var mailAccount=require(_0x2ef1('0xd'));var md5Accounts={};function EmailChannel(_0x423026){logger['info']('start\x20email\x20channel');this[_0x2ef1('0xe')]=_0x423026['mailAccounts'];this[_0x2ef1('0xf')]={};this[_0x2ef1('0x10')]=new EmailSmtp();}EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x12')]=function(_0x2f9d36){var _0x4479fa=this[_0x2ef1('0xe')][_0x2f9d36];var _0x5bc4fa={'id':_0x4479fa['id'],'name':_0x4479fa[_0x2ef1('0x13')],'key':_0x4479fa[_0x2ef1('0x14')],'active':_0x4479fa[_0x2ef1('0x15')],'Imap':{'status':_0x4479fa[_0x2ef1('0x16')][_0x2ef1('0x17')],'messageStatus':_0x4479fa[_0x2ef1('0x16')]['messageStatus'],'total':_0x4479fa[_0x2ef1('0x16')][_0x2ef1('0x18')]}};if(_[_0x2ef1('0x19')](md5Accounts[_0x2f9d36])){md5Accounts[_0x2f9d36]={};}var _0x3c0572=md5(JSON['stringify'](_0x5bc4fa));if(md5Accounts[_0x2f9d36]['md5']!==_0x3c0572){md5Accounts[_0x2f9d36][_0x2ef1('0x1a')]=_0x3c0572;io[_0x2ef1('0x12')]('mailAccount:update',_0x5bc4fa);}};EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x1b')]=function(_0x1dd60c){for(var _0x5ad2e5 in _0x1dd60c){if(_0x1dd60c[_0x2ef1('0x1c')](_0x5ad2e5)){if(_0x1dd60c[_0x5ad2e5][_0x2ef1('0x16')]&&_0x1dd60c[_0x5ad2e5][_0x2ef1('0x15')]){var _0x37a439=_0x1dd60c[_0x5ad2e5][_0x2ef1('0x16')];if(!_0x37a439[_0x2ef1('0x1d')]&&_0x1dd60c[_0x5ad2e5]['provider']!==_0x2ef1('0x1e'))_0x37a439[_0x2ef1('0x1d')]=_0x1dd60c[_0x5ad2e5]['provider'];if(!this[_0x2ef1('0xf')]['hasOwnProperty'](_0x37a439['id'])){this['imapAccounts'][_0x37a439['id']]=new EmailImap(_0x37a439,_0x1dd60c[_0x5ad2e5][_0x2ef1('0x6')]);this['imapAccounts'][_0x37a439['id']]['on'](_0x2ef1('0x1f'),this['handleImapBox'][_0x2ef1('0x20')](this,_0x5ad2e5));this[_0x2ef1('0xf')][_0x37a439['id']]['on']('email',this['handleImapEmail'][_0x2ef1('0x20')](this,_0x5ad2e5));this[_0x2ef1('0xf')][_0x37a439['id']]['on'](_0x2ef1('0x21'),this[_0x2ef1('0x22')][_0x2ef1('0x20')](this,_0x5ad2e5));this[_0x2ef1('0xf')][_0x37a439['id']]['on']('error',this[_0x2ef1('0x23')]['bind'](this,_0x5ad2e5));}}else{if(_[_0x2ef1('0x19')](this[_0x2ef1('0xe')][_0x5ad2e5][_0x2ef1('0x16')])){this['mailAccounts'][_0x5ad2e5]['Imap']={};}this['mailAccounts'][_0x5ad2e5][_0x2ef1('0x16')]['status']=_0x2ef1('0x24');this[_0x2ef1('0xe')][_0x5ad2e5][_0x2ef1('0x16')][_0x2ef1('0x25')]='';this[_0x2ef1('0x12')](_0x5ad2e5);}}}};EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x26')]=function(_0x5ae284,_0xe8c6b0){if(this[_0x2ef1('0xe')][_0x5ae284]){this['mailAccounts'][_0x5ae284][_0x2ef1('0x16')][_0x2ef1('0x17')]=_0x2ef1('0x27');this[_0x2ef1('0xe')][_0x5ae284]['Imap'][_0x2ef1('0x25')]=_0xe8c6b0[_0x2ef1('0x13')];if(_0xe8c6b0[_0x2ef1('0x28')]){this[_0x2ef1('0xe')][_0x5ae284][_0x2ef1('0x16')][_0x2ef1('0x18')]=_0xe8c6b0['messages'][_0x2ef1('0x18')];}return this[_0x2ef1('0x12')](_0x5ae284);}};EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x29')]=function(_0x57d4c9,_0x5c841a){logger[_0x2ef1('0x2a')](_0x2ef1('0x2b'),_0x5c841a[_0x2ef1('0x2c')],_0x5c841a['lastName'],_0x5c841a['from'],_0x57d4c9);if(this['mailAccounts'][_0x57d4c9]){return mailAccount[_0x2ef1('0x2d')](_0x57d4c9,_0x5c841a)['then'](function(_0x284100){if(_0x284100){logger[_0x2ef1('0x2a')](_0x2ef1('0x2e'));}})[_0x2ef1('0x2f')](function(_0x139041){logger[_0x2ef1('0x30')](_0x2ef1('0x31'),JSON['stringify'](_0x139041));});}};EmailChannel['prototype'][_0x2ef1('0x22')]=function(_0x1c72cd){if(this['mailAccounts'][_0x1c72cd]&&this[_0x2ef1('0xe')][_0x1c72cd]['Imap']){if(this['imapAccounts'][this[_0x2ef1('0xe')][_0x1c72cd][_0x2ef1('0x16')]['id']]){delete this[_0x2ef1('0xf')][this['mailAccounts'][_0x1c72cd][_0x2ef1('0x16')]['id']];}this[_0x2ef1('0xe')][_0x1c72cd][_0x2ef1('0x16')][_0x2ef1('0x32')]=moment();this[_0x2ef1('0x12')](_0x1c72cd);}};EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x23')]=function(_0x1e57dc,_0x3cfde1){if(this['mailAccounts'][_0x1e57dc]){this[_0x2ef1('0xe')][_0x1e57dc][_0x2ef1('0x16')][_0x2ef1('0x17')]=_0x2ef1('0x30');this[_0x2ef1('0xe')][_0x1e57dc][_0x2ef1('0x16')][_0x2ef1('0x25')]=_0x3cfde1;return this['emit'](_0x1e57dc);}};EmailChannel[_0x2ef1('0x11')][_0x2ef1('0x33')]=function(_0x4c34e9,_0x26a701){return this[_0x2ef1('0x10')][_0x2ef1('0x34')](_0x4c34e9,_0x26a701);};EmailChannel['prototype'][_0x2ef1('0x35')]=function(_0xb7ba64){var _0x3fcbff=this;if(this[_0x2ef1('0xe')][_0xb7ba64['id']]){if(_[_0x2ef1('0x19')](this[_0x2ef1('0xe')][_0xb7ba64['id']][_0x2ef1('0x36')])){this['mailAccounts'][_0xb7ba64['id']][_0x2ef1('0x36')]={};}this[_0x2ef1('0xe')][_0xb7ba64['id']][_0x2ef1('0x36')][_0x2ef1('0x32')]=moment();return new BPromise(function(_0x60ece6,_0x1ba892){return _0x3fcbff['smtp'][_0x2ef1('0x37')](_0xb7ba64)[_0x2ef1('0x38')](function(_0x5b9d25){_0x3fcbff[_0x2ef1('0xe')][_0xb7ba64['id']][_0x2ef1('0x36')]['status']='verified';_0x3fcbff[_0x2ef1('0xe')][_0xb7ba64['id']][_0x2ef1('0x36')][_0x2ef1('0x25')]='';_0x3fcbff[_0x2ef1('0x12')](_0xb7ba64['id']);_0x60ece6(_0x5b9d25);})[_0x2ef1('0x2f')](function(_0x15c0fe){_0x3fcbff[_0x2ef1('0xe')][_0xb7ba64['id']][_0x2ef1('0x36')]['status']='error';_0x3fcbff['mailAccounts'][_0xb7ba64['id']]['Smtp'][_0x2ef1('0x25')]=_0x15c0fe;_0x3fcbff[_0x2ef1('0x12')](_0xb7ba64['id']);_0x1ba892(_0x15c0fe);});});}return this[_0x2ef1('0x10')][_0x2ef1('0x37')](_0xb7ba64);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 45f00b0..e145518 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 _0x11f5=['openBox','handleOpenBox','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','closeBox','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','handleReady'];(function(_0x4e6938,_0xe1cef8){var _0x56c09b=function(_0xcd8401){while(--_0xcd8401){_0x4e6938['push'](_0x4e6938['shift']());}};_0x56c09b(++_0xe1cef8);}(_0x11f5,0x1d9));var _0x511f=function(_0x294e9e,_0x1c5905){_0x294e9e=_0x294e9e-0x0;var _0x35926e=_0x11f5[_0x294e9e];return _0x35926e;};'use strict';var _=require(_0x511f('0x0'));var util=require(_0x511f('0x1'));var Imap=require(_0x511f('0x2'));var simpleParser=require(_0x511f('0x3'))[_0x511f('0x4')];var Iconv=require('iconv')[_0x511f('0x5')];var EventEmitter=require(_0x511f('0x6'))[_0x511f('0x7')];var utils=require(_0x511f('0x8'));var logger=require(_0x511f('0x9'))(_0x511f('0xa'));function EmailImap(_0x421db3,_0x6fcd17){this[_0x511f('0xb')]=_0x421db3[_0x511f('0xb')];this[_0x511f('0xc')]=this[_0x511f('0xd')](_0x421db3,_0x6fcd17);this[_0x511f('0x2')]=new Imap(this[_0x511f('0xc')]);this[_0x511f('0x2')]['once'](_0x511f('0xe'),this['handleReady'][_0x511f('0xf')](this));this[_0x511f('0x2')][_0x511f('0x10')](_0x511f('0x11'),this[_0x511f('0x12')][_0x511f('0xf')](this));this[_0x511f('0x2')]['on'](_0x511f('0x13'),this[_0x511f('0x14')][_0x511f('0xf')](this));this[_0x511f('0x2')][_0x511f('0x15')]();}util[_0x511f('0x16')](EmailImap,EventEmitter);EmailImap[_0x511f('0x17')][_0x511f('0xd')]=function(_0x39291c,_0x224e2e){var _0x1d071d={'connTimeout':_0x39291c['connTimeout']?_0x39291c[_0x511f('0x18')]*0x3e8:0x2710,'authTimeout':_0x39291c[_0x511f('0x19')]?_0x39291c[_0x511f('0x19')]*0x3e8:0x1388};if(_0x39291c['service']){_0x1d071d[_0x511f('0x1a')]=_0x39291c[_0x511f('0x1a')];if(_0x39291c[_0x511f('0x1b')]){_0x1d071d[_0x511f('0x1c')]=utils['generateXOAuth2Token'](_0x39291c[_0x511f('0x1d')][_0x511f('0x1e')],_0x39291c[_0x511f('0x1a')]);}else{_0x1d071d[_0x511f('0x1f')]=_0x39291c['password'];}}else{if(_0x39291c[_0x511f('0x20')]){_0x1d071d[_0x511f('0x1a')]=_0x39291c[_0x511f('0x1a')];_0x1d071d[_0x511f('0x1f')]=_0x39291c[_0x511f('0x1f')];}}_0x1d071d[_0x511f('0xa')]=_0x224e2e||_0x39291c[_0x511f('0x1a')]||_0x511f('0x21');_0x1d071d[_0x511f('0x22')]=_0x39291c[_0x511f('0x22')];_0x1d071d[_0x511f('0x23')]=_0x39291c[_0x511f('0x23')]||0x3e1;if(_0x39291c['tls']){_0x1d071d['tls']=!![];}else{_0x1d071d[_0x511f('0x24')]=![];_0x1d071d[_0x511f('0x25')]='required';}return _0x1d071d;};EmailImap[_0x511f('0x17')][_0x511f('0x26')]=function(){this[_0x511f('0x2')][_0x511f('0x27')](this[_0x511f('0xb')],![],this[_0x511f('0x28')][_0x511f('0xf')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x52151d,_0x1185c2){if(_0x52151d){this[_0x511f('0x14')](_0x52151d,!![]);}else{this['emit']('box',_0x1185c2);this['readUnseen']();}};EmailImap[_0x511f('0x17')][_0x511f('0x29')]=function(_0x3765f9){if(_0x3765f9){this[_0x511f('0x14')](_0x3765f9,!![]);}else{this[_0x511f('0x2')][_0x511f('0x11')]();}};EmailImap[_0x511f('0x17')][_0x511f('0x2a')]=function(){this[_0x511f('0x2')][_0x511f('0x2b')]([_0x511f('0x2c')],this['handleReadUnseen'][_0x511f('0xf')](this));};EmailImap[_0x511f('0x17')][_0x511f('0x2d')]=function(_0x3bdcb5,_0x1899a8){if(_0x3bdcb5){this['handleError'](_0x3bdcb5,!![]);}else{if(_0x1899a8[_0x511f('0x2e')]){try{var _0x2a200a=this['imap'][_0x511f('0x2f')](_0x1899a8,{'bodies':'','markSeen':!![]});_0x2a200a['on'](_0x511f('0x30'),this[_0x511f('0x31')][_0x511f('0xf')](this));_0x2a200a['once'](_0x511f('0x13'),this[_0x511f('0x32')]['bind'](this));_0x2a200a[_0x511f('0x10')]('end',this['handleFetchEnd'][_0x511f('0xf')](this));}catch(_0x280f75){logger[_0x511f('0x13')](_0x280f75);}}else{this['imap']['closeBox'](!![],this[_0x511f('0x29')][_0x511f('0xf')](this));}}};EmailImap[_0x511f('0x17')][_0x511f('0x31')]=function(_0x40d82d){_0x40d82d['on'](_0x511f('0x33'),this[_0x511f('0x34')]['bind'](this));_0x40d82d[_0x511f('0x10')](_0x511f('0x35'),this[_0x511f('0x36')][_0x511f('0xf')](this));_0x40d82d[_0x511f('0x10')](_0x511f('0x11'),this[_0x511f('0x37')][_0x511f('0xf')](this));};EmailImap['prototype'][_0x511f('0x34')]=function(_0x1ebc1a){simpleParser(_0x1ebc1a,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0x511f('0x17')][_0x511f('0x36')]=function(){};EmailImap[_0x511f('0x17')][_0x511f('0x37')]=function(){};EmailImap['prototype'][_0x511f('0x38')]=function(_0x4cc502,_0x17a0c9){if(_0x4cc502){logger[_0x511f('0x13')](_0x4cc502);}else{var _0x424911=this;utils[_0x511f('0x39')](this[_0x511f('0xc')],_0x17a0c9,function(_0x39d1c7){_0x424911[_0x511f('0x3a')]('email',_0x39d1c7);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x511f('0x2')][_0x511f('0x3b')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x511f('0x17')][_0x511f('0x32')]=function(_0x599d06){this[_0x511f('0x14')](_0x599d06);this[_0x511f('0x2')][_0x511f('0x3b')](!![],this[_0x511f('0x29')]['bind'](this));};EmailImap[_0x511f('0x17')][_0x511f('0x12')]=function(){this[_0x511f('0x3a')](_0x511f('0x11'));};EmailImap[_0x511f('0x17')][_0x511f('0x14')]=function(_0x5c1354,_0x3353f3){logger['error'](_0x511f('0x14'),this[_0x511f('0xc')][_0x511f('0xa')],JSON[_0x511f('0x3c')](_0x5c1354));var _0x28415f='';if(_0x5c1354){if(_0x5c1354[_0x511f('0x3d')]){_0x28415f=_0x5c1354[_0x511f('0x3d')];}else{for(var _0x3506fc in _0x5c1354){if(_0x5c1354['hasOwnProperty'](_0x3506fc)){_0x28415f+=_[_0x511f('0x3e')](_0x3506fc)+':\x20'+_0x5c1354[_0x3506fc]+'\x0a';}}}}if(_0x3353f3){this[_0x511f('0x2')][_0x511f('0x11')]();}else{this[_0x511f('0x3a')](_0x511f('0x13'),_0x28415f);this['emit'](_0x511f('0x11'));}};module[_0x511f('0x3f')]=EmailImap; \ No newline at end of file +var _0x92d4=['readUnseen','search','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','end','handleEnd','error','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','box','handleCloseBox'];(function(_0x490f65,_0x2229e3){var _0x57a7a7=function(_0x2623e0){while(--_0x2623e0){_0x490f65['push'](_0x490f65['shift']());}};_0x57a7a7(++_0x2229e3);}(_0x92d4,0x1ec));var _0x492d=function(_0x11fc77,_0x296b53){_0x11fc77=_0x11fc77-0x0;var _0x38293f=_0x92d4[_0x11fc77];return _0x38293f;};'use strict';var _=require(_0x492d('0x0'));var util=require(_0x492d('0x1'));var Imap=require(_0x492d('0x2'));var simpleParser=require(_0x492d('0x3'))['simpleParser'];var Iconv=require(_0x492d('0x4'))['Iconv'];var EventEmitter=require(_0x492d('0x5'))[_0x492d('0x6')];var utils=require(_0x492d('0x7'));var logger=require(_0x492d('0x8'))(_0x492d('0x9'));function EmailImap(_0x1296be,_0x12c5f6){this['mailbox']=_0x1296be[_0x492d('0xa')];this[_0x492d('0xb')]=this[_0x492d('0xc')](_0x1296be,_0x12c5f6);this['imap']=new Imap(this['account']);this['imap']['once'](_0x492d('0xd'),this[_0x492d('0xe')]['bind'](this));this[_0x492d('0x2')]['once'](_0x492d('0xf'),this[_0x492d('0x10')]['bind'](this));this[_0x492d('0x2')]['on'](_0x492d('0x11'),this[_0x492d('0x12')][_0x492d('0x13')](this));this[_0x492d('0x2')][_0x492d('0x14')]();}util[_0x492d('0x15')](EmailImap,EventEmitter);EmailImap[_0x492d('0x16')][_0x492d('0xc')]=function(_0x5a3a0a,_0x28bccd){var _0x24981b={'connTimeout':_0x5a3a0a[_0x492d('0x17')]?_0x5a3a0a['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5a3a0a[_0x492d('0x18')]?_0x5a3a0a[_0x492d('0x18')]*0x3e8:0x1388};if(_0x5a3a0a['service']){_0x24981b[_0x492d('0x19')]=_0x5a3a0a[_0x492d('0x19')];if(_0x5a3a0a['modernAuthentication']){_0x24981b[_0x492d('0x1a')]=utils[_0x492d('0x1b')](_0x5a3a0a['CloudProvider']['data5'],_0x5a3a0a[_0x492d('0x19')]);}else{_0x24981b[_0x492d('0x1c')]=_0x5a3a0a[_0x492d('0x1c')];}}else{if(_0x5a3a0a[_0x492d('0x1d')]){_0x24981b[_0x492d('0x19')]=_0x5a3a0a[_0x492d('0x19')];_0x24981b[_0x492d('0x1c')]=_0x5a3a0a[_0x492d('0x1c')];}}_0x24981b[_0x492d('0x9')]=_0x28bccd||_0x5a3a0a['user']||'anonymous@xcally.com';_0x24981b[_0x492d('0x1e')]=_0x5a3a0a[_0x492d('0x1e')];_0x24981b['port']=_0x5a3a0a[_0x492d('0x1f')]||0x3e1;if(_0x5a3a0a[_0x492d('0x20')]){_0x24981b[_0x492d('0x20')]=!![];}else{_0x24981b[_0x492d('0x20')]=![];_0x24981b[_0x492d('0x21')]='required';}return _0x24981b;};EmailImap['prototype']['handleReady']=function(){this[_0x492d('0x2')][_0x492d('0x22')](this[_0x492d('0xa')],![],this[_0x492d('0x23')][_0x492d('0x13')](this));};EmailImap[_0x492d('0x16')][_0x492d('0x23')]=function(_0x682b69,_0x11a09b){if(_0x682b69){this[_0x492d('0x12')](_0x682b69,!![]);}else{this[_0x492d('0x24')](_0x492d('0x25'),_0x11a09b);this['readUnseen']();}};EmailImap[_0x492d('0x16')][_0x492d('0x26')]=function(_0x3e78c7){if(_0x3e78c7){this['handleError'](_0x3e78c7,!![]);}else{this['imap']['end']();}};EmailImap[_0x492d('0x16')][_0x492d('0x27')]=function(){this['imap'][_0x492d('0x28')](['UNSEEN'],this[_0x492d('0x29')]['bind'](this));};EmailImap['prototype'][_0x492d('0x29')]=function(_0x43e56e,_0x45a9b3){if(_0x43e56e){this[_0x492d('0x12')](_0x43e56e,!![]);}else{if(_0x45a9b3[_0x492d('0x2a')]){try{var _0xcd6cac=this[_0x492d('0x2')][_0x492d('0x2b')](_0x45a9b3,{'bodies':'','markSeen':!![]});_0xcd6cac['on']('message',this[_0x492d('0x2c')][_0x492d('0x13')](this));_0xcd6cac[_0x492d('0x2d')](_0x492d('0x11'),this[_0x492d('0x2e')][_0x492d('0x13')](this));_0xcd6cac['once'](_0x492d('0xf'),this['handleFetchEnd']['bind'](this));}catch(_0x171e40){logger[_0x492d('0x11')](_0x171e40);}}else{this[_0x492d('0x2')][_0x492d('0x2f')](!![],this[_0x492d('0x26')][_0x492d('0x13')](this));}}};EmailImap[_0x492d('0x16')][_0x492d('0x2c')]=function(_0x388f82){_0x388f82['on'](_0x492d('0x30'),this['handleMessageBody'][_0x492d('0x13')](this));_0x388f82[_0x492d('0x2d')](_0x492d('0x31'),this[_0x492d('0x32')][_0x492d('0x13')](this));_0x388f82[_0x492d('0x2d')](_0x492d('0xf'),this[_0x492d('0x33')][_0x492d('0x13')](this));};EmailImap['prototype'][_0x492d('0x34')]=function(_0x1eeba4){simpleParser(_0x1eeba4,{'Iconv':Iconv},this[_0x492d('0x35')][_0x492d('0x13')](this));};EmailImap[_0x492d('0x16')][_0x492d('0x32')]=function(){};EmailImap['prototype'][_0x492d('0x33')]=function(){};EmailImap[_0x492d('0x16')][_0x492d('0x35')]=function(_0x153f66,_0x2787df){if(_0x153f66){logger[_0x492d('0x11')](_0x153f66);}else{var _0x3d7d9a=this;utils['parser'](this[_0x492d('0xb')],_0x2787df,function(_0x4af635){_0x3d7d9a[_0x492d('0x24')](_0x492d('0x9'),_0x4af635);});}};EmailImap[_0x492d('0x16')][_0x492d('0x36')]=function(){this[_0x492d('0x2')][_0x492d('0x2f')](!![],this[_0x492d('0x26')]['bind'](this));};EmailImap[_0x492d('0x16')][_0x492d('0x2e')]=function(_0x2feb62){this['handleError'](_0x2feb62);this[_0x492d('0x2')][_0x492d('0x2f')](!![],this[_0x492d('0x26')][_0x492d('0x13')](this));};EmailImap[_0x492d('0x16')][_0x492d('0x10')]=function(){this['emit'](_0x492d('0xf'));};EmailImap['prototype'][_0x492d('0x12')]=function(_0x3c8329,_0x49abb1){logger[_0x492d('0x11')](_0x492d('0x12'),this[_0x492d('0xb')][_0x492d('0x9')],JSON[_0x492d('0x37')](_0x3c8329));var _0x2b63fd='';if(_0x3c8329){if(_0x3c8329[_0x492d('0x38')]){_0x2b63fd=_0x3c8329[_0x492d('0x38')];}else{for(var _0x3d2900 in _0x3c8329){if(_0x3c8329[_0x492d('0x39')](_0x3d2900)){_0x2b63fd+=_['upperFirst'](_0x3d2900)+':\x20'+_0x3c8329[_0x3d2900]+'\x0a';}}}}if(_0x49abb1){this['imap']['end']();}else{this['emit']('error',_0x2b63fd);this[_0x492d('0x24')](_0x492d('0xf'));}};module[_0x492d('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9a6418d..b48ef46 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 _0x1d8d=['verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','toString','prototype'];(function(_0x209a41,_0x462913){var _0x5e605e=function(_0x2edfc9){while(--_0x2edfc9){_0x209a41['push'](_0x209a41['shift']());}};_0x5e605e(++_0x462913);}(_0x1d8d,0xfc));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var nodemailer=require(_0xd1d8('0x0'));var inlineBase64=require(_0xd1d8('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xd1d8('0x2')]=function(_0x561786,_0x59dc83){return new Promise(function(_0xb2bc18,_0x308ecf){var _0xdc41f=nodemailer[_0xd1d8('0x3')](_0x561786);_0xdc41f[_0xd1d8('0x4')](_0xd1d8('0x5'),inlineBase64());_0xdc41f['sendMail'](_0x59dc83,function(_0xc78bbc,_0xe7df06){if(_0xc78bbc){_0x308ecf(_0xc78bbc[_0xd1d8('0x6')]());}else{_0xb2bc18(_0xe7df06);}});});};EmailSmtp[_0xd1d8('0x7')][_0xd1d8('0x8')]=function(_0x2bf1d6){return new Promise(function(_0x30820d,_0xbea848){var _0xc12b7c=nodemailer[_0xd1d8('0x3')](_0x2bf1d6);_0xc12b7c[_0xd1d8('0x8')](function(_0x33176d,_0x34795){if(_0x33176d){_0xbea848(_0x33176d['toString']());}else{if(_0x34795){_0x30820d(_0x34795);}else{_0xbea848(_0xd1d8('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x900d=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','sendMail','verify','toString'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_0x900d,0x91));var _0xd900=function(_0x5ae3a7,_0x5e6e6d){_0x5ae3a7=_0x5ae3a7-0x0;var _0x4b0054=_0x900d[_0x5ae3a7];return _0x4b0054;};'use strict';var nodemailer=require(_0xd900('0x0'));var inlineBase64=require(_0xd900('0x1'));function EmailSmtp(){}EmailSmtp[_0xd900('0x2')]['send']=function(_0xc60af8,_0x19aaab){return new Promise(function(_0x4e8262,_0x31a948){var _0x224a6e=nodemailer[_0xd900('0x3')](_0xc60af8);_0x224a6e[_0xd900('0x4')](_0xd900('0x5'),inlineBase64());_0x224a6e[_0xd900('0x6')](_0x19aaab,function(_0x503ad9,_0x430443){if(_0x503ad9){_0x31a948(_0x503ad9['toString']());}else{_0x4e8262(_0x430443);}});});};EmailSmtp[_0xd900('0x2')]['verify']=function(_0x426d56){return new Promise(function(_0x3d1299,_0x118d7c){var _0xfcfc3=nodemailer[_0xd900('0x3')](_0x426d56);_0xfcfc3[_0xd900('0x7')](function(_0x58e63b,_0x426150){if(_0x58e63b){_0x118d7c(_0x58e63b[_0xd900('0x8')]());}else{if(_0x426150){_0x3d1299(_0x426150);}else{_0x118d7c(_0xd900('0x9'));}}});});};module[_0xd900('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 81fce7b..2d72e75 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 _0x4016=['Attachments','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','util','node-tnef','../../../config/logger','email','value','address','generate','name','substring','indexOf','length','slice','join','Anonymous','head','split','pop','isEmpty','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x4016,0xeb));var _0x6401=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4016[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x6401('0x0'));var moment=require('moment');var random=require(_0x6401('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x6401('0x2'));var tnef=require(_0x6401('0x3'));var logger=require(_0x6401('0x4'))(_0x6401('0x5'));var config=require('../../../config/environment');function getAddress(_0x217e13){var _0x315be4=_['head'](_0x217e13[_0x6401('0x6')]);return _0x315be4&&_0x315be4[_0x6401('0x7')]?_0x315be4[_0x6401('0x7')]:'anonymous'+random[_0x6401('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x163955){var _0x135494=_['head'](_0x163955['value']);if(_0x135494&&_0x135494['name']){if(_0x135494[_0x6401('0x9')]==_0x135494[_0x6401('0x7')]){return _0x135494['name'][_0x6401('0xa')](0x0,_0x135494[_0x6401('0x9')][_0x6401('0xb')]('@'));}var _0x122ab6=_0x135494[_0x6401('0x9')]['split'](/\s+/);return _0x122ab6[_0x6401('0xc')]>0x1?_0x122ab6[_0x6401('0xd')](0x0,-0x1)[_0x6401('0xe')]('\x20'):_0x135494[_0x6401('0x9')];}return _0x6401('0xf');}function getLastName(_0x379417){var _0x388b44=_[_0x6401('0x10')](_0x379417['value']);if(_0x388b44&&_0x388b44['name']){var _0x40b3a2=_0x388b44[_0x6401('0x9')][_0x6401('0x11')](/\s+/);return _0x40b3a2['length']>0x1?_0x40b3a2[_0x6401('0x12')]():'';}return'';}function getMails(_0x18b233,_0x1a03ad){var _0x3832b0='';for(var _0x20bcc8=0x0;_0x20bcc8<_0x1a03ad[_0x6401('0x6')][_0x6401('0xc')];_0x20bcc8+=0x1){if(_0x1a03ad[_0x6401('0x6')][_0x20bcc8][_0x6401('0x7')]!==_0x18b233){if(!_[_0x6401('0x13')](_0x3832b0)){_0x3832b0+=',';}_0x3832b0+=_0x1a03ad[_0x6401('0x6')][_0x20bcc8]['name']||_0x1a03ad[_0x6401('0x6')][_0x20bcc8][_0x6401('0x7')]||'';_0x3832b0+='\x20<';_0x3832b0+=_0x1a03ad[_0x6401('0x6')][_0x20bcc8][_0x6401('0x7')]?_0x1a03ad['value'][_0x20bcc8][_0x6401('0x7')]:'anonymous'+random[_0x6401('0x8')](0x6)+_0x6401('0x14');_0x3832b0+='>';}}return _0x3832b0;}function parseEmail(_0x380843,_0x4e11a8,_0x5e0586){if(_0x4e11a8[_0x6401('0x15')]){var _0x375f68=/)<[^<]*)*<\/script>/gi;while(_0x375f68[_0x6401('0x16')](_0x4e11a8[_0x6401('0x15')])){_0x4e11a8[_0x6401('0x15')]=_0x4e11a8[_0x6401('0x15')][_0x6401('0x17')](_0x375f68,'');}if(_0x4e11a8[_0x6401('0x15')][_0x6401('0x18')](_0x6401('0x19'))){var _0x38acc3=[];_0x4e11a8[_0x6401('0x1a')][_0x6401('0x1b')](_0x460bdf=>{_0x38acc3['push'](_0x460bdf[_0x6401('0x1c')]);});var _0x8da027=/]+>/g;var _0x5a8049=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x21e34d=_0x4e11a8[_0x6401('0x15')][_0x6401('0x17')](_0x5a8049,_0x6401('0x1d'));var _0x7f7ba9=_0x21e34d[_0x6401('0x17')](_0x8da027,'_IMG');for(let _0x382be9=0x0;_0x382be9<_0x38acc3[_0x6401('0xc')];_0x382be9++){var _0x447307=_0x7f7ba9['replace'](_0x6401('0x1e'),_0x6401('0x1f')+_0x38acc3[_0x382be9]+_0x6401('0x20'));_0x7f7ba9=_0x447307;}_0x4e11a8[_0x6401('0x15')]=_0x7f7ba9;}_0x5e0586['body']=_0x4e11a8['html'];}else{_0x5e0586[_0x6401('0x21')]=_0x4e11a8[_0x6401('0x22')];}if(_0x5e0586[_0x6401('0x21')]){_0x5e0586[_0x6401('0x21')]=_0x5e0586[_0x6401('0x21')]['replace'](/0x0){var _0x38740b=[_0x6401('0x32'),'X-Auto-Response-Suppress:\x20All',_0x6401('0x33')];for(var _0x349d3b=0x0;_0x349d3b<_0x4e11a8[_0x6401('0x31')][_0x6401('0xc')];_0x349d3b++){var _0x5855ae=_[_0x6401('0xb')](_0x38740b,_0x4e11a8[_0x6401('0x31')][_0x349d3b][_0x6401('0x34')]);if(_0x5855ae>=0x0){_0x5e0586[_0x6401('0x35')]=!![];}}}return _0x5e0586;}exports[_0x6401('0x36')]=function(_0x3d1457,_0x52f9a4,_0x54140a){var _0x3390e3={'from':getAddress(_0x52f9a4['from']),'firstName':getFirstName(_0x52f9a4[_0x6401('0x37')]),'lastName':getLastName(_0x52f9a4[_0x6401('0x37')]),'mapKey':_0x6401('0x5'),'message':{'from':getMails(_0x3d1457[_0x6401('0x5')],_0x52f9a4[_0x6401('0x37')]),'to':_0x3d1457[_0x6401('0x5')],'cc':'','subject':_0x52f9a4[_0x6401('0x38')]||'','messageId':_0x52f9a4[_0x6401('0x39')],'inReplyTo':_0x52f9a4[_0x6401('0x3a')],'sentAt':moment(_0x52f9a4[_0x6401('0x3b')])[_0x6401('0x2b')](_0x6401('0x3c')),'attach':![],'attachments':[]}};if(!_0x52f9a4[_0x6401('0x15')]&&!_0x52f9a4[_0x6401('0x22')]){var _0x3440c5=_[_0x6401('0x3d')](_0x52f9a4[_0x6401('0x1a')],{'contentType':_0x6401('0x3e')});if(_0x3440c5[_0x6401('0xc')]){logger[_0x6401('0x3f')](util[_0x6401('0x2b')](_0x6401('0x40'),_0x52f9a4[_0x6401('0x39')]));tnef[_0x6401('0x41')](_[_0x6401('0x42')](_0x3440c5)['content'],function(_0x544548,_0x338bea){if(_0x338bea){_0x52f9a4['html']=_0x338bea[_0x6401('0x43')]||_0x6401('0x44');if(_0x338bea[_0x6401('0x45')]){for(var _0x5d47bf=0x0;_0x5d47bf<_0x338bea['Attachments'][_0x6401('0xc')];_0x5d47bf++){var _0x2b51f9=_0x338bea[_0x6401('0x45')][_0x5d47bf];_0x3390e3['message'][_0x6401('0x1a')][_0x6401('0x2f')]({'filename':_0x2b51f9['Title'],'content':Buffer[_0x6401('0x37')](_0x2b51f9[_0x6401('0x46')])});}}}_0x54140a(parseEmail(_0x3d1457,_0x52f9a4,_0x3390e3));});}else{_0x52f9a4[_0x6401('0x15')]='

Empty\x20message

';_0x54140a(parseEmail(_0x3d1457,_0x52f9a4,_0x3390e3));}}else{_0x54140a(parseEmail(_0x3d1457,_0x52f9a4,_0x3390e3));}};exports[_0x6401('0x47')]=function(_0x410cd9,_0x3dbc04){var _0x44ebb3=['user='+(_0x3dbc04||''),_0x6401('0x48')+_0x410cd9,'',''];return Buffer[_0x6401('0x37')](_0x44ebb3[_0x6401('0xe')](''),_0x6401('0x49'))[_0x6401('0x4a')](_0x6401('0x4b'));}; \ No newline at end of file +var _0xbb1c=['info','messageId','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','test','html','includes','0x1?_0x4b0b66[_0xcbb1('0x12')](0x0,-0x1)[_0xcbb1('0x13')]('\x20'):_0x9526fa[_0xcbb1('0xd')];}return _0xcbb1('0x14');}function getLastName(_0x4c9aa4){var _0x575d5f=_[_0xcbb1('0x9')](_0x4c9aa4[_0xcbb1('0xa')]);if(_0x575d5f&&_0x575d5f[_0xcbb1('0xd')]){var _0xb05fc=_0x575d5f['name']['split'](/\s+/);return _0xb05fc['length']>0x1?_0xb05fc[_0xcbb1('0x15')]():'';}return'';}function getMails(_0x16752b,_0x30e6d7){var _0x2e463b='';for(var _0x47ed6d=0x0;_0x47ed6d<_0x30e6d7[_0xcbb1('0xa')]['length'];_0x47ed6d+=0x1){if(_0x30e6d7[_0xcbb1('0xa')][_0x47ed6d]['address']!==_0x16752b){if(!_[_0xcbb1('0x16')](_0x2e463b)){_0x2e463b+=',';}_0x2e463b+=_0x30e6d7[_0xcbb1('0xa')][_0x47ed6d]['name']||_0x30e6d7[_0xcbb1('0xa')][_0x47ed6d][_0xcbb1('0xb')]||'';_0x2e463b+='\x20<';_0x2e463b+=_0x30e6d7[_0xcbb1('0xa')][_0x47ed6d][_0xcbb1('0xb')]?_0x30e6d7[_0xcbb1('0xa')][_0x47ed6d][_0xcbb1('0xb')]:_0xcbb1('0xc')+random['generate'](0x6)+_0xcbb1('0x17');_0x2e463b+='>';}}return _0x2e463b;}function parseEmail(_0x18ab62,_0x4e9bef,_0x552edf){if(_0x4e9bef['html']){var _0x110bf6=/)<[^<]*)*<\/script>/gi;while(_0x110bf6[_0xcbb1('0x18')](_0x4e9bef[_0xcbb1('0x19')])){_0x4e9bef[_0xcbb1('0x19')]=_0x4e9bef[_0xcbb1('0x19')]['replace'](_0x110bf6,'');}if(_0x4e9bef[_0xcbb1('0x19')][_0xcbb1('0x1a')](_0xcbb1('0x1b'))){var _0x264386=[];_0x4e9bef['attachments'][_0xcbb1('0x1c')](_0x10e88b=>{_0x264386[_0xcbb1('0x1d')](_0x10e88b['filename']);});var _0x2e7fd9=/]+>/g;var _0x26e7b8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4aa357=_0x4e9bef['html'][_0xcbb1('0x1e')](_0x26e7b8,_0xcbb1('0x1f'));var _0x226238=_0x4aa357['replace'](_0x2e7fd9,_0xcbb1('0x20'));for(let _0x409a7b=0x0;_0x409a7b<_0x264386['length'];_0x409a7b++){var _0x3834aa=_0x226238[_0xcbb1('0x1e')](_0xcbb1('0x20'),'\x20[Attachment:\x20'+_0x264386[_0x409a7b]+'\x20]');_0x226238=_0x3834aa;}_0x4e9bef[_0xcbb1('0x19')]=_0x226238;}_0x552edf[_0xcbb1('0x21')]=_0x4e9bef[_0xcbb1('0x19')];}else{_0x552edf['body']=_0x4e9bef[_0xcbb1('0x22')];}if(_0x552edf['body']){_0x552edf[_0xcbb1('0x21')]=_0x552edf[_0xcbb1('0x21')]['replace'](/0x0){var _0x4bdc1e=[_0xcbb1('0x34'),_0xcbb1('0x35'),'Precedence:\x20auto_reply'];for(var _0x2885a8=0x0;_0x2885a8<_0x4e9bef[_0xcbb1('0x33')][_0xcbb1('0x11')];_0x2885a8++){var _0x41f946=_[_0xcbb1('0xf')](_0x4bdc1e,_0x4e9bef[_0xcbb1('0x33')][_0x2885a8][_0xcbb1('0x36')]);if(_0x41f946>=0x0){_0x552edf[_0xcbb1('0x37')]=!![];}}}return _0x552edf;}exports[_0xcbb1('0x38')]=function(_0x461e98,_0x37918a,_0x4b7015){var _0x34da3a={'from':getAddress(_0x37918a[_0xcbb1('0x39')]),'firstName':getFirstName(_0x37918a[_0xcbb1('0x39')]),'lastName':getLastName(_0x37918a['from']),'mapKey':_0xcbb1('0x7'),'message':{'from':getMails(_0x461e98[_0xcbb1('0x7')],_0x37918a[_0xcbb1('0x39')]),'to':_0x461e98[_0xcbb1('0x7')],'cc':'','subject':_0x37918a['subject']||'','messageId':_0x37918a['messageId'],'inReplyTo':_0x37918a[_0xcbb1('0x3a')],'sentAt':moment(_0x37918a['date'])[_0xcbb1('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x37918a['html']&&!_0x37918a[_0xcbb1('0x22')]){var _0x2c084=_[_0xcbb1('0x3b')](_0x37918a[_0xcbb1('0x28')],{'contentType':_0xcbb1('0x3c')});if(_0x2c084[_0xcbb1('0x11')]){logger[_0xcbb1('0x3d')](util[_0xcbb1('0x2e')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x37918a[_0xcbb1('0x3e')]));tnef['parseBuffer'](_['first'](_0x2c084)['content'],function(_0x443313,_0x4e0f16){if(_0x4e0f16){_0x37918a[_0xcbb1('0x19')]=_0x4e0f16[_0xcbb1('0x3f')]||_0xcbb1('0x40');if(_0x4e0f16['Attachments']){for(var _0x43dc55=0x0;_0x43dc55<_0x4e0f16['Attachments'][_0xcbb1('0x11')];_0x43dc55++){var _0x23c5aa=_0x4e0f16[_0xcbb1('0x41')][_0x43dc55];_0x34da3a[_0xcbb1('0x24')][_0xcbb1('0x28')][_0xcbb1('0x1d')]({'filename':_0x23c5aa['Title'],'content':Buffer['from'](_0x23c5aa[_0xcbb1('0x42')])});}}}_0x4b7015(parseEmail(_0x461e98,_0x37918a,_0x34da3a));});}else{_0x37918a[_0xcbb1('0x19')]=_0xcbb1('0x40');_0x4b7015(parseEmail(_0x461e98,_0x37918a,_0x34da3a));}}else{_0x4b7015(parseEmail(_0x461e98,_0x37918a,_0x34da3a));}};exports[_0xcbb1('0x43')]=function(_0x224685,_0x1c22a8){var _0x8d44ff=[_0xcbb1('0x44')+(_0x1c22a8||''),_0xcbb1('0x45')+_0x224685,'',''];return Buffer['from'](_0x8d44ff[_0xcbb1('0x13')](''),'utf-8')[_0xcbb1('0x46')](_0xcbb1('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b16f26e..63f41e9 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 _0xbb7e=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbb7e,0x143));var _0xebb7=function(_0x5a7b57,_0x58ed7e){_0x5a7b57=_0x5a7b57-0x0;var _0x5ac7ab=_0xbb7e[_0x5a7b57];return _0x5ac7ab;};'use strict';var _=require(_0xebb7('0x0'));function MailAccount(_0x552e3b){this['id']=_0x552e3b['id']||0x0;this[_0xebb7('0x1')]=_0x552e3b[_0xebb7('0x1')]||_0xebb7('0x2');this['key']=_0x552e3b[_0xebb7('0x3')]||_0xebb7('0x4');this[_0xebb7('0x5')]=_0x552e3b[_0xebb7('0x5')]||![];this['Imap']=_0x552e3b[_0xebb7('0x6')]||[];this[_0xebb7('0x7')]=_0x552e3b[_0xebb7('0x7')]||[];}module[_0xebb7('0x8')]=MailAccount; \ No newline at end of file +var _0x10c2=['Service','key','SERV','active','Imap','Smtp','lodash','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c2,0xd6));var _0x210c=function(_0x3e775c,_0x588835){_0x3e775c=_0x3e775c-0x0;var _0x374fde=_0x10c2[_0x3e775c];return _0x374fde;};'use strict';var _=require(_0x210c('0x0'));function MailAccount(_0x738326){this['id']=_0x738326['id']||0x0;this[_0x210c('0x1')]=_0x738326[_0x210c('0x1')]||_0x210c('0x2');this[_0x210c('0x3')]=_0x738326['key']||_0x210c('0x4');this[_0x210c('0x5')]=_0x738326[_0x210c('0x5')]||![];this[_0x210c('0x6')]=_0x738326['Imap']||[];this[_0x210c('0x7')]=_0x738326[_0x210c('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 485ccc1..95069d4 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 _0x0380=['mergeFromDatabase','initMailAccounts','length','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x32c4d0,_0x3d3d02){var _0x3730dd=function(_0x31182a){while(--_0x31182a){_0x32c4d0['push'](_0x32c4d0['shift']());}};_0x3730dd(++_0x3d3d02);}(_0x0380,0x1ef));var _0x0038=function(_0x3de415,_0x5e68eb){_0x3de415=_0x3de415-0x0;var _0x3957dd=_0x0380[_0x3de415];return _0x3957dd;};'use strict';var _=require(_0x0038('0x0'));var MailAccount=require(_0x0038('0x1'));var Realtime=function(){this[_0x0038('0x2')]={};};function freeIsNotKey(_0x1856f9,_0x47fa43,_0x30113b){var _0x3965b0=_[_0x0038('0x3')](_0x1856f9,function(_0x5b451c,_0x517d62){return _0x5b451c[_0x30113b];});for(var _0x7b8f3f in _0x47fa43){if(_0x47fa43['hasOwnProperty'](_0x7b8f3f)){if(!_0x3965b0[_0x7b8f3f]){delete _0x47fa43[_0x7b8f3f];}}}}Realtime[_0x0038('0x4')][_0x0038('0x5')]=function(_0x523ca8,_0x407f31){for(var _0x214d35 in _0x407f31){if(_0x523ca8['hasOwnProperty'](_0x214d35)){_0x523ca8[_0x214d35]=_0x407f31[_0x214d35];}}};Realtime[_0x0038('0x4')][_0x0038('0x6')]=function(){var _0x210b9b=this;return function(_0x23d5e2){if(_0x23d5e2){freeIsNotKey(_0x23d5e2,_0x210b9b['mailAccounts'],'id');for(var _0x1f57f0=0x0,_0x554e20={},_0xdb08f3={};_0x1f57f0<_0x23d5e2[_0x0038('0x7')];_0x1f57f0+=0x1){_0x554e20=_0x23d5e2[_0x1f57f0];if(_['isUndefined'](_0x210b9b[_0x0038('0x2')][_0x554e20['id']])){_0x210b9b[_0x0038('0x2')][_0x554e20['id']]=new MailAccount(_0x554e20);}else{_[_0x0038('0x8')](_0x210b9b[_0x0038('0x2')][_0x554e20['id']],_0x554e20);}}}return _0x210b9b[_0x0038('0x2')];};};module[_0x0038('0x9')]=Realtime; \ No newline at end of file +var _0x64f2=['prototype','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x299478,_0x1a7ce0){var _0x61de3d=function(_0x416169){while(--_0x416169){_0x299478['push'](_0x299478['shift']());}};_0x61de3d(++_0x1a7ce0);}(_0x64f2,0xaf));var _0x264f=function(_0x174565,_0x7fdcc9){_0x174565=_0x174565-0x0;var _0x351905=_0x64f2[_0x174565];return _0x351905;};'use strict';var _=require(_0x264f('0x0'));var MailAccount=require(_0x264f('0x1'));var Realtime=function(){this[_0x264f('0x2')]={};};function freeIsNotKey(_0x37486d,_0x3cd519,_0x132b18){var _0x8a63e1=_[_0x264f('0x3')](_0x37486d,function(_0x45a3b7,_0xe26a10){return _0x45a3b7[_0x132b18];});for(var _0x5de8c3 in _0x3cd519){if(_0x3cd519[_0x264f('0x4')](_0x5de8c3)){if(!_0x8a63e1[_0x5de8c3]){delete _0x3cd519[_0x5de8c3];}}}}Realtime[_0x264f('0x5')]['mergeFromDatabase']=function(_0x444b76,_0x3489b7){for(var _0x595ebf in _0x3489b7){if(_0x444b76[_0x264f('0x4')](_0x595ebf)){_0x444b76[_0x595ebf]=_0x3489b7[_0x595ebf];}}};Realtime['prototype'][_0x264f('0x6')]=function(){var _0x2b3aae=this;return function(_0x34cdcf){if(_0x34cdcf){freeIsNotKey(_0x34cdcf,_0x2b3aae['mailAccounts'],'id');for(var _0x45f39e=0x0,_0x69e472={},_0x5a1b13={};_0x45f39e<_0x34cdcf[_0x264f('0x7')];_0x45f39e+=0x1){_0x69e472=_0x34cdcf[_0x45f39e];if(_[_0x264f('0x8')](_0x2b3aae['mailAccounts'][_0x69e472['id']])){_0x2b3aae[_0x264f('0x2')][_0x69e472['id']]=new MailAccount(_0x69e472);}else{_[_0x264f('0x9')](_0x2b3aae['mailAccounts'][_0x69e472['id']],_0x69e472);}}}return _0x2b3aae['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e66e531..a493961 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 _0x27a0=['Request','GetMailAccount','name','provider','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts'];(function(_0x34537a,_0x4984ac){var _0x2ac5f8=function(_0x2a12de){while(--_0x2a12de){_0x34537a['push'](_0x34537a['shift']());}};_0x2ac5f8(++_0x4984ac);}(_0x27a0,0xbf));var _0x027a=function(_0x2ba1e4,_0x3548bc){_0x2ba1e4=_0x2ba1e4-0x0;var _0x164f28=_0x27a0[_0x2ba1e4];return _0x164f28;};'use strict';var client=require('../client');exports[_0x027a('0x0')]=function(){return function(){return client[_0x027a('0x1')](_0x027a('0x2'),{'options':{'attributes':['id',_0x027a('0x3'),_0x027a('0x4'),'service','email','active','key',_0x027a('0x5'),_0x027a('0x6')],'raw':![],'include':[{'model':_0x027a('0x7'),'as':_0x027a('0x8'),'include':[{'model':_0x027a('0x9'),'attributes':['id',_0x027a('0x3'),'service',_0x027a('0xa'),_0x027a('0xb')],'as':_0x027a('0x9')}]},{'model':'MailServerOut','as':_0x027a('0xc'),'include':[{'model':_0x027a('0x9'),'attributes':['id',_0x027a('0x3'),'service',_0x027a('0xa'),_0x027a('0xb')],'as':_0x027a('0x9')}]}]},'log':_0x027a('0xd')});};};exports[_0x027a('0xe')]=function(_0x267afc,_0x2698d1){return client[_0x027a('0x1')](_0x027a('0xf'),{'account':{'id':_0x267afc},'body':_0x2698d1,'log':_0x027a('0xf')});}; \ No newline at end of file +var _0x3c04=['notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId','Imap','type','CloudProvider','MailServerOut','Smtp','getMailAccount'];(function(_0x2c449a,_0x2e8fb3){var _0x11fcea=function(_0x27013c){while(--_0x27013c){_0x2c449a['push'](_0x2c449a['shift']());}};_0x11fcea(++_0x2e8fb3);}(_0x3c04,0x192));var _0x43c0=function(_0x16dd4e,_0xf60fbe){_0x16dd4e=_0x16dd4e-0x0;var _0x274859=_0x3c04[_0x16dd4e];return _0x274859;};'use strict';var client=require('../client');exports[_0x43c0('0x0')]=function(){return function(){return client['Request'](_0x43c0('0x1'),{'options':{'attributes':['id',_0x43c0('0x2'),_0x43c0('0x3'),_0x43c0('0x4'),_0x43c0('0x5'),_0x43c0('0x6'),_0x43c0('0x7'),_0x43c0('0x8'),_0x43c0('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x43c0('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x43c0('0x2'),'service',_0x43c0('0xb'),'data5'],'as':_0x43c0('0xc')}]},{'model':_0x43c0('0xd'),'as':_0x43c0('0xe'),'include':[{'model':_0x43c0('0xc'),'attributes':['id','name','service',_0x43c0('0xb'),'data5'],'as':_0x43c0('0xc')}]}]},'log':_0x43c0('0xf')});};};exports[_0x43c0('0x10')]=function(_0x5baa9d,_0x3d667c){return client[_0x43c0('0x11')](_0x43c0('0x12'),{'account':{'id':_0x5baa9d},'body':_0x3d667c,'log':_0x43c0('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 8107e3f..69c451b 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 _0xdef0=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0xdef0,0x169));var _0x0def=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdef0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0def('0x0'));exports['getSettings']=function(){return client[_0x0def('0x1')](_0x0def('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0def('0x3')]},'log':_0x0def('0x4')});}; \ No newline at end of file +var _0xa75d=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x5b6e72,_0x5b8cca){var _0x221284=function(_0x5dba6c){while(--_0x5dba6c){_0x5b6e72['push'](_0x5b6e72['shift']());}};_0x221284(++_0x5b8cca);}(_0xa75d,0x7e));var _0xda75=function(_0x11d813,_0x326b02){_0x11d813=_0x11d813-0x0;var _0x36226d=_0xa75d[_0x11d813];return _0x36226d;};'use strict';var client=require(_0xda75('0x0'));exports[_0xda75('0x1')]=function(){return client[_0xda75('0x2')](_0xda75('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xda75('0x4')]},'log':_0xda75('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 132f292..425ce84 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(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 80a5d2f..5437c3a 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 _0x52f2=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','default','../../config/express','../../routes','once','listening','log'];(function(_0x495b00,_0x14ea09){var _0x3dae04=function(_0x4684f7){while(--_0x4684f7){_0x495b00['push'](_0x495b00['shift']());}};_0x3dae04(++_0x14ea09);}(_0x52f2,0x144));var _0x252f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x52f2[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x252f('0x0'));var http=require(_0x252f('0x1'));var express=require('express');var sticky=require(_0x252f('0x2'));var Redis=require(_0x252f('0x3'));var config=require(_0x252f('0x4'));var app=express();var server=http[_0x252f('0x5')](app);server[_0x252f('0x6')]=0xdbba0;if(sticky[_0x252f('0x7')](server,config[_0x252f('0x8')])){var socketio=require(_0x252f('0x9'))(server,{'transports':[_0x252f('0xa'),_0x252f('0xb')]});config[_0x252f('0xc')]=_[_0x252f('0xd')](config[_0x252f('0xc')],{'host':_0x252f('0xe'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x252f('0xc')]),'subClient':new Redis(config[_0x252f('0xc')])}));require('../../config/triggers')[_0x252f('0xf')]();require('../../config/socketio')[_0x252f('0xf')](socketio);require(_0x252f('0x10'))['default'](app);require(_0x252f('0x11'))[_0x252f('0xf')](app);}else{server[_0x252f('0x12')](_0x252f('0x13'),function(){console[_0x252f('0x14')](_0x252f('0x15'),config[_0x252f('0x8')]);});}exports=module[_0x252f('0x16')]=app; \ No newline at end of file +var _0x408a=['express','sticky-session','../../config/environment','timeout','port','socket.io','websocket','polling','localhost','adapter','socket.io-redis','redis','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x2dc950,_0xf030d2){var _0x4aeb12=function(_0x528d90){while(--_0x528d90){_0x2dc950['push'](_0x2dc950['shift']());}};_0x4aeb12(++_0xf030d2);}(_0x408a,0x18f));var _0xa408=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x408a[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xa408('0x0'));var sticky=require(_0xa408('0x1'));var Redis=require('ioredis');var config=require(_0xa408('0x2'));var app=express();var server=http['createServer'](app);server[_0xa408('0x3')]=0xdbba0;if(sticky['listen'](server,config[_0xa408('0x4')])){var socketio=require(_0xa408('0x5'))(server,{'transports':[_0xa408('0x6'),_0xa408('0x7')]});config['redis']=_['defaults'](config['redis'],{'host':_0xa408('0x8'),'port':0x18eb});socketio[_0xa408('0x9')](require(_0xa408('0xa'))({'pubClient':new Redis(config[_0xa408('0xb')]),'subClient':new Redis(config[_0xa408('0xb')])}));require('../../config/triggers')[_0xa408('0xc')]();require(_0xa408('0xd'))[_0xa408('0xc')](socketio);require(_0xa408('0xe'))[_0xa408('0xc')](app);require('../../routes')[_0xa408('0xc')](app);}else{server[_0xa408('0xf')](_0xa408('0x10'),function(){console[_0xa408('0x11')](_0xa408('0x12'),config[_0xa408('0x4')]);});}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 8c5044b..4893f71 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 _0x6893=['client','http','Request','request','then','debug','rpc','error','message','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x208355,_0x4b8434){var _0xc38a3f=function(_0x1bb075){while(--_0x1bb075){_0x208355['push'](_0x208355['shift']());}};_0xc38a3f(++_0x4b8434);}(_0x6893,0x122));var _0x3689=function(_0x241f06,_0x3c7ef8){_0x241f06=_0x241f06-0x0;var _0x2ec3a1=_0x6893[_0x241f06];return _0x2ec3a1;};'use strict';var jayson=require(_0x3689('0x0'));var BPromise=require(_0x3689('0x1'));var logger=require(_0x3689('0x2'))(_0x3689('0x3'));var client=jayson[_0x3689('0x4')][_0x3689('0x5')]({'port':0x2329});client[_0x3689('0x6')]=function(_0x1a5d5b,_0x2e77fe){return new BPromise(function(_0x42495e,_0x3a8d8b){return client[_0x3689('0x7')](_0x1a5d5b,_0x2e77fe)[_0x3689('0x8')](function(_0x59ac96){logger[_0x3689('0x9')](_0x3689('0xa'),_0x3689('0x3'),_0x1a5d5b,_0x2e77fe,_0x59ac96);if(_0x59ac96[_0x3689('0xb')]){logger['error'](_0x3689('0xa'),_0x3689('0x3'),_0x1a5d5b,_0x59ac96['error'][_0x3689('0xc')],_0x2e77fe);return _0x3a8d8b(_0x59ac96[_0x3689('0xb')][_0x3689('0xc')]);}else{return _0x42495e(_0x59ac96['result']);}})['catch'](function(_0x5ad771){logger[_0x3689('0xb')]('rpc',_0x3689('0x3'),_0x1a5d5b,_0x5ad771,_0x2e77fe);return _0x3a8d8b(_0x5ad771);});});};module[_0x3689('0xd')]=client; \ No newline at end of file +var _0x81b8=['jayson/promise','routing','client','http','request','then','debug','rpc','error','message','result'];(function(_0x138468,_0x7f8bfc){var _0x1e0a31=function(_0x418b3e){while(--_0x418b3e){_0x138468['push'](_0x138468['shift']());}};_0x1e0a31(++_0x7f8bfc);}(_0x81b8,0x79));var _0x881b=function(_0x405e1a,_0x59ec1d){_0x405e1a=_0x405e1a-0x0;var _0x56e7d5=_0x81b8[_0x405e1a];return _0x56e7d5;};'use strict';var jayson=require(_0x881b('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x881b('0x1'));var client=jayson[_0x881b('0x2')][_0x881b('0x3')]({'port':0x2329});client['Request']=function(_0x59eb3a,_0x216359){return new BPromise(function(_0x353eb1,_0x15093c){return client[_0x881b('0x4')](_0x59eb3a,_0x216359)[_0x881b('0x5')](function(_0x3b9b66){logger[_0x881b('0x6')](_0x881b('0x7'),_0x881b('0x1'),_0x59eb3a,_0x216359,_0x3b9b66);if(_0x3b9b66['error']){logger['error']('rpc',_0x881b('0x1'),_0x59eb3a,_0x3b9b66[_0x881b('0x8')][_0x881b('0x9')],_0x216359);return _0x15093c(_0x3b9b66[_0x881b('0x8')][_0x881b('0x9')]);}else{return _0x353eb1(_0x3b9b66[_0x881b('0xa')]);}})['catch'](function(_0x568e17){logger[_0x881b('0x8')](_0x881b('0x7'),_0x881b('0x1'),_0x59eb3a,_0x568e17,_0x216359);return _0x15093c(_0x568e17);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 48f2f64..d123f74 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 _0x861b=['initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x3fb92b,_0x1648d8){var _0x512f37=function(_0x1eae75){while(--_0x1eae75){_0x3fb92b['push'](_0x3fb92b['shift']());}};_0x512f37(++_0x1648d8);}(_0x861b,0x1d5));var _0xb861=function(_0x1aab9d,_0x503b9e){_0x1aab9d=_0x1aab9d-0x0;var _0x3840b2=_0x861b[_0x1aab9d];return _0x3840b2;};'use strict';var BPromise=require(_0xb861('0x0'));var server=require(_0xb861('0x1'));var Realtime=require(_0xb861('0x2'));var user=require(_0xb861('0x3'));var interval=require(_0xb861('0x4'));var openchannelQueue=require(_0xb861('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb861('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xb861('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xb861('0x8')]()[_0xb861('0x9')](user[_0xb861('0xa')]())[_0xb861('0x9')](realtime[_0xb861('0xb')]())[_0xb861('0x9')](interval[_0xb861('0xc')]())[_0xb861('0x9')](realtime[_0xb861('0xd')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xb861('0x9')](realtime[_0xb861('0xe')]())[_0xb861('0x9')](chatQueue[_0xb861('0xf')]())[_0xb861('0x9')](realtime['initChatQueues']())['then'](smsQueue[_0xb861('0x10')]())['then'](realtime[_0xb861('0x11')]())['then'](mailQueue[_0xb861('0x12')]())[_0xb861('0x9')](realtime[_0xb861('0x13')]())[_0xb861('0x9')](faxQueue['getFaxQueues']())[_0xb861('0x9')](realtime['initFaxQueues']())[_0xb861('0x9')](whatsappQueue[_0xb861('0x14')]())[_0xb861('0x9')](realtime[_0xb861('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xb861('0x16')](realtime)[_0xb861('0x9')](function(_0x190712){return initRealtime();})['then'](function(_0x3c9651){return setInterval(initRealtime,0x1388);})[_0xb861('0x17')](function(_0x17734b){console['log'](_0x17734b);});}main(); \ No newline at end of file +var _0xccfb=['catch','log','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','initIntervals','initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0xccfb,0x162));var _0xbccf=function(_0x5a86d4,_0x2edc6f){_0x5a86d4=_0x5a86d4-0x0;var _0x1251c0=_0xccfb[_0x5a86d4];return _0x1251c0;};'use strict';var BPromise=require('bluebird');var server=require(_0xbccf('0x0'));var Realtime=require('./realtime');var user=require(_0xbccf('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xbccf('0x2'));var chatQueue=require(_0xbccf('0x3'));var smsQueue=require(_0xbccf('0x4'));var mailQueue=require(_0xbccf('0x5'));var faxQueue=require(_0xbccf('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xbccf('0x7')]()[_0xbccf('0x8')](user[_0xbccf('0x9')]())[_0xbccf('0x8')](realtime[_0xbccf('0xa')]())[_0xbccf('0x8')](interval['getIntervals']())[_0xbccf('0x8')](realtime[_0xbccf('0xb')]())[_0xbccf('0x8')](openchannelQueue['getOpenchannelQueues']())[_0xbccf('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())['then'](realtime[_0xbccf('0xc')]())[_0xbccf('0x8')](smsQueue[_0xbccf('0xd')]())['then'](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0xbccf('0x8')](realtime[_0xbccf('0xe')]())[_0xbccf('0x8')](faxQueue[_0xbccf('0xf')]())['then'](realtime[_0xbccf('0x10')]())['then'](whatsappQueue[_0xbccf('0x11')]())[_0xbccf('0x8')](realtime[_0xbccf('0x12')]())['then'](function(){return realtime;});}function main(){return server[_0xbccf('0x13')](realtime)[_0xbccf('0x8')](function(_0x1d985d){return initRealtime();})[_0xbccf('0x8')](function(_0xd1fac0){return setInterval(initRealtime,0x1388);})[_0xbccf('0x14')](function(_0x386eec){console[_0xbccf('0x15')](_0x386eec);});}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 08d2159..4bceaf1 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2a1608,_0x182256){var _0x15ff82=function(_0xb4cbd7){while(--_0xb4cbd7){_0x2a1608['push'](_0x2a1608['shift']());}};_0x15ff82(++_0x182256);}(_0x7a54,0x106));var _0x47a5=function(_0x53242d,_0x4ac799){_0x53242d=_0x53242d-0x0;var _0x11eeba=_0x7a54[_0x53242d];return _0x11eeba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x37589b,_0x3529b1){var _0x95884f=function(_0x3ae9ea){while(--_0x3ae9ea){_0x37589b['push'](_0x37589b['shift']());}};_0x95884f(++_0x3529b1);}(_0xe14b,0x93));var _0xbe14=function(_0x54bccd,_0x54775b){_0x54bccd=_0x54bccd-0x0;var _0x3d6d79=_0xe14b[_0x54bccd];return _0x3d6d79;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 38bbf8d..28b2a95 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 _0xb7fb=['jayson/promise','client','then','error','message','SendMail'];(function(_0xb0525d,_0x3a916a){var _0xf46511=function(_0x3215bb){while(--_0x3215bb){_0xb0525d['push'](_0xb0525d['shift']());}};_0xf46511(++_0x3a916a);}(_0xb7fb,0x1d4));var _0xbb7f=function(_0x3b1e80,_0x241d42){_0x3b1e80=_0x3b1e80-0x0;var _0x545743=_0xb7fb[_0x3b1e80];return _0x545743;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xbb7f('0x0'));var client=jayson[_0xbb7f('0x1')]['http']({'port':0x232b});function request(_0x160576,_0x430b07){return new BPromise(function(_0xdcb0f1,_0xd542b0){return client['request'](_0x160576,_0x430b07)[_0xbb7f('0x2')](function(_0x9a0104){if(_0x9a0104[_0xbb7f('0x3')]){return _0xd542b0(_0x9a0104['error'][_0xbb7f('0x4')]);}else{return _0xdcb0f1(_0x9a0104['result']);}})['catch'](function(_0x27e898){return _0xd542b0(_0x27e898);});});}exports['sendMailMessage']=function(_0x4889c7,_0xc105a){return request(_0xbb7f('0x5'),{'account':_0x4889c7,'message':_0xc105a});}; \ No newline at end of file +var _0x3de8=['catch','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x4f5dfb,_0x5bfabe){var _0x4b43d1=function(_0x4a9721){while(--_0x4a9721){_0x4f5dfb['push'](_0x4f5dfb['shift']());}};_0x4b43d1(++_0x5bfabe);}(_0x3de8,0xb2));var _0x83de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de8[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x83de('0x0'));var jayson=require(_0x83de('0x1'));var client=jayson[_0x83de('0x2')][_0x83de('0x3')]({'port':0x232b});function request(_0x23fb6d,_0x30c343){return new BPromise(function(_0x115397,_0x3270ef){return client[_0x83de('0x4')](_0x23fb6d,_0x30c343)[_0x83de('0x5')](function(_0x3073d0){if(_0x3073d0[_0x83de('0x6')]){return _0x3270ef(_0x3073d0[_0x83de('0x6')][_0x83de('0x7')]);}else{return _0x115397(_0x3073d0[_0x83de('0x8')]);}})[_0x83de('0x9')](function(_0x15712f){return _0x3270ef(_0x15712f);});});}exports['sendMailMessage']=function(_0x1484af,_0x2117ad){return request(_0x83de('0xa'),{'account':_0x1484af,'message':_0x2117ad});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e25c14f..504fd95 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 _0x68da=['chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','mail','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','online','mailCurrentCapacity','faxStatus','faxStatusTime','smsStatus','smsCurrentCapacity','openchannelCapacity','mailWaitingInteractions','stringify','emit','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime'];(function(_0x4712ad,_0x32fb94){var _0x2f24dc=function(_0x5db696){while(--_0x5db696){_0x4712ad['push'](_0x4712ad['shift']());}};_0x2f24dc(++_0x32fb94);}(_0x68da,0x1af));var _0xa68d=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0x68da[_0x5e2c70];return _0x1e6cbc;};'use strict';var _=require(_0xa68d('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xa68d('0x1'));var config=require(_0xa68d('0x2'));config[_0xa68d('0x3')]=_[_0xa68d('0x4')](config[_0xa68d('0x3')],{'host':_0xa68d('0x5'),'port':0x18eb});var io=require(_0xa68d('0x6'))(new Redis(config[_0xa68d('0x3')]));function Agent(_0x12b678){this['id']=_0x12b678['id']||0x0;this[_0xa68d('0x7')]=_0x12b678['name']||'';this[_0xa68d('0x8')]=_0x12b678[_0xa68d('0x8')]||![];this['chatPause']=_0x12b678[_0xa68d('0x9')]||![];this[_0xa68d('0xa')]=_0x12b678[_0xa68d('0xa')]||![];this[_0xa68d('0xb')]=_0x12b678[_0xa68d('0xb')]||![];this[_0xa68d('0xc')]=_0x12b678[_0xa68d('0xc')]||![];this['openchannelPause']=_0x12b678[_0xa68d('0xd')]||![];this[_0xa68d('0xe')]=_0xa68d('0xf');this[_0xa68d('0x10')]=0x0;this[_0xa68d('0x11')]=_0x12b678['chatCapacity']||0x0;this[_0xa68d('0x12')]=0x0;this[_0xa68d('0x13')]='unknown';this[_0xa68d('0x14')]=0x0;this[_0xa68d('0x15')]=_0x12b678['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0xa68d('0x16')]=_0x12b678['faxCapacity']||0x0;this[_0xa68d('0x17')]=0x0;this['smsStatus']=_0xa68d('0xf');this[_0xa68d('0x18')]=0x0;this[_0xa68d('0x19')]=_0x12b678['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xa68d('0x1a')]=_0xa68d('0xf');this[_0xa68d('0x1b')]=0x0;this['whatsappCapacity']=_0x12b678[_0xa68d('0x1c')]||0x0;this[_0xa68d('0x1d')]=0x0;this[_0xa68d('0x1e')]=_0xa68d('0xf');this[_0xa68d('0x1f')]=0x0;this['openchannelCapacity']=_0x12b678['openchannelCapacity']||0x0;this[_0xa68d('0x20')]=0x0;this[_0xa68d('0x21')]=![];this['busyQueue']=undefined;this[_0xa68d('0x22')]='';this[_0xa68d('0x23')]={};this[_0xa68d('0x24')]={};this['mailWaitingInteractions']={};this[_0xa68d('0x25')]={};this[_0xa68d('0x26')]={};this[_0xa68d('0x27')]={};this[_0xa68d('0x28')]();}Agent[_0xa68d('0x29')][_0xa68d('0x2a')]=function(_0x2e45a6){if(this[_0x2e45a6+_0xa68d('0x2b')]>0x0){if(this[_0x2e45a6+'Capacity']>0x0&&this[_0x2e45a6+_0xa68d('0x2b')]>=this[_0x2e45a6+_0xa68d('0x2c')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x42e8a8=[_0xa68d('0x2d'),'chat',_0xa68d('0x2e'),_0xa68d('0x2f'),_0xa68d('0x30'),'whatsapp'];for(var _0x2c802c=0x0;_0x2c802c<_0x42e8a8[_0xa68d('0x31')];_0x2c802c+=0x1){var _0x88d373=this[_0xa68d('0x2a')](_0x42e8a8[_0x2c802c]);if(this[_0x42e8a8[_0x2c802c]+_0xa68d('0x32')]!==_0x88d373){this[_0x42e8a8[_0x2c802c]+_0xa68d('0x33')]=_[_0xa68d('0x34')](moment()[_0xa68d('0x35')]('x'));}this[_0x42e8a8[_0x2c802c]+_0xa68d('0x32')]=_0x88d373;}var _0x342a14={'id':this['id'],'name':this[_0xa68d('0x7')],'online':this[_0xa68d('0x36')],'voicePause':this[_0xa68d('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0xa68d('0xa')],'smsPause':this[_0xa68d('0xc')],'faxPause':this[_0xa68d('0xb')],'openchannelPause':this[_0xa68d('0xd')],'chatStatus':this[_0xa68d('0xe')],'chatStatusTime':this[_0xa68d('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xa68d('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xa68d('0x15')],'mailCurrentCapacity':this[_0xa68d('0x37')],'faxStatus':this[_0xa68d('0x38')],'faxStatusTime':this[_0xa68d('0x39')],'faxCapacity':this[_0xa68d('0x16')],'faxCurrentCapacity':this[_0xa68d('0x17')],'smsStatus':this[_0xa68d('0x3a')],'smsStatusTime':this[_0xa68d('0x18')],'smsCapacity':this[_0xa68d('0x19')],'smsCurrentCapacity':this[_0xa68d('0x3b')],'whatsappStatus':this[_0xa68d('0x1a')],'whatsappStatusTime':this[_0xa68d('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xa68d('0x1d')],'openchannelStatus':this[_0xa68d('0x1e')],'openchannelStatusTime':this[_0xa68d('0x1f')],'openchannelCapacity':this[_0xa68d('0x3c')],'openchannelCurrentCapacity':this[_0xa68d('0x20')],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xa68d('0x23')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xa68d('0x3d')],'openchannelWaitingInteractions':this[_0xa68d('0x25')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xa68d('0x27')]};var _0x4c1d22=md5(JSON[_0xa68d('0x3e')](_0x342a14));if(this[_0xa68d('0x22')]!==_0x4c1d22){this[_0xa68d('0x22')]=_0x4c1d22;io[_0xa68d('0x3f')]('user:routing:update',_0x342a14);}};module['exports']=Agent; \ No newline at end of file +var _0x7d19=['updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','online','faxStatusTime','stringify','emit','user:routing:update','exports','lodash','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x7d19,0x1e5));var _0x97d1=function(_0x10b4d3,_0x12e69b){_0x10b4d3=_0x10b4d3-0x0;var _0x12615b=_0x7d19[_0x10b4d3];return _0x12615b;};'use strict';var _=require(_0x97d1('0x0'));var moment=require(_0x97d1('0x1'));var md5=require(_0x97d1('0x2'));var Redis=require(_0x97d1('0x3'));var config=require('../../../config/environment');config[_0x97d1('0x4')]=_['defaults'](config[_0x97d1('0x4')],{'host':_0x97d1('0x5'),'port':0x18eb});var io=require(_0x97d1('0x6'))(new Redis(config[_0x97d1('0x4')]));function Agent(_0x3d0328){this['id']=_0x3d0328['id']||0x0;this[_0x97d1('0x7')]=_0x3d0328['name']||'';this[_0x97d1('0x8')]=_0x3d0328['voicePause']||![];this[_0x97d1('0x9')]=_0x3d0328[_0x97d1('0x9')]||![];this[_0x97d1('0xa')]=_0x3d0328[_0x97d1('0xa')]||![];this[_0x97d1('0xb')]=_0x3d0328['faxPause']||![];this['smsPause']=_0x3d0328['smsPause']||![];this[_0x97d1('0xc')]=_0x3d0328[_0x97d1('0xc')]||![];this[_0x97d1('0xd')]=_0x97d1('0xe');this[_0x97d1('0xf')]=0x0;this[_0x97d1('0x10')]=_0x3d0328['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x97d1('0x11')]=_0x97d1('0xe');this[_0x97d1('0x12')]=0x0;this[_0x97d1('0x13')]=_0x3d0328[_0x97d1('0x13')]||0x0;this[_0x97d1('0x14')]=0x0;this[_0x97d1('0x15')]=_0x97d1('0xe');this['faxStatusTime']=0x0;this[_0x97d1('0x16')]=_0x3d0328[_0x97d1('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x97d1('0x17')]=_0x97d1('0xe');this[_0x97d1('0x18')]=0x0;this[_0x97d1('0x19')]=_0x3d0328[_0x97d1('0x19')]||0x0;this[_0x97d1('0x1a')]=0x0;this[_0x97d1('0x1b')]=_0x97d1('0xe');this[_0x97d1('0x1c')]=0x0;this[_0x97d1('0x1d')]=_0x3d0328[_0x97d1('0x1d')]||0x0;this[_0x97d1('0x1e')]=0x0;this[_0x97d1('0x1f')]=_0x97d1('0xe');this[_0x97d1('0x20')]=0x0;this[_0x97d1('0x21')]=_0x3d0328[_0x97d1('0x21')]||0x0;this[_0x97d1('0x22')]=0x0;this[_0x97d1('0x23')]=![];this[_0x97d1('0x24')]=undefined;this['md5']='';this[_0x97d1('0x25')]={};this[_0x97d1('0x26')]={};this[_0x97d1('0x27')]={};this[_0x97d1('0x28')]={};this[_0x97d1('0x29')]={};this[_0x97d1('0x2a')]={};this[_0x97d1('0x2b')]();}Agent[_0x97d1('0x2c')][_0x97d1('0x2d')]=function(_0x5755fc){if(this[_0x5755fc+_0x97d1('0x2e')]>0x0){if(this[_0x5755fc+_0x97d1('0x2f')]>0x0&&this[_0x5755fc+'CurrentCapacity']>=this[_0x5755fc+_0x97d1('0x2f')]){return _0x97d1('0x30');}else{return'working';}}else{return _0x97d1('0x31');}};Agent[_0x97d1('0x2c')][_0x97d1('0x2b')]=function(){var _0x4c24e7=[_0x97d1('0x32'),_0x97d1('0x33'),_0x97d1('0x34'),_0x97d1('0x35'),_0x97d1('0x36'),_0x97d1('0x37')];for(var _0x64d23b=0x0;_0x64d23b<_0x4c24e7[_0x97d1('0x38')];_0x64d23b+=0x1){var _0x3594a4=this[_0x97d1('0x2d')](_0x4c24e7[_0x64d23b]);if(this[_0x4c24e7[_0x64d23b]+_0x97d1('0x39')]!==_0x3594a4){this[_0x4c24e7[_0x64d23b]+_0x97d1('0x3a')]=_['toNumber'](moment()[_0x97d1('0x3b')]('x'));}this[_0x4c24e7[_0x64d23b]+_0x97d1('0x39')]=_0x3594a4;}var _0x4cbf67={'id':this['id'],'name':this[_0x97d1('0x7')],'online':this[_0x97d1('0x3c')],'voicePause':this[_0x97d1('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x97d1('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x97d1('0xd')],'chatStatusTime':this[_0x97d1('0xf')],'chatCapacity':this[_0x97d1('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x97d1('0x11')],'mailStatusTime':this[_0x97d1('0x12')],'mailCapacity':this[_0x97d1('0x13')],'mailCurrentCapacity':this[_0x97d1('0x14')],'faxStatus':this[_0x97d1('0x15')],'faxStatusTime':this[_0x97d1('0x3d')],'faxCapacity':this[_0x97d1('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x97d1('0x17')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x97d1('0x19')],'smsCurrentCapacity':this[_0x97d1('0x1a')],'whatsappStatus':this[_0x97d1('0x1b')],'whatsappStatusTime':this[_0x97d1('0x1c')],'whatsappCapacity':this[_0x97d1('0x1d')],'whatsappCurrentCapacity':this[_0x97d1('0x1e')],'openchannelStatus':this[_0x97d1('0x1f')],'openchannelStatusTime':this[_0x97d1('0x20')],'openchannelCapacity':this[_0x97d1('0x21')],'openchannelCurrentCapacity':this[_0x97d1('0x22')],'busy':this['busy'],'busyQueue':this[_0x97d1('0x24')],'chatWaitingInteractions':this[_0x97d1('0x25')],'faxWaitingInteractions':this[_0x97d1('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x97d1('0x28')],'smsWaitingInteractions':this[_0x97d1('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x4cde9a=md5(JSON[_0x97d1('0x3e')](_0x4cbf67));if(this['md5']!==_0x4cde9a){this['md5']=_0x4cde9a;io[_0x97d1('0x3f')](_0x97d1('0x40'),_0x4cbf67);}};module[_0x97d1('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7811ae7..6e4d13f 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 _0x99c9=['beepall','md5','updateRouting','prototype','mapAgentsId','map','Agents','_rr','updateRealtime','loggedIn','paused','available','waiting','stringify','format','chat:queue:%s','emit','lodash','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x48013c,_0x54372e){var _0x45afd3=function(_0x399f68){while(--_0x399f68){_0x48013c['push'](_0x48013c['shift']());}};_0x45afd3(++_0x54372e);}(_0x99c9,0xa1));var _0x999c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x99c9[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x999c('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x999c('0x1')]=_[_0x999c('0x2')](config[_0x999c('0x1')],{'host':'localhost','port':0x18eb});var io=require(_0x999c('0x3'))(new Redis(config[_0x999c('0x1')]));function ChatQueue(_0x405ba3){this['id']=_0x405ba3['id']||0x0;this[_0x999c('0x4')]=_0x405ba3[_0x999c('0x4')]||'';this[_0x999c('0x5')]=_0x405ba3[_0x999c('0x5')]||0xa;this[_0x999c('0x6')]=_0x405ba3[_0x999c('0x6')]||_0x999c('0x7');this['Agents']=_0x405ba3['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x999c('0x8')]='';this[_0x999c('0x9')]();this['updateRealtime']();}ChatQueue[_0x999c('0xa')][_0x999c('0x9')]=function(){var _0x3b5a3a=this['mapAgentsId']['_rr'];this[_0x999c('0xb')]=_[_0x999c('0xc')](this[_0x999c('0xd')],'id');this['mapAgentsId'][_0x999c('0xe')]=_0x3b5a3a;};ChatQueue[_0x999c('0xa')][_0x999c('0xf')]=function(){this[_0x999c('0x10')]=0x0;this['paused']=0x0;for(var _0x40544e=0x0;_0x40544e=0x0?this[_0x999c('0x12')]:0x0;var _0x27bdd0={'id':this['id'],'available':this[_0x999c('0x12')],'loggedIn':this[_0x999c('0x10')],'name':this[_0x999c('0x4')],'paused':this[_0x999c('0x11')],'waiting':this[_0x999c('0x13')]};var _0x538c56=md5(JSON[_0x999c('0x14')](_0x27bdd0));if(this['md5']!==_0x538c56){this[_0x999c('0x8')]=_0x538c56;io['to'](util[_0x999c('0x15')](_0x999c('0x16'),_0x27bdd0['name']))[_0x999c('0x17')]('chat_queue:save',_0x27bdd0);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xdb15=['prototype','_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1aa8f6,_0x1f1c93){var _0x3050ea=function(_0x3305a2){while(--_0x3305a2){_0x1aa8f6['push'](_0x1aa8f6['shift']());}};_0x3050ea(++_0x1f1c93);}(_0xdb15,0x182));var _0x5db1=function(_0x42b553,_0x3dc704){_0x42b553=_0x42b553-0x0;var _0x3dfcf4=_0xdb15[_0x42b553];return _0x3dfcf4;};'use strict';var _=require(_0x5db1('0x0'));var md5=require(_0x5db1('0x1'));var util=require(_0x5db1('0x2'));var Redis=require(_0x5db1('0x3'));var config=require(_0x5db1('0x4'));config['redis']=_[_0x5db1('0x5')](config[_0x5db1('0x6')],{'host':_0x5db1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5db1('0x6')]));function ChatQueue(_0x56d0a7){this['id']=_0x56d0a7['id']||0x0;this[_0x5db1('0x8')]=_0x56d0a7[_0x5db1('0x8')]||'';this[_0x5db1('0x9')]=_0x56d0a7[_0x5db1('0x9')]||0xa;this[_0x5db1('0xa')]=_0x56d0a7[_0x5db1('0xa')]||_0x5db1('0xb');this[_0x5db1('0xc')]=_0x56d0a7[_0x5db1('0xc')];this[_0x5db1('0xd')]={};this[_0x5db1('0xe')]=0x0;this[_0x5db1('0x1')]='';this[_0x5db1('0xf')]();this[_0x5db1('0x10')]();}ChatQueue[_0x5db1('0x11')]['updateRouting']=function(){var _0x7c7eec=this[_0x5db1('0xd')][_0x5db1('0x12')];this[_0x5db1('0xd')]=_['map'](this[_0x5db1('0xc')],'id');this[_0x5db1('0xd')][_0x5db1('0x12')]=_0x7c7eec;};ChatQueue[_0x5db1('0x11')][_0x5db1('0x10')]=function(){this['loggedIn']=0x0;this[_0x5db1('0x13')]=0x0;for(var _0x137ee9=0x0;_0x137ee9=0x0?this['available']:0x0;var _0x5a11dc={'id':this['id'],'available':this[_0x5db1('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x5db1('0x8')],'paused':this['paused'],'waiting':this[_0x5db1('0xe')]};var _0x316887=md5(JSON[_0x5db1('0x19')](_0x5a11dc));if(this[_0x5db1('0x1')]!==_0x316887){this[_0x5db1('0x1')]=_0x316887;io['to'](util[_0x5db1('0x1a')](_0x5db1('0x1b'),_0x5a11dc['name']))[_0x5db1('0x1c')](_0x5db1('0x1d'),_0x5a11dc);}};module[_0x5db1('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 263bc33..a2aa1b9 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 _0x89ab=['mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x89ab,0xb6));var _0xb89a=function(_0xd4ee30,_0xa3427d){_0xd4ee30=_0xd4ee30-0x0;var _0x3d3528=_0x89ab[_0xd4ee30];return _0x3d3528;};'use strict';var _=require('lodash');var md5=require(_0xb89a('0x0'));var util=require('util');var Redis=require(_0xb89a('0x1'));var config=require(_0xb89a('0x2'));config[_0xb89a('0x3')]=_[_0xb89a('0x4')](config[_0xb89a('0x3')],{'host':_0xb89a('0x5'),'port':0x18eb});var io=require(_0xb89a('0x6'))(new Redis(config[_0xb89a('0x3')]));function FaxQueue(_0x4548f1){this['id']=_0x4548f1['id']||0x0;this['name']=_0x4548f1[_0xb89a('0x7')]||'';this[_0xb89a('0x8')]=_0x4548f1['timeout']||0xa;this[_0xb89a('0x9')]=_0x4548f1[_0xb89a('0x9')]||'beepall';this['Agents']=_0x4548f1[_0xb89a('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xb89a('0x0')]='';this[_0xb89a('0xb')]();this[_0xb89a('0xc')]();}FaxQueue[_0xb89a('0xd')][_0xb89a('0xb')]=function(){var _0x4ac545=this[_0xb89a('0xe')]['_rr'];this[_0xb89a('0xe')]=_[_0xb89a('0xf')](this[_0xb89a('0xa')],'id');this['mapAgentsId'][_0xb89a('0x10')]=_0x4ac545;};FaxQueue[_0xb89a('0xd')][_0xb89a('0xc')]=function(){this[_0xb89a('0x11')]=0x0;this[_0xb89a('0x12')]=0x0;for(var _0x5431e0=0x0;_0x5431e0=0x0?this['available']:0x0;var _0x122437={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb89a('0x11')],'name':this[_0xb89a('0x7')],'paused':this[_0xb89a('0x12')],'waiting':this[_0xb89a('0x16')]};var _0x24ec6f=md5(JSON[_0xb89a('0x17')](_0x122437));if(this[_0xb89a('0x0')]!==_0x24ec6f){this[_0xb89a('0x0')]=_0x24ec6f;io['to'](util['format'](_0xb89a('0x18'),_0x122437['name']))[_0xb89a('0x19')](_0xb89a('0x1a'),_0x122437);}};module[_0xb89a('0x1b')]=FaxQueue; \ No newline at end of file +var _0x95da=['strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','faxPause','paused','available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout'];(function(_0x3ef800,_0x3cb5fe){var _0x1cc409=function(_0x439f8b){while(--_0x439f8b){_0x3ef800['push'](_0x3ef800['shift']());}};_0x1cc409(++_0x3cb5fe);}(_0x95da,0x19c));var _0xa95d=function(_0x46511d,_0x4e941b){_0x46511d=_0x46511d-0x0;var _0x8f0de2=_0x95da[_0x46511d];return _0x8f0de2;};'use strict';var _=require('lodash');var md5=require(_0xa95d('0x0'));var util=require(_0xa95d('0x1'));var Redis=require('ioredis');var config=require(_0xa95d('0x2'));config[_0xa95d('0x3')]=_[_0xa95d('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa95d('0x5'))(new Redis(config[_0xa95d('0x3')]));function FaxQueue(_0x309437){this['id']=_0x309437['id']||0x0;this[_0xa95d('0x6')]=_0x309437[_0xa95d('0x6')]||'';this[_0xa95d('0x7')]=_0x309437[_0xa95d('0x7')]||0xa;this[_0xa95d('0x8')]=_0x309437['strategy']||_0xa95d('0x9');this[_0xa95d('0xa')]=_0x309437[_0xa95d('0xa')];this[_0xa95d('0xb')]={};this['waiting']=0x0;this[_0xa95d('0x0')]='';this[_0xa95d('0xc')]();this[_0xa95d('0xd')]();}FaxQueue[_0xa95d('0xe')][_0xa95d('0xc')]=function(){var _0x2b23bc=this[_0xa95d('0xb')][_0xa95d('0xf')];this[_0xa95d('0xb')]=_['map'](this[_0xa95d('0xa')],'id');this['mapAgentsId'][_0xa95d('0xf')]=_0x2b23bc;};FaxQueue[_0xa95d('0xe')][_0xa95d('0xd')]=function(){this[_0xa95d('0x10')]=0x0;this['paused']=0x0;for(var _0x577d3b=0x0;_0x577d3b=0x0?this[_0xa95d('0x15')]:0x0;var _0xac308b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa95d('0x10')],'name':this['name'],'paused':this[_0xa95d('0x14')],'waiting':this[_0xa95d('0x16')]};var _0x3a30ab=md5(JSON['stringify'](_0xac308b));if(this['md5']!==_0x3a30ab){this['md5']=_0x3a30ab;io['to'](util[_0xa95d('0x17')](_0xa95d('0x18'),_0xac308b[_0xa95d('0x6')]))[_0xa95d('0x19')](_0xa95d('0x1a'),_0xac308b);}};module[_0xa95d('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 433ddb1..28dea9a 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 _0x75ff=['exports','name'];(function(_0x5b8298,_0xa67155){var _0x29cac3=function(_0x59eb60){while(--_0x59eb60){_0x5b8298['push'](_0x5b8298['shift']());}};_0x29cac3(++_0xa67155);}(_0x75ff,0x153));var _0xf75f=function(_0x5b7b22,_0x5bc479){_0x5b7b22=_0x5b7b22-0x0;var _0x53dc9d=_0x75ff[_0x5b7b22];return _0x53dc9d;};'use strict';function Interval(_0x4a9842){this['id']=_0x4a9842['id']||0x0;this[_0xf75f('0x0')]=_0x4a9842[_0xf75f('0x0')]||'';this['Intervals']=_0x4a9842['Intervals']||{};}module[_0xf75f('0x1')]=Interval; \ No newline at end of file +var _0x388e=['Intervals','exports','name'];(function(_0xd45b65,_0x12b848){var _0x11c1c8=function(_0x5f27f4){while(--_0x5f27f4){_0xd45b65['push'](_0xd45b65['shift']());}};_0x11c1c8(++_0x12b848);}(_0x388e,0x1b2));var _0xe388=function(_0x238721,_0x1149ad){_0x238721=_0x238721-0x0;var _0x33c7c5=_0x388e[_0x238721];return _0x33c7c5;};'use strict';function Interval(_0x2aef12){this['id']=_0x2aef12['id']||0x0;this[_0xe388('0x0')]=_0x2aef12[_0xe388('0x0')]||'';this[_0xe388('0x1')]=_0x2aef12[_0xe388('0x1')]||{};}module[_0xe388('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 f1d4978..616413e 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 _0xc4b7=['ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','mailPause','paused','available','loggedIn','stringify','mail:queue:%s','emit','exports','util'];(function(_0x122b96,_0x32b176){var _0x4e96a5=function(_0x34f42e){while(--_0x34f42e){_0x122b96['push'](_0x122b96['shift']());}};_0x4e96a5(++_0x32b176);}(_0xc4b7,0xdf));var _0x7c4b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4b7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x7c4b('0x0'));var Redis=require(_0x7c4b('0x1'));var config=require(_0x7c4b('0x2'));config['redis']=_[_0x7c4b('0x3')](config[_0x7c4b('0x4')],{'host':_0x7c4b('0x5'),'port':0x18eb});var io=require(_0x7c4b('0x6'))(new Redis(config[_0x7c4b('0x4')]));function MailQueue(_0x5e8ef4){this['id']=_0x5e8ef4['id']||0x0;this['name']=_0x5e8ef4[_0x7c4b('0x7')]||'';this['timeout']=_0x5e8ef4[_0x7c4b('0x8')]||0xa;this[_0x7c4b('0x9')]=_0x5e8ef4['strategy']||_0x7c4b('0xa');this['Agents']=_0x5e8ef4[_0x7c4b('0xb')];this[_0x7c4b('0xc')]={};this[_0x7c4b('0xd')]=0x0;this[_0x7c4b('0xe')]='';this[_0x7c4b('0xf')]();this[_0x7c4b('0x10')]();}MailQueue[_0x7c4b('0x11')][_0x7c4b('0xf')]=function(){var _0x4884e8=this['mapAgentsId'][_0x7c4b('0x12')];this['mapAgentsId']=_[_0x7c4b('0x13')](this[_0x7c4b('0xb')],'id');this[_0x7c4b('0xc')][_0x7c4b('0x12')]=_0x4884e8;};MailQueue[_0x7c4b('0x11')][_0x7c4b('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2e76f9=0x0;_0x2e76f9=0x0?this[_0x7c4b('0x16')]:0x0;var _0x22cec7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7c4b('0x17')],'name':this[_0x7c4b('0x7')],'paused':this[_0x7c4b('0x15')],'waiting':this[_0x7c4b('0xd')]};var _0x2c516d=md5(JSON[_0x7c4b('0x18')](_0x22cec7));if(this[_0x7c4b('0xe')]!==_0x2c516d){this[_0x7c4b('0xe')]=_0x2c516d;io['to'](util['format'](_0x7c4b('0x19'),_0x22cec7['name']))[_0x7c4b('0x1a')]('mail_queue:save',_0x22cec7);}};module[_0x7c4b('0x1b')]=MailQueue; \ No newline at end of file +var _0xa740=['updateRealtime','prototype','map','_rr','loggedIn','paused','online','mailPause','available','stringify','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x55a49b,_0x692eec){var _0x39cd28=function(_0x5d9c07){while(--_0x5d9c07){_0x55a49b['push'](_0x55a49b['shift']());}};_0x39cd28(++_0x692eec);}(_0xa740,0xed));var _0x0a74=function(_0x2c5c7c,_0x559587){_0x2c5c7c=_0x2c5c7c-0x0;var _0x5d77af=_0xa740[_0x2c5c7c];return _0x5d77af;};'use strict';var _=require(_0x0a74('0x0'));var md5=require(_0x0a74('0x1'));var util=require(_0x0a74('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a74('0x3')]=_[_0x0a74('0x4')](config[_0x0a74('0x3')],{'host':_0x0a74('0x5'),'port':0x18eb});var io=require(_0x0a74('0x6'))(new Redis(config[_0x0a74('0x3')]));function MailQueue(_0x32dff5){this['id']=_0x32dff5['id']||0x0;this['name']=_0x32dff5[_0x0a74('0x7')]||'';this['timeout']=_0x32dff5[_0x0a74('0x8')]||0xa;this['strategy']=_0x32dff5[_0x0a74('0x9')]||_0x0a74('0xa');this[_0x0a74('0xb')]=_0x32dff5[_0x0a74('0xb')];this[_0x0a74('0xc')]={};this[_0x0a74('0xd')]=0x0;this['md5']='';this[_0x0a74('0xe')]();this[_0x0a74('0xf')]();}MailQueue[_0x0a74('0x10')]['updateRouting']=function(){var _0x54b9c2=this[_0x0a74('0xc')]['_rr'];this[_0x0a74('0xc')]=_[_0x0a74('0x11')](this[_0x0a74('0xb')],'id');this[_0x0a74('0xc')][_0x0a74('0x12')]=_0x54b9c2;};MailQueue[_0x0a74('0x10')]['updateRealtime']=function(){this[_0x0a74('0x13')]=0x0;this[_0x0a74('0x14')]=0x0;for(var _0x178b27=0x0;_0x178b27=0x0?this['available']:0x0;var _0x1c9639={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x0a74('0x14')],'waiting':this[_0x0a74('0xd')]};var _0x24f72a=md5(JSON[_0x0a74('0x18')](_0x1c9639));if(this[_0x0a74('0x1')]!==_0x24f72a){this[_0x0a74('0x1')]=_0x24f72a;io['to'](util['format'](_0x0a74('0x19'),_0x1c9639[_0x0a74('0x7')]))['emit'](_0x0a74('0x1a'),_0x1c9639);}};module[_0x0a74('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5ce6968..5c20989 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 _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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x326f,0xd1));var _0xf326=function(_0x58ebd9,_0x12b04c){_0x58ebd9=_0x58ebd9-0x0;var _0x313719=_0x326f[_0x58ebd9];return _0x313719;};'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 +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x46992d,_0x57ff6c){_0x46992d=_0x46992d-0x0;var _0x4c0fc5=_0x7a54[_0x46992d];return _0x4c0fc5;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 75be512..7c46780 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 _0xfd2f=['socket.io-emitter','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','_rr','map','online','loggedIn','smsPause','paused','available','name','format','sms_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis'];(function(_0x35af8e,_0x4e0dfa){var _0x5a32ff=function(_0x2aad6f){while(--_0x2aad6f){_0x35af8e['push'](_0x35af8e['shift']());}};_0x5a32ff(++_0x4e0dfa);}(_0xfd2f,0x14a));var _0xffd2=function(_0x396aff,_0x51367d){_0x396aff=_0x396aff-0x0;var _0x36a6b1=_0xfd2f[_0x396aff];return _0x36a6b1;};'use strict';var _=require(_0xffd2('0x0'));var md5=require(_0xffd2('0x1'));var util=require(_0xffd2('0x2'));var Redis=require('ioredis');var config=require(_0xffd2('0x3'));config['redis']=_[_0xffd2('0x4')](config[_0xffd2('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xffd2('0x6'))(new Redis(config[_0xffd2('0x5')]));function SmsQueue(_0x4aef44){this['id']=_0x4aef44['id']||0x0;this['name']=_0x4aef44['name']||'';this[_0xffd2('0x7')]=_0x4aef44[_0xffd2('0x7')]||0xa;this['strategy']=_0x4aef44[_0xffd2('0x8')]||'beepall';this['Agents']=_0x4aef44[_0xffd2('0x9')];this[_0xffd2('0xa')]={};this[_0xffd2('0xb')]=0x0;this[_0xffd2('0x1')]='';this['updateRouting']();this[_0xffd2('0xc')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x506d58=this[_0xffd2('0xa')][_0xffd2('0xd')];this[_0xffd2('0xa')]=_[_0xffd2('0xe')](this[_0xffd2('0x9')],'id');this[_0xffd2('0xa')][_0xffd2('0xd')]=_0x506d58;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2f0d34=0x0;_0x2f0d34=0x0?this[_0xffd2('0x13')]:0x0;var _0x214737={'id':this['id'],'available':this['available'],'loggedIn':this[_0xffd2('0x10')],'name':this[_0xffd2('0x14')],'paused':this[_0xffd2('0x12')],'waiting':this[_0xffd2('0xb')]};var _0x49690c=md5(JSON['stringify'](_0x214737));if(this[_0xffd2('0x1')]!==_0x49690c){this[_0xffd2('0x1')]=_0x49690c;io['to'](util[_0xffd2('0x15')]('sms:queue:%s',_0x214737[_0xffd2('0x14')]))['emit'](_0xffd2('0x16'),_0x214737);}};module[_0xffd2('0x17')]=SmsQueue; \ No newline at end of file +var _0xb201=['prototype','_rr','map','updateRealtime','loggedIn','paused','length','smsPause','available','stringify','md5','sms:queue:%s','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0xb201,0x1b1));var _0x1b20=function(_0xe79988,_0x9a94e0){_0xe79988=_0xe79988-0x0;var _0x3cdb6b=_0xb201[_0xe79988];return _0x3cdb6b;};'use strict';var _=require(_0x1b20('0x0'));var md5=require('md5');var util=require(_0x1b20('0x1'));var Redis=require(_0x1b20('0x2'));var config=require(_0x1b20('0x3'));config[_0x1b20('0x4')]=_[_0x1b20('0x5')](config[_0x1b20('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1b20('0x6'))(new Redis(config[_0x1b20('0x4')]));function SmsQueue(_0x34bde5){this['id']=_0x34bde5['id']||0x0;this['name']=_0x34bde5[_0x1b20('0x7')]||'';this['timeout']=_0x34bde5[_0x1b20('0x8')]||0xa;this[_0x1b20('0x9')]=_0x34bde5[_0x1b20('0x9')]||_0x1b20('0xa');this['Agents']=_0x34bde5[_0x1b20('0xb')];this[_0x1b20('0xc')]={};this[_0x1b20('0xd')]=0x0;this['md5']='';this[_0x1b20('0xe')]();this['updateRealtime']();}SmsQueue[_0x1b20('0xf')]['updateRouting']=function(){var _0x4cba95=this[_0x1b20('0xc')][_0x1b20('0x10')];this[_0x1b20('0xc')]=_[_0x1b20('0x11')](this[_0x1b20('0xb')],'id');this['mapAgentsId'][_0x1b20('0x10')]=_0x4cba95;};SmsQueue[_0x1b20('0xf')][_0x1b20('0x12')]=function(){this[_0x1b20('0x13')]=0x0;this[_0x1b20('0x14')]=0x0;for(var _0x4f4f28=0x0;_0x4f4f28=0x0?this[_0x1b20('0x17')]:0x0;var _0xf9078e={'id':this['id'],'available':this[_0x1b20('0x17')],'loggedIn':this[_0x1b20('0x13')],'name':this[_0x1b20('0x7')],'paused':this[_0x1b20('0x14')],'waiting':this[_0x1b20('0xd')]};var _0x3ff32c=md5(JSON[_0x1b20('0x18')](_0xf9078e));if(this[_0x1b20('0x19')]!==_0x3ff32c){this[_0x1b20('0x19')]=_0x3ff32c;io['to'](util['format'](_0x1b20('0x1a'),_0xf9078e['name']))['emit']('sms_queue:save',_0xf9078e);}};module[_0x1b20('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 738b077..74d6218 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 _0xe9cb=['stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','whatsappPause','paused','available'];(function(_0x3b97a5,_0xa64be0){var _0x44ea6e=function(_0xc621a3){while(--_0xc621a3){_0x3b97a5['push'](_0x3b97a5['shift']());}};_0x44ea6e(++_0xa64be0);}(_0xe9cb,0x12e));var _0xbe9c=function(_0x11314c,_0x2ca8d7){_0x11314c=_0x11314c-0x0;var _0x12cb4a=_0xe9cb[_0x11314c];return _0x12cb4a;};'use strict';var _=require(_0xbe9c('0x0'));var md5=require(_0xbe9c('0x1'));var util=require(_0xbe9c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xbe9c('0x3')](config[_0xbe9c('0x4')],{'host':_0xbe9c('0x5'),'port':0x18eb});var io=require(_0xbe9c('0x6'))(new Redis(config[_0xbe9c('0x4')]));function WhatsappQueue(_0x434cf5){this['id']=_0x434cf5['id']||0x0;this[_0xbe9c('0x7')]=_0x434cf5[_0xbe9c('0x7')]||'';this[_0xbe9c('0x8')]=_0x434cf5[_0xbe9c('0x8')]||0xa;this[_0xbe9c('0x9')]=_0x434cf5[_0xbe9c('0x9')]||'beepall';this[_0xbe9c('0xa')]=_0x434cf5[_0xbe9c('0xa')];this[_0xbe9c('0xb')]={};this[_0xbe9c('0xc')]=0x0;this[_0xbe9c('0x1')]='';this[_0xbe9c('0xd')]();this[_0xbe9c('0xe')]();}WhatsappQueue[_0xbe9c('0xf')][_0xbe9c('0xd')]=function(){var _0x6b12fe=this['mapAgentsId']['_rr'];this[_0xbe9c('0xb')]=_[_0xbe9c('0x10')](this[_0xbe9c('0xa')],'id');this[_0xbe9c('0xb')]['_rr']=_0x6b12fe;};WhatsappQueue[_0xbe9c('0xf')][_0xbe9c('0xe')]=function(){this[_0xbe9c('0x11')]=0x0;this['paused']=0x0;for(var _0x42bfdd=0x0;_0x42bfdd=0x0?this['available']:0x0;var _0x50a3c5={'id':this['id'],'available':this[_0xbe9c('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xbe9c('0x7')],'paused':this[_0xbe9c('0x14')],'waiting':this['waiting']};var _0x4e7f75=md5(JSON[_0xbe9c('0x16')](_0x50a3c5));if(this[_0xbe9c('0x1')]!==_0x4e7f75){this[_0xbe9c('0x1')]=_0x4e7f75;io['to'](util[_0xbe9c('0x17')](_0xbe9c('0x18'),_0x50a3c5[_0xbe9c('0x7')]))[_0xbe9c('0x19')](_0xbe9c('0x1a'),_0x50a3c5);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x26b0=['ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5'];(function(_0xbff9a7,_0x5ea599){var _0x21224f=function(_0x515754){while(--_0x515754){_0xbff9a7['push'](_0xbff9a7['shift']());}};_0x21224f(++_0x5ea599);}(_0x26b0,0x1be));var _0x026b=function(_0x24bf49,_0x265dc9){_0x24bf49=_0x24bf49-0x0;var _0x11160a=_0x26b0[_0x24bf49];return _0x11160a;};'use strict';var _=require(_0x026b('0x0'));var md5=require(_0x026b('0x1'));var util=require('util');var Redis=require(_0x026b('0x2'));var config=require('../../../config/environment');config[_0x026b('0x3')]=_[_0x026b('0x4')](config[_0x026b('0x3')],{'host':_0x026b('0x5'),'port':0x18eb});var io=require(_0x026b('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x5b1cb2){this['id']=_0x5b1cb2['id']||0x0;this[_0x026b('0x7')]=_0x5b1cb2[_0x026b('0x7')]||'';this['timeout']=_0x5b1cb2[_0x026b('0x8')]||0xa;this[_0x026b('0x9')]=_0x5b1cb2[_0x026b('0x9')]||'beepall';this[_0x026b('0xa')]=_0x5b1cb2[_0x026b('0xa')];this['mapAgentsId']={};this[_0x026b('0xb')]=0x0;this[_0x026b('0x1')]='';this[_0x026b('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x026b('0xd')][_0x026b('0xc')]=function(){var _0x26c3b0=this[_0x026b('0xe')][_0x026b('0xf')];this[_0x026b('0xe')]=_[_0x026b('0x10')](this[_0x026b('0xa')],'id');this[_0x026b('0xe')]['_rr']=_0x26c3b0;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x026b('0x11')]=0x0;this[_0x026b('0x12')]=0x0;for(var _0x979c0b=0x0;_0x979c0b=0x0?this['available']:0x0;var _0x30fb1f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x026b('0x7')],'paused':this[_0x026b('0x12')],'waiting':this[_0x026b('0xb')]};var _0x3da351=md5(JSON[_0x026b('0x17')](_0x30fb1f));if(this[_0x026b('0x1')]!==_0x3da351){this['md5']=_0x3da351;io['to'](util[_0x026b('0x18')](_0x026b('0x19'),_0x30fb1f[_0x026b('0x7')]))[_0x026b('0x1a')]('whatsapp_queue:save',_0x30fb1f);}};module[_0x026b('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 216c0cd..3182ac1 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x273a77,_0x44afaa){var _0x3f275e=function(_0x8cc4b9){while(--_0x8cc4b9){_0x273a77['push'](_0x273a77['shift']());}};_0x3f275e(++_0x44afaa);}(_0xb10b,0x12a));var _0xbb10=function(_0x298510,_0x21b06b){_0x298510=_0x298510-0x0;var _0x51f279=_0xb10b[_0x298510];return _0x51f279;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 7fddcf3..3ae85ec 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 _0xaf5c=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf5c,0x173));var _0xcaf5=function(_0x1e59c4,_0x5d1506){_0x1e59c4=_0x1e59c4-0x0;var _0xd03f58=_0xaf5c[_0x1e59c4];return _0xd03f58;};'use strict';var client=require('../client');exports[_0xcaf5('0x0')]=function(_0x483b2a,_0x4eeb68){return client[_0xcaf5('0x1')](_0xcaf5('0x2'),{'body':_0x4eeb68,'options':{'where':{'id':_0x483b2a}},'log':_0xcaf5('0x3')});};exports[_0xcaf5('0x4')]=function(_0xecb2c0,_0x37d2ba){return client[_0xcaf5('0x1')](_0xcaf5('0x5'),{'body':_0x37d2ba,'options':{'where':{'id':_0xecb2c0}},'log':_0xcaf5('0x6')});}; \ No newline at end of file +var _0xa409=['../client','update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x2c3464,_0x2acebf){var _0x254f76=function(_0x2b1448){while(--_0x2b1448){_0x2c3464['push'](_0x2c3464['shift']());}};_0x254f76(++_0x2acebf);}(_0xa409,0x134));var _0x9a40=function(_0x364d7a,_0x43e789){_0x364d7a=_0x364d7a-0x0;var _0x38623e=_0xa409[_0x364d7a];return _0x38623e;};'use strict';var client=require(_0x9a40('0x0'));exports[_0x9a40('0x1')]=function(_0x41b308,_0x36c291){return client[_0x9a40('0x2')](_0x9a40('0x3'),{'body':_0x36c291,'options':{'where':{'id':_0x41b308}},'log':'updateChatInteraction'});};exports[_0x9a40('0x4')]=function(_0x28d587,_0x561a50){return client[_0x9a40('0x2')](_0x9a40('0x5'),{'body':_0x561a50,'options':{'where':{'id':_0x28d587}},'log':_0x9a40('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9718535..734e651 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 _0xe694=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe694,0x174));var _0x4e69=function(_0x5ebcc4,_0x24356a){_0x5ebcc4=_0x5ebcc4-0x0;var _0xff2552=_0xe694[_0x5ebcc4];return _0xff2552;};'use strict';var client=require(_0x4e69('0x0'));exports[_0x4e69('0x1')]=function(_0x49ccbf){return client[_0x4e69('0x2')](_0x4e69('0x3'),{'body':_0x49ccbf,'log':_0x4e69('0x4')});}; \ No newline at end of file +var _0x2bca=['create','createChatMessage','../client'];(function(_0x4ce0df,_0x14a96d){var _0x25e2b8=function(_0x387d4a){while(--_0x387d4a){_0x4ce0df['push'](_0x4ce0df['shift']());}};_0x25e2b8(++_0x14a96d);}(_0x2bca,0x13a));var _0xa2bc=function(_0x26a71e,_0x529d2b){_0x26a71e=_0x26a71e-0x0;var _0x2f24b7=_0x2bca[_0x26a71e];return _0x2f24b7;};'use strict';var client=require(_0xa2bc('0x0'));exports[_0xa2bc('0x1')]=function(_0xd87e7e){return client['Request']('CreateChatMessage',{'body':_0xd87e7e,'log':_0xa2bc('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 23b072e..2a3373a 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 _0xc569=['chatPause','../client','getChatQueues','Request','name','timeout','User','Agents'];(function(_0x651998,_0x3787f6){var _0x2eb83b=function(_0x17a825){while(--_0x17a825){_0x651998['push'](_0x651998['shift']());}};_0x2eb83b(++_0x3787f6);}(_0xc569,0x159));var _0x9c56=function(_0x5f3f71,_0x236de7){_0x5f3f71=_0x5f3f71-0x0;var _0x275dd6=_0xc569[_0x5f3f71];return _0x275dd6;};'use strict';var client=require(_0x9c56('0x0'));exports[_0x9c56('0x1')]=function(){return function(){return client[_0x9c56('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x9c56('0x3'),_0x9c56('0x4'),'strategy'],'include':[{'model':_0x9c56('0x5'),'as':_0x9c56('0x6'),'attributes':['id',_0x9c56('0x3'),'online',_0x9c56('0x7')]}]},'log':_0x9c56('0x1')});};}; \ No newline at end of file +var _0xdc03=['getChatQueues','../client','Request','GetChatQueue','timeout','strategy','User','Agents','name','online'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdc03,0x65));var _0x3dc0=function(_0x35447b,_0x550f16){_0x35447b=_0x35447b-0x0;var _0x11e087=_0xdc03[_0x35447b];return _0x11e087;};'use strict';var client=require(_0x3dc0('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3dc0('0x1')](_0x3dc0('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3dc0('0x3'),_0x3dc0('0x4')],'include':[{'model':_0x3dc0('0x5'),'as':_0x3dc0('0x6'),'attributes':['id',_0x3dc0('0x7'),_0x3dc0('0x8'),'chatPause']}]},'log':_0x3dc0('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index aeafbe5..c03930d 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 _0x3ae9=['CreateChatQueueReport','update','DESC','Request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ae9,0xdb));var _0x93ae=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x3ae9[_0x1beef3];return _0x5af964;};'use strict';var client=require('../client');exports['create']=function(_0x32d9e9){return client[_0x93ae('0x0')](_0x93ae('0x1'),{'body':_0x32d9e9,'log':'CreateChatQueueReport'});};exports[_0x93ae('0x2')]=function(_0x228854,_0x2dc540){return client[_0x93ae('0x0')]('UpdateChatQueueReport',{'body':_0x2dc540,'options':{'where':{'uniqueid':_0x228854},'order':[['id',_0x93ae('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x4b84=['../client','create','CreateChatQueueReport','Request'];(function(_0x250337,_0x54267b){var _0x10c225=function(_0x12f7c2){while(--_0x12f7c2){_0x250337['push'](_0x250337['shift']());}};_0x10c225(++_0x54267b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x4b84[_0x17c483];return _0x112bdb;};'use strict';var client=require(_0x44b8('0x0'));exports[_0x44b8('0x1')]=function(_0x499894){return client['Request'](_0x44b8('0x2'),{'body':_0x499894,'log':'CreateChatQueueReport'});};exports['update']=function(_0x3b26c7,_0x31282a){return client[_0x44b8('0x3')]('UpdateChatQueueReport',{'body':_0x31282a,'options':{'where':{'uniqueid':_0x3b26c7},'order':[['id','DESC']],'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 184b379..0d330ab 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0x7a54,0x106));var _0x47a5=function(_0x589df2,_0xedd392){_0x589df2=_0x589df2-0x0;var _0x2843a0=_0x7a54[_0x589df2];return _0x2843a0;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x7a54,0x106));var _0x47a5=function(_0x203371,_0x1e8cea){_0x203371=_0x203371-0x0;var _0x1d588e=_0x7a54[_0x203371];return _0x1d588e;};'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 3b5849d..53e55ba 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 _0x2839=['createFaxMessage','create','Request'];(function(_0x5a4779,_0x414192){var _0xa96b80=function(_0x3a07e5){while(--_0x3a07e5){_0x5a4779['push'](_0x5a4779['shift']());}};_0xa96b80(++_0x414192);}(_0x2839,0x76));var _0x9283=function(_0x752e1d,_0x15892d){_0x752e1d=_0x752e1d-0x0;var _0x24a36f=_0x2839[_0x752e1d];return _0x24a36f;};'use strict';var client=require('../client');exports[_0x9283('0x0')]=function(_0x1c432f){return client[_0x9283('0x1')]('CreateFaxMessage',{'body':_0x1c432f,'log':_0x9283('0x2')});}; \ No newline at end of file +var _0x4051=['CreateFaxMessage','../client','create','Request'];(function(_0xe9dc99,_0x48ab3d){var _0x420df5=function(_0x168509){while(--_0x168509){_0xe9dc99['push'](_0xe9dc99['shift']());}};_0x420df5(++_0x48ab3d);}(_0x4051,0xe1));var _0x1405=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x4051[_0x279d37];return _0x530173;};'use strict';var client=require(_0x1405('0x0'));exports[_0x1405('0x1')]=function(_0x1c624d){return client[_0x1405('0x2')](_0x1405('0x3'),{'body':_0x1c624d,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 779c754..4a45b47 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 _0xb7ea=['name','User','Agents','faxPause','../client'];(function(_0x584db2,_0x49a182){var _0x5b03bd=function(_0xde690){while(--_0xde690){_0x584db2['push'](_0x584db2['shift']());}};_0x5b03bd(++_0x49a182);}(_0xb7ea,0x18a));var _0xab7e=function(_0x574394,_0x49d75f){_0x574394=_0x574394-0x0;var _0x93a092=_0xb7ea[_0x574394];return _0x93a092;};'use strict';var client=require(_0xab7e('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xab7e('0x1'),'timeout','strategy'],'include':[{'model':_0xab7e('0x2'),'as':_0xab7e('0x3'),'attributes':['id',_0xab7e('0x1'),'online',_0xab7e('0x4')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x2b68=['Agents','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b68,0x1dd));var _0x82b6=function(_0x43931e,_0x54268e){_0x43931e=_0x43931e-0x0;var _0x7ff9d5=_0x2b68[_0x43931e];return _0x7ff9d5;};'use strict';var client=require(_0x82b6('0x0'));exports[_0x82b6('0x1')]=function(){return function(){return client['Request'](_0x82b6('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':'User','as':_0x82b6('0x3'),'attributes':['id','name','online',_0x82b6('0x4')]}]},'log':_0x82b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 42d10ff..501c16f 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 _0x1787=['Request','CreateFaxQueueReport','update','DESC','../client','create'];(function(_0x367cb3,_0x41c42d){var _0x2f1114=function(_0x32434d){while(--_0x32434d){_0x367cb3['push'](_0x367cb3['shift']());}};_0x2f1114(++_0x41c42d);}(_0x1787,0xc4));var _0x7178=function(_0x4c9173,_0x54c378){_0x4c9173=_0x4c9173-0x0;var _0x48bf57=_0x1787[_0x4c9173];return _0x48bf57;};'use strict';var client=require(_0x7178('0x0'));exports[_0x7178('0x1')]=function(_0x48c145){return client[_0x7178('0x2')](_0x7178('0x3'),{'body':_0x48c145,'log':_0x7178('0x3')});};exports[_0x7178('0x4')]=function(_0x10a3d9,_0x2cfda9){return client[_0x7178('0x2')]('UpdateFaxQueueReport',{'body':_0x2cfda9,'options':{'where':{'uniqueid':_0x10a3d9},'order':[['id',_0x7178('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xd8aa=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x396007,_0x3a697c){var _0x185651=function(_0x100675){while(--_0x100675){_0x396007['push'](_0x396007['shift']());}};_0x185651(++_0x3a697c);}(_0xd8aa,0x81));var _0xad8a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd8aa[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0xad8a('0x0'));exports[_0xad8a('0x1')]=function(_0x9372dd){return client[_0xad8a('0x2')](_0xad8a('0x3'),{'body':_0x9372dd,'log':_0xad8a('0x3')});};exports['update']=function(_0x226ac2,_0x985cb5){return client[_0xad8a('0x2')](_0xad8a('0x4'),{'body':_0x985cb5,'options':{'where':{'uniqueid':_0x226ac2},'order':[['id',_0xad8a('0x5')]],'limit':0x1},'log':_0xad8a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c741eb1..57b8f49 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 _0xdaf3=['../client','getIntervals','Request','Intervals','name','interval'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdaf3,0xde));var _0x3daf=function(_0x271d02,_0x5cd222){_0x271d02=_0x271d02-0x0;var _0x14112d=_0xdaf3[_0x271d02];return _0x14112d;};'use strict';var client=require(_0x3daf('0x0'));exports[_0x3daf('0x1')]=function(){return function(){return client[_0x3daf('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x3daf('0x3'),'attributes':['id',_0x3daf('0x4'),_0x3daf('0x5')]}]},'log':_0x3daf('0x1')});};}; \ No newline at end of file +var _0x80d6=['GetInterval','Interval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x1baa31,_0x2b81ca){var _0x54a137=function(_0x23ba2e){while(--_0x23ba2e){_0x1baa31['push'](_0x1baa31['shift']());}};_0x54a137(++_0x2b81ca);}(_0x80d6,0x155));var _0x680d=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x80d6[_0x3afe18];return _0x19ed1f;};'use strict';var client=require(_0x680d('0x0'));exports[_0x680d('0x1')]=function(){return function(){return client[_0x680d('0x2')](_0x680d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x680d('0x4'),'as':_0x680d('0x5'),'attributes':['id',_0x680d('0x6'),_0x680d('0x7')]}]},'log':_0x680d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index bd9d334..ee96c6c 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 _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x1a809c,_0x199a58){var _0x533174=function(_0x18e72e){while(--_0x18e72e){_0x1a809c['push'](_0x1a809c['shift']());}};_0x533174(++_0x199a58);}(_0x77e6,0x1a6));var _0x677e=function(_0x1e4ecb,_0x508c84){_0x1e4ecb=_0x1e4ecb-0x0;var _0x3a39db=_0x77e6[_0x1e4ecb];return _0x3a39db;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file +var _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x3d76a5,_0x13e0d3){var _0x676de0=function(_0x10f10e){while(--_0x10f10e){_0x3d76a5['push'](_0x3d76a5['shift']());}};_0x676de0(++_0x13e0d3);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x7c1603,_0x12809a){_0x7c1603=_0x7c1603-0x0;var _0x46b433=_0xcf2f[_0x7c1603];return _0x46b433;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ec17aa0..f69070e 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 _0xe5e1=['../client','create','Request','createMailMessage'];(function(_0x22c237,_0x44cab2){var _0x45a536=function(_0xff476c){while(--_0xff476c){_0x22c237['push'](_0x22c237['shift']());}};_0x45a536(++_0x44cab2);}(_0xe5e1,0x10c));var _0x1e5e=function(_0x2c1d7f,_0x4eba22){_0x2c1d7f=_0x2c1d7f-0x0;var _0x41a692=_0xe5e1[_0x2c1d7f];return _0x41a692;};'use strict';var client=require(_0x1e5e('0x0'));exports[_0x1e5e('0x1')]=function(_0x5dd3d1){return client[_0x1e5e('0x2')]('CreateMailMessage',{'body':_0x5dd3d1,'log':_0x1e5e('0x3')});}; \ No newline at end of file +var _0x125c=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x125c,0x153));var _0xc125=function(_0x2c2016,_0x5a8867){_0x2c2016=_0x2c2016-0x0;var _0x421631=_0x125c[_0x2c2016];return _0x421631;};'use strict';var client=require(_0xc125('0x0'));exports[_0xc125('0x1')]=function(_0x75e48a){return client[_0xc125('0x2')](_0xc125('0x3'),{'body':_0x75e48a,'log':_0xc125('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ed3ca10..d5c2fba 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 _0x2a99=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0xd6b5a,_0x1ae9ac){var _0x4e3d7e=function(_0x1a0558){while(--_0x1a0558){_0xd6b5a['push'](_0xd6b5a['shift']());}};_0x4e3d7e(++_0x1ae9ac);}(_0x2a99,0x66));var _0x92a9=function(_0x5d9295,_0x5f5bc6){_0x5d9295=_0x5d9295-0x0;var _0x4f2534=_0x2a99[_0x5d9295];return _0x4f2534;};'use strict';var client=require(_0x92a9('0x0'));exports[_0x92a9('0x1')]=function(){return function(){return client[_0x92a9('0x2')](_0x92a9('0x3'),{'options':{'raw':![],'attributes':['id',_0x92a9('0x4'),_0x92a9('0x5'),_0x92a9('0x6')],'include':[{'model':_0x92a9('0x7'),'as':'Agents','attributes':['id','name',_0x92a9('0x8'),_0x92a9('0x9')]}]},'log':_0x92a9('0x1')});};}; \ No newline at end of file +var _0xd874=['GetMailQueue','name','timeout','User','Agents','online','mailPause','../client','Request'];(function(_0x3c3684,_0x2f8823){var _0x1651ca=function(_0x29ec09){while(--_0x29ec09){_0x3c3684['push'](_0x3c3684['shift']());}};_0x1651ca(++_0x2f8823);}(_0xd874,0x7c));var _0x4d87=function(_0x301c34,_0x15701e){_0x301c34=_0x301c34-0x0;var _0x1a8c5a=_0xd874[_0x301c34];return _0x1a8c5a;};'use strict';var client=require(_0x4d87('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4d87('0x1')](_0x4d87('0x2'),{'options':{'raw':![],'attributes':['id',_0x4d87('0x3'),_0x4d87('0x4'),'strategy'],'include':[{'model':_0x4d87('0x5'),'as':_0x4d87('0x6'),'attributes':['id',_0x4d87('0x3'),_0x4d87('0x7'),_0x4d87('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 732ffbd..9ad0e51 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 _0x3ea6=['DESC','../client','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x43e9a3,_0x4c9568){var _0x311a9c=function(_0x3ce344){while(--_0x3ce344){_0x43e9a3['push'](_0x43e9a3['shift']());}};_0x311a9c(++_0x4c9568);}(_0x3ea6,0x163));var _0x63ea=function(_0x40d558,_0x42fbac){_0x40d558=_0x40d558-0x0;var _0x386205=_0x3ea6[_0x40d558];return _0x386205;};'use strict';var client=require(_0x63ea('0x0'));exports[_0x63ea('0x1')]=function(_0x566b58){return client[_0x63ea('0x2')](_0x63ea('0x3'),{'body':_0x566b58,'log':_0x63ea('0x3')});};exports['update']=function(_0x1d3031,_0xfd64){return client[_0x63ea('0x2')](_0x63ea('0x4'),{'body':_0xfd64,'options':{'where':{'uniqueid':_0x1d3031},'order':[['id',_0x63ea('0x5')]],'limit':0x1},'log':_0x63ea('0x4')});}; \ No newline at end of file +var _0x1953=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1953,0x12b));var _0x3195=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1953[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0x3195('0x0')]=function(_0x270310){return client[_0x3195('0x1')](_0x3195('0x2'),{'body':_0x270310,'log':_0x3195('0x2')});};exports[_0x3195('0x3')]=function(_0xda3368,_0xb10ac){return client[_0x3195('0x1')](_0x3195('0x4'),{'body':_0xb10ac,'options':{'where':{'uniqueid':_0xda3368},'order':[['id',_0x3195('0x5')]],'limit':0x1},'log':_0x3195('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c6311b1..1cf51eb 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 _0xc152=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xc152,0x1a2));var _0x2c15=function(_0x28255b,_0x250671){_0x28255b=_0x28255b-0x0;var _0x18f74b=_0xc152[_0x28255b];return _0x18f74b;};'use strict';var client=require(_0x2c15('0x0'));exports['update']=function(_0x26372c,_0xd94cee){return client[_0x2c15('0x1')](_0x2c15('0x2'),{'body':_0xd94cee,'options':{'where':{'id':_0x26372c}},'log':_0x2c15('0x3')});};exports['addTags']=function(_0x40e729,_0x119fbf){return client[_0x2c15('0x1')](_0x2c15('0x4'),{'body':_0x119fbf,'options':{'where':{'id':_0x40e729}},'log':_0x2c15('0x5')});}; \ No newline at end of file +var _0x209b=['AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x45996b,_0x145516){var _0x2defda=function(_0x346637){while(--_0x346637){_0x45996b['push'](_0x45996b['shift']());}};_0x2defda(++_0x145516);}(_0x209b,0xcc));var _0xb209=function(_0x1308ec,_0x32c99e){_0x1308ec=_0x1308ec-0x0;var _0x1a43c8=_0x209b[_0x1308ec];return _0x1a43c8;};'use strict';var client=require(_0xb209('0x0'));exports[_0xb209('0x1')]=function(_0x496e73,_0x316899){return client[_0xb209('0x2')](_0xb209('0x3'),{'body':_0x316899,'options':{'where':{'id':_0x496e73}},'log':_0xb209('0x4')});};exports[_0xb209('0x5')]=function(_0x26f7d3,_0x27f850){return client[_0xb209('0x2')](_0xb209('0x6'),{'body':_0x27f850,'options':{'where':{'id':_0x26f7d3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ebac92c..dd78b2f 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 _0x42d9=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x23095d,_0x39f73f){var _0x1e7114=function(_0x1466a0){while(--_0x1466a0){_0x23095d['push'](_0x23095d['shift']());}};_0x1e7114(++_0x39f73f);}(_0x42d9,0xa3));var _0x942d=function(_0x14bbdc,_0x49b365){_0x14bbdc=_0x14bbdc-0x0;var _0x5eac57=_0x42d9[_0x14bbdc];return _0x5eac57;};'use strict';var client=require(_0x942d('0x0'));exports[_0x942d('0x1')]=function(_0x46bf44){return client[_0x942d('0x2')](_0x942d('0x3'),{'body':_0x46bf44,'log':_0x942d('0x4')});}; \ No newline at end of file +var _0x1d21=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x271984,_0x4fb647){var _0x49feed=function(_0x4c1280){while(--_0x4c1280){_0x271984['push'](_0x271984['shift']());}};_0x49feed(++_0x4fb647);}(_0x1d21,0x159));var _0x11d2=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x1d21[_0x2ed7d1];return _0x38ae3c;};'use strict';var client=require(_0x11d2('0x0'));exports[_0x11d2('0x1')]=function(_0x385d58){return client[_0x11d2('0x2')](_0x11d2('0x3'),{'body':_0x385d58,'log':_0x11d2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 04640a9..fbbc74a 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 _0xb677=['GetOpenchannelQueue','name','timeout','strategy','User','openchannelPause','getOpenchannelQueues','../client','Request'];(function(_0x28d847,_0x435ad6){var _0xd11d90=function(_0x52f246){while(--_0x52f246){_0x28d847['push'](_0x28d847['shift']());}};_0xd11d90(++_0x435ad6);}(_0xb677,0x178));var _0x7b67=function(_0x49b3a5,_0x35208d){_0x49b3a5=_0x49b3a5-0x0;var _0x2e1cda=_0xb677[_0x49b3a5];return _0x2e1cda;};'use strict';var client=require(_0x7b67('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x7b67('0x1')](_0x7b67('0x2'),{'options':{'raw':![],'attributes':['id',_0x7b67('0x3'),_0x7b67('0x4'),_0x7b67('0x5')],'include':[{'model':_0x7b67('0x6'),'as':'Agents','attributes':['id',_0x7b67('0x3'),'online',_0x7b67('0x7')]}]},'log':_0x7b67('0x8')});};}; \ No newline at end of file +var _0x78ed=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online','openchannelPause'];(function(_0x7ee360,_0x30eb28){var _0x367230=function(_0x20be10){while(--_0x20be10){_0x7ee360['push'](_0x7ee360['shift']());}};_0x367230(++_0x30eb28);}(_0x78ed,0x104));var _0xd78e=function(_0x3d1e25,_0x251b4d){_0x3d1e25=_0x3d1e25-0x0;var _0x78b4d5=_0x78ed[_0x3d1e25];return _0x78b4d5;};'use strict';var client=require(_0xd78e('0x0'));exports[_0xd78e('0x1')]=function(){return function(){return client[_0xd78e('0x2')](_0xd78e('0x3'),{'options':{'raw':![],'attributes':['id',_0xd78e('0x4'),'timeout',_0xd78e('0x5')],'include':[{'model':_0xd78e('0x6'),'as':_0xd78e('0x7'),'attributes':['id',_0xd78e('0x4'),_0xd78e('0x8'),_0xd78e('0x9')]}]},'log':_0xd78e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 55d593d..25e3625 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 _0x608c=['update','UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x608c,0x1a1));var _0xc608=function(_0x4d8a8f,_0x2ae06d){_0x4d8a8f=_0x4d8a8f-0x0;var _0x5b7c07=_0x608c[_0x4d8a8f];return _0x5b7c07;};'use strict';var client=require(_0xc608('0x0'));exports['create']=function(_0x46863c){return client[_0xc608('0x1')](_0xc608('0x2'),{'body':_0x46863c,'log':_0xc608('0x2')});};exports[_0xc608('0x3')]=function(_0x2ff32e,_0x124682){return client[_0xc608('0x1')](_0xc608('0x4'),{'body':_0x124682,'options':{'where':{'uniqueid':_0x2ff32e},'order':[['id',_0xc608('0x5')]],'limit':0x1},'log':_0xc608('0x4')});}; \ No newline at end of file +var _0xe29a=['DESC','../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x592caf,_0x4d8027){var _0x56a352=function(_0x5c8e0a){while(--_0x5c8e0a){_0x592caf['push'](_0x592caf['shift']());}};_0x56a352(++_0x4d8027);}(_0xe29a,0x190));var _0xae29=function(_0x30de01,_0x6bedaa){_0x30de01=_0x30de01-0x0;var _0x52f38a=_0xe29a[_0x30de01];return _0x52f38a;};'use strict';var client=require(_0xae29('0x0'));exports[_0xae29('0x1')]=function(_0x42079b){return client['Request'](_0xae29('0x2'),{'body':_0x42079b,'log':_0xae29('0x2')});};exports[_0xae29('0x3')]=function(_0x339cf0,_0x3c6dfd){return client[_0xae29('0x4')](_0xae29('0x5'),{'body':_0x3c6dfd,'options':{'where':{'uniqueid':_0x339cf0},'order':[['id',_0xae29('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3d9499e..5ea941d 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 _0xd67b=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x53b585,_0x16e0cd){var _0x2e089a=function(_0x4baa7a){while(--_0x4baa7a){_0x53b585['push'](_0x53b585['shift']());}};_0x2e089a(++_0x16e0cd);}(_0xd67b,0x133));var _0xbd67=function(_0x469dc5,_0x5cda6d){_0x469dc5=_0x469dc5-0x0;var _0x55bccf=_0xd67b[_0x469dc5];return _0x55bccf;};'use strict';var client=require('../client');exports[_0xbd67('0x0')]=function(_0x5adb01,_0x1da24d){return client[_0xbd67('0x1')](_0xbd67('0x2'),{'body':_0x1da24d,'options':{'where':{'id':_0x5adb01}},'log':'updateSmsInteraction'});};exports[_0xbd67('0x3')]=function(_0x50da5a,_0x1bf96){return client['Request'](_0xbd67('0x4'),{'body':_0x1bf96,'options':{'where':{'id':_0x50da5a}},'log':_0xbd67('0x5')});}; \ No newline at end of file +var _0x899a=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x899a,0x1b6));var _0xa899=function(_0x970bb3,_0x351f2e){_0x970bb3=_0x970bb3-0x0;var _0x1bf393=_0x899a[_0x970bb3];return _0x1bf393;};'use strict';var client=require(_0xa899('0x0'));exports[_0xa899('0x1')]=function(_0x4f77af,_0x26e9a7){return client[_0xa899('0x2')]('UpdateSmsInteraction',{'body':_0x26e9a7,'options':{'where':{'id':_0x4f77af}},'log':_0xa899('0x3')});};exports[_0xa899('0x4')]=function(_0x1c5c93,_0x223383){return client['Request'](_0xa899('0x5'),{'body':_0x223383,'options':{'where':{'id':_0x1c5c93}},'log':_0xa899('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 5be3c3f..5d53ef7 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 _0xc71d=['createSmsMessage','../client','Request','CreateSmsMessage'];(function(_0x36864a,_0xf4aa03){var _0x434e00=function(_0x5b06ec){while(--_0x5b06ec){_0x36864a['push'](_0x36864a['shift']());}};_0x434e00(++_0xf4aa03);}(_0xc71d,0x71));var _0xdc71=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xc71d[_0xbf8ebe];return _0x1e25e8;};'use strict';var client=require(_0xdc71('0x0'));exports['create']=function(_0xcd5713){return client[_0xdc71('0x1')](_0xdc71('0x2'),{'body':_0xcd5713,'log':_0xdc71('0x3')});}; \ No newline at end of file +var _0x1ac2=['Request','createSmsMessage','create'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1ac2,0x6b));var _0x21ac=function(_0x105e3a,_0x5efd23){_0x105e3a=_0x105e3a-0x0;var _0x4b2a41=_0x1ac2[_0x105e3a];return _0x4b2a41;};'use strict';var client=require('../client');exports[_0x21ac('0x0')]=function(_0x63933a){return client[_0x21ac('0x1')]('CreateSmsMessage',{'body':_0x63933a,'log':_0x21ac('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 48ff44b..e8b73e3 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_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 +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x39da91,_0x1b0145){var _0x14320c=function(_0x120894){while(--_0x120894){_0x39da91['push'](_0x39da91['shift']());}};_0x14320c(++_0x1b0145);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6e94ba8..7e2b0f0 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x16a33b,_0x1e7f53){var _0x4d2277=function(_0x356977){while(--_0x356977){_0x16a33b['push'](_0x16a33b['shift']());}};_0x4d2277(++_0x1e7f53);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x253283,_0x65500b){var _0x3f4d3d=function(_0x441fe3){while(--_0x441fe3){_0x253283['push'](_0x253283['shift']());}};_0x3f4d3d(++_0x65500b);}(_0x55ca,0x126));var _0xa55c=function(_0x331298,_0x12341a){_0x331298=_0x331298-0x0;var _0x3824bc=_0x55ca[_0x331298];return _0x3824bc;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 318462f..5f78e1d 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(_0x366223,_0x495c81){var _0x345d9d=function(_0x449412){while(--_0x449412){_0x366223['push'](_0x366223['shift']());}};_0x345d9d(++_0x495c81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x550937,_0x20e57d){var _0x3b33b7=function(_0x2e2829){while(--_0x2e2829){_0x550937['push'](_0x550937['shift']());}};_0x3b33b7(++_0x20e57d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 1d1036c..545289a 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 _0xafc4=['../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x52fd3d,_0x3af718){var _0x49b06d=function(_0x2f4a2b){while(--_0x2f4a2b){_0x52fd3d['push'](_0x52fd3d['shift']());}};_0x49b06d(++_0x3af718);}(_0xafc4,0x69));var _0x4afc=function(_0xdda87b,_0x119b64){_0xdda87b=_0xdda87b-0x0;var _0x5869f6=_0xafc4[_0xdda87b];return _0x5869f6;};'use strict';var client=require(_0x4afc('0x0'));exports['update']=function(_0x2604d4,_0x52e4dd){return client[_0x4afc('0x1')](_0x4afc('0x2'),{'body':_0x52e4dd,'options':{'where':{'id':_0x2604d4}},'log':_0x4afc('0x3')});};exports[_0x4afc('0x4')]=function(_0x4d9dbd,_0x49f417){return client['Request'](_0x4afc('0x5'),{'body':_0x49f417,'options':{'where':{'id':_0x4d9dbd}},'log':_0x4afc('0x6')});}; \ No newline at end of file +var _0x0650=['AddTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','addTags'];(function(_0x523244,_0x11d2ae){var _0x1f6b7b=function(_0xfd4016){while(--_0xfd4016){_0x523244['push'](_0x523244['shift']());}};_0x1f6b7b(++_0x11d2ae);}(_0x0650,0xed));var _0x0065=function(_0x59c2cb,_0x671ebb){_0x59c2cb=_0x59c2cb-0x0;var _0x4d2910=_0x0650[_0x59c2cb];return _0x4d2910;};'use strict';var client=require(_0x0065('0x0'));exports['update']=function(_0x3fbf43,_0x42d2cd){return client['Request'](_0x0065('0x1'),{'body':_0x42d2cd,'options':{'where':{'id':_0x3fbf43}},'log':'updateWhatsappInteraction'});};exports[_0x0065('0x2')]=function(_0x8260ba,_0x3dd8c6){return client['Request'](_0x0065('0x3'),{'body':_0x3dd8c6,'options':{'where':{'id':_0x8260ba}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 60f9301..5133fa5 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 _0x5630=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x1a1800,_0x335b5c){var _0x37eb69=function(_0x17c34a){while(--_0x17c34a){_0x1a1800['push'](_0x1a1800['shift']());}};_0x37eb69(++_0x335b5c);}(_0x5630,0x180));var _0x0563=function(_0x278ca9,_0xec9761){_0x278ca9=_0x278ca9-0x0;var _0x5e591e=_0x5630[_0x278ca9];return _0x5e591e;};'use strict';var client=require(_0x0563('0x0'));exports['create']=function(_0xccd141){return client[_0x0563('0x1')](_0x0563('0x2'),{'body':_0xccd141,'log':_0x0563('0x3')});}; \ No newline at end of file +var _0xf6f0=['../client','create','Request','createWhatsappMessage'];(function(_0x275bbc,_0x6cde86){var _0x2316fa=function(_0x3bcbea){while(--_0x3bcbea){_0x275bbc['push'](_0x275bbc['shift']());}};_0x2316fa(++_0x6cde86);}(_0xf6f0,0x1c4));var _0x0f6f=function(_0x3e5e03,_0x2fac27){_0x3e5e03=_0x3e5e03-0x0;var _0x45279e=_0xf6f0[_0x3e5e03];return _0x45279e;};'use strict';var client=require(_0x0f6f('0x0'));exports[_0x0f6f('0x1')]=function(_0x2204c1){return client[_0x0f6f('0x2')]('CreateWhatsappMessage',{'body':_0x2204c1,'log':_0x0f6f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 97d2cd4..bb73dca 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 _0x1b12=['online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','timeout','strategy','User','Agents','name'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1b12,0x66));var _0x21b1=function(_0xed6d60,_0x522f96){_0xed6d60=_0xed6d60-0x0;var _0x278982=_0x1b12[_0xed6d60];return _0x278982;};'use strict';var client=require(_0x21b1('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x21b1('0x1')](_0x21b1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x21b1('0x3'),_0x21b1('0x4')],'include':[{'model':_0x21b1('0x5'),'as':_0x21b1('0x6'),'attributes':['id',_0x21b1('0x7'),_0x21b1('0x8'),_0x21b1('0x9')]}]},'log':_0x21b1('0xa')});};}; \ No newline at end of file +var _0x76e4=['online','whatsappPause','../client','getWhatsappQueues','timeout','strategy','User','Agents','name'];(function(_0x57a84c,_0x36d73d){var _0x2e0d2d=function(_0x7d225a){while(--_0x7d225a){_0x57a84c['push'](_0x57a84c['shift']());}};_0x2e0d2d(++_0x36d73d);}(_0x76e4,0x65));var _0x476e=function(_0x103fbf,_0x3c850e){_0x103fbf=_0x103fbf-0x0;var _0x3abace=_0x76e4[_0x103fbf];return _0x3abace;};'use strict';var client=require(_0x476e('0x0'));exports[_0x476e('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x476e('0x2'),_0x476e('0x3')],'include':[{'model':_0x476e('0x4'),'as':_0x476e('0x5'),'attributes':['id',_0x476e('0x6'),_0x476e('0x7'),_0x476e('0x8')]}]},'log':_0x476e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index e752f1c..ff1c6fa 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 _0xb841=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x5e343c,_0x5d5c6a){var _0x497243=function(_0x49bcda){while(--_0x49bcda){_0x5e343c['push'](_0x5e343c['shift']());}};_0x497243(++_0x5d5c6a);}(_0xb841,0xc8));var _0x1b84=function(_0x4b7d4,_0x541242){_0x4b7d4=_0x4b7d4-0x0;var _0x348639=_0xb841[_0x4b7d4];return _0x348639;};'use strict';var client=require(_0x1b84('0x0'));exports[_0x1b84('0x1')]=function(_0x1f3dbb){return client[_0x1b84('0x2')](_0x1b84('0x3'),{'body':_0x1f3dbb,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x47c921,_0x7c5522){return client[_0x1b84('0x2')](_0x1b84('0x4'),{'body':_0x7c5522,'options':{'where':{'uniqueid':_0x47c921},'order':[['id',_0x1b84('0x5')]],'limit':0x1},'log':_0x1b84('0x4')});}; \ No newline at end of file +var _0x9642=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x10a8d2,_0x205dc1){var _0x402a1e=function(_0xbf2b36){while(--_0xbf2b36){_0x10a8d2['push'](_0x10a8d2['shift']());}};_0x402a1e(++_0x205dc1);}(_0x9642,0xdf));var _0x2964=function(_0x54b915,_0x312b14){_0x54b915=_0x54b915-0x0;var _0x5c841f=_0x9642[_0x54b915];return _0x5c841f;};'use strict';var client=require(_0x2964('0x0'));exports[_0x2964('0x1')]=function(_0x4852dc){return client[_0x2964('0x2')](_0x2964('0x3'),{'body':_0x4852dc,'log':_0x2964('0x3')});};exports[_0x2964('0x4')]=function(_0x38e662,_0x465845){return client[_0x2964('0x2')](_0x2964('0x5'),{'body':_0x465845,'options':{'where':{'uniqueid':_0x38e662},'order':[['id',_0x2964('0x6')]],'limit':0x1},'log':_0x2964('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 3892e0b..f8b1a42 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 _0x0157=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','channel','format','START:%s','rules','end','close','complete','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0157,0xf9));var _0x7015=function(_0x4ee754,_0x503c21){_0x4ee754=_0x4ee754-0x0;var _0x61d356=_0x0157[_0x4ee754];return _0x61d356;};'use strict';var schema=require(_0x7015('0x0'));var _=require('lodash');var util=require(_0x7015('0x1'));var seqqueue=require(_0x7015('0x2'));var logger=require(_0x7015('0x3'))(_0x7015('0x4'));var strategy=require(_0x7015('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x7015('0x6')},'timeout':{'type':_0x7015('0x7'),'message':_0x7015('0x8')}});function writeLog(_0x43ec94,_0x353feb,_0x4ae854){return logger[_0x7015('0x9')](util['format'](_0x7015('0xa'),_0x43ec94,_0x353feb[_0x7015('0xb')],_0x4ae854));}function handleFindAgent(_0x46db77){return function(_0xa30935){return _0xa30935[_0x7015('0xb')][_0x7015('0xc')]()===_0x46db77[_0x7015('0xc')]();};}exports[_0x7015('0xd')]=function(_0xf304c0,_0x2e55b4,_0x4cb5f5,_0x3bdbb8){return function(_0x610f48){try{var _0x31c849={'name':_0x2e55b4[0x0],'timeout':_0x2e55b4[0x1]};var _0x5a817e=queue['validate'](_0x31c849,{'typecast':!![]});if(_0x5a817e[_0x7015('0xe')]){logger['error'](_0x7015('0xf'),_0xf304c0,_[_0x7015('0x10')](_0x5a817e,_0x7015('0x11'))[_0x7015('0x12')](',\x20'));_0x610f48[_0x7015('0x13')]();}else{var _0x159f28=_[_0x7015('0x14')](_0x4cb5f5['agents'],handleFindAgent(_0x31c849[_0x7015('0xb')]));if(_0x159f28){var _0x218b49=(_0x31c849[_0x7015('0x15')]||0xa)*0x3e8;var _0x39dcc1,_0x24e740;var _0xa0a339=seqqueue[_0x7015('0x16')](_0x218b49);_0xa0a339['id']=_0xf304c0;_0xa0a339['atimeout']=_0x218b49;_0xa0a339[_0x7015('0x17')]=_0x3bdbb8[_0x7015('0x17')];writeLog(_0xf304c0,_0x159f28,util[_0x7015('0x18')](_0x7015('0x19'),_0x218b49));_0x4cb5f5[_0x7015('0x1a')][_0xf304c0]['on'](_0x7015('0x1b'),function(){logger[_0x7015('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xf304c0);clearTimeout(_0x24e740);_0x24e740=undefined;_0xa0a339[_0x7015('0x1c')]();if(_0x4cb5f5['rules'][_0xf304c0]){delete _0x4cb5f5[_0x7015('0x1a')][_0xf304c0];}_0x610f48[_0x7015('0x13')]();});_0x4cb5f5[_0x7015('0x1a')][_0xf304c0]['on'](_0x7015('0x1d'),function(){if(_0x4cb5f5[_0x7015('0x1a')][_0xf304c0]){delete _0x4cb5f5[_0x7015('0x1a')][_0xf304c0];}});_0x24e740=setTimeout(function(){logger[_0x7015('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0xf304c0);clearTimeout(_0x24e740);_0xa0a339[_0x7015('0x1c')]();_0x610f48['next']();},_0x218b49);strategy['agent'](_0xa0a339,_0x159f28,_0x4cb5f5,_0x3bdbb8);}else{logger[_0x7015('0x1e')](_0x7015('0x1f'),_0xf304c0,_0x31c849[_0x7015('0xb')]);_0x610f48[_0x7015('0x13')]();}}}catch(_0x54c2d7){console[_0x7015('0x20')](_0x54c2d7);logger['error'](_0x7015('0x21'),_0xf304c0,_0x54c2d7[_0x7015('0x22')]);_0x610f48[_0x7015('0x13')]();}};}; \ No newline at end of file +var _0xb614=['lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','map','message','join','stop','find','createQueue','atimeout','channel','START:%s','rules','end','info','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb614,0x6c));var _0x4b61=function(_0xdf2ece,_0x4a570f){_0xdf2ece=_0xdf2ece-0x0;var _0x2f2b43=_0xb614[_0xdf2ece];return _0x2f2b43;};'use strict';var schema=require('validate');var _=require(_0x4b61('0x0'));var util=require('util');var seqqueue=require(_0x4b61('0x1'));var logger=require('../../../../config/logger')(_0x4b61('0x2'));var strategy=require(_0x4b61('0x3'));var queue=schema({'name':{'type':_0x4b61('0x4'),'required':!![],'message':_0x4b61('0x5')},'timeout':{'type':_0x4b61('0x6'),'message':_0x4b61('0x7')}});function writeLog(_0x1ea620,_0xbb06ee,_0x1c0735){return logger['info'](util[_0x4b61('0x8')](_0x4b61('0x9'),_0x1ea620,_0xbb06ee[_0x4b61('0xa')],_0x1c0735));}function handleFindAgent(_0x346f9a){return function(_0x4500ca){return _0x4500ca[_0x4b61('0xa')][_0x4b61('0xb')]()===_0x346f9a[_0x4b61('0xb')]();};}exports[_0x4b61('0xc')]=function(_0x2e927f,_0x31460f,_0x9fd60c,_0x2632b0){return function(_0x301b2d){try{var _0x3c87ff={'name':_0x31460f[0x0],'timeout':_0x31460f[0x1]};var _0x47ed91=queue[_0x4b61('0xd')](_0x3c87ff,{'typecast':!![]});if(_0x47ed91['length']){logger[_0x4b61('0xe')]('[%s][AGENT]\x20%s',_0x2e927f,_[_0x4b61('0xf')](_0x47ed91,_0x4b61('0x10'))[_0x4b61('0x11')](',\x20'));_0x301b2d[_0x4b61('0x12')]();}else{var _0x3ca27f=_[_0x4b61('0x13')](_0x9fd60c['agents'],handleFindAgent(_0x3c87ff[_0x4b61('0xa')]));if(_0x3ca27f){var _0x29f23=(_0x3c87ff['timeout']||0xa)*0x3e8;var _0xf47fe2,_0x45117b;var _0x44528c=seqqueue[_0x4b61('0x14')](_0x29f23);_0x44528c['id']=_0x2e927f;_0x44528c[_0x4b61('0x15')]=_0x29f23;_0x44528c[_0x4b61('0x16')]=_0x2632b0[_0x4b61('0x16')];writeLog(_0x2e927f,_0x3ca27f,util[_0x4b61('0x8')](_0x4b61('0x17'),_0x29f23));_0x9fd60c[_0x4b61('0x18')][_0x2e927f]['on'](_0x4b61('0x19'),function(){logger[_0x4b61('0x1a')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2e927f);clearTimeout(_0x45117b);_0x45117b=undefined;_0x44528c[_0x4b61('0x1b')]();if(_0x9fd60c[_0x4b61('0x18')][_0x2e927f]){delete _0x9fd60c[_0x4b61('0x18')][_0x2e927f];}_0x301b2d[_0x4b61('0x12')]();});_0x9fd60c['rules'][_0x2e927f]['on'](_0x4b61('0x1c'),function(){if(_0x9fd60c[_0x4b61('0x18')][_0x2e927f]){delete _0x9fd60c['rules'][_0x2e927f];}});_0x45117b=setTimeout(function(){logger[_0x4b61('0x1a')](_0x4b61('0x1d'),_0x2e927f);clearTimeout(_0x45117b);_0x44528c[_0x4b61('0x1b')]();_0x301b2d[_0x4b61('0x1e')]();},_0x29f23);strategy[_0x4b61('0x1f')](_0x44528c,_0x3ca27f,_0x9fd60c,_0x2632b0);}else{logger[_0x4b61('0xe')](_0x4b61('0x20'),_0x2e927f,_0x3c87ff[_0x4b61('0xa')]);_0x301b2d[_0x4b61('0x12')]();}}}catch(_0x4c25c3){console[_0x4b61('0x21')](_0x4c25c3);logger['error'](_0x4b61('0x22'),_0x2e927f,_0x4c25c3[_0x4b61('0x23')]);_0x301b2d[_0x4b61('0x12')]();}};}; \ 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 ae26764..af0e6b3 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 _0x6a7b=['body','create','info','catch','[%s][AMAZONLEX]\x20%s','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','toString','postText','error','message','amazonlex','providerName','providerResponse','Message','then','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty'];(function(_0x2d6b2a,_0x3e1695){var _0x5612b3=function(_0x1cfebc){while(--_0x1cfebc){_0x2d6b2a['push'](_0x2d6b2a['shift']());}};_0x5612b3(++_0x3e1695);}(_0x6a7b,0x1ba));var _0xb6a7=function(_0x539491,_0x1755c6){_0x539491=_0x539491-0x0;var _0x4b0930=_0x6a7b[_0x539491];return _0x4b0930;};'use strict';var _=require('lodash');var moment=require(_0xb6a7('0x0'));var AWS=require(_0xb6a7('0x1'));var utils=require(_0xb6a7('0x2'));var logger=require(_0xb6a7('0x3'))(_0xb6a7('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb6a7('0x5')),'smsMessage':require(_0xb6a7('0x6')),'faxMessage':require(_0xb6a7('0x7')),'whatsappMessage':require(_0xb6a7('0x8'))};exports[_0xb6a7('0x9')]=function(_0x15a074,_0x4b3061){return function(_0x4accf2){try{if(!_[_0xb6a7('0xa')](this[_0xb6a7('0xb')][_0xb6a7('0xc')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x15a074,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4accf2[_0xb6a7('0xd')]();}var _0x468fc9={'ContactId':this[_0xb6a7('0xe')]['id'],'sentAt':moment()[_0xb6a7('0xf')](_0xb6a7('0x10')),'direction':_0xb6a7('0x11')};if(this[_0xb6a7('0x12')]===_0xb6a7('0x13')||this['channel']==='whatsapp'){_0x468fc9['phone']=this[_0xb6a7('0xb')][_0xb6a7('0x14')];}var _0x39747e=this['channel'];if(_0x39747e===_0xb6a7('0x15')){_0x468fc9[_0xb6a7('0x16')]=this[_0xb6a7('0x17')]['id'];}else{_0x468fc9[_[_0xb6a7('0x18')](_0x39747e)+_0xb6a7('0x19')]=this[_0xb6a7('0x17')]['id'];}_0x468fc9[_[_0xb6a7('0x18')](_0x39747e)+'InteractionId']=this[_0xb6a7('0xb')]['id'];if(this[_0xb6a7('0xb')][_0xb6a7('0x1a')]){var _0x3358db=_0x4b3061[0x4];if(!_[_0xb6a7('0x1b')](_0x3358db)){_0x468fc9[_0xb6a7('0x1c')]=utils['getMustacheRender'](_0x3358db,this);return rpc[_0x39747e+'Message'][_0xb6a7('0x1d')](_0x468fc9)['then'](function(_0x8937a3){logger[_0xb6a7('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x15a074,_0x468fc9['body']);})[_0xb6a7('0x1f')](function(_0x523663){logger['error'](_0xb6a7('0x20'),_0x15a074,JSON[_0xb6a7('0x21')](_0x523663));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x15a074);_0x4accf2['stop']();});}else{logger[_0xb6a7('0x1e')](_0xb6a7('0x22'),_0x15a074);_0x4accf2[_0xb6a7('0x23')]();}}else{var _0x74470=this;var _0x596f35=new AWS['LexRuntime']({'accessKeyId':_0x4b3061[0x0],'secretAccessKey':_0x4b3061[0x1],'region':_0x4b3061[0x2]});var _0x5f5820={'botAlias':'$LATEST','botName':_0x4b3061[0x3],'inputText':this['message']['body'],'userId':this[_0xb6a7('0x12')]+':'+this[_0xb6a7('0xb')]['id'][_0xb6a7('0x24')]()};_0x596f35[_0xb6a7('0x25')](_0x5f5820,function(_0x2753fc,_0x221df9){if(_0x2753fc){logger[_0xb6a7('0x26')](_0xb6a7('0x20'),_0x15a074,_0x2753fc['message']);_0x4accf2[_0xb6a7('0xd')]();}else if(_0x221df9&&_0x221df9[_0xb6a7('0x27')]){_0x74470['body'][_0xb6a7('0x28')]=_0x221df9;_0x468fc9[_0xb6a7('0x1c')]=_0x221df9[_0xb6a7('0x27')];_0x468fc9[_0xb6a7('0x29')]=_0xb6a7('0x28');_0x468fc9[_0xb6a7('0x2a')]=JSON['stringify'](_0x221df9);return rpc[_0x39747e+_0xb6a7('0x2b')][_0xb6a7('0x1d')](_0x468fc9)[_0xb6a7('0x2c')](function(_0x38a1ab){logger[_0xb6a7('0x1e')](_0xb6a7('0x20'),_0x15a074,_0x468fc9[_0xb6a7('0x1c')]);if(_0x221df9[_0xb6a7('0x2d')]==_0xb6a7('0x2e')){_0x4accf2['next']();}else{_0x4accf2[_0xb6a7('0x23')]();}})['catch'](function(_0x451152){logger[_0xb6a7('0x26')](_0xb6a7('0x20'),_0x15a074,JSON[_0xb6a7('0x21')](_0x451152));_0x4accf2['next']();});}else{_0x4accf2[_0xb6a7('0xd')]();}});}}catch(_0xceb18b){logger[_0xb6a7('0x26')]('[%s][AMAZONLEX]\x20%s',_0x15a074,JSON[_0xb6a7('0x21')](_0xceb18b));_0x4accf2[_0xb6a7('0x23')]();}};}; \ No newline at end of file +var _0xab16=['account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','catch','[%s][AMAZONLEX]\x20%s','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','postText','error','message','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xab16,0x10a));var _0x6ab1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab16[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6ab1('0x0'));var moment=require('moment');var AWS=require(_0x6ab1('0x1'));var utils=require(_0x6ab1('0x2'));var logger=require(_0x6ab1('0x3'))(_0x6ab1('0x4'));var rpc={'chatMessage':require(_0x6ab1('0x5')),'openchannelMessage':require(_0x6ab1('0x6')),'mailMessage':require(_0x6ab1('0x7')),'smsMessage':require(_0x6ab1('0x8')),'faxMessage':require(_0x6ab1('0x9')),'whatsappMessage':require(_0x6ab1('0xa'))};exports['consequence']=function(_0x3ae1e1,_0x4c9199){return function(_0xaf6af){try{if(!_['isNil'](this[_0x6ab1('0xb')][_0x6ab1('0xc')])){logger[_0x6ab1('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3ae1e1,_0x6ab1('0xe'));return _0xaf6af[_0x6ab1('0xf')]();}var _0x29b920={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6ab1('0x10')](_0x6ab1('0x11')),'direction':_0x6ab1('0x12')};if(this[_0x6ab1('0x13')]==='sms'||this[_0x6ab1('0x13')]==='whatsapp'){_0x29b920[_0x6ab1('0x14')]=this[_0x6ab1('0xb')][_0x6ab1('0x14')];}var _0x57d068=this[_0x6ab1('0x13')];if(_0x57d068===_0x6ab1('0x15')){_0x29b920['ChatWebsiteId']=this[_0x6ab1('0x16')]['id'];}else{_0x29b920[_['upperFirst'](_0x57d068)+_0x6ab1('0x17')]=this[_0x6ab1('0x16')]['id'];}_0x29b920[_[_0x6ab1('0x18')](_0x57d068)+_0x6ab1('0x19')]=this['interaction']['id'];if(this['interaction'][_0x6ab1('0x1a')]){var _0x13e7fe=_0x4c9199[0x4];if(!_['isEmpty'](_0x13e7fe)){_0x29b920[_0x6ab1('0x1b')]=utils[_0x6ab1('0x1c')](_0x13e7fe,this);return rpc[_0x57d068+_0x6ab1('0x1d')][_0x6ab1('0x1e')](_0x29b920)[_0x6ab1('0x1f')](function(_0x176965){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3ae1e1,_0x29b920['body']);})[_0x6ab1('0x20')](function(_0x172093){logger['error'](_0x6ab1('0x21'),_0x3ae1e1,JSON['stringify'](_0x172093));})['finally'](function(){logger[_0x6ab1('0xd')](_0x6ab1('0x22'),_0x3ae1e1);_0xaf6af[_0x6ab1('0x23')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3ae1e1);_0xaf6af[_0x6ab1('0x23')]();}}else{var _0x31044a=this;var _0x1ab7b6=new AWS[(_0x6ab1('0x24'))]({'accessKeyId':_0x4c9199[0x0],'secretAccessKey':_0x4c9199[0x1],'region':_0x4c9199[0x2]});var _0x237f6b={'botAlias':_0x6ab1('0x25'),'botName':_0x4c9199[0x3],'inputText':this['message'][_0x6ab1('0x1b')],'userId':this[_0x6ab1('0x13')]+':'+this['interaction']['id'][_0x6ab1('0x26')]()};_0x1ab7b6[_0x6ab1('0x27')](_0x237f6b,function(_0x1866da,_0x4eef6f){if(_0x1866da){logger[_0x6ab1('0x28')](_0x6ab1('0x21'),_0x3ae1e1,_0x1866da['message']);_0xaf6af[_0x6ab1('0xf')]();}else if(_0x4eef6f&&_0x4eef6f[_0x6ab1('0x29')]){_0x31044a[_0x6ab1('0x1b')][_0x6ab1('0x2a')]=_0x4eef6f;_0x29b920['body']=_0x4eef6f['message'];_0x29b920[_0x6ab1('0x2b')]=_0x6ab1('0x2a');_0x29b920[_0x6ab1('0x2c')]=JSON[_0x6ab1('0x2d')](_0x4eef6f);return rpc[_0x57d068+_0x6ab1('0x1d')][_0x6ab1('0x1e')](_0x29b920)[_0x6ab1('0x1f')](function(_0x11f1b4){logger[_0x6ab1('0xd')](_0x6ab1('0x21'),_0x3ae1e1,_0x29b920[_0x6ab1('0x1b')]);if(_0x4eef6f[_0x6ab1('0x2e')]==_0x6ab1('0x2f')){_0xaf6af[_0x6ab1('0xf')]();}else{_0xaf6af[_0x6ab1('0x23')]();}})[_0x6ab1('0x20')](function(_0x368506){logger[_0x6ab1('0x28')]('[%s][AMAZONLEX]\x20%s',_0x3ae1e1,JSON[_0x6ab1('0x2d')](_0x368506));_0xaf6af['next']();});}else{_0xaf6af['next']();}});}}catch(_0x410294){logger['error'](_0x6ab1('0x21'),_0x3ae1e1,JSON[_0x6ab1('0x2d')](_0x410294));_0xaf6af[_0x6ab1('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 6ad6e94..1538bac 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 _0x1d26=['update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','autoreplyExecuted','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','interaction','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','AccountId','account','upperFirst','Message','inReplyTo','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','messageId','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction'];(function(_0xd715ff,_0xf59490){var _0x165ef3=function(_0x32b3ef){while(--_0x32b3ef){_0xd715ff['push'](_0xd715ff['shift']());}};_0x165ef3(++_0xf59490);}(_0x1d26,0x153));var _0x61d2=function(_0x48d122,_0x4bcd20){_0x48d122=_0x48d122-0x0;var _0x36e303=_0x1d26[_0x48d122];return _0x36e303;};'use strict';var _=require(_0x61d2('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0x61d2('0x1'))(_0x61d2('0x2'));var rpc={'chatMessage':require(_0x61d2('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x61d2('0x4')),'smsMessage':require(_0x61d2('0x5')),'faxMessage':require(_0x61d2('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x61d2('0x7')),'openchannelInteraction':require(_0x61d2('0x8')),'mailInteraction':require(_0x61d2('0x9')),'smsInteraction':require(_0x61d2('0xa')),'faxInteraction':require(_0x61d2('0xb')),'whatsappInteraction':require(_0x61d2('0xc'))};var mailRpc=require(_0x61d2('0xd'));exports[_0x61d2('0xe')]=function(_0x5d218e,_0x4255ac,_0x2fc11c,_0x5a19a7){return function(_0xff900a){try{var _0x39a213=this[_0x61d2('0xf')];if(_0x39a213===_0x61d2('0x10')&&_0x5a19a7['body']['isAutoreply']){logger[_0x61d2('0x11')](_0x61d2('0x12'),_0x5d218e,_0x61d2('0x13'));return _0xff900a[_0x61d2('0x14')]();}if(_0x4255ac[0x0]==='1'&&(_['isNil'](this['interaction'][_0x61d2('0x15')])||!this[_0x61d2('0x16')][_0x61d2('0x15')])){logger[_0x61d2('0x11')](_0x61d2('0x12'),_0x5d218e,_0x61d2('0x17'));return _0xff900a[_0x61d2('0x14')]();}if(_0x4255ac[0x0]==='2'&&this[_0x61d2('0x16')]['autoreplyExecuted']){logger[_0x61d2('0x11')](_0x61d2('0x18'),_0x5d218e,_0x61d2('0x19'));return _0xff900a[_0x61d2('0x14')]();}var _0x78bcd3={'ContactId':this[_0x61d2('0x1a')]['id'],'sentAt':moment()[_0x61d2('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x61d2('0x1c')};if(this[_0x61d2('0xf')]===_0x61d2('0x10')){_0x78bcd3[_0x61d2('0x1d')]=utils['getMustacheRender'](_0x4255ac[0x2],this);}else{_0x78bcd3[_0x61d2('0x1d')]=utils[_0x61d2('0x1e')](_0x4255ac[0x1],this);}if(this[_0x61d2('0x1f')]){_0x78bcd3['to']=this[_0x61d2('0x1f')][_0x61d2('0x20')]||'';if(this['channel']===_0x61d2('0x10')&&_0x4255ac[0x1]==='1'){_0x78bcd3['cc']=this[_0x61d2('0x1f')]['cc']||'';}_0x78bcd3['from']=this[_0x61d2('0x1f')]['to']||'';_0x78bcd3[_0x61d2('0x21')]=this[_0x61d2('0x1f')][_0x61d2('0x21')]||'';_0x78bcd3[_0x61d2('0x22')]=!![];if(this[_0x61d2('0x1f')][_0x61d2('0x23')]){_0x78bcd3['subject']='';_0x78bcd3[_0x61d2('0x23')]+=_[_0x61d2('0x24')](this[_0x61d2('0x1f')][_0x61d2('0x23')],_0x61d2('0x25'))?'':'Re:\x20';_0x78bcd3[_0x61d2('0x23')]+=this[_0x61d2('0x1f')][_0x61d2('0x23')];}}if(this[_0x61d2('0xf')]===_0x61d2('0x26')){_0x78bcd3['ChatWebsiteId']=this['account']['id'];}else{_0x78bcd3[_['upperFirst'](this[_0x61d2('0xf')])+_0x61d2('0x27')]=this[_0x61d2('0x28')]['id'];}_0x78bcd3[_[_0x61d2('0x29')](this[_0x61d2('0xf')])+'InteractionId']=this[_0x61d2('0x16')]['id'];var _0xd573ec=this['interaction'];if(rpc[this[_0x61d2('0xf')]+_0x61d2('0x2a')]){if(this[_0x61d2('0xf')]===_0x61d2('0x10')){_0x78bcd3[_0x61d2('0x2b')]=this[_0x61d2('0x1f')]['messageId'];_0x78bcd3[_0x61d2('0x2c')]=''+_[_0x61d2('0x2d')](_0x78bcd3['body'],'','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','finally','Interaction','catch','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply'];(function(_0x1b3a83,_0x1757e8){var _0x18fc40=function(_0x212200){while(--_0x212200){_0x1b3a83['push'](_0x1b3a83['shift']());}};_0x18fc40(++_0x1757e8);}(_0x5952,0x1d6));var _0x2595=function(_0xae5291,_0x23afcc){_0xae5291=_0xae5291-0x0;var _0x193555=_0x5952[_0xae5291];return _0x193555;};'use strict';var _=require(_0x2595('0x0'));var moment=require(_0x2595('0x1'));var utils=require(_0x2595('0x2'));var logger=require(_0x2595('0x3'))(_0x2595('0x4'));var rpc={'chatMessage':require(_0x2595('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2595('0x6')),'smsMessage':require(_0x2595('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2595('0x8')),'chatInteraction':require(_0x2595('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x2595('0xa')),'smsInteraction':require(_0x2595('0xb')),'faxInteraction':require(_0x2595('0xc')),'whatsappInteraction':require(_0x2595('0xd'))};var mailRpc=require(_0x2595('0xe'));exports[_0x2595('0xf')]=function(_0x557dc5,_0x54e32a,_0x346792,_0x527956){return function(_0x21652d){try{var _0x57efdb=this[_0x2595('0x10')];if(_0x57efdb===_0x2595('0x11')&&_0x527956[_0x2595('0x12')][_0x2595('0x13')]){logger[_0x2595('0x14')](_0x2595('0x15'),_0x557dc5,_0x2595('0x16'));return _0x21652d[_0x2595('0x17')]();}if(_0x54e32a[0x0]==='1'&&(_[_0x2595('0x18')](this['interaction'][_0x2595('0x19')])||!this['interaction'][_0x2595('0x19')])){logger[_0x2595('0x14')](_0x2595('0x15'),_0x557dc5,'Autoreply\x20already\x20sent');return _0x21652d['next']();}if(_0x54e32a[0x0]==='2'&&this[_0x2595('0x1a')][_0x2595('0x1b')]){logger['info'](_0x2595('0x1c'),_0x557dc5,_0x2595('0x1d'));return _0x21652d[_0x2595('0x17')]();}var _0x3ec104={'ContactId':this[_0x2595('0x1e')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2595('0x1f')};if(this['channel']===_0x2595('0x11')){_0x3ec104['body']=utils['getMustacheRender'](_0x54e32a[0x2],this);}else{_0x3ec104[_0x2595('0x12')]=utils[_0x2595('0x20')](_0x54e32a[0x1],this);}if(this[_0x2595('0x21')]){_0x3ec104['to']=this[_0x2595('0x21')][_0x2595('0x22')]||'';if(this[_0x2595('0x10')]==='mail'&&_0x54e32a[0x1]==='1'){_0x3ec104['cc']=this[_0x2595('0x21')]['cc']||'';}_0x3ec104[_0x2595('0x22')]=this[_0x2595('0x21')]['to']||'';_0x3ec104['phone']=this[_0x2595('0x21')][_0x2595('0x23')]||'';_0x3ec104[_0x2595('0x24')]=!![];if(this[_0x2595('0x21')]['subject']){_0x3ec104[_0x2595('0x25')]='';_0x3ec104[_0x2595('0x25')]+=_['startsWith'](this[_0x2595('0x21')][_0x2595('0x25')],_0x2595('0x26'))?'':_0x2595('0x27');_0x3ec104[_0x2595('0x25')]+=this[_0x2595('0x21')]['subject'];}}if(this[_0x2595('0x10')]==='chat'){_0x3ec104[_0x2595('0x28')]=this[_0x2595('0x29')]['id'];}else{_0x3ec104[_[_0x2595('0x2a')](this['channel'])+'AccountId']=this[_0x2595('0x29')]['id'];}_0x3ec104[_[_0x2595('0x2a')](this['channel'])+_0x2595('0x2b')]=this['interaction']['id'];var _0x34ea05=this[_0x2595('0x1a')];if(rpc[this[_0x2595('0x10')]+_0x2595('0x2c')]){if(this[_0x2595('0x10')]===_0x2595('0x11')){_0x3ec104['inReplyTo']=this[_0x2595('0x21')][_0x2595('0x2d')];_0x3ec104[_0x2595('0x2e')]=_0x2595('0x2f')+_[_0x2595('0x30')](_0x3ec104['body'],_0x2595('0x31'),_0x2595('0x32'))+_0x2595('0x33');_0x3ec104[_0x2595('0x34')]={'Auto-Submitted':_0x2595('0x35'),'X-Auto-Response-Suppress':_0x2595('0x36'),'Precedence':_0x2595('0x37')};return mailRpc[_0x2595('0x38')](this[_0x2595('0x29')][_0x2595('0x39')],_0x3ec104)[_0x2595('0x3a')](function(_0x282109){logger['info'](_0x2595('0x3b'),_0x557dc5);_0x3ec104['messageId']=_0x282109[_0x2595('0x21')][_0x2595('0x2d')];return rpc[_0x57efdb+'Message'][_0x2595('0x3c')](_0x3ec104);})['then'](function(_0x5ed46a){logger['info'](_0x2595('0x15'),_0x557dc5,JSON[_0x2595('0x3d')](_0x5ed46a));})['catch'](function(_0x5619f0){logger[_0x2595('0x3e')]('[RPC][%s][AUTOREPLY]\x20%s',_0x557dc5,JSON['stringify'](_0x5619f0));})[_0x2595('0x3f')](function(){Promise['resolve']()[_0x2595('0x3a')](function(){if(_0x54e32a[0x0]!=='2'||_0x34ea05[_0x2595('0x1b')])return;return rpc[_0x57efdb+_0x2595('0x40')]['update'](_0x34ea05['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2d50ef){logger['info'](_0x2595('0x1c'),_0x557dc5,JSON[_0x2595('0x3d')](_0x2d50ef));})[_0x2595('0x41')](function(_0x4b6fd6){logger[_0x2595('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x557dc5,JSON[_0x2595('0x3d')](_0x4b6fd6));});})[_0x2595('0x3a')](function(){_0x21652d['next']();});});}else{return rpc[this['channel']+_0x2595('0x2c')][_0x2595('0x3c')](_0x3ec104)[_0x2595('0x3a')](function(){logger[_0x2595('0x14')]('[%s][AUTOREPLY]\x20%s',_0x557dc5,_0x3ec104[_0x2595('0x12')]);})[_0x2595('0x41')](function(_0x3715c5){logger[_0x2595('0x3e')](_0x2595('0x15'),_0x557dc5,JSON[_0x2595('0x3d')](_0x3715c5));})[_0x2595('0x3f')](function(){Promise[_0x2595('0x42')]()[_0x2595('0x3a')](function(){if(_0x54e32a[0x0]!=='2'||_0x34ea05[_0x2595('0x1b')])return;return rpc[_0x57efdb+_0x2595('0x40')][_0x2595('0x43')](_0x34ea05['id'],{'autoreplyExecuted':!![]})[_0x2595('0x3a')](function(_0x221bff){logger[_0x2595('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x557dc5,JSON[_0x2595('0x3d')](_0x221bff));})[_0x2595('0x41')](function(_0x284631){logger[_0x2595('0x3e')](_0x2595('0x44'),_0x557dc5,JSON[_0x2595('0x3d')](_0x284631));});})[_0x2595('0x3a')](function(){_0x21652d[_0x2595('0x17')]();});});}}}catch(_0x4978d4){logger[_0x2595('0x3e')](_0x2595('0x15'),_0x557dc5,JSON[_0x2595('0x3d')](_0x4978d4));_0x21652d[_0x2595('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index a4250fe..5786aad 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefc1=['routing','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger'];(function(_0x5c449d,_0x54b48f){var _0x371d46=function(_0xbf860f){while(--_0xbf860f){_0x5c449d['push'](_0x5c449d['shift']());}};_0x371d46(++_0x54b48f);}(_0xefc1,0xee));var _0x1efc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xefc1[_0x1d9aa0];return _0x226868;};'use strict';var moment=require(_0x1efc('0x0'));var logger=require(_0x1efc('0x1'))(_0x1efc('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1efc('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1efc('0x4')),'whatsappInteraction':require(_0x1efc('0x5'))};exports[_0x1efc('0x6')]=function(_0x49541f,_0x501f1f,_0xb5bfb3,_0x7666b2){return function(_0x580e5f){try{logger[_0x1efc('0x7')](_0x1efc('0x8'),_0x49541f,_0x501f1f[0x0]);var _0x2bd7fe={'closed':0x1,'closedAt':moment()[_0x1efc('0x9')](_0x1efc('0xa')),'closeReason':_0x1efc('0xb'),'disposition':_0x501f1f[0x0]};if(rpc[_0x7666b2[_0x1efc('0xc')]+_0x1efc('0xd')]){rpc[_0x7666b2[_0x1efc('0xc')]+'Interaction'][_0x1efc('0xe')](_0x7666b2[_0x1efc('0xf')]['id'],_0x2bd7fe)[_0x1efc('0x10')](function(_0x4ede48){logger[_0x1efc('0x7')](_0x1efc('0x11'),_0x49541f,_0x7666b2['interaction']['id']);})[_0x1efc('0x12')](function(_0x690ec0){logger[_0x1efc('0x13')](_0x1efc('0x14'),_0x49541f,JSON['stringify'](_0x690ec0));})[_0x1efc('0x15')](function(){_0x580e5f[_0x1efc('0x16')]();});}}catch(_0x252a20){logger[_0x1efc('0x13')]('[%s][CLOSE]\x20%s',_0x49541f,JSON[_0x1efc('0x17')](_0x252a20));_0x580e5f[_0x1efc('0x16')]();}};}; \ No newline at end of file +var _0xa685=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x1cac7d,_0x587638){var _0x468636=function(_0x455ba1){while(--_0x455ba1){_0x1cac7d['push'](_0x1cac7d['shift']());}};_0x468636(++_0x587638);}(_0xa685,0xc1));var _0x5a68=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xa685[_0x2a56ad];return _0x425175;};'use strict';var moment=require(_0x5a68('0x0'));var logger=require(_0x5a68('0x1'))(_0x5a68('0x2'));var rpc={'chatInteraction':require(_0x5a68('0x3')),'openchannelInteraction':require(_0x5a68('0x4')),'smsInteraction':require(_0x5a68('0x5')),'mailInteraction':require(_0x5a68('0x6')),'faxInteraction':require(_0x5a68('0x7')),'whatsappInteraction':require(_0x5a68('0x8'))};exports['consequence']=function(_0x4dbbd6,_0x261ec0,_0x3f6a9d,_0x97b767){return function(_0xb81191){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x4dbbd6,_0x261ec0[0x0]);var _0x577683={'closed':0x1,'closedAt':moment()[_0x5a68('0x9')](_0x5a68('0xa')),'closeReason':_0x5a68('0xb'),'disposition':_0x261ec0[0x0]};if(rpc[_0x97b767[_0x5a68('0xc')]+_0x5a68('0xd')]){rpc[_0x97b767[_0x5a68('0xc')]+_0x5a68('0xd')][_0x5a68('0xe')](_0x97b767[_0x5a68('0xf')]['id'],_0x577683)[_0x5a68('0x10')](function(_0x5a3bd1){logger[_0x5a68('0x11')](_0x5a68('0x12'),_0x4dbbd6,_0x97b767[_0x5a68('0xf')]['id']);})['catch'](function(_0x5ed805){logger[_0x5a68('0x13')]('[%s][CLOSE]\x20%s',_0x4dbbd6,JSON[_0x5a68('0x14')](_0x5ed805));})['finally'](function(){_0xb81191['stop']();});}}catch(_0x260940){logger['error']('[%s][CLOSE]\x20%s',_0x4dbbd6,JSON[_0x5a68('0x14')](_0x260940));_0xb81191[_0x5a68('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 70d2a33..c372dbc 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x297f=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','Message','create','endConversation','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','created','body','getMustacheRender','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x5b19fe,_0xf96db0){var _0x37083f=function(_0x26c452){while(--_0x26c452){_0x5b19fe['push'](_0x5b19fe['shift']());}};_0x37083f(++_0xf96db0);}(_0x297f,0x1f0));var _0xf297=function(_0x54b92e,_0x97472b){_0x54b92e=_0x54b92e-0x0;var _0x5aa79e=_0x297f[_0x54b92e];return _0x5aa79e;};'use strict';var _=require(_0xf297('0x0'));var moment=require(_0xf297('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xf297('0x2'));var logger=require(_0xf297('0x3'))(_0xf297('0x4'));var rpc={'chatMessage':require(_0xf297('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf297('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf297('0x7')),'whatsappMessage':require(_0xf297('0x8'))};exports[_0xf297('0x9')]=function(_0x4bb956,_0x4a3862){return function(_0x302320){try{if(!_[_0xf297('0xa')](this[_0xf297('0xb')]['UserId'])){logger[_0xf297('0xc')](_0xf297('0xd'),_0x4bb956,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x302320[_0xf297('0xe')]();}var _0x481d0d={'ContactId':this[_0xf297('0xf')]['id'],'sentAt':moment()[_0xf297('0x10')](_0xf297('0x11')),'direction':'out'};if(this[_0xf297('0x12')]==='sms'||this[_0xf297('0x12')]==='whatsapp'){_0x481d0d['phone']=this[_0xf297('0xb')][_0xf297('0x13')];}var _0x1f0459=this[_0xf297('0x12')];if(_0x1f0459===_0xf297('0x14')){_0x481d0d[_0xf297('0x15')]=this['account']['id'];}else{_0x481d0d[_[_0xf297('0x16')](_0x1f0459)+_0xf297('0x17')]=this['account']['id'];}_0x481d0d[_[_0xf297('0x16')](_0x1f0459)+'InteractionId']=this[_0xf297('0xb')]['id'];if(this[_0xf297('0xb')][_0xf297('0x18')]){var _0x4cc9a4=_0x4a3862[0x2];if(!_['isEmpty'](_0x4cc9a4)){_0x481d0d[_0xf297('0x19')]=utils[_0xf297('0x1a')](_0x4cc9a4,this);return rpc[_0x1f0459+'Message']['create'](_0x481d0d)[_0xf297('0x1b')](function(_0x1932df){logger['info'](_0xf297('0xd'),_0x4bb956,_0x481d0d[_0xf297('0x19')]);})[_0xf297('0x1c')](function(_0x480c10){logger[_0xf297('0x1d')](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x480c10));})['finally'](function(){logger[_0xf297('0xc')](_0xf297('0x1f'),_0x4bb956);_0x302320[_0xf297('0x20')]();});}else{logger['info'](_0xf297('0x21'),_0x4bb956);_0x302320[_0xf297('0x20')]();}}else{var _0x4023a3=this;var _0x4cf7f7=apiai(_0x4a3862[0x0],{'language':_0x4a3862[0x1]||'en'});return _0x4cf7f7[_0xf297('0x22')](this[_0xf297('0x23')][_0xf297('0x19')],{'sessionId':md5(this[_0xf297('0xb')]['id'])})['then'](function(_0x27265c){_0x4023a3['body'][_0xf297('0x24')]=_0x27265c;_0x481d0d[_0xf297('0x19')]=_0x27265c[_0xf297('0x25')][_0xf297('0x26')][_0xf297('0x27')];_0x481d0d['providerName']='dialogflow';_0x481d0d[_0xf297('0x28')]=JSON[_0xf297('0x1e')](_0x27265c);return rpc[_0x1f0459+_0xf297('0x29')][_0xf297('0x2a')](_0x481d0d)[_0xf297('0x1b')](function(_0x456573){logger['info'](_0xf297('0xd'),_0x4bb956,_0x481d0d['body']);if(_0x27265c['result']['metadata'][_0xf297('0x2b')]){_0x302320[_0xf297('0xe')]();}else{_0x302320[_0xf297('0x20')]();}})[_0xf297('0x1c')](function(_0x2cdfc6){logger['error'](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x2cdfc6));_0x302320['next']();});})[_0xf297('0x1c')](function(_0x38a4f6){logger[_0xf297('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x4bb956,_0x38a4f6[_0xf297('0x23')]);_0x302320[_0xf297('0xe')]();});}}catch(_0x2be167){logger['error'](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x2be167));_0x302320['stop']();}};}; \ No newline at end of file +var _0x94ba=['isNil','interaction','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerName','metadata','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence'];(function(_0x30ec02,_0x14c788){var _0x1d91dd=function(_0x35d0a2){while(--_0x35d0a2){_0x30ec02['push'](_0x30ec02['shift']());}};_0x1d91dd(++_0x14c788);}(_0x94ba,0xbe));var _0xa94b=function(_0x4057ec,_0x425f09){_0x4057ec=_0x4057ec-0x0;var _0xe062c=_0x94ba[_0x4057ec];return _0xe062c;};'use strict';var _=require(_0xa94b('0x0'));var moment=require(_0xa94b('0x1'));var apiai=require(_0xa94b('0x2'));var md5=require(_0xa94b('0x3'));var utils=require(_0xa94b('0x4'));var logger=require('../../../../config/logger')(_0xa94b('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa94b('0x6')),'mailMessage':require(_0xa94b('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa94b('0x8'))};exports[_0xa94b('0x9')]=function(_0x363129,_0x262c09){return function(_0x54c158){try{if(!_[_0xa94b('0xa')](this[_0xa94b('0xb')]['UserId'])){logger['info'](_0xa94b('0xc'),_0x363129,_0xa94b('0xd'));return _0x54c158[_0xa94b('0xe')]();}var _0x5233ee={'ContactId':this[_0xa94b('0xf')]['id'],'sentAt':moment()[_0xa94b('0x10')](_0xa94b('0x11')),'direction':_0xa94b('0x12')};if(this[_0xa94b('0x13')]===_0xa94b('0x14')||this['channel']===_0xa94b('0x15')){_0x5233ee[_0xa94b('0x16')]=this[_0xa94b('0xb')][_0xa94b('0x16')];}var _0x162f7c=this[_0xa94b('0x13')];if(_0x162f7c===_0xa94b('0x17')){_0x5233ee[_0xa94b('0x18')]=this['account']['id'];}else{_0x5233ee[_[_0xa94b('0x19')](_0x162f7c)+_0xa94b('0x1a')]=this['account']['id'];}_0x5233ee[_[_0xa94b('0x19')](_0x162f7c)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xa94b('0x1b')]){var _0x8a8b5d=_0x262c09[0x2];if(!_[_0xa94b('0x1c')](_0x8a8b5d)){_0x5233ee[_0xa94b('0x1d')]=utils[_0xa94b('0x1e')](_0x8a8b5d,this);return rpc[_0x162f7c+_0xa94b('0x1f')][_0xa94b('0x20')](_0x5233ee)[_0xa94b('0x21')](function(_0x34049f){logger[_0xa94b('0x22')](_0xa94b('0xc'),_0x363129,_0x5233ee[_0xa94b('0x1d')]);})[_0xa94b('0x23')](function(_0x1e5cd4){logger[_0xa94b('0x24')](_0xa94b('0xc'),_0x363129,JSON[_0xa94b('0x25')](_0x1e5cd4));})[_0xa94b('0x26')](function(){logger[_0xa94b('0x22')](_0xa94b('0x27'),_0x363129);_0x54c158[_0xa94b('0x28')]();});}else{logger['info'](_0xa94b('0x29'),_0x363129);_0x54c158[_0xa94b('0x28')]();}}else{var _0x2740b4=this;var _0x1f2133=apiai(_0x262c09[0x0],{'language':_0x262c09[0x1]||'en'});return _0x1f2133[_0xa94b('0x2a')](this[_0xa94b('0x2b')][_0xa94b('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0xa94b('0x21')](function(_0x987123){_0x2740b4[_0xa94b('0x1d')][_0xa94b('0x2c')]=_0x987123;_0x5233ee[_0xa94b('0x1d')]=_0x987123[_0xa94b('0x2d')][_0xa94b('0x2e')][_0xa94b('0x2f')];_0x5233ee[_0xa94b('0x30')]='dialogflow';_0x5233ee['providerResponse']=JSON[_0xa94b('0x25')](_0x987123);return rpc[_0x162f7c+_0xa94b('0x1f')][_0xa94b('0x20')](_0x5233ee)[_0xa94b('0x21')](function(_0x242a7e){logger[_0xa94b('0x22')](_0xa94b('0xc'),_0x363129,_0x5233ee['body']);if(_0x987123['result'][_0xa94b('0x31')]['endConversation']){_0x54c158[_0xa94b('0xe')]();}else{_0x54c158[_0xa94b('0x28')]();}})[_0xa94b('0x23')](function(_0x183212){logger[_0xa94b('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x363129,JSON[_0xa94b('0x25')](_0x183212));_0x54c158[_0xa94b('0xe')]();});})['catch'](function(_0x38c9e2){logger[_0xa94b('0x24')](_0xa94b('0xc'),_0x363129,_0x38c9e2[_0xa94b('0x2b')]);_0x54c158[_0xa94b('0xe')]();});}}catch(_0x1e716c){logger[_0xa94b('0x24')](_0xa94b('0xc'),_0x363129,JSON[_0xa94b('0x25')](_0x1e716c));_0x54c158[_0xa94b('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 25b7727..d5a2494 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce28=['all','next','stack','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push'];(function(_0x15ac75,_0x4afbaa){var _0x468abe=function(_0x7160eb){while(--_0x7160eb){_0x15ac75['push'](_0x15ac75['shift']());}};_0x468abe(++_0x4afbaa);}(_0xce28,0xe1));var _0x8ce2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xce28[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x8ce2('0x0'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x8ce2('0x1'))(_0x8ce2('0x2'));var utils=require('./utils');var rpc={'chatMessage':require(_0x8ce2('0x3')),'openchannelMessage':require(_0x8ce2('0x4')),'mailMessage':require(_0x8ce2('0x5')),'smsMessage':require(_0x8ce2('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8ce2('0x7'))};function createMessage(_0x1d00ae,_0x45eda6,_0xa16fb1,_0x482828){return new Promise(function(_0x399600,_0xfcf18){var _0x4b84b3=_[_0x8ce2('0x8')](_0xa16fb1);_0x4b84b3[_0x8ce2('0x9')]=_0x482828;return rpc[_0x45eda6+_0x8ce2('0xa')][_0x8ce2('0xb')](_0x4b84b3)[_0x8ce2('0xc')](function(){logger[_0x8ce2('0xd')](_0x8ce2('0xe'),_0x1d00ae,_0x4b84b3[_0x8ce2('0x9')]);_0x399600();})[_0x8ce2('0xf')](function(_0x366c83){logger[_0x8ce2('0x10')](_0x8ce2('0xe'),_0x1d00ae,JSON[_0x8ce2('0x11')](_0x366c83));_0xfcf18(_0x366c83);});});}exports['consequence']=function(_0x481781,_0x2e4a08){return function(_0x3768f0){try{if(!_[_0x8ce2('0x12')](this[_0x8ce2('0x13')][_0x8ce2('0x14')])){logger[_0x8ce2('0xd')](_0x8ce2('0xe'),_0x481781,_0x8ce2('0x15'));return _0x3768f0['next']();}var _0x32f61d={'ContactId':this[_0x8ce2('0x16')]['id'],'sentAt':moment()[_0x8ce2('0x17')](_0x8ce2('0x18')),'direction':_0x8ce2('0x19')};if(this['channel']===_0x8ce2('0x1a')||this[_0x8ce2('0x1b')]===_0x8ce2('0x1c')){_0x32f61d[_0x8ce2('0x1d')]=this[_0x8ce2('0x13')][_0x8ce2('0x1d')];}var _0x1c31b6=this[_0x8ce2('0x1b')];if(_0x1c31b6===_0x8ce2('0x1e')){_0x32f61d[_0x8ce2('0x1f')]=this[_0x8ce2('0x20')]['id'];}else{_0x32f61d[_[_0x8ce2('0x21')](_0x1c31b6)+'AccountId']=this['account']['id'];}_0x32f61d[_[_0x8ce2('0x21')](_0x1c31b6)+_0x8ce2('0x22')]=this[_0x8ce2('0x13')]['id'];if(this[_0x8ce2('0x13')][_0x8ce2('0x23')]){var _0x44c344=_0x2e4a08[0x4];if(!_['isEmpty'](_0x44c344)){_0x32f61d[_0x8ce2('0x9')]=utils[_0x8ce2('0x24')](_0x44c344,this);return rpc[_0x1c31b6+_0x8ce2('0xa')][_0x8ce2('0xb')](_0x32f61d)[_0x8ce2('0xc')](function(_0x4c8860){logger[_0x8ce2('0xd')](_0x8ce2('0xe'),_0x481781,_0x32f61d['body']);})[_0x8ce2('0xf')](function(_0x2e4867){logger[_0x8ce2('0x10')](_0x8ce2('0xe'),_0x481781,JSON['stringify'](_0x2e4867));})[_0x8ce2('0x25')](function(){logger[_0x8ce2('0xd')](_0x8ce2('0x26'),_0x481781);_0x3768f0[_0x8ce2('0x27')]();});}else{logger[_0x8ce2('0xd')](_0x8ce2('0x28'),_0x481781);_0x3768f0[_0x8ce2('0x27')]();}}else{var _0x1ab79c=this;var _0x550e88=_0x2e4a08[0x2][_0x8ce2('0x29')](/\\n/g,'\x0a');var _0x59de58={'credentials':{'private_key':_0x550e88,'client_email':_0x2e4a08[0x1]}};var _0x485abc=new dialogflow[(_0x8ce2('0x2a'))](_0x59de58);var _0x3feff1=_0x485abc[_0x8ce2('0x2b')](_0x2e4a08[0x0],md5(_0x1ab79c[_0x8ce2('0x13')]['id']));var _0xcf1251={'session':_0x3feff1,'queryInput':{'text':{'text':_0x1ab79c[_0x8ce2('0x2c')][_0x8ce2('0x9')],'languageCode':_0x2e4a08[0x3]||'en'}}};return _0x485abc[_0x8ce2('0x2d')](_0xcf1251)['then'](function(_0x424a9a){if(_0x424a9a&&_0x424a9a[_0x8ce2('0x2e')]){_0x1ab79c['body']['dialogflowV2']=_0x424a9a;var _0x5809ad=_0x424a9a[0x0];var _0x4a87b3=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')]&&_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')][_0x8ce2('0x31')]?_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')][_0x8ce2('0x31')][_0x8ce2('0x32')][_0x8ce2('0x33')]:![];_0x1ab79c[_0x8ce2('0x9')][_0x8ce2('0x34')]=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x35')];_0x1ab79c[_0x8ce2('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x36')];_0x1ab79c['body'][_0x8ce2('0x37')]=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')]&&_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')][_0x8ce2('0x31')]?_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x30')]['fields'][_0x8ce2('0x32')]['boolValue']:![];_0x1ab79c[_0x8ce2('0x9')][_0x8ce2('0x38')]=_0x5809ad['queryResult'][_0x8ce2('0x39')]['name'];_0x1ab79c[_0x8ce2('0x9')][_0x8ce2('0x3a')]=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x39')][_0x8ce2('0x3b')];_0x1ab79c['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x39')][_0x8ce2('0x3c')];_0x1ab79c[_0x8ce2('0x9')][_0x8ce2('0x3d')]=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x3e')];_0x1ab79c[_0x8ce2('0x9')]['DIALOGFLOWV2_QUERYTEXT']=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x3f')];_0x1ab79c['body'][_0x8ce2('0x40')]=_0x5809ad[_0x8ce2('0x2f')][_0x8ce2('0x41')];_0x32f61d[_0x8ce2('0x42')]=_0x8ce2('0x43');_0x32f61d[_0x8ce2('0x44')]=JSON[_0x8ce2('0x11')](_0x424a9a);var _0x5155de=[];for(var _0x48d850=0x0;_0x48d850<_0x424a9a[_0x8ce2('0x2e')];_0x48d850++){var _0x9d5ec7=_0x424a9a[_0x48d850];if(_0x9d5ec7&&_0x9d5ec7[_0x8ce2('0x2f')]&&_0x9d5ec7[_0x8ce2('0x2f')][_0x8ce2('0x45')]){_0x5155de[_0x8ce2('0x46')](createMessage(_0x481781,_0x1c31b6,_0x32f61d,_0x9d5ec7[_0x8ce2('0x2f')][_0x8ce2('0x45')]));}}return Promise[_0x8ce2('0x47')](_0x5155de)[_0x8ce2('0xc')](function(){if(_0x4a87b3){_0x3768f0[_0x8ce2('0x48')]();}else{_0x3768f0[_0x8ce2('0x27')]();}})[_0x8ce2('0xf')](function(_0x252d6e){logger[_0x8ce2('0x10')](_0x8ce2('0xe'),_0x481781,JSON[_0x8ce2('0x11')](_0x252d6e));_0x3768f0[_0x8ce2('0x48')]();});}})[_0x8ce2('0xf')](function(_0x5925ba){logger[_0x8ce2('0x10')](_0x8ce2('0xe'),_0x481781,_0x5925ba[_0x8ce2('0x2c')],_0x5925ba[_0x8ce2('0x49')]);_0x3768f0[_0x8ce2('0x48')]();});}}catch(_0x24696d){logger[_0x8ce2('0x10')](_0x8ce2('0xe'),_0x481781,JSON['stringify'](_0x24696d));_0x3768f0[_0x8ce2('0x27')]();}};}; \ No newline at end of file +var _0x569e=['../../rpc/faxMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','create','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','fulfillmentText','push','lodash','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0xc4376d,_0x2e6841){var _0x291524=function(_0x235c70){while(--_0x235c70){_0xc4376d['push'](_0xc4376d['shift']());}};_0x291524(++_0x2e6841);}(_0x569e,0x7b));var _0xe569=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0x569e[_0x460dae];return _0x36e6d0;};'use strict';var _=require(_0xe569('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0xe569('0x1'));var Promise=require(_0xe569('0x2'));var logger=require(_0xe569('0x3'))(_0xe569('0x4'));var utils=require(_0xe569('0x5'));var rpc={'chatMessage':require(_0xe569('0x6')),'openchannelMessage':require(_0xe569('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe569('0x8')),'faxMessage':require(_0xe569('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x28e107,_0x420e62,_0x1593ec,_0x84cd1){return new Promise(function(_0x3361d9,_0x5ce1dc){var _0x1216a9=_['clone'](_0x1593ec);_0x1216a9[_0xe569('0xa')]=_0x84cd1;return rpc[_0x420e62+_0xe569('0xb')]['create'](_0x1216a9)[_0xe569('0xc')](function(){logger[_0xe569('0xd')](_0xe569('0xe'),_0x28e107,_0x1216a9[_0xe569('0xa')]);_0x3361d9();})[_0xe569('0xf')](function(_0x36c8d8){logger[_0xe569('0x10')](_0xe569('0xe'),_0x28e107,JSON['stringify'](_0x36c8d8));_0x5ce1dc(_0x36c8d8);});});}exports[_0xe569('0x11')]=function(_0x3d40a6,_0x564791){return function(_0x594d8c){try{if(!_[_0xe569('0x12')](this[_0xe569('0x13')][_0xe569('0x14')])){logger[_0xe569('0xd')](_0xe569('0xe'),_0x3d40a6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x594d8c[_0xe569('0x15')]();}var _0x148c5a={'ContactId':this[_0xe569('0x16')]['id'],'sentAt':moment()['format'](_0xe569('0x17')),'direction':_0xe569('0x18')};if(this['channel']==='sms'||this[_0xe569('0x19')]==='whatsapp'){_0x148c5a[_0xe569('0x1a')]=this[_0xe569('0x13')][_0xe569('0x1a')];}var _0x42ac16=this[_0xe569('0x19')];if(_0x42ac16==='chat'){_0x148c5a[_0xe569('0x1b')]=this[_0xe569('0x1c')]['id'];}else{_0x148c5a[_['upperFirst'](_0x42ac16)+_0xe569('0x1d')]=this['account']['id'];}_0x148c5a[_['upperFirst'](_0x42ac16)+_0xe569('0x1e')]=this[_0xe569('0x13')]['id'];if(this[_0xe569('0x13')][_0xe569('0x1f')]){var _0x4a8bcd=_0x564791[0x4];if(!_[_0xe569('0x20')](_0x4a8bcd)){_0x148c5a['body']=utils['getMustacheRender'](_0x4a8bcd,this);return rpc[_0x42ac16+_0xe569('0xb')][_0xe569('0x21')](_0x148c5a)[_0xe569('0xc')](function(_0x1d470b){logger[_0xe569('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x3d40a6,_0x148c5a[_0xe569('0xa')]);})[_0xe569('0xf')](function(_0x586661){logger['error'](_0xe569('0xe'),_0x3d40a6,JSON[_0xe569('0x22')](_0x586661));})[_0xe569('0x23')](function(){logger['info'](_0xe569('0x24'),_0x3d40a6);_0x594d8c[_0xe569('0x25')]();});}else{logger[_0xe569('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d40a6);_0x594d8c['stop']();}}else{var _0x2db4d6=this;var _0x5b2fb7=_0x564791[0x2][_0xe569('0x26')](/\\n/g,'\x0a');var _0x2dbaa4={'credentials':{'private_key':_0x5b2fb7,'client_email':_0x564791[0x1]}};var _0xd97a00=new dialogflow['SessionsClient'](_0x2dbaa4);var _0x2879e3=_0xd97a00[_0xe569('0x27')](_0x564791[0x0],md5(_0x2db4d6[_0xe569('0x13')]['id']));var _0x2bd4e1={'session':_0x2879e3,'queryInput':{'text':{'text':_0x2db4d6[_0xe569('0x28')]['body'],'languageCode':_0x564791[0x3]||'en'}}};return _0xd97a00[_0xe569('0x29')](_0x2bd4e1)['then'](function(_0x15e56b){if(_0x15e56b&&_0x15e56b[_0xe569('0x2a')]){_0x2db4d6['body'][_0xe569('0x2b')]=_0x15e56b;var _0x19ead0=_0x15e56b[0x0];var _0x18d68e=_0x19ead0[_0xe569('0x2c')][_0xe569('0x2d')]&&_0x19ead0[_0xe569('0x2c')][_0xe569('0x2d')]['fields']?_0x19ead0[_0xe569('0x2c')]['diagnosticInfo'][_0xe569('0x2e')][_0xe569('0x2f')][_0xe569('0x30')]:![];_0x2db4d6[_0xe569('0xa')][_0xe569('0x31')]=_0x19ead0['queryResult'][_0xe569('0x32')];_0x2db4d6['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x19ead0[_0xe569('0x2c')][_0xe569('0x33')];_0x2db4d6[_0xe569('0xa')][_0xe569('0x34')]=_0x19ead0['queryResult']['diagnosticInfo']&&_0x19ead0[_0xe569('0x2c')][_0xe569('0x2d')][_0xe569('0x2e')]?_0x19ead0['queryResult']['diagnosticInfo'][_0xe569('0x2e')][_0xe569('0x2f')][_0xe569('0x30')]:![];_0x2db4d6[_0xe569('0xa')][_0xe569('0x35')]=_0x19ead0[_0xe569('0x2c')][_0xe569('0x36')]['name'];_0x2db4d6[_0xe569('0xa')][_0xe569('0x37')]=_0x19ead0['queryResult'][_0xe569('0x36')][_0xe569('0x38')];_0x2db4d6['body'][_0xe569('0x39')]=_0x19ead0[_0xe569('0x2c')][_0xe569('0x36')][_0xe569('0x3a')];_0x2db4d6[_0xe569('0xa')][_0xe569('0x3b')]=_0x19ead0[_0xe569('0x2c')][_0xe569('0x3c')];_0x2db4d6[_0xe569('0xa')][_0xe569('0x3d')]=_0x19ead0[_0xe569('0x2c')]['queryText'];_0x2db4d6[_0xe569('0xa')][_0xe569('0x3e')]=_0x19ead0[_0xe569('0x2c')][_0xe569('0x3f')];_0x148c5a['providerName']=_0xe569('0x2b');_0x148c5a['providerResponse']=JSON[_0xe569('0x22')](_0x15e56b);var _0x20fde2=[];for(var _0x2fbe53=0x0;_0x2fbe53<_0x15e56b[_0xe569('0x2a')];_0x2fbe53++){var _0x1f21e3=_0x15e56b[_0x2fbe53];if(_0x1f21e3&&_0x1f21e3['queryResult']&&_0x1f21e3['queryResult'][_0xe569('0x40')]){_0x20fde2[_0xe569('0x41')](createMessage(_0x3d40a6,_0x42ac16,_0x148c5a,_0x1f21e3[_0xe569('0x2c')]['fulfillmentText']));}}return Promise['all'](_0x20fde2)[_0xe569('0xc')](function(){if(_0x18d68e){_0x594d8c['next']();}else{_0x594d8c[_0xe569('0x25')]();}})[_0xe569('0xf')](function(_0x37c12d){logger[_0xe569('0x10')](_0xe569('0xe'),_0x3d40a6,JSON[_0xe569('0x22')](_0x37c12d));_0x594d8c[_0xe569('0x15')]();});}})[_0xe569('0xf')](function(_0x558938){logger['error'](_0xe569('0xe'),_0x3d40a6,_0x558938[_0xe569('0x28')],_0x558938['stack']);_0x594d8c[_0xe569('0x15')]();});}}catch(_0x275003){logger['error'](_0xe569('0xe'),_0x3d40a6,JSON[_0xe569('0x22')](_0x275003));_0x594d8c[_0xe569('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 7c441cf..244648e 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4daf=['findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify','validate','lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','message','join','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x21b61d,_0x2946a1){var _0x168d2f=function(_0xe5c0ac){while(--_0xe5c0ac){_0x21b61d['push'](_0x21b61d['shift']());}};_0x168d2f(++_0x2946a1);}(_0x4daf,0xbd));var _0xf4da=function(_0x22daf6,_0x1efa91){_0x22daf6=_0x22daf6-0x0;var _0x13f131=_0x4daf[_0x22daf6];return _0x13f131;};'use strict';var schema=require(_0xf4da('0x0'));var _=require(_0xf4da('0x1'));var htmlToText=require(_0xf4da('0x2'));var utils=require('./utils');var logger=require(_0xf4da('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xf4da('0x4'),'required':!![],'message':_0xf4da('0x5')},'priorityTrue':{'type':_0xf4da('0x6'),'message':_0xf4da('0x7')},'priorityFalse':{'type':_0xf4da('0x6'),'message':_0xf4da('0x8')}});exports[_0xf4da('0x9')]=function(_0x454adf,_0x11a49f){return function(_0x48637f){try{var _0x154b4a={'condition':htmlToText['fromString'](utils[_0xf4da('0xa')](_0x11a49f[0x0],this),{'wordwrap':![]})[_0xf4da('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x11a49f[0x1],'priorityFalse':_0x11a49f[0x2]};var _0x5bd393=gotoif[_0xf4da('0x0')](_0x154b4a,{'typecast':!![]});if(_0x5bd393['length']){logger[_0xf4da('0xc')](_0xf4da('0xd'),_0x454adf,_['map'](_0x5bd393,_0xf4da('0xe'))[_0xf4da('0xf')](',\x20'));_0x48637f['stop']();}else{try{var _0x494295=eval('('+_0x154b4a['condition']+')');var _0x2b23d0=_0x494295?_0x154b4a[_0xf4da('0x10')]:_0x154b4a['priorityFalse'];logger['info'](_0xf4da('0x11'),_0x454adf,_0x154b4a['condition'],_0x494295,_0x2b23d0||_0xf4da('0x12'));if(_0x2b23d0){var _0x3c833c=_[_0xf4da('0x13')](_0x48637f['rules'](),{'p':_0x2b23d0});if(_0x3c833c>=0x0){logger[_0xf4da('0x14')](_0xf4da('0x15'),_0x454adf,_0x2b23d0||_0xf4da('0x12'),_0x3c833c);_0x48637f[_0xf4da('0x12')](_0x3c833c);}else{logger[_0xf4da('0x14')](_0xf4da('0x16'),_0x454adf,_0x2b23d0||_0xf4da('0x12'));_0x48637f['stop']();}}else{_0x48637f[_0xf4da('0x12')]();}}catch(_0x1d9e45){logger['error'](_0xf4da('0x17'),_0x454adf,_0x1d9e45[_0xf4da('0xe')]);_0x48637f[_0xf4da('0x18')]();}}}catch(_0x1678f5){logger['error'](_0xf4da('0xd'),_0x454adf,JSON[_0xf4da('0x19')](_0x1678f5));_0x48637f[_0xf4da('0x18')]();}};}; \ No newline at end of file +var _0xe22a=['validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','map','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify'];(function(_0x3486b0,_0x248021){var _0x2c8a3f=function(_0x7b5568){while(--_0x7b5568){_0x3486b0['push'](_0x3486b0['shift']());}};_0x2c8a3f(++_0x248021);}(_0xe22a,0x13f));var _0xae22=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe22a[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0xae22('0x0'));var _=require(_0xae22('0x1'));var htmlToText=require(_0xae22('0x2'));var utils=require('./utils');var logger=require(_0xae22('0x3'))(_0xae22('0x4'));var gotoif=schema({'condition':{'type':_0xae22('0x5'),'required':!![],'message':_0xae22('0x6')},'priorityTrue':{'type':_0xae22('0x7'),'message':_0xae22('0x8')},'priorityFalse':{'type':_0xae22('0x7'),'message':_0xae22('0x9')}});exports['consequence']=function(_0x349d1f,_0x5681a9){return function(_0x55f71f){try{var _0x10cb88={'condition':htmlToText['fromString'](utils[_0xae22('0xa')](_0x5681a9[0x0],this),{'wordwrap':![]})[_0xae22('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5681a9[0x1],'priorityFalse':_0x5681a9[0x2]};var _0x501368=gotoif[_0xae22('0x0')](_0x10cb88,{'typecast':!![]});if(_0x501368[_0xae22('0xc')]){logger[_0xae22('0xd')]('[%s][GOTOIF]\x20%s',_0x349d1f,_[_0xae22('0xe')](_0x501368,'message')[_0xae22('0xf')](',\x20'));_0x55f71f[_0xae22('0x10')]();}else{try{var _0x1fcd78=eval('('+_0x10cb88[_0xae22('0x11')]+')');var _0x14322a=_0x1fcd78?_0x10cb88[_0xae22('0x12')]:_0x10cb88[_0xae22('0x13')];logger['info'](_0xae22('0x14'),_0x349d1f,_0x10cb88[_0xae22('0x11')],_0x1fcd78,_0x14322a||_0xae22('0x15'));if(_0x14322a){var _0x3954a5=_[_0xae22('0x16')](_0x55f71f['rules'](),{'p':_0x14322a});if(_0x3954a5>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x349d1f,_0x14322a||'next',_0x3954a5);_0x55f71f[_0xae22('0x15')](_0x3954a5);}else{logger[_0xae22('0x17')](_0xae22('0x18'),_0x349d1f,_0x14322a||_0xae22('0x15'));_0x55f71f[_0xae22('0x10')]();}}else{_0x55f71f[_0xae22('0x15')]();}}catch(_0x39b88c){logger['error'](_0xae22('0x19'),_0x349d1f,_0x39b88c[_0xae22('0x1a')]);_0x55f71f[_0xae22('0x10')]();}}}catch(_0x594d67){logger[_0xae22('0xd')](_0xae22('0x1b'),_0x349d1f,JSON[_0xae22('0x1c')](_0x594d67));_0x55f71f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index add8d78..585602b 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 _0x97a7=['number','consequence','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97a7,0x65));var _0x797a=function(_0x27ba17,_0x58f31c){_0x27ba17=_0x27ba17-0x0;var _0x377b6c=_0x97a7[_0x27ba17];return _0x377b6c;};'use strict';var schema=require(_0x797a('0x0'));var _=require(_0x797a('0x1'));var logger=require(_0x797a('0x2'))(_0x797a('0x3'));var gotop=schema({'priority':{'type':_0x797a('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x797a('0x5')]=function(_0x49f4c0,_0x5ecef4){return function(_0x2122e7){try{var _0x469f1b={'priority':_0x5ecef4[0x0]};var _0x5a1d10=gotop[_0x797a('0x0')](_0x469f1b,{'typecast':!![]});if(_0x5a1d10[_0x797a('0x6')]){logger[_0x797a('0x7')](_0x797a('0x8'),_0x49f4c0,_[_0x797a('0x9')](_0x5a1d10,'message')[_0x797a('0xa')](',\x20'));_0x2122e7[_0x797a('0xb')]();}else{logger[_0x797a('0xc')](_0x797a('0xd'),_0x49f4c0,_0x469f1b['priority']);if(_0x469f1b['priority']){var _0x18cba4=_[_0x797a('0xe')](_0x2122e7[_0x797a('0xf')](),{'p':_0x469f1b['priority']});if(_0x18cba4>=0x0){logger[_0x797a('0xc')](_0x797a('0x10'),_0x49f4c0,_0x469f1b[_0x797a('0x11')]||_0x797a('0x12'),_0x18cba4);_0x2122e7[_0x797a('0x12')](_0x18cba4);}else{logger[_0x797a('0xc')](_0x797a('0x13'),_0x49f4c0,_0x469f1b[_0x797a('0x11')]||_0x797a('0x12'));_0x2122e7[_0x797a('0xb')]();}}else{_0x2122e7['next']();}}}catch(_0x32dacb){logger[_0x797a('0x7')](_0x797a('0x8'),_0x49f4c0,JSON[_0x797a('0x14')](_0x32dacb));_0x2122e7[_0x797a('0xb')]();}};}; \ No newline at end of file +var _0x34b8=['length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x3dbb5d,_0x4d5392){var _0x905117=function(_0x3387f7){while(--_0x3387f7){_0x3dbb5d['push'](_0x3dbb5d['shift']());}};_0x905117(++_0x4d5392);}(_0x34b8,0xb6));var _0x834b=function(_0x1ef230,_0x3b5720){_0x1ef230=_0x1ef230-0x0;var _0x388707=_0x34b8[_0x1ef230];return _0x388707;};'use strict';var schema=require(_0x834b('0x0'));var _=require(_0x834b('0x1'));var logger=require(_0x834b('0x2'))(_0x834b('0x3'));var gotop=schema({'priority':{'type':_0x834b('0x4'),'required':!![],'message':_0x834b('0x5')}});exports[_0x834b('0x6')]=function(_0x1a3036,_0x51bb8e){return function(_0x77c5fe){try{var _0x4b4741={'priority':_0x51bb8e[0x0]};var _0x1df2e4=gotop[_0x834b('0x0')](_0x4b4741,{'typecast':!![]});if(_0x1df2e4[_0x834b('0x7')]){logger['error'](_0x834b('0x8'),_0x1a3036,_[_0x834b('0x9')](_0x1df2e4,_0x834b('0xa'))[_0x834b('0xb')](',\x20'));_0x77c5fe[_0x834b('0xc')]();}else{logger[_0x834b('0xd')](_0x834b('0xe'),_0x1a3036,_0x4b4741[_0x834b('0xf')]);if(_0x4b4741[_0x834b('0xf')]){var _0x2f7874=_[_0x834b('0x10')](_0x77c5fe[_0x834b('0x11')](),{'p':_0x4b4741[_0x834b('0xf')]});if(_0x2f7874>=0x0){logger[_0x834b('0xd')](_0x834b('0x12'),_0x1a3036,_0x4b4741[_0x834b('0xf')]||_0x834b('0x13'),_0x2f7874);_0x77c5fe['next'](_0x2f7874);}else{logger[_0x834b('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1a3036,_0x4b4741['priority']||_0x834b('0x13'));_0x77c5fe[_0x834b('0xc')]();}}else{_0x77c5fe[_0x834b('0x13')]();}}}catch(_0x61b5d9){logger['error'](_0x834b('0x8'),_0x1a3036,JSON[_0x834b('0x14')](_0x61b5d9));_0x77c5fe[_0x834b('0xc')]();}};}; \ 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 cb4a159..7257d61 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 _0x5795=['Message','then','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','interaction'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x5795,0xd1));var _0x5579=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5795[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x5579('0x0'));var utils=require(_0x5579('0x1'));var logger=require(_0x5579('0x2'))(_0x5579('0x3'));var rpc={'chatMessage':require(_0x5579('0x4')),'openchannelMessage':require(_0x5579('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5579('0x6'))};exports[_0x5579('0x7')]=function(_0x57e45d,_0x3aaa1c){return function(_0x1e02f3){try{var _0x3eee07={'body':utils[_0x5579('0x8')](_0x3aaa1c[0x0],this),'ContactId':this[_0x5579('0x9')]['id']};if(this[_0x5579('0xa')]==='chat'){_0x3eee07[_0x5579('0xb')]=this[_0x5579('0xc')]['id'];}else{_0x3eee07[_['upperFirst'](this['channel'])+_0x5579('0xd')]=this[_0x5579('0xc')]['id'];}_0x3eee07[_[_0x5579('0xe')](this[_0x5579('0xa')])+'InteractionId']=this[_0x5579('0xf')]['id'];if(rpc[this['channel']+_0x5579('0x10')]){return rpc[this[_0x5579('0xa')]+_0x5579('0x10')]['create'](_0x3eee07)[_0x5579('0x11')](function(_0x255e30){logger['info']('[%s][MESSAGE]\x20%s',_0x57e45d,_0x3eee07[_0x5579('0x12')]);_0x1e02f3[_0x5579('0x13')]();})[_0x5579('0x14')](function(_0x3fe5e3){logger[_0x5579('0x15')](_0x5579('0x16'),_0x57e45d,JSON[_0x5579('0x17')](_0x3fe5e3));_0x1e02f3[_0x5579('0x18')]();});}}catch(_0x406bf9){logger[_0x5579('0x15')](_0x5579('0x16'),_0x57e45d,JSON[_0x5579('0x17')](_0x406bf9));_0x1e02f3[_0x5579('0x18')]();}};}; \ No newline at end of file +var _0x40e8=['interaction','Message','info','body','next','catch','[%s][MESSAGE]\x20%s','stop','error','stringify','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst','channel','AccountId','account','InteractionId'];(function(_0x524145,_0x2e2751){var _0x2a28f0=function(_0xe757ec){while(--_0xe757ec){_0x524145['push'](_0x524145['shift']());}};_0x2a28f0(++_0x2e2751);}(_0x40e8,0x1d5));var _0x840e=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x40e8[_0x29d915];return _0x160f86;};'use strict';var _=require('lodash');var utils=require(_0x840e('0x0'));var logger=require(_0x840e('0x1'))(_0x840e('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x840e('0x3')),'mailMessage':require(_0x840e('0x4')),'smsMessage':require(_0x840e('0x5')),'faxMessage':require(_0x840e('0x6')),'whatsappMessage':require(_0x840e('0x7'))};exports['consequence']=function(_0x1417d6,_0x53fc5e){return function(_0x3349a2){try{var _0x13184f={'body':utils[_0x840e('0x8')](_0x53fc5e[0x0],this),'ContactId':this[_0x840e('0x9')]['id']};if(this['channel']===_0x840e('0xa')){_0x13184f[_0x840e('0xb')]=this['account']['id'];}else{_0x13184f[_[_0x840e('0xc')](this[_0x840e('0xd')])+_0x840e('0xe')]=this[_0x840e('0xf')]['id'];}_0x13184f[_['upperFirst'](this[_0x840e('0xd')])+_0x840e('0x10')]=this[_0x840e('0x11')]['id'];if(rpc[this[_0x840e('0xd')]+_0x840e('0x12')]){return rpc[this[_0x840e('0xd')]+_0x840e('0x12')]['create'](_0x13184f)['then'](function(_0x37599e){logger[_0x840e('0x13')]('[%s][MESSAGE]\x20%s',_0x1417d6,_0x13184f[_0x840e('0x14')]);_0x3349a2[_0x840e('0x15')]();})[_0x840e('0x16')](function(_0x5e1769){logger['error'](_0x840e('0x17'),_0x1417d6,JSON['stringify'](_0x5e1769));_0x3349a2[_0x840e('0x18')]();});}}catch(_0x1cab67){logger[_0x840e('0x19')](_0x840e('0x17'),_0x1417d6,JSON[_0x840e('0x1a')](_0x1cab67));_0x3349a2[_0x840e('0x18')]();}};}; \ 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 0b05f70..f226191 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 _0xf26b=['stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x4424c9,_0x30e8cb){var _0x3cf991=function(_0x597dc2){while(--_0x597dc2){_0x4424c9['push'](_0x4424c9['shift']());}};_0x3cf991(++_0x30e8cb);}(_0xf26b,0xe8));var _0xbf26=function(_0x2866f9,_0xde7f6b){_0x2866f9=_0x2866f9-0x0;var _0x5ab82b=_0xf26b[_0x2866f9];return _0x5ab82b;};'use strict';var utils=require(_0xbf26('0x0'));var logger=require(_0xbf26('0x1'))('routing');exports[_0xbf26('0x2')]=function(_0x105b23,_0x21a48a){return function(_0x1e7a62){try{logger[_0xbf26('0x3')](_0xbf26('0x4'),_0x105b23,utils[_0xbf26('0x5')](_0x21a48a[0x0],this));_0x1e7a62['next']();}catch(_0x4ebccd){logger['error'](_0xbf26('0x4'),_0x105b23,JSON['stringify'](_0x4ebccd));_0x1e7a62[_0xbf26('0x6')]();}};}; \ No newline at end of file +var _0xe164=['../../../../config/logger','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','./utils'];(function(_0x5c715d,_0x46c9c2){var _0xa15a21=function(_0x1d3f4e){while(--_0x1d3f4e){_0x5c715d['push'](_0x5c715d['shift']());}};_0xa15a21(++_0x46c9c2);}(_0xe164,0x8f));var _0x4e16=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe164[_0x21a9d9];return _0x46adce;};'use strict';var utils=require(_0x4e16('0x0'));var logger=require(_0x4e16('0x1'))('routing');exports['consequence']=function(_0xbc25e3,_0x35133c){return function(_0x10b7d5){try{logger[_0x4e16('0x2')]('[%s][NOOP]\x20%s',_0xbc25e3,utils[_0x4e16('0x3')](_0x35133c[0x0],this));_0x10b7d5[_0x4e16('0x4')]();}catch(_0x51b454){logger[_0x4e16('0x5')](_0x4e16('0x6'),_0xbc25e3,JSON[_0x4e16('0x7')](_0x51b454));_0x10b7d5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6d50bae..3ce75d8 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 _0xf725=['complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','account','queue','from','joinAt','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x344d7e,_0x3f9c1f){var _0x359740=function(_0x596bd4){while(--_0x596bd4){_0x344d7e['push'](_0x344d7e['shift']());}};_0x359740(++_0x3f9c1f);}(_0xf725,0x14f));var _0x5f72=function(_0x5488e3,_0x5cff14){_0x5488e3=_0x5488e3-0x0;var _0x1c7119=_0xf725[_0x5488e3];return _0x1c7119;};'use strict';var schema=require(_0x5f72('0x0'));var _=require(_0x5f72('0x1'));var util=require(_0x5f72('0x2'));var seqqueue=require(_0x5f72('0x3'));var moment=require(_0x5f72('0x4'));var Redis=require(_0x5f72('0x5'));var config=require(_0x5f72('0x6'));var logger=require('../../../../config/logger')(_0x5f72('0x7'));var strategy=require('./strategy');config[_0x5f72('0x8')]=_[_0x5f72('0x9')](config[_0x5f72('0x8')],{'host':_0x5f72('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f72('0x8')]));var attributes=['id','queue_id',_0x5f72('0xb'),_0x5f72('0xc'),_0x5f72('0xd'),_0x5f72('0xe')];function emit(_0x3b6569,_0x18568a,_0x3fa811){io['to'](_0x3b6569)['emit'](_0x18568a,_0x3fa811);}function emitChannelQueueInteraction(_0x20e68e,_0x2bb54b,_0x5e13f3,_0x2b30fa,_0x1e0325,_0x128d18,_0x157545,_0x165c1d){var _0x1fc886=_[_0x5f72('0xf')](_0x5e13f3);_0x1fc886['queue_id']=_0x165c1d;_0x1fc886[_0x5f72('0xc')]=_0x2bb54b;_0x1fc886[_0x5f72('0xb')]=_0x2b30fa;_0x1fc886['id']=_0x1e0325;if(_0x128d18){attributes[_0x5f72('0x10')](_[_0x5f72('0x11')](_0x20e68e)+_0x5f72('0x12'));_0x157545[util['format'](_0x5f72('0x13'),_0x20e68e)][_0x1e0325]=_[_0x5f72('0x14')](_0x1fc886,attributes);}else{delete _0x157545[util[_0x5f72('0x15')]('%sQueuesWaitingInteractions',_0x20e68e)][_0x1e0325];}emit(util[_0x5f72('0x15')](_0x5f72('0x16'),_0x20e68e,_0x2bb54b),util[_0x5f72('0x15')](_0x5f72('0x17'),_0x20e68e,_0x128d18?'save':_0x5f72('0x18')),_['pick'](_0x1fc886,attributes));}var rpc={'openchannelQueueReport':require(_0x5f72('0x19')),'mailQueueReport':require(_0x5f72('0x1a')),'chatQueueReport':require(_0x5f72('0x1b')),'smsQueueReport':require(_0x5f72('0x1c')),'faxQueueReport':require(_0x5f72('0x1d')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x5f72('0x1e')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x5f72('0x1f'))};var queue=schema({'name':{'type':_0x5f72('0x20'),'required':!![],'message':_0x5f72('0x21')},'timeout':{'type':'number','message':_0x5f72('0x22')}});function startRouting(_0x58ecc0,_0x59f8c4,_0x12e3e8,_0x4540e3){if(_0x58ecc0&&_0x59f8c4&&_0x12e3e8){_0x59f8c4['waiting']+=0x1;var _0x58fad7={'uniqueid':_0x58ecc0,'from':_0x12e3e8[_0x5f72('0x23')]?_0x12e3e8[_0x5f72('0x23')][_0x5f72('0xd')]:'','joinAt':moment()[_0x5f72('0x15')](_0x5f72('0x24')),'ContactId':_0x12e3e8[_0x5f72('0x25')]?_0x12e3e8['contact']['id']:null,'ListId':_0x12e3e8['list']?_0x12e3e8[_0x5f72('0x26')]['id']:null};_0x58fad7[_[_0x5f72('0x27')](_0x12e3e8['channel'])+_0x5f72('0x28')]=_0x59f8c4['id']||null;_0x58fad7[_['upperFirst'](_0x12e3e8[_0x5f72('0x29')])+'InteractionId']=_0x12e3e8[_0x5f72('0x2a')]?_0x12e3e8[_0x5f72('0x2a')]['id']:null;_0x58fad7[_[_0x5f72('0x27')](_0x12e3e8[_0x5f72('0x29')])+_0x5f72('0x2b')]=_0x12e3e8[_0x5f72('0x2c')]?_0x12e3e8[_0x5f72('0x2c')]['id']:null;_0x58fad7[_[_0x5f72('0x27')](_0x12e3e8[_0x5f72('0x29')])+(_0x12e3e8[_0x5f72('0x29')]!==_0x5f72('0x2d')?'AccountId':'WebsiteId')]=_0x12e3e8[_0x5f72('0xb')]?_0x12e3e8[_0x5f72('0xb')]['id']:null;logger[_0x5f72('0x2e')](util[_0x5f72('0x15')](_0x5f72('0x2f'),_0x58ecc0,_0x59f8c4[_0x5f72('0x30')]));emitChannelQueueInteraction(_0x12e3e8[_0x5f72('0x29')],_0x59f8c4[_0x5f72('0x30')],_0x58fad7,_0x12e3e8[_0x5f72('0xb')][_0x5f72('0x30')],_0x12e3e8[_0x5f72('0x2c')]['id'],!![],_0x4540e3,_0x59f8c4['id']);if(rpc[_0x12e3e8['channel']+_0x5f72('0x31')]){return rpc[_0x12e3e8['channel']+_0x5f72('0x31')][_0x5f72('0x32')](_0x58fad7)['catch'](function(_0x235216){logger['error'](_0x5f72('0x33'),_0x235216);});}}}function stopRouting(_0x51fa80,_0x1a50a3,_0x654840,_0x5ca39f){if(_0x51fa80&&_0x1a50a3){_0x1a50a3['waiting']-=0x1;var _0x1e5fc1={'leaveAt':moment()[_0x5f72('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x5f72('0x24')),'reason':_0x5f72('0x34')};logger[_0x5f72('0x2e')](util[_0x5f72('0x15')](_0x5f72('0x35'),_0x51fa80,_0x1a50a3[_0x5f72('0x30')]));emitChannelQueueInteraction(_0x654840[_0x5f72('0x29')],_0x1a50a3[_0x5f72('0x30')],_0x654840[_0x5f72('0x23')],_0x654840[_0x5f72('0xb')][_0x5f72('0x30')],_0x654840[_0x5f72('0x2c')]['id'],![],_0x5ca39f,_0x1a50a3['id']);return rpc[_0x654840[_0x5f72('0x29')]+_0x5f72('0x36')]['update'](_0x654840[_0x5f72('0x2a')]['id'],{'queueId':_0x1a50a3['id']})[_0x5f72('0x37')](function(){if(rpc[_0x654840[_0x5f72('0x29')]+_0x5f72('0x31')]){return rpc[_0x654840[_0x5f72('0x29')]+_0x5f72('0x31')][_0x5f72('0x38')](_0x51fa80,_0x1e5fc1)[_0x5f72('0x39')](function(_0x4b7356){logger[_0x5f72('0x3a')](_0x5f72('0x3b'),_0x4b7356);});}});}}function endRouting(_0xd607dc,_0x46dde8,_0x2e70e4,_0x3815ae){if(_0xd607dc&&_0x46dde8){_0x46dde8['waiting']-=0x1;var _0x421fcc={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x5f72('0x24')),'reason':_0x5f72('0x3c')};logger['info'](util['format'](_0x5f72('0x3d'),_0xd607dc,_0x46dde8[_0x5f72('0x30')]));emitChannelQueueInteraction(_0x2e70e4[_0x5f72('0x29')],_0x46dde8[_0x5f72('0x30')],_0x2e70e4[_0x5f72('0x23')],_0x2e70e4[_0x5f72('0xb')]['name'],_0x2e70e4[_0x5f72('0x2c')]['id'],![],_0x3815ae);if(rpc[_0x2e70e4[_0x5f72('0x29')]+_0x5f72('0x31')]){return rpc[_0x2e70e4[_0x5f72('0x29')]+_0x5f72('0x31')]['update'](_0xd607dc,_0x421fcc)[_0x5f72('0x39')](function(_0x40fac2){logger['error']('update\x20queue\x20report',_0x40fac2);});}}}function handleFindQueue(_0x17bee0){return function(_0x403a02){return _0x403a02[_0x5f72('0x30')][_0x5f72('0x3e')]()===_0x17bee0['toLowerCase']();};}exports[_0x5f72('0x3f')]=function(_0x456858,_0x1e7da2,_0x4b6278,_0x46c0fd){return function(_0x12ab5f){try{var _0x228216={'name':_0x1e7da2[0x0],'timeout':_0x1e7da2[0x1]};var _0x45c7fb=queue['validate'](_0x228216,{'typecast':!![]});if(_0x45c7fb[_0x5f72('0x40')]){logger['error'](_0x5f72('0x41'),_0x456858,_[_0x5f72('0x42')](_0x45c7fb,_0x5f72('0x2c'))[_0x5f72('0x43')](',\x20'));_0x12ab5f[_0x5f72('0x44')]();}else{var _0x2e1eb2=_[_0x5f72('0x45')](_0x4b6278[_0x46c0fd['channel']+'Queues'],handleFindQueue(_0x228216[_0x5f72('0x30')]));if(_0x2e1eb2){startRouting(_0x456858,_0x2e1eb2,_0x46c0fd,_0x4b6278);var _0x166e21=(_0x2e1eb2[_0x5f72('0x3c')]||0xa)*0x3e8;var _0x4a7bf9=(_0x228216[_0x5f72('0x3c')]||0x14)*0x3e8;var _0x925252;if(_0x166e21>_0x4a7bf9){_0x4a7bf9=_0x166e21;}var _0x2e048a=seqqueue[_0x5f72('0x46')](_0x166e21);_0x2e048a['id']=_0x456858;_0x2e048a[_0x5f72('0x47')]=_0x166e21;_0x2e048a[_0x5f72('0x48')]=_0x4a7bf9;_0x2e048a[_0x5f72('0x29')]=_0x46c0fd[_0x5f72('0x29')];_0x4b6278[_0x5f72('0x49')][_0x456858]['on']('end',function(){logger[_0x5f72('0x2e')](_0x5f72('0x4a'),_0x456858);stopRouting(_0x456858,_0x2e1eb2,_0x46c0fd,_0x4b6278);clearTimeout(_0x925252);_0x925252=undefined;_0x2e048a['close'](!![]);if(_0x4b6278['rules'][_0x456858]){delete _0x4b6278[_0x5f72('0x49')][_0x456858];}_0x12ab5f['stop']();});_0x4b6278['rules'][_0x456858]['on'](_0x5f72('0x4b'),function(){if(_0x4b6278[_0x5f72('0x49')][_0x456858]){delete _0x4b6278[_0x5f72('0x49')][_0x456858];}});_0x925252=setTimeout(function(){logger[_0x5f72('0x2e')](_0x5f72('0x4c'),_0x456858);endRouting(_0x456858,_0x2e1eb2,_0x46c0fd,_0x4b6278);clearTimeout(_0x925252);_0x2e048a[_0x5f72('0x4d')](!![]);_0x12ab5f['next']();},_0x4a7bf9);switch(_0x2e1eb2[_0x5f72('0x4e')]){case'rrmemory':strategy[_0x5f72('0x4f')](_0x2e048a,_0x2e1eb2,_0x4b6278,_0x46c0fd);break;default:strategy[_0x5f72('0x50')](_0x2e048a,_0x2e1eb2,_0x4b6278,_0x46c0fd);}}else{logger[_0x5f72('0x3a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x456858,_0x228216[_0x5f72('0x30')]);_0x12ab5f[_0x5f72('0x44')]();}}}catch(_0x36fbe7){logger[_0x5f72('0x3a')](_0x5f72('0x41'),_0x456858,_0x36fbe7[_0x5f72('0x51')]);_0x12ab5f[_0x5f72('0x44')]();}};}; \ No newline at end of file +var _0x6755=['routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','push','capitalize','InteractionId','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','find','Queues','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','close','next','rrmemory','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger'];(function(_0x34cadd,_0x408a89){var _0x35b5d1=function(_0x5bc47d){while(--_0x5bc47d){_0x34cadd['push'](_0x34cadd['shift']());}};_0x35b5d1(++_0x408a89);}(_0x6755,0xa0));var _0x5675=function(_0x3b0123,_0x174c10){_0x3b0123=_0x3b0123-0x0;var _0x4a2df3=_0x6755[_0x3b0123];return _0x4a2df3;};'use strict';var schema=require(_0x5675('0x0'));var _=require(_0x5675('0x1'));var util=require(_0x5675('0x2'));var seqqueue=require(_0x5675('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x5675('0x4'));var logger=require(_0x5675('0x5'))(_0x5675('0x6'));var strategy=require(_0x5675('0x7'));config['redis']=_[_0x5675('0x8')](config[_0x5675('0x9')],{'host':_0x5675('0xa'),'port':0x18eb});var io=require(_0x5675('0xb'))(new Redis(config[_0x5675('0x9')]));var attributes=['id',_0x5675('0xc'),'account',_0x5675('0xd'),_0x5675('0xe'),_0x5675('0xf')];function emit(_0x3ba34f,_0x4c0ad,_0x2db306){io['to'](_0x3ba34f)[_0x5675('0x10')](_0x4c0ad,_0x2db306);}function emitChannelQueueInteraction(_0x193dff,_0x3572f4,_0x27a405,_0x454ad7,_0x326415,_0x47291b,_0x2c9b9f,_0x5372c6){var _0x4ec9a8=_[_0x5675('0x11')](_0x27a405);_0x4ec9a8[_0x5675('0xc')]=_0x5372c6;_0x4ec9a8[_0x5675('0xd')]=_0x3572f4;_0x4ec9a8[_0x5675('0x12')]=_0x454ad7;_0x4ec9a8['id']=_0x326415;if(_0x47291b){attributes[_0x5675('0x13')](_[_0x5675('0x14')](_0x193dff)+_0x5675('0x15'));_0x2c9b9f[util[_0x5675('0x16')]('%sQueuesWaitingInteractions',_0x193dff)][_0x326415]=_[_0x5675('0x17')](_0x4ec9a8,attributes);}else{delete _0x2c9b9f[util['format']('%sQueuesWaitingInteractions',_0x193dff)][_0x326415];}emit(util[_0x5675('0x16')](_0x5675('0x18'),_0x193dff,_0x3572f4),util[_0x5675('0x16')](_0x5675('0x19'),_0x193dff,_0x47291b?'save':'remove'),_[_0x5675('0x17')](_0x4ec9a8,attributes));}var rpc={'openchannelQueueReport':require(_0x5675('0x1a')),'mailQueueReport':require(_0x5675('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x5675('0x1c')),'faxQueueReport':require(_0x5675('0x1d')),'whatsappQueueReport':require(_0x5675('0x1e')),'chatInteraction':require(_0x5675('0x1f')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x5675('0x20')),'openchannelInteraction':require(_0x5675('0x21')),'smsInteraction':require(_0x5675('0x22')),'whatsappInteraction':require(_0x5675('0x23'))};var queue=schema({'name':{'type':_0x5675('0x24'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5675('0x25'),'message':_0x5675('0x26')}});function startRouting(_0x20b564,_0x58e848,_0x20479c,_0x570b96){if(_0x20b564&&_0x58e848&&_0x20479c){_0x58e848['waiting']+=0x1;var _0x68fb14={'uniqueid':_0x20b564,'from':_0x20479c['body']?_0x20479c[_0x5675('0x27')][_0x5675('0xe')]:'','joinAt':moment()['format'](_0x5675('0x28')),'ContactId':_0x20479c['contact']?_0x20479c[_0x5675('0x29')]['id']:null,'ListId':_0x20479c['list']?_0x20479c[_0x5675('0x2a')]['id']:null};_0x68fb14[_['upperFirst'](_0x20479c[_0x5675('0x2b')])+_0x5675('0x2c')]=_0x58e848['id']||null;_0x68fb14[_[_0x5675('0x2d')](_0x20479c[_0x5675('0x2b')])+_0x5675('0x15')]=_0x20479c['interaction']?_0x20479c[_0x5675('0x2e')]['id']:null;_0x68fb14[_[_0x5675('0x2d')](_0x20479c['channel'])+_0x5675('0x2f')]=_0x20479c['message']?_0x20479c[_0x5675('0x30')]['id']:null;_0x68fb14[_['upperFirst'](_0x20479c['channel'])+(_0x20479c['channel']!==_0x5675('0x31')?_0x5675('0x32'):_0x5675('0x33'))]=_0x20479c[_0x5675('0x12')]?_0x20479c['account']['id']:null;logger[_0x5675('0x34')](util[_0x5675('0x16')](_0x5675('0x35'),_0x20b564,_0x58e848[_0x5675('0x36')]));emitChannelQueueInteraction(_0x20479c['channel'],_0x58e848[_0x5675('0x36')],_0x68fb14,_0x20479c[_0x5675('0x12')]['name'],_0x20479c['message']['id'],!![],_0x570b96,_0x58e848['id']);if(rpc[_0x20479c['channel']+_0x5675('0x37')]){return rpc[_0x20479c[_0x5675('0x2b')]+_0x5675('0x37')][_0x5675('0x38')](_0x68fb14)[_0x5675('0x39')](function(_0x271baa){logger[_0x5675('0x3a')]('create\x20queue\x20report',_0x271baa);});}}}function stopRouting(_0x5a3fa8,_0x3c641a,_0x131302,_0xcf367a){if(_0x5a3fa8&&_0x3c641a){_0x3c641a['waiting']-=0x1;var _0x2a1d1b={'leaveAt':moment()[_0x5675('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x5675('0x16')](_0x5675('0x28')),'reason':_0x5675('0x3b')};logger[_0x5675('0x34')](util[_0x5675('0x16')](_0x5675('0x3c'),_0x5a3fa8,_0x3c641a[_0x5675('0x36')]));emitChannelQueueInteraction(_0x131302[_0x5675('0x2b')],_0x3c641a[_0x5675('0x36')],_0x131302[_0x5675('0x27')],_0x131302[_0x5675('0x12')][_0x5675('0x36')],_0x131302['message']['id'],![],_0xcf367a,_0x3c641a['id']);return rpc[_0x131302['channel']+'Interaction'][_0x5675('0x3d')](_0x131302[_0x5675('0x2e')]['id'],{'queueId':_0x3c641a['id']})[_0x5675('0x3e')](function(){if(rpc[_0x131302['channel']+_0x5675('0x37')]){return rpc[_0x131302[_0x5675('0x2b')]+'QueueReport'][_0x5675('0x3d')](_0x5a3fa8,_0x2a1d1b)[_0x5675('0x39')](function(_0x214eca){logger[_0x5675('0x3a')](_0x5675('0x3f'),_0x214eca);});}});}}function endRouting(_0x516320,_0x2321f6,_0x22c7f3,_0x11cee9){if(_0x516320&&_0x2321f6){_0x2321f6[_0x5675('0x40')]-=0x1;var _0x55f228={'leaveAt':moment()[_0x5675('0x16')](_0x5675('0x28')),'exitAt':moment()[_0x5675('0x16')](_0x5675('0x28')),'reason':_0x5675('0x41')};logger['info'](util[_0x5675('0x16')](_0x5675('0x42'),_0x516320,_0x2321f6[_0x5675('0x36')]));emitChannelQueueInteraction(_0x22c7f3[_0x5675('0x2b')],_0x2321f6[_0x5675('0x36')],_0x22c7f3['body'],_0x22c7f3['account'][_0x5675('0x36')],_0x22c7f3[_0x5675('0x30')]['id'],![],_0x11cee9);if(rpc[_0x22c7f3[_0x5675('0x2b')]+_0x5675('0x37')]){return rpc[_0x22c7f3['channel']+_0x5675('0x37')][_0x5675('0x3d')](_0x516320,_0x55f228)[_0x5675('0x39')](function(_0x1f891f){logger[_0x5675('0x3a')]('update\x20queue\x20report',_0x1f891f);});}}}function handleFindQueue(_0x45e43f){return function(_0x2133c4){return _0x2133c4[_0x5675('0x36')][_0x5675('0x43')]()===_0x45e43f['toLowerCase']();};}exports[_0x5675('0x44')]=function(_0x4c2b7c,_0x4a307e,_0xc5d8a6,_0x5b922b){return function(_0x5d578a){try{var _0x2a79dd={'name':_0x4a307e[0x0],'timeout':_0x4a307e[0x1]};var _0x2cc05c=queue[_0x5675('0x0')](_0x2a79dd,{'typecast':!![]});if(_0x2cc05c[_0x5675('0x45')]){logger[_0x5675('0x3a')](_0x5675('0x46'),_0x4c2b7c,_['map'](_0x2cc05c,_0x5675('0x30'))['join'](',\x20'));_0x5d578a[_0x5675('0x47')]();}else{var _0x1e81e3=_[_0x5675('0x48')](_0xc5d8a6[_0x5b922b[_0x5675('0x2b')]+_0x5675('0x49')],handleFindQueue(_0x2a79dd[_0x5675('0x36')]));if(_0x1e81e3){startRouting(_0x4c2b7c,_0x1e81e3,_0x5b922b,_0xc5d8a6);var _0x3ef510=(_0x1e81e3[_0x5675('0x41')]||0xa)*0x3e8;var _0x10cff3=(_0x2a79dd[_0x5675('0x41')]||0x14)*0x3e8;var _0x467121;if(_0x3ef510>_0x10cff3){_0x10cff3=_0x3ef510;}var _0x317880=seqqueue[_0x5675('0x4a')](_0x3ef510);_0x317880['id']=_0x4c2b7c;_0x317880['atimeout']=_0x3ef510;_0x317880[_0x5675('0x4b')]=_0x10cff3;_0x317880['channel']=_0x5b922b['channel'];_0xc5d8a6['rules'][_0x4c2b7c]['on'](_0x5675('0x4c'),function(){logger[_0x5675('0x34')](_0x5675('0x4d'),_0x4c2b7c);stopRouting(_0x4c2b7c,_0x1e81e3,_0x5b922b,_0xc5d8a6);clearTimeout(_0x467121);_0x467121=undefined;_0x317880['close'](!![]);if(_0xc5d8a6[_0x5675('0x4e')][_0x4c2b7c]){delete _0xc5d8a6[_0x5675('0x4e')][_0x4c2b7c];}_0x5d578a[_0x5675('0x47')]();});_0xc5d8a6[_0x5675('0x4e')][_0x4c2b7c]['on'](_0x5675('0x4f'),function(){if(_0xc5d8a6[_0x5675('0x4e')][_0x4c2b7c]){delete _0xc5d8a6[_0x5675('0x4e')][_0x4c2b7c];}});_0x467121=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4c2b7c);endRouting(_0x4c2b7c,_0x1e81e3,_0x5b922b,_0xc5d8a6);clearTimeout(_0x467121);_0x317880[_0x5675('0x50')](!![]);_0x5d578a[_0x5675('0x51')]();},_0x10cff3);switch(_0x1e81e3['strategy']){case _0x5675('0x52'):strategy[_0x5675('0x52')](_0x317880,_0x1e81e3,_0xc5d8a6,_0x5b922b);break;default:strategy['beepall'](_0x317880,_0x1e81e3,_0xc5d8a6,_0x5b922b);}}else{logger[_0x5675('0x3a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4c2b7c,_0x2a79dd[_0x5675('0x36')]);_0x5d578a[_0x5675('0x47')]();}}}catch(_0xff6373){logger[_0x5675('0x3a')](_0x5675('0x46'),_0x4c2b7c,_0xff6373['stack']);_0x5d578a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index d87e379..ddcbc59 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 _0xa37e=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','agent','bind','handleTimeout','prototype','push','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','realtime','channel','busy','busyQueue','writeLog','RINGING','debug'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xa37e,0x97));var _0xea37=function(_0x3cca01,_0x51ea50){_0x3cca01=_0x3cca01-0x0;var _0x56cb82=_0xa37e[_0x3cca01];return _0x56cb82;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));var Agent=function(_0x475c71,_0x5430aa,_0x3cabb8,_0x537c5a){this[_0xea37('0x3')]=uuid['v4']();this[_0xea37('0x4')]=_0x475c71;this[_0xea37('0x5')]=_0x5430aa;this['realtime']=_0x3cabb8;this['routing']=_0x537c5a;this[_0xea37('0x4')]['push'](this['handleRun'][_0xea37('0x6')](this),this[_0xea37('0x7')][_0xea37('0x6')](this));this[_0xea37('0x4')]['on']('timeout',this[_0xea37('0x7')][_0xea37('0x6')](this));this[_0xea37('0x4')]['on']('drained',this['handleDrained'][_0xea37('0x6')](this));};Agent[_0xea37('0x8')][_0xea37('0x9')]=function(){this['squeue'][_0xea37('0x9')](this[_0xea37('0xa')][_0xea37('0x6')](this),this['handleTimeout'][_0xea37('0x6')](this));};Agent[_0xea37('0x8')]['handleDrained']=function(){this[_0xea37('0x7')](!![]);};Agent['prototype'][_0xea37('0xa')]=function(){logger['debug'](_0xea37('0xb'),this[_0xea37('0x4')]['id'],this[_0xea37('0x5')]['id']);if(_[_0xea37('0xc')](this['realtime'][_0xea37('0xd')][this['agent']['id']])){logger['debug'](_0xea37('0xe'),this['squeue']['id'],this[_0xea37('0x5')]['id']);setTimeout(this[_0xea37('0x9')]['bind'](this),0x3e8);}else{if(this[_0xea37('0x2')][_0xea37('0xf')]||util['isAgentAvailable'](this[_0xea37('0x4')]['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],this[_0xea37('0x4')][_0xea37('0x11')],![])){this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x12')]=!![];this['realtime'][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x13')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0xea37('0x2')],this[_0xea37('0x5')],this[_0xea37('0x4')][_0xea37('0x11')]);util['showNotification'](this[_0xea37('0x3')],this['squeue']['id'],this['realtime']['agents'][this[_0xea37('0x5')]['id']],null,this['routing']);util[_0xea37('0x14')](this[_0xea37('0x4')]['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],_0xea37('0x15')+(this['routing'][_0xea37('0xf')]?':FORCED':''));}else{logger[_0xea37('0x16')](_0xea37('0x17'),this['squeue']['id'],this[_0xea37('0x5')]['id']);setTimeout(this[_0xea37('0x9')][_0xea37('0x6')](this),0x3e8);}}};Agent['prototype'][_0xea37('0x7')]=function(_0x366acb){if(_[_0xea37('0xc')](this[_0xea37('0x10')]['agents'][this[_0xea37('0x5')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xea37('0x4')]['id'],this['agent']['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xea37('0x4')]['id'],this[_0xea37('0x5')]['id']);util[_0xea37('0x18')](this[_0xea37('0x3')],this[_0xea37('0x4')]['id'],this[_0xea37('0x10')]['agents'][this[_0xea37('0x5')]['id']],null,this[_0xea37('0x2')]);this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']][_0xea37('0x12')]=![];this['realtime'][_0xea37('0xd')][this['agent']['id']][_0xea37('0x13')]=undefined;util[_0xea37('0x19')](this[_0xea37('0x10')],this[_0xea37('0x2')],this[_0xea37('0x5')],this[_0xea37('0x4')][_0xea37('0x11')]);util[_0xea37('0x14')](this['squeue']['id'],this[_0xea37('0x10')][_0xea37('0xd')][this[_0xea37('0x5')]['id']],_0x366acb?_0xea37('0x1a'):_0xea37('0x1b'));}if(!_0x366acb){setTimeout(this[_0xea37('0x9')]['bind'](this),0x3e8);}};function agent(_0x499388,_0x4feaf1,_0x1877eb,_0x5453da){return new Agent(_0x499388,_0x4feaf1,_0x1877eb,_0x5453da);}module[_0xea37('0x1c')]=agent; \ No newline at end of file +var _0xed1f=['RINGING','forcedOwnership',':FORCED','debug','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','busy','busyQueue'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xed1f,0x6a));var _0xfed1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xed1f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xfed1('0x0'));var uuid=require(_0xfed1('0x1'));var util=require(_0xfed1('0x2'));var logger=require(_0xfed1('0x3'))(_0xfed1('0x4'));var Agent=function(_0x25f345,_0x1dd614,_0xa68587,_0x2209b3){this[_0xfed1('0x5')]=uuid['v4']();this[_0xfed1('0x6')]=_0x25f345;this[_0xfed1('0x7')]=_0x1dd614;this[_0xfed1('0x8')]=_0xa68587;this[_0xfed1('0x4')]=_0x2209b3;this[_0xfed1('0x6')][_0xfed1('0x9')](this[_0xfed1('0xa')][_0xfed1('0xb')](this),this['handleTimeout'][_0xfed1('0xb')](this));this[_0xfed1('0x6')]['on']('timeout',this[_0xfed1('0xc')][_0xfed1('0xb')](this));this['squeue']['on'](_0xfed1('0xd'),this['handleDrained'][_0xfed1('0xb')](this));};Agent[_0xfed1('0xe')]['push']=function(){this['squeue'][_0xfed1('0x9')](this[_0xfed1('0xa')]['bind'](this),this[_0xfed1('0xc')]['bind'](this));};Agent['prototype'][_0xfed1('0xf')]=function(){this[_0xfed1('0xc')](!![]);};Agent['prototype'][_0xfed1('0xa')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xfed1('0x6')]['id'],this[_0xfed1('0x7')]['id']);if(_[_0xfed1('0x10')](this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']])){logger['debug'](_0xfed1('0x11'),this[_0xfed1('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xfed1('0x9')][_0xfed1('0xb')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this[_0xfed1('0x6')]['id'],this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],this['squeue'][_0xfed1('0x13')],![])){this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']][_0xfed1('0x14')]=!![];this[_0xfed1('0x8')][_0xfed1('0x12')][this['agent']['id']][_0xfed1('0x15')]=undefined;util['saveWaitingNotification'](this[_0xfed1('0x8')],this[_0xfed1('0x4')],this[_0xfed1('0x7')],this['squeue'][_0xfed1('0x13')]);util['showNotification'](this[_0xfed1('0x5')],this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],null,this[_0xfed1('0x4')]);util['writeLog'](this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']],_0xfed1('0x16')+(this[_0xfed1('0x4')][_0xfed1('0x17')]?_0xfed1('0x18'):''));}else{logger[_0xfed1('0x19')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xfed1('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xfed1('0x9')]['bind'](this),0x3e8);}}};Agent['prototype'][_0xfed1('0xc')]=function(_0x42c950){if(_[_0xfed1('0x10')](this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']])){return logger[_0xfed1('0x19')](_0xfed1('0x11'),this[_0xfed1('0x6')]['id'],this[_0xfed1('0x7')]['id']);}else{logger['debug'](_0xfed1('0x1a'),this[_0xfed1('0x6')]['id'],this['agent']['id']);util['hideNotification'](this[_0xfed1('0x5')],this[_0xfed1('0x6')]['id'],this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],null,this['routing']);this[_0xfed1('0x8')][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']][_0xfed1('0x14')]=![];this[_0xfed1('0x8')]['agents'][this[_0xfed1('0x7')]['id']]['busyQueue']=undefined;util[_0xfed1('0x1b')](this[_0xfed1('0x8')],this[_0xfed1('0x4')],this[_0xfed1('0x7')],this[_0xfed1('0x6')][_0xfed1('0x13')]);util[_0xfed1('0x1c')](this[_0xfed1('0x6')]['id'],this['realtime'][_0xfed1('0x12')][this[_0xfed1('0x7')]['id']],_0x42c950?_0xfed1('0x1d'):_0xfed1('0x1e'));}if(!_0x42c950){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x42d5df,_0x3c026d,_0x1d06af,_0x1105bd){return new Agent(_0x42d5df,_0x3c026d,_0x1d06af,_0x1105bd);}module[_0xfed1('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 899a35f..60df6e1 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 _0x2637=['lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue','realtime','push','bind','timeout','handleTimeout','drained','prototype','handleRun','handleDrained','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','RINGING','busyQueue','name','saveWaitingNotification','channel','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy'];(function(_0x2a0755,_0xdf6bac){var _0x3eaf4f=function(_0x7a9a84){while(--_0x7a9a84){_0x2a0755['push'](_0x2a0755['shift']());}};_0x3eaf4f(++_0xdf6bac);}(_0x2637,0x118));var _0x7263=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2637[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x7263('0x0'));var uuid=require(_0x7263('0x1'));var util=require(_0x7263('0x2'));var logger=require(_0x7263('0x3'))(_0x7263('0x4'));var Beepall=function(_0x35e50d,_0x5cc1fb,_0x15d413,_0x1c6e9c){this['notificationId']=uuid['v4']();this[_0x7263('0x5')]=_0x35e50d;this[_0x7263('0x6')]=_0x5cc1fb;this[_0x7263('0x7')]=_0x15d413;this[_0x7263('0x4')]=_0x1c6e9c;this['squeue'][_0x7263('0x8')](this['handleRun'][_0x7263('0x9')](this),this['handleTimeout'][_0x7263('0x9')](this));this[_0x7263('0x5')]['on'](_0x7263('0xa'),this[_0x7263('0xb')][_0x7263('0x9')](this));this['squeue']['on'](_0x7263('0xc'),this['handleDrained']['bind'](this));};Beepall[_0x7263('0xd')][_0x7263('0x8')]=function(){this[_0x7263('0x5')]['push'](this[_0x7263('0xe')][_0x7263('0x9')](this),this[_0x7263('0xb')][_0x7263('0x9')](this));};Beepall[_0x7263('0xd')][_0x7263('0xf')]=function(){this[_0x7263('0xb')](!![]);};Beepall[_0x7263('0xd')][_0x7263('0xe')]=function(){var _0x18f190=!![];if(!_['isNil'](this[_0x7263('0x6')])&&!_[_0x7263('0x10')](this['queue'][_0x7263('0x11')])&&this['queue'][_0x7263('0x11')][_0x7263('0x12')]>0x0){for(var _0x305d18=0x0,_0x3faf07;_0x305d180x0){for(var _0x5f1e76=0x0,_0x4492ae;_0x5f1e760x0&&_0x392dfe[_0x303f4f+_0x02cd('0x1e')]>=_0x392dfe[_0x303f4f+_0x02cd('0x1d')]){writeLog(_0x33a384,_0x392dfe,_0x303f4f['toUpperCase']()+_0x02cd('0x1f'));return![];}}return!![];};exports[_0x02cd('0x20')]=function(_0x1adbc1,_0x3b4274,_0x2db248,_0x2762ba,_0x14966f){return sendNotification(!![],_0x1adbc1,_0x3b4274,_0x2db248,_0x2762ba,_0x14966f);};exports[_0x02cd('0x21')]=function(_0x1f786a,_0xfa65dc,_0x53e80a,_0x139d7f,_0x894994){return sendNotification(![],_0x1f786a,_0xfa65dc,_0x53e80a,_0x139d7f,_0x894994);};exports[_0x02cd('0x22')]=function(_0xd9f5a6,_0x212b7d,_0x3a0666){var _0x272df6=_0x212b7d[_0x02cd('0x23')][_0x02cd('0x24')];if(!_0x272df6&&_0x3a0666){_0x272df6=_0x3a0666['id'];}var _0x4cd505=_[_0x02cd('0x25')](_0xd9f5a6[_0x212b7d[_0x02cd('0x26')]+_0x02cd('0x27')],function(_0x3e0fff){var _0x1c1a8d=_[_0x02cd('0x28')](_0x212b7d['channel'])+_0x02cd('0x29');return _0x3e0fff[_0x1c1a8d]===_0x212b7d[_0x02cd('0x23')]['id'];});if(!_0x4cd505&&_0x272df6&&_0xd9f5a6['agents'][_0x272df6]){_0x4cd505=_[_0x02cd('0x25')](_0xd9f5a6[_0x02cd('0x2a')][_0x272df6][_0x212b7d[_0x02cd('0x26')]+'WaitingInteractions'],function(_0x1e36c0){return _0x1e36c0['id']===_0x212b7d[_0x02cd('0x23')]['id'];});}return _0x4cd505;};exports['saveWaitingNotification']=function(_0x421951,_0x3749a8,_0xcaa5f2,_0x47e9f9){if(_0xcaa5f2&&_0xcaa5f2['id']&&_0x421951[_0x02cd('0x2a')]&&_0x421951[_0x02cd('0x2a')][_0xcaa5f2['id']]){_0x421951[_0x02cd('0x2a')][_0xcaa5f2['id']][_0x47e9f9+_0x02cd('0x2b')][_0x3749a8['message']['id']]={'id':_0x3749a8[_0x02cd('0x23')]['id']};}};exports[_0x02cd('0x2c')]=function(_0x46568f,_0x251766,_0x663254,_0x40b54e){if(_0x663254&&_0x663254['id']&&_0x46568f['agents']&&_0x46568f['agents'][_0x663254['id']]){delete _0x46568f[_0x02cd('0x2a')][_0x663254['id']][_0x40b54e+_0x02cd('0x2b')][_0x251766[_0x02cd('0x2d')]['id']];}};exports[_0x02cd('0x2e')]=writeLog; \ No newline at end of file +var _0xd8a7=['split','\x20interaction','account','notificationShake','body','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','online','OFFLINE','Pause','PAUSE','Capacity','CurrentCapacity','showNotification','checkWaitingNotifications','interaction','UserId','some','QueuesWaitingInteractions','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','../../../../../config/environment','../../../../../config/logger','routing','defaults','localhost','redis','format','user:%s','name','emit','user:save'];(function(_0x48b746,_0x449866){var _0x50abe3=function(_0x50a07a){while(--_0x50a07a){_0x48b746['push'](_0x48b746['shift']());}};_0x50abe3(++_0x449866);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x43071b,_0x1ce820){_0x43071b=_0x43071b-0x0;var _0x5553ff=_0xd8a7[_0x43071b];return _0x5553ff;};'use strict';var _=require(_0x7d8a('0x0'));var util=require('util');var utils=require('../utils');var Redis=require('ioredis');var config=require(_0x7d8a('0x1'));var logger=require(_0x7d8a('0x2'))(_0x7d8a('0x3'));config['redis']=_[_0x7d8a('0x4')](config['redis'],{'host':_0x7d8a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7d8a('0x6')]));function sendNotification(_0x530308,_0x1cf673,_0x28ea08,_0x240123,_0x58ead1,_0x3207cc){io['to'](util[_0x7d8a('0x7')](_0x7d8a('0x8'),_0x240123[_0x7d8a('0x9')]))[_0x7d8a('0xa')](_0x7d8a('0xb'),_0x240123);var _0x23f181=_0x3207cc||{};var _0x4440af=_0x28ea08[_0x7d8a('0xc')]('.');var _0x3999c7={'uniqueid':_0x1cf673,'channel':_0x4440af[0x0],'id':_0x4440af[0x1],'title':_0x4440af[0x0]+_0x7d8a('0xd'),'interactionId':_0x4440af[0x2],'queue':_0x58ead1?_0x58ead1[_0x7d8a('0x9')]:null,'sound':_0x23f181[_0x7d8a('0xe')]['notificationSound'],'shake':_0x23f181[_0x7d8a('0xe')][_0x7d8a('0xf')]};try{if(!_0x23f181[_0x7d8a('0x10')]){_0x23f181[_0x7d8a('0x10')]={};}if(_0x58ead1){_0x23f181[_0x7d8a('0x10')]['queue']=_0x58ead1;}else if(_0x23f181[_0x7d8a('0x10')]['queue']){delete _0x23f181[_0x7d8a('0x10')]['queue'];}_0x3999c7[_0x7d8a('0x11')]=utils['getMustacheRender'](_0x23f181[_0x7d8a('0xe')][_0x7d8a('0x12')],_0x23f181);}catch(_0x52ec93){_0x3999c7[_0x7d8a('0x11')]=_0x7d8a('0x13');logger[_0x7d8a('0x14')](util[_0x7d8a('0x7')]('[%s][QUEUE]\x20%s',_0x1cf673,_0x52ec93[_0x7d8a('0x15')]));}io['to'](util[_0x7d8a('0x7')]('user:%s',_0x240123[_0x7d8a('0x9')]))[_0x7d8a('0xa')](util['format'](_0x7d8a('0x16'),_0x530308?_0x7d8a('0x17'):_0x7d8a('0x18')),_0x3999c7);}function writeLog(_0x2b74ed,_0x29d826,_0x9fdf1f){return logger[_0x7d8a('0x19')](util[_0x7d8a('0x7')](_0x7d8a('0x1a'),_0x2b74ed,_0x29d826[_0x7d8a('0x9')],_0x9fdf1f));}exports[_0x7d8a('0x1b')]=function(_0x8bacd,_0xdbee48,_0x4cc9ec,_0x478375){if(_0xdbee48['busy']){writeLog(_0x8bacd,_0xdbee48,'BUSY');return![];}if(!_0xdbee48[_0x7d8a('0x1c')]){writeLog(_0x8bacd,_0xdbee48,_0x7d8a('0x1d'));return![];}if(_0xdbee48[_0x4cc9ec+_0x7d8a('0x1e')]){writeLog(_0x8bacd,_0xdbee48,_0x7d8a('0x1f'));return![];}if(_0x478375&&_0xdbee48['hasOwnProperty'](_0x4cc9ec+_0x7d8a('0x20'))&&_0xdbee48['hasOwnProperty'](_0x4cc9ec+_0x7d8a('0x21'))){if(_0xdbee48[_0x4cc9ec+_0x7d8a('0x20')]>0x0&&_0xdbee48[_0x4cc9ec+'CurrentCapacity']>=_0xdbee48[_0x4cc9ec+_0x7d8a('0x20')]){writeLog(_0x8bacd,_0xdbee48,_0x4cc9ec['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x7d8a('0x22')]=function(_0x5c7aef,_0x260eb3,_0x38cd5e,_0x417311,_0x3ded5e){return sendNotification(!![],_0x5c7aef,_0x260eb3,_0x38cd5e,_0x417311,_0x3ded5e);};exports['hideNotification']=function(_0x1454c2,_0x358494,_0x3af432,_0x124fab,_0x2031c7){return sendNotification(![],_0x1454c2,_0x358494,_0x3af432,_0x124fab,_0x2031c7);};exports[_0x7d8a('0x23')]=function(_0x370ee6,_0x4837fd,_0x112e99){var _0x5ed101=_0x4837fd[_0x7d8a('0x24')][_0x7d8a('0x25')];if(!_0x5ed101&&_0x112e99){_0x5ed101=_0x112e99['id'];}var _0x174ec8=_[_0x7d8a('0x26')](_0x370ee6[_0x4837fd['channel']+_0x7d8a('0x27')],function(_0x363e4a){var _0x519fc2=_['capitalize'](_0x4837fd[_0x7d8a('0x28')])+_0x7d8a('0x29');return _0x363e4a[_0x519fc2]===_0x4837fd[_0x7d8a('0x24')]['id'];});if(!_0x174ec8&&_0x5ed101&&_0x370ee6[_0x7d8a('0x2a')][_0x5ed101]){_0x174ec8=_['some'](_0x370ee6[_0x7d8a('0x2a')][_0x5ed101][_0x4837fd[_0x7d8a('0x28')]+_0x7d8a('0x2b')],function(_0x5c5419){return _0x5c5419['id']===_0x4837fd[_0x7d8a('0x24')]['id'];});}return _0x174ec8;};exports[_0x7d8a('0x2c')]=function(_0x1fc56a,_0x45841d,_0x2b466a,_0x5f2e14){if(_0x2b466a&&_0x2b466a['id']&&_0x1fc56a[_0x7d8a('0x2a')]&&_0x1fc56a[_0x7d8a('0x2a')][_0x2b466a['id']]){_0x1fc56a[_0x7d8a('0x2a')][_0x2b466a['id']][_0x5f2e14+_0x7d8a('0x2b')][_0x45841d[_0x7d8a('0x15')]['id']]={'id':_0x45841d[_0x7d8a('0x24')]['id']};}};exports[_0x7d8a('0x2d')]=function(_0x1c1d83,_0x3c8ba5,_0x41e686,_0x381f39){if(_0x41e686&&_0x41e686['id']&&_0x1c1d83[_0x7d8a('0x2a')]&&_0x1c1d83[_0x7d8a('0x2a')][_0x41e686['id']]){delete _0x1c1d83[_0x7d8a('0x2a')][_0x41e686['id']][_0x381f39+_0x7d8a('0x2b')][_0x3c8ba5[_0x7d8a('0x15')]['id']];}};exports[_0x7d8a('0x2e')]=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 c72136b..bc8c049 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 _0x7fa6=['stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x7fa6,0xb1));var _0x67fa=function(_0x1b9530,_0x4d2106){_0x1b9530=_0x1b9530-0x0;var _0x74d78d=_0x7fa6[_0x1b9530];return _0x74d78d;};'use strict';var schema=require(_0x67fa('0x0'));var sh=require(_0x67fa('0x1'));var _=require('lodash');var utils=require(_0x67fa('0x2'));var logger=require(_0x67fa('0x3'))(_0x67fa('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x67fa('0x5')]=function(_0x43047b,_0x5839f8){return function(_0x2b82a7){try{var _0x29d5c4={'command':_0x5839f8[0x0]};var _0x47aedd=system[_0x67fa('0x0')](_0x29d5c4,{'typecast':!![]});if(_0x47aedd[_0x67fa('0x6')]){logger[_0x67fa('0x7')](_0x67fa('0x8'),_0x43047b,_[_0x67fa('0x9')](_0x47aedd,_0x67fa('0xa'))[_0x67fa('0xb')](',\x20'));logger[_0x67fa('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x43047b);_0x2b82a7[_0x67fa('0xd')]();}else{var _0x2177e3=this;var _0x470dbc=utils[_0x67fa('0xe')](_0x5839f8[0x0],this);logger[_0x67fa('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x43047b,_0x470dbc);sh[_0x67fa('0xf')](_['trim'](_0x470dbc),function(_0x3c1351,_0x105eef){logger['info'](_0x67fa('0x10'),_0x43047b,_0x3c1351);if(_0x3c1351==0x0){var _0x1484cd=_0x105eef[_0x67fa('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5839f8[0x1])||_[_0x67fa('0x12')](_0x5839f8[0x1])){logger[_0x67fa('0xc')](_0x67fa('0x13'),_0x43047b);_0x2177e3[_0x67fa('0x14')][_0x5839f8[0x1]]=_0x1484cd;}else{logger[_0x67fa('0xc')](_0x67fa('0x15'),_0x43047b,_0x5839f8[0x1],_0x1484cd);_0x2177e3[_0x67fa('0x14')][_0x5839f8[0x1]]=_0x1484cd;}}_0x2b82a7['next']();});}}catch(_0x3470c0){logger['error'](_0x67fa('0x8'),_0x43047b,_[_0x67fa('0x16')](_0x3470c0)?JSON[_0x67fa('0x17')](_0x3470c0):_0x3470c0);logger[_0x67fa('0xc')](_0x67fa('0x18'),_0x43047b);_0x2b82a7[_0x67fa('0xd')]();}};}; \ No newline at end of file +var _0xc46a=['[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xc46a,0x10c));var _0xac46=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xc46a[_0xaaf2e2];return _0x28bc36;};'use strict';var schema=require('validate');var sh=require(_0xac46('0x0'));var _=require(_0xac46('0x1'));var utils=require('./utils');var logger=require(_0xac46('0x2'))(_0xac46('0x3'));var system=schema({'command':{'type':_0xac46('0x4'),'required':!![],'message':_0xac46('0x5')}});exports['consequence']=function(_0x488919,_0x34fd10){return function(_0x501b4d){try{var _0x2ed93e={'command':_0x34fd10[0x0]};var _0x1b2397=system[_0xac46('0x6')](_0x2ed93e,{'typecast':!![]});if(_0x1b2397['length']){logger[_0xac46('0x7')](_0xac46('0x8'),_0x488919,_[_0xac46('0x9')](_0x1b2397,_0xac46('0xa'))[_0xac46('0xb')](',\x20'));logger[_0xac46('0xc')](_0xac46('0xd'),_0x488919);_0x501b4d['next']();}else{var _0x2a7b56=this;var _0x46251e=utils['getMustacheRender'](_0x34fd10[0x0],this);logger[_0xac46('0xc')](_0xac46('0xe'),_0x488919,_0x46251e);sh[_0xac46('0xf')](_['trim'](_0x46251e),function(_0x55d62d,_0x46f3ed){logger[_0xac46('0xc')](_0xac46('0x10'),_0x488919,_0x55d62d);if(_0x55d62d==0x0){var _0x204ebd=_0x46f3ed[_0xac46('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x34fd10[0x1])||_[_0xac46('0x12')](_0x34fd10[0x1])){logger['info'](_0xac46('0x13'),_0x488919);_0x2a7b56[_0xac46('0x14')][_0x34fd10[0x1]]=_0x204ebd;}else{logger['info'](_0xac46('0x15'),_0x488919,_0x34fd10[0x1],_0x204ebd);_0x2a7b56[_0xac46('0x14')][_0x34fd10[0x1]]=_0x204ebd;}}_0x501b4d['next']();});}}catch(_0x2186d4){logger[_0xac46('0x7')]('[%s][SYSTEM]\x20%s',_0x488919,_['isObject'](_0x2186d4)?JSON[_0xac46('0x16')](_0x2186d4):_0x2186d4);logger['info'](_0xac46('0xd'),_0x488919);_0x501b4d['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 9be8595..6c0a79e 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 _0x5b01=['validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b01,0x1c3));var _0x15b0=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x5b01[_0x298ed3];return _0x5aad28;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x15b0('0x0')),'smsInteraction':require(_0x15b0('0x1')),'mailInteraction':require(_0x15b0('0x2')),'faxInteraction':require(_0x15b0('0x3')),'whatsappInteraction':require(_0x15b0('0x4'))};var logger=require(_0x15b0('0x5'))('routing');var tag=schema({'tag':{'type':_0x15b0('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x15b0('0x7')]=function(_0x4d74c3,_0x50240b,_0x4c9e6d,_0x1c3e00){return function(_0x54ed85){try{var _0x530b9f={'tag':_0x50240b[0x0]};var _0x212985=tag[_0x15b0('0x8')](_0x530b9f,{'typecast':!![]});if(_0x212985[_0x15b0('0x9')]){logger[_0x15b0('0xa')](_0x15b0('0xb'),_0x4d74c3,_[_0x15b0('0xc')](_0x212985,_0x15b0('0xd'))[_0x15b0('0xe')](',\x20'));logger[_0x15b0('0xf')](_0x15b0('0x10'),_0x4d74c3);_0x54ed85[_0x15b0('0x11')]();}else{var _0x4bdc72={'ids':[_0x50240b[0x0]]};if(rpc[_0x1c3e00['channel']+_0x15b0('0x12')]){rpc[_0x1c3e00[_0x15b0('0x13')]+_0x15b0('0x12')][_0x15b0('0x14')](_0x1c3e00[_0x15b0('0x15')]['id'],_0x4bdc72)[_0x15b0('0x16')](function(_0x20ae2d){logger['info'](_0x15b0('0x17'),_0x4d74c3,_0x50240b[0x1],_0x1c3e00[_0x15b0('0x13')],_0x1c3e00[_0x15b0('0x15')]['id']);})[_0x15b0('0x18')](function(_0x11a413){logger[_0x15b0('0xa')](_0x15b0('0xb'),_0x4d74c3,JSON[_0x15b0('0x19')](_0x11a413));logger[_0x15b0('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4d74c3);})[_0x15b0('0x1a')](function(){_0x54ed85['next']();});}}}catch(_0x1806d0){logger['error'](_0x15b0('0xb'),_0x4d74c3,_['isObject'](_0x1806d0)?JSON['stringify'](_0x1806d0):_0x1806d0);logger[_0x15b0('0xf')](_0x15b0('0x10'),_0x4d74c3);_0x54ed85[_0x15b0('0x11')]();}};}; \ No newline at end of file +var _0x54e9=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','info','finally','isObject','stringify','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x54e9,0x15d));var _0x954e=function(_0xfa4fba,_0x46ec03){_0xfa4fba=_0xfa4fba-0x0;var _0x2f7f81=_0x54e9[_0xfa4fba];return _0x2f7f81;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x954e('0x0')),'openchannelInteraction':require(_0x954e('0x1')),'smsInteraction':require(_0x954e('0x2')),'mailInteraction':require(_0x954e('0x3')),'faxInteraction':require(_0x954e('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x954e('0x5'))(_0x954e('0x6'));var tag=schema({'tag':{'type':_0x954e('0x7'),'required':!![],'message':_0x954e('0x8')}});exports[_0x954e('0x9')]=function(_0x24d19d,_0x1e324c,_0x1dd04f,_0x345733){return function(_0x2f4a61){try{var _0x3a41aa={'tag':_0x1e324c[0x0]};var _0x4c4d48=tag[_0x954e('0xa')](_0x3a41aa,{'typecast':!![]});if(_0x4c4d48['length']){logger[_0x954e('0xb')](_0x954e('0xc'),_0x24d19d,_[_0x954e('0xd')](_0x4c4d48,_0x954e('0xe'))[_0x954e('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x24d19d);_0x2f4a61[_0x954e('0x10')]();}else{var _0x33f0ac={'ids':[_0x1e324c[0x0]]};if(rpc[_0x345733['channel']+_0x954e('0x11')]){rpc[_0x345733[_0x954e('0x12')]+_0x954e('0x11')]['addTags'](_0x345733[_0x954e('0x13')]['id'],_0x33f0ac)[_0x954e('0x14')](function(_0x2ba93c){logger['info'](_0x954e('0x15'),_0x24d19d,_0x1e324c[0x1],_0x345733['channel'],_0x345733[_0x954e('0x13')]['id']);})[_0x954e('0x16')](function(_0xd11bc2){logger['error']('[%s][TAG]\x20%s',_0x24d19d,JSON['stringify'](_0xd11bc2));logger[_0x954e('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x24d19d);})[_0x954e('0x18')](function(){_0x2f4a61[_0x954e('0x10')]();});}}}catch(_0x178c3a){logger[_0x954e('0xb')](_0x954e('0xc'),_0x24d19d,_[_0x954e('0x19')](_0x178c3a)?JSON[_0x954e('0x1a')](_0x178c3a):_0x178c3a);logger[_0x954e('0x17')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x24d19d);_0x2f4a61[_0x954e('0x10')]();}};}; \ 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 713ae1d..dc29e1f 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 _0x3601=['then','stop','catch','error','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','method','login','params','utf8','application/json-rpc','parse','result','logged','channelId=','&serviceId=','&data=','stringify'];(function(_0xb7a5b4,_0x500657){var _0x5186ce=function(_0x1a0139){while(--_0x1a0139){_0xb7a5b4['push'](_0xb7a5b4['shift']());}};_0x5186ce(++_0x500657);}(_0x3601,0x152));var _0x1360=function(_0x3b2666,_0x3bcf4c){_0x3b2666=_0x3b2666-0x0;var _0x5bd634=_0x3601[_0x3b2666];return _0x5bd634;};'use strict';var rp=require(_0x1360('0x0'));var logger=require('../../../../config/logger')(_0x1360('0x1'));var _=require('lodash');var arr=[];exports[_0x1360('0x2')]=function(_0x1f3b8e,_0x1a0420){return function(_0x593de7){var _0x18cb3b=_0x1a0420[0xa];var _0x57c8ad=_0x1a0420[0xb];var _0x1782f4=_0x1a0420[0xc];var _0x5a475e=_0x1a0420[0xd];var _0x5b01e4=_0x1a0420[0xe];var _0x4a034a=_0x1a0420[0xf][_0x1360('0x3')](/\n/g,_0x1360('0x4'));var _0x316a11=_0x1a0420[0x10][_0x1360('0x3')](/\n/g,'\x20');if(!arr['includes'](_0x57c8ad)){arr[_0x1360('0x5')](_0x57c8ad);var _0x2e0c9c=_0x1a0420[0x3];var _0x2976ac=_0x1a0420[0x4];var _0x23bde9=_0x1a0420[0x1];var _0x56774c=_0x1a0420[0x0];var _0x3285f6={};_0x3285f6[_0x1360('0x6')]=_0x1a0420[0x8]+'?params='+_0x1782f4+'|'+_0x18cb3b+'|'+_0x5a475e+'|'+_0x57c8ad+'|'+_0x5b01e4;_0x3285f6[_0x1360('0x7')]=_0x1a0420[0x7]+_0x1360('0x8')+_0x1782f4+'|'+_0x18cb3b+'|'+_0x5a475e+'|'+_0x57c8ad+'|'+_0x5b01e4+'|'+_0x4a034a+'|'+_0x316a11;_0x3285f6[_0x1360('0x9')]=_0x1a0420[0x9];var _0xf1444e={};_0xf1444e['jsonrpc']='2.0';_0xf1444e[_0x1360('0xa')]=_0x1360('0xb');var _0x4bd354=[];_0x4bd354[_0x1360('0x5')](_0x1a0420[0x2]);_0x4bd354[_0x1360('0x5')](_0x1a0420[0x5]);_0x4bd354['push'](_0x1a0420[0x6]);_0xf1444e[_0x1360('0xc')]=_0x4bd354;_0xf1444e['id']=0x1;var _0x54a9bb=JSON['stringify'](_0xf1444e);var _0x44433a={'encoding':_0x1360('0xd'),'method':'POST','timeout':0x2710,'url':_0x2e0c9c,'headers':{'Content-Type':_0x1360('0xe')},'body':_0x54a9bb};return rp(_0x44433a)['then'](function(_0x3a2dc3){const _0xf55a08=JSON[_0x1360('0xf')](_0x3a2dc3);if(!_0xf55a08[_0x1360('0x10')][_0x1360('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x341104=_0x57c8ad;var _0x30a297=_0x1360('0x12')+_0x23bde9+_0x1360('0x13')+_0x56774c+'&sessionId='+_0x341104+_0x1360('0x14')+JSON[_0x1360('0x15')](_0x3285f6);var _0x3fe584=_0x2976ac+'?'+_0x30a297;return rp(_0x3fe584);})[_0x1360('0x16')](function(_0x4057dd){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x1f3b8e,_0x4057dd);_0x593de7[_0x1360('0x17')]();})[_0x1360('0x18')](function(_0x1bc281){logger[_0x1360('0x19')]('[%s][TVOX]\x20%s',_0x1f3b8e,_[_0x1360('0x1a')](_0x1bc281)?JSON['stringify'](_0x1bc281):_0x1bc281);_0x593de7['stop']();});}else{logger[_0x1360('0x1b')](_0x1360('0x1c'),_0x1f3b8e);_0x593de7[_0x1360('0x1d')]();}};}; \ No newline at end of file +var _0xe300=['method','login','params','stringify','utf8','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0'];(function(_0x2658b2,_0x26d8ff){var _0x44a2f1=function(_0x2382b2){while(--_0x2382b2){_0x2658b2['push'](_0x2658b2['shift']());}};_0x44a2f1(++_0x26d8ff);}(_0xe300,0x77));var _0x0e30=function(_0x39cae5,_0x18cf74){_0x39cae5=_0x39cae5-0x0;var _0x297ead=_0xe300[_0x39cae5];return _0x297ead;};'use strict';var rp=require(_0x0e30('0x0'));var logger=require(_0x0e30('0x1'))(_0x0e30('0x2'));var _=require('lodash');var arr=[];exports[_0x0e30('0x3')]=function(_0x5a420e,_0x352861){return function(_0x51d698){var _0x37b6a3=_0x352861[0xa];var _0x33996a=_0x352861[0xb];var _0x1c4004=_0x352861[0xc];var _0x2f4dd9=_0x352861[0xd];var _0x174909=_0x352861[0xe];var _0x3226c3=_0x352861[0xf][_0x0e30('0x4')](/\n/g,_0x0e30('0x5'));var _0x12815f=_0x352861[0x10][_0x0e30('0x4')](/\n/g,'\x20');if(!arr[_0x0e30('0x6')](_0x33996a)){arr[_0x0e30('0x7')](_0x33996a);var _0x58a1f5=_0x352861[0x3];var _0x43cdb3=_0x352861[0x4];var _0x389820=_0x352861[0x1];var _0x5d4c0a=_0x352861[0x0];var _0x567de7={};_0x567de7[_0x0e30('0x8')]=_0x352861[0x8]+_0x0e30('0x9')+_0x1c4004+'|'+_0x37b6a3+'|'+_0x2f4dd9+'|'+_0x33996a+'|'+_0x174909;_0x567de7[_0x0e30('0xa')]=_0x352861[0x7]+_0x0e30('0x9')+_0x1c4004+'|'+_0x37b6a3+'|'+_0x2f4dd9+'|'+_0x33996a+'|'+_0x174909+'|'+_0x3226c3+'|'+_0x12815f;_0x567de7['title']=_0x352861[0x9];var _0x14de0e={};_0x14de0e[_0x0e30('0xb')]=_0x0e30('0xc');_0x14de0e[_0x0e30('0xd')]=_0x0e30('0xe');var _0x154dd3=[];_0x154dd3[_0x0e30('0x7')](_0x352861[0x2]);_0x154dd3['push'](_0x352861[0x5]);_0x154dd3[_0x0e30('0x7')](_0x352861[0x6]);_0x14de0e[_0x0e30('0xf')]=_0x154dd3;_0x14de0e['id']=0x1;var _0x165ec2=JSON[_0x0e30('0x10')](_0x14de0e);var _0x763410={'encoding':_0x0e30('0x11'),'method':'POST','timeout':0x2710,'url':_0x58a1f5,'headers':{'Content-Type':_0x0e30('0x12')},'body':_0x165ec2};return rp(_0x763410)[_0x0e30('0x13')](function(_0x278939){const _0x110d53=JSON[_0x0e30('0x14')](_0x278939);if(!_0x110d53[_0x0e30('0x15')]['logged']){throw new Error(_0x0e30('0x16'));}var _0x243a12=_0x33996a;var _0x32595d=_0x0e30('0x17')+_0x389820+_0x0e30('0x18')+_0x5d4c0a+_0x0e30('0x19')+_0x243a12+'&data='+JSON['stringify'](_0x567de7);var _0x372523=_0x43cdb3+'?'+_0x32595d;return rp(_0x372523);})[_0x0e30('0x13')](function(_0x36c07c){logger[_0x0e30('0x1a')](_0x0e30('0x1b'),_0x5a420e,_0x36c07c);_0x51d698[_0x0e30('0x1c')]();})[_0x0e30('0x1d')](function(_0x4fff56){logger[_0x0e30('0x1e')]('[%s][TVOX]\x20%s',_0x5a420e,_[_0x0e30('0x1f')](_0x4fff56)?JSON['stringify'](_0x4fff56):_0x4fff56);_0x51d698[_0x0e30('0x1c')]();});}else{logger[_0x0e30('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5a420e);_0x51d698[_0x0e30('0x20')]();}};}; \ 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 808079c..2ca7ba7 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4c8ef8,_0x1247c7){var _0x331eec=function(_0x343305){while(--_0x343305){_0x4c8ef8['push'](_0x4c8ef8['shift']());}};_0x331eec(++_0x1247c7);}(_0xe706,0xa3));var _0x6e70=function(_0x2a9bf4,_0x5e0ffb){_0x2a9bf4=_0x2a9bf4-0x0;var _0x5f5ff1=_0xe706[_0x2a9bf4];return _0x5f5ff1;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3e96aa,_0x6fba7a){var _0xc7b131=function(_0xee515d){while(--_0xee515d){_0x3e96aa['push'](_0x3e96aa['shift']());}};_0xc7b131(++_0x6fba7a);}(_0xe706,0xa3));var _0x6e70=function(_0x179314,_0x32d3a2){_0x179314=_0x179314-0x0;var _0x3556f7=_0xe706[_0x179314];return _0x3556f7;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0e43f62..53c1d25 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 _0x122d=['../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','body','app','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','complete','Skipped\x20routing\x20for\x20%s','stack','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','emit','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/strategy/util'];(function(_0xf869f3,_0x5cd742){var _0x374e14=function(_0xaecc1d){while(--_0xaecc1d){_0xf869f3['push'](_0xf869f3['shift']());}};_0x374e14(++_0x5cd742);}(_0x122d,0x12d));var _0xd122=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x122d[_0x13b392];return _0x39db24;};'use strict';var _=require(_0xd122('0x0'));var util=require(_0xd122('0x1'));var path=require(_0xd122('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xd122('0x3'));var utils=require('./applications/utils');var sUtils=require(_0xd122('0x4'));var logger=require(_0xd122('0x5'))(_0xd122('0x6'));var rpc={'openchannelQueueReport':require(_0xd122('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xd122('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xd122('0x9'))};var RuleEngine=require(_0xd122('0xa'));function getId(_0x32c309,_0x5e1b6d,_0x46b353){return util[_0xd122('0xb')](_0xd122('0xc'),_0x32c309,_0x5e1b6d||0x0,_0x46b353||0x0);}function getIntervals(_0x3b4989,_0x41a298){var _0x531131=[];if(!_[_0xd122('0xd')](_0x41a298['IntervalId'])&&!_[_0xd122('0xd')](_0x3b4989[_0x41a298[_0xd122('0xe')]])&&!_[_0xd122('0xd')](_0x3b4989[_0x41a298[_0xd122('0xe')]][_0xd122('0xf')])){_0x531131=_[_0xd122('0x10')](_0x3b4989[_0x41a298[_0xd122('0xe')]][_0xd122('0xf')],'interval');}else if(!_[_0xd122('0xd')](_0x41a298[_0xd122('0x11')])){_0x531131=[_0x41a298[_0xd122('0x11')]];}return _0x531131;}exports['listen']=function(_0x4aaff3){_0x4aaff3['rules']={};return new BPromise(function(_0x2cc230,_0x3123ef){var _0x455630={'Start':function(_0x4050f9){var _0x1cf920=this;return new Promise(function(_0x1d686a,_0x55db55){if(_0x4050f9){try{var _0x57200d=[];var _0x4bc4c0=getId(_0x4050f9[_0xd122('0x12')],_0x4050f9['message']?_0x4050f9[_0xd122('0x13')]['id']:0x0,_0x4050f9[_0xd122('0x14')]?_0x4050f9[_0xd122('0x14')]['id']:0x0);var _0x4ff2cb=sUtils[_0xd122('0x15')](_0x4aaff3,_0x4050f9);if(!_0x4ff2cb&&_0x4050f9[_0xd122('0x16')]&&_[_0xd122('0x17')](_0x4050f9[_0xd122('0x16')])&&_0x4050f9[_0xd122('0x16')][_0xd122('0x18')]){for(var _0x371dd9=0x0;_0x371dd9<_0x4050f9[_0xd122('0x16')][_0xd122('0x18')];_0x371dd9+=0x1){var _0x3e6264=_0x4050f9[_0xd122('0x16')][_0x371dd9];if(fs[_0xd122('0x19')](path['join'](__dirname,_0xd122('0x16'),_0x3e6264['app']+_0xd122('0x1a')))){var _0x25f916=[];switch(_0x3e6264['app'][_0xd122('0x1b')]()){case _0xd122('0x1c'):var _0x149603=_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');if(_0x4050f9[_0xd122('0x12')]===_0xd122('0x1f')){_0x25f916[_0xd122('0x20')](_0x149603[0x0]);_0x25f916[_0xd122('0x20')](_0x149603[0x1]);_0x25f916['push'](_0x149603[_0xd122('0x21')](0x2,_0x149603['length'])[_0xd122('0x22')](','));}else{_0x25f916[_0xd122('0x20')](_0x149603[0x0]);_0x25f916[_0xd122('0x20')](_0x149603[_0xd122('0x21')](0x1,_0x149603[_0xd122('0x18')])[_0xd122('0x22')](','));}break;case'dialogflow':var _0x2405bd=_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');_0x25f916[_0xd122('0x20')](_0x2405bd[0x0]);_0x25f916['push'](_0x2405bd[0x1]);_0x25f916[_0xd122('0x20')](_0x2405bd[_0xd122('0x21')](0x2,_0x2405bd[_0xd122('0x18')])[_0xd122('0x22')](','));break;case _0xd122('0x23'):var _0x32ce1d=_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');_0x25f916['push'](_0x32ce1d[0x0]);_0x25f916[_0xd122('0x20')](_0x32ce1d[0x1]);_0x25f916[_0xd122('0x20')](_0x32ce1d[0x2]);_0x25f916['push'](_0x32ce1d[0x3]);_0x25f916[_0xd122('0x20')](_0x32ce1d[_0xd122('0x21')](0x4,_0x32ce1d['length'])[_0xd122('0x22')](','));break;case _0xd122('0x24'):var _0x387199=_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');_0x25f916['push'](_0x387199[0x0]);_0x25f916['push'](_0x387199[0x1]);_0x25f916[_0xd122('0x20')](_0x387199[0x2]);_0x25f916[_0xd122('0x20')](_0x387199[0x3]);_0x25f916[_0xd122('0x20')](_0x387199[_0xd122('0x21')](0x4,_0x387199[_0xd122('0x18')])[_0xd122('0x22')](','));break;case'message':_0x25f916['push'](_0x3e6264[_0xd122('0x1d')]);break;case'tag':_0x25f916[_0xd122('0x20')](_0x3e6264[_0xd122('0x25')]);_0x25f916[_0xd122('0x20')](_0x3e6264['appdata']);break;case _0xd122('0x26'):var _0x391cc1=utils[_0xd122('0x27')](_0x4050f9['account'][_0xd122('0x28')],_0x4050f9);var _0x1278cd=_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');_0x25f916[_0xd122('0x20')](_0x1278cd[0x0]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x1]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x2]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x3]);_0x25f916['push'](_0x1278cd[0x4]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x5]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x6]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x7]);_0x25f916['push'](_0x1278cd[0x8]);_0x25f916[_0xd122('0x20')](_0x1278cd[0x9]);_0x25f916['push'](_0x1278cd[0xa]);_0x25f916[_0xd122('0x20')](_0x4050f9[_0xd122('0x14')]['id']);_0x25f916[_0xd122('0x20')](_0x4050f9[_0xd122('0x13')]['id']);_0x25f916['push'](_0x3e6264[_0xd122('0x29')]);_0x25f916['push'](_0x4050f9[_0xd122('0x14')]['ContactId']);_0x25f916[_0xd122('0x20')](_0x4050f9['body'][_0xd122('0x2a')]);_0x25f916[_0xd122('0x20')](_0x391cc1);break;default:_0x25f916=_['isNil'](_0x3e6264[_0xd122('0x1d')])?[]:_0x3e6264[_0xd122('0x1d')][_0xd122('0x1e')](',');}var _0x516754={'id':util[_0xd122('0xb')]('%s:%s:%s',_0x4bc4c0,_0x3e6264['id'],_0x3e6264[_0xd122('0x2b')]),'condition':require(_0xd122('0x2c'))[_0xd122('0x2d')](_0x4bc4c0,getIntervals(_0x4aaff3[_0xd122('0x2e')],_0x3e6264),_0x4aaff3),'consequence':require('./applications/'+_0x3e6264[_0xd122('0x2b')])[_0xd122('0x2f')](_0x4bc4c0,_0x25f916,_0x4aaff3,_0x4050f9),'p':_0x3e6264[_0xd122('0x30')]||0x0};logger[_0xd122('0x31')](_0xd122('0x32'),_0x516754['id'],_0xd122('0x33'),getIntervals(_0x4aaff3['intervals'],_0x3e6264)[_0xd122('0x22')](_0xd122('0x34')));_0x57200d[_0xd122('0x20')](_0x516754);}else{logger['error'](_0xd122('0x35'),path[_0xd122('0x22')](__dirname,_0xd122('0x16'),_0x3e6264[_0xd122('0x2b')]+_0xd122('0x1a')));}}_0x4aaff3[_0xd122('0x36')][_0x4bc4c0]=new RuleEngine(_0x57200d);_0x4aaff3['rules'][_0x4bc4c0][_0xd122('0x37')](_0x4050f9,function(_0x3b5abd){logger['info']('Applications\x20executed',JSON['stringify'](_0x3b5abd['matchPath']));if(_0x4aaff3['rules'][_0x4bc4c0]){_0x4aaff3[_0xd122('0x36')][_0x4bc4c0]['emit'](_0xd122('0x38'));}});return _0x1d686a({'code':0xc8,'message':_0x4050f9});}else{if(_0x4ff2cb){logger[_0xd122('0x31')](util['format'](_0xd122('0x39'),_0x4bc4c0));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x1d686a({'code':0xc8,'message':_0x4050f9});}}catch(_0x6c244c){logger['error'](_0x6c244c[_0xd122('0x3a')]);return _0x55db55(_0x1cf920[_0xd122('0x3b')](0x1f4,_0x6c244c));}}return _0x55db55(_0xd122('0x3c'));});},'AcceptMessage':function(_0xc693d2){var _0x30937f=this;return new Promise(function(_0x34cbdb,_0x1154ca){if(_0xc693d2['agent']&&_0xc693d2[_0xd122('0x3d')]['id']){if(_0x4aaff3[_0xd122('0x3e')][_0xc693d2[_0xd122('0x3d')]['id']]){_0x4aaff3[_0xd122('0x3e')][_0xc693d2[_0xd122('0x3d')]['id']][_0xd122('0x3f')]=![];_0x4aaff3[_0xd122('0x3e')][_0xc693d2[_0xd122('0x3d')]['id']][_0xd122('0x40')]=undefined;}}if(_0xc693d2[_0xd122('0x13')]&&_0xc693d2[_0xd122('0x13')]['id']){try{var _0x52f161=getId(_0xc693d2[_0xd122('0x12')],_0xc693d2[_0xd122('0x13')]?_0xc693d2[_0xd122('0x13')]['id']:0x0,_0xc693d2[_0xd122('0x14')]?_0xc693d2[_0xd122('0x14')]['id']:0x0);if(_0x4aaff3[_0xd122('0x36')][_0x52f161]){_0x4aaff3[_0xd122('0x36')][_0x52f161]['emit'](_0xd122('0x41'));if(rpc[_0xc693d2[_0xd122('0x12')]+_0xd122('0x42')]){rpc[_0xc693d2['channel']+_0xd122('0x42')][_0xd122('0x43')](_0x52f161,{'UserId':_0xc693d2['message'][_0xd122('0x44')]})[_0xd122('0x45')](function(){logger[_0xd122('0x3b')](_0xd122('0x46'));});}}return _0x34cbdb({'code':0xc8,'message':_0xc693d2});}catch(_0x506026){logger[_0xd122('0x3b')](_0x506026[_0xd122('0x3a')]);return _0x1154ca(_0x30937f[_0xd122('0x3b')](0x1f4,_0x506026));}}logger[_0xd122('0x3b')](_0xd122('0x47'));return _0x1154ca(_0x30937f[_0xd122('0x3b')](0x1f4,_0xd122('0x47')));});},'RejectMessage':function(_0x2a0086){var _0x2e1cd2=this;return new Promise(function(_0x1a75c3,_0x33c4f3){if(_0x2a0086[_0xd122('0x3d')]&&_0x2a0086['agent']['id']){try{if(_0x4aaff3[_0xd122('0x3e')][_0x2a0086[_0xd122('0x3d')]['id']]){_0x4aaff3[_0xd122('0x3e')][_0x2a0086[_0xd122('0x3d')]['id']]['busy']=![];_0x4aaff3[_0xd122('0x3e')][_0x2a0086['agent']['id']][_0xd122('0x40')]=undefined;}return _0x1a75c3({'code':0xc8,'message':_0x2a0086});}catch(_0x54820c){logger[_0xd122('0x3b')](_0x54820c['stack']);return _0x33c4f3(_0x2e1cd2['error'](0x1f4,_0x54820c));}}logger[_0xd122('0x3b')](_0xd122('0x47'));return _0x33c4f3(_0x2e1cd2[_0xd122('0x3b')](0x1f4,_0xd122('0x47')));});},'AbandonInteraction':function(_0x4ddc20){var _0x3f4e26=this;return new Promise(function(_0x543225,_0x5ef770){if(_0x4ddc20['channel']&&_0x4ddc20['interaction']&&_0x4ddc20[_0xd122('0x14')]['id']){try{var _0x56ed52=getId(_0x4ddc20[_0xd122('0x12')],_0x4ddc20['message']?_0x4ddc20[_0xd122('0x13')]['id']:0x0,_0x4ddc20[_0xd122('0x14')]?_0x4ddc20['interaction']['id']:0x0);if(_0x4aaff3[_0xd122('0x36')][_0x56ed52]){_0x4aaff3[_0xd122('0x36')][_0x56ed52][_0xd122('0x48')]('end');}return _0x543225({'code':0xc8,'message':_0x4ddc20});}catch(_0x4c5627){logger['error'](_0x4c5627['stack']);return _0x5ef770(_0x3f4e26[_0xd122('0x3b')](0x1f4,_0x4c5627));}}logger[_0xd122('0x3b')]('message\x20is\x20empty');return _0x5ef770(_0x3f4e26[_0xd122('0x3b')](0x1f4,_0xd122('0x47')));});},'AgentCapacity':function(_0x29d10a){var _0x4298fd=this;return new Promise(function(_0x5f2ce6,_0x5b064b){if(_0x4aaff3[_0xd122('0x3e')][_0xd122('0x49')](_0x29d10a['id'])){for(var _0x23efa7 in _0x29d10a[_0xd122('0x4a')]){if(_0x29d10a[_0xd122('0x4a')][_0xd122('0x49')](_0x23efa7)){if(_0x4aaff3['agents'][_0x29d10a['id']][_0xd122('0x49')](_0x23efa7+'CurrentCapacity')){_0x4aaff3[_0xd122('0x3e')][_0x29d10a['id']][_0x23efa7+'CurrentCapacity']=parseInt(_0x29d10a[_0xd122('0x4a')][_0x23efa7],0xa);}}}_0x4aaff3[_0xd122('0x3e')][_0x29d10a['id']][_0xd122('0x4b')]();return _0x5f2ce6({'code':0xc8,'message':_0x4aaff3[_0xd122('0x3e')][_0x29d10a['id']]});}else{return _0x5b064b(_0x4298fd[_0xd122('0x3b')](0x1f4,_0xd122('0x4c')));}});},'Agents':function(_0x5f2892){return new Promise(function(_0x28d7f4){var _0x4b96e7=_[_0xd122('0x4d')](_0x4aaff3[_0xd122('0x3e')]);if(_0x5f2892&&_0x5f2892['id']){var _0x5265e5=_['find'](_0x4b96e7,function(_0x2788c5){return _0x2788c5['id']===_0x5f2892['id'];});_0x28d7f4(_0x5265e5);}else{_0x28d7f4({'count':_0x4b96e7[_0xd122('0x18')],'rows':_0x4b96e7});}});},'ChatQueues':function(){return new Promise(function(_0x5dd617){var _0x3e1020=[];for(var _0x723736 in _0x4aaff3[_0xd122('0x4e')]){if(_0x4aaff3[_0xd122('0x4e')][_0xd122('0x49')](_0x723736)){var _0x299ae2=_0x4aaff3[_0xd122('0x4e')][_0x723736];var _0x3ea97f={'id':_0x299ae2['id'],'available':_0x299ae2[_0xd122('0x4f')],'loggedIn':_0x299ae2[_0xd122('0x50')],'name':_0x299ae2['name'],'paused':_0x299ae2[_0xd122('0x51')],'waiting':_0x299ae2['waiting']};_0x3e1020[_0xd122('0x20')](_0x3ea97f);}}_0x5dd617({'count':_0x3e1020[_0xd122('0x18')],'rows':_0x3e1020});});},'MailQueues':function(){return new Promise(function(_0x1f2a9d){var _0x1e8201=[];for(var _0x23f3a5 in _0x4aaff3[_0xd122('0x52')]){if(_0x4aaff3[_0xd122('0x52')][_0xd122('0x49')](_0x23f3a5)){var _0xfdfae7=_0x4aaff3[_0xd122('0x52')][_0x23f3a5];var _0x268694={'id':_0xfdfae7['id'],'available':_0xfdfae7['available'],'loggedIn':_0xfdfae7[_0xd122('0x50')],'name':_0xfdfae7[_0xd122('0x53')],'paused':_0xfdfae7[_0xd122('0x51')],'waiting':_0xfdfae7[_0xd122('0x54')]};_0x1e8201[_0xd122('0x20')](_0x268694);}}_0x1f2a9d({'count':_0x1e8201[_0xd122('0x18')],'rows':_0x1e8201});});},'OpenchannelQueues':function(){return new Promise(function(_0x3fb4ee){var _0x5af2b6=[];for(var _0x1e5c8a in _0x4aaff3[_0xd122('0x55')]){if(_0x4aaff3['openchannelQueues'][_0xd122('0x49')](_0x1e5c8a)){var _0x52e1ed=_0x4aaff3[_0xd122('0x55')][_0x1e5c8a];var _0x56043e={'id':_0x52e1ed['id'],'available':_0x52e1ed[_0xd122('0x4f')],'loggedIn':_0x52e1ed['loggedIn'],'name':_0x52e1ed[_0xd122('0x53')],'paused':_0x52e1ed['paused'],'waiting':_0x52e1ed['waiting']};_0x5af2b6['push'](_0x56043e);}}_0x3fb4ee({'count':_0x5af2b6[_0xd122('0x18')],'rows':_0x5af2b6});});},'SmsQueues':function(){return new Promise(function(_0x1cea0f){var _0x37840b=[];for(var _0x3e78be in _0x4aaff3[_0xd122('0x56')]){if(_0x4aaff3[_0xd122('0x56')]['hasOwnProperty'](_0x3e78be)){var _0x411191=_0x4aaff3['smsQueues'][_0x3e78be];var _0x5d71b5={'id':_0x411191['id'],'available':_0x411191[_0xd122('0x4f')],'loggedIn':_0x411191[_0xd122('0x50')],'name':_0x411191[_0xd122('0x53')],'paused':_0x411191['paused'],'waiting':_0x411191[_0xd122('0x54')]};_0x37840b[_0xd122('0x20')](_0x5d71b5);}}_0x1cea0f({'count':_0x37840b[_0xd122('0x18')],'rows':_0x37840b});});},'FaxQueues':function(){return new Promise(function(_0x2d0c74){var _0x57a3f9=[];for(var _0x288790 in _0x4aaff3[_0xd122('0x57')]){if(_0x4aaff3[_0xd122('0x57')][_0xd122('0x49')](_0x288790)){var _0x2198aa=_0x4aaff3[_0xd122('0x57')][_0x288790];var _0x34d765={'id':_0x2198aa['id'],'available':_0x2198aa[_0xd122('0x4f')],'loggedIn':_0x2198aa[_0xd122('0x50')],'name':_0x2198aa[_0xd122('0x53')],'paused':_0x2198aa['paused'],'waiting':_0x2198aa[_0xd122('0x54')]};_0x57a3f9['push'](_0x34d765);}}_0x2d0c74({'count':_0x57a3f9[_0xd122('0x18')],'rows':_0x57a3f9});});},'WhatsappQueues':function(){return new Promise(function(_0x3a5746){var _0x15b72f=[];for(var _0x9e3a4f in _0x4aaff3[_0xd122('0x58')]){if(_0x4aaff3['whatsappQueues']['hasOwnProperty'](_0x9e3a4f)){var _0x4d8911=_0x4aaff3[_0xd122('0x58')][_0x9e3a4f];var _0x267de3={'id':_0x4d8911['id'],'available':_0x4d8911[_0xd122('0x4f')],'loggedIn':_0x4d8911[_0xd122('0x50')],'name':_0x4d8911['name'],'paused':_0x4d8911[_0xd122('0x51')],'waiting':_0x4d8911[_0xd122('0x54')]};_0x15b72f['push'](_0x267de3);}}_0x3a5746({'count':_0x15b72f[_0xd122('0x18')],'rows':_0x15b72f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x375572){var _0x4bd857=_['values'](_0x4aaff3[_0xd122('0x59')]);_0x375572({'count':_0x4bd857[_0xd122('0x18')],'rows':_0x4bd857});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xd8c4aa){var _0x54ae2d=_[_0xd122('0x4d')](_0x4aaff3[_0xd122('0x5a')]);_0xd8c4aa({'count':_0x54ae2d[_0xd122('0x18')],'rows':_0x54ae2d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x33858b){var _0x5cd68a=_[_0xd122('0x4d')](_0x4aaff3[_0xd122('0x5b')]);_0x33858b({'count':_0x5cd68a[_0xd122('0x18')],'rows':_0x5cd68a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3d9acf){var _0x232724=_[_0xd122('0x4d')](_0x4aaff3['smsQueuesWaitingInteractions']);_0x3d9acf({'count':_0x232724[_0xd122('0x18')],'rows':_0x232724});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xa17038){var _0x3dbdd8=_['values'](_0x4aaff3[_0xd122('0x5c')]);_0xa17038({'count':_0x3dbdd8[_0xd122('0x18')],'rows':_0x3dbdd8});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x42af8b){var _0xd82086=_[_0xd122('0x4d')](_0x4aaff3[_0xd122('0x5d')]);_0x42af8b({'count':_0xd82086[_0xd122('0x18')],'rows':_0xd82086});});}};var _0x3aa9e5=jayson[_0xd122('0x5e')](_0x455630)[_0xd122('0x5f')]();_0x3aa9e5['on']('error',function(_0x32e9d9){logger[_0xd122('0x3b')](JSON[_0xd122('0x60')](_0x32e9d9));return _0x3123ef(_0x32e9d9);});_0x3aa9e5[_0xd122('0x61')](0x232c,_0xd122('0x62'),function(){console[_0xd122('0x63')](_0xd122('0x64'),0x232c);return _0x2cc230(_0xd122('0x65')+0x232c);});});}; \ No newline at end of file +var _0x148c=['paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','condition','intervals','priority','info','Push\x20new\x20rule','\x20|\x20','.js','execute','Applications\x20executed','stringify','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x148c,0x19f));var _0xc148=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x148c[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xc148('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xc148('0x1'));var utils=require(_0xc148('0x2'));var sUtils=require(_0xc148('0x3'));var logger=require(_0xc148('0x4'))('routing');var rpc={'openchannelQueueReport':require(_0xc148('0x5')),'mailQueueReport':require(_0xc148('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xc148('0x7')),'whatsappQueueReport':require(_0xc148('0x8'))};var RuleEngine=require(_0xc148('0x9'));function getId(_0xd4d240,_0x3b1b13,_0x1ce5c7){return util['format'](_0xc148('0xa'),_0xd4d240,_0x3b1b13||0x0,_0x1ce5c7||0x0);}function getIntervals(_0x46e640,_0x549c23){var _0x64eeba=[];if(!_[_0xc148('0xb')](_0x549c23[_0xc148('0xc')])&&!_['isNil'](_0x46e640[_0x549c23[_0xc148('0xc')]])&&!_[_0xc148('0xb')](_0x46e640[_0x549c23[_0xc148('0xc')]][_0xc148('0xd')])){_0x64eeba=_['map'](_0x46e640[_0x549c23[_0xc148('0xc')]][_0xc148('0xd')],_0xc148('0xe'));}else if(!_[_0xc148('0xb')](_0x549c23[_0xc148('0xe')])){_0x64eeba=[_0x549c23[_0xc148('0xe')]];}return _0x64eeba;}exports[_0xc148('0xf')]=function(_0x4345a1){_0x4345a1[_0xc148('0x10')]={};return new BPromise(function(_0x336f90,_0x34655b){var _0x4ff6cd={'Start':function(_0x270da5){var _0x5b0212=this;return new Promise(function(_0x5e6bba,_0x3ae7ee){if(_0x270da5){try{var _0x23cc7f=[];var _0x5615ac=getId(_0x270da5[_0xc148('0x11')],_0x270da5[_0xc148('0x12')]?_0x270da5[_0xc148('0x12')]['id']:0x0,_0x270da5['interaction']?_0x270da5[_0xc148('0x13')]['id']:0x0);var _0xb44e21=sUtils[_0xc148('0x14')](_0x4345a1,_0x270da5);if(!_0xb44e21&&_0x270da5[_0xc148('0x15')]&&_[_0xc148('0x16')](_0x270da5[_0xc148('0x15')])&&_0x270da5[_0xc148('0x15')]['length']){for(var _0x142dda=0x0;_0x142dda<_0x270da5['applications'][_0xc148('0x17')];_0x142dda+=0x1){var _0x2c7a61=_0x270da5[_0xc148('0x15')][_0x142dda];if(fs[_0xc148('0x18')](path[_0xc148('0x19')](__dirname,_0xc148('0x15'),_0x2c7a61[_0xc148('0x1a')]+'.js'))){var _0x7cc339=[];switch(_0x2c7a61[_0xc148('0x1a')][_0xc148('0x1b')]()){case _0xc148('0x1c'):var _0x47c0ec=_0x2c7a61[_0xc148('0x1d')][_0xc148('0x1e')](',');if(_0x270da5['channel']===_0xc148('0x1f')){_0x7cc339[_0xc148('0x20')](_0x47c0ec[0x0]);_0x7cc339[_0xc148('0x20')](_0x47c0ec[0x1]);_0x7cc339[_0xc148('0x20')](_0x47c0ec[_0xc148('0x21')](0x2,_0x47c0ec['length'])[_0xc148('0x19')](','));}else{_0x7cc339[_0xc148('0x20')](_0x47c0ec[0x0]);_0x7cc339['push'](_0x47c0ec['slice'](0x1,_0x47c0ec[_0xc148('0x17')])[_0xc148('0x19')](','));}break;case'dialogflow':var _0x4b022f=_0x2c7a61[_0xc148('0x1d')][_0xc148('0x1e')](',');_0x7cc339[_0xc148('0x20')](_0x4b022f[0x0]);_0x7cc339[_0xc148('0x20')](_0x4b022f[0x1]);_0x7cc339[_0xc148('0x20')](_0x4b022f[_0xc148('0x21')](0x2,_0x4b022f[_0xc148('0x17')])['join'](','));break;case _0xc148('0x22'):var _0x19f7d1=_0x2c7a61[_0xc148('0x1d')][_0xc148('0x1e')](',');_0x7cc339[_0xc148('0x20')](_0x19f7d1[0x0]);_0x7cc339[_0xc148('0x20')](_0x19f7d1[0x1]);_0x7cc339[_0xc148('0x20')](_0x19f7d1[0x2]);_0x7cc339[_0xc148('0x20')](_0x19f7d1[0x3]);_0x7cc339[_0xc148('0x20')](_0x19f7d1[_0xc148('0x21')](0x4,_0x19f7d1['length'])[_0xc148('0x19')](','));break;case'amazonlex':var _0x2f08da=_0x2c7a61[_0xc148('0x1d')]['split'](',');_0x7cc339[_0xc148('0x20')](_0x2f08da[0x0]);_0x7cc339[_0xc148('0x20')](_0x2f08da[0x1]);_0x7cc339['push'](_0x2f08da[0x2]);_0x7cc339[_0xc148('0x20')](_0x2f08da[0x3]);_0x7cc339['push'](_0x2f08da[_0xc148('0x21')](0x4,_0x2f08da['length'])[_0xc148('0x19')](','));break;case _0xc148('0x12'):_0x7cc339['push'](_0x2c7a61[_0xc148('0x1d')]);break;case _0xc148('0x23'):_0x7cc339[_0xc148('0x20')](_0x2c7a61[_0xc148('0x24')]);_0x7cc339[_0xc148('0x20')](_0x2c7a61[_0xc148('0x1d')]);break;case _0xc148('0x25'):var _0x4e1232=utils[_0xc148('0x26')](_0x270da5[_0xc148('0x27')][_0xc148('0x28')],_0x270da5);var _0x2acd3c=_0x2c7a61[_0xc148('0x1d')][_0xc148('0x1e')](',');_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x0]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x1]);_0x7cc339['push'](_0x2acd3c[0x2]);_0x7cc339['push'](_0x2acd3c[0x3]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x4]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x5]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x6]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x7]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x8]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0x9]);_0x7cc339[_0xc148('0x20')](_0x2acd3c[0xa]);_0x7cc339[_0xc148('0x20')](_0x270da5[_0xc148('0x13')]['id']);_0x7cc339[_0xc148('0x20')](_0x270da5['message']['id']);_0x7cc339['push'](_0x2c7a61[_0xc148('0x29')]);_0x7cc339[_0xc148('0x20')](_0x270da5[_0xc148('0x13')][_0xc148('0x2a')]);_0x7cc339[_0xc148('0x20')](_0x270da5[_0xc148('0x2b')][_0xc148('0x2b')]);_0x7cc339['push'](_0x4e1232);break;default:_0x7cc339=_[_0xc148('0xb')](_0x2c7a61[_0xc148('0x1d')])?[]:_0x2c7a61[_0xc148('0x1d')][_0xc148('0x1e')](',');}var _0x55f896={'id':util[_0xc148('0x2c')](_0xc148('0x2d'),_0x5615ac,_0x2c7a61['id'],_0x2c7a61['app']),'condition':require('./interval')[_0xc148('0x2e')](_0x5615ac,getIntervals(_0x4345a1[_0xc148('0x2f')],_0x2c7a61),_0x4345a1),'consequence':require('./applications/'+_0x2c7a61[_0xc148('0x1a')])['consequence'](_0x5615ac,_0x7cc339,_0x4345a1,_0x270da5),'p':_0x2c7a61[_0xc148('0x30')]||0x0};logger[_0xc148('0x31')](_0xc148('0x32'),_0x55f896['id'],'on\x20interval',getIntervals(_0x4345a1['intervals'],_0x2c7a61)[_0xc148('0x19')](_0xc148('0x33')));_0x23cc7f[_0xc148('0x20')](_0x55f896);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc148('0x19')](__dirname,'applications',_0x2c7a61[_0xc148('0x1a')]+_0xc148('0x34')));}}_0x4345a1[_0xc148('0x10')][_0x5615ac]=new RuleEngine(_0x23cc7f);_0x4345a1[_0xc148('0x10')][_0x5615ac][_0xc148('0x35')](_0x270da5,function(_0x55d89c){logger['info'](_0xc148('0x36'),JSON[_0xc148('0x37')](_0x55d89c['matchPath']));if(_0x4345a1['rules'][_0x5615ac]){_0x4345a1['rules'][_0x5615ac]['emit'](_0xc148('0x38'));}});return _0x5e6bba({'code':0xc8,'message':_0x270da5});}else{if(_0xb44e21){logger[_0xc148('0x31')](util[_0xc148('0x2c')](_0xc148('0x39'),_0x5615ac));}else{logger[_0xc148('0x31')](_0xc148('0x3a'));}return _0x5e6bba({'code':0xc8,'message':_0x270da5});}}catch(_0x35774a){logger[_0xc148('0x3b')](_0x35774a[_0xc148('0x3c')]);return _0x3ae7ee(_0x5b0212[_0xc148('0x3b')](0x1f4,_0x35774a));}}return _0x3ae7ee(_0xc148('0x3d'));});},'AcceptMessage':function(_0x432781){var _0x478259=this;return new Promise(function(_0x1b6282,_0x71bd4c){if(_0x432781[_0xc148('0x3e')]&&_0x432781[_0xc148('0x3e')]['id']){if(_0x4345a1['agents'][_0x432781['agent']['id']]){_0x4345a1[_0xc148('0x3f')][_0x432781[_0xc148('0x3e')]['id']][_0xc148('0x40')]=![];_0x4345a1[_0xc148('0x3f')][_0x432781['agent']['id']][_0xc148('0x41')]=undefined;}}if(_0x432781[_0xc148('0x12')]&&_0x432781['message']['id']){try{var _0x286dd7=getId(_0x432781[_0xc148('0x11')],_0x432781[_0xc148('0x12')]?_0x432781[_0xc148('0x12')]['id']:0x0,_0x432781[_0xc148('0x13')]?_0x432781[_0xc148('0x13')]['id']:0x0);if(_0x4345a1[_0xc148('0x10')][_0x286dd7]){_0x4345a1[_0xc148('0x10')][_0x286dd7][_0xc148('0x42')](_0xc148('0x43'));if(rpc[_0x432781[_0xc148('0x11')]+_0xc148('0x44')]){rpc[_0x432781[_0xc148('0x11')]+_0xc148('0x44')][_0xc148('0x45')](_0x286dd7,{'UserId':_0x432781[_0xc148('0x12')][_0xc148('0x46')]})[_0xc148('0x47')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x1b6282({'code':0xc8,'message':_0x432781});}catch(_0x5ba0c5){logger[_0xc148('0x3b')](_0x5ba0c5[_0xc148('0x3c')]);return _0x71bd4c(_0x478259['error'](0x1f4,_0x5ba0c5));}}logger[_0xc148('0x3b')](_0xc148('0x48'));return _0x71bd4c(_0x478259[_0xc148('0x3b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1ccc5b){var _0x14732f=this;return new Promise(function(_0xb9fe18,_0x11c1a9){if(_0x1ccc5b[_0xc148('0x3e')]&&_0x1ccc5b[_0xc148('0x3e')]['id']){try{if(_0x4345a1[_0xc148('0x3f')][_0x1ccc5b[_0xc148('0x3e')]['id']]){_0x4345a1[_0xc148('0x3f')][_0x1ccc5b['agent']['id']][_0xc148('0x40')]=![];_0x4345a1[_0xc148('0x3f')][_0x1ccc5b[_0xc148('0x3e')]['id']]['busyQueue']=undefined;}return _0xb9fe18({'code':0xc8,'message':_0x1ccc5b});}catch(_0x448946){logger[_0xc148('0x3b')](_0x448946[_0xc148('0x3c')]);return _0x11c1a9(_0x14732f[_0xc148('0x3b')](0x1f4,_0x448946));}}logger[_0xc148('0x3b')](_0xc148('0x48'));return _0x11c1a9(_0x14732f[_0xc148('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5229f7){var _0x2efa06=this;return new Promise(function(_0x3370c2,_0x340aa5){if(_0x5229f7['channel']&&_0x5229f7['interaction']&&_0x5229f7[_0xc148('0x13')]['id']){try{var _0x2caef6=getId(_0x5229f7[_0xc148('0x11')],_0x5229f7['message']?_0x5229f7[_0xc148('0x12')]['id']:0x0,_0x5229f7[_0xc148('0x13')]?_0x5229f7['interaction']['id']:0x0);if(_0x4345a1[_0xc148('0x10')][_0x2caef6]){_0x4345a1[_0xc148('0x10')][_0x2caef6][_0xc148('0x42')](_0xc148('0x43'));}return _0x3370c2({'code':0xc8,'message':_0x5229f7});}catch(_0x59b0c3){logger['error'](_0x59b0c3[_0xc148('0x3c')]);return _0x340aa5(_0x2efa06[_0xc148('0x3b')](0x1f4,_0x59b0c3));}}logger[_0xc148('0x3b')](_0xc148('0x48'));return _0x340aa5(_0x2efa06[_0xc148('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x31dc72){var _0xd5b145=this;return new Promise(function(_0x3f8334,_0x1e277c){if(_0x4345a1[_0xc148('0x3f')][_0xc148('0x49')](_0x31dc72['id'])){for(var _0x3bc676 in _0x31dc72['capacity']){if(_0x31dc72[_0xc148('0x4a')][_0xc148('0x49')](_0x3bc676)){if(_0x4345a1[_0xc148('0x3f')][_0x31dc72['id']][_0xc148('0x49')](_0x3bc676+'CurrentCapacity')){_0x4345a1[_0xc148('0x3f')][_0x31dc72['id']][_0x3bc676+_0xc148('0x4b')]=parseInt(_0x31dc72[_0xc148('0x4a')][_0x3bc676],0xa);}}}_0x4345a1[_0xc148('0x3f')][_0x31dc72['id']][_0xc148('0x4c')]();return _0x3f8334({'code':0xc8,'message':_0x4345a1[_0xc148('0x3f')][_0x31dc72['id']]});}else{return _0x1e277c(_0xd5b145[_0xc148('0x3b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x9231fc){return new Promise(function(_0x59cc7d){var _0xd96a5a=_[_0xc148('0x4d')](_0x4345a1[_0xc148('0x3f')]);if(_0x9231fc&&_0x9231fc['id']){var _0xfee66e=_[_0xc148('0x4e')](_0xd96a5a,function(_0x59eafc){return _0x59eafc['id']===_0x9231fc['id'];});_0x59cc7d(_0xfee66e);}else{_0x59cc7d({'count':_0xd96a5a[_0xc148('0x17')],'rows':_0xd96a5a});}});},'ChatQueues':function(){return new Promise(function(_0x5816dc){var _0x3c6ab0=[];for(var _0x6d373b in _0x4345a1[_0xc148('0x4f')]){if(_0x4345a1[_0xc148('0x4f')][_0xc148('0x49')](_0x6d373b)){var _0x3c8fc6=_0x4345a1[_0xc148('0x4f')][_0x6d373b];var _0xf5e56e={'id':_0x3c8fc6['id'],'available':_0x3c8fc6[_0xc148('0x50')],'loggedIn':_0x3c8fc6[_0xc148('0x51')],'name':_0x3c8fc6[_0xc148('0x52')],'paused':_0x3c8fc6['paused'],'waiting':_0x3c8fc6[_0xc148('0x53')]};_0x3c6ab0[_0xc148('0x20')](_0xf5e56e);}}_0x5816dc({'count':_0x3c6ab0[_0xc148('0x17')],'rows':_0x3c6ab0});});},'MailQueues':function(){return new Promise(function(_0x1945f6){var _0x492273=[];for(var _0x301b07 in _0x4345a1[_0xc148('0x54')]){if(_0x4345a1[_0xc148('0x54')]['hasOwnProperty'](_0x301b07)){var _0x195349=_0x4345a1[_0xc148('0x54')][_0x301b07];var _0x5d83ef={'id':_0x195349['id'],'available':_0x195349[_0xc148('0x50')],'loggedIn':_0x195349[_0xc148('0x51')],'name':_0x195349[_0xc148('0x52')],'paused':_0x195349[_0xc148('0x55')],'waiting':_0x195349['waiting']};_0x492273[_0xc148('0x20')](_0x5d83ef);}}_0x1945f6({'count':_0x492273[_0xc148('0x17')],'rows':_0x492273});});},'OpenchannelQueues':function(){return new Promise(function(_0x4f311b){var _0x37074e=[];for(var _0x25d874 in _0x4345a1[_0xc148('0x56')]){if(_0x4345a1['openchannelQueues'][_0xc148('0x49')](_0x25d874)){var _0x9d4303=_0x4345a1[_0xc148('0x56')][_0x25d874];var _0x442405={'id':_0x9d4303['id'],'available':_0x9d4303[_0xc148('0x50')],'loggedIn':_0x9d4303[_0xc148('0x51')],'name':_0x9d4303[_0xc148('0x52')],'paused':_0x9d4303[_0xc148('0x55')],'waiting':_0x9d4303[_0xc148('0x53')]};_0x37074e['push'](_0x442405);}}_0x4f311b({'count':_0x37074e[_0xc148('0x17')],'rows':_0x37074e});});},'SmsQueues':function(){return new Promise(function(_0x3f4ea1){var _0x4cb282=[];for(var _0x3bfc23 in _0x4345a1[_0xc148('0x57')]){if(_0x4345a1[_0xc148('0x57')][_0xc148('0x49')](_0x3bfc23)){var _0x470efd=_0x4345a1['smsQueues'][_0x3bfc23];var _0x49c975={'id':_0x470efd['id'],'available':_0x470efd[_0xc148('0x50')],'loggedIn':_0x470efd[_0xc148('0x51')],'name':_0x470efd[_0xc148('0x52')],'paused':_0x470efd[_0xc148('0x55')],'waiting':_0x470efd[_0xc148('0x53')]};_0x4cb282['push'](_0x49c975);}}_0x3f4ea1({'count':_0x4cb282[_0xc148('0x17')],'rows':_0x4cb282});});},'FaxQueues':function(){return new Promise(function(_0x12812e){var _0x483b14=[];for(var _0x273849 in _0x4345a1[_0xc148('0x58')]){if(_0x4345a1[_0xc148('0x58')][_0xc148('0x49')](_0x273849)){var _0x16289f=_0x4345a1[_0xc148('0x58')][_0x273849];var _0x211912={'id':_0x16289f['id'],'available':_0x16289f[_0xc148('0x50')],'loggedIn':_0x16289f[_0xc148('0x51')],'name':_0x16289f[_0xc148('0x52')],'paused':_0x16289f['paused'],'waiting':_0x16289f[_0xc148('0x53')]};_0x483b14[_0xc148('0x20')](_0x211912);}}_0x12812e({'count':_0x483b14[_0xc148('0x17')],'rows':_0x483b14});});},'WhatsappQueues':function(){return new Promise(function(_0x2abec6){var _0x4fa185=[];for(var _0x2cdc32 in _0x4345a1['whatsappQueues']){if(_0x4345a1['whatsappQueues'][_0xc148('0x49')](_0x2cdc32)){var _0x4c17e9=_0x4345a1[_0xc148('0x59')][_0x2cdc32];var _0x3b5110={'id':_0x4c17e9['id'],'available':_0x4c17e9[_0xc148('0x50')],'loggedIn':_0x4c17e9[_0xc148('0x51')],'name':_0x4c17e9[_0xc148('0x52')],'paused':_0x4c17e9['paused'],'waiting':_0x4c17e9[_0xc148('0x53')]};_0x4fa185[_0xc148('0x20')](_0x3b5110);}}_0x2abec6({'count':_0x4fa185[_0xc148('0x17')],'rows':_0x4fa185});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x223a4d){var _0x502e09=_[_0xc148('0x4d')](_0x4345a1[_0xc148('0x5a')]);_0x223a4d({'count':_0x502e09[_0xc148('0x17')],'rows':_0x502e09});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5245be){var _0x249172=_['values'](_0x4345a1[_0xc148('0x5b')]);_0x5245be({'count':_0x249172[_0xc148('0x17')],'rows':_0x249172});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2e7f6a){var _0xcef202=_[_0xc148('0x4d')](_0x4345a1[_0xc148('0x5c')]);_0x2e7f6a({'count':_0xcef202[_0xc148('0x17')],'rows':_0xcef202});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x41e6a0){var _0x43951d=_[_0xc148('0x4d')](_0x4345a1[_0xc148('0x5d')]);_0x41e6a0({'count':_0x43951d[_0xc148('0x17')],'rows':_0x43951d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4764b9){var _0x53f16f=_[_0xc148('0x4d')](_0x4345a1[_0xc148('0x5e')]);_0x4764b9({'count':_0x53f16f['length'],'rows':_0x53f16f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x19b507){var _0x1f62e9=_[_0xc148('0x4d')](_0x4345a1['whatsappQueuesWaitingInteractions']);_0x19b507({'count':_0x1f62e9['length'],'rows':_0x1f62e9});});}};var _0x1e45ea=jayson[_0xc148('0x5f')](_0x4ff6cd)[_0xc148('0x60')]();_0x1e45ea['on'](_0xc148('0x3b'),function(_0x494a55){logger[_0xc148('0x3b')](JSON[_0xc148('0x37')](_0x494a55));return _0x34655b(_0x494a55);});_0x1e45ea['listen'](0x232c,_0xc148('0x61'),function(){console[_0xc148('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x336f90(_0xc148('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 169111d..790bf23 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 _0x0652=['http','request','then','error','message','result','catch','rules','info','stop','length','push','Command','iftime\x20%s','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','stack','util','bluebird','routing','client'];(function(_0x5e0e76,_0x4a1487){var _0x1d4557=function(_0xbbe928){while(--_0xbbe928){_0x5e0e76['push'](_0x5e0e76['shift']());}};_0x1d4557(++_0x4a1487);}(_0x0652,0x1ea));var _0x2065=function(_0x33f594,_0x15fbca){_0x33f594=_0x33f594-0x0;var _0x3a4df5=_0x0652[_0x33f594];return _0x3a4df5;};'use strict';var util=require(_0x2065('0x0'));var BPromise=require(_0x2065('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x2065('0x2'));var client=jayson[_0x2065('0x3')][_0x2065('0x4')]({'port':0x232a});function request(_0x451457,_0x31aa44){return new BPromise(function(_0x18b19f,_0x746bb2){return client[_0x2065('0x5')](_0x451457,_0x31aa44)[_0x2065('0x6')](function(_0x71d597){if(_0x71d597[_0x2065('0x7')]){return _0x746bb2(_0x71d597[_0x2065('0x7')][_0x2065('0x8')]);}else{return _0x18b19f(_0x71d597[_0x2065('0x9')]);}})[_0x2065('0xa')](function(_0x508c35){return _0x746bb2(_0x508c35);});});}exports['condition']=function(_0x1a8f4d,_0x1b5d09,_0x2675d5){return function(_0x7e963b){if(_0x2675d5[_0x2065('0xb')]&&!_0x2675d5[_0x2065('0xb')][_0x1a8f4d]){logger[_0x2065('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1a8f4d);return _0x7e963b[_0x2065('0xd')]();}var _0x5d1bbe=[];for(var _0x45739e=0x0;_0x45739e<_0x1b5d09[_0x2065('0xe')];_0x45739e+=0x1){_0x5d1bbe[_0x2065('0xf')](request(_0x2065('0x10'),{'command':util['format'](_0x2065('0x11'),_0x1b5d09[_0x45739e])})[_0x2065('0x6')](function(_0x308633){return _0x308633&&_0x308633['message']&&_0x308633['message'][_0x2065('0x12')](_0x2065('0x13'))>=0x0?!![]:![];})[_0x2065('0xa')](function(_0x1e5b4f){logger['error']('[%s][INTERVAL]\x20%s',_0x1a8f4d,_0x1b5d09[_0x45739e]);}));}BPromise[_0x2065('0x14')](_0x5d1bbe)['then'](function(_0x2672f2){var _0xe6c5cb=_['some'](_0x2672f2);logger['info'](_0x2065('0x15'),_0x1a8f4d,_0x1b5d09[_0x2065('0x16')]('\x20|\x20'),_0xe6c5cb);_0x7e963b['when'](_0xe6c5cb);})[_0x2065('0xa')](function(_0x49f23b){console[_0x2065('0x17')](_0x49f23b);logger[_0x2065('0x7')](_0x2065('0x15'),_0x1a8f4d,_0x1b5d09[_0x2065('0x16')](_0x2065('0x18')),_0x49f23b[_0x2065('0x19')]);_0x7e963b[_0x2065('0xd')]();});};}; \ No newline at end of file +var _0x4750=['join','\x20|\x20','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','message','indexOf','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x143df6,_0x4934b3){var _0x10a829=function(_0x31a5a5){while(--_0x31a5a5){_0x143df6['push'](_0x143df6['shift']());}};_0x10a829(++_0x4934b3);}(_0x4750,0x1e5));var _0x0475=function(_0x5fb825,_0x475a4c){_0x5fb825=_0x5fb825-0x0;var _0x13295f=_0x4750[_0x5fb825];return _0x13295f;};'use strict';var util=require('util');var BPromise=require(_0x0475('0x0'));var jayson=require(_0x0475('0x1'));var _=require(_0x0475('0x2'));var logger=require(_0x0475('0x3'))(_0x0475('0x4'));var client=jayson[_0x0475('0x5')][_0x0475('0x6')]({'port':0x232a});function request(_0x3f08a1,_0xc4b9e0){return new BPromise(function(_0x3f482d,_0x2a091a){return client[_0x0475('0x7')](_0x3f08a1,_0xc4b9e0)['then'](function(_0x4d9081){if(_0x4d9081['error']){return _0x2a091a(_0x4d9081[_0x0475('0x8')]['message']);}else{return _0x3f482d(_0x4d9081[_0x0475('0x9')]);}})[_0x0475('0xa')](function(_0xfaf56){return _0x2a091a(_0xfaf56);});});}exports[_0x0475('0xb')]=function(_0x394753,_0x218269,_0x51dc5c){return function(_0x114436){if(_0x51dc5c[_0x0475('0xc')]&&!_0x51dc5c[_0x0475('0xc')][_0x394753]){logger['info'](_0x0475('0xd'),_0x394753);return _0x114436[_0x0475('0xe')]();}var _0x2a7b97=[];for(var _0x4d1c44=0x0;_0x4d1c44<_0x218269[_0x0475('0xf')];_0x4d1c44+=0x1){_0x2a7b97['push'](request(_0x0475('0x10'),{'command':util['format'](_0x0475('0x11'),_0x218269[_0x4d1c44])})['then'](function(_0x38a9c9){return _0x38a9c9&&_0x38a9c9[_0x0475('0x12')]&&_0x38a9c9[_0x0475('0x12')][_0x0475('0x13')]('true')>=0x0?!![]:![];})['catch'](function(_0x296289){logger[_0x0475('0x8')](_0x0475('0x14'),_0x394753,_0x218269[_0x4d1c44]);}));}BPromise[_0x0475('0x15')](_0x2a7b97)[_0x0475('0x16')](function(_0x2c11f1){var _0x24b815=_[_0x0475('0x17')](_0x2c11f1);logger['info'](_0x0475('0x18'),_0x394753,_0x218269[_0x0475('0x19')](_0x0475('0x1a')),_0x24b815);_0x114436[_0x0475('0x1b')](_0x24b815);})['catch'](function(_0x303f97){console[_0x0475('0x1c')](_0x303f97);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x394753,_0x218269['join'](_0x0475('0x1a')),_0x303f97[_0x0475('0x1d')]);_0x114436[_0x0475('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7438597..98b4ebd 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 _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0x208331,_0x16a0d0){var _0xa34762=function(_0x49ae95){while(--_0x49ae95){_0x208331['push'](_0x208331['shift']());}};_0xa34762(++_0x16a0d0);}(_0x6cb4,0xff));var _0x46cb=function(_0x2518cc,_0x2039ba){_0x2518cc=_0x2518cc-0x0;var _0xc36a5a=_0x6cb4[_0x2518cc];return _0xc36a5a;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}}; \ No newline at end of file +var _0x3c81=['CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request'];(function(_0x16d0be,_0x51f0c3){var _0xacd5bc=function(_0x353f12){while(--_0x353f12){_0x16d0be['push'](_0x16d0be['shift']());}};_0xacd5bc(++_0x51f0c3);}(_0x3c81,0x102));var _0x13c8=function(_0x3bfc1e,_0x36215f){_0x3bfc1e=_0x3bfc1e-0x0;var _0x11dd4b=_0x3c81[_0x3bfc1e];return _0x11dd4b;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x252f26,_0x131d0b){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x252f26['uniqueid'],_0x252f26[_0x13c8('0x2')],_0x252f26[_0x13c8('0x3')],_0x252f26[_0x13c8('0x4')],_0x252f26[_0x13c8('0x5')],_0x252f26[_0x13c8('0x6')],_0x252f26[_0x13c8('0x7')],_0x252f26[_0x13c8('0x8')]));if(_0x252f26['queue']){utils[_0x13c8('0x9')](_0x252f26['queue'])[_0x13c8('0xa')](function(_0x296463){if(_0x296463){_0x252f26[_0x13c8('0xb')]=_0x296463[_0x13c8('0xb')];_0x252f26[_0x13c8('0xc')]=_0x252f26[_0x13c8('0xd')]?_0x296463[_0x13c8('0xe')]:![];_0x252f26[_0x13c8('0xf')]=_0x252f26[_0x13c8('0xc')]?_0x296463[_0x13c8('0x10')]:0x0;}utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);});}else{utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);}if(_0x131d0b){delete transfers[_0x252f26['uniqueid']];}else{delete agents[_0x252f26[_0x13c8('0x13')]];}}exports[_0x13c8('0x14')]=function(_0x2304b5){try{utils[_0x13c8('0x15')](util['format'](_0x13c8('0x16'),_0x2304b5['uniqueid']),_0x2304b5);agents[_0x2304b5['destuniqueid']]=_0x2304b5;agents[_0x2304b5['destuniqueid']][_0x13c8('0x17')]=utils['now']();agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x18');agents[_0x2304b5[_0x13c8('0x13')]]['connectedlinenum']=null;agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x19')]=null;utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x1c'),_0x2304b5[_0x13c8('0x1d')],agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x4')],_0x2304b5[_0x13c8('0x13')]));}catch(_0x31d122){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x16'),_0x2304b5[_0x13c8('0x1d')]),_0x31d122);}};exports[_0x13c8('0x1f')]=function(_0x313ea3){try{if(!_['isNil'](agents[_0x313ea3[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x313ea3);utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x21'),_0x313ea3[_0x13c8('0x1d')],agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x4')],_0x313ea3['destuniqueid']));agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x1f')]=!![];agents[_0x313ea3['destuniqueid']]['agentringnoanswerAt']=utils[_0x13c8('0x22')]();agents[_0x313ea3[_0x13c8('0x13')]]['lastevent']='timeout';agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x23')]='timeout';agents[_0x313ea3['destuniqueid']][_0x13c8('0x24')]=_0x313ea3['ringtime']?parseInt(_0x313ea3['ringtime'])/0x3e8:0x0;agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x25')]=0x0;unanswered[_0x13c8('0x26')](_0x313ea3['destuniqueid']);}}catch(_0x5ef2f7){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x5ef2f7);}};exports[_0x13c8('0x27')]=function(_0x220d40){try{_[_0x13c8('0x28')](agents,function(_0x4a1b9c,_0x109cb8){if(_0x4a1b9c[_0x13c8('0x1d')]==_0x220d40['uniqueid']&&!_['includes'](unanswered,_0x4a1b9c[_0x13c8('0x13')])){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x220d40);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2a'),_0x220d40[_0x13c8('0x1d')],_0x4a1b9c[_0x13c8('0x4')],_0x4a1b9c[_0x13c8('0x13')]));_0x4a1b9c[_0x13c8('0x1f')]=!![];_0x4a1b9c[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x4a1b9c['lastevent']='abandoned';_0x4a1b9c[_0x13c8('0x23')]=_0x13c8('0x2c');_0x4a1b9c['holdtime']=_0x220d40[_0x13c8('0x24')];_0x4a1b9c['talktime']=0x0;writeDB(_0x4a1b9c);}});}catch(_0x1fdf7d){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x1fdf7d);}};exports[_0x13c8('0x2d')]=function(_0x2039e7){try{if(agents[_0x2039e7[_0x13c8('0x13')]]){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0x2039e7);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2f'),_0x2039e7[_0x13c8('0x1d')],agents[_0x2039e7['destuniqueid']]['membername'],_0x2039e7['destuniqueid']));agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x7')]=_0x2039e7[_0x13c8('0x7')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x19')]=_0x2039e7[_0x13c8('0x19')];agents[_0x2039e7['destuniqueid']]['holdtime']=_0x2039e7[_0x13c8('0x31')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x32');_['forIn'](agents,function(_0x35e1e7,_0x4bd627){if(_0x35e1e7[_0x13c8('0x13')]!=_0x2039e7[_0x13c8('0x13')]&&_0x35e1e7[_0x13c8('0x1d')]==_0x2039e7[_0x13c8('0x1d')]){_0x35e1e7[_0x13c8('0x25')]=0x0;_0x35e1e7[_0x13c8('0x24')]=_0x2039e7[_0x13c8('0x31')];_0x35e1e7[_0x13c8('0x1f')]=!![];_0x35e1e7[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x35e1e7[_0x13c8('0x8')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x23')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x34')]=_0x2039e7[_0x13c8('0x13')];_0x35e1e7[_0x13c8('0x35')]=_0x2039e7[_0x13c8('0x4')];writeDB(_0x35e1e7);}});}}catch(_0xc5eb86){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0xc5eb86);}};exports[_0x13c8('0xd')]=function(_0x44ee66){try{if(!_['isNil'](agents[_0x44ee66[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x44ee66);utils['info'](util['format'](_0x13c8('0x37'),_0x44ee66[_0x13c8('0x1d')],agents[_0x44ee66[_0x13c8('0x13')]]['membername'],_0x44ee66['destuniqueid']));agents[_0x44ee66['destuniqueid']][_0x13c8('0xd')]=!![];agents[_0x44ee66['destuniqueid']][_0x13c8('0x38')]=utils['now']();agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x25')]=utils[_0x13c8('0x39')](agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x38')],agents[_0x44ee66[_0x13c8('0x13')]]['agentconnectAt']);agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x23')]=_0x44ee66['reason'];agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x3a');writeDB(agents[_0x44ee66[_0x13c8('0x13')]]);}}catch(_0x38486a){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x38486a);}};exports[_0x13c8('0x3b')]=function(_0x185d18){try{if(!_['isNil'](agents[_0x185d18[_0x13c8('0x3c')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18[_0x13c8('0x1d')]),_0x185d18);utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x3e'),_0x185d18[_0x13c8('0x1d')],agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x4')],agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')]));agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x3f')]=!![];agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x40')]=_0x13c8('0x41');agents[_0x185d18['transfereruniqueid']][_0x13c8('0x42')]=_0x185d18[_0x13c8('0x43')];agents[_0x185d18[_0x13c8('0x3c')]]['transferuniqueid']=agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')];}}catch(_0x14a738){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18['uniqueid']),_0x14a738);}};exports[_0x13c8('0x44')]=function(_0x554792){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792['origtransfereruniqueid']),_0x554792);if(_0x554792[_0x13c8('0x46')]==_0x554792[_0x13c8('0x47')]){if(!_['isNil'](agents[_0x554792[_0x13c8('0x48')]])){utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4')]));agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x554792['secondtransfereruniqueid']]['transferexten']=_0x554792[_0x13c8('0x4a')];agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x46')];}if(_0x554792[_0x13c8('0x4c')]&&agents[_0x554792[_0x13c8('0x4c')]]){agents[_0x554792[_0x13c8('0x4c')]]['agententerreason']=0x1;transfers[_0x554792['transfereeuniqueid']]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x4c')]]);transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4e')]=agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x4e')];transfers[_0x554792[_0x13c8('0x4c')]]['agentcalledAt']=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4f')]=0x2;}}else if(_0x554792[_0x13c8('0x48')]==_0x554792[_0x13c8('0x50')]){if(!_[_0x13c8('0x51')](agents[_0x554792[_0x13c8('0x46')]])){utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x4')]));agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792[_0x13c8('0x46')]]['transfertype']=_0x13c8('0x52');agents[_0x554792[_0x13c8('0x46')]]['transferexten']=_0x554792[_0x13c8('0x53')];agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x48')];}if(_0x554792[_0x13c8('0x54')]&&agents[_0x554792[_0x13c8('0x54')]]){agents[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x1;transfers[_0x554792[_0x13c8('0x54')]]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x54')]]);transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4e')]=agents[_0x554792[_0x13c8('0x46')]]['calleridname'];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x17')]=utils[_0x13c8('0x22')]();transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x2;}}}catch(_0x55e5ba){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792[_0x13c8('0x46')]),_0x55e5ba);}};exports['hangup']=function(_0x16b409){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x55'),_0x16b409[_0x13c8('0x1d')]),_0x16b409);if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409[_0x13c8('0x1d')]]['reason']===_0x13c8('0x56')){if(_0x16b409[_0x13c8('0x57')]==='21'){agents[_0x16b409[_0x13c8('0x1d')]]['reason']=_0x13c8('0x58');agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']='rejected';}utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x59'),_0x16b409['uniqueid'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);var _0x2d8dfe=unanswered['indexOf'](_0x16b409[_0x13c8('0x1d')]);if(_0x2d8dfe>-0x1){unanswered[_0x13c8('0x5a')](_0x2d8dfe,0x1);}}if(transfers[_0x16b409[_0x13c8('0x1d')]]){transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0xd')]=!![];transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x25')]=utils['diffTime'](transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')],transfers[_0x16b409['uniqueid']]['agentconnectAt']);transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=_0x13c8('0x5b');transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]=_0x13c8('0x3a');utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x59'),_0x16b409[_0x13c8('0x1d')],transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],transfers[_0x16b409['uniqueid']][_0x13c8('0x23')],transfers[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(transfers[_0x16b409[_0x13c8('0x1d')]],!![]);}if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409['uniqueid']][_0x13c8('0x30')]){agents[_0x16b409['uniqueid']][_0x13c8('0xd')]=!![];agents[_0x16b409['uniqueid']][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();agents[_0x16b409[_0x13c8('0x1d')]]['talktime']=utils[_0x13c8('0x39')](agents[_0x16b409['uniqueid']]['agentcompleteAt'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x30')]);agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=agents[_0x16b409['uniqueid']]['transfer']?_0x13c8('0x3f'):'agent';agents[_0x16b409['uniqueid']][_0x13c8('0x8')]=_0x13c8('0x3a');utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x16b409[_0x13c8('0x1d')],agents[_0x16b409['uniqueid']]['membername'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);}}catch(_0x551563){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x55'),_0x16b409['uniqueid']),_0x551563);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9131c1d..520e8b0 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 _0x7e04=['CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','origtransfereruniqueid','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','substring','lastIndexOf','noop','gotoif','lastapplication','lastdata','lodash','FAILED','NO\x20ANSWER','ANSWERED','BUSY','format','uniqueid','channel','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7e04,0xc4));var _0x47e0=function(_0x21db17,_0x5070cd){_0x21db17=_0x21db17-0x0;var _0x19c6ac=_0x7e04[_0x21db17];return _0x19c6ac;};'use strict';var _=require(_0x47e0('0x0'));var util=require('util');var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x47e0('0x1'),_0x47e0('0x1'),_0x47e0('0x2'),_0x47e0('0x2'),_0x47e0('0x2'),_0x47e0('0x3'),_0x47e0('0x4'),'FAILED',_0x47e0('0x1'),_0x47e0('0x1')];var channels={};function writeDB(_0x31d2db){utils['info'](util[_0x47e0('0x5')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x31d2db[_0x47e0('0x6')],_0x31d2db[_0x47e0('0x7')],_0x31d2db['queue'],_0x31d2db['membername'],_0x31d2db['interface'],_0x31d2db[_0x47e0('0x8')],_0x31d2db[_0x47e0('0x9')],_0x31d2db[_0x47e0('0xa')]));if(_0x31d2db[_0x47e0('0xb')]){utils[_0x47e0('0xc')](_0x31d2db[_0x47e0('0xb')])['then'](function(_0x18d57c){if(_0x18d57c){_0x31d2db['UserId']=_0x18d57c['id'];}utils[_0x47e0('0xd')](_0x47e0('0xe'),_0x31d2db);});}else{utils[_0x47e0('0xd')](_0x47e0('0xe'),_0x31d2db);}if(channels[_0x31d2db['uniqueid']]){delete channels[_0x31d2db[_0x47e0('0x6')]];}}exports[_0x47e0('0xf')]=function(_0x4b86e6){try{utils['debug'](util[_0x47e0('0x5')](_0x47e0('0x10'),_0x4b86e6[_0x47e0('0x6')]),_0x4b86e6);if(_0x4b86e6[_0x47e0('0x6')]==_0x4b86e6[_0x47e0('0x11')]&&_0x4b86e6[_0x47e0('0x7')]!=_0x47e0('0x12')){utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x14'),_0x4b86e6[_0x47e0('0x6')],_0x4b86e6[_0x47e0('0x15')],_0x4b86e6['exten']));channels[_0x4b86e6[_0x47e0('0x6')]]={'uniqueid':_0x4b86e6['uniqueid'],'accountcode':_0x4b86e6[_0x47e0('0xb')],'source':_0x4b86e6[_0x47e0('0x8')],'destination':_0x4b86e6[_0x47e0('0x16')],'destinationcontext':_0x4b86e6[_0x47e0('0x15')],'channel':_0x4b86e6[_0x47e0('0x7')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x47e0('0x17')};}}catch(_0x16bf7a){utils[_0x47e0('0x18')](util['format'](_0x47e0('0x10'),_0x4b86e6[_0x47e0('0x6')]),_0x16bf7a);}};exports[_0x47e0('0x19')]=function(_0x2fd140){try{utils[_0x47e0('0x1a')](util[_0x47e0('0x5')](_0x47e0('0x1b'),_0x2fd140[_0x47e0('0x6')]),_0x2fd140);if(!_[_0x47e0('0x1c')](channels[_0x2fd140[_0x47e0('0x6')]])&&_0x2fd140[_0x47e0('0x1d')]==0x6){utils['info'](util[_0x47e0('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2fd140[_0x47e0('0x6')],_0x2fd140[_0x47e0('0x15')],_0x2fd140[_0x47e0('0x7')]));if(_[_0x47e0('0x1c')](channels[_0x2fd140['uniqueid']][_0x47e0('0x1e')])){channels[_0x2fd140[_0x47e0('0x6')]][_0x47e0('0x1e')]=utils[_0x47e0('0x1f')]();}}else if(!_[_0x47e0('0x1c')](channels[_0x2fd140[_0x47e0('0x11')]])&&_0x2fd140[_0x47e0('0x1d')]==0x6&&_0x2fd140[_0x47e0('0x15')]!=_0x47e0('0x20')){utils[_0x47e0('0x13')](util['format'](_0x47e0('0x21'),_0x2fd140['uniqueid'],_0x2fd140['linkedid'],_0x2fd140['context'],_0x2fd140[_0x47e0('0x7')]));channels[_0x2fd140['linkedid']][_0x47e0('0xb')]=_0x2fd140[_0x47e0('0xb')];channels[_0x2fd140[_0x47e0('0x11')]][_0x47e0('0x22')]=_0x2fd140['channel'];if(_[_0x47e0('0x1c')](channels[_0x2fd140[_0x47e0('0x11')]][_0x47e0('0x23')])){channels[_0x2fd140[_0x47e0('0x11')]]['answertime']=utils[_0x47e0('0x1f')]();}channels[_0x2fd140[_0x47e0('0x11')]][_0x47e0('0x24')]=dispositions[_[_0x47e0('0x25')](_0x2fd140['channelstate'])]||_0x47e0('0x3');}}catch(_0x9c6066){utils[_0x47e0('0x18')](util[_0x47e0('0x5')](_0x47e0('0x1b'),_0x2fd140[_0x47e0('0x6')]),_0x9c6066);}};exports[_0x47e0('0x26')]=function(_0x107311){try{if(!_['isNil'](channels[_0x107311[_0x47e0('0x6')]])){utils[_0x47e0('0x1a')](util[_0x47e0('0x5')](_0x47e0('0x27'),_0x107311[_0x47e0('0x6')]),_0x107311);if(_['isNil'](channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x28')])){channels[_0x107311[_0x47e0('0x6')]]['callerid']=_0x107311[_0x47e0('0x29')]+'\x20<'+_0x107311[_0x47e0('0x8')]+'>';}utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x2a'),_0x107311[_0x47e0('0x6')],channels[_0x107311['uniqueid']][_0x47e0('0x28')],_0x107311[_0x47e0('0x2b')]));channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x2c')]=utils[_0x47e0('0x1f')]();channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x2d')]=utils[_0x47e0('0x2e')](channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x2c')],channels[_0x107311['uniqueid']][_0x47e0('0x2f')]);channels[_0x107311[_0x47e0('0x6')]]['billableseconds']=channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x23')]?utils[_0x47e0('0x2e')](channels[_0x107311[_0x47e0('0x6')]][_0x47e0('0x2c')],channels[_0x107311[_0x47e0('0x6')]]['answertime']):0x0;writeDB(channels[_0x107311[_0x47e0('0x6')]]);}}catch(_0xc1c7ca){utils[_0x47e0('0x18')](util[_0x47e0('0x5')](_0x47e0('0x27'),_0x107311[_0x47e0('0x6')]),_0xc1c7ca);}};exports[_0x47e0('0x30')]=function(_0x4812b0){try{if(!_[_0x47e0('0x1c')](channels[_0x4812b0[_0x47e0('0x31')]])){utils['debug'](util[_0x47e0('0x5')](_0x47e0('0x32'),_0x4812b0['origtransfereruniqueid']),_0x4812b0);if(channels[_0x4812b0[_0x47e0('0x31')]]['channel']==_0x4812b0[_0x47e0('0x33')]){utils[_0x47e0('0x13')](util[_0x47e0('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4812b0['origtransfereruniqueid'],_0x4812b0[_0x47e0('0x31')],_0x4812b0[_0x47e0('0x34')]));channels[_0x4812b0[_0x47e0('0x31')]][_0x47e0('0x22')]=_0x4812b0[_0x47e0('0x34')];channels[_0x4812b0['localtwolinkedid']][_0x47e0('0x35')]=_0x47e0('0x36');}else if(channels[_0x4812b0[_0x47e0('0x31')]][_0x47e0('0x7')]=_0x4812b0[_0x47e0('0x37')]){utils['info'](util[_0x47e0('0x5')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4812b0['origtransfereruniqueid'],_0x4812b0[_0x47e0('0x31')],_0x4812b0[_0x47e0('0x38')]));channels[_0x4812b0[_0x47e0('0x31')]]['destinationchannel']=_0x4812b0[_0x47e0('0x38')];channels[_0x4812b0['localtwolinkedid']][_0x47e0('0x35')]=_0x47e0('0x36');}}}catch(_0x9a16d7){utils['error'](util[_0x47e0('0x5')](_0x47e0('0x32'),_0x4812b0[_0x47e0('0x39')]),_0x9a16d7);}};exports['musiconholdstart']=function(_0x3d5f05){try{if(!_['isNil'](channels[_0x3d5f05[_0x47e0('0x6')]])){utils[_0x47e0('0x1a')](util[_0x47e0('0x5')]('[%s][calls][musiconholdstart]',_0x3d5f05[_0x47e0('0x6')]),_0x3d5f05);channels[_0x3d5f05[_0x47e0('0x6')]][_0x47e0('0x3a')]=utils['now']();utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x3b'),_0x3d5f05[_0x47e0('0x6')],channels[_0x3d5f05[_0x47e0('0x6')]][_0x47e0('0x3a')]));}}catch(_0x291a5c){utils['error'](util[_0x47e0('0x5')](_0x47e0('0x3c'),_0x3d5f05[_0x47e0('0x6')]),_0x291a5c);}};exports[_0x47e0('0x3d')]=function(_0xfc8873){try{if(!_['isNil'](channels[_0xfc8873[_0x47e0('0x6')]])){utils[_0x47e0('0x1a')](util[_0x47e0('0x5')]('[%s][calls][musiconholdstop]',_0xfc8873[_0x47e0('0x6')]),_0xfc8873);if(!_['isNil'](channels[_0xfc8873[_0x47e0('0x6')]][_0x47e0('0x3a')])){channels[_0xfc8873[_0x47e0('0x6')]][_0x47e0('0x3e')]+=utils['diffTime'](utils[_0x47e0('0x1f')](),channels[_0xfc8873[_0x47e0('0x6')]][_0x47e0('0x3a')]);utils[_0x47e0('0x13')](util['format'](_0x47e0('0x3f'),_0xfc8873[_0x47e0('0x6')],channels[_0xfc8873[_0x47e0('0x6')]][_0x47e0('0x3e')]));delete channels[_0xfc8873[_0x47e0('0x6')]]['musiconholdstartAt'];}}}catch(_0x5e0ccd){utils[_0x47e0('0x18')](util[_0x47e0('0x5')](_0x47e0('0x40'),_0xfc8873[_0x47e0('0x6')]),_0x5e0ccd);}};exports[_0x47e0('0x41')]=function(_0x2eeeef){try{if(!_['isNil'](channels[_0x2eeeef['uniqueid']])){utils[_0x47e0('0x1a')](util[_0x47e0('0x5')](_0x47e0('0x42'),_0x2eeeef[_0x47e0('0x6')]),_0x2eeeef);if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')]['xmd-originatecalleridnum'])){utils[_0x47e0('0x13')](util['format'](_0x47e0('0x44'),_0x2eeeef[_0x47e0('0x6')],_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x46')]=_0x2eeeef[_0x47e0('0x45')];}if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x47')])){utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x48'),_0x2eeeef['uniqueid'],_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef['uniqueid']][_0x47e0('0x49')]=_0x2eeeef[_0x47e0('0x45')];channels[_0x2eeeef['uniqueid']][_0x47e0('0x28')]='\x22'+_0x2eeeef[_0x47e0('0x45')]+_0x47e0('0x4a')+_0x2eeeef[_0x47e0('0x45')]+'>';}if(!_['isNil'](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x4b')])||!_['isNil'](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x4c')])){utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x4d'),_0x2eeeef[_0x47e0('0x6')],!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')]['xmd-callerid-preview'])?_0x47e0('0x4b'):_0x47e0('0x4c'),_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef['uniqueid']][_0x47e0('0x28')]=_0x2eeeef['value'];}if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x4e')])||!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')]['xmcs-queue'])){utils[_0x47e0('0x13')](util['format'](_0x47e0('0x4d'),_0x2eeeef['uniqueid'],!_[_0x47e0('0x1c')](_0x2eeeef['variable'][_0x47e0('0x4e')])?_0x47e0('0x4e'):_0x47e0('0x4f'),_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef['uniqueid']]['lastapplication']='Queue';channels[_0x2eeeef[_0x47e0('0x6')]]['lastdata']=_0x2eeeef[_0x47e0('0x45')];channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x50')]=!![];}if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')]['xmd-contactid'])){utils['info'](util[_0x47e0('0x5')](_0x47e0('0x51'),_0x2eeeef['uniqueid'],_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x52')]=_0x2eeeef[_0x47e0('0x45')];}if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x53')])){utils['info'](util[_0x47e0('0x5')](_0x47e0('0x54'),_0x2eeeef[_0x47e0('0x6')],_0x2eeeef['value']));channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x55')]=_0x2eeeef['value'];}if(!_[_0x47e0('0x1c')](_0x2eeeef['variable'][_0x47e0('0x56')])){utils[_0x47e0('0x13')](util['format'](_0x47e0('0x57'),_0x2eeeef[_0x47e0('0x6')],_0x2eeeef[_0x47e0('0x45')]));channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x58')]=_0x2eeeef['value'];}if(!_[_0x47e0('0x1c')](_0x2eeeef[_0x47e0('0x43')][_0x47e0('0x59')])){utils[_0x47e0('0x13')](util['format'](_0x47e0('0x5a'),_0x2eeeef[_0x47e0('0x6')],_0x2eeeef['value']));channels[_0x2eeeef[_0x47e0('0x6')]][_0x47e0('0x59')]=_0x2eeeef[_0x47e0('0x45')];}}}catch(_0x14456f){utils[_0x47e0('0x18')](util['format'](_0x47e0('0x42'),_0x2eeeef[_0x47e0('0x6')]),_0x14456f);}};exports[_0x47e0('0x5b')]=function(_0x39dcfe){try{if(!_[_0x47e0('0x1c')](channels[_0x39dcfe[_0x47e0('0x6')]])){utils[_0x47e0('0x1a')](util[_0x47e0('0x5')](_0x47e0('0x5c'),_0x39dcfe[_0x47e0('0x6')]),_0x39dcfe);utils[_0x47e0('0x13')](util[_0x47e0('0x5')](_0x47e0('0x5d'),_0x39dcfe['uniqueid'],_0x39dcfe[_0x47e0('0x5e')],_0x39dcfe['appdata']));if(_0x39dcfe[_0x47e0('0x5e')][_0x47e0('0x5f')]()=='set'&&_[_0x47e0('0x60')](_0x39dcfe['appdata']['toLowerCase'](),_0x47e0('0x61'))){var _0x5292d5=_0x39dcfe[_0x47e0('0x62')]['split']('=');var _0x31f6b1=_0x5292d5[0x0][_0x47e0('0x63')](_0x5292d5[0x0][_0x47e0('0x64')]('(')+0x1,_0x5292d5[0x0][_0x47e0('0x64')](')'));var _0x554b70=_0x5292d5[0x1];channels[_0x39dcfe['uniqueid']][_0x31f6b1]=_0x554b70;}if(!_['includes']([_0x47e0('0x26'),_0x47e0('0x65'),'execif','set',_0x47e0('0x66')],_0x39dcfe['application']['toLowerCase']())){channels[_0x39dcfe[_0x47e0('0x6')]][_0x47e0('0x67')]=_0x39dcfe[_0x47e0('0x5e')];channels[_0x39dcfe[_0x47e0('0x6')]][_0x47e0('0x68')]=_0x39dcfe[_0x47e0('0x62')];}}}catch(_0x4b2b8d){utils[_0x47e0('0x18')](util[_0x47e0('0x5')](_0x47e0('0x5c'),_0x39dcfe[_0x47e0('0x6')]),_0x4b2b8d);}}; \ No newline at end of file +var _0x6311=['DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6311,0xbc));var _0x1631=function(_0x1f6fd5,_0x399cb0){_0x1f6fd5=_0x1f6fd5-0x0;var _0x587d12=_0x6311[_0x1f6fd5];return _0x587d12;};'use strict';var _=require('lodash');var util=require(_0x1631('0x0'));var utils=require(_0x1631('0x1'));var dispositions=[_0x1631('0x2'),'FAILED',_0x1631('0x3'),_0x1631('0x2'),'NO\x20ANSWER',_0x1631('0x2'),_0x1631('0x4'),_0x1631('0x5'),_0x1631('0x3'),_0x1631('0x3'),_0x1631('0x3')];var channels={};function writeDB(_0x44bef8){utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44bef8[_0x1631('0x8')],_0x44bef8[_0x1631('0x9')],_0x44bef8['queue'],_0x44bef8[_0x1631('0xa')],_0x44bef8[_0x1631('0xb')],_0x44bef8[_0x1631('0xc')],_0x44bef8[_0x1631('0xd')],_0x44bef8['lastevent']));if(_0x44bef8['accountcode']){utils[_0x1631('0xe')](_0x44bef8[_0x1631('0xf')])[_0x1631('0x10')](function(_0x16f5ad){if(_0x16f5ad){_0x44bef8[_0x1631('0x11')]=_0x16f5ad['id'];}utils[_0x1631('0x12')](_0x1631('0x13'),_0x44bef8);});}else{utils[_0x1631('0x12')](_0x1631('0x13'),_0x44bef8);}if(channels[_0x44bef8[_0x1631('0x8')]]){delete channels[_0x44bef8[_0x1631('0x8')]];}}exports[_0x1631('0x14')]=function(_0xf644e1){try{utils[_0x1631('0x15')](util[_0x1631('0x7')]('[%s][calls][newchannel]',_0xf644e1['uniqueid']),_0xf644e1);if(_0xf644e1['uniqueid']==_0xf644e1[_0x1631('0x16')]&&_0xf644e1[_0x1631('0x9')]!=_0x1631('0x17')){utils['info'](util[_0x1631('0x7')](_0x1631('0x18'),_0xf644e1['uniqueid'],_0xf644e1['context'],_0xf644e1[_0x1631('0x19')]));channels[_0xf644e1[_0x1631('0x8')]]={'uniqueid':_0xf644e1[_0x1631('0x8')],'accountcode':_0xf644e1[_0x1631('0xf')],'source':_0xf644e1[_0x1631('0xc')],'destination':_0xf644e1[_0x1631('0x19')],'destinationcontext':_0xf644e1[_0x1631('0x1a')],'channel':_0xf644e1[_0x1631('0x9')],'starttime':utils[_0x1631('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1631('0x2'),'amaflags':_0x1631('0x1c')};}}catch(_0x2cbd02){utils[_0x1631('0x1d')](util[_0x1631('0x7')]('[%s][calls][newchannel]',_0xf644e1[_0x1631('0x8')]),_0x2cbd02);}};exports[_0x1631('0x1e')]=function(_0x5b615e){try{utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x1f'),_0x5b615e['uniqueid']),_0x5b615e);if(!_[_0x1631('0x20')](channels[_0x5b615e[_0x1631('0x8')]])&&_0x5b615e[_0x1631('0x21')]==0x6){utils[_0x1631('0x6')](util['format'](_0x1631('0x22'),_0x5b615e['uniqueid'],_0x5b615e['context'],_0x5b615e[_0x1631('0x9')]));if(_['isNil'](channels[_0x5b615e['uniqueid']][_0x1631('0x23')])){channels[_0x5b615e[_0x1631('0x8')]][_0x1631('0x23')]=utils[_0x1631('0x1b')]();}}else if(!_[_0x1631('0x20')](channels[_0x5b615e['linkedid']])&&_0x5b615e[_0x1631('0x21')]==0x6&&_0x5b615e[_0x1631('0x1a')]!=_0x1631('0x24')){utils['info'](util[_0x1631('0x7')](_0x1631('0x25'),_0x5b615e[_0x1631('0x8')],_0x5b615e['linkedid'],_0x5b615e['context'],_0x5b615e[_0x1631('0x9')]));channels[_0x5b615e[_0x1631('0x16')]]['accountcode']=_0x5b615e[_0x1631('0xf')];channels[_0x5b615e[_0x1631('0x16')]][_0x1631('0x26')]=_0x5b615e[_0x1631('0x9')];if(_[_0x1631('0x20')](channels[_0x5b615e[_0x1631('0x16')]][_0x1631('0x27')])){channels[_0x5b615e['linkedid']][_0x1631('0x27')]=utils[_0x1631('0x1b')]();}channels[_0x5b615e['linkedid']][_0x1631('0x28')]=dispositions[_[_0x1631('0x29')](_0x5b615e['channelstate'])]||_0x1631('0x4');}}catch(_0x55414f){utils[_0x1631('0x1d')](util['format'](_0x1631('0x1f'),_0x5b615e['uniqueid']),_0x55414f);}};exports[_0x1631('0x2a')]=function(_0x189f60){try{if(!_[_0x1631('0x20')](channels[_0x189f60[_0x1631('0x8')]])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x2b'),_0x189f60[_0x1631('0x8')]),_0x189f60);if(_['isNil'](channels[_0x189f60[_0x1631('0x8')]]['callerid'])){channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x2c')]=_0x189f60[_0x1631('0x2d')]+'\x20<'+_0x189f60[_0x1631('0xc')]+'>';}utils[_0x1631('0x6')](util[_0x1631('0x7')](_0x1631('0x2e'),_0x189f60['uniqueid'],channels[_0x189f60[_0x1631('0x8')]]['callerid'],_0x189f60[_0x1631('0x2f')]));channels[_0x189f60['uniqueid']][_0x1631('0x30')]=utils[_0x1631('0x1b')]();channels[_0x189f60['uniqueid']][_0x1631('0x31')]=utils[_0x1631('0x32')](channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x30')],channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x33')]);channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x34')]=channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x27')]?utils['diffTime'](channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x30')],channels[_0x189f60[_0x1631('0x8')]][_0x1631('0x27')]):0x0;writeDB(channels[_0x189f60[_0x1631('0x8')]]);}}catch(_0x5c70de){utils[_0x1631('0x1d')](util['format'](_0x1631('0x2b'),_0x189f60['uniqueid']),_0x5c70de);}};exports[_0x1631('0x35')]=function(_0x1b6b38){try{if(!_[_0x1631('0x20')](channels[_0x1b6b38[_0x1631('0x36')]])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x37'),_0x1b6b38[_0x1631('0x38')]),_0x1b6b38);if(channels[_0x1b6b38[_0x1631('0x36')]][_0x1631('0x9')]==_0x1b6b38[_0x1631('0x39')]){utils['info'](util[_0x1631('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1b6b38[_0x1631('0x38')],_0x1b6b38[_0x1631('0x36')],_0x1b6b38[_0x1631('0x3a')]));channels[_0x1b6b38[_0x1631('0x36')]][_0x1631('0x26')]=_0x1b6b38[_0x1631('0x3a')];channels[_0x1b6b38[_0x1631('0x36')]][_0x1631('0x3b')]=_0x1631('0x3c');}else if(channels[_0x1b6b38[_0x1631('0x36')]][_0x1631('0x9')]=_0x1b6b38[_0x1631('0x3d')]){utils[_0x1631('0x6')](util[_0x1631('0x7')](_0x1631('0x3e'),_0x1b6b38['origtransfereruniqueid'],_0x1b6b38[_0x1631('0x36')],_0x1b6b38[_0x1631('0x3f')]));channels[_0x1b6b38[_0x1631('0x36')]]['destinationchannel']=_0x1b6b38[_0x1631('0x3f')];channels[_0x1b6b38['localtwolinkedid']][_0x1631('0x3b')]=_0x1631('0x3c');}}}catch(_0x2ddea1){utils[_0x1631('0x1d')](util[_0x1631('0x7')]('[%s][calls][attendedtransfer]',_0x1b6b38['origtransfereruniqueid']),_0x2ddea1);}};exports['musiconholdstart']=function(_0x20196a){try{if(!_[_0x1631('0x20')](channels[_0x20196a[_0x1631('0x8')]])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x40'),_0x20196a[_0x1631('0x8')]),_0x20196a);channels[_0x20196a['uniqueid']]['musiconholdstartAt']=utils[_0x1631('0x1b')]();utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x20196a['uniqueid'],channels[_0x20196a['uniqueid']][_0x1631('0x41')]));}}catch(_0x4d7f77){utils[_0x1631('0x1d')](util[_0x1631('0x7')](_0x1631('0x40'),_0x20196a['uniqueid']),_0x4d7f77);}};exports['musiconholdstop']=function(_0x4f2fd3){try{if(!_[_0x1631('0x20')](channels[_0x4f2fd3['uniqueid']])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x42'),_0x4f2fd3['uniqueid']),_0x4f2fd3);if(!_[_0x1631('0x20')](channels[_0x4f2fd3[_0x1631('0x8')]][_0x1631('0x41')])){channels[_0x4f2fd3[_0x1631('0x8')]][_0x1631('0x43')]+=utils[_0x1631('0x32')](utils['now'](),channels[_0x4f2fd3[_0x1631('0x8')]][_0x1631('0x41')]);utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4f2fd3[_0x1631('0x8')],channels[_0x4f2fd3['uniqueid']][_0x1631('0x43')]));delete channels[_0x4f2fd3[_0x1631('0x8')]][_0x1631('0x41')];}}}catch(_0x13e53f){utils[_0x1631('0x1d')](util['format'](_0x1631('0x42'),_0x4f2fd3['uniqueid']),_0x13e53f);}};exports[_0x1631('0x44')]=function(_0x20c575){try{if(!_[_0x1631('0x20')](channels[_0x20c575[_0x1631('0x8')]])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x45'),_0x20c575[_0x1631('0x8')]),_0x20c575);if(!_[_0x1631('0x20')](_0x20c575[_0x1631('0x46')][_0x1631('0x47')])){utils['info'](util[_0x1631('0x7')](_0x1631('0x48'),_0x20c575['uniqueid'],_0x20c575[_0x1631('0x49')]));channels[_0x20c575['uniqueid']]['source']=_0x20c575[_0x1631('0x49')];}if(!_[_0x1631('0x20')](_0x20c575['variable']['xmd-phone'])){utils['info'](util[_0x1631('0x7')](_0x1631('0x4a'),_0x20c575[_0x1631('0x8')],_0x20c575[_0x1631('0x49')]));channels[_0x20c575['uniqueid']][_0x1631('0x4b')]=_0x20c575[_0x1631('0x49')];channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x2c')]='\x22'+_0x20c575[_0x1631('0x49')]+_0x1631('0x4c')+_0x20c575[_0x1631('0x49')]+'>';}if(!_[_0x1631('0x20')](_0x20c575[_0x1631('0x46')][_0x1631('0x4d')])||!_['isNil'](_0x20c575[_0x1631('0x46')]['xmd-callerid'])){utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x20c575['uniqueid'],!_[_0x1631('0x20')](_0x20c575[_0x1631('0x46')][_0x1631('0x4d')])?_0x1631('0x4d'):'xmd-callerid',_0x20c575[_0x1631('0x49')]));channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x2c')]=_0x20c575['value'];}if(!_['isNil'](_0x20c575[_0x1631('0x46')]['xmd-queue'])||!_[_0x1631('0x20')](_0x20c575[_0x1631('0x46')][_0x1631('0x4e')])){utils['info'](util[_0x1631('0x7')](_0x1631('0x4f'),_0x20c575[_0x1631('0x8')],!_[_0x1631('0x20')](_0x20c575['variable'][_0x1631('0x50')])?_0x1631('0x50'):_0x1631('0x4e'),_0x20c575[_0x1631('0x49')]));channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x51')]=_0x1631('0x52');channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x53')]=_0x20c575[_0x1631('0x49')];channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x54')]=!![];}if(!_['isNil'](_0x20c575[_0x1631('0x46')]['xmd-contactid'])){utils[_0x1631('0x6')](util[_0x1631('0x7')](_0x1631('0x55'),_0x20c575[_0x1631('0x8')],_0x20c575['value']));channels[_0x20c575[_0x1631('0x8')]]['ContactId']=_0x20c575[_0x1631('0x49')];}if(!_[_0x1631('0x20')](_0x20c575[_0x1631('0x46')][_0x1631('0x56')])){utils[_0x1631('0x6')](util[_0x1631('0x7')](_0x1631('0x57'),_0x20c575[_0x1631('0x8')],_0x20c575['value']));channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x58')]=_0x20c575[_0x1631('0x49')];}if(!_['isNil'](_0x20c575[_0x1631('0x46')][_0x1631('0x59')])){utils[_0x1631('0x6')](util[_0x1631('0x7')](_0x1631('0x5a'),_0x20c575[_0x1631('0x8')],_0x20c575['value']));channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x5b')]=_0x20c575[_0x1631('0x49')];}if(!_['isNil'](_0x20c575[_0x1631('0x46')][_0x1631('0x5c')])){utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x20c575[_0x1631('0x8')],_0x20c575[_0x1631('0x49')]));channels[_0x20c575[_0x1631('0x8')]][_0x1631('0x5c')]=_0x20c575[_0x1631('0x49')];}}}catch(_0x144915){utils['error'](util[_0x1631('0x7')]('[%s][calls][varset]',_0x20c575['uniqueid']),_0x144915);}};exports[_0x1631('0x5d')]=function(_0x446907){try{if(!_[_0x1631('0x20')](channels[_0x446907[_0x1631('0x8')]])){utils[_0x1631('0x15')](util[_0x1631('0x7')](_0x1631('0x5e'),_0x446907[_0x1631('0x8')]),_0x446907);utils[_0x1631('0x6')](util[_0x1631('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x446907[_0x1631('0x8')],_0x446907[_0x1631('0x5f')],_0x446907[_0x1631('0x60')]));if(_0x446907[_0x1631('0x5f')][_0x1631('0x61')]()==_0x1631('0x62')&&_[_0x1631('0x63')](_0x446907[_0x1631('0x60')][_0x1631('0x61')](),_0x1631('0x64'))){var _0x30a0ad=_0x446907[_0x1631('0x60')][_0x1631('0x65')]('=');var _0x51cd96=_0x30a0ad[0x0][_0x1631('0x66')](_0x30a0ad[0x0]['lastIndexOf']('(')+0x1,_0x30a0ad[0x0][_0x1631('0x67')](')'));var _0x903a59=_0x30a0ad[0x1];channels[_0x446907['uniqueid']][_0x51cd96]=_0x903a59;}if(!_[_0x1631('0x68')]([_0x1631('0x2a'),_0x1631('0x69'),_0x1631('0x6a'),'set',_0x1631('0x6b')],_0x446907[_0x1631('0x5f')][_0x1631('0x61')]())){channels[_0x446907[_0x1631('0x8')]]['lastapplication']=_0x446907[_0x1631('0x5f')];channels[_0x446907[_0x1631('0x8')]][_0x1631('0x53')]=_0x446907[_0x1631('0x60')];}}}catch(_0x4c7d9c){utils[_0x1631('0x1d')](util[_0x1631('0x7')](_0x1631('0x5e'),_0x446907['uniqueid']),_0x4c7d9c);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a49fdb1..341de6d 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 _0x602f=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x602f,0x19c));var _0xf602=function(_0x40160b,_0x4f8cba){_0x40160b=_0x40160b-0x0;var _0x3352cd=_0x602f[_0x40160b];return _0x3352cd;};'use strict';var utils=require(_0xf602('0x0'));exports[_0xf602('0x1')]=function(){utils[_0xf602('0x2')](_0xf602('0x3'));};exports[_0xf602('0x4')]=function(){utils[_0xf602('0x2')]('[core]\x20shutdown');};exports[_0xf602('0x5')]=function(){utils['info'](_0xf602('0x6'));};exports[_0xf602('0x7')]=function(_0x11e214){utils[_0xf602('0x7')](_0xf602('0x8'),_0x11e214);};exports[_0xf602('0x9')]=function(){utils[_0xf602('0x2')](_0xf602('0xa'));};exports[_0xf602('0xb')]=function(_0x3bc00e){}; \ No newline at end of file +var _0x6439=['[core]\x20close','managerevent','./utils','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','error','[core]\x20error'];(function(_0x22c897,_0x3d3795){var _0x14928d=function(_0xa12a2a){while(--_0xa12a2a){_0x22c897['push'](_0x22c897['shift']());}};_0x14928d(++_0x3d3795);}(_0x6439,0x1ce));var _0x9643=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6439[_0x3bf83f];return _0x22c4a9;};'use strict';var utils=require(_0x9643('0x0'));exports['connect']=function(){utils['info'](_0x9643('0x1'));};exports[_0x9643('0x2')]=function(){utils[_0x9643('0x3')](_0x9643('0x4'));};exports[_0x9643('0x5')]=function(){utils[_0x9643('0x3')]('[core]\x20fullybooted');};exports[_0x9643('0x6')]=function(_0x5f4ed4){utils[_0x9643('0x6')](_0x9643('0x7'),_0x5f4ed4);};exports['close']=function(){utils['info'](_0x9643('0x8'));};exports[_0x9643('0x9')]=function(_0x4ded0e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e3f5db3..0edc17c 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 _0x43de=['calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','cdr(routeid)','split','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','calleridname','diffTime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring'];(function(_0x773620,_0x28e151){var _0x54b6b1=function(_0x588d7f){while(--_0x588d7f){_0x773620['push'](_0x773620['shift']());}};_0x54b6b1(++_0x28e151);}(_0x43de,0x1f2));var _0xe43d=function(_0x44ef42,_0x13240b){_0x44ef42=_0x44ef42-0x0;var _0x4133ad=_0x43de[_0x44ef42];return _0x4133ad;};'use strict';var _=require(_0xe43d('0x0'));var util=require('util');var utils=require(_0xe43d('0x1'));var dials={};function writeDB(_0x572b75){utils[_0xe43d('0x2')](util[_0xe43d('0x3')](_0xe43d('0x4'),_0x572b75[_0xe43d('0x5')],_0x572b75[_0xe43d('0x6')],_0x572b75[_0xe43d('0x7')],_0x572b75[_0xe43d('0x8')],_0x572b75[_0xe43d('0x9')],_0x572b75[_0xe43d('0xa')]));utils[_0xe43d('0xb')](_0xe43d('0xc'),_0x572b75);delete dials[_0x572b75[_0xe43d('0x5')]];}exports[_0xe43d('0xd')]=function(_0x1917a6){try{utils[_0xe43d('0xe')](util[_0xe43d('0x3')](_0xe43d('0xf'),_0x1917a6[_0xe43d('0x5')]),_0x1917a6);utils[_0xe43d('0x2')](util[_0xe43d('0x3')](_0xe43d('0x10'),_0x1917a6[_0xe43d('0x5')],_0x1917a6[_0xe43d('0x11')],_0x1917a6[_0xe43d('0x12')]));if(_0x1917a6[_0xe43d('0x11')]['toLowerCase']()==_0xe43d('0x13')&&_['startsWith'](_0x1917a6['appdata']['toLowerCase'](),_0xe43d('0x14'))){var _0x2ccf66=_0x1917a6[_0xe43d('0x12')][_0xe43d('0x15')]('=');dials[_0x1917a6[_0xe43d('0x5')]]={'routeId':_0x2ccf66[0x1]};}}catch(_0x3a5787){utils[_0xe43d('0x16')](util[_0xe43d('0x3')](_0xe43d('0xf'),_0x1917a6[_0xe43d('0x5')]),_0x3a5787);}};exports['varset']=function(_0x3224ac){try{utils[_0xe43d('0xe')](util[_0xe43d('0x3')](_0xe43d('0x17'),_0x3224ac[_0xe43d('0x5')]),_0x3224ac);if(!_[_0xe43d('0x18')](_0x3224ac['variable'][_0xe43d('0x19')])){utils[_0xe43d('0x2')](util['format'](_0xe43d('0x1a'),_0x3224ac['uniqueid'],_0x3224ac[_0xe43d('0x1b')]));dials[_0x3224ac[_0xe43d('0x5')]]={'routeId':_0x3224ac[_0xe43d('0x1b')]};}}catch(_0x317341){utils['error'](util['format']('[%s][dials][varset]',_0x3224ac[_0xe43d('0x5')]),_0x317341);}};exports[_0xe43d('0x1c')]=function(_0x12bf5f){try{if(!_[_0xe43d('0x18')](dials[_0x12bf5f[_0xe43d('0x5')]])){utils[_0xe43d('0xe')](util[_0xe43d('0x3')](_0xe43d('0x1d'),_0x12bf5f[_0xe43d('0x5')]),_0x12bf5f);dials[_0x12bf5f[_0xe43d('0x5')]]=_[_0xe43d('0x1e')](dials[_0x12bf5f[_0xe43d('0x5')]],_0x12bf5f);dials[_0x12bf5f[_0xe43d('0x5')]][_0xe43d('0x1f')]=utils[_0xe43d('0x20')]();dials[_0x12bf5f[_0xe43d('0x5')]][_0xe43d('0x21')]=_0xe43d('0x22');utils['info'](util[_0xe43d('0x3')](_0xe43d('0x23'),_0x12bf5f[_0xe43d('0x5')],dials[_0x12bf5f['uniqueid']][_0xe43d('0x1f')]));}}catch(_0x23a66a){utils[_0xe43d('0x16')](util[_0xe43d('0x3')](_0xe43d('0x1d'),_0x12bf5f['uniqueid']),_0x23a66a);}};exports[_0xe43d('0x24')]=function(_0x4e62a4){try{if(!_[_0xe43d('0x18')](dials[_0x4e62a4[_0xe43d('0x5')]])){utils[_0xe43d('0xe')](util[_0xe43d('0x3')](_0xe43d('0x25'),_0x4e62a4['uniqueid']),_0x4e62a4);dials[_0x4e62a4['uniqueid']][_0xe43d('0xa')]=_0x4e62a4['dialstatus'];if(_0x4e62a4[_0xe43d('0xa')]==_0xe43d('0x26')){dials[_0x4e62a4['uniqueid']]=_[_0xe43d('0x1e')](dials[_0x4e62a4[_0xe43d('0x5')]],_0x4e62a4);dials[_0x4e62a4[_0xe43d('0x5')]]['answertime']=utils[_0xe43d('0x20')]();dials[_0x4e62a4[_0xe43d('0x5')]]['lastevent']=_0xe43d('0x27');utils[_0xe43d('0x2')](util['format'](_0xe43d('0x28'),_0x4e62a4[_0xe43d('0x5')],_0x4e62a4['dialstatus'],dials[_0x4e62a4[_0xe43d('0x5')]][_0xe43d('0x29')]));}else{utils[_0xe43d('0x2')](util[_0xe43d('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4e62a4[_0xe43d('0x5')],_0x4e62a4[_0xe43d('0xa')]));}}}catch(_0x460f7e){utils[_0xe43d('0x16')](util[_0xe43d('0x3')](_0xe43d('0x25'),_0x4e62a4[_0xe43d('0x5')]),_0x460f7e);}};exports[_0xe43d('0x2a')]=function(_0x24dc38){try{if(!_[_0xe43d('0x18')](dials[_0x24dc38['uniqueid']])){utils[_0xe43d('0xe')](util[_0xe43d('0x3')](_0xe43d('0x2b'),_0x24dc38[_0xe43d('0x5')]),_0x24dc38);utils[_0xe43d('0x2')](util[_0xe43d('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x24dc38['uniqueid'],_0x24dc38[_0xe43d('0x8')],_0x24dc38[_0xe43d('0x2c')],_0x24dc38['cause-txt']));dials[_0x24dc38[_0xe43d('0x5')]]=_[_0xe43d('0x1e')](dials[_0x24dc38[_0xe43d('0x5')]],{'endtime':utils[_0xe43d('0x20')](),'lastevent':'complete'});dials[_0x24dc38['uniqueid']]['duration']=utils[_0xe43d('0x2d')](dials[_0x24dc38[_0xe43d('0x5')]]['endtime'],dials[_0x24dc38[_0xe43d('0x5')]][_0xe43d('0x1f')]);dials[_0x24dc38[_0xe43d('0x5')]]['holdtime']=utils[_0xe43d('0x2d')](dials[_0x24dc38['uniqueid']][_0xe43d('0x29')]||dials[_0x24dc38[_0xe43d('0x5')]]['endtime'],dials[_0x24dc38['uniqueid']][_0xe43d('0x1f')]);dials[_0x24dc38[_0xe43d('0x5')]]['billableseconds']=dials[_0x24dc38[_0xe43d('0x5')]][_0xe43d('0x29')]?utils['diffTime'](dials[_0x24dc38[_0xe43d('0x5')]]['endtime'],dials[_0x24dc38[_0xe43d('0x5')]]['answertime']):0x0;writeDB(dials[_0x24dc38[_0xe43d('0x5')]]);}}catch(_0xc788f2){utils['error'](util[_0xe43d('0x3')](_0xe43d('0x2b'),_0x24dc38[_0xe43d('0x5')]),_0xc788f2);}}; \ No newline at end of file +var _0x62d5=['diffTime','endtime','holdtime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','debug','[%s][dials][varset]','variable','value','dialbegin','isNil','assign','starttime','now','called','[%s][dials][dialbegin]','[%s][dials][dialend]','dialstatus','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','cause-txt','complete','duration'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x62d5,0x16b));var _0x562d=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0x62d5[_0x2cdec6];return _0xa36703;};'use strict';var _=require(_0x562d('0x0'));var util=require(_0x562d('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x8ac572){utils[_0x562d('0x2')](util[_0x562d('0x3')](_0x562d('0x4'),_0x8ac572[_0x562d('0x5')],_0x8ac572['channel'],_0x8ac572['dialstring'],_0x8ac572[_0x562d('0x6')],_0x8ac572[_0x562d('0x7')],_0x8ac572['dialstatus']));utils[_0x562d('0x8')](_0x562d('0x9'),_0x8ac572);delete dials[_0x8ac572['uniqueid']];}exports[_0x562d('0xa')]=function(_0x1f1642){try{utils['debug'](util[_0x562d('0x3')](_0x562d('0xb'),_0x1f1642[_0x562d('0x5')]),_0x1f1642);utils['info'](util[_0x562d('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1f1642['uniqueid'],_0x1f1642[_0x562d('0xc')],_0x1f1642[_0x562d('0xd')]));if(_0x1f1642[_0x562d('0xc')][_0x562d('0xe')]()==_0x562d('0xf')&&_[_0x562d('0x10')](_0x1f1642[_0x562d('0xd')]['toLowerCase'](),_0x562d('0x11'))){var _0x5626f6=_0x1f1642['appdata']['split']('=');dials[_0x1f1642[_0x562d('0x5')]]={'routeId':_0x5626f6[0x1]};}}catch(_0x5aee31){utils[_0x562d('0x12')](util[_0x562d('0x3')](_0x562d('0xb'),_0x1f1642[_0x562d('0x5')]),_0x5aee31);}};exports['varset']=function(_0x1ddb35){try{utils[_0x562d('0x13')](util[_0x562d('0x3')](_0x562d('0x14'),_0x1ddb35['uniqueid']),_0x1ddb35);if(!_['isNil'](_0x1ddb35[_0x562d('0x15')]['outboundrouteid'])){utils[_0x562d('0x2')](util[_0x562d('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1ddb35[_0x562d('0x5')],_0x1ddb35['value']));dials[_0x1ddb35[_0x562d('0x5')]]={'routeId':_0x1ddb35[_0x562d('0x16')]};}}catch(_0x1cbcd6){utils[_0x562d('0x12')](util[_0x562d('0x3')]('[%s][dials][varset]',_0x1ddb35[_0x562d('0x5')]),_0x1cbcd6);}};exports[_0x562d('0x17')]=function(_0x69eeda){try{if(!_[_0x562d('0x18')](dials[_0x69eeda[_0x562d('0x5')]])){utils[_0x562d('0x13')](util[_0x562d('0x3')]('[%s][dials][dialbegin]',_0x69eeda[_0x562d('0x5')]),_0x69eeda);dials[_0x69eeda['uniqueid']]=_[_0x562d('0x19')](dials[_0x69eeda[_0x562d('0x5')]],_0x69eeda);dials[_0x69eeda[_0x562d('0x5')]][_0x562d('0x1a')]=utils[_0x562d('0x1b')]();dials[_0x69eeda[_0x562d('0x5')]]['lastevent']=_0x562d('0x1c');utils[_0x562d('0x2')](util[_0x562d('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x69eeda[_0x562d('0x5')],dials[_0x69eeda[_0x562d('0x5')]][_0x562d('0x1a')]));}}catch(_0x83a312){utils[_0x562d('0x12')](util[_0x562d('0x3')](_0x562d('0x1d'),_0x69eeda[_0x562d('0x5')]),_0x83a312);}};exports['dialend']=function(_0x4e4502){try{if(!_[_0x562d('0x18')](dials[_0x4e4502[_0x562d('0x5')]])){utils['debug'](util[_0x562d('0x3')](_0x562d('0x1e'),_0x4e4502[_0x562d('0x5')]),_0x4e4502);dials[_0x4e4502[_0x562d('0x5')]]['dialstatus']=_0x4e4502[_0x562d('0x1f')];if(_0x4e4502[_0x562d('0x1f')]==_0x562d('0x20')){dials[_0x4e4502['uniqueid']]=_[_0x562d('0x19')](dials[_0x4e4502['uniqueid']],_0x4e4502);dials[_0x4e4502['uniqueid']]['answertime']=utils['now']();dials[_0x4e4502[_0x562d('0x5')]][_0x562d('0x21')]=_0x562d('0x22');utils[_0x562d('0x2')](util['format'](_0x562d('0x23'),_0x4e4502[_0x562d('0x5')],_0x4e4502[_0x562d('0x1f')],dials[_0x4e4502[_0x562d('0x5')]][_0x562d('0x24')]));}else{utils[_0x562d('0x2')](util[_0x562d('0x3')](_0x562d('0x25'),_0x4e4502[_0x562d('0x5')],_0x4e4502['dialstatus']));}}}catch(_0x1e230c){utils[_0x562d('0x12')](util[_0x562d('0x3')](_0x562d('0x1e'),_0x4e4502['uniqueid']),_0x1e230c);}};exports['hangup']=function(_0x2afc2f){try{if(!_['isNil'](dials[_0x2afc2f['uniqueid']])){utils[_0x562d('0x13')](util[_0x562d('0x3')](_0x562d('0x26'),_0x2afc2f[_0x562d('0x5')]),_0x2afc2f);utils[_0x562d('0x2')](util[_0x562d('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2afc2f[_0x562d('0x5')],_0x2afc2f[_0x562d('0x6')],_0x2afc2f['calleridname'],_0x2afc2f[_0x562d('0x27')]));dials[_0x2afc2f[_0x562d('0x5')]]=_[_0x562d('0x19')](dials[_0x2afc2f['uniqueid']],{'endtime':utils[_0x562d('0x1b')](),'lastevent':_0x562d('0x28')});dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x29')]=utils[_0x562d('0x2a')](dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x2b')],dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x1a')]);dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x2c')]=utils[_0x562d('0x2a')](dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x24')]||dials[_0x2afc2f[_0x562d('0x5')]]['endtime'],dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x1a')]);dials[_0x2afc2f[_0x562d('0x5')]]['billableseconds']=dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x24')]?utils[_0x562d('0x2a')](dials[_0x2afc2f[_0x562d('0x5')]][_0x562d('0x2b')],dials[_0x2afc2f[_0x562d('0x5')]]['answertime']):0x0;writeDB(dials[_0x2afc2f[_0x562d('0x5')]]);}}catch(_0x5dea35){utils[_0x562d('0x12')](util[_0x562d('0x3')](_0x562d('0x26'),_0x2afc2f[_0x562d('0x5')]),_0x5dea35);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 43a187c..a5d3c00 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 _0x4148=['close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','xdr','disabled','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error'];(function(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_0x4148,0x75));var _0x8414=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x4148[_0x54d52];return _0x968345;};var AsteriskManager=require(_0x8414('0x0'));var config=require(_0x8414('0x1'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0x8414('0x2')]&&config[_0x8414('0x2')][_0x8414('0x3')]?!config[_0x8414('0x2')][_0x8414('0x3')]:!![];var isProduction=config['env']===_0x8414('0x4')||![];var isLocalAsterisk=config[_0x8414('0x2')]&&config[_0x8414('0x2')][_0x8414('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x8414('0x6')][_0x8414('0x7')],config['asterisk']['ip'],config[_0x8414('0x6')][_0x8414('0x8')],config[_0x8414('0x6')][_0x8414('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x8414('0xa')](_0x8414('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x8414('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x8414('0xd'));var queues=require(_0x8414('0xe'));var recordings=require('./recordings.controller');var members=require(_0x8414('0xf'));var dials=require(_0x8414('0x10'));var transfers=require(_0x8414('0x11'));var core=require(_0x8414('0x12'));ami['on'](_0x8414('0x13'),core[_0x8414('0x13')]);ami['on'](_0x8414('0x14'),core[_0x8414('0x14')]);ami['on'](_0x8414('0x15'),core['fullybooted']);ami['on'](_0x8414('0x16'),core['error']);ami['on'](_0x8414('0x17'),core[_0x8414('0x17')]);ami['on'](_0x8414('0x18'),core['managerevent']);ami['on'](_0x8414('0x19'),function(_0x9aa9bd){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')]('[%s][index][devicestatechange]',_0x9aa9bd['device']),_0x9aa9bd);members[_0x8414('0x19')](_0x9aa9bd);}catch(_0x1403aa){utils[_0x8414('0x16')](util['format'](_0x8414('0x1c'),_0x9aa9bd[_0x8414('0x1d')]),_0x1403aa);}});ami['on']('agentcalled',function(_0x131e89){try{utils['debug'](util[_0x8414('0x1b')](_0x8414('0x1e'),_0x131e89[_0x8414('0x1f')]),_0x131e89);agents[_0x8414('0x20')](_0x131e89);}catch(_0x222f9a){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x1e'),_0x131e89[_0x8414('0x1f')]),_0x222f9a);}});ami['on'](_0x8414('0x21'),function(_0x269ad2){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x22'),_0x269ad2['uniqueid']),_0x269ad2);agents[_0x8414('0x21')](_0x269ad2);}catch(_0x57cc40){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x22'),_0x269ad2[_0x8414('0x1f')]),_0x57cc40);}});ami['on']('agentconnect',function(_0x51ec6d){try{utils['debug'](util[_0x8414('0x1b')](_0x8414('0x23'),_0x51ec6d[_0x8414('0x1f')]),_0x51ec6d);agents[_0x8414('0x24')](_0x51ec6d);queues[_0x8414('0x24')](_0x51ec6d);}catch(_0x12aeb4){utils[_0x8414('0x16')](util['format']('[%s][index][agentconnect]',_0x51ec6d['uniqueid']),_0x12aeb4);}});ami['on'](_0x8414('0x25'),function(_0x4b4700){try{utils[_0x8414('0x1a')](util['format'](_0x8414('0x26'),_0x4b4700[_0x8414('0x1f')]),_0x4b4700);agents[_0x8414('0x25')](_0x4b4700);queues[_0x8414('0x25')](_0x4b4700);members[_0x8414('0x25')](_0x4b4700);}catch(_0x2703a4){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x26'),_0x4b4700[_0x8414('0x1f')]),_0x2703a4);}});ami['on'](_0x8414('0x27'),function(_0x439ea5){try{utils[_0x8414('0x1a')](util['format']('[%s][index][queuecallerabandon]',_0x439ea5['uniqueid']),_0x439ea5);agents[_0x8414('0x27')](_0x439ea5);queues[_0x8414('0x27')](_0x439ea5);}catch(_0xdc3dce){utils[_0x8414('0x16')](util['format'](_0x8414('0x28'),_0x439ea5[_0x8414('0x1f')]),_0xdc3dce);}});ami['on'](_0x8414('0x29'),function(_0x163e61){try{utils[_0x8414('0x1a')](util['format'](_0x8414('0x2a'),_0x163e61[_0x8414('0x1f')]),_0x163e61);queues[_0x8414('0x29')](_0x163e61);recordings['queuecallerjoin'](_0x163e61);}catch(_0x40755d){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x2a'),_0x163e61[_0x8414('0x1f')]),_0x40755d);}});ami['on'](_0x8414('0x2b'),function(_0x47ae44){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')]('[%s][index][queuecallerleave]',_0x47ae44[_0x8414('0x1f')]),_0x47ae44);queues['queuecallerleave'](_0x47ae44);}catch(_0xa17a80){utils[_0x8414('0x16')](util['format'](_0x8414('0x2c'),_0x47ae44[_0x8414('0x1f')]),_0xa17a80);}});ami['on'](_0x8414('0x2d'),function(_0x4ea251){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x2e'),_0x4ea251['uniqueid']),_0x4ea251);queues[_0x8414('0x2d')](_0x4ea251);calls[_0x8414('0x2d')](_0x4ea251);}catch(_0x4eaa76){utils[_0x8414('0x16')](util[_0x8414('0x1b')]('[%s][index][musiconholdstart]',_0x4ea251['uniqueid']),_0x4eaa76);}});ami['on']('musiconholdstop',function(_0x579ddf){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x2f'),_0x579ddf['uniqueid']),_0x579ddf);queues['musiconholdstop'](_0x579ddf);calls['musiconholdstop'](_0x579ddf);}catch(_0x3338c5){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x2f'),_0x579ddf[_0x8414('0x1f')]),_0x3338c5);}});ami['on'](_0x8414('0x30'),function(_0x3d29bf){try{utils['debug'](util[_0x8414('0x1b')](_0x8414('0x31'),_0x3d29bf[_0x8414('0x1f')]),_0x3d29bf);calls[_0x8414('0x30')](_0x3d29bf);recordings['newstate'](_0x3d29bf);}catch(_0xa10a){utils['error'](util[_0x8414('0x1b')](_0x8414('0x31'),_0x3d29bf[_0x8414('0x1f')]),_0xa10a);}});ami['on'](_0x8414('0x32'),function(_0x2b8e39){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x33'),_0x2b8e39[_0x8414('0x1f')]),_0x2b8e39);calls[_0x8414('0x32')](_0x2b8e39);recordings[_0x8414('0x32')](_0x2b8e39);dials['hangup'](_0x2b8e39);agents[_0x8414('0x32')](_0x2b8e39);queues[_0x8414('0x32')](_0x2b8e39);}catch(_0x2555e6){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x33'),_0x2b8e39[_0x8414('0x1f')]),_0x2555e6);}});ami['on']('cdr',function(_0x17cd2c){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x34'),_0x17cd2c['uniqueid']),_0x17cd2c);members[_0x8414('0x35')](_0x17cd2c);}catch(_0x37ca8f){utils['error'](util['format'](_0x8414('0x34'),_0x17cd2c[_0x8414('0x1f')]),_0x37ca8f);}});ami['on'](_0x8414('0x36'),function(_0x2973f1){try{utils['debug'](util['format'](_0x8414('0x37'),_0x2973f1[_0x8414('0x1f')]),_0x2973f1);queues['blindtransfer'](_0x2973f1);agents[_0x8414('0x36')](_0x2973f1);transfers['blindtransfer'](_0x2973f1);}catch(_0x32c201){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x37'),_0x2973f1[_0x8414('0x1f')]),_0x32c201);}});ami['on']('attendedtransfer',function(_0x4401b0){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')]('[%s][index][attendedtransfer]',_0x4401b0[_0x8414('0x38')]),_0x4401b0);queues[_0x8414('0x39')](_0x4401b0);transfers['attendedtransfer'](_0x4401b0);agents[_0x8414('0x39')](_0x4401b0);calls[_0x8414('0x39')](_0x4401b0);}catch(_0x1d7784){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x3a'),_0x4401b0[_0x8414('0x38')]),_0x1d7784);}});ami['on'](_0x8414('0x3b'),function(_0x4f1731){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x3c'),_0x4f1731['uniqueid']),_0x4f1731);queues[_0x8414('0x3b')](_0x4f1731);recordings[_0x8414('0x3b')](_0x4f1731);calls[_0x8414('0x3b')](_0x4f1731);dials[_0x8414('0x3b')](_0x4f1731);}catch(_0x500a96){utils[_0x8414('0x16')](util[_0x8414('0x1b')]('[%s][index][varset]',_0x4f1731['uniqueid']),_0x500a96);}});ami['on'](_0x8414('0x3d'),function(_0x24f302){try{utils['debug'](util[_0x8414('0x1b')](_0x8414('0x3e'),_0x24f302[_0x8414('0x1f')]),_0x24f302);calls[_0x8414('0x3d')](_0x24f302);recordings[_0x8414('0x3d')](_0x24f302);dials[_0x8414('0x3d')](_0x24f302);}catch(_0x346317){utils[_0x8414('0x16')](util[_0x8414('0x1b')]('[%s][index][newexten]',_0x24f302[_0x8414('0x1f')]),_0x346317);}});ami['on'](_0x8414('0x3f'),function(_0x46624a){try{utils[_0x8414('0x1a')](util['format'](_0x8414('0x40'),_0x46624a['uniqueid']),_0x46624a);calls['newchannel'](_0x46624a);recordings[_0x8414('0x3f')](_0x46624a);}catch(_0x8b86cb){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x40'),_0x46624a[_0x8414('0x1f')]),_0x8b86cb);}});ami['on'](_0x8414('0x41'),function(_0x5a7b60){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')](_0x8414('0x42'),_0x5a7b60[_0x8414('0x1f')]),_0x5a7b60);dials[_0x8414('0x41')](_0x5a7b60);}catch(_0x17de1c){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x43'),_0x5a7b60['uniqueid']),_0x17de1c);}});ami['on'](_0x8414('0x44'),function(_0x159cba){try{utils[_0x8414('0x1a')](util[_0x8414('0x1b')]('[%s][index][dialend]',_0x159cba[_0x8414('0x1f')]),_0x159cba);dials[_0x8414('0x44')](_0x159cba);}catch(_0x559938){utils[_0x8414('0x16')](util[_0x8414('0x1b')](_0x8414('0x45'),_0x159cba[_0x8414('0x1f')]),_0x559938);}});} \ No newline at end of file +var _0x41a8=['[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','asterisk','port','username','password','keepConnected','info','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','agentringnoanswer','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][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]','blindtransfer'];(function(_0x37a58f,_0x2ac66e){var _0x1f6ed4=function(_0x4f1cbc){while(--_0x4f1cbc){_0x37a58f['push'](_0x37a58f['shift']());}};_0x1f6ed4(++_0x2ac66e);}(_0x41a8,0xde));var _0x841a=function(_0x539cb3,_0xa313cd){_0x539cb3=_0x539cb3-0x0;var _0x45032e=_0x41a8[_0x539cb3];return _0x45032e;};var AsteriskManager=require(_0x841a('0x0'));var config=require(_0x841a('0x1'));var utils=require('./utils');var util=require(_0x841a('0x2'));var isXDREnabled=config[_0x841a('0x3')]&&config[_0x841a('0x3')][_0x841a('0x4')]?!config[_0x841a('0x3')][_0x841a('0x4')]:!![];var isProduction=config['env']===_0x841a('0x5')||![];var isLocalAsterisk=config[_0x841a('0x3')]&&config[_0x841a('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x841a('0x6')][_0x841a('0x7')],config[_0x841a('0x6')]['ip'],config[_0x841a('0x6')][_0x841a('0x8')],config[_0x841a('0x6')][_0x841a('0x9')],!![]);ami[_0x841a('0xa')]();if(!isXDREnabled){utils[_0x841a('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x841a('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x841a('0xc'));var calls=require('./calls.controller');var queues=require(_0x841a('0xd'));var recordings=require(_0x841a('0xe'));var members=require(_0x841a('0xf'));var dials=require('./dials.controller');var transfers=require(_0x841a('0x10'));var core=require(_0x841a('0x11'));ami['on'](_0x841a('0x12'),core[_0x841a('0x12')]);ami['on'](_0x841a('0x13'),core['shutdown']);ami['on'](_0x841a('0x14'),core[_0x841a('0x14')]);ami['on'](_0x841a('0x15'),core[_0x841a('0x15')]);ami['on'](_0x841a('0x16'),core['close']);ami['on'](_0x841a('0x17'),core[_0x841a('0x17')]);ami['on']('devicestatechange',function(_0x3f2fe4){try{utils['debug'](util[_0x841a('0x18')]('[%s][index][devicestatechange]',_0x3f2fe4[_0x841a('0x19')]),_0x3f2fe4);members['devicestatechange'](_0x3f2fe4);}catch(_0x40ec3c){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x1a'),_0x3f2fe4[_0x841a('0x19')]),_0x40ec3c);}});ami['on'](_0x841a('0x1b'),function(_0x4727ab){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x1d'),_0x4727ab['uniqueid']),_0x4727ab);agents[_0x841a('0x1b')](_0x4727ab);}catch(_0x49ce80){utils[_0x841a('0x15')](util['format'](_0x841a('0x1d'),_0x4727ab['uniqueid']),_0x49ce80);}});ami['on'](_0x841a('0x1e'),function(_0x1e4c00){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')]('[%s][index][agentringnoanswer]',_0x1e4c00[_0x841a('0x1f')]),_0x1e4c00);agents[_0x841a('0x1e')](_0x1e4c00);}catch(_0x25b53f){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x20'),_0x1e4c00[_0x841a('0x1f')]),_0x25b53f);}});ami['on'](_0x841a('0x21'),function(_0x366d83){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x22'),_0x366d83[_0x841a('0x1f')]),_0x366d83);agents[_0x841a('0x21')](_0x366d83);queues[_0x841a('0x21')](_0x366d83);}catch(_0x22ab74){utils[_0x841a('0x15')](util['format']('[%s][index][agentconnect]',_0x366d83['uniqueid']),_0x22ab74);}});ami['on']('agentcomplete',function(_0xcbf798){try{utils['debug'](util['format']('[%s][index][agentcomplete]',_0xcbf798[_0x841a('0x1f')]),_0xcbf798);agents[_0x841a('0x23')](_0xcbf798);queues[_0x841a('0x23')](_0xcbf798);members['agentcomplete'](_0xcbf798);}catch(_0xada1c5){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x24'),_0xcbf798[_0x841a('0x1f')]),_0xada1c5);}});ami['on'](_0x841a('0x25'),function(_0x2e00e3){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x26'),_0x2e00e3[_0x841a('0x1f')]),_0x2e00e3);agents[_0x841a('0x25')](_0x2e00e3);queues[_0x841a('0x25')](_0x2e00e3);}catch(_0x44872e){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x26'),_0x2e00e3[_0x841a('0x1f')]),_0x44872e);}});ami['on'](_0x841a('0x27'),function(_0x14f03d){try{utils[_0x841a('0x1c')](util['format'](_0x841a('0x28'),_0x14f03d[_0x841a('0x1f')]),_0x14f03d);queues['queuecallerjoin'](_0x14f03d);recordings[_0x841a('0x27')](_0x14f03d);}catch(_0x1faca8){utils['error'](util['format'](_0x841a('0x28'),_0x14f03d[_0x841a('0x1f')]),_0x1faca8);}});ami['on'](_0x841a('0x29'),function(_0xf1aa0d){try{utils[_0x841a('0x1c')](util['format'](_0x841a('0x2a'),_0xf1aa0d[_0x841a('0x1f')]),_0xf1aa0d);queues[_0x841a('0x29')](_0xf1aa0d);}catch(_0xcef71b){utils['error'](util[_0x841a('0x18')](_0x841a('0x2a'),_0xf1aa0d[_0x841a('0x1f')]),_0xcef71b);}});ami['on'](_0x841a('0x2b'),function(_0x258dc2){try{utils['debug'](util[_0x841a('0x18')](_0x841a('0x2c'),_0x258dc2[_0x841a('0x1f')]),_0x258dc2);queues[_0x841a('0x2b')](_0x258dc2);calls[_0x841a('0x2b')](_0x258dc2);}catch(_0x3d9998){utils['error'](util['format'](_0x841a('0x2c'),_0x258dc2['uniqueid']),_0x3d9998);}});ami['on'](_0x841a('0x2d'),function(_0x335861){try{utils[_0x841a('0x1c')](util['format']('[%s][index][musiconholdstop]',_0x335861['uniqueid']),_0x335861);queues[_0x841a('0x2d')](_0x335861);calls['musiconholdstop'](_0x335861);}catch(_0xcee11a){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x2e'),_0x335861[_0x841a('0x1f')]),_0xcee11a);}});ami['on'](_0x841a('0x2f'),function(_0x2db685){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x30'),_0x2db685[_0x841a('0x1f')]),_0x2db685);calls[_0x841a('0x2f')](_0x2db685);recordings[_0x841a('0x2f')](_0x2db685);}catch(_0x37da1f){utils[_0x841a('0x15')](util['format'](_0x841a('0x30'),_0x2db685['uniqueid']),_0x37da1f);}});ami['on'](_0x841a('0x31'),function(_0x130b54){try{utils['debug'](util[_0x841a('0x18')](_0x841a('0x32'),_0x130b54[_0x841a('0x1f')]),_0x130b54);calls[_0x841a('0x31')](_0x130b54);recordings['hangup'](_0x130b54);dials[_0x841a('0x31')](_0x130b54);agents['hangup'](_0x130b54);queues[_0x841a('0x31')](_0x130b54);}catch(_0x5245a7){utils['error'](util[_0x841a('0x18')](_0x841a('0x32'),_0x130b54[_0x841a('0x1f')]),_0x5245a7);}});ami['on'](_0x841a('0x33'),function(_0xd2b5f5){try{utils[_0x841a('0x1c')](util['format'](_0x841a('0x34'),_0xd2b5f5[_0x841a('0x1f')]),_0xd2b5f5);members[_0x841a('0x33')](_0xd2b5f5);}catch(_0x463185){utils[_0x841a('0x15')](util['format'](_0x841a('0x34'),_0xd2b5f5[_0x841a('0x1f')]),_0x463185);}});ami['on'](_0x841a('0x35'),function(_0x56672f){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x36'),_0x56672f[_0x841a('0x1f')]),_0x56672f);queues['blindtransfer'](_0x56672f);agents[_0x841a('0x35')](_0x56672f);transfers[_0x841a('0x35')](_0x56672f);}catch(_0x6e242e){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x36'),_0x56672f['uniqueid']),_0x6e242e);}});ami['on'](_0x841a('0x37'),function(_0x4e077d){try{utils['debug'](util[_0x841a('0x18')](_0x841a('0x38'),_0x4e077d[_0x841a('0x39')]),_0x4e077d);queues[_0x841a('0x37')](_0x4e077d);transfers['attendedtransfer'](_0x4e077d);agents[_0x841a('0x37')](_0x4e077d);calls[_0x841a('0x37')](_0x4e077d);}catch(_0x1dfc7b){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x38'),_0x4e077d[_0x841a('0x39')]),_0x1dfc7b);}});ami['on'](_0x841a('0x3a'),function(_0x5b2c38){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x3b'),_0x5b2c38[_0x841a('0x1f')]),_0x5b2c38);queues[_0x841a('0x3a')](_0x5b2c38);recordings[_0x841a('0x3a')](_0x5b2c38);calls[_0x841a('0x3a')](_0x5b2c38);dials['varset'](_0x5b2c38);}catch(_0x4a60a8){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x3b'),_0x5b2c38[_0x841a('0x1f')]),_0x4a60a8);}});ami['on'](_0x841a('0x3c'),function(_0x2cf9ae){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')]('[%s][index][newexten]',_0x2cf9ae['uniqueid']),_0x2cf9ae);calls[_0x841a('0x3c')](_0x2cf9ae);recordings['newexten'](_0x2cf9ae);dials[_0x841a('0x3c')](_0x2cf9ae);}catch(_0x469657){utils[_0x841a('0x15')](util['format'](_0x841a('0x3d'),_0x2cf9ae[_0x841a('0x1f')]),_0x469657);}});ami['on'](_0x841a('0x3e'),function(_0x1dd7d7){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x3f'),_0x1dd7d7[_0x841a('0x1f')]),_0x1dd7d7);calls[_0x841a('0x3e')](_0x1dd7d7);recordings[_0x841a('0x3e')](_0x1dd7d7);}catch(_0x359ff9){utils[_0x841a('0x15')](util['format']('[%s][index][newchannel]',_0x1dd7d7[_0x841a('0x1f')]),_0x359ff9);}});ami['on'](_0x841a('0x40'),function(_0x15351a){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')](_0x841a('0x41'),_0x15351a['uniqueid']),_0x15351a);dials['dialbegin'](_0x15351a);}catch(_0x13c629){utils[_0x841a('0x15')](util[_0x841a('0x18')](_0x841a('0x42'),_0x15351a[_0x841a('0x1f')]),_0x13c629);}});ami['on']('dialend',function(_0x484a45){try{utils[_0x841a('0x1c')](util[_0x841a('0x18')]('[%s][index][dialend]',_0x484a45['uniqueid']),_0x484a45);dials[_0x841a('0x43')](_0x484a45);}catch(_0x28242b){utils[_0x841a('0x15')](util['format'](_0x841a('0x44'),_0x484a45[_0x841a('0x1f')]),_0x28242b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a5ce35f..79e6f0d 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 _0x9fca=['Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','name','internal','CreateMemberReport','split','membername','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent','NOT_INUSE','isNil','diffTime','exitAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x9fca,0x1be));var _0xa9fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa9fc('0x0'));var util=require(_0xa9fc('0x1'));var utils=require(_0xa9fc('0x2'));var members={};var exclude=[_0xa9fc('0x3'),_0xa9fc('0x4')];function writeDB(_0x4c7058){utils[_0xa9fc('0x5')](util[_0xa9fc('0x6')](_0xa9fc('0x7'),_0x4c7058[_0xa9fc('0x8')],_0x4c7058[_0xa9fc('0x9')],_0x4c7058[_0xa9fc('0xa')],_0x4c7058[_0xa9fc('0xb')],_0x4c7058['membername'],_0x4c7058['type']));if(_0x4c7058[_0xa9fc('0x9')]){utils[_0xa9fc('0xc')](_0x4c7058[_0xa9fc('0x9')])[_0xa9fc('0xd')](function(_0x1e7786){if(_0x1e7786){_0x4c7058['membername']=_0x1e7786[_0xa9fc('0xe')];_0x4c7058[_0xa9fc('0xf')]=_0x1e7786[_0xa9fc('0xf')];utils['request'](_0xa9fc('0x10'),_0x4c7058);}else{utils['getUserByName'](_0x4c7058[_0xa9fc('0x9')][_0xa9fc('0x11')]('/')[0x1])[_0xa9fc('0xd')](function(_0x8ad8ad){if(_0x8ad8ad){_0x4c7058[_0xa9fc('0x12')]=_0x8ad8ad[_0xa9fc('0xe')];_0x4c7058['internal']=_0x8ad8ad[_0xa9fc('0xf')];utils['request']('CreateMemberReport',_0x4c7058);}});}})[_0xa9fc('0x13')](function(_0x5d737a){utils[_0xa9fc('0x14')](util[_0xa9fc('0x6')](_0xa9fc('0x15'),_0x4c7058[_0xa9fc('0x8')]),_0x5d737a);});}delete members[_0x4c7058['interface']];}function startsWith(_0x32c8e7,_0x310dc3){return _['some'](_0x32c8e7,function(_0x9f50ba){return _[_0xa9fc('0x16')](_0x310dc3,_0x9f50ba);});}exports[_0xa9fc('0x17')]=function(_0x56d871){try{utils[_0xa9fc('0x18')](util[_0xa9fc('0x6')](_0xa9fc('0x19'),members[_0x56d871[_0xa9fc('0x1a')]]?members[_0x56d871[_0xa9fc('0x1a')]][_0xa9fc('0x8')]:_0x56d871['device']),_0x56d871);utils[_0xa9fc('0x5')](util[_0xa9fc('0x6')](_0xa9fc('0x1b'),members[_0x56d871[_0xa9fc('0x1a')]]?members[_0x56d871[_0xa9fc('0x1a')]][_0xa9fc('0x8')]:_0x56d871[_0xa9fc('0x1a')],_0x56d871['state'],_0x56d871[_0xa9fc('0x1a')]));switch(_0x56d871[_0xa9fc('0x1c')]){case _0xa9fc('0x1d'):case'BUSY':if(!startsWith(exclude,_0x56d871[_0xa9fc('0x1a')])){members[_0x56d871[_0xa9fc('0x1a')]]={'channel':_0xa9fc('0x1e'),'interface':_0x56d871[_0xa9fc('0x1a')],'type':'TALKING','enterAt':utils[_0xa9fc('0x1f')](),'role':_0xa9fc('0x20')};}break;case _0xa9fc('0x21'):if(!_[_0xa9fc('0x22')](members[_0x56d871[_0xa9fc('0x1a')]])){members[_0x56d871['device']]['exitAt']=utils[_0xa9fc('0x1f')]();members[_0x56d871[_0xa9fc('0x1a')]]['duration']=utils[_0xa9fc('0x23')](members[_0x56d871[_0xa9fc('0x1a')]][_0xa9fc('0x24')],members[_0x56d871['device']]['enterAt']);if(members[_0x56d871['device']][_0xa9fc('0x8')]){writeDB(members[_0x56d871['device']]);}}break;default:break;}}catch(_0x3827ef){utils['error'](util[_0xa9fc('0x6')]('[%s][members][devicestatechange]',members[_0x56d871[_0xa9fc('0x1a')]]?members[_0x56d871[_0xa9fc('0x1a')]][_0xa9fc('0x8')]:_0x56d871[_0xa9fc('0x1a')]),_0x3827ef);}};exports[_0xa9fc('0x25')]=function(_0x586d71){try{if(!_[_0xa9fc('0x22')](members[_0x586d71[_0xa9fc('0x9')]])){utils['debug'](util[_0xa9fc('0x6')](_0xa9fc('0x26'),_0x586d71[_0xa9fc('0x8')]),_0x586d71);utils[_0xa9fc('0x5')](util[_0xa9fc('0x6')](_0xa9fc('0x27'),_0x586d71[_0xa9fc('0x8')],_0x586d71[_0xa9fc('0x9')],_0x586d71[_0xa9fc('0x28')]));members[_0x586d71[_0xa9fc('0x9')]]=_[_0xa9fc('0x29')](members[_0x586d71[_0xa9fc('0x9')]],{'data4':_0x586d71[_0xa9fc('0x28')],'uniqueid':_0x586d71[_0xa9fc('0x8')]});}}catch(_0x383745){utils['error'](util[_0xa9fc('0x6')](_0xa9fc('0x26'),_0x586d71[_0xa9fc('0x8')]),_0x383745);}};exports[_0xa9fc('0x2a')]=function(_0x57f475){try{utils[_0xa9fc('0x18')](util[_0xa9fc('0x6')](_0xa9fc('0x2b'),_0x57f475[_0xa9fc('0x8')]),_0x57f475);if(_0x57f475[_0xa9fc('0xa')]){var _0xfb331c=_0x57f475['channel'][_0xa9fc('0x11')]('-')[0x0];if(!_['isNil'](members[_0xfb331c])){members[_0xfb331c]=_['assign'](members[_0xfb331c],{'data1':members[_0xfb331c][_0xa9fc('0x2c')]||_0x57f475['type'],'data2':members[_0xfb331c][_0xa9fc('0xb')]||_0x57f475['source'],'data3':members[_0xfb331c][_0xa9fc('0x2d')]||_0x57f475[_0xa9fc('0x2e')],'uniqueid':members[_0xfb331c][_0xa9fc('0x8')]||_0x57f475['uniqueid']});utils[_0xa9fc('0x5')](util[_0xa9fc('0x6')](_0xa9fc('0x2f'),_0x57f475['uniqueid'],members[_0xfb331c]['data1'],members[_0xfb331c][_0xa9fc('0xb')],members[_0xfb331c][_0xa9fc('0x2d')]));if(members[_0xfb331c]['exitAt']){writeDB(members[_0xfb331c]);}}}if(_0x57f475[_0xa9fc('0x30')]){var _0x240553=_0x57f475[_0xa9fc('0x30')][_0xa9fc('0x11')]('-')[0x0];if(!_['isNil'](members[_0x240553])){members[_0x240553]=_[_0xa9fc('0x29')](members[_0x240553],{'data1':members[_0x240553][_0xa9fc('0x2c')]||_0x57f475['type'],'data2':members[_0x240553][_0xa9fc('0xb')]||_0x57f475[_0xa9fc('0x31')],'data3':members[_0x240553][_0xa9fc('0x2d')]||_0x57f475[_0xa9fc('0x2e')],'uniqueid':members[_0x240553][_0xa9fc('0x8')]||_0x57f475[_0xa9fc('0x8')]});utils['info'](util[_0xa9fc('0x6')](_0xa9fc('0x2f'),_0x57f475['uniqueid'],members[_0x240553][_0xa9fc('0x2c')],members[_0x240553][_0xa9fc('0xb')],members[_0x240553][_0xa9fc('0x2d')]));if(members[_0x240553][_0xa9fc('0x24')]){writeDB(members[_0x240553]);}}}}catch(_0x3730b8){utils[_0xa9fc('0x14')](util['format'](_0xa9fc('0x2b'),_0x57f475['uniqueid']),_0x3730b8);}}; \ No newline at end of file +var _0xe735=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','enterAt','format','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','error','[%s][members][cdr]','lodash','Local/_attended@transfer','Queue:','info'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xe735,0xc4));var _0x5e73=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xe735[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x5e73('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x5e73('0x1'),_0x5e73('0x2')];function writeDB(_0x1b900b){utils[_0x5e73('0x3')](util['format'](_0x5e73('0x4'),_0x1b900b[_0x5e73('0x5')],_0x1b900b[_0x5e73('0x6')],_0x1b900b[_0x5e73('0x7')],_0x1b900b[_0x5e73('0x8')],_0x1b900b[_0x5e73('0x9')],_0x1b900b[_0x5e73('0xa')]));if(_0x1b900b[_0x5e73('0x6')]){utils[_0x5e73('0xb')](_0x1b900b['interface'])[_0x5e73('0xc')](function(_0x970e9d){if(_0x970e9d){_0x1b900b[_0x5e73('0x9')]=_0x970e9d[_0x5e73('0xd')];_0x1b900b[_0x5e73('0xe')]=_0x970e9d[_0x5e73('0xe')];utils[_0x5e73('0xf')](_0x5e73('0x10'),_0x1b900b);}else{utils[_0x5e73('0x11')](_0x1b900b[_0x5e73('0x6')][_0x5e73('0x12')]('/')[0x1])[_0x5e73('0xc')](function(_0x483bfc){if(_0x483bfc){_0x1b900b[_0x5e73('0x9')]=_0x483bfc[_0x5e73('0xd')];_0x1b900b[_0x5e73('0xe')]=_0x483bfc['internal'];utils[_0x5e73('0xf')](_0x5e73('0x10'),_0x1b900b);}});}})[_0x5e73('0x13')](function(_0x1d46d0){utils['error'](util['format']('[%s][members][writeDB]',_0x1b900b[_0x5e73('0x5')]),_0x1d46d0);});}delete members[_0x1b900b[_0x5e73('0x6')]];}function startsWith(_0x21a5e2,_0x41ff68){return _['some'](_0x21a5e2,function(_0xfadca3){return _[_0x5e73('0x14')](_0x41ff68,_0xfadca3);});}exports[_0x5e73('0x15')]=function(_0x2f204c){try{utils[_0x5e73('0x16')](util['format'](_0x5e73('0x17'),members[_0x2f204c['device']]?members[_0x2f204c[_0x5e73('0x18')]]['uniqueid']:_0x2f204c['device']),_0x2f204c);utils[_0x5e73('0x3')](util['format'](_0x5e73('0x19'),members[_0x2f204c[_0x5e73('0x18')]]?members[_0x2f204c[_0x5e73('0x18')]]['uniqueid']:_0x2f204c['device'],_0x2f204c['state'],_0x2f204c['device']));switch(_0x2f204c[_0x5e73('0x1a')]){case _0x5e73('0x1b'):case _0x5e73('0x1c'):if(!startsWith(exclude,_0x2f204c['device'])){members[_0x2f204c[_0x5e73('0x18')]]={'channel':_0x5e73('0x1d'),'interface':_0x2f204c[_0x5e73('0x18')],'type':_0x5e73('0x1e'),'enterAt':utils['now'](),'role':_0x5e73('0x1f')};}break;case _0x5e73('0x20'):if(!_[_0x5e73('0x21')](members[_0x2f204c[_0x5e73('0x18')]])){members[_0x2f204c['device']][_0x5e73('0x22')]=utils[_0x5e73('0x23')]();members[_0x2f204c['device']][_0x5e73('0x24')]=utils['diffTime'](members[_0x2f204c[_0x5e73('0x18')]][_0x5e73('0x22')],members[_0x2f204c[_0x5e73('0x18')]][_0x5e73('0x25')]);if(members[_0x2f204c[_0x5e73('0x18')]][_0x5e73('0x5')]){writeDB(members[_0x2f204c['device']]);}}break;default:break;}}catch(_0x16f47f){utils['error'](util[_0x5e73('0x26')]('[%s][members][devicestatechange]',members[_0x2f204c[_0x5e73('0x18')]]?members[_0x2f204c['device']][_0x5e73('0x5')]:_0x2f204c[_0x5e73('0x18')]),_0x16f47f);}};exports[_0x5e73('0x27')]=function(_0x2be637){try{if(!_[_0x5e73('0x21')](members[_0x2be637['interface']])){utils[_0x5e73('0x16')](util['format']('[%s][members][agentcomplete]',_0x2be637[_0x5e73('0x5')]),_0x2be637);utils[_0x5e73('0x3')](util[_0x5e73('0x26')](_0x5e73('0x28'),_0x2be637['uniqueid'],_0x2be637['interface'],_0x2be637[_0x5e73('0x29')]));members[_0x2be637[_0x5e73('0x6')]]=_['assign'](members[_0x2be637[_0x5e73('0x6')]],{'data4':_0x2be637[_0x5e73('0x29')],'uniqueid':_0x2be637[_0x5e73('0x5')]});}}catch(_0x6d0e0c){utils['error'](util['format']('[%s][members][agentcomplete]',_0x2be637[_0x5e73('0x5')]),_0x6d0e0c);}};exports['cdr']=function(_0x1bf908){try{utils[_0x5e73('0x16')](util[_0x5e73('0x26')]('[%s][members][cdr]',_0x1bf908['uniqueid']),_0x1bf908);if(_0x1bf908['channel']){var _0x44e712=_0x1bf908[_0x5e73('0x7')]['split']('-')[0x0];if(!_[_0x5e73('0x21')](members[_0x44e712])){members[_0x44e712]=_[_0x5e73('0x2a')](members[_0x44e712],{'data1':members[_0x44e712]['data1']||_0x1bf908['type'],'data2':members[_0x44e712][_0x5e73('0x8')]||_0x1bf908[_0x5e73('0x2b')],'data3':members[_0x44e712]['data3']||_0x1bf908['destination'],'uniqueid':members[_0x44e712][_0x5e73('0x5')]||_0x1bf908[_0x5e73('0x5')]});utils[_0x5e73('0x3')](util['format'](_0x5e73('0x2c'),_0x1bf908[_0x5e73('0x5')],members[_0x44e712][_0x5e73('0x2d')],members[_0x44e712][_0x5e73('0x8')],members[_0x44e712][_0x5e73('0x2e')]));if(members[_0x44e712][_0x5e73('0x22')]){writeDB(members[_0x44e712]);}}}if(_0x1bf908[_0x5e73('0x2f')]){var _0x2cf6bf=_0x1bf908[_0x5e73('0x2f')][_0x5e73('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2cf6bf])){members[_0x2cf6bf]=_['assign'](members[_0x2cf6bf],{'data1':members[_0x2cf6bf]['data1']||_0x1bf908['type'],'data2':members[_0x2cf6bf][_0x5e73('0x8')]||_0x1bf908[_0x5e73('0x2b')],'data3':members[_0x2cf6bf][_0x5e73('0x2e')]||_0x1bf908['destination'],'uniqueid':members[_0x2cf6bf]['uniqueid']||_0x1bf908[_0x5e73('0x5')]});utils[_0x5e73('0x3')](util[_0x5e73('0x26')](_0x5e73('0x2c'),_0x1bf908[_0x5e73('0x5')],members[_0x2cf6bf]['data1'],members[_0x2cf6bf][_0x5e73('0x8')],members[_0x2cf6bf][_0x5e73('0x2e')]));if(members[_0x2cf6bf][_0x5e73('0x22')]){writeDB(members[_0x2cf6bf]);}}}}catch(_0x4544f2){utils[_0x5e73('0x30')](util[_0x5e73('0x26')](_0x5e73('0x31'),_0x1bf908[_0x5e73('0x5')]),_0x4544f2);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6fd62eb..c94cecc 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 _0xf16b=['musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','accountcode','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','reason','transfer','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfereelinkedid','clone','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x4a3f4a,_0xf5031f){var _0x5cb287=function(_0x5704b2){while(--_0x5704b2){_0x4a3f4a['push'](_0x4a3f4a['shift']());}};_0x5cb287(++_0xf5031f);}(_0xf16b,0xd0));var _0xbf16=function(_0x3a570c,_0x499854){_0x3a570c=_0x3a570c-0x0;var _0x1813e8=_0xf16b[_0x3a570c];return _0x1813e8;};'use strict';var _=require('lodash');var util=require(_0xbf16('0x0'));var utils=require(_0xbf16('0x1'));var queues={};function writeDB(_0x43923a){utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x4'),_0x43923a[_0xbf16('0x5')],_0x43923a['channel'],_0x43923a[_0xbf16('0x6')],_0x43923a[_0xbf16('0x7')],_0x43923a['calleridnum'],_0x43923a[_0xbf16('0x8')],_0x43923a['queuecallerexitreason']));if(_0x43923a[_0xbf16('0x6')]){utils['getVoiceQueueByName'](_0x43923a['queue'])['then'](function(_0x31b40c){if(_0x31b40c){_0x43923a['type']=_0x31b40c[_0xbf16('0x9')];}utils[_0xbf16('0xa')]('CreateVoiceQueueReport',_0x43923a);});}else{utils['request'](_0xbf16('0xb'),_0x43923a);}if(_0x43923a[_0xbf16('0xc')]){delete queues[_0x43923a['transfereduniqueid']];}else{delete queues[_0x43923a[_0xbf16('0x5')]];}}exports[_0xbf16('0xd')]=function(_0x177f3f){try{utils[_0xbf16('0xe')](util[_0xbf16('0x3')](_0xbf16('0xf'),_0x177f3f[_0xbf16('0x5')]),_0x177f3f);utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x10'),_0x177f3f[_0xbf16('0x5')],_0x177f3f[_0xbf16('0x6')],_0x177f3f[_0xbf16('0x11')]));queues[_0x177f3f['uniqueid']]=_[_0xbf16('0x12')](_0x177f3f,{'originalposition':_0x177f3f['position'],'queuecallerjoinAt':utils[_0xbf16('0x13')](),'mohtime':0x0});}catch(_0x5ccb77){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0xf'),_0x177f3f['uniqueid']),_0x5ccb77);}};exports[_0xbf16('0x15')]=function(_0x1cab31){try{if(!_[_0xbf16('0x16')](queues[_0x1cab31['uniqueid']])){utils[_0xbf16('0xe')](util['format']('[%s][queues][hangup]',_0x1cab31[_0xbf16('0x5')]),_0x1cab31);if(queues[_0x1cab31['uniqueid']][_0xbf16('0x17')]){if(!queues[_0x1cab31[_0xbf16('0x5')]]['queuecallerabandon']&&!queues[_0x1cab31[_0xbf16('0x5')]][_0xbf16('0x18')]){queues[_0x1cab31[_0xbf16('0x5')]]['queuecallercomplete']=!![];queues[_0x1cab31[_0xbf16('0x5')]][_0xbf16('0x19')]=utils[_0xbf16('0x13')]();queues[_0x1cab31[_0xbf16('0x5')]]['queuecallerexitreason']=_0xbf16('0x1a');}utils['info'](util[_0xbf16('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x1cab31[_0xbf16('0x5')],queues[_0x1cab31['uniqueid']]['name'],queues[_0x1cab31['uniqueid']][_0xbf16('0x1b')]));writeDB(queues[_0x1cab31['uniqueid']]);}else if(queues[_0x1cab31[_0xbf16('0x5')]][_0xbf16('0xc')]){utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x1c'),_0x1cab31[_0xbf16('0x5')],queues[_0x1cab31[_0xbf16('0x5')]]['name'],queues[_0x1cab31[_0xbf16('0x5')]][_0xbf16('0xc')]));queues[queues[_0x1cab31['uniqueid']][_0xbf16('0xc')]]=queues[_0x1cab31['uniqueid']];queues[queues[_0x1cab31['uniqueid']][_0xbf16('0xc')]][_0xbf16('0x1d')]=0x2;delete queues[_0x1cab31[_0xbf16('0x5')]];}}}catch(_0xd71d81){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0x1e'),_0x1cab31['uniqueid']),_0xd71d81);}};exports[_0xbf16('0x1f')]=function(_0x4945a7){try{utils[_0xbf16('0xe')](util[_0xbf16('0x3')](_0xbf16('0x20'),_0x4945a7[_0xbf16('0x5')]),_0x4945a7);if(!_[_0xbf16('0x16')](_0x4945a7[_0xbf16('0x21')]['queuestatus'])&&_0x4945a7[_0xbf16('0x22')]['toUpperCase']()!==_0xbf16('0x23')){if(!_[_0xbf16('0x16')](queues[_0x4945a7[_0xbf16('0x5')]])){queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x24')]=![];queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x25')]=null;queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x18')]=!![];queues[_0x4945a7[_0xbf16('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x1b')]=_0x4945a7[_0xbf16('0x22')][_0xbf16('0x26')]();utils[_0xbf16('0x2')](util['format'](_0xbf16('0x27'),_0x4945a7['uniqueid'],queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x28')],_0x4945a7[_0xbf16('0x22')],queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x1b')]));writeDB(queues[_0x4945a7[_0xbf16('0x5')]]);}}else if(!_[_0xbf16('0x16')](_0x4945a7[_0xbf16('0x21')][_0xbf16('0x29')])){if(!_[_0xbf16('0x16')](queues[_0x4945a7['uniqueid']])&&!queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x24')]){queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x24')]=![];queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x25')]=null;queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x18')]=!![];queues[_0x4945a7['uniqueid']][_0xbf16('0x2a')]=utils[_0xbf16('0x13')]();queues[_0x4945a7[_0xbf16('0x5')]]['queuecallerexitreason']=_0xbf16('0x2b');utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x2c'),_0x4945a7[_0xbf16('0x5')],queues[_0x4945a7[_0xbf16('0x5')]][_0xbf16('0x28')],_0x4945a7['value'],queues[_0x4945a7['uniqueid']][_0xbf16('0x1b')]));}}}catch(_0x2adb23){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0x20'),_0x4945a7[_0xbf16('0x5')]),_0x2adb23);}};exports[_0xbf16('0x24')]=function(_0x58441d){try{if(!_['isNil'](queues[_0x58441d[_0xbf16('0x5')]])){utils['debug'](util[_0xbf16('0x3')]('[%s][queues][queuecallerabandon]',_0x58441d[_0xbf16('0x5')]),_0x58441d);queues[_0x58441d[_0xbf16('0x5')]][_0xbf16('0x18')]=![];queues[_0x58441d['uniqueid']]['queuecallerexitAt']=null;queues[_0x58441d['uniqueid']][_0xbf16('0x24')]=!![];queues[_0x58441d[_0xbf16('0x5')]][_0xbf16('0x25')]=utils[_0xbf16('0x13')]();queues[_0x58441d[_0xbf16('0x5')]]['queuecallerexitreason']=_0xbf16('0x2d');utils[_0xbf16('0x2')](util[_0xbf16('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x58441d[_0xbf16('0x5')],queues[_0x58441d[_0xbf16('0x5')]][_0xbf16('0x28')],queues[_0x58441d[_0xbf16('0x5')]][_0xbf16('0x1b')]));}}catch(_0x17f4fc){utils['error'](util['format'](_0xbf16('0x2e'),_0x58441d[_0xbf16('0x5')]),_0x17f4fc);}};exports[_0xbf16('0x2f')]=function(_0x54753a){try{if(!_[_0xbf16('0x16')](queues[_0x54753a['uniqueid']])){utils[_0xbf16('0xe')](util['format'](_0xbf16('0x30'),_0x54753a[_0xbf16('0x5')]),_0x54753a);utils['info'](util['format'](_0xbf16('0x31'),_0x54753a['uniqueid'],queues[_0x54753a[_0xbf16('0x5')]][_0xbf16('0x28')],_0x54753a[_0xbf16('0x32')],_0x54753a['connectedlinename']));queues[_0x54753a[_0xbf16('0x5')]]['queuecallerleave']=!![];queues[_0x54753a[_0xbf16('0x5')]]['queuecallerleaveAt']=utils[_0xbf16('0x13')]();queues[_0x54753a[_0xbf16('0x5')]]['holdtime']=utils['diffTime'](queues[_0x54753a[_0xbf16('0x5')]][_0xbf16('0x17')],queues[_0x54753a['uniqueid']][_0xbf16('0x33')]);queues[_0x54753a['uniqueid']][_0xbf16('0x11')]=_0x54753a['position'];queues[_0x54753a[_0xbf16('0x5')]][_0xbf16('0x34')]=_0x54753a[_0xbf16('0x34')];queues[_0x54753a[_0xbf16('0x5')]]['connectedlinenum']=_0x54753a['connectedlinenum'];queues[_0x54753a[_0xbf16('0x5')]][_0xbf16('0x35')]=_0x54753a[_0xbf16('0x35')];}}catch(_0x4e3950){utils[_0xbf16('0x14')](util[_0xbf16('0x3')]('[%s][queues][queuecallerleave]',_0x54753a[_0xbf16('0x5')]),_0x4e3950);}};exports[_0xbf16('0x36')]=function(_0x510def){try{if(!_[_0xbf16('0x16')](queues[_0x510def['uniqueid']])){utils[_0xbf16('0xe')](util[_0xbf16('0x3')]('[%s][queues][agentconnect]',_0x510def['uniqueid']),_0x510def);utils[_0xbf16('0x2')](util['format'](_0xbf16('0x37'),_0x510def[_0xbf16('0x5')],queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x28')],_0x510def[_0xbf16('0x38')],_0x510def[_0xbf16('0x39')]));queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x24')]=![];queues[_0x510def['uniqueid']][_0xbf16('0x24')]=![];queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x25')]=null;queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x18')]=![];queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x1b')]=null;queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x2a')]=null;queues[_0x510def[_0xbf16('0x5')]]['assigned']=!![];queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x8')]=_0x510def[_0xbf16('0x39')];queues[_0x510def[_0xbf16('0x5')]][_0xbf16('0x7')]=_0x510def['membername'];}}catch(_0x25deef){utils[_0xbf16('0x14')](util['format'](_0xbf16('0x3a'),_0x510def[_0xbf16('0x5')]),_0x25deef);}};exports[_0xbf16('0x3b')]=function(_0x396059){try{if(!_[_0xbf16('0x16')](queues[_0x396059[_0xbf16('0x5')]])){if(queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x17')]){utils['debug'](util[_0xbf16('0x3')](_0xbf16('0x3c'),_0x396059[_0xbf16('0x5')]),_0x396059);queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x24')]=![];queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x24')]=![];queues[_0x396059[_0xbf16('0x5')]]['queuecallerabandonAt']=null;queues[_0x396059['uniqueid']][_0xbf16('0x18')]=![];queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x2a')]=null;queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x3d')]=!![];queues[_0x396059[_0xbf16('0x5')]]['lastAssignedTo']=_0x396059[_0xbf16('0x38')];queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x3e')]=!![];queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x19')]=utils[_0xbf16('0x13')]();if(_0x396059[_0xbf16('0x3f')]==_0xbf16('0x40')){if(!queues[_0x396059[_0xbf16('0x5')]][_0xbf16('0x40')]){queues[_0x396059['uniqueid']][_0xbf16('0x1b')]='TRANSFER';}}else{queues[_0x396059[_0xbf16('0x5')]]['queuecallerexitreason']=_0xbf16('0x41')+_0x396059[_0xbf16('0x3f')][_0xbf16('0x26')]();}utils[_0xbf16('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x396059['uniqueid'],queues[_0x396059[_0xbf16('0x5')]]['name'],_0x396059[_0xbf16('0x38')],queues[_0x396059['uniqueid']][_0xbf16('0x1b')]));writeDB(queues[_0x396059[_0xbf16('0x5')]]);}}}catch(_0x189603){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0x3c'),_0x396059['uniqueid']),_0x189603);}};exports[_0xbf16('0x42')]=function(_0x1a04fa){try{if(!_['isNil'](queues[_0x1a04fa['transfereeuniqueid']])){utils[_0xbf16('0xe')](util['format'](_0xbf16('0x43'),_0x1a04fa[_0xbf16('0x5')]),_0x1a04fa);queues[_0x1a04fa[_0xbf16('0x44')]][_0xbf16('0x40')]=!![];queues[_0x1a04fa['transfereeuniqueid']][_0xbf16('0x45')]=_0xbf16('0x46');queues[_0x1a04fa[_0xbf16('0x44')]][_0xbf16('0x47')]=_0x1a04fa[_0xbf16('0x48')];queues[_0x1a04fa[_0xbf16('0x44')]][_0xbf16('0x49')]=_0x1a04fa[_0xbf16('0x44')];queues[_0x1a04fa[_0xbf16('0x44')]][_0xbf16('0x1b')]=_0xbf16('0x4a');utils[_0xbf16('0x2')](util[_0xbf16('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1a04fa[_0xbf16('0x5')],queues[_0x1a04fa[_0xbf16('0x44')]][_0xbf16('0x28')],_0x1a04fa[_0xbf16('0x44')],_0x1a04fa[_0xbf16('0x48')]));}}catch(_0x1d0e56){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0x43'),_0x1a04fa['uniqueid']),_0x1d0e56);}};exports['attendedtransfer']=function(_0x1a366d){try{utils[_0xbf16('0xe')](util[_0xbf16('0x3')](_0xbf16('0x4b'),_0x1a366d[_0xbf16('0x4c')]),_0x1a366d);if(_0x1a366d[_0xbf16('0x4c')]==_0x1a366d[_0xbf16('0x4d')]){if(!_[_0xbf16('0x16')](queues[_0x1a366d[_0xbf16('0x4e')]])){utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x4f'),_0x1a366d[_0xbf16('0x4c')],queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x28')],_0x1a366d[_0xbf16('0x50')]));queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x40')]=!![];queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x45')]='ATTENDED';queues[_0x1a366d['secondtransfererlinkedid']]['transferexten']=_0x1a366d[_0xbf16('0x50')];queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x49')]=_0x1a366d['origtransfereruniqueid'];queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x1b')]='ATTENDEDTRANSFER';}if(!_[_0xbf16('0x16')](queues[_0x1a366d[_0xbf16('0x4d')]])){if(_0x1a366d['transfereelinkedid']&&queues[_0x1a366d[_0xbf16('0x51')]]){queues[_0x1a366d[_0xbf16('0x51')]][_0xbf16('0x1d')]=0x1;queues[_0x1a366d[_0xbf16('0x44')]]=_[_0xbf16('0x52')](queues[_0x1a366d[_0xbf16('0x51')]]);queues[_0x1a366d[_0xbf16('0x44')]][_0xbf16('0xc')]=_0x1a366d['transfertargetuniqueid'];queues[_0x1a366d['transfereeuniqueid']][_0xbf16('0x1d')]=0x2;queues[_0x1a366d[_0xbf16('0x44')]]['calleridnum']=queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x53')];queues[_0x1a366d[_0xbf16('0x44')]]['calleridname']=queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0x54')];queues[_0x1a366d['transfereeuniqueid']][_0xbf16('0x33')]=utils[_0xbf16('0x13')]();queues[_0x1a366d[_0xbf16('0x44')]]['queuecallerleaveAt']=utils[_0xbf16('0x13')]();queues[_0x1a366d[_0xbf16('0x44')]][_0xbf16('0x55')]=0x0;queues[_0x1a366d[_0xbf16('0x44')]][_0xbf16('0x56')]=0x0;utils[_0xbf16('0x2')](util[_0xbf16('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1a366d['origtransfereruniqueid'],queues[_0x1a366d[_0xbf16('0x44')]]['name'],queues[_0x1a366d[_0xbf16('0x44')]][_0xbf16('0x53')],queues[_0x1a366d[_0xbf16('0x44')]][_0xbf16('0x54')]));}else{utils['info'](util['format'](_0xbf16('0x57'),_0x1a366d[_0xbf16('0x4c')],queues[_0x1a366d[_0xbf16('0x4d')]][_0xbf16('0x28')],_0x1a366d['secondtransfererlinkedid']));queues[_0x1a366d[_0xbf16('0x4d')]][_0xbf16('0xc')]=_0x1a366d[_0xbf16('0x4e')];}}}else if(_0x1a366d[_0xbf16('0x58')]==_0x1a366d[_0xbf16('0x4e')]){if(!_[_0xbf16('0x16')](queues[_0x1a366d[_0xbf16('0x4d')]])){utils[_0xbf16('0x2')](util['format'](_0xbf16('0x59'),_0x1a366d[_0xbf16('0x4c')],queues[_0x1a366d[_0xbf16('0x4d')]][_0xbf16('0x28')],_0x1a366d['secondtransfereruniqueid'],_0x1a366d[_0xbf16('0x5a')]));queues[_0x1a366d['origtransfererlinkedid']][_0xbf16('0x40')]=!![];queues[_0x1a366d['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x1a366d[_0xbf16('0x4d')]]['transferexten']=_0x1a366d['secondtransfererexten'];queues[_0x1a366d['origtransfererlinkedid']][_0xbf16('0x49')]=_0x1a366d[_0xbf16('0x58')];queues[_0x1a366d['origtransfererlinkedid']]['queuecallerexitreason']=_0xbf16('0x5b');}if(!_[_0xbf16('0x16')](queues[_0x1a366d['secondtransfererlinkedid']])){if(_0x1a366d['transfertargetlinkedid']&&queues[_0x1a366d['transfertargetlinkedid']]){queues[_0x1a366d[_0xbf16('0x5c')]][_0xbf16('0x1d')]=0x1;queues[_0x1a366d['transfertargetuniqueid']]=_[_0xbf16('0x52')](queues[_0x1a366d['transfertargetlinkedid']]);queues[_0x1a366d['transfertargetuniqueid']][_0xbf16('0xc')]=_0x1a366d[_0xbf16('0x5d')];queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x1d')]=0x2;queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x53')]=queues[_0x1a366d[_0xbf16('0x4d')]][_0xbf16('0x53')];queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x54')]=queues[_0x1a366d[_0xbf16('0x4d')]][_0xbf16('0x54')];queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x33')]=utils[_0xbf16('0x13')]();queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x17')]=utils['now']();queues[_0x1a366d['transfertargetuniqueid']][_0xbf16('0x55')]=0x0;queues[_0x1a366d[_0xbf16('0x5d')]]['mohtime']=0x0;utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x5e'),_0x1a366d['origtransfereruniqueid'],queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x28')],queues[_0x1a366d[_0xbf16('0x5d')]]['transfereduniqueid'],queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x53')],queues[_0x1a366d[_0xbf16('0x5d')]][_0xbf16('0x54')]));}else{utils[_0xbf16('0x2')](util[_0xbf16('0x3')](_0xbf16('0x57'),_0x1a366d[_0xbf16('0x4c')],queues[_0x1a366d['secondtransfererlinkedid']][_0xbf16('0x28')],_0x1a366d[_0xbf16('0x4d')]));queues[_0x1a366d[_0xbf16('0x4e')]][_0xbf16('0xc')]=_0x1a366d[_0xbf16('0x4d')];}}}}catch(_0x4e40c5){utils[_0xbf16('0x14')](util[_0xbf16('0x3')](_0xbf16('0x4b'),_0x1a366d[_0xbf16('0x4c')]),_0x4e40c5);}};exports[_0xbf16('0x5f')]=function(_0x15abbd){try{if(!_['isNil'](queues[_0x15abbd[_0xbf16('0x5')]])){utils['debug'](util[_0xbf16('0x3')](_0xbf16('0x60'),_0x15abbd['uniqueid']),_0x15abbd);queues[_0x15abbd[_0xbf16('0x5')]]['musiconholdstartAt']=utils[_0xbf16('0x13')]();utils[_0xbf16('0x2')](util[_0xbf16('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x15abbd[_0xbf16('0x5')],queues[_0x15abbd[_0xbf16('0x5')]][_0xbf16('0x28')],queues[_0x15abbd[_0xbf16('0x5')]][_0xbf16('0x61')]));}}catch(_0x46b0a0){utils[_0xbf16('0x14')](util[_0xbf16('0x3')]('[%s][queues][musiconholdstart]',_0x15abbd[_0xbf16('0x5')]),_0x46b0a0);}};exports[_0xbf16('0x62')]=function(_0x309d47){try{if(!_[_0xbf16('0x16')](queues[_0x309d47[_0xbf16('0x5')]])){if(!_['isNil'](queues[_0x309d47[_0xbf16('0x5')]]['musiconholdstartAt'])){utils[_0xbf16('0xe')](util[_0xbf16('0x3')](_0xbf16('0x63'),_0x309d47['uniqueid']),_0x309d47);queues[_0x309d47[_0xbf16('0x5')]][_0xbf16('0x56')]+=utils['diffTime'](utils['now'](),queues[_0x309d47[_0xbf16('0x5')]]['musiconholdstartAt']);utils['info'](util[_0xbf16('0x3')](_0xbf16('0x64'),_0x309d47[_0xbf16('0x5')],queues[_0x309d47[_0xbf16('0x5')]]['name'],queues[_0x309d47[_0xbf16('0x5')]]['mohtime']));delete queues[_0x309d47['uniqueid']][_0xbf16('0x61')];}}}catch(_0x210139){utils[_0xbf16('0x14')](util['format']('[%s][queues][musiconholdstop]',_0x309d47[_0xbf16('0x5')]),_0x210139);}}; \ No newline at end of file +var _0x02f4=['transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','uniqueid','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','membername','assigned','destaccountcode','lastAssignedTo','[%s][queues][agentconnect]','queuecallercompleteAt','reason'];(function(_0xf39f64,_0x110a98){var _0x3a307a=function(_0x19ed1b){while(--_0x19ed1b){_0xf39f64['push'](_0xf39f64['shift']());}};_0x3a307a(++_0x110a98);}(_0x02f4,0x1bd));var _0x402f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x02f4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x402f('0x0'));var util=require(_0x402f('0x1'));var utils=require(_0x402f('0x2'));var queues={};function writeDB(_0x2282b5){utils[_0x402f('0x3')](util[_0x402f('0x4')](_0x402f('0x5'),_0x2282b5['uniqueid'],_0x2282b5[_0x402f('0x6')],_0x2282b5['queue'],_0x2282b5['lastAssignedTo'],_0x2282b5[_0x402f('0x7')],_0x2282b5[_0x402f('0x8')],_0x2282b5[_0x402f('0x9')]));if(_0x2282b5[_0x402f('0xa')]){utils[_0x402f('0xb')](_0x2282b5[_0x402f('0xa')])['then'](function(_0x473f11){if(_0x473f11){_0x2282b5[_0x402f('0xc')]=_0x473f11[_0x402f('0xc')];}utils[_0x402f('0xd')](_0x402f('0xe'),_0x2282b5);});}else{utils[_0x402f('0xd')](_0x402f('0xe'),_0x2282b5);}if(_0x2282b5['transfereduniqueid']){delete queues[_0x2282b5[_0x402f('0xf')]];}else{delete queues[_0x2282b5['uniqueid']];}}exports[_0x402f('0x10')]=function(_0x53760d){try{utils[_0x402f('0x11')](util[_0x402f('0x4')]('[%s][queues][queuecallerjoin]',_0x53760d[_0x402f('0x12')]),_0x53760d);utils['info'](util[_0x402f('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x53760d[_0x402f('0x12')],_0x53760d[_0x402f('0xa')],_0x53760d[_0x402f('0x13')]));queues[_0x53760d[_0x402f('0x12')]]=_[_0x402f('0x14')](_0x53760d,{'originalposition':_0x53760d[_0x402f('0x13')],'queuecallerjoinAt':utils[_0x402f('0x15')](),'mohtime':0x0});}catch(_0x49f21d){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x17'),_0x53760d['uniqueid']),_0x49f21d);}};exports['hangup']=function(_0x49ec7d){try{if(!_[_0x402f('0x18')](queues[_0x49ec7d[_0x402f('0x12')]])){utils['debug'](util[_0x402f('0x4')](_0x402f('0x19'),_0x49ec7d['uniqueid']),_0x49ec7d);if(queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x1a')]){if(!queues[_0x49ec7d[_0x402f('0x12')]]['queuecallerabandon']&&!queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x1b')]){queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x1c')]=!![];queues[_0x49ec7d[_0x402f('0x12')]]['queuecallercompleteAt']=utils['now']();queues[_0x49ec7d[_0x402f('0x12')]]['queuecallerexitreason']=_0x402f('0x1d');}utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x49ec7d['uniqueid'],queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x1e')],queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x9')]));writeDB(queues[_0x49ec7d[_0x402f('0x12')]]);}else if(queues[_0x49ec7d['uniqueid']]['transfereduniqueid']){utils['info'](util[_0x402f('0x4')](_0x402f('0x1f'),_0x49ec7d[_0x402f('0x12')],queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0x1e')],queues[_0x49ec7d['uniqueid']][_0x402f('0xf')]));queues[queues[_0x49ec7d['uniqueid']][_0x402f('0xf')]]=queues[_0x49ec7d['uniqueid']];queues[queues[_0x49ec7d[_0x402f('0x12')]][_0x402f('0xf')]][_0x402f('0x20')]=0x2;delete queues[_0x49ec7d[_0x402f('0x12')]];}}}catch(_0x4cebd8){utils[_0x402f('0x16')](util[_0x402f('0x4')]('[%s][queues][hangup]',_0x49ec7d['uniqueid']),_0x4cebd8);}};exports[_0x402f('0x21')]=function(_0x3e6b8b){try{utils[_0x402f('0x11')](util[_0x402f('0x4')]('[%s][queues][varset]',_0x3e6b8b[_0x402f('0x12')]),_0x3e6b8b);if(!_['isNil'](_0x3e6b8b[_0x402f('0x22')][_0x402f('0x23')])&&_0x3e6b8b['value'][_0x402f('0x24')]()!==_0x402f('0x25')){if(!_[_0x402f('0x18')](queues[_0x3e6b8b[_0x402f('0x12')]])){queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x26')]=![];queues[_0x3e6b8b[_0x402f('0x12')]]['queuecallerabandonAt']=null;queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x1b')]=!![];queues[_0x3e6b8b['uniqueid']][_0x402f('0x27')]=utils[_0x402f('0x15')]();queues[_0x3e6b8b['uniqueid']]['queuecallerexitreason']=_0x3e6b8b[_0x402f('0x28')]['toUpperCase']();utils[_0x402f('0x3')](util[_0x402f('0x4')](_0x402f('0x29'),_0x3e6b8b[_0x402f('0x12')],queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x1e')],_0x3e6b8b['value'],queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x9')]));writeDB(queues[_0x3e6b8b[_0x402f('0x12')]]);}}else if(!_[_0x402f('0x18')](_0x3e6b8b['variable']['queueposition'])){if(!_['isNil'](queues[_0x3e6b8b[_0x402f('0x12')]])&&!queues[_0x3e6b8b['uniqueid']]['queuecallerabandon']){queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x26')]=![];queues[_0x3e6b8b['uniqueid']][_0x402f('0x2a')]=null;queues[_0x3e6b8b['uniqueid']][_0x402f('0x1b')]=!![];queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x27')]=utils[_0x402f('0x15')]();queues[_0x3e6b8b[_0x402f('0x12')]]['queuecallerexitreason']=_0x402f('0x2b');utils[_0x402f('0x3')](util['format'](_0x402f('0x2c'),_0x3e6b8b['uniqueid'],queues[_0x3e6b8b[_0x402f('0x12')]][_0x402f('0x1e')],_0x3e6b8b[_0x402f('0x28')],queues[_0x3e6b8b[_0x402f('0x12')]]['queuecallerexitreason']));}}}catch(_0x1bb122){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x2d'),_0x3e6b8b['uniqueid']),_0x1bb122);}};exports[_0x402f('0x26')]=function(_0x454b68){try{if(!_['isNil'](queues[_0x454b68[_0x402f('0x12')]])){utils[_0x402f('0x11')](util[_0x402f('0x4')](_0x402f('0x2e'),_0x454b68['uniqueid']),_0x454b68);queues[_0x454b68[_0x402f('0x12')]][_0x402f('0x1b')]=![];queues[_0x454b68[_0x402f('0x12')]][_0x402f('0x27')]=null;queues[_0x454b68[_0x402f('0x12')]]['queuecallerabandon']=!![];queues[_0x454b68[_0x402f('0x12')]]['queuecallerabandonAt']=utils[_0x402f('0x15')]();queues[_0x454b68[_0x402f('0x12')]][_0x402f('0x9')]=_0x402f('0x2f');utils['info'](util['format'](_0x402f('0x30'),_0x454b68[_0x402f('0x12')],queues[_0x454b68[_0x402f('0x12')]][_0x402f('0x1e')],queues[_0x454b68[_0x402f('0x12')]][_0x402f('0x9')]));}}catch(_0xe74eb4){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x2e'),_0x454b68['uniqueid']),_0xe74eb4);}};exports['queuecallerleave']=function(_0x4c32a0){try{if(!_[_0x402f('0x18')](queues[_0x4c32a0[_0x402f('0x12')]])){utils['debug'](util[_0x402f('0x4')]('[%s][queues][queuecallerleave]',_0x4c32a0[_0x402f('0x12')]),_0x4c32a0);utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4c32a0[_0x402f('0x12')],queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x1e')],_0x4c32a0[_0x402f('0x31')],_0x4c32a0[_0x402f('0x32')]));queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x33')]=!![];queues[_0x4c32a0['uniqueid']][_0x402f('0x1a')]=utils[_0x402f('0x15')]();queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x34')]=utils[_0x402f('0x35')](queues[_0x4c32a0['uniqueid']][_0x402f('0x1a')],queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x36')]);queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x13')]=_0x4c32a0[_0x402f('0x13')];queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x37')]=_0x4c32a0[_0x402f('0x37')];queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x31')]=_0x4c32a0[_0x402f('0x31')];queues[_0x4c32a0[_0x402f('0x12')]][_0x402f('0x32')]=_0x4c32a0[_0x402f('0x32')];}}catch(_0x555e4b){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x38'),_0x4c32a0['uniqueid']),_0x555e4b);}};exports[_0x402f('0x39')]=function(_0x1f2cc6){try{if(!_['isNil'](queues[_0x1f2cc6[_0x402f('0x12')]])){utils[_0x402f('0x11')](util[_0x402f('0x4')]('[%s][queues][agentconnect]',_0x1f2cc6[_0x402f('0x12')]),_0x1f2cc6);utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1f2cc6['uniqueid'],queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x1e')],_0x1f2cc6[_0x402f('0x3a')],_0x1f2cc6['destaccountcode']));queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x26')]=![];queues[_0x1f2cc6['uniqueid']][_0x402f('0x26')]=![];queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x2a')]=null;queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x1b')]=![];queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x9')]=null;queues[_0x1f2cc6[_0x402f('0x12')]]['queuecallerexitAt']=null;queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x3b')]=!![];queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x8')]=_0x1f2cc6[_0x402f('0x3c')];queues[_0x1f2cc6[_0x402f('0x12')]][_0x402f('0x3d')]=_0x1f2cc6['membername'];}}catch(_0x113206){utils['error'](util['format'](_0x402f('0x3e'),_0x1f2cc6[_0x402f('0x12')]),_0x113206);}};exports['agentcomplete']=function(_0x3c12ce){try{if(!_[_0x402f('0x18')](queues[_0x3c12ce[_0x402f('0x12')]])){if(queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x1a')]){utils[_0x402f('0x11')](util[_0x402f('0x4')]('[%s][queues][agentcomplete]',_0x3c12ce[_0x402f('0x12')]),_0x3c12ce);queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x26')]=![];queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x26')]=![];queues[_0x3c12ce['uniqueid']][_0x402f('0x2a')]=null;queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x1b')]=![];queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x27')]=null;queues[_0x3c12ce[_0x402f('0x12')]]['assigned']=!![];queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x3d')]=_0x3c12ce['membername'];queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x1c')]=!![];queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x3f')]=utils[_0x402f('0x15')]();if(_0x3c12ce[_0x402f('0x40')]==_0x402f('0x41')){if(!queues[_0x3c12ce['uniqueid']][_0x402f('0x41')]){queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x9')]=_0x402f('0x42');}}else{queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x9')]=_0x402f('0x43')+_0x3c12ce[_0x402f('0x40')][_0x402f('0x24')]();}utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3c12ce[_0x402f('0x12')],queues[_0x3c12ce[_0x402f('0x12')]]['name'],_0x3c12ce[_0x402f('0x3a')],queues[_0x3c12ce[_0x402f('0x12')]][_0x402f('0x9')]));writeDB(queues[_0x3c12ce[_0x402f('0x12')]]);}}}catch(_0x48e904){utils[_0x402f('0x16')](util[_0x402f('0x4')]('[%s][queues][agentcomplete]',_0x3c12ce['uniqueid']),_0x48e904);}};exports[_0x402f('0x44')]=function(_0x3d8b03){try{if(!_[_0x402f('0x18')](queues[_0x3d8b03['transfereeuniqueid']])){utils[_0x402f('0x11')](util[_0x402f('0x4')](_0x402f('0x45'),_0x3d8b03['uniqueid']),_0x3d8b03);queues[_0x3d8b03[_0x402f('0x46')]][_0x402f('0x41')]=!![];queues[_0x3d8b03[_0x402f('0x46')]][_0x402f('0x47')]=_0x402f('0x48');queues[_0x3d8b03[_0x402f('0x46')]][_0x402f('0x49')]=_0x3d8b03[_0x402f('0x4a')];queues[_0x3d8b03['transfereeuniqueid']][_0x402f('0x4b')]=_0x3d8b03[_0x402f('0x46')];queues[_0x3d8b03['transfereeuniqueid']]['queuecallerexitreason']=_0x402f('0x4c');utils['info'](util[_0x402f('0x4')](_0x402f('0x4d'),_0x3d8b03['uniqueid'],queues[_0x3d8b03[_0x402f('0x46')]][_0x402f('0x1e')],_0x3d8b03[_0x402f('0x46')],_0x3d8b03['extension']));}}catch(_0x2d1bb6){utils[_0x402f('0x16')](util[_0x402f('0x4')]('[%s][queues][blindtransfer]',_0x3d8b03['uniqueid']),_0x2d1bb6);}};exports[_0x402f('0x4e')]=function(_0x44b223){try{utils[_0x402f('0x11')](util[_0x402f('0x4')](_0x402f('0x4f'),_0x44b223['origtransfereruniqueid']),_0x44b223);if(_0x44b223[_0x402f('0x50')]==_0x44b223[_0x402f('0x51')]){if(!_[_0x402f('0x18')](queues[_0x44b223[_0x402f('0x52')]])){utils['info'](util[_0x402f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x44b223['origtransfereruniqueid'],queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x1e')],_0x44b223[_0x402f('0x53')]));queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x41')]=!![];queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x47')]='ATTENDED';queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x49')]=_0x44b223[_0x402f('0x53')];queues[_0x44b223['secondtransfererlinkedid']]['transferuniqueid']=_0x44b223[_0x402f('0x50')];queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x402f('0x18')](queues[_0x44b223['origtransfererlinkedid']])){if(_0x44b223['transfereelinkedid']&&queues[_0x44b223[_0x402f('0x54')]]){queues[_0x44b223[_0x402f('0x54')]]['queuecallerenterreason']=0x1;queues[_0x44b223[_0x402f('0x46')]]=_[_0x402f('0x55')](queues[_0x44b223[_0x402f('0x54')]]);queues[_0x44b223[_0x402f('0x46')]]['transfereduniqueid']=_0x44b223[_0x402f('0x56')];queues[_0x44b223['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x44b223[_0x402f('0x46')]][_0x402f('0x7')]=queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x7')];queues[_0x44b223['transfereeuniqueid']][_0x402f('0x57')]=queues[_0x44b223[_0x402f('0x52')]][_0x402f('0x57')];queues[_0x44b223['transfereeuniqueid']][_0x402f('0x36')]=utils[_0x402f('0x15')]();queues[_0x44b223[_0x402f('0x46')]][_0x402f('0x1a')]=utils['now']();queues[_0x44b223[_0x402f('0x46')]]['holdtime']=0x0;queues[_0x44b223['transfereeuniqueid']][_0x402f('0x58')]=0x0;utils['info'](util[_0x402f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x44b223[_0x402f('0x50')],queues[_0x44b223['transfereeuniqueid']][_0x402f('0x1e')],queues[_0x44b223['transfereeuniqueid']][_0x402f('0x7')],queues[_0x44b223['transfereeuniqueid']][_0x402f('0x57')]));}else{utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x44b223[_0x402f('0x50')],queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x1e')],_0x44b223[_0x402f('0x52')]));queues[_0x44b223[_0x402f('0x51')]][_0x402f('0xf')]=_0x44b223['secondtransfererlinkedid'];}}}else if(_0x44b223[_0x402f('0x59')]==_0x44b223['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x44b223[_0x402f('0x51')]])){utils[_0x402f('0x3')](util[_0x402f('0x4')](_0x402f('0x5a'),_0x44b223['origtransfereruniqueid'],queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x1e')],_0x44b223[_0x402f('0x59')],_0x44b223[_0x402f('0x5b')]));queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x41')]=!![];queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x47')]=_0x402f('0x5c');queues[_0x44b223['origtransfererlinkedid']]['transferexten']=_0x44b223[_0x402f('0x5b')];queues[_0x44b223[_0x402f('0x51')]]['transferuniqueid']=_0x44b223[_0x402f('0x59')];queues[_0x44b223[_0x402f('0x51')]]['queuecallerexitreason']=_0x402f('0x5d');}if(!_[_0x402f('0x18')](queues[_0x44b223['secondtransfererlinkedid']])){if(_0x44b223['transfertargetlinkedid']&&queues[_0x44b223[_0x402f('0x5e')]]){queues[_0x44b223[_0x402f('0x5e')]][_0x402f('0x20')]=0x1;queues[_0x44b223[_0x402f('0x56')]]=_[_0x402f('0x55')](queues[_0x44b223[_0x402f('0x5e')]]);queues[_0x44b223[_0x402f('0x56')]][_0x402f('0xf')]=_0x44b223[_0x402f('0x56')];queues[_0x44b223['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x44b223[_0x402f('0x56')]][_0x402f('0x7')]=queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x7')];queues[_0x44b223[_0x402f('0x56')]][_0x402f('0x57')]=queues[_0x44b223[_0x402f('0x51')]][_0x402f('0x57')];queues[_0x44b223[_0x402f('0x56')]][_0x402f('0x36')]=utils[_0x402f('0x15')]();queues[_0x44b223['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x402f('0x15')]();queues[_0x44b223[_0x402f('0x56')]][_0x402f('0x34')]=0x0;queues[_0x44b223['transfertargetuniqueid']][_0x402f('0x58')]=0x0;utils['info'](util[_0x402f('0x4')](_0x402f('0x5f'),_0x44b223[_0x402f('0x50')],queues[_0x44b223[_0x402f('0x56')]][_0x402f('0x1e')],queues[_0x44b223[_0x402f('0x56')]][_0x402f('0xf')],queues[_0x44b223[_0x402f('0x56')]]['calleridnum'],queues[_0x44b223['transfertargetuniqueid']][_0x402f('0x57')]));}else{utils[_0x402f('0x3')](util[_0x402f('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x44b223[_0x402f('0x50')],queues[_0x44b223['secondtransfererlinkedid']][_0x402f('0x1e')],_0x44b223[_0x402f('0x51')]));queues[_0x44b223[_0x402f('0x52')]][_0x402f('0xf')]=_0x44b223[_0x402f('0x51')];}}}}catch(_0x4cb7e3){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x4f'),_0x44b223[_0x402f('0x50')]),_0x4cb7e3);}};exports[_0x402f('0x60')]=function(_0x4c49e7){try{if(!_[_0x402f('0x18')](queues[_0x4c49e7[_0x402f('0x12')]])){utils[_0x402f('0x11')](util[_0x402f('0x4')]('[%s][queues][musiconholdstart]',_0x4c49e7[_0x402f('0x12')]),_0x4c49e7);queues[_0x4c49e7[_0x402f('0x12')]]['musiconholdstartAt']=utils[_0x402f('0x15')]();utils[_0x402f('0x3')](util[_0x402f('0x4')](_0x402f('0x61'),_0x4c49e7[_0x402f('0x12')],queues[_0x4c49e7[_0x402f('0x12')]][_0x402f('0x1e')],queues[_0x4c49e7[_0x402f('0x12')]][_0x402f('0x62')]));}}catch(_0x3827a2){utils[_0x402f('0x16')](util[_0x402f('0x4')](_0x402f('0x63'),_0x4c49e7[_0x402f('0x12')]),_0x3827a2);}};exports[_0x402f('0x64')]=function(_0x1404f2){try{if(!_[_0x402f('0x18')](queues[_0x1404f2[_0x402f('0x12')]])){if(!_[_0x402f('0x18')](queues[_0x1404f2['uniqueid']][_0x402f('0x62')])){utils[_0x402f('0x11')](util[_0x402f('0x4')](_0x402f('0x65'),_0x1404f2[_0x402f('0x12')]),_0x1404f2);queues[_0x1404f2[_0x402f('0x12')]][_0x402f('0x58')]+=utils[_0x402f('0x35')](utils[_0x402f('0x15')](),queues[_0x1404f2['uniqueid']][_0x402f('0x62')]);utils['info'](util[_0x402f('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1404f2[_0x402f('0x12')],queues[_0x1404f2[_0x402f('0x12')]][_0x402f('0x1e')],queues[_0x1404f2[_0x402f('0x12')]][_0x402f('0x58')]));delete queues[_0x1404f2[_0x402f('0x12')]][_0x402f('0x62')];}}}catch(_0x2c0bfb){utils[_0x402f('0x16')](util['format'](_0x402f('0x65'),_0x1404f2[_0x402f('0x12')]),_0x2c0bfb);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 67f7809..3672f2a 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 _0x4973=['info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','lodash','./utils'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x4973,0xbb));var _0x3497=function(_0x514846,_0x34ac8d){_0x514846=_0x514846-0x0;var _0x2627a8=_0x4973[_0x514846];return _0x2627a8;};'use strict';var _=require(_0x3497('0x0'));var util=require('util');var utils=require(_0x3497('0x1'));var recordings={};function writeDB(_0x1eab94){utils[_0x3497('0x2')](util[_0x3497('0x3')](_0x3497('0x4'),_0x1eab94[_0x3497('0x5')]));if(_0x1eab94['accountcode']){utils[_0x3497('0x6')](_0x1eab94[_0x3497('0x7')])['then'](function(_0x49e7fb){if(_0x49e7fb){_0x1eab94['membername']=_0x49e7fb['name'];_0x1eab94[_0x3497('0x8')]=_0x49e7fb['id'];}utils[_0x3497('0x9')]('CreateVoiceRecording',_0x1eab94);});}else{utils[_0x3497('0x9')](_0x3497('0xa'),_0x1eab94);}}exports[_0x3497('0xb')]=function(_0x195aad){try{utils[_0x3497('0xc')](util[_0x3497('0x3')](_0x3497('0xd'),_0x195aad[_0x3497('0x5')]),_0x195aad);if(_0x195aad[_0x3497('0x5')]==_0x195aad['linkedid']){utils[_0x3497('0x2')](util[_0x3497('0x3')](_0x3497('0xe'),_0x195aad[_0x3497('0x5')],_0x195aad[_0x3497('0xf')],_0x195aad[_0x3497('0x10')]));recordings[_0x195aad[_0x3497('0x5')]]={'uniqueid':_0x195aad[_0x3497('0x5')],'accountcode':_0x195aad[_0x3497('0x7')],'exten':_0x195aad[_0x3497('0x10')],'context':_0x195aad[_0x3497('0xf')],'channel':_0x195aad[_0x3497('0x11')],'monitors':[]};}}catch(_0xd2c197){utils[_0x3497('0x12')](util['format'](_0x3497('0xd'),_0x195aad[_0x3497('0x5')]),_0xd2c197);}};exports[_0x3497('0x13')]=function(_0x26796a){try{utils[_0x3497('0xc')](util['format'](_0x3497('0x14'),_0x26796a['uniqueid']),_0x26796a);if(!_['isNil'](recordings[_0x26796a[_0x3497('0x5')]])&&_0x26796a[_0x3497('0x15')]==0x6){utils['info'](util[_0x3497('0x3')](_0x3497('0x16'),_0x26796a[_0x3497('0x5')],_0x26796a[_0x3497('0xf')],_0x26796a['channel']));}else if(!_[_0x3497('0x17')](recordings[_0x26796a[_0x3497('0x18')]])&&_0x26796a[_0x3497('0x15')]==0x6&&_0x26796a[_0x3497('0xf')]!=_0x3497('0x19')){utils['info'](util[_0x3497('0x3')](_0x3497('0x1a'),_0x26796a[_0x3497('0x5')],_0x26796a[_0x3497('0x18')],_0x26796a['context'],_0x26796a[_0x3497('0x11')]));recordings[_0x26796a['linkedid']][_0x3497('0x7')]=_0x26796a[_0x3497('0x7')];}}catch(_0x572ba2){utils[_0x3497('0x12')](util[_0x3497('0x3')](_0x3497('0x14'),_0x26796a['uniqueid']),_0x572ba2);}};exports[_0x3497('0x1b')]=function(_0x4b3ceb){try{if(!_[_0x3497('0x17')](_0x4b3ceb[_0x3497('0x1c')])&&!_[_0x3497('0x17')](_0x4b3ceb['variable'][_0x3497('0x1d')])){utils['debug'](util['format'](_0x3497('0x1e'),_0x4b3ceb[_0x3497('0x5')]),_0x4b3ceb);utils[_0x3497('0x2')](util[_0x3497('0x3')](_0x3497('0x1f'),_0x4b3ceb[_0x3497('0x5')],_0x4b3ceb[_0x3497('0x1c')],_0x4b3ceb[_0x3497('0x20')]));if(_[_0x3497('0x21')](_0x4b3ceb[_0x3497('0x20')],'.wav49')){_0x4b3ceb['value']=_0x4b3ceb[_0x3497('0x20')][_0x3497('0x22')](_0x3497('0x23'),_0x3497('0x24'));}if(recordings[_0x4b3ceb['linkedid']]){var _0x295cdc=_[_0x3497('0x25')](recordings[_0x4b3ceb['linkedid']][_0x3497('0x26')],{'value':_0x4b3ceb[_0x3497('0x20')]});if(_[_0x3497('0x17')](_0x295cdc)){recordings[_0x4b3ceb['linkedid']]['monitors'][_0x3497('0x27')]({'value':_0x4b3ceb['value']});}}}}catch(_0x291984){utils[_0x3497('0x12')](util['format']('[%s][recordings][varset]',_0x4b3ceb[_0x3497('0x5')]),_0x291984);}};exports['hangup']=function(_0x261a60){try{if(!_[_0x3497('0x17')](recordings[_0x261a60[_0x3497('0x5')]])){utils[_0x3497('0xc')](util[_0x3497('0x3')](_0x3497('0x28'),_0x261a60[_0x3497('0x5')]),_0x261a60);utils[_0x3497('0x2')](util[_0x3497('0x3')](_0x3497('0x29'),_0x261a60[_0x3497('0x5')],_0x261a60['calleridnum'],_0x261a60[_0x3497('0x2a')],_0x261a60['cause-txt']));recordings[_0x261a60['uniqueid']][_0x3497('0x2b')]=_0x261a60['calleridnum'];recordings[_0x261a60[_0x3497('0x5')]]['calleridname']=_0x261a60[_0x3497('0x2a')];recordings[_0x261a60[_0x3497('0x5')]][_0x3497('0x2c')]=_0x261a60['connectedlinenum'];recordings[_0x261a60[_0x3497('0x5')]][_0x3497('0x2d')]=_0x261a60[_0x3497('0x2d')];if(recordings[_0x261a60[_0x3497('0x5')]][_0x3497('0x2e')]==_0x3497('0x2f')&&recordings[_0x261a60[_0x3497('0x5')]]['accountcode']){recordings[_0x261a60[_0x3497('0x5')]][_0x3497('0x2c')]=recordings[_0x261a60['uniqueid']]['accountcode'];recordings[_0x261a60[_0x3497('0x5')]]['connectedlinename']='';}recordings[_0x261a60['uniqueid']][_0x3497('0x26')][_0x3497('0x30')](function(_0x152f19){var _0x234243=_[_0x3497('0x31')](recordings[_0x261a60[_0x3497('0x5')]]);_0x234243[_0x3497('0x20')]=_0x152f19['value'];writeDB(_0x234243);});delete recordings[_0x261a60[_0x3497('0x5')]];}}catch(_0x45ceb9){utils[_0x3497('0x12')](util[_0x3497('0x3')](_0x3497('0x28'),_0x261a60['uniqueid']),_0x45ceb9);}};exports[_0x3497('0x32')]=function(_0x531a30){try{if(!_['isNil'](recordings[_0x531a30[_0x3497('0x5')]])){utils[_0x3497('0xc')](util[_0x3497('0x3')](_0x3497('0x33'),_0x531a30[_0x3497('0x5')]),_0x531a30);utils[_0x3497('0x2')](util[_0x3497('0x3')](_0x3497('0x34'),_0x531a30[_0x3497('0x5')],_0x531a30['application'],_0x531a30[_0x3497('0x35')]));if(_0x531a30[_0x3497('0x36')][_0x3497('0x37')]()==_0x3497('0x38')&&_['startsWith'](_0x531a30[_0x3497('0x35')]['toLowerCase'](),_0x3497('0x39'))){var _0x253057=_0x531a30['appdata'][_0x3497('0x3a')]('=');var _0x1c580b=_0x253057[0x0][_0x3497('0x3b')](_0x253057[0x0][_0x3497('0x3c')]('(')+0x1,_0x253057[0x0][_0x3497('0x3c')](')'));var _0xc69719=_0x253057[0x1];recordings[_0x531a30[_0x3497('0x5')]][_0x1c580b]=_0xc69719;}}}catch(_0x149824){utils[_0x3497('0x12')](util[_0x3497('0x3')](_0x3497('0x33'),_0x531a30[_0x3497('0x5')]),_0x149824);}};exports['queuecallerjoin']=function(_0x926de9){try{if(!_['isNil'](recordings[_0x926de9[_0x3497('0x5')]])){utils['debug'](util[_0x3497('0x3')](_0x3497('0x3d'),_0x926de9[_0x3497('0x5')]),_0x926de9);utils[_0x3497('0x2')](util[_0x3497('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x926de9[_0x3497('0x5')],_0x926de9[_0x3497('0x3e')]));recordings[_0x926de9['uniqueid']]['queue']=_0x926de9['queue'];}}catch(_0x292616){utils[_0x3497('0x12')](util[_0x3497('0x3')](_0x3497('0x3d'),_0x926de9[_0x3497('0x5')]),_0x292616);}}; \ No newline at end of file +var _0x7b05=['CreateVoiceRecording','newchannel','debug','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','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','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x151848,_0x3a74a8){var _0x22f8d7=function(_0x131de3){while(--_0x131de3){_0x151848['push'](_0x151848['shift']());}};_0x22f8d7(++_0x3a74a8);}(_0x7b05,0xc2));var _0x57b0=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x7b05[_0x87239];return _0x53af1e;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var utils=require(_0x57b0('0x2'));var recordings={};function writeDB(_0x206c1c){utils[_0x57b0('0x3')](util['format'](_0x57b0('0x4'),_0x206c1c[_0x57b0('0x5')]));if(_0x206c1c[_0x57b0('0x6')]){utils[_0x57b0('0x7')](_0x206c1c[_0x57b0('0x6')])[_0x57b0('0x8')](function(_0xe39d7f){if(_0xe39d7f){_0x206c1c[_0x57b0('0x9')]=_0xe39d7f[_0x57b0('0xa')];_0x206c1c[_0x57b0('0xb')]=_0xe39d7f['id'];}utils[_0x57b0('0xc')](_0x57b0('0xd'),_0x206c1c);});}else{utils[_0x57b0('0xc')](_0x57b0('0xd'),_0x206c1c);}}exports[_0x57b0('0xe')]=function(_0x293d84){try{utils[_0x57b0('0xf')](util[_0x57b0('0x10')]('[%s][recordings][newchannel]',_0x293d84['uniqueid']),_0x293d84);if(_0x293d84[_0x57b0('0x5')]==_0x293d84[_0x57b0('0x11')]){utils['info'](util[_0x57b0('0x10')](_0x57b0('0x12'),_0x293d84[_0x57b0('0x5')],_0x293d84[_0x57b0('0x13')],_0x293d84[_0x57b0('0x14')]));recordings[_0x293d84[_0x57b0('0x5')]]={'uniqueid':_0x293d84[_0x57b0('0x5')],'accountcode':_0x293d84[_0x57b0('0x6')],'exten':_0x293d84[_0x57b0('0x14')],'context':_0x293d84[_0x57b0('0x13')],'channel':_0x293d84[_0x57b0('0x15')],'monitors':[]};}}catch(_0x51c937){utils['error'](util[_0x57b0('0x10')](_0x57b0('0x16'),_0x293d84[_0x57b0('0x5')]),_0x51c937);}};exports[_0x57b0('0x17')]=function(_0x334beb){try{utils[_0x57b0('0xf')](util[_0x57b0('0x10')](_0x57b0('0x18'),_0x334beb[_0x57b0('0x5')]),_0x334beb);if(!_[_0x57b0('0x19')](recordings[_0x334beb[_0x57b0('0x5')]])&&_0x334beb[_0x57b0('0x1a')]==0x6){utils[_0x57b0('0x3')](util['format'](_0x57b0('0x1b'),_0x334beb[_0x57b0('0x5')],_0x334beb[_0x57b0('0x13')],_0x334beb[_0x57b0('0x15')]));}else if(!_[_0x57b0('0x19')](recordings[_0x334beb[_0x57b0('0x11')]])&&_0x334beb[_0x57b0('0x1a')]==0x6&&_0x334beb[_0x57b0('0x13')]!=_0x57b0('0x1c')){utils[_0x57b0('0x3')](util['format'](_0x57b0('0x1d'),_0x334beb[_0x57b0('0x5')],_0x334beb[_0x57b0('0x11')],_0x334beb[_0x57b0('0x13')],_0x334beb[_0x57b0('0x15')]));recordings[_0x334beb[_0x57b0('0x11')]][_0x57b0('0x6')]=_0x334beb[_0x57b0('0x6')];}}catch(_0x5303b8){utils[_0x57b0('0x1e')](util[_0x57b0('0x10')](_0x57b0('0x18'),_0x334beb['uniqueid']),_0x5303b8);}};exports[_0x57b0('0x1f')]=function(_0x78ab81){try{if(!_['isNil'](_0x78ab81[_0x57b0('0x20')])&&!_[_0x57b0('0x19')](_0x78ab81[_0x57b0('0x20')][_0x57b0('0x21')])){utils['debug'](util[_0x57b0('0x10')](_0x57b0('0x22'),_0x78ab81['uniqueid']),_0x78ab81);utils['info'](util[_0x57b0('0x10')](_0x57b0('0x23'),_0x78ab81[_0x57b0('0x5')],_0x78ab81['variable'],_0x78ab81[_0x57b0('0x24')]));if(_[_0x57b0('0x25')](_0x78ab81['value'],_0x57b0('0x26'))){_0x78ab81[_0x57b0('0x24')]=_0x78ab81['value'][_0x57b0('0x27')](_0x57b0('0x26'),_0x57b0('0x28'));}if(recordings[_0x78ab81[_0x57b0('0x11')]]){var _0x216c5b=_[_0x57b0('0x29')](recordings[_0x78ab81['linkedid']][_0x57b0('0x2a')],{'value':_0x78ab81[_0x57b0('0x24')]});if(_[_0x57b0('0x19')](_0x216c5b)){recordings[_0x78ab81['linkedid']]['monitors'][_0x57b0('0x2b')]({'value':_0x78ab81['value']});}}}}catch(_0x45051a){utils[_0x57b0('0x1e')](util[_0x57b0('0x10')]('[%s][recordings][varset]',_0x78ab81[_0x57b0('0x5')]),_0x45051a);}};exports[_0x57b0('0x2c')]=function(_0x94f65a){try{if(!_[_0x57b0('0x19')](recordings[_0x94f65a[_0x57b0('0x5')]])){utils[_0x57b0('0xf')](util['format']('[%s][recordings][hangup]',_0x94f65a[_0x57b0('0x5')]),_0x94f65a);utils[_0x57b0('0x3')](util[_0x57b0('0x10')](_0x57b0('0x2d'),_0x94f65a['uniqueid'],_0x94f65a['calleridnum'],_0x94f65a['calleridname'],_0x94f65a[_0x57b0('0x2e')]));recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x2f')]=_0x94f65a[_0x57b0('0x2f')];recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x30')]=_0x94f65a[_0x57b0('0x30')];recordings[_0x94f65a['uniqueid']][_0x57b0('0x31')]=_0x94f65a['connectedlinenum'];recordings[_0x94f65a['uniqueid']][_0x57b0('0x32')]=_0x94f65a[_0x57b0('0x32')];if(recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x33')]==_0x57b0('0x34')&&recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x6')]){recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x31')]=recordings[_0x94f65a[_0x57b0('0x5')]]['accountcode'];recordings[_0x94f65a['uniqueid']]['connectedlinename']='';}recordings[_0x94f65a[_0x57b0('0x5')]][_0x57b0('0x2a')][_0x57b0('0x35')](function(_0x5d559d){var _0x1084c0=_[_0x57b0('0x36')](recordings[_0x94f65a[_0x57b0('0x5')]]);_0x1084c0[_0x57b0('0x24')]=_0x5d559d[_0x57b0('0x24')];writeDB(_0x1084c0);});delete recordings[_0x94f65a[_0x57b0('0x5')]];}}catch(_0x350d86){utils['error'](util[_0x57b0('0x10')](_0x57b0('0x37'),_0x94f65a[_0x57b0('0x5')]),_0x350d86);}};exports[_0x57b0('0x38')]=function(_0x589e33){try{if(!_[_0x57b0('0x19')](recordings[_0x589e33[_0x57b0('0x5')]])){utils[_0x57b0('0xf')](util['format']('[%s][recordings][newexten]',_0x589e33[_0x57b0('0x5')]),_0x589e33);utils[_0x57b0('0x3')](util[_0x57b0('0x10')](_0x57b0('0x39'),_0x589e33[_0x57b0('0x5')],_0x589e33['application'],_0x589e33[_0x57b0('0x3a')]));if(_0x589e33[_0x57b0('0x3b')]['toLowerCase']()==_0x57b0('0x3c')&&_['startsWith'](_0x589e33[_0x57b0('0x3a')][_0x57b0('0x3d')](),'cdr')){var _0x2442a9=_0x589e33[_0x57b0('0x3a')][_0x57b0('0x3e')]('=');var _0x5a41a3=_0x2442a9[0x0][_0x57b0('0x3f')](_0x2442a9[0x0]['lastIndexOf']('(')+0x1,_0x2442a9[0x0][_0x57b0('0x40')](')'));var _0x1af5f2=_0x2442a9[0x1];recordings[_0x589e33[_0x57b0('0x5')]][_0x5a41a3]=_0x1af5f2;}}}catch(_0x224724){utils['error'](util[_0x57b0('0x10')]('[%s][recordings][newexten]',_0x589e33[_0x57b0('0x5')]),_0x224724);}};exports[_0x57b0('0x41')]=function(_0x14cca4){try{if(!_['isNil'](recordings[_0x14cca4[_0x57b0('0x5')]])){utils[_0x57b0('0xf')](util[_0x57b0('0x10')](_0x57b0('0x42'),_0x14cca4[_0x57b0('0x5')]),_0x14cca4);utils[_0x57b0('0x3')](util[_0x57b0('0x10')](_0x57b0('0x43'),_0x14cca4[_0x57b0('0x5')],_0x14cca4[_0x57b0('0x44')]));recordings[_0x14cca4[_0x57b0('0x5')]][_0x57b0('0x44')]=_0x14cca4['queue'];}}catch(_0x2cdb28){utils[_0x57b0('0x1e')](util[_0x57b0('0x10')]('[%s][recordings][queuecallerjoin]',_0x14cca4[_0x57b0('0x5')]),_0x2cdb28);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f83ac65..9bf5479 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 _0x698c=['isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererexten'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x698c,0x158));var _0xc698=function(_0x5af0bd,_0x9adde8){_0x5af0bd=_0x5af0bd-0x0;var _0x40cd36=_0x698c[_0x5af0bd];return _0x40cd36;};'use strict';var _=require(_0xc698('0x0'));var util=require(_0xc698('0x1'));var utils=require(_0xc698('0x2'));function writeDB(_0xf4aede){utils[_0xc698('0x3')](util[_0xc698('0x4')](_0xc698('0x5'),_0xf4aede['type']===_0xc698('0x6')?_0xf4aede['origtransfereruniqueid']:_0xf4aede[_0xc698('0x7')],_0xf4aede[_0xc698('0x8')]));utils[_0xc698('0x9')]('CreateVoiceTransferReport',_0xf4aede);}exports[_0xc698('0xa')]=function(_0x5f9cf8){try{utils[_0xc698('0xb')](util[_0xc698('0x4')](_0xc698('0xc'),_0x5f9cf8['uniqueid']),_0x5f9cf8);utils['info'](util['format'](_0xc698('0xd'),_0x5f9cf8[_0xc698('0x7')],_0x5f9cf8[_0xc698('0xe')],_0x5f9cf8[_0xc698('0xf')],_0x5f9cf8[_0xc698('0x10')],_0x5f9cf8[_0xc698('0x11')]));_0x5f9cf8[_0xc698('0x8')]=_0xc698('0x12');writeDB(_0x5f9cf8);}catch(_0x48db0a){utils['error'](util[_0xc698('0x4')]('[%s][transfers][blindtransfer]',_0x5f9cf8[_0xc698('0x7')]),_0x48db0a);}};exports[_0xc698('0x13')]=function(_0x2ca3c2){try{utils[_0xc698('0xb')](util[_0xc698('0x4')](_0xc698('0x14'),_0x2ca3c2[_0xc698('0x15')]),_0x2ca3c2);utils[_0xc698('0x3')](util[_0xc698('0x4')](_0xc698('0x16'),_0x2ca3c2[_0xc698('0x15')],_0x2ca3c2[_0xc698('0x17')],_0x2ca3c2[_0xc698('0x18')],_0x2ca3c2[_0xc698('0x19')],_0x2ca3c2[_0xc698('0x1a')]));_0x2ca3c2=_[_0xc698('0x1b')](_0x2ca3c2,{'transfererchannel':_0x2ca3c2[_0xc698('0x1c')],'transferercalleridnum':_0x2ca3c2[_0xc698('0x17')],'transferercalleridname':_0x2ca3c2[_0xc698('0x18')],'transfererconnectedlinenum':_0x2ca3c2[_0xc698('0x1d')],'transfererconnectedlinename':_0x2ca3c2[_0xc698('0x1e')],'transfereraccountcode':_0x2ca3c2[_0xc698('0x1f')],'transferercontext':_0x2ca3c2[_0xc698('0x20')],'transfererexten':_0x2ca3c2['secondtransfererexten'],'transfererlinkedid':_0x2ca3c2['origtransfererlinkedid'],'context':_0x2ca3c2['origtransferercontext'],'extension':_0x2ca3c2[_0xc698('0x21')],'type':_0xc698('0x6')});if(_[_0xc698('0x22')](_0x2ca3c2['transfereechannel'])){_0x2ca3c2=_[_0xc698('0x1b')](_0x2ca3c2,{'transfereechannel':_0x2ca3c2[_0xc698('0x23')],'transfereecalleridnum':_0x2ca3c2[_0xc698('0x19')],'transfereecalleridname':_0x2ca3c2[_0xc698('0x1a')],'transfereeconnectedlinenum':_0x2ca3c2['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ca3c2[_0xc698('0x24')],'transfereeaccountcode':_0x2ca3c2[_0xc698('0x25')],'transfereecontext':_0x2ca3c2[_0xc698('0x26')],'transfereeexten':_0x2ca3c2[_0xc698('0x27')],'transfereelinkedid':_0x2ca3c2[_0xc698('0x28')]});}writeDB(_0x2ca3c2);}catch(_0x12c590){utils[_0xc698('0x29')](util[_0xc698('0x4')](_0xc698('0x14'),_0x2ca3c2[_0xc698('0x15')]),_0x12c590);}}; \ No newline at end of file +var _0x8535=['debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer'];(function(_0x43f8cb,_0x4ab169){var _0x540320=function(_0xd1088c){while(--_0xd1088c){_0x43f8cb['push'](_0x43f8cb['shift']());}};_0x540320(++_0x4ab169);}(_0x8535,0xbd));var _0x5853=function(_0x1f5d6e,_0x46d589){_0x1f5d6e=_0x1f5d6e-0x0;var _0x3a4451=_0x8535[_0x1f5d6e];return _0x3a4451;};'use strict';var _=require(_0x5853('0x0'));var util=require(_0x5853('0x1'));var utils=require(_0x5853('0x2'));function writeDB(_0x3e13e9){utils['info'](util[_0x5853('0x3')](_0x5853('0x4'),_0x3e13e9[_0x5853('0x5')]==='attended'?_0x3e13e9[_0x5853('0x6')]:_0x3e13e9[_0x5853('0x7')],_0x3e13e9['type']));utils[_0x5853('0x8')](_0x5853('0x9'),_0x3e13e9);}exports[_0x5853('0xa')]=function(_0x2f7c99){try{utils[_0x5853('0xb')](util['format'](_0x5853('0xc'),_0x2f7c99['uniqueid']),_0x2f7c99);utils[_0x5853('0xd')](util[_0x5853('0x3')](_0x5853('0xe'),_0x2f7c99[_0x5853('0x7')],_0x2f7c99[_0x5853('0xf')],_0x2f7c99[_0x5853('0x10')],_0x2f7c99['transfereecalleridnum'],_0x2f7c99[_0x5853('0x11')]));_0x2f7c99[_0x5853('0x5')]='blind';writeDB(_0x2f7c99);}catch(_0x22318a){utils['error'](util[_0x5853('0x3')](_0x5853('0xc'),_0x2f7c99[_0x5853('0x7')]),_0x22318a);}};exports[_0x5853('0x12')]=function(_0x2d7eb9){try{utils['debug'](util[_0x5853('0x3')](_0x5853('0x13'),_0x2d7eb9[_0x5853('0x6')]),_0x2d7eb9);utils[_0x5853('0xd')](util[_0x5853('0x3')](_0x5853('0x14'),_0x2d7eb9[_0x5853('0x6')],_0x2d7eb9[_0x5853('0x15')],_0x2d7eb9[_0x5853('0x16')],_0x2d7eb9['transfertargetcalleridnum'],_0x2d7eb9[_0x5853('0x17')]));_0x2d7eb9=_[_0x5853('0x18')](_0x2d7eb9,{'transfererchannel':_0x2d7eb9[_0x5853('0x19')],'transferercalleridnum':_0x2d7eb9[_0x5853('0x15')],'transferercalleridname':_0x2d7eb9[_0x5853('0x16')],'transfererconnectedlinenum':_0x2d7eb9['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2d7eb9[_0x5853('0x1a')],'transfereraccountcode':_0x2d7eb9[_0x5853('0x1b')],'transferercontext':_0x2d7eb9[_0x5853('0x1c')],'transfererexten':_0x2d7eb9[_0x5853('0x1d')],'transfererlinkedid':_0x2d7eb9['origtransfererlinkedid'],'context':_0x2d7eb9[_0x5853('0x1e')],'extension':_0x2d7eb9[_0x5853('0x1f')],'type':_0x5853('0x20')});if(_[_0x5853('0x21')](_0x2d7eb9[_0x5853('0x22')])){_0x2d7eb9=_[_0x5853('0x18')](_0x2d7eb9,{'transfereechannel':_0x2d7eb9[_0x5853('0x23')],'transfereecalleridnum':_0x2d7eb9['transfertargetcalleridnum'],'transfereecalleridname':_0x2d7eb9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2d7eb9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d7eb9['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2d7eb9['transfertargetaccountcode'],'transfereecontext':_0x2d7eb9[_0x5853('0x24')],'transfereeexten':_0x2d7eb9[_0x5853('0x25')],'transfereelinkedid':_0x2d7eb9[_0x5853('0x26')]});}writeDB(_0x2d7eb9);}catch(_0x101413){utils[_0x5853('0x27')](util['format']('[%s][transfers][attendedtransfer]',_0x2d7eb9[_0x5853('0x6')]),_0x101413);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2f30390..b38c76f 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 _0x22d6=['[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','addTime','add','format','subtractTime','seconds','diff','sumTime','YYYY-MM-DD\x20HH:mm:ss','isAfter','bluebird','util','client','http','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s'];(function(_0x891513,_0x569f0e){var _0x3a0c01=function(_0x2ce3a2){while(--_0x2ce3a2){_0x891513['push'](_0x891513['shift']());}};_0x3a0c01(++_0x569f0e);}(_0x22d6,0xea));var _0x622d=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x22d6[_0x533110];return _0xc3c866;};'use strict';var BPromise=require(_0x622d('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x622d('0x1'));var client=jayson[_0x622d('0x2')][_0x622d('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x622d('0x4'));exports['info']=function(_0x73212a,_0x842a9d){logger[_0x622d('0x5')](_0x73212a,_0x842a9d?util['inspect'](_0x842a9d,{'showHidden':![],'depth':null}):'');};exports[_0x622d('0x6')]=function(_0x3a74e3,_0x47ae36){logger[_0x622d('0x6')](_0x3a74e3,_0x47ae36?util[_0x622d('0x7')](_0x47ae36,{'showHidden':![],'depth':null}):'');};exports[_0x622d('0x8')]=function(_0x2b060b,_0x52b6a2){logger['error'](_0x2b060b,_0x52b6a2?util[_0x622d('0x7')](_0x52b6a2,{'showHidden':![],'depth':null}):'');};exports[_0x622d('0x9')]=function(_0x49bfa9,_0x12fef7){return client['request'](_0x49bfa9,{'body':_0x12fef7})['then'](function(_0x4cf83b){logger[_0x622d('0x6')](_0x622d('0xa'),_0x49bfa9,_0x4cf83b?util['inspect'](_0x4cf83b,{'showHidden':![],'depth':null}):'');})[_0x622d('0xb')](function(_0x2b0366){logger[_0x622d('0x8')](_0x622d('0xa'),_0x49bfa9,_0x2b0366?util[_0x622d('0x7')](_0x2b0366,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1b956c){return client[_0x622d('0x9')](_0x622d('0xc'),{'options':{'raw':!![],'attributes':['id',_0x622d('0xd'),_0x622d('0xe'),_0x622d('0xf')],'where':_0x1b956c,'limit':0x1}})[_0x622d('0x10')](function(_0x4c3aad){logger[_0x622d('0x6')](_0x622d('0x11'),JSON[_0x622d('0x12')](_0x1b956c),_0x4c3aad?util[_0x622d('0x7')](_0x4c3aad,{'showHidden':![],'depth':null}):'');return _0x4c3aad[_0x622d('0x13')][_0x622d('0x14')]?_0x4c3aad[_0x622d('0x13')][0x0]:null;});}exports[_0x622d('0x15')]=function(_0x24a423){return new BPromise(function(_0x5ef540,_0x2a129c){if(_0x24a423){return getUser({'internal':_0x24a423})[_0x622d('0x10')](function(_0x598f16){logger[_0x622d('0x5')](_0x622d('0x16'),_0x24a423,_0x598f16?_0x622d('0x17'):_0x622d('0x18'));return _0x5ef540(_0x598f16);})[_0x622d('0xb')](function(_0x14ae2c){logger[_0x622d('0x8')](_0x622d('0x19'),_0x14ae2c?util['inspect'](_0x14ae2c,{'showHidden':![],'depth':null}):'');return _0x5ef540(null);});}return _0x5ef540(null);});};exports[_0x622d('0x1a')]=function(_0x439738){return new BPromise(function(_0x365e03,_0xf6cc23){if(_0x439738){return getUser({'interface':_0x439738})['then'](function(_0x57114f){logger[_0x622d('0x5')](_0x622d('0x1b'),_0x439738,_0x57114f?_0x622d('0x17'):_0x622d('0x18'));return _0x365e03(_0x57114f);})[_0x622d('0xb')](function(_0x4e56c7){logger[_0x622d('0x8')]('[utils][getUserByInterface]',_0x4e56c7?util[_0x622d('0x7')](_0x4e56c7,{'showHidden':![],'depth':null}):'');return _0x365e03(null);});}return _0x365e03(null);});};exports[_0x622d('0x1c')]=function(_0x3342dc){return new BPromise(function(_0x5c2927,_0x18414c){if(_0x3342dc){return getUser({'name':_0x3342dc})[_0x622d('0x10')](function(_0x407b85){logger[_0x622d('0x5')](_0x622d('0x1d'),_0x3342dc,_0x407b85?'found':_0x622d('0x18'));return _0x5c2927(_0x407b85);})[_0x622d('0xb')](function(_0x35cc15){logger[_0x622d('0x8')](_0x622d('0x1e'),_0x35cc15?util[_0x622d('0x7')](_0x35cc15,{'showHidden':![],'depth':null}):'');return _0x5c2927(null);});}return _0x5c2927(null);});};exports[_0x622d('0x1f')]=function(_0xfccc61){return new BPromise(function(_0x57b0f4,_0x1b5abf){if(_0xfccc61){return client[_0x622d('0x9')](_0x622d('0x20'),{'options':{'raw':!![],'attributes':['id',_0x622d('0xe'),'type',_0x622d('0x21'),_0x622d('0x22')],'where':{'name':_0xfccc61},'limit':0x1}})[_0x622d('0x10')](function(_0x131b83){logger[_0x622d('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0xfccc61,_0x131b83?util[_0x622d('0x7')](_0x131b83,{'showHidden':![],'depth':null}):'');logger[_0x622d('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0xfccc61,_0x131b83?'found':_0x622d('0x18'));return _0x57b0f4(_0x131b83[_0x622d('0x13')][_0x622d('0x14')]?_0x131b83[_0x622d('0x13')][0x0]:null);})['catch'](function(_0x5d8120){logger[_0x622d('0x8')]('[utils][getVoiceQueueByName]',_0x5d8120?util[_0x622d('0x7')](_0x5d8120,{'showHidden':![],'depth':null}):'');return _0x57b0f4(null);});}return _0x57b0f4(null);});};exports[_0x622d('0x23')]=function(_0x624f0f,_0x5ad6ac){return moment(_0x624f0f)[_0x622d('0x24')](_0x5ad6ac,'seconds')[_0x622d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x622d('0x26')]=function(_0x269875,_0x5e1708){return moment(_0x269875)['subtract'](_0x5e1708,_0x622d('0x27'))[_0x622d('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x353437,_0x3b09e9){return moment(_0x353437)[_0x622d('0x28')](moment(_0x3b09e9),'seconds');};exports[_0x622d('0x29')]=function(_0x86624a,_0x3ec7fd){return parseInt(_0x86624a,0xa)+parseInt(_0x3ec7fd,0xa);};exports['now']=function(){return moment()[_0x622d('0x25')](_0x622d('0x2a'));};exports[_0x622d('0x2b')]=function(_0x3a3b61,_0x167ffe){if(_0x167ffe){return moment(_0x3a3b61)[_0x622d('0x2b')](_0x167ffe);}return!![];};exports['isBefore']=function(_0x3f8c35,_0x4f19b1){if(_0x4f19b1){return moment(_0x3f8c35)['isBefore'](_0x4f19b1);}else if(_0x3f8c35){return!![];}return![];}; \ No newline at end of file +var _0xc359=['getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x3f5d44,_0x390578){var _0x33bdaf=function(_0xb0e5ec){while(--_0xb0e5ec){_0x3f5d44['push'](_0x3f5d44['shift']());}};_0x33bdaf(++_0x390578);}(_0xc359,0xa8));var _0x9c35=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0xc359[_0x79a6e8];return _0xeeb993;};'use strict';var BPromise=require(_0x9c35('0x0'));var jayson=require(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var util=require(_0x9c35('0x3'));var client=jayson['client'][_0x9c35('0x4')]({'port':0x2329});var logger=require(_0x9c35('0x5'))('xdr');exports[_0x9c35('0x6')]=function(_0x56fa66,_0x57df87){logger[_0x9c35('0x6')](_0x56fa66,_0x57df87?util[_0x9c35('0x7')](_0x57df87,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3cb389,_0x39fd94){logger[_0x9c35('0x8')](_0x3cb389,_0x39fd94?util[_0x9c35('0x7')](_0x39fd94,{'showHidden':![],'depth':null}):'');};exports[_0x9c35('0x9')]=function(_0x1956c4,_0x35afbc){logger[_0x9c35('0x9')](_0x1956c4,_0x35afbc?util['inspect'](_0x35afbc,{'showHidden':![],'depth':null}):'');};exports[_0x9c35('0xa')]=function(_0x53c664,_0x8cc004){return client[_0x9c35('0xa')](_0x53c664,{'body':_0x8cc004})[_0x9c35('0xb')](function(_0xa56a5c){logger[_0x9c35('0x8')](_0x9c35('0xc'),_0x53c664,_0xa56a5c?util['inspect'](_0xa56a5c,{'showHidden':![],'depth':null}):'');})[_0x9c35('0xd')](function(_0x1ca8e0){logger[_0x9c35('0x9')](_0x9c35('0xc'),_0x53c664,_0x1ca8e0?util[_0x9c35('0x7')](_0x1ca8e0,{'showHidden':![],'depth':null}):'');});};function getUser(_0xe8f83b){return client[_0x9c35('0xa')](_0x9c35('0xe'),{'options':{'raw':!![],'attributes':['id',_0x9c35('0xf'),_0x9c35('0x10'),'interface'],'where':_0xe8f83b,'limit':0x1}})[_0x9c35('0xb')](function(_0x132dc0){logger[_0x9c35('0x8')](_0x9c35('0x11'),JSON[_0x9c35('0x12')](_0xe8f83b),_0x132dc0?util['inspect'](_0x132dc0,{'showHidden':![],'depth':null}):'');return _0x132dc0[_0x9c35('0x13')][_0x9c35('0x14')]?_0x132dc0[_0x9c35('0x13')][0x0]:null;});}exports[_0x9c35('0x15')]=function(_0x3d1680){return new BPromise(function(_0x35fc06,_0x2c6412){if(_0x3d1680){return getUser({'internal':_0x3d1680})['then'](function(_0x8124){logger['info'](_0x9c35('0x16'),_0x3d1680,_0x8124?_0x9c35('0x17'):_0x9c35('0x18'));return _0x35fc06(_0x8124);})[_0x9c35('0xd')](function(_0x41c3e2){logger['error'](_0x9c35('0x19'),_0x41c3e2?util[_0x9c35('0x7')](_0x41c3e2,{'showHidden':![],'depth':null}):'');return _0x35fc06(null);});}return _0x35fc06(null);});};exports[_0x9c35('0x1a')]=function(_0x2a83da){return new BPromise(function(_0x3b4b53,_0x3155b3){if(_0x2a83da){return getUser({'interface':_0x2a83da})['then'](function(_0x46345f){logger[_0x9c35('0x6')](_0x9c35('0x1b'),_0x2a83da,_0x46345f?_0x9c35('0x17'):'notfound');return _0x3b4b53(_0x46345f);})['catch'](function(_0xd0be30){logger[_0x9c35('0x9')](_0x9c35('0x1c'),_0xd0be30?util[_0x9c35('0x7')](_0xd0be30,{'showHidden':![],'depth':null}):'');return _0x3b4b53(null);});}return _0x3b4b53(null);});};exports[_0x9c35('0x1d')]=function(_0x14b0c8){return new BPromise(function(_0x58bf0a,_0x1d4633){if(_0x14b0c8){return getUser({'name':_0x14b0c8})[_0x9c35('0xb')](function(_0x4f283a){logger[_0x9c35('0x6')](_0x9c35('0x1e'),_0x14b0c8,_0x4f283a?_0x9c35('0x17'):_0x9c35('0x18'));return _0x58bf0a(_0x4f283a);})[_0x9c35('0xd')](function(_0x19e1e2){logger[_0x9c35('0x9')](_0x9c35('0x1f'),_0x19e1e2?util['inspect'](_0x19e1e2,{'showHidden':![],'depth':null}):'');return _0x58bf0a(null);});}return _0x58bf0a(null);});};exports[_0x9c35('0x20')]=function(_0x18a72f){return new BPromise(function(_0x42ca40,_0x41ab0c){if(_0x18a72f){return client[_0x9c35('0xa')](_0x9c35('0x21'),{'options':{'raw':!![],'attributes':['id','name',_0x9c35('0x22'),_0x9c35('0x23'),_0x9c35('0x24')],'where':{'name':_0x18a72f},'limit':0x1}})['then'](function(_0x5de7be){logger['debug'](_0x9c35('0x25'),_0x18a72f,_0x5de7be?util[_0x9c35('0x7')](_0x5de7be,{'showHidden':![],'depth':null}):'');logger[_0x9c35('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x18a72f,_0x5de7be?_0x9c35('0x17'):_0x9c35('0x18'));return _0x42ca40(_0x5de7be['result'][_0x9c35('0x14')]?_0x5de7be[_0x9c35('0x13')][0x0]:null);})['catch'](function(_0x15152e){logger[_0x9c35('0x9')](_0x9c35('0x26'),_0x15152e?util['inspect'](_0x15152e,{'showHidden':![],'depth':null}):'');return _0x42ca40(null);});}return _0x42ca40(null);});};exports['addTime']=function(_0x180d2d,_0x164f52){return moment(_0x180d2d)[_0x9c35('0x27')](_0x164f52,_0x9c35('0x28'))[_0x9c35('0x29')](_0x9c35('0x2a'));};exports[_0x9c35('0x2b')]=function(_0x2da33f,_0x230576){return moment(_0x2da33f)['subtract'](_0x230576,_0x9c35('0x28'))[_0x9c35('0x29')](_0x9c35('0x2a'));};exports[_0x9c35('0x2c')]=function(_0xca8206,_0x5f128b){return moment(_0xca8206)[_0x9c35('0x2d')](moment(_0x5f128b),'seconds');};exports[_0x9c35('0x2e')]=function(_0x1fb5b8,_0x3d4475){return parseInt(_0x1fb5b8,0xa)+parseInt(_0x3d4475,0xa);};exports[_0x9c35('0x2f')]=function(){return moment()[_0x9c35('0x29')](_0x9c35('0x2a'));};exports[_0x9c35('0x30')]=function(_0x105f84,_0x41cdfc){if(_0x41cdfc){return moment(_0x105f84)['isAfter'](_0x41cdfc);}return!![];};exports[_0x9c35('0x31')]=function(_0xecd492,_0x31326b){if(_0x31326b){return moment(_0xecd492)['isBefore'](_0x31326b);}else if(_0xecd492){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 5a25a72..12260f3 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 _0xe5ac=['use','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_id','agent_name','setupLoggers','fs-extra','express-winston','path','util','safeTemplate','./mask-sensitive-data','maskSensitiveData','log','xcally','join','client','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','logger','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','responseTime','name','role','inspect'];(function(_0x437dab,_0x349b46){var _0x44c9b3=function(_0x550ff6){while(--_0x550ff6){_0x437dab['push'](_0x437dab['shift']());}};_0x44c9b3(++_0x349b46);}(_0xe5ac,0x13d));var _0xce5a=function(_0x481db3,_0x18bdc8){_0x481db3=_0x481db3-0x0;var _0x3c1638=_0xe5ac[_0x481db3];return _0x3c1638;};var fs=require(_0xce5a('0x0'));var _=require('lodash');var ewinston=require(_0xce5a('0x1'));var path=require(_0xce5a('0x2'));var util=require(_0xce5a('0x3'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require('./safe-template')[_0xce5a('0x4')];var maskSensitiveData=require(_0xce5a('0x5'))[_0xce5a('0x6')];function ClientSideLogger(){function _0xa11d19(_0x4a3ce1){var _0x15ad99=path['join']('/var',_0xce5a('0x7'),_0xce5a('0x8'));var _0x1aef38=path[_0xce5a('0x9')](_0xce5a('0xa'),_0x4a3ce1['role']+'-'+_0x4a3ce1['name']);return fs[_0xce5a('0xb')](path['join'](_0x15ad99,_0x1aef38))[_0xce5a('0xc')](function(){var _0x460206=fileLogger(_0xce5a('0xa'),path[_0xce5a('0x9')](_0x15ad99,_0x1aef38));return _0x460206;})[_0xce5a('0xd')](function(_0x21a7c9){throw _0x21a7c9;});}this[_0xce5a('0x7')]=function(_0x4f385f,_0x563851,_0x34a09f,_0x7efc32){return _0xa11d19(_0x4f385f[_0xce5a('0xe')])['then'](function(_0x2edb5d){var _0x4c8d0f=_0x2edb5d[_0x563851];return _0x4c8d0f;})[_0xce5a('0xc')](function(_0x1be5ac){var _0x27e9ba=_0x4f385f[_0xce5a('0xe')]?_0x4f385f[_0xce5a('0xe')]['id']:_0xce5a('0xf');var _0x3194cb=_0x7efc32[_0xce5a('0x10')];var _0x57059f=_0x7efc32[_0xce5a('0x11')];var _0x555e76=new Date(Number(_0x57059f));return _0x1be5ac(_0x27e9ba,_0x555e76,_0x34a09f,_0x3194cb);})[_0xce5a('0xd')](function(_0x556c04){fileLogger(_0xce5a('0xa'))[_0xce5a('0x12')](_0x556c04);});};}function setupLoggers(_0x28d710){return new Promise(function(_0x103891){var _0x43b0f4=new ClientSideLogger();var _0x539730=fileLogger(_0xce5a('0x13'));var _0x6ad5cf=fileLogger(_0xce5a('0x14'));_0x28d710['set'](_0xce5a('0x15'),_0x43b0f4);_0x28d710['use'](ewinston[_0xce5a('0x16')]({'winstonInstance':_0x539730,'meta':![],'statusLevels':!![],'msg':function(_0x538b0a,_0x392df4){var _0x473d3c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xce5a('0x17')](_0x538b0a['body'])){_0x473d3c+=_0xce5a('0x18');var _0x56b334=_0x538b0a['body'];maskSensitiveData(_0x56b334);}return safeTemplate(util[_0xce5a('0x19')](_0x473d3c,_0x538b0a[_0xce5a('0x1a')],_0x538b0a[_0xce5a('0x1b')][_0xce5a('0x1c')]?_0x538b0a[_0xce5a('0x1b')][_0xce5a('0x1c')]:_0x538b0a[_0xce5a('0x1d')]['remoteAddress']||_0x538b0a['ip'],_0x538b0a[_0xce5a('0x1e')],_0x392df4['statusCode'],_0x392df4[_0xce5a('0x1f')],_0x538b0a['user']?_0x538b0a['user']['id']:null,_0x538b0a['user']?_0x538b0a['user'][_0xce5a('0x20')]:null,_0x538b0a['user']?_0x538b0a[_0xce5a('0xe')][_0xce5a('0x21')]:null,_0x56b334?util[_0xce5a('0x22')](_0x56b334,![],null):''));}}));_0x28d710[_0xce5a('0x23')](ewinston[_0xce5a('0x16')]({'winstonInstance':_0x6ad5cf,'meta':![],'statusLevels':!![],'msg':function(_0x24a82d,_0x472015){var _0x45286e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x24a82d[_0xce5a('0x24')]&&_0x24a82d['body'][_0xce5a('0x25')]&&_0x24a82d['body']['agent_id']){_0x45286e=_0xce5a('0x26');}return util[_0xce5a('0x19')](_0x45286e,_0x24a82d[_0xce5a('0x1a')],_0x24a82d['headers'][_0xce5a('0x1c')]?_0x24a82d['headers'][_0xce5a('0x1c')]:_0x24a82d[_0xce5a('0x1d')]['remoteAddress']||_0x24a82d['ip'],_0x24a82d[_0xce5a('0x1e')],_0x472015[_0xce5a('0x27')],_0x472015[_0xce5a('0x1f')],_0x24a82d[_0xce5a('0xe')]?_0x24a82d[_0xce5a('0xe')]['id']:null,_0x24a82d[_0xce5a('0xe')]?_0x24a82d[_0xce5a('0xe')][_0xce5a('0x20')]:null,_0x24a82d[_0xce5a('0xe')]?_0x24a82d['user'][_0xce5a('0x21')]:null,_0x24a82d[_0xce5a('0x24')]&&_0x24a82d[_0xce5a('0x24')][_0xce5a('0x25')]?_0x24a82d[_0xce5a('0x24')]['device']:_0xce5a('0x28'),_0x24a82d[_0xce5a('0x24')]&&_0x24a82d[_0xce5a('0x24')]['agent_id']?_0x24a82d['body'][_0xce5a('0x29')]:'',_0x24a82d[_0xce5a('0x24')]&&_0x24a82d['body'][_0xce5a('0x2a')]?_0x24a82d[_0xce5a('0x24')][_0xce5a('0x2a')]:'');},'ignoreRoute':function(_0x40323a){var _0x222e85=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x222e85['test'](_0x40323a[_0xce5a('0x1e')]);}}));return _0x103891();});}exports[_0xce5a('0x2b')]=setupLoggers; \ No newline at end of file +var _0x7502=['timestamp','error','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','agent_name','fs-extra','lodash','path','./loggers','fileLogger','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','catch','user','no-user','data'];(function(_0x33bb07,_0x5b1849){var _0x481c81=function(_0x1709f0){while(--_0x1709f0){_0x33bb07['push'](_0x33bb07['shift']());}};_0x481c81(++_0x5b1849);}(_0x7502,0x192));var _0x2750=function(_0x1fe75e,_0xa1ea15){_0x1fe75e=_0x1fe75e-0x0;var _0xc12009=_0x7502[_0x1fe75e];return _0xc12009;};var fs=require(_0x2750('0x0'));var _=require(_0x2750('0x1'));var ewinston=require('express-winston');var path=require(_0x2750('0x2'));var util=require('util');var fileLogger=require(_0x2750('0x3'))[_0x2750('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x2750('0x5')];function ClientSideLogger(){function _0x2b118c(_0x4dbad7){var _0x19a347=path[_0x2750('0x6')](_0x2750('0x7'),_0x2750('0x8'),_0x2750('0x9'));var _0x1c87d0=path[_0x2750('0x6')](_0x2750('0xa'),_0x4dbad7['role']+'-'+_0x4dbad7[_0x2750('0xb')]);return fs[_0x2750('0xc')](path[_0x2750('0x6')](_0x19a347,_0x1c87d0))[_0x2750('0xd')](function(){var _0x355cb5=fileLogger(_0x2750('0xa'),path[_0x2750('0x6')](_0x19a347,_0x1c87d0));return _0x355cb5;})[_0x2750('0xe')](function(_0x520903){throw _0x520903;});}this['log']=function(_0x3ddd7c,_0x341631,_0x240493,_0x4c6461){return _0x2b118c(_0x3ddd7c['user'])[_0x2750('0xd')](function(_0x143f02){var _0x434262=_0x143f02[_0x341631];return _0x434262;})[_0x2750('0xd')](function(_0xa48ebd){var _0x2ab8a7=_0x3ddd7c[_0x2750('0xf')]?_0x3ddd7c[_0x2750('0xf')]['id']:_0x2750('0x10');var _0x1a6c34=_0x4c6461[_0x2750('0x11')];var _0x24c81f=_0x4c6461[_0x2750('0x12')];var _0x3ff60c=new Date(Number(_0x24c81f));return _0xa48ebd(_0x2ab8a7,_0x3ff60c,_0x240493,_0x1a6c34);})['catch'](function(_0x55f7e1){fileLogger(_0x2750('0xa'))[_0x2750('0x13')](_0x55f7e1);});};}function setupLoggers(_0x4a3c08){return new Promise(function(_0x241475){var _0x14d560=new ClientSideLogger();var _0x1ddde7=fileLogger(_0x2750('0x14'));var _0x8a633c=fileLogger(_0x2750('0x15'));_0x4a3c08['set']('client-side-logger',_0x14d560);_0x4a3c08[_0x2750('0x16')](ewinston['logger']({'winstonInstance':_0x1ddde7,'meta':![],'statusLevels':!![],'msg':function(_0xc8b528,_0x55a620){var _0x18b3e6=_0x2750('0x17');if(!_[_0x2750('0x18')](_0xc8b528['body'])){_0x18b3e6+=_0x2750('0x19');var _0xe15e1b=_0xc8b528[_0x2750('0x1a')];maskSensitiveData(_0xe15e1b);}return safeTemplate(util[_0x2750('0x1b')](_0x18b3e6,_0xc8b528[_0x2750('0x1c')],_0xc8b528[_0x2750('0x1d')][_0x2750('0x1e')]?_0xc8b528['headers']['x-forwarded-for']:_0xc8b528[_0x2750('0x1f')][_0x2750('0x20')]||_0xc8b528['ip'],_0xc8b528[_0x2750('0x21')],_0x55a620[_0x2750('0x22')],_0x55a620[_0x2750('0x23')],_0xc8b528[_0x2750('0xf')]?_0xc8b528[_0x2750('0xf')]['id']:null,_0xc8b528['user']?_0xc8b528[_0x2750('0xf')][_0x2750('0xb')]:null,_0xc8b528[_0x2750('0xf')]?_0xc8b528[_0x2750('0xf')][_0x2750('0x24')]:null,_0xe15e1b?util['inspect'](_0xe15e1b,![],null):''));}}));_0x4a3c08[_0x2750('0x16')](ewinston[_0x2750('0x25')]({'winstonInstance':_0x8a633c,'meta':![],'statusLevels':!![],'msg':function(_0x58e350,_0xcbdde4){var _0x461590=_0x2750('0x26');if(_0x58e350[_0x2750('0x1a')]&&_0x58e350['body'][_0x2750('0x27')]&&_0x58e350['body']['agent_id']){_0x461590='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2750('0x1b')](_0x461590,_0x58e350[_0x2750('0x1c')],_0x58e350[_0x2750('0x1d')]['x-forwarded-for']?_0x58e350['headers'][_0x2750('0x1e')]:_0x58e350[_0x2750('0x1f')][_0x2750('0x20')]||_0x58e350['ip'],_0x58e350['url'],_0xcbdde4[_0x2750('0x22')],_0xcbdde4[_0x2750('0x23')],_0x58e350[_0x2750('0xf')]?_0x58e350['user']['id']:null,_0x58e350[_0x2750('0xf')]?_0x58e350['user'][_0x2750('0xb')]:null,_0x58e350[_0x2750('0xf')]?_0x58e350[_0x2750('0xf')][_0x2750('0x24')]:null,_0x58e350[_0x2750('0x1a')]&&_0x58e350[_0x2750('0x1a')][_0x2750('0x27')]?_0x58e350['body'][_0x2750('0x27')]:'other',_0x58e350[_0x2750('0x1a')]&&_0x58e350[_0x2750('0x1a')][_0x2750('0x28')]?_0x58e350[_0x2750('0x1a')][_0x2750('0x28')]:'',_0x58e350[_0x2750('0x1a')]&&_0x58e350['body'][_0x2750('0x29')]?_0x58e350[_0x2750('0x1a')][_0x2750('0x29')]:'');},'ignoreRoute':function(_0x1195b7){var _0x1a256e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a256e['test'](_0x1195b7[_0x2750('0x21')]);}}));return _0x241475();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index fe7efc5..c9056e2 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6498=['indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','MMM','monthCompare','test','isMoment','split','padStart','length','lodash','map','source','join','Interval\x20string\x20not\x20valid','locale','weekdaysShort','toLowerCase'];(function(_0x2445e2,_0xc4a747){var _0x1e5736=function(_0x4a6509){while(--_0x4a6509){_0x2445e2['push'](_0x2445e2['shift']());}};_0x1e5736(++_0xc4a747);}(_0x6498,0x8c));var _0x8649=function(_0x1a7a09,_0x1ddfab){_0x1a7a09=_0x1a7a09-0x0;var _0x11a7b1=_0x6498[_0x1a7a09];return _0x11a7b1;};var _=require(_0x8649('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x8649('0x1')](function(_0x45a8a7){return _0x45a8a7[_0x8649('0x2')];})[_0x8649('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x8649('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x5eae08){if(!_0x5eae08['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2a5174){var _0x5493ee=_0x2a5174['split'](':')[_0x8649('0x1')](function(_0x1ff05e){return parseInt(_0x1ff05e,0xa);});var _0x4d8738=_0x5493ee[0x0];var _0x2e43ed=_0x5493ee[0x1];if(_0x4d8738<0x0||_0x4d8738>0x17||_0x2e43ed<0x0||_0x2e43ed>0x3b){throw new Error(EINVALID_DATE);}return[_0x4d8738,_0x2e43ed];}function circularDoWInterval(_0x54b989,_0x4033df){if(_0x54b989===_0x4033df){return[_0x54b989];}else{var _0x4ce907=moment[_0x8649('0x5')]();moment['locale']('en');var _0xbf3996=moment[_0x8649('0x6')]()[_0x8649('0x1')](function(_0x1b0a43){return _0x1b0a43[_0x8649('0x7')]();});moment['locale'](_0x4ce907);var _0x40fe5e=_0xbf3996[_0x8649('0x8')](_0x54b989);var _0xe066b5=_0xbf3996[_0x8649('0x8')](_0x4033df);if(_0xe066b5>_0x40fe5e){return _0xbf3996[_0x8649('0x9')](_0x40fe5e,_0xe066b5+0x1);}else{var _0x50bd38=_0xbf3996[_0x8649('0x9')](0x0,_0xe066b5+0x1);var _0x77d48b=_0xbf3996[_0x8649('0x9')](_0x40fe5e);return _0x77d48b[_0x8649('0xa')](_0x50bd38);}}}module[_0x8649('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x7ec406,_0x5bb895){if(_0x7ec406===_0x5bb895){return[_0x7ec406];}else{var _0x5293ab=moment['locale']();moment['locale']('en');var _0x1f6e5a=moment[_0x8649('0xc')]()['map'](function(_0x1f059e){return _0x1f059e[_0x8649('0x7')]();});moment[_0x8649('0x5')](_0x5293ab);var _0x58c1e1=_0x1f6e5a[_0x8649('0x8')](_0x7ec406);var _0x583186=_0x1f6e5a[_0x8649('0x8')](_0x5bb895);if(_0x583186>_0x58c1e1){return _0x1f6e5a['slice'](_0x58c1e1,_0x583186+0x1);}else{var _0x169efc=_0x1f6e5a[_0x8649('0x9')](0x0,_0x583186+0x1);var _0xcfccd5=_0x1f6e5a[_0x8649('0x9')](_0x58c1e1);return _0xcfccd5[_0x8649('0xa')](_0x169efc);}}}module[_0x8649('0xb')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x307529){var _0x53566d=parseInt(_0x307529,0xa);if(_0x53566d<0x1||_0x53566d>0x1f){throw new Error(EINVALID_DATE);}return _0x53566d;}function timeCompare(_0x5b99e8,_0x26598a,_0x11305b){var _0x20ee64=_0x5b99e8[_0x8649('0xd')]();var _0x2cb409=extractTime(_0x26598a);var _0x26174b=_0x2cb409[0x0];var _0x14e4c2=_0x2cb409[0x1];var _0x3860d3=_0x5b99e8[_0x8649('0xd')]()[_0x8649('0xe')](_0x26174b)[_0x8649('0xf')](_0x14e4c2);throwIfDateNotValid(_0x3860d3);var _0x51822b=extractTime(_0x11305b);var _0x8960cd=_0x51822b[0x0];var _0x3ed5c1=_0x51822b[0x1];var _0x1dfe1c=_0x5b99e8[_0x8649('0xd')]()[_0x8649('0xe')](_0x8960cd)['minutes'](_0x3ed5c1);throwIfDateNotValid(_0x1dfe1c);if(_0x1dfe1c[_0x8649('0x10')](_0x3860d3)){var _0x218387=_0x20ee64[_0x8649('0xd')]()[_0x8649('0x11')](_0x8649('0x12'));var _0x2aa3b2=_0x20ee64[_0x8649('0xd')]()[_0x8649('0x13')](_0x8649('0x12'));return _0x20ee64['isBetween'](_0x3860d3,_0x2aa3b2,undefined,'[]')||_0x20ee64[_0x8649('0x14')](_0x218387,_0x1dfe1c,undefined,'[]');}else{return _0x20ee64[_0x8649('0x14')](_0x3860d3,_0x1dfe1c,undefined,'[]');}}module['exports'][_0x8649('0x15')]=timeCompare;function dowCompare(_0x54d6aa,_0x3c1f42,_0xa9ea89){var _0x1ca439=_0x54d6aa['locale']('en')[_0x8649('0x16')](_0x8649('0x17'))[_0x8649('0x7')]();return circularDoWInterval(_0x3c1f42,_0xa9ea89)[_0x8649('0x18')](_0x1ca439);}module[_0x8649('0xb')][_0x8649('0x19')]=dowCompare;function domCompare(_0x1a46b3,_0x1ba022,_0x281c47){var _0x423a63=_0x1a46b3[_0x8649('0x1a')]();if(_0x1ba022===_0x281c47){return _0x423a63===_0x1ba022;}else{var _0x489456=_0x1a46b3[_0x8649('0x1b')]();var _0x5a5674=_0x1ba022<_0x281c47;let _0xa8b3c=![];var _0x4c1c55=0x0;var _0x1f4e75=0x0;if(_0x5a5674){_0x4c1c55=Math['max'](0x1,_0x1ba022);_0x1f4e75=Math[_0x8649('0x1c')](_0x281c47,_0x489456);_0xa8b3c=_0x423a63>=_0x4c1c55&&_0x423a63<=_0x1f4e75;}else{_0x4c1c55=Math[_0x8649('0x1c')](_0x1ba022,_0x489456);_0x1f4e75=Math[_0x8649('0x1d')](0x1,_0x281c47);_0xa8b3c=_0x423a63>=_0x4c1c55||_0x423a63<=_0x1f4e75;}return _0xa8b3c;}}module[_0x8649('0xb')]['domCompare']=domCompare;function monthCompare(_0x3b6a23,_0x140bb7,_0x34f14e){var _0x4f34a2=_0x3b6a23[_0x8649('0x5')]('en')[_0x8649('0x16')](_0x8649('0x1e'))[_0x8649('0x7')]();return circularMonthInterval(_0x140bb7,_0x34f14e)[_0x8649('0x18')](_0x4f34a2);}module[_0x8649('0xb')][_0x8649('0x1f')]=monthCompare;function iftime(_0x387df0,_0x39bf63=moment['tz']['guess'](),_0x55f3d1=moment()){if(!validateRx[_0x8649('0x20')](_0x387df0)){throw new Error(EINVALID_STRING);}else{var _0x389c72=(moment[_0x8649('0x21')](_0x55f3d1)?_0x55f3d1[_0x8649('0xd')]():moment(_0x55f3d1))['tz'](_0x39bf63)[_0x8649('0x5')]('en');throwIfDateNotValid(_0x389c72);var _0x134164=_0x387df0[_0x8649('0x22')](',');var _0x5dbc74=_0x134164[0x0];var _0x3b3a32=_0x134164[0x1];var _0x44ba5c=_0x134164[0x2];var _0x3380c0=_0x134164[0x3];let _0xd54664=!![];if(_0x5dbc74!=='*'){var _0x10efd1=_0x5dbc74[_0x8649('0x22')]('-');var _0x181649=_[_0x8649('0x23')](_0x10efd1[0x0],0x5,'0');var _0x2cabae=_0x10efd1[_0x8649('0x24')]===0x2?_['padStart'](_0x10efd1[0x1],0x5,'0'):_0x181649;_0xd54664=timeCompare(_0x389c72,_0x181649,_0x2cabae);}let _0x1d8475=!![];if(_0x3b3a32!=='*'){var _0x29c830=_0x3b3a32[_0x8649('0x22')]('-');var _0x5ace29=_0x29c830[0x0];var _0x5be7d0=_0x29c830[_0x8649('0x24')]===0x2?_0x29c830[0x1]:_0x5ace29;_0x1d8475=dowCompare(_0x389c72,_0x5ace29,_0x5be7d0);}let _0xea80b=!![];if(_0x44ba5c!=='*'){var _0x5bd7ed=_0x44ba5c[_0x8649('0x22')]('-');var _0x587c30=parseDom(_0x5bd7ed[0x0]);var _0x3e39e6=_0x5bd7ed['length']===0x2?parseDom(_0x5bd7ed[0x1]):_0x587c30;_0xea80b=domCompare(_0x389c72,_0x587c30,_0x3e39e6);}let _0x17c11b=!![];if(_0x3380c0!=='*'){var _0x14c990=_0x3380c0[_0x8649('0x22')]('-');var _0x4d27ce=_0x14c990[0x0];var _0x230bb6=_0x14c990[_0x8649('0x24')]===0x2?_0x14c990[0x1]:_0x14c990[0x0];_0x17c11b=monthCompare(_0x389c72,_0x4d27ce,_0x230bb6);}return _0xd54664&&_0x1d8475&&_0xea80b&&_0x17c11b;}}module[_0x8649('0xb')]['iftime']=iftime; \ No newline at end of file +var _0x9e91=['hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','ddd','dowCompare','date','max','min','domCompare','format','MMM','includes','monthCompare','guess','test','split','padStart','length','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','exports','circularDoWInterval','monthsShort','concat','circularMonthInterval','clone'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x9e91,0x1cf));var _0x19e9=function(_0x48e358,_0x47a94a){_0x48e358=_0x48e358-0x0;var _0x4a2620=_0x9e91[_0x48e358];return _0x4a2620;};var _=require(_0x19e9('0x0'));var moment=require(_0x19e9('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][_0x19e9('0x2')](function(_0x335828){return _0x335828['source'];})[_0x19e9('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x19e9('0x4');var EINVALID_DATE=_0x19e9('0x5');function throwIfDateNotValid(_0x5cf9cb){if(!_0x5cf9cb[_0x19e9('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x503a22){var _0x42e6f0=_0x503a22['split'](':')[_0x19e9('0x2')](function(_0x319f01){return parseInt(_0x319f01,0xa);});var _0x34ba59=_0x42e6f0[0x0];var _0x5133a0=_0x42e6f0[0x1];if(_0x34ba59<0x0||_0x34ba59>0x17||_0x5133a0<0x0||_0x5133a0>0x3b){throw new Error(EINVALID_DATE);}return[_0x34ba59,_0x5133a0];}function circularDoWInterval(_0x388cf7,_0x3e0ab4){if(_0x388cf7===_0x3e0ab4){return[_0x388cf7];}else{var _0xa93a3a=moment[_0x19e9('0x7')]();moment[_0x19e9('0x7')]('en');var _0x8dcbfa=moment['weekdaysShort']()[_0x19e9('0x2')](function(_0x267b4e){return _0x267b4e[_0x19e9('0x8')]();});moment[_0x19e9('0x7')](_0xa93a3a);var _0x145cd1=_0x8dcbfa[_0x19e9('0x9')](_0x388cf7);var _0x5a5d68=_0x8dcbfa[_0x19e9('0x9')](_0x3e0ab4);if(_0x5a5d68>_0x145cd1){return _0x8dcbfa[_0x19e9('0xa')](_0x145cd1,_0x5a5d68+0x1);}else{var _0x2d699b=_0x8dcbfa[_0x19e9('0xa')](0x0,_0x5a5d68+0x1);var _0x5a672b=_0x8dcbfa[_0x19e9('0xa')](_0x145cd1);return _0x5a672b['concat'](_0x2d699b);}}}module[_0x19e9('0xb')][_0x19e9('0xc')]=circularDoWInterval;function circularMonthInterval(_0x2839e0,_0x44aeb7){if(_0x2839e0===_0x44aeb7){return[_0x2839e0];}else{var _0x335fdf=moment[_0x19e9('0x7')]();moment[_0x19e9('0x7')]('en');var _0x968f09=moment[_0x19e9('0xd')]()[_0x19e9('0x2')](function(_0x48daec){return _0x48daec[_0x19e9('0x8')]();});moment[_0x19e9('0x7')](_0x335fdf);var _0x57ab36=_0x968f09['indexOf'](_0x2839e0);var _0x2a6490=_0x968f09[_0x19e9('0x9')](_0x44aeb7);if(_0x2a6490>_0x57ab36){return _0x968f09['slice'](_0x57ab36,_0x2a6490+0x1);}else{var _0x14d268=_0x968f09['slice'](0x0,_0x2a6490+0x1);var _0x5d37c7=_0x968f09[_0x19e9('0xa')](_0x57ab36);return _0x5d37c7[_0x19e9('0xe')](_0x14d268);}}}module[_0x19e9('0xb')][_0x19e9('0xf')]=circularMonthInterval;function parseDom(_0x30c17d){var _0x5aa55b=parseInt(_0x30c17d,0xa);if(_0x5aa55b<0x1||_0x5aa55b>0x1f){throw new Error(EINVALID_DATE);}return _0x5aa55b;}function timeCompare(_0xd7edcb,_0x1e66e,_0x5c7c30){var _0x4bf50c=_0xd7edcb[_0x19e9('0x10')]();var _0x4af722=extractTime(_0x1e66e);var _0x5ca2dd=_0x4af722[0x0];var _0x4a201b=_0x4af722[0x1];var _0xdf4ceb=_0xd7edcb[_0x19e9('0x10')]()['hours'](_0x5ca2dd)['minutes'](_0x4a201b);throwIfDateNotValid(_0xdf4ceb);var _0x152a94=extractTime(_0x5c7c30);var _0x2b1025=_0x152a94[0x0];var _0x20d477=_0x152a94[0x1];var _0x4e8221=_0xd7edcb[_0x19e9('0x10')]()[_0x19e9('0x11')](_0x2b1025)[_0x19e9('0x12')](_0x20d477);throwIfDateNotValid(_0x4e8221);if(_0x4e8221[_0x19e9('0x13')](_0xdf4ceb)){var _0x4bccf9=_0x4bf50c[_0x19e9('0x10')]()[_0x19e9('0x14')]('day');var _0x5253b2=_0x4bf50c[_0x19e9('0x10')]()[_0x19e9('0x15')](_0x19e9('0x16'));return _0x4bf50c[_0x19e9('0x17')](_0xdf4ceb,_0x5253b2,undefined,'[]')||_0x4bf50c[_0x19e9('0x17')](_0x4bccf9,_0x4e8221,undefined,'[]');}else{return _0x4bf50c['isBetween'](_0xdf4ceb,_0x4e8221,undefined,'[]');}}module[_0x19e9('0xb')][_0x19e9('0x18')]=timeCompare;function dowCompare(_0x469738,_0x50e274,_0x4b0d08){var _0x14bc48=_0x469738['locale']('en')['format'](_0x19e9('0x19'))[_0x19e9('0x8')]();return circularDoWInterval(_0x50e274,_0x4b0d08)['includes'](_0x14bc48);}module[_0x19e9('0xb')][_0x19e9('0x1a')]=dowCompare;function domCompare(_0x503768,_0xd9f353,_0xf54a5d){var _0x967768=_0x503768[_0x19e9('0x1b')]();if(_0xd9f353===_0xf54a5d){return _0x967768===_0xd9f353;}else{var _0x33ce7c=_0x503768['daysInMonth']();var _0x2895c6=_0xd9f353<_0xf54a5d;let _0x1aeb81=![];var _0x21729f=0x0;var _0x52ae66=0x0;if(_0x2895c6){_0x21729f=Math[_0x19e9('0x1c')](0x1,_0xd9f353);_0x52ae66=Math[_0x19e9('0x1d')](_0xf54a5d,_0x33ce7c);_0x1aeb81=_0x967768>=_0x21729f&&_0x967768<=_0x52ae66;}else{_0x21729f=Math[_0x19e9('0x1d')](_0xd9f353,_0x33ce7c);_0x52ae66=Math[_0x19e9('0x1c')](0x1,_0xf54a5d);_0x1aeb81=_0x967768>=_0x21729f||_0x967768<=_0x52ae66;}return _0x1aeb81;}}module[_0x19e9('0xb')][_0x19e9('0x1e')]=domCompare;function monthCompare(_0x105f9b,_0x1b78d6,_0x4ef6e4){var _0xd48b2d=_0x105f9b[_0x19e9('0x7')]('en')[_0x19e9('0x1f')](_0x19e9('0x20'))['toLowerCase']();return circularMonthInterval(_0x1b78d6,_0x4ef6e4)[_0x19e9('0x21')](_0xd48b2d);}module[_0x19e9('0xb')][_0x19e9('0x22')]=monthCompare;function iftime(_0x3e8391,_0x203575=moment['tz'][_0x19e9('0x23')](),_0x2ac4fe=moment()){if(!validateRx[_0x19e9('0x24')](_0x3e8391)){throw new Error(EINVALID_STRING);}else{var _0x2dcda0=(moment['isMoment'](_0x2ac4fe)?_0x2ac4fe[_0x19e9('0x10')]():moment(_0x2ac4fe))['tz'](_0x203575)['locale']('en');throwIfDateNotValid(_0x2dcda0);var _0x7b1664=_0x3e8391[_0x19e9('0x25')](',');var _0x5e27b2=_0x7b1664[0x0];var _0x19f010=_0x7b1664[0x1];var _0x52fd51=_0x7b1664[0x2];var _0x3b1e28=_0x7b1664[0x3];let _0x315842=!![];if(_0x5e27b2!=='*'){var _0x527e52=_0x5e27b2[_0x19e9('0x25')]('-');var _0x2f6729=_[_0x19e9('0x26')](_0x527e52[0x0],0x5,'0');var _0x44b048=_0x527e52[_0x19e9('0x27')]===0x2?_[_0x19e9('0x26')](_0x527e52[0x1],0x5,'0'):_0x2f6729;_0x315842=timeCompare(_0x2dcda0,_0x2f6729,_0x44b048);}let _0x4910c2=!![];if(_0x19f010!=='*'){var _0x1163d5=_0x19f010[_0x19e9('0x25')]('-');var _0x2e0363=_0x1163d5[0x0];var _0x4f099f=_0x1163d5[_0x19e9('0x27')]===0x2?_0x1163d5[0x1]:_0x2e0363;_0x4910c2=dowCompare(_0x2dcda0,_0x2e0363,_0x4f099f);}let _0x13e88c=!![];if(_0x52fd51!=='*'){var _0x58f1b9=_0x52fd51[_0x19e9('0x25')]('-');var _0x1ab49e=parseDom(_0x58f1b9[0x0]);var _0xc8fd77=_0x58f1b9[_0x19e9('0x27')]===0x2?parseDom(_0x58f1b9[0x1]):_0x1ab49e;_0x13e88c=domCompare(_0x2dcda0,_0x1ab49e,_0xc8fd77);}let _0x2f6f47=!![];if(_0x3b1e28!=='*'){var _0x47a8d0=_0x3b1e28[_0x19e9('0x25')]('-');var _0x415fd0=_0x47a8d0[0x0];var _0x3fba6a=_0x47a8d0[_0x19e9('0x27')]===0x2?_0x47a8d0[0x1]:_0x47a8d0[0x0];_0x2f6f47=monthCompare(_0x2dcda0,_0x415fd0,_0x3fba6a);}return _0x315842&&_0x4910c2&&_0x13e88c&&_0x2f6f47;}}module[_0x19e9('0xb')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 171f75b..7078c1d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b3a=['keys','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20magenta','bold\x20cyan','addColors','join','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x6bcab1,_0x14186b){var _0x3889d0=function(_0x484688){while(--_0x484688){_0x6bcab1['push'](_0x6bcab1['shift']());}};_0x3889d0(++_0x14186b);}(_0x1b3a,0x79));var _0xa1b3=function(_0x348a88,_0x141ba8){_0x348a88=_0x348a88-0x0;var _0x1f1ec7=_0x1b3a[_0x348a88];return _0x1f1ec7;};'use strict';var path=require(_0xa1b3('0x0'));var util=require(_0xa1b3('0x1'));var moment=require('moment');var winston=require(_0xa1b3('0x2'));var config=require(_0xa1b3('0x3'));var debugLevel=config[_0xa1b3('0x4')]?config[_0xa1b3('0x4')][_0xa1b3('0x5')]():_0xa1b3('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa1b3('0x7'),'error':_0xa1b3('0x8'),'warn':'bold\x20yellow','info':'white','print':_0xa1b3('0x9'),'success':'bold\x20green','http':'gray','verbose':_0xa1b3('0xa'),'debug':'bold\x20blue','silly':_0xa1b3('0xb')};winston[_0xa1b3('0xc')](XC_LOG_COLORS);function getLogFileName(_0x47d2c6,_0x60e21b,_0x52e366){var _0x5e562d=_0x47d2c6||'/var/log/xcally';return path[_0xa1b3('0xd')](_0x5e562d,util['format']('%s-%s.log',_0x60e21b,_0x52e366));}function formatter(_0x5629c2,_0xb826ac){_0xb826ac[_0xa1b3('0xe')]=_0xb826ac['message'][_0xa1b3('0xf')](/@@{/g,_0xa1b3('0x10'))[_0xa1b3('0xf')](/}@@/g,_0xa1b3('0x11'))[_0xa1b3('0xf')](/@{/g,'{{')[_0xa1b3('0xf')](/}@/g,'}}');return util[_0xa1b3('0x12')](_0xa1b3('0x13'),moment()['format'](_0xa1b3('0x14')),_0xb826ac[_0xa1b3('0x15')][_0xa1b3('0x16')](),_0x5629c2,_0xb826ac[_0xa1b3('0xe')]);}function fileFormat(_0x1cabd2,_0x4c8b18){_0x4c8b18[_0xa1b3('0xe')]=_0x4c8b18[_0xa1b3('0xe')][_0xa1b3('0xf')](/@@{/g,_0xa1b3('0x10'))['replace'](/}@@/g,'}}}')[_0xa1b3('0xf')](/@{/g,'{{')[_0xa1b3('0xf')](/}@/g,'}}');var _0x1b9a0e=_0x4c8b18['meta']&&Object[_0xa1b3('0x17')](_0x4c8b18[_0xa1b3('0x18')])['length']?'\x0a\x09'+JSON[_0xa1b3('0x19')](_0x4c8b18[_0xa1b3('0x18')]):'';return util[_0xa1b3('0x12')](_0xa1b3('0x1a'),moment()['format'](_0xa1b3('0x14')),_0x4c8b18[_0xa1b3('0x15')][_0xa1b3('0x16')](),_0x1cabd2,_0x4c8b18[_0xa1b3('0xe')],_0x1b9a0e);}function consoleLogger(){var _0x57c750=new winston[(_0xa1b3('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa1b3('0x1c'))][(_0xa1b3('0x1d'))]({'level':_0xa1b3('0x1e'),'json':![],'formatter':function(_0x2ea884){return formatter('',_0x2ea884);}})]});return _0x57c750;}function fileLogger(_0x3125e4,_0x60629b){var _0x154c26=new winston[(_0xa1b3('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa1b3('0x1c'))][(_0xa1b3('0x1f'))]({'name':util['format'](_0xa1b3('0x20'),_0x3125e4,_0xa1b3('0x21')),'filename':getLogFileName(_0x60629b,_0x3125e4,_0xa1b3('0x21')),'level':_0xa1b3('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58da15){return fileFormat(_0x3125e4,_0x58da15);}}),new winston[(_0xa1b3('0x1c'))][(_0xa1b3('0x1f'))]({'name':util[_0xa1b3('0x12')](_0xa1b3('0x20'),_0x3125e4,debugLevel),'filename':getLogFileName(_0x60629b,_0x3125e4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f7d26){return fileFormat(_0x3125e4,_0x2f7d26);}}),new winston[(_0xa1b3('0x1c'))][(_0xa1b3('0x1d'))]({'level':_0xa1b3('0x1e'),'json':![],'formatter':function(_0x3961ee){return fileFormat(_0x3125e4,_0x3961ee);}})]});return _0x154c26;}exports[_0xa1b3('0x22')]=consoleLogger;exports[_0xa1b3('0x23')]=fileLogger; \ No newline at end of file +var _0x40de=['../config/environment','debugLevel','toLowerCase','info','white','bold\x20white','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40de,0x8b));var _0xe40d=function(_0x4a5635,_0x443b90){_0x4a5635=_0x4a5635-0x0;var _0x18d602=_0x40de[_0x4a5635];return _0x18d602;};'use strict';var path=require('path');var util=require(_0xe40d('0x0'));var moment=require('moment');var winston=require('winston');var config=require(_0xe40d('0x1'));var debugLevel=config[_0xe40d('0x2')]?config[_0xe40d('0x2')][_0xe40d('0x3')]():_0xe40d('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':'redBG\x20white','error':'red','warn':'bold\x20yellow','info':_0xe40d('0x5'),'print':_0xe40d('0x6'),'success':'bold\x20green','http':_0xe40d('0x7'),'verbose':_0xe40d('0x8'),'debug':'bold\x20blue','silly':_0xe40d('0x9')};winston[_0xe40d('0xa')](XC_LOG_COLORS);function getLogFileName(_0x474278,_0x583571,_0x2e2ccf){var _0x565628=_0x474278||_0xe40d('0xb');return path[_0xe40d('0xc')](_0x565628,util[_0xe40d('0xd')](_0xe40d('0xe'),_0x583571,_0x2e2ccf));}function formatter(_0x494dec,_0x47ed66){_0x47ed66[_0xe40d('0xf')]=_0x47ed66[_0xe40d('0xf')][_0xe40d('0x10')](/@@{/g,_0xe40d('0x11'))[_0xe40d('0x10')](/}@@/g,_0xe40d('0x12'))[_0xe40d('0x10')](/@{/g,'{{')[_0xe40d('0x10')](/}@/g,'}}');return util[_0xe40d('0xd')](_0xe40d('0x13'),moment()[_0xe40d('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x47ed66[_0xe40d('0x14')][_0xe40d('0x15')](),_0x494dec,_0x47ed66[_0xe40d('0xf')]);}function fileFormat(_0x493cb3,_0x3a37d4){_0x3a37d4['message']=_0x3a37d4['message'][_0xe40d('0x10')](/@@{/g,_0xe40d('0x11'))['replace'](/}@@/g,_0xe40d('0x12'))[_0xe40d('0x10')](/@{/g,'{{')[_0xe40d('0x10')](/}@/g,'}}');var _0x537146=_0x3a37d4[_0xe40d('0x16')]&&Object[_0xe40d('0x17')](_0x3a37d4['meta'])[_0xe40d('0x18')]?'\x0a\x09'+JSON[_0xe40d('0x19')](_0x3a37d4[_0xe40d('0x16')]):'';return util['format'](_0xe40d('0x1a'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x3a37d4[_0xe40d('0x14')]['toUpperCase'](),_0x493cb3,_0x3a37d4[_0xe40d('0xf')],_0x537146);}function consoleLogger(){var _0x1e9a9e=new winston[(_0xe40d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe40d('0x1c'))][(_0xe40d('0x1d'))]({'level':_0xe40d('0x1e'),'json':![],'formatter':function(_0x5588f0){return formatter('',_0x5588f0);}})]});return _0x1e9a9e;}function fileLogger(_0x2f3b83,_0x8d98c7){var _0x5a0b15=new winston[(_0xe40d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xe40d('0xd')](_0xe40d('0x1f'),_0x2f3b83,_0xe40d('0x20')),'filename':getLogFileName(_0x8d98c7,_0x2f3b83,_0xe40d('0x20')),'level':_0xe40d('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35d0ea){return fileFormat(_0x2f3b83,_0x35d0ea);}}),new winston[(_0xe40d('0x1c'))][(_0xe40d('0x21'))]({'name':util[_0xe40d('0xd')](_0xe40d('0x1f'),_0x2f3b83,debugLevel),'filename':getLogFileName(_0x8d98c7,_0x2f3b83,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe78e82){return fileFormat(_0x2f3b83,_0xe78e82);}}),new winston[(_0xe40d('0x1c'))][(_0xe40d('0x1d'))]({'level':_0xe40d('0x1e'),'json':![],'formatter':function(_0x4931ad){return fileFormat(_0x2f3b83,_0x4931ad);}})]});return _0x5a0b15;}exports[_0xe40d('0x22')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 87ff675..9e5449e 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 _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x114bdf,_0x119ada){var _0x5658f6=function(_0xff3dc){while(--_0xff3dc){_0x114bdf['push'](_0x114bdf['shift']());}};_0x5658f6(++_0x119ada);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3a2889,_0x1ee764){_0x3a2889=_0x3a2889-0x0;var _0x12b9e9=_0x5f2f[_0x3a2889];return _0x12b9e9;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x5e240e,_0x40bc29){var _0xacc92f=function(_0x3af56c){while(--_0x3af56c){_0x5e240e['push'](_0x5e240e['shift']());}};_0xacc92f(++_0x40bc29);}(_0x66fa,0x117));var _0xa66f=function(_0x40491e,_0x4a2086){_0x40491e=_0x40491e-0x0;var _0x3e0619=_0x66fa[_0x40491e];return _0x3e0619;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c6c2ffc..c838581 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 _0xbaf0=['exports','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce'];(function(_0x5e54d4,_0x5f554f){var _0x5a3007=function(_0xee56cf){while(--_0xee56cf){_0x5e54d4['push'](_0x5e54d4['shift']());}};_0x5a3007(++_0x5f554f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x286ac2){return _0x286ac2==='{{'?_0x0baf('0x0'):_0x0baf('0x1');}function safeTemplate(_0x263f79){var _0x1688bc=_0x263f79;if(typeof _0x263f79===_0x0baf('0x2')){_0x1688bc=_0x263f79['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x0baf('0x3')](_0x263f79)){_0x1688bc=_0x263f79[_0x0baf('0x4')](function(_0x2d3fa5){return safeTemplate(_0x2d3fa5);});}else if(_[_0x0baf('0x5')](_0x263f79)){_0x1688bc=Object[_0x0baf('0x6')](_0x263f79)[_0x0baf('0x7')](function(_0x1a10b1,_0x2dcaac){_0x1a10b1[_0x2dcaac]=safeTemplate(_0x263f79[_0x2dcaac]);return _0x1a10b1;},{});}return _0x1688bc;}module[_0x0baf('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x293412,_0x22c2bd){var _0xc8d787=function(_0x277c09){while(--_0x277c09){_0x293412['push'](_0x293412['shift']());}};_0xc8d787(++_0x22c2bd);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index f6e7552..353f418 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 _0x4f4b=['env','pathExists','then','readJSON','updated','info','writeJSON','exports','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','NODE_PATH'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x4f4b,0x13a));var _0xb4f4=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4f4b[_0x311c35];return _0x5cc50c;};var fs=require('fs-extra');var path=require('path');var config=require(_0xb4f4('0x0'));var root=config[_0xb4f4('0x1')];var APP_JSON_PATH=path[_0xb4f4('0x2')](root,_0xb4f4('0x3'));var NODEPATH=path['resolve'](root,_0xb4f4('0x4'));function setLegacyLibsNodeEnvPath(_0x330c96){let _0x1b5e4c=![];if(Array[_0xb4f4('0x5')](_0x330c96[_0xb4f4('0x6')])){var _0x41ab15=_0x330c96[_0xb4f4('0x6')][_0xb4f4('0x7')](function(_0x418c28){return _0x418c28[_0xb4f4('0x8')]==='motion2';});if(_0x41ab15>-0x1){var _0xe39967=_0x330c96[_0xb4f4('0x6')][_0x41ab15];if(typeof _0xe39967['env'][_0xb4f4('0x9')]!=='string'){_0xe39967[_0xb4f4('0xa')]['NODE_PATH']=NODEPATH;_0x1b5e4c=!![];}}return{'appConfig':_0x330c96,'updated':_0x1b5e4c};}}function updateAppConfig(_0x5e4ce9){return fs[_0xb4f4('0xb')](APP_JSON_PATH)[_0xb4f4('0xc')](function(_0x14f963){if(_0x14f963){return fs[_0xb4f4('0xd')](APP_JSON_PATH)[_0xb4f4('0xc')](function(_0x39de90){var _0x39c85b=setLegacyLibsNodeEnvPath(_0x39de90);if(_0x39c85b[_0xb4f4('0xe')]){_0x5e4ce9[_0xb4f4('0xf')]('Updating\x20app.json');return fs[_0xb4f4('0x10')](APP_JSON_PATH,_0x39de90,{'spaces':0x2});}else{return Promise[_0xb4f4('0x2')]();}});}else{return Promise[_0xb4f4('0x2')]();}});}module[_0xb4f4('0x11')]=updateAppConfig; \ No newline at end of file +var _0xea11=['exports','fs-extra','path','../config/environment','root','server/app.json','resolve','legacy-libs','isArray','findIndex','name','motion2','env','string','NODE_PATH','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON'];(function(_0x472b7a,_0x21695b){var _0x3f9a3f=function(_0x3f86ab){while(--_0x3f86ab){_0x472b7a['push'](_0x472b7a['shift']());}};_0x3f9a3f(++_0x21695b);}(_0xea11,0x17b));var _0x1ea1=function(_0x1f2ab3,_0x4349d3){_0x1f2ab3=_0x1f2ab3-0x0;var _0x399942=_0xea11[_0x1f2ab3];return _0x399942;};var fs=require(_0x1ea1('0x0'));var path=require(_0x1ea1('0x1'));var config=require(_0x1ea1('0x2'));var root=config[_0x1ea1('0x3')];var APP_JSON_PATH=path['resolve'](root,_0x1ea1('0x4'));var NODEPATH=path[_0x1ea1('0x5')](root,_0x1ea1('0x6'));function setLegacyLibsNodeEnvPath(_0xe62d3){let _0x570574=![];if(Array[_0x1ea1('0x7')](_0xe62d3['apps'])){var _0x16626a=_0xe62d3['apps'][_0x1ea1('0x8')](function(_0x27a30b){return _0x27a30b[_0x1ea1('0x9')]===_0x1ea1('0xa');});if(_0x16626a>-0x1){var _0x3d901f=_0xe62d3['apps'][_0x16626a];if(typeof _0x3d901f[_0x1ea1('0xb')]['NODE_PATH']!==_0x1ea1('0xc')){_0x3d901f[_0x1ea1('0xb')][_0x1ea1('0xd')]=NODEPATH;_0x570574=!![];}}return{'appConfig':_0xe62d3,'updated':_0x570574};}}function updateAppConfig(_0xb3afcf){return fs[_0x1ea1('0xe')](APP_JSON_PATH)[_0x1ea1('0xf')](function(_0x4b2cf4){if(_0x4b2cf4){return fs[_0x1ea1('0x10')](APP_JSON_PATH)[_0x1ea1('0xf')](function(_0x313cea){var _0x3d1b02=setLegacyLibsNodeEnvPath(_0x313cea);if(_0x3d1b02['updated']){_0xb3afcf[_0x1ea1('0x11')](_0x1ea1('0x12'));return fs[_0x1ea1('0x13')](APP_JSON_PATH,_0x313cea,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x1ea1('0x5')]();}});}module[_0x1ea1('0x14')]=updateAppConfig; \ No newline at end of file